@drincs/pixi-vn 1.8.13 → 1.8.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/canvas.cjs +1 -1
- package/dist/canvas.mjs +1 -1
- package/dist/characters.cjs +1 -1
- package/dist/characters.d.cts +3 -2
- package/dist/characters.d.ts +3 -2
- package/dist/characters.mjs +1 -1
- package/dist/chunk-GIYMPXBT.mjs +1 -1
- package/dist/chunk-HQQ5WH6C.mjs +1 -1
- package/dist/history.cjs +1 -1
- package/dist/history.mjs +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +1 -1
- package/dist/motion.cjs +1 -1
- package/dist/motion.mjs +1 -1
- package/dist/narration.cjs +1 -1
- package/dist/narration.d.cts +19 -7
- package/dist/narration.d.ts +19 -7
- package/dist/narration.mjs +1 -1
- package/dist/pixi/browser.js +156 -156
- package/dist/sound.cjs +1 -1
- package/dist/sound.mjs +1 -1
- package/dist/storage.cjs +1 -1
- package/dist/vite-listener.cjs +1 -1
- package/dist/vite-listener.mjs +1 -1
- package/dist/vite.cjs +2 -2
- package/dist/vite.d.cts +16 -4
- package/dist/vite.d.ts +16 -4
- package/dist/vite.mjs +2 -2
- package/package.json +2 -2
package/dist/chunk-HQQ5WH6C.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import {PixiError}from'./core.mjs';var Kt=Object.create;var xt=Object.defineProperty;var $t=Object.getOwnPropertyDescriptor;var Bt=Object.getOwnPropertyNames;var Jt=Object.getPrototypeOf,qt=Object.prototype.hasOwnProperty;var Gt=l=>{throw TypeError(l)};var Xt=(l,e,i)=>e in l?xt(l,e,{enumerable:true,configurable:true,writable:true,value:i}):l[e]=i;var ie=(l=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(l,{get:(e,i)=>(typeof require<"u"?require:e)[i]}):l)(function(l){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+l+'" is not supported')});var se=(l,e)=>()=>(e||l((e={exports:{}}).exports,e),e.exports);var Yt=(l,e,i,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let h of Bt(e))!qt.call(l,h)&&h!==i&&xt(l,h,{get:()=>e[h],enumerable:!(s=$t(e,h))||s.enumerable});return l};var he=(l,e,i)=>(i=l!=null?Kt(Jt(l)):{},Yt(e||!l||!l.__esModule?xt(i,"default",{value:l,enumerable:true}):i,l));var T=(l,e,i)=>Xt(l,typeof e!="symbol"?e+"":e,i),Tt=(l,e,i)=>e.has(l)||Gt("Cannot "+i);var t=(l,e,i)=>(Tt(l,e,"read from private field"),i?i.call(l):e.get(l)),g=(l,e,i)=>e.has(l)?Gt("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(l):e.set(l,i),f=(l,e,i,s)=>(Tt(l,e,"write to private field"),e.set(l,i),i),a=(l,e,i)=>(Tt(l,e,"access private method"),i);var yt=(l,e,i,s)=>({set _(h){f(l,e,h);},get _(){return t(l,e,s)}});var Qt=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,It=new Set,zt=typeof process=="object"&&process?process:{},Vt=(l,e,i,s)=>{typeof zt.emitWarning=="function"?zt.emitWarning(l,e,i,s):console.error(`[${i}] ${e}: ${l}`);},Ft=globalThis.AbortController,jt=globalThis.AbortSignal;if(typeof Ft>"u"){jt=class{onabort;_onabort=[];reason;aborted=false;addEventListener(i,s){this._onabort.push(s);}},Ft=class{constructor(){e();}signal=new jt;abort(i){if(!this.signal.aborted){this.signal.reason=i,this.signal.aborted=true;for(let s of this.signal._onabort)s(i);this.signal.onabort?.(i);}}};let l=zt.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{l&&(l=false,Vt("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 Zt=l=>!It.has(l);var tt=l=>l&&l===Math.floor(l)&&l>0&&isFinite(l),Pt=l=>tt(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(l){super(l),this.fill(0);}},Y,ct,te=(Y=class{heap;length;static create(e){let i=Pt(e);if(!i)return [];f(Y,ct,true);let s=new Y(e,i);return f(Y,ct,false),s}constructor(e,i){if(!t(Y,ct))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new i(e),this.length=0;}push(e){this.heap[this.length++]=e;}pop(){return this.heap[--this.length]}},ct=new WeakMap,g(Y,ct,false),Y),Mt,Nt,V,U,P,ot,k,ft,dt,H,O,K,A,b,d,W,G,z,F,$,E,B,J,j,M,q,ht,D,pt,n,Rt,rt,Q,vt,N,Ht,nt,gt,bt,et,it,Ct,At,Ot,v,Wt,St,st,Dt,wt,kt=(wt=class{constructor(e){g(this,n);g(this,V);g(this,U);g(this,P);g(this,ot);g(this,k);g(this,ft);g(this,dt);g(this,H);T(this,"ttl");T(this,"ttlResolution");T(this,"ttlAutopurge");T(this,"updateAgeOnGet");T(this,"updateAgeOnHas");T(this,"allowStale");T(this,"noDisposeOnSet");T(this,"noUpdateTTL");T(this,"maxEntrySize");T(this,"sizeCalculation");T(this,"noDeleteOnFetchRejection");T(this,"noDeleteOnStaleGet");T(this,"allowStaleOnFetchAbort");T(this,"allowStaleOnFetchRejection");T(this,"ignoreFetchAbort");g(this,O);g(this,K);g(this,A);g(this,b);g(this,d);g(this,W);g(this,G);g(this,z);g(this,F);g(this,$);g(this,E);g(this,B);g(this,J);g(this,j);g(this,M);g(this,q);g(this,ht);g(this,D);g(this,pt);g(this,rt,()=>{});g(this,Q,()=>{});g(this,vt,()=>{});g(this,N,()=>false);g(this,nt,e=>{});g(this,gt,(e,i,s)=>{});g(this,bt,(e,i,s,h)=>{if(s||h)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});T(this,Mt,"LRUCache");let{max:i=0,ttl:s,ttlResolution:h=1,ttlAutopurge:r,updateAgeOnGet:o,updateAgeOnHas:u,allowStale:c,dispose:w,onInsert:x,disposeAfter:m,noDisposeOnSet:Z,noUpdateTTL:I,maxSize:X=0,maxEntrySize:y=0,sizeCalculation:S,fetchMethod:p,memoMethod:R,noDeleteOnFetchRejection:L,noDeleteOnStaleGet:C,allowStaleOnFetchRejection:_,allowStaleOnFetchAbort:mt,ignoreFetchAbort:lt,perf:at}=e;if(at!==void 0&&typeof at?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(f(this,H,at??Qt),i!==0&&!tt(i))throw new TypeError("max option must be a nonnegative integer");let ut=i?Pt(i):Array;if(!ut)throw new Error("invalid max value: "+i);if(f(this,V,i),f(this,U,X),this.maxEntrySize=y||t(this,U),this.sizeCalculation=S,this.sizeCalculation){if(!t(this,U)&&!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(R!==void 0&&typeof R!="function")throw new TypeError("memoMethod must be a function if defined");if(f(this,dt,R),p!==void 0&&typeof p!="function")throw new TypeError("fetchMethod must be a function if specified");if(f(this,ft,p),f(this,ht,!!p),f(this,A,new Map),f(this,b,new Array(i).fill(void 0)),f(this,d,new Array(i).fill(void 0)),f(this,W,new ut(i)),f(this,G,new ut(i)),f(this,z,0),f(this,F,0),f(this,$,te.create(i)),f(this,O,0),f(this,K,0),typeof w=="function"&&f(this,P,w),typeof x=="function"&&f(this,ot,x),typeof m=="function"?(f(this,k,m),f(this,E,[])):(f(this,k,void 0),f(this,E,void 0)),f(this,q,!!t(this,P)),f(this,pt,!!t(this,ot)),f(this,D,!!t(this,k)),this.noDisposeOnSet=!!Z,this.noUpdateTTL=!!I,this.noDeleteOnFetchRejection=!!L,this.allowStaleOnFetchRejection=!!_,this.allowStaleOnFetchAbort=!!mt,this.ignoreFetchAbort=!!lt,this.maxEntrySize!==0){if(t(this,U)!==0&&!tt(t(this,U)))throw new TypeError("maxSize must be a positive integer if specified");if(!tt(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");a(this,n,Ht).call(this);}if(this.allowStale=!!c,this.noDeleteOnStaleGet=!!C,this.updateAgeOnGet=!!o,this.updateAgeOnHas=!!u,this.ttlResolution=tt(h)||h===0?h:1,this.ttlAutopurge=!!r,this.ttl=s||0,this.ttl){if(!tt(this.ttl))throw new TypeError("ttl must be a positive integer if specified");a(this,n,Rt).call(this);}if(t(this,V)===0&&this.ttl===0&&t(this,U)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!t(this,V)&&!t(this,U)){let Et="LRU_CACHE_UNBOUNDED";Zt(Et)&&(It.add(Et),Vt("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",Et,wt));}}get perf(){return t(this,H)}static unsafeExposeInternals(e){return {starts:t(e,J),ttls:t(e,j),autopurgeTimers:t(e,M),sizes:t(e,B),keyMap:t(e,A),keyList:t(e,b),valList:t(e,d),next:t(e,W),prev:t(e,G),get head(){return t(e,z)},get tail(){return t(e,F)},free:t(e,$),isBackgroundFetch:i=>{var s;return a(s=e,n,v).call(s,i)},backgroundFetch:(i,s,h,r)=>{var o;return a(o=e,n,Ot).call(o,i,s,h,r)},moveToTail:i=>{var s;return a(s=e,n,St).call(s,i)},indexes:i=>{var s;return a(s=e,n,et).call(s,i)},rindexes:i=>{var s;return a(s=e,n,it).call(s,i)},isStale:i=>{var s;return t(s=e,N).call(s,i)}}}get max(){return t(this,V)}get maxSize(){return t(this,U)}get calculatedSize(){return t(this,K)}get size(){return t(this,O)}get fetchMethod(){return t(this,ft)}get memoMethod(){return t(this,dt)}get dispose(){return t(this,P)}get onInsert(){return t(this,ot)}get disposeAfter(){return t(this,k)}getRemainingTTL(e){return t(this,A).has(e)?1/0:0}*entries(){for(let e of a(this,n,et).call(this))t(this,d)[e]!==void 0&&t(this,b)[e]!==void 0&&!a(this,n,v).call(this,t(this,d)[e])&&(yield [t(this,b)[e],t(this,d)[e]]);}*rentries(){for(let e of a(this,n,it).call(this))t(this,d)[e]!==void 0&&t(this,b)[e]!==void 0&&!a(this,n,v).call(this,t(this,d)[e])&&(yield [t(this,b)[e],t(this,d)[e]]);}*keys(){for(let e of a(this,n,et).call(this)){let i=t(this,b)[e];i!==void 0&&!a(this,n,v).call(this,t(this,d)[e])&&(yield i);}}*rkeys(){for(let e of a(this,n,it).call(this)){let i=t(this,b)[e];i!==void 0&&!a(this,n,v).call(this,t(this,d)[e])&&(yield i);}}*values(){for(let e of a(this,n,et).call(this))t(this,d)[e]!==void 0&&!a(this,n,v).call(this,t(this,d)[e])&&(yield t(this,d)[e]);}*rvalues(){for(let e of a(this,n,it).call(this))t(this,d)[e]!==void 0&&!a(this,n,v).call(this,t(this,d)[e])&&(yield t(this,d)[e]);}[(Nt=Symbol.iterator,Mt=Symbol.toStringTag,Nt)](){return this.entries()}find(e,i={}){for(let s of a(this,n,et).call(this)){let h=t(this,d)[s],r=a(this,n,v).call(this,h)?h.__staleWhileFetching:h;if(r!==void 0&&e(r,t(this,b)[s],this))return this.get(t(this,b)[s],i)}}forEach(e,i=this){for(let s of a(this,n,et).call(this)){let h=t(this,d)[s],r=a(this,n,v).call(this,h)?h.__staleWhileFetching:h;r!==void 0&&e.call(i,r,t(this,b)[s],this);}}rforEach(e,i=this){for(let s of a(this,n,it).call(this)){let h=t(this,d)[s],r=a(this,n,v).call(this,h)?h.__staleWhileFetching:h;r!==void 0&&e.call(i,r,t(this,b)[s],this);}}purgeStale(){let e=false;for(let i of a(this,n,it).call(this,{allowStale:true}))t(this,N).call(this,i)&&(a(this,n,st).call(this,t(this,b)[i],"expire"),e=true);return e}info(e){let i=t(this,A).get(e);if(i===void 0)return;let s=t(this,d)[i],h=a(this,n,v).call(this,s)?s.__staleWhileFetching:s;if(h===void 0)return;let r={value:h};if(t(this,j)&&t(this,J)){let o=t(this,j)[i],u=t(this,J)[i];if(o&&u){let c=o-(t(this,H).now()-u);r.ttl=c,r.start=Date.now();}}return t(this,B)&&(r.size=t(this,B)[i]),r}dump(){let e=[];for(let i of a(this,n,et).call(this,{allowStale:true})){let s=t(this,b)[i],h=t(this,d)[i],r=a(this,n,v).call(this,h)?h.__staleWhileFetching:h;if(r===void 0||s===void 0)continue;let o={value:r};if(t(this,j)&&t(this,J)){o.ttl=t(this,j)[i];let u=t(this,H).now()-t(this,J)[i];o.start=Math.floor(Date.now()-u);}t(this,B)&&(o.size=t(this,B)[i]),e.unshift([s,o]);}return e}load(e){this.clear();for(let[i,s]of e){if(s.start){let h=Date.now()-s.start;s.start=t(this,H).now()-h;}this.set(i,s.value,s);}}set(e,i,s={}){var Z,I,X,y;if(i===void 0)return this.delete(e),this;let{ttl:h=this.ttl,start:r,noDisposeOnSet:o=this.noDisposeOnSet,sizeCalculation:u=this.sizeCalculation,status:c}=s,{noUpdateTTL:w=this.noUpdateTTL}=s,x=t(this,bt).call(this,e,i,s.size||0,u);if(this.maxEntrySize&&x>this.maxEntrySize)return c&&(c.set="miss",c.maxEntrySizeExceeded=true),a(this,n,st).call(this,e,"set"),this;let m=t(this,O)===0?void 0:t(this,A).get(e);if(m===void 0)m=t(this,O)===0?t(this,F):t(this,$).length!==0?t(this,$).pop():t(this,O)===t(this,V)?a(this,n,At).call(this,false):t(this,O),t(this,b)[m]=e,t(this,d)[m]=i,t(this,A).set(e,m),t(this,W)[t(this,F)]=m,t(this,G)[m]=t(this,F),f(this,F,m),yt(this,O)._++,t(this,gt).call(this,m,x,c),c&&(c.set="add"),w=false,t(this,pt)&&((Z=t(this,ot))==null||Z.call(this,i,e,"add"));else {a(this,n,St).call(this,m);let S=t(this,d)[m];if(i!==S){if(t(this,ht)&&a(this,n,v).call(this,S)){S.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:p}=S;p!==void 0&&!o&&(t(this,q)&&((I=t(this,P))==null||I.call(this,p,e,"set")),t(this,D)&&t(this,E)?.push([p,e,"set"]));}else o||(t(this,q)&&((X=t(this,P))==null||X.call(this,S,e,"set")),t(this,D)&&t(this,E)?.push([S,e,"set"]));if(t(this,nt).call(this,m),t(this,gt).call(this,m,x,c),t(this,d)[m]=i,c){c.set="replace";let p=S&&a(this,n,v).call(this,S)?S.__staleWhileFetching:S;p!==void 0&&(c.oldValue=p);}}else c&&(c.set="update");t(this,pt)&&this.onInsert?.(i,e,i===S?"update":"replace");}if(h!==0&&!t(this,j)&&a(this,n,Rt).call(this),t(this,j)&&(w||t(this,vt).call(this,m,h,r),c&&t(this,Q).call(this,c,m)),!o&&t(this,D)&&t(this,E)){let S=t(this,E),p;for(;p=S?.shift();)(y=t(this,k))==null||y.call(this,...p);}return this}pop(){var e;try{for(;t(this,O);){let i=t(this,d)[t(this,z)];if(a(this,n,At).call(this,!0),a(this,n,v).call(this,i)){if(i.__staleWhileFetching)return i.__staleWhileFetching}else if(i!==void 0)return i}}finally{if(t(this,D)&&t(this,E)){let i=t(this,E),s;for(;s=i?.shift();)(e=t(this,k))==null||e.call(this,...s);}}}has(e,i={}){let{updateAgeOnHas:s=this.updateAgeOnHas,status:h}=i,r=t(this,A).get(e);if(r!==void 0){let o=t(this,d)[r];if(a(this,n,v).call(this,o)&&o.__staleWhileFetching===void 0)return false;if(t(this,N).call(this,r))h&&(h.has="stale",t(this,Q).call(this,h,r));else return s&&t(this,rt).call(this,r),h&&(h.has="hit",t(this,Q).call(this,h,r)),true}else h&&(h.has="miss");return false}peek(e,i={}){let{allowStale:s=this.allowStale}=i,h=t(this,A).get(e);if(h===void 0||!s&&t(this,N).call(this,h))return;let r=t(this,d)[h];return a(this,n,v).call(this,r)?r.__staleWhileFetching:r}async fetch(e,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:h=this.updateAgeOnGet,noDeleteOnStaleGet:r=this.noDeleteOnStaleGet,ttl:o=this.ttl,noDisposeOnSet:u=this.noDisposeOnSet,size:c=0,sizeCalculation:w=this.sizeCalculation,noUpdateTTL:x=this.noUpdateTTL,noDeleteOnFetchRejection:m=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:Z=this.allowStaleOnFetchRejection,ignoreFetchAbort:I=this.ignoreFetchAbort,allowStaleOnFetchAbort:X=this.allowStaleOnFetchAbort,context:y,forceRefresh:S=false,status:p,signal:R}=i;if(!t(this,ht))return p&&(p.fetch="get"),this.get(e,{allowStale:s,updateAgeOnGet:h,noDeleteOnStaleGet:r,status:p});let L={allowStale:s,updateAgeOnGet:h,noDeleteOnStaleGet:r,ttl:o,noDisposeOnSet:u,size:c,sizeCalculation:w,noUpdateTTL:x,noDeleteOnFetchRejection:m,allowStaleOnFetchRejection:Z,allowStaleOnFetchAbort:X,ignoreFetchAbort:I,status:p,signal:R},C=t(this,A).get(e);if(C===void 0){p&&(p.fetch="miss");let _=a(this,n,Ot).call(this,e,C,L,y);return _.__returned=_}else {let _=t(this,d)[C];if(a(this,n,v).call(this,_)){let ut=s&&_.__staleWhileFetching!==void 0;return p&&(p.fetch="inflight",ut&&(p.returnedStale=true)),ut?_.__staleWhileFetching:_.__returned=_}let mt=t(this,N).call(this,C);if(!S&&!mt)return p&&(p.fetch="hit"),a(this,n,St).call(this,C),h&&t(this,rt).call(this,C),p&&t(this,Q).call(this,p,C),_;let lt=a(this,n,Ot).call(this,e,C,L,y),at=lt.__staleWhileFetching!==void 0&&s;return p&&(p.fetch=mt?"stale":"refresh",at&&mt&&(p.returnedStale=true)),at?lt.__staleWhileFetching:lt.__returned=lt}}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,i={}){let s=t(this,dt);if(!s)throw new Error("no memoMethod provided to constructor");let{context:h,forceRefresh:r,...o}=i,u=this.get(e,o);if(!r&&u!==void 0)return u;let c=s(e,u,{options:o,context:h});return this.set(e,c,o),c}get(e,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:h=this.updateAgeOnGet,noDeleteOnStaleGet:r=this.noDeleteOnStaleGet,status:o}=i,u=t(this,A).get(e);if(u!==void 0){let c=t(this,d)[u],w=a(this,n,v).call(this,c);return o&&t(this,Q).call(this,o,u),t(this,N).call(this,u)?(o&&(o.get="stale"),w?(o&&s&&c.__staleWhileFetching!==void 0&&(o.returnedStale=true),s?c.__staleWhileFetching:void 0):(r||a(this,n,st).call(this,e,"expire"),o&&s&&(o.returnedStale=true),s?c:void 0)):(o&&(o.get="hit"),w?c.__staleWhileFetching:(a(this,n,St).call(this,u),h&&t(this,rt).call(this,u),c))}else o&&(o.get="miss");}delete(e){return a(this,n,st).call(this,e,"delete")}clear(){return a(this,n,Dt).call(this,"delete")}},V=new WeakMap,U=new WeakMap,P=new WeakMap,ot=new WeakMap,k=new WeakMap,ft=new WeakMap,dt=new WeakMap,H=new WeakMap,O=new WeakMap,K=new WeakMap,A=new WeakMap,b=new WeakMap,d=new WeakMap,W=new WeakMap,G=new WeakMap,z=new WeakMap,F=new WeakMap,$=new WeakMap,E=new WeakMap,B=new WeakMap,J=new WeakMap,j=new WeakMap,M=new WeakMap,q=new WeakMap,ht=new WeakMap,D=new WeakMap,pt=new WeakMap,n=new WeakSet,Rt=function(){let e=new _t(t(this,V)),i=new _t(t(this,V));f(this,j,e),f(this,J,i);let s=this.ttlAutopurge?new Array(t(this,V)):void 0;f(this,M,s),f(this,vt,(u,c,w=t(this,H).now())=>{i[u]=c!==0?w:0,e[u]=c,h(u,c);}),f(this,rt,u=>{i[u]=e[u]!==0?t(this,H).now():0,h(u,e[u]);});let h=this.ttlAutopurge?(u,c)=>{if(s?.[u]&&(clearTimeout(s[u]),s[u]=void 0),c&&c!==0&&s){let w=setTimeout(()=>{t(this,N).call(this,u)&&a(this,n,st).call(this,t(this,b)[u],"expire");},c+1);w.unref&&w.unref(),s[u]=w;}}:()=>{};f(this,Q,(u,c)=>{if(e[c]){let w=e[c],x=i[c];if(!w||!x)return;u.ttl=w,u.start=x,u.now=r||o();let m=u.now-x;u.remainingTTL=w-m;}});let r=0,o=()=>{let u=t(this,H).now();if(this.ttlResolution>0){r=u;let c=setTimeout(()=>r=0,this.ttlResolution);c.unref&&c.unref();}return u};this.getRemainingTTL=u=>{let c=t(this,A).get(u);if(c===void 0)return 0;let w=e[c],x=i[c];if(!w||!x)return 1/0;let m=(r||o())-x;return w-m},f(this,N,u=>{let c=i[u],w=e[u];return !!w&&!!c&&(r||o())-c>w});},rt=new WeakMap,Q=new WeakMap,vt=new WeakMap,N=new WeakMap,Ht=function(){let e=new _t(t(this,V));f(this,K,0),f(this,B,e),f(this,nt,i=>{f(this,K,t(this,K)-e[i]),e[i]=0;}),f(this,bt,(i,s,h,r)=>{if(a(this,n,v).call(this,s))return 0;if(!tt(h))if(r){if(typeof r!="function")throw new TypeError("sizeCalculation must be a function");if(h=r(s,i),!tt(h))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}),f(this,gt,(i,s,h)=>{if(e[i]=s,t(this,U)){let r=t(this,U)-e[i];for(;t(this,K)>r;)a(this,n,At).call(this,true);}f(this,K,t(this,K)+e[i]),h&&(h.entrySize=s,h.totalCalculatedSize=t(this,K));});},nt=new WeakMap,gt=new WeakMap,bt=new WeakMap,et=function*({allowStale:e=this.allowStale}={}){if(t(this,O))for(let i=t(this,F);!(!a(this,n,Ct).call(this,i)||((e||!t(this,N).call(this,i))&&(yield i),i===t(this,z)));)i=t(this,G)[i];},it=function*({allowStale:e=this.allowStale}={}){if(t(this,O))for(let i=t(this,z);!(!a(this,n,Ct).call(this,i)||((e||!t(this,N).call(this,i))&&(yield i),i===t(this,F)));)i=t(this,W)[i];},Ct=function(e){return e!==void 0&&t(this,A).get(t(this,b)[e])===e},At=function(e){var r;let i=t(this,z),s=t(this,b)[i],h=t(this,d)[i];return t(this,ht)&&a(this,n,v).call(this,h)?h.__abortController.abort(new Error("evicted")):(t(this,q)||t(this,D))&&(t(this,q)&&((r=t(this,P))==null||r.call(this,h,s,"evict")),t(this,D)&&t(this,E)?.push([h,s,"evict"])),t(this,nt).call(this,i),t(this,M)?.[i]&&(clearTimeout(t(this,M)[i]),t(this,M)[i]=void 0),e&&(t(this,b)[i]=void 0,t(this,d)[i]=void 0,t(this,$).push(i)),t(this,O)===1?(f(this,z,f(this,F,0)),t(this,$).length=0):f(this,z,t(this,W)[i]),t(this,A).delete(s),yt(this,O)._--,i},Ot=function(e,i,s,h){let r=i===void 0?void 0:t(this,d)[i];if(a(this,n,v).call(this,r))return r;let o=new Ft,{signal:u}=s;u?.addEventListener("abort",()=>o.abort(u.reason),{signal:o.signal});let c={signal:o.signal,options:s,context:h},w=(y,S=false)=>{let{aborted:p}=o.signal,R=s.ignoreFetchAbort&&y!==void 0,L=s.ignoreFetchAbort||!!(s.allowStaleOnFetchAbort&&y!==void 0);if(s.status&&(p&&!S?(s.status.fetchAborted=true,s.status.fetchError=o.signal.reason,R&&(s.status.fetchAbortIgnored=true)):s.status.fetchResolved=true),p&&!R&&!S)return m(o.signal.reason,L);let C=I,_=t(this,d)[i];return (_===I||R&&S&&_===void 0)&&(y===void 0?C.__staleWhileFetching!==void 0?t(this,d)[i]=C.__staleWhileFetching:a(this,n,st).call(this,e,"fetch"):(s.status&&(s.status.fetchUpdated=true),this.set(e,y,c.options))),y},x=y=>(s.status&&(s.status.fetchRejected=true,s.status.fetchError=y),m(y,false)),m=(y,S)=>{let{aborted:p}=o.signal,R=p&&s.allowStaleOnFetchAbort,L=R||s.allowStaleOnFetchRejection,C=L||s.noDeleteOnFetchRejection,_=I;if(t(this,d)[i]===I&&(!C||!S&&_.__staleWhileFetching===void 0?a(this,n,st).call(this,e,"fetch"):R||(t(this,d)[i]=_.__staleWhileFetching)),L)return s.status&&_.__staleWhileFetching!==void 0&&(s.status.returnedStale=true),_.__staleWhileFetching;if(_.__returned===_)throw y},Z=(y,S)=>{var R;let p=(R=t(this,ft))==null?void 0:R.call(this,e,r,c);p&&p instanceof Promise&&p.then(L=>y(L===void 0?void 0:L),S),o.signal.addEventListener("abort",()=>{(!s.ignoreFetchAbort||s.allowStaleOnFetchAbort)&&(y(void 0),s.allowStaleOnFetchAbort&&(y=L=>w(L,true)));});};s.status&&(s.status.fetchDispatched=true);let I=new Promise(Z).then(w,x),X=Object.assign(I,{__abortController:o,__staleWhileFetching:r,__returned:void 0});return i===void 0?(this.set(e,X,{...c.options,status:void 0}),i=t(this,A).get(e)):t(this,d)[i]=X,X},v=function(e){if(!t(this,ht))return false;let i=e;return !!i&&i instanceof Promise&&i.hasOwnProperty("__staleWhileFetching")&&i.__abortController instanceof Ft},Wt=function(e,i){t(this,G)[i]=e,t(this,W)[e]=i;},St=function(e){e!==t(this,F)&&(e===t(this,z)?f(this,z,t(this,W)[e]):a(this,n,Wt).call(this,t(this,G)[e],t(this,W)[e]),a(this,n,Wt).call(this,t(this,F),e),f(this,F,e));},st=function(e,i){var h,r;let s=false;if(t(this,O)!==0){let o=t(this,A).get(e);if(o!==void 0)if(t(this,M)?.[o]&&(clearTimeout(t(this,M)?.[o]),t(this,M)[o]=void 0),s=true,t(this,O)===1)a(this,n,Dt).call(this,i);else {t(this,nt).call(this,o);let u=t(this,d)[o];if(a(this,n,v).call(this,u)?u.__abortController.abort(new Error("deleted")):(t(this,q)||t(this,D))&&(t(this,q)&&((h=t(this,P))==null||h.call(this,u,e,i)),t(this,D)&&t(this,E)?.push([u,e,i])),t(this,A).delete(e),t(this,b)[o]=void 0,t(this,d)[o]=void 0,o===t(this,F))f(this,F,t(this,G)[o]);else if(o===t(this,z))f(this,z,t(this,W)[o]);else {let c=t(this,G)[o];t(this,W)[c]=t(this,W)[o];let w=t(this,W)[o];t(this,G)[w]=t(this,G)[o];}yt(this,O)._--,t(this,$).push(o);}}if(t(this,D)&&t(this,E)?.length){let o=t(this,E),u;for(;u=o?.shift();)(r=t(this,k))==null||r.call(this,...u);}return s},Dt=function(e){var i,s;for(let h of a(this,n,it).call(this,{allowStale:true})){let r=t(this,d)[h];if(a(this,n,v).call(this,r))r.__abortController.abort(new Error("deleted"));else {let o=t(this,b)[h];t(this,q)&&((i=t(this,P))==null||i.call(this,r,o,e)),t(this,D)&&t(this,E)?.push([r,o,e]);}}if(t(this,A).clear(),t(this,d).fill(void 0),t(this,b).fill(void 0),t(this,j)&&t(this,J)){t(this,j).fill(0),t(this,J).fill(0);for(let h of t(this,M)??[])h!==void 0&&clearTimeout(h);t(this,M)?.fill(void 0);}if(t(this,B)&&t(this,B).fill(0),f(this,z,0),f(this,F,0),t(this,$).length=0,f(this,K,0),f(this,O,0),t(this,D)&&t(this,E)){let h=t(this,E),r;for(;r=h?.shift();)(s=t(this,k))==null||s.call(this,...r);}},wt);var Lt=class{cache;map=new Map;constructor(e){this.cache=new kt({max:e.cacheSize}),this.map=new Map;}get[Symbol.iterator](){return this.map[Symbol.iterator]}get[Symbol.toStringTag](){return this.map[Symbol.toStringTag]}clear(){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()}};var Ut;(h=>(h.log=(r,...o)=>console.log(`[Pixi\u2019VN] ${r}`,...o),h.warn=(r,...o)=>console.warn(`[Pixi\u2019VN] ${r}`,...o),h.error=(r,...o)=>console.error(`[Pixi\u2019VN] ${r}`,...o),h.info=(r,...o)=>console.info(`[Pixi\u2019VN] ${r}`,...o)))(Ut||={});function we(l){try{if(typeof l>"u")return l;let e=JSON.stringify(l);return JSON.parse(e)}catch(e){throw Ut.error("Error creating exportable element",l,e),new PixiError("not_json_serializable","Error creating exportable element")}}export{ie as a,se as b,he as c,Lt as d,Ut as e,we as f};
|
|
1
|
+
import {PixiError}from'@drincs/pixi-vn/core';var Kt=Object.create;var xt=Object.defineProperty;var $t=Object.getOwnPropertyDescriptor;var Bt=Object.getOwnPropertyNames;var Jt=Object.getPrototypeOf,qt=Object.prototype.hasOwnProperty;var Gt=l=>{throw TypeError(l)};var Xt=(l,e,i)=>e in l?xt(l,e,{enumerable:true,configurable:true,writable:true,value:i}):l[e]=i;var ie=(l=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(l,{get:(e,i)=>(typeof require<"u"?require:e)[i]}):l)(function(l){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+l+'" is not supported')});var se=(l,e)=>()=>(e||l((e={exports:{}}).exports,e),e.exports);var Yt=(l,e,i,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let h of Bt(e))!qt.call(l,h)&&h!==i&&xt(l,h,{get:()=>e[h],enumerable:!(s=$t(e,h))||s.enumerable});return l};var he=(l,e,i)=>(i=l!=null?Kt(Jt(l)):{},Yt(e||!l||!l.__esModule?xt(i,"default",{value:l,enumerable:true}):i,l));var T=(l,e,i)=>Xt(l,typeof e!="symbol"?e+"":e,i),Tt=(l,e,i)=>e.has(l)||Gt("Cannot "+i);var t=(l,e,i)=>(Tt(l,e,"read from private field"),i?i.call(l):e.get(l)),g=(l,e,i)=>e.has(l)?Gt("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(l):e.set(l,i),f=(l,e,i,s)=>(Tt(l,e,"write to private field"),e.set(l,i),i),a=(l,e,i)=>(Tt(l,e,"access private method"),i);var yt=(l,e,i,s)=>({set _(h){f(l,e,h);},get _(){return t(l,e,s)}});var Qt=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,It=new Set,zt=typeof process=="object"&&process?process:{},Vt=(l,e,i,s)=>{typeof zt.emitWarning=="function"?zt.emitWarning(l,e,i,s):console.error(`[${i}] ${e}: ${l}`);},Ft=globalThis.AbortController,jt=globalThis.AbortSignal;if(typeof Ft>"u"){jt=class{onabort;_onabort=[];reason;aborted=false;addEventListener(i,s){this._onabort.push(s);}},Ft=class{constructor(){e();}signal=new jt;abort(i){if(!this.signal.aborted){this.signal.reason=i,this.signal.aborted=true;for(let s of this.signal._onabort)s(i);this.signal.onabort?.(i);}}};let l=zt.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{l&&(l=false,Vt("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 Zt=l=>!It.has(l);var tt=l=>l&&l===Math.floor(l)&&l>0&&isFinite(l),Pt=l=>tt(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(l){super(l),this.fill(0);}},Y,ct,te=(Y=class{heap;length;static create(e){let i=Pt(e);if(!i)return [];f(Y,ct,true);let s=new Y(e,i);return f(Y,ct,false),s}constructor(e,i){if(!t(Y,ct))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new i(e),this.length=0;}push(e){this.heap[this.length++]=e;}pop(){return this.heap[--this.length]}},ct=new WeakMap,g(Y,ct,false),Y),Mt,Nt,V,U,P,ot,k,ft,dt,H,O,K,A,b,d,W,G,z,F,$,E,B,J,j,M,q,ht,D,pt,n,Rt,rt,Q,vt,N,Ht,nt,gt,bt,et,it,Ct,At,Ot,v,Wt,St,st,Dt,wt,kt=(wt=class{constructor(e){g(this,n);g(this,V);g(this,U);g(this,P);g(this,ot);g(this,k);g(this,ft);g(this,dt);g(this,H);T(this,"ttl");T(this,"ttlResolution");T(this,"ttlAutopurge");T(this,"updateAgeOnGet");T(this,"updateAgeOnHas");T(this,"allowStale");T(this,"noDisposeOnSet");T(this,"noUpdateTTL");T(this,"maxEntrySize");T(this,"sizeCalculation");T(this,"noDeleteOnFetchRejection");T(this,"noDeleteOnStaleGet");T(this,"allowStaleOnFetchAbort");T(this,"allowStaleOnFetchRejection");T(this,"ignoreFetchAbort");g(this,O);g(this,K);g(this,A);g(this,b);g(this,d);g(this,W);g(this,G);g(this,z);g(this,F);g(this,$);g(this,E);g(this,B);g(this,J);g(this,j);g(this,M);g(this,q);g(this,ht);g(this,D);g(this,pt);g(this,rt,()=>{});g(this,Q,()=>{});g(this,vt,()=>{});g(this,N,()=>false);g(this,nt,e=>{});g(this,gt,(e,i,s)=>{});g(this,bt,(e,i,s,h)=>{if(s||h)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});T(this,Mt,"LRUCache");let{max:i=0,ttl:s,ttlResolution:h=1,ttlAutopurge:r,updateAgeOnGet:o,updateAgeOnHas:u,allowStale:c,dispose:w,onInsert:x,disposeAfter:m,noDisposeOnSet:Z,noUpdateTTL:I,maxSize:X=0,maxEntrySize:y=0,sizeCalculation:S,fetchMethod:p,memoMethod:R,noDeleteOnFetchRejection:L,noDeleteOnStaleGet:C,allowStaleOnFetchRejection:_,allowStaleOnFetchAbort:mt,ignoreFetchAbort:lt,perf:at}=e;if(at!==void 0&&typeof at?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(f(this,H,at??Qt),i!==0&&!tt(i))throw new TypeError("max option must be a nonnegative integer");let ut=i?Pt(i):Array;if(!ut)throw new Error("invalid max value: "+i);if(f(this,V,i),f(this,U,X),this.maxEntrySize=y||t(this,U),this.sizeCalculation=S,this.sizeCalculation){if(!t(this,U)&&!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(R!==void 0&&typeof R!="function")throw new TypeError("memoMethod must be a function if defined");if(f(this,dt,R),p!==void 0&&typeof p!="function")throw new TypeError("fetchMethod must be a function if specified");if(f(this,ft,p),f(this,ht,!!p),f(this,A,new Map),f(this,b,new Array(i).fill(void 0)),f(this,d,new Array(i).fill(void 0)),f(this,W,new ut(i)),f(this,G,new ut(i)),f(this,z,0),f(this,F,0),f(this,$,te.create(i)),f(this,O,0),f(this,K,0),typeof w=="function"&&f(this,P,w),typeof x=="function"&&f(this,ot,x),typeof m=="function"?(f(this,k,m),f(this,E,[])):(f(this,k,void 0),f(this,E,void 0)),f(this,q,!!t(this,P)),f(this,pt,!!t(this,ot)),f(this,D,!!t(this,k)),this.noDisposeOnSet=!!Z,this.noUpdateTTL=!!I,this.noDeleteOnFetchRejection=!!L,this.allowStaleOnFetchRejection=!!_,this.allowStaleOnFetchAbort=!!mt,this.ignoreFetchAbort=!!lt,this.maxEntrySize!==0){if(t(this,U)!==0&&!tt(t(this,U)))throw new TypeError("maxSize must be a positive integer if specified");if(!tt(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");a(this,n,Ht).call(this);}if(this.allowStale=!!c,this.noDeleteOnStaleGet=!!C,this.updateAgeOnGet=!!o,this.updateAgeOnHas=!!u,this.ttlResolution=tt(h)||h===0?h:1,this.ttlAutopurge=!!r,this.ttl=s||0,this.ttl){if(!tt(this.ttl))throw new TypeError("ttl must be a positive integer if specified");a(this,n,Rt).call(this);}if(t(this,V)===0&&this.ttl===0&&t(this,U)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!t(this,V)&&!t(this,U)){let Et="LRU_CACHE_UNBOUNDED";Zt(Et)&&(It.add(Et),Vt("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",Et,wt));}}get perf(){return t(this,H)}static unsafeExposeInternals(e){return {starts:t(e,J),ttls:t(e,j),autopurgeTimers:t(e,M),sizes:t(e,B),keyMap:t(e,A),keyList:t(e,b),valList:t(e,d),next:t(e,W),prev:t(e,G),get head(){return t(e,z)},get tail(){return t(e,F)},free:t(e,$),isBackgroundFetch:i=>{var s;return a(s=e,n,v).call(s,i)},backgroundFetch:(i,s,h,r)=>{var o;return a(o=e,n,Ot).call(o,i,s,h,r)},moveToTail:i=>{var s;return a(s=e,n,St).call(s,i)},indexes:i=>{var s;return a(s=e,n,et).call(s,i)},rindexes:i=>{var s;return a(s=e,n,it).call(s,i)},isStale:i=>{var s;return t(s=e,N).call(s,i)}}}get max(){return t(this,V)}get maxSize(){return t(this,U)}get calculatedSize(){return t(this,K)}get size(){return t(this,O)}get fetchMethod(){return t(this,ft)}get memoMethod(){return t(this,dt)}get dispose(){return t(this,P)}get onInsert(){return t(this,ot)}get disposeAfter(){return t(this,k)}getRemainingTTL(e){return t(this,A).has(e)?1/0:0}*entries(){for(let e of a(this,n,et).call(this))t(this,d)[e]!==void 0&&t(this,b)[e]!==void 0&&!a(this,n,v).call(this,t(this,d)[e])&&(yield [t(this,b)[e],t(this,d)[e]]);}*rentries(){for(let e of a(this,n,it).call(this))t(this,d)[e]!==void 0&&t(this,b)[e]!==void 0&&!a(this,n,v).call(this,t(this,d)[e])&&(yield [t(this,b)[e],t(this,d)[e]]);}*keys(){for(let e of a(this,n,et).call(this)){let i=t(this,b)[e];i!==void 0&&!a(this,n,v).call(this,t(this,d)[e])&&(yield i);}}*rkeys(){for(let e of a(this,n,it).call(this)){let i=t(this,b)[e];i!==void 0&&!a(this,n,v).call(this,t(this,d)[e])&&(yield i);}}*values(){for(let e of a(this,n,et).call(this))t(this,d)[e]!==void 0&&!a(this,n,v).call(this,t(this,d)[e])&&(yield t(this,d)[e]);}*rvalues(){for(let e of a(this,n,it).call(this))t(this,d)[e]!==void 0&&!a(this,n,v).call(this,t(this,d)[e])&&(yield t(this,d)[e]);}[(Nt=Symbol.iterator,Mt=Symbol.toStringTag,Nt)](){return this.entries()}find(e,i={}){for(let s of a(this,n,et).call(this)){let h=t(this,d)[s],r=a(this,n,v).call(this,h)?h.__staleWhileFetching:h;if(r!==void 0&&e(r,t(this,b)[s],this))return this.get(t(this,b)[s],i)}}forEach(e,i=this){for(let s of a(this,n,et).call(this)){let h=t(this,d)[s],r=a(this,n,v).call(this,h)?h.__staleWhileFetching:h;r!==void 0&&e.call(i,r,t(this,b)[s],this);}}rforEach(e,i=this){for(let s of a(this,n,it).call(this)){let h=t(this,d)[s],r=a(this,n,v).call(this,h)?h.__staleWhileFetching:h;r!==void 0&&e.call(i,r,t(this,b)[s],this);}}purgeStale(){let e=false;for(let i of a(this,n,it).call(this,{allowStale:true}))t(this,N).call(this,i)&&(a(this,n,st).call(this,t(this,b)[i],"expire"),e=true);return e}info(e){let i=t(this,A).get(e);if(i===void 0)return;let s=t(this,d)[i],h=a(this,n,v).call(this,s)?s.__staleWhileFetching:s;if(h===void 0)return;let r={value:h};if(t(this,j)&&t(this,J)){let o=t(this,j)[i],u=t(this,J)[i];if(o&&u){let c=o-(t(this,H).now()-u);r.ttl=c,r.start=Date.now();}}return t(this,B)&&(r.size=t(this,B)[i]),r}dump(){let e=[];for(let i of a(this,n,et).call(this,{allowStale:true})){let s=t(this,b)[i],h=t(this,d)[i],r=a(this,n,v).call(this,h)?h.__staleWhileFetching:h;if(r===void 0||s===void 0)continue;let o={value:r};if(t(this,j)&&t(this,J)){o.ttl=t(this,j)[i];let u=t(this,H).now()-t(this,J)[i];o.start=Math.floor(Date.now()-u);}t(this,B)&&(o.size=t(this,B)[i]),e.unshift([s,o]);}return e}load(e){this.clear();for(let[i,s]of e){if(s.start){let h=Date.now()-s.start;s.start=t(this,H).now()-h;}this.set(i,s.value,s);}}set(e,i,s={}){var Z,I,X,y;if(i===void 0)return this.delete(e),this;let{ttl:h=this.ttl,start:r,noDisposeOnSet:o=this.noDisposeOnSet,sizeCalculation:u=this.sizeCalculation,status:c}=s,{noUpdateTTL:w=this.noUpdateTTL}=s,x=t(this,bt).call(this,e,i,s.size||0,u);if(this.maxEntrySize&&x>this.maxEntrySize)return c&&(c.set="miss",c.maxEntrySizeExceeded=true),a(this,n,st).call(this,e,"set"),this;let m=t(this,O)===0?void 0:t(this,A).get(e);if(m===void 0)m=t(this,O)===0?t(this,F):t(this,$).length!==0?t(this,$).pop():t(this,O)===t(this,V)?a(this,n,At).call(this,false):t(this,O),t(this,b)[m]=e,t(this,d)[m]=i,t(this,A).set(e,m),t(this,W)[t(this,F)]=m,t(this,G)[m]=t(this,F),f(this,F,m),yt(this,O)._++,t(this,gt).call(this,m,x,c),c&&(c.set="add"),w=false,t(this,pt)&&((Z=t(this,ot))==null||Z.call(this,i,e,"add"));else {a(this,n,St).call(this,m);let S=t(this,d)[m];if(i!==S){if(t(this,ht)&&a(this,n,v).call(this,S)){S.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:p}=S;p!==void 0&&!o&&(t(this,q)&&((I=t(this,P))==null||I.call(this,p,e,"set")),t(this,D)&&t(this,E)?.push([p,e,"set"]));}else o||(t(this,q)&&((X=t(this,P))==null||X.call(this,S,e,"set")),t(this,D)&&t(this,E)?.push([S,e,"set"]));if(t(this,nt).call(this,m),t(this,gt).call(this,m,x,c),t(this,d)[m]=i,c){c.set="replace";let p=S&&a(this,n,v).call(this,S)?S.__staleWhileFetching:S;p!==void 0&&(c.oldValue=p);}}else c&&(c.set="update");t(this,pt)&&this.onInsert?.(i,e,i===S?"update":"replace");}if(h!==0&&!t(this,j)&&a(this,n,Rt).call(this),t(this,j)&&(w||t(this,vt).call(this,m,h,r),c&&t(this,Q).call(this,c,m)),!o&&t(this,D)&&t(this,E)){let S=t(this,E),p;for(;p=S?.shift();)(y=t(this,k))==null||y.call(this,...p);}return this}pop(){var e;try{for(;t(this,O);){let i=t(this,d)[t(this,z)];if(a(this,n,At).call(this,!0),a(this,n,v).call(this,i)){if(i.__staleWhileFetching)return i.__staleWhileFetching}else if(i!==void 0)return i}}finally{if(t(this,D)&&t(this,E)){let i=t(this,E),s;for(;s=i?.shift();)(e=t(this,k))==null||e.call(this,...s);}}}has(e,i={}){let{updateAgeOnHas:s=this.updateAgeOnHas,status:h}=i,r=t(this,A).get(e);if(r!==void 0){let o=t(this,d)[r];if(a(this,n,v).call(this,o)&&o.__staleWhileFetching===void 0)return false;if(t(this,N).call(this,r))h&&(h.has="stale",t(this,Q).call(this,h,r));else return s&&t(this,rt).call(this,r),h&&(h.has="hit",t(this,Q).call(this,h,r)),true}else h&&(h.has="miss");return false}peek(e,i={}){let{allowStale:s=this.allowStale}=i,h=t(this,A).get(e);if(h===void 0||!s&&t(this,N).call(this,h))return;let r=t(this,d)[h];return a(this,n,v).call(this,r)?r.__staleWhileFetching:r}async fetch(e,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:h=this.updateAgeOnGet,noDeleteOnStaleGet:r=this.noDeleteOnStaleGet,ttl:o=this.ttl,noDisposeOnSet:u=this.noDisposeOnSet,size:c=0,sizeCalculation:w=this.sizeCalculation,noUpdateTTL:x=this.noUpdateTTL,noDeleteOnFetchRejection:m=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:Z=this.allowStaleOnFetchRejection,ignoreFetchAbort:I=this.ignoreFetchAbort,allowStaleOnFetchAbort:X=this.allowStaleOnFetchAbort,context:y,forceRefresh:S=false,status:p,signal:R}=i;if(!t(this,ht))return p&&(p.fetch="get"),this.get(e,{allowStale:s,updateAgeOnGet:h,noDeleteOnStaleGet:r,status:p});let L={allowStale:s,updateAgeOnGet:h,noDeleteOnStaleGet:r,ttl:o,noDisposeOnSet:u,size:c,sizeCalculation:w,noUpdateTTL:x,noDeleteOnFetchRejection:m,allowStaleOnFetchRejection:Z,allowStaleOnFetchAbort:X,ignoreFetchAbort:I,status:p,signal:R},C=t(this,A).get(e);if(C===void 0){p&&(p.fetch="miss");let _=a(this,n,Ot).call(this,e,C,L,y);return _.__returned=_}else {let _=t(this,d)[C];if(a(this,n,v).call(this,_)){let ut=s&&_.__staleWhileFetching!==void 0;return p&&(p.fetch="inflight",ut&&(p.returnedStale=true)),ut?_.__staleWhileFetching:_.__returned=_}let mt=t(this,N).call(this,C);if(!S&&!mt)return p&&(p.fetch="hit"),a(this,n,St).call(this,C),h&&t(this,rt).call(this,C),p&&t(this,Q).call(this,p,C),_;let lt=a(this,n,Ot).call(this,e,C,L,y),at=lt.__staleWhileFetching!==void 0&&s;return p&&(p.fetch=mt?"stale":"refresh",at&&mt&&(p.returnedStale=true)),at?lt.__staleWhileFetching:lt.__returned=lt}}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,i={}){let s=t(this,dt);if(!s)throw new Error("no memoMethod provided to constructor");let{context:h,forceRefresh:r,...o}=i,u=this.get(e,o);if(!r&&u!==void 0)return u;let c=s(e,u,{options:o,context:h});return this.set(e,c,o),c}get(e,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:h=this.updateAgeOnGet,noDeleteOnStaleGet:r=this.noDeleteOnStaleGet,status:o}=i,u=t(this,A).get(e);if(u!==void 0){let c=t(this,d)[u],w=a(this,n,v).call(this,c);return o&&t(this,Q).call(this,o,u),t(this,N).call(this,u)?(o&&(o.get="stale"),w?(o&&s&&c.__staleWhileFetching!==void 0&&(o.returnedStale=true),s?c.__staleWhileFetching:void 0):(r||a(this,n,st).call(this,e,"expire"),o&&s&&(o.returnedStale=true),s?c:void 0)):(o&&(o.get="hit"),w?c.__staleWhileFetching:(a(this,n,St).call(this,u),h&&t(this,rt).call(this,u),c))}else o&&(o.get="miss");}delete(e){return a(this,n,st).call(this,e,"delete")}clear(){return a(this,n,Dt).call(this,"delete")}},V=new WeakMap,U=new WeakMap,P=new WeakMap,ot=new WeakMap,k=new WeakMap,ft=new WeakMap,dt=new WeakMap,H=new WeakMap,O=new WeakMap,K=new WeakMap,A=new WeakMap,b=new WeakMap,d=new WeakMap,W=new WeakMap,G=new WeakMap,z=new WeakMap,F=new WeakMap,$=new WeakMap,E=new WeakMap,B=new WeakMap,J=new WeakMap,j=new WeakMap,M=new WeakMap,q=new WeakMap,ht=new WeakMap,D=new WeakMap,pt=new WeakMap,n=new WeakSet,Rt=function(){let e=new _t(t(this,V)),i=new _t(t(this,V));f(this,j,e),f(this,J,i);let s=this.ttlAutopurge?new Array(t(this,V)):void 0;f(this,M,s),f(this,vt,(u,c,w=t(this,H).now())=>{i[u]=c!==0?w:0,e[u]=c,h(u,c);}),f(this,rt,u=>{i[u]=e[u]!==0?t(this,H).now():0,h(u,e[u]);});let h=this.ttlAutopurge?(u,c)=>{if(s?.[u]&&(clearTimeout(s[u]),s[u]=void 0),c&&c!==0&&s){let w=setTimeout(()=>{t(this,N).call(this,u)&&a(this,n,st).call(this,t(this,b)[u],"expire");},c+1);w.unref&&w.unref(),s[u]=w;}}:()=>{};f(this,Q,(u,c)=>{if(e[c]){let w=e[c],x=i[c];if(!w||!x)return;u.ttl=w,u.start=x,u.now=r||o();let m=u.now-x;u.remainingTTL=w-m;}});let r=0,o=()=>{let u=t(this,H).now();if(this.ttlResolution>0){r=u;let c=setTimeout(()=>r=0,this.ttlResolution);c.unref&&c.unref();}return u};this.getRemainingTTL=u=>{let c=t(this,A).get(u);if(c===void 0)return 0;let w=e[c],x=i[c];if(!w||!x)return 1/0;let m=(r||o())-x;return w-m},f(this,N,u=>{let c=i[u],w=e[u];return !!w&&!!c&&(r||o())-c>w});},rt=new WeakMap,Q=new WeakMap,vt=new WeakMap,N=new WeakMap,Ht=function(){let e=new _t(t(this,V));f(this,K,0),f(this,B,e),f(this,nt,i=>{f(this,K,t(this,K)-e[i]),e[i]=0;}),f(this,bt,(i,s,h,r)=>{if(a(this,n,v).call(this,s))return 0;if(!tt(h))if(r){if(typeof r!="function")throw new TypeError("sizeCalculation must be a function");if(h=r(s,i),!tt(h))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}),f(this,gt,(i,s,h)=>{if(e[i]=s,t(this,U)){let r=t(this,U)-e[i];for(;t(this,K)>r;)a(this,n,At).call(this,true);}f(this,K,t(this,K)+e[i]),h&&(h.entrySize=s,h.totalCalculatedSize=t(this,K));});},nt=new WeakMap,gt=new WeakMap,bt=new WeakMap,et=function*({allowStale:e=this.allowStale}={}){if(t(this,O))for(let i=t(this,F);!(!a(this,n,Ct).call(this,i)||((e||!t(this,N).call(this,i))&&(yield i),i===t(this,z)));)i=t(this,G)[i];},it=function*({allowStale:e=this.allowStale}={}){if(t(this,O))for(let i=t(this,z);!(!a(this,n,Ct).call(this,i)||((e||!t(this,N).call(this,i))&&(yield i),i===t(this,F)));)i=t(this,W)[i];},Ct=function(e){return e!==void 0&&t(this,A).get(t(this,b)[e])===e},At=function(e){var r;let i=t(this,z),s=t(this,b)[i],h=t(this,d)[i];return t(this,ht)&&a(this,n,v).call(this,h)?h.__abortController.abort(new Error("evicted")):(t(this,q)||t(this,D))&&(t(this,q)&&((r=t(this,P))==null||r.call(this,h,s,"evict")),t(this,D)&&t(this,E)?.push([h,s,"evict"])),t(this,nt).call(this,i),t(this,M)?.[i]&&(clearTimeout(t(this,M)[i]),t(this,M)[i]=void 0),e&&(t(this,b)[i]=void 0,t(this,d)[i]=void 0,t(this,$).push(i)),t(this,O)===1?(f(this,z,f(this,F,0)),t(this,$).length=0):f(this,z,t(this,W)[i]),t(this,A).delete(s),yt(this,O)._--,i},Ot=function(e,i,s,h){let r=i===void 0?void 0:t(this,d)[i];if(a(this,n,v).call(this,r))return r;let o=new Ft,{signal:u}=s;u?.addEventListener("abort",()=>o.abort(u.reason),{signal:o.signal});let c={signal:o.signal,options:s,context:h},w=(y,S=false)=>{let{aborted:p}=o.signal,R=s.ignoreFetchAbort&&y!==void 0,L=s.ignoreFetchAbort||!!(s.allowStaleOnFetchAbort&&y!==void 0);if(s.status&&(p&&!S?(s.status.fetchAborted=true,s.status.fetchError=o.signal.reason,R&&(s.status.fetchAbortIgnored=true)):s.status.fetchResolved=true),p&&!R&&!S)return m(o.signal.reason,L);let C=I,_=t(this,d)[i];return (_===I||R&&S&&_===void 0)&&(y===void 0?C.__staleWhileFetching!==void 0?t(this,d)[i]=C.__staleWhileFetching:a(this,n,st).call(this,e,"fetch"):(s.status&&(s.status.fetchUpdated=true),this.set(e,y,c.options))),y},x=y=>(s.status&&(s.status.fetchRejected=true,s.status.fetchError=y),m(y,false)),m=(y,S)=>{let{aborted:p}=o.signal,R=p&&s.allowStaleOnFetchAbort,L=R||s.allowStaleOnFetchRejection,C=L||s.noDeleteOnFetchRejection,_=I;if(t(this,d)[i]===I&&(!C||!S&&_.__staleWhileFetching===void 0?a(this,n,st).call(this,e,"fetch"):R||(t(this,d)[i]=_.__staleWhileFetching)),L)return s.status&&_.__staleWhileFetching!==void 0&&(s.status.returnedStale=true),_.__staleWhileFetching;if(_.__returned===_)throw y},Z=(y,S)=>{var R;let p=(R=t(this,ft))==null?void 0:R.call(this,e,r,c);p&&p instanceof Promise&&p.then(L=>y(L===void 0?void 0:L),S),o.signal.addEventListener("abort",()=>{(!s.ignoreFetchAbort||s.allowStaleOnFetchAbort)&&(y(void 0),s.allowStaleOnFetchAbort&&(y=L=>w(L,true)));});};s.status&&(s.status.fetchDispatched=true);let I=new Promise(Z).then(w,x),X=Object.assign(I,{__abortController:o,__staleWhileFetching:r,__returned:void 0});return i===void 0?(this.set(e,X,{...c.options,status:void 0}),i=t(this,A).get(e)):t(this,d)[i]=X,X},v=function(e){if(!t(this,ht))return false;let i=e;return !!i&&i instanceof Promise&&i.hasOwnProperty("__staleWhileFetching")&&i.__abortController instanceof Ft},Wt=function(e,i){t(this,G)[i]=e,t(this,W)[e]=i;},St=function(e){e!==t(this,F)&&(e===t(this,z)?f(this,z,t(this,W)[e]):a(this,n,Wt).call(this,t(this,G)[e],t(this,W)[e]),a(this,n,Wt).call(this,t(this,F),e),f(this,F,e));},st=function(e,i){var h,r;let s=false;if(t(this,O)!==0){let o=t(this,A).get(e);if(o!==void 0)if(t(this,M)?.[o]&&(clearTimeout(t(this,M)?.[o]),t(this,M)[o]=void 0),s=true,t(this,O)===1)a(this,n,Dt).call(this,i);else {t(this,nt).call(this,o);let u=t(this,d)[o];if(a(this,n,v).call(this,u)?u.__abortController.abort(new Error("deleted")):(t(this,q)||t(this,D))&&(t(this,q)&&((h=t(this,P))==null||h.call(this,u,e,i)),t(this,D)&&t(this,E)?.push([u,e,i])),t(this,A).delete(e),t(this,b)[o]=void 0,t(this,d)[o]=void 0,o===t(this,F))f(this,F,t(this,G)[o]);else if(o===t(this,z))f(this,z,t(this,W)[o]);else {let c=t(this,G)[o];t(this,W)[c]=t(this,W)[o];let w=t(this,W)[o];t(this,G)[w]=t(this,G)[o];}yt(this,O)._--,t(this,$).push(o);}}if(t(this,D)&&t(this,E)?.length){let o=t(this,E),u;for(;u=o?.shift();)(r=t(this,k))==null||r.call(this,...u);}return s},Dt=function(e){var i,s;for(let h of a(this,n,it).call(this,{allowStale:true})){let r=t(this,d)[h];if(a(this,n,v).call(this,r))r.__abortController.abort(new Error("deleted"));else {let o=t(this,b)[h];t(this,q)&&((i=t(this,P))==null||i.call(this,r,o,e)),t(this,D)&&t(this,E)?.push([r,o,e]);}}if(t(this,A).clear(),t(this,d).fill(void 0),t(this,b).fill(void 0),t(this,j)&&t(this,J)){t(this,j).fill(0),t(this,J).fill(0);for(let h of t(this,M)??[])h!==void 0&&clearTimeout(h);t(this,M)?.fill(void 0);}if(t(this,B)&&t(this,B).fill(0),f(this,z,0),f(this,F,0),t(this,$).length=0,f(this,K,0),f(this,O,0),t(this,D)&&t(this,E)){let h=t(this,E),r;for(;r=h?.shift();)(s=t(this,k))==null||s.call(this,...r);}},wt);var Lt=class{cache;map=new Map;constructor(e){this.cache=new kt({max:e.cacheSize}),this.map=new Map;}get[Symbol.iterator](){return this.map[Symbol.iterator]}get[Symbol.toStringTag](){return this.map[Symbol.toStringTag]}clear(){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()}};var Ut;(h=>(h.log=(r,...o)=>console.log(`[Pixi\u2019VN] ${r}`,...o),h.warn=(r,...o)=>console.warn(`[Pixi\u2019VN] ${r}`,...o),h.error=(r,...o)=>console.error(`[Pixi\u2019VN] ${r}`,...o),h.info=(r,...o)=>console.info(`[Pixi\u2019VN] ${r}`,...o)))(Ut||={});function we(l){try{if(typeof l>"u")return l;let e=JSON.stringify(l);return JSON.parse(e)}catch(e){throw Ut.error("Error creating exportable element",l,e),new PixiError("not_json_serializable","Error creating exportable element")}}export{ie as a,se as b,he as c,Lt as d,Ut as e,we as f};
|
package/dist/history.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var core=require('./core.cjs');var Yt=Object.defineProperty;var Wt=c=>{throw TypeError(c)};var Xt=(c,t,i)=>t in c?Yt(c,t,{enumerable:true,configurable:true,writable:true,value:i}):c[t]=i;var D=(c,t,i)=>Xt(c,typeof t!="symbol"?t+"":t,i),Mt=(c,t,i)=>t.has(c)||Wt("Cannot "+i);var e=(c,t,i)=>(Mt(c,t,"read from private field"),i?i.call(c):t.get(c)),b=(c,t,i)=>t.has(c)?Wt("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(c):t.set(c,i),u=(c,t,i,s)=>(Mt(c,t,"write to private field"),t.set(c,i),i),f=(c,t,i)=>(Mt(c,t,"access private method"),i);var Ot=(c,t,i,s)=>({set _(r){u(c,t,r);},get _(){return e(c,t,s)}});var Qt=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,Kt=new Set,Gt=typeof process=="object"&&process?process:{},Pt=(c,t,i,s)=>{typeof Gt.emitWarning=="function"?Gt.emitWarning(c,t,i,s):console.error(`[${i}] ${t}: ${c}`);},Dt=globalThis.AbortController,jt=globalThis.AbortSignal;if(typeof Dt>"u"){jt=class{onabort;_onabort=[];reason;aborted=false;addEventListener(i,s){this._onabort.push(s);}},Dt=class{constructor(){t();}signal=new jt;abort(i){if(!this.signal.aborted){this.signal.reason=i,this.signal.aborted=true;for(let s of this.signal._onabort)s(i);this.signal.onabort?.(i);}}};let c=Gt.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",t=()=>{c&&(c=false,Pt("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 Zt=c=>!Kt.has(c);var rt=c=>c&&c===Math.floor(c)&&c>0&&isFinite(c),$t=c=>rt(c)?c<=Math.pow(2,8)?Uint8Array:c<=Math.pow(2,16)?Uint16Array:c<=Math.pow(2,32)?Uint32Array:c<=Number.MAX_SAFE_INTEGER?Tt:null:null,Tt=class extends Array{constructor(c){super(c),this.fill(0);}},et,gt,te=(et=class{heap;length;static create(t){let i=$t(t);if(!i)return [];u(et,gt,true);let s=new et(t,i);return u(et,gt,false),s}constructor(t,i){if(!e(et,gt))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new i(t),this.length=0;}push(t){this.heap[this.length++]=t;}pop(){return this.heap[--this.length]}},gt=new WeakMap,b(et,gt,false),et),Vt,Ut,P,k,$,ct,B,mt,St,q,T,J,E,x,y,G,W,z,F,Y,C,X,Q,j,V,Z,ht,N,bt,l,Nt,ft,st,Ht,U,qt,ut,vt,At,ot,nt,Rt,Ft,Ct,_,Lt,xt,at,kt,wt,Bt=(wt=class{constructor(t){b(this,l);b(this,P);b(this,k);b(this,$);b(this,ct);b(this,B);b(this,mt);b(this,St);b(this,q);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");b(this,T);b(this,J);b(this,E);b(this,x);b(this,y);b(this,G);b(this,W);b(this,z);b(this,F);b(this,Y);b(this,C);b(this,X);b(this,Q);b(this,j);b(this,V);b(this,Z);b(this,ht);b(this,N);b(this,bt);b(this,ft,()=>{});b(this,st,()=>{});b(this,Ht,()=>{});b(this,U,()=>false);b(this,ut,t=>{});b(this,vt,(t,i,s)=>{});b(this,At,(t,i,s,r)=>{if(s||r)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});D(this,Vt,"LRUCache");let{max:i=0,ttl:s,ttlResolution:r=1,ttlAutopurge:o,updateAgeOnGet:n,updateAgeOnHas:a,allowStale:h,dispose:d,onInsert:g,disposeAfter:m,noDisposeOnSet:v,noUpdateTTL:K,maxSize:tt=0,maxEntrySize:H=0,sizeCalculation:w,fetchMethod:S,memoMethod:I,noDeleteOnFetchRejection:R,noDeleteOnStaleGet:M,allowStaleOnFetchRejection:A,allowStaleOnFetchAbort:_t,ignoreFetchAbort:pt,perf:dt}=t;if(dt!==void 0&&typeof dt?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(u(this,q,dt??Qt),i!==0&&!rt(i))throw new TypeError("max option must be a nonnegative integer");let yt=i?$t(i):Array;if(!yt)throw new Error("invalid max value: "+i);if(u(this,P,i),u(this,k,tt),this.maxEntrySize=H||e(this,k),this.sizeCalculation=w,this.sizeCalculation){if(!e(this,k)&&!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(I!==void 0&&typeof I!="function")throw new TypeError("memoMethod must be a function if defined");if(u(this,St,I),S!==void 0&&typeof S!="function")throw new TypeError("fetchMethod must be a function if specified");if(u(this,mt,S),u(this,ht,!!S),u(this,E,new Map),u(this,x,new Array(i).fill(void 0)),u(this,y,new Array(i).fill(void 0)),u(this,G,new yt(i)),u(this,W,new yt(i)),u(this,z,0),u(this,F,0),u(this,Y,te.create(i)),u(this,T,0),u(this,J,0),typeof d=="function"&&u(this,$,d),typeof g=="function"&&u(this,ct,g),typeof m=="function"?(u(this,B,m),u(this,C,[])):(u(this,B,void 0),u(this,C,void 0)),u(this,Z,!!e(this,$)),u(this,bt,!!e(this,ct)),u(this,N,!!e(this,B)),this.noDisposeOnSet=!!v,this.noUpdateTTL=!!K,this.noDeleteOnFetchRejection=!!R,this.allowStaleOnFetchRejection=!!A,this.allowStaleOnFetchAbort=!!_t,this.ignoreFetchAbort=!!pt,this.maxEntrySize!==0){if(e(this,k)!==0&&!rt(e(this,k)))throw new TypeError("maxSize must be a positive integer if specified");if(!rt(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");f(this,l,qt).call(this);}if(this.allowStale=!!h,this.noDeleteOnStaleGet=!!M,this.updateAgeOnGet=!!n,this.updateAgeOnHas=!!a,this.ttlResolution=rt(r)||r===0?r:1,this.ttlAutopurge=!!o,this.ttl=s||0,this.ttl){if(!rt(this.ttl))throw new TypeError("ttl must be a positive integer if specified");f(this,l,Nt).call(this);}if(e(this,P)===0&&this.ttl===0&&e(this,k)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!e(this,P)&&!e(this,k)){let It="LRU_CACHE_UNBOUNDED";Zt(It)&&(Kt.add(It),Pt("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",It,wt));}}get perf(){return e(this,q)}static unsafeExposeInternals(t){return {starts:e(t,Q),ttls:e(t,j),autopurgeTimers:e(t,V),sizes:e(t,X),keyMap:e(t,E),keyList:e(t,x),valList:e(t,y),next:e(t,G),prev:e(t,W),get head(){return e(t,z)},get tail(){return e(t,F)},free:e(t,Y),isBackgroundFetch:i=>{var s;return f(s=t,l,_).call(s,i)},backgroundFetch:(i,s,r,o)=>{var n;return f(n=t,l,Ct).call(n,i,s,r,o)},moveToTail:i=>{var s;return f(s=t,l,xt).call(s,i)},indexes:i=>{var s;return f(s=t,l,ot).call(s,i)},rindexes:i=>{var s;return f(s=t,l,nt).call(s,i)},isStale:i=>{var s;return e(s=t,U).call(s,i)}}}get max(){return e(this,P)}get maxSize(){return e(this,k)}get calculatedSize(){return e(this,J)}get size(){return e(this,T)}get fetchMethod(){return e(this,mt)}get memoMethod(){return e(this,St)}get dispose(){return e(this,$)}get onInsert(){return e(this,ct)}get disposeAfter(){return e(this,B)}getRemainingTTL(t){return e(this,E).has(t)?1/0:0}*entries(){for(let t of f(this,l,ot).call(this))e(this,y)[t]!==void 0&&e(this,x)[t]!==void 0&&!f(this,l,_).call(this,e(this,y)[t])&&(yield [e(this,x)[t],e(this,y)[t]]);}*rentries(){for(let t of f(this,l,nt).call(this))e(this,y)[t]!==void 0&&e(this,x)[t]!==void 0&&!f(this,l,_).call(this,e(this,y)[t])&&(yield [e(this,x)[t],e(this,y)[t]]);}*keys(){for(let t of f(this,l,ot).call(this)){let i=e(this,x)[t];i!==void 0&&!f(this,l,_).call(this,e(this,y)[t])&&(yield i);}}*rkeys(){for(let t of f(this,l,nt).call(this)){let i=e(this,x)[t];i!==void 0&&!f(this,l,_).call(this,e(this,y)[t])&&(yield i);}}*values(){for(let t of f(this,l,ot).call(this))e(this,y)[t]!==void 0&&!f(this,l,_).call(this,e(this,y)[t])&&(yield e(this,y)[t]);}*rvalues(){for(let t of f(this,l,nt).call(this))e(this,y)[t]!==void 0&&!f(this,l,_).call(this,e(this,y)[t])&&(yield e(this,y)[t]);}[(Ut=Symbol.iterator,Vt=Symbol.toStringTag,Ut)](){return this.entries()}find(t,i={}){for(let s of f(this,l,ot).call(this)){let r=e(this,y)[s],o=f(this,l,_).call(this,r)?r.__staleWhileFetching:r;if(o!==void 0&&t(o,e(this,x)[s],this))return this.get(e(this,x)[s],i)}}forEach(t,i=this){for(let s of f(this,l,ot).call(this)){let r=e(this,y)[s],o=f(this,l,_).call(this,r)?r.__staleWhileFetching:r;o!==void 0&&t.call(i,o,e(this,x)[s],this);}}rforEach(t,i=this){for(let s of f(this,l,nt).call(this)){let r=e(this,y)[s],o=f(this,l,_).call(this,r)?r.__staleWhileFetching:r;o!==void 0&&t.call(i,o,e(this,x)[s],this);}}purgeStale(){let t=false;for(let i of f(this,l,nt).call(this,{allowStale:true}))e(this,U).call(this,i)&&(f(this,l,at).call(this,e(this,x)[i],"expire"),t=true);return t}info(t){let i=e(this,E).get(t);if(i===void 0)return;let s=e(this,y)[i],r=f(this,l,_).call(this,s)?s.__staleWhileFetching:s;if(r===void 0)return;let o={value:r};if(e(this,j)&&e(this,Q)){let n=e(this,j)[i],a=e(this,Q)[i];if(n&&a){let h=n-(e(this,q).now()-a);o.ttl=h,o.start=Date.now();}}return e(this,X)&&(o.size=e(this,X)[i]),o}dump(){let t=[];for(let i of f(this,l,ot).call(this,{allowStale:true})){let s=e(this,x)[i],r=e(this,y)[i],o=f(this,l,_).call(this,r)?r.__staleWhileFetching:r;if(o===void 0||s===void 0)continue;let n={value:o};if(e(this,j)&&e(this,Q)){n.ttl=e(this,j)[i];let a=e(this,q).now()-e(this,Q)[i];n.start=Math.floor(Date.now()-a);}e(this,X)&&(n.size=e(this,X)[i]),t.unshift([s,n]);}return t}load(t){this.clear();for(let[i,s]of t){if(s.start){let r=Date.now()-s.start;s.start=e(this,q).now()-r;}this.set(i,s.value,s);}}set(t,i,s={}){var v,K,tt,H;if(i===void 0)return this.delete(t),this;let{ttl:r=this.ttl,start:o,noDisposeOnSet:n=this.noDisposeOnSet,sizeCalculation:a=this.sizeCalculation,status:h}=s,{noUpdateTTL:d=this.noUpdateTTL}=s,g=e(this,At).call(this,t,i,s.size||0,a);if(this.maxEntrySize&&g>this.maxEntrySize)return h&&(h.set="miss",h.maxEntrySizeExceeded=true),f(this,l,at).call(this,t,"set"),this;let m=e(this,T)===0?void 0:e(this,E).get(t);if(m===void 0)m=e(this,T)===0?e(this,F):e(this,Y).length!==0?e(this,Y).pop():e(this,T)===e(this,P)?f(this,l,Ft).call(this,false):e(this,T),e(this,x)[m]=t,e(this,y)[m]=i,e(this,E).set(t,m),e(this,G)[e(this,F)]=m,e(this,W)[m]=e(this,F),u(this,F,m),Ot(this,T)._++,e(this,vt).call(this,m,g,h),h&&(h.set="add"),d=false,e(this,bt)&&((v=e(this,ct))==null||v.call(this,i,t,"add"));else {f(this,l,xt).call(this,m);let w=e(this,y)[m];if(i!==w){if(e(this,ht)&&f(this,l,_).call(this,w)){w.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:S}=w;S!==void 0&&!n&&(e(this,Z)&&((K=e(this,$))==null||K.call(this,S,t,"set")),e(this,N)&&e(this,C)?.push([S,t,"set"]));}else n||(e(this,Z)&&((tt=e(this,$))==null||tt.call(this,w,t,"set")),e(this,N)&&e(this,C)?.push([w,t,"set"]));if(e(this,ut).call(this,m),e(this,vt).call(this,m,g,h),e(this,y)[m]=i,h){h.set="replace";let S=w&&f(this,l,_).call(this,w)?w.__staleWhileFetching:w;S!==void 0&&(h.oldValue=S);}}else h&&(h.set="update");e(this,bt)&&this.onInsert?.(i,t,i===w?"update":"replace");}if(r!==0&&!e(this,j)&&f(this,l,Nt).call(this),e(this,j)&&(d||e(this,Ht).call(this,m,r,o),h&&e(this,st).call(this,h,m)),!n&&e(this,N)&&e(this,C)){let w=e(this,C),S;for(;S=w?.shift();)(H=e(this,B))==null||H.call(this,...S);}return this}pop(){var t;try{for(;e(this,T);){let i=e(this,y)[e(this,z)];if(f(this,l,Ft).call(this,!0),f(this,l,_).call(this,i)){if(i.__staleWhileFetching)return i.__staleWhileFetching}else if(i!==void 0)return i}}finally{if(e(this,N)&&e(this,C)){let i=e(this,C),s;for(;s=i?.shift();)(t=e(this,B))==null||t.call(this,...s);}}}has(t,i={}){let{updateAgeOnHas:s=this.updateAgeOnHas,status:r}=i,o=e(this,E).get(t);if(o!==void 0){let n=e(this,y)[o];if(f(this,l,_).call(this,n)&&n.__staleWhileFetching===void 0)return false;if(e(this,U).call(this,o))r&&(r.has="stale",e(this,st).call(this,r,o));else return s&&e(this,ft).call(this,o),r&&(r.has="hit",e(this,st).call(this,r,o)),true}else r&&(r.has="miss");return false}peek(t,i={}){let{allowStale:s=this.allowStale}=i,r=e(this,E).get(t);if(r===void 0||!s&&e(this,U).call(this,r))return;let o=e(this,y)[r];return f(this,l,_).call(this,o)?o.__staleWhileFetching:o}async fetch(t,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,ttl:n=this.ttl,noDisposeOnSet:a=this.noDisposeOnSet,size:h=0,sizeCalculation:d=this.sizeCalculation,noUpdateTTL:g=this.noUpdateTTL,noDeleteOnFetchRejection:m=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:v=this.allowStaleOnFetchRejection,ignoreFetchAbort:K=this.ignoreFetchAbort,allowStaleOnFetchAbort:tt=this.allowStaleOnFetchAbort,context:H,forceRefresh:w=false,status:S,signal:I}=i;if(!e(this,ht))return S&&(S.fetch="get"),this.get(t,{allowStale:s,updateAgeOnGet:r,noDeleteOnStaleGet:o,status:S});let R={allowStale:s,updateAgeOnGet:r,noDeleteOnStaleGet:o,ttl:n,noDisposeOnSet:a,size:h,sizeCalculation:d,noUpdateTTL:g,noDeleteOnFetchRejection:m,allowStaleOnFetchRejection:v,allowStaleOnFetchAbort:tt,ignoreFetchAbort:K,status:S,signal:I},M=e(this,E).get(t);if(M===void 0){S&&(S.fetch="miss");let A=f(this,l,Ct).call(this,t,M,R,H);return A.__returned=A}else {let A=e(this,y)[M];if(f(this,l,_).call(this,A)){let yt=s&&A.__staleWhileFetching!==void 0;return S&&(S.fetch="inflight",yt&&(S.returnedStale=true)),yt?A.__staleWhileFetching:A.__returned=A}let _t=e(this,U).call(this,M);if(!w&&!_t)return S&&(S.fetch="hit"),f(this,l,xt).call(this,M),r&&e(this,ft).call(this,M),S&&e(this,st).call(this,S,M),A;let pt=f(this,l,Ct).call(this,t,M,R,H),dt=pt.__staleWhileFetching!==void 0&&s;return S&&(S.fetch=_t?"stale":"refresh",dt&&_t&&(S.returnedStale=true)),dt?pt.__staleWhileFetching:pt.__returned=pt}}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:r,forceRefresh:o,...n}=i,a=this.get(t,n);if(!o&&a!==void 0)return a;let h=s(t,a,{options:n,context:r});return this.set(t,h,n),h}get(t,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,status:n}=i,a=e(this,E).get(t);if(a!==void 0){let h=e(this,y)[a],d=f(this,l,_).call(this,h);return n&&e(this,st).call(this,n,a),e(this,U).call(this,a)?(n&&(n.get="stale"),d?(n&&s&&h.__staleWhileFetching!==void 0&&(n.returnedStale=true),s?h.__staleWhileFetching:void 0):(o||f(this,l,at).call(this,t,"expire"),n&&s&&(n.returnedStale=true),s?h:void 0)):(n&&(n.get="hit"),d?h.__staleWhileFetching:(f(this,l,xt).call(this,a),r&&e(this,ft).call(this,a),h))}else n&&(n.get="miss");}delete(t){return f(this,l,at).call(this,t,"delete")}clear(){return f(this,l,kt).call(this,"delete")}},P=new WeakMap,k=new WeakMap,$=new WeakMap,ct=new WeakMap,B=new WeakMap,mt=new WeakMap,St=new WeakMap,q=new WeakMap,T=new WeakMap,J=new WeakMap,E=new WeakMap,x=new WeakMap,y=new WeakMap,G=new WeakMap,W=new WeakMap,z=new WeakMap,F=new WeakMap,Y=new WeakMap,C=new WeakMap,X=new WeakMap,Q=new WeakMap,j=new WeakMap,V=new WeakMap,Z=new WeakMap,ht=new WeakMap,N=new WeakMap,bt=new WeakMap,l=new WeakSet,Nt=function(){let t=new Tt(e(this,P)),i=new Tt(e(this,P));u(this,j,t),u(this,Q,i);let s=this.ttlAutopurge?new Array(e(this,P)):void 0;u(this,V,s),u(this,Ht,(a,h,d=e(this,q).now())=>{i[a]=h!==0?d:0,t[a]=h,r(a,h);}),u(this,ft,a=>{i[a]=t[a]!==0?e(this,q).now():0,r(a,t[a]);});let r=this.ttlAutopurge?(a,h)=>{if(s?.[a]&&(clearTimeout(s[a]),s[a]=void 0),h&&h!==0&&s){let d=setTimeout(()=>{e(this,U).call(this,a)&&f(this,l,at).call(this,e(this,x)[a],"expire");},h+1);d.unref&&d.unref(),s[a]=d;}}:()=>{};u(this,st,(a,h)=>{if(t[h]){let d=t[h],g=i[h];if(!d||!g)return;a.ttl=d,a.start=g,a.now=o||n();let m=a.now-g;a.remainingTTL=d-m;}});let o=0,n=()=>{let a=e(this,q).now();if(this.ttlResolution>0){o=a;let h=setTimeout(()=>o=0,this.ttlResolution);h.unref&&h.unref();}return a};this.getRemainingTTL=a=>{let h=e(this,E).get(a);if(h===void 0)return 0;let d=t[h],g=i[h];if(!d||!g)return 1/0;let m=(o||n())-g;return d-m},u(this,U,a=>{let h=i[a],d=t[a];return !!d&&!!h&&(o||n())-h>d});},ft=new WeakMap,st=new WeakMap,Ht=new WeakMap,U=new WeakMap,qt=function(){let t=new Tt(e(this,P));u(this,J,0),u(this,X,t),u(this,ut,i=>{u(this,J,e(this,J)-t[i]),t[i]=0;}),u(this,At,(i,s,r,o)=>{if(f(this,l,_).call(this,s))return 0;if(!rt(r))if(o){if(typeof o!="function")throw new TypeError("sizeCalculation must be a function");if(r=o(s,i),!rt(r))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 r}),u(this,vt,(i,s,r)=>{if(t[i]=s,e(this,k)){let o=e(this,k)-t[i];for(;e(this,J)>o;)f(this,l,Ft).call(this,true);}u(this,J,e(this,J)+t[i]),r&&(r.entrySize=s,r.totalCalculatedSize=e(this,J));});},ut=new WeakMap,vt=new WeakMap,At=new WeakMap,ot=function*({allowStale:t=this.allowStale}={}){if(e(this,T))for(let i=e(this,F);!(!f(this,l,Rt).call(this,i)||((t||!e(this,U).call(this,i))&&(yield i),i===e(this,z)));)i=e(this,W)[i];},nt=function*({allowStale:t=this.allowStale}={}){if(e(this,T))for(let i=e(this,z);!(!f(this,l,Rt).call(this,i)||((t||!e(this,U).call(this,i))&&(yield i),i===e(this,F)));)i=e(this,G)[i];},Rt=function(t){return t!==void 0&&e(this,E).get(e(this,x)[t])===t},Ft=function(t){var o;let i=e(this,z),s=e(this,x)[i],r=e(this,y)[i];return e(this,ht)&&f(this,l,_).call(this,r)?r.__abortController.abort(new Error("evicted")):(e(this,Z)||e(this,N))&&(e(this,Z)&&((o=e(this,$))==null||o.call(this,r,s,"evict")),e(this,N)&&e(this,C)?.push([r,s,"evict"])),e(this,ut).call(this,i),e(this,V)?.[i]&&(clearTimeout(e(this,V)[i]),e(this,V)[i]=void 0),t&&(e(this,x)[i]=void 0,e(this,y)[i]=void 0,e(this,Y).push(i)),e(this,T)===1?(u(this,z,u(this,F,0)),e(this,Y).length=0):u(this,z,e(this,G)[i]),e(this,E).delete(s),Ot(this,T)._--,i},Ct=function(t,i,s,r){let o=i===void 0?void 0:e(this,y)[i];if(f(this,l,_).call(this,o))return o;let n=new Dt,{signal:a}=s;a?.addEventListener("abort",()=>n.abort(a.reason),{signal:n.signal});let h={signal:n.signal,options:s,context:r},d=(H,w=false)=>{let{aborted:S}=n.signal,I=s.ignoreFetchAbort&&H!==void 0,R=s.ignoreFetchAbort||!!(s.allowStaleOnFetchAbort&&H!==void 0);if(s.status&&(S&&!w?(s.status.fetchAborted=true,s.status.fetchError=n.signal.reason,I&&(s.status.fetchAbortIgnored=true)):s.status.fetchResolved=true),S&&!I&&!w)return m(n.signal.reason,R);let M=K,A=e(this,y)[i];return (A===K||I&&w&&A===void 0)&&(H===void 0?M.__staleWhileFetching!==void 0?e(this,y)[i]=M.__staleWhileFetching:f(this,l,at).call(this,t,"fetch"):(s.status&&(s.status.fetchUpdated=true),this.set(t,H,h.options))),H},g=H=>(s.status&&(s.status.fetchRejected=true,s.status.fetchError=H),m(H,false)),m=(H,w)=>{let{aborted:S}=n.signal,I=S&&s.allowStaleOnFetchAbort,R=I||s.allowStaleOnFetchRejection,M=R||s.noDeleteOnFetchRejection,A=K;if(e(this,y)[i]===K&&(!M||!w&&A.__staleWhileFetching===void 0?f(this,l,at).call(this,t,"fetch"):I||(e(this,y)[i]=A.__staleWhileFetching)),R)return s.status&&A.__staleWhileFetching!==void 0&&(s.status.returnedStale=true),A.__staleWhileFetching;if(A.__returned===A)throw H},v=(H,w)=>{var I;let S=(I=e(this,mt))==null?void 0:I.call(this,t,o,h);S&&S instanceof Promise&&S.then(R=>H(R===void 0?void 0:R),w),n.signal.addEventListener("abort",()=>{(!s.ignoreFetchAbort||s.allowStaleOnFetchAbort)&&(H(void 0),s.allowStaleOnFetchAbort&&(H=R=>d(R,true)));});};s.status&&(s.status.fetchDispatched=true);let K=new Promise(v).then(d,g),tt=Object.assign(K,{__abortController:n,__staleWhileFetching:o,__returned:void 0});return i===void 0?(this.set(t,tt,{...h.options,status:void 0}),i=e(this,E).get(t)):e(this,y)[i]=tt,tt},_=function(t){if(!e(this,ht))return false;let i=t;return !!i&&i instanceof Promise&&i.hasOwnProperty("__staleWhileFetching")&&i.__abortController instanceof Dt},Lt=function(t,i){e(this,W)[i]=t,e(this,G)[t]=i;},xt=function(t){t!==e(this,F)&&(t===e(this,z)?u(this,z,e(this,G)[t]):f(this,l,Lt).call(this,e(this,W)[t],e(this,G)[t]),f(this,l,Lt).call(this,e(this,F),t),u(this,F,t));},at=function(t,i){var r,o;let s=false;if(e(this,T)!==0){let n=e(this,E).get(t);if(n!==void 0)if(e(this,V)?.[n]&&(clearTimeout(e(this,V)?.[n]),e(this,V)[n]=void 0),s=true,e(this,T)===1)f(this,l,kt).call(this,i);else {e(this,ut).call(this,n);let a=e(this,y)[n];if(f(this,l,_).call(this,a)?a.__abortController.abort(new Error("deleted")):(e(this,Z)||e(this,N))&&(e(this,Z)&&((r=e(this,$))==null||r.call(this,a,t,i)),e(this,N)&&e(this,C)?.push([a,t,i])),e(this,E).delete(t),e(this,x)[n]=void 0,e(this,y)[n]=void 0,n===e(this,F))u(this,F,e(this,W)[n]);else if(n===e(this,z))u(this,z,e(this,G)[n]);else {let h=e(this,W)[n];e(this,G)[h]=e(this,G)[n];let d=e(this,G)[n];e(this,W)[d]=e(this,W)[n];}Ot(this,T)._--,e(this,Y).push(n);}}if(e(this,N)&&e(this,C)?.length){let n=e(this,C),a;for(;a=n?.shift();)(o=e(this,B))==null||o.call(this,...a);}return s},kt=function(t){var i,s;for(let r of f(this,l,nt).call(this,{allowStale:true})){let o=e(this,y)[r];if(f(this,l,_).call(this,o))o.__abortController.abort(new Error("deleted"));else {let n=e(this,x)[r];e(this,Z)&&((i=e(this,$))==null||i.call(this,o,n,t)),e(this,N)&&e(this,C)?.push([o,n,t]);}}if(e(this,E).clear(),e(this,y).fill(void 0),e(this,x).fill(void 0),e(this,j)&&e(this,Q)){e(this,j).fill(0),e(this,Q).fill(0);for(let r of e(this,V)??[])r!==void 0&&clearTimeout(r);e(this,V)?.fill(void 0);}if(e(this,X)&&e(this,X).fill(0),u(this,z,0),u(this,F,0),e(this,Y).length=0,u(this,J,0),u(this,T,0),e(this,N)&&e(this,C)){let r=e(this,C),o;for(;o=r?.shift();)(s=e(this,B))==null||s.call(this,...o);}},wt);var lt=class{cache;map=new Map;constructor(t){this.cache=new Bt({max:t.cacheSize}),this.map=new Map;}get[Symbol.iterator](){return this.map[Symbol.iterator]}get[Symbol.toStringTag](){return this.map[Symbol.toStringTag]}clear(){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;(r=>(r.log=(o,...n)=>console.log(`[Pixi\u2019VN] ${o}`,...n),r.warn=(o,...n)=>console.warn(`[Pixi\u2019VN] ${o}`,...n),r.error=(o,...n)=>console.error(`[Pixi\u2019VN] ${o}`,...n),r.info=(o,...n)=>console.info(`[Pixi\u2019VN] ${o}`,...n)))(O||={});function it(c){try{if(typeof c>"u")return c;let t=JSON.stringify(c);return JSON.parse(t)}catch(t){throw O.error("Error creating exportable element",c,t),new core.PixiError("not_json_serializable","Error creating exportable element")}}var p=class c{static _diffHistory=new lt({cacheSize:5});static _stepsInfoHistory=new lt({cacheSize:5});static _narrationHistory=new lt({cacheSize:50});static stepLimitSaved=20;static _originalStepData=void 0;static get originalStepData(){return c._originalStepData?it(c._originalStepData):{path:"",storage:{},canvas:{elementAliasesOrder:[],elements:{},stage:{},tickers:{},tickersSteps:{},tickersOnPause:{},tickersToCompleteOnStepEnd:{tikersIds:[],stepAlias:[]}},sound:{soundAliasesOrder:[],soundsPlaying:{},playInStepIndex:{},filters:void 0},labelIndex:-1,openedLabels:[]}}static set originalStepData(t){c._originalStepData=it(t);}};function Jt(c,t){let i=it(c);return t.length>1&&"type"in t[0]&&(t=t.slice().reverse()),t.forEach(s=>{ie(i,s);}),i}function ie(c,t){let i=c;t.path&&t.path.length>0?t.path.forEach((s,r)=>{if(t.path&&r===t.path.length-1)switch(t.type){case "CHANGE":case "REMOVE":i[s]=t.oldValue;break;case "CREATE":Array.isArray(i)&&typeof s=="number"?i.splice(s,1):delete i[s];break}else i=i[s];}):O.warn("No path found, skipping diff",t);}var se={Date:true,RegExp:true,String:true,Number:true};function zt(c,t,i={cyclesFix:true},s=[]){let r=[],o=Array.isArray(c);for(let a in c){let h=c[a],d=o?+a:a;if(!(a in t)){r.push({type:"REMOVE",path:[d],oldValue:c[a]});continue}let g=t[a],m=typeof h=="object"&&typeof g=="object"&&Array.isArray(h)===Array.isArray(g);h&&g&&m&&!se[Object.getPrototypeOf(h)?.constructor?.name]&&(!i.cyclesFix||!s.includes(h))?r.push.apply(r,zt(h,g,i,i.cyclesFix?s.concat([h]):[]).map(v=>(v.path.unshift(d),v))):h!==g&&!(Number.isNaN(h)&&Number.isNaN(g))&&!(m&&(isNaN(h)?h+""==g+"":+h==+g))&&r.push({path:[d],type:"CHANGE",value:g,oldValue:h});}let n=Array.isArray(t);for(let a in t)a in c||r.push({type:"CREATE",path:[n?+a:a],value:t[a]});return r}var Et=class{get stepsInfoMap(){return p._stepsInfoHistory}get diffMap(){return p._diffHistory}get narrationMap(){return p._narrationHistory}get size(){return p._stepsInfoHistory.size}get lastKey(){return this.size===0?null:Math.max(...Array.from(this.keys()))}keys(){return p._stepsInfoHistory.keys()}get(t){let i=p._narrationHistory.get(t);if(!(i&&Object.keys(i).length===1&&i.stepIndex!==void 0))return i}delete(t){p._stepsInfoHistory.delete(t),p._diffHistory.delete(t),p._narrationHistory.delete(t);}getOldGameState(t,i){if(t<=0||this.size===0)return i;let s=this.lastKey;if(typeof s!="number")return O.warn("You can't go back, there is no step to go back"),i;let r=p._diffHistory.get(s);if(r)try{let o=Jt(i,r);return core.GameUnifier.stepCounter=s,this.delete(s),this.getOldGameState(t-1,o)}catch(o){return O.error("Error applying diff",o),i}else return O.warn("No diff found for the last step, cannot go back"),i}async back(t,i={}){let{steps:s=1}=i;if(!Number.isFinite(s)){O.warn(`[back] The parameter steps must be a valid finite number, received: ${s}`);return}if(s<=0){O.warn(`[back] The parameter steps must be greater than 0, received: ${s}`);return}if(core.GameUnifier.runningStepsCount>0){core.GameUnifier.increaseBackRequest(s);return}if(p._diffHistory.size<1){O.warn("You can't go back, there is no step to go back");return}core.GameUnifier.runningStepsCount++;try{let r=it(this.getOldGameState(s,p.originalStepData));if(r){await core.GameUnifier.restoreGameStepState(r,core.GameUnifier.navigate);let o=core.GameUnifier.stepCounter-1,n=p._narrationHistory.get(o);if(n&&Object.keys(n).length===1&&n.stepIndex!==void 0){let a=p._stepsInfoHistory.get(o);if(a){let h=this.itemMapper({step:a});p._narrationHistory.set(a.index,h);}}}else O.error("Error going back");p.originalStepData=r;}catch(r){O.error("Error going back",r);}if(core.GameUnifier.runningStepsCount--,core.GameUnifier.runningStepsCount===0&&core.GameUnifier.backRequestsCount!==0)return await core.GameUnifier.processNavigationRequests(t)}add(t,i={}){let s=p.originalStepData,{ignoreSameStep:r}=i,o=core.GameUnifier.currentGameStepState;if(!r&&this.isSameStep(s,o))return;let n=this.lastKey;(async()=>{try{let h,d;if(typeof n=="number"&&(h=p._stepsInfoHistory.get(n),d=p._narrationHistory.get(n)),p._stepsInfoHistory.set(t.index,t),t.index!==0){let v=zt(s,o);v?p._diffHistory.set(t.index,v):O.warn("It was not possible to create the difference between the two steps");}let g={},m=this.itemMapper({step:t},g);if(p._narrationHistory.set(t.index,m),h&&d&&typeof n=="number"){let v=this.itemMapper({...g,step:h},{});p._narrationHistory.set(n,v);}}catch(h){O.error("Error adding history step",h);}})(),p.originalStepData=o;}itemMapper(t,i){let{step:s,choiceIndexMade:r,inputValue:o,removeDialogue:n}=t,a=s.dialogue;i&&s.isGlued&&(i.removeDialogue=true),n&&(a=void 0);let h=s.choices;if(i&&s.currentLabel&&s.choiceIndexMade!==void 0&&(i.choiceIndexMade=s.choiceIndexMade),s.inputValue&&i&&(i.inputValue=s.inputValue),a||h||o){let d=h?.map((g,m)=>{let v=false;return g.oneTime&&s.alreadyMadeChoices?.includes(m)&&(v=true),{text:g.text,type:g.type,isResponse:false,hidden:v}});if(d){if(d.every(g=>g.hidden)){let g=d.find(m=>m.hidden===false);g&&(g.hidden=false);}r!==void 0&&(d[r].isResponse=true);}return {dialogue:a?{...a,character:a.character?core.GameUnifier.getCharacter(a.character)||a.character:void 0}:void 0,playerMadeChoice:typeof r=="number",choices:d,stepIndex:s.index,inputValue:o}}return {stepIndex:s.index}}get narrativeHistory(){let t=[];return Array.from(this.keys()).sort((s,r)=>s-r).forEach(s=>{let r=this.get(s);r&&t.push(r);}),t}get currentLabelHistory(){let t=[],i=Array.from(this.keys()).sort((h,d)=>d-h);if(i.length===0)return t;let s=i[0];if(typeof s!="number")return t;let r=p._stepsInfoHistory.get(s);if(!r)return t;let o=r.openedLabels;if(!o||!Array.isArray(o)||o.length===0)return t;let n=o[0].currentStepIndex,a=o[0].label;return i.every((h,d)=>{let g=this.get(h);if(g){if(d===0)return t.push(g),true;let m=p._stepsInfoHistory.get(h);if(!m)return true;let v=m.openedLabels;if(!v||!Array.isArray(v)||v.length===0||v[0].label!==a||v[0].currentStepIndex>=n)return false;n=v[0].currentStepIndex,t.push(g);}return true}),t.reverse()}removeNarrativeHistory(t){if(t){let i=Array.from(this.keys()).sort((s,r)=>s-r);i=i.slice(0,t),i.forEach(s=>{p._narrationHistory.delete(s),p._stepsInfoHistory.delete(s),p._diffHistory.delete(s);});}else p._stepsInfoHistory.clear(),p._diffHistory.clear(),p._narrationHistory.clear();}get canGoBack(){let t=this.lastKey;return typeof t!="number"?false:p._diffHistory.has(t)}blockGoBack(){core.GameUnifier.runningStepsCount===0&&p._diffHistory.clear();}isSameStep(t,i){if(t.openedLabels.length===i.openedLabels.length)try{let s=JSON.stringify(t.openedLabels),r=JSON.stringify(i.openedLabels);if(s===r&&t.path===i.path&&t.labelIndex===i.labelIndex)return !0}catch(s){return O.error("Error comparing opened labels",s),true}return false}clear(){p._stepsInfoHistory.clear(),p._diffHistory.clear(),p._narrationHistory.clear(),p._originalStepData=void 0;}get stepLimitSaved(){return p.stepLimitSaved}set stepLimitSaved(t){p.stepLimitSaved=t;}export(){let t=Array.from(this.keys()).sort((s,r)=>s-r);t.length>this.stepLimitSaved&&(t=t.slice(t.length-this.stepLimitSaved));let i=[];return t.forEach(s=>{let r=p._stepsInfoHistory.get(s);if(r){let o=p._diffHistory.get(s);i.push({...r,diff:o});}}),{stepsHistory:it(i),originalStepData:it(p._originalStepData)}}restoreNarrativeHistory(){let t=Array.from(this.keys()).sort((s,r)=>s-r),i={};t.forEach(s=>{let r=p._stepsInfoHistory.get(s);if(r){let o={...i};i={};let n=this.itemMapper({step:r,choiceIndexMade:o.choiceIndexMade,inputValue:o.inputValue,removeDialogue:o.removeDialogue},i);n&&p._narrationHistory.set(s,n);}});}async restore(t){this.clear();try{Object.hasOwn(t,"stepsHistory")?(t.stepsHistory.forEach(s=>{s.diff&&p._diffHistory.set(s.index,s.diff);let r={...s,diff:void 0};p._stepsInfoHistory.set(s.index,r);}),this.restoreNarrativeHistory()):O.warn("Could not import stepsHistory data, so will be ignored"),Object.hasOwn(t,"originalStepData")?p._originalStepData=t.originalStepData:O.warn("Could not import originalStepData data, so will be ignored");}catch(i){O.error("Error importing data",i);}}};var Ge=new Et;exports.HistoryManagerStatic=p;exports.stepHistory=Ge;
|
|
1
|
+
'use strict';var core=require('@drincs/pixi-vn/core');var Yt=Object.defineProperty;var Wt=c=>{throw TypeError(c)};var Xt=(c,t,i)=>t in c?Yt(c,t,{enumerable:true,configurable:true,writable:true,value:i}):c[t]=i;var D=(c,t,i)=>Xt(c,typeof t!="symbol"?t+"":t,i),Mt=(c,t,i)=>t.has(c)||Wt("Cannot "+i);var e=(c,t,i)=>(Mt(c,t,"read from private field"),i?i.call(c):t.get(c)),b=(c,t,i)=>t.has(c)?Wt("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(c):t.set(c,i),u=(c,t,i,s)=>(Mt(c,t,"write to private field"),t.set(c,i),i),f=(c,t,i)=>(Mt(c,t,"access private method"),i);var Ot=(c,t,i,s)=>({set _(r){u(c,t,r);},get _(){return e(c,t,s)}});var Qt=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,Kt=new Set,Gt=typeof process=="object"&&process?process:{},Pt=(c,t,i,s)=>{typeof Gt.emitWarning=="function"?Gt.emitWarning(c,t,i,s):console.error(`[${i}] ${t}: ${c}`);},Dt=globalThis.AbortController,jt=globalThis.AbortSignal;if(typeof Dt>"u"){jt=class{onabort;_onabort=[];reason;aborted=false;addEventListener(i,s){this._onabort.push(s);}},Dt=class{constructor(){t();}signal=new jt;abort(i){if(!this.signal.aborted){this.signal.reason=i,this.signal.aborted=true;for(let s of this.signal._onabort)s(i);this.signal.onabort?.(i);}}};let c=Gt.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",t=()=>{c&&(c=false,Pt("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 Zt=c=>!Kt.has(c);var rt=c=>c&&c===Math.floor(c)&&c>0&&isFinite(c),$t=c=>rt(c)?c<=Math.pow(2,8)?Uint8Array:c<=Math.pow(2,16)?Uint16Array:c<=Math.pow(2,32)?Uint32Array:c<=Number.MAX_SAFE_INTEGER?Tt:null:null,Tt=class extends Array{constructor(c){super(c),this.fill(0);}},et,gt,te=(et=class{heap;length;static create(t){let i=$t(t);if(!i)return [];u(et,gt,true);let s=new et(t,i);return u(et,gt,false),s}constructor(t,i){if(!e(et,gt))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new i(t),this.length=0;}push(t){this.heap[this.length++]=t;}pop(){return this.heap[--this.length]}},gt=new WeakMap,b(et,gt,false),et),Vt,Ut,P,k,$,ct,B,mt,St,q,T,J,E,x,y,G,W,z,F,Y,C,X,Q,j,V,Z,ht,N,bt,l,Nt,ft,st,Ht,U,qt,ut,vt,At,ot,nt,Rt,Ft,Ct,_,Lt,xt,at,kt,wt,Bt=(wt=class{constructor(t){b(this,l);b(this,P);b(this,k);b(this,$);b(this,ct);b(this,B);b(this,mt);b(this,St);b(this,q);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");b(this,T);b(this,J);b(this,E);b(this,x);b(this,y);b(this,G);b(this,W);b(this,z);b(this,F);b(this,Y);b(this,C);b(this,X);b(this,Q);b(this,j);b(this,V);b(this,Z);b(this,ht);b(this,N);b(this,bt);b(this,ft,()=>{});b(this,st,()=>{});b(this,Ht,()=>{});b(this,U,()=>false);b(this,ut,t=>{});b(this,vt,(t,i,s)=>{});b(this,At,(t,i,s,r)=>{if(s||r)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});D(this,Vt,"LRUCache");let{max:i=0,ttl:s,ttlResolution:r=1,ttlAutopurge:o,updateAgeOnGet:n,updateAgeOnHas:a,allowStale:h,dispose:d,onInsert:g,disposeAfter:m,noDisposeOnSet:v,noUpdateTTL:K,maxSize:tt=0,maxEntrySize:H=0,sizeCalculation:w,fetchMethod:S,memoMethod:I,noDeleteOnFetchRejection:R,noDeleteOnStaleGet:M,allowStaleOnFetchRejection:A,allowStaleOnFetchAbort:_t,ignoreFetchAbort:pt,perf:dt}=t;if(dt!==void 0&&typeof dt?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(u(this,q,dt??Qt),i!==0&&!rt(i))throw new TypeError("max option must be a nonnegative integer");let yt=i?$t(i):Array;if(!yt)throw new Error("invalid max value: "+i);if(u(this,P,i),u(this,k,tt),this.maxEntrySize=H||e(this,k),this.sizeCalculation=w,this.sizeCalculation){if(!e(this,k)&&!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(I!==void 0&&typeof I!="function")throw new TypeError("memoMethod must be a function if defined");if(u(this,St,I),S!==void 0&&typeof S!="function")throw new TypeError("fetchMethod must be a function if specified");if(u(this,mt,S),u(this,ht,!!S),u(this,E,new Map),u(this,x,new Array(i).fill(void 0)),u(this,y,new Array(i).fill(void 0)),u(this,G,new yt(i)),u(this,W,new yt(i)),u(this,z,0),u(this,F,0),u(this,Y,te.create(i)),u(this,T,0),u(this,J,0),typeof d=="function"&&u(this,$,d),typeof g=="function"&&u(this,ct,g),typeof m=="function"?(u(this,B,m),u(this,C,[])):(u(this,B,void 0),u(this,C,void 0)),u(this,Z,!!e(this,$)),u(this,bt,!!e(this,ct)),u(this,N,!!e(this,B)),this.noDisposeOnSet=!!v,this.noUpdateTTL=!!K,this.noDeleteOnFetchRejection=!!R,this.allowStaleOnFetchRejection=!!A,this.allowStaleOnFetchAbort=!!_t,this.ignoreFetchAbort=!!pt,this.maxEntrySize!==0){if(e(this,k)!==0&&!rt(e(this,k)))throw new TypeError("maxSize must be a positive integer if specified");if(!rt(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");f(this,l,qt).call(this);}if(this.allowStale=!!h,this.noDeleteOnStaleGet=!!M,this.updateAgeOnGet=!!n,this.updateAgeOnHas=!!a,this.ttlResolution=rt(r)||r===0?r:1,this.ttlAutopurge=!!o,this.ttl=s||0,this.ttl){if(!rt(this.ttl))throw new TypeError("ttl must be a positive integer if specified");f(this,l,Nt).call(this);}if(e(this,P)===0&&this.ttl===0&&e(this,k)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!e(this,P)&&!e(this,k)){let It="LRU_CACHE_UNBOUNDED";Zt(It)&&(Kt.add(It),Pt("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",It,wt));}}get perf(){return e(this,q)}static unsafeExposeInternals(t){return {starts:e(t,Q),ttls:e(t,j),autopurgeTimers:e(t,V),sizes:e(t,X),keyMap:e(t,E),keyList:e(t,x),valList:e(t,y),next:e(t,G),prev:e(t,W),get head(){return e(t,z)},get tail(){return e(t,F)},free:e(t,Y),isBackgroundFetch:i=>{var s;return f(s=t,l,_).call(s,i)},backgroundFetch:(i,s,r,o)=>{var n;return f(n=t,l,Ct).call(n,i,s,r,o)},moveToTail:i=>{var s;return f(s=t,l,xt).call(s,i)},indexes:i=>{var s;return f(s=t,l,ot).call(s,i)},rindexes:i=>{var s;return f(s=t,l,nt).call(s,i)},isStale:i=>{var s;return e(s=t,U).call(s,i)}}}get max(){return e(this,P)}get maxSize(){return e(this,k)}get calculatedSize(){return e(this,J)}get size(){return e(this,T)}get fetchMethod(){return e(this,mt)}get memoMethod(){return e(this,St)}get dispose(){return e(this,$)}get onInsert(){return e(this,ct)}get disposeAfter(){return e(this,B)}getRemainingTTL(t){return e(this,E).has(t)?1/0:0}*entries(){for(let t of f(this,l,ot).call(this))e(this,y)[t]!==void 0&&e(this,x)[t]!==void 0&&!f(this,l,_).call(this,e(this,y)[t])&&(yield [e(this,x)[t],e(this,y)[t]]);}*rentries(){for(let t of f(this,l,nt).call(this))e(this,y)[t]!==void 0&&e(this,x)[t]!==void 0&&!f(this,l,_).call(this,e(this,y)[t])&&(yield [e(this,x)[t],e(this,y)[t]]);}*keys(){for(let t of f(this,l,ot).call(this)){let i=e(this,x)[t];i!==void 0&&!f(this,l,_).call(this,e(this,y)[t])&&(yield i);}}*rkeys(){for(let t of f(this,l,nt).call(this)){let i=e(this,x)[t];i!==void 0&&!f(this,l,_).call(this,e(this,y)[t])&&(yield i);}}*values(){for(let t of f(this,l,ot).call(this))e(this,y)[t]!==void 0&&!f(this,l,_).call(this,e(this,y)[t])&&(yield e(this,y)[t]);}*rvalues(){for(let t of f(this,l,nt).call(this))e(this,y)[t]!==void 0&&!f(this,l,_).call(this,e(this,y)[t])&&(yield e(this,y)[t]);}[(Ut=Symbol.iterator,Vt=Symbol.toStringTag,Ut)](){return this.entries()}find(t,i={}){for(let s of f(this,l,ot).call(this)){let r=e(this,y)[s],o=f(this,l,_).call(this,r)?r.__staleWhileFetching:r;if(o!==void 0&&t(o,e(this,x)[s],this))return this.get(e(this,x)[s],i)}}forEach(t,i=this){for(let s of f(this,l,ot).call(this)){let r=e(this,y)[s],o=f(this,l,_).call(this,r)?r.__staleWhileFetching:r;o!==void 0&&t.call(i,o,e(this,x)[s],this);}}rforEach(t,i=this){for(let s of f(this,l,nt).call(this)){let r=e(this,y)[s],o=f(this,l,_).call(this,r)?r.__staleWhileFetching:r;o!==void 0&&t.call(i,o,e(this,x)[s],this);}}purgeStale(){let t=false;for(let i of f(this,l,nt).call(this,{allowStale:true}))e(this,U).call(this,i)&&(f(this,l,at).call(this,e(this,x)[i],"expire"),t=true);return t}info(t){let i=e(this,E).get(t);if(i===void 0)return;let s=e(this,y)[i],r=f(this,l,_).call(this,s)?s.__staleWhileFetching:s;if(r===void 0)return;let o={value:r};if(e(this,j)&&e(this,Q)){let n=e(this,j)[i],a=e(this,Q)[i];if(n&&a){let h=n-(e(this,q).now()-a);o.ttl=h,o.start=Date.now();}}return e(this,X)&&(o.size=e(this,X)[i]),o}dump(){let t=[];for(let i of f(this,l,ot).call(this,{allowStale:true})){let s=e(this,x)[i],r=e(this,y)[i],o=f(this,l,_).call(this,r)?r.__staleWhileFetching:r;if(o===void 0||s===void 0)continue;let n={value:o};if(e(this,j)&&e(this,Q)){n.ttl=e(this,j)[i];let a=e(this,q).now()-e(this,Q)[i];n.start=Math.floor(Date.now()-a);}e(this,X)&&(n.size=e(this,X)[i]),t.unshift([s,n]);}return t}load(t){this.clear();for(let[i,s]of t){if(s.start){let r=Date.now()-s.start;s.start=e(this,q).now()-r;}this.set(i,s.value,s);}}set(t,i,s={}){var v,K,tt,H;if(i===void 0)return this.delete(t),this;let{ttl:r=this.ttl,start:o,noDisposeOnSet:n=this.noDisposeOnSet,sizeCalculation:a=this.sizeCalculation,status:h}=s,{noUpdateTTL:d=this.noUpdateTTL}=s,g=e(this,At).call(this,t,i,s.size||0,a);if(this.maxEntrySize&&g>this.maxEntrySize)return h&&(h.set="miss",h.maxEntrySizeExceeded=true),f(this,l,at).call(this,t,"set"),this;let m=e(this,T)===0?void 0:e(this,E).get(t);if(m===void 0)m=e(this,T)===0?e(this,F):e(this,Y).length!==0?e(this,Y).pop():e(this,T)===e(this,P)?f(this,l,Ft).call(this,false):e(this,T),e(this,x)[m]=t,e(this,y)[m]=i,e(this,E).set(t,m),e(this,G)[e(this,F)]=m,e(this,W)[m]=e(this,F),u(this,F,m),Ot(this,T)._++,e(this,vt).call(this,m,g,h),h&&(h.set="add"),d=false,e(this,bt)&&((v=e(this,ct))==null||v.call(this,i,t,"add"));else {f(this,l,xt).call(this,m);let w=e(this,y)[m];if(i!==w){if(e(this,ht)&&f(this,l,_).call(this,w)){w.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:S}=w;S!==void 0&&!n&&(e(this,Z)&&((K=e(this,$))==null||K.call(this,S,t,"set")),e(this,N)&&e(this,C)?.push([S,t,"set"]));}else n||(e(this,Z)&&((tt=e(this,$))==null||tt.call(this,w,t,"set")),e(this,N)&&e(this,C)?.push([w,t,"set"]));if(e(this,ut).call(this,m),e(this,vt).call(this,m,g,h),e(this,y)[m]=i,h){h.set="replace";let S=w&&f(this,l,_).call(this,w)?w.__staleWhileFetching:w;S!==void 0&&(h.oldValue=S);}}else h&&(h.set="update");e(this,bt)&&this.onInsert?.(i,t,i===w?"update":"replace");}if(r!==0&&!e(this,j)&&f(this,l,Nt).call(this),e(this,j)&&(d||e(this,Ht).call(this,m,r,o),h&&e(this,st).call(this,h,m)),!n&&e(this,N)&&e(this,C)){let w=e(this,C),S;for(;S=w?.shift();)(H=e(this,B))==null||H.call(this,...S);}return this}pop(){var t;try{for(;e(this,T);){let i=e(this,y)[e(this,z)];if(f(this,l,Ft).call(this,!0),f(this,l,_).call(this,i)){if(i.__staleWhileFetching)return i.__staleWhileFetching}else if(i!==void 0)return i}}finally{if(e(this,N)&&e(this,C)){let i=e(this,C),s;for(;s=i?.shift();)(t=e(this,B))==null||t.call(this,...s);}}}has(t,i={}){let{updateAgeOnHas:s=this.updateAgeOnHas,status:r}=i,o=e(this,E).get(t);if(o!==void 0){let n=e(this,y)[o];if(f(this,l,_).call(this,n)&&n.__staleWhileFetching===void 0)return false;if(e(this,U).call(this,o))r&&(r.has="stale",e(this,st).call(this,r,o));else return s&&e(this,ft).call(this,o),r&&(r.has="hit",e(this,st).call(this,r,o)),true}else r&&(r.has="miss");return false}peek(t,i={}){let{allowStale:s=this.allowStale}=i,r=e(this,E).get(t);if(r===void 0||!s&&e(this,U).call(this,r))return;let o=e(this,y)[r];return f(this,l,_).call(this,o)?o.__staleWhileFetching:o}async fetch(t,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,ttl:n=this.ttl,noDisposeOnSet:a=this.noDisposeOnSet,size:h=0,sizeCalculation:d=this.sizeCalculation,noUpdateTTL:g=this.noUpdateTTL,noDeleteOnFetchRejection:m=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:v=this.allowStaleOnFetchRejection,ignoreFetchAbort:K=this.ignoreFetchAbort,allowStaleOnFetchAbort:tt=this.allowStaleOnFetchAbort,context:H,forceRefresh:w=false,status:S,signal:I}=i;if(!e(this,ht))return S&&(S.fetch="get"),this.get(t,{allowStale:s,updateAgeOnGet:r,noDeleteOnStaleGet:o,status:S});let R={allowStale:s,updateAgeOnGet:r,noDeleteOnStaleGet:o,ttl:n,noDisposeOnSet:a,size:h,sizeCalculation:d,noUpdateTTL:g,noDeleteOnFetchRejection:m,allowStaleOnFetchRejection:v,allowStaleOnFetchAbort:tt,ignoreFetchAbort:K,status:S,signal:I},M=e(this,E).get(t);if(M===void 0){S&&(S.fetch="miss");let A=f(this,l,Ct).call(this,t,M,R,H);return A.__returned=A}else {let A=e(this,y)[M];if(f(this,l,_).call(this,A)){let yt=s&&A.__staleWhileFetching!==void 0;return S&&(S.fetch="inflight",yt&&(S.returnedStale=true)),yt?A.__staleWhileFetching:A.__returned=A}let _t=e(this,U).call(this,M);if(!w&&!_t)return S&&(S.fetch="hit"),f(this,l,xt).call(this,M),r&&e(this,ft).call(this,M),S&&e(this,st).call(this,S,M),A;let pt=f(this,l,Ct).call(this,t,M,R,H),dt=pt.__staleWhileFetching!==void 0&&s;return S&&(S.fetch=_t?"stale":"refresh",dt&&_t&&(S.returnedStale=true)),dt?pt.__staleWhileFetching:pt.__returned=pt}}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:r,forceRefresh:o,...n}=i,a=this.get(t,n);if(!o&&a!==void 0)return a;let h=s(t,a,{options:n,context:r});return this.set(t,h,n),h}get(t,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,status:n}=i,a=e(this,E).get(t);if(a!==void 0){let h=e(this,y)[a],d=f(this,l,_).call(this,h);return n&&e(this,st).call(this,n,a),e(this,U).call(this,a)?(n&&(n.get="stale"),d?(n&&s&&h.__staleWhileFetching!==void 0&&(n.returnedStale=true),s?h.__staleWhileFetching:void 0):(o||f(this,l,at).call(this,t,"expire"),n&&s&&(n.returnedStale=true),s?h:void 0)):(n&&(n.get="hit"),d?h.__staleWhileFetching:(f(this,l,xt).call(this,a),r&&e(this,ft).call(this,a),h))}else n&&(n.get="miss");}delete(t){return f(this,l,at).call(this,t,"delete")}clear(){return f(this,l,kt).call(this,"delete")}},P=new WeakMap,k=new WeakMap,$=new WeakMap,ct=new WeakMap,B=new WeakMap,mt=new WeakMap,St=new WeakMap,q=new WeakMap,T=new WeakMap,J=new WeakMap,E=new WeakMap,x=new WeakMap,y=new WeakMap,G=new WeakMap,W=new WeakMap,z=new WeakMap,F=new WeakMap,Y=new WeakMap,C=new WeakMap,X=new WeakMap,Q=new WeakMap,j=new WeakMap,V=new WeakMap,Z=new WeakMap,ht=new WeakMap,N=new WeakMap,bt=new WeakMap,l=new WeakSet,Nt=function(){let t=new Tt(e(this,P)),i=new Tt(e(this,P));u(this,j,t),u(this,Q,i);let s=this.ttlAutopurge?new Array(e(this,P)):void 0;u(this,V,s),u(this,Ht,(a,h,d=e(this,q).now())=>{i[a]=h!==0?d:0,t[a]=h,r(a,h);}),u(this,ft,a=>{i[a]=t[a]!==0?e(this,q).now():0,r(a,t[a]);});let r=this.ttlAutopurge?(a,h)=>{if(s?.[a]&&(clearTimeout(s[a]),s[a]=void 0),h&&h!==0&&s){let d=setTimeout(()=>{e(this,U).call(this,a)&&f(this,l,at).call(this,e(this,x)[a],"expire");},h+1);d.unref&&d.unref(),s[a]=d;}}:()=>{};u(this,st,(a,h)=>{if(t[h]){let d=t[h],g=i[h];if(!d||!g)return;a.ttl=d,a.start=g,a.now=o||n();let m=a.now-g;a.remainingTTL=d-m;}});let o=0,n=()=>{let a=e(this,q).now();if(this.ttlResolution>0){o=a;let h=setTimeout(()=>o=0,this.ttlResolution);h.unref&&h.unref();}return a};this.getRemainingTTL=a=>{let h=e(this,E).get(a);if(h===void 0)return 0;let d=t[h],g=i[h];if(!d||!g)return 1/0;let m=(o||n())-g;return d-m},u(this,U,a=>{let h=i[a],d=t[a];return !!d&&!!h&&(o||n())-h>d});},ft=new WeakMap,st=new WeakMap,Ht=new WeakMap,U=new WeakMap,qt=function(){let t=new Tt(e(this,P));u(this,J,0),u(this,X,t),u(this,ut,i=>{u(this,J,e(this,J)-t[i]),t[i]=0;}),u(this,At,(i,s,r,o)=>{if(f(this,l,_).call(this,s))return 0;if(!rt(r))if(o){if(typeof o!="function")throw new TypeError("sizeCalculation must be a function");if(r=o(s,i),!rt(r))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 r}),u(this,vt,(i,s,r)=>{if(t[i]=s,e(this,k)){let o=e(this,k)-t[i];for(;e(this,J)>o;)f(this,l,Ft).call(this,true);}u(this,J,e(this,J)+t[i]),r&&(r.entrySize=s,r.totalCalculatedSize=e(this,J));});},ut=new WeakMap,vt=new WeakMap,At=new WeakMap,ot=function*({allowStale:t=this.allowStale}={}){if(e(this,T))for(let i=e(this,F);!(!f(this,l,Rt).call(this,i)||((t||!e(this,U).call(this,i))&&(yield i),i===e(this,z)));)i=e(this,W)[i];},nt=function*({allowStale:t=this.allowStale}={}){if(e(this,T))for(let i=e(this,z);!(!f(this,l,Rt).call(this,i)||((t||!e(this,U).call(this,i))&&(yield i),i===e(this,F)));)i=e(this,G)[i];},Rt=function(t){return t!==void 0&&e(this,E).get(e(this,x)[t])===t},Ft=function(t){var o;let i=e(this,z),s=e(this,x)[i],r=e(this,y)[i];return e(this,ht)&&f(this,l,_).call(this,r)?r.__abortController.abort(new Error("evicted")):(e(this,Z)||e(this,N))&&(e(this,Z)&&((o=e(this,$))==null||o.call(this,r,s,"evict")),e(this,N)&&e(this,C)?.push([r,s,"evict"])),e(this,ut).call(this,i),e(this,V)?.[i]&&(clearTimeout(e(this,V)[i]),e(this,V)[i]=void 0),t&&(e(this,x)[i]=void 0,e(this,y)[i]=void 0,e(this,Y).push(i)),e(this,T)===1?(u(this,z,u(this,F,0)),e(this,Y).length=0):u(this,z,e(this,G)[i]),e(this,E).delete(s),Ot(this,T)._--,i},Ct=function(t,i,s,r){let o=i===void 0?void 0:e(this,y)[i];if(f(this,l,_).call(this,o))return o;let n=new Dt,{signal:a}=s;a?.addEventListener("abort",()=>n.abort(a.reason),{signal:n.signal});let h={signal:n.signal,options:s,context:r},d=(H,w=false)=>{let{aborted:S}=n.signal,I=s.ignoreFetchAbort&&H!==void 0,R=s.ignoreFetchAbort||!!(s.allowStaleOnFetchAbort&&H!==void 0);if(s.status&&(S&&!w?(s.status.fetchAborted=true,s.status.fetchError=n.signal.reason,I&&(s.status.fetchAbortIgnored=true)):s.status.fetchResolved=true),S&&!I&&!w)return m(n.signal.reason,R);let M=K,A=e(this,y)[i];return (A===K||I&&w&&A===void 0)&&(H===void 0?M.__staleWhileFetching!==void 0?e(this,y)[i]=M.__staleWhileFetching:f(this,l,at).call(this,t,"fetch"):(s.status&&(s.status.fetchUpdated=true),this.set(t,H,h.options))),H},g=H=>(s.status&&(s.status.fetchRejected=true,s.status.fetchError=H),m(H,false)),m=(H,w)=>{let{aborted:S}=n.signal,I=S&&s.allowStaleOnFetchAbort,R=I||s.allowStaleOnFetchRejection,M=R||s.noDeleteOnFetchRejection,A=K;if(e(this,y)[i]===K&&(!M||!w&&A.__staleWhileFetching===void 0?f(this,l,at).call(this,t,"fetch"):I||(e(this,y)[i]=A.__staleWhileFetching)),R)return s.status&&A.__staleWhileFetching!==void 0&&(s.status.returnedStale=true),A.__staleWhileFetching;if(A.__returned===A)throw H},v=(H,w)=>{var I;let S=(I=e(this,mt))==null?void 0:I.call(this,t,o,h);S&&S instanceof Promise&&S.then(R=>H(R===void 0?void 0:R),w),n.signal.addEventListener("abort",()=>{(!s.ignoreFetchAbort||s.allowStaleOnFetchAbort)&&(H(void 0),s.allowStaleOnFetchAbort&&(H=R=>d(R,true)));});};s.status&&(s.status.fetchDispatched=true);let K=new Promise(v).then(d,g),tt=Object.assign(K,{__abortController:n,__staleWhileFetching:o,__returned:void 0});return i===void 0?(this.set(t,tt,{...h.options,status:void 0}),i=e(this,E).get(t)):e(this,y)[i]=tt,tt},_=function(t){if(!e(this,ht))return false;let i=t;return !!i&&i instanceof Promise&&i.hasOwnProperty("__staleWhileFetching")&&i.__abortController instanceof Dt},Lt=function(t,i){e(this,W)[i]=t,e(this,G)[t]=i;},xt=function(t){t!==e(this,F)&&(t===e(this,z)?u(this,z,e(this,G)[t]):f(this,l,Lt).call(this,e(this,W)[t],e(this,G)[t]),f(this,l,Lt).call(this,e(this,F),t),u(this,F,t));},at=function(t,i){var r,o;let s=false;if(e(this,T)!==0){let n=e(this,E).get(t);if(n!==void 0)if(e(this,V)?.[n]&&(clearTimeout(e(this,V)?.[n]),e(this,V)[n]=void 0),s=true,e(this,T)===1)f(this,l,kt).call(this,i);else {e(this,ut).call(this,n);let a=e(this,y)[n];if(f(this,l,_).call(this,a)?a.__abortController.abort(new Error("deleted")):(e(this,Z)||e(this,N))&&(e(this,Z)&&((r=e(this,$))==null||r.call(this,a,t,i)),e(this,N)&&e(this,C)?.push([a,t,i])),e(this,E).delete(t),e(this,x)[n]=void 0,e(this,y)[n]=void 0,n===e(this,F))u(this,F,e(this,W)[n]);else if(n===e(this,z))u(this,z,e(this,G)[n]);else {let h=e(this,W)[n];e(this,G)[h]=e(this,G)[n];let d=e(this,G)[n];e(this,W)[d]=e(this,W)[n];}Ot(this,T)._--,e(this,Y).push(n);}}if(e(this,N)&&e(this,C)?.length){let n=e(this,C),a;for(;a=n?.shift();)(o=e(this,B))==null||o.call(this,...a);}return s},kt=function(t){var i,s;for(let r of f(this,l,nt).call(this,{allowStale:true})){let o=e(this,y)[r];if(f(this,l,_).call(this,o))o.__abortController.abort(new Error("deleted"));else {let n=e(this,x)[r];e(this,Z)&&((i=e(this,$))==null||i.call(this,o,n,t)),e(this,N)&&e(this,C)?.push([o,n,t]);}}if(e(this,E).clear(),e(this,y).fill(void 0),e(this,x).fill(void 0),e(this,j)&&e(this,Q)){e(this,j).fill(0),e(this,Q).fill(0);for(let r of e(this,V)??[])r!==void 0&&clearTimeout(r);e(this,V)?.fill(void 0);}if(e(this,X)&&e(this,X).fill(0),u(this,z,0),u(this,F,0),e(this,Y).length=0,u(this,J,0),u(this,T,0),e(this,N)&&e(this,C)){let r=e(this,C),o;for(;o=r?.shift();)(s=e(this,B))==null||s.call(this,...o);}},wt);var lt=class{cache;map=new Map;constructor(t){this.cache=new Bt({max:t.cacheSize}),this.map=new Map;}get[Symbol.iterator](){return this.map[Symbol.iterator]}get[Symbol.toStringTag](){return this.map[Symbol.toStringTag]}clear(){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;(r=>(r.log=(o,...n)=>console.log(`[Pixi\u2019VN] ${o}`,...n),r.warn=(o,...n)=>console.warn(`[Pixi\u2019VN] ${o}`,...n),r.error=(o,...n)=>console.error(`[Pixi\u2019VN] ${o}`,...n),r.info=(o,...n)=>console.info(`[Pixi\u2019VN] ${o}`,...n)))(O||={});function it(c){try{if(typeof c>"u")return c;let t=JSON.stringify(c);return JSON.parse(t)}catch(t){throw O.error("Error creating exportable element",c,t),new core.PixiError("not_json_serializable","Error creating exportable element")}}var p=class c{static _diffHistory=new lt({cacheSize:5});static _stepsInfoHistory=new lt({cacheSize:5});static _narrationHistory=new lt({cacheSize:50});static stepLimitSaved=20;static _originalStepData=void 0;static get originalStepData(){return c._originalStepData?it(c._originalStepData):{path:"",storage:{},canvas:{elementAliasesOrder:[],elements:{},stage:{},tickers:{},tickersSteps:{},tickersOnPause:{},tickersToCompleteOnStepEnd:{tikersIds:[],stepAlias:[]}},sound:{soundAliasesOrder:[],soundsPlaying:{},playInStepIndex:{},filters:void 0},labelIndex:-1,openedLabels:[]}}static set originalStepData(t){c._originalStepData=it(t);}};function Jt(c,t){let i=it(c);return t.length>1&&"type"in t[0]&&(t=t.slice().reverse()),t.forEach(s=>{ie(i,s);}),i}function ie(c,t){let i=c;t.path&&t.path.length>0?t.path.forEach((s,r)=>{if(t.path&&r===t.path.length-1)switch(t.type){case "CHANGE":case "REMOVE":i[s]=t.oldValue;break;case "CREATE":Array.isArray(i)&&typeof s=="number"?i.splice(s,1):delete i[s];break}else i=i[s];}):O.warn("No path found, skipping diff",t);}var se={Date:true,RegExp:true,String:true,Number:true};function zt(c,t,i={cyclesFix:true},s=[]){let r=[],o=Array.isArray(c);for(let a in c){let h=c[a],d=o?+a:a;if(!(a in t)){r.push({type:"REMOVE",path:[d],oldValue:c[a]});continue}let g=t[a],m=typeof h=="object"&&typeof g=="object"&&Array.isArray(h)===Array.isArray(g);h&&g&&m&&!se[Object.getPrototypeOf(h)?.constructor?.name]&&(!i.cyclesFix||!s.includes(h))?r.push.apply(r,zt(h,g,i,i.cyclesFix?s.concat([h]):[]).map(v=>(v.path.unshift(d),v))):h!==g&&!(Number.isNaN(h)&&Number.isNaN(g))&&!(m&&(isNaN(h)?h+""==g+"":+h==+g))&&r.push({path:[d],type:"CHANGE",value:g,oldValue:h});}let n=Array.isArray(t);for(let a in t)a in c||r.push({type:"CREATE",path:[n?+a:a],value:t[a]});return r}var Et=class{get stepsInfoMap(){return p._stepsInfoHistory}get diffMap(){return p._diffHistory}get narrationMap(){return p._narrationHistory}get size(){return p._stepsInfoHistory.size}get lastKey(){return this.size===0?null:Math.max(...Array.from(this.keys()))}keys(){return p._stepsInfoHistory.keys()}get(t){let i=p._narrationHistory.get(t);if(!(i&&Object.keys(i).length===1&&i.stepIndex!==void 0))return i}delete(t){p._stepsInfoHistory.delete(t),p._diffHistory.delete(t),p._narrationHistory.delete(t);}getOldGameState(t,i){if(t<=0||this.size===0)return i;let s=this.lastKey;if(typeof s!="number")return O.warn("You can't go back, there is no step to go back"),i;let r=p._diffHistory.get(s);if(r)try{let o=Jt(i,r);return core.GameUnifier.stepCounter=s,this.delete(s),this.getOldGameState(t-1,o)}catch(o){return O.error("Error applying diff",o),i}else return O.warn("No diff found for the last step, cannot go back"),i}async back(t,i={}){let{steps:s=1}=i;if(!Number.isFinite(s)){O.warn(`[back] The parameter steps must be a valid finite number, received: ${s}`);return}if(s<=0){O.warn(`[back] The parameter steps must be greater than 0, received: ${s}`);return}if(core.GameUnifier.runningStepsCount>0){core.GameUnifier.increaseBackRequest(s);return}if(p._diffHistory.size<1){O.warn("You can't go back, there is no step to go back");return}core.GameUnifier.runningStepsCount++;try{let r=it(this.getOldGameState(s,p.originalStepData));if(r){await core.GameUnifier.restoreGameStepState(r,core.GameUnifier.navigate);let o=core.GameUnifier.stepCounter-1,n=p._narrationHistory.get(o);if(n&&Object.keys(n).length===1&&n.stepIndex!==void 0){let a=p._stepsInfoHistory.get(o);if(a){let h=this.itemMapper({step:a});p._narrationHistory.set(a.index,h);}}}else O.error("Error going back");p.originalStepData=r;}catch(r){O.error("Error going back",r);}if(core.GameUnifier.runningStepsCount--,core.GameUnifier.runningStepsCount===0&&core.GameUnifier.backRequestsCount!==0)return await core.GameUnifier.processNavigationRequests(t)}add(t,i={}){let s=p.originalStepData,{ignoreSameStep:r}=i,o=core.GameUnifier.currentGameStepState;if(!r&&this.isSameStep(s,o))return;let n=this.lastKey;(async()=>{try{let h,d;if(typeof n=="number"&&(h=p._stepsInfoHistory.get(n),d=p._narrationHistory.get(n)),p._stepsInfoHistory.set(t.index,t),t.index!==0){let v=zt(s,o);v?p._diffHistory.set(t.index,v):O.warn("It was not possible to create the difference between the two steps");}let g={},m=this.itemMapper({step:t},g);if(p._narrationHistory.set(t.index,m),h&&d&&typeof n=="number"){let v=this.itemMapper({...g,step:h},{});p._narrationHistory.set(n,v);}}catch(h){O.error("Error adding history step",h);}})(),p.originalStepData=o;}itemMapper(t,i){let{step:s,choiceIndexMade:r,inputValue:o,removeDialogue:n}=t,a=s.dialogue;i&&s.isGlued&&(i.removeDialogue=true),n&&(a=void 0);let h=s.choices;if(i&&s.currentLabel&&s.choiceIndexMade!==void 0&&(i.choiceIndexMade=s.choiceIndexMade),s.inputValue&&i&&(i.inputValue=s.inputValue),a||h||o){let d=h?.map((g,m)=>{let v=false;return g.oneTime&&s.alreadyMadeChoices?.includes(m)&&(v=true),{text:g.text,type:g.type,isResponse:false,hidden:v}});if(d){if(d.every(g=>g.hidden)){let g=d.find(m=>m.hidden===false);g&&(g.hidden=false);}r!==void 0&&(d[r].isResponse=true);}return {dialogue:a?{...a,character:a.character?core.GameUnifier.getCharacter(a.character)||a.character:void 0}:void 0,playerMadeChoice:typeof r=="number",choices:d,stepIndex:s.index,inputValue:o}}return {stepIndex:s.index}}get narrativeHistory(){let t=[];return Array.from(this.keys()).sort((s,r)=>s-r).forEach(s=>{let r=this.get(s);r&&t.push(r);}),t}get currentLabelHistory(){let t=[],i=Array.from(this.keys()).sort((h,d)=>d-h);if(i.length===0)return t;let s=i[0];if(typeof s!="number")return t;let r=p._stepsInfoHistory.get(s);if(!r)return t;let o=r.openedLabels;if(!o||!Array.isArray(o)||o.length===0)return t;let n=o[0].currentStepIndex,a=o[0].label;return i.every((h,d)=>{let g=this.get(h);if(g){if(d===0)return t.push(g),true;let m=p._stepsInfoHistory.get(h);if(!m)return true;let v=m.openedLabels;if(!v||!Array.isArray(v)||v.length===0||v[0].label!==a||v[0].currentStepIndex>=n)return false;n=v[0].currentStepIndex,t.push(g);}return true}),t.reverse()}removeNarrativeHistory(t){if(t){let i=Array.from(this.keys()).sort((s,r)=>s-r);i=i.slice(0,t),i.forEach(s=>{p._narrationHistory.delete(s),p._stepsInfoHistory.delete(s),p._diffHistory.delete(s);});}else p._stepsInfoHistory.clear(),p._diffHistory.clear(),p._narrationHistory.clear();}get canGoBack(){let t=this.lastKey;return typeof t!="number"?false:p._diffHistory.has(t)}blockGoBack(){core.GameUnifier.runningStepsCount===0&&p._diffHistory.clear();}isSameStep(t,i){if(t.openedLabels.length===i.openedLabels.length)try{let s=JSON.stringify(t.openedLabels),r=JSON.stringify(i.openedLabels);if(s===r&&t.path===i.path&&t.labelIndex===i.labelIndex)return !0}catch(s){return O.error("Error comparing opened labels",s),true}return false}clear(){p._stepsInfoHistory.clear(),p._diffHistory.clear(),p._narrationHistory.clear(),p._originalStepData=void 0;}get stepLimitSaved(){return p.stepLimitSaved}set stepLimitSaved(t){p.stepLimitSaved=t;}export(){let t=Array.from(this.keys()).sort((s,r)=>s-r);t.length>this.stepLimitSaved&&(t=t.slice(t.length-this.stepLimitSaved));let i=[];return t.forEach(s=>{let r=p._stepsInfoHistory.get(s);if(r){let o=p._diffHistory.get(s);i.push({...r,diff:o});}}),{stepsHistory:it(i),originalStepData:it(p._originalStepData)}}restoreNarrativeHistory(){let t=Array.from(this.keys()).sort((s,r)=>s-r),i={};t.forEach(s=>{let r=p._stepsInfoHistory.get(s);if(r){let o={...i};i={};let n=this.itemMapper({step:r,choiceIndexMade:o.choiceIndexMade,inputValue:o.inputValue,removeDialogue:o.removeDialogue},i);n&&p._narrationHistory.set(s,n);}});}async restore(t){this.clear();try{Object.hasOwn(t,"stepsHistory")?(t.stepsHistory.forEach(s=>{s.diff&&p._diffHistory.set(s.index,s.diff);let r={...s,diff:void 0};p._stepsInfoHistory.set(s.index,r);}),this.restoreNarrativeHistory()):O.warn("Could not import stepsHistory data, so will be ignored"),Object.hasOwn(t,"originalStepData")?p._originalStepData=t.originalStepData:O.warn("Could not import originalStepData data, so will be ignored");}catch(i){O.error("Error importing data",i);}}};var Ge=new Et;exports.HistoryManagerStatic=p;exports.stepHistory=Ge;
|
package/dist/history.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import'./chunk-JMOSOAGB.mjs';import {d,f,e}from'./chunk-HQQ5WH6C.mjs';import {GameUnifier}from'
|
|
1
|
+
import'./chunk-JMOSOAGB.mjs';import {d,f,e}from'./chunk-HQQ5WH6C.mjs';import {GameUnifier}from'@drincs/pixi-vn/core';var i=class y{static _diffHistory=new d({cacheSize:5});static _stepsInfoHistory=new d({cacheSize:5});static _narrationHistory=new d({cacheSize:50});static stepLimitSaved=20;static _originalStepData=void 0;static get originalStepData(){return y._originalStepData?f(y._originalStepData):{path:"",storage:{},canvas:{elementAliasesOrder:[],elements:{},stage:{},tickers:{},tickersSteps:{},tickersOnPause:{},tickersToCompleteOnStepEnd:{tikersIds:[],stepAlias:[]}},sound:{soundAliasesOrder:[],soundsPlaying:{},playInStepIndex:{},filters:void 0},labelIndex:-1,openedLabels:[]}}static set originalStepData(e){y._originalStepData=f(e);}};function b(y,e){let r=f(y);return e.length>1&&"type"in e[0]&&(e=e.slice().reverse()),e.forEach(t=>{x(r,t);}),r}function x(y,e$1){let r=y;e$1.path&&e$1.path.length>0?e$1.path.forEach((t,a)=>{if(e$1.path&&a===e$1.path.length-1)switch(e$1.type){case "CHANGE":case "REMOVE":r[t]=e$1.oldValue;break;case "CREATE":Array.isArray(r)&&typeof t=="number"?r.splice(t,1):delete r[t];break}else r=r[t];}):e.warn("No path found, skipping diff",e$1);}var _={Date:true,RegExp:true,String:true,Number:true};function S(y,e,r={cyclesFix:true},t=[]){let a=[],s=Array.isArray(y);for(let o in y){let n=y[o],u=s?+o:o;if(!(o in e)){a.push({type:"REMOVE",path:[u],oldValue:y[o]});continue}let p=e[o],m=typeof n=="object"&&typeof p=="object"&&Array.isArray(n)===Array.isArray(p);n&&p&&m&&!_[Object.getPrototypeOf(n)?.constructor?.name]&&(!r.cyclesFix||!t.includes(n))?a.push.apply(a,S(n,p,r,r.cyclesFix?t.concat([n]):[]).map(f=>(f.path.unshift(u),f))):n!==p&&!(Number.isNaN(n)&&Number.isNaN(p))&&!(m&&(isNaN(n)?n+""==p+"":+n==+p))&&a.push({path:[u],type:"CHANGE",value:p,oldValue:n});}let c=Array.isArray(e);for(let o in e)o in y||a.push({type:"CREATE",path:[c?+o:o],value:e[o]});return a}var h=class{get stepsInfoMap(){return i._stepsInfoHistory}get diffMap(){return i._diffHistory}get narrationMap(){return i._narrationHistory}get size(){return i._stepsInfoHistory.size}get lastKey(){return this.size===0?null:Math.max(...Array.from(this.keys()))}keys(){return i._stepsInfoHistory.keys()}get(e){let r=i._narrationHistory.get(e);if(!(r&&Object.keys(r).length===1&&r.stepIndex!==void 0))return r}delete(e){i._stepsInfoHistory.delete(e),i._diffHistory.delete(e),i._narrationHistory.delete(e);}getOldGameState(e$1,r){if(e$1<=0||this.size===0)return r;let t=this.lastKey;if(typeof t!="number")return e.warn("You can't go back, there is no step to go back"),r;let a=i._diffHistory.get(t);if(a)try{let s=b(r,a);return GameUnifier.stepCounter=t,this.delete(t),this.getOldGameState(e$1-1,s)}catch(s){return e.error("Error applying diff",s),r}else return e.warn("No diff found for the last step, cannot go back"),r}async back(e$1,r={}){let{steps:t=1}=r;if(!Number.isFinite(t)){e.warn(`[back] The parameter steps must be a valid finite number, received: ${t}`);return}if(t<=0){e.warn(`[back] The parameter steps must be greater than 0, received: ${t}`);return}if(GameUnifier.runningStepsCount>0){GameUnifier.increaseBackRequest(t);return}if(i._diffHistory.size<1){e.warn("You can't go back, there is no step to go back");return}GameUnifier.runningStepsCount++;try{let a=f(this.getOldGameState(t,i.originalStepData));if(a){await GameUnifier.restoreGameStepState(a,GameUnifier.navigate);let s=GameUnifier.stepCounter-1,c=i._narrationHistory.get(s);if(c&&Object.keys(c).length===1&&c.stepIndex!==void 0){let o=i._stepsInfoHistory.get(s);if(o){let n=this.itemMapper({step:o});i._narrationHistory.set(o.index,n);}}}else e.error("Error going back");i.originalStepData=a;}catch(a){e.error("Error going back",a);}if(GameUnifier.runningStepsCount--,GameUnifier.runningStepsCount===0&&GameUnifier.backRequestsCount!==0)return await GameUnifier.processNavigationRequests(e$1)}add(e$1,r={}){let t=i.originalStepData,{ignoreSameStep:a}=r,s=GameUnifier.currentGameStepState;if(!a&&this.isSameStep(t,s))return;let c=this.lastKey;(async()=>{try{let n,u;if(typeof c=="number"&&(n=i._stepsInfoHistory.get(c),u=i._narrationHistory.get(c)),i._stepsInfoHistory.set(e$1.index,e$1),e$1.index!==0){let f=S(t,s);f?i._diffHistory.set(e$1.index,f):e.warn("It was not possible to create the difference between the two steps");}let p={},m=this.itemMapper({step:e$1},p);if(i._narrationHistory.set(e$1.index,m),n&&u&&typeof c=="number"){let f=this.itemMapper({...p,step:n},{});i._narrationHistory.set(c,f);}}catch(n){e.error("Error adding history step",n);}})(),i.originalStepData=s;}itemMapper(e,r){let{step:t,choiceIndexMade:a,inputValue:s,removeDialogue:c}=e,o=t.dialogue;r&&t.isGlued&&(r.removeDialogue=true),c&&(o=void 0);let n=t.choices;if(r&&t.currentLabel&&t.choiceIndexMade!==void 0&&(r.choiceIndexMade=t.choiceIndexMade),t.inputValue&&r&&(r.inputValue=t.inputValue),o||n||s){let u=n?.map((p,m)=>{let f=false;return p.oneTime&&t.alreadyMadeChoices?.includes(m)&&(f=true),{text:p.text,type:p.type,isResponse:false,hidden:f}});if(u){if(u.every(p=>p.hidden)){let p=u.find(m=>m.hidden===false);p&&(p.hidden=false);}a!==void 0&&(u[a].isResponse=true);}return {dialogue:o?{...o,character:o.character?GameUnifier.getCharacter(o.character)||o.character:void 0}:void 0,playerMadeChoice:typeof a=="number",choices:u,stepIndex:t.index,inputValue:s}}return {stepIndex:t.index}}get narrativeHistory(){let e=[];return Array.from(this.keys()).sort((t,a)=>t-a).forEach(t=>{let a=this.get(t);a&&e.push(a);}),e}get currentLabelHistory(){let e=[],r=Array.from(this.keys()).sort((n,u)=>u-n);if(r.length===0)return e;let t=r[0];if(typeof t!="number")return e;let a=i._stepsInfoHistory.get(t);if(!a)return e;let s=a.openedLabels;if(!s||!Array.isArray(s)||s.length===0)return e;let c=s[0].currentStepIndex,o=s[0].label;return r.every((n,u)=>{let p=this.get(n);if(p){if(u===0)return e.push(p),true;let m=i._stepsInfoHistory.get(n);if(!m)return true;let f=m.openedLabels;if(!f||!Array.isArray(f)||f.length===0||f[0].label!==o||f[0].currentStepIndex>=c)return false;c=f[0].currentStepIndex,e.push(p);}return true}),e.reverse()}removeNarrativeHistory(e){if(e){let r=Array.from(this.keys()).sort((t,a)=>t-a);r=r.slice(0,e),r.forEach(t=>{i._narrationHistory.delete(t),i._stepsInfoHistory.delete(t),i._diffHistory.delete(t);});}else i._stepsInfoHistory.clear(),i._diffHistory.clear(),i._narrationHistory.clear();}get canGoBack(){let e=this.lastKey;return typeof e!="number"?false:i._diffHistory.has(e)}blockGoBack(){GameUnifier.runningStepsCount===0&&i._diffHistory.clear();}isSameStep(e$1,r){if(e$1.openedLabels.length===r.openedLabels.length)try{let t=JSON.stringify(e$1.openedLabels),a=JSON.stringify(r.openedLabels);if(t===a&&e$1.path===r.path&&e$1.labelIndex===r.labelIndex)return !0}catch(t){return e.error("Error comparing opened labels",t),true}return false}clear(){i._stepsInfoHistory.clear(),i._diffHistory.clear(),i._narrationHistory.clear(),i._originalStepData=void 0;}get stepLimitSaved(){return i.stepLimitSaved}set stepLimitSaved(e){i.stepLimitSaved=e;}export(){let e=Array.from(this.keys()).sort((t,a)=>t-a);e.length>this.stepLimitSaved&&(e=e.slice(e.length-this.stepLimitSaved));let r=[];return e.forEach(t=>{let a=i._stepsInfoHistory.get(t);if(a){let s=i._diffHistory.get(t);r.push({...a,diff:s});}}),{stepsHistory:f(r),originalStepData:f(i._originalStepData)}}restoreNarrativeHistory(){let e=Array.from(this.keys()).sort((t,a)=>t-a),r={};e.forEach(t=>{let a=i._stepsInfoHistory.get(t);if(a){let s={...r};r={};let c=this.itemMapper({step:a,choiceIndexMade:s.choiceIndexMade,inputValue:s.inputValue,removeDialogue:s.removeDialogue},r);c&&i._narrationHistory.set(t,c);}});}async restore(e$1){this.clear();try{Object.hasOwn(e$1,"stepsHistory")?(e$1.stepsHistory.forEach(t=>{t.diff&&i._diffHistory.set(t.index,t.diff);let a={...t,diff:void 0};i._stepsInfoHistory.set(t.index,a);}),this.restoreNarrativeHistory()):e.warn("Could not import stepsHistory data, so will be ignored"),Object.hasOwn(e$1,"originalStepData")?i._originalStepData=e$1.originalStepData:e.warn("Could not import originalStepData data, so will be ignored");}catch(r){e.error("Error importing data",r);}}};var j=new h;export{i as HistoryManagerStatic,j as stepHistory};
|
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';Object.defineProperty(exports,'__esModule',{value:true});var nt=require('./canvas.cjs'),Bt=require('./characters.cjs'),core=require('./core.cjs'),et=require('./history.cjs'),L=require('./narration.cjs'),pt=require('./sound.cjs'),G=require('./storage.cjs'),motion=require('./motion.cjs');function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var nt__namespace=/*#__PURE__*/_interopNamespace(nt);var Bt__namespace=/*#__PURE__*/_interopNamespace(Bt);var et__namespace=/*#__PURE__*/_interopNamespace(et);var L__namespace=/*#__PURE__*/_interopNamespace(L);var pt__namespace=/*#__PURE__*/_interopNamespace(pt);var G__namespace=/*#__PURE__*/_interopNamespace(G);var Xt=Object.defineProperty;var Jt=h=>{throw TypeError(h)};var ue=(h,e,i)=>e in h?Xt(h,e,{enumerable:true,configurable:true,writable:true,value:i}):h[e]=i;var fe=(h,e)=>{for(var i in e)Xt(h,i,{get:e[i],enumerable:true});};var C=(h,e,i)=>ue(h,typeof e!="symbol"?e+"":e,i),jt=(h,e,i)=>e.has(h)||Jt("Cannot "+i);var t=(h,e,i)=>(jt(h,e,"read from private field"),i?i.call(h):e.get(h)),_=(h,e,i)=>e.has(h)?Jt("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(h):e.set(h,i),u=(h,e,i,s)=>(jt(h,e,"write to private field"),e.set(h,i),i),d=(h,e,i)=>(jt(h,e,"access private method"),i);var Rt=(h,e,i,s)=>({set _(r){u(h,e,r);},get _(){return t(h,e,s)}});var me=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,ee=new Set,Gt=typeof process=="object"&&process?process:{},ie=(h,e,i,s)=>{typeof Gt.emitWarning=="function"?Gt.emitWarning(h,e,i,s):console.error(`[${i}] ${e}: ${h}`);},Nt=globalThis.AbortController,Qt=globalThis.AbortSignal;if(typeof Nt>"u"){Qt=class{onabort;_onabort=[];reason;aborted=false;addEventListener(i,s){this._onabort.push(s);}},Nt=class{constructor(){e();}signal=new Qt;abort(i){if(!this.signal.aborted){this.signal.reason=i,this.signal.aborted=true;for(let s of this.signal._onabort)s(i);this.signal.onabort?.(i);}}};let h=Gt.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{h&&(h=false,ie("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 ge=h=>!ee.has(h);var at=h=>h&&h===Math.floor(h)&&h>0&&isFinite(h),se=h=>at(h)?h<=Math.pow(2,8)?Uint8Array:h<=Math.pow(2,16)?Uint16Array:h<=Math.pow(2,32)?Uint32Array:h<=Number.MAX_SAFE_INTEGER?Dt:null:null,Dt=class extends Array{constructor(h){super(h),this.fill(0);}},it,St,_e=(it=class{heap;length;static create(e){let i=se(e);if(!i)return [];u(it,St,true);let s=new it(e,i);return u(it,St,false),s}constructor(e,i){if(!t(it,St))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new i(e),this.length=0;}push(e){this.heap[this.length++]=e;}pop(){return this.heap[--this.length]}},St=new WeakMap,_(it,St,false),it),Zt,te,K,M,q,ut,$,yt,xt,B,O,X,T,b,m,P,z,N,R,J,D,Q,Z,V,W,tt,dt,j,Et,l,It,ft,ot,Tt,Y,oe,mt,bt,Ot,lt,ht,Mt,Lt,Ct,E,zt,At,ct,Vt,wt,re=(wt=class{constructor(e){_(this,l);_(this,K);_(this,M);_(this,q);_(this,ut);_(this,$);_(this,yt);_(this,xt);_(this,B);C(this,"ttl");C(this,"ttlResolution");C(this,"ttlAutopurge");C(this,"updateAgeOnGet");C(this,"updateAgeOnHas");C(this,"allowStale");C(this,"noDisposeOnSet");C(this,"noUpdateTTL");C(this,"maxEntrySize");C(this,"sizeCalculation");C(this,"noDeleteOnFetchRejection");C(this,"noDeleteOnStaleGet");C(this,"allowStaleOnFetchAbort");C(this,"allowStaleOnFetchRejection");C(this,"ignoreFetchAbort");_(this,O);_(this,X);_(this,T);_(this,b);_(this,m);_(this,P);_(this,z);_(this,N);_(this,R);_(this,J);_(this,D);_(this,Q);_(this,Z);_(this,V);_(this,W);_(this,tt);_(this,dt);_(this,j);_(this,Et);_(this,ft,()=>{});_(this,ot,()=>{});_(this,Tt,()=>{});_(this,Y,()=>false);_(this,mt,e=>{});_(this,bt,(e,i,s)=>{});_(this,Ot,(e,i,s,r)=>{if(s||r)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});C(this,Zt,"LRUCache");let{max:i=0,ttl:s,ttlResolution:r=1,ttlAutopurge:n,updateAgeOnGet:o,updateAgeOnHas:c,allowStale:p,dispose:v,onInsert:U,disposeAfter:S,noDisposeOnSet:rt,noUpdateTTL:I,maxSize:k=0,maxEntrySize:w=0,sizeCalculation:y,fetchMethod:a,memoMethod:x,noDeleteOnFetchRejection:A,noDeleteOnStaleGet:f,allowStaleOnFetchRejection:g,allowStaleOnFetchAbort:F,ignoreFetchAbort:H,perf:_t}=e;if(_t!==void 0&&typeof _t?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(u(this,B,_t??me),i!==0&&!at(i))throw new TypeError("max option must be a nonnegative integer");let vt=i?se(i):Array;if(!vt)throw new Error("invalid max value: "+i);if(u(this,K,i),u(this,M,k),this.maxEntrySize=w||t(this,M),this.sizeCalculation=y,this.sizeCalculation){if(!t(this,M)&&!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(u(this,xt,x),a!==void 0&&typeof a!="function")throw new TypeError("fetchMethod must be a function if specified");if(u(this,yt,a),u(this,dt,!!a),u(this,T,new Map),u(this,b,new Array(i).fill(void 0)),u(this,m,new Array(i).fill(void 0)),u(this,P,new vt(i)),u(this,z,new vt(i)),u(this,N,0),u(this,R,0),u(this,J,_e.create(i)),u(this,O,0),u(this,X,0),typeof v=="function"&&u(this,q,v),typeof U=="function"&&u(this,ut,U),typeof S=="function"?(u(this,$,S),u(this,D,[])):(u(this,$,void 0),u(this,D,void 0)),u(this,tt,!!t(this,q)),u(this,Et,!!t(this,ut)),u(this,j,!!t(this,$)),this.noDisposeOnSet=!!rt,this.noUpdateTTL=!!I,this.noDeleteOnFetchRejection=!!A,this.allowStaleOnFetchRejection=!!g,this.allowStaleOnFetchAbort=!!F,this.ignoreFetchAbort=!!H,this.maxEntrySize!==0){if(t(this,M)!==0&&!at(t(this,M)))throw new TypeError("maxSize must be a positive integer if specified");if(!at(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");d(this,l,oe).call(this);}if(this.allowStale=!!p,this.noDeleteOnStaleGet=!!f,this.updateAgeOnGet=!!o,this.updateAgeOnHas=!!c,this.ttlResolution=at(r)||r===0?r:1,this.ttlAutopurge=!!n,this.ttl=s||0,this.ttl){if(!at(this.ttl))throw new TypeError("ttl must be a positive integer if specified");d(this,l,It).call(this);}if(t(this,K)===0&&this.ttl===0&&t(this,M)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!t(this,K)&&!t(this,M)){let Pt="LRU_CACHE_UNBOUNDED";ge(Pt)&&(ee.add(Pt),ie("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",Pt,wt));}}get perf(){return t(this,B)}static unsafeExposeInternals(e){return {starts:t(e,Z),ttls:t(e,V),autopurgeTimers:t(e,W),sizes:t(e,Q),keyMap:t(e,T),keyList:t(e,b),valList:t(e,m),next:t(e,P),prev:t(e,z),get head(){return t(e,N)},get tail(){return t(e,R)},free:t(e,J),isBackgroundFetch:i=>{var s;return d(s=e,l,E).call(s,i)},backgroundFetch:(i,s,r,n)=>{var o;return d(o=e,l,Ct).call(o,i,s,r,n)},moveToTail:i=>{var s;return d(s=e,l,At).call(s,i)},indexes:i=>{var s;return d(s=e,l,lt).call(s,i)},rindexes:i=>{var s;return d(s=e,l,ht).call(s,i)},isStale:i=>{var s;return t(s=e,Y).call(s,i)}}}get max(){return t(this,K)}get maxSize(){return t(this,M)}get calculatedSize(){return t(this,X)}get size(){return t(this,O)}get fetchMethod(){return t(this,yt)}get memoMethod(){return t(this,xt)}get dispose(){return t(this,q)}get onInsert(){return t(this,ut)}get disposeAfter(){return t(this,$)}getRemainingTTL(e){return t(this,T).has(e)?1/0:0}*entries(){for(let e of d(this,l,lt).call(this))t(this,m)[e]!==void 0&&t(this,b)[e]!==void 0&&!d(this,l,E).call(this,t(this,m)[e])&&(yield [t(this,b)[e],t(this,m)[e]]);}*rentries(){for(let e of d(this,l,ht).call(this))t(this,m)[e]!==void 0&&t(this,b)[e]!==void 0&&!d(this,l,E).call(this,t(this,m)[e])&&(yield [t(this,b)[e],t(this,m)[e]]);}*keys(){for(let e of d(this,l,lt).call(this)){let i=t(this,b)[e];i!==void 0&&!d(this,l,E).call(this,t(this,m)[e])&&(yield i);}}*rkeys(){for(let e of d(this,l,ht).call(this)){let i=t(this,b)[e];i!==void 0&&!d(this,l,E).call(this,t(this,m)[e])&&(yield i);}}*values(){for(let e of d(this,l,lt).call(this))t(this,m)[e]!==void 0&&!d(this,l,E).call(this,t(this,m)[e])&&(yield t(this,m)[e]);}*rvalues(){for(let e of d(this,l,ht).call(this))t(this,m)[e]!==void 0&&!d(this,l,E).call(this,t(this,m)[e])&&(yield t(this,m)[e]);}[(te=Symbol.iterator,Zt=Symbol.toStringTag,te)](){return this.entries()}find(e,i={}){for(let s of d(this,l,lt).call(this)){let r=t(this,m)[s],n=d(this,l,E).call(this,r)?r.__staleWhileFetching:r;if(n!==void 0&&e(n,t(this,b)[s],this))return this.get(t(this,b)[s],i)}}forEach(e,i=this){for(let s of d(this,l,lt).call(this)){let r=t(this,m)[s],n=d(this,l,E).call(this,r)?r.__staleWhileFetching:r;n!==void 0&&e.call(i,n,t(this,b)[s],this);}}rforEach(e,i=this){for(let s of d(this,l,ht).call(this)){let r=t(this,m)[s],n=d(this,l,E).call(this,r)?r.__staleWhileFetching:r;n!==void 0&&e.call(i,n,t(this,b)[s],this);}}purgeStale(){let e=false;for(let i of d(this,l,ht).call(this,{allowStale:true}))t(this,Y).call(this,i)&&(d(this,l,ct).call(this,t(this,b)[i],"expire"),e=true);return e}info(e){let i=t(this,T).get(e);if(i===void 0)return;let s=t(this,m)[i],r=d(this,l,E).call(this,s)?s.__staleWhileFetching:s;if(r===void 0)return;let n={value:r};if(t(this,V)&&t(this,Z)){let o=t(this,V)[i],c=t(this,Z)[i];if(o&&c){let p=o-(t(this,B).now()-c);n.ttl=p,n.start=Date.now();}}return t(this,Q)&&(n.size=t(this,Q)[i]),n}dump(){let e=[];for(let i of d(this,l,lt).call(this,{allowStale:true})){let s=t(this,b)[i],r=t(this,m)[i],n=d(this,l,E).call(this,r)?r.__staleWhileFetching:r;if(n===void 0||s===void 0)continue;let o={value:n};if(t(this,V)&&t(this,Z)){o.ttl=t(this,V)[i];let c=t(this,B).now()-t(this,Z)[i];o.start=Math.floor(Date.now()-c);}t(this,Q)&&(o.size=t(this,Q)[i]),e.unshift([s,o]);}return e}load(e){this.clear();for(let[i,s]of e){if(s.start){let r=Date.now()-s.start;s.start=t(this,B).now()-r;}this.set(i,s.value,s);}}set(e,i,s={}){var rt,I,k,w;if(i===void 0)return this.delete(e),this;let{ttl:r=this.ttl,start:n,noDisposeOnSet:o=this.noDisposeOnSet,sizeCalculation:c=this.sizeCalculation,status:p}=s,{noUpdateTTL:v=this.noUpdateTTL}=s,U=t(this,Ot).call(this,e,i,s.size||0,c);if(this.maxEntrySize&&U>this.maxEntrySize)return p&&(p.set="miss",p.maxEntrySizeExceeded=true),d(this,l,ct).call(this,e,"set"),this;let S=t(this,O)===0?void 0:t(this,T).get(e);if(S===void 0)S=t(this,O)===0?t(this,R):t(this,J).length!==0?t(this,J).pop():t(this,O)===t(this,K)?d(this,l,Lt).call(this,false):t(this,O),t(this,b)[S]=e,t(this,m)[S]=i,t(this,T).set(e,S),t(this,P)[t(this,R)]=S,t(this,z)[S]=t(this,R),u(this,R,S),Rt(this,O)._++,t(this,bt).call(this,S,U,p),p&&(p.set="add"),v=false,t(this,Et)&&((rt=t(this,ut))==null||rt.call(this,i,e,"add"));else {d(this,l,At).call(this,S);let y=t(this,m)[S];if(i!==y){if(t(this,dt)&&d(this,l,E).call(this,y)){y.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:a}=y;a!==void 0&&!o&&(t(this,tt)&&((I=t(this,q))==null||I.call(this,a,e,"set")),t(this,j)&&t(this,D)?.push([a,e,"set"]));}else o||(t(this,tt)&&((k=t(this,q))==null||k.call(this,y,e,"set")),t(this,j)&&t(this,D)?.push([y,e,"set"]));if(t(this,mt).call(this,S),t(this,bt).call(this,S,U,p),t(this,m)[S]=i,p){p.set="replace";let a=y&&d(this,l,E).call(this,y)?y.__staleWhileFetching:y;a!==void 0&&(p.oldValue=a);}}else p&&(p.set="update");t(this,Et)&&this.onInsert?.(i,e,i===y?"update":"replace");}if(r!==0&&!t(this,V)&&d(this,l,It).call(this),t(this,V)&&(v||t(this,Tt).call(this,S,r,n),p&&t(this,ot).call(this,p,S)),!o&&t(this,j)&&t(this,D)){let y=t(this,D),a;for(;a=y?.shift();)(w=t(this,$))==null||w.call(this,...a);}return this}pop(){var e;try{for(;t(this,O);){let i=t(this,m)[t(this,N)];if(d(this,l,Lt).call(this,!0),d(this,l,E).call(this,i)){if(i.__staleWhileFetching)return i.__staleWhileFetching}else if(i!==void 0)return i}}finally{if(t(this,j)&&t(this,D)){let i=t(this,D),s;for(;s=i?.shift();)(e=t(this,$))==null||e.call(this,...s);}}}has(e,i={}){let{updateAgeOnHas:s=this.updateAgeOnHas,status:r}=i,n=t(this,T).get(e);if(n!==void 0){let o=t(this,m)[n];if(d(this,l,E).call(this,o)&&o.__staleWhileFetching===void 0)return false;if(t(this,Y).call(this,n))r&&(r.has="stale",t(this,ot).call(this,r,n));else return s&&t(this,ft).call(this,n),r&&(r.has="hit",t(this,ot).call(this,r,n)),true}else r&&(r.has="miss");return false}peek(e,i={}){let{allowStale:s=this.allowStale}=i,r=t(this,T).get(e);if(r===void 0||!s&&t(this,Y).call(this,r))return;let n=t(this,m)[r];return d(this,l,E).call(this,n)?n.__staleWhileFetching:n}async fetch(e,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,ttl:o=this.ttl,noDisposeOnSet:c=this.noDisposeOnSet,size:p=0,sizeCalculation:v=this.sizeCalculation,noUpdateTTL:U=this.noUpdateTTL,noDeleteOnFetchRejection:S=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:rt=this.allowStaleOnFetchRejection,ignoreFetchAbort:I=this.ignoreFetchAbort,allowStaleOnFetchAbort:k=this.allowStaleOnFetchAbort,context:w,forceRefresh:y=false,status:a,signal:x}=i;if(!t(this,dt))return a&&(a.fetch="get"),this.get(e,{allowStale:s,updateAgeOnGet:r,noDeleteOnStaleGet:n,status:a});let A={allowStale:s,updateAgeOnGet:r,noDeleteOnStaleGet:n,ttl:o,noDisposeOnSet:c,size:p,sizeCalculation:v,noUpdateTTL:U,noDeleteOnFetchRejection:S,allowStaleOnFetchRejection:rt,allowStaleOnFetchAbort:k,ignoreFetchAbort:I,status:a,signal:x},f=t(this,T).get(e);if(f===void 0){a&&(a.fetch="miss");let g=d(this,l,Ct).call(this,e,f,A,w);return g.__returned=g}else {let g=t(this,m)[f];if(d(this,l,E).call(this,g)){let vt=s&&g.__staleWhileFetching!==void 0;return a&&(a.fetch="inflight",vt&&(a.returnedStale=true)),vt?g.__staleWhileFetching:g.__returned=g}let F=t(this,Y).call(this,f);if(!y&&!F)return a&&(a.fetch="hit"),d(this,l,At).call(this,f),r&&t(this,ft).call(this,f),a&&t(this,ot).call(this,a,f),g;let H=d(this,l,Ct).call(this,e,f,A,w),_t=H.__staleWhileFetching!==void 0&&s;return a&&(a.fetch=F?"stale":"refresh",_t&&F&&(a.returnedStale=true)),_t?H.__staleWhileFetching:H.__returned=H}}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,i={}){let s=t(this,xt);if(!s)throw new Error("no memoMethod provided to constructor");let{context:r,forceRefresh:n,...o}=i,c=this.get(e,o);if(!n&&c!==void 0)return c;let p=s(e,c,{options:o,context:r});return this.set(e,p,o),p}get(e,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,status:o}=i,c=t(this,T).get(e);if(c!==void 0){let p=t(this,m)[c],v=d(this,l,E).call(this,p);return o&&t(this,ot).call(this,o,c),t(this,Y).call(this,c)?(o&&(o.get="stale"),v?(o&&s&&p.__staleWhileFetching!==void 0&&(o.returnedStale=true),s?p.__staleWhileFetching:void 0):(n||d(this,l,ct).call(this,e,"expire"),o&&s&&(o.returnedStale=true),s?p:void 0)):(o&&(o.get="hit"),v?p.__staleWhileFetching:(d(this,l,At).call(this,c),r&&t(this,ft).call(this,c),p))}else o&&(o.get="miss");}delete(e){return d(this,l,ct).call(this,e,"delete")}clear(){return d(this,l,Vt).call(this,"delete")}},K=new WeakMap,M=new WeakMap,q=new WeakMap,ut=new WeakMap,$=new WeakMap,yt=new WeakMap,xt=new WeakMap,B=new WeakMap,O=new WeakMap,X=new WeakMap,T=new WeakMap,b=new WeakMap,m=new WeakMap,P=new WeakMap,z=new WeakMap,N=new WeakMap,R=new WeakMap,J=new WeakMap,D=new WeakMap,Q=new WeakMap,Z=new WeakMap,V=new WeakMap,W=new WeakMap,tt=new WeakMap,dt=new WeakMap,j=new WeakMap,Et=new WeakMap,l=new WeakSet,It=function(){let e=new Dt(t(this,K)),i=new Dt(t(this,K));u(this,V,e),u(this,Z,i);let s=this.ttlAutopurge?new Array(t(this,K)):void 0;u(this,W,s),u(this,Tt,(c,p,v=t(this,B).now())=>{i[c]=p!==0?v:0,e[c]=p,r(c,p);}),u(this,ft,c=>{i[c]=e[c]!==0?t(this,B).now():0,r(c,e[c]);});let r=this.ttlAutopurge?(c,p)=>{if(s?.[c]&&(clearTimeout(s[c]),s[c]=void 0),p&&p!==0&&s){let v=setTimeout(()=>{t(this,Y).call(this,c)&&d(this,l,ct).call(this,t(this,b)[c],"expire");},p+1);v.unref&&v.unref(),s[c]=v;}}:()=>{};u(this,ot,(c,p)=>{if(e[p]){let v=e[p],U=i[p];if(!v||!U)return;c.ttl=v,c.start=U,c.now=n||o();let S=c.now-U;c.remainingTTL=v-S;}});let n=0,o=()=>{let c=t(this,B).now();if(this.ttlResolution>0){n=c;let p=setTimeout(()=>n=0,this.ttlResolution);p.unref&&p.unref();}return c};this.getRemainingTTL=c=>{let p=t(this,T).get(c);if(p===void 0)return 0;let v=e[p],U=i[p];if(!v||!U)return 1/0;let S=(n||o())-U;return v-S},u(this,Y,c=>{let p=i[c],v=e[c];return !!v&&!!p&&(n||o())-p>v});},ft=new WeakMap,ot=new WeakMap,Tt=new WeakMap,Y=new WeakMap,oe=function(){let e=new Dt(t(this,K));u(this,X,0),u(this,Q,e),u(this,mt,i=>{u(this,X,t(this,X)-e[i]),e[i]=0;}),u(this,Ot,(i,s,r,n)=>{if(d(this,l,E).call(this,s))return 0;if(!at(r))if(n){if(typeof n!="function")throw new TypeError("sizeCalculation must be a function");if(r=n(s,i),!at(r))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 r}),u(this,bt,(i,s,r)=>{if(e[i]=s,t(this,M)){let n=t(this,M)-e[i];for(;t(this,X)>n;)d(this,l,Lt).call(this,true);}u(this,X,t(this,X)+e[i]),r&&(r.entrySize=s,r.totalCalculatedSize=t(this,X));});},mt=new WeakMap,bt=new WeakMap,Ot=new WeakMap,lt=function*({allowStale:e=this.allowStale}={}){if(t(this,O))for(let i=t(this,R);!(!d(this,l,Mt).call(this,i)||((e||!t(this,Y).call(this,i))&&(yield i),i===t(this,N)));)i=t(this,z)[i];},ht=function*({allowStale:e=this.allowStale}={}){if(t(this,O))for(let i=t(this,N);!(!d(this,l,Mt).call(this,i)||((e||!t(this,Y).call(this,i))&&(yield i),i===t(this,R)));)i=t(this,P)[i];},Mt=function(e){return e!==void 0&&t(this,T).get(t(this,b)[e])===e},Lt=function(e){var n;let i=t(this,N),s=t(this,b)[i],r=t(this,m)[i];return t(this,dt)&&d(this,l,E).call(this,r)?r.__abortController.abort(new Error("evicted")):(t(this,tt)||t(this,j))&&(t(this,tt)&&((n=t(this,q))==null||n.call(this,r,s,"evict")),t(this,j)&&t(this,D)?.push([r,s,"evict"])),t(this,mt).call(this,i),t(this,W)?.[i]&&(clearTimeout(t(this,W)[i]),t(this,W)[i]=void 0),e&&(t(this,b)[i]=void 0,t(this,m)[i]=void 0,t(this,J).push(i)),t(this,O)===1?(u(this,N,u(this,R,0)),t(this,J).length=0):u(this,N,t(this,P)[i]),t(this,T).delete(s),Rt(this,O)._--,i},Ct=function(e,i,s,r){let n=i===void 0?void 0:t(this,m)[i];if(d(this,l,E).call(this,n))return n;let o=new Nt,{signal:c}=s;c?.addEventListener("abort",()=>o.abort(c.reason),{signal:o.signal});let p={signal:o.signal,options:s,context:r},v=(w,y=false)=>{let{aborted:a}=o.signal,x=s.ignoreFetchAbort&&w!==void 0,A=s.ignoreFetchAbort||!!(s.allowStaleOnFetchAbort&&w!==void 0);if(s.status&&(a&&!y?(s.status.fetchAborted=true,s.status.fetchError=o.signal.reason,x&&(s.status.fetchAbortIgnored=true)):s.status.fetchResolved=true),a&&!x&&!y)return S(o.signal.reason,A);let f=I,g=t(this,m)[i];return (g===I||x&&y&&g===void 0)&&(w===void 0?f.__staleWhileFetching!==void 0?t(this,m)[i]=f.__staleWhileFetching:d(this,l,ct).call(this,e,"fetch"):(s.status&&(s.status.fetchUpdated=true),this.set(e,w,p.options))),w},U=w=>(s.status&&(s.status.fetchRejected=true,s.status.fetchError=w),S(w,false)),S=(w,y)=>{let{aborted:a}=o.signal,x=a&&s.allowStaleOnFetchAbort,A=x||s.allowStaleOnFetchRejection,f=A||s.noDeleteOnFetchRejection,g=I;if(t(this,m)[i]===I&&(!f||!y&&g.__staleWhileFetching===void 0?d(this,l,ct).call(this,e,"fetch"):x||(t(this,m)[i]=g.__staleWhileFetching)),A)return s.status&&g.__staleWhileFetching!==void 0&&(s.status.returnedStale=true),g.__staleWhileFetching;if(g.__returned===g)throw w},rt=(w,y)=>{var x;let a=(x=t(this,yt))==null?void 0:x.call(this,e,n,p);a&&a instanceof Promise&&a.then(A=>w(A===void 0?void 0:A),y),o.signal.addEventListener("abort",()=>{(!s.ignoreFetchAbort||s.allowStaleOnFetchAbort)&&(w(void 0),s.allowStaleOnFetchAbort&&(w=A=>v(A,true)));});};s.status&&(s.status.fetchDispatched=true);let I=new Promise(rt).then(v,U),k=Object.assign(I,{__abortController:o,__staleWhileFetching:n,__returned:void 0});return i===void 0?(this.set(e,k,{...p.options,status:void 0}),i=t(this,T).get(e)):t(this,m)[i]=k,k},E=function(e){if(!t(this,dt))return false;let i=e;return !!i&&i instanceof Promise&&i.hasOwnProperty("__staleWhileFetching")&&i.__abortController instanceof Nt},zt=function(e,i){t(this,z)[i]=e,t(this,P)[e]=i;},At=function(e){e!==t(this,R)&&(e===t(this,N)?u(this,N,t(this,P)[e]):d(this,l,zt).call(this,t(this,z)[e],t(this,P)[e]),d(this,l,zt).call(this,t(this,R),e),u(this,R,e));},ct=function(e,i){var r,n;let s=false;if(t(this,O)!==0){let o=t(this,T).get(e);if(o!==void 0)if(t(this,W)?.[o]&&(clearTimeout(t(this,W)?.[o]),t(this,W)[o]=void 0),s=true,t(this,O)===1)d(this,l,Vt).call(this,i);else {t(this,mt).call(this,o);let c=t(this,m)[o];if(d(this,l,E).call(this,c)?c.__abortController.abort(new Error("deleted")):(t(this,tt)||t(this,j))&&(t(this,tt)&&((r=t(this,q))==null||r.call(this,c,e,i)),t(this,j)&&t(this,D)?.push([c,e,i])),t(this,T).delete(e),t(this,b)[o]=void 0,t(this,m)[o]=void 0,o===t(this,R))u(this,R,t(this,z)[o]);else if(o===t(this,N))u(this,N,t(this,P)[o]);else {let p=t(this,z)[o];t(this,P)[p]=t(this,P)[o];let v=t(this,P)[o];t(this,z)[v]=t(this,z)[o];}Rt(this,O)._--,t(this,J).push(o);}}if(t(this,j)&&t(this,D)?.length){let o=t(this,D),c;for(;c=o?.shift();)(n=t(this,$))==null||n.call(this,...c);}return s},Vt=function(e){var i,s;for(let r of d(this,l,ht).call(this,{allowStale:true})){let n=t(this,m)[r];if(d(this,l,E).call(this,n))n.__abortController.abort(new Error("deleted"));else {let o=t(this,b)[r];t(this,tt)&&((i=t(this,q))==null||i.call(this,n,o,e)),t(this,j)&&t(this,D)?.push([n,o,e]);}}if(t(this,T).clear(),t(this,m).fill(void 0),t(this,b).fill(void 0),t(this,V)&&t(this,Z)){t(this,V).fill(0),t(this,Z).fill(0);for(let r of t(this,W)??[])r!==void 0&&clearTimeout(r);t(this,W)?.fill(void 0);}if(t(this,Q)&&t(this,Q).fill(0),u(this,N,0),u(this,R,0),t(this,J).length=0,u(this,X,0),u(this,O,0),t(this,j)&&t(this,D)){let r=t(this,D),n;for(;n=r?.shift();)(s=t(this,$))==null||s.call(this,...n);}},wt);var Ft=class{cache;map=new Map;constructor(e){this.cache=new re({max:e.cacheSize}),this.map=new Map;}get[Symbol.iterator](){return this.map[Symbol.iterator]}get[Symbol.toStringTag](){return this.map[Symbol.toStringTag]}clear(){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()}};var Ut="1.8.13";var Wt={version:Ut};var Yt="repeat";function Ht(h){return {type:"pause",duration:h}}var Kt="__game_layer__";var ve={CURRENT_DIALOGUE_MEMORY_KEY:"dialogue",LAST_DIALOGUE_ADDED_IN_STEP_MEMORY_KEY:"dialogue:step_counter",CURRENT_MENU_OPTIONS_MEMORY_KEY:"choice:options",LAST_MENU_OPTIONS_ADDED_IN_STEP_MEMORY_KEY:"choice:step_counter",CURRENT_INPUT_VALUE_MEMORY_KEY:"input:value",LAST_INPUT_ADDED_IN_STEP_MEMORY_KEY:"input:step_counter",CURRENT_INPUT_INFO_MEMORY_KEY:"input:info",CHARACTER_CATEGORY_KEY:"character",ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY:"___glue___",OPENED_LABELS_COUNTER_KEY:"label:opened",ALL_CHOICES_MADE_KEY:"choices:made",CURRENT_STEP_TIMES_COUNTER_KEY:"label:history",LAST_STEP_GLUED:"glue:last_step"};var ae={};var kt={};fe(kt,{createExportableElement:()=>le});var gt;(r=>(r.log=(n,...o)=>console.log(`[Pixi\u2019VN] ${n}`,...o),r.warn=(n,...o)=>console.warn(`[Pixi\u2019VN] ${n}`,...o),r.error=(n,...o)=>console.error(`[Pixi\u2019VN] ${n}`,...o),r.info=(n,...o)=>console.info(`[Pixi\u2019VN] ${n}`,...o)))(gt||={});function le(h){try{if(typeof h>"u")return h;let e=JSON.stringify(h);return JSON.parse(e)}catch(e){throw gt.error("Error creating exportable element",h,e),new core.PixiError("not_json_serializable","Error creating exportable element")}}var ye=typeof window<"u"&&typeof document<"u",he=[" _______ _ _ _ ____ ____ ____ _____ ","|_ __ \\ (_) (_) | | |_ _| |_ _||_ \\|_ _|"," | |__) |__ _ __ __ \\_| \\ \\ / / | \\ | | "," | ___/[ | [ \\ [ ][ | \\ \\ / / | |\\ \\| | "," _| |_ | | > ' < | | \\ ' / _| |_\\ |_ ",`|_____| [___][__]\`\\_][___] \\_/ |_____|\\____| v${Wt.version}`],ce=31,xe="background:#2f90da;color:#fff;font-weight:bold;",Ee="background:#c832bb;color:#fff;font-weight:bold;",be="background:transparent;font-weight:bold;",qt=` v${Wt.version}`;function de(){if(!ye)return;let h=[],e=[];for(let i=0;i<he.length;i++){let s=he[i],r=s.endsWith(qt),n=r?s.slice(0,-qt.length):s,o=n.slice(0,ce),c=n.slice(ce),p=r?"%c%s%c%s%c%s":"%c%s%c%s";h.push(p),e.push(xe,o,Ee,c),r&&e.push(be,qt);}console.info(h.join(`
|
|
1
|
+
'use strict';Object.defineProperty(exports,'__esModule',{value:true});var nt=require('@drincs/pixi-vn/canvas'),Bt=require('@drincs/pixi-vn/characters'),core=require('@drincs/pixi-vn/core'),et=require('@drincs/pixi-vn/history'),L=require('@drincs/pixi-vn/narration'),pt=require('@drincs/pixi-vn/sound'),G=require('@drincs/pixi-vn/storage'),motion=require('@drincs/pixi-vn/motion');function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var nt__namespace=/*#__PURE__*/_interopNamespace(nt);var Bt__namespace=/*#__PURE__*/_interopNamespace(Bt);var et__namespace=/*#__PURE__*/_interopNamespace(et);var L__namespace=/*#__PURE__*/_interopNamespace(L);var pt__namespace=/*#__PURE__*/_interopNamespace(pt);var G__namespace=/*#__PURE__*/_interopNamespace(G);var Xt=Object.defineProperty;var Jt=h=>{throw TypeError(h)};var ue=(h,e,i)=>e in h?Xt(h,e,{enumerable:true,configurable:true,writable:true,value:i}):h[e]=i;var fe=(h,e)=>{for(var i in e)Xt(h,i,{get:e[i],enumerable:true});};var C=(h,e,i)=>ue(h,typeof e!="symbol"?e+"":e,i),jt=(h,e,i)=>e.has(h)||Jt("Cannot "+i);var t=(h,e,i)=>(jt(h,e,"read from private field"),i?i.call(h):e.get(h)),_=(h,e,i)=>e.has(h)?Jt("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(h):e.set(h,i),u=(h,e,i,s)=>(jt(h,e,"write to private field"),e.set(h,i),i),d=(h,e,i)=>(jt(h,e,"access private method"),i);var Rt=(h,e,i,s)=>({set _(r){u(h,e,r);},get _(){return t(h,e,s)}});var me=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,ee=new Set,Gt=typeof process=="object"&&process?process:{},ie=(h,e,i,s)=>{typeof Gt.emitWarning=="function"?Gt.emitWarning(h,e,i,s):console.error(`[${i}] ${e}: ${h}`);},Nt=globalThis.AbortController,Qt=globalThis.AbortSignal;if(typeof Nt>"u"){Qt=class{onabort;_onabort=[];reason;aborted=false;addEventListener(i,s){this._onabort.push(s);}},Nt=class{constructor(){e();}signal=new Qt;abort(i){if(!this.signal.aborted){this.signal.reason=i,this.signal.aborted=true;for(let s of this.signal._onabort)s(i);this.signal.onabort?.(i);}}};let h=Gt.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{h&&(h=false,ie("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 ge=h=>!ee.has(h);var at=h=>h&&h===Math.floor(h)&&h>0&&isFinite(h),se=h=>at(h)?h<=Math.pow(2,8)?Uint8Array:h<=Math.pow(2,16)?Uint16Array:h<=Math.pow(2,32)?Uint32Array:h<=Number.MAX_SAFE_INTEGER?Dt:null:null,Dt=class extends Array{constructor(h){super(h),this.fill(0);}},it,St,_e=(it=class{heap;length;static create(e){let i=se(e);if(!i)return [];u(it,St,true);let s=new it(e,i);return u(it,St,false),s}constructor(e,i){if(!t(it,St))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new i(e),this.length=0;}push(e){this.heap[this.length++]=e;}pop(){return this.heap[--this.length]}},St=new WeakMap,_(it,St,false),it),Zt,te,K,M,q,ut,$,yt,xt,B,O,X,T,b,m,P,z,N,R,J,D,Q,Z,V,W,tt,dt,j,Et,l,It,ft,ot,Tt,Y,oe,mt,bt,Ot,lt,ht,Mt,Lt,Ct,E,zt,At,ct,Vt,wt,re=(wt=class{constructor(e){_(this,l);_(this,K);_(this,M);_(this,q);_(this,ut);_(this,$);_(this,yt);_(this,xt);_(this,B);C(this,"ttl");C(this,"ttlResolution");C(this,"ttlAutopurge");C(this,"updateAgeOnGet");C(this,"updateAgeOnHas");C(this,"allowStale");C(this,"noDisposeOnSet");C(this,"noUpdateTTL");C(this,"maxEntrySize");C(this,"sizeCalculation");C(this,"noDeleteOnFetchRejection");C(this,"noDeleteOnStaleGet");C(this,"allowStaleOnFetchAbort");C(this,"allowStaleOnFetchRejection");C(this,"ignoreFetchAbort");_(this,O);_(this,X);_(this,T);_(this,b);_(this,m);_(this,P);_(this,z);_(this,N);_(this,R);_(this,J);_(this,D);_(this,Q);_(this,Z);_(this,V);_(this,W);_(this,tt);_(this,dt);_(this,j);_(this,Et);_(this,ft,()=>{});_(this,ot,()=>{});_(this,Tt,()=>{});_(this,Y,()=>false);_(this,mt,e=>{});_(this,bt,(e,i,s)=>{});_(this,Ot,(e,i,s,r)=>{if(s||r)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});C(this,Zt,"LRUCache");let{max:i=0,ttl:s,ttlResolution:r=1,ttlAutopurge:n,updateAgeOnGet:o,updateAgeOnHas:c,allowStale:p,dispose:v,onInsert:U,disposeAfter:S,noDisposeOnSet:rt,noUpdateTTL:I,maxSize:k=0,maxEntrySize:w=0,sizeCalculation:y,fetchMethod:a,memoMethod:x,noDeleteOnFetchRejection:A,noDeleteOnStaleGet:f,allowStaleOnFetchRejection:g,allowStaleOnFetchAbort:F,ignoreFetchAbort:H,perf:_t}=e;if(_t!==void 0&&typeof _t?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(u(this,B,_t??me),i!==0&&!at(i))throw new TypeError("max option must be a nonnegative integer");let vt=i?se(i):Array;if(!vt)throw new Error("invalid max value: "+i);if(u(this,K,i),u(this,M,k),this.maxEntrySize=w||t(this,M),this.sizeCalculation=y,this.sizeCalculation){if(!t(this,M)&&!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(u(this,xt,x),a!==void 0&&typeof a!="function")throw new TypeError("fetchMethod must be a function if specified");if(u(this,yt,a),u(this,dt,!!a),u(this,T,new Map),u(this,b,new Array(i).fill(void 0)),u(this,m,new Array(i).fill(void 0)),u(this,P,new vt(i)),u(this,z,new vt(i)),u(this,N,0),u(this,R,0),u(this,J,_e.create(i)),u(this,O,0),u(this,X,0),typeof v=="function"&&u(this,q,v),typeof U=="function"&&u(this,ut,U),typeof S=="function"?(u(this,$,S),u(this,D,[])):(u(this,$,void 0),u(this,D,void 0)),u(this,tt,!!t(this,q)),u(this,Et,!!t(this,ut)),u(this,j,!!t(this,$)),this.noDisposeOnSet=!!rt,this.noUpdateTTL=!!I,this.noDeleteOnFetchRejection=!!A,this.allowStaleOnFetchRejection=!!g,this.allowStaleOnFetchAbort=!!F,this.ignoreFetchAbort=!!H,this.maxEntrySize!==0){if(t(this,M)!==0&&!at(t(this,M)))throw new TypeError("maxSize must be a positive integer if specified");if(!at(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");d(this,l,oe).call(this);}if(this.allowStale=!!p,this.noDeleteOnStaleGet=!!f,this.updateAgeOnGet=!!o,this.updateAgeOnHas=!!c,this.ttlResolution=at(r)||r===0?r:1,this.ttlAutopurge=!!n,this.ttl=s||0,this.ttl){if(!at(this.ttl))throw new TypeError("ttl must be a positive integer if specified");d(this,l,It).call(this);}if(t(this,K)===0&&this.ttl===0&&t(this,M)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!t(this,K)&&!t(this,M)){let Pt="LRU_CACHE_UNBOUNDED";ge(Pt)&&(ee.add(Pt),ie("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",Pt,wt));}}get perf(){return t(this,B)}static unsafeExposeInternals(e){return {starts:t(e,Z),ttls:t(e,V),autopurgeTimers:t(e,W),sizes:t(e,Q),keyMap:t(e,T),keyList:t(e,b),valList:t(e,m),next:t(e,P),prev:t(e,z),get head(){return t(e,N)},get tail(){return t(e,R)},free:t(e,J),isBackgroundFetch:i=>{var s;return d(s=e,l,E).call(s,i)},backgroundFetch:(i,s,r,n)=>{var o;return d(o=e,l,Ct).call(o,i,s,r,n)},moveToTail:i=>{var s;return d(s=e,l,At).call(s,i)},indexes:i=>{var s;return d(s=e,l,lt).call(s,i)},rindexes:i=>{var s;return d(s=e,l,ht).call(s,i)},isStale:i=>{var s;return t(s=e,Y).call(s,i)}}}get max(){return t(this,K)}get maxSize(){return t(this,M)}get calculatedSize(){return t(this,X)}get size(){return t(this,O)}get fetchMethod(){return t(this,yt)}get memoMethod(){return t(this,xt)}get dispose(){return t(this,q)}get onInsert(){return t(this,ut)}get disposeAfter(){return t(this,$)}getRemainingTTL(e){return t(this,T).has(e)?1/0:0}*entries(){for(let e of d(this,l,lt).call(this))t(this,m)[e]!==void 0&&t(this,b)[e]!==void 0&&!d(this,l,E).call(this,t(this,m)[e])&&(yield [t(this,b)[e],t(this,m)[e]]);}*rentries(){for(let e of d(this,l,ht).call(this))t(this,m)[e]!==void 0&&t(this,b)[e]!==void 0&&!d(this,l,E).call(this,t(this,m)[e])&&(yield [t(this,b)[e],t(this,m)[e]]);}*keys(){for(let e of d(this,l,lt).call(this)){let i=t(this,b)[e];i!==void 0&&!d(this,l,E).call(this,t(this,m)[e])&&(yield i);}}*rkeys(){for(let e of d(this,l,ht).call(this)){let i=t(this,b)[e];i!==void 0&&!d(this,l,E).call(this,t(this,m)[e])&&(yield i);}}*values(){for(let e of d(this,l,lt).call(this))t(this,m)[e]!==void 0&&!d(this,l,E).call(this,t(this,m)[e])&&(yield t(this,m)[e]);}*rvalues(){for(let e of d(this,l,ht).call(this))t(this,m)[e]!==void 0&&!d(this,l,E).call(this,t(this,m)[e])&&(yield t(this,m)[e]);}[(te=Symbol.iterator,Zt=Symbol.toStringTag,te)](){return this.entries()}find(e,i={}){for(let s of d(this,l,lt).call(this)){let r=t(this,m)[s],n=d(this,l,E).call(this,r)?r.__staleWhileFetching:r;if(n!==void 0&&e(n,t(this,b)[s],this))return this.get(t(this,b)[s],i)}}forEach(e,i=this){for(let s of d(this,l,lt).call(this)){let r=t(this,m)[s],n=d(this,l,E).call(this,r)?r.__staleWhileFetching:r;n!==void 0&&e.call(i,n,t(this,b)[s],this);}}rforEach(e,i=this){for(let s of d(this,l,ht).call(this)){let r=t(this,m)[s],n=d(this,l,E).call(this,r)?r.__staleWhileFetching:r;n!==void 0&&e.call(i,n,t(this,b)[s],this);}}purgeStale(){let e=false;for(let i of d(this,l,ht).call(this,{allowStale:true}))t(this,Y).call(this,i)&&(d(this,l,ct).call(this,t(this,b)[i],"expire"),e=true);return e}info(e){let i=t(this,T).get(e);if(i===void 0)return;let s=t(this,m)[i],r=d(this,l,E).call(this,s)?s.__staleWhileFetching:s;if(r===void 0)return;let n={value:r};if(t(this,V)&&t(this,Z)){let o=t(this,V)[i],c=t(this,Z)[i];if(o&&c){let p=o-(t(this,B).now()-c);n.ttl=p,n.start=Date.now();}}return t(this,Q)&&(n.size=t(this,Q)[i]),n}dump(){let e=[];for(let i of d(this,l,lt).call(this,{allowStale:true})){let s=t(this,b)[i],r=t(this,m)[i],n=d(this,l,E).call(this,r)?r.__staleWhileFetching:r;if(n===void 0||s===void 0)continue;let o={value:n};if(t(this,V)&&t(this,Z)){o.ttl=t(this,V)[i];let c=t(this,B).now()-t(this,Z)[i];o.start=Math.floor(Date.now()-c);}t(this,Q)&&(o.size=t(this,Q)[i]),e.unshift([s,o]);}return e}load(e){this.clear();for(let[i,s]of e){if(s.start){let r=Date.now()-s.start;s.start=t(this,B).now()-r;}this.set(i,s.value,s);}}set(e,i,s={}){var rt,I,k,w;if(i===void 0)return this.delete(e),this;let{ttl:r=this.ttl,start:n,noDisposeOnSet:o=this.noDisposeOnSet,sizeCalculation:c=this.sizeCalculation,status:p}=s,{noUpdateTTL:v=this.noUpdateTTL}=s,U=t(this,Ot).call(this,e,i,s.size||0,c);if(this.maxEntrySize&&U>this.maxEntrySize)return p&&(p.set="miss",p.maxEntrySizeExceeded=true),d(this,l,ct).call(this,e,"set"),this;let S=t(this,O)===0?void 0:t(this,T).get(e);if(S===void 0)S=t(this,O)===0?t(this,R):t(this,J).length!==0?t(this,J).pop():t(this,O)===t(this,K)?d(this,l,Lt).call(this,false):t(this,O),t(this,b)[S]=e,t(this,m)[S]=i,t(this,T).set(e,S),t(this,P)[t(this,R)]=S,t(this,z)[S]=t(this,R),u(this,R,S),Rt(this,O)._++,t(this,bt).call(this,S,U,p),p&&(p.set="add"),v=false,t(this,Et)&&((rt=t(this,ut))==null||rt.call(this,i,e,"add"));else {d(this,l,At).call(this,S);let y=t(this,m)[S];if(i!==y){if(t(this,dt)&&d(this,l,E).call(this,y)){y.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:a}=y;a!==void 0&&!o&&(t(this,tt)&&((I=t(this,q))==null||I.call(this,a,e,"set")),t(this,j)&&t(this,D)?.push([a,e,"set"]));}else o||(t(this,tt)&&((k=t(this,q))==null||k.call(this,y,e,"set")),t(this,j)&&t(this,D)?.push([y,e,"set"]));if(t(this,mt).call(this,S),t(this,bt).call(this,S,U,p),t(this,m)[S]=i,p){p.set="replace";let a=y&&d(this,l,E).call(this,y)?y.__staleWhileFetching:y;a!==void 0&&(p.oldValue=a);}}else p&&(p.set="update");t(this,Et)&&this.onInsert?.(i,e,i===y?"update":"replace");}if(r!==0&&!t(this,V)&&d(this,l,It).call(this),t(this,V)&&(v||t(this,Tt).call(this,S,r,n),p&&t(this,ot).call(this,p,S)),!o&&t(this,j)&&t(this,D)){let y=t(this,D),a;for(;a=y?.shift();)(w=t(this,$))==null||w.call(this,...a);}return this}pop(){var e;try{for(;t(this,O);){let i=t(this,m)[t(this,N)];if(d(this,l,Lt).call(this,!0),d(this,l,E).call(this,i)){if(i.__staleWhileFetching)return i.__staleWhileFetching}else if(i!==void 0)return i}}finally{if(t(this,j)&&t(this,D)){let i=t(this,D),s;for(;s=i?.shift();)(e=t(this,$))==null||e.call(this,...s);}}}has(e,i={}){let{updateAgeOnHas:s=this.updateAgeOnHas,status:r}=i,n=t(this,T).get(e);if(n!==void 0){let o=t(this,m)[n];if(d(this,l,E).call(this,o)&&o.__staleWhileFetching===void 0)return false;if(t(this,Y).call(this,n))r&&(r.has="stale",t(this,ot).call(this,r,n));else return s&&t(this,ft).call(this,n),r&&(r.has="hit",t(this,ot).call(this,r,n)),true}else r&&(r.has="miss");return false}peek(e,i={}){let{allowStale:s=this.allowStale}=i,r=t(this,T).get(e);if(r===void 0||!s&&t(this,Y).call(this,r))return;let n=t(this,m)[r];return d(this,l,E).call(this,n)?n.__staleWhileFetching:n}async fetch(e,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,ttl:o=this.ttl,noDisposeOnSet:c=this.noDisposeOnSet,size:p=0,sizeCalculation:v=this.sizeCalculation,noUpdateTTL:U=this.noUpdateTTL,noDeleteOnFetchRejection:S=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:rt=this.allowStaleOnFetchRejection,ignoreFetchAbort:I=this.ignoreFetchAbort,allowStaleOnFetchAbort:k=this.allowStaleOnFetchAbort,context:w,forceRefresh:y=false,status:a,signal:x}=i;if(!t(this,dt))return a&&(a.fetch="get"),this.get(e,{allowStale:s,updateAgeOnGet:r,noDeleteOnStaleGet:n,status:a});let A={allowStale:s,updateAgeOnGet:r,noDeleteOnStaleGet:n,ttl:o,noDisposeOnSet:c,size:p,sizeCalculation:v,noUpdateTTL:U,noDeleteOnFetchRejection:S,allowStaleOnFetchRejection:rt,allowStaleOnFetchAbort:k,ignoreFetchAbort:I,status:a,signal:x},f=t(this,T).get(e);if(f===void 0){a&&(a.fetch="miss");let g=d(this,l,Ct).call(this,e,f,A,w);return g.__returned=g}else {let g=t(this,m)[f];if(d(this,l,E).call(this,g)){let vt=s&&g.__staleWhileFetching!==void 0;return a&&(a.fetch="inflight",vt&&(a.returnedStale=true)),vt?g.__staleWhileFetching:g.__returned=g}let F=t(this,Y).call(this,f);if(!y&&!F)return a&&(a.fetch="hit"),d(this,l,At).call(this,f),r&&t(this,ft).call(this,f),a&&t(this,ot).call(this,a,f),g;let H=d(this,l,Ct).call(this,e,f,A,w),_t=H.__staleWhileFetching!==void 0&&s;return a&&(a.fetch=F?"stale":"refresh",_t&&F&&(a.returnedStale=true)),_t?H.__staleWhileFetching:H.__returned=H}}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,i={}){let s=t(this,xt);if(!s)throw new Error("no memoMethod provided to constructor");let{context:r,forceRefresh:n,...o}=i,c=this.get(e,o);if(!n&&c!==void 0)return c;let p=s(e,c,{options:o,context:r});return this.set(e,p,o),p}get(e,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,status:o}=i,c=t(this,T).get(e);if(c!==void 0){let p=t(this,m)[c],v=d(this,l,E).call(this,p);return o&&t(this,ot).call(this,o,c),t(this,Y).call(this,c)?(o&&(o.get="stale"),v?(o&&s&&p.__staleWhileFetching!==void 0&&(o.returnedStale=true),s?p.__staleWhileFetching:void 0):(n||d(this,l,ct).call(this,e,"expire"),o&&s&&(o.returnedStale=true),s?p:void 0)):(o&&(o.get="hit"),v?p.__staleWhileFetching:(d(this,l,At).call(this,c),r&&t(this,ft).call(this,c),p))}else o&&(o.get="miss");}delete(e){return d(this,l,ct).call(this,e,"delete")}clear(){return d(this,l,Vt).call(this,"delete")}},K=new WeakMap,M=new WeakMap,q=new WeakMap,ut=new WeakMap,$=new WeakMap,yt=new WeakMap,xt=new WeakMap,B=new WeakMap,O=new WeakMap,X=new WeakMap,T=new WeakMap,b=new WeakMap,m=new WeakMap,P=new WeakMap,z=new WeakMap,N=new WeakMap,R=new WeakMap,J=new WeakMap,D=new WeakMap,Q=new WeakMap,Z=new WeakMap,V=new WeakMap,W=new WeakMap,tt=new WeakMap,dt=new WeakMap,j=new WeakMap,Et=new WeakMap,l=new WeakSet,It=function(){let e=new Dt(t(this,K)),i=new Dt(t(this,K));u(this,V,e),u(this,Z,i);let s=this.ttlAutopurge?new Array(t(this,K)):void 0;u(this,W,s),u(this,Tt,(c,p,v=t(this,B).now())=>{i[c]=p!==0?v:0,e[c]=p,r(c,p);}),u(this,ft,c=>{i[c]=e[c]!==0?t(this,B).now():0,r(c,e[c]);});let r=this.ttlAutopurge?(c,p)=>{if(s?.[c]&&(clearTimeout(s[c]),s[c]=void 0),p&&p!==0&&s){let v=setTimeout(()=>{t(this,Y).call(this,c)&&d(this,l,ct).call(this,t(this,b)[c],"expire");},p+1);v.unref&&v.unref(),s[c]=v;}}:()=>{};u(this,ot,(c,p)=>{if(e[p]){let v=e[p],U=i[p];if(!v||!U)return;c.ttl=v,c.start=U,c.now=n||o();let S=c.now-U;c.remainingTTL=v-S;}});let n=0,o=()=>{let c=t(this,B).now();if(this.ttlResolution>0){n=c;let p=setTimeout(()=>n=0,this.ttlResolution);p.unref&&p.unref();}return c};this.getRemainingTTL=c=>{let p=t(this,T).get(c);if(p===void 0)return 0;let v=e[p],U=i[p];if(!v||!U)return 1/0;let S=(n||o())-U;return v-S},u(this,Y,c=>{let p=i[c],v=e[c];return !!v&&!!p&&(n||o())-p>v});},ft=new WeakMap,ot=new WeakMap,Tt=new WeakMap,Y=new WeakMap,oe=function(){let e=new Dt(t(this,K));u(this,X,0),u(this,Q,e),u(this,mt,i=>{u(this,X,t(this,X)-e[i]),e[i]=0;}),u(this,Ot,(i,s,r,n)=>{if(d(this,l,E).call(this,s))return 0;if(!at(r))if(n){if(typeof n!="function")throw new TypeError("sizeCalculation must be a function");if(r=n(s,i),!at(r))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 r}),u(this,bt,(i,s,r)=>{if(e[i]=s,t(this,M)){let n=t(this,M)-e[i];for(;t(this,X)>n;)d(this,l,Lt).call(this,true);}u(this,X,t(this,X)+e[i]),r&&(r.entrySize=s,r.totalCalculatedSize=t(this,X));});},mt=new WeakMap,bt=new WeakMap,Ot=new WeakMap,lt=function*({allowStale:e=this.allowStale}={}){if(t(this,O))for(let i=t(this,R);!(!d(this,l,Mt).call(this,i)||((e||!t(this,Y).call(this,i))&&(yield i),i===t(this,N)));)i=t(this,z)[i];},ht=function*({allowStale:e=this.allowStale}={}){if(t(this,O))for(let i=t(this,N);!(!d(this,l,Mt).call(this,i)||((e||!t(this,Y).call(this,i))&&(yield i),i===t(this,R)));)i=t(this,P)[i];},Mt=function(e){return e!==void 0&&t(this,T).get(t(this,b)[e])===e},Lt=function(e){var n;let i=t(this,N),s=t(this,b)[i],r=t(this,m)[i];return t(this,dt)&&d(this,l,E).call(this,r)?r.__abortController.abort(new Error("evicted")):(t(this,tt)||t(this,j))&&(t(this,tt)&&((n=t(this,q))==null||n.call(this,r,s,"evict")),t(this,j)&&t(this,D)?.push([r,s,"evict"])),t(this,mt).call(this,i),t(this,W)?.[i]&&(clearTimeout(t(this,W)[i]),t(this,W)[i]=void 0),e&&(t(this,b)[i]=void 0,t(this,m)[i]=void 0,t(this,J).push(i)),t(this,O)===1?(u(this,N,u(this,R,0)),t(this,J).length=0):u(this,N,t(this,P)[i]),t(this,T).delete(s),Rt(this,O)._--,i},Ct=function(e,i,s,r){let n=i===void 0?void 0:t(this,m)[i];if(d(this,l,E).call(this,n))return n;let o=new Nt,{signal:c}=s;c?.addEventListener("abort",()=>o.abort(c.reason),{signal:o.signal});let p={signal:o.signal,options:s,context:r},v=(w,y=false)=>{let{aborted:a}=o.signal,x=s.ignoreFetchAbort&&w!==void 0,A=s.ignoreFetchAbort||!!(s.allowStaleOnFetchAbort&&w!==void 0);if(s.status&&(a&&!y?(s.status.fetchAborted=true,s.status.fetchError=o.signal.reason,x&&(s.status.fetchAbortIgnored=true)):s.status.fetchResolved=true),a&&!x&&!y)return S(o.signal.reason,A);let f=I,g=t(this,m)[i];return (g===I||x&&y&&g===void 0)&&(w===void 0?f.__staleWhileFetching!==void 0?t(this,m)[i]=f.__staleWhileFetching:d(this,l,ct).call(this,e,"fetch"):(s.status&&(s.status.fetchUpdated=true),this.set(e,w,p.options))),w},U=w=>(s.status&&(s.status.fetchRejected=true,s.status.fetchError=w),S(w,false)),S=(w,y)=>{let{aborted:a}=o.signal,x=a&&s.allowStaleOnFetchAbort,A=x||s.allowStaleOnFetchRejection,f=A||s.noDeleteOnFetchRejection,g=I;if(t(this,m)[i]===I&&(!f||!y&&g.__staleWhileFetching===void 0?d(this,l,ct).call(this,e,"fetch"):x||(t(this,m)[i]=g.__staleWhileFetching)),A)return s.status&&g.__staleWhileFetching!==void 0&&(s.status.returnedStale=true),g.__staleWhileFetching;if(g.__returned===g)throw w},rt=(w,y)=>{var x;let a=(x=t(this,yt))==null?void 0:x.call(this,e,n,p);a&&a instanceof Promise&&a.then(A=>w(A===void 0?void 0:A),y),o.signal.addEventListener("abort",()=>{(!s.ignoreFetchAbort||s.allowStaleOnFetchAbort)&&(w(void 0),s.allowStaleOnFetchAbort&&(w=A=>v(A,true)));});};s.status&&(s.status.fetchDispatched=true);let I=new Promise(rt).then(v,U),k=Object.assign(I,{__abortController:o,__staleWhileFetching:n,__returned:void 0});return i===void 0?(this.set(e,k,{...p.options,status:void 0}),i=t(this,T).get(e)):t(this,m)[i]=k,k},E=function(e){if(!t(this,dt))return false;let i=e;return !!i&&i instanceof Promise&&i.hasOwnProperty("__staleWhileFetching")&&i.__abortController instanceof Nt},zt=function(e,i){t(this,z)[i]=e,t(this,P)[e]=i;},At=function(e){e!==t(this,R)&&(e===t(this,N)?u(this,N,t(this,P)[e]):d(this,l,zt).call(this,t(this,z)[e],t(this,P)[e]),d(this,l,zt).call(this,t(this,R),e),u(this,R,e));},ct=function(e,i){var r,n;let s=false;if(t(this,O)!==0){let o=t(this,T).get(e);if(o!==void 0)if(t(this,W)?.[o]&&(clearTimeout(t(this,W)?.[o]),t(this,W)[o]=void 0),s=true,t(this,O)===1)d(this,l,Vt).call(this,i);else {t(this,mt).call(this,o);let c=t(this,m)[o];if(d(this,l,E).call(this,c)?c.__abortController.abort(new Error("deleted")):(t(this,tt)||t(this,j))&&(t(this,tt)&&((r=t(this,q))==null||r.call(this,c,e,i)),t(this,j)&&t(this,D)?.push([c,e,i])),t(this,T).delete(e),t(this,b)[o]=void 0,t(this,m)[o]=void 0,o===t(this,R))u(this,R,t(this,z)[o]);else if(o===t(this,N))u(this,N,t(this,P)[o]);else {let p=t(this,z)[o];t(this,P)[p]=t(this,P)[o];let v=t(this,P)[o];t(this,z)[v]=t(this,z)[o];}Rt(this,O)._--,t(this,J).push(o);}}if(t(this,j)&&t(this,D)?.length){let o=t(this,D),c;for(;c=o?.shift();)(n=t(this,$))==null||n.call(this,...c);}return s},Vt=function(e){var i,s;for(let r of d(this,l,ht).call(this,{allowStale:true})){let n=t(this,m)[r];if(d(this,l,E).call(this,n))n.__abortController.abort(new Error("deleted"));else {let o=t(this,b)[r];t(this,tt)&&((i=t(this,q))==null||i.call(this,n,o,e)),t(this,j)&&t(this,D)?.push([n,o,e]);}}if(t(this,T).clear(),t(this,m).fill(void 0),t(this,b).fill(void 0),t(this,V)&&t(this,Z)){t(this,V).fill(0),t(this,Z).fill(0);for(let r of t(this,W)??[])r!==void 0&&clearTimeout(r);t(this,W)?.fill(void 0);}if(t(this,Q)&&t(this,Q).fill(0),u(this,N,0),u(this,R,0),t(this,J).length=0,u(this,X,0),u(this,O,0),t(this,j)&&t(this,D)){let r=t(this,D),n;for(;n=r?.shift();)(s=t(this,$))==null||s.call(this,...n);}},wt);var Ft=class{cache;map=new Map;constructor(e){this.cache=new re({max:e.cacheSize}),this.map=new Map;}get[Symbol.iterator](){return this.map[Symbol.iterator]}get[Symbol.toStringTag](){return this.map[Symbol.toStringTag]}clear(){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()}};var Ut="1.8.15";var Wt={version:Ut};var Yt="repeat";function Ht(h){return {type:"pause",duration:h}}var Kt="__game_layer__";var ve={CURRENT_DIALOGUE_MEMORY_KEY:"dialogue",LAST_DIALOGUE_ADDED_IN_STEP_MEMORY_KEY:"dialogue:step_counter",CURRENT_MENU_OPTIONS_MEMORY_KEY:"choice:options",LAST_MENU_OPTIONS_ADDED_IN_STEP_MEMORY_KEY:"choice:step_counter",CURRENT_INPUT_VALUE_MEMORY_KEY:"input:value",LAST_INPUT_ADDED_IN_STEP_MEMORY_KEY:"input:step_counter",CURRENT_INPUT_INFO_MEMORY_KEY:"input:info",CHARACTER_CATEGORY_KEY:"character",ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY:"___glue___",OPENED_LABELS_COUNTER_KEY:"label:opened",ALL_CHOICES_MADE_KEY:"choices:made",CURRENT_STEP_TIMES_COUNTER_KEY:"label:history",LAST_STEP_GLUED:"glue:last_step"};var ae={};var kt={};fe(kt,{createExportableElement:()=>le});var gt;(r=>(r.log=(n,...o)=>console.log(`[Pixi\u2019VN] ${n}`,...o),r.warn=(n,...o)=>console.warn(`[Pixi\u2019VN] ${n}`,...o),r.error=(n,...o)=>console.error(`[Pixi\u2019VN] ${n}`,...o),r.info=(n,...o)=>console.info(`[Pixi\u2019VN] ${n}`,...o)))(gt||={});function le(h){try{if(typeof h>"u")return h;let e=JSON.stringify(h);return JSON.parse(e)}catch(e){throw gt.error("Error creating exportable element",h,e),new core.PixiError("not_json_serializable","Error creating exportable element")}}var ye=typeof window<"u"&&typeof document<"u",he=[" _______ _ _ _ ____ ____ ____ _____ ","|_ __ \\ (_) (_) | | |_ _| |_ _||_ \\|_ _|"," | |__) |__ _ __ __ \\_| \\ \\ / / | \\ | | "," | ___/[ | [ \\ [ ][ | \\ \\ / / | |\\ \\| | "," _| |_ | | > ' < | | \\ ' / _| |_\\ |_ ",`|_____| [___][__]\`\\_][___] \\_/ |_____|\\____| v${Wt.version}`],ce=31,xe="background:#2f90da;color:#fff;font-weight:bold;",Ee="background:#c832bb;color:#fff;font-weight:bold;",be="background:transparent;font-weight:bold;",qt=` v${Wt.version}`;function de(){if(!ye)return;let h=[],e=[];for(let i=0;i<he.length;i++){let s=he[i],r=s.endsWith(qt),n=r?s.slice(0,-qt.length):s,o=n.slice(0,ce),c=n.slice(ce),p=r?"%c%s%c%s%c%s":"%c%s%c%s";h.push(p),e.push(xe,o,Ee,c),r&&e.push(be,qt);}console.info(h.join(`
|
|
2
2
|
`),...e);}function $t(){let h=window.location.pathname+window.location.hash;return h.includes("#")&&(h=h.split("#")[1]),h}de();exports.Game=void 0;(y=>{async function h(a,x,A){if(core.GameUnifier.init({navigate:x?.navigate,getCurrentGameStepState:()=>{let f={};try{f=nt__namespace.canvas.export();}catch{}return {path:$t(),storage:G__namespace.storage.export(),canvas:f,sound:pt__namespace.sound.export(),labelIndex:L__namespace.NarrationManagerStatic.currentLabelStepIndex||0,openedLabels:L__namespace.narration.openedLabels}},restoreGameStepState:async(f,g)=>{et__namespace.HistoryManagerStatic._originalStepData=f,L__namespace.NarrationManagerStatic.openedLabels=f.openedLabels,G__namespace.storage.restore(f.storage);try{await nt__namespace.canvas.restore(f.canvas),await pt__namespace.sound.restore(f.sound);}catch(F){gt.error("Error restoring game step state:",F);}await g(f.path);},getStepCounter:()=>L__namespace.narration.stepCounter,setStepCounter:f=>{L__namespace.NarrationManagerStatic._stepCounter=f;},getOpenedLabels:()=>L__namespace.narration.openedLabels.length,addHistoryItem:(f,g)=>et__namespace.stepHistory.add(f,g),getCharacter:f=>Bt__namespace.RegisteredCharacters.get(f),processNavigationRequests:(f,g)=>{let F=f,H=Promise.resolve();return f>0?(F--,H=L__namespace.narration.continue(g)):f<0&&(F=0,H=et__namespace.stepHistory.back(g,{steps:f*-1})),{newValue:F,result:H}},animate:(f,g,F,H)=>motion.motion.animate(f,g,F,H),getVariable:(f,g)=>G__namespace.StorageRegistry.getVariable(f,g),setVariable:(f,g,F)=>G__namespace.StorageRegistry.setVariable(f,g,F),removeVariable:(f,g)=>G__namespace.StorageRegistry.removeVariable(f,g),getFlag:f=>G__namespace.storage.getFlag(f),setFlag:(f,g)=>G__namespace.storage.setFlag(f,g),onLabelClosing:f=>G__namespace.StorageRegistry.clearOldTempVariables(f)}),!a||!x){gt.warn("The canvas element or options are not defined. The canvas will not be initialized.");return}return await nt__namespace.canvas.init(a,x,A)}y.init=h;function e(){G__namespace.storage.clear();try{nt__namespace.canvas.clear();}catch{}pt__namespace.sound.clear(),L__namespace.narration.clear(),et__namespace.stepHistory.clear();}y.clear=e;function i(){let a={};try{a=nt__namespace.canvas.export();}catch{}return {pixivn_version:Ut,stepData:L__namespace.narration.export(),storageData:G__namespace.storage.export(),canvasData:a,soundData:pt__namespace.sound.export(),historyData:et__namespace.stepHistory.export(),path:$t()}}y.exportGameState=i;async function s(a,x){et__namespace.stepHistory.restore(a.historyData);let A=et__namespace.stepHistory.lastKey;if(typeof A=="number"){let f=et__namespace.stepHistory.stepsInfoMap.get(A)||null;await L__namespace.narration.restore(a.stepData,f);}G__namespace.storage.restore(a.storageData);try{await nt__namespace.canvas.restore(a.canvasData),await pt__namespace.sound.restore(a.soundData);}catch{}x?await x(a.path):await core.GameUnifier.navigate(a.path);}y.restoreGameState=s;async function r(a,x){return y.clear(),await L__namespace.narration.call(a,x)}y.start=r;function n(a){return JSON.parse(a)}y.jsonToGameState=n;function o(a){core.GameUnifier.onEnd=a;}y.onEnd=o;function c(a){return gt.warn("Game.onError is deprecated. Use Game.addOnError / Game.removeOnError to register multiple handlers."),core.GameUnifier.addOnError((x,A)=>a("step",x,A))}y.onError=c;function p(a){return core.GameUnifier.addOnError(a)}y.addOnError=p;function v(a){return core.GameUnifier.removeOnError(a)}y.removeOnError=v;function U(a){L__namespace.NarrationManagerStatic.onStepStart=a;}y.onStepStart=U;function S(a){L__namespace.NarrationManagerStatic.onLoadingLabel=a;}y.onLoadingLabel=S;function rt(a){L__namespace.NarrationManagerStatic.onStepEnd=a;}y.onStepEnd=rt;function I(a){core.GameUnifier.navigate=a;}y.onNavigate=I;function k(a){return core.GameUnifier.addOnPreContinue(a)}y.addOnPreContinue=k;function w(a){return core.GameUnifier.removeOnPreContinue(a)}y.removeOnPreContinue=w;})(exports.Game||={});var Ze={characterUtils:Bt__namespace,canvasUtils:nt__namespace,narrationUtils:L__namespace,soundUtils:pt__namespace,CANVAS_APP_GAME_LAYER_ALIAS:Kt,Pause:Ht,Repeat:Yt,PIXIVN_VERSION:Ut,...kt,...ae,canvas:nt__namespace.canvas,narration:L__namespace.narration,sound:pt__namespace.sound,storage:G__namespace.storage,history:et__namespace.stepHistory,Game:exports.Game,GameUnifier:core.GameUnifier};exports.CANVAS_APP_GAME_LAYER_ALIAS=Kt;exports.CachedMap=Ft;exports.PIXIVN_VERSION=Ut;exports.Pause=Ht;exports.Repeat=Yt;exports.SYSTEM_RESERVED_STORAGE_KEYS=ve;exports.createExportableElement=le;exports.default=Ze;Object.keys(nt).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return nt[k]}})});Object.keys(Bt).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return Bt[k]}})});Object.keys(core).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return core[k]}})});Object.keys(et).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return et[k]}})});Object.keys(L).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return L[k]}})});Object.keys(pt).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return pt[k]}})});Object.keys(G).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return G[k]}})});
|
package/dist/index.d.cts
CHANGED