@drincs/pixi-vn
Version:
Pixi'VN is a npm package that provides various features for creating visual novels.
1 lines • 23.8 kB
JavaScript
import {PixiError}from'@drincs/pixi-vn/core';var Kt=Object.create;var Tt=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?Tt(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&&Tt(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?Tt(i,"default",{value:l,enumerable:true}):i,l));var S=(l,e,i)=>Xt(l,typeof e!="symbol"?e+"":e,i),zt=(l,e,i)=>e.has(l)||Gt("Cannot "+i);var t=(l,e,i)=>(zt(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)=>(zt(l,e,"write to private field"),e.set(l,i),i),a=(l,e,i)=>(zt(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,Rt=typeof process=="object"&&process?process:{},Vt=(l,e,i,s)=>{typeof Rt.emitWarning=="function"?Rt.emitWarning(l,e,i,s):console.error(`[${i}] ${e}: ${l}`);},Ft=globalThis.AbortController,jt=globalThis.AbortSignal;if(typeof Ft>"u"){jt=class{constructor(){S(this,"onabort");S(this,"_onabort",[]);S(this,"reason");S(this,"aborted",false);}addEventListener(i,s){this._onabort.push(s);}},Ft=class{constructor(){S(this,"signal",new jt);e();}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=Rt.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{constructor(e,i){S(this,"heap");S(this,"length");if(!t(Y,ct))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new i(e),this.length=0;}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}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,F,K,O,y,d,W,G,z,E,$,x,B,J,j,M,q,ht,D,pt,n,Ct,rt,Q,vt,N,Ht,nt,gt,bt,et,it,Wt,At,Ot,b,Dt,St,st,Lt,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);S(this,"ttl");S(this,"ttlResolution");S(this,"ttlAutopurge");S(this,"updateAgeOnGet");S(this,"updateAgeOnHas");S(this,"allowStale");S(this,"noDisposeOnSet");S(this,"noUpdateTTL");S(this,"maxEntrySize");S(this,"sizeCalculation");S(this,"noDeleteOnFetchRejection");S(this,"noDeleteOnStaleGet");S(this,"allowStaleOnFetchAbort");S(this,"allowStaleOnFetchRejection");S(this,"ignoreFetchAbort");g(this,F);g(this,K);g(this,O);g(this,y);g(this,d);g(this,W);g(this,G);g(this,z);g(this,E);g(this,$);g(this,x);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});S(this,Mt,"LRUCache");let{max:i=0,ttl:s,ttlResolution:h=1,ttlAutopurge:r,updateAgeOnGet:o,updateAgeOnHas:u,allowStale:c,dispose:w,onInsert:T,disposeAfter:m,noDisposeOnSet:Z,noUpdateTTL:I,maxSize:X=0,maxEntrySize:_=0,sizeCalculation:v,fetchMethod:p,memoMethod:R,noDeleteOnFetchRejection:L,noDeleteOnStaleGet:C,allowStaleOnFetchRejection:A,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=_||t(this,U),this.sizeCalculation=v,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,O,new Map),f(this,y,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,E,0),f(this,$,te.create(i)),f(this,F,0),f(this,K,0),typeof w=="function"&&f(this,P,w),typeof T=="function"&&f(this,ot,T),typeof m=="function"?(f(this,k,m),f(this,x,[])):(f(this,k,void 0),f(this,x,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=!!A,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,Ct).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 xt="LRU_CACHE_UNBOUNDED";Zt(xt)&&(It.add(xt),Vt("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",xt,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,O),keyList:t(e,y),valList:t(e,d),next:t(e,W),prev:t(e,G),get head(){return t(e,z)},get tail(){return t(e,E)},free:t(e,$),isBackgroundFetch:i=>{var s;return a(s=e,n,b).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,F)}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,O).has(e)?1/0:0}*entries(){for(let e of a(this,n,et).call(this))t(this,d)[e]!==void 0&&t(this,y)[e]!==void 0&&!a(this,n,b).call(this,t(this,d)[e])&&(yield [t(this,y)[e],t(this,d)[e]]);}*rentries(){for(let e of a(this,n,it).call(this))t(this,d)[e]!==void 0&&t(this,y)[e]!==void 0&&!a(this,n,b).call(this,t(this,d)[e])&&(yield [t(this,y)[e],t(this,d)[e]]);}*keys(){for(let e of a(this,n,et).call(this)){let i=t(this,y)[e];i!==void 0&&!a(this,n,b).call(this,t(this,d)[e])&&(yield i);}}*rkeys(){for(let e of a(this,n,it).call(this)){let i=t(this,y)[e];i!==void 0&&!a(this,n,b).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,b).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,b).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,b).call(this,h)?h.__staleWhileFetching:h;if(r!==void 0&&e(r,t(this,y)[s],this))return this.get(t(this,y)[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,b).call(this,h)?h.__staleWhileFetching:h;r!==void 0&&e.call(i,r,t(this,y)[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,b).call(this,h)?h.__staleWhileFetching:h;r!==void 0&&e.call(i,r,t(this,y)[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,y)[i],"expire"),e=true);return e}info(e){let i=t(this,O).get(e);if(i===void 0)return;let s=t(this,d)[i],h=a(this,n,b).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,y)[i],h=t(this,d)[i],r=a(this,n,b).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,_;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,T=t(this,bt).call(this,e,i,s.size||0,u);if(this.maxEntrySize&&T>this.maxEntrySize)return c&&(c.set="miss",c.maxEntrySizeExceeded=true),a(this,n,st).call(this,e,"set"),this;let m=t(this,F)===0?void 0:t(this,O).get(e);if(m===void 0)m=t(this,F)===0?t(this,E):t(this,$).length!==0?t(this,$).pop():t(this,F)===t(this,V)?a(this,n,At).call(this,false):t(this,F),t(this,y)[m]=e,t(this,d)[m]=i,t(this,O).set(e,m),t(this,W)[t(this,E)]=m,t(this,G)[m]=t(this,E),f(this,E,m),yt(this,F)._++,t(this,gt).call(this,m,T,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 v=t(this,d)[m];if(i!==v){if(t(this,ht)&&a(this,n,b).call(this,v)){v.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:p}=v;p!==void 0&&!o&&(t(this,q)&&((I=t(this,P))==null||I.call(this,p,e,"set")),t(this,D)&&t(this,x)?.push([p,e,"set"]));}else o||(t(this,q)&&((X=t(this,P))==null||X.call(this,v,e,"set")),t(this,D)&&t(this,x)?.push([v,e,"set"]));if(t(this,nt).call(this,m),t(this,gt).call(this,m,T,c),t(this,d)[m]=i,c){c.set="replace";let p=v&&a(this,n,b).call(this,v)?v.__staleWhileFetching:v;p!==void 0&&(c.oldValue=p);}}else c&&(c.set="update");t(this,pt)&&this.onInsert?.(i,e,i===v?"update":"replace");}if(h!==0&&!t(this,j)&&a(this,n,Ct).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,x)){let v=t(this,x),p;for(;p=v?.shift();)(_=t(this,k))==null||_.call(this,...p);}return this}pop(){var e;try{for(;t(this,F);){let i=t(this,d)[t(this,z)];if(a(this,n,At).call(this,!0),a(this,n,b).call(this,i)){if(i.__staleWhileFetching)return i.__staleWhileFetching}else if(i!==void 0)return i}}finally{if(t(this,D)&&t(this,x)){let i=t(this,x),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,O).get(e);if(r!==void 0){let o=t(this,d)[r];if(a(this,n,b).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,O).get(e);if(h===void 0||!s&&t(this,N).call(this,h))return;let r=t(this,d)[h];return a(this,n,b).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:T=this.noUpdateTTL,noDeleteOnFetchRejection:m=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:Z=this.allowStaleOnFetchRejection,ignoreFetchAbort:I=this.ignoreFetchAbort,allowStaleOnFetchAbort:X=this.allowStaleOnFetchAbort,context:_,forceRefresh:v=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:T,noDeleteOnFetchRejection:m,allowStaleOnFetchRejection:Z,allowStaleOnFetchAbort:X,ignoreFetchAbort:I,status:p,signal:R},C=t(this,O).get(e);if(C===void 0){p&&(p.fetch="miss");let A=a(this,n,Ot).call(this,e,C,L,_);return A.__returned=A}else {let A=t(this,d)[C];if(a(this,n,b).call(this,A)){let ut=s&&A.__staleWhileFetching!==void 0;return p&&(p.fetch="inflight",ut&&(p.returnedStale=true)),ut?A.__staleWhileFetching:A.__returned=A}let mt=t(this,N).call(this,C);if(!v&&!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),A;let lt=a(this,n,Ot).call(this,e,C,L,_),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,O).get(e);if(u!==void 0){let c=t(this,d)[u],w=a(this,n,b).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,Lt).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,F=new WeakMap,K=new WeakMap,O=new WeakMap,y=new WeakMap,d=new WeakMap,W=new WeakMap,G=new WeakMap,z=new WeakMap,E=new WeakMap,$=new WeakMap,x=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,Ct=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,y)[u],"expire");},c+1);w.unref&&w.unref(),s[u]=w;}}:()=>{};f(this,Q,(u,c)=>{if(e[c]){let w=e[c],T=i[c];if(!w||!T)return;u.ttl=w,u.start=T,u.now=r||o();let m=u.now-T;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,O).get(u);if(c===void 0)return 0;let w=e[c],T=i[c];if(!w||!T)return 1/0;let m=(r||o())-T;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,b).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,F))for(let i=t(this,E);!(!a(this,n,Wt).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,F))for(let i=t(this,z);!(!a(this,n,Wt).call(this,i)||((e||!t(this,N).call(this,i))&&(yield i),i===t(this,E)));)i=t(this,W)[i];},Wt=function(e){return e!==void 0&&t(this,O).get(t(this,y)[e])===e},At=function(e){var r;let i=t(this,z),s=t(this,y)[i],h=t(this,d)[i];return t(this,ht)&&a(this,n,b).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,x)?.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,y)[i]=void 0,t(this,d)[i]=void 0,t(this,$).push(i)),t(this,F)===1?(f(this,z,f(this,E,0)),t(this,$).length=0):f(this,z,t(this,W)[i]),t(this,O).delete(s),yt(this,F)._--,i},Ot=function(e,i,s,h){let r=i===void 0?void 0:t(this,d)[i];if(a(this,n,b).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=(_,v=false)=>{let{aborted:p}=o.signal,R=s.ignoreFetchAbort&&_!==void 0,L=s.ignoreFetchAbort||!!(s.allowStaleOnFetchAbort&&_!==void 0);if(s.status&&(p&&!v?(s.status.fetchAborted=true,s.status.fetchError=o.signal.reason,R&&(s.status.fetchAbortIgnored=true)):s.status.fetchResolved=true),p&&!R&&!v)return m(o.signal.reason,L);let C=I,A=t(this,d)[i];return (A===I||R&&v&&A===void 0)&&(_===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,_,c.options))),_},T=_=>(s.status&&(s.status.fetchRejected=true,s.status.fetchError=_),m(_,false)),m=(_,v)=>{let{aborted:p}=o.signal,R=p&&s.allowStaleOnFetchAbort,L=R||s.allowStaleOnFetchRejection,C=L||s.noDeleteOnFetchRejection,A=I;if(t(this,d)[i]===I&&(!C||!v&&A.__staleWhileFetching===void 0?a(this,n,st).call(this,e,"fetch"):R||(t(this,d)[i]=A.__staleWhileFetching)),L)return s.status&&A.__staleWhileFetching!==void 0&&(s.status.returnedStale=true),A.__staleWhileFetching;if(A.__returned===A)throw _},Z=(_,v)=>{var R;let p=(R=t(this,ft))==null?void 0:R.call(this,e,r,c);p&&p instanceof Promise&&p.then(L=>_(L===void 0?void 0:L),v),o.signal.addEventListener("abort",()=>{(!s.ignoreFetchAbort||s.allowStaleOnFetchAbort)&&(_(void 0),s.allowStaleOnFetchAbort&&(_=L=>w(L,true)));});};s.status&&(s.status.fetchDispatched=true);let I=new Promise(Z).then(w,T),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,O).get(e)):t(this,d)[i]=X,X},b=function(e){if(!t(this,ht))return false;let i=e;return !!i&&i instanceof Promise&&i.hasOwnProperty("__staleWhileFetching")&&i.__abortController instanceof Ft},Dt=function(e,i){t(this,G)[i]=e,t(this,W)[e]=i;},St=function(e){e!==t(this,E)&&(e===t(this,z)?f(this,z,t(this,W)[e]):a(this,n,Dt).call(this,t(this,G)[e],t(this,W)[e]),a(this,n,Dt).call(this,t(this,E),e),f(this,E,e));},st=function(e,i){var h,r;let s=false;if(t(this,F)!==0){let o=t(this,O).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,F)===1)a(this,n,Lt).call(this,i);else {t(this,nt).call(this,o);let u=t(this,d)[o];if(a(this,n,b).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,x)?.push([u,e,i])),t(this,O).delete(e),t(this,y)[o]=void 0,t(this,d)[o]=void 0,o===t(this,E))f(this,E,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,F)._--,t(this,$).push(o);}}if(t(this,D)&&t(this,x)?.length){let o=t(this,x),u;for(;u=o?.shift();)(r=t(this,k))==null||r.call(this,...u);}return s},Lt=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,b).call(this,r))r.__abortController.abort(new Error("deleted"));else {let o=t(this,y)[h];t(this,q)&&((i=t(this,P))==null||i.call(this,r,o,e)),t(this,D)&&t(this,x)?.push([r,o,e]);}}if(t(this,O).clear(),t(this,d).fill(void 0),t(this,y).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,E,0),t(this,$).length=0,f(this,K,0),f(this,F,0),t(this,D)&&t(this,x)){let h=t(this,x),r;for(;r=h?.shift();)(s=t(this,k))==null||s.call(this,...r);}},wt);var Ut=class{constructor(e){S(this,"cache");S(this,"map",new Map);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 Et;(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)))(Et||(Et={}));function me(l){try{if(typeof l>"u")return l;let e=JSON.stringify(l);return JSON.parse(e)}catch(e){throw Et.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,S as d,Ut as e,Et as f,me as g};