@drincs/pixi-vn 1.9.4 → 1.9.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/README.md +186 -170
  2. package/dist/{ContainerMemory-DNqSVzLY.d.cts → ContainerMemory-De04YSUc.d.cts} +2 -1
  3. package/dist/{ContainerMemory-DNqSVzLY.d.ts → ContainerMemory-De04YSUc.d.ts} +2 -1
  4. package/dist/canvas.cjs +2 -2
  5. package/dist/canvas.d.cts +1008 -918
  6. package/dist/canvas.d.ts +1008 -918
  7. package/dist/canvas.mjs +2 -2
  8. package/dist/characters.cjs +1 -1
  9. package/dist/characters.d.cts +3 -2
  10. package/dist/characters.d.ts +3 -2
  11. package/dist/characters.mjs +1 -1
  12. package/dist/{chunk-S7HZUIEI.mjs → chunk-A5FN4SNI.mjs} +1 -1
  13. package/dist/chunk-B46NFIFC.mjs +1 -0
  14. package/dist/chunk-FPMP2OWB.mjs +1 -0
  15. package/dist/{chunk-6OABTG5R.mjs → chunk-OJKUK6GL.mjs} +1 -1
  16. package/dist/{chunk-5MVDNAT4.mjs → chunk-WYGKBGMH.mjs} +1 -1
  17. package/dist/chunk-XLRCR56W.mjs +1 -0
  18. package/dist/core.d.cts +12 -5
  19. package/dist/core.d.ts +12 -5
  20. package/dist/filters.cjs +1 -1
  21. package/dist/filters.d.cts +18 -3
  22. package/dist/filters.d.ts +18 -3
  23. package/dist/filters.mjs +1 -1
  24. package/dist/history.cjs +1 -1
  25. package/dist/history.d.cts +10 -5
  26. package/dist/history.d.ts +10 -5
  27. package/dist/history.mjs +1 -1
  28. package/dist/index.cjs +2 -2
  29. package/dist/index.d.cts +16 -7
  30. package/dist/index.d.ts +16 -7
  31. package/dist/index.mjs +2 -2
  32. package/dist/motion.cjs +1 -1
  33. package/dist/motion.d.cts +8 -2
  34. package/dist/motion.d.ts +8 -2
  35. package/dist/motion.mjs +1 -1
  36. package/dist/narration.cjs +2 -2
  37. package/dist/narration.d.cts +7 -2
  38. package/dist/narration.d.ts +7 -2
  39. package/dist/narration.mjs +1 -1
  40. package/dist/pixi/browser.js +182 -148
  41. package/dist/sound.cjs +1 -1
  42. package/dist/sound.d.cts +3 -2
  43. package/dist/sound.d.ts +3 -2
  44. package/dist/sound.mjs +1 -1
  45. package/dist/storage.cjs +1 -1
  46. package/dist/storage.d.cts +7 -2
  47. package/dist/storage.d.ts +7 -2
  48. package/dist/storage.mjs +1 -1
  49. package/dist/tickers.cjs +1 -1
  50. package/dist/tickers.d.cts +72 -1
  51. package/dist/tickers.d.ts +72 -1
  52. package/dist/tickers.mjs +1 -1
  53. package/dist/vite-listener.mjs +1 -1
  54. package/dist/vite.cjs +1 -1
  55. package/dist/vite.d.cts +2 -1
  56. package/dist/vite.d.ts +2 -1
  57. package/dist/vite.mjs +1 -1
  58. package/dist/worker.cjs +1 -1
  59. package/dist/worker.d.cts +2 -1
  60. package/dist/worker.d.ts +2 -1
  61. package/package.json +11 -10
  62. package/dist/chunk-AW5XWF24.mjs +0 -1
  63. package/dist/chunk-K7JIC2F2.mjs +0 -1
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 P=(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 xe=(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,Ue=typeof process=="object"&&process?process:{},_t=(o,t,e,n)=>{typeof Ue.emitWarning=="function"?Ue.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=Ue.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?De:null:null,De=class extends Array{constructor(o){super(o),this.fill(0);}},te,me,zt=(te=class{heap;length;static create(t){let e=Ct(t);if(!e)return [];c(te,me,true);let n=new te(t,e);return c(te,me,false),n}constructor(t,e){if(!i(te,me))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]}},me=new WeakMap,g(te,me,false),te),St,Ft,j,U,K,he,$,ye,ge,H,C,X,O,A,f,N,q,D,I,Q,E,Z,J,W,V,ee,le,G,ve,h,qe,ue,ie,Fe,Y,Et,de,be,Oe,ae,re,We,Me,ke,T,Ve,Se,oe,Ye,we,It=(we=class{constructor(t){g(this,h);g(this,j);g(this,U);g(this,K);g(this,he);g(this,$);g(this,ye);g(this,ge);g(this,H);P(this,"ttl");P(this,"ttlResolution");P(this,"ttlAutopurge");P(this,"updateAgeOnGet");P(this,"updateAgeOnHas");P(this,"allowStale");P(this,"noDisposeOnSet");P(this,"noUpdateTTL");P(this,"maxEntrySize");P(this,"sizeCalculation");P(this,"noDeleteOnFetchRejection");P(this,"noDeleteOnStaleGet");P(this,"allowStaleOnFetchAbort");P(this,"allowStaleOnFetchRejection");P(this,"ignoreFetchAbort");g(this,C);g(this,X);g(this,O);g(this,A);g(this,f);g(this,N);g(this,q);g(this,D);g(this,I);g(this,Q);g(this,E);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});P(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:x,maxSize:z=0,maxEntrySize:S=0,sizeCalculation:w,fetchMethod:m,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 fe=e?Ct(e):Array;if(!fe)throw new Error("invalid max value: "+e);if(c(this,j,e),c(this,U,z),this.maxEntrySize=S||i(this,U),this.sizeCalculation=w,this.sizeCalculation){if(!i(this,U)&&!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),m!==void 0&&typeof m!="function")throw new TypeError("fetchMethod must be a function if specified");if(c(this,ye,m),c(this,le,!!m),c(this,O,new Map),c(this,A,new Array(e).fill(void 0)),c(this,f,new Array(e).fill(void 0)),c(this,N,new fe(e)),c(this,q,new fe(e)),c(this,D,0),c(this,I,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,E,[])):(c(this,$,void 0),c(this,E,void 0)),c(this,ee,!!i(this,K)),c(this,ve,!!i(this,he)),c(this,G,!!i(this,$)),this.noDisposeOnSet=!!M,this.noUpdateTTL=!!x,this.noDeleteOnFetchRejection=!!L,this.allowStaleOnFetchRejection=!!F,this.allowStaleOnFetchAbort=!!Ae,this.ignoreFetchAbort=!!ce,this.maxEntrySize!==0){if(i(this,U)!==0&&!se(i(this,U)))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,Et).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,qe).call(this);}if(i(this,j)===0&&this.ttl===0&&i(this,U)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!i(this,j)&&!i(this,U)){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,f),next:i(t,N),prev:i(t,q),get head(){return i(t,D)},get tail(){return i(t,I)},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,U)}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,f)[t]!==void 0&&i(this,A)[t]!==void 0&&!d(this,h,T).call(this,i(this,f)[t])&&(yield [i(this,A)[t],i(this,f)[t]]);}*rentries(){for(let t of d(this,h,re).call(this))i(this,f)[t]!==void 0&&i(this,A)[t]!==void 0&&!d(this,h,T).call(this,i(this,f)[t])&&(yield [i(this,A)[t],i(this,f)[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,f)[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,f)[t])&&(yield e);}}*values(){for(let t of d(this,h,ae).call(this))i(this,f)[t]!==void 0&&!d(this,h,T).call(this,i(this,f)[t])&&(yield i(this,f)[t]);}*rvalues(){for(let t of d(this,h,re).call(this))i(this,f)[t]!==void 0&&!d(this,h,T).call(this,i(this,f)[t])&&(yield i(this,f)[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,f)[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,f)[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,f)[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,f)[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,f)[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,x,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,I):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,f)[v]=e,i(this,O).set(t,v),i(this,N)[i(this,I)]=v,i(this,q)[v]=i(this,I),c(this,I,v),xe(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,f)[v];if(e!==w){if(i(this,le)&&d(this,h,T).call(this,w)){w.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:m}=w;m!==void 0&&!a&&(i(this,ee)&&((x=i(this,K))==null||x.call(this,m,t,"set")),i(this,G)&&i(this,E)?.push([m,t,"set"]));}else a||(i(this,ee)&&((z=i(this,K))==null||z.call(this,w,t,"set")),i(this,G)&&i(this,E)?.push([w,t,"set"]));if(i(this,de).call(this,v),i(this,be).call(this,v,b,u),i(this,f)[v]=e,u){u.set="replace";let m=w&&d(this,h,T).call(this,w)?w.__staleWhileFetching:w;m!==void 0&&(u.oldValue=m);}}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,qe).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,E)){let w=i(this,E),m;for(;m=w?.shift();)(S=i(this,$))==null||S.call(this,...m);}return this}pop(){var t;try{for(;i(this,C);){let e=i(this,f)[i(this,D)];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,E)){let e=i(this,E),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,f)[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,f)[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:x=this.ignoreFetchAbort,allowStaleOnFetchAbort:z=this.allowStaleOnFetchAbort,context:S,forceRefresh:w=false,status:m,signal:k}=e;if(!i(this,le))return m&&(m.fetch="get"),this.get(t,{allowStale:n,updateAgeOnGet:s,noDeleteOnStaleGet:r,status:m});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:x,status:m,signal:k},R=i(this,O).get(t);if(R===void 0){m&&(m.fetch="miss");let F=d(this,h,ke).call(this,t,R,L,S);return F.__returned=F}else {let F=i(this,f)[R];if(d(this,h,T).call(this,F)){let fe=n&&F.__staleWhileFetching!==void 0;return m&&(m.fetch="inflight",fe&&(m.returnedStale=true)),fe?F.__staleWhileFetching:F.__returned=F}let Ae=i(this,Y).call(this,R);if(!w&&!Ae)return m&&(m.fetch="hit"),d(this,h,Se).call(this,R),s&&i(this,ue).call(this,R),m&&i(this,ie).call(this,m,R),F;let ce=d(this,h,ke).call(this,t,R,L,S),pe=ce.__staleWhileFetching!==void 0&&n;return m&&(m.fetch=Ae?"stale":"refresh",pe&&Ae&&(m.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,f)[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,U=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,f=new WeakMap,N=new WeakMap,q=new WeakMap,D=new WeakMap,I=new WeakMap,Q=new WeakMap,E=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,qe=function(){let t=new De(i(this,j)),e=new De(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,Et=function(){let t=new De(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,U)){let r=i(this,U)-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,I);!(!d(this,h,We).call(this,e)||((t||!i(this,Y).call(this,e))&&(yield e),e===i(this,D)));)e=i(this,q)[e];},re=function*({allowStale:t=this.allowStale}={}){if(i(this,C))for(let e=i(this,D);!(!d(this,h,We).call(this,e)||((t||!i(this,Y).call(this,e))&&(yield e),e===i(this,I)));)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,D),n=i(this,A)[e],s=i(this,f)[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,E)?.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,f)[e]=void 0,i(this,Q).push(e)),i(this,C)===1?(c(this,D,c(this,I,0)),i(this,Q).length=0):c(this,D,i(this,N)[e]),i(this,O).delete(n),xe(this,C)._--,e},ke=function(t,e,n,s){let r=e===void 0?void 0:i(this,f)[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:m}=a.signal,k=n.ignoreFetchAbort&&S!==void 0,L=n.ignoreFetchAbort||!!(n.allowStaleOnFetchAbort&&S!==void 0);if(n.status&&(m&&!w?(n.status.fetchAborted=true,n.status.fetchError=a.signal.reason,k&&(n.status.fetchAbortIgnored=true)):n.status.fetchResolved=true),m&&!k&&!w)return v(a.signal.reason,L);let R=x,F=i(this,f)[e];return (F===x||k&&w&&F===void 0)&&(S===void 0?R.__staleWhileFetching!==void 0?i(this,f)[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:m}=a.signal,k=m&&n.allowStaleOnFetchAbort,L=k||n.allowStaleOnFetchRejection,R=L||n.noDeleteOnFetchRejection,F=x;if(i(this,f)[e]===x&&(!R||!w&&F.__staleWhileFetching===void 0?d(this,h,oe).call(this,t,"fetch"):k||(i(this,f)[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 m=(k=i(this,ye))==null?void 0:k.call(this,t,r,u);m&&m instanceof Promise&&m.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 x=new Promise(M).then(y,b),z=Object.assign(x,{__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,f)[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,q)[e]=t,i(this,N)[t]=e;},Se=function(t){t!==i(this,I)&&(t===i(this,D)?c(this,D,i(this,N)[t]):d(this,h,Ve).call(this,i(this,q)[t],i(this,N)[t]),d(this,h,Ve).call(this,i(this,I),t),c(this,I,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,f)[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,E)?.push([l,t,e])),i(this,O).delete(t),i(this,A)[a]=void 0,i(this,f)[a]=void 0,a===i(this,I))c(this,I,i(this,q)[a]);else if(a===i(this,D))c(this,D,i(this,N)[a]);else {let u=i(this,q)[a];i(this,N)[u]=i(this,N)[a];let y=i(this,N)[a];i(this,q)[y]=i(this,q)[a];}xe(this,C)._--,i(this,Q).push(a);}}if(i(this,G)&&i(this,E)?.length){let a=i(this,E),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,f)[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,E)?.push([r,a,t]);}}if(i(this,O).clear(),i(this,f).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,D,0),c(this,I,0),i(this,Q).length=0,c(this,X,0),c(this,C,0),i(this,G)&&i(this,E)){let s=i(this,E),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 It({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 Pt;(r=>(r.mediaInstances=new Map,r.channels=new Map,r.transients=new Set,r.systemPausedAliases=new Set,r.bufferRegistry=new _e({cacheSize:10})))(Pt||={});var p=Pt;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 Dt(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 Ie=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 Ee=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 x=new Ie(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?x.start(`+${r}`,z):x.start(void 0,z)),x}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 Pe=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}pauseUnsavedAllInternal(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();}}resumeUnsavedAllInternal(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);}stopTransientAllInternal(){for(let t of p.transients)t.stop();p.transients.clear();}async playTransientInternal(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}unsaved={playTransient:(t,e)=>this.playTransientInternal(t,e),pauseAll:t=>(this.pauseUnsavedAllInternal(t),this.unsaved),resumeAll:t=>(this.resumeUnsavedAllInternal(t),this.unsaved),stopTransientAll:()=>(this.stopTransientAllInternal(),this.unsaved)};pauseUnsavedAll(t){return this.pauseUnsavedAllInternal(t),this}resumeUnsavedAll(t){return this.resumeUnsavedAllInternal(t),this}stopTransientAll(){return this.stopTransientAllInternal(),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.findChannelInternal(a).play(s,r,l)}async playTransient(t,e){return this.playTransientInternal(t,e)}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();}addChannelInternal(t,e={}){if(typeof t!="string"){t.forEach(s=>{let r={...e,filters:e.filters?[...e.filters]:e.filters};this.addChannelInternal(s,r);});return}if(p.channels.has(t)){_.warn(`Channel with alias ${t} already exists.`);return}let n=new Ee(t,e);return p.channels.set(t,n),n}findChannelInternal(t){let e=p.channels.get(t);return e||this.addChannelInternal(t)}channels={add:(t,e)=>this.addChannelInternal(t,e),find:t=>this.findChannelInternal(t),get values(){return Array.from(p.channels.values())}};addChannel(t,e={}){return this.channels.add(t,e)}findChannel(t){return this.channels.find(t)}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:Dt(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.values.forEach(a=>{(!a.background||!n.has(a.alias))&&a.stopAll();});let r=Object.keys(e).map(async a=>{let l=e[a],u=this.findChannelInternal(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 Pe;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'),xt=require('@drincs/pixi-vn/pixi.js'),Y=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 xt__default=/*#__PURE__*/_interopDefault(xt);var Y__namespace=/*#__PURE__*/_interopNamespace(Y);var Mt=Object.defineProperty;var wt=o=>{throw TypeError(o)};var kt=(o,t,e)=>t in o?Mt(o,t,{enumerable:true,configurable:true,writable:true,value:e}):o[t]=e;var E=(o,t,e)=>kt(o,typeof t!="symbol"?t+"":t,e),Re=(o,t,e)=>t.has(o)||wt("Cannot "+e);var i=(o,t,e)=>(Re(o,t,"read from private field"),e?e.call(o):t.get(o)),m=(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),p=(o,t,e,n)=>(Re(o,t,"write to private field"),t.set(o,e),e),u=(o,t,e)=>(Re(o,t,"access private method"),e);var Ce=(o,t,e,n)=>({set _(s){p(o,t,s);},get _(){return i(o,t,n)}});var vt="general";var ue=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,Ft=new Set,Ne=typeof process=="object"&&process?process:{},_t=(o,t,e,n)=>{typeof Ne.emitWarning=="function"?Ne.emitWarning(o,t,e,n):console.error(`[${e}] ${t}: ${o}`);},Ee=globalThis.AbortController,Tt=globalThis.AbortSignal;if(typeof Ee>"u"){Tt=class{onabort;_onabort=[];reason;aborted=false;addEventListener(n,s){this._onabort.push(s);}},Ee=class{constructor(){t();}signal=new Tt;abort(n){if(!this.signal.aborted){this.signal.reason=n,this.signal.aborted=true;for(let s of this.signal._onabort)s(n);this.signal.onabort?.(n);}}};let o=Ne.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 Rt=o=>!Ft.has(o);var ie=o=>o&&o===Math.floor(o)&&o>0&&isFinite(o),Ot=o=>ie(o)?o<=Math.pow(2,8)?Uint8Array:o<=Math.pow(2,16)?Uint16Array:o<=Math.pow(2,32)?Uint32Array:o<=Number.MAX_SAFE_INTEGER?de:null:null,de=class extends Array{constructor(t){super(t),this.fill(0);}},ce,oe=class oe{heap;length;static create(t){let e=Ot(t);if(!e)return [];p(oe,ce,true);let n=new oe(t,e);return p(oe,ce,false),n}constructor(t,e){if(!i(oe,ce))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]}};ce=new WeakMap,m(oe,ce,false);var Ge=oe,At,St,B,L,K,$,pe,fe,O,j,F,T,f,k,z,x,C,X,I,H,Q,q,Z,re,R,l,Le,le,J,we,U,Ct,he,me,ve,ne,se,ze,Ie,Pe,v,qe,be,ae,Ue,We=class We{constructor(t){m(this,l);m(this,B);m(this,L);m(this,K);m(this,$);m(this,pe);m(this,fe);E(this,"ttl");E(this,"ttlResolution");E(this,"ttlAutopurge");E(this,"updateAgeOnGet");E(this,"updateAgeOnHas");E(this,"allowStale");E(this,"noDisposeOnSet");E(this,"noUpdateTTL");E(this,"maxEntrySize");E(this,"sizeCalculation");E(this,"noDeleteOnFetchRejection");E(this,"noDeleteOnStaleGet");E(this,"allowStaleOnFetchAbort");E(this,"allowStaleOnFetchRejection");E(this,"ignoreFetchAbort");m(this,O);m(this,j);m(this,F);m(this,T);m(this,f);m(this,k);m(this,z);m(this,x);m(this,C);m(this,X);m(this,I);m(this,H);m(this,Q);m(this,q);m(this,Z);m(this,re);m(this,R);m(this,le,()=>{});m(this,J,()=>{});m(this,we,()=>{});m(this,U,()=>false);m(this,he,t=>{});m(this,me,(t,e,n)=>{});m(this,ve,(t,e,n,s)=>{if(n||s)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});E(this,At,"LRUCache");let{max:e=0,ttl:n,ttlResolution:s=1,ttlAutopurge:a,updateAgeOnGet:r,updateAgeOnHas:h,allowStale:d,dispose:b,disposeAfter:A,noDisposeOnSet:w,noUpdateTTL:M,maxSize:D=0,maxEntrySize:G=0,sizeCalculation:y,fetchMethod:S,memoMethod:g,noDeleteOnFetchRejection:W,noDeleteOnStaleGet:N,allowStaleOnFetchRejection:P,allowStaleOnFetchAbort:V,ignoreFetchAbort:ge}=t;if(e!==0&&!ie(e))throw new TypeError("max option must be a nonnegative integer");let te=e?Ot(e):Array;if(!te)throw new Error("invalid max value: "+e);if(p(this,B,e),p(this,L,D),this.maxEntrySize=G||i(this,L),this.sizeCalculation=y,this.sizeCalculation){if(!i(this,L)&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(g!==void 0&&typeof g!="function")throw new TypeError("memoMethod must be a function if defined");if(p(this,fe,g),S!==void 0&&typeof S!="function")throw new TypeError("fetchMethod must be a function if specified");if(p(this,pe,S),p(this,re,!!S),p(this,F,new Map),p(this,T,new Array(e).fill(void 0)),p(this,f,new Array(e).fill(void 0)),p(this,k,new te(e)),p(this,z,new te(e)),p(this,x,0),p(this,C,0),p(this,X,Ge.create(e)),p(this,O,0),p(this,j,0),typeof b=="function"&&p(this,K,b),typeof A=="function"?(p(this,$,A),p(this,I,[])):(p(this,$,void 0),p(this,I,void 0)),p(this,Z,!!i(this,K)),p(this,R,!!i(this,$)),this.noDisposeOnSet=!!w,this.noUpdateTTL=!!M,this.noDeleteOnFetchRejection=!!W,this.allowStaleOnFetchRejection=!!P,this.allowStaleOnFetchAbort=!!V,this.ignoreFetchAbort=!!ge,this.maxEntrySize!==0){if(i(this,L)!==0&&!ie(i(this,L)))throw new TypeError("maxSize must be a positive integer if specified");if(!ie(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");u(this,l,Ct).call(this);}if(this.allowStale=!!d,this.noDeleteOnStaleGet=!!N,this.updateAgeOnGet=!!r,this.updateAgeOnHas=!!h,this.ttlResolution=ie(s)||s===0?s:1,this.ttlAutopurge=!!a,this.ttl=n||0,this.ttl){if(!ie(this.ttl))throw new TypeError("ttl must be a positive integer if specified");u(this,l,Le).call(this);}if(i(this,B)===0&&this.ttl===0&&i(this,L)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!i(this,B)&&!i(this,L)){let Oe="LRU_CACHE_UNBOUNDED";Rt(Oe)&&(Ft.add(Oe),_t("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",Oe,We));}}static unsafeExposeInternals(t){return {starts:i(t,Q),ttls:i(t,q),sizes:i(t,H),keyMap:i(t,F),keyList:i(t,T),valList:i(t,f),next:i(t,k),prev:i(t,z),get head(){return i(t,x)},get tail(){return i(t,C)},free:i(t,X),isBackgroundFetch:e=>{var n;return u(n=t,l,v).call(n,e)},backgroundFetch:(e,n,s,a)=>{var r;return u(r=t,l,Pe).call(r,e,n,s,a)},moveToTail:e=>{var n;return u(n=t,l,be).call(n,e)},indexes:e=>{var n;return u(n=t,l,ne).call(n,e)},rindexes:e=>{var n;return u(n=t,l,se).call(n,e)},isStale:e=>{var n;return i(n=t,U).call(n,e)}}}get max(){return i(this,B)}get maxSize(){return i(this,L)}get calculatedSize(){return i(this,j)}get size(){return i(this,O)}get fetchMethod(){return i(this,pe)}get memoMethod(){return i(this,fe)}get dispose(){return i(this,K)}get disposeAfter(){return i(this,$)}getRemainingTTL(t){return i(this,F).has(t)?1/0:0}*entries(){for(let t of u(this,l,ne).call(this))i(this,f)[t]!==void 0&&i(this,T)[t]!==void 0&&!u(this,l,v).call(this,i(this,f)[t])&&(yield [i(this,T)[t],i(this,f)[t]]);}*rentries(){for(let t of u(this,l,se).call(this))i(this,f)[t]!==void 0&&i(this,T)[t]!==void 0&&!u(this,l,v).call(this,i(this,f)[t])&&(yield [i(this,T)[t],i(this,f)[t]]);}*keys(){for(let t of u(this,l,ne).call(this)){let e=i(this,T)[t];e!==void 0&&!u(this,l,v).call(this,i(this,f)[t])&&(yield e);}}*rkeys(){for(let t of u(this,l,se).call(this)){let e=i(this,T)[t];e!==void 0&&!u(this,l,v).call(this,i(this,f)[t])&&(yield e);}}*values(){for(let t of u(this,l,ne).call(this))i(this,f)[t]!==void 0&&!u(this,l,v).call(this,i(this,f)[t])&&(yield i(this,f)[t]);}*rvalues(){for(let t of u(this,l,se).call(this))i(this,f)[t]!==void 0&&!u(this,l,v).call(this,i(this,f)[t])&&(yield i(this,f)[t]);}[(St=Symbol.iterator,At=Symbol.toStringTag,St)](){return this.entries()}find(t,e={}){for(let n of u(this,l,ne).call(this)){let s=i(this,f)[n],a=u(this,l,v).call(this,s)?s.__staleWhileFetching:s;if(a!==void 0&&t(a,i(this,T)[n],this))return this.get(i(this,T)[n],e)}}forEach(t,e=this){for(let n of u(this,l,ne).call(this)){let s=i(this,f)[n],a=u(this,l,v).call(this,s)?s.__staleWhileFetching:s;a!==void 0&&t.call(e,a,i(this,T)[n],this);}}rforEach(t,e=this){for(let n of u(this,l,se).call(this)){let s=i(this,f)[n],a=u(this,l,v).call(this,s)?s.__staleWhileFetching:s;a!==void 0&&t.call(e,a,i(this,T)[n],this);}}purgeStale(){let t=false;for(let e of u(this,l,se).call(this,{allowStale:true}))i(this,U).call(this,e)&&(u(this,l,ae).call(this,i(this,T)[e],"expire"),t=true);return t}info(t){let e=i(this,F).get(t);if(e===void 0)return;let n=i(this,f)[e],s=u(this,l,v).call(this,n)?n.__staleWhileFetching:n;if(s===void 0)return;let a={value:s};if(i(this,q)&&i(this,Q)){let r=i(this,q)[e],h=i(this,Q)[e];if(r&&h){let d=r-(ue.now()-h);a.ttl=d,a.start=Date.now();}}return i(this,H)&&(a.size=i(this,H)[e]),a}dump(){let t=[];for(let e of u(this,l,ne).call(this,{allowStale:true})){let n=i(this,T)[e],s=i(this,f)[e],a=u(this,l,v).call(this,s)?s.__staleWhileFetching:s;if(a===void 0||n===void 0)continue;let r={value:a};if(i(this,q)&&i(this,Q)){r.ttl=i(this,q)[e];let h=ue.now()-i(this,Q)[e];r.start=Math.floor(Date.now()-h);}i(this,H)&&(r.size=i(this,H)[e]),t.unshift([n,r]);}return t}load(t){this.clear();for(let[e,n]of t){if(n.start){let s=Date.now()-n.start;n.start=ue.now()-s;}this.set(e,n.value,n);}}set(t,e,n={}){var M,D,G;if(e===void 0)return this.delete(t),this;let{ttl:s=this.ttl,start:a,noDisposeOnSet:r=this.noDisposeOnSet,sizeCalculation:h=this.sizeCalculation,status:d}=n,{noUpdateTTL:b=this.noUpdateTTL}=n,A=i(this,ve).call(this,t,e,n.size||0,h);if(this.maxEntrySize&&A>this.maxEntrySize)return d&&(d.set="miss",d.maxEntrySizeExceeded=true),u(this,l,ae).call(this,t,"set"),this;let w=i(this,O)===0?void 0:i(this,F).get(t);if(w===void 0)w=i(this,O)===0?i(this,C):i(this,X).length!==0?i(this,X).pop():i(this,O)===i(this,B)?u(this,l,Ie).call(this,false):i(this,O),i(this,T)[w]=t,i(this,f)[w]=e,i(this,F).set(t,w),i(this,k)[i(this,C)]=w,i(this,z)[w]=i(this,C),p(this,C,w),Ce(this,O)._++,i(this,me).call(this,w,A,d),d&&(d.set="add"),b=false;else {u(this,l,be).call(this,w);let y=i(this,f)[w];if(e!==y){if(i(this,re)&&u(this,l,v).call(this,y)){y.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:S}=y;S!==void 0&&!r&&(i(this,Z)&&((M=i(this,K))==null||M.call(this,S,t,"set")),i(this,R)&&i(this,I)?.push([S,t,"set"]));}else r||(i(this,Z)&&((D=i(this,K))==null||D.call(this,y,t,"set")),i(this,R)&&i(this,I)?.push([y,t,"set"]));if(i(this,he).call(this,w),i(this,me).call(this,w,A,d),i(this,f)[w]=e,d){d.set="replace";let S=y&&u(this,l,v).call(this,y)?y.__staleWhileFetching:y;S!==void 0&&(d.oldValue=S);}}else d&&(d.set="update");}if(s!==0&&!i(this,q)&&u(this,l,Le).call(this),i(this,q)&&(b||i(this,we).call(this,w,s,a),d&&i(this,J).call(this,d,w)),!r&&i(this,R)&&i(this,I)){let y=i(this,I),S;for(;S=y?.shift();)(G=i(this,$))==null||G.call(this,...S);}return this}pop(){var t;try{for(;i(this,O);){let e=i(this,f)[i(this,x)];if(u(this,l,Ie).call(this,!0),u(this,l,v).call(this,e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(i(this,R)&&i(this,I)){let e=i(this,I),n;for(;n=e?.shift();)(t=i(this,$))==null||t.call(this,...n);}}}has(t,e={}){let{updateAgeOnHas:n=this.updateAgeOnHas,status:s}=e,a=i(this,F).get(t);if(a!==void 0){let r=i(this,f)[a];if(u(this,l,v).call(this,r)&&r.__staleWhileFetching===void 0)return false;if(i(this,U).call(this,a))s&&(s.has="stale",i(this,J).call(this,s,a));else return n&&i(this,le).call(this,a),s&&(s.has="hit",i(this,J).call(this,s,a)),true}else s&&(s.has="miss");return false}peek(t,e={}){let{allowStale:n=this.allowStale}=e,s=i(this,F).get(t);if(s===void 0||!n&&i(this,U).call(this,s))return;let a=i(this,f)[s];return u(this,l,v).call(this,a)?a.__staleWhileFetching:a}async fetch(t,e={}){let{allowStale:n=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:a=this.noDeleteOnStaleGet,ttl:r=this.ttl,noDisposeOnSet:h=this.noDisposeOnSet,size:d=0,sizeCalculation:b=this.sizeCalculation,noUpdateTTL:A=this.noUpdateTTL,noDeleteOnFetchRejection:w=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:M=this.allowStaleOnFetchRejection,ignoreFetchAbort:D=this.ignoreFetchAbort,allowStaleOnFetchAbort:G=this.allowStaleOnFetchAbort,context:y,forceRefresh:S=false,status:g,signal:W}=e;if(!i(this,re))return g&&(g.fetch="get"),this.get(t,{allowStale:n,updateAgeOnGet:s,noDeleteOnStaleGet:a,status:g});let N={allowStale:n,updateAgeOnGet:s,noDeleteOnStaleGet:a,ttl:r,noDisposeOnSet:h,size:d,sizeCalculation:b,noUpdateTTL:A,noDeleteOnFetchRejection:w,allowStaleOnFetchRejection:M,allowStaleOnFetchAbort:G,ignoreFetchAbort:D,status:g,signal:W},P=i(this,F).get(t);if(P===void 0){g&&(g.fetch="miss");let V=u(this,l,Pe).call(this,t,P,N,y);return V.__returned=V}else {let V=i(this,f)[P];if(u(this,l,v).call(this,V)){let bt=n&&V.__staleWhileFetching!==void 0;return g&&(g.fetch="inflight",bt&&(g.returnedStale=true)),bt?V.__staleWhileFetching:V.__returned=V}let ge=i(this,U).call(this,P);if(!S&&!ge)return g&&(g.fetch="hit"),u(this,l,be).call(this,P),s&&i(this,le).call(this,P),g&&i(this,J).call(this,g,P),V;let te=u(this,l,Pe).call(this,t,P,N,y),ke=te.__staleWhileFetching!==void 0&&n;return g&&(g.fetch=ge?"stale":"refresh",ke&&ge&&(g.returnedStale=true)),ke?te.__staleWhileFetching:te.__returned=te}}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,fe);if(!n)throw new Error("no memoMethod provided to constructor");let{context:s,forceRefresh:a,...r}=e,h=this.get(t,r);if(!a&&h!==void 0)return h;let d=n(t,h,{options:r,context:s});return this.set(t,d,r),d}get(t,e={}){let{allowStale:n=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:a=this.noDeleteOnStaleGet,status:r}=e,h=i(this,F).get(t);if(h!==void 0){let d=i(this,f)[h],b=u(this,l,v).call(this,d);return r&&i(this,J).call(this,r,h),i(this,U).call(this,h)?(r&&(r.get="stale"),b?(r&&n&&d.__staleWhileFetching!==void 0&&(r.returnedStale=true),n?d.__staleWhileFetching:void 0):(a||u(this,l,ae).call(this,t,"expire"),r&&n&&(r.returnedStale=true),n?d:void 0)):(r&&(r.get="hit"),b?d.__staleWhileFetching:(u(this,l,be).call(this,h),s&&i(this,le).call(this,h),d))}else r&&(r.get="miss");}delete(t){return u(this,l,ae).call(this,t,"delete")}clear(){return u(this,l,Ue).call(this,"delete")}};B=new WeakMap,L=new WeakMap,K=new WeakMap,$=new WeakMap,pe=new WeakMap,fe=new WeakMap,O=new WeakMap,j=new WeakMap,F=new WeakMap,T=new WeakMap,f=new WeakMap,k=new WeakMap,z=new WeakMap,x=new WeakMap,C=new WeakMap,X=new WeakMap,I=new WeakMap,H=new WeakMap,Q=new WeakMap,q=new WeakMap,Z=new WeakMap,re=new WeakMap,R=new WeakMap,l=new WeakSet,Le=function(){let t=new de(i(this,B)),e=new de(i(this,B));p(this,q,t),p(this,Q,e),p(this,we,(a,r,h=ue.now())=>{if(e[a]=r!==0?h:0,t[a]=r,r!==0&&this.ttlAutopurge){let d=setTimeout(()=>{i(this,U).call(this,a)&&u(this,l,ae).call(this,i(this,T)[a],"expire");},r+1);d.unref&&d.unref();}}),p(this,le,a=>{e[a]=t[a]!==0?ue.now():0;}),p(this,J,(a,r)=>{if(t[r]){let h=t[r],d=e[r];if(!h||!d)return;a.ttl=h,a.start=d,a.now=n||s();let b=a.now-d;a.remainingTTL=h-b;}});let n=0,s=()=>{let a=ue.now();if(this.ttlResolution>0){n=a;let r=setTimeout(()=>n=0,this.ttlResolution);r.unref&&r.unref();}return a};this.getRemainingTTL=a=>{let r=i(this,F).get(a);if(r===void 0)return 0;let h=t[r],d=e[r];if(!h||!d)return 1/0;let b=(n||s())-d;return h-b},p(this,U,a=>{let r=e[a],h=t[a];return !!h&&!!r&&(n||s())-r>h});},le=new WeakMap,J=new WeakMap,we=new WeakMap,U=new WeakMap,Ct=function(){let t=new de(i(this,B));p(this,j,0),p(this,H,t),p(this,he,e=>{p(this,j,i(this,j)-t[e]),t[e]=0;}),p(this,ve,(e,n,s,a)=>{if(u(this,l,v).call(this,n))return 0;if(!ie(s))if(a){if(typeof a!="function")throw new TypeError("sizeCalculation must be a function");if(s=a(n,e),!ie(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}),p(this,me,(e,n,s)=>{if(t[e]=n,i(this,L)){let a=i(this,L)-t[e];for(;i(this,j)>a;)u(this,l,Ie).call(this,true);}p(this,j,i(this,j)+t[e]),s&&(s.entrySize=n,s.totalCalculatedSize=i(this,j));});},he=new WeakMap,me=new WeakMap,ve=new WeakMap,ne=function*({allowStale:t=this.allowStale}={}){if(i(this,O))for(let e=i(this,C);!(!u(this,l,ze).call(this,e)||((t||!i(this,U).call(this,e))&&(yield e),e===i(this,x)));)e=i(this,z)[e];},se=function*({allowStale:t=this.allowStale}={}){if(i(this,O))for(let e=i(this,x);!(!u(this,l,ze).call(this,e)||((t||!i(this,U).call(this,e))&&(yield e),e===i(this,C)));)e=i(this,k)[e];},ze=function(t){return t!==void 0&&i(this,F).get(i(this,T)[t])===t},Ie=function(t){var a;let e=i(this,x),n=i(this,T)[e],s=i(this,f)[e];return i(this,re)&&u(this,l,v).call(this,s)?s.__abortController.abort(new Error("evicted")):(i(this,Z)||i(this,R))&&(i(this,Z)&&((a=i(this,K))==null||a.call(this,s,n,"evict")),i(this,R)&&i(this,I)?.push([s,n,"evict"])),i(this,he).call(this,e),t&&(i(this,T)[e]=void 0,i(this,f)[e]=void 0,i(this,X).push(e)),i(this,O)===1?(p(this,x,p(this,C,0)),i(this,X).length=0):p(this,x,i(this,k)[e]),i(this,F).delete(n),Ce(this,O)._--,e},Pe=function(t,e,n,s){let a=e===void 0?void 0:i(this,f)[e];if(u(this,l,v).call(this,a))return a;let r=new Ee,{signal:h}=n;h?.addEventListener("abort",()=>r.abort(h.reason),{signal:r.signal});let d={signal:r.signal,options:n,context:s},b=(y,S=false)=>{let{aborted:g}=r.signal,W=n.ignoreFetchAbort&&y!==void 0;if(n.status&&(g&&!S?(n.status.fetchAborted=true,n.status.fetchError=r.signal.reason,W&&(n.status.fetchAbortIgnored=true)):n.status.fetchResolved=true),g&&!W&&!S)return w(r.signal.reason);let N=D;return i(this,f)[e]===D&&(y===void 0?N.__staleWhileFetching?i(this,f)[e]=N.__staleWhileFetching:u(this,l,ae).call(this,t,"fetch"):(n.status&&(n.status.fetchUpdated=true),this.set(t,y,d.options))),y},A=y=>(n.status&&(n.status.fetchRejected=true,n.status.fetchError=y),w(y)),w=y=>{let{aborted:S}=r.signal,g=S&&n.allowStaleOnFetchAbort,W=g||n.allowStaleOnFetchRejection,N=W||n.noDeleteOnFetchRejection,P=D;if(i(this,f)[e]===D&&(!N||P.__staleWhileFetching===void 0?u(this,l,ae).call(this,t,"fetch"):g||(i(this,f)[e]=P.__staleWhileFetching)),W)return n.status&&P.__staleWhileFetching!==void 0&&(n.status.returnedStale=true),P.__staleWhileFetching;if(P.__returned===P)throw y},M=(y,S)=>{var W;let g=(W=i(this,pe))==null?void 0:W.call(this,t,a,d);g&&g instanceof Promise&&g.then(N=>y(N===void 0?void 0:N),S),r.signal.addEventListener("abort",()=>{(!n.ignoreFetchAbort||n.allowStaleOnFetchAbort)&&(y(void 0),n.allowStaleOnFetchAbort&&(y=N=>b(N,true)));});};n.status&&(n.status.fetchDispatched=true);let D=new Promise(M).then(b,A),G=Object.assign(D,{__abortController:r,__staleWhileFetching:a,__returned:void 0});return e===void 0?(this.set(t,G,{...d.options,status:void 0}),e=i(this,F).get(t)):i(this,f)[e]=G,G},v=function(t){if(!i(this,re))return false;let e=t;return !!e&&e instanceof Promise&&e.hasOwnProperty("__staleWhileFetching")&&e.__abortController instanceof Ee},qe=function(t,e){i(this,z)[e]=t,i(this,k)[t]=e;},be=function(t){t!==i(this,C)&&(t===i(this,x)?p(this,x,i(this,k)[t]):u(this,l,qe).call(this,i(this,z)[t],i(this,k)[t]),u(this,l,qe).call(this,i(this,C),t),p(this,C,t));},ae=function(t,e){var s,a;let n=false;if(i(this,O)!==0){let r=i(this,F).get(t);if(r!==void 0)if(n=true,i(this,O)===1)u(this,l,Ue).call(this,e);else {i(this,he).call(this,r);let h=i(this,f)[r];if(u(this,l,v).call(this,h)?h.__abortController.abort(new Error("deleted")):(i(this,Z)||i(this,R))&&(i(this,Z)&&((s=i(this,K))==null||s.call(this,h,t,e)),i(this,R)&&i(this,I)?.push([h,t,e])),i(this,F).delete(t),i(this,T)[r]=void 0,i(this,f)[r]=void 0,r===i(this,C))p(this,C,i(this,z)[r]);else if(r===i(this,x))p(this,x,i(this,k)[r]);else {let d=i(this,z)[r];i(this,k)[d]=i(this,k)[r];let b=i(this,k)[r];i(this,z)[b]=i(this,z)[r];}Ce(this,O)._--,i(this,X).push(r);}}if(i(this,R)&&i(this,I)?.length){let r=i(this,I),h;for(;h=r?.shift();)(a=i(this,$))==null||a.call(this,...h);}return n},Ue=function(t){var e,n;for(let s of u(this,l,se).call(this,{allowStale:true})){let a=i(this,f)[s];if(u(this,l,v).call(this,a))a.__abortController.abort(new Error("deleted"));else {let r=i(this,T)[s];i(this,Z)&&((e=i(this,K))==null||e.call(this,a,r,t)),i(this,R)&&i(this,I)?.push([a,r,t]);}}if(i(this,F).clear(),i(this,f).fill(void 0),i(this,T).fill(void 0),i(this,q)&&i(this,Q)&&(i(this,q).fill(0),i(this,Q).fill(0)),i(this,H)&&i(this,H).fill(0),p(this,x,0),p(this,C,0),i(this,X).length=0,p(this,j,0),p(this,O,0),i(this,R)&&i(this,I)){let s=i(this,I),a;for(;a=s?.shift();)(n=i(this,$))==null||n.call(this,...a);}};var De=We;var Te=class{cache;map=new Map;constructor(t){this.cache=new De({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 It;(a=>(a.mediaInstances=new Map,a.channels=new Map,a.transients=new Set,a.systemPausedAliases=new Set,a.bufferRegistry=new Te({cacheSize:10})))(It||={});var c=It;var _;(s=>(s.log=(a,...r)=>console.log(`[Pixi\u2019VN] ${a}`,...r),s.warn=(a,...r)=>console.warn(`[Pixi\u2019VN] ${a}`,...r),s.error=(a,...r)=>console.error(`[Pixi\u2019VN] ${a}`,...r),s.info=(a,...r)=>console.info(`[Pixi\u2019VN] ${a}`,...r)))(_||={});function xe(o){return o.reduce((t,e)=>{switch(e.filterType){case "ReverbFilter":t.push(new Y.Reverb({decay:e.decay,preDelay:e.preDelay,wet:e.wet}).toDestination());break;case "FeedbackDelayFilter":t.push(new Y.FeedbackDelay({feedback:e.feedback,delayTime:e.delayTime,wet:e.wet}).toDestination());break;case "BitCrusherFilter":t.push(new Y.BitCrusher({bits:e.bits}).toDestination());break;case "CompressorFilter":t.push(new Y.Compressor({attack:e.attack,knee:e.knee,ratio:e.ratio,release:e.release,threshold:e.threshold}).toDestination());break;case "DelayFilter":t.push(new Y.Delay({delayTime:e.delayTime,maxDelay:e.maxDelay}).toDestination());break;case "DistortionFilter":t.push(new Y.Distortion({distortion:e.distortion,oversample:e.oversample,wet:e.wet}).toDestination());break;case "FeedbackCombFilterFilter":t.push(new Y.FeedbackCombFilter({delayTime:e.delayTime,resonance:e.resonance}).toDestination());break;case "FreeverbFilter":t.push(new Y.Freeverb({roomSize:e.roomSize,dampening:e.dampening,wet:e.wet}).toDestination());break;case "GateFilter":t.push(new Y.Gate({threshold:e.threshold,smoothing:e.smoothing}).toDestination());break;case "GreaterThanFilter":t.push(new Y.GreaterThan({value:e.value,convert:e.convert,maxValue:e.maxValue,minValue:e.minValue,units:e.units}).toDestination());break;case "GreaterThanZeroFilter":t.push(new Y.GreaterThanZero);break;case "LimiterFilter":t.push(new Y.Limiter({threshold:e.threshold}).toDestination());break;case "MidSideCompressorFilter":t.push(new Y.MidSideCompressor({mid:e.mid,side:e.side}).toDestination());break;case "MultibandCompressorFilter":t.push(new Y.MultibandCompressor({lowFrequency:e.lowFrequency,highFrequency:e.highFrequency,low:e.low,mid:e.mid,high:e.high}).toDestination());break;case "Panner3DFilter":t.push(new Y.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 Y.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 Y.StereoWidener({width:e.width,wet:e.wet}).toDestination());break;case "PingPongDelayFilter":t.push(new Y.PingPongDelay({wet:e.wet,delayTime:e.delayTime,feedback:e.feedback,maxDelay:e.maxDelay}).toDestination());break;case "AutoFilterFilter":t.push(new Y.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 Y.BiquadFilter({frequency:e.frequency,detune:e.detune,Q:e.Q,type:e.type,gain:e.gain}).toDestination());break;case "OnePoleFilterFilter":t.push(new Y.OnePoleFilter({type:e.type}).toDestination());break;case "CustomFilter":t.push(new Y.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 Y.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 Y.Tremolo({frequency:e.frequency,type:e.type,depth:e.depth,spread:e.spread,wet:e.wet}).toDestination());break;case "VibratoFilter":t.push(new Y.Vibrato({maxDelay:e.maxDelay,frequency:e.frequency,depth:e.depth,type:e.type,wet:e.wet}).toDestination());break;case "AutoPannerFilter":t.push(new Y.AutoPanner({frequency:e.frequency,type:e.type,depth:e.depth,channelCount:e.channelCount,wet:e.wet}).toDestination());break}return t},[])}function Et(o){if(o)return Array.from(o).reduce((t,e)=>(e instanceof Y.Reverb?t.push({filterType:"ReverbFilter",wet:e.wet.value,decay:Y.Time(e.decay).toSeconds(),preDelay:Y.Time(e.preDelay).toSeconds()}):e instanceof Y.PingPongDelay?t.push({filterType:"PingPongDelayFilter",wet:e.wet.value,delayTime:e.delayTime.value,feedback:e.feedback.value}):e instanceof Y.FeedbackDelay?t.push({filterType:"FeedbackDelayFilter",feedback:e.feedback.value,delayTime:e.delayTime.value,wet:e.wet.value}):e instanceof Y.BitCrusher?t.push({filterType:"BitCrusherFilter",bits:e.bits.value,wet:e.wet.value}):e instanceof Y.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 Y.Delay?t.push({filterType:"DelayFilter",delayTime:e.delayTime.value,maxDelay:e.maxDelay}):e instanceof Y.Distortion?t.push({filterType:"DistortionFilter",distortion:e.distortion,oversample:e.oversample,wet:e.wet.value}):e instanceof Y.FeedbackCombFilter?t.push({filterType:"FeedbackCombFilterFilter",delayTime:e.delayTime.value,resonance:e.resonance.value}):e instanceof Y.Freeverb?t.push({filterType:"FreeverbFilter",roomSize:e.roomSize.value,dampening:e.dampening,wet:e.wet.value}):e instanceof Y.Gate?t.push({filterType:"GateFilter",threshold:e.threshold,smoothing:e.smoothing}):e instanceof Y.GreaterThan?t.push({filterType:"GreaterThanFilter",value:e.comparator.value,convert:e.convert,maxValue:e.maxValue,minValue:e.minValue}):e instanceof Y.GreaterThanZero?t.push({filterType:"GreaterThanZeroFilter"}):e instanceof Y.Limiter?t.push({filterType:"LimiterFilter",threshold:e.threshold.value}):e instanceof Y.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 Y.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 Y.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 Y.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 Y.StereoWidener?t.push({filterType:"StereoWidenerFilter",width:e.width.value,wet:e.wet.value}):e instanceof Y.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 Y.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 Y.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 Y.Vibrato?t.push({filterType:"VibratoFilter",type:e.type,frequency:e.frequency.value,depth:e.depth.value,wet:e.wet.value}):e instanceof Y.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 Y.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 Y.OnePoleFilter?t.push({filterType:"OnePoleFilterFilter",type:e.type}):e instanceof Y.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 mt(o){return o instanceof Y.Reverb||o instanceof Y.FeedbackDelay||o instanceof Y.PingPongDelay||o instanceof Y.BitCrusher||o instanceof Y.Compressor||o instanceof Y.Delay||o instanceof Y.Distortion||o instanceof Y.FeedbackCombFilter||o instanceof Y.Freeverb||o instanceof Y.Gate||o instanceof Y.GreaterThan||o instanceof Y.GreaterThanZero||o instanceof Y.Limiter||o instanceof Y.MidSideCompressor||o instanceof Y.MultibandCompressor||o instanceof Y.Panner3D||o instanceof Y.Phaser||o instanceof Y.StereoWidener||o instanceof Y.AutoFilter||o instanceof Y.Chorus||o instanceof Y.Vibrato||o instanceof Y.Tremolo||o instanceof Y.AutoPanner||o instanceof Y.BiquadFilter||o instanceof Y.OnePoleFilter||o instanceof Y.Filter}function ee(o){return o<=0?-1/0:20*Math.log10(o)}function ye(o){return o<=-1/0?0:10**(o/20)}async function Me(o){if(c.bufferRegistry.has(o))return;let t=o;try{let e=xt__default.default.Assets.resolver.resolve(o);e?.src&&(t=e.src);}catch{}try{let e=await Y.ToneAudioBuffer.load(t),n=new Y.ToneAudioBuffer(e);c.bufferRegistry.set(o,n);}catch(e){_.warn(`Failed to load audio buffer for "${o}" (url: "${t}"): ${e instanceof Error?e.message:e}`),c.bufferRegistry.set(o,new Y.ToneAudioBuffer);}}var Se=class extends Y.Player{constructor(e,n,s,a,r={},h){super(r);this.alias=e;this.channelAlias=n;this.soundAlias=s;this.stepCounter=a;this.delay=h;this.options=r,this.playStartTime=Y.now()+(h??0);}alias;channelAlias;soundAlias;stepCounter;delay;options;filters=new Set;pausedAt=void 0;playStartTime=Y.now();get memory(){let e=Math.max(0,this.pausedAt?this.pausedAt-this.playStartTime:Y.now()-this.playStartTime),n=this.paused;return n&&c.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:ye(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!==ee(e.volume??1)&&(this.volume.value=ee(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=Y.now(),n==="started"&&super.stop();else {let s,a=false;typeof this.pausedAt=="number"&&(a=true,s=this.pausedAt-this.playStartTime,this.pausedAt=void 0),a&&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 c.mediaInstances.delete(this.alias),super.stop(e)}start(e,n,s){let a=Y.now(),r=a;if(typeof e=="number")r=e;else if(typeof e=="string"&&e.startsWith("+")){let d=Number(e.slice(1));Number.isNaN(d)||(r=a+d);}let h=typeof n=="number"?n:0;return this.playStartTime=r-h,super.start(e,n,s)}chain(...e){return e.forEach(n=>{mt(n)&&(n.toDestination(),this.filters.add(n));}),super.chain(...e)}disconnect(e){return mt(e)&&(e.disconnect(),this.filters.delete(e)),super.disconnect(e)}};var Fe=class{constructor(t,e={}){this.alias=t;this.background=e.background??false,this.toneChannel=new Y.Channel({volume:ee(e.volume??1),mute:e.muted??false,pan:e.pan??0}).toDestination(),e.filters&&this.toneChannel.chain(...e.filters);}alias;toneChannel;get volume(){return ye(this.toneChannel.volume.value)}set volume(t){this.toneChannel.volume.value=ee(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 c.mediaInstances.values())t.channelAlias===this.alias&&!t.paused&&(t.paused=true);return this}resumeAll(){for(let t of c.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=c.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:a,elapsed:r,filters:h=[],muted:d,autostart:b=true,speed:A,volume:w,...M}=n;d!==void 0&&(_.warn(`MediaInstance "${t}" is being created with muted=${d}. This will override the channel's muted state (${this.muted}).`),M.mute=d),A!==void 0&&(_.warn(`MediaInstance "${t}" is being created with speed=${A}. This will override the default playback speed of 1.`),M.playbackRate=A);let D=new Se(t,this.alias,e,core.GameUnifier.stepCounter,{...M,volume:w!==void 0?ee(w):void 0,url:s},a).chain(...h,this.toneChannel),G=r!==void 0?Math.max(0,r):void 0;return b&&(a?D.start(`+${a}`,G):D.start(void 0,G)),D}async play(t,e,n){let s,a;if(typeof e=="string"?(s=t,a=e):(s=t,a=t,n=e),c.mediaInstances.has(s)){let h=c.mediaInstances.get(s);h&&(h.stop(),n={...h.memory,...n,filters:[...h.filters,...n?.filters||[]]});}await Me(a);let r=this._createPlayer(s,a,n);return c.mediaInstances.set(s,r),r}toggleMuteAll(){return this.muted=!this.muted,this.muted}get mediaInstances(){return Array.from(c.mediaInstances.values()).reduce((t,e)=>(e.channelAlias===this.alias&&t.push(e),t),[])}stopAll(){let t=[];for(let[e,n]of c.mediaInstances.entries())n.channelAlias===this.alias&&(n.stop(),t.push(e));return t.forEach(e=>{c.mediaInstances.delete(e);}),this}};function Dt(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 _e=class{get volumeAll(){return ye(Y__namespace.getDestination().volume.value)}set volumeAll(t){Y__namespace.getDestination().volume.value=ee(t);}get speedAll(){return this._speedAll}set speedAll(t){this._speedAll=t;for(let e of c.mediaInstances.values())e.speed=t;}_speedAll=1;_defaultChannelAlias=vt;get defaultChannelAlias(){return this._defaultChannelAlias}set defaultChannelAlias(t){this._defaultChannelAlias=t;}add(t,e){if(!c.bufferRegistry.has(t)){let n=new Y__namespace.ToneAudioBuffer(e);c.bufferRegistry.set(t,n);}}pauseAll(){for(let t of c.mediaInstances.values())t.paused||(t.paused=true);return this}resumeAll(){for(let t of c.mediaInstances.values())t.paused&&(t.paused=false);return this}get muted(){return Y__namespace.getDestination().mute}toggleMuteAll(){let t=!Y__namespace.getDestination().mute;return Y__namespace.getDestination().mute=t,t}muteAll(){return Y__namespace.getDestination().mute=true,this}unmuteAll(){return Y__namespace.getDestination().mute=false,this}stopAll(){for(let t of c.mediaInstances.values())t.stop();return c.mediaInstances.clear(),this}pauseUnsavedAllInternal(t){for(let[e,n]of c.mediaInstances.entries())t&&n.channelAlias!==t||n.paused||(n.paused=true,c.systemPausedAliases.add(e));if(!t){for(let e of c.transients)e.stop();c.transients.clear();}}resumeUnsavedAllInternal(t){let e=[];for(let n of c.systemPausedAliases){let s=c.mediaInstances.get(n);if(!s){e.push(n);continue}t&&s.channelAlias!==t||(s.paused=false,e.push(n));}for(let n of e)c.systemPausedAliases.delete(n);}stopTransientAllInternal(){for(let t of c.transients)t.stop();c.transients.clear();}async playTransientInternal(t,e){c.bufferRegistry.has(t)||await this.load(t);let n=c.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,...a}=e??{},r=new Y__namespace.Player({...a,url:n}).toDestination();return s&&r.start(),c.transients.add(r),r.onstop=()=>{r.dispose(),c.transients.delete(r);},r}unsaved={playTransient:(t,e)=>this.playTransientInternal(t,e),pauseAll:t=>(this.pauseUnsavedAllInternal(t),this.unsaved),resumeAll:t=>(this.resumeUnsavedAllInternal(t),this.unsaved),stopTransientAll:()=>(this.stopTransientAllInternal(),this.unsaved)};pauseUnsavedAll(t){return this.pauseUnsavedAllInternal(t),this}resumeUnsavedAll(t){return this.resumeUnsavedAllInternal(t),this}stopTransientAll(){return this.stopTransientAllInternal(),this}async play(t,e,n){let s,a;typeof e=="string"?(s=t,a=e):(s=t,a=t,n=e),c.bufferRegistry.has(a)||await this.load(a);let{channel:r=this.defaultChannelAlias,...h}=n??{};return await this.findChannelInternal(r).play(s,a,h)}async playTransient(t,e){return this.playTransientInternal(t,e)}find(t){return c.mediaInstances.get(t)}stop(t){let e=this.find(t);e?(e.stop(),c.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 c.bufferRegistry.get(t)?.duration??0}async load(...t){let e=t.map(Me);await Promise.all(e);}backgroundLoad(...t){return this.load(...t).catch(e=>{_.error("Error background-loading sound",e);})}backgroundLoadBundle(t){let e=xt__default.default.Assets.backgroundLoadBundle(t);return e.then(async()=>{try{let n=await xt__default.default.Assets.loadBundle(t),s=[];for(let a in n)c.bufferRegistry.has(a)||s.push(this.load(a));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();}addChannelInternal(t,e={}){if(typeof t!="string"){t.forEach(s=>{let a={...e,filters:e.filters?[...e.filters]:e.filters};this.addChannelInternal(s,a);});return}if(c.channels.has(t)){_.warn(`Channel with alias ${t} already exists.`);return}let n=new Fe(t,e);return c.channels.set(t,n),n}findChannelInternal(t){let e=c.channels.get(t);return e||this.addChannelInternal(t)}channels={add:(t,e)=>this.addChannelInternal(t,e),find:t=>this.findChannelInternal(t),get values(){return Array.from(c.channels.values())}};addChannel(t,e={}){return this.channels.add(t,e)}findChannel(t){return this.channels.find(t)}export(){let t=Array.from(c.mediaInstances.entries()).reduce((e,[n,s])=>(e[n]={channelAlias:s.channelAlias,soundAlias:s.soundAlias,stepCounter:s.stepCounter,paused:s.paused,options:{...s.memory,filters:Et(s.filters)}},e),{});return {mediaInstances:Dt(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:r,channelAlias:h})=>(n.add(h),await this.load(r)));await Promise.all(s),this.channels.values.forEach(r=>{(!r.background||!n.has(r.alias))&&r.stopAll();});let a=Object.keys(e).map(async r=>{let h=e[r],d=this.findChannelInternal(h.channelAlias),b=h.options.paused??h.paused??!1;if(d.background)if(h.stepCounter===core.GameUnifier.stepCounter||!this.find(r)){let A=await d.play(r,h.soundAlias,{...h.options,autostart:!b,filters:xe(h.options.filters||[]),delay:h.options.delay});A.paused=b;}else {let A=c.mediaInstances.get(r);if(!A){_.warn(`No media instance found with alias ${r} while restoring background state.`);return}A.memory={...h.options,paused:b},[...A.filters].forEach(M=>{A.disconnect(M),M.dispose();}),A.chain(...xe(h.options.filters||[]));}else {let A=await d.play(r,h.soundAlias,{...h.options,autostart:!b,filters:xe(h.options.filters||[]),delay:h.options.delay});A.paused=b;}});await Promise.all(a);}}}catch(e){_.error("Error importing data",e);}}};var gt=new _e;core.GameUnifier.addOnPreContinue(async()=>{try{c.channels.forEach(o=>{o.background||o.stopAll();});}catch{}});if(typeof document<"u"){let o=false;document.addEventListener("visibilitychange",()=>{document.hidden?gt.muted||(gt.muteAll(),o=true):o&&(gt.unmuteAll(),o=false);});}exports.SoundRegistry=c;exports.sound=gt;
package/dist/sound.d.cts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { a as SoundPlayOptions, M as MediaInterface, C as ChannelOptions, b as SoundPlayOptionsWithChannel, S as SoundGameState, c as MediaMemory } from './SoundGameState-C_6ZsQX6.cjs';
2
2
  export { E as ExportedSound, d as ExportedSoundPlay, e as SoundOptions, f as SoundPlay } from './SoundGameState-C_6ZsQX6.cjs';
3
3
  import { ToneAudioNode, Param, PlayerOptions, Player, ToneAudioBuffer } from 'tone';
4
- import { C as CachedMap } from './CachedMap-DZLvJAnA.cjs';
4
+ import { CachedMap } from './index.cjs';
5
5
  import 'lru-cache';
6
6
 
7
7
  interface AudioChannelInterface {
@@ -373,4 +373,5 @@ declare namespace SoundRegistry {
373
373
  */
374
374
  declare const sound: SoundManagerInterface;
375
375
 
376
- export { type AudioChannelInterface, ChannelOptions, MediaInterface, type SoundChannelsInterface, SoundGameState, type SoundManagerInterface, SoundPlayOptions, SoundPlayOptionsWithChannel, SoundRegistry, type SoundUnsavedInterface, sound };
376
+ export { ChannelOptions, MediaInterface, SoundGameState, SoundPlayOptions, SoundPlayOptionsWithChannel, SoundRegistry, sound };
377
+ export type { AudioChannelInterface, SoundChannelsInterface, SoundManagerInterface, SoundUnsavedInterface };
package/dist/sound.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { a as SoundPlayOptions, M as MediaInterface, C as ChannelOptions, b as SoundPlayOptionsWithChannel, S as SoundGameState, c as MediaMemory } from './SoundGameState-C_6ZsQX6.js';
2
2
  export { E as ExportedSound, d as ExportedSoundPlay, e as SoundOptions, f as SoundPlay } from './SoundGameState-C_6ZsQX6.js';
3
3
  import { ToneAudioNode, Param, PlayerOptions, Player, ToneAudioBuffer } from 'tone';
4
- import { C as CachedMap } from './CachedMap-DZLvJAnA.js';
4
+ import { CachedMap } from './index.js';
5
5
  import 'lru-cache';
6
6
 
7
7
  interface AudioChannelInterface {
@@ -373,4 +373,5 @@ declare namespace SoundRegistry {
373
373
  */
374
374
  declare const sound: SoundManagerInterface;
375
375
 
376
- export { type AudioChannelInterface, ChannelOptions, MediaInterface, type SoundChannelsInterface, SoundGameState, type SoundManagerInterface, SoundPlayOptions, SoundPlayOptionsWithChannel, SoundRegistry, type SoundUnsavedInterface, sound };
376
+ export { ChannelOptions, MediaInterface, SoundGameState, SoundPlayOptions, SoundPlayOptionsWithChannel, SoundRegistry, sound };
377
+ export type { AudioChannelInterface, SoundChannelsInterface, SoundManagerInterface, SoundUnsavedInterface };
package/dist/sound.mjs CHANGED
@@ -1 +1 @@
1
- import {h}from'./chunk-HD353M4B.mjs';import {a}from'./chunk-S7HZUIEI.mjs';import {d,e}from'./chunk-AW5XWF24.mjs';import {GameUnifier,PixiError}from'@drincs/pixi-vn/core';import oe 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 T(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 se(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 w(a){if(i.bufferRegistry.has(a))return;let t=a;try{let e=oe.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 v=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,s=false;typeof this.pausedAt=="number"&&(s=true,r=this.pausedAt-this.playStartTime,this.pausedAt=void 0),s&&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 b=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 I=new v(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?I.start(`+${s}`,ee):I.start(void 0,ee)),I}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 w(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=h;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}pauseUnsavedAllInternal(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();}}resumeUnsavedAllInternal(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);}stopTransientAllInternal(){for(let t of i.transients)t.stop();i.transients.clear();}async playTransientInternal(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}unsaved={playTransient:(t,e)=>this.playTransientInternal(t,e),pauseAll:t=>(this.pauseUnsavedAllInternal(t),this.unsaved),resumeAll:t=>(this.resumeUnsavedAllInternal(t),this.unsaved),stopTransientAll:()=>(this.stopTransientAllInternal(),this.unsaved)};pauseUnsavedAll(t){return this.pauseUnsavedAllInternal(t),this}resumeUnsavedAll(t){return this.resumeUnsavedAllInternal(t),this}stopTransientAll(){return this.stopTransientAllInternal(),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.findChannelInternal(o).play(r,s,l)}async playTransient(t,e){return this.playTransientInternal(t,e)}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(w);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=oe.Assets.backgroundLoadBundle(t);return e$1.then(async()=>{try{let n=await oe.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();}addChannelInternal(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.addChannelInternal(r,s);});return}if(i.channels.has(t)){e.warn(`Channel with alias ${t} already exists.`);return}let n=new b(t,e$1);return i.channels.set(t,n),n}findChannelInternal(t){let e=i.channels.get(t);return e||this.addChannelInternal(t)}channels={add:(t,e)=>this.addChannelInternal(t,e),find:t=>this.findChannelInternal(t),get values(){return Array.from(i.channels.values())}};addChannel(t,e={}){return this.channels.add(t,e)}findChannel(t){return this.channels.find(t)}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:se(r.filters)}},e),{});return {mediaInstances:a(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.values.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.findChannelInternal(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:T(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(...T(l.options.filters||[]));}else {let d=await c.play(o,l.soundAlias,{...l.options,autostart:!h,filters:T(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 {h}from'./chunk-HD353M4B.mjs';import {a}from'./chunk-A5FN4SNI.mjs';import {d,e}from'./chunk-B46NFIFC.mjs';import {GameUnifier,PixiError}from'@drincs/pixi-vn/core';import oe 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 T(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 se(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 w(a){if(i.bufferRegistry.has(a))return;let t=a;try{let e=oe.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 v=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,s=false;typeof this.pausedAt=="number"&&(s=true,r=this.pausedAt-this.playStartTime,this.pausedAt=void 0),s&&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 b=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 I=new v(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?I.start(`+${s}`,ee):I.start(void 0,ee)),I}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 w(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=h;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}pauseUnsavedAllInternal(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();}}resumeUnsavedAllInternal(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);}stopTransientAllInternal(){for(let t of i.transients)t.stop();i.transients.clear();}async playTransientInternal(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}unsaved={playTransient:(t,e)=>this.playTransientInternal(t,e),pauseAll:t=>(this.pauseUnsavedAllInternal(t),this.unsaved),resumeAll:t=>(this.resumeUnsavedAllInternal(t),this.unsaved),stopTransientAll:()=>(this.stopTransientAllInternal(),this.unsaved)};pauseUnsavedAll(t){return this.pauseUnsavedAllInternal(t),this}resumeUnsavedAll(t){return this.resumeUnsavedAllInternal(t),this}stopTransientAll(){return this.stopTransientAllInternal(),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.findChannelInternal(o).play(r,s,l)}async playTransient(t,e){return this.playTransientInternal(t,e)}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(w);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=oe.Assets.backgroundLoadBundle(t);return e$1.then(async()=>{try{let n=await oe.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();}addChannelInternal(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.addChannelInternal(r,s);});return}if(i.channels.has(t)){e.warn(`Channel with alias ${t} already exists.`);return}let n=new b(t,e$1);return i.channels.set(t,n),n}findChannelInternal(t){let e=i.channels.get(t);return e||this.addChannelInternal(t)}channels={add:(t,e)=>this.addChannelInternal(t,e),find:t=>this.findChannelInternal(t),get values(){return Array.from(i.channels.values())}};addChannel(t,e={}){return this.channels.add(t,e)}findChannel(t){return this.channels.find(t)}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:se(r.filters)}},e),{});return {mediaInstances:a(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.values.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.findChannelInternal(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:T(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(...T(l.options.filters||[]));}else {let d=await c.play(o,l.soundAlias,{...l.options,autostart:!h,filters:T(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};
package/dist/storage.cjs CHANGED
@@ -1 +1 @@
1
- 'use strict';var core=require('@drincs/pixi-vn/core'),worker=require('@drincs/pixi-vn/worker');var te=Object.defineProperty;var Ht=f=>{throw TypeError(f)};var ee=(f,e,i)=>e in f?te(f,e,{enumerable:true,configurable:true,writable:true,value:i}):f[e]=i;var D=(f,e,i)=>ee(f,typeof e!="symbol"?e+"":e,i),Ut=(f,e,i)=>e.has(f)||Ht("Cannot "+i);var t=(f,e,i)=>(Ut(f,e,"read from private field"),i?i.call(f):e.get(f)),_=(f,e,i)=>e.has(f)?Ht("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(f):e.set(f,i),u=(f,e,i,s)=>(Ut(f,e,"write to private field"),e.set(f,i),i),l=(f,e,i)=>(Ut(f,e,"access private method"),i);var It=(f,e,i,s)=>({set _(r){u(f,e,r);},get _(){return t(f,e,s)}});var st="storage",ht="temp",H="narration",Nt="flags",j={CURRENT_DIALOGUE_MEMORY_KEY:"dialogue",LAST_DIALOGUE_ADDED_IN_STEP_MEMORY_KEY:"dialogue:step_counter",CURRENT_MENU_OPTIONS_MEMORY_KEY:"choice:options",LAST_MENU_OPTIONS_ADDED_IN_STEP_MEMORY_KEY:"choice:step_counter",CURRENT_INPUT_VALUE_MEMORY_KEY:"input:value",LAST_INPUT_ADDED_IN_STEP_MEMORY_KEY:"input:step_counter",CURRENT_INPUT_INFO_MEMORY_KEY:"input:info",CHARACTER_CATEGORY_KEY:"character",ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY:"___glue___",OPENED_LABELS_COUNTER_KEY:"label:opened",ALL_CHOICES_MADE_KEY:"choices:made",CURRENT_STEP_TIMES_COUNTER_KEY:"label:history",LAST_STEP_GLUED:"glue:last_step"};var ie=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,Bt=new Set,zt=typeof process=="object"&&process?process:{},Xt=(f,e,i,s)=>{typeof zt.emitWarning=="function"?zt.emitWarning(f,e,i,s):console.error(`[${i}] ${e}: ${f}`);},Ct=globalThis.AbortController,jt=globalThis.AbortSignal;if(typeof Ct>"u"){jt=class{onabort;_onabort=[];reason;aborted=false;addEventListener(i,s){this._onabort.push(s);}},Ct=class{constructor(){e();}signal=new jt;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 f=zt.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{f&&(f=false,Xt("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",e));};}var se=f=>!Bt.has(f);var rt=f=>f&&f===Math.floor(f)&&f>0&&isFinite(f),Jt=f=>rt(f)?f<=Math.pow(2,8)?Uint8Array:f<=Math.pow(2,16)?Uint16Array:f<=Math.pow(2,32)?Uint32Array:f<=Number.MAX_SAFE_INTEGER?Ft:null:null,Ft=class extends Array{constructor(f){super(f),this.fill(0);}},et,_t,re=(et=class{heap;length;static create(e){let i=Jt(e);if(!i)return [];u(et,_t,true);let s=new et(e,i);return u(et,_t,false),s}constructor(e,i){if(!t(et,_t))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]}},_t=new WeakMap,_(et,_t,false),et),$t,kt,$,z,k,ct,B,mt,St,X,R,J,x,O,g,L,Y,M,N,q,F,Q,Z,P,K,tt,lt,V,Et,n,Yt,ft,it,wt,W,Qt,ut,Tt,xt,at,ot,Pt,Dt,Mt,v,Kt,Ot,nt,Wt,bt,qt=(bt=class{constructor(e){_(this,n);_(this,$);_(this,z);_(this,k);_(this,ct);_(this,B);_(this,mt);_(this,St);_(this,X);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");_(this,R);_(this,J);_(this,x);_(this,O);_(this,g);_(this,L);_(this,Y);_(this,M);_(this,N);_(this,q);_(this,F);_(this,Q);_(this,Z);_(this,P);_(this,K);_(this,tt);_(this,lt);_(this,V);_(this,Et);_(this,ft,()=>{});_(this,it,()=>{});_(this,wt,()=>{});_(this,W,()=>false);_(this,ut,e=>{});_(this,Tt,(e,i,s)=>{});_(this,xt,(e,i,s,r)=>{if(s||r)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});D(this,$t,"LRUCache");let{max:i=0,ttl:s,ttlResolution:r=1,ttlAutopurge:o,updateAgeOnGet:a,updateAgeOnHas:h,allowStale:c,dispose:S,onInsert:I,disposeAfter:p,noDisposeOnSet:b,noUpdateTTL:T,maxSize:E=0,maxEntrySize:y=0,sizeCalculation:A,fetchMethod:d,memoMethod:C,noDeleteOnFetchRejection:U,noDeleteOnStaleGet:G,allowStaleOnFetchRejection:w,allowStaleOnFetchAbort:vt,ignoreFetchAbort:gt,perf:pt}=e;if(pt!==void 0&&typeof pt?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(u(this,X,pt??ie),i!==0&&!rt(i))throw new TypeError("max option must be a nonnegative integer");let dt=i?Jt(i):Array;if(!dt)throw new Error("invalid max value: "+i);if(u(this,$,i),u(this,z,E),this.maxEntrySize=y||t(this,z),this.sizeCalculation=A,this.sizeCalculation){if(!t(this,z)&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(C!==void 0&&typeof C!="function")throw new TypeError("memoMethod must be a function if defined");if(u(this,St,C),d!==void 0&&typeof d!="function")throw new TypeError("fetchMethod must be a function if specified");if(u(this,mt,d),u(this,lt,!!d),u(this,x,new Map),u(this,O,new Array(i).fill(void 0)),u(this,g,new Array(i).fill(void 0)),u(this,L,new dt(i)),u(this,Y,new dt(i)),u(this,M,0),u(this,N,0),u(this,q,re.create(i)),u(this,R,0),u(this,J,0),typeof S=="function"&&u(this,k,S),typeof I=="function"&&u(this,ct,I),typeof p=="function"?(u(this,B,p),u(this,F,[])):(u(this,B,void 0),u(this,F,void 0)),u(this,tt,!!t(this,k)),u(this,Et,!!t(this,ct)),u(this,V,!!t(this,B)),this.noDisposeOnSet=!!b,this.noUpdateTTL=!!T,this.noDeleteOnFetchRejection=!!U,this.allowStaleOnFetchRejection=!!w,this.allowStaleOnFetchAbort=!!vt,this.ignoreFetchAbort=!!gt,this.maxEntrySize!==0){if(t(this,z)!==0&&!rt(t(this,z)))throw new TypeError("maxSize must be a positive integer if specified");if(!rt(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");l(this,n,Qt).call(this);}if(this.allowStale=!!c,this.noDeleteOnStaleGet=!!G,this.updateAgeOnGet=!!a,this.updateAgeOnHas=!!h,this.ttlResolution=rt(r)||r===0?r:1,this.ttlAutopurge=!!o,this.ttl=s||0,this.ttl){if(!rt(this.ttl))throw new TypeError("ttl must be a positive integer if specified");l(this,n,Yt).call(this);}if(t(this,$)===0&&this.ttl===0&&t(this,z)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!t(this,$)&&!t(this,z)){let Vt="LRU_CACHE_UNBOUNDED";se(Vt)&&(Bt.add(Vt),Xt("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",Vt,bt));}}get perf(){return t(this,X)}static unsafeExposeInternals(e){return {starts:t(e,Z),ttls:t(e,P),autopurgeTimers:t(e,K),sizes:t(e,Q),keyMap:t(e,x),keyList:t(e,O),valList:t(e,g),next:t(e,L),prev:t(e,Y),get head(){return t(e,M)},get tail(){return t(e,N)},free:t(e,q),isBackgroundFetch:i=>{var s;return l(s=e,n,v).call(s,i)},backgroundFetch:(i,s,r,o)=>{var a;return l(a=e,n,Mt).call(a,i,s,r,o)},moveToTail:i=>{var s;return l(s=e,n,Ot).call(s,i)},indexes:i=>{var s;return l(s=e,n,at).call(s,i)},rindexes:i=>{var s;return l(s=e,n,ot).call(s,i)},isStale:i=>{var s;return t(s=e,W).call(s,i)}}}get max(){return t(this,$)}get maxSize(){return t(this,z)}get calculatedSize(){return t(this,J)}get size(){return t(this,R)}get fetchMethod(){return t(this,mt)}get memoMethod(){return t(this,St)}get dispose(){return t(this,k)}get onInsert(){return t(this,ct)}get disposeAfter(){return t(this,B)}getRemainingTTL(e){return t(this,x).has(e)?1/0:0}*entries(){for(let e of l(this,n,at).call(this))t(this,g)[e]!==void 0&&t(this,O)[e]!==void 0&&!l(this,n,v).call(this,t(this,g)[e])&&(yield [t(this,O)[e],t(this,g)[e]]);}*rentries(){for(let e of l(this,n,ot).call(this))t(this,g)[e]!==void 0&&t(this,O)[e]!==void 0&&!l(this,n,v).call(this,t(this,g)[e])&&(yield [t(this,O)[e],t(this,g)[e]]);}*keys(){for(let e of l(this,n,at).call(this)){let i=t(this,O)[e];i!==void 0&&!l(this,n,v).call(this,t(this,g)[e])&&(yield i);}}*rkeys(){for(let e of l(this,n,ot).call(this)){let i=t(this,O)[e];i!==void 0&&!l(this,n,v).call(this,t(this,g)[e])&&(yield i);}}*values(){for(let e of l(this,n,at).call(this))t(this,g)[e]!==void 0&&!l(this,n,v).call(this,t(this,g)[e])&&(yield t(this,g)[e]);}*rvalues(){for(let e of l(this,n,ot).call(this))t(this,g)[e]!==void 0&&!l(this,n,v).call(this,t(this,g)[e])&&(yield t(this,g)[e]);}[(kt=Symbol.iterator,$t=Symbol.toStringTag,kt)](){return this.entries()}find(e,i={}){for(let s of l(this,n,at).call(this)){let r=t(this,g)[s],o=l(this,n,v).call(this,r)?r.__staleWhileFetching:r;if(o!==void 0&&e(o,t(this,O)[s],this))return this.get(t(this,O)[s],i)}}forEach(e,i=this){for(let s of l(this,n,at).call(this)){let r=t(this,g)[s],o=l(this,n,v).call(this,r)?r.__staleWhileFetching:r;o!==void 0&&e.call(i,o,t(this,O)[s],this);}}rforEach(e,i=this){for(let s of l(this,n,ot).call(this)){let r=t(this,g)[s],o=l(this,n,v).call(this,r)?r.__staleWhileFetching:r;o!==void 0&&e.call(i,o,t(this,O)[s],this);}}purgeStale(){let e=false;for(let i of l(this,n,ot).call(this,{allowStale:true}))t(this,W).call(this,i)&&(l(this,n,nt).call(this,t(this,O)[i],"expire"),e=true);return e}info(e){let i=t(this,x).get(e);if(i===void 0)return;let s=t(this,g)[i],r=l(this,n,v).call(this,s)?s.__staleWhileFetching:s;if(r===void 0)return;let o={value:r};if(t(this,P)&&t(this,Z)){let a=t(this,P)[i],h=t(this,Z)[i];if(a&&h){let c=a-(t(this,X).now()-h);o.ttl=c,o.start=Date.now();}}return t(this,Q)&&(o.size=t(this,Q)[i]),o}dump(){let e=[];for(let i of l(this,n,at).call(this,{allowStale:true})){let s=t(this,O)[i],r=t(this,g)[i],o=l(this,n,v).call(this,r)?r.__staleWhileFetching:r;if(o===void 0||s===void 0)continue;let a={value:o};if(t(this,P)&&t(this,Z)){a.ttl=t(this,P)[i];let h=t(this,X).now()-t(this,Z)[i];a.start=Math.floor(Date.now()-h);}t(this,Q)&&(a.size=t(this,Q)[i]),e.unshift([s,a]);}return e}load(e){this.clear();for(let[i,s]of e){if(s.start){let r=Date.now()-s.start;s.start=t(this,X).now()-r;}this.set(i,s.value,s);}}set(e,i,s={}){var b,T,E,y;if(i===void 0)return this.delete(e),this;let{ttl:r=this.ttl,start:o,noDisposeOnSet:a=this.noDisposeOnSet,sizeCalculation:h=this.sizeCalculation,status:c}=s,{noUpdateTTL:S=this.noUpdateTTL}=s,I=t(this,xt).call(this,e,i,s.size||0,h);if(this.maxEntrySize&&I>this.maxEntrySize)return c&&(c.set="miss",c.maxEntrySizeExceeded=true),l(this,n,nt).call(this,e,"set"),this;let p=t(this,R)===0?void 0:t(this,x).get(e);if(p===void 0)p=t(this,R)===0?t(this,N):t(this,q).length!==0?t(this,q).pop():t(this,R)===t(this,$)?l(this,n,Dt).call(this,false):t(this,R),t(this,O)[p]=e,t(this,g)[p]=i,t(this,x).set(e,p),t(this,L)[t(this,N)]=p,t(this,Y)[p]=t(this,N),u(this,N,p),It(this,R)._++,t(this,Tt).call(this,p,I,c),c&&(c.set="add"),S=false,t(this,Et)&&((b=t(this,ct))==null||b.call(this,i,e,"add"));else {l(this,n,Ot).call(this,p);let A=t(this,g)[p];if(i!==A){if(t(this,lt)&&l(this,n,v).call(this,A)){A.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:d}=A;d!==void 0&&!a&&(t(this,tt)&&((T=t(this,k))==null||T.call(this,d,e,"set")),t(this,V)&&t(this,F)?.push([d,e,"set"]));}else a||(t(this,tt)&&((E=t(this,k))==null||E.call(this,A,e,"set")),t(this,V)&&t(this,F)?.push([A,e,"set"]));if(t(this,ut).call(this,p),t(this,Tt).call(this,p,I,c),t(this,g)[p]=i,c){c.set="replace";let d=A&&l(this,n,v).call(this,A)?A.__staleWhileFetching:A;d!==void 0&&(c.oldValue=d);}}else c&&(c.set="update");t(this,Et)&&this.onInsert?.(i,e,i===A?"update":"replace");}if(r!==0&&!t(this,P)&&l(this,n,Yt).call(this),t(this,P)&&(S||t(this,wt).call(this,p,r,o),c&&t(this,it).call(this,c,p)),!a&&t(this,V)&&t(this,F)){let A=t(this,F),d;for(;d=A?.shift();)(y=t(this,B))==null||y.call(this,...d);}return this}pop(){var e;try{for(;t(this,R);){let i=t(this,g)[t(this,M)];if(l(this,n,Dt).call(this,!0),l(this,n,v).call(this,i)){if(i.__staleWhileFetching)return i.__staleWhileFetching}else if(i!==void 0)return i}}finally{if(t(this,V)&&t(this,F)){let i=t(this,F),s;for(;s=i?.shift();)(e=t(this,B))==null||e.call(this,...s);}}}has(e,i={}){let{updateAgeOnHas:s=this.updateAgeOnHas,status:r}=i,o=t(this,x).get(e);if(o!==void 0){let a=t(this,g)[o];if(l(this,n,v).call(this,a)&&a.__staleWhileFetching===void 0)return false;if(t(this,W).call(this,o))r&&(r.has="stale",t(this,it).call(this,r,o));else return s&&t(this,ft).call(this,o),r&&(r.has="hit",t(this,it).call(this,r,o)),true}else r&&(r.has="miss");return false}peek(e,i={}){let{allowStale:s=this.allowStale}=i,r=t(this,x).get(e);if(r===void 0||!s&&t(this,W).call(this,r))return;let o=t(this,g)[r];return l(this,n,v).call(this,o)?o.__staleWhileFetching:o}async fetch(e,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,ttl:a=this.ttl,noDisposeOnSet:h=this.noDisposeOnSet,size:c=0,sizeCalculation:S=this.sizeCalculation,noUpdateTTL:I=this.noUpdateTTL,noDeleteOnFetchRejection:p=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:b=this.allowStaleOnFetchRejection,ignoreFetchAbort:T=this.ignoreFetchAbort,allowStaleOnFetchAbort:E=this.allowStaleOnFetchAbort,context:y,forceRefresh:A=false,status:d,signal:C}=i;if(!t(this,lt))return d&&(d.fetch="get"),this.get(e,{allowStale:s,updateAgeOnGet:r,noDeleteOnStaleGet:o,status:d});let U={allowStale:s,updateAgeOnGet:r,noDeleteOnStaleGet:o,ttl:a,noDisposeOnSet:h,size:c,sizeCalculation:S,noUpdateTTL:I,noDeleteOnFetchRejection:p,allowStaleOnFetchRejection:b,allowStaleOnFetchAbort:E,ignoreFetchAbort:T,status:d,signal:C},G=t(this,x).get(e);if(G===void 0){d&&(d.fetch="miss");let w=l(this,n,Mt).call(this,e,G,U,y);return w.__returned=w}else {let w=t(this,g)[G];if(l(this,n,v).call(this,w)){let dt=s&&w.__staleWhileFetching!==void 0;return d&&(d.fetch="inflight",dt&&(d.returnedStale=true)),dt?w.__staleWhileFetching:w.__returned=w}let vt=t(this,W).call(this,G);if(!A&&!vt)return d&&(d.fetch="hit"),l(this,n,Ot).call(this,G),r&&t(this,ft).call(this,G),d&&t(this,it).call(this,d,G),w;let gt=l(this,n,Mt).call(this,e,G,U,y),pt=gt.__staleWhileFetching!==void 0&&s;return d&&(d.fetch=vt?"stale":"refresh",pt&&vt&&(d.returnedStale=true)),pt?gt.__staleWhileFetching:gt.__returned=gt}}async forceFetch(e,i={}){let s=await this.fetch(e,i);if(s===void 0)throw new Error("fetch() returned undefined");return s}memo(e,i={}){let s=t(this,St);if(!s)throw new Error("no memoMethod provided to constructor");let{context:r,forceRefresh:o,...a}=i,h=this.get(e,a);if(!o&&h!==void 0)return h;let c=s(e,h,{options:a,context:r});return this.set(e,c,a),c}get(e,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,status:a}=i,h=t(this,x).get(e);if(h!==void 0){let c=t(this,g)[h],S=l(this,n,v).call(this,c);return a&&t(this,it).call(this,a,h),t(this,W).call(this,h)?(a&&(a.get="stale"),S?(a&&s&&c.__staleWhileFetching!==void 0&&(a.returnedStale=true),s?c.__staleWhileFetching:void 0):(o||l(this,n,nt).call(this,e,"expire"),a&&s&&(a.returnedStale=true),s?c:void 0)):(a&&(a.get="hit"),S?c.__staleWhileFetching:(l(this,n,Ot).call(this,h),r&&t(this,ft).call(this,h),c))}else a&&(a.get="miss");}delete(e){return l(this,n,nt).call(this,e,"delete")}clear(){return l(this,n,Wt).call(this,"delete")}},$=new WeakMap,z=new WeakMap,k=new WeakMap,ct=new WeakMap,B=new WeakMap,mt=new WeakMap,St=new WeakMap,X=new WeakMap,R=new WeakMap,J=new WeakMap,x=new WeakMap,O=new WeakMap,g=new WeakMap,L=new WeakMap,Y=new WeakMap,M=new WeakMap,N=new WeakMap,q=new WeakMap,F=new WeakMap,Q=new WeakMap,Z=new WeakMap,P=new WeakMap,K=new WeakMap,tt=new WeakMap,lt=new WeakMap,V=new WeakMap,Et=new WeakMap,n=new WeakSet,Yt=function(){let e=new Ft(t(this,$)),i=new Ft(t(this,$));u(this,P,e),u(this,Z,i);let s=this.ttlAutopurge?new Array(t(this,$)):void 0;u(this,K,s),u(this,wt,(h,c,S=t(this,X).now())=>{i[h]=c!==0?S:0,e[h]=c,r(h,c);}),u(this,ft,h=>{i[h]=e[h]!==0?t(this,X).now():0,r(h,e[h]);});let r=this.ttlAutopurge?(h,c)=>{if(s?.[h]&&(clearTimeout(s[h]),s[h]=void 0),c&&c!==0&&s){let S=setTimeout(()=>{t(this,W).call(this,h)&&l(this,n,nt).call(this,t(this,O)[h],"expire");},c+1);S.unref&&S.unref(),s[h]=S;}}:()=>{};u(this,it,(h,c)=>{if(e[c]){let S=e[c],I=i[c];if(!S||!I)return;h.ttl=S,h.start=I,h.now=o||a();let p=h.now-I;h.remainingTTL=S-p;}});let o=0,a=()=>{let h=t(this,X).now();if(this.ttlResolution>0){o=h;let c=setTimeout(()=>o=0,this.ttlResolution);c.unref&&c.unref();}return h};this.getRemainingTTL=h=>{let c=t(this,x).get(h);if(c===void 0)return 0;let S=e[c],I=i[c];if(!S||!I)return 1/0;let p=(o||a())-I;return S-p},u(this,W,h=>{let c=i[h],S=e[h];return !!S&&!!c&&(o||a())-c>S});},ft=new WeakMap,it=new WeakMap,wt=new WeakMap,W=new WeakMap,Qt=function(){let e=new Ft(t(this,$));u(this,J,0),u(this,Q,e),u(this,ut,i=>{u(this,J,t(this,J)-e[i]),e[i]=0;}),u(this,xt,(i,s,r,o)=>{if(l(this,n,v).call(this,s))return 0;if(!rt(r))if(o){if(typeof o!="function")throw new TypeError("sizeCalculation must be a function");if(r=o(s,i),!rt(r))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return r}),u(this,Tt,(i,s,r)=>{if(e[i]=s,t(this,z)){let o=t(this,z)-e[i];for(;t(this,J)>o;)l(this,n,Dt).call(this,true);}u(this,J,t(this,J)+e[i]),r&&(r.entrySize=s,r.totalCalculatedSize=t(this,J));});},ut=new WeakMap,Tt=new WeakMap,xt=new WeakMap,at=function*({allowStale:e=this.allowStale}={}){if(t(this,R))for(let i=t(this,N);!(!l(this,n,Pt).call(this,i)||((e||!t(this,W).call(this,i))&&(yield i),i===t(this,M)));)i=t(this,Y)[i];},ot=function*({allowStale:e=this.allowStale}={}){if(t(this,R))for(let i=t(this,M);!(!l(this,n,Pt).call(this,i)||((e||!t(this,W).call(this,i))&&(yield i),i===t(this,N)));)i=t(this,L)[i];},Pt=function(e){return e!==void 0&&t(this,x).get(t(this,O)[e])===e},Dt=function(e){var o;let i=t(this,M),s=t(this,O)[i],r=t(this,g)[i];return t(this,lt)&&l(this,n,v).call(this,r)?r.__abortController.abort(new Error("evicted")):(t(this,tt)||t(this,V))&&(t(this,tt)&&((o=t(this,k))==null||o.call(this,r,s,"evict")),t(this,V)&&t(this,F)?.push([r,s,"evict"])),t(this,ut).call(this,i),t(this,K)?.[i]&&(clearTimeout(t(this,K)[i]),t(this,K)[i]=void 0),e&&(t(this,O)[i]=void 0,t(this,g)[i]=void 0,t(this,q).push(i)),t(this,R)===1?(u(this,M,u(this,N,0)),t(this,q).length=0):u(this,M,t(this,L)[i]),t(this,x).delete(s),It(this,R)._--,i},Mt=function(e,i,s,r){let o=i===void 0?void 0:t(this,g)[i];if(l(this,n,v).call(this,o))return o;let a=new Ct,{signal:h}=s;h?.addEventListener("abort",()=>a.abort(h.reason),{signal:a.signal});let c={signal:a.signal,options:s,context:r},S=(y,A=false)=>{let{aborted:d}=a.signal,C=s.ignoreFetchAbort&&y!==void 0,U=s.ignoreFetchAbort||!!(s.allowStaleOnFetchAbort&&y!==void 0);if(s.status&&(d&&!A?(s.status.fetchAborted=true,s.status.fetchError=a.signal.reason,C&&(s.status.fetchAbortIgnored=true)):s.status.fetchResolved=true),d&&!C&&!A)return p(a.signal.reason,U);let G=T,w=t(this,g)[i];return (w===T||C&&A&&w===void 0)&&(y===void 0?G.__staleWhileFetching!==void 0?t(this,g)[i]=G.__staleWhileFetching:l(this,n,nt).call(this,e,"fetch"):(s.status&&(s.status.fetchUpdated=true),this.set(e,y,c.options))),y},I=y=>(s.status&&(s.status.fetchRejected=true,s.status.fetchError=y),p(y,false)),p=(y,A)=>{let{aborted:d}=a.signal,C=d&&s.allowStaleOnFetchAbort,U=C||s.allowStaleOnFetchRejection,G=U||s.noDeleteOnFetchRejection,w=T;if(t(this,g)[i]===T&&(!G||!A&&w.__staleWhileFetching===void 0?l(this,n,nt).call(this,e,"fetch"):C||(t(this,g)[i]=w.__staleWhileFetching)),U)return s.status&&w.__staleWhileFetching!==void 0&&(s.status.returnedStale=true),w.__staleWhileFetching;if(w.__returned===w)throw y},b=(y,A)=>{var C;let d=(C=t(this,mt))==null?void 0:C.call(this,e,o,c);d&&d instanceof Promise&&d.then(U=>y(U===void 0?void 0:U),A),a.signal.addEventListener("abort",()=>{(!s.ignoreFetchAbort||s.allowStaleOnFetchAbort)&&(y(void 0),s.allowStaleOnFetchAbort&&(y=U=>S(U,true)));});};s.status&&(s.status.fetchDispatched=true);let T=new Promise(b).then(S,I),E=Object.assign(T,{__abortController:a,__staleWhileFetching:o,__returned:void 0});return i===void 0?(this.set(e,E,{...c.options,status:void 0}),i=t(this,x).get(e)):t(this,g)[i]=E,E},v=function(e){if(!t(this,lt))return false;let i=e;return !!i&&i instanceof Promise&&i.hasOwnProperty("__staleWhileFetching")&&i.__abortController instanceof Ct},Kt=function(e,i){t(this,Y)[i]=e,t(this,L)[e]=i;},Ot=function(e){e!==t(this,N)&&(e===t(this,M)?u(this,M,t(this,L)[e]):l(this,n,Kt).call(this,t(this,Y)[e],t(this,L)[e]),l(this,n,Kt).call(this,t(this,N),e),u(this,N,e));},nt=function(e,i){var r,o;let s=false;if(t(this,R)!==0){let a=t(this,x).get(e);if(a!==void 0)if(t(this,K)?.[a]&&(clearTimeout(t(this,K)?.[a]),t(this,K)[a]=void 0),s=true,t(this,R)===1)l(this,n,Wt).call(this,i);else {t(this,ut).call(this,a);let h=t(this,g)[a];if(l(this,n,v).call(this,h)?h.__abortController.abort(new Error("deleted")):(t(this,tt)||t(this,V))&&(t(this,tt)&&((r=t(this,k))==null||r.call(this,h,e,i)),t(this,V)&&t(this,F)?.push([h,e,i])),t(this,x).delete(e),t(this,O)[a]=void 0,t(this,g)[a]=void 0,a===t(this,N))u(this,N,t(this,Y)[a]);else if(a===t(this,M))u(this,M,t(this,L)[a]);else {let c=t(this,Y)[a];t(this,L)[c]=t(this,L)[a];let S=t(this,L)[a];t(this,Y)[S]=t(this,Y)[a];}It(this,R)._--,t(this,q).push(a);}}if(t(this,V)&&t(this,F)?.length){let a=t(this,F),h;for(;h=a?.shift();)(o=t(this,B))==null||o.call(this,...h);}return s},Wt=function(e){var i,s;for(let r of l(this,n,ot).call(this,{allowStale:true})){let o=t(this,g)[r];if(l(this,n,v).call(this,o))o.__abortController.abort(new Error("deleted"));else {let a=t(this,O)[r];t(this,tt)&&((i=t(this,k))==null||i.call(this,o,a,e)),t(this,V)&&t(this,F)?.push([o,a,e]);}}if(t(this,x).clear(),t(this,g).fill(void 0),t(this,O).fill(void 0),t(this,P)&&t(this,Z)){t(this,P).fill(0),t(this,Z).fill(0);for(let r of t(this,K)??[])r!==void 0&&clearTimeout(r);t(this,K)?.fill(void 0);}if(t(this,Q)&&t(this,Q).fill(0),u(this,M,0),u(this,N,0),t(this,q).length=0,u(this,J,0),u(this,R,0),t(this,V)&&t(this,F)){let r=t(this,F),o;for(;o=r?.shift();)(s=t(this,B))==null||s.call(this,...o);}},bt);var yt=class{cache;map=new Map;constructor(e){this.cache=new qt({max:e.cacheSize}),this.map=new Map;}get[Symbol.iterator](){return this.map[Symbol.iterator]}get[Symbol.toStringTag](){return this.map[Symbol.toStringTag]}clear(){this.cache.clear(),this.map.clear();}delete(e){let i=this.map.delete(e);return i&&this.cache.delete(e),i}get forEach(){return this.map.forEach}get(e){let i=this.cache.get(e);return i||this.map.get(e)}has(e){return this.map.has(e)}set(e,i){return this.map.set(e,i),this.cache.set(e,i),this}get size(){return this.map.size}entries(){return this.map.entries()}keys(){return this.map.keys()}values(){return this.map.values()}};var At;(r=>(r.log=(o,...a)=>console.log(`[Pixi\u2019VN] ${o}`,...a),r.warn=(o,...a)=>console.warn(`[Pixi\u2019VN] ${o}`,...a),r.error=(o,...a)=>console.error(`[Pixi\u2019VN] ${o}`,...a),r.info=(o,...a)=>console.info(`[Pixi\u2019VN] ${o}`,...a)))(At||={});function Gt(f){try{if(typeof f>"u")return f;let e=JSON.stringify(f);return JSON.parse(e)}catch(e){throw At.error("Error creating exportable element",f,e),new core.PixiError("not_json_serializable","Error creating exportable element")}}var Zt;(p=>{p.storage=new yt({cacheSize:50}),p.defaultStorage=new yt({cacheSize:10}),p.tempStorageDeadlines=new Map;let s;function r(b){p.tempStorageDeadlines.forEach((T,E)=>{T>b&&(p.storage.delete(`${ht}:${E}`),s?.onClearOldTempVariable?.(E),p.tempStorageDeadlines.delete(E));});}p.clearOldTempVariables=r;function o(b){s=b;}p.setExternalStoreHandler=o;function a(b,T,E){E==null?p.storage.delete(`${b}:${T}`):p.storage.set(`${b}:${T}`,E),s?.onSetVariable?.(T,E);}p.setVariable=a;function h(b,T){let E=p.storage.get(`${b}:${T}`);return Gt(E)}p.getVariable=h;function c(b,T){p.storage.delete(`${b}:${T}`),s?.onRemoveVariable?.(T);}p.removeVariable=c;function S(b,T){let E=p.storage.get(Nt)||[];if(T)E.includes(b)||E.push(b);else {let y=E.indexOf(b);y>-1&&E.splice(y,1);}p.storage.set(Nt,E);}p.setFlag=S;function I(b){return (p.storage.get(Nt)||[]).includes(b)}p.getFlag=I;})(Zt||={});var m=Zt;var Rt=class{get base(){return m.storage.map}get cache(){return m.storage.cache}get tempStorageDeadlines(){return m.tempStorageDeadlines}set default(e){Object.entries(e).forEach(([i,s])=>{m.defaultStorage.map.set(i,s);});}temp={set:(e,i)=>this.setTemp(e,i),remove:e=>this.removeTemp(e),get deadlines(){return m.tempStorageDeadlines}};flags={set:(e,i)=>m.setFlag(e,i),get:e=>m.getFlag(e)};set(e,i){return m.setVariable(st,e,i)}get(e){let i=m.getVariable(ht,e);return i===void 0&&(i=m.getVariable(st,e)),i===void 0&&(i=Gt(m.defaultStorage.get(e))),i}remove(e){return this.temp.remove(e),m.removeVariable(st,e)}setTemp(e,i){if(i==null){this.temp.remove(e);return}else m.setVariable(ht,e,i),this.temp.deadlines.has(e)||this.temp.deadlines.set(e,core.GameUnifier.openedLabels);}removeTemp(e){m.removeVariable(ht,e),this.temp.deadlines.has(e)&&this.temp.deadlines.delete(e);}setTempVariable(e,i){this.temp.set(e,i);}removeTempVariable(e){this.temp.remove(e);}setFlag(e,i){this.flags.set(e,i);}getFlag(e){return this.flags.get(e)}setStorageHandler(e){m.setExternalStoreHandler(e);}clear(){this.base.clear(),this.cache.clear(),this.temp.deadlines.clear();}async export(){let e=[];[...this.base.keys()].forEach(s=>{e.push({key:s,value:this.base.get(s)});});let i=[];return [...this.temp.deadlines.keys()].forEach(s=>{i.push({key:s,value:this.temp.deadlines.get(s)});}),worker.cloneMaybeOffloaded({main:e,tempDeadlines:i})}restore(e){this.clear();try{e?(e.base?.forEach(i=>{switch(i.key){case "___current_dialogue_memory___":m.setVariable(H,j.CURRENT_DIALOGUE_MEMORY_KEY,i.value);break;case "___last_dialogue_added_in_step_memory___":m.setVariable(H,j.LAST_DIALOGUE_ADDED_IN_STEP_MEMORY_KEY,i.value);break;case "___current_menu_options_memory___":m.setVariable(H,j.CURRENT_MENU_OPTIONS_MEMORY_KEY,i.value);break;case "___last_menu_options_added_in_step_memory___":m.setVariable(H,j.LAST_MENU_OPTIONS_ADDED_IN_STEP_MEMORY_KEY,i.value);break;case "_input_value_":m.setVariable(H,j.CURRENT_INPUT_VALUE_MEMORY_KEY,i.value);break;case "___last_input_added_in_step_memory___":m.setVariable(H,j.LAST_INPUT_ADDED_IN_STEP_MEMORY_KEY,i.value);break;case "___current_input_info_memory___":m.setVariable(H,j.CURRENT_INPUT_INFO_MEMORY_KEY,i.value);break;case "___opened_labels_counter___":m.setVariable(H,j.OPENED_LABELS_COUNTER_KEY,i.value);break;case "___all_choices_made___":m.setVariable(H,j.ALL_CHOICES_MADE_KEY,i.value);break;case "___current_step_times_counter___":m.setVariable(H,j.CURRENT_STEP_TIMES_COUNTER_KEY,i.value);break;case "___last_step_glued___":m.setVariable(H,j.LAST_STEP_GLUED,i.value);break;default:m.setVariable(st,i.key,i.value);}}),e.temp?.forEach(i=>{m.setVariable(ht,i.key,i.value);}),e.flags?.forEach(i=>{m.setFlag(i,!0);}),e.main?.forEach(i=>{this.base.set(i.key,i.value);}),e.tempDeadlines?.forEach(i=>{this.temp.deadlines.set(i.key,i.value);})):At.warn("No storage data found");}catch(i){At.error("Error importing data",i);}}};var Lt=class{constructor(e,i){this.categoryId=e,this.id=i,this.migrateOldStorage();}migrateOldStorage(e=this.categoryId){let i=m.getVariable(st,e);i&&(Object.entries(i).forEach(([s,r])=>{typeof r=="object"&&r!==null&&Object.entries(r).forEach(([o,a])=>{m.setVariable(this.categoryId,`${s}:${o}`,a);});}),m.removeVariable(st,e));}id;categoryId;setStorageProperty(e,i){m.setVariable(this.categoryId,`${this.id}:${e}`,i);}getStorageProperty(e,i=this.id){return m.getVariable(this.categoryId,`${i}:${e}`)}};var Le=new Rt;exports.StorageRegistry=m;exports.StoredClassModel=Lt;exports.storage=Le;
1
+ 'use strict';var core=require('@drincs/pixi-vn/core'),worker=require('@drincs/pixi-vn/worker');var Qt=Object.defineProperty;var Wt=l=>{throw TypeError(l)};var Zt=(l,t,i)=>t in l?Qt(l,t,{enumerable:true,configurable:true,writable:true,value:i}):l[t]=i;var M=(l,t,i)=>Zt(l,typeof t!="symbol"?t+"":t,i),Ct=(l,t,i)=>t.has(l)||Wt("Cannot "+i);var e=(l,t,i)=>(Ct(l,t,"read from private field"),i?i.call(l):t.get(l)),m=(l,t,i)=>t.has(l)?Wt("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(l):t.set(l,i),f=(l,t,i,s)=>(Ct(l,t,"write to private field"),t.set(l,i),i),h=(l,t,i)=>(Ct(l,t,"access private method"),i);var Ot=(l,t,i,s)=>({set _(a){f(l,t,a);},get _(){return e(l,t,s)}});var et="storage",ot="temp",K="narration",Rt="flags",W={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 ct=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,kt=new Set,Vt=typeof process=="object"&&process?process:{},Bt=(l,t,i,s)=>{typeof Vt.emitWarning=="function"?Vt.emitWarning(l,t,i,s):console.error(`[${i}] ${t}: ${l}`);},Nt=globalThis.AbortController,Ht=globalThis.AbortSignal;if(typeof Nt>"u"){Ht=class{onabort;_onabort=[];reason;aborted=false;addEventListener(s,a){this._onabort.push(a);}},Nt=class{constructor(){t();}signal=new Ht;abort(s){if(!this.signal.aborted){this.signal.reason=s,this.signal.aborted=true;for(let a of this.signal._onabort)a(s);this.signal.onabort?.(s);}}};let l=Vt.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",t=()=>{l&&(l=false,Bt("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 te=l=>!kt.has(l);var it=l=>l&&l===Math.floor(l)&&l>0&&isFinite(l),Xt=l=>it(l)?l<=Math.pow(2,8)?Uint8Array:l<=Math.pow(2,16)?Uint16Array:l<=Math.pow(2,32)?Uint32Array:l<=Number.MAX_SAFE_INTEGER?ut:null:null,ut=class extends Array{constructor(t){super(t),this.fill(0);}},dt,ht=class ht{heap;length;static create(t){let i=Xt(t);if(!i)return [];f(ht,dt,true);let s=new ht(t,i);return f(ht,dt,false),s}constructor(t,i){if(!e(ht,dt))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new i(t),this.length=0;}push(t){this.heap[this.length++]=t;}pop(){return this.heap[--this.length]}};dt=new WeakMap,m(ht,dt,false);var Lt=ht,$t,jt,$,L,j,k,gt,_t,I,B,R,A,d,F,z,D,x,X,N,q,J,G,Q,at,C,o,zt,lt,Z,Tt,U,qt,ft,pt,yt,st,rt,Gt,It,xt,y,Ut,bt,nt,Yt,Pt=class Pt{constructor(t){m(this,o);m(this,$);m(this,L);m(this,j);m(this,k);m(this,gt);m(this,_t);M(this,"ttl");M(this,"ttlResolution");M(this,"ttlAutopurge");M(this,"updateAgeOnGet");M(this,"updateAgeOnHas");M(this,"allowStale");M(this,"noDisposeOnSet");M(this,"noUpdateTTL");M(this,"maxEntrySize");M(this,"sizeCalculation");M(this,"noDeleteOnFetchRejection");M(this,"noDeleteOnStaleGet");M(this,"allowStaleOnFetchAbort");M(this,"allowStaleOnFetchRejection");M(this,"ignoreFetchAbort");m(this,I);m(this,B);m(this,R);m(this,A);m(this,d);m(this,F);m(this,z);m(this,D);m(this,x);m(this,X);m(this,N);m(this,q);m(this,J);m(this,G);m(this,Q);m(this,at);m(this,C);m(this,lt,()=>{});m(this,Z,()=>{});m(this,Tt,()=>{});m(this,U,()=>false);m(this,ft,t=>{});m(this,pt,(t,i,s)=>{});m(this,yt,(t,i,s,a)=>{if(s||a)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});M(this,$t,"LRUCache");let{max:i=0,ttl:s,ttlResolution:a=1,ttlAutopurge:r,updateAgeOnGet:n,updateAgeOnHas:u,allowStale:c,dispose:O,disposeAfter:H,noDisposeOnSet:g,noUpdateTTL:T,maxSize:b=0,maxEntrySize:E=0,sizeCalculation:p,fetchMethod:w,memoMethod:S,noDeleteOnFetchRejection:Y,noDeleteOnStaleGet:V,allowStaleOnFetchRejection:v,allowStaleOnFetchAbort:P,ignoreFetchAbort:Et}=t;if(i!==0&&!it(i))throw new TypeError("max option must be a nonnegative integer");let tt=i?Xt(i):Array;if(!tt)throw new Error("invalid max value: "+i);if(f(this,$,i),f(this,L,b),this.maxEntrySize=E||e(this,L),this.sizeCalculation=p,this.sizeCalculation){if(!e(this,L)&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(S!==void 0&&typeof S!="function")throw new TypeError("memoMethod must be a function if defined");if(f(this,_t,S),w!==void 0&&typeof w!="function")throw new TypeError("fetchMethod must be a function if specified");if(f(this,gt,w),f(this,at,!!w),f(this,R,new Map),f(this,A,new Array(i).fill(void 0)),f(this,d,new Array(i).fill(void 0)),f(this,F,new tt(i)),f(this,z,new tt(i)),f(this,D,0),f(this,x,0),f(this,X,Lt.create(i)),f(this,I,0),f(this,B,0),typeof O=="function"&&f(this,j,O),typeof H=="function"?(f(this,k,H),f(this,N,[])):(f(this,k,void 0),f(this,N,void 0)),f(this,Q,!!e(this,j)),f(this,C,!!e(this,k)),this.noDisposeOnSet=!!g,this.noUpdateTTL=!!T,this.noDeleteOnFetchRejection=!!Y,this.allowStaleOnFetchRejection=!!v,this.allowStaleOnFetchAbort=!!P,this.ignoreFetchAbort=!!Et,this.maxEntrySize!==0){if(e(this,L)!==0&&!it(e(this,L)))throw new TypeError("maxSize must be a positive integer if specified");if(!it(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");h(this,o,qt).call(this);}if(this.allowStale=!!c,this.noDeleteOnStaleGet=!!V,this.updateAgeOnGet=!!n,this.updateAgeOnHas=!!u,this.ttlResolution=it(a)||a===0?a:1,this.ttlAutopurge=!!r,this.ttl=s||0,this.ttl){if(!it(this.ttl))throw new TypeError("ttl must be a positive integer if specified");h(this,o,zt).call(this);}if(e(this,$)===0&&this.ttl===0&&e(this,L)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!e(this,$)&&!e(this,L)){let wt="LRU_CACHE_UNBOUNDED";te(wt)&&(kt.add(wt),Bt("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",wt,Pt));}}static unsafeExposeInternals(t){return {starts:e(t,J),ttls:e(t,G),sizes:e(t,q),keyMap:e(t,R),keyList:e(t,A),valList:e(t,d),next:e(t,F),prev:e(t,z),get head(){return e(t,D)},get tail(){return e(t,x)},free:e(t,X),isBackgroundFetch:i=>{var s;return h(s=t,o,y).call(s,i)},backgroundFetch:(i,s,a,r)=>{var n;return h(n=t,o,xt).call(n,i,s,a,r)},moveToTail:i=>{var s;return h(s=t,o,bt).call(s,i)},indexes:i=>{var s;return h(s=t,o,st).call(s,i)},rindexes:i=>{var s;return h(s=t,o,rt).call(s,i)},isStale:i=>{var s;return e(s=t,U).call(s,i)}}}get max(){return e(this,$)}get maxSize(){return e(this,L)}get calculatedSize(){return e(this,B)}get size(){return e(this,I)}get fetchMethod(){return e(this,gt)}get memoMethod(){return e(this,_t)}get dispose(){return e(this,j)}get disposeAfter(){return e(this,k)}getRemainingTTL(t){return e(this,R).has(t)?1/0:0}*entries(){for(let t of h(this,o,st).call(this))e(this,d)[t]!==void 0&&e(this,A)[t]!==void 0&&!h(this,o,y).call(this,e(this,d)[t])&&(yield [e(this,A)[t],e(this,d)[t]]);}*rentries(){for(let t of h(this,o,rt).call(this))e(this,d)[t]!==void 0&&e(this,A)[t]!==void 0&&!h(this,o,y).call(this,e(this,d)[t])&&(yield [e(this,A)[t],e(this,d)[t]]);}*keys(){for(let t of h(this,o,st).call(this)){let i=e(this,A)[t];i!==void 0&&!h(this,o,y).call(this,e(this,d)[t])&&(yield i);}}*rkeys(){for(let t of h(this,o,rt).call(this)){let i=e(this,A)[t];i!==void 0&&!h(this,o,y).call(this,e(this,d)[t])&&(yield i);}}*values(){for(let t of h(this,o,st).call(this))e(this,d)[t]!==void 0&&!h(this,o,y).call(this,e(this,d)[t])&&(yield e(this,d)[t]);}*rvalues(){for(let t of h(this,o,rt).call(this))e(this,d)[t]!==void 0&&!h(this,o,y).call(this,e(this,d)[t])&&(yield e(this,d)[t]);}[(jt=Symbol.iterator,$t=Symbol.toStringTag,jt)](){return this.entries()}find(t,i={}){for(let s of h(this,o,st).call(this)){let a=e(this,d)[s],r=h(this,o,y).call(this,a)?a.__staleWhileFetching:a;if(r!==void 0&&t(r,e(this,A)[s],this))return this.get(e(this,A)[s],i)}}forEach(t,i=this){for(let s of h(this,o,st).call(this)){let a=e(this,d)[s],r=h(this,o,y).call(this,a)?a.__staleWhileFetching:a;r!==void 0&&t.call(i,r,e(this,A)[s],this);}}rforEach(t,i=this){for(let s of h(this,o,rt).call(this)){let a=e(this,d)[s],r=h(this,o,y).call(this,a)?a.__staleWhileFetching:a;r!==void 0&&t.call(i,r,e(this,A)[s],this);}}purgeStale(){let t=false;for(let i of h(this,o,rt).call(this,{allowStale:true}))e(this,U).call(this,i)&&(h(this,o,nt).call(this,e(this,A)[i],"expire"),t=true);return t}info(t){let i=e(this,R).get(t);if(i===void 0)return;let s=e(this,d)[i],a=h(this,o,y).call(this,s)?s.__staleWhileFetching:s;if(a===void 0)return;let r={value:a};if(e(this,G)&&e(this,J)){let n=e(this,G)[i],u=e(this,J)[i];if(n&&u){let c=n-(ct.now()-u);r.ttl=c,r.start=Date.now();}}return e(this,q)&&(r.size=e(this,q)[i]),r}dump(){let t=[];for(let i of h(this,o,st).call(this,{allowStale:true})){let s=e(this,A)[i],a=e(this,d)[i],r=h(this,o,y).call(this,a)?a.__staleWhileFetching:a;if(r===void 0||s===void 0)continue;let n={value:r};if(e(this,G)&&e(this,J)){n.ttl=e(this,G)[i];let u=ct.now()-e(this,J)[i];n.start=Math.floor(Date.now()-u);}e(this,q)&&(n.size=e(this,q)[i]),t.unshift([s,n]);}return t}load(t){this.clear();for(let[i,s]of t){if(s.start){let a=Date.now()-s.start;s.start=ct.now()-a;}this.set(i,s.value,s);}}set(t,i,s={}){var T,b,E;if(i===void 0)return this.delete(t),this;let{ttl:a=this.ttl,start:r,noDisposeOnSet:n=this.noDisposeOnSet,sizeCalculation:u=this.sizeCalculation,status:c}=s,{noUpdateTTL:O=this.noUpdateTTL}=s,H=e(this,yt).call(this,t,i,s.size||0,u);if(this.maxEntrySize&&H>this.maxEntrySize)return c&&(c.set="miss",c.maxEntrySizeExceeded=true),h(this,o,nt).call(this,t,"set"),this;let g=e(this,I)===0?void 0:e(this,R).get(t);if(g===void 0)g=e(this,I)===0?e(this,x):e(this,X).length!==0?e(this,X).pop():e(this,I)===e(this,$)?h(this,o,It).call(this,false):e(this,I),e(this,A)[g]=t,e(this,d)[g]=i,e(this,R).set(t,g),e(this,F)[e(this,x)]=g,e(this,z)[g]=e(this,x),f(this,x,g),Ot(this,I)._++,e(this,pt).call(this,g,H,c),c&&(c.set="add"),O=false;else {h(this,o,bt).call(this,g);let p=e(this,d)[g];if(i!==p){if(e(this,at)&&h(this,o,y).call(this,p)){p.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:w}=p;w!==void 0&&!n&&(e(this,Q)&&((T=e(this,j))==null||T.call(this,w,t,"set")),e(this,C)&&e(this,N)?.push([w,t,"set"]));}else n||(e(this,Q)&&((b=e(this,j))==null||b.call(this,p,t,"set")),e(this,C)&&e(this,N)?.push([p,t,"set"]));if(e(this,ft).call(this,g),e(this,pt).call(this,g,H,c),e(this,d)[g]=i,c){c.set="replace";let w=p&&h(this,o,y).call(this,p)?p.__staleWhileFetching:p;w!==void 0&&(c.oldValue=w);}}else c&&(c.set="update");}if(a!==0&&!e(this,G)&&h(this,o,zt).call(this),e(this,G)&&(O||e(this,Tt).call(this,g,a,r),c&&e(this,Z).call(this,c,g)),!n&&e(this,C)&&e(this,N)){let p=e(this,N),w;for(;w=p?.shift();)(E=e(this,k))==null||E.call(this,...w);}return this}pop(){var t;try{for(;e(this,I);){let i=e(this,d)[e(this,D)];if(h(this,o,It).call(this,!0),h(this,o,y).call(this,i)){if(i.__staleWhileFetching)return i.__staleWhileFetching}else if(i!==void 0)return i}}finally{if(e(this,C)&&e(this,N)){let i=e(this,N),s;for(;s=i?.shift();)(t=e(this,k))==null||t.call(this,...s);}}}has(t,i={}){let{updateAgeOnHas:s=this.updateAgeOnHas,status:a}=i,r=e(this,R).get(t);if(r!==void 0){let n=e(this,d)[r];if(h(this,o,y).call(this,n)&&n.__staleWhileFetching===void 0)return false;if(e(this,U).call(this,r))a&&(a.has="stale",e(this,Z).call(this,a,r));else return s&&e(this,lt).call(this,r),a&&(a.has="hit",e(this,Z).call(this,a,r)),true}else a&&(a.has="miss");return false}peek(t,i={}){let{allowStale:s=this.allowStale}=i,a=e(this,R).get(t);if(a===void 0||!s&&e(this,U).call(this,a))return;let r=e(this,d)[a];return h(this,o,y).call(this,r)?r.__staleWhileFetching:r}async fetch(t,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:a=this.updateAgeOnGet,noDeleteOnStaleGet:r=this.noDeleteOnStaleGet,ttl:n=this.ttl,noDisposeOnSet:u=this.noDisposeOnSet,size:c=0,sizeCalculation:O=this.sizeCalculation,noUpdateTTL:H=this.noUpdateTTL,noDeleteOnFetchRejection:g=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:T=this.allowStaleOnFetchRejection,ignoreFetchAbort:b=this.ignoreFetchAbort,allowStaleOnFetchAbort:E=this.allowStaleOnFetchAbort,context:p,forceRefresh:w=false,status:S,signal:Y}=i;if(!e(this,at))return S&&(S.fetch="get"),this.get(t,{allowStale:s,updateAgeOnGet:a,noDeleteOnStaleGet:r,status:S});let V={allowStale:s,updateAgeOnGet:a,noDeleteOnStaleGet:r,ttl:n,noDisposeOnSet:u,size:c,sizeCalculation:O,noUpdateTTL:H,noDeleteOnFetchRejection:g,allowStaleOnFetchRejection:T,allowStaleOnFetchAbort:E,ignoreFetchAbort:b,status:S,signal:Y},v=e(this,R).get(t);if(v===void 0){S&&(S.fetch="miss");let P=h(this,o,xt).call(this,t,v,V,p);return P.__returned=P}else {let P=e(this,d)[v];if(h(this,o,y).call(this,P)){let Kt=s&&P.__staleWhileFetching!==void 0;return S&&(S.fetch="inflight",Kt&&(S.returnedStale=true)),Kt?P.__staleWhileFetching:P.__returned=P}let Et=e(this,U).call(this,v);if(!w&&!Et)return S&&(S.fetch="hit"),h(this,o,bt).call(this,v),a&&e(this,lt).call(this,v),S&&e(this,Z).call(this,S,v),P;let tt=h(this,o,xt).call(this,t,v,V,p),Ft=tt.__staleWhileFetching!==void 0&&s;return S&&(S.fetch=Et?"stale":"refresh",Ft&&Et&&(S.returnedStale=true)),Ft?tt.__staleWhileFetching:tt.__returned=tt}}async forceFetch(t,i={}){let s=await this.fetch(t,i);if(s===void 0)throw new Error("fetch() returned undefined");return s}memo(t,i={}){let s=e(this,_t);if(!s)throw new Error("no memoMethod provided to constructor");let{context:a,forceRefresh:r,...n}=i,u=this.get(t,n);if(!r&&u!==void 0)return u;let c=s(t,u,{options:n,context:a});return this.set(t,c,n),c}get(t,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:a=this.updateAgeOnGet,noDeleteOnStaleGet:r=this.noDeleteOnStaleGet,status:n}=i,u=e(this,R).get(t);if(u!==void 0){let c=e(this,d)[u],O=h(this,o,y).call(this,c);return n&&e(this,Z).call(this,n,u),e(this,U).call(this,u)?(n&&(n.get="stale"),O?(n&&s&&c.__staleWhileFetching!==void 0&&(n.returnedStale=true),s?c.__staleWhileFetching:void 0):(r||h(this,o,nt).call(this,t,"expire"),n&&s&&(n.returnedStale=true),s?c:void 0)):(n&&(n.get="hit"),O?c.__staleWhileFetching:(h(this,o,bt).call(this,u),a&&e(this,lt).call(this,u),c))}else n&&(n.get="miss");}delete(t){return h(this,o,nt).call(this,t,"delete")}clear(){return h(this,o,Yt).call(this,"delete")}};$=new WeakMap,L=new WeakMap,j=new WeakMap,k=new WeakMap,gt=new WeakMap,_t=new WeakMap,I=new WeakMap,B=new WeakMap,R=new WeakMap,A=new WeakMap,d=new WeakMap,F=new WeakMap,z=new WeakMap,D=new WeakMap,x=new WeakMap,X=new WeakMap,N=new WeakMap,q=new WeakMap,J=new WeakMap,G=new WeakMap,Q=new WeakMap,at=new WeakMap,C=new WeakMap,o=new WeakSet,zt=function(){let t=new ut(e(this,$)),i=new ut(e(this,$));f(this,G,t),f(this,J,i),f(this,Tt,(r,n,u=ct.now())=>{if(i[r]=n!==0?u:0,t[r]=n,n!==0&&this.ttlAutopurge){let c=setTimeout(()=>{e(this,U).call(this,r)&&h(this,o,nt).call(this,e(this,A)[r],"expire");},n+1);c.unref&&c.unref();}}),f(this,lt,r=>{i[r]=t[r]!==0?ct.now():0;}),f(this,Z,(r,n)=>{if(t[n]){let u=t[n],c=i[n];if(!u||!c)return;r.ttl=u,r.start=c,r.now=s||a();let O=r.now-c;r.remainingTTL=u-O;}});let s=0,a=()=>{let r=ct.now();if(this.ttlResolution>0){s=r;let n=setTimeout(()=>s=0,this.ttlResolution);n.unref&&n.unref();}return r};this.getRemainingTTL=r=>{let n=e(this,R).get(r);if(n===void 0)return 0;let u=t[n],c=i[n];if(!u||!c)return 1/0;let O=(s||a())-c;return u-O},f(this,U,r=>{let n=i[r],u=t[r];return !!u&&!!n&&(s||a())-n>u});},lt=new WeakMap,Z=new WeakMap,Tt=new WeakMap,U=new WeakMap,qt=function(){let t=new ut(e(this,$));f(this,B,0),f(this,q,t),f(this,ft,i=>{f(this,B,e(this,B)-t[i]),t[i]=0;}),f(this,yt,(i,s,a,r)=>{if(h(this,o,y).call(this,s))return 0;if(!it(a))if(r){if(typeof r!="function")throw new TypeError("sizeCalculation must be a function");if(a=r(s,i),!it(a))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 a}),f(this,pt,(i,s,a)=>{if(t[i]=s,e(this,L)){let r=e(this,L)-t[i];for(;e(this,B)>r;)h(this,o,It).call(this,true);}f(this,B,e(this,B)+t[i]),a&&(a.entrySize=s,a.totalCalculatedSize=e(this,B));});},ft=new WeakMap,pt=new WeakMap,yt=new WeakMap,st=function*({allowStale:t=this.allowStale}={}){if(e(this,I))for(let i=e(this,x);!(!h(this,o,Gt).call(this,i)||((t||!e(this,U).call(this,i))&&(yield i),i===e(this,D)));)i=e(this,z)[i];},rt=function*({allowStale:t=this.allowStale}={}){if(e(this,I))for(let i=e(this,D);!(!h(this,o,Gt).call(this,i)||((t||!e(this,U).call(this,i))&&(yield i),i===e(this,x)));)i=e(this,F)[i];},Gt=function(t){return t!==void 0&&e(this,R).get(e(this,A)[t])===t},It=function(t){var r;let i=e(this,D),s=e(this,A)[i],a=e(this,d)[i];return e(this,at)&&h(this,o,y).call(this,a)?a.__abortController.abort(new Error("evicted")):(e(this,Q)||e(this,C))&&(e(this,Q)&&((r=e(this,j))==null||r.call(this,a,s,"evict")),e(this,C)&&e(this,N)?.push([a,s,"evict"])),e(this,ft).call(this,i),t&&(e(this,A)[i]=void 0,e(this,d)[i]=void 0,e(this,X).push(i)),e(this,I)===1?(f(this,D,f(this,x,0)),e(this,X).length=0):f(this,D,e(this,F)[i]),e(this,R).delete(s),Ot(this,I)._--,i},xt=function(t,i,s,a){let r=i===void 0?void 0:e(this,d)[i];if(h(this,o,y).call(this,r))return r;let n=new Nt,{signal:u}=s;u?.addEventListener("abort",()=>n.abort(u.reason),{signal:n.signal});let c={signal:n.signal,options:s,context:a},O=(p,w=false)=>{let{aborted:S}=n.signal,Y=s.ignoreFetchAbort&&p!==void 0;if(s.status&&(S&&!w?(s.status.fetchAborted=true,s.status.fetchError=n.signal.reason,Y&&(s.status.fetchAbortIgnored=true)):s.status.fetchResolved=true),S&&!Y&&!w)return g(n.signal.reason);let V=b;return e(this,d)[i]===b&&(p===void 0?V.__staleWhileFetching?e(this,d)[i]=V.__staleWhileFetching:h(this,o,nt).call(this,t,"fetch"):(s.status&&(s.status.fetchUpdated=true),this.set(t,p,c.options))),p},H=p=>(s.status&&(s.status.fetchRejected=true,s.status.fetchError=p),g(p)),g=p=>{let{aborted:w}=n.signal,S=w&&s.allowStaleOnFetchAbort,Y=S||s.allowStaleOnFetchRejection,V=Y||s.noDeleteOnFetchRejection,v=b;if(e(this,d)[i]===b&&(!V||v.__staleWhileFetching===void 0?h(this,o,nt).call(this,t,"fetch"):S||(e(this,d)[i]=v.__staleWhileFetching)),Y)return s.status&&v.__staleWhileFetching!==void 0&&(s.status.returnedStale=true),v.__staleWhileFetching;if(v.__returned===v)throw p},T=(p,w)=>{var Y;let S=(Y=e(this,gt))==null?void 0:Y.call(this,t,r,c);S&&S instanceof Promise&&S.then(V=>p(V===void 0?void 0:V),w),n.signal.addEventListener("abort",()=>{(!s.ignoreFetchAbort||s.allowStaleOnFetchAbort)&&(p(void 0),s.allowStaleOnFetchAbort&&(p=V=>O(V,true)));});};s.status&&(s.status.fetchDispatched=true);let b=new Promise(T).then(O,H),E=Object.assign(b,{__abortController:n,__staleWhileFetching:r,__returned:void 0});return i===void 0?(this.set(t,E,{...c.options,status:void 0}),i=e(this,R).get(t)):e(this,d)[i]=E,E},y=function(t){if(!e(this,at))return false;let i=t;return !!i&&i instanceof Promise&&i.hasOwnProperty("__staleWhileFetching")&&i.__abortController instanceof Nt},Ut=function(t,i){e(this,z)[i]=t,e(this,F)[t]=i;},bt=function(t){t!==e(this,x)&&(t===e(this,D)?f(this,D,e(this,F)[t]):h(this,o,Ut).call(this,e(this,z)[t],e(this,F)[t]),h(this,o,Ut).call(this,e(this,x),t),f(this,x,t));},nt=function(t,i){var a,r;let s=false;if(e(this,I)!==0){let n=e(this,R).get(t);if(n!==void 0)if(s=true,e(this,I)===1)h(this,o,Yt).call(this,i);else {e(this,ft).call(this,n);let u=e(this,d)[n];if(h(this,o,y).call(this,u)?u.__abortController.abort(new Error("deleted")):(e(this,Q)||e(this,C))&&(e(this,Q)&&((a=e(this,j))==null||a.call(this,u,t,i)),e(this,C)&&e(this,N)?.push([u,t,i])),e(this,R).delete(t),e(this,A)[n]=void 0,e(this,d)[n]=void 0,n===e(this,x))f(this,x,e(this,z)[n]);else if(n===e(this,D))f(this,D,e(this,F)[n]);else {let c=e(this,z)[n];e(this,F)[c]=e(this,F)[n];let O=e(this,F)[n];e(this,z)[O]=e(this,z)[n];}Ot(this,I)._--,e(this,X).push(n);}}if(e(this,C)&&e(this,N)?.length){let n=e(this,N),u;for(;u=n?.shift();)(r=e(this,k))==null||r.call(this,...u);}return s},Yt=function(t){var i,s;for(let a of h(this,o,rt).call(this,{allowStale:true})){let r=e(this,d)[a];if(h(this,o,y).call(this,r))r.__abortController.abort(new Error("deleted"));else {let n=e(this,A)[a];e(this,Q)&&((i=e(this,j))==null||i.call(this,r,n,t)),e(this,C)&&e(this,N)?.push([r,n,t]);}}if(e(this,R).clear(),e(this,d).fill(void 0),e(this,A).fill(void 0),e(this,G)&&e(this,J)&&(e(this,G).fill(0),e(this,J).fill(0)),e(this,q)&&e(this,q).fill(0),f(this,D,0),f(this,x,0),e(this,X).length=0,f(this,B,0),f(this,I,0),e(this,C)&&e(this,N)){let a=e(this,N),r;for(;r=a?.shift();)(s=e(this,k))==null||s.call(this,...r);}};var vt=Pt;var mt=class{cache;map=new Map;constructor(t){this.cache=new vt({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 i=this.map.delete(t);return i&&this.cache.delete(t),i}get forEach(){return this.map.forEach}get(t){let i=this.cache.get(t);return i||this.map.get(t)}has(t){return this.map.has(t)}set(t,i){return this.map.set(t,i),this.cache.set(t,i),this}get size(){return this.map.size}entries(){return this.map.entries()}keys(){return this.map.keys()}values(){return this.map.values()}};var St;(a=>(a.log=(r,...n)=>console.log(`[Pixi\u2019VN] ${r}`,...n),a.warn=(r,...n)=>console.warn(`[Pixi\u2019VN] ${r}`,...n),a.error=(r,...n)=>console.error(`[Pixi\u2019VN] ${r}`,...n),a.info=(r,...n)=>console.info(`[Pixi\u2019VN] ${r}`,...n)))(St||={});function Mt(l){try{if(typeof l>"u")return l;let t=JSON.stringify(l);return JSON.parse(t)}catch(t){throw St.error("Error creating exportable element",l,t),new core.PixiError("not_json_serializable","Error creating exportable element")}}var Jt;(g=>{g.storage=new mt({cacheSize:50}),g.defaultStorage=new mt({cacheSize:10}),g.tempStorageDeadlines=new Map;let s;function a(T){g.tempStorageDeadlines.forEach((b,E)=>{b>T&&(g.storage.delete(`${ot}:${E}`),s?.onClearOldTempVariable?.(E),g.tempStorageDeadlines.delete(E));});}g.clearOldTempVariables=a;function r(T){s=T;}g.setExternalStoreHandler=r;function n(T,b,E){E==null?g.storage.delete(`${T}:${b}`):g.storage.set(`${T}:${b}`,E),s?.onSetVariable?.(b,E);}g.setVariable=n;function u(T,b){let E=g.storage.get(`${T}:${b}`);return Mt(E)}g.getVariable=u;function c(T,b){g.storage.delete(`${T}:${b}`),s?.onRemoveVariable?.(b);}g.removeVariable=c;function O(T,b){let E=g.storage.get(Rt)||[];if(b)E.includes(T)||E.push(T);else {let p=E.indexOf(T);p>-1&&E.splice(p,1);}g.storage.set(Rt,E);}g.setFlag=O;function H(T){return (g.storage.get(Rt)||[]).includes(T)}g.getFlag=H;})(Jt||={});var _=Jt;var At=class{get base(){return _.storage.map}get cache(){return _.storage.cache}get tempStorageDeadlines(){return _.tempStorageDeadlines}set default(t){Object.entries(t).forEach(([i,s])=>{_.defaultStorage.map.set(i,s);});}temp={set:(t,i)=>this.setTemp(t,i),remove:t=>this.removeTemp(t),get deadlines(){return _.tempStorageDeadlines}};flags={set:(t,i)=>_.setFlag(t,i),get:t=>_.getFlag(t)};set(t,i){return _.setVariable(et,t,i)}get(t){let i=_.getVariable(ot,t);return i===void 0&&(i=_.getVariable(et,t)),i===void 0&&(i=Mt(_.defaultStorage.get(t))),i}remove(t){return this.temp.remove(t),_.removeVariable(et,t)}setTemp(t,i){if(i==null){this.temp.remove(t);return}else _.setVariable(ot,t,i),this.temp.deadlines.has(t)||this.temp.deadlines.set(t,core.GameUnifier.openedLabels);}removeTemp(t){_.removeVariable(ot,t),this.temp.deadlines.has(t)&&this.temp.deadlines.delete(t);}setTempVariable(t,i){this.temp.set(t,i);}removeTempVariable(t){this.temp.remove(t);}setFlag(t,i){this.flags.set(t,i);}getFlag(t){return this.flags.get(t)}setStorageHandler(t){_.setExternalStoreHandler(t);}clear(){this.base.clear(),this.cache.clear(),this.temp.deadlines.clear();}async export(){let t=[];[...this.base.keys()].forEach(s=>{t.push({key:s,value:this.base.get(s)});});let i=[];return [...this.temp.deadlines.keys()].forEach(s=>{i.push({key:s,value:this.temp.deadlines.get(s)});}),worker.cloneMaybeOffloaded({main:t,tempDeadlines:i})}restore(t){this.clear();try{t?(t.base?.forEach(i=>{switch(i.key){case "___current_dialogue_memory___":_.setVariable(K,W.CURRENT_DIALOGUE_MEMORY_KEY,i.value);break;case "___last_dialogue_added_in_step_memory___":_.setVariable(K,W.LAST_DIALOGUE_ADDED_IN_STEP_MEMORY_KEY,i.value);break;case "___current_menu_options_memory___":_.setVariable(K,W.CURRENT_MENU_OPTIONS_MEMORY_KEY,i.value);break;case "___last_menu_options_added_in_step_memory___":_.setVariable(K,W.LAST_MENU_OPTIONS_ADDED_IN_STEP_MEMORY_KEY,i.value);break;case "_input_value_":_.setVariable(K,W.CURRENT_INPUT_VALUE_MEMORY_KEY,i.value);break;case "___last_input_added_in_step_memory___":_.setVariable(K,W.LAST_INPUT_ADDED_IN_STEP_MEMORY_KEY,i.value);break;case "___current_input_info_memory___":_.setVariable(K,W.CURRENT_INPUT_INFO_MEMORY_KEY,i.value);break;case "___opened_labels_counter___":_.setVariable(K,W.OPENED_LABELS_COUNTER_KEY,i.value);break;case "___all_choices_made___":_.setVariable(K,W.ALL_CHOICES_MADE_KEY,i.value);break;case "___current_step_times_counter___":_.setVariable(K,W.CURRENT_STEP_TIMES_COUNTER_KEY,i.value);break;case "___last_step_glued___":_.setVariable(K,W.LAST_STEP_GLUED,i.value);break;default:_.setVariable(et,i.key,i.value);}}),t.temp?.forEach(i=>{_.setVariable(ot,i.key,i.value);}),t.flags?.forEach(i=>{_.setFlag(i,!0);}),t.main?.forEach(i=>{this.base.set(i.key,i.value);}),t.tempDeadlines?.forEach(i=>{this.temp.deadlines.set(i.key,i.value);})):St.warn("No storage data found");}catch(i){St.error("Error importing data",i);}}};var Dt=class{constructor(t,i){this.categoryId=t,this.id=i,this.migrateOldStorage();}migrateOldStorage(t=this.categoryId){let i=_.getVariable(et,t);i&&(Object.entries(i).forEach(([s,a])=>{typeof a=="object"&&a!==null&&Object.entries(a).forEach(([r,n])=>{_.setVariable(this.categoryId,`${s}:${r}`,n);});}),_.removeVariable(et,t));}id;categoryId;setStorageProperty(t,i){_.setVariable(this.categoryId,`${this.id}:${t}`,i);}getStorageProperty(t,i=this.id){return _.getVariable(this.categoryId,`${i}:${t}`)}};var Me=new At;exports.StorageRegistry=_;exports.StoredClassModel=Dt;exports.storage=Me;
@@ -3,7 +3,7 @@ export { a as StorageObjectType } from './StorageElementType-C7ETezlL.cjs';
3
3
  import { S as StorageGameState } from './StorageGameState-C3PGrFPr.cjs';
4
4
  import { LRUCache } from 'lru-cache';
5
5
  export { S as StoredClassModel } from './StoredClassModel-Bykjdn8S.cjs';
6
- import { C as CachedMap } from './CachedMap-DZLvJAnA.cjs';
6
+ import { CachedMap } from './index.cjs';
7
7
 
8
8
  interface StorageExternalStoreHandler {
9
9
  /**
@@ -212,6 +212,11 @@ declare namespace StorageRegistry {
212
212
  function getFlag(key: string): boolean;
213
213
  }
214
214
 
215
+ /**
216
+ * The global storage manager instance. It keeps the game variables and flags
217
+ * (set/get values, temporary variables) that are saved and restored with the game state.
218
+ */
215
219
  declare const storage: StorageManagerInterface;
216
220
 
217
- export { StorageElementType, type StorageExternalStoreHandler, type StorageFlagsInterface, StorageGameState, type StorageManagerInterface, StorageRegistry, type StorageTempInterface, storage };
221
+ export { StorageElementType, StorageGameState, StorageRegistry, storage };
222
+ export type { StorageExternalStoreHandler, StorageFlagsInterface, StorageManagerInterface, StorageTempInterface };
package/dist/storage.d.ts CHANGED
@@ -3,7 +3,7 @@ export { a as StorageObjectType } from './StorageElementType-C7ETezlL.js';
3
3
  import { S as StorageGameState } from './StorageGameState-jAexrJLj.js';
4
4
  import { LRUCache } from 'lru-cache';
5
5
  export { S as StoredClassModel } from './StoredClassModel-uMifeNzV.js';
6
- import { C as CachedMap } from './CachedMap-DZLvJAnA.js';
6
+ import { CachedMap } from './index.js';
7
7
 
8
8
  interface StorageExternalStoreHandler {
9
9
  /**
@@ -212,6 +212,11 @@ declare namespace StorageRegistry {
212
212
  function getFlag(key: string): boolean;
213
213
  }
214
214
 
215
+ /**
216
+ * The global storage manager instance. It keeps the game variables and flags
217
+ * (set/get values, temporary variables) that are saved and restored with the game state.
218
+ */
215
219
  declare const storage: StorageManagerInterface;
216
220
 
217
- export { StorageElementType, type StorageExternalStoreHandler, type StorageFlagsInterface, StorageGameState, type StorageManagerInterface, StorageRegistry, type StorageTempInterface, storage };
221
+ export { StorageElementType, StorageGameState, StorageRegistry, storage };
222
+ export type { StorageExternalStoreHandler, StorageFlagsInterface, StorageManagerInterface, StorageTempInterface };
package/dist/storage.mjs CHANGED
@@ -1 +1 @@
1
- export{a as StorageRegistry,b as StoredClassModel,c as storage}from'./chunk-6OABTG5R.mjs';import'./chunk-HD353M4B.mjs';import'./chunk-S7HZUIEI.mjs';import'./chunk-AW5XWF24.mjs';
1
+ export{a as StorageRegistry,b as StoredClassModel,c as storage}from'./chunk-OJKUK6GL.mjs';import'./chunk-HD353M4B.mjs';import'./chunk-A5FN4SNI.mjs';import'./chunk-B46NFIFC.mjs';