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