react-hooks-global-states
Version:
This is a package to easily handling global-state across your react-components using hooks.
1 lines • 20.9 kB
JavaScript
var t,e;t=this,e=(t,e,r,n,o,i,a,s,u,c)=>(()=>{"use strict";var l={45:e=>{e.exports=t},78:t=>{t.exports=e},155:t=>{t.exports=r},187:t=>{t.exports=n},293:t=>{t.exports=o},361:t=>{t.exports=i},487:t=>{t.exports=a},506:t=>{t.exports=s},673:t=>{t.exports=u},773:t=>{t.exports=c}},f={};function p(t){var e=f[t];if(void 0!==e)return e.exports;var r=f[t]={exports:{}};return l[t](r,r.exports,p),r.exports}var d={};return(()=>{var t=d;function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},e(t)}function r(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,s=[],u=!0,c=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=i.call(r)).done)&&(s.push(n.value),s.length!==e);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,e)||n(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function n(t,e){if(t){if("string"==typeof t)return o(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?o(t,e):void 0}}function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function i(){i=function(){return r};var t,r={},n=Object.prototype,o=n.hasOwnProperty,a=Object.defineProperty||function(t,e,r){t[e]=r.value},s="function"==typeof Symbol?Symbol:{},u=s.iterator||"@@iterator",c=s.asyncIterator||"@@asyncIterator",l=s.toStringTag||"@@toStringTag";function f(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{f({},"")}catch(t){f=function(t,e,r){return t[e]=r}}function p(t,e,r,n){var o=e&&e.prototype instanceof S?e:S,i=Object.create(o.prototype),s=new q(n||[]);return a(i,"_invoke",{value:x(t,r,s)}),i}function d(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}r.wrap=p;var h="suspendedStart",v="suspendedYield",b="executing",g="completed",y={};function S(){}function m(){}function w(){}var O={};f(O,u,(function(){return this}));var j=Object.getPrototypeOf,E=j&&j(j(R([])));E&&E!==n&&o.call(E,u)&&(O=E);var _=w.prototype=S.prototype=Object.create(O);function C(t){["next","throw","return"].forEach((function(e){f(t,e,(function(t){return this._invoke(e,t)}))}))}function k(t,r){function n(i,a,s,u){var c=d(t[i],t,a);if("throw"!==c.type){var l=c.arg,f=l.value;return f&&"object"==e(f)&&o.call(f,"__await")?r.resolve(f.__await).then((function(t){n("next",t,s,u)}),(function(t){n("throw",t,s,u)})):r.resolve(f).then((function(t){l.value=t,s(l)}),(function(t){return n("throw",t,s,u)}))}u(c.arg)}var i;a(this,"_invoke",{value:function(t,e){function o(){return new r((function(r,o){n(t,e,r,o)}))}return i=i?i.then(o,o):o()}})}function x(e,r,n){var o=h;return function(i,a){if(o===b)throw Error("Generator is already running");if(o===g){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var s=n.delegate;if(s){var u=T(s,n);if(u){if(u===y)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===h)throw o=g,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=b;var c=d(e,r,n);if("normal"===c.type){if(o=n.done?g:v,c.arg===y)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(o=g,n.method="throw",n.arg=c.arg)}}}function T(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,T(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),y;var i=d(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,y;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,y):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,y)}function A(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function L(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function q(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(A,this),this.reset(!0)}function R(r){if(r||""===r){var n=r[u];if(n)return n.call(r);if("function"==typeof r.next)return r;if(!isNaN(r.length)){var i=-1,a=function e(){for(;++i<r.length;)if(o.call(r,i))return e.value=r[i],e.done=!1,e;return e.value=t,e.done=!0,e};return a.next=a}}throw new TypeError(e(r)+" is not iterable")}return m.prototype=w,a(_,"constructor",{value:w,configurable:!0}),a(w,"constructor",{value:m,configurable:!0}),m.displayName=f(w,l,"GeneratorFunction"),r.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===m||"GeneratorFunction"===(e.displayName||e.name))},r.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,w):(t.__proto__=w,f(t,l,"GeneratorFunction")),t.prototype=Object.create(_),t},r.awrap=function(t){return{__await:t}},C(k.prototype),f(k.prototype,c,(function(){return this})),r.AsyncIterator=k,r.async=function(t,e,n,o,i){void 0===i&&(i=Promise);var a=new k(p(t,e,n,o),i);return r.isGeneratorFunction(e)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},C(_),f(_,l,"Generator"),f(_,u,(function(){return this})),f(_,"toString",(function(){return"[object Generator]"})),r.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},r.values=R,q.prototype={constructor:q,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(L),!e)for(var r in this)"t"===r.charAt(0)&&o.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function n(n,o){return s.type="throw",s.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var u=o.call(a,"catchLoc"),c=o.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&o.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var i=n;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,y):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),y},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),L(r),y}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;L(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:R(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),y}},r}function a(t){var r=function(t){if("object"!=e(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=e(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==e(r)?r:r+""}Object.defineProperty(t,"__esModule",{value:!0}),t.GlobalStore=void 0;var s=p(155),u=p(506),c=p(773),l=p(187),f=p(487),h=p(673),v=p(361),b=p(78),g=p(293),y=p(45),S=globalThis;!function(){if(!S.REACT_GLOBAL_STATE_HOOK_DEBUG&&!(0,c.isNil)(S.sessionStorage)){try{if(!S.sessionStorage.getItem("REACT_GLOBAL_STATE_HOOK_DEBUG"))return}catch(t){return}S.REACT_GLOBAL_STATE_TEMP_HOOKS=new Map,setTimeout((function(){S.REACT_GLOBAL_STATE_TEMP_HOOKS=null}),6e4)}}();var m=function(){return t=function t(e){var o,p=this,d=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{metadata:{}};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.wasDisposed=!1,this.actionsConfig=null,this.callbacks=null,this.actions=null,this.subscribers=new Map,this.initialize=function(){return t=p,e=void 0,r=i().mark((function t(){var e,r,n,o,a,s;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(Object.keys(null!==(e=this.actionsConfig)&&void 0!==e?e:{}).length>0&&(this.actions=this.getStoreActionsMap()),n=this.onInit,o=null!==(r=this.callbacks)&&void 0!==r?r:{},a=o.onInit,n||a){t.next=6;break}return t.abrupt("return");case 6:s=this.getConfigCallbackParam(),null==n||n(s),(0,c.isNil)(a)||null==a||a(s);case 9:case"end":return t.stop()}}),t,this)})),new(e||(e=Promise))((function(n,o){function i(t){try{s(r.next(t))}catch(t){o(t)}}function a(t){try{s(r.throw(t))}catch(t){o(t)}}function s(t){var r;t.done?n(t.value):(r=t.value,r instanceof e?r:new e((function(t){t(r)}))).then(i,a)}s((r=r.apply(t,[])).next())}));var t,e,r},this.executeSetStateForSubscriber=function(t,e){var r,n,o=t.selector,i=t.callback,a=t.currentState,s=t.config;if(!e.forceUpdate&&(null!==(r=null==s?void 0:s.isEqualRoot)&&void 0!==r?r:function(t,e){return t===e})(e.currentRootState,e.newRootState))return{didUpdate:!1};var u=o?o(e.newRootState):e.newRootState;return!e.forceUpdate&&(null!==(n=null==s?void 0:s.isEqual)&&void 0!==n?n:function(t,e){return t===e})(a,u)?{didUpdate:!1}:(p.partialUpdateSubscription(t.subscriptionId,{currentState:u}),i({state:u},{identifier:e.identifier}),{didUpdate:!0})},this.setState=function(t,e){var r=t.state,o=e.forceUpdate,i=e.identifier,a=p.stateWrapper.state;if(o||a!==r){p.stateWrapper={state:r};var s,u={forceUpdate:o,newRootState:r,currentRootState:a,identifier:i},c=function(t){var e="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!e){if(Array.isArray(t)||(e=n(t))){e&&(t=e);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){e=e.call(t)},n:function(){var t=e.next();return a=t.done,t},e:function(t){s=!0,i=t},f:function(){try{a||null==e.return||e.return()}finally{if(s)throw i}}}}(p.subscribers.values());try{for(c.s();!(s=c.n()).done;){var l=s.value;p.executeSetStateForSubscriber(l,u)}}catch(t){c.e(t)}finally{c.f()}}},this.setMetadata=function(t){var e=(0,u.isFunction)(t)?t(p.metadata):t;p.metadata=e},this.getMetadata=function(){return p.metadata},this.getState=function(t,e,r){var n;if(!t)return p.stateWrapper.state;var o=(0,u.isFunction)(e),i=o?t:void 0,a=o?e:t,s=null!==(n=o?r:e)&&void 0!==n?n:void 0,c=i?i(p.stateWrapper.state):p.stateWrapper.state;(null==s?void 0:s.skipFirst)||a(c);var l=(0,b.uniqueId)("gs:");return p.setOrUpdateSubscription({subscriptionId:l,selector:i,config:s,currentState:c,callback:function(t){var e=t.state;return a(e)},isSetStateCallback:!1}),function(){p.subscribers.delete(l)}},this.getConfigCallbackParam=function(){var t=p.setMetadata,e=p.getMetadata,r=p.getState,n=p.actions;return{setMetadata:t,getMetadata:e,getState:r,setState:p.setStateWrapper,actions:n}},this.lastSubscriptionId=null,this.setOrUpdateSubscription=function(t){var e=t.subscriptionId;if(!e)return{isNewSubscription:!1};var r=p.subscribers.get(e);return(0,f.isRecord)(r)?(Object.assign(r,t),{isNewSubscription:!1}):(p.executeOnSubscribed(),p.subscribers.set(e,t),p.lastSubscriptionId=e,{isNewSubscription:!0})},this.partialUpdateSubscription=function(t,e){var r=p.subscribers.get(t);(0,f.isRecord)(r)&&Object.assign(r,e)},this.executeOnSubscribed=function(){var t,e=p.onSubscribed,r=null===(t=p.callbacks)||void 0===t?void 0:t.onSubscribed;if(e||r){var n=p.getConfigCallbackParam();null==e||e(n),null==r||r(n)}},this.getHook=function(){var t=function(t){var e,n,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];if(p.wasDisposed)throw new Error("The global state was disposed");var i=Array.isArray(o)?{dependencies:o}:null!=o?o:{},a=(0,s.useRef)({subscriptionId:null,tempInitialRootState:p.stateWrapper.state}),u=function(){return t?{state:t(p.stateWrapper.state)}:p.stateWrapper},f=r((0,s.useState)(u),2),d=f[0],h=f[1];(0,s.useEffect)((function(){if(!(0,c.isNil)(a.current)){(0,c.isNil)(a.current.subscriptionId)&&(a.current.subscriptionId=(0,b.uniqueId)("ss:"));var e=a.current.subscriptionId,r={subscriptionId:e,currentState:d.state,selector:t,config:i,callback:h,isSetStateCallback:!0};return p.setOrUpdateSubscription(r).isNewSubscription&&(p.executeSetStateForSubscriber(r,{forceUpdate:!1,newRootState:p.stateWrapper.state,currentRootState:a.current.tempInitialRootState===g.uniqueSymbol?p.stateWrapper.state:a.current.tempInitialRootState,identifier:"on mount state update"}),a.current.tempInitialRootState=g.uniqueSymbol),function(){p.subscribers.delete(e)}}}),[]);var v=(0,l.isString)(null===(e=a.current)||void 0===e?void 0:e.subscriptionId)?a.current.subscriptionId:"",y=p.subscribers.get(v),S=(null!==(n=null==y?void 0:y.config)&&void 0!==n?n:{dependencies:i.dependencies}).dependencies;return p.partialUpdateSubscription(v,{currentState:d.state,selector:t,config:i,callback:h}),[p.computeSelectedState({selector:t,subscriptionId:v,config:i,currentDependencies:S,computeChildState:u,stateWrapperRef:d}),p.getStateOrchestrator(),p.metadata]};return t.stateControls=p.stateControls,t.createSelectorHook=p.createSelectorHook,t.createObservable=p.createObservable,t.removeSubscriptions=p.removeSubscriptions,t.dispose=p.dispose,t},this.computeSelectedState=function(t){var e=t.selector,r=t.subscriptionId,n=t.config,o=t.currentDependencies,i=t.computeChildState,a=t.stateWrapperRef;if(!e||!r)return a.state;var s=n.dependencies;if(o===s)return a.state;if((null==o?void 0:o.length)===(null==s?void 0:s.length)&&(0,h.shallowCompare)(o,s))return a.state;var u=i().state;return p.partialUpdateSubscription(r,{currentState:u}),a.state=u,u},this.createSelectorHook=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=n.isEqualRoot,i=n.isEqual,a=n.name,s=r(p.stateControls(),3),c=s[0],l=s[1],f=s[2],d=c(),h=(null!=e?e:function(t){return t})(d),v=new t(h,{name:null!=a?a:(0,b.uniqueId)("sh:")}),g=r(v.stateControls(),2),y=g[0],S=g[1],m=c((function(t){if(!(null!=o?o:Object.is)(d,t)){d=t;var r=e(t);(null!=i?i:Object.is)(h,r)||(h=r,S(r))}}),{skipFirst:!0}),w=v.getHook(),O=function(t,e){return[r((0,u.isFunction)(t)?w(t,e):w(),1)[0],l,f]};return O.stateControls=function(){return[y,l,f]},O.createSelectorHook=v.createSelectorHook,O.createObservable=p.createObservable.bind(O),O.removeSubscriptions=function(){m(),v.removeSubscriptions()},O.dispose=function(){O.removeSubscriptions(),v.dispose()},O},this.stateControls=function(){var t=p.getStateOrchestrator(),e=p.getMetadata;return[p.getState,t,e]},this.getStateOrchestrator=function(){return p.actions?p.actions:p.setStateWrapper},this.setStateWrapper=function(t){var e,r,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=n.forceUpdate,i=n.identifier,a=p.stateWrapper.state,s=(0,u.isFunction)(t)?t(a):t;if(o||p.stateWrapper.state!==s){var c=p.setMetadata,l=p.getMetadata,f=p.getState,d=p.actions,h={setMetadata:c,getMetadata:l,setState:p.setState,getState:f,actions:d,previousState:a,state:s,identifier:i},v=p.computePreventStateChange,b=null===(e=p.callbacks)||void 0===e?void 0:e.computePreventStateChange;if((v||b)&&((null==v?void 0:v(h))||(null==b?void 0:b(h))))return;p.setState({state:s},{forceUpdate:o,identifier:i});var g=p.onStateChanged,y=null===(r=p.callbacks)||void 0===r?void 0:r.onStateChanged;(g||y)&&(null==g||g(h),null==y||y(h))}},this.getStoreActionsMap=function(){if(!(0,f.isRecord)(p.actionsConfig))return null;var t=p.actionsConfig,e=p.setMetadata,r=p.setStateWrapper,n=p.getState,o=p.getMetadata,i=Object.keys(t).reduce((function(s,u){var c,l,f;return Object.assign(s,(c={},f=function(){for(var a=t[u],s=arguments.length,c=new Array(s),l=0;l<s;l++)c[l]=arguments[l];var f=a.apply(i,c);return"function"!=typeof f&&(0,v.throwWrongKeyOnActionCollectionConfig)(u),f.call(i,{setState:r,getState:n,setMetadata:e,getMetadata:o,actions:i})},(l=a(l=u))in c?Object.defineProperty(c,l,{value:f,enumerable:!0,configurable:!0,writable:!0}):c[l]=f,c)),s}),{});return i},this.removeSubscriptions=function(){p.subscribers.clear()},this.dispose=function(){p.wasDisposed=!0,p.removeSubscriptions(),p._name="",p.actionsConfig=null,p.callbacks=null,p.metadata={},p.actions=null,p.stateWrapper={state:null}};var m=d.metadata,w=d.callbacks,O=d.actions,j=d.name;this.stateWrapper={state:e},this._name=null!=j?j:(0,b.uniqueId)("gs:"),this.metadata=null!=m?m:{},this.callbacks=null!=w?w:null,this.actionsConfig=null!=O?O:null;var E="";if((S.REACT_GLOBAL_STATE_HOOK_DEBUG||S.REACT_GLOBAL_STATE_TEMP_HOOKS)&&(E=(0,y.generateStackHash)(null!==(o=(new Error).stack)&&void 0!==o?o:"")),S.REACT_GLOBAL_STATE_HOOK_DEBUG)S.REACT_GLOBAL_STATE_HOOK_DEBUG(this,d,E);else if(S.REACT_GLOBAL_STATE_TEMP_HOOKS){var _=void 0!==globalThis.WeakRef?new globalThis.WeakRef(this):this,C=void 0!==globalThis.WeakRef?new globalThis.WeakRef(d):d;S.REACT_GLOBAL_STATE_TEMP_HOOKS.set(E,[_,C])}this.constructor!==t||this.initialize()},e=[{key:"createObservable",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e.isEqualRoot,o=e.isEqual,i=e.name,a=r(this.stateControls(),1)[0],s=[],c=a(),l=(null!=t?t:function(t){return t})(a()),f=a((function(e){if(!(null!=n?n:Object.is)(c,e)){c=e;var r=t(e);(null!=o?o:Object.is)(l,r)||(l=r,s.forEach((function(t){return t()})))}}),{skipFirst:!0}),p=function(t,e,r){var n;if(!t)return l;var o=(0,u.isFunction)(e),i=o?t:void 0,a=o?e:t,c=null!==(n=o?r:e)&&void 0!==n?n:void 0,f=function(){return a(i?i(l):l)};(null==c?void 0:c.skipFirst)||f();var p=function(){f()};return s.push(p),function(){s.splice(s.indexOf(p),1)}};return p._name=null!=i?i:(0,b.uniqueId)("ob:"),p.createObservable=this.createObservable.bind(p),p.removeSubscriptions=function(){s.forEach((function(t){return t()})),s.length=0,f()},p.stateControls=function(){return[p]},p}}],e&&function(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,a(n.key),n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();t.GlobalStore=m,t.default=m})(),d})(),"object"==typeof exports&&"object"==typeof module?module.exports=e(require("./generateStackHash.js"),require("./uniqueId.js"),require("react"),require("json-storage-formatter/isString"),require("./uniqueSymbol.js"),require("./throwWrongKeyOnActionCollectionConfig.js"),require("./isRecord.js"),require("json-storage-formatter/isFunction"),require("./shallowCompare.js"),require("json-storage-formatter/isNil")):"function"==typeof define&&define.amd?define(["./generateStackHash.js","./uniqueId.js","react","json-storage-formatter/isString","./uniqueSymbol.js","./throwWrongKeyOnActionCollectionConfig.js","./isRecord.js","json-storage-formatter/isFunction","./shallowCompare.js","json-storage-formatter/isNil"],e):"object"==typeof exports?exports["react-hooks-global-states"]=e(require("./generateStackHash.js"),require("./uniqueId.js"),require("react"),require("json-storage-formatter/isString"),require("./uniqueSymbol.js"),require("./throwWrongKeyOnActionCollectionConfig.js"),require("./isRecord.js"),require("json-storage-formatter/isFunction"),require("./shallowCompare.js"),require("json-storage-formatter/isNil")):t["react-hooks-global-states"]=e(t["./generateStackHash.js"],t["./uniqueId.js"],t.react,t["json-storage-formatter/isString"],t["./uniqueSymbol.js"],t["./throwWrongKeyOnActionCollectionConfig.js"],t["./isRecord.js"],t["json-storage-formatter/isFunction"],t["./shallowCompare.js"],t["json-storage-formatter/isNil"]);