@drincs/pixi-vn 1.3.22 → 1.3.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.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)),_=(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),c=(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 Ut=(l,e,i,s)=>({set _(o){c(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}`);},Dt=globalThis.AbortController,Qt=globalThis.AbortSignal;if(typeof Dt>"u"){Qt=class{constructor(){S(this,"onabort");S(this,"_onabort",[]);S(this,"reason");S(this,"aborted",false);}addEventListener(s,o){this._onabort.push(o);}},Dt=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 [];c(ht,gt,true);let s=new ht(e,i);return c(ht,gt,false),s}push(e){this.heap[this.length++]=e;}pop(){return this.heap[--this.length]}};gt=new WeakMap,_(ht,gt,false);var Nt=ht,Zt,te,q,P,K,lt,$,_t,vt,Y,E,B,A,x,p,R,M,F,T,X,U,J,Q,V,Z,ot,j,yt,a,Pt,ct,et,wt,G,ne,ft,St,At,st,nt,Mt,Ot,Ct,b,Vt,xt,rt,Gt,Wt=class Wt{constructor(e){_(this,a);_(this,q);_(this,P);_(this,K);_(this,lt);_(this,$);_(this,_t);_(this,vt);_(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");_(this,E);_(this,B);_(this,A);_(this,x);_(this,p);_(this,R);_(this,M);_(this,F);_(this,T);_(this,X);_(this,U);_(this,J);_(this,Q);_(this,V);_(this,Z);_(this,ot);_(this,j);_(this,yt);_(this,ct,()=>{});_(this,et,()=>{});_(this,wt,()=>{});_(this,G,()=>false);_(this,ft,e=>{});_(this,St,(e,i,s)=>{});_(this,At,(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:d,allowStale:u,dispose:w,onInsert:k,disposeAfter:f,noDisposeOnSet:W,noUpdateTTL:O,maxSize:g=0,maxEntrySize:v=0,sizeCalculation:y,fetchMethod:m,memoMethod:z,noDeleteOnFetchRejection:L,noDeleteOnStaleGet:C,allowStaleOnFetchRejection:H,allowStaleOnFetchAbort:bt,ignoreFetchAbort:ut,perf:Tt}=e;if(Tt!==void 0&&typeof Tt?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(c(this,Y,Tt??ce),i!==0&&!it(i))throw new TypeError("max option must be a nonnegative integer");let dt=i?se(i):Array;if(!dt)throw new Error("invalid max value: "+i);if(c(this,q,i),c(this,P,g),this.maxEntrySize=v||t(this,P),this.sizeCalculation=y,this.sizeCalculation){if(!t(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(c(this,vt,z),m!==void 0&&typeof m!="function")throw new TypeError("fetchMethod must be a function if specified");if(c(this,_t,m),c(this,ot,!!m),c(this,A,new Map),c(this,x,new Array(i).fill(void 0)),c(this,p,new Array(i).fill(void 0)),c(this,R,new dt(i)),c(this,M,new dt(i)),c(this,F,0),c(this,T,0),c(this,X,Nt.create(i)),c(this,E,0),c(this,B,0),typeof w=="function"&&c(this,K,w),typeof k=="function"&&c(this,lt,k),typeof f=="function"?(c(this,$,f),c(this,U,[])):(c(this,$,void 0),c(this,U,void 0)),c(this,Z,!!t(this,K)),c(this,yt,!!t(this,lt)),c(this,j,!!t(this,$)),this.noDisposeOnSet=!!W,this.noUpdateTTL=!!O,this.noDeleteOnFetchRejection=!!L,this.allowStaleOnFetchRejection=!!H,this.allowStaleOnFetchAbort=!!bt,this.ignoreFetchAbort=!!ut,this.maxEntrySize!==0){if(t(this,P)!==0&&!it(t(this,P)))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=!!u,this.noDeleteOnStaleGet=!!C,this.updateAgeOnGet=!!r,this.updateAgeOnHas=!!d,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,Pt).call(this);}if(t(this,q)===0&&this.ttl===0&&t(this,P)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!t(this,q)&&!t(this,P)){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,V),sizes:t(e,J),keyMap:t(e,A),keyList:t(e,x),valList:t(e,p),next:t(e,R),prev:t(e,M),get head(){return t(e,F)},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,Ct).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,G).call(s,i)}}}get max(){return t(this,q)}get maxSize(){return t(this,P)}get calculatedSize(){return t(this,B)}get size(){return t(this,E)}get fetchMethod(){return t(this,_t)}get memoMethod(){return t(this,vt)}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,p)[e]!==void 0&&t(this,x)[e]!==void 0&&!h(this,a,b).call(this,t(this,p)[e])&&(yield [t(this,x)[e],t(this,p)[e]]);}*rentries(){for(let e of h(this,a,nt).call(this))t(this,p)[e]!==void 0&&t(this,x)[e]!==void 0&&!h(this,a,b).call(this,t(this,p)[e])&&(yield [t(this,x)[e],t(this,p)[e]]);}*keys(){for(let e of h(this,a,st).call(this)){let i=t(this,x)[e];i!==void 0&&!h(this,a,b).call(this,t(this,p)[e])&&(yield i);}}*rkeys(){for(let e of h(this,a,nt).call(this)){let i=t(this,x)[e];i!==void 0&&!h(this,a,b).call(this,t(this,p)[e])&&(yield i);}}*values(){for(let e of h(this,a,st).call(this))t(this,p)[e]!==void 0&&!h(this,a,b).call(this,t(this,p)[e])&&(yield t(this,p)[e]);}*rvalues(){for(let e of h(this,a,nt).call(this))t(this,p)[e]!==void 0&&!h(this,a,b).call(this,t(this,p)[e])&&(yield t(this,p)[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,p)[s],n=h(this,a,b).call(this,o)?o.__staleWhileFetching:o;if(n!==void 0&&e(n,t(this,x)[s],this))return this.get(t(this,x)[s],i)}}forEach(e,i=this){for(let s of h(this,a,st).call(this)){let o=t(this,p)[s],n=h(this,a,b).call(this,o)?o.__staleWhileFetching:o;n!==void 0&&e.call(i,n,t(this,x)[s],this);}}rforEach(e,i=this){for(let s of h(this,a,nt).call(this)){let o=t(this,p)[s],n=h(this,a,b).call(this,o)?o.__staleWhileFetching:o;n!==void 0&&e.call(i,n,t(this,x)[s],this);}}purgeStale(){let e=false;for(let i of h(this,a,nt).call(this,{allowStale:true}))t(this,G).call(this,i)&&(h(this,a,rt).call(this,t(this,x)[i],"expire"),e=true);return e}info(e){let i=t(this,A).get(e);if(i===void 0)return;let s=t(this,p)[i],o=h(this,a,b).call(this,s)?s.__staleWhileFetching:s;if(o===void 0)return;let n={value:o};if(t(this,V)&&t(this,Q)){let r=t(this,V)[i],d=t(this,Q)[i];if(r&&d){let u=r-(t(this,Y).now()-d);n.ttl=u,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,x)[i],o=t(this,p)[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,V)&&t(this,Q)){r.ttl=t(this,V)[i];let d=t(this,Y).now()-t(this,Q)[i];r.start=Math.floor(Date.now()-d);}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 W,O,g,v;if(i===void 0)return this.delete(e),this;let{ttl:o=this.ttl,start:n,noDisposeOnSet:r=this.noDisposeOnSet,sizeCalculation:d=this.sizeCalculation,status:u}=s,{noUpdateTTL:w=this.noUpdateTTL}=s,k=t(this,At).call(this,e,i,s.size||0,d);if(this.maxEntrySize&&k>this.maxEntrySize)return u&&(u.set="miss",u.maxEntrySizeExceeded=true),h(this,a,rt).call(this,e,"set"),this;let f=t(this,E)===0?void 0:t(this,A).get(e);if(f===void 0)f=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,Ot).call(this,false):t(this,E),t(this,x)[f]=e,t(this,p)[f]=i,t(this,A).set(e,f),t(this,R)[t(this,T)]=f,t(this,M)[f]=t(this,T),c(this,T,f),Ut(this,E)._++,t(this,St).call(this,f,k,u),u&&(u.set="add"),w=false,t(this,yt)&&((W=t(this,lt))==null||W.call(this,i,e,"add"));else {h(this,a,xt).call(this,f);let y=t(this,p)[f];if(i!==y){if(t(this,ot)&&h(this,a,b).call(this,y)){y.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:m}=y;m!==void 0&&!r&&(t(this,Z)&&((O=t(this,K))==null||O.call(this,m,e,"set")),t(this,j)&&t(this,U)?.push([m,e,"set"]));}else r||(t(this,Z)&&((g=t(this,K))==null||g.call(this,y,e,"set")),t(this,j)&&t(this,U)?.push([y,e,"set"]));if(t(this,ft).call(this,f),t(this,St).call(this,f,k,u),t(this,p)[f]=i,u){u.set="replace";let m=y&&h(this,a,b).call(this,y)?y.__staleWhileFetching:y;m!==void 0&&(u.oldValue=m);}}else u&&(u.set="update");t(this,yt)&&this.onInsert?.(i,e,i===y?"update":"replace");}if(o!==0&&!t(this,V)&&h(this,a,Pt).call(this),t(this,V)&&(w||t(this,wt).call(this,f,o,n),u&&t(this,et).call(this,u,f)),!r&&t(this,j)&&t(this,U)){let y=t(this,U),m;for(;m=y?.shift();)(v=t(this,$))==null||v.call(this,...m);}return this}pop(){var e;try{for(;t(this,E);){let i=t(this,p)[t(this,F)];if(h(this,a,Ot).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,j)&&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,p)[n];if(h(this,a,b).call(this,r)&&r.__staleWhileFetching===void 0)return false;if(t(this,G).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,G).call(this,o))return;let n=t(this,p)[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:d=this.noDisposeOnSet,size:u=0,sizeCalculation:w=this.sizeCalculation,noUpdateTTL:k=this.noUpdateTTL,noDeleteOnFetchRejection:f=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:W=this.allowStaleOnFetchRejection,ignoreFetchAbort:O=this.ignoreFetchAbort,allowStaleOnFetchAbort:g=this.allowStaleOnFetchAbort,context:v,forceRefresh:y=false,status:m,signal:z}=i;if(!t(this,ot))return m&&(m.fetch="get"),this.get(e,{allowStale:s,updateAgeOnGet:o,noDeleteOnStaleGet:n,status:m});let L={allowStale:s,updateAgeOnGet:o,noDeleteOnStaleGet:n,ttl:r,noDisposeOnSet:d,size:u,sizeCalculation:w,noUpdateTTL:k,noDeleteOnFetchRejection:f,allowStaleOnFetchRejection:W,allowStaleOnFetchAbort:g,ignoreFetchAbort:O,status:m,signal:z},C=t(this,A).get(e);if(C===void 0){m&&(m.fetch="miss");let H=h(this,a,Ct).call(this,e,C,L,v);return H.__returned=H}else {let H=t(this,p)[C];if(h(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 bt=t(this,G).call(this,C);if(!y&&!bt)return m&&(m.fetch="hit"),h(this,a,xt).call(this,C),o&&t(this,ct).call(this,C),m&&t(this,et).call(this,m,C),H;let ut=h(this,a,Ct).call(this,e,C,L,v),dt=ut.__staleWhileFetching!==void 0&&s;return m&&(m.fetch=bt?"stale":"refresh",dt&&bt&&(m.returnedStale=true)),dt?ut.__staleWhileFetching:ut.__returned=ut}}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,vt);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 u=s(e,d,{options:r,context:o});return this.set(e,u,r),u}get(e,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:o=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,status:r}=i,d=t(this,A).get(e);if(d!==void 0){let u=t(this,p)[d],w=h(this,a,b).call(this,u);return r&&t(this,et).call(this,r,d),t(this,G).call(this,d)?(r&&(r.get="stale"),w?(r&&s&&u.__staleWhileFetching!==void 0&&(r.returnedStale=true),s?u.__staleWhileFetching:void 0):(n||h(this,a,rt).call(this,e,"expire"),r&&s&&(r.returnedStale=true),s?u:void 0)):(r&&(r.get="hit"),w?u.__staleWhileFetching:(h(this,a,xt).call(this,d),o&&t(this,ct).call(this,d),u))}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,P=new WeakMap,K=new WeakMap,lt=new WeakMap,$=new WeakMap,_t=new WeakMap,vt=new WeakMap,Y=new WeakMap,E=new WeakMap,B=new WeakMap,A=new WeakMap,x=new WeakMap,p=new WeakMap,R=new WeakMap,M=new WeakMap,F=new WeakMap,T=new WeakMap,X=new WeakMap,U=new WeakMap,J=new WeakMap,Q=new WeakMap,V=new WeakMap,Z=new WeakMap,ot=new WeakMap,j=new WeakMap,yt=new WeakMap,a=new WeakSet,Pt=function(){let e=new mt(t(this,q)),i=new mt(t(this,q));c(this,V,e),c(this,Q,i),c(this,wt,(n,r,d=t(this,Y).now())=>{if(i[n]=r!==0?d:0,e[n]=r,r!==0&&this.ttlAutopurge){let u=setTimeout(()=>{t(this,G).call(this,n)&&h(this,a,rt).call(this,t(this,x)[n],"expire");},r+1);u.unref&&u.unref();}}),c(this,ct,n=>{i[n]=e[n]!==0?t(this,Y).now():0;}),c(this,et,(n,r)=>{if(e[r]){let d=e[r],u=i[r];if(!d||!u)return;n.ttl=d,n.start=u,n.now=s||o();let w=n.now-u;n.remainingTTL=d-w;}});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 d=e[r],u=i[r];if(!d||!u)return 1/0;let w=(s||o())-u;return d-w},c(this,G,n=>{let r=i[n],d=e[n];return !!d&&!!r&&(s||o())-r>d});},ct=new WeakMap,et=new WeakMap,wt=new WeakMap,G=new WeakMap,ne=function(){let e=new mt(t(this,q));c(this,B,0),c(this,J,e),c(this,ft,i=>{c(this,B,t(this,B)-e[i]),e[i]=0;}),c(this,At,(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}),c(this,St,(i,s,o)=>{if(e[i]=s,t(this,P)){let n=t(this,P)-e[i];for(;t(this,B)>n;)h(this,a,Ot).call(this,true);}c(this,B,t(this,B)+e[i]),o&&(o.entrySize=s,o.totalCalculatedSize=t(this,B));});},ft=new WeakMap,St=new WeakMap,At=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,G).call(this,i))&&(yield i),i===t(this,F)));)i=t(this,M)[i];},nt=function*({allowStale:e=this.allowStale}={}){if(t(this,E))for(let i=t(this,F);!(!h(this,a,Mt).call(this,i)||((e||!t(this,G).call(this,i))&&(yield i),i===t(this,T)));)i=t(this,R)[i];},Mt=function(e){return e!==void 0&&t(this,A).get(t(this,x)[e])===e},Ot=function(e){var n;let i=t(this,F),s=t(this,x)[i],o=t(this,p)[i];return t(this,ot)&&h(this,a,b).call(this,o)?o.__abortController.abort(new Error("evicted")):(t(this,Z)||t(this,j))&&(t(this,Z)&&((n=t(this,K))==null||n.call(this,o,s,"evict")),t(this,j)&&t(this,U)?.push([o,s,"evict"])),t(this,ft).call(this,i),e&&(t(this,x)[i]=void 0,t(this,p)[i]=void 0,t(this,X).push(i)),t(this,E)===1?(c(this,F,c(this,T,0)),t(this,X).length=0):c(this,F,t(this,R)[i]),t(this,A).delete(s),Ut(this,E)._--,i},Ct=function(e,i,s,o){let n=i===void 0?void 0:t(this,p)[i];if(h(this,a,b).call(this,n))return n;let r=new Dt,{signal:d}=s;d?.addEventListener("abort",()=>r.abort(d.reason),{signal:r.signal});let u={signal:r.signal,options:s,context:o},w=(v,y=false)=>{let{aborted:m}=r.signal,z=s.ignoreFetchAbort&&v!==void 0;if(s.status&&(m&&!y?(s.status.fetchAborted=true,s.status.fetchError=r.signal.reason,z&&(s.status.fetchAbortIgnored=true)):s.status.fetchResolved=true),m&&!z&&!y)return f(r.signal.reason);let L=O;return t(this,p)[i]===O&&(v===void 0?L.__staleWhileFetching!==void 0?t(this,p)[i]=L.__staleWhileFetching:h(this,a,rt).call(this,e,"fetch"):(s.status&&(s.status.fetchUpdated=true),this.set(e,v,u.options))),v},k=v=>(s.status&&(s.status.fetchRejected=true,s.status.fetchError=v),f(v)),f=v=>{let{aborted:y}=r.signal,m=y&&s.allowStaleOnFetchAbort,z=m||s.allowStaleOnFetchRejection,L=z||s.noDeleteOnFetchRejection,C=O;if(t(this,p)[i]===O&&(!L||C.__staleWhileFetching===void 0?h(this,a,rt).call(this,e,"fetch"):m||(t(this,p)[i]=C.__staleWhileFetching)),z)return s.status&&C.__staleWhileFetching!==void 0&&(s.status.returnedStale=true),C.__staleWhileFetching;if(C.__returned===C)throw v},W=(v,y)=>{var z;let m=(z=t(this,_t))==null?void 0:z.call(this,e,n,u);m&&m instanceof Promise&&m.then(L=>v(L===void 0?void 0:L),y),r.signal.addEventListener("abort",()=>{(!s.ignoreFetchAbort||s.allowStaleOnFetchAbort)&&(v(void 0),s.allowStaleOnFetchAbort&&(v=L=>w(L,true)));});};s.status&&(s.status.fetchDispatched=true);let O=new Promise(W).then(w,k),g=Object.assign(O,{__abortController:r,__staleWhileFetching:n,__returned:void 0});return i===void 0?(this.set(e,g,{...u.options,status:void 0}),i=t(this,A).get(e)):t(this,p)[i]=g,g},b=function(e){if(!t(this,ot))return false;let i=e;return !!i&&i instanceof Promise&&i.hasOwnProperty("__staleWhileFetching")&&i.__abortController instanceof Dt},Vt=function(e,i){t(this,M)[i]=e,t(this,R)[e]=i;},xt=function(e){e!==t(this,T)&&(e===t(this,F)?c(this,F,t(this,R)[e]):h(this,a,Vt).call(this,t(this,M)[e],t(this,R)[e]),h(this,a,Vt).call(this,t(this,T),e),c(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 d=t(this,p)[r];if(h(this,a,b).call(this,d)?d.__abortController.abort(new Error("deleted")):(t(this,Z)||t(this,j))&&(t(this,Z)&&((o=t(this,K))==null||o.call(this,d,e,i)),t(this,j)&&t(this,U)?.push([d,e,i])),t(this,A).delete(e),t(this,x)[r]=void 0,t(this,p)[r]=void 0,r===t(this,T))c(this,T,t(this,M)[r]);else if(r===t(this,F))c(this,F,t(this,R)[r]);else {let u=t(this,M)[r];t(this,R)[u]=t(this,R)[r];let w=t(this,R)[r];t(this,M)[w]=t(this,M)[r];}Ut(this,E)._--,t(this,X).push(r);}}if(t(this,j)&&t(this,U)?.length){let r=t(this,U),d;for(;d=r?.shift();)(n=t(this,$))==null||n.call(this,...d);}return s},Gt=function(e){var i,s;for(let o of h(this,a,nt).call(this,{allowStale:true})){let n=t(this,p)[o];if(h(this,a,b).call(this,n))n.__abortController.abort(new Error("deleted"));else {let r=t(this,x)[o];t(this,Z)&&((i=t(this,K))==null||i.call(this,n,r,e)),t(this,j)&&t(this,U)?.push([n,r,e]);}}if(t(this,A).clear(),t(this,p).fill(void 0),t(this,x).fill(void 0),t(this,V)&&t(this,Q)&&(t(this,V).fill(0),t(this,Q).fill(0)),t(this,J)&&t(this,J).fill(0),c(this,F,0),c(this,T,0),t(this,X).length=0,c(this,B,0),c(this,E,0),t(this,j)&&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 Et="1.3.22";var Ht="repeat";function kt(l){return {type:"pause",duration:l}}var qt="__game_layer__";var re={};var Kt={};le(Kt,{createExportableElement:()=>oe});var jt;(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)))(jt||(jt={}));function oe(l){try{if(typeof l>"u")return l;let e=JSON.stringify(l);return JSON.parse(e)}catch(e){throw jt.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)),_=(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),c=(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 Ut=(l,e,i,s)=>({set _(o){c(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}`);},Dt=globalThis.AbortController,Qt=globalThis.AbortSignal;if(typeof Dt>"u"){Qt=class{constructor(){S(this,"onabort");S(this,"_onabort",[]);S(this,"reason");S(this,"aborted",false);}addEventListener(s,o){this._onabort.push(o);}},Dt=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 [];c(ht,gt,true);let s=new ht(e,i);return c(ht,gt,false),s}push(e){this.heap[this.length++]=e;}pop(){return this.heap[--this.length]}};gt=new WeakMap,_(ht,gt,false);var Nt=ht,Zt,te,q,P,K,lt,$,_t,vt,Y,E,B,A,x,p,R,M,F,T,X,U,J,Q,V,Z,ot,j,yt,a,Pt,ct,et,wt,G,ne,ft,St,At,st,nt,Mt,Ot,Ct,b,Vt,xt,rt,Gt,Wt=class Wt{constructor(e){_(this,a);_(this,q);_(this,P);_(this,K);_(this,lt);_(this,$);_(this,_t);_(this,vt);_(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");_(this,E);_(this,B);_(this,A);_(this,x);_(this,p);_(this,R);_(this,M);_(this,F);_(this,T);_(this,X);_(this,U);_(this,J);_(this,Q);_(this,V);_(this,Z);_(this,ot);_(this,j);_(this,yt);_(this,ct,()=>{});_(this,et,()=>{});_(this,wt,()=>{});_(this,G,()=>false);_(this,ft,e=>{});_(this,St,(e,i,s)=>{});_(this,At,(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:d,allowStale:u,dispose:w,onInsert:k,disposeAfter:f,noDisposeOnSet:W,noUpdateTTL:O,maxSize:g=0,maxEntrySize:v=0,sizeCalculation:y,fetchMethod:m,memoMethod:z,noDeleteOnFetchRejection:L,noDeleteOnStaleGet:C,allowStaleOnFetchRejection:H,allowStaleOnFetchAbort:bt,ignoreFetchAbort:ut,perf:Tt}=e;if(Tt!==void 0&&typeof Tt?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(c(this,Y,Tt??ce),i!==0&&!it(i))throw new TypeError("max option must be a nonnegative integer");let dt=i?se(i):Array;if(!dt)throw new Error("invalid max value: "+i);if(c(this,q,i),c(this,P,g),this.maxEntrySize=v||t(this,P),this.sizeCalculation=y,this.sizeCalculation){if(!t(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(c(this,vt,z),m!==void 0&&typeof m!="function")throw new TypeError("fetchMethod must be a function if specified");if(c(this,_t,m),c(this,ot,!!m),c(this,A,new Map),c(this,x,new Array(i).fill(void 0)),c(this,p,new Array(i).fill(void 0)),c(this,R,new dt(i)),c(this,M,new dt(i)),c(this,F,0),c(this,T,0),c(this,X,Nt.create(i)),c(this,E,0),c(this,B,0),typeof w=="function"&&c(this,K,w),typeof k=="function"&&c(this,lt,k),typeof f=="function"?(c(this,$,f),c(this,U,[])):(c(this,$,void 0),c(this,U,void 0)),c(this,Z,!!t(this,K)),c(this,yt,!!t(this,lt)),c(this,j,!!t(this,$)),this.noDisposeOnSet=!!W,this.noUpdateTTL=!!O,this.noDeleteOnFetchRejection=!!L,this.allowStaleOnFetchRejection=!!H,this.allowStaleOnFetchAbort=!!bt,this.ignoreFetchAbort=!!ut,this.maxEntrySize!==0){if(t(this,P)!==0&&!it(t(this,P)))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=!!u,this.noDeleteOnStaleGet=!!C,this.updateAgeOnGet=!!r,this.updateAgeOnHas=!!d,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,Pt).call(this);}if(t(this,q)===0&&this.ttl===0&&t(this,P)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!t(this,q)&&!t(this,P)){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,V),sizes:t(e,J),keyMap:t(e,A),keyList:t(e,x),valList:t(e,p),next:t(e,R),prev:t(e,M),get head(){return t(e,F)},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,Ct).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,G).call(s,i)}}}get max(){return t(this,q)}get maxSize(){return t(this,P)}get calculatedSize(){return t(this,B)}get size(){return t(this,E)}get fetchMethod(){return t(this,_t)}get memoMethod(){return t(this,vt)}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,p)[e]!==void 0&&t(this,x)[e]!==void 0&&!h(this,a,b).call(this,t(this,p)[e])&&(yield [t(this,x)[e],t(this,p)[e]]);}*rentries(){for(let e of h(this,a,nt).call(this))t(this,p)[e]!==void 0&&t(this,x)[e]!==void 0&&!h(this,a,b).call(this,t(this,p)[e])&&(yield [t(this,x)[e],t(this,p)[e]]);}*keys(){for(let e of h(this,a,st).call(this)){let i=t(this,x)[e];i!==void 0&&!h(this,a,b).call(this,t(this,p)[e])&&(yield i);}}*rkeys(){for(let e of h(this,a,nt).call(this)){let i=t(this,x)[e];i!==void 0&&!h(this,a,b).call(this,t(this,p)[e])&&(yield i);}}*values(){for(let e of h(this,a,st).call(this))t(this,p)[e]!==void 0&&!h(this,a,b).call(this,t(this,p)[e])&&(yield t(this,p)[e]);}*rvalues(){for(let e of h(this,a,nt).call(this))t(this,p)[e]!==void 0&&!h(this,a,b).call(this,t(this,p)[e])&&(yield t(this,p)[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,p)[s],n=h(this,a,b).call(this,o)?o.__staleWhileFetching:o;if(n!==void 0&&e(n,t(this,x)[s],this))return this.get(t(this,x)[s],i)}}forEach(e,i=this){for(let s of h(this,a,st).call(this)){let o=t(this,p)[s],n=h(this,a,b).call(this,o)?o.__staleWhileFetching:o;n!==void 0&&e.call(i,n,t(this,x)[s],this);}}rforEach(e,i=this){for(let s of h(this,a,nt).call(this)){let o=t(this,p)[s],n=h(this,a,b).call(this,o)?o.__staleWhileFetching:o;n!==void 0&&e.call(i,n,t(this,x)[s],this);}}purgeStale(){let e=false;for(let i of h(this,a,nt).call(this,{allowStale:true}))t(this,G).call(this,i)&&(h(this,a,rt).call(this,t(this,x)[i],"expire"),e=true);return e}info(e){let i=t(this,A).get(e);if(i===void 0)return;let s=t(this,p)[i],o=h(this,a,b).call(this,s)?s.__staleWhileFetching:s;if(o===void 0)return;let n={value:o};if(t(this,V)&&t(this,Q)){let r=t(this,V)[i],d=t(this,Q)[i];if(r&&d){let u=r-(t(this,Y).now()-d);n.ttl=u,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,x)[i],o=t(this,p)[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,V)&&t(this,Q)){r.ttl=t(this,V)[i];let d=t(this,Y).now()-t(this,Q)[i];r.start=Math.floor(Date.now()-d);}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 W,O,g,v;if(i===void 0)return this.delete(e),this;let{ttl:o=this.ttl,start:n,noDisposeOnSet:r=this.noDisposeOnSet,sizeCalculation:d=this.sizeCalculation,status:u}=s,{noUpdateTTL:w=this.noUpdateTTL}=s,k=t(this,At).call(this,e,i,s.size||0,d);if(this.maxEntrySize&&k>this.maxEntrySize)return u&&(u.set="miss",u.maxEntrySizeExceeded=true),h(this,a,rt).call(this,e,"set"),this;let f=t(this,E)===0?void 0:t(this,A).get(e);if(f===void 0)f=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,Ot).call(this,false):t(this,E),t(this,x)[f]=e,t(this,p)[f]=i,t(this,A).set(e,f),t(this,R)[t(this,T)]=f,t(this,M)[f]=t(this,T),c(this,T,f),Ut(this,E)._++,t(this,St).call(this,f,k,u),u&&(u.set="add"),w=false,t(this,yt)&&((W=t(this,lt))==null||W.call(this,i,e,"add"));else {h(this,a,xt).call(this,f);let y=t(this,p)[f];if(i!==y){if(t(this,ot)&&h(this,a,b).call(this,y)){y.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:m}=y;m!==void 0&&!r&&(t(this,Z)&&((O=t(this,K))==null||O.call(this,m,e,"set")),t(this,j)&&t(this,U)?.push([m,e,"set"]));}else r||(t(this,Z)&&((g=t(this,K))==null||g.call(this,y,e,"set")),t(this,j)&&t(this,U)?.push([y,e,"set"]));if(t(this,ft).call(this,f),t(this,St).call(this,f,k,u),t(this,p)[f]=i,u){u.set="replace";let m=y&&h(this,a,b).call(this,y)?y.__staleWhileFetching:y;m!==void 0&&(u.oldValue=m);}}else u&&(u.set="update");t(this,yt)&&this.onInsert?.(i,e,i===y?"update":"replace");}if(o!==0&&!t(this,V)&&h(this,a,Pt).call(this),t(this,V)&&(w||t(this,wt).call(this,f,o,n),u&&t(this,et).call(this,u,f)),!r&&t(this,j)&&t(this,U)){let y=t(this,U),m;for(;m=y?.shift();)(v=t(this,$))==null||v.call(this,...m);}return this}pop(){var e;try{for(;t(this,E);){let i=t(this,p)[t(this,F)];if(h(this,a,Ot).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,j)&&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,p)[n];if(h(this,a,b).call(this,r)&&r.__staleWhileFetching===void 0)return false;if(t(this,G).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,G).call(this,o))return;let n=t(this,p)[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:d=this.noDisposeOnSet,size:u=0,sizeCalculation:w=this.sizeCalculation,noUpdateTTL:k=this.noUpdateTTL,noDeleteOnFetchRejection:f=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:W=this.allowStaleOnFetchRejection,ignoreFetchAbort:O=this.ignoreFetchAbort,allowStaleOnFetchAbort:g=this.allowStaleOnFetchAbort,context:v,forceRefresh:y=false,status:m,signal:z}=i;if(!t(this,ot))return m&&(m.fetch="get"),this.get(e,{allowStale:s,updateAgeOnGet:o,noDeleteOnStaleGet:n,status:m});let L={allowStale:s,updateAgeOnGet:o,noDeleteOnStaleGet:n,ttl:r,noDisposeOnSet:d,size:u,sizeCalculation:w,noUpdateTTL:k,noDeleteOnFetchRejection:f,allowStaleOnFetchRejection:W,allowStaleOnFetchAbort:g,ignoreFetchAbort:O,status:m,signal:z},C=t(this,A).get(e);if(C===void 0){m&&(m.fetch="miss");let H=h(this,a,Ct).call(this,e,C,L,v);return H.__returned=H}else {let H=t(this,p)[C];if(h(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 bt=t(this,G).call(this,C);if(!y&&!bt)return m&&(m.fetch="hit"),h(this,a,xt).call(this,C),o&&t(this,ct).call(this,C),m&&t(this,et).call(this,m,C),H;let ut=h(this,a,Ct).call(this,e,C,L,v),dt=ut.__staleWhileFetching!==void 0&&s;return m&&(m.fetch=bt?"stale":"refresh",dt&&bt&&(m.returnedStale=true)),dt?ut.__staleWhileFetching:ut.__returned=ut}}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,vt);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 u=s(e,d,{options:r,context:o});return this.set(e,u,r),u}get(e,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:o=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,status:r}=i,d=t(this,A).get(e);if(d!==void 0){let u=t(this,p)[d],w=h(this,a,b).call(this,u);return r&&t(this,et).call(this,r,d),t(this,G).call(this,d)?(r&&(r.get="stale"),w?(r&&s&&u.__staleWhileFetching!==void 0&&(r.returnedStale=true),s?u.__staleWhileFetching:void 0):(n||h(this,a,rt).call(this,e,"expire"),r&&s&&(r.returnedStale=true),s?u:void 0)):(r&&(r.get="hit"),w?u.__staleWhileFetching:(h(this,a,xt).call(this,d),o&&t(this,ct).call(this,d),u))}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,P=new WeakMap,K=new WeakMap,lt=new WeakMap,$=new WeakMap,_t=new WeakMap,vt=new WeakMap,Y=new WeakMap,E=new WeakMap,B=new WeakMap,A=new WeakMap,x=new WeakMap,p=new WeakMap,R=new WeakMap,M=new WeakMap,F=new WeakMap,T=new WeakMap,X=new WeakMap,U=new WeakMap,J=new WeakMap,Q=new WeakMap,V=new WeakMap,Z=new WeakMap,ot=new WeakMap,j=new WeakMap,yt=new WeakMap,a=new WeakSet,Pt=function(){let e=new mt(t(this,q)),i=new mt(t(this,q));c(this,V,e),c(this,Q,i),c(this,wt,(n,r,d=t(this,Y).now())=>{if(i[n]=r!==0?d:0,e[n]=r,r!==0&&this.ttlAutopurge){let u=setTimeout(()=>{t(this,G).call(this,n)&&h(this,a,rt).call(this,t(this,x)[n],"expire");},r+1);u.unref&&u.unref();}}),c(this,ct,n=>{i[n]=e[n]!==0?t(this,Y).now():0;}),c(this,et,(n,r)=>{if(e[r]){let d=e[r],u=i[r];if(!d||!u)return;n.ttl=d,n.start=u,n.now=s||o();let w=n.now-u;n.remainingTTL=d-w;}});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 d=e[r],u=i[r];if(!d||!u)return 1/0;let w=(s||o())-u;return d-w},c(this,G,n=>{let r=i[n],d=e[n];return !!d&&!!r&&(s||o())-r>d});},ct=new WeakMap,et=new WeakMap,wt=new WeakMap,G=new WeakMap,ne=function(){let e=new mt(t(this,q));c(this,B,0),c(this,J,e),c(this,ft,i=>{c(this,B,t(this,B)-e[i]),e[i]=0;}),c(this,At,(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}),c(this,St,(i,s,o)=>{if(e[i]=s,t(this,P)){let n=t(this,P)-e[i];for(;t(this,B)>n;)h(this,a,Ot).call(this,true);}c(this,B,t(this,B)+e[i]),o&&(o.entrySize=s,o.totalCalculatedSize=t(this,B));});},ft=new WeakMap,St=new WeakMap,At=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,G).call(this,i))&&(yield i),i===t(this,F)));)i=t(this,M)[i];},nt=function*({allowStale:e=this.allowStale}={}){if(t(this,E))for(let i=t(this,F);!(!h(this,a,Mt).call(this,i)||((e||!t(this,G).call(this,i))&&(yield i),i===t(this,T)));)i=t(this,R)[i];},Mt=function(e){return e!==void 0&&t(this,A).get(t(this,x)[e])===e},Ot=function(e){var n;let i=t(this,F),s=t(this,x)[i],o=t(this,p)[i];return t(this,ot)&&h(this,a,b).call(this,o)?o.__abortController.abort(new Error("evicted")):(t(this,Z)||t(this,j))&&(t(this,Z)&&((n=t(this,K))==null||n.call(this,o,s,"evict")),t(this,j)&&t(this,U)?.push([o,s,"evict"])),t(this,ft).call(this,i),e&&(t(this,x)[i]=void 0,t(this,p)[i]=void 0,t(this,X).push(i)),t(this,E)===1?(c(this,F,c(this,T,0)),t(this,X).length=0):c(this,F,t(this,R)[i]),t(this,A).delete(s),Ut(this,E)._--,i},Ct=function(e,i,s,o){let n=i===void 0?void 0:t(this,p)[i];if(h(this,a,b).call(this,n))return n;let r=new Dt,{signal:d}=s;d?.addEventListener("abort",()=>r.abort(d.reason),{signal:r.signal});let u={signal:r.signal,options:s,context:o},w=(v,y=false)=>{let{aborted:m}=r.signal,z=s.ignoreFetchAbort&&v!==void 0;if(s.status&&(m&&!y?(s.status.fetchAborted=true,s.status.fetchError=r.signal.reason,z&&(s.status.fetchAbortIgnored=true)):s.status.fetchResolved=true),m&&!z&&!y)return f(r.signal.reason);let L=O;return t(this,p)[i]===O&&(v===void 0?L.__staleWhileFetching!==void 0?t(this,p)[i]=L.__staleWhileFetching:h(this,a,rt).call(this,e,"fetch"):(s.status&&(s.status.fetchUpdated=true),this.set(e,v,u.options))),v},k=v=>(s.status&&(s.status.fetchRejected=true,s.status.fetchError=v),f(v)),f=v=>{let{aborted:y}=r.signal,m=y&&s.allowStaleOnFetchAbort,z=m||s.allowStaleOnFetchRejection,L=z||s.noDeleteOnFetchRejection,C=O;if(t(this,p)[i]===O&&(!L||C.__staleWhileFetching===void 0?h(this,a,rt).call(this,e,"fetch"):m||(t(this,p)[i]=C.__staleWhileFetching)),z)return s.status&&C.__staleWhileFetching!==void 0&&(s.status.returnedStale=true),C.__staleWhileFetching;if(C.__returned===C)throw v},W=(v,y)=>{var z;let m=(z=t(this,_t))==null?void 0:z.call(this,e,n,u);m&&m instanceof Promise&&m.then(L=>v(L===void 0?void 0:L),y),r.signal.addEventListener("abort",()=>{(!s.ignoreFetchAbort||s.allowStaleOnFetchAbort)&&(v(void 0),s.allowStaleOnFetchAbort&&(v=L=>w(L,true)));});};s.status&&(s.status.fetchDispatched=true);let O=new Promise(W).then(w,k),g=Object.assign(O,{__abortController:r,__staleWhileFetching:n,__returned:void 0});return i===void 0?(this.set(e,g,{...u.options,status:void 0}),i=t(this,A).get(e)):t(this,p)[i]=g,g},b=function(e){if(!t(this,ot))return false;let i=e;return !!i&&i instanceof Promise&&i.hasOwnProperty("__staleWhileFetching")&&i.__abortController instanceof Dt},Vt=function(e,i){t(this,M)[i]=e,t(this,R)[e]=i;},xt=function(e){e!==t(this,T)&&(e===t(this,F)?c(this,F,t(this,R)[e]):h(this,a,Vt).call(this,t(this,M)[e],t(this,R)[e]),h(this,a,Vt).call(this,t(this,T),e),c(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 d=t(this,p)[r];if(h(this,a,b).call(this,d)?d.__abortController.abort(new Error("deleted")):(t(this,Z)||t(this,j))&&(t(this,Z)&&((o=t(this,K))==null||o.call(this,d,e,i)),t(this,j)&&t(this,U)?.push([d,e,i])),t(this,A).delete(e),t(this,x)[r]=void 0,t(this,p)[r]=void 0,r===t(this,T))c(this,T,t(this,M)[r]);else if(r===t(this,F))c(this,F,t(this,R)[r]);else {let u=t(this,M)[r];t(this,R)[u]=t(this,R)[r];let w=t(this,R)[r];t(this,M)[w]=t(this,M)[r];}Ut(this,E)._--,t(this,X).push(r);}}if(t(this,j)&&t(this,U)?.length){let r=t(this,U),d;for(;d=r?.shift();)(n=t(this,$))==null||n.call(this,...d);}return s},Gt=function(e){var i,s;for(let o of h(this,a,nt).call(this,{allowStale:true})){let n=t(this,p)[o];if(h(this,a,b).call(this,n))n.__abortController.abort(new Error("deleted"));else {let r=t(this,x)[o];t(this,Z)&&((i=t(this,K))==null||i.call(this,n,r,e)),t(this,j)&&t(this,U)?.push([n,r,e]);}}if(t(this,A).clear(),t(this,p).fill(void 0),t(this,x).fill(void 0),t(this,V)&&t(this,Q)&&(t(this,V).fill(0),t(this,Q).fill(0)),t(this,J)&&t(this,J).fill(0),c(this,F,0),c(this,T,0),t(this,X).length=0,c(this,B,0),c(this,E,0),t(this,j)&&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 Et="1.3.23";var Ht="repeat";function kt(l){return {type:"pause",duration:l}}var qt="__game_layer__";var re={};var Kt={};le(Kt,{createExportableElement:()=>oe});var jt;(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)))(jt||(jt={}));function oe(l){try{if(typeof l>"u")return l;let e=JSON.stringify(l);return JSON.parse(e)}catch(e){throw jt.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
@@ -356,7 +356,7 @@ interface ContainerMemory<C extends ContainerChild = ContainerChild> extends Con
356
356
  elements: CanvasBaseItemMemory[];
357
357
  }
358
358
 
359
- var version = "1.3.22";
359
+ var version = "1.3.23";
360
360
 
361
361
  declare const Repeat: RepeatType;
362
362
  /**
package/dist/index.d.ts CHANGED
@@ -356,7 +356,7 @@ interface ContainerMemory<C extends ContainerChild = ContainerChild> extends Con
356
356
  elements: CanvasBaseItemMemory[];
357
357
  }
358
358
 
359
- var version = "1.3.22";
359
+ var version = "1.3.23";
360
360
 
361
361
  declare const Repeat: RepeatType;
362
362
  /**
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import*as I from'@drincs/pixi-vn/canvas';export*from'@drincs/pixi-vn/canvas';import*as Bt 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 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)),_=(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),c=(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 Ut=(l,e,i,s)=>({set _(o){c(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}`);},Dt=globalThis.AbortController,Qt=globalThis.AbortSignal;if(typeof Dt>"u"){Qt=class{constructor(){S(this,"onabort");S(this,"_onabort",[]);S(this,"reason");S(this,"aborted",false);}addEventListener(s,o){this._onabort.push(o);}},Dt=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 [];c(ht,gt,true);let s=new ht(e,i);return c(ht,gt,false),s}push(e){this.heap[this.length++]=e;}pop(){return this.heap[--this.length]}};gt=new WeakMap,_(ht,gt,false);var Nt=ht,Zt,te,q,P,K,lt,$,_t,vt,Y,E,B,A,x,p,R,M,F,T,X,U,J,Q,V,Z,ot,j,yt,a,Pt,ct,et,wt,G,ne,ft,St,At,st,nt,Mt,Ot,Ct,b,Vt,xt,rt,Gt,Wt=class Wt{constructor(e){_(this,a);_(this,q);_(this,P);_(this,K);_(this,lt);_(this,$);_(this,_t);_(this,vt);_(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");_(this,E);_(this,B);_(this,A);_(this,x);_(this,p);_(this,R);_(this,M);_(this,F);_(this,T);_(this,X);_(this,U);_(this,J);_(this,Q);_(this,V);_(this,Z);_(this,ot);_(this,j);_(this,yt);_(this,ct,()=>{});_(this,et,()=>{});_(this,wt,()=>{});_(this,G,()=>false);_(this,ft,e=>{});_(this,St,(e,i,s)=>{});_(this,At,(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:d,allowStale:u,dispose:w,onInsert:k,disposeAfter:f,noDisposeOnSet:W,noUpdateTTL:O,maxSize:g=0,maxEntrySize:v=0,sizeCalculation:y,fetchMethod:m,memoMethod:z,noDeleteOnFetchRejection:L,noDeleteOnStaleGet:C,allowStaleOnFetchRejection:H,allowStaleOnFetchAbort:bt,ignoreFetchAbort:ut,perf:Tt}=e;if(Tt!==void 0&&typeof Tt?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(c(this,Y,Tt??ce),i!==0&&!it(i))throw new TypeError("max option must be a nonnegative integer");let dt=i?se(i):Array;if(!dt)throw new Error("invalid max value: "+i);if(c(this,q,i),c(this,P,g),this.maxEntrySize=v||t(this,P),this.sizeCalculation=y,this.sizeCalculation){if(!t(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(c(this,vt,z),m!==void 0&&typeof m!="function")throw new TypeError("fetchMethod must be a function if specified");if(c(this,_t,m),c(this,ot,!!m),c(this,A,new Map),c(this,x,new Array(i).fill(void 0)),c(this,p,new Array(i).fill(void 0)),c(this,R,new dt(i)),c(this,M,new dt(i)),c(this,F,0),c(this,T,0),c(this,X,Nt.create(i)),c(this,E,0),c(this,B,0),typeof w=="function"&&c(this,K,w),typeof k=="function"&&c(this,lt,k),typeof f=="function"?(c(this,$,f),c(this,U,[])):(c(this,$,void 0),c(this,U,void 0)),c(this,Z,!!t(this,K)),c(this,yt,!!t(this,lt)),c(this,j,!!t(this,$)),this.noDisposeOnSet=!!W,this.noUpdateTTL=!!O,this.noDeleteOnFetchRejection=!!L,this.allowStaleOnFetchRejection=!!H,this.allowStaleOnFetchAbort=!!bt,this.ignoreFetchAbort=!!ut,this.maxEntrySize!==0){if(t(this,P)!==0&&!it(t(this,P)))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=!!u,this.noDeleteOnStaleGet=!!C,this.updateAgeOnGet=!!r,this.updateAgeOnHas=!!d,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,Pt).call(this);}if(t(this,q)===0&&this.ttl===0&&t(this,P)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!t(this,q)&&!t(this,P)){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,V),sizes:t(e,J),keyMap:t(e,A),keyList:t(e,x),valList:t(e,p),next:t(e,R),prev:t(e,M),get head(){return t(e,F)},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,Ct).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,G).call(s,i)}}}get max(){return t(this,q)}get maxSize(){return t(this,P)}get calculatedSize(){return t(this,B)}get size(){return t(this,E)}get fetchMethod(){return t(this,_t)}get memoMethod(){return t(this,vt)}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,p)[e]!==void 0&&t(this,x)[e]!==void 0&&!h(this,a,b).call(this,t(this,p)[e])&&(yield [t(this,x)[e],t(this,p)[e]]);}*rentries(){for(let e of h(this,a,nt).call(this))t(this,p)[e]!==void 0&&t(this,x)[e]!==void 0&&!h(this,a,b).call(this,t(this,p)[e])&&(yield [t(this,x)[e],t(this,p)[e]]);}*keys(){for(let e of h(this,a,st).call(this)){let i=t(this,x)[e];i!==void 0&&!h(this,a,b).call(this,t(this,p)[e])&&(yield i);}}*rkeys(){for(let e of h(this,a,nt).call(this)){let i=t(this,x)[e];i!==void 0&&!h(this,a,b).call(this,t(this,p)[e])&&(yield i);}}*values(){for(let e of h(this,a,st).call(this))t(this,p)[e]!==void 0&&!h(this,a,b).call(this,t(this,p)[e])&&(yield t(this,p)[e]);}*rvalues(){for(let e of h(this,a,nt).call(this))t(this,p)[e]!==void 0&&!h(this,a,b).call(this,t(this,p)[e])&&(yield t(this,p)[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,p)[s],n=h(this,a,b).call(this,o)?o.__staleWhileFetching:o;if(n!==void 0&&e(n,t(this,x)[s],this))return this.get(t(this,x)[s],i)}}forEach(e,i=this){for(let s of h(this,a,st).call(this)){let o=t(this,p)[s],n=h(this,a,b).call(this,o)?o.__staleWhileFetching:o;n!==void 0&&e.call(i,n,t(this,x)[s],this);}}rforEach(e,i=this){for(let s of h(this,a,nt).call(this)){let o=t(this,p)[s],n=h(this,a,b).call(this,o)?o.__staleWhileFetching:o;n!==void 0&&e.call(i,n,t(this,x)[s],this);}}purgeStale(){let e=false;for(let i of h(this,a,nt).call(this,{allowStale:true}))t(this,G).call(this,i)&&(h(this,a,rt).call(this,t(this,x)[i],"expire"),e=true);return e}info(e){let i=t(this,A).get(e);if(i===void 0)return;let s=t(this,p)[i],o=h(this,a,b).call(this,s)?s.__staleWhileFetching:s;if(o===void 0)return;let n={value:o};if(t(this,V)&&t(this,Q)){let r=t(this,V)[i],d=t(this,Q)[i];if(r&&d){let u=r-(t(this,Y).now()-d);n.ttl=u,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,x)[i],o=t(this,p)[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,V)&&t(this,Q)){r.ttl=t(this,V)[i];let d=t(this,Y).now()-t(this,Q)[i];r.start=Math.floor(Date.now()-d);}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 W,O,g,v;if(i===void 0)return this.delete(e),this;let{ttl:o=this.ttl,start:n,noDisposeOnSet:r=this.noDisposeOnSet,sizeCalculation:d=this.sizeCalculation,status:u}=s,{noUpdateTTL:w=this.noUpdateTTL}=s,k=t(this,At).call(this,e,i,s.size||0,d);if(this.maxEntrySize&&k>this.maxEntrySize)return u&&(u.set="miss",u.maxEntrySizeExceeded=true),h(this,a,rt).call(this,e,"set"),this;let f=t(this,E)===0?void 0:t(this,A).get(e);if(f===void 0)f=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,Ot).call(this,false):t(this,E),t(this,x)[f]=e,t(this,p)[f]=i,t(this,A).set(e,f),t(this,R)[t(this,T)]=f,t(this,M)[f]=t(this,T),c(this,T,f),Ut(this,E)._++,t(this,St).call(this,f,k,u),u&&(u.set="add"),w=false,t(this,yt)&&((W=t(this,lt))==null||W.call(this,i,e,"add"));else {h(this,a,xt).call(this,f);let y=t(this,p)[f];if(i!==y){if(t(this,ot)&&h(this,a,b).call(this,y)){y.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:m}=y;m!==void 0&&!r&&(t(this,Z)&&((O=t(this,K))==null||O.call(this,m,e,"set")),t(this,j)&&t(this,U)?.push([m,e,"set"]));}else r||(t(this,Z)&&((g=t(this,K))==null||g.call(this,y,e,"set")),t(this,j)&&t(this,U)?.push([y,e,"set"]));if(t(this,ft).call(this,f),t(this,St).call(this,f,k,u),t(this,p)[f]=i,u){u.set="replace";let m=y&&h(this,a,b).call(this,y)?y.__staleWhileFetching:y;m!==void 0&&(u.oldValue=m);}}else u&&(u.set="update");t(this,yt)&&this.onInsert?.(i,e,i===y?"update":"replace");}if(o!==0&&!t(this,V)&&h(this,a,Pt).call(this),t(this,V)&&(w||t(this,wt).call(this,f,o,n),u&&t(this,et).call(this,u,f)),!r&&t(this,j)&&t(this,U)){let y=t(this,U),m;for(;m=y?.shift();)(v=t(this,$))==null||v.call(this,...m);}return this}pop(){var e;try{for(;t(this,E);){let i=t(this,p)[t(this,F)];if(h(this,a,Ot).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,j)&&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,p)[n];if(h(this,a,b).call(this,r)&&r.__staleWhileFetching===void 0)return false;if(t(this,G).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,G).call(this,o))return;let n=t(this,p)[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:d=this.noDisposeOnSet,size:u=0,sizeCalculation:w=this.sizeCalculation,noUpdateTTL:k=this.noUpdateTTL,noDeleteOnFetchRejection:f=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:W=this.allowStaleOnFetchRejection,ignoreFetchAbort:O=this.ignoreFetchAbort,allowStaleOnFetchAbort:g=this.allowStaleOnFetchAbort,context:v,forceRefresh:y=false,status:m,signal:z}=i;if(!t(this,ot))return m&&(m.fetch="get"),this.get(e,{allowStale:s,updateAgeOnGet:o,noDeleteOnStaleGet:n,status:m});let L={allowStale:s,updateAgeOnGet:o,noDeleteOnStaleGet:n,ttl:r,noDisposeOnSet:d,size:u,sizeCalculation:w,noUpdateTTL:k,noDeleteOnFetchRejection:f,allowStaleOnFetchRejection:W,allowStaleOnFetchAbort:g,ignoreFetchAbort:O,status:m,signal:z},C=t(this,A).get(e);if(C===void 0){m&&(m.fetch="miss");let H=h(this,a,Ct).call(this,e,C,L,v);return H.__returned=H}else {let H=t(this,p)[C];if(h(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 bt=t(this,G).call(this,C);if(!y&&!bt)return m&&(m.fetch="hit"),h(this,a,xt).call(this,C),o&&t(this,ct).call(this,C),m&&t(this,et).call(this,m,C),H;let ut=h(this,a,Ct).call(this,e,C,L,v),dt=ut.__staleWhileFetching!==void 0&&s;return m&&(m.fetch=bt?"stale":"refresh",dt&&bt&&(m.returnedStale=true)),dt?ut.__staleWhileFetching:ut.__returned=ut}}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,vt);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 u=s(e,d,{options:r,context:o});return this.set(e,u,r),u}get(e,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:o=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,status:r}=i,d=t(this,A).get(e);if(d!==void 0){let u=t(this,p)[d],w=h(this,a,b).call(this,u);return r&&t(this,et).call(this,r,d),t(this,G).call(this,d)?(r&&(r.get="stale"),w?(r&&s&&u.__staleWhileFetching!==void 0&&(r.returnedStale=true),s?u.__staleWhileFetching:void 0):(n||h(this,a,rt).call(this,e,"expire"),r&&s&&(r.returnedStale=true),s?u:void 0)):(r&&(r.get="hit"),w?u.__staleWhileFetching:(h(this,a,xt).call(this,d),o&&t(this,ct).call(this,d),u))}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,P=new WeakMap,K=new WeakMap,lt=new WeakMap,$=new WeakMap,_t=new WeakMap,vt=new WeakMap,Y=new WeakMap,E=new WeakMap,B=new WeakMap,A=new WeakMap,x=new WeakMap,p=new WeakMap,R=new WeakMap,M=new WeakMap,F=new WeakMap,T=new WeakMap,X=new WeakMap,U=new WeakMap,J=new WeakMap,Q=new WeakMap,V=new WeakMap,Z=new WeakMap,ot=new WeakMap,j=new WeakMap,yt=new WeakMap,a=new WeakSet,Pt=function(){let e=new mt(t(this,q)),i=new mt(t(this,q));c(this,V,e),c(this,Q,i),c(this,wt,(n,r,d=t(this,Y).now())=>{if(i[n]=r!==0?d:0,e[n]=r,r!==0&&this.ttlAutopurge){let u=setTimeout(()=>{t(this,G).call(this,n)&&h(this,a,rt).call(this,t(this,x)[n],"expire");},r+1);u.unref&&u.unref();}}),c(this,ct,n=>{i[n]=e[n]!==0?t(this,Y).now():0;}),c(this,et,(n,r)=>{if(e[r]){let d=e[r],u=i[r];if(!d||!u)return;n.ttl=d,n.start=u,n.now=s||o();let w=n.now-u;n.remainingTTL=d-w;}});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 d=e[r],u=i[r];if(!d||!u)return 1/0;let w=(s||o())-u;return d-w},c(this,G,n=>{let r=i[n],d=e[n];return !!d&&!!r&&(s||o())-r>d});},ct=new WeakMap,et=new WeakMap,wt=new WeakMap,G=new WeakMap,ne=function(){let e=new mt(t(this,q));c(this,B,0),c(this,J,e),c(this,ft,i=>{c(this,B,t(this,B)-e[i]),e[i]=0;}),c(this,At,(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}),c(this,St,(i,s,o)=>{if(e[i]=s,t(this,P)){let n=t(this,P)-e[i];for(;t(this,B)>n;)h(this,a,Ot).call(this,true);}c(this,B,t(this,B)+e[i]),o&&(o.entrySize=s,o.totalCalculatedSize=t(this,B));});},ft=new WeakMap,St=new WeakMap,At=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,G).call(this,i))&&(yield i),i===t(this,F)));)i=t(this,M)[i];},nt=function*({allowStale:e=this.allowStale}={}){if(t(this,E))for(let i=t(this,F);!(!h(this,a,Mt).call(this,i)||((e||!t(this,G).call(this,i))&&(yield i),i===t(this,T)));)i=t(this,R)[i];},Mt=function(e){return e!==void 0&&t(this,A).get(t(this,x)[e])===e},Ot=function(e){var n;let i=t(this,F),s=t(this,x)[i],o=t(this,p)[i];return t(this,ot)&&h(this,a,b).call(this,o)?o.__abortController.abort(new Error("evicted")):(t(this,Z)||t(this,j))&&(t(this,Z)&&((n=t(this,K))==null||n.call(this,o,s,"evict")),t(this,j)&&t(this,U)?.push([o,s,"evict"])),t(this,ft).call(this,i),e&&(t(this,x)[i]=void 0,t(this,p)[i]=void 0,t(this,X).push(i)),t(this,E)===1?(c(this,F,c(this,T,0)),t(this,X).length=0):c(this,F,t(this,R)[i]),t(this,A).delete(s),Ut(this,E)._--,i},Ct=function(e,i,s,o){let n=i===void 0?void 0:t(this,p)[i];if(h(this,a,b).call(this,n))return n;let r=new Dt,{signal:d}=s;d?.addEventListener("abort",()=>r.abort(d.reason),{signal:r.signal});let u={signal:r.signal,options:s,context:o},w=(v,y=false)=>{let{aborted:m}=r.signal,z=s.ignoreFetchAbort&&v!==void 0;if(s.status&&(m&&!y?(s.status.fetchAborted=true,s.status.fetchError=r.signal.reason,z&&(s.status.fetchAbortIgnored=true)):s.status.fetchResolved=true),m&&!z&&!y)return f(r.signal.reason);let L=O;return t(this,p)[i]===O&&(v===void 0?L.__staleWhileFetching!==void 0?t(this,p)[i]=L.__staleWhileFetching:h(this,a,rt).call(this,e,"fetch"):(s.status&&(s.status.fetchUpdated=true),this.set(e,v,u.options))),v},k=v=>(s.status&&(s.status.fetchRejected=true,s.status.fetchError=v),f(v)),f=v=>{let{aborted:y}=r.signal,m=y&&s.allowStaleOnFetchAbort,z=m||s.allowStaleOnFetchRejection,L=z||s.noDeleteOnFetchRejection,C=O;if(t(this,p)[i]===O&&(!L||C.__staleWhileFetching===void 0?h(this,a,rt).call(this,e,"fetch"):m||(t(this,p)[i]=C.__staleWhileFetching)),z)return s.status&&C.__staleWhileFetching!==void 0&&(s.status.returnedStale=true),C.__staleWhileFetching;if(C.__returned===C)throw v},W=(v,y)=>{var z;let m=(z=t(this,_t))==null?void 0:z.call(this,e,n,u);m&&m instanceof Promise&&m.then(L=>v(L===void 0?void 0:L),y),r.signal.addEventListener("abort",()=>{(!s.ignoreFetchAbort||s.allowStaleOnFetchAbort)&&(v(void 0),s.allowStaleOnFetchAbort&&(v=L=>w(L,true)));});};s.status&&(s.status.fetchDispatched=true);let O=new Promise(W).then(w,k),g=Object.assign(O,{__abortController:r,__staleWhileFetching:n,__returned:void 0});return i===void 0?(this.set(e,g,{...u.options,status:void 0}),i=t(this,A).get(e)):t(this,p)[i]=g,g},b=function(e){if(!t(this,ot))return false;let i=e;return !!i&&i instanceof Promise&&i.hasOwnProperty("__staleWhileFetching")&&i.__abortController instanceof Dt},Vt=function(e,i){t(this,M)[i]=e,t(this,R)[e]=i;},xt=function(e){e!==t(this,T)&&(e===t(this,F)?c(this,F,t(this,R)[e]):h(this,a,Vt).call(this,t(this,M)[e],t(this,R)[e]),h(this,a,Vt).call(this,t(this,T),e),c(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 d=t(this,p)[r];if(h(this,a,b).call(this,d)?d.__abortController.abort(new Error("deleted")):(t(this,Z)||t(this,j))&&(t(this,Z)&&((o=t(this,K))==null||o.call(this,d,e,i)),t(this,j)&&t(this,U)?.push([d,e,i])),t(this,A).delete(e),t(this,x)[r]=void 0,t(this,p)[r]=void 0,r===t(this,T))c(this,T,t(this,M)[r]);else if(r===t(this,F))c(this,F,t(this,R)[r]);else {let u=t(this,M)[r];t(this,R)[u]=t(this,R)[r];let w=t(this,R)[r];t(this,M)[w]=t(this,M)[r];}Ut(this,E)._--,t(this,X).push(r);}}if(t(this,j)&&t(this,U)?.length){let r=t(this,U),d;for(;d=r?.shift();)(n=t(this,$))==null||n.call(this,...d);}return s},Gt=function(e){var i,s;for(let o of h(this,a,nt).call(this,{allowStale:true})){let n=t(this,p)[o];if(h(this,a,b).call(this,n))n.__abortController.abort(new Error("deleted"));else {let r=t(this,x)[o];t(this,Z)&&((i=t(this,K))==null||i.call(this,n,r,e)),t(this,j)&&t(this,U)?.push([n,r,e]);}}if(t(this,A).clear(),t(this,p).fill(void 0),t(this,x).fill(void 0),t(this,V)&&t(this,Q)&&(t(this,V).fill(0),t(this,Q).fill(0)),t(this,J)&&t(this,J).fill(0),c(this,F,0),c(this,T,0),t(this,X).length=0,c(this,B,0),c(this,E,0),t(this,j)&&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 Et="1.3.22";var Ht="repeat";function kt(l){return {type:"pause",duration:l}}var qt="__game_layer__";var re={};var Kt={};le(Kt,{createExportableElement:()=>oe});var jt;(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)))(jt||(jt={}));function oe(l){try{if(typeof l>"u")return l;let e=JSON.stringify(l);return JSON.parse(e)}catch(e){throw jt.error("Error creating exportable element",l,e),new Error("[Pixi\u2019VN] Error creating exportable element")}}function ae(){console.info(`
1
+ import*as I from'@drincs/pixi-vn/canvas';export*from'@drincs/pixi-vn/canvas';import*as Bt 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 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)),_=(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),c=(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 Ut=(l,e,i,s)=>({set _(o){c(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}`);},Dt=globalThis.AbortController,Qt=globalThis.AbortSignal;if(typeof Dt>"u"){Qt=class{constructor(){S(this,"onabort");S(this,"_onabort",[]);S(this,"reason");S(this,"aborted",false);}addEventListener(s,o){this._onabort.push(o);}},Dt=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 [];c(ht,gt,true);let s=new ht(e,i);return c(ht,gt,false),s}push(e){this.heap[this.length++]=e;}pop(){return this.heap[--this.length]}};gt=new WeakMap,_(ht,gt,false);var Nt=ht,Zt,te,q,P,K,lt,$,_t,vt,Y,E,B,A,x,p,R,M,F,T,X,U,J,Q,V,Z,ot,j,yt,a,Pt,ct,et,wt,G,ne,ft,St,At,st,nt,Mt,Ot,Ct,b,Vt,xt,rt,Gt,Wt=class Wt{constructor(e){_(this,a);_(this,q);_(this,P);_(this,K);_(this,lt);_(this,$);_(this,_t);_(this,vt);_(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");_(this,E);_(this,B);_(this,A);_(this,x);_(this,p);_(this,R);_(this,M);_(this,F);_(this,T);_(this,X);_(this,U);_(this,J);_(this,Q);_(this,V);_(this,Z);_(this,ot);_(this,j);_(this,yt);_(this,ct,()=>{});_(this,et,()=>{});_(this,wt,()=>{});_(this,G,()=>false);_(this,ft,e=>{});_(this,St,(e,i,s)=>{});_(this,At,(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:d,allowStale:u,dispose:w,onInsert:k,disposeAfter:f,noDisposeOnSet:W,noUpdateTTL:O,maxSize:g=0,maxEntrySize:v=0,sizeCalculation:y,fetchMethod:m,memoMethod:z,noDeleteOnFetchRejection:L,noDeleteOnStaleGet:C,allowStaleOnFetchRejection:H,allowStaleOnFetchAbort:bt,ignoreFetchAbort:ut,perf:Tt}=e;if(Tt!==void 0&&typeof Tt?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(c(this,Y,Tt??ce),i!==0&&!it(i))throw new TypeError("max option must be a nonnegative integer");let dt=i?se(i):Array;if(!dt)throw new Error("invalid max value: "+i);if(c(this,q,i),c(this,P,g),this.maxEntrySize=v||t(this,P),this.sizeCalculation=y,this.sizeCalculation){if(!t(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(c(this,vt,z),m!==void 0&&typeof m!="function")throw new TypeError("fetchMethod must be a function if specified");if(c(this,_t,m),c(this,ot,!!m),c(this,A,new Map),c(this,x,new Array(i).fill(void 0)),c(this,p,new Array(i).fill(void 0)),c(this,R,new dt(i)),c(this,M,new dt(i)),c(this,F,0),c(this,T,0),c(this,X,Nt.create(i)),c(this,E,0),c(this,B,0),typeof w=="function"&&c(this,K,w),typeof k=="function"&&c(this,lt,k),typeof f=="function"?(c(this,$,f),c(this,U,[])):(c(this,$,void 0),c(this,U,void 0)),c(this,Z,!!t(this,K)),c(this,yt,!!t(this,lt)),c(this,j,!!t(this,$)),this.noDisposeOnSet=!!W,this.noUpdateTTL=!!O,this.noDeleteOnFetchRejection=!!L,this.allowStaleOnFetchRejection=!!H,this.allowStaleOnFetchAbort=!!bt,this.ignoreFetchAbort=!!ut,this.maxEntrySize!==0){if(t(this,P)!==0&&!it(t(this,P)))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=!!u,this.noDeleteOnStaleGet=!!C,this.updateAgeOnGet=!!r,this.updateAgeOnHas=!!d,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,Pt).call(this);}if(t(this,q)===0&&this.ttl===0&&t(this,P)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!t(this,q)&&!t(this,P)){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,V),sizes:t(e,J),keyMap:t(e,A),keyList:t(e,x),valList:t(e,p),next:t(e,R),prev:t(e,M),get head(){return t(e,F)},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,Ct).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,G).call(s,i)}}}get max(){return t(this,q)}get maxSize(){return t(this,P)}get calculatedSize(){return t(this,B)}get size(){return t(this,E)}get fetchMethod(){return t(this,_t)}get memoMethod(){return t(this,vt)}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,p)[e]!==void 0&&t(this,x)[e]!==void 0&&!h(this,a,b).call(this,t(this,p)[e])&&(yield [t(this,x)[e],t(this,p)[e]]);}*rentries(){for(let e of h(this,a,nt).call(this))t(this,p)[e]!==void 0&&t(this,x)[e]!==void 0&&!h(this,a,b).call(this,t(this,p)[e])&&(yield [t(this,x)[e],t(this,p)[e]]);}*keys(){for(let e of h(this,a,st).call(this)){let i=t(this,x)[e];i!==void 0&&!h(this,a,b).call(this,t(this,p)[e])&&(yield i);}}*rkeys(){for(let e of h(this,a,nt).call(this)){let i=t(this,x)[e];i!==void 0&&!h(this,a,b).call(this,t(this,p)[e])&&(yield i);}}*values(){for(let e of h(this,a,st).call(this))t(this,p)[e]!==void 0&&!h(this,a,b).call(this,t(this,p)[e])&&(yield t(this,p)[e]);}*rvalues(){for(let e of h(this,a,nt).call(this))t(this,p)[e]!==void 0&&!h(this,a,b).call(this,t(this,p)[e])&&(yield t(this,p)[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,p)[s],n=h(this,a,b).call(this,o)?o.__staleWhileFetching:o;if(n!==void 0&&e(n,t(this,x)[s],this))return this.get(t(this,x)[s],i)}}forEach(e,i=this){for(let s of h(this,a,st).call(this)){let o=t(this,p)[s],n=h(this,a,b).call(this,o)?o.__staleWhileFetching:o;n!==void 0&&e.call(i,n,t(this,x)[s],this);}}rforEach(e,i=this){for(let s of h(this,a,nt).call(this)){let o=t(this,p)[s],n=h(this,a,b).call(this,o)?o.__staleWhileFetching:o;n!==void 0&&e.call(i,n,t(this,x)[s],this);}}purgeStale(){let e=false;for(let i of h(this,a,nt).call(this,{allowStale:true}))t(this,G).call(this,i)&&(h(this,a,rt).call(this,t(this,x)[i],"expire"),e=true);return e}info(e){let i=t(this,A).get(e);if(i===void 0)return;let s=t(this,p)[i],o=h(this,a,b).call(this,s)?s.__staleWhileFetching:s;if(o===void 0)return;let n={value:o};if(t(this,V)&&t(this,Q)){let r=t(this,V)[i],d=t(this,Q)[i];if(r&&d){let u=r-(t(this,Y).now()-d);n.ttl=u,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,x)[i],o=t(this,p)[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,V)&&t(this,Q)){r.ttl=t(this,V)[i];let d=t(this,Y).now()-t(this,Q)[i];r.start=Math.floor(Date.now()-d);}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 W,O,g,v;if(i===void 0)return this.delete(e),this;let{ttl:o=this.ttl,start:n,noDisposeOnSet:r=this.noDisposeOnSet,sizeCalculation:d=this.sizeCalculation,status:u}=s,{noUpdateTTL:w=this.noUpdateTTL}=s,k=t(this,At).call(this,e,i,s.size||0,d);if(this.maxEntrySize&&k>this.maxEntrySize)return u&&(u.set="miss",u.maxEntrySizeExceeded=true),h(this,a,rt).call(this,e,"set"),this;let f=t(this,E)===0?void 0:t(this,A).get(e);if(f===void 0)f=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,Ot).call(this,false):t(this,E),t(this,x)[f]=e,t(this,p)[f]=i,t(this,A).set(e,f),t(this,R)[t(this,T)]=f,t(this,M)[f]=t(this,T),c(this,T,f),Ut(this,E)._++,t(this,St).call(this,f,k,u),u&&(u.set="add"),w=false,t(this,yt)&&((W=t(this,lt))==null||W.call(this,i,e,"add"));else {h(this,a,xt).call(this,f);let y=t(this,p)[f];if(i!==y){if(t(this,ot)&&h(this,a,b).call(this,y)){y.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:m}=y;m!==void 0&&!r&&(t(this,Z)&&((O=t(this,K))==null||O.call(this,m,e,"set")),t(this,j)&&t(this,U)?.push([m,e,"set"]));}else r||(t(this,Z)&&((g=t(this,K))==null||g.call(this,y,e,"set")),t(this,j)&&t(this,U)?.push([y,e,"set"]));if(t(this,ft).call(this,f),t(this,St).call(this,f,k,u),t(this,p)[f]=i,u){u.set="replace";let m=y&&h(this,a,b).call(this,y)?y.__staleWhileFetching:y;m!==void 0&&(u.oldValue=m);}}else u&&(u.set="update");t(this,yt)&&this.onInsert?.(i,e,i===y?"update":"replace");}if(o!==0&&!t(this,V)&&h(this,a,Pt).call(this),t(this,V)&&(w||t(this,wt).call(this,f,o,n),u&&t(this,et).call(this,u,f)),!r&&t(this,j)&&t(this,U)){let y=t(this,U),m;for(;m=y?.shift();)(v=t(this,$))==null||v.call(this,...m);}return this}pop(){var e;try{for(;t(this,E);){let i=t(this,p)[t(this,F)];if(h(this,a,Ot).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,j)&&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,p)[n];if(h(this,a,b).call(this,r)&&r.__staleWhileFetching===void 0)return false;if(t(this,G).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,G).call(this,o))return;let n=t(this,p)[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:d=this.noDisposeOnSet,size:u=0,sizeCalculation:w=this.sizeCalculation,noUpdateTTL:k=this.noUpdateTTL,noDeleteOnFetchRejection:f=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:W=this.allowStaleOnFetchRejection,ignoreFetchAbort:O=this.ignoreFetchAbort,allowStaleOnFetchAbort:g=this.allowStaleOnFetchAbort,context:v,forceRefresh:y=false,status:m,signal:z}=i;if(!t(this,ot))return m&&(m.fetch="get"),this.get(e,{allowStale:s,updateAgeOnGet:o,noDeleteOnStaleGet:n,status:m});let L={allowStale:s,updateAgeOnGet:o,noDeleteOnStaleGet:n,ttl:r,noDisposeOnSet:d,size:u,sizeCalculation:w,noUpdateTTL:k,noDeleteOnFetchRejection:f,allowStaleOnFetchRejection:W,allowStaleOnFetchAbort:g,ignoreFetchAbort:O,status:m,signal:z},C=t(this,A).get(e);if(C===void 0){m&&(m.fetch="miss");let H=h(this,a,Ct).call(this,e,C,L,v);return H.__returned=H}else {let H=t(this,p)[C];if(h(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 bt=t(this,G).call(this,C);if(!y&&!bt)return m&&(m.fetch="hit"),h(this,a,xt).call(this,C),o&&t(this,ct).call(this,C),m&&t(this,et).call(this,m,C),H;let ut=h(this,a,Ct).call(this,e,C,L,v),dt=ut.__staleWhileFetching!==void 0&&s;return m&&(m.fetch=bt?"stale":"refresh",dt&&bt&&(m.returnedStale=true)),dt?ut.__staleWhileFetching:ut.__returned=ut}}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,vt);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 u=s(e,d,{options:r,context:o});return this.set(e,u,r),u}get(e,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:o=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,status:r}=i,d=t(this,A).get(e);if(d!==void 0){let u=t(this,p)[d],w=h(this,a,b).call(this,u);return r&&t(this,et).call(this,r,d),t(this,G).call(this,d)?(r&&(r.get="stale"),w?(r&&s&&u.__staleWhileFetching!==void 0&&(r.returnedStale=true),s?u.__staleWhileFetching:void 0):(n||h(this,a,rt).call(this,e,"expire"),r&&s&&(r.returnedStale=true),s?u:void 0)):(r&&(r.get="hit"),w?u.__staleWhileFetching:(h(this,a,xt).call(this,d),o&&t(this,ct).call(this,d),u))}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,P=new WeakMap,K=new WeakMap,lt=new WeakMap,$=new WeakMap,_t=new WeakMap,vt=new WeakMap,Y=new WeakMap,E=new WeakMap,B=new WeakMap,A=new WeakMap,x=new WeakMap,p=new WeakMap,R=new WeakMap,M=new WeakMap,F=new WeakMap,T=new WeakMap,X=new WeakMap,U=new WeakMap,J=new WeakMap,Q=new WeakMap,V=new WeakMap,Z=new WeakMap,ot=new WeakMap,j=new WeakMap,yt=new WeakMap,a=new WeakSet,Pt=function(){let e=new mt(t(this,q)),i=new mt(t(this,q));c(this,V,e),c(this,Q,i),c(this,wt,(n,r,d=t(this,Y).now())=>{if(i[n]=r!==0?d:0,e[n]=r,r!==0&&this.ttlAutopurge){let u=setTimeout(()=>{t(this,G).call(this,n)&&h(this,a,rt).call(this,t(this,x)[n],"expire");},r+1);u.unref&&u.unref();}}),c(this,ct,n=>{i[n]=e[n]!==0?t(this,Y).now():0;}),c(this,et,(n,r)=>{if(e[r]){let d=e[r],u=i[r];if(!d||!u)return;n.ttl=d,n.start=u,n.now=s||o();let w=n.now-u;n.remainingTTL=d-w;}});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 d=e[r],u=i[r];if(!d||!u)return 1/0;let w=(s||o())-u;return d-w},c(this,G,n=>{let r=i[n],d=e[n];return !!d&&!!r&&(s||o())-r>d});},ct=new WeakMap,et=new WeakMap,wt=new WeakMap,G=new WeakMap,ne=function(){let e=new mt(t(this,q));c(this,B,0),c(this,J,e),c(this,ft,i=>{c(this,B,t(this,B)-e[i]),e[i]=0;}),c(this,At,(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}),c(this,St,(i,s,o)=>{if(e[i]=s,t(this,P)){let n=t(this,P)-e[i];for(;t(this,B)>n;)h(this,a,Ot).call(this,true);}c(this,B,t(this,B)+e[i]),o&&(o.entrySize=s,o.totalCalculatedSize=t(this,B));});},ft=new WeakMap,St=new WeakMap,At=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,G).call(this,i))&&(yield i),i===t(this,F)));)i=t(this,M)[i];},nt=function*({allowStale:e=this.allowStale}={}){if(t(this,E))for(let i=t(this,F);!(!h(this,a,Mt).call(this,i)||((e||!t(this,G).call(this,i))&&(yield i),i===t(this,T)));)i=t(this,R)[i];},Mt=function(e){return e!==void 0&&t(this,A).get(t(this,x)[e])===e},Ot=function(e){var n;let i=t(this,F),s=t(this,x)[i],o=t(this,p)[i];return t(this,ot)&&h(this,a,b).call(this,o)?o.__abortController.abort(new Error("evicted")):(t(this,Z)||t(this,j))&&(t(this,Z)&&((n=t(this,K))==null||n.call(this,o,s,"evict")),t(this,j)&&t(this,U)?.push([o,s,"evict"])),t(this,ft).call(this,i),e&&(t(this,x)[i]=void 0,t(this,p)[i]=void 0,t(this,X).push(i)),t(this,E)===1?(c(this,F,c(this,T,0)),t(this,X).length=0):c(this,F,t(this,R)[i]),t(this,A).delete(s),Ut(this,E)._--,i},Ct=function(e,i,s,o){let n=i===void 0?void 0:t(this,p)[i];if(h(this,a,b).call(this,n))return n;let r=new Dt,{signal:d}=s;d?.addEventListener("abort",()=>r.abort(d.reason),{signal:r.signal});let u={signal:r.signal,options:s,context:o},w=(v,y=false)=>{let{aborted:m}=r.signal,z=s.ignoreFetchAbort&&v!==void 0;if(s.status&&(m&&!y?(s.status.fetchAborted=true,s.status.fetchError=r.signal.reason,z&&(s.status.fetchAbortIgnored=true)):s.status.fetchResolved=true),m&&!z&&!y)return f(r.signal.reason);let L=O;return t(this,p)[i]===O&&(v===void 0?L.__staleWhileFetching!==void 0?t(this,p)[i]=L.__staleWhileFetching:h(this,a,rt).call(this,e,"fetch"):(s.status&&(s.status.fetchUpdated=true),this.set(e,v,u.options))),v},k=v=>(s.status&&(s.status.fetchRejected=true,s.status.fetchError=v),f(v)),f=v=>{let{aborted:y}=r.signal,m=y&&s.allowStaleOnFetchAbort,z=m||s.allowStaleOnFetchRejection,L=z||s.noDeleteOnFetchRejection,C=O;if(t(this,p)[i]===O&&(!L||C.__staleWhileFetching===void 0?h(this,a,rt).call(this,e,"fetch"):m||(t(this,p)[i]=C.__staleWhileFetching)),z)return s.status&&C.__staleWhileFetching!==void 0&&(s.status.returnedStale=true),C.__staleWhileFetching;if(C.__returned===C)throw v},W=(v,y)=>{var z;let m=(z=t(this,_t))==null?void 0:z.call(this,e,n,u);m&&m instanceof Promise&&m.then(L=>v(L===void 0?void 0:L),y),r.signal.addEventListener("abort",()=>{(!s.ignoreFetchAbort||s.allowStaleOnFetchAbort)&&(v(void 0),s.allowStaleOnFetchAbort&&(v=L=>w(L,true)));});};s.status&&(s.status.fetchDispatched=true);let O=new Promise(W).then(w,k),g=Object.assign(O,{__abortController:r,__staleWhileFetching:n,__returned:void 0});return i===void 0?(this.set(e,g,{...u.options,status:void 0}),i=t(this,A).get(e)):t(this,p)[i]=g,g},b=function(e){if(!t(this,ot))return false;let i=e;return !!i&&i instanceof Promise&&i.hasOwnProperty("__staleWhileFetching")&&i.__abortController instanceof Dt},Vt=function(e,i){t(this,M)[i]=e,t(this,R)[e]=i;},xt=function(e){e!==t(this,T)&&(e===t(this,F)?c(this,F,t(this,R)[e]):h(this,a,Vt).call(this,t(this,M)[e],t(this,R)[e]),h(this,a,Vt).call(this,t(this,T),e),c(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 d=t(this,p)[r];if(h(this,a,b).call(this,d)?d.__abortController.abort(new Error("deleted")):(t(this,Z)||t(this,j))&&(t(this,Z)&&((o=t(this,K))==null||o.call(this,d,e,i)),t(this,j)&&t(this,U)?.push([d,e,i])),t(this,A).delete(e),t(this,x)[r]=void 0,t(this,p)[r]=void 0,r===t(this,T))c(this,T,t(this,M)[r]);else if(r===t(this,F))c(this,F,t(this,R)[r]);else {let u=t(this,M)[r];t(this,R)[u]=t(this,R)[r];let w=t(this,R)[r];t(this,M)[w]=t(this,M)[r];}Ut(this,E)._--,t(this,X).push(r);}}if(t(this,j)&&t(this,U)?.length){let r=t(this,U),d;for(;d=r?.shift();)(n=t(this,$))==null||n.call(this,...d);}return s},Gt=function(e){var i,s;for(let o of h(this,a,nt).call(this,{allowStale:true})){let n=t(this,p)[o];if(h(this,a,b).call(this,n))n.__abortController.abort(new Error("deleted"));else {let r=t(this,x)[o];t(this,Z)&&((i=t(this,K))==null||i.call(this,n,r,e)),t(this,j)&&t(this,U)?.push([n,r,e]);}}if(t(this,A).clear(),t(this,p).fill(void 0),t(this,x).fill(void 0),t(this,V)&&t(this,Q)&&(t(this,V).fill(0),t(this,Q).fill(0)),t(this,J)&&t(this,J).fill(0),c(this,F,0),c(this,T,0),t(this,X).length=0,c(this,B,0),c(this,E,0),t(this,j)&&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 Et="1.3.23";var Ht="repeat";function kt(l){return {type:"pause",duration:l}}var qt="__game_layer__";var re={};var Kt={};le(Kt,{createExportableElement:()=>oe});var jt;(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)))(jt||(jt={}));function oe(l){try{if(typeof l>"u")return l;let e=JSON.stringify(l);return JSON.parse(e)}catch(e){throw jt.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
  | |__) |__ _ __ __ \\_| \\ \\ / / | \\ | |
@@ -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 O={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,ve,k,lt,ye,Ie,Ae,pe,de,ke,Ue,Ye,A,qe,xe,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,ve,()=>{});w(this,k,()=>false);w(this,ye,e=>{});w(this,Ie,(e,t,n)=>{});w(this,Ae,(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,xe).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,Ae).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,xe).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,ve).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,xe).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,xe).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,ve,(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,ve=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,Ae,(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,Ae=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;},xe=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 Oe=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 Me=new Oe({cacheSize:10}),Qe;(i=>{function l(s){let a=Me.get(s);if(!a){L.error(`Label "${s}" not found`);return}return a}i.get=l;function e(s){if(Array.isArray(s)){s.forEach(a=>e(a));return}Me.has(s.id)&&L.info(`Label "${s.id}" already exists, it will be overwritten`),Me.set(s.id,s);}i.add=e;function t(){return Array.from(Me.values())}i.values=t;function n(s){return Me.has(s)}i.has=n;})(Qe||(Qe={}));var se=Qe;var b=class b{constructor(){}static get allOpenedLabels(){return unifier.GameUnifier.getVariable(O.OPENED_LABELS_COUNTER_KEY)||{}}static set allOpenedLabels(e){unifier.GameUnifier.setVariable(O.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(O.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(O.CURRENT_STEP_TIMES_COUNTER_KEY)||{};a[s]||(a[s]={}),a[s][i]=t,unifier.GameUnifier.setVariable(O.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(O.CURRENT_STEP_TIMES_COUNTER_KEY)||{};s[i]||(s[i]={}),s[i][n]={stepCounters:[],stepSha1:""},unifier.GameUnifier.setVariable(O.CURRENT_STEP_TIMES_COUNTER_KEY,s);}static get allChoicesMade(){return unifier.GameUnifier.getVariable(O.ALL_CHOICES_MADE_KEY)||[]}static set allChoicesMade(e){unifier.GameUnifier.setVariable(O.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(O.LAST_STEP_GLUED)===this.stepCounter;unifier.GameUnifier.getVariable(O.LAST_DIALOGUE_ADDED_IN_STEP_MEMORY_KEY)===this.stepCounter&&(s=unifier.GameUnifier.getVariable(O.CURRENT_DIALOGUE_MEMORY_KEY)),unifier.GameUnifier.getVariable(O.LAST_MENU_OPTIONS_ADDED_IN_STEP_MEMORY_KEY)===this.stepCounter&&(a=unifier.GameUnifier.getVariable(O.CURRENT_MENU_OPTIONS_MEMORY_KEY)),unifier.GameUnifier.getVariable(O.LAST_INPUT_ADDED_IN_STEP_MEMORY_KEY)===this.stepCounter&&(u=unifier.GameUnifier.getVariable(O.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.choiceMenuOptions;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.choiceMenuOptions;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.choiceMenuOptions=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(O.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){unifier.GameUnifier.setVariable(O.CURRENT_DIALOGUE_MEMORY_KEY,void 0);return}if((typeof e=="string"||Array.isArray(e))&&(e={text:e}),this.dialogGlue){let t=unifier.GameUnifier.getVariable(O.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(O.LAST_STEP_GLUED,this.stepCounter),this.dialogGlue=false;}try{unifier.GameUnifier.setVariable(O.CURRENT_DIALOGUE_MEMORY_KEY,oe({...e,character:typeof e.character=="string"?e.character:e.character?.id})),unifier.GameUnifier.setVariable(O.LAST_DIALOGUE_ADDED_IN_STEP_MEMORY_KEY,this.stepCounter);}catch(t){throw L.error("DialogueInterface cannot contain functions or classes"),t}}get choiceMenuOptions(){let e=unifier.GameUnifier.getVariable(O.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){if(!e||e.length===0){unifier.GameUnifier.setVariable(O.CURRENT_MENU_OPTIONS_MEMORY_KEY,void 0);return}try{unifier.GameUnifier.setVariable(O.CURRENT_MENU_OPTIONS_MEMORY_KEY,oe(e)),unifier.GameUnifier.setVariable(O.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(O.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY)}set dialogGlue(e){unifier.GameUnifier.setFlag(O.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,e);}get inputValue(){return unifier.GameUnifier.getVariable(O.CURRENT_INPUT_VALUE_MEMORY_KEY)}set inputValue(e){this.removeInputRequest(),unifier.GameUnifier.setVariable(O.CURRENT_INPUT_VALUE_MEMORY_KEY,e),unifier.GameUnifier.setVariable(O.LAST_INPUT_ADDED_IN_STEP_MEMORY_KEY,this.stepCounter);}get isRequiredInput(){return unifier.GameUnifier.getVariable(O.CURRENT_INPUT_INFO_MEMORY_KEY)?.isRequired||false}get inputType(){return unifier.GameUnifier.getVariable(O.CURRENT_INPUT_INFO_MEMORY_KEY)?.type}requestInput(e,t){e.isRequired=true,unifier.GameUnifier.setVariable(O.CURRENT_INPUT_INFO_MEMORY_KEY,e),t!==void 0?unifier.GameUnifier.setVariable(O.CURRENT_INPUT_VALUE_MEMORY_KEY,t):unifier.GameUnifier.removeVariable(O.CURRENT_INPUT_VALUE_MEMORY_KEY);}removeInputRequest(){unifier.GameUnifier.removeVariable(O.CURRENT_INPUT_INFO_MEMORY_KEY),unifier.GameUnifier.removeVariable(O.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 Ot(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 Rt(l,e){return {...e,type:Ze,text:l}}var dt=Tt(pt());var Re=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 we=class extends Re{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 we(l,e,t);return se.add(n),n}var Rr=new Ne;
2
- exports.Close=Ze;exports.Label=we;exports.LabelAbstract=Re;exports.NarrationManagerStatic=p;exports.RegisteredLabels=se;exports.narration=Rr;exports.newChoiceOption=Ot;exports.newCloseChoiceOption=Rt;exports.newLabel=ft;
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,ve,k,lt,ye,Ie,Ae,pe,de,ke,Ue,Ye,A,qe,xe,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,ve,()=>{});w(this,k,()=>false);w(this,ye,e=>{});w(this,Ie,(e,t,n)=>{});w(this,Ae,(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,xe).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,Ae).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,xe).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,ve).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,xe).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,xe).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,ve,(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,ve=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,Ae,(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,Ae=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;},xe=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 Me=new Re({cacheSize:10}),Qe;(i=>{function l(s){let a=Me.get(s);if(!a){L.error(`Label "${s}" not found`);return}return a}i.get=l;function e(s){if(Array.isArray(s)){s.forEach(a=>e(a));return}Me.has(s.id)&&L.info(`Label "${s.id}" already exists, it will be overwritten`),Me.set(s.id,s);}i.add=e;function t(){return Array.from(Me.values())}i.values=t;function n(s){return Me.has(s)}i.has=n;})(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){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 Oe=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 we=class extends Oe{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 we(l,e,t);return se.add(n),n}var Or=new Ne;
2
+ exports.Close=Ze;exports.Label=we;exports.LabelAbstract=Oe;exports.NarrationManagerStatic=p;exports.RegisteredLabels=se;exports.narration=Or;exports.newChoiceOption=Rt;exports.newCloseChoiceOption=Ot;exports.newLabel=ft;
@@ -100,7 +100,7 @@ declare abstract class LabelAbstract<TLabel, TProps extends {} = {}, StepIdType
100
100
  * (props) => {
101
101
  * canvas.clear()
102
102
  * narration.dialogue = { character: liam, text: "Which test do you want to perform?" }
103
- * narration.choiceMenuOptions = [
103
+ * narration.choices = [
104
104
  * newChoiceOption("Events Test", eventsTestLabel),
105
105
  * newChoiceOption("Show Image Test", showImageTest),
106
106
  * ]
@@ -466,7 +466,7 @@ interface NarrationManagerInterface {
466
466
  * The options to be shown in the game
467
467
  * @example
468
468
  * ```typescript
469
- * narration.choiceMenuOptions = [
469
+ * narration.choices = [
470
470
  * newChoiceOption("Events Test", EventsTestLabel, {}),
471
471
  * newChoiceOption("Show Image Test", ShowImageTest, { image: "imageId" }, "call"),
472
472
  * newChoiceOption("Ticker Test", TickerTestLabel, {}),
@@ -475,12 +475,16 @@ interface NarrationManagerInterface {
475
475
  * ]
476
476
  * ```
477
477
  */
478
+ get choices(): StoredIndexedChoiceInterface[] | undefined;
479
+ /**
480
+ * @deprecated use {@link choices} instead.
481
+ */
478
482
  get choiceMenuOptions(): StoredIndexedChoiceInterface[] | undefined;
479
483
  /**
480
484
  * The options to be shown in the game
481
485
  * @example
482
486
  * ```typescript
483
- * narration.choiceMenuOptions = [
487
+ * narration.choices = [
484
488
  * newChoiceOption("Events Test", EventsTestLabel, {}),
485
489
  * newChoiceOption("Show Image Test", ShowImageTest, { image: "imageId" }, "call"),
486
490
  * newChoiceOption("Ticker Test", TickerTestLabel, {}),
@@ -489,6 +493,10 @@ interface NarrationManagerInterface {
489
493
  * ]
490
494
  * ```
491
495
  */
496
+ set choices(data: StoredChoiceInterface[] | undefined);
497
+ /**
498
+ * @deprecated use {@link choices} instead.
499
+ */
492
500
  set choiceMenuOptions(data: StoredChoiceInterface[] | undefined);
493
501
  /**
494
502
  * If true, the next dialogue text will be added to the current dialogue text.
@@ -100,7 +100,7 @@ declare abstract class LabelAbstract<TLabel, TProps extends {} = {}, StepIdType
100
100
  * (props) => {
101
101
  * canvas.clear()
102
102
  * narration.dialogue = { character: liam, text: "Which test do you want to perform?" }
103
- * narration.choiceMenuOptions = [
103
+ * narration.choices = [
104
104
  * newChoiceOption("Events Test", eventsTestLabel),
105
105
  * newChoiceOption("Show Image Test", showImageTest),
106
106
  * ]
@@ -466,7 +466,7 @@ interface NarrationManagerInterface {
466
466
  * The options to be shown in the game
467
467
  * @example
468
468
  * ```typescript
469
- * narration.choiceMenuOptions = [
469
+ * narration.choices = [
470
470
  * newChoiceOption("Events Test", EventsTestLabel, {}),
471
471
  * newChoiceOption("Show Image Test", ShowImageTest, { image: "imageId" }, "call"),
472
472
  * newChoiceOption("Ticker Test", TickerTestLabel, {}),
@@ -475,12 +475,16 @@ interface NarrationManagerInterface {
475
475
  * ]
476
476
  * ```
477
477
  */
478
+ get choices(): StoredIndexedChoiceInterface[] | undefined;
479
+ /**
480
+ * @deprecated use {@link choices} instead.
481
+ */
478
482
  get choiceMenuOptions(): StoredIndexedChoiceInterface[] | undefined;
479
483
  /**
480
484
  * The options to be shown in the game
481
485
  * @example
482
486
  * ```typescript
483
- * narration.choiceMenuOptions = [
487
+ * narration.choices = [
484
488
  * newChoiceOption("Events Test", EventsTestLabel, {}),
485
489
  * newChoiceOption("Show Image Test", ShowImageTest, { image: "imageId" }, "call"),
486
490
  * newChoiceOption("Ticker Test", TickerTestLabel, {}),
@@ -489,6 +493,10 @@ interface NarrationManagerInterface {
489
493
  * ]
490
494
  * ```
491
495
  */
496
+ set choices(data: StoredChoiceInterface[] | undefined);
497
+ /**
498
+ * @deprecated use {@link choices} instead.
499
+ */
492
500
  set choiceMenuOptions(data: StoredChoiceInterface[] | undefined);
493
501
  /**
494
502
  * If true, the next dialogue text will be added to the current dialogue text.
@@ -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 C=new a({cacheSize:10}),R;(o=>{function m(a){let l=C.get(a);if(!l){j.error(`Label "${a}" not found`);return}return l}o.get=m;function e(a){if(Array.isArray(a)){a.forEach(l=>e(l));return}C.has(a.id)&&j.info(`Label "${a.id}" already exists, it will be overwritten`),C.set(a.id,a);}o.add=e;function t(){return Array.from(C.values())}o.values=t;function r(a){return C.has(a)}o.has=r;})(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}`,o=i.currentLabelId,a=i._currentLabel;if(!o||t===null||!a)return j.error("currentLabelId or currentLabelStepIndex is null or currentLabel not found"),null;let l=a.getStepSha(t)||"error",d=GameUnifier.getVariable(a$2.CURRENT_STEP_TIMES_COUNTER_KEY)||{};return d[o]||(d[o]={}),(!d[o][r]||d[o][r].stepSha1!=l)&&(d[o][r]={stepSha1:l}),d[o][r]}static setCurrentStepTimesCounterData(e="",t){let r=i.currentLabelStepIndex,o=r+e,a=i.currentLabelId;if(!a||r===null){j.error("currentLabelId or currentLabelStepIndex is null");return}let l=GameUnifier.getVariable(a$2.CURRENT_STEP_TIMES_COUNTER_KEY)||{};l[a]||(l[a]={}),l[a][o]=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 o=r.stepCounters||r.lastStepIndexs||[];return o.find(l=>l===t)||(o.push(t),delete r.lastStepIndexs,r.stepCounters=o,i.setCurrentStepTimesCounterData(e,r)),o.length}static getRandomNumber(e,t,r={}){let o=r.nestedId||"";if(r.onceOnly||false){let l=i.getCurrentStepTimesCounterData(o);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(o,l),f}return Math.floor(Math.random()*(t-e+1))+e}static resetCurrentStepTimesCounter(e=""){let t=i.currentLabelStepIndex,r=t+e,o=i.currentLabelId;if(!o||t===null){j.error("currentLabelId or currentLabelStepIndex is null");return}let a=GameUnifier.getVariable(a$2.CURRENT_STEP_TIMES_COUNTER_KEY)||{};a[o]||(a[o]={}),a[o][r]={stepCounters:[],stepSha1:""},GameUnifier.setVariable(a$2.CURRENT_STEP_TIMES_COUNTER_KEY,a);}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,o=i.allOpenedLabels[e]?.biggestStep||0,a=i.allOpenedLabels[e]?.openCount||0;(!o||o<t)&&(r[e]={biggestStep:t,openCount:a},i.allOpenedLabels=r);}static addChoicesMade(e,t,r,o){let a=i.allChoicesMade,l=a.findIndex(d=>d.labelId===e&&d.stepIndex===t&&d.choiceIndex===o&&d.stepSha1===r);l<0?a.push({labelId:e,stepIndex:t,choiceIndex:o,stepSha1:r,madeTimes:1}):a[l].madeTimes++,i.allChoicesMade=a;}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,o=i.allOpenedLabels[e]?.biggestStep||0,a=i.allOpenedLabels[e]?.openCount||0;r[e]={biggestStep:o,openCount:a+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:o}=t,a,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&&(a=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:a,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:o}),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 o=n.allOpenedLabels[t]?.biggestStep||0;if(o){let a=L.get(t);if(a)return a.stepCount<=o}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(o=>o.labelId===t?.id&&o.stepIndex===e&&o.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.choiceMenuOptions;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(o){j.error("Error running onStepEnd",o);}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 o=n.currentLabelStepIndex;if(o===null){j.error("currentLabelStepIndex is null");return}let a=n._currentLabel;if(!a){j.error("currentLabel not found");return}if(a.stepCount>o){try{await this.onStepRun(a,o);}catch(c){j.error("Error running onStepStart",c),this.onStepError&&this.onStepError(c,e);return}let l=a.getStepById(o);if(!l){j.error("step not found");return}let d=a.getStepSha(o);d||(j.warn("stepSha not found, setting to ERROR"),d="error");try{n.stepsRunning++;let c=await l(e,{labelId:a.id}),y=this.choiceMenuOptions;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(a.id,o),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:o}=r||{},a;typeof e=="string"?a=e:a=e.id;try{let l=L.get(a);if(!l)throw new Error(`[Pixi\u2019VN] Label ${a} 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:o})}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:o}=r||{},a;typeof e=="string"?a=e:a=e.id;try{let l=L.get(a);if(!l)throw new Error(`[Pixi\u2019VN] Label ${a} 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:o})}async selectChoice(e,t){this.choiceMenuOptions=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,o)=>e(r,o);}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){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(){let e=GameUnifier.getVariable(a$2.CURRENT_MENU_OPTIONS_MEMORY_KEY);if(e){let t=[],r=e.map((a,l)=>({...a,choiceIndex:l})),o=this.alreadyCurrentStepMadeChoices;if(r=r.filter((a,l)=>a.oneTime&&o&&o.includes(l)?false:a.onlyHaveNoChoice?(t.push(a),false):true),r.length>0)return r;if(t.length>0)return [t[0]]}}set choiceMenuOptions(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 o=[],a=L.get(r.label);return a&&(a.onLoadingLabel&&o.push(a.onLoadingLabel(e,a)),n.onLoadingLabel&&o.push(n.onLoadingLabel(e,a))),await Promise.all(o)});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 o=typeof e=="string"?e:e.id;return {...r,label:o,props:t,text:m,type:r?.type||"call"}}var O="close";function U(m,e){return {...e,type:O,text:m}}var M=c(a$1(),1);var I=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 g=class extends I{constructor(t,r,o){super(t,o);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,M.default)(r.toString().toLocaleLowerCase()).toString()}catch(r){return j.warn("stepSha not found, setting to ERROR",r),"error"}}};function x(m,e,t){let r=new g(m,e,t);return L.add(r),r}var Se=new E;
2
- export{O as Close,g as Label,I as LabelAbstract,n as NarrationManagerStatic,L as RegisteredLabels,Se as narration,D as newChoiceOption,U as newCloseChoiceOption,x as newLabel};
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 C=new a({cacheSize:10}),R;(o=>{function m(a){let l=C.get(a);if(!l){j.error(`Label "${a}" not found`);return}return l}o.get=m;function e(a){if(Array.isArray(a)){a.forEach(l=>e(l));return}C.has(a.id)&&j.info(`Label "${a.id}" already exists, it will be overwritten`),C.set(a.id,a);}o.add=e;function t(){return Array.from(C.values())}o.values=t;function r(a){return C.has(a)}o.has=r;})(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}`,o=i.currentLabelId,a=i._currentLabel;if(!o||t===null||!a)return j.error("currentLabelId or currentLabelStepIndex is null or currentLabel not found"),null;let l=a.getStepSha(t)||"error",d=GameUnifier.getVariable(a$2.CURRENT_STEP_TIMES_COUNTER_KEY)||{};return d[o]||(d[o]={}),(!d[o][r]||d[o][r].stepSha1!=l)&&(d[o][r]={stepSha1:l}),d[o][r]}static setCurrentStepTimesCounterData(e="",t){let r=i.currentLabelStepIndex,o=r+e,a=i.currentLabelId;if(!a||r===null){j.error("currentLabelId or currentLabelStepIndex is null");return}let l=GameUnifier.getVariable(a$2.CURRENT_STEP_TIMES_COUNTER_KEY)||{};l[a]||(l[a]={}),l[a][o]=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 o=r.stepCounters||r.lastStepIndexs||[];return o.find(l=>l===t)||(o.push(t),delete r.lastStepIndexs,r.stepCounters=o,i.setCurrentStepTimesCounterData(e,r)),o.length}static getRandomNumber(e,t,r={}){let o=r.nestedId||"";if(r.onceOnly||false){let l=i.getCurrentStepTimesCounterData(o);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(o,l),f}return Math.floor(Math.random()*(t-e+1))+e}static resetCurrentStepTimesCounter(e=""){let t=i.currentLabelStepIndex,r=t+e,o=i.currentLabelId;if(!o||t===null){j.error("currentLabelId or currentLabelStepIndex is null");return}let a=GameUnifier.getVariable(a$2.CURRENT_STEP_TIMES_COUNTER_KEY)||{};a[o]||(a[o]={}),a[o][r]={stepCounters:[],stepSha1:""},GameUnifier.setVariable(a$2.CURRENT_STEP_TIMES_COUNTER_KEY,a);}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,o=i.allOpenedLabels[e]?.biggestStep||0,a=i.allOpenedLabels[e]?.openCount||0;(!o||o<t)&&(r[e]={biggestStep:t,openCount:a},i.allOpenedLabels=r);}static addChoicesMade(e,t,r,o){let a=i.allChoicesMade,l=a.findIndex(d=>d.labelId===e&&d.stepIndex===t&&d.choiceIndex===o&&d.stepSha1===r);l<0?a.push({labelId:e,stepIndex:t,choiceIndex:o,stepSha1:r,madeTimes:1}):a[l].madeTimes++,i.allChoicesMade=a;}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,o=i.allOpenedLabels[e]?.biggestStep||0,a=i.allOpenedLabels[e]?.openCount||0;r[e]={biggestStep:o,openCount:a+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:o}=t,a,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&&(a=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:a,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:o}),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 o=n.allOpenedLabels[t]?.biggestStep||0;if(o){let a=L.get(t);if(a)return a.stepCount<=o}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(o=>o.labelId===t?.id&&o.stepIndex===e&&o.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(o){j.error("Error running onStepEnd",o);}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 o=n.currentLabelStepIndex;if(o===null){j.error("currentLabelStepIndex is null");return}let a=n._currentLabel;if(!a){j.error("currentLabel not found");return}if(a.stepCount>o){try{await this.onStepRun(a,o);}catch(c){j.error("Error running onStepStart",c),this.onStepError&&this.onStepError(c,e);return}let l=a.getStepById(o);if(!l){j.error("step not found");return}let d=a.getStepSha(o);d||(j.warn("stepSha not found, setting to ERROR"),d="error");try{n.stepsRunning++;let c=await l(e,{labelId:a.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(a.id,o),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:o}=r||{},a;typeof e=="string"?a=e:a=e.id;try{let l=L.get(a);if(!l)throw new Error(`[Pixi\u2019VN] Label ${a} 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:o})}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:o}=r||{},a;typeof e=="string"?a=e:a=e.id;try{let l=L.get(a);if(!l)throw new Error(`[Pixi\u2019VN] Label ${a} 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:o})}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,o)=>e(r,o);}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){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((a,l)=>({...a,choiceIndex:l})),o=this.alreadyCurrentStepMadeChoices;if(r=r.filter((a,l)=>a.oneTime&&o&&o.includes(l)?false:a.onlyHaveNoChoice?(t.push(a),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 o=[],a=L.get(r.label);return a&&(a.onLoadingLabel&&o.push(a.onLoadingLabel(e,a)),n.onLoadingLabel&&o.push(n.onLoadingLabel(e,a))),await Promise.all(o)});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 o=typeof e=="string"?e:e.id;return {...r,label:o,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 I=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 g=class extends I{constructor(t,r,o){super(t,o);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 g(m,e,t);return L.add(r),r}var Se=new E;
2
+ export{_ as Close,g as Label,I as LabelAbstract,n as NarrationManagerStatic,L as RegisteredLabels,Se as narration,D as newChoiceOption,U as newCloseChoiceOption,M as newLabel};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drincs/pixi-vn",
3
- "version": "1.3.22",
3
+ "version": "1.3.23",
4
4
  "type": "module",
5
5
  "description": "Pixi'VN is a npm package that provides various features for creating visual novels.",
6
6
  "main": "./dist/index.cjs",