@drincs/pixi-vn 1.8.1 → 1.8.2

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.
Files changed (35) hide show
  1. package/README.md +3 -47
  2. package/dist/{HistoryChoiceMenuOption-BP9Tsbyd.d.ts → HistoryChoiceMenuOption-CS41KG13.d.ts} +2 -2
  3. package/dist/{HistoryChoiceMenuOption-DSSNUXEq.d.cts → HistoryChoiceMenuOption-DdwePsOm.d.cts} +2 -2
  4. package/dist/{StorageElementType-DkJ394kq.d.cts → StorageElementType-C7ETezlL.d.cts} +1 -1
  5. package/dist/{StorageElementType-DkJ394kq.d.ts → StorageElementType-C7ETezlL.d.ts} +1 -1
  6. package/dist/{StoredClassModel-a4pvgJXD.d.ts → StoredClassModel-C9mQxPg-.d.cts} +9 -6
  7. package/dist/{StoredClassModel-LtyakzOw.d.cts → StoredClassModel-upXPNQTp.d.ts} +9 -6
  8. package/dist/characters.cjs +1 -1
  9. package/dist/characters.d.cts +54 -50
  10. package/dist/characters.d.ts +54 -50
  11. package/dist/characters.mjs +1 -1
  12. package/dist/chunk-K7JIC2F2.mjs +1 -0
  13. package/dist/{chunk-36I5IN5S.mjs → chunk-V34PMA2H.mjs} +1 -1
  14. package/dist/history.d.cts +2 -2
  15. package/dist/history.d.ts +2 -2
  16. package/dist/index.cjs +2 -2
  17. package/dist/index.d.cts +21 -6
  18. package/dist/index.d.ts +21 -6
  19. package/dist/index.mjs +2 -2
  20. package/dist/narration.d.cts +3 -3
  21. package/dist/narration.d.ts +3 -3
  22. package/dist/storage.cjs +1 -1
  23. package/dist/storage.d.cts +3 -3
  24. package/dist/storage.d.ts +3 -3
  25. package/dist/storage.mjs +1 -1
  26. package/dist/vite-listener.cjs +1 -1
  27. package/dist/vite-listener.d.cts +13 -4
  28. package/dist/vite-listener.d.ts +13 -4
  29. package/dist/vite-listener.mjs +1 -1
  30. package/dist/vite.cjs +1 -1
  31. package/dist/vite.d.cts +66 -36
  32. package/dist/vite.d.ts +66 -36
  33. package/dist/vite.mjs +1 -1
  34. package/package.json +14 -6
  35. package/dist/chunk-TTRUPDAB.mjs +0 -1
package/dist/index.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import {b as b$1,d,a,c,e,f as f$1,g}from'./chunk-TTRUPDAB.mjs';import*as nt 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 {PixiError,GameUnifier}from'@drincs/pixi-vn/core';export*from'@drincs/pixi-vn/core';import*as et from'@drincs/pixi-vn/history';export*from'@drincs/pixi-vn/history';import*as C from'@drincs/pixi-vn/narration';export*from'@drincs/pixi-vn/narration';import*as ut from'@drincs/pixi-vn/sound';export*from'@drincs/pixi-vn/sound';import*as G from'@drincs/pixi-vn/storage';export*from'@drincs/pixi-vn/storage';import {motion}from'@drincs/pixi-vn/motion';var de=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,Zt=new Set,jt=typeof process=="object"&&process?process:{},te=(m,e,i,s)=>{typeof jt.emitWarning=="function"?jt.emitWarning(m,e,i,s):console.error(`[${i}] ${e}: ${m}`);},Nt=globalThis.AbortController,Xt=globalThis.AbortSignal;if(typeof Nt>"u"){Xt=class{constructor(){b$1(this,"onabort");b$1(this,"_onabort",[]);b$1(this,"reason");b$1(this,"aborted",false);}addEventListener(i,s){this._onabort.push(s);}},Nt=class{constructor(){b$1(this,"signal",new Xt);e();}abort(i){if(!this.signal.aborted){this.signal.reason=i,this.signal.aborted=true;for(let s of this.signal._onabort)s(i);this.signal.onabort?.(i);}}};let m=jt.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{m&&(m=false,te("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 pe=m=>!Zt.has(m);var at=m=>m&&m===Math.floor(m)&&m>0&&isFinite(m),ee=m=>at(m)?m<=Math.pow(2,8)?Uint8Array:m<=Math.pow(2,16)?Uint16Array:m<=Math.pow(2,32)?Uint32Array:m<=Number.MAX_SAFE_INTEGER?Dt:null:null,Dt=class extends Array{constructor(m){super(m),this.fill(0);}},it,St,ue=(it=class{constructor(e,i){b$1(this,"heap");b$1(this,"length");if(!c(it,St))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new i(e),this.length=0;}static create(e$1){let i=ee(e$1);if(!i)return [];e(it,St,true);let s=new it(e$1,i);return e(it,St,false),s}push(e){this.heap[this.length++]=e;}pop(){return this.heap[--this.length]}},St=new WeakMap,d(it,St,false),it),Jt,Qt,K,M,q,ft,$,yt,xt,B,U,X,T,b,f,P,z,N,D,J,L,Q,Z,V,W,tt,dt,j,Et,l,Gt,mt,ot,Ot,Y,se,gt,wt,Tt,lt,ht,It,Lt,Ct,w,Mt,At,ct,zt,bt,ie=(bt=class{constructor(e$1){d(this,l);d(this,K);d(this,M);d(this,q);d(this,ft);d(this,$);d(this,yt);d(this,xt);d(this,B);b$1(this,"ttl");b$1(this,"ttlResolution");b$1(this,"ttlAutopurge");b$1(this,"updateAgeOnGet");b$1(this,"updateAgeOnHas");b$1(this,"allowStale");b$1(this,"noDisposeOnSet");b$1(this,"noUpdateTTL");b$1(this,"maxEntrySize");b$1(this,"sizeCalculation");b$1(this,"noDeleteOnFetchRejection");b$1(this,"noDeleteOnStaleGet");b$1(this,"allowStaleOnFetchAbort");b$1(this,"allowStaleOnFetchRejection");b$1(this,"ignoreFetchAbort");d(this,U);d(this,X);d(this,T);d(this,b);d(this,f);d(this,P);d(this,z);d(this,N);d(this,D);d(this,J);d(this,L);d(this,Q);d(this,Z);d(this,V);d(this,W);d(this,tt);d(this,dt);d(this,j);d(this,Et);d(this,mt,()=>{});d(this,ot,()=>{});d(this,Ot,()=>{});d(this,Y,()=>false);d(this,gt,e=>{});d(this,wt,(e,i,s)=>{});d(this,Tt,(e,i,s,r)=>{if(s||r)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});b$1(this,Jt,"LRUCache");let{max:i=0,ttl:s,ttlResolution:r=1,ttlAutopurge:n,updateAgeOnGet:o,updateAgeOnHas:h,allowStale:d$1,dispose:v,onInsert:R,disposeAfter:S,noDisposeOnSet:rt,noUpdateTTL:I,maxSize:k=0,maxEntrySize:A=0,sizeCalculation:y,fetchMethod:a,memoMethod:x,noDeleteOnFetchRejection:O,noDeleteOnStaleGet:u,allowStaleOnFetchRejection:g,allowStaleOnFetchAbort:F,ignoreFetchAbort:H,perf:_t}=e$1;if(_t!==void 0&&typeof _t?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(e(this,B,_t??de),i!==0&&!at(i))throw new TypeError("max option must be a nonnegative integer");let vt=i?ee(i):Array;if(!vt)throw new Error("invalid max value: "+i);if(e(this,K,i),e(this,M,k),this.maxEntrySize=A||c(this,M),this.sizeCalculation=y,this.sizeCalculation){if(!c(this,M)&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(x!==void 0&&typeof x!="function")throw new TypeError("memoMethod must be a function if defined");if(e(this,xt,x),a!==void 0&&typeof a!="function")throw new TypeError("fetchMethod must be a function if specified");if(e(this,yt,a),e(this,dt,!!a),e(this,T,new Map),e(this,b,new Array(i).fill(void 0)),e(this,f,new Array(i).fill(void 0)),e(this,P,new vt(i)),e(this,z,new vt(i)),e(this,N,0),e(this,D,0),e(this,J,ue.create(i)),e(this,U,0),e(this,X,0),typeof v=="function"&&e(this,q,v),typeof R=="function"&&e(this,ft,R),typeof S=="function"?(e(this,$,S),e(this,L,[])):(e(this,$,void 0),e(this,L,void 0)),e(this,tt,!!c(this,q)),e(this,Et,!!c(this,ft)),e(this,j,!!c(this,$)),this.noDisposeOnSet=!!rt,this.noUpdateTTL=!!I,this.noDeleteOnFetchRejection=!!O,this.allowStaleOnFetchRejection=!!g,this.allowStaleOnFetchAbort=!!F,this.ignoreFetchAbort=!!H,this.maxEntrySize!==0){if(c(this,M)!==0&&!at(c(this,M)))throw new TypeError("maxSize must be a positive integer if specified");if(!at(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");f$1(this,l,se).call(this);}if(this.allowStale=!!d$1,this.noDeleteOnStaleGet=!!u,this.updateAgeOnGet=!!o,this.updateAgeOnHas=!!h,this.ttlResolution=at(r)||r===0?r:1,this.ttlAutopurge=!!n,this.ttl=s||0,this.ttl){if(!at(this.ttl))throw new TypeError("ttl must be a positive integer if specified");f$1(this,l,Gt).call(this);}if(c(this,K)===0&&this.ttl===0&&c(this,M)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!c(this,K)&&!c(this,M)){let Pt="LRU_CACHE_UNBOUNDED";pe(Pt)&&(Zt.add(Pt),te("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",Pt,bt));}}get perf(){return c(this,B)}static unsafeExposeInternals(e){return {starts:c(e,Z),ttls:c(e,V),autopurgeTimers:c(e,W),sizes:c(e,Q),keyMap:c(e,T),keyList:c(e,b),valList:c(e,f),next:c(e,P),prev:c(e,z),get head(){return c(e,N)},get tail(){return c(e,D)},free:c(e,J),isBackgroundFetch:i=>{var s;return f$1(s=e,l,w).call(s,i)},backgroundFetch:(i,s,r,n)=>{var o;return f$1(o=e,l,Ct).call(o,i,s,r,n)},moveToTail:i=>{var s;return f$1(s=e,l,At).call(s,i)},indexes:i=>{var s;return f$1(s=e,l,lt).call(s,i)},rindexes:i=>{var s;return f$1(s=e,l,ht).call(s,i)},isStale:i=>{var s;return c(s=e,Y).call(s,i)}}}get max(){return c(this,K)}get maxSize(){return c(this,M)}get calculatedSize(){return c(this,X)}get size(){return c(this,U)}get fetchMethod(){return c(this,yt)}get memoMethod(){return c(this,xt)}get dispose(){return c(this,q)}get onInsert(){return c(this,ft)}get disposeAfter(){return c(this,$)}getRemainingTTL(e){return c(this,T).has(e)?1/0:0}*entries(){for(let e of f$1(this,l,lt).call(this))c(this,f)[e]!==void 0&&c(this,b)[e]!==void 0&&!f$1(this,l,w).call(this,c(this,f)[e])&&(yield [c(this,b)[e],c(this,f)[e]]);}*rentries(){for(let e of f$1(this,l,ht).call(this))c(this,f)[e]!==void 0&&c(this,b)[e]!==void 0&&!f$1(this,l,w).call(this,c(this,f)[e])&&(yield [c(this,b)[e],c(this,f)[e]]);}*keys(){for(let e of f$1(this,l,lt).call(this)){let i=c(this,b)[e];i!==void 0&&!f$1(this,l,w).call(this,c(this,f)[e])&&(yield i);}}*rkeys(){for(let e of f$1(this,l,ht).call(this)){let i=c(this,b)[e];i!==void 0&&!f$1(this,l,w).call(this,c(this,f)[e])&&(yield i);}}*values(){for(let e of f$1(this,l,lt).call(this))c(this,f)[e]!==void 0&&!f$1(this,l,w).call(this,c(this,f)[e])&&(yield c(this,f)[e]);}*rvalues(){for(let e of f$1(this,l,ht).call(this))c(this,f)[e]!==void 0&&!f$1(this,l,w).call(this,c(this,f)[e])&&(yield c(this,f)[e]);}[(Qt=Symbol.iterator,Jt=Symbol.toStringTag,Qt)](){return this.entries()}find(e,i={}){for(let s of f$1(this,l,lt).call(this)){let r=c(this,f)[s],n=f$1(this,l,w).call(this,r)?r.__staleWhileFetching:r;if(n!==void 0&&e(n,c(this,b)[s],this))return this.get(c(this,b)[s],i)}}forEach(e,i=this){for(let s of f$1(this,l,lt).call(this)){let r=c(this,f)[s],n=f$1(this,l,w).call(this,r)?r.__staleWhileFetching:r;n!==void 0&&e.call(i,n,c(this,b)[s],this);}}rforEach(e,i=this){for(let s of f$1(this,l,ht).call(this)){let r=c(this,f)[s],n=f$1(this,l,w).call(this,r)?r.__staleWhileFetching:r;n!==void 0&&e.call(i,n,c(this,b)[s],this);}}purgeStale(){let e=false;for(let i of f$1(this,l,ht).call(this,{allowStale:true}))c(this,Y).call(this,i)&&(f$1(this,l,ct).call(this,c(this,b)[i],"expire"),e=true);return e}info(e){let i=c(this,T).get(e);if(i===void 0)return;let s=c(this,f)[i],r=f$1(this,l,w).call(this,s)?s.__staleWhileFetching:s;if(r===void 0)return;let n={value:r};if(c(this,V)&&c(this,Z)){let o=c(this,V)[i],h=c(this,Z)[i];if(o&&h){let d=o-(c(this,B).now()-h);n.ttl=d,n.start=Date.now();}}return c(this,Q)&&(n.size=c(this,Q)[i]),n}dump(){let e=[];for(let i of f$1(this,l,lt).call(this,{allowStale:true})){let s=c(this,b)[i],r=c(this,f)[i],n=f$1(this,l,w).call(this,r)?r.__staleWhileFetching:r;if(n===void 0||s===void 0)continue;let o={value:n};if(c(this,V)&&c(this,Z)){o.ttl=c(this,V)[i];let h=c(this,B).now()-c(this,Z)[i];o.start=Math.floor(Date.now()-h);}c(this,Q)&&(o.size=c(this,Q)[i]),e.unshift([s,o]);}return e}load(e){this.clear();for(let[i,s]of e){if(s.start){let r=Date.now()-s.start;s.start=c(this,B).now()-r;}this.set(i,s.value,s);}}set(e$1,i,s={}){var rt,I,k,A;if(i===void 0)return this.delete(e$1),this;let{ttl:r=this.ttl,start:n,noDisposeOnSet:o=this.noDisposeOnSet,sizeCalculation:h=this.sizeCalculation,status:d}=s,{noUpdateTTL:v=this.noUpdateTTL}=s,R=c(this,Tt).call(this,e$1,i,s.size||0,h);if(this.maxEntrySize&&R>this.maxEntrySize)return d&&(d.set="miss",d.maxEntrySizeExceeded=true),f$1(this,l,ct).call(this,e$1,"set"),this;let S=c(this,U)===0?void 0:c(this,T).get(e$1);if(S===void 0)S=c(this,U)===0?c(this,D):c(this,J).length!==0?c(this,J).pop():c(this,U)===c(this,K)?f$1(this,l,Lt).call(this,false):c(this,U),c(this,b)[S]=e$1,c(this,f)[S]=i,c(this,T).set(e$1,S),c(this,P)[c(this,D)]=S,c(this,z)[S]=c(this,D),e(this,D,S),g(this,U)._++,c(this,wt).call(this,S,R,d),d&&(d.set="add"),v=false,c(this,Et)&&((rt=c(this,ft))==null||rt.call(this,i,e$1,"add"));else {f$1(this,l,At).call(this,S);let y=c(this,f)[S];if(i!==y){if(c(this,dt)&&f$1(this,l,w).call(this,y)){y.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:a}=y;a!==void 0&&!o&&(c(this,tt)&&((I=c(this,q))==null||I.call(this,a,e$1,"set")),c(this,j)&&c(this,L)?.push([a,e$1,"set"]));}else o||(c(this,tt)&&((k=c(this,q))==null||k.call(this,y,e$1,"set")),c(this,j)&&c(this,L)?.push([y,e$1,"set"]));if(c(this,gt).call(this,S),c(this,wt).call(this,S,R,d),c(this,f)[S]=i,d){d.set="replace";let a=y&&f$1(this,l,w).call(this,y)?y.__staleWhileFetching:y;a!==void 0&&(d.oldValue=a);}}else d&&(d.set="update");c(this,Et)&&this.onInsert?.(i,e$1,i===y?"update":"replace");}if(r!==0&&!c(this,V)&&f$1(this,l,Gt).call(this),c(this,V)&&(v||c(this,Ot).call(this,S,r,n),d&&c(this,ot).call(this,d,S)),!o&&c(this,j)&&c(this,L)){let y=c(this,L),a;for(;a=y?.shift();)(A=c(this,$))==null||A.call(this,...a);}return this}pop(){var e;try{for(;c(this,U);){let i=c(this,f)[c(this,N)];if(f$1(this,l,Lt).call(this,!0),f$1(this,l,w).call(this,i)){if(i.__staleWhileFetching)return i.__staleWhileFetching}else if(i!==void 0)return i}}finally{if(c(this,j)&&c(this,L)){let i=c(this,L),s;for(;s=i?.shift();)(e=c(this,$))==null||e.call(this,...s);}}}has(e,i={}){let{updateAgeOnHas:s=this.updateAgeOnHas,status:r}=i,n=c(this,T).get(e);if(n!==void 0){let o=c(this,f)[n];if(f$1(this,l,w).call(this,o)&&o.__staleWhileFetching===void 0)return false;if(c(this,Y).call(this,n))r&&(r.has="stale",c(this,ot).call(this,r,n));else return s&&c(this,mt).call(this,n),r&&(r.has="hit",c(this,ot).call(this,r,n)),true}else r&&(r.has="miss");return false}peek(e,i={}){let{allowStale:s=this.allowStale}=i,r=c(this,T).get(e);if(r===void 0||!s&&c(this,Y).call(this,r))return;let n=c(this,f)[r];return f$1(this,l,w).call(this,n)?n.__staleWhileFetching:n}async fetch(e,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,ttl:o=this.ttl,noDisposeOnSet:h=this.noDisposeOnSet,size:d=0,sizeCalculation:v=this.sizeCalculation,noUpdateTTL:R=this.noUpdateTTL,noDeleteOnFetchRejection:S=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:rt=this.allowStaleOnFetchRejection,ignoreFetchAbort:I=this.ignoreFetchAbort,allowStaleOnFetchAbort:k=this.allowStaleOnFetchAbort,context:A,forceRefresh:y=false,status:a,signal:x}=i;if(!c(this,dt))return a&&(a.fetch="get"),this.get(e,{allowStale:s,updateAgeOnGet:r,noDeleteOnStaleGet:n,status:a});let O={allowStale:s,updateAgeOnGet:r,noDeleteOnStaleGet:n,ttl:o,noDisposeOnSet:h,size:d,sizeCalculation:v,noUpdateTTL:R,noDeleteOnFetchRejection:S,allowStaleOnFetchRejection:rt,allowStaleOnFetchAbort:k,ignoreFetchAbort:I,status:a,signal:x},u=c(this,T).get(e);if(u===void 0){a&&(a.fetch="miss");let g=f$1(this,l,Ct).call(this,e,u,O,A);return g.__returned=g}else {let g=c(this,f)[u];if(f$1(this,l,w).call(this,g)){let vt=s&&g.__staleWhileFetching!==void 0;return a&&(a.fetch="inflight",vt&&(a.returnedStale=true)),vt?g.__staleWhileFetching:g.__returned=g}let F=c(this,Y).call(this,u);if(!y&&!F)return a&&(a.fetch="hit"),f$1(this,l,At).call(this,u),r&&c(this,mt).call(this,u),a&&c(this,ot).call(this,a,u),g;let H=f$1(this,l,Ct).call(this,e,u,O,A),_t=H.__staleWhileFetching!==void 0&&s;return a&&(a.fetch=F?"stale":"refresh",_t&&F&&(a.returnedStale=true)),_t?H.__staleWhileFetching:H.__returned=H}}async forceFetch(e,i={}){let s=await this.fetch(e,i);if(s===void 0)throw new Error("fetch() returned undefined");return s}memo(e,i={}){let s=c(this,xt);if(!s)throw new Error("no memoMethod provided to constructor");let{context:r,forceRefresh:n,...o}=i,h=this.get(e,o);if(!n&&h!==void 0)return h;let d=s(e,h,{options:o,context:r});return this.set(e,d,o),d}get(e,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,status:o}=i,h=c(this,T).get(e);if(h!==void 0){let d=c(this,f)[h],v=f$1(this,l,w).call(this,d);return o&&c(this,ot).call(this,o,h),c(this,Y).call(this,h)?(o&&(o.get="stale"),v?(o&&s&&d.__staleWhileFetching!==void 0&&(o.returnedStale=true),s?d.__staleWhileFetching:void 0):(n||f$1(this,l,ct).call(this,e,"expire"),o&&s&&(o.returnedStale=true),s?d:void 0)):(o&&(o.get="hit"),v?d.__staleWhileFetching:(f$1(this,l,At).call(this,h),r&&c(this,mt).call(this,h),d))}else o&&(o.get="miss");}delete(e){return f$1(this,l,ct).call(this,e,"delete")}clear(){return f$1(this,l,zt).call(this,"delete")}},K=new WeakMap,M=new WeakMap,q=new WeakMap,ft=new WeakMap,$=new WeakMap,yt=new WeakMap,xt=new WeakMap,B=new WeakMap,U=new WeakMap,X=new WeakMap,T=new WeakMap,b=new WeakMap,f=new WeakMap,P=new WeakMap,z=new WeakMap,N=new WeakMap,D=new WeakMap,J=new WeakMap,L=new WeakMap,Q=new WeakMap,Z=new WeakMap,V=new WeakMap,W=new WeakMap,tt=new WeakMap,dt=new WeakMap,j=new WeakMap,Et=new WeakMap,l=new WeakSet,Gt=function(){let e$1=new Dt(c(this,K)),i=new Dt(c(this,K));e(this,V,e$1),e(this,Z,i);let s=this.ttlAutopurge?new Array(c(this,K)):void 0;e(this,W,s),e(this,Ot,(h,d,v=c(this,B).now())=>{i[h]=d!==0?v:0,e$1[h]=d,r(h,d);}),e(this,mt,h=>{i[h]=e$1[h]!==0?c(this,B).now():0,r(h,e$1[h]);});let r=this.ttlAutopurge?(h,d)=>{if(s?.[h]&&(clearTimeout(s[h]),s[h]=void 0),d&&d!==0&&s){let v=setTimeout(()=>{c(this,Y).call(this,h)&&f$1(this,l,ct).call(this,c(this,b)[h],"expire");},d+1);v.unref&&v.unref(),s[h]=v;}}:()=>{};e(this,ot,(h,d)=>{if(e$1[d]){let v=e$1[d],R=i[d];if(!v||!R)return;h.ttl=v,h.start=R,h.now=n||o();let S=h.now-R;h.remainingTTL=v-S;}});let n=0,o=()=>{let h=c(this,B).now();if(this.ttlResolution>0){n=h;let d=setTimeout(()=>n=0,this.ttlResolution);d.unref&&d.unref();}return h};this.getRemainingTTL=h=>{let d=c(this,T).get(h);if(d===void 0)return 0;let v=e$1[d],R=i[d];if(!v||!R)return 1/0;let S=(n||o())-R;return v-S},e(this,Y,h=>{let d=i[h],v=e$1[h];return !!v&&!!d&&(n||o())-d>v});},mt=new WeakMap,ot=new WeakMap,Ot=new WeakMap,Y=new WeakMap,se=function(){let e$1=new Dt(c(this,K));e(this,X,0),e(this,Q,e$1),e(this,gt,i=>{e(this,X,c(this,X)-e$1[i]),e$1[i]=0;}),e(this,Tt,(i,s,r,n)=>{if(f$1(this,l,w).call(this,s))return 0;if(!at(r))if(n){if(typeof n!="function")throw new TypeError("sizeCalculation must be a function");if(r=n(s,i),!at(r))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return r}),e(this,wt,(i,s,r)=>{if(e$1[i]=s,c(this,M)){let n=c(this,M)-e$1[i];for(;c(this,X)>n;)f$1(this,l,Lt).call(this,true);}e(this,X,c(this,X)+e$1[i]),r&&(r.entrySize=s,r.totalCalculatedSize=c(this,X));});},gt=new WeakMap,wt=new WeakMap,Tt=new WeakMap,lt=function*({allowStale:e=this.allowStale}={}){if(c(this,U))for(let i=c(this,D);!(!f$1(this,l,It).call(this,i)||((e||!c(this,Y).call(this,i))&&(yield i),i===c(this,N)));)i=c(this,z)[i];},ht=function*({allowStale:e=this.allowStale}={}){if(c(this,U))for(let i=c(this,N);!(!f$1(this,l,It).call(this,i)||((e||!c(this,Y).call(this,i))&&(yield i),i===c(this,D)));)i=c(this,P)[i];},It=function(e){return e!==void 0&&c(this,T).get(c(this,b)[e])===e},Lt=function(e$1){var n;let i=c(this,N),s=c(this,b)[i],r=c(this,f)[i];return c(this,dt)&&f$1(this,l,w).call(this,r)?r.__abortController.abort(new Error("evicted")):(c(this,tt)||c(this,j))&&(c(this,tt)&&((n=c(this,q))==null||n.call(this,r,s,"evict")),c(this,j)&&c(this,L)?.push([r,s,"evict"])),c(this,gt).call(this,i),c(this,W)?.[i]&&(clearTimeout(c(this,W)[i]),c(this,W)[i]=void 0),e$1&&(c(this,b)[i]=void 0,c(this,f)[i]=void 0,c(this,J).push(i)),c(this,U)===1?(e(this,N,e(this,D,0)),c(this,J).length=0):e(this,N,c(this,P)[i]),c(this,T).delete(s),g(this,U)._--,i},Ct=function(e,i,s,r){let n=i===void 0?void 0:c(this,f)[i];if(f$1(this,l,w).call(this,n))return n;let o=new Nt,{signal:h}=s;h?.addEventListener("abort",()=>o.abort(h.reason),{signal:o.signal});let d={signal:o.signal,options:s,context:r},v=(A,y=false)=>{let{aborted:a}=o.signal,x=s.ignoreFetchAbort&&A!==void 0,O=s.ignoreFetchAbort||!!(s.allowStaleOnFetchAbort&&A!==void 0);if(s.status&&(a&&!y?(s.status.fetchAborted=true,s.status.fetchError=o.signal.reason,x&&(s.status.fetchAbortIgnored=true)):s.status.fetchResolved=true),a&&!x&&!y)return S(o.signal.reason,O);let u=I,g=c(this,f)[i];return (g===I||x&&y&&g===void 0)&&(A===void 0?u.__staleWhileFetching!==void 0?c(this,f)[i]=u.__staleWhileFetching:f$1(this,l,ct).call(this,e,"fetch"):(s.status&&(s.status.fetchUpdated=true),this.set(e,A,d.options))),A},R=A=>(s.status&&(s.status.fetchRejected=true,s.status.fetchError=A),S(A,false)),S=(A,y)=>{let{aborted:a}=o.signal,x=a&&s.allowStaleOnFetchAbort,O=x||s.allowStaleOnFetchRejection,u=O||s.noDeleteOnFetchRejection,g=I;if(c(this,f)[i]===I&&(!u||!y&&g.__staleWhileFetching===void 0?f$1(this,l,ct).call(this,e,"fetch"):x||(c(this,f)[i]=g.__staleWhileFetching)),O)return s.status&&g.__staleWhileFetching!==void 0&&(s.status.returnedStale=true),g.__staleWhileFetching;if(g.__returned===g)throw A},rt=(A,y)=>{var x;let a=(x=c(this,yt))==null?void 0:x.call(this,e,n,d);a&&a instanceof Promise&&a.then(O=>A(O===void 0?void 0:O),y),o.signal.addEventListener("abort",()=>{(!s.ignoreFetchAbort||s.allowStaleOnFetchAbort)&&(A(void 0),s.allowStaleOnFetchAbort&&(A=O=>v(O,true)));});};s.status&&(s.status.fetchDispatched=true);let I=new Promise(rt).then(v,R),k=Object.assign(I,{__abortController:o,__staleWhileFetching:n,__returned:void 0});return i===void 0?(this.set(e,k,{...d.options,status:void 0}),i=c(this,T).get(e)):c(this,f)[i]=k,k},w=function(e){if(!c(this,dt))return false;let i=e;return !!i&&i instanceof Promise&&i.hasOwnProperty("__staleWhileFetching")&&i.__abortController instanceof Nt},Mt=function(e,i){c(this,z)[i]=e,c(this,P)[e]=i;},At=function(e$1){e$1!==c(this,D)&&(e$1===c(this,N)?e(this,N,c(this,P)[e$1]):f$1(this,l,Mt).call(this,c(this,z)[e$1],c(this,P)[e$1]),f$1(this,l,Mt).call(this,c(this,D),e$1),e(this,D,e$1));},ct=function(e$1,i){var r,n;let s=false;if(c(this,U)!==0){let o=c(this,T).get(e$1);if(o!==void 0)if(c(this,W)?.[o]&&(clearTimeout(c(this,W)?.[o]),c(this,W)[o]=void 0),s=true,c(this,U)===1)f$1(this,l,zt).call(this,i);else {c(this,gt).call(this,o);let h=c(this,f)[o];if(f$1(this,l,w).call(this,h)?h.__abortController.abort(new Error("deleted")):(c(this,tt)||c(this,j))&&(c(this,tt)&&((r=c(this,q))==null||r.call(this,h,e$1,i)),c(this,j)&&c(this,L)?.push([h,e$1,i])),c(this,T).delete(e$1),c(this,b)[o]=void 0,c(this,f)[o]=void 0,o===c(this,D))e(this,D,c(this,z)[o]);else if(o===c(this,N))e(this,N,c(this,P)[o]);else {let d=c(this,z)[o];c(this,P)[d]=c(this,P)[o];let v=c(this,P)[o];c(this,z)[v]=c(this,z)[o];}g(this,U)._--,c(this,J).push(o);}}if(c(this,j)&&c(this,L)?.length){let o=c(this,L),h;for(;h=o?.shift();)(n=c(this,$))==null||n.call(this,...h);}return s},zt=function(e$1){var i,s;for(let r of f$1(this,l,ht).call(this,{allowStale:true})){let n=c(this,f)[r];if(f$1(this,l,w).call(this,n))n.__abortController.abort(new Error("deleted"));else {let o=c(this,b)[r];c(this,tt)&&((i=c(this,q))==null||i.call(this,n,o,e$1)),c(this,j)&&c(this,L)?.push([n,o,e$1]);}}if(c(this,T).clear(),c(this,f).fill(void 0),c(this,b).fill(void 0),c(this,V)&&c(this,Z)){c(this,V).fill(0),c(this,Z).fill(0);for(let r of c(this,W)??[])r!==void 0&&clearTimeout(r);c(this,W)?.fill(void 0);}if(c(this,Q)&&c(this,Q).fill(0),e(this,N,0),e(this,D,0),c(this,J).length=0,e(this,X,0),e(this,U,0),c(this,j)&&c(this,L)){let r=c(this,L),n;for(;n=r?.shift();)(s=c(this,$))==null||s.call(this,...n);}},bt);var Ft=class{constructor(e){b$1(this,"cache");b$1(this,"map",new Map);this.cache=new ie({max:e.cacheSize}),this.map=new Map;}get[Symbol.iterator](){return this.map[Symbol.iterator]}get[Symbol.toStringTag](){return this.map[Symbol.toStringTag]}clear(){this.cache.clear(),this.map.clear();}delete(e){let i=this.map.delete(e);return i&&this.cache.delete(e),i}get forEach(){return this.map.forEach}get(e){let i=this.cache.get(e);return i||this.map.get(e)}has(e){return this.map.has(e)}set(e,i){return this.map.set(e,i),this.cache.set(e,i),this}get size(){return this.map.size}entries(){return this.map.entries()}keys(){return this.map.keys()}values(){return this.map.values()}};var Ut="1.8.1";var Vt={version:Ut};var Wt="repeat";function Yt(m){return {type:"pause",duration:m}}var Ht="__game_layer__";var fe={CURRENT_DIALOGUE_MEMORY_KEY:"dialogue",LAST_DIALOGUE_ADDED_IN_STEP_MEMORY_KEY:"dialogue:step_counter",CURRENT_MENU_OPTIONS_MEMORY_KEY:"choice:options",LAST_MENU_OPTIONS_ADDED_IN_STEP_MEMORY_KEY:"choice:step_counter",CURRENT_INPUT_VALUE_MEMORY_KEY:"input:value",LAST_INPUT_ADDED_IN_STEP_MEMORY_KEY:"input:step_counter",CURRENT_INPUT_INFO_MEMORY_KEY:"input:info",CHARACTER_CATEGORY_KEY:"character",ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY:"___glue___",OPENED_LABELS_COUNTER_KEY:"label:opened",ALL_CHOICES_MADE_KEY:"choices:made",CURRENT_STEP_TIMES_COUNTER_KEY:"label:history",LAST_STEP_GLUED:"glue:last_step"};var oe={};var Kt={};a(Kt,{createExportableElement:()=>ne});var pt;(r=>(r.log=(n,...o)=>console.log(`[Pixi\u2019VN] ${n}`,...o),r.warn=(n,...o)=>console.warn(`[Pixi\u2019VN] ${n}`,...o),r.error=(n,...o)=>console.error(`[Pixi\u2019VN] ${n}`,...o),r.info=(n,...o)=>console.info(`[Pixi\u2019VN] ${n}`,...o)))(pt||(pt={}));function ne(m){try{if(typeof m>"u")return m;let e=JSON.stringify(m);return JSON.parse(e)}catch(e){throw pt.error("Error creating exportable element",m,e),new PixiError("not_json_serializable","Error creating exportable element")}}var ge=typeof window<"u"&&typeof document<"u",ae=[" _______ _ _ _ ____ ____ ____ _____ ","|_ __ \\ (_) (_) | | |_ _| |_ _||_ \\|_ _|"," | |__) |__ _ __ __ \\_| \\ \\ / / | \\ | | "," | ___/[ | [ \\ [ ][ | \\ \\ / / | |\\ \\| | "," _| |_ | | > ' < | | \\ ' / _| |_\\ |_ ",`|_____| [___][__]\`\\_][___] \\_/ |_____|\\____| v${Vt.version}`],le=31,_e="background:#2f90da;color:#fff;font-weight:bold;",ve="background:#c832bb;color:#fff;font-weight:bold;",Se="background:transparent;font-weight:bold;",kt=` v${Vt.version}`;function he(){if(!ge)return;let m=[],e=[];for(let i=0;i<ae.length;i++){let s=ae[i],r=s.endsWith(kt),n=r?s.slice(0,-kt.length):s,o=n.slice(0,le),h=n.slice(le),d=r?"%c%s%c%s%c%s":"%c%s%c%s";m.push(d),e.push(_e,o,ve,h),r&&e.push(Se,kt);}console.info(m.join(`
2
- `),...e);}function qt(){let m=window.location.pathname+window.location.hash;return m.includes("#")&&(m=m.split("#")[1]),m}he();var $t;(y=>{async function m(a,x,O){if(GameUnifier.init({navigate:x?.navigate,getCurrentGameStepState:()=>{let u={};try{u=nt.canvas.export();}catch{}return {path:qt(),storage:G.storage.export(),canvas:u,sound:ut.sound.export(),labelIndex:C.NarrationManagerStatic.currentLabelStepIndex||0,openedLabels:C.narration.openedLabels}},restoreGameStepState:async(u,g)=>{et.HistoryManagerStatic._originalStepData=u,C.NarrationManagerStatic.openedLabels=u.openedLabels,G.storage.restore(u.storage);try{await nt.canvas.restore(u.canvas),await ut.sound.restore(u.sound);}catch(F){pt.error("Error restoring game step state:",F);}await g(u.path);},getStepCounter:()=>C.narration.stepCounter,setStepCounter:u=>{C.NarrationManagerStatic._stepCounter=u;},getOpenedLabels:()=>C.narration.openedLabels.length,addHistoryItem:(u,g)=>et.stepHistory.add(u,g),getCharacter:u=>Bt.RegisteredCharacters.get(u),processNavigationRequests:(u,g)=>{let F=u,H=Promise.resolve();return u>0?(F--,H=C.narration.continue(g)):u<0&&(F=0,H=et.stepHistory.back(g,{steps:u*-1})),{newValue:F,result:H}},animate:(u,g,F,H)=>motion.animate(u,g,F,H),getVariable:(u,g)=>G.StorageRegistry.getVariable(u,g),setVariable:(u,g,F)=>G.StorageRegistry.setVariable(u,g,F),removeVariable:(u,g)=>G.StorageRegistry.removeVariable(u,g),getFlag:u=>G.storage.getFlag(u),setFlag:(u,g)=>G.storage.setFlag(u,g),onLabelClosing:u=>G.StorageRegistry.clearOldTempVariables(u)}),!a||!x){pt.warn("The canvas element or options are not defined. The canvas will not be initialized.");return}return await nt.canvas.init(a,x,O)}y.init=m;function e(){G.storage.clear();try{nt.canvas.clear();}catch{}ut.sound.clear(),C.narration.clear(),et.stepHistory.clear();}y.clear=e;function i(){let a={};try{a=nt.canvas.export();}catch{}return {pixivn_version:Ut,stepData:C.narration.export(),storageData:G.storage.export(),canvasData:a,soundData:ut.sound.export(),historyData:et.stepHistory.export(),path:qt()}}y.exportGameState=i;async function s(a,x){et.stepHistory.restore(a.historyData);let O=et.stepHistory.lastKey;if(typeof O=="number"){let u=et.stepHistory.stepsInfoMap.get(O)||null;await C.narration.restore(a.stepData,u);}G.storage.restore(a.storageData);try{await nt.canvas.restore(a.canvasData),await ut.sound.restore(a.soundData);}catch{}x?await x(a.path):await GameUnifier.navigate(a.path);}y.restoreGameState=s;async function r(a,x){return y.clear(),await C.narration.call(a,x)}y.start=r;function n(a){return JSON.parse(a)}y.jsonToGameState=n;function o(a){GameUnifier.onEnd=a;}y.onEnd=o;function h(a){return pt.warn("Game.onError is deprecated. Use Game.addOnError / Game.removeOnError to register multiple handlers."),GameUnifier.addOnError((x,O)=>a("step",x,O))}y.onError=h;function d(a){return GameUnifier.addOnError(a)}y.addOnError=d;function v(a){return GameUnifier.removeOnError(a)}y.removeOnError=v;function R(a){C.NarrationManagerStatic.onStepStart=a;}y.onStepStart=R;function S(a){C.NarrationManagerStatic.onLoadingLabel=a;}y.onLoadingLabel=S;function rt(a){C.NarrationManagerStatic.onStepEnd=a;}y.onStepEnd=rt;function I(a){GameUnifier.navigate=a;}y.onNavigate=I;function k(a){return GameUnifier.addOnPreContinue(a)}y.addOnPreContinue=k;function A(a){return GameUnifier.removeOnPreContinue(a)}y.removeOnPreContinue=A;})($t||($t={}));var $e={characterUtils:Bt,canvasUtils:nt,narrationUtils:C,soundUtils:ut,CANVAS_APP_GAME_LAYER_ALIAS:Ht,Pause:Yt,Repeat:Wt,PIXIVN_VERSION:Ut,...Kt,...oe,canvas:nt.canvas,narration:C.narration,sound:ut.sound,storage:G.storage,history:et.stepHistory,Game:$t,GameUnifier:GameUnifier};export{Ht as CANVAS_APP_GAME_LAYER_ALIAS,Ft as CachedMap,$t as Game,Ut as PIXIVN_VERSION,Yt as Pause,Wt as Repeat,fe as SYSTEM_RESERVED_STORAGE_KEYS,ne as createExportableElement,$e as default};
1
+ import {d,f as f$1,b as b$1,e,g,h,i}from'./chunk-K7JIC2F2.mjs';import*as nt 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 {PixiError,GameUnifier}from'@drincs/pixi-vn/core';export*from'@drincs/pixi-vn/core';import*as et from'@drincs/pixi-vn/history';export*from'@drincs/pixi-vn/history';import*as C from'@drincs/pixi-vn/narration';export*from'@drincs/pixi-vn/narration';import*as ut from'@drincs/pixi-vn/sound';export*from'@drincs/pixi-vn/sound';import*as G from'@drincs/pixi-vn/storage';export*from'@drincs/pixi-vn/storage';import {motion}from'@drincs/pixi-vn/motion';var de=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,Zt=new Set,jt=typeof process=="object"&&process?process:{},te=(m,e,i,s)=>{typeof jt.emitWarning=="function"?jt.emitWarning(m,e,i,s):console.error(`[${i}] ${e}: ${m}`);},Nt=globalThis.AbortController,Xt=globalThis.AbortSignal;if(typeof Nt>"u"){Xt=class{constructor(){d(this,"onabort");d(this,"_onabort",[]);d(this,"reason");d(this,"aborted",false);}addEventListener(i,s){this._onabort.push(s);}},Nt=class{constructor(){d(this,"signal",new Xt);e();}abort(i){if(!this.signal.aborted){this.signal.reason=i,this.signal.aborted=true;for(let s of this.signal._onabort)s(i);this.signal.onabort?.(i);}}};let m=jt.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{m&&(m=false,te("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 pe=m=>!Zt.has(m);var at=m=>m&&m===Math.floor(m)&&m>0&&isFinite(m),ee=m=>at(m)?m<=Math.pow(2,8)?Uint8Array:m<=Math.pow(2,16)?Uint16Array:m<=Math.pow(2,32)?Uint32Array:m<=Number.MAX_SAFE_INTEGER?Dt:null:null,Dt=class extends Array{constructor(m){super(m),this.fill(0);}},it,St,ue=(it=class{constructor(e$1,i){d(this,"heap");d(this,"length");if(!e(it,St))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new i(e$1),this.length=0;}static create(e){let i=ee(e);if(!i)return [];g(it,St,true);let s=new it(e,i);return g(it,St,false),s}push(e){this.heap[this.length++]=e;}pop(){return this.heap[--this.length]}},St=new WeakMap,f$1(it,St,false),it),Jt,Qt,K,M,q,ft,$,yt,xt,B,U,X,T,w,f,P,z,N,D,J,L,Q,Z,V,W,tt,dt,j,Et,l,Gt,mt,ot,Ot,Y,se,gt,bt,Tt,lt,ht,It,Lt,Ct,b,Mt,At,ct,zt,wt,ie=(wt=class{constructor(e$1){f$1(this,l);f$1(this,K);f$1(this,M);f$1(this,q);f$1(this,ft);f$1(this,$);f$1(this,yt);f$1(this,xt);f$1(this,B);d(this,"ttl");d(this,"ttlResolution");d(this,"ttlAutopurge");d(this,"updateAgeOnGet");d(this,"updateAgeOnHas");d(this,"allowStale");d(this,"noDisposeOnSet");d(this,"noUpdateTTL");d(this,"maxEntrySize");d(this,"sizeCalculation");d(this,"noDeleteOnFetchRejection");d(this,"noDeleteOnStaleGet");d(this,"allowStaleOnFetchAbort");d(this,"allowStaleOnFetchRejection");d(this,"ignoreFetchAbort");f$1(this,U);f$1(this,X);f$1(this,T);f$1(this,w);f$1(this,f);f$1(this,P);f$1(this,z);f$1(this,N);f$1(this,D);f$1(this,J);f$1(this,L);f$1(this,Q);f$1(this,Z);f$1(this,V);f$1(this,W);f$1(this,tt);f$1(this,dt);f$1(this,j);f$1(this,Et);f$1(this,mt,()=>{});f$1(this,ot,()=>{});f$1(this,Ot,()=>{});f$1(this,Y,()=>false);f$1(this,gt,e=>{});f$1(this,bt,(e,i,s)=>{});f$1(this,Tt,(e,i,s,r)=>{if(s||r)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});d(this,Jt,"LRUCache");let{max:i=0,ttl:s,ttlResolution:r=1,ttlAutopurge:n,updateAgeOnGet:o,updateAgeOnHas:h$1,allowStale:d$1,dispose:v,onInsert:R,disposeAfter:S,noDisposeOnSet:rt,noUpdateTTL:I,maxSize:k=0,maxEntrySize:A=0,sizeCalculation:y,fetchMethod:a,memoMethod:x,noDeleteOnFetchRejection:O,noDeleteOnStaleGet:u,allowStaleOnFetchRejection:g$1,allowStaleOnFetchAbort:F,ignoreFetchAbort:H,perf:_t}=e$1;if(_t!==void 0&&typeof _t?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(g(this,B,_t??de),i!==0&&!at(i))throw new TypeError("max option must be a nonnegative integer");let vt=i?ee(i):Array;if(!vt)throw new Error("invalid max value: "+i);if(g(this,K,i),g(this,M,k),this.maxEntrySize=A||e(this,M),this.sizeCalculation=y,this.sizeCalculation){if(!e(this,M)&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(x!==void 0&&typeof x!="function")throw new TypeError("memoMethod must be a function if defined");if(g(this,xt,x),a!==void 0&&typeof a!="function")throw new TypeError("fetchMethod must be a function if specified");if(g(this,yt,a),g(this,dt,!!a),g(this,T,new Map),g(this,w,new Array(i).fill(void 0)),g(this,f,new Array(i).fill(void 0)),g(this,P,new vt(i)),g(this,z,new vt(i)),g(this,N,0),g(this,D,0),g(this,J,ue.create(i)),g(this,U,0),g(this,X,0),typeof v=="function"&&g(this,q,v),typeof R=="function"&&g(this,ft,R),typeof S=="function"?(g(this,$,S),g(this,L,[])):(g(this,$,void 0),g(this,L,void 0)),g(this,tt,!!e(this,q)),g(this,Et,!!e(this,ft)),g(this,j,!!e(this,$)),this.noDisposeOnSet=!!rt,this.noUpdateTTL=!!I,this.noDeleteOnFetchRejection=!!O,this.allowStaleOnFetchRejection=!!g$1,this.allowStaleOnFetchAbort=!!F,this.ignoreFetchAbort=!!H,this.maxEntrySize!==0){if(e(this,M)!==0&&!at(e(this,M)))throw new TypeError("maxSize must be a positive integer if specified");if(!at(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");h(this,l,se).call(this);}if(this.allowStale=!!d$1,this.noDeleteOnStaleGet=!!u,this.updateAgeOnGet=!!o,this.updateAgeOnHas=!!h$1,this.ttlResolution=at(r)||r===0?r:1,this.ttlAutopurge=!!n,this.ttl=s||0,this.ttl){if(!at(this.ttl))throw new TypeError("ttl must be a positive integer if specified");h(this,l,Gt).call(this);}if(e(this,K)===0&&this.ttl===0&&e(this,M)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!e(this,K)&&!e(this,M)){let Pt="LRU_CACHE_UNBOUNDED";pe(Pt)&&(Zt.add(Pt),te("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",Pt,wt));}}get perf(){return e(this,B)}static unsafeExposeInternals(e$1){return {starts:e(e$1,Z),ttls:e(e$1,V),autopurgeTimers:e(e$1,W),sizes:e(e$1,Q),keyMap:e(e$1,T),keyList:e(e$1,w),valList:e(e$1,f),next:e(e$1,P),prev:e(e$1,z),get head(){return e(e$1,N)},get tail(){return e(e$1,D)},free:e(e$1,J),isBackgroundFetch:i=>{var s;return h(s=e$1,l,b).call(s,i)},backgroundFetch:(i,s,r,n)=>{var o;return h(o=e$1,l,Ct).call(o,i,s,r,n)},moveToTail:i=>{var s;return h(s=e$1,l,At).call(s,i)},indexes:i=>{var s;return h(s=e$1,l,lt).call(s,i)},rindexes:i=>{var s;return h(s=e$1,l,ht).call(s,i)},isStale:i=>{var s;return e(s=e$1,Y).call(s,i)}}}get max(){return e(this,K)}get maxSize(){return e(this,M)}get calculatedSize(){return e(this,X)}get size(){return e(this,U)}get fetchMethod(){return e(this,yt)}get memoMethod(){return e(this,xt)}get dispose(){return e(this,q)}get onInsert(){return e(this,ft)}get disposeAfter(){return e(this,$)}getRemainingTTL(e$1){return e(this,T).has(e$1)?1/0:0}*entries(){for(let e$1 of h(this,l,lt).call(this))e(this,f)[e$1]!==void 0&&e(this,w)[e$1]!==void 0&&!h(this,l,b).call(this,e(this,f)[e$1])&&(yield [e(this,w)[e$1],e(this,f)[e$1]]);}*rentries(){for(let e$1 of h(this,l,ht).call(this))e(this,f)[e$1]!==void 0&&e(this,w)[e$1]!==void 0&&!h(this,l,b).call(this,e(this,f)[e$1])&&(yield [e(this,w)[e$1],e(this,f)[e$1]]);}*keys(){for(let e$1 of h(this,l,lt).call(this)){let i=e(this,w)[e$1];i!==void 0&&!h(this,l,b).call(this,e(this,f)[e$1])&&(yield i);}}*rkeys(){for(let e$1 of h(this,l,ht).call(this)){let i=e(this,w)[e$1];i!==void 0&&!h(this,l,b).call(this,e(this,f)[e$1])&&(yield i);}}*values(){for(let e$1 of h(this,l,lt).call(this))e(this,f)[e$1]!==void 0&&!h(this,l,b).call(this,e(this,f)[e$1])&&(yield e(this,f)[e$1]);}*rvalues(){for(let e$1 of h(this,l,ht).call(this))e(this,f)[e$1]!==void 0&&!h(this,l,b).call(this,e(this,f)[e$1])&&(yield e(this,f)[e$1]);}[(Qt=Symbol.iterator,Jt=Symbol.toStringTag,Qt)](){return this.entries()}find(e$1,i={}){for(let s of h(this,l,lt).call(this)){let r=e(this,f)[s],n=h(this,l,b).call(this,r)?r.__staleWhileFetching:r;if(n!==void 0&&e$1(n,e(this,w)[s],this))return this.get(e(this,w)[s],i)}}forEach(e$1,i=this){for(let s of h(this,l,lt).call(this)){let r=e(this,f)[s],n=h(this,l,b).call(this,r)?r.__staleWhileFetching:r;n!==void 0&&e$1.call(i,n,e(this,w)[s],this);}}rforEach(e$1,i=this){for(let s of h(this,l,ht).call(this)){let r=e(this,f)[s],n=h(this,l,b).call(this,r)?r.__staleWhileFetching:r;n!==void 0&&e$1.call(i,n,e(this,w)[s],this);}}purgeStale(){let e$1=false;for(let i of h(this,l,ht).call(this,{allowStale:true}))e(this,Y).call(this,i)&&(h(this,l,ct).call(this,e(this,w)[i],"expire"),e$1=true);return e$1}info(e$1){let i=e(this,T).get(e$1);if(i===void 0)return;let s=e(this,f)[i],r=h(this,l,b).call(this,s)?s.__staleWhileFetching:s;if(r===void 0)return;let n={value:r};if(e(this,V)&&e(this,Z)){let o=e(this,V)[i],h=e(this,Z)[i];if(o&&h){let d=o-(e(this,B).now()-h);n.ttl=d,n.start=Date.now();}}return e(this,Q)&&(n.size=e(this,Q)[i]),n}dump(){let e$1=[];for(let i of h(this,l,lt).call(this,{allowStale:true})){let s=e(this,w)[i],r=e(this,f)[i],n=h(this,l,b).call(this,r)?r.__staleWhileFetching:r;if(n===void 0||s===void 0)continue;let o={value:n};if(e(this,V)&&e(this,Z)){o.ttl=e(this,V)[i];let h=e(this,B).now()-e(this,Z)[i];o.start=Math.floor(Date.now()-h);}e(this,Q)&&(o.size=e(this,Q)[i]),e$1.unshift([s,o]);}return e$1}load(e$1){this.clear();for(let[i,s]of e$1){if(s.start){let r=Date.now()-s.start;s.start=e(this,B).now()-r;}this.set(i,s.value,s);}}set(e$1,i$1,s={}){var rt,I,k,A;if(i$1===void 0)return this.delete(e$1),this;let{ttl:r=this.ttl,start:n,noDisposeOnSet:o=this.noDisposeOnSet,sizeCalculation:h$1=this.sizeCalculation,status:d}=s,{noUpdateTTL:v=this.noUpdateTTL}=s,R=e(this,Tt).call(this,e$1,i$1,s.size||0,h$1);if(this.maxEntrySize&&R>this.maxEntrySize)return d&&(d.set="miss",d.maxEntrySizeExceeded=true),h(this,l,ct).call(this,e$1,"set"),this;let S=e(this,U)===0?void 0:e(this,T).get(e$1);if(S===void 0)S=e(this,U)===0?e(this,D):e(this,J).length!==0?e(this,J).pop():e(this,U)===e(this,K)?h(this,l,Lt).call(this,false):e(this,U),e(this,w)[S]=e$1,e(this,f)[S]=i$1,e(this,T).set(e$1,S),e(this,P)[e(this,D)]=S,e(this,z)[S]=e(this,D),g(this,D,S),i(this,U)._++,e(this,bt).call(this,S,R,d),d&&(d.set="add"),v=false,e(this,Et)&&((rt=e(this,ft))==null||rt.call(this,i$1,e$1,"add"));else {h(this,l,At).call(this,S);let y=e(this,f)[S];if(i$1!==y){if(e(this,dt)&&h(this,l,b).call(this,y)){y.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:a}=y;a!==void 0&&!o&&(e(this,tt)&&((I=e(this,q))==null||I.call(this,a,e$1,"set")),e(this,j)&&e(this,L)?.push([a,e$1,"set"]));}else o||(e(this,tt)&&((k=e(this,q))==null||k.call(this,y,e$1,"set")),e(this,j)&&e(this,L)?.push([y,e$1,"set"]));if(e(this,gt).call(this,S),e(this,bt).call(this,S,R,d),e(this,f)[S]=i$1,d){d.set="replace";let a=y&&h(this,l,b).call(this,y)?y.__staleWhileFetching:y;a!==void 0&&(d.oldValue=a);}}else d&&(d.set="update");e(this,Et)&&this.onInsert?.(i$1,e$1,i$1===y?"update":"replace");}if(r!==0&&!e(this,V)&&h(this,l,Gt).call(this),e(this,V)&&(v||e(this,Ot).call(this,S,r,n),d&&e(this,ot).call(this,d,S)),!o&&e(this,j)&&e(this,L)){let y=e(this,L),a;for(;a=y?.shift();)(A=e(this,$))==null||A.call(this,...a);}return this}pop(){var e$1;try{for(;e(this,U);){let i=e(this,f)[e(this,N)];if(h(this,l,Lt).call(this,!0),h(this,l,b).call(this,i)){if(i.__staleWhileFetching)return i.__staleWhileFetching}else if(i!==void 0)return i}}finally{if(e(this,j)&&e(this,L)){let i=e(this,L),s;for(;s=i?.shift();)(e$1=e(this,$))==null||e$1.call(this,...s);}}}has(e$1,i={}){let{updateAgeOnHas:s=this.updateAgeOnHas,status:r}=i,n=e(this,T).get(e$1);if(n!==void 0){let o=e(this,f)[n];if(h(this,l,b).call(this,o)&&o.__staleWhileFetching===void 0)return false;if(e(this,Y).call(this,n))r&&(r.has="stale",e(this,ot).call(this,r,n));else return s&&e(this,mt).call(this,n),r&&(r.has="hit",e(this,ot).call(this,r,n)),true}else r&&(r.has="miss");return false}peek(e$1,i={}){let{allowStale:s=this.allowStale}=i,r=e(this,T).get(e$1);if(r===void 0||!s&&e(this,Y).call(this,r))return;let n=e(this,f)[r];return h(this,l,b).call(this,n)?n.__staleWhileFetching:n}async fetch(e$1,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,ttl:o=this.ttl,noDisposeOnSet:h$1=this.noDisposeOnSet,size:d=0,sizeCalculation:v=this.sizeCalculation,noUpdateTTL:R=this.noUpdateTTL,noDeleteOnFetchRejection:S=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:rt=this.allowStaleOnFetchRejection,ignoreFetchAbort:I=this.ignoreFetchAbort,allowStaleOnFetchAbort:k=this.allowStaleOnFetchAbort,context:A,forceRefresh:y=false,status:a,signal:x}=i;if(!e(this,dt))return a&&(a.fetch="get"),this.get(e$1,{allowStale:s,updateAgeOnGet:r,noDeleteOnStaleGet:n,status:a});let O={allowStale:s,updateAgeOnGet:r,noDeleteOnStaleGet:n,ttl:o,noDisposeOnSet:h$1,size:d,sizeCalculation:v,noUpdateTTL:R,noDeleteOnFetchRejection:S,allowStaleOnFetchRejection:rt,allowStaleOnFetchAbort:k,ignoreFetchAbort:I,status:a,signal:x},u=e(this,T).get(e$1);if(u===void 0){a&&(a.fetch="miss");let g=h(this,l,Ct).call(this,e$1,u,O,A);return g.__returned=g}else {let g=e(this,f)[u];if(h(this,l,b).call(this,g)){let vt=s&&g.__staleWhileFetching!==void 0;return a&&(a.fetch="inflight",vt&&(a.returnedStale=true)),vt?g.__staleWhileFetching:g.__returned=g}let F=e(this,Y).call(this,u);if(!y&&!F)return a&&(a.fetch="hit"),h(this,l,At).call(this,u),r&&e(this,mt).call(this,u),a&&e(this,ot).call(this,a,u),g;let H=h(this,l,Ct).call(this,e$1,u,O,A),_t=H.__staleWhileFetching!==void 0&&s;return a&&(a.fetch=F?"stale":"refresh",_t&&F&&(a.returnedStale=true)),_t?H.__staleWhileFetching:H.__returned=H}}async forceFetch(e,i={}){let s=await this.fetch(e,i);if(s===void 0)throw new Error("fetch() returned undefined");return s}memo(e$1,i={}){let s=e(this,xt);if(!s)throw new Error("no memoMethod provided to constructor");let{context:r,forceRefresh:n,...o}=i,h=this.get(e$1,o);if(!n&&h!==void 0)return h;let d=s(e$1,h,{options:o,context:r});return this.set(e$1,d,o),d}get(e$1,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,status:o}=i,h$1=e(this,T).get(e$1);if(h$1!==void 0){let d=e(this,f)[h$1],v=h(this,l,b).call(this,d);return o&&e(this,ot).call(this,o,h$1),e(this,Y).call(this,h$1)?(o&&(o.get="stale"),v?(o&&s&&d.__staleWhileFetching!==void 0&&(o.returnedStale=true),s?d.__staleWhileFetching:void 0):(n||h(this,l,ct).call(this,e$1,"expire"),o&&s&&(o.returnedStale=true),s?d:void 0)):(o&&(o.get="hit"),v?d.__staleWhileFetching:(h(this,l,At).call(this,h$1),r&&e(this,mt).call(this,h$1),d))}else o&&(o.get="miss");}delete(e){return h(this,l,ct).call(this,e,"delete")}clear(){return h(this,l,zt).call(this,"delete")}},K=new WeakMap,M=new WeakMap,q=new WeakMap,ft=new WeakMap,$=new WeakMap,yt=new WeakMap,xt=new WeakMap,B=new WeakMap,U=new WeakMap,X=new WeakMap,T=new WeakMap,w=new WeakMap,f=new WeakMap,P=new WeakMap,z=new WeakMap,N=new WeakMap,D=new WeakMap,J=new WeakMap,L=new WeakMap,Q=new WeakMap,Z=new WeakMap,V=new WeakMap,W=new WeakMap,tt=new WeakMap,dt=new WeakMap,j=new WeakMap,Et=new WeakMap,l=new WeakSet,Gt=function(){let e$1=new Dt(e(this,K)),i=new Dt(e(this,K));g(this,V,e$1),g(this,Z,i);let s=this.ttlAutopurge?new Array(e(this,K)):void 0;g(this,W,s),g(this,Ot,(h,d,v=e(this,B).now())=>{i[h]=d!==0?v:0,e$1[h]=d,r(h,d);}),g(this,mt,h=>{i[h]=e$1[h]!==0?e(this,B).now():0,r(h,e$1[h]);});let r=this.ttlAutopurge?(h$1,d)=>{if(s?.[h$1]&&(clearTimeout(s[h$1]),s[h$1]=void 0),d&&d!==0&&s){let v=setTimeout(()=>{e(this,Y).call(this,h$1)&&h(this,l,ct).call(this,e(this,w)[h$1],"expire");},d+1);v.unref&&v.unref(),s[h$1]=v;}}:()=>{};g(this,ot,(h,d)=>{if(e$1[d]){let v=e$1[d],R=i[d];if(!v||!R)return;h.ttl=v,h.start=R,h.now=n||o();let S=h.now-R;h.remainingTTL=v-S;}});let n=0,o=()=>{let h=e(this,B).now();if(this.ttlResolution>0){n=h;let d=setTimeout(()=>n=0,this.ttlResolution);d.unref&&d.unref();}return h};this.getRemainingTTL=h=>{let d=e(this,T).get(h);if(d===void 0)return 0;let v=e$1[d],R=i[d];if(!v||!R)return 1/0;let S=(n||o())-R;return v-S},g(this,Y,h=>{let d=i[h],v=e$1[h];return !!v&&!!d&&(n||o())-d>v});},mt=new WeakMap,ot=new WeakMap,Ot=new WeakMap,Y=new WeakMap,se=function(){let e$1=new Dt(e(this,K));g(this,X,0),g(this,Q,e$1),g(this,gt,i=>{g(this,X,e(this,X)-e$1[i]),e$1[i]=0;}),g(this,Tt,(i,s,r,n)=>{if(h(this,l,b).call(this,s))return 0;if(!at(r))if(n){if(typeof n!="function")throw new TypeError("sizeCalculation must be a function");if(r=n(s,i),!at(r))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return r}),g(this,bt,(i,s,r)=>{if(e$1[i]=s,e(this,M)){let n=e(this,M)-e$1[i];for(;e(this,X)>n;)h(this,l,Lt).call(this,true);}g(this,X,e(this,X)+e$1[i]),r&&(r.entrySize=s,r.totalCalculatedSize=e(this,X));});},gt=new WeakMap,bt=new WeakMap,Tt=new WeakMap,lt=function*({allowStale:e$1=this.allowStale}={}){if(e(this,U))for(let i=e(this,D);!(!h(this,l,It).call(this,i)||((e$1||!e(this,Y).call(this,i))&&(yield i),i===e(this,N)));)i=e(this,z)[i];},ht=function*({allowStale:e$1=this.allowStale}={}){if(e(this,U))for(let i=e(this,N);!(!h(this,l,It).call(this,i)||((e$1||!e(this,Y).call(this,i))&&(yield i),i===e(this,D)));)i=e(this,P)[i];},It=function(e$1){return e$1!==void 0&&e(this,T).get(e(this,w)[e$1])===e$1},Lt=function(e$1){var n;let i$1=e(this,N),s=e(this,w)[i$1],r=e(this,f)[i$1];return e(this,dt)&&h(this,l,b).call(this,r)?r.__abortController.abort(new Error("evicted")):(e(this,tt)||e(this,j))&&(e(this,tt)&&((n=e(this,q))==null||n.call(this,r,s,"evict")),e(this,j)&&e(this,L)?.push([r,s,"evict"])),e(this,gt).call(this,i$1),e(this,W)?.[i$1]&&(clearTimeout(e(this,W)[i$1]),e(this,W)[i$1]=void 0),e$1&&(e(this,w)[i$1]=void 0,e(this,f)[i$1]=void 0,e(this,J).push(i$1)),e(this,U)===1?(g(this,N,g(this,D,0)),e(this,J).length=0):g(this,N,e(this,P)[i$1]),e(this,T).delete(s),i(this,U)._--,i$1},Ct=function(e$1,i,s,r){let n=i===void 0?void 0:e(this,f)[i];if(h(this,l,b).call(this,n))return n;let o=new Nt,{signal:h$1}=s;h$1?.addEventListener("abort",()=>o.abort(h$1.reason),{signal:o.signal});let d={signal:o.signal,options:s,context:r},v=(A,y=false)=>{let{aborted:a}=o.signal,x=s.ignoreFetchAbort&&A!==void 0,O=s.ignoreFetchAbort||!!(s.allowStaleOnFetchAbort&&A!==void 0);if(s.status&&(a&&!y?(s.status.fetchAborted=true,s.status.fetchError=o.signal.reason,x&&(s.status.fetchAbortIgnored=true)):s.status.fetchResolved=true),a&&!x&&!y)return S(o.signal.reason,O);let u=I,g=e(this,f)[i];return (g===I||x&&y&&g===void 0)&&(A===void 0?u.__staleWhileFetching!==void 0?e(this,f)[i]=u.__staleWhileFetching:h(this,l,ct).call(this,e$1,"fetch"):(s.status&&(s.status.fetchUpdated=true),this.set(e$1,A,d.options))),A},R=A=>(s.status&&(s.status.fetchRejected=true,s.status.fetchError=A),S(A,false)),S=(A,y)=>{let{aborted:a}=o.signal,x=a&&s.allowStaleOnFetchAbort,O=x||s.allowStaleOnFetchRejection,u=O||s.noDeleteOnFetchRejection,g=I;if(e(this,f)[i]===I&&(!u||!y&&g.__staleWhileFetching===void 0?h(this,l,ct).call(this,e$1,"fetch"):x||(e(this,f)[i]=g.__staleWhileFetching)),O)return s.status&&g.__staleWhileFetching!==void 0&&(s.status.returnedStale=true),g.__staleWhileFetching;if(g.__returned===g)throw A},rt=(A,y)=>{var x;let a=(x=e(this,yt))==null?void 0:x.call(this,e$1,n,d);a&&a instanceof Promise&&a.then(O=>A(O===void 0?void 0:O),y),o.signal.addEventListener("abort",()=>{(!s.ignoreFetchAbort||s.allowStaleOnFetchAbort)&&(A(void 0),s.allowStaleOnFetchAbort&&(A=O=>v(O,true)));});};s.status&&(s.status.fetchDispatched=true);let I=new Promise(rt).then(v,R),k=Object.assign(I,{__abortController:o,__staleWhileFetching:n,__returned:void 0});return i===void 0?(this.set(e$1,k,{...d.options,status:void 0}),i=e(this,T).get(e$1)):e(this,f)[i]=k,k},b=function(e$1){if(!e(this,dt))return false;let i=e$1;return !!i&&i instanceof Promise&&i.hasOwnProperty("__staleWhileFetching")&&i.__abortController instanceof Nt},Mt=function(e$1,i){e(this,z)[i]=e$1,e(this,P)[e$1]=i;},At=function(e$1){e$1!==e(this,D)&&(e$1===e(this,N)?g(this,N,e(this,P)[e$1]):h(this,l,Mt).call(this,e(this,z)[e$1],e(this,P)[e$1]),h(this,l,Mt).call(this,e(this,D),e$1),g(this,D,e$1));},ct=function(e$1,i$1){var r,n;let s=false;if(e(this,U)!==0){let o=e(this,T).get(e$1);if(o!==void 0)if(e(this,W)?.[o]&&(clearTimeout(e(this,W)?.[o]),e(this,W)[o]=void 0),s=true,e(this,U)===1)h(this,l,zt).call(this,i$1);else {e(this,gt).call(this,o);let h$1=e(this,f)[o];if(h(this,l,b).call(this,h$1)?h$1.__abortController.abort(new Error("deleted")):(e(this,tt)||e(this,j))&&(e(this,tt)&&((r=e(this,q))==null||r.call(this,h$1,e$1,i$1)),e(this,j)&&e(this,L)?.push([h$1,e$1,i$1])),e(this,T).delete(e$1),e(this,w)[o]=void 0,e(this,f)[o]=void 0,o===e(this,D))g(this,D,e(this,z)[o]);else if(o===e(this,N))g(this,N,e(this,P)[o]);else {let d=e(this,z)[o];e(this,P)[d]=e(this,P)[o];let v=e(this,P)[o];e(this,z)[v]=e(this,z)[o];}i(this,U)._--,e(this,J).push(o);}}if(e(this,j)&&e(this,L)?.length){let o=e(this,L),h;for(;h=o?.shift();)(n=e(this,$))==null||n.call(this,...h);}return s},zt=function(e$1){var i,s;for(let r of h(this,l,ht).call(this,{allowStale:true})){let n=e(this,f)[r];if(h(this,l,b).call(this,n))n.__abortController.abort(new Error("deleted"));else {let o=e(this,w)[r];e(this,tt)&&((i=e(this,q))==null||i.call(this,n,o,e$1)),e(this,j)&&e(this,L)?.push([n,o,e$1]);}}if(e(this,T).clear(),e(this,f).fill(void 0),e(this,w).fill(void 0),e(this,V)&&e(this,Z)){e(this,V).fill(0),e(this,Z).fill(0);for(let r of e(this,W)??[])r!==void 0&&clearTimeout(r);e(this,W)?.fill(void 0);}if(e(this,Q)&&e(this,Q).fill(0),g(this,N,0),g(this,D,0),e(this,J).length=0,g(this,X,0),g(this,U,0),e(this,j)&&e(this,L)){let r=e(this,L),n;for(;n=r?.shift();)(s=e(this,$))==null||s.call(this,...n);}},wt);var Ft=class{constructor(e){d(this,"cache");d(this,"map",new Map);this.cache=new ie({max:e.cacheSize}),this.map=new Map;}get[Symbol.iterator](){return this.map[Symbol.iterator]}get[Symbol.toStringTag](){return this.map[Symbol.toStringTag]}clear(){this.cache.clear(),this.map.clear();}delete(e){let i=this.map.delete(e);return i&&this.cache.delete(e),i}get forEach(){return this.map.forEach}get(e){let i=this.cache.get(e);return i||this.map.get(e)}has(e){return this.map.has(e)}set(e,i){return this.map.set(e,i),this.cache.set(e,i),this}get size(){return this.map.size}entries(){return this.map.entries()}keys(){return this.map.keys()}values(){return this.map.values()}};var Ut="1.8.2";var Vt={version:Ut};var Wt="repeat";function Yt(m){return {type:"pause",duration:m}}var Ht="__game_layer__";var fe={CURRENT_DIALOGUE_MEMORY_KEY:"dialogue",LAST_DIALOGUE_ADDED_IN_STEP_MEMORY_KEY:"dialogue:step_counter",CURRENT_MENU_OPTIONS_MEMORY_KEY:"choice:options",LAST_MENU_OPTIONS_ADDED_IN_STEP_MEMORY_KEY:"choice:step_counter",CURRENT_INPUT_VALUE_MEMORY_KEY:"input:value",LAST_INPUT_ADDED_IN_STEP_MEMORY_KEY:"input:step_counter",CURRENT_INPUT_INFO_MEMORY_KEY:"input:info",CHARACTER_CATEGORY_KEY:"character",ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY:"___glue___",OPENED_LABELS_COUNTER_KEY:"label:opened",ALL_CHOICES_MADE_KEY:"choices:made",CURRENT_STEP_TIMES_COUNTER_KEY:"label:history",LAST_STEP_GLUED:"glue:last_step"};var oe={};var Kt={};b$1(Kt,{createExportableElement:()=>ne});var pt;(r=>(r.log=(n,...o)=>console.log(`[Pixi\u2019VN] ${n}`,...o),r.warn=(n,...o)=>console.warn(`[Pixi\u2019VN] ${n}`,...o),r.error=(n,...o)=>console.error(`[Pixi\u2019VN] ${n}`,...o),r.info=(n,...o)=>console.info(`[Pixi\u2019VN] ${n}`,...o)))(pt||(pt={}));function ne(m){try{if(typeof m>"u")return m;let e=JSON.stringify(m);return JSON.parse(e)}catch(e){throw pt.error("Error creating exportable element",m,e),new PixiError("not_json_serializable","Error creating exportable element")}}var ge=typeof window<"u"&&typeof document<"u",ae=[" _______ _ _ _ ____ ____ ____ _____ ","|_ __ \\ (_) (_) | | |_ _| |_ _||_ \\|_ _|"," | |__) |__ _ __ __ \\_| \\ \\ / / | \\ | | "," | ___/[ | [ \\ [ ][ | \\ \\ / / | |\\ \\| | "," _| |_ | | > ' < | | \\ ' / _| |_\\ |_ ",`|_____| [___][__]\`\\_][___] \\_/ |_____|\\____| v${Vt.version}`],le=31,_e="background:#2f90da;color:#fff;font-weight:bold;",ve="background:#c832bb;color:#fff;font-weight:bold;",Se="background:transparent;font-weight:bold;",kt=` v${Vt.version}`;function he(){if(!ge)return;let m=[],e=[];for(let i=0;i<ae.length;i++){let s=ae[i],r=s.endsWith(kt),n=r?s.slice(0,-kt.length):s,o=n.slice(0,le),h=n.slice(le),d=r?"%c%s%c%s%c%s":"%c%s%c%s";m.push(d),e.push(_e,o,ve,h),r&&e.push(Se,kt);}console.info(m.join(`
2
+ `),...e);}function qt(){let m=window.location.pathname+window.location.hash;return m.includes("#")&&(m=m.split("#")[1]),m}he();var $t;(y=>{async function m(a,x,O){if(GameUnifier.init({navigate:x?.navigate,getCurrentGameStepState:()=>{let u={};try{u=nt.canvas.export();}catch{}return {path:qt(),storage:G.storage.export(),canvas:u,sound:ut.sound.export(),labelIndex:C.NarrationManagerStatic.currentLabelStepIndex||0,openedLabels:C.narration.openedLabels}},restoreGameStepState:async(u,g)=>{et.HistoryManagerStatic._originalStepData=u,C.NarrationManagerStatic.openedLabels=u.openedLabels,G.storage.restore(u.storage);try{await nt.canvas.restore(u.canvas),await ut.sound.restore(u.sound);}catch(F){pt.error("Error restoring game step state:",F);}await g(u.path);},getStepCounter:()=>C.narration.stepCounter,setStepCounter:u=>{C.NarrationManagerStatic._stepCounter=u;},getOpenedLabels:()=>C.narration.openedLabels.length,addHistoryItem:(u,g)=>et.stepHistory.add(u,g),getCharacter:u=>Bt.RegisteredCharacters.get(u),processNavigationRequests:(u,g)=>{let F=u,H=Promise.resolve();return u>0?(F--,H=C.narration.continue(g)):u<0&&(F=0,H=et.stepHistory.back(g,{steps:u*-1})),{newValue:F,result:H}},animate:(u,g,F,H)=>motion.animate(u,g,F,H),getVariable:(u,g)=>G.StorageRegistry.getVariable(u,g),setVariable:(u,g,F)=>G.StorageRegistry.setVariable(u,g,F),removeVariable:(u,g)=>G.StorageRegistry.removeVariable(u,g),getFlag:u=>G.storage.getFlag(u),setFlag:(u,g)=>G.storage.setFlag(u,g),onLabelClosing:u=>G.StorageRegistry.clearOldTempVariables(u)}),!a||!x){pt.warn("The canvas element or options are not defined. The canvas will not be initialized.");return}return await nt.canvas.init(a,x,O)}y.init=m;function e(){G.storage.clear();try{nt.canvas.clear();}catch{}ut.sound.clear(),C.narration.clear(),et.stepHistory.clear();}y.clear=e;function i(){let a={};try{a=nt.canvas.export();}catch{}return {pixivn_version:Ut,stepData:C.narration.export(),storageData:G.storage.export(),canvasData:a,soundData:ut.sound.export(),historyData:et.stepHistory.export(),path:qt()}}y.exportGameState=i;async function s(a,x){et.stepHistory.restore(a.historyData);let O=et.stepHistory.lastKey;if(typeof O=="number"){let u=et.stepHistory.stepsInfoMap.get(O)||null;await C.narration.restore(a.stepData,u);}G.storage.restore(a.storageData);try{await nt.canvas.restore(a.canvasData),await ut.sound.restore(a.soundData);}catch{}x?await x(a.path):await GameUnifier.navigate(a.path);}y.restoreGameState=s;async function r(a,x){return y.clear(),await C.narration.call(a,x)}y.start=r;function n(a){return JSON.parse(a)}y.jsonToGameState=n;function o(a){GameUnifier.onEnd=a;}y.onEnd=o;function h(a){return pt.warn("Game.onError is deprecated. Use Game.addOnError / Game.removeOnError to register multiple handlers."),GameUnifier.addOnError((x,O)=>a("step",x,O))}y.onError=h;function d(a){return GameUnifier.addOnError(a)}y.addOnError=d;function v(a){return GameUnifier.removeOnError(a)}y.removeOnError=v;function R(a){C.NarrationManagerStatic.onStepStart=a;}y.onStepStart=R;function S(a){C.NarrationManagerStatic.onLoadingLabel=a;}y.onLoadingLabel=S;function rt(a){C.NarrationManagerStatic.onStepEnd=a;}y.onStepEnd=rt;function I(a){GameUnifier.navigate=a;}y.onNavigate=I;function k(a){return GameUnifier.addOnPreContinue(a)}y.addOnPreContinue=k;function A(a){return GameUnifier.removeOnPreContinue(a)}y.removeOnPreContinue=A;})($t||($t={}));var Be={characterUtils:Bt,canvasUtils:nt,narrationUtils:C,soundUtils:ut,CANVAS_APP_GAME_LAYER_ALIAS:Ht,Pause:Yt,Repeat:Wt,PIXIVN_VERSION:Ut,...Kt,...oe,canvas:nt.canvas,narration:C.narration,sound:ut.sound,storage:G.storage,history:et.stepHistory,Game:$t,GameUnifier:GameUnifier};export{Ht as CANVAS_APP_GAME_LAYER_ALIAS,Ft as CachedMap,$t as Game,Ut as PIXIVN_VERSION,Yt as Pause,Wt as Repeat,fe as SYSTEM_RESERVED_STORAGE_KEYS,ne as createExportableElement,Be as default};
@@ -1,7 +1,7 @@
1
1
  import { ChoiceInterface as ChoiceInterface$1 } from '@drincs/pixi-vn';
2
- import { S as StorageObjectType, a as StorageElementType } from './StorageElementType-DkJ394kq.cjs';
3
- import { L as LabelIdType, S as StepLabelType, a as LabelRunModeType, C as ChoiceOptionInterface, b as CloseChoiceOptionInterface, c as CloseType, O as OpenedLabel, d as StepLabelPropsType, e as StepLabelResultType, f as StoredIndexedChoiceInterface, D as DialogueInterface, g as StoredChoiceInterface, H as HistoryStep } from './HistoryChoiceMenuOption-DSSNUXEq.cjs';
4
- export { h as HistoryChoiceMenuOption, N as NarrationHistory } from './HistoryChoiceMenuOption-DSSNUXEq.cjs';
2
+ import { a as StorageObjectType, S as StorageElementType } from './StorageElementType-C7ETezlL.cjs';
3
+ import { L as LabelIdType, f as StepLabelType, d as LabelRunModeType, C as ChoiceOptionInterface, a as CloseChoiceOptionInterface, b as CloseType, O as OpenedLabel, S as StepLabelPropsType, e as StepLabelResultType, h as StoredIndexedChoiceInterface, D as DialogueInterface, g as StoredChoiceInterface, c as HistoryStep } from './HistoryChoiceMenuOption-DdwePsOm.cjs';
4
+ export { H as HistoryChoiceMenuOption, N as NarrationHistory } from './HistoryChoiceMenuOption-DdwePsOm.cjs';
5
5
  import 'microdiff';
6
6
 
7
7
  interface LabelProps<T, StepIdType = number> {
@@ -1,7 +1,7 @@
1
1
  import { ChoiceInterface as ChoiceInterface$1 } from '@drincs/pixi-vn';
2
- import { S as StorageObjectType, a as StorageElementType } from './StorageElementType-DkJ394kq.js';
3
- import { L as LabelIdType, S as StepLabelType, a as LabelRunModeType, C as ChoiceOptionInterface, b as CloseChoiceOptionInterface, c as CloseType, O as OpenedLabel, d as StepLabelPropsType, e as StepLabelResultType, f as StoredIndexedChoiceInterface, D as DialogueInterface, g as StoredChoiceInterface, H as HistoryStep } from './HistoryChoiceMenuOption-BP9Tsbyd.js';
4
- export { h as HistoryChoiceMenuOption, N as NarrationHistory } from './HistoryChoiceMenuOption-BP9Tsbyd.js';
2
+ import { a as StorageObjectType, S as StorageElementType } from './StorageElementType-C7ETezlL.js';
3
+ import { L as LabelIdType, f as StepLabelType, d as LabelRunModeType, C as ChoiceOptionInterface, a as CloseChoiceOptionInterface, b as CloseType, O as OpenedLabel, S as StepLabelPropsType, e as StepLabelResultType, h as StoredIndexedChoiceInterface, D as DialogueInterface, g as StoredChoiceInterface, c as HistoryStep } from './HistoryChoiceMenuOption-CS41KG13.js';
4
+ export { H as HistoryChoiceMenuOption, N as NarrationHistory } from './HistoryChoiceMenuOption-CS41KG13.js';
5
5
  import 'microdiff';
6
6
 
7
7
  interface LabelProps<T, StepIdType = number> {
package/dist/storage.cjs CHANGED
@@ -1 +1 @@
1
- 'use strict';var core=require('@drincs/pixi-vn/core');var te=Object.defineProperty;var jt=u=>{throw TypeError(u)};var ee=(u,e,i)=>e in u?te(u,e,{enumerable:true,configurable:true,writable:true,value:i}):u[e]=i;var E=(u,e,i)=>ee(u,typeof e!="symbol"?e+"":e,i),Ut=(u,e,i)=>e.has(u)||jt("Cannot "+i);var t=(u,e,i)=>(Ut(u,e,"read from private field"),i?i.call(u):e.get(u)),d=(u,e,i)=>e.has(u)?jt("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(u):e.set(u,i),f=(u,e,i,s)=>(Ut(u,e,"write to private field"),e.set(u,i),i),l=(u,e,i)=>(Ut(u,e,"access private method"),i);var It=(u,e,i,s)=>({set _(r){f(u,e,r);},get _(){return t(u,e,s)}});var st="storage",ht="temp",H="narration",Nt="flags",j={CURRENT_DIALOGUE_MEMORY_KEY:"dialogue",LAST_DIALOGUE_ADDED_IN_STEP_MEMORY_KEY:"dialogue:step_counter",CURRENT_MENU_OPTIONS_MEMORY_KEY:"choice:options",LAST_MENU_OPTIONS_ADDED_IN_STEP_MEMORY_KEY:"choice:step_counter",CURRENT_INPUT_VALUE_MEMORY_KEY:"input:value",LAST_INPUT_ADDED_IN_STEP_MEMORY_KEY:"input:step_counter",CURRENT_INPUT_INFO_MEMORY_KEY:"input:info",CHARACTER_CATEGORY_KEY:"character",ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY:"___glue___",OPENED_LABELS_COUNTER_KEY:"label:opened",ALL_CHOICES_MADE_KEY:"choices:made",CURRENT_STEP_TIMES_COUNTER_KEY:"label:history",LAST_STEP_GLUED:"glue:last_step"};var ie=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,Xt=new Set,zt=typeof process=="object"&&process?process:{},Jt=(u,e,i,s)=>{typeof zt.emitWarning=="function"?zt.emitWarning(u,e,i,s):console.error(`[${i}] ${e}: ${u}`);},Gt=globalThis.AbortController,$t=globalThis.AbortSignal;if(typeof Gt>"u"){$t=class{constructor(){E(this,"onabort");E(this,"_onabort",[]);E(this,"reason");E(this,"aborted",false);}addEventListener(i,s){this._onabort.push(s);}},Gt=class{constructor(){E(this,"signal",new $t);e();}abort(i){if(!this.signal.aborted){this.signal.reason=i,this.signal.aborted=true;for(let s of this.signal._onabort)s(i);this.signal.onabort?.(i);}}};let u=zt.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{u&&(u=false,Jt("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 se=u=>!Xt.has(u);var rt=u=>u&&u===Math.floor(u)&&u>0&&isFinite(u),qt=u=>rt(u)?u<=Math.pow(2,8)?Uint8Array:u<=Math.pow(2,16)?Uint16Array:u<=Math.pow(2,32)?Uint32Array:u<=Number.MAX_SAFE_INTEGER?Ft:null:null,Ft=class extends Array{constructor(u){super(u),this.fill(0);}},et,St,re=(et=class{constructor(e,i){E(this,"heap");E(this,"length");if(!t(et,St))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new i(e),this.length=0;}static create(e){let i=qt(e);if(!i)return [];f(et,St,true);let s=new et(e,i);return f(et,St,false),s}push(e){this.heap[this.length++]=e;}pop(){return this.heap[--this.length]}},St=new WeakMap,d(et,St,false),et),kt,Bt,$,z,k,ct,B,mt,Et,X,D,J,R,w,p,V,Y,C,N,q,F,Q,Z,P,K,tt,lt,L,Tt,n,Yt,ut,it,wt,W,Zt,ft,bt,xt,ot,at,Pt,Ct,Mt,O,Kt,Ot,nt,Wt,yt,Qt=(yt=class{constructor(e){d(this,n);d(this,$);d(this,z);d(this,k);d(this,ct);d(this,B);d(this,mt);d(this,Et);d(this,X);E(this,"ttl");E(this,"ttlResolution");E(this,"ttlAutopurge");E(this,"updateAgeOnGet");E(this,"updateAgeOnHas");E(this,"allowStale");E(this,"noDisposeOnSet");E(this,"noUpdateTTL");E(this,"maxEntrySize");E(this,"sizeCalculation");E(this,"noDeleteOnFetchRejection");E(this,"noDeleteOnStaleGet");E(this,"allowStaleOnFetchAbort");E(this,"allowStaleOnFetchRejection");E(this,"ignoreFetchAbort");d(this,D);d(this,J);d(this,R);d(this,w);d(this,p);d(this,V);d(this,Y);d(this,C);d(this,N);d(this,q);d(this,F);d(this,Q);d(this,Z);d(this,P);d(this,K);d(this,tt);d(this,lt);d(this,L);d(this,Tt);d(this,ut,()=>{});d(this,it,()=>{});d(this,wt,()=>{});d(this,W,()=>false);d(this,ft,e=>{});d(this,bt,(e,i,s)=>{});d(this,xt,(e,i,s,r)=>{if(s||r)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});E(this,kt,"LRUCache");let{max:i=0,ttl:s,ttlResolution:r=1,ttlAutopurge:a,updateAgeOnGet:o,updateAgeOnHas:h,allowStale:c,dispose:m,onInsert:I,disposeAfter:g,noDisposeOnSet:y,noUpdateTTL:b,maxSize:T=0,maxEntrySize:A=0,sizeCalculation:v,fetchMethod:_,memoMethod:M,noDeleteOnFetchRejection:U,noDeleteOnStaleGet:G,allowStaleOnFetchRejection:x,allowStaleOnFetchAbort:vt,ignoreFetchAbort:gt,perf:_t}=e;if(_t!==void 0&&typeof _t?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(f(this,X,_t??ie),i!==0&&!rt(i))throw new TypeError("max option must be a nonnegative integer");let dt=i?qt(i):Array;if(!dt)throw new Error("invalid max value: "+i);if(f(this,$,i),f(this,z,T),this.maxEntrySize=A||t(this,z),this.sizeCalculation=v,this.sizeCalculation){if(!t(this,z)&&!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(M!==void 0&&typeof M!="function")throw new TypeError("memoMethod must be a function if defined");if(f(this,Et,M),_!==void 0&&typeof _!="function")throw new TypeError("fetchMethod must be a function if specified");if(f(this,mt,_),f(this,lt,!!_),f(this,R,new Map),f(this,w,new Array(i).fill(void 0)),f(this,p,new Array(i).fill(void 0)),f(this,V,new dt(i)),f(this,Y,new dt(i)),f(this,C,0),f(this,N,0),f(this,q,re.create(i)),f(this,D,0),f(this,J,0),typeof m=="function"&&f(this,k,m),typeof I=="function"&&f(this,ct,I),typeof g=="function"?(f(this,B,g),f(this,F,[])):(f(this,B,void 0),f(this,F,void 0)),f(this,tt,!!t(this,k)),f(this,Tt,!!t(this,ct)),f(this,L,!!t(this,B)),this.noDisposeOnSet=!!y,this.noUpdateTTL=!!b,this.noDeleteOnFetchRejection=!!U,this.allowStaleOnFetchRejection=!!x,this.allowStaleOnFetchAbort=!!vt,this.ignoreFetchAbort=!!gt,this.maxEntrySize!==0){if(t(this,z)!==0&&!rt(t(this,z)))throw new TypeError("maxSize must be a positive integer if specified");if(!rt(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");l(this,n,Zt).call(this);}if(this.allowStale=!!c,this.noDeleteOnStaleGet=!!G,this.updateAgeOnGet=!!o,this.updateAgeOnHas=!!h,this.ttlResolution=rt(r)||r===0?r:1,this.ttlAutopurge=!!a,this.ttl=s||0,this.ttl){if(!rt(this.ttl))throw new TypeError("ttl must be a positive integer if specified");l(this,n,Yt).call(this);}if(t(this,$)===0&&this.ttl===0&&t(this,z)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!t(this,$)&&!t(this,z)){let Lt="LRU_CACHE_UNBOUNDED";se(Lt)&&(Xt.add(Lt),Jt("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",Lt,yt));}}get perf(){return t(this,X)}static unsafeExposeInternals(e){return {starts:t(e,Z),ttls:t(e,P),autopurgeTimers:t(e,K),sizes:t(e,Q),keyMap:t(e,R),keyList:t(e,w),valList:t(e,p),next:t(e,V),prev:t(e,Y),get head(){return t(e,C)},get tail(){return t(e,N)},free:t(e,q),isBackgroundFetch:i=>{var s;return l(s=e,n,O).call(s,i)},backgroundFetch:(i,s,r,a)=>{var o;return l(o=e,n,Mt).call(o,i,s,r,a)},moveToTail:i=>{var s;return l(s=e,n,Ot).call(s,i)},indexes:i=>{var s;return l(s=e,n,ot).call(s,i)},rindexes:i=>{var s;return l(s=e,n,at).call(s,i)},isStale:i=>{var s;return t(s=e,W).call(s,i)}}}get max(){return t(this,$)}get maxSize(){return t(this,z)}get calculatedSize(){return t(this,J)}get size(){return t(this,D)}get fetchMethod(){return t(this,mt)}get memoMethod(){return t(this,Et)}get dispose(){return t(this,k)}get onInsert(){return t(this,ct)}get disposeAfter(){return t(this,B)}getRemainingTTL(e){return t(this,R).has(e)?1/0:0}*entries(){for(let e of l(this,n,ot).call(this))t(this,p)[e]!==void 0&&t(this,w)[e]!==void 0&&!l(this,n,O).call(this,t(this,p)[e])&&(yield [t(this,w)[e],t(this,p)[e]]);}*rentries(){for(let e of l(this,n,at).call(this))t(this,p)[e]!==void 0&&t(this,w)[e]!==void 0&&!l(this,n,O).call(this,t(this,p)[e])&&(yield [t(this,w)[e],t(this,p)[e]]);}*keys(){for(let e of l(this,n,ot).call(this)){let i=t(this,w)[e];i!==void 0&&!l(this,n,O).call(this,t(this,p)[e])&&(yield i);}}*rkeys(){for(let e of l(this,n,at).call(this)){let i=t(this,w)[e];i!==void 0&&!l(this,n,O).call(this,t(this,p)[e])&&(yield i);}}*values(){for(let e of l(this,n,ot).call(this))t(this,p)[e]!==void 0&&!l(this,n,O).call(this,t(this,p)[e])&&(yield t(this,p)[e]);}*rvalues(){for(let e of l(this,n,at).call(this))t(this,p)[e]!==void 0&&!l(this,n,O).call(this,t(this,p)[e])&&(yield t(this,p)[e]);}[(Bt=Symbol.iterator,kt=Symbol.toStringTag,Bt)](){return this.entries()}find(e,i={}){for(let s of l(this,n,ot).call(this)){let r=t(this,p)[s],a=l(this,n,O).call(this,r)?r.__staleWhileFetching:r;if(a!==void 0&&e(a,t(this,w)[s],this))return this.get(t(this,w)[s],i)}}forEach(e,i=this){for(let s of l(this,n,ot).call(this)){let r=t(this,p)[s],a=l(this,n,O).call(this,r)?r.__staleWhileFetching:r;a!==void 0&&e.call(i,a,t(this,w)[s],this);}}rforEach(e,i=this){for(let s of l(this,n,at).call(this)){let r=t(this,p)[s],a=l(this,n,O).call(this,r)?r.__staleWhileFetching:r;a!==void 0&&e.call(i,a,t(this,w)[s],this);}}purgeStale(){let e=false;for(let i of l(this,n,at).call(this,{allowStale:true}))t(this,W).call(this,i)&&(l(this,n,nt).call(this,t(this,w)[i],"expire"),e=true);return e}info(e){let i=t(this,R).get(e);if(i===void 0)return;let s=t(this,p)[i],r=l(this,n,O).call(this,s)?s.__staleWhileFetching:s;if(r===void 0)return;let a={value:r};if(t(this,P)&&t(this,Z)){let o=t(this,P)[i],h=t(this,Z)[i];if(o&&h){let c=o-(t(this,X).now()-h);a.ttl=c,a.start=Date.now();}}return t(this,Q)&&(a.size=t(this,Q)[i]),a}dump(){let e=[];for(let i of l(this,n,ot).call(this,{allowStale:true})){let s=t(this,w)[i],r=t(this,p)[i],a=l(this,n,O).call(this,r)?r.__staleWhileFetching:r;if(a===void 0||s===void 0)continue;let o={value:a};if(t(this,P)&&t(this,Z)){o.ttl=t(this,P)[i];let h=t(this,X).now()-t(this,Z)[i];o.start=Math.floor(Date.now()-h);}t(this,Q)&&(o.size=t(this,Q)[i]),e.unshift([s,o]);}return e}load(e){this.clear();for(let[i,s]of e){if(s.start){let r=Date.now()-s.start;s.start=t(this,X).now()-r;}this.set(i,s.value,s);}}set(e,i,s={}){var y,b,T,A;if(i===void 0)return this.delete(e),this;let{ttl:r=this.ttl,start:a,noDisposeOnSet:o=this.noDisposeOnSet,sizeCalculation:h=this.sizeCalculation,status:c}=s,{noUpdateTTL:m=this.noUpdateTTL}=s,I=t(this,xt).call(this,e,i,s.size||0,h);if(this.maxEntrySize&&I>this.maxEntrySize)return c&&(c.set="miss",c.maxEntrySizeExceeded=true),l(this,n,nt).call(this,e,"set"),this;let g=t(this,D)===0?void 0:t(this,R).get(e);if(g===void 0)g=t(this,D)===0?t(this,N):t(this,q).length!==0?t(this,q).pop():t(this,D)===t(this,$)?l(this,n,Ct).call(this,false):t(this,D),t(this,w)[g]=e,t(this,p)[g]=i,t(this,R).set(e,g),t(this,V)[t(this,N)]=g,t(this,Y)[g]=t(this,N),f(this,N,g),It(this,D)._++,t(this,bt).call(this,g,I,c),c&&(c.set="add"),m=false,t(this,Tt)&&((y=t(this,ct))==null||y.call(this,i,e,"add"));else {l(this,n,Ot).call(this,g);let v=t(this,p)[g];if(i!==v){if(t(this,lt)&&l(this,n,O).call(this,v)){v.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:_}=v;_!==void 0&&!o&&(t(this,tt)&&((b=t(this,k))==null||b.call(this,_,e,"set")),t(this,L)&&t(this,F)?.push([_,e,"set"]));}else o||(t(this,tt)&&((T=t(this,k))==null||T.call(this,v,e,"set")),t(this,L)&&t(this,F)?.push([v,e,"set"]));if(t(this,ft).call(this,g),t(this,bt).call(this,g,I,c),t(this,p)[g]=i,c){c.set="replace";let _=v&&l(this,n,O).call(this,v)?v.__staleWhileFetching:v;_!==void 0&&(c.oldValue=_);}}else c&&(c.set="update");t(this,Tt)&&this.onInsert?.(i,e,i===v?"update":"replace");}if(r!==0&&!t(this,P)&&l(this,n,Yt).call(this),t(this,P)&&(m||t(this,wt).call(this,g,r,a),c&&t(this,it).call(this,c,g)),!o&&t(this,L)&&t(this,F)){let v=t(this,F),_;for(;_=v?.shift();)(A=t(this,B))==null||A.call(this,..._);}return this}pop(){var e;try{for(;t(this,D);){let i=t(this,p)[t(this,C)];if(l(this,n,Ct).call(this,!0),l(this,n,O).call(this,i)){if(i.__staleWhileFetching)return i.__staleWhileFetching}else if(i!==void 0)return i}}finally{if(t(this,L)&&t(this,F)){let i=t(this,F),s;for(;s=i?.shift();)(e=t(this,B))==null||e.call(this,...s);}}}has(e,i={}){let{updateAgeOnHas:s=this.updateAgeOnHas,status:r}=i,a=t(this,R).get(e);if(a!==void 0){let o=t(this,p)[a];if(l(this,n,O).call(this,o)&&o.__staleWhileFetching===void 0)return false;if(t(this,W).call(this,a))r&&(r.has="stale",t(this,it).call(this,r,a));else return s&&t(this,ut).call(this,a),r&&(r.has="hit",t(this,it).call(this,r,a)),true}else r&&(r.has="miss");return false}peek(e,i={}){let{allowStale:s=this.allowStale}=i,r=t(this,R).get(e);if(r===void 0||!s&&t(this,W).call(this,r))return;let a=t(this,p)[r];return l(this,n,O).call(this,a)?a.__staleWhileFetching:a}async fetch(e,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:a=this.noDeleteOnStaleGet,ttl:o=this.ttl,noDisposeOnSet:h=this.noDisposeOnSet,size:c=0,sizeCalculation:m=this.sizeCalculation,noUpdateTTL:I=this.noUpdateTTL,noDeleteOnFetchRejection:g=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:y=this.allowStaleOnFetchRejection,ignoreFetchAbort:b=this.ignoreFetchAbort,allowStaleOnFetchAbort:T=this.allowStaleOnFetchAbort,context:A,forceRefresh:v=false,status:_,signal:M}=i;if(!t(this,lt))return _&&(_.fetch="get"),this.get(e,{allowStale:s,updateAgeOnGet:r,noDeleteOnStaleGet:a,status:_});let U={allowStale:s,updateAgeOnGet:r,noDeleteOnStaleGet:a,ttl:o,noDisposeOnSet:h,size:c,sizeCalculation:m,noUpdateTTL:I,noDeleteOnFetchRejection:g,allowStaleOnFetchRejection:y,allowStaleOnFetchAbort:T,ignoreFetchAbort:b,status:_,signal:M},G=t(this,R).get(e);if(G===void 0){_&&(_.fetch="miss");let x=l(this,n,Mt).call(this,e,G,U,A);return x.__returned=x}else {let x=t(this,p)[G];if(l(this,n,O).call(this,x)){let dt=s&&x.__staleWhileFetching!==void 0;return _&&(_.fetch="inflight",dt&&(_.returnedStale=true)),dt?x.__staleWhileFetching:x.__returned=x}let vt=t(this,W).call(this,G);if(!v&&!vt)return _&&(_.fetch="hit"),l(this,n,Ot).call(this,G),r&&t(this,ut).call(this,G),_&&t(this,it).call(this,_,G),x;let gt=l(this,n,Mt).call(this,e,G,U,A),_t=gt.__staleWhileFetching!==void 0&&s;return _&&(_.fetch=vt?"stale":"refresh",_t&&vt&&(_.returnedStale=true)),_t?gt.__staleWhileFetching:gt.__returned=gt}}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,Et);if(!s)throw new Error("no memoMethod provided to constructor");let{context:r,forceRefresh:a,...o}=i,h=this.get(e,o);if(!a&&h!==void 0)return h;let c=s(e,h,{options:o,context:r});return this.set(e,c,o),c}get(e,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:a=this.noDeleteOnStaleGet,status:o}=i,h=t(this,R).get(e);if(h!==void 0){let c=t(this,p)[h],m=l(this,n,O).call(this,c);return o&&t(this,it).call(this,o,h),t(this,W).call(this,h)?(o&&(o.get="stale"),m?(o&&s&&c.__staleWhileFetching!==void 0&&(o.returnedStale=true),s?c.__staleWhileFetching:void 0):(a||l(this,n,nt).call(this,e,"expire"),o&&s&&(o.returnedStale=true),s?c:void 0)):(o&&(o.get="hit"),m?c.__staleWhileFetching:(l(this,n,Ot).call(this,h),r&&t(this,ut).call(this,h),c))}else o&&(o.get="miss");}delete(e){return l(this,n,nt).call(this,e,"delete")}clear(){return l(this,n,Wt).call(this,"delete")}},$=new WeakMap,z=new WeakMap,k=new WeakMap,ct=new WeakMap,B=new WeakMap,mt=new WeakMap,Et=new WeakMap,X=new WeakMap,D=new WeakMap,J=new WeakMap,R=new WeakMap,w=new WeakMap,p=new WeakMap,V=new WeakMap,Y=new WeakMap,C=new WeakMap,N=new WeakMap,q=new WeakMap,F=new WeakMap,Q=new WeakMap,Z=new WeakMap,P=new WeakMap,K=new WeakMap,tt=new WeakMap,lt=new WeakMap,L=new WeakMap,Tt=new WeakMap,n=new WeakSet,Yt=function(){let e=new Ft(t(this,$)),i=new Ft(t(this,$));f(this,P,e),f(this,Z,i);let s=this.ttlAutopurge?new Array(t(this,$)):void 0;f(this,K,s),f(this,wt,(h,c,m=t(this,X).now())=>{i[h]=c!==0?m:0,e[h]=c,r(h,c);}),f(this,ut,h=>{i[h]=e[h]!==0?t(this,X).now():0,r(h,e[h]);});let r=this.ttlAutopurge?(h,c)=>{if(s?.[h]&&(clearTimeout(s[h]),s[h]=void 0),c&&c!==0&&s){let m=setTimeout(()=>{t(this,W).call(this,h)&&l(this,n,nt).call(this,t(this,w)[h],"expire");},c+1);m.unref&&m.unref(),s[h]=m;}}:()=>{};f(this,it,(h,c)=>{if(e[c]){let m=e[c],I=i[c];if(!m||!I)return;h.ttl=m,h.start=I,h.now=a||o();let g=h.now-I;h.remainingTTL=m-g;}});let a=0,o=()=>{let h=t(this,X).now();if(this.ttlResolution>0){a=h;let c=setTimeout(()=>a=0,this.ttlResolution);c.unref&&c.unref();}return h};this.getRemainingTTL=h=>{let c=t(this,R).get(h);if(c===void 0)return 0;let m=e[c],I=i[c];if(!m||!I)return 1/0;let g=(a||o())-I;return m-g},f(this,W,h=>{let c=i[h],m=e[h];return !!m&&!!c&&(a||o())-c>m});},ut=new WeakMap,it=new WeakMap,wt=new WeakMap,W=new WeakMap,Zt=function(){let e=new Ft(t(this,$));f(this,J,0),f(this,Q,e),f(this,ft,i=>{f(this,J,t(this,J)-e[i]),e[i]=0;}),f(this,xt,(i,s,r,a)=>{if(l(this,n,O).call(this,s))return 0;if(!rt(r))if(a){if(typeof a!="function")throw new TypeError("sizeCalculation must be a function");if(r=a(s,i),!rt(r))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return r}),f(this,bt,(i,s,r)=>{if(e[i]=s,t(this,z)){let a=t(this,z)-e[i];for(;t(this,J)>a;)l(this,n,Ct).call(this,true);}f(this,J,t(this,J)+e[i]),r&&(r.entrySize=s,r.totalCalculatedSize=t(this,J));});},ft=new WeakMap,bt=new WeakMap,xt=new WeakMap,ot=function*({allowStale:e=this.allowStale}={}){if(t(this,D))for(let i=t(this,N);!(!l(this,n,Pt).call(this,i)||((e||!t(this,W).call(this,i))&&(yield i),i===t(this,C)));)i=t(this,Y)[i];},at=function*({allowStale:e=this.allowStale}={}){if(t(this,D))for(let i=t(this,C);!(!l(this,n,Pt).call(this,i)||((e||!t(this,W).call(this,i))&&(yield i),i===t(this,N)));)i=t(this,V)[i];},Pt=function(e){return e!==void 0&&t(this,R).get(t(this,w)[e])===e},Ct=function(e){var a;let i=t(this,C),s=t(this,w)[i],r=t(this,p)[i];return t(this,lt)&&l(this,n,O).call(this,r)?r.__abortController.abort(new Error("evicted")):(t(this,tt)||t(this,L))&&(t(this,tt)&&((a=t(this,k))==null||a.call(this,r,s,"evict")),t(this,L)&&t(this,F)?.push([r,s,"evict"])),t(this,ft).call(this,i),t(this,K)?.[i]&&(clearTimeout(t(this,K)[i]),t(this,K)[i]=void 0),e&&(t(this,w)[i]=void 0,t(this,p)[i]=void 0,t(this,q).push(i)),t(this,D)===1?(f(this,C,f(this,N,0)),t(this,q).length=0):f(this,C,t(this,V)[i]),t(this,R).delete(s),It(this,D)._--,i},Mt=function(e,i,s,r){let a=i===void 0?void 0:t(this,p)[i];if(l(this,n,O).call(this,a))return a;let o=new Gt,{signal:h}=s;h?.addEventListener("abort",()=>o.abort(h.reason),{signal:o.signal});let c={signal:o.signal,options:s,context:r},m=(A,v=false)=>{let{aborted:_}=o.signal,M=s.ignoreFetchAbort&&A!==void 0,U=s.ignoreFetchAbort||!!(s.allowStaleOnFetchAbort&&A!==void 0);if(s.status&&(_&&!v?(s.status.fetchAborted=true,s.status.fetchError=o.signal.reason,M&&(s.status.fetchAbortIgnored=true)):s.status.fetchResolved=true),_&&!M&&!v)return g(o.signal.reason,U);let G=b,x=t(this,p)[i];return (x===b||M&&v&&x===void 0)&&(A===void 0?G.__staleWhileFetching!==void 0?t(this,p)[i]=G.__staleWhileFetching:l(this,n,nt).call(this,e,"fetch"):(s.status&&(s.status.fetchUpdated=true),this.set(e,A,c.options))),A},I=A=>(s.status&&(s.status.fetchRejected=true,s.status.fetchError=A),g(A,false)),g=(A,v)=>{let{aborted:_}=o.signal,M=_&&s.allowStaleOnFetchAbort,U=M||s.allowStaleOnFetchRejection,G=U||s.noDeleteOnFetchRejection,x=b;if(t(this,p)[i]===b&&(!G||!v&&x.__staleWhileFetching===void 0?l(this,n,nt).call(this,e,"fetch"):M||(t(this,p)[i]=x.__staleWhileFetching)),U)return s.status&&x.__staleWhileFetching!==void 0&&(s.status.returnedStale=true),x.__staleWhileFetching;if(x.__returned===x)throw A},y=(A,v)=>{var M;let _=(M=t(this,mt))==null?void 0:M.call(this,e,a,c);_&&_ instanceof Promise&&_.then(U=>A(U===void 0?void 0:U),v),o.signal.addEventListener("abort",()=>{(!s.ignoreFetchAbort||s.allowStaleOnFetchAbort)&&(A(void 0),s.allowStaleOnFetchAbort&&(A=U=>m(U,true)));});};s.status&&(s.status.fetchDispatched=true);let b=new Promise(y).then(m,I),T=Object.assign(b,{__abortController:o,__staleWhileFetching:a,__returned:void 0});return i===void 0?(this.set(e,T,{...c.options,status:void 0}),i=t(this,R).get(e)):t(this,p)[i]=T,T},O=function(e){if(!t(this,lt))return false;let i=e;return !!i&&i instanceof Promise&&i.hasOwnProperty("__staleWhileFetching")&&i.__abortController instanceof Gt},Kt=function(e,i){t(this,Y)[i]=e,t(this,V)[e]=i;},Ot=function(e){e!==t(this,N)&&(e===t(this,C)?f(this,C,t(this,V)[e]):l(this,n,Kt).call(this,t(this,Y)[e],t(this,V)[e]),l(this,n,Kt).call(this,t(this,N),e),f(this,N,e));},nt=function(e,i){var r,a;let s=false;if(t(this,D)!==0){let o=t(this,R).get(e);if(o!==void 0)if(t(this,K)?.[o]&&(clearTimeout(t(this,K)?.[o]),t(this,K)[o]=void 0),s=true,t(this,D)===1)l(this,n,Wt).call(this,i);else {t(this,ft).call(this,o);let h=t(this,p)[o];if(l(this,n,O).call(this,h)?h.__abortController.abort(new Error("deleted")):(t(this,tt)||t(this,L))&&(t(this,tt)&&((r=t(this,k))==null||r.call(this,h,e,i)),t(this,L)&&t(this,F)?.push([h,e,i])),t(this,R).delete(e),t(this,w)[o]=void 0,t(this,p)[o]=void 0,o===t(this,N))f(this,N,t(this,Y)[o]);else if(o===t(this,C))f(this,C,t(this,V)[o]);else {let c=t(this,Y)[o];t(this,V)[c]=t(this,V)[o];let m=t(this,V)[o];t(this,Y)[m]=t(this,Y)[o];}It(this,D)._--,t(this,q).push(o);}}if(t(this,L)&&t(this,F)?.length){let o=t(this,F),h;for(;h=o?.shift();)(a=t(this,B))==null||a.call(this,...h);}return s},Wt=function(e){var i,s;for(let r of l(this,n,at).call(this,{allowStale:true})){let a=t(this,p)[r];if(l(this,n,O).call(this,a))a.__abortController.abort(new Error("deleted"));else {let o=t(this,w)[r];t(this,tt)&&((i=t(this,k))==null||i.call(this,a,o,e)),t(this,L)&&t(this,F)?.push([a,o,e]);}}if(t(this,R).clear(),t(this,p).fill(void 0),t(this,w).fill(void 0),t(this,P)&&t(this,Z)){t(this,P).fill(0),t(this,Z).fill(0);for(let r of t(this,K)??[])r!==void 0&&clearTimeout(r);t(this,K)?.fill(void 0);}if(t(this,Q)&&t(this,Q).fill(0),f(this,C,0),f(this,N,0),t(this,q).length=0,f(this,J,0),f(this,D,0),t(this,L)&&t(this,F)){let r=t(this,F),a;for(;a=r?.shift();)(s=t(this,B))==null||s.call(this,...a);}},yt);var At=class{constructor(e){E(this,"cache");E(this,"map",new Map);this.cache=new Qt({max:e.cacheSize}),this.map=new Map;}get[Symbol.iterator](){return this.map[Symbol.iterator]}get[Symbol.toStringTag](){return this.map[Symbol.toStringTag]}clear(){this.cache.clear(),this.map.clear();}delete(e){let i=this.map.delete(e);return i&&this.cache.delete(e),i}get forEach(){return this.map.forEach}get(e){let i=this.cache.get(e);return i||this.map.get(e)}has(e){return this.map.has(e)}set(e,i){return this.map.set(e,i),this.cache.set(e,i),this}get size(){return this.map.size}entries(){return this.map.entries()}keys(){return this.map.keys()}values(){return this.map.values()}};var pt;(r=>(r.log=(a,...o)=>console.log(`[Pixi\u2019VN] ${a}`,...o),r.warn=(a,...o)=>console.warn(`[Pixi\u2019VN] ${a}`,...o),r.error=(a,...o)=>console.error(`[Pixi\u2019VN] ${a}`,...o),r.info=(a,...o)=>console.info(`[Pixi\u2019VN] ${a}`,...o)))(pt||(pt={}));function Rt(u){try{if(typeof u>"u")return u;let e=JSON.stringify(u);return JSON.parse(e)}catch(e){throw pt.error("Error creating exportable element",u,e),new core.PixiError("not_json_serializable","Error creating exportable element")}}var Ht;(g=>{g.storage=new At({cacheSize:50}),g.defaultStorage=new At({cacheSize:10}),g.tempStorageDeadlines=new Map;let s;function r(y){g.tempStorageDeadlines.forEach((b,T)=>{b>y&&(g.storage.delete(`${ht}:${T}`),s?.onClearOldTempVariable?.(T),g.tempStorageDeadlines.delete(T));});}g.clearOldTempVariables=r;function a(y){s=y;}g.setExternalStoreHandler=a;function o(y,b,T){T==null?g.storage.delete(`${y}:${b}`):g.storage.set(`${y}:${b}`,T),s?.onSetVariable?.(b,T);}g.setVariable=o;function h(y,b){let T=g.storage.get(`${y}:${b}`);return Rt(T)}g.getVariable=h;function c(y,b){g.storage.delete(`${y}:${b}`),s?.onRemoveVariable?.(b);}g.removeVariable=c;function m(y,b){let T=g.storage.get(Nt)||[];if(b)T.includes(y)||T.push(y);else {let A=T.indexOf(y);A>-1&&T.splice(A,1);}g.storage.set(Nt,T);}g.setFlag=m;function I(y){return (g.storage.get(Nt)||[]).includes(y)}g.getFlag=I;})(Ht||(Ht={}));var S=Ht;var Dt=class{get base(){return S.storage.map}get cache(){return S.storage.cache}get tempStorageDeadlines(){return S.tempStorageDeadlines}set default(e){Object.entries(e).forEach(([i,s])=>{S.defaultStorage.map.set(i,s);});}set(e,i){return S.setVariable(st,e,i)}get(e){let i=S.getVariable(ht,e);return i===void 0&&(i=S.getVariable(st,e)),i===void 0&&(i=Rt(S.defaultStorage.get(e))),i}remove(e){return this.removeTempVariable(e),S.removeVariable(st,e)}setTempVariable(e,i){if(i==null){this.removeTempVariable(e);return}else S.setVariable(ht,e,i),this.tempStorageDeadlines.has(e)||this.tempStorageDeadlines.set(e,core.GameUnifier.openedLabels);}removeTempVariable(e){S.removeVariable(ht,e),this.tempStorageDeadlines.has(e)&&this.tempStorageDeadlines.delete(e);}setFlag(e,i){return S.setFlag(e,i)}getFlag(e){return S.getFlag(e)}setStorageHandler(e){S.setExternalStoreHandler(e);}clear(){this.base.clear(),this.cache.clear(),this.tempStorageDeadlines.clear();}export(){let e=[];[...this.base.keys()].forEach(s=>{e.push({key:s,value:this.base.get(s)});});let i=[];return [...S.tempStorageDeadlines.keys()].forEach(s=>{i.push({key:s,value:this.tempStorageDeadlines.get(s)});}),Rt({main:e,tempDeadlines:i})}restore(e){this.clear();try{e?(e.base?.forEach(i=>{switch(i.key){case "___current_dialogue_memory___":S.setVariable(H,j.CURRENT_DIALOGUE_MEMORY_KEY,i.value);break;case "___last_dialogue_added_in_step_memory___":S.setVariable(H,j.LAST_DIALOGUE_ADDED_IN_STEP_MEMORY_KEY,i.value);break;case "___current_menu_options_memory___":S.setVariable(H,j.CURRENT_MENU_OPTIONS_MEMORY_KEY,i.value);break;case "___last_menu_options_added_in_step_memory___":S.setVariable(H,j.LAST_MENU_OPTIONS_ADDED_IN_STEP_MEMORY_KEY,i.value);break;case "_input_value_":S.setVariable(H,j.CURRENT_INPUT_VALUE_MEMORY_KEY,i.value);break;case "___last_input_added_in_step_memory___":S.setVariable(H,j.LAST_INPUT_ADDED_IN_STEP_MEMORY_KEY,i.value);break;case "___current_input_info_memory___":S.setVariable(H,j.CURRENT_INPUT_INFO_MEMORY_KEY,i.value);break;case "___opened_labels_counter___":S.setVariable(H,j.OPENED_LABELS_COUNTER_KEY,i.value);break;case "___all_choices_made___":S.setVariable(H,j.ALL_CHOICES_MADE_KEY,i.value);break;case "___current_step_times_counter___":S.setVariable(H,j.CURRENT_STEP_TIMES_COUNTER_KEY,i.value);break;case "___last_step_glued___":S.setVariable(H,j.LAST_STEP_GLUED,i.value);break;default:S.setVariable(st,i.key,i.value);}}),e.temp?.forEach(i=>{S.setVariable(ht,i.key,i.value);}),e.flags?.forEach(i=>{S.setFlag(i,!0);}),e.main?.forEach(i=>{this.base.set(i.key,i.value);}),e.tempDeadlines?.forEach(i=>{this.tempStorageDeadlines.set(i.key,i.value);})):pt.warn("No storage data found");}catch(i){pt.error("Error importing data",i);}}};var Vt=class{constructor(e,i){E(this,"id");E(this,"categoryId");this.categoryId=e,this.id=i,this.migrateOldStorage();}migrateOldStorage(e=this.categoryId){let i=S.getVariable(st,e);i&&(Object.entries(i).forEach(([s,r])=>{typeof r=="object"&&r!==null&&Object.entries(r).forEach(([a,o])=>{S.setVariable(this.categoryId,`${s}:${a}`,o);});}),S.removeVariable(st,e));}setStorageProperty(e,i){S.setVariable(this.categoryId,`${this.id}:${e}`,i);}getStorageProperty(e,i=this.id){return S.getVariable(this.categoryId,`${i}:${e}`)}};var Ve=new Dt;exports.StorageRegistry=S;exports.StoredClassModel=Vt;exports.storage=Ve;
1
+ 'use strict';var core=require('@drincs/pixi-vn/core');var te=Object.defineProperty;var jt=u=>{throw TypeError(u)};var ee=(u,e,i)=>e in u?te(u,e,{enumerable:true,configurable:true,writable:true,value:i}):u[e]=i;var E=(u,e,i)=>ee(u,typeof e!="symbol"?e+"":e,i),Ut=(u,e,i)=>e.has(u)||jt("Cannot "+i);var t=(u,e,i)=>(Ut(u,e,"read from private field"),i?i.call(u):e.get(u)),d=(u,e,i)=>e.has(u)?jt("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(u):e.set(u,i),f=(u,e,i,s)=>(Ut(u,e,"write to private field"),e.set(u,i),i),l=(u,e,i)=>(Ut(u,e,"access private method"),i);var It=(u,e,i,s)=>({set _(r){f(u,e,r);},get _(){return t(u,e,s)}});var st="storage",ht="temp",H="narration",Nt="flags",j={CURRENT_DIALOGUE_MEMORY_KEY:"dialogue",LAST_DIALOGUE_ADDED_IN_STEP_MEMORY_KEY:"dialogue:step_counter",CURRENT_MENU_OPTIONS_MEMORY_KEY:"choice:options",LAST_MENU_OPTIONS_ADDED_IN_STEP_MEMORY_KEY:"choice:step_counter",CURRENT_INPUT_VALUE_MEMORY_KEY:"input:value",LAST_INPUT_ADDED_IN_STEP_MEMORY_KEY:"input:step_counter",CURRENT_INPUT_INFO_MEMORY_KEY:"input:info",CHARACTER_CATEGORY_KEY:"character",ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY:"___glue___",OPENED_LABELS_COUNTER_KEY:"label:opened",ALL_CHOICES_MADE_KEY:"choices:made",CURRENT_STEP_TIMES_COUNTER_KEY:"label:history",LAST_STEP_GLUED:"glue:last_step"};var ie=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,Xt=new Set,zt=typeof process=="object"&&process?process:{},Jt=(u,e,i,s)=>{typeof zt.emitWarning=="function"?zt.emitWarning(u,e,i,s):console.error(`[${i}] ${e}: ${u}`);},Gt=globalThis.AbortController,$t=globalThis.AbortSignal;if(typeof Gt>"u"){$t=class{constructor(){E(this,"onabort");E(this,"_onabort",[]);E(this,"reason");E(this,"aborted",false);}addEventListener(i,s){this._onabort.push(s);}},Gt=class{constructor(){E(this,"signal",new $t);e();}abort(i){if(!this.signal.aborted){this.signal.reason=i,this.signal.aborted=true;for(let s of this.signal._onabort)s(i);this.signal.onabort?.(i);}}};let u=zt.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{u&&(u=false,Jt("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 se=u=>!Xt.has(u);var rt=u=>u&&u===Math.floor(u)&&u>0&&isFinite(u),qt=u=>rt(u)?u<=Math.pow(2,8)?Uint8Array:u<=Math.pow(2,16)?Uint16Array:u<=Math.pow(2,32)?Uint32Array:u<=Number.MAX_SAFE_INTEGER?Ft:null:null,Ft=class extends Array{constructor(u){super(u),this.fill(0);}},et,St,re=(et=class{constructor(e,i){E(this,"heap");E(this,"length");if(!t(et,St))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new i(e),this.length=0;}static create(e){let i=qt(e);if(!i)return [];f(et,St,true);let s=new et(e,i);return f(et,St,false),s}push(e){this.heap[this.length++]=e;}pop(){return this.heap[--this.length]}},St=new WeakMap,d(et,St,false),et),kt,Bt,$,z,k,ct,B,mt,Et,X,D,J,R,v,p,V,Y,C,N,q,F,Q,Z,P,K,tt,lt,L,Tt,n,Yt,ut,it,vt,W,Zt,ft,bt,xt,at,ot,Pt,Ct,Mt,w,Kt,wt,nt,Wt,At,Qt=(At=class{constructor(e){d(this,n);d(this,$);d(this,z);d(this,k);d(this,ct);d(this,B);d(this,mt);d(this,Et);d(this,X);E(this,"ttl");E(this,"ttlResolution");E(this,"ttlAutopurge");E(this,"updateAgeOnGet");E(this,"updateAgeOnHas");E(this,"allowStale");E(this,"noDisposeOnSet");E(this,"noUpdateTTL");E(this,"maxEntrySize");E(this,"sizeCalculation");E(this,"noDeleteOnFetchRejection");E(this,"noDeleteOnStaleGet");E(this,"allowStaleOnFetchAbort");E(this,"allowStaleOnFetchRejection");E(this,"ignoreFetchAbort");d(this,D);d(this,J);d(this,R);d(this,v);d(this,p);d(this,V);d(this,Y);d(this,C);d(this,N);d(this,q);d(this,F);d(this,Q);d(this,Z);d(this,P);d(this,K);d(this,tt);d(this,lt);d(this,L);d(this,Tt);d(this,ut,()=>{});d(this,it,()=>{});d(this,vt,()=>{});d(this,W,()=>false);d(this,ft,e=>{});d(this,bt,(e,i,s)=>{});d(this,xt,(e,i,s,r)=>{if(s||r)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});E(this,kt,"LRUCache");let{max:i=0,ttl:s,ttlResolution:r=1,ttlAutopurge:o,updateAgeOnGet:a,updateAgeOnHas:h,allowStale:c,dispose:m,onInsert:I,disposeAfter:g,noDisposeOnSet:A,noUpdateTTL:b,maxSize:T=0,maxEntrySize:y=0,sizeCalculation:O,fetchMethod:_,memoMethod:M,noDeleteOnFetchRejection:U,noDeleteOnStaleGet:G,allowStaleOnFetchRejection:x,allowStaleOnFetchAbort:Ot,ignoreFetchAbort:gt,perf:_t}=e;if(_t!==void 0&&typeof _t?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(f(this,X,_t??ie),i!==0&&!rt(i))throw new TypeError("max option must be a nonnegative integer");let dt=i?qt(i):Array;if(!dt)throw new Error("invalid max value: "+i);if(f(this,$,i),f(this,z,T),this.maxEntrySize=y||t(this,z),this.sizeCalculation=O,this.sizeCalculation){if(!t(this,z)&&!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(M!==void 0&&typeof M!="function")throw new TypeError("memoMethod must be a function if defined");if(f(this,Et,M),_!==void 0&&typeof _!="function")throw new TypeError("fetchMethod must be a function if specified");if(f(this,mt,_),f(this,lt,!!_),f(this,R,new Map),f(this,v,new Array(i).fill(void 0)),f(this,p,new Array(i).fill(void 0)),f(this,V,new dt(i)),f(this,Y,new dt(i)),f(this,C,0),f(this,N,0),f(this,q,re.create(i)),f(this,D,0),f(this,J,0),typeof m=="function"&&f(this,k,m),typeof I=="function"&&f(this,ct,I),typeof g=="function"?(f(this,B,g),f(this,F,[])):(f(this,B,void 0),f(this,F,void 0)),f(this,tt,!!t(this,k)),f(this,Tt,!!t(this,ct)),f(this,L,!!t(this,B)),this.noDisposeOnSet=!!A,this.noUpdateTTL=!!b,this.noDeleteOnFetchRejection=!!U,this.allowStaleOnFetchRejection=!!x,this.allowStaleOnFetchAbort=!!Ot,this.ignoreFetchAbort=!!gt,this.maxEntrySize!==0){if(t(this,z)!==0&&!rt(t(this,z)))throw new TypeError("maxSize must be a positive integer if specified");if(!rt(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");l(this,n,Zt).call(this);}if(this.allowStale=!!c,this.noDeleteOnStaleGet=!!G,this.updateAgeOnGet=!!a,this.updateAgeOnHas=!!h,this.ttlResolution=rt(r)||r===0?r:1,this.ttlAutopurge=!!o,this.ttl=s||0,this.ttl){if(!rt(this.ttl))throw new TypeError("ttl must be a positive integer if specified");l(this,n,Yt).call(this);}if(t(this,$)===0&&this.ttl===0&&t(this,z)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!t(this,$)&&!t(this,z)){let Lt="LRU_CACHE_UNBOUNDED";se(Lt)&&(Xt.add(Lt),Jt("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",Lt,At));}}get perf(){return t(this,X)}static unsafeExposeInternals(e){return {starts:t(e,Z),ttls:t(e,P),autopurgeTimers:t(e,K),sizes:t(e,Q),keyMap:t(e,R),keyList:t(e,v),valList:t(e,p),next:t(e,V),prev:t(e,Y),get head(){return t(e,C)},get tail(){return t(e,N)},free:t(e,q),isBackgroundFetch:i=>{var s;return l(s=e,n,w).call(s,i)},backgroundFetch:(i,s,r,o)=>{var a;return l(a=e,n,Mt).call(a,i,s,r,o)},moveToTail:i=>{var s;return l(s=e,n,wt).call(s,i)},indexes:i=>{var s;return l(s=e,n,at).call(s,i)},rindexes:i=>{var s;return l(s=e,n,ot).call(s,i)},isStale:i=>{var s;return t(s=e,W).call(s,i)}}}get max(){return t(this,$)}get maxSize(){return t(this,z)}get calculatedSize(){return t(this,J)}get size(){return t(this,D)}get fetchMethod(){return t(this,mt)}get memoMethod(){return t(this,Et)}get dispose(){return t(this,k)}get onInsert(){return t(this,ct)}get disposeAfter(){return t(this,B)}getRemainingTTL(e){return t(this,R).has(e)?1/0:0}*entries(){for(let e of l(this,n,at).call(this))t(this,p)[e]!==void 0&&t(this,v)[e]!==void 0&&!l(this,n,w).call(this,t(this,p)[e])&&(yield [t(this,v)[e],t(this,p)[e]]);}*rentries(){for(let e of l(this,n,ot).call(this))t(this,p)[e]!==void 0&&t(this,v)[e]!==void 0&&!l(this,n,w).call(this,t(this,p)[e])&&(yield [t(this,v)[e],t(this,p)[e]]);}*keys(){for(let e of l(this,n,at).call(this)){let i=t(this,v)[e];i!==void 0&&!l(this,n,w).call(this,t(this,p)[e])&&(yield i);}}*rkeys(){for(let e of l(this,n,ot).call(this)){let i=t(this,v)[e];i!==void 0&&!l(this,n,w).call(this,t(this,p)[e])&&(yield i);}}*values(){for(let e of l(this,n,at).call(this))t(this,p)[e]!==void 0&&!l(this,n,w).call(this,t(this,p)[e])&&(yield t(this,p)[e]);}*rvalues(){for(let e of l(this,n,ot).call(this))t(this,p)[e]!==void 0&&!l(this,n,w).call(this,t(this,p)[e])&&(yield t(this,p)[e]);}[(Bt=Symbol.iterator,kt=Symbol.toStringTag,Bt)](){return this.entries()}find(e,i={}){for(let s of l(this,n,at).call(this)){let r=t(this,p)[s],o=l(this,n,w).call(this,r)?r.__staleWhileFetching:r;if(o!==void 0&&e(o,t(this,v)[s],this))return this.get(t(this,v)[s],i)}}forEach(e,i=this){for(let s of l(this,n,at).call(this)){let r=t(this,p)[s],o=l(this,n,w).call(this,r)?r.__staleWhileFetching:r;o!==void 0&&e.call(i,o,t(this,v)[s],this);}}rforEach(e,i=this){for(let s of l(this,n,ot).call(this)){let r=t(this,p)[s],o=l(this,n,w).call(this,r)?r.__staleWhileFetching:r;o!==void 0&&e.call(i,o,t(this,v)[s],this);}}purgeStale(){let e=false;for(let i of l(this,n,ot).call(this,{allowStale:true}))t(this,W).call(this,i)&&(l(this,n,nt).call(this,t(this,v)[i],"expire"),e=true);return e}info(e){let i=t(this,R).get(e);if(i===void 0)return;let s=t(this,p)[i],r=l(this,n,w).call(this,s)?s.__staleWhileFetching:s;if(r===void 0)return;let o={value:r};if(t(this,P)&&t(this,Z)){let a=t(this,P)[i],h=t(this,Z)[i];if(a&&h){let c=a-(t(this,X).now()-h);o.ttl=c,o.start=Date.now();}}return t(this,Q)&&(o.size=t(this,Q)[i]),o}dump(){let e=[];for(let i of l(this,n,at).call(this,{allowStale:true})){let s=t(this,v)[i],r=t(this,p)[i],o=l(this,n,w).call(this,r)?r.__staleWhileFetching:r;if(o===void 0||s===void 0)continue;let a={value:o};if(t(this,P)&&t(this,Z)){a.ttl=t(this,P)[i];let h=t(this,X).now()-t(this,Z)[i];a.start=Math.floor(Date.now()-h);}t(this,Q)&&(a.size=t(this,Q)[i]),e.unshift([s,a]);}return e}load(e){this.clear();for(let[i,s]of e){if(s.start){let r=Date.now()-s.start;s.start=t(this,X).now()-r;}this.set(i,s.value,s);}}set(e,i,s={}){var A,b,T,y;if(i===void 0)return this.delete(e),this;let{ttl:r=this.ttl,start:o,noDisposeOnSet:a=this.noDisposeOnSet,sizeCalculation:h=this.sizeCalculation,status:c}=s,{noUpdateTTL:m=this.noUpdateTTL}=s,I=t(this,xt).call(this,e,i,s.size||0,h);if(this.maxEntrySize&&I>this.maxEntrySize)return c&&(c.set="miss",c.maxEntrySizeExceeded=true),l(this,n,nt).call(this,e,"set"),this;let g=t(this,D)===0?void 0:t(this,R).get(e);if(g===void 0)g=t(this,D)===0?t(this,N):t(this,q).length!==0?t(this,q).pop():t(this,D)===t(this,$)?l(this,n,Ct).call(this,false):t(this,D),t(this,v)[g]=e,t(this,p)[g]=i,t(this,R).set(e,g),t(this,V)[t(this,N)]=g,t(this,Y)[g]=t(this,N),f(this,N,g),It(this,D)._++,t(this,bt).call(this,g,I,c),c&&(c.set="add"),m=false,t(this,Tt)&&((A=t(this,ct))==null||A.call(this,i,e,"add"));else {l(this,n,wt).call(this,g);let O=t(this,p)[g];if(i!==O){if(t(this,lt)&&l(this,n,w).call(this,O)){O.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:_}=O;_!==void 0&&!a&&(t(this,tt)&&((b=t(this,k))==null||b.call(this,_,e,"set")),t(this,L)&&t(this,F)?.push([_,e,"set"]));}else a||(t(this,tt)&&((T=t(this,k))==null||T.call(this,O,e,"set")),t(this,L)&&t(this,F)?.push([O,e,"set"]));if(t(this,ft).call(this,g),t(this,bt).call(this,g,I,c),t(this,p)[g]=i,c){c.set="replace";let _=O&&l(this,n,w).call(this,O)?O.__staleWhileFetching:O;_!==void 0&&(c.oldValue=_);}}else c&&(c.set="update");t(this,Tt)&&this.onInsert?.(i,e,i===O?"update":"replace");}if(r!==0&&!t(this,P)&&l(this,n,Yt).call(this),t(this,P)&&(m||t(this,vt).call(this,g,r,o),c&&t(this,it).call(this,c,g)),!a&&t(this,L)&&t(this,F)){let O=t(this,F),_;for(;_=O?.shift();)(y=t(this,B))==null||y.call(this,..._);}return this}pop(){var e;try{for(;t(this,D);){let i=t(this,p)[t(this,C)];if(l(this,n,Ct).call(this,!0),l(this,n,w).call(this,i)){if(i.__staleWhileFetching)return i.__staleWhileFetching}else if(i!==void 0)return i}}finally{if(t(this,L)&&t(this,F)){let i=t(this,F),s;for(;s=i?.shift();)(e=t(this,B))==null||e.call(this,...s);}}}has(e,i={}){let{updateAgeOnHas:s=this.updateAgeOnHas,status:r}=i,o=t(this,R).get(e);if(o!==void 0){let a=t(this,p)[o];if(l(this,n,w).call(this,a)&&a.__staleWhileFetching===void 0)return false;if(t(this,W).call(this,o))r&&(r.has="stale",t(this,it).call(this,r,o));else return s&&t(this,ut).call(this,o),r&&(r.has="hit",t(this,it).call(this,r,o)),true}else r&&(r.has="miss");return false}peek(e,i={}){let{allowStale:s=this.allowStale}=i,r=t(this,R).get(e);if(r===void 0||!s&&t(this,W).call(this,r))return;let o=t(this,p)[r];return l(this,n,w).call(this,o)?o.__staleWhileFetching:o}async fetch(e,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,ttl:a=this.ttl,noDisposeOnSet:h=this.noDisposeOnSet,size:c=0,sizeCalculation:m=this.sizeCalculation,noUpdateTTL:I=this.noUpdateTTL,noDeleteOnFetchRejection:g=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:A=this.allowStaleOnFetchRejection,ignoreFetchAbort:b=this.ignoreFetchAbort,allowStaleOnFetchAbort:T=this.allowStaleOnFetchAbort,context:y,forceRefresh:O=false,status:_,signal:M}=i;if(!t(this,lt))return _&&(_.fetch="get"),this.get(e,{allowStale:s,updateAgeOnGet:r,noDeleteOnStaleGet:o,status:_});let U={allowStale:s,updateAgeOnGet:r,noDeleteOnStaleGet:o,ttl:a,noDisposeOnSet:h,size:c,sizeCalculation:m,noUpdateTTL:I,noDeleteOnFetchRejection:g,allowStaleOnFetchRejection:A,allowStaleOnFetchAbort:T,ignoreFetchAbort:b,status:_,signal:M},G=t(this,R).get(e);if(G===void 0){_&&(_.fetch="miss");let x=l(this,n,Mt).call(this,e,G,U,y);return x.__returned=x}else {let x=t(this,p)[G];if(l(this,n,w).call(this,x)){let dt=s&&x.__staleWhileFetching!==void 0;return _&&(_.fetch="inflight",dt&&(_.returnedStale=true)),dt?x.__staleWhileFetching:x.__returned=x}let Ot=t(this,W).call(this,G);if(!O&&!Ot)return _&&(_.fetch="hit"),l(this,n,wt).call(this,G),r&&t(this,ut).call(this,G),_&&t(this,it).call(this,_,G),x;let gt=l(this,n,Mt).call(this,e,G,U,y),_t=gt.__staleWhileFetching!==void 0&&s;return _&&(_.fetch=Ot?"stale":"refresh",_t&&Ot&&(_.returnedStale=true)),_t?gt.__staleWhileFetching:gt.__returned=gt}}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,Et);if(!s)throw new Error("no memoMethod provided to constructor");let{context:r,forceRefresh:o,...a}=i,h=this.get(e,a);if(!o&&h!==void 0)return h;let c=s(e,h,{options:a,context:r});return this.set(e,c,a),c}get(e,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,status:a}=i,h=t(this,R).get(e);if(h!==void 0){let c=t(this,p)[h],m=l(this,n,w).call(this,c);return a&&t(this,it).call(this,a,h),t(this,W).call(this,h)?(a&&(a.get="stale"),m?(a&&s&&c.__staleWhileFetching!==void 0&&(a.returnedStale=true),s?c.__staleWhileFetching:void 0):(o||l(this,n,nt).call(this,e,"expire"),a&&s&&(a.returnedStale=true),s?c:void 0)):(a&&(a.get="hit"),m?c.__staleWhileFetching:(l(this,n,wt).call(this,h),r&&t(this,ut).call(this,h),c))}else a&&(a.get="miss");}delete(e){return l(this,n,nt).call(this,e,"delete")}clear(){return l(this,n,Wt).call(this,"delete")}},$=new WeakMap,z=new WeakMap,k=new WeakMap,ct=new WeakMap,B=new WeakMap,mt=new WeakMap,Et=new WeakMap,X=new WeakMap,D=new WeakMap,J=new WeakMap,R=new WeakMap,v=new WeakMap,p=new WeakMap,V=new WeakMap,Y=new WeakMap,C=new WeakMap,N=new WeakMap,q=new WeakMap,F=new WeakMap,Q=new WeakMap,Z=new WeakMap,P=new WeakMap,K=new WeakMap,tt=new WeakMap,lt=new WeakMap,L=new WeakMap,Tt=new WeakMap,n=new WeakSet,Yt=function(){let e=new Ft(t(this,$)),i=new Ft(t(this,$));f(this,P,e),f(this,Z,i);let s=this.ttlAutopurge?new Array(t(this,$)):void 0;f(this,K,s),f(this,vt,(h,c,m=t(this,X).now())=>{i[h]=c!==0?m:0,e[h]=c,r(h,c);}),f(this,ut,h=>{i[h]=e[h]!==0?t(this,X).now():0,r(h,e[h]);});let r=this.ttlAutopurge?(h,c)=>{if(s?.[h]&&(clearTimeout(s[h]),s[h]=void 0),c&&c!==0&&s){let m=setTimeout(()=>{t(this,W).call(this,h)&&l(this,n,nt).call(this,t(this,v)[h],"expire");},c+1);m.unref&&m.unref(),s[h]=m;}}:()=>{};f(this,it,(h,c)=>{if(e[c]){let m=e[c],I=i[c];if(!m||!I)return;h.ttl=m,h.start=I,h.now=o||a();let g=h.now-I;h.remainingTTL=m-g;}});let o=0,a=()=>{let h=t(this,X).now();if(this.ttlResolution>0){o=h;let c=setTimeout(()=>o=0,this.ttlResolution);c.unref&&c.unref();}return h};this.getRemainingTTL=h=>{let c=t(this,R).get(h);if(c===void 0)return 0;let m=e[c],I=i[c];if(!m||!I)return 1/0;let g=(o||a())-I;return m-g},f(this,W,h=>{let c=i[h],m=e[h];return !!m&&!!c&&(o||a())-c>m});},ut=new WeakMap,it=new WeakMap,vt=new WeakMap,W=new WeakMap,Zt=function(){let e=new Ft(t(this,$));f(this,J,0),f(this,Q,e),f(this,ft,i=>{f(this,J,t(this,J)-e[i]),e[i]=0;}),f(this,xt,(i,s,r,o)=>{if(l(this,n,w).call(this,s))return 0;if(!rt(r))if(o){if(typeof o!="function")throw new TypeError("sizeCalculation must be a function");if(r=o(s,i),!rt(r))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return r}),f(this,bt,(i,s,r)=>{if(e[i]=s,t(this,z)){let o=t(this,z)-e[i];for(;t(this,J)>o;)l(this,n,Ct).call(this,true);}f(this,J,t(this,J)+e[i]),r&&(r.entrySize=s,r.totalCalculatedSize=t(this,J));});},ft=new WeakMap,bt=new WeakMap,xt=new WeakMap,at=function*({allowStale:e=this.allowStale}={}){if(t(this,D))for(let i=t(this,N);!(!l(this,n,Pt).call(this,i)||((e||!t(this,W).call(this,i))&&(yield i),i===t(this,C)));)i=t(this,Y)[i];},ot=function*({allowStale:e=this.allowStale}={}){if(t(this,D))for(let i=t(this,C);!(!l(this,n,Pt).call(this,i)||((e||!t(this,W).call(this,i))&&(yield i),i===t(this,N)));)i=t(this,V)[i];},Pt=function(e){return e!==void 0&&t(this,R).get(t(this,v)[e])===e},Ct=function(e){var o;let i=t(this,C),s=t(this,v)[i],r=t(this,p)[i];return t(this,lt)&&l(this,n,w).call(this,r)?r.__abortController.abort(new Error("evicted")):(t(this,tt)||t(this,L))&&(t(this,tt)&&((o=t(this,k))==null||o.call(this,r,s,"evict")),t(this,L)&&t(this,F)?.push([r,s,"evict"])),t(this,ft).call(this,i),t(this,K)?.[i]&&(clearTimeout(t(this,K)[i]),t(this,K)[i]=void 0),e&&(t(this,v)[i]=void 0,t(this,p)[i]=void 0,t(this,q).push(i)),t(this,D)===1?(f(this,C,f(this,N,0)),t(this,q).length=0):f(this,C,t(this,V)[i]),t(this,R).delete(s),It(this,D)._--,i},Mt=function(e,i,s,r){let o=i===void 0?void 0:t(this,p)[i];if(l(this,n,w).call(this,o))return o;let a=new Gt,{signal:h}=s;h?.addEventListener("abort",()=>a.abort(h.reason),{signal:a.signal});let c={signal:a.signal,options:s,context:r},m=(y,O=false)=>{let{aborted:_}=a.signal,M=s.ignoreFetchAbort&&y!==void 0,U=s.ignoreFetchAbort||!!(s.allowStaleOnFetchAbort&&y!==void 0);if(s.status&&(_&&!O?(s.status.fetchAborted=true,s.status.fetchError=a.signal.reason,M&&(s.status.fetchAbortIgnored=true)):s.status.fetchResolved=true),_&&!M&&!O)return g(a.signal.reason,U);let G=b,x=t(this,p)[i];return (x===b||M&&O&&x===void 0)&&(y===void 0?G.__staleWhileFetching!==void 0?t(this,p)[i]=G.__staleWhileFetching:l(this,n,nt).call(this,e,"fetch"):(s.status&&(s.status.fetchUpdated=true),this.set(e,y,c.options))),y},I=y=>(s.status&&(s.status.fetchRejected=true,s.status.fetchError=y),g(y,false)),g=(y,O)=>{let{aborted:_}=a.signal,M=_&&s.allowStaleOnFetchAbort,U=M||s.allowStaleOnFetchRejection,G=U||s.noDeleteOnFetchRejection,x=b;if(t(this,p)[i]===b&&(!G||!O&&x.__staleWhileFetching===void 0?l(this,n,nt).call(this,e,"fetch"):M||(t(this,p)[i]=x.__staleWhileFetching)),U)return s.status&&x.__staleWhileFetching!==void 0&&(s.status.returnedStale=true),x.__staleWhileFetching;if(x.__returned===x)throw y},A=(y,O)=>{var M;let _=(M=t(this,mt))==null?void 0:M.call(this,e,o,c);_&&_ instanceof Promise&&_.then(U=>y(U===void 0?void 0:U),O),a.signal.addEventListener("abort",()=>{(!s.ignoreFetchAbort||s.allowStaleOnFetchAbort)&&(y(void 0),s.allowStaleOnFetchAbort&&(y=U=>m(U,true)));});};s.status&&(s.status.fetchDispatched=true);let b=new Promise(A).then(m,I),T=Object.assign(b,{__abortController:a,__staleWhileFetching:o,__returned:void 0});return i===void 0?(this.set(e,T,{...c.options,status:void 0}),i=t(this,R).get(e)):t(this,p)[i]=T,T},w=function(e){if(!t(this,lt))return false;let i=e;return !!i&&i instanceof Promise&&i.hasOwnProperty("__staleWhileFetching")&&i.__abortController instanceof Gt},Kt=function(e,i){t(this,Y)[i]=e,t(this,V)[e]=i;},wt=function(e){e!==t(this,N)&&(e===t(this,C)?f(this,C,t(this,V)[e]):l(this,n,Kt).call(this,t(this,Y)[e],t(this,V)[e]),l(this,n,Kt).call(this,t(this,N),e),f(this,N,e));},nt=function(e,i){var r,o;let s=false;if(t(this,D)!==0){let a=t(this,R).get(e);if(a!==void 0)if(t(this,K)?.[a]&&(clearTimeout(t(this,K)?.[a]),t(this,K)[a]=void 0),s=true,t(this,D)===1)l(this,n,Wt).call(this,i);else {t(this,ft).call(this,a);let h=t(this,p)[a];if(l(this,n,w).call(this,h)?h.__abortController.abort(new Error("deleted")):(t(this,tt)||t(this,L))&&(t(this,tt)&&((r=t(this,k))==null||r.call(this,h,e,i)),t(this,L)&&t(this,F)?.push([h,e,i])),t(this,R).delete(e),t(this,v)[a]=void 0,t(this,p)[a]=void 0,a===t(this,N))f(this,N,t(this,Y)[a]);else if(a===t(this,C))f(this,C,t(this,V)[a]);else {let c=t(this,Y)[a];t(this,V)[c]=t(this,V)[a];let m=t(this,V)[a];t(this,Y)[m]=t(this,Y)[a];}It(this,D)._--,t(this,q).push(a);}}if(t(this,L)&&t(this,F)?.length){let a=t(this,F),h;for(;h=a?.shift();)(o=t(this,B))==null||o.call(this,...h);}return s},Wt=function(e){var i,s;for(let r of l(this,n,ot).call(this,{allowStale:true})){let o=t(this,p)[r];if(l(this,n,w).call(this,o))o.__abortController.abort(new Error("deleted"));else {let a=t(this,v)[r];t(this,tt)&&((i=t(this,k))==null||i.call(this,o,a,e)),t(this,L)&&t(this,F)?.push([o,a,e]);}}if(t(this,R).clear(),t(this,p).fill(void 0),t(this,v).fill(void 0),t(this,P)&&t(this,Z)){t(this,P).fill(0),t(this,Z).fill(0);for(let r of t(this,K)??[])r!==void 0&&clearTimeout(r);t(this,K)?.fill(void 0);}if(t(this,Q)&&t(this,Q).fill(0),f(this,C,0),f(this,N,0),t(this,q).length=0,f(this,J,0),f(this,D,0),t(this,L)&&t(this,F)){let r=t(this,F),o;for(;o=r?.shift();)(s=t(this,B))==null||s.call(this,...o);}},At);var yt=class{constructor(e){E(this,"cache");E(this,"map",new Map);this.cache=new Qt({max:e.cacheSize}),this.map=new Map;}get[Symbol.iterator](){return this.map[Symbol.iterator]}get[Symbol.toStringTag](){return this.map[Symbol.toStringTag]}clear(){this.cache.clear(),this.map.clear();}delete(e){let i=this.map.delete(e);return i&&this.cache.delete(e),i}get forEach(){return this.map.forEach}get(e){let i=this.cache.get(e);return i||this.map.get(e)}has(e){return this.map.has(e)}set(e,i){return this.map.set(e,i),this.cache.set(e,i),this}get size(){return this.map.size}entries(){return this.map.entries()}keys(){return this.map.keys()}values(){return this.map.values()}};var pt;(r=>(r.log=(o,...a)=>console.log(`[Pixi\u2019VN] ${o}`,...a),r.warn=(o,...a)=>console.warn(`[Pixi\u2019VN] ${o}`,...a),r.error=(o,...a)=>console.error(`[Pixi\u2019VN] ${o}`,...a),r.info=(o,...a)=>console.info(`[Pixi\u2019VN] ${o}`,...a)))(pt||(pt={}));function Rt(u){try{if(typeof u>"u")return u;let e=JSON.stringify(u);return JSON.parse(e)}catch(e){throw pt.error("Error creating exportable element",u,e),new core.PixiError("not_json_serializable","Error creating exportable element")}}var Ht;(g=>{g.storage=new yt({cacheSize:50}),g.defaultStorage=new yt({cacheSize:10}),g.tempStorageDeadlines=new Map;let s;function r(A){g.tempStorageDeadlines.forEach((b,T)=>{b>A&&(g.storage.delete(`${ht}:${T}`),s?.onClearOldTempVariable?.(T),g.tempStorageDeadlines.delete(T));});}g.clearOldTempVariables=r;function o(A){s=A;}g.setExternalStoreHandler=o;function a(A,b,T){T==null?g.storage.delete(`${A}:${b}`):g.storage.set(`${A}:${b}`,T),s?.onSetVariable?.(b,T);}g.setVariable=a;function h(A,b){let T=g.storage.get(`${A}:${b}`);return Rt(T)}g.getVariable=h;function c(A,b){g.storage.delete(`${A}:${b}`),s?.onRemoveVariable?.(b);}g.removeVariable=c;function m(A,b){let T=g.storage.get(Nt)||[];if(b)T.includes(A)||T.push(A);else {let y=T.indexOf(A);y>-1&&T.splice(y,1);}g.storage.set(Nt,T);}g.setFlag=m;function I(A){return (g.storage.get(Nt)||[]).includes(A)}g.getFlag=I;})(Ht||(Ht={}));var S=Ht;var Dt=class{get base(){return S.storage.map}get cache(){return S.storage.cache}get tempStorageDeadlines(){return S.tempStorageDeadlines}set default(e){Object.entries(e).forEach(([i,s])=>{S.defaultStorage.map.set(i,s);});}set(e,i){return S.setVariable(st,e,i)}get(e){let i=S.getVariable(ht,e);return i===void 0&&(i=S.getVariable(st,e)),i===void 0&&(i=Rt(S.defaultStorage.get(e))),i}remove(e){return this.removeTempVariable(e),S.removeVariable(st,e)}setTempVariable(e,i){if(i==null){this.removeTempVariable(e);return}else S.setVariable(ht,e,i),this.tempStorageDeadlines.has(e)||this.tempStorageDeadlines.set(e,core.GameUnifier.openedLabels);}removeTempVariable(e){S.removeVariable(ht,e),this.tempStorageDeadlines.has(e)&&this.tempStorageDeadlines.delete(e);}setFlag(e,i){return S.setFlag(e,i)}getFlag(e){return S.getFlag(e)}setStorageHandler(e){S.setExternalStoreHandler(e);}clear(){this.base.clear(),this.cache.clear(),this.tempStorageDeadlines.clear();}export(){let e=[];[...this.base.keys()].forEach(s=>{e.push({key:s,value:this.base.get(s)});});let i=[];return [...S.tempStorageDeadlines.keys()].forEach(s=>{i.push({key:s,value:this.tempStorageDeadlines.get(s)});}),Rt({main:e,tempDeadlines:i})}restore(e){this.clear();try{e?(e.base?.forEach(i=>{switch(i.key){case "___current_dialogue_memory___":S.setVariable(H,j.CURRENT_DIALOGUE_MEMORY_KEY,i.value);break;case "___last_dialogue_added_in_step_memory___":S.setVariable(H,j.LAST_DIALOGUE_ADDED_IN_STEP_MEMORY_KEY,i.value);break;case "___current_menu_options_memory___":S.setVariable(H,j.CURRENT_MENU_OPTIONS_MEMORY_KEY,i.value);break;case "___last_menu_options_added_in_step_memory___":S.setVariable(H,j.LAST_MENU_OPTIONS_ADDED_IN_STEP_MEMORY_KEY,i.value);break;case "_input_value_":S.setVariable(H,j.CURRENT_INPUT_VALUE_MEMORY_KEY,i.value);break;case "___last_input_added_in_step_memory___":S.setVariable(H,j.LAST_INPUT_ADDED_IN_STEP_MEMORY_KEY,i.value);break;case "___current_input_info_memory___":S.setVariable(H,j.CURRENT_INPUT_INFO_MEMORY_KEY,i.value);break;case "___opened_labels_counter___":S.setVariable(H,j.OPENED_LABELS_COUNTER_KEY,i.value);break;case "___all_choices_made___":S.setVariable(H,j.ALL_CHOICES_MADE_KEY,i.value);break;case "___current_step_times_counter___":S.setVariable(H,j.CURRENT_STEP_TIMES_COUNTER_KEY,i.value);break;case "___last_step_glued___":S.setVariable(H,j.LAST_STEP_GLUED,i.value);break;default:S.setVariable(st,i.key,i.value);}}),e.temp?.forEach(i=>{S.setVariable(ht,i.key,i.value);}),e.flags?.forEach(i=>{S.setFlag(i,!0);}),e.main?.forEach(i=>{this.base.set(i.key,i.value);}),e.tempDeadlines?.forEach(i=>{this.tempStorageDeadlines.set(i.key,i.value);})):pt.warn("No storage data found");}catch(i){pt.error("Error importing data",i);}}};var Vt=class{constructor(e,i){E(this,"id");E(this,"categoryId");this.categoryId=e,this.id=i,this.migrateOldStorage();}migrateOldStorage(e=this.categoryId){let i=S.getVariable(st,e);i&&(Object.entries(i).forEach(([s,r])=>{typeof r=="object"&&r!==null&&Object.entries(r).forEach(([o,a])=>{S.setVariable(this.categoryId,`${s}:${o}`,a);});}),S.removeVariable(st,e));}setStorageProperty(e,i){S.setVariable(this.categoryId,`${this.id}:${e}`,i);}getStorageProperty(e,i=this.id){return S.getVariable(this.categoryId,`${i}:${e}`)}};var Ve=new Dt;exports.StorageRegistry=S;exports.StoredClassModel=Vt;exports.storage=Ve;
@@ -1,7 +1,7 @@
1
1
  import { LRUCache } from 'lru-cache';
2
- import { a as StorageElementType } from './StorageElementType-DkJ394kq.cjs';
3
- export { S as StorageObjectType } from './StorageElementType-DkJ394kq.cjs';
4
- export { S as StoredClassModel } from './StoredClassModel-LtyakzOw.cjs';
2
+ import { S as StorageElementType } from './StorageElementType-C7ETezlL.cjs';
3
+ export { a as StorageObjectType } from './StorageElementType-C7ETezlL.cjs';
4
+ export { S as StoredClassModel } from './StoredClassModel-C9mQxPg-.cjs';
5
5
  import { C as CachedMap } from './CachedMap-DZLvJAnA.cjs';
6
6
 
7
7
  interface StorageExternalStoreHandler {
package/dist/storage.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { LRUCache } from 'lru-cache';
2
- import { a as StorageElementType } from './StorageElementType-DkJ394kq.js';
3
- export { S as StorageObjectType } from './StorageElementType-DkJ394kq.js';
4
- export { S as StoredClassModel } from './StoredClassModel-a4pvgJXD.js';
2
+ import { S as StorageElementType } from './StorageElementType-C7ETezlL.js';
3
+ export { a as StorageObjectType } from './StorageElementType-C7ETezlL.js';
4
+ export { S as StoredClassModel } from './StoredClassModel-upXPNQTp.js';
5
5
  import { C as CachedMap } from './CachedMap-DZLvJAnA.js';
6
6
 
7
7
  interface StorageExternalStoreHandler {
package/dist/storage.mjs CHANGED
@@ -1 +1 @@
1
- export{a as StorageRegistry,b as StoredClassModel,c as storage}from'./chunk-36I5IN5S.mjs';import'./chunk-IWAXXFXE.mjs';import'./chunk-Z4GZCINS.mjs';
1
+ export{a as StorageRegistry,b as StoredClassModel,c as storage}from'./chunk-V34PMA2H.mjs';import'./chunk-IWAXXFXE.mjs';import'./chunk-Z4GZCINS.mjs';
@@ -1 +1 @@
1
- 'use strict';var canvas=require('@drincs/pixi-vn/canvas'),characters=require('@drincs/pixi-vn/characters'),narration=require('@drincs/pixi-vn/narration'),l=require('@drincs/pixi-vn/pixi.js');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var l__default=/*#__PURE__*/_interopDefault(l);var o="/__pixi-vn/characters",i="/__pixi-vn/labels",a="/__pixi-vn/assets/manifest",c="/__pixi-vn/canvas-options";function f(){try{return new Function('return typeof import !== "undefined" && typeof import.meta !== "undefined" && import.meta.env?.DEV === true')()}catch{return false}}function r(t,n,s="data"){try{fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)}).catch(e=>{console.warn(`Failed to send ${s} to ${t}:`,e);});}catch(e){console.warn(`Error sending ${s} to ${t}:`,e);}}function m(){let t=l__default.default.Assets.resolver._assetMap,n=l__default.default.Assets.resolver._bundles;return {bundles:Object.entries(n).map(([s,e])=>({name:s,assets:e.flatMap(_=>t[_]??[])}))}}function P(){if(f()){try{let t=characters.RegisteredCharacters.values();r(o,t,"characters");}catch(t){console.warn("Error collecting characters:",t);}try{let t=narration.RegisteredLabels.keys();r(i,t,"labels");}catch(t){console.warn("Error collecting labels:",t);}try{let t=m();r(a,t,"assets manifest");}catch(t){console.warn("Error collecting assets manifest:",t);}try{let t={height:canvas.canvas.app.screen.height,width:canvas.canvas.app.screen.width};r(c,t,"canvas options");}catch(t){console.warn("Error collecting canvas options:",t);}}}exports.setupPixivnViteData=P;
1
+ 'use strict';var canvas=require('@drincs/pixi-vn/canvas'),characters=require('@drincs/pixi-vn/characters'),narration=require('@drincs/pixi-vn/narration'),l=require('@drincs/pixi-vn/pixi.js');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var l__default=/*#__PURE__*/_interopDefault(l);var i="/__pixi-vn/characters",a="/__pixi-vn/labels",c="/__pixi-vn/assets/manifest",p="/__pixi-vn/canvas-options";async function e(t,s,r="data"){try{await fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});}catch(n){console.warn(`Failed to send ${r} to ${t}:`,n);}}function d(){let t=l__default.default.Assets.resolver._assetMap,s=l__default.default.Assets.resolver._bundles;return {bundles:Object.entries(s).map(([r,n])=>({name:r,assets:n.flatMap(I=>t[I]??[])}))}}function _(){return typeof window>"u"||typeof document>"u"?false:!!document.querySelector('script[src^="/@vite/client"]')}async function m(){if(_()){try{let t=characters.RegisteredCharacters.values();await e(i,t,"characters");}catch(t){console.warn("Error collecting characters:",t);}try{let t=narration.RegisteredLabels.keys();await e(a,t,"labels");}catch(t){console.warn("Error collecting labels:",t);}try{let t=d();await e(c,t,"assets manifest");}catch(t){console.warn("Error collecting assets manifest:",t);}if(canvas.canvas.isInitialized)try{let t={height:canvas.canvas.app.screen.height,width:canvas.canvas.app.screen.width};await e(p,t,"canvas options");}catch(t){console.warn("Error collecting canvas options:",t);}}}exports.isViteDevelopmentMode=_;exports.setupPixivnViteData=m;
@@ -1,3 +1,12 @@
1
+ /**
2
+ * Checks if the current runtime is Vite development mode.
3
+ * Detects Vite dev client script injected in development.
4
+ * Assumes default Vite client path starts with `/@vite/client`.
5
+ *
6
+ * @returns {boolean}
7
+ * @public
8
+ */
9
+ declare function isViteDevelopmentMode(): boolean;
1
10
  /**
2
11
  * Initializes Pixi VN development tools by syncing game state with the Vite dev server.
3
12
  * Sends registered characters, labels, assets manifest, and canvas options.
@@ -14,12 +23,12 @@
14
23
  *
15
24
  * await Promise.all([import("@/content")]);
16
25
  * // After game setup
17
- * setupPixivnViteData();
26
+ * await setupPixivnViteData();
18
27
  * ```
19
28
  *
20
- * @returns {void}
29
+ * @returns {Promise<void>}
21
30
  * @public
22
31
  */
23
- declare function setupPixivnViteData(): void;
32
+ declare function setupPixivnViteData(): Promise<void>;
24
33
 
25
- export { setupPixivnViteData };
34
+ export { isViteDevelopmentMode, setupPixivnViteData };
@@ -1,3 +1,12 @@
1
+ /**
2
+ * Checks if the current runtime is Vite development mode.
3
+ * Detects Vite dev client script injected in development.
4
+ * Assumes default Vite client path starts with `/@vite/client`.
5
+ *
6
+ * @returns {boolean}
7
+ * @public
8
+ */
9
+ declare function isViteDevelopmentMode(): boolean;
1
10
  /**
2
11
  * Initializes Pixi VN development tools by syncing game state with the Vite dev server.
3
12
  * Sends registered characters, labels, assets manifest, and canvas options.
@@ -14,12 +23,12 @@
14
23
  *
15
24
  * await Promise.all([import("@/content")]);
16
25
  * // After game setup
17
- * setupPixivnViteData();
26
+ * await setupPixivnViteData();
18
27
  * ```
19
28
  *
20
- * @returns {void}
29
+ * @returns {Promise<void>}
21
30
  * @public
22
31
  */
23
- declare function setupPixivnViteData(): void;
32
+ declare function setupPixivnViteData(): Promise<void>;
24
33
 
25
- export { setupPixivnViteData };
34
+ export { isViteDevelopmentMode, setupPixivnViteData };
@@ -1 +1 @@
1
- import {a,b,c,d}from'./chunk-3BBZHKU4.mjs';import'./chunk-TTRUPDAB.mjs';import {canvas}from'@drincs/pixi-vn/canvas';import {RegisteredCharacters}from'@drincs/pixi-vn/characters';import {RegisteredLabels}from'@drincs/pixi-vn/narration';import p from'@drincs/pixi-vn/pixi.js';function u(){try{return new Function('return typeof import !== "undefined" && typeof import.meta !== "undefined" && import.meta.env?.DEV === true')()}catch{return false}}function s(t,n,r="data"){try{fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)}).catch(e=>{console.warn(`Failed to send ${r} to ${t}:`,e);});}catch(e){console.warn(`Error sending ${r} to ${t}:`,e);}}function h(){let t=p.Assets.resolver._assetMap,n=p.Assets.resolver._bundles;return {bundles:Object.entries(n).map(([r,e])=>({name:r,assets:e.flatMap(f=>t[f]??[])}))}}function A(){if(u()){try{let t=RegisteredCharacters.values();s(a,t,"characters");}catch(t){console.warn("Error collecting characters:",t);}try{let t=RegisteredLabels.keys();s(b,t,"labels");}catch(t){console.warn("Error collecting labels:",t);}try{let t=h();s(c,t,"assets manifest");}catch(t){console.warn("Error collecting assets manifest:",t);}try{let t={height:canvas.app.screen.height,width:canvas.app.screen.width};s(d,t,"canvas options");}catch(t){console.warn("Error collecting canvas options:",t);}}}export{A as setupPixivnViteData};
1
+ import {a,b,c,d}from'./chunk-3BBZHKU4.mjs';import'./chunk-K7JIC2F2.mjs';import {canvas}from'@drincs/pixi-vn/canvas';import {RegisteredCharacters}from'@drincs/pixi-vn/characters';import {RegisteredLabels}from'@drincs/pixi-vn/narration';import p from'@drincs/pixi-vn/pixi.js';async function t(e,s,r="data"){try{await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});}catch(o){console.warn(`Failed to send ${r} to ${e}:`,o);}}function A(){let e=p.Assets.resolver._assetMap,s=p.Assets.resolver._bundles;return {bundles:Object.entries(s).map(([r,o])=>({name:r,assets:o.flatMap(d=>e[d]??[])}))}}function f(){return typeof window>"u"||typeof document>"u"?false:!!document.querySelector('script[src^="/@vite/client"]')}async function h(){if(f()){try{let e=RegisteredCharacters.values();await t(a,e,"characters");}catch(e){console.warn("Error collecting characters:",e);}try{let e=RegisteredLabels.keys();await t(b,e,"labels");}catch(e){console.warn("Error collecting labels:",e);}try{let e=A();await t(c,e,"assets manifest");}catch(e){console.warn("Error collecting assets manifest:",e);}if(canvas.isInitialized)try{let e={height:canvas.app.screen.height,width:canvas.app.screen.width};await t(d,e,"canvas options");}catch(e){console.warn("Error collecting canvas options:",e);}}}export{f as isViteDevelopmentMode,h as setupPixivnViteData};
package/dist/vite.cjs CHANGED
@@ -1 +1 @@
1
- 'use strict';var s="/__pixi-vn/characters",o="/__pixi-vn/labels",a="/__pixi-vn/assets/manifest",_="/__pixi-vn/canvas-options";var p=null,c=null,u=null,A=null;function S(){let t=(e,r)=>(i,n)=>{if(n.setHeader("Content-Type","application/json"),i.method==="GET"){if(e.current===null){n.statusCode=404,n.end(JSON.stringify({error:`${r} not initialized`}));return}n.statusCode=200,n.end(JSON.stringify(e.current));return}if(i.method==="POST"){let l="";i.on("data",I=>l+=I),i.on("end",()=>{try{e.current=JSON.parse(l),n.statusCode=201,n.end(JSON.stringify({message:`${r} updated successfully`}));}catch{n.statusCode=400,n.end(JSON.stringify({error:`Invalid JSON format for ${r}`}));}});}};return {name:"vite-plugin-pixi-vn",apply:"serve",configureServer(e){e.middlewares.use(s,t({current:p},"Characters")),e.middlewares.use(o,t({current:c},"Labels")),e.middlewares.use(a,t({current:u},"Manifest")),e.middlewares.use(_,t({current:A},"Canvas options"));}}}exports.PIXIVN_DEV_API_ASSETS_MANIFEST=a;exports.PIXIVN_DEV_API_CANVAS_OPTIONS=_;exports.PIXIVN_DEV_API_CHARACTERS=s;exports.PIXIVN_DEV_API_LABELS=o;exports.vitePluginPixivn=S;
1
+ 'use strict';var fs=require('fs'),tinyglobby=require('tinyglobby');var D=Object.create;var V=Object.defineProperty;var F=Object.getOwnPropertyDescriptor;var X=Object.getOwnPropertyNames;var k=Object.getPrototypeOf,$=Object.prototype.hasOwnProperty;var G=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var J=(e,t,s,c)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of X(t))!$.call(e,i)&&i!==s&&V(e,i,{get:()=>t[i],enumerable:!(c=F(t,i))||c.enumerable});return e};var H=(e,t,s)=>(s=e!=null?D(k(e)):{},J(V(s,"default",{value:e,enumerable:true}),e));var N=G((q,S)=>{var f=process||{},O=f.argv||[],u=f.env||{},j=!(u.NO_COLOR||O.includes("--no-color"))&&(!!u.FORCE_COLOR||O.includes("--color")||f.platform==="win32"||(f.stdout||{}).isTTY&&u.TERM!=="dumb"||!!u.CI),z=(e,t,s=e)=>c=>{let i=""+c,a=i.indexOf(t,e.length);return ~a?e+Y(i,t,s,a)+t:e+i+t},Y=(e,t,s,c)=>{let i="",a=0;do i+=e.substring(a,c)+s,a=c+t.length,c=e.indexOf(t,a);while(~c);return i+e.substring(a)},R=(e=j)=>{let t=e?z:()=>String;return {isColorSupported:e,reset:t("\x1B[0m","\x1B[0m"),bold:t("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:t("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:t("\x1B[3m","\x1B[23m"),underline:t("\x1B[4m","\x1B[24m"),inverse:t("\x1B[7m","\x1B[27m"),hidden:t("\x1B[8m","\x1B[28m"),strikethrough:t("\x1B[9m","\x1B[29m"),black:t("\x1B[30m","\x1B[39m"),red:t("\x1B[31m","\x1B[39m"),green:t("\x1B[32m","\x1B[39m"),yellow:t("\x1B[33m","\x1B[39m"),blue:t("\x1B[34m","\x1B[39m"),magenta:t("\x1B[35m","\x1B[39m"),cyan:t("\x1B[36m","\x1B[39m"),white:t("\x1B[37m","\x1B[39m"),gray:t("\x1B[90m","\x1B[39m"),bgBlack:t("\x1B[40m","\x1B[49m"),bgRed:t("\x1B[41m","\x1B[49m"),bgGreen:t("\x1B[42m","\x1B[49m"),bgYellow:t("\x1B[43m","\x1B[49m"),bgBlue:t("\x1B[44m","\x1B[49m"),bgMagenta:t("\x1B[45m","\x1B[49m"),bgCyan:t("\x1B[46m","\x1B[49m"),bgWhite:t("\x1B[47m","\x1B[49m"),blackBright:t("\x1B[90m","\x1B[39m"),redBright:t("\x1B[91m","\x1B[39m"),greenBright:t("\x1B[92m","\x1B[39m"),yellowBright:t("\x1B[93m","\x1B[39m"),blueBright:t("\x1B[94m","\x1B[39m"),magentaBright:t("\x1B[95m","\x1B[39m"),cyanBright:t("\x1B[96m","\x1B[39m"),whiteBright:t("\x1B[97m","\x1B[39m"),bgBlackBright:t("\x1B[100m","\x1B[49m"),bgRedBright:t("\x1B[101m","\x1B[49m"),bgGreenBright:t("\x1B[102m","\x1B[49m"),bgYellowBright:t("\x1B[103m","\x1B[49m"),bgBlueBright:t("\x1B[104m","\x1B[49m"),bgMagentaBright:t("\x1B[105m","\x1B[49m"),bgCyanBright:t("\x1B[106m","\x1B[49m"),bgWhiteBright:t("\x1B[107m","\x1B[49m")}};S.exports=R();S.exports.createColors=R;});var p="/__pixi-vn/characters",I="/__pixi-vn/labels",v="/__pixi-vn/assets/manifest",_="/__pixi-vn/canvas-options";var y=H(N());var L=y.default.cyan("(pixi-vn)");function P(e){return e?Array.isArray(e)?e:[e]:[]}function W(e){let t=[],s=[];for(let c of e)try{let i=fs.readFileSync(c,"utf-8"),a=/newLabel\(\s*["']([^"']+)["']/g,d;for(;(d=a.exec(i))!==null;)s.push(d[1]);let g=/new\s+\w*[Cc]haracter\(\s*["']([^"']+)["']/g;for(;(d=g.exec(i))!==null;)t.push(d[1]);}catch{}return {charIds:t,labelIds:s}}function K(e){let t,s,c=new Promise(r=>{s=r;}),i=[...P(e?.content),...P(e?.characters),...P(e?.labels)],a=[],d=[],g=new Set,C=[];async function A(r,o=[]){try{a=(await r("@drincs/pixi-vn")).RegisteredCharacters?.values()??[];}catch{a=[];}try{d=(await r("@drincs/pixi-vn")).RegisteredLabels?.keys()??[];}catch{d=[];}if(o.length>0){let{charIds:n,labelIds:m}=W(o),h=new Set(a.map(b=>b.id)),M=new Set(d);for(let b of n)h.has(b)||a.push({id:b});for(let b of m)M.has(b)||d.push(b);}let l=a.map(n=>n.id).join(", ")||"none";t?.logger.info(`${L} ${y.default.dim(`${a.length} character(s): [${l}], ${d.length} label(s)`)}`,{timestamp:true});}async function w(r,o){let l=await tinyglobby.glob(i,{cwd:o,absolute:true,onlyFiles:true}),n=[];for(let m of l){g.add(m);try{await r(m);}catch{n.push(m);}}await A(r,n),s();}async function T(r){for(let n of g)for(let m of r.moduleGraph.getModulesByFile(n)??[])r.moduleGraph.invalidateModule(m);try{(await r.ssrLoadModule("@drincs/pixi-vn/characters")).registeredCharacters?.clear?.();}catch{}let o=await tinyglobby.glob(i,{cwd:t.root,absolute:true,onlyFiles:true}),l=[];for(let n of o){g.add(n);try{await r.ssrLoadModule(n);}catch{l.push(n);}}await A(n=>r.ssrLoadModule(n),l);for(let n of C)n();}let E={characters:null,labels:null,manifest:null,canvasOptions:null};function x(r,o){return (l,n)=>{if(n.setHeader("Content-Type","application/json"),l.method==="GET"){let m=E[r];if(m===null){n.statusCode=404,n.end(JSON.stringify({error:`${o} not initialized`}));return}n.statusCode=200,n.end(JSON.stringify(m));return}if(l.method==="POST"){let m="";l.on("data",h=>{m+=h.toString();}),l.on("end",()=>{try{E[r]=JSON.parse(m),n.statusCode=201,n.end(JSON.stringify({message:`${o} updated successfully`}));}catch{n.statusCode=400,n.end(JSON.stringify({error:`Invalid JSON format for ${o}`}));}});}}}return {name:"vite-plugin-pixi-vn",enforce:"pre",api:{contentLoaded:c,get characters(){return a},onReload(r){C.push(r);}},configResolved(r){t=r,i.length===0&&s();},async buildStart(){if(t?.command!=="build"||i.length===0)return;let{createServer:r}=await import('vite'),o=await r({root:t.root,configFile:false,server:{middlewareMode:true},appType:"custom",logLevel:"silent",optimizeDeps:{noDiscovery:true}});try{await w(l=>o.ssrLoadModule(l),t.root);}catch{s();}finally{await o.close();}},configureServer(r){i.length>0&&w(o=>r.ssrLoadModule(o),t.root).catch(()=>{s();}),r.middlewares.use(p,x("characters","Characters")),r.middlewares.use(I,x("labels","Labels")),r.middlewares.use(v,x("manifest","Manifest")),r.middlewares.use(_,x("canvasOptions","Canvas options"));},hotUpdate({file:r,server:o}){if(i.length>0&&g.has(r))return T(o).catch(l=>{t?.logger.error(`${L} Failed to reload content.`,{error:l instanceof Error?l:new Error(String(l)),timestamp:true});}),[]}}}exports.PIXIVN_DEV_API_ASSETS_MANIFEST=v;exports.PIXIVN_DEV_API_CANVAS_OPTIONS=_;exports.PIXIVN_DEV_API_CHARACTERS=p;exports.PIXIVN_DEV_API_LABELS=I;exports.vitePluginPixivn=K;
package/dist/vite.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { IncomingMessage, ServerResponse } from 'node:http';
1
+ import { Plugin } from 'vite';
2
2
 
3
3
  /** @const {string} API endpoint for characters data - GET to retrieve, POST to update */
4
4
  declare const PIXIVN_DEV_API_CHARACTERS = "/__pixi-vn/characters";
@@ -10,54 +10,84 @@ declare const PIXIVN_DEV_API_ASSETS_MANIFEST = "/__pixi-vn/assets/manifest";
10
10
  declare const PIXIVN_DEV_API_CANVAS_OPTIONS = "/__pixi-vn/canvas-options";
11
11
 
12
12
  /**
13
- * Represents a Vite plugin configuration object.
14
- * Defines the structure for registering middleware and handling server requests.
15
- *
16
- * @typedef {Object} Plugin
17
- * @property {string} name - Unique identifier for the plugin
18
- * @property {"serve"} apply - Plugin application scope (development server only)
19
- * @property {Function} configureServer - Middleware configuration function
13
+ * Options for {@link vitePluginPixivn}.
20
14
  */
21
- type Plugin = {
22
- name: string;
23
- apply: "serve";
24
- configureServer: (server: {
25
- middlewares: {
26
- use: (path: string, handler: (req: IncomingMessage, res: ServerResponse) => void) => void;
27
- };
28
- }) => void;
29
- };
15
+ interface VitePluginPixivnOptions {
16
+ /**
17
+ * Glob / path of module(s) that set up all game content as side effects:
18
+ * characters, labels, hashtag-command handlers, text-replace handlers, etc.
19
+ *
20
+ * The plugin loads these files server-side (via Vite SSR) at startup so that
21
+ * every downstream plugin that depends on the registered data — most notably
22
+ * `vitePluginInk` for JSON compilation — has the full registry available
23
+ * before it runs. This also works during `vite build`.
24
+ *
25
+ * Pointing to a barrel file that re-exports everything is the simplest option.
26
+ * All patterns are resolved relative to Vite `root`.
27
+ *
28
+ * @example "./src/content/index.ts"
29
+ * @example "./src/content/*.ts"
30
+ */
31
+ content?: string | string[];
32
+ /**
33
+ * Glob / path of module(s) whose side effects register characters via
34
+ * `RegisteredCharacters.add(...)`.
35
+ *
36
+ * Use when characters are defined separately from other content.
37
+ *
38
+ * @example "./src/characters.ts"
39
+ */
40
+ characters?: string | string[];
41
+ /**
42
+ * Glob / path of module(s) whose side effects register narration labels via
43
+ * `RegisteredLabels.register(...)`.
44
+ *
45
+ * @example "./src/*.label.ts"
46
+ */
47
+ labels?: string | string[];
48
+ }
30
49
  /**
31
- * Creates a Vite development server plugin for Pixi VN integration.
50
+ * Creates a Vite plugin for Pixi'VN integration.
51
+ *
52
+ * **Static content loading**
53
+ *
54
+ * When {@link VitePluginPixivnOptions.content}, {@link VitePluginPixivnOptions.characters}, or
55
+ * {@link VitePluginPixivnOptions.labels} are provided, the matched files are executed server-side
56
+ * via Vite SSR at startup, populating `RegisteredCharacters`, `RegisteredLabels`, and any other
57
+ * singletons before downstream plugins (such as `vitePluginInk`) run — including during
58
+ * `vite build`.
32
59
  *
33
- * This plugin provides four API endpoints to sync game state between the client
34
- * and the development server. Only active in development mode (serve).
60
+ * **Dev-server HTTP endpoints**
35
61
  *
36
- * **Endpoints:**
37
- * - `GET /__pixi-vn/characters` - Retrieve cached registered characters
38
- * - `POST /__pixi-vn/characters` - Update registered characters from client
39
- * - `GET /__pixi-vn/labels` - Retrieve cached narration labels
40
- * - `POST /__pixi-vn/labels` - Update narration labels from client
41
- * - `GET /__pixi-vn/assets/manifest` - Retrieve PIXI assets manifest
42
- * - `POST /__pixi-vn/assets/manifest` - Update assets manifest from client
43
- * - `GET /__pixi-vn/canvas-options` - Retrieve canvas rendering options
44
- * - `POST /__pixi-vn/canvas-options` - Update canvas options from client
62
+ * - `GET /__pixi-vn/characters` — retrieve registered characters
63
+ * - `POST /__pixi-vn/characters` *(deprecated)* update from client; use the `characters` option instead
64
+ * - `GET /__pixi-vn/labels` retrieve narration labels
65
+ * - `POST /__pixi-vn/labels` *(deprecated)* update from client; use the `labels` / `content` option instead
66
+ * - `GET /__pixi-vn/assets/manifest` retrieve PIXI assets manifest
67
+ * - `POST /__pixi-vn/assets/manifest` update assets manifest from client
68
+ * - `GET /__pixi-vn/canvas-options` retrieve canvas rendering options
69
+ * - `POST /__pixi-vn/canvas-options` update canvas options from client
45
70
  *
46
- * @returns {Plugin} Configured Vite plugin object
71
+ * **Plugin API** (consumed by `vitePluginInk`):
72
+ * - `api.contentLoaded` — `Promise<void>` that resolves once all content modules have finished
73
+ * loading. Await this before generating JSON files.
47
74
  *
48
75
  * @example
49
76
  * ```typescript
50
77
  * // vite.config.ts
51
- * import { defineConfig } from 'vite';
52
- * import { vitePluginPixivn } from '@drincs/pixi-vn/vite';
78
+ * import { defineConfig } from "vite";
79
+ * import { vitePluginPixivn } from "@drincs/pixi-vn/vite";
53
80
  *
54
81
  * export default defineConfig({
55
- * plugins: [vitePluginPixivn()],
82
+ * plugins: [
83
+ * vitePluginPixivn({ content: "./src/content/index.ts" }),
84
+ * ],
56
85
  * });
57
86
  * ```
58
87
  *
59
- * @public
88
+ * @param options - Optional plugin configuration.
89
+ * @returns A Vite plugin.
60
90
  */
61
- declare function vitePluginPixivn(): Plugin;
91
+ declare function vitePluginPixivn(options?: VitePluginPixivnOptions): Plugin;
62
92
 
63
- export { PIXIVN_DEV_API_ASSETS_MANIFEST, PIXIVN_DEV_API_CANVAS_OPTIONS, PIXIVN_DEV_API_CHARACTERS, PIXIVN_DEV_API_LABELS, vitePluginPixivn };
93
+ export { PIXIVN_DEV_API_ASSETS_MANIFEST, PIXIVN_DEV_API_CANVAS_OPTIONS, PIXIVN_DEV_API_CHARACTERS, PIXIVN_DEV_API_LABELS, type VitePluginPixivnOptions, vitePluginPixivn };