@drincs/pixi-vn 1.3.21 → 1.3.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/canvas.cjs +1 -1
- package/dist/canvas.mjs +1 -1
- package/dist/characters.cjs +1 -1
- package/dist/characters.mjs +1 -1
- package/dist/chunk-RXNJBYVP.mjs +1 -0
- package/dist/{chunk-ROWTJPTX.mjs → chunk-VWR64CHT.mjs} +1 -1
- package/dist/history.cjs +1 -1
- package/dist/history.d.cts +6 -2
- package/dist/history.d.ts +6 -2
- package/dist/history.mjs +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +2 -2
- package/dist/narration.cjs +2 -2
- package/dist/narration.d.cts +28 -11
- package/dist/narration.d.ts +28 -11
- package/dist/narration.mjs +2 -2
- package/dist/pixi.js.cjs +143 -126
- package/dist/pixi.js.mjs +160 -143
- package/dist/storage.cjs +1 -1
- package/dist/storage.mjs +1 -1
- package/dist/unifier.d.cts +4 -4
- package/dist/unifier.d.ts +4 -4
- package/package.json +6 -6
- package/dist/chunk-JYY377ML.mjs +0 -1
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 Z 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 ot 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),f=(l,e,i,s)=>(zt(l,e,"write to private field"),e.set(l,i),i),h=(l,e,i)=>(zt(l,e,"access private method"),i);var Ut=(l,e,i,s)=>({set _(o){f(l,e,o);},get _(){return t(l,e,s)}});var dt=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}`);},Ct=globalThis.AbortController,Qt=globalThis.AbortSignal;if(typeof Ct>"u"){Qt=class{constructor(){S(this,"onabort");S(this,"_onabort",[]);S(this,"reason");S(this,"aborted",false);}addEventListener(s,o){this._onabort.push(o);}},Ct=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 ce=l=>!ee.has(l),et=l=>l&&l===Math.floor(l)&&l>0&&isFinite(l),se=l=>et(l)?l<=Math.pow(2,8)?Uint8Array:l<=Math.pow(2,16)?Uint16Array:l<=Math.pow(2,32)?Uint32Array:l<=Number.MAX_SAFE_INTEGER?pt:null:null,pt=class extends Array{constructor(e){super(e),this.fill(0);}},mt,at=class at{constructor(e,i){S(this,"heap");S(this,"length");if(!t(at,mt))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new i(e),this.length=0;}static create(e){let i=se(e);if(!i)return [];f(at,mt,true);let s=new at(e,i);return f(at,mt,false),s}push(e){this.heap[this.length++]=e;}pop(){return this.heap[--this.length]}};mt=new WeakMap,_(at,mt,false);var Nt=at,Zt,te,q,P,K,ht,$,gt,_t,E,Y,A,x,p,R,M,F,U,B,T,X,J,V,Q,rt,j,vt,a,Pt,lt,tt,xt,G,ne,ct,yt,wt,it,st,Mt,Tt,Ot,b,Vt,bt,nt,Gt,Wt=class Wt{constructor(e){_(this,a);_(this,q);_(this,P);_(this,K);_(this,ht);_(this,$);_(this,gt);_(this,_t);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,Y);_(this,A);_(this,x);_(this,p);_(this,R);_(this,M);_(this,F);_(this,U);_(this,B);_(this,T);_(this,X);_(this,J);_(this,V);_(this,Q);_(this,rt);_(this,j);_(this,vt);_(this,lt,()=>{});_(this,tt,()=>{});_(this,xt,()=>{});_(this,G,()=>false);_(this,ct,e=>{});_(this,yt,(e,i,s)=>{});_(this,wt,(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:c,noDisposeOnSet:W,noUpdateTTL:O,maxSize:g=0,maxEntrySize:v=0,sizeCalculation:y,fetchMethod:m,memoMethod:z,noDeleteOnFetchRejection:L,noDeleteOnStaleGet:C,allowStaleOnFetchRejection:H,allowStaleOnFetchAbort:St,ignoreFetchAbort:ft}=e;if(i!==0&&!et(i))throw new TypeError("max option must be a nonnegative integer");let Et=i?se(i):Array;if(!Et)throw new Error("invalid max value: "+i);if(f(this,q,i),f(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(f(this,_t,z),m!==void 0&&typeof m!="function")throw new TypeError("fetchMethod must be a function if specified");if(f(this,gt,m),f(this,rt,!!m),f(this,A,new Map),f(this,x,new Array(i).fill(void 0)),f(this,p,new Array(i).fill(void 0)),f(this,R,new Et(i)),f(this,M,new Et(i)),f(this,F,0),f(this,U,0),f(this,B,Nt.create(i)),f(this,E,0),f(this,Y,0),typeof w=="function"&&f(this,K,w),typeof k=="function"&&f(this,ht,k),typeof c=="function"?(f(this,$,c),f(this,T,[])):(f(this,$,void 0),f(this,T,void 0)),f(this,Q,!!t(this,K)),f(this,vt,!!t(this,ht)),f(this,j,!!t(this,$)),this.noDisposeOnSet=!!W,this.noUpdateTTL=!!O,this.noDeleteOnFetchRejection=!!L,this.allowStaleOnFetchRejection=!!H,this.allowStaleOnFetchAbort=!!St,this.ignoreFetchAbort=!!ft,this.maxEntrySize!==0){if(t(this,P)!==0&&!et(t(this,P)))throw new TypeError("maxSize must be a positive integer if specified");if(!et(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");h(this,a,ne).call(this);}if(this.allowStale=!!u,this.noDeleteOnStaleGet=!!C,this.updateAgeOnGet=!!r,this.updateAgeOnHas=!!d,this.ttlResolution=et(o)||o===0?o:1,this.ttlAutopurge=!!n,this.ttl=s||0,this.ttl){if(!et(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 ut="LRU_CACHE_UNBOUNDED";ce(ut)&&(ee.add(ut),ie("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",ut,Wt));}}static unsafeExposeInternals(e){return {starts:t(e,J),ttls:t(e,V),sizes:t(e,X),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,U)},free:t(e,B),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,Ot).call(r,i,s,o,n)},moveToTail:i=>{var s;return h(s=e,a,bt).call(s,i)},indexes:i=>{var s;return h(s=e,a,it).call(s,i)},rindexes:i=>{var s;return h(s=e,a,st).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,Y)}get size(){return t(this,E)}get fetchMethod(){return t(this,gt)}get memoMethod(){return t(this,_t)}get dispose(){return t(this,K)}get onInsert(){return t(this,ht)}get disposeAfter(){return t(this,$)}getRemainingTTL(e){return t(this,A).has(e)?1/0:0}*entries(){for(let e of h(this,a,it).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,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]]);}*keys(){for(let e of h(this,a,it).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,st).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,it).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,st).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,it).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,it).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,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);}}purgeStale(){let e=false;for(let i of h(this,a,st).call(this,{allowStale:true}))t(this,G).call(this,i)&&(h(this,a,nt).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,J)){let r=t(this,V)[i],d=t(this,J)[i];if(r&&d){let u=r-(dt.now()-d);n.ttl=u,n.start=Date.now();}}return t(this,X)&&(n.size=t(this,X)[i]),n}dump(){let e=[];for(let i of h(this,a,it).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,J)){r.ttl=t(this,V)[i];let d=dt.now()-t(this,J)[i];r.start=Math.floor(Date.now()-d);}t(this,X)&&(r.size=t(this,X)[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=dt.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,wt).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,nt).call(this,e,"set"),this;let c=t(this,E)===0?void 0:t(this,A).get(e);if(c===void 0)c=t(this,E)===0?t(this,U):t(this,B).length!==0?t(this,B).pop():t(this,E)===t(this,q)?h(this,a,Tt).call(this,false):t(this,E),t(this,x)[c]=e,t(this,p)[c]=i,t(this,A).set(e,c),t(this,R)[t(this,U)]=c,t(this,M)[c]=t(this,U),f(this,U,c),Ut(this,E)._++,t(this,yt).call(this,c,k,u),u&&(u.set="add"),w=false,t(this,vt)&&((W=t(this,ht))==null||W.call(this,i,e,"add"));else {h(this,a,bt).call(this,c);let y=t(this,p)[c];if(i!==y){if(t(this,rt)&&h(this,a,b).call(this,y)){y.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:m}=y;m!==void 0&&!r&&(t(this,Q)&&((O=t(this,K))==null||O.call(this,m,e,"set")),t(this,j)&&t(this,T)?.push([m,e,"set"]));}else r||(t(this,Q)&&((g=t(this,K))==null||g.call(this,y,e,"set")),t(this,j)&&t(this,T)?.push([y,e,"set"]));if(t(this,ct).call(this,c),t(this,yt).call(this,c,k,u),t(this,p)[c]=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,vt)&&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,xt).call(this,c,o,n),u&&t(this,tt).call(this,u,c)),!r&&t(this,j)&&t(this,T)){let y=t(this,T),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,Tt).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,T)){let i=t(this,T),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,tt).call(this,o,n));else return s&&t(this,lt).call(this,n),o&&(o.has="hit",t(this,tt).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:c=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,rt))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:c,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,Ot).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 It=s&&H.__staleWhileFetching!==void 0;return m&&(m.fetch="inflight",It&&(m.returnedStale=true)),It?H.__staleWhileFetching:H.__returned=H}let St=t(this,G).call(this,C);if(!y&&!St)return m&&(m.fetch="hit"),h(this,a,bt).call(this,C),o&&t(this,lt).call(this,C),m&&t(this,tt).call(this,m,C),H;let ft=h(this,a,Ot).call(this,e,C,L,v),ut=ft.__staleWhileFetching!==void 0&&s;return m&&(m.fetch=St?"stale":"refresh",ut&&St&&(m.returnedStale=true)),ut?ft.__staleWhileFetching:ft.__returned=ft}}async forceFetch(e,i={}){let s=await this.fetch(e,i);if(s===void 0)throw new Error("fetch() returned undefined");return s}memo(e,i={}){let s=t(this,_t);if(!s)throw new Error("no memoMethod provided to constructor");let{context:o,forceRefresh:n,...r}=i,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,tt).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,nt).call(this,e,"expire"),r&&s&&(r.returnedStale=true),s?u:void 0)):(r&&(r.get="hit"),w?u.__staleWhileFetching:(h(this,a,bt).call(this,d),o&&t(this,lt).call(this,d),u))}else r&&(r.get="miss");}delete(e){return h(this,a,nt).call(this,e,"delete")}clear(){return h(this,a,Gt).call(this,"delete")}};q=new WeakMap,P=new WeakMap,K=new WeakMap,ht=new WeakMap,$=new WeakMap,gt=new WeakMap,_t=new WeakMap,E=new WeakMap,Y=new WeakMap,A=new WeakMap,x=new WeakMap,p=new WeakMap,R=new WeakMap,M=new WeakMap,F=new WeakMap,U=new WeakMap,B=new WeakMap,T=new WeakMap,X=new WeakMap,J=new WeakMap,V=new WeakMap,Q=new WeakMap,rt=new WeakMap,j=new WeakMap,vt=new WeakMap,a=new WeakSet,Pt=function(){let e=new pt(t(this,q)),i=new pt(t(this,q));f(this,V,e),f(this,J,i),f(this,xt,(n,r,d=dt.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,nt).call(this,t(this,x)[n],"expire");},r+1);u.unref&&u.unref();}}),f(this,lt,n=>{i[n]=e[n]!==0?dt.now():0;}),f(this,tt,(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=dt.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},f(this,G,n=>{let r=i[n],d=e[n];return !!d&&!!r&&(s||o())-r>d});},lt=new WeakMap,tt=new WeakMap,xt=new WeakMap,G=new WeakMap,ne=function(){let e=new pt(t(this,q));f(this,Y,0),f(this,X,e),f(this,ct,i=>{f(this,Y,t(this,Y)-e[i]),e[i]=0;}),f(this,wt,(i,s,o,n)=>{if(h(this,a,b).call(this,s))return 0;if(!et(o))if(n){if(typeof n!="function")throw new TypeError("sizeCalculation must be a function");if(o=n(s,i),!et(o))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return o}),f(this,yt,(i,s,o)=>{if(e[i]=s,t(this,P)){let n=t(this,P)-e[i];for(;t(this,Y)>n;)h(this,a,Tt).call(this,true);}f(this,Y,t(this,Y)+e[i]),o&&(o.entrySize=s,o.totalCalculatedSize=t(this,Y));});},ct=new WeakMap,yt=new WeakMap,wt=new WeakMap,it=function*({allowStale:e=this.allowStale}={}){if(t(this,E))for(let i=t(this,U);!(!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];},st=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,U)));)i=t(this,R)[i];},Mt=function(e){return e!==void 0&&t(this,A).get(t(this,x)[e])===e},Tt=function(e){var n;let i=t(this,F),s=t(this,x)[i],o=t(this,p)[i];return t(this,rt)&&h(this,a,b).call(this,o)?o.__abortController.abort(new Error("evicted")):(t(this,Q)||t(this,j))&&(t(this,Q)&&((n=t(this,K))==null||n.call(this,o,s,"evict")),t(this,j)&&t(this,T)?.push([o,s,"evict"])),t(this,ct).call(this,i),e&&(t(this,x)[i]=void 0,t(this,p)[i]=void 0,t(this,B).push(i)),t(this,E)===1?(f(this,F,f(this,U,0)),t(this,B).length=0):f(this,F,t(this,R)[i]),t(this,A).delete(s),Ut(this,E)._--,i},Ot=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 Ct,{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 c(r.signal.reason);let L=O;return t(this,p)[i]===O&&(v===void 0?L.__staleWhileFetching?t(this,p)[i]=L.__staleWhileFetching:h(this,a,nt).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),c(v)),c=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,nt).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,gt))==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,rt))return false;let i=e;return !!i&&i instanceof Promise&&i.hasOwnProperty("__staleWhileFetching")&&i.__abortController instanceof Ct},Vt=function(e,i){t(this,M)[i]=e,t(this,R)[e]=i;},bt=function(e){e!==t(this,U)&&(e===t(this,F)?f(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,U),e),f(this,U,e));},nt=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,ct).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,Q)||t(this,j))&&(t(this,Q)&&((o=t(this,K))==null||o.call(this,d,e,i)),t(this,j)&&t(this,T)?.push([d,e,i])),t(this,A).delete(e),t(this,x)[r]=void 0,t(this,p)[r]=void 0,r===t(this,U))f(this,U,t(this,M)[r]);else if(r===t(this,F))f(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,B).push(r);}}if(t(this,j)&&t(this,T)?.length){let r=t(this,T),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,st).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,Q)&&((i=t(this,K))==null||i.call(this,n,r,e)),t(this,j)&&t(this,T)?.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,J)&&(t(this,V).fill(0),t(this,J).fill(0)),t(this,X)&&t(this,X).fill(0),f(this,F,0),f(this,U,0),t(this,B).length=0,f(this,Y,0),f(this,E,0),t(this,j)&&t(this,T)){let o=t(this,T),n;for(;n=o?.shift();)(s=t(this,$))==null||s.call(this,...n);}};var Dt=Wt;var Ft=class{constructor(e){S(this,"cache");S(this,"map",new Map);this.cache=new Dt({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 At="1.3.21";var Ht="repeat";function kt(l){return {type:"pause",duration:l}}var qt="__game_layer__";var re={};var Kt={};le(Kt,{createExportableElement:()=>oe});var Rt;(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)))(Rt||(Rt={}));function oe(l){try{if(typeof l>"u")return l;let e=JSON.stringify(l);return JSON.parse(e)}catch(e){throw Rt.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.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(`
|
|
2
2
|
_______ _ _ _ ____ ____ ____ _____
|
|
3
3
|
|_ __ \\ (_) (_) | | |_ _| |_ _||_ \\|_ _|
|
|
4
4
|
| |__) |__ _ __ __ \\_| \\ \\ / / | \\ | |
|
|
@@ -6,4 +6,4 @@ import*as I from'@drincs/pixi-vn/canvas';export*from'@drincs/pixi-vn/canvas';imp
|
|
|
6
6
|
_| |_ | | > ' < | | \\ ' / _| |_\\ |_
|
|
7
7
|
|_____| [___][__]\`\\_][___] \\_/ |_____|\\____|
|
|
8
8
|
|
|
9
|
-
`);}function $t(){let l=window.location.pathname+window.location.hash;return l.includes("#")&&(l=l.split("#")[1]),l}var Yt;(k=>{async function l(
|
|
9
|
+
`);}function $t(){let l=window.location.pathname+window.location.hash;return l.includes("#")&&(l=l.split("#")[1]),l}var Yt;(k=>{async function l(f,W,O){return GameUnifier.init({getCurrentGameStepState:()=>({path:$t(),storage:N.storage.export(),canvas:I.canvas.export(),sound:at.sound.export(),labelIndex:D.NarrationManagerStatic.currentLabelStepIndex||0,openedLabels:D.narration.openedLabels}),restoreGameStepState:async(g,v)=>{tt.HistoryManagerStatic._originalStepData=g,D.NarrationManagerStatic.openedLabels=g.openedLabels,N.storage.restore(g.storage),await I.canvas.restore(g.canvas),at.sound.restore(g.sound),v(g.path);},getStepCounter:()=>D.narration.stepCounter,setStepCounter:g=>{D.NarrationManagerStatic._stepCounter=g;},getOpenedLabels:()=>D.narration.openedLabels.length,addHistoryItem:(g,v)=>tt.stepHistory.add(g,v),getCurrentStepsRunningNumber:()=>D.NarrationManagerStatic.stepsRunning,getCharacter:g=>Bt.RegisteredCharacters.get(g),onGoNextEnd:async()=>{let g=I.CanvasManagerStatic._tickersToCompleteOnStepEnd.tikersIds.map(({id:y})=>I.canvas.forceCompletionOfTicker(y)),v=I.CanvasManagerStatic._tickersToCompleteOnStepEnd.stepAlias.map(({alias:y,id:m})=>I.canvas.forceCompletionOfTicker(m,y));await Promise.all([...g,...v]),I.CanvasManagerStatic._tickersToCompleteOnStepEnd={tikersIds:[],stepAlias:[]};},getVariable:g=>N.storage.get(g),setVariable:(g,v)=>N.storage.set(g,v),removeVariable:g=>N.storage.removeVariable(g),getFlag:g=>N.storage.getFlag(g),setFlag:(g,v)=>N.storage.setFlag(g,v),onLabelClosing:g=>N.StorageManagerStatic.clearOldTempVariables(g)}),ae(),await I.canvas.init(f,W,O)}k.init=l;function e(){N.storage.clear(),I.canvas.clear(),at.sound.clear(),D.narration.clear(),tt.stepHistory.clear();}k.clear=e;function i(){return {pixivn_version:Et,stepData:D.narration.export(),storageData:N.storage.export(),canvasData:I.canvas.export(),soundData:at.sound.export(),historyData:tt.stepHistory.export(),path:$t()}}k.exportGameState=i;async function s(f,W){f.stepData.hasOwnProperty("stepsHistory")&&f.stepData.stepsHistory&&(f.historyData.stepsHistory=f.stepData.stepsHistory),f.stepData.hasOwnProperty("originalStepData")&&f.stepData.originalStepData&&(f.historyData.originalStepData=f.stepData.originalStepData),tt.stepHistory.restore(f.historyData);let O=tt.stepHistory.lastKey;if(typeof O=="number"){let g=tt.stepHistory.stepsInfoMap.get(O)||null;await D.narration.restore(f.stepData,g);}N.storage.restore(f.storageData),await I.canvas.restore(f.canvasData),at.sound.restore(f.soundData),await W(f.path);}k.restoreGameState=s;function o(f){return JSON.parse(f)}k.jsonToGameState=o;function n(f){GameUnifier.onEnd=f;}k.onEnd=n;function r(f){GameUnifier.onError=f;}k.onError=r;function d(f){D.NarrationManagerStatic.onStepStart=f;}k.onStepStart=d;function u(f){D.NarrationManagerStatic.onLoadingLabel=f;}k.onLoadingLabel=u;function w(f){D.NarrationManagerStatic.onStepEnd=f;}k.onStepEnd=w;})(Yt||(Yt={}));var We={Assets:Assets,Rectangle:Rectangle,characterUtils:Bt,canvasUtils:I,narrationUtils:D,soundUtils:at,CANVAS_APP_GAME_LAYER_ALIAS:qt,Pause:kt,Repeat:Ht,PIXIVN_VERSION:Et,...Kt,...re,canvas:I.canvas,narration:D.narration,sound:at.sound,storage:N.storage,history:tt.stepHistory,Game:Yt,GameUnifier:GameUnifier};export{qt as CANVAS_APP_GAME_LAYER_ALIAS,Rt as CachedMap,Yt as Game,Et as PIXIVN_VERSION,kt as Pause,Ht as Repeat,oe as createExportableElement,We as default};
|
package/dist/narration.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';var unifier=require('@drincs/pixi-vn/unifier');var bt=Object.create;var He=Object.defineProperty;var mt=Object.getOwnPropertyDescriptor;var St=Object.getOwnPropertyNames;var gt=Object.getPrototypeOf,_t=Object.prototype.hasOwnProperty;var et=l=>{throw TypeError(l)};var yt=(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,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of St(e))!_t.call(l,i)&&i!==t&&He(l,i,{get:()=>e[i],enumerable:!(r=mt(e,i))||r.enumerable});return l};var Tt=(l,e,t)=>(t=l!=null?bt(gt(l)):{},Lt(He(t,"default",{value:l,enumerable:true}),l));var _=(l,e,t)=>yt(l,typeof e!="symbol"?e+"":e,t),We=(l,e,t)=>e.has(l)||et("Cannot "+t);var n=(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,r)=>(We(l,e,"write to private field"),e.set(l,t),t),f=(l,e,t)=>(We(l,e,"access private method"),t);var Pe=(l,e,t,r)=>({set _(i){m(l,e,i);},get _(){return n(l,e,r)}});var ut=tt((Ve,ht)=>{(function(l,e){typeof Ve=="object"?ht.exports=Ve=e():typeof define=="function"&&define.amd?define([],e):l.CryptoJS=e();})(Ve,function(){var l=l||(function(e,t){var r;if(typeof window<"u"&&window.crypto&&(r=window.crypto),typeof self<"u"&&self.crypto&&(r=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(r=globalThis.crypto),!r&&typeof window<"u"&&window.msCrypto&&(r=window.msCrypto),!r&&typeof global<"u"&&global.crypto&&(r=global.crypto),!r&&typeof Ke=="function")try{r=Ke("crypto");}catch{}var i=function(){if(r){if(typeof r.getRandomValues=="function")try{return r.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof r.randomBytes=="function")try{return r.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={},h=a.lib={},c=h.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=h.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,y=this.sigBytes,x=o.sigBytes;if(this.clamp(),y%4)for(var U=0;U<x;U++){var se=I[U>>>2]>>>24-U%4*8&255;d[y+U>>>2]|=se<<24-(y+U)%4*8;}else for(var H=0;H<x;H+=4)d[y+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,y=[],x=0;x<I;x++){var U=d[x>>>2]>>>24-x%4*8&255;y.push((U>>>4).toString(16)),y.push((U&15).toString(16));}return y.join("")},parse:function(o){for(var d=o.length,I=[],y=0;y<d;y+=2)I[y>>>3]|=parseInt(o.substr(y,2),16)<<24-y%8*4;return new E.init(I,d/2)}},N=S.Latin1={stringify:function(o){for(var d=o.words,I=o.sigBytes,y=[],x=0;x<I;x++){var U=d[x>>>2]>>>24-x%4*8&255;y.push(String.fromCharCode(U));}return y.join("")},parse:function(o){for(var d=o.length,I=[],y=0;y<d;y++)I[y>>>2]|=(o.charCodeAt(y)&255)<<24-y%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=h.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,y=I.words,x=I.sigBytes,U=this.blockSize,se=U*4,H=x/se;o?H=e.ceil(H):H=e.max((H|0)-this._minBufferSize,0);var q=H*U,ge=e.min(q*4,x);if(q){for(var Ge=0;Ge<q;Ge+=U)this._doProcessBlock(y,Ge);d=y.splice(0,q),I.sigBytes-=ge;}return new E.init(d,ge)},clone:function(){var o=c.clone.call(this);return o._data=this._data.clone(),o},_minBufferSize:0});h.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((ze,ct)=>{(function(l,e){typeof ze=="object"?ct.exports=ze=e(ut()):typeof define=="function"&&define.amd?define(["./core"],e):e(l.CryptoJS);})(ze,function(l){return (function(){var e=l,t=e.lib,r=t.WordArray,i=t.Hasher,s=e.algo,a=[],h=s.SHA1=i.extend({_doReset:function(){this._hash=new r.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(h),e.HmacSHA1=i._createHmacHelper(h);})(),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 ae(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 _e=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,st=new Set,Be=typeof process=="object"&&process?process:{},at=(l,e,t,r)=>{typeof Be.emitWarning=="function"?Be.emitWarning(l,e,t,r):console.error(`[${t}] ${e}: ${l}`);},Ye=globalThis.AbortController,rt=globalThis.AbortSignal;if(typeof Ye>"u"){rt=class{constructor(){_(this,"onabort");_(this,"_onabort",[]);_(this,"reason");_(this,"aborted",false);}addEventListener(r,i){this._onabort.push(i);}},Ye=class{constructor(){_(this,"signal",new rt);e();}abort(r){if(!this.signal.aborted){this.signal.reason=r,this.signal.aborted=true;for(let i of this.signal._onabort)i(r);this.signal.onabort?.(r);}}};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 Et=l=>!st.has(l),he=l=>l&&l===Math.floor(l)&&l>0&&isFinite(l),ot=l=>he(l)?l<=Math.pow(2,8)?Uint8Array:l<=Math.pow(2,16)?Uint16Array:l<=Math.pow(2,32)?Uint32Array:l<=Number.MAX_SAFE_INTEGER?ye:null:null,ye=class extends Array{constructor(e){super(e),this.fill(0);}},Le,fe=class fe{constructor(e,t){_(this,"heap");_(this,"length");if(!n(fe,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(fe,Le,true);let r=new fe(e,t);return m(fe,Le,false),r}push(e){this.heap[this.length++]=e;}pop(){return this.heap[--this.length]}};Le=new WeakMap,w(fe,Le,false);var je=fe,nt,it,X,B,J,be,Q,Te,Ee,F,Z,Y,M,T,K,j,G,V,ee,z,te,re,$,ne,de,W,Ce,u,$e,me,oe,ve,k,lt,Se,Ie,Ae,ue,ce,ke,De,Ue,A,qe,xe,pe,Xe,Je=class Je{constructor(e){w(this,u);w(this,X);w(this,B);w(this,J);w(this,be);w(this,Q);w(this,Te);w(this,Ee);_(this,"ttl");_(this,"ttlResolution");_(this,"ttlAutopurge");_(this,"updateAgeOnGet");_(this,"updateAgeOnHas");_(this,"allowStale");_(this,"noDisposeOnSet");_(this,"noUpdateTTL");_(this,"maxEntrySize");_(this,"sizeCalculation");_(this,"noDeleteOnFetchRejection");_(this,"noDeleteOnStaleGet");_(this,"allowStaleOnFetchAbort");_(this,"allowStaleOnFetchRejection");_(this,"ignoreFetchAbort");w(this,F);w(this,Z);w(this,Y);w(this,M);w(this,T);w(this,K);w(this,j);w(this,G);w(this,V);w(this,ee);w(this,z);w(this,te);w(this,re);w(this,$);w(this,ne);w(this,de);w(this,W);w(this,Ce);w(this,me,()=>{});w(this,oe,()=>{});w(this,ve,()=>{});w(this,k,()=>false);w(this,Se,e=>{});w(this,Ie,(e,t,r)=>{});w(this,Ae,(e,t,r,i)=>{if(r||i)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});_(this,nt,"LRUCache");let{max:t=0,ttl:r,ttlResolution:i=1,ttlAutopurge:s,updateAgeOnGet:a,updateAgeOnHas:h,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:y,allowStaleOnFetchRejection:x,allowStaleOnFetchAbort:U,ignoreFetchAbort:se}=e;if(t!==0&&!he(t))throw new TypeError("max option must be a nonnegative integer");let H=t?ot(t):Array;if(!H)throw new Error("invalid max value: "+t);if(m(this,X,t),m(this,B,D),this.maxEntrySize=v||n(this,B),this.sizeCalculation=C,this.sizeCalculation){if(!n(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,de,!!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 H(t)),m(this,j,new H(t)),m(this,G,0),m(this,V,0),m(this,ee,je.create(t)),m(this,F,0),m(this,Z,0),typeof E=="function"&&m(this,J,E),typeof S=="function"&&m(this,be,S),typeof g=="function"?(m(this,Q,g),m(this,z,[])):(m(this,Q,void 0),m(this,z,void 0)),m(this,ne,!!n(this,J)),m(this,Ce,!!n(this,be)),m(this,W,!!n(this,Q)),this.noDisposeOnSet=!!N,this.noUpdateTTL=!!P,this.noDeleteOnFetchRejection=!!I,this.allowStaleOnFetchRejection=!!x,this.allowStaleOnFetchAbort=!!U,this.ignoreFetchAbort=!!se,this.maxEntrySize!==0){if(n(this,B)!==0&&!he(n(this,B)))throw new TypeError("maxSize must be a positive integer if specified");if(!he(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");f(this,u,lt).call(this);}if(this.allowStale=!!c,this.noDeleteOnStaleGet=!!y,this.updateAgeOnGet=!!a,this.updateAgeOnHas=!!h,this.ttlResolution=he(i)||i===0?i:1,this.ttlAutopurge=!!s,this.ttl=r||0,this.ttl){if(!he(this.ttl))throw new TypeError("ttl must be a positive integer if specified");f(this,u,$e).call(this);}if(n(this,X)===0&&this.ttl===0&&n(this,B)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!n(this,X)&&!n(this,B)){let q="LRU_CACHE_UNBOUNDED";Et(q)&&(st.add(q),at("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",q,Je));}}static unsafeExposeInternals(e){return {starts:n(e,re),ttls:n(e,$),sizes:n(e,te),keyMap:n(e,Y),keyList:n(e,M),valList:n(e,T),next:n(e,K),prev:n(e,j),get head(){return n(e,G)},get tail(){return n(e,V)},free:n(e,ee),isBackgroundFetch:t=>{var r;return f(r=e,u,A).call(r,t)},backgroundFetch:(t,r,i,s)=>{var a;return f(a=e,u,Ue).call(a,t,r,i,s)},moveToTail:t=>{var r;return f(r=e,u,xe).call(r,t)},indexes:t=>{var r;return f(r=e,u,ue).call(r,t)},rindexes:t=>{var r;return f(r=e,u,ce).call(r,t)},isStale:t=>{var r;return n(r=e,k).call(r,t)}}}get max(){return n(this,X)}get maxSize(){return n(this,B)}get calculatedSize(){return n(this,Z)}get size(){return n(this,F)}get fetchMethod(){return n(this,Te)}get memoMethod(){return n(this,Ee)}get dispose(){return n(this,J)}get onInsert(){return n(this,be)}get disposeAfter(){return n(this,Q)}getRemainingTTL(e){return n(this,Y).has(e)?1/0:0}*entries(){for(let e of f(this,u,ue).call(this))n(this,T)[e]!==void 0&&n(this,M)[e]!==void 0&&!f(this,u,A).call(this,n(this,T)[e])&&(yield [n(this,M)[e],n(this,T)[e]]);}*rentries(){for(let e of f(this,u,ce).call(this))n(this,T)[e]!==void 0&&n(this,M)[e]!==void 0&&!f(this,u,A).call(this,n(this,T)[e])&&(yield [n(this,M)[e],n(this,T)[e]]);}*keys(){for(let e of f(this,u,ue).call(this)){let t=n(this,M)[e];t!==void 0&&!f(this,u,A).call(this,n(this,T)[e])&&(yield t);}}*rkeys(){for(let e of f(this,u,ce).call(this)){let t=n(this,M)[e];t!==void 0&&!f(this,u,A).call(this,n(this,T)[e])&&(yield t);}}*values(){for(let e of f(this,u,ue).call(this))n(this,T)[e]!==void 0&&!f(this,u,A).call(this,n(this,T)[e])&&(yield n(this,T)[e]);}*rvalues(){for(let e of f(this,u,ce).call(this))n(this,T)[e]!==void 0&&!f(this,u,A).call(this,n(this,T)[e])&&(yield n(this,T)[e]);}[(it=Symbol.iterator,nt=Symbol.toStringTag,it)](){return this.entries()}find(e,t={}){for(let r of f(this,u,ue).call(this)){let i=n(this,T)[r],s=f(this,u,A).call(this,i)?i.__staleWhileFetching:i;if(s!==void 0&&e(s,n(this,M)[r],this))return this.get(n(this,M)[r],t)}}forEach(e,t=this){for(let r of f(this,u,ue).call(this)){let i=n(this,T)[r],s=f(this,u,A).call(this,i)?i.__staleWhileFetching:i;s!==void 0&&e.call(t,s,n(this,M)[r],this);}}rforEach(e,t=this){for(let r of f(this,u,ce).call(this)){let i=n(this,T)[r],s=f(this,u,A).call(this,i)?i.__staleWhileFetching:i;s!==void 0&&e.call(t,s,n(this,M)[r],this);}}purgeStale(){let e=false;for(let t of f(this,u,ce).call(this,{allowStale:true}))n(this,k).call(this,t)&&(f(this,u,pe).call(this,n(this,M)[t],"expire"),e=true);return e}info(e){let t=n(this,Y).get(e);if(t===void 0)return;let r=n(this,T)[t],i=f(this,u,A).call(this,r)?r.__staleWhileFetching:r;if(i===void 0)return;let s={value:i};if(n(this,$)&&n(this,re)){let a=n(this,$)[t],h=n(this,re)[t];if(a&&h){let c=a-(_e.now()-h);s.ttl=c,s.start=Date.now();}}return n(this,te)&&(s.size=n(this,te)[t]),s}dump(){let e=[];for(let t of f(this,u,ue).call(this,{allowStale:true})){let r=n(this,M)[t],i=n(this,T)[t],s=f(this,u,A).call(this,i)?i.__staleWhileFetching:i;if(s===void 0||r===void 0)continue;let a={value:s};if(n(this,$)&&n(this,re)){a.ttl=n(this,$)[t];let h=_e.now()-n(this,re)[t];a.start=Math.floor(Date.now()-h);}n(this,te)&&(a.size=n(this,te)[t]),e.unshift([r,a]);}return e}load(e){this.clear();for(let[t,r]of e){if(r.start){let i=Date.now()-r.start;r.start=_e.now()-i;}this.set(t,r.value,r);}}set(e,t,r={}){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:h=this.sizeCalculation,status:c}=r,{noUpdateTTL:E=this.noUpdateTTL}=r,S=n(this,Ae).call(this,e,t,r.size||0,h);if(this.maxEntrySize&&S>this.maxEntrySize)return c&&(c.set="miss",c.maxEntrySizeExceeded=true),f(this,u,pe).call(this,e,"set"),this;let g=n(this,F)===0?void 0:n(this,Y).get(e);if(g===void 0)g=n(this,F)===0?n(this,V):n(this,ee).length!==0?n(this,ee).pop():n(this,F)===n(this,X)?f(this,u,De).call(this,false):n(this,F),n(this,M)[g]=e,n(this,T)[g]=t,n(this,Y).set(e,g),n(this,K)[n(this,V)]=g,n(this,j)[g]=n(this,V),m(this,V,g),Pe(this,F)._++,n(this,Ie).call(this,g,S,c),c&&(c.set="add"),E=false,n(this,Ce)&&((N=n(this,be))==null||N.call(this,t,e,"add"));else {f(this,u,xe).call(this,g);let C=n(this,T)[g];if(t!==C){if(n(this,de)&&f(this,u,A).call(this,C)){C.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:o}=C;o!==void 0&&!a&&(n(this,ne)&&((P=n(this,J))==null||P.call(this,o,e,"set")),n(this,W)&&n(this,z)?.push([o,e,"set"]));}else a||(n(this,ne)&&((D=n(this,J))==null||D.call(this,C,e,"set")),n(this,W)&&n(this,z)?.push([C,e,"set"]));if(n(this,Se).call(this,g),n(this,Ie).call(this,g,S,c),n(this,T)[g]=t,c){c.set="replace";let o=C&&f(this,u,A).call(this,C)?C.__staleWhileFetching:C;o!==void 0&&(c.oldValue=o);}}else c&&(c.set="update");n(this,Ce)&&this.onInsert?.(t,e,t===C?"update":"replace");}if(i!==0&&!n(this,$)&&f(this,u,$e).call(this),n(this,$)&&(E||n(this,ve).call(this,g,i,s),c&&n(this,oe).call(this,c,g)),!a&&n(this,W)&&n(this,z)){let C=n(this,z),o;for(;o=C?.shift();)(v=n(this,Q))==null||v.call(this,...o);}return this}pop(){var e;try{for(;n(this,F);){let t=n(this,T)[n(this,G)];if(f(this,u,De).call(this,!0),f(this,u,A).call(this,t)){if(t.__staleWhileFetching)return t.__staleWhileFetching}else if(t!==void 0)return t}}finally{if(n(this,W)&&n(this,z)){let t=n(this,z),r;for(;r=t?.shift();)(e=n(this,Q))==null||e.call(this,...r);}}}has(e,t={}){let{updateAgeOnHas:r=this.updateAgeOnHas,status:i}=t,s=n(this,Y).get(e);if(s!==void 0){let a=n(this,T)[s];if(f(this,u,A).call(this,a)&&a.__staleWhileFetching===void 0)return false;if(n(this,k).call(this,s))i&&(i.has="stale",n(this,oe).call(this,i,s));else return r&&n(this,me).call(this,s),i&&(i.has="hit",n(this,oe).call(this,i,s)),true}else i&&(i.has="miss");return false}peek(e,t={}){let{allowStale:r=this.allowStale}=t,i=n(this,Y).get(e);if(i===void 0||!r&&n(this,k).call(this,i))return;let s=n(this,T)[i];return f(this,u,A).call(this,s)?s.__staleWhileFetching:s}async fetch(e,t={}){let{allowStale:r=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:s=this.noDeleteOnStaleGet,ttl:a=this.ttl,noDisposeOnSet:h=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(!n(this,de))return o&&(o.fetch="get"),this.get(e,{allowStale:r,updateAgeOnGet:i,noDeleteOnStaleGet:s,status:o});let I={allowStale:r,updateAgeOnGet:i,noDeleteOnStaleGet:s,ttl:a,noDisposeOnSet:h,size:c,sizeCalculation:E,noUpdateTTL:S,noDeleteOnFetchRejection:g,allowStaleOnFetchRejection:N,allowStaleOnFetchAbort:D,ignoreFetchAbort:P,status:o,signal:d},y=n(this,Y).get(e);if(y===void 0){o&&(o.fetch="miss");let x=f(this,u,Ue).call(this,e,y,I,v);return x.__returned=x}else {let x=n(this,T)[y];if(f(this,u,A).call(this,x)){let ge=r&&x.__staleWhileFetching!==void 0;return o&&(o.fetch="inflight",ge&&(o.returnedStale=true)),ge?x.__staleWhileFetching:x.__returned=x}let U=n(this,k).call(this,y);if(!C&&!U)return o&&(o.fetch="hit"),f(this,u,xe).call(this,y),i&&n(this,me).call(this,y),o&&n(this,oe).call(this,o,y),x;let se=f(this,u,Ue).call(this,e,y,I,v),q=se.__staleWhileFetching!==void 0&&r;return o&&(o.fetch=U?"stale":"refresh",q&&U&&(o.returnedStale=true)),q?se.__staleWhileFetching:se.__returned=se}}async forceFetch(e,t={}){let r=await this.fetch(e,t);if(r===void 0)throw new Error("fetch() returned undefined");return r}memo(e,t={}){let r=n(this,Ee);if(!r)throw new Error("no memoMethod provided to constructor");let{context:i,forceRefresh:s,...a}=t,h=this.get(e,a);if(!s&&h!==void 0)return h;let c=r(e,h,{options:a,context:i});return this.set(e,c,a),c}get(e,t={}){let{allowStale:r=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:s=this.noDeleteOnStaleGet,status:a}=t,h=n(this,Y).get(e);if(h!==void 0){let c=n(this,T)[h],E=f(this,u,A).call(this,c);return a&&n(this,oe).call(this,a,h),n(this,k).call(this,h)?(a&&(a.get="stale"),E?(a&&r&&c.__staleWhileFetching!==void 0&&(a.returnedStale=true),r?c.__staleWhileFetching:void 0):(s||f(this,u,pe).call(this,e,"expire"),a&&r&&(a.returnedStale=true),r?c:void 0)):(a&&(a.get="hit"),E?c.__staleWhileFetching:(f(this,u,xe).call(this,h),i&&n(this,me).call(this,h),c))}else a&&(a.get="miss");}delete(e){return f(this,u,pe).call(this,e,"delete")}clear(){return f(this,u,Xe).call(this,"delete")}};X=new WeakMap,B=new WeakMap,J=new WeakMap,be=new WeakMap,Q=new WeakMap,Te=new WeakMap,Ee=new WeakMap,F=new WeakMap,Z=new WeakMap,Y=new WeakMap,M=new WeakMap,T=new WeakMap,K=new WeakMap,j=new WeakMap,G=new WeakMap,V=new WeakMap,ee=new WeakMap,z=new WeakMap,te=new WeakMap,re=new WeakMap,$=new WeakMap,ne=new WeakMap,de=new WeakMap,W=new WeakMap,Ce=new WeakMap,u=new WeakSet,$e=function(){let e=new ye(n(this,X)),t=new ye(n(this,X));m(this,$,e),m(this,re,t),m(this,ve,(s,a,h=_e.now())=>{if(t[s]=a!==0?h:0,e[s]=a,a!==0&&this.ttlAutopurge){let c=setTimeout(()=>{n(this,k).call(this,s)&&f(this,u,pe).call(this,n(this,M)[s],"expire");},a+1);c.unref&&c.unref();}}),m(this,me,s=>{t[s]=e[s]!==0?_e.now():0;}),m(this,oe,(s,a)=>{if(e[a]){let h=e[a],c=t[a];if(!h||!c)return;s.ttl=h,s.start=c,s.now=r||i();let E=s.now-c;s.remainingTTL=h-E;}});let r=0,i=()=>{let s=_e.now();if(this.ttlResolution>0){r=s;let a=setTimeout(()=>r=0,this.ttlResolution);a.unref&&a.unref();}return s};this.getRemainingTTL=s=>{let a=n(this,Y).get(s);if(a===void 0)return 0;let h=e[a],c=t[a];if(!h||!c)return 1/0;let E=(r||i())-c;return h-E},m(this,k,s=>{let a=t[s],h=e[s];return !!h&&!!a&&(r||i())-a>h});},me=new WeakMap,oe=new WeakMap,ve=new WeakMap,k=new WeakMap,lt=function(){let e=new ye(n(this,X));m(this,Z,0),m(this,te,e),m(this,Se,t=>{m(this,Z,n(this,Z)-e[t]),e[t]=0;}),m(this,Ae,(t,r,i,s)=>{if(f(this,u,A).call(this,r))return 0;if(!he(i))if(s){if(typeof s!="function")throw new TypeError("sizeCalculation must be a function");if(i=s(r,t),!he(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,r,i)=>{if(e[t]=r,n(this,B)){let s=n(this,B)-e[t];for(;n(this,Z)>s;)f(this,u,De).call(this,true);}m(this,Z,n(this,Z)+e[t]),i&&(i.entrySize=r,i.totalCalculatedSize=n(this,Z));});},Se=new WeakMap,Ie=new WeakMap,Ae=new WeakMap,ue=function*({allowStale:e=this.allowStale}={}){if(n(this,F))for(let t=n(this,V);!(!f(this,u,ke).call(this,t)||((e||!n(this,k).call(this,t))&&(yield t),t===n(this,G)));)t=n(this,j)[t];},ce=function*({allowStale:e=this.allowStale}={}){if(n(this,F))for(let t=n(this,G);!(!f(this,u,ke).call(this,t)||((e||!n(this,k).call(this,t))&&(yield t),t===n(this,V)));)t=n(this,K)[t];},ke=function(e){return e!==void 0&&n(this,Y).get(n(this,M)[e])===e},De=function(e){var s;let t=n(this,G),r=n(this,M)[t],i=n(this,T)[t];return n(this,de)&&f(this,u,A).call(this,i)?i.__abortController.abort(new Error("evicted")):(n(this,ne)||n(this,W))&&(n(this,ne)&&((s=n(this,J))==null||s.call(this,i,r,"evict")),n(this,W)&&n(this,z)?.push([i,r,"evict"])),n(this,Se).call(this,t),e&&(n(this,M)[t]=void 0,n(this,T)[t]=void 0,n(this,ee).push(t)),n(this,F)===1?(m(this,G,m(this,V,0)),n(this,ee).length=0):m(this,G,n(this,K)[t]),n(this,Y).delete(r),Pe(this,F)._--,t},Ue=function(e,t,r,i){let s=t===void 0?void 0:n(this,T)[t];if(f(this,u,A).call(this,s))return s;let a=new Ye,{signal:h}=r;h?.addEventListener("abort",()=>a.abort(h.reason),{signal:a.signal});let c={signal:a.signal,options:r,context:i},E=(v,C=false)=>{let{aborted:o}=a.signal,d=r.ignoreFetchAbort&&v!==void 0;if(r.status&&(o&&!C?(r.status.fetchAborted=true,r.status.fetchError=a.signal.reason,d&&(r.status.fetchAbortIgnored=true)):r.status.fetchResolved=true),o&&!d&&!C)return g(a.signal.reason);let I=P;return n(this,T)[t]===P&&(v===void 0?I.__staleWhileFetching?n(this,T)[t]=I.__staleWhileFetching:f(this,u,pe).call(this,e,"fetch"):(r.status&&(r.status.fetchUpdated=true),this.set(e,v,c.options))),v},S=v=>(r.status&&(r.status.fetchRejected=true,r.status.fetchError=v),g(v)),g=v=>{let{aborted:C}=a.signal,o=C&&r.allowStaleOnFetchAbort,d=o||r.allowStaleOnFetchRejection,I=d||r.noDeleteOnFetchRejection,y=P;if(n(this,T)[t]===P&&(!I||y.__staleWhileFetching===void 0?f(this,u,pe).call(this,e,"fetch"):o||(n(this,T)[t]=y.__staleWhileFetching)),d)return r.status&&y.__staleWhileFetching!==void 0&&(r.status.returnedStale=true),y.__staleWhileFetching;if(y.__returned===y)throw v},N=(v,C)=>{var d;let o=(d=n(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",()=>{(!r.ignoreFetchAbort||r.allowStaleOnFetchAbort)&&(v(void 0),r.allowStaleOnFetchAbort&&(v=I=>E(I,true)));});};r.status&&(r.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=n(this,Y).get(e)):n(this,T)[t]=D,D},A=function(e){if(!n(this,de))return false;let t=e;return !!t&&t instanceof Promise&&t.hasOwnProperty("__staleWhileFetching")&&t.__abortController instanceof Ye},qe=function(e,t){n(this,j)[t]=e,n(this,K)[e]=t;},xe=function(e){e!==n(this,V)&&(e===n(this,G)?m(this,G,n(this,K)[e]):f(this,u,qe).call(this,n(this,j)[e],n(this,K)[e]),f(this,u,qe).call(this,n(this,V),e),m(this,V,e));},pe=function(e,t){var i,s;let r=false;if(n(this,F)!==0){let a=n(this,Y).get(e);if(a!==void 0)if(r=true,n(this,F)===1)f(this,u,Xe).call(this,t);else {n(this,Se).call(this,a);let h=n(this,T)[a];if(f(this,u,A).call(this,h)?h.__abortController.abort(new Error("deleted")):(n(this,ne)||n(this,W))&&(n(this,ne)&&((i=n(this,J))==null||i.call(this,h,e,t)),n(this,W)&&n(this,z)?.push([h,e,t])),n(this,Y).delete(e),n(this,M)[a]=void 0,n(this,T)[a]=void 0,a===n(this,V))m(this,V,n(this,j)[a]);else if(a===n(this,G))m(this,G,n(this,K)[a]);else {let c=n(this,j)[a];n(this,K)[c]=n(this,K)[a];let E=n(this,K)[a];n(this,j)[E]=n(this,j)[a];}Pe(this,F)._--,n(this,ee).push(a);}}if(n(this,W)&&n(this,z)?.length){let a=n(this,z),h;for(;h=a?.shift();)(s=n(this,Q))==null||s.call(this,...h);}return r},Xe=function(e){var t,r;for(let i of f(this,u,ce).call(this,{allowStale:true})){let s=n(this,T)[i];if(f(this,u,A).call(this,s))s.__abortController.abort(new Error("deleted"));else {let a=n(this,M)[i];n(this,ne)&&((t=n(this,J))==null||t.call(this,s,a,e)),n(this,W)&&n(this,z)?.push([s,a,e]);}}if(n(this,Y).clear(),n(this,T).fill(void 0),n(this,M).fill(void 0),n(this,$)&&n(this,re)&&(n(this,$).fill(0),n(this,re).fill(0)),n(this,te)&&n(this,te).fill(0),m(this,G,0),m(this,V,0),n(this,ee).length=0,m(this,Z,0),m(this,F,0),n(this,W)&&n(this,z)){let i=n(this,z),s;for(;s=i?.shift();)(r=n(this,Q))==null||r.call(this,...s);}};var Fe=Je;var Oe=class{constructor(e){_(this,"cache");_(this,"map",new Map);this.cache=new Fe({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 r(s){return Me.has(s)}i.has=r;})(Qe||(Qe={}));var ie=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 r=`${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",h=unifier.GameUnifier.getVariable(O.CURRENT_STEP_TIMES_COUNTER_KEY)||{};return h[i]||(h[i]={}),(!h[i][r]||h[i][r].stepSha1!=a)&&(h[i][r]={stepSha1:a}),h[i][r]}static setCurrentStepTimesCounterData(e="",t){let r=b.currentLabelStepIndex,i=r+e,s=b.currentLabelId;if(!s||r===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,r=b.getCurrentStepTimesCounterData(e);if(!r)return L.error("getCurrentStepTimesCounter obj is null"),0;let i=r.stepCounters||r.lastStepIndexs||[];return i.find(a=>a===t)||(i.push(t),delete r.lastStepIndexs,r.stepCounters=i,b.setCurrentStepTimesCounterData(e,r)),i.length}static getRandomNumber(e,t,r={}){let i=r.nestedId||"";if(r.onceOnly||false){let a=b.getCurrentStepTimesCounterData(i);if(!a)return;let h=a.usedRandomNumbers||{},c=Array.from({length:t-e+1},(g,N)=>N+e).filter(g=>!h[`${e}-${t}`]?.includes(g));if(c.length===0)return;let E=Math.floor(Math.random()*c.length),S=c[E];return h[`${e}-${t}`]||(h[`${e}-${t}`]=[]),h[`${e}-${t}`].push(S),a.usedRandomNumbers=h,b.setCurrentStepTimesCounterData(i,a),S}return Math.floor(Math.random()*(t-e+1))+e}static resetCurrentStepTimesCounter(e=""){let t=b.currentLabelStepIndex,r=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][r]={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 ae(b._openedLabels)}static set openedLabels(e){b._openedLabels=ae(e);}static get originalOpenedLabels(){return ae(b._originalOpenedLabels)}static set originalOpenedLabels(e){b._originalOpenedLabels=ae(e);}static get _currentLabel(){if(b.currentLabelId)return ie.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 r=b.allOpenedLabels,i=b.allOpenedLabels[e]?.biggestStep||0,s=b.allOpenedLabels[e]?.openCount||0;(!i||i<t)&&(r[e]={biggestStep:t,openCount:s},b.allOpenedLabels=r);}static addChoicesMade(e,t,r,i){let s=b.allChoicesMade,a=s.findIndex(h=>h.labelId===e&&h.stepIndex===t&&h.choiceIndex===i&&h.stepSha1===r);a<0?s.push({labelId:e,stepIndex:t,choiceIndex:i,stepSha1:r,madeTimes:1}):s[a].madeTimes++,b.allChoicesMade=s;}static pushNewLabel(e){if(!ie.get(e))throw new Error(`[Pixi\u2019VN] Label ${e} not found`);b._openedLabels.push({label:e,currentStepIndex:0});let r=b.allOpenedLabels,i=b.allOpenedLabels[e]?.biggestStep||0,s=b.allOpenedLabels[e]?.openCount||0;r[e]={biggestStep:i,openCount:s+1},b.allOpenedLabels=r;}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 r=[];return b.onLoadingLabel&&e===0&&r.push(b.onLoadingLabel(e,t)),b._onStepStart&&r.push(b._onStepStart(e,t)),await Promise.all(r)}}};_(b,"stepsRunning",0),_(b,"goNextRequests",0),_(b,"choiceMadeTemp"),_(b,"lastHistoryStep",null),_(b,"_stepCounter",0),_(b,"_openedLabels",[]),_(b,"_originalOpenedLabels",[]),_(b,"_onStepStart"),_(b,"onLoadingLabel"),_(b,"onStepEnd");var p=b;var Ne=class{get currentStepTimesCounter(){return p.getCurrentStepTimesCounter()}set currentStepTimesCounter(e){p.resetCurrentStepTimesCounter();}getRandomNumber(e,t,r={}){return p.getRandomNumber(e,t,r)}get stepCounter(){return p._stepCounter}get openedLabels(){return p.openedLabels}get currentLabel(){return p._currentLabel}addStepHistory(e,t={}){let{choiceMade:r,ignoreSameStep:i}=t,s,a,h,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&&(h=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:r,inputValue:h,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=ie.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 r=t.getStepSha(e);return r||(L.warn("stepSha not found, setting to ERROR"),r="error"),p.allChoicesMade.filter(i=>i.labelId===t?.id&&i.stepIndex===e&&i.stepSha1===r)}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});}getCanGoNext(e){let t=e?.showWarn||false,r=this.choiceMenuOptions;return r&&r.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 canGoNext(){return p.stepsRunning!==0?false:this.getCanGoNext()}async onStepRun(e,t){let r=[];return e.onStepStart&&r.push(e.onStepStart(t,e)),p.onStepStart&&r.push(p.onStepStart(t,e)),await Promise.all(r)}async onStepEnd(e,t){let r=[];return e.onStepEnd&&r.push(e.onStepEnd(t,e)),p.onStepEnd&&r.push(p.onStepEnd(t,e)),await Promise.all(r)}async goNext(e,t={}){let{runNow:r=false}=t;if(!(!r&&!this.getCanGoNext({showWarn:true}))){if(!r&&p.stepsRunning!==0){p.goNextRequests++;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:r}=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 h=s.getStepSha(i);h||(L.warn("stepSha not found, setting to ERROR"),h="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(r!==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",r),p.choiceMadeTemp=r;}return p.stepsRunning--,p.stepsRunning===0&&(p.addLabelHistory(s.id,i),this.addStepHistory(h,{...t,choiceMade:p.choiceMadeTemp}),p.choiceMadeTemp=void 0,p.goNextRequests>0)?(p.goNextRequests--,await this.goNext(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.goNext(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,r){let{choiceMade:i}=r||{},s;typeof e=="string"?s=e:s=e.id;try{let a=ie.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(h){L.error("Error running onStepEnd",h);}p.pushNewLabel(a.id);}catch(a){L.error("Error calling label",a);return}return await this.runCurrentStep(t,{choiceMade:i})}async jumpLabel(e,t,r){this.openedLabels.length>0&&this.closeCurrentLabel();let{choiceMade:i}=r||{},s;typeof e=="string"?s=e:s=e.id;try{let a=ie.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(h){L.error("Error running onStepEnd",h);}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 r=e.type;switch(r){case "call":return await this.callLabel(e.label,{...e.props,...t},{choiceMade:e.choiceIndex});case "jump":return await this.jumpLabel(e.label,{...e.props,...t},{choiceMade:e.choiceIndex});case "close":return await this.closeChoiceMenu(e,{...e.props,...t});default:throw L.error(`Type ${r} not found`),new Error(`[Pixi\u2019VN] Type ${r} 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 r;return typeof e.choiceIndex=="number"&&(r=e.choiceIndex),e.closeCurrentLabel&&this.closeCurrentLabel(),this.goNext(t,{choiceMade:r})}get onStepError(){let e=unifier.GameUnifier.onError;return e?(t,r)=>e("step",t,r):void 0}set onStepError(e){unifier.GameUnifier.onError=(t,r,i)=>e(r,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 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;}unifier.GameUnifier.setVariable(O.LAST_STEP_GLUED,this.stepCounter),this.dialogGlue=false;}try{unifier.GameUnifier.setVariable(O.CURRENT_DIALOGUE_MEMORY_KEY,ae({...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=[],r=e.map((s,a)=>({...s,choiceIndex:a})),i=this.alreadyCurrentStepMadeChoices;if(r=r.filter((s,a)=>s.oneTime&&i&&i.includes(a)?false:s.onlyHaveNoChoice?(t.push(s),false):true),r.length>0)return r;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,ae(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:ae(p.openedLabels),stepCounter:this.stepCounter}}async onLoadingLabel(e){let t=this.openedLabels.map(async r=>{let i=[],s=ie.get(r.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(r){L.error("Error running onLoadingLabel",r);}}catch(r){L.error("Error importing data",r);}}};function It(l,e,t,r){let i=typeof e=="string"?e:e.id;return {...r,label:i,props:t,text:l,type:r?.type||"call"}}var Ze="close";function Ot(l,e){return {...e,type:Ze,text:l}}var dt=Tt(pt());var Re=class{constructor(e,t){_(this,"_id");_(this,"_onStepStart");_(this,"_onLoadingLabel");_(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,r,i){super(t,i);_(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 L.warn("stepSha not found, setting to ERROR"),"error";try{let r=this.steps[t];return (0,dt.default)(r.toString().toLocaleLowerCase()).toString()}catch(r){return L.warn("stepSha not found, setting to ERROR",r),"error"}}};function ft(l,e,t){let r=new we(l,e,t);return ie.add(r),r}var Or=new Ne;
|
|
2
|
-
exports.Close=Ze;exports.Label=we;exports.LabelAbstract=Re;exports.NarrationManagerStatic=p;exports.RegisteredLabels=
|
|
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;
|
package/dist/narration.d.cts
CHANGED
|
@@ -105,11 +105,11 @@ declare abstract class LabelAbstract<TLabel, TProps extends {} = {}, StepIdType
|
|
|
105
105
|
* newChoiceOption("Show Image Test", showImageTest),
|
|
106
106
|
* ]
|
|
107
107
|
* },
|
|
108
|
-
* (props) => narration.
|
|
108
|
+
* (props) => narration.jump(START_LABEL_ID, props),
|
|
109
109
|
* ]
|
|
110
110
|
* )
|
|
111
111
|
*
|
|
112
|
-
* narration.
|
|
112
|
+
* narration.call(StartLabel)
|
|
113
113
|
* ```
|
|
114
114
|
*/
|
|
115
115
|
declare class Label<T extends {} = {}> extends LabelAbstract<Label<T>, T> {
|
|
@@ -335,6 +335,10 @@ interface NarrationManagerInterface {
|
|
|
335
335
|
* Return if can go to the next step.
|
|
336
336
|
* @returns True if can go to the next step.
|
|
337
337
|
*/
|
|
338
|
+
readonly canContinue: boolean;
|
|
339
|
+
/**
|
|
340
|
+
* @deprecated use {@link canContinue} instead.
|
|
341
|
+
*/
|
|
338
342
|
readonly canGoNext: boolean;
|
|
339
343
|
/**
|
|
340
344
|
* Execute the next step and add it to the history. If a step is already running, it will put the request in the queue,
|
|
@@ -346,7 +350,7 @@ interface NarrationManagerInterface {
|
|
|
346
350
|
* ```typescript
|
|
347
351
|
* function nextOnClick() {
|
|
348
352
|
* setLoading(true)
|
|
349
|
-
* narration.
|
|
353
|
+
* narration.continue(yourParams)
|
|
350
354
|
* .then((result) => {
|
|
351
355
|
* setUpdate((p) => p + 1)
|
|
352
356
|
* setLoading(false)
|
|
@@ -361,11 +365,16 @@ interface NarrationManagerInterface {
|
|
|
361
365
|
* }
|
|
362
366
|
* ```
|
|
363
367
|
*/
|
|
364
|
-
|
|
368
|
+
continue(props: StepLabelPropsType, options?: {
|
|
365
369
|
/**
|
|
366
|
-
*
|
|
370
|
+
* If true, ignore the running step, ignore the choice menu/required input and run the next step immediately.
|
|
367
371
|
*/
|
|
368
|
-
|
|
372
|
+
runNow?: boolean;
|
|
373
|
+
}): Promise<StepLabelResultType>;
|
|
374
|
+
/**
|
|
375
|
+
* @deprecated use {@link continue} instead.
|
|
376
|
+
*/
|
|
377
|
+
goNext(props: StepLabelPropsType, options?: {
|
|
369
378
|
/**
|
|
370
379
|
* If true, ignore the running step, ignore the choice menu/required input and run the next step immediately.
|
|
371
380
|
*/
|
|
@@ -378,7 +387,7 @@ interface NarrationManagerInterface {
|
|
|
378
387
|
* @returns StepLabelResultType or undefined.
|
|
379
388
|
* @example
|
|
380
389
|
* ```typescript
|
|
381
|
-
* narration.
|
|
390
|
+
* narration.call(startLabel, yourParams).then((result) => {
|
|
382
391
|
* if (result) {
|
|
383
392
|
* // your code
|
|
384
393
|
* }
|
|
@@ -387,11 +396,15 @@ interface NarrationManagerInterface {
|
|
|
387
396
|
* @example
|
|
388
397
|
* ```typescript
|
|
389
398
|
* // if you use it in a step label you should return the result.
|
|
390
|
-
* return narration.
|
|
399
|
+
* return narration.call(startLabel).then((result) => {
|
|
391
400
|
* return result
|
|
392
401
|
* })
|
|
393
402
|
* ```
|
|
394
403
|
*/
|
|
404
|
+
call<T extends {} = {}>(label: LabelAbstract<any, T> | LabelIdType, props: StepLabelPropsType<T>): Promise<StepLabelResultType>;
|
|
405
|
+
/**
|
|
406
|
+
* @deprecated use {@link call} instead.
|
|
407
|
+
*/
|
|
395
408
|
callLabel<T extends {} = {}>(label: LabelAbstract<any, T> | LabelIdType, props: StepLabelPropsType<T>): Promise<StepLabelResultType>;
|
|
396
409
|
/**
|
|
397
410
|
* Execute the label, close the current label, execute the new label and add the new label to the history. (It's similar to Ren'Py's jump function)
|
|
@@ -400,7 +413,7 @@ interface NarrationManagerInterface {
|
|
|
400
413
|
* @returns StepLabelResultType or undefined.
|
|
401
414
|
* @example
|
|
402
415
|
* ```typescript
|
|
403
|
-
* narration.
|
|
416
|
+
* narration.jump(startLabel, yourParams).then((result) => {
|
|
404
417
|
* if (result) {
|
|
405
418
|
* // your code
|
|
406
419
|
* }
|
|
@@ -409,11 +422,15 @@ interface NarrationManagerInterface {
|
|
|
409
422
|
* @example
|
|
410
423
|
* ```typescript
|
|
411
424
|
* // if you use it in a step label you should return the result.
|
|
412
|
-
* return narration.
|
|
425
|
+
* return narration.jump(startLabel).then((result) => {
|
|
413
426
|
* return result
|
|
414
427
|
* })
|
|
415
428
|
* ```
|
|
416
429
|
*/
|
|
430
|
+
jump<T extends {}>(label: LabelAbstract<any, T> | LabelIdType, props: StepLabelPropsType<T>): Promise<StepLabelResultType>;
|
|
431
|
+
/**
|
|
432
|
+
* @deprecated use {@link jump} instead.
|
|
433
|
+
**/
|
|
417
434
|
jumpLabel<T extends {}>(label: LabelAbstract<any, T> | LabelIdType, props: StepLabelPropsType<T>): Promise<StepLabelResultType>;
|
|
418
435
|
/**
|
|
419
436
|
* Select a choice from the choice menu. and close the choice menu.
|
|
@@ -598,7 +615,7 @@ declare class NarrationManagerStatic {
|
|
|
598
615
|
* Number of requests to go to the next step.
|
|
599
616
|
* If it is > 0, after the stepsRunning is 0, the next step will be executed
|
|
600
617
|
*/
|
|
601
|
-
static
|
|
618
|
+
static continueRequests: number;
|
|
602
619
|
static choiceMadeTemp: undefined | number;
|
|
603
620
|
static lastHistoryStep: Omit<HistoryStep, "diff"> | null;
|
|
604
621
|
/**
|
package/dist/narration.d.ts
CHANGED
|
@@ -105,11 +105,11 @@ declare abstract class LabelAbstract<TLabel, TProps extends {} = {}, StepIdType
|
|
|
105
105
|
* newChoiceOption("Show Image Test", showImageTest),
|
|
106
106
|
* ]
|
|
107
107
|
* },
|
|
108
|
-
* (props) => narration.
|
|
108
|
+
* (props) => narration.jump(START_LABEL_ID, props),
|
|
109
109
|
* ]
|
|
110
110
|
* )
|
|
111
111
|
*
|
|
112
|
-
* narration.
|
|
112
|
+
* narration.call(StartLabel)
|
|
113
113
|
* ```
|
|
114
114
|
*/
|
|
115
115
|
declare class Label<T extends {} = {}> extends LabelAbstract<Label<T>, T> {
|
|
@@ -335,6 +335,10 @@ interface NarrationManagerInterface {
|
|
|
335
335
|
* Return if can go to the next step.
|
|
336
336
|
* @returns True if can go to the next step.
|
|
337
337
|
*/
|
|
338
|
+
readonly canContinue: boolean;
|
|
339
|
+
/**
|
|
340
|
+
* @deprecated use {@link canContinue} instead.
|
|
341
|
+
*/
|
|
338
342
|
readonly canGoNext: boolean;
|
|
339
343
|
/**
|
|
340
344
|
* Execute the next step and add it to the history. If a step is already running, it will put the request in the queue,
|
|
@@ -346,7 +350,7 @@ interface NarrationManagerInterface {
|
|
|
346
350
|
* ```typescript
|
|
347
351
|
* function nextOnClick() {
|
|
348
352
|
* setLoading(true)
|
|
349
|
-
* narration.
|
|
353
|
+
* narration.continue(yourParams)
|
|
350
354
|
* .then((result) => {
|
|
351
355
|
* setUpdate((p) => p + 1)
|
|
352
356
|
* setLoading(false)
|
|
@@ -361,11 +365,16 @@ interface NarrationManagerInterface {
|
|
|
361
365
|
* }
|
|
362
366
|
* ```
|
|
363
367
|
*/
|
|
364
|
-
|
|
368
|
+
continue(props: StepLabelPropsType, options?: {
|
|
365
369
|
/**
|
|
366
|
-
*
|
|
370
|
+
* If true, ignore the running step, ignore the choice menu/required input and run the next step immediately.
|
|
367
371
|
*/
|
|
368
|
-
|
|
372
|
+
runNow?: boolean;
|
|
373
|
+
}): Promise<StepLabelResultType>;
|
|
374
|
+
/**
|
|
375
|
+
* @deprecated use {@link continue} instead.
|
|
376
|
+
*/
|
|
377
|
+
goNext(props: StepLabelPropsType, options?: {
|
|
369
378
|
/**
|
|
370
379
|
* If true, ignore the running step, ignore the choice menu/required input and run the next step immediately.
|
|
371
380
|
*/
|
|
@@ -378,7 +387,7 @@ interface NarrationManagerInterface {
|
|
|
378
387
|
* @returns StepLabelResultType or undefined.
|
|
379
388
|
* @example
|
|
380
389
|
* ```typescript
|
|
381
|
-
* narration.
|
|
390
|
+
* narration.call(startLabel, yourParams).then((result) => {
|
|
382
391
|
* if (result) {
|
|
383
392
|
* // your code
|
|
384
393
|
* }
|
|
@@ -387,11 +396,15 @@ interface NarrationManagerInterface {
|
|
|
387
396
|
* @example
|
|
388
397
|
* ```typescript
|
|
389
398
|
* // if you use it in a step label you should return the result.
|
|
390
|
-
* return narration.
|
|
399
|
+
* return narration.call(startLabel).then((result) => {
|
|
391
400
|
* return result
|
|
392
401
|
* })
|
|
393
402
|
* ```
|
|
394
403
|
*/
|
|
404
|
+
call<T extends {} = {}>(label: LabelAbstract<any, T> | LabelIdType, props: StepLabelPropsType<T>): Promise<StepLabelResultType>;
|
|
405
|
+
/**
|
|
406
|
+
* @deprecated use {@link call} instead.
|
|
407
|
+
*/
|
|
395
408
|
callLabel<T extends {} = {}>(label: LabelAbstract<any, T> | LabelIdType, props: StepLabelPropsType<T>): Promise<StepLabelResultType>;
|
|
396
409
|
/**
|
|
397
410
|
* Execute the label, close the current label, execute the new label and add the new label to the history. (It's similar to Ren'Py's jump function)
|
|
@@ -400,7 +413,7 @@ interface NarrationManagerInterface {
|
|
|
400
413
|
* @returns StepLabelResultType or undefined.
|
|
401
414
|
* @example
|
|
402
415
|
* ```typescript
|
|
403
|
-
* narration.
|
|
416
|
+
* narration.jump(startLabel, yourParams).then((result) => {
|
|
404
417
|
* if (result) {
|
|
405
418
|
* // your code
|
|
406
419
|
* }
|
|
@@ -409,11 +422,15 @@ interface NarrationManagerInterface {
|
|
|
409
422
|
* @example
|
|
410
423
|
* ```typescript
|
|
411
424
|
* // if you use it in a step label you should return the result.
|
|
412
|
-
* return narration.
|
|
425
|
+
* return narration.jump(startLabel).then((result) => {
|
|
413
426
|
* return result
|
|
414
427
|
* })
|
|
415
428
|
* ```
|
|
416
429
|
*/
|
|
430
|
+
jump<T extends {}>(label: LabelAbstract<any, T> | LabelIdType, props: StepLabelPropsType<T>): Promise<StepLabelResultType>;
|
|
431
|
+
/**
|
|
432
|
+
* @deprecated use {@link jump} instead.
|
|
433
|
+
**/
|
|
417
434
|
jumpLabel<T extends {}>(label: LabelAbstract<any, T> | LabelIdType, props: StepLabelPropsType<T>): Promise<StepLabelResultType>;
|
|
418
435
|
/**
|
|
419
436
|
* Select a choice from the choice menu. and close the choice menu.
|
|
@@ -598,7 +615,7 @@ declare class NarrationManagerStatic {
|
|
|
598
615
|
* Number of requests to go to the next step.
|
|
599
616
|
* If it is > 0, after the stepsRunning is 0, the next step will be executed
|
|
600
617
|
*/
|
|
601
|
-
static
|
|
618
|
+
static continueRequests: number;
|
|
602
619
|
static choiceMadeTemp: undefined | number;
|
|
603
620
|
static lastHistoryStep: Omit<HistoryStep, "diff"> | null;
|
|
604
621
|
/**
|