rescope
Version:
Flexible state management system based on flux architecture, stores data components & inheritable scopes
2 lines • 43.3 kB
JavaScript
!function(t){function e(r){if(n[r])return n[r].exports;var i=n[r]={exports:{},id:r,loaded:!1};return t[r].call(i.exports,i,i.exports,e),i.loaded=!0,i.exports}var n={};return e.m=t,e.c=n,e.p="/",e(0)}([function(t,e,n){(function(r){"use strict";function i(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var s=n(3),o=i(s),a=n(5),u=i(a),c=n(8),l=i(c),h=n(10),f="undefined"!=typeof window?window:r;f.___rescope||(f.___rescope=o.default,u.default.Store=l.default,o.default.Scope=u.default,o.default.Context=u.default,o.default.Store=l.default,o.default.reScope=h.reScope,o.default.scopeToState=h.scopeToState,o.default.reScopeState=h.scopeToState,o.default.addScopableType=h.addScopableType,o.default.scopeRef=function(t,e){return t[e]=new u.default.scopeRef(t[e]),t}),e.default=f.___rescope||o.default,t.exports=e.default}).call(e,function(){return this}())},function(t,e){"use strict";var n,r=Object.prototype,i=r.hasOwnProperty,s=r.toString;"function"==typeof Symbol&&(n=Symbol.prototype.valueOf);var o=function(t){return t!==t},a={boolean:1,number:1,string:1,undefined:1},u=/^([A-Za-z0-9+\/]{4})*([A-Za-z0-9+\/]{4}|[A-Za-z0-9+\/]{3}=|[A-Za-z0-9+\/]{2}==)$/,c=/^[A-Fa-f0-9]+$/,l={};l.a=l.type=function(t,e){return typeof t===e},l.defined=function(t){return"undefined"!=typeof t},l.empty=function(t){var e,n=s.call(t);if("[object Array]"===n||"[object Arguments]"===n||"[object String]"===n)return 0===t.length;if("[object Object]"===n){for(e in t)if(i.call(t,e))return!1;return!0}return!t},l.equal=function(t,e){if(t===e)return!0;var n,r=s.call(t);if(r!==s.call(e))return!1;if("[object Object]"===r){for(n in t)if(!(l.equal(t[n],e[n])&&n in e))return!1;for(n in e)if(!(l.equal(t[n],e[n])&&n in t))return!1;return!0}if("[object Array]"===r){if(n=t.length,n!==e.length)return!1;for(;n--;)if(!l.equal(t[n],e[n]))return!1;return!0}return"[object Function]"===r?t.prototype===e.prototype:"[object Date]"===r&&t.getTime()===e.getTime()},l.hosted=function(t,e){var n=typeof e[t];return"object"===n?!!e[t]:!a[n]},l.instance=l.instanceof=function(t,e){return t instanceof e},l.nil=l.null=function(t){return null===t},l.undef=l.undefined=function(t){return"undefined"==typeof t},l.args=l.arguments=function(t){var e="[object Arguments]"===s.call(t),n=!l.array(t)&&l.arraylike(t)&&l.object(t)&&l.fn(t.callee);return e||n},l.array=Array.isArray||function(t){return"[object Array]"===s.call(t)},l.args.empty=function(t){return l.args(t)&&0===t.length},l.array.empty=function(t){return l.array(t)&&0===t.length},l.arraylike=function(t){return!!t&&!l.bool(t)&&i.call(t,"length")&&isFinite(t.length)&&l.number(t.length)&&t.length>=0},l.bool=l.boolean=function(t){return"[object Boolean]"===s.call(t)},l.false=function(t){return l.bool(t)&&Boolean(Number(t))===!1},l.true=function(t){return l.bool(t)&&Boolean(Number(t))===!0},l.date=function(t){return"[object Date]"===s.call(t)},l.date.valid=function(t){return l.date(t)&&!isNaN(Number(t))},l.element=function(t){return void 0!==t&&"undefined"!=typeof HTMLElement&&t instanceof HTMLElement&&1===t.nodeType},l.error=function(t){return"[object Error]"===s.call(t)},l.fn=l.function=function(t){var e="undefined"!=typeof window&&t===window.alert;if(e)return!0;var n=s.call(t);return"[object Function]"===n||"[object GeneratorFunction]"===n||"[object AsyncFunction]"===n},l.number=function(t){return"[object Number]"===s.call(t)},l.infinite=function(t){return t===1/0||t===-(1/0)},l.decimal=function(t){return l.number(t)&&!o(t)&&!l.infinite(t)&&t%1!==0},l.divisibleBy=function(t,e){var n=l.infinite(t),r=l.infinite(e),i=l.number(t)&&!o(t)&&l.number(e)&&!o(e)&&0!==e;return n||r||i&&t%e===0},l.integer=l.int=function(t){return l.number(t)&&!o(t)&&t%1===0},l.maximum=function(t,e){if(o(t))throw new TypeError("NaN is not a valid value");if(!l.arraylike(e))throw new TypeError("second argument must be array-like");for(var n=e.length;--n>=0;)if(t<e[n])return!1;return!0},l.minimum=function(t,e){if(o(t))throw new TypeError("NaN is not a valid value");if(!l.arraylike(e))throw new TypeError("second argument must be array-like");for(var n=e.length;--n>=0;)if(t>e[n])return!1;return!0},l.nan=function(t){return!l.number(t)||t!==t},l.even=function(t){return l.infinite(t)||l.number(t)&&t===t&&t%2===0},l.odd=function(t){return l.infinite(t)||l.number(t)&&t===t&&t%2!==0},l.ge=function(t,e){if(o(t)||o(e))throw new TypeError("NaN is not a valid value");return!l.infinite(t)&&!l.infinite(e)&&t>=e},l.gt=function(t,e){if(o(t)||o(e))throw new TypeError("NaN is not a valid value");return!l.infinite(t)&&!l.infinite(e)&&t>e},l.le=function(t,e){if(o(t)||o(e))throw new TypeError("NaN is not a valid value");return!l.infinite(t)&&!l.infinite(e)&&t<=e},l.lt=function(t,e){if(o(t)||o(e))throw new TypeError("NaN is not a valid value");return!l.infinite(t)&&!l.infinite(e)&&t<e},l.within=function(t,e,n){if(o(t)||o(e)||o(n))throw new TypeError("NaN is not a valid value");if(!l.number(t)||!l.number(e)||!l.number(n))throw new TypeError("all arguments must be numbers");var r=l.infinite(t)||l.infinite(e)||l.infinite(n);return r||t>=e&&t<=n},l.object=function(t){return"[object Object]"===s.call(t)},l.primitive=function(t){return!t||!("object"==typeof t||l.object(t)||l.fn(t)||l.array(t))},l.hash=function(t){return l.object(t)&&t.constructor===Object&&!t.nodeType&&!t.setInterval},l.regexp=function(t){return"[object RegExp]"===s.call(t)},l.string=function(t){return"[object String]"===s.call(t)},l.base64=function(t){return l.string(t)&&(!t.length||u.test(t))},l.hex=function(t){return l.string(t)&&(!t.length||c.test(t))},l.symbol=function(t){return"function"==typeof Symbol&&"[object Symbol]"===s.call(t)&&"symbol"==typeof n.call(t)},t.exports=l},function(t,e,n){"use strict";function r(){f=!1}function i(t){if(!t)return void(l!==_&&(l=_,r()));if(t!==l){if(t.length!==_.length)throw new Error("Custom alphabet for shortid must be "+_.length+" unique characters. You submitted "+t.length+" characters: "+t);var e=t.split("").filter(function(t,e,n){return e!==n.lastIndexOf(t)});if(e.length)throw new Error("Custom alphabet for shortid must be "+_.length+" unique characters. These characters were not unique: "+e.join(", "));l=t,r()}}function s(t){return i(t),l}function o(t){p.seed(t),h!==t&&(r(),h=t)}function a(){l||i(_);for(var t,e=l.split(""),n=[],r=p.nextValue();e.length>0;)r=p.nextValue(),t=Math.floor(r*e.length),n.push(e.splice(t,1)[0]);return n.join("")}function u(){return f?f:f=a()}function c(t){var e=u();return e[t]}var l,h,f,p=n(17),_="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-";t.exports={characters:s,seed:o,lookup:c,shuffled:u}},function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default={},t.exports=e.default},function(t,e,n){"use strict";function r(t){if(Array.isArray(t)){for(var e=0,n=Array(t.length);e<t.length;e++)n[e]=t[e];return n}return Array.from(t)}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var s=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),o=n(1),a=function(){function t(){i(this,t),this._events={}}return s(t,[{key:"on",value:function(t,e){var n=this;return!o.string(t)&&t?Object.keys(t).forEach(function(e){return n.on(e,t[e])}):(this._events[t]=this._events[t]||[],void this._events[t].push(e))}},{key:"un",value:function(t,e){var n=this;if(!o.string(t)&&t)return Object.keys(t).forEach(function(e){return n.un(e,t[e])});if(this._events[t]){var r=this._events[t].indexOf(e);this._events[t].splice(r,1)}}},{key:"emit",value:function(t){if(this._events[t]){for(var e=[].concat(r(this._events[t])),n=arguments.length,i=Array(n>1?n-1:0),s=1;s<n;s++)i[s-1]=arguments[s];for(var o=0;o<e.length;o++)e[o].apply(e,i)}}},{key:"addListener",value:function(){this.on.apply(this,arguments)}},{key:"removeListener",value:function(){this.un.apply(this,arguments)}},{key:"removeAllListeners",value:function(){this._events={}}},{key:"once",value:function(t,e){var n=this,r=void 0;this.on(t,r=function(){n.un(t,r),e.apply(void 0,arguments)})}}]),t}();e.default=a,t.exports=e.default},function(t,e,n){"use strict";function r(t){if(Array.isArray(t)){for(var e=0,n=Array(t.length);e<t.length;e++)n[e]=t[e];return n}return Array.from(t)}function i(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function s(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var u=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),c=n(1),l=n(4),h=n(6),f=function(t,e,n){var r=function(){};r.prototype=n?new n._[e]:t[e]||{},t[e]=new r,t._[e]=r},p={},_=({}.constructor,function(t){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=n.parent,i=n.key,a=n.id,u=n.state,l=n.data,_=n.incrementId,d=void 0===_?!!i:_,v=n.persistenceTm,y=n.autoDestroy,b=n.rootEmitter,m=n.boundedActions;s(this,e);var g=o(this,(e.__proto__||Object.getPrototypeOf(e)).call(this)),w={};if(a=a||i&&(r&&r._id||"")+"::"+i,w.isLocalId=!a,a=a||"_____"+h.generate(),p[a]&&!d){var k;return g._id=a,p[a].register(t),k=p[a],o(g,k)}if(p[a]&&d){for(var S=-1;p[a+"["+ ++S+"]"];);a=a+"["+S+"]"}if(g._id=a,p[a]=g,w.persistenceTm=v||g.constructor.persistenceTm,g.actions={},g.stores={},g.state={},g.data={},g.parent=r,g._=w,r&&r.dead)throw new Error("Can't use a dead scope as parent !");return f(g,"actions",r),f(g,"stores",r),f(g,"state",r),f(g,"data",r),g.sources=[],w.childScopes=[],w.childScopesList=[],w.unStableChilds=0,g.__retains={all:0},g.__locks={all:1},w._boundedActions=c.array(m)?{test:m.includes.bind(m)}:m,w._listening={},w._scope={},w._mixed=[],w._mixedList=[],w.followers=[],r&&(r.retain("isMyParent"),b?r.on(w._parentList={update:function(t){return g._propag()}}):(!r._stable&&g.wait("waitingParent"),r.on(w._parentList={stable:function(t){return g.release("waitingParent")},unstable:function(t){return g.wait("waitingParent")},update:function(t){return g._propag()}}))),g.register(t,u,l),g.__locks.all--,g._stable=!g.__locks.all,r&&r._addChild(g),y&&setTimeout(function(t){g.retain("autoDestroy"),g.dispose("autoDestroy")}),g}return a(e,t),u(e,null,[{key:"getScope",value:function(t){var n=c.array(t)?t.sort(function(t,e){return t.firstname<e.firstname?-1:t.firstname>e.firstname?1:0}).join("::"):t;return p[n]=p[n]||new e({},{id:n})}},{key:"stateMapToRefList",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"";return Object.keys(t).forEach(function(o){var a=s?s+"."+o:o;t[o]instanceof e.scopeRef?r.push(t[o].path+":"+a):t[o]&&t[o]instanceof Function?i[o]=t[o]:t[o]&&t[o].prototype instanceof e.Store?r.push(t[o].as(a)):n[a]=t[o]}),r}}]),u(e,[{key:"mount",value:function(t,e,n,r){var i=this;return c.array(t)?t.forEach(function(t){return i._mount(t,e,n,r)}):this._mount.apply(this,arguments),this}},{key:"_mount",value:function(t,e,n,r){if("string"!=typeof t&&(this.register(i({},t.name,t.store)),t=t.name),!this._._scope[t]){var s;if(this._._mixed.reduce(function(i,s){return i||s._mount(t,e,n,r)},!1)||!this.parent)return;return(s=this.parent)._mount.apply(s,arguments)}var o=this._._scope[t];return c.fn(o)?this._._scope[t]=new o(this,{snapshot:e,name:t,state:n,data:r}):e?o.restore(e):(void 0!==n&&void 0===r?o.setState(n):void 0!==n&&(o.state=n),void 0!==r&&o.push(r)),this._watchStore(t),this._._scope[t]}},{key:"_watchStore",value:function(t,e,n){var r=this;return this._._listening[t]||c.fn(this._._scope[t])||(!this._._scope[t]._autoDestroy&&this._._scope[t].retain("scoped"),!this._._scope[t].isStable()&&this.wait(t),this._._scope[t].on(this._._listening[t]={destroy:function(e){delete r._._listening[t],r._._scope[t]=r._._scope[t].constructor},update:function(t){return r.propag()},stable:function(e){return r.release(t)},unstable:function(e){return r.wait(t)}})),!0}},{key:"mixin",value:function(t){var e=this,n=this.parent,r=void 0;this._._mixed.push(t),t.retain("mixedTo"),t._stable||this.wait(t._id),this._._mixedList.push(r={stable:function(n){return e.release(t._id)},unstable:function(n){return e.wait(t._id)},update:function(t){return e._propag()}}),this.actions={},this.stores={},this.state={},this.data={},t.on(r),f(this,"actions",n),f(this,"stores",n),f(this,"state",n),f(this,"data",n),this.relink(this._._scope,this,!1,!0),this._._mixed.forEach(function(t){f(e,"actions"),f(e,"stores"),f(e,"state"),f(e,"data"),t.relink(t._._scope,e,!0,!0)})}},{key:"register",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};this.relink(t,this,!1,!1),Object.keys(t).forEach(function(i){t[i].singleton||c.fn(t[i])&&(n[i]||r[i])?e._mount(i,void 0,n[i],r[i]):n[i]||r[i]?r[i]?(n[i]&&(e.stores[i].state=n[i]),e.stores[i].push(r[i])):n[i]&&e.stores[i].setState(n[i]):e._watchStore(i)})}},{key:"relink",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this,r=this,i=arguments[2],s=arguments[3],o=n._.stores.prototype;Object.keys(t).forEach(function(a){if(!(!s&&n._._scope[a]===t[a]||n._._scope[a]&&n._._scope[a].constructor===t[a])){if(!s&&n._._scope[a])return i||c.fn(n._._scope[a])||(n._._scope[a].__proto__=t[a].prototype),void(!i&&c.fn(n._._scope[a])&&(n._._scope[a]=t[a]));s||i||(r._._scope[a]=t[a]),Object.defineProperty(o,a,{enumerable:!0,get:function(){return r._._scope[a]}}),Object.defineProperty(n._.state.prototype,a,{enumerable:!0,get:function(){return r._._scope[a]&&r._._scope[a].state},set:function(t){return r._mount(a,void 0,t)}}),Object.defineProperty(n._.data.prototype,a,{enumerable:!0,get:function(){return r._._scope[a]&&r._._scope[a].data},set:function(t){return r._mount(a,void 0,t)}});var u=t[a]instanceof e.Store?t[a].constructor.actions:t[a].actions,l=n._.actions.prototype;u&&Object.keys(u).forEach(function(t){l.hasOwnProperty(t)?l[t].__targetStores++:(l[t]=r.dispatch.bind(r,t),l[t].__targetStores=1)})}})}},{key:"bind",value:function(t,e,n){var r=this,s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],o=void 0,a=void 0,u=void 0;if(e&&!c.array(e)&&(e=[e]),n!==!1&&n!==!0||(s=n,n=null),u=e.map(function(t){return c.string(t)?t:t.name}).map(function(t){return r.parseRef(t)}),this._.followers.push([t,e,n||void 0,o=u.reduce(function(t,e){return t[e.storeId]=t[e.storeId]||{rev:0,refs:[]},t[e.storeId].refs.push(e),t},{})]),this.mount(e),this.retainStores(Object.keys(o),"listeners"),s&&this._stable){if(a=this.getUpdates(o),!a)return;"function"!=typeof t?n?t.setState(i({},n,a)):t.setState(a):t(a)}return this}},{key:"unBind",value:function(t,e,n){for(var r=this._.followers,i=r&&r.length;r&&i--;)if(r[i][0]===t&&""+r[i][1]==""+e&&r[i][2]==n)return this.disposeStores(Object.keys(r[i][3]),"listeners"),r.splice(i,1)}},{key:"map",value:function(t,e){var n=this,r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],i=this.constructor.Store;e=c.array(e)?e:[e];var s=e.map(this.parseRef);if(this.mount(s.map(function(t){return t.storeId})),r&&t instanceof i)i.map(t,e,this,this,!1);else if(r){this.bind(t,e,void 0,!1);var o=void 0,a=t.isReactComponent?"componentWillUnmount":"destroy";t.hasOwnProperty(a)&&(o=t[a]),t[a]=function(){return delete t[a],o&&(t[a]=o),n.unBind(t,e),t[a]&&t[a].apply(t,arguments)}}return e.reduce(function(t,e){return c.string(e)||(e=e.name),e=e.split(":"),e[0]=e[0].split("."),t[e[1]||e[0][e[0].length-1]]=n.stores[e[0][0]]&&n.stores[e[0][0]].retrieve&&n.stores[e[0][0]].retrieve(e[0].splice(1)),t},{})}},{key:"retrieve",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return t=c.string(t)?t.split("."):t,t&&this.stores[t[0]]&&this.stores[t[0]].retrieve(t.slice(1))}},{key:"getStoresRevs",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments[1],n=this._._scope;return t||(t={}),Object.keys(n).forEach(function(e){c.fn(n[e])?t.hasOwnProperty(e)||(t[e]=!1):t[e]=n[e]._rev}),e||(this._._mixed.reduce(function(e,n){return n.getStoresRevs(t),t},t),this.parent&&this.parent.getStoresRevs(t)),t}},{key:"getUpdates",value:function(t,e,n){var r=this,i=this._._scope;return e=e||{},Object.keys(i).forEach(function(s){e.hasOwnProperty(s)||c.fn(i[s])||t&&(!t.hasOwnProperty(s)||void 0!==t[s])&&(!t.hasOwnProperty(s)||i[s]._rev<=t[s].rev)||(n=!0,e[s]=r.data[s],t&&t.hasOwnProperty(s)?(t[s].rev=i[s]._rev,t[s].refs.forEach(function(t){e[t.alias]=r.retrieve(t.path)})):e[s]=r.data[s])}),n=this._._mixed.reduce(function(n,r){return r.getUpdates(t,e,n)||n},n),n=this.parent&&this.parent.getUpdates(t,e,n)||n,n&&e}},{key:"_getAllChilds",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return t.push.apply(t,r(this._.childScopes)),this._.childScopes.forEach(function(e){e._getAllChilds(t)}),t}},{key:"serialize",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.alias,r=e.withChilds,i=void 0===r||r,s=e.withParents,o=e.withMixed,a=void 0===o||o,u=e.norefs,l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},h=this._._scope;if(!l[this._id])return l[this._id]={},Object.keys(h).forEach(function(t){c.fn(h[t])||h[t].serialize(!u,l)}),s&&this.parent&&this.parent.serialize({withChild:!1,withParents:!0,withMixed:a,norefs:u},l),i&&this._.childScopes.forEach(function(t){!t._.isLocalId&&t.serialize({withChild:!0,withParents:!1,withMixed:a,norefs:u},l)}),a&&this._._mixed.forEach(function(t){!t._.isLocalId&&t.serialize({withChild:!1,withParents:!1,withMixed:a,norefs:u},l)}),n&&(l=Object.keys(l).reduce(function(e,r){return e[r.replace(t._id,n)]=l[r],e},{})),l}},{key:"restore",value:function(t,e){var n=this,r=this._._scope;t[this._id]&&Object.keys(r).forEach(function(i){var s=t[n._id+"/"+i];s&&(e&&!c.fn(r[i])&&r[i].destroy(),n.mount(i,t))}),this._._mixed.forEach(function(n){!n._.isLocalId&&n.restore(t,e)}),this._.childScopes.forEach(function(n){!n._.isLocalId&&n.restore(t,e)})}},{key:"parseRef",value:function(t){var e=t.split(":");return e[0]=e[0].split("."),{storeId:e[0][0],path:e[0],alias:e[1]||e[0][e[0].length-1],ref:t}}},{key:"dispatch",value:function(t){for(var e,n=this,r=arguments.length,i=Array(r>1?r-1:0),s=1;s<r;s++)i[s-1]=arguments[s];if(!this.dead){var o=this._._boundedActions;if(Object.keys(this._._scope).forEach(function(e){var r;c.fn(n._._scope[e])||(r=n._._scope[e]).trigger.apply(r,[t].concat(i))}),!o||!o.test(t))return this._._mixed.forEach(function(e){return e.dispatch.apply(e,[t].concat(i))}),this.parent&&(e=this.parent).dispatch.apply(e,[t].concat(i)),this}}},{key:"then",value:function(t){var e=this;return this._stable?t(null,this.data):void this.once("stable",function(n){return t(null,e.data)})}},{key:"retainStores",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=arguments[1];e.forEach(function(e){return t.stores[e]&&t.stores[e].retain&&t.stores[e].retain(n)})}},{key:"disposeStores",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=arguments[1];e.forEach(function(e){return t.stores[e]&&t.stores[e].dispose&&t.stores[e].dispose(n)})}},{key:"wait",value:function(t){this._stable&&!this.__locks.all&&this.emit("unstable",this),this._stable=!1,this.__locks.all++,t&&(this.__locks[t]=this.__locks[t]||0,this.__locks[t]++)}},{key:"release",value:function(t){var e=this;t&&(0==this.__locks[t],this.__locks[t]=this.__locks[t]||0,this.__locks[t]--),!t&&0==this.__locks.all,this.__locks.all--,this.__locks.all||(this._.stabilizerTM&&clearTimeout(this._.stabilizerTM),this._.stabilizerTM=setTimeout(function(t){e._.stabilizerTM=null,e.__locks.all||(e._.propagTM&&clearTimeout(e._.propagTM),e._stable=!0,e.emit("stable",e),!e.dead&&e._propag())}))}},{key:"propag",value:function(){var t=this;this._.propagTM&&clearTimeout(this._.propagTM),this._.propagTM=setTimeout(function(e){t._.propagTM=null,t._propag()},2)}},{key:"_propag",value:function(){var t=this;this._.followers.length&&this._.followers.forEach(function(e){var n=e[0],s=(e[1],e[2]),o=e[3],a=(e[3],t.getUpdates(o));a&&("function"!=typeof n?s?n.setState(i({},s,a)):n.setState(a):n(a,o&&[].concat(r(o))||"no revs"))}),this.emit("update",this.getUpdates())}},{key:"isStable",value:function(){return this._stable}},{key:"_addChild",value:function(t){var e=this;this._.childScopes.push(t);var n={stable:function(t){e._.unStableChilds--,e._.unStableChilds||e.emit("stableTree",e)},unstable:function(t){e._.unStableChilds++,1==e._.unStableChilds&&e.emit("unstableTree",e)},stableTree:function(t){e._.unStableChilds--,e._.unStableChilds||e.emit("stableTree",e)},unstableTree:function(t){e._.unStableChilds++,1==e._.unStableChilds&&e.emit("unstableTree",e)},destroy:function(t){t._.unStableChilds&&e._.unStableChilds--,t.isStable()||e._.unStableChilds--,e._.unStableChilds||e.emit("stableTree",e)}},r=this._.unStableChilds;!t.isStable()&&this._.unStableChilds++,t._.unStableChilds&&this._.unStableChilds++,this._.childScopesList.push(n),!r&&this._.unStableChilds&&this.emit("unstableTree",this),t.on(n)}},{key:"_rmChild",value:function(t){var e=this._.childScopes.indexOf(t),n=this._.unStableChilds;e!=-1&&(this._.childScopes.splice(e,1),!t.isStable()&&this._.unStableChilds--,t._.unStableChilds&&this._.unStableChilds--,t.un(this._.childScopesList.splice(e,1)[0]),n&&!this._.unStableChilds&&this.emit("stableTree"))}},{key:"retain",value:function(t){this.__retains.all++,t&&(this.__retains[t]=this.__retains[t]||0,this.__retains[t]++)}},{key:"dispose",value:function(t){var e=this;if(t){if(!this.__retains[t])throw new Error("Dispose more than retaining : "+t);this.__retains[t]--}if(!this.__retains.all)throw new Error("Dispose more than retaining !");this.__retains.all--,this.__retains.all||(this._.persistenceTm?(this._.destroyTM&&clearTimeout(this._.destroyTM),this._.destroyTM=setTimeout(function(t){!e.__retains.all&&e.destroy()},this._.persistenceTm)):!this.__retains.all&&this.destroy())}},{key:"destroy",value:function(){var t=this,e=this._._scope;this.emit("destroy",this);for(var n in e)c.fn(e[n])||!e[n]._autoDestroy&&e[n].dispose("scoped");for(this.dead=!0,[].concat(r(this._.followers)).map(function(e){return t.unBind.apply(t,r(e))}),Object.keys(this._._listening).forEach(function(e){return t._._scope[e].removeListener(t._._listening[e])}),this._.stabilizerTM&&clearTimeout(this._.stabilizerTM),this._.propagTM&&clearTimeout(this._.propagTM),this._.isLocalId||delete p[this._id];this._._mixedList.length;)this._._mixed[0].removeListener(this._._mixedList.shift()),this._._mixed.shift().dispose("mixedTo");this._._parentList&&(this.parent._rmChild(this),this.parent.removeListener(this._._parentList),this.parent.dispose("isMyParent"),this._._parentList=null),this._=null}},{key:"datas",get:function(){return this.data}}]),e}(l));_.persistenceTm=1,_.Store=null,_.scopeRef=function(t){this.path=t},_.scopes=p,e.default=_,t.exports=e.default},function(t,e,n){"use strict";t.exports=n(14)},function(t,e,n){"use strict";function r(t,e){for(var n,r=0,s="";!n;)s+=t(e>>4*r&15|i()),n=e<Math.pow(16,r+1),r++;return s}var i=n(16);t.exports=r},function(t,e,n){"use strict";function r(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function i(t){if(Array.isArray(t)){for(var e=0,n=Array(t.length);e<t.length;e++)n[e]=t[e];return n}return Array.from(t)}function s(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var u=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},c=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),l=function t(e,n,r){null===e&&(e=Function.prototype);var i=Object.getOwnPropertyDescriptor(e,n);if(void 0===i){var s=Object.getPrototypeOf(e);return null===s?void 0:t(s,n,r)}if("value"in i)return i.value;var o=i.get;return void 0!==o?o.call(r):void 0},h=n(1),f=n(5),p=n(4),_=n(9),d=n(6),v=Object.getPrototypeOf({}),y=function(t){function e(){var t,n;s(this,e);var r,a=o(this,(e.__proto__||Object.getPrototypeOf(e)).call(this)),c=[].concat(Array.prototype.slice.call(arguments)),l=a.constructor,p=c[0]instanceof f?c.shift():l.scope?f.getScope(l.scope):h.string(c[0])?f.getScope(c.shift()):l.staticScope,_=!c[0]||h.array(c[0])||h.string(c[0])?{}:c.shift(),v=h.string(c[0])?c[0]:_.name||l.name,y=h.array(c[0])?c.shift():_.use||[],b=h.fn(c[0])?c.shift():_.apply||null,m=l.state||l.initialState||l.defaultState;return a._uid=_._uid||d.generate(),a.__retains={all:0},a.__locks={all:0},a._onStabilize=[],a._autoDestroy=!!a._persistenceTm,a._persistenceTm=_.persistenceTm||l.persistenceTm||(_.autoDestroy||l.autoDestroy)&&5,_&&_.on&&a.on(_.on),a.name=v,p.stores?(a.scopeObj=p,a.scope=p.stores):(a.scopeObj=new f(p),a.scope=p.stores),a.$scope=a.scopeObj,a.$stores=a.scopeObj.stores,a.$actions=a.scopeObj.actions,a.$dispatch=a.scopeObj.dispatch.bind(a.scopeObj),a._rev=a.constructor._rev||0,a._revs={},a.stores={},a._require=[],a._sources=[v],h.array(l.use)?a._use=[].concat(i(y),i((l.use||[]).map(function(t){var e=t.match(/^(\!?)([^\:]*)(?:\:(.*))?$/);if(e[1]){var n=e[2].split(".");a._require.push(e[3]||n[n.length-1])}return e[2]}))):a._use=[].concat(i(y),i(l.use?Object.keys(l.use).map(function(t){var e=t.match(/^(\!?)(.*)$/);return e[1]&&a._require.push(l.use[t]),e[2]+(l.use[t]===!0?"":":"+l.use[t])}):[])),l.require&&(t=a._require).push.apply(t,i(l.require)),_.require&&(n=a._require).push.apply(n,i(_.require)),a._followers=[],a._changesSW={},b&&(a.apply=b),_.snapshot&&_.snapshot[a.scopeObj._id+"/"+v]?(a.restore(_.snapshot),a._stable=!0,p.bind(a,a._use,!1)):(void 0!==l.data&&(a.data=u({},l.data)),_.hasOwnProperty("data")&&void 0!==_.data&&(a.data=_.data),_.hasOwnProperty("state")&&void 0!==_.state&&(m=u({},m,_.state)),(m||a._use.length)&&(a._changesSW=u({},m||{},p.map(a,a._use)),a.state={},a.shouldApply(a._changesSW)&&void 0===a.data&&(a.data=a.apply(a.data,a._changesSW,a._changesSW),r=!0,a.state=a._changesSW,a._changesSW={}))),void 0===a.data&&!r||a.__locks.all?(a._stable=!1,!(l.managed||a.state||a._use&&a._use.length)):(a._stable=!0,a._rev++),!a._stable&&a.emit("unstable",a.state),a}return a(e,t),c(e,[{key:"shouldPropag",value:function(t){return!0}},{key:"hasDataChange",value:function(t){var e,n=(this.constructor,this.data);return e=!n&&t||n!==t,!e&&n&&Object.keys(n).forEach(function(r){e=e||(t?n[r]!==t[r]:n&&n[r])}),!e&&t&&Object.keys(t).forEach(function(r){e=e||(t?n[r]!==t[r]:n&&n[r])}),e}},{key:"shouldApply",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.state,n=this.constructor;return!!this.isComplete(e)&&(h.array(n.follow)?n.follow.reduce(function(t,n){return t||e&&e[n]},!1):!n.follow||Object.keys(n.follow).reduce(function(r,i){return r||e&&h.fn(n.follow[i])&&n.follow[i].call(t,e[i])||n.follow[i]&&e[i]!==t.state[i]},!1))}},{key:"apply",value:function(t,e,n){return e=e||this.state,this.refine?this.refine.apply(this,arguments):t&&t.__proto__===v&&e.__proto__===v?u({},t,e):e}},{key:"refine",value:function(t,e,n){return e=e||this.state,t&&t.__proto__===v&&e.__proto__===v?u({},t,e):e}},{key:"stabilize",value:function(t){t&&this.once("stable",t),this._stable&&this.emit("unstable",this.state,this.data),this._stable=!1,this._stabilizer||(this._stabilizer=_.pushTask(this,"pushState"))}},{key:"retrieve",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.data;return t=h.string(t)?t.split("."):t,n&&t&&t.length?t.length==e+1?n[t[e]]:this.retrieve(t,e+1,n[t[e]]):n}},{key:"dispatch",value:function(t){for(var e,n=arguments.length,r=Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];(e=this.scopeObj).dispatch.apply(e,[t].concat(r))}},{key:"trigger",value:function(t){var e=this.constructor.actions;if(e&&e[t]){for(var n,r=arguments.length,i=Array(r>1?r-1:0),s=1;s<r;s++)i[s-1]=arguments[s];var o=(n=e[t]).call.apply(n,[this].concat(i));o&&this.setState(o)}}},{key:"pull",value:function(t,e,n){var r=this,i=this.scopeObj.map(this,t);return e&&(this.wait(),t.forEach(function(t){return r.scope[t]&&r.wait(r.scope[t])}),this.release()),i}},{key:"push",value:function(t,e,n){if(n=e===!0?n:e,e=e===!0,!e&&!this.hasDataChange(t)){if(n&&n(),!this.__locks.all){var r=this._stable;this._stable=!0,!r&&this.emit("stable",this.state,this.data),this._stabilizer=null}return!1}this.data=t,this.wait(),this.release(n)}},{key:"pushState",value:function(t){if(t||this._changesSW||!this.data){var e=u({},this.state,this._changesSW||{}),n=this.apply(this.data,e,this._changesSW);if(this._stabilizer=null,this.state=e,this._changesSW=null,!t&&!this.hasDataChange(n)){if(!this.__locks.all){var r=this._stable;this._stable=!0,!r&&this.emit("stable",this.state,this.data),this._stabilizer=null}return!1}this.data=n,this.wait(),this.release()}}},{key:"setState",value:function(t,e,n){var r,i=this._changesSW=this._changesSW||{};for(var s in t)(!this.state||i.hasOwnProperty(s)&&t[s]!==i[s]||t.hasOwnProperty(s)&&(t[s]!==this.state[s]||this.state[s]&&t[s]&&t[s]._rev!=this._revs[s]))&&(r=!0,this._revs[s]=t[s]&&t[s]._rev||!0,i[s]=t[s]);if(this.shouldApply(u({},this.state,i)))return n?(this.pushState(),e&&e()):r?this.stabilize(e):e&&e(),this}},{key:"setStateSync",value:function(t){var e,n=this._changesSW=this._changesSW||{};for(var r in t)(!this.state||t.hasOwnProperty(r)&&(t[r]!=this.state[r]||this.state[r]&&t[r]&&t[r]._rev!=this._revs[r]))&&(e=!0,this._revs[r]=t[r]&&t[r]._rev||!0,n[r]=t[r]);return this.shouldApply(u({},this.state||{},n))&&this.pushState(),this.data}},{key:"as",value:function(t){return{store:this,name:t}}},{key:"on",value:function(t){var n=this;!h.string(t)&&t?Object.keys(t).forEach(function(r){return l(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"on",n).call(n,r,t[r])}):l(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"on",this).apply(this,arguments)}},{key:"removeListener",value:function(t){var n=this;!h.string(t)&&t?Object.keys(t).forEach(function(r){return l(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"removeListener",n).call(n,r,t[r])}):l(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"removeListener",this).apply(this,arguments)}},{key:"isComplete",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.state;
return this.constructor,!this._require||!this._require.length||t&&this._require.reduce(function(e,n){return e&&t[n]},!0)}},{key:"isStable",value:function(){return this._stable}},{key:"serialize",value:function(){var t=this,e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e&&h.array(this._use)&&this._use.reduce(function(e,n){var r=void 0,i=void 0,s=void 0;return n.store&&n.name?i=r=n.name:h.fn(n)?r=i=n.name||n.defaultName:(n=n.match(/([\w_]+)((?:\.[\w_]+)*)(?:\:([\w_]+))?/),r=n[1],s=n[2]&&n[2].substr(1),i=n[3]||s&&s.match(/([^\.]*)$/)[0]||n[1]),t.scopeObj.stores[r].scopeObj._.isLocalId||(e[i]=t.scopeObj.stores[r].scopeObj._id+"/"+r),e},{})||{};return n[this.scopeObj._id+"/"+this.name]={state:this.state&&(e?Object.keys(this.state).reduce(function(e,n){return!r[n]&&(e[n]=t.state[n]),e},{}):u({},this.state)),data:this.data,refs:r},n}},{key:"restore",value:function(t){var e=t[this.scopeObj._id+"/"+this.name];e&&(this.state=e.state,Object.keys(e.refs).forEach(function(n){t[e.refs[n]]&&(e.state[n]=t[e.refs[n]].data)}),this.data=e.data)}},{key:"unBind",value:function(t,e,n){for(var r=this._followers,i=r&&r.length;r&&i--;)if(r[i][0]===t&&r[i][1]===e&&r[i][2]===n)return r.splice(i,1)}},{key:"bind",value:function(t,e){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],i=arguments[3];if(this._followers.push([t,e,i]),n&&this.data&&this._stable){var s=i?this.retrieve(i):this.data;"function"!=typeof t?e?t.setState(r({},e,s)):t.setState(s):t(s)}}},{key:"then",value:function(t){var e=this;return this._stable?t(null,this.data):void this.once("stable",function(n){return t(null,e.data)})}},{key:"wait",value:function(t){if("number"==typeof t)return this.__locks.all+=t;if(h.array(t))return t.map(this.wait.bind(this));this._stable&&this.emit("unstable",this.state,this.data),this._stable=!1,this.__locks.all++;var e=h.string(t)?t:null;return e&&(this.__locks[e]=this.__locks[e]||0,this.__locks[e]++),t&&h.fn(t.then)&&t.then(this.release.bind(this,null)),this}},{key:"release",value:function(t,e){var n=(this.constructor,this),i=this._stable;if(h.fn(t)&&(e=t,t=null),t&&(0==this.__locks[t],this.__locks[t]=this.__locks[t]||0,this.__locks[t]--),!t&&0==this.__locks.all,!--this.__locks.all&&this.isComplete()){var s=this.shouldPropag(this.data);this._stable=!0,s&&this._rev++,s&&this._followers.length&&this._followers.forEach(function(t){var e=t[2]?n.retrieve(t[2]):n.data;"function"==typeof t[0]?t[0](e):t[0].setState(t[1]?r({},t[1],e):e)}),!i&&this.emit("stable",this.data),s&&this.emit("update",this.data),e&&e()}else e&&this.then(e);return this}},{key:"propag",value:function(t){this.emit("update",t)}},{key:"retain",value:function(t){this.__retains.all++,t&&(this.__retains[t]=this.__retains[t]||0,this.__retains[t]++)}},{key:"dispose",value:function(t){var e=this;if(t){if(!this.__retains[t])throw new Error("Dispose more than retaining : "+t);this.__retains[t]--}if(0==this.__retains.all)throw new Error("Dispose more than retaining !");this.__retains.all--,this.__retains.all||(this._persistenceTm?(this._destroyTM&&clearTimeout(this._destroyTM),this._destroyTM=setTimeout(function(t){e._destroyTM=null,!e.__retains.all&&e.destroy()},this._persistenceTm)):!this.__retains.all&&this.destroy())}},{key:"destroy",value:function(){this.emit("destroy",this),this._stabilizer&&clearTimeout(this._stabilizer),this._followers.length&&this._followers.forEach(function(t){"function"!=typeof t[0]&&t[0].stores&&delete t[0].stores[t[1]]}),this._followers.length=0,this.constructor._rev=this.rev,this.dead=!0,this._revs=this.data=this.state=this.scope=null,this.removeAllListeners()}},{key:"contextObj",get:function(){return this.scopeObj}},{key:"context",get:function(){return this.scope}},{key:"datas",get:function(){return this.data},set:function(t){this.data=t}},{key:"nextState",get:function(){return this._changesSW&&u({},this.state,this._changesSW)||this.state}}]),e}(p);y.use=[],y.staticScope=new f({},{id:"static"}),y.state=void 0,y.persistenceTm=!1,y.as=function(t){return{store:this,name:t}},y.map=function(t,e,n,r){var s=arguments.length>4&&void 0!==arguments[4]&&arguments[4],o=t._revs||{},a=t.stores||(t.stores={}),u={};e=h.array(e)?[].concat(i(e)):[e],n=n||y.staticScope,e=e.filter(function(e){var r;if(!e)return!1;var c=void 0,l=void 0,f=void 0,p=void 0;return e.store&&e.name?(l=c=e.name,p=e.store):h.fn(e)?(c=l=e.name||e.defaultName,p=e):(e=e.match(/([\w_]+)((?:\.[\w_]+)*)(?:\:([\w_]+))?/),c=e[1],f=e[2]&&e[2].substr(1),p=n.stores[e[1]],l=e[3]||f&&f.match(/([^\.]*)$/)[0]||e[1]),!o[c]&&!!p&&(h.fn(p)?(n._mount(c),n.stores[c].bind(t,l,s,f)):p.bind(t,l,s,f),(r=t._sources).push.apply(r,i(n.stores[c]._sources)),o[l]=o[l]||!0,!a[c]&&(a[c]=n.stores[c]),n.stores[c].hasOwnProperty("data")&&(u[c]=n.data[c]),!0)});var c,l=t.isReactComponent?"componentWillUnmount":"destroy";return t.hasOwnProperty(l)&&(c=t[l]),t[l]=function(){return delete t[l],c&&(t[l]=c),e.map(function(e){var r=void 0,i=void 0,s=void 0,o=void 0;e.store&&e.name?(i=r=e.name,o=e.store):h.fn(e)?(r=i=e.name||e.defaultName,o=n.stores[r]):(e=e.match(/([\w_]+)((?:\.[\w_]+)*)(?:\:([\w_]+))?/),r=e[1],s=e[2]&&e[2].substr(1),o=n.stores[e[1]],i=e[3]||s&&s.match(/([^\.]*)$/)[0]||e[1]),o&&!h.fn(o)&&o.unBind(t,i,s)}),t[l]&&t[l].apply(t,arguments)},u},e.default=y,t.exports=e.default},function(t,e,n){(function(r){"use strict";function i(t){return t&&t.__esModule?t:{default:t}}function s(){_||o()}function o(){for(Date.now(),_=!0,d.enable();f;){for(;!c[l]||!c[l].length;)l++;f--,p=c[l].shift(),p[0][p[1]].apply(p[0],p[2])}p=void 0,d.disable(),_=!1,f&&setTimeout(s)}Object.defineProperty(e,"__esModule",{value:!0});var a=n(3),u=(i(a),n(1)),c=(i(u),[]),l=0,h=0,f=0,p=void 0,_=void 0,d={lastError:null,dispatch:function(t){d.disable(),p&&p[0].handleError&&p[0].handleError(t,p),_=!1,p=null,s()},enable:"undefined"!=typeof window?function(){window.addEventListener("error",d.dispatch)}:function(){r.on("uncaughtException",d.dispatch)},disable:"undefined"!=typeof window?function(){window.removeEventListener("error",d.dispatch)}:function(){r.removeListener("uncaughtException",d.dispatch)}};e.default={pushTask:function(t,e,n){var r=t._sources&&t._sources.length||1,i=c[r]=c[r]||[];return h=Math.max(h,r),l=Math.min(l,r),f++,i.push([t,e,n]),setTimeout(s),i.length}},t.exports=e.default}).call(e,n(11))},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function i(t){if(Array.isArray(t)){for(var e=0,n=Array(t.length);e<t.length;e++)n[e]=t[e];return n}return Array.from(t)}function s(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];f.push({test:t,member:n,stateScope:r,handle:e})}function o(t,e,n){for(var r=0;r<f.length;r++)if((void 0===e||e==f[r].member)&&n==f[r].stateScope&&f[r].test(t))return!0;return!1}function a(t,e,n,r){for(var s=0;s<f.length;s++){var o;if(n==f[s].member&&r==f[s].stateScope&&f[s].test(t))return(o=f[s]).handle.apply(o,[t].concat(i(e)))}return!1}function u(){for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];return e[0]instanceof h&&e[2]instanceof h&&e[0].hasOwnProperty(e[1])?(e[2].value=a(e[0],[],!0,!1),e[0]):o(e[0],void 0,!1)?a(e[0],e.slice(1),!1,!1):function(){for(var t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];return n[0]instanceof h&&n[2]instanceof h&&n[0].hasOwnProperty(n[1])?(n[2].value=a(n[0],e,!0,!1),n[0]):u.apply(void 0,[n[0]].concat(e))}}function c(){for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];return e[0]instanceof h&&e[2]instanceof h&&e[0].hasOwnProperty(e[1])?(e[2].value=a(e[0],[],!0,!0),e[0]):o(e[0],void 0,!0)?a(e[0],e.slice(1),!1,!0):function(){for(var t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];return n[0]instanceof h&&n[2]instanceof h&&n[0].hasOwnProperty(n[1])?(n[2].value=a(n[0],e,!0,!0),n[0]):c.apply(void 0,[n[0]].concat(e))}}Object.defineProperty(e,"__esModule",{value:!0}),e.scopeToState=e.reScope=e.addScopableType=void 0;var l=n(1),h=(r(l),n(3),{}.constructor),f=[];e.addScopableType=s,e.reScope=u,e.scopeToState=c},function(t,e){function n(){throw new Error("setTimeout has not been defined")}function r(){throw new Error("clearTimeout has not been defined")}function i(t){if(l===setTimeout)return setTimeout(t,0);if((l===n||!l)&&setTimeout)return l=setTimeout,setTimeout(t,0);try{return l(t,0)}catch(e){try{return l.call(null,t,0)}catch(e){return l.call(this,t,0)}}}function s(t){if(h===clearTimeout)return clearTimeout(t);if((h===r||!h)&&clearTimeout)return h=clearTimeout,clearTimeout(t);try{return h(t)}catch(e){try{return h.call(null,t)}catch(e){return h.call(this,t)}}}function o(){d&&p&&(d=!1,p.length?_=p.concat(_):v=-1,_.length&&a())}function a(){if(!d){var t=i(o);d=!0;for(var e=_.length;e;){for(p=_,_=[];++v<e;)p&&p[v].run();v=-1,e=_.length}p=null,d=!1,s(t)}}function u(t,e){this.fun=t,this.array=e}function c(){}var l,h,f=t.exports={};!function(){try{l="function"==typeof setTimeout?setTimeout:n}catch(t){l=n}try{h="function"==typeof clearTimeout?clearTimeout:r}catch(t){h=r}}();var p,_=[],d=!1,v=-1;f.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];_.push(new u(t,e)),1!==_.length||d||i(a)},u.prototype.run=function(){this.fun.apply(null,this.array)},f.title="browser",f.browser=!0,f.env={},f.argv=[],f.version="",f.versions={},f.on=c,f.addListener=c,f.once=c,f.off=c,f.removeListener=c,f.removeAllListeners=c,f.emit=c,f.prependListener=c,f.prependOnceListener=c,f.listeners=function(t){return[]},f.binding=function(t){throw new Error("process.binding is not supported")},f.cwd=function(){return"/"},f.chdir=function(t){throw new Error("process.chdir is not supported")},f.umask=function(){return 0}},function(t,e,n){"use strict";function r(t){var e="",n=Math.floor(.001*(Date.now()-u));return n===s?i++:(i=0,s=n),e+=o(a.lookup,c),e+=o(a.lookup,t),i>0&&(e+=o(a.lookup,i)),e+=o(a.lookup,n)}var i,s,o=n(7),a=n(2),u=1459707606518,c=6;t.exports=r},function(t,e,n){"use strict";function r(t){var e=i.shuffled();return{version:15&e.indexOf(t.substr(0,1)),worker:15&e.indexOf(t.substr(1,1))}}var i=n(2);t.exports=r},function(t,e,n){"use strict";function r(e){return a.seed(e),t.exports}function i(e){return h=e,t.exports}function s(t){return void 0!==t&&a.characters(t),a.shuffled()}function o(){return c(h)}var a=n(2),u=(n(7),n(13)),c=n(12),l=n(15),h=n(18)||0;t.exports=o,t.exports.generate=o,t.exports.seed=r,t.exports.worker=i,t.exports.characters=s,t.exports.decode=u,t.exports.isValid=l},function(t,e,n){"use strict";function r(t){if(!t||"string"!=typeof t||t.length<6)return!1;for(var e=i.characters(),n=t.length,r=0;r<n;r++)if(e.indexOf(t[r])===-1)return!1;return!0}var i=n(2);t.exports=r},function(t,e){"use strict";function n(){if(!r||!r.getRandomValues)return 48&Math.floor(256*Math.random());var t=new Uint8Array(1);return r.getRandomValues(t),48&t[0]}var r="object"==typeof window&&(window.crypto||window.msCrypto);t.exports=n},function(t,e){"use strict";function n(){return i=(9301*i+49297)%233280,i/233280}function r(t){i=t}var i=1;t.exports={nextValue:n,seed:r}},function(t,e){"use strict";t.exports=0}]);