UNPKG

@nimel/directorr

Version:
2 lines (1 loc) 22.4 kB
!function(t,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports):"function"==typeof define&&define.amd?define(["exports"],r):r((t=t||self).index={})}(this,(function(t){"use strict";var r=function(t,r,e){return"".concat(t,": call decorator with arg=").concat(r," ").concat(e)},e=function(t,e){return r(t,e,"not equal to string/class/MSTModel or array of string/class/MSTModel")},n=function(t,r){return"".concat(t,": use decorator for prop=").concat(r," equal func")},o=function(t){return"".concat(t,": call stack out of range, this usually happens with cyclical dependency of injected stores")};if("undefined"==typeof Symbol)throw new TypeError("Directorr requires Symbol and Map objects. If your environment doesn't support, magic won`t work.");var i,c=function(){return(c=Object.assign||function(t){for(var r,e=1,n=arguments.length;e<n;e++)for(var o in r=arguments[e])Object.prototype.hasOwnProperty.call(r,o)&&(t[o]=r[o]);return t}).apply(this,arguments)};function a(t){var r="function"==typeof Symbol&&Symbol.iterator,e=r&&t[r],n=0;if(e)return e.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(r?"Object is not iterable.":"Symbol.iterator is not defined.")}function u(t,r){var e="function"==typeof Symbol&&t[Symbol.iterator];if(!e)return t;var n,o,i=e.call(t),c=[];try{for(;(void 0===r||r-- >0)&&!(n=i.next()).done;)c.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(e=i.return)&&e.call(i)}finally{if(o)throw o.error}}return c}function f(t,r,e){if(e||2===arguments.length)for(var n,o=0,i=r.length;o<i;o++)!n&&o in r||(n||(n=Array.prototype.slice.call(r,0,o)),n[o]=r[o]);return t.concat(n||Array.prototype.slice.call(r))}var s=Symbol.for("dirrector: effects"),l=Symbol.for("dirrector: dispatchAction"),d=Symbol.for("dirrector: dispatchEffects"),h=Symbol.for("dirrector: stores"),p=Symbol.for("dirrector: injected stores"),y=Symbol.for("dirrector: injected from stores"),v=Symbol.for("dirrector: external dependency"),S=Symbol.for("dirrector: timers"),E=Symbol.for("dirrector: clear timers"),w=Symbol.for("dirrector: subscribe"),T=Symbol.for("dirrector: dispatchers"),R=Symbol.for("dirrector: clear dispatchers"),m=function(){},O=function(t){return t},b=function(){return!0},I=Object.freeze({}),A="string",D={writable:!1,enumerable:!1,configurable:!0,value:null},g={enumerable:!1,configurable:!0,get:m,set:m};function _(t){return D.value=t,D}function x(t,r){return void 0===t&&(t=m),void 0===r&&(r=m),g.get=t,g.set=r,g}var N=Array.isArray,j=Object.defineProperty,C=(i=Object.prototype).toString,M=i.hasOwnProperty;function P(t){var r=m,e=m,n=m,o=!0;function i(t){n=t}function c(t){return o=!1,r(t)}function a(t){return o=!1,e(t)}var u=new Promise((function(n,o){r=n,e=o,t(c,a,i)}));return u.cancel=function(){r(Promise.resolve(void 0)),o&&n()},u}function F(t){return"[object Object]"===C.call(t)}function L(t){return typeof t===A}function k(t){return!!(t&&t.constructor&&t.call&&t.apply)}function Y(t,r){return M.call(t,r)}function H(t,r){return r===t.store}function J(t){if(!t)return!1;if(N(t)){if(!t.length)return!1;for(var r=0,e=t.length;r<e;++r)if(!J(t[r]))return!1;return!0}return L(t)||k(t)}function q(t){return!!t&&(F(t)&&void 0!==t.type)}function z(t){if(k(t))return t.storeName||t.name;if(t.constructor)return z(t.constructor);throw new Error("Store name not found")}function G(t){return k(t)?function(t){return!!t.type}(t)?t.type:z(t):t}function U(t){return t}function B(t,r){return r?{type:t,payload:r}:{type:t}}function W(t){var r=this[s],e=r.get(t.type);if(e)for(var n=0,o=e.length;n<o;++n)this[e[n]](t.payload);var i=r.get("@@DIRECTORR.ANY_ACTION");if(i)for(n=0,o=i.length;n<o;++n)this[i[n]](t)}function K(t){return!(!t||void 0===t.initializer)}function Q(t,r,e,n){return t&&K(t)?function(t,r,e,n){t.writable=!1;var o=t.initializer;return t.initializer=function(){return e(this,o&&o.call(this),r,n)},t}(t,r,e,n):function(t,r,e,n){var o=Symbol.for(r),i=t.set,c=t.get;return x((function(){return this[o]}),(function(t){var a;i&&c?(i.call(this,t),a=c.call(this)):a=t,j(this,o,_(e(this,a,r,n)))}))}(t||I,r,e,n)}function V(t){return function(r,e,n){for(var o=n,i=t.length-1;i>=0;--i)o=t[i](r,e,o);return o}}function X(t){return void 0===t.isReady||(k(t.isReady)?t.isReady():t.isReady)}function Z(t,r,e){var n,o;if(e){for(var i=0,c=e.length,u=void 0;i<c;++i)if((u=t.get(e[i]))&&!r(u))return!1}else try{for(var f=a(t.values()),s=f.next();!s.done;s=f.next()){if(!r(u=s.value))return!1}}catch(t){n={error:t}}finally{try{s&&!s.done&&(o=f.return)&&o.call(f)}finally{if(n)throw n.error}}return!0}function $(t){return void 0!==t.isError&&t.isError}function tt(t,r){var e,n;try{for(var o=a(t.values()),i=o.next();!i.done;i=o.next()){var c=i.value;if(r(c))return c}}catch(t){e={error:t}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(e)throw e.error}}}function rt(t,r){if(r.fromJSON)r.fromJSON(t);else for(var e in t)if(Y(r,e)){var n=t[e];F(n)&&r[e]?rt(n,r[e]):r[e]=n}}function et(t,r){if(r.fromJSON)r.fromJSON(t);else for(var e in t){var n=t[e];F(n)&&r[e]?et(n,r[e]):r[e]=n}}function nt(t){var r,e,n={};try{for(var o=a(t.entries()),i=o.next();!i.done;i=o.next()){var c=u(i.value,2),f=c[0],s=c[1];n[f]=s}}catch(t){r={error:t}}finally{try{i&&!i.done&&(e=o.return)&&e.call(o)}finally{if(r)throw r.error}}return JSON.parse(JSON.stringify(n))}function ot(t){var r,e;if(this===t.store){var n=this[S];try{for(var o=a(n),i=o.next();!i.done;i=o.next()){var c=i.value;k(c)?c():clearTimeout(c)}}catch(t){r={error:t}}finally{try{i&&!i.done&&(e=o.return)&&e.call(o)}finally{if(r)throw r.error}}}}function it(t,r){if(void 0===r&&(r=b),k(r))return r(t);for(var e in r){var n=r[e];if(!Y(t,e))return!1;if(k(n)){if(!n(t,e))return!1}else if(t[e]!==n)return!1}return!0}function ct(t){return{type:t,typeLoading:"".concat(t,"_LOADING"),typeSuccess:"".concat(t,"_SUCCESS"),typeError:"".concat(t,"_ERROR")}}var at=new function(){var t=this;this.batchFunction=U,this.createAction=B,this.createActionType=function(r){return function t(r,e){if(N(r)){for(var n="",o=0,i=r.length,c=void 0,a=void 0;o<i;++o)a=r[o],c=N(a)?t(a,e):G(a),n+=o>0?e+c:c;return n}return G(r)}(r,t.actionTypeDivider)},this.actionTypeDivider=".",this.dispatchEffectsOrig=W,this.dispatchEffects=W,this.hydrateStoresToState=nt,this.mergeStateToStore=rt,this.setStateToStore=et,this.configure=function(r){var e=r.batchFunction,n=r.createAction,o=r.actionTypeDivider,i=r.createActionType,c=r.dispatchEffects,a=r.hydrateStoresToState,u=r.mergeStateToStore,f=r.setStateToStore;e&&(t.batchFunction=e,t.dispatchEffects=e(t.dispatchEffectsOrig)),n&&(t.createAction=n),i&&(t.createActionType=i),o&&(t.actionTypeDivider=o),c&&(t.dispatchEffectsOrig=c,t.dispatchEffects=t.batchFunction(c)),a&&(t.hydrateStoresToState=a),u&&(t.mergeStateToStore=u),f&&(t.setStateToStore=f)}},ut=function(){function t(t,r,e,n){this.middleware=t,this.directorr=n,this.next=function(t){return r(e,t)}}return t.prototype.run=function(t){this.middleware(t,this.next,this.directorr)},t}(),ft=function(){function t(t,r,e,n,o){this.next=function(t){return r(e,t)},this.middleware=t(o)(this.next)}return t.prototype.run=function(t){this.middleware(t)},t}(),st={global:!0},lt=function(){function t(t){var r,e=(void 0===t?I:t).initState,n=void 0===e?I:e,o=this;this.stores=new Map,this.setStateToStore=at.batchFunction((function(t){var r,e;try{for(var n=a(o.stores.entries()),i=n.next();!i.done;i=n.next()){var c=u(i.value,2),f=c[0],s=c[1];Y(t,f)&&at.setStateToStore(t[f],s)}}catch(t){r={error:t}}finally{try{i&&!i.done&&(e=n.return)&&e.call(n)}finally{if(r)throw r.error}}})),this.mergeStateToStore=at.batchFunction((function(t){var r,e;try{for(var n=a(o.stores.entries()),i=n.next();!i.done;i=n.next()){var c=u(i.value,2),f=c[0],s=c[1];Y(t,f)&&at.mergeStateToStore(t[f],s)}}catch(t){r={error:t}}finally{try{i&&!i.done&&(e=n.return)&&e.call(n)}finally{if(r)throw r.error}}})),this.subscribeHandlers=[],this.subscribe=function(t){return o.subscribeHandlers=f(f([],u(o.subscribeHandlers),!1),[t],!1),function(){return o.unsubscribe(t)}},this.unsubscribe=function(t){o.subscribeHandlers=o.subscribeHandlers.filter((function(r){return r!==t}))},this.middlewares=[],this.findNextMiddleware=function(t,r){var e=o.middlewares[t+1];e?e.run(r):o.runEffects(r)},this.dispatch=at.batchFunction((function(t){if(!q(t))throw new Error(function(t,r){return"".concat(t,": call with action=").concat(JSON.stringify(r)," not like action type")}("Directorr",t));return o.findNextMiddleware(-1,t),t})),this.dispatchType=function(t,r){return o.dispatch(at.createAction(t,r))},this.reduxStore=((r={getState:function(){return o.getHydrateStoresState()},dispatch:this.dispatch,subscribe:this.subscribe,replaceReducer:m})[Symbol.observable]=function(){var t,r=o.subscribe;return(t={subscribe:function(t){if(null===t||!F(t))throw new TypeError("Expected the observer to be an object");return{unsubscribe:t.next?r((function(r){return t.next(r)})):m}}})[Symbol.observable]=function(){return this},t},r),this.afterwares=[],this.initState=n}return t.prototype.getStore=function(t){return this.stores.get(z(t))},t.prototype.getHydrateStoresState=function(){return at.hydrateStoresToState(this.stores)},t.prototype.addStores=function(t){var r=this;t.forEach((function(t){return r.addStore(t)}))},t.prototype.addStore=function(t){return this.addStoreDependency(t,st)},t.prototype.removeStore=function(t){return this.removeStoreDependency(t,st)},t.prototype.addStoreDependency=function(t,r){var e=this.initStore(t);return e[v].push(r),e},t.prototype.removeStoreDependency=function(t,r){var e=this.getStore(t);if(e){var n=e[v],o=n.indexOf(r);-1!==o&&n.splice(o,1),n.length||this.destroyStore(t)}},t.prototype.initStore=function(t){var r,e,n=this,i=z(t);if(this.stores.has(i))return this.stores.get(i);if(Y(t,p)){var c=t[p];try{try{for(var u=a(c),f=u.next();!f.done;f=u.next()){var s=f.value;this.initStore(s)[y].push(t)}}catch(t){r={error:t}}finally{try{f&&!f.done&&(e=u.return)&&e.call(u)}finally{if(r)throw r.error}}}catch(t){if(t instanceof RangeError)throw new TypeError(o("Directorr"));throw t}}t.afterware&&this.addAfterware(t.afterware);var S=new t(t.storeInitOptions);if(Y(S,y)||(j(S,y,_([])),j(S,v,_([]))),j(S,h,_(this.stores)),j(S,l,_(this.dispatch)),j(S,w,_(this.subscribe)),Y(S,d)||j(S,d,_(m)),this.stores.set(i,S),Y(this.initState,i)&&(at.mergeStateToStore(this.initState[i],S),delete this.initState[i]),Y(t,p)){var E=(c=t[p]).map((function(t){return z(t)}));Z(this.stores,X,E)?this.dispatchType("@@DIRECTORR.INIT_STORE",{store:S}):this.waitStoresState(c).then((function(){n.dispatchType("@@DIRECTORR.INIT_STORE",{store:S})}))}else this.dispatchType("@@DIRECTORR.INIT_STORE",{store:S});return S},t.prototype.destroyStore=function(t,r){var e,n,i=z(t),c=this.stores.get(i);if(c){if(Y(t,p)){var u=t[p];try{try{for(var f=a(u),s=f.next();!s.done;s=f.next()){var d=s.value;this.destroyStore(d,t)}}catch(t){e={error:t}}finally{try{s&&!s.done&&(n=f.return)&&n.call(f)}finally{if(e)throw e.error}}}catch(t){if(t instanceof RangeError)throw new TypeError(o("Directorr"));throw t}}if(r){var h=c[y],S=h.indexOf(r);h.splice(S,1)}c[y].length||c[v].length||(t.afterware&&this.removeAfterware(t.afterware),this.dispatchType("@@DIRECTORR.DESTROY_STORE",{store:c}),j(c,l,_(m)),this.stores.delete(i))}},t.prototype.waitAllStoresState=function(t){var r=this;return void 0===t&&(t=X),P((function(e,n,o){if(Z(r.stores,t))return e(void 0);var i=r.subscribe((function(r){if(Z(r,t))return i(),e(void 0)}));o(i)}))},t.prototype.waitStoresState=function(t,r){var e=this;void 0===r&&(r=X);var n=t.map((function(t){return z(t)}));return P((function(t,o,i){if(Z(e.stores,r,n))return t(void 0);var c=e.subscribe((function(e){if(Z(e,r,n))return c(),t(void 0)}));i(c)}))},t.prototype.findStoreState=function(t){var r=this;return void 0===t&&(t=$),P((function(e,n,o){var i=tt(r.stores,t);if(i)return e(i);var c=r.subscribe((function(r){var n=tt(r,t);if(n)return c(),e(n)}));o(c)}))},t.prototype.addSomeMiddlewares=function(t,r){for(var e,n=this.middlewares.length,o=function(o,c,a){if(a=t[o],i.middlewares.some((function(t){return t.middleware===a})))return e=a,"continue";i.middlewares.push(new r(a,i.findNextMiddleware,n+o,i,i.reduxStore)),e=a},i=this,c=0,a=t.length,u=void 0;c<a;++c)o(c,0,u),u=e},t.prototype.addReduxMiddlewares=function(t){this.addSomeMiddlewares(t,ft)},t.prototype.addMiddlewares=function(t){this.addSomeMiddlewares(t,ut)},t.prototype.removeMiddleware=function(t){var r=this.middlewares.findIndex((function(r){return r.middleware===t}));this.middlewares.splice(r,1)},t.prototype.addAfterware=function(t){this.afterwares=f(f([],u(this.afterwares),!1),[t],!1)},t.prototype.removeAfterware=function(t){this.afterwares=this.afterwares.filter((function(r){return r!==t}))},t.prototype.runEffects=function(t){var r,e,n,o,i,c;try{for(var u=a(this.stores.values()),f=u.next();!f.done;f=u.next()){f.value[d](t)}}catch(t){r={error:t}}finally{try{f&&!f.done&&(e=u.return)&&e.call(u)}finally{if(r)throw r.error}}try{for(var s=a(this.afterwares),l=s.next();!l.done;l=s.next()){(0,l.value)(t,this.dispatchType,this)}}catch(t){n={error:t}}finally{try{l&&!l.done&&(o=s.return)&&o.call(s)}finally{if(n)throw n.error}}try{for(var h=a(this.subscribeHandlers),p=h.next();!p.done;p=h.next()){(0,p.value)(this.stores,t)}}catch(t){i={error:t}}finally{try{p&&!p.done&&(c=h.return)&&c.call(h)}finally{if(i)throw i.error}}},t}();function dt(t,r,e){d in t&&t[d](at.createAction(r,e))}function ht(t,r,e){return[r,e]}function pt(t,r,e,n,o){return void 0===n&&(n=ht),void 0===o&&(o=O),function(i,c){var a=n(t,i,c);return o((function(n,o,i){return r(n,o,i,t,e,a)}),a)}}function yt(t,r,e,n,o,i,c){if(void 0===c&&(c=Q),!function(t){return!!(null==t?void 0:t.initializer)||!(null==t?void 0:t.value)}(e))throw new Error(function(t,r){return"".concat(t,": use for property=").concat(r," not like property decorator")}(n,r));return c(e,r,o,i)}function vt(t,r,n){if(!J(r))throw new Error(e(t,r));return[at.createActionType(r),n]}function St(t){Y(t,d)||(j(t,d,_(at.dispatchEffects)),j(t,l,_(at.dispatchEffects)),j(t,s,_(new Map)),j(t,v,_([])),j(t,y,_([])),j(t,h,_(null)))}function Et(t,r,e,n,o){var i,c=e.apply(void 0,f([],u(t),!1));return null!==c&&((i=c)&&i.then&&i.catch?c.then((function(t){null!==t&&n[l](at.createAction(r,o(t,n)))})):n[l](at.createAction(r,o(c,n)))),c}var wt=pt("action",yt,(function(t,r,e,o,i,c){var a=u(o,2),f=a[0],s=a[1],l=void 0===s?O:s;if(void 0===i&&(i=Et),void 0===c&&(c=St),!k(r))throw new Error(n("action",e));return c(t),function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return i(e,f,r,t,l)}}),vt,(function(t,r){return t.type=r[0],t.createAction=function(r){return at.createAction(t.type,r)},t.isAction=function(r){return t.type===r.type},t}));var Tt=pt("effect",yt,(function(t,r,e,o,i){var c=u(o,1)[0];if(void 0===i&&(i=St),!k(r))throw new Error(n("effect",e));i(t);var a=t[s],f=a.get(c);return f?f.push(e):a.set(c,[e]),r}),vt,(function(t,r){return t.type=r[0],t.createAction=function(r){return at.createAction(t.type,r)},t.isAction=function(r){return t.type===r.type},t}));var Rt=Tt("@@DIRECTORR.ANY_ACTION");function mt(t){this===t.store&&this[T].forEach((function(t){return t()}))}var Ot=function(){var t=this;this.stores=new Map,this.actions=[],this.addStores=jest.fn().mockImplementation((function(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];r.forEach((function(r){var e=new r;return t.stores.set(z(r),e),e}))})),this.addStore=jest.fn().mockImplementation((function(r){var e=new r;return t.stores.set(z(r),e),e})),this.addStoreDependency=jest.fn().mockImplementation((function(r){var e=new r;return t.stores.set(z(r),e),e})),this.removeStoreDependency=jest.fn(),this.getHydrateStoresState=jest.fn(),this.getStore=jest.fn().mockImplementation((function(r){return t.stores.get(z(r))})),this.waitAllStoresState=jest.fn().mockImplementationOnce((function(){var t=Promise.resolve();return t.cancel=jest.fn(),t})),this.waitStoresState=jest.fn().mockImplementationOnce((function(t){var r=Promise.resolve(t);return r.cancel=jest.fn(),r})),this.findStoreState=jest.fn().mockImplementationOnce((function(){var t=Promise.resolve();return t.cancel=jest.fn(),t})),this.dispatch=jest.fn().mockImplementationOnce((function(r){return t.actions.push(r)})),this.dispatchType=jest.fn().mockImplementationOnce((function(r,e){return t.dispatch({type:r,payload:e})})),this.addInitState=jest.fn(),this.removeStore=jest.fn(),this.addReduxMiddlewares=jest.fn(),this.addMiddlewares=jest.fn(),this.mergeStateToStore=jest.fn(),this.setStateToStore=jest.fn(),this.removeMiddleware=jest.fn()},bt=function(t,e,n){if(!(o=e)||!k(o)&&!F(o))throw new Error(function(t,e){return r(t,e,"not like object or function")}(t,e));var o;if(n&&!k(n))throw new Error(function(t,e){return r(t,e,"not like function")}(t,n));return[e,n]};function It(t,r,e,n){var o=u(n,1)[0];if(!t)return r(t);if(k(o))return o(t,e)?r(t):void 0;for(var i in o){var c=o[i];if(k(c)){if(!Y(e,i)||!c(e,t,i))return}else if(e[i]!==c)return}return r(t)}var At=pt("whenState",yt,(function(t,r,e,o,i){if(void 0===i&&(i=It),!k(r))throw new Error(n("whenState",e));return function(e){return i(e,r,t,o)}}),bt);function Dt(t,r,e){var n=u(e,2),o=n[0],i=n[1],c=void 0===i?O:i;return t?it(t,o)?r(c(t)):void 0:r(c(t))}var gt=pt("whenPayload",yt,(function(t,r,e,o,i){if(void 0===i&&(i=Dt),!k(r))throw new Error(n("whenPayload",e));return function(t){return i(t,r,o)}}),bt),_t=V([Tt("@@DIRECTORR.DESTROY_STORE"),At(H)]),xt=V([Tt("@@DIRECTORR.INIT_STORE"),At(H)]),Nt=wt("@@DIRECTORR.RELOAD_STORE");var jt=function(t,e){return function(n){if(!k(n))throw new Error(function(t,e){return r(t,e,"not constuctor")}(t,n));return function(r,o,i){if(function(t){return!(!t||K(t))}(i))throw new Error(function(t){return"".concat(t,": dont use with another decorators")}(t));var c=r.constructor;if(Y(c,p)){var a=c[p];a.includes(n)||a.push(n)}else j(c,p,_([n]));return e(n,t)}}}("injectStore",(function(t,r){return x((function(){if(!this[h])throw new Error(function(t,r){return"".concat(t,": store with constuctor=").concat(r.name," not add to Dirrector")}(r,t));var e=this[h].get(z(t));if(!e)throw new Error(function(t,r,e){return"".concat(t,": for some reason, not found store or model with constuctor=").concat(r.name,", may be worth adding storage=").concat(r.name," earlier than the current=").concat(e.name)}(r,t,this.constructor));return e}))}));var Ct=pt("delay",yt,(function(t,r,e,o,i){var c=u(o,1)[0],a=void 0===c?0:c;if(void 0===i&&(i=St),!k(r))throw new Error(n("delay",e));if(i(t),!Y(t,S)){var l=t[s],d=l.get("@@DIRECTORR.DESTROY_STORE");d?d.push(E):l.set("@@DIRECTORR.DESTROY_STORE",[E]),j(t,S,_([])),j(t,E,_(ot))}return function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];var o=t[S],i=setTimeout((function(){o.splice(o.indexOf(i),1),r.apply(void 0,f([],u(e),!1))}),a);o.push(i)}})),Mt=Tt("@@DIRECTORR.RELOAD_STORE");function Pt(t,r,e,n,o){r[d](t),e[d](at.createAction(at.createActionType(o?[o,t.type]:t.type),c(c({},t.payload),{connectStoreProperty:n})))}function Ft(t,r,e,n,o){return void 0===o&&(o=Pt),j(t,l,_((function(i){return o(i,t,r,e,n)})))}var Lt=pt("connectStore",yt,(function(t,r,e,n,o,i){if(void 0===o&&(o=Ft),void 0===i&&(i=St),k(r))throw new Error(function(t,r){return"".concat(t,": use decorator for prop=").concat(r," equal object")}("connectStore",e));return i(t),r?o(r,t,e,n):r}),(function(t,r){if(r){if(!J(r))throw new Error(e(t,r));return at.createActionType(r)}return r}));t.DEPENDENCY_FIELD_NAME=v,t.DIRECTORR_DESTROY_STORE_ACTION="@@DIRECTORR.DESTROY_STORE",t.DIRECTORR_INIT_STORE_ACTION="@@DIRECTORR.INIT_STORE",t.DIRECTORR_RELOAD_STORE_ACTION="@@DIRECTORR.RELOAD_STORE",t.DISPATCH_ACTION_FIELD_NAME=l,t.DISPATCH_EFFECTS_FIELD_NAME=d,t.Directorr=lt,t.DirectorrMock=Ot,t.EMPTY_FUNC=m,t.EMPTY_OBJECT=I,t.EMPTY_STRING="",t.GLOBAL_DEP=st,t.INJECTED_FROM_FIELD_NAME=y,t.INJECTED_STORES_FIELD_NAME=p,t.MODULE_NAME="Directorr",t.OMIT_ACTIONS=["@APPLY_SNAPSHOT"],t.STORES_FIELD_NAME=h,t.action=wt,t.allEffect=Rt,t.callWithPropNotEquallFunc=n,t.composePropertyDecorators=V,t.config=at,t.connectStore=Lt,t.createAction=B,t.createActionAndEffect=function(t){var r=ct(at.createActionType(t)),e=r.type,n=r.typeSuccess,o=r.typeError,i=r.typeLoading;return[wt(e),Tt(e),wt(n),Tt(n),wt(o),Tt(o),wt(i),Tt(i)]},t.createActionFactory=function(t){return function(r){return at.createAction(t,r)}},t.createDecoratorFactory=pt,t.createDispatcher=function(t){if(!Y(t,T)){var r=t[s],e=r.get("@@DIRECTORR.DESTROY_STORE");e?e.push(R):r.set("@@DIRECTORR.DESTROY_STORE",[R]),j(t,T,_([])),j(t,R,_(mt))}return function(r,e,n){if(!t[w])throw new Error(function(t,r){var e;return"".concat(t,": call with not connected to directorr store=").concat(null===(e=null==r?void 0:r.construnctor)||void 0===e?void 0:e.name)}("createDispatcher",t));if(!Array.isArray(r))return t[l](at.createAction(at.createActionType(r),e));var o=u(r,3),i=o[0],c=o[1],a=o[2],f=ct(at.createActionType(i)),s=f.type,d=c?at.createActionType(c):f.typeSuccess,h=a?at.createActionType(a):f.typeError,p=t[T],y=[d,h],v=P((function(r,e,o){var i=t[w]((function(t,o){if(y.includes(o.type)&&it(o.payload,n))return i(),p.splice(p.indexOf(v.cancel),1),o.type===d?r(o.payload):e(o.payload)}));o(i)}));return p.push(v.cancel),t[l](at.createAction(s,e)),v}},t.createPropertyDecoratorFactory=function(t,r,e){return pt(t,yt,r,e)},t.delay=Ct,t.dispatchActionInStore=function(t,r,e){l in t&&t[l](at.createAction(r,e))},t.dispatchDestroyEffectInStore=function(t){dt(t,"@@DIRECTORR.DESTROY_STORE",{store:t})},t.dispatchEffectInStore=dt,t.dispatchInitEffectInStore=function(t){dt(t,"@@DIRECTORR.INIT_STORE",{store:t})},t.dispatchReloadEffectInStore=function(t,r){dt(t,"@@DIRECTORR.RELOAD_STORE",r)},t.effect=Tt,t.getStoreName=z,t.injectStore=jt,t.isActionHave=function(t,r,e){var n=t.type,o=t.payload;return n===r&&function(t,r){if(!r)return!1;for(var e in t){var n=t[e];if(k(n)){if(!n(r[e]))return!1}else if(r[e]!==n)return!1}return!0}(e,o)},t.isFunction=k,t.isLikeAction=q,t.isStoreError=$,t.isStoreReady=X,t.isString=L,t.propIsNotEqual=function(t){return function(r,e){return r[e]!==t}},t.propIsNotEqualOneOf=function(t){return function(r,e){return!t.includes(r[e])}},t.propOneOf=function(t){return function(r,e){return t.includes(r[e])}},t.reloadAction=Nt,t.whenDestroy=_t,t.whenInit=xt,t.whenPayload=gt,t.whenReload=Mt,t.whenState=At,Object.defineProperty(t,"__esModule",{value:!0})}));