@drincs/pixi-vn 1.8.14 → 1.8.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +1 -1
- package/dist/sound.cjs +1 -1
- package/dist/sound.mjs +1 -1
- package/dist/vite.cjs +2 -2
- package/dist/vite.mjs +2 -2
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';Object.defineProperty(exports,'__esModule',{value:true});var nt=require('@drincs/pixi-vn/canvas'),Bt=require('@drincs/pixi-vn/characters'),core=require('@drincs/pixi-vn/core'),et=require('@drincs/pixi-vn/history'),L=require('@drincs/pixi-vn/narration'),pt=require('@drincs/pixi-vn/sound'),G=require('@drincs/pixi-vn/storage'),motion=require('@drincs/pixi-vn/motion');function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var nt__namespace=/*#__PURE__*/_interopNamespace(nt);var Bt__namespace=/*#__PURE__*/_interopNamespace(Bt);var et__namespace=/*#__PURE__*/_interopNamespace(et);var L__namespace=/*#__PURE__*/_interopNamespace(L);var pt__namespace=/*#__PURE__*/_interopNamespace(pt);var G__namespace=/*#__PURE__*/_interopNamespace(G);var Xt=Object.defineProperty;var Jt=h=>{throw TypeError(h)};var ue=(h,e,i)=>e in h?Xt(h,e,{enumerable:true,configurable:true,writable:true,value:i}):h[e]=i;var fe=(h,e)=>{for(var i in e)Xt(h,i,{get:e[i],enumerable:true});};var C=(h,e,i)=>ue(h,typeof e!="symbol"?e+"":e,i),jt=(h,e,i)=>e.has(h)||Jt("Cannot "+i);var t=(h,e,i)=>(jt(h,e,"read from private field"),i?i.call(h):e.get(h)),_=(h,e,i)=>e.has(h)?Jt("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(h):e.set(h,i),u=(h,e,i,s)=>(jt(h,e,"write to private field"),e.set(h,i),i),d=(h,e,i)=>(jt(h,e,"access private method"),i);var Rt=(h,e,i,s)=>({set _(r){u(h,e,r);},get _(){return t(h,e,s)}});var me=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,ee=new Set,Gt=typeof process=="object"&&process?process:{},ie=(h,e,i,s)=>{typeof Gt.emitWarning=="function"?Gt.emitWarning(h,e,i,s):console.error(`[${i}] ${e}: ${h}`);},Nt=globalThis.AbortController,Qt=globalThis.AbortSignal;if(typeof Nt>"u"){Qt=class{onabort;_onabort=[];reason;aborted=false;addEventListener(i,s){this._onabort.push(s);}},Nt=class{constructor(){e();}signal=new Qt;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 h=Gt.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{h&&(h=false,ie("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",e));};}var ge=h=>!ee.has(h);var at=h=>h&&h===Math.floor(h)&&h>0&&isFinite(h),se=h=>at(h)?h<=Math.pow(2,8)?Uint8Array:h<=Math.pow(2,16)?Uint16Array:h<=Math.pow(2,32)?Uint32Array:h<=Number.MAX_SAFE_INTEGER?Dt:null:null,Dt=class extends Array{constructor(h){super(h),this.fill(0);}},it,St,_e=(it=class{heap;length;static create(e){let i=se(e);if(!i)return [];u(it,St,true);let s=new it(e,i);return u(it,St,false),s}constructor(e,i){if(!t(it,St))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new i(e),this.length=0;}push(e){this.heap[this.length++]=e;}pop(){return this.heap[--this.length]}},St=new WeakMap,_(it,St,false),it),Zt,te,K,M,q,ut,$,yt,xt,B,O,X,T,b,m,P,z,N,R,J,D,Q,Z,V,W,tt,dt,j,Et,l,It,ft,ot,Tt,Y,oe,mt,bt,Ot,lt,ht,Mt,Lt,Ct,E,zt,At,ct,Vt,wt,re=(wt=class{constructor(e){_(this,l);_(this,K);_(this,M);_(this,q);_(this,ut);_(this,$);_(this,yt);_(this,xt);_(this,B);C(this,"ttl");C(this,"ttlResolution");C(this,"ttlAutopurge");C(this,"updateAgeOnGet");C(this,"updateAgeOnHas");C(this,"allowStale");C(this,"noDisposeOnSet");C(this,"noUpdateTTL");C(this,"maxEntrySize");C(this,"sizeCalculation");C(this,"noDeleteOnFetchRejection");C(this,"noDeleteOnStaleGet");C(this,"allowStaleOnFetchAbort");C(this,"allowStaleOnFetchRejection");C(this,"ignoreFetchAbort");_(this,O);_(this,X);_(this,T);_(this,b);_(this,m);_(this,P);_(this,z);_(this,N);_(this,R);_(this,J);_(this,D);_(this,Q);_(this,Z);_(this,V);_(this,W);_(this,tt);_(this,dt);_(this,j);_(this,Et);_(this,ft,()=>{});_(this,ot,()=>{});_(this,Tt,()=>{});_(this,Y,()=>false);_(this,mt,e=>{});_(this,bt,(e,i,s)=>{});_(this,Ot,(e,i,s,r)=>{if(s||r)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});C(this,Zt,"LRUCache");let{max:i=0,ttl:s,ttlResolution:r=1,ttlAutopurge:n,updateAgeOnGet:o,updateAgeOnHas:c,allowStale:p,dispose:v,onInsert:U,disposeAfter:S,noDisposeOnSet:rt,noUpdateTTL:I,maxSize:k=0,maxEntrySize:w=0,sizeCalculation:y,fetchMethod:a,memoMethod:x,noDeleteOnFetchRejection:A,noDeleteOnStaleGet:f,allowStaleOnFetchRejection:g,allowStaleOnFetchAbort:F,ignoreFetchAbort:H,perf:_t}=e;if(_t!==void 0&&typeof _t?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(u(this,B,_t??me),i!==0&&!at(i))throw new TypeError("max option must be a nonnegative integer");let vt=i?se(i):Array;if(!vt)throw new Error("invalid max value: "+i);if(u(this,K,i),u(this,M,k),this.maxEntrySize=w||t(this,M),this.sizeCalculation=y,this.sizeCalculation){if(!t(this,M)&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(x!==void 0&&typeof x!="function")throw new TypeError("memoMethod must be a function if defined");if(u(this,xt,x),a!==void 0&&typeof a!="function")throw new TypeError("fetchMethod must be a function if specified");if(u(this,yt,a),u(this,dt,!!a),u(this,T,new Map),u(this,b,new Array(i).fill(void 0)),u(this,m,new Array(i).fill(void 0)),u(this,P,new vt(i)),u(this,z,new vt(i)),u(this,N,0),u(this,R,0),u(this,J,_e.create(i)),u(this,O,0),u(this,X,0),typeof v=="function"&&u(this,q,v),typeof U=="function"&&u(this,ut,U),typeof S=="function"?(u(this,$,S),u(this,D,[])):(u(this,$,void 0),u(this,D,void 0)),u(this,tt,!!t(this,q)),u(this,Et,!!t(this,ut)),u(this,j,!!t(this,$)),this.noDisposeOnSet=!!rt,this.noUpdateTTL=!!I,this.noDeleteOnFetchRejection=!!A,this.allowStaleOnFetchRejection=!!g,this.allowStaleOnFetchAbort=!!F,this.ignoreFetchAbort=!!H,this.maxEntrySize!==0){if(t(this,M)!==0&&!at(t(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");d(this,l,oe).call(this);}if(this.allowStale=!!p,this.noDeleteOnStaleGet=!!f,this.updateAgeOnGet=!!o,this.updateAgeOnHas=!!c,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");d(this,l,It).call(this);}if(t(this,K)===0&&this.ttl===0&&t(this,M)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!t(this,K)&&!t(this,M)){let Pt="LRU_CACHE_UNBOUNDED";ge(Pt)&&(ee.add(Pt),ie("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",Pt,wt));}}get perf(){return t(this,B)}static unsafeExposeInternals(e){return {starts:t(e,Z),ttls:t(e,V),autopurgeTimers:t(e,W),sizes:t(e,Q),keyMap:t(e,T),keyList:t(e,b),valList:t(e,m),next:t(e,P),prev:t(e,z),get head(){return t(e,N)},get tail(){return t(e,R)},free:t(e,J),isBackgroundFetch:i=>{var s;return d(s=e,l,E).call(s,i)},backgroundFetch:(i,s,r,n)=>{var o;return d(o=e,l,Ct).call(o,i,s,r,n)},moveToTail:i=>{var s;return d(s=e,l,At).call(s,i)},indexes:i=>{var s;return d(s=e,l,lt).call(s,i)},rindexes:i=>{var s;return d(s=e,l,ht).call(s,i)},isStale:i=>{var s;return t(s=e,Y).call(s,i)}}}get max(){return t(this,K)}get maxSize(){return t(this,M)}get calculatedSize(){return t(this,X)}get size(){return t(this,O)}get fetchMethod(){return t(this,yt)}get memoMethod(){return t(this,xt)}get dispose(){return t(this,q)}get onInsert(){return t(this,ut)}get disposeAfter(){return t(this,$)}getRemainingTTL(e){return t(this,T).has(e)?1/0:0}*entries(){for(let e of d(this,l,lt).call(this))t(this,m)[e]!==void 0&&t(this,b)[e]!==void 0&&!d(this,l,E).call(this,t(this,m)[e])&&(yield [t(this,b)[e],t(this,m)[e]]);}*rentries(){for(let e of d(this,l,ht).call(this))t(this,m)[e]!==void 0&&t(this,b)[e]!==void 0&&!d(this,l,E).call(this,t(this,m)[e])&&(yield [t(this,b)[e],t(this,m)[e]]);}*keys(){for(let e of d(this,l,lt).call(this)){let i=t(this,b)[e];i!==void 0&&!d(this,l,E).call(this,t(this,m)[e])&&(yield i);}}*rkeys(){for(let e of d(this,l,ht).call(this)){let i=t(this,b)[e];i!==void 0&&!d(this,l,E).call(this,t(this,m)[e])&&(yield i);}}*values(){for(let e of d(this,l,lt).call(this))t(this,m)[e]!==void 0&&!d(this,l,E).call(this,t(this,m)[e])&&(yield t(this,m)[e]);}*rvalues(){for(let e of d(this,l,ht).call(this))t(this,m)[e]!==void 0&&!d(this,l,E).call(this,t(this,m)[e])&&(yield t(this,m)[e]);}[(te=Symbol.iterator,Zt=Symbol.toStringTag,te)](){return this.entries()}find(e,i={}){for(let s of d(this,l,lt).call(this)){let r=t(this,m)[s],n=d(this,l,E).call(this,r)?r.__staleWhileFetching:r;if(n!==void 0&&e(n,t(this,b)[s],this))return this.get(t(this,b)[s],i)}}forEach(e,i=this){for(let s of d(this,l,lt).call(this)){let r=t(this,m)[s],n=d(this,l,E).call(this,r)?r.__staleWhileFetching:r;n!==void 0&&e.call(i,n,t(this,b)[s],this);}}rforEach(e,i=this){for(let s of d(this,l,ht).call(this)){let r=t(this,m)[s],n=d(this,l,E).call(this,r)?r.__staleWhileFetching:r;n!==void 0&&e.call(i,n,t(this,b)[s],this);}}purgeStale(){let e=false;for(let i of d(this,l,ht).call(this,{allowStale:true}))t(this,Y).call(this,i)&&(d(this,l,ct).call(this,t(this,b)[i],"expire"),e=true);return e}info(e){let i=t(this,T).get(e);if(i===void 0)return;let s=t(this,m)[i],r=d(this,l,E).call(this,s)?s.__staleWhileFetching:s;if(r===void 0)return;let n={value:r};if(t(this,V)&&t(this,Z)){let o=t(this,V)[i],c=t(this,Z)[i];if(o&&c){let p=o-(t(this,B).now()-c);n.ttl=p,n.start=Date.now();}}return t(this,Q)&&(n.size=t(this,Q)[i]),n}dump(){let e=[];for(let i of d(this,l,lt).call(this,{allowStale:true})){let s=t(this,b)[i],r=t(this,m)[i],n=d(this,l,E).call(this,r)?r.__staleWhileFetching:r;if(n===void 0||s===void 0)continue;let o={value:n};if(t(this,V)&&t(this,Z)){o.ttl=t(this,V)[i];let c=t(this,B).now()-t(this,Z)[i];o.start=Math.floor(Date.now()-c);}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,B).now()-r;}this.set(i,s.value,s);}}set(e,i,s={}){var rt,I,k,w;if(i===void 0)return this.delete(e),this;let{ttl:r=this.ttl,start:n,noDisposeOnSet:o=this.noDisposeOnSet,sizeCalculation:c=this.sizeCalculation,status:p}=s,{noUpdateTTL:v=this.noUpdateTTL}=s,U=t(this,Ot).call(this,e,i,s.size||0,c);if(this.maxEntrySize&&U>this.maxEntrySize)return p&&(p.set="miss",p.maxEntrySizeExceeded=true),d(this,l,ct).call(this,e,"set"),this;let S=t(this,O)===0?void 0:t(this,T).get(e);if(S===void 0)S=t(this,O)===0?t(this,R):t(this,J).length!==0?t(this,J).pop():t(this,O)===t(this,K)?d(this,l,Lt).call(this,false):t(this,O),t(this,b)[S]=e,t(this,m)[S]=i,t(this,T).set(e,S),t(this,P)[t(this,R)]=S,t(this,z)[S]=t(this,R),u(this,R,S),Rt(this,O)._++,t(this,bt).call(this,S,U,p),p&&(p.set="add"),v=false,t(this,Et)&&((rt=t(this,ut))==null||rt.call(this,i,e,"add"));else {d(this,l,At).call(this,S);let y=t(this,m)[S];if(i!==y){if(t(this,dt)&&d(this,l,E).call(this,y)){y.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:a}=y;a!==void 0&&!o&&(t(this,tt)&&((I=t(this,q))==null||I.call(this,a,e,"set")),t(this,j)&&t(this,D)?.push([a,e,"set"]));}else o||(t(this,tt)&&((k=t(this,q))==null||k.call(this,y,e,"set")),t(this,j)&&t(this,D)?.push([y,e,"set"]));if(t(this,mt).call(this,S),t(this,bt).call(this,S,U,p),t(this,m)[S]=i,p){p.set="replace";let a=y&&d(this,l,E).call(this,y)?y.__staleWhileFetching:y;a!==void 0&&(p.oldValue=a);}}else p&&(p.set="update");t(this,Et)&&this.onInsert?.(i,e,i===y?"update":"replace");}if(r!==0&&!t(this,V)&&d(this,l,It).call(this),t(this,V)&&(v||t(this,Tt).call(this,S,r,n),p&&t(this,ot).call(this,p,S)),!o&&t(this,j)&&t(this,D)){let y=t(this,D),a;for(;a=y?.shift();)(w=t(this,$))==null||w.call(this,...a);}return this}pop(){var e;try{for(;t(this,O);){let i=t(this,m)[t(this,N)];if(d(this,l,Lt).call(this,!0),d(this,l,E).call(this,i)){if(i.__staleWhileFetching)return i.__staleWhileFetching}else if(i!==void 0)return i}}finally{if(t(this,j)&&t(this,D)){let i=t(this,D),s;for(;s=i?.shift();)(e=t(this,$))==null||e.call(this,...s);}}}has(e,i={}){let{updateAgeOnHas:s=this.updateAgeOnHas,status:r}=i,n=t(this,T).get(e);if(n!==void 0){let o=t(this,m)[n];if(d(this,l,E).call(this,o)&&o.__staleWhileFetching===void 0)return false;if(t(this,Y).call(this,n))r&&(r.has="stale",t(this,ot).call(this,r,n));else return s&&t(this,ft).call(this,n),r&&(r.has="hit",t(this,ot).call(this,r,n)),true}else r&&(r.has="miss");return false}peek(e,i={}){let{allowStale:s=this.allowStale}=i,r=t(this,T).get(e);if(r===void 0||!s&&t(this,Y).call(this,r))return;let n=t(this,m)[r];return d(this,l,E).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:c=this.noDisposeOnSet,size:p=0,sizeCalculation:v=this.sizeCalculation,noUpdateTTL:U=this.noUpdateTTL,noDeleteOnFetchRejection:S=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:rt=this.allowStaleOnFetchRejection,ignoreFetchAbort:I=this.ignoreFetchAbort,allowStaleOnFetchAbort:k=this.allowStaleOnFetchAbort,context:w,forceRefresh:y=false,status:a,signal:x}=i;if(!t(this,dt))return a&&(a.fetch="get"),this.get(e,{allowStale:s,updateAgeOnGet:r,noDeleteOnStaleGet:n,status:a});let A={allowStale:s,updateAgeOnGet:r,noDeleteOnStaleGet:n,ttl:o,noDisposeOnSet:c,size:p,sizeCalculation:v,noUpdateTTL:U,noDeleteOnFetchRejection:S,allowStaleOnFetchRejection:rt,allowStaleOnFetchAbort:k,ignoreFetchAbort:I,status:a,signal:x},f=t(this,T).get(e);if(f===void 0){a&&(a.fetch="miss");let g=d(this,l,Ct).call(this,e,f,A,w);return g.__returned=g}else {let g=t(this,m)[f];if(d(this,l,E).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=t(this,Y).call(this,f);if(!y&&!F)return a&&(a.fetch="hit"),d(this,l,At).call(this,f),r&&t(this,ft).call(this,f),a&&t(this,ot).call(this,a,f),g;let H=d(this,l,Ct).call(this,e,f,A,w),_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=t(this,xt);if(!s)throw new Error("no memoMethod provided to constructor");let{context:r,forceRefresh:n,...o}=i,c=this.get(e,o);if(!n&&c!==void 0)return c;let p=s(e,c,{options:o,context:r});return this.set(e,p,o),p}get(e,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,status:o}=i,c=t(this,T).get(e);if(c!==void 0){let p=t(this,m)[c],v=d(this,l,E).call(this,p);return o&&t(this,ot).call(this,o,c),t(this,Y).call(this,c)?(o&&(o.get="stale"),v?(o&&s&&p.__staleWhileFetching!==void 0&&(o.returnedStale=true),s?p.__staleWhileFetching:void 0):(n||d(this,l,ct).call(this,e,"expire"),o&&s&&(o.returnedStale=true),s?p:void 0)):(o&&(o.get="hit"),v?p.__staleWhileFetching:(d(this,l,At).call(this,c),r&&t(this,ft).call(this,c),p))}else o&&(o.get="miss");}delete(e){return d(this,l,ct).call(this,e,"delete")}clear(){return d(this,l,Vt).call(this,"delete")}},K=new WeakMap,M=new WeakMap,q=new WeakMap,ut=new WeakMap,$=new WeakMap,yt=new WeakMap,xt=new WeakMap,B=new WeakMap,O=new WeakMap,X=new WeakMap,T=new WeakMap,b=new WeakMap,m=new WeakMap,P=new WeakMap,z=new WeakMap,N=new WeakMap,R=new WeakMap,J=new WeakMap,D=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,It=function(){let e=new Dt(t(this,K)),i=new Dt(t(this,K));u(this,V,e),u(this,Z,i);let s=this.ttlAutopurge?new Array(t(this,K)):void 0;u(this,W,s),u(this,Tt,(c,p,v=t(this,B).now())=>{i[c]=p!==0?v:0,e[c]=p,r(c,p);}),u(this,ft,c=>{i[c]=e[c]!==0?t(this,B).now():0,r(c,e[c]);});let r=this.ttlAutopurge?(c,p)=>{if(s?.[c]&&(clearTimeout(s[c]),s[c]=void 0),p&&p!==0&&s){let v=setTimeout(()=>{t(this,Y).call(this,c)&&d(this,l,ct).call(this,t(this,b)[c],"expire");},p+1);v.unref&&v.unref(),s[c]=v;}}:()=>{};u(this,ot,(c,p)=>{if(e[p]){let v=e[p],U=i[p];if(!v||!U)return;c.ttl=v,c.start=U,c.now=n||o();let S=c.now-U;c.remainingTTL=v-S;}});let n=0,o=()=>{let c=t(this,B).now();if(this.ttlResolution>0){n=c;let p=setTimeout(()=>n=0,this.ttlResolution);p.unref&&p.unref();}return c};this.getRemainingTTL=c=>{let p=t(this,T).get(c);if(p===void 0)return 0;let v=e[p],U=i[p];if(!v||!U)return 1/0;let S=(n||o())-U;return v-S},u(this,Y,c=>{let p=i[c],v=e[c];return !!v&&!!p&&(n||o())-p>v});},ft=new WeakMap,ot=new WeakMap,Tt=new WeakMap,Y=new WeakMap,oe=function(){let e=new Dt(t(this,K));u(this,X,0),u(this,Q,e),u(this,mt,i=>{u(this,X,t(this,X)-e[i]),e[i]=0;}),u(this,Ot,(i,s,r,n)=>{if(d(this,l,E).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}),u(this,bt,(i,s,r)=>{if(e[i]=s,t(this,M)){let n=t(this,M)-e[i];for(;t(this,X)>n;)d(this,l,Lt).call(this,true);}u(this,X,t(this,X)+e[i]),r&&(r.entrySize=s,r.totalCalculatedSize=t(this,X));});},mt=new WeakMap,bt=new WeakMap,Ot=new WeakMap,lt=function*({allowStale:e=this.allowStale}={}){if(t(this,O))for(let i=t(this,R);!(!d(this,l,Mt).call(this,i)||((e||!t(this,Y).call(this,i))&&(yield i),i===t(this,N)));)i=t(this,z)[i];},ht=function*({allowStale:e=this.allowStale}={}){if(t(this,O))for(let i=t(this,N);!(!d(this,l,Mt).call(this,i)||((e||!t(this,Y).call(this,i))&&(yield i),i===t(this,R)));)i=t(this,P)[i];},Mt=function(e){return e!==void 0&&t(this,T).get(t(this,b)[e])===e},Lt=function(e){var n;let i=t(this,N),s=t(this,b)[i],r=t(this,m)[i];return t(this,dt)&&d(this,l,E).call(this,r)?r.__abortController.abort(new Error("evicted")):(t(this,tt)||t(this,j))&&(t(this,tt)&&((n=t(this,q))==null||n.call(this,r,s,"evict")),t(this,j)&&t(this,D)?.push([r,s,"evict"])),t(this,mt).call(this,i),t(this,W)?.[i]&&(clearTimeout(t(this,W)[i]),t(this,W)[i]=void 0),e&&(t(this,b)[i]=void 0,t(this,m)[i]=void 0,t(this,J).push(i)),t(this,O)===1?(u(this,N,u(this,R,0)),t(this,J).length=0):u(this,N,t(this,P)[i]),t(this,T).delete(s),Rt(this,O)._--,i},Ct=function(e,i,s,r){let n=i===void 0?void 0:t(this,m)[i];if(d(this,l,E).call(this,n))return n;let o=new Nt,{signal:c}=s;c?.addEventListener("abort",()=>o.abort(c.reason),{signal:o.signal});let p={signal:o.signal,options:s,context:r},v=(w,y=false)=>{let{aborted:a}=o.signal,x=s.ignoreFetchAbort&&w!==void 0,A=s.ignoreFetchAbort||!!(s.allowStaleOnFetchAbort&&w!==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,A);let f=I,g=t(this,m)[i];return (g===I||x&&y&&g===void 0)&&(w===void 0?f.__staleWhileFetching!==void 0?t(this,m)[i]=f.__staleWhileFetching:d(this,l,ct).call(this,e,"fetch"):(s.status&&(s.status.fetchUpdated=true),this.set(e,w,p.options))),w},U=w=>(s.status&&(s.status.fetchRejected=true,s.status.fetchError=w),S(w,false)),S=(w,y)=>{let{aborted:a}=o.signal,x=a&&s.allowStaleOnFetchAbort,A=x||s.allowStaleOnFetchRejection,f=A||s.noDeleteOnFetchRejection,g=I;if(t(this,m)[i]===I&&(!f||!y&&g.__staleWhileFetching===void 0?d(this,l,ct).call(this,e,"fetch"):x||(t(this,m)[i]=g.__staleWhileFetching)),A)return s.status&&g.__staleWhileFetching!==void 0&&(s.status.returnedStale=true),g.__staleWhileFetching;if(g.__returned===g)throw w},rt=(w,y)=>{var x;let a=(x=t(this,yt))==null?void 0:x.call(this,e,n,p);a&&a instanceof Promise&&a.then(A=>w(A===void 0?void 0:A),y),o.signal.addEventListener("abort",()=>{(!s.ignoreFetchAbort||s.allowStaleOnFetchAbort)&&(w(void 0),s.allowStaleOnFetchAbort&&(w=A=>v(A,true)));});};s.status&&(s.status.fetchDispatched=true);let I=new Promise(rt).then(v,U),k=Object.assign(I,{__abortController:o,__staleWhileFetching:n,__returned:void 0});return i===void 0?(this.set(e,k,{...p.options,status:void 0}),i=t(this,T).get(e)):t(this,m)[i]=k,k},E=function(e){if(!t(this,dt))return false;let i=e;return !!i&&i instanceof Promise&&i.hasOwnProperty("__staleWhileFetching")&&i.__abortController instanceof Nt},zt=function(e,i){t(this,z)[i]=e,t(this,P)[e]=i;},At=function(e){e!==t(this,R)&&(e===t(this,N)?u(this,N,t(this,P)[e]):d(this,l,zt).call(this,t(this,z)[e],t(this,P)[e]),d(this,l,zt).call(this,t(this,R),e),u(this,R,e));},ct=function(e,i){var r,n;let s=false;if(t(this,O)!==0){let o=t(this,T).get(e);if(o!==void 0)if(t(this,W)?.[o]&&(clearTimeout(t(this,W)?.[o]),t(this,W)[o]=void 0),s=true,t(this,O)===1)d(this,l,Vt).call(this,i);else {t(this,mt).call(this,o);let c=t(this,m)[o];if(d(this,l,E).call(this,c)?c.__abortController.abort(new Error("deleted")):(t(this,tt)||t(this,j))&&(t(this,tt)&&((r=t(this,q))==null||r.call(this,c,e,i)),t(this,j)&&t(this,D)?.push([c,e,i])),t(this,T).delete(e),t(this,b)[o]=void 0,t(this,m)[o]=void 0,o===t(this,R))u(this,R,t(this,z)[o]);else if(o===t(this,N))u(this,N,t(this,P)[o]);else {let p=t(this,z)[o];t(this,P)[p]=t(this,P)[o];let v=t(this,P)[o];t(this,z)[v]=t(this,z)[o];}Rt(this,O)._--,t(this,J).push(o);}}if(t(this,j)&&t(this,D)?.length){let o=t(this,D),c;for(;c=o?.shift();)(n=t(this,$))==null||n.call(this,...c);}return s},Vt=function(e){var i,s;for(let r of d(this,l,ht).call(this,{allowStale:true})){let n=t(this,m)[r];if(d(this,l,E).call(this,n))n.__abortController.abort(new Error("deleted"));else {let o=t(this,b)[r];t(this,tt)&&((i=t(this,q))==null||i.call(this,n,o,e)),t(this,j)&&t(this,D)?.push([n,o,e]);}}if(t(this,T).clear(),t(this,m).fill(void 0),t(this,b).fill(void 0),t(this,V)&&t(this,Z)){t(this,V).fill(0),t(this,Z).fill(0);for(let r of t(this,W)??[])r!==void 0&&clearTimeout(r);t(this,W)?.fill(void 0);}if(t(this,Q)&&t(this,Q).fill(0),u(this,N,0),u(this,R,0),t(this,J).length=0,u(this,X,0),u(this,O,0),t(this,j)&&t(this,D)){let r=t(this,D),n;for(;n=r?.shift();)(s=t(this,$))==null||s.call(this,...n);}},wt);var Ft=class{cache;map=new Map;constructor(e){this.cache=new re({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.14";var Wt={version:Ut};var Yt="repeat";function Ht(h){return {type:"pause",duration:h}}var Kt="__game_layer__";var ve={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 ae={};var kt={};fe(kt,{createExportableElement:()=>le});var gt;(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)))(gt||={});function le(h){try{if(typeof h>"u")return h;let e=JSON.stringify(h);return JSON.parse(e)}catch(e){throw gt.error("Error creating exportable element",h,e),new core.PixiError("not_json_serializable","Error creating exportable element")}}var ye=typeof window<"u"&&typeof document<"u",he=[" _______ _ _ _ ____ ____ ____ _____ ","|_ __ \\ (_) (_) | | |_ _| |_ _||_ \\|_ _|"," | |__) |__ _ __ __ \\_| \\ \\ / / | \\ | | "," | ___/[ | [ \\ [ ][ | \\ \\ / / | |\\ \\| | "," _| |_ | | > ' < | | \\ ' / _| |_\\ |_ ",`|_____| [___][__]\`\\_][___] \\_/ |_____|\\____| v${Wt.version}`],ce=31,xe="background:#2f90da;color:#fff;font-weight:bold;",Ee="background:#c832bb;color:#fff;font-weight:bold;",be="background:transparent;font-weight:bold;",qt=` v${Wt.version}`;function de(){if(!ye)return;let h=[],e=[];for(let i=0;i<he.length;i++){let s=he[i],r=s.endsWith(qt),n=r?s.slice(0,-qt.length):s,o=n.slice(0,ce),c=n.slice(ce),p=r?"%c%s%c%s%c%s":"%c%s%c%s";h.push(p),e.push(xe,o,Ee,c),r&&e.push(be,qt);}console.info(h.join(`
|
|
1
|
+
'use strict';Object.defineProperty(exports,'__esModule',{value:true});var nt=require('@drincs/pixi-vn/canvas'),Bt=require('@drincs/pixi-vn/characters'),core=require('@drincs/pixi-vn/core'),et=require('@drincs/pixi-vn/history'),L=require('@drincs/pixi-vn/narration'),pt=require('@drincs/pixi-vn/sound'),G=require('@drincs/pixi-vn/storage'),motion=require('@drincs/pixi-vn/motion');function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var nt__namespace=/*#__PURE__*/_interopNamespace(nt);var Bt__namespace=/*#__PURE__*/_interopNamespace(Bt);var et__namespace=/*#__PURE__*/_interopNamespace(et);var L__namespace=/*#__PURE__*/_interopNamespace(L);var pt__namespace=/*#__PURE__*/_interopNamespace(pt);var G__namespace=/*#__PURE__*/_interopNamespace(G);var Xt=Object.defineProperty;var Jt=h=>{throw TypeError(h)};var ue=(h,e,i)=>e in h?Xt(h,e,{enumerable:true,configurable:true,writable:true,value:i}):h[e]=i;var fe=(h,e)=>{for(var i in e)Xt(h,i,{get:e[i],enumerable:true});};var C=(h,e,i)=>ue(h,typeof e!="symbol"?e+"":e,i),jt=(h,e,i)=>e.has(h)||Jt("Cannot "+i);var t=(h,e,i)=>(jt(h,e,"read from private field"),i?i.call(h):e.get(h)),_=(h,e,i)=>e.has(h)?Jt("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(h):e.set(h,i),u=(h,e,i,s)=>(jt(h,e,"write to private field"),e.set(h,i),i),d=(h,e,i)=>(jt(h,e,"access private method"),i);var Rt=(h,e,i,s)=>({set _(r){u(h,e,r);},get _(){return t(h,e,s)}});var me=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,ee=new Set,Gt=typeof process=="object"&&process?process:{},ie=(h,e,i,s)=>{typeof Gt.emitWarning=="function"?Gt.emitWarning(h,e,i,s):console.error(`[${i}] ${e}: ${h}`);},Nt=globalThis.AbortController,Qt=globalThis.AbortSignal;if(typeof Nt>"u"){Qt=class{onabort;_onabort=[];reason;aborted=false;addEventListener(i,s){this._onabort.push(s);}},Nt=class{constructor(){e();}signal=new Qt;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 h=Gt.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{h&&(h=false,ie("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",e));};}var ge=h=>!ee.has(h);var at=h=>h&&h===Math.floor(h)&&h>0&&isFinite(h),se=h=>at(h)?h<=Math.pow(2,8)?Uint8Array:h<=Math.pow(2,16)?Uint16Array:h<=Math.pow(2,32)?Uint32Array:h<=Number.MAX_SAFE_INTEGER?Dt:null:null,Dt=class extends Array{constructor(h){super(h),this.fill(0);}},it,St,_e=(it=class{heap;length;static create(e){let i=se(e);if(!i)return [];u(it,St,true);let s=new it(e,i);return u(it,St,false),s}constructor(e,i){if(!t(it,St))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new i(e),this.length=0;}push(e){this.heap[this.length++]=e;}pop(){return this.heap[--this.length]}},St=new WeakMap,_(it,St,false),it),Zt,te,K,M,q,ut,$,yt,xt,B,O,X,T,b,m,P,z,N,R,J,D,Q,Z,V,W,tt,dt,j,Et,l,It,ft,ot,Tt,Y,oe,mt,bt,Ot,lt,ht,Mt,Lt,Ct,E,zt,At,ct,Vt,wt,re=(wt=class{constructor(e){_(this,l);_(this,K);_(this,M);_(this,q);_(this,ut);_(this,$);_(this,yt);_(this,xt);_(this,B);C(this,"ttl");C(this,"ttlResolution");C(this,"ttlAutopurge");C(this,"updateAgeOnGet");C(this,"updateAgeOnHas");C(this,"allowStale");C(this,"noDisposeOnSet");C(this,"noUpdateTTL");C(this,"maxEntrySize");C(this,"sizeCalculation");C(this,"noDeleteOnFetchRejection");C(this,"noDeleteOnStaleGet");C(this,"allowStaleOnFetchAbort");C(this,"allowStaleOnFetchRejection");C(this,"ignoreFetchAbort");_(this,O);_(this,X);_(this,T);_(this,b);_(this,m);_(this,P);_(this,z);_(this,N);_(this,R);_(this,J);_(this,D);_(this,Q);_(this,Z);_(this,V);_(this,W);_(this,tt);_(this,dt);_(this,j);_(this,Et);_(this,ft,()=>{});_(this,ot,()=>{});_(this,Tt,()=>{});_(this,Y,()=>false);_(this,mt,e=>{});_(this,bt,(e,i,s)=>{});_(this,Ot,(e,i,s,r)=>{if(s||r)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});C(this,Zt,"LRUCache");let{max:i=0,ttl:s,ttlResolution:r=1,ttlAutopurge:n,updateAgeOnGet:o,updateAgeOnHas:c,allowStale:p,dispose:v,onInsert:U,disposeAfter:S,noDisposeOnSet:rt,noUpdateTTL:I,maxSize:k=0,maxEntrySize:w=0,sizeCalculation:y,fetchMethod:a,memoMethod:x,noDeleteOnFetchRejection:A,noDeleteOnStaleGet:f,allowStaleOnFetchRejection:g,allowStaleOnFetchAbort:F,ignoreFetchAbort:H,perf:_t}=e;if(_t!==void 0&&typeof _t?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(u(this,B,_t??me),i!==0&&!at(i))throw new TypeError("max option must be a nonnegative integer");let vt=i?se(i):Array;if(!vt)throw new Error("invalid max value: "+i);if(u(this,K,i),u(this,M,k),this.maxEntrySize=w||t(this,M),this.sizeCalculation=y,this.sizeCalculation){if(!t(this,M)&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(x!==void 0&&typeof x!="function")throw new TypeError("memoMethod must be a function if defined");if(u(this,xt,x),a!==void 0&&typeof a!="function")throw new TypeError("fetchMethod must be a function if specified");if(u(this,yt,a),u(this,dt,!!a),u(this,T,new Map),u(this,b,new Array(i).fill(void 0)),u(this,m,new Array(i).fill(void 0)),u(this,P,new vt(i)),u(this,z,new vt(i)),u(this,N,0),u(this,R,0),u(this,J,_e.create(i)),u(this,O,0),u(this,X,0),typeof v=="function"&&u(this,q,v),typeof U=="function"&&u(this,ut,U),typeof S=="function"?(u(this,$,S),u(this,D,[])):(u(this,$,void 0),u(this,D,void 0)),u(this,tt,!!t(this,q)),u(this,Et,!!t(this,ut)),u(this,j,!!t(this,$)),this.noDisposeOnSet=!!rt,this.noUpdateTTL=!!I,this.noDeleteOnFetchRejection=!!A,this.allowStaleOnFetchRejection=!!g,this.allowStaleOnFetchAbort=!!F,this.ignoreFetchAbort=!!H,this.maxEntrySize!==0){if(t(this,M)!==0&&!at(t(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");d(this,l,oe).call(this);}if(this.allowStale=!!p,this.noDeleteOnStaleGet=!!f,this.updateAgeOnGet=!!o,this.updateAgeOnHas=!!c,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");d(this,l,It).call(this);}if(t(this,K)===0&&this.ttl===0&&t(this,M)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!t(this,K)&&!t(this,M)){let Pt="LRU_CACHE_UNBOUNDED";ge(Pt)&&(ee.add(Pt),ie("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",Pt,wt));}}get perf(){return t(this,B)}static unsafeExposeInternals(e){return {starts:t(e,Z),ttls:t(e,V),autopurgeTimers:t(e,W),sizes:t(e,Q),keyMap:t(e,T),keyList:t(e,b),valList:t(e,m),next:t(e,P),prev:t(e,z),get head(){return t(e,N)},get tail(){return t(e,R)},free:t(e,J),isBackgroundFetch:i=>{var s;return d(s=e,l,E).call(s,i)},backgroundFetch:(i,s,r,n)=>{var o;return d(o=e,l,Ct).call(o,i,s,r,n)},moveToTail:i=>{var s;return d(s=e,l,At).call(s,i)},indexes:i=>{var s;return d(s=e,l,lt).call(s,i)},rindexes:i=>{var s;return d(s=e,l,ht).call(s,i)},isStale:i=>{var s;return t(s=e,Y).call(s,i)}}}get max(){return t(this,K)}get maxSize(){return t(this,M)}get calculatedSize(){return t(this,X)}get size(){return t(this,O)}get fetchMethod(){return t(this,yt)}get memoMethod(){return t(this,xt)}get dispose(){return t(this,q)}get onInsert(){return t(this,ut)}get disposeAfter(){return t(this,$)}getRemainingTTL(e){return t(this,T).has(e)?1/0:0}*entries(){for(let e of d(this,l,lt).call(this))t(this,m)[e]!==void 0&&t(this,b)[e]!==void 0&&!d(this,l,E).call(this,t(this,m)[e])&&(yield [t(this,b)[e],t(this,m)[e]]);}*rentries(){for(let e of d(this,l,ht).call(this))t(this,m)[e]!==void 0&&t(this,b)[e]!==void 0&&!d(this,l,E).call(this,t(this,m)[e])&&(yield [t(this,b)[e],t(this,m)[e]]);}*keys(){for(let e of d(this,l,lt).call(this)){let i=t(this,b)[e];i!==void 0&&!d(this,l,E).call(this,t(this,m)[e])&&(yield i);}}*rkeys(){for(let e of d(this,l,ht).call(this)){let i=t(this,b)[e];i!==void 0&&!d(this,l,E).call(this,t(this,m)[e])&&(yield i);}}*values(){for(let e of d(this,l,lt).call(this))t(this,m)[e]!==void 0&&!d(this,l,E).call(this,t(this,m)[e])&&(yield t(this,m)[e]);}*rvalues(){for(let e of d(this,l,ht).call(this))t(this,m)[e]!==void 0&&!d(this,l,E).call(this,t(this,m)[e])&&(yield t(this,m)[e]);}[(te=Symbol.iterator,Zt=Symbol.toStringTag,te)](){return this.entries()}find(e,i={}){for(let s of d(this,l,lt).call(this)){let r=t(this,m)[s],n=d(this,l,E).call(this,r)?r.__staleWhileFetching:r;if(n!==void 0&&e(n,t(this,b)[s],this))return this.get(t(this,b)[s],i)}}forEach(e,i=this){for(let s of d(this,l,lt).call(this)){let r=t(this,m)[s],n=d(this,l,E).call(this,r)?r.__staleWhileFetching:r;n!==void 0&&e.call(i,n,t(this,b)[s],this);}}rforEach(e,i=this){for(let s of d(this,l,ht).call(this)){let r=t(this,m)[s],n=d(this,l,E).call(this,r)?r.__staleWhileFetching:r;n!==void 0&&e.call(i,n,t(this,b)[s],this);}}purgeStale(){let e=false;for(let i of d(this,l,ht).call(this,{allowStale:true}))t(this,Y).call(this,i)&&(d(this,l,ct).call(this,t(this,b)[i],"expire"),e=true);return e}info(e){let i=t(this,T).get(e);if(i===void 0)return;let s=t(this,m)[i],r=d(this,l,E).call(this,s)?s.__staleWhileFetching:s;if(r===void 0)return;let n={value:r};if(t(this,V)&&t(this,Z)){let o=t(this,V)[i],c=t(this,Z)[i];if(o&&c){let p=o-(t(this,B).now()-c);n.ttl=p,n.start=Date.now();}}return t(this,Q)&&(n.size=t(this,Q)[i]),n}dump(){let e=[];for(let i of d(this,l,lt).call(this,{allowStale:true})){let s=t(this,b)[i],r=t(this,m)[i],n=d(this,l,E).call(this,r)?r.__staleWhileFetching:r;if(n===void 0||s===void 0)continue;let o={value:n};if(t(this,V)&&t(this,Z)){o.ttl=t(this,V)[i];let c=t(this,B).now()-t(this,Z)[i];o.start=Math.floor(Date.now()-c);}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,B).now()-r;}this.set(i,s.value,s);}}set(e,i,s={}){var rt,I,k,w;if(i===void 0)return this.delete(e),this;let{ttl:r=this.ttl,start:n,noDisposeOnSet:o=this.noDisposeOnSet,sizeCalculation:c=this.sizeCalculation,status:p}=s,{noUpdateTTL:v=this.noUpdateTTL}=s,U=t(this,Ot).call(this,e,i,s.size||0,c);if(this.maxEntrySize&&U>this.maxEntrySize)return p&&(p.set="miss",p.maxEntrySizeExceeded=true),d(this,l,ct).call(this,e,"set"),this;let S=t(this,O)===0?void 0:t(this,T).get(e);if(S===void 0)S=t(this,O)===0?t(this,R):t(this,J).length!==0?t(this,J).pop():t(this,O)===t(this,K)?d(this,l,Lt).call(this,false):t(this,O),t(this,b)[S]=e,t(this,m)[S]=i,t(this,T).set(e,S),t(this,P)[t(this,R)]=S,t(this,z)[S]=t(this,R),u(this,R,S),Rt(this,O)._++,t(this,bt).call(this,S,U,p),p&&(p.set="add"),v=false,t(this,Et)&&((rt=t(this,ut))==null||rt.call(this,i,e,"add"));else {d(this,l,At).call(this,S);let y=t(this,m)[S];if(i!==y){if(t(this,dt)&&d(this,l,E).call(this,y)){y.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:a}=y;a!==void 0&&!o&&(t(this,tt)&&((I=t(this,q))==null||I.call(this,a,e,"set")),t(this,j)&&t(this,D)?.push([a,e,"set"]));}else o||(t(this,tt)&&((k=t(this,q))==null||k.call(this,y,e,"set")),t(this,j)&&t(this,D)?.push([y,e,"set"]));if(t(this,mt).call(this,S),t(this,bt).call(this,S,U,p),t(this,m)[S]=i,p){p.set="replace";let a=y&&d(this,l,E).call(this,y)?y.__staleWhileFetching:y;a!==void 0&&(p.oldValue=a);}}else p&&(p.set="update");t(this,Et)&&this.onInsert?.(i,e,i===y?"update":"replace");}if(r!==0&&!t(this,V)&&d(this,l,It).call(this),t(this,V)&&(v||t(this,Tt).call(this,S,r,n),p&&t(this,ot).call(this,p,S)),!o&&t(this,j)&&t(this,D)){let y=t(this,D),a;for(;a=y?.shift();)(w=t(this,$))==null||w.call(this,...a);}return this}pop(){var e;try{for(;t(this,O);){let i=t(this,m)[t(this,N)];if(d(this,l,Lt).call(this,!0),d(this,l,E).call(this,i)){if(i.__staleWhileFetching)return i.__staleWhileFetching}else if(i!==void 0)return i}}finally{if(t(this,j)&&t(this,D)){let i=t(this,D),s;for(;s=i?.shift();)(e=t(this,$))==null||e.call(this,...s);}}}has(e,i={}){let{updateAgeOnHas:s=this.updateAgeOnHas,status:r}=i,n=t(this,T).get(e);if(n!==void 0){let o=t(this,m)[n];if(d(this,l,E).call(this,o)&&o.__staleWhileFetching===void 0)return false;if(t(this,Y).call(this,n))r&&(r.has="stale",t(this,ot).call(this,r,n));else return s&&t(this,ft).call(this,n),r&&(r.has="hit",t(this,ot).call(this,r,n)),true}else r&&(r.has="miss");return false}peek(e,i={}){let{allowStale:s=this.allowStale}=i,r=t(this,T).get(e);if(r===void 0||!s&&t(this,Y).call(this,r))return;let n=t(this,m)[r];return d(this,l,E).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:c=this.noDisposeOnSet,size:p=0,sizeCalculation:v=this.sizeCalculation,noUpdateTTL:U=this.noUpdateTTL,noDeleteOnFetchRejection:S=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:rt=this.allowStaleOnFetchRejection,ignoreFetchAbort:I=this.ignoreFetchAbort,allowStaleOnFetchAbort:k=this.allowStaleOnFetchAbort,context:w,forceRefresh:y=false,status:a,signal:x}=i;if(!t(this,dt))return a&&(a.fetch="get"),this.get(e,{allowStale:s,updateAgeOnGet:r,noDeleteOnStaleGet:n,status:a});let A={allowStale:s,updateAgeOnGet:r,noDeleteOnStaleGet:n,ttl:o,noDisposeOnSet:c,size:p,sizeCalculation:v,noUpdateTTL:U,noDeleteOnFetchRejection:S,allowStaleOnFetchRejection:rt,allowStaleOnFetchAbort:k,ignoreFetchAbort:I,status:a,signal:x},f=t(this,T).get(e);if(f===void 0){a&&(a.fetch="miss");let g=d(this,l,Ct).call(this,e,f,A,w);return g.__returned=g}else {let g=t(this,m)[f];if(d(this,l,E).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=t(this,Y).call(this,f);if(!y&&!F)return a&&(a.fetch="hit"),d(this,l,At).call(this,f),r&&t(this,ft).call(this,f),a&&t(this,ot).call(this,a,f),g;let H=d(this,l,Ct).call(this,e,f,A,w),_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=t(this,xt);if(!s)throw new Error("no memoMethod provided to constructor");let{context:r,forceRefresh:n,...o}=i,c=this.get(e,o);if(!n&&c!==void 0)return c;let p=s(e,c,{options:o,context:r});return this.set(e,p,o),p}get(e,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,status:o}=i,c=t(this,T).get(e);if(c!==void 0){let p=t(this,m)[c],v=d(this,l,E).call(this,p);return o&&t(this,ot).call(this,o,c),t(this,Y).call(this,c)?(o&&(o.get="stale"),v?(o&&s&&p.__staleWhileFetching!==void 0&&(o.returnedStale=true),s?p.__staleWhileFetching:void 0):(n||d(this,l,ct).call(this,e,"expire"),o&&s&&(o.returnedStale=true),s?p:void 0)):(o&&(o.get="hit"),v?p.__staleWhileFetching:(d(this,l,At).call(this,c),r&&t(this,ft).call(this,c),p))}else o&&(o.get="miss");}delete(e){return d(this,l,ct).call(this,e,"delete")}clear(){return d(this,l,Vt).call(this,"delete")}},K=new WeakMap,M=new WeakMap,q=new WeakMap,ut=new WeakMap,$=new WeakMap,yt=new WeakMap,xt=new WeakMap,B=new WeakMap,O=new WeakMap,X=new WeakMap,T=new WeakMap,b=new WeakMap,m=new WeakMap,P=new WeakMap,z=new WeakMap,N=new WeakMap,R=new WeakMap,J=new WeakMap,D=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,It=function(){let e=new Dt(t(this,K)),i=new Dt(t(this,K));u(this,V,e),u(this,Z,i);let s=this.ttlAutopurge?new Array(t(this,K)):void 0;u(this,W,s),u(this,Tt,(c,p,v=t(this,B).now())=>{i[c]=p!==0?v:0,e[c]=p,r(c,p);}),u(this,ft,c=>{i[c]=e[c]!==0?t(this,B).now():0,r(c,e[c]);});let r=this.ttlAutopurge?(c,p)=>{if(s?.[c]&&(clearTimeout(s[c]),s[c]=void 0),p&&p!==0&&s){let v=setTimeout(()=>{t(this,Y).call(this,c)&&d(this,l,ct).call(this,t(this,b)[c],"expire");},p+1);v.unref&&v.unref(),s[c]=v;}}:()=>{};u(this,ot,(c,p)=>{if(e[p]){let v=e[p],U=i[p];if(!v||!U)return;c.ttl=v,c.start=U,c.now=n||o();let S=c.now-U;c.remainingTTL=v-S;}});let n=0,o=()=>{let c=t(this,B).now();if(this.ttlResolution>0){n=c;let p=setTimeout(()=>n=0,this.ttlResolution);p.unref&&p.unref();}return c};this.getRemainingTTL=c=>{let p=t(this,T).get(c);if(p===void 0)return 0;let v=e[p],U=i[p];if(!v||!U)return 1/0;let S=(n||o())-U;return v-S},u(this,Y,c=>{let p=i[c],v=e[c];return !!v&&!!p&&(n||o())-p>v});},ft=new WeakMap,ot=new WeakMap,Tt=new WeakMap,Y=new WeakMap,oe=function(){let e=new Dt(t(this,K));u(this,X,0),u(this,Q,e),u(this,mt,i=>{u(this,X,t(this,X)-e[i]),e[i]=0;}),u(this,Ot,(i,s,r,n)=>{if(d(this,l,E).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}),u(this,bt,(i,s,r)=>{if(e[i]=s,t(this,M)){let n=t(this,M)-e[i];for(;t(this,X)>n;)d(this,l,Lt).call(this,true);}u(this,X,t(this,X)+e[i]),r&&(r.entrySize=s,r.totalCalculatedSize=t(this,X));});},mt=new WeakMap,bt=new WeakMap,Ot=new WeakMap,lt=function*({allowStale:e=this.allowStale}={}){if(t(this,O))for(let i=t(this,R);!(!d(this,l,Mt).call(this,i)||((e||!t(this,Y).call(this,i))&&(yield i),i===t(this,N)));)i=t(this,z)[i];},ht=function*({allowStale:e=this.allowStale}={}){if(t(this,O))for(let i=t(this,N);!(!d(this,l,Mt).call(this,i)||((e||!t(this,Y).call(this,i))&&(yield i),i===t(this,R)));)i=t(this,P)[i];},Mt=function(e){return e!==void 0&&t(this,T).get(t(this,b)[e])===e},Lt=function(e){var n;let i=t(this,N),s=t(this,b)[i],r=t(this,m)[i];return t(this,dt)&&d(this,l,E).call(this,r)?r.__abortController.abort(new Error("evicted")):(t(this,tt)||t(this,j))&&(t(this,tt)&&((n=t(this,q))==null||n.call(this,r,s,"evict")),t(this,j)&&t(this,D)?.push([r,s,"evict"])),t(this,mt).call(this,i),t(this,W)?.[i]&&(clearTimeout(t(this,W)[i]),t(this,W)[i]=void 0),e&&(t(this,b)[i]=void 0,t(this,m)[i]=void 0,t(this,J).push(i)),t(this,O)===1?(u(this,N,u(this,R,0)),t(this,J).length=0):u(this,N,t(this,P)[i]),t(this,T).delete(s),Rt(this,O)._--,i},Ct=function(e,i,s,r){let n=i===void 0?void 0:t(this,m)[i];if(d(this,l,E).call(this,n))return n;let o=new Nt,{signal:c}=s;c?.addEventListener("abort",()=>o.abort(c.reason),{signal:o.signal});let p={signal:o.signal,options:s,context:r},v=(w,y=false)=>{let{aborted:a}=o.signal,x=s.ignoreFetchAbort&&w!==void 0,A=s.ignoreFetchAbort||!!(s.allowStaleOnFetchAbort&&w!==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,A);let f=I,g=t(this,m)[i];return (g===I||x&&y&&g===void 0)&&(w===void 0?f.__staleWhileFetching!==void 0?t(this,m)[i]=f.__staleWhileFetching:d(this,l,ct).call(this,e,"fetch"):(s.status&&(s.status.fetchUpdated=true),this.set(e,w,p.options))),w},U=w=>(s.status&&(s.status.fetchRejected=true,s.status.fetchError=w),S(w,false)),S=(w,y)=>{let{aborted:a}=o.signal,x=a&&s.allowStaleOnFetchAbort,A=x||s.allowStaleOnFetchRejection,f=A||s.noDeleteOnFetchRejection,g=I;if(t(this,m)[i]===I&&(!f||!y&&g.__staleWhileFetching===void 0?d(this,l,ct).call(this,e,"fetch"):x||(t(this,m)[i]=g.__staleWhileFetching)),A)return s.status&&g.__staleWhileFetching!==void 0&&(s.status.returnedStale=true),g.__staleWhileFetching;if(g.__returned===g)throw w},rt=(w,y)=>{var x;let a=(x=t(this,yt))==null?void 0:x.call(this,e,n,p);a&&a instanceof Promise&&a.then(A=>w(A===void 0?void 0:A),y),o.signal.addEventListener("abort",()=>{(!s.ignoreFetchAbort||s.allowStaleOnFetchAbort)&&(w(void 0),s.allowStaleOnFetchAbort&&(w=A=>v(A,true)));});};s.status&&(s.status.fetchDispatched=true);let I=new Promise(rt).then(v,U),k=Object.assign(I,{__abortController:o,__staleWhileFetching:n,__returned:void 0});return i===void 0?(this.set(e,k,{...p.options,status:void 0}),i=t(this,T).get(e)):t(this,m)[i]=k,k},E=function(e){if(!t(this,dt))return false;let i=e;return !!i&&i instanceof Promise&&i.hasOwnProperty("__staleWhileFetching")&&i.__abortController instanceof Nt},zt=function(e,i){t(this,z)[i]=e,t(this,P)[e]=i;},At=function(e){e!==t(this,R)&&(e===t(this,N)?u(this,N,t(this,P)[e]):d(this,l,zt).call(this,t(this,z)[e],t(this,P)[e]),d(this,l,zt).call(this,t(this,R),e),u(this,R,e));},ct=function(e,i){var r,n;let s=false;if(t(this,O)!==0){let o=t(this,T).get(e);if(o!==void 0)if(t(this,W)?.[o]&&(clearTimeout(t(this,W)?.[o]),t(this,W)[o]=void 0),s=true,t(this,O)===1)d(this,l,Vt).call(this,i);else {t(this,mt).call(this,o);let c=t(this,m)[o];if(d(this,l,E).call(this,c)?c.__abortController.abort(new Error("deleted")):(t(this,tt)||t(this,j))&&(t(this,tt)&&((r=t(this,q))==null||r.call(this,c,e,i)),t(this,j)&&t(this,D)?.push([c,e,i])),t(this,T).delete(e),t(this,b)[o]=void 0,t(this,m)[o]=void 0,o===t(this,R))u(this,R,t(this,z)[o]);else if(o===t(this,N))u(this,N,t(this,P)[o]);else {let p=t(this,z)[o];t(this,P)[p]=t(this,P)[o];let v=t(this,P)[o];t(this,z)[v]=t(this,z)[o];}Rt(this,O)._--,t(this,J).push(o);}}if(t(this,j)&&t(this,D)?.length){let o=t(this,D),c;for(;c=o?.shift();)(n=t(this,$))==null||n.call(this,...c);}return s},Vt=function(e){var i,s;for(let r of d(this,l,ht).call(this,{allowStale:true})){let n=t(this,m)[r];if(d(this,l,E).call(this,n))n.__abortController.abort(new Error("deleted"));else {let o=t(this,b)[r];t(this,tt)&&((i=t(this,q))==null||i.call(this,n,o,e)),t(this,j)&&t(this,D)?.push([n,o,e]);}}if(t(this,T).clear(),t(this,m).fill(void 0),t(this,b).fill(void 0),t(this,V)&&t(this,Z)){t(this,V).fill(0),t(this,Z).fill(0);for(let r of t(this,W)??[])r!==void 0&&clearTimeout(r);t(this,W)?.fill(void 0);}if(t(this,Q)&&t(this,Q).fill(0),u(this,N,0),u(this,R,0),t(this,J).length=0,u(this,X,0),u(this,O,0),t(this,j)&&t(this,D)){let r=t(this,D),n;for(;n=r?.shift();)(s=t(this,$))==null||s.call(this,...n);}},wt);var Ft=class{cache;map=new Map;constructor(e){this.cache=new re({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.16";var Wt={version:Ut};var Yt="repeat";function Ht(h){return {type:"pause",duration:h}}var Kt="__game_layer__";var ve={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 ae={};var kt={};fe(kt,{createExportableElement:()=>le});var gt;(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)))(gt||={});function le(h){try{if(typeof h>"u")return h;let e=JSON.stringify(h);return JSON.parse(e)}catch(e){throw gt.error("Error creating exportable element",h,e),new core.PixiError("not_json_serializable","Error creating exportable element")}}var ye=typeof window<"u"&&typeof document<"u",he=[" _______ _ _ _ ____ ____ ____ _____ ","|_ __ \\ (_) (_) | | |_ _| |_ _||_ \\|_ _|"," | |__) |__ _ __ __ \\_| \\ \\ / / | \\ | | "," | ___/[ | [ \\ [ ][ | \\ \\ / / | |\\ \\| | "," _| |_ | | > ' < | | \\ ' / _| |_\\ |_ ",`|_____| [___][__]\`\\_][___] \\_/ |_____|\\____| v${Wt.version}`],ce=31,xe="background:#2f90da;color:#fff;font-weight:bold;",Ee="background:#c832bb;color:#fff;font-weight:bold;",be="background:transparent;font-weight:bold;",qt=` v${Wt.version}`;function de(){if(!ye)return;let h=[],e=[];for(let i=0;i<he.length;i++){let s=he[i],r=s.endsWith(qt),n=r?s.slice(0,-qt.length):s,o=n.slice(0,ce),c=n.slice(ce),p=r?"%c%s%c%s%c%s":"%c%s%c%s";h.push(p),e.push(xe,o,Ee,c),r&&e.push(be,qt);}console.info(h.join(`
|
|
2
2
|
`),...e);}function $t(){let h=window.location.pathname+window.location.hash;return h.includes("#")&&(h=h.split("#")[1]),h}de();exports.Game=void 0;(y=>{async function h(a,x,A){if(core.GameUnifier.init({navigate:x?.navigate,getCurrentGameStepState:()=>{let f={};try{f=nt__namespace.canvas.export();}catch{}return {path:$t(),storage:G__namespace.storage.export(),canvas:f,sound:pt__namespace.sound.export(),labelIndex:L__namespace.NarrationManagerStatic.currentLabelStepIndex||0,openedLabels:L__namespace.narration.openedLabels}},restoreGameStepState:async(f,g)=>{et__namespace.HistoryManagerStatic._originalStepData=f,L__namespace.NarrationManagerStatic.openedLabels=f.openedLabels,G__namespace.storage.restore(f.storage);try{await nt__namespace.canvas.restore(f.canvas),await pt__namespace.sound.restore(f.sound);}catch(F){gt.error("Error restoring game step state:",F);}await g(f.path);},getStepCounter:()=>L__namespace.narration.stepCounter,setStepCounter:f=>{L__namespace.NarrationManagerStatic._stepCounter=f;},getOpenedLabels:()=>L__namespace.narration.openedLabels.length,addHistoryItem:(f,g)=>et__namespace.stepHistory.add(f,g),getCharacter:f=>Bt__namespace.RegisteredCharacters.get(f),processNavigationRequests:(f,g)=>{let F=f,H=Promise.resolve();return f>0?(F--,H=L__namespace.narration.continue(g)):f<0&&(F=0,H=et__namespace.stepHistory.back(g,{steps:f*-1})),{newValue:F,result:H}},animate:(f,g,F,H)=>motion.motion.animate(f,g,F,H),getVariable:(f,g)=>G__namespace.StorageRegistry.getVariable(f,g),setVariable:(f,g,F)=>G__namespace.StorageRegistry.setVariable(f,g,F),removeVariable:(f,g)=>G__namespace.StorageRegistry.removeVariable(f,g),getFlag:f=>G__namespace.storage.getFlag(f),setFlag:(f,g)=>G__namespace.storage.setFlag(f,g),onLabelClosing:f=>G__namespace.StorageRegistry.clearOldTempVariables(f)}),!a||!x){gt.warn("The canvas element or options are not defined. The canvas will not be initialized.");return}return await nt__namespace.canvas.init(a,x,A)}y.init=h;function e(){G__namespace.storage.clear();try{nt__namespace.canvas.clear();}catch{}pt__namespace.sound.clear(),L__namespace.narration.clear(),et__namespace.stepHistory.clear();}y.clear=e;function i(){let a={};try{a=nt__namespace.canvas.export();}catch{}return {pixivn_version:Ut,stepData:L__namespace.narration.export(),storageData:G__namespace.storage.export(),canvasData:a,soundData:pt__namespace.sound.export(),historyData:et__namespace.stepHistory.export(),path:$t()}}y.exportGameState=i;async function s(a,x){et__namespace.stepHistory.restore(a.historyData);let A=et__namespace.stepHistory.lastKey;if(typeof A=="number"){let f=et__namespace.stepHistory.stepsInfoMap.get(A)||null;await L__namespace.narration.restore(a.stepData,f);}G__namespace.storage.restore(a.storageData);try{await nt__namespace.canvas.restore(a.canvasData),await pt__namespace.sound.restore(a.soundData);}catch{}x?await x(a.path):await core.GameUnifier.navigate(a.path);}y.restoreGameState=s;async function r(a,x){return y.clear(),await L__namespace.narration.call(a,x)}y.start=r;function n(a){return JSON.parse(a)}y.jsonToGameState=n;function o(a){core.GameUnifier.onEnd=a;}y.onEnd=o;function c(a){return gt.warn("Game.onError is deprecated. Use Game.addOnError / Game.removeOnError to register multiple handlers."),core.GameUnifier.addOnError((x,A)=>a("step",x,A))}y.onError=c;function p(a){return core.GameUnifier.addOnError(a)}y.addOnError=p;function v(a){return core.GameUnifier.removeOnError(a)}y.removeOnError=v;function U(a){L__namespace.NarrationManagerStatic.onStepStart=a;}y.onStepStart=U;function S(a){L__namespace.NarrationManagerStatic.onLoadingLabel=a;}y.onLoadingLabel=S;function rt(a){L__namespace.NarrationManagerStatic.onStepEnd=a;}y.onStepEnd=rt;function I(a){core.GameUnifier.navigate=a;}y.onNavigate=I;function k(a){return core.GameUnifier.addOnPreContinue(a)}y.addOnPreContinue=k;function w(a){return core.GameUnifier.removeOnPreContinue(a)}y.removeOnPreContinue=w;})(exports.Game||={});var Ze={characterUtils:Bt__namespace,canvasUtils:nt__namespace,narrationUtils:L__namespace,soundUtils:pt__namespace,CANVAS_APP_GAME_LAYER_ALIAS:Kt,Pause:Ht,Repeat:Yt,PIXIVN_VERSION:Ut,...kt,...ae,canvas:nt__namespace.canvas,narration:L__namespace.narration,sound:pt__namespace.sound,storage:G__namespace.storage,history:et__namespace.stepHistory,Game:exports.Game,GameUnifier:core.GameUnifier};exports.CANVAS_APP_GAME_LAYER_ALIAS=Kt;exports.CachedMap=Ft;exports.PIXIVN_VERSION=Ut;exports.Pause=Ht;exports.Repeat=Yt;exports.SYSTEM_RESERVED_STORAGE_KEYS=ve;exports.createExportableElement=le;exports.default=Ze;Object.keys(nt).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return nt[k]}})});Object.keys(Bt).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return Bt[k]}})});Object.keys(core).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return core[k]}})});Object.keys(et).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return et[k]}})});Object.keys(L).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return L[k]}})});Object.keys(pt).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return pt[k]}})});Object.keys(G).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return G[k]}})});
|
package/dist/index.d.cts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {f as f$1,b as b$1,g,e,d,h,i}from'./chunk-K7JIC2F2.mjs';import*as nt from'@drincs/pixi-vn/canvas';export*from'@drincs/pixi-vn/canvas';import*as $t 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 L from'@drincs/pixi-vn/narration';export*from'@drincs/pixi-vn/narration';import*as pt 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,Qt=new Set,jt=typeof process=="object"&&process?process:{},Zt=(m,e,i,s)=>{typeof jt.emitWarning=="function"?jt.emitWarning(m,e,i,s):console.error(`[${i}] ${e}: ${m}`);},Nt=globalThis.AbortController,Bt=globalThis.AbortSignal;if(typeof Nt>"u"){Bt=class{onabort;_onabort=[];reason;aborted=false;addEventListener(i,s){this._onabort.push(s);}},Nt=class{constructor(){e();}signal=new Bt;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,Zt("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",e));};}var pe=m=>!Qt.has(m);var at=m=>m&&m===Math.floor(m)&&m>0&&isFinite(m),te=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{heap;length;static create(e){let i=te(e);if(!i)return [];g(it,St,true);let s=new it(e,i);return g(it,St,false),s}constructor(e$1,i){if(!e(it,St))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new i(e$1),this.length=0;}push(e){this.heap[this.length++]=e;}pop(){return this.heap[--this.length]}},St=new WeakMap,f$1(it,St,false),it),Xt,Jt,K,M,q,ut,$,yt,xt,B,O,X,T,b,f,P,z,N,R,J,D,Q,Z,V,W,tt,dt,j,Et,l,Gt,ft,ot,Tt,Y,ie,mt,bt,Ot,lt,ht,It,Lt,Ct,E,Mt,At,ct,zt,wt,ee=(wt=class{constructor(e$1){f$1(this,l);f$1(this,K);f$1(this,M);f$1(this,q);f$1(this,ut);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,O);f$1(this,X);f$1(this,T);f$1(this,b);f$1(this,f);f$1(this,P);f$1(this,z);f$1(this,N);f$1(this,R);f$1(this,J);f$1(this,D);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,ft,()=>{});f$1(this,ot,()=>{});f$1(this,Tt,()=>{});f$1(this,Y,()=>false);f$1(this,mt,e=>{});f$1(this,bt,(e,i,s)=>{});f$1(this,Ot,(e,i,s,r)=>{if(s||r)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});d(this,Xt,"LRUCache");let{max:i=0,ttl:s,ttlResolution:r=1,ttlAutopurge:n,updateAgeOnGet:o,updateAgeOnHas:h$1,allowStale:d$1,dispose:v,onInsert:U,disposeAfter:S,noDisposeOnSet:rt,noUpdateTTL:I,maxSize:k=0,maxEntrySize:w=0,sizeCalculation:y,fetchMethod:a,memoMethod:x,noDeleteOnFetchRejection:A,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?te(i):Array;if(!vt)throw new Error("invalid max value: "+i);if(g(this,K,i),g(this,M,k),this.maxEntrySize=w||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,b,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,R,0),g(this,J,ue.create(i)),g(this,O,0),g(this,X,0),typeof v=="function"&&g(this,q,v),typeof U=="function"&&g(this,ut,U),typeof S=="function"?(g(this,$,S),g(this,D,[])):(g(this,$,void 0),g(this,D,void 0)),g(this,tt,!!e(this,q)),g(this,Et,!!e(this,ut)),g(this,j,!!e(this,$)),this.noDisposeOnSet=!!rt,this.noUpdateTTL=!!I,this.noDeleteOnFetchRejection=!!A,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,ie).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)&&(Qt.add(Pt),Zt("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,b),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,R)},free:e(e$1,J),isBackgroundFetch:i=>{var s;return h(s=e$1,l,E).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,O)}get fetchMethod(){return e(this,yt)}get memoMethod(){return e(this,xt)}get dispose(){return e(this,q)}get onInsert(){return e(this,ut)}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,b)[e$1]!==void 0&&!h(this,l,E).call(this,e(this,f)[e$1])&&(yield [e(this,b)[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,b)[e$1]!==void 0&&!h(this,l,E).call(this,e(this,f)[e$1])&&(yield [e(this,b)[e$1],e(this,f)[e$1]]);}*keys(){for(let e$1 of h(this,l,lt).call(this)){let i=e(this,b)[e$1];i!==void 0&&!h(this,l,E).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,b)[e$1];i!==void 0&&!h(this,l,E).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,E).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,E).call(this,e(this,f)[e$1])&&(yield e(this,f)[e$1]);}[(Jt=Symbol.iterator,Xt=Symbol.toStringTag,Jt)](){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,E).call(this,r)?r.__staleWhileFetching:r;if(n!==void 0&&e$1(n,e(this,b)[s],this))return this.get(e(this,b)[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,E).call(this,r)?r.__staleWhileFetching:r;n!==void 0&&e$1.call(i,n,e(this,b)[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,E).call(this,r)?r.__staleWhileFetching:r;n!==void 0&&e$1.call(i,n,e(this,b)[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,b)[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,E).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,b)[i],r=e(this,f)[i],n=h(this,l,E).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,w;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,U=e(this,Ot).call(this,e$1,i$1,s.size||0,h$1);if(this.maxEntrySize&&U>this.maxEntrySize)return d&&(d.set="miss",d.maxEntrySizeExceeded=true),h(this,l,ct).call(this,e$1,"set"),this;let S=e(this,O)===0?void 0:e(this,T).get(e$1);if(S===void 0)S=e(this,O)===0?e(this,R):e(this,J).length!==0?e(this,J).pop():e(this,O)===e(this,K)?h(this,l,Lt).call(this,false):e(this,O),e(this,b)[S]=e$1,e(this,f)[S]=i$1,e(this,T).set(e$1,S),e(this,P)[e(this,R)]=S,e(this,z)[S]=e(this,R),g(this,R,S),i(this,O)._++,e(this,bt).call(this,S,U,d),d&&(d.set="add"),v=false,e(this,Et)&&((rt=e(this,ut))==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,E).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,D)?.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,D)?.push([y,e$1,"set"]));if(e(this,mt).call(this,S),e(this,bt).call(this,S,U,d),e(this,f)[S]=i$1,d){d.set="replace";let a=y&&h(this,l,E).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,Tt).call(this,S,r,n),d&&e(this,ot).call(this,d,S)),!o&&e(this,j)&&e(this,D)){let y=e(this,D),a;for(;a=y?.shift();)(w=e(this,$))==null||w.call(this,...a);}return this}pop(){var e$1;try{for(;e(this,O);){let i=e(this,f)[e(this,N)];if(h(this,l,Lt).call(this,!0),h(this,l,E).call(this,i)){if(i.__staleWhileFetching)return i.__staleWhileFetching}else if(i!==void 0)return i}}finally{if(e(this,j)&&e(this,D)){let i=e(this,D),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,E).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,ft).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,E).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:U=this.noUpdateTTL,noDeleteOnFetchRejection:S=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:rt=this.allowStaleOnFetchRejection,ignoreFetchAbort:I=this.ignoreFetchAbort,allowStaleOnFetchAbort:k=this.allowStaleOnFetchAbort,context:w,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 A={allowStale:s,updateAgeOnGet:r,noDeleteOnStaleGet:n,ttl:o,noDisposeOnSet:h$1,size:d,sizeCalculation:v,noUpdateTTL:U,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,A,w);return g.__returned=g}else {let g=e(this,f)[u];if(h(this,l,E).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,ft).call(this,u),a&&e(this,ot).call(this,a,u),g;let H=h(this,l,Ct).call(this,e$1,u,A,w),_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,E).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,ft).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,ut=new WeakMap,$=new WeakMap,yt=new WeakMap,xt=new WeakMap,B=new WeakMap,O=new WeakMap,X=new WeakMap,T=new WeakMap,b=new WeakMap,f=new WeakMap,P=new WeakMap,z=new WeakMap,N=new WeakMap,R=new WeakMap,J=new WeakMap,D=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,Tt,(h,d,v=e(this,B).now())=>{i[h]=d!==0?v:0,e$1[h]=d,r(h,d);}),g(this,ft,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,b)[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],U=i[d];if(!v||!U)return;h.ttl=v,h.start=U,h.now=n||o();let S=h.now-U;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],U=i[d];if(!v||!U)return 1/0;let S=(n||o())-U;return v-S},g(this,Y,h=>{let d=i[h],v=e$1[h];return !!v&&!!d&&(n||o())-d>v});},ft=new WeakMap,ot=new WeakMap,Tt=new WeakMap,Y=new WeakMap,ie=function(){let e$1=new Dt(e(this,K));g(this,X,0),g(this,Q,e$1),g(this,mt,i=>{g(this,X,e(this,X)-e$1[i]),e$1[i]=0;}),g(this,Ot,(i,s,r,n)=>{if(h(this,l,E).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));});},mt=new WeakMap,bt=new WeakMap,Ot=new WeakMap,lt=function*({allowStale:e$1=this.allowStale}={}){if(e(this,O))for(let i=e(this,R);!(!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,O))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,R)));)i=e(this,P)[i];},It=function(e$1){return e$1!==void 0&&e(this,T).get(e(this,b)[e$1])===e$1},Lt=function(e$1){var n;let i$1=e(this,N),s=e(this,b)[i$1],r=e(this,f)[i$1];return e(this,dt)&&h(this,l,E).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,D)?.push([r,s,"evict"])),e(this,mt).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,b)[i$1]=void 0,e(this,f)[i$1]=void 0,e(this,J).push(i$1)),e(this,O)===1?(g(this,N,g(this,R,0)),e(this,J).length=0):g(this,N,e(this,P)[i$1]),e(this,T).delete(s),i(this,O)._--,i$1},Ct=function(e$1,i,s,r){let n=i===void 0?void 0:e(this,f)[i];if(h(this,l,E).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=(w,y=false)=>{let{aborted:a}=o.signal,x=s.ignoreFetchAbort&&w!==void 0,A=s.ignoreFetchAbort||!!(s.allowStaleOnFetchAbort&&w!==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,A);let u=I,g=e(this,f)[i];return (g===I||x&&y&&g===void 0)&&(w===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,w,d.options))),w},U=w=>(s.status&&(s.status.fetchRejected=true,s.status.fetchError=w),S(w,false)),S=(w,y)=>{let{aborted:a}=o.signal,x=a&&s.allowStaleOnFetchAbort,A=x||s.allowStaleOnFetchRejection,u=A||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)),A)return s.status&&g.__staleWhileFetching!==void 0&&(s.status.returnedStale=true),g.__staleWhileFetching;if(g.__returned===g)throw w},rt=(w,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(A=>w(A===void 0?void 0:A),y),o.signal.addEventListener("abort",()=>{(!s.ignoreFetchAbort||s.allowStaleOnFetchAbort)&&(w(void 0),s.allowStaleOnFetchAbort&&(w=A=>v(A,true)));});};s.status&&(s.status.fetchDispatched=true);let I=new Promise(rt).then(v,U),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},E=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,R)&&(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,R),e$1),g(this,R,e$1));},ct=function(e$1,i$1){var r,n;let s=false;if(e(this,O)!==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,O)===1)h(this,l,zt).call(this,i$1);else {e(this,mt).call(this,o);let h$1=e(this,f)[o];if(h(this,l,E).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,D)?.push([h$1,e$1,i$1])),e(this,T).delete(e$1),e(this,b)[o]=void 0,e(this,f)[o]=void 0,o===e(this,R))g(this,R,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,O)._--,e(this,J).push(o);}}if(e(this,j)&&e(this,D)?.length){let o=e(this,D),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,E).call(this,n))n.__abortController.abort(new Error("deleted"));else {let o=e(this,b)[r];e(this,tt)&&((i=e(this,q))==null||i.call(this,n,o,e$1)),e(this,j)&&e(this,D)?.push([n,o,e$1]);}}if(e(this,T).clear(),e(this,f).fill(void 0),e(this,b).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,R,0),e(this,J).length=0,g(this,X,0),g(this,O,0),e(this,j)&&e(this,D)){let r=e(this,D),n;for(;n=r?.shift();)(s=e(this,$))==null||s.call(this,...n);}},wt);var Ft=class{cache;map=new Map;constructor(e){this.cache=new ee({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.14";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 re={};var Kt={};b$1(Kt,{createExportableElement:()=>oe});var gt;(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)))(gt||={});function oe(m){try{if(typeof m>"u")return m;let e=JSON.stringify(m);return JSON.parse(e)}catch(e){throw gt.error("Error creating exportable element",m,e),new PixiError("not_json_serializable","Error creating exportable element")}}var ge=typeof window<"u"&&typeof document<"u",ne=[" _______ _ _ _ ____ ____ ____ _____ ","|_ __ \\ (_) (_) | | |_ _| |_ _||_ \\|_ _|"," | |__) |__ _ __ __ \\_| \\ \\ / / | \\ | | "," | ___/[ | [ \\ [ ][ | \\ \\ / / | |\\ \\| | "," _| |_ | | > ' < | | \\ ' / _| |_\\ |_ ",`|_____| [___][__]\`\\_][___] \\_/ |_____|\\____| v${Vt.version}`],ae=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 le(){if(!ge)return;let m=[],e=[];for(let i=0;i<ne.length;i++){let s=ne[i],r=s.endsWith(kt),n=r?s.slice(0,-kt.length):s,o=n.slice(0,ae),h=n.slice(ae),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(`
|
|
1
|
+
import {f as f$1,b as b$1,g,e,d,h,i}from'./chunk-K7JIC2F2.mjs';import*as nt from'@drincs/pixi-vn/canvas';export*from'@drincs/pixi-vn/canvas';import*as $t 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 L from'@drincs/pixi-vn/narration';export*from'@drincs/pixi-vn/narration';import*as pt 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,Qt=new Set,jt=typeof process=="object"&&process?process:{},Zt=(m,e,i,s)=>{typeof jt.emitWarning=="function"?jt.emitWarning(m,e,i,s):console.error(`[${i}] ${e}: ${m}`);},Nt=globalThis.AbortController,Bt=globalThis.AbortSignal;if(typeof Nt>"u"){Bt=class{onabort;_onabort=[];reason;aborted=false;addEventListener(i,s){this._onabort.push(s);}},Nt=class{constructor(){e();}signal=new Bt;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,Zt("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",e));};}var pe=m=>!Qt.has(m);var at=m=>m&&m===Math.floor(m)&&m>0&&isFinite(m),te=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{heap;length;static create(e){let i=te(e);if(!i)return [];g(it,St,true);let s=new it(e,i);return g(it,St,false),s}constructor(e$1,i){if(!e(it,St))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new i(e$1),this.length=0;}push(e){this.heap[this.length++]=e;}pop(){return this.heap[--this.length]}},St=new WeakMap,f$1(it,St,false),it),Xt,Jt,K,M,q,ut,$,yt,xt,B,O,X,T,b,f,P,z,N,R,J,D,Q,Z,V,W,tt,dt,j,Et,l,Gt,ft,ot,Tt,Y,ie,mt,bt,Ot,lt,ht,It,Lt,Ct,E,Mt,At,ct,zt,wt,ee=(wt=class{constructor(e$1){f$1(this,l);f$1(this,K);f$1(this,M);f$1(this,q);f$1(this,ut);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,O);f$1(this,X);f$1(this,T);f$1(this,b);f$1(this,f);f$1(this,P);f$1(this,z);f$1(this,N);f$1(this,R);f$1(this,J);f$1(this,D);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,ft,()=>{});f$1(this,ot,()=>{});f$1(this,Tt,()=>{});f$1(this,Y,()=>false);f$1(this,mt,e=>{});f$1(this,bt,(e,i,s)=>{});f$1(this,Ot,(e,i,s,r)=>{if(s||r)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});d(this,Xt,"LRUCache");let{max:i=0,ttl:s,ttlResolution:r=1,ttlAutopurge:n,updateAgeOnGet:o,updateAgeOnHas:h$1,allowStale:d$1,dispose:v,onInsert:U,disposeAfter:S,noDisposeOnSet:rt,noUpdateTTL:I,maxSize:k=0,maxEntrySize:w=0,sizeCalculation:y,fetchMethod:a,memoMethod:x,noDeleteOnFetchRejection:A,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?te(i):Array;if(!vt)throw new Error("invalid max value: "+i);if(g(this,K,i),g(this,M,k),this.maxEntrySize=w||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,b,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,R,0),g(this,J,ue.create(i)),g(this,O,0),g(this,X,0),typeof v=="function"&&g(this,q,v),typeof U=="function"&&g(this,ut,U),typeof S=="function"?(g(this,$,S),g(this,D,[])):(g(this,$,void 0),g(this,D,void 0)),g(this,tt,!!e(this,q)),g(this,Et,!!e(this,ut)),g(this,j,!!e(this,$)),this.noDisposeOnSet=!!rt,this.noUpdateTTL=!!I,this.noDeleteOnFetchRejection=!!A,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,ie).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)&&(Qt.add(Pt),Zt("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,b),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,R)},free:e(e$1,J),isBackgroundFetch:i=>{var s;return h(s=e$1,l,E).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,O)}get fetchMethod(){return e(this,yt)}get memoMethod(){return e(this,xt)}get dispose(){return e(this,q)}get onInsert(){return e(this,ut)}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,b)[e$1]!==void 0&&!h(this,l,E).call(this,e(this,f)[e$1])&&(yield [e(this,b)[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,b)[e$1]!==void 0&&!h(this,l,E).call(this,e(this,f)[e$1])&&(yield [e(this,b)[e$1],e(this,f)[e$1]]);}*keys(){for(let e$1 of h(this,l,lt).call(this)){let i=e(this,b)[e$1];i!==void 0&&!h(this,l,E).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,b)[e$1];i!==void 0&&!h(this,l,E).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,E).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,E).call(this,e(this,f)[e$1])&&(yield e(this,f)[e$1]);}[(Jt=Symbol.iterator,Xt=Symbol.toStringTag,Jt)](){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,E).call(this,r)?r.__staleWhileFetching:r;if(n!==void 0&&e$1(n,e(this,b)[s],this))return this.get(e(this,b)[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,E).call(this,r)?r.__staleWhileFetching:r;n!==void 0&&e$1.call(i,n,e(this,b)[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,E).call(this,r)?r.__staleWhileFetching:r;n!==void 0&&e$1.call(i,n,e(this,b)[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,b)[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,E).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,b)[i],r=e(this,f)[i],n=h(this,l,E).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,w;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,U=e(this,Ot).call(this,e$1,i$1,s.size||0,h$1);if(this.maxEntrySize&&U>this.maxEntrySize)return d&&(d.set="miss",d.maxEntrySizeExceeded=true),h(this,l,ct).call(this,e$1,"set"),this;let S=e(this,O)===0?void 0:e(this,T).get(e$1);if(S===void 0)S=e(this,O)===0?e(this,R):e(this,J).length!==0?e(this,J).pop():e(this,O)===e(this,K)?h(this,l,Lt).call(this,false):e(this,O),e(this,b)[S]=e$1,e(this,f)[S]=i$1,e(this,T).set(e$1,S),e(this,P)[e(this,R)]=S,e(this,z)[S]=e(this,R),g(this,R,S),i(this,O)._++,e(this,bt).call(this,S,U,d),d&&(d.set="add"),v=false,e(this,Et)&&((rt=e(this,ut))==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,E).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,D)?.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,D)?.push([y,e$1,"set"]));if(e(this,mt).call(this,S),e(this,bt).call(this,S,U,d),e(this,f)[S]=i$1,d){d.set="replace";let a=y&&h(this,l,E).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,Tt).call(this,S,r,n),d&&e(this,ot).call(this,d,S)),!o&&e(this,j)&&e(this,D)){let y=e(this,D),a;for(;a=y?.shift();)(w=e(this,$))==null||w.call(this,...a);}return this}pop(){var e$1;try{for(;e(this,O);){let i=e(this,f)[e(this,N)];if(h(this,l,Lt).call(this,!0),h(this,l,E).call(this,i)){if(i.__staleWhileFetching)return i.__staleWhileFetching}else if(i!==void 0)return i}}finally{if(e(this,j)&&e(this,D)){let i=e(this,D),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,E).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,ft).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,E).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:U=this.noUpdateTTL,noDeleteOnFetchRejection:S=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:rt=this.allowStaleOnFetchRejection,ignoreFetchAbort:I=this.ignoreFetchAbort,allowStaleOnFetchAbort:k=this.allowStaleOnFetchAbort,context:w,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 A={allowStale:s,updateAgeOnGet:r,noDeleteOnStaleGet:n,ttl:o,noDisposeOnSet:h$1,size:d,sizeCalculation:v,noUpdateTTL:U,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,A,w);return g.__returned=g}else {let g=e(this,f)[u];if(h(this,l,E).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,ft).call(this,u),a&&e(this,ot).call(this,a,u),g;let H=h(this,l,Ct).call(this,e$1,u,A,w),_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,E).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,ft).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,ut=new WeakMap,$=new WeakMap,yt=new WeakMap,xt=new WeakMap,B=new WeakMap,O=new WeakMap,X=new WeakMap,T=new WeakMap,b=new WeakMap,f=new WeakMap,P=new WeakMap,z=new WeakMap,N=new WeakMap,R=new WeakMap,J=new WeakMap,D=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,Tt,(h,d,v=e(this,B).now())=>{i[h]=d!==0?v:0,e$1[h]=d,r(h,d);}),g(this,ft,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,b)[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],U=i[d];if(!v||!U)return;h.ttl=v,h.start=U,h.now=n||o();let S=h.now-U;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],U=i[d];if(!v||!U)return 1/0;let S=(n||o())-U;return v-S},g(this,Y,h=>{let d=i[h],v=e$1[h];return !!v&&!!d&&(n||o())-d>v});},ft=new WeakMap,ot=new WeakMap,Tt=new WeakMap,Y=new WeakMap,ie=function(){let e$1=new Dt(e(this,K));g(this,X,0),g(this,Q,e$1),g(this,mt,i=>{g(this,X,e(this,X)-e$1[i]),e$1[i]=0;}),g(this,Ot,(i,s,r,n)=>{if(h(this,l,E).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));});},mt=new WeakMap,bt=new WeakMap,Ot=new WeakMap,lt=function*({allowStale:e$1=this.allowStale}={}){if(e(this,O))for(let i=e(this,R);!(!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,O))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,R)));)i=e(this,P)[i];},It=function(e$1){return e$1!==void 0&&e(this,T).get(e(this,b)[e$1])===e$1},Lt=function(e$1){var n;let i$1=e(this,N),s=e(this,b)[i$1],r=e(this,f)[i$1];return e(this,dt)&&h(this,l,E).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,D)?.push([r,s,"evict"])),e(this,mt).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,b)[i$1]=void 0,e(this,f)[i$1]=void 0,e(this,J).push(i$1)),e(this,O)===1?(g(this,N,g(this,R,0)),e(this,J).length=0):g(this,N,e(this,P)[i$1]),e(this,T).delete(s),i(this,O)._--,i$1},Ct=function(e$1,i,s,r){let n=i===void 0?void 0:e(this,f)[i];if(h(this,l,E).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=(w,y=false)=>{let{aborted:a}=o.signal,x=s.ignoreFetchAbort&&w!==void 0,A=s.ignoreFetchAbort||!!(s.allowStaleOnFetchAbort&&w!==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,A);let u=I,g=e(this,f)[i];return (g===I||x&&y&&g===void 0)&&(w===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,w,d.options))),w},U=w=>(s.status&&(s.status.fetchRejected=true,s.status.fetchError=w),S(w,false)),S=(w,y)=>{let{aborted:a}=o.signal,x=a&&s.allowStaleOnFetchAbort,A=x||s.allowStaleOnFetchRejection,u=A||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)),A)return s.status&&g.__staleWhileFetching!==void 0&&(s.status.returnedStale=true),g.__staleWhileFetching;if(g.__returned===g)throw w},rt=(w,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(A=>w(A===void 0?void 0:A),y),o.signal.addEventListener("abort",()=>{(!s.ignoreFetchAbort||s.allowStaleOnFetchAbort)&&(w(void 0),s.allowStaleOnFetchAbort&&(w=A=>v(A,true)));});};s.status&&(s.status.fetchDispatched=true);let I=new Promise(rt).then(v,U),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},E=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,R)&&(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,R),e$1),g(this,R,e$1));},ct=function(e$1,i$1){var r,n;let s=false;if(e(this,O)!==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,O)===1)h(this,l,zt).call(this,i$1);else {e(this,mt).call(this,o);let h$1=e(this,f)[o];if(h(this,l,E).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,D)?.push([h$1,e$1,i$1])),e(this,T).delete(e$1),e(this,b)[o]=void 0,e(this,f)[o]=void 0,o===e(this,R))g(this,R,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,O)._--,e(this,J).push(o);}}if(e(this,j)&&e(this,D)?.length){let o=e(this,D),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,E).call(this,n))n.__abortController.abort(new Error("deleted"));else {let o=e(this,b)[r];e(this,tt)&&((i=e(this,q))==null||i.call(this,n,o,e$1)),e(this,j)&&e(this,D)?.push([n,o,e$1]);}}if(e(this,T).clear(),e(this,f).fill(void 0),e(this,b).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,R,0),e(this,J).length=0,g(this,X,0),g(this,O,0),e(this,j)&&e(this,D)){let r=e(this,D),n;for(;n=r?.shift();)(s=e(this,$))==null||s.call(this,...n);}},wt);var Ft=class{cache;map=new Map;constructor(e){this.cache=new ee({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.16";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 re={};var Kt={};b$1(Kt,{createExportableElement:()=>oe});var gt;(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)))(gt||={});function oe(m){try{if(typeof m>"u")return m;let e=JSON.stringify(m);return JSON.parse(e)}catch(e){throw gt.error("Error creating exportable element",m,e),new PixiError("not_json_serializable","Error creating exportable element")}}var ge=typeof window<"u"&&typeof document<"u",ne=[" _______ _ _ _ ____ ____ ____ _____ ","|_ __ \\ (_) (_) | | |_ _| |_ _||_ \\|_ _|"," | |__) |__ _ __ __ \\_| \\ \\ / / | \\ | | "," | ___/[ | [ \\ [ ][ | \\ \\ / / | |\\ \\| | "," _| |_ | | > ' < | | \\ ' / _| |_\\ |_ ",`|_____| [___][__]\`\\_][___] \\_/ |_____|\\____| v${Vt.version}`],ae=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 le(){if(!ge)return;let m=[],e=[];for(let i=0;i<ne.length;i++){let s=ne[i],r=s.endsWith(kt),n=r?s.slice(0,-kt.length):s,o=n.slice(0,ae),h=n.slice(ae),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
2
|
`),...e);}function qt(){let m=window.location.pathname+window.location.hash;return m.includes("#")&&(m=m.split("#")[1]),m}le();var he;(y=>{async function m(a,x,A){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:pt.sound.export(),labelIndex:L.NarrationManagerStatic.currentLabelStepIndex||0,openedLabels:L.narration.openedLabels}},restoreGameStepState:async(u,g)=>{et.HistoryManagerStatic._originalStepData=u,L.NarrationManagerStatic.openedLabels=u.openedLabels,G.storage.restore(u.storage);try{await nt.canvas.restore(u.canvas),await pt.sound.restore(u.sound);}catch(F){gt.error("Error restoring game step state:",F);}await g(u.path);},getStepCounter:()=>L.narration.stepCounter,setStepCounter:u=>{L.NarrationManagerStatic._stepCounter=u;},getOpenedLabels:()=>L.narration.openedLabels.length,addHistoryItem:(u,g)=>et.stepHistory.add(u,g),getCharacter:u=>$t.RegisteredCharacters.get(u),processNavigationRequests:(u,g)=>{let F=u,H=Promise.resolve();return u>0?(F--,H=L.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){gt.warn("The canvas element or options are not defined. The canvas will not be initialized.");return}return await nt.canvas.init(a,x,A)}y.init=m;function e(){G.storage.clear();try{nt.canvas.clear();}catch{}pt.sound.clear(),L.narration.clear(),et.stepHistory.clear();}y.clear=e;function i(){let a={};try{a=nt.canvas.export();}catch{}return {pixivn_version:Ut,stepData:L.narration.export(),storageData:G.storage.export(),canvasData:a,soundData:pt.sound.export(),historyData:et.stepHistory.export(),path:qt()}}y.exportGameState=i;async function s(a,x){et.stepHistory.restore(a.historyData);let A=et.stepHistory.lastKey;if(typeof A=="number"){let u=et.stepHistory.stepsInfoMap.get(A)||null;await L.narration.restore(a.stepData,u);}G.storage.restore(a.storageData);try{await nt.canvas.restore(a.canvasData),await pt.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 L.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 gt.warn("Game.onError is deprecated. Use Game.addOnError / Game.removeOnError to register multiple handlers."),GameUnifier.addOnError((x,A)=>a("step",x,A))}y.onError=h;function d(a){return GameUnifier.addOnError(a)}y.addOnError=d;function v(a){return GameUnifier.removeOnError(a)}y.removeOnError=v;function U(a){L.NarrationManagerStatic.onStepStart=a;}y.onStepStart=U;function S(a){L.NarrationManagerStatic.onLoadingLabel=a;}y.onLoadingLabel=S;function rt(a){L.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 w(a){return GameUnifier.removeOnPreContinue(a)}y.removeOnPreContinue=w;})(he||={});var $e={characterUtils:$t,canvasUtils:nt,narrationUtils:L,soundUtils:pt,CANVAS_APP_GAME_LAYER_ALIAS:Ht,Pause:Yt,Repeat:Wt,PIXIVN_VERSION:Ut,...Kt,...re,canvas:nt.canvas,narration:L.narration,sound:pt.sound,storage:G.storage,history:et.stepHistory,Game:he,GameUnifier:GameUnifier};export{Ht as CANVAS_APP_GAME_LAYER_ALIAS,Ft as CachedMap,he as Game,Ut as PIXIVN_VERSION,Yt as Pause,Wt as Repeat,fe as SYSTEM_RESERVED_STORAGE_KEYS,oe as createExportableElement,$e as default};
|
package/dist/sound.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var core=require('@drincs/pixi-vn/core'),kt=require('@drincs/pixi-vn/pixi.js'),B=require('tone');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var kt__default=/*#__PURE__*/_interopDefault(kt);var B__namespace=/*#__PURE__*/_interopNamespace(B);var Rt=Object.defineProperty;var wt=o=>{throw TypeError(o)};var Nt=(o,t,e)=>t in o?Rt(o,t,{enumerable:true,configurable:true,writable:true,value:e}):o[t]=e;var x=(o,t,e)=>Nt(o,typeof t!="symbol"?t+"":t,e),ze=(o,t,e)=>t.has(o)||wt("Cannot "+e);var i=(o,t,e)=>(ze(o,t,"read from private field"),e?e.call(o):t.get(o)),g=(o,t,e)=>t.has(o)?wt("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(o):t.set(o,e),c=(o,t,e,n)=>(ze(o,t,"write to private field"),t.set(o,e),e),d=(o,t,e)=>(ze(o,t,"access private method"),e);var De=(o,t,e,n)=>({set _(s){c(o,t,s);},get _(){return i(o,t,n)}});var Tt="general";var Gt=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,Ot=new Set,qe=typeof process=="object"&&process?process:{},_t=(o,t,e,n)=>{typeof qe.emitWarning=="function"?qe.emitWarning(o,t,e,n):console.error(`[${e}] ${t}: ${o}`);},Re=globalThis.AbortController,At=globalThis.AbortSignal;if(typeof Re>"u"){At=class{onabort;_onabort=[];reason;aborted=false;addEventListener(e,n){this._onabort.push(n);}},Re=class{constructor(){t();}signal=new At;abort(e){if(!this.signal.aborted){this.signal.reason=e,this.signal.aborted=true;for(let n of this.signal._onabort)n(e);this.signal.onabort?.(e);}}};let o=qe.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",t=()=>{o&&(o=false,_t("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",t));};}var Lt=o=>!Ot.has(o);var se=o=>o&&o===Math.floor(o)&&o>0&&isFinite(o),Ct=o=>se(o)?o<=Math.pow(2,8)?Uint8Array:o<=Math.pow(2,16)?Uint16Array:o<=Math.pow(2,32)?Uint32Array:o<=Number.MAX_SAFE_INTEGER?Ie:null:null,Ie=class extends Array{constructor(o){super(o),this.fill(0);}},te,fe,zt=(te=class{heap;length;static create(t){let e=Ct(t);if(!e)return [];c(te,fe,true);let n=new te(t,e);return c(te,fe,false),n}constructor(t,e){if(!i(te,fe))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new e(t),this.length=0;}push(t){this.heap[this.length++]=t;}pop(){return this.heap[--this.length]}},fe=new WeakMap,g(te,fe,false),te),St,Ft,j,q,K,he,$,ye,ge,H,C,X,O,A,m,N,U,I,E,Q,P,Z,J,W,V,ee,le,G,ve,h,Ue,ue,ie,Fe,Y,Pt,de,be,Oe,ae,re,We,Me,ke,T,Ve,Se,oe,Ye,we,Et=(we=class{constructor(t){g(this,h);g(this,j);g(this,q);g(this,K);g(this,he);g(this,$);g(this,ye);g(this,ge);g(this,H);x(this,"ttl");x(this,"ttlResolution");x(this,"ttlAutopurge");x(this,"updateAgeOnGet");x(this,"updateAgeOnHas");x(this,"allowStale");x(this,"noDisposeOnSet");x(this,"noUpdateTTL");x(this,"maxEntrySize");x(this,"sizeCalculation");x(this,"noDeleteOnFetchRejection");x(this,"noDeleteOnStaleGet");x(this,"allowStaleOnFetchAbort");x(this,"allowStaleOnFetchRejection");x(this,"ignoreFetchAbort");g(this,C);g(this,X);g(this,O);g(this,A);g(this,m);g(this,N);g(this,U);g(this,I);g(this,E);g(this,Q);g(this,P);g(this,Z);g(this,J);g(this,W);g(this,V);g(this,ee);g(this,le);g(this,G);g(this,ve);g(this,ue,()=>{});g(this,ie,()=>{});g(this,Fe,()=>{});g(this,Y,()=>false);g(this,de,t=>{});g(this,be,(t,e,n)=>{});g(this,Oe,(t,e,n,s)=>{if(n||s)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});x(this,St,"LRUCache");let{max:e=0,ttl:n,ttlResolution:s=1,ttlAutopurge:r,updateAgeOnGet:a,updateAgeOnHas:l,allowStale:u,dispose:y,onInsert:b,disposeAfter:v,noDisposeOnSet:M,noUpdateTTL:D,maxSize:z=0,maxEntrySize:S=0,sizeCalculation:w,fetchMethod:f,memoMethod:k,noDeleteOnFetchRejection:L,noDeleteOnStaleGet:R,allowStaleOnFetchRejection:F,allowStaleOnFetchAbort:Ae,ignoreFetchAbort:ce,perf:pe}=t;if(pe!==void 0&&typeof pe?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(c(this,H,pe??Gt),e!==0&&!se(e))throw new TypeError("max option must be a nonnegative integer");let me=e?Ct(e):Array;if(!me)throw new Error("invalid max value: "+e);if(c(this,j,e),c(this,q,z),this.maxEntrySize=S||i(this,q),this.sizeCalculation=w,this.sizeCalculation){if(!i(this,q)&&!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(k!==void 0&&typeof k!="function")throw new TypeError("memoMethod must be a function if defined");if(c(this,ge,k),f!==void 0&&typeof f!="function")throw new TypeError("fetchMethod must be a function if specified");if(c(this,ye,f),c(this,le,!!f),c(this,O,new Map),c(this,A,new Array(e).fill(void 0)),c(this,m,new Array(e).fill(void 0)),c(this,N,new me(e)),c(this,U,new me(e)),c(this,I,0),c(this,E,0),c(this,Q,zt.create(e)),c(this,C,0),c(this,X,0),typeof y=="function"&&c(this,K,y),typeof b=="function"&&c(this,he,b),typeof v=="function"?(c(this,$,v),c(this,P,[])):(c(this,$,void 0),c(this,P,void 0)),c(this,ee,!!i(this,K)),c(this,ve,!!i(this,he)),c(this,G,!!i(this,$)),this.noDisposeOnSet=!!M,this.noUpdateTTL=!!D,this.noDeleteOnFetchRejection=!!L,this.allowStaleOnFetchRejection=!!F,this.allowStaleOnFetchAbort=!!Ae,this.ignoreFetchAbort=!!ce,this.maxEntrySize!==0){if(i(this,q)!==0&&!se(i(this,q)))throw new TypeError("maxSize must be a positive integer if specified");if(!se(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");d(this,h,Pt).call(this);}if(this.allowStale=!!u,this.noDeleteOnStaleGet=!!R,this.updateAgeOnGet=!!a,this.updateAgeOnHas=!!l,this.ttlResolution=se(s)||s===0?s:1,this.ttlAutopurge=!!r,this.ttl=n||0,this.ttl){if(!se(this.ttl))throw new TypeError("ttl must be a positive integer if specified");d(this,h,Ue).call(this);}if(i(this,j)===0&&this.ttl===0&&i(this,q)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!i(this,j)&&!i(this,q)){let Le="LRU_CACHE_UNBOUNDED";Lt(Le)&&(Ot.add(Le),_t("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",Le,we));}}get perf(){return i(this,H)}static unsafeExposeInternals(t){return {starts:i(t,J),ttls:i(t,W),autopurgeTimers:i(t,V),sizes:i(t,Z),keyMap:i(t,O),keyList:i(t,A),valList:i(t,m),next:i(t,N),prev:i(t,U),get head(){return i(t,I)},get tail(){return i(t,E)},free:i(t,Q),isBackgroundFetch:e=>{var n;return d(n=t,h,T).call(n,e)},backgroundFetch:(e,n,s,r)=>{var a;return d(a=t,h,ke).call(a,e,n,s,r)},moveToTail:e=>{var n;return d(n=t,h,Se).call(n,e)},indexes:e=>{var n;return d(n=t,h,ae).call(n,e)},rindexes:e=>{var n;return d(n=t,h,re).call(n,e)},isStale:e=>{var n;return i(n=t,Y).call(n,e)}}}get max(){return i(this,j)}get maxSize(){return i(this,q)}get calculatedSize(){return i(this,X)}get size(){return i(this,C)}get fetchMethod(){return i(this,ye)}get memoMethod(){return i(this,ge)}get dispose(){return i(this,K)}get onInsert(){return i(this,he)}get disposeAfter(){return i(this,$)}getRemainingTTL(t){return i(this,O).has(t)?1/0:0}*entries(){for(let t of d(this,h,ae).call(this))i(this,m)[t]!==void 0&&i(this,A)[t]!==void 0&&!d(this,h,T).call(this,i(this,m)[t])&&(yield [i(this,A)[t],i(this,m)[t]]);}*rentries(){for(let t of d(this,h,re).call(this))i(this,m)[t]!==void 0&&i(this,A)[t]!==void 0&&!d(this,h,T).call(this,i(this,m)[t])&&(yield [i(this,A)[t],i(this,m)[t]]);}*keys(){for(let t of d(this,h,ae).call(this)){let e=i(this,A)[t];e!==void 0&&!d(this,h,T).call(this,i(this,m)[t])&&(yield e);}}*rkeys(){for(let t of d(this,h,re).call(this)){let e=i(this,A)[t];e!==void 0&&!d(this,h,T).call(this,i(this,m)[t])&&(yield e);}}*values(){for(let t of d(this,h,ae).call(this))i(this,m)[t]!==void 0&&!d(this,h,T).call(this,i(this,m)[t])&&(yield i(this,m)[t]);}*rvalues(){for(let t of d(this,h,re).call(this))i(this,m)[t]!==void 0&&!d(this,h,T).call(this,i(this,m)[t])&&(yield i(this,m)[t]);}[(Ft=Symbol.iterator,St=Symbol.toStringTag,Ft)](){return this.entries()}find(t,e={}){for(let n of d(this,h,ae).call(this)){let s=i(this,m)[n],r=d(this,h,T).call(this,s)?s.__staleWhileFetching:s;if(r!==void 0&&t(r,i(this,A)[n],this))return this.get(i(this,A)[n],e)}}forEach(t,e=this){for(let n of d(this,h,ae).call(this)){let s=i(this,m)[n],r=d(this,h,T).call(this,s)?s.__staleWhileFetching:s;r!==void 0&&t.call(e,r,i(this,A)[n],this);}}rforEach(t,e=this){for(let n of d(this,h,re).call(this)){let s=i(this,m)[n],r=d(this,h,T).call(this,s)?s.__staleWhileFetching:s;r!==void 0&&t.call(e,r,i(this,A)[n],this);}}purgeStale(){let t=false;for(let e of d(this,h,re).call(this,{allowStale:true}))i(this,Y).call(this,e)&&(d(this,h,oe).call(this,i(this,A)[e],"expire"),t=true);return t}info(t){let e=i(this,O).get(t);if(e===void 0)return;let n=i(this,m)[e],s=d(this,h,T).call(this,n)?n.__staleWhileFetching:n;if(s===void 0)return;let r={value:s};if(i(this,W)&&i(this,J)){let a=i(this,W)[e],l=i(this,J)[e];if(a&&l){let u=a-(i(this,H).now()-l);r.ttl=u,r.start=Date.now();}}return i(this,Z)&&(r.size=i(this,Z)[e]),r}dump(){let t=[];for(let e of d(this,h,ae).call(this,{allowStale:true})){let n=i(this,A)[e],s=i(this,m)[e],r=d(this,h,T).call(this,s)?s.__staleWhileFetching:s;if(r===void 0||n===void 0)continue;let a={value:r};if(i(this,W)&&i(this,J)){a.ttl=i(this,W)[e];let l=i(this,H).now()-i(this,J)[e];a.start=Math.floor(Date.now()-l);}i(this,Z)&&(a.size=i(this,Z)[e]),t.unshift([n,a]);}return t}load(t){this.clear();for(let[e,n]of t){if(n.start){let s=Date.now()-n.start;n.start=i(this,H).now()-s;}this.set(e,n.value,n);}}set(t,e,n={}){var M,D,z,S;if(e===void 0)return this.delete(t),this;let{ttl:s=this.ttl,start:r,noDisposeOnSet:a=this.noDisposeOnSet,sizeCalculation:l=this.sizeCalculation,status:u}=n,{noUpdateTTL:y=this.noUpdateTTL}=n,b=i(this,Oe).call(this,t,e,n.size||0,l);if(this.maxEntrySize&&b>this.maxEntrySize)return u&&(u.set="miss",u.maxEntrySizeExceeded=true),d(this,h,oe).call(this,t,"set"),this;let v=i(this,C)===0?void 0:i(this,O).get(t);if(v===void 0)v=i(this,C)===0?i(this,E):i(this,Q).length!==0?i(this,Q).pop():i(this,C)===i(this,j)?d(this,h,Me).call(this,false):i(this,C),i(this,A)[v]=t,i(this,m)[v]=e,i(this,O).set(t,v),i(this,N)[i(this,E)]=v,i(this,U)[v]=i(this,E),c(this,E,v),De(this,C)._++,i(this,be).call(this,v,b,u),u&&(u.set="add"),y=false,i(this,ve)&&((M=i(this,he))==null||M.call(this,e,t,"add"));else {d(this,h,Se).call(this,v);let w=i(this,m)[v];if(e!==w){if(i(this,le)&&d(this,h,T).call(this,w)){w.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:f}=w;f!==void 0&&!a&&(i(this,ee)&&((D=i(this,K))==null||D.call(this,f,t,"set")),i(this,G)&&i(this,P)?.push([f,t,"set"]));}else a||(i(this,ee)&&((z=i(this,K))==null||z.call(this,w,t,"set")),i(this,G)&&i(this,P)?.push([w,t,"set"]));if(i(this,de).call(this,v),i(this,be).call(this,v,b,u),i(this,m)[v]=e,u){u.set="replace";let f=w&&d(this,h,T).call(this,w)?w.__staleWhileFetching:w;f!==void 0&&(u.oldValue=f);}}else u&&(u.set="update");i(this,ve)&&this.onInsert?.(e,t,e===w?"update":"replace");}if(s!==0&&!i(this,W)&&d(this,h,Ue).call(this),i(this,W)&&(y||i(this,Fe).call(this,v,s,r),u&&i(this,ie).call(this,u,v)),!a&&i(this,G)&&i(this,P)){let w=i(this,P),f;for(;f=w?.shift();)(S=i(this,$))==null||S.call(this,...f);}return this}pop(){var t;try{for(;i(this,C);){let e=i(this,m)[i(this,I)];if(d(this,h,Me).call(this,!0),d(this,h,T).call(this,e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(i(this,G)&&i(this,P)){let e=i(this,P),n;for(;n=e?.shift();)(t=i(this,$))==null||t.call(this,...n);}}}has(t,e={}){let{updateAgeOnHas:n=this.updateAgeOnHas,status:s}=e,r=i(this,O).get(t);if(r!==void 0){let a=i(this,m)[r];if(d(this,h,T).call(this,a)&&a.__staleWhileFetching===void 0)return false;if(i(this,Y).call(this,r))s&&(s.has="stale",i(this,ie).call(this,s,r));else return n&&i(this,ue).call(this,r),s&&(s.has="hit",i(this,ie).call(this,s,r)),true}else s&&(s.has="miss");return false}peek(t,e={}){let{allowStale:n=this.allowStale}=e,s=i(this,O).get(t);if(s===void 0||!n&&i(this,Y).call(this,s))return;let r=i(this,m)[s];return d(this,h,T).call(this,r)?r.__staleWhileFetching:r}async fetch(t,e={}){let{allowStale:n=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:r=this.noDeleteOnStaleGet,ttl:a=this.ttl,noDisposeOnSet:l=this.noDisposeOnSet,size:u=0,sizeCalculation:y=this.sizeCalculation,noUpdateTTL:b=this.noUpdateTTL,noDeleteOnFetchRejection:v=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:M=this.allowStaleOnFetchRejection,ignoreFetchAbort:D=this.ignoreFetchAbort,allowStaleOnFetchAbort:z=this.allowStaleOnFetchAbort,context:S,forceRefresh:w=false,status:f,signal:k}=e;if(!i(this,le))return f&&(f.fetch="get"),this.get(t,{allowStale:n,updateAgeOnGet:s,noDeleteOnStaleGet:r,status:f});let L={allowStale:n,updateAgeOnGet:s,noDeleteOnStaleGet:r,ttl:a,noDisposeOnSet:l,size:u,sizeCalculation:y,noUpdateTTL:b,noDeleteOnFetchRejection:v,allowStaleOnFetchRejection:M,allowStaleOnFetchAbort:z,ignoreFetchAbort:D,status:f,signal:k},R=i(this,O).get(t);if(R===void 0){f&&(f.fetch="miss");let F=d(this,h,ke).call(this,t,R,L,S);return F.__returned=F}else {let F=i(this,m)[R];if(d(this,h,T).call(this,F)){let me=n&&F.__staleWhileFetching!==void 0;return f&&(f.fetch="inflight",me&&(f.returnedStale=true)),me?F.__staleWhileFetching:F.__returned=F}let Ae=i(this,Y).call(this,R);if(!w&&!Ae)return f&&(f.fetch="hit"),d(this,h,Se).call(this,R),s&&i(this,ue).call(this,R),f&&i(this,ie).call(this,f,R),F;let ce=d(this,h,ke).call(this,t,R,L,S),pe=ce.__staleWhileFetching!==void 0&&n;return f&&(f.fetch=Ae?"stale":"refresh",pe&&Ae&&(f.returnedStale=true)),pe?ce.__staleWhileFetching:ce.__returned=ce}}async forceFetch(t,e={}){let n=await this.fetch(t,e);if(n===void 0)throw new Error("fetch() returned undefined");return n}memo(t,e={}){let n=i(this,ge);if(!n)throw new Error("no memoMethod provided to constructor");let{context:s,forceRefresh:r,...a}=e,l=this.get(t,a);if(!r&&l!==void 0)return l;let u=n(t,l,{options:a,context:s});return this.set(t,u,a),u}get(t,e={}){let{allowStale:n=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:r=this.noDeleteOnStaleGet,status:a}=e,l=i(this,O).get(t);if(l!==void 0){let u=i(this,m)[l],y=d(this,h,T).call(this,u);return a&&i(this,ie).call(this,a,l),i(this,Y).call(this,l)?(a&&(a.get="stale"),y?(a&&n&&u.__staleWhileFetching!==void 0&&(a.returnedStale=true),n?u.__staleWhileFetching:void 0):(r||d(this,h,oe).call(this,t,"expire"),a&&n&&(a.returnedStale=true),n?u:void 0)):(a&&(a.get="hit"),y?u.__staleWhileFetching:(d(this,h,Se).call(this,l),s&&i(this,ue).call(this,l),u))}else a&&(a.get="miss");}delete(t){return d(this,h,oe).call(this,t,"delete")}clear(){return d(this,h,Ye).call(this,"delete")}},j=new WeakMap,q=new WeakMap,K=new WeakMap,he=new WeakMap,$=new WeakMap,ye=new WeakMap,ge=new WeakMap,H=new WeakMap,C=new WeakMap,X=new WeakMap,O=new WeakMap,A=new WeakMap,m=new WeakMap,N=new WeakMap,U=new WeakMap,I=new WeakMap,E=new WeakMap,Q=new WeakMap,P=new WeakMap,Z=new WeakMap,J=new WeakMap,W=new WeakMap,V=new WeakMap,ee=new WeakMap,le=new WeakMap,G=new WeakMap,ve=new WeakMap,h=new WeakSet,Ue=function(){let t=new Ie(i(this,j)),e=new Ie(i(this,j));c(this,W,t),c(this,J,e);let n=this.ttlAutopurge?new Array(i(this,j)):void 0;c(this,V,n),c(this,Fe,(l,u,y=i(this,H).now())=>{e[l]=u!==0?y:0,t[l]=u,s(l,u);}),c(this,ue,l=>{e[l]=t[l]!==0?i(this,H).now():0,s(l,t[l]);});let s=this.ttlAutopurge?(l,u)=>{if(n?.[l]&&(clearTimeout(n[l]),n[l]=void 0),u&&u!==0&&n){let y=setTimeout(()=>{i(this,Y).call(this,l)&&d(this,h,oe).call(this,i(this,A)[l],"expire");},u+1);y.unref&&y.unref(),n[l]=y;}}:()=>{};c(this,ie,(l,u)=>{if(t[u]){let y=t[u],b=e[u];if(!y||!b)return;l.ttl=y,l.start=b,l.now=r||a();let v=l.now-b;l.remainingTTL=y-v;}});let r=0,a=()=>{let l=i(this,H).now();if(this.ttlResolution>0){r=l;let u=setTimeout(()=>r=0,this.ttlResolution);u.unref&&u.unref();}return l};this.getRemainingTTL=l=>{let u=i(this,O).get(l);if(u===void 0)return 0;let y=t[u],b=e[u];if(!y||!b)return 1/0;let v=(r||a())-b;return y-v},c(this,Y,l=>{let u=e[l],y=t[l];return !!y&&!!u&&(r||a())-u>y});},ue=new WeakMap,ie=new WeakMap,Fe=new WeakMap,Y=new WeakMap,Pt=function(){let t=new Ie(i(this,j));c(this,X,0),c(this,Z,t),c(this,de,e=>{c(this,X,i(this,X)-t[e]),t[e]=0;}),c(this,Oe,(e,n,s,r)=>{if(d(this,h,T).call(this,n))return 0;if(!se(s))if(r){if(typeof r!="function")throw new TypeError("sizeCalculation must be a function");if(s=r(n,e),!se(s))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 s}),c(this,be,(e,n,s)=>{if(t[e]=n,i(this,q)){let r=i(this,q)-t[e];for(;i(this,X)>r;)d(this,h,Me).call(this,true);}c(this,X,i(this,X)+t[e]),s&&(s.entrySize=n,s.totalCalculatedSize=i(this,X));});},de=new WeakMap,be=new WeakMap,Oe=new WeakMap,ae=function*({allowStale:t=this.allowStale}={}){if(i(this,C))for(let e=i(this,E);!(!d(this,h,We).call(this,e)||((t||!i(this,Y).call(this,e))&&(yield e),e===i(this,I)));)e=i(this,U)[e];},re=function*({allowStale:t=this.allowStale}={}){if(i(this,C))for(let e=i(this,I);!(!d(this,h,We).call(this,e)||((t||!i(this,Y).call(this,e))&&(yield e),e===i(this,E)));)e=i(this,N)[e];},We=function(t){return t!==void 0&&i(this,O).get(i(this,A)[t])===t},Me=function(t){var r;let e=i(this,I),n=i(this,A)[e],s=i(this,m)[e];return i(this,le)&&d(this,h,T).call(this,s)?s.__abortController.abort(new Error("evicted")):(i(this,ee)||i(this,G))&&(i(this,ee)&&((r=i(this,K))==null||r.call(this,s,n,"evict")),i(this,G)&&i(this,P)?.push([s,n,"evict"])),i(this,de).call(this,e),i(this,V)?.[e]&&(clearTimeout(i(this,V)[e]),i(this,V)[e]=void 0),t&&(i(this,A)[e]=void 0,i(this,m)[e]=void 0,i(this,Q).push(e)),i(this,C)===1?(c(this,I,c(this,E,0)),i(this,Q).length=0):c(this,I,i(this,N)[e]),i(this,O).delete(n),De(this,C)._--,e},ke=function(t,e,n,s){let r=e===void 0?void 0:i(this,m)[e];if(d(this,h,T).call(this,r))return r;let a=new Re,{signal:l}=n;l?.addEventListener("abort",()=>a.abort(l.reason),{signal:a.signal});let u={signal:a.signal,options:n,context:s},y=(S,w=false)=>{let{aborted:f}=a.signal,k=n.ignoreFetchAbort&&S!==void 0,L=n.ignoreFetchAbort||!!(n.allowStaleOnFetchAbort&&S!==void 0);if(n.status&&(f&&!w?(n.status.fetchAborted=true,n.status.fetchError=a.signal.reason,k&&(n.status.fetchAbortIgnored=true)):n.status.fetchResolved=true),f&&!k&&!w)return v(a.signal.reason,L);let R=D,F=i(this,m)[e];return (F===D||k&&w&&F===void 0)&&(S===void 0?R.__staleWhileFetching!==void 0?i(this,m)[e]=R.__staleWhileFetching:d(this,h,oe).call(this,t,"fetch"):(n.status&&(n.status.fetchUpdated=true),this.set(t,S,u.options))),S},b=S=>(n.status&&(n.status.fetchRejected=true,n.status.fetchError=S),v(S,false)),v=(S,w)=>{let{aborted:f}=a.signal,k=f&&n.allowStaleOnFetchAbort,L=k||n.allowStaleOnFetchRejection,R=L||n.noDeleteOnFetchRejection,F=D;if(i(this,m)[e]===D&&(!R||!w&&F.__staleWhileFetching===void 0?d(this,h,oe).call(this,t,"fetch"):k||(i(this,m)[e]=F.__staleWhileFetching)),L)return n.status&&F.__staleWhileFetching!==void 0&&(n.status.returnedStale=true),F.__staleWhileFetching;if(F.__returned===F)throw S},M=(S,w)=>{var k;let f=(k=i(this,ye))==null?void 0:k.call(this,t,r,u);f&&f instanceof Promise&&f.then(L=>S(L===void 0?void 0:L),w),a.signal.addEventListener("abort",()=>{(!n.ignoreFetchAbort||n.allowStaleOnFetchAbort)&&(S(void 0),n.allowStaleOnFetchAbort&&(S=L=>y(L,true)));});};n.status&&(n.status.fetchDispatched=true);let D=new Promise(M).then(y,b),z=Object.assign(D,{__abortController:a,__staleWhileFetching:r,__returned:void 0});return e===void 0?(this.set(t,z,{...u.options,status:void 0}),e=i(this,O).get(t)):i(this,m)[e]=z,z},T=function(t){if(!i(this,le))return false;let e=t;return !!e&&e instanceof Promise&&e.hasOwnProperty("__staleWhileFetching")&&e.__abortController instanceof Re},Ve=function(t,e){i(this,U)[e]=t,i(this,N)[t]=e;},Se=function(t){t!==i(this,E)&&(t===i(this,I)?c(this,I,i(this,N)[t]):d(this,h,Ve).call(this,i(this,U)[t],i(this,N)[t]),d(this,h,Ve).call(this,i(this,E),t),c(this,E,t));},oe=function(t,e){var s,r;let n=false;if(i(this,C)!==0){let a=i(this,O).get(t);if(a!==void 0)if(i(this,V)?.[a]&&(clearTimeout(i(this,V)?.[a]),i(this,V)[a]=void 0),n=true,i(this,C)===1)d(this,h,Ye).call(this,e);else {i(this,de).call(this,a);let l=i(this,m)[a];if(d(this,h,T).call(this,l)?l.__abortController.abort(new Error("deleted")):(i(this,ee)||i(this,G))&&(i(this,ee)&&((s=i(this,K))==null||s.call(this,l,t,e)),i(this,G)&&i(this,P)?.push([l,t,e])),i(this,O).delete(t),i(this,A)[a]=void 0,i(this,m)[a]=void 0,a===i(this,E))c(this,E,i(this,U)[a]);else if(a===i(this,I))c(this,I,i(this,N)[a]);else {let u=i(this,U)[a];i(this,N)[u]=i(this,N)[a];let y=i(this,N)[a];i(this,U)[y]=i(this,U)[a];}De(this,C)._--,i(this,Q).push(a);}}if(i(this,G)&&i(this,P)?.length){let a=i(this,P),l;for(;l=a?.shift();)(r=i(this,$))==null||r.call(this,...l);}return n},Ye=function(t){var e,n;for(let s of d(this,h,re).call(this,{allowStale:true})){let r=i(this,m)[s];if(d(this,h,T).call(this,r))r.__abortController.abort(new Error("deleted"));else {let a=i(this,A)[s];i(this,ee)&&((e=i(this,K))==null||e.call(this,r,a,t)),i(this,G)&&i(this,P)?.push([r,a,t]);}}if(i(this,O).clear(),i(this,m).fill(void 0),i(this,A).fill(void 0),i(this,W)&&i(this,J)){i(this,W).fill(0),i(this,J).fill(0);for(let s of i(this,V)??[])s!==void 0&&clearTimeout(s);i(this,V)?.fill(void 0);}if(i(this,Z)&&i(this,Z).fill(0),c(this,I,0),c(this,E,0),i(this,Q).length=0,c(this,X,0),c(this,C,0),i(this,G)&&i(this,P)){let s=i(this,P),r;for(;r=s?.shift();)(n=i(this,$))==null||n.call(this,...r);}},we);var _e=class{cache;map=new Map;constructor(t){this.cache=new Et({max:t.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(t){let e=this.map.delete(t);return e&&this.cache.delete(t),e}get forEach(){return this.map.forEach}get(t){let e=this.cache.get(t);return e||this.map.get(t)}has(t){return this.map.has(t)}set(t,e){return this.map.set(t,e),this.cache.set(t,e),this}get size(){return this.map.size}entries(){return this.map.entries()}keys(){return this.map.keys()}values(){return this.map.values()}};var xt;(r=>(r.mediaInstances=new Map,r.channels=new Map,r.transients=new Set,r.systemPausedAliases=new Set,r.bufferRegistry=new _e({cacheSize:10})))(xt||={});var p=xt;var _;(s=>(s.log=(r,...a)=>console.log(`[Pixi\u2019VN] ${r}`,...a),s.warn=(r,...a)=>console.warn(`[Pixi\u2019VN] ${r}`,...a),s.error=(r,...a)=>console.error(`[Pixi\u2019VN] ${r}`,...a),s.info=(r,...a)=>console.info(`[Pixi\u2019VN] ${r}`,...a)))(_||={});function Ne(o){return o.reduce((t,e)=>{switch(e.filterType){case "ReverbFilter":t.push(new B.Reverb({decay:e.decay,preDelay:e.preDelay,wet:e.wet}).toDestination());break;case "FeedbackDelayFilter":t.push(new B.FeedbackDelay({feedback:e.feedback,delayTime:e.delayTime,wet:e.wet}).toDestination());break;case "BitCrusherFilter":t.push(new B.BitCrusher({bits:e.bits}).toDestination());break;case "CompressorFilter":t.push(new B.Compressor({attack:e.attack,knee:e.knee,ratio:e.ratio,release:e.release,threshold:e.threshold}).toDestination());break;case "DelayFilter":t.push(new B.Delay({delayTime:e.delayTime,maxDelay:e.maxDelay}).toDestination());break;case "DistortionFilter":t.push(new B.Distortion({distortion:e.distortion,oversample:e.oversample,wet:e.wet}).toDestination());break;case "FeedbackCombFilterFilter":t.push(new B.FeedbackCombFilter({delayTime:e.delayTime,resonance:e.resonance}).toDestination());break;case "FreeverbFilter":t.push(new B.Freeverb({roomSize:e.roomSize,dampening:e.dampening,wet:e.wet}).toDestination());break;case "GateFilter":t.push(new B.Gate({threshold:e.threshold,smoothing:e.smoothing}).toDestination());break;case "GreaterThanFilter":t.push(new B.GreaterThan({value:e.value,convert:e.convert,maxValue:e.maxValue,minValue:e.minValue,units:e.units}).toDestination());break;case "GreaterThanZeroFilter":t.push(new B.GreaterThanZero);break;case "LimiterFilter":t.push(new B.Limiter({threshold:e.threshold}).toDestination());break;case "MidSideCompressorFilter":t.push(new B.MidSideCompressor({mid:e.mid,side:e.side}).toDestination());break;case "MultibandCompressorFilter":t.push(new B.MultibandCompressor({lowFrequency:e.lowFrequency,highFrequency:e.highFrequency,low:e.low,mid:e.mid,high:e.high}).toDestination());break;case "Panner3DFilter":t.push(new B.Panner3D({positionX:e.positionX,positionY:e.positionY,positionZ:e.positionZ,orientationX:e.orientationX,orientationY:e.orientationY,orientationZ:e.orientationZ,coneInnerAngle:e.coneInnerAngle,coneOuterAngle:e.coneOuterAngle,coneOuterGain:e.coneOuterGain,distanceModel:e.distanceModel,maxDistance:e.maxDistance,refDistance:e.refDistance,rolloffFactor:e.rolloffFactor,panningModel:e.panningModel}).toDestination());break;case "PhaserFilter":t.push(new B.Phaser({frequency:e.frequency,octaves:e.octaves,baseFrequency:e.baseFrequency,wet:e.wet,Q:e.Q,stages:e.stages}).toDestination());break;case "StereoWidenerFilter":t.push(new B.StereoWidener({width:e.width,wet:e.wet}).toDestination());break;case "PingPongDelayFilter":t.push(new B.PingPongDelay({wet:e.wet,delayTime:e.delayTime,feedback:e.feedback,maxDelay:e.maxDelay}).toDestination());break;case "AutoFilterFilter":t.push(new B.AutoFilter({frequency:e.frequency,depth:e.depth,baseFrequency:e.baseFrequency,octaves:e.octaves,filter:e.filter,wet:e.wet,type:e.type}).toDestination());break;case "BiquadFilterFilter":t.push(new B.BiquadFilter({frequency:e.frequency,detune:e.detune,Q:e.Q,type:e.type,gain:e.gain}).toDestination());break;case "OnePoleFilterFilter":t.push(new B.OnePoleFilter({type:e.type}).toDestination());break;case "CustomFilter":t.push(new B.Filter({frequency:e.frequency,Q:e.Q,type:e.type,detune:e.detune,gain:e.gain,rolloff:e.rolloff}).toDestination());break;case "ChorusFilter":t.push(new B.Chorus({frequency:e.frequency,delayTime:e.delayTime,depth:e.depth,type:e.type,spread:e.spread,feedback:e.feedback,wet:e.wet}).toDestination());break;case "TremoloFilter":t.push(new B.Tremolo({frequency:e.frequency,type:e.type,depth:e.depth,spread:e.spread,wet:e.wet}).toDestination());break;case "VibratoFilter":t.push(new B.Vibrato({maxDelay:e.maxDelay,frequency:e.frequency,depth:e.depth,type:e.type,wet:e.wet}).toDestination());break;case "AutoPannerFilter":t.push(new B.AutoPanner({frequency:e.frequency,type:e.type,depth:e.depth,channelCount:e.channelCount,wet:e.wet}).toDestination());break}return t},[])}function It(o){if(o)return Array.from(o).reduce((t,e)=>(e instanceof B.Reverb?t.push({filterType:"ReverbFilter",wet:e.wet.value,decay:B.Time(e.decay).toSeconds(),preDelay:B.Time(e.preDelay).toSeconds()}):e instanceof B.PingPongDelay?t.push({filterType:"PingPongDelayFilter",wet:e.wet.value,delayTime:e.delayTime.value,feedback:e.feedback.value}):e instanceof B.FeedbackDelay?t.push({filterType:"FeedbackDelayFilter",feedback:e.feedback.value,delayTime:e.delayTime.value,wet:e.wet.value}):e instanceof B.BitCrusher?t.push({filterType:"BitCrusherFilter",bits:e.bits.value,wet:e.wet.value}):e instanceof B.Compressor?t.push({filterType:"CompressorFilter",attack:e.attack.value,knee:e.knee.value,ratio:e.ratio.value,release:e.release.value,threshold:e.threshold.value}):e instanceof B.Delay?t.push({filterType:"DelayFilter",delayTime:e.delayTime.value,maxDelay:e.maxDelay}):e instanceof B.Distortion?t.push({filterType:"DistortionFilter",distortion:e.distortion,oversample:e.oversample,wet:e.wet.value}):e instanceof B.FeedbackCombFilter?t.push({filterType:"FeedbackCombFilterFilter",delayTime:e.delayTime.value,resonance:e.resonance.value}):e instanceof B.Freeverb?t.push({filterType:"FreeverbFilter",roomSize:e.roomSize.value,dampening:e.dampening,wet:e.wet.value}):e instanceof B.Gate?t.push({filterType:"GateFilter",threshold:e.threshold,smoothing:e.smoothing}):e instanceof B.GreaterThan?t.push({filterType:"GreaterThanFilter",value:e.comparator.value,convert:e.convert,maxValue:e.maxValue,minValue:e.minValue}):e instanceof B.GreaterThanZero?t.push({filterType:"GreaterThanZeroFilter"}):e instanceof B.Limiter?t.push({filterType:"LimiterFilter",threshold:e.threshold.value}):e instanceof B.MidSideCompressor?t.push({filterType:"MidSideCompressorFilter",mid:{attack:e.mid.attack.value,knee:e.mid.knee.value,ratio:e.mid.ratio.value,release:e.mid.release.value,threshold:e.mid.threshold.value},side:{attack:e.side.attack.value,knee:e.side.knee.value,ratio:e.side.ratio.value,release:e.side.release.value,threshold:e.side.threshold.value}}):e instanceof B.MultibandCompressor?t.push({filterType:"MultibandCompressorFilter",lowFrequency:e.lowFrequency.value,highFrequency:e.highFrequency.value,low:{attack:e.low.attack.value,knee:e.low.knee.value,ratio:e.low.ratio.value,release:e.low.release.value,threshold:e.low.threshold.value},mid:{attack:e.mid.attack.value,knee:e.mid.knee.value,ratio:e.mid.ratio.value,release:e.mid.release.value,threshold:e.mid.threshold.value},high:{attack:e.high.attack.value,knee:e.high.knee.value,ratio:e.high.ratio.value,release:e.high.release.value,threshold:e.high.threshold.value}}):e instanceof B.Panner3D?t.push({filterType:"Panner3DFilter",positionX:e.positionX.value,positionY:e.positionY.value,positionZ:e.positionZ.value,orientationX:e.orientationX.value,orientationY:e.orientationY.value,orientationZ:e.orientationZ.value,coneInnerAngle:e.coneInnerAngle,coneOuterAngle:e.coneOuterAngle,coneOuterGain:e.coneOuterGain,distanceModel:e.distanceModel,maxDistance:e.maxDistance,refDistance:e.refDistance,rolloffFactor:e.rolloffFactor,panningModel:e.panningModel}):e instanceof B.Phaser?t.push({filterType:"PhaserFilter",frequency:e.frequency.value,octaves:e.octaves,baseFrequency:e.baseFrequency,wet:e.wet.value,Q:e.Q.value}):e instanceof B.StereoWidener?t.push({filterType:"StereoWidenerFilter",width:e.width.value,wet:e.wet.value}):e instanceof B.AutoFilter?t.push({filterType:"AutoFilterFilter",type:e.type,frequency:e.frequency.value,depth:e.depth.value,baseFrequency:e.baseFrequency,octaves:e.octaves,filter:{Q:e.filter.Q.value,type:e.filter.type,rolloff:e.filter.rolloff},wet:e.wet.value}):e instanceof B.Chorus?t.push({filterType:"ChorusFilter",type:e.type,frequency:e.frequency.value,delayTime:e.delayTime,depth:e.depth,spread:e.spread,feedback:e.feedback.value,wet:e.wet.value}):e instanceof B.Tremolo?t.push({filterType:"TremoloFilter",type:e.type,frequency:e.frequency.value,depth:e.depth.value,spread:e.spread,wet:e.wet.value}):e instanceof B.Vibrato?t.push({filterType:"VibratoFilter",type:e.type,frequency:e.frequency.value,depth:e.depth.value,wet:e.wet.value}):e instanceof B.AutoPanner?t.push({filterType:"AutoPannerFilter",type:e.type,frequency:e.frequency.value,depth:e.depth.value,channelCount:e.channelCount,wet:e.wet.value}):e instanceof B.BiquadFilter?t.push({filterType:"BiquadFilterFilter",type:e.type,frequency:e.frequency.value,detune:e.detune.value,Q:e.Q.value,gain:e.gain.value}):e instanceof B.OnePoleFilter?t.push({filterType:"OnePoleFilterFilter",type:e.type}):e instanceof B.Filter?t.push({filterType:"CustomFilter",type:e.type,frequency:e.frequency.value,Q:e.Q.value,detune:e.detune.value,gain:e.gain.value,rolloff:e.rolloff}):_.warn(`Unsupported filter type for serialisation: ${e?.constructor?.name??e}, please report this to the developers if you encounter it.`),t),[])}function gt(o){return o instanceof B.Reverb||o instanceof B.FeedbackDelay||o instanceof B.PingPongDelay||o instanceof B.BitCrusher||o instanceof B.Compressor||o instanceof B.Delay||o instanceof B.Distortion||o instanceof B.FeedbackCombFilter||o instanceof B.Freeverb||o instanceof B.Gate||o instanceof B.GreaterThan||o instanceof B.GreaterThanZero||o instanceof B.Limiter||o instanceof B.MidSideCompressor||o instanceof B.MultibandCompressor||o instanceof B.Panner3D||o instanceof B.Phaser||o instanceof B.StereoWidener||o instanceof B.AutoFilter||o instanceof B.Chorus||o instanceof B.Vibrato||o instanceof B.Tremolo||o instanceof B.AutoPanner||o instanceof B.BiquadFilter||o instanceof B.OnePoleFilter||o instanceof B.Filter}function ne(o){return o<=0?-1/0:20*Math.log10(o)}function Te(o){return o<=-1/0?0:10**(o/20)}async function Ge(o){if(p.bufferRegistry.has(o))return;let t=o;try{let e=kt__default.default.Assets.resolver.resolve(o);e?.src&&(t=e.src);}catch{}try{let e=await B.ToneAudioBuffer.load(t),n=new B.ToneAudioBuffer(e);p.bufferRegistry.set(o,n);}catch(e){_.warn(`Failed to load audio buffer for "${o}" (url: "${t}"): ${e instanceof Error?e.message:e}`),p.bufferRegistry.set(o,new B.ToneAudioBuffer);}}var Ee=class extends B.Player{constructor(e,n,s,r,a={},l){super(a);this.alias=e;this.channelAlias=n;this.soundAlias=s;this.stepCounter=r;this.delay=l;this.options=a,this.playStartTime=B.now()+(l??0);}alias;channelAlias;soundAlias;stepCounter;delay;options;filters=new Set;pausedAt=void 0;playStartTime=B.now();get memory(){let e=Math.max(0,this.pausedAt?this.pausedAt-this.playStartTime:B.now()-this.playStartTime),n=this.paused;return n&&p.systemPausedAliases.has(this.alias)&&(n=false),{...this.options,fadeIn:this.fadeIn,loop:this.loop,loopEnd:this.loopEnd,loopStart:this.loopStart,mute:this.mute,playbackRate:this.playbackRate,reverse:this.reverse,volume:Te(this.volume.value),autostart:!this.paused,elapsed:e,paused:n,delay:this.delay}}set memory(e){this.paused=e.paused,this.loop!==(e.loop||false)&&(this.loop=e.loop||false),this.volume.value!==ne(e.volume??1)&&(this.volume.value=ne(e.volume??1)),this.mute!==(e.mute||false)&&(this.mute=e.mute||false),this.playbackRate!==(e.playbackRate??1)&&(this.playbackRate=e.playbackRate??1),this.reverse!==(e.reverse||false)&&(this.reverse=e.reverse||false),this.fadeIn!==(e.fadeIn||0)&&(this.fadeIn=e.fadeIn||0),this.loopStart!==(e.loopStart||0)&&(this.loopStart=e.loopStart||0),this.loopEnd!==(e.loopEnd||0)&&(this.loopEnd=e.loopEnd||0);}get paused(){return typeof this.pausedAt=="number"}set paused(e){let n=this.state;if(e)this.pausedAt=B.now(),n==="started"&&super.stop();else {let s;typeof this.pausedAt=="number"&&(s=this.pausedAt-this.playStartTime,this.pausedAt=void 0),n==="stopped"&&(this.delay?this.start(`+${this.delay}`,s):this.start(void 0,s));}}get muted(){return this.mute}set muted(e){this.mute=e;}get speed(){return this.playbackRate}set speed(e){this.playbackRate=e;}stop(e){return p.mediaInstances.delete(this.alias),super.stop(e)}start(e,n,s){let r=B.now(),a=r;if(typeof e=="number")a=e;else if(typeof e=="string"&&e.startsWith("+")){let u=Number(e.slice(1));Number.isNaN(u)||(a=r+u);}let l=typeof n=="number"?n:0;return this.playStartTime=a-l,super.start(e,n,s)}chain(...e){return e.forEach(n=>{gt(n)&&(n.toDestination(),this.filters.add(n));}),super.chain(...e)}disconnect(e){return gt(e)&&(e.disconnect(),this.filters.delete(e)),super.disconnect(e)}};var Pe=class{constructor(t,e={}){this.alias=t;this.background=e.background??false,this.toneChannel=new B.Channel({volume:ne(e.volume??1),mute:e.muted??false,pan:e.pan??0}).toDestination(),e.filters&&this.toneChannel.chain(...e.filters);}alias;toneChannel;get volume(){return Te(this.toneChannel.volume.value)}set volume(t){this.toneChannel.volume.value=ne(t);}get volumeParam(){return this.toneChannel.volume}get pan(){return this.toneChannel.pan.value}set pan(t){this.toneChannel.pan.value=t;}get panParam(){return this.toneChannel.pan}get muted(){return this.toneChannel.mute}set muted(t){this.toneChannel.mute=t;}pauseAll(){for(let t of p.mediaInstances.values())t.channelAlias===this.alias&&!t.paused&&(t.paused=true);return this}resumeAll(){for(let t of p.mediaInstances.values())t.channelAlias===this.alias&&t.paused&&(t.paused=false);return this}chain(...t){return this.toneChannel.chain(...t),this}background;_createPlayer(t,e,n={}){let s=p.bufferRegistry.get(e);if(!s)throw new core.PixiError("unregistered_asset",`Sound buffer for alias "${e}" is not loaded. Call sound.load() first.`);let{delay:r,elapsed:a,filters:l=[],muted:u,autostart:y=true,speed:b,volume:v,...M}=n;u!==void 0&&(_.warn(`MediaInstance "${t}" is being created with muted=${u}. This will override the channel's muted state (${this.muted}).`),M.mute=u),b!==void 0&&(_.warn(`MediaInstance "${t}" is being created with speed=${b}. This will override the default playback speed of 1.`),M.playbackRate=b);let D=new Ee(t,this.alias,e,core.GameUnifier.stepCounter,{...M,volume:v!==void 0?ne(v):void 0,url:s},r).chain(...l,this.toneChannel),z=a!==void 0?Math.max(0,a):void 0;return y&&(r?D.start(`+${r}`,z):D.start(void 0,z)),D}async play(t,e,n){let s,r;if(typeof e=="string"?(s=t,r=e):(s=t,r=t,n=e),p.mediaInstances.has(s)){let l=p.mediaInstances.get(s);l&&(l.stop(),n={...l.memory,...n,filters:[...l.filters,...n?.filters||[]]});}await Ge(r);let a=this._createPlayer(s,r,n);return p.mediaInstances.set(s,a),a}toggleMuteAll(){return this.muted=!this.muted,this.muted}get mediaInstances(){return Array.from(p.mediaInstances.values()).reduce((t,e)=>(e.channelAlias===this.alias&&t.push(e),t),[])}stopAll(){let t=[];for(let[e,n]of p.mediaInstances.entries())n.channelAlias===this.alias&&(n.stop(),t.push(e));return t.forEach(e=>{p.mediaInstances.delete(e);}),this}};function Mt(o){try{if(typeof o>"u")return o;let t=JSON.stringify(o);return JSON.parse(t)}catch(t){throw _.error("Error creating exportable element",o,t),new core.PixiError("not_json_serializable","Error creating exportable element")}}var xe=class{get volumeAll(){return Te(B__namespace.getDestination().volume.value)}set volumeAll(t){B__namespace.getDestination().volume.value=ne(t);}get speedAll(){return this._speedAll}set speedAll(t){this._speedAll=t;for(let e of p.mediaInstances.values())e.speed=t;}_speedAll=1;_defaultChannelAlias=Tt;get defaultChannelAlias(){return this._defaultChannelAlias}set defaultChannelAlias(t){this._defaultChannelAlias=t;}add(t,e){if(!p.bufferRegistry.has(t)){let n=new B__namespace.ToneAudioBuffer(e);p.bufferRegistry.set(t,n);}}pauseAll(){for(let t of p.mediaInstances.values())t.paused||(t.paused=true);return this}resumeAll(){for(let t of p.mediaInstances.values())t.paused&&(t.paused=false);return this}get muted(){return B__namespace.getDestination().mute}toggleMuteAll(){let t=!B__namespace.getDestination().mute;return B__namespace.getDestination().mute=t,t}muteAll(){return B__namespace.getDestination().mute=true,this}unmuteAll(){return B__namespace.getDestination().mute=false,this}stopAll(){for(let t of p.mediaInstances.values())t.stop();return p.mediaInstances.clear(),this}pauseUnsavedAll(t){for(let[e,n]of p.mediaInstances.entries())t&&n.channelAlias!==t||n.paused||(n.paused=true,p.systemPausedAliases.add(e));if(!t){for(let e of p.transients)e.stop();p.transients.clear();}return this}resumeUnsavedAll(t){let e=[];for(let n of p.systemPausedAliases){let s=p.mediaInstances.get(n);if(!s){e.push(n);continue}t&&s.channelAlias!==t||(s.paused=false,e.push(n));}for(let n of e)p.systemPausedAliases.delete(n);return this}stopTransientAll(){for(let t of p.transients)t.stop();return p.transients.clear(),this}async play(t,e,n){let s,r;typeof e=="string"?(s=t,r=e):(s=t,r=t,n=e),p.bufferRegistry.has(r)||await this.load(r);let{channel:a=this.defaultChannelAlias,...l}=n??{};return await this.findChannel(a).play(s,r,l)}async playTransient(t,e){p.bufferRegistry.has(t)||await this.load(t);let n=p.bufferRegistry.get(t);if(!n)throw new core.PixiError("unregistered_asset",`Sound buffer for alias "${t}" is not loaded. Call sound.load() first.`);let{autostart:s=true,...r}=e??{},a=new B__namespace.Player({...r,url:n}).toDestination();return s&&a.start(),p.transients.add(a),a.onstop=()=>{a.dispose(),p.transients.delete(a);},a}find(t){return p.mediaInstances.get(t)}stop(t){let e=this.find(t);e?(e.stop(),p.mediaInstances.delete(t)):_.warn(`No media instance found with alias ${t} to stop.`);}pause(t){let e=this.find(t);if(!e){_.warn(`No media instance found with alias ${t} to pause.`);return}return e.paused=true,e}resume(t){let e=this.find(t);if(!e){_.warn(`No media instance found with alias ${t} to resume.`);return}return e.paused=false,e}duration(t){return p.bufferRegistry.get(t)?.duration??0}async load(...t){let e=t.map(Ge);await Promise.all(e);}backgroundLoad(...t){return this.load(...t).catch(e=>{_.error("Error background-loading sound",e);})}backgroundLoadBundle(t){let e=kt__default.default.Assets.backgroundLoadBundle(t);return e.then(async()=>{try{let n=await kt__default.default.Assets.loadBundle(t),s=[];for(let r in n)p.bufferRegistry.has(r)||s.push(this.load(r));await Promise.all(s);}catch(n){_.error("Error loading sound bundle",n);}}).catch(n=>{_.error("Error background-loading sound bundle",n);}),e}clear(){this.stopAll();}addChannel(t,e={}){if(typeof t!="string"){t.forEach(s=>{let r={...e,filters:e.filters?[...e.filters]:e.filters};this.addChannel(s,r);});return}if(p.channels.has(t)){_.warn(`Channel with alias ${t} already exists.`);return}let n=new Pe(t,e);return p.channels.set(t,n),n}findChannel(t){let e=p.channels.get(t);return e||this.addChannel(t)}get channels(){return Array.from(p.channels.values())}export(){let t=Array.from(p.mediaInstances.entries()).reduce((e,[n,s])=>(e[n]={channelAlias:s.channelAlias,soundAlias:s.soundAlias,stepCounter:s.stepCounter,paused:s.paused,options:{...s.memory,filters:It(s.filters)}},e),{});return {mediaInstances:Mt(t)}}async restore(t){try{if(Object.hasOwn(t,"soundsPlaying")){let e=t.soundsPlaying;if(e){let n=Object.keys(e).map(async s=>{await this.load(s),await this.play(s);});await Promise.all(n);}}if(Object.hasOwn(t,"mediaInstances")){let e=t.mediaInstances;if(e){let n=new Set,s=Object.values(e).map(async({soundAlias:a,channelAlias:l})=>(n.add(l),await this.load(a)));await Promise.all(s),this.channels.forEach(a=>{(!a.background||!n.has(a.alias))&&a.stopAll();});let r=Object.keys(e).map(async a=>{let l=e[a],u=this.findChannel(l.channelAlias),y=l.options.paused??l.paused??!1;if(u.background)if(l.stepCounter===core.GameUnifier.stepCounter||!this.find(a)){let b=await u.play(a,l.soundAlias,{...l.options,autostart:!y,filters:Ne(l.options.filters||[]),delay:l.options.delay});b.paused=y;}else {let b=p.mediaInstances.get(a);if(!b){_.warn(`No media instance found with alias ${a} while restoring background state.`);return}b.memory={...l.options,paused:y},[...b.filters].forEach(M=>{b.disconnect(M),M.dispose();}),b.chain(...Ne(l.options.filters||[]));}else {let b=await u.play(a,l.soundAlias,{...l.options,autostart:!y,filters:Ne(l.options.filters||[]),delay:l.options.delay});b.paused=y;}});await Promise.all(r);}}}catch(e){_.error("Error importing data",e);}}};var bt=new xe;core.GameUnifier.addOnPreContinue(async()=>{try{p.channels.forEach(o=>{o.background||o.stopAll();});}catch{}});if(typeof document<"u"){let o=false;document.addEventListener("visibilitychange",()=>{document.hidden?bt.muted||(bt.muteAll(),o=true):o&&(bt.unmuteAll(),o=false);});}exports.SoundRegistry=p;exports.sound=bt;
|
|
1
|
+
'use strict';var core=require('@drincs/pixi-vn/core'),kt=require('@drincs/pixi-vn/pixi.js'),B=require('tone');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var kt__default=/*#__PURE__*/_interopDefault(kt);var B__namespace=/*#__PURE__*/_interopNamespace(B);var Rt=Object.defineProperty;var wt=o=>{throw TypeError(o)};var Nt=(o,t,e)=>t in o?Rt(o,t,{enumerable:true,configurable:true,writable:true,value:e}):o[t]=e;var x=(o,t,e)=>Nt(o,typeof t!="symbol"?t+"":t,e),ze=(o,t,e)=>t.has(o)||wt("Cannot "+e);var i=(o,t,e)=>(ze(o,t,"read from private field"),e?e.call(o):t.get(o)),g=(o,t,e)=>t.has(o)?wt("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(o):t.set(o,e),c=(o,t,e,n)=>(ze(o,t,"write to private field"),t.set(o,e),e),d=(o,t,e)=>(ze(o,t,"access private method"),e);var De=(o,t,e,n)=>({set _(s){c(o,t,s);},get _(){return i(o,t,n)}});var Tt="general";var Gt=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,Ot=new Set,qe=typeof process=="object"&&process?process:{},_t=(o,t,e,n)=>{typeof qe.emitWarning=="function"?qe.emitWarning(o,t,e,n):console.error(`[${e}] ${t}: ${o}`);},Re=globalThis.AbortController,At=globalThis.AbortSignal;if(typeof Re>"u"){At=class{onabort;_onabort=[];reason;aborted=false;addEventListener(e,n){this._onabort.push(n);}},Re=class{constructor(){t();}signal=new At;abort(e){if(!this.signal.aborted){this.signal.reason=e,this.signal.aborted=true;for(let n of this.signal._onabort)n(e);this.signal.onabort?.(e);}}};let o=qe.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",t=()=>{o&&(o=false,_t("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",t));};}var Lt=o=>!Ot.has(o);var se=o=>o&&o===Math.floor(o)&&o>0&&isFinite(o),Ct=o=>se(o)?o<=Math.pow(2,8)?Uint8Array:o<=Math.pow(2,16)?Uint16Array:o<=Math.pow(2,32)?Uint32Array:o<=Number.MAX_SAFE_INTEGER?Ie:null:null,Ie=class extends Array{constructor(o){super(o),this.fill(0);}},te,fe,zt=(te=class{heap;length;static create(t){let e=Ct(t);if(!e)return [];c(te,fe,true);let n=new te(t,e);return c(te,fe,false),n}constructor(t,e){if(!i(te,fe))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new e(t),this.length=0;}push(t){this.heap[this.length++]=t;}pop(){return this.heap[--this.length]}},fe=new WeakMap,g(te,fe,false),te),St,Ft,j,q,K,he,$,ye,ge,H,C,X,O,A,m,N,U,I,E,Q,P,Z,J,W,V,ee,le,G,ve,h,Ue,ue,ie,Fe,Y,Pt,de,be,Oe,ae,re,We,Me,ke,T,Ve,Se,oe,Ye,we,Et=(we=class{constructor(t){g(this,h);g(this,j);g(this,q);g(this,K);g(this,he);g(this,$);g(this,ye);g(this,ge);g(this,H);x(this,"ttl");x(this,"ttlResolution");x(this,"ttlAutopurge");x(this,"updateAgeOnGet");x(this,"updateAgeOnHas");x(this,"allowStale");x(this,"noDisposeOnSet");x(this,"noUpdateTTL");x(this,"maxEntrySize");x(this,"sizeCalculation");x(this,"noDeleteOnFetchRejection");x(this,"noDeleteOnStaleGet");x(this,"allowStaleOnFetchAbort");x(this,"allowStaleOnFetchRejection");x(this,"ignoreFetchAbort");g(this,C);g(this,X);g(this,O);g(this,A);g(this,m);g(this,N);g(this,U);g(this,I);g(this,E);g(this,Q);g(this,P);g(this,Z);g(this,J);g(this,W);g(this,V);g(this,ee);g(this,le);g(this,G);g(this,ve);g(this,ue,()=>{});g(this,ie,()=>{});g(this,Fe,()=>{});g(this,Y,()=>false);g(this,de,t=>{});g(this,be,(t,e,n)=>{});g(this,Oe,(t,e,n,s)=>{if(n||s)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});x(this,St,"LRUCache");let{max:e=0,ttl:n,ttlResolution:s=1,ttlAutopurge:r,updateAgeOnGet:a,updateAgeOnHas:l,allowStale:u,dispose:y,onInsert:b,disposeAfter:v,noDisposeOnSet:M,noUpdateTTL:D,maxSize:z=0,maxEntrySize:S=0,sizeCalculation:w,fetchMethod:f,memoMethod:k,noDeleteOnFetchRejection:L,noDeleteOnStaleGet:R,allowStaleOnFetchRejection:F,allowStaleOnFetchAbort:Ae,ignoreFetchAbort:ce,perf:pe}=t;if(pe!==void 0&&typeof pe?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(c(this,H,pe??Gt),e!==0&&!se(e))throw new TypeError("max option must be a nonnegative integer");let me=e?Ct(e):Array;if(!me)throw new Error("invalid max value: "+e);if(c(this,j,e),c(this,q,z),this.maxEntrySize=S||i(this,q),this.sizeCalculation=w,this.sizeCalculation){if(!i(this,q)&&!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(k!==void 0&&typeof k!="function")throw new TypeError("memoMethod must be a function if defined");if(c(this,ge,k),f!==void 0&&typeof f!="function")throw new TypeError("fetchMethod must be a function if specified");if(c(this,ye,f),c(this,le,!!f),c(this,O,new Map),c(this,A,new Array(e).fill(void 0)),c(this,m,new Array(e).fill(void 0)),c(this,N,new me(e)),c(this,U,new me(e)),c(this,I,0),c(this,E,0),c(this,Q,zt.create(e)),c(this,C,0),c(this,X,0),typeof y=="function"&&c(this,K,y),typeof b=="function"&&c(this,he,b),typeof v=="function"?(c(this,$,v),c(this,P,[])):(c(this,$,void 0),c(this,P,void 0)),c(this,ee,!!i(this,K)),c(this,ve,!!i(this,he)),c(this,G,!!i(this,$)),this.noDisposeOnSet=!!M,this.noUpdateTTL=!!D,this.noDeleteOnFetchRejection=!!L,this.allowStaleOnFetchRejection=!!F,this.allowStaleOnFetchAbort=!!Ae,this.ignoreFetchAbort=!!ce,this.maxEntrySize!==0){if(i(this,q)!==0&&!se(i(this,q)))throw new TypeError("maxSize must be a positive integer if specified");if(!se(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");d(this,h,Pt).call(this);}if(this.allowStale=!!u,this.noDeleteOnStaleGet=!!R,this.updateAgeOnGet=!!a,this.updateAgeOnHas=!!l,this.ttlResolution=se(s)||s===0?s:1,this.ttlAutopurge=!!r,this.ttl=n||0,this.ttl){if(!se(this.ttl))throw new TypeError("ttl must be a positive integer if specified");d(this,h,Ue).call(this);}if(i(this,j)===0&&this.ttl===0&&i(this,q)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!i(this,j)&&!i(this,q)){let Le="LRU_CACHE_UNBOUNDED";Lt(Le)&&(Ot.add(Le),_t("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",Le,we));}}get perf(){return i(this,H)}static unsafeExposeInternals(t){return {starts:i(t,J),ttls:i(t,W),autopurgeTimers:i(t,V),sizes:i(t,Z),keyMap:i(t,O),keyList:i(t,A),valList:i(t,m),next:i(t,N),prev:i(t,U),get head(){return i(t,I)},get tail(){return i(t,E)},free:i(t,Q),isBackgroundFetch:e=>{var n;return d(n=t,h,T).call(n,e)},backgroundFetch:(e,n,s,r)=>{var a;return d(a=t,h,ke).call(a,e,n,s,r)},moveToTail:e=>{var n;return d(n=t,h,Se).call(n,e)},indexes:e=>{var n;return d(n=t,h,ae).call(n,e)},rindexes:e=>{var n;return d(n=t,h,re).call(n,e)},isStale:e=>{var n;return i(n=t,Y).call(n,e)}}}get max(){return i(this,j)}get maxSize(){return i(this,q)}get calculatedSize(){return i(this,X)}get size(){return i(this,C)}get fetchMethod(){return i(this,ye)}get memoMethod(){return i(this,ge)}get dispose(){return i(this,K)}get onInsert(){return i(this,he)}get disposeAfter(){return i(this,$)}getRemainingTTL(t){return i(this,O).has(t)?1/0:0}*entries(){for(let t of d(this,h,ae).call(this))i(this,m)[t]!==void 0&&i(this,A)[t]!==void 0&&!d(this,h,T).call(this,i(this,m)[t])&&(yield [i(this,A)[t],i(this,m)[t]]);}*rentries(){for(let t of d(this,h,re).call(this))i(this,m)[t]!==void 0&&i(this,A)[t]!==void 0&&!d(this,h,T).call(this,i(this,m)[t])&&(yield [i(this,A)[t],i(this,m)[t]]);}*keys(){for(let t of d(this,h,ae).call(this)){let e=i(this,A)[t];e!==void 0&&!d(this,h,T).call(this,i(this,m)[t])&&(yield e);}}*rkeys(){for(let t of d(this,h,re).call(this)){let e=i(this,A)[t];e!==void 0&&!d(this,h,T).call(this,i(this,m)[t])&&(yield e);}}*values(){for(let t of d(this,h,ae).call(this))i(this,m)[t]!==void 0&&!d(this,h,T).call(this,i(this,m)[t])&&(yield i(this,m)[t]);}*rvalues(){for(let t of d(this,h,re).call(this))i(this,m)[t]!==void 0&&!d(this,h,T).call(this,i(this,m)[t])&&(yield i(this,m)[t]);}[(Ft=Symbol.iterator,St=Symbol.toStringTag,Ft)](){return this.entries()}find(t,e={}){for(let n of d(this,h,ae).call(this)){let s=i(this,m)[n],r=d(this,h,T).call(this,s)?s.__staleWhileFetching:s;if(r!==void 0&&t(r,i(this,A)[n],this))return this.get(i(this,A)[n],e)}}forEach(t,e=this){for(let n of d(this,h,ae).call(this)){let s=i(this,m)[n],r=d(this,h,T).call(this,s)?s.__staleWhileFetching:s;r!==void 0&&t.call(e,r,i(this,A)[n],this);}}rforEach(t,e=this){for(let n of d(this,h,re).call(this)){let s=i(this,m)[n],r=d(this,h,T).call(this,s)?s.__staleWhileFetching:s;r!==void 0&&t.call(e,r,i(this,A)[n],this);}}purgeStale(){let t=false;for(let e of d(this,h,re).call(this,{allowStale:true}))i(this,Y).call(this,e)&&(d(this,h,oe).call(this,i(this,A)[e],"expire"),t=true);return t}info(t){let e=i(this,O).get(t);if(e===void 0)return;let n=i(this,m)[e],s=d(this,h,T).call(this,n)?n.__staleWhileFetching:n;if(s===void 0)return;let r={value:s};if(i(this,W)&&i(this,J)){let a=i(this,W)[e],l=i(this,J)[e];if(a&&l){let u=a-(i(this,H).now()-l);r.ttl=u,r.start=Date.now();}}return i(this,Z)&&(r.size=i(this,Z)[e]),r}dump(){let t=[];for(let e of d(this,h,ae).call(this,{allowStale:true})){let n=i(this,A)[e],s=i(this,m)[e],r=d(this,h,T).call(this,s)?s.__staleWhileFetching:s;if(r===void 0||n===void 0)continue;let a={value:r};if(i(this,W)&&i(this,J)){a.ttl=i(this,W)[e];let l=i(this,H).now()-i(this,J)[e];a.start=Math.floor(Date.now()-l);}i(this,Z)&&(a.size=i(this,Z)[e]),t.unshift([n,a]);}return t}load(t){this.clear();for(let[e,n]of t){if(n.start){let s=Date.now()-n.start;n.start=i(this,H).now()-s;}this.set(e,n.value,n);}}set(t,e,n={}){var M,D,z,S;if(e===void 0)return this.delete(t),this;let{ttl:s=this.ttl,start:r,noDisposeOnSet:a=this.noDisposeOnSet,sizeCalculation:l=this.sizeCalculation,status:u}=n,{noUpdateTTL:y=this.noUpdateTTL}=n,b=i(this,Oe).call(this,t,e,n.size||0,l);if(this.maxEntrySize&&b>this.maxEntrySize)return u&&(u.set="miss",u.maxEntrySizeExceeded=true),d(this,h,oe).call(this,t,"set"),this;let v=i(this,C)===0?void 0:i(this,O).get(t);if(v===void 0)v=i(this,C)===0?i(this,E):i(this,Q).length!==0?i(this,Q).pop():i(this,C)===i(this,j)?d(this,h,Me).call(this,false):i(this,C),i(this,A)[v]=t,i(this,m)[v]=e,i(this,O).set(t,v),i(this,N)[i(this,E)]=v,i(this,U)[v]=i(this,E),c(this,E,v),De(this,C)._++,i(this,be).call(this,v,b,u),u&&(u.set="add"),y=false,i(this,ve)&&((M=i(this,he))==null||M.call(this,e,t,"add"));else {d(this,h,Se).call(this,v);let w=i(this,m)[v];if(e!==w){if(i(this,le)&&d(this,h,T).call(this,w)){w.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:f}=w;f!==void 0&&!a&&(i(this,ee)&&((D=i(this,K))==null||D.call(this,f,t,"set")),i(this,G)&&i(this,P)?.push([f,t,"set"]));}else a||(i(this,ee)&&((z=i(this,K))==null||z.call(this,w,t,"set")),i(this,G)&&i(this,P)?.push([w,t,"set"]));if(i(this,de).call(this,v),i(this,be).call(this,v,b,u),i(this,m)[v]=e,u){u.set="replace";let f=w&&d(this,h,T).call(this,w)?w.__staleWhileFetching:w;f!==void 0&&(u.oldValue=f);}}else u&&(u.set="update");i(this,ve)&&this.onInsert?.(e,t,e===w?"update":"replace");}if(s!==0&&!i(this,W)&&d(this,h,Ue).call(this),i(this,W)&&(y||i(this,Fe).call(this,v,s,r),u&&i(this,ie).call(this,u,v)),!a&&i(this,G)&&i(this,P)){let w=i(this,P),f;for(;f=w?.shift();)(S=i(this,$))==null||S.call(this,...f);}return this}pop(){var t;try{for(;i(this,C);){let e=i(this,m)[i(this,I)];if(d(this,h,Me).call(this,!0),d(this,h,T).call(this,e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(i(this,G)&&i(this,P)){let e=i(this,P),n;for(;n=e?.shift();)(t=i(this,$))==null||t.call(this,...n);}}}has(t,e={}){let{updateAgeOnHas:n=this.updateAgeOnHas,status:s}=e,r=i(this,O).get(t);if(r!==void 0){let a=i(this,m)[r];if(d(this,h,T).call(this,a)&&a.__staleWhileFetching===void 0)return false;if(i(this,Y).call(this,r))s&&(s.has="stale",i(this,ie).call(this,s,r));else return n&&i(this,ue).call(this,r),s&&(s.has="hit",i(this,ie).call(this,s,r)),true}else s&&(s.has="miss");return false}peek(t,e={}){let{allowStale:n=this.allowStale}=e,s=i(this,O).get(t);if(s===void 0||!n&&i(this,Y).call(this,s))return;let r=i(this,m)[s];return d(this,h,T).call(this,r)?r.__staleWhileFetching:r}async fetch(t,e={}){let{allowStale:n=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:r=this.noDeleteOnStaleGet,ttl:a=this.ttl,noDisposeOnSet:l=this.noDisposeOnSet,size:u=0,sizeCalculation:y=this.sizeCalculation,noUpdateTTL:b=this.noUpdateTTL,noDeleteOnFetchRejection:v=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:M=this.allowStaleOnFetchRejection,ignoreFetchAbort:D=this.ignoreFetchAbort,allowStaleOnFetchAbort:z=this.allowStaleOnFetchAbort,context:S,forceRefresh:w=false,status:f,signal:k}=e;if(!i(this,le))return f&&(f.fetch="get"),this.get(t,{allowStale:n,updateAgeOnGet:s,noDeleteOnStaleGet:r,status:f});let L={allowStale:n,updateAgeOnGet:s,noDeleteOnStaleGet:r,ttl:a,noDisposeOnSet:l,size:u,sizeCalculation:y,noUpdateTTL:b,noDeleteOnFetchRejection:v,allowStaleOnFetchRejection:M,allowStaleOnFetchAbort:z,ignoreFetchAbort:D,status:f,signal:k},R=i(this,O).get(t);if(R===void 0){f&&(f.fetch="miss");let F=d(this,h,ke).call(this,t,R,L,S);return F.__returned=F}else {let F=i(this,m)[R];if(d(this,h,T).call(this,F)){let me=n&&F.__staleWhileFetching!==void 0;return f&&(f.fetch="inflight",me&&(f.returnedStale=true)),me?F.__staleWhileFetching:F.__returned=F}let Ae=i(this,Y).call(this,R);if(!w&&!Ae)return f&&(f.fetch="hit"),d(this,h,Se).call(this,R),s&&i(this,ue).call(this,R),f&&i(this,ie).call(this,f,R),F;let ce=d(this,h,ke).call(this,t,R,L,S),pe=ce.__staleWhileFetching!==void 0&&n;return f&&(f.fetch=Ae?"stale":"refresh",pe&&Ae&&(f.returnedStale=true)),pe?ce.__staleWhileFetching:ce.__returned=ce}}async forceFetch(t,e={}){let n=await this.fetch(t,e);if(n===void 0)throw new Error("fetch() returned undefined");return n}memo(t,e={}){let n=i(this,ge);if(!n)throw new Error("no memoMethod provided to constructor");let{context:s,forceRefresh:r,...a}=e,l=this.get(t,a);if(!r&&l!==void 0)return l;let u=n(t,l,{options:a,context:s});return this.set(t,u,a),u}get(t,e={}){let{allowStale:n=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:r=this.noDeleteOnStaleGet,status:a}=e,l=i(this,O).get(t);if(l!==void 0){let u=i(this,m)[l],y=d(this,h,T).call(this,u);return a&&i(this,ie).call(this,a,l),i(this,Y).call(this,l)?(a&&(a.get="stale"),y?(a&&n&&u.__staleWhileFetching!==void 0&&(a.returnedStale=true),n?u.__staleWhileFetching:void 0):(r||d(this,h,oe).call(this,t,"expire"),a&&n&&(a.returnedStale=true),n?u:void 0)):(a&&(a.get="hit"),y?u.__staleWhileFetching:(d(this,h,Se).call(this,l),s&&i(this,ue).call(this,l),u))}else a&&(a.get="miss");}delete(t){return d(this,h,oe).call(this,t,"delete")}clear(){return d(this,h,Ye).call(this,"delete")}},j=new WeakMap,q=new WeakMap,K=new WeakMap,he=new WeakMap,$=new WeakMap,ye=new WeakMap,ge=new WeakMap,H=new WeakMap,C=new WeakMap,X=new WeakMap,O=new WeakMap,A=new WeakMap,m=new WeakMap,N=new WeakMap,U=new WeakMap,I=new WeakMap,E=new WeakMap,Q=new WeakMap,P=new WeakMap,Z=new WeakMap,J=new WeakMap,W=new WeakMap,V=new WeakMap,ee=new WeakMap,le=new WeakMap,G=new WeakMap,ve=new WeakMap,h=new WeakSet,Ue=function(){let t=new Ie(i(this,j)),e=new Ie(i(this,j));c(this,W,t),c(this,J,e);let n=this.ttlAutopurge?new Array(i(this,j)):void 0;c(this,V,n),c(this,Fe,(l,u,y=i(this,H).now())=>{e[l]=u!==0?y:0,t[l]=u,s(l,u);}),c(this,ue,l=>{e[l]=t[l]!==0?i(this,H).now():0,s(l,t[l]);});let s=this.ttlAutopurge?(l,u)=>{if(n?.[l]&&(clearTimeout(n[l]),n[l]=void 0),u&&u!==0&&n){let y=setTimeout(()=>{i(this,Y).call(this,l)&&d(this,h,oe).call(this,i(this,A)[l],"expire");},u+1);y.unref&&y.unref(),n[l]=y;}}:()=>{};c(this,ie,(l,u)=>{if(t[u]){let y=t[u],b=e[u];if(!y||!b)return;l.ttl=y,l.start=b,l.now=r||a();let v=l.now-b;l.remainingTTL=y-v;}});let r=0,a=()=>{let l=i(this,H).now();if(this.ttlResolution>0){r=l;let u=setTimeout(()=>r=0,this.ttlResolution);u.unref&&u.unref();}return l};this.getRemainingTTL=l=>{let u=i(this,O).get(l);if(u===void 0)return 0;let y=t[u],b=e[u];if(!y||!b)return 1/0;let v=(r||a())-b;return y-v},c(this,Y,l=>{let u=e[l],y=t[l];return !!y&&!!u&&(r||a())-u>y});},ue=new WeakMap,ie=new WeakMap,Fe=new WeakMap,Y=new WeakMap,Pt=function(){let t=new Ie(i(this,j));c(this,X,0),c(this,Z,t),c(this,de,e=>{c(this,X,i(this,X)-t[e]),t[e]=0;}),c(this,Oe,(e,n,s,r)=>{if(d(this,h,T).call(this,n))return 0;if(!se(s))if(r){if(typeof r!="function")throw new TypeError("sizeCalculation must be a function");if(s=r(n,e),!se(s))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 s}),c(this,be,(e,n,s)=>{if(t[e]=n,i(this,q)){let r=i(this,q)-t[e];for(;i(this,X)>r;)d(this,h,Me).call(this,true);}c(this,X,i(this,X)+t[e]),s&&(s.entrySize=n,s.totalCalculatedSize=i(this,X));});},de=new WeakMap,be=new WeakMap,Oe=new WeakMap,ae=function*({allowStale:t=this.allowStale}={}){if(i(this,C))for(let e=i(this,E);!(!d(this,h,We).call(this,e)||((t||!i(this,Y).call(this,e))&&(yield e),e===i(this,I)));)e=i(this,U)[e];},re=function*({allowStale:t=this.allowStale}={}){if(i(this,C))for(let e=i(this,I);!(!d(this,h,We).call(this,e)||((t||!i(this,Y).call(this,e))&&(yield e),e===i(this,E)));)e=i(this,N)[e];},We=function(t){return t!==void 0&&i(this,O).get(i(this,A)[t])===t},Me=function(t){var r;let e=i(this,I),n=i(this,A)[e],s=i(this,m)[e];return i(this,le)&&d(this,h,T).call(this,s)?s.__abortController.abort(new Error("evicted")):(i(this,ee)||i(this,G))&&(i(this,ee)&&((r=i(this,K))==null||r.call(this,s,n,"evict")),i(this,G)&&i(this,P)?.push([s,n,"evict"])),i(this,de).call(this,e),i(this,V)?.[e]&&(clearTimeout(i(this,V)[e]),i(this,V)[e]=void 0),t&&(i(this,A)[e]=void 0,i(this,m)[e]=void 0,i(this,Q).push(e)),i(this,C)===1?(c(this,I,c(this,E,0)),i(this,Q).length=0):c(this,I,i(this,N)[e]),i(this,O).delete(n),De(this,C)._--,e},ke=function(t,e,n,s){let r=e===void 0?void 0:i(this,m)[e];if(d(this,h,T).call(this,r))return r;let a=new Re,{signal:l}=n;l?.addEventListener("abort",()=>a.abort(l.reason),{signal:a.signal});let u={signal:a.signal,options:n,context:s},y=(S,w=false)=>{let{aborted:f}=a.signal,k=n.ignoreFetchAbort&&S!==void 0,L=n.ignoreFetchAbort||!!(n.allowStaleOnFetchAbort&&S!==void 0);if(n.status&&(f&&!w?(n.status.fetchAborted=true,n.status.fetchError=a.signal.reason,k&&(n.status.fetchAbortIgnored=true)):n.status.fetchResolved=true),f&&!k&&!w)return v(a.signal.reason,L);let R=D,F=i(this,m)[e];return (F===D||k&&w&&F===void 0)&&(S===void 0?R.__staleWhileFetching!==void 0?i(this,m)[e]=R.__staleWhileFetching:d(this,h,oe).call(this,t,"fetch"):(n.status&&(n.status.fetchUpdated=true),this.set(t,S,u.options))),S},b=S=>(n.status&&(n.status.fetchRejected=true,n.status.fetchError=S),v(S,false)),v=(S,w)=>{let{aborted:f}=a.signal,k=f&&n.allowStaleOnFetchAbort,L=k||n.allowStaleOnFetchRejection,R=L||n.noDeleteOnFetchRejection,F=D;if(i(this,m)[e]===D&&(!R||!w&&F.__staleWhileFetching===void 0?d(this,h,oe).call(this,t,"fetch"):k||(i(this,m)[e]=F.__staleWhileFetching)),L)return n.status&&F.__staleWhileFetching!==void 0&&(n.status.returnedStale=true),F.__staleWhileFetching;if(F.__returned===F)throw S},M=(S,w)=>{var k;let f=(k=i(this,ye))==null?void 0:k.call(this,t,r,u);f&&f instanceof Promise&&f.then(L=>S(L===void 0?void 0:L),w),a.signal.addEventListener("abort",()=>{(!n.ignoreFetchAbort||n.allowStaleOnFetchAbort)&&(S(void 0),n.allowStaleOnFetchAbort&&(S=L=>y(L,true)));});};n.status&&(n.status.fetchDispatched=true);let D=new Promise(M).then(y,b),z=Object.assign(D,{__abortController:a,__staleWhileFetching:r,__returned:void 0});return e===void 0?(this.set(t,z,{...u.options,status:void 0}),e=i(this,O).get(t)):i(this,m)[e]=z,z},T=function(t){if(!i(this,le))return false;let e=t;return !!e&&e instanceof Promise&&e.hasOwnProperty("__staleWhileFetching")&&e.__abortController instanceof Re},Ve=function(t,e){i(this,U)[e]=t,i(this,N)[t]=e;},Se=function(t){t!==i(this,E)&&(t===i(this,I)?c(this,I,i(this,N)[t]):d(this,h,Ve).call(this,i(this,U)[t],i(this,N)[t]),d(this,h,Ve).call(this,i(this,E),t),c(this,E,t));},oe=function(t,e){var s,r;let n=false;if(i(this,C)!==0){let a=i(this,O).get(t);if(a!==void 0)if(i(this,V)?.[a]&&(clearTimeout(i(this,V)?.[a]),i(this,V)[a]=void 0),n=true,i(this,C)===1)d(this,h,Ye).call(this,e);else {i(this,de).call(this,a);let l=i(this,m)[a];if(d(this,h,T).call(this,l)?l.__abortController.abort(new Error("deleted")):(i(this,ee)||i(this,G))&&(i(this,ee)&&((s=i(this,K))==null||s.call(this,l,t,e)),i(this,G)&&i(this,P)?.push([l,t,e])),i(this,O).delete(t),i(this,A)[a]=void 0,i(this,m)[a]=void 0,a===i(this,E))c(this,E,i(this,U)[a]);else if(a===i(this,I))c(this,I,i(this,N)[a]);else {let u=i(this,U)[a];i(this,N)[u]=i(this,N)[a];let y=i(this,N)[a];i(this,U)[y]=i(this,U)[a];}De(this,C)._--,i(this,Q).push(a);}}if(i(this,G)&&i(this,P)?.length){let a=i(this,P),l;for(;l=a?.shift();)(r=i(this,$))==null||r.call(this,...l);}return n},Ye=function(t){var e,n;for(let s of d(this,h,re).call(this,{allowStale:true})){let r=i(this,m)[s];if(d(this,h,T).call(this,r))r.__abortController.abort(new Error("deleted"));else {let a=i(this,A)[s];i(this,ee)&&((e=i(this,K))==null||e.call(this,r,a,t)),i(this,G)&&i(this,P)?.push([r,a,t]);}}if(i(this,O).clear(),i(this,m).fill(void 0),i(this,A).fill(void 0),i(this,W)&&i(this,J)){i(this,W).fill(0),i(this,J).fill(0);for(let s of i(this,V)??[])s!==void 0&&clearTimeout(s);i(this,V)?.fill(void 0);}if(i(this,Z)&&i(this,Z).fill(0),c(this,I,0),c(this,E,0),i(this,Q).length=0,c(this,X,0),c(this,C,0),i(this,G)&&i(this,P)){let s=i(this,P),r;for(;r=s?.shift();)(n=i(this,$))==null||n.call(this,...r);}},we);var _e=class{cache;map=new Map;constructor(t){this.cache=new Et({max:t.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(t){let e=this.map.delete(t);return e&&this.cache.delete(t),e}get forEach(){return this.map.forEach}get(t){let e=this.cache.get(t);return e||this.map.get(t)}has(t){return this.map.has(t)}set(t,e){return this.map.set(t,e),this.cache.set(t,e),this}get size(){return this.map.size}entries(){return this.map.entries()}keys(){return this.map.keys()}values(){return this.map.values()}};var xt;(r=>(r.mediaInstances=new Map,r.channels=new Map,r.transients=new Set,r.systemPausedAliases=new Set,r.bufferRegistry=new _e({cacheSize:10})))(xt||={});var p=xt;var _;(s=>(s.log=(r,...a)=>console.log(`[Pixi\u2019VN] ${r}`,...a),s.warn=(r,...a)=>console.warn(`[Pixi\u2019VN] ${r}`,...a),s.error=(r,...a)=>console.error(`[Pixi\u2019VN] ${r}`,...a),s.info=(r,...a)=>console.info(`[Pixi\u2019VN] ${r}`,...a)))(_||={});function Ne(o){return o.reduce((t,e)=>{switch(e.filterType){case "ReverbFilter":t.push(new B.Reverb({decay:e.decay,preDelay:e.preDelay,wet:e.wet}).toDestination());break;case "FeedbackDelayFilter":t.push(new B.FeedbackDelay({feedback:e.feedback,delayTime:e.delayTime,wet:e.wet}).toDestination());break;case "BitCrusherFilter":t.push(new B.BitCrusher({bits:e.bits}).toDestination());break;case "CompressorFilter":t.push(new B.Compressor({attack:e.attack,knee:e.knee,ratio:e.ratio,release:e.release,threshold:e.threshold}).toDestination());break;case "DelayFilter":t.push(new B.Delay({delayTime:e.delayTime,maxDelay:e.maxDelay}).toDestination());break;case "DistortionFilter":t.push(new B.Distortion({distortion:e.distortion,oversample:e.oversample,wet:e.wet}).toDestination());break;case "FeedbackCombFilterFilter":t.push(new B.FeedbackCombFilter({delayTime:e.delayTime,resonance:e.resonance}).toDestination());break;case "FreeverbFilter":t.push(new B.Freeverb({roomSize:e.roomSize,dampening:e.dampening,wet:e.wet}).toDestination());break;case "GateFilter":t.push(new B.Gate({threshold:e.threshold,smoothing:e.smoothing}).toDestination());break;case "GreaterThanFilter":t.push(new B.GreaterThan({value:e.value,convert:e.convert,maxValue:e.maxValue,minValue:e.minValue,units:e.units}).toDestination());break;case "GreaterThanZeroFilter":t.push(new B.GreaterThanZero);break;case "LimiterFilter":t.push(new B.Limiter({threshold:e.threshold}).toDestination());break;case "MidSideCompressorFilter":t.push(new B.MidSideCompressor({mid:e.mid,side:e.side}).toDestination());break;case "MultibandCompressorFilter":t.push(new B.MultibandCompressor({lowFrequency:e.lowFrequency,highFrequency:e.highFrequency,low:e.low,mid:e.mid,high:e.high}).toDestination());break;case "Panner3DFilter":t.push(new B.Panner3D({positionX:e.positionX,positionY:e.positionY,positionZ:e.positionZ,orientationX:e.orientationX,orientationY:e.orientationY,orientationZ:e.orientationZ,coneInnerAngle:e.coneInnerAngle,coneOuterAngle:e.coneOuterAngle,coneOuterGain:e.coneOuterGain,distanceModel:e.distanceModel,maxDistance:e.maxDistance,refDistance:e.refDistance,rolloffFactor:e.rolloffFactor,panningModel:e.panningModel}).toDestination());break;case "PhaserFilter":t.push(new B.Phaser({frequency:e.frequency,octaves:e.octaves,baseFrequency:e.baseFrequency,wet:e.wet,Q:e.Q,stages:e.stages}).toDestination());break;case "StereoWidenerFilter":t.push(new B.StereoWidener({width:e.width,wet:e.wet}).toDestination());break;case "PingPongDelayFilter":t.push(new B.PingPongDelay({wet:e.wet,delayTime:e.delayTime,feedback:e.feedback,maxDelay:e.maxDelay}).toDestination());break;case "AutoFilterFilter":t.push(new B.AutoFilter({frequency:e.frequency,depth:e.depth,baseFrequency:e.baseFrequency,octaves:e.octaves,filter:e.filter,wet:e.wet,type:e.type}).toDestination());break;case "BiquadFilterFilter":t.push(new B.BiquadFilter({frequency:e.frequency,detune:e.detune,Q:e.Q,type:e.type,gain:e.gain}).toDestination());break;case "OnePoleFilterFilter":t.push(new B.OnePoleFilter({type:e.type}).toDestination());break;case "CustomFilter":t.push(new B.Filter({frequency:e.frequency,Q:e.Q,type:e.type,detune:e.detune,gain:e.gain,rolloff:e.rolloff}).toDestination());break;case "ChorusFilter":t.push(new B.Chorus({frequency:e.frequency,delayTime:e.delayTime,depth:e.depth,type:e.type,spread:e.spread,feedback:e.feedback,wet:e.wet}).toDestination());break;case "TremoloFilter":t.push(new B.Tremolo({frequency:e.frequency,type:e.type,depth:e.depth,spread:e.spread,wet:e.wet}).toDestination());break;case "VibratoFilter":t.push(new B.Vibrato({maxDelay:e.maxDelay,frequency:e.frequency,depth:e.depth,type:e.type,wet:e.wet}).toDestination());break;case "AutoPannerFilter":t.push(new B.AutoPanner({frequency:e.frequency,type:e.type,depth:e.depth,channelCount:e.channelCount,wet:e.wet}).toDestination());break}return t},[])}function It(o){if(o)return Array.from(o).reduce((t,e)=>(e instanceof B.Reverb?t.push({filterType:"ReverbFilter",wet:e.wet.value,decay:B.Time(e.decay).toSeconds(),preDelay:B.Time(e.preDelay).toSeconds()}):e instanceof B.PingPongDelay?t.push({filterType:"PingPongDelayFilter",wet:e.wet.value,delayTime:e.delayTime.value,feedback:e.feedback.value}):e instanceof B.FeedbackDelay?t.push({filterType:"FeedbackDelayFilter",feedback:e.feedback.value,delayTime:e.delayTime.value,wet:e.wet.value}):e instanceof B.BitCrusher?t.push({filterType:"BitCrusherFilter",bits:e.bits.value,wet:e.wet.value}):e instanceof B.Compressor?t.push({filterType:"CompressorFilter",attack:e.attack.value,knee:e.knee.value,ratio:e.ratio.value,release:e.release.value,threshold:e.threshold.value}):e instanceof B.Delay?t.push({filterType:"DelayFilter",delayTime:e.delayTime.value,maxDelay:e.maxDelay}):e instanceof B.Distortion?t.push({filterType:"DistortionFilter",distortion:e.distortion,oversample:e.oversample,wet:e.wet.value}):e instanceof B.FeedbackCombFilter?t.push({filterType:"FeedbackCombFilterFilter",delayTime:e.delayTime.value,resonance:e.resonance.value}):e instanceof B.Freeverb?t.push({filterType:"FreeverbFilter",roomSize:e.roomSize.value,dampening:e.dampening,wet:e.wet.value}):e instanceof B.Gate?t.push({filterType:"GateFilter",threshold:e.threshold,smoothing:e.smoothing}):e instanceof B.GreaterThan?t.push({filterType:"GreaterThanFilter",value:e.comparator.value,convert:e.convert,maxValue:e.maxValue,minValue:e.minValue}):e instanceof B.GreaterThanZero?t.push({filterType:"GreaterThanZeroFilter"}):e instanceof B.Limiter?t.push({filterType:"LimiterFilter",threshold:e.threshold.value}):e instanceof B.MidSideCompressor?t.push({filterType:"MidSideCompressorFilter",mid:{attack:e.mid.attack.value,knee:e.mid.knee.value,ratio:e.mid.ratio.value,release:e.mid.release.value,threshold:e.mid.threshold.value},side:{attack:e.side.attack.value,knee:e.side.knee.value,ratio:e.side.ratio.value,release:e.side.release.value,threshold:e.side.threshold.value}}):e instanceof B.MultibandCompressor?t.push({filterType:"MultibandCompressorFilter",lowFrequency:e.lowFrequency.value,highFrequency:e.highFrequency.value,low:{attack:e.low.attack.value,knee:e.low.knee.value,ratio:e.low.ratio.value,release:e.low.release.value,threshold:e.low.threshold.value},mid:{attack:e.mid.attack.value,knee:e.mid.knee.value,ratio:e.mid.ratio.value,release:e.mid.release.value,threshold:e.mid.threshold.value},high:{attack:e.high.attack.value,knee:e.high.knee.value,ratio:e.high.ratio.value,release:e.high.release.value,threshold:e.high.threshold.value}}):e instanceof B.Panner3D?t.push({filterType:"Panner3DFilter",positionX:e.positionX.value,positionY:e.positionY.value,positionZ:e.positionZ.value,orientationX:e.orientationX.value,orientationY:e.orientationY.value,orientationZ:e.orientationZ.value,coneInnerAngle:e.coneInnerAngle,coneOuterAngle:e.coneOuterAngle,coneOuterGain:e.coneOuterGain,distanceModel:e.distanceModel,maxDistance:e.maxDistance,refDistance:e.refDistance,rolloffFactor:e.rolloffFactor,panningModel:e.panningModel}):e instanceof B.Phaser?t.push({filterType:"PhaserFilter",frequency:e.frequency.value,octaves:e.octaves,baseFrequency:e.baseFrequency,wet:e.wet.value,Q:e.Q.value}):e instanceof B.StereoWidener?t.push({filterType:"StereoWidenerFilter",width:e.width.value,wet:e.wet.value}):e instanceof B.AutoFilter?t.push({filterType:"AutoFilterFilter",type:e.type,frequency:e.frequency.value,depth:e.depth.value,baseFrequency:e.baseFrequency,octaves:e.octaves,filter:{Q:e.filter.Q.value,type:e.filter.type,rolloff:e.filter.rolloff},wet:e.wet.value}):e instanceof B.Chorus?t.push({filterType:"ChorusFilter",type:e.type,frequency:e.frequency.value,delayTime:e.delayTime,depth:e.depth,spread:e.spread,feedback:e.feedback.value,wet:e.wet.value}):e instanceof B.Tremolo?t.push({filterType:"TremoloFilter",type:e.type,frequency:e.frequency.value,depth:e.depth.value,spread:e.spread,wet:e.wet.value}):e instanceof B.Vibrato?t.push({filterType:"VibratoFilter",type:e.type,frequency:e.frequency.value,depth:e.depth.value,wet:e.wet.value}):e instanceof B.AutoPanner?t.push({filterType:"AutoPannerFilter",type:e.type,frequency:e.frequency.value,depth:e.depth.value,channelCount:e.channelCount,wet:e.wet.value}):e instanceof B.BiquadFilter?t.push({filterType:"BiquadFilterFilter",type:e.type,frequency:e.frequency.value,detune:e.detune.value,Q:e.Q.value,gain:e.gain.value}):e instanceof B.OnePoleFilter?t.push({filterType:"OnePoleFilterFilter",type:e.type}):e instanceof B.Filter?t.push({filterType:"CustomFilter",type:e.type,frequency:e.frequency.value,Q:e.Q.value,detune:e.detune.value,gain:e.gain.value,rolloff:e.rolloff}):_.warn(`Unsupported filter type for serialisation: ${e?.constructor?.name??e}, please report this to the developers if you encounter it.`),t),[])}function gt(o){return o instanceof B.Reverb||o instanceof B.FeedbackDelay||o instanceof B.PingPongDelay||o instanceof B.BitCrusher||o instanceof B.Compressor||o instanceof B.Delay||o instanceof B.Distortion||o instanceof B.FeedbackCombFilter||o instanceof B.Freeverb||o instanceof B.Gate||o instanceof B.GreaterThan||o instanceof B.GreaterThanZero||o instanceof B.Limiter||o instanceof B.MidSideCompressor||o instanceof B.MultibandCompressor||o instanceof B.Panner3D||o instanceof B.Phaser||o instanceof B.StereoWidener||o instanceof B.AutoFilter||o instanceof B.Chorus||o instanceof B.Vibrato||o instanceof B.Tremolo||o instanceof B.AutoPanner||o instanceof B.BiquadFilter||o instanceof B.OnePoleFilter||o instanceof B.Filter}function ne(o){return o<=0?-1/0:20*Math.log10(o)}function Te(o){return o<=-1/0?0:10**(o/20)}async function Ge(o){if(p.bufferRegistry.has(o))return;let t=o;try{let e=kt__default.default.Assets.resolver.resolve(o);e?.src&&(t=e.src);}catch{}try{let e=await B.ToneAudioBuffer.load(t),n=new B.ToneAudioBuffer(e);p.bufferRegistry.set(o,n);}catch(e){_.warn(`Failed to load audio buffer for "${o}" (url: "${t}"): ${e instanceof Error?e.message:e}`),p.bufferRegistry.set(o,new B.ToneAudioBuffer);}}var Ee=class extends B.Player{constructor(e,n,s,r,a={},l){super(a);this.alias=e;this.channelAlias=n;this.soundAlias=s;this.stepCounter=r;this.delay=l;this.options=a,this.playStartTime=B.now()+(l??0);}alias;channelAlias;soundAlias;stepCounter;delay;options;filters=new Set;pausedAt=void 0;playStartTime=B.now();get memory(){let e=Math.max(0,this.pausedAt?this.pausedAt-this.playStartTime:B.now()-this.playStartTime),n=this.paused;return n&&p.systemPausedAliases.has(this.alias)&&(n=false),{...this.options,fadeIn:this.fadeIn,loop:this.loop,loopEnd:this.loopEnd,loopStart:this.loopStart,mute:this.mute,playbackRate:this.playbackRate,reverse:this.reverse,volume:Te(this.volume.value),autostart:!this.paused,elapsed:e,paused:n,delay:this.delay}}set memory(e){this.paused=e.paused,this.loop!==(e.loop||false)&&(this.loop=e.loop||false),this.volume.value!==ne(e.volume??1)&&(this.volume.value=ne(e.volume??1)),this.mute!==(e.mute||false)&&(this.mute=e.mute||false),this.playbackRate!==(e.playbackRate??1)&&(this.playbackRate=e.playbackRate??1),this.reverse!==(e.reverse||false)&&(this.reverse=e.reverse||false),this.fadeIn!==(e.fadeIn||0)&&(this.fadeIn=e.fadeIn||0),this.loopStart!==(e.loopStart||0)&&(this.loopStart=e.loopStart||0),this.loopEnd!==(e.loopEnd||0)&&(this.loopEnd=e.loopEnd||0);}get paused(){return typeof this.pausedAt=="number"}set paused(e){let n=this.state;if(e)this.pausedAt=B.now(),n==="started"&&super.stop();else {let s,r=false;typeof this.pausedAt=="number"&&(r=true,s=this.pausedAt-this.playStartTime,this.pausedAt=void 0),r&&n==="stopped"&&(this.delay?this.start(`+${this.delay}`,s):this.start(void 0,s));}}get muted(){return this.mute}set muted(e){this.mute=e;}get speed(){return this.playbackRate}set speed(e){this.playbackRate=e;}stop(e){return p.mediaInstances.delete(this.alias),super.stop(e)}start(e,n,s){let r=B.now(),a=r;if(typeof e=="number")a=e;else if(typeof e=="string"&&e.startsWith("+")){let u=Number(e.slice(1));Number.isNaN(u)||(a=r+u);}let l=typeof n=="number"?n:0;return this.playStartTime=a-l,super.start(e,n,s)}chain(...e){return e.forEach(n=>{gt(n)&&(n.toDestination(),this.filters.add(n));}),super.chain(...e)}disconnect(e){return gt(e)&&(e.disconnect(),this.filters.delete(e)),super.disconnect(e)}};var Pe=class{constructor(t,e={}){this.alias=t;this.background=e.background??false,this.toneChannel=new B.Channel({volume:ne(e.volume??1),mute:e.muted??false,pan:e.pan??0}).toDestination(),e.filters&&this.toneChannel.chain(...e.filters);}alias;toneChannel;get volume(){return Te(this.toneChannel.volume.value)}set volume(t){this.toneChannel.volume.value=ne(t);}get volumeParam(){return this.toneChannel.volume}get pan(){return this.toneChannel.pan.value}set pan(t){this.toneChannel.pan.value=t;}get panParam(){return this.toneChannel.pan}get muted(){return this.toneChannel.mute}set muted(t){this.toneChannel.mute=t;}pauseAll(){for(let t of p.mediaInstances.values())t.channelAlias===this.alias&&!t.paused&&(t.paused=true);return this}resumeAll(){for(let t of p.mediaInstances.values())t.channelAlias===this.alias&&t.paused&&(t.paused=false);return this}chain(...t){return this.toneChannel.chain(...t),this}background;_createPlayer(t,e,n={}){let s=p.bufferRegistry.get(e);if(!s)throw new core.PixiError("unregistered_asset",`Sound buffer for alias "${e}" is not loaded. Call sound.load() first.`);let{delay:r,elapsed:a,filters:l=[],muted:u,autostart:y=true,speed:b,volume:v,...M}=n;u!==void 0&&(_.warn(`MediaInstance "${t}" is being created with muted=${u}. This will override the channel's muted state (${this.muted}).`),M.mute=u),b!==void 0&&(_.warn(`MediaInstance "${t}" is being created with speed=${b}. This will override the default playback speed of 1.`),M.playbackRate=b);let D=new Ee(t,this.alias,e,core.GameUnifier.stepCounter,{...M,volume:v!==void 0?ne(v):void 0,url:s},r).chain(...l,this.toneChannel),z=a!==void 0?Math.max(0,a):void 0;return y&&(r?D.start(`+${r}`,z):D.start(void 0,z)),D}async play(t,e,n){let s,r;if(typeof e=="string"?(s=t,r=e):(s=t,r=t,n=e),p.mediaInstances.has(s)){let l=p.mediaInstances.get(s);l&&(l.stop(),n={...l.memory,...n,filters:[...l.filters,...n?.filters||[]]});}await Ge(r);let a=this._createPlayer(s,r,n);return p.mediaInstances.set(s,a),a}toggleMuteAll(){return this.muted=!this.muted,this.muted}get mediaInstances(){return Array.from(p.mediaInstances.values()).reduce((t,e)=>(e.channelAlias===this.alias&&t.push(e),t),[])}stopAll(){let t=[];for(let[e,n]of p.mediaInstances.entries())n.channelAlias===this.alias&&(n.stop(),t.push(e));return t.forEach(e=>{p.mediaInstances.delete(e);}),this}};function Mt(o){try{if(typeof o>"u")return o;let t=JSON.stringify(o);return JSON.parse(t)}catch(t){throw _.error("Error creating exportable element",o,t),new core.PixiError("not_json_serializable","Error creating exportable element")}}var xe=class{get volumeAll(){return Te(B__namespace.getDestination().volume.value)}set volumeAll(t){B__namespace.getDestination().volume.value=ne(t);}get speedAll(){return this._speedAll}set speedAll(t){this._speedAll=t;for(let e of p.mediaInstances.values())e.speed=t;}_speedAll=1;_defaultChannelAlias=Tt;get defaultChannelAlias(){return this._defaultChannelAlias}set defaultChannelAlias(t){this._defaultChannelAlias=t;}add(t,e){if(!p.bufferRegistry.has(t)){let n=new B__namespace.ToneAudioBuffer(e);p.bufferRegistry.set(t,n);}}pauseAll(){for(let t of p.mediaInstances.values())t.paused||(t.paused=true);return this}resumeAll(){for(let t of p.mediaInstances.values())t.paused&&(t.paused=false);return this}get muted(){return B__namespace.getDestination().mute}toggleMuteAll(){let t=!B__namespace.getDestination().mute;return B__namespace.getDestination().mute=t,t}muteAll(){return B__namespace.getDestination().mute=true,this}unmuteAll(){return B__namespace.getDestination().mute=false,this}stopAll(){for(let t of p.mediaInstances.values())t.stop();return p.mediaInstances.clear(),this}pauseUnsavedAll(t){for(let[e,n]of p.mediaInstances.entries())t&&n.channelAlias!==t||n.paused||(n.paused=true,p.systemPausedAliases.add(e));if(!t){for(let e of p.transients)e.stop();p.transients.clear();}return this}resumeUnsavedAll(t){let e=[];for(let n of p.systemPausedAliases){let s=p.mediaInstances.get(n);if(!s){e.push(n);continue}t&&s.channelAlias!==t||(s.paused=false,e.push(n));}for(let n of e)p.systemPausedAliases.delete(n);return this}stopTransientAll(){for(let t of p.transients)t.stop();return p.transients.clear(),this}async play(t,e,n){let s,r;typeof e=="string"?(s=t,r=e):(s=t,r=t,n=e),p.bufferRegistry.has(r)||await this.load(r);let{channel:a=this.defaultChannelAlias,...l}=n??{};return await this.findChannel(a).play(s,r,l)}async playTransient(t,e){p.bufferRegistry.has(t)||await this.load(t);let n=p.bufferRegistry.get(t);if(!n)throw new core.PixiError("unregistered_asset",`Sound buffer for alias "${t}" is not loaded. Call sound.load() first.`);let{autostart:s=true,...r}=e??{},a=new B__namespace.Player({...r,url:n}).toDestination();return s&&a.start(),p.transients.add(a),a.onstop=()=>{a.dispose(),p.transients.delete(a);},a}find(t){return p.mediaInstances.get(t)}stop(t){let e=this.find(t);e?(e.stop(),p.mediaInstances.delete(t)):_.warn(`No media instance found with alias ${t} to stop.`);}pause(t){let e=this.find(t);if(!e){_.warn(`No media instance found with alias ${t} to pause.`);return}return e.paused=true,e}resume(t){let e=this.find(t);if(!e){_.warn(`No media instance found with alias ${t} to resume.`);return}return e.paused=false,e}duration(t){return p.bufferRegistry.get(t)?.duration??0}async load(...t){let e=t.map(Ge);await Promise.all(e);}backgroundLoad(...t){return this.load(...t).catch(e=>{_.error("Error background-loading sound",e);})}backgroundLoadBundle(t){let e=kt__default.default.Assets.backgroundLoadBundle(t);return e.then(async()=>{try{let n=await kt__default.default.Assets.loadBundle(t),s=[];for(let r in n)p.bufferRegistry.has(r)||s.push(this.load(r));await Promise.all(s);}catch(n){_.error("Error loading sound bundle",n);}}).catch(n=>{_.error("Error background-loading sound bundle",n);}),e}clear(){this.stopAll();}addChannel(t,e={}){if(typeof t!="string"){t.forEach(s=>{let r={...e,filters:e.filters?[...e.filters]:e.filters};this.addChannel(s,r);});return}if(p.channels.has(t)){_.warn(`Channel with alias ${t} already exists.`);return}let n=new Pe(t,e);return p.channels.set(t,n),n}findChannel(t){let e=p.channels.get(t);return e||this.addChannel(t)}get channels(){return Array.from(p.channels.values())}export(){let t=Array.from(p.mediaInstances.entries()).reduce((e,[n,s])=>(e[n]={channelAlias:s.channelAlias,soundAlias:s.soundAlias,stepCounter:s.stepCounter,paused:s.paused,options:{...s.memory,filters:It(s.filters)}},e),{});return {mediaInstances:Mt(t)}}async restore(t){try{if(Object.hasOwn(t,"soundsPlaying")){let e=t.soundsPlaying;if(e){let n=Object.keys(e).map(async s=>{await this.load(s),await this.play(s);});await Promise.all(n);}}if(Object.hasOwn(t,"mediaInstances")){let e=t.mediaInstances;if(e){let n=new Set,s=Object.values(e).map(async({soundAlias:a,channelAlias:l})=>(n.add(l),await this.load(a)));await Promise.all(s),this.channels.forEach(a=>{(!a.background||!n.has(a.alias))&&a.stopAll();});let r=Object.keys(e).map(async a=>{let l=e[a],u=this.findChannel(l.channelAlias),y=l.options.paused??l.paused??!1;if(u.background)if(l.stepCounter===core.GameUnifier.stepCounter||!this.find(a)){let b=await u.play(a,l.soundAlias,{...l.options,autostart:!y,filters:Ne(l.options.filters||[]),delay:l.options.delay});b.paused=y;}else {let b=p.mediaInstances.get(a);if(!b){_.warn(`No media instance found with alias ${a} while restoring background state.`);return}b.memory={...l.options,paused:y},[...b.filters].forEach(M=>{b.disconnect(M),M.dispose();}),b.chain(...Ne(l.options.filters||[]));}else {let b=await u.play(a,l.soundAlias,{...l.options,autostart:!y,filters:Ne(l.options.filters||[]),delay:l.options.delay});b.paused=y;}});await Promise.all(r);}}}catch(e){_.error("Error importing data",e);}}};var bt=new xe;core.GameUnifier.addOnPreContinue(async()=>{try{p.channels.forEach(o=>{o.background||o.stopAll();});}catch{}});if(typeof document<"u"){let o=false;document.addEventListener("visibilitychange",()=>{document.hidden?bt.muted||(bt.muteAll(),o=true):o&&(bt.unmuteAll(),o=false);});}exports.SoundRegistry=p;exports.sound=bt;
|
package/dist/sound.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import {i as i$1}from'./chunk-IWAXXFXE.mjs';import {d,e,f as f$1}from'./chunk-HQQ5WH6C.mjs';import {GameUnifier,PixiError}from'@drincs/pixi-vn/core';import se from'@drincs/pixi-vn/pixi.js';import*as p from'tone';import {ToneAudioBuffer,Channel,Reverb,Time,PingPongDelay,FeedbackDelay,BitCrusher,Compressor,Delay,Distortion,FeedbackCombFilter,Freeverb,Gate,GreaterThan,GreaterThanZero,Limiter,MidSideCompressor,MultibandCompressor,Panner3D,Phaser,StereoWidener,AutoFilter,Chorus,Tremolo,Vibrato,AutoPanner,BiquadFilter,OnePoleFilter,Filter,Player,now}from'tone';var ie;(s=>(s.mediaInstances=new Map,s.channels=new Map,s.transients=new Set,s.systemPausedAliases=new Set,s.bufferRegistry=new d({cacheSize:10})))(ie||={});var i=ie;function w(a){return a.reduce((t,e)=>{switch(e.filterType){case "ReverbFilter":t.push(new Reverb({decay:e.decay,preDelay:e.preDelay,wet:e.wet}).toDestination());break;case "FeedbackDelayFilter":t.push(new FeedbackDelay({feedback:e.feedback,delayTime:e.delayTime,wet:e.wet}).toDestination());break;case "BitCrusherFilter":t.push(new BitCrusher({bits:e.bits}).toDestination());break;case "CompressorFilter":t.push(new Compressor({attack:e.attack,knee:e.knee,ratio:e.ratio,release:e.release,threshold:e.threshold}).toDestination());break;case "DelayFilter":t.push(new Delay({delayTime:e.delayTime,maxDelay:e.maxDelay}).toDestination());break;case "DistortionFilter":t.push(new Distortion({distortion:e.distortion,oversample:e.oversample,wet:e.wet}).toDestination());break;case "FeedbackCombFilterFilter":t.push(new FeedbackCombFilter({delayTime:e.delayTime,resonance:e.resonance}).toDestination());break;case "FreeverbFilter":t.push(new Freeverb({roomSize:e.roomSize,dampening:e.dampening,wet:e.wet}).toDestination());break;case "GateFilter":t.push(new Gate({threshold:e.threshold,smoothing:e.smoothing}).toDestination());break;case "GreaterThanFilter":t.push(new GreaterThan({value:e.value,convert:e.convert,maxValue:e.maxValue,minValue:e.minValue,units:e.units}).toDestination());break;case "GreaterThanZeroFilter":t.push(new GreaterThanZero);break;case "LimiterFilter":t.push(new Limiter({threshold:e.threshold}).toDestination());break;case "MidSideCompressorFilter":t.push(new MidSideCompressor({mid:e.mid,side:e.side}).toDestination());break;case "MultibandCompressorFilter":t.push(new MultibandCompressor({lowFrequency:e.lowFrequency,highFrequency:e.highFrequency,low:e.low,mid:e.mid,high:e.high}).toDestination());break;case "Panner3DFilter":t.push(new Panner3D({positionX:e.positionX,positionY:e.positionY,positionZ:e.positionZ,orientationX:e.orientationX,orientationY:e.orientationY,orientationZ:e.orientationZ,coneInnerAngle:e.coneInnerAngle,coneOuterAngle:e.coneOuterAngle,coneOuterGain:e.coneOuterGain,distanceModel:e.distanceModel,maxDistance:e.maxDistance,refDistance:e.refDistance,rolloffFactor:e.rolloffFactor,panningModel:e.panningModel}).toDestination());break;case "PhaserFilter":t.push(new Phaser({frequency:e.frequency,octaves:e.octaves,baseFrequency:e.baseFrequency,wet:e.wet,Q:e.Q,stages:e.stages}).toDestination());break;case "StereoWidenerFilter":t.push(new StereoWidener({width:e.width,wet:e.wet}).toDestination());break;case "PingPongDelayFilter":t.push(new PingPongDelay({wet:e.wet,delayTime:e.delayTime,feedback:e.feedback,maxDelay:e.maxDelay}).toDestination());break;case "AutoFilterFilter":t.push(new AutoFilter({frequency:e.frequency,depth:e.depth,baseFrequency:e.baseFrequency,octaves:e.octaves,filter:e.filter,wet:e.wet,type:e.type}).toDestination());break;case "BiquadFilterFilter":t.push(new BiquadFilter({frequency:e.frequency,detune:e.detune,Q:e.Q,type:e.type,gain:e.gain}).toDestination());break;case "OnePoleFilterFilter":t.push(new OnePoleFilter({type:e.type}).toDestination());break;case "CustomFilter":t.push(new Filter({frequency:e.frequency,Q:e.Q,type:e.type,detune:e.detune,gain:e.gain,rolloff:e.rolloff}).toDestination());break;case "ChorusFilter":t.push(new Chorus({frequency:e.frequency,delayTime:e.delayTime,depth:e.depth,type:e.type,spread:e.spread,feedback:e.feedback,wet:e.wet}).toDestination());break;case "TremoloFilter":t.push(new Tremolo({frequency:e.frequency,type:e.type,depth:e.depth,spread:e.spread,wet:e.wet}).toDestination());break;case "VibratoFilter":t.push(new Vibrato({maxDelay:e.maxDelay,frequency:e.frequency,depth:e.depth,type:e.type,wet:e.wet}).toDestination());break;case "AutoPannerFilter":t.push(new AutoPanner({frequency:e.frequency,type:e.type,depth:e.depth,channelCount:e.channelCount,wet:e.wet}).toDestination());break}return t},[])}function oe(a){if(a)return Array.from(a).reduce((t,e$1)=>(e$1 instanceof Reverb?t.push({filterType:"ReverbFilter",wet:e$1.wet.value,decay:Time(e$1.decay).toSeconds(),preDelay:Time(e$1.preDelay).toSeconds()}):e$1 instanceof PingPongDelay?t.push({filterType:"PingPongDelayFilter",wet:e$1.wet.value,delayTime:e$1.delayTime.value,feedback:e$1.feedback.value}):e$1 instanceof FeedbackDelay?t.push({filterType:"FeedbackDelayFilter",feedback:e$1.feedback.value,delayTime:e$1.delayTime.value,wet:e$1.wet.value}):e$1 instanceof BitCrusher?t.push({filterType:"BitCrusherFilter",bits:e$1.bits.value,wet:e$1.wet.value}):e$1 instanceof Compressor?t.push({filterType:"CompressorFilter",attack:e$1.attack.value,knee:e$1.knee.value,ratio:e$1.ratio.value,release:e$1.release.value,threshold:e$1.threshold.value}):e$1 instanceof Delay?t.push({filterType:"DelayFilter",delayTime:e$1.delayTime.value,maxDelay:e$1.maxDelay}):e$1 instanceof Distortion?t.push({filterType:"DistortionFilter",distortion:e$1.distortion,oversample:e$1.oversample,wet:e$1.wet.value}):e$1 instanceof FeedbackCombFilter?t.push({filterType:"FeedbackCombFilterFilter",delayTime:e$1.delayTime.value,resonance:e$1.resonance.value}):e$1 instanceof Freeverb?t.push({filterType:"FreeverbFilter",roomSize:e$1.roomSize.value,dampening:e$1.dampening,wet:e$1.wet.value}):e$1 instanceof Gate?t.push({filterType:"GateFilter",threshold:e$1.threshold,smoothing:e$1.smoothing}):e$1 instanceof GreaterThan?t.push({filterType:"GreaterThanFilter",value:e$1.comparator.value,convert:e$1.convert,maxValue:e$1.maxValue,minValue:e$1.minValue}):e$1 instanceof GreaterThanZero?t.push({filterType:"GreaterThanZeroFilter"}):e$1 instanceof Limiter?t.push({filterType:"LimiterFilter",threshold:e$1.threshold.value}):e$1 instanceof MidSideCompressor?t.push({filterType:"MidSideCompressorFilter",mid:{attack:e$1.mid.attack.value,knee:e$1.mid.knee.value,ratio:e$1.mid.ratio.value,release:e$1.mid.release.value,threshold:e$1.mid.threshold.value},side:{attack:e$1.side.attack.value,knee:e$1.side.knee.value,ratio:e$1.side.ratio.value,release:e$1.side.release.value,threshold:e$1.side.threshold.value}}):e$1 instanceof MultibandCompressor?t.push({filterType:"MultibandCompressorFilter",lowFrequency:e$1.lowFrequency.value,highFrequency:e$1.highFrequency.value,low:{attack:e$1.low.attack.value,knee:e$1.low.knee.value,ratio:e$1.low.ratio.value,release:e$1.low.release.value,threshold:e$1.low.threshold.value},mid:{attack:e$1.mid.attack.value,knee:e$1.mid.knee.value,ratio:e$1.mid.ratio.value,release:e$1.mid.release.value,threshold:e$1.mid.threshold.value},high:{attack:e$1.high.attack.value,knee:e$1.high.knee.value,ratio:e$1.high.ratio.value,release:e$1.high.release.value,threshold:e$1.high.threshold.value}}):e$1 instanceof Panner3D?t.push({filterType:"Panner3DFilter",positionX:e$1.positionX.value,positionY:e$1.positionY.value,positionZ:e$1.positionZ.value,orientationX:e$1.orientationX.value,orientationY:e$1.orientationY.value,orientationZ:e$1.orientationZ.value,coneInnerAngle:e$1.coneInnerAngle,coneOuterAngle:e$1.coneOuterAngle,coneOuterGain:e$1.coneOuterGain,distanceModel:e$1.distanceModel,maxDistance:e$1.maxDistance,refDistance:e$1.refDistance,rolloffFactor:e$1.rolloffFactor,panningModel:e$1.panningModel}):e$1 instanceof Phaser?t.push({filterType:"PhaserFilter",frequency:e$1.frequency.value,octaves:e$1.octaves,baseFrequency:e$1.baseFrequency,wet:e$1.wet.value,Q:e$1.Q.value}):e$1 instanceof StereoWidener?t.push({filterType:"StereoWidenerFilter",width:e$1.width.value,wet:e$1.wet.value}):e$1 instanceof AutoFilter?t.push({filterType:"AutoFilterFilter",type:e$1.type,frequency:e$1.frequency.value,depth:e$1.depth.value,baseFrequency:e$1.baseFrequency,octaves:e$1.octaves,filter:{Q:e$1.filter.Q.value,type:e$1.filter.type,rolloff:e$1.filter.rolloff},wet:e$1.wet.value}):e$1 instanceof Chorus?t.push({filterType:"ChorusFilter",type:e$1.type,frequency:e$1.frequency.value,delayTime:e$1.delayTime,depth:e$1.depth,spread:e$1.spread,feedback:e$1.feedback.value,wet:e$1.wet.value}):e$1 instanceof Tremolo?t.push({filterType:"TremoloFilter",type:e$1.type,frequency:e$1.frequency.value,depth:e$1.depth.value,spread:e$1.spread,wet:e$1.wet.value}):e$1 instanceof Vibrato?t.push({filterType:"VibratoFilter",type:e$1.type,frequency:e$1.frequency.value,depth:e$1.depth.value,wet:e$1.wet.value}):e$1 instanceof AutoPanner?t.push({filterType:"AutoPannerFilter",type:e$1.type,frequency:e$1.frequency.value,depth:e$1.depth.value,channelCount:e$1.channelCount,wet:e$1.wet.value}):e$1 instanceof BiquadFilter?t.push({filterType:"BiquadFilterFilter",type:e$1.type,frequency:e$1.frequency.value,detune:e$1.detune.value,Q:e$1.Q.value,gain:e$1.gain.value}):e$1 instanceof OnePoleFilter?t.push({filterType:"OnePoleFilterFilter",type:e$1.type}):e$1 instanceof Filter?t.push({filterType:"CustomFilter",type:e$1.type,frequency:e$1.frequency.value,Q:e$1.Q.value,detune:e$1.detune.value,gain:e$1.gain.value,rolloff:e$1.rolloff}):e.warn(`Unsupported filter type for serialisation: ${e$1?.constructor?.name??e$1}, please report this to the developers if you encounter it.`),t),[])}function H(a){return a instanceof Reverb||a instanceof FeedbackDelay||a instanceof PingPongDelay||a instanceof BitCrusher||a instanceof Compressor||a instanceof Delay||a instanceof Distortion||a instanceof FeedbackCombFilter||a instanceof Freeverb||a instanceof Gate||a instanceof GreaterThan||a instanceof GreaterThanZero||a instanceof Limiter||a instanceof MidSideCompressor||a instanceof MultibandCompressor||a instanceof Panner3D||a instanceof Phaser||a instanceof StereoWidener||a instanceof AutoFilter||a instanceof Chorus||a instanceof Vibrato||a instanceof Tremolo||a instanceof AutoPanner||a instanceof BiquadFilter||a instanceof OnePoleFilter||a instanceof Filter}function m(a){return a<=0?-1/0:20*Math.log10(a)}function f(a){return a<=-1/0?0:10**(a/20)}async function T(a){if(i.bufferRegistry.has(a))return;let t=a;try{let e=se.Assets.resolver.resolve(a);e?.src&&(t=e.src);}catch{}try{let e=await ToneAudioBuffer.load(t),n=new ToneAudioBuffer(e);i.bufferRegistry.set(a,n);}catch(e$1){e.warn(`Failed to load audio buffer for "${a}" (url: "${t}"): ${e$1 instanceof Error?e$1.message:e$1}`),i.bufferRegistry.set(a,new ToneAudioBuffer);}}var b=class extends Player{constructor(e,n,r,s,o={},l){super(o);this.alias=e;this.channelAlias=n;this.soundAlias=r;this.stepCounter=s;this.delay=l;this.options=o,this.playStartTime=now()+(l??0);}alias;channelAlias;soundAlias;stepCounter;delay;options;filters=new Set;pausedAt=void 0;playStartTime=now();get memory(){let e=Math.max(0,this.pausedAt?this.pausedAt-this.playStartTime:now()-this.playStartTime),n=this.paused;return n&&i.systemPausedAliases.has(this.alias)&&(n=false),{...this.options,fadeIn:this.fadeIn,loop:this.loop,loopEnd:this.loopEnd,loopStart:this.loopStart,mute:this.mute,playbackRate:this.playbackRate,reverse:this.reverse,volume:f(this.volume.value),autostart:!this.paused,elapsed:e,paused:n,delay:this.delay}}set memory(e){this.paused=e.paused,this.loop!==(e.loop||false)&&(this.loop=e.loop||false),this.volume.value!==m(e.volume??1)&&(this.volume.value=m(e.volume??1)),this.mute!==(e.mute||false)&&(this.mute=e.mute||false),this.playbackRate!==(e.playbackRate??1)&&(this.playbackRate=e.playbackRate??1),this.reverse!==(e.reverse||false)&&(this.reverse=e.reverse||false),this.fadeIn!==(e.fadeIn||0)&&(this.fadeIn=e.fadeIn||0),this.loopStart!==(e.loopStart||0)&&(this.loopStart=e.loopStart||0),this.loopEnd!==(e.loopEnd||0)&&(this.loopEnd=e.loopEnd||0);}get paused(){return typeof this.pausedAt=="number"}set paused(e){let n=this.state;if(e)this.pausedAt=now(),n==="started"&&super.stop();else {let r;typeof this.pausedAt=="number"&&(r=this.pausedAt-this.playStartTime,this.pausedAt=void 0),n==="stopped"&&(this.delay?this.start(`+${this.delay}`,r):this.start(void 0,r));}}get muted(){return this.mute}set muted(e){this.mute=e;}get speed(){return this.playbackRate}set speed(e){this.playbackRate=e;}stop(e){return i.mediaInstances.delete(this.alias),super.stop(e)}start(e,n,r){let s=now(),o=s;if(typeof e=="number")o=e;else if(typeof e=="string"&&e.startsWith("+")){let c=Number(e.slice(1));Number.isNaN(c)||(o=s+c);}let l=typeof n=="number"?n:0;return this.playStartTime=o-l,super.start(e,n,r)}chain(...e){return e.forEach(n=>{H(n)&&(n.toDestination(),this.filters.add(n));}),super.chain(...e)}disconnect(e){return H(e)&&(e.disconnect(),this.filters.delete(e)),super.disconnect(e)}};var v=class{constructor(t,e={}){this.alias=t;this.background=e.background??false,this.toneChannel=new Channel({volume:m(e.volume??1),mute:e.muted??false,pan:e.pan??0}).toDestination(),e.filters&&this.toneChannel.chain(...e.filters);}alias;toneChannel;get volume(){return f(this.toneChannel.volume.value)}set volume(t){this.toneChannel.volume.value=m(t);}get volumeParam(){return this.toneChannel.volume}get pan(){return this.toneChannel.pan.value}set pan(t){this.toneChannel.pan.value=t;}get panParam(){return this.toneChannel.pan}get muted(){return this.toneChannel.mute}set muted(t){this.toneChannel.mute=t;}pauseAll(){for(let t of i.mediaInstances.values())t.channelAlias===this.alias&&!t.paused&&(t.paused=true);return this}resumeAll(){for(let t of i.mediaInstances.values())t.channelAlias===this.alias&&t.paused&&(t.paused=false);return this}chain(...t){return this.toneChannel.chain(...t),this}background;_createPlayer(t,e$1,n={}){let r=i.bufferRegistry.get(e$1);if(!r)throw new PixiError("unregistered_asset",`Sound buffer for alias "${e$1}" is not loaded. Call sound.load() first.`);let{delay:s,elapsed:o,filters:l=[],muted:c,autostart:h=true,speed:d,volume:P,...y}=n;c!==void 0&&(e.warn(`MediaInstance "${t}" is being created with muted=${c}. This will override the channel's muted state (${this.muted}).`),y.mute=c),d!==void 0&&(e.warn(`MediaInstance "${t}" is being created with speed=${d}. This will override the default playback speed of 1.`),y.playbackRate=d);let A=new b(t,this.alias,e$1,GameUnifier.stepCounter,{...y,volume:P!==void 0?m(P):void 0,url:r},s).chain(...l,this.toneChannel),ee=o!==void 0?Math.max(0,o):void 0;return h&&(s?A.start(`+${s}`,ee):A.start(void 0,ee)),A}async play(t,e,n){let r,s;if(typeof e=="string"?(r=t,s=e):(r=t,s=t,n=e),i.mediaInstances.has(r)){let l=i.mediaInstances.get(r);l&&(l.stop(),n={...l.memory,...n,filters:[...l.filters,...n?.filters||[]]});}await T(s);let o=this._createPlayer(r,s,n);return i.mediaInstances.set(r,o),o}toggleMuteAll(){return this.muted=!this.muted,this.muted}get mediaInstances(){return Array.from(i.mediaInstances.values()).reduce((t,e)=>(e.channelAlias===this.alias&&t.push(e),t),[])}stopAll(){let t=[];for(let[e,n]of i.mediaInstances.entries())n.channelAlias===this.alias&&(n.stop(),t.push(e));return t.forEach(e=>{i.mediaInstances.delete(e);}),this}};var F=class{get volumeAll(){return f(p.getDestination().volume.value)}set volumeAll(t){p.getDestination().volume.value=m(t);}get speedAll(){return this._speedAll}set speedAll(t){this._speedAll=t;for(let e of i.mediaInstances.values())e.speed=t;}_speedAll=1;_defaultChannelAlias=i$1;get defaultChannelAlias(){return this._defaultChannelAlias}set defaultChannelAlias(t){this._defaultChannelAlias=t;}add(t,e){if(!i.bufferRegistry.has(t)){let n=new p.ToneAudioBuffer(e);i.bufferRegistry.set(t,n);}}pauseAll(){for(let t of i.mediaInstances.values())t.paused||(t.paused=true);return this}resumeAll(){for(let t of i.mediaInstances.values())t.paused&&(t.paused=false);return this}get muted(){return p.getDestination().mute}toggleMuteAll(){let t=!p.getDestination().mute;return p.getDestination().mute=t,t}muteAll(){return p.getDestination().mute=true,this}unmuteAll(){return p.getDestination().mute=false,this}stopAll(){for(let t of i.mediaInstances.values())t.stop();return i.mediaInstances.clear(),this}pauseUnsavedAll(t){for(let[e,n]of i.mediaInstances.entries())t&&n.channelAlias!==t||n.paused||(n.paused=true,i.systemPausedAliases.add(e));if(!t){for(let e of i.transients)e.stop();i.transients.clear();}return this}resumeUnsavedAll(t){let e=[];for(let n of i.systemPausedAliases){let r=i.mediaInstances.get(n);if(!r){e.push(n);continue}t&&r.channelAlias!==t||(r.paused=false,e.push(n));}for(let n of e)i.systemPausedAliases.delete(n);return this}stopTransientAll(){for(let t of i.transients)t.stop();return i.transients.clear(),this}async play(t,e,n){let r,s;typeof e=="string"?(r=t,s=e):(r=t,s=t,n=e),i.bufferRegistry.has(s)||await this.load(s);let{channel:o=this.defaultChannelAlias,...l}=n??{};return await this.findChannel(o).play(r,s,l)}async playTransient(t,e){i.bufferRegistry.has(t)||await this.load(t);let n=i.bufferRegistry.get(t);if(!n)throw new PixiError("unregistered_asset",`Sound buffer for alias "${t}" is not loaded. Call sound.load() first.`);let{autostart:r=true,...s}=e??{},o=new p.Player({...s,url:n}).toDestination();return r&&o.start(),i.transients.add(o),o.onstop=()=>{o.dispose(),i.transients.delete(o);},o}find(t){return i.mediaInstances.get(t)}stop(t){let e$1=this.find(t);e$1?(e$1.stop(),i.mediaInstances.delete(t)):e.warn(`No media instance found with alias ${t} to stop.`);}pause(t){let e$1=this.find(t);if(!e$1){e.warn(`No media instance found with alias ${t} to pause.`);return}return e$1.paused=true,e$1}resume(t){let e$1=this.find(t);if(!e$1){e.warn(`No media instance found with alias ${t} to resume.`);return}return e$1.paused=false,e$1}duration(t){return i.bufferRegistry.get(t)?.duration??0}async load(...t){let e=t.map(T);await Promise.all(e);}backgroundLoad(...t){return this.load(...t).catch(e$1=>{e.error("Error background-loading sound",e$1);})}backgroundLoadBundle(t){let e$1=se.Assets.backgroundLoadBundle(t);return e$1.then(async()=>{try{let n=await se.Assets.loadBundle(t),r=[];for(let s in n)i.bufferRegistry.has(s)||r.push(this.load(s));await Promise.all(r);}catch(n){e.error("Error loading sound bundle",n);}}).catch(n=>{e.error("Error background-loading sound bundle",n);}),e$1}clear(){this.stopAll();}addChannel(t,e$1={}){if(typeof t!="string"){t.forEach(r=>{let s={...e$1,filters:e$1.filters?[...e$1.filters]:e$1.filters};this.addChannel(r,s);});return}if(i.channels.has(t)){e.warn(`Channel with alias ${t} already exists.`);return}let n=new v(t,e$1);return i.channels.set(t,n),n}findChannel(t){let e=i.channels.get(t);return e||this.addChannel(t)}get channels(){return Array.from(i.channels.values())}export(){let t=Array.from(i.mediaInstances.entries()).reduce((e,[n,r])=>(e[n]={channelAlias:r.channelAlias,soundAlias:r.soundAlias,stepCounter:r.stepCounter,paused:r.paused,options:{...r.memory,filters:oe(r.filters)}},e),{});return {mediaInstances:f$1(t)}}async restore(t){try{if(Object.hasOwn(t,"soundsPlaying")){let e=t.soundsPlaying;if(e){let n=Object.keys(e).map(async r=>{await this.load(r),await this.play(r);});await Promise.all(n);}}if(Object.hasOwn(t,"mediaInstances")){let e$1=t.mediaInstances;if(e$1){let n=new Set,r=Object.values(e$1).map(async({soundAlias:o,channelAlias:l})=>(n.add(l),await this.load(o)));await Promise.all(r),this.channels.forEach(o=>{(!o.background||!n.has(o.alias))&&o.stopAll();});let s=Object.keys(e$1).map(async o=>{let l=e$1[o],c=this.findChannel(l.channelAlias),h=l.options.paused??l.paused??!1;if(c.background)if(l.stepCounter===GameUnifier.stepCounter||!this.find(o)){let d=await c.play(o,l.soundAlias,{...l.options,autostart:!h,filters:w(l.options.filters||[]),delay:l.options.delay});d.paused=h;}else {let d=i.mediaInstances.get(o);if(!d){e.warn(`No media instance found with alias ${o} while restoring background state.`);return}d.memory={...l.options,paused:h},[...d.filters].forEach(y=>{d.disconnect(y),y.dispose();}),d.chain(...w(l.options.filters||[]));}else {let d=await c.play(o,l.soundAlias,{...l.options,autostart:!h,filters:w(l.options.filters||[]),delay:l.options.delay});d.paused=h;}});await Promise.all(s);}}}catch(e$1){e.error("Error importing data",e$1);}}};var K=new F;GameUnifier.addOnPreContinue(async()=>{try{i.channels.forEach(a=>{a.background||a.stopAll();});}catch{}});if(typeof document<"u"){let a=false;document.addEventListener("visibilitychange",()=>{document.hidden?K.muted||(K.muteAll(),a=true):a&&(K.unmuteAll(),a=false);});}export{i as SoundRegistry,K as sound};
|
|
1
|
+
import {i as i$1}from'./chunk-IWAXXFXE.mjs';import {d,e,f as f$1}from'./chunk-HQQ5WH6C.mjs';import {GameUnifier,PixiError}from'@drincs/pixi-vn/core';import se from'@drincs/pixi-vn/pixi.js';import*as p from'tone';import {ToneAudioBuffer,Channel,Reverb,Time,PingPongDelay,FeedbackDelay,BitCrusher,Compressor,Delay,Distortion,FeedbackCombFilter,Freeverb,Gate,GreaterThan,GreaterThanZero,Limiter,MidSideCompressor,MultibandCompressor,Panner3D,Phaser,StereoWidener,AutoFilter,Chorus,Tremolo,Vibrato,AutoPanner,BiquadFilter,OnePoleFilter,Filter,Player,now}from'tone';var ie;(o=>(o.mediaInstances=new Map,o.channels=new Map,o.transients=new Set,o.systemPausedAliases=new Set,o.bufferRegistry=new d({cacheSize:10})))(ie||={});var i=ie;function w(a){return a.reduce((t,e)=>{switch(e.filterType){case "ReverbFilter":t.push(new Reverb({decay:e.decay,preDelay:e.preDelay,wet:e.wet}).toDestination());break;case "FeedbackDelayFilter":t.push(new FeedbackDelay({feedback:e.feedback,delayTime:e.delayTime,wet:e.wet}).toDestination());break;case "BitCrusherFilter":t.push(new BitCrusher({bits:e.bits}).toDestination());break;case "CompressorFilter":t.push(new Compressor({attack:e.attack,knee:e.knee,ratio:e.ratio,release:e.release,threshold:e.threshold}).toDestination());break;case "DelayFilter":t.push(new Delay({delayTime:e.delayTime,maxDelay:e.maxDelay}).toDestination());break;case "DistortionFilter":t.push(new Distortion({distortion:e.distortion,oversample:e.oversample,wet:e.wet}).toDestination());break;case "FeedbackCombFilterFilter":t.push(new FeedbackCombFilter({delayTime:e.delayTime,resonance:e.resonance}).toDestination());break;case "FreeverbFilter":t.push(new Freeverb({roomSize:e.roomSize,dampening:e.dampening,wet:e.wet}).toDestination());break;case "GateFilter":t.push(new Gate({threshold:e.threshold,smoothing:e.smoothing}).toDestination());break;case "GreaterThanFilter":t.push(new GreaterThan({value:e.value,convert:e.convert,maxValue:e.maxValue,minValue:e.minValue,units:e.units}).toDestination());break;case "GreaterThanZeroFilter":t.push(new GreaterThanZero);break;case "LimiterFilter":t.push(new Limiter({threshold:e.threshold}).toDestination());break;case "MidSideCompressorFilter":t.push(new MidSideCompressor({mid:e.mid,side:e.side}).toDestination());break;case "MultibandCompressorFilter":t.push(new MultibandCompressor({lowFrequency:e.lowFrequency,highFrequency:e.highFrequency,low:e.low,mid:e.mid,high:e.high}).toDestination());break;case "Panner3DFilter":t.push(new Panner3D({positionX:e.positionX,positionY:e.positionY,positionZ:e.positionZ,orientationX:e.orientationX,orientationY:e.orientationY,orientationZ:e.orientationZ,coneInnerAngle:e.coneInnerAngle,coneOuterAngle:e.coneOuterAngle,coneOuterGain:e.coneOuterGain,distanceModel:e.distanceModel,maxDistance:e.maxDistance,refDistance:e.refDistance,rolloffFactor:e.rolloffFactor,panningModel:e.panningModel}).toDestination());break;case "PhaserFilter":t.push(new Phaser({frequency:e.frequency,octaves:e.octaves,baseFrequency:e.baseFrequency,wet:e.wet,Q:e.Q,stages:e.stages}).toDestination());break;case "StereoWidenerFilter":t.push(new StereoWidener({width:e.width,wet:e.wet}).toDestination());break;case "PingPongDelayFilter":t.push(new PingPongDelay({wet:e.wet,delayTime:e.delayTime,feedback:e.feedback,maxDelay:e.maxDelay}).toDestination());break;case "AutoFilterFilter":t.push(new AutoFilter({frequency:e.frequency,depth:e.depth,baseFrequency:e.baseFrequency,octaves:e.octaves,filter:e.filter,wet:e.wet,type:e.type}).toDestination());break;case "BiquadFilterFilter":t.push(new BiquadFilter({frequency:e.frequency,detune:e.detune,Q:e.Q,type:e.type,gain:e.gain}).toDestination());break;case "OnePoleFilterFilter":t.push(new OnePoleFilter({type:e.type}).toDestination());break;case "CustomFilter":t.push(new Filter({frequency:e.frequency,Q:e.Q,type:e.type,detune:e.detune,gain:e.gain,rolloff:e.rolloff}).toDestination());break;case "ChorusFilter":t.push(new Chorus({frequency:e.frequency,delayTime:e.delayTime,depth:e.depth,type:e.type,spread:e.spread,feedback:e.feedback,wet:e.wet}).toDestination());break;case "TremoloFilter":t.push(new Tremolo({frequency:e.frequency,type:e.type,depth:e.depth,spread:e.spread,wet:e.wet}).toDestination());break;case "VibratoFilter":t.push(new Vibrato({maxDelay:e.maxDelay,frequency:e.frequency,depth:e.depth,type:e.type,wet:e.wet}).toDestination());break;case "AutoPannerFilter":t.push(new AutoPanner({frequency:e.frequency,type:e.type,depth:e.depth,channelCount:e.channelCount,wet:e.wet}).toDestination());break}return t},[])}function oe(a){if(a)return Array.from(a).reduce((t,e$1)=>(e$1 instanceof Reverb?t.push({filterType:"ReverbFilter",wet:e$1.wet.value,decay:Time(e$1.decay).toSeconds(),preDelay:Time(e$1.preDelay).toSeconds()}):e$1 instanceof PingPongDelay?t.push({filterType:"PingPongDelayFilter",wet:e$1.wet.value,delayTime:e$1.delayTime.value,feedback:e$1.feedback.value}):e$1 instanceof FeedbackDelay?t.push({filterType:"FeedbackDelayFilter",feedback:e$1.feedback.value,delayTime:e$1.delayTime.value,wet:e$1.wet.value}):e$1 instanceof BitCrusher?t.push({filterType:"BitCrusherFilter",bits:e$1.bits.value,wet:e$1.wet.value}):e$1 instanceof Compressor?t.push({filterType:"CompressorFilter",attack:e$1.attack.value,knee:e$1.knee.value,ratio:e$1.ratio.value,release:e$1.release.value,threshold:e$1.threshold.value}):e$1 instanceof Delay?t.push({filterType:"DelayFilter",delayTime:e$1.delayTime.value,maxDelay:e$1.maxDelay}):e$1 instanceof Distortion?t.push({filterType:"DistortionFilter",distortion:e$1.distortion,oversample:e$1.oversample,wet:e$1.wet.value}):e$1 instanceof FeedbackCombFilter?t.push({filterType:"FeedbackCombFilterFilter",delayTime:e$1.delayTime.value,resonance:e$1.resonance.value}):e$1 instanceof Freeverb?t.push({filterType:"FreeverbFilter",roomSize:e$1.roomSize.value,dampening:e$1.dampening,wet:e$1.wet.value}):e$1 instanceof Gate?t.push({filterType:"GateFilter",threshold:e$1.threshold,smoothing:e$1.smoothing}):e$1 instanceof GreaterThan?t.push({filterType:"GreaterThanFilter",value:e$1.comparator.value,convert:e$1.convert,maxValue:e$1.maxValue,minValue:e$1.minValue}):e$1 instanceof GreaterThanZero?t.push({filterType:"GreaterThanZeroFilter"}):e$1 instanceof Limiter?t.push({filterType:"LimiterFilter",threshold:e$1.threshold.value}):e$1 instanceof MidSideCompressor?t.push({filterType:"MidSideCompressorFilter",mid:{attack:e$1.mid.attack.value,knee:e$1.mid.knee.value,ratio:e$1.mid.ratio.value,release:e$1.mid.release.value,threshold:e$1.mid.threshold.value},side:{attack:e$1.side.attack.value,knee:e$1.side.knee.value,ratio:e$1.side.ratio.value,release:e$1.side.release.value,threshold:e$1.side.threshold.value}}):e$1 instanceof MultibandCompressor?t.push({filterType:"MultibandCompressorFilter",lowFrequency:e$1.lowFrequency.value,highFrequency:e$1.highFrequency.value,low:{attack:e$1.low.attack.value,knee:e$1.low.knee.value,ratio:e$1.low.ratio.value,release:e$1.low.release.value,threshold:e$1.low.threshold.value},mid:{attack:e$1.mid.attack.value,knee:e$1.mid.knee.value,ratio:e$1.mid.ratio.value,release:e$1.mid.release.value,threshold:e$1.mid.threshold.value},high:{attack:e$1.high.attack.value,knee:e$1.high.knee.value,ratio:e$1.high.ratio.value,release:e$1.high.release.value,threshold:e$1.high.threshold.value}}):e$1 instanceof Panner3D?t.push({filterType:"Panner3DFilter",positionX:e$1.positionX.value,positionY:e$1.positionY.value,positionZ:e$1.positionZ.value,orientationX:e$1.orientationX.value,orientationY:e$1.orientationY.value,orientationZ:e$1.orientationZ.value,coneInnerAngle:e$1.coneInnerAngle,coneOuterAngle:e$1.coneOuterAngle,coneOuterGain:e$1.coneOuterGain,distanceModel:e$1.distanceModel,maxDistance:e$1.maxDistance,refDistance:e$1.refDistance,rolloffFactor:e$1.rolloffFactor,panningModel:e$1.panningModel}):e$1 instanceof Phaser?t.push({filterType:"PhaserFilter",frequency:e$1.frequency.value,octaves:e$1.octaves,baseFrequency:e$1.baseFrequency,wet:e$1.wet.value,Q:e$1.Q.value}):e$1 instanceof StereoWidener?t.push({filterType:"StereoWidenerFilter",width:e$1.width.value,wet:e$1.wet.value}):e$1 instanceof AutoFilter?t.push({filterType:"AutoFilterFilter",type:e$1.type,frequency:e$1.frequency.value,depth:e$1.depth.value,baseFrequency:e$1.baseFrequency,octaves:e$1.octaves,filter:{Q:e$1.filter.Q.value,type:e$1.filter.type,rolloff:e$1.filter.rolloff},wet:e$1.wet.value}):e$1 instanceof Chorus?t.push({filterType:"ChorusFilter",type:e$1.type,frequency:e$1.frequency.value,delayTime:e$1.delayTime,depth:e$1.depth,spread:e$1.spread,feedback:e$1.feedback.value,wet:e$1.wet.value}):e$1 instanceof Tremolo?t.push({filterType:"TremoloFilter",type:e$1.type,frequency:e$1.frequency.value,depth:e$1.depth.value,spread:e$1.spread,wet:e$1.wet.value}):e$1 instanceof Vibrato?t.push({filterType:"VibratoFilter",type:e$1.type,frequency:e$1.frequency.value,depth:e$1.depth.value,wet:e$1.wet.value}):e$1 instanceof AutoPanner?t.push({filterType:"AutoPannerFilter",type:e$1.type,frequency:e$1.frequency.value,depth:e$1.depth.value,channelCount:e$1.channelCount,wet:e$1.wet.value}):e$1 instanceof BiquadFilter?t.push({filterType:"BiquadFilterFilter",type:e$1.type,frequency:e$1.frequency.value,detune:e$1.detune.value,Q:e$1.Q.value,gain:e$1.gain.value}):e$1 instanceof OnePoleFilter?t.push({filterType:"OnePoleFilterFilter",type:e$1.type}):e$1 instanceof Filter?t.push({filterType:"CustomFilter",type:e$1.type,frequency:e$1.frequency.value,Q:e$1.Q.value,detune:e$1.detune.value,gain:e$1.gain.value,rolloff:e$1.rolloff}):e.warn(`Unsupported filter type for serialisation: ${e$1?.constructor?.name??e$1}, please report this to the developers if you encounter it.`),t),[])}function H(a){return a instanceof Reverb||a instanceof FeedbackDelay||a instanceof PingPongDelay||a instanceof BitCrusher||a instanceof Compressor||a instanceof Delay||a instanceof Distortion||a instanceof FeedbackCombFilter||a instanceof Freeverb||a instanceof Gate||a instanceof GreaterThan||a instanceof GreaterThanZero||a instanceof Limiter||a instanceof MidSideCompressor||a instanceof MultibandCompressor||a instanceof Panner3D||a instanceof Phaser||a instanceof StereoWidener||a instanceof AutoFilter||a instanceof Chorus||a instanceof Vibrato||a instanceof Tremolo||a instanceof AutoPanner||a instanceof BiquadFilter||a instanceof OnePoleFilter||a instanceof Filter}function m(a){return a<=0?-1/0:20*Math.log10(a)}function f(a){return a<=-1/0?0:10**(a/20)}async function T(a){if(i.bufferRegistry.has(a))return;let t=a;try{let e=se.Assets.resolver.resolve(a);e?.src&&(t=e.src);}catch{}try{let e=await ToneAudioBuffer.load(t),n=new ToneAudioBuffer(e);i.bufferRegistry.set(a,n);}catch(e$1){e.warn(`Failed to load audio buffer for "${a}" (url: "${t}"): ${e$1 instanceof Error?e$1.message:e$1}`),i.bufferRegistry.set(a,new ToneAudioBuffer);}}var b=class extends Player{constructor(e,n,r,o,s={},l){super(s);this.alias=e;this.channelAlias=n;this.soundAlias=r;this.stepCounter=o;this.delay=l;this.options=s,this.playStartTime=now()+(l??0);}alias;channelAlias;soundAlias;stepCounter;delay;options;filters=new Set;pausedAt=void 0;playStartTime=now();get memory(){let e=Math.max(0,this.pausedAt?this.pausedAt-this.playStartTime:now()-this.playStartTime),n=this.paused;return n&&i.systemPausedAliases.has(this.alias)&&(n=false),{...this.options,fadeIn:this.fadeIn,loop:this.loop,loopEnd:this.loopEnd,loopStart:this.loopStart,mute:this.mute,playbackRate:this.playbackRate,reverse:this.reverse,volume:f(this.volume.value),autostart:!this.paused,elapsed:e,paused:n,delay:this.delay}}set memory(e){this.paused=e.paused,this.loop!==(e.loop||false)&&(this.loop=e.loop||false),this.volume.value!==m(e.volume??1)&&(this.volume.value=m(e.volume??1)),this.mute!==(e.mute||false)&&(this.mute=e.mute||false),this.playbackRate!==(e.playbackRate??1)&&(this.playbackRate=e.playbackRate??1),this.reverse!==(e.reverse||false)&&(this.reverse=e.reverse||false),this.fadeIn!==(e.fadeIn||0)&&(this.fadeIn=e.fadeIn||0),this.loopStart!==(e.loopStart||0)&&(this.loopStart=e.loopStart||0),this.loopEnd!==(e.loopEnd||0)&&(this.loopEnd=e.loopEnd||0);}get paused(){return typeof this.pausedAt=="number"}set paused(e){let n=this.state;if(e)this.pausedAt=now(),n==="started"&&super.stop();else {let r,o=false;typeof this.pausedAt=="number"&&(o=true,r=this.pausedAt-this.playStartTime,this.pausedAt=void 0),o&&n==="stopped"&&(this.delay?this.start(`+${this.delay}`,r):this.start(void 0,r));}}get muted(){return this.mute}set muted(e){this.mute=e;}get speed(){return this.playbackRate}set speed(e){this.playbackRate=e;}stop(e){return i.mediaInstances.delete(this.alias),super.stop(e)}start(e,n,r){let o=now(),s=o;if(typeof e=="number")s=e;else if(typeof e=="string"&&e.startsWith("+")){let c=Number(e.slice(1));Number.isNaN(c)||(s=o+c);}let l=typeof n=="number"?n:0;return this.playStartTime=s-l,super.start(e,n,r)}chain(...e){return e.forEach(n=>{H(n)&&(n.toDestination(),this.filters.add(n));}),super.chain(...e)}disconnect(e){return H(e)&&(e.disconnect(),this.filters.delete(e)),super.disconnect(e)}};var v=class{constructor(t,e={}){this.alias=t;this.background=e.background??false,this.toneChannel=new Channel({volume:m(e.volume??1),mute:e.muted??false,pan:e.pan??0}).toDestination(),e.filters&&this.toneChannel.chain(...e.filters);}alias;toneChannel;get volume(){return f(this.toneChannel.volume.value)}set volume(t){this.toneChannel.volume.value=m(t);}get volumeParam(){return this.toneChannel.volume}get pan(){return this.toneChannel.pan.value}set pan(t){this.toneChannel.pan.value=t;}get panParam(){return this.toneChannel.pan}get muted(){return this.toneChannel.mute}set muted(t){this.toneChannel.mute=t;}pauseAll(){for(let t of i.mediaInstances.values())t.channelAlias===this.alias&&!t.paused&&(t.paused=true);return this}resumeAll(){for(let t of i.mediaInstances.values())t.channelAlias===this.alias&&t.paused&&(t.paused=false);return this}chain(...t){return this.toneChannel.chain(...t),this}background;_createPlayer(t,e$1,n={}){let r=i.bufferRegistry.get(e$1);if(!r)throw new PixiError("unregistered_asset",`Sound buffer for alias "${e$1}" is not loaded. Call sound.load() first.`);let{delay:o,elapsed:s,filters:l=[],muted:c,autostart:h=true,speed:d,volume:P,...y}=n;c!==void 0&&(e.warn(`MediaInstance "${t}" is being created with muted=${c}. This will override the channel's muted state (${this.muted}).`),y.mute=c),d!==void 0&&(e.warn(`MediaInstance "${t}" is being created with speed=${d}. This will override the default playback speed of 1.`),y.playbackRate=d);let A=new b(t,this.alias,e$1,GameUnifier.stepCounter,{...y,volume:P!==void 0?m(P):void 0,url:r},o).chain(...l,this.toneChannel),ee=s!==void 0?Math.max(0,s):void 0;return h&&(o?A.start(`+${o}`,ee):A.start(void 0,ee)),A}async play(t,e,n){let r,o;if(typeof e=="string"?(r=t,o=e):(r=t,o=t,n=e),i.mediaInstances.has(r)){let l=i.mediaInstances.get(r);l&&(l.stop(),n={...l.memory,...n,filters:[...l.filters,...n?.filters||[]]});}await T(o);let s=this._createPlayer(r,o,n);return i.mediaInstances.set(r,s),s}toggleMuteAll(){return this.muted=!this.muted,this.muted}get mediaInstances(){return Array.from(i.mediaInstances.values()).reduce((t,e)=>(e.channelAlias===this.alias&&t.push(e),t),[])}stopAll(){let t=[];for(let[e,n]of i.mediaInstances.entries())n.channelAlias===this.alias&&(n.stop(),t.push(e));return t.forEach(e=>{i.mediaInstances.delete(e);}),this}};var F=class{get volumeAll(){return f(p.getDestination().volume.value)}set volumeAll(t){p.getDestination().volume.value=m(t);}get speedAll(){return this._speedAll}set speedAll(t){this._speedAll=t;for(let e of i.mediaInstances.values())e.speed=t;}_speedAll=1;_defaultChannelAlias=i$1;get defaultChannelAlias(){return this._defaultChannelAlias}set defaultChannelAlias(t){this._defaultChannelAlias=t;}add(t,e){if(!i.bufferRegistry.has(t)){let n=new p.ToneAudioBuffer(e);i.bufferRegistry.set(t,n);}}pauseAll(){for(let t of i.mediaInstances.values())t.paused||(t.paused=true);return this}resumeAll(){for(let t of i.mediaInstances.values())t.paused&&(t.paused=false);return this}get muted(){return p.getDestination().mute}toggleMuteAll(){let t=!p.getDestination().mute;return p.getDestination().mute=t,t}muteAll(){return p.getDestination().mute=true,this}unmuteAll(){return p.getDestination().mute=false,this}stopAll(){for(let t of i.mediaInstances.values())t.stop();return i.mediaInstances.clear(),this}pauseUnsavedAll(t){for(let[e,n]of i.mediaInstances.entries())t&&n.channelAlias!==t||n.paused||(n.paused=true,i.systemPausedAliases.add(e));if(!t){for(let e of i.transients)e.stop();i.transients.clear();}return this}resumeUnsavedAll(t){let e=[];for(let n of i.systemPausedAliases){let r=i.mediaInstances.get(n);if(!r){e.push(n);continue}t&&r.channelAlias!==t||(r.paused=false,e.push(n));}for(let n of e)i.systemPausedAliases.delete(n);return this}stopTransientAll(){for(let t of i.transients)t.stop();return i.transients.clear(),this}async play(t,e,n){let r,o;typeof e=="string"?(r=t,o=e):(r=t,o=t,n=e),i.bufferRegistry.has(o)||await this.load(o);let{channel:s=this.defaultChannelAlias,...l}=n??{};return await this.findChannel(s).play(r,o,l)}async playTransient(t,e){i.bufferRegistry.has(t)||await this.load(t);let n=i.bufferRegistry.get(t);if(!n)throw new PixiError("unregistered_asset",`Sound buffer for alias "${t}" is not loaded. Call sound.load() first.`);let{autostart:r=true,...o}=e??{},s=new p.Player({...o,url:n}).toDestination();return r&&s.start(),i.transients.add(s),s.onstop=()=>{s.dispose(),i.transients.delete(s);},s}find(t){return i.mediaInstances.get(t)}stop(t){let e$1=this.find(t);e$1?(e$1.stop(),i.mediaInstances.delete(t)):e.warn(`No media instance found with alias ${t} to stop.`);}pause(t){let e$1=this.find(t);if(!e$1){e.warn(`No media instance found with alias ${t} to pause.`);return}return e$1.paused=true,e$1}resume(t){let e$1=this.find(t);if(!e$1){e.warn(`No media instance found with alias ${t} to resume.`);return}return e$1.paused=false,e$1}duration(t){return i.bufferRegistry.get(t)?.duration??0}async load(...t){let e=t.map(T);await Promise.all(e);}backgroundLoad(...t){return this.load(...t).catch(e$1=>{e.error("Error background-loading sound",e$1);})}backgroundLoadBundle(t){let e$1=se.Assets.backgroundLoadBundle(t);return e$1.then(async()=>{try{let n=await se.Assets.loadBundle(t),r=[];for(let o in n)i.bufferRegistry.has(o)||r.push(this.load(o));await Promise.all(r);}catch(n){e.error("Error loading sound bundle",n);}}).catch(n=>{e.error("Error background-loading sound bundle",n);}),e$1}clear(){this.stopAll();}addChannel(t,e$1={}){if(typeof t!="string"){t.forEach(r=>{let o={...e$1,filters:e$1.filters?[...e$1.filters]:e$1.filters};this.addChannel(r,o);});return}if(i.channels.has(t)){e.warn(`Channel with alias ${t} already exists.`);return}let n=new v(t,e$1);return i.channels.set(t,n),n}findChannel(t){let e=i.channels.get(t);return e||this.addChannel(t)}get channels(){return Array.from(i.channels.values())}export(){let t=Array.from(i.mediaInstances.entries()).reduce((e,[n,r])=>(e[n]={channelAlias:r.channelAlias,soundAlias:r.soundAlias,stepCounter:r.stepCounter,paused:r.paused,options:{...r.memory,filters:oe(r.filters)}},e),{});return {mediaInstances:f$1(t)}}async restore(t){try{if(Object.hasOwn(t,"soundsPlaying")){let e=t.soundsPlaying;if(e){let n=Object.keys(e).map(async r=>{await this.load(r),await this.play(r);});await Promise.all(n);}}if(Object.hasOwn(t,"mediaInstances")){let e$1=t.mediaInstances;if(e$1){let n=new Set,r=Object.values(e$1).map(async({soundAlias:s,channelAlias:l})=>(n.add(l),await this.load(s)));await Promise.all(r),this.channels.forEach(s=>{(!s.background||!n.has(s.alias))&&s.stopAll();});let o=Object.keys(e$1).map(async s=>{let l=e$1[s],c=this.findChannel(l.channelAlias),h=l.options.paused??l.paused??!1;if(c.background)if(l.stepCounter===GameUnifier.stepCounter||!this.find(s)){let d=await c.play(s,l.soundAlias,{...l.options,autostart:!h,filters:w(l.options.filters||[]),delay:l.options.delay});d.paused=h;}else {let d=i.mediaInstances.get(s);if(!d){e.warn(`No media instance found with alias ${s} while restoring background state.`);return}d.memory={...l.options,paused:h},[...d.filters].forEach(y=>{d.disconnect(y),y.dispose();}),d.chain(...w(l.options.filters||[]));}else {let d=await c.play(s,l.soundAlias,{...l.options,autostart:!h,filters:w(l.options.filters||[]),delay:l.options.delay});d.paused=h;}});await Promise.all(o);}}}catch(e$1){e.error("Error importing data",e$1);}}};var K=new F;GameUnifier.addOnPreContinue(async()=>{try{i.channels.forEach(a=>{a.background||a.stopAll();});}catch{}});if(typeof document<"u"){let a=false;document.addEventListener("visibilitychange",()=>{document.hidden?K.muted||(K.muteAll(),a=true):a&&(K.unmuteAll(),a=false);});}export{i as SoundRegistry,K as sound};
|
package/dist/vite.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';var fs=require('fs'),path=require('path'),tinyglobby=require('tinyglobby');var
|
|
2
|
-
`),"utf-8");}function
|
|
1
|
+
'use strict';var fs=require('fs'),path=require('path'),tinyglobby=require('tinyglobby');var X=Object.create;var L=Object.defineProperty;var G=Object.getOwnPropertyDescriptor;var j=Object.getOwnPropertyNames;var H=Object.getPrototypeOf,K=Object.prototype.hasOwnProperty;var z=(n,t)=>()=>(t||n((t={exports:{}}).exports,t),t.exports);var U=(n,t,l,m)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of j(t))!K.call(n,s)&&s!==l&&L(n,s,{get:()=>t[s],enumerable:!(m=G(t,s))||m.enumerable});return n};var Y=(n,t,l)=>(l=n!=null?X(H(n)):{},U(L(l,"default",{value:n,enumerable:true}),n));var T=z((ct,_)=>{var h=process||{},B=h.argv||[],p=h.env||{},W=!(p.NO_COLOR||B.includes("--no-color"))&&(!!p.FORCE_COLOR||B.includes("--color")||h.platform==="win32"||(h.stdout||{}).isTTY&&p.TERM!=="dumb"||!!p.CI),Q=(n,t,l=n)=>m=>{let s=""+m,c=s.indexOf(t,n.length);return ~c?n+Z(s,t,l,c)+t:n+s+t},Z=(n,t,l,m)=>{let s="",c=0;do s+=n.substring(c,m)+l,c=m+t.length,m=n.indexOf(t,c);while(~m);return s+n.substring(c)},F=(n=W)=>{let t=n?Q:()=>String;return {isColorSupported:n,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")}};_.exports=F();_.exports.createColors=F;});var y="/__pixi-vn/characters",I="/__pixi-vn/labels",S="/__pixi-vn/assets/manifest",P="/__pixi-vn/canvas-options";var C=Y(T());var w=C.default.cyan("(pixi-vn)");function A(n){return n?Array.isArray(n)?n:[n]:[]}function st(n){let t=[],l=[];for(let m of n)try{let s=fs.readFileSync(m,"utf-8"),c=/newLabel\(\s*["']([^"']+)["']/g,d;for(;(d=c.exec(s))!==null;)l.push(d[1]);let u=/new\s+\w*[Cc]haracter\(\s*["']([^"']+)["']/g;for(;(d=u.exec(s))!==null;)t.push(d[1]);}catch{}return {charIds:t,labelIds:l}}function at(n){let t,l,m=new Promise(e=>{l=e;}),s=[...A(n?.content),...A(n?.characters),...A(n?.labels)],c=[],d=[],u=new Set,E=[],v=new Map;function O(){if(!n?.typeFilePath||!t)return null;let e=n.typeFilePath;return path.isAbsolute(e)?e:path.resolve(t.root,e)}function D(){let e=[...d,...Array.from(v.values()).flat()];return Array.from(new Set(e))}function $(e,i,a){fs.mkdirSync(path.dirname(e),{recursive:true});let r=["/* eslint-disable */","// noinspection JSUnusedGlobalSymbols","// This file is auto-generated by @drincs/pixi-vn vite plugin. Do not edit manually."];if(i.length>0){r.push('declare module "@drincs/pixi-vn/characters" {'),r.push(" interface PixivnCharacterIds {");for(let o of i)r.push(` ${JSON.stringify(o)}: never;`);r.push(" }"),r.push("}");}if(a.length>0){r.push('declare module "@drincs/pixi-vn/narration" {'),r.push(" interface PixivnLabelIds {");for(let o of a)r.push(` ${JSON.stringify(o)}: never;`);r.push(" }"),r.push("}");}if(r.push(`export const characterIds = ${JSON.stringify(i)} as const;`),i.length>0){let o=Object.fromEntries(i.map(g=>[g,g]));r.push(`export const characterIdsEnum = ${JSON.stringify(o)} as const;`);}if(r.push(`export const labelIds = ${JSON.stringify(a)} as const;`),a.length>0){let o=Object.fromEntries(a.map(g=>[g,g]));r.push(`export const labelIdsEnum = ${JSON.stringify(o)} as const;`);}r.push(""),fs.writeFileSync(e,r.join(`
|
|
2
|
+
`),"utf-8");}function x(){let e=O();if(e)try{$(e,c.map(i=>i.id),D());}catch(i){t?.logger.error(`${w} Failed to write keys file "${e}".`,{error:i instanceof Error?i:new Error(String(i)),timestamp:true});}}async function N(e,i=[]){try{c=(await e("@drincs/pixi-vn/characters")).RegisteredCharacters?.values()??[];}catch{c=[];}try{d=(await e("@drincs/pixi-vn/narration")).RegisteredLabels?.keys()??[];}catch{d=[];}if(i.length>0){let{charIds:r,labelIds:o}=st(i),g=new Set(c.map(b=>b.id)),J=new Set(d);for(let b of r)g.has(b)||c.push({id:b});for(let b of o)J.has(b)||d.push(b);}let a=c.map(r=>r.id).join(", ")||"none";t?.logger.info(`${w} ${C.default.dim(`${c.length} character(s): [${a}], ${d.length} label(s)`)}`,{timestamp:true});}async function R(e,i){try{await e("@drincs/pixi-vn/characters");}catch{}try{await e("@drincs/pixi-vn/narration");}catch{}let a=await tinyglobby.glob(s,{cwd:i,absolute:true,onlyFiles:true}),r=[];for(let o of a){u.add(o);try{await e(o);}catch{r.push(o);}}await N(e,r),x(),l();}async function k(e){for(let r of u)for(let o of e.moduleGraph.getModulesByFile(r)??[])e.moduleGraph.invalidateModule(o);try{(await e.ssrLoadModule("@drincs/pixi-vn/characters")).RegisteredCharacters?.clear?.();}catch{}try{(await e.ssrLoadModule("@drincs/pixi-vn/narration")).RegisteredLabels?.clear?.();}catch{}let i=await tinyglobby.glob(s,{cwd:t.root,absolute:true,onlyFiles:true}),a=[];for(let r of i){u.add(r);try{await e.ssrLoadModule(r);}catch{a.push(r);}}await N(r=>e.ssrLoadModule(r),a),x();for(let r of E)r();}let V={characters:null,labels:null,manifest:null,canvasOptions:null};function f(e,i){return (a,r)=>{if(r.setHeader("Content-Type","application/json"),a.method==="GET"){let o=V[e];if(o===null){r.statusCode=404,r.end(JSON.stringify({error:`${i} not initialized`}));return}r.statusCode=200,r.end(JSON.stringify(o));return}if(a.method==="POST"){let o="";a.on("data",g=>{o+=g.toString();}),a.on("end",()=>{try{V[e]=JSON.parse(o),r.statusCode=201,r.end(JSON.stringify({message:`${i} updated successfully`}));}catch{r.statusCode=400,r.end(JSON.stringify({error:`Invalid JSON format for ${i}`}));}});}}}return {name:"vite-plugin-pixi-vn",enforce:"pre",api:{contentLoaded:m,get characters(){return c},onReload(e){E.push(e);},setExternalLabels(e,i){v.set(e,i),x();},clearExternalLabels(e){v.delete(e),x();}},config(e,i){if(i.command==="serve"&&s.length>0)return {ssr:{noExternal:["@drincs/pixi-vn"]}}},configResolved(e){t=e,s.length===0&&l();},async buildStart(){if(t?.command!=="build"||s.length===0)return;let{createServer:e}=await import('vite'),i=await e({root:t.root,configFile:false,server:{middlewareMode:true},appType:"custom",logLevel:"silent",optimizeDeps:{noDiscovery:true},ssr:{noExternal:["@drincs/pixi-vn"]}});try{await R(a=>i.ssrLoadModule(a),t.root);}catch{l();}finally{await i.close();}},configureServer(e){s.length>0&&R(i=>e.ssrLoadModule(i),t.root).catch(()=>{l();}),e.middlewares.use(y,f("characters","Characters")),e.middlewares.use(I,f("labels","Labels")),e.middlewares.use(S,f("manifest","Manifest")),e.middlewares.use(P,f("canvasOptions","Canvas options"));},hotUpdate({file:e,server:i}){let a=O();if(a&&e===a)return [];if(s.length>0&&u.has(e))return k(i).catch(r=>{t?.logger.error(`${w} Failed to reload content.`,{error:r instanceof Error?r:new Error(String(r)),timestamp:true});}),[]}}}exports.PIXIVN_DEV_API_ASSETS_MANIFEST=S;exports.PIXIVN_DEV_API_CANVAS_OPTIONS=P;exports.PIXIVN_DEV_API_CHARACTERS=y;exports.PIXIVN_DEV_API_LABELS=I;exports.vitePluginPixivn=at;
|
package/dist/vite.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {a as a$1,b,c as c$1,d}from'./chunk-3BBZHKU4.mjs';export{c as PIXIVN_DEV_API_ASSETS_MANIFEST,d as PIXIVN_DEV_API_CANVAS_OPTIONS,a as PIXIVN_DEV_API_CHARACTERS,b as PIXIVN_DEV_API_LABELS}from'./chunk-3BBZHKU4.mjs';import {a,c}from'./chunk-K7JIC2F2.mjs';import {mkdirSync,writeFileSync,readFileSync}from'fs';import {isAbsolute,resolve,dirname}from'path';import {glob}from'tinyglobby';var F=a((
|
|
2
|
-
`),"utf-8");}function
|
|
1
|
+
import {a as a$1,b,c as c$1,d}from'./chunk-3BBZHKU4.mjs';export{c as PIXIVN_DEV_API_ASSETS_MANIFEST,d as PIXIVN_DEV_API_CANVAS_OPTIONS,a as PIXIVN_DEV_API_CHARACTERS,b as PIXIVN_DEV_API_LABELS}from'./chunk-3BBZHKU4.mjs';import {a,c}from'./chunk-K7JIC2F2.mjs';import {mkdirSync,writeFileSync,readFileSync}from'fs';import {isAbsolute,resolve,dirname}from'path';import {glob}from'tinyglobby';var F=a((tt,P)=>{var p=process||{},B=p.argv||[],h=p.env||{},G=!(h.NO_COLOR||B.includes("--no-color"))&&(!!h.FORCE_COLOR||B.includes("--color")||p.platform==="win32"||(p.stdout||{}).isTTY&&h.TERM!=="dumb"||!!h.CI),j=(i,t,c=i)=>d=>{let l=""+d,o=l.indexOf(t,i.length);return ~o?i+H(l,t,c,o)+t:i+l+t},H=(i,t,c,d)=>{let l="",o=0;do l+=i.substring(o,d)+c,o=d+t.length,d=i.indexOf(t,o);while(~d);return l+i.substring(o)},V=(i=G)=>{let t=i?j:()=>String;return {isColorSupported:i,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")}};P.exports=V();P.exports.createColors=V;});var E=c(F(),1);var C=E.default.cyan("(pixi-vn)");function A(i){return i?Array.isArray(i)?i:[i]:[]}function Z(i){let t=[],c=[];for(let d of i)try{let l=readFileSync(d,"utf-8"),o=/newLabel\(\s*["']([^"']+)["']/g,m;for(;(m=o.exec(l))!==null;)c.push(m[1]);let u=/new\s+\w*[Cc]haracter\(\s*["']([^"']+)["']/g;for(;(m=u.exec(l))!==null;)t.push(m[1]);}catch{}return {charIds:t,labelIds:c}}function q(i){let t,c,d$1=new Promise(e=>{c=e;}),l=[...A(i?.content),...A(i?.characters),...A(i?.labels)],o=[],m=[],u=new Set,O=[],y=new Map;function _(){if(!i?.typeFilePath||!t)return null;let e=i.typeFilePath;return isAbsolute(e)?e:resolve(t.root,e)}function $(){let e=[...m,...Array.from(y.values()).flat()];return Array.from(new Set(e))}function T(e,n,s){mkdirSync(dirname(e),{recursive:true});let r=["/* eslint-disable */","// noinspection JSUnusedGlobalSymbols","// This file is auto-generated by @drincs/pixi-vn vite plugin. Do not edit manually."];if(n.length>0){r.push('declare module "@drincs/pixi-vn/characters" {'),r.push(" interface PixivnCharacterIds {");for(let a of n)r.push(` ${JSON.stringify(a)}: never;`);r.push(" }"),r.push("}");}if(s.length>0){r.push('declare module "@drincs/pixi-vn/narration" {'),r.push(" interface PixivnLabelIds {");for(let a of s)r.push(` ${JSON.stringify(a)}: never;`);r.push(" }"),r.push("}");}if(r.push(`export const characterIds = ${JSON.stringify(n)} as const;`),n.length>0){let a=Object.fromEntries(n.map(g=>[g,g]));r.push(`export const characterIdsEnum = ${JSON.stringify(a)} as const;`);}if(r.push(`export const labelIds = ${JSON.stringify(s)} as const;`),s.length>0){let a=Object.fromEntries(s.map(g=>[g,g]));r.push(`export const labelIdsEnum = ${JSON.stringify(a)} as const;`);}r.push(""),writeFileSync(e,r.join(`
|
|
2
|
+
`),"utf-8");}function x(){let e=_();if(e)try{T(e,o.map(n=>n.id),$());}catch(n){t?.logger.error(`${C} Failed to write keys file "${e}".`,{error:n instanceof Error?n:new Error(String(n)),timestamp:true});}}async function R(e,n=[]){try{o=(await e("@drincs/pixi-vn/characters")).RegisteredCharacters?.values()??[];}catch{o=[];}try{m=(await e("@drincs/pixi-vn/narration")).RegisteredLabels?.keys()??[];}catch{m=[];}if(n.length>0){let{charIds:r,labelIds:a}=Z(n),g=new Set(o.map(b=>b.id)),D=new Set(m);for(let b of r)g.has(b)||o.push({id:b});for(let b of a)D.has(b)||m.push(b);}let s=o.map(r=>r.id).join(", ")||"none";t?.logger.info(`${C} ${E.default.dim(`${o.length} character(s): [${s}], ${m.length} label(s)`)}`,{timestamp:true});}async function L(e,n){try{await e("@drincs/pixi-vn/characters");}catch{}try{await e("@drincs/pixi-vn/narration");}catch{}let s=await glob(l,{cwd:n,absolute:true,onlyFiles:true}),r=[];for(let a of s){u.add(a);try{await e(a);}catch{r.push(a);}}await R(e,r),x(),c();}async function k(e){for(let r of u)for(let a of e.moduleGraph.getModulesByFile(r)??[])e.moduleGraph.invalidateModule(a);try{(await e.ssrLoadModule("@drincs/pixi-vn/characters")).RegisteredCharacters?.clear?.();}catch{}try{(await e.ssrLoadModule("@drincs/pixi-vn/narration")).RegisteredLabels?.clear?.();}catch{}let n=await glob(l,{cwd:t.root,absolute:true,onlyFiles:true}),s=[];for(let r of n){u.add(r);try{await e.ssrLoadModule(r);}catch{s.push(r);}}await R(r=>e.ssrLoadModule(r),s),x();for(let r of O)r();}let N={characters:null,labels:null,manifest:null,canvasOptions:null};function f(e,n){return (s,r)=>{if(r.setHeader("Content-Type","application/json"),s.method==="GET"){let a=N[e];if(a===null){r.statusCode=404,r.end(JSON.stringify({error:`${n} not initialized`}));return}r.statusCode=200,r.end(JSON.stringify(a));return}if(s.method==="POST"){let a="";s.on("data",g=>{a+=g.toString();}),s.on("end",()=>{try{N[e]=JSON.parse(a),r.statusCode=201,r.end(JSON.stringify({message:`${n} updated successfully`}));}catch{r.statusCode=400,r.end(JSON.stringify({error:`Invalid JSON format for ${n}`}));}});}}}return {name:"vite-plugin-pixi-vn",enforce:"pre",api:{contentLoaded:d$1,get characters(){return o},onReload(e){O.push(e);},setExternalLabels(e,n){y.set(e,n),x();},clearExternalLabels(e){y.delete(e),x();}},config(e,n){if(n.command==="serve"&&l.length>0)return {ssr:{noExternal:["@drincs/pixi-vn"]}}},configResolved(e){t=e,l.length===0&&c();},async buildStart(){if(t?.command!=="build"||l.length===0)return;let{createServer:e}=await import('vite'),n=await e({root:t.root,configFile:false,server:{middlewareMode:true},appType:"custom",logLevel:"silent",optimizeDeps:{noDiscovery:true},ssr:{noExternal:["@drincs/pixi-vn"]}});try{await L(s=>n.ssrLoadModule(s),t.root);}catch{c();}finally{await n.close();}},configureServer(e){l.length>0&&L(n=>e.ssrLoadModule(n),t.root).catch(()=>{c();}),e.middlewares.use(a$1,f("characters","Characters")),e.middlewares.use(b,f("labels","Labels")),e.middlewares.use(c$1,f("manifest","Manifest")),e.middlewares.use(d,f("canvasOptions","Canvas options"));},hotUpdate({file:e,server:n}){let s=_();if(s&&e===s)return [];if(l.length>0&&u.has(e))return k(n).catch(r=>{t?.logger.error(`${C} Failed to reload content.`,{error:r instanceof Error?r:new Error(String(r)),timestamp:true});}),[]}}}export{q as vitePluginPixivn};
|