react-state-custom 1.0.0 → 1.0.2

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/dist/index.umd.js CHANGED
@@ -1,4 +1,4 @@
1
- (function(y,m){typeof exports=="object"&&typeof module<"u"?m(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],m):(y=typeof globalThis<"u"?globalThis:y||self,m(y.RState={},y.React))})(this,function(y,m){"use strict";var fr=Object.defineProperty;var cr=(y,m,W)=>m in y?fr(y,m,{enumerable:!0,configurable:!0,writable:!0,value:W}):y[m]=W;var ne=(y,m,W)=>cr(y,typeof m!="symbol"?m+"":m,W);function W(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var B={exports:{}},le;function Ae(){if(le)return B.exports;le=1;var e=typeof Reflect=="object"?Reflect:null,t=e&&typeof e.apply=="function"?e.apply:function(o,n,f){return Function.prototype.apply.call(o,n,f)},r;e&&typeof e.ownKeys=="function"?r=e.ownKeys:Object.getOwnPropertySymbols?r=function(o){return Object.getOwnPropertyNames(o).concat(Object.getOwnPropertySymbols(o))}:r=function(o){return Object.getOwnPropertyNames(o)};function u(s){console&&console.warn&&console.warn(s)}var c=Number.isNaN||function(o){return o!==o};function i(){i.init.call(this)}B.exports=i,B.exports.once=A,i.EventEmitter=i,i.prototype._events=void 0,i.prototype._eventsCount=0,i.prototype._maxListeners=void 0;var d=10;function h(s){if(typeof s!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof s)}Object.defineProperty(i,"defaultMaxListeners",{enumerable:!0,get:function(){return d},set:function(s){if(typeof s!="number"||s<0||c(s))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+s+".");d=s}}),i.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},i.prototype.setMaxListeners=function(o){if(typeof o!="number"||o<0||c(o))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+o+".");return this._maxListeners=o,this};function b(s){return s._maxListeners===void 0?i.defaultMaxListeners:s._maxListeners}i.prototype.getMaxListeners=function(){return b(this)},i.prototype.emit=function(o){for(var n=[],f=1;f<arguments.length;f++)n.push(arguments[f]);var l=o==="error",g=this._events;if(g!==void 0)l=l&&g.error===void 0;else if(!l)return!1;if(l){var v;if(n.length>0&&(v=n[0]),v instanceof Error)throw v;var j=new Error("Unhandled error."+(v?" ("+v.message+")":""));throw j.context=v,j}var M=g[o];if(M===void 0)return!1;if(typeof M=="function")t(M,this,n);else for(var re=M.length,K=F(M,re),f=0;f<re;++f)t(K[f],this,n);return!0};function _(s,o,n,f){var l,g,v;if(h(n),g=s._events,g===void 0?(g=s._events=Object.create(null),s._eventsCount=0):(g.newListener!==void 0&&(s.emit("newListener",o,n.listener?n.listener:n),g=s._events),v=g[o]),v===void 0)v=g[o]=n,++s._eventsCount;else if(typeof v=="function"?v=g[o]=f?[n,v]:[v,n]:f?v.unshift(n):v.push(n),l=b(s),l>0&&v.length>l&&!v.warned){v.warned=!0;var j=new Error("Possible EventEmitter memory leak detected. "+v.length+" "+String(o)+" listeners added. Use emitter.setMaxListeners() to increase limit");j.name="MaxListenersExceededWarning",j.emitter=s,j.type=o,j.count=v.length,u(j)}return s}i.prototype.addListener=function(o,n){return _(this,o,n,!1)},i.prototype.on=i.prototype.addListener,i.prototype.prependListener=function(o,n){return _(this,o,n,!0)};function O(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function w(s,o,n){var f={fired:!1,wrapFn:void 0,target:s,type:o,listener:n},l=O.bind(f);return l.listener=n,f.wrapFn=l,l}i.prototype.once=function(o,n){return h(n),this.on(o,w(this,o,n)),this},i.prototype.prependOnceListener=function(o,n){return h(n),this.prependListener(o,w(this,o,n)),this},i.prototype.removeListener=function(o,n){var f,l,g,v,j;if(h(n),l=this._events,l===void 0)return this;if(f=l[o],f===void 0)return this;if(f===n||f.listener===n)--this._eventsCount===0?this._events=Object.create(null):(delete l[o],l.removeListener&&this.emit("removeListener",o,f.listener||n));else if(typeof f!="function"){for(g=-1,v=f.length-1;v>=0;v--)if(f[v]===n||f[v].listener===n){j=f[v].listener,g=v;break}if(g<0)return this;g===0?f.shift():E(f,g),f.length===1&&(l[o]=f[0]),l.removeListener!==void 0&&this.emit("removeListener",o,j||n)}return this},i.prototype.off=i.prototype.removeListener,i.prototype.removeAllListeners=function(o){var n,f,l;if(f=this._events,f===void 0)return this;if(f.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):f[o]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete f[o]),this;if(arguments.length===0){var g=Object.keys(f),v;for(l=0;l<g.length;++l)v=g[l],v!=="removeListener"&&this.removeAllListeners(v);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(n=f[o],typeof n=="function")this.removeListener(o,n);else if(n!==void 0)for(l=n.length-1;l>=0;l--)this.removeListener(o,n[l]);return this};function L(s,o,n){var f=s._events;if(f===void 0)return[];var l=f[o];return l===void 0?[]:typeof l=="function"?n?[l.listener||l]:[l]:n?S(l):F(l,l.length)}i.prototype.listeners=function(o){return L(this,o,!0)},i.prototype.rawListeners=function(o){return L(this,o,!1)},i.listenerCount=function(s,o){return typeof s.listenerCount=="function"?s.listenerCount(o):P.call(s,o)},i.prototype.listenerCount=P;function P(s){var o=this._events;if(o!==void 0){var n=o[s];if(typeof n=="function")return 1;if(n!==void 0)return n.length}return 0}i.prototype.eventNames=function(){return this._eventsCount>0?r(this._events):[]};function F(s,o){for(var n=new Array(o),f=0;f<o;++f)n[f]=s[f];return n}function E(s,o){for(;o+1<s.length;o++)s[o]=s[o+1];s.pop()}function S(s){for(var o=new Array(s.length),n=0;n<o.length;++n)o[n]=s[n].listener||s[n];return o}function A(s,o){return new Promise(function(n,f){function l(v){s.removeListener(o,g),f(v)}function g(){typeof s.removeListener=="function"&&s.removeListener("error",l),n([].slice.call(arguments))}U(s,o,g,{once:!0}),o!=="error"&&G(s,l,{once:!0})})}function G(s,o,n){typeof s.on=="function"&&U(s,"error",o,n)}function U(s,o,n,f){if(typeof s.on=="function")f.once?s.once(o,n):s.on(o,n);else if(typeof s.addEventListener=="function")s.addEventListener(o,function l(g){f.once&&s.removeEventListener(o,l),n(g)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof s)}return B.exports}var Me=Ae();const De=W(Me);var Ie=typeof global=="object"&&global&&global.Object===Object&&global,ke=typeof self=="object"&&self&&self.Object===Object&&self,Q=Ie||ke||Function("return this")(),Z=Q.Symbol,de=Object.prototype,Fe=de.hasOwnProperty,We=de.toString,x=Z?Z.toStringTag:void 0;function ze(e){var t=Fe.call(e,x),r=e[x];try{e[x]=void 0;var u=!0}catch{}var c=We.call(e);return u&&(t?e[x]=r:delete e[x]),c}var Ye=Object.prototype,Ge=Ye.toString;function Ue(e){return Ge.call(e)}var Ve="[object Null]",xe="[object Undefined]",he=Z?Z.toStringTag:void 0;function pe(e){return e==null?e===void 0?xe:Ve:he&&he in Object(e)?ze(e):Ue(e)}function He(e){return e!=null&&typeof e=="object"}var Je="[object Symbol]";function Xe(e){return typeof e=="symbol"||He(e)&&pe(e)==Je}var Ke=/\s/;function Be(e){for(var t=e.length;t--&&Ke.test(e.charAt(t)););return t}var Qe=/^\s+/;function Ze(e){return e&&e.slice(0,Be(e)+1).replace(Qe,"")}function z(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var ve=NaN,$e=/^[-+]0x[0-9a-f]+$/i,qe=/^0b[01]+$/i,et=/^0o[0-7]+$/i,tt=parseInt;function me(e){if(typeof e=="number")return e;if(Xe(e))return ve;if(z(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=z(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=Ze(e);var r=qe.test(e);return r||et.test(e)?tt(e.slice(2),r?2:8):$e.test(e)?ve:+e}var rt="[object AsyncFunction]",nt="[object Function]",ot="[object GeneratorFunction]",at="[object Proxy]";function it(e){if(!z(e))return!1;var t=pe(e);return t==nt||t==ot||t==rt||t==at}var oe=Q["__core-js_shared__"],be=function(){var e=/[^.]+$/.exec(oe&&oe.keys&&oe.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function st(e){return!!be&&be in e}var ut=Function.prototype,ft=ut.toString;function ct(e){if(e!=null){try{return ft.call(e)}catch{}try{return e+""}catch{}}return""}var lt=/[\\^$.*+?()[\]{}|]/g,dt=/^\[object .+?Constructor\]$/,ht=Function.prototype,pt=Object.prototype,vt=ht.toString,mt=pt.hasOwnProperty,bt=RegExp("^"+vt.call(mt).replace(lt,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function gt(e){if(!z(e)||st(e))return!1;var t=it(e)?bt:dt;return t.test(ct(e))}function _t(e,t){return e==null?void 0:e[t]}function ge(e,t){var r=_t(e,t);return gt(r)?r:void 0}function Et(e,t){return e===t||e!==e&&t!==t}var H=ge(Object,"create");function yt(){this.__data__=H?H(null):{},this.size=0}function Tt(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var Ot="__lodash_hash_undefined__",wt=Object.prototype,St=wt.hasOwnProperty;function Rt(e){var t=this.__data__;if(H){var r=t[e];return r===Ot?void 0:r}return St.call(t,e)?t[e]:void 0}var Ct=Object.prototype,jt=Ct.hasOwnProperty;function Lt(e){var t=this.__data__;return H?t[e]!==void 0:jt.call(t,e)}var Pt="__lodash_hash_undefined__";function Nt(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=H&&t===void 0?Pt:t,this}function I(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var u=e[t];this.set(u[0],u[1])}}I.prototype.clear=yt,I.prototype.delete=Tt,I.prototype.get=Rt,I.prototype.has=Lt,I.prototype.set=Nt;function At(){this.__data__=[],this.size=0}function $(e,t){for(var r=e.length;r--;)if(Et(e[r][0],t))return r;return-1}var Mt=Array.prototype,Dt=Mt.splice;function It(e){var t=this.__data__,r=$(t,e);if(r<0)return!1;var u=t.length-1;return r==u?t.pop():Dt.call(t,r,1),--this.size,!0}function kt(e){var t=this.__data__,r=$(t,e);return r<0?void 0:t[r][1]}function Ft(e){return $(this.__data__,e)>-1}function Wt(e,t){var r=this.__data__,u=$(r,e);return u<0?(++this.size,r.push([e,t])):r[u][1]=t,this}function Y(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var u=e[t];this.set(u[0],u[1])}}Y.prototype.clear=At,Y.prototype.delete=It,Y.prototype.get=kt,Y.prototype.has=Ft,Y.prototype.set=Wt;var zt=ge(Q,"Map");function Yt(){this.size=0,this.__data__={hash:new I,map:new(zt||Y),string:new I}}function Gt(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function q(e,t){var r=e.__data__;return Gt(t)?r[typeof t=="string"?"string":"hash"]:r.map}function Ut(e){var t=q(this,e).delete(e);return this.size-=t?1:0,t}function Vt(e){return q(this,e).get(e)}function xt(e){return q(this,e).has(e)}function Ht(e,t){var r=q(this,e),u=r.size;return r.set(e,t),this.size+=r.size==u?0:1,this}function k(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var u=e[t];this.set(u[0],u[1])}}k.prototype.clear=Yt,k.prototype.delete=Ut,k.prototype.get=Vt,k.prototype.has=xt,k.prototype.set=Ht;var Jt="Expected a function";function ae(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(Jt);var r=function(){var u=arguments,c=t?t.apply(this,u):u[0],i=r.cache;if(i.has(c))return i.get(c);var d=e.apply(this,u);return r.cache=i.set(c,d)||i,d};return r.cache=new(ae.Cache||k),r}ae.Cache=k;var ie=function(){return Q.Date.now()},Xt="Expected a function",Kt=Math.max,Bt=Math.min;function ee(e,t,r){var u,c,i,d,h,b,_=0,O=!1,w=!1,L=!0;if(typeof e!="function")throw new TypeError(Xt);t=me(t)||0,z(r)&&(O=!!r.leading,w="maxWait"in r,i=w?Kt(me(r.maxWait)||0,t):i,L="trailing"in r?!!r.trailing:L);function P(n){var f=u,l=c;return u=c=void 0,_=n,d=e.apply(l,f),d}function F(n){return _=n,h=setTimeout(A,t),O?P(n):d}function E(n){var f=n-b,l=n-_,g=t-f;return w?Bt(g,i-l):g}function S(n){var f=n-b,l=n-_;return b===void 0||f>=t||f<0||w&&l>=i}function A(){var n=ie();if(S(n))return G(n);h=setTimeout(A,E(n))}function G(n){return h=void 0,L&&u?P(n):(u=c=void 0,d)}function U(){h!==void 0&&clearTimeout(h),_=0,u=b=c=h=void 0}function s(){return h===void 0?d:G(ie())}function o(){var n=ie(),f=S(n);if(u=arguments,c=this,b=n,f){if(h===void 0)return F(b);if(w)return clearTimeout(h),h=setTimeout(A,t),P(b)}return h===void 0&&(h=setTimeout(A,t)),d}return o.cancel=U,o.flush=s,o}var Qt="Expected a function";function Zt(e,t,r){var u=!0,c=!0;if(typeof e!="function")throw new TypeError(Qt);return z(r)&&(u="leading"in r?!!r.leading:u,c="trailing"in r?!!r.trailing:c),ee(e,t,{leading:u,maxWait:t,trailing:c})}class _e{constructor(t){ne(this,"event",new De.EventEmitter);ne(this,"data",{});ne(this,"registry",new Set);this.name=t,console.log("[CONTEXT] %s",t),this.event.setMaxListeners(100)}publish(t,r){r!=this.data[t]&&(this.data[t]=r,this.event.emit(String(t),{value:r}))}subscribe(t,r){const u=({value:c})=>{r(c)};return this.event.addListener(String(t),u),console.log("listenerCount:",String(t),this.event.listenerCount(String(t))),t in this.data&&r(this.data[t]),()=>(this.event.removeListener(String(t),u),void 0)}}const Ee=ae(e=>new _e(e)),se=(e="noname")=>m.useMemo(()=>Ee(e),[e]),ye=(e,...t)=>{const r=new Error("[ctx] useRegistryChecker failed "+JSON.stringify({names:t,ctx:(e==null?void 0:e.name)??"undefined"}));m.useEffect(()=>{if(e)return t.some(u=>e.registry.has(u))&&console.error(r),t.forEach(u=>e.registry.add(u)),()=>{t.forEach(u=>e.registry.delete(u))}},[e,t.length])},$t=(e,t,r)=>{m.useEffect(()=>{e&&e.data[t]!=r&&e.publish(t,r)},[t,r,e]),ye(e,t)},qt=(e,t,r=0)=>{const[{value:u},c]=m.useState(()=>{var i;return{value:(i=e==null?void 0:e.data)==null?void 0:i[t]}});return m.useEffect(()=>{if(e){let i=r==0?h=>c({value:h}):ee(h=>c({value:h}),r),d=e.subscribe(t,i);return u!=e.data[t]&&c({value:e.data[t]}),()=>{d()}}},[t,e]),e==null?void 0:e.data[t]},er=(e,t,r)=>{const[,u]=m.useState(0),c=m.useMemo(()=>r(e==null?void 0:e.data[t]),[r,e==null?void 0:e.data[t]]);return m.useEffect(()=>{if(e){let i=c,d=()=>{let b=r(e.data[t]);b!=i&&(i=b,u(_=>_+1))},h=e.subscribe(t,d);return d(),()=>h()}},[t,e]),c},Te=(e,...t)=>{m.useEffect(()=>{if(e)for(let[r,u]of t)e.data[r]!=u&&e.publish(r,u)},[e,...t.flat()]),ye(e,...t.map(r=>r[0]))},tr=(e,...t)=>{const[,r]=m.useState(0),u=t.map(c=>{var i;return(i=e==null?void 0:e.data)==null?void 0:i[c]});return m.useEffect(()=>{if(e){let c=u;const i=ee(()=>{let b=t.map(_=>{var O;return(O=e==null?void 0:e.data)==null?void 0:O[_]});t.some((_,O)=>c[O]!=b[O])&&(c=b,r(_=>_+1))},1);let d=t.map(b=>e.subscribe(b,i)),h=setTimeout(i,1);return()=>{clearTimeout(h),i.cancel(),d.forEach(b=>b())}}},[e,...t]),Object.fromEntries(t.map((c,i)=>[c,u[i]]))},rr=(e,t=100,...r)=>{const[,u]=m.useState(0),c=r.map(i=>{var d;return(d=e==null?void 0:e.data)==null?void 0:d[i]});return m.useEffect(()=>{if(e){let i=c;const d=Zt(()=>{let _=r.map(O=>{var w;return(w=e==null?void 0:e.data)==null?void 0:w[O]});r.some((O,w)=>i[w]!=_[w])&&(i=_,u(O=>O+1))},t);let h=r.map(_=>e.subscribe(_,d)),b=setTimeout(d,1);return()=>{clearTimeout(b),d.cancel(),h.forEach(_=>_())}}},[e,...r]),c};var te={exports:{}},J={};/**
1
+ (function(y,m){typeof exports=="object"&&typeof module<"u"?m(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],m):(y=typeof globalThis<"u"?globalThis:y||self,m(y.RState={},y.React))})(this,function(y,m){"use strict";var fr=Object.defineProperty;var cr=(y,m,W)=>m in y?fr(y,m,{enumerable:!0,configurable:!0,writable:!0,value:W}):y[m]=W;var oe=(y,m,W)=>cr(y,typeof m!="symbol"?m+"":m,W);function W(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var B={exports:{}},le;function Ae(){if(le)return B.exports;le=1;var e=typeof Reflect=="object"?Reflect:null,t=e&&typeof e.apply=="function"?e.apply:function(a,o,f){return Function.prototype.apply.call(a,o,f)},r;e&&typeof e.ownKeys=="function"?r=e.ownKeys:Object.getOwnPropertySymbols?r=function(a){return Object.getOwnPropertyNames(a).concat(Object.getOwnPropertySymbols(a))}:r=function(a){return Object.getOwnPropertyNames(a)};function u(s){console&&console.warn&&console.warn(s)}var c=Number.isNaN||function(a){return a!==a};function n(){n.init.call(this)}B.exports=n,B.exports.once=A,n.EventEmitter=n,n.prototype._events=void 0,n.prototype._eventsCount=0,n.prototype._maxListeners=void 0;var d=10;function h(s){if(typeof s!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof s)}Object.defineProperty(n,"defaultMaxListeners",{enumerable:!0,get:function(){return d},set:function(s){if(typeof s!="number"||s<0||c(s))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+s+".");d=s}}),n.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},n.prototype.setMaxListeners=function(a){if(typeof a!="number"||a<0||c(a))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+a+".");return this._maxListeners=a,this};function b(s){return s._maxListeners===void 0?n.defaultMaxListeners:s._maxListeners}n.prototype.getMaxListeners=function(){return b(this)},n.prototype.emit=function(a){for(var o=[],f=1;f<arguments.length;f++)o.push(arguments[f]);var l=a==="error",g=this._events;if(g!==void 0)l=l&&g.error===void 0;else if(!l)return!1;if(l){var v;if(o.length>0&&(v=o[0]),v instanceof Error)throw v;var j=new Error("Unhandled error."+(v?" ("+v.message+")":""));throw j.context=v,j}var M=g[a];if(M===void 0)return!1;if(typeof M=="function")t(M,this,o);else for(var ne=M.length,K=F(M,ne),f=0;f<ne;++f)t(K[f],this,o);return!0};function _(s,a,o,f){var l,g,v;if(h(o),g=s._events,g===void 0?(g=s._events=Object.create(null),s._eventsCount=0):(g.newListener!==void 0&&(s.emit("newListener",a,o.listener?o.listener:o),g=s._events),v=g[a]),v===void 0)v=g[a]=o,++s._eventsCount;else if(typeof v=="function"?v=g[a]=f?[o,v]:[v,o]:f?v.unshift(o):v.push(o),l=b(s),l>0&&v.length>l&&!v.warned){v.warned=!0;var j=new Error("Possible EventEmitter memory leak detected. "+v.length+" "+String(a)+" listeners added. Use emitter.setMaxListeners() to increase limit");j.name="MaxListenersExceededWarning",j.emitter=s,j.type=a,j.count=v.length,u(j)}return s}n.prototype.addListener=function(a,o){return _(this,a,o,!1)},n.prototype.on=n.prototype.addListener,n.prototype.prependListener=function(a,o){return _(this,a,o,!0)};function w(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function O(s,a,o){var f={fired:!1,wrapFn:void 0,target:s,type:a,listener:o},l=w.bind(f);return l.listener=o,f.wrapFn=l,l}n.prototype.once=function(a,o){return h(o),this.on(a,O(this,a,o)),this},n.prototype.prependOnceListener=function(a,o){return h(o),this.prependListener(a,O(this,a,o)),this},n.prototype.removeListener=function(a,o){var f,l,g,v,j;if(h(o),l=this._events,l===void 0)return this;if(f=l[a],f===void 0)return this;if(f===o||f.listener===o)--this._eventsCount===0?this._events=Object.create(null):(delete l[a],l.removeListener&&this.emit("removeListener",a,f.listener||o));else if(typeof f!="function"){for(g=-1,v=f.length-1;v>=0;v--)if(f[v]===o||f[v].listener===o){j=f[v].listener,g=v;break}if(g<0)return this;g===0?f.shift():E(f,g),f.length===1&&(l[a]=f[0]),l.removeListener!==void 0&&this.emit("removeListener",a,j||o)}return this},n.prototype.off=n.prototype.removeListener,n.prototype.removeAllListeners=function(a){var o,f,l;if(f=this._events,f===void 0)return this;if(f.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):f[a]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete f[a]),this;if(arguments.length===0){var g=Object.keys(f),v;for(l=0;l<g.length;++l)v=g[l],v!=="removeListener"&&this.removeAllListeners(v);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(o=f[a],typeof o=="function")this.removeListener(a,o);else if(o!==void 0)for(l=o.length-1;l>=0;l--)this.removeListener(a,o[l]);return this};function L(s,a,o){var f=s._events;if(f===void 0)return[];var l=f[a];return l===void 0?[]:typeof l=="function"?o?[l.listener||l]:[l]:o?S(l):F(l,l.length)}n.prototype.listeners=function(a){return L(this,a,!0)},n.prototype.rawListeners=function(a){return L(this,a,!1)},n.listenerCount=function(s,a){return typeof s.listenerCount=="function"?s.listenerCount(a):P.call(s,a)},n.prototype.listenerCount=P;function P(s){var a=this._events;if(a!==void 0){var o=a[s];if(typeof o=="function")return 1;if(o!==void 0)return o.length}return 0}n.prototype.eventNames=function(){return this._eventsCount>0?r(this._events):[]};function F(s,a){for(var o=new Array(a),f=0;f<a;++f)o[f]=s[f];return o}function E(s,a){for(;a+1<s.length;a++)s[a]=s[a+1];s.pop()}function S(s){for(var a=new Array(s.length),o=0;o<a.length;++o)a[o]=s[o].listener||s[o];return a}function A(s,a){return new Promise(function(o,f){function l(v){s.removeListener(a,g),f(v)}function g(){typeof s.removeListener=="function"&&s.removeListener("error",l),o([].slice.call(arguments))}G(s,a,g,{once:!0}),a!=="error"&&Y(s,l,{once:!0})})}function Y(s,a,o){typeof s.on=="function"&&G(s,"error",a,o)}function G(s,a,o,f){if(typeof s.on=="function")f.once?s.once(a,o):s.on(a,o);else if(typeof s.addEventListener=="function")s.addEventListener(a,function l(g){f.once&&s.removeEventListener(a,l),o(g)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof s)}return B.exports}var Me=Ae();const ke=W(Me);var De=typeof global=="object"&&global&&global.Object===Object&&global,Ie=typeof self=="object"&&self&&self.Object===Object&&self,Q=De||Ie||Function("return this")(),Z=Q.Symbol,de=Object.prototype,Fe=de.hasOwnProperty,We=de.toString,V=Z?Z.toStringTag:void 0;function xe(e){var t=Fe.call(e,V),r=e[V];try{e[V]=void 0;var u=!0}catch{}var c=We.call(e);return u&&(t?e[V]=r:delete e[V]),c}var ze=Object.prototype,Ye=ze.toString;function Ge(e){return Ye.call(e)}var Ue="[object Null]",Ve="[object Undefined]",he=Z?Z.toStringTag:void 0;function pe(e){return e==null?e===void 0?Ve:Ue:he&&he in Object(e)?xe(e):Ge(e)}function He(e){return e!=null&&typeof e=="object"}var Je="[object Symbol]";function Xe(e){return typeof e=="symbol"||He(e)&&pe(e)==Je}var Ke=/\s/;function Be(e){for(var t=e.length;t--&&Ke.test(e.charAt(t)););return t}var Qe=/^\s+/;function Ze(e){return e&&e.slice(0,Be(e)+1).replace(Qe,"")}function x(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var ve=NaN,$e=/^[-+]0x[0-9a-f]+$/i,qe=/^0b[01]+$/i,et=/^0o[0-7]+$/i,tt=parseInt;function me(e){if(typeof e=="number")return e;if(Xe(e))return ve;if(x(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=x(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=Ze(e);var r=qe.test(e);return r||et.test(e)?tt(e.slice(2),r?2:8):$e.test(e)?ve:+e}var rt="[object AsyncFunction]",nt="[object Function]",ot="[object GeneratorFunction]",at="[object Proxy]";function it(e){if(!x(e))return!1;var t=pe(e);return t==nt||t==ot||t==rt||t==at}var ae=Q["__core-js_shared__"],be=function(){var e=/[^.]+$/.exec(ae&&ae.keys&&ae.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function st(e){return!!be&&be in e}var ut=Function.prototype,ft=ut.toString;function ct(e){if(e!=null){try{return ft.call(e)}catch{}try{return e+""}catch{}}return""}var lt=/[\\^$.*+?()[\]{}|]/g,dt=/^\[object .+?Constructor\]$/,ht=Function.prototype,pt=Object.prototype,vt=ht.toString,mt=pt.hasOwnProperty,bt=RegExp("^"+vt.call(mt).replace(lt,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function gt(e){if(!x(e)||st(e))return!1;var t=it(e)?bt:dt;return t.test(ct(e))}function _t(e,t){return e==null?void 0:e[t]}function ge(e,t){var r=_t(e,t);return gt(r)?r:void 0}function Et(e,t){return e===t||e!==e&&t!==t}var H=ge(Object,"create");function yt(){this.__data__=H?H(null):{},this.size=0}function Tt(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var wt="__lodash_hash_undefined__",Ot=Object.prototype,St=Ot.hasOwnProperty;function Rt(e){var t=this.__data__;if(H){var r=t[e];return r===wt?void 0:r}return St.call(t,e)?t[e]:void 0}var Ct=Object.prototype,jt=Ct.hasOwnProperty;function Lt(e){var t=this.__data__;return H?t[e]!==void 0:jt.call(t,e)}var Pt="__lodash_hash_undefined__";function Nt(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=H&&t===void 0?Pt:t,this}function D(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var u=e[t];this.set(u[0],u[1])}}D.prototype.clear=yt,D.prototype.delete=Tt,D.prototype.get=Rt,D.prototype.has=Lt,D.prototype.set=Nt;function At(){this.__data__=[],this.size=0}function $(e,t){for(var r=e.length;r--;)if(Et(e[r][0],t))return r;return-1}var Mt=Array.prototype,kt=Mt.splice;function Dt(e){var t=this.__data__,r=$(t,e);if(r<0)return!1;var u=t.length-1;return r==u?t.pop():kt.call(t,r,1),--this.size,!0}function It(e){var t=this.__data__,r=$(t,e);return r<0?void 0:t[r][1]}function Ft(e){return $(this.__data__,e)>-1}function Wt(e,t){var r=this.__data__,u=$(r,e);return u<0?(++this.size,r.push([e,t])):r[u][1]=t,this}function z(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var u=e[t];this.set(u[0],u[1])}}z.prototype.clear=At,z.prototype.delete=Dt,z.prototype.get=It,z.prototype.has=Ft,z.prototype.set=Wt;var xt=ge(Q,"Map");function zt(){this.size=0,this.__data__={hash:new D,map:new(xt||z),string:new D}}function Yt(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function q(e,t){var r=e.__data__;return Yt(t)?r[typeof t=="string"?"string":"hash"]:r.map}function Gt(e){var t=q(this,e).delete(e);return this.size-=t?1:0,t}function Ut(e){return q(this,e).get(e)}function Vt(e){return q(this,e).has(e)}function Ht(e,t){var r=q(this,e),u=r.size;return r.set(e,t),this.size+=r.size==u?0:1,this}function I(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var u=e[t];this.set(u[0],u[1])}}I.prototype.clear=zt,I.prototype.delete=Gt,I.prototype.get=Ut,I.prototype.has=Vt,I.prototype.set=Ht;var Jt="Expected a function";function ie(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(Jt);var r=function(){var u=arguments,c=t?t.apply(this,u):u[0],n=r.cache;if(n.has(c))return n.get(c);var d=e.apply(this,u);return r.cache=n.set(c,d)||n,d};return r.cache=new(ie.Cache||I),r}ie.Cache=I;var se=function(){return Q.Date.now()},Xt="Expected a function",Kt=Math.max,Bt=Math.min;function ee(e,t,r){var u,c,n,d,h,b,_=0,w=!1,O=!1,L=!0;if(typeof e!="function")throw new TypeError(Xt);t=me(t)||0,x(r)&&(w=!!r.leading,O="maxWait"in r,n=O?Kt(me(r.maxWait)||0,t):n,L="trailing"in r?!!r.trailing:L);function P(o){var f=u,l=c;return u=c=void 0,_=o,d=e.apply(l,f),d}function F(o){return _=o,h=setTimeout(A,t),w?P(o):d}function E(o){var f=o-b,l=o-_,g=t-f;return O?Bt(g,n-l):g}function S(o){var f=o-b,l=o-_;return b===void 0||f>=t||f<0||O&&l>=n}function A(){var o=se();if(S(o))return Y(o);h=setTimeout(A,E(o))}function Y(o){return h=void 0,L&&u?P(o):(u=c=void 0,d)}function G(){h!==void 0&&clearTimeout(h),_=0,u=b=c=h=void 0}function s(){return h===void 0?d:Y(se())}function a(){var o=se(),f=S(o);if(u=arguments,c=this,b=o,f){if(h===void 0)return F(b);if(O)return clearTimeout(h),h=setTimeout(A,t),P(b)}return h===void 0&&(h=setTimeout(A,t)),d}return a.cancel=G,a.flush=s,a}var Qt="Expected a function";function Zt(e,t,r){var u=!0,c=!0;if(typeof e!="function")throw new TypeError(Qt);return x(r)&&(u="leading"in r?!!r.leading:u,c="trailing"in r?!!r.trailing:c),ee(e,t,{leading:u,maxWait:t,trailing:c})}class _e{constructor(t){oe(this,"event",new ke.EventEmitter);oe(this,"data",{});oe(this,"registry",new Set);this.name=t,console.log("[CONTEXT] %s",t),this.event.setMaxListeners(100)}publish(t,r){r!=this.data[t]&&(this.data[t]=r,this.event.emit(String(t),{value:r}))}subscribe(t,r){const u=({value:c})=>{r(c)};return this.event.addListener(String(t),u),console.log("listenerCount:",String(t),this.event.listenerCount(String(t))),t in this.data&&r(this.data[t]),()=>(this.event.removeListener(String(t),u),void 0)}}const Ee=ie(e=>new _e(e)),te=(e="noname")=>m.useMemo(()=>Ee(e),[e]),ye=(e,...t)=>{const r=new Error("[ctx] useRegistryChecker failed "+JSON.stringify({names:t,ctx:(e==null?void 0:e.name)??"undefined"}));m.useEffect(()=>{if(e)return t.some(u=>e.registry.has(u))&&console.error(r),t.forEach(u=>e.registry.add(u)),()=>{t.forEach(u=>e.registry.delete(u))}},[e,t.length])},$t=(e,t,r)=>{m.useEffect(()=>{e&&e.data[t]!=r&&e.publish(t,r)},[t,r,e]),ye(e,t)},qt=(e,t,r=0)=>{const[{value:u},c]=m.useState(()=>{var n;return{value:(n=e==null?void 0:e.data)==null?void 0:n[t]}});return m.useEffect(()=>{if(e){let n=r==0?h=>c({value:h}):ee(h=>c({value:h}),r),d=e.subscribe(t,n);return u!=e.data[t]&&c({value:e.data[t]}),()=>{d()}}},[t,e]),e==null?void 0:e.data[t]},er=(e,t,r)=>{const[,u]=m.useState(0),c=m.useMemo(()=>r(e==null?void 0:e.data[t]),[r,e==null?void 0:e.data[t]]);return m.useEffect(()=>{if(e){let n=c,d=()=>{let b=r(e.data[t]);b!=n&&(n=b,u(_=>_+1))},h=e.subscribe(t,d);return d(),()=>h()}},[t,e]),c},Te=(e,...t)=>{m.useEffect(()=>{if(e)for(let[r,u]of t)e.data[r]!=u&&e.publish(r,u)},[e,...t.flat()]),ye(e,...t.map(r=>r[0]))},tr=(e,...t)=>{const[,r]=m.useState(0),u=t.map(c=>{var n;return(n=e==null?void 0:e.data)==null?void 0:n[c]});return m.useEffect(()=>{if(e){let c=u;const n=ee(()=>{let b=t.map(_=>{var w;return(w=e==null?void 0:e.data)==null?void 0:w[_]});t.some((_,w)=>c[w]!=b[w])&&(c=b,r(_=>_+1))},1);let d=t.map(b=>e.subscribe(b,n)),h=setTimeout(n,1);return()=>{clearTimeout(h),n.cancel(),d.forEach(b=>b())}}},[e,...t]),Object.fromEntries(t.map((c,n)=>[c,u[n]]))},rr=(e,t=100,...r)=>{const[,u]=m.useState(0),c=r.map(n=>{var d;return(d=e==null?void 0:e.data)==null?void 0:d[n]});return m.useEffect(()=>{if(e){let n=c;const d=Zt(()=>{let _=r.map(w=>{var O;return(O=e==null?void 0:e.data)==null?void 0:O[w]});r.some((w,O)=>n[O]!=_[O])&&(n=_,u(w=>w+1))},t);let h=r.map(_=>e.subscribe(_,d)),b=setTimeout(d,1);return()=>{clearTimeout(b),d.cancel(),h.forEach(_=>_())}}},[e,...r]),c};var re={exports:{}},J={};/**
2
2
  * @license React
3
3
  * react-jsx-runtime.production.js
4
4
  *
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
- */var Oe;function nr(){if(Oe)return J;Oe=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function r(u,c,i){var d=null;if(i!==void 0&&(d=""+i),c.key!==void 0&&(d=""+c.key),"key"in c){i={};for(var h in c)h!=="key"&&(i[h]=c[h])}else i=c;return c=i.ref,{$$typeof:e,type:u,key:d,ref:c!==void 0?c:null,props:i}}return J.Fragment=t,J.jsx=r,J.jsxs=r,J}var X={};/**
9
+ */var we;function nr(){if(we)return J;we=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function r(u,c,n){var d=null;if(n!==void 0&&(d=""+n),c.key!==void 0&&(d=""+c.key),"key"in c){n={};for(var h in c)h!=="key"&&(n[h]=c[h])}else n=c;return c=n.ref,{$$typeof:e,type:u,key:d,ref:c!==void 0?c:null,props:n}}return J.Fragment=t,J.jsx=r,J.jsxs=r,J}var X={};/**
10
10
  * @license React
11
11
  * react-jsx-runtime.development.js
12
12
  *
@@ -14,9 +14,9 @@
14
14
  *
15
15
  * This source code is licensed under the MIT license found in the
16
16
  * LICENSE file in the root directory of this source tree.
17
- */var we;function or(){return we||(we=1,process.env.NODE_ENV!=="production"&&function(){function e(a){if(a==null)return null;if(typeof a=="function")return a.$$typeof===v?null:a.displayName||a.name||null;if(typeof a=="string")return a;switch(a){case E:return"Fragment";case A:return"Profiler";case S:return"StrictMode";case o:return"Suspense";case n:return"SuspenseList";case g:return"Activity"}if(typeof a=="object")switch(typeof a.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),a.$$typeof){case F:return"Portal";case U:return(a.displayName||"Context")+".Provider";case G:return(a._context.displayName||"Context")+".Consumer";case s:var p=a.render;return a=a.displayName,a||(a=p.displayName||p.name||"",a=a!==""?"ForwardRef("+a+")":"ForwardRef"),a;case f:return p=a.displayName||null,p!==null?p:e(a.type)||"Memo";case l:p=a._payload,a=a._init;try{return e(a(p))}catch{}}return null}function t(a){return""+a}function r(a){try{t(a);var p=!1}catch{p=!0}if(p){p=console;var T=p.error,R=typeof Symbol=="function"&&Symbol.toStringTag&&a[Symbol.toStringTag]||a.constructor.name||"Object";return T.call(p,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",R),t(a)}}function u(a){if(a===E)return"<>";if(typeof a=="object"&&a!==null&&a.$$typeof===l)return"<...>";try{var p=e(a);return p?"<"+p+">":"<...>"}catch{return"<...>"}}function c(){var a=j.A;return a===null?null:a.getOwner()}function i(){return Error("react-stack-top-frame")}function d(a){if(M.call(a,"key")){var p=Object.getOwnPropertyDescriptor(a,"key").get;if(p&&p.isReactWarning)return!1}return a.key!==void 0}function h(a,p){function T(){Ce||(Ce=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",p))}T.isReactWarning=!0,Object.defineProperty(a,"key",{get:T,configurable:!0})}function b(){var a=e(this.type);return je[a]||(je[a]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),a=this.props.ref,a!==void 0?a:null}function _(a,p,T,R,D,N,ue,fe){return T=N.ref,a={$$typeof:P,type:a,key:p,props:N,_owner:D},(T!==void 0?T:null)!==null?Object.defineProperty(a,"ref",{enumerable:!1,get:b}):Object.defineProperty(a,"ref",{enumerable:!1,value:null}),a._store={},Object.defineProperty(a._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(a,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(a,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:ue}),Object.defineProperty(a,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:fe}),Object.freeze&&(Object.freeze(a.props),Object.freeze(a)),a}function O(a,p,T,R,D,N,ue,fe){var C=p.children;if(C!==void 0)if(R)if(re(C)){for(R=0;R<C.length;R++)w(C[R]);Object.freeze&&Object.freeze(C)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else w(C);if(M.call(p,"key")){C=e(a);var V=Object.keys(p).filter(function(ur){return ur!=="key"});R=0<V.length?"{key: someKey, "+V.join(": ..., ")+": ...}":"{key: someKey}",Ne[C+R]||(V=0<V.length?"{"+V.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
17
+ */var Oe;function or(){return Oe||(Oe=1,process.env.NODE_ENV!=="production"&&function(){function e(i){if(i==null)return null;if(typeof i=="function")return i.$$typeof===v?null:i.displayName||i.name||null;if(typeof i=="string")return i;switch(i){case E:return"Fragment";case A:return"Profiler";case S:return"StrictMode";case a:return"Suspense";case o:return"SuspenseList";case g:return"Activity"}if(typeof i=="object")switch(typeof i.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),i.$$typeof){case F:return"Portal";case G:return(i.displayName||"Context")+".Provider";case Y:return(i._context.displayName||"Context")+".Consumer";case s:var p=i.render;return i=i.displayName,i||(i=p.displayName||p.name||"",i=i!==""?"ForwardRef("+i+")":"ForwardRef"),i;case f:return p=i.displayName||null,p!==null?p:e(i.type)||"Memo";case l:p=i._payload,i=i._init;try{return e(i(p))}catch{}}return null}function t(i){return""+i}function r(i){try{t(i);var p=!1}catch{p=!0}if(p){p=console;var T=p.error,R=typeof Symbol=="function"&&Symbol.toStringTag&&i[Symbol.toStringTag]||i.constructor.name||"Object";return T.call(p,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",R),t(i)}}function u(i){if(i===E)return"<>";if(typeof i=="object"&&i!==null&&i.$$typeof===l)return"<...>";try{var p=e(i);return p?"<"+p+">":"<...>"}catch{return"<...>"}}function c(){var i=j.A;return i===null?null:i.getOwner()}function n(){return Error("react-stack-top-frame")}function d(i){if(M.call(i,"key")){var p=Object.getOwnPropertyDescriptor(i,"key").get;if(p&&p.isReactWarning)return!1}return i.key!==void 0}function h(i,p){function T(){Ce||(Ce=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",p))}T.isReactWarning=!0,Object.defineProperty(i,"key",{get:T,configurable:!0})}function b(){var i=e(this.type);return je[i]||(je[i]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),i=this.props.ref,i!==void 0?i:null}function _(i,p,T,R,k,N,ue,fe){return T=N.ref,i={$$typeof:P,type:i,key:p,props:N,_owner:k},(T!==void 0?T:null)!==null?Object.defineProperty(i,"ref",{enumerable:!1,get:b}):Object.defineProperty(i,"ref",{enumerable:!1,value:null}),i._store={},Object.defineProperty(i._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(i,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(i,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:ue}),Object.defineProperty(i,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:fe}),Object.freeze&&(Object.freeze(i.props),Object.freeze(i)),i}function w(i,p,T,R,k,N,ue,fe){var C=p.children;if(C!==void 0)if(R)if(ne(C)){for(R=0;R<C.length;R++)O(C[R]);Object.freeze&&Object.freeze(C)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else O(C);if(M.call(p,"key")){C=e(i);var U=Object.keys(p).filter(function(ur){return ur!=="key"});R=0<U.length?"{key: someKey, "+U.join(": ..., ")+": ...}":"{key: someKey}",Ne[C+R]||(U=0<U.length?"{"+U.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
18
18
  let props = %s;
19
19
  <%s {...props} />
20
20
  React keys must be passed directly to JSX without using spread:
21
21
  let props = %s;
22
- <%s key={someKey} {...props} />`,R,C,V,C),Ne[C+R]=!0)}if(C=null,T!==void 0&&(r(T),C=""+T),d(p)&&(r(p.key),C=""+p.key),"key"in p){T={};for(var ce in p)ce!=="key"&&(T[ce]=p[ce])}else T=p;return C&&h(T,typeof a=="function"?a.displayName||a.name||"Unknown":a),_(a,C,N,D,c(),T,ue,fe)}function w(a){typeof a=="object"&&a!==null&&a.$$typeof===P&&a._store&&(a._store.validated=1)}var L=m,P=Symbol.for("react.transitional.element"),F=Symbol.for("react.portal"),E=Symbol.for("react.fragment"),S=Symbol.for("react.strict_mode"),A=Symbol.for("react.profiler"),G=Symbol.for("react.consumer"),U=Symbol.for("react.context"),s=Symbol.for("react.forward_ref"),o=Symbol.for("react.suspense"),n=Symbol.for("react.suspense_list"),f=Symbol.for("react.memo"),l=Symbol.for("react.lazy"),g=Symbol.for("react.activity"),v=Symbol.for("react.client.reference"),j=L.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,M=Object.prototype.hasOwnProperty,re=Array.isArray,K=console.createTask?console.createTask:function(){return null};L={"react-stack-bottom-frame":function(a){return a()}};var Ce,je={},Le=L["react-stack-bottom-frame"].bind(L,i)(),Pe=K(u(i)),Ne={};X.Fragment=E,X.jsx=function(a,p,T,R,D){var N=1e4>j.recentlyCreatedOwnerStacks++;return O(a,p,T,!1,R,D,N?Error("react-stack-top-frame"):Le,N?K(u(a)):Pe)},X.jsxs=function(a,p,T,R,D){var N=1e4>j.recentlyCreatedOwnerStacks++;return O(a,p,T,!0,R,D,N?Error("react-stack-top-frame"):Le,N?K(u(a)):Pe)}}()),X}var Se;function ar(){return Se||(Se=1,process.env.NODE_ENV==="production"?te.exports=nr():te.exports=or()),te.exports}var Re=ar();const ir=(e,t)=>{const r=c=>[e,...Object.entries(c??{}).sort((i,d)=>i[0].localeCompare(d[0])).flat()].join("-");let u=!1;return{Root:c=>{const i=se(r(c)),d=t(c),h=m.useMemo(()=>new Error().stack,[]);return Te(i,...Object.entries(d)),m.useEffect(()=>{if(u==!0){const b=new Error("RootContext "+r(c)+" are mounted more than once");throw b.stack=h,b}return u=!0,()=>{u=!1}}),Re.jsx(Re.Fragment,{})},useCtxState:c=>{const i=m.useMemo(()=>new Error().stack,[]);return m.useEffect(()=>{if(!u){const d=new Error("RootContext ["+r(c)+"] is not mounted");throw d.stack=i,d}},[u]),se(r(c))}}},sr=e=>{const[,t]=m.useState(0),{proxy:r,finalGetter:u,openGetter:c,clean:i}=m.useMemo(()=>{const d=new Set,h={},b=new Map,_=new Proxy(e==null?void 0:e.data,{get(E,S){if(O)return d.add(S),h[S]=E[S];throw new Error("now allow here")}});let O=!0,w=ee(()=>{[...d.values()].some(E=>{var S;return h[E]!=((S=e==null?void 0:e.data)==null?void 0:S[E])})&&t(E=>E+1)},0),L=()=>{O=!0,d.clear()},P=()=>{O=!1,[...d.values()].filter(E=>!b.has(E)).forEach(E=>{b.set(E,e==null?void 0:e.subscribe(E,w))}),[...b.keys()].filter(E=>!d.has(E)).forEach(E=>{let S=b.get(E);S==null||S(),b.delete(E)})};return{proxy:_,finalGetter:P,openGetter:L,clean:()=>{L(),P(),t(E=>E+1)}}},[]);return c(),setTimeout(u,0),m.useEffect(()=>()=>i(),[i]),r};y.Context=_e,y.createRootCtx=ir,y.getContext=Ee,y.useDataContext=se,y.useDataSource=$t,y.useDataSourceMultiple=Te,y.useDataSubscribe=qt,y.useDataSubscribeMultiple=tr,y.useDataSubscribeMultipleWithDebounce=rr,y.useDataSubscribeWithTransform=er,y.useQuickSubscribe=sr,Object.defineProperty(y,Symbol.toStringTag,{value:"Module"})});
22
+ <%s key={someKey} {...props} />`,R,C,U,C),Ne[C+R]=!0)}if(C=null,T!==void 0&&(r(T),C=""+T),d(p)&&(r(p.key),C=""+p.key),"key"in p){T={};for(var ce in p)ce!=="key"&&(T[ce]=p[ce])}else T=p;return C&&h(T,typeof i=="function"?i.displayName||i.name||"Unknown":i),_(i,C,N,k,c(),T,ue,fe)}function O(i){typeof i=="object"&&i!==null&&i.$$typeof===P&&i._store&&(i._store.validated=1)}var L=m,P=Symbol.for("react.transitional.element"),F=Symbol.for("react.portal"),E=Symbol.for("react.fragment"),S=Symbol.for("react.strict_mode"),A=Symbol.for("react.profiler"),Y=Symbol.for("react.consumer"),G=Symbol.for("react.context"),s=Symbol.for("react.forward_ref"),a=Symbol.for("react.suspense"),o=Symbol.for("react.suspense_list"),f=Symbol.for("react.memo"),l=Symbol.for("react.lazy"),g=Symbol.for("react.activity"),v=Symbol.for("react.client.reference"),j=L.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,M=Object.prototype.hasOwnProperty,ne=Array.isArray,K=console.createTask?console.createTask:function(){return null};L={"react-stack-bottom-frame":function(i){return i()}};var Ce,je={},Le=L["react-stack-bottom-frame"].bind(L,n)(),Pe=K(u(n)),Ne={};X.Fragment=E,X.jsx=function(i,p,T,R,k){var N=1e4>j.recentlyCreatedOwnerStacks++;return w(i,p,T,!1,R,k,N?Error("react-stack-top-frame"):Le,N?K(u(i)):Pe)},X.jsxs=function(i,p,T,R,k){var N=1e4>j.recentlyCreatedOwnerStacks++;return w(i,p,T,!0,R,k,N?Error("react-stack-top-frame"):Le,N?K(u(i)):Pe)}}()),X}var Se;function ar(){return Se||(Se=1,process.env.NODE_ENV==="production"?re.exports=nr():re.exports=or()),re.exports}var Re=ar();const ir=(e,t)=>{const r=c=>[e,...Object.entries(c??{}).sort((n,d)=>n[0].localeCompare(d[0])).flat()].join("-");let u=new Set;return{Root:c=>{const n=r(c),d=te(n),h=t(c),b=m.useMemo(()=>new Error().stack,[]);return Te(d,...Object.entries(h)),m.useEffect(()=>{if(u.has(n)){const _=new Error("RootContext "+n+" are mounted more than once");throw _.stack=b,_}return u.add(n),()=>{u.delete(n)}}),Re.jsx(Re.Fragment,{})},useCtxStateStrict:c=>{const n=r(c),d=m.useMemo(()=>new Error().stack,[]);return m.useEffect(()=>{if(!u.has(n)){const h=new Error("RootContext ["+n+"] is not mounted");throw h.stack=d,h}},[n]),te(n)},useCtxState:c=>{const n=r(c),d=m.useMemo(()=>new Error().stack,[]);return m.useEffect(()=>{if(!u.has(n)){const h=new Error("RootContext ["+n+"] is not mounted");h.stack=d;let b=setTimeout(()=>console.error(h),1e3);return()=>clearTimeout(b)}},[u.has(n)]),te(n)}}},sr=e=>{const[,t]=m.useState(0),{proxy:r,finalGetter:u,openGetter:c,clean:n}=m.useMemo(()=>{const d=new Set,h={},b=new Map,_=new Proxy(e==null?void 0:e.data,{get(E,S){if(w)return d.add(S),h[S]=E[S];throw new Error("now allow here")}});let w=!0,O=ee(()=>{[...d.values()].some(E=>{var S;return h[E]!=((S=e==null?void 0:e.data)==null?void 0:S[E])})&&t(E=>E+1)},0),L=()=>{w=!0,d.clear()},P=()=>{w=!1,[...d.values()].filter(E=>!b.has(E)).forEach(E=>{b.set(E,e==null?void 0:e.subscribe(E,O))}),[...b.keys()].filter(E=>!d.has(E)).forEach(E=>{let S=b.get(E);S==null||S(),b.delete(E)})};return{proxy:_,finalGetter:P,openGetter:L,clean:()=>{L(),P(),t(E=>E+1)}}},[]);return c(),setTimeout(u,0),m.useEffect(()=>()=>n(),[n]),r};y.Context=_e,y.createRootCtx=ir,y.getContext=Ee,y.useDataContext=te,y.useDataSource=$t,y.useDataSourceMultiple=Te,y.useDataSubscribe=qt,y.useDataSubscribeMultiple=tr,y.useDataSubscribeMultipleWithDebounce=rr,y.useDataSubscribeWithTransform=er,y.useQuickSubscribe=sr,Object.defineProperty(y,Symbol.toStringTag,{value:"Module"})});
@@ -1,5 +1,6 @@
1
1
  import { Context } from './ctx';
2
2
  export declare const createRootCtx: <U extends object, V extends object>(name: string, useFn: (e: U) => V) => {
3
3
  Root: (e: U) => import("react/jsx-runtime").JSX.Element;
4
+ useCtxStateStrict: (e: U) => Context<V>;
4
5
  useCtxState: (e: U) => Context<V>;
5
6
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-state-custom",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "A React library built with Vite and TypeScript",
5
5
  "type": "module",
6
6
  "main": "dist/index.umd.js",
@@ -13,11 +13,12 @@ export const createRootCtx = <U extends object, V extends object>(name: string,
13
13
  .flat()
14
14
  ].join("-")
15
15
 
16
- let isCtxMounted = false
16
+ let ctxMountedCheck = new Set<string>()
17
17
 
18
18
  return {
19
19
  Root: (e: U) => {
20
- const ctx = useDataContext<V>(resolveCtxName(e))
20
+ const ctxName = resolveCtxName(e)
21
+ const ctx = useDataContext<V>(ctxName)
21
22
  const state = useFn(e)
22
23
  const stack = useMemo(() => new Error().stack, [])
23
24
 
@@ -27,30 +28,47 @@ export const createRootCtx = <U extends object, V extends object>(name: string,
27
28
  )
28
29
 
29
30
  useEffect(() => {
30
- if (isCtxMounted == true) {
31
- const err = new Error("RootContext " + resolveCtxName(e) + " are mounted more than once")
31
+ if (ctxMountedCheck.has(ctxName)) {
32
+ const err = new Error("RootContext " + ctxName + " are mounted more than once")
32
33
  err.stack = stack;
33
34
  throw err
34
35
  }
35
- isCtxMounted = true;
36
- return () => { isCtxMounted = false };
36
+ ctxMountedCheck.add(ctxName)
37
+ return () => { ctxMountedCheck.delete(ctxName) };
37
38
  })
38
39
 
39
40
  return <></>
40
41
  },
41
- useCtxState: (e: U): Context<V> => {
42
+ useCtxStateStrict: (e: U): Context<V> => {
43
+ const ctxName = resolveCtxName(e)
42
44
 
43
45
  const stack = useMemo(() => new Error().stack, [])
44
46
 
45
47
  useEffect(() => {
46
- if (!isCtxMounted) {
47
- const err = new Error("RootContext [" + resolveCtxName(e) + "] is not mounted")
48
+ if (!ctxMountedCheck.has(ctxName)) {
49
+ const err = new Error("RootContext [" + ctxName + "] is not mounted")
48
50
  err.stack = stack;
49
51
  throw err
50
52
  }
51
- }, [isCtxMounted])
53
+ }, [ctxName])
54
+
55
+ return useDataContext<V>(ctxName)
56
+ },
57
+ useCtxState: (e: U): Context<V> => {
58
+ const ctxName = resolveCtxName(e)
59
+
60
+ const stack = useMemo(() => new Error().stack, [])
61
+
62
+ useEffect(() => {
63
+ if (!ctxMountedCheck.has(ctxName)) {
64
+ const err = new Error("RootContext [" + ctxName + "] is not mounted")
65
+ err.stack = stack;
66
+ let timeout = setTimeout(() => console.error(err), 1000)
67
+ return () => clearTimeout(timeout)
68
+ }
69
+ }, [ctxMountedCheck.has(ctxName)])
52
70
 
53
- return useDataContext<V>(resolveCtxName(e))
71
+ return useDataContext<V>(ctxName)
54
72
  }
55
73
  }
56
74
  }