-
Notifications
You must be signed in to change notification settings - Fork 2
/
client.min.js
1 lines (1 loc) · 9.61 KB
/
client.min.js
1
var core=function(){"use strict";var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var n=function(){var e,n,t=new Promise(function(t,r){e=t,n=r});return arguments.length&&e(arguments[0]),t.resolve=e,t.reject=n,t};var t=Object.freeze({default:n,__moduleExports:n}),r=function e(n,t){return t instanceof Array&&(t=t.reduce(e,[])),(n=n||[]).concat(t)},o=Object.freeze({default:r,__moduleExports:r}),u=function(e,n){return n in e},c=Object.freeze({default:u,__moduleExports:u}),f=c&&u||c,i=function(e,n,t,r){return e.host&&e.host.nodeName&&(e=e.host),n.name&&(t=n,n=n.name),!f(e,n)&&Object.defineProperty(e,n,{value:t,writable:r}),e[n]},s=Object.freeze({default:i,__moduleExports:i}),a=t&&n||t,l=o&&r||o,d=s&&i||s,p=function(){},m=function e(n,t){return t=t||{},d(n=n||{},"emit",function(e,t,o){for(var u=n.on[e.split(".")[0]]||[],c=[],f=0;f<u.length;f++)u[f].ns&&o&&!o(u[f].ns)||c.push(r(u[f].isOnce?u.splice(f--,1)[0]:u[f],t));for(var f=0;f<n.on["*"].length;f++)c.push(r(n.on["*"][f],[e,t]));return c.reduce(l,[])},1),d(n,"once",function(e,t){return n.on(e,t,!0)},1),d(n,"off",function(e,t){o(n.on[e]||[],t),t&&t.ns&&delete n.on[e]["$"+t.ns];return n},1),d(n,"on",function(e,r,c){var f=e.split(".")[0],i=e.split(".")[1],s=n.on[f]=n.on[f]||[],a="function"==typeof r?r:0;return!a&&i?(a=n.on[f]["$"+i])?a:l(u(n,r)):a||i?a&&i?l((o(s,n.on[f]["$"+i]||-1),a)):!(!a||i)&&l(a):l(u(n,r));function l(e){return e.isOnce=c,e.type=f,i&&(n.on[f]["$"+(e.ns=i)]=e),s.push(e),(t.on||p)(e),e.next?e:n}},1),n.on["*"]=n.on["*"]||[],n;function r(e,t){return e.next?e.next(t):t instanceof Array?e.apply(n,t):e.call(n,t)}function o(e,n){for(var r=e.length;~--r;)n!=e[r]&&n!=e[r].fn&&n||(t.off||p)(e.splice(r,1)[0])}function u(n,t){var r=e((t=t||{}).base||a());return r.i=0,r.li=[],r.fn=t.fn,r.parent=n,r.source=t.fn?r.parent.source:r,r.on("stop",function(e){return r.type?r.parent.off(r.type,r):r.parent.off(r),r.reason=e}),r.each=function(e){var n=e.next?e:u(r,{fn:e});return r.li.push(n),n},r.pipe=function(e){return e(r)},r.map=function(e){return r.each(function(n,t,r){return r.next(e(n,t,r))})},r.filter=function(e){return r.each(function(n,t,r){return e(n,t,r)&&r.next(n)})},r.reduce=function(e,n){return r.each(function(t,r,o){return o.next(n=e(n,t,r,o))})},r.unpromise=function(){var e=u(r,{base:{},fn:function(n){return e.next(n)}});return r.li.push(e),e},r.next=function(e){return r.resolve&&r.resolve(e),r.li.length?r.li.map(function(n){return n.fn(e,n.i++,n)}):e},r.until=function(e){return e?e.each?e.each(r.stop):e.then?e.then(r.stop):e.call?r.filter(e).map(r.stop):0:0},r.off=function(e){return o(r.li,e),r},r.start=function(e){return r.until(e),r.source.emit("start"),r},r.stop=function(e){return r.source.emit("stop",e)},r[Symbol.asyncIterator]=function(){return{next:function(){return r.wait=new Promise(function(e){r.wait=!0,r.map(function(n,t,o){delete r.wait,r.off(o),e({value:n,done:!1})}),r.emit("pull",r)})}}},r}},h=Object.freeze({default:m,__moduleExports:m}),b="undefined"!=typeof window,y=Object.freeze({default:b,__moduleExports:b}),_=g;function g(e){return function(n){return n==e}}g.fn=function(e){return"function"==typeof e},g.str=function(e){return"string"==typeof e},g.num=function(e){return"number"==typeof e},g.obj=function(e){return"object"==typeof e},g.lit=function(e){return e.constructor==Object},g.bol=function(e){return"boolean"==typeof e},g.truthy=function(e){return 1==!!e},g.falsy=function(e){return 0==!!e},g.arr=function(e){return e instanceof Array},g.null=function(e){return null===e},g.def=function(e){return void 0!==e},g.in=function(e){return function(n){return!!e&&(e.indexOf?~e.indexOf(n):n in e)}},g.promise=function(e){return e instanceof Promise},g.stream=function(e){return!(!e||!e.next)};var v=Object.freeze({default:_,__moduleExports:_}),x=y&&b||y,j=v&&_||v;["red","green","bold","grey","strip"].forEach(function(e){!j.str(String.prototype[e])&&Object.defineProperty(String.prototype,e,{get:function(){return String(this)}})});var O=function(e){return e},E=Object.freeze({default:O,__moduleExports:O}),z=function(e){return function(){return e}},w=Object.freeze({default:z,__moduleExports:z}),S=function(e){return Object.keys(j.obj(e)||j.fn(e)?e:{})},k=Object.freeze({default:S,__moduleExports:S}),P=function(e){return 0===e?"0":e?j.fn(e)?""+e:j.obj(e)?JSON.stringify(e):String(e):""},$=Object.freeze({default:P,__moduleExports:P}),A=w&&z||w,D=k&&S||k,I=$&&P||$,N=function e(n,t){var r=arguments.length>1,o=j.fn(n)?[]:I(n).split(".").filter(Boolean),u=o.shift();return function(c,f){var i={};return c?j.num(n)||n?j.arr(n)?(n.map(function(n){var r=e(n)(c);null!=(r=j.fn(t)?t(r):null==r?t:r)&&e(n,j.fn(r)?A(r):r)(i)}),i):c[n]||!o.length?r?(c[n]=j.fn(t)?t(c[n],f):t,c):j.fn(n)?n(c):c[n]:r?(e(o.join("."),t)(c[u]?c[u]:c[u]={}),c):e(o.join("."))(c[u]):r?function(e,n){return D(e).map(function(n){delete e[n]}),D(n).map(function(t){e[t]=n[t]}),e}(c,t):c:void 0}},B=Object.freeze({default:N,__moduleExports:N}),G=B&&N||B,J=function(e,n){var t=1==arguments.length;return function(r){return r&&r.headers?t?G(e)(r.headers):G(e)(r.headers)==n:null}},U=Object.freeze({default:J,__moduleExports:J}),q=function(e){return e.__data__},C=Object.freeze({default:q,__moduleExports:q}),F=C&&q||C,H=K;function K(e){return function(n){return G(n)(e)}}K.parent=function(e){return F(this.parentNode)[e]};var L=Object.freeze({default:H,__moduleExports:H}),M=L&&H||L,Q=function(e){return e?D(e).map(M(e)):[]},R=Object.freeze({default:Q,__moduleExports:Q}),T={arr:function(e){return Array.prototype.slice.call(e,0)},obj:function(e){var n="id";return 1==arguments.length?(n=e,t):t.apply(this,arguments);function t(e,t,r){return 0===r&&(e={}),e[j.fn(n)?n(t,r):t[n]]=t,e}}};var V=T.arr,W=T.obj,X=Object.freeze({default:T,__moduleExports:T,arr:V,obj:W}),Y=X&&T||X,Z=function(){return function e(n){return function(t,r){if(!n.length)return 0;var o=n[0],u=G(o)(t)||"",c=G(o)(r)||"";return u<c?1:u>c?-1:e(n.slice(1))(t,r)}}(Y.arr(arguments))};var ee=Object.freeze({default:Z,__moduleExports:Z}),ne=function(e){return function(n){return n&&n.indexOf&&~n.indexOf(e)}},te=Object.freeze({default:ne,__moduleExports:ne}),re=te&&ne||te,oe={header:"text/plain",check:function(e){return!re(".html")(e.name)&&!re(".css")(e.name)&&j.str(e.body)}},ue=oe.header,ce=oe.check,fe=Object.freeze({default:oe,__moduleExports:oe,header:ue,check:ce}),ie=x?window:e,se=Object.freeze({default:ie,__moduleExports:ie}),ae=se&&ie||se,le=function(e){return function(n){if(!ae.console||!console.error.apply)return n;j.arr(arguments[2])&&(arguments[2]=arguments[2].length);var t=Y.arr(arguments),r="[err]["+(new Date).toISOString()+"]"+e;return t.unshift(r.red?r.red:r),console.error.apply(console,t),n}},de=Object.freeze({default:le,__moduleExports:le}),pe=function(e){return function(n){if(!ae.console||!console.log.apply)return n;j.arr(arguments[2])&&(arguments[2]=arguments[2].length);var t=Y.arr(arguments),r="[log]["+(new Date).toISOString()+"]"+e;return t.unshift(r.grey?r.grey:r),console.log.apply(console,t),n}},me=Object.freeze({default:pe,__moduleExports:pe}),he=function(e){return function(n){return n.split(e)}},be=Object.freeze({default:he,__moduleExports:he}),ye=be&&he||be,_e=E&&O||E,ge=je((x?(ae.location.search.match(/debug=(.*?)(&|$)/)||[])[1]:G("process.env.DEBUG")(ae))||""),ve=ge.split(",").map(ye("/")),xe=function(e){return"*"==ge||ve.some(function(e){return e=je(e).split("/"),function(n){return 1==n.length?n[0]==e[0]:2==n.length&&n[0]==e[0]&&n[1]==e[1]}}(e))?function(n){if(!ae.console||!console.log.apply)return n;j.arr(arguments[2])&&(arguments[2]=arguments[2].length);var t=Y.arr(arguments),r="[deb]["+(new Date).toISOString()+"]"+e;return t.unshift(r.grey?r.grey:r),console.log.apply(console,t),n}:_e};function je(e){return e.replace(/(\[|\])/g,"")}var Oe,Ee=Object.freeze({default:xe,__moduleExports:xe}),ze=h&&m||h,we=U&&J||U,Se=R&&Q||R,ke=ee&&Z||ee,Pe=fe&&oe||fe,$e=de&&le||de,Ae=me&&pe||me,De=Ee&&xe||Ee;return function(e){e.exports=function(e){void 0===e&&(e={});var t=e.aliases;return void 0===t&&(t={}),s("creating"),r.resources={},r.link=f(r),r.register=r,r.types=u(),c(ze(r),t);function r(e,t,o){return e?j.arr(e)?e.map(r):j.promise(e)?e.then(r).catch(i):j.obj(e)&&!e.name?r(Se(e)):j.fn(e)&&e.resources?r(Se(e.resources)):j.str(e)&&!t&&r.resources[e]?r.resources[e].body:!j.str(e)||t||r.resources[e]?j.str(e)&&t?n(r)({name:e,body:t,headers:o}):j.obj(e)?n(r)(e):(i("could not find or create resource",e),!1):void 0:r}};var n=function(e){return function(r){var o=r.name,u=r.body,c=r.headers;if(void 0===c&&(c={}),o=e.aliases.src[o]||o,j.promise(u))return u.then(function(t){return n(e)({name:o,body:t,headers:c})}).catch(i);a("registering",o);var f=t(e)({name:o,body:u,headers:c});return f?(e.resources[o]=f,e.emit("change",[o,{type:"update",value:f.body,time:l(f)}]),e.resources[o].body):(i("failed to register",o),!1)}},t=function(e){return function(n){return we("content-type")(n)||Se(e.types).sort(ke("priority")).some(o(n)),we("content-type")(n)?r(e)(n):(i("could not understand resource",n),!1)}},r=function(e){return function(n){var t=we("content-type")(n);return e.types[t]?(e.types[t].parse||_e)(n):(i("could not understand type",t),!1)}},o=function(e){return function(n){return n.check(e)&&(e.headers["content-type"]=n.header)}},u=function(){return[Pe].reduce(Y.obj("header"),1)},c=function(e,n){for(var t in e.aliases={dst:{},src:{}},n)e.link(n[t],t);return e},f=function(e){return function(n,t){n in e.resources&&t==e.aliases.src[n]||(e.aliases.src[n]=t,e.aliases.dst[t]=n,Object.defineProperty(e.resources,n,{get:function(){return e.resources[t]},set:function(n){e.resources[t]=n},configurable:!0}))}},i=$e("[ri/core]"),s=Ae("[ri/core]"),a=De("[ri/core]"),l=function(e,n){return n=G("body.log.length")(e),j.num(n)?n-1:n}}(Oe={exports:{}},Oe.exports),Oe.exports}();