@drincs/pixi-vn 1.3.26 → 1.3.27
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/{StoredClassModel-CjdhvNgB.d.cts → StoredClassModel-BgRY86sq.d.cts} +1 -2
- package/dist/{StoredClassModel-CjdhvNgB.d.ts → StoredClassModel-BgRY86sq.d.ts} +1 -2
- package/dist/characters.cjs +1 -1
- package/dist/characters.d.cts +1 -1
- package/dist/characters.d.ts +1 -1
- package/dist/characters.mjs +1 -1
- package/dist/{chunk-VWR64CHT.mjs → chunk-CSAIUPQQ.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/narration.cjs +1 -1
- package/dist/narration.d.cts +1 -2
- package/dist/narration.d.ts +1 -2
- package/dist/narration.mjs +2 -2
- package/dist/storage.cjs +1 -1
- package/dist/storage.d.cts +1 -1
- package/dist/storage.d.ts +1 -1
- package/dist/storage.mjs +1 -1
- package/dist/vite-listener.cjs +1 -1
- package/dist/vite-listener.mjs +1 -1
- package/dist/vite.cjs +1 -1
- package/dist/vite.mjs +1 -1
- package/package.json +1 -1
|
@@ -32,11 +32,10 @@ declare class StoredClassModel {
|
|
|
32
32
|
* @param id The id of instance of the class. This id must be unique for the category.
|
|
33
33
|
*/
|
|
34
34
|
constructor(categoryId: string, id: string);
|
|
35
|
-
private _id;
|
|
36
35
|
/**
|
|
37
36
|
* Is id of the stored class. is unique for this class.
|
|
38
37
|
*/
|
|
39
|
-
|
|
38
|
+
readonly id: string;
|
|
40
39
|
private categoryId;
|
|
41
40
|
/**
|
|
42
41
|
* Update a property in the storage.
|
|
@@ -32,11 +32,10 @@ declare class StoredClassModel {
|
|
|
32
32
|
* @param id The id of instance of the class. This id must be unique for the category.
|
|
33
33
|
*/
|
|
34
34
|
constructor(categoryId: string, id: string);
|
|
35
|
-
private _id;
|
|
36
35
|
/**
|
|
37
36
|
* Is id of the stored class. is unique for this class.
|
|
38
37
|
*/
|
|
39
|
-
|
|
38
|
+
readonly id: string;
|
|
40
39
|
private categoryId;
|
|
41
40
|
/**
|
|
42
41
|
* Update a property in the storage.
|
package/dist/characters.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';require('@drincs/pixi-vn/unifier');var ee=Object.defineProperty;var $t=l=>{throw TypeError(l)};var ie=(l,t,e)=>t in l?ee(l,t,{enumerable:true,configurable:true,writable:true,value:e}):l[t]=e;var g=(l,t,e)=>ie(l,typeof t!="symbol"?t+"":t,e),Gt=(l,t,e)=>t.has(l)||$t("Cannot "+e);var i=(l,t,e)=>(Gt(l,t,"read from private field"),e?e.call(l):t.get(l)),_=(l,t,e)=>t.has(l)?$t("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(l):t.set(l,e),f=(l,t,e,s)=>(Gt(l,t,"write to private field"),t.set(l,e),e),h=(l,t,e)=>(Gt(l,t,"access private method"),e);var vt=(l,t,e,s)=>({set _(r){f(l,t,r);},get _(){return i(l,t,s)}});var W;(r=>(r.log=(a,...n)=>console.log(`[Pixi\u2019VN] ${a}`,...n),r.warn=(a,...n)=>console.warn(`[Pixi\u2019VN] ${a}`,...n),r.error=(a,...n)=>console.error(`[Pixi\u2019VN] ${a}`,...n),r.info=(a,...n)=>console.info(`[Pixi\u2019VN] ${a}`,...n)))(W||(W={}));function It(l){try{if(typeof l>"u")return l;let t=JSON.stringify(l);return JSON.parse(t)}catch(t){throw W.error("Error creating exportable element",l,t),new Error("[Pixi\u2019VN] Error creating exportable element")}}var se=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,Jt=new Set,Lt=typeof process=="object"&&process?process:{},Qt=(l,t,e,s)=>{typeof Lt.emitWarning=="function"?Lt.emitWarning(l,t,e,s):console.error(`[${e}] ${t}: ${l}`);},zt=globalThis.AbortController,Bt=globalThis.AbortSignal;if(typeof zt>"u"){Bt=class{constructor(){g(this,"onabort");g(this,"_onabort",[]);g(this,"reason");g(this,"aborted",false);}addEventListener(s,r){this._onabort.push(r);}},zt=class{constructor(){g(this,"signal",new Bt);t();}abort(s){if(!this.signal.aborted){this.signal.reason=s,this.signal.aborted=true;for(let r of this.signal._onabort)r(s);this.signal.onabort?.(s);}}};let l=Lt.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",t=()=>{l&&(l=false,Qt("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 re=l=>!Jt.has(l),et=l=>l&&l===Math.floor(l)&&l>0&&isFinite(l),Zt=l=>et(l)?l<=Math.pow(2,8)?Uint8Array:l<=Math.pow(2,16)?Uint16Array:l<=Math.pow(2,32)?Uint32Array:l<=Number.MAX_SAFE_INTEGER?gt:null:null,gt=class extends Array{constructor(t){super(t),this.fill(0);}},pt,ot=class ot{constructor(t,e){g(this,"heap");g(this,"length");if(!i(ot,pt))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new e(t),this.length=0;}static create(t){let e=Zt(t);if(!e)return [];f(ot,pt,true);let s=new ot(t,e);return f(ot,pt,false),s}push(t){this.heap[this.length++]=t;}pop(){return this.heap[--this.length]}};pt=new WeakMap,_(ot,pt,false);var Nt=ot,Xt,qt,Y,P,K,ht,j,mt,_t,H,R,$,w,E,p,F,G,I,x,B,C,X,q,L,J,nt,D,St,o,Vt,lt,k,Ot,N,kt,ft,Et,Rt,it,st,Ut,Ft,Dt,S,Wt,At,rt,Yt,Kt=class Kt{constructor(t){_(this,o);_(this,Y);_(this,P);_(this,K);_(this,ht);_(this,j);_(this,mt);_(this,_t);_(this,H);g(this,"ttl");g(this,"ttlResolution");g(this,"ttlAutopurge");g(this,"updateAgeOnGet");g(this,"updateAgeOnHas");g(this,"allowStale");g(this,"noDisposeOnSet");g(this,"noUpdateTTL");g(this,"maxEntrySize");g(this,"sizeCalculation");g(this,"noDeleteOnFetchRejection");g(this,"noDeleteOnStaleGet");g(this,"allowStaleOnFetchAbort");g(this,"allowStaleOnFetchRejection");g(this,"ignoreFetchAbort");_(this,R);_(this,$);_(this,w);_(this,E);_(this,p);_(this,F);_(this,G);_(this,I);_(this,x);_(this,B);_(this,C);_(this,X);_(this,q);_(this,L);_(this,J);_(this,nt);_(this,D);_(this,St);_(this,lt,()=>{});_(this,k,()=>{});_(this,Ot,()=>{});_(this,N,()=>false);_(this,ft,t=>{});_(this,Et,(t,e,s)=>{});_(this,Rt,(t,e,s,r)=>{if(s||r)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});g(this,Xt,"LRUCache");let{max:e=0,ttl:s,ttlResolution:r=1,ttlAutopurge:a,updateAgeOnGet:n,updateAgeOnHas:c,allowStale:u,dispose:O,onInsert:Q,disposeAfter:b,noDisposeOnSet:tt,noUpdateTTL:V,maxSize:Z=0,maxEntrySize:T=0,sizeCalculation:y,fetchMethod:m,memoMethod:z,noDeleteOnFetchRejection:M,noDeleteOnStaleGet:v,allowStaleOnFetchRejection:U,allowStaleOnFetchAbort:wt,ignoreFetchAbort:ct,perf:Ct}=t;if(Ct!==void 0&&typeof Ct?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(f(this,H,Ct??se),e!==0&&!et(e))throw new TypeError("max option must be a nonnegative integer");let ut=e?Zt(e):Array;if(!ut)throw new Error("invalid max value: "+e);if(f(this,Y,e),f(this,P,Z),this.maxEntrySize=T||i(this,P),this.sizeCalculation=y,this.sizeCalculation){if(!i(this,P)&&!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(z!==void 0&&typeof z!="function")throw new TypeError("memoMethod must be a function if defined");if(f(this,_t,z),m!==void 0&&typeof m!="function")throw new TypeError("fetchMethod must be a function if specified");if(f(this,mt,m),f(this,nt,!!m),f(this,w,new Map),f(this,E,new Array(e).fill(void 0)),f(this,p,new Array(e).fill(void 0)),f(this,F,new ut(e)),f(this,G,new ut(e)),f(this,I,0),f(this,x,0),f(this,B,Nt.create(e)),f(this,R,0),f(this,$,0),typeof O=="function"&&f(this,K,O),typeof Q=="function"&&f(this,ht,Q),typeof b=="function"?(f(this,j,b),f(this,C,[])):(f(this,j,void 0),f(this,C,void 0)),f(this,J,!!i(this,K)),f(this,St,!!i(this,ht)),f(this,D,!!i(this,j)),this.noDisposeOnSet=!!tt,this.noUpdateTTL=!!V,this.noDeleteOnFetchRejection=!!M,this.allowStaleOnFetchRejection=!!U,this.allowStaleOnFetchAbort=!!wt,this.ignoreFetchAbort=!!ct,this.maxEntrySize!==0){if(i(this,P)!==0&&!et(i(this,P)))throw new TypeError("maxSize must be a positive integer if specified");if(!et(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");h(this,o,kt).call(this);}if(this.allowStale=!!u,this.noDeleteOnStaleGet=!!v,this.updateAgeOnGet=!!n,this.updateAgeOnHas=!!c,this.ttlResolution=et(r)||r===0?r:1,this.ttlAutopurge=!!a,this.ttl=s||0,this.ttl){if(!et(this.ttl))throw new TypeError("ttl must be a positive integer if specified");h(this,o,Vt).call(this);}if(i(this,Y)===0&&this.ttl===0&&i(this,P)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!i(this,Y)&&!i(this,P)){let dt="LRU_CACHE_UNBOUNDED";re(dt)&&(Jt.add(dt),Qt("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",dt,Kt));}}get perf(){return i(this,H)}static unsafeExposeInternals(t){return {starts:i(t,q),ttls:i(t,L),sizes:i(t,X),keyMap:i(t,w),keyList:i(t,E),valList:i(t,p),next:i(t,F),prev:i(t,G),get head(){return i(t,I)},get tail(){return i(t,x)},free:i(t,B),isBackgroundFetch:e=>{var s;return h(s=t,o,S).call(s,e)},backgroundFetch:(e,s,r,a)=>{var n;return h(n=t,o,Dt).call(n,e,s,r,a)},moveToTail:e=>{var s;return h(s=t,o,At).call(s,e)},indexes:e=>{var s;return h(s=t,o,it).call(s,e)},rindexes:e=>{var s;return h(s=t,o,st).call(s,e)},isStale:e=>{var s;return i(s=t,N).call(s,e)}}}get max(){return i(this,Y)}get maxSize(){return i(this,P)}get calculatedSize(){return i(this,$)}get size(){return i(this,R)}get fetchMethod(){return i(this,mt)}get memoMethod(){return i(this,_t)}get dispose(){return i(this,K)}get onInsert(){return i(this,ht)}get disposeAfter(){return i(this,j)}getRemainingTTL(t){return i(this,w).has(t)?1/0:0}*entries(){for(let t of h(this,o,it).call(this))i(this,p)[t]!==void 0&&i(this,E)[t]!==void 0&&!h(this,o,S).call(this,i(this,p)[t])&&(yield [i(this,E)[t],i(this,p)[t]]);}*rentries(){for(let t of h(this,o,st).call(this))i(this,p)[t]!==void 0&&i(this,E)[t]!==void 0&&!h(this,o,S).call(this,i(this,p)[t])&&(yield [i(this,E)[t],i(this,p)[t]]);}*keys(){for(let t of h(this,o,it).call(this)){let e=i(this,E)[t];e!==void 0&&!h(this,o,S).call(this,i(this,p)[t])&&(yield e);}}*rkeys(){for(let t of h(this,o,st).call(this)){let e=i(this,E)[t];e!==void 0&&!h(this,o,S).call(this,i(this,p)[t])&&(yield e);}}*values(){for(let t of h(this,o,it).call(this))i(this,p)[t]!==void 0&&!h(this,o,S).call(this,i(this,p)[t])&&(yield i(this,p)[t]);}*rvalues(){for(let t of h(this,o,st).call(this))i(this,p)[t]!==void 0&&!h(this,o,S).call(this,i(this,p)[t])&&(yield i(this,p)[t]);}[(qt=Symbol.iterator,Xt=Symbol.toStringTag,qt)](){return this.entries()}find(t,e={}){for(let s of h(this,o,it).call(this)){let r=i(this,p)[s],a=h(this,o,S).call(this,r)?r.__staleWhileFetching:r;if(a!==void 0&&t(a,i(this,E)[s],this))return this.get(i(this,E)[s],e)}}forEach(t,e=this){for(let s of h(this,o,it).call(this)){let r=i(this,p)[s],a=h(this,o,S).call(this,r)?r.__staleWhileFetching:r;a!==void 0&&t.call(e,a,i(this,E)[s],this);}}rforEach(t,e=this){for(let s of h(this,o,st).call(this)){let r=i(this,p)[s],a=h(this,o,S).call(this,r)?r.__staleWhileFetching:r;a!==void 0&&t.call(e,a,i(this,E)[s],this);}}purgeStale(){let t=false;for(let e of h(this,o,st).call(this,{allowStale:true}))i(this,N).call(this,e)&&(h(this,o,rt).call(this,i(this,E)[e],"expire"),t=true);return t}info(t){let e=i(this,w).get(t);if(e===void 0)return;let s=i(this,p)[e],r=h(this,o,S).call(this,s)?s.__staleWhileFetching:s;if(r===void 0)return;let a={value:r};if(i(this,L)&&i(this,q)){let n=i(this,L)[e],c=i(this,q)[e];if(n&&c){let u=n-(i(this,H).now()-c);a.ttl=u,a.start=Date.now();}}return i(this,X)&&(a.size=i(this,X)[e]),a}dump(){let t=[];for(let e of h(this,o,it).call(this,{allowStale:true})){let s=i(this,E)[e],r=i(this,p)[e],a=h(this,o,S).call(this,r)?r.__staleWhileFetching:r;if(a===void 0||s===void 0)continue;let n={value:a};if(i(this,L)&&i(this,q)){n.ttl=i(this,L)[e];let c=i(this,H).now()-i(this,q)[e];n.start=Math.floor(Date.now()-c);}i(this,X)&&(n.size=i(this,X)[e]),t.unshift([s,n]);}return t}load(t){this.clear();for(let[e,s]of t){if(s.start){let r=Date.now()-s.start;s.start=i(this,H).now()-r;}this.set(e,s.value,s);}}set(t,e,s={}){var tt,V,Z,T;if(e===void 0)return this.delete(t),this;let{ttl:r=this.ttl,start:a,noDisposeOnSet:n=this.noDisposeOnSet,sizeCalculation:c=this.sizeCalculation,status:u}=s,{noUpdateTTL:O=this.noUpdateTTL}=s,Q=i(this,Rt).call(this,t,e,s.size||0,c);if(this.maxEntrySize&&Q>this.maxEntrySize)return u&&(u.set="miss",u.maxEntrySizeExceeded=true),h(this,o,rt).call(this,t,"set"),this;let b=i(this,R)===0?void 0:i(this,w).get(t);if(b===void 0)b=i(this,R)===0?i(this,x):i(this,B).length!==0?i(this,B).pop():i(this,R)===i(this,Y)?h(this,o,Ft).call(this,false):i(this,R),i(this,E)[b]=t,i(this,p)[b]=e,i(this,w).set(t,b),i(this,F)[i(this,x)]=b,i(this,G)[b]=i(this,x),f(this,x,b),vt(this,R)._++,i(this,Et).call(this,b,Q,u),u&&(u.set="add"),O=false,i(this,St)&&((tt=i(this,ht))==null||tt.call(this,e,t,"add"));else {h(this,o,At).call(this,b);let y=i(this,p)[b];if(e!==y){if(i(this,nt)&&h(this,o,S).call(this,y)){y.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:m}=y;m!==void 0&&!n&&(i(this,J)&&((V=i(this,K))==null||V.call(this,m,t,"set")),i(this,D)&&i(this,C)?.push([m,t,"set"]));}else n||(i(this,J)&&((Z=i(this,K))==null||Z.call(this,y,t,"set")),i(this,D)&&i(this,C)?.push([y,t,"set"]));if(i(this,ft).call(this,b),i(this,Et).call(this,b,Q,u),i(this,p)[b]=e,u){u.set="replace";let m=y&&h(this,o,S).call(this,y)?y.__staleWhileFetching:y;m!==void 0&&(u.oldValue=m);}}else u&&(u.set="update");i(this,St)&&this.onInsert?.(e,t,e===y?"update":"replace");}if(r!==0&&!i(this,L)&&h(this,o,Vt).call(this),i(this,L)&&(O||i(this,Ot).call(this,b,r,a),u&&i(this,k).call(this,u,b)),!n&&i(this,D)&&i(this,C)){let y=i(this,C),m;for(;m=y?.shift();)(T=i(this,j))==null||T.call(this,...m);}return this}pop(){var t;try{for(;i(this,R);){let e=i(this,p)[i(this,I)];if(h(this,o,Ft).call(this,!0),h(this,o,S).call(this,e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(i(this,D)&&i(this,C)){let e=i(this,C),s;for(;s=e?.shift();)(t=i(this,j))==null||t.call(this,...s);}}}has(t,e={}){let{updateAgeOnHas:s=this.updateAgeOnHas,status:r}=e,a=i(this,w).get(t);if(a!==void 0){let n=i(this,p)[a];if(h(this,o,S).call(this,n)&&n.__staleWhileFetching===void 0)return false;if(i(this,N).call(this,a))r&&(r.has="stale",i(this,k).call(this,r,a));else return s&&i(this,lt).call(this,a),r&&(r.has="hit",i(this,k).call(this,r,a)),true}else r&&(r.has="miss");return false}peek(t,e={}){let{allowStale:s=this.allowStale}=e,r=i(this,w).get(t);if(r===void 0||!s&&i(this,N).call(this,r))return;let a=i(this,p)[r];return h(this,o,S).call(this,a)?a.__staleWhileFetching:a}async fetch(t,e={}){let{allowStale:s=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:a=this.noDeleteOnStaleGet,ttl:n=this.ttl,noDisposeOnSet:c=this.noDisposeOnSet,size:u=0,sizeCalculation:O=this.sizeCalculation,noUpdateTTL:Q=this.noUpdateTTL,noDeleteOnFetchRejection:b=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:tt=this.allowStaleOnFetchRejection,ignoreFetchAbort:V=this.ignoreFetchAbort,allowStaleOnFetchAbort:Z=this.allowStaleOnFetchAbort,context:T,forceRefresh:y=false,status:m,signal:z}=e;if(!i(this,nt))return m&&(m.fetch="get"),this.get(t,{allowStale:s,updateAgeOnGet:r,noDeleteOnStaleGet:a,status:m});let M={allowStale:s,updateAgeOnGet:r,noDeleteOnStaleGet:a,ttl:n,noDisposeOnSet:c,size:u,sizeCalculation:O,noUpdateTTL:Q,noDeleteOnFetchRejection:b,allowStaleOnFetchRejection:tt,allowStaleOnFetchAbort:Z,ignoreFetchAbort:V,status:m,signal:z},v=i(this,w).get(t);if(v===void 0){m&&(m.fetch="miss");let U=h(this,o,Dt).call(this,t,v,M,T);return U.__returned=U}else {let U=i(this,p)[v];if(h(this,o,S).call(this,U)){let dt=s&&U.__staleWhileFetching!==void 0;return m&&(m.fetch="inflight",dt&&(m.returnedStale=true)),dt?U.__staleWhileFetching:U.__returned=U}let wt=i(this,N).call(this,v);if(!y&&!wt)return m&&(m.fetch="hit"),h(this,o,At).call(this,v),r&&i(this,lt).call(this,v),m&&i(this,k).call(this,m,v),U;let ct=h(this,o,Dt).call(this,t,v,M,T),ut=ct.__staleWhileFetching!==void 0&&s;return m&&(m.fetch=wt?"stale":"refresh",ut&&wt&&(m.returnedStale=true)),ut?ct.__staleWhileFetching:ct.__returned=ct}}async forceFetch(t,e={}){let s=await this.fetch(t,e);if(s===void 0)throw new Error("fetch() returned undefined");return s}memo(t,e={}){let s=i(this,_t);if(!s)throw new Error("no memoMethod provided to constructor");let{context:r,forceRefresh:a,...n}=e,c=this.get(t,n);if(!a&&c!==void 0)return c;let u=s(t,c,{options:n,context:r});return this.set(t,u,n),u}get(t,e={}){let{allowStale:s=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:a=this.noDeleteOnStaleGet,status:n}=e,c=i(this,w).get(t);if(c!==void 0){let u=i(this,p)[c],O=h(this,o,S).call(this,u);return n&&i(this,k).call(this,n,c),i(this,N).call(this,c)?(n&&(n.get="stale"),O?(n&&s&&u.__staleWhileFetching!==void 0&&(n.returnedStale=true),s?u.__staleWhileFetching:void 0):(a||h(this,o,rt).call(this,t,"expire"),n&&s&&(n.returnedStale=true),s?u:void 0)):(n&&(n.get="hit"),O?u.__staleWhileFetching:(h(this,o,At).call(this,c),r&&i(this,lt).call(this,c),u))}else n&&(n.get="miss");}delete(t){return h(this,o,rt).call(this,t,"delete")}clear(){return h(this,o,Yt).call(this,"delete")}};Y=new WeakMap,P=new WeakMap,K=new WeakMap,ht=new WeakMap,j=new WeakMap,mt=new WeakMap,_t=new WeakMap,H=new WeakMap,R=new WeakMap,$=new WeakMap,w=new WeakMap,E=new WeakMap,p=new WeakMap,F=new WeakMap,G=new WeakMap,I=new WeakMap,x=new WeakMap,B=new WeakMap,C=new WeakMap,X=new WeakMap,q=new WeakMap,L=new WeakMap,J=new WeakMap,nt=new WeakMap,D=new WeakMap,St=new WeakMap,o=new WeakSet,Vt=function(){let t=new gt(i(this,Y)),e=new gt(i(this,Y));f(this,L,t),f(this,q,e),f(this,Ot,(a,n,c=i(this,H).now())=>{if(e[a]=n!==0?c:0,t[a]=n,n!==0&&this.ttlAutopurge){let u=setTimeout(()=>{i(this,N).call(this,a)&&h(this,o,rt).call(this,i(this,E)[a],"expire");},n+1);u.unref&&u.unref();}}),f(this,lt,a=>{e[a]=t[a]!==0?i(this,H).now():0;}),f(this,k,(a,n)=>{if(t[n]){let c=t[n],u=e[n];if(!c||!u)return;a.ttl=c,a.start=u,a.now=s||r();let O=a.now-u;a.remainingTTL=c-O;}});let s=0,r=()=>{let a=i(this,H).now();if(this.ttlResolution>0){s=a;let n=setTimeout(()=>s=0,this.ttlResolution);n.unref&&n.unref();}return a};this.getRemainingTTL=a=>{let n=i(this,w).get(a);if(n===void 0)return 0;let c=t[n],u=e[n];if(!c||!u)return 1/0;let O=(s||r())-u;return c-O},f(this,N,a=>{let n=e[a],c=t[a];return !!c&&!!n&&(s||r())-n>c});},lt=new WeakMap,k=new WeakMap,Ot=new WeakMap,N=new WeakMap,kt=function(){let t=new gt(i(this,Y));f(this,$,0),f(this,X,t),f(this,ft,e=>{f(this,$,i(this,$)-t[e]),t[e]=0;}),f(this,Rt,(e,s,r,a)=>{if(h(this,o,S).call(this,s))return 0;if(!et(r))if(a){if(typeof a!="function")throw new TypeError("sizeCalculation must be a function");if(r=a(s,e),!et(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}),f(this,Et,(e,s,r)=>{if(t[e]=s,i(this,P)){let a=i(this,P)-t[e];for(;i(this,$)>a;)h(this,o,Ft).call(this,true);}f(this,$,i(this,$)+t[e]),r&&(r.entrySize=s,r.totalCalculatedSize=i(this,$));});},ft=new WeakMap,Et=new WeakMap,Rt=new WeakMap,it=function*({allowStale:t=this.allowStale}={}){if(i(this,R))for(let e=i(this,x);!(!h(this,o,Ut).call(this,e)||((t||!i(this,N).call(this,e))&&(yield e),e===i(this,I)));)e=i(this,G)[e];},st=function*({allowStale:t=this.allowStale}={}){if(i(this,R))for(let e=i(this,I);!(!h(this,o,Ut).call(this,e)||((t||!i(this,N).call(this,e))&&(yield e),e===i(this,x)));)e=i(this,F)[e];},Ut=function(t){return t!==void 0&&i(this,w).get(i(this,E)[t])===t},Ft=function(t){var a;let e=i(this,I),s=i(this,E)[e],r=i(this,p)[e];return i(this,nt)&&h(this,o,S).call(this,r)?r.__abortController.abort(new Error("evicted")):(i(this,J)||i(this,D))&&(i(this,J)&&((a=i(this,K))==null||a.call(this,r,s,"evict")),i(this,D)&&i(this,C)?.push([r,s,"evict"])),i(this,ft).call(this,e),t&&(i(this,E)[e]=void 0,i(this,p)[e]=void 0,i(this,B).push(e)),i(this,R)===1?(f(this,I,f(this,x,0)),i(this,B).length=0):f(this,I,i(this,F)[e]),i(this,w).delete(s),vt(this,R)._--,e},Dt=function(t,e,s,r){let a=e===void 0?void 0:i(this,p)[e];if(h(this,o,S).call(this,a))return a;let n=new zt,{signal:c}=s;c?.addEventListener("abort",()=>n.abort(c.reason),{signal:n.signal});let u={signal:n.signal,options:s,context:r},O=(T,y=false)=>{let{aborted:m}=n.signal,z=s.ignoreFetchAbort&&T!==void 0;if(s.status&&(m&&!y?(s.status.fetchAborted=true,s.status.fetchError=n.signal.reason,z&&(s.status.fetchAbortIgnored=true)):s.status.fetchResolved=true),m&&!z&&!y)return b(n.signal.reason);let M=V;return i(this,p)[e]===V&&(T===void 0?M.__staleWhileFetching!==void 0?i(this,p)[e]=M.__staleWhileFetching:h(this,o,rt).call(this,t,"fetch"):(s.status&&(s.status.fetchUpdated=true),this.set(t,T,u.options))),T},Q=T=>(s.status&&(s.status.fetchRejected=true,s.status.fetchError=T),b(T)),b=T=>{let{aborted:y}=n.signal,m=y&&s.allowStaleOnFetchAbort,z=m||s.allowStaleOnFetchRejection,M=z||s.noDeleteOnFetchRejection,v=V;if(i(this,p)[e]===V&&(!M||v.__staleWhileFetching===void 0?h(this,o,rt).call(this,t,"fetch"):m||(i(this,p)[e]=v.__staleWhileFetching)),z)return s.status&&v.__staleWhileFetching!==void 0&&(s.status.returnedStale=true),v.__staleWhileFetching;if(v.__returned===v)throw T},tt=(T,y)=>{var z;let m=(z=i(this,mt))==null?void 0:z.call(this,t,a,u);m&&m instanceof Promise&&m.then(M=>T(M===void 0?void 0:M),y),n.signal.addEventListener("abort",()=>{(!s.ignoreFetchAbort||s.allowStaleOnFetchAbort)&&(T(void 0),s.allowStaleOnFetchAbort&&(T=M=>O(M,true)));});};s.status&&(s.status.fetchDispatched=true);let V=new Promise(tt).then(O,Q),Z=Object.assign(V,{__abortController:n,__staleWhileFetching:a,__returned:void 0});return e===void 0?(this.set(t,Z,{...u.options,status:void 0}),e=i(this,w).get(t)):i(this,p)[e]=Z,Z},S=function(t){if(!i(this,nt))return false;let e=t;return !!e&&e instanceof Promise&&e.hasOwnProperty("__staleWhileFetching")&&e.__abortController instanceof zt},Wt=function(t,e){i(this,G)[e]=t,i(this,F)[t]=e;},At=function(t){t!==i(this,x)&&(t===i(this,I)?f(this,I,i(this,F)[t]):h(this,o,Wt).call(this,i(this,G)[t],i(this,F)[t]),h(this,o,Wt).call(this,i(this,x),t),f(this,x,t));},rt=function(t,e){var r,a;let s=false;if(i(this,R)!==0){let n=i(this,w).get(t);if(n!==void 0)if(s=true,i(this,R)===1)h(this,o,Yt).call(this,e);else {i(this,ft).call(this,n);let c=i(this,p)[n];if(h(this,o,S).call(this,c)?c.__abortController.abort(new Error("deleted")):(i(this,J)||i(this,D))&&(i(this,J)&&((r=i(this,K))==null||r.call(this,c,t,e)),i(this,D)&&i(this,C)?.push([c,t,e])),i(this,w).delete(t),i(this,E)[n]=void 0,i(this,p)[n]=void 0,n===i(this,x))f(this,x,i(this,G)[n]);else if(n===i(this,I))f(this,I,i(this,F)[n]);else {let u=i(this,G)[n];i(this,F)[u]=i(this,F)[n];let O=i(this,F)[n];i(this,G)[O]=i(this,G)[n];}vt(this,R)._--,i(this,B).push(n);}}if(i(this,D)&&i(this,C)?.length){let n=i(this,C),c;for(;c=n?.shift();)(a=i(this,j))==null||a.call(this,...c);}return s},Yt=function(t){var e,s;for(let r of h(this,o,st).call(this,{allowStale:true})){let a=i(this,p)[r];if(h(this,o,S).call(this,a))a.__abortController.abort(new Error("deleted"));else {let n=i(this,E)[r];i(this,J)&&((e=i(this,K))==null||e.call(this,a,n,t)),i(this,D)&&i(this,C)?.push([a,n,t]);}}if(i(this,w).clear(),i(this,p).fill(void 0),i(this,E).fill(void 0),i(this,L)&&i(this,q)&&(i(this,L).fill(0),i(this,q).fill(0)),i(this,X)&&i(this,X).fill(0),f(this,I,0),f(this,x,0),i(this,B).length=0,f(this,$,0),f(this,R,0),i(this,D)&&i(this,C)){let r=i(this,C),a;for(;a=r?.shift();)(s=i(this,j))==null||s.call(this,...a);}};var Mt=Kt;var at=class{constructor(t){g(this,"cache");g(this,"map",new Map);this.cache=new Mt({max:t.cacheSize}),this.map=new Map;}get[Symbol.iterator](){return this.map[Symbol.iterator]}get[Symbol.toStringTag](){return this.map[Symbol.toStringTag]}clear(){return this.cache.clear(),this.map.clear()}delete(t){let e=this.map.delete(t);return e&&this.cache.delete(t),e}get forEach(){return this.map.forEach}get(t){let e=this.cache.get(t);return e||this.map.get(t)}has(t){return this.map.has(t)}set(t,e){return this.map.set(t,e),this.cache.set(t,e),this}get size(){return this.map.size}entries(){return this.map.entries()}keys(){return this.map.keys()}values(){return this.map.values()}};var A=class A{constructor(){}static clearOldTempVariables(t){A.tempStorageDeadlines.forEach((e,s)=>{e>t&&(A.tempStorage.delete(s),A.tempStorageDeadlines.delete(s),A.storage.cache.delete(s));});}static setVariable(t,e){let s=A.tempStorage.has(t);e==null?(A.storage.map.delete(t),!s&&A.storage.cache.delete(t)):(A.storage.map.set(t,e),!s&&A.storage.cache.set(t,e));}static getVariable(t){let e=A.storage.cache.get(t);return e===void 0&&(e=A.tempStorage.get(t)),e===void 0&&(e=A.storage.map.get(t)),It(e)}static removeVariable(t){A.storage.delete(t);}static setFlag(t,e){if(e)this.flags.includes(t)||this.flags.push(t);else {let s=this.flags.indexOf(t);s>-1&&this.flags.splice(s,1);}}static getFlag(t){return this.flags.includes(t)}};g(A,"storage",new at({cacheSize:20})),g(A,"startingStorage",[]),g(A,"flags",Array()),g(A,"tempStorage",new Map),g(A,"tempStorageDeadlines",new Map);var d=A;var bt=class{constructor(t,e){g(this,"_id");g(this,"categoryId");this.categoryId=t,this._id=e;}get id(){return this._id}setStorageProperty(t,e){let s=d.getVariable(this.categoryId);s||(s={}),s.hasOwnProperty(this.id)||(s[this.id]={}),e==null?s[this.id].hasOwnProperty(t)&&delete s[this.id][t]:s[this.id]={...s[this.id],[t]:e},Object.keys(s[this.id]).length===0&&delete s[this.id],d.setVariable(this.categoryId,s);}getStorageProperty(t,e=this.id){let s=d.getVariable(this.categoryId);if(s&&s.hasOwnProperty(e)&&s[e].hasOwnProperty(t))return s[e][t]}};var jt={CHARACTER_CATEGORY_KEY:"___character___"};var ne="@",yt=class extends bt{constructor(e,s=""){super(jt.CHARACTER_CATEGORY_KEY,e+(s?ne+s:""));g(this,"sourceId");this.sourceId=e;}getStorageProperty(e){let s=super.getStorageProperty(e);return s===void 0&&(s=super.getStorageProperty(e,this.sourceId)),s}};var Pt=class extends yt{constructor(e,s){super(typeof e=="string"?e:e.id,typeof e=="string"?"":e.emotion);g(this,"defaultName");g(this,"defaultSurname");g(this,"defaultAge");g(this,"_icon");g(this,"_color");this.defaultName=s.name,this.defaultSurname=s.surname,this.defaultAge=s.age,this._icon=s.icon,this._color=s.color;}get name(){return this.getStorageProperty("name")||this.defaultName||this.id}set name(e){this.setStorageProperty("name",e);}get surname(){return this.getStorageProperty("surname")||this.defaultSurname}set surname(e){this.setStorageProperty("surname",e);}get age(){return this.getStorageProperty("age")||this.defaultAge}set age(e){this.setStorageProperty("age",e);}get icon(){return this._icon}get color(){return this._color}};var Tt=new at({cacheSize:10}),Ht;(a=>{function l(n){try{let c=Tt.get(n);if(!c){W.warn(`Character "${n}" not found, did you forget to register it with the RegisteredCharacters.add?`);return}return c}catch(c){W.error(`Error while getting Character "${n}"`,c);return}}a.get=l;function t(n){if(Array.isArray(n)){n.forEach(c=>t(c));return}Tt.get(n.id)&&W.info(`Character id "${n.id}" already exists, it will be overwritten`),Tt.set(n.id,n);}a.add=t;function e(){return Array.from(Tt.values())}a.values=e;function s(n){return Tt.has(n)}a.has=s;function r(){return Array.from(Tt.keys())}a.keys=r;})(Ht||(Ht={}));var ae=Ht;exports.CharacterBaseModel=Pt;exports.CharacterStoredClass=yt;exports.RegisteredCharacters=ae;
|
|
1
|
+
'use strict';require('@drincs/pixi-vn/unifier');var ee=Object.defineProperty;var $t=l=>{throw TypeError(l)};var ie=(l,t,e)=>t in l?ee(l,t,{enumerable:true,configurable:true,writable:true,value:e}):l[t]=e;var g=(l,t,e)=>ie(l,typeof t!="symbol"?t+"":t,e),Gt=(l,t,e)=>t.has(l)||$t("Cannot "+e);var i=(l,t,e)=>(Gt(l,t,"read from private field"),e?e.call(l):t.get(l)),_=(l,t,e)=>t.has(l)?$t("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(l):t.set(l,e),f=(l,t,e,s)=>(Gt(l,t,"write to private field"),t.set(l,e),e),h=(l,t,e)=>(Gt(l,t,"access private method"),e);var vt=(l,t,e,s)=>({set _(r){f(l,t,r);},get _(){return i(l,t,s)}});var W;(r=>(r.log=(a,...n)=>console.log(`[Pixi\u2019VN] ${a}`,...n),r.warn=(a,...n)=>console.warn(`[Pixi\u2019VN] ${a}`,...n),r.error=(a,...n)=>console.error(`[Pixi\u2019VN] ${a}`,...n),r.info=(a,...n)=>console.info(`[Pixi\u2019VN] ${a}`,...n)))(W||(W={}));function It(l){try{if(typeof l>"u")return l;let t=JSON.stringify(l);return JSON.parse(t)}catch(t){throw W.error("Error creating exportable element",l,t),new Error("[Pixi\u2019VN] Error creating exportable element")}}var se=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,Jt=new Set,Lt=typeof process=="object"&&process?process:{},Qt=(l,t,e,s)=>{typeof Lt.emitWarning=="function"?Lt.emitWarning(l,t,e,s):console.error(`[${e}] ${t}: ${l}`);},zt=globalThis.AbortController,Bt=globalThis.AbortSignal;if(typeof zt>"u"){Bt=class{constructor(){g(this,"onabort");g(this,"_onabort",[]);g(this,"reason");g(this,"aborted",false);}addEventListener(s,r){this._onabort.push(r);}},zt=class{constructor(){g(this,"signal",new Bt);t();}abort(s){if(!this.signal.aborted){this.signal.reason=s,this.signal.aborted=true;for(let r of this.signal._onabort)r(s);this.signal.onabort?.(s);}}};let l=Lt.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",t=()=>{l&&(l=false,Qt("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 re=l=>!Jt.has(l),et=l=>l&&l===Math.floor(l)&&l>0&&isFinite(l),Zt=l=>et(l)?l<=Math.pow(2,8)?Uint8Array:l<=Math.pow(2,16)?Uint16Array:l<=Math.pow(2,32)?Uint32Array:l<=Number.MAX_SAFE_INTEGER?gt:null:null,gt=class extends Array{constructor(t){super(t),this.fill(0);}},pt,ot=class ot{constructor(t,e){g(this,"heap");g(this,"length");if(!i(ot,pt))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new e(t),this.length=0;}static create(t){let e=Zt(t);if(!e)return [];f(ot,pt,true);let s=new ot(t,e);return f(ot,pt,false),s}push(t){this.heap[this.length++]=t;}pop(){return this.heap[--this.length]}};pt=new WeakMap,_(ot,pt,false);var Nt=ot,Xt,qt,Y,P,K,ht,j,mt,_t,H,R,$,w,E,p,F,G,I,x,B,C,X,q,L,J,nt,D,St,o,Vt,lt,k,Ot,N,kt,ft,Et,Rt,it,st,Ut,Ft,Dt,S,Wt,At,rt,Yt,Kt=class Kt{constructor(t){_(this,o);_(this,Y);_(this,P);_(this,K);_(this,ht);_(this,j);_(this,mt);_(this,_t);_(this,H);g(this,"ttl");g(this,"ttlResolution");g(this,"ttlAutopurge");g(this,"updateAgeOnGet");g(this,"updateAgeOnHas");g(this,"allowStale");g(this,"noDisposeOnSet");g(this,"noUpdateTTL");g(this,"maxEntrySize");g(this,"sizeCalculation");g(this,"noDeleteOnFetchRejection");g(this,"noDeleteOnStaleGet");g(this,"allowStaleOnFetchAbort");g(this,"allowStaleOnFetchRejection");g(this,"ignoreFetchAbort");_(this,R);_(this,$);_(this,w);_(this,E);_(this,p);_(this,F);_(this,G);_(this,I);_(this,x);_(this,B);_(this,C);_(this,X);_(this,q);_(this,L);_(this,J);_(this,nt);_(this,D);_(this,St);_(this,lt,()=>{});_(this,k,()=>{});_(this,Ot,()=>{});_(this,N,()=>false);_(this,ft,t=>{});_(this,Et,(t,e,s)=>{});_(this,Rt,(t,e,s,r)=>{if(s||r)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});g(this,Xt,"LRUCache");let{max:e=0,ttl:s,ttlResolution:r=1,ttlAutopurge:a,updateAgeOnGet:n,updateAgeOnHas:c,allowStale:u,dispose:O,onInsert:Q,disposeAfter:b,noDisposeOnSet:tt,noUpdateTTL:V,maxSize:Z=0,maxEntrySize:T=0,sizeCalculation:y,fetchMethod:m,memoMethod:z,noDeleteOnFetchRejection:M,noDeleteOnStaleGet:v,allowStaleOnFetchRejection:U,allowStaleOnFetchAbort:wt,ignoreFetchAbort:ct,perf:Ct}=t;if(Ct!==void 0&&typeof Ct?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(f(this,H,Ct??se),e!==0&&!et(e))throw new TypeError("max option must be a nonnegative integer");let ut=e?Zt(e):Array;if(!ut)throw new Error("invalid max value: "+e);if(f(this,Y,e),f(this,P,Z),this.maxEntrySize=T||i(this,P),this.sizeCalculation=y,this.sizeCalculation){if(!i(this,P)&&!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(z!==void 0&&typeof z!="function")throw new TypeError("memoMethod must be a function if defined");if(f(this,_t,z),m!==void 0&&typeof m!="function")throw new TypeError("fetchMethod must be a function if specified");if(f(this,mt,m),f(this,nt,!!m),f(this,w,new Map),f(this,E,new Array(e).fill(void 0)),f(this,p,new Array(e).fill(void 0)),f(this,F,new ut(e)),f(this,G,new ut(e)),f(this,I,0),f(this,x,0),f(this,B,Nt.create(e)),f(this,R,0),f(this,$,0),typeof O=="function"&&f(this,K,O),typeof Q=="function"&&f(this,ht,Q),typeof b=="function"?(f(this,j,b),f(this,C,[])):(f(this,j,void 0),f(this,C,void 0)),f(this,J,!!i(this,K)),f(this,St,!!i(this,ht)),f(this,D,!!i(this,j)),this.noDisposeOnSet=!!tt,this.noUpdateTTL=!!V,this.noDeleteOnFetchRejection=!!M,this.allowStaleOnFetchRejection=!!U,this.allowStaleOnFetchAbort=!!wt,this.ignoreFetchAbort=!!ct,this.maxEntrySize!==0){if(i(this,P)!==0&&!et(i(this,P)))throw new TypeError("maxSize must be a positive integer if specified");if(!et(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");h(this,o,kt).call(this);}if(this.allowStale=!!u,this.noDeleteOnStaleGet=!!v,this.updateAgeOnGet=!!n,this.updateAgeOnHas=!!c,this.ttlResolution=et(r)||r===0?r:1,this.ttlAutopurge=!!a,this.ttl=s||0,this.ttl){if(!et(this.ttl))throw new TypeError("ttl must be a positive integer if specified");h(this,o,Vt).call(this);}if(i(this,Y)===0&&this.ttl===0&&i(this,P)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!i(this,Y)&&!i(this,P)){let dt="LRU_CACHE_UNBOUNDED";re(dt)&&(Jt.add(dt),Qt("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",dt,Kt));}}get perf(){return i(this,H)}static unsafeExposeInternals(t){return {starts:i(t,q),ttls:i(t,L),sizes:i(t,X),keyMap:i(t,w),keyList:i(t,E),valList:i(t,p),next:i(t,F),prev:i(t,G),get head(){return i(t,I)},get tail(){return i(t,x)},free:i(t,B),isBackgroundFetch:e=>{var s;return h(s=t,o,S).call(s,e)},backgroundFetch:(e,s,r,a)=>{var n;return h(n=t,o,Dt).call(n,e,s,r,a)},moveToTail:e=>{var s;return h(s=t,o,At).call(s,e)},indexes:e=>{var s;return h(s=t,o,it).call(s,e)},rindexes:e=>{var s;return h(s=t,o,st).call(s,e)},isStale:e=>{var s;return i(s=t,N).call(s,e)}}}get max(){return i(this,Y)}get maxSize(){return i(this,P)}get calculatedSize(){return i(this,$)}get size(){return i(this,R)}get fetchMethod(){return i(this,mt)}get memoMethod(){return i(this,_t)}get dispose(){return i(this,K)}get onInsert(){return i(this,ht)}get disposeAfter(){return i(this,j)}getRemainingTTL(t){return i(this,w).has(t)?1/0:0}*entries(){for(let t of h(this,o,it).call(this))i(this,p)[t]!==void 0&&i(this,E)[t]!==void 0&&!h(this,o,S).call(this,i(this,p)[t])&&(yield [i(this,E)[t],i(this,p)[t]]);}*rentries(){for(let t of h(this,o,st).call(this))i(this,p)[t]!==void 0&&i(this,E)[t]!==void 0&&!h(this,o,S).call(this,i(this,p)[t])&&(yield [i(this,E)[t],i(this,p)[t]]);}*keys(){for(let t of h(this,o,it).call(this)){let e=i(this,E)[t];e!==void 0&&!h(this,o,S).call(this,i(this,p)[t])&&(yield e);}}*rkeys(){for(let t of h(this,o,st).call(this)){let e=i(this,E)[t];e!==void 0&&!h(this,o,S).call(this,i(this,p)[t])&&(yield e);}}*values(){for(let t of h(this,o,it).call(this))i(this,p)[t]!==void 0&&!h(this,o,S).call(this,i(this,p)[t])&&(yield i(this,p)[t]);}*rvalues(){for(let t of h(this,o,st).call(this))i(this,p)[t]!==void 0&&!h(this,o,S).call(this,i(this,p)[t])&&(yield i(this,p)[t]);}[(qt=Symbol.iterator,Xt=Symbol.toStringTag,qt)](){return this.entries()}find(t,e={}){for(let s of h(this,o,it).call(this)){let r=i(this,p)[s],a=h(this,o,S).call(this,r)?r.__staleWhileFetching:r;if(a!==void 0&&t(a,i(this,E)[s],this))return this.get(i(this,E)[s],e)}}forEach(t,e=this){for(let s of h(this,o,it).call(this)){let r=i(this,p)[s],a=h(this,o,S).call(this,r)?r.__staleWhileFetching:r;a!==void 0&&t.call(e,a,i(this,E)[s],this);}}rforEach(t,e=this){for(let s of h(this,o,st).call(this)){let r=i(this,p)[s],a=h(this,o,S).call(this,r)?r.__staleWhileFetching:r;a!==void 0&&t.call(e,a,i(this,E)[s],this);}}purgeStale(){let t=false;for(let e of h(this,o,st).call(this,{allowStale:true}))i(this,N).call(this,e)&&(h(this,o,rt).call(this,i(this,E)[e],"expire"),t=true);return t}info(t){let e=i(this,w).get(t);if(e===void 0)return;let s=i(this,p)[e],r=h(this,o,S).call(this,s)?s.__staleWhileFetching:s;if(r===void 0)return;let a={value:r};if(i(this,L)&&i(this,q)){let n=i(this,L)[e],c=i(this,q)[e];if(n&&c){let u=n-(i(this,H).now()-c);a.ttl=u,a.start=Date.now();}}return i(this,X)&&(a.size=i(this,X)[e]),a}dump(){let t=[];for(let e of h(this,o,it).call(this,{allowStale:true})){let s=i(this,E)[e],r=i(this,p)[e],a=h(this,o,S).call(this,r)?r.__staleWhileFetching:r;if(a===void 0||s===void 0)continue;let n={value:a};if(i(this,L)&&i(this,q)){n.ttl=i(this,L)[e];let c=i(this,H).now()-i(this,q)[e];n.start=Math.floor(Date.now()-c);}i(this,X)&&(n.size=i(this,X)[e]),t.unshift([s,n]);}return t}load(t){this.clear();for(let[e,s]of t){if(s.start){let r=Date.now()-s.start;s.start=i(this,H).now()-r;}this.set(e,s.value,s);}}set(t,e,s={}){var tt,V,Z,T;if(e===void 0)return this.delete(t),this;let{ttl:r=this.ttl,start:a,noDisposeOnSet:n=this.noDisposeOnSet,sizeCalculation:c=this.sizeCalculation,status:u}=s,{noUpdateTTL:O=this.noUpdateTTL}=s,Q=i(this,Rt).call(this,t,e,s.size||0,c);if(this.maxEntrySize&&Q>this.maxEntrySize)return u&&(u.set="miss",u.maxEntrySizeExceeded=true),h(this,o,rt).call(this,t,"set"),this;let b=i(this,R)===0?void 0:i(this,w).get(t);if(b===void 0)b=i(this,R)===0?i(this,x):i(this,B).length!==0?i(this,B).pop():i(this,R)===i(this,Y)?h(this,o,Ft).call(this,false):i(this,R),i(this,E)[b]=t,i(this,p)[b]=e,i(this,w).set(t,b),i(this,F)[i(this,x)]=b,i(this,G)[b]=i(this,x),f(this,x,b),vt(this,R)._++,i(this,Et).call(this,b,Q,u),u&&(u.set="add"),O=false,i(this,St)&&((tt=i(this,ht))==null||tt.call(this,e,t,"add"));else {h(this,o,At).call(this,b);let y=i(this,p)[b];if(e!==y){if(i(this,nt)&&h(this,o,S).call(this,y)){y.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:m}=y;m!==void 0&&!n&&(i(this,J)&&((V=i(this,K))==null||V.call(this,m,t,"set")),i(this,D)&&i(this,C)?.push([m,t,"set"]));}else n||(i(this,J)&&((Z=i(this,K))==null||Z.call(this,y,t,"set")),i(this,D)&&i(this,C)?.push([y,t,"set"]));if(i(this,ft).call(this,b),i(this,Et).call(this,b,Q,u),i(this,p)[b]=e,u){u.set="replace";let m=y&&h(this,o,S).call(this,y)?y.__staleWhileFetching:y;m!==void 0&&(u.oldValue=m);}}else u&&(u.set="update");i(this,St)&&this.onInsert?.(e,t,e===y?"update":"replace");}if(r!==0&&!i(this,L)&&h(this,o,Vt).call(this),i(this,L)&&(O||i(this,Ot).call(this,b,r,a),u&&i(this,k).call(this,u,b)),!n&&i(this,D)&&i(this,C)){let y=i(this,C),m;for(;m=y?.shift();)(T=i(this,j))==null||T.call(this,...m);}return this}pop(){var t;try{for(;i(this,R);){let e=i(this,p)[i(this,I)];if(h(this,o,Ft).call(this,!0),h(this,o,S).call(this,e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(i(this,D)&&i(this,C)){let e=i(this,C),s;for(;s=e?.shift();)(t=i(this,j))==null||t.call(this,...s);}}}has(t,e={}){let{updateAgeOnHas:s=this.updateAgeOnHas,status:r}=e,a=i(this,w).get(t);if(a!==void 0){let n=i(this,p)[a];if(h(this,o,S).call(this,n)&&n.__staleWhileFetching===void 0)return false;if(i(this,N).call(this,a))r&&(r.has="stale",i(this,k).call(this,r,a));else return s&&i(this,lt).call(this,a),r&&(r.has="hit",i(this,k).call(this,r,a)),true}else r&&(r.has="miss");return false}peek(t,e={}){let{allowStale:s=this.allowStale}=e,r=i(this,w).get(t);if(r===void 0||!s&&i(this,N).call(this,r))return;let a=i(this,p)[r];return h(this,o,S).call(this,a)?a.__staleWhileFetching:a}async fetch(t,e={}){let{allowStale:s=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:a=this.noDeleteOnStaleGet,ttl:n=this.ttl,noDisposeOnSet:c=this.noDisposeOnSet,size:u=0,sizeCalculation:O=this.sizeCalculation,noUpdateTTL:Q=this.noUpdateTTL,noDeleteOnFetchRejection:b=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:tt=this.allowStaleOnFetchRejection,ignoreFetchAbort:V=this.ignoreFetchAbort,allowStaleOnFetchAbort:Z=this.allowStaleOnFetchAbort,context:T,forceRefresh:y=false,status:m,signal:z}=e;if(!i(this,nt))return m&&(m.fetch="get"),this.get(t,{allowStale:s,updateAgeOnGet:r,noDeleteOnStaleGet:a,status:m});let M={allowStale:s,updateAgeOnGet:r,noDeleteOnStaleGet:a,ttl:n,noDisposeOnSet:c,size:u,sizeCalculation:O,noUpdateTTL:Q,noDeleteOnFetchRejection:b,allowStaleOnFetchRejection:tt,allowStaleOnFetchAbort:Z,ignoreFetchAbort:V,status:m,signal:z},v=i(this,w).get(t);if(v===void 0){m&&(m.fetch="miss");let U=h(this,o,Dt).call(this,t,v,M,T);return U.__returned=U}else {let U=i(this,p)[v];if(h(this,o,S).call(this,U)){let dt=s&&U.__staleWhileFetching!==void 0;return m&&(m.fetch="inflight",dt&&(m.returnedStale=true)),dt?U.__staleWhileFetching:U.__returned=U}let wt=i(this,N).call(this,v);if(!y&&!wt)return m&&(m.fetch="hit"),h(this,o,At).call(this,v),r&&i(this,lt).call(this,v),m&&i(this,k).call(this,m,v),U;let ct=h(this,o,Dt).call(this,t,v,M,T),ut=ct.__staleWhileFetching!==void 0&&s;return m&&(m.fetch=wt?"stale":"refresh",ut&&wt&&(m.returnedStale=true)),ut?ct.__staleWhileFetching:ct.__returned=ct}}async forceFetch(t,e={}){let s=await this.fetch(t,e);if(s===void 0)throw new Error("fetch() returned undefined");return s}memo(t,e={}){let s=i(this,_t);if(!s)throw new Error("no memoMethod provided to constructor");let{context:r,forceRefresh:a,...n}=e,c=this.get(t,n);if(!a&&c!==void 0)return c;let u=s(t,c,{options:n,context:r});return this.set(t,u,n),u}get(t,e={}){let{allowStale:s=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:a=this.noDeleteOnStaleGet,status:n}=e,c=i(this,w).get(t);if(c!==void 0){let u=i(this,p)[c],O=h(this,o,S).call(this,u);return n&&i(this,k).call(this,n,c),i(this,N).call(this,c)?(n&&(n.get="stale"),O?(n&&s&&u.__staleWhileFetching!==void 0&&(n.returnedStale=true),s?u.__staleWhileFetching:void 0):(a||h(this,o,rt).call(this,t,"expire"),n&&s&&(n.returnedStale=true),s?u:void 0)):(n&&(n.get="hit"),O?u.__staleWhileFetching:(h(this,o,At).call(this,c),r&&i(this,lt).call(this,c),u))}else n&&(n.get="miss");}delete(t){return h(this,o,rt).call(this,t,"delete")}clear(){return h(this,o,Yt).call(this,"delete")}};Y=new WeakMap,P=new WeakMap,K=new WeakMap,ht=new WeakMap,j=new WeakMap,mt=new WeakMap,_t=new WeakMap,H=new WeakMap,R=new WeakMap,$=new WeakMap,w=new WeakMap,E=new WeakMap,p=new WeakMap,F=new WeakMap,G=new WeakMap,I=new WeakMap,x=new WeakMap,B=new WeakMap,C=new WeakMap,X=new WeakMap,q=new WeakMap,L=new WeakMap,J=new WeakMap,nt=new WeakMap,D=new WeakMap,St=new WeakMap,o=new WeakSet,Vt=function(){let t=new gt(i(this,Y)),e=new gt(i(this,Y));f(this,L,t),f(this,q,e),f(this,Ot,(a,n,c=i(this,H).now())=>{if(e[a]=n!==0?c:0,t[a]=n,n!==0&&this.ttlAutopurge){let u=setTimeout(()=>{i(this,N).call(this,a)&&h(this,o,rt).call(this,i(this,E)[a],"expire");},n+1);u.unref&&u.unref();}}),f(this,lt,a=>{e[a]=t[a]!==0?i(this,H).now():0;}),f(this,k,(a,n)=>{if(t[n]){let c=t[n],u=e[n];if(!c||!u)return;a.ttl=c,a.start=u,a.now=s||r();let O=a.now-u;a.remainingTTL=c-O;}});let s=0,r=()=>{let a=i(this,H).now();if(this.ttlResolution>0){s=a;let n=setTimeout(()=>s=0,this.ttlResolution);n.unref&&n.unref();}return a};this.getRemainingTTL=a=>{let n=i(this,w).get(a);if(n===void 0)return 0;let c=t[n],u=e[n];if(!c||!u)return 1/0;let O=(s||r())-u;return c-O},f(this,N,a=>{let n=e[a],c=t[a];return !!c&&!!n&&(s||r())-n>c});},lt=new WeakMap,k=new WeakMap,Ot=new WeakMap,N=new WeakMap,kt=function(){let t=new gt(i(this,Y));f(this,$,0),f(this,X,t),f(this,ft,e=>{f(this,$,i(this,$)-t[e]),t[e]=0;}),f(this,Rt,(e,s,r,a)=>{if(h(this,o,S).call(this,s))return 0;if(!et(r))if(a){if(typeof a!="function")throw new TypeError("sizeCalculation must be a function");if(r=a(s,e),!et(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}),f(this,Et,(e,s,r)=>{if(t[e]=s,i(this,P)){let a=i(this,P)-t[e];for(;i(this,$)>a;)h(this,o,Ft).call(this,true);}f(this,$,i(this,$)+t[e]),r&&(r.entrySize=s,r.totalCalculatedSize=i(this,$));});},ft=new WeakMap,Et=new WeakMap,Rt=new WeakMap,it=function*({allowStale:t=this.allowStale}={}){if(i(this,R))for(let e=i(this,x);!(!h(this,o,Ut).call(this,e)||((t||!i(this,N).call(this,e))&&(yield e),e===i(this,I)));)e=i(this,G)[e];},st=function*({allowStale:t=this.allowStale}={}){if(i(this,R))for(let e=i(this,I);!(!h(this,o,Ut).call(this,e)||((t||!i(this,N).call(this,e))&&(yield e),e===i(this,x)));)e=i(this,F)[e];},Ut=function(t){return t!==void 0&&i(this,w).get(i(this,E)[t])===t},Ft=function(t){var a;let e=i(this,I),s=i(this,E)[e],r=i(this,p)[e];return i(this,nt)&&h(this,o,S).call(this,r)?r.__abortController.abort(new Error("evicted")):(i(this,J)||i(this,D))&&(i(this,J)&&((a=i(this,K))==null||a.call(this,r,s,"evict")),i(this,D)&&i(this,C)?.push([r,s,"evict"])),i(this,ft).call(this,e),t&&(i(this,E)[e]=void 0,i(this,p)[e]=void 0,i(this,B).push(e)),i(this,R)===1?(f(this,I,f(this,x,0)),i(this,B).length=0):f(this,I,i(this,F)[e]),i(this,w).delete(s),vt(this,R)._--,e},Dt=function(t,e,s,r){let a=e===void 0?void 0:i(this,p)[e];if(h(this,o,S).call(this,a))return a;let n=new zt,{signal:c}=s;c?.addEventListener("abort",()=>n.abort(c.reason),{signal:n.signal});let u={signal:n.signal,options:s,context:r},O=(T,y=false)=>{let{aborted:m}=n.signal,z=s.ignoreFetchAbort&&T!==void 0;if(s.status&&(m&&!y?(s.status.fetchAborted=true,s.status.fetchError=n.signal.reason,z&&(s.status.fetchAbortIgnored=true)):s.status.fetchResolved=true),m&&!z&&!y)return b(n.signal.reason);let M=V;return i(this,p)[e]===V&&(T===void 0?M.__staleWhileFetching!==void 0?i(this,p)[e]=M.__staleWhileFetching:h(this,o,rt).call(this,t,"fetch"):(s.status&&(s.status.fetchUpdated=true),this.set(t,T,u.options))),T},Q=T=>(s.status&&(s.status.fetchRejected=true,s.status.fetchError=T),b(T)),b=T=>{let{aborted:y}=n.signal,m=y&&s.allowStaleOnFetchAbort,z=m||s.allowStaleOnFetchRejection,M=z||s.noDeleteOnFetchRejection,v=V;if(i(this,p)[e]===V&&(!M||v.__staleWhileFetching===void 0?h(this,o,rt).call(this,t,"fetch"):m||(i(this,p)[e]=v.__staleWhileFetching)),z)return s.status&&v.__staleWhileFetching!==void 0&&(s.status.returnedStale=true),v.__staleWhileFetching;if(v.__returned===v)throw T},tt=(T,y)=>{var z;let m=(z=i(this,mt))==null?void 0:z.call(this,t,a,u);m&&m instanceof Promise&&m.then(M=>T(M===void 0?void 0:M),y),n.signal.addEventListener("abort",()=>{(!s.ignoreFetchAbort||s.allowStaleOnFetchAbort)&&(T(void 0),s.allowStaleOnFetchAbort&&(T=M=>O(M,true)));});};s.status&&(s.status.fetchDispatched=true);let V=new Promise(tt).then(O,Q),Z=Object.assign(V,{__abortController:n,__staleWhileFetching:a,__returned:void 0});return e===void 0?(this.set(t,Z,{...u.options,status:void 0}),e=i(this,w).get(t)):i(this,p)[e]=Z,Z},S=function(t){if(!i(this,nt))return false;let e=t;return !!e&&e instanceof Promise&&e.hasOwnProperty("__staleWhileFetching")&&e.__abortController instanceof zt},Wt=function(t,e){i(this,G)[e]=t,i(this,F)[t]=e;},At=function(t){t!==i(this,x)&&(t===i(this,I)?f(this,I,i(this,F)[t]):h(this,o,Wt).call(this,i(this,G)[t],i(this,F)[t]),h(this,o,Wt).call(this,i(this,x),t),f(this,x,t));},rt=function(t,e){var r,a;let s=false;if(i(this,R)!==0){let n=i(this,w).get(t);if(n!==void 0)if(s=true,i(this,R)===1)h(this,o,Yt).call(this,e);else {i(this,ft).call(this,n);let c=i(this,p)[n];if(h(this,o,S).call(this,c)?c.__abortController.abort(new Error("deleted")):(i(this,J)||i(this,D))&&(i(this,J)&&((r=i(this,K))==null||r.call(this,c,t,e)),i(this,D)&&i(this,C)?.push([c,t,e])),i(this,w).delete(t),i(this,E)[n]=void 0,i(this,p)[n]=void 0,n===i(this,x))f(this,x,i(this,G)[n]);else if(n===i(this,I))f(this,I,i(this,F)[n]);else {let u=i(this,G)[n];i(this,F)[u]=i(this,F)[n];let O=i(this,F)[n];i(this,G)[O]=i(this,G)[n];}vt(this,R)._--,i(this,B).push(n);}}if(i(this,D)&&i(this,C)?.length){let n=i(this,C),c;for(;c=n?.shift();)(a=i(this,j))==null||a.call(this,...c);}return s},Yt=function(t){var e,s;for(let r of h(this,o,st).call(this,{allowStale:true})){let a=i(this,p)[r];if(h(this,o,S).call(this,a))a.__abortController.abort(new Error("deleted"));else {let n=i(this,E)[r];i(this,J)&&((e=i(this,K))==null||e.call(this,a,n,t)),i(this,D)&&i(this,C)?.push([a,n,t]);}}if(i(this,w).clear(),i(this,p).fill(void 0),i(this,E).fill(void 0),i(this,L)&&i(this,q)&&(i(this,L).fill(0),i(this,q).fill(0)),i(this,X)&&i(this,X).fill(0),f(this,I,0),f(this,x,0),i(this,B).length=0,f(this,$,0),f(this,R,0),i(this,D)&&i(this,C)){let r=i(this,C),a;for(;a=r?.shift();)(s=i(this,j))==null||s.call(this,...a);}};var Mt=Kt;var at=class{constructor(t){g(this,"cache");g(this,"map",new Map);this.cache=new Mt({max:t.cacheSize}),this.map=new Map;}get[Symbol.iterator](){return this.map[Symbol.iterator]}get[Symbol.toStringTag](){return this.map[Symbol.toStringTag]}clear(){return this.cache.clear(),this.map.clear()}delete(t){let e=this.map.delete(t);return e&&this.cache.delete(t),e}get forEach(){return this.map.forEach}get(t){let e=this.cache.get(t);return e||this.map.get(t)}has(t){return this.map.has(t)}set(t,e){return this.map.set(t,e),this.cache.set(t,e),this}get size(){return this.map.size}entries(){return this.map.entries()}keys(){return this.map.keys()}values(){return this.map.values()}};var A=class A{constructor(){}static clearOldTempVariables(t){A.tempStorageDeadlines.forEach((e,s)=>{e>t&&(A.tempStorage.delete(s),A.tempStorageDeadlines.delete(s),A.storage.cache.delete(s));});}static setVariable(t,e){let s=A.tempStorage.has(t);e==null?(A.storage.map.delete(t),!s&&A.storage.cache.delete(t)):(A.storage.map.set(t,e),!s&&A.storage.cache.set(t,e));}static getVariable(t){let e=A.storage.cache.get(t);return e===void 0&&(e=A.tempStorage.get(t)),e===void 0&&(e=A.storage.map.get(t)),It(e)}static removeVariable(t){A.storage.delete(t);}static setFlag(t,e){if(e)this.flags.includes(t)||this.flags.push(t);else {let s=this.flags.indexOf(t);s>-1&&this.flags.splice(s,1);}}static getFlag(t){return this.flags.includes(t)}};g(A,"storage",new at({cacheSize:20})),g(A,"startingStorage",[]),g(A,"flags",Array()),g(A,"tempStorage",new Map),g(A,"tempStorageDeadlines",new Map);var d=A;var bt=class{constructor(t,e){g(this,"id");g(this,"categoryId");this.categoryId=t,this.id=e;}setStorageProperty(t,e){let s=d.getVariable(this.categoryId);s||(s={}),s.hasOwnProperty(this.id)||(s[this.id]={}),e==null?s[this.id].hasOwnProperty(t)&&delete s[this.id][t]:s[this.id]={...s[this.id],[t]:e},Object.keys(s[this.id]).length===0&&delete s[this.id],d.setVariable(this.categoryId,s);}getStorageProperty(t,e=this.id){let s=d.getVariable(this.categoryId);if(s&&s.hasOwnProperty(e)&&s[e].hasOwnProperty(t))return s[e][t]}};var jt={CHARACTER_CATEGORY_KEY:"___character___"};var ne="@",yt=class extends bt{constructor(e,s=""){super(jt.CHARACTER_CATEGORY_KEY,e+(s?ne+s:""));g(this,"sourceId");this.sourceId=e;}getStorageProperty(e){let s=super.getStorageProperty(e);return s===void 0&&(s=super.getStorageProperty(e,this.sourceId)),s}};var Pt=class extends yt{constructor(e,s){super(typeof e=="string"?e:e.id,typeof e=="string"?"":e.emotion);g(this,"defaultName");g(this,"defaultSurname");g(this,"defaultAge");g(this,"_icon");g(this,"_color");this.defaultName=s.name,this.defaultSurname=s.surname,this.defaultAge=s.age,this._icon=s.icon,this._color=s.color;}get name(){return this.getStorageProperty("name")||this.defaultName||this.id}set name(e){this.setStorageProperty("name",e);}get surname(){return this.getStorageProperty("surname")||this.defaultSurname}set surname(e){this.setStorageProperty("surname",e);}get age(){return this.getStorageProperty("age")||this.defaultAge}set age(e){this.setStorageProperty("age",e);}get icon(){return this._icon}get color(){return this._color}};var Tt=new at({cacheSize:10}),Ht;(a=>{function l(n){try{let c=Tt.get(n);if(!c){W.warn(`Character "${n}" not found, did you forget to register it with the RegisteredCharacters.add?`);return}return c}catch(c){W.error(`Error while getting Character "${n}"`,c);return}}a.get=l;function t(n){if(Array.isArray(n)){n.forEach(c=>t(c));return}Tt.get(n.id)&&W.info(`Character id "${n.id}" already exists, it will be overwritten`),Tt.set(n.id,n);}a.add=t;function e(){return Array.from(Tt.values())}a.values=e;function s(n){return Tt.has(n)}a.has=s;function r(){return Array.from(Tt.keys())}a.keys=r;})(Ht||(Ht={}));var ae=Ht;exports.CharacterBaseModel=Pt;exports.CharacterStoredClass=yt;exports.RegisteredCharacters=ae;
|
package/dist/characters.d.cts
CHANGED
package/dist/characters.d.ts
CHANGED
package/dist/characters.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import {b}from'./chunk-
|
|
1
|
+
import {b}from'./chunk-CSAIUPQQ.mjs';import {a as a$1}from'./chunk-6GO4XVS7.mjs';import {a}from'./chunk-RXNJBYVP.mjs';import {j,d}from'./chunk-GNJIUFU2.mjs';var l="@",s=class extends b{constructor(e,r=""){super(a$1.CHARACTER_CATEGORY_KEY,e+(r?l+r:""));d(this,"sourceId");this.sourceId=e;}getStorageProperty(e){let r=super.getStorageProperty(e);return r===void 0&&(r=super.getStorageProperty(e,this.sourceId)),r}};var u=class extends s{constructor(e,r){super(typeof e=="string"?e:e.id,typeof e=="string"?"":e.emotion);d(this,"defaultName");d(this,"defaultSurname");d(this,"defaultAge");d(this,"_icon");d(this,"_color");this.defaultName=r.name,this.defaultSurname=r.surname,this.defaultAge=r.age,this._icon=r.icon,this._color=r.color;}get name(){return this.getStorageProperty("name")||this.defaultName||this.id}set name(e){this.setStorageProperty("name",e);}get surname(){return this.getStorageProperty("surname")||this.defaultSurname}set surname(e){this.setStorageProperty("surname",e);}get age(){return this.getStorageProperty("age")||this.defaultAge}set age(e){this.setStorageProperty("age",e);}get icon(){return this._icon}get color(){return this._color}};var i=new a({cacheSize:10}),f;(S=>{function d(t){try{let a=i.get(t);if(!a){j.warn(`Character "${t}" not found, did you forget to register it with the RegisteredCharacters.add?`);return}return a}catch(a){j.error(`Error while getting Character "${t}"`,a);return}}S.get=d;function g(t){if(Array.isArray(t)){t.forEach(a=>g(a));return}i.get(t.id)&&j.info(`Character id "${t.id}" already exists, it will be overwritten`),i.set(t.id,t);}S.add=g;function e(){return Array.from(i.values())}S.values=e;function r(t){return i.has(t)}S.has=r;function C(){return Array.from(i.keys())}S.keys=C;})(f||(f={}));var p=f;export{u as CharacterBaseModel,s as CharacterStoredClass,p as RegisteredCharacters};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {a}from'./chunk-RXNJBYVP.mjs';import {d,k,j}from'./chunk-GNJIUFU2.mjs';import {GameUnifier}from'@drincs/pixi-vn/unifier';var o=class o{constructor(){}static clearOldTempVariables(e){o.tempStorageDeadlines.forEach((t,a)=>{t>e&&(o.tempStorage.delete(a),o.tempStorageDeadlines.delete(a),o.storage.cache.delete(a));});}static setVariable(e,t){let a=o.tempStorage.has(e);t==null?(o.storage.map.delete(e),!a&&o.storage.cache.delete(e)):(o.storage.map.set(e,t),!a&&o.storage.cache.set(e,t));}static getVariable(e){let t=o.storage.cache.get(e);return t===void 0&&(t=o.tempStorage.get(e)),t===void 0&&(t=o.storage.map.get(e)),k(t)}static removeVariable(e){o.storage.delete(e);}static setFlag(e,t){if(t)this.flags.includes(e)||this.flags.push(e);else {let a=this.flags.indexOf(e);a>-1&&this.flags.splice(a,1);}}static getFlag(e){return this.flags.includes(e)}};d(o,"storage",new a({cacheSize:20})),d(o,"startingStorage",[]),d(o,"flags",Array()),d(o,"tempStorage",new Map),d(o,"tempStorageDeadlines",new Map);var r=o;var n=class{get storage(){return r.storage.map}get cache(){return r.storage.cache}get flags(){return r.flags}get tempStorage(){return r.tempStorage}get tempStorageDeadlines(){return r.tempStorageDeadlines}set startingStorage(e){let t=GameUnifier.stepCounter===0;Object.entries(e).forEach(([a,s])=>{r.startingStorage.push({key:a,value:s}),t&&r.storage.set(a,s);});}set(e,t){return r.setVariable(e,t)}setVariable(e,t){return this.set(e,t)}get(e){return r.getVariable(e)}getVariable(e){return this.get(e)}removeVariable(e){return r.removeVariable(e)}setTempVariable(e,t){if(t==null){this.removeTempVariable(e);return}else r.tempStorage.set(e,t),r.storage.cache.set(e,t),r.tempStorageDeadlines.has(e)||r.tempStorageDeadlines.set(e,GameUnifier.openedLabels);}removeTempVariable(e){r.tempStorage.has(e)&&(r.tempStorage.delete(e),r.tempStorageDeadlines.delete(e),r.storage.cache.delete(e));}setFlag(e,t){return r.setFlag(e,t)}getFlag(e){return r.getFlag(e)}clear(){this.storage.clear(),this.cache.clear(),r.flags=[],r.tempStorage.clear(),r.tempStorageDeadlines.clear(),r.startingStorage.forEach(({key:e,value:t})=>{this.storage.set(e,t);});}export(){let e=[];[...this.storage.keys()].forEach(s=>{e.push({key:s,value:this.storage.get(s)});});let t=[];[...r.tempStorage.keys()].forEach(s=>{t.push({key:s,value:r.tempStorage.get(s)});});let a=[];return [...r.tempStorageDeadlines.keys()].forEach(s=>{a.push({key:s,value:r.tempStorageDeadlines.get(s)});}),k({base:e,temp:t,tempDeadlines:a,flags:r.flags})}restore(e){this.clear();try{e?(Array.isArray(e)&&e.forEach(t=>{if(t.key==="___temp_storage___"){let a=t.value;Object.entries(a).forEach(([s,g])=>{r.tempStorage.set(s,g);});}else if(t.key==="___temp_storage_deadlines___"){let a=t.value;Object.entries(a).forEach(([s,g])=>{r.tempStorageDeadlines.set(s,g);});}else t.key==="___flags___"?t.value.forEach(s=>{r.flags.push(s);}):this.storage.set(t.key,t.value);}),"base"in e&&"temp"in e&&"tempDeadlines"in e?(e.base?.forEach(t=>{this.storage.set(t.key,t.value);}),e.temp?.forEach(t=>{r.tempStorage.set(t.key,t.value);}),e.tempDeadlines?.forEach(t=>{r.tempStorageDeadlines.set(t.key,t.value);})):Object.entries(e).forEach(([t,a])=>{t==="___temp_storage___"?Object.entries(a).forEach(([s,g])=>{r.tempStorage.set(s,g);}):t==="___temp_storage_deadlines___"?Object.entries(a).forEach(([s,g])=>{r.tempStorageDeadlines.set(s,g);}):t==="___flags___"?a.forEach(s=>{r.flags.push(s);}):this.storage.set(t,a);})):j.warn("No storage data found");}catch(t){j.error("Error importing data",t);}}};var
|
|
1
|
+
import {a}from'./chunk-RXNJBYVP.mjs';import {d,k,j}from'./chunk-GNJIUFU2.mjs';import {GameUnifier}from'@drincs/pixi-vn/unifier';var o=class o{constructor(){}static clearOldTempVariables(e){o.tempStorageDeadlines.forEach((t,a)=>{t>e&&(o.tempStorage.delete(a),o.tempStorageDeadlines.delete(a),o.storage.cache.delete(a));});}static setVariable(e,t){let a=o.tempStorage.has(e);t==null?(o.storage.map.delete(e),!a&&o.storage.cache.delete(e)):(o.storage.map.set(e,t),!a&&o.storage.cache.set(e,t));}static getVariable(e){let t=o.storage.cache.get(e);return t===void 0&&(t=o.tempStorage.get(e)),t===void 0&&(t=o.storage.map.get(e)),k(t)}static removeVariable(e){o.storage.delete(e);}static setFlag(e,t){if(t)this.flags.includes(e)||this.flags.push(e);else {let a=this.flags.indexOf(e);a>-1&&this.flags.splice(a,1);}}static getFlag(e){return this.flags.includes(e)}};d(o,"storage",new a({cacheSize:20})),d(o,"startingStorage",[]),d(o,"flags",Array()),d(o,"tempStorage",new Map),d(o,"tempStorageDeadlines",new Map);var r=o;var n=class{get storage(){return r.storage.map}get cache(){return r.storage.cache}get flags(){return r.flags}get tempStorage(){return r.tempStorage}get tempStorageDeadlines(){return r.tempStorageDeadlines}set startingStorage(e){let t=GameUnifier.stepCounter===0;Object.entries(e).forEach(([a,s])=>{r.startingStorage.push({key:a,value:s}),t&&r.storage.set(a,s);});}set(e,t){return r.setVariable(e,t)}setVariable(e,t){return this.set(e,t)}get(e){return r.getVariable(e)}getVariable(e){return this.get(e)}removeVariable(e){return r.removeVariable(e)}setTempVariable(e,t){if(t==null){this.removeTempVariable(e);return}else r.tempStorage.set(e,t),r.storage.cache.set(e,t),r.tempStorageDeadlines.has(e)||r.tempStorageDeadlines.set(e,GameUnifier.openedLabels);}removeTempVariable(e){r.tempStorage.has(e)&&(r.tempStorage.delete(e),r.tempStorageDeadlines.delete(e),r.storage.cache.delete(e));}setFlag(e,t){return r.setFlag(e,t)}getFlag(e){return r.getFlag(e)}clear(){this.storage.clear(),this.cache.clear(),r.flags=[],r.tempStorage.clear(),r.tempStorageDeadlines.clear(),r.startingStorage.forEach(({key:e,value:t})=>{this.storage.set(e,t);});}export(){let e=[];[...this.storage.keys()].forEach(s=>{e.push({key:s,value:this.storage.get(s)});});let t=[];[...r.tempStorage.keys()].forEach(s=>{t.push({key:s,value:r.tempStorage.get(s)});});let a=[];return [...r.tempStorageDeadlines.keys()].forEach(s=>{a.push({key:s,value:r.tempStorageDeadlines.get(s)});}),k({base:e,temp:t,tempDeadlines:a,flags:r.flags})}restore(e){this.clear();try{e?(Array.isArray(e)&&e.forEach(t=>{if(t.key==="___temp_storage___"){let a=t.value;Object.entries(a).forEach(([s,g])=>{r.tempStorage.set(s,g);});}else if(t.key==="___temp_storage_deadlines___"){let a=t.value;Object.entries(a).forEach(([s,g])=>{r.tempStorageDeadlines.set(s,g);});}else t.key==="___flags___"?t.value.forEach(s=>{r.flags.push(s);}):this.storage.set(t.key,t.value);}),"base"in e&&"temp"in e&&"tempDeadlines"in e?(e.base?.forEach(t=>{this.storage.set(t.key,t.value);}),e.temp?.forEach(t=>{r.tempStorage.set(t.key,t.value);}),e.tempDeadlines?.forEach(t=>{r.tempStorageDeadlines.set(t.key,t.value);})):Object.entries(e).forEach(([t,a])=>{t==="___temp_storage___"?Object.entries(a).forEach(([s,g])=>{r.tempStorage.set(s,g);}):t==="___temp_storage_deadlines___"?Object.entries(a).forEach(([s,g])=>{r.tempStorageDeadlines.set(s,g);}):t==="___flags___"?a.forEach(s=>{r.flags.push(s);}):this.storage.set(t,a);})):j.warn("No storage data found");}catch(t){j.error("Error importing data",t);}}};var m=class{constructor(e,t){d(this,"id");d(this,"categoryId");this.categoryId=e,this.id=t;}setStorageProperty(e,t){let a=r.getVariable(this.categoryId);a||(a={}),a.hasOwnProperty(this.id)||(a[this.id]={}),t==null?a[this.id].hasOwnProperty(e)&&delete a[this.id][e]:a[this.id]={...a[this.id],[e]:t},Object.keys(a[this.id]).length===0&&delete a[this.id],r.setVariable(this.categoryId,a);}getStorageProperty(e,t=this.id){let a=r.getVariable(this.categoryId);if(a&&a.hasOwnProperty(t)&&a[t].hasOwnProperty(e))return a[t][e]}};var v=new n;export{r as a,m as b,v as c};
|
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
'use strict';Object.defineProperty(exports,'__esModule',{value:true});var I=require('@drincs/pixi-vn/canvas'),Bt=require('@drincs/pixi-vn/characters'),tt=require('@drincs/pixi-vn/history'),D=require('@drincs/pixi-vn/narration'),pixi_js=require('@drincs/pixi-vn/pixi.js'),at=require('@drincs/pixi-vn/sound'),N=require('@drincs/pixi-vn/storage'),unifier=require('@drincs/pixi-vn/unifier');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 I__namespace=/*#__PURE__*/_interopNamespace(I);var Bt__namespace=/*#__PURE__*/_interopNamespace(Bt);var tt__namespace=/*#__PURE__*/_interopNamespace(tt);var D__namespace=/*#__PURE__*/_interopNamespace(D);var at__namespace=/*#__PURE__*/_interopNamespace(at);var N__namespace=/*#__PURE__*/_interopNamespace(N);var Xt=Object.defineProperty;var Jt=l=>{throw TypeError(l)};var he=(l,e,i)=>e in l?Xt(l,e,{enumerable:true,configurable:true,writable:true,value:i}):l[e]=i;var le=(l,e)=>{for(var i in e)Xt(l,i,{get:e[i],enumerable:true});};var S=(l,e,i)=>he(l,typeof e!="symbol"?e+"":e,i),zt=(l,e,i)=>e.has(l)||Jt("Cannot "+i);var t=(l,e,i)=>(zt(l,e,"read from private field"),i?i.call(l):e.get(l)),v=(l,e,i)=>e.has(l)?Jt("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),h=(l,e,i)=>(zt(l,e,"access private method"),i);var Ot=(l,e,i,s)=>({set _(o){f(l,e,o);},get _(){return t(l,e,s)}});var ce=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,ee=new Set,Lt=typeof process=="object"&&process?process:{},ie=(l,e,i,s)=>{typeof Lt.emitWarning=="function"?Lt.emitWarning(l,e,i,s):console.error(`[${i}] ${e}: ${l}`);},jt=globalThis.AbortController,Qt=globalThis.AbortSignal;if(typeof jt>"u"){Qt=class{constructor(){S(this,"onabort");S(this,"_onabort",[]);S(this,"reason");S(this,"aborted",false);}addEventListener(s,o){this._onabort.push(o);}},jt=class{constructor(){S(this,"signal",new Qt);e();}abort(s){if(!this.signal.aborted){this.signal.reason=s,this.signal.aborted=true;for(let o of this.signal._onabort)o(s);this.signal.onabort?.(s);}}};let l=Lt.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{l&&(l=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 fe=l=>!ee.has(l),it=l=>l&&l===Math.floor(l)&&l>0&&isFinite(l),se=l=>it(l)?l<=Math.pow(2,8)?Uint8Array:l<=Math.pow(2,16)?Uint16Array:l<=Math.pow(2,32)?Uint32Array:l<=Number.MAX_SAFE_INTEGER?mt:null:null,mt=class extends Array{constructor(e){super(e),this.fill(0);}},gt,ht=class ht{constructor(e,i){S(this,"heap");S(this,"length");if(!t(ht,gt))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new i(e),this.length=0;}static create(e){let i=se(e);if(!i)return [];f(ht,gt,true);let s=new ht(e,i);return f(ht,gt,false),s}push(e){this.heap[this.length++]=e;}pop(){return this.heap[--this.length]}};gt=new WeakMap,v(ht,gt,false);var Pt=ht,Zt,te,q,M,K,lt,$,vt,_t,Y,E,B,A,w,m,F,V,j,T,X,U,J,Q,G,Z,ot,R,yt,a,Nt,ct,et,At,W,ne,ft,St,Et,st,nt,Mt,Ct,Dt,b,Vt,xt,rt,Gt,Wt=class Wt{constructor(e){v(this,a);v(this,q);v(this,M);v(this,K);v(this,lt);v(this,$);v(this,vt);v(this,_t);v(this,Y);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");v(this,E);v(this,B);v(this,A);v(this,w);v(this,m);v(this,F);v(this,V);v(this,j);v(this,T);v(this,X);v(this,U);v(this,J);v(this,Q);v(this,G);v(this,Z);v(this,ot);v(this,R);v(this,yt);v(this,ct,()=>{});v(this,et,()=>{});v(this,At,()=>{});v(this,W,()=>false);v(this,ft,e=>{});v(this,St,(e,i,s)=>{});v(this,Et,(e,i,s,o)=>{if(s||o)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});S(this,Zt,"LRUCache");let{max:i=0,ttl:s,ttlResolution:o=1,ttlAutopurge:n,updateAgeOnGet:r,updateAgeOnHas:u,allowStale:d,dispose:x,onInsert:k,disposeAfter:c,noDisposeOnSet:z,noUpdateTTL:O,maxSize:p=0,maxEntrySize:_=0,sizeCalculation:y,fetchMethod:g,memoMethod:L,noDeleteOnFetchRejection:P,noDeleteOnStaleGet:C,allowStaleOnFetchRejection:H,allowStaleOnFetchAbort:wt,ignoreFetchAbort:dt,perf:Ut}=e;if(Ut!==void 0&&typeof Ut?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(f(this,Y,Ut??ce),i!==0&&!it(i))throw new TypeError("max option must be a nonnegative integer");let ut=i?se(i):Array;if(!ut)throw new Error("invalid max value: "+i);if(f(this,q,i),f(this,M,p),this.maxEntrySize=_||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(L!==void 0&&typeof L!="function")throw new TypeError("memoMethod must be a function if defined");if(f(this,_t,L),g!==void 0&&typeof g!="function")throw new TypeError("fetchMethod must be a function if specified");if(f(this,vt,g),f(this,ot,!!g),f(this,A,new Map),f(this,w,new Array(i).fill(void 0)),f(this,m,new Array(i).fill(void 0)),f(this,F,new ut(i)),f(this,V,new ut(i)),f(this,j,0),f(this,T,0),f(this,X,Pt.create(i)),f(this,E,0),f(this,B,0),typeof x=="function"&&f(this,K,x),typeof k=="function"&&f(this,lt,k),typeof c=="function"?(f(this,$,c),f(this,U,[])):(f(this,$,void 0),f(this,U,void 0)),f(this,Z,!!t(this,K)),f(this,yt,!!t(this,lt)),f(this,R,!!t(this,$)),this.noDisposeOnSet=!!z,this.noUpdateTTL=!!O,this.noDeleteOnFetchRejection=!!P,this.allowStaleOnFetchRejection=!!H,this.allowStaleOnFetchAbort=!!wt,this.ignoreFetchAbort=!!dt,this.maxEntrySize!==0){if(t(this,M)!==0&&!it(t(this,M)))throw new TypeError("maxSize must be a positive integer if specified");if(!it(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");h(this,a,ne).call(this);}if(this.allowStale=!!d,this.noDeleteOnStaleGet=!!C,this.updateAgeOnGet=!!r,this.updateAgeOnHas=!!u,this.ttlResolution=it(o)||o===0?o:1,this.ttlAutopurge=!!n,this.ttl=s||0,this.ttl){if(!it(this.ttl))throw new TypeError("ttl must be a positive integer if specified");h(this,a,Nt).call(this);}if(t(this,q)===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,q)&&!t(this,M)){let pt="LRU_CACHE_UNBOUNDED";fe(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,Y)}static unsafeExposeInternals(e){return {starts:t(e,Q),ttls:t(e,G),sizes:t(e,J),keyMap:t(e,A),keyList:t(e,w),valList:t(e,m),next:t(e,F),prev:t(e,V),get head(){return t(e,j)},get tail(){return t(e,T)},free:t(e,X),isBackgroundFetch:i=>{var s;return h(s=e,a,b).call(s,i)},backgroundFetch:(i,s,o,n)=>{var r;return h(r=e,a,Dt).call(r,i,s,o,n)},moveToTail:i=>{var s;return h(s=e,a,xt).call(s,i)},indexes:i=>{var s;return h(s=e,a,st).call(s,i)},rindexes:i=>{var s;return h(s=e,a,nt).call(s,i)},isStale:i=>{var s;return t(s=e,W).call(s,i)}}}get max(){return t(this,q)}get maxSize(){return t(this,M)}get calculatedSize(){return t(this,B)}get size(){return t(this,E)}get fetchMethod(){return t(this,vt)}get memoMethod(){return t(this,_t)}get dispose(){return t(this,K)}get onInsert(){return t(this,lt)}get disposeAfter(){return t(this,$)}getRemainingTTL(e){return t(this,A).has(e)?1/0:0}*entries(){for(let e of h(this,a,st).call(this))t(this,m)[e]!==void 0&&t(this,w)[e]!==void 0&&!h(this,a,b).call(this,t(this,m)[e])&&(yield [t(this,w)[e],t(this,m)[e]]);}*rentries(){for(let e of h(this,a,nt).call(this))t(this,m)[e]!==void 0&&t(this,w)[e]!==void 0&&!h(this,a,b).call(this,t(this,m)[e])&&(yield [t(this,w)[e],t(this,m)[e]]);}*keys(){for(let e of h(this,a,st).call(this)){let i=t(this,w)[e];i!==void 0&&!h(this,a,b).call(this,t(this,m)[e])&&(yield i);}}*rkeys(){for(let e of h(this,a,nt).call(this)){let i=t(this,w)[e];i!==void 0&&!h(this,a,b).call(this,t(this,m)[e])&&(yield i);}}*values(){for(let e of h(this,a,st).call(this))t(this,m)[e]!==void 0&&!h(this,a,b).call(this,t(this,m)[e])&&(yield t(this,m)[e]);}*rvalues(){for(let e of h(this,a,nt).call(this))t(this,m)[e]!==void 0&&!h(this,a,b).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 h(this,a,st).call(this)){let o=t(this,m)[s],n=h(this,a,b).call(this,o)?o.__staleWhileFetching:o;if(n!==void 0&&e(n,t(this,w)[s],this))return this.get(t(this,w)[s],i)}}forEach(e,i=this){for(let s of h(this,a,st).call(this)){let o=t(this,m)[s],n=h(this,a,b).call(this,o)?o.__staleWhileFetching:o;n!==void 0&&e.call(i,n,t(this,w)[s],this);}}rforEach(e,i=this){for(let s of h(this,a,nt).call(this)){let o=t(this,m)[s],n=h(this,a,b).call(this,o)?o.__staleWhileFetching:o;n!==void 0&&e.call(i,n,t(this,w)[s],this);}}purgeStale(){let e=false;for(let i of h(this,a,nt).call(this,{allowStale:true}))t(this,W).call(this,i)&&(h(this,a,rt).call(this,t(this,w)[i],"expire"),e=true);return e}info(e){let i=t(this,A).get(e);if(i===void 0)return;let s=t(this,m)[i],o=h(this,a,b).call(this,s)?s.__staleWhileFetching:s;if(o===void 0)return;let n={value:o};if(t(this,G)&&t(this,Q)){let r=t(this,G)[i],u=t(this,Q)[i];if(r&&u){let d=r-(t(this,Y).now()-u);n.ttl=d,n.start=Date.now();}}return t(this,J)&&(n.size=t(this,J)[i]),n}dump(){let e=[];for(let i of h(this,a,st).call(this,{allowStale:true})){let s=t(this,w)[i],o=t(this,m)[i],n=h(this,a,b).call(this,o)?o.__staleWhileFetching:o;if(n===void 0||s===void 0)continue;let r={value:n};if(t(this,G)&&t(this,Q)){r.ttl=t(this,G)[i];let u=t(this,Y).now()-t(this,Q)[i];r.start=Math.floor(Date.now()-u);}t(this,J)&&(r.size=t(this,J)[i]),e.unshift([s,r]);}return e}load(e){this.clear();for(let[i,s]of e){if(s.start){let o=Date.now()-s.start;s.start=t(this,Y).now()-o;}this.set(i,s.value,s);}}set(e,i,s={}){var z,O,p,_;if(i===void 0)return this.delete(e),this;let{ttl:o=this.ttl,start:n,noDisposeOnSet:r=this.noDisposeOnSet,sizeCalculation:u=this.sizeCalculation,status:d}=s,{noUpdateTTL:x=this.noUpdateTTL}=s,k=t(this,Et).call(this,e,i,s.size||0,u);if(this.maxEntrySize&&k>this.maxEntrySize)return d&&(d.set="miss",d.maxEntrySizeExceeded=true),h(this,a,rt).call(this,e,"set"),this;let c=t(this,E)===0?void 0:t(this,A).get(e);if(c===void 0)c=t(this,E)===0?t(this,T):t(this,X).length!==0?t(this,X).pop():t(this,E)===t(this,q)?h(this,a,Ct).call(this,false):t(this,E),t(this,w)[c]=e,t(this,m)[c]=i,t(this,A).set(e,c),t(this,F)[t(this,T)]=c,t(this,V)[c]=t(this,T),f(this,T,c),Ot(this,E)._++,t(this,St).call(this,c,k,d),d&&(d.set="add"),x=false,t(this,yt)&&((z=t(this,lt))==null||z.call(this,i,e,"add"));else {h(this,a,xt).call(this,c);let y=t(this,m)[c];if(i!==y){if(t(this,ot)&&h(this,a,b).call(this,y)){y.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:g}=y;g!==void 0&&!r&&(t(this,Z)&&((O=t(this,K))==null||O.call(this,g,e,"set")),t(this,R)&&t(this,U)?.push([g,e,"set"]));}else r||(t(this,Z)&&((p=t(this,K))==null||p.call(this,y,e,"set")),t(this,R)&&t(this,U)?.push([y,e,"set"]));if(t(this,ft).call(this,c),t(this,St).call(this,c,k,d),t(this,m)[c]=i,d){d.set="replace";let g=y&&h(this,a,b).call(this,y)?y.__staleWhileFetching:y;g!==void 0&&(d.oldValue=g);}}else d&&(d.set="update");t(this,yt)&&this.onInsert?.(i,e,i===y?"update":"replace");}if(o!==0&&!t(this,G)&&h(this,a,Nt).call(this),t(this,G)&&(x||t(this,At).call(this,c,o,n),d&&t(this,et).call(this,d,c)),!r&&t(this,R)&&t(this,U)){let y=t(this,U),g;for(;g=y?.shift();)(_=t(this,$))==null||_.call(this,...g);}return this}pop(){var e;try{for(;t(this,E);){let i=t(this,m)[t(this,j)];if(h(this,a,Ct).call(this,!0),h(this,a,b).call(this,i)){if(i.__staleWhileFetching)return i.__staleWhileFetching}else if(i!==void 0)return i}}finally{if(t(this,R)&&t(this,U)){let i=t(this,U),s;for(;s=i?.shift();)(e=t(this,$))==null||e.call(this,...s);}}}has(e,i={}){let{updateAgeOnHas:s=this.updateAgeOnHas,status:o}=i,n=t(this,A).get(e);if(n!==void 0){let r=t(this,m)[n];if(h(this,a,b).call(this,r)&&r.__staleWhileFetching===void 0)return false;if(t(this,W).call(this,n))o&&(o.has="stale",t(this,et).call(this,o,n));else return s&&t(this,ct).call(this,n),o&&(o.has="hit",t(this,et).call(this,o,n)),true}else o&&(o.has="miss");return false}peek(e,i={}){let{allowStale:s=this.allowStale}=i,o=t(this,A).get(e);if(o===void 0||!s&&t(this,W).call(this,o))return;let n=t(this,m)[o];return h(this,a,b).call(this,n)?n.__staleWhileFetching:n}async fetch(e,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:o=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,ttl:r=this.ttl,noDisposeOnSet:u=this.noDisposeOnSet,size:d=0,sizeCalculation:x=this.sizeCalculation,noUpdateTTL:k=this.noUpdateTTL,noDeleteOnFetchRejection:c=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:z=this.allowStaleOnFetchRejection,ignoreFetchAbort:O=this.ignoreFetchAbort,allowStaleOnFetchAbort:p=this.allowStaleOnFetchAbort,context:_,forceRefresh:y=false,status:g,signal:L}=i;if(!t(this,ot))return g&&(g.fetch="get"),this.get(e,{allowStale:s,updateAgeOnGet:o,noDeleteOnStaleGet:n,status:g});let P={allowStale:s,updateAgeOnGet:o,noDeleteOnStaleGet:n,ttl:r,noDisposeOnSet:u,size:d,sizeCalculation:x,noUpdateTTL:k,noDeleteOnFetchRejection:c,allowStaleOnFetchRejection:z,allowStaleOnFetchAbort:p,ignoreFetchAbort:O,status:g,signal:L},C=t(this,A).get(e);if(C===void 0){g&&(g.fetch="miss");let H=h(this,a,Dt).call(this,e,C,P,_);return H.__returned=H}else {let H=t(this,m)[C];if(h(this,a,b).call(this,H)){let pt=s&&H.__staleWhileFetching!==void 0;return g&&(g.fetch="inflight",pt&&(g.returnedStale=true)),pt?H.__staleWhileFetching:H.__returned=H}let wt=t(this,W).call(this,C);if(!y&&!wt)return g&&(g.fetch="hit"),h(this,a,xt).call(this,C),o&&t(this,ct).call(this,C),g&&t(this,et).call(this,g,C),H;let dt=h(this,a,Dt).call(this,e,C,P,_),ut=dt.__staleWhileFetching!==void 0&&s;return g&&(g.fetch=wt?"stale":"refresh",ut&&wt&&(g.returnedStale=true)),ut?dt.__staleWhileFetching:dt.__returned=dt}}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,_t);if(!s)throw new Error("no memoMethod provided to constructor");let{context:o,forceRefresh:n,...r}=i,u=this.get(e,r);if(!n&&u!==void 0)return u;let d=s(e,u,{options:r,context:o});return this.set(e,d,r),d}get(e,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:o=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,status:r}=i,u=t(this,A).get(e);if(u!==void 0){let d=t(this,m)[u],x=h(this,a,b).call(this,d);return r&&t(this,et).call(this,r,u),t(this,W).call(this,u)?(r&&(r.get="stale"),x?(r&&s&&d.__staleWhileFetching!==void 0&&(r.returnedStale=true),s?d.__staleWhileFetching:void 0):(n||h(this,a,rt).call(this,e,"expire"),r&&s&&(r.returnedStale=true),s?d:void 0)):(r&&(r.get="hit"),x?d.__staleWhileFetching:(h(this,a,xt).call(this,u),o&&t(this,ct).call(this,u),d))}else r&&(r.get="miss");}delete(e){return h(this,a,rt).call(this,e,"delete")}clear(){return h(this,a,Gt).call(this,"delete")}};q=new WeakMap,M=new WeakMap,K=new WeakMap,lt=new WeakMap,$=new WeakMap,vt=new WeakMap,_t=new WeakMap,Y=new WeakMap,E=new WeakMap,B=new WeakMap,A=new WeakMap,w=new WeakMap,m=new WeakMap,F=new WeakMap,V=new WeakMap,j=new WeakMap,T=new WeakMap,X=new WeakMap,U=new WeakMap,J=new WeakMap,Q=new WeakMap,G=new WeakMap,Z=new WeakMap,ot=new WeakMap,R=new WeakMap,yt=new WeakMap,a=new WeakSet,Nt=function(){let e=new mt(t(this,q)),i=new mt(t(this,q));f(this,G,e),f(this,Q,i),f(this,At,(n,r,u=t(this,Y).now())=>{if(i[n]=r!==0?u:0,e[n]=r,r!==0&&this.ttlAutopurge){let d=setTimeout(()=>{t(this,W).call(this,n)&&h(this,a,rt).call(this,t(this,w)[n],"expire");},r+1);d.unref&&d.unref();}}),f(this,ct,n=>{i[n]=e[n]!==0?t(this,Y).now():0;}),f(this,et,(n,r)=>{if(e[r]){let u=e[r],d=i[r];if(!u||!d)return;n.ttl=u,n.start=d,n.now=s||o();let x=n.now-d;n.remainingTTL=u-x;}});let s=0,o=()=>{let n=t(this,Y).now();if(this.ttlResolution>0){s=n;let r=setTimeout(()=>s=0,this.ttlResolution);r.unref&&r.unref();}return n};this.getRemainingTTL=n=>{let r=t(this,A).get(n);if(r===void 0)return 0;let u=e[r],d=i[r];if(!u||!d)return 1/0;let x=(s||o())-d;return u-x},f(this,W,n=>{let r=i[n],u=e[n];return !!u&&!!r&&(s||o())-r>u});},ct=new WeakMap,et=new WeakMap,At=new WeakMap,W=new WeakMap,ne=function(){let e=new mt(t(this,q));f(this,B,0),f(this,J,e),f(this,ft,i=>{f(this,B,t(this,B)-e[i]),e[i]=0;}),f(this,Et,(i,s,o,n)=>{if(h(this,a,b).call(this,s))return 0;if(!it(o))if(n){if(typeof n!="function")throw new TypeError("sizeCalculation must be a function");if(o=n(s,i),!it(o))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 o}),f(this,St,(i,s,o)=>{if(e[i]=s,t(this,M)){let n=t(this,M)-e[i];for(;t(this,B)>n;)h(this,a,Ct).call(this,true);}f(this,B,t(this,B)+e[i]),o&&(o.entrySize=s,o.totalCalculatedSize=t(this,B));});},ft=new WeakMap,St=new WeakMap,Et=new WeakMap,st=function*({allowStale:e=this.allowStale}={}){if(t(this,E))for(let i=t(this,T);!(!h(this,a,Mt).call(this,i)||((e||!t(this,W).call(this,i))&&(yield i),i===t(this,j)));)i=t(this,V)[i];},nt=function*({allowStale:e=this.allowStale}={}){if(t(this,E))for(let i=t(this,j);!(!h(this,a,Mt).call(this,i)||((e||!t(this,W).call(this,i))&&(yield i),i===t(this,T)));)i=t(this,F)[i];},Mt=function(e){return e!==void 0&&t(this,A).get(t(this,w)[e])===e},Ct=function(e){var n;let i=t(this,j),s=t(this,w)[i],o=t(this,m)[i];return t(this,ot)&&h(this,a,b).call(this,o)?o.__abortController.abort(new Error("evicted")):(t(this,Z)||t(this,R))&&(t(this,Z)&&((n=t(this,K))==null||n.call(this,o,s,"evict")),t(this,R)&&t(this,U)?.push([o,s,"evict"])),t(this,ft).call(this,i),e&&(t(this,w)[i]=void 0,t(this,m)[i]=void 0,t(this,X).push(i)),t(this,E)===1?(f(this,j,f(this,T,0)),t(this,X).length=0):f(this,j,t(this,F)[i]),t(this,A).delete(s),Ot(this,E)._--,i},Dt=function(e,i,s,o){let n=i===void 0?void 0:t(this,m)[i];if(h(this,a,b).call(this,n))return n;let r=new jt,{signal:u}=s;u?.addEventListener("abort",()=>r.abort(u.reason),{signal:r.signal});let d={signal:r.signal,options:s,context:o},x=(_,y=false)=>{let{aborted:g}=r.signal,L=s.ignoreFetchAbort&&_!==void 0;if(s.status&&(g&&!y?(s.status.fetchAborted=true,s.status.fetchError=r.signal.reason,L&&(s.status.fetchAbortIgnored=true)):s.status.fetchResolved=true),g&&!L&&!y)return c(r.signal.reason);let P=O;return t(this,m)[i]===O&&(_===void 0?P.__staleWhileFetching!==void 0?t(this,m)[i]=P.__staleWhileFetching:h(this,a,rt).call(this,e,"fetch"):(s.status&&(s.status.fetchUpdated=true),this.set(e,_,d.options))),_},k=_=>(s.status&&(s.status.fetchRejected=true,s.status.fetchError=_),c(_)),c=_=>{let{aborted:y}=r.signal,g=y&&s.allowStaleOnFetchAbort,L=g||s.allowStaleOnFetchRejection,P=L||s.noDeleteOnFetchRejection,C=O;if(t(this,m)[i]===O&&(!P||C.__staleWhileFetching===void 0?h(this,a,rt).call(this,e,"fetch"):g||(t(this,m)[i]=C.__staleWhileFetching)),L)return s.status&&C.__staleWhileFetching!==void 0&&(s.status.returnedStale=true),C.__staleWhileFetching;if(C.__returned===C)throw _},z=(_,y)=>{var L;let g=(L=t(this,vt))==null?void 0:L.call(this,e,n,d);g&&g instanceof Promise&&g.then(P=>_(P===void 0?void 0:P),y),r.signal.addEventListener("abort",()=>{(!s.ignoreFetchAbort||s.allowStaleOnFetchAbort)&&(_(void 0),s.allowStaleOnFetchAbort&&(_=P=>x(P,true)));});};s.status&&(s.status.fetchDispatched=true);let O=new Promise(z).then(x,k),p=Object.assign(O,{__abortController:r,__staleWhileFetching:n,__returned:void 0});return i===void 0?(this.set(e,p,{...d.options,status:void 0}),i=t(this,A).get(e)):t(this,m)[i]=p,p},b=function(e){if(!t(this,ot))return false;let i=e;return !!i&&i instanceof Promise&&i.hasOwnProperty("__staleWhileFetching")&&i.__abortController instanceof jt},Vt=function(e,i){t(this,V)[i]=e,t(this,F)[e]=i;},xt=function(e){e!==t(this,T)&&(e===t(this,j)?f(this,j,t(this,F)[e]):h(this,a,Vt).call(this,t(this,V)[e],t(this,F)[e]),h(this,a,Vt).call(this,t(this,T),e),f(this,T,e));},rt=function(e,i){var o,n;let s=false;if(t(this,E)!==0){let r=t(this,A).get(e);if(r!==void 0)if(s=true,t(this,E)===1)h(this,a,Gt).call(this,i);else {t(this,ft).call(this,r);let u=t(this,m)[r];if(h(this,a,b).call(this,u)?u.__abortController.abort(new Error("deleted")):(t(this,Z)||t(this,R))&&(t(this,Z)&&((o=t(this,K))==null||o.call(this,u,e,i)),t(this,R)&&t(this,U)?.push([u,e,i])),t(this,A).delete(e),t(this,w)[r]=void 0,t(this,m)[r]=void 0,r===t(this,T))f(this,T,t(this,V)[r]);else if(r===t(this,j))f(this,j,t(this,F)[r]);else {let d=t(this,V)[r];t(this,F)[d]=t(this,F)[r];let x=t(this,F)[r];t(this,V)[x]=t(this,V)[r];}Ot(this,E)._--,t(this,X).push(r);}}if(t(this,R)&&t(this,U)?.length){let r=t(this,U),u;for(;u=r?.shift();)(n=t(this,$))==null||n.call(this,...u);}return s},Gt=function(e){var i,s;for(let o of h(this,a,nt).call(this,{allowStale:true})){let n=t(this,m)[o];if(h(this,a,b).call(this,n))n.__abortController.abort(new Error("deleted"));else {let r=t(this,w)[o];t(this,Z)&&((i=t(this,K))==null||i.call(this,n,r,e)),t(this,R)&&t(this,U)?.push([n,r,e]);}}if(t(this,A).clear(),t(this,m).fill(void 0),t(this,w).fill(void 0),t(this,G)&&t(this,Q)&&(t(this,G).fill(0),t(this,Q).fill(0)),t(this,J)&&t(this,J).fill(0),f(this,j,0),f(this,T,0),t(this,X).length=0,f(this,B,0),f(this,E,0),t(this,R)&&t(this,U)){let o=t(this,U),n;for(;n=o?.shift();)(s=t(this,$))==null||s.call(this,...n);}};var Ft=Wt;var Rt=class{constructor(e){S(this,"cache");S(this,"map",new Map);this.cache=new Ft({max:e.cacheSize}),this.map=new Map;}get[Symbol.iterator](){return this.map[Symbol.iterator]}get[Symbol.toStringTag](){return this.map[Symbol.toStringTag]}clear(){return this.cache.clear(),this.map.clear()}delete(e){let i=this.map.delete(e);return i&&this.cache.delete(e),i}get forEach(){return this.map.forEach}get(e){let i=this.cache.get(e);return i||this.map.get(e)}has(e){return this.map.has(e)}set(e,i){return this.map.set(e,i),this.cache.set(e,i),this}get size(){return this.map.size}entries(){return this.map.entries()}keys(){return this.map.keys()}values(){return this.map.values()}};var Tt="1.3.26";var Ht="repeat";function kt(l){return {type:"pause",duration:l}}var qt="__game_layer__";var re={};var Kt={};le(Kt,{createExportableElement:()=>oe});var bt;(o=>(o.log=(n,...r)=>console.log(`[Pixi\u2019VN] ${n}`,...r),o.warn=(n,...r)=>console.warn(`[Pixi\u2019VN] ${n}`,...r),o.error=(n,...r)=>console.error(`[Pixi\u2019VN] ${n}`,...r),o.info=(n,...r)=>console.info(`[Pixi\u2019VN] ${n}`,...r)))(bt||(bt={}));function oe(l){try{if(typeof l>"u")return l;let e=JSON.stringify(l);return JSON.parse(e)}catch(e){throw bt.error("Error creating exportable element",l,e),new Error("[Pixi\u2019VN] Error creating exportable element")}}function ae(){console.info(`
|
|
1
|
+
'use strict';Object.defineProperty(exports,'__esModule',{value:true});var I=require('@drincs/pixi-vn/canvas'),Bt=require('@drincs/pixi-vn/characters'),tt=require('@drincs/pixi-vn/history'),D=require('@drincs/pixi-vn/narration'),pixi_js=require('@drincs/pixi-vn/pixi.js'),at=require('@drincs/pixi-vn/sound'),N=require('@drincs/pixi-vn/storage'),unifier=require('@drincs/pixi-vn/unifier');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 I__namespace=/*#__PURE__*/_interopNamespace(I);var Bt__namespace=/*#__PURE__*/_interopNamespace(Bt);var tt__namespace=/*#__PURE__*/_interopNamespace(tt);var D__namespace=/*#__PURE__*/_interopNamespace(D);var at__namespace=/*#__PURE__*/_interopNamespace(at);var N__namespace=/*#__PURE__*/_interopNamespace(N);var Xt=Object.defineProperty;var Jt=l=>{throw TypeError(l)};var he=(l,e,i)=>e in l?Xt(l,e,{enumerable:true,configurable:true,writable:true,value:i}):l[e]=i;var le=(l,e)=>{for(var i in e)Xt(l,i,{get:e[i],enumerable:true});};var S=(l,e,i)=>he(l,typeof e!="symbol"?e+"":e,i),zt=(l,e,i)=>e.has(l)||Jt("Cannot "+i);var t=(l,e,i)=>(zt(l,e,"read from private field"),i?i.call(l):e.get(l)),v=(l,e,i)=>e.has(l)?Jt("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),h=(l,e,i)=>(zt(l,e,"access private method"),i);var Ot=(l,e,i,s)=>({set _(o){f(l,e,o);},get _(){return t(l,e,s)}});var ce=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,ee=new Set,Lt=typeof process=="object"&&process?process:{},ie=(l,e,i,s)=>{typeof Lt.emitWarning=="function"?Lt.emitWarning(l,e,i,s):console.error(`[${i}] ${e}: ${l}`);},jt=globalThis.AbortController,Qt=globalThis.AbortSignal;if(typeof jt>"u"){Qt=class{constructor(){S(this,"onabort");S(this,"_onabort",[]);S(this,"reason");S(this,"aborted",false);}addEventListener(s,o){this._onabort.push(o);}},jt=class{constructor(){S(this,"signal",new Qt);e();}abort(s){if(!this.signal.aborted){this.signal.reason=s,this.signal.aborted=true;for(let o of this.signal._onabort)o(s);this.signal.onabort?.(s);}}};let l=Lt.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{l&&(l=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 fe=l=>!ee.has(l),it=l=>l&&l===Math.floor(l)&&l>0&&isFinite(l),se=l=>it(l)?l<=Math.pow(2,8)?Uint8Array:l<=Math.pow(2,16)?Uint16Array:l<=Math.pow(2,32)?Uint32Array:l<=Number.MAX_SAFE_INTEGER?mt:null:null,mt=class extends Array{constructor(e){super(e),this.fill(0);}},gt,ht=class ht{constructor(e,i){S(this,"heap");S(this,"length");if(!t(ht,gt))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new i(e),this.length=0;}static create(e){let i=se(e);if(!i)return [];f(ht,gt,true);let s=new ht(e,i);return f(ht,gt,false),s}push(e){this.heap[this.length++]=e;}pop(){return this.heap[--this.length]}};gt=new WeakMap,v(ht,gt,false);var Pt=ht,Zt,te,q,M,K,lt,$,vt,_t,Y,E,B,A,w,m,F,V,j,T,X,U,J,Q,G,Z,ot,R,yt,a,Nt,ct,et,At,W,ne,ft,St,Et,st,nt,Mt,Ct,Dt,b,Vt,xt,rt,Gt,Wt=class Wt{constructor(e){v(this,a);v(this,q);v(this,M);v(this,K);v(this,lt);v(this,$);v(this,vt);v(this,_t);v(this,Y);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");v(this,E);v(this,B);v(this,A);v(this,w);v(this,m);v(this,F);v(this,V);v(this,j);v(this,T);v(this,X);v(this,U);v(this,J);v(this,Q);v(this,G);v(this,Z);v(this,ot);v(this,R);v(this,yt);v(this,ct,()=>{});v(this,et,()=>{});v(this,At,()=>{});v(this,W,()=>false);v(this,ft,e=>{});v(this,St,(e,i,s)=>{});v(this,Et,(e,i,s,o)=>{if(s||o)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});S(this,Zt,"LRUCache");let{max:i=0,ttl:s,ttlResolution:o=1,ttlAutopurge:n,updateAgeOnGet:r,updateAgeOnHas:u,allowStale:d,dispose:x,onInsert:k,disposeAfter:c,noDisposeOnSet:z,noUpdateTTL:O,maxSize:p=0,maxEntrySize:_=0,sizeCalculation:y,fetchMethod:g,memoMethod:L,noDeleteOnFetchRejection:P,noDeleteOnStaleGet:C,allowStaleOnFetchRejection:H,allowStaleOnFetchAbort:wt,ignoreFetchAbort:dt,perf:Ut}=e;if(Ut!==void 0&&typeof Ut?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(f(this,Y,Ut??ce),i!==0&&!it(i))throw new TypeError("max option must be a nonnegative integer");let ut=i?se(i):Array;if(!ut)throw new Error("invalid max value: "+i);if(f(this,q,i),f(this,M,p),this.maxEntrySize=_||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(L!==void 0&&typeof L!="function")throw new TypeError("memoMethod must be a function if defined");if(f(this,_t,L),g!==void 0&&typeof g!="function")throw new TypeError("fetchMethod must be a function if specified");if(f(this,vt,g),f(this,ot,!!g),f(this,A,new Map),f(this,w,new Array(i).fill(void 0)),f(this,m,new Array(i).fill(void 0)),f(this,F,new ut(i)),f(this,V,new ut(i)),f(this,j,0),f(this,T,0),f(this,X,Pt.create(i)),f(this,E,0),f(this,B,0),typeof x=="function"&&f(this,K,x),typeof k=="function"&&f(this,lt,k),typeof c=="function"?(f(this,$,c),f(this,U,[])):(f(this,$,void 0),f(this,U,void 0)),f(this,Z,!!t(this,K)),f(this,yt,!!t(this,lt)),f(this,R,!!t(this,$)),this.noDisposeOnSet=!!z,this.noUpdateTTL=!!O,this.noDeleteOnFetchRejection=!!P,this.allowStaleOnFetchRejection=!!H,this.allowStaleOnFetchAbort=!!wt,this.ignoreFetchAbort=!!dt,this.maxEntrySize!==0){if(t(this,M)!==0&&!it(t(this,M)))throw new TypeError("maxSize must be a positive integer if specified");if(!it(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");h(this,a,ne).call(this);}if(this.allowStale=!!d,this.noDeleteOnStaleGet=!!C,this.updateAgeOnGet=!!r,this.updateAgeOnHas=!!u,this.ttlResolution=it(o)||o===0?o:1,this.ttlAutopurge=!!n,this.ttl=s||0,this.ttl){if(!it(this.ttl))throw new TypeError("ttl must be a positive integer if specified");h(this,a,Nt).call(this);}if(t(this,q)===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,q)&&!t(this,M)){let pt="LRU_CACHE_UNBOUNDED";fe(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,Y)}static unsafeExposeInternals(e){return {starts:t(e,Q),ttls:t(e,G),sizes:t(e,J),keyMap:t(e,A),keyList:t(e,w),valList:t(e,m),next:t(e,F),prev:t(e,V),get head(){return t(e,j)},get tail(){return t(e,T)},free:t(e,X),isBackgroundFetch:i=>{var s;return h(s=e,a,b).call(s,i)},backgroundFetch:(i,s,o,n)=>{var r;return h(r=e,a,Dt).call(r,i,s,o,n)},moveToTail:i=>{var s;return h(s=e,a,xt).call(s,i)},indexes:i=>{var s;return h(s=e,a,st).call(s,i)},rindexes:i=>{var s;return h(s=e,a,nt).call(s,i)},isStale:i=>{var s;return t(s=e,W).call(s,i)}}}get max(){return t(this,q)}get maxSize(){return t(this,M)}get calculatedSize(){return t(this,B)}get size(){return t(this,E)}get fetchMethod(){return t(this,vt)}get memoMethod(){return t(this,_t)}get dispose(){return t(this,K)}get onInsert(){return t(this,lt)}get disposeAfter(){return t(this,$)}getRemainingTTL(e){return t(this,A).has(e)?1/0:0}*entries(){for(let e of h(this,a,st).call(this))t(this,m)[e]!==void 0&&t(this,w)[e]!==void 0&&!h(this,a,b).call(this,t(this,m)[e])&&(yield [t(this,w)[e],t(this,m)[e]]);}*rentries(){for(let e of h(this,a,nt).call(this))t(this,m)[e]!==void 0&&t(this,w)[e]!==void 0&&!h(this,a,b).call(this,t(this,m)[e])&&(yield [t(this,w)[e],t(this,m)[e]]);}*keys(){for(let e of h(this,a,st).call(this)){let i=t(this,w)[e];i!==void 0&&!h(this,a,b).call(this,t(this,m)[e])&&(yield i);}}*rkeys(){for(let e of h(this,a,nt).call(this)){let i=t(this,w)[e];i!==void 0&&!h(this,a,b).call(this,t(this,m)[e])&&(yield i);}}*values(){for(let e of h(this,a,st).call(this))t(this,m)[e]!==void 0&&!h(this,a,b).call(this,t(this,m)[e])&&(yield t(this,m)[e]);}*rvalues(){for(let e of h(this,a,nt).call(this))t(this,m)[e]!==void 0&&!h(this,a,b).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 h(this,a,st).call(this)){let o=t(this,m)[s],n=h(this,a,b).call(this,o)?o.__staleWhileFetching:o;if(n!==void 0&&e(n,t(this,w)[s],this))return this.get(t(this,w)[s],i)}}forEach(e,i=this){for(let s of h(this,a,st).call(this)){let o=t(this,m)[s],n=h(this,a,b).call(this,o)?o.__staleWhileFetching:o;n!==void 0&&e.call(i,n,t(this,w)[s],this);}}rforEach(e,i=this){for(let s of h(this,a,nt).call(this)){let o=t(this,m)[s],n=h(this,a,b).call(this,o)?o.__staleWhileFetching:o;n!==void 0&&e.call(i,n,t(this,w)[s],this);}}purgeStale(){let e=false;for(let i of h(this,a,nt).call(this,{allowStale:true}))t(this,W).call(this,i)&&(h(this,a,rt).call(this,t(this,w)[i],"expire"),e=true);return e}info(e){let i=t(this,A).get(e);if(i===void 0)return;let s=t(this,m)[i],o=h(this,a,b).call(this,s)?s.__staleWhileFetching:s;if(o===void 0)return;let n={value:o};if(t(this,G)&&t(this,Q)){let r=t(this,G)[i],u=t(this,Q)[i];if(r&&u){let d=r-(t(this,Y).now()-u);n.ttl=d,n.start=Date.now();}}return t(this,J)&&(n.size=t(this,J)[i]),n}dump(){let e=[];for(let i of h(this,a,st).call(this,{allowStale:true})){let s=t(this,w)[i],o=t(this,m)[i],n=h(this,a,b).call(this,o)?o.__staleWhileFetching:o;if(n===void 0||s===void 0)continue;let r={value:n};if(t(this,G)&&t(this,Q)){r.ttl=t(this,G)[i];let u=t(this,Y).now()-t(this,Q)[i];r.start=Math.floor(Date.now()-u);}t(this,J)&&(r.size=t(this,J)[i]),e.unshift([s,r]);}return e}load(e){this.clear();for(let[i,s]of e){if(s.start){let o=Date.now()-s.start;s.start=t(this,Y).now()-o;}this.set(i,s.value,s);}}set(e,i,s={}){var z,O,p,_;if(i===void 0)return this.delete(e),this;let{ttl:o=this.ttl,start:n,noDisposeOnSet:r=this.noDisposeOnSet,sizeCalculation:u=this.sizeCalculation,status:d}=s,{noUpdateTTL:x=this.noUpdateTTL}=s,k=t(this,Et).call(this,e,i,s.size||0,u);if(this.maxEntrySize&&k>this.maxEntrySize)return d&&(d.set="miss",d.maxEntrySizeExceeded=true),h(this,a,rt).call(this,e,"set"),this;let c=t(this,E)===0?void 0:t(this,A).get(e);if(c===void 0)c=t(this,E)===0?t(this,T):t(this,X).length!==0?t(this,X).pop():t(this,E)===t(this,q)?h(this,a,Ct).call(this,false):t(this,E),t(this,w)[c]=e,t(this,m)[c]=i,t(this,A).set(e,c),t(this,F)[t(this,T)]=c,t(this,V)[c]=t(this,T),f(this,T,c),Ot(this,E)._++,t(this,St).call(this,c,k,d),d&&(d.set="add"),x=false,t(this,yt)&&((z=t(this,lt))==null||z.call(this,i,e,"add"));else {h(this,a,xt).call(this,c);let y=t(this,m)[c];if(i!==y){if(t(this,ot)&&h(this,a,b).call(this,y)){y.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:g}=y;g!==void 0&&!r&&(t(this,Z)&&((O=t(this,K))==null||O.call(this,g,e,"set")),t(this,R)&&t(this,U)?.push([g,e,"set"]));}else r||(t(this,Z)&&((p=t(this,K))==null||p.call(this,y,e,"set")),t(this,R)&&t(this,U)?.push([y,e,"set"]));if(t(this,ft).call(this,c),t(this,St).call(this,c,k,d),t(this,m)[c]=i,d){d.set="replace";let g=y&&h(this,a,b).call(this,y)?y.__staleWhileFetching:y;g!==void 0&&(d.oldValue=g);}}else d&&(d.set="update");t(this,yt)&&this.onInsert?.(i,e,i===y?"update":"replace");}if(o!==0&&!t(this,G)&&h(this,a,Nt).call(this),t(this,G)&&(x||t(this,At).call(this,c,o,n),d&&t(this,et).call(this,d,c)),!r&&t(this,R)&&t(this,U)){let y=t(this,U),g;for(;g=y?.shift();)(_=t(this,$))==null||_.call(this,...g);}return this}pop(){var e;try{for(;t(this,E);){let i=t(this,m)[t(this,j)];if(h(this,a,Ct).call(this,!0),h(this,a,b).call(this,i)){if(i.__staleWhileFetching)return i.__staleWhileFetching}else if(i!==void 0)return i}}finally{if(t(this,R)&&t(this,U)){let i=t(this,U),s;for(;s=i?.shift();)(e=t(this,$))==null||e.call(this,...s);}}}has(e,i={}){let{updateAgeOnHas:s=this.updateAgeOnHas,status:o}=i,n=t(this,A).get(e);if(n!==void 0){let r=t(this,m)[n];if(h(this,a,b).call(this,r)&&r.__staleWhileFetching===void 0)return false;if(t(this,W).call(this,n))o&&(o.has="stale",t(this,et).call(this,o,n));else return s&&t(this,ct).call(this,n),o&&(o.has="hit",t(this,et).call(this,o,n)),true}else o&&(o.has="miss");return false}peek(e,i={}){let{allowStale:s=this.allowStale}=i,o=t(this,A).get(e);if(o===void 0||!s&&t(this,W).call(this,o))return;let n=t(this,m)[o];return h(this,a,b).call(this,n)?n.__staleWhileFetching:n}async fetch(e,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:o=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,ttl:r=this.ttl,noDisposeOnSet:u=this.noDisposeOnSet,size:d=0,sizeCalculation:x=this.sizeCalculation,noUpdateTTL:k=this.noUpdateTTL,noDeleteOnFetchRejection:c=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:z=this.allowStaleOnFetchRejection,ignoreFetchAbort:O=this.ignoreFetchAbort,allowStaleOnFetchAbort:p=this.allowStaleOnFetchAbort,context:_,forceRefresh:y=false,status:g,signal:L}=i;if(!t(this,ot))return g&&(g.fetch="get"),this.get(e,{allowStale:s,updateAgeOnGet:o,noDeleteOnStaleGet:n,status:g});let P={allowStale:s,updateAgeOnGet:o,noDeleteOnStaleGet:n,ttl:r,noDisposeOnSet:u,size:d,sizeCalculation:x,noUpdateTTL:k,noDeleteOnFetchRejection:c,allowStaleOnFetchRejection:z,allowStaleOnFetchAbort:p,ignoreFetchAbort:O,status:g,signal:L},C=t(this,A).get(e);if(C===void 0){g&&(g.fetch="miss");let H=h(this,a,Dt).call(this,e,C,P,_);return H.__returned=H}else {let H=t(this,m)[C];if(h(this,a,b).call(this,H)){let pt=s&&H.__staleWhileFetching!==void 0;return g&&(g.fetch="inflight",pt&&(g.returnedStale=true)),pt?H.__staleWhileFetching:H.__returned=H}let wt=t(this,W).call(this,C);if(!y&&!wt)return g&&(g.fetch="hit"),h(this,a,xt).call(this,C),o&&t(this,ct).call(this,C),g&&t(this,et).call(this,g,C),H;let dt=h(this,a,Dt).call(this,e,C,P,_),ut=dt.__staleWhileFetching!==void 0&&s;return g&&(g.fetch=wt?"stale":"refresh",ut&&wt&&(g.returnedStale=true)),ut?dt.__staleWhileFetching:dt.__returned=dt}}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,_t);if(!s)throw new Error("no memoMethod provided to constructor");let{context:o,forceRefresh:n,...r}=i,u=this.get(e,r);if(!n&&u!==void 0)return u;let d=s(e,u,{options:r,context:o});return this.set(e,d,r),d}get(e,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:o=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,status:r}=i,u=t(this,A).get(e);if(u!==void 0){let d=t(this,m)[u],x=h(this,a,b).call(this,d);return r&&t(this,et).call(this,r,u),t(this,W).call(this,u)?(r&&(r.get="stale"),x?(r&&s&&d.__staleWhileFetching!==void 0&&(r.returnedStale=true),s?d.__staleWhileFetching:void 0):(n||h(this,a,rt).call(this,e,"expire"),r&&s&&(r.returnedStale=true),s?d:void 0)):(r&&(r.get="hit"),x?d.__staleWhileFetching:(h(this,a,xt).call(this,u),o&&t(this,ct).call(this,u),d))}else r&&(r.get="miss");}delete(e){return h(this,a,rt).call(this,e,"delete")}clear(){return h(this,a,Gt).call(this,"delete")}};q=new WeakMap,M=new WeakMap,K=new WeakMap,lt=new WeakMap,$=new WeakMap,vt=new WeakMap,_t=new WeakMap,Y=new WeakMap,E=new WeakMap,B=new WeakMap,A=new WeakMap,w=new WeakMap,m=new WeakMap,F=new WeakMap,V=new WeakMap,j=new WeakMap,T=new WeakMap,X=new WeakMap,U=new WeakMap,J=new WeakMap,Q=new WeakMap,G=new WeakMap,Z=new WeakMap,ot=new WeakMap,R=new WeakMap,yt=new WeakMap,a=new WeakSet,Nt=function(){let e=new mt(t(this,q)),i=new mt(t(this,q));f(this,G,e),f(this,Q,i),f(this,At,(n,r,u=t(this,Y).now())=>{if(i[n]=r!==0?u:0,e[n]=r,r!==0&&this.ttlAutopurge){let d=setTimeout(()=>{t(this,W).call(this,n)&&h(this,a,rt).call(this,t(this,w)[n],"expire");},r+1);d.unref&&d.unref();}}),f(this,ct,n=>{i[n]=e[n]!==0?t(this,Y).now():0;}),f(this,et,(n,r)=>{if(e[r]){let u=e[r],d=i[r];if(!u||!d)return;n.ttl=u,n.start=d,n.now=s||o();let x=n.now-d;n.remainingTTL=u-x;}});let s=0,o=()=>{let n=t(this,Y).now();if(this.ttlResolution>0){s=n;let r=setTimeout(()=>s=0,this.ttlResolution);r.unref&&r.unref();}return n};this.getRemainingTTL=n=>{let r=t(this,A).get(n);if(r===void 0)return 0;let u=e[r],d=i[r];if(!u||!d)return 1/0;let x=(s||o())-d;return u-x},f(this,W,n=>{let r=i[n],u=e[n];return !!u&&!!r&&(s||o())-r>u});},ct=new WeakMap,et=new WeakMap,At=new WeakMap,W=new WeakMap,ne=function(){let e=new mt(t(this,q));f(this,B,0),f(this,J,e),f(this,ft,i=>{f(this,B,t(this,B)-e[i]),e[i]=0;}),f(this,Et,(i,s,o,n)=>{if(h(this,a,b).call(this,s))return 0;if(!it(o))if(n){if(typeof n!="function")throw new TypeError("sizeCalculation must be a function");if(o=n(s,i),!it(o))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 o}),f(this,St,(i,s,o)=>{if(e[i]=s,t(this,M)){let n=t(this,M)-e[i];for(;t(this,B)>n;)h(this,a,Ct).call(this,true);}f(this,B,t(this,B)+e[i]),o&&(o.entrySize=s,o.totalCalculatedSize=t(this,B));});},ft=new WeakMap,St=new WeakMap,Et=new WeakMap,st=function*({allowStale:e=this.allowStale}={}){if(t(this,E))for(let i=t(this,T);!(!h(this,a,Mt).call(this,i)||((e||!t(this,W).call(this,i))&&(yield i),i===t(this,j)));)i=t(this,V)[i];},nt=function*({allowStale:e=this.allowStale}={}){if(t(this,E))for(let i=t(this,j);!(!h(this,a,Mt).call(this,i)||((e||!t(this,W).call(this,i))&&(yield i),i===t(this,T)));)i=t(this,F)[i];},Mt=function(e){return e!==void 0&&t(this,A).get(t(this,w)[e])===e},Ct=function(e){var n;let i=t(this,j),s=t(this,w)[i],o=t(this,m)[i];return t(this,ot)&&h(this,a,b).call(this,o)?o.__abortController.abort(new Error("evicted")):(t(this,Z)||t(this,R))&&(t(this,Z)&&((n=t(this,K))==null||n.call(this,o,s,"evict")),t(this,R)&&t(this,U)?.push([o,s,"evict"])),t(this,ft).call(this,i),e&&(t(this,w)[i]=void 0,t(this,m)[i]=void 0,t(this,X).push(i)),t(this,E)===1?(f(this,j,f(this,T,0)),t(this,X).length=0):f(this,j,t(this,F)[i]),t(this,A).delete(s),Ot(this,E)._--,i},Dt=function(e,i,s,o){let n=i===void 0?void 0:t(this,m)[i];if(h(this,a,b).call(this,n))return n;let r=new jt,{signal:u}=s;u?.addEventListener("abort",()=>r.abort(u.reason),{signal:r.signal});let d={signal:r.signal,options:s,context:o},x=(_,y=false)=>{let{aborted:g}=r.signal,L=s.ignoreFetchAbort&&_!==void 0;if(s.status&&(g&&!y?(s.status.fetchAborted=true,s.status.fetchError=r.signal.reason,L&&(s.status.fetchAbortIgnored=true)):s.status.fetchResolved=true),g&&!L&&!y)return c(r.signal.reason);let P=O;return t(this,m)[i]===O&&(_===void 0?P.__staleWhileFetching!==void 0?t(this,m)[i]=P.__staleWhileFetching:h(this,a,rt).call(this,e,"fetch"):(s.status&&(s.status.fetchUpdated=true),this.set(e,_,d.options))),_},k=_=>(s.status&&(s.status.fetchRejected=true,s.status.fetchError=_),c(_)),c=_=>{let{aborted:y}=r.signal,g=y&&s.allowStaleOnFetchAbort,L=g||s.allowStaleOnFetchRejection,P=L||s.noDeleteOnFetchRejection,C=O;if(t(this,m)[i]===O&&(!P||C.__staleWhileFetching===void 0?h(this,a,rt).call(this,e,"fetch"):g||(t(this,m)[i]=C.__staleWhileFetching)),L)return s.status&&C.__staleWhileFetching!==void 0&&(s.status.returnedStale=true),C.__staleWhileFetching;if(C.__returned===C)throw _},z=(_,y)=>{var L;let g=(L=t(this,vt))==null?void 0:L.call(this,e,n,d);g&&g instanceof Promise&&g.then(P=>_(P===void 0?void 0:P),y),r.signal.addEventListener("abort",()=>{(!s.ignoreFetchAbort||s.allowStaleOnFetchAbort)&&(_(void 0),s.allowStaleOnFetchAbort&&(_=P=>x(P,true)));});};s.status&&(s.status.fetchDispatched=true);let O=new Promise(z).then(x,k),p=Object.assign(O,{__abortController:r,__staleWhileFetching:n,__returned:void 0});return i===void 0?(this.set(e,p,{...d.options,status:void 0}),i=t(this,A).get(e)):t(this,m)[i]=p,p},b=function(e){if(!t(this,ot))return false;let i=e;return !!i&&i instanceof Promise&&i.hasOwnProperty("__staleWhileFetching")&&i.__abortController instanceof jt},Vt=function(e,i){t(this,V)[i]=e,t(this,F)[e]=i;},xt=function(e){e!==t(this,T)&&(e===t(this,j)?f(this,j,t(this,F)[e]):h(this,a,Vt).call(this,t(this,V)[e],t(this,F)[e]),h(this,a,Vt).call(this,t(this,T),e),f(this,T,e));},rt=function(e,i){var o,n;let s=false;if(t(this,E)!==0){let r=t(this,A).get(e);if(r!==void 0)if(s=true,t(this,E)===1)h(this,a,Gt).call(this,i);else {t(this,ft).call(this,r);let u=t(this,m)[r];if(h(this,a,b).call(this,u)?u.__abortController.abort(new Error("deleted")):(t(this,Z)||t(this,R))&&(t(this,Z)&&((o=t(this,K))==null||o.call(this,u,e,i)),t(this,R)&&t(this,U)?.push([u,e,i])),t(this,A).delete(e),t(this,w)[r]=void 0,t(this,m)[r]=void 0,r===t(this,T))f(this,T,t(this,V)[r]);else if(r===t(this,j))f(this,j,t(this,F)[r]);else {let d=t(this,V)[r];t(this,F)[d]=t(this,F)[r];let x=t(this,F)[r];t(this,V)[x]=t(this,V)[r];}Ot(this,E)._--,t(this,X).push(r);}}if(t(this,R)&&t(this,U)?.length){let r=t(this,U),u;for(;u=r?.shift();)(n=t(this,$))==null||n.call(this,...u);}return s},Gt=function(e){var i,s;for(let o of h(this,a,nt).call(this,{allowStale:true})){let n=t(this,m)[o];if(h(this,a,b).call(this,n))n.__abortController.abort(new Error("deleted"));else {let r=t(this,w)[o];t(this,Z)&&((i=t(this,K))==null||i.call(this,n,r,e)),t(this,R)&&t(this,U)?.push([n,r,e]);}}if(t(this,A).clear(),t(this,m).fill(void 0),t(this,w).fill(void 0),t(this,G)&&t(this,Q)&&(t(this,G).fill(0),t(this,Q).fill(0)),t(this,J)&&t(this,J).fill(0),f(this,j,0),f(this,T,0),t(this,X).length=0,f(this,B,0),f(this,E,0),t(this,R)&&t(this,U)){let o=t(this,U),n;for(;n=o?.shift();)(s=t(this,$))==null||s.call(this,...n);}};var Ft=Wt;var Rt=class{constructor(e){S(this,"cache");S(this,"map",new Map);this.cache=new Ft({max:e.cacheSize}),this.map=new Map;}get[Symbol.iterator](){return this.map[Symbol.iterator]}get[Symbol.toStringTag](){return this.map[Symbol.toStringTag]}clear(){return this.cache.clear(),this.map.clear()}delete(e){let i=this.map.delete(e);return i&&this.cache.delete(e),i}get forEach(){return this.map.forEach}get(e){let i=this.cache.get(e);return i||this.map.get(e)}has(e){return this.map.has(e)}set(e,i){return this.map.set(e,i),this.cache.set(e,i),this}get size(){return this.map.size}entries(){return this.map.entries()}keys(){return this.map.keys()}values(){return this.map.values()}};var Tt="1.3.27";var Ht="repeat";function kt(l){return {type:"pause",duration:l}}var qt="__game_layer__";var re={};var Kt={};le(Kt,{createExportableElement:()=>oe});var bt;(o=>(o.log=(n,...r)=>console.log(`[Pixi\u2019VN] ${n}`,...r),o.warn=(n,...r)=>console.warn(`[Pixi\u2019VN] ${n}`,...r),o.error=(n,...r)=>console.error(`[Pixi\u2019VN] ${n}`,...r),o.info=(n,...r)=>console.info(`[Pixi\u2019VN] ${n}`,...r)))(bt||(bt={}));function oe(l){try{if(typeof l>"u")return l;let e=JSON.stringify(l);return JSON.parse(e)}catch(e){throw bt.error("Error creating exportable element",l,e),new Error("[Pixi\u2019VN] Error creating exportable element")}}function ae(){console.info(`
|
|
2
2
|
_______ _ _ _ ____ ____ ____ _____
|
|
3
3
|
|_ __ \\ (_) (_) | | |_ _| |_ _||_ \\|_ _|
|
|
4
4
|
| |__) |__ _ __ __ \\_| \\ \\ / / | \\ | |
|
package/dist/index.d.cts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {b as b$1,d,a as a$1,c,e,f,g}from'./chunk-TTRUPDAB.mjs';import*as I from'@drincs/pixi-vn/canvas';export*from'@drincs/pixi-vn/canvas';import*as Yt from'@drincs/pixi-vn/characters';export*from'@drincs/pixi-vn/characters';import*as tt from'@drincs/pixi-vn/history';export*from'@drincs/pixi-vn/history';import*as D from'@drincs/pixi-vn/narration';export*from'@drincs/pixi-vn/narration';import {Rectangle,Assets}from'@drincs/pixi-vn/pixi.js';export{Assets,Rectangle,Texture,UPDATE_PRIORITY}from'@drincs/pixi-vn/pixi.js';import*as at from'@drincs/pixi-vn/sound';export*from'@drincs/pixi-vn/sound';import*as N from'@drincs/pixi-vn/storage';export*from'@drincs/pixi-vn/storage';import {GameUnifier}from'@drincs/pixi-vn/unifier';export*from'@drincs/pixi-vn/unifier';var oe=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,Qt=new Set,zt=typeof process=="object"&&process?process:{},Zt=(v,e,i,s)=>{typeof zt.emitWarning=="function"?zt.emitWarning(v,e,i,s):console.error(`[${i}] ${e}: ${v}`);},jt=globalThis.AbortController,Bt=globalThis.AbortSignal;if(typeof jt>"u"){Bt=class{constructor(){b$1(this,"onabort");b$1(this,"_onabort",[]);b$1(this,"reason");b$1(this,"aborted",false);}addEventListener(s,o){this._onabort.push(o);}},jt=class{constructor(){b$1(this,"signal",new Bt);e();}abort(s){if(!this.signal.aborted){this.signal.reason=s,this.signal.aborted=true;for(let o of this.signal._onabort)o(s);this.signal.onabort?.(s);}}};let v=zt.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{v&&(v=false,Zt("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 ae=v=>!Qt.has(v),it=v=>v&&v===Math.floor(v)&&v>0&&isFinite(v),te=v=>it(v)?v<=Math.pow(2,8)?Uint8Array:v<=Math.pow(2,16)?Uint16Array:v<=Math.pow(2,32)?Uint32Array:v<=Number.MAX_SAFE_INTEGER?mt:null:null,mt=class extends Array{constructor(e){super(e),this.fill(0);}},gt,ht=class ht{constructor(e,i){b$1(this,"heap");b$1(this,"length");if(!c(ht,gt))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new i(e),this.length=0;}static create(e$1){let i=te(e$1);if(!i)return [];e(ht,gt,true);let s=new ht(e$1,i);return e(ht,gt,false),s}push(e){this.heap[this.length++]=e;}pop(){return this.heap[--this.length]}};gt=new WeakMap,d(ht,gt,false);var Lt=ht,Xt,Jt,q,M,K,lt,$,vt,_t,Y,E,B,A,w,p,F,V,j,T,X,U,J,Q,G,Z,ot,R,yt,a,Pt,ct,et,At,W,ee,ft,St,Et,st,nt,Nt,Ct,Dt,b,Mt,xt,rt,Vt,Gt=class Gt{constructor(e$1){d(this,a);d(this,q);d(this,M);d(this,K);d(this,lt);d(this,$);d(this,vt);d(this,_t);d(this,Y);b$1(this,"ttl");b$1(this,"ttlResolution");b$1(this,"ttlAutopurge");b$1(this,"updateAgeOnGet");b$1(this,"updateAgeOnHas");b$1(this,"allowStale");b$1(this,"noDisposeOnSet");b$1(this,"noUpdateTTL");b$1(this,"maxEntrySize");b$1(this,"sizeCalculation");b$1(this,"noDeleteOnFetchRejection");b$1(this,"noDeleteOnStaleGet");b$1(this,"allowStaleOnFetchAbort");b$1(this,"allowStaleOnFetchRejection");b$1(this,"ignoreFetchAbort");d(this,E);d(this,B);d(this,A);d(this,w);d(this,p);d(this,F);d(this,V);d(this,j);d(this,T);d(this,X);d(this,U);d(this,J);d(this,Q);d(this,G);d(this,Z);d(this,ot);d(this,R);d(this,yt);d(this,ct,()=>{});d(this,et,()=>{});d(this,At,()=>{});d(this,W,()=>false);d(this,ft,e=>{});d(this,St,(e,i,s)=>{});d(this,Et,(e,i,s,o)=>{if(s||o)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});b$1(this,Xt,"LRUCache");let{max:i=0,ttl:s,ttlResolution:o=1,ttlAutopurge:n,updateAgeOnGet:r,updateAgeOnHas:d$1,allowStale:f$1,dispose:x,onInsert:k,disposeAfter:l,noDisposeOnSet:z,noUpdateTTL:O,maxSize:u=0,maxEntrySize:_=0,sizeCalculation:y,fetchMethod:m,memoMethod:L,noDeleteOnFetchRejection:P,noDeleteOnStaleGet:C,allowStaleOnFetchRejection:H,allowStaleOnFetchAbort:wt,ignoreFetchAbort:dt,perf:Ut}=e$1;if(Ut!==void 0&&typeof Ut?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(e(this,Y,Ut??oe),i!==0&&!it(i))throw new TypeError("max option must be a nonnegative integer");let ut=i?te(i):Array;if(!ut)throw new Error("invalid max value: "+i);if(e(this,q,i),e(this,M,u),this.maxEntrySize=_||c(this,M),this.sizeCalculation=y,this.sizeCalculation){if(!c(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(L!==void 0&&typeof L!="function")throw new TypeError("memoMethod must be a function if defined");if(e(this,_t,L),m!==void 0&&typeof m!="function")throw new TypeError("fetchMethod must be a function if specified");if(e(this,vt,m),e(this,ot,!!m),e(this,A,new Map),e(this,w,new Array(i).fill(void 0)),e(this,p,new Array(i).fill(void 0)),e(this,F,new ut(i)),e(this,V,new ut(i)),e(this,j,0),e(this,T,0),e(this,X,Lt.create(i)),e(this,E,0),e(this,B,0),typeof x=="function"&&e(this,K,x),typeof k=="function"&&e(this,lt,k),typeof l=="function"?(e(this,$,l),e(this,U,[])):(e(this,$,void 0),e(this,U,void 0)),e(this,Z,!!c(this,K)),e(this,yt,!!c(this,lt)),e(this,R,!!c(this,$)),this.noDisposeOnSet=!!z,this.noUpdateTTL=!!O,this.noDeleteOnFetchRejection=!!P,this.allowStaleOnFetchRejection=!!H,this.allowStaleOnFetchAbort=!!wt,this.ignoreFetchAbort=!!dt,this.maxEntrySize!==0){if(c(this,M)!==0&&!it(c(this,M)))throw new TypeError("maxSize must be a positive integer if specified");if(!it(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");f(this,a,ee).call(this);}if(this.allowStale=!!f$1,this.noDeleteOnStaleGet=!!C,this.updateAgeOnGet=!!r,this.updateAgeOnHas=!!d$1,this.ttlResolution=it(o)||o===0?o:1,this.ttlAutopurge=!!n,this.ttl=s||0,this.ttl){if(!it(this.ttl))throw new TypeError("ttl must be a positive integer if specified");f(this,a,Pt).call(this);}if(c(this,q)===0&&this.ttl===0&&c(this,M)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!c(this,q)&&!c(this,M)){let pt="LRU_CACHE_UNBOUNDED";ae(pt)&&(Qt.add(pt),Zt("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",pt,Gt));}}get perf(){return c(this,Y)}static unsafeExposeInternals(e){return {starts:c(e,Q),ttls:c(e,G),sizes:c(e,J),keyMap:c(e,A),keyList:c(e,w),valList:c(e,p),next:c(e,F),prev:c(e,V),get head(){return c(e,j)},get tail(){return c(e,T)},free:c(e,X),isBackgroundFetch:i=>{var s;return f(s=e,a,b).call(s,i)},backgroundFetch:(i,s,o,n)=>{var r;return f(r=e,a,Dt).call(r,i,s,o,n)},moveToTail:i=>{var s;return f(s=e,a,xt).call(s,i)},indexes:i=>{var s;return f(s=e,a,st).call(s,i)},rindexes:i=>{var s;return f(s=e,a,nt).call(s,i)},isStale:i=>{var s;return c(s=e,W).call(s,i)}}}get max(){return c(this,q)}get maxSize(){return c(this,M)}get calculatedSize(){return c(this,B)}get size(){return c(this,E)}get fetchMethod(){return c(this,vt)}get memoMethod(){return c(this,_t)}get dispose(){return c(this,K)}get onInsert(){return c(this,lt)}get disposeAfter(){return c(this,$)}getRemainingTTL(e){return c(this,A).has(e)?1/0:0}*entries(){for(let e of f(this,a,st).call(this))c(this,p)[e]!==void 0&&c(this,w)[e]!==void 0&&!f(this,a,b).call(this,c(this,p)[e])&&(yield [c(this,w)[e],c(this,p)[e]]);}*rentries(){for(let e of f(this,a,nt).call(this))c(this,p)[e]!==void 0&&c(this,w)[e]!==void 0&&!f(this,a,b).call(this,c(this,p)[e])&&(yield [c(this,w)[e],c(this,p)[e]]);}*keys(){for(let e of f(this,a,st).call(this)){let i=c(this,w)[e];i!==void 0&&!f(this,a,b).call(this,c(this,p)[e])&&(yield i);}}*rkeys(){for(let e of f(this,a,nt).call(this)){let i=c(this,w)[e];i!==void 0&&!f(this,a,b).call(this,c(this,p)[e])&&(yield i);}}*values(){for(let e of f(this,a,st).call(this))c(this,p)[e]!==void 0&&!f(this,a,b).call(this,c(this,p)[e])&&(yield c(this,p)[e]);}*rvalues(){for(let e of f(this,a,nt).call(this))c(this,p)[e]!==void 0&&!f(this,a,b).call(this,c(this,p)[e])&&(yield c(this,p)[e]);}[(Jt=Symbol.iterator,Xt=Symbol.toStringTag,Jt)](){return this.entries()}find(e,i={}){for(let s of f(this,a,st).call(this)){let o=c(this,p)[s],n=f(this,a,b).call(this,o)?o.__staleWhileFetching:o;if(n!==void 0&&e(n,c(this,w)[s],this))return this.get(c(this,w)[s],i)}}forEach(e,i=this){for(let s of f(this,a,st).call(this)){let o=c(this,p)[s],n=f(this,a,b).call(this,o)?o.__staleWhileFetching:o;n!==void 0&&e.call(i,n,c(this,w)[s],this);}}rforEach(e,i=this){for(let s of f(this,a,nt).call(this)){let o=c(this,p)[s],n=f(this,a,b).call(this,o)?o.__staleWhileFetching:o;n!==void 0&&e.call(i,n,c(this,w)[s],this);}}purgeStale(){let e=false;for(let i of f(this,a,nt).call(this,{allowStale:true}))c(this,W).call(this,i)&&(f(this,a,rt).call(this,c(this,w)[i],"expire"),e=true);return e}info(e){let i=c(this,A).get(e);if(i===void 0)return;let s=c(this,p)[i],o=f(this,a,b).call(this,s)?s.__staleWhileFetching:s;if(o===void 0)return;let n={value:o};if(c(this,G)&&c(this,Q)){let r=c(this,G)[i],d=c(this,Q)[i];if(r&&d){let f=r-(c(this,Y).now()-d);n.ttl=f,n.start=Date.now();}}return c(this,J)&&(n.size=c(this,J)[i]),n}dump(){let e=[];for(let i of f(this,a,st).call(this,{allowStale:true})){let s=c(this,w)[i],o=c(this,p)[i],n=f(this,a,b).call(this,o)?o.__staleWhileFetching:o;if(n===void 0||s===void 0)continue;let r={value:n};if(c(this,G)&&c(this,Q)){r.ttl=c(this,G)[i];let d=c(this,Y).now()-c(this,Q)[i];r.start=Math.floor(Date.now()-d);}c(this,J)&&(r.size=c(this,J)[i]),e.unshift([s,r]);}return e}load(e){this.clear();for(let[i,s]of e){if(s.start){let o=Date.now()-s.start;s.start=c(this,Y).now()-o;}this.set(i,s.value,s);}}set(e$1,i,s={}){var z,O,u,_;if(i===void 0)return this.delete(e$1),this;let{ttl:o=this.ttl,start:n,noDisposeOnSet:r=this.noDisposeOnSet,sizeCalculation:d=this.sizeCalculation,status:f$1}=s,{noUpdateTTL:x=this.noUpdateTTL}=s,k=c(this,Et).call(this,e$1,i,s.size||0,d);if(this.maxEntrySize&&k>this.maxEntrySize)return f$1&&(f$1.set="miss",f$1.maxEntrySizeExceeded=true),f(this,a,rt).call(this,e$1,"set"),this;let l=c(this,E)===0?void 0:c(this,A).get(e$1);if(l===void 0)l=c(this,E)===0?c(this,T):c(this,X).length!==0?c(this,X).pop():c(this,E)===c(this,q)?f(this,a,Ct).call(this,false):c(this,E),c(this,w)[l]=e$1,c(this,p)[l]=i,c(this,A).set(e$1,l),c(this,F)[c(this,T)]=l,c(this,V)[l]=c(this,T),e(this,T,l),g(this,E)._++,c(this,St).call(this,l,k,f$1),f$1&&(f$1.set="add"),x=false,c(this,yt)&&((z=c(this,lt))==null||z.call(this,i,e$1,"add"));else {f(this,a,xt).call(this,l);let y=c(this,p)[l];if(i!==y){if(c(this,ot)&&f(this,a,b).call(this,y)){y.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:m}=y;m!==void 0&&!r&&(c(this,Z)&&((O=c(this,K))==null||O.call(this,m,e$1,"set")),c(this,R)&&c(this,U)?.push([m,e$1,"set"]));}else r||(c(this,Z)&&((u=c(this,K))==null||u.call(this,y,e$1,"set")),c(this,R)&&c(this,U)?.push([y,e$1,"set"]));if(c(this,ft).call(this,l),c(this,St).call(this,l,k,f$1),c(this,p)[l]=i,f$1){f$1.set="replace";let m=y&&f(this,a,b).call(this,y)?y.__staleWhileFetching:y;m!==void 0&&(f$1.oldValue=m);}}else f$1&&(f$1.set="update");c(this,yt)&&this.onInsert?.(i,e$1,i===y?"update":"replace");}if(o!==0&&!c(this,G)&&f(this,a,Pt).call(this),c(this,G)&&(x||c(this,At).call(this,l,o,n),f$1&&c(this,et).call(this,f$1,l)),!r&&c(this,R)&&c(this,U)){let y=c(this,U),m;for(;m=y?.shift();)(_=c(this,$))==null||_.call(this,...m);}return this}pop(){var e;try{for(;c(this,E);){let i=c(this,p)[c(this,j)];if(f(this,a,Ct).call(this,!0),f(this,a,b).call(this,i)){if(i.__staleWhileFetching)return i.__staleWhileFetching}else if(i!==void 0)return i}}finally{if(c(this,R)&&c(this,U)){let i=c(this,U),s;for(;s=i?.shift();)(e=c(this,$))==null||e.call(this,...s);}}}has(e,i={}){let{updateAgeOnHas:s=this.updateAgeOnHas,status:o}=i,n=c(this,A).get(e);if(n!==void 0){let r=c(this,p)[n];if(f(this,a,b).call(this,r)&&r.__staleWhileFetching===void 0)return false;if(c(this,W).call(this,n))o&&(o.has="stale",c(this,et).call(this,o,n));else return s&&c(this,ct).call(this,n),o&&(o.has="hit",c(this,et).call(this,o,n)),true}else o&&(o.has="miss");return false}peek(e,i={}){let{allowStale:s=this.allowStale}=i,o=c(this,A).get(e);if(o===void 0||!s&&c(this,W).call(this,o))return;let n=c(this,p)[o];return f(this,a,b).call(this,n)?n.__staleWhileFetching:n}async fetch(e,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:o=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,ttl:r=this.ttl,noDisposeOnSet:d=this.noDisposeOnSet,size:f$1=0,sizeCalculation:x=this.sizeCalculation,noUpdateTTL:k=this.noUpdateTTL,noDeleteOnFetchRejection:l=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:z=this.allowStaleOnFetchRejection,ignoreFetchAbort:O=this.ignoreFetchAbort,allowStaleOnFetchAbort:u=this.allowStaleOnFetchAbort,context:_,forceRefresh:y=false,status:m,signal:L}=i;if(!c(this,ot))return m&&(m.fetch="get"),this.get(e,{allowStale:s,updateAgeOnGet:o,noDeleteOnStaleGet:n,status:m});let P={allowStale:s,updateAgeOnGet:o,noDeleteOnStaleGet:n,ttl:r,noDisposeOnSet:d,size:f$1,sizeCalculation:x,noUpdateTTL:k,noDeleteOnFetchRejection:l,allowStaleOnFetchRejection:z,allowStaleOnFetchAbort:u,ignoreFetchAbort:O,status:m,signal:L},C=c(this,A).get(e);if(C===void 0){m&&(m.fetch="miss");let H=f(this,a,Dt).call(this,e,C,P,_);return H.__returned=H}else {let H=c(this,p)[C];if(f(this,a,b).call(this,H)){let pt=s&&H.__staleWhileFetching!==void 0;return m&&(m.fetch="inflight",pt&&(m.returnedStale=true)),pt?H.__staleWhileFetching:H.__returned=H}let wt=c(this,W).call(this,C);if(!y&&!wt)return m&&(m.fetch="hit"),f(this,a,xt).call(this,C),o&&c(this,ct).call(this,C),m&&c(this,et).call(this,m,C),H;let dt=f(this,a,Dt).call(this,e,C,P,_),ut=dt.__staleWhileFetching!==void 0&&s;return m&&(m.fetch=wt?"stale":"refresh",ut&&wt&&(m.returnedStale=true)),ut?dt.__staleWhileFetching:dt.__returned=dt}}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=c(this,_t);if(!s)throw new Error("no memoMethod provided to constructor");let{context:o,forceRefresh:n,...r}=i,d=this.get(e,r);if(!n&&d!==void 0)return d;let f=s(e,d,{options:r,context:o});return this.set(e,f,r),f}get(e,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:o=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,status:r}=i,d=c(this,A).get(e);if(d!==void 0){let f$1=c(this,p)[d],x=f(this,a,b).call(this,f$1);return r&&c(this,et).call(this,r,d),c(this,W).call(this,d)?(r&&(r.get="stale"),x?(r&&s&&f$1.__staleWhileFetching!==void 0&&(r.returnedStale=true),s?f$1.__staleWhileFetching:void 0):(n||f(this,a,rt).call(this,e,"expire"),r&&s&&(r.returnedStale=true),s?f$1:void 0)):(r&&(r.get="hit"),x?f$1.__staleWhileFetching:(f(this,a,xt).call(this,d),o&&c(this,ct).call(this,d),f$1))}else r&&(r.get="miss");}delete(e){return f(this,a,rt).call(this,e,"delete")}clear(){return f(this,a,Vt).call(this,"delete")}};q=new WeakMap,M=new WeakMap,K=new WeakMap,lt=new WeakMap,$=new WeakMap,vt=new WeakMap,_t=new WeakMap,Y=new WeakMap,E=new WeakMap,B=new WeakMap,A=new WeakMap,w=new WeakMap,p=new WeakMap,F=new WeakMap,V=new WeakMap,j=new WeakMap,T=new WeakMap,X=new WeakMap,U=new WeakMap,J=new WeakMap,Q=new WeakMap,G=new WeakMap,Z=new WeakMap,ot=new WeakMap,R=new WeakMap,yt=new WeakMap,a=new WeakSet,Pt=function(){let e$1=new mt(c(this,q)),i=new mt(c(this,q));e(this,G,e$1),e(this,Q,i),e(this,At,(n,r,d=c(this,Y).now())=>{if(i[n]=r!==0?d:0,e$1[n]=r,r!==0&&this.ttlAutopurge){let f$1=setTimeout(()=>{c(this,W).call(this,n)&&f(this,a,rt).call(this,c(this,w)[n],"expire");},r+1);f$1.unref&&f$1.unref();}}),e(this,ct,n=>{i[n]=e$1[n]!==0?c(this,Y).now():0;}),e(this,et,(n,r)=>{if(e$1[r]){let d=e$1[r],f=i[r];if(!d||!f)return;n.ttl=d,n.start=f,n.now=s||o();let x=n.now-f;n.remainingTTL=d-x;}});let s=0,o=()=>{let n=c(this,Y).now();if(this.ttlResolution>0){s=n;let r=setTimeout(()=>s=0,this.ttlResolution);r.unref&&r.unref();}return n};this.getRemainingTTL=n=>{let r=c(this,A).get(n);if(r===void 0)return 0;let d=e$1[r],f=i[r];if(!d||!f)return 1/0;let x=(s||o())-f;return d-x},e(this,W,n=>{let r=i[n],d=e$1[n];return !!d&&!!r&&(s||o())-r>d});},ct=new WeakMap,et=new WeakMap,At=new WeakMap,W=new WeakMap,ee=function(){let e$1=new mt(c(this,q));e(this,B,0),e(this,J,e$1),e(this,ft,i=>{e(this,B,c(this,B)-e$1[i]),e$1[i]=0;}),e(this,Et,(i,s,o,n)=>{if(f(this,a,b).call(this,s))return 0;if(!it(o))if(n){if(typeof n!="function")throw new TypeError("sizeCalculation must be a function");if(o=n(s,i),!it(o))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 o}),e(this,St,(i,s,o)=>{if(e$1[i]=s,c(this,M)){let n=c(this,M)-e$1[i];for(;c(this,B)>n;)f(this,a,Ct).call(this,true);}e(this,B,c(this,B)+e$1[i]),o&&(o.entrySize=s,o.totalCalculatedSize=c(this,B));});},ft=new WeakMap,St=new WeakMap,Et=new WeakMap,st=function*({allowStale:e=this.allowStale}={}){if(c(this,E))for(let i=c(this,T);!(!f(this,a,Nt).call(this,i)||((e||!c(this,W).call(this,i))&&(yield i),i===c(this,j)));)i=c(this,V)[i];},nt=function*({allowStale:e=this.allowStale}={}){if(c(this,E))for(let i=c(this,j);!(!f(this,a,Nt).call(this,i)||((e||!c(this,W).call(this,i))&&(yield i),i===c(this,T)));)i=c(this,F)[i];},Nt=function(e){return e!==void 0&&c(this,A).get(c(this,w)[e])===e},Ct=function(e$1){var n;let i=c(this,j),s=c(this,w)[i],o=c(this,p)[i];return c(this,ot)&&f(this,a,b).call(this,o)?o.__abortController.abort(new Error("evicted")):(c(this,Z)||c(this,R))&&(c(this,Z)&&((n=c(this,K))==null||n.call(this,o,s,"evict")),c(this,R)&&c(this,U)?.push([o,s,"evict"])),c(this,ft).call(this,i),e$1&&(c(this,w)[i]=void 0,c(this,p)[i]=void 0,c(this,X).push(i)),c(this,E)===1?(e(this,j,e(this,T,0)),c(this,X).length=0):e(this,j,c(this,F)[i]),c(this,A).delete(s),g(this,E)._--,i},Dt=function(e,i,s,o){let n=i===void 0?void 0:c(this,p)[i];if(f(this,a,b).call(this,n))return n;let r=new jt,{signal:d}=s;d?.addEventListener("abort",()=>r.abort(d.reason),{signal:r.signal});let f$1={signal:r.signal,options:s,context:o},x=(_,y=false)=>{let{aborted:m}=r.signal,L=s.ignoreFetchAbort&&_!==void 0;if(s.status&&(m&&!y?(s.status.fetchAborted=true,s.status.fetchError=r.signal.reason,L&&(s.status.fetchAbortIgnored=true)):s.status.fetchResolved=true),m&&!L&&!y)return l(r.signal.reason);let P=O;return c(this,p)[i]===O&&(_===void 0?P.__staleWhileFetching!==void 0?c(this,p)[i]=P.__staleWhileFetching:f(this,a,rt).call(this,e,"fetch"):(s.status&&(s.status.fetchUpdated=true),this.set(e,_,f$1.options))),_},k=_=>(s.status&&(s.status.fetchRejected=true,s.status.fetchError=_),l(_)),l=_=>{let{aborted:y}=r.signal,m=y&&s.allowStaleOnFetchAbort,L=m||s.allowStaleOnFetchRejection,P=L||s.noDeleteOnFetchRejection,C=O;if(c(this,p)[i]===O&&(!P||C.__staleWhileFetching===void 0?f(this,a,rt).call(this,e,"fetch"):m||(c(this,p)[i]=C.__staleWhileFetching)),L)return s.status&&C.__staleWhileFetching!==void 0&&(s.status.returnedStale=true),C.__staleWhileFetching;if(C.__returned===C)throw _},z=(_,y)=>{var L;let m=(L=c(this,vt))==null?void 0:L.call(this,e,n,f$1);m&&m instanceof Promise&&m.then(P=>_(P===void 0?void 0:P),y),r.signal.addEventListener("abort",()=>{(!s.ignoreFetchAbort||s.allowStaleOnFetchAbort)&&(_(void 0),s.allowStaleOnFetchAbort&&(_=P=>x(P,true)));});};s.status&&(s.status.fetchDispatched=true);let O=new Promise(z).then(x,k),u=Object.assign(O,{__abortController:r,__staleWhileFetching:n,__returned:void 0});return i===void 0?(this.set(e,u,{...f$1.options,status:void 0}),i=c(this,A).get(e)):c(this,p)[i]=u,u},b=function(e){if(!c(this,ot))return false;let i=e;return !!i&&i instanceof Promise&&i.hasOwnProperty("__staleWhileFetching")&&i.__abortController instanceof jt},Mt=function(e,i){c(this,V)[i]=e,c(this,F)[e]=i;},xt=function(e$1){e$1!==c(this,T)&&(e$1===c(this,j)?e(this,j,c(this,F)[e$1]):f(this,a,Mt).call(this,c(this,V)[e$1],c(this,F)[e$1]),f(this,a,Mt).call(this,c(this,T),e$1),e(this,T,e$1));},rt=function(e$1,i){var o,n;let s=false;if(c(this,E)!==0){let r=c(this,A).get(e$1);if(r!==void 0)if(s=true,c(this,E)===1)f(this,a,Vt).call(this,i);else {c(this,ft).call(this,r);let d=c(this,p)[r];if(f(this,a,b).call(this,d)?d.__abortController.abort(new Error("deleted")):(c(this,Z)||c(this,R))&&(c(this,Z)&&((o=c(this,K))==null||o.call(this,d,e$1,i)),c(this,R)&&c(this,U)?.push([d,e$1,i])),c(this,A).delete(e$1),c(this,w)[r]=void 0,c(this,p)[r]=void 0,r===c(this,T))e(this,T,c(this,V)[r]);else if(r===c(this,j))e(this,j,c(this,F)[r]);else {let f=c(this,V)[r];c(this,F)[f]=c(this,F)[r];let x=c(this,F)[r];c(this,V)[x]=c(this,V)[r];}g(this,E)._--,c(this,X).push(r);}}if(c(this,R)&&c(this,U)?.length){let r=c(this,U),d;for(;d=r?.shift();)(n=c(this,$))==null||n.call(this,...d);}return s},Vt=function(e$1){var i,s;for(let o of f(this,a,nt).call(this,{allowStale:true})){let n=c(this,p)[o];if(f(this,a,b).call(this,n))n.__abortController.abort(new Error("deleted"));else {let r=c(this,w)[o];c(this,Z)&&((i=c(this,K))==null||i.call(this,n,r,e$1)),c(this,R)&&c(this,U)?.push([n,r,e$1]);}}if(c(this,A).clear(),c(this,p).fill(void 0),c(this,w).fill(void 0),c(this,G)&&c(this,Q)&&(c(this,G).fill(0),c(this,Q).fill(0)),c(this,J)&&c(this,J).fill(0),e(this,j,0),e(this,T,0),c(this,X).length=0,e(this,B,0),e(this,E,0),c(this,R)&&c(this,U)){let o=c(this,U),n;for(;n=o?.shift();)(s=c(this,$))==null||s.call(this,...n);}};var Ft=Gt;var Rt=class{constructor(e){b$1(this,"cache");b$1(this,"map",new Map);this.cache=new Ft({max:e.cacheSize}),this.map=new Map;}get[Symbol.iterator](){return this.map[Symbol.iterator]}get[Symbol.toStringTag](){return this.map[Symbol.toStringTag]}clear(){return this.cache.clear(),this.map.clear()}delete(e){let i=this.map.delete(e);return i&&this.cache.delete(e),i}get forEach(){return this.map.forEach}get(e){let i=this.cache.get(e);return i||this.map.get(e)}has(e){return this.map.has(e)}set(e,i){return this.map.set(e,i),this.cache.set(e,i),this}get size(){return this.map.size}entries(){return this.map.entries()}keys(){return this.map.keys()}values(){return this.map.values()}};var Tt="1.3.26";var Wt="repeat";function Ht(v){return {type:"pause",duration:v}}var kt="__game_layer__";var ie={};var qt={};a$1(qt,{createExportableElement:()=>se});var bt;(o=>(o.log=(n,...r)=>console.log(`[Pixi\u2019VN] ${n}`,...r),o.warn=(n,...r)=>console.warn(`[Pixi\u2019VN] ${n}`,...r),o.error=(n,...r)=>console.error(`[Pixi\u2019VN] ${n}`,...r),o.info=(n,...r)=>console.info(`[Pixi\u2019VN] ${n}`,...r)))(bt||(bt={}));function se(v){try{if(typeof v>"u")return v;let e=JSON.stringify(v);return JSON.parse(e)}catch(e){throw bt.error("Error creating exportable element",v,e),new Error("[Pixi\u2019VN] Error creating exportable element")}}function ne(){console.info(`
|
|
1
|
+
import {b as b$1,d,a as a$1,c,e,f,g}from'./chunk-TTRUPDAB.mjs';import*as I from'@drincs/pixi-vn/canvas';export*from'@drincs/pixi-vn/canvas';import*as Yt from'@drincs/pixi-vn/characters';export*from'@drincs/pixi-vn/characters';import*as tt from'@drincs/pixi-vn/history';export*from'@drincs/pixi-vn/history';import*as D from'@drincs/pixi-vn/narration';export*from'@drincs/pixi-vn/narration';import {Rectangle,Assets}from'@drincs/pixi-vn/pixi.js';export{Assets,Rectangle,Texture,UPDATE_PRIORITY}from'@drincs/pixi-vn/pixi.js';import*as at from'@drincs/pixi-vn/sound';export*from'@drincs/pixi-vn/sound';import*as N from'@drincs/pixi-vn/storage';export*from'@drincs/pixi-vn/storage';import {GameUnifier}from'@drincs/pixi-vn/unifier';export*from'@drincs/pixi-vn/unifier';var oe=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,Qt=new Set,zt=typeof process=="object"&&process?process:{},Zt=(v,e,i,s)=>{typeof zt.emitWarning=="function"?zt.emitWarning(v,e,i,s):console.error(`[${i}] ${e}: ${v}`);},jt=globalThis.AbortController,Bt=globalThis.AbortSignal;if(typeof jt>"u"){Bt=class{constructor(){b$1(this,"onabort");b$1(this,"_onabort",[]);b$1(this,"reason");b$1(this,"aborted",false);}addEventListener(s,o){this._onabort.push(o);}},jt=class{constructor(){b$1(this,"signal",new Bt);e();}abort(s){if(!this.signal.aborted){this.signal.reason=s,this.signal.aborted=true;for(let o of this.signal._onabort)o(s);this.signal.onabort?.(s);}}};let v=zt.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{v&&(v=false,Zt("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 ae=v=>!Qt.has(v),it=v=>v&&v===Math.floor(v)&&v>0&&isFinite(v),te=v=>it(v)?v<=Math.pow(2,8)?Uint8Array:v<=Math.pow(2,16)?Uint16Array:v<=Math.pow(2,32)?Uint32Array:v<=Number.MAX_SAFE_INTEGER?mt:null:null,mt=class extends Array{constructor(e){super(e),this.fill(0);}},gt,ht=class ht{constructor(e,i){b$1(this,"heap");b$1(this,"length");if(!c(ht,gt))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new i(e),this.length=0;}static create(e$1){let i=te(e$1);if(!i)return [];e(ht,gt,true);let s=new ht(e$1,i);return e(ht,gt,false),s}push(e){this.heap[this.length++]=e;}pop(){return this.heap[--this.length]}};gt=new WeakMap,d(ht,gt,false);var Lt=ht,Xt,Jt,q,M,K,lt,$,vt,_t,Y,E,B,A,w,p,F,V,j,T,X,U,J,Q,G,Z,ot,R,yt,a,Pt,ct,et,At,W,ee,ft,St,Et,st,nt,Nt,Ct,Dt,b,Mt,xt,rt,Vt,Gt=class Gt{constructor(e$1){d(this,a);d(this,q);d(this,M);d(this,K);d(this,lt);d(this,$);d(this,vt);d(this,_t);d(this,Y);b$1(this,"ttl");b$1(this,"ttlResolution");b$1(this,"ttlAutopurge");b$1(this,"updateAgeOnGet");b$1(this,"updateAgeOnHas");b$1(this,"allowStale");b$1(this,"noDisposeOnSet");b$1(this,"noUpdateTTL");b$1(this,"maxEntrySize");b$1(this,"sizeCalculation");b$1(this,"noDeleteOnFetchRejection");b$1(this,"noDeleteOnStaleGet");b$1(this,"allowStaleOnFetchAbort");b$1(this,"allowStaleOnFetchRejection");b$1(this,"ignoreFetchAbort");d(this,E);d(this,B);d(this,A);d(this,w);d(this,p);d(this,F);d(this,V);d(this,j);d(this,T);d(this,X);d(this,U);d(this,J);d(this,Q);d(this,G);d(this,Z);d(this,ot);d(this,R);d(this,yt);d(this,ct,()=>{});d(this,et,()=>{});d(this,At,()=>{});d(this,W,()=>false);d(this,ft,e=>{});d(this,St,(e,i,s)=>{});d(this,Et,(e,i,s,o)=>{if(s||o)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});b$1(this,Xt,"LRUCache");let{max:i=0,ttl:s,ttlResolution:o=1,ttlAutopurge:n,updateAgeOnGet:r,updateAgeOnHas:d$1,allowStale:f$1,dispose:x,onInsert:k,disposeAfter:l,noDisposeOnSet:z,noUpdateTTL:O,maxSize:u=0,maxEntrySize:_=0,sizeCalculation:y,fetchMethod:m,memoMethod:L,noDeleteOnFetchRejection:P,noDeleteOnStaleGet:C,allowStaleOnFetchRejection:H,allowStaleOnFetchAbort:wt,ignoreFetchAbort:dt,perf:Ut}=e$1;if(Ut!==void 0&&typeof Ut?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(e(this,Y,Ut??oe),i!==0&&!it(i))throw new TypeError("max option must be a nonnegative integer");let ut=i?te(i):Array;if(!ut)throw new Error("invalid max value: "+i);if(e(this,q,i),e(this,M,u),this.maxEntrySize=_||c(this,M),this.sizeCalculation=y,this.sizeCalculation){if(!c(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(L!==void 0&&typeof L!="function")throw new TypeError("memoMethod must be a function if defined");if(e(this,_t,L),m!==void 0&&typeof m!="function")throw new TypeError("fetchMethod must be a function if specified");if(e(this,vt,m),e(this,ot,!!m),e(this,A,new Map),e(this,w,new Array(i).fill(void 0)),e(this,p,new Array(i).fill(void 0)),e(this,F,new ut(i)),e(this,V,new ut(i)),e(this,j,0),e(this,T,0),e(this,X,Lt.create(i)),e(this,E,0),e(this,B,0),typeof x=="function"&&e(this,K,x),typeof k=="function"&&e(this,lt,k),typeof l=="function"?(e(this,$,l),e(this,U,[])):(e(this,$,void 0),e(this,U,void 0)),e(this,Z,!!c(this,K)),e(this,yt,!!c(this,lt)),e(this,R,!!c(this,$)),this.noDisposeOnSet=!!z,this.noUpdateTTL=!!O,this.noDeleteOnFetchRejection=!!P,this.allowStaleOnFetchRejection=!!H,this.allowStaleOnFetchAbort=!!wt,this.ignoreFetchAbort=!!dt,this.maxEntrySize!==0){if(c(this,M)!==0&&!it(c(this,M)))throw new TypeError("maxSize must be a positive integer if specified");if(!it(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");f(this,a,ee).call(this);}if(this.allowStale=!!f$1,this.noDeleteOnStaleGet=!!C,this.updateAgeOnGet=!!r,this.updateAgeOnHas=!!d$1,this.ttlResolution=it(o)||o===0?o:1,this.ttlAutopurge=!!n,this.ttl=s||0,this.ttl){if(!it(this.ttl))throw new TypeError("ttl must be a positive integer if specified");f(this,a,Pt).call(this);}if(c(this,q)===0&&this.ttl===0&&c(this,M)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!c(this,q)&&!c(this,M)){let pt="LRU_CACHE_UNBOUNDED";ae(pt)&&(Qt.add(pt),Zt("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",pt,Gt));}}get perf(){return c(this,Y)}static unsafeExposeInternals(e){return {starts:c(e,Q),ttls:c(e,G),sizes:c(e,J),keyMap:c(e,A),keyList:c(e,w),valList:c(e,p),next:c(e,F),prev:c(e,V),get head(){return c(e,j)},get tail(){return c(e,T)},free:c(e,X),isBackgroundFetch:i=>{var s;return f(s=e,a,b).call(s,i)},backgroundFetch:(i,s,o,n)=>{var r;return f(r=e,a,Dt).call(r,i,s,o,n)},moveToTail:i=>{var s;return f(s=e,a,xt).call(s,i)},indexes:i=>{var s;return f(s=e,a,st).call(s,i)},rindexes:i=>{var s;return f(s=e,a,nt).call(s,i)},isStale:i=>{var s;return c(s=e,W).call(s,i)}}}get max(){return c(this,q)}get maxSize(){return c(this,M)}get calculatedSize(){return c(this,B)}get size(){return c(this,E)}get fetchMethod(){return c(this,vt)}get memoMethod(){return c(this,_t)}get dispose(){return c(this,K)}get onInsert(){return c(this,lt)}get disposeAfter(){return c(this,$)}getRemainingTTL(e){return c(this,A).has(e)?1/0:0}*entries(){for(let e of f(this,a,st).call(this))c(this,p)[e]!==void 0&&c(this,w)[e]!==void 0&&!f(this,a,b).call(this,c(this,p)[e])&&(yield [c(this,w)[e],c(this,p)[e]]);}*rentries(){for(let e of f(this,a,nt).call(this))c(this,p)[e]!==void 0&&c(this,w)[e]!==void 0&&!f(this,a,b).call(this,c(this,p)[e])&&(yield [c(this,w)[e],c(this,p)[e]]);}*keys(){for(let e of f(this,a,st).call(this)){let i=c(this,w)[e];i!==void 0&&!f(this,a,b).call(this,c(this,p)[e])&&(yield i);}}*rkeys(){for(let e of f(this,a,nt).call(this)){let i=c(this,w)[e];i!==void 0&&!f(this,a,b).call(this,c(this,p)[e])&&(yield i);}}*values(){for(let e of f(this,a,st).call(this))c(this,p)[e]!==void 0&&!f(this,a,b).call(this,c(this,p)[e])&&(yield c(this,p)[e]);}*rvalues(){for(let e of f(this,a,nt).call(this))c(this,p)[e]!==void 0&&!f(this,a,b).call(this,c(this,p)[e])&&(yield c(this,p)[e]);}[(Jt=Symbol.iterator,Xt=Symbol.toStringTag,Jt)](){return this.entries()}find(e,i={}){for(let s of f(this,a,st).call(this)){let o=c(this,p)[s],n=f(this,a,b).call(this,o)?o.__staleWhileFetching:o;if(n!==void 0&&e(n,c(this,w)[s],this))return this.get(c(this,w)[s],i)}}forEach(e,i=this){for(let s of f(this,a,st).call(this)){let o=c(this,p)[s],n=f(this,a,b).call(this,o)?o.__staleWhileFetching:o;n!==void 0&&e.call(i,n,c(this,w)[s],this);}}rforEach(e,i=this){for(let s of f(this,a,nt).call(this)){let o=c(this,p)[s],n=f(this,a,b).call(this,o)?o.__staleWhileFetching:o;n!==void 0&&e.call(i,n,c(this,w)[s],this);}}purgeStale(){let e=false;for(let i of f(this,a,nt).call(this,{allowStale:true}))c(this,W).call(this,i)&&(f(this,a,rt).call(this,c(this,w)[i],"expire"),e=true);return e}info(e){let i=c(this,A).get(e);if(i===void 0)return;let s=c(this,p)[i],o=f(this,a,b).call(this,s)?s.__staleWhileFetching:s;if(o===void 0)return;let n={value:o};if(c(this,G)&&c(this,Q)){let r=c(this,G)[i],d=c(this,Q)[i];if(r&&d){let f=r-(c(this,Y).now()-d);n.ttl=f,n.start=Date.now();}}return c(this,J)&&(n.size=c(this,J)[i]),n}dump(){let e=[];for(let i of f(this,a,st).call(this,{allowStale:true})){let s=c(this,w)[i],o=c(this,p)[i],n=f(this,a,b).call(this,o)?o.__staleWhileFetching:o;if(n===void 0||s===void 0)continue;let r={value:n};if(c(this,G)&&c(this,Q)){r.ttl=c(this,G)[i];let d=c(this,Y).now()-c(this,Q)[i];r.start=Math.floor(Date.now()-d);}c(this,J)&&(r.size=c(this,J)[i]),e.unshift([s,r]);}return e}load(e){this.clear();for(let[i,s]of e){if(s.start){let o=Date.now()-s.start;s.start=c(this,Y).now()-o;}this.set(i,s.value,s);}}set(e$1,i,s={}){var z,O,u,_;if(i===void 0)return this.delete(e$1),this;let{ttl:o=this.ttl,start:n,noDisposeOnSet:r=this.noDisposeOnSet,sizeCalculation:d=this.sizeCalculation,status:f$1}=s,{noUpdateTTL:x=this.noUpdateTTL}=s,k=c(this,Et).call(this,e$1,i,s.size||0,d);if(this.maxEntrySize&&k>this.maxEntrySize)return f$1&&(f$1.set="miss",f$1.maxEntrySizeExceeded=true),f(this,a,rt).call(this,e$1,"set"),this;let l=c(this,E)===0?void 0:c(this,A).get(e$1);if(l===void 0)l=c(this,E)===0?c(this,T):c(this,X).length!==0?c(this,X).pop():c(this,E)===c(this,q)?f(this,a,Ct).call(this,false):c(this,E),c(this,w)[l]=e$1,c(this,p)[l]=i,c(this,A).set(e$1,l),c(this,F)[c(this,T)]=l,c(this,V)[l]=c(this,T),e(this,T,l),g(this,E)._++,c(this,St).call(this,l,k,f$1),f$1&&(f$1.set="add"),x=false,c(this,yt)&&((z=c(this,lt))==null||z.call(this,i,e$1,"add"));else {f(this,a,xt).call(this,l);let y=c(this,p)[l];if(i!==y){if(c(this,ot)&&f(this,a,b).call(this,y)){y.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:m}=y;m!==void 0&&!r&&(c(this,Z)&&((O=c(this,K))==null||O.call(this,m,e$1,"set")),c(this,R)&&c(this,U)?.push([m,e$1,"set"]));}else r||(c(this,Z)&&((u=c(this,K))==null||u.call(this,y,e$1,"set")),c(this,R)&&c(this,U)?.push([y,e$1,"set"]));if(c(this,ft).call(this,l),c(this,St).call(this,l,k,f$1),c(this,p)[l]=i,f$1){f$1.set="replace";let m=y&&f(this,a,b).call(this,y)?y.__staleWhileFetching:y;m!==void 0&&(f$1.oldValue=m);}}else f$1&&(f$1.set="update");c(this,yt)&&this.onInsert?.(i,e$1,i===y?"update":"replace");}if(o!==0&&!c(this,G)&&f(this,a,Pt).call(this),c(this,G)&&(x||c(this,At).call(this,l,o,n),f$1&&c(this,et).call(this,f$1,l)),!r&&c(this,R)&&c(this,U)){let y=c(this,U),m;for(;m=y?.shift();)(_=c(this,$))==null||_.call(this,...m);}return this}pop(){var e;try{for(;c(this,E);){let i=c(this,p)[c(this,j)];if(f(this,a,Ct).call(this,!0),f(this,a,b).call(this,i)){if(i.__staleWhileFetching)return i.__staleWhileFetching}else if(i!==void 0)return i}}finally{if(c(this,R)&&c(this,U)){let i=c(this,U),s;for(;s=i?.shift();)(e=c(this,$))==null||e.call(this,...s);}}}has(e,i={}){let{updateAgeOnHas:s=this.updateAgeOnHas,status:o}=i,n=c(this,A).get(e);if(n!==void 0){let r=c(this,p)[n];if(f(this,a,b).call(this,r)&&r.__staleWhileFetching===void 0)return false;if(c(this,W).call(this,n))o&&(o.has="stale",c(this,et).call(this,o,n));else return s&&c(this,ct).call(this,n),o&&(o.has="hit",c(this,et).call(this,o,n)),true}else o&&(o.has="miss");return false}peek(e,i={}){let{allowStale:s=this.allowStale}=i,o=c(this,A).get(e);if(o===void 0||!s&&c(this,W).call(this,o))return;let n=c(this,p)[o];return f(this,a,b).call(this,n)?n.__staleWhileFetching:n}async fetch(e,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:o=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,ttl:r=this.ttl,noDisposeOnSet:d=this.noDisposeOnSet,size:f$1=0,sizeCalculation:x=this.sizeCalculation,noUpdateTTL:k=this.noUpdateTTL,noDeleteOnFetchRejection:l=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:z=this.allowStaleOnFetchRejection,ignoreFetchAbort:O=this.ignoreFetchAbort,allowStaleOnFetchAbort:u=this.allowStaleOnFetchAbort,context:_,forceRefresh:y=false,status:m,signal:L}=i;if(!c(this,ot))return m&&(m.fetch="get"),this.get(e,{allowStale:s,updateAgeOnGet:o,noDeleteOnStaleGet:n,status:m});let P={allowStale:s,updateAgeOnGet:o,noDeleteOnStaleGet:n,ttl:r,noDisposeOnSet:d,size:f$1,sizeCalculation:x,noUpdateTTL:k,noDeleteOnFetchRejection:l,allowStaleOnFetchRejection:z,allowStaleOnFetchAbort:u,ignoreFetchAbort:O,status:m,signal:L},C=c(this,A).get(e);if(C===void 0){m&&(m.fetch="miss");let H=f(this,a,Dt).call(this,e,C,P,_);return H.__returned=H}else {let H=c(this,p)[C];if(f(this,a,b).call(this,H)){let pt=s&&H.__staleWhileFetching!==void 0;return m&&(m.fetch="inflight",pt&&(m.returnedStale=true)),pt?H.__staleWhileFetching:H.__returned=H}let wt=c(this,W).call(this,C);if(!y&&!wt)return m&&(m.fetch="hit"),f(this,a,xt).call(this,C),o&&c(this,ct).call(this,C),m&&c(this,et).call(this,m,C),H;let dt=f(this,a,Dt).call(this,e,C,P,_),ut=dt.__staleWhileFetching!==void 0&&s;return m&&(m.fetch=wt?"stale":"refresh",ut&&wt&&(m.returnedStale=true)),ut?dt.__staleWhileFetching:dt.__returned=dt}}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=c(this,_t);if(!s)throw new Error("no memoMethod provided to constructor");let{context:o,forceRefresh:n,...r}=i,d=this.get(e,r);if(!n&&d!==void 0)return d;let f=s(e,d,{options:r,context:o});return this.set(e,f,r),f}get(e,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:o=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,status:r}=i,d=c(this,A).get(e);if(d!==void 0){let f$1=c(this,p)[d],x=f(this,a,b).call(this,f$1);return r&&c(this,et).call(this,r,d),c(this,W).call(this,d)?(r&&(r.get="stale"),x?(r&&s&&f$1.__staleWhileFetching!==void 0&&(r.returnedStale=true),s?f$1.__staleWhileFetching:void 0):(n||f(this,a,rt).call(this,e,"expire"),r&&s&&(r.returnedStale=true),s?f$1:void 0)):(r&&(r.get="hit"),x?f$1.__staleWhileFetching:(f(this,a,xt).call(this,d),o&&c(this,ct).call(this,d),f$1))}else r&&(r.get="miss");}delete(e){return f(this,a,rt).call(this,e,"delete")}clear(){return f(this,a,Vt).call(this,"delete")}};q=new WeakMap,M=new WeakMap,K=new WeakMap,lt=new WeakMap,$=new WeakMap,vt=new WeakMap,_t=new WeakMap,Y=new WeakMap,E=new WeakMap,B=new WeakMap,A=new WeakMap,w=new WeakMap,p=new WeakMap,F=new WeakMap,V=new WeakMap,j=new WeakMap,T=new WeakMap,X=new WeakMap,U=new WeakMap,J=new WeakMap,Q=new WeakMap,G=new WeakMap,Z=new WeakMap,ot=new WeakMap,R=new WeakMap,yt=new WeakMap,a=new WeakSet,Pt=function(){let e$1=new mt(c(this,q)),i=new mt(c(this,q));e(this,G,e$1),e(this,Q,i),e(this,At,(n,r,d=c(this,Y).now())=>{if(i[n]=r!==0?d:0,e$1[n]=r,r!==0&&this.ttlAutopurge){let f$1=setTimeout(()=>{c(this,W).call(this,n)&&f(this,a,rt).call(this,c(this,w)[n],"expire");},r+1);f$1.unref&&f$1.unref();}}),e(this,ct,n=>{i[n]=e$1[n]!==0?c(this,Y).now():0;}),e(this,et,(n,r)=>{if(e$1[r]){let d=e$1[r],f=i[r];if(!d||!f)return;n.ttl=d,n.start=f,n.now=s||o();let x=n.now-f;n.remainingTTL=d-x;}});let s=0,o=()=>{let n=c(this,Y).now();if(this.ttlResolution>0){s=n;let r=setTimeout(()=>s=0,this.ttlResolution);r.unref&&r.unref();}return n};this.getRemainingTTL=n=>{let r=c(this,A).get(n);if(r===void 0)return 0;let d=e$1[r],f=i[r];if(!d||!f)return 1/0;let x=(s||o())-f;return d-x},e(this,W,n=>{let r=i[n],d=e$1[n];return !!d&&!!r&&(s||o())-r>d});},ct=new WeakMap,et=new WeakMap,At=new WeakMap,W=new WeakMap,ee=function(){let e$1=new mt(c(this,q));e(this,B,0),e(this,J,e$1),e(this,ft,i=>{e(this,B,c(this,B)-e$1[i]),e$1[i]=0;}),e(this,Et,(i,s,o,n)=>{if(f(this,a,b).call(this,s))return 0;if(!it(o))if(n){if(typeof n!="function")throw new TypeError("sizeCalculation must be a function");if(o=n(s,i),!it(o))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 o}),e(this,St,(i,s,o)=>{if(e$1[i]=s,c(this,M)){let n=c(this,M)-e$1[i];for(;c(this,B)>n;)f(this,a,Ct).call(this,true);}e(this,B,c(this,B)+e$1[i]),o&&(o.entrySize=s,o.totalCalculatedSize=c(this,B));});},ft=new WeakMap,St=new WeakMap,Et=new WeakMap,st=function*({allowStale:e=this.allowStale}={}){if(c(this,E))for(let i=c(this,T);!(!f(this,a,Nt).call(this,i)||((e||!c(this,W).call(this,i))&&(yield i),i===c(this,j)));)i=c(this,V)[i];},nt=function*({allowStale:e=this.allowStale}={}){if(c(this,E))for(let i=c(this,j);!(!f(this,a,Nt).call(this,i)||((e||!c(this,W).call(this,i))&&(yield i),i===c(this,T)));)i=c(this,F)[i];},Nt=function(e){return e!==void 0&&c(this,A).get(c(this,w)[e])===e},Ct=function(e$1){var n;let i=c(this,j),s=c(this,w)[i],o=c(this,p)[i];return c(this,ot)&&f(this,a,b).call(this,o)?o.__abortController.abort(new Error("evicted")):(c(this,Z)||c(this,R))&&(c(this,Z)&&((n=c(this,K))==null||n.call(this,o,s,"evict")),c(this,R)&&c(this,U)?.push([o,s,"evict"])),c(this,ft).call(this,i),e$1&&(c(this,w)[i]=void 0,c(this,p)[i]=void 0,c(this,X).push(i)),c(this,E)===1?(e(this,j,e(this,T,0)),c(this,X).length=0):e(this,j,c(this,F)[i]),c(this,A).delete(s),g(this,E)._--,i},Dt=function(e,i,s,o){let n=i===void 0?void 0:c(this,p)[i];if(f(this,a,b).call(this,n))return n;let r=new jt,{signal:d}=s;d?.addEventListener("abort",()=>r.abort(d.reason),{signal:r.signal});let f$1={signal:r.signal,options:s,context:o},x=(_,y=false)=>{let{aborted:m}=r.signal,L=s.ignoreFetchAbort&&_!==void 0;if(s.status&&(m&&!y?(s.status.fetchAborted=true,s.status.fetchError=r.signal.reason,L&&(s.status.fetchAbortIgnored=true)):s.status.fetchResolved=true),m&&!L&&!y)return l(r.signal.reason);let P=O;return c(this,p)[i]===O&&(_===void 0?P.__staleWhileFetching!==void 0?c(this,p)[i]=P.__staleWhileFetching:f(this,a,rt).call(this,e,"fetch"):(s.status&&(s.status.fetchUpdated=true),this.set(e,_,f$1.options))),_},k=_=>(s.status&&(s.status.fetchRejected=true,s.status.fetchError=_),l(_)),l=_=>{let{aborted:y}=r.signal,m=y&&s.allowStaleOnFetchAbort,L=m||s.allowStaleOnFetchRejection,P=L||s.noDeleteOnFetchRejection,C=O;if(c(this,p)[i]===O&&(!P||C.__staleWhileFetching===void 0?f(this,a,rt).call(this,e,"fetch"):m||(c(this,p)[i]=C.__staleWhileFetching)),L)return s.status&&C.__staleWhileFetching!==void 0&&(s.status.returnedStale=true),C.__staleWhileFetching;if(C.__returned===C)throw _},z=(_,y)=>{var L;let m=(L=c(this,vt))==null?void 0:L.call(this,e,n,f$1);m&&m instanceof Promise&&m.then(P=>_(P===void 0?void 0:P),y),r.signal.addEventListener("abort",()=>{(!s.ignoreFetchAbort||s.allowStaleOnFetchAbort)&&(_(void 0),s.allowStaleOnFetchAbort&&(_=P=>x(P,true)));});};s.status&&(s.status.fetchDispatched=true);let O=new Promise(z).then(x,k),u=Object.assign(O,{__abortController:r,__staleWhileFetching:n,__returned:void 0});return i===void 0?(this.set(e,u,{...f$1.options,status:void 0}),i=c(this,A).get(e)):c(this,p)[i]=u,u},b=function(e){if(!c(this,ot))return false;let i=e;return !!i&&i instanceof Promise&&i.hasOwnProperty("__staleWhileFetching")&&i.__abortController instanceof jt},Mt=function(e,i){c(this,V)[i]=e,c(this,F)[e]=i;},xt=function(e$1){e$1!==c(this,T)&&(e$1===c(this,j)?e(this,j,c(this,F)[e$1]):f(this,a,Mt).call(this,c(this,V)[e$1],c(this,F)[e$1]),f(this,a,Mt).call(this,c(this,T),e$1),e(this,T,e$1));},rt=function(e$1,i){var o,n;let s=false;if(c(this,E)!==0){let r=c(this,A).get(e$1);if(r!==void 0)if(s=true,c(this,E)===1)f(this,a,Vt).call(this,i);else {c(this,ft).call(this,r);let d=c(this,p)[r];if(f(this,a,b).call(this,d)?d.__abortController.abort(new Error("deleted")):(c(this,Z)||c(this,R))&&(c(this,Z)&&((o=c(this,K))==null||o.call(this,d,e$1,i)),c(this,R)&&c(this,U)?.push([d,e$1,i])),c(this,A).delete(e$1),c(this,w)[r]=void 0,c(this,p)[r]=void 0,r===c(this,T))e(this,T,c(this,V)[r]);else if(r===c(this,j))e(this,j,c(this,F)[r]);else {let f=c(this,V)[r];c(this,F)[f]=c(this,F)[r];let x=c(this,F)[r];c(this,V)[x]=c(this,V)[r];}g(this,E)._--,c(this,X).push(r);}}if(c(this,R)&&c(this,U)?.length){let r=c(this,U),d;for(;d=r?.shift();)(n=c(this,$))==null||n.call(this,...d);}return s},Vt=function(e$1){var i,s;for(let o of f(this,a,nt).call(this,{allowStale:true})){let n=c(this,p)[o];if(f(this,a,b).call(this,n))n.__abortController.abort(new Error("deleted"));else {let r=c(this,w)[o];c(this,Z)&&((i=c(this,K))==null||i.call(this,n,r,e$1)),c(this,R)&&c(this,U)?.push([n,r,e$1]);}}if(c(this,A).clear(),c(this,p).fill(void 0),c(this,w).fill(void 0),c(this,G)&&c(this,Q)&&(c(this,G).fill(0),c(this,Q).fill(0)),c(this,J)&&c(this,J).fill(0),e(this,j,0),e(this,T,0),c(this,X).length=0,e(this,B,0),e(this,E,0),c(this,R)&&c(this,U)){let o=c(this,U),n;for(;n=o?.shift();)(s=c(this,$))==null||s.call(this,...n);}};var Ft=Gt;var Rt=class{constructor(e){b$1(this,"cache");b$1(this,"map",new Map);this.cache=new Ft({max:e.cacheSize}),this.map=new Map;}get[Symbol.iterator](){return this.map[Symbol.iterator]}get[Symbol.toStringTag](){return this.map[Symbol.toStringTag]}clear(){return this.cache.clear(),this.map.clear()}delete(e){let i=this.map.delete(e);return i&&this.cache.delete(e),i}get forEach(){return this.map.forEach}get(e){let i=this.cache.get(e);return i||this.map.get(e)}has(e){return this.map.has(e)}set(e,i){return this.map.set(e,i),this.cache.set(e,i),this}get size(){return this.map.size}entries(){return this.map.entries()}keys(){return this.map.keys()}values(){return this.map.values()}};var Tt="1.3.27";var Wt="repeat";function Ht(v){return {type:"pause",duration:v}}var kt="__game_layer__";var ie={};var qt={};a$1(qt,{createExportableElement:()=>se});var bt;(o=>(o.log=(n,...r)=>console.log(`[Pixi\u2019VN] ${n}`,...r),o.warn=(n,...r)=>console.warn(`[Pixi\u2019VN] ${n}`,...r),o.error=(n,...r)=>console.error(`[Pixi\u2019VN] ${n}`,...r),o.info=(n,...r)=>console.info(`[Pixi\u2019VN] ${n}`,...r)))(bt||(bt={}));function se(v){try{if(typeof v>"u")return v;let e=JSON.stringify(v);return JSON.parse(e)}catch(e){throw bt.error("Error creating exportable element",v,e),new Error("[Pixi\u2019VN] Error creating exportable element")}}function ne(){console.info(`
|
|
2
2
|
_______ _ _ _ ____ ____ ____ _____
|
|
3
3
|
|_ __ \\ (_) (_) | | |_ _| |_ _||_ \\|_ _|
|
|
4
4
|
| |__) |__ _ __ __ \\_| \\ \\ / / | \\ | |
|
package/dist/narration.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';var unifier=require('@drincs/pixi-vn/unifier');var bt=Object.create;var He=Object.defineProperty;var mt=Object.getOwnPropertyDescriptor;var St=Object.getOwnPropertyNames;var gt=Object.getPrototypeOf,yt=Object.prototype.hasOwnProperty;var et=l=>{throw TypeError(l)};var _t=(l,e,t)=>e in l?He(l,e,{enumerable:true,configurable:true,writable:true,value:t}):l[e]=t;var Ke=(l=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(l,{get:(e,t)=>(typeof require<"u"?require:e)[t]}):l)(function(l){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+l+'" is not supported')});var tt=(l,e)=>()=>(e||l((e={exports:{}}).exports,e),e.exports);var Lt=(l,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of St(e))!yt.call(l,i)&&i!==t&&He(l,i,{get:()=>e[i],enumerable:!(n=mt(e,i))||n.enumerable});return l};var Tt=(l,e,t)=>(t=l!=null?bt(gt(l)):{},Lt(He(t,"default",{value:l,enumerable:true}),l));var y=(l,e,t)=>_t(l,typeof e!="symbol"?e+"":e,t),We=(l,e,t)=>e.has(l)||et("Cannot "+t);var r=(l,e,t)=>(We(l,e,"read from private field"),t?t.call(l):e.get(l)),w=(l,e,t)=>e.has(l)?et("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(l):e.set(l,t),m=(l,e,t,n)=>(We(l,e,"write to private field"),e.set(l,t),t),f=(l,e,t)=>(We(l,e,"access private method"),t);var De=(l,e,t,n)=>({set _(i){m(l,e,i);},get _(){return r(l,e,n)}});var ht=tt((ze,ut)=>{(function(l,e){typeof ze=="object"?ut.exports=ze=e():typeof define=="function"&&define.amd?define([],e):l.CryptoJS=e();})(ze,function(){var l=l||(function(e,t){var n;if(typeof window<"u"&&window.crypto&&(n=window.crypto),typeof self<"u"&&self.crypto&&(n=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(n=globalThis.crypto),!n&&typeof window<"u"&&window.msCrypto&&(n=window.msCrypto),!n&&typeof global<"u"&&global.crypto&&(n=global.crypto),!n&&typeof Ke=="function")try{n=Ke("crypto");}catch{}var i=function(){if(n){if(typeof n.getRandomValues=="function")try{return n.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof n.randomBytes=="function")try{return n.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},s=Object.create||(function(){function o(){}return function(d){var I;return o.prototype=d,I=new o,o.prototype=null,I}})(),a={},u=a.lib={},c=u.Base=(function(){return {extend:function(o){var d=s(this);return o&&d.mixIn(o),(!d.hasOwnProperty("init")||this.init===d.init)&&(d.init=function(){d.$super.init.apply(this,arguments);}),d.init.prototype=d,d.$super=this,d},create:function(){var o=this.extend();return o.init.apply(o,arguments),o},init:function(){},mixIn:function(o){for(var d in o)o.hasOwnProperty(d)&&(this[d]=o[d]);o.hasOwnProperty("toString")&&(this.toString=o.toString);},clone:function(){return this.init.prototype.extend(this)}}})(),E=u.WordArray=c.extend({init:function(o,d){o=this.words=o||[],d!=t?this.sigBytes=d:this.sigBytes=o.length*4;},toString:function(o){return (o||g).stringify(this)},concat:function(o){var d=this.words,I=o.words,_=this.sigBytes,x=o.sigBytes;if(this.clamp(),_%4)for(var U=0;U<x;U++){var ae=I[U>>>2]>>>24-U%4*8&255;d[_+U>>>2]|=ae<<24-(_+U)%4*8;}else for(var H=0;H<x;H+=4)d[_+H>>>2]=I[H>>>2];return this.sigBytes+=x,this},clamp:function(){var o=this.words,d=this.sigBytes;o[d>>>2]&=4294967295<<32-d%4*8,o.length=e.ceil(d/4);},clone:function(){var o=c.clone.call(this);return o.words=this.words.slice(0),o},random:function(o){for(var d=[],I=0;I<o;I+=4)d.push(i());return new E.init(d,o)}}),S=a.enc={},g=S.Hex={stringify:function(o){for(var d=o.words,I=o.sigBytes,_=[],x=0;x<I;x++){var U=d[x>>>2]>>>24-x%4*8&255;_.push((U>>>4).toString(16)),_.push((U&15).toString(16));}return _.join("")},parse:function(o){for(var d=o.length,I=[],_=0;_<d;_+=2)I[_>>>3]|=parseInt(o.substr(_,2),16)<<24-_%8*4;return new E.init(I,d/2)}},N=S.Latin1={stringify:function(o){for(var d=o.words,I=o.sigBytes,_=[],x=0;x<I;x++){var U=d[x>>>2]>>>24-x%4*8&255;_.push(String.fromCharCode(U));}return _.join("")},parse:function(o){for(var d=o.length,I=[],_=0;_<d;_++)I[_>>>2]|=(o.charCodeAt(_)&255)<<24-_%4*8;return new E.init(I,d)}},P=S.Utf8={stringify:function(o){try{return decodeURIComponent(escape(N.stringify(o)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(o){return N.parse(unescape(encodeURIComponent(o)))}},D=u.BufferedBlockAlgorithm=c.extend({reset:function(){this._data=new E.init,this._nDataBytes=0;},_append:function(o){typeof o=="string"&&(o=P.parse(o)),this._data.concat(o),this._nDataBytes+=o.sigBytes;},_process:function(o){var d,I=this._data,_=I.words,x=I.sigBytes,U=this.blockSize,ae=U*4,H=x/ae;o?H=e.ceil(H):H=e.max((H|0)-this._minBufferSize,0);var q=H*U,le=e.min(q*4,x);if(q){for(var Pe=0;Pe<q;Pe+=U)this._doProcessBlock(_,Pe);d=_.splice(0,q),I.sigBytes-=le;}return new E.init(d,le)},clone:function(){var o=c.clone.call(this);return o._data=this._data.clone(),o},_minBufferSize:0});u.Hasher=D.extend({cfg:c.extend(),init:function(o){this.cfg=this.cfg.extend(o),this.reset();},reset:function(){D.reset.call(this),this._doReset();},update:function(o){return this._append(o),this._process(),this},finalize:function(o){o&&this._append(o);var d=this._doFinalize();return d},blockSize:512/32,_createHelper:function(o){return function(d,I){return new o.init(I).finalize(d)}},_createHmacHelper:function(o){return function(d,I){return new C.HMAC.init(o,I).finalize(d)}}});var C=a.algo={};return a})(Math);return l});});var pt=tt((Ge,ct)=>{(function(l,e){typeof Ge=="object"?ct.exports=Ge=e(ht()):typeof define=="function"&&define.amd?define(["./core"],e):e(l.CryptoJS);})(Ge,function(l){return (function(){var e=l,t=e.lib,n=t.WordArray,i=t.Hasher,s=e.algo,a=[],u=s.SHA1=i.extend({_doReset:function(){this._hash=new n.init([1732584193,4023233417,2562383102,271733878,3285377520]);},_doProcessBlock:function(c,E){for(var S=this._hash.words,g=S[0],N=S[1],P=S[2],D=S[3],v=S[4],C=0;C<80;C++){if(C<16)a[C]=c[E+C]|0;else {var o=a[C-3]^a[C-8]^a[C-14]^a[C-16];a[C]=o<<1|o>>>31;}var d=(g<<5|g>>>27)+v+a[C];C<20?d+=(N&P|~N&D)+1518500249:C<40?d+=(N^P^D)+1859775393:C<60?d+=(N&P|N&D|P&D)-1894007588:d+=(N^P^D)-899497514,v=D,D=P,P=N<<30|N>>>2,N=g,g=d;}S[0]=S[0]+g|0,S[1]=S[1]+N|0,S[2]=S[2]+P|0,S[3]=S[3]+D|0,S[4]=S[4]+v|0;},_doFinalize:function(){var c=this._data,E=c.words,S=this._nDataBytes*8,g=c.sigBytes*8;return E[g>>>5]|=128<<24-g%32,E[(g+64>>>9<<4)+14]=Math.floor(S/4294967296),E[(g+64>>>9<<4)+15]=S,c.sigBytes=E.length*4,this._process(),this._hash},clone:function(){var c=i.clone.call(this);return c._hash=this._hash.clone(),c}});e.SHA1=i._createHelper(u),e.HmacSHA1=i._createHmacHelper(u);})(),l.SHA1});});var R={CURRENT_DIALOGUE_MEMORY_KEY:"___current_dialogue_memory___",LAST_DIALOGUE_ADDED_IN_STEP_MEMORY_KEY:"___last_dialogue_added_in_step_memory___",CURRENT_MENU_OPTIONS_MEMORY_KEY:"___current_menu_options_memory___",LAST_MENU_OPTIONS_ADDED_IN_STEP_MEMORY_KEY:"___last_menu_options_added_in_step_memory___",CURRENT_INPUT_VALUE_MEMORY_KEY:"_input_value_",LAST_INPUT_ADDED_IN_STEP_MEMORY_KEY:"___last_input_added_in_step_memory___",CURRENT_INPUT_INFO_MEMORY_KEY:"___current_input_info_memory___",CHARACTER_CATEGORY_KEY:"___character___",ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY:"___glue___",OPENED_LABELS_COUNTER_KEY:"___opened_labels_counter___",ALL_CHOICES_MADE_KEY:"___all_choices_made___",CURRENT_STEP_TIMES_COUNTER_KEY:"___current_step_times_counter___",LAST_STEP_GLUED:"___last_step_glued___"};var L;(i=>(i.log=(s,...a)=>console.log(`[Pixi\u2019VN] ${s}`,...a),i.warn=(s,...a)=>console.warn(`[Pixi\u2019VN] ${s}`,...a),i.error=(s,...a)=>console.error(`[Pixi\u2019VN] ${s}`,...a),i.info=(s,...a)=>console.info(`[Pixi\u2019VN] ${s}`,...a)))(L||(L={}));function oe(l){try{if(typeof l>"u")return l;let e=JSON.stringify(l);return JSON.parse(e)}catch(e){throw L.error("Error creating exportable element",l,e),new Error("[Pixi\u2019VN] Error creating exportable element")}}var Et=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,st=new Set,Be=typeof process=="object"&&process?process:{},at=(l,e,t,n)=>{typeof Be.emitWarning=="function"?Be.emitWarning(l,e,t,n):console.error(`[${t}] ${e}: ${l}`);},Fe=globalThis.AbortController,rt=globalThis.AbortSignal;if(typeof Fe>"u"){rt=class{constructor(){y(this,"onabort");y(this,"_onabort",[]);y(this,"reason");y(this,"aborted",false);}addEventListener(n,i){this._onabort.push(i);}},Fe=class{constructor(){y(this,"signal",new rt);e();}abort(n){if(!this.signal.aborted){this.signal.reason=n,this.signal.aborted=true;for(let i of this.signal._onabort)i(n);this.signal.onabort?.(n);}}};let l=Be.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{l&&(l=false,at("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 Ct=l=>!st.has(l),ce=l=>l&&l===Math.floor(l)&&l>0&&isFinite(l),ot=l=>ce(l)?l<=Math.pow(2,8)?Uint8Array:l<=Math.pow(2,16)?Uint16Array:l<=Math.pow(2,32)?Uint32Array:l<=Number.MAX_SAFE_INTEGER?_e:null:null,_e=class extends Array{constructor(e){super(e),this.fill(0);}},Le,me=class me{constructor(e,t){y(this,"heap");y(this,"length");if(!r(me,Le))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new t(e),this.length=0;}static create(e){let t=ot(e);if(!t)return [];m(me,Le,true);let n=new me(e,t);return m(me,Le,false),n}push(e){this.heap[this.length++]=e;}pop(){return this.heap[--this.length]}};Le=new WeakMap,w(me,Le,false);var je=me,nt,it,X,B,J,Se,Q,Te,Ee,Z,F,ee,Y,M,T,K,j,G,V,te,z,re,ne,$,ie,be,W,Ce,h,$e,ge,ue,Ae,k,lt,ye,Ie,Me,pe,de,ke,Ue,Ye,A,qe,ve,fe,Xe,Je=class Je{constructor(e){w(this,h);w(this,X);w(this,B);w(this,J);w(this,Se);w(this,Q);w(this,Te);w(this,Ee);w(this,Z);y(this,"ttl");y(this,"ttlResolution");y(this,"ttlAutopurge");y(this,"updateAgeOnGet");y(this,"updateAgeOnHas");y(this,"allowStale");y(this,"noDisposeOnSet");y(this,"noUpdateTTL");y(this,"maxEntrySize");y(this,"sizeCalculation");y(this,"noDeleteOnFetchRejection");y(this,"noDeleteOnStaleGet");y(this,"allowStaleOnFetchAbort");y(this,"allowStaleOnFetchRejection");y(this,"ignoreFetchAbort");w(this,F);w(this,ee);w(this,Y);w(this,M);w(this,T);w(this,K);w(this,j);w(this,G);w(this,V);w(this,te);w(this,z);w(this,re);w(this,ne);w(this,$);w(this,ie);w(this,be);w(this,W);w(this,Ce);w(this,ge,()=>{});w(this,ue,()=>{});w(this,Ae,()=>{});w(this,k,()=>false);w(this,ye,e=>{});w(this,Ie,(e,t,n)=>{});w(this,Me,(e,t,n,i)=>{if(n||i)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});y(this,nt,"LRUCache");let{max:t=0,ttl:n,ttlResolution:i=1,ttlAutopurge:s,updateAgeOnGet:a,updateAgeOnHas:u,allowStale:c,dispose:E,onInsert:S,disposeAfter:g,noDisposeOnSet:N,noUpdateTTL:P,maxSize:D=0,maxEntrySize:v=0,sizeCalculation:C,fetchMethod:o,memoMethod:d,noDeleteOnFetchRejection:I,noDeleteOnStaleGet:_,allowStaleOnFetchRejection:x,allowStaleOnFetchAbort:U,ignoreFetchAbort:ae,perf:H}=e;if(H!==void 0&&typeof H?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(m(this,Z,H??Et),t!==0&&!ce(t))throw new TypeError("max option must be a nonnegative integer");let q=t?ot(t):Array;if(!q)throw new Error("invalid max value: "+t);if(m(this,X,t),m(this,B,D),this.maxEntrySize=v||r(this,B),this.sizeCalculation=C,this.sizeCalculation){if(!r(this,B)&&!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(d!==void 0&&typeof d!="function")throw new TypeError("memoMethod must be a function if defined");if(m(this,Ee,d),o!==void 0&&typeof o!="function")throw new TypeError("fetchMethod must be a function if specified");if(m(this,Te,o),m(this,be,!!o),m(this,Y,new Map),m(this,M,new Array(t).fill(void 0)),m(this,T,new Array(t).fill(void 0)),m(this,K,new q(t)),m(this,j,new q(t)),m(this,G,0),m(this,V,0),m(this,te,je.create(t)),m(this,F,0),m(this,ee,0),typeof E=="function"&&m(this,J,E),typeof S=="function"&&m(this,Se,S),typeof g=="function"?(m(this,Q,g),m(this,z,[])):(m(this,Q,void 0),m(this,z,void 0)),m(this,ie,!!r(this,J)),m(this,Ce,!!r(this,Se)),m(this,W,!!r(this,Q)),this.noDisposeOnSet=!!N,this.noUpdateTTL=!!P,this.noDeleteOnFetchRejection=!!I,this.allowStaleOnFetchRejection=!!x,this.allowStaleOnFetchAbort=!!U,this.ignoreFetchAbort=!!ae,this.maxEntrySize!==0){if(r(this,B)!==0&&!ce(r(this,B)))throw new TypeError("maxSize must be a positive integer if specified");if(!ce(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");f(this,h,lt).call(this);}if(this.allowStale=!!c,this.noDeleteOnStaleGet=!!_,this.updateAgeOnGet=!!a,this.updateAgeOnHas=!!u,this.ttlResolution=ce(i)||i===0?i:1,this.ttlAutopurge=!!s,this.ttl=n||0,this.ttl){if(!ce(this.ttl))throw new TypeError("ttl must be a positive integer if specified");f(this,h,$e).call(this);}if(r(this,X)===0&&this.ttl===0&&r(this,B)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!r(this,X)&&!r(this,B)){let le="LRU_CACHE_UNBOUNDED";Ct(le)&&(st.add(le),at("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",le,Je));}}get perf(){return r(this,Z)}static unsafeExposeInternals(e){return {starts:r(e,ne),ttls:r(e,$),sizes:r(e,re),keyMap:r(e,Y),keyList:r(e,M),valList:r(e,T),next:r(e,K),prev:r(e,j),get head(){return r(e,G)},get tail(){return r(e,V)},free:r(e,te),isBackgroundFetch:t=>{var n;return f(n=e,h,A).call(n,t)},backgroundFetch:(t,n,i,s)=>{var a;return f(a=e,h,Ye).call(a,t,n,i,s)},moveToTail:t=>{var n;return f(n=e,h,ve).call(n,t)},indexes:t=>{var n;return f(n=e,h,pe).call(n,t)},rindexes:t=>{var n;return f(n=e,h,de).call(n,t)},isStale:t=>{var n;return r(n=e,k).call(n,t)}}}get max(){return r(this,X)}get maxSize(){return r(this,B)}get calculatedSize(){return r(this,ee)}get size(){return r(this,F)}get fetchMethod(){return r(this,Te)}get memoMethod(){return r(this,Ee)}get dispose(){return r(this,J)}get onInsert(){return r(this,Se)}get disposeAfter(){return r(this,Q)}getRemainingTTL(e){return r(this,Y).has(e)?1/0:0}*entries(){for(let e of f(this,h,pe).call(this))r(this,T)[e]!==void 0&&r(this,M)[e]!==void 0&&!f(this,h,A).call(this,r(this,T)[e])&&(yield [r(this,M)[e],r(this,T)[e]]);}*rentries(){for(let e of f(this,h,de).call(this))r(this,T)[e]!==void 0&&r(this,M)[e]!==void 0&&!f(this,h,A).call(this,r(this,T)[e])&&(yield [r(this,M)[e],r(this,T)[e]]);}*keys(){for(let e of f(this,h,pe).call(this)){let t=r(this,M)[e];t!==void 0&&!f(this,h,A).call(this,r(this,T)[e])&&(yield t);}}*rkeys(){for(let e of f(this,h,de).call(this)){let t=r(this,M)[e];t!==void 0&&!f(this,h,A).call(this,r(this,T)[e])&&(yield t);}}*values(){for(let e of f(this,h,pe).call(this))r(this,T)[e]!==void 0&&!f(this,h,A).call(this,r(this,T)[e])&&(yield r(this,T)[e]);}*rvalues(){for(let e of f(this,h,de).call(this))r(this,T)[e]!==void 0&&!f(this,h,A).call(this,r(this,T)[e])&&(yield r(this,T)[e]);}[(it=Symbol.iterator,nt=Symbol.toStringTag,it)](){return this.entries()}find(e,t={}){for(let n of f(this,h,pe).call(this)){let i=r(this,T)[n],s=f(this,h,A).call(this,i)?i.__staleWhileFetching:i;if(s!==void 0&&e(s,r(this,M)[n],this))return this.get(r(this,M)[n],t)}}forEach(e,t=this){for(let n of f(this,h,pe).call(this)){let i=r(this,T)[n],s=f(this,h,A).call(this,i)?i.__staleWhileFetching:i;s!==void 0&&e.call(t,s,r(this,M)[n],this);}}rforEach(e,t=this){for(let n of f(this,h,de).call(this)){let i=r(this,T)[n],s=f(this,h,A).call(this,i)?i.__staleWhileFetching:i;s!==void 0&&e.call(t,s,r(this,M)[n],this);}}purgeStale(){let e=false;for(let t of f(this,h,de).call(this,{allowStale:true}))r(this,k).call(this,t)&&(f(this,h,fe).call(this,r(this,M)[t],"expire"),e=true);return e}info(e){let t=r(this,Y).get(e);if(t===void 0)return;let n=r(this,T)[t],i=f(this,h,A).call(this,n)?n.__staleWhileFetching:n;if(i===void 0)return;let s={value:i};if(r(this,$)&&r(this,ne)){let a=r(this,$)[t],u=r(this,ne)[t];if(a&&u){let c=a-(r(this,Z).now()-u);s.ttl=c,s.start=Date.now();}}return r(this,re)&&(s.size=r(this,re)[t]),s}dump(){let e=[];for(let t of f(this,h,pe).call(this,{allowStale:true})){let n=r(this,M)[t],i=r(this,T)[t],s=f(this,h,A).call(this,i)?i.__staleWhileFetching:i;if(s===void 0||n===void 0)continue;let a={value:s};if(r(this,$)&&r(this,ne)){a.ttl=r(this,$)[t];let u=r(this,Z).now()-r(this,ne)[t];a.start=Math.floor(Date.now()-u);}r(this,re)&&(a.size=r(this,re)[t]),e.unshift([n,a]);}return e}load(e){this.clear();for(let[t,n]of e){if(n.start){let i=Date.now()-n.start;n.start=r(this,Z).now()-i;}this.set(t,n.value,n);}}set(e,t,n={}){var N,P,D,v;if(t===void 0)return this.delete(e),this;let{ttl:i=this.ttl,start:s,noDisposeOnSet:a=this.noDisposeOnSet,sizeCalculation:u=this.sizeCalculation,status:c}=n,{noUpdateTTL:E=this.noUpdateTTL}=n,S=r(this,Me).call(this,e,t,n.size||0,u);if(this.maxEntrySize&&S>this.maxEntrySize)return c&&(c.set="miss",c.maxEntrySizeExceeded=true),f(this,h,fe).call(this,e,"set"),this;let g=r(this,F)===0?void 0:r(this,Y).get(e);if(g===void 0)g=r(this,F)===0?r(this,V):r(this,te).length!==0?r(this,te).pop():r(this,F)===r(this,X)?f(this,h,Ue).call(this,false):r(this,F),r(this,M)[g]=e,r(this,T)[g]=t,r(this,Y).set(e,g),r(this,K)[r(this,V)]=g,r(this,j)[g]=r(this,V),m(this,V,g),De(this,F)._++,r(this,Ie).call(this,g,S,c),c&&(c.set="add"),E=false,r(this,Ce)&&((N=r(this,Se))==null||N.call(this,t,e,"add"));else {f(this,h,ve).call(this,g);let C=r(this,T)[g];if(t!==C){if(r(this,be)&&f(this,h,A).call(this,C)){C.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:o}=C;o!==void 0&&!a&&(r(this,ie)&&((P=r(this,J))==null||P.call(this,o,e,"set")),r(this,W)&&r(this,z)?.push([o,e,"set"]));}else a||(r(this,ie)&&((D=r(this,J))==null||D.call(this,C,e,"set")),r(this,W)&&r(this,z)?.push([C,e,"set"]));if(r(this,ye).call(this,g),r(this,Ie).call(this,g,S,c),r(this,T)[g]=t,c){c.set="replace";let o=C&&f(this,h,A).call(this,C)?C.__staleWhileFetching:C;o!==void 0&&(c.oldValue=o);}}else c&&(c.set="update");r(this,Ce)&&this.onInsert?.(t,e,t===C?"update":"replace");}if(i!==0&&!r(this,$)&&f(this,h,$e).call(this),r(this,$)&&(E||r(this,Ae).call(this,g,i,s),c&&r(this,ue).call(this,c,g)),!a&&r(this,W)&&r(this,z)){let C=r(this,z),o;for(;o=C?.shift();)(v=r(this,Q))==null||v.call(this,...o);}return this}pop(){var e;try{for(;r(this,F);){let t=r(this,T)[r(this,G)];if(f(this,h,Ue).call(this,!0),f(this,h,A).call(this,t)){if(t.__staleWhileFetching)return t.__staleWhileFetching}else if(t!==void 0)return t}}finally{if(r(this,W)&&r(this,z)){let t=r(this,z),n;for(;n=t?.shift();)(e=r(this,Q))==null||e.call(this,...n);}}}has(e,t={}){let{updateAgeOnHas:n=this.updateAgeOnHas,status:i}=t,s=r(this,Y).get(e);if(s!==void 0){let a=r(this,T)[s];if(f(this,h,A).call(this,a)&&a.__staleWhileFetching===void 0)return false;if(r(this,k).call(this,s))i&&(i.has="stale",r(this,ue).call(this,i,s));else return n&&r(this,ge).call(this,s),i&&(i.has="hit",r(this,ue).call(this,i,s)),true}else i&&(i.has="miss");return false}peek(e,t={}){let{allowStale:n=this.allowStale}=t,i=r(this,Y).get(e);if(i===void 0||!n&&r(this,k).call(this,i))return;let s=r(this,T)[i];return f(this,h,A).call(this,s)?s.__staleWhileFetching:s}async fetch(e,t={}){let{allowStale:n=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:s=this.noDeleteOnStaleGet,ttl:a=this.ttl,noDisposeOnSet:u=this.noDisposeOnSet,size:c=0,sizeCalculation:E=this.sizeCalculation,noUpdateTTL:S=this.noUpdateTTL,noDeleteOnFetchRejection:g=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:N=this.allowStaleOnFetchRejection,ignoreFetchAbort:P=this.ignoreFetchAbort,allowStaleOnFetchAbort:D=this.allowStaleOnFetchAbort,context:v,forceRefresh:C=false,status:o,signal:d}=t;if(!r(this,be))return o&&(o.fetch="get"),this.get(e,{allowStale:n,updateAgeOnGet:i,noDeleteOnStaleGet:s,status:o});let I={allowStale:n,updateAgeOnGet:i,noDeleteOnStaleGet:s,ttl:a,noDisposeOnSet:u,size:c,sizeCalculation:E,noUpdateTTL:S,noDeleteOnFetchRejection:g,allowStaleOnFetchRejection:N,allowStaleOnFetchAbort:D,ignoreFetchAbort:P,status:o,signal:d},_=r(this,Y).get(e);if(_===void 0){o&&(o.fetch="miss");let x=f(this,h,Ye).call(this,e,_,I,v);return x.__returned=x}else {let x=r(this,T)[_];if(f(this,h,A).call(this,x)){let le=n&&x.__staleWhileFetching!==void 0;return o&&(o.fetch="inflight",le&&(o.returnedStale=true)),le?x.__staleWhileFetching:x.__returned=x}let U=r(this,k).call(this,_);if(!C&&!U)return o&&(o.fetch="hit"),f(this,h,ve).call(this,_),i&&r(this,ge).call(this,_),o&&r(this,ue).call(this,o,_),x;let ae=f(this,h,Ye).call(this,e,_,I,v),q=ae.__staleWhileFetching!==void 0&&n;return o&&(o.fetch=U?"stale":"refresh",q&&U&&(o.returnedStale=true)),q?ae.__staleWhileFetching:ae.__returned=ae}}async forceFetch(e,t={}){let n=await this.fetch(e,t);if(n===void 0)throw new Error("fetch() returned undefined");return n}memo(e,t={}){let n=r(this,Ee);if(!n)throw new Error("no memoMethod provided to constructor");let{context:i,forceRefresh:s,...a}=t,u=this.get(e,a);if(!s&&u!==void 0)return u;let c=n(e,u,{options:a,context:i});return this.set(e,c,a),c}get(e,t={}){let{allowStale:n=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:s=this.noDeleteOnStaleGet,status:a}=t,u=r(this,Y).get(e);if(u!==void 0){let c=r(this,T)[u],E=f(this,h,A).call(this,c);return a&&r(this,ue).call(this,a,u),r(this,k).call(this,u)?(a&&(a.get="stale"),E?(a&&n&&c.__staleWhileFetching!==void 0&&(a.returnedStale=true),n?c.__staleWhileFetching:void 0):(s||f(this,h,fe).call(this,e,"expire"),a&&n&&(a.returnedStale=true),n?c:void 0)):(a&&(a.get="hit"),E?c.__staleWhileFetching:(f(this,h,ve).call(this,u),i&&r(this,ge).call(this,u),c))}else a&&(a.get="miss");}delete(e){return f(this,h,fe).call(this,e,"delete")}clear(){return f(this,h,Xe).call(this,"delete")}};X=new WeakMap,B=new WeakMap,J=new WeakMap,Se=new WeakMap,Q=new WeakMap,Te=new WeakMap,Ee=new WeakMap,Z=new WeakMap,F=new WeakMap,ee=new WeakMap,Y=new WeakMap,M=new WeakMap,T=new WeakMap,K=new WeakMap,j=new WeakMap,G=new WeakMap,V=new WeakMap,te=new WeakMap,z=new WeakMap,re=new WeakMap,ne=new WeakMap,$=new WeakMap,ie=new WeakMap,be=new WeakMap,W=new WeakMap,Ce=new WeakMap,h=new WeakSet,$e=function(){let e=new _e(r(this,X)),t=new _e(r(this,X));m(this,$,e),m(this,ne,t),m(this,Ae,(s,a,u=r(this,Z).now())=>{if(t[s]=a!==0?u:0,e[s]=a,a!==0&&this.ttlAutopurge){let c=setTimeout(()=>{r(this,k).call(this,s)&&f(this,h,fe).call(this,r(this,M)[s],"expire");},a+1);c.unref&&c.unref();}}),m(this,ge,s=>{t[s]=e[s]!==0?r(this,Z).now():0;}),m(this,ue,(s,a)=>{if(e[a]){let u=e[a],c=t[a];if(!u||!c)return;s.ttl=u,s.start=c,s.now=n||i();let E=s.now-c;s.remainingTTL=u-E;}});let n=0,i=()=>{let s=r(this,Z).now();if(this.ttlResolution>0){n=s;let a=setTimeout(()=>n=0,this.ttlResolution);a.unref&&a.unref();}return s};this.getRemainingTTL=s=>{let a=r(this,Y).get(s);if(a===void 0)return 0;let u=e[a],c=t[a];if(!u||!c)return 1/0;let E=(n||i())-c;return u-E},m(this,k,s=>{let a=t[s],u=e[s];return !!u&&!!a&&(n||i())-a>u});},ge=new WeakMap,ue=new WeakMap,Ae=new WeakMap,k=new WeakMap,lt=function(){let e=new _e(r(this,X));m(this,ee,0),m(this,re,e),m(this,ye,t=>{m(this,ee,r(this,ee)-e[t]),e[t]=0;}),m(this,Me,(t,n,i,s)=>{if(f(this,h,A).call(this,n))return 0;if(!ce(i))if(s){if(typeof s!="function")throw new TypeError("sizeCalculation must be a function");if(i=s(n,t),!ce(i))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 i}),m(this,Ie,(t,n,i)=>{if(e[t]=n,r(this,B)){let s=r(this,B)-e[t];for(;r(this,ee)>s;)f(this,h,Ue).call(this,true);}m(this,ee,r(this,ee)+e[t]),i&&(i.entrySize=n,i.totalCalculatedSize=r(this,ee));});},ye=new WeakMap,Ie=new WeakMap,Me=new WeakMap,pe=function*({allowStale:e=this.allowStale}={}){if(r(this,F))for(let t=r(this,V);!(!f(this,h,ke).call(this,t)||((e||!r(this,k).call(this,t))&&(yield t),t===r(this,G)));)t=r(this,j)[t];},de=function*({allowStale:e=this.allowStale}={}){if(r(this,F))for(let t=r(this,G);!(!f(this,h,ke).call(this,t)||((e||!r(this,k).call(this,t))&&(yield t),t===r(this,V)));)t=r(this,K)[t];},ke=function(e){return e!==void 0&&r(this,Y).get(r(this,M)[e])===e},Ue=function(e){var s;let t=r(this,G),n=r(this,M)[t],i=r(this,T)[t];return r(this,be)&&f(this,h,A).call(this,i)?i.__abortController.abort(new Error("evicted")):(r(this,ie)||r(this,W))&&(r(this,ie)&&((s=r(this,J))==null||s.call(this,i,n,"evict")),r(this,W)&&r(this,z)?.push([i,n,"evict"])),r(this,ye).call(this,t),e&&(r(this,M)[t]=void 0,r(this,T)[t]=void 0,r(this,te).push(t)),r(this,F)===1?(m(this,G,m(this,V,0)),r(this,te).length=0):m(this,G,r(this,K)[t]),r(this,Y).delete(n),De(this,F)._--,t},Ye=function(e,t,n,i){let s=t===void 0?void 0:r(this,T)[t];if(f(this,h,A).call(this,s))return s;let a=new Fe,{signal:u}=n;u?.addEventListener("abort",()=>a.abort(u.reason),{signal:a.signal});let c={signal:a.signal,options:n,context:i},E=(v,C=false)=>{let{aborted:o}=a.signal,d=n.ignoreFetchAbort&&v!==void 0;if(n.status&&(o&&!C?(n.status.fetchAborted=true,n.status.fetchError=a.signal.reason,d&&(n.status.fetchAbortIgnored=true)):n.status.fetchResolved=true),o&&!d&&!C)return g(a.signal.reason);let I=P;return r(this,T)[t]===P&&(v===void 0?I.__staleWhileFetching!==void 0?r(this,T)[t]=I.__staleWhileFetching:f(this,h,fe).call(this,e,"fetch"):(n.status&&(n.status.fetchUpdated=true),this.set(e,v,c.options))),v},S=v=>(n.status&&(n.status.fetchRejected=true,n.status.fetchError=v),g(v)),g=v=>{let{aborted:C}=a.signal,o=C&&n.allowStaleOnFetchAbort,d=o||n.allowStaleOnFetchRejection,I=d||n.noDeleteOnFetchRejection,_=P;if(r(this,T)[t]===P&&(!I||_.__staleWhileFetching===void 0?f(this,h,fe).call(this,e,"fetch"):o||(r(this,T)[t]=_.__staleWhileFetching)),d)return n.status&&_.__staleWhileFetching!==void 0&&(n.status.returnedStale=true),_.__staleWhileFetching;if(_.__returned===_)throw v},N=(v,C)=>{var d;let o=(d=r(this,Te))==null?void 0:d.call(this,e,s,c);o&&o instanceof Promise&&o.then(I=>v(I===void 0?void 0:I),C),a.signal.addEventListener("abort",()=>{(!n.ignoreFetchAbort||n.allowStaleOnFetchAbort)&&(v(void 0),n.allowStaleOnFetchAbort&&(v=I=>E(I,true)));});};n.status&&(n.status.fetchDispatched=true);let P=new Promise(N).then(E,S),D=Object.assign(P,{__abortController:a,__staleWhileFetching:s,__returned:void 0});return t===void 0?(this.set(e,D,{...c.options,status:void 0}),t=r(this,Y).get(e)):r(this,T)[t]=D,D},A=function(e){if(!r(this,be))return false;let t=e;return !!t&&t instanceof Promise&&t.hasOwnProperty("__staleWhileFetching")&&t.__abortController instanceof Fe},qe=function(e,t){r(this,j)[t]=e,r(this,K)[e]=t;},ve=function(e){e!==r(this,V)&&(e===r(this,G)?m(this,G,r(this,K)[e]):f(this,h,qe).call(this,r(this,j)[e],r(this,K)[e]),f(this,h,qe).call(this,r(this,V),e),m(this,V,e));},fe=function(e,t){var i,s;let n=false;if(r(this,F)!==0){let a=r(this,Y).get(e);if(a!==void 0)if(n=true,r(this,F)===1)f(this,h,Xe).call(this,t);else {r(this,ye).call(this,a);let u=r(this,T)[a];if(f(this,h,A).call(this,u)?u.__abortController.abort(new Error("deleted")):(r(this,ie)||r(this,W))&&(r(this,ie)&&((i=r(this,J))==null||i.call(this,u,e,t)),r(this,W)&&r(this,z)?.push([u,e,t])),r(this,Y).delete(e),r(this,M)[a]=void 0,r(this,T)[a]=void 0,a===r(this,V))m(this,V,r(this,j)[a]);else if(a===r(this,G))m(this,G,r(this,K)[a]);else {let c=r(this,j)[a];r(this,K)[c]=r(this,K)[a];let E=r(this,K)[a];r(this,j)[E]=r(this,j)[a];}De(this,F)._--,r(this,te).push(a);}}if(r(this,W)&&r(this,z)?.length){let a=r(this,z),u;for(;u=a?.shift();)(s=r(this,Q))==null||s.call(this,...u);}return n},Xe=function(e){var t,n;for(let i of f(this,h,de).call(this,{allowStale:true})){let s=r(this,T)[i];if(f(this,h,A).call(this,s))s.__abortController.abort(new Error("deleted"));else {let a=r(this,M)[i];r(this,ie)&&((t=r(this,J))==null||t.call(this,s,a,e)),r(this,W)&&r(this,z)?.push([s,a,e]);}}if(r(this,Y).clear(),r(this,T).fill(void 0),r(this,M).fill(void 0),r(this,$)&&r(this,ne)&&(r(this,$).fill(0),r(this,ne).fill(0)),r(this,re)&&r(this,re).fill(0),m(this,G,0),m(this,V,0),r(this,te).length=0,m(this,ee,0),m(this,F,0),r(this,W)&&r(this,z)){let i=r(this,z),s;for(;s=i?.shift();)(n=r(this,Q))==null||n.call(this,...s);}};var Ve=Je;var Re=class{constructor(e){y(this,"cache");y(this,"map",new Map);this.cache=new Ve({max:e.cacheSize}),this.map=new Map;}get[Symbol.iterator](){return this.map[Symbol.iterator]}get[Symbol.toStringTag](){return this.map[Symbol.toStringTag]}clear(){return this.cache.clear(),this.map.clear()}delete(e){let t=this.map.delete(e);return t&&this.cache.delete(e),t}get forEach(){return this.map.forEach}get(e){let t=this.cache.get(e);return t||this.map.get(e)}has(e){return this.map.has(e)}set(e,t){return this.map.set(e,t),this.cache.set(e,t),this}get size(){return this.map.size}entries(){return this.map.entries()}keys(){return this.map.keys()}values(){return this.map.values()}};var Oe=new Re({cacheSize:10}),Qe;(s=>{function l(a){let u=Oe.get(a);if(!u){L.error(`Label "${a}" not found`);return}return u}s.get=l;function e(a){if(Array.isArray(a)){a.forEach(u=>e(u));return}Oe.has(a.id)&&L.info(`Label "${a.id}" already exists, it will be overwritten`),Oe.set(a.id,a);}s.add=e;function t(){return Array.from(Oe.values())}s.values=t;function n(a){return Oe.has(a)}s.has=n;function i(){return Array.from(Oe.keys())}s.keys=i;})(Qe||(Qe={}));var se=Qe;var b=class b{constructor(){}static get allOpenedLabels(){return unifier.GameUnifier.getVariable(R.OPENED_LABELS_COUNTER_KEY)||{}}static set allOpenedLabels(e){unifier.GameUnifier.setVariable(R.OPENED_LABELS_COUNTER_KEY,e);}static getCurrentStepTimesCounterData(e=""){let t=b.currentLabelStepIndex;if(t===null)return L.error("currentLabelStepIndex is null"),null;let n=`${t}${e}`,i=b.currentLabelId,s=b._currentLabel;if(!i||t===null||!s)return L.error("currentLabelId or currentLabelStepIndex is null or currentLabel not found"),null;let a=s.getStepSha(t)||"error",u=unifier.GameUnifier.getVariable(R.CURRENT_STEP_TIMES_COUNTER_KEY)||{};return u[i]||(u[i]={}),(!u[i][n]||u[i][n].stepSha1!=a)&&(u[i][n]={stepSha1:a}),u[i][n]}static setCurrentStepTimesCounterData(e="",t){let n=b.currentLabelStepIndex,i=n+e,s=b.currentLabelId;if(!s||n===null){L.error("currentLabelId or currentLabelStepIndex is null");return}let a=unifier.GameUnifier.getVariable(R.CURRENT_STEP_TIMES_COUNTER_KEY)||{};a[s]||(a[s]={}),a[s][i]=t,unifier.GameUnifier.setVariable(R.CURRENT_STEP_TIMES_COUNTER_KEY,a);}static getCurrentStepTimesCounter(e=""){let t=b._stepCounter,n=b.getCurrentStepTimesCounterData(e);if(!n)return L.error("getCurrentStepTimesCounter obj is null"),0;let i=n.stepCounters||n.lastStepIndexs||[];return i.find(a=>a===t)||(i.push(t),delete n.lastStepIndexs,n.stepCounters=i,b.setCurrentStepTimesCounterData(e,n)),i.length}static getRandomNumber(e,t,n={}){let i=n.nestedId||"";if(n.onceOnly||false){let a=b.getCurrentStepTimesCounterData(i);if(!a)return;let u=a.usedRandomNumbers||{},c=Array.from({length:t-e+1},(g,N)=>N+e).filter(g=>!u[`${e}-${t}`]?.includes(g));if(c.length===0)return;let E=Math.floor(Math.random()*c.length),S=c[E];return u[`${e}-${t}`]||(u[`${e}-${t}`]=[]),u[`${e}-${t}`].push(S),a.usedRandomNumbers=u,b.setCurrentStepTimesCounterData(i,a),S}return Math.floor(Math.random()*(t-e+1))+e}static resetCurrentStepTimesCounter(e=""){let t=b.currentLabelStepIndex,n=t+e,i=b.currentLabelId;if(!i||t===null){L.error("currentLabelId or currentLabelStepIndex is null");return}let s=unifier.GameUnifier.getVariable(R.CURRENT_STEP_TIMES_COUNTER_KEY)||{};s[i]||(s[i]={}),s[i][n]={stepCounters:[],stepSha1:""},unifier.GameUnifier.setVariable(R.CURRENT_STEP_TIMES_COUNTER_KEY,s);}static get allChoicesMade(){return unifier.GameUnifier.getVariable(R.ALL_CHOICES_MADE_KEY)||[]}static set allChoicesMade(e){unifier.GameUnifier.setVariable(R.ALL_CHOICES_MADE_KEY,e);}static increaseStepCounter(){b._stepCounter++;}static get openedLabels(){return oe(b._openedLabels)}static set openedLabels(e){b._openedLabels=oe(e);}static get originalOpenedLabels(){return oe(b._originalOpenedLabels)}static set originalOpenedLabels(e){b._originalOpenedLabels=oe(e);}static get _currentLabel(){if(b.currentLabelId)return se.get(b.currentLabelId)}static get currentLabelId(){if(b._openedLabels.length>0)return b._openedLabels[b._openedLabels.length-1].label}static get currentLabelStepIndex(){return b._openedLabels.length>0?b._openedLabels[b._openedLabels.length-1].currentStepIndex:null}static addLabelHistory(e,t){let n=b.allOpenedLabels,i=b.allOpenedLabels[e]?.biggestStep||0,s=b.allOpenedLabels[e]?.openCount||0;(!i||i<t)&&(n[e]={biggestStep:t,openCount:s},b.allOpenedLabels=n);}static addChoicesMade(e,t,n,i){let s=b.allChoicesMade,a=s.findIndex(u=>u.labelId===e&&u.stepIndex===t&&u.choiceIndex===i&&u.stepSha1===n);a<0?s.push({labelId:e,stepIndex:t,choiceIndex:i,stepSha1:n,madeTimes:1}):s[a].madeTimes++,b.allChoicesMade=s;}static pushNewLabel(e){if(!se.get(e))throw new Error(`[Pixi\u2019VN] Label ${e} not found`);b._openedLabels.push({label:e,currentStepIndex:0});let n=b.allOpenedLabels,i=b.allOpenedLabels[e]?.biggestStep||0,s=b.allOpenedLabels[e]?.openCount||0;n[e]={biggestStep:i,openCount:s+1},b.allOpenedLabels=n;}static increaseCurrentStepIndex(){if(b._openedLabels.length>0){let e=b._openedLabels[b._openedLabels.length-1];b._openedLabels[b._openedLabels.length-1]={...e,currentStepIndex:e.currentStepIndex+1};}}static set onStepStart(e){b._onStepStart=e;}static get onStepStart(){return async(e,t)=>{let n=[];return b.onLoadingLabel&&e===0&&n.push(b.onLoadingLabel(e,t)),b._onStepStart&&n.push(b._onStepStart(e,t)),await Promise.all(n)}}};y(b,"stepsRunning",0),y(b,"continueRequests",0),y(b,"choiceMadeTemp"),y(b,"lastHistoryStep",null),y(b,"_stepCounter",0),y(b,"_openedLabels",[]),y(b,"_originalOpenedLabels",[]),y(b,"_onStepStart"),y(b,"onLoadingLabel"),y(b,"onStepEnd");var p=b;var Ne=class{get currentStepTimesCounter(){return p.getCurrentStepTimesCounter()}set currentStepTimesCounter(e){p.resetCurrentStepTimesCounter();}getRandomNumber(e,t,n={}){return p.getRandomNumber(e,t,n)}get stepCounter(){return p._stepCounter}get openedLabels(){return p.openedLabels}get currentLabel(){return p._currentLabel}addStepHistory(e,t={}){let{choiceMade:n,ignoreSameStep:i}=t,s,a,u,c=unifier.GameUnifier.getVariable(R.LAST_STEP_GLUED)===this.stepCounter;unifier.GameUnifier.getVariable(R.LAST_DIALOGUE_ADDED_IN_STEP_MEMORY_KEY)===this.stepCounter&&(s=unifier.GameUnifier.getVariable(R.CURRENT_DIALOGUE_MEMORY_KEY)),unifier.GameUnifier.getVariable(R.LAST_MENU_OPTIONS_ADDED_IN_STEP_MEMORY_KEY)===this.stepCounter&&(a=unifier.GameUnifier.getVariable(R.CURRENT_MENU_OPTIONS_MEMORY_KEY)),unifier.GameUnifier.getVariable(R.LAST_INPUT_ADDED_IN_STEP_MEMORY_KEY)===this.stepCounter&&(u=unifier.GameUnifier.getVariable(R.CURRENT_INPUT_VALUE_MEMORY_KEY));let E=p.openedLabels,S={currentLabel:p.currentLabelId,dialogue:s,choices:a,stepSha1:e,index:this.stepCounter,labelStepIndex:p.currentLabelStepIndex,choiceIndexMade:n,inputValue:u,alreadyMadeChoices:this.alreadyCurrentStepMadeChoices,isGlued:c,openedLabels:E};p.originalOpenedLabels=E,unifier.GameUnifier.addHistoryItem(S,{ignoreSameStep:i}),p.lastHistoryStep=S,p.increaseStepCounter();}closeCurrentLabel(){if(!p.currentLabelId){L.warn("No label to close");return}if(!this.currentLabel){L.error("currentLabel not found");return}let e=p.openedLabels;e.pop(),p.openedLabels=e,unifier.GameUnifier.onLabelClosing(this.openedLabels.length);}closeAllLabels(){for(;p.openedLabels.length>0;)this.closeCurrentLabel(),unifier.GameUnifier.onLabelClosing(this.openedLabels.length);}isLabelAlreadyCompleted(e){let t;typeof e=="string"?t=e:t=e.id;let i=p.allOpenedLabels[t]?.biggestStep||0;if(i){let s=se.get(t);if(s)return s.stepCount<=i}return false}get alreadyCurrentStepMadeChoicesObj(){let e=p.currentLabelStepIndex,t=this.currentLabel;if(e===null||!t)return;let n=t.getStepSha(e);return n||(L.warn("stepSha not found, setting to ERROR"),n="error"),p.allChoicesMade.filter(i=>i.labelId===t?.id&&i.stepIndex===e&&i.stepSha1===n)}get alreadyCurrentStepMadeChoices(){return this.alreadyCurrentStepMadeChoicesObj?.map(e=>e.choiceIndex)}get isCurrentStepAlreadyOpened(){let e=p.currentLabelId;if(e){let t=p.allOpenedLabels[e]?.openCount||0;if(p.currentLabelStepIndex&&t>=p.currentLabelStepIndex)return true}return false}getTimesLabelOpened(e){return p.allOpenedLabels[e]?.openCount||0}getTimesChoiceMade(e){return this.alreadyCurrentStepMadeChoicesObj?.find(t=>t.choiceIndex===e)?.madeTimes||0}addCurrentStepToHistory(){this.addStepHistory("dev",{ignoreSameStep:true});}getCanContinue(e){let t=e?.showWarn||false,n=this.choices;return n&&n.length>0?(t&&L.warn("The player must make a choice"),false):this.isRequiredInput?(t&&L.warn("The player must enter a value"),false):true}get canContinue(){return p.stepsRunning!==0?false:this.getCanContinue()}get canGoNext(){return this.canContinue}async onStepRun(e,t){let n=[];return e.onStepStart&&n.push(e.onStepStart(t,e)),p.onStepStart&&n.push(p.onStepStart(t,e)),await Promise.all(n)}async onStepEnd(e,t){let n=[];return e.onStepEnd&&n.push(e.onStepEnd(t,e)),p.onStepEnd&&n.push(p.onStepEnd(t,e)),await Promise.all(n)}async goNext(e,t={}){return await this.continue(e,t)}async continue(e,t={}){let{runNow:n=false}=t;if(!(!n&&!this.getCanContinue({showWarn:true}))){if(!n&&p.stepsRunning!==0){p.continueRequests++;return}try{this.currentLabel&&await this.onStepEnd(this.currentLabel,p.currentLabelStepIndex||0);}catch(i){L.error("Error running onStepEnd",i);}return p.stepsRunning===0&&await unifier.GameUnifier.onGoNextEnd(),p.increaseCurrentStepIndex(),await this.runCurrentStep(e,t)}}async runCurrentStep(e,t={}){let{choiceMade:n}=t;if(p.currentLabelId){let i=p.currentLabelStepIndex;if(i===null){L.error("currentLabelStepIndex is null");return}let s=p._currentLabel;if(!s){L.error("currentLabel not found");return}if(s.stepCount>i){try{await this.onStepRun(s,i);}catch(c){L.error("Error running onStepStart",c),this.onStepError&&this.onStepError(c,e);return}let a=s.getStepById(i);if(!a){L.error("step not found");return}let u=s.getStepSha(i);u||(L.warn("stepSha not found, setting to ERROR"),u="error");try{p.stepsRunning++;let c=await a(e,{labelId:s.id}),E=this.choices;if(E?.length===1&&E[0].autoSelect){let g=E[0];c=await this.selectChoice(g,e);}let S=p.lastHistoryStep;if(n!==void 0&&S){let g=S.stepSha1;g||(L.warn("stepSha not found, setting to ERROR"),g="error"),p.addChoicesMade(S.currentLabel||"error",typeof S.labelStepIndex=="number"?S.labelStepIndex:-1,S.stepSha1||"error",n),p.choiceMadeTemp=n;}return p.stepsRunning--,p.stepsRunning===0&&(p.addLabelHistory(s.id,i),this.addStepHistory(u,{...t,choiceMade:p.choiceMadeTemp}),p.choiceMadeTemp=void 0,p.continueRequests>0)?(p.continueRequests--,await this.continue(e)):c}catch(c){p.stepsRunning>0&&p.stepsRunning--,L.error("Error running step",c),this.onStepError&&this.onStepError(c,e);return}}else {if(this.openedLabels.length>1)return this.closeCurrentLabel(),await this.continue(e,t);if(this.openedLabels.length===1)return p.openedLabels=[],unifier.GameUnifier.onEnd?await unifier.GameUnifier.onEnd(e,{labelId:"end"}):void 0}}else if(this.openedLabels.length===0){if(p.openedLabels=p.originalOpenedLabels,unifier.GameUnifier.onEnd)return await unifier.GameUnifier.onEnd(e,{labelId:"end"});L.error("The end of the game is not managed, so the game is blocked. Read this documentation to know how to manage the end of the game: https://pixi-vn.web.app/start/other-narrative-features.html#how-manage-the-end-of-the-game");return}else L.error("currentLabelId not found");}async callLabel(e,t,n){return await this.call(e,t,n)}async call(e,t,n){let{choiceMade:i}=n||{},s;typeof e=="string"?s=e:s=e.id;try{let a=se.get(s);if(!a)throw new Error(`[Pixi\u2019VN] Label ${s} not found`);try{this.currentLabel&&await this.onStepEnd(this.currentLabel,p.currentLabelStepIndex||0);}catch(u){L.error("Error running onStepEnd",u);}p.pushNewLabel(a.id);}catch(a){L.error("Error calling label",a);return}return await this.runCurrentStep(t,{choiceMade:i})}async jumpLabel(e,t,n){return await this.jump(e,t,n)}async jump(e,t,n){this.openedLabels.length>0&&this.closeCurrentLabel();let{choiceMade:i}=n||{},s;typeof e=="string"?s=e:s=e.id;try{let a=se.get(s);if(!a)throw new Error(`[Pixi\u2019VN] Label ${s} not found`);try{this.currentLabel&&await this.onStepEnd(this.currentLabel,p.currentLabelStepIndex||0);}catch(u){L.error("Error running onStepEnd",u);}p.pushNewLabel(a.id);}catch(a){L.error("Error jumping label",a);return}return await this.runCurrentStep(t,{choiceMade:i})}async selectChoice(e,t){this.choices=void 0;let n=e.type;switch(n){case "call":return await this.call(e.label,{...e.props,...t},{choiceMade:e.choiceIndex});case "jump":return await this.jump(e.label,{...e.props,...t},{choiceMade:e.choiceIndex});case "close":return await this.closeChoiceMenu(e,{...e.props,...t});default:throw L.error(`Type ${n} not found`),new Error(`[Pixi\u2019VN] Type ${n} not found`)}}async closeChoiceMenu(e,t){if(e.type!=="close")throw L.error("For closeChoiceMenu, the type must be close"),new Error("[Pixi\u2019VN] For closeChoiceMenu, the type must be close");let n;return typeof e.choiceIndex=="number"&&(n=e.choiceIndex),e.closeCurrentLabel&&this.closeCurrentLabel(),this.continue(t,{choiceMade:n})}get onStepError(){let e=unifier.GameUnifier.onError;return e?(t,n)=>e("step",t,n):void 0}set onStepError(e){unifier.GameUnifier.onError=(t,n,i)=>e(n,i);}get dialogue(){let e=unifier.GameUnifier.getVariable(R.CURRENT_DIALOGUE_MEMORY_KEY);if(e)return {...e,character:e.character?unifier.GameUnifier.getCharacter(e.character)||e.character:void 0}}set dialogue(e){if(e===void 0){unifier.GameUnifier.setVariable(R.CURRENT_DIALOGUE_MEMORY_KEY,void 0);return}if((typeof e=="string"||Array.isArray(e))&&(e={text:e}),this.dialogGlue){let t=unifier.GameUnifier.getVariable(R.CURRENT_DIALOGUE_MEMORY_KEY);if(t){let n=[];Array.isArray(t.text)?n=[...t.text]:n=[t.text],Array.isArray(e.text)?n=[...n,...e.text]:n=[...n,e.text],e.text=n,e.character=e.character||t.character;}unifier.GameUnifier.setVariable(R.LAST_STEP_GLUED,this.stepCounter),this.dialogGlue=false;}try{unifier.GameUnifier.setVariable(R.CURRENT_DIALOGUE_MEMORY_KEY,oe({...e,character:typeof e.character=="string"?e.character:e.character?.id})),unifier.GameUnifier.setVariable(R.LAST_DIALOGUE_ADDED_IN_STEP_MEMORY_KEY,this.stepCounter);}catch(t){throw L.error("DialogueInterface cannot contain functions or classes"),t}}get choiceMenuOptions(){return this.choices}get choices(){let e=unifier.GameUnifier.getVariable(R.CURRENT_MENU_OPTIONS_MEMORY_KEY);if(e){let t=[],n=e.map((s,a)=>({...s,choiceIndex:a})),i=this.alreadyCurrentStepMadeChoices;if(n=n.filter((s,a)=>s.oneTime&&i&&i.includes(a)?false:s.onlyHaveNoChoice?(t.push(s),false):true),n.length>0)return n;if(t.length>0)return [t[0]]}}set choiceMenuOptions(e){this.choices=e;}set choices(e){if(!e||e.length===0){unifier.GameUnifier.setVariable(R.CURRENT_MENU_OPTIONS_MEMORY_KEY,void 0);return}try{unifier.GameUnifier.setVariable(R.CURRENT_MENU_OPTIONS_MEMORY_KEY,oe(e)),unifier.GameUnifier.setVariable(R.LAST_MENU_OPTIONS_ADDED_IN_STEP_MEMORY_KEY,this.stepCounter);}catch(t){throw L.error("ChoiceInterface cannot contain functions or classes"),t}}get dialogGlue(){return unifier.GameUnifier.getFlag(R.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY)}set dialogGlue(e){unifier.GameUnifier.setFlag(R.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,e);}get inputValue(){return unifier.GameUnifier.getVariable(R.CURRENT_INPUT_VALUE_MEMORY_KEY)}set inputValue(e){this.removeInputRequest(),unifier.GameUnifier.setVariable(R.CURRENT_INPUT_VALUE_MEMORY_KEY,e),unifier.GameUnifier.setVariable(R.LAST_INPUT_ADDED_IN_STEP_MEMORY_KEY,this.stepCounter);}get isRequiredInput(){return unifier.GameUnifier.getVariable(R.CURRENT_INPUT_INFO_MEMORY_KEY)?.isRequired||false}get inputType(){return unifier.GameUnifier.getVariable(R.CURRENT_INPUT_INFO_MEMORY_KEY)?.type}requestInput(e,t){e.isRequired=true,unifier.GameUnifier.setVariable(R.CURRENT_INPUT_INFO_MEMORY_KEY,e),t!==void 0?unifier.GameUnifier.setVariable(R.CURRENT_INPUT_VALUE_MEMORY_KEY,t):unifier.GameUnifier.removeVariable(R.CURRENT_INPUT_VALUE_MEMORY_KEY);}removeInputRequest(){unifier.GameUnifier.removeVariable(R.CURRENT_INPUT_INFO_MEMORY_KEY),unifier.GameUnifier.removeVariable(R.CURRENT_INPUT_VALUE_MEMORY_KEY);}clear(){p.openedLabels=[],p._stepCounter=0;}export(){return {openedLabels:oe(p.openedLabels),stepCounter:this.stepCounter}}async onLoadingLabel(e){let t=this.openedLabels.map(async n=>{let i=[],s=se.get(n.label);return s&&(s.onLoadingLabel&&i.push(s.onLoadingLabel(e,s)),p.onLoadingLabel&&i.push(p.onLoadingLabel(e,s))),await Promise.all(i)});return await Promise.all(t)}async restore(e,t){this.clear();try{p.lastHistoryStep=t,e.hasOwnProperty("openedLabels")?(p.openedLabels=e.openedLabels,p.originalOpenedLabels=p.openedLabels):L.warn("Could not import openedLabels data, so will be ignored"),e.hasOwnProperty("stepCounter")?p._stepCounter=e.stepCounter:e.hasOwnProperty("lastStepIndex")?p._stepCounter=e.lastStepIndex:L.warn("Could not import stepCounter data, so will be ignored");try{await this.onLoadingLabel(p.currentLabelStepIndex||0);}catch(n){L.error("Error running onLoadingLabel",n);}}catch(n){L.error("Error importing data",n);}}};function Rt(l,e,t,n){let i=typeof e=="string"?e:e.id;return {...n,label:i,props:t,text:l,type:n?.type||"call"}}var Ze="close";function Ot(l,e){return {...e,type:Ze,text:l}}var dt=Tt(pt());var we=class{constructor(e,t){y(this,"_id");y(this,"_onStepStart");y(this,"_onLoadingLabel");y(this,"_onStepEnd");this._id=e,this._onStepStart=t?.onStepStart,this._onLoadingLabel=t?.onLoadingLabel,this._onStepEnd=t?.onStepEnd;}get id(){return this._id}get onStepStart(){return async(e,t)=>{if(this._onLoadingLabel&&e===0&&await this._onLoadingLabel(e,t),this._onStepStart)return await this._onStepStart(e,t)}}get onLoadingLabel(){return this._onLoadingLabel}get onStepEnd(){return this._onStepEnd}};var xe=class extends we{constructor(t,n,i){super(t,i);y(this,"_steps");this._steps=n;}get stepCount(){return this.steps.length}getStepById(t){return this.steps[t]}get steps(){return typeof this._steps=="function"?this._steps():this._steps}getStepSha(t){if(t<0||t>=this.steps.length)return L.warn("stepSha not found, setting to ERROR"),"error";try{let n=this.steps[t];return (0,dt.default)(n.toString().toLocaleLowerCase()).toString()}catch(n){return L.warn("stepSha not found, setting to ERROR",n),"error"}}};function ft(l,e,t){let n=new xe(l,e,t);return se.add(n),n}var Or=new Ne;
|
|
1
|
+
'use strict';var unifier=require('@drincs/pixi-vn/unifier');var bt=Object.create;var He=Object.defineProperty;var mt=Object.getOwnPropertyDescriptor;var St=Object.getOwnPropertyNames;var gt=Object.getPrototypeOf,yt=Object.prototype.hasOwnProperty;var et=l=>{throw TypeError(l)};var _t=(l,e,t)=>e in l?He(l,e,{enumerable:true,configurable:true,writable:true,value:t}):l[e]=t;var Ke=(l=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(l,{get:(e,t)=>(typeof require<"u"?require:e)[t]}):l)(function(l){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+l+'" is not supported')});var tt=(l,e)=>()=>(e||l((e={exports:{}}).exports,e),e.exports);var Lt=(l,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of St(e))!yt.call(l,i)&&i!==t&&He(l,i,{get:()=>e[i],enumerable:!(n=mt(e,i))||n.enumerable});return l};var Tt=(l,e,t)=>(t=l!=null?bt(gt(l)):{},Lt(He(t,"default",{value:l,enumerable:true}),l));var y=(l,e,t)=>_t(l,typeof e!="symbol"?e+"":e,t),We=(l,e,t)=>e.has(l)||et("Cannot "+t);var r=(l,e,t)=>(We(l,e,"read from private field"),t?t.call(l):e.get(l)),w=(l,e,t)=>e.has(l)?et("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(l):e.set(l,t),m=(l,e,t,n)=>(We(l,e,"write to private field"),e.set(l,t),t),f=(l,e,t)=>(We(l,e,"access private method"),t);var De=(l,e,t,n)=>({set _(i){m(l,e,i);},get _(){return r(l,e,n)}});var ht=tt((ze,ut)=>{(function(l,e){typeof ze=="object"?ut.exports=ze=e():typeof define=="function"&&define.amd?define([],e):l.CryptoJS=e();})(ze,function(){var l=l||(function(e,t){var n;if(typeof window<"u"&&window.crypto&&(n=window.crypto),typeof self<"u"&&self.crypto&&(n=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(n=globalThis.crypto),!n&&typeof window<"u"&&window.msCrypto&&(n=window.msCrypto),!n&&typeof global<"u"&&global.crypto&&(n=global.crypto),!n&&typeof Ke=="function")try{n=Ke("crypto");}catch{}var i=function(){if(n){if(typeof n.getRandomValues=="function")try{return n.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof n.randomBytes=="function")try{return n.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},s=Object.create||(function(){function o(){}return function(d){var I;return o.prototype=d,I=new o,o.prototype=null,I}})(),a={},u=a.lib={},c=u.Base=(function(){return {extend:function(o){var d=s(this);return o&&d.mixIn(o),(!d.hasOwnProperty("init")||this.init===d.init)&&(d.init=function(){d.$super.init.apply(this,arguments);}),d.init.prototype=d,d.$super=this,d},create:function(){var o=this.extend();return o.init.apply(o,arguments),o},init:function(){},mixIn:function(o){for(var d in o)o.hasOwnProperty(d)&&(this[d]=o[d]);o.hasOwnProperty("toString")&&(this.toString=o.toString);},clone:function(){return this.init.prototype.extend(this)}}})(),E=u.WordArray=c.extend({init:function(o,d){o=this.words=o||[],d!=t?this.sigBytes=d:this.sigBytes=o.length*4;},toString:function(o){return (o||g).stringify(this)},concat:function(o){var d=this.words,I=o.words,_=this.sigBytes,x=o.sigBytes;if(this.clamp(),_%4)for(var U=0;U<x;U++){var ae=I[U>>>2]>>>24-U%4*8&255;d[_+U>>>2]|=ae<<24-(_+U)%4*8;}else for(var H=0;H<x;H+=4)d[_+H>>>2]=I[H>>>2];return this.sigBytes+=x,this},clamp:function(){var o=this.words,d=this.sigBytes;o[d>>>2]&=4294967295<<32-d%4*8,o.length=e.ceil(d/4);},clone:function(){var o=c.clone.call(this);return o.words=this.words.slice(0),o},random:function(o){for(var d=[],I=0;I<o;I+=4)d.push(i());return new E.init(d,o)}}),S=a.enc={},g=S.Hex={stringify:function(o){for(var d=o.words,I=o.sigBytes,_=[],x=0;x<I;x++){var U=d[x>>>2]>>>24-x%4*8&255;_.push((U>>>4).toString(16)),_.push((U&15).toString(16));}return _.join("")},parse:function(o){for(var d=o.length,I=[],_=0;_<d;_+=2)I[_>>>3]|=parseInt(o.substr(_,2),16)<<24-_%8*4;return new E.init(I,d/2)}},N=S.Latin1={stringify:function(o){for(var d=o.words,I=o.sigBytes,_=[],x=0;x<I;x++){var U=d[x>>>2]>>>24-x%4*8&255;_.push(String.fromCharCode(U));}return _.join("")},parse:function(o){for(var d=o.length,I=[],_=0;_<d;_++)I[_>>>2]|=(o.charCodeAt(_)&255)<<24-_%4*8;return new E.init(I,d)}},P=S.Utf8={stringify:function(o){try{return decodeURIComponent(escape(N.stringify(o)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(o){return N.parse(unescape(encodeURIComponent(o)))}},D=u.BufferedBlockAlgorithm=c.extend({reset:function(){this._data=new E.init,this._nDataBytes=0;},_append:function(o){typeof o=="string"&&(o=P.parse(o)),this._data.concat(o),this._nDataBytes+=o.sigBytes;},_process:function(o){var d,I=this._data,_=I.words,x=I.sigBytes,U=this.blockSize,ae=U*4,H=x/ae;o?H=e.ceil(H):H=e.max((H|0)-this._minBufferSize,0);var q=H*U,le=e.min(q*4,x);if(q){for(var Pe=0;Pe<q;Pe+=U)this._doProcessBlock(_,Pe);d=_.splice(0,q),I.sigBytes-=le;}return new E.init(d,le)},clone:function(){var o=c.clone.call(this);return o._data=this._data.clone(),o},_minBufferSize:0});u.Hasher=D.extend({cfg:c.extend(),init:function(o){this.cfg=this.cfg.extend(o),this.reset();},reset:function(){D.reset.call(this),this._doReset();},update:function(o){return this._append(o),this._process(),this},finalize:function(o){o&&this._append(o);var d=this._doFinalize();return d},blockSize:512/32,_createHelper:function(o){return function(d,I){return new o.init(I).finalize(d)}},_createHmacHelper:function(o){return function(d,I){return new C.HMAC.init(o,I).finalize(d)}}});var C=a.algo={};return a})(Math);return l});});var pt=tt((Ge,ct)=>{(function(l,e){typeof Ge=="object"?ct.exports=Ge=e(ht()):typeof define=="function"&&define.amd?define(["./core"],e):e(l.CryptoJS);})(Ge,function(l){return (function(){var e=l,t=e.lib,n=t.WordArray,i=t.Hasher,s=e.algo,a=[],u=s.SHA1=i.extend({_doReset:function(){this._hash=new n.init([1732584193,4023233417,2562383102,271733878,3285377520]);},_doProcessBlock:function(c,E){for(var S=this._hash.words,g=S[0],N=S[1],P=S[2],D=S[3],v=S[4],C=0;C<80;C++){if(C<16)a[C]=c[E+C]|0;else {var o=a[C-3]^a[C-8]^a[C-14]^a[C-16];a[C]=o<<1|o>>>31;}var d=(g<<5|g>>>27)+v+a[C];C<20?d+=(N&P|~N&D)+1518500249:C<40?d+=(N^P^D)+1859775393:C<60?d+=(N&P|N&D|P&D)-1894007588:d+=(N^P^D)-899497514,v=D,D=P,P=N<<30|N>>>2,N=g,g=d;}S[0]=S[0]+g|0,S[1]=S[1]+N|0,S[2]=S[2]+P|0,S[3]=S[3]+D|0,S[4]=S[4]+v|0;},_doFinalize:function(){var c=this._data,E=c.words,S=this._nDataBytes*8,g=c.sigBytes*8;return E[g>>>5]|=128<<24-g%32,E[(g+64>>>9<<4)+14]=Math.floor(S/4294967296),E[(g+64>>>9<<4)+15]=S,c.sigBytes=E.length*4,this._process(),this._hash},clone:function(){var c=i.clone.call(this);return c._hash=this._hash.clone(),c}});e.SHA1=i._createHelper(u),e.HmacSHA1=i._createHmacHelper(u);})(),l.SHA1});});var R={CURRENT_DIALOGUE_MEMORY_KEY:"___current_dialogue_memory___",LAST_DIALOGUE_ADDED_IN_STEP_MEMORY_KEY:"___last_dialogue_added_in_step_memory___",CURRENT_MENU_OPTIONS_MEMORY_KEY:"___current_menu_options_memory___",LAST_MENU_OPTIONS_ADDED_IN_STEP_MEMORY_KEY:"___last_menu_options_added_in_step_memory___",CURRENT_INPUT_VALUE_MEMORY_KEY:"_input_value_",LAST_INPUT_ADDED_IN_STEP_MEMORY_KEY:"___last_input_added_in_step_memory___",CURRENT_INPUT_INFO_MEMORY_KEY:"___current_input_info_memory___",CHARACTER_CATEGORY_KEY:"___character___",ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY:"___glue___",OPENED_LABELS_COUNTER_KEY:"___opened_labels_counter___",ALL_CHOICES_MADE_KEY:"___all_choices_made___",CURRENT_STEP_TIMES_COUNTER_KEY:"___current_step_times_counter___",LAST_STEP_GLUED:"___last_step_glued___"};var L;(i=>(i.log=(s,...a)=>console.log(`[Pixi\u2019VN] ${s}`,...a),i.warn=(s,...a)=>console.warn(`[Pixi\u2019VN] ${s}`,...a),i.error=(s,...a)=>console.error(`[Pixi\u2019VN] ${s}`,...a),i.info=(s,...a)=>console.info(`[Pixi\u2019VN] ${s}`,...a)))(L||(L={}));function oe(l){try{if(typeof l>"u")return l;let e=JSON.stringify(l);return JSON.parse(e)}catch(e){throw L.error("Error creating exportable element",l,e),new Error("[Pixi\u2019VN] Error creating exportable element")}}var Et=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,st=new Set,Be=typeof process=="object"&&process?process:{},at=(l,e,t,n)=>{typeof Be.emitWarning=="function"?Be.emitWarning(l,e,t,n):console.error(`[${t}] ${e}: ${l}`);},Fe=globalThis.AbortController,rt=globalThis.AbortSignal;if(typeof Fe>"u"){rt=class{constructor(){y(this,"onabort");y(this,"_onabort",[]);y(this,"reason");y(this,"aborted",false);}addEventListener(n,i){this._onabort.push(i);}},Fe=class{constructor(){y(this,"signal",new rt);e();}abort(n){if(!this.signal.aborted){this.signal.reason=n,this.signal.aborted=true;for(let i of this.signal._onabort)i(n);this.signal.onabort?.(n);}}};let l=Be.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{l&&(l=false,at("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 Ct=l=>!st.has(l),ce=l=>l&&l===Math.floor(l)&&l>0&&isFinite(l),ot=l=>ce(l)?l<=Math.pow(2,8)?Uint8Array:l<=Math.pow(2,16)?Uint16Array:l<=Math.pow(2,32)?Uint32Array:l<=Number.MAX_SAFE_INTEGER?_e:null:null,_e=class extends Array{constructor(e){super(e),this.fill(0);}},Le,me=class me{constructor(e,t){y(this,"heap");y(this,"length");if(!r(me,Le))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new t(e),this.length=0;}static create(e){let t=ot(e);if(!t)return [];m(me,Le,true);let n=new me(e,t);return m(me,Le,false),n}push(e){this.heap[this.length++]=e;}pop(){return this.heap[--this.length]}};Le=new WeakMap,w(me,Le,false);var je=me,nt,it,X,B,J,Se,Q,Te,Ee,Z,F,ee,Y,M,T,K,j,G,V,te,z,re,ne,$,ie,be,W,Ce,h,$e,ge,ue,Ae,k,lt,ye,Ie,Me,pe,de,ke,Ue,Ye,A,qe,ve,fe,Xe,Je=class Je{constructor(e){w(this,h);w(this,X);w(this,B);w(this,J);w(this,Se);w(this,Q);w(this,Te);w(this,Ee);w(this,Z);y(this,"ttl");y(this,"ttlResolution");y(this,"ttlAutopurge");y(this,"updateAgeOnGet");y(this,"updateAgeOnHas");y(this,"allowStale");y(this,"noDisposeOnSet");y(this,"noUpdateTTL");y(this,"maxEntrySize");y(this,"sizeCalculation");y(this,"noDeleteOnFetchRejection");y(this,"noDeleteOnStaleGet");y(this,"allowStaleOnFetchAbort");y(this,"allowStaleOnFetchRejection");y(this,"ignoreFetchAbort");w(this,F);w(this,ee);w(this,Y);w(this,M);w(this,T);w(this,K);w(this,j);w(this,G);w(this,V);w(this,te);w(this,z);w(this,re);w(this,ne);w(this,$);w(this,ie);w(this,be);w(this,W);w(this,Ce);w(this,ge,()=>{});w(this,ue,()=>{});w(this,Ae,()=>{});w(this,k,()=>false);w(this,ye,e=>{});w(this,Ie,(e,t,n)=>{});w(this,Me,(e,t,n,i)=>{if(n||i)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});y(this,nt,"LRUCache");let{max:t=0,ttl:n,ttlResolution:i=1,ttlAutopurge:s,updateAgeOnGet:a,updateAgeOnHas:u,allowStale:c,dispose:E,onInsert:S,disposeAfter:g,noDisposeOnSet:N,noUpdateTTL:P,maxSize:D=0,maxEntrySize:v=0,sizeCalculation:C,fetchMethod:o,memoMethod:d,noDeleteOnFetchRejection:I,noDeleteOnStaleGet:_,allowStaleOnFetchRejection:x,allowStaleOnFetchAbort:U,ignoreFetchAbort:ae,perf:H}=e;if(H!==void 0&&typeof H?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(m(this,Z,H??Et),t!==0&&!ce(t))throw new TypeError("max option must be a nonnegative integer");let q=t?ot(t):Array;if(!q)throw new Error("invalid max value: "+t);if(m(this,X,t),m(this,B,D),this.maxEntrySize=v||r(this,B),this.sizeCalculation=C,this.sizeCalculation){if(!r(this,B)&&!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(d!==void 0&&typeof d!="function")throw new TypeError("memoMethod must be a function if defined");if(m(this,Ee,d),o!==void 0&&typeof o!="function")throw new TypeError("fetchMethod must be a function if specified");if(m(this,Te,o),m(this,be,!!o),m(this,Y,new Map),m(this,M,new Array(t).fill(void 0)),m(this,T,new Array(t).fill(void 0)),m(this,K,new q(t)),m(this,j,new q(t)),m(this,G,0),m(this,V,0),m(this,te,je.create(t)),m(this,F,0),m(this,ee,0),typeof E=="function"&&m(this,J,E),typeof S=="function"&&m(this,Se,S),typeof g=="function"?(m(this,Q,g),m(this,z,[])):(m(this,Q,void 0),m(this,z,void 0)),m(this,ie,!!r(this,J)),m(this,Ce,!!r(this,Se)),m(this,W,!!r(this,Q)),this.noDisposeOnSet=!!N,this.noUpdateTTL=!!P,this.noDeleteOnFetchRejection=!!I,this.allowStaleOnFetchRejection=!!x,this.allowStaleOnFetchAbort=!!U,this.ignoreFetchAbort=!!ae,this.maxEntrySize!==0){if(r(this,B)!==0&&!ce(r(this,B)))throw new TypeError("maxSize must be a positive integer if specified");if(!ce(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");f(this,h,lt).call(this);}if(this.allowStale=!!c,this.noDeleteOnStaleGet=!!_,this.updateAgeOnGet=!!a,this.updateAgeOnHas=!!u,this.ttlResolution=ce(i)||i===0?i:1,this.ttlAutopurge=!!s,this.ttl=n||0,this.ttl){if(!ce(this.ttl))throw new TypeError("ttl must be a positive integer if specified");f(this,h,$e).call(this);}if(r(this,X)===0&&this.ttl===0&&r(this,B)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!r(this,X)&&!r(this,B)){let le="LRU_CACHE_UNBOUNDED";Ct(le)&&(st.add(le),at("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",le,Je));}}get perf(){return r(this,Z)}static unsafeExposeInternals(e){return {starts:r(e,ne),ttls:r(e,$),sizes:r(e,re),keyMap:r(e,Y),keyList:r(e,M),valList:r(e,T),next:r(e,K),prev:r(e,j),get head(){return r(e,G)},get tail(){return r(e,V)},free:r(e,te),isBackgroundFetch:t=>{var n;return f(n=e,h,A).call(n,t)},backgroundFetch:(t,n,i,s)=>{var a;return f(a=e,h,Ye).call(a,t,n,i,s)},moveToTail:t=>{var n;return f(n=e,h,ve).call(n,t)},indexes:t=>{var n;return f(n=e,h,pe).call(n,t)},rindexes:t=>{var n;return f(n=e,h,de).call(n,t)},isStale:t=>{var n;return r(n=e,k).call(n,t)}}}get max(){return r(this,X)}get maxSize(){return r(this,B)}get calculatedSize(){return r(this,ee)}get size(){return r(this,F)}get fetchMethod(){return r(this,Te)}get memoMethod(){return r(this,Ee)}get dispose(){return r(this,J)}get onInsert(){return r(this,Se)}get disposeAfter(){return r(this,Q)}getRemainingTTL(e){return r(this,Y).has(e)?1/0:0}*entries(){for(let e of f(this,h,pe).call(this))r(this,T)[e]!==void 0&&r(this,M)[e]!==void 0&&!f(this,h,A).call(this,r(this,T)[e])&&(yield [r(this,M)[e],r(this,T)[e]]);}*rentries(){for(let e of f(this,h,de).call(this))r(this,T)[e]!==void 0&&r(this,M)[e]!==void 0&&!f(this,h,A).call(this,r(this,T)[e])&&(yield [r(this,M)[e],r(this,T)[e]]);}*keys(){for(let e of f(this,h,pe).call(this)){let t=r(this,M)[e];t!==void 0&&!f(this,h,A).call(this,r(this,T)[e])&&(yield t);}}*rkeys(){for(let e of f(this,h,de).call(this)){let t=r(this,M)[e];t!==void 0&&!f(this,h,A).call(this,r(this,T)[e])&&(yield t);}}*values(){for(let e of f(this,h,pe).call(this))r(this,T)[e]!==void 0&&!f(this,h,A).call(this,r(this,T)[e])&&(yield r(this,T)[e]);}*rvalues(){for(let e of f(this,h,de).call(this))r(this,T)[e]!==void 0&&!f(this,h,A).call(this,r(this,T)[e])&&(yield r(this,T)[e]);}[(it=Symbol.iterator,nt=Symbol.toStringTag,it)](){return this.entries()}find(e,t={}){for(let n of f(this,h,pe).call(this)){let i=r(this,T)[n],s=f(this,h,A).call(this,i)?i.__staleWhileFetching:i;if(s!==void 0&&e(s,r(this,M)[n],this))return this.get(r(this,M)[n],t)}}forEach(e,t=this){for(let n of f(this,h,pe).call(this)){let i=r(this,T)[n],s=f(this,h,A).call(this,i)?i.__staleWhileFetching:i;s!==void 0&&e.call(t,s,r(this,M)[n],this);}}rforEach(e,t=this){for(let n of f(this,h,de).call(this)){let i=r(this,T)[n],s=f(this,h,A).call(this,i)?i.__staleWhileFetching:i;s!==void 0&&e.call(t,s,r(this,M)[n],this);}}purgeStale(){let e=false;for(let t of f(this,h,de).call(this,{allowStale:true}))r(this,k).call(this,t)&&(f(this,h,fe).call(this,r(this,M)[t],"expire"),e=true);return e}info(e){let t=r(this,Y).get(e);if(t===void 0)return;let n=r(this,T)[t],i=f(this,h,A).call(this,n)?n.__staleWhileFetching:n;if(i===void 0)return;let s={value:i};if(r(this,$)&&r(this,ne)){let a=r(this,$)[t],u=r(this,ne)[t];if(a&&u){let c=a-(r(this,Z).now()-u);s.ttl=c,s.start=Date.now();}}return r(this,re)&&(s.size=r(this,re)[t]),s}dump(){let e=[];for(let t of f(this,h,pe).call(this,{allowStale:true})){let n=r(this,M)[t],i=r(this,T)[t],s=f(this,h,A).call(this,i)?i.__staleWhileFetching:i;if(s===void 0||n===void 0)continue;let a={value:s};if(r(this,$)&&r(this,ne)){a.ttl=r(this,$)[t];let u=r(this,Z).now()-r(this,ne)[t];a.start=Math.floor(Date.now()-u);}r(this,re)&&(a.size=r(this,re)[t]),e.unshift([n,a]);}return e}load(e){this.clear();for(let[t,n]of e){if(n.start){let i=Date.now()-n.start;n.start=r(this,Z).now()-i;}this.set(t,n.value,n);}}set(e,t,n={}){var N,P,D,v;if(t===void 0)return this.delete(e),this;let{ttl:i=this.ttl,start:s,noDisposeOnSet:a=this.noDisposeOnSet,sizeCalculation:u=this.sizeCalculation,status:c}=n,{noUpdateTTL:E=this.noUpdateTTL}=n,S=r(this,Me).call(this,e,t,n.size||0,u);if(this.maxEntrySize&&S>this.maxEntrySize)return c&&(c.set="miss",c.maxEntrySizeExceeded=true),f(this,h,fe).call(this,e,"set"),this;let g=r(this,F)===0?void 0:r(this,Y).get(e);if(g===void 0)g=r(this,F)===0?r(this,V):r(this,te).length!==0?r(this,te).pop():r(this,F)===r(this,X)?f(this,h,Ue).call(this,false):r(this,F),r(this,M)[g]=e,r(this,T)[g]=t,r(this,Y).set(e,g),r(this,K)[r(this,V)]=g,r(this,j)[g]=r(this,V),m(this,V,g),De(this,F)._++,r(this,Ie).call(this,g,S,c),c&&(c.set="add"),E=false,r(this,Ce)&&((N=r(this,Se))==null||N.call(this,t,e,"add"));else {f(this,h,ve).call(this,g);let C=r(this,T)[g];if(t!==C){if(r(this,be)&&f(this,h,A).call(this,C)){C.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:o}=C;o!==void 0&&!a&&(r(this,ie)&&((P=r(this,J))==null||P.call(this,o,e,"set")),r(this,W)&&r(this,z)?.push([o,e,"set"]));}else a||(r(this,ie)&&((D=r(this,J))==null||D.call(this,C,e,"set")),r(this,W)&&r(this,z)?.push([C,e,"set"]));if(r(this,ye).call(this,g),r(this,Ie).call(this,g,S,c),r(this,T)[g]=t,c){c.set="replace";let o=C&&f(this,h,A).call(this,C)?C.__staleWhileFetching:C;o!==void 0&&(c.oldValue=o);}}else c&&(c.set="update");r(this,Ce)&&this.onInsert?.(t,e,t===C?"update":"replace");}if(i!==0&&!r(this,$)&&f(this,h,$e).call(this),r(this,$)&&(E||r(this,Ae).call(this,g,i,s),c&&r(this,ue).call(this,c,g)),!a&&r(this,W)&&r(this,z)){let C=r(this,z),o;for(;o=C?.shift();)(v=r(this,Q))==null||v.call(this,...o);}return this}pop(){var e;try{for(;r(this,F);){let t=r(this,T)[r(this,G)];if(f(this,h,Ue).call(this,!0),f(this,h,A).call(this,t)){if(t.__staleWhileFetching)return t.__staleWhileFetching}else if(t!==void 0)return t}}finally{if(r(this,W)&&r(this,z)){let t=r(this,z),n;for(;n=t?.shift();)(e=r(this,Q))==null||e.call(this,...n);}}}has(e,t={}){let{updateAgeOnHas:n=this.updateAgeOnHas,status:i}=t,s=r(this,Y).get(e);if(s!==void 0){let a=r(this,T)[s];if(f(this,h,A).call(this,a)&&a.__staleWhileFetching===void 0)return false;if(r(this,k).call(this,s))i&&(i.has="stale",r(this,ue).call(this,i,s));else return n&&r(this,ge).call(this,s),i&&(i.has="hit",r(this,ue).call(this,i,s)),true}else i&&(i.has="miss");return false}peek(e,t={}){let{allowStale:n=this.allowStale}=t,i=r(this,Y).get(e);if(i===void 0||!n&&r(this,k).call(this,i))return;let s=r(this,T)[i];return f(this,h,A).call(this,s)?s.__staleWhileFetching:s}async fetch(e,t={}){let{allowStale:n=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:s=this.noDeleteOnStaleGet,ttl:a=this.ttl,noDisposeOnSet:u=this.noDisposeOnSet,size:c=0,sizeCalculation:E=this.sizeCalculation,noUpdateTTL:S=this.noUpdateTTL,noDeleteOnFetchRejection:g=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:N=this.allowStaleOnFetchRejection,ignoreFetchAbort:P=this.ignoreFetchAbort,allowStaleOnFetchAbort:D=this.allowStaleOnFetchAbort,context:v,forceRefresh:C=false,status:o,signal:d}=t;if(!r(this,be))return o&&(o.fetch="get"),this.get(e,{allowStale:n,updateAgeOnGet:i,noDeleteOnStaleGet:s,status:o});let I={allowStale:n,updateAgeOnGet:i,noDeleteOnStaleGet:s,ttl:a,noDisposeOnSet:u,size:c,sizeCalculation:E,noUpdateTTL:S,noDeleteOnFetchRejection:g,allowStaleOnFetchRejection:N,allowStaleOnFetchAbort:D,ignoreFetchAbort:P,status:o,signal:d},_=r(this,Y).get(e);if(_===void 0){o&&(o.fetch="miss");let x=f(this,h,Ye).call(this,e,_,I,v);return x.__returned=x}else {let x=r(this,T)[_];if(f(this,h,A).call(this,x)){let le=n&&x.__staleWhileFetching!==void 0;return o&&(o.fetch="inflight",le&&(o.returnedStale=true)),le?x.__staleWhileFetching:x.__returned=x}let U=r(this,k).call(this,_);if(!C&&!U)return o&&(o.fetch="hit"),f(this,h,ve).call(this,_),i&&r(this,ge).call(this,_),o&&r(this,ue).call(this,o,_),x;let ae=f(this,h,Ye).call(this,e,_,I,v),q=ae.__staleWhileFetching!==void 0&&n;return o&&(o.fetch=U?"stale":"refresh",q&&U&&(o.returnedStale=true)),q?ae.__staleWhileFetching:ae.__returned=ae}}async forceFetch(e,t={}){let n=await this.fetch(e,t);if(n===void 0)throw new Error("fetch() returned undefined");return n}memo(e,t={}){let n=r(this,Ee);if(!n)throw new Error("no memoMethod provided to constructor");let{context:i,forceRefresh:s,...a}=t,u=this.get(e,a);if(!s&&u!==void 0)return u;let c=n(e,u,{options:a,context:i});return this.set(e,c,a),c}get(e,t={}){let{allowStale:n=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:s=this.noDeleteOnStaleGet,status:a}=t,u=r(this,Y).get(e);if(u!==void 0){let c=r(this,T)[u],E=f(this,h,A).call(this,c);return a&&r(this,ue).call(this,a,u),r(this,k).call(this,u)?(a&&(a.get="stale"),E?(a&&n&&c.__staleWhileFetching!==void 0&&(a.returnedStale=true),n?c.__staleWhileFetching:void 0):(s||f(this,h,fe).call(this,e,"expire"),a&&n&&(a.returnedStale=true),n?c:void 0)):(a&&(a.get="hit"),E?c.__staleWhileFetching:(f(this,h,ve).call(this,u),i&&r(this,ge).call(this,u),c))}else a&&(a.get="miss");}delete(e){return f(this,h,fe).call(this,e,"delete")}clear(){return f(this,h,Xe).call(this,"delete")}};X=new WeakMap,B=new WeakMap,J=new WeakMap,Se=new WeakMap,Q=new WeakMap,Te=new WeakMap,Ee=new WeakMap,Z=new WeakMap,F=new WeakMap,ee=new WeakMap,Y=new WeakMap,M=new WeakMap,T=new WeakMap,K=new WeakMap,j=new WeakMap,G=new WeakMap,V=new WeakMap,te=new WeakMap,z=new WeakMap,re=new WeakMap,ne=new WeakMap,$=new WeakMap,ie=new WeakMap,be=new WeakMap,W=new WeakMap,Ce=new WeakMap,h=new WeakSet,$e=function(){let e=new _e(r(this,X)),t=new _e(r(this,X));m(this,$,e),m(this,ne,t),m(this,Ae,(s,a,u=r(this,Z).now())=>{if(t[s]=a!==0?u:0,e[s]=a,a!==0&&this.ttlAutopurge){let c=setTimeout(()=>{r(this,k).call(this,s)&&f(this,h,fe).call(this,r(this,M)[s],"expire");},a+1);c.unref&&c.unref();}}),m(this,ge,s=>{t[s]=e[s]!==0?r(this,Z).now():0;}),m(this,ue,(s,a)=>{if(e[a]){let u=e[a],c=t[a];if(!u||!c)return;s.ttl=u,s.start=c,s.now=n||i();let E=s.now-c;s.remainingTTL=u-E;}});let n=0,i=()=>{let s=r(this,Z).now();if(this.ttlResolution>0){n=s;let a=setTimeout(()=>n=0,this.ttlResolution);a.unref&&a.unref();}return s};this.getRemainingTTL=s=>{let a=r(this,Y).get(s);if(a===void 0)return 0;let u=e[a],c=t[a];if(!u||!c)return 1/0;let E=(n||i())-c;return u-E},m(this,k,s=>{let a=t[s],u=e[s];return !!u&&!!a&&(n||i())-a>u});},ge=new WeakMap,ue=new WeakMap,Ae=new WeakMap,k=new WeakMap,lt=function(){let e=new _e(r(this,X));m(this,ee,0),m(this,re,e),m(this,ye,t=>{m(this,ee,r(this,ee)-e[t]),e[t]=0;}),m(this,Me,(t,n,i,s)=>{if(f(this,h,A).call(this,n))return 0;if(!ce(i))if(s){if(typeof s!="function")throw new TypeError("sizeCalculation must be a function");if(i=s(n,t),!ce(i))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 i}),m(this,Ie,(t,n,i)=>{if(e[t]=n,r(this,B)){let s=r(this,B)-e[t];for(;r(this,ee)>s;)f(this,h,Ue).call(this,true);}m(this,ee,r(this,ee)+e[t]),i&&(i.entrySize=n,i.totalCalculatedSize=r(this,ee));});},ye=new WeakMap,Ie=new WeakMap,Me=new WeakMap,pe=function*({allowStale:e=this.allowStale}={}){if(r(this,F))for(let t=r(this,V);!(!f(this,h,ke).call(this,t)||((e||!r(this,k).call(this,t))&&(yield t),t===r(this,G)));)t=r(this,j)[t];},de=function*({allowStale:e=this.allowStale}={}){if(r(this,F))for(let t=r(this,G);!(!f(this,h,ke).call(this,t)||((e||!r(this,k).call(this,t))&&(yield t),t===r(this,V)));)t=r(this,K)[t];},ke=function(e){return e!==void 0&&r(this,Y).get(r(this,M)[e])===e},Ue=function(e){var s;let t=r(this,G),n=r(this,M)[t],i=r(this,T)[t];return r(this,be)&&f(this,h,A).call(this,i)?i.__abortController.abort(new Error("evicted")):(r(this,ie)||r(this,W))&&(r(this,ie)&&((s=r(this,J))==null||s.call(this,i,n,"evict")),r(this,W)&&r(this,z)?.push([i,n,"evict"])),r(this,ye).call(this,t),e&&(r(this,M)[t]=void 0,r(this,T)[t]=void 0,r(this,te).push(t)),r(this,F)===1?(m(this,G,m(this,V,0)),r(this,te).length=0):m(this,G,r(this,K)[t]),r(this,Y).delete(n),De(this,F)._--,t},Ye=function(e,t,n,i){let s=t===void 0?void 0:r(this,T)[t];if(f(this,h,A).call(this,s))return s;let a=new Fe,{signal:u}=n;u?.addEventListener("abort",()=>a.abort(u.reason),{signal:a.signal});let c={signal:a.signal,options:n,context:i},E=(v,C=false)=>{let{aborted:o}=a.signal,d=n.ignoreFetchAbort&&v!==void 0;if(n.status&&(o&&!C?(n.status.fetchAborted=true,n.status.fetchError=a.signal.reason,d&&(n.status.fetchAbortIgnored=true)):n.status.fetchResolved=true),o&&!d&&!C)return g(a.signal.reason);let I=P;return r(this,T)[t]===P&&(v===void 0?I.__staleWhileFetching!==void 0?r(this,T)[t]=I.__staleWhileFetching:f(this,h,fe).call(this,e,"fetch"):(n.status&&(n.status.fetchUpdated=true),this.set(e,v,c.options))),v},S=v=>(n.status&&(n.status.fetchRejected=true,n.status.fetchError=v),g(v)),g=v=>{let{aborted:C}=a.signal,o=C&&n.allowStaleOnFetchAbort,d=o||n.allowStaleOnFetchRejection,I=d||n.noDeleteOnFetchRejection,_=P;if(r(this,T)[t]===P&&(!I||_.__staleWhileFetching===void 0?f(this,h,fe).call(this,e,"fetch"):o||(r(this,T)[t]=_.__staleWhileFetching)),d)return n.status&&_.__staleWhileFetching!==void 0&&(n.status.returnedStale=true),_.__staleWhileFetching;if(_.__returned===_)throw v},N=(v,C)=>{var d;let o=(d=r(this,Te))==null?void 0:d.call(this,e,s,c);o&&o instanceof Promise&&o.then(I=>v(I===void 0?void 0:I),C),a.signal.addEventListener("abort",()=>{(!n.ignoreFetchAbort||n.allowStaleOnFetchAbort)&&(v(void 0),n.allowStaleOnFetchAbort&&(v=I=>E(I,true)));});};n.status&&(n.status.fetchDispatched=true);let P=new Promise(N).then(E,S),D=Object.assign(P,{__abortController:a,__staleWhileFetching:s,__returned:void 0});return t===void 0?(this.set(e,D,{...c.options,status:void 0}),t=r(this,Y).get(e)):r(this,T)[t]=D,D},A=function(e){if(!r(this,be))return false;let t=e;return !!t&&t instanceof Promise&&t.hasOwnProperty("__staleWhileFetching")&&t.__abortController instanceof Fe},qe=function(e,t){r(this,j)[t]=e,r(this,K)[e]=t;},ve=function(e){e!==r(this,V)&&(e===r(this,G)?m(this,G,r(this,K)[e]):f(this,h,qe).call(this,r(this,j)[e],r(this,K)[e]),f(this,h,qe).call(this,r(this,V),e),m(this,V,e));},fe=function(e,t){var i,s;let n=false;if(r(this,F)!==0){let a=r(this,Y).get(e);if(a!==void 0)if(n=true,r(this,F)===1)f(this,h,Xe).call(this,t);else {r(this,ye).call(this,a);let u=r(this,T)[a];if(f(this,h,A).call(this,u)?u.__abortController.abort(new Error("deleted")):(r(this,ie)||r(this,W))&&(r(this,ie)&&((i=r(this,J))==null||i.call(this,u,e,t)),r(this,W)&&r(this,z)?.push([u,e,t])),r(this,Y).delete(e),r(this,M)[a]=void 0,r(this,T)[a]=void 0,a===r(this,V))m(this,V,r(this,j)[a]);else if(a===r(this,G))m(this,G,r(this,K)[a]);else {let c=r(this,j)[a];r(this,K)[c]=r(this,K)[a];let E=r(this,K)[a];r(this,j)[E]=r(this,j)[a];}De(this,F)._--,r(this,te).push(a);}}if(r(this,W)&&r(this,z)?.length){let a=r(this,z),u;for(;u=a?.shift();)(s=r(this,Q))==null||s.call(this,...u);}return n},Xe=function(e){var t,n;for(let i of f(this,h,de).call(this,{allowStale:true})){let s=r(this,T)[i];if(f(this,h,A).call(this,s))s.__abortController.abort(new Error("deleted"));else {let a=r(this,M)[i];r(this,ie)&&((t=r(this,J))==null||t.call(this,s,a,e)),r(this,W)&&r(this,z)?.push([s,a,e]);}}if(r(this,Y).clear(),r(this,T).fill(void 0),r(this,M).fill(void 0),r(this,$)&&r(this,ne)&&(r(this,$).fill(0),r(this,ne).fill(0)),r(this,re)&&r(this,re).fill(0),m(this,G,0),m(this,V,0),r(this,te).length=0,m(this,ee,0),m(this,F,0),r(this,W)&&r(this,z)){let i=r(this,z),s;for(;s=i?.shift();)(n=r(this,Q))==null||n.call(this,...s);}};var Ve=Je;var Re=class{constructor(e){y(this,"cache");y(this,"map",new Map);this.cache=new Ve({max:e.cacheSize}),this.map=new Map;}get[Symbol.iterator](){return this.map[Symbol.iterator]}get[Symbol.toStringTag](){return this.map[Symbol.toStringTag]}clear(){return this.cache.clear(),this.map.clear()}delete(e){let t=this.map.delete(e);return t&&this.cache.delete(e),t}get forEach(){return this.map.forEach}get(e){let t=this.cache.get(e);return t||this.map.get(e)}has(e){return this.map.has(e)}set(e,t){return this.map.set(e,t),this.cache.set(e,t),this}get size(){return this.map.size}entries(){return this.map.entries()}keys(){return this.map.keys()}values(){return this.map.values()}};var Oe=new Re({cacheSize:10}),Qe;(s=>{function l(a){let u=Oe.get(a);if(!u){L.error(`Label "${a}" not found`);return}return u}s.get=l;function e(a){if(Array.isArray(a)){a.forEach(u=>e(u));return}Oe.has(a.id)&&L.info(`Label "${a.id}" already exists, it will be overwritten`),Oe.set(a.id,a);}s.add=e;function t(){return Array.from(Oe.values())}s.values=t;function n(a){return Oe.has(a)}s.has=n;function i(){return Array.from(Oe.keys())}s.keys=i;})(Qe||(Qe={}));var se=Qe;var b=class b{constructor(){}static get allOpenedLabels(){return unifier.GameUnifier.getVariable(R.OPENED_LABELS_COUNTER_KEY)||{}}static set allOpenedLabels(e){unifier.GameUnifier.setVariable(R.OPENED_LABELS_COUNTER_KEY,e);}static getCurrentStepTimesCounterData(e=""){let t=b.currentLabelStepIndex;if(t===null)return L.error("currentLabelStepIndex is null"),null;let n=`${t}${e}`,i=b.currentLabelId,s=b._currentLabel;if(!i||t===null||!s)return L.error("currentLabelId or currentLabelStepIndex is null or currentLabel not found"),null;let a=s.getStepSha(t)||"error",u=unifier.GameUnifier.getVariable(R.CURRENT_STEP_TIMES_COUNTER_KEY)||{};return u[i]||(u[i]={}),(!u[i][n]||u[i][n].stepSha1!=a)&&(u[i][n]={stepSha1:a}),u[i][n]}static setCurrentStepTimesCounterData(e="",t){let n=b.currentLabelStepIndex,i=n+e,s=b.currentLabelId;if(!s||n===null){L.error("currentLabelId or currentLabelStepIndex is null");return}let a=unifier.GameUnifier.getVariable(R.CURRENT_STEP_TIMES_COUNTER_KEY)||{};a[s]||(a[s]={}),a[s][i]=t,unifier.GameUnifier.setVariable(R.CURRENT_STEP_TIMES_COUNTER_KEY,a);}static getCurrentStepTimesCounter(e=""){let t=b._stepCounter,n=b.getCurrentStepTimesCounterData(e);if(!n)return L.error("getCurrentStepTimesCounter obj is null"),0;let i=n.stepCounters||n.lastStepIndexs||[];return i.find(a=>a===t)||(i.push(t),delete n.lastStepIndexs,n.stepCounters=i,b.setCurrentStepTimesCounterData(e,n)),i.length}static getRandomNumber(e,t,n={}){let i=n.nestedId||"";if(n.onceOnly||false){let a=b.getCurrentStepTimesCounterData(i);if(!a)return;let u=a.usedRandomNumbers||{},c=Array.from({length:t-e+1},(g,N)=>N+e).filter(g=>!u[`${e}-${t}`]?.includes(g));if(c.length===0)return;let E=Math.floor(Math.random()*c.length),S=c[E];return u[`${e}-${t}`]||(u[`${e}-${t}`]=[]),u[`${e}-${t}`].push(S),a.usedRandomNumbers=u,b.setCurrentStepTimesCounterData(i,a),S}return Math.floor(Math.random()*(t-e+1))+e}static resetCurrentStepTimesCounter(e=""){let t=b.currentLabelStepIndex,n=t+e,i=b.currentLabelId;if(!i||t===null){L.error("currentLabelId or currentLabelStepIndex is null");return}let s=unifier.GameUnifier.getVariable(R.CURRENT_STEP_TIMES_COUNTER_KEY)||{};s[i]||(s[i]={}),s[i][n]={stepCounters:[],stepSha1:""},unifier.GameUnifier.setVariable(R.CURRENT_STEP_TIMES_COUNTER_KEY,s);}static get allChoicesMade(){return unifier.GameUnifier.getVariable(R.ALL_CHOICES_MADE_KEY)||[]}static set allChoicesMade(e){unifier.GameUnifier.setVariable(R.ALL_CHOICES_MADE_KEY,e);}static increaseStepCounter(){b._stepCounter++;}static get openedLabels(){return oe(b._openedLabels)}static set openedLabels(e){b._openedLabels=oe(e);}static get originalOpenedLabels(){return oe(b._originalOpenedLabels)}static set originalOpenedLabels(e){b._originalOpenedLabels=oe(e);}static get _currentLabel(){if(b.currentLabelId)return se.get(b.currentLabelId)}static get currentLabelId(){if(b._openedLabels.length>0)return b._openedLabels[b._openedLabels.length-1].label}static get currentLabelStepIndex(){return b._openedLabels.length>0?b._openedLabels[b._openedLabels.length-1].currentStepIndex:null}static addLabelHistory(e,t){let n=b.allOpenedLabels,i=b.allOpenedLabels[e]?.biggestStep||0,s=b.allOpenedLabels[e]?.openCount||0;(!i||i<t)&&(n[e]={biggestStep:t,openCount:s},b.allOpenedLabels=n);}static addChoicesMade(e,t,n,i){let s=b.allChoicesMade,a=s.findIndex(u=>u.labelId===e&&u.stepIndex===t&&u.choiceIndex===i&&u.stepSha1===n);a<0?s.push({labelId:e,stepIndex:t,choiceIndex:i,stepSha1:n,madeTimes:1}):s[a].madeTimes++,b.allChoicesMade=s;}static pushNewLabel(e){if(!se.get(e))throw new Error(`[Pixi\u2019VN] Label ${e} not found`);b._openedLabels.push({label:e,currentStepIndex:0});let n=b.allOpenedLabels,i=b.allOpenedLabels[e]?.biggestStep||0,s=b.allOpenedLabels[e]?.openCount||0;n[e]={biggestStep:i,openCount:s+1},b.allOpenedLabels=n;}static increaseCurrentStepIndex(){if(b._openedLabels.length>0){let e=b._openedLabels[b._openedLabels.length-1];b._openedLabels[b._openedLabels.length-1]={...e,currentStepIndex:e.currentStepIndex+1};}}static set onStepStart(e){b._onStepStart=e;}static get onStepStart(){return async(e,t)=>{let n=[];return b.onLoadingLabel&&e===0&&n.push(b.onLoadingLabel(e,t)),b._onStepStart&&n.push(b._onStepStart(e,t)),await Promise.all(n)}}};y(b,"stepsRunning",0),y(b,"continueRequests",0),y(b,"choiceMadeTemp"),y(b,"lastHistoryStep",null),y(b,"_stepCounter",0),y(b,"_openedLabels",[]),y(b,"_originalOpenedLabels",[]),y(b,"_onStepStart"),y(b,"onLoadingLabel"),y(b,"onStepEnd");var p=b;var Ne=class{get currentStepTimesCounter(){return p.getCurrentStepTimesCounter()}set currentStepTimesCounter(e){p.resetCurrentStepTimesCounter();}getRandomNumber(e,t,n={}){return p.getRandomNumber(e,t,n)}get stepCounter(){return p._stepCounter}get openedLabels(){return p.openedLabels}get currentLabel(){return p._currentLabel}addStepHistory(e,t={}){let{choiceMade:n,ignoreSameStep:i}=t,s,a,u,c=unifier.GameUnifier.getVariable(R.LAST_STEP_GLUED)===this.stepCounter;unifier.GameUnifier.getVariable(R.LAST_DIALOGUE_ADDED_IN_STEP_MEMORY_KEY)===this.stepCounter&&(s=unifier.GameUnifier.getVariable(R.CURRENT_DIALOGUE_MEMORY_KEY)),unifier.GameUnifier.getVariable(R.LAST_MENU_OPTIONS_ADDED_IN_STEP_MEMORY_KEY)===this.stepCounter&&(a=unifier.GameUnifier.getVariable(R.CURRENT_MENU_OPTIONS_MEMORY_KEY)),unifier.GameUnifier.getVariable(R.LAST_INPUT_ADDED_IN_STEP_MEMORY_KEY)===this.stepCounter&&(u=unifier.GameUnifier.getVariable(R.CURRENT_INPUT_VALUE_MEMORY_KEY));let E=p.openedLabels,S={currentLabel:p.currentLabelId,dialogue:s,choices:a,stepSha1:e,index:this.stepCounter,labelStepIndex:p.currentLabelStepIndex,choiceIndexMade:n,inputValue:u,alreadyMadeChoices:this.alreadyCurrentStepMadeChoices,isGlued:c,openedLabels:E};p.originalOpenedLabels=E,unifier.GameUnifier.addHistoryItem(S,{ignoreSameStep:i}),p.lastHistoryStep=S,p.increaseStepCounter();}closeCurrentLabel(){if(!p.currentLabelId){L.warn("No label to close");return}if(!this.currentLabel){L.error("currentLabel not found");return}let e=p.openedLabels;e.pop(),p.openedLabels=e,unifier.GameUnifier.onLabelClosing(this.openedLabels.length);}closeAllLabels(){for(;p.openedLabels.length>0;)this.closeCurrentLabel(),unifier.GameUnifier.onLabelClosing(this.openedLabels.length);}isLabelAlreadyCompleted(e){let t;typeof e=="string"?t=e:t=e.id;let i=p.allOpenedLabels[t]?.biggestStep||0;if(i){let s=se.get(t);if(s)return s.stepCount<=i}return false}get alreadyCurrentStepMadeChoicesObj(){let e=p.currentLabelStepIndex,t=this.currentLabel;if(e===null||!t)return;let n=t.getStepSha(e);return n||(L.warn("stepSha not found, setting to ERROR"),n="error"),p.allChoicesMade.filter(i=>i.labelId===t?.id&&i.stepIndex===e&&i.stepSha1===n)}get alreadyCurrentStepMadeChoices(){return this.alreadyCurrentStepMadeChoicesObj?.map(e=>e.choiceIndex)}get isCurrentStepAlreadyOpened(){let e=p.currentLabelId;if(e){let t=p.allOpenedLabels[e]?.openCount||0;if(p.currentLabelStepIndex&&t>=p.currentLabelStepIndex)return true}return false}getTimesLabelOpened(e){return p.allOpenedLabels[e]?.openCount||0}getTimesChoiceMade(e){return this.alreadyCurrentStepMadeChoicesObj?.find(t=>t.choiceIndex===e)?.madeTimes||0}addCurrentStepToHistory(){this.addStepHistory("dev",{ignoreSameStep:true});}getCanContinue(e){let t=e?.showWarn||false,n=this.choices;return n&&n.length>0?(t&&L.warn("The player must make a choice"),false):this.isRequiredInput?(t&&L.warn("The player must enter a value"),false):true}get canContinue(){return p.stepsRunning!==0?false:this.getCanContinue()}get canGoNext(){return this.canContinue}async onStepRun(e,t){let n=[];return e.onStepStart&&n.push(e.onStepStart(t,e)),p.onStepStart&&n.push(p.onStepStart(t,e)),await Promise.all(n)}async onStepEnd(e,t){let n=[];return e.onStepEnd&&n.push(e.onStepEnd(t,e)),p.onStepEnd&&n.push(p.onStepEnd(t,e)),await Promise.all(n)}async goNext(e,t={}){return await this.continue(e,t)}async continue(e,t={}){let{runNow:n=false}=t;if(!(!n&&!this.getCanContinue({showWarn:true}))){if(!n&&p.stepsRunning!==0){p.continueRequests++;return}try{this.currentLabel&&await this.onStepEnd(this.currentLabel,p.currentLabelStepIndex||0);}catch(i){L.error("Error running onStepEnd",i);}return p.stepsRunning===0&&await unifier.GameUnifier.onGoNextEnd(),p.increaseCurrentStepIndex(),await this.runCurrentStep(e,t)}}async runCurrentStep(e,t={}){let{choiceMade:n}=t;if(p.currentLabelId){let i=p.currentLabelStepIndex;if(i===null){L.error("currentLabelStepIndex is null");return}let s=p._currentLabel;if(!s){L.error("currentLabel not found");return}if(s.stepCount>i){try{await this.onStepRun(s,i);}catch(c){L.error("Error running onStepStart",c),this.onStepError&&this.onStepError(c,e);return}let a=s.getStepById(i);if(!a){L.error("step not found");return}let u=s.getStepSha(i);u||(L.warn("stepSha not found, setting to ERROR"),u="error");try{p.stepsRunning++;let c=await a(e,{labelId:s.id}),E=this.choices;if(E?.length===1&&E[0].autoSelect){let g=E[0];c=await this.selectChoice(g,e);}let S=p.lastHistoryStep;if(n!==void 0&&S){let g=S.stepSha1;g||(L.warn("stepSha not found, setting to ERROR"),g="error"),p.addChoicesMade(S.currentLabel||"error",typeof S.labelStepIndex=="number"?S.labelStepIndex:-1,S.stepSha1||"error",n),p.choiceMadeTemp=n;}return p.stepsRunning--,p.stepsRunning===0&&(p.addLabelHistory(s.id,i),this.addStepHistory(u,{...t,choiceMade:p.choiceMadeTemp}),p.choiceMadeTemp=void 0,p.continueRequests>0)?(p.continueRequests--,await this.continue(e)):c}catch(c){p.stepsRunning>0&&p.stepsRunning--,L.error("Error running step",c),this.onStepError&&this.onStepError(c,e);return}}else {if(this.openedLabels.length>1)return this.closeCurrentLabel(),await this.continue(e,t);if(this.openedLabels.length===1)return p.openedLabels=[],unifier.GameUnifier.onEnd?await unifier.GameUnifier.onEnd(e,{labelId:"end"}):void 0}}else if(this.openedLabels.length===0){if(p.openedLabels=p.originalOpenedLabels,unifier.GameUnifier.onEnd)return await unifier.GameUnifier.onEnd(e,{labelId:"end"});L.error("The end of the game is not managed, so the game is blocked. Read this documentation to know how to manage the end of the game: https://pixi-vn.web.app/start/other-narrative-features.html#how-manage-the-end-of-the-game");return}else L.error("currentLabelId not found");}async callLabel(e,t,n){return await this.call(e,t,n)}async call(e,t,n){let{choiceMade:i}=n||{},s;typeof e=="string"?s=e:s=e.id;try{let a=se.get(s);if(!a)throw new Error(`[Pixi\u2019VN] Label ${s} not found`);try{this.currentLabel&&await this.onStepEnd(this.currentLabel,p.currentLabelStepIndex||0);}catch(u){L.error("Error running onStepEnd",u);}p.pushNewLabel(a.id);}catch(a){L.error("Error calling label",a);return}return await this.runCurrentStep(t,{choiceMade:i})}async jumpLabel(e,t,n){return await this.jump(e,t,n)}async jump(e,t,n){this.openedLabels.length>0&&this.closeCurrentLabel();let{choiceMade:i}=n||{},s;typeof e=="string"?s=e:s=e.id;try{let a=se.get(s);if(!a)throw new Error(`[Pixi\u2019VN] Label ${s} not found`);try{this.currentLabel&&await this.onStepEnd(this.currentLabel,p.currentLabelStepIndex||0);}catch(u){L.error("Error running onStepEnd",u);}p.pushNewLabel(a.id);}catch(a){L.error("Error jumping label",a);return}return await this.runCurrentStep(t,{choiceMade:i})}async selectChoice(e,t){this.choices=void 0;let n=e.type;switch(n){case "call":return await this.call(e.label,{...e.props,...t},{choiceMade:e.choiceIndex});case "jump":return await this.jump(e.label,{...e.props,...t},{choiceMade:e.choiceIndex});case "close":return await this.closeChoiceMenu(e,{...e.props,...t});default:throw L.error(`Type ${n} not found`),new Error(`[Pixi\u2019VN] Type ${n} not found`)}}async closeChoiceMenu(e,t){if(e.type!=="close")throw L.error("For closeChoiceMenu, the type must be close"),new Error("[Pixi\u2019VN] For closeChoiceMenu, the type must be close");let n;return typeof e.choiceIndex=="number"&&(n=e.choiceIndex),e.closeCurrentLabel&&this.closeCurrentLabel(),this.continue(t,{choiceMade:n})}get onStepError(){let e=unifier.GameUnifier.onError;return e?(t,n)=>e("step",t,n):void 0}set onStepError(e){unifier.GameUnifier.onError=(t,n,i)=>e(n,i);}get dialogue(){let e=unifier.GameUnifier.getVariable(R.CURRENT_DIALOGUE_MEMORY_KEY);if(e)return {...e,character:e.character?unifier.GameUnifier.getCharacter(e.character)||e.character:void 0}}set dialogue(e){if(e===void 0){unifier.GameUnifier.setVariable(R.CURRENT_DIALOGUE_MEMORY_KEY,void 0);return}if((typeof e=="string"||Array.isArray(e))&&(e={text:e}),this.dialogGlue){let t=unifier.GameUnifier.getVariable(R.CURRENT_DIALOGUE_MEMORY_KEY);if(t){let n=[];Array.isArray(t.text)?n=[...t.text]:n=[t.text],Array.isArray(e.text)?n=[...n,...e.text]:n=[...n,e.text],e.text=n,e.character=e.character||t.character;}unifier.GameUnifier.setVariable(R.LAST_STEP_GLUED,this.stepCounter),this.dialogGlue=false;}try{unifier.GameUnifier.setVariable(R.CURRENT_DIALOGUE_MEMORY_KEY,oe({...e,character:typeof e.character=="string"?e.character:e.character?.id})),unifier.GameUnifier.setVariable(R.LAST_DIALOGUE_ADDED_IN_STEP_MEMORY_KEY,this.stepCounter);}catch(t){throw L.error("DialogueInterface cannot contain functions or classes"),t}}get choiceMenuOptions(){return this.choices}get choices(){let e=unifier.GameUnifier.getVariable(R.CURRENT_MENU_OPTIONS_MEMORY_KEY);if(e){let t=[],n=e.map((s,a)=>({...s,choiceIndex:a})),i=this.alreadyCurrentStepMadeChoices;if(n=n.filter((s,a)=>s.oneTime&&i&&i.includes(a)?false:s.onlyHaveNoChoice?(t.push(s),false):true),n.length>0)return n;if(t.length>0)return [t[0]]}}set choiceMenuOptions(e){this.choices=e;}set choices(e){if(!e||e.length===0){unifier.GameUnifier.setVariable(R.CURRENT_MENU_OPTIONS_MEMORY_KEY,void 0);return}try{unifier.GameUnifier.setVariable(R.CURRENT_MENU_OPTIONS_MEMORY_KEY,oe(e)),unifier.GameUnifier.setVariable(R.LAST_MENU_OPTIONS_ADDED_IN_STEP_MEMORY_KEY,this.stepCounter);}catch(t){throw L.error("ChoiceInterface cannot contain functions or classes"),t}}get dialogGlue(){return unifier.GameUnifier.getFlag(R.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY)}set dialogGlue(e){unifier.GameUnifier.setFlag(R.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,e);}get inputValue(){return unifier.GameUnifier.getVariable(R.CURRENT_INPUT_VALUE_MEMORY_KEY)}set inputValue(e){this.removeInputRequest(),unifier.GameUnifier.setVariable(R.CURRENT_INPUT_VALUE_MEMORY_KEY,e),unifier.GameUnifier.setVariable(R.LAST_INPUT_ADDED_IN_STEP_MEMORY_KEY,this.stepCounter);}get isRequiredInput(){return unifier.GameUnifier.getVariable(R.CURRENT_INPUT_INFO_MEMORY_KEY)?.isRequired||false}get inputType(){return unifier.GameUnifier.getVariable(R.CURRENT_INPUT_INFO_MEMORY_KEY)?.type}requestInput(e,t){e.isRequired=true,unifier.GameUnifier.setVariable(R.CURRENT_INPUT_INFO_MEMORY_KEY,e),t!==void 0?unifier.GameUnifier.setVariable(R.CURRENT_INPUT_VALUE_MEMORY_KEY,t):unifier.GameUnifier.removeVariable(R.CURRENT_INPUT_VALUE_MEMORY_KEY);}removeInputRequest(){unifier.GameUnifier.removeVariable(R.CURRENT_INPUT_INFO_MEMORY_KEY),unifier.GameUnifier.removeVariable(R.CURRENT_INPUT_VALUE_MEMORY_KEY);}clear(){p.openedLabels=[],p._stepCounter=0;}export(){return {openedLabels:oe(p.openedLabels),stepCounter:this.stepCounter}}async onLoadingLabel(e){let t=this.openedLabels.map(async n=>{let i=[],s=se.get(n.label);return s&&(s.onLoadingLabel&&i.push(s.onLoadingLabel(e,s)),p.onLoadingLabel&&i.push(p.onLoadingLabel(e,s))),await Promise.all(i)});return await Promise.all(t)}async restore(e,t){this.clear();try{p.lastHistoryStep=t,e.hasOwnProperty("openedLabels")?(p.openedLabels=e.openedLabels,p.originalOpenedLabels=p.openedLabels):L.warn("Could not import openedLabels data, so will be ignored"),e.hasOwnProperty("stepCounter")?p._stepCounter=e.stepCounter:e.hasOwnProperty("lastStepIndex")?p._stepCounter=e.lastStepIndex:L.warn("Could not import stepCounter data, so will be ignored");try{await this.onLoadingLabel(p.currentLabelStepIndex||0);}catch(n){L.error("Error running onLoadingLabel",n);}}catch(n){L.error("Error importing data",n);}}};function Rt(l,e,t,n){let i=typeof e=="string"?e:e.id;return {...n,label:i,props:t,text:l,type:n?.type||"call"}}var Ze="close";function Ot(l,e){return {...e,type:Ze,text:l}}var dt=Tt(pt());var we=class{constructor(e,t){y(this,"id");y(this,"_onStepStart");y(this,"_onLoadingLabel");y(this,"_onStepEnd");this.id=e,this._onStepStart=t?.onStepStart,this._onLoadingLabel=t?.onLoadingLabel,this._onStepEnd=t?.onStepEnd;}get onStepStart(){return async(e,t)=>{if(this._onLoadingLabel&&e===0&&await this._onLoadingLabel(e,t),this._onStepStart)return await this._onStepStart(e,t)}}get onLoadingLabel(){return this._onLoadingLabel}get onStepEnd(){return this._onStepEnd}};var xe=class extends we{constructor(t,n,i){super(t,i);y(this,"_steps");this._steps=n;}get stepCount(){return this.steps.length}getStepById(t){return this.steps[t]}get steps(){return typeof this._steps=="function"?this._steps():this._steps}getStepSha(t){if(t<0||t>=this.steps.length)return L.warn("stepSha not found, setting to ERROR"),"error";try{let n=this.steps[t];return (0,dt.default)(n.toString().toLocaleLowerCase()).toString()}catch(n){return L.warn("stepSha not found, setting to ERROR",n),"error"}}};function ft(l,e,t){let n=new xe(l,e,t);return se.add(n),n}var Or=new Ne;
|
|
2
2
|
exports.Close=Ze;exports.Label=xe;exports.LabelAbstract=we;exports.NarrationManagerStatic=p;exports.RegisteredLabels=se;exports.narration=Or;exports.newChoiceOption=Rt;exports.newCloseChoiceOption=Ot;exports.newLabel=ft;
|
package/dist/narration.d.cts
CHANGED
|
@@ -59,11 +59,10 @@ declare abstract class LabelAbstract<TLabel, TProps extends {} = {}, StepIdType
|
|
|
59
59
|
* @param props is the properties of the label
|
|
60
60
|
*/
|
|
61
61
|
constructor(id: LabelIdType, props?: LabelProps<TLabel, StepIdType>);
|
|
62
|
-
private _id;
|
|
63
62
|
/**
|
|
64
63
|
* Get the id of the label. This variable is used in the system to get the label by id, {@link RegisteredLabels.get}
|
|
65
64
|
*/
|
|
66
|
-
|
|
65
|
+
readonly id: LabelIdType;
|
|
67
66
|
/**
|
|
68
67
|
* Get the number of steps in the label. This variable is used in the system to get the number of steps in the label.
|
|
69
68
|
* @returns The number of steps in the label
|
package/dist/narration.d.ts
CHANGED
|
@@ -59,11 +59,10 @@ declare abstract class LabelAbstract<TLabel, TProps extends {} = {}, StepIdType
|
|
|
59
59
|
* @param props is the properties of the label
|
|
60
60
|
*/
|
|
61
61
|
constructor(id: LabelIdType, props?: LabelProps<TLabel, StepIdType>);
|
|
62
|
-
private _id;
|
|
63
62
|
/**
|
|
64
63
|
* Get the id of the label. This variable is used in the system to get the label by id, {@link RegisteredLabels.get}
|
|
65
64
|
*/
|
|
66
|
-
|
|
65
|
+
readonly id: LabelIdType;
|
|
67
66
|
/**
|
|
68
67
|
* Get the number of steps in the label. This variable is used in the system to get the number of steps in the label.
|
|
69
68
|
* @returns The number of steps in the label
|
package/dist/narration.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {a as a$1}from'./chunk-HVEJJGVC.mjs';import'./chunk-XSN6P5JL.mjs';import {a as a$2}from'./chunk-6GO4XVS7.mjs';import {a}from'./chunk-RXNJBYVP.mjs';import {d,c,j,k}from'./chunk-GNJIUFU2.mjs';import {GameUnifier}from'@drincs/pixi-vn/unifier';var I=new a({cacheSize:10}),R;(o=>{function m(l){let d=I.get(l);if(!d){j.error(`Label "${l}" not found`);return}return d}o.get=m;function e(l){if(Array.isArray(l)){l.forEach(d=>e(d));return}I.has(l.id)&&j.info(`Label "${l.id}" already exists, it will be overwritten`),I.set(l.id,l);}o.add=e;function t(){return Array.from(I.values())}o.values=t;function r(l){return I.has(l)}o.has=r;function a(){return Array.from(I.keys())}o.keys=a;})(R||(R={}));var L=R;var i=class i{constructor(){}static get allOpenedLabels(){return GameUnifier.getVariable(a$2.OPENED_LABELS_COUNTER_KEY)||{}}static set allOpenedLabels(e){GameUnifier.setVariable(a$2.OPENED_LABELS_COUNTER_KEY,e);}static getCurrentStepTimesCounterData(e=""){let t=i.currentLabelStepIndex;if(t===null)return j.error("currentLabelStepIndex is null"),null;let r=`${t}${e}`,a=i.currentLabelId,o=i._currentLabel;if(!a||t===null||!o)return j.error("currentLabelId or currentLabelStepIndex is null or currentLabel not found"),null;let l=o.getStepSha(t)||"error",d=GameUnifier.getVariable(a$2.CURRENT_STEP_TIMES_COUNTER_KEY)||{};return d[a]||(d[a]={}),(!d[a][r]||d[a][r].stepSha1!=l)&&(d[a][r]={stepSha1:l}),d[a][r]}static setCurrentStepTimesCounterData(e="",t){let r=i.currentLabelStepIndex,a=r+e,o=i.currentLabelId;if(!o||r===null){j.error("currentLabelId or currentLabelStepIndex is null");return}let l=GameUnifier.getVariable(a$2.CURRENT_STEP_TIMES_COUNTER_KEY)||{};l[o]||(l[o]={}),l[o][a]=t,GameUnifier.setVariable(a$2.CURRENT_STEP_TIMES_COUNTER_KEY,l);}static getCurrentStepTimesCounter(e=""){let t=i._stepCounter,r=i.getCurrentStepTimesCounterData(e);if(!r)return j.error("getCurrentStepTimesCounter obj is null"),0;let a=r.stepCounters||r.lastStepIndexs||[];return a.find(l=>l===t)||(a.push(t),delete r.lastStepIndexs,r.stepCounters=a,i.setCurrentStepTimesCounterData(e,r)),a.length}static getRandomNumber(e,t,r={}){let a=r.nestedId||"";if(r.onceOnly||false){let l=i.getCurrentStepTimesCounterData(a);if(!l)return;let d=l.usedRandomNumbers||{},c=Array.from({length:t-e+1},(T,N)=>N+e).filter(T=>!d[`${e}-${t}`]?.includes(T));if(c.length===0)return;let y=Math.floor(Math.random()*c.length),f=c[y];return d[`${e}-${t}`]||(d[`${e}-${t}`]=[]),d[`${e}-${t}`].push(f),l.usedRandomNumbers=d,i.setCurrentStepTimesCounterData(a,l),f}return Math.floor(Math.random()*(t-e+1))+e}static resetCurrentStepTimesCounter(e=""){let t=i.currentLabelStepIndex,r=t+e,a=i.currentLabelId;if(!a||t===null){j.error("currentLabelId or currentLabelStepIndex is null");return}let o=GameUnifier.getVariable(a$2.CURRENT_STEP_TIMES_COUNTER_KEY)||{};o[a]||(o[a]={}),o[a][r]={stepCounters:[],stepSha1:""},GameUnifier.setVariable(a$2.CURRENT_STEP_TIMES_COUNTER_KEY,o);}static get allChoicesMade(){return GameUnifier.getVariable(a$2.ALL_CHOICES_MADE_KEY)||[]}static set allChoicesMade(e){GameUnifier.setVariable(a$2.ALL_CHOICES_MADE_KEY,e);}static increaseStepCounter(){i._stepCounter++;}static get openedLabels(){return k(i._openedLabels)}static set openedLabels(e){i._openedLabels=k(e);}static get originalOpenedLabels(){return k(i._originalOpenedLabels)}static set originalOpenedLabels(e){i._originalOpenedLabels=k(e);}static get _currentLabel(){if(i.currentLabelId)return L.get(i.currentLabelId)}static get currentLabelId(){if(i._openedLabels.length>0)return i._openedLabels[i._openedLabels.length-1].label}static get currentLabelStepIndex(){return i._openedLabels.length>0?i._openedLabels[i._openedLabels.length-1].currentStepIndex:null}static addLabelHistory(e,t){let r=i.allOpenedLabels,a=i.allOpenedLabels[e]?.biggestStep||0,o=i.allOpenedLabels[e]?.openCount||0;(!a||a<t)&&(r[e]={biggestStep:t,openCount:o},i.allOpenedLabels=r);}static addChoicesMade(e,t,r,a){let o=i.allChoicesMade,l=o.findIndex(d=>d.labelId===e&&d.stepIndex===t&&d.choiceIndex===a&&d.stepSha1===r);l<0?o.push({labelId:e,stepIndex:t,choiceIndex:a,stepSha1:r,madeTimes:1}):o[l].madeTimes++,i.allChoicesMade=o;}static pushNewLabel(e){if(!L.get(e))throw new Error(`[Pixi\u2019VN] Label ${e} not found`);i._openedLabels.push({label:e,currentStepIndex:0});let r=i.allOpenedLabels,a=i.allOpenedLabels[e]?.biggestStep||0,o=i.allOpenedLabels[e]?.openCount||0;r[e]={biggestStep:a,openCount:o+1},i.allOpenedLabels=r;}static increaseCurrentStepIndex(){if(i._openedLabels.length>0){let e=i._openedLabels[i._openedLabels.length-1];i._openedLabels[i._openedLabels.length-1]={...e,currentStepIndex:e.currentStepIndex+1};}}static set onStepStart(e){i._onStepStart=e;}static get onStepStart(){return async(e,t)=>{let r=[];return i.onLoadingLabel&&e===0&&r.push(i.onLoadingLabel(e,t)),i._onStepStart&&r.push(i._onStepStart(e,t)),await Promise.all(r)}}};d(i,"stepsRunning",0),d(i,"continueRequests",0),d(i,"choiceMadeTemp"),d(i,"lastHistoryStep",null),d(i,"_stepCounter",0),d(i,"_openedLabels",[]),d(i,"_originalOpenedLabels",[]),d(i,"_onStepStart"),d(i,"onLoadingLabel"),d(i,"onStepEnd");var n=i;var E=class{get currentStepTimesCounter(){return n.getCurrentStepTimesCounter()}set currentStepTimesCounter(e){n.resetCurrentStepTimesCounter();}getRandomNumber(e,t,r={}){return n.getRandomNumber(e,t,r)}get stepCounter(){return n._stepCounter}get openedLabels(){return n.openedLabels}get currentLabel(){return n._currentLabel}addStepHistory(e,t={}){let{choiceMade:r,ignoreSameStep:a}=t,o,l,d,c=GameUnifier.getVariable(a$2.LAST_STEP_GLUED)===this.stepCounter;GameUnifier.getVariable(a$2.LAST_DIALOGUE_ADDED_IN_STEP_MEMORY_KEY)===this.stepCounter&&(o=GameUnifier.getVariable(a$2.CURRENT_DIALOGUE_MEMORY_KEY)),GameUnifier.getVariable(a$2.LAST_MENU_OPTIONS_ADDED_IN_STEP_MEMORY_KEY)===this.stepCounter&&(l=GameUnifier.getVariable(a$2.CURRENT_MENU_OPTIONS_MEMORY_KEY)),GameUnifier.getVariable(a$2.LAST_INPUT_ADDED_IN_STEP_MEMORY_KEY)===this.stepCounter&&(d=GameUnifier.getVariable(a$2.CURRENT_INPUT_VALUE_MEMORY_KEY));let y=n.openedLabels,f={currentLabel:n.currentLabelId,dialogue:o,choices:l,stepSha1:e,index:this.stepCounter,labelStepIndex:n.currentLabelStepIndex,choiceIndexMade:r,inputValue:d,alreadyMadeChoices:this.alreadyCurrentStepMadeChoices,isGlued:c,openedLabels:y};n.originalOpenedLabels=y,GameUnifier.addHistoryItem(f,{ignoreSameStep:a}),n.lastHistoryStep=f,n.increaseStepCounter();}closeCurrentLabel(){if(!n.currentLabelId){j.warn("No label to close");return}if(!this.currentLabel){j.error("currentLabel not found");return}let e=n.openedLabels;e.pop(),n.openedLabels=e,GameUnifier.onLabelClosing(this.openedLabels.length);}closeAllLabels(){for(;n.openedLabels.length>0;)this.closeCurrentLabel(),GameUnifier.onLabelClosing(this.openedLabels.length);}isLabelAlreadyCompleted(e){let t;typeof e=="string"?t=e:t=e.id;let a=n.allOpenedLabels[t]?.biggestStep||0;if(a){let o=L.get(t);if(o)return o.stepCount<=a}return false}get alreadyCurrentStepMadeChoicesObj(){let e=n.currentLabelStepIndex,t=this.currentLabel;if(e===null||!t)return;let r=t.getStepSha(e);return r||(j.warn("stepSha not found, setting to ERROR"),r="error"),n.allChoicesMade.filter(a=>a.labelId===t?.id&&a.stepIndex===e&&a.stepSha1===r)}get alreadyCurrentStepMadeChoices(){return this.alreadyCurrentStepMadeChoicesObj?.map(e=>e.choiceIndex)}get isCurrentStepAlreadyOpened(){let e=n.currentLabelId;if(e){let t=n.allOpenedLabels[e]?.openCount||0;if(n.currentLabelStepIndex&&t>=n.currentLabelStepIndex)return true}return false}getTimesLabelOpened(e){return n.allOpenedLabels[e]?.openCount||0}getTimesChoiceMade(e){return this.alreadyCurrentStepMadeChoicesObj?.find(t=>t.choiceIndex===e)?.madeTimes||0}addCurrentStepToHistory(){this.addStepHistory("dev",{ignoreSameStep:true});}getCanContinue(e){let t=e?.showWarn||false,r=this.choices;return r&&r.length>0?(t&&j.warn("The player must make a choice"),false):this.isRequiredInput?(t&&j.warn("The player must enter a value"),false):true}get canContinue(){return n.stepsRunning!==0?false:this.getCanContinue()}get canGoNext(){return this.canContinue}async onStepRun(e,t){let r=[];return e.onStepStart&&r.push(e.onStepStart(t,e)),n.onStepStart&&r.push(n.onStepStart(t,e)),await Promise.all(r)}async onStepEnd(e,t){let r=[];return e.onStepEnd&&r.push(e.onStepEnd(t,e)),n.onStepEnd&&r.push(n.onStepEnd(t,e)),await Promise.all(r)}async goNext(e,t={}){return await this.continue(e,t)}async continue(e,t={}){let{runNow:r=false}=t;if(!(!r&&!this.getCanContinue({showWarn:true}))){if(!r&&n.stepsRunning!==0){n.continueRequests++;return}try{this.currentLabel&&await this.onStepEnd(this.currentLabel,n.currentLabelStepIndex||0);}catch(a){j.error("Error running onStepEnd",a);}return n.stepsRunning===0&&await GameUnifier.onGoNextEnd(),n.increaseCurrentStepIndex(),await this.runCurrentStep(e,t)}}async runCurrentStep(e,t={}){let{choiceMade:r}=t;if(n.currentLabelId){let a=n.currentLabelStepIndex;if(a===null){j.error("currentLabelStepIndex is null");return}let o=n._currentLabel;if(!o){j.error("currentLabel not found");return}if(o.stepCount>a){try{await this.onStepRun(o,a);}catch(c){j.error("Error running onStepStart",c),this.onStepError&&this.onStepError(c,e);return}let l=o.getStepById(a);if(!l){j.error("step not found");return}let d=o.getStepSha(a);d||(j.warn("stepSha not found, setting to ERROR"),d="error");try{n.stepsRunning++;let c=await l(e,{labelId:o.id}),y=this.choices;if(y?.length===1&&y[0].autoSelect){let T=y[0];c=await this.selectChoice(T,e);}let f=n.lastHistoryStep;if(r!==void 0&&f){let T=f.stepSha1;T||(j.warn("stepSha not found, setting to ERROR"),T="error"),n.addChoicesMade(f.currentLabel||"error",typeof f.labelStepIndex=="number"?f.labelStepIndex:-1,f.stepSha1||"error",r),n.choiceMadeTemp=r;}return n.stepsRunning--,n.stepsRunning===0&&(n.addLabelHistory(o.id,a),this.addStepHistory(d,{...t,choiceMade:n.choiceMadeTemp}),n.choiceMadeTemp=void 0,n.continueRequests>0)?(n.continueRequests--,await this.continue(e)):c}catch(c){n.stepsRunning>0&&n.stepsRunning--,j.error("Error running step",c),this.onStepError&&this.onStepError(c,e);return}}else {if(this.openedLabels.length>1)return this.closeCurrentLabel(),await this.continue(e,t);if(this.openedLabels.length===1)return n.openedLabels=[],GameUnifier.onEnd?await GameUnifier.onEnd(e,{labelId:"end"}):void 0}}else if(this.openedLabels.length===0){if(n.openedLabels=n.originalOpenedLabels,GameUnifier.onEnd)return await GameUnifier.onEnd(e,{labelId:"end"});j.error("The end of the game is not managed, so the game is blocked. Read this documentation to know how to manage the end of the game: https://pixi-vn.web.app/start/other-narrative-features.html#how-manage-the-end-of-the-game");return}else j.error("currentLabelId not found");}async callLabel(e,t,r){return await this.call(e,t,r)}async call(e,t,r){let{choiceMade:a}=r||{},o;typeof e=="string"?o=e:o=e.id;try{let l=L.get(o);if(!l)throw new Error(`[Pixi\u2019VN] Label ${o} not found`);try{this.currentLabel&&await this.onStepEnd(this.currentLabel,n.currentLabelStepIndex||0);}catch(d){j.error("Error running onStepEnd",d);}n.pushNewLabel(l.id);}catch(l){j.error("Error calling label",l);return}return await this.runCurrentStep(t,{choiceMade:a})}async jumpLabel(e,t,r){return await this.jump(e,t,r)}async jump(e,t,r){this.openedLabels.length>0&&this.closeCurrentLabel();let{choiceMade:a}=r||{},o;typeof e=="string"?o=e:o=e.id;try{let l=L.get(o);if(!l)throw new Error(`[Pixi\u2019VN] Label ${o} not found`);try{this.currentLabel&&await this.onStepEnd(this.currentLabel,n.currentLabelStepIndex||0);}catch(d){j.error("Error running onStepEnd",d);}n.pushNewLabel(l.id);}catch(l){j.error("Error jumping label",l);return}return await this.runCurrentStep(t,{choiceMade:a})}async selectChoice(e,t){this.choices=void 0;let r=e.type;switch(r){case "call":return await this.call(e.label,{...e.props,...t},{choiceMade:e.choiceIndex});case "jump":return await this.jump(e.label,{...e.props,...t},{choiceMade:e.choiceIndex});case "close":return await this.closeChoiceMenu(e,{...e.props,...t});default:throw j.error(`Type ${r} not found`),new Error(`[Pixi\u2019VN] Type ${r} not found`)}}async closeChoiceMenu(e,t){if(e.type!=="close")throw j.error("For closeChoiceMenu, the type must be close"),new Error("[Pixi\u2019VN] For closeChoiceMenu, the type must be close");let r;return typeof e.choiceIndex=="number"&&(r=e.choiceIndex),e.closeCurrentLabel&&this.closeCurrentLabel(),this.continue(t,{choiceMade:r})}get onStepError(){let e=GameUnifier.onError;return e?(t,r)=>e("step",t,r):void 0}set onStepError(e){GameUnifier.onError=(t,r,a)=>e(r,a);}get dialogue(){let e=GameUnifier.getVariable(a$2.CURRENT_DIALOGUE_MEMORY_KEY);if(e)return {...e,character:e.character?GameUnifier.getCharacter(e.character)||e.character:void 0}}set dialogue(e){if(e===void 0){GameUnifier.setVariable(a$2.CURRENT_DIALOGUE_MEMORY_KEY,void 0);return}if((typeof e=="string"||Array.isArray(e))&&(e={text:e}),this.dialogGlue){let t=GameUnifier.getVariable(a$2.CURRENT_DIALOGUE_MEMORY_KEY);if(t){let r=[];Array.isArray(t.text)?r=[...t.text]:r=[t.text],Array.isArray(e.text)?r=[...r,...e.text]:r=[...r,e.text],e.text=r,e.character=e.character||t.character;}GameUnifier.setVariable(a$2.LAST_STEP_GLUED,this.stepCounter),this.dialogGlue=false;}try{GameUnifier.setVariable(a$2.CURRENT_DIALOGUE_MEMORY_KEY,k({...e,character:typeof e.character=="string"?e.character:e.character?.id})),GameUnifier.setVariable(a$2.LAST_DIALOGUE_ADDED_IN_STEP_MEMORY_KEY,this.stepCounter);}catch(t){throw j.error("DialogueInterface cannot contain functions or classes"),t}}get choiceMenuOptions(){return this.choices}get choices(){let e=GameUnifier.getVariable(a$2.CURRENT_MENU_OPTIONS_MEMORY_KEY);if(e){let t=[],r=e.map((o,l)=>({...o,choiceIndex:l})),a=this.alreadyCurrentStepMadeChoices;if(r=r.filter((o,l)=>o.oneTime&&a&&a.includes(l)?false:o.onlyHaveNoChoice?(t.push(o),false):true),r.length>0)return r;if(t.length>0)return [t[0]]}}set choiceMenuOptions(e){this.choices=e;}set choices(e){if(!e||e.length===0){GameUnifier.setVariable(a$2.CURRENT_MENU_OPTIONS_MEMORY_KEY,void 0);return}try{GameUnifier.setVariable(a$2.CURRENT_MENU_OPTIONS_MEMORY_KEY,k(e)),GameUnifier.setVariable(a$2.LAST_MENU_OPTIONS_ADDED_IN_STEP_MEMORY_KEY,this.stepCounter);}catch(t){throw j.error("ChoiceInterface cannot contain functions or classes"),t}}get dialogGlue(){return GameUnifier.getFlag(a$2.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY)}set dialogGlue(e){GameUnifier.setFlag(a$2.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,e);}get inputValue(){return GameUnifier.getVariable(a$2.CURRENT_INPUT_VALUE_MEMORY_KEY)}set inputValue(e){this.removeInputRequest(),GameUnifier.setVariable(a$2.CURRENT_INPUT_VALUE_MEMORY_KEY,e),GameUnifier.setVariable(a$2.LAST_INPUT_ADDED_IN_STEP_MEMORY_KEY,this.stepCounter);}get isRequiredInput(){return GameUnifier.getVariable(a$2.CURRENT_INPUT_INFO_MEMORY_KEY)?.isRequired||false}get inputType(){return GameUnifier.getVariable(a$2.CURRENT_INPUT_INFO_MEMORY_KEY)?.type}requestInput(e,t){e.isRequired=true,GameUnifier.setVariable(a$2.CURRENT_INPUT_INFO_MEMORY_KEY,e),t!==void 0?GameUnifier.setVariable(a$2.CURRENT_INPUT_VALUE_MEMORY_KEY,t):GameUnifier.removeVariable(a$2.CURRENT_INPUT_VALUE_MEMORY_KEY);}removeInputRequest(){GameUnifier.removeVariable(a$2.CURRENT_INPUT_INFO_MEMORY_KEY),GameUnifier.removeVariable(a$2.CURRENT_INPUT_VALUE_MEMORY_KEY);}clear(){n.openedLabels=[],n._stepCounter=0;}export(){return {openedLabels:k(n.openedLabels),stepCounter:this.stepCounter}}async onLoadingLabel(e){let t=this.openedLabels.map(async r=>{let a=[],o=L.get(r.label);return o&&(o.onLoadingLabel&&a.push(o.onLoadingLabel(e,o)),n.onLoadingLabel&&a.push(n.onLoadingLabel(e,o))),await Promise.all(a)});return await Promise.all(t)}async restore(e,t){this.clear();try{n.lastHistoryStep=t,e.hasOwnProperty("openedLabels")?(n.openedLabels=e.openedLabels,n.originalOpenedLabels=n.openedLabels):j.warn("Could not import openedLabels data, so will be ignored"),e.hasOwnProperty("stepCounter")?n._stepCounter=e.stepCounter:e.hasOwnProperty("lastStepIndex")?n._stepCounter=e.lastStepIndex:j.warn("Could not import stepCounter data, so will be ignored");try{await this.onLoadingLabel(n.currentLabelStepIndex||0);}catch(r){j.error("Error running onLoadingLabel",r);}}catch(r){j.error("Error importing data",r);}}};function D(m,e,t,r){let a=typeof e=="string"?e:e.id;return {...r,label:a,props:t,text:m,type:r?.type||"call"}}var _="close";function U(m,e){return {...e,type:_,text:m}}var x=c(a$1(),1);var g=class{constructor(e,t){d(this,"_id");d(this,"_onStepStart");d(this,"_onLoadingLabel");d(this,"_onStepEnd");this._id=e,this._onStepStart=t?.onStepStart,this._onLoadingLabel=t?.onLoadingLabel,this._onStepEnd=t?.onStepEnd;}get id(){return this._id}get onStepStart(){return async(e,t)=>{if(this._onLoadingLabel&&e===0&&await this._onLoadingLabel(e,t),this._onStepStart)return await this._onStepStart(e,t)}}get onLoadingLabel(){return this._onLoadingLabel}get onStepEnd(){return this._onStepEnd}};var C=class extends g{constructor(t,r,a){super(t,a);d(this,"_steps");this._steps=r;}get stepCount(){return this.steps.length}getStepById(t){return this.steps[t]}get steps(){return typeof this._steps=="function"?this._steps():this._steps}getStepSha(t){if(t<0||t>=this.steps.length)return j.warn("stepSha not found, setting to ERROR"),"error";try{let r=this.steps[t];return (0,x.default)(r.toString().toLocaleLowerCase()).toString()}catch(r){return j.warn("stepSha not found, setting to ERROR",r),"error"}}};function M(m,e,t){let r=new C(m,e,t);return L.add(r),r}var Se=new E;
|
|
2
|
-
export{
|
|
1
|
+
import {a as a$1}from'./chunk-HVEJJGVC.mjs';import'./chunk-XSN6P5JL.mjs';import {a as a$2}from'./chunk-6GO4XVS7.mjs';import {a}from'./chunk-RXNJBYVP.mjs';import {d,c,j,k}from'./chunk-GNJIUFU2.mjs';import {GameUnifier}from'@drincs/pixi-vn/unifier';var I=new a({cacheSize:10}),R;(o=>{function m(l){let d=I.get(l);if(!d){j.error(`Label "${l}" not found`);return}return d}o.get=m;function e(l){if(Array.isArray(l)){l.forEach(d=>e(d));return}I.has(l.id)&&j.info(`Label "${l.id}" already exists, it will be overwritten`),I.set(l.id,l);}o.add=e;function t(){return Array.from(I.values())}o.values=t;function r(l){return I.has(l)}o.has=r;function a(){return Array.from(I.keys())}o.keys=a;})(R||(R={}));var L=R;var i=class i{constructor(){}static get allOpenedLabels(){return GameUnifier.getVariable(a$2.OPENED_LABELS_COUNTER_KEY)||{}}static set allOpenedLabels(e){GameUnifier.setVariable(a$2.OPENED_LABELS_COUNTER_KEY,e);}static getCurrentStepTimesCounterData(e=""){let t=i.currentLabelStepIndex;if(t===null)return j.error("currentLabelStepIndex is null"),null;let r=`${t}${e}`,a=i.currentLabelId,o=i._currentLabel;if(!a||t===null||!o)return j.error("currentLabelId or currentLabelStepIndex is null or currentLabel not found"),null;let l=o.getStepSha(t)||"error",d=GameUnifier.getVariable(a$2.CURRENT_STEP_TIMES_COUNTER_KEY)||{};return d[a]||(d[a]={}),(!d[a][r]||d[a][r].stepSha1!=l)&&(d[a][r]={stepSha1:l}),d[a][r]}static setCurrentStepTimesCounterData(e="",t){let r=i.currentLabelStepIndex,a=r+e,o=i.currentLabelId;if(!o||r===null){j.error("currentLabelId or currentLabelStepIndex is null");return}let l=GameUnifier.getVariable(a$2.CURRENT_STEP_TIMES_COUNTER_KEY)||{};l[o]||(l[o]={}),l[o][a]=t,GameUnifier.setVariable(a$2.CURRENT_STEP_TIMES_COUNTER_KEY,l);}static getCurrentStepTimesCounter(e=""){let t=i._stepCounter,r=i.getCurrentStepTimesCounterData(e);if(!r)return j.error("getCurrentStepTimesCounter obj is null"),0;let a=r.stepCounters||r.lastStepIndexs||[];return a.find(l=>l===t)||(a.push(t),delete r.lastStepIndexs,r.stepCounters=a,i.setCurrentStepTimesCounterData(e,r)),a.length}static getRandomNumber(e,t,r={}){let a=r.nestedId||"";if(r.onceOnly||false){let l=i.getCurrentStepTimesCounterData(a);if(!l)return;let d=l.usedRandomNumbers||{},c=Array.from({length:t-e+1},(T,N)=>N+e).filter(T=>!d[`${e}-${t}`]?.includes(T));if(c.length===0)return;let y=Math.floor(Math.random()*c.length),f=c[y];return d[`${e}-${t}`]||(d[`${e}-${t}`]=[]),d[`${e}-${t}`].push(f),l.usedRandomNumbers=d,i.setCurrentStepTimesCounterData(a,l),f}return Math.floor(Math.random()*(t-e+1))+e}static resetCurrentStepTimesCounter(e=""){let t=i.currentLabelStepIndex,r=t+e,a=i.currentLabelId;if(!a||t===null){j.error("currentLabelId or currentLabelStepIndex is null");return}let o=GameUnifier.getVariable(a$2.CURRENT_STEP_TIMES_COUNTER_KEY)||{};o[a]||(o[a]={}),o[a][r]={stepCounters:[],stepSha1:""},GameUnifier.setVariable(a$2.CURRENT_STEP_TIMES_COUNTER_KEY,o);}static get allChoicesMade(){return GameUnifier.getVariable(a$2.ALL_CHOICES_MADE_KEY)||[]}static set allChoicesMade(e){GameUnifier.setVariable(a$2.ALL_CHOICES_MADE_KEY,e);}static increaseStepCounter(){i._stepCounter++;}static get openedLabels(){return k(i._openedLabels)}static set openedLabels(e){i._openedLabels=k(e);}static get originalOpenedLabels(){return k(i._originalOpenedLabels)}static set originalOpenedLabels(e){i._originalOpenedLabels=k(e);}static get _currentLabel(){if(i.currentLabelId)return L.get(i.currentLabelId)}static get currentLabelId(){if(i._openedLabels.length>0)return i._openedLabels[i._openedLabels.length-1].label}static get currentLabelStepIndex(){return i._openedLabels.length>0?i._openedLabels[i._openedLabels.length-1].currentStepIndex:null}static addLabelHistory(e,t){let r=i.allOpenedLabels,a=i.allOpenedLabels[e]?.biggestStep||0,o=i.allOpenedLabels[e]?.openCount||0;(!a||a<t)&&(r[e]={biggestStep:t,openCount:o},i.allOpenedLabels=r);}static addChoicesMade(e,t,r,a){let o=i.allChoicesMade,l=o.findIndex(d=>d.labelId===e&&d.stepIndex===t&&d.choiceIndex===a&&d.stepSha1===r);l<0?o.push({labelId:e,stepIndex:t,choiceIndex:a,stepSha1:r,madeTimes:1}):o[l].madeTimes++,i.allChoicesMade=o;}static pushNewLabel(e){if(!L.get(e))throw new Error(`[Pixi\u2019VN] Label ${e} not found`);i._openedLabels.push({label:e,currentStepIndex:0});let r=i.allOpenedLabels,a=i.allOpenedLabels[e]?.biggestStep||0,o=i.allOpenedLabels[e]?.openCount||0;r[e]={biggestStep:a,openCount:o+1},i.allOpenedLabels=r;}static increaseCurrentStepIndex(){if(i._openedLabels.length>0){let e=i._openedLabels[i._openedLabels.length-1];i._openedLabels[i._openedLabels.length-1]={...e,currentStepIndex:e.currentStepIndex+1};}}static set onStepStart(e){i._onStepStart=e;}static get onStepStart(){return async(e,t)=>{let r=[];return i.onLoadingLabel&&e===0&&r.push(i.onLoadingLabel(e,t)),i._onStepStart&&r.push(i._onStepStart(e,t)),await Promise.all(r)}}};d(i,"stepsRunning",0),d(i,"continueRequests",0),d(i,"choiceMadeTemp"),d(i,"lastHistoryStep",null),d(i,"_stepCounter",0),d(i,"_openedLabels",[]),d(i,"_originalOpenedLabels",[]),d(i,"_onStepStart"),d(i,"onLoadingLabel"),d(i,"onStepEnd");var n=i;var E=class{get currentStepTimesCounter(){return n.getCurrentStepTimesCounter()}set currentStepTimesCounter(e){n.resetCurrentStepTimesCounter();}getRandomNumber(e,t,r={}){return n.getRandomNumber(e,t,r)}get stepCounter(){return n._stepCounter}get openedLabels(){return n.openedLabels}get currentLabel(){return n._currentLabel}addStepHistory(e,t={}){let{choiceMade:r,ignoreSameStep:a}=t,o,l,d,c=GameUnifier.getVariable(a$2.LAST_STEP_GLUED)===this.stepCounter;GameUnifier.getVariable(a$2.LAST_DIALOGUE_ADDED_IN_STEP_MEMORY_KEY)===this.stepCounter&&(o=GameUnifier.getVariable(a$2.CURRENT_DIALOGUE_MEMORY_KEY)),GameUnifier.getVariable(a$2.LAST_MENU_OPTIONS_ADDED_IN_STEP_MEMORY_KEY)===this.stepCounter&&(l=GameUnifier.getVariable(a$2.CURRENT_MENU_OPTIONS_MEMORY_KEY)),GameUnifier.getVariable(a$2.LAST_INPUT_ADDED_IN_STEP_MEMORY_KEY)===this.stepCounter&&(d=GameUnifier.getVariable(a$2.CURRENT_INPUT_VALUE_MEMORY_KEY));let y=n.openedLabels,f={currentLabel:n.currentLabelId,dialogue:o,choices:l,stepSha1:e,index:this.stepCounter,labelStepIndex:n.currentLabelStepIndex,choiceIndexMade:r,inputValue:d,alreadyMadeChoices:this.alreadyCurrentStepMadeChoices,isGlued:c,openedLabels:y};n.originalOpenedLabels=y,GameUnifier.addHistoryItem(f,{ignoreSameStep:a}),n.lastHistoryStep=f,n.increaseStepCounter();}closeCurrentLabel(){if(!n.currentLabelId){j.warn("No label to close");return}if(!this.currentLabel){j.error("currentLabel not found");return}let e=n.openedLabels;e.pop(),n.openedLabels=e,GameUnifier.onLabelClosing(this.openedLabels.length);}closeAllLabels(){for(;n.openedLabels.length>0;)this.closeCurrentLabel(),GameUnifier.onLabelClosing(this.openedLabels.length);}isLabelAlreadyCompleted(e){let t;typeof e=="string"?t=e:t=e.id;let a=n.allOpenedLabels[t]?.biggestStep||0;if(a){let o=L.get(t);if(o)return o.stepCount<=a}return false}get alreadyCurrentStepMadeChoicesObj(){let e=n.currentLabelStepIndex,t=this.currentLabel;if(e===null||!t)return;let r=t.getStepSha(e);return r||(j.warn("stepSha not found, setting to ERROR"),r="error"),n.allChoicesMade.filter(a=>a.labelId===t?.id&&a.stepIndex===e&&a.stepSha1===r)}get alreadyCurrentStepMadeChoices(){return this.alreadyCurrentStepMadeChoicesObj?.map(e=>e.choiceIndex)}get isCurrentStepAlreadyOpened(){let e=n.currentLabelId;if(e){let t=n.allOpenedLabels[e]?.openCount||0;if(n.currentLabelStepIndex&&t>=n.currentLabelStepIndex)return true}return false}getTimesLabelOpened(e){return n.allOpenedLabels[e]?.openCount||0}getTimesChoiceMade(e){return this.alreadyCurrentStepMadeChoicesObj?.find(t=>t.choiceIndex===e)?.madeTimes||0}addCurrentStepToHistory(){this.addStepHistory("dev",{ignoreSameStep:true});}getCanContinue(e){let t=e?.showWarn||false,r=this.choices;return r&&r.length>0?(t&&j.warn("The player must make a choice"),false):this.isRequiredInput?(t&&j.warn("The player must enter a value"),false):true}get canContinue(){return n.stepsRunning!==0?false:this.getCanContinue()}get canGoNext(){return this.canContinue}async onStepRun(e,t){let r=[];return e.onStepStart&&r.push(e.onStepStart(t,e)),n.onStepStart&&r.push(n.onStepStart(t,e)),await Promise.all(r)}async onStepEnd(e,t){let r=[];return e.onStepEnd&&r.push(e.onStepEnd(t,e)),n.onStepEnd&&r.push(n.onStepEnd(t,e)),await Promise.all(r)}async goNext(e,t={}){return await this.continue(e,t)}async continue(e,t={}){let{runNow:r=false}=t;if(!(!r&&!this.getCanContinue({showWarn:true}))){if(!r&&n.stepsRunning!==0){n.continueRequests++;return}try{this.currentLabel&&await this.onStepEnd(this.currentLabel,n.currentLabelStepIndex||0);}catch(a){j.error("Error running onStepEnd",a);}return n.stepsRunning===0&&await GameUnifier.onGoNextEnd(),n.increaseCurrentStepIndex(),await this.runCurrentStep(e,t)}}async runCurrentStep(e,t={}){let{choiceMade:r}=t;if(n.currentLabelId){let a=n.currentLabelStepIndex;if(a===null){j.error("currentLabelStepIndex is null");return}let o=n._currentLabel;if(!o){j.error("currentLabel not found");return}if(o.stepCount>a){try{await this.onStepRun(o,a);}catch(c){j.error("Error running onStepStart",c),this.onStepError&&this.onStepError(c,e);return}let l=o.getStepById(a);if(!l){j.error("step not found");return}let d=o.getStepSha(a);d||(j.warn("stepSha not found, setting to ERROR"),d="error");try{n.stepsRunning++;let c=await l(e,{labelId:o.id}),y=this.choices;if(y?.length===1&&y[0].autoSelect){let T=y[0];c=await this.selectChoice(T,e);}let f=n.lastHistoryStep;if(r!==void 0&&f){let T=f.stepSha1;T||(j.warn("stepSha not found, setting to ERROR"),T="error"),n.addChoicesMade(f.currentLabel||"error",typeof f.labelStepIndex=="number"?f.labelStepIndex:-1,f.stepSha1||"error",r),n.choiceMadeTemp=r;}return n.stepsRunning--,n.stepsRunning===0&&(n.addLabelHistory(o.id,a),this.addStepHistory(d,{...t,choiceMade:n.choiceMadeTemp}),n.choiceMadeTemp=void 0,n.continueRequests>0)?(n.continueRequests--,await this.continue(e)):c}catch(c){n.stepsRunning>0&&n.stepsRunning--,j.error("Error running step",c),this.onStepError&&this.onStepError(c,e);return}}else {if(this.openedLabels.length>1)return this.closeCurrentLabel(),await this.continue(e,t);if(this.openedLabels.length===1)return n.openedLabels=[],GameUnifier.onEnd?await GameUnifier.onEnd(e,{labelId:"end"}):void 0}}else if(this.openedLabels.length===0){if(n.openedLabels=n.originalOpenedLabels,GameUnifier.onEnd)return await GameUnifier.onEnd(e,{labelId:"end"});j.error("The end of the game is not managed, so the game is blocked. Read this documentation to know how to manage the end of the game: https://pixi-vn.web.app/start/other-narrative-features.html#how-manage-the-end-of-the-game");return}else j.error("currentLabelId not found");}async callLabel(e,t,r){return await this.call(e,t,r)}async call(e,t,r){let{choiceMade:a}=r||{},o;typeof e=="string"?o=e:o=e.id;try{let l=L.get(o);if(!l)throw new Error(`[Pixi\u2019VN] Label ${o} not found`);try{this.currentLabel&&await this.onStepEnd(this.currentLabel,n.currentLabelStepIndex||0);}catch(d){j.error("Error running onStepEnd",d);}n.pushNewLabel(l.id);}catch(l){j.error("Error calling label",l);return}return await this.runCurrentStep(t,{choiceMade:a})}async jumpLabel(e,t,r){return await this.jump(e,t,r)}async jump(e,t,r){this.openedLabels.length>0&&this.closeCurrentLabel();let{choiceMade:a}=r||{},o;typeof e=="string"?o=e:o=e.id;try{let l=L.get(o);if(!l)throw new Error(`[Pixi\u2019VN] Label ${o} not found`);try{this.currentLabel&&await this.onStepEnd(this.currentLabel,n.currentLabelStepIndex||0);}catch(d){j.error("Error running onStepEnd",d);}n.pushNewLabel(l.id);}catch(l){j.error("Error jumping label",l);return}return await this.runCurrentStep(t,{choiceMade:a})}async selectChoice(e,t){this.choices=void 0;let r=e.type;switch(r){case "call":return await this.call(e.label,{...e.props,...t},{choiceMade:e.choiceIndex});case "jump":return await this.jump(e.label,{...e.props,...t},{choiceMade:e.choiceIndex});case "close":return await this.closeChoiceMenu(e,{...e.props,...t});default:throw j.error(`Type ${r} not found`),new Error(`[Pixi\u2019VN] Type ${r} not found`)}}async closeChoiceMenu(e,t){if(e.type!=="close")throw j.error("For closeChoiceMenu, the type must be close"),new Error("[Pixi\u2019VN] For closeChoiceMenu, the type must be close");let r;return typeof e.choiceIndex=="number"&&(r=e.choiceIndex),e.closeCurrentLabel&&this.closeCurrentLabel(),this.continue(t,{choiceMade:r})}get onStepError(){let e=GameUnifier.onError;return e?(t,r)=>e("step",t,r):void 0}set onStepError(e){GameUnifier.onError=(t,r,a)=>e(r,a);}get dialogue(){let e=GameUnifier.getVariable(a$2.CURRENT_DIALOGUE_MEMORY_KEY);if(e)return {...e,character:e.character?GameUnifier.getCharacter(e.character)||e.character:void 0}}set dialogue(e){if(e===void 0){GameUnifier.setVariable(a$2.CURRENT_DIALOGUE_MEMORY_KEY,void 0);return}if((typeof e=="string"||Array.isArray(e))&&(e={text:e}),this.dialogGlue){let t=GameUnifier.getVariable(a$2.CURRENT_DIALOGUE_MEMORY_KEY);if(t){let r=[];Array.isArray(t.text)?r=[...t.text]:r=[t.text],Array.isArray(e.text)?r=[...r,...e.text]:r=[...r,e.text],e.text=r,e.character=e.character||t.character;}GameUnifier.setVariable(a$2.LAST_STEP_GLUED,this.stepCounter),this.dialogGlue=false;}try{GameUnifier.setVariable(a$2.CURRENT_DIALOGUE_MEMORY_KEY,k({...e,character:typeof e.character=="string"?e.character:e.character?.id})),GameUnifier.setVariable(a$2.LAST_DIALOGUE_ADDED_IN_STEP_MEMORY_KEY,this.stepCounter);}catch(t){throw j.error("DialogueInterface cannot contain functions or classes"),t}}get choiceMenuOptions(){return this.choices}get choices(){let e=GameUnifier.getVariable(a$2.CURRENT_MENU_OPTIONS_MEMORY_KEY);if(e){let t=[],r=e.map((o,l)=>({...o,choiceIndex:l})),a=this.alreadyCurrentStepMadeChoices;if(r=r.filter((o,l)=>o.oneTime&&a&&a.includes(l)?false:o.onlyHaveNoChoice?(t.push(o),false):true),r.length>0)return r;if(t.length>0)return [t[0]]}}set choiceMenuOptions(e){this.choices=e;}set choices(e){if(!e||e.length===0){GameUnifier.setVariable(a$2.CURRENT_MENU_OPTIONS_MEMORY_KEY,void 0);return}try{GameUnifier.setVariable(a$2.CURRENT_MENU_OPTIONS_MEMORY_KEY,k(e)),GameUnifier.setVariable(a$2.LAST_MENU_OPTIONS_ADDED_IN_STEP_MEMORY_KEY,this.stepCounter);}catch(t){throw j.error("ChoiceInterface cannot contain functions or classes"),t}}get dialogGlue(){return GameUnifier.getFlag(a$2.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY)}set dialogGlue(e){GameUnifier.setFlag(a$2.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,e);}get inputValue(){return GameUnifier.getVariable(a$2.CURRENT_INPUT_VALUE_MEMORY_KEY)}set inputValue(e){this.removeInputRequest(),GameUnifier.setVariable(a$2.CURRENT_INPUT_VALUE_MEMORY_KEY,e),GameUnifier.setVariable(a$2.LAST_INPUT_ADDED_IN_STEP_MEMORY_KEY,this.stepCounter);}get isRequiredInput(){return GameUnifier.getVariable(a$2.CURRENT_INPUT_INFO_MEMORY_KEY)?.isRequired||false}get inputType(){return GameUnifier.getVariable(a$2.CURRENT_INPUT_INFO_MEMORY_KEY)?.type}requestInput(e,t){e.isRequired=true,GameUnifier.setVariable(a$2.CURRENT_INPUT_INFO_MEMORY_KEY,e),t!==void 0?GameUnifier.setVariable(a$2.CURRENT_INPUT_VALUE_MEMORY_KEY,t):GameUnifier.removeVariable(a$2.CURRENT_INPUT_VALUE_MEMORY_KEY);}removeInputRequest(){GameUnifier.removeVariable(a$2.CURRENT_INPUT_INFO_MEMORY_KEY),GameUnifier.removeVariable(a$2.CURRENT_INPUT_VALUE_MEMORY_KEY);}clear(){n.openedLabels=[],n._stepCounter=0;}export(){return {openedLabels:k(n.openedLabels),stepCounter:this.stepCounter}}async onLoadingLabel(e){let t=this.openedLabels.map(async r=>{let a=[],o=L.get(r.label);return o&&(o.onLoadingLabel&&a.push(o.onLoadingLabel(e,o)),n.onLoadingLabel&&a.push(n.onLoadingLabel(e,o))),await Promise.all(a)});return await Promise.all(t)}async restore(e,t){this.clear();try{n.lastHistoryStep=t,e.hasOwnProperty("openedLabels")?(n.openedLabels=e.openedLabels,n.originalOpenedLabels=n.openedLabels):j.warn("Could not import openedLabels data, so will be ignored"),e.hasOwnProperty("stepCounter")?n._stepCounter=e.stepCounter:e.hasOwnProperty("lastStepIndex")?n._stepCounter=e.lastStepIndex:j.warn("Could not import stepCounter data, so will be ignored");try{await this.onLoadingLabel(n.currentLabelStepIndex||0);}catch(r){j.error("Error running onLoadingLabel",r);}}catch(r){j.error("Error importing data",r);}}};function D(m,e,t,r){let a=typeof e=="string"?e:e.id;return {...r,label:a,props:t,text:m,type:r?.type||"call"}}var O="close";function U(m,e){return {...e,type:O,text:m}}var x=c(a$1(),1);var g=class{constructor(e,t){d(this,"id");d(this,"_onStepStart");d(this,"_onLoadingLabel");d(this,"_onStepEnd");this.id=e,this._onStepStart=t?.onStepStart,this._onLoadingLabel=t?.onLoadingLabel,this._onStepEnd=t?.onStepEnd;}get onStepStart(){return async(e,t)=>{if(this._onLoadingLabel&&e===0&&await this._onLoadingLabel(e,t),this._onStepStart)return await this._onStepStart(e,t)}}get onLoadingLabel(){return this._onLoadingLabel}get onStepEnd(){return this._onStepEnd}};var C=class extends g{constructor(t,r,a){super(t,a);d(this,"_steps");this._steps=r;}get stepCount(){return this.steps.length}getStepById(t){return this.steps[t]}get steps(){return typeof this._steps=="function"?this._steps():this._steps}getStepSha(t){if(t<0||t>=this.steps.length)return j.warn("stepSha not found, setting to ERROR"),"error";try{let r=this.steps[t];return (0,x.default)(r.toString().toLocaleLowerCase()).toString()}catch(r){return j.warn("stepSha not found, setting to ERROR",r),"error"}}};function M(m,e,t){let r=new C(m,e,t);return L.add(r),r}var Se=new E;
|
|
2
|
+
export{O as Close,C as Label,g as LabelAbstract,n as NarrationManagerStatic,L as RegisteredLabels,Se as narration,D as newChoiceOption,U as newCloseChoiceOption,M as newLabel};
|
package/dist/storage.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var unifier=require('@drincs/pixi-vn/unifier');var Jt=Object.defineProperty;var Pt=l=>{throw TypeError(l)};var Qt=(l,t,i)=>t in l?Jt(l,t,{enumerable:true,configurable:true,writable:true,value:i}):l[t]=i;var _=(l,t,i)=>Qt(l,typeof t!="symbol"?t+"":t,i),Ct=(l,t,i)=>t.has(l)||Pt("Cannot "+i);var e=(l,t,i)=>(Ct(l,t,"read from private field"),i?i.call(l):t.get(l)),m=(l,t,i)=>t.has(l)?Pt("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(l):t.set(l,i),f=(l,t,i,s)=>(Ct(l,t,"write to private field"),t.set(l,i),i),h=(l,t,i)=>(Ct(l,t,"access private method"),i);var Rt=(l,t,i,s)=>({set _(n){f(l,t,n);},get _(){return e(l,t,s)}});var rt;(n=>(n.log=(r,...a)=>console.log(`[Pixi\u2019VN] ${r}`,...a),n.warn=(r,...a)=>console.warn(`[Pixi\u2019VN] ${r}`,...a),n.error=(r,...a)=>console.error(`[Pixi\u2019VN] ${r}`,...a),n.info=(r,...a)=>console.info(`[Pixi\u2019VN] ${r}`,...a)))(rt||(rt={}));function Ft(l){try{if(typeof l>"u")return l;let t=JSON.stringify(l);return JSON.parse(t)}catch(t){throw rt.error("Error creating exportable element",l,t),new Error("[Pixi\u2019VN] Error creating exportable element")}}var Zt=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,Ht=new Set,Mt=typeof process=="object"&&process?process:{},$t=(l,t,i,s)=>{typeof Mt.emitWarning=="function"?Mt.emitWarning(l,t,i,s):console.error(`[${i}] ${t}: ${l}`);},xt=globalThis.AbortController,Yt=globalThis.AbortSignal;if(typeof xt>"u"){Yt=class{constructor(){_(this,"onabort");_(this,"_onabort",[]);_(this,"reason");_(this,"aborted",false);}addEventListener(s,n){this._onabort.push(n);}},xt=class{constructor(){_(this,"signal",new Yt);t();}abort(s){if(!this.signal.aborted){this.signal.reason=s,this.signal.aborted=true;for(let n of this.signal._onabort)n(s);this.signal.onabort?.(s);}}};let l=Mt.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",t=()=>{l&&(l=false,$t("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",t));};}var kt=l=>!Ht.has(l),tt=l=>l&&l===Math.floor(l)&&l>0&&isFinite(l),Bt=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?dt:null:null,dt=class extends Array{constructor(t){super(t),this.fill(0);}},gt,at=class at{constructor(t,i){_(this,"heap");_(this,"length");if(!e(at,gt))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new i(t),this.length=0;}static create(t){let i=Bt(t);if(!i)return [];f(at,gt,true);let s=new at(t,i);return f(at,gt,false),s}push(t){this.heap[this.length++]=t;}pop(){return this.heap[--this.length]}};gt=new WeakMap,m(at,gt,false);var Lt=at,jt,Kt,P,L,Y,ot,j,pt,_t,K,R,H,T,E,g,z,G,x,F,$,D,B,X,N,q,nt,I,mt,o,Gt,ht,Z,yt,U,Xt,lt,St,Tt,et,it,Nt,Dt,vt,S,Ut,wt,st,Vt,Wt=class Wt{constructor(t){m(this,o);m(this,P);m(this,L);m(this,Y);m(this,ot);m(this,j);m(this,pt);m(this,_t);m(this,K);_(this,"ttl");_(this,"ttlResolution");_(this,"ttlAutopurge");_(this,"updateAgeOnGet");_(this,"updateAgeOnHas");_(this,"allowStale");_(this,"noDisposeOnSet");_(this,"noUpdateTTL");_(this,"maxEntrySize");_(this,"sizeCalculation");_(this,"noDeleteOnFetchRejection");_(this,"noDeleteOnStaleGet");_(this,"allowStaleOnFetchAbort");_(this,"allowStaleOnFetchRejection");_(this,"ignoreFetchAbort");m(this,R);m(this,H);m(this,T);m(this,E);m(this,g);m(this,z);m(this,G);m(this,x);m(this,F);m(this,$);m(this,D);m(this,B);m(this,X);m(this,N);m(this,q);m(this,nt);m(this,I);m(this,mt);m(this,ht,()=>{});m(this,Z,()=>{});m(this,yt,()=>{});m(this,U,()=>false);m(this,lt,t=>{});m(this,St,(t,i,s)=>{});m(this,Tt,(t,i,s,n)=>{if(s||n)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});_(this,jt,"LRUCache");let{max:i=0,ttl:s,ttlResolution:n=1,ttlAutopurge:r,updateAgeOnGet:a,updateAgeOnHas:d,allowStale:c,dispose:O,onInsert:J,disposeAfter:b,noDisposeOnSet:k,noUpdateTTL:V,maxSize:Q=0,maxEntrySize:y=0,sizeCalculation:w,fetchMethod:p,memoMethod:C,noDeleteOnFetchRejection:M,noDeleteOnStaleGet:v,allowStaleOnFetchRejection:W,allowStaleOnFetchAbort:bt,ignoreFetchAbort:ft,perf:Ot}=t;if(Ot!==void 0&&typeof Ot?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(f(this,K,Ot??Zt),i!==0&&!tt(i))throw new TypeError("max option must be a nonnegative integer");let ct=i?Bt(i):Array;if(!ct)throw new Error("invalid max value: "+i);if(f(this,P,i),f(this,L,Q),this.maxEntrySize=y||e(this,L),this.sizeCalculation=w,this.sizeCalculation){if(!e(this,L)&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(C!==void 0&&typeof C!="function")throw new TypeError("memoMethod must be a function if defined");if(f(this,_t,C),p!==void 0&&typeof p!="function")throw new TypeError("fetchMethod must be a function if specified");if(f(this,pt,p),f(this,nt,!!p),f(this,T,new Map),f(this,E,new Array(i).fill(void 0)),f(this,g,new Array(i).fill(void 0)),f(this,z,new ct(i)),f(this,G,new ct(i)),f(this,x,0),f(this,F,0),f(this,$,Lt.create(i)),f(this,R,0),f(this,H,0),typeof O=="function"&&f(this,Y,O),typeof J=="function"&&f(this,ot,J),typeof b=="function"?(f(this,j,b),f(this,D,[])):(f(this,j,void 0),f(this,D,void 0)),f(this,q,!!e(this,Y)),f(this,mt,!!e(this,ot)),f(this,I,!!e(this,j)),this.noDisposeOnSet=!!k,this.noUpdateTTL=!!V,this.noDeleteOnFetchRejection=!!M,this.allowStaleOnFetchRejection=!!W,this.allowStaleOnFetchAbort=!!bt,this.ignoreFetchAbort=!!ft,this.maxEntrySize!==0){if(e(this,L)!==0&&!tt(e(this,L)))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");h(this,o,Xt).call(this);}if(this.allowStale=!!c,this.noDeleteOnStaleGet=!!v,this.updateAgeOnGet=!!a,this.updateAgeOnHas=!!d,this.ttlResolution=tt(n)||n===0?n: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");h(this,o,Gt).call(this);}if(e(this,P)===0&&this.ttl===0&&e(this,L)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!e(this,P)&&!e(this,L)){let ut="LRU_CACHE_UNBOUNDED";kt(ut)&&(Ht.add(ut),$t("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",ut,Wt));}}get perf(){return e(this,K)}static unsafeExposeInternals(t){return {starts:e(t,X),ttls:e(t,N),sizes:e(t,B),keyMap:e(t,T),keyList:e(t,E),valList:e(t,g),next:e(t,z),prev:e(t,G),get head(){return e(t,x)},get tail(){return e(t,F)},free:e(t,$),isBackgroundFetch:i=>{var s;return h(s=t,o,S).call(s,i)},backgroundFetch:(i,s,n,r)=>{var a;return h(a=t,o,vt).call(a,i,s,n,r)},moveToTail:i=>{var s;return h(s=t,o,wt).call(s,i)},indexes:i=>{var s;return h(s=t,o,et).call(s,i)},rindexes:i=>{var s;return h(s=t,o,it).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,L)}get calculatedSize(){return e(this,H)}get size(){return e(this,R)}get fetchMethod(){return e(this,pt)}get memoMethod(){return e(this,_t)}get dispose(){return e(this,Y)}get onInsert(){return e(this,ot)}get disposeAfter(){return e(this,j)}getRemainingTTL(t){return e(this,T).has(t)?1/0:0}*entries(){for(let t of h(this,o,et).call(this))e(this,g)[t]!==void 0&&e(this,E)[t]!==void 0&&!h(this,o,S).call(this,e(this,g)[t])&&(yield [e(this,E)[t],e(this,g)[t]]);}*rentries(){for(let t of h(this,o,it).call(this))e(this,g)[t]!==void 0&&e(this,E)[t]!==void 0&&!h(this,o,S).call(this,e(this,g)[t])&&(yield [e(this,E)[t],e(this,g)[t]]);}*keys(){for(let t of h(this,o,et).call(this)){let i=e(this,E)[t];i!==void 0&&!h(this,o,S).call(this,e(this,g)[t])&&(yield i);}}*rkeys(){for(let t of h(this,o,it).call(this)){let i=e(this,E)[t];i!==void 0&&!h(this,o,S).call(this,e(this,g)[t])&&(yield i);}}*values(){for(let t of h(this,o,et).call(this))e(this,g)[t]!==void 0&&!h(this,o,S).call(this,e(this,g)[t])&&(yield e(this,g)[t]);}*rvalues(){for(let t of h(this,o,it).call(this))e(this,g)[t]!==void 0&&!h(this,o,S).call(this,e(this,g)[t])&&(yield e(this,g)[t]);}[(Kt=Symbol.iterator,jt=Symbol.toStringTag,Kt)](){return this.entries()}find(t,i={}){for(let s of h(this,o,et).call(this)){let n=e(this,g)[s],r=h(this,o,S).call(this,n)?n.__staleWhileFetching:n;if(r!==void 0&&t(r,e(this,E)[s],this))return this.get(e(this,E)[s],i)}}forEach(t,i=this){for(let s of h(this,o,et).call(this)){let n=e(this,g)[s],r=h(this,o,S).call(this,n)?n.__staleWhileFetching:n;r!==void 0&&t.call(i,r,e(this,E)[s],this);}}rforEach(t,i=this){for(let s of h(this,o,it).call(this)){let n=e(this,g)[s],r=h(this,o,S).call(this,n)?n.__staleWhileFetching:n;r!==void 0&&t.call(i,r,e(this,E)[s],this);}}purgeStale(){let t=false;for(let i of h(this,o,it).call(this,{allowStale:true}))e(this,U).call(this,i)&&(h(this,o,st).call(this,e(this,E)[i],"expire"),t=true);return t}info(t){let i=e(this,T).get(t);if(i===void 0)return;let s=e(this,g)[i],n=h(this,o,S).call(this,s)?s.__staleWhileFetching:s;if(n===void 0)return;let r={value:n};if(e(this,N)&&e(this,X)){let a=e(this,N)[i],d=e(this,X)[i];if(a&&d){let c=a-(e(this,K).now()-d);r.ttl=c,r.start=Date.now();}}return e(this,B)&&(r.size=e(this,B)[i]),r}dump(){let t=[];for(let i of h(this,o,et).call(this,{allowStale:true})){let s=e(this,E)[i],n=e(this,g)[i],r=h(this,o,S).call(this,n)?n.__staleWhileFetching:n;if(r===void 0||s===void 0)continue;let a={value:r};if(e(this,N)&&e(this,X)){a.ttl=e(this,N)[i];let d=e(this,K).now()-e(this,X)[i];a.start=Math.floor(Date.now()-d);}e(this,B)&&(a.size=e(this,B)[i]),t.unshift([s,a]);}return t}load(t){this.clear();for(let[i,s]of t){if(s.start){let n=Date.now()-s.start;s.start=e(this,K).now()-n;}this.set(i,s.value,s);}}set(t,i,s={}){var k,V,Q,y;if(i===void 0)return this.delete(t),this;let{ttl:n=this.ttl,start:r,noDisposeOnSet:a=this.noDisposeOnSet,sizeCalculation:d=this.sizeCalculation,status:c}=s,{noUpdateTTL:O=this.noUpdateTTL}=s,J=e(this,Tt).call(this,t,i,s.size||0,d);if(this.maxEntrySize&&J>this.maxEntrySize)return c&&(c.set="miss",c.maxEntrySizeExceeded=true),h(this,o,st).call(this,t,"set"),this;let b=e(this,R)===0?void 0:e(this,T).get(t);if(b===void 0)b=e(this,R)===0?e(this,F):e(this,$).length!==0?e(this,$).pop():e(this,R)===e(this,P)?h(this,o,Dt).call(this,false):e(this,R),e(this,E)[b]=t,e(this,g)[b]=i,e(this,T).set(t,b),e(this,z)[e(this,F)]=b,e(this,G)[b]=e(this,F),f(this,F,b),Rt(this,R)._++,e(this,St).call(this,b,J,c),c&&(c.set="add"),O=false,e(this,mt)&&((k=e(this,ot))==null||k.call(this,i,t,"add"));else {h(this,o,wt).call(this,b);let w=e(this,g)[b];if(i!==w){if(e(this,nt)&&h(this,o,S).call(this,w)){w.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:p}=w;p!==void 0&&!a&&(e(this,q)&&((V=e(this,Y))==null||V.call(this,p,t,"set")),e(this,I)&&e(this,D)?.push([p,t,"set"]));}else a||(e(this,q)&&((Q=e(this,Y))==null||Q.call(this,w,t,"set")),e(this,I)&&e(this,D)?.push([w,t,"set"]));if(e(this,lt).call(this,b),e(this,St).call(this,b,J,c),e(this,g)[b]=i,c){c.set="replace";let p=w&&h(this,o,S).call(this,w)?w.__staleWhileFetching:w;p!==void 0&&(c.oldValue=p);}}else c&&(c.set="update");e(this,mt)&&this.onInsert?.(i,t,i===w?"update":"replace");}if(n!==0&&!e(this,N)&&h(this,o,Gt).call(this),e(this,N)&&(O||e(this,yt).call(this,b,n,r),c&&e(this,Z).call(this,c,b)),!a&&e(this,I)&&e(this,D)){let w=e(this,D),p;for(;p=w?.shift();)(y=e(this,j))==null||y.call(this,...p);}return this}pop(){var t;try{for(;e(this,R);){let i=e(this,g)[e(this,x)];if(h(this,o,Dt).call(this,!0),h(this,o,S).call(this,i)){if(i.__staleWhileFetching)return i.__staleWhileFetching}else if(i!==void 0)return i}}finally{if(e(this,I)&&e(this,D)){let i=e(this,D),s;for(;s=i?.shift();)(t=e(this,j))==null||t.call(this,...s);}}}has(t,i={}){let{updateAgeOnHas:s=this.updateAgeOnHas,status:n}=i,r=e(this,T).get(t);if(r!==void 0){let a=e(this,g)[r];if(h(this,o,S).call(this,a)&&a.__staleWhileFetching===void 0)return false;if(e(this,U).call(this,r))n&&(n.has="stale",e(this,Z).call(this,n,r));else return s&&e(this,ht).call(this,r),n&&(n.has="hit",e(this,Z).call(this,n,r)),true}else n&&(n.has="miss");return false}peek(t,i={}){let{allowStale:s=this.allowStale}=i,n=e(this,T).get(t);if(n===void 0||!s&&e(this,U).call(this,n))return;let r=e(this,g)[n];return h(this,o,S).call(this,r)?r.__staleWhileFetching:r}async fetch(t,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:n=this.updateAgeOnGet,noDeleteOnStaleGet:r=this.noDeleteOnStaleGet,ttl:a=this.ttl,noDisposeOnSet:d=this.noDisposeOnSet,size:c=0,sizeCalculation:O=this.sizeCalculation,noUpdateTTL:J=this.noUpdateTTL,noDeleteOnFetchRejection:b=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:k=this.allowStaleOnFetchRejection,ignoreFetchAbort:V=this.ignoreFetchAbort,allowStaleOnFetchAbort:Q=this.allowStaleOnFetchAbort,context:y,forceRefresh:w=false,status:p,signal:C}=i;if(!e(this,nt))return p&&(p.fetch="get"),this.get(t,{allowStale:s,updateAgeOnGet:n,noDeleteOnStaleGet:r,status:p});let M={allowStale:s,updateAgeOnGet:n,noDeleteOnStaleGet:r,ttl:a,noDisposeOnSet:d,size:c,sizeCalculation:O,noUpdateTTL:J,noDeleteOnFetchRejection:b,allowStaleOnFetchRejection:k,allowStaleOnFetchAbort:Q,ignoreFetchAbort:V,status:p,signal:C},v=e(this,T).get(t);if(v===void 0){p&&(p.fetch="miss");let W=h(this,o,vt).call(this,t,v,M,y);return W.__returned=W}else {let W=e(this,g)[v];if(h(this,o,S).call(this,W)){let ut=s&&W.__staleWhileFetching!==void 0;return p&&(p.fetch="inflight",ut&&(p.returnedStale=true)),ut?W.__staleWhileFetching:W.__returned=W}let bt=e(this,U).call(this,v);if(!w&&!bt)return p&&(p.fetch="hit"),h(this,o,wt).call(this,v),n&&e(this,ht).call(this,v),p&&e(this,Z).call(this,p,v),W;let ft=h(this,o,vt).call(this,t,v,M,y),ct=ft.__staleWhileFetching!==void 0&&s;return p&&(p.fetch=bt?"stale":"refresh",ct&&bt&&(p.returnedStale=true)),ct?ft.__staleWhileFetching:ft.__returned=ft}}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,_t);if(!s)throw new Error("no memoMethod provided to constructor");let{context:n,forceRefresh:r,...a}=i,d=this.get(t,a);if(!r&&d!==void 0)return d;let c=s(t,d,{options:a,context:n});return this.set(t,c,a),c}get(t,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:n=this.updateAgeOnGet,noDeleteOnStaleGet:r=this.noDeleteOnStaleGet,status:a}=i,d=e(this,T).get(t);if(d!==void 0){let c=e(this,g)[d],O=h(this,o,S).call(this,c);return a&&e(this,Z).call(this,a,d),e(this,U).call(this,d)?(a&&(a.get="stale"),O?(a&&s&&c.__staleWhileFetching!==void 0&&(a.returnedStale=true),s?c.__staleWhileFetching:void 0):(r||h(this,o,st).call(this,t,"expire"),a&&s&&(a.returnedStale=true),s?c:void 0)):(a&&(a.get="hit"),O?c.__staleWhileFetching:(h(this,o,wt).call(this,d),n&&e(this,ht).call(this,d),c))}else a&&(a.get="miss");}delete(t){return h(this,o,st).call(this,t,"delete")}clear(){return h(this,o,Vt).call(this,"delete")}};P=new WeakMap,L=new WeakMap,Y=new WeakMap,ot=new WeakMap,j=new WeakMap,pt=new WeakMap,_t=new WeakMap,K=new WeakMap,R=new WeakMap,H=new WeakMap,T=new WeakMap,E=new WeakMap,g=new WeakMap,z=new WeakMap,G=new WeakMap,x=new WeakMap,F=new WeakMap,$=new WeakMap,D=new WeakMap,B=new WeakMap,X=new WeakMap,N=new WeakMap,q=new WeakMap,nt=new WeakMap,I=new WeakMap,mt=new WeakMap,o=new WeakSet,Gt=function(){let t=new dt(e(this,P)),i=new dt(e(this,P));f(this,N,t),f(this,X,i),f(this,yt,(r,a,d=e(this,K).now())=>{if(i[r]=a!==0?d:0,t[r]=a,a!==0&&this.ttlAutopurge){let c=setTimeout(()=>{e(this,U).call(this,r)&&h(this,o,st).call(this,e(this,E)[r],"expire");},a+1);c.unref&&c.unref();}}),f(this,ht,r=>{i[r]=t[r]!==0?e(this,K).now():0;}),f(this,Z,(r,a)=>{if(t[a]){let d=t[a],c=i[a];if(!d||!c)return;r.ttl=d,r.start=c,r.now=s||n();let O=r.now-c;r.remainingTTL=d-O;}});let s=0,n=()=>{let r=e(this,K).now();if(this.ttlResolution>0){s=r;let a=setTimeout(()=>s=0,this.ttlResolution);a.unref&&a.unref();}return r};this.getRemainingTTL=r=>{let a=e(this,T).get(r);if(a===void 0)return 0;let d=t[a],c=i[a];if(!d||!c)return 1/0;let O=(s||n())-c;return d-O},f(this,U,r=>{let a=i[r],d=t[r];return !!d&&!!a&&(s||n())-a>d});},ht=new WeakMap,Z=new WeakMap,yt=new WeakMap,U=new WeakMap,Xt=function(){let t=new dt(e(this,P));f(this,H,0),f(this,B,t),f(this,lt,i=>{f(this,H,e(this,H)-t[i]),t[i]=0;}),f(this,Tt,(i,s,n,r)=>{if(h(this,o,S).call(this,s))return 0;if(!tt(n))if(r){if(typeof r!="function")throw new TypeError("sizeCalculation must be a function");if(n=r(s,i),!tt(n))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return n}),f(this,St,(i,s,n)=>{if(t[i]=s,e(this,L)){let r=e(this,L)-t[i];for(;e(this,H)>r;)h(this,o,Dt).call(this,true);}f(this,H,e(this,H)+t[i]),n&&(n.entrySize=s,n.totalCalculatedSize=e(this,H));});},lt=new WeakMap,St=new WeakMap,Tt=new WeakMap,et=function*({allowStale:t=this.allowStale}={}){if(e(this,R))for(let i=e(this,F);!(!h(this,o,Nt).call(this,i)||((t||!e(this,U).call(this,i))&&(yield i),i===e(this,x)));)i=e(this,G)[i];},it=function*({allowStale:t=this.allowStale}={}){if(e(this,R))for(let i=e(this,x);!(!h(this,o,Nt).call(this,i)||((t||!e(this,U).call(this,i))&&(yield i),i===e(this,F)));)i=e(this,z)[i];},Nt=function(t){return t!==void 0&&e(this,T).get(e(this,E)[t])===t},Dt=function(t){var r;let i=e(this,x),s=e(this,E)[i],n=e(this,g)[i];return e(this,nt)&&h(this,o,S).call(this,n)?n.__abortController.abort(new Error("evicted")):(e(this,q)||e(this,I))&&(e(this,q)&&((r=e(this,Y))==null||r.call(this,n,s,"evict")),e(this,I)&&e(this,D)?.push([n,s,"evict"])),e(this,lt).call(this,i),t&&(e(this,E)[i]=void 0,e(this,g)[i]=void 0,e(this,$).push(i)),e(this,R)===1?(f(this,x,f(this,F,0)),e(this,$).length=0):f(this,x,e(this,z)[i]),e(this,T).delete(s),Rt(this,R)._--,i},vt=function(t,i,s,n){let r=i===void 0?void 0:e(this,g)[i];if(h(this,o,S).call(this,r))return r;let a=new xt,{signal:d}=s;d?.addEventListener("abort",()=>a.abort(d.reason),{signal:a.signal});let c={signal:a.signal,options:s,context:n},O=(y,w=false)=>{let{aborted:p}=a.signal,C=s.ignoreFetchAbort&&y!==void 0;if(s.status&&(p&&!w?(s.status.fetchAborted=true,s.status.fetchError=a.signal.reason,C&&(s.status.fetchAbortIgnored=true)):s.status.fetchResolved=true),p&&!C&&!w)return b(a.signal.reason);let M=V;return e(this,g)[i]===V&&(y===void 0?M.__staleWhileFetching!==void 0?e(this,g)[i]=M.__staleWhileFetching:h(this,o,st).call(this,t,"fetch"):(s.status&&(s.status.fetchUpdated=true),this.set(t,y,c.options))),y},J=y=>(s.status&&(s.status.fetchRejected=true,s.status.fetchError=y),b(y)),b=y=>{let{aborted:w}=a.signal,p=w&&s.allowStaleOnFetchAbort,C=p||s.allowStaleOnFetchRejection,M=C||s.noDeleteOnFetchRejection,v=V;if(e(this,g)[i]===V&&(!M||v.__staleWhileFetching===void 0?h(this,o,st).call(this,t,"fetch"):p||(e(this,g)[i]=v.__staleWhileFetching)),C)return s.status&&v.__staleWhileFetching!==void 0&&(s.status.returnedStale=true),v.__staleWhileFetching;if(v.__returned===v)throw y},k=(y,w)=>{var C;let p=(C=e(this,pt))==null?void 0:C.call(this,t,r,c);p&&p instanceof Promise&&p.then(M=>y(M===void 0?void 0:M),w),a.signal.addEventListener("abort",()=>{(!s.ignoreFetchAbort||s.allowStaleOnFetchAbort)&&(y(void 0),s.allowStaleOnFetchAbort&&(y=M=>O(M,true)));});};s.status&&(s.status.fetchDispatched=true);let V=new Promise(k).then(O,J),Q=Object.assign(V,{__abortController:a,__staleWhileFetching:r,__returned:void 0});return i===void 0?(this.set(t,Q,{...c.options,status:void 0}),i=e(this,T).get(t)):e(this,g)[i]=Q,Q},S=function(t){if(!e(this,nt))return false;let i=t;return !!i&&i instanceof Promise&&i.hasOwnProperty("__staleWhileFetching")&&i.__abortController instanceof xt},Ut=function(t,i){e(this,G)[i]=t,e(this,z)[t]=i;},wt=function(t){t!==e(this,F)&&(t===e(this,x)?f(this,x,e(this,z)[t]):h(this,o,Ut).call(this,e(this,G)[t],e(this,z)[t]),h(this,o,Ut).call(this,e(this,F),t),f(this,F,t));},st=function(t,i){var n,r;let s=false;if(e(this,R)!==0){let a=e(this,T).get(t);if(a!==void 0)if(s=true,e(this,R)===1)h(this,o,Vt).call(this,i);else {e(this,lt).call(this,a);let d=e(this,g)[a];if(h(this,o,S).call(this,d)?d.__abortController.abort(new Error("deleted")):(e(this,q)||e(this,I))&&(e(this,q)&&((n=e(this,Y))==null||n.call(this,d,t,i)),e(this,I)&&e(this,D)?.push([d,t,i])),e(this,T).delete(t),e(this,E)[a]=void 0,e(this,g)[a]=void 0,a===e(this,F))f(this,F,e(this,G)[a]);else if(a===e(this,x))f(this,x,e(this,z)[a]);else {let c=e(this,G)[a];e(this,z)[c]=e(this,z)[a];let O=e(this,z)[a];e(this,G)[O]=e(this,G)[a];}Rt(this,R)._--,e(this,$).push(a);}}if(e(this,I)&&e(this,D)?.length){let a=e(this,D),d;for(;d=a?.shift();)(r=e(this,j))==null||r.call(this,...d);}return s},Vt=function(t){var i,s;for(let n of h(this,o,it).call(this,{allowStale:true})){let r=e(this,g)[n];if(h(this,o,S).call(this,r))r.__abortController.abort(new Error("deleted"));else {let a=e(this,E)[n];e(this,q)&&((i=e(this,Y))==null||i.call(this,r,a,t)),e(this,I)&&e(this,D)?.push([r,a,t]);}}if(e(this,T).clear(),e(this,g).fill(void 0),e(this,E).fill(void 0),e(this,N)&&e(this,X)&&(e(this,N).fill(0),e(this,X).fill(0)),e(this,B)&&e(this,B).fill(0),f(this,x,0),f(this,F,0),e(this,$).length=0,f(this,H,0),f(this,R,0),e(this,I)&&e(this,D)){let n=e(this,D),r;for(;r=n?.shift();)(s=e(this,j))==null||s.call(this,...r);}};var zt=Wt;var Et=class{constructor(t){_(this,"cache");_(this,"map",new Map);this.cache=new zt({max:t.cacheSize}),this.map=new Map;}get[Symbol.iterator](){return this.map[Symbol.iterator]}get[Symbol.toStringTag](){return this.map[Symbol.toStringTag]}clear(){return this.cache.clear(),this.map.clear()}delete(t){let i=this.map.delete(t);return i&&this.cache.delete(t),i}get forEach(){return this.map.forEach}get(t){let i=this.cache.get(t);return i||this.map.get(t)}has(t){return this.map.has(t)}set(t,i){return this.map.set(t,i),this.cache.set(t,i),this}get size(){return this.map.size}entries(){return this.map.entries()}keys(){return this.map.keys()}values(){return this.map.values()}};var A=class A{constructor(){}static clearOldTempVariables(t){A.tempStorageDeadlines.forEach((i,s)=>{i>t&&(A.tempStorage.delete(s),A.tempStorageDeadlines.delete(s),A.storage.cache.delete(s));});}static setVariable(t,i){let s=A.tempStorage.has(t);i==null?(A.storage.map.delete(t),!s&&A.storage.cache.delete(t)):(A.storage.map.set(t,i),!s&&A.storage.cache.set(t,i));}static getVariable(t){let i=A.storage.cache.get(t);return i===void 0&&(i=A.tempStorage.get(t)),i===void 0&&(i=A.storage.map.get(t)),Ft(i)}static removeVariable(t){A.storage.delete(t);}static setFlag(t,i){if(i)this.flags.includes(t)||this.flags.push(t);else {let s=this.flags.indexOf(t);s>-1&&this.flags.splice(s,1);}}static getFlag(t){return this.flags.includes(t)}};_(A,"storage",new Et({cacheSize:20})),_(A,"startingStorage",[]),_(A,"flags",Array()),_(A,"tempStorage",new Map),_(A,"tempStorageDeadlines",new Map);var u=A;var At=class{get storage(){return u.storage.map}get cache(){return u.storage.cache}get flags(){return u.flags}get tempStorage(){return u.tempStorage}get tempStorageDeadlines(){return u.tempStorageDeadlines}set startingStorage(t){let i=unifier.GameUnifier.stepCounter===0;Object.entries(t).forEach(([s,n])=>{u.startingStorage.push({key:s,value:n}),i&&u.storage.set(s,n);});}set(t,i){return u.setVariable(t,i)}setVariable(t,i){return this.set(t,i)}get(t){return u.getVariable(t)}getVariable(t){return this.get(t)}removeVariable(t){return u.removeVariable(t)}setTempVariable(t,i){if(i==null){this.removeTempVariable(t);return}else u.tempStorage.set(t,i),u.storage.cache.set(t,i),u.tempStorageDeadlines.has(t)||u.tempStorageDeadlines.set(t,unifier.GameUnifier.openedLabels);}removeTempVariable(t){u.tempStorage.has(t)&&(u.tempStorage.delete(t),u.tempStorageDeadlines.delete(t),u.storage.cache.delete(t));}setFlag(t,i){return u.setFlag(t,i)}getFlag(t){return u.getFlag(t)}clear(){this.storage.clear(),this.cache.clear(),u.flags=[],u.tempStorage.clear(),u.tempStorageDeadlines.clear(),u.startingStorage.forEach(({key:t,value:i})=>{this.storage.set(t,i);});}export(){let t=[];[...this.storage.keys()].forEach(n=>{t.push({key:n,value:this.storage.get(n)});});let i=[];[...u.tempStorage.keys()].forEach(n=>{i.push({key:n,value:u.tempStorage.get(n)});});let s=[];return [...u.tempStorageDeadlines.keys()].forEach(n=>{s.push({key:n,value:u.tempStorageDeadlines.get(n)});}),Ft({base:t,temp:i,tempDeadlines:s,flags:u.flags})}restore(t){this.clear();try{t?(Array.isArray(t)&&t.forEach(i=>{if(i.key==="___temp_storage___"){let s=i.value;Object.entries(s).forEach(([n,r])=>{u.tempStorage.set(n,r);});}else if(i.key==="___temp_storage_deadlines___"){let s=i.value;Object.entries(s).forEach(([n,r])=>{u.tempStorageDeadlines.set(n,r);});}else i.key==="___flags___"?i.value.forEach(n=>{u.flags.push(n);}):this.storage.set(i.key,i.value);}),"base"in t&&"temp"in t&&"tempDeadlines"in t?(t.base?.forEach(i=>{this.storage.set(i.key,i.value);}),t.temp?.forEach(i=>{u.tempStorage.set(i.key,i.value);}),t.tempDeadlines?.forEach(i=>{u.tempStorageDeadlines.set(i.key,i.value);})):Object.entries(t).forEach(([i,s])=>{i==="___temp_storage___"?Object.entries(s).forEach(([n,r])=>{u.tempStorage.set(n,r);}):i==="___temp_storage_deadlines___"?Object.entries(s).forEach(([n,r])=>{u.tempStorageDeadlines.set(n,r);}):i==="___flags___"?s.forEach(n=>{u.flags.push(n);}):this.storage.set(i,s);})):rt.warn("No storage data found");}catch(i){rt.error("Error importing data",i);}}};var It=class{constructor(t,i){_(this,"_id");_(this,"categoryId");this.categoryId=t,this._id=i;}get id(){return this._id}setStorageProperty(t,i){let s=u.getVariable(this.categoryId);s||(s={}),s.hasOwnProperty(this.id)||(s[this.id]={}),i==null?s[this.id].hasOwnProperty(t)&&delete s[this.id][t]:s[this.id]={...s[this.id],[t]:i},Object.keys(s[this.id]).length===0&&delete s[this.id],u.setVariable(this.categoryId,s);}getStorageProperty(t,i=this.id){let s=u.getVariable(this.categoryId);if(s&&s.hasOwnProperty(i)&&s[i].hasOwnProperty(t))return s[i][t]}};var te={CURRENT_DIALOGUE_MEMORY_KEY:"___current_dialogue_memory___",LAST_DIALOGUE_ADDED_IN_STEP_MEMORY_KEY:"___last_dialogue_added_in_step_memory___",CURRENT_MENU_OPTIONS_MEMORY_KEY:"___current_menu_options_memory___",LAST_MENU_OPTIONS_ADDED_IN_STEP_MEMORY_KEY:"___last_menu_options_added_in_step_memory___",CURRENT_INPUT_VALUE_MEMORY_KEY:"_input_value_",LAST_INPUT_ADDED_IN_STEP_MEMORY_KEY:"___last_input_added_in_step_memory___",CURRENT_INPUT_INFO_MEMORY_KEY:"___current_input_info_memory___",CHARACTER_CATEGORY_KEY:"___character___",ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY:"___glue___",OPENED_LABELS_COUNTER_KEY:"___opened_labels_counter___",ALL_CHOICES_MADE_KEY:"___all_choices_made___",CURRENT_STEP_TIMES_COUNTER_KEY:"___current_step_times_counter___",LAST_STEP_GLUED:"___last_step_glued___"};var xe=new At;exports.SYSTEM_RESERVED_STORAGE_KEYS=te;exports.StorageManagerStatic=u;exports.StoredClassModel=It;exports.storage=xe;
|
|
1
|
+
'use strict';var unifier=require('@drincs/pixi-vn/unifier');var Jt=Object.defineProperty;var Pt=l=>{throw TypeError(l)};var Qt=(l,t,i)=>t in l?Jt(l,t,{enumerable:true,configurable:true,writable:true,value:i}):l[t]=i;var _=(l,t,i)=>Qt(l,typeof t!="symbol"?t+"":t,i),Ct=(l,t,i)=>t.has(l)||Pt("Cannot "+i);var e=(l,t,i)=>(Ct(l,t,"read from private field"),i?i.call(l):t.get(l)),m=(l,t,i)=>t.has(l)?Pt("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(l):t.set(l,i),f=(l,t,i,s)=>(Ct(l,t,"write to private field"),t.set(l,i),i),h=(l,t,i)=>(Ct(l,t,"access private method"),i);var Rt=(l,t,i,s)=>({set _(n){f(l,t,n);},get _(){return e(l,t,s)}});var rt;(n=>(n.log=(r,...a)=>console.log(`[Pixi\u2019VN] ${r}`,...a),n.warn=(r,...a)=>console.warn(`[Pixi\u2019VN] ${r}`,...a),n.error=(r,...a)=>console.error(`[Pixi\u2019VN] ${r}`,...a),n.info=(r,...a)=>console.info(`[Pixi\u2019VN] ${r}`,...a)))(rt||(rt={}));function Ft(l){try{if(typeof l>"u")return l;let t=JSON.stringify(l);return JSON.parse(t)}catch(t){throw rt.error("Error creating exportable element",l,t),new Error("[Pixi\u2019VN] Error creating exportable element")}}var Zt=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,Ht=new Set,Mt=typeof process=="object"&&process?process:{},$t=(l,t,i,s)=>{typeof Mt.emitWarning=="function"?Mt.emitWarning(l,t,i,s):console.error(`[${i}] ${t}: ${l}`);},xt=globalThis.AbortController,Yt=globalThis.AbortSignal;if(typeof xt>"u"){Yt=class{constructor(){_(this,"onabort");_(this,"_onabort",[]);_(this,"reason");_(this,"aborted",false);}addEventListener(s,n){this._onabort.push(n);}},xt=class{constructor(){_(this,"signal",new Yt);t();}abort(s){if(!this.signal.aborted){this.signal.reason=s,this.signal.aborted=true;for(let n of this.signal._onabort)n(s);this.signal.onabort?.(s);}}};let l=Mt.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",t=()=>{l&&(l=false,$t("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",t));};}var kt=l=>!Ht.has(l),tt=l=>l&&l===Math.floor(l)&&l>0&&isFinite(l),Bt=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?dt:null:null,dt=class extends Array{constructor(t){super(t),this.fill(0);}},gt,at=class at{constructor(t,i){_(this,"heap");_(this,"length");if(!e(at,gt))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new i(t),this.length=0;}static create(t){let i=Bt(t);if(!i)return [];f(at,gt,true);let s=new at(t,i);return f(at,gt,false),s}push(t){this.heap[this.length++]=t;}pop(){return this.heap[--this.length]}};gt=new WeakMap,m(at,gt,false);var Lt=at,jt,Kt,P,L,Y,ot,j,pt,_t,K,R,H,T,E,g,z,G,x,F,$,D,B,X,N,q,nt,I,mt,o,Gt,ht,Z,wt,U,Xt,lt,St,Tt,et,it,Nt,Dt,vt,S,Ut,yt,st,Vt,Wt=class Wt{constructor(t){m(this,o);m(this,P);m(this,L);m(this,Y);m(this,ot);m(this,j);m(this,pt);m(this,_t);m(this,K);_(this,"ttl");_(this,"ttlResolution");_(this,"ttlAutopurge");_(this,"updateAgeOnGet");_(this,"updateAgeOnHas");_(this,"allowStale");_(this,"noDisposeOnSet");_(this,"noUpdateTTL");_(this,"maxEntrySize");_(this,"sizeCalculation");_(this,"noDeleteOnFetchRejection");_(this,"noDeleteOnStaleGet");_(this,"allowStaleOnFetchAbort");_(this,"allowStaleOnFetchRejection");_(this,"ignoreFetchAbort");m(this,R);m(this,H);m(this,T);m(this,E);m(this,g);m(this,z);m(this,G);m(this,x);m(this,F);m(this,$);m(this,D);m(this,B);m(this,X);m(this,N);m(this,q);m(this,nt);m(this,I);m(this,mt);m(this,ht,()=>{});m(this,Z,()=>{});m(this,wt,()=>{});m(this,U,()=>false);m(this,lt,t=>{});m(this,St,(t,i,s)=>{});m(this,Tt,(t,i,s,n)=>{if(s||n)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});_(this,jt,"LRUCache");let{max:i=0,ttl:s,ttlResolution:n=1,ttlAutopurge:r,updateAgeOnGet:a,updateAgeOnHas:d,allowStale:c,dispose:O,onInsert:J,disposeAfter:b,noDisposeOnSet:k,noUpdateTTL:V,maxSize:Q=0,maxEntrySize:w=0,sizeCalculation:y,fetchMethod:p,memoMethod:C,noDeleteOnFetchRejection:M,noDeleteOnStaleGet:v,allowStaleOnFetchRejection:W,allowStaleOnFetchAbort:bt,ignoreFetchAbort:ft,perf:Ot}=t;if(Ot!==void 0&&typeof Ot?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(f(this,K,Ot??Zt),i!==0&&!tt(i))throw new TypeError("max option must be a nonnegative integer");let ct=i?Bt(i):Array;if(!ct)throw new Error("invalid max value: "+i);if(f(this,P,i),f(this,L,Q),this.maxEntrySize=w||e(this,L),this.sizeCalculation=y,this.sizeCalculation){if(!e(this,L)&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(C!==void 0&&typeof C!="function")throw new TypeError("memoMethod must be a function if defined");if(f(this,_t,C),p!==void 0&&typeof p!="function")throw new TypeError("fetchMethod must be a function if specified");if(f(this,pt,p),f(this,nt,!!p),f(this,T,new Map),f(this,E,new Array(i).fill(void 0)),f(this,g,new Array(i).fill(void 0)),f(this,z,new ct(i)),f(this,G,new ct(i)),f(this,x,0),f(this,F,0),f(this,$,Lt.create(i)),f(this,R,0),f(this,H,0),typeof O=="function"&&f(this,Y,O),typeof J=="function"&&f(this,ot,J),typeof b=="function"?(f(this,j,b),f(this,D,[])):(f(this,j,void 0),f(this,D,void 0)),f(this,q,!!e(this,Y)),f(this,mt,!!e(this,ot)),f(this,I,!!e(this,j)),this.noDisposeOnSet=!!k,this.noUpdateTTL=!!V,this.noDeleteOnFetchRejection=!!M,this.allowStaleOnFetchRejection=!!W,this.allowStaleOnFetchAbort=!!bt,this.ignoreFetchAbort=!!ft,this.maxEntrySize!==0){if(e(this,L)!==0&&!tt(e(this,L)))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");h(this,o,Xt).call(this);}if(this.allowStale=!!c,this.noDeleteOnStaleGet=!!v,this.updateAgeOnGet=!!a,this.updateAgeOnHas=!!d,this.ttlResolution=tt(n)||n===0?n: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");h(this,o,Gt).call(this);}if(e(this,P)===0&&this.ttl===0&&e(this,L)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!e(this,P)&&!e(this,L)){let ut="LRU_CACHE_UNBOUNDED";kt(ut)&&(Ht.add(ut),$t("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",ut,Wt));}}get perf(){return e(this,K)}static unsafeExposeInternals(t){return {starts:e(t,X),ttls:e(t,N),sizes:e(t,B),keyMap:e(t,T),keyList:e(t,E),valList:e(t,g),next:e(t,z),prev:e(t,G),get head(){return e(t,x)},get tail(){return e(t,F)},free:e(t,$),isBackgroundFetch:i=>{var s;return h(s=t,o,S).call(s,i)},backgroundFetch:(i,s,n,r)=>{var a;return h(a=t,o,vt).call(a,i,s,n,r)},moveToTail:i=>{var s;return h(s=t,o,yt).call(s,i)},indexes:i=>{var s;return h(s=t,o,et).call(s,i)},rindexes:i=>{var s;return h(s=t,o,it).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,L)}get calculatedSize(){return e(this,H)}get size(){return e(this,R)}get fetchMethod(){return e(this,pt)}get memoMethod(){return e(this,_t)}get dispose(){return e(this,Y)}get onInsert(){return e(this,ot)}get disposeAfter(){return e(this,j)}getRemainingTTL(t){return e(this,T).has(t)?1/0:0}*entries(){for(let t of h(this,o,et).call(this))e(this,g)[t]!==void 0&&e(this,E)[t]!==void 0&&!h(this,o,S).call(this,e(this,g)[t])&&(yield [e(this,E)[t],e(this,g)[t]]);}*rentries(){for(let t of h(this,o,it).call(this))e(this,g)[t]!==void 0&&e(this,E)[t]!==void 0&&!h(this,o,S).call(this,e(this,g)[t])&&(yield [e(this,E)[t],e(this,g)[t]]);}*keys(){for(let t of h(this,o,et).call(this)){let i=e(this,E)[t];i!==void 0&&!h(this,o,S).call(this,e(this,g)[t])&&(yield i);}}*rkeys(){for(let t of h(this,o,it).call(this)){let i=e(this,E)[t];i!==void 0&&!h(this,o,S).call(this,e(this,g)[t])&&(yield i);}}*values(){for(let t of h(this,o,et).call(this))e(this,g)[t]!==void 0&&!h(this,o,S).call(this,e(this,g)[t])&&(yield e(this,g)[t]);}*rvalues(){for(let t of h(this,o,it).call(this))e(this,g)[t]!==void 0&&!h(this,o,S).call(this,e(this,g)[t])&&(yield e(this,g)[t]);}[(Kt=Symbol.iterator,jt=Symbol.toStringTag,Kt)](){return this.entries()}find(t,i={}){for(let s of h(this,o,et).call(this)){let n=e(this,g)[s],r=h(this,o,S).call(this,n)?n.__staleWhileFetching:n;if(r!==void 0&&t(r,e(this,E)[s],this))return this.get(e(this,E)[s],i)}}forEach(t,i=this){for(let s of h(this,o,et).call(this)){let n=e(this,g)[s],r=h(this,o,S).call(this,n)?n.__staleWhileFetching:n;r!==void 0&&t.call(i,r,e(this,E)[s],this);}}rforEach(t,i=this){for(let s of h(this,o,it).call(this)){let n=e(this,g)[s],r=h(this,o,S).call(this,n)?n.__staleWhileFetching:n;r!==void 0&&t.call(i,r,e(this,E)[s],this);}}purgeStale(){let t=false;for(let i of h(this,o,it).call(this,{allowStale:true}))e(this,U).call(this,i)&&(h(this,o,st).call(this,e(this,E)[i],"expire"),t=true);return t}info(t){let i=e(this,T).get(t);if(i===void 0)return;let s=e(this,g)[i],n=h(this,o,S).call(this,s)?s.__staleWhileFetching:s;if(n===void 0)return;let r={value:n};if(e(this,N)&&e(this,X)){let a=e(this,N)[i],d=e(this,X)[i];if(a&&d){let c=a-(e(this,K).now()-d);r.ttl=c,r.start=Date.now();}}return e(this,B)&&(r.size=e(this,B)[i]),r}dump(){let t=[];for(let i of h(this,o,et).call(this,{allowStale:true})){let s=e(this,E)[i],n=e(this,g)[i],r=h(this,o,S).call(this,n)?n.__staleWhileFetching:n;if(r===void 0||s===void 0)continue;let a={value:r};if(e(this,N)&&e(this,X)){a.ttl=e(this,N)[i];let d=e(this,K).now()-e(this,X)[i];a.start=Math.floor(Date.now()-d);}e(this,B)&&(a.size=e(this,B)[i]),t.unshift([s,a]);}return t}load(t){this.clear();for(let[i,s]of t){if(s.start){let n=Date.now()-s.start;s.start=e(this,K).now()-n;}this.set(i,s.value,s);}}set(t,i,s={}){var k,V,Q,w;if(i===void 0)return this.delete(t),this;let{ttl:n=this.ttl,start:r,noDisposeOnSet:a=this.noDisposeOnSet,sizeCalculation:d=this.sizeCalculation,status:c}=s,{noUpdateTTL:O=this.noUpdateTTL}=s,J=e(this,Tt).call(this,t,i,s.size||0,d);if(this.maxEntrySize&&J>this.maxEntrySize)return c&&(c.set="miss",c.maxEntrySizeExceeded=true),h(this,o,st).call(this,t,"set"),this;let b=e(this,R)===0?void 0:e(this,T).get(t);if(b===void 0)b=e(this,R)===0?e(this,F):e(this,$).length!==0?e(this,$).pop():e(this,R)===e(this,P)?h(this,o,Dt).call(this,false):e(this,R),e(this,E)[b]=t,e(this,g)[b]=i,e(this,T).set(t,b),e(this,z)[e(this,F)]=b,e(this,G)[b]=e(this,F),f(this,F,b),Rt(this,R)._++,e(this,St).call(this,b,J,c),c&&(c.set="add"),O=false,e(this,mt)&&((k=e(this,ot))==null||k.call(this,i,t,"add"));else {h(this,o,yt).call(this,b);let y=e(this,g)[b];if(i!==y){if(e(this,nt)&&h(this,o,S).call(this,y)){y.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:p}=y;p!==void 0&&!a&&(e(this,q)&&((V=e(this,Y))==null||V.call(this,p,t,"set")),e(this,I)&&e(this,D)?.push([p,t,"set"]));}else a||(e(this,q)&&((Q=e(this,Y))==null||Q.call(this,y,t,"set")),e(this,I)&&e(this,D)?.push([y,t,"set"]));if(e(this,lt).call(this,b),e(this,St).call(this,b,J,c),e(this,g)[b]=i,c){c.set="replace";let p=y&&h(this,o,S).call(this,y)?y.__staleWhileFetching:y;p!==void 0&&(c.oldValue=p);}}else c&&(c.set="update");e(this,mt)&&this.onInsert?.(i,t,i===y?"update":"replace");}if(n!==0&&!e(this,N)&&h(this,o,Gt).call(this),e(this,N)&&(O||e(this,wt).call(this,b,n,r),c&&e(this,Z).call(this,c,b)),!a&&e(this,I)&&e(this,D)){let y=e(this,D),p;for(;p=y?.shift();)(w=e(this,j))==null||w.call(this,...p);}return this}pop(){var t;try{for(;e(this,R);){let i=e(this,g)[e(this,x)];if(h(this,o,Dt).call(this,!0),h(this,o,S).call(this,i)){if(i.__staleWhileFetching)return i.__staleWhileFetching}else if(i!==void 0)return i}}finally{if(e(this,I)&&e(this,D)){let i=e(this,D),s;for(;s=i?.shift();)(t=e(this,j))==null||t.call(this,...s);}}}has(t,i={}){let{updateAgeOnHas:s=this.updateAgeOnHas,status:n}=i,r=e(this,T).get(t);if(r!==void 0){let a=e(this,g)[r];if(h(this,o,S).call(this,a)&&a.__staleWhileFetching===void 0)return false;if(e(this,U).call(this,r))n&&(n.has="stale",e(this,Z).call(this,n,r));else return s&&e(this,ht).call(this,r),n&&(n.has="hit",e(this,Z).call(this,n,r)),true}else n&&(n.has="miss");return false}peek(t,i={}){let{allowStale:s=this.allowStale}=i,n=e(this,T).get(t);if(n===void 0||!s&&e(this,U).call(this,n))return;let r=e(this,g)[n];return h(this,o,S).call(this,r)?r.__staleWhileFetching:r}async fetch(t,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:n=this.updateAgeOnGet,noDeleteOnStaleGet:r=this.noDeleteOnStaleGet,ttl:a=this.ttl,noDisposeOnSet:d=this.noDisposeOnSet,size:c=0,sizeCalculation:O=this.sizeCalculation,noUpdateTTL:J=this.noUpdateTTL,noDeleteOnFetchRejection:b=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:k=this.allowStaleOnFetchRejection,ignoreFetchAbort:V=this.ignoreFetchAbort,allowStaleOnFetchAbort:Q=this.allowStaleOnFetchAbort,context:w,forceRefresh:y=false,status:p,signal:C}=i;if(!e(this,nt))return p&&(p.fetch="get"),this.get(t,{allowStale:s,updateAgeOnGet:n,noDeleteOnStaleGet:r,status:p});let M={allowStale:s,updateAgeOnGet:n,noDeleteOnStaleGet:r,ttl:a,noDisposeOnSet:d,size:c,sizeCalculation:O,noUpdateTTL:J,noDeleteOnFetchRejection:b,allowStaleOnFetchRejection:k,allowStaleOnFetchAbort:Q,ignoreFetchAbort:V,status:p,signal:C},v=e(this,T).get(t);if(v===void 0){p&&(p.fetch="miss");let W=h(this,o,vt).call(this,t,v,M,w);return W.__returned=W}else {let W=e(this,g)[v];if(h(this,o,S).call(this,W)){let ut=s&&W.__staleWhileFetching!==void 0;return p&&(p.fetch="inflight",ut&&(p.returnedStale=true)),ut?W.__staleWhileFetching:W.__returned=W}let bt=e(this,U).call(this,v);if(!y&&!bt)return p&&(p.fetch="hit"),h(this,o,yt).call(this,v),n&&e(this,ht).call(this,v),p&&e(this,Z).call(this,p,v),W;let ft=h(this,o,vt).call(this,t,v,M,w),ct=ft.__staleWhileFetching!==void 0&&s;return p&&(p.fetch=bt?"stale":"refresh",ct&&bt&&(p.returnedStale=true)),ct?ft.__staleWhileFetching:ft.__returned=ft}}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,_t);if(!s)throw new Error("no memoMethod provided to constructor");let{context:n,forceRefresh:r,...a}=i,d=this.get(t,a);if(!r&&d!==void 0)return d;let c=s(t,d,{options:a,context:n});return this.set(t,c,a),c}get(t,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:n=this.updateAgeOnGet,noDeleteOnStaleGet:r=this.noDeleteOnStaleGet,status:a}=i,d=e(this,T).get(t);if(d!==void 0){let c=e(this,g)[d],O=h(this,o,S).call(this,c);return a&&e(this,Z).call(this,a,d),e(this,U).call(this,d)?(a&&(a.get="stale"),O?(a&&s&&c.__staleWhileFetching!==void 0&&(a.returnedStale=true),s?c.__staleWhileFetching:void 0):(r||h(this,o,st).call(this,t,"expire"),a&&s&&(a.returnedStale=true),s?c:void 0)):(a&&(a.get="hit"),O?c.__staleWhileFetching:(h(this,o,yt).call(this,d),n&&e(this,ht).call(this,d),c))}else a&&(a.get="miss");}delete(t){return h(this,o,st).call(this,t,"delete")}clear(){return h(this,o,Vt).call(this,"delete")}};P=new WeakMap,L=new WeakMap,Y=new WeakMap,ot=new WeakMap,j=new WeakMap,pt=new WeakMap,_t=new WeakMap,K=new WeakMap,R=new WeakMap,H=new WeakMap,T=new WeakMap,E=new WeakMap,g=new WeakMap,z=new WeakMap,G=new WeakMap,x=new WeakMap,F=new WeakMap,$=new WeakMap,D=new WeakMap,B=new WeakMap,X=new WeakMap,N=new WeakMap,q=new WeakMap,nt=new WeakMap,I=new WeakMap,mt=new WeakMap,o=new WeakSet,Gt=function(){let t=new dt(e(this,P)),i=new dt(e(this,P));f(this,N,t),f(this,X,i),f(this,wt,(r,a,d=e(this,K).now())=>{if(i[r]=a!==0?d:0,t[r]=a,a!==0&&this.ttlAutopurge){let c=setTimeout(()=>{e(this,U).call(this,r)&&h(this,o,st).call(this,e(this,E)[r],"expire");},a+1);c.unref&&c.unref();}}),f(this,ht,r=>{i[r]=t[r]!==0?e(this,K).now():0;}),f(this,Z,(r,a)=>{if(t[a]){let d=t[a],c=i[a];if(!d||!c)return;r.ttl=d,r.start=c,r.now=s||n();let O=r.now-c;r.remainingTTL=d-O;}});let s=0,n=()=>{let r=e(this,K).now();if(this.ttlResolution>0){s=r;let a=setTimeout(()=>s=0,this.ttlResolution);a.unref&&a.unref();}return r};this.getRemainingTTL=r=>{let a=e(this,T).get(r);if(a===void 0)return 0;let d=t[a],c=i[a];if(!d||!c)return 1/0;let O=(s||n())-c;return d-O},f(this,U,r=>{let a=i[r],d=t[r];return !!d&&!!a&&(s||n())-a>d});},ht=new WeakMap,Z=new WeakMap,wt=new WeakMap,U=new WeakMap,Xt=function(){let t=new dt(e(this,P));f(this,H,0),f(this,B,t),f(this,lt,i=>{f(this,H,e(this,H)-t[i]),t[i]=0;}),f(this,Tt,(i,s,n,r)=>{if(h(this,o,S).call(this,s))return 0;if(!tt(n))if(r){if(typeof r!="function")throw new TypeError("sizeCalculation must be a function");if(n=r(s,i),!tt(n))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return n}),f(this,St,(i,s,n)=>{if(t[i]=s,e(this,L)){let r=e(this,L)-t[i];for(;e(this,H)>r;)h(this,o,Dt).call(this,true);}f(this,H,e(this,H)+t[i]),n&&(n.entrySize=s,n.totalCalculatedSize=e(this,H));});},lt=new WeakMap,St=new WeakMap,Tt=new WeakMap,et=function*({allowStale:t=this.allowStale}={}){if(e(this,R))for(let i=e(this,F);!(!h(this,o,Nt).call(this,i)||((t||!e(this,U).call(this,i))&&(yield i),i===e(this,x)));)i=e(this,G)[i];},it=function*({allowStale:t=this.allowStale}={}){if(e(this,R))for(let i=e(this,x);!(!h(this,o,Nt).call(this,i)||((t||!e(this,U).call(this,i))&&(yield i),i===e(this,F)));)i=e(this,z)[i];},Nt=function(t){return t!==void 0&&e(this,T).get(e(this,E)[t])===t},Dt=function(t){var r;let i=e(this,x),s=e(this,E)[i],n=e(this,g)[i];return e(this,nt)&&h(this,o,S).call(this,n)?n.__abortController.abort(new Error("evicted")):(e(this,q)||e(this,I))&&(e(this,q)&&((r=e(this,Y))==null||r.call(this,n,s,"evict")),e(this,I)&&e(this,D)?.push([n,s,"evict"])),e(this,lt).call(this,i),t&&(e(this,E)[i]=void 0,e(this,g)[i]=void 0,e(this,$).push(i)),e(this,R)===1?(f(this,x,f(this,F,0)),e(this,$).length=0):f(this,x,e(this,z)[i]),e(this,T).delete(s),Rt(this,R)._--,i},vt=function(t,i,s,n){let r=i===void 0?void 0:e(this,g)[i];if(h(this,o,S).call(this,r))return r;let a=new xt,{signal:d}=s;d?.addEventListener("abort",()=>a.abort(d.reason),{signal:a.signal});let c={signal:a.signal,options:s,context:n},O=(w,y=false)=>{let{aborted:p}=a.signal,C=s.ignoreFetchAbort&&w!==void 0;if(s.status&&(p&&!y?(s.status.fetchAborted=true,s.status.fetchError=a.signal.reason,C&&(s.status.fetchAbortIgnored=true)):s.status.fetchResolved=true),p&&!C&&!y)return b(a.signal.reason);let M=V;return e(this,g)[i]===V&&(w===void 0?M.__staleWhileFetching!==void 0?e(this,g)[i]=M.__staleWhileFetching:h(this,o,st).call(this,t,"fetch"):(s.status&&(s.status.fetchUpdated=true),this.set(t,w,c.options))),w},J=w=>(s.status&&(s.status.fetchRejected=true,s.status.fetchError=w),b(w)),b=w=>{let{aborted:y}=a.signal,p=y&&s.allowStaleOnFetchAbort,C=p||s.allowStaleOnFetchRejection,M=C||s.noDeleteOnFetchRejection,v=V;if(e(this,g)[i]===V&&(!M||v.__staleWhileFetching===void 0?h(this,o,st).call(this,t,"fetch"):p||(e(this,g)[i]=v.__staleWhileFetching)),C)return s.status&&v.__staleWhileFetching!==void 0&&(s.status.returnedStale=true),v.__staleWhileFetching;if(v.__returned===v)throw w},k=(w,y)=>{var C;let p=(C=e(this,pt))==null?void 0:C.call(this,t,r,c);p&&p instanceof Promise&&p.then(M=>w(M===void 0?void 0:M),y),a.signal.addEventListener("abort",()=>{(!s.ignoreFetchAbort||s.allowStaleOnFetchAbort)&&(w(void 0),s.allowStaleOnFetchAbort&&(w=M=>O(M,true)));});};s.status&&(s.status.fetchDispatched=true);let V=new Promise(k).then(O,J),Q=Object.assign(V,{__abortController:a,__staleWhileFetching:r,__returned:void 0});return i===void 0?(this.set(t,Q,{...c.options,status:void 0}),i=e(this,T).get(t)):e(this,g)[i]=Q,Q},S=function(t){if(!e(this,nt))return false;let i=t;return !!i&&i instanceof Promise&&i.hasOwnProperty("__staleWhileFetching")&&i.__abortController instanceof xt},Ut=function(t,i){e(this,G)[i]=t,e(this,z)[t]=i;},yt=function(t){t!==e(this,F)&&(t===e(this,x)?f(this,x,e(this,z)[t]):h(this,o,Ut).call(this,e(this,G)[t],e(this,z)[t]),h(this,o,Ut).call(this,e(this,F),t),f(this,F,t));},st=function(t,i){var n,r;let s=false;if(e(this,R)!==0){let a=e(this,T).get(t);if(a!==void 0)if(s=true,e(this,R)===1)h(this,o,Vt).call(this,i);else {e(this,lt).call(this,a);let d=e(this,g)[a];if(h(this,o,S).call(this,d)?d.__abortController.abort(new Error("deleted")):(e(this,q)||e(this,I))&&(e(this,q)&&((n=e(this,Y))==null||n.call(this,d,t,i)),e(this,I)&&e(this,D)?.push([d,t,i])),e(this,T).delete(t),e(this,E)[a]=void 0,e(this,g)[a]=void 0,a===e(this,F))f(this,F,e(this,G)[a]);else if(a===e(this,x))f(this,x,e(this,z)[a]);else {let c=e(this,G)[a];e(this,z)[c]=e(this,z)[a];let O=e(this,z)[a];e(this,G)[O]=e(this,G)[a];}Rt(this,R)._--,e(this,$).push(a);}}if(e(this,I)&&e(this,D)?.length){let a=e(this,D),d;for(;d=a?.shift();)(r=e(this,j))==null||r.call(this,...d);}return s},Vt=function(t){var i,s;for(let n of h(this,o,it).call(this,{allowStale:true})){let r=e(this,g)[n];if(h(this,o,S).call(this,r))r.__abortController.abort(new Error("deleted"));else {let a=e(this,E)[n];e(this,q)&&((i=e(this,Y))==null||i.call(this,r,a,t)),e(this,I)&&e(this,D)?.push([r,a,t]);}}if(e(this,T).clear(),e(this,g).fill(void 0),e(this,E).fill(void 0),e(this,N)&&e(this,X)&&(e(this,N).fill(0),e(this,X).fill(0)),e(this,B)&&e(this,B).fill(0),f(this,x,0),f(this,F,0),e(this,$).length=0,f(this,H,0),f(this,R,0),e(this,I)&&e(this,D)){let n=e(this,D),r;for(;r=n?.shift();)(s=e(this,j))==null||s.call(this,...r);}};var zt=Wt;var Et=class{constructor(t){_(this,"cache");_(this,"map",new Map);this.cache=new zt({max:t.cacheSize}),this.map=new Map;}get[Symbol.iterator](){return this.map[Symbol.iterator]}get[Symbol.toStringTag](){return this.map[Symbol.toStringTag]}clear(){return this.cache.clear(),this.map.clear()}delete(t){let i=this.map.delete(t);return i&&this.cache.delete(t),i}get forEach(){return this.map.forEach}get(t){let i=this.cache.get(t);return i||this.map.get(t)}has(t){return this.map.has(t)}set(t,i){return this.map.set(t,i),this.cache.set(t,i),this}get size(){return this.map.size}entries(){return this.map.entries()}keys(){return this.map.keys()}values(){return this.map.values()}};var A=class A{constructor(){}static clearOldTempVariables(t){A.tempStorageDeadlines.forEach((i,s)=>{i>t&&(A.tempStorage.delete(s),A.tempStorageDeadlines.delete(s),A.storage.cache.delete(s));});}static setVariable(t,i){let s=A.tempStorage.has(t);i==null?(A.storage.map.delete(t),!s&&A.storage.cache.delete(t)):(A.storage.map.set(t,i),!s&&A.storage.cache.set(t,i));}static getVariable(t){let i=A.storage.cache.get(t);return i===void 0&&(i=A.tempStorage.get(t)),i===void 0&&(i=A.storage.map.get(t)),Ft(i)}static removeVariable(t){A.storage.delete(t);}static setFlag(t,i){if(i)this.flags.includes(t)||this.flags.push(t);else {let s=this.flags.indexOf(t);s>-1&&this.flags.splice(s,1);}}static getFlag(t){return this.flags.includes(t)}};_(A,"storage",new Et({cacheSize:20})),_(A,"startingStorage",[]),_(A,"flags",Array()),_(A,"tempStorage",new Map),_(A,"tempStorageDeadlines",new Map);var u=A;var At=class{get storage(){return u.storage.map}get cache(){return u.storage.cache}get flags(){return u.flags}get tempStorage(){return u.tempStorage}get tempStorageDeadlines(){return u.tempStorageDeadlines}set startingStorage(t){let i=unifier.GameUnifier.stepCounter===0;Object.entries(t).forEach(([s,n])=>{u.startingStorage.push({key:s,value:n}),i&&u.storage.set(s,n);});}set(t,i){return u.setVariable(t,i)}setVariable(t,i){return this.set(t,i)}get(t){return u.getVariable(t)}getVariable(t){return this.get(t)}removeVariable(t){return u.removeVariable(t)}setTempVariable(t,i){if(i==null){this.removeTempVariable(t);return}else u.tempStorage.set(t,i),u.storage.cache.set(t,i),u.tempStorageDeadlines.has(t)||u.tempStorageDeadlines.set(t,unifier.GameUnifier.openedLabels);}removeTempVariable(t){u.tempStorage.has(t)&&(u.tempStorage.delete(t),u.tempStorageDeadlines.delete(t),u.storage.cache.delete(t));}setFlag(t,i){return u.setFlag(t,i)}getFlag(t){return u.getFlag(t)}clear(){this.storage.clear(),this.cache.clear(),u.flags=[],u.tempStorage.clear(),u.tempStorageDeadlines.clear(),u.startingStorage.forEach(({key:t,value:i})=>{this.storage.set(t,i);});}export(){let t=[];[...this.storage.keys()].forEach(n=>{t.push({key:n,value:this.storage.get(n)});});let i=[];[...u.tempStorage.keys()].forEach(n=>{i.push({key:n,value:u.tempStorage.get(n)});});let s=[];return [...u.tempStorageDeadlines.keys()].forEach(n=>{s.push({key:n,value:u.tempStorageDeadlines.get(n)});}),Ft({base:t,temp:i,tempDeadlines:s,flags:u.flags})}restore(t){this.clear();try{t?(Array.isArray(t)&&t.forEach(i=>{if(i.key==="___temp_storage___"){let s=i.value;Object.entries(s).forEach(([n,r])=>{u.tempStorage.set(n,r);});}else if(i.key==="___temp_storage_deadlines___"){let s=i.value;Object.entries(s).forEach(([n,r])=>{u.tempStorageDeadlines.set(n,r);});}else i.key==="___flags___"?i.value.forEach(n=>{u.flags.push(n);}):this.storage.set(i.key,i.value);}),"base"in t&&"temp"in t&&"tempDeadlines"in t?(t.base?.forEach(i=>{this.storage.set(i.key,i.value);}),t.temp?.forEach(i=>{u.tempStorage.set(i.key,i.value);}),t.tempDeadlines?.forEach(i=>{u.tempStorageDeadlines.set(i.key,i.value);})):Object.entries(t).forEach(([i,s])=>{i==="___temp_storage___"?Object.entries(s).forEach(([n,r])=>{u.tempStorage.set(n,r);}):i==="___temp_storage_deadlines___"?Object.entries(s).forEach(([n,r])=>{u.tempStorageDeadlines.set(n,r);}):i==="___flags___"?s.forEach(n=>{u.flags.push(n);}):this.storage.set(i,s);})):rt.warn("No storage data found");}catch(i){rt.error("Error importing data",i);}}};var It=class{constructor(t,i){_(this,"id");_(this,"categoryId");this.categoryId=t,this.id=i;}setStorageProperty(t,i){let s=u.getVariable(this.categoryId);s||(s={}),s.hasOwnProperty(this.id)||(s[this.id]={}),i==null?s[this.id].hasOwnProperty(t)&&delete s[this.id][t]:s[this.id]={...s[this.id],[t]:i},Object.keys(s[this.id]).length===0&&delete s[this.id],u.setVariable(this.categoryId,s);}getStorageProperty(t,i=this.id){let s=u.getVariable(this.categoryId);if(s&&s.hasOwnProperty(i)&&s[i].hasOwnProperty(t))return s[i][t]}};var te={CURRENT_DIALOGUE_MEMORY_KEY:"___current_dialogue_memory___",LAST_DIALOGUE_ADDED_IN_STEP_MEMORY_KEY:"___last_dialogue_added_in_step_memory___",CURRENT_MENU_OPTIONS_MEMORY_KEY:"___current_menu_options_memory___",LAST_MENU_OPTIONS_ADDED_IN_STEP_MEMORY_KEY:"___last_menu_options_added_in_step_memory___",CURRENT_INPUT_VALUE_MEMORY_KEY:"_input_value_",LAST_INPUT_ADDED_IN_STEP_MEMORY_KEY:"___last_input_added_in_step_memory___",CURRENT_INPUT_INFO_MEMORY_KEY:"___current_input_info_memory___",CHARACTER_CATEGORY_KEY:"___character___",ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY:"___glue___",OPENED_LABELS_COUNTER_KEY:"___opened_labels_counter___",ALL_CHOICES_MADE_KEY:"___all_choices_made___",CURRENT_STEP_TIMES_COUNTER_KEY:"___current_step_times_counter___",LAST_STEP_GLUED:"___last_step_glued___"};var xe=new At;exports.SYSTEM_RESERVED_STORAGE_KEYS=te;exports.StorageManagerStatic=u;exports.StoredClassModel=It;exports.storage=xe;
|
package/dist/storage.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { LRUCache } from 'lru-cache';
|
|
2
2
|
import { a as StorageElementType } from './StorageElementType-dAIVJeiw.cjs';
|
|
3
3
|
export { S as StorageObjectType } from './StorageElementType-dAIVJeiw.cjs';
|
|
4
|
-
export { S as StoredClassModel } from './StoredClassModel-
|
|
4
|
+
export { S as StoredClassModel } from './StoredClassModel-BgRY86sq.cjs';
|
|
5
5
|
import { C as CachedMap } from './CachedMap-DZLvJAnA.cjs';
|
|
6
6
|
|
|
7
7
|
interface StorageGameStateItem<T = StorageElementType> {
|
package/dist/storage.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { LRUCache } from 'lru-cache';
|
|
2
2
|
import { a as StorageElementType } from './StorageElementType-dAIVJeiw.js';
|
|
3
3
|
export { S as StorageObjectType } from './StorageElementType-dAIVJeiw.js';
|
|
4
|
-
export { S as StoredClassModel } from './StoredClassModel-
|
|
4
|
+
export { S as StoredClassModel } from './StoredClassModel-BgRY86sq.js';
|
|
5
5
|
import { C as CachedMap } from './CachedMap-DZLvJAnA.js';
|
|
6
6
|
|
|
7
7
|
interface StorageGameStateItem<T = StorageElementType> {
|
package/dist/storage.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{a as StorageManagerStatic,b as StoredClassModel,c as storage}from'./chunk-
|
|
1
|
+
export{a as StorageManagerStatic,b as StoredClassModel,c as storage}from'./chunk-CSAIUPQQ.mjs';export{a as SYSTEM_RESERVED_STORAGE_KEYS}from'./chunk-6GO4XVS7.mjs';import'./chunk-RXNJBYVP.mjs';import'./chunk-GNJIUFU2.mjs';
|
package/dist/vite-listener.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var characters=require('@drincs/pixi-vn/characters'),narration=require('@drincs/pixi-vn/narration'),pixi_js=require('@drincs/pixi-vn/pixi.js');function
|
|
1
|
+
'use strict';var canvas=require('@drincs/pixi-vn/canvas'),characters=require('@drincs/pixi-vn/characters'),narration=require('@drincs/pixi-vn/narration'),pixi_js=require('@drincs/pixi-vn/pixi.js');function l(){try{let e=characters.RegisteredCharacters.values();fetch("/pixi-vn/characters",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});}catch{}try{let e=narration.RegisteredLabels.keys();fetch("/pixi-vn/labels",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});}catch{}try{let e=pixi_js.Assets.resolver._assetMap,a=pixi_js.Assets.resolver._bundles,s={bundles:[]};Object.entries(a).forEach(([r,p])=>{let t=[];p.forEach(i=>{if(e[i]){let c=e[i];t=[...t,...c];}}),s.bundles.push({name:r,assets:t});}),fetch("/pixi-vn/assets/manifest",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});}catch{}try{let e={height:canvas.canvas.app.screen.height,width:canvas.canvas.app.screen.width};fetch("/pixi-vn/canvas/options",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});}catch{}}exports.setupPixivnViteData=l;
|
package/dist/vite-listener.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import'./chunk-TTRUPDAB.mjs';import {RegisteredCharacters}from'@drincs/pixi-vn/characters';import {RegisteredLabels}from'@drincs/pixi-vn/narration';import {Assets}from'@drincs/pixi-vn/pixi.js';function
|
|
1
|
+
import'./chunk-TTRUPDAB.mjs';import {canvas}from'@drincs/pixi-vn/canvas';import {RegisteredCharacters}from'@drincs/pixi-vn/characters';import {RegisteredLabels}from'@drincs/pixi-vn/narration';import {Assets}from'@drincs/pixi-vn/pixi.js';function l(){try{let e=RegisteredCharacters.values();fetch("/pixi-vn/characters",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});}catch{}try{let e=RegisteredLabels.keys();fetch("/pixi-vn/labels",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});}catch{}try{let e=Assets.resolver._assetMap,a=Assets.resolver._bundles,s={bundles:[]};Object.entries(a).forEach(([r,p])=>{let t=[];p.forEach(i=>{if(e[i]){let c=e[i];t=[...t,...c];}}),s.bundles.push({name:r,assets:t});}),fetch("/pixi-vn/assets/manifest",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});}catch{}try{let e={height:canvas.app.screen.height,width:canvas.app.screen.width};fetch("/pixi-vn/canvas/options",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});}catch{}}export{l as setupPixivnViteData};
|
package/dist/vite.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var s=null,d=null,
|
|
1
|
+
'use strict';var s=null,o=null,d=null,l=null;function u(){return {name:"vite-plugin-pixi-vn",configureServer(a){a.middlewares.use("/pixi-vn/characters",(i,t)=>{if(t.setHeader("Content-Type","application/json"),i.method==="GET"){if(!s){t.statusCode=404,t.end(JSON.stringify({error:"Characters not initialized"}));return}t.statusCode=200,t.end(JSON.stringify(s));}if(i.method==="POST"){let n="";i.on("data",e=>n+=e),i.on("end",()=>{try{s=JSON.parse(n),t.statusCode=201,t.end(JSON.stringify({message:"Characters updated successfully"}));}catch{t.statusCode=400,t.end(JSON.stringify({error:"Invalid JSON format"}));}});}}),a.middlewares.use("/pixi-vn/labels",(i,t)=>{if(t.setHeader("Content-Type","application/json"),i.method==="GET"){if(!o){t.statusCode=404,t.end(JSON.stringify({error:"Labels not initialized"}));return}t.statusCode=200,t.end(JSON.stringify(o));}if(i.method==="POST"){let n="";i.on("data",e=>n+=e),i.on("end",()=>{try{o=JSON.parse(n),t.statusCode=201,t.end(JSON.stringify({message:"Labels updated successfully"}));}catch{t.statusCode=400,t.end(JSON.stringify({error:"Invalid JSON format"}));}});}}),a.middlewares.use("/pixi-vn/assets/manifest",(i,t)=>{if(t.setHeader("Content-Type","application/json"),i.method==="GET"){if(!d){t.statusCode=404,t.end(JSON.stringify({error:"Manifest not initialized"}));return}t.statusCode=200,t.end(JSON.stringify(d));}if(i.method==="POST"){let n="";i.on("data",e=>n+=e),i.on("end",()=>{try{d=JSON.parse(n),t.statusCode=201,t.end(JSON.stringify({message:"Manifest updated successfully"}));}catch{t.statusCode=400,t.end(JSON.stringify({error:"Invalid JSON format"}));}});}}),a.middlewares.use("/pixi-vn/canvas/options",(i,t)=>{if(t.setHeader("Content-Type","application/json"),i.method==="GET"){if(!l){t.statusCode=404,t.end(JSON.stringify({error:"Options not initialized"}));return}t.statusCode=200,t.end(JSON.stringify(l));}if(i.method==="POST"){let n="";i.on("data",e=>n+=e),i.on("end",()=>{try{l=JSON.parse(n),t.statusCode=201,t.end(JSON.stringify({message:"Options updated successfully"}));}catch{t.statusCode=400,t.end(JSON.stringify({error:"Invalid JSON format"}));}});}});}}}exports.vitePluginPixivn=u;
|
package/dist/vite.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import'./chunk-TTRUPDAB.mjs';var s=null,d=null,
|
|
1
|
+
import'./chunk-TTRUPDAB.mjs';var s=null,o=null,d=null,l=null;function u(){return {name:"vite-plugin-pixi-vn",configureServer(a){a.middlewares.use("/pixi-vn/characters",(i,t)=>{if(t.setHeader("Content-Type","application/json"),i.method==="GET"){if(!s){t.statusCode=404,t.end(JSON.stringify({error:"Characters not initialized"}));return}t.statusCode=200,t.end(JSON.stringify(s));}if(i.method==="POST"){let n="";i.on("data",e=>n+=e),i.on("end",()=>{try{s=JSON.parse(n),t.statusCode=201,t.end(JSON.stringify({message:"Characters updated successfully"}));}catch{t.statusCode=400,t.end(JSON.stringify({error:"Invalid JSON format"}));}});}}),a.middlewares.use("/pixi-vn/labels",(i,t)=>{if(t.setHeader("Content-Type","application/json"),i.method==="GET"){if(!o){t.statusCode=404,t.end(JSON.stringify({error:"Labels not initialized"}));return}t.statusCode=200,t.end(JSON.stringify(o));}if(i.method==="POST"){let n="";i.on("data",e=>n+=e),i.on("end",()=>{try{o=JSON.parse(n),t.statusCode=201,t.end(JSON.stringify({message:"Labels updated successfully"}));}catch{t.statusCode=400,t.end(JSON.stringify({error:"Invalid JSON format"}));}});}}),a.middlewares.use("/pixi-vn/assets/manifest",(i,t)=>{if(t.setHeader("Content-Type","application/json"),i.method==="GET"){if(!d){t.statusCode=404,t.end(JSON.stringify({error:"Manifest not initialized"}));return}t.statusCode=200,t.end(JSON.stringify(d));}if(i.method==="POST"){let n="";i.on("data",e=>n+=e),i.on("end",()=>{try{d=JSON.parse(n),t.statusCode=201,t.end(JSON.stringify({message:"Manifest updated successfully"}));}catch{t.statusCode=400,t.end(JSON.stringify({error:"Invalid JSON format"}));}});}}),a.middlewares.use("/pixi-vn/canvas/options",(i,t)=>{if(t.setHeader("Content-Type","application/json"),i.method==="GET"){if(!l){t.statusCode=404,t.end(JSON.stringify({error:"Options not initialized"}));return}t.statusCode=200,t.end(JSON.stringify(l));}if(i.method==="POST"){let n="";i.on("data",e=>n+=e),i.on("end",()=>{try{l=JSON.parse(n),t.statusCode=201,t.end(JSON.stringify({message:"Options updated successfully"}));}catch{t.statusCode=400,t.end(JSON.stringify({error:"Invalid JSON format"}));}});}});}}}export{u as vitePluginPixivn};
|