actives
Version:
actives - pure logic (PL) - pure view (PV)
1 lines • 29.7 kB
JavaScript
var actives=function(e){function t(i){if(n[i])return n[i].exports;var r=n[i]={exports:{},id:i,loaded:!1};return e[i].call(r.exports,r,r.exports,t),r.loaded=!0,r.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";e.exports=n(1)},function(e,t,n){"use strict";t.Box=n(2),t.Reflection=n(4),t.BoxReflection=n(19),t.Connection=n(13)},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=n(3),u=n(8),a=n(9),s=n(4),c=n(12),f=n(14),l=n(20),h=n(19);e.exports=function(){function e(){i(this,e),this._definitions=new u,this._connections=new c,this._factory=new a,this._contextValue=void 0,this._names=new Map,h.addName(this,"self")}return r(e,[{key:"add",value:function(t,n,i){return this.remove(t),n instanceof e?h.addBox({box:this,name:t,child:n,dependencies:i}):this._definitions.add(t,o.create(t,n,i)),h.addName(this,t),this}},{key:"get",value:function(e){return"self"===e?this:l.isPath(e)?l.path(e)(this):(this._definitions.isResolved(e)||this._definitions.resolve(e,this.create(e)),this._connections.has(e)?(this._connections.get(e).init(this),this._connections.get(e).getState()):this._definitions.getResolved(e))}},{key:"remove",value:function(e){this._definitions.has(e)&&this._definitions.remove(e),this._connections.has(e)&&this._connections.remove(e)}},{key:"keys",value:function(){return this._definitions.keys().concat(this._connections.keys())}},{key:"create",value:function(e){return this._definitions.isDefinition(e)?this._factory.create(this,this._definitions.get(e)):h.clone(this)}},{key:"connect",value:function(e,t){return f.connect({box:this,name:e,service:t})}},{key:"context",value:function e(){var t=this,n=arguments.length<=0||void 0===arguments[0]?null:arguments[0];if(!n&&this._contextValue)return this._contextValue;var i=n||{};i.self=function(){return t};var r=this.keys().concat(s.keys(i));r=s.uniqueArray(r);var e=s.defineNames({},r,function(e){var n=i[e]||e;return s.isFunction(n)?n(t.context()):t.get(n)});return n||(this._contextValue=e),e}}],[{key:"create",value:function(){return new e}}]),e}()},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=n(4),u=n(5),a=n(6),s=n(7);e.exports=function(){function e(t,n,r){i(this,e),this.name=t,this.definition=n,this.dependencies=r,this.reset()}return r(e,[{key:"setMeta",value:function(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];this.meta=this.meta||{},o.merge(this.meta,e)}},{key:"getMeta",value:function(){return this.setMeta(),this.meta}},{key:"getName",value:function(){return this.name}},{key:"getValue",value:function(){return this.value}},{key:"isResolved",value:function(){return this.resolved}},{key:"resolve",value:function(e){var t=this;this.originValue=e,this.value=e,this.isConnected()&&(o.isPureObject(e)?this.value=a(e,function(e){return t.observer.notify(e)}):o.isFunction(e)&&(this.value=s(e,{},function(e){return t.observer.notify(e)}))),this.resolved=!0}},{key:"getOriginValue",value:function(){return this.originValue}},{key:"getResolved",value:function(){return this.value}},{key:"getDependencies",value:function(){return this.dependencies}},{key:"getDefinition",value:function(){return this.definition}},{key:"subscribe",value:function(e){!this.isConnected()&&this.isResolved()&&(this.connected=!0,this.resolve(this.getValue())),this.connected=!0,this.observer=this.observer||new u,this.observer.subscribe(e)}},{key:"isConnected",value:function(){return this.connected}},{key:"reset",value:function(){this.resolved=!1,this.value=void 0,this.originValue=void 0,this.observer=void 0,this.connected=!1,this.meta=void 0}},{key:"clone",value:function(){return new e(this.name,this.definition,this.dependencies)}}],[{key:"create",value:function(t,n,i){if(o.isFunction(n))return new e(t,n,i);if(n instanceof e)return n;if(o.isPureObject(n)){var r=new e(t,n,i);return r.resolve(n),r}return n}}]),e}()},function(module,exports){"use strict";function _toConsumableArray(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var _createClass=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}();module.exports=function(){function Reflection(){_classCallCheck(this,Reflection)}return _createClass(Reflection,null,[{key:"isPureObject",value:function(e){return this.isObject(e)&&!this.isFunction(e)&&!this.isArray(e)}},{key:"isArray",value:function(e){return Array.isArray(e)}},{key:"isObject",value:function(e){return e instanceof Object}},{key:"isClass",value:function(e){return this.isFunction(e)&&(/^\s*class\s+/.test(e.toString())||/_classCallCheck/gim.test(e.toString()))}},{key:"isFunction",value:function(e){return e instanceof Function}},{key:"isPromise",value:function(e){return e instanceof Promise||this.isObject(e)&&Reflection.isFunction(e.then)&&Reflection.catch(e.then)}},{key:"isString",value:function(e){return"string"==typeof e}},{key:"getNames",value:function(e){return this.getPropertyNames(e).concat(this.getMethodNames(e))}},{key:"getMethodNames",value:function(e){var t=this.getPrototype(e);return t==Object.prototype?[]:Object.getOwnPropertyNames(t)}},{key:"getPrototype",value:function(e){return Object.getPrototypeOf(e)}},{key:"getPropertyNames",value:function(e){return this.keys(e)}},{key:"keys",value:function(e){return Object.keys(e)}},{key:"defineName",value:function(e,t){var n=arguments.length<=2||void 0===arguments[2]?null:arguments[2],i=arguments.length<=3||void 0===arguments[3]?null:arguments[3],r=!(arguments.length<=4||void 0===arguments[4])&&arguments[4],o={};n&&(o.get=function(){return n(t)}),i&&(o.set=function(e){return i(t,e)}),r&&(o.configurable=!0,o.enumerable=!1),Object.defineProperty(e,t,o)}},{key:"defineNames",value:function(e,t){var n=this,i=arguments.length<=2||void 0===arguments[2]?null:arguments[2],r=arguments.length<=3||void 0===arguments[3]?null:arguments[3];return t.forEach(function(t){n.defineName(e,t,i,r)}),e}},{key:"iteratorToArray",value:function(e){var t=[],n=!0,i=!1,r=void 0;try{for(var o,u=e[Symbol.iterator]();!(n=(o=u.next()).done);n=!0){var a=o.value;t.push(a)}}catch(e){i=!0,r=e}finally{try{!n&&u.return&&u.return()}finally{if(i)throw r}}return t}},{key:"clone",value:function(e){if(this.isObject(e)){var t=function(){return this};return t.prototype=e,new t}return e}},{key:"constructCreator",value:function constructCreator(_class,args){var _a=args,a=args.map(function(e,t){return"_a["+t+"]"}).join(", ");return function(){return eval("new _class("+a+")")}}},{key:"uniqueArray",value:function(e){return[].concat(_toConsumableArray(new Set(e)))}},{key:"merge",value:function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return n.forEach(function(t){for(var n in t)e[n]=t[n]}),e}}]),Reflection}()},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=n(4);e.exports=function(){function e(){i(this,e),this.observers=[]}return r(e,[{key:"subscribe",value:function(e){this.observers.push(e)}},{key:"unsubscribe",value:function(e){var t=this.observers.indexOf(e);t>=0&&this.observers.splice(t,1)}},{key:"notify",value:function(){for(var e=this,t=arguments.length,n=Array(t),i=0;i<t;i++)n[i]=arguments[i];this.observers.forEach(function(t){return t.apply(e,n)})}}],[{key:"notifier",value:function(e){return function(){var t=arguments.length<=0||void 0===arguments[0]?function(){return null}:arguments[0],n=function n(i){return!n.locked&&t(o.merge({},e,i))};return n}}}]),e}()},function(e,t,n){"use strict";var i=n(4),r=n(7),o=n(5);e.exports=function(e){var t=arguments.length<=1||void 0===arguments[1]?function(){return null}:arguments[1],n=i.clone(e),u=new Map,a=o.notifier({origin:e})(t);return i.defineNames(n,i.getNames(e),function(t){var o=e[t];return i.isFunction(o)?(u.has(t)||u.set(t,r(o,n,a)),u.get(t)):o},function(t,i){var r=e[t]!==i;e[t]=i,r&&a({type:"SET",name:t,value:i,wrapper:n})}),n}},function(e,t,n){"use strict";var i=n(4),r=n(5);e.exports=function(e,t){var n=arguments.length<=2||void 0===arguments[2]?function(){return null}:arguments[2],o=r.notifier({origin:e,context:t,type:"CALL"})(n),u=function(){for(var r=arguments.length,u=Array(r),a=0;a<r;a++)u[a]=arguments[a];n.locked=!0;var s=e.apply(t,u);return n.locked=!1,o({arguments:u,result:s}),i.isPromise(s)&&s.then(function(e){return setTimeout(function(){return o({type:"CALL_ASYNC_OK",arguments:u,result:e})},0),e},function(e){return setTimeout(function(){return o({type:"CALL_ASYNC_REJECT",arguments:u,result:e})},0),e}),s};return u.prototype=e,u}},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=n(3),u=n(4);e.exports=function(){function e(){i(this,e),this.definitions=new Map,this.values=new Map}return r(e,[{key:"add",value:function(e,t){t instanceof o?this.definitions.set(t.getName(),t):this.values.set(e,t)}},{key:"remove",value:function(e){this.isValue(e)&&this.values.delete(e),this.isDefinition(e)&&(this.definitions.get(e).reset(),this.definitions.delete(e))}},{key:"has",value:function(e){return this.isDefinition(e)||this.isValue(e)}},{key:"get",value:function(e){return this.isDefinition(e)?this.definitions.get(e):this.values.get(e)}},{key:"isResolved",value:function(e){return!this.isDefinition(e)||this.get(e).isResolved()}},{key:"isDefinition",value:function(e){return this.definitions.has(e)}},{key:"isValue",value:function(e){return this.values.has(e)}},{key:"getResolved",value:function(e){return this.isDefinition(e)?this.get(e).getResolved():this.values.get(e)}},{key:"resolve",value:function(e,t){this.isDefinition(e)?this.definitions.get(e).resolve(t):this.values.set(e,t)}},{key:"keys",value:function(){return u.iteratorToArray(this.values.keys()).concat(u.iteratorToArray(this.definitions.keys()))}},{key:"each",value:function(e){var t=this;this.keys().forEach(function(n){return e(t.get(n),n)})}}]),e}()},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=n(10);e.exports=function(){function e(){i(this,e)}return r(e,[{key:"create",value:function(e,t){return o.create(t)(e)()}}]),e}()},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=n(4),u=n(11);e.exports=function(){function e(t){i(this,e),this.definition=t}return r(e,[{key:"create",value:function(){if(o.isClass(this.definition.getDefinition()))return this.makeClass();if(o.isFunction(this.definition.getDefinition()))return this.makeFunction();if(this.definition.getMeta().box)return this.makeBox();throw new Error("Unexpected definition type")}},{key:"makeClass",value:function(){var e=this;return function(t){var n=u.create(e.definition)(t),i=e.definition.getDefinition();return o.constructCreator(i,n)}}},{key:"makeFunction",value:function(){var e=this;return function(t){var n=u.create(e.definition)(t),i=e.definition.getDefinition(),r=function(){return i.apply(this,n)};return r.prototype=i.prototype,r}}},{key:"makeBox",value:function(){var e=this;return function(t){return function(){var n=u.create(e.definition)(t),i=e.definition.getDefinition();for(var r in n)i.add(r,n[r]);return i}}}}],[{key:"create",value:function(t){return new e(t).create()}}]),e}()},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=n(4);e.exports=function(){function e(t){i(this,e),this.definition=t,this.hasDependencies=!!t.getDependencies(),this.isArrayDeps=o.isArray(t.getDependencies()),this.isObjectDeps=!this.isArrayDeps&&o.isPureObject(t.getDependencies())}return r(e,[{key:"isClass",value:function(){return o.isClass(this.definition.getDefinition())}},{key:"isFunction",value:function(){return!this.isClass()&&o.isFunction(this.definition.getDefinition())}},{key:"isBox",value:function(){return this.definition.getMeta().box}},{key:"create",value:function(){return this.isClass()?this.makeClass():this.isFunction()?this.makeFunction():this.isBox()?this.makeBox():function(){return[]}}},{key:"makeBox",value:function(){return this.isObjectDeps?e.objectBoxWay(this.definition):function(){return[]}}},{key:"makeFunction",value:function(){return!this.hasDependencies||this.isObjectDeps?e.objectWay(this.definition):this.isArrayDeps?e.arrayWay(this.definition):function(){return[]}}},{key:"makeClass",value:function(){return this.isArrayDeps?e.arrayWay(this.definition):this.isObjectDeps?e.objectWay(this.definition):function(){return[]}}}],[{key:"arrayWay",value:function(e){return function(t){return e.getDependencies().map(function(e){return o.isFunction(e)?e(t.context()):t.get(e)})}}},{key:"objectWay",value:function(e){return function(t){var n=e.getDependencies()||{};return[t.context(n)]}}},{key:"objectBoxWay",value:function(e){return function(t){var n=e.getDependencies()||{},i={};for(var r in n){var u=n[r];o.isFunction(u)?i[r]=u(t.context()):i[r]=t.get(n[r])}return i}}},{key:"create",value:function(t){return new e(t).create()}}]),e}()},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=n(13),u=n(4);e.exports=function(){function e(){i(this,e),this.connections=new Map}return r(e,[{key:"add",value:function(e){e instanceof o&&this.connections.set(e.getName(),e)}},{key:"get",value:function(e){return this.connections.get(e)}},{key:"has",value:function(e){return this.connections.has(e)}},{key:"keys",value:function(){return u.iteratorToArray(this.connections.keys())}},{key:"each",value:function(e){var t=this;this.keys().forEach(function(n){return e(t.get(n),n)})}},{key:"remove",value:function(e){this.has(e)&&this.get(e).reset()}}]),e}()},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=n(5),u=n(4),a="___Symbol__connection";e.exports=function(){function e(t,n){i(this,e),this.name=t,this.service=n,this.reset()}return r(e,[{key:"init",value:function(e){this.hasState()||this.notify(e,{type:"CONNECTION_INIT",name:this.getName(),box:e})}},{key:"reset",value:function(){this.observer=void 0,this.stateCreator=void 0,this.stateValue=void 0,this.actionsCreator=void 0,this.actionsCalled=!1,this.actionsValue=void 0}},{key:"getName",value:function(){return this.name}},{key:"getService",value:function(){return this.service}},{key:"state",value:function(e){return u.isFunction(e)&&(this.stateCreator=e),this}},{key:"model",value:function(e){return this.state(e)}},{key:"actions",value:function(e){return u.isFunction(e)&&(this.actionsCreator=e),this}},{key:"subscribe",value:function(e){this.observer=this.observer||new o,this.observer.subscribe(e)}},{key:"unsubscribe",value:function(e){this.observer&&this.observer.unsubscribe(e)}},{key:"notifyObservers",value:function(t,n){var i=this.getState();this.observer&&this.observer.notify(n,e.clearState(i))}},{key:"hasState",value:function(){return!!this.stateValue}},{key:"getState",value:function(){var t=this.stateValue||this.resetState();return e.defineSymbol(t,this),t}},{key:"resetState",value:function(){return this.stateValue={},this.stateValue}},{key:"applyState",value:function(e){this.stateValue=this.getState(),u.isPureObject(e)&&u.merge(this.stateValue,e)}},{key:"notify",value:function(e,t){this.notifyIt(e,t)}},{key:"notifyIt",value:function(e,t){this.resetState(),this.callActionsCreator(e),this.callStateCreator(e),this.notifyObservers(e,t)}},{key:"callActionsCreator",value:function(e){if(this.actionsCreator&&!this.actionsCalled){var t=this.actionsCreator(this.getActionsContext(e));this.actionsValue=t,this.actionsCalled=!0,this.applyState(t)}else this.applyState(this.actionsValue)}},{key:"callStateCreator",value:function(e){this.stateCreator&&this.applyState(this.stateCreator(this.getStateContext(e)))}},{key:"getActionsContext",value:function(e){return e.context()}},{key:"getOriginValue",value:function(){return this.getState()}},{key:"getValue",value:function(){return this.getOriginValue()}},{key:"getStateContext",value:function(e){return e.context()}}],[{key:"isStateObject",value:function(e){return e[a]}},{key:"subscribe",value:function(e,t){var n=e[a];n&&n.subscribe(t)}},{key:"unsubscribe",value:function(e,t){var n=e[a];n&&n.unsubscribe(t)}},{key:"clearState",value:function(t){return e.isStateObject(t)&&t[a]&&delete t[a],t}},{key:"defineSymbol",value:function(t,n){return u.isString(a)?e.isStateObject(t)||u.defineName(t,a,function(){return n},null,!0):t[a]=n,t}}]),e}()},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=n(15),u=n(13),a=n(16),s=n(17),c=n(18),f=n(4),l=n(19),h=n(20);e.exports=function(){function e(){i(this,e)}return r(e,null,[{key:"createConnection",value:function(t){var n=this,i=t.name,r=t.service,u=t.box,v=l.getDefinitions(u),y=l.getConnections(u),p=void 0;if(!p&&v.isDefinition(r)){var b=v.get(r);p=new o(i,r,b),b.subscribe(function(e){return p.notify(u,e)})}if(!p&&y.has(r)&&(p=new a(i,r),y.get(r).subscribe(function(e){return p.notify(u,e)})),!p&&f.isPureObject(r)){p=new c(i,r);var d={};for(var i in r){var g=r[i],k=this.createConnection({name:g,service:g,box:u});d[i]=k,k.subscribe(function(t){var n=e.getBoxPath(u,g),i=l.getConnections(n.box);if(i.has(n.service)){var r=i.get(n.service);k.resetState(),k.applyState(r.getState())}return p.notify(u,t)})}p.setConnections(d)}if(!p&&f.isArray(r)){p=new s(i,r);var m=r.map(function(e){var t=n.createConnection({name:e,service:e,box:u});return t.subscribe(function(n){if(y.has(e)){var i=y.get(e);t.resetState(),t.applyState(i.getState())}return p.notify(u,n)}),t});p.setConnections(m)}if(!p&&h.isPath(r)){var x=e.getBoxPath(u,r);p=this.createConnection({name:i,service:x.service,box:x.box})}if(!p)throw new Error("Unexpected connection, no definition or another connection");return p}},{key:"connect",value:function(e){var t=e.name,n=e.service,i=e.box,r=l.getConnections(i);i.remove(t);var o=void 0;if(n instanceof u){var a=n;o=this.createConnection({name:t,service:a.getService(),box:i}),o.state(a.stateCreator).actions(a.actionsCreator)}else o=this.createConnection({name:t,service:n,box:i});return r.add(o),l.addName(i,t),o}},{key:"getBoxPath",value:function(e,t){if(h.isPath(t)){var n=h.toArray(t),i=n.pop(),r=h.path(n)(e);if(l.isBox(r))return{box:r,service:i};throw new Error("Unexpected path to connected service: "+i)}return{box:e,service:t}}}]),e}()},function(e,t,n){"use strict";function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),s=n(13);e.exports=function(e){function t(e,n,i){r(this,t);var u=o(this,Object.getPrototypeOf(t).call(this,e,n));return u.definition=i,u.context=void 0,u}return u(t,e),a(t,[{key:"notify",value:function(e,t){"CONNECTION_INIT"==t.type&&e.get(this.service),this.notifyIt(e,t)}},{key:"getStateContext",value:function(e){var t=this;return this.context||(this.context=e.context(i({},this.service,function(){return t.getOriginValue()}))),this.context}},{key:"getValue",value:function(){return this.definition.getValue()}},{key:"getOriginValue",value:function(){return this.definition.getOriginValue()}}]),t}(s)},function(e,t,n){"use strict";var i=n(13);e.exports=i},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var u=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),a=function e(t,n,i){null===t&&(t=Function.prototype);var r=Object.getOwnPropertyDescriptor(t,n);if(void 0===r){var o=Object.getPrototypeOf(t);return null===o?void 0:e(o,n,i)}if("value"in r)return r.value;var u=r.get;if(void 0!==u)return u.call(i)},s=n(13);e.exports=function(e){function t(e,n){i(this,t);var o=r(this,Object.getPrototypeOf(t).call(this,e,n));return o.connections=void 0,o.context=void 0,o}return o(t,e),u(t,[{key:"setConnections",value:function(e){this.connections=e}},{key:"makeRelations",value:function(e,t){this.connections.forEach(function(t){return e.get(t.getName())})}},{key:"notify",value:function(e,t){t&&"CONNECTION_INIT"===t.type&&this.makeRelations(e,t),this.notifyIt(e,t)}},{key:"getStateContext",value:function(e){if(!this.context){var t={};this.connections.forEach(function(e){t[e.getName()]=function(){return e.getOriginValue()}}),this.context=e.context(t)}return this.context}},{key:"reset",value:function(){this.connections=void 0,this.context=void 0,a(Object.getPrototypeOf(t.prototype),"reset",this).call(this)}}]),t}(s)},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var u=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),a=function e(t,n,i){null===t&&(t=Function.prototype);var r=Object.getOwnPropertyDescriptor(t,n);if(void 0===r){var o=Object.getPrototypeOf(t);return null===o?void 0:e(o,n,i)}if("value"in r)return r.value;var u=r.get;if(void 0!==u)return u.call(i)},s=n(13);e.exports=function(e){function t(e,n){i(this,t);var o=r(this,Object.getPrototypeOf(t).call(this,e,n));return o.connections=void 0,o.stateContext=void 0,o.actionsContext=void 0,o}return o(t,e),u(t,[{key:"setConnections",value:function(e){this.connections=e}},{key:"makeRelations",value:function(e,t){for(var n in this.connections)e.get(this.connections[n].getName())}},{key:"notify",value:function(e,t){t&&"CONNECTION_INIT"===t.type&&this.makeRelations(e,t),this.notifyIt(e,t)}},{key:"getStateContext",value:function(e){if(!this.stateContext){var t={},n=function(e,n){return t[e]=function(){return n.getOriginValue()}};for(var i in this.connections)n(i,this.connections[i]);this.stateContext=e.context(t)}return this.stateContext}},{key:"getActionsContext",value:function(e){if(!this.actionsContext){var t={},n=function(e,n){return t[e]=function(){return n.getValue()}};for(var i in this.connections)n(i,this.connections[i]);this.actionsContext=e.context(t)}return this.actionsContext}},{key:"reset",value:function(){this.connections=void 0,this.stateContext=void 0,a(Object.getPrototypeOf(t.prototype),"reset",this).call(this)}}]),t}(s)},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=n(4),u=n(3);e.exports=function(){function e(){i(this,e)}return r(e,null,[{key:"getDefinitions",value:function(e){return e._definitions}},{key:"getConnections",value:function(e){return e._connections}},{key:"addBox",value:function(e){var t=e.box,n=e.name,i=e.child,r=e.dependencies,o=new u(n,i,r);o.setMeta({box:!0}),this.getDefinitions(t).add(n,o)}},{key:"addName",value:function(e,t){e._names.has(t)||t in e||(o.defineName(e,t,function(t){return e.get(t)},function(t,n){return e.add(t,n)}),e._names.set(t,t))}},{key:"isBox",value:function(e){return e instanceof n(2)}},{key:"clone",value:function(e){var t=n(2),i=t.create();return this.getDefinitions(e).each(function(e,t){return i.add(t,e.clone())}),this.getConnections(e).each(function(e,t){return i.connect(t,e)}),i}}]),e}()},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=n(4);e.exports=function(){function e(){i(this,e)}return r(e,null,[{key:"getCache",value:function(){return this._cache=this._cache||new Map,this._cache}},{key:"isPath",value:function(e){var t=arguments.length<=1||void 0===arguments[1]?"/":arguments[1];return!!(o.isArray(e)||o.isString(e)&&e.indexOf(t)>0)}},{key:"toArray",value:function(e){var t=arguments.length<=1||void 0===arguments[1]?"/":arguments[1];return this.isPath(e)?o.isArray(e)?e:e.split(t):[]}},{key:"create",value:function(e){var t=this.getCache();if(t.has(e))return t.get(e);var n=function(t){if(o.isObject(t))return o.isFunction(t.get)?t.get(e):t[e]};return this.getCache().set(e,n),n}},{key:"path",value:function(e){var t=this,n=arguments.length<=1||void 0===arguments[1]?"/":arguments[1],i=o.isArray(e)?e:e.split(n),r=i.map(function(e){return t.create(e)});return function(e){var t=!0,n=!1,i=void 0;try{for(var o,u=r[Symbol.iterator]();!(t=(o=u.next()).done);t=!0){var a=o.value;if(e=a(e),void 0===e)break}}catch(e){n=!0,i=e}finally{try{!t&&u.return&&u.return()}finally{if(n)throw i}}return e}}}]),e}()}]);