react-hooks-global-states 7.0.14 → 7.0.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/GlobalStore.js CHANGED
@@ -1 +1 @@
1
- !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("./generateStackHash.js"),require("./isRecord.js"),require("./shallowCompare.js"),require("./throwWrongKeyOnActionCollectionConfig.js"),require("./uniqueId.js"),require("./uniqueSymbol.js"),require("react")):"function"==typeof define&&define.amd?define(["./generateStackHash.js","./isRecord.js","./shallowCompare.js","./throwWrongKeyOnActionCollectionConfig.js","./uniqueId.js","./uniqueSymbol.js","react"],e):"object"==typeof exports?exports["react-hooks-global-states"]=e(require("./generateStackHash.js"),require("./isRecord.js"),require("./shallowCompare.js"),require("./throwWrongKeyOnActionCollectionConfig.js"),require("./uniqueId.js"),require("./uniqueSymbol.js"),require("react")):t["react-hooks-global-states"]=e(t["./generateStackHash.js"],t["./isRecord.js"],t["./shallowCompare.js"],t["./throwWrongKeyOnActionCollectionConfig.js"],t["./uniqueId.js"],t["./uniqueSymbol.js"],t.react)}(this,((t,e,r,n,i,o,a)=>(()=>{var s={244:function(t){t.exports=(()=>{"use strict";var t={};return(()=>{var e=t;Object.defineProperty(e,"__esModule",{value:!0}),e.isFunction=void 0,e.isFunction=function(t){return"function"==typeof t||t instanceof Function}})(),t})()},125:function(t){t.exports=(()=>{"use strict";var t={};return(()=>{var e=t;Object.defineProperty(e,"__esModule",{value:!0}),e.isNil=void 0,e.isNil=function(t){return null==t}})(),t})()},281:function(t){t.exports=(()=>{"use strict";var t={};return(()=>{var e=t;Object.defineProperty(e,"__esModule",{value:!0}),e.isString=void 0,e.isString=function(t){return"string"==typeof t}})(),t})()},109:e=>{"use strict";e.exports=t},664:t=>{"use strict";t.exports=e},682:t=>{"use strict";t.exports=r},286:t=>{"use strict";t.exports=n},865:t=>{"use strict";t.exports=i},69:t=>{"use strict";t.exports=o},156:t=>{"use strict";t.exports=a}},u={};function c(t){var e=u[t];if(void 0!==e)return e.exports;var r=u[t]={exports:{}};return s[t].call(r.exports,r,r.exports,c),r.exports}var l={};return(()=>{"use strict";var t=l;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,i,o,a,s=[],u=!0,c=!1;try{if(o=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=o.call(r)).done)&&(s.push(n.value),s.length!==e);u=!0);}catch(t){c=!0,i=t}finally{try{if(!u&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw i}}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 i(t,e);var r=Object.prototype.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)?i(t,e):void 0}}function i(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function o(){o=function(){return t};var t={},r=Object.prototype,n=r.hasOwnProperty,i=Object.defineProperty||function(t,e,r){t[e]=r.value},a="function"==typeof Symbol?Symbol:{},s=a.iterator||"@@iterator",u=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function l(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(t){l=function(t,e,r){return t[e]=r}}function f(t,e,r,n){var o=e&&e.prototype instanceof h?e:h,a=Object.create(o.prototype),s=new C(n||[]);return i(a,"_invoke",{value:E(t,r,s)}),a}function p(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=f;var d={};function h(){}function v(){}function b(){}var g={};l(g,s,(function(){return this}));var y=Object.getPrototypeOf,S=y&&y(y(k([])));S&&S!==r&&n.call(S,s)&&(g=S);var m=b.prototype=h.prototype=Object.create(g);function w(t){["next","throw","return"].forEach((function(e){l(t,e,(function(t){return this._invoke(e,t)}))}))}function O(t,r){function o(i,a,s,u){var c=p(t[i],t,a);if("throw"!==c.type){var l=c.arg,f=l.value;return f&&"object"==e(f)&&n.call(f,"__await")?r.resolve(f.__await).then((function(t){o("next",t,s,u)}),(function(t){o("throw",t,s,u)})):r.resolve(f).then((function(t){l.value=t,s(l)}),(function(t){return o("throw",t,s,u)}))}u(c.arg)}var a;i(this,"_invoke",{value:function(t,e){function n(){return new r((function(r,n){o(t,e,r,n)}))}return a=a?a.then(n,n):n()}})}function E(t,e,r){var n="suspendedStart";return function(i,o){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw o;return T()}for(r.method=i,r.arg=o;;){var a=r.delegate;if(a){var s=_(a,r);if(s){if(s===d)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=p(t,e,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===d)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}function _(t,e){var r=e.method,n=t.iterator[r];if(void 0===n)return e.delegate=null,"throw"===r&&t.iterator.return&&(e.method="return",e.arg=void 0,_(t,e),"throw"===e.method)||"return"!==r&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+r+"' method")),d;var i=p(n,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,d;var o=i.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,d):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,d)}function j(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 x(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function C(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(j,this),this.reset(!0)}function k(t){if(t){var e=t[s];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,i=function e(){for(;++r<t.length;)if(n.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:T}}function T(){return{value:void 0,done:!0}}return v.prototype=b,i(m,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:v,configurable:!0}),v.displayName=l(b,c,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===v||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,l(t,c,"GeneratorFunction")),t.prototype=Object.create(m),t},t.awrap=function(t){return{__await:t}},w(O.prototype),l(O.prototype,u,(function(){return this})),t.AsyncIterator=O,t.async=function(e,r,n,i,o){void 0===o&&(o=Promise);var a=new O(f(e,r,n,i),o);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},w(m),l(m,c,"Generator"),l(m,s,(function(){return this})),l(m,"toString",(function(){return"[object Generator]"})),t.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}},t.values=k,C.prototype={constructor:C,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(x),!t)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function r(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var s=n.call(o,"catchLoc"),u=n.call(o,"finallyLoc");if(s&&u){if(this.prev<o.catchLoc)return r(o.catchLoc,!0);if(this.prev<o.finallyLoc)return r(o.finallyLoc)}else if(s){if(this.prev<o.catchLoc)return r(o.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return r(o.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=t,a.arg=e,o?(this.method="next",this.next=o.finallyLoc,d):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),d},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),x(r),d}},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 i=n.arg;x(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:k(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),d}},t}function a(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,s(n.key),n)}}function s(t){var r=function(t,r){if("object"!==e(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,r||"default");if("object"!==e(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}(t,"string");return"symbol"===e(r)?r:String(r)}var u=function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function a(t){try{u(n.next(t))}catch(t){o(t)}}function s(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,s)}u((n=n.apply(t,e||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.GlobalStore=void 0;var f=c(156),p=c(244),d=c(125),h=c(281),v=c(664),b=c(682),g=c(286),y=c(865),S=c(69),m=c(109),w=globalThis;!function(){if(!w.REACT_GLOBAL_STATE_HOOK_DEBUG&&!(0,d.isNil)(w.sessionStorage)){try{if(!w.sessionStorage.getItem("REACT_GLOBAL_STATE_HOOK_DEBUG"))return}catch(t){return}w.REACT_GLOBAL_STATE_TEMP_HOOKS=new Map,setTimeout((function(){w.REACT_GLOBAL_STATE_TEMP_HOOKS=null}),6e4)}}();var O=function(){function t(e){var i,a=this,c=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 u(a,void 0,void 0,o().mark((function t(){var e,r,n,i,a,s;return o().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,i=null!==(r=this.callbacks)&&void 0!==r?r:{},a=i.onInit,n||a){t.next=6;break}return t.abrupt("return");case 6:s=this.getConfigCallbackParam(),null==n||n(s),(0,d.isNil)(a)||null==a||a(s);case 9:case"end":return t.stop()}}),t,this)})))},this.executeSetStateForSubscriber=function(t,e){var r,n,i=t.selector,o=t.callback,s=t.currentState,u=t.config;if(!e.forceUpdate&&(null!==(r=null==u?void 0:u.isEqualRoot)&&void 0!==r?r:function(t,e){return t===e})(e.currentRootState,e.newRootState))return{didUpdate:!1};var c=i?i(e.newRootState):e.newRootState;return!e.forceUpdate&&(null!==(n=null==u?void 0:u.isEqual)&&void 0!==n?n:function(t,e){return t===e})(s,c)?{didUpdate:!1}:(a.partialUpdateSubscription(t.subscriptionId,{currentState:c}),o({state:c},{identifier:e.identifier}),{didUpdate:!0})},this.setState=function(t,e){var r=t.state,i=e.forceUpdate,o=e.identifier,s=a.stateWrapper.state;if(i||s!==r){a.stateWrapper={state:r};var u,c={forceUpdate:i,newRootState:r,currentRootState:s,identifier:o},l=function(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=n(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var i=0,o=function(){};return{s:o,n:function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},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 a,s=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return s=t.done,t},e:function(t){u=!0,a=t},f:function(){try{s||null==r.return||r.return()}finally{if(u)throw a}}}}(a.subscribers.values());try{for(l.s();!(u=l.n()).done;){var f=u.value;a.executeSetStateForSubscriber(f,c)}}catch(t){l.e(t)}finally{l.f()}}},this.setMetadata=function(t){var e=(0,p.isFunction)(t)?t(a.metadata):t;a.metadata=e},this.getMetadata=function(){return a.metadata},this.getState=function(t,e,r){var n;if(!t)return a.stateWrapper.state;var i=(0,p.isFunction)(e),o=i?t:void 0,s=i?e:t,u=null!==(n=i?r:e)&&void 0!==n?n:void 0,c=o?o(a.stateWrapper.state):a.stateWrapper.state;(null==u?void 0:u.skipFirst)||s(c);var l=(0,y.uniqueId)("gs:");return a.setOrUpdateSubscription({subscriptionId:l,selector:o,config:u,currentState:c,callback:function(t){var e=t.state;return s(e)},isSetStateCallback:!1}),function(){a.subscribers.delete(l)}},this.getConfigCallbackParam=function(){var t=a.setMetadata,e=a.getMetadata,r=a.getState,n=a.actions;return{setMetadata:t,getMetadata:e,getState:r,setState:a.setStateWrapper,actions:n}},this.lastSubscriptionId=null,this.setOrUpdateSubscription=function(t){var e=t.subscriptionId;if(!e)return{isNewSubscription:!1};var r=a.subscribers.get(e);return(0,v.isRecord)(r)?(Object.assign(r,t),{isNewSubscription:!1}):(a.executeOnSubscribed(),a.subscribers.set(e,t),a.lastSubscriptionId=e,{isNewSubscription:!0})},this.partialUpdateSubscription=function(t,e){var r=a.subscribers.get(t);(0,v.isRecord)(r)&&Object.assign(r,e)},this.executeOnSubscribed=function(){var t,e=a.onSubscribed,r=null===(t=a.callbacks)||void 0===t?void 0:t.onSubscribed;if(e||r){var n=a.getConfigCallbackParam();null==e||e(n),null==r||r(n)}},this.getHook=function(){var t=function(t){var e,n,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];if(a.wasDisposed)throw new Error("The global state was disposed");var o=Array.isArray(i)?{dependencies:i}:null!=i?i:{},s=(0,f.useRef)({subscriptionId:null,tempInitialRootState:a.stateWrapper.state}),u=function(){return t?{state:t(a.stateWrapper.state)}:a.stateWrapper},c=r((0,f.useState)(u),2),l=c[0],p=c[1];(0,f.useEffect)((function(){if(!(0,d.isNil)(s.current)){(0,d.isNil)(s.current.subscriptionId)&&(s.current.subscriptionId=(0,y.uniqueId)("ss:"));var e=s.current.subscriptionId,r={subscriptionId:e,currentState:l.state,selector:t,config:o,callback:p,isSetStateCallback:!0};return a.setOrUpdateSubscription(r).isNewSubscription&&(a.executeSetStateForSubscriber(r,{forceUpdate:!1,newRootState:a.stateWrapper.state,currentRootState:s.current.tempInitialRootState===S.uniqueSymbol?a.stateWrapper.state:s.current.tempInitialRootState,identifier:"on mount state update"}),s.current.tempInitialRootState=S.uniqueSymbol),function(){a.subscribers.delete(e)}}}),[]);var v=(0,h.isString)(null===(e=s.current)||void 0===e?void 0:e.subscriptionId)?s.current.subscriptionId:"",b=a.subscribers.get(v),g=(null!==(n=null==b?void 0:b.config)&&void 0!==n?n:{dependencies:o.dependencies}).dependencies;return a.partialUpdateSubscription(v,{currentState:l.state,selector:t,config:o,callback:p}),[a.computeSelectedState({selector:t,subscriptionId:v,config:o,currentDependencies:g,computeChildState:u,stateWrapperRef:l}),a.getStateOrchestrator(),a.metadata]};return t.stateControls=a.stateControls,t.createSelectorHook=a.createSelectorHook,t.createObservable=a.createObservable,t.removeSubscriptions=a.removeSubscriptions,t.dispose=a.dispose,t},this.computeSelectedState=function(t){var e=t.selector,r=t.subscriptionId,n=t.config,i=t.currentDependencies,o=t.computeChildState,s=t.stateWrapperRef;if(!e||!r)return s.state;var u=n.dependencies;if(i===u)return s.state;if((null==i?void 0:i.length)===(null==u?void 0:u.length)&&(0,b.shallowCompare)(i,u))return s.state;var c=o().state;return a.partialUpdateSubscription(r,{currentState:c}),s.state=c,c},this.createSelectorHook=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=n.isEqualRoot,o=n.isEqual,s=n.name,u=r(a.stateControls(),3),c=u[0],l=u[1],f=u[2],d=c(),h=(null!=e?e:function(t){return t})(d),v=new t(h,{name:null!=s?s:(0,y.uniqueId)("sh:")}),b=r(v.stateControls(),2),g=b[0],S=b[1],m=c((function(t){if(!(null!=i?i:Object.is)(d,t)){d=t;var r=e(t);(null!=o?o:Object.is)(h,r)||(h=r,S(r))}}),{skipFirst:!0}),w=v.getHook(),O=function(t,e){return[r((0,p.isFunction)(t)?w(t,e):w(),1)[0],l,f]};return O.stateControls=function(){return[g,l,f]},O.createSelectorHook=a.createSelectorHook.bind(O),O.createObservable=a.createObservable.bind(O),O.removeSubscriptions=function(){m(),v.removeSubscriptions()},O.dispose=function(){O.removeSubscriptions(),v.dispose()},O},this.stateControls=function(){var t=a.getStateOrchestrator(),e=a.getMetadata;return[a.getState,t,e]},this.getStateOrchestrator=function(){return a.actions?a.actions:a.setStateWrapper},this.setStateWrapper=function(t){var e,r,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=n.forceUpdate,o=n.identifier,s=a.stateWrapper.state,u=(0,p.isFunction)(t)?t(s):t;if(i||a.stateWrapper.state!==u){var c=a.setMetadata,l=a.getMetadata,f=a.getState,d=a.actions,h={setMetadata:c,getMetadata:l,setState:a.setState,getState:f,actions:d,previousState:s,state:u,identifier:o},v=a.computePreventStateChange,b=null===(e=a.callbacks)||void 0===e?void 0:e.computePreventStateChange;if(v||b)if((null==v?void 0:v(h))||(null==b?void 0:b(h)))return;a.setState({state:u},{forceUpdate:i,identifier:o});var g=a.onStateChanged,y=null===(r=a.callbacks)||void 0===r?void 0:r.onStateChanged;(g||y)&&(null==g||g(h),null==y||y(h))}},this.getStoreActionsMap=function(){if(!(0,v.isRecord)(a.actionsConfig))return null;var t=a.actionsConfig,e=a.setMetadata,r=a.setStateWrapper,n=a.getState,i=a.getMetadata,o=Object.keys(t).reduce((function(a,u){var c,l,f;return Object.assign(a,(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(o,c);return"function"!=typeof f&&(0,g.throwWrongKeyOnActionCollectionConfig)(u),f.call(o,{setState:r,getState:n,setMetadata:e,getMetadata:i,actions:o})},(l=s(l=u))in c?Object.defineProperty(c,l,{value:f,enumerable:!0,configurable:!0,writable:!0}):c[l]=f,c)),a}),{});return o},this.removeSubscriptions=function(){a.subscribers.clear()},this.dispose=function(){a.wasDisposed=!0,a.removeSubscriptions(),a._name="",a.actionsConfig=null,a.callbacks=null,a.metadata={},a.actions=null,a.subscribers.clear(),a.stateWrapper={state:null}};var l=c.metadata,O=c.callbacks,E=c.actions,_=c.name;this.stateWrapper={state:e},this._name=null!=_?_:(0,y.uniqueId)("gs:"),this.metadata=null!=l?l:{},this.callbacks=null!=O?O:null,this.actionsConfig=null!=E?E:null;var j="";if((w.REACT_GLOBAL_STATE_HOOK_DEBUG||w.REACT_GLOBAL_STATE_TEMP_HOOKS)&&(j=(0,m.generateStackHash)(null!==(i=(new Error).stack)&&void 0!==i?i:"")),w.REACT_GLOBAL_STATE_HOOK_DEBUG)w.REACT_GLOBAL_STATE_HOOK_DEBUG(this,c,j);else if(w.REACT_GLOBAL_STATE_TEMP_HOOKS){var x=void 0!==globalThis.WeakRef?new globalThis.WeakRef(this):this,C=void 0!==globalThis.WeakRef?new globalThis.WeakRef(c):c;w.REACT_GLOBAL_STATE_TEMP_HOOKS.set(j,[x,C])}this.constructor!==t||this.initialize()}var e,i,c;return e=t,i=[{key:"createObservable",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e.isEqualRoot,i=e.isEqual,o=e.name,a=r(this.stateControls(),1)[0],s=[],u=a(),c=(null!=t?t:function(t){return t})(a()),l=a((function(e){if(!(null!=n?n:Object.is)(u,e)){u=e;var r=t(e);(null!=i?i:Object.is)(c,r)||(c=r,s.forEach((function(t){return t()})))}}),{skipFirst:!0}),f=function(t,e,r){var n;if(!t)return c;var i=(0,p.isFunction)(e),o=i?t:void 0,a=i?e:t,u=null!==(n=i?r:e)&&void 0!==n?n:void 0,l=function(){return a(o?o(c):c)};(null==u?void 0:u.skipFirst)||l();var f=function(){l()};return s.push(f),function(){s.splice(s.indexOf(f),1)}};return f._name=null!=o?o:(0,y.uniqueId)("ob:"),f.createObservable=this.createObservable.bind(f),f.removeSubscriptions=function(){s.forEach((function(t){return t()})),s.length=0,l()},f.stateControls=function(){return[f]},f}}],i&&a(e.prototype,i),c&&a(e,c),Object.defineProperty(e,"prototype",{writable:!1}),t}();t.GlobalStore=O,t.default=O})(),l})()));
1
+ !function(e,o){"object"==typeof exports&&"object"==typeof module?module.exports=o(require("./GlobalStore.js")):"function"==typeof define&&define.amd?define(["./GlobalStore.js"],o):"object"==typeof exports?exports["react-hooks-global-states"]=o(require("./GlobalStore.js")):e["react-hooks-global-states"]=o(e["./GlobalStore.js"])}(this,(e=>(()=>{"use strict";var o={352:o=>{o.exports=e}},t={};var r=function e(r){var s=t[r];if(void 0!==s)return s.exports;var a=t[r]={exports:{}};return o[r](a,a.exports,e),a.exports}(352);return r})()));
@@ -1 +1 @@
1
- !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("./GlobalStore.js")):"function"==typeof define&&define.amd?define(["./GlobalStore.js"],e):"object"==typeof exports?exports["react-hooks-global-states"]=e(require("./GlobalStore.js")):t["react-hooks-global-states"]=e(t["./GlobalStore.js"])}(this,(t=>(()=>{"use strict";var e={352:e=>{e.exports=t}},r={};function o(t){var n=r[t];if(void 0!==n)return n.exports;var i=r[t]={exports:{}};return e[t](i,i.exports,o),i.exports}var n={};return(()=>{var t=n;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,r){for(var o=0;o<r.length;o++){var n=r[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,(i=n.key,u=void 0,u=function(t,r){if("object"!==e(t)||null===t)return t;var o=t[Symbol.toPrimitive];if(void 0!==o){var n=o.call(t,r||"default");if("object"!==e(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}(i,"string"),"symbol"===e(u)?u:String(u)),n)}var i,u}function i(t,e){return i=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},i(t,e)}function u(t){var r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var o,n=c(t);if(r){var i=c(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return function(t,r){if(r&&("object"===e(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,o)}}function c(t){return c=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},c(t)}Object.defineProperty(t,"__esModule",{value:!0}),t.GlobalStoreAbstract=void 0;var f=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&i(t,e)}(f,t);var e,o,n,c=u(f);function f(){var t;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,f),(t=c.apply(this,arguments)).onInit=function(e){t.onInitialize(e)},t.onStateChanged=function(e){t.onChange(e)},t}return e=f,o&&r(e.prototype,o),n&&r(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}(o(352).GlobalStore);t.GlobalStoreAbstract=f,t.default=f})(),n})()));
1
+ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("./GlobalStoreAbstract.js")):"function"==typeof define&&define.amd?define(["./GlobalStoreAbstract.js"],e):"object"==typeof exports?exports["react-hooks-global-states"]=e(require("./GlobalStoreAbstract.js")):t["react-hooks-global-states"]=e(t["./GlobalStoreAbstract.js"])}(this,(t=>(()=>{"use strict";var e={674:e=>{e.exports=t}},o={};var r=function t(r){var s=o[r];if(void 0!==s)return s.exports;var a=o[r]={exports:{}};return e[r](a,a.exports,t),a.exports}(674);return r})()));
package/bundle.js CHANGED
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("./GlobalStore.js"),require("./GlobalStoreAbstract.js"),require("./createContext.js"),require("./createCustomGlobalState.js"),require("./createGlobalState.js"),require("./generateStackHash.js"),require("./isRecord.js"),require("./shallowCompare.js"),require("./src/debounce.ts"),require("./throwWrongKeyOnActionCollectionConfig.js"),require("./uniqueId.js"),require("./uniqueSymbol.js"),require("./useStableState.js")):"function"==typeof define&&define.amd?define(["./GlobalStore.js","./GlobalStoreAbstract.js","./createContext.js","./createCustomGlobalState.js","./createGlobalState.js","./generateStackHash.js","./isRecord.js","./shallowCompare.js","./src/debounce.ts","./throwWrongKeyOnActionCollectionConfig.js","./uniqueId.js","./uniqueSymbol.js","./useStableState.js"],t):"object"==typeof exports?exports["react-hooks-global-states"]=t(require("./GlobalStore.js"),require("./GlobalStoreAbstract.js"),require("./createContext.js"),require("./createCustomGlobalState.js"),require("./createGlobalState.js"),require("./generateStackHash.js"),require("./isRecord.js"),require("./shallowCompare.js"),require("./src/debounce.ts"),require("./throwWrongKeyOnActionCollectionConfig.js"),require("./uniqueId.js"),require("./uniqueSymbol.js"),require("./useStableState.js")):e["react-hooks-global-states"]=t(e["./GlobalStore.js"],e["./GlobalStoreAbstract.js"],e["./createContext.js"],e["./createCustomGlobalState.js"],e["./createGlobalState.js"],e["./generateStackHash.js"],e["./isRecord.js"],e["./shallowCompare.js"],e["./src/debounce.ts"],e["./throwWrongKeyOnActionCollectionConfig.js"],e["./uniqueId.js"],e["./uniqueSymbol.js"],e["./useStableState.js"])}(this,((e,t,r,o,a,n,s,u,l,i,c,b,j)=>(()=>{"use strict";var S={352:t=>{t.exports=e},674:e=>{e.exports=t},104:e=>{e.exports=r},842:e=>{e.exports=o},963:e=>{e.exports=a},109:e=>{e.exports=n},664:e=>{e.exports=s},682:e=>{e.exports=u},297:e=>{e.exports=l},286:e=>{e.exports=i},865:e=>{e.exports=c},69:e=>{e.exports=b},503:e=>{e.exports=j}},p={};function f(e){var t=p[e];if(void 0!==t)return t.exports;var r=p[e]={exports:{}};return S[e](r,r.exports,f),r.exports}var d={};return(()=>{var e=d;Object.defineProperty(e,"__esModule",{value:!0}),e.generateStackHash=e.createContext=e.useStableState=e.uniqueSymbol=e.isRecord=e.throwWrongKeyOnActionCollectionConfig=e.uniqueId=e.debounce=e.shallowCompare=e.createCustomGlobalState=e.createGlobalState=e.GlobalStoreAbstract=e.GlobalStore=void 0;var t=f(352);Object.defineProperty(e,"GlobalStore",{enumerable:!0,get:function(){return t.GlobalStore}});var r=f(674);Object.defineProperty(e,"GlobalStoreAbstract",{enumerable:!0,get:function(){return r.GlobalStoreAbstract}});var o=f(963);Object.defineProperty(e,"createGlobalState",{enumerable:!0,get:function(){return o.createGlobalState}});var a=f(842);Object.defineProperty(e,"createCustomGlobalState",{enumerable:!0,get:function(){return a.createCustomGlobalState}});var n=f(682);Object.defineProperty(e,"shallowCompare",{enumerable:!0,get:function(){return n.shallowCompare}});var s=f(297);Object.defineProperty(e,"debounce",{enumerable:!0,get:function(){return s.debounce}});var u=f(865);Object.defineProperty(e,"uniqueId",{enumerable:!0,get:function(){return u.uniqueId}});var l=f(286);Object.defineProperty(e,"throwWrongKeyOnActionCollectionConfig",{enumerable:!0,get:function(){return l.throwWrongKeyOnActionCollectionConfig}});var i=f(664);Object.defineProperty(e,"isRecord",{enumerable:!0,get:function(){return i.isRecord}});var c=f(69);Object.defineProperty(e,"uniqueSymbol",{enumerable:!0,get:function(){return c.uniqueSymbol}});var b=f(503);Object.defineProperty(e,"useStableState",{enumerable:!0,get:function(){return b.useStableState}});var j=f(104);Object.defineProperty(e,"createContext",{enumerable:!0,get:function(){return j.createContext}});var S=f(109);Object.defineProperty(e,"generateStackHash",{enumerable:!0,get:function(){return S.generateStackHash}})})(),d})()));
1
+ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("json-storage-formatter/isDate"),require("json-storage-formatter/isFunction"),require("json-storage-formatter/isNil"),require("json-storage-formatter/isPrimitive"),require("json-storage-formatter/isString"),require("react")):"function"==typeof define&&define.amd?define(["json-storage-formatter/isDate","json-storage-formatter/isFunction","json-storage-formatter/isNil","json-storage-formatter/isPrimitive","json-storage-formatter/isString","react"],e):"object"==typeof exports?exports["react-hooks-global-states"]=e(require("json-storage-formatter/isDate"),require("json-storage-formatter/isFunction"),require("json-storage-formatter/isNil"),require("json-storage-formatter/isPrimitive"),require("json-storage-formatter/isString"),require("react")):t["react-hooks-global-states"]=e(t["json-storage-formatter/isDate"],t["json-storage-formatter/isFunction"],t["json-storage-formatter/isNil"],t["json-storage-formatter/isPrimitive"],t["json-storage-formatter/isString"],t.react)}(this,((t,e,r,n,o,i)=>(()=>{"use strict";var a={774:(t,e,r)=>{function n(t){return n="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},n(t)}function o(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,u=[],c=!0,l=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(u.push(n.value),u.length!==e);c=!0);}catch(t){l=!0,o=t}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return u}}(t,e)||i(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 i(t,e){if(t){if("string"==typeof t)return a(t,e);var r=Object.prototype.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)?a(t,e):void 0}}function a(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function u(){u=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",c=i.asyncIterator||"@@asyncIterator",l=i.toStringTag||"@@toStringTag";function s(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(t){s=function(t,e,r){return t[e]=r}}function f(t,e,r,n){var i=e&&e.prototype instanceof v?e:v,a=Object.create(i.prototype),u=new A(n||[]);return o(a,"_invoke",{value:j(t,r,u)}),a}function d(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=f;var p={};function v(){}function b(){}function h(){}var y={};s(y,a,(function(){return this}));var g=Object.getPrototypeOf,m=g&&g(g(k([])));m&&m!==e&&r.call(m,a)&&(y=m);var S=h.prototype=v.prototype=Object.create(y);function O(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function w(t,e){function i(o,a,u,c){var l=d(t[o],t,a);if("throw"!==l.type){var s=l.arg,f=s.value;return f&&"object"==n(f)&&r.call(f,"__await")?e.resolve(f.__await).then((function(t){i("next",t,u,c)}),(function(t){i("throw",t,u,c)})):e.resolve(f).then((function(t){s.value=t,u(s)}),(function(t){return i("throw",t,u,c)}))}c(l.arg)}var a;o(this,"_invoke",{value:function(t,r){function n(){return new e((function(e,n){i(t,r,e,n)}))}return a=a?a.then(n,n):n()}})}function j(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return x()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var u=C(a,r);if(u){if(u===p)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=d(t,e,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===p)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}function C(t,e){var r=e.method,n=t.iterator[r];if(void 0===n)return e.delegate=null,"throw"===r&&t.iterator.return&&(e.method="return",e.arg=void 0,C(t,e),"throw"===e.method)||"return"!==r&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+r+"' method")),p;var o=d(n,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,p;var i=o.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,p):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,p)}function _(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 E(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function A(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(_,this),this.reset(!0)}function k(t){if(t){var e=t[a];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,o=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return o.next=o}}return{next:x}}function x(){return{value:void 0,done:!0}}return b.prototype=h,o(S,"constructor",{value:h,configurable:!0}),o(h,"constructor",{value:b,configurable:!0}),b.displayName=s(h,l,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===b||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,h):(t.__proto__=h,s(t,l,"GeneratorFunction")),t.prototype=Object.create(S),t},t.awrap=function(t){return{__await:t}},O(w.prototype),s(w.prototype,c,(function(){return this})),t.AsyncIterator=w,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new w(f(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},O(S),s(S,l,"Generator"),s(S,a,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.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}},t.values=k,A.prototype={constructor:A,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(E),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var u=r.call(i,"catchLoc"),c=r.call(i,"finallyLoc");if(u&&c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(u){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;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,p):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),p},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),E(r),p}},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;E(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:k(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),p}},t}function c(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,l(n.key),n)}}function l(t){var e=function(t,e){if("object"!==n(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var o=r.call(t,e||"default");if("object"!==n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"===n(e)?e:String(e)}var s=function(t,e,r,n){return new(r||(r=Promise))((function(o,i){function a(t){try{c(n.next(t))}catch(t){i(t)}}function u(t){try{c(n.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,u)}c((n=n.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.GlobalStore=void 0;var f=r(156),d=r(122),p=r(538),v=r(582),b=r(143),h=r(561),y=r(400),g=r(157),m=r(605),S=r(748),O=globalThis;!function(){if(!O.REACT_GLOBAL_STATE_HOOK_DEBUG&&!(0,p.isNil)(O.sessionStorage)){try{if(!O.sessionStorage.getItem("REACT_GLOBAL_STATE_HOOK_DEBUG"))return}catch(t){return}O.REACT_GLOBAL_STATE_TEMP_HOOKS=new Map,setTimeout((function(){O.REACT_GLOBAL_STATE_TEMP_HOOKS=null}),6e4)}}();var w=function(){function t(e){var r,n=this,a=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 s(n,void 0,void 0,u().mark((function t(){var e,r,n,o,i,a;return u().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:{},i=o.onInit,n||i){t.next=6;break}return t.abrupt("return");case 6:a=this.getConfigCallbackParam(),null==n||n(a),(0,p.isNil)(i)||null==i||i(a);case 9:case"end":return t.stop()}}),t,this)})))},this.executeSetStateForSubscriber=function(t,e){var r,o,i=t.selector,a=t.callback,u=t.currentState,c=t.config;if(!e.forceUpdate&&(null!==(r=null==c?void 0:c.isEqualRoot)&&void 0!==r?r:function(t,e){return t===e})(e.currentRootState,e.newRootState))return{didUpdate:!1};var l=i?i(e.newRootState):e.newRootState;return!e.forceUpdate&&(null!==(o=null==c?void 0:c.isEqual)&&void 0!==o?o:function(t,e){return t===e})(u,l)?{didUpdate:!1}:(n.partialUpdateSubscription(t.subscriptionId,{currentState:l}),a({state:l},{identifier:e.identifier}),{didUpdate:!0})},this.setState=function(t,e){var r=t.state,o=e.forceUpdate,a=e.identifier,u=n.stateWrapper.state;if(o||u!==r){n.stateWrapper={state:r};var c,l={forceUpdate:o,newRootState:r,currentRootState:u,identifier:a},s=function(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=i(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},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 a,u=!0,c=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return u=t.done,t},e:function(t){c=!0,a=t},f:function(){try{u||null==r.return||r.return()}finally{if(c)throw a}}}}(n.subscribers.values());try{for(s.s();!(c=s.n()).done;){var f=c.value;n.executeSetStateForSubscriber(f,l)}}catch(t){s.e(t)}finally{s.f()}}},this.setMetadata=function(t){var e=(0,d.isFunction)(t)?t(n.metadata):t;n.metadata=e},this.getMetadata=function(){return n.metadata},this.getState=function(t,e,r){var o;if(!t)return n.stateWrapper.state;var i=(0,d.isFunction)(e),a=i?t:void 0,u=i?e:t,c=null!==(o=i?r:e)&&void 0!==o?o:void 0,l=a?a(n.stateWrapper.state):n.stateWrapper.state;(null==c?void 0:c.skipFirst)||u(l);var s=(0,g.uniqueId)("gs:");return n.setOrUpdateSubscription({subscriptionId:s,selector:a,config:c,currentState:l,callback:function(t){var e=t.state;return u(e)},isSetStateCallback:!1}),function(){n.subscribers.delete(s)}},this.getConfigCallbackParam=function(){var t=n.setMetadata,e=n.getMetadata,r=n.getState,o=n.actions;return{setMetadata:t,getMetadata:e,getState:r,setState:n.setStateWrapper,actions:o}},this.lastSubscriptionId=null,this.setOrUpdateSubscription=function(t){var e=t.subscriptionId;if(!e)return{isNewSubscription:!1};var r=n.subscribers.get(e);return(0,b.isRecord)(r)?(Object.assign(r,t),{isNewSubscription:!1}):(n.executeOnSubscribed(),n.subscribers.set(e,t),n.lastSubscriptionId=e,{isNewSubscription:!0})},this.partialUpdateSubscription=function(t,e){var r=n.subscribers.get(t);(0,b.isRecord)(r)&&Object.assign(r,e)},this.executeOnSubscribed=function(){var t,e=n.onSubscribed,r=null===(t=n.callbacks)||void 0===t?void 0:t.onSubscribed;if(e||r){var o=n.getConfigCallbackParam();null==e||e(o),null==r||r(o)}},this.getHook=function(){var t=function(t){var e,r,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];if(n.wasDisposed)throw new Error("The global state was disposed");var a=Array.isArray(i)?{dependencies:i}:null!=i?i:{},u=(0,f.useRef)({subscriptionId:null,tempInitialRootState:n.stateWrapper.state}),c=function(){return t?{state:t(n.stateWrapper.state)}:n.stateWrapper},l=o((0,f.useState)(c),2),s=l[0],d=l[1];(0,f.useEffect)((function(){if(!(0,p.isNil)(u.current)){(0,p.isNil)(u.current.subscriptionId)&&(u.current.subscriptionId=(0,g.uniqueId)("ss:"));var e=u.current.subscriptionId,r={subscriptionId:e,currentState:s.state,selector:t,config:a,callback:d,isSetStateCallback:!0};return n.setOrUpdateSubscription(r).isNewSubscription&&(n.executeSetStateForSubscriber(r,{forceUpdate:!1,newRootState:n.stateWrapper.state,currentRootState:u.current.tempInitialRootState===m.uniqueSymbol?n.stateWrapper.state:u.current.tempInitialRootState,identifier:"on mount state update"}),u.current.tempInitialRootState=m.uniqueSymbol),function(){n.subscribers.delete(e)}}}),[]);var b=(0,v.isString)(null===(e=u.current)||void 0===e?void 0:e.subscriptionId)?u.current.subscriptionId:"",h=n.subscribers.get(b),y=(null!==(r=null==h?void 0:h.config)&&void 0!==r?r:{dependencies:a.dependencies}).dependencies;return n.partialUpdateSubscription(b,{currentState:s.state,selector:t,config:a,callback:d}),[n.computeSelectedState({selector:t,subscriptionId:b,config:a,currentDependencies:y,computeChildState:c,stateWrapperRef:s}),n.getStateOrchestrator(),n.metadata]};return t.stateControls=n.stateControls,t.createSelectorHook=n.createSelectorHook,t.createObservable=n.createObservable,t.removeSubscriptions=n.removeSubscriptions,t.dispose=n.dispose,t},this.computeSelectedState=function(t){var e=t.selector,r=t.subscriptionId,o=t.config,i=t.currentDependencies,a=t.computeChildState,u=t.stateWrapperRef;if(!e||!r)return u.state;var c=o.dependencies;if(i===c)return u.state;if((null==i?void 0:i.length)===(null==c?void 0:c.length)&&(0,h.shallowCompare)(i,c))return u.state;var l=a().state;return n.partialUpdateSubscription(r,{currentState:l}),u.state=l,l},this.createSelectorHook=function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=r.isEqualRoot,a=r.isEqual,u=r.name,c=o(n.stateControls(),3),l=c[0],s=c[1],f=c[2],p=l(),v=(null!=e?e:function(t){return t})(p),b=new t(v,{name:null!=u?u:(0,g.uniqueId)("sh:")}),h=o(b.stateControls(),2),y=h[0],m=h[1],S=l((function(t){if(!(null!=i?i:Object.is)(p,t)){p=t;var r=e(t);(null!=a?a:Object.is)(v,r)||(v=r,m(r))}}),{skipFirst:!0}),O=b.getHook(),w=function(t,e){return[o((0,d.isFunction)(t)?O(t,e):O(),1)[0],s,f]};return w.stateControls=function(){return[y,s,f]},w.createSelectorHook=n.createSelectorHook.bind(w),w.createObservable=n.createObservable.bind(w),w.removeSubscriptions=function(){S(),b.removeSubscriptions()},w.dispose=function(){w.removeSubscriptions(),b.dispose()},w},this.stateControls=function(){var t=n.getStateOrchestrator(),e=n.getMetadata;return[n.getState,t,e]},this.getStateOrchestrator=function(){return n.actions?n.actions:n.setStateWrapper},this.setStateWrapper=function(t){var e,r,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=o.forceUpdate,a=o.identifier,u=n.stateWrapper.state,c=(0,d.isFunction)(t)?t(u):t;if(i||n.stateWrapper.state!==c){var l=n.setMetadata,s=n.getMetadata,f=n.getState,p=n.actions,v={setMetadata:l,getMetadata:s,setState:n.setState,getState:f,actions:p,previousState:u,state:c,identifier:a},b=n.computePreventStateChange,h=null===(e=n.callbacks)||void 0===e?void 0:e.computePreventStateChange;if(b||h)if((null==b?void 0:b(v))||(null==h?void 0:h(v)))return;n.setState({state:c},{forceUpdate:i,identifier:a});var y=n.onStateChanged,g=null===(r=n.callbacks)||void 0===r?void 0:r.onStateChanged;(y||g)&&(null==y||y(v),null==g||g(v))}},this.getStoreActionsMap=function(){if(!(0,b.isRecord)(n.actionsConfig))return null;var t=n.actionsConfig,e=n.setMetadata,r=n.setStateWrapper,o=n.getState,i=n.getMetadata,a=Object.keys(t).reduce((function(n,u){var c,s,f;return Object.assign(n,(c={},f=function(){for(var n=t[u],c=arguments.length,l=new Array(c),s=0;s<c;s++)l[s]=arguments[s];var f=n.apply(a,l);return"function"!=typeof f&&(0,y.throwWrongKeyOnActionCollectionConfig)(u),f.call(a,{setState:r,getState:o,setMetadata:e,getMetadata:i,actions:a})},(s=l(s=u))in c?Object.defineProperty(c,s,{value:f,enumerable:!0,configurable:!0,writable:!0}):c[s]=f,c)),n}),{});return a},this.removeSubscriptions=function(){n.subscribers.clear()},this.dispose=function(){n.wasDisposed=!0,n.removeSubscriptions(),n._name="",n.actionsConfig=null,n.callbacks=null,n.metadata={},n.actions=null,n.subscribers.clear(),n.stateWrapper={state:null}};var c=a.metadata,w=a.callbacks,j=a.actions,C=a.name;this.stateWrapper={state:e},this._name=null!=C?C:(0,g.uniqueId)("gs:"),this.metadata=null!=c?c:{},this.callbacks=null!=w?w:null,this.actionsConfig=null!=j?j:null;var _="";if((O.REACT_GLOBAL_STATE_HOOK_DEBUG||O.REACT_GLOBAL_STATE_TEMP_HOOKS)&&(_=(0,S.generateStackHash)(null!==(r=(new Error).stack)&&void 0!==r?r:"")),O.REACT_GLOBAL_STATE_HOOK_DEBUG)O.REACT_GLOBAL_STATE_HOOK_DEBUG(this,a,_);else if(O.REACT_GLOBAL_STATE_TEMP_HOOKS){var E=void 0!==globalThis.WeakRef?new globalThis.WeakRef(this):this,A=void 0!==globalThis.WeakRef?new globalThis.WeakRef(a):a;O.REACT_GLOBAL_STATE_TEMP_HOOKS.set(_,[E,A])}this.constructor!==t||this.initialize()}var e,r,n;return e=t,r=[{key:"createObservable",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e.isEqualRoot,n=e.isEqual,i=e.name,a=o(this.stateControls(),1)[0],u=[],c=a(),l=(null!=t?t:function(t){return t})(a()),s=a((function(e){if(!(null!=r?r:Object.is)(c,e)){c=e;var o=t(e);(null!=n?n:Object.is)(l,o)||(l=o,u.forEach((function(t){return t()})))}}),{skipFirst:!0}),f=function(t,e,r){var n;if(!t)return l;var o=(0,d.isFunction)(e),i=o?t:void 0,a=o?e:t,c=null!==(n=o?r:e)&&void 0!==n?n:void 0,s=function(){return a(i?i(l):l)};(null==c?void 0:c.skipFirst)||s();var f=function(){s()};return u.push(f),function(){u.splice(u.indexOf(f),1)}};return f._name=null!=i?i:(0,g.uniqueId)("ob:"),f.createObservable=this.createObservable.bind(f),f.removeSubscriptions=function(){u.forEach((function(t){return t()})),u.length=0,s()},f.stateControls=function(){return[f]},f}}],r&&c(e.prototype,r),n&&c(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();e.GlobalStore=w,e.default=w},195:(t,e,r)=>{function n(t){return n="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},n(t)}function o(t,e){for(var r=0;r<e.length;r++){var o=e[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,(i=o.key,a=void 0,a=function(t,e){if("object"!==n(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var o=r.call(t,e||"default");if("object"!==n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(i,"string"),"symbol"===n(a)?a:String(a)),o)}var i,a}function i(t,e){return i=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},i(t,e)}function a(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,o=u(t);if(e){var i=u(this).constructor;r=Reflect.construct(o,arguments,i)}else r=o.apply(this,arguments);return function(t,e){if(e&&("object"===n(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,r)}}function u(t){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},u(t)}Object.defineProperty(e,"__esModule",{value:!0}),e.GlobalStoreAbstract=void 0;var c=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&i(t,e)}(c,t);var e,r,n,u=a(c);function c(){var t;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,c),(t=u.apply(this,arguments)).onInit=function(e){t.onInitialize(e)},t.onStateChanged=function(e){t.onChange(e)},t}return e=c,r&&o(e.prototype,r),n&&o(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}(r(774).GlobalStore);e.GlobalStoreAbstract=c,e.default=c},564:(t,e,r)=>{function n(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,u=[],c=!0,l=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(u.push(n.value),u.length!==e);c=!0);}catch(t){l=!0,o=t}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return u}}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return o(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return o(t,e)}(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 o(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}Object.defineProperty(e,"__esModule",{value:!0}),e.createContext=void 0;var i=r(156),a=r(774),u=r(122),c=r(538),l=r(965);e.createContext=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=(0,i.createContext)(null),o=function(){var t=(0,i.useContext)(r);if(!t)throw new Error("ContextHook must be used within a ContextProvider");return t()};o.createSelectorHook=function(t,e){return function(){var o=(0,i.useContext)(r);if((0,c.isNil)(o))throw new Error("SelectorHook must be used within a ContextProvider");return n((0,l.useStableState)((function(){return o.createSelectorHook(t,e)}),(function(t){return t.removeSubscriptions()}),[o]),1)[0].value.apply(void 0,arguments)}};var s=function(){var t=(0,i.useContext)(r);if((0,c.isNil)(t))throw new Error("useStateControls must be used within a ContextProvider");return t.stateControls()},f=function(t,e){var n=(0,i.useContext)(r);if((0,c.isNil)(n))throw new Error("useObservableBuilder must be used within a ContextProvider");return n.createObservable(t,e)};return o.stateControls=function(){return[s,f]},[o,function(o){var s=o.children,f=o.value,d=o.ref,p=n((0,l.useStableState)((function(){var r,n=function(){return(0,u.isFunction)(t)?t():t},o=(0,c.isNil)(f)?n():(0,u.isFunction)(f)?f(n()):f,i=new a.GlobalStore(o,Object.assign(Object.assign({},e),{metadata:null!==(r=(0,u.isFunction)(e.metadata)?e.metadata():e.metadata)&&void 0!==r?r:{}})),l=i.getHook();return{store:i,parentHook:l}}),(function(t){var e,r,n,o;t.store.dispose(),null===(r=null===(e=p.value.store.callbacks)||void 0===e?void 0:e.onUnMount)||void 0===r||r.call(e),null===(o=(n=p.value.store).__onUnMountContext)||void 0===o||o.call(n,p.value.store,p.value.parentHook)}),[]),1)[0];return(0,i.useImperativeHandle)(d,(function(){return d?p.value.store.getConfigCallbackParam():{}}),[p.value.store,d]),(0,i.createElement)(r.Provider,{value:p.value.parentHook},s)}]},e.default=e.createContext},362:(t,e,r)=>{var n=function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(r[n[o]]=t[n[o]])}return r};Object.defineProperty(e,"__esModule",{value:!0}),e.createCustomGlobalState=void 0;var o=r(196);e.createCustomGlobalState=function(t){var e=t.onInitialize,r=t.onChange;return function(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=i.callbacks,u=n(i,["callbacks"]);return(0,o.createGlobalState)(t,Object.assign(Object.assign({},u),{callbacks:Object.assign(Object.assign({},null!=a?a:{}),{onInit:function(t){var r;null==e||e(t,null==u?void 0:u.config),null===(r=null==a?void 0:a.onInit)||void 0===r||r.call(a,t)},onStateChanged:function(t){var e;null==r||r(t,null==u?void 0:u.config),null===(e=null==a?void 0:a.onStateChanged)||void 0===e||e.call(a,t)}})}))}},e.default=e.createCustomGlobalState},196:(t,e,r)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.createGlobalState=void 0;var n=r(774);e.createGlobalState=function(t,e){return new n.GlobalStore(t,e).getHook()},e.default=e.createGlobalState},17:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.debounce=void 0;e.debounce=function(t){var e,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return function(){for(var n=arguments.length,o=new Array(n),i=0;i<n;i++)o[i]=arguments[i];e&&clearTimeout(e),e=setTimeout((function(){t.apply(void 0,o)}),r)}},e.default=e.debounce},748:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.generateStackHash=void 0;e.generateStackHash=function(t){if(!t.trim())return"unknown";t=t.replace(/\s/g,"");for(var e=2166136261,r=0;r<t.length;r++)e^=t.charCodeAt(r),e*=16777619,e&=4294967295;return function(t){for(var e="";t>0;)e="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"[t%62]+e,t=Math.floor(t/62);return e||"0"}(e>>>0)},e.default=e.generateStackHash},143:(t,e,r)=>{function n(t){return n="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},n(t)}Object.defineProperty(e,"__esModule",{value:!0}),e.isRecord=void 0;var o=r(538);e.isRecord=function(t){return!(0,o.isNil)(t)&&"object"===n(t)},e.default=e.isRecord},561:(t,e,r)=>{function n(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,u=[],c=!0,l=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(u.push(n.value),u.length!==e);c=!0);}catch(t){l=!0,o=t}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return u}}(t,e)||i(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 o(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=i(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},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 a,u=!0,c=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return u=t.done,t},e:function(t){c=!0,a=t},f:function(){try{u||null==r.return||r.return()}finally{if(c)throw a}}}}function i(t,e){if(t){if("string"==typeof t)return a(t,e);var r=Object.prototype.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)?a(t,e):void 0}}function a(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function u(t){return u="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},u(t)}Object.defineProperty(e,"__esModule",{value:!0}),e.shallowCompare=void 0;var c=r(834),l=r(266),s=r(538),f=r(143);e.shallowCompare=function(t,e){if(t===e)return!0;var r=u(t),i=u(e);if(r!==i)return!1;if((0,s.isNil)(t)||(0,s.isNil)(e)||(0,c.isPrimitive)(t)&&(0,c.isPrimitive)(e)||(0,l.isDate)(t)&&(0,l.isDate)(e)||"function"===r&&"function"===i)return t===e;if(Array.isArray(t)){var a=t,d=e;if(a.length!==d.length)return!1;for(var p=0;p<a.length;p++){if(a[p]!==d[p])return!1}}if(t instanceof Map){var v=t,b=e;if(v.size!==b.size)return!1;var h,y=o(v);try{for(y.s();!(h=y.n()).done;){var g=n(h.value,2),m=g[0];if(g[1]!==b.get(m))return!1}}catch(t){y.e(t)}finally{y.f()}}if(t instanceof Set){var S=t,O=e;if(S.size!==O.size)return!1;var w,j=o(S);try{for(j.s();!(w=j.n()).done;){var C=w.value;if(!O.has(C))return!1}}catch(t){j.e(t)}finally{j.f()}}if(!(0,f.isRecord)(t)||!(0,f.isRecord)(e))return t===e;var _=Object.keys(t),E=Object.keys(e);if(_.length!==E.length)return!1;for(var A=0,k=_;A<k.length;A++){var x=k[A];if(t[x]!==e[x])return!1}return!0},e.default=e.shallowCompare},400:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.throwWrongKeyOnActionCollectionConfig=void 0;e.throwWrongKeyOnActionCollectionConfig=function(t){throw new Error("[WRONG CONFIGURATION!]: Every key inside the storeActionsConfig must be a higher order function that returns a function \n[".concat(t,"]: key is not a valid function, try something like this: \n{\n\n ").concat(t,": (param) => ({ setState, getState, setMetadata, getMetadata, actions }) => {\n\n setState((state) => ({ ...state, ...param }))\n\n }\n\n}\n"))},e.default=e.throwWrongKeyOnActionCollectionConfig},157:(t,e)=>{var r;Object.defineProperty(e,"__esModule",{value:!0}),e.uniqueId=void 0,e.uniqueId=(r=0,function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return r===Number.MAX_SAFE_INTEGER&&(r=0),t+Date.now().toString(36)+(r++).toString(36)}),e.default=e.uniqueId},605:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.uniqueSymbol=void 0,e.uniqueSymbol=Symbol("unique"),e.default=e.uniqueSymbol},965:(t,e,r)=>{function n(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,u=[],c=!0,l=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(u.push(n.value),u.length!==e);c=!0);}catch(t){l=!0,o=t}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return u}}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return o(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return o(t,e)}(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 o(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}Object.defineProperty(e,"__esModule",{value:!0}),e.useStableState=void 0;var i=r(156),a=r(122),u=r(538),c=r(561),l=r(156),s=r(156);e.useStableState=function(t){var e=(0,a.isFunction)(arguments.length<=1?void 0:arguments[1])?arguments.length<=1?void 0:arguments[1]:void 0,r=e?arguments.length<=2?void 0:arguments[2]:arguments.length<=1?void 0:arguments[1],o=(0,i.useRef)({builder:null,cleanup:e,dependencies:r}),f=(0,a.isFunction)(t)?t:function(){return t},d=n((0,l.useState)((function(){return{value:f()}})),2),p=d[0],v=d[1],b=(0,u.isNil)(o.current.builder),h=(0,u.isNil)(r)||!(0,c.shallowCompare)(o.current.dependencies,r);!b&&h&&(p.value=f()),o.current.dependencies=r,o.current.builder=f,o.current.cleanup=e;var y=(0,s.useCallback)((function(){v({value:o.current.builder()})}),[]);return(0,i.useEffect)((function(){return function(){o.current.cleanup&&o.current.cleanup(p.value)}}),[]),[p,y]},e.default=e.useStableState},266:e=>{e.exports=t},122:t=>{t.exports=e},538:t=>{t.exports=r},834:t=>{t.exports=n},582:t=>{t.exports=o},156:t=>{t.exports=i}},u={};function c(t){var e=u[t];if(void 0!==e)return e.exports;var r=u[t]={exports:{}};return a[t](r,r.exports,c),r.exports}var l={};return(()=>{var t=l;Object.defineProperty(t,"__esModule",{value:!0}),t.generateStackHash=t.createContext=t.useStableState=t.uniqueSymbol=t.isRecord=t.throwWrongKeyOnActionCollectionConfig=t.uniqueId=t.debounce=t.shallowCompare=t.createCustomGlobalState=t.createGlobalState=t.GlobalStoreAbstract=t.GlobalStore=void 0;var e=c(774);Object.defineProperty(t,"GlobalStore",{enumerable:!0,get:function(){return e.GlobalStore}});var r=c(195);Object.defineProperty(t,"GlobalStoreAbstract",{enumerable:!0,get:function(){return r.GlobalStoreAbstract}});var n=c(196);Object.defineProperty(t,"createGlobalState",{enumerable:!0,get:function(){return n.createGlobalState}});var o=c(362);Object.defineProperty(t,"createCustomGlobalState",{enumerable:!0,get:function(){return o.createCustomGlobalState}});var i=c(561);Object.defineProperty(t,"shallowCompare",{enumerable:!0,get:function(){return i.shallowCompare}});var a=c(17);Object.defineProperty(t,"debounce",{enumerable:!0,get:function(){return a.debounce}});var u=c(157);Object.defineProperty(t,"uniqueId",{enumerable:!0,get:function(){return u.uniqueId}});var s=c(400);Object.defineProperty(t,"throwWrongKeyOnActionCollectionConfig",{enumerable:!0,get:function(){return s.throwWrongKeyOnActionCollectionConfig}});var f=c(143);Object.defineProperty(t,"isRecord",{enumerable:!0,get:function(){return f.isRecord}});var d=c(605);Object.defineProperty(t,"uniqueSymbol",{enumerable:!0,get:function(){return d.uniqueSymbol}});var p=c(965);Object.defineProperty(t,"useStableState",{enumerable:!0,get:function(){return p.useStableState}});var v=c(564);Object.defineProperty(t,"createContext",{enumerable:!0,get:function(){return v.createContext}});var b=c(748);Object.defineProperty(t,"generateStackHash",{enumerable:!0,get:function(){return b.generateStackHash}})})(),l})()));
package/createContext.js CHANGED
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("./GlobalStore.js"),require("./useStableState.js"),require("react")):"function"==typeof define&&define.amd?define(["./GlobalStore.js","./useStableState.js","react"],t):"object"==typeof exports?exports["react-hooks-global-states"]=t(require("./GlobalStore.js"),require("./useStableState.js"),require("react")):e["react-hooks-global-states"]=t(e["./GlobalStore.js"],e["./useStableState.js"],e.react)}(this,((e,t,r)=>{return o={564:(e,t,r)=>{"use strict";function o(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var o,n,u,a,i=[],l=!0,s=!1;try{if(u=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;l=!1}else for(;!(l=(o=u.call(r)).done)&&(i.push(o.value),i.length!==t);l=!0);}catch(e){s=!0,n=e}finally{try{if(!l&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(s)throw n}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return n(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(e,t):void 0}}(e,t)||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(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,o=new Array(t);r<t;r++)o[r]=e[r];return o}Object.defineProperty(t,"__esModule",{value:!0}),t.createContext=void 0;var u=r(156),a=r(352),i=r(244),l=r(125),s=r(503);t.createContext=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=(0,u.createContext)(null),n=function(){var e=(0,u.useContext)(r);if(!e)throw new Error("ContextHook must be used within a ContextProvider");return e()};n.createSelectorHook=function(e,t){return function(){var n=(0,u.useContext)(r);if((0,l.isNil)(n))throw new Error("SelectorHook must be used within a ContextProvider");return o((0,s.useStableState)((function(){return n.createSelectorHook(e,t)}),(function(e){return e.removeSubscriptions()}),[n]),1)[0].value.apply(void 0,arguments)}};var c=function(){var e=(0,u.useContext)(r);if((0,l.isNil)(e))throw new Error("useStateControls must be used within a ContextProvider");return e.stateControls()},f=function(e,t){var o=(0,u.useContext)(r);if((0,l.isNil)(o))throw new Error("useObservableBuilder must be used within a ContextProvider");return o.createObservable(e,t)};return n.stateControls=function(){return[c,f]},[n,function(n){var c=n.children,f=n.value,v=n.ref,d=o((0,s.useStableState)((function(){var r,o=function(){return(0,i.isFunction)(e)?e():e},n=(0,l.isNil)(f)?o():(0,i.isFunction)(f)?f(o()):f,u=new a.GlobalStore(n,Object.assign(Object.assign({},t),{metadata:null!==(r=(0,i.isFunction)(t.metadata)?t.metadata():t.metadata)&&void 0!==r?r:{}})),s=u.getHook();return{store:u,parentHook:s}}),(function(e){var t,r,o,n;e.store.dispose(),null===(r=null===(t=d.value.store.callbacks)||void 0===t?void 0:t.onUnMount)||void 0===r||r.call(t),null===(n=(o=d.value.store).__onUnMountContext)||void 0===n||n.call(o,d.value.store,d.value.parentHook)}),[]),1)[0];return(0,u.useImperativeHandle)(v,(function(){return v?d.value.store.getConfigCallbackParam():{}}),[d.value.store,v]),(0,u.createElement)(r.Provider,{value:d.value.parentHook},c)}]},t.default=t.createContext},244:function(e){e.exports=(()=>{"use strict";var e={};return(()=>{var t=e;Object.defineProperty(t,"__esModule",{value:!0}),t.isFunction=void 0,t.isFunction=function(e){return"function"==typeof e||e instanceof Function}})(),e})()},125:function(e){e.exports=(()=>{"use strict";var e={};return(()=>{var t=e;Object.defineProperty(t,"__esModule",{value:!0}),t.isNil=void 0,t.isNil=function(e){return null==e}})(),e})()},352:t=>{"use strict";t.exports=e},503:e=>{"use strict";e.exports=t},156:e=>{"use strict";e.exports=r}},n={},function e(t){var r=n[t];if(void 0!==r)return r.exports;var u=n[t]={exports:{}};return o[t].call(u.exports,u,u.exports,e),u.exports}(564);var o,n}));
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("./createContext.js")):"function"==typeof define&&define.amd?define(["./createContext.js"],t):"object"==typeof exports?exports["react-hooks-global-states"]=t(require("./createContext.js")):e["react-hooks-global-states"]=t(e["./createContext.js"])}(this,(e=>(()=>{"use strict";var t={104:t=>{t.exports=e}},o={};var r=function e(r){var s=o[r];if(void 0!==s)return s.exports;var n=o[r]={exports:{}};return t[r](n,n.exports,e),n.exports}(104);return r})()));
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("./createGlobalState.js")):"function"==typeof define&&define.amd?define(["./createGlobalState.js"],t):"object"==typeof exports?exports["react-hooks-global-states"]=t(require("./createGlobalState.js")):e["react-hooks-global-states"]=t(e["./createGlobalState.js"])}(this,(e=>(()=>{"use strict";var t={362:(e,t,o)=>{var a=function(e,t){var o={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(o[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var l=0;for(a=Object.getOwnPropertySymbols(e);l<a.length;l++)t.indexOf(a[l])<0&&Object.prototype.propertyIsEnumerable.call(e,a[l])&&(o[a[l]]=e[a[l]])}return o};Object.defineProperty(t,"__esModule",{value:!0}),t.createCustomGlobalState=void 0;var l=o(963);t.createCustomGlobalState=function(e){var t=e.onInitialize,o=e.onChange;return function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=n.callbacks,c=a(n,["callbacks"]);return(0,l.createGlobalState)(e,Object.assign(Object.assign({},c),{callbacks:Object.assign(Object.assign({},null!=r?r:{}),{onInit:function(e){var o;null==t||t(e,null==c?void 0:c.config),null===(o=null==r?void 0:r.onInit)||void 0===o||o.call(r,e)},onStateChanged:function(e){var t;null==o||o(e,null==c?void 0:c.config),null===(t=null==r?void 0:r.onStateChanged)||void 0===t||t.call(r,e)}})}))}},t.default=t.createCustomGlobalState},963:t=>{t.exports=e}},o={};var a=function e(a){var l=o[a];if(void 0!==l)return l.exports;var n=o[a]={exports:{}};return t[a](n,n.exports,e),n.exports}(362);return a})()));
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("./createCustomGlobalState.js")):"function"==typeof define&&define.amd?define(["./createCustomGlobalState.js"],t):"object"==typeof exports?exports["react-hooks-global-states"]=t(require("./createCustomGlobalState.js")):e["react-hooks-global-states"]=t(e["./createCustomGlobalState.js"])}(this,(e=>(()=>{"use strict";var t={842:t=>{t.exports=e}},o={};var r=function e(r){var s=o[r];if(void 0!==s)return s.exports;var a=o[r]={exports:{}};return t[r](a,a.exports,e),a.exports}(842);return r})()));
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("./GlobalStore.js")):"function"==typeof define&&define.amd?define(["./GlobalStore.js"],t):"object"==typeof exports?exports["react-hooks-global-states"]=t(require("./GlobalStore.js")):e["react-hooks-global-states"]=t(e["./GlobalStore.js"])}(this,(e=>(()=>{"use strict";var t={196:(e,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createGlobalState=void 0;var r=o(352);t.createGlobalState=function(e,t){return new r.GlobalStore(e,t).getHook()},t.default=t.createGlobalState},352:t=>{t.exports=e}},o={};var r=function e(r){var a=o[r];if(void 0!==a)return a.exports;var l=o[r]={exports:{}};return t[r](l,l.exports,e),l.exports}(196);return r})()));
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("./createGlobalState.js")):"function"==typeof define&&define.amd?define(["./createGlobalState.js"],t):"object"==typeof exports?exports["react-hooks-global-states"]=t(require("./createGlobalState.js")):e["react-hooks-global-states"]=t(e["./createGlobalState.js"])}(this,(e=>(()=>{"use strict";var t={963:t=>{t.exports=e}},o={};var r=function e(r){var a=o[r];if(void 0!==a)return a.exports;var s=o[r]={exports:{}};return t[r](s,s.exports,e),s.exports}(963);return r})()));
package/debounce.js CHANGED
@@ -1 +1 @@
1
- !function(e,o){"object"==typeof exports&&"object"==typeof module?module.exports=o():"function"==typeof define&&define.amd?define([],o):"object"==typeof exports?exports["react-hooks-global-states"]=o():e["react-hooks-global-states"]=o()}(this,(()=>(()=>{"use strict";var e={};return((e,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.debounce=void 0;o.debounce=function(e){var o,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return function(){for(var n=arguments.length,r=new Array(n),u=0;u<n;u++)r[u]=arguments[u];o&&clearTimeout(o),o=setTimeout((function(){e.apply(void 0,r)}),t)}},o.default=o.debounce})(0,e),e})()));
1
+ !function(e,o){"object"==typeof exports&&"object"==typeof module?module.exports=o(require("./debounce.js")):"function"==typeof define&&define.amd?define(["./debounce.js"],o):"object"==typeof exports?exports["react-hooks-global-states"]=o(require("./debounce.js")):e["react-hooks-global-states"]=o(e["./debounce.js"])}(this,(e=>(()=>{"use strict";var o={433:o=>{o.exports=e}},t={};var r=function e(r){var s=t[r];if(void 0!==s)return s.exports;var n=t[r]={exports:{}};return o[r](n,n.exports,e),n.exports}(433);return r})()));
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["react-hooks-global-states"]=t():e["react-hooks-global-states"]=t()}(this,(()=>(()=>{"use strict";var e={};return((e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.generateStackHash=void 0;t.generateStackHash=function(e){if(!e.trim())return"unknown";e=e.replace(/\s/g,"");for(var t=2166136261,o=0;o<e.length;o++)t^=e.charCodeAt(o),t*=16777619,t&=4294967295;return function(e){for(var t="";e>0;)t="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"[e%62]+t,e=Math.floor(e/62);return t||"0"}(t>>>0)},t.default=t.generateStackHash})(0,e),e})()));
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("./generateStackHash.js")):"function"==typeof define&&define.amd?define(["./generateStackHash.js"],t):"object"==typeof exports?exports["react-hooks-global-states"]=t(require("./generateStackHash.js")):e["react-hooks-global-states"]=t(e["./generateStackHash.js"])}(this,(e=>(()=>{"use strict";var t={109:t=>{t.exports=e}},r={};var o=function e(o){var s=r[o];if(void 0!==s)return s.exports;var a=r[o]={exports:{}};return t[o](a,a.exports,e),a.exports}(109);return o})()));
package/isRecord.js CHANGED
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["react-hooks-global-states"]=t():e["react-hooks-global-states"]=t()}(this,(()=>{return e={143:(e,t,o)=>{"use strict";function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.isRecord=void 0;var n=o(125);t.isRecord=function(e){return!(0,n.isNil)(e)&&"object"===r(e)},t.default=t.isRecord},125:function(e){e.exports=(()=>{"use strict";var e={};return(()=>{var t=e;Object.defineProperty(t,"__esModule",{value:!0}),t.isNil=void 0,t.isNil=function(e){return null==e}})(),e})()}},t={},function o(r){var n=t[r];if(void 0!==n)return n.exports;var i=t[r]={exports:{}};return e[r].call(i.exports,i,i.exports,o),i.exports}(143);var e,t}));
1
+ !function(e,o){"object"==typeof exports&&"object"==typeof module?module.exports=o(require("./isRecord.js")):"function"==typeof define&&define.amd?define(["./isRecord.js"],o):"object"==typeof exports?exports["react-hooks-global-states"]=o(require("./isRecord.js")):e["react-hooks-global-states"]=o(e["./isRecord.js"])}(this,(e=>(()=>{"use strict";var o={664:o=>{o.exports=e}},t={};var r=function e(r){var s=t[r];if(void 0!==s)return s.exports;var i=t[r]={exports:{}};return o[r](i,i.exports,e),i.exports}(664);return r})()));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-hooks-global-states",
3
- "version": "7.0.14",
3
+ "version": "7.0.15",
4
4
  "description": "This is a package to easily handling global-state across your react-components using hooks.",
5
5
  "main": "./bundle.js",
6
6
  "types": "./index.d.ts",
package/shallowCompare.js CHANGED
@@ -1 +1 @@
1
- !function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r(require("./isRecord.js")):"function"==typeof define&&define.amd?define(["./isRecord.js"],r):"object"==typeof exports?exports["react-hooks-global-states"]=r(require("./isRecord.js")):e["react-hooks-global-states"]=r(e["./isRecord.js"])}(this,(e=>{return r={561:(e,r,t)=>{"use strict";function n(e,r){return function(e){if(Array.isArray(e))return e}(e)||function(e,r){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var n,o,i,u,a=[],f=!0,l=!1;try{if(i=(t=t.call(e)).next,0===r){if(Object(t)!==t)return;f=!1}else for(;!(f=(n=i.call(t)).done)&&(a.push(n.value),a.length!==r);f=!0);}catch(e){l=!0,o=e}finally{try{if(!f&&null!=t.return&&(u=t.return(),Object(u)!==u))return}finally{if(l)throw o}}return a}}(e,r)||i(e,r)||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 o(e,r){var t="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!t){if(Array.isArray(e)||(t=i(e))||r&&e&&"number"==typeof e.length){t&&(e=t);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},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 u,a=!0,f=!1;return{s:function(){t=t.call(e)},n:function(){var e=t.next();return a=e.done,e},e:function(e){f=!0,u=e},f:function(){try{a||null==t.return||t.return()}finally{if(f)throw u}}}}function i(e,r){if(e){if("string"==typeof e)return u(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?u(e,r):void 0}}function u(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function a(e){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a(e)}Object.defineProperty(r,"__esModule",{value:!0}),r.shallowCompare=void 0;var f=t(416),l=t(231),s=t(125),c=t(664);r.shallowCompare=function(e,r){if(e===r)return!0;var t=a(e),i=a(r);if(t!==i)return!1;if((0,s.isNil)(e)||(0,s.isNil)(r)||(0,f.isPrimitive)(e)&&(0,f.isPrimitive)(r)||(0,l.isDate)(e)&&(0,l.isDate)(r)||"function"===t&&"function"===i)return e===r;if(Array.isArray(e)){var u=e,y=r;if(u.length!==y.length)return!1;for(var v=0;v<u.length;v++)if(u[v]!==y[v])return!1}if(e instanceof Map){var p=e,d=r;if(p.size!==d.size)return!1;var b,m=o(p);try{for(m.s();!(b=m.n()).done;){var h=n(b.value,2),j=h[0];if(h[1]!==d.get(j))return!1}}catch(e){m.e(e)}finally{m.f()}}if(e instanceof Set){var S=e,g=r;if(S.size!==g.size)return!1;var x,_=o(S);try{for(_.s();!(x=_.n()).done;){var O=x.value;if(!g.has(O))return!1}}catch(e){_.e(e)}finally{_.f()}}if(!(0,c.isRecord)(e)||!(0,c.isRecord)(r))return e===r;var P=Object.keys(e),w=Object.keys(r);if(P.length!==w.length)return!1;for(var A=0,M=P;A<M.length;A++){var N=M[A];if(e[N]!==r[N])return!1}return!0},r.default=r.shallowCompare},231:function(e){e.exports=(()=>{"use strict";var e={};return(()=>{var r=e;Object.defineProperty(r,"__esModule",{value:!0}),r.isDate=void 0,r.isDate=function(e){return e instanceof Date}})(),e})()},125:function(e){e.exports=(()=>{"use strict";var e={};return(()=>{var r=e;Object.defineProperty(r,"__esModule",{value:!0}),r.isNil=void 0,r.isNil=function(e){return null==e}})(),e})()},416:function(e){e.exports=(()=>{"use strict";var e={112:(e,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.isBoolean=void 0,r.isBoolean=function(e){return"boolean"==typeof e}},243:(e,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.isNil=void 0,r.isNil=function(e){return null==e}},11:(e,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.isNumber=void 0,r.isNumber=function(e){return"number"==typeof e}},671:(e,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.isString=void 0,r.isString=function(e){return"string"==typeof e}}},r={};function t(n){var o=r[n];if(void 0!==o)return o.exports;var i=r[n]={exports:{}};return e[n](i,i.exports,t),i.exports}var n={};return(()=>{var e=n;function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}Object.defineProperty(e,"__esModule",{value:!0}),e.isPrimitive=void 0;var o=t(112),i=t(243),u=t(11),a=t(671);e.isPrimitive=function(e){return(0,i.isNil)(e)||(0,u.isNumber)(e)||(0,o.isBoolean)(e)||(0,a.isString)(e)||"symbol"===r(e)}})(),n})()},664:r=>{"use strict";r.exports=e}},t={},function e(n){var o=t[n];if(void 0!==o)return o.exports;var i=t[n]={exports:{}};return r[n].call(i.exports,i,i.exports,e),i.exports}(561);var r,t}));
1
+ !function(e,o){"object"==typeof exports&&"object"==typeof module?module.exports=o(require("./shallowCompare.js")):"function"==typeof define&&define.amd?define(["./shallowCompare.js"],o):"object"==typeof exports?exports["react-hooks-global-states"]=o(require("./shallowCompare.js")):e["react-hooks-global-states"]=o(e["./shallowCompare.js"])}(this,(e=>(()=>{"use strict";var o={682:o=>{o.exports=e}},t={};var r=function e(r){var s=t[r];if(void 0!==s)return s.exports;var a=t[r]={exports:{}};return o[r](a,a.exports,e),a.exports}(682);return r})()));
@@ -1 +1 @@
1
- !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports["react-hooks-global-states"]=e():t["react-hooks-global-states"]=e()}(this,(()=>(()=>{"use strict";var t={};return((t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.throwWrongKeyOnActionCollectionConfig=void 0;e.throwWrongKeyOnActionCollectionConfig=function(t){throw new Error("[WRONG CONFIGURATION!]: Every key inside the storeActionsConfig must be a higher order function that returns a function \n[".concat(t,"]: key is not a valid function, try something like this: \n{\n\n ").concat(t,": (param) => ({ setState, getState, setMetadata, getMetadata, actions }) => {\n\n setState((state) => ({ ...state, ...param }))\n\n }\n\n}\n"))},e.default=e.throwWrongKeyOnActionCollectionConfig})(0,t),t})()));
1
+ !function(o,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("./throwWrongKeyOnActionCollectionConfig.js")):"function"==typeof define&&define.amd?define(["./throwWrongKeyOnActionCollectionConfig.js"],e):"object"==typeof exports?exports["react-hooks-global-states"]=e(require("./throwWrongKeyOnActionCollectionConfig.js")):o["react-hooks-global-states"]=e(o["./throwWrongKeyOnActionCollectionConfig.js"])}(this,(o=>(()=>{"use strict";var e={286:e=>{e.exports=o}},t={};var r=function o(r){var n=t[r];if(void 0!==n)return n.exports;var i=t[r]={exports:{}};return e[r](i,i.exports,o),i.exports}(286);return r})()));
package/types.js CHANGED
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["react-hooks-global-states"]=t():e["react-hooks-global-states"]=t()}(this,(()=>(()=>{"use strict";var e={};return(()=>{var t=e;Object.defineProperty(t,"__esModule",{value:!0})})(),e})()));
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("./types.js")):"function"==typeof define&&define.amd?define(["./types.js"],t):"object"==typeof exports?exports["react-hooks-global-states"]=t(require("./types.js")):e["react-hooks-global-states"]=t(e["./types.js"])}(this,(e=>(()=>{"use strict";var t={908:t=>{t.exports=e}},o={};var r=function e(r){var s=o[r];if(void 0!==s)return s.exports;var p=o[r]={exports:{}};return t[r](p,p.exports,e),p.exports}(908);return r})()));
package/uniqueId.js CHANGED
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["react-hooks-global-states"]=t():e["react-hooks-global-states"]=t()}(this,(()=>(()=>{"use strict";var e={};return((e,t)=>{var o;Object.defineProperty(t,"__esModule",{value:!0}),t.uniqueId=void 0,t.uniqueId=(o=0,function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return o===Number.MAX_SAFE_INTEGER&&(o=0),e+Date.now().toString(36)+(o++).toString(36)}),t.default=t.uniqueId})(0,e),e})()));
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("./uniqueId.js")):"function"==typeof define&&define.amd?define(["./uniqueId.js"],t):"object"==typeof exports?exports["react-hooks-global-states"]=t(require("./uniqueId.js")):e["react-hooks-global-states"]=t(e["./uniqueId.js"])}(this,(e=>(()=>{"use strict";var t={865:t=>{t.exports=e}},o={};var r=function e(r){var s=o[r];if(void 0!==s)return s.exports;var u=o[r]={exports:{}};return t[r](u,u.exports,e),u.exports}(865);return r})()));
package/uniqueSymbol.js CHANGED
@@ -1 +1 @@
1
- !function(e,o){"object"==typeof exports&&"object"==typeof module?module.exports=o():"function"==typeof define&&define.amd?define([],o):"object"==typeof exports?exports["react-hooks-global-states"]=o():e["react-hooks-global-states"]=o()}(this,(()=>(()=>{"use strict";var e={};return((e,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.uniqueSymbol=void 0,o.uniqueSymbol=Symbol("unique"),o.default=o.uniqueSymbol})(0,e),e})()));
1
+ !function(e,o){"object"==typeof exports&&"object"==typeof module?module.exports=o(require("./uniqueSymbol.js")):"function"==typeof define&&define.amd?define(["./uniqueSymbol.js"],o):"object"==typeof exports?exports["react-hooks-global-states"]=o(require("./uniqueSymbol.js")):e["react-hooks-global-states"]=o(e["./uniqueSymbol.js"])}(this,(e=>(()=>{"use strict";var o={69:o=>{o.exports=e}},t={};var r=function e(r){var s=t[r];if(void 0!==s)return s.exports;var u=t[r]={exports:{}};return o[r](u,u.exports,e),u.exports}(69);return r})()));
package/useStableState.js CHANGED
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("./shallowCompare.js"),require("react")):"function"==typeof define&&define.amd?define(["./shallowCompare.js","react"],t):"object"==typeof exports?exports["react-hooks-global-states"]=t(require("./shallowCompare.js"),require("react")):e["react-hooks-global-states"]=t(e["./shallowCompare.js"],e.react)}(this,((e,t)=>{return r={965:(e,t,r)=>{"use strict";function n(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,u,i,l=[],a=!0,c=!1;try{if(u=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;a=!1}else for(;!(a=(n=u.call(r)).done)&&(l.push(n.value),l.length!==t);a=!0);}catch(e){c=!0,o=e}finally{try{if(!a&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(c)throw o}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return o(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?o(e,t):void 0}}(e,t)||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 o(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}Object.defineProperty(t,"__esModule",{value:!0}),t.useStableState=void 0;var u=r(156),i=r(244),l=r(125),a=r(682),c=r(156),s=r(156);t.useStableState=function(e){var t=(0,i.isFunction)(arguments.length<=1?void 0:arguments[1])?arguments.length<=1?void 0:arguments[1]:void 0,r=t?arguments.length<=2?void 0:arguments[2]:arguments.length<=1?void 0:arguments[1],o=(0,u.useRef)({builder:null,cleanup:t,dependencies:r}),f=(0,i.isFunction)(e)?e:function(){return e},p=n((0,c.useState)((function(){return{value:f()}})),2),d=p[0],v=p[1],b=(0,l.isNil)(o.current.builder),y=(0,l.isNil)(r)||!(0,a.shallowCompare)(o.current.dependencies,r);!b&&y&&(d.value=f()),o.current.dependencies=r,o.current.builder=f,o.current.cleanup=t;var h=(0,s.useCallback)((function(){v({value:o.current.builder()})}),[]);return(0,u.useEffect)((function(){return function(){o.current.cleanup&&o.current.cleanup(d.value)}}),[]),[d,h]},t.default=t.useStableState},244:function(e){e.exports=(()=>{"use strict";var e={};return(()=>{var t=e;Object.defineProperty(t,"__esModule",{value:!0}),t.isFunction=void 0,t.isFunction=function(e){return"function"==typeof e||e instanceof Function}})(),e})()},125:function(e){e.exports=(()=>{"use strict";var e={};return(()=>{var t=e;Object.defineProperty(t,"__esModule",{value:!0}),t.isNil=void 0,t.isNil=function(e){return null==e}})(),e})()},682:t=>{"use strict";t.exports=e},156:e=>{"use strict";e.exports=t}},n={},function e(t){var o=n[t];if(void 0!==o)return o.exports;var u=n[t]={exports:{}};return r[t].call(u.exports,u,u.exports,e),u.exports}(965);var r,n}));
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("./useStableState.js")):"function"==typeof define&&define.amd?define(["./useStableState.js"],t):"object"==typeof exports?exports["react-hooks-global-states"]=t(require("./useStableState.js")):e["react-hooks-global-states"]=t(e["./useStableState.js"])}(this,(e=>(()=>{"use strict";var t={503:t=>{t.exports=e}},o={};var r=function e(r){var s=o[r];if(void 0!==s)return s.exports;var a=o[r]={exports:{}};return t[r](a,a.exports,e),a.exports}(503);return r})()));
package/webpack.config.js CHANGED
@@ -20,23 +20,28 @@ module.exports = {
20
20
  useStableState: './src/useStableState.ts',
21
21
  generateStackHash: './src/generateStackHash.ts',
22
22
  },
23
- externals: {
24
- react: 'react',
25
- './createContext': './createContext.js',
26
- './GlobalStore': './GlobalStore.js',
27
- './GlobalStoreAbstract': './GlobalStoreAbstract.js',
28
- './createCustomGlobalState': './createCustomGlobalState.js',
29
- './createGlobalState': './createGlobalState.js',
30
- './types': './types.js',
31
- './debounce': './src/debounce.ts',
32
- './isRecord': './isRecord.js',
33
- './shallowCompare': './shallowCompare.js',
34
- './throwWrongKeyOnActionCollectionConfig': './throwWrongKeyOnActionCollectionConfig.js',
35
- './uniqueId': './uniqueId.js',
36
- './uniqueSymbol': './uniqueSymbol.js',
37
- './useStableState': './useStableState.js',
38
- './generateStackHash': './generateStackHash.js',
39
- },
23
+ externals: [
24
+ 'react',
25
+ 'json-storage-formatter',
26
+ ({ request }, callback) => {
27
+ request = String(request);
28
+
29
+ const isMainBundle = request === './src/index.ts';
30
+ if (isMainBundle) return callback();
31
+
32
+ const isJSONStorageFormatter = request.startsWith('json-storage-formatter');
33
+ if (isJSONStorageFormatter) return callback(null, request);
34
+
35
+ // thread local imports as externals
36
+ const isLocal = request.startsWith('./src/');
37
+ if (isLocal) {
38
+ const filename = path.basename(request, '.ts') + '.js';
39
+ return callback(null, `./${filename}`);
40
+ }
41
+
42
+ callback();
43
+ },
44
+ ],
40
45
  output: {
41
46
  path: path.resolve(__dirname),
42
47
  filename: ({ chunk: { name } }) => {
@@ -48,12 +53,6 @@ module.exports = {
48
53
  },
49
54
  resolve: {
50
55
  extensions: ['.ts', '.js'],
51
- alias: {
52
- 'react-hooks-global-states': path.resolve(
53
- __dirname,
54
- 'node_modules/react-hooks-global-states/package.json'
55
- ),
56
- },
57
56
  },
58
57
  module: {
59
58
  rules: [