@drincs/pixi-vn 1.4.2 → 1.4.4

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/storage.cjs CHANGED
@@ -1 +1 @@
1
- 'use strict';var unifier=require('@drincs/pixi-vn/unifier');var Jt=Object.defineProperty;var Yt=l=>{throw TypeError(l)};var Qt=(l,t,i)=>t in l?Jt(l,t,{enumerable:true,configurable:true,writable:true,value:i}):l[t]=i;var m=(l,t,i)=>Qt(l,typeof t!="symbol"?t+"":t,i),Mt=(l,t,i)=>t.has(l)||Yt("Cannot "+i);var e=(l,t,i)=>(Mt(l,t,"read from private field"),i?i.call(l):t.get(l)),_=(l,t,i)=>t.has(l)?Yt("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(l):t.set(l,i),f=(l,t,i,s)=>(Mt(l,t,"write to private field"),t.set(l,i),i),h=(l,t,i)=>(Mt(l,t,"access private method"),i);var Ft=(l,t,i,s)=>({set _(n){f(l,t,n);},get _(){return e(l,t,s)}});var at;(n=>(n.log=(a,...r)=>console.log(`[Pixi\u2019VN] ${a}`,...r),n.warn=(a,...r)=>console.warn(`[Pixi\u2019VN] ${a}`,...r),n.error=(a,...r)=>console.error(`[Pixi\u2019VN] ${a}`,...r),n.info=(a,...r)=>console.info(`[Pixi\u2019VN] ${a}`,...r)))(at||(at={}));function Dt(l){try{if(typeof l>"u")return l;let t=JSON.stringify(l);return JSON.parse(t)}catch(t){throw at.error("Error creating exportable element",l,t),new Error("[Pixi\u2019VN] Error creating exportable element")}}var Zt=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,$t=new Set,Lt=typeof process=="object"&&process?process:{},Bt=(l,t,i,s)=>{typeof Lt.emitWarning=="function"?Lt.emitWarning(l,t,i,s):console.error(`[${i}] ${t}: ${l}`);},xt=globalThis.AbortController,jt=globalThis.AbortSignal;if(typeof xt>"u"){jt=class{constructor(){m(this,"onabort");m(this,"_onabort",[]);m(this,"reason");m(this,"aborted",false);}addEventListener(s,n){this._onabort.push(n);}},xt=class{constructor(){m(this,"signal",new jt);t();}abort(s){if(!this.signal.aborted){this.signal.reason=s,this.signal.aborted=true;for(let n of this.signal._onabort)n(s);this.signal.onabort?.(s);}}};let l=Lt.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",t=()=>{l&&(l=false,Bt("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",t));};}var kt=l=>!$t.has(l);var et=l=>l&&l===Math.floor(l)&&l>0&&isFinite(l),Xt=l=>et(l)?l<=Math.pow(2,8)?Uint8Array:l<=Math.pow(2,16)?Uint16Array:l<=Math.pow(2,32)?Uint32Array:l<=Number.MAX_SAFE_INTEGER?pt:null:null,pt=class extends Array{constructor(t){super(t),this.fill(0);}},_t,ot=class ot{constructor(t,i){m(this,"heap");m(this,"length");if(!e(ot,_t))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new i(t),this.length=0;}static create(t){let i=Xt(t);if(!i)return [];f(ot,_t,true);let s=new ot(t,i);return f(ot,_t,false),s}push(t){this.heap[this.length++]=t;}pop(){return this.heap[--this.length]}};_t=new WeakMap,_(ot,_t,false);var Nt=ot,Kt,Ht,j,N,K,ht,H,mt,St,$,F,B,R,w,d,I,G,z,D,X,v,q,J,U,V,Q,rt,C,Et,o,Gt,lt,k,Tt,W,qt,ft,bt,At,it,st,Ut,vt,zt,b,Vt,yt,nt,Wt,Pt=class Pt{constructor(t){_(this,o);_(this,j);_(this,N);_(this,K);_(this,ht);_(this,H);_(this,mt);_(this,St);_(this,$);m(this,"ttl");m(this,"ttlResolution");m(this,"ttlAutopurge");m(this,"updateAgeOnGet");m(this,"updateAgeOnHas");m(this,"allowStale");m(this,"noDisposeOnSet");m(this,"noUpdateTTL");m(this,"maxEntrySize");m(this,"sizeCalculation");m(this,"noDeleteOnFetchRejection");m(this,"noDeleteOnStaleGet");m(this,"allowStaleOnFetchAbort");m(this,"allowStaleOnFetchRejection");m(this,"ignoreFetchAbort");_(this,F);_(this,B);_(this,R);_(this,w);_(this,d);_(this,I);_(this,G);_(this,z);_(this,D);_(this,X);_(this,v);_(this,q);_(this,J);_(this,U);_(this,V);_(this,Q);_(this,rt);_(this,C);_(this,Et);_(this,lt,()=>{});_(this,k,()=>{});_(this,Tt,()=>{});_(this,W,()=>false);_(this,ft,t=>{});_(this,bt,(t,i,s)=>{});_(this,At,(t,i,s,n)=>{if(s||n)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});m(this,Kt,"LRUCache");let{max:i=0,ttl:s,ttlResolution:n=1,ttlAutopurge:a,updateAgeOnGet:r,updateAgeOnHas:c,allowStale:u,dispose:S,onInsert:M,disposeAfter:y,noDisposeOnSet:tt,noUpdateTTL:P,maxSize:Z=0,maxEntrySize:T=0,sizeCalculation:E,fetchMethod:p,memoMethod:x,noDeleteOnFetchRejection:L,noDeleteOnStaleGet:O,allowStaleOnFetchRejection:Y,allowStaleOnFetchAbort:wt,ignoreFetchAbort:ut,perf:Rt}=t;if(Rt!==void 0&&typeof Rt?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(f(this,$,Rt??Zt),i!==0&&!et(i))throw new TypeError("max option must be a nonnegative integer");let dt=i?Xt(i):Array;if(!dt)throw new Error("invalid max value: "+i);if(f(this,j,i),f(this,N,Z),this.maxEntrySize=T||e(this,N),this.sizeCalculation=E,this.sizeCalculation){if(!e(this,N)&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(x!==void 0&&typeof x!="function")throw new TypeError("memoMethod must be a function if defined");if(f(this,St,x),p!==void 0&&typeof p!="function")throw new TypeError("fetchMethod must be a function if specified");if(f(this,mt,p),f(this,rt,!!p),f(this,R,new Map),f(this,w,new Array(i).fill(void 0)),f(this,d,new Array(i).fill(void 0)),f(this,I,new dt(i)),f(this,G,new dt(i)),f(this,z,0),f(this,D,0),f(this,X,Nt.create(i)),f(this,F,0),f(this,B,0),typeof S=="function"&&f(this,K,S),typeof M=="function"&&f(this,ht,M),typeof y=="function"?(f(this,H,y),f(this,v,[])):(f(this,H,void 0),f(this,v,void 0)),f(this,Q,!!e(this,K)),f(this,Et,!!e(this,ht)),f(this,C,!!e(this,H)),this.noDisposeOnSet=!!tt,this.noUpdateTTL=!!P,this.noDeleteOnFetchRejection=!!L,this.allowStaleOnFetchRejection=!!Y,this.allowStaleOnFetchAbort=!!wt,this.ignoreFetchAbort=!!ut,this.maxEntrySize!==0){if(e(this,N)!==0&&!et(e(this,N)))throw new TypeError("maxSize must be a positive integer if specified");if(!et(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");h(this,o,qt).call(this);}if(this.allowStale=!!u,this.noDeleteOnStaleGet=!!O,this.updateAgeOnGet=!!r,this.updateAgeOnHas=!!c,this.ttlResolution=et(n)||n===0?n:1,this.ttlAutopurge=!!a,this.ttl=s||0,this.ttl){if(!et(this.ttl))throw new TypeError("ttl must be a positive integer if specified");h(this,o,Gt).call(this);}if(e(this,j)===0&&this.ttl===0&&e(this,N)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!e(this,j)&&!e(this,N)){let gt="LRU_CACHE_UNBOUNDED";kt(gt)&&($t.add(gt),Bt("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",gt,Pt));}}get perf(){return e(this,$)}static unsafeExposeInternals(t){return {starts:e(t,J),ttls:e(t,U),autopurgeTimers:e(t,V),sizes:e(t,q),keyMap:e(t,R),keyList:e(t,w),valList:e(t,d),next:e(t,I),prev:e(t,G),get head(){return e(t,z)},get tail(){return e(t,D)},free:e(t,X),isBackgroundFetch:i=>{var s;return h(s=t,o,b).call(s,i)},backgroundFetch:(i,s,n,a)=>{var r;return h(r=t,o,zt).call(r,i,s,n,a)},moveToTail:i=>{var s;return h(s=t,o,yt).call(s,i)},indexes:i=>{var s;return h(s=t,o,it).call(s,i)},rindexes:i=>{var s;return h(s=t,o,st).call(s,i)},isStale:i=>{var s;return e(s=t,W).call(s,i)}}}get max(){return e(this,j)}get maxSize(){return e(this,N)}get calculatedSize(){return e(this,B)}get size(){return e(this,F)}get fetchMethod(){return e(this,mt)}get memoMethod(){return e(this,St)}get dispose(){return e(this,K)}get onInsert(){return e(this,ht)}get disposeAfter(){return e(this,H)}getRemainingTTL(t){return e(this,R).has(t)?1/0:0}*entries(){for(let t of h(this,o,it).call(this))e(this,d)[t]!==void 0&&e(this,w)[t]!==void 0&&!h(this,o,b).call(this,e(this,d)[t])&&(yield [e(this,w)[t],e(this,d)[t]]);}*rentries(){for(let t of h(this,o,st).call(this))e(this,d)[t]!==void 0&&e(this,w)[t]!==void 0&&!h(this,o,b).call(this,e(this,d)[t])&&(yield [e(this,w)[t],e(this,d)[t]]);}*keys(){for(let t of h(this,o,it).call(this)){let i=e(this,w)[t];i!==void 0&&!h(this,o,b).call(this,e(this,d)[t])&&(yield i);}}*rkeys(){for(let t of h(this,o,st).call(this)){let i=e(this,w)[t];i!==void 0&&!h(this,o,b).call(this,e(this,d)[t])&&(yield i);}}*values(){for(let t of h(this,o,it).call(this))e(this,d)[t]!==void 0&&!h(this,o,b).call(this,e(this,d)[t])&&(yield e(this,d)[t]);}*rvalues(){for(let t of h(this,o,st).call(this))e(this,d)[t]!==void 0&&!h(this,o,b).call(this,e(this,d)[t])&&(yield e(this,d)[t]);}[(Ht=Symbol.iterator,Kt=Symbol.toStringTag,Ht)](){return this.entries()}find(t,i={}){for(let s of h(this,o,it).call(this)){let n=e(this,d)[s],a=h(this,o,b).call(this,n)?n.__staleWhileFetching:n;if(a!==void 0&&t(a,e(this,w)[s],this))return this.get(e(this,w)[s],i)}}forEach(t,i=this){for(let s of h(this,o,it).call(this)){let n=e(this,d)[s],a=h(this,o,b).call(this,n)?n.__staleWhileFetching:n;a!==void 0&&t.call(i,a,e(this,w)[s],this);}}rforEach(t,i=this){for(let s of h(this,o,st).call(this)){let n=e(this,d)[s],a=h(this,o,b).call(this,n)?n.__staleWhileFetching:n;a!==void 0&&t.call(i,a,e(this,w)[s],this);}}purgeStale(){let t=false;for(let i of h(this,o,st).call(this,{allowStale:true}))e(this,W).call(this,i)&&(h(this,o,nt).call(this,e(this,w)[i],"expire"),t=true);return t}info(t){let i=e(this,R).get(t);if(i===void 0)return;let s=e(this,d)[i],n=h(this,o,b).call(this,s)?s.__staleWhileFetching:s;if(n===void 0)return;let a={value:n};if(e(this,U)&&e(this,J)){let r=e(this,U)[i],c=e(this,J)[i];if(r&&c){let u=r-(e(this,$).now()-c);a.ttl=u,a.start=Date.now();}}return e(this,q)&&(a.size=e(this,q)[i]),a}dump(){let t=[];for(let i of h(this,o,it).call(this,{allowStale:true})){let s=e(this,w)[i],n=e(this,d)[i],a=h(this,o,b).call(this,n)?n.__staleWhileFetching:n;if(a===void 0||s===void 0)continue;let r={value:a};if(e(this,U)&&e(this,J)){r.ttl=e(this,U)[i];let c=e(this,$).now()-e(this,J)[i];r.start=Math.floor(Date.now()-c);}e(this,q)&&(r.size=e(this,q)[i]),t.unshift([s,r]);}return t}load(t){this.clear();for(let[i,s]of t){if(s.start){let n=Date.now()-s.start;s.start=e(this,$).now()-n;}this.set(i,s.value,s);}}set(t,i,s={}){var tt,P,Z,T;if(i===void 0)return this.delete(t),this;let{ttl:n=this.ttl,start:a,noDisposeOnSet:r=this.noDisposeOnSet,sizeCalculation:c=this.sizeCalculation,status:u}=s,{noUpdateTTL:S=this.noUpdateTTL}=s,M=e(this,At).call(this,t,i,s.size||0,c);if(this.maxEntrySize&&M>this.maxEntrySize)return u&&(u.set="miss",u.maxEntrySizeExceeded=true),h(this,o,nt).call(this,t,"set"),this;let y=e(this,F)===0?void 0:e(this,R).get(t);if(y===void 0)y=e(this,F)===0?e(this,D):e(this,X).length!==0?e(this,X).pop():e(this,F)===e(this,j)?h(this,o,vt).call(this,false):e(this,F),e(this,w)[y]=t,e(this,d)[y]=i,e(this,R).set(t,y),e(this,I)[e(this,D)]=y,e(this,G)[y]=e(this,D),f(this,D,y),Ft(this,F)._++,e(this,bt).call(this,y,M,u),u&&(u.set="add"),S=false,e(this,Et)&&((tt=e(this,ht))==null||tt.call(this,i,t,"add"));else {h(this,o,yt).call(this,y);let E=e(this,d)[y];if(i!==E){if(e(this,rt)&&h(this,o,b).call(this,E)){E.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:p}=E;p!==void 0&&!r&&(e(this,Q)&&((P=e(this,K))==null||P.call(this,p,t,"set")),e(this,C)&&e(this,v)?.push([p,t,"set"]));}else r||(e(this,Q)&&((Z=e(this,K))==null||Z.call(this,E,t,"set")),e(this,C)&&e(this,v)?.push([E,t,"set"]));if(e(this,ft).call(this,y),e(this,bt).call(this,y,M,u),e(this,d)[y]=i,u){u.set="replace";let p=E&&h(this,o,b).call(this,E)?E.__staleWhileFetching:E;p!==void 0&&(u.oldValue=p);}}else u&&(u.set="update");e(this,Et)&&this.onInsert?.(i,t,i===E?"update":"replace");}if(n!==0&&!e(this,U)&&h(this,o,Gt).call(this),e(this,U)&&(S||e(this,Tt).call(this,y,n,a),u&&e(this,k).call(this,u,y)),!r&&e(this,C)&&e(this,v)){let E=e(this,v),p;for(;p=E?.shift();)(T=e(this,H))==null||T.call(this,...p);}return this}pop(){var t;try{for(;e(this,F);){let i=e(this,d)[e(this,z)];if(h(this,o,vt).call(this,!0),h(this,o,b).call(this,i)){if(i.__staleWhileFetching)return i.__staleWhileFetching}else if(i!==void 0)return i}}finally{if(e(this,C)&&e(this,v)){let i=e(this,v),s;for(;s=i?.shift();)(t=e(this,H))==null||t.call(this,...s);}}}has(t,i={}){let{updateAgeOnHas:s=this.updateAgeOnHas,status:n}=i,a=e(this,R).get(t);if(a!==void 0){let r=e(this,d)[a];if(h(this,o,b).call(this,r)&&r.__staleWhileFetching===void 0)return false;if(e(this,W).call(this,a))n&&(n.has="stale",e(this,k).call(this,n,a));else return s&&e(this,lt).call(this,a),n&&(n.has="hit",e(this,k).call(this,n,a)),true}else n&&(n.has="miss");return false}peek(t,i={}){let{allowStale:s=this.allowStale}=i,n=e(this,R).get(t);if(n===void 0||!s&&e(this,W).call(this,n))return;let a=e(this,d)[n];return h(this,o,b).call(this,a)?a.__staleWhileFetching:a}async fetch(t,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:n=this.updateAgeOnGet,noDeleteOnStaleGet:a=this.noDeleteOnStaleGet,ttl:r=this.ttl,noDisposeOnSet:c=this.noDisposeOnSet,size:u=0,sizeCalculation:S=this.sizeCalculation,noUpdateTTL:M=this.noUpdateTTL,noDeleteOnFetchRejection:y=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:tt=this.allowStaleOnFetchRejection,ignoreFetchAbort:P=this.ignoreFetchAbort,allowStaleOnFetchAbort:Z=this.allowStaleOnFetchAbort,context:T,forceRefresh:E=false,status:p,signal:x}=i;if(!e(this,rt))return p&&(p.fetch="get"),this.get(t,{allowStale:s,updateAgeOnGet:n,noDeleteOnStaleGet:a,status:p});let L={allowStale:s,updateAgeOnGet:n,noDeleteOnStaleGet:a,ttl:r,noDisposeOnSet:c,size:u,sizeCalculation:S,noUpdateTTL:M,noDeleteOnFetchRejection:y,allowStaleOnFetchRejection:tt,allowStaleOnFetchAbort:Z,ignoreFetchAbort:P,status:p,signal:x},O=e(this,R).get(t);if(O===void 0){p&&(p.fetch="miss");let Y=h(this,o,zt).call(this,t,O,L,T);return Y.__returned=Y}else {let Y=e(this,d)[O];if(h(this,o,b).call(this,Y)){let gt=s&&Y.__staleWhileFetching!==void 0;return p&&(p.fetch="inflight",gt&&(p.returnedStale=true)),gt?Y.__staleWhileFetching:Y.__returned=Y}let wt=e(this,W).call(this,O);if(!E&&!wt)return p&&(p.fetch="hit"),h(this,o,yt).call(this,O),n&&e(this,lt).call(this,O),p&&e(this,k).call(this,p,O),Y;let ut=h(this,o,zt).call(this,t,O,L,T),dt=ut.__staleWhileFetching!==void 0&&s;return p&&(p.fetch=wt?"stale":"refresh",dt&&wt&&(p.returnedStale=true)),dt?ut.__staleWhileFetching:ut.__returned=ut}}async forceFetch(t,i={}){let s=await this.fetch(t,i);if(s===void 0)throw new Error("fetch() returned undefined");return s}memo(t,i={}){let s=e(this,St);if(!s)throw new Error("no memoMethod provided to constructor");let{context:n,forceRefresh:a,...r}=i,c=this.get(t,r);if(!a&&c!==void 0)return c;let u=s(t,c,{options:r,context:n});return this.set(t,u,r),u}get(t,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:n=this.updateAgeOnGet,noDeleteOnStaleGet:a=this.noDeleteOnStaleGet,status:r}=i,c=e(this,R).get(t);if(c!==void 0){let u=e(this,d)[c],S=h(this,o,b).call(this,u);return r&&e(this,k).call(this,r,c),e(this,W).call(this,c)?(r&&(r.get="stale"),S?(r&&s&&u.__staleWhileFetching!==void 0&&(r.returnedStale=true),s?u.__staleWhileFetching:void 0):(a||h(this,o,nt).call(this,t,"expire"),r&&s&&(r.returnedStale=true),s?u:void 0)):(r&&(r.get="hit"),S?u.__staleWhileFetching:(h(this,o,yt).call(this,c),n&&e(this,lt).call(this,c),u))}else r&&(r.get="miss");}delete(t){return h(this,o,nt).call(this,t,"delete")}clear(){return h(this,o,Wt).call(this,"delete")}};j=new WeakMap,N=new WeakMap,K=new WeakMap,ht=new WeakMap,H=new WeakMap,mt=new WeakMap,St=new WeakMap,$=new WeakMap,F=new WeakMap,B=new WeakMap,R=new WeakMap,w=new WeakMap,d=new WeakMap,I=new WeakMap,G=new WeakMap,z=new WeakMap,D=new WeakMap,X=new WeakMap,v=new WeakMap,q=new WeakMap,J=new WeakMap,U=new WeakMap,V=new WeakMap,Q=new WeakMap,rt=new WeakMap,C=new WeakMap,Et=new WeakMap,o=new WeakSet,Gt=function(){let t=new pt(e(this,j)),i=new pt(e(this,j));f(this,U,t),f(this,J,i);let s=this.ttlAutopurge?new Array(e(this,j)):void 0;f(this,V,s),f(this,Tt,(r,c,u=e(this,$).now())=>{if(i[r]=c!==0?u:0,t[r]=c,s?.[r]&&(clearTimeout(s[r]),s[r]=void 0),c!==0&&s){let S=setTimeout(()=>{e(this,W).call(this,r)&&h(this,o,nt).call(this,e(this,w)[r],"expire");},c+1);S.unref&&S.unref(),s[r]=S;}}),f(this,lt,r=>{i[r]=t[r]!==0?e(this,$).now():0;}),f(this,k,(r,c)=>{if(t[c]){let u=t[c],S=i[c];if(!u||!S)return;r.ttl=u,r.start=S,r.now=n||a();let M=r.now-S;r.remainingTTL=u-M;}});let n=0,a=()=>{let r=e(this,$).now();if(this.ttlResolution>0){n=r;let c=setTimeout(()=>n=0,this.ttlResolution);c.unref&&c.unref();}return r};this.getRemainingTTL=r=>{let c=e(this,R).get(r);if(c===void 0)return 0;let u=t[c],S=i[c];if(!u||!S)return 1/0;let M=(n||a())-S;return u-M},f(this,W,r=>{let c=i[r],u=t[r];return !!u&&!!c&&(n||a())-c>u});},lt=new WeakMap,k=new WeakMap,Tt=new WeakMap,W=new WeakMap,qt=function(){let t=new pt(e(this,j));f(this,B,0),f(this,q,t),f(this,ft,i=>{f(this,B,e(this,B)-t[i]),t[i]=0;}),f(this,At,(i,s,n,a)=>{if(h(this,o,b).call(this,s))return 0;if(!et(n))if(a){if(typeof a!="function")throw new TypeError("sizeCalculation must be a function");if(n=a(s,i),!et(n))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return n}),f(this,bt,(i,s,n)=>{if(t[i]=s,e(this,N)){let a=e(this,N)-t[i];for(;e(this,B)>a;)h(this,o,vt).call(this,true);}f(this,B,e(this,B)+t[i]),n&&(n.entrySize=s,n.totalCalculatedSize=e(this,B));});},ft=new WeakMap,bt=new WeakMap,At=new WeakMap,it=function*({allowStale:t=this.allowStale}={}){if(e(this,F))for(let i=e(this,D);!(!h(this,o,Ut).call(this,i)||((t||!e(this,W).call(this,i))&&(yield i),i===e(this,z)));)i=e(this,G)[i];},st=function*({allowStale:t=this.allowStale}={}){if(e(this,F))for(let i=e(this,z);!(!h(this,o,Ut).call(this,i)||((t||!e(this,W).call(this,i))&&(yield i),i===e(this,D)));)i=e(this,I)[i];},Ut=function(t){return t!==void 0&&e(this,R).get(e(this,w)[t])===t},vt=function(t){var a;let i=e(this,z),s=e(this,w)[i],n=e(this,d)[i];return e(this,rt)&&h(this,o,b).call(this,n)?n.__abortController.abort(new Error("evicted")):(e(this,Q)||e(this,C))&&(e(this,Q)&&((a=e(this,K))==null||a.call(this,n,s,"evict")),e(this,C)&&e(this,v)?.push([n,s,"evict"])),e(this,ft).call(this,i),e(this,V)?.[i]&&(clearTimeout(e(this,V)[i]),e(this,V)[i]=void 0),t&&(e(this,w)[i]=void 0,e(this,d)[i]=void 0,e(this,X).push(i)),e(this,F)===1?(f(this,z,f(this,D,0)),e(this,X).length=0):f(this,z,e(this,I)[i]),e(this,R).delete(s),Ft(this,F)._--,i},zt=function(t,i,s,n){let a=i===void 0?void 0:e(this,d)[i];if(h(this,o,b).call(this,a))return a;let r=new xt,{signal:c}=s;c?.addEventListener("abort",()=>r.abort(c.reason),{signal:r.signal});let u={signal:r.signal,options:s,context:n},S=(T,E=false)=>{let{aborted:p}=r.signal,x=s.ignoreFetchAbort&&T!==void 0;if(s.status&&(p&&!E?(s.status.fetchAborted=true,s.status.fetchError=r.signal.reason,x&&(s.status.fetchAbortIgnored=true)):s.status.fetchResolved=true),p&&!x&&!E)return y(r.signal.reason);let L=P,O=e(this,d)[i];return (O===P||x&&E&&O===void 0)&&(T===void 0?L.__staleWhileFetching!==void 0?e(this,d)[i]=L.__staleWhileFetching:h(this,o,nt).call(this,t,"fetch"):(s.status&&(s.status.fetchUpdated=true),this.set(t,T,u.options))),T},M=T=>(s.status&&(s.status.fetchRejected=true,s.status.fetchError=T),y(T)),y=T=>{let{aborted:E}=r.signal,p=E&&s.allowStaleOnFetchAbort,x=p||s.allowStaleOnFetchRejection,L=x||s.noDeleteOnFetchRejection,O=P;if(e(this,d)[i]===P&&(!L||O.__staleWhileFetching===void 0?h(this,o,nt).call(this,t,"fetch"):p||(e(this,d)[i]=O.__staleWhileFetching)),x)return s.status&&O.__staleWhileFetching!==void 0&&(s.status.returnedStale=true),O.__staleWhileFetching;if(O.__returned===O)throw T},tt=(T,E)=>{var x;let p=(x=e(this,mt))==null?void 0:x.call(this,t,a,u);p&&p instanceof Promise&&p.then(L=>T(L===void 0?void 0:L),E),r.signal.addEventListener("abort",()=>{(!s.ignoreFetchAbort||s.allowStaleOnFetchAbort)&&(T(void 0),s.allowStaleOnFetchAbort&&(T=L=>S(L,true)));});};s.status&&(s.status.fetchDispatched=true);let P=new Promise(tt).then(S,M),Z=Object.assign(P,{__abortController:r,__staleWhileFetching:a,__returned:void 0});return i===void 0?(this.set(t,Z,{...u.options,status:void 0}),i=e(this,R).get(t)):e(this,d)[i]=Z,Z},b=function(t){if(!e(this,rt))return false;let i=t;return !!i&&i instanceof Promise&&i.hasOwnProperty("__staleWhileFetching")&&i.__abortController instanceof xt},Vt=function(t,i){e(this,G)[i]=t,e(this,I)[t]=i;},yt=function(t){t!==e(this,D)&&(t===e(this,z)?f(this,z,e(this,I)[t]):h(this,o,Vt).call(this,e(this,G)[t],e(this,I)[t]),h(this,o,Vt).call(this,e(this,D),t),f(this,D,t));},nt=function(t,i){var n,a;let s=false;if(e(this,F)!==0){let r=e(this,R).get(t);if(r!==void 0)if(e(this,V)?.[r]&&(clearTimeout(e(this,V)?.[r]),e(this,V)[r]=void 0),s=true,e(this,F)===1)h(this,o,Wt).call(this,i);else {e(this,ft).call(this,r);let c=e(this,d)[r];if(h(this,o,b).call(this,c)?c.__abortController.abort(new Error("deleted")):(e(this,Q)||e(this,C))&&(e(this,Q)&&((n=e(this,K))==null||n.call(this,c,t,i)),e(this,C)&&e(this,v)?.push([c,t,i])),e(this,R).delete(t),e(this,w)[r]=void 0,e(this,d)[r]=void 0,r===e(this,D))f(this,D,e(this,G)[r]);else if(r===e(this,z))f(this,z,e(this,I)[r]);else {let u=e(this,G)[r];e(this,I)[u]=e(this,I)[r];let S=e(this,I)[r];e(this,G)[S]=e(this,G)[r];}Ft(this,F)._--,e(this,X).push(r);}}if(e(this,C)&&e(this,v)?.length){let r=e(this,v),c;for(;c=r?.shift();)(a=e(this,H))==null||a.call(this,...c);}return s},Wt=function(t){var i,s;for(let n of h(this,o,st).call(this,{allowStale:true})){let a=e(this,d)[n];if(h(this,o,b).call(this,a))a.__abortController.abort(new Error("deleted"));else {let r=e(this,w)[n];e(this,Q)&&((i=e(this,K))==null||i.call(this,a,r,t)),e(this,C)&&e(this,v)?.push([a,r,t]);}}if(e(this,R).clear(),e(this,d).fill(void 0),e(this,w).fill(void 0),e(this,U)&&e(this,J)){e(this,U).fill(0),e(this,J).fill(0);for(let n of e(this,V)??[])n!==void 0&&clearTimeout(n);e(this,V)?.fill(void 0);}if(e(this,q)&&e(this,q).fill(0),f(this,z,0),f(this,D,0),e(this,X).length=0,f(this,B,0),f(this,F,0),e(this,C)&&e(this,v)){let n=e(this,v),a;for(;a=n?.shift();)(s=e(this,H))==null||s.call(this,...a);}};var It=Pt;var ct=class{constructor(t){m(this,"cache");m(this,"map",new Map);this.cache=new It({max:t.cacheSize}),this.map=new Map;}get[Symbol.iterator](){return this.map[Symbol.iterator]}get[Symbol.toStringTag](){return this.map[Symbol.toStringTag]}clear(){return this.cache.clear(),this.map.clear()}delete(t){let i=this.map.delete(t);return i&&this.cache.delete(t),i}get forEach(){return this.map.forEach}get(t){let i=this.cache.get(t);return i||this.map.get(t)}has(t){return this.map.has(t)}set(t,i){return this.map.set(t,i),this.cache.set(t,i),this}get size(){return this.map.size}entries(){return this.map.entries()}keys(){return this.map.keys()}values(){return this.map.values()}};var A=class A{constructor(){}static clearOldTempVariables(t){A.tempStorageDeadlines.forEach((i,s)=>{i>t&&(A.tempStorage.delete(s),A.tempStorageDeadlines.delete(s),A.storage.cache.delete(s));});}static setVariable(t,i){let s=A.tempStorage.has(t);i==null?(A.storage.map.delete(t),!s&&A.storage.cache.delete(t)):(A.storage.map.set(t,i),!s&&A.storage.cache.set(t,i));}static getVariable(t){let i=A.storage.cache.get(t);return i===void 0&&(i=A.tempStorage.get(t)),i===void 0&&(i=A.storage.map.get(t)),i===void 0&&(i=A.default.get(t)),Dt(i)}static removeVariable(t){A.storage.delete(t);}static setFlag(t,i){if(i)this.flags.includes(t)||this.flags.push(t);else {let s=this.flags.indexOf(t);s>-1&&this.flags.splice(s,1);}}static getFlag(t){return this.flags.includes(t)}};m(A,"storage",new ct({cacheSize:20})),m(A,"default",new ct({cacheSize:20})),m(A,"flags",Array()),m(A,"tempStorage",new Map),m(A,"tempStorageDeadlines",new Map);var g=A;var Ot=class{get storage(){return g.storage.map}get cache(){return g.storage.cache}get flags(){return g.flags}get tempStorage(){return g.tempStorage}get tempStorageDeadlines(){return g.tempStorageDeadlines}set default(t){Object.entries(t).forEach(([i,s])=>{g.default.set(i,s);});}set(t,i){return g.setVariable(t,i)}get(t){return g.getVariable(t)}remove(t){return g.removeVariable(t)}setTempVariable(t,i){if(i==null){this.removeTempVariable(t);return}else g.tempStorage.set(t,i),g.storage.cache.set(t,i),g.tempStorageDeadlines.has(t)||g.tempStorageDeadlines.set(t,unifier.GameUnifier.openedLabels);}removeTempVariable(t){g.tempStorage.has(t)&&(g.tempStorage.delete(t),g.tempStorageDeadlines.delete(t),g.storage.cache.delete(t));}setFlag(t,i){return g.setFlag(t,i)}getFlag(t){return g.getFlag(t)}clear(){this.storage.clear(),this.cache.clear(),g.flags=[],g.tempStorage.clear(),g.tempStorageDeadlines.clear();}export(){let t=[];[...this.storage.keys()].forEach(n=>{t.push({key:n,value:this.storage.get(n)});});let i=[];[...g.tempStorage.keys()].forEach(n=>{i.push({key:n,value:g.tempStorage.get(n)});});let s=[];return [...g.tempStorageDeadlines.keys()].forEach(n=>{s.push({key:n,value:g.tempStorageDeadlines.get(n)});}),Dt({base:t,temp:i,tempDeadlines:s,flags:g.flags})}restore(t){this.clear();try{t?(Array.isArray(t)&&t.forEach(i=>{if(i.key==="___temp_storage___"){let s=i.value;Object.entries(s).forEach(([n,a])=>{g.tempStorage.set(n,a);});}else if(i.key==="___temp_storage_deadlines___"){let s=i.value;Object.entries(s).forEach(([n,a])=>{g.tempStorageDeadlines.set(n,a);});}else i.key==="___flags___"?i.value.forEach(n=>{g.flags.push(n);}):this.storage.set(i.key,i.value);}),"base"in t&&"temp"in t&&"tempDeadlines"in t?(t.base?.forEach(i=>{this.storage.set(i.key,i.value);}),t.temp?.forEach(i=>{g.tempStorage.set(i.key,i.value);}),t.tempDeadlines?.forEach(i=>{g.tempStorageDeadlines.set(i.key,i.value);})):Object.entries(t).forEach(([i,s])=>{i==="___temp_storage___"?Object.entries(s).forEach(([n,a])=>{g.tempStorage.set(n,a);}):i==="___temp_storage_deadlines___"?Object.entries(s).forEach(([n,a])=>{g.tempStorageDeadlines.set(n,a);}):i==="___flags___"?s.forEach(n=>{g.flags.push(n);}):this.storage.set(i,s);})):at.warn("No storage data found");}catch(i){at.error("Error importing data",i);}}};var Ct=class{constructor(t,i){m(this,"id");m(this,"categoryId");this.categoryId=t,this.id=i;}setStorageProperty(t,i){let s=g.getVariable(this.categoryId);s||(s={}),s.hasOwnProperty(this.id)||(s[this.id]={}),i==null?s[this.id].hasOwnProperty(t)&&delete s[this.id][t]:s[this.id]={...s[this.id],[t]:i},Object.keys(s[this.id]).length===0&&delete s[this.id],g.setVariable(this.categoryId,s);}getStorageProperty(t,i=this.id){let s=g.getVariable(this.categoryId);if(s&&s.hasOwnProperty(i)&&s[i].hasOwnProperty(t))return s[i][t]}};var ee={CURRENT_DIALOGUE_MEMORY_KEY:"___current_dialogue_memory___",LAST_DIALOGUE_ADDED_IN_STEP_MEMORY_KEY:"___last_dialogue_added_in_step_memory___",CURRENT_MENU_OPTIONS_MEMORY_KEY:"___current_menu_options_memory___",LAST_MENU_OPTIONS_ADDED_IN_STEP_MEMORY_KEY:"___last_menu_options_added_in_step_memory___",CURRENT_INPUT_VALUE_MEMORY_KEY:"_input_value_",LAST_INPUT_ADDED_IN_STEP_MEMORY_KEY:"___last_input_added_in_step_memory___",CURRENT_INPUT_INFO_MEMORY_KEY:"___current_input_info_memory___",CHARACTER_CATEGORY_KEY:"___character___",ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY:"___glue___",OPENED_LABELS_COUNTER_KEY:"___opened_labels_counter___",ALL_CHOICES_MADE_KEY:"___all_choices_made___",CURRENT_STEP_TIMES_COUNTER_KEY:"___current_step_times_counter___",LAST_STEP_GLUED:"___last_step_glued___"};var ze=new Ot;exports.SYSTEM_RESERVED_STORAGE_KEYS=ee;exports.StorageManagerStatic=g;exports.StoredClassModel=Ct;exports.storage=ze;
1
+ 'use strict';var unifier=require('@drincs/pixi-vn/unifier');var Jt=Object.defineProperty;var Yt=l=>{throw TypeError(l)};var Qt=(l,t,i)=>t in l?Jt(l,t,{enumerable:true,configurable:true,writable:true,value:i}):l[t]=i;var m=(l,t,i)=>Qt(l,typeof t!="symbol"?t+"":t,i),Mt=(l,t,i)=>t.has(l)||Yt("Cannot "+i);var e=(l,t,i)=>(Mt(l,t,"read from private field"),i?i.call(l):t.get(l)),_=(l,t,i)=>t.has(l)?Yt("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(l):t.set(l,i),f=(l,t,i,s)=>(Mt(l,t,"write to private field"),t.set(l,i),i),h=(l,t,i)=>(Mt(l,t,"access private method"),i);var Rt=(l,t,i,s)=>({set _(n){f(l,t,n);},get _(){return e(l,t,s)}});var at;(n=>(n.log=(a,...r)=>console.log(`[Pixi\u2019VN] ${a}`,...r),n.warn=(a,...r)=>console.warn(`[Pixi\u2019VN] ${a}`,...r),n.error=(a,...r)=>console.error(`[Pixi\u2019VN] ${a}`,...r),n.info=(a,...r)=>console.info(`[Pixi\u2019VN] ${a}`,...r)))(at||(at={}));function Dt(l){try{if(typeof l>"u")return l;let t=JSON.stringify(l);return JSON.parse(t)}catch(t){throw at.error("Error creating exportable element",l,t),new Error("[Pixi\u2019VN] Error creating exportable element")}}var Zt=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,$t=new Set,Lt=typeof process=="object"&&process?process:{},Bt=(l,t,i,s)=>{typeof Lt.emitWarning=="function"?Lt.emitWarning(l,t,i,s):console.error(`[${i}] ${t}: ${l}`);},xt=globalThis.AbortController,jt=globalThis.AbortSignal;if(typeof xt>"u"){jt=class{constructor(){m(this,"onabort");m(this,"_onabort",[]);m(this,"reason");m(this,"aborted",false);}addEventListener(s,n){this._onabort.push(n);}},xt=class{constructor(){m(this,"signal",new jt);t();}abort(s){if(!this.signal.aborted){this.signal.reason=s,this.signal.aborted=true;for(let n of this.signal._onabort)n(s);this.signal.onabort?.(s);}}};let l=Lt.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",t=()=>{l&&(l=false,Bt("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",t));};}var kt=l=>!$t.has(l);var et=l=>l&&l===Math.floor(l)&&l>0&&isFinite(l),Xt=l=>et(l)?l<=Math.pow(2,8)?Uint8Array:l<=Math.pow(2,16)?Uint16Array:l<=Math.pow(2,32)?Uint32Array:l<=Number.MAX_SAFE_INTEGER?_t:null:null,_t=class extends Array{constructor(t){super(t),this.fill(0);}},mt,ot=class ot{constructor(t,i){m(this,"heap");m(this,"length");if(!e(ot,mt))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new i(t),this.length=0;}static create(t){let i=Xt(t);if(!i)return [];f(ot,mt,true);let s=new ot(t,i);return f(ot,mt,false),s}push(t){this.heap[this.length++]=t;}pop(){return this.heap[--this.length]}};mt=new WeakMap,_(ot,mt,false);var Nt=ot,Kt,Ht,j,G,K,ht,H,St,Et,$,R,B,F,w,d,C,U,z,D,X,v,q,J,V,W,Q,rt,M,bt,o,Gt,lt,k,Tt,P,qt,ft,wt,At,it,st,Ut,vt,zt,b,Vt,yt,nt,Wt,Pt=class Pt{constructor(t){_(this,o);_(this,j);_(this,G);_(this,K);_(this,ht);_(this,H);_(this,St);_(this,Et);_(this,$);m(this,"ttl");m(this,"ttlResolution");m(this,"ttlAutopurge");m(this,"updateAgeOnGet");m(this,"updateAgeOnHas");m(this,"allowStale");m(this,"noDisposeOnSet");m(this,"noUpdateTTL");m(this,"maxEntrySize");m(this,"sizeCalculation");m(this,"noDeleteOnFetchRejection");m(this,"noDeleteOnStaleGet");m(this,"allowStaleOnFetchAbort");m(this,"allowStaleOnFetchRejection");m(this,"ignoreFetchAbort");_(this,R);_(this,B);_(this,F);_(this,w);_(this,d);_(this,C);_(this,U);_(this,z);_(this,D);_(this,X);_(this,v);_(this,q);_(this,J);_(this,V);_(this,W);_(this,Q);_(this,rt);_(this,M);_(this,bt);_(this,lt,()=>{});_(this,k,()=>{});_(this,Tt,()=>{});_(this,P,()=>false);_(this,ft,t=>{});_(this,wt,(t,i,s)=>{});_(this,At,(t,i,s,n)=>{if(s||n)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});m(this,Kt,"LRUCache");let{max:i=0,ttl:s,ttlResolution:n=1,ttlAutopurge:a,updateAgeOnGet:r,updateAgeOnHas:c,allowStale:u,dispose:S,onInsert:L,disposeAfter:y,noDisposeOnSet:tt,noUpdateTTL:Y,maxSize:Z=0,maxEntrySize:T=0,sizeCalculation:E,fetchMethod:p,memoMethod:x,noDeleteOnFetchRejection:N,noDeleteOnStaleGet:I,allowStaleOnFetchRejection:A,allowStaleOnFetchAbort:ut,ignoreFetchAbort:dt,perf:Ft}=t;if(Ft!==void 0&&typeof Ft?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(f(this,$,Ft??Zt),i!==0&&!et(i))throw new TypeError("max option must be a nonnegative integer");let gt=i?Xt(i):Array;if(!gt)throw new Error("invalid max value: "+i);if(f(this,j,i),f(this,G,Z),this.maxEntrySize=T||e(this,G),this.sizeCalculation=E,this.sizeCalculation){if(!e(this,G)&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(x!==void 0&&typeof x!="function")throw new TypeError("memoMethod must be a function if defined");if(f(this,Et,x),p!==void 0&&typeof p!="function")throw new TypeError("fetchMethod must be a function if specified");if(f(this,St,p),f(this,rt,!!p),f(this,F,new Map),f(this,w,new Array(i).fill(void 0)),f(this,d,new Array(i).fill(void 0)),f(this,C,new gt(i)),f(this,U,new gt(i)),f(this,z,0),f(this,D,0),f(this,X,Nt.create(i)),f(this,R,0),f(this,B,0),typeof S=="function"&&f(this,K,S),typeof L=="function"&&f(this,ht,L),typeof y=="function"?(f(this,H,y),f(this,v,[])):(f(this,H,void 0),f(this,v,void 0)),f(this,Q,!!e(this,K)),f(this,bt,!!e(this,ht)),f(this,M,!!e(this,H)),this.noDisposeOnSet=!!tt,this.noUpdateTTL=!!Y,this.noDeleteOnFetchRejection=!!N,this.allowStaleOnFetchRejection=!!A,this.allowStaleOnFetchAbort=!!ut,this.ignoreFetchAbort=!!dt,this.maxEntrySize!==0){if(e(this,G)!==0&&!et(e(this,G)))throw new TypeError("maxSize must be a positive integer if specified");if(!et(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");h(this,o,qt).call(this);}if(this.allowStale=!!u,this.noDeleteOnStaleGet=!!I,this.updateAgeOnGet=!!r,this.updateAgeOnHas=!!c,this.ttlResolution=et(n)||n===0?n:1,this.ttlAutopurge=!!a,this.ttl=s||0,this.ttl){if(!et(this.ttl))throw new TypeError("ttl must be a positive integer if specified");h(this,o,Gt).call(this);}if(e(this,j)===0&&this.ttl===0&&e(this,G)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!e(this,j)&&!e(this,G)){let pt="LRU_CACHE_UNBOUNDED";kt(pt)&&($t.add(pt),Bt("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",pt,Pt));}}get perf(){return e(this,$)}static unsafeExposeInternals(t){return {starts:e(t,J),ttls:e(t,V),autopurgeTimers:e(t,W),sizes:e(t,q),keyMap:e(t,F),keyList:e(t,w),valList:e(t,d),next:e(t,C),prev:e(t,U),get head(){return e(t,z)},get tail(){return e(t,D)},free:e(t,X),isBackgroundFetch:i=>{var s;return h(s=t,o,b).call(s,i)},backgroundFetch:(i,s,n,a)=>{var r;return h(r=t,o,zt).call(r,i,s,n,a)},moveToTail:i=>{var s;return h(s=t,o,yt).call(s,i)},indexes:i=>{var s;return h(s=t,o,it).call(s,i)},rindexes:i=>{var s;return h(s=t,o,st).call(s,i)},isStale:i=>{var s;return e(s=t,P).call(s,i)}}}get max(){return e(this,j)}get maxSize(){return e(this,G)}get calculatedSize(){return e(this,B)}get size(){return e(this,R)}get fetchMethod(){return e(this,St)}get memoMethod(){return e(this,Et)}get dispose(){return e(this,K)}get onInsert(){return e(this,ht)}get disposeAfter(){return e(this,H)}getRemainingTTL(t){return e(this,F).has(t)?1/0:0}*entries(){for(let t of h(this,o,it).call(this))e(this,d)[t]!==void 0&&e(this,w)[t]!==void 0&&!h(this,o,b).call(this,e(this,d)[t])&&(yield [e(this,w)[t],e(this,d)[t]]);}*rentries(){for(let t of h(this,o,st).call(this))e(this,d)[t]!==void 0&&e(this,w)[t]!==void 0&&!h(this,o,b).call(this,e(this,d)[t])&&(yield [e(this,w)[t],e(this,d)[t]]);}*keys(){for(let t of h(this,o,it).call(this)){let i=e(this,w)[t];i!==void 0&&!h(this,o,b).call(this,e(this,d)[t])&&(yield i);}}*rkeys(){for(let t of h(this,o,st).call(this)){let i=e(this,w)[t];i!==void 0&&!h(this,o,b).call(this,e(this,d)[t])&&(yield i);}}*values(){for(let t of h(this,o,it).call(this))e(this,d)[t]!==void 0&&!h(this,o,b).call(this,e(this,d)[t])&&(yield e(this,d)[t]);}*rvalues(){for(let t of h(this,o,st).call(this))e(this,d)[t]!==void 0&&!h(this,o,b).call(this,e(this,d)[t])&&(yield e(this,d)[t]);}[(Ht=Symbol.iterator,Kt=Symbol.toStringTag,Ht)](){return this.entries()}find(t,i={}){for(let s of h(this,o,it).call(this)){let n=e(this,d)[s],a=h(this,o,b).call(this,n)?n.__staleWhileFetching:n;if(a!==void 0&&t(a,e(this,w)[s],this))return this.get(e(this,w)[s],i)}}forEach(t,i=this){for(let s of h(this,o,it).call(this)){let n=e(this,d)[s],a=h(this,o,b).call(this,n)?n.__staleWhileFetching:n;a!==void 0&&t.call(i,a,e(this,w)[s],this);}}rforEach(t,i=this){for(let s of h(this,o,st).call(this)){let n=e(this,d)[s],a=h(this,o,b).call(this,n)?n.__staleWhileFetching:n;a!==void 0&&t.call(i,a,e(this,w)[s],this);}}purgeStale(){let t=false;for(let i of h(this,o,st).call(this,{allowStale:true}))e(this,P).call(this,i)&&(h(this,o,nt).call(this,e(this,w)[i],"expire"),t=true);return t}info(t){let i=e(this,F).get(t);if(i===void 0)return;let s=e(this,d)[i],n=h(this,o,b).call(this,s)?s.__staleWhileFetching:s;if(n===void 0)return;let a={value:n};if(e(this,V)&&e(this,J)){let r=e(this,V)[i],c=e(this,J)[i];if(r&&c){let u=r-(e(this,$).now()-c);a.ttl=u,a.start=Date.now();}}return e(this,q)&&(a.size=e(this,q)[i]),a}dump(){let t=[];for(let i of h(this,o,it).call(this,{allowStale:true})){let s=e(this,w)[i],n=e(this,d)[i],a=h(this,o,b).call(this,n)?n.__staleWhileFetching:n;if(a===void 0||s===void 0)continue;let r={value:a};if(e(this,V)&&e(this,J)){r.ttl=e(this,V)[i];let c=e(this,$).now()-e(this,J)[i];r.start=Math.floor(Date.now()-c);}e(this,q)&&(r.size=e(this,q)[i]),t.unshift([s,r]);}return t}load(t){this.clear();for(let[i,s]of t){if(s.start){let n=Date.now()-s.start;s.start=e(this,$).now()-n;}this.set(i,s.value,s);}}set(t,i,s={}){var tt,Y,Z,T;if(i===void 0)return this.delete(t),this;let{ttl:n=this.ttl,start:a,noDisposeOnSet:r=this.noDisposeOnSet,sizeCalculation:c=this.sizeCalculation,status:u}=s,{noUpdateTTL:S=this.noUpdateTTL}=s,L=e(this,At).call(this,t,i,s.size||0,c);if(this.maxEntrySize&&L>this.maxEntrySize)return u&&(u.set="miss",u.maxEntrySizeExceeded=true),h(this,o,nt).call(this,t,"set"),this;let y=e(this,R)===0?void 0:e(this,F).get(t);if(y===void 0)y=e(this,R)===0?e(this,D):e(this,X).length!==0?e(this,X).pop():e(this,R)===e(this,j)?h(this,o,vt).call(this,false):e(this,R),e(this,w)[y]=t,e(this,d)[y]=i,e(this,F).set(t,y),e(this,C)[e(this,D)]=y,e(this,U)[y]=e(this,D),f(this,D,y),Rt(this,R)._++,e(this,wt).call(this,y,L,u),u&&(u.set="add"),S=false,e(this,bt)&&((tt=e(this,ht))==null||tt.call(this,i,t,"add"));else {h(this,o,yt).call(this,y);let E=e(this,d)[y];if(i!==E){if(e(this,rt)&&h(this,o,b).call(this,E)){E.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:p}=E;p!==void 0&&!r&&(e(this,Q)&&((Y=e(this,K))==null||Y.call(this,p,t,"set")),e(this,M)&&e(this,v)?.push([p,t,"set"]));}else r||(e(this,Q)&&((Z=e(this,K))==null||Z.call(this,E,t,"set")),e(this,M)&&e(this,v)?.push([E,t,"set"]));if(e(this,ft).call(this,y),e(this,wt).call(this,y,L,u),e(this,d)[y]=i,u){u.set="replace";let p=E&&h(this,o,b).call(this,E)?E.__staleWhileFetching:E;p!==void 0&&(u.oldValue=p);}}else u&&(u.set="update");e(this,bt)&&this.onInsert?.(i,t,i===E?"update":"replace");}if(n!==0&&!e(this,V)&&h(this,o,Gt).call(this),e(this,V)&&(S||e(this,Tt).call(this,y,n,a),u&&e(this,k).call(this,u,y)),!r&&e(this,M)&&e(this,v)){let E=e(this,v),p;for(;p=E?.shift();)(T=e(this,H))==null||T.call(this,...p);}return this}pop(){var t;try{for(;e(this,R);){let i=e(this,d)[e(this,z)];if(h(this,o,vt).call(this,!0),h(this,o,b).call(this,i)){if(i.__staleWhileFetching)return i.__staleWhileFetching}else if(i!==void 0)return i}}finally{if(e(this,M)&&e(this,v)){let i=e(this,v),s;for(;s=i?.shift();)(t=e(this,H))==null||t.call(this,...s);}}}has(t,i={}){let{updateAgeOnHas:s=this.updateAgeOnHas,status:n}=i,a=e(this,F).get(t);if(a!==void 0){let r=e(this,d)[a];if(h(this,o,b).call(this,r)&&r.__staleWhileFetching===void 0)return false;if(e(this,P).call(this,a))n&&(n.has="stale",e(this,k).call(this,n,a));else return s&&e(this,lt).call(this,a),n&&(n.has="hit",e(this,k).call(this,n,a)),true}else n&&(n.has="miss");return false}peek(t,i={}){let{allowStale:s=this.allowStale}=i,n=e(this,F).get(t);if(n===void 0||!s&&e(this,P).call(this,n))return;let a=e(this,d)[n];return h(this,o,b).call(this,a)?a.__staleWhileFetching:a}async fetch(t,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:n=this.updateAgeOnGet,noDeleteOnStaleGet:a=this.noDeleteOnStaleGet,ttl:r=this.ttl,noDisposeOnSet:c=this.noDisposeOnSet,size:u=0,sizeCalculation:S=this.sizeCalculation,noUpdateTTL:L=this.noUpdateTTL,noDeleteOnFetchRejection:y=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:tt=this.allowStaleOnFetchRejection,ignoreFetchAbort:Y=this.ignoreFetchAbort,allowStaleOnFetchAbort:Z=this.allowStaleOnFetchAbort,context:T,forceRefresh:E=false,status:p,signal:x}=i;if(!e(this,rt))return p&&(p.fetch="get"),this.get(t,{allowStale:s,updateAgeOnGet:n,noDeleteOnStaleGet:a,status:p});let N={allowStale:s,updateAgeOnGet:n,noDeleteOnStaleGet:a,ttl:r,noDisposeOnSet:c,size:u,sizeCalculation:S,noUpdateTTL:L,noDeleteOnFetchRejection:y,allowStaleOnFetchRejection:tt,allowStaleOnFetchAbort:Z,ignoreFetchAbort:Y,status:p,signal:x},I=e(this,F).get(t);if(I===void 0){p&&(p.fetch="miss");let A=h(this,o,zt).call(this,t,I,N,T);return A.__returned=A}else {let A=e(this,d)[I];if(h(this,o,b).call(this,A)){let pt=s&&A.__staleWhileFetching!==void 0;return p&&(p.fetch="inflight",pt&&(p.returnedStale=true)),pt?A.__staleWhileFetching:A.__returned=A}let ut=e(this,P).call(this,I);if(!E&&!ut)return p&&(p.fetch="hit"),h(this,o,yt).call(this,I),n&&e(this,lt).call(this,I),p&&e(this,k).call(this,p,I),A;let dt=h(this,o,zt).call(this,t,I,N,T),gt=dt.__staleWhileFetching!==void 0&&s;return p&&(p.fetch=ut?"stale":"refresh",gt&&ut&&(p.returnedStale=true)),gt?dt.__staleWhileFetching:dt.__returned=dt}}async forceFetch(t,i={}){let s=await this.fetch(t,i);if(s===void 0)throw new Error("fetch() returned undefined");return s}memo(t,i={}){let s=e(this,Et);if(!s)throw new Error("no memoMethod provided to constructor");let{context:n,forceRefresh:a,...r}=i,c=this.get(t,r);if(!a&&c!==void 0)return c;let u=s(t,c,{options:r,context:n});return this.set(t,u,r),u}get(t,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:n=this.updateAgeOnGet,noDeleteOnStaleGet:a=this.noDeleteOnStaleGet,status:r}=i,c=e(this,F).get(t);if(c!==void 0){let u=e(this,d)[c],S=h(this,o,b).call(this,u);return r&&e(this,k).call(this,r,c),e(this,P).call(this,c)?(r&&(r.get="stale"),S?(r&&s&&u.__staleWhileFetching!==void 0&&(r.returnedStale=true),s?u.__staleWhileFetching:void 0):(a||h(this,o,nt).call(this,t,"expire"),r&&s&&(r.returnedStale=true),s?u:void 0)):(r&&(r.get="hit"),S?u.__staleWhileFetching:(h(this,o,yt).call(this,c),n&&e(this,lt).call(this,c),u))}else r&&(r.get="miss");}delete(t){return h(this,o,nt).call(this,t,"delete")}clear(){return h(this,o,Wt).call(this,"delete")}};j=new WeakMap,G=new WeakMap,K=new WeakMap,ht=new WeakMap,H=new WeakMap,St=new WeakMap,Et=new WeakMap,$=new WeakMap,R=new WeakMap,B=new WeakMap,F=new WeakMap,w=new WeakMap,d=new WeakMap,C=new WeakMap,U=new WeakMap,z=new WeakMap,D=new WeakMap,X=new WeakMap,v=new WeakMap,q=new WeakMap,J=new WeakMap,V=new WeakMap,W=new WeakMap,Q=new WeakMap,rt=new WeakMap,M=new WeakMap,bt=new WeakMap,o=new WeakSet,Gt=function(){let t=new _t(e(this,j)),i=new _t(e(this,j));f(this,V,t),f(this,J,i);let s=this.ttlAutopurge?new Array(e(this,j)):void 0;f(this,W,s),f(this,Tt,(r,c,u=e(this,$).now())=>{if(i[r]=c!==0?u:0,t[r]=c,s?.[r]&&(clearTimeout(s[r]),s[r]=void 0),c!==0&&s){let S=setTimeout(()=>{e(this,P).call(this,r)&&h(this,o,nt).call(this,e(this,w)[r],"expire");},c+1);S.unref&&S.unref(),s[r]=S;}}),f(this,lt,r=>{i[r]=t[r]!==0?e(this,$).now():0;}),f(this,k,(r,c)=>{if(t[c]){let u=t[c],S=i[c];if(!u||!S)return;r.ttl=u,r.start=S,r.now=n||a();let L=r.now-S;r.remainingTTL=u-L;}});let n=0,a=()=>{let r=e(this,$).now();if(this.ttlResolution>0){n=r;let c=setTimeout(()=>n=0,this.ttlResolution);c.unref&&c.unref();}return r};this.getRemainingTTL=r=>{let c=e(this,F).get(r);if(c===void 0)return 0;let u=t[c],S=i[c];if(!u||!S)return 1/0;let L=(n||a())-S;return u-L},f(this,P,r=>{let c=i[r],u=t[r];return !!u&&!!c&&(n||a())-c>u});},lt=new WeakMap,k=new WeakMap,Tt=new WeakMap,P=new WeakMap,qt=function(){let t=new _t(e(this,j));f(this,B,0),f(this,q,t),f(this,ft,i=>{f(this,B,e(this,B)-t[i]),t[i]=0;}),f(this,At,(i,s,n,a)=>{if(h(this,o,b).call(this,s))return 0;if(!et(n))if(a){if(typeof a!="function")throw new TypeError("sizeCalculation must be a function");if(n=a(s,i),!et(n))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return n}),f(this,wt,(i,s,n)=>{if(t[i]=s,e(this,G)){let a=e(this,G)-t[i];for(;e(this,B)>a;)h(this,o,vt).call(this,true);}f(this,B,e(this,B)+t[i]),n&&(n.entrySize=s,n.totalCalculatedSize=e(this,B));});},ft=new WeakMap,wt=new WeakMap,At=new WeakMap,it=function*({allowStale:t=this.allowStale}={}){if(e(this,R))for(let i=e(this,D);!(!h(this,o,Ut).call(this,i)||((t||!e(this,P).call(this,i))&&(yield i),i===e(this,z)));)i=e(this,U)[i];},st=function*({allowStale:t=this.allowStale}={}){if(e(this,R))for(let i=e(this,z);!(!h(this,o,Ut).call(this,i)||((t||!e(this,P).call(this,i))&&(yield i),i===e(this,D)));)i=e(this,C)[i];},Ut=function(t){return t!==void 0&&e(this,F).get(e(this,w)[t])===t},vt=function(t){var a;let i=e(this,z),s=e(this,w)[i],n=e(this,d)[i];return e(this,rt)&&h(this,o,b).call(this,n)?n.__abortController.abort(new Error("evicted")):(e(this,Q)||e(this,M))&&(e(this,Q)&&((a=e(this,K))==null||a.call(this,n,s,"evict")),e(this,M)&&e(this,v)?.push([n,s,"evict"])),e(this,ft).call(this,i),e(this,W)?.[i]&&(clearTimeout(e(this,W)[i]),e(this,W)[i]=void 0),t&&(e(this,w)[i]=void 0,e(this,d)[i]=void 0,e(this,X).push(i)),e(this,R)===1?(f(this,z,f(this,D,0)),e(this,X).length=0):f(this,z,e(this,C)[i]),e(this,F).delete(s),Rt(this,R)._--,i},zt=function(t,i,s,n){let a=i===void 0?void 0:e(this,d)[i];if(h(this,o,b).call(this,a))return a;let r=new xt,{signal:c}=s;c?.addEventListener("abort",()=>r.abort(c.reason),{signal:r.signal});let u={signal:r.signal,options:s,context:n},S=(T,E=false)=>{let{aborted:p}=r.signal,x=s.ignoreFetchAbort&&T!==void 0,N=s.ignoreFetchAbort||!!(s.allowStaleOnFetchAbort&&T!==void 0);if(s.status&&(p&&!E?(s.status.fetchAborted=true,s.status.fetchError=r.signal.reason,x&&(s.status.fetchAbortIgnored=true)):s.status.fetchResolved=true),p&&!x&&!E)return y(r.signal.reason,N);let I=Y,A=e(this,d)[i];return (A===Y||x&&E&&A===void 0)&&(T===void 0?I.__staleWhileFetching!==void 0?e(this,d)[i]=I.__staleWhileFetching:h(this,o,nt).call(this,t,"fetch"):(s.status&&(s.status.fetchUpdated=true),this.set(t,T,u.options))),T},L=T=>(s.status&&(s.status.fetchRejected=true,s.status.fetchError=T),y(T,false)),y=(T,E)=>{let{aborted:p}=r.signal,x=p&&s.allowStaleOnFetchAbort,N=x||s.allowStaleOnFetchRejection,I=N||s.noDeleteOnFetchRejection,A=Y;if(e(this,d)[i]===Y&&(!I||!E&&A.__staleWhileFetching===void 0?h(this,o,nt).call(this,t,"fetch"):x||(e(this,d)[i]=A.__staleWhileFetching)),N)return s.status&&A.__staleWhileFetching!==void 0&&(s.status.returnedStale=true),A.__staleWhileFetching;if(A.__returned===A)throw T},tt=(T,E)=>{var x;let p=(x=e(this,St))==null?void 0:x.call(this,t,a,u);p&&p instanceof Promise&&p.then(N=>T(N===void 0?void 0:N),E),r.signal.addEventListener("abort",()=>{(!s.ignoreFetchAbort||s.allowStaleOnFetchAbort)&&(T(void 0),s.allowStaleOnFetchAbort&&(T=N=>S(N,true)));});};s.status&&(s.status.fetchDispatched=true);let Y=new Promise(tt).then(S,L),Z=Object.assign(Y,{__abortController:r,__staleWhileFetching:a,__returned:void 0});return i===void 0?(this.set(t,Z,{...u.options,status:void 0}),i=e(this,F).get(t)):e(this,d)[i]=Z,Z},b=function(t){if(!e(this,rt))return false;let i=t;return !!i&&i instanceof Promise&&i.hasOwnProperty("__staleWhileFetching")&&i.__abortController instanceof xt},Vt=function(t,i){e(this,U)[i]=t,e(this,C)[t]=i;},yt=function(t){t!==e(this,D)&&(t===e(this,z)?f(this,z,e(this,C)[t]):h(this,o,Vt).call(this,e(this,U)[t],e(this,C)[t]),h(this,o,Vt).call(this,e(this,D),t),f(this,D,t));},nt=function(t,i){var n,a;let s=false;if(e(this,R)!==0){let r=e(this,F).get(t);if(r!==void 0)if(e(this,W)?.[r]&&(clearTimeout(e(this,W)?.[r]),e(this,W)[r]=void 0),s=true,e(this,R)===1)h(this,o,Wt).call(this,i);else {e(this,ft).call(this,r);let c=e(this,d)[r];if(h(this,o,b).call(this,c)?c.__abortController.abort(new Error("deleted")):(e(this,Q)||e(this,M))&&(e(this,Q)&&((n=e(this,K))==null||n.call(this,c,t,i)),e(this,M)&&e(this,v)?.push([c,t,i])),e(this,F).delete(t),e(this,w)[r]=void 0,e(this,d)[r]=void 0,r===e(this,D))f(this,D,e(this,U)[r]);else if(r===e(this,z))f(this,z,e(this,C)[r]);else {let u=e(this,U)[r];e(this,C)[u]=e(this,C)[r];let S=e(this,C)[r];e(this,U)[S]=e(this,U)[r];}Rt(this,R)._--,e(this,X).push(r);}}if(e(this,M)&&e(this,v)?.length){let r=e(this,v),c;for(;c=r?.shift();)(a=e(this,H))==null||a.call(this,...c);}return s},Wt=function(t){var i,s;for(let n of h(this,o,st).call(this,{allowStale:true})){let a=e(this,d)[n];if(h(this,o,b).call(this,a))a.__abortController.abort(new Error("deleted"));else {let r=e(this,w)[n];e(this,Q)&&((i=e(this,K))==null||i.call(this,a,r,t)),e(this,M)&&e(this,v)?.push([a,r,t]);}}if(e(this,F).clear(),e(this,d).fill(void 0),e(this,w).fill(void 0),e(this,V)&&e(this,J)){e(this,V).fill(0),e(this,J).fill(0);for(let n of e(this,W)??[])n!==void 0&&clearTimeout(n);e(this,W)?.fill(void 0);}if(e(this,q)&&e(this,q).fill(0),f(this,z,0),f(this,D,0),e(this,X).length=0,f(this,B,0),f(this,R,0),e(this,M)&&e(this,v)){let n=e(this,v),a;for(;a=n?.shift();)(s=e(this,H))==null||s.call(this,...a);}};var It=Pt;var ct=class{constructor(t){m(this,"cache");m(this,"map",new Map);this.cache=new It({max:t.cacheSize}),this.map=new Map;}get[Symbol.iterator](){return this.map[Symbol.iterator]}get[Symbol.toStringTag](){return this.map[Symbol.toStringTag]}clear(){return this.cache.clear(),this.map.clear()}delete(t){let i=this.map.delete(t);return i&&this.cache.delete(t),i}get forEach(){return this.map.forEach}get(t){let i=this.cache.get(t);return i||this.map.get(t)}has(t){return this.map.has(t)}set(t,i){return this.map.set(t,i),this.cache.set(t,i),this}get size(){return this.map.size}entries(){return this.map.entries()}keys(){return this.map.keys()}values(){return this.map.values()}};var O=class O{constructor(){}static clearOldTempVariables(t){O.tempStorageDeadlines.forEach((i,s)=>{i>t&&(O.tempStorage.delete(s),O.tempStorageDeadlines.delete(s),O.storage.cache.delete(s));});}static setVariable(t,i){let s=O.tempStorage.has(t);i==null?(O.storage.map.delete(t),!s&&O.storage.cache.delete(t)):(O.storage.map.set(t,i),!s&&O.storage.cache.set(t,i));}static getVariable(t){let i=O.storage.cache.get(t);return i===void 0&&(i=O.tempStorage.get(t)),i===void 0&&(i=O.storage.map.get(t)),i===void 0&&(i=O.default.get(t)),Dt(i)}static removeVariable(t){O.storage.delete(t);}static setFlag(t,i){if(i)this.flags.includes(t)||this.flags.push(t);else {let s=this.flags.indexOf(t);s>-1&&this.flags.splice(s,1);}}static getFlag(t){return this.flags.includes(t)}};m(O,"storage",new ct({cacheSize:20})),m(O,"default",new ct({cacheSize:20})),m(O,"flags",Array()),m(O,"tempStorage",new Map),m(O,"tempStorageDeadlines",new Map);var g=O;var Ot=class{get storage(){return g.storage.map}get cache(){return g.storage.cache}get flags(){return g.flags}get tempStorage(){return g.tempStorage}get tempStorageDeadlines(){return g.tempStorageDeadlines}set default(t){Object.entries(t).forEach(([i,s])=>{g.default.set(i,s);});}set(t,i){return g.setVariable(t,i)}get(t){return g.getVariable(t)}remove(t){return g.removeVariable(t)}setTempVariable(t,i){if(i==null){this.removeTempVariable(t);return}else g.tempStorage.set(t,i),g.storage.cache.set(t,i),g.tempStorageDeadlines.has(t)||g.tempStorageDeadlines.set(t,unifier.GameUnifier.openedLabels);}removeTempVariable(t){g.tempStorage.has(t)&&(g.tempStorage.delete(t),g.tempStorageDeadlines.delete(t),g.storage.cache.delete(t));}setFlag(t,i){return g.setFlag(t,i)}getFlag(t){return g.getFlag(t)}clear(){this.storage.clear(),this.cache.clear(),g.flags=[],g.tempStorage.clear(),g.tempStorageDeadlines.clear();}export(){let t=[];[...this.storage.keys()].forEach(n=>{t.push({key:n,value:this.storage.get(n)});});let i=[];[...g.tempStorage.keys()].forEach(n=>{i.push({key:n,value:g.tempStorage.get(n)});});let s=[];return [...g.tempStorageDeadlines.keys()].forEach(n=>{s.push({key:n,value:g.tempStorageDeadlines.get(n)});}),Dt({base:t,temp:i,tempDeadlines:s,flags:g.flags})}restore(t){this.clear();try{t?(Array.isArray(t)&&t.forEach(i=>{if(i.key==="___temp_storage___"){let s=i.value;Object.entries(s).forEach(([n,a])=>{g.tempStorage.set(n,a);});}else if(i.key==="___temp_storage_deadlines___"){let s=i.value;Object.entries(s).forEach(([n,a])=>{g.tempStorageDeadlines.set(n,a);});}else i.key==="___flags___"?i.value.forEach(n=>{g.flags.push(n);}):this.storage.set(i.key,i.value);}),"base"in t&&"temp"in t&&"tempDeadlines"in t?(t.base?.forEach(i=>{this.storage.set(i.key,i.value);}),t.temp?.forEach(i=>{g.tempStorage.set(i.key,i.value);}),t.tempDeadlines?.forEach(i=>{g.tempStorageDeadlines.set(i.key,i.value);})):Object.entries(t).forEach(([i,s])=>{i==="___temp_storage___"?Object.entries(s).forEach(([n,a])=>{g.tempStorage.set(n,a);}):i==="___temp_storage_deadlines___"?Object.entries(s).forEach(([n,a])=>{g.tempStorageDeadlines.set(n,a);}):i==="___flags___"?s.forEach(n=>{g.flags.push(n);}):this.storage.set(i,s);})):at.warn("No storage data found");}catch(i){at.error("Error importing data",i);}}};var Ct=class{constructor(t,i){m(this,"id");m(this,"categoryId");this.categoryId=t,this.id=i;}setStorageProperty(t,i){let s=g.getVariable(this.categoryId);s||(s={}),s.hasOwnProperty(this.id)||(s[this.id]={}),i==null?s[this.id].hasOwnProperty(t)&&delete s[this.id][t]:s[this.id]={...s[this.id],[t]:i},Object.keys(s[this.id]).length===0&&delete s[this.id],g.setVariable(this.categoryId,s);}getStorageProperty(t,i=this.id){let s=g.getVariable(this.categoryId);if(s&&s.hasOwnProperty(i)&&s[i].hasOwnProperty(t))return s[i][t]}};var ee={CURRENT_DIALOGUE_MEMORY_KEY:"___current_dialogue_memory___",LAST_DIALOGUE_ADDED_IN_STEP_MEMORY_KEY:"___last_dialogue_added_in_step_memory___",CURRENT_MENU_OPTIONS_MEMORY_KEY:"___current_menu_options_memory___",LAST_MENU_OPTIONS_ADDED_IN_STEP_MEMORY_KEY:"___last_menu_options_added_in_step_memory___",CURRENT_INPUT_VALUE_MEMORY_KEY:"_input_value_",LAST_INPUT_ADDED_IN_STEP_MEMORY_KEY:"___last_input_added_in_step_memory___",CURRENT_INPUT_INFO_MEMORY_KEY:"___current_input_info_memory___",CHARACTER_CATEGORY_KEY:"___character___",ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY:"___glue___",OPENED_LABELS_COUNTER_KEY:"___opened_labels_counter___",ALL_CHOICES_MADE_KEY:"___all_choices_made___",CURRENT_STEP_TIMES_COUNTER_KEY:"___current_step_times_counter___",LAST_STEP_GLUED:"___last_step_glued___"};var ze=new Ot;exports.SYSTEM_RESERVED_STORAGE_KEYS=ee;exports.StorageManagerStatic=g;exports.StoredClassModel=Ct;exports.storage=ze;
package/dist/storage.mjs CHANGED
@@ -1 +1 @@
1
- export{a as StorageManagerStatic,b as StoredClassModel,c as storage}from'./chunk-IKZP57DP.mjs';export{a as SYSTEM_RESERVED_STORAGE_KEYS}from'./chunk-6GO4XVS7.mjs';import'./chunk-YDXQLPAR.mjs';import'./chunk-GNJIUFU2.mjs';
1
+ export{a as StorageManagerStatic,b as StoredClassModel,c as storage}from'./chunk-TIA4D2N7.mjs';export{a as SYSTEM_RESERVED_STORAGE_KEYS}from'./chunk-6GO4XVS7.mjs';import'./chunk-GFG3MDHE.mjs';import'./chunk-GNJIUFU2.mjs';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drincs/pixi-vn",
3
- "version": "1.4.2",
3
+ "version": "1.4.4",
4
4
  "type": "module",
5
5
  "description": "Pixi'VN is a npm package that provides various features for creating visual novels.",
6
6
  "main": "./dist/index.cjs",
@@ -25,10 +25,10 @@
25
25
  "default": "./dist/index.mjs"
26
26
  },
27
27
  "./pixi.js": {
28
- "types": "./dist/pixi.js.d.ts",
29
- "import": "./dist/pixi.js.mjs",
30
- "require": "./dist/pixi.js.cjs",
31
- "default": "./dist/pixi.js.mjs"
28
+ "types": "./dist/pixi.d.ts",
29
+ "import": "./dist/pixi.js",
30
+ "require": "./dist/pixi.js",
31
+ "default": "./dist/pixi.js"
32
32
  },
33
33
  "./unifier": {
34
34
  "types": "./dist/unifier.d.ts",
@@ -88,7 +88,7 @@
88
88
  "typesVersions": {
89
89
  "*": {
90
90
  "pixi.js": [
91
- "./dist/pixi.js.d.ts"
91
+ "./dist/pixi.d.ts"
92
92
  ],
93
93
  "unifier": [
94
94
  "./dist/unifier.d.ts"
@@ -1 +0,0 @@
1
- import {d,f,e,g,h,i}from'./chunk-GNJIUFU2.mjs';var Pt=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,Gt=new Set,vt=typeof process=="object"&&process?process:{},jt=(_,e,i,s)=>{typeof vt.emitWarning=="function"?vt.emitWarning(_,e,i,s):console.error(`[${i}] ${e}: ${_}`);},Et=globalThis.AbortController,Mt=globalThis.AbortSignal;if(typeof Et>"u"){Mt=class{constructor(){d(this,"onabort");d(this,"_onabort",[]);d(this,"reason");d(this,"aborted",false);}addEventListener(s,h){this._onabort.push(h);}},Et=class{constructor(){d(this,"signal",new Mt);e();}abort(s){if(!this.signal.aborted){this.signal.reason=s,this.signal.aborted=true;for(let h of this.signal._onabort)h(s);this.signal.onabort?.(s);}}};let _=vt.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{_&&(_=false,jt("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",e));};}var Ht=_=>!Gt.has(_);var Z=_=>_&&_===Math.floor(_)&&_>0&&isFinite(_),Nt=_=>Z(_)?_<=Math.pow(2,8)?Uint8Array:_<=Math.pow(2,16)?Uint16Array:_<=Math.pow(2,32)?Uint32Array:_<=Number.MAX_SAFE_INTEGER?ct:null:null,ct=class extends Array{constructor(e){super(e),this.fill(0);}},ut,nt=class nt{constructor(e$1,i){d(this,"heap");d(this,"length");if(!e(nt,ut))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new i(e$1),this.length=0;}static create(e){let i=Nt(e);if(!i)return [];g(nt,ut,true);let s=new nt(e,i);return g(nt,ut,false),s}push(e){this.heap[this.length++]=e;}pop(){return this.heap[--this.length]}};ut=new WeakMap,f(nt,ut,false);var Ct=nt,Ut,It,V,x,P,ht,H,dt,gt,K,E,B,F,b,u,R,M,v,z,k,O,$,q,U,I,Y,st,W,pt,r,Rt,rt,J,bt,G,Vt,ot,mt,yt,tt,et,Wt,Tt,Ft,S,Dt,St,it,Lt,xt=class xt{constructor(e$1){f(this,r);f(this,V);f(this,x);f(this,P);f(this,ht);f(this,H);f(this,dt);f(this,gt);f(this,K);d(this,"ttl");d(this,"ttlResolution");d(this,"ttlAutopurge");d(this,"updateAgeOnGet");d(this,"updateAgeOnHas");d(this,"allowStale");d(this,"noDisposeOnSet");d(this,"noUpdateTTL");d(this,"maxEntrySize");d(this,"sizeCalculation");d(this,"noDeleteOnFetchRejection");d(this,"noDeleteOnStaleGet");d(this,"allowStaleOnFetchAbort");d(this,"allowStaleOnFetchRejection");d(this,"ignoreFetchAbort");f(this,E);f(this,B);f(this,F);f(this,b);f(this,u);f(this,R);f(this,M);f(this,v);f(this,z);f(this,k);f(this,O);f(this,$);f(this,q);f(this,U);f(this,I);f(this,Y);f(this,st);f(this,W);f(this,pt);f(this,rt,()=>{});f(this,J,()=>{});f(this,bt,()=>{});f(this,G,()=>false);f(this,ot,e=>{});f(this,mt,(e,i,s)=>{});f(this,yt,(e,i,s,h)=>{if(s||h)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});d(this,Ut,"LRUCache");let{max:i=0,ttl:s,ttlResolution:h$1=1,ttlAutopurge:o,updateAgeOnGet:n,updateAgeOnHas:f$1,allowStale:c,dispose:m,onInsert:D,disposeAfter:y,noDisposeOnSet:Q,noUpdateTTL:j,maxSize:X=0,maxEntrySize:A=0,sizeCalculation:w,fetchMethod:d$1,memoMethod:C,noDeleteOnFetchRejection:L,noDeleteOnStaleGet:T,allowStaleOnFetchRejection:N,allowStaleOnFetchAbort:wt,ignoreFetchAbort:at,perf:_t}=e$1;if(_t!==void 0&&typeof _t?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(g(this,K,_t??Pt),i!==0&&!Z(i))throw new TypeError("max option must be a nonnegative integer");let lt=i?Nt(i):Array;if(!lt)throw new Error("invalid max value: "+i);if(g(this,V,i),g(this,x,X),this.maxEntrySize=A||e(this,x),this.sizeCalculation=w,this.sizeCalculation){if(!e(this,x)&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(C!==void 0&&typeof C!="function")throw new TypeError("memoMethod must be a function if defined");if(g(this,gt,C),d$1!==void 0&&typeof d$1!="function")throw new TypeError("fetchMethod must be a function if specified");if(g(this,dt,d$1),g(this,st,!!d$1),g(this,F,new Map),g(this,b,new Array(i).fill(void 0)),g(this,u,new Array(i).fill(void 0)),g(this,R,new lt(i)),g(this,M,new lt(i)),g(this,v,0),g(this,z,0),g(this,k,Ct.create(i)),g(this,E,0),g(this,B,0),typeof m=="function"&&g(this,P,m),typeof D=="function"&&g(this,ht,D),typeof y=="function"?(g(this,H,y),g(this,O,[])):(g(this,H,void 0),g(this,O,void 0)),g(this,Y,!!e(this,P)),g(this,pt,!!e(this,ht)),g(this,W,!!e(this,H)),this.noDisposeOnSet=!!Q,this.noUpdateTTL=!!j,this.noDeleteOnFetchRejection=!!L,this.allowStaleOnFetchRejection=!!N,this.allowStaleOnFetchAbort=!!wt,this.ignoreFetchAbort=!!at,this.maxEntrySize!==0){if(e(this,x)!==0&&!Z(e(this,x)))throw new TypeError("maxSize must be a positive integer if specified");if(!Z(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");h(this,r,Vt).call(this);}if(this.allowStale=!!c,this.noDeleteOnStaleGet=!!T,this.updateAgeOnGet=!!n,this.updateAgeOnHas=!!f$1,this.ttlResolution=Z(h$1)||h$1===0?h$1:1,this.ttlAutopurge=!!o,this.ttl=s||0,this.ttl){if(!Z(this.ttl))throw new TypeError("ttl must be a positive integer if specified");h(this,r,Rt).call(this);}if(e(this,V)===0&&this.ttl===0&&e(this,x)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!e(this,V)&&!e(this,x)){let ft="LRU_CACHE_UNBOUNDED";Ht(ft)&&(Gt.add(ft),jt("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",ft,xt));}}get perf(){return e(this,K)}static unsafeExposeInternals(e$1){return {starts:e(e$1,q),ttls:e(e$1,U),autopurgeTimers:e(e$1,I),sizes:e(e$1,$),keyMap:e(e$1,F),keyList:e(e$1,b),valList:e(e$1,u),next:e(e$1,R),prev:e(e$1,M),get head(){return e(e$1,v)},get tail(){return e(e$1,z)},free:e(e$1,k),isBackgroundFetch:i=>{var s;return h(s=e$1,r,S).call(s,i)},backgroundFetch:(i,s,h$1,o)=>{var n;return h(n=e$1,r,Ft).call(n,i,s,h$1,o)},moveToTail:i=>{var s;return h(s=e$1,r,St).call(s,i)},indexes:i=>{var s;return h(s=e$1,r,tt).call(s,i)},rindexes:i=>{var s;return h(s=e$1,r,et).call(s,i)},isStale:i=>{var s;return e(s=e$1,G).call(s,i)}}}get max(){return e(this,V)}get maxSize(){return e(this,x)}get calculatedSize(){return e(this,B)}get size(){return e(this,E)}get fetchMethod(){return e(this,dt)}get memoMethod(){return e(this,gt)}get dispose(){return e(this,P)}get onInsert(){return e(this,ht)}get disposeAfter(){return e(this,H)}getRemainingTTL(e$1){return e(this,F).has(e$1)?1/0:0}*entries(){for(let e$1 of h(this,r,tt).call(this))e(this,u)[e$1]!==void 0&&e(this,b)[e$1]!==void 0&&!h(this,r,S).call(this,e(this,u)[e$1])&&(yield [e(this,b)[e$1],e(this,u)[e$1]]);}*rentries(){for(let e$1 of h(this,r,et).call(this))e(this,u)[e$1]!==void 0&&e(this,b)[e$1]!==void 0&&!h(this,r,S).call(this,e(this,u)[e$1])&&(yield [e(this,b)[e$1],e(this,u)[e$1]]);}*keys(){for(let e$1 of h(this,r,tt).call(this)){let i=e(this,b)[e$1];i!==void 0&&!h(this,r,S).call(this,e(this,u)[e$1])&&(yield i);}}*rkeys(){for(let e$1 of h(this,r,et).call(this)){let i=e(this,b)[e$1];i!==void 0&&!h(this,r,S).call(this,e(this,u)[e$1])&&(yield i);}}*values(){for(let e$1 of h(this,r,tt).call(this))e(this,u)[e$1]!==void 0&&!h(this,r,S).call(this,e(this,u)[e$1])&&(yield e(this,u)[e$1]);}*rvalues(){for(let e$1 of h(this,r,et).call(this))e(this,u)[e$1]!==void 0&&!h(this,r,S).call(this,e(this,u)[e$1])&&(yield e(this,u)[e$1]);}[(It=Symbol.iterator,Ut=Symbol.toStringTag,It)](){return this.entries()}find(e$1,i={}){for(let s of h(this,r,tt).call(this)){let h$1=e(this,u)[s],o=h(this,r,S).call(this,h$1)?h$1.__staleWhileFetching:h$1;if(o!==void 0&&e$1(o,e(this,b)[s],this))return this.get(e(this,b)[s],i)}}forEach(e$1,i=this){for(let s of h(this,r,tt).call(this)){let h$1=e(this,u)[s],o=h(this,r,S).call(this,h$1)?h$1.__staleWhileFetching:h$1;o!==void 0&&e$1.call(i,o,e(this,b)[s],this);}}rforEach(e$1,i=this){for(let s of h(this,r,et).call(this)){let h$1=e(this,u)[s],o=h(this,r,S).call(this,h$1)?h$1.__staleWhileFetching:h$1;o!==void 0&&e$1.call(i,o,e(this,b)[s],this);}}purgeStale(){let e$1=false;for(let i of h(this,r,et).call(this,{allowStale:true}))e(this,G).call(this,i)&&(h(this,r,it).call(this,e(this,b)[i],"expire"),e$1=true);return e$1}info(e$1){let i=e(this,F).get(e$1);if(i===void 0)return;let s=e(this,u)[i],h$1=h(this,r,S).call(this,s)?s.__staleWhileFetching:s;if(h$1===void 0)return;let o={value:h$1};if(e(this,U)&&e(this,q)){let n=e(this,U)[i],f=e(this,q)[i];if(n&&f){let c=n-(e(this,K).now()-f);o.ttl=c,o.start=Date.now();}}return e(this,$)&&(o.size=e(this,$)[i]),o}dump(){let e$1=[];for(let i of h(this,r,tt).call(this,{allowStale:true})){let s=e(this,b)[i],h$1=e(this,u)[i],o=h(this,r,S).call(this,h$1)?h$1.__staleWhileFetching:h$1;if(o===void 0||s===void 0)continue;let n={value:o};if(e(this,U)&&e(this,q)){n.ttl=e(this,U)[i];let f=e(this,K).now()-e(this,q)[i];n.start=Math.floor(Date.now()-f);}e(this,$)&&(n.size=e(this,$)[i]),e$1.unshift([s,n]);}return e$1}load(e$1){this.clear();for(let[i,s]of e$1){if(s.start){let h=Date.now()-s.start;s.start=e(this,K).now()-h;}this.set(i,s.value,s);}}set(e$1,i$1,s={}){var Q,j,X,A;if(i$1===void 0)return this.delete(e$1),this;let{ttl:h$1=this.ttl,start:o,noDisposeOnSet:n=this.noDisposeOnSet,sizeCalculation:f=this.sizeCalculation,status:c}=s,{noUpdateTTL:m=this.noUpdateTTL}=s,D=e(this,yt).call(this,e$1,i$1,s.size||0,f);if(this.maxEntrySize&&D>this.maxEntrySize)return c&&(c.set="miss",c.maxEntrySizeExceeded=true),h(this,r,it).call(this,e$1,"set"),this;let y=e(this,E)===0?void 0:e(this,F).get(e$1);if(y===void 0)y=e(this,E)===0?e(this,z):e(this,k).length!==0?e(this,k).pop():e(this,E)===e(this,V)?h(this,r,Tt).call(this,false):e(this,E),e(this,b)[y]=e$1,e(this,u)[y]=i$1,e(this,F).set(e$1,y),e(this,R)[e(this,z)]=y,e(this,M)[y]=e(this,z),g(this,z,y),i(this,E)._++,e(this,mt).call(this,y,D,c),c&&(c.set="add"),m=false,e(this,pt)&&((Q=e(this,ht))==null||Q.call(this,i$1,e$1,"add"));else {h(this,r,St).call(this,y);let w=e(this,u)[y];if(i$1!==w){if(e(this,st)&&h(this,r,S).call(this,w)){w.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:d}=w;d!==void 0&&!n&&(e(this,Y)&&((j=e(this,P))==null||j.call(this,d,e$1,"set")),e(this,W)&&e(this,O)?.push([d,e$1,"set"]));}else n||(e(this,Y)&&((X=e(this,P))==null||X.call(this,w,e$1,"set")),e(this,W)&&e(this,O)?.push([w,e$1,"set"]));if(e(this,ot).call(this,y),e(this,mt).call(this,y,D,c),e(this,u)[y]=i$1,c){c.set="replace";let d=w&&h(this,r,S).call(this,w)?w.__staleWhileFetching:w;d!==void 0&&(c.oldValue=d);}}else c&&(c.set="update");e(this,pt)&&this.onInsert?.(i$1,e$1,i$1===w?"update":"replace");}if(h$1!==0&&!e(this,U)&&h(this,r,Rt).call(this),e(this,U)&&(m||e(this,bt).call(this,y,h$1,o),c&&e(this,J).call(this,c,y)),!n&&e(this,W)&&e(this,O)){let w=e(this,O),d;for(;d=w?.shift();)(A=e(this,H))==null||A.call(this,...d);}return this}pop(){var e$1;try{for(;e(this,E);){let i=e(this,u)[e(this,v)];if(h(this,r,Tt).call(this,!0),h(this,r,S).call(this,i)){if(i.__staleWhileFetching)return i.__staleWhileFetching}else if(i!==void 0)return i}}finally{if(e(this,W)&&e(this,O)){let i=e(this,O),s;for(;s=i?.shift();)(e$1=e(this,H))==null||e$1.call(this,...s);}}}has(e$1,i={}){let{updateAgeOnHas:s=this.updateAgeOnHas,status:h$1}=i,o=e(this,F).get(e$1);if(o!==void 0){let n=e(this,u)[o];if(h(this,r,S).call(this,n)&&n.__staleWhileFetching===void 0)return false;if(e(this,G).call(this,o))h$1&&(h$1.has="stale",e(this,J).call(this,h$1,o));else return s&&e(this,rt).call(this,o),h$1&&(h$1.has="hit",e(this,J).call(this,h$1,o)),true}else h$1&&(h$1.has="miss");return false}peek(e$1,i={}){let{allowStale:s=this.allowStale}=i,h$1=e(this,F).get(e$1);if(h$1===void 0||!s&&e(this,G).call(this,h$1))return;let o=e(this,u)[h$1];return h(this,r,S).call(this,o)?o.__staleWhileFetching:o}async fetch(e$1,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:h$1=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,ttl:n=this.ttl,noDisposeOnSet:f=this.noDisposeOnSet,size:c=0,sizeCalculation:m=this.sizeCalculation,noUpdateTTL:D=this.noUpdateTTL,noDeleteOnFetchRejection:y=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:Q=this.allowStaleOnFetchRejection,ignoreFetchAbort:j=this.ignoreFetchAbort,allowStaleOnFetchAbort:X=this.allowStaleOnFetchAbort,context:A,forceRefresh:w=false,status:d,signal:C}=i;if(!e(this,st))return d&&(d.fetch="get"),this.get(e$1,{allowStale:s,updateAgeOnGet:h$1,noDeleteOnStaleGet:o,status:d});let L={allowStale:s,updateAgeOnGet:h$1,noDeleteOnStaleGet:o,ttl:n,noDisposeOnSet:f,size:c,sizeCalculation:m,noUpdateTTL:D,noDeleteOnFetchRejection:y,allowStaleOnFetchRejection:Q,allowStaleOnFetchAbort:X,ignoreFetchAbort:j,status:d,signal:C},T=e(this,F).get(e$1);if(T===void 0){d&&(d.fetch="miss");let N=h(this,r,Ft).call(this,e$1,T,L,A);return N.__returned=N}else {let N=e(this,u)[T];if(h(this,r,S).call(this,N)){let ft=s&&N.__staleWhileFetching!==void 0;return d&&(d.fetch="inflight",ft&&(d.returnedStale=true)),ft?N.__staleWhileFetching:N.__returned=N}let wt=e(this,G).call(this,T);if(!w&&!wt)return d&&(d.fetch="hit"),h(this,r,St).call(this,T),h$1&&e(this,rt).call(this,T),d&&e(this,J).call(this,d,T),N;let at=h(this,r,Ft).call(this,e$1,T,L,A),lt=at.__staleWhileFetching!==void 0&&s;return d&&(d.fetch=wt?"stale":"refresh",lt&&wt&&(d.returnedStale=true)),lt?at.__staleWhileFetching:at.__returned=at}}async forceFetch(e,i={}){let s=await this.fetch(e,i);if(s===void 0)throw new Error("fetch() returned undefined");return s}memo(e$1,i={}){let s=e(this,gt);if(!s)throw new Error("no memoMethod provided to constructor");let{context:h,forceRefresh:o,...n}=i,f=this.get(e$1,n);if(!o&&f!==void 0)return f;let c=s(e$1,f,{options:n,context:h});return this.set(e$1,c,n),c}get(e$1,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:h$1=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,status:n}=i,f=e(this,F).get(e$1);if(f!==void 0){let c=e(this,u)[f],m=h(this,r,S).call(this,c);return n&&e(this,J).call(this,n,f),e(this,G).call(this,f)?(n&&(n.get="stale"),m?(n&&s&&c.__staleWhileFetching!==void 0&&(n.returnedStale=true),s?c.__staleWhileFetching:void 0):(o||h(this,r,it).call(this,e$1,"expire"),n&&s&&(n.returnedStale=true),s?c:void 0)):(n&&(n.get="hit"),m?c.__staleWhileFetching:(h(this,r,St).call(this,f),h$1&&e(this,rt).call(this,f),c))}else n&&(n.get="miss");}delete(e){return h(this,r,it).call(this,e,"delete")}clear(){return h(this,r,Lt).call(this,"delete")}};V=new WeakMap,x=new WeakMap,P=new WeakMap,ht=new WeakMap,H=new WeakMap,dt=new WeakMap,gt=new WeakMap,K=new WeakMap,E=new WeakMap,B=new WeakMap,F=new WeakMap,b=new WeakMap,u=new WeakMap,R=new WeakMap,M=new WeakMap,v=new WeakMap,z=new WeakMap,k=new WeakMap,O=new WeakMap,$=new WeakMap,q=new WeakMap,U=new WeakMap,I=new WeakMap,Y=new WeakMap,st=new WeakMap,W=new WeakMap,pt=new WeakMap,r=new WeakSet,Rt=function(){let e$1=new ct(e(this,V)),i=new ct(e(this,V));g(this,U,e$1),g(this,q,i);let s=this.ttlAutopurge?new Array(e(this,V)):void 0;g(this,I,s),g(this,bt,(n,f,c=e(this,K).now())=>{if(i[n]=f!==0?c:0,e$1[n]=f,s?.[n]&&(clearTimeout(s[n]),s[n]=void 0),f!==0&&s){let m=setTimeout(()=>{e(this,G).call(this,n)&&h(this,r,it).call(this,e(this,b)[n],"expire");},f+1);m.unref&&m.unref(),s[n]=m;}}),g(this,rt,n=>{i[n]=e$1[n]!==0?e(this,K).now():0;}),g(this,J,(n,f)=>{if(e$1[f]){let c=e$1[f],m=i[f];if(!c||!m)return;n.ttl=c,n.start=m,n.now=h$1||o();let D=n.now-m;n.remainingTTL=c-D;}});let h$1=0,o=()=>{let n=e(this,K).now();if(this.ttlResolution>0){h$1=n;let f=setTimeout(()=>h$1=0,this.ttlResolution);f.unref&&f.unref();}return n};this.getRemainingTTL=n=>{let f=e(this,F).get(n);if(f===void 0)return 0;let c=e$1[f],m=i[f];if(!c||!m)return 1/0;let D=(h$1||o())-m;return c-D},g(this,G,n=>{let f=i[n],c=e$1[n];return !!c&&!!f&&(h$1||o())-f>c});},rt=new WeakMap,J=new WeakMap,bt=new WeakMap,G=new WeakMap,Vt=function(){let e$1=new ct(e(this,V));g(this,B,0),g(this,$,e$1),g(this,ot,i=>{g(this,B,e(this,B)-e$1[i]),e$1[i]=0;}),g(this,yt,(i,s,h$1,o)=>{if(h(this,r,S).call(this,s))return 0;if(!Z(h$1))if(o){if(typeof o!="function")throw new TypeError("sizeCalculation must be a function");if(h$1=o(s,i),!Z(h$1))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return h$1}),g(this,mt,(i,s,h$1)=>{if(e$1[i]=s,e(this,x)){let o=e(this,x)-e$1[i];for(;e(this,B)>o;)h(this,r,Tt).call(this,true);}g(this,B,e(this,B)+e$1[i]),h$1&&(h$1.entrySize=s,h$1.totalCalculatedSize=e(this,B));});},ot=new WeakMap,mt=new WeakMap,yt=new WeakMap,tt=function*({allowStale:e$1=this.allowStale}={}){if(e(this,E))for(let i=e(this,z);!(!h(this,r,Wt).call(this,i)||((e$1||!e(this,G).call(this,i))&&(yield i),i===e(this,v)));)i=e(this,M)[i];},et=function*({allowStale:e$1=this.allowStale}={}){if(e(this,E))for(let i=e(this,v);!(!h(this,r,Wt).call(this,i)||((e$1||!e(this,G).call(this,i))&&(yield i),i===e(this,z)));)i=e(this,R)[i];},Wt=function(e$1){return e$1!==void 0&&e(this,F).get(e(this,b)[e$1])===e$1},Tt=function(e$1){var o;let i$1=e(this,v),s=e(this,b)[i$1],h$1=e(this,u)[i$1];return e(this,st)&&h(this,r,S).call(this,h$1)?h$1.__abortController.abort(new Error("evicted")):(e(this,Y)||e(this,W))&&(e(this,Y)&&((o=e(this,P))==null||o.call(this,h$1,s,"evict")),e(this,W)&&e(this,O)?.push([h$1,s,"evict"])),e(this,ot).call(this,i$1),e(this,I)?.[i$1]&&(clearTimeout(e(this,I)[i$1]),e(this,I)[i$1]=void 0),e$1&&(e(this,b)[i$1]=void 0,e(this,u)[i$1]=void 0,e(this,k).push(i$1)),e(this,E)===1?(g(this,v,g(this,z,0)),e(this,k).length=0):g(this,v,e(this,R)[i$1]),e(this,F).delete(s),i(this,E)._--,i$1},Ft=function(e$1,i,s,h$1){let o=i===void 0?void 0:e(this,u)[i];if(h(this,r,S).call(this,o))return o;let n=new Et,{signal:f}=s;f?.addEventListener("abort",()=>n.abort(f.reason),{signal:n.signal});let c={signal:n.signal,options:s,context:h$1},m=(A,w=false)=>{let{aborted:d}=n.signal,C=s.ignoreFetchAbort&&A!==void 0;if(s.status&&(d&&!w?(s.status.fetchAborted=true,s.status.fetchError=n.signal.reason,C&&(s.status.fetchAbortIgnored=true)):s.status.fetchResolved=true),d&&!C&&!w)return y(n.signal.reason);let L=j,T=e(this,u)[i];return (T===j||C&&w&&T===void 0)&&(A===void 0?L.__staleWhileFetching!==void 0?e(this,u)[i]=L.__staleWhileFetching:h(this,r,it).call(this,e$1,"fetch"):(s.status&&(s.status.fetchUpdated=true),this.set(e$1,A,c.options))),A},D=A=>(s.status&&(s.status.fetchRejected=true,s.status.fetchError=A),y(A)),y=A=>{let{aborted:w}=n.signal,d=w&&s.allowStaleOnFetchAbort,C=d||s.allowStaleOnFetchRejection,L=C||s.noDeleteOnFetchRejection,T=j;if(e(this,u)[i]===j&&(!L||T.__staleWhileFetching===void 0?h(this,r,it).call(this,e$1,"fetch"):d||(e(this,u)[i]=T.__staleWhileFetching)),C)return s.status&&T.__staleWhileFetching!==void 0&&(s.status.returnedStale=true),T.__staleWhileFetching;if(T.__returned===T)throw A},Q=(A,w)=>{var C;let d=(C=e(this,dt))==null?void 0:C.call(this,e$1,o,c);d&&d instanceof Promise&&d.then(L=>A(L===void 0?void 0:L),w),n.signal.addEventListener("abort",()=>{(!s.ignoreFetchAbort||s.allowStaleOnFetchAbort)&&(A(void 0),s.allowStaleOnFetchAbort&&(A=L=>m(L,true)));});};s.status&&(s.status.fetchDispatched=true);let j=new Promise(Q).then(m,D),X=Object.assign(j,{__abortController:n,__staleWhileFetching:o,__returned:void 0});return i===void 0?(this.set(e$1,X,{...c.options,status:void 0}),i=e(this,F).get(e$1)):e(this,u)[i]=X,X},S=function(e$1){if(!e(this,st))return false;let i=e$1;return !!i&&i instanceof Promise&&i.hasOwnProperty("__staleWhileFetching")&&i.__abortController instanceof Et},Dt=function(e$1,i){e(this,M)[i]=e$1,e(this,R)[e$1]=i;},St=function(e$1){e$1!==e(this,z)&&(e$1===e(this,v)?g(this,v,e(this,R)[e$1]):h(this,r,Dt).call(this,e(this,M)[e$1],e(this,R)[e$1]),h(this,r,Dt).call(this,e(this,z),e$1),g(this,z,e$1));},it=function(e$1,i$1){var h$1,o;let s=false;if(e(this,E)!==0){let n=e(this,F).get(e$1);if(n!==void 0)if(e(this,I)?.[n]&&(clearTimeout(e(this,I)?.[n]),e(this,I)[n]=void 0),s=true,e(this,E)===1)h(this,r,Lt).call(this,i$1);else {e(this,ot).call(this,n);let f=e(this,u)[n];if(h(this,r,S).call(this,f)?f.__abortController.abort(new Error("deleted")):(e(this,Y)||e(this,W))&&(e(this,Y)&&((h$1=e(this,P))==null||h$1.call(this,f,e$1,i$1)),e(this,W)&&e(this,O)?.push([f,e$1,i$1])),e(this,F).delete(e$1),e(this,b)[n]=void 0,e(this,u)[n]=void 0,n===e(this,z))g(this,z,e(this,M)[n]);else if(n===e(this,v))g(this,v,e(this,R)[n]);else {let c=e(this,M)[n];e(this,R)[c]=e(this,R)[n];let m=e(this,R)[n];e(this,M)[m]=e(this,M)[n];}i(this,E)._--,e(this,k).push(n);}}if(e(this,W)&&e(this,O)?.length){let n=e(this,O),f;for(;f=n?.shift();)(o=e(this,H))==null||o.call(this,...f);}return s},Lt=function(e$1){var i,s;for(let h$1 of h(this,r,et).call(this,{allowStale:true})){let o=e(this,u)[h$1];if(h(this,r,S).call(this,o))o.__abortController.abort(new Error("deleted"));else {let n=e(this,b)[h$1];e(this,Y)&&((i=e(this,P))==null||i.call(this,o,n,e$1)),e(this,W)&&e(this,O)?.push([o,n,e$1]);}}if(e(this,F).clear(),e(this,u).fill(void 0),e(this,b).fill(void 0),e(this,U)&&e(this,q)){e(this,U).fill(0),e(this,q).fill(0);for(let h of e(this,I)??[])h!==void 0&&clearTimeout(h);e(this,I)?.fill(void 0);}if(e(this,$)&&e(this,$).fill(0),g(this,v,0),g(this,z,0),e(this,k).length=0,g(this,B,0),g(this,E,0),e(this,W)&&e(this,O)){let h=e(this,O),o;for(;o=h?.shift();)(s=e(this,H))==null||s.call(this,...o);}};var zt=xt;var Ot=class{constructor(e){d(this,"cache");d(this,"map",new Map);this.cache=new zt({max:e.cacheSize}),this.map=new Map;}get[Symbol.iterator](){return this.map[Symbol.iterator]}get[Symbol.toStringTag](){return this.map[Symbol.toStringTag]}clear(){return this.cache.clear(),this.map.clear()}delete(e){let i=this.map.delete(e);return i&&this.cache.delete(e),i}get forEach(){return this.map.forEach}get(e){let i=this.cache.get(e);return i||this.map.get(e)}has(e){return this.map.has(e)}set(e,i){return this.map.set(e,i),this.cache.set(e,i),this}get size(){return this.map.size}entries(){return this.map.entries()}keys(){return this.map.keys()}values(){return this.map.values()}};export{Ot as a};