@drincs/pixi-vn 1.3.13 → 1.3.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{classes/index.d.cts → CachedMap-DZLvJAnA.d.cts} +1 -1
- package/dist/{classes/index.d.ts → CachedMap-DZLvJAnA.d.ts} +1 -1
- package/dist/{OpenedLabel-DxlOwJKw.d.ts → HistoryChoiceMenuOption-BjnxDyK5.d.cts} +47 -2
- package/dist/{OpenedLabel-Dgkgemkv.d.cts → HistoryChoiceMenuOption-ZdrL_kYX.d.ts} +47 -2
- package/dist/{StorageElementType-DTGcnkzF.d.ts → StorageElementType-dAIVJeiw.d.cts} +1 -1
- package/dist/{StorageElementType-DTGcnkzF.d.cts → StorageElementType-dAIVJeiw.d.ts} +1 -1
- package/dist/history.cjs +1 -0
- package/dist/{history/index.d.ts → history.d.cts} +14 -8
- package/dist/{history/index.d.cts → history.d.ts} +14 -8
- package/dist/history.mjs +1 -0
- package/dist/index.cjs +143 -143
- package/dist/index.d.cts +3076 -216
- package/dist/index.d.ts +3076 -216
- package/dist/index.mjs +143 -143
- package/dist/narration.cjs +2 -0
- package/dist/{index-_rD16ks5.d.ts → narration.d.cts} +27 -44
- package/dist/{index-Bl9hiHQR.d.cts → narration.d.ts} +27 -44
- package/dist/narration.mjs +2 -0
- package/dist/storage.cjs +1 -0
- package/dist/{storage/index.d.ts → storage.d.cts} +75 -6
- package/dist/{storage/index.d.cts → storage.d.ts} +75 -6
- package/dist/storage.mjs +1 -0
- package/dist/unifier.cjs +1 -0
- package/dist/unifier.d.cts +230 -0
- package/dist/unifier.d.ts +230 -0
- package/dist/unifier.mjs +1 -0
- package/package.json +29 -2
- package/dist/ContainerMemory-CrY9QSo2.d.cts +0 -106
- package/dist/ContainerMemory-DrijxCcD.d.ts +0 -106
- package/dist/HistoryChoiceMenuOption-Kj_P28ke.d.ts +0 -49
- package/dist/HistoryChoiceMenuOption-unaLLfKR.d.cts +0 -49
- package/dist/HistoryGameState-i_gx3rGM.d.ts +0 -12
- package/dist/HistoryGameState-qeIMl_DH.d.cts +0 -12
- package/dist/NarrationGameState-CqDh48n_.d.ts +0 -24
- package/dist/NarrationGameState-Cu-OYzph.d.cts +0 -24
- package/dist/SoundGameState-BG_iPwjt.d.cts +0 -85
- package/dist/SoundGameState-BG_iPwjt.d.ts +0 -85
- package/dist/StorageGameState-B2kz-u_2.d.cts +0 -19
- package/dist/StorageGameState-Cnfj75sk.d.ts +0 -19
- package/dist/StoredClassModel-CjdhvNgB.d.cts +0 -56
- package/dist/StoredClassModel-CjdhvNgB.d.ts +0 -56
- package/dist/TickersSequence-Cf1Vcu22.d.cts +0 -133
- package/dist/TickersSequence-Cf1Vcu22.d.ts +0 -133
- package/dist/canvas/index.cjs +0 -3316
- package/dist/canvas/index.d.cts +0 -8
- package/dist/canvas/index.d.ts +0 -8
- package/dist/canvas/index.mjs +0 -3316
- package/dist/canvas/tickers/index.cjs +0 -3316
- package/dist/canvas/tickers/index.d.cts +0 -467
- package/dist/canvas/tickers/index.d.ts +0 -467
- package/dist/canvas/tickers/index.mjs +0 -3316
- package/dist/character/index.cjs +0 -572
- package/dist/character/index.d.cts +0 -3
- package/dist/character/index.d.ts +0 -3
- package/dist/character/index.mjs +0 -572
- package/dist/classes/index.cjs +0 -1
- package/dist/classes/index.mjs +0 -1
- package/dist/history/index.cjs +0 -1
- package/dist/history/index.mjs +0 -1
- package/dist/index-B4F3XaWz.d.cts +0 -1767
- package/dist/index-Cax-mGq_.d.cts +0 -216
- package/dist/index-Cvdua0o-.d.ts +0 -216
- package/dist/index-Czfdktw9.d.ts +0 -93
- package/dist/index-DZ1shoNp.d.cts +0 -93
- package/dist/index-DvpfJ2VQ.d.ts +0 -1767
- package/dist/interfaces/index.cjs +0 -1
- package/dist/interfaces/index.d.cts +0 -55
- package/dist/interfaces/index.d.ts +0 -55
- package/dist/interfaces/index.mjs +0 -0
- package/dist/narration/index.cjs +0 -573
- package/dist/narration/index.d.cts +0 -8
- package/dist/narration/index.d.ts +0 -8
- package/dist/narration/index.mjs +0 -573
- package/dist/sound/index.cjs +0 -572
- package/dist/sound/index.d.cts +0 -3
- package/dist/sound/index.d.ts +0 -3
- package/dist/sound/index.mjs +0 -572
- package/dist/storage/index.cjs +0 -1
- package/dist/storage/index.mjs +0 -1
- package/dist/utils/index.cjs +0 -1
- package/dist/utils/index.d.cts +0 -8
- package/dist/utils/index.d.ts +0 -8
- package/dist/utils/index.mjs +0 -1
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use strict';var unifier=require('@drincs/pixi-vn/unifier'),sound=require('@pixi/sound');var mt=Object.create;var Ke=Object.defineProperty;var St=Object.getOwnPropertyDescriptor;var gt=Object.getOwnPropertyNames;var _t=Object.getPrototypeOf,yt=Object.prototype.hasOwnProperty;var tt=l=>{throw TypeError(l)};var Lt=(l,e,t)=>e in l?Ke(l,e,{enumerable:true,configurable:true,writable:true,value:t}):l[e]=t;var We=(l=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(l,{get:(e,t)=>(typeof require<"u"?require:e)[t]}):l)(function(l){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+l+'" is not supported')});var rt=(l,e)=>()=>(e||l((e={exports:{}}).exports,e),e.exports);var Tt=(l,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of gt(e))!yt.call(l,i)&&i!==t&&Ke(l,i,{get:()=>e[i],enumerable:!(r=St(e,i))||r.enumerable});return l};var Et=(l,e,t)=>(t=l!=null?mt(_t(l)):{},Tt(Ke(t,"default",{value:l,enumerable:true}),l));var _=(l,e,t)=>Lt(l,typeof e!="symbol"?e+"":e,t),Be=(l,e,t)=>e.has(l)||tt("Cannot "+t);var n=(l,e,t)=>(Be(l,e,"read from private field"),t?t.call(l):e.get(l)),v=(l,e,t)=>e.has(l)?tt("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(l):e.set(l,t),m=(l,e,t,r)=>(Be(l,e,"write to private field"),e.set(l,t),t),f=(l,e,t)=>(Be(l,e,"access private method"),t);var De=(l,e,t,r)=>({set _(i){m(l,e,i);},get _(){return n(l,e,r)}});var pt=rt((ze,ht)=>{(function(l,e){typeof ze=="object"?ht.exports=ze=e():typeof define=="function"&&define.amd?define([],e):l.CryptoJS=e();})(ze,function(){var l=l||(function(e,t){var r;if(typeof window<"u"&&window.crypto&&(r=window.crypto),typeof self<"u"&&self.crypto&&(r=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(r=globalThis.crypto),!r&&typeof window<"u"&&window.msCrypto&&(r=window.msCrypto),!r&&typeof global<"u"&&global.crypto&&(r=global.crypto),!r&&typeof We=="function")try{r=We("crypto");}catch{}var i=function(){if(r){if(typeof r.getRandomValues=="function")try{return r.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof r.randomBytes=="function")try{return r.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},s=Object.create||(function(){function a(){}return function(d){var I;return a.prototype=d,I=new a,a.prototype=null,I}})(),o={},u=o.lib={},p=u.Base=(function(){return {extend:function(a){var d=s(this);return a&&d.mixIn(a),(!d.hasOwnProperty("init")||this.init===d.init)&&(d.init=function(){d.$super.init.apply(this,arguments);}),d.init.prototype=d,d.$super=this,d},create:function(){var a=this.extend();return a.init.apply(a,arguments),a},init:function(){},mixIn:function(a){for(var d in a)a.hasOwnProperty(d)&&(this[d]=a[d]);a.hasOwnProperty("toString")&&(this.toString=a.toString);},clone:function(){return this.init.prototype.extend(this)}}})(),E=u.WordArray=p.extend({init:function(a,d){a=this.words=a||[],d!=t?this.sigBytes=d:this.sigBytes=a.length*4;},toString:function(a){return (a||g).stringify(this)},concat:function(a){var d=this.words,I=a.words,y=this.sigBytes,w=a.sigBytes;if(this.clamp(),y%4)for(var U=0;U<w;U++){var se=I[U>>>2]>>>24-U%4*8&255;d[y+U>>>2]|=se<<24-(y+U)%4*8;}else for(var H=0;H<w;H+=4)d[y+H>>>2]=I[H>>>2];return this.sigBytes+=w,this},clamp:function(){var a=this.words,d=this.sigBytes;a[d>>>2]&=4294967295<<32-d%4*8,a.length=e.ceil(d/4);},clone:function(){var a=p.clone.call(this);return a.words=this.words.slice(0),a},random:function(a){for(var d=[],I=0;I<a;I+=4)d.push(i());return new E.init(d,a)}}),S=o.enc={},g=S.Hex={stringify:function(a){for(var d=a.words,I=a.sigBytes,y=[],w=0;w<I;w++){var U=d[w>>>2]>>>24-w%4*8&255;y.push((U>>>4).toString(16)),y.push((U&15).toString(16));}return y.join("")},parse:function(a){for(var d=a.length,I=[],y=0;y<d;y+=2)I[y>>>3]|=parseInt(a.substr(y,2),16)<<24-y%8*4;return new E.init(I,d/2)}},N=S.Latin1={stringify:function(a){for(var d=a.words,I=a.sigBytes,y=[],w=0;w<I;w++){var U=d[w>>>2]>>>24-w%4*8&255;y.push(String.fromCharCode(U));}return y.join("")},parse:function(a){for(var d=a.length,I=[],y=0;y<d;y++)I[y>>>2]|=(a.charCodeAt(y)&255)<<24-y%4*8;return new E.init(I,d)}},P=S.Utf8={stringify:function(a){try{return decodeURIComponent(escape(N.stringify(a)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(a){return N.parse(unescape(encodeURIComponent(a)))}},D=u.BufferedBlockAlgorithm=p.extend({reset:function(){this._data=new E.init,this._nDataBytes=0;},_append:function(a){typeof a=="string"&&(a=P.parse(a)),this._data.concat(a),this._nDataBytes+=a.sigBytes;},_process:function(a){var d,I=this._data,y=I.words,w=I.sigBytes,U=this.blockSize,se=U*4,H=w/se;a?H=e.ceil(H):H=e.max((H|0)-this._minBufferSize,0);var q=H*U,_e=e.min(q*4,w);if(q){for(var He=0;He<q;He+=U)this._doProcessBlock(y,He);d=y.splice(0,q),I.sigBytes-=_e;}return new E.init(d,_e)},clone:function(){var a=p.clone.call(this);return a._data=this._data.clone(),a},_minBufferSize:0});u.Hasher=D.extend({cfg:p.extend(),init:function(a){this.cfg=this.cfg.extend(a),this.reset();},reset:function(){D.reset.call(this),this._doReset();},update:function(a){return this._append(a),this._process(),this},finalize:function(a){a&&this._append(a);var d=this._doFinalize();return d},blockSize:512/32,_createHelper:function(a){return function(d,I){return new a.init(I).finalize(d)}},_createHmacHelper:function(a){return function(d,I){return new C.HMAC.init(a,I).finalize(d)}}});var C=o.algo={};return o})(Math);return l});});var dt=rt((Ge,ct)=>{(function(l,e){typeof Ge=="object"?ct.exports=Ge=e(pt()):typeof define=="function"&&define.amd?define(["./core"],e):e(l.CryptoJS);})(Ge,function(l){return (function(){var e=l,t=e.lib,r=t.WordArray,i=t.Hasher,s=e.algo,o=[],u=s.SHA1=i.extend({_doReset:function(){this._hash=new r.init([1732584193,4023233417,2562383102,271733878,3285377520]);},_doProcessBlock:function(p,E){for(var S=this._hash.words,g=S[0],N=S[1],P=S[2],D=S[3],x=S[4],C=0;C<80;C++){if(C<16)o[C]=p[E+C]|0;else {var a=o[C-3]^o[C-8]^o[C-14]^o[C-16];o[C]=a<<1|a>>>31;}var d=(g<<5|g>>>27)+x+o[C];C<20?d+=(N&P|~N&D)+1518500249:C<40?d+=(N^P^D)+1859775393:C<60?d+=(N&P|N&D|P&D)-1894007588:d+=(N^P^D)-899497514,x=D,D=P,P=N<<30|N>>>2,N=g,g=d;}S[0]=S[0]+g|0,S[1]=S[1]+N|0,S[2]=S[2]+P|0,S[3]=S[3]+D|0,S[4]=S[4]+x|0;},_doFinalize:function(){var p=this._data,E=p.words,S=this._nDataBytes*8,g=p.sigBytes*8;return E[g>>>5]|=128<<24-g%32,E[(g+64>>>9<<4)+14]=Math.floor(S/4294967296),E[(g+64>>>9<<4)+15]=S,p.sigBytes=E.length*4,this._process(),this._hash},clone:function(){var p=i.clone.call(this);return p._hash=this._hash.clone(),p}});e.SHA1=i._createHelper(u),e.HmacSHA1=i._createHmacHelper(u);})(),l.SHA1});});({DistortionFilter:sound.filters.DistortionFilter,EqualizerFilter:sound.filters.EqualizerFilter,MonoFilter:sound.filters.MonoFilter,ReverbFilter:sound.filters.ReverbFilter,StereoFilter:sound.filters.StereoFilter,StreamFilter:sound.filters.StreamFilter,TelephoneFilter:sound.filters.TelephoneFilter});var R={CURRENT_DIALOGUE_MEMORY_KEY:"___current_dialogue_memory___",LAST_DIALOGUE_ADDED_IN_STEP_MEMORY_KEY:"___last_dialogue_added_in_step_memory___",CURRENT_MENU_OPTIONS_MEMORY_KEY:"___current_menu_options_memory___",LAST_MENU_OPTIONS_ADDED_IN_STEP_MEMORY_KEY:"___last_menu_options_added_in_step_memory___",CURRENT_INPUT_VALUE_MEMORY_KEY:"_input_value_",LAST_INPUT_ADDED_IN_STEP_MEMORY_KEY:"___last_input_added_in_step_memory___",CURRENT_INPUT_INFO_MEMORY_KEY:"___current_input_info_memory___",CHARACTER_CATEGORY_KEY:"___character___",ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY:"___glue___",OPENED_LABELS_COUNTER_KEY:"___opened_labels_counter___",ALL_CHOICES_MADE_KEY:"___all_choices_made___",CURRENT_STEP_TIMES_COUNTER_KEY:"___current_step_times_counter___",LAST_STEP_GLUED:"___last_step_glued___"};var L;(i=>(i.log=(s,...o)=>console.log(`[Pixi\u2019VN] ${s}`,...o),i.warn=(s,...o)=>console.warn(`[Pixi\u2019VN] ${s}`,...o),i.error=(s,...o)=>console.error(`[Pixi\u2019VN] ${s}`,...o),i.info=(s,...o)=>console.info(`[Pixi\u2019VN] ${s}`,...o)))(L||(L={}));function oe(l){try{if(typeof l>"u")return l;let e=JSON.stringify(l);return JSON.parse(e)}catch(e){throw L.error("Error creating exportable element",l,e),new Error("[Pixi\u2019VN] Error creating exportable element")}}var ye=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,ot=new Set,je=typeof process=="object"&&process?process:{},at=(l,e,t,r)=>{typeof je.emitWarning=="function"?je.emitWarning(l,e,t,r):console.error(`[${t}] ${e}: ${l}`);},Ye=globalThis.AbortController,nt=globalThis.AbortSignal;if(typeof Ye>"u"){nt=class{constructor(){_(this,"onabort");_(this,"_onabort",[]);_(this,"reason");_(this,"aborted",false);}addEventListener(r,i){this._onabort.push(i);}},Ye=class{constructor(){_(this,"signal",new nt);e();}abort(r){if(!this.signal.aborted){this.signal.reason=r,this.signal.aborted=true;for(let i of this.signal._onabort)i(r);this.signal.onabort?.(r);}}};let l=je.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{l&&(l=false,at("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",e));};}var Ct=l=>!ot.has(l),ue=l=>l&&l===Math.floor(l)&&l>0&&isFinite(l),lt=l=>ue(l)?l<=Math.pow(2,8)?Uint8Array:l<=Math.pow(2,16)?Uint16Array:l<=Math.pow(2,32)?Uint32Array:l<=Number.MAX_SAFE_INTEGER?Le:null:null,Le=class extends Array{constructor(e){super(e),this.fill(0);}},Te,be=class be{constructor(e,t){_(this,"heap");_(this,"length");if(!n(be,Te))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new t(e),this.length=0;}static create(e){let t=lt(e);if(!t)return [];m(be,Te,true);let r=new be(e,t);return m(be,Te,false),r}push(e){this.heap[this.length++]=e;}pop(){return this.heap[--this.length]}};Te=new WeakMap,v(be,Te,false);var $e=be,it,st,X,B,J,me,Q,Ee,Ce,Y,Z,F,M,T,K,j,G,V,ee,z,te,re,$,ne,de,W,Ie,h,ke,Se,ae,Ae,k,ut,ge,Re,Me,he,pe,qe,Ue,Fe,A,Xe,xe,ce,Je,Qe=class Qe{constructor(e){v(this,h);v(this,X);v(this,B);v(this,J);v(this,me);v(this,Q);v(this,Ee);v(this,Ce);_(this,"ttl");_(this,"ttlResolution");_(this,"ttlAutopurge");_(this,"updateAgeOnGet");_(this,"updateAgeOnHas");_(this,"allowStale");_(this,"noDisposeOnSet");_(this,"noUpdateTTL");_(this,"maxEntrySize");_(this,"sizeCalculation");_(this,"noDeleteOnFetchRejection");_(this,"noDeleteOnStaleGet");_(this,"allowStaleOnFetchAbort");_(this,"allowStaleOnFetchRejection");_(this,"ignoreFetchAbort");v(this,Y);v(this,Z);v(this,F);v(this,M);v(this,T);v(this,K);v(this,j);v(this,G);v(this,V);v(this,ee);v(this,z);v(this,te);v(this,re);v(this,$);v(this,ne);v(this,de);v(this,W);v(this,Ie);v(this,Se,()=>{});v(this,ae,()=>{});v(this,Ae,()=>{});v(this,k,()=>false);v(this,ge,e=>{});v(this,Re,(e,t,r)=>{});v(this,Me,(e,t,r,i)=>{if(r||i)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});_(this,it,"LRUCache");let{max:t=0,ttl:r,ttlResolution:i=1,ttlAutopurge:s,updateAgeOnGet:o,updateAgeOnHas:u,allowStale:p,dispose:E,onInsert:S,disposeAfter:g,noDisposeOnSet:N,noUpdateTTL:P,maxSize:D=0,maxEntrySize:x=0,sizeCalculation:C,fetchMethod:a,memoMethod:d,noDeleteOnFetchRejection:I,noDeleteOnStaleGet:y,allowStaleOnFetchRejection:w,allowStaleOnFetchAbort:U,ignoreFetchAbort:se}=e;if(t!==0&&!ue(t))throw new TypeError("max option must be a nonnegative integer");let H=t?lt(t):Array;if(!H)throw new Error("invalid max value: "+t);if(m(this,X,t),m(this,B,D),this.maxEntrySize=x||n(this,B),this.sizeCalculation=C,this.sizeCalculation){if(!n(this,B)&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(d!==void 0&&typeof d!="function")throw new TypeError("memoMethod must be a function if defined");if(m(this,Ce,d),a!==void 0&&typeof a!="function")throw new TypeError("fetchMethod must be a function if specified");if(m(this,Ee,a),m(this,de,!!a),m(this,F,new Map),m(this,M,new Array(t).fill(void 0)),m(this,T,new Array(t).fill(void 0)),m(this,K,new H(t)),m(this,j,new H(t)),m(this,G,0),m(this,V,0),m(this,ee,$e.create(t)),m(this,Y,0),m(this,Z,0),typeof E=="function"&&m(this,J,E),typeof S=="function"&&m(this,me,S),typeof g=="function"?(m(this,Q,g),m(this,z,[])):(m(this,Q,void 0),m(this,z,void 0)),m(this,ne,!!n(this,J)),m(this,Ie,!!n(this,me)),m(this,W,!!n(this,Q)),this.noDisposeOnSet=!!N,this.noUpdateTTL=!!P,this.noDeleteOnFetchRejection=!!I,this.allowStaleOnFetchRejection=!!w,this.allowStaleOnFetchAbort=!!U,this.ignoreFetchAbort=!!se,this.maxEntrySize!==0){if(n(this,B)!==0&&!ue(n(this,B)))throw new TypeError("maxSize must be a positive integer if specified");if(!ue(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");f(this,h,ut).call(this);}if(this.allowStale=!!p,this.noDeleteOnStaleGet=!!y,this.updateAgeOnGet=!!o,this.updateAgeOnHas=!!u,this.ttlResolution=ue(i)||i===0?i:1,this.ttlAutopurge=!!s,this.ttl=r||0,this.ttl){if(!ue(this.ttl))throw new TypeError("ttl must be a positive integer if specified");f(this,h,ke).call(this);}if(n(this,X)===0&&this.ttl===0&&n(this,B)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!n(this,X)&&!n(this,B)){let q="LRU_CACHE_UNBOUNDED";Ct(q)&&(ot.add(q),at("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",q,Qe));}}static unsafeExposeInternals(e){return {starts:n(e,re),ttls:n(e,$),sizes:n(e,te),keyMap:n(e,F),keyList:n(e,M),valList:n(e,T),next:n(e,K),prev:n(e,j),get head(){return n(e,G)},get tail(){return n(e,V)},free:n(e,ee),isBackgroundFetch:t=>{var r;return f(r=e,h,A).call(r,t)},backgroundFetch:(t,r,i,s)=>{var o;return f(o=e,h,Fe).call(o,t,r,i,s)},moveToTail:t=>{var r;return f(r=e,h,xe).call(r,t)},indexes:t=>{var r;return f(r=e,h,he).call(r,t)},rindexes:t=>{var r;return f(r=e,h,pe).call(r,t)},isStale:t=>{var r;return n(r=e,k).call(r,t)}}}get max(){return n(this,X)}get maxSize(){return n(this,B)}get calculatedSize(){return n(this,Z)}get size(){return n(this,Y)}get fetchMethod(){return n(this,Ee)}get memoMethod(){return n(this,Ce)}get dispose(){return n(this,J)}get onInsert(){return n(this,me)}get disposeAfter(){return n(this,Q)}getRemainingTTL(e){return n(this,F).has(e)?1/0:0}*entries(){for(let e of f(this,h,he).call(this))n(this,T)[e]!==void 0&&n(this,M)[e]!==void 0&&!f(this,h,A).call(this,n(this,T)[e])&&(yield [n(this,M)[e],n(this,T)[e]]);}*rentries(){for(let e of f(this,h,pe).call(this))n(this,T)[e]!==void 0&&n(this,M)[e]!==void 0&&!f(this,h,A).call(this,n(this,T)[e])&&(yield [n(this,M)[e],n(this,T)[e]]);}*keys(){for(let e of f(this,h,he).call(this)){let t=n(this,M)[e];t!==void 0&&!f(this,h,A).call(this,n(this,T)[e])&&(yield t);}}*rkeys(){for(let e of f(this,h,pe).call(this)){let t=n(this,M)[e];t!==void 0&&!f(this,h,A).call(this,n(this,T)[e])&&(yield t);}}*values(){for(let e of f(this,h,he).call(this))n(this,T)[e]!==void 0&&!f(this,h,A).call(this,n(this,T)[e])&&(yield n(this,T)[e]);}*rvalues(){for(let e of f(this,h,pe).call(this))n(this,T)[e]!==void 0&&!f(this,h,A).call(this,n(this,T)[e])&&(yield n(this,T)[e]);}[(st=Symbol.iterator,it=Symbol.toStringTag,st)](){return this.entries()}find(e,t={}){for(let r of f(this,h,he).call(this)){let i=n(this,T)[r],s=f(this,h,A).call(this,i)?i.__staleWhileFetching:i;if(s!==void 0&&e(s,n(this,M)[r],this))return this.get(n(this,M)[r],t)}}forEach(e,t=this){for(let r of f(this,h,he).call(this)){let i=n(this,T)[r],s=f(this,h,A).call(this,i)?i.__staleWhileFetching:i;s!==void 0&&e.call(t,s,n(this,M)[r],this);}}rforEach(e,t=this){for(let r of f(this,h,pe).call(this)){let i=n(this,T)[r],s=f(this,h,A).call(this,i)?i.__staleWhileFetching:i;s!==void 0&&e.call(t,s,n(this,M)[r],this);}}purgeStale(){let e=false;for(let t of f(this,h,pe).call(this,{allowStale:true}))n(this,k).call(this,t)&&(f(this,h,ce).call(this,n(this,M)[t],"expire"),e=true);return e}info(e){let t=n(this,F).get(e);if(t===void 0)return;let r=n(this,T)[t],i=f(this,h,A).call(this,r)?r.__staleWhileFetching:r;if(i===void 0)return;let s={value:i};if(n(this,$)&&n(this,re)){let o=n(this,$)[t],u=n(this,re)[t];if(o&&u){let p=o-(ye.now()-u);s.ttl=p,s.start=Date.now();}}return n(this,te)&&(s.size=n(this,te)[t]),s}dump(){let e=[];for(let t of f(this,h,he).call(this,{allowStale:true})){let r=n(this,M)[t],i=n(this,T)[t],s=f(this,h,A).call(this,i)?i.__staleWhileFetching:i;if(s===void 0||r===void 0)continue;let o={value:s};if(n(this,$)&&n(this,re)){o.ttl=n(this,$)[t];let u=ye.now()-n(this,re)[t];o.start=Math.floor(Date.now()-u);}n(this,te)&&(o.size=n(this,te)[t]),e.unshift([r,o]);}return e}load(e){this.clear();for(let[t,r]of e){if(r.start){let i=Date.now()-r.start;r.start=ye.now()-i;}this.set(t,r.value,r);}}set(e,t,r={}){var N,P,D,x;if(t===void 0)return this.delete(e),this;let{ttl:i=this.ttl,start:s,noDisposeOnSet:o=this.noDisposeOnSet,sizeCalculation:u=this.sizeCalculation,status:p}=r,{noUpdateTTL:E=this.noUpdateTTL}=r,S=n(this,Me).call(this,e,t,r.size||0,u);if(this.maxEntrySize&&S>this.maxEntrySize)return p&&(p.set="miss",p.maxEntrySizeExceeded=true),f(this,h,ce).call(this,e,"set"),this;let g=n(this,Y)===0?void 0:n(this,F).get(e);if(g===void 0)g=n(this,Y)===0?n(this,V):n(this,ee).length!==0?n(this,ee).pop():n(this,Y)===n(this,X)?f(this,h,Ue).call(this,false):n(this,Y),n(this,M)[g]=e,n(this,T)[g]=t,n(this,F).set(e,g),n(this,K)[n(this,V)]=g,n(this,j)[g]=n(this,V),m(this,V,g),De(this,Y)._++,n(this,Re).call(this,g,S,p),p&&(p.set="add"),E=false,n(this,Ie)&&((N=n(this,me))==null||N.call(this,t,e,"add"));else {f(this,h,xe).call(this,g);let C=n(this,T)[g];if(t!==C){if(n(this,de)&&f(this,h,A).call(this,C)){C.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:a}=C;a!==void 0&&!o&&(n(this,ne)&&((P=n(this,J))==null||P.call(this,a,e,"set")),n(this,W)&&n(this,z)?.push([a,e,"set"]));}else o||(n(this,ne)&&((D=n(this,J))==null||D.call(this,C,e,"set")),n(this,W)&&n(this,z)?.push([C,e,"set"]));if(n(this,ge).call(this,g),n(this,Re).call(this,g,S,p),n(this,T)[g]=t,p){p.set="replace";let a=C&&f(this,h,A).call(this,C)?C.__staleWhileFetching:C;a!==void 0&&(p.oldValue=a);}}else p&&(p.set="update");n(this,Ie)&&this.onInsert?.(t,e,t===C?"update":"replace");}if(i!==0&&!n(this,$)&&f(this,h,ke).call(this),n(this,$)&&(E||n(this,Ae).call(this,g,i,s),p&&n(this,ae).call(this,p,g)),!o&&n(this,W)&&n(this,z)){let C=n(this,z),a;for(;a=C?.shift();)(x=n(this,Q))==null||x.call(this,...a);}return this}pop(){var e;try{for(;n(this,Y);){let t=n(this,T)[n(this,G)];if(f(this,h,Ue).call(this,!0),f(this,h,A).call(this,t)){if(t.__staleWhileFetching)return t.__staleWhileFetching}else if(t!==void 0)return t}}finally{if(n(this,W)&&n(this,z)){let t=n(this,z),r;for(;r=t?.shift();)(e=n(this,Q))==null||e.call(this,...r);}}}has(e,t={}){let{updateAgeOnHas:r=this.updateAgeOnHas,status:i}=t,s=n(this,F).get(e);if(s!==void 0){let o=n(this,T)[s];if(f(this,h,A).call(this,o)&&o.__staleWhileFetching===void 0)return false;if(n(this,k).call(this,s))i&&(i.has="stale",n(this,ae).call(this,i,s));else return r&&n(this,Se).call(this,s),i&&(i.has="hit",n(this,ae).call(this,i,s)),true}else i&&(i.has="miss");return false}peek(e,t={}){let{allowStale:r=this.allowStale}=t,i=n(this,F).get(e);if(i===void 0||!r&&n(this,k).call(this,i))return;let s=n(this,T)[i];return f(this,h,A).call(this,s)?s.__staleWhileFetching:s}async fetch(e,t={}){let{allowStale:r=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:s=this.noDeleteOnStaleGet,ttl:o=this.ttl,noDisposeOnSet:u=this.noDisposeOnSet,size:p=0,sizeCalculation:E=this.sizeCalculation,noUpdateTTL:S=this.noUpdateTTL,noDeleteOnFetchRejection:g=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:N=this.allowStaleOnFetchRejection,ignoreFetchAbort:P=this.ignoreFetchAbort,allowStaleOnFetchAbort:D=this.allowStaleOnFetchAbort,context:x,forceRefresh:C=false,status:a,signal:d}=t;if(!n(this,de))return a&&(a.fetch="get"),this.get(e,{allowStale:r,updateAgeOnGet:i,noDeleteOnStaleGet:s,status:a});let I={allowStale:r,updateAgeOnGet:i,noDeleteOnStaleGet:s,ttl:o,noDisposeOnSet:u,size:p,sizeCalculation:E,noUpdateTTL:S,noDeleteOnFetchRejection:g,allowStaleOnFetchRejection:N,allowStaleOnFetchAbort:D,ignoreFetchAbort:P,status:a,signal:d},y=n(this,F).get(e);if(y===void 0){a&&(a.fetch="miss");let w=f(this,h,Fe).call(this,e,y,I,x);return w.__returned=w}else {let w=n(this,T)[y];if(f(this,h,A).call(this,w)){let _e=r&&w.__staleWhileFetching!==void 0;return a&&(a.fetch="inflight",_e&&(a.returnedStale=true)),_e?w.__staleWhileFetching:w.__returned=w}let U=n(this,k).call(this,y);if(!C&&!U)return a&&(a.fetch="hit"),f(this,h,xe).call(this,y),i&&n(this,Se).call(this,y),a&&n(this,ae).call(this,a,y),w;let se=f(this,h,Fe).call(this,e,y,I,x),q=se.__staleWhileFetching!==void 0&&r;return a&&(a.fetch=U?"stale":"refresh",q&&U&&(a.returnedStale=true)),q?se.__staleWhileFetching:se.__returned=se}}async forceFetch(e,t={}){let r=await this.fetch(e,t);if(r===void 0)throw new Error("fetch() returned undefined");return r}memo(e,t={}){let r=n(this,Ce);if(!r)throw new Error("no memoMethod provided to constructor");let{context:i,forceRefresh:s,...o}=t,u=this.get(e,o);if(!s&&u!==void 0)return u;let p=r(e,u,{options:o,context:i});return this.set(e,p,o),p}get(e,t={}){let{allowStale:r=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:s=this.noDeleteOnStaleGet,status:o}=t,u=n(this,F).get(e);if(u!==void 0){let p=n(this,T)[u],E=f(this,h,A).call(this,p);return o&&n(this,ae).call(this,o,u),n(this,k).call(this,u)?(o&&(o.get="stale"),E?(o&&r&&p.__staleWhileFetching!==void 0&&(o.returnedStale=true),r?p.__staleWhileFetching:void 0):(s||f(this,h,ce).call(this,e,"expire"),o&&r&&(o.returnedStale=true),r?p:void 0)):(o&&(o.get="hit"),E?p.__staleWhileFetching:(f(this,h,xe).call(this,u),i&&n(this,Se).call(this,u),p))}else o&&(o.get="miss");}delete(e){return f(this,h,ce).call(this,e,"delete")}clear(){return f(this,h,Je).call(this,"delete")}};X=new WeakMap,B=new WeakMap,J=new WeakMap,me=new WeakMap,Q=new WeakMap,Ee=new WeakMap,Ce=new WeakMap,Y=new WeakMap,Z=new WeakMap,F=new WeakMap,M=new WeakMap,T=new WeakMap,K=new WeakMap,j=new WeakMap,G=new WeakMap,V=new WeakMap,ee=new WeakMap,z=new WeakMap,te=new WeakMap,re=new WeakMap,$=new WeakMap,ne=new WeakMap,de=new WeakMap,W=new WeakMap,Ie=new WeakMap,h=new WeakSet,ke=function(){let e=new Le(n(this,X)),t=new Le(n(this,X));m(this,$,e),m(this,re,t),m(this,Ae,(s,o,u=ye.now())=>{if(t[s]=o!==0?u:0,e[s]=o,o!==0&&this.ttlAutopurge){let p=setTimeout(()=>{n(this,k).call(this,s)&&f(this,h,ce).call(this,n(this,M)[s],"expire");},o+1);p.unref&&p.unref();}}),m(this,Se,s=>{t[s]=e[s]!==0?ye.now():0;}),m(this,ae,(s,o)=>{if(e[o]){let u=e[o],p=t[o];if(!u||!p)return;s.ttl=u,s.start=p,s.now=r||i();let E=s.now-p;s.remainingTTL=u-E;}});let r=0,i=()=>{let s=ye.now();if(this.ttlResolution>0){r=s;let o=setTimeout(()=>r=0,this.ttlResolution);o.unref&&o.unref();}return s};this.getRemainingTTL=s=>{let o=n(this,F).get(s);if(o===void 0)return 0;let u=e[o],p=t[o];if(!u||!p)return 1/0;let E=(r||i())-p;return u-E},m(this,k,s=>{let o=t[s],u=e[s];return !!u&&!!o&&(r||i())-o>u});},Se=new WeakMap,ae=new WeakMap,Ae=new WeakMap,k=new WeakMap,ut=function(){let e=new Le(n(this,X));m(this,Z,0),m(this,te,e),m(this,ge,t=>{m(this,Z,n(this,Z)-e[t]),e[t]=0;}),m(this,Me,(t,r,i,s)=>{if(f(this,h,A).call(this,r))return 0;if(!ue(i))if(s){if(typeof s!="function")throw new TypeError("sizeCalculation must be a function");if(i=s(r,t),!ue(i))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return i}),m(this,Re,(t,r,i)=>{if(e[t]=r,n(this,B)){let s=n(this,B)-e[t];for(;n(this,Z)>s;)f(this,h,Ue).call(this,true);}m(this,Z,n(this,Z)+e[t]),i&&(i.entrySize=r,i.totalCalculatedSize=n(this,Z));});},ge=new WeakMap,Re=new WeakMap,Me=new WeakMap,he=function*({allowStale:e=this.allowStale}={}){if(n(this,Y))for(let t=n(this,V);!(!f(this,h,qe).call(this,t)||((e||!n(this,k).call(this,t))&&(yield t),t===n(this,G)));)t=n(this,j)[t];},pe=function*({allowStale:e=this.allowStale}={}){if(n(this,Y))for(let t=n(this,G);!(!f(this,h,qe).call(this,t)||((e||!n(this,k).call(this,t))&&(yield t),t===n(this,V)));)t=n(this,K)[t];},qe=function(e){return e!==void 0&&n(this,F).get(n(this,M)[e])===e},Ue=function(e){var s;let t=n(this,G),r=n(this,M)[t],i=n(this,T)[t];return n(this,de)&&f(this,h,A).call(this,i)?i.__abortController.abort(new Error("evicted")):(n(this,ne)||n(this,W))&&(n(this,ne)&&((s=n(this,J))==null||s.call(this,i,r,"evict")),n(this,W)&&n(this,z)?.push([i,r,"evict"])),n(this,ge).call(this,t),e&&(n(this,M)[t]=void 0,n(this,T)[t]=void 0,n(this,ee).push(t)),n(this,Y)===1?(m(this,G,m(this,V,0)),n(this,ee).length=0):m(this,G,n(this,K)[t]),n(this,F).delete(r),De(this,Y)._--,t},Fe=function(e,t,r,i){let s=t===void 0?void 0:n(this,T)[t];if(f(this,h,A).call(this,s))return s;let o=new Ye,{signal:u}=r;u?.addEventListener("abort",()=>o.abort(u.reason),{signal:o.signal});let p={signal:o.signal,options:r,context:i},E=(x,C=false)=>{let{aborted:a}=o.signal,d=r.ignoreFetchAbort&&x!==void 0;if(r.status&&(a&&!C?(r.status.fetchAborted=true,r.status.fetchError=o.signal.reason,d&&(r.status.fetchAbortIgnored=true)):r.status.fetchResolved=true),a&&!d&&!C)return g(o.signal.reason);let I=P;return n(this,T)[t]===P&&(x===void 0?I.__staleWhileFetching?n(this,T)[t]=I.__staleWhileFetching:f(this,h,ce).call(this,e,"fetch"):(r.status&&(r.status.fetchUpdated=true),this.set(e,x,p.options))),x},S=x=>(r.status&&(r.status.fetchRejected=true,r.status.fetchError=x),g(x)),g=x=>{let{aborted:C}=o.signal,a=C&&r.allowStaleOnFetchAbort,d=a||r.allowStaleOnFetchRejection,I=d||r.noDeleteOnFetchRejection,y=P;if(n(this,T)[t]===P&&(!I||y.__staleWhileFetching===void 0?f(this,h,ce).call(this,e,"fetch"):a||(n(this,T)[t]=y.__staleWhileFetching)),d)return r.status&&y.__staleWhileFetching!==void 0&&(r.status.returnedStale=true),y.__staleWhileFetching;if(y.__returned===y)throw x},N=(x,C)=>{var d;let a=(d=n(this,Ee))==null?void 0:d.call(this,e,s,p);a&&a instanceof Promise&&a.then(I=>x(I===void 0?void 0:I),C),o.signal.addEventListener("abort",()=>{(!r.ignoreFetchAbort||r.allowStaleOnFetchAbort)&&(x(void 0),r.allowStaleOnFetchAbort&&(x=I=>E(I,true)));});};r.status&&(r.status.fetchDispatched=true);let P=new Promise(N).then(E,S),D=Object.assign(P,{__abortController:o,__staleWhileFetching:s,__returned:void 0});return t===void 0?(this.set(e,D,{...p.options,status:void 0}),t=n(this,F).get(e)):n(this,T)[t]=D,D},A=function(e){if(!n(this,de))return false;let t=e;return !!t&&t instanceof Promise&&t.hasOwnProperty("__staleWhileFetching")&&t.__abortController instanceof Ye},Xe=function(e,t){n(this,j)[t]=e,n(this,K)[e]=t;},xe=function(e){e!==n(this,V)&&(e===n(this,G)?m(this,G,n(this,K)[e]):f(this,h,Xe).call(this,n(this,j)[e],n(this,K)[e]),f(this,h,Xe).call(this,n(this,V),e),m(this,V,e));},ce=function(e,t){var i,s;let r=false;if(n(this,Y)!==0){let o=n(this,F).get(e);if(o!==void 0)if(r=true,n(this,Y)===1)f(this,h,Je).call(this,t);else {n(this,ge).call(this,o);let u=n(this,T)[o];if(f(this,h,A).call(this,u)?u.__abortController.abort(new Error("deleted")):(n(this,ne)||n(this,W))&&(n(this,ne)&&((i=n(this,J))==null||i.call(this,u,e,t)),n(this,W)&&n(this,z)?.push([u,e,t])),n(this,F).delete(e),n(this,M)[o]=void 0,n(this,T)[o]=void 0,o===n(this,V))m(this,V,n(this,j)[o]);else if(o===n(this,G))m(this,G,n(this,K)[o]);else {let p=n(this,j)[o];n(this,K)[p]=n(this,K)[o];let E=n(this,K)[o];n(this,j)[E]=n(this,j)[o];}De(this,Y)._--,n(this,ee).push(o);}}if(n(this,W)&&n(this,z)?.length){let o=n(this,z),u;for(;u=o?.shift();)(s=n(this,Q))==null||s.call(this,...u);}return r},Je=function(e){var t,r;for(let i of f(this,h,pe).call(this,{allowStale:true})){let s=n(this,T)[i];if(f(this,h,A).call(this,s))s.__abortController.abort(new Error("deleted"));else {let o=n(this,M)[i];n(this,ne)&&((t=n(this,J))==null||t.call(this,s,o,e)),n(this,W)&&n(this,z)?.push([s,o,e]);}}if(n(this,F).clear(),n(this,T).fill(void 0),n(this,M).fill(void 0),n(this,$)&&n(this,re)&&(n(this,$).fill(0),n(this,re).fill(0)),n(this,te)&&n(this,te).fill(0),m(this,G,0),m(this,V,0),n(this,ee).length=0,m(this,Z,0),m(this,Y,0),n(this,W)&&n(this,z)){let i=n(this,z),s;for(;s=i?.shift();)(r=n(this,Q))==null||r.call(this,...s);}};var Ve=Qe;var Oe=class{constructor(e){_(this,"cache");_(this,"map",new Map);this.cache=new Ve({max:e.cacheSize}),this.map=new Map;}get[Symbol.iterator](){return this.map[Symbol.iterator]}get[Symbol.toStringTag](){return this.map[Symbol.toStringTag]}clear(){return this.cache.clear(),this.map.clear()}delete(e){let t=this.map.delete(e);return t&&this.cache.delete(e),t}get forEach(){return this.map.forEach}get(e){let t=this.cache.get(e);return t||this.map.get(e)}has(e){return this.map.has(e)}set(e,t){return this.map.set(e,t),this.cache.set(e,t),this}get size(){return this.map.size}entries(){return this.map.entries()}keys(){return this.map.keys()}values(){return this.map.values()}};var Ne=new Oe({cacheSize:10}),Ze;(i=>{function l(s){let o=Ne.get(s);if(!o){L.error(`Label "${s}" not found`);return}return o}i.get=l;function e(s){if(Array.isArray(s)){s.forEach(o=>e(o));return}Ne.has(s.id)&&L.info(`Label "${s.id}" already exists, it will be overwritten`),Ne.set(s.id,s);}i.add=e;function t(){return Array.from(Ne.values())}i.values=t;function r(s){return Ne.has(s)}i.has=r;})(Ze||(Ze={}));var ie=Ze;var b=class b{constructor(){}static get allOpenedLabels(){return unifier.GameUnifier.getVariable(R.OPENED_LABELS_COUNTER_KEY)||{}}static set allOpenedLabels(e){unifier.GameUnifier.setVariable(R.OPENED_LABELS_COUNTER_KEY,e);}static getCurrentStepTimesCounterData(e=""){let t=b.currentLabelStepIndex;if(t===null)return L.error("currentLabelStepIndex is null"),null;let r=`${t}${e}`,i=b.currentLabelId,s=b._currentLabel;if(!i||t===null||!s)return L.error("currentLabelId or currentLabelStepIndex is null or currentLabel not found"),null;let o=s.getStepSha(t)||"error",u=unifier.GameUnifier.getVariable(R.CURRENT_STEP_TIMES_COUNTER_KEY)||{};return u[i]||(u[i]={}),(!u[i][r]||u[i][r].stepSha1!=o)&&(u[i][r]={stepSha1:o}),u[i][r]}static setCurrentStepTimesCounterData(e="",t){let r=b.currentLabelStepIndex,i=r+e,s=b.currentLabelId;if(!s||r===null){L.error("currentLabelId or currentLabelStepIndex is null");return}let o=unifier.GameUnifier.getVariable(R.CURRENT_STEP_TIMES_COUNTER_KEY)||{};o[s]||(o[s]={}),o[s][i]=t,unifier.GameUnifier.setVariable(R.CURRENT_STEP_TIMES_COUNTER_KEY,o);}static getCurrentStepTimesCounter(e=""){let t=b._stepCounter,r=b.getCurrentStepTimesCounterData(e);if(!r)return L.error("getCurrentStepTimesCounter obj is null"),0;let i=r.stepCounters||r.lastStepIndexs||[];return i.find(o=>o===t)||(i.push(t),delete r.lastStepIndexs,r.stepCounters=i,b.setCurrentStepTimesCounterData(e,r)),i.length}static getRandomNumber(e,t,r={}){let i=r.nestedId||"";if(r.onceOnly||false){let o=b.getCurrentStepTimesCounterData(i);if(!o)return;let u=o.usedRandomNumbers||{},p=Array.from({length:t-e+1},(g,N)=>N+e).filter(g=>!u[`${e}-${t}`]?.includes(g));if(p.length===0)return;let E=Math.floor(Math.random()*p.length),S=p[E];return u[`${e}-${t}`]||(u[`${e}-${t}`]=[]),u[`${e}-${t}`].push(S),o.usedRandomNumbers=u,b.setCurrentStepTimesCounterData(i,o),S}return Math.floor(Math.random()*(t-e+1))+e}static resetCurrentStepTimesCounter(e=""){let t=b.currentLabelStepIndex,r=t+e,i=b.currentLabelId;if(!i||t===null){L.error("currentLabelId or currentLabelStepIndex is null");return}let s=unifier.GameUnifier.getVariable(R.CURRENT_STEP_TIMES_COUNTER_KEY)||{};s[i]||(s[i]={}),s[i][r]={stepCounters:[],stepSha1:""},unifier.GameUnifier.setVariable(R.CURRENT_STEP_TIMES_COUNTER_KEY,s);}static get allChoicesMade(){return unifier.GameUnifier.getVariable(R.ALL_CHOICES_MADE_KEY)||[]}static set allChoicesMade(e){unifier.GameUnifier.setVariable(R.ALL_CHOICES_MADE_KEY,e);}static increaseStepCounter(){b._stepCounter++;}static get openedLabels(){return oe(b._openedLabels)}static set openedLabels(e){b._openedLabels=oe(e);}static get originalOpenedLabels(){return oe(b._originalOpenedLabels)}static set originalOpenedLabels(e){b._originalOpenedLabels=oe(e);}static get _currentLabel(){if(b.currentLabelId)return ie.get(b.currentLabelId)}static get currentLabelId(){if(b._openedLabels.length>0)return b._openedLabels[b._openedLabels.length-1].label}static get currentLabelStepIndex(){return b._openedLabels.length>0?b._openedLabels[b._openedLabels.length-1].currentStepIndex:null}static addLabelHistory(e,t){let r=b.allOpenedLabels,i=b.allOpenedLabels[e]?.biggestStep||0,s=b.allOpenedLabels[e]?.openCount||0;(!i||i<t)&&(r[e]={biggestStep:t,openCount:s},b.allOpenedLabels=r);}static addChoicesMade(e,t,r,i){let s=b.allChoicesMade,o=s.findIndex(u=>u.labelId===e&&u.stepIndex===t&&u.choiceIndex===i&&u.stepSha1===r);o<0?s.push({labelId:e,stepIndex:t,choiceIndex:i,stepSha1:r,madeTimes:1}):s[o].madeTimes++,b.allChoicesMade=s;}static pushNewLabel(e){if(!ie.get(e))throw new Error(`[Pixi\u2019VN] Label ${e} not found`);b._openedLabels.push({label:e,currentStepIndex:0});let r=b.allOpenedLabels,i=b.allOpenedLabels[e]?.biggestStep||0,s=b.allOpenedLabels[e]?.openCount||0;r[e]={biggestStep:i,openCount:s+1},b.allOpenedLabels=r;}static increaseCurrentStepIndex(){if(b._openedLabels.length>0){let e=b._openedLabels[b._openedLabels.length-1];b._openedLabels[b._openedLabels.length-1]={...e,currentStepIndex:e.currentStepIndex+1};}}static set onStepStart(e){b._onStepStart=e;}static get onStepStart(){return async(e,t)=>{let r=[];return b.onLoadingLabel&&e===0&&r.push(b.onLoadingLabel(e,t)),b._onStepStart&&r.push(b._onStepStart(e,t)),await Promise.all(r)}}};_(b,"stepsRunning",0),_(b,"goNextRequests",0),_(b,"choiceMadeTemp"),_(b,"lastHistoryStep",null),_(b,"_stepCounter",0),_(b,"_openedLabels",[]),_(b,"_originalOpenedLabels",[]),_(b,"_onStepStart"),_(b,"onLoadingLabel"),_(b,"onStepEnd");var c=b;var Pe=class{get currentStepTimesCounter(){return c.getCurrentStepTimesCounter()}set currentStepTimesCounter(e){c.resetCurrentStepTimesCounter();}getRandomNumber(e,t,r={}){return c.getRandomNumber(e,t,r)}get stepCounter(){return c._stepCounter}get openedLabels(){return c.openedLabels}get currentLabel(){return c._currentLabel}addStepHistory(e,t={}){let{choiceMade:r,ignoreSameStep:i}=t,s,o,u,p=unifier.GameUnifier.getVariable(R.LAST_STEP_GLUED)===this.stepCounter;unifier.GameUnifier.getVariable(R.LAST_DIALOGUE_ADDED_IN_STEP_MEMORY_KEY)===this.stepCounter&&(s=unifier.GameUnifier.getVariable(R.CURRENT_DIALOGUE_MEMORY_KEY)),unifier.GameUnifier.getVariable(R.LAST_MENU_OPTIONS_ADDED_IN_STEP_MEMORY_KEY)===this.stepCounter&&(o=unifier.GameUnifier.getVariable(R.CURRENT_MENU_OPTIONS_MEMORY_KEY)),unifier.GameUnifier.getVariable(R.LAST_INPUT_ADDED_IN_STEP_MEMORY_KEY)===this.stepCounter&&(u=unifier.GameUnifier.getVariable(R.CURRENT_INPUT_VALUE_MEMORY_KEY));let E=c.openedLabels,S={currentLabel:c.currentLabelId,dialogue:s,choices:o,stepSha1:e,index:this.stepCounter,labelStepIndex:c.currentLabelStepIndex,choiceIndexMade:r,inputValue:u,alreadyMadeChoices:this.alreadyCurrentStepMadeChoices,isGlued:p,openedLabels:E};c.originalOpenedLabels=E,unifier.GameUnifier.addHistoryItem(S,{ignoreSameStep:i}),c.lastHistoryStep=S,c.increaseStepCounter();}closeCurrentLabel(){if(!c.currentLabelId){L.warn("No label to close");return}if(!this.currentLabel){L.error("currentLabel not found");return}let e=c.openedLabels;e.pop(),c.openedLabels=e,unifier.GameUnifier.onLabelClosing(this.openedLabels.length);}closeAllLabels(){for(;c.openedLabels.length>0;)this.closeCurrentLabel(),unifier.GameUnifier.onLabelClosing(this.openedLabels.length);}isLabelAlreadyCompleted(e){let t;typeof e=="string"?t=e:t=e.id;let i=c.allOpenedLabels[t]?.biggestStep||0;if(i){let s=ie.get(t);if(s)return s.stepCount<=i}return false}get alreadyCurrentStepMadeChoicesObj(){let e=c.currentLabelStepIndex,t=this.currentLabel;if(e===null||!t)return;let r=t.getStepSha(e);return r||(L.warn("stepSha not found, setting to ERROR"),r="error"),c.allChoicesMade.filter(i=>i.labelId===t?.id&&i.stepIndex===e&&i.stepSha1===r)}get alreadyCurrentStepMadeChoices(){return this.alreadyCurrentStepMadeChoicesObj?.map(e=>e.choiceIndex)}get isCurrentStepAlreadyOpened(){let e=c.currentLabelId;if(e){let t=c.allOpenedLabels[e]?.openCount||0;if(c.currentLabelStepIndex&&t>=c.currentLabelStepIndex)return true}return false}getTimesLabelOpened(e){return c.allOpenedLabels[e]?.openCount||0}getTimesChoiceMade(e){return this.alreadyCurrentStepMadeChoicesObj?.find(t=>t.choiceIndex===e)?.madeTimes||0}addCurrentStepToHistory(){this.addStepHistory("dev",{ignoreSameStep:true});}getCanGoNext(e){let t=e?.showWarn||false,r=this.choiceMenuOptions;return r&&r.length>0?(t&&L.warn("The player must make a choice"),false):this.isRequiredInput?(t&&L.warn("The player must enter a value"),false):true}get canGoNext(){return c.stepsRunning!==0?false:this.getCanGoNext()}async onStepRun(e,t){let r=[];return e.onStepStart&&r.push(e.onStepStart(t,e)),c.onStepStart&&r.push(c.onStepStart(t,e)),await Promise.all(r)}async onStepEnd(e,t){let r=[];return e.onStepEnd&&r.push(e.onStepEnd(t,e)),c.onStepEnd&&r.push(c.onStepEnd(t,e)),await Promise.all(r)}async goNext(e,t={}){let{runNow:r=false}=t;if(!(!r&&!this.getCanGoNext({showWarn:true}))){if(!r&&c.stepsRunning!==0){c.goNextRequests++;return}try{this.currentLabel&&await this.onStepEnd(this.currentLabel,c.currentLabelStepIndex||0);}catch(i){L.error("Error running onStepEnd",i);}return c.stepsRunning===0&&await unifier.GameUnifier.onGoNextEnd(),c.increaseCurrentStepIndex(),await this.runCurrentStep(e,t)}}async runCurrentStep(e,t={}){let{choiceMade:r}=t;if(c.currentLabelId){let i=c.currentLabelStepIndex;if(i===null){L.error("currentLabelStepIndex is null");return}let s=c._currentLabel;if(!s){L.error("currentLabel not found");return}if(s.stepCount>i){try{await this.onStepRun(s,i);}catch(p){L.error("Error running onStepStart",p),this.onStepError&&this.onStepError(p,e);return}let o=s.getStepById(i);if(!o){L.error("step not found");return}let u=s.getStepSha(i);u||(L.warn("stepSha not found, setting to ERROR"),u="error");try{c.stepsRunning++;let p=await o(e,{labelId:s.id}),E=this.choiceMenuOptions;if(E?.length===1&&E[0].autoSelect){let g=E[0];p=await this.selectChoice(g,e);}let S=c.lastHistoryStep;if(r!==void 0&&S){let g=S.stepSha1;g||(L.warn("stepSha not found, setting to ERROR"),g="error"),c.addChoicesMade(S.currentLabel||"error",typeof S.labelStepIndex=="number"?S.labelStepIndex:-1,S.stepSha1||"error",r),c.choiceMadeTemp=r;}return c.stepsRunning--,c.stepsRunning===0&&(c.addLabelHistory(s.id,i),this.addStepHistory(u,{...t,choiceMade:c.choiceMadeTemp}),c.choiceMadeTemp=void 0,c.goNextRequests>0)?(c.goNextRequests--,await this.goNext(e)):p}catch(p){c.stepsRunning>0&&c.stepsRunning--,L.error("Error running step",p),this.onStepError&&this.onStepError(p,e);return}}else {if(this.openedLabels.length>1)return this.closeCurrentLabel(),await this.goNext(e,t);if(this.openedLabels.length===1)return c.openedLabels=[],unifier.GameUnifier.onEnd?await unifier.GameUnifier.onEnd(e,{labelId:"end"}):void 0}}else if(this.openedLabels.length===0){if(c.openedLabels=c.originalOpenedLabels,unifier.GameUnifier.onEnd)return await unifier.GameUnifier.onEnd(e,{labelId:"end"});L.error("The end of the game is not managed, so the game is blocked. Read this documentation to know how to manage the end of the game: https://pixi-vn.web.app/start/other-narrative-features.html#how-manage-the-end-of-the-game");return}else L.error("currentLabelId not found");}async callLabel(e,t,r){let{choiceMade:i}=r||{},s;typeof e=="string"?s=e:s=e.id;try{let o=ie.get(s);if(!o)throw new Error(`[Pixi\u2019VN] Label ${s} not found`);try{this.currentLabel&&await this.onStepEnd(this.currentLabel,c.currentLabelStepIndex||0);}catch(u){L.error("Error running onStepEnd",u);}c.pushNewLabel(o.id);}catch(o){L.error("Error calling label",o);return}return await this.runCurrentStep(t,{choiceMade:i})}async jumpLabel(e,t,r){this.openedLabels.length>0&&this.closeCurrentLabel();let{choiceMade:i}=r||{},s;typeof e=="string"?s=e:s=e.id;try{let o=ie.get(s);if(!o)throw new Error(`[Pixi\u2019VN] Label ${s} not found`);try{this.currentLabel&&await this.onStepEnd(this.currentLabel,c.currentLabelStepIndex||0);}catch(u){L.error("Error running onStepEnd",u);}c.pushNewLabel(o.id);}catch(o){L.error("Error jumping label",o);return}return await this.runCurrentStep(t,{choiceMade:i})}async selectChoice(e,t){this.choiceMenuOptions=void 0;let r=e.type;switch(r){case "call":return await this.callLabel(e.label,{...e.props,...t},{choiceMade:e.choiceIndex});case "jump":return await this.jumpLabel(e.label,{...e.props,...t},{choiceMade:e.choiceIndex});case "close":return await this.closeChoiceMenu(e,{...e.props,...t});default:throw L.error(`Type ${r} not found`),new Error(`[Pixi\u2019VN] Type ${r} not found`)}}async closeChoiceMenu(e,t){if(e.type!=="close")throw L.error("For closeChoiceMenu, the type must be close"),new Error("[Pixi\u2019VN] For closeChoiceMenu, the type must be close");let r;return typeof e.choiceIndex=="number"&&(r=e.choiceIndex),e.closeCurrentLabel&&this.closeCurrentLabel(),this.goNext(t,{choiceMade:r})}get onStepError(){let e=unifier.GameUnifier.onError;return e?(t,r)=>e("step",t,r):void 0}set onStepError(e){unifier.GameUnifier.onError=(t,r,i)=>e(r,i);}get dialogue(){let e=unifier.GameUnifier.getVariable(R.CURRENT_DIALOGUE_MEMORY_KEY);if(e)return {...e,character:e.character?unifier.GameUnifier.getCharacter(e.character)||e.character:void 0}}set dialogue(e){if(!e){unifier.GameUnifier.setVariable(R.CURRENT_DIALOGUE_MEMORY_KEY,void 0);return}if((typeof e=="string"||Array.isArray(e))&&(e={text:e}),this.dialogGlue){let t=unifier.GameUnifier.getVariable(R.CURRENT_DIALOGUE_MEMORY_KEY);if(t){let r=[];Array.isArray(t.text)?r=[...t.text]:r=[t.text],Array.isArray(e.text)?r=[...r,...e.text]:r=[...r,e.text],e.text=r,e.character=e.character||t.character;}unifier.GameUnifier.setVariable(R.LAST_STEP_GLUED,this.stepCounter),this.dialogGlue=false;}try{unifier.GameUnifier.setVariable(R.CURRENT_DIALOGUE_MEMORY_KEY,oe({...e,character:typeof e.character=="string"?e.character:e.character?.id})),unifier.GameUnifier.setVariable(R.LAST_DIALOGUE_ADDED_IN_STEP_MEMORY_KEY,this.stepCounter);}catch(t){throw L.error("DialogueInterface cannot contain functions or classes"),t}}get choiceMenuOptions(){let e=unifier.GameUnifier.getVariable(R.CURRENT_MENU_OPTIONS_MEMORY_KEY);if(e){let t=[],r=e.map((s,o)=>({...s,choiceIndex:o})),i=this.alreadyCurrentStepMadeChoices;if(r=r.filter((s,o)=>s.oneTime&&i&&i.includes(o)?false:s.onlyHaveNoChoice?(t.push(s),false):true),r.length>0)return r;if(t.length>0)return [t[0]]}}set choiceMenuOptions(e){if(!e||e.length===0){unifier.GameUnifier.setVariable(R.CURRENT_MENU_OPTIONS_MEMORY_KEY,void 0);return}try{unifier.GameUnifier.setVariable(R.CURRENT_MENU_OPTIONS_MEMORY_KEY,oe(e)),unifier.GameUnifier.setVariable(R.LAST_MENU_OPTIONS_ADDED_IN_STEP_MEMORY_KEY,this.stepCounter);}catch(t){throw L.error("ChoiceInterface cannot contain functions or classes"),t}}get dialogGlue(){return unifier.GameUnifier.getFlag(R.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY)}set dialogGlue(e){unifier.GameUnifier.setFlag(R.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,e);}get inputValue(){return unifier.GameUnifier.getVariable(R.CURRENT_INPUT_VALUE_MEMORY_KEY)}set inputValue(e){this.removeInputRequest(),unifier.GameUnifier.setVariable(R.CURRENT_INPUT_VALUE_MEMORY_KEY,e),unifier.GameUnifier.setVariable(R.LAST_INPUT_ADDED_IN_STEP_MEMORY_KEY,this.stepCounter);}get isRequiredInput(){return unifier.GameUnifier.getVariable(R.CURRENT_INPUT_INFO_MEMORY_KEY)?.isRequired||false}get inputType(){return unifier.GameUnifier.getVariable(R.CURRENT_INPUT_INFO_MEMORY_KEY)?.type}requestInput(e,t){e.isRequired=true,unifier.GameUnifier.setVariable(R.CURRENT_INPUT_INFO_MEMORY_KEY,e),t!==void 0?unifier.GameUnifier.setVariable(R.CURRENT_INPUT_VALUE_MEMORY_KEY,t):unifier.GameUnifier.removeVariable(R.CURRENT_INPUT_VALUE_MEMORY_KEY);}removeInputRequest(){unifier.GameUnifier.removeVariable(R.CURRENT_INPUT_INFO_MEMORY_KEY),unifier.GameUnifier.removeVariable(R.CURRENT_INPUT_VALUE_MEMORY_KEY);}clear(){c.openedLabels=[],c._stepCounter=0;}export(){return {openedLabels:oe(c.openedLabels),stepCounter:this.stepCounter}}async onLoadingLabel(e){let t=this.openedLabels.map(async r=>{let i=[],s=ie.get(r.label);return s&&(s.onLoadingLabel&&i.push(s.onLoadingLabel(e,s)),c.onLoadingLabel&&i.push(c.onLoadingLabel(e,s))),await Promise.all(i)});return await Promise.all(t)}async restore(e,t){this.clear();try{c.lastHistoryStep=t,e.hasOwnProperty("openedLabels")?(c.openedLabels=e.openedLabels,c.originalOpenedLabels=c.openedLabels):L.warn("Could not import openedLabels data, so will be ignored"),e.hasOwnProperty("stepCounter")?c._stepCounter=e.stepCounter:e.hasOwnProperty("lastStepIndex")?c._stepCounter=e.lastStepIndex:L.warn("Could not import stepCounter data, so will be ignored");try{await this.onLoadingLabel(c.currentLabelStepIndex||0);}catch(r){L.error("Error running onLoadingLabel",r);}}catch(r){L.error("Error importing data",r);}}};function Rt(l,e,t,r){let i=typeof e=="string"?e:e.id;return {...r,label:i,props:t,text:l,type:r?.type||"call"}}var et="close";function Ot(l,e){return {...e,type:et,text:l}}var ft=Et(dt());var ve=class{constructor(e,t){_(this,"_id");_(this,"_onStepStart");_(this,"_onLoadingLabel");_(this,"_onStepEnd");this._id=e,this._onStepStart=t?.onStepStart,this._onLoadingLabel=t?.onLoadingLabel,this._onStepEnd=t?.onStepEnd;}get id(){return this._id}get onStepStart(){return async(e,t)=>{if(this._onLoadingLabel&&e===0&&await this._onLoadingLabel(e,t),this._onStepStart)return await this._onStepStart(e,t)}}get onLoadingLabel(){return this._onLoadingLabel}get onStepEnd(){return this._onStepEnd}};var we=class extends ve{constructor(t,r,i){super(t,i);_(this,"_steps");this._steps=r;}get stepCount(){return this.steps.length}getStepById(t){return this.steps[t]}get steps(){return typeof this._steps=="function"?this._steps():this._steps}getStepSha(t){if(t<0||t>=this.steps.length)return L.warn("stepSha not found, setting to ERROR"),"error";try{let r=this.steps[t];return (0,ft.default)(r.toString().toLocaleLowerCase()).toString()}catch(r){return L.warn("stepSha not found, setting to ERROR",r),"error"}}};function bt(l,e,t){let r=new we(l,e,t);return ie.add(r),r}var wr=new Pe;
|
|
2
|
+
exports.Close=et;exports.Label=we;exports.LabelAbstract=ve;exports.NarrationManagerStatic=c;exports.RegisteredLabels=ie;exports.narration=wr;exports.newChoiceOption=Rt;exports.newCloseChoiceOption=Ot;exports.newLabel=bt;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { a as
|
|
4
|
-
|
|
5
|
-
import
|
|
1
|
+
import { StepLabelProps as StepLabelProps$1, StepLabelResult as StepLabelResult$1, ChoiceInterface as ChoiceInterface$1, GameStepState } from '@drincs/pixi-vn';
|
|
2
|
+
import { S as StorageObjectType, a as StorageElementType } from './StorageElementType-dAIVJeiw.cjs';
|
|
3
|
+
import { L as LabelIdType, a as LabelRunModeType, C as ChoiceOptionInterface, b as CloseChoiceOptionInterface, c as CloseType, H as HistoryStep, O as OpenedLabel, S as StoredIndexedChoiceInterface, D as DialogueInterface, d as StoredChoiceInterface } from './HistoryChoiceMenuOption-BjnxDyK5.cjs';
|
|
4
|
+
export { e as Close, f as HistoryChoiceMenuOption, N as NarrationHistory } from './HistoryChoiceMenuOption-BjnxDyK5.cjs';
|
|
5
|
+
import 'deep-diff';
|
|
6
|
+
import 'microdiff';
|
|
6
7
|
|
|
7
8
|
type StepLabelResultType = StepLabelResult$1 | void;
|
|
8
9
|
type StepLabelPropsType<T extends {} = {}> = StepLabelProps$1 & T;
|
|
@@ -230,6 +231,26 @@ interface ChoiceInterface {
|
|
|
230
231
|
props?: StorageObjectType;
|
|
231
232
|
}
|
|
232
233
|
|
|
234
|
+
/**
|
|
235
|
+
* Interface exported step data
|
|
236
|
+
*/
|
|
237
|
+
interface NarrationGameState {
|
|
238
|
+
/**
|
|
239
|
+
* @deprecated moved to HistoryManagerStatic
|
|
240
|
+
*/
|
|
241
|
+
stepsHistory?: HistoryStep[];
|
|
242
|
+
openedLabels: OpenedLabel[];
|
|
243
|
+
/**
|
|
244
|
+
* @deprecated use stepCounter
|
|
245
|
+
*/
|
|
246
|
+
lastStepIndex?: number;
|
|
247
|
+
stepCounter: number;
|
|
248
|
+
/**
|
|
249
|
+
* @deprecated moved to HistoryManagerStatic
|
|
250
|
+
*/
|
|
251
|
+
originalStepData?: GameStepState;
|
|
252
|
+
}
|
|
253
|
+
|
|
233
254
|
interface NarrationManagerInterface {
|
|
234
255
|
/**
|
|
235
256
|
* Counter of execution times of the current step. Current execution is also included. Starts from 1.
|
|
@@ -646,42 +667,4 @@ type InputInfo = {
|
|
|
646
667
|
|
|
647
668
|
declare const narration: NarrationManagerInterface;
|
|
648
669
|
|
|
649
|
-
type
|
|
650
|
-
declare const narrationUtils_ChoiceOptionInterface: typeof ChoiceOptionInterface;
|
|
651
|
-
declare const narrationUtils_Close: typeof Close;
|
|
652
|
-
declare const narrationUtils_CloseChoiceOptionInterface: typeof CloseChoiceOptionInterface;
|
|
653
|
-
declare const narrationUtils_CloseType: typeof CloseType;
|
|
654
|
-
declare const narrationUtils_DialogueInterface: typeof DialogueInterface;
|
|
655
|
-
declare const narrationUtils_HistoryChoiceMenuOption: typeof HistoryChoiceMenuOption;
|
|
656
|
-
declare const narrationUtils_HistoryStep: typeof HistoryStep;
|
|
657
|
-
type narrationUtils_InputInfo = InputInfo;
|
|
658
|
-
type narrationUtils_Label<T extends {} = {}> = Label<T>;
|
|
659
|
-
declare const narrationUtils_Label: typeof Label;
|
|
660
|
-
type narrationUtils_LabelAbstract<TLabel, TProps extends {} = {}, StepIdType = number> = LabelAbstract<TLabel, TProps, StepIdType>;
|
|
661
|
-
declare const narrationUtils_LabelAbstract: typeof LabelAbstract;
|
|
662
|
-
type narrationUtils_LabelProps<T, StepIdType = number> = LabelProps<T, StepIdType>;
|
|
663
|
-
declare const narrationUtils_LabelRunModeType: typeof LabelRunModeType;
|
|
664
|
-
type narrationUtils_LabelSteps<T extends {}> = LabelSteps<T>;
|
|
665
|
-
declare const narrationUtils_NarrationGameState: typeof NarrationGameState;
|
|
666
|
-
declare const narrationUtils_NarrationHistory: typeof NarrationHistory;
|
|
667
|
-
type narrationUtils_NarrationManagerInterface = NarrationManagerInterface;
|
|
668
|
-
type narrationUtils_NarrationManagerStatic = NarrationManagerStatic;
|
|
669
|
-
declare const narrationUtils_NarrationManagerStatic: typeof NarrationManagerStatic;
|
|
670
|
-
declare const narrationUtils_OpenedLabel: typeof OpenedLabel;
|
|
671
|
-
declare const narrationUtils_RegisteredLabels: typeof RegisteredLabels;
|
|
672
|
-
type narrationUtils_StepLabelProps = StepLabelProps;
|
|
673
|
-
type narrationUtils_StepLabelPropsType<T extends {} = {}> = StepLabelPropsType<T>;
|
|
674
|
-
type narrationUtils_StepLabelResult = StepLabelResult;
|
|
675
|
-
type narrationUtils_StepLabelResultType = StepLabelResultType;
|
|
676
|
-
type narrationUtils_StepLabelType<T extends {} = {}> = StepLabelType<T>;
|
|
677
|
-
declare const narrationUtils_StoredChoiceInterface: typeof StoredChoiceInterface;
|
|
678
|
-
declare const narrationUtils_StoredIndexedChoiceInterface: typeof StoredIndexedChoiceInterface;
|
|
679
|
-
declare const narrationUtils_narration: typeof narration;
|
|
680
|
-
declare const narrationUtils_newChoiceOption: typeof newChoiceOption;
|
|
681
|
-
declare const narrationUtils_newCloseChoiceOption: typeof newCloseChoiceOption;
|
|
682
|
-
declare const narrationUtils_newLabel: typeof newLabel;
|
|
683
|
-
declare namespace narrationUtils {
|
|
684
|
-
export { type narrationUtils_ChoiceInterface as ChoiceInterface, narrationUtils_ChoiceOptionInterface as ChoiceOptionInterface, narrationUtils_Close as Close, narrationUtils_CloseChoiceOptionInterface as CloseChoiceOptionInterface, narrationUtils_CloseType as CloseType, narrationUtils_DialogueInterface as DialogueInterface, narrationUtils_HistoryChoiceMenuOption as HistoryChoiceMenuOption, narrationUtils_HistoryStep as HistoryStep, type narrationUtils_InputInfo as InputInfo, narrationUtils_Label as Label, narrationUtils_LabelAbstract as LabelAbstract, type narrationUtils_LabelProps as LabelProps, narrationUtils_LabelRunModeType as LabelRunModeType, type narrationUtils_LabelSteps as LabelSteps, narrationUtils_NarrationGameState as NarrationGameState, narrationUtils_NarrationHistory as NarrationHistory, type narrationUtils_NarrationManagerInterface as NarrationManagerInterface, narrationUtils_NarrationManagerStatic as NarrationManagerStatic, narrationUtils_OpenedLabel as OpenedLabel, narrationUtils_RegisteredLabels as RegisteredLabels, type narrationUtils_StepLabelProps as StepLabelProps, type narrationUtils_StepLabelPropsType as StepLabelPropsType, type narrationUtils_StepLabelResult as StepLabelResult, type narrationUtils_StepLabelResultType as StepLabelResultType, type narrationUtils_StepLabelType as StepLabelType, narrationUtils_StoredChoiceInterface as StoredChoiceInterface, narrationUtils_StoredIndexedChoiceInterface as StoredIndexedChoiceInterface, narrationUtils_narration as narration, narrationUtils_newChoiceOption as newChoiceOption, narrationUtils_newCloseChoiceOption as newCloseChoiceOption, narrationUtils_newLabel as newLabel };
|
|
685
|
-
}
|
|
686
|
-
|
|
687
|
-
export { type ChoiceInterface as C, type InputInfo as I, LabelAbstract as L, type NarrationManagerInterface as N, RegisteredLabels as R, type StepLabelType as S, type StepLabelPropsType as a, narration as b, newChoiceOption as c, newCloseChoiceOption as d, Label as e, newLabel as f, type LabelProps as g, type StepLabelProps as h, type StepLabelResult as i, NarrationManagerStatic as j, type LabelSteps as k, type StepLabelResultType as l, narrationUtils as n };
|
|
670
|
+
export { type ChoiceInterface, ChoiceOptionInterface, CloseChoiceOptionInterface, CloseType, DialogueInterface, HistoryStep, type InputInfo, Label, LabelAbstract, type LabelProps, LabelRunModeType, type LabelSteps, type NarrationGameState, type NarrationManagerInterface, NarrationManagerStatic, OpenedLabel, RegisteredLabels, type StepLabelProps, type StepLabelPropsType, type StepLabelResult, type StepLabelResultType, type StepLabelType, StoredChoiceInterface, StoredIndexedChoiceInterface, narration, newChoiceOption, newCloseChoiceOption, newLabel };
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { a as
|
|
4
|
-
|
|
5
|
-
import
|
|
1
|
+
import { StepLabelProps as StepLabelProps$1, StepLabelResult as StepLabelResult$1, ChoiceInterface as ChoiceInterface$1, GameStepState } from '@drincs/pixi-vn';
|
|
2
|
+
import { S as StorageObjectType, a as StorageElementType } from './StorageElementType-dAIVJeiw.js';
|
|
3
|
+
import { L as LabelIdType, a as LabelRunModeType, C as ChoiceOptionInterface, b as CloseChoiceOptionInterface, c as CloseType, H as HistoryStep, O as OpenedLabel, S as StoredIndexedChoiceInterface, D as DialogueInterface, d as StoredChoiceInterface } from './HistoryChoiceMenuOption-ZdrL_kYX.js';
|
|
4
|
+
export { e as Close, f as HistoryChoiceMenuOption, N as NarrationHistory } from './HistoryChoiceMenuOption-ZdrL_kYX.js';
|
|
5
|
+
import 'deep-diff';
|
|
6
|
+
import 'microdiff';
|
|
6
7
|
|
|
7
8
|
type StepLabelResultType = StepLabelResult$1 | void;
|
|
8
9
|
type StepLabelPropsType<T extends {} = {}> = StepLabelProps$1 & T;
|
|
@@ -230,6 +231,26 @@ interface ChoiceInterface {
|
|
|
230
231
|
props?: StorageObjectType;
|
|
231
232
|
}
|
|
232
233
|
|
|
234
|
+
/**
|
|
235
|
+
* Interface exported step data
|
|
236
|
+
*/
|
|
237
|
+
interface NarrationGameState {
|
|
238
|
+
/**
|
|
239
|
+
* @deprecated moved to HistoryManagerStatic
|
|
240
|
+
*/
|
|
241
|
+
stepsHistory?: HistoryStep[];
|
|
242
|
+
openedLabels: OpenedLabel[];
|
|
243
|
+
/**
|
|
244
|
+
* @deprecated use stepCounter
|
|
245
|
+
*/
|
|
246
|
+
lastStepIndex?: number;
|
|
247
|
+
stepCounter: number;
|
|
248
|
+
/**
|
|
249
|
+
* @deprecated moved to HistoryManagerStatic
|
|
250
|
+
*/
|
|
251
|
+
originalStepData?: GameStepState;
|
|
252
|
+
}
|
|
253
|
+
|
|
233
254
|
interface NarrationManagerInterface {
|
|
234
255
|
/**
|
|
235
256
|
* Counter of execution times of the current step. Current execution is also included. Starts from 1.
|
|
@@ -646,42 +667,4 @@ type InputInfo = {
|
|
|
646
667
|
|
|
647
668
|
declare const narration: NarrationManagerInterface;
|
|
648
669
|
|
|
649
|
-
type
|
|
650
|
-
declare const narrationUtils_ChoiceOptionInterface: typeof ChoiceOptionInterface;
|
|
651
|
-
declare const narrationUtils_Close: typeof Close;
|
|
652
|
-
declare const narrationUtils_CloseChoiceOptionInterface: typeof CloseChoiceOptionInterface;
|
|
653
|
-
declare const narrationUtils_CloseType: typeof CloseType;
|
|
654
|
-
declare const narrationUtils_DialogueInterface: typeof DialogueInterface;
|
|
655
|
-
declare const narrationUtils_HistoryChoiceMenuOption: typeof HistoryChoiceMenuOption;
|
|
656
|
-
declare const narrationUtils_HistoryStep: typeof HistoryStep;
|
|
657
|
-
type narrationUtils_InputInfo = InputInfo;
|
|
658
|
-
type narrationUtils_Label<T extends {} = {}> = Label<T>;
|
|
659
|
-
declare const narrationUtils_Label: typeof Label;
|
|
660
|
-
type narrationUtils_LabelAbstract<TLabel, TProps extends {} = {}, StepIdType = number> = LabelAbstract<TLabel, TProps, StepIdType>;
|
|
661
|
-
declare const narrationUtils_LabelAbstract: typeof LabelAbstract;
|
|
662
|
-
type narrationUtils_LabelProps<T, StepIdType = number> = LabelProps<T, StepIdType>;
|
|
663
|
-
declare const narrationUtils_LabelRunModeType: typeof LabelRunModeType;
|
|
664
|
-
type narrationUtils_LabelSteps<T extends {}> = LabelSteps<T>;
|
|
665
|
-
declare const narrationUtils_NarrationGameState: typeof NarrationGameState;
|
|
666
|
-
declare const narrationUtils_NarrationHistory: typeof NarrationHistory;
|
|
667
|
-
type narrationUtils_NarrationManagerInterface = NarrationManagerInterface;
|
|
668
|
-
type narrationUtils_NarrationManagerStatic = NarrationManagerStatic;
|
|
669
|
-
declare const narrationUtils_NarrationManagerStatic: typeof NarrationManagerStatic;
|
|
670
|
-
declare const narrationUtils_OpenedLabel: typeof OpenedLabel;
|
|
671
|
-
declare const narrationUtils_RegisteredLabels: typeof RegisteredLabels;
|
|
672
|
-
type narrationUtils_StepLabelProps = StepLabelProps;
|
|
673
|
-
type narrationUtils_StepLabelPropsType<T extends {} = {}> = StepLabelPropsType<T>;
|
|
674
|
-
type narrationUtils_StepLabelResult = StepLabelResult;
|
|
675
|
-
type narrationUtils_StepLabelResultType = StepLabelResultType;
|
|
676
|
-
type narrationUtils_StepLabelType<T extends {} = {}> = StepLabelType<T>;
|
|
677
|
-
declare const narrationUtils_StoredChoiceInterface: typeof StoredChoiceInterface;
|
|
678
|
-
declare const narrationUtils_StoredIndexedChoiceInterface: typeof StoredIndexedChoiceInterface;
|
|
679
|
-
declare const narrationUtils_narration: typeof narration;
|
|
680
|
-
declare const narrationUtils_newChoiceOption: typeof newChoiceOption;
|
|
681
|
-
declare const narrationUtils_newCloseChoiceOption: typeof newCloseChoiceOption;
|
|
682
|
-
declare const narrationUtils_newLabel: typeof newLabel;
|
|
683
|
-
declare namespace narrationUtils {
|
|
684
|
-
export { type narrationUtils_ChoiceInterface as ChoiceInterface, narrationUtils_ChoiceOptionInterface as ChoiceOptionInterface, narrationUtils_Close as Close, narrationUtils_CloseChoiceOptionInterface as CloseChoiceOptionInterface, narrationUtils_CloseType as CloseType, narrationUtils_DialogueInterface as DialogueInterface, narrationUtils_HistoryChoiceMenuOption as HistoryChoiceMenuOption, narrationUtils_HistoryStep as HistoryStep, type narrationUtils_InputInfo as InputInfo, narrationUtils_Label as Label, narrationUtils_LabelAbstract as LabelAbstract, type narrationUtils_LabelProps as LabelProps, narrationUtils_LabelRunModeType as LabelRunModeType, type narrationUtils_LabelSteps as LabelSteps, narrationUtils_NarrationGameState as NarrationGameState, narrationUtils_NarrationHistory as NarrationHistory, type narrationUtils_NarrationManagerInterface as NarrationManagerInterface, narrationUtils_NarrationManagerStatic as NarrationManagerStatic, narrationUtils_OpenedLabel as OpenedLabel, narrationUtils_RegisteredLabels as RegisteredLabels, type narrationUtils_StepLabelProps as StepLabelProps, type narrationUtils_StepLabelPropsType as StepLabelPropsType, type narrationUtils_StepLabelResult as StepLabelResult, type narrationUtils_StepLabelResultType as StepLabelResultType, type narrationUtils_StepLabelType as StepLabelType, narrationUtils_StoredChoiceInterface as StoredChoiceInterface, narrationUtils_StoredIndexedChoiceInterface as StoredIndexedChoiceInterface, narrationUtils_narration as narration, narrationUtils_newChoiceOption as newChoiceOption, narrationUtils_newCloseChoiceOption as newCloseChoiceOption, narrationUtils_newLabel as newLabel };
|
|
685
|
-
}
|
|
686
|
-
|
|
687
|
-
export { type ChoiceInterface as C, type InputInfo as I, LabelAbstract as L, type NarrationManagerInterface as N, RegisteredLabels as R, type StepLabelType as S, type StepLabelPropsType as a, narration as b, newChoiceOption as c, newCloseChoiceOption as d, Label as e, newLabel as f, type LabelProps as g, type StepLabelProps as h, type StepLabelResult as i, NarrationManagerStatic as j, type LabelSteps as k, type StepLabelResultType as l, narrationUtils as n };
|
|
670
|
+
export { type ChoiceInterface, ChoiceOptionInterface, CloseChoiceOptionInterface, CloseType, DialogueInterface, HistoryStep, type InputInfo, Label, LabelAbstract, type LabelProps, LabelRunModeType, type LabelSteps, type NarrationGameState, type NarrationManagerInterface, NarrationManagerStatic, OpenedLabel, RegisteredLabels, type StepLabelProps, type StepLabelPropsType, type StepLabelResult, type StepLabelResultType, type StepLabelType, StoredChoiceInterface, StoredIndexedChoiceInterface, narration, newChoiceOption, newCloseChoiceOption, newLabel };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import {GameUnifier}from'@drincs/pixi-vn/unifier';import {filters}from'@pixi/sound';var mt=Object.create;var Ke=Object.defineProperty;var St=Object.getOwnPropertyDescriptor;var gt=Object.getOwnPropertyNames;var _t=Object.getPrototypeOf,yt=Object.prototype.hasOwnProperty;var tt=l=>{throw TypeError(l)};var Lt=(l,e,t)=>e in l?Ke(l,e,{enumerable:true,configurable:true,writable:true,value:t}):l[e]=t;var We=(l=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(l,{get:(e,t)=>(typeof require<"u"?require:e)[t]}):l)(function(l){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+l+'" is not supported')});var rt=(l,e)=>()=>(e||l((e={exports:{}}).exports,e),e.exports);var Tt=(l,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of gt(e))!yt.call(l,i)&&i!==t&&Ke(l,i,{get:()=>e[i],enumerable:!(r=St(e,i))||r.enumerable});return l};var Et=(l,e,t)=>(t=l!=null?mt(_t(l)):{},Tt(Ke(t,"default",{value:l,enumerable:true}),l));var _=(l,e,t)=>Lt(l,typeof e!="symbol"?e+"":e,t),Be=(l,e,t)=>e.has(l)||tt("Cannot "+t);var n=(l,e,t)=>(Be(l,e,"read from private field"),t?t.call(l):e.get(l)),v=(l,e,t)=>e.has(l)?tt("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(l):e.set(l,t),m=(l,e,t,r)=>(Be(l,e,"write to private field"),e.set(l,t),t),f=(l,e,t)=>(Be(l,e,"access private method"),t);var De=(l,e,t,r)=>({set _(i){m(l,e,i);},get _(){return n(l,e,r)}});var pt=rt((ze,ht)=>{(function(l,e){typeof ze=="object"?ht.exports=ze=e():typeof define=="function"&&define.amd?define([],e):l.CryptoJS=e();})(ze,function(){var l=l||(function(e,t){var r;if(typeof window<"u"&&window.crypto&&(r=window.crypto),typeof self<"u"&&self.crypto&&(r=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(r=globalThis.crypto),!r&&typeof window<"u"&&window.msCrypto&&(r=window.msCrypto),!r&&typeof global<"u"&&global.crypto&&(r=global.crypto),!r&&typeof We=="function")try{r=We("crypto");}catch{}var i=function(){if(r){if(typeof r.getRandomValues=="function")try{return r.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof r.randomBytes=="function")try{return r.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},s=Object.create||(function(){function a(){}return function(d){var I;return a.prototype=d,I=new a,a.prototype=null,I}})(),o={},u=o.lib={},p=u.Base=(function(){return {extend:function(a){var d=s(this);return a&&d.mixIn(a),(!d.hasOwnProperty("init")||this.init===d.init)&&(d.init=function(){d.$super.init.apply(this,arguments);}),d.init.prototype=d,d.$super=this,d},create:function(){var a=this.extend();return a.init.apply(a,arguments),a},init:function(){},mixIn:function(a){for(var d in a)a.hasOwnProperty(d)&&(this[d]=a[d]);a.hasOwnProperty("toString")&&(this.toString=a.toString);},clone:function(){return this.init.prototype.extend(this)}}})(),E=u.WordArray=p.extend({init:function(a,d){a=this.words=a||[],d!=t?this.sigBytes=d:this.sigBytes=a.length*4;},toString:function(a){return (a||g).stringify(this)},concat:function(a){var d=this.words,I=a.words,y=this.sigBytes,w=a.sigBytes;if(this.clamp(),y%4)for(var U=0;U<w;U++){var se=I[U>>>2]>>>24-U%4*8&255;d[y+U>>>2]|=se<<24-(y+U)%4*8;}else for(var H=0;H<w;H+=4)d[y+H>>>2]=I[H>>>2];return this.sigBytes+=w,this},clamp:function(){var a=this.words,d=this.sigBytes;a[d>>>2]&=4294967295<<32-d%4*8,a.length=e.ceil(d/4);},clone:function(){var a=p.clone.call(this);return a.words=this.words.slice(0),a},random:function(a){for(var d=[],I=0;I<a;I+=4)d.push(i());return new E.init(d,a)}}),S=o.enc={},g=S.Hex={stringify:function(a){for(var d=a.words,I=a.sigBytes,y=[],w=0;w<I;w++){var U=d[w>>>2]>>>24-w%4*8&255;y.push((U>>>4).toString(16)),y.push((U&15).toString(16));}return y.join("")},parse:function(a){for(var d=a.length,I=[],y=0;y<d;y+=2)I[y>>>3]|=parseInt(a.substr(y,2),16)<<24-y%8*4;return new E.init(I,d/2)}},N=S.Latin1={stringify:function(a){for(var d=a.words,I=a.sigBytes,y=[],w=0;w<I;w++){var U=d[w>>>2]>>>24-w%4*8&255;y.push(String.fromCharCode(U));}return y.join("")},parse:function(a){for(var d=a.length,I=[],y=0;y<d;y++)I[y>>>2]|=(a.charCodeAt(y)&255)<<24-y%4*8;return new E.init(I,d)}},P=S.Utf8={stringify:function(a){try{return decodeURIComponent(escape(N.stringify(a)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(a){return N.parse(unescape(encodeURIComponent(a)))}},D=u.BufferedBlockAlgorithm=p.extend({reset:function(){this._data=new E.init,this._nDataBytes=0;},_append:function(a){typeof a=="string"&&(a=P.parse(a)),this._data.concat(a),this._nDataBytes+=a.sigBytes;},_process:function(a){var d,I=this._data,y=I.words,w=I.sigBytes,U=this.blockSize,se=U*4,H=w/se;a?H=e.ceil(H):H=e.max((H|0)-this._minBufferSize,0);var q=H*U,_e=e.min(q*4,w);if(q){for(var He=0;He<q;He+=U)this._doProcessBlock(y,He);d=y.splice(0,q),I.sigBytes-=_e;}return new E.init(d,_e)},clone:function(){var a=p.clone.call(this);return a._data=this._data.clone(),a},_minBufferSize:0});u.Hasher=D.extend({cfg:p.extend(),init:function(a){this.cfg=this.cfg.extend(a),this.reset();},reset:function(){D.reset.call(this),this._doReset();},update:function(a){return this._append(a),this._process(),this},finalize:function(a){a&&this._append(a);var d=this._doFinalize();return d},blockSize:512/32,_createHelper:function(a){return function(d,I){return new a.init(I).finalize(d)}},_createHmacHelper:function(a){return function(d,I){return new C.HMAC.init(a,I).finalize(d)}}});var C=o.algo={};return o})(Math);return l});});var dt=rt((Ge,ct)=>{(function(l,e){typeof Ge=="object"?ct.exports=Ge=e(pt()):typeof define=="function"&&define.amd?define(["./core"],e):e(l.CryptoJS);})(Ge,function(l){return (function(){var e=l,t=e.lib,r=t.WordArray,i=t.Hasher,s=e.algo,o=[],u=s.SHA1=i.extend({_doReset:function(){this._hash=new r.init([1732584193,4023233417,2562383102,271733878,3285377520]);},_doProcessBlock:function(p,E){for(var S=this._hash.words,g=S[0],N=S[1],P=S[2],D=S[3],x=S[4],C=0;C<80;C++){if(C<16)o[C]=p[E+C]|0;else {var a=o[C-3]^o[C-8]^o[C-14]^o[C-16];o[C]=a<<1|a>>>31;}var d=(g<<5|g>>>27)+x+o[C];C<20?d+=(N&P|~N&D)+1518500249:C<40?d+=(N^P^D)+1859775393:C<60?d+=(N&P|N&D|P&D)-1894007588:d+=(N^P^D)-899497514,x=D,D=P,P=N<<30|N>>>2,N=g,g=d;}S[0]=S[0]+g|0,S[1]=S[1]+N|0,S[2]=S[2]+P|0,S[3]=S[3]+D|0,S[4]=S[4]+x|0;},_doFinalize:function(){var p=this._data,E=p.words,S=this._nDataBytes*8,g=p.sigBytes*8;return E[g>>>5]|=128<<24-g%32,E[(g+64>>>9<<4)+14]=Math.floor(S/4294967296),E[(g+64>>>9<<4)+15]=S,p.sigBytes=E.length*4,this._process(),this._hash},clone:function(){var p=i.clone.call(this);return p._hash=this._hash.clone(),p}});e.SHA1=i._createHelper(u),e.HmacSHA1=i._createHmacHelper(u);})(),l.SHA1});});({DistortionFilter:filters.DistortionFilter,EqualizerFilter:filters.EqualizerFilter,MonoFilter:filters.MonoFilter,ReverbFilter:filters.ReverbFilter,StereoFilter:filters.StereoFilter,StreamFilter:filters.StreamFilter,TelephoneFilter:filters.TelephoneFilter});var R={CURRENT_DIALOGUE_MEMORY_KEY:"___current_dialogue_memory___",LAST_DIALOGUE_ADDED_IN_STEP_MEMORY_KEY:"___last_dialogue_added_in_step_memory___",CURRENT_MENU_OPTIONS_MEMORY_KEY:"___current_menu_options_memory___",LAST_MENU_OPTIONS_ADDED_IN_STEP_MEMORY_KEY:"___last_menu_options_added_in_step_memory___",CURRENT_INPUT_VALUE_MEMORY_KEY:"_input_value_",LAST_INPUT_ADDED_IN_STEP_MEMORY_KEY:"___last_input_added_in_step_memory___",CURRENT_INPUT_INFO_MEMORY_KEY:"___current_input_info_memory___",CHARACTER_CATEGORY_KEY:"___character___",ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY:"___glue___",OPENED_LABELS_COUNTER_KEY:"___opened_labels_counter___",ALL_CHOICES_MADE_KEY:"___all_choices_made___",CURRENT_STEP_TIMES_COUNTER_KEY:"___current_step_times_counter___",LAST_STEP_GLUED:"___last_step_glued___"};var L;(i=>(i.log=(s,...o)=>console.log(`[Pixi\u2019VN] ${s}`,...o),i.warn=(s,...o)=>console.warn(`[Pixi\u2019VN] ${s}`,...o),i.error=(s,...o)=>console.error(`[Pixi\u2019VN] ${s}`,...o),i.info=(s,...o)=>console.info(`[Pixi\u2019VN] ${s}`,...o)))(L||(L={}));function oe(l){try{if(typeof l>"u")return l;let e=JSON.stringify(l);return JSON.parse(e)}catch(e){throw L.error("Error creating exportable element",l,e),new Error("[Pixi\u2019VN] Error creating exportable element")}}var ye=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,ot=new Set,je=typeof process=="object"&&process?process:{},at=(l,e,t,r)=>{typeof je.emitWarning=="function"?je.emitWarning(l,e,t,r):console.error(`[${t}] ${e}: ${l}`);},Ye=globalThis.AbortController,nt=globalThis.AbortSignal;if(typeof Ye>"u"){nt=class{constructor(){_(this,"onabort");_(this,"_onabort",[]);_(this,"reason");_(this,"aborted",false);}addEventListener(r,i){this._onabort.push(i);}},Ye=class{constructor(){_(this,"signal",new nt);e();}abort(r){if(!this.signal.aborted){this.signal.reason=r,this.signal.aborted=true;for(let i of this.signal._onabort)i(r);this.signal.onabort?.(r);}}};let l=je.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{l&&(l=false,at("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",e));};}var Ct=l=>!ot.has(l),ue=l=>l&&l===Math.floor(l)&&l>0&&isFinite(l),lt=l=>ue(l)?l<=Math.pow(2,8)?Uint8Array:l<=Math.pow(2,16)?Uint16Array:l<=Math.pow(2,32)?Uint32Array:l<=Number.MAX_SAFE_INTEGER?Le:null:null,Le=class extends Array{constructor(e){super(e),this.fill(0);}},Te,be=class be{constructor(e,t){_(this,"heap");_(this,"length");if(!n(be,Te))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new t(e),this.length=0;}static create(e){let t=lt(e);if(!t)return [];m(be,Te,true);let r=new be(e,t);return m(be,Te,false),r}push(e){this.heap[this.length++]=e;}pop(){return this.heap[--this.length]}};Te=new WeakMap,v(be,Te,false);var $e=be,it,st,X,B,J,me,Q,Ee,Ce,Y,Z,F,M,T,K,j,G,V,ee,z,te,re,$,ne,de,W,Ie,h,ke,Se,ae,Ae,k,ut,ge,Re,Me,he,pe,qe,Ue,Fe,A,Xe,xe,ce,Je,Qe=class Qe{constructor(e){v(this,h);v(this,X);v(this,B);v(this,J);v(this,me);v(this,Q);v(this,Ee);v(this,Ce);_(this,"ttl");_(this,"ttlResolution");_(this,"ttlAutopurge");_(this,"updateAgeOnGet");_(this,"updateAgeOnHas");_(this,"allowStale");_(this,"noDisposeOnSet");_(this,"noUpdateTTL");_(this,"maxEntrySize");_(this,"sizeCalculation");_(this,"noDeleteOnFetchRejection");_(this,"noDeleteOnStaleGet");_(this,"allowStaleOnFetchAbort");_(this,"allowStaleOnFetchRejection");_(this,"ignoreFetchAbort");v(this,Y);v(this,Z);v(this,F);v(this,M);v(this,T);v(this,K);v(this,j);v(this,G);v(this,V);v(this,ee);v(this,z);v(this,te);v(this,re);v(this,$);v(this,ne);v(this,de);v(this,W);v(this,Ie);v(this,Se,()=>{});v(this,ae,()=>{});v(this,Ae,()=>{});v(this,k,()=>false);v(this,ge,e=>{});v(this,Re,(e,t,r)=>{});v(this,Me,(e,t,r,i)=>{if(r||i)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});_(this,it,"LRUCache");let{max:t=0,ttl:r,ttlResolution:i=1,ttlAutopurge:s,updateAgeOnGet:o,updateAgeOnHas:u,allowStale:p,dispose:E,onInsert:S,disposeAfter:g,noDisposeOnSet:N,noUpdateTTL:P,maxSize:D=0,maxEntrySize:x=0,sizeCalculation:C,fetchMethod:a,memoMethod:d,noDeleteOnFetchRejection:I,noDeleteOnStaleGet:y,allowStaleOnFetchRejection:w,allowStaleOnFetchAbort:U,ignoreFetchAbort:se}=e;if(t!==0&&!ue(t))throw new TypeError("max option must be a nonnegative integer");let H=t?lt(t):Array;if(!H)throw new Error("invalid max value: "+t);if(m(this,X,t),m(this,B,D),this.maxEntrySize=x||n(this,B),this.sizeCalculation=C,this.sizeCalculation){if(!n(this,B)&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(d!==void 0&&typeof d!="function")throw new TypeError("memoMethod must be a function if defined");if(m(this,Ce,d),a!==void 0&&typeof a!="function")throw new TypeError("fetchMethod must be a function if specified");if(m(this,Ee,a),m(this,de,!!a),m(this,F,new Map),m(this,M,new Array(t).fill(void 0)),m(this,T,new Array(t).fill(void 0)),m(this,K,new H(t)),m(this,j,new H(t)),m(this,G,0),m(this,V,0),m(this,ee,$e.create(t)),m(this,Y,0),m(this,Z,0),typeof E=="function"&&m(this,J,E),typeof S=="function"&&m(this,me,S),typeof g=="function"?(m(this,Q,g),m(this,z,[])):(m(this,Q,void 0),m(this,z,void 0)),m(this,ne,!!n(this,J)),m(this,Ie,!!n(this,me)),m(this,W,!!n(this,Q)),this.noDisposeOnSet=!!N,this.noUpdateTTL=!!P,this.noDeleteOnFetchRejection=!!I,this.allowStaleOnFetchRejection=!!w,this.allowStaleOnFetchAbort=!!U,this.ignoreFetchAbort=!!se,this.maxEntrySize!==0){if(n(this,B)!==0&&!ue(n(this,B)))throw new TypeError("maxSize must be a positive integer if specified");if(!ue(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");f(this,h,ut).call(this);}if(this.allowStale=!!p,this.noDeleteOnStaleGet=!!y,this.updateAgeOnGet=!!o,this.updateAgeOnHas=!!u,this.ttlResolution=ue(i)||i===0?i:1,this.ttlAutopurge=!!s,this.ttl=r||0,this.ttl){if(!ue(this.ttl))throw new TypeError("ttl must be a positive integer if specified");f(this,h,ke).call(this);}if(n(this,X)===0&&this.ttl===0&&n(this,B)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!n(this,X)&&!n(this,B)){let q="LRU_CACHE_UNBOUNDED";Ct(q)&&(ot.add(q),at("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",q,Qe));}}static unsafeExposeInternals(e){return {starts:n(e,re),ttls:n(e,$),sizes:n(e,te),keyMap:n(e,F),keyList:n(e,M),valList:n(e,T),next:n(e,K),prev:n(e,j),get head(){return n(e,G)},get tail(){return n(e,V)},free:n(e,ee),isBackgroundFetch:t=>{var r;return f(r=e,h,A).call(r,t)},backgroundFetch:(t,r,i,s)=>{var o;return f(o=e,h,Fe).call(o,t,r,i,s)},moveToTail:t=>{var r;return f(r=e,h,xe).call(r,t)},indexes:t=>{var r;return f(r=e,h,he).call(r,t)},rindexes:t=>{var r;return f(r=e,h,pe).call(r,t)},isStale:t=>{var r;return n(r=e,k).call(r,t)}}}get max(){return n(this,X)}get maxSize(){return n(this,B)}get calculatedSize(){return n(this,Z)}get size(){return n(this,Y)}get fetchMethod(){return n(this,Ee)}get memoMethod(){return n(this,Ce)}get dispose(){return n(this,J)}get onInsert(){return n(this,me)}get disposeAfter(){return n(this,Q)}getRemainingTTL(e){return n(this,F).has(e)?1/0:0}*entries(){for(let e of f(this,h,he).call(this))n(this,T)[e]!==void 0&&n(this,M)[e]!==void 0&&!f(this,h,A).call(this,n(this,T)[e])&&(yield [n(this,M)[e],n(this,T)[e]]);}*rentries(){for(let e of f(this,h,pe).call(this))n(this,T)[e]!==void 0&&n(this,M)[e]!==void 0&&!f(this,h,A).call(this,n(this,T)[e])&&(yield [n(this,M)[e],n(this,T)[e]]);}*keys(){for(let e of f(this,h,he).call(this)){let t=n(this,M)[e];t!==void 0&&!f(this,h,A).call(this,n(this,T)[e])&&(yield t);}}*rkeys(){for(let e of f(this,h,pe).call(this)){let t=n(this,M)[e];t!==void 0&&!f(this,h,A).call(this,n(this,T)[e])&&(yield t);}}*values(){for(let e of f(this,h,he).call(this))n(this,T)[e]!==void 0&&!f(this,h,A).call(this,n(this,T)[e])&&(yield n(this,T)[e]);}*rvalues(){for(let e of f(this,h,pe).call(this))n(this,T)[e]!==void 0&&!f(this,h,A).call(this,n(this,T)[e])&&(yield n(this,T)[e]);}[(st=Symbol.iterator,it=Symbol.toStringTag,st)](){return this.entries()}find(e,t={}){for(let r of f(this,h,he).call(this)){let i=n(this,T)[r],s=f(this,h,A).call(this,i)?i.__staleWhileFetching:i;if(s!==void 0&&e(s,n(this,M)[r],this))return this.get(n(this,M)[r],t)}}forEach(e,t=this){for(let r of f(this,h,he).call(this)){let i=n(this,T)[r],s=f(this,h,A).call(this,i)?i.__staleWhileFetching:i;s!==void 0&&e.call(t,s,n(this,M)[r],this);}}rforEach(e,t=this){for(let r of f(this,h,pe).call(this)){let i=n(this,T)[r],s=f(this,h,A).call(this,i)?i.__staleWhileFetching:i;s!==void 0&&e.call(t,s,n(this,M)[r],this);}}purgeStale(){let e=false;for(let t of f(this,h,pe).call(this,{allowStale:true}))n(this,k).call(this,t)&&(f(this,h,ce).call(this,n(this,M)[t],"expire"),e=true);return e}info(e){let t=n(this,F).get(e);if(t===void 0)return;let r=n(this,T)[t],i=f(this,h,A).call(this,r)?r.__staleWhileFetching:r;if(i===void 0)return;let s={value:i};if(n(this,$)&&n(this,re)){let o=n(this,$)[t],u=n(this,re)[t];if(o&&u){let p=o-(ye.now()-u);s.ttl=p,s.start=Date.now();}}return n(this,te)&&(s.size=n(this,te)[t]),s}dump(){let e=[];for(let t of f(this,h,he).call(this,{allowStale:true})){let r=n(this,M)[t],i=n(this,T)[t],s=f(this,h,A).call(this,i)?i.__staleWhileFetching:i;if(s===void 0||r===void 0)continue;let o={value:s};if(n(this,$)&&n(this,re)){o.ttl=n(this,$)[t];let u=ye.now()-n(this,re)[t];o.start=Math.floor(Date.now()-u);}n(this,te)&&(o.size=n(this,te)[t]),e.unshift([r,o]);}return e}load(e){this.clear();for(let[t,r]of e){if(r.start){let i=Date.now()-r.start;r.start=ye.now()-i;}this.set(t,r.value,r);}}set(e,t,r={}){var N,P,D,x;if(t===void 0)return this.delete(e),this;let{ttl:i=this.ttl,start:s,noDisposeOnSet:o=this.noDisposeOnSet,sizeCalculation:u=this.sizeCalculation,status:p}=r,{noUpdateTTL:E=this.noUpdateTTL}=r,S=n(this,Me).call(this,e,t,r.size||0,u);if(this.maxEntrySize&&S>this.maxEntrySize)return p&&(p.set="miss",p.maxEntrySizeExceeded=true),f(this,h,ce).call(this,e,"set"),this;let g=n(this,Y)===0?void 0:n(this,F).get(e);if(g===void 0)g=n(this,Y)===0?n(this,V):n(this,ee).length!==0?n(this,ee).pop():n(this,Y)===n(this,X)?f(this,h,Ue).call(this,false):n(this,Y),n(this,M)[g]=e,n(this,T)[g]=t,n(this,F).set(e,g),n(this,K)[n(this,V)]=g,n(this,j)[g]=n(this,V),m(this,V,g),De(this,Y)._++,n(this,Re).call(this,g,S,p),p&&(p.set="add"),E=false,n(this,Ie)&&((N=n(this,me))==null||N.call(this,t,e,"add"));else {f(this,h,xe).call(this,g);let C=n(this,T)[g];if(t!==C){if(n(this,de)&&f(this,h,A).call(this,C)){C.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:a}=C;a!==void 0&&!o&&(n(this,ne)&&((P=n(this,J))==null||P.call(this,a,e,"set")),n(this,W)&&n(this,z)?.push([a,e,"set"]));}else o||(n(this,ne)&&((D=n(this,J))==null||D.call(this,C,e,"set")),n(this,W)&&n(this,z)?.push([C,e,"set"]));if(n(this,ge).call(this,g),n(this,Re).call(this,g,S,p),n(this,T)[g]=t,p){p.set="replace";let a=C&&f(this,h,A).call(this,C)?C.__staleWhileFetching:C;a!==void 0&&(p.oldValue=a);}}else p&&(p.set="update");n(this,Ie)&&this.onInsert?.(t,e,t===C?"update":"replace");}if(i!==0&&!n(this,$)&&f(this,h,ke).call(this),n(this,$)&&(E||n(this,Ae).call(this,g,i,s),p&&n(this,ae).call(this,p,g)),!o&&n(this,W)&&n(this,z)){let C=n(this,z),a;for(;a=C?.shift();)(x=n(this,Q))==null||x.call(this,...a);}return this}pop(){var e;try{for(;n(this,Y);){let t=n(this,T)[n(this,G)];if(f(this,h,Ue).call(this,!0),f(this,h,A).call(this,t)){if(t.__staleWhileFetching)return t.__staleWhileFetching}else if(t!==void 0)return t}}finally{if(n(this,W)&&n(this,z)){let t=n(this,z),r;for(;r=t?.shift();)(e=n(this,Q))==null||e.call(this,...r);}}}has(e,t={}){let{updateAgeOnHas:r=this.updateAgeOnHas,status:i}=t,s=n(this,F).get(e);if(s!==void 0){let o=n(this,T)[s];if(f(this,h,A).call(this,o)&&o.__staleWhileFetching===void 0)return false;if(n(this,k).call(this,s))i&&(i.has="stale",n(this,ae).call(this,i,s));else return r&&n(this,Se).call(this,s),i&&(i.has="hit",n(this,ae).call(this,i,s)),true}else i&&(i.has="miss");return false}peek(e,t={}){let{allowStale:r=this.allowStale}=t,i=n(this,F).get(e);if(i===void 0||!r&&n(this,k).call(this,i))return;let s=n(this,T)[i];return f(this,h,A).call(this,s)?s.__staleWhileFetching:s}async fetch(e,t={}){let{allowStale:r=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:s=this.noDeleteOnStaleGet,ttl:o=this.ttl,noDisposeOnSet:u=this.noDisposeOnSet,size:p=0,sizeCalculation:E=this.sizeCalculation,noUpdateTTL:S=this.noUpdateTTL,noDeleteOnFetchRejection:g=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:N=this.allowStaleOnFetchRejection,ignoreFetchAbort:P=this.ignoreFetchAbort,allowStaleOnFetchAbort:D=this.allowStaleOnFetchAbort,context:x,forceRefresh:C=false,status:a,signal:d}=t;if(!n(this,de))return a&&(a.fetch="get"),this.get(e,{allowStale:r,updateAgeOnGet:i,noDeleteOnStaleGet:s,status:a});let I={allowStale:r,updateAgeOnGet:i,noDeleteOnStaleGet:s,ttl:o,noDisposeOnSet:u,size:p,sizeCalculation:E,noUpdateTTL:S,noDeleteOnFetchRejection:g,allowStaleOnFetchRejection:N,allowStaleOnFetchAbort:D,ignoreFetchAbort:P,status:a,signal:d},y=n(this,F).get(e);if(y===void 0){a&&(a.fetch="miss");let w=f(this,h,Fe).call(this,e,y,I,x);return w.__returned=w}else {let w=n(this,T)[y];if(f(this,h,A).call(this,w)){let _e=r&&w.__staleWhileFetching!==void 0;return a&&(a.fetch="inflight",_e&&(a.returnedStale=true)),_e?w.__staleWhileFetching:w.__returned=w}let U=n(this,k).call(this,y);if(!C&&!U)return a&&(a.fetch="hit"),f(this,h,xe).call(this,y),i&&n(this,Se).call(this,y),a&&n(this,ae).call(this,a,y),w;let se=f(this,h,Fe).call(this,e,y,I,x),q=se.__staleWhileFetching!==void 0&&r;return a&&(a.fetch=U?"stale":"refresh",q&&U&&(a.returnedStale=true)),q?se.__staleWhileFetching:se.__returned=se}}async forceFetch(e,t={}){let r=await this.fetch(e,t);if(r===void 0)throw new Error("fetch() returned undefined");return r}memo(e,t={}){let r=n(this,Ce);if(!r)throw new Error("no memoMethod provided to constructor");let{context:i,forceRefresh:s,...o}=t,u=this.get(e,o);if(!s&&u!==void 0)return u;let p=r(e,u,{options:o,context:i});return this.set(e,p,o),p}get(e,t={}){let{allowStale:r=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:s=this.noDeleteOnStaleGet,status:o}=t,u=n(this,F).get(e);if(u!==void 0){let p=n(this,T)[u],E=f(this,h,A).call(this,p);return o&&n(this,ae).call(this,o,u),n(this,k).call(this,u)?(o&&(o.get="stale"),E?(o&&r&&p.__staleWhileFetching!==void 0&&(o.returnedStale=true),r?p.__staleWhileFetching:void 0):(s||f(this,h,ce).call(this,e,"expire"),o&&r&&(o.returnedStale=true),r?p:void 0)):(o&&(o.get="hit"),E?p.__staleWhileFetching:(f(this,h,xe).call(this,u),i&&n(this,Se).call(this,u),p))}else o&&(o.get="miss");}delete(e){return f(this,h,ce).call(this,e,"delete")}clear(){return f(this,h,Je).call(this,"delete")}};X=new WeakMap,B=new WeakMap,J=new WeakMap,me=new WeakMap,Q=new WeakMap,Ee=new WeakMap,Ce=new WeakMap,Y=new WeakMap,Z=new WeakMap,F=new WeakMap,M=new WeakMap,T=new WeakMap,K=new WeakMap,j=new WeakMap,G=new WeakMap,V=new WeakMap,ee=new WeakMap,z=new WeakMap,te=new WeakMap,re=new WeakMap,$=new WeakMap,ne=new WeakMap,de=new WeakMap,W=new WeakMap,Ie=new WeakMap,h=new WeakSet,ke=function(){let e=new Le(n(this,X)),t=new Le(n(this,X));m(this,$,e),m(this,re,t),m(this,Ae,(s,o,u=ye.now())=>{if(t[s]=o!==0?u:0,e[s]=o,o!==0&&this.ttlAutopurge){let p=setTimeout(()=>{n(this,k).call(this,s)&&f(this,h,ce).call(this,n(this,M)[s],"expire");},o+1);p.unref&&p.unref();}}),m(this,Se,s=>{t[s]=e[s]!==0?ye.now():0;}),m(this,ae,(s,o)=>{if(e[o]){let u=e[o],p=t[o];if(!u||!p)return;s.ttl=u,s.start=p,s.now=r||i();let E=s.now-p;s.remainingTTL=u-E;}});let r=0,i=()=>{let s=ye.now();if(this.ttlResolution>0){r=s;let o=setTimeout(()=>r=0,this.ttlResolution);o.unref&&o.unref();}return s};this.getRemainingTTL=s=>{let o=n(this,F).get(s);if(o===void 0)return 0;let u=e[o],p=t[o];if(!u||!p)return 1/0;let E=(r||i())-p;return u-E},m(this,k,s=>{let o=t[s],u=e[s];return !!u&&!!o&&(r||i())-o>u});},Se=new WeakMap,ae=new WeakMap,Ae=new WeakMap,k=new WeakMap,ut=function(){let e=new Le(n(this,X));m(this,Z,0),m(this,te,e),m(this,ge,t=>{m(this,Z,n(this,Z)-e[t]),e[t]=0;}),m(this,Me,(t,r,i,s)=>{if(f(this,h,A).call(this,r))return 0;if(!ue(i))if(s){if(typeof s!="function")throw new TypeError("sizeCalculation must be a function");if(i=s(r,t),!ue(i))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return i}),m(this,Re,(t,r,i)=>{if(e[t]=r,n(this,B)){let s=n(this,B)-e[t];for(;n(this,Z)>s;)f(this,h,Ue).call(this,true);}m(this,Z,n(this,Z)+e[t]),i&&(i.entrySize=r,i.totalCalculatedSize=n(this,Z));});},ge=new WeakMap,Re=new WeakMap,Me=new WeakMap,he=function*({allowStale:e=this.allowStale}={}){if(n(this,Y))for(let t=n(this,V);!(!f(this,h,qe).call(this,t)||((e||!n(this,k).call(this,t))&&(yield t),t===n(this,G)));)t=n(this,j)[t];},pe=function*({allowStale:e=this.allowStale}={}){if(n(this,Y))for(let t=n(this,G);!(!f(this,h,qe).call(this,t)||((e||!n(this,k).call(this,t))&&(yield t),t===n(this,V)));)t=n(this,K)[t];},qe=function(e){return e!==void 0&&n(this,F).get(n(this,M)[e])===e},Ue=function(e){var s;let t=n(this,G),r=n(this,M)[t],i=n(this,T)[t];return n(this,de)&&f(this,h,A).call(this,i)?i.__abortController.abort(new Error("evicted")):(n(this,ne)||n(this,W))&&(n(this,ne)&&((s=n(this,J))==null||s.call(this,i,r,"evict")),n(this,W)&&n(this,z)?.push([i,r,"evict"])),n(this,ge).call(this,t),e&&(n(this,M)[t]=void 0,n(this,T)[t]=void 0,n(this,ee).push(t)),n(this,Y)===1?(m(this,G,m(this,V,0)),n(this,ee).length=0):m(this,G,n(this,K)[t]),n(this,F).delete(r),De(this,Y)._--,t},Fe=function(e,t,r,i){let s=t===void 0?void 0:n(this,T)[t];if(f(this,h,A).call(this,s))return s;let o=new Ye,{signal:u}=r;u?.addEventListener("abort",()=>o.abort(u.reason),{signal:o.signal});let p={signal:o.signal,options:r,context:i},E=(x,C=false)=>{let{aborted:a}=o.signal,d=r.ignoreFetchAbort&&x!==void 0;if(r.status&&(a&&!C?(r.status.fetchAborted=true,r.status.fetchError=o.signal.reason,d&&(r.status.fetchAbortIgnored=true)):r.status.fetchResolved=true),a&&!d&&!C)return g(o.signal.reason);let I=P;return n(this,T)[t]===P&&(x===void 0?I.__staleWhileFetching?n(this,T)[t]=I.__staleWhileFetching:f(this,h,ce).call(this,e,"fetch"):(r.status&&(r.status.fetchUpdated=true),this.set(e,x,p.options))),x},S=x=>(r.status&&(r.status.fetchRejected=true,r.status.fetchError=x),g(x)),g=x=>{let{aborted:C}=o.signal,a=C&&r.allowStaleOnFetchAbort,d=a||r.allowStaleOnFetchRejection,I=d||r.noDeleteOnFetchRejection,y=P;if(n(this,T)[t]===P&&(!I||y.__staleWhileFetching===void 0?f(this,h,ce).call(this,e,"fetch"):a||(n(this,T)[t]=y.__staleWhileFetching)),d)return r.status&&y.__staleWhileFetching!==void 0&&(r.status.returnedStale=true),y.__staleWhileFetching;if(y.__returned===y)throw x},N=(x,C)=>{var d;let a=(d=n(this,Ee))==null?void 0:d.call(this,e,s,p);a&&a instanceof Promise&&a.then(I=>x(I===void 0?void 0:I),C),o.signal.addEventListener("abort",()=>{(!r.ignoreFetchAbort||r.allowStaleOnFetchAbort)&&(x(void 0),r.allowStaleOnFetchAbort&&(x=I=>E(I,true)));});};r.status&&(r.status.fetchDispatched=true);let P=new Promise(N).then(E,S),D=Object.assign(P,{__abortController:o,__staleWhileFetching:s,__returned:void 0});return t===void 0?(this.set(e,D,{...p.options,status:void 0}),t=n(this,F).get(e)):n(this,T)[t]=D,D},A=function(e){if(!n(this,de))return false;let t=e;return !!t&&t instanceof Promise&&t.hasOwnProperty("__staleWhileFetching")&&t.__abortController instanceof Ye},Xe=function(e,t){n(this,j)[t]=e,n(this,K)[e]=t;},xe=function(e){e!==n(this,V)&&(e===n(this,G)?m(this,G,n(this,K)[e]):f(this,h,Xe).call(this,n(this,j)[e],n(this,K)[e]),f(this,h,Xe).call(this,n(this,V),e),m(this,V,e));},ce=function(e,t){var i,s;let r=false;if(n(this,Y)!==0){let o=n(this,F).get(e);if(o!==void 0)if(r=true,n(this,Y)===1)f(this,h,Je).call(this,t);else {n(this,ge).call(this,o);let u=n(this,T)[o];if(f(this,h,A).call(this,u)?u.__abortController.abort(new Error("deleted")):(n(this,ne)||n(this,W))&&(n(this,ne)&&((i=n(this,J))==null||i.call(this,u,e,t)),n(this,W)&&n(this,z)?.push([u,e,t])),n(this,F).delete(e),n(this,M)[o]=void 0,n(this,T)[o]=void 0,o===n(this,V))m(this,V,n(this,j)[o]);else if(o===n(this,G))m(this,G,n(this,K)[o]);else {let p=n(this,j)[o];n(this,K)[p]=n(this,K)[o];let E=n(this,K)[o];n(this,j)[E]=n(this,j)[o];}De(this,Y)._--,n(this,ee).push(o);}}if(n(this,W)&&n(this,z)?.length){let o=n(this,z),u;for(;u=o?.shift();)(s=n(this,Q))==null||s.call(this,...u);}return r},Je=function(e){var t,r;for(let i of f(this,h,pe).call(this,{allowStale:true})){let s=n(this,T)[i];if(f(this,h,A).call(this,s))s.__abortController.abort(new Error("deleted"));else {let o=n(this,M)[i];n(this,ne)&&((t=n(this,J))==null||t.call(this,s,o,e)),n(this,W)&&n(this,z)?.push([s,o,e]);}}if(n(this,F).clear(),n(this,T).fill(void 0),n(this,M).fill(void 0),n(this,$)&&n(this,re)&&(n(this,$).fill(0),n(this,re).fill(0)),n(this,te)&&n(this,te).fill(0),m(this,G,0),m(this,V,0),n(this,ee).length=0,m(this,Z,0),m(this,Y,0),n(this,W)&&n(this,z)){let i=n(this,z),s;for(;s=i?.shift();)(r=n(this,Q))==null||r.call(this,...s);}};var Ve=Qe;var Oe=class{constructor(e){_(this,"cache");_(this,"map",new Map);this.cache=new Ve({max:e.cacheSize}),this.map=new Map;}get[Symbol.iterator](){return this.map[Symbol.iterator]}get[Symbol.toStringTag](){return this.map[Symbol.toStringTag]}clear(){return this.cache.clear(),this.map.clear()}delete(e){let t=this.map.delete(e);return t&&this.cache.delete(e),t}get forEach(){return this.map.forEach}get(e){let t=this.cache.get(e);return t||this.map.get(e)}has(e){return this.map.has(e)}set(e,t){return this.map.set(e,t),this.cache.set(e,t),this}get size(){return this.map.size}entries(){return this.map.entries()}keys(){return this.map.keys()}values(){return this.map.values()}};var Ne=new Oe({cacheSize:10}),Ze;(i=>{function l(s){let o=Ne.get(s);if(!o){L.error(`Label "${s}" not found`);return}return o}i.get=l;function e(s){if(Array.isArray(s)){s.forEach(o=>e(o));return}Ne.has(s.id)&&L.info(`Label "${s.id}" already exists, it will be overwritten`),Ne.set(s.id,s);}i.add=e;function t(){return Array.from(Ne.values())}i.values=t;function r(s){return Ne.has(s)}i.has=r;})(Ze||(Ze={}));var ie=Ze;var b=class b{constructor(){}static get allOpenedLabels(){return GameUnifier.getVariable(R.OPENED_LABELS_COUNTER_KEY)||{}}static set allOpenedLabels(e){GameUnifier.setVariable(R.OPENED_LABELS_COUNTER_KEY,e);}static getCurrentStepTimesCounterData(e=""){let t=b.currentLabelStepIndex;if(t===null)return L.error("currentLabelStepIndex is null"),null;let r=`${t}${e}`,i=b.currentLabelId,s=b._currentLabel;if(!i||t===null||!s)return L.error("currentLabelId or currentLabelStepIndex is null or currentLabel not found"),null;let o=s.getStepSha(t)||"error",u=GameUnifier.getVariable(R.CURRENT_STEP_TIMES_COUNTER_KEY)||{};return u[i]||(u[i]={}),(!u[i][r]||u[i][r].stepSha1!=o)&&(u[i][r]={stepSha1:o}),u[i][r]}static setCurrentStepTimesCounterData(e="",t){let r=b.currentLabelStepIndex,i=r+e,s=b.currentLabelId;if(!s||r===null){L.error("currentLabelId or currentLabelStepIndex is null");return}let o=GameUnifier.getVariable(R.CURRENT_STEP_TIMES_COUNTER_KEY)||{};o[s]||(o[s]={}),o[s][i]=t,GameUnifier.setVariable(R.CURRENT_STEP_TIMES_COUNTER_KEY,o);}static getCurrentStepTimesCounter(e=""){let t=b._stepCounter,r=b.getCurrentStepTimesCounterData(e);if(!r)return L.error("getCurrentStepTimesCounter obj is null"),0;let i=r.stepCounters||r.lastStepIndexs||[];return i.find(o=>o===t)||(i.push(t),delete r.lastStepIndexs,r.stepCounters=i,b.setCurrentStepTimesCounterData(e,r)),i.length}static getRandomNumber(e,t,r={}){let i=r.nestedId||"";if(r.onceOnly||false){let o=b.getCurrentStepTimesCounterData(i);if(!o)return;let u=o.usedRandomNumbers||{},p=Array.from({length:t-e+1},(g,N)=>N+e).filter(g=>!u[`${e}-${t}`]?.includes(g));if(p.length===0)return;let E=Math.floor(Math.random()*p.length),S=p[E];return u[`${e}-${t}`]||(u[`${e}-${t}`]=[]),u[`${e}-${t}`].push(S),o.usedRandomNumbers=u,b.setCurrentStepTimesCounterData(i,o),S}return Math.floor(Math.random()*(t-e+1))+e}static resetCurrentStepTimesCounter(e=""){let t=b.currentLabelStepIndex,r=t+e,i=b.currentLabelId;if(!i||t===null){L.error("currentLabelId or currentLabelStepIndex is null");return}let s=GameUnifier.getVariable(R.CURRENT_STEP_TIMES_COUNTER_KEY)||{};s[i]||(s[i]={}),s[i][r]={stepCounters:[],stepSha1:""},GameUnifier.setVariable(R.CURRENT_STEP_TIMES_COUNTER_KEY,s);}static get allChoicesMade(){return GameUnifier.getVariable(R.ALL_CHOICES_MADE_KEY)||[]}static set allChoicesMade(e){GameUnifier.setVariable(R.ALL_CHOICES_MADE_KEY,e);}static increaseStepCounter(){b._stepCounter++;}static get openedLabels(){return oe(b._openedLabels)}static set openedLabels(e){b._openedLabels=oe(e);}static get originalOpenedLabels(){return oe(b._originalOpenedLabels)}static set originalOpenedLabels(e){b._originalOpenedLabels=oe(e);}static get _currentLabel(){if(b.currentLabelId)return ie.get(b.currentLabelId)}static get currentLabelId(){if(b._openedLabels.length>0)return b._openedLabels[b._openedLabels.length-1].label}static get currentLabelStepIndex(){return b._openedLabels.length>0?b._openedLabels[b._openedLabels.length-1].currentStepIndex:null}static addLabelHistory(e,t){let r=b.allOpenedLabels,i=b.allOpenedLabels[e]?.biggestStep||0,s=b.allOpenedLabels[e]?.openCount||0;(!i||i<t)&&(r[e]={biggestStep:t,openCount:s},b.allOpenedLabels=r);}static addChoicesMade(e,t,r,i){let s=b.allChoicesMade,o=s.findIndex(u=>u.labelId===e&&u.stepIndex===t&&u.choiceIndex===i&&u.stepSha1===r);o<0?s.push({labelId:e,stepIndex:t,choiceIndex:i,stepSha1:r,madeTimes:1}):s[o].madeTimes++,b.allChoicesMade=s;}static pushNewLabel(e){if(!ie.get(e))throw new Error(`[Pixi\u2019VN] Label ${e} not found`);b._openedLabels.push({label:e,currentStepIndex:0});let r=b.allOpenedLabels,i=b.allOpenedLabels[e]?.biggestStep||0,s=b.allOpenedLabels[e]?.openCount||0;r[e]={biggestStep:i,openCount:s+1},b.allOpenedLabels=r;}static increaseCurrentStepIndex(){if(b._openedLabels.length>0){let e=b._openedLabels[b._openedLabels.length-1];b._openedLabels[b._openedLabels.length-1]={...e,currentStepIndex:e.currentStepIndex+1};}}static set onStepStart(e){b._onStepStart=e;}static get onStepStart(){return async(e,t)=>{let r=[];return b.onLoadingLabel&&e===0&&r.push(b.onLoadingLabel(e,t)),b._onStepStart&&r.push(b._onStepStart(e,t)),await Promise.all(r)}}};_(b,"stepsRunning",0),_(b,"goNextRequests",0),_(b,"choiceMadeTemp"),_(b,"lastHistoryStep",null),_(b,"_stepCounter",0),_(b,"_openedLabels",[]),_(b,"_originalOpenedLabels",[]),_(b,"_onStepStart"),_(b,"onLoadingLabel"),_(b,"onStepEnd");var c=b;var Pe=class{get currentStepTimesCounter(){return c.getCurrentStepTimesCounter()}set currentStepTimesCounter(e){c.resetCurrentStepTimesCounter();}getRandomNumber(e,t,r={}){return c.getRandomNumber(e,t,r)}get stepCounter(){return c._stepCounter}get openedLabels(){return c.openedLabels}get currentLabel(){return c._currentLabel}addStepHistory(e,t={}){let{choiceMade:r,ignoreSameStep:i}=t,s,o,u,p=GameUnifier.getVariable(R.LAST_STEP_GLUED)===this.stepCounter;GameUnifier.getVariable(R.LAST_DIALOGUE_ADDED_IN_STEP_MEMORY_KEY)===this.stepCounter&&(s=GameUnifier.getVariable(R.CURRENT_DIALOGUE_MEMORY_KEY)),GameUnifier.getVariable(R.LAST_MENU_OPTIONS_ADDED_IN_STEP_MEMORY_KEY)===this.stepCounter&&(o=GameUnifier.getVariable(R.CURRENT_MENU_OPTIONS_MEMORY_KEY)),GameUnifier.getVariable(R.LAST_INPUT_ADDED_IN_STEP_MEMORY_KEY)===this.stepCounter&&(u=GameUnifier.getVariable(R.CURRENT_INPUT_VALUE_MEMORY_KEY));let E=c.openedLabels,S={currentLabel:c.currentLabelId,dialogue:s,choices:o,stepSha1:e,index:this.stepCounter,labelStepIndex:c.currentLabelStepIndex,choiceIndexMade:r,inputValue:u,alreadyMadeChoices:this.alreadyCurrentStepMadeChoices,isGlued:p,openedLabels:E};c.originalOpenedLabels=E,GameUnifier.addHistoryItem(S,{ignoreSameStep:i}),c.lastHistoryStep=S,c.increaseStepCounter();}closeCurrentLabel(){if(!c.currentLabelId){L.warn("No label to close");return}if(!this.currentLabel){L.error("currentLabel not found");return}let e=c.openedLabels;e.pop(),c.openedLabels=e,GameUnifier.onLabelClosing(this.openedLabels.length);}closeAllLabels(){for(;c.openedLabels.length>0;)this.closeCurrentLabel(),GameUnifier.onLabelClosing(this.openedLabels.length);}isLabelAlreadyCompleted(e){let t;typeof e=="string"?t=e:t=e.id;let i=c.allOpenedLabels[t]?.biggestStep||0;if(i){let s=ie.get(t);if(s)return s.stepCount<=i}return false}get alreadyCurrentStepMadeChoicesObj(){let e=c.currentLabelStepIndex,t=this.currentLabel;if(e===null||!t)return;let r=t.getStepSha(e);return r||(L.warn("stepSha not found, setting to ERROR"),r="error"),c.allChoicesMade.filter(i=>i.labelId===t?.id&&i.stepIndex===e&&i.stepSha1===r)}get alreadyCurrentStepMadeChoices(){return this.alreadyCurrentStepMadeChoicesObj?.map(e=>e.choiceIndex)}get isCurrentStepAlreadyOpened(){let e=c.currentLabelId;if(e){let t=c.allOpenedLabels[e]?.openCount||0;if(c.currentLabelStepIndex&&t>=c.currentLabelStepIndex)return true}return false}getTimesLabelOpened(e){return c.allOpenedLabels[e]?.openCount||0}getTimesChoiceMade(e){return this.alreadyCurrentStepMadeChoicesObj?.find(t=>t.choiceIndex===e)?.madeTimes||0}addCurrentStepToHistory(){this.addStepHistory("dev",{ignoreSameStep:true});}getCanGoNext(e){let t=e?.showWarn||false,r=this.choiceMenuOptions;return r&&r.length>0?(t&&L.warn("The player must make a choice"),false):this.isRequiredInput?(t&&L.warn("The player must enter a value"),false):true}get canGoNext(){return c.stepsRunning!==0?false:this.getCanGoNext()}async onStepRun(e,t){let r=[];return e.onStepStart&&r.push(e.onStepStart(t,e)),c.onStepStart&&r.push(c.onStepStart(t,e)),await Promise.all(r)}async onStepEnd(e,t){let r=[];return e.onStepEnd&&r.push(e.onStepEnd(t,e)),c.onStepEnd&&r.push(c.onStepEnd(t,e)),await Promise.all(r)}async goNext(e,t={}){let{runNow:r=false}=t;if(!(!r&&!this.getCanGoNext({showWarn:true}))){if(!r&&c.stepsRunning!==0){c.goNextRequests++;return}try{this.currentLabel&&await this.onStepEnd(this.currentLabel,c.currentLabelStepIndex||0);}catch(i){L.error("Error running onStepEnd",i);}return c.stepsRunning===0&&await GameUnifier.onGoNextEnd(),c.increaseCurrentStepIndex(),await this.runCurrentStep(e,t)}}async runCurrentStep(e,t={}){let{choiceMade:r}=t;if(c.currentLabelId){let i=c.currentLabelStepIndex;if(i===null){L.error("currentLabelStepIndex is null");return}let s=c._currentLabel;if(!s){L.error("currentLabel not found");return}if(s.stepCount>i){try{await this.onStepRun(s,i);}catch(p){L.error("Error running onStepStart",p),this.onStepError&&this.onStepError(p,e);return}let o=s.getStepById(i);if(!o){L.error("step not found");return}let u=s.getStepSha(i);u||(L.warn("stepSha not found, setting to ERROR"),u="error");try{c.stepsRunning++;let p=await o(e,{labelId:s.id}),E=this.choiceMenuOptions;if(E?.length===1&&E[0].autoSelect){let g=E[0];p=await this.selectChoice(g,e);}let S=c.lastHistoryStep;if(r!==void 0&&S){let g=S.stepSha1;g||(L.warn("stepSha not found, setting to ERROR"),g="error"),c.addChoicesMade(S.currentLabel||"error",typeof S.labelStepIndex=="number"?S.labelStepIndex:-1,S.stepSha1||"error",r),c.choiceMadeTemp=r;}return c.stepsRunning--,c.stepsRunning===0&&(c.addLabelHistory(s.id,i),this.addStepHistory(u,{...t,choiceMade:c.choiceMadeTemp}),c.choiceMadeTemp=void 0,c.goNextRequests>0)?(c.goNextRequests--,await this.goNext(e)):p}catch(p){c.stepsRunning>0&&c.stepsRunning--,L.error("Error running step",p),this.onStepError&&this.onStepError(p,e);return}}else {if(this.openedLabels.length>1)return this.closeCurrentLabel(),await this.goNext(e,t);if(this.openedLabels.length===1)return c.openedLabels=[],GameUnifier.onEnd?await GameUnifier.onEnd(e,{labelId:"end"}):void 0}}else if(this.openedLabels.length===0){if(c.openedLabels=c.originalOpenedLabels,GameUnifier.onEnd)return await GameUnifier.onEnd(e,{labelId:"end"});L.error("The end of the game is not managed, so the game is blocked. Read this documentation to know how to manage the end of the game: https://pixi-vn.web.app/start/other-narrative-features.html#how-manage-the-end-of-the-game");return}else L.error("currentLabelId not found");}async callLabel(e,t,r){let{choiceMade:i}=r||{},s;typeof e=="string"?s=e:s=e.id;try{let o=ie.get(s);if(!o)throw new Error(`[Pixi\u2019VN] Label ${s} not found`);try{this.currentLabel&&await this.onStepEnd(this.currentLabel,c.currentLabelStepIndex||0);}catch(u){L.error("Error running onStepEnd",u);}c.pushNewLabel(o.id);}catch(o){L.error("Error calling label",o);return}return await this.runCurrentStep(t,{choiceMade:i})}async jumpLabel(e,t,r){this.openedLabels.length>0&&this.closeCurrentLabel();let{choiceMade:i}=r||{},s;typeof e=="string"?s=e:s=e.id;try{let o=ie.get(s);if(!o)throw new Error(`[Pixi\u2019VN] Label ${s} not found`);try{this.currentLabel&&await this.onStepEnd(this.currentLabel,c.currentLabelStepIndex||0);}catch(u){L.error("Error running onStepEnd",u);}c.pushNewLabel(o.id);}catch(o){L.error("Error jumping label",o);return}return await this.runCurrentStep(t,{choiceMade:i})}async selectChoice(e,t){this.choiceMenuOptions=void 0;let r=e.type;switch(r){case "call":return await this.callLabel(e.label,{...e.props,...t},{choiceMade:e.choiceIndex});case "jump":return await this.jumpLabel(e.label,{...e.props,...t},{choiceMade:e.choiceIndex});case "close":return await this.closeChoiceMenu(e,{...e.props,...t});default:throw L.error(`Type ${r} not found`),new Error(`[Pixi\u2019VN] Type ${r} not found`)}}async closeChoiceMenu(e,t){if(e.type!=="close")throw L.error("For closeChoiceMenu, the type must be close"),new Error("[Pixi\u2019VN] For closeChoiceMenu, the type must be close");let r;return typeof e.choiceIndex=="number"&&(r=e.choiceIndex),e.closeCurrentLabel&&this.closeCurrentLabel(),this.goNext(t,{choiceMade:r})}get onStepError(){let e=GameUnifier.onError;return e?(t,r)=>e("step",t,r):void 0}set onStepError(e){GameUnifier.onError=(t,r,i)=>e(r,i);}get dialogue(){let e=GameUnifier.getVariable(R.CURRENT_DIALOGUE_MEMORY_KEY);if(e)return {...e,character:e.character?GameUnifier.getCharacter(e.character)||e.character:void 0}}set dialogue(e){if(!e){GameUnifier.setVariable(R.CURRENT_DIALOGUE_MEMORY_KEY,void 0);return}if((typeof e=="string"||Array.isArray(e))&&(e={text:e}),this.dialogGlue){let t=GameUnifier.getVariable(R.CURRENT_DIALOGUE_MEMORY_KEY);if(t){let r=[];Array.isArray(t.text)?r=[...t.text]:r=[t.text],Array.isArray(e.text)?r=[...r,...e.text]:r=[...r,e.text],e.text=r,e.character=e.character||t.character;}GameUnifier.setVariable(R.LAST_STEP_GLUED,this.stepCounter),this.dialogGlue=false;}try{GameUnifier.setVariable(R.CURRENT_DIALOGUE_MEMORY_KEY,oe({...e,character:typeof e.character=="string"?e.character:e.character?.id})),GameUnifier.setVariable(R.LAST_DIALOGUE_ADDED_IN_STEP_MEMORY_KEY,this.stepCounter);}catch(t){throw L.error("DialogueInterface cannot contain functions or classes"),t}}get choiceMenuOptions(){let e=GameUnifier.getVariable(R.CURRENT_MENU_OPTIONS_MEMORY_KEY);if(e){let t=[],r=e.map((s,o)=>({...s,choiceIndex:o})),i=this.alreadyCurrentStepMadeChoices;if(r=r.filter((s,o)=>s.oneTime&&i&&i.includes(o)?false:s.onlyHaveNoChoice?(t.push(s),false):true),r.length>0)return r;if(t.length>0)return [t[0]]}}set choiceMenuOptions(e){if(!e||e.length===0){GameUnifier.setVariable(R.CURRENT_MENU_OPTIONS_MEMORY_KEY,void 0);return}try{GameUnifier.setVariable(R.CURRENT_MENU_OPTIONS_MEMORY_KEY,oe(e)),GameUnifier.setVariable(R.LAST_MENU_OPTIONS_ADDED_IN_STEP_MEMORY_KEY,this.stepCounter);}catch(t){throw L.error("ChoiceInterface cannot contain functions or classes"),t}}get dialogGlue(){return GameUnifier.getFlag(R.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY)}set dialogGlue(e){GameUnifier.setFlag(R.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,e);}get inputValue(){return GameUnifier.getVariable(R.CURRENT_INPUT_VALUE_MEMORY_KEY)}set inputValue(e){this.removeInputRequest(),GameUnifier.setVariable(R.CURRENT_INPUT_VALUE_MEMORY_KEY,e),GameUnifier.setVariable(R.LAST_INPUT_ADDED_IN_STEP_MEMORY_KEY,this.stepCounter);}get isRequiredInput(){return GameUnifier.getVariable(R.CURRENT_INPUT_INFO_MEMORY_KEY)?.isRequired||false}get inputType(){return GameUnifier.getVariable(R.CURRENT_INPUT_INFO_MEMORY_KEY)?.type}requestInput(e,t){e.isRequired=true,GameUnifier.setVariable(R.CURRENT_INPUT_INFO_MEMORY_KEY,e),t!==void 0?GameUnifier.setVariable(R.CURRENT_INPUT_VALUE_MEMORY_KEY,t):GameUnifier.removeVariable(R.CURRENT_INPUT_VALUE_MEMORY_KEY);}removeInputRequest(){GameUnifier.removeVariable(R.CURRENT_INPUT_INFO_MEMORY_KEY),GameUnifier.removeVariable(R.CURRENT_INPUT_VALUE_MEMORY_KEY);}clear(){c.openedLabels=[],c._stepCounter=0;}export(){return {openedLabels:oe(c.openedLabels),stepCounter:this.stepCounter}}async onLoadingLabel(e){let t=this.openedLabels.map(async r=>{let i=[],s=ie.get(r.label);return s&&(s.onLoadingLabel&&i.push(s.onLoadingLabel(e,s)),c.onLoadingLabel&&i.push(c.onLoadingLabel(e,s))),await Promise.all(i)});return await Promise.all(t)}async restore(e,t){this.clear();try{c.lastHistoryStep=t,e.hasOwnProperty("openedLabels")?(c.openedLabels=e.openedLabels,c.originalOpenedLabels=c.openedLabels):L.warn("Could not import openedLabels data, so will be ignored"),e.hasOwnProperty("stepCounter")?c._stepCounter=e.stepCounter:e.hasOwnProperty("lastStepIndex")?c._stepCounter=e.lastStepIndex:L.warn("Could not import stepCounter data, so will be ignored");try{await this.onLoadingLabel(c.currentLabelStepIndex||0);}catch(r){L.error("Error running onLoadingLabel",r);}}catch(r){L.error("Error importing data",r);}}};function Rt(l,e,t,r){let i=typeof e=="string"?e:e.id;return {...r,label:i,props:t,text:l,type:r?.type||"call"}}var et="close";function Ot(l,e){return {...e,type:et,text:l}}var ft=Et(dt());var ve=class{constructor(e,t){_(this,"_id");_(this,"_onStepStart");_(this,"_onLoadingLabel");_(this,"_onStepEnd");this._id=e,this._onStepStart=t?.onStepStart,this._onLoadingLabel=t?.onLoadingLabel,this._onStepEnd=t?.onStepEnd;}get id(){return this._id}get onStepStart(){return async(e,t)=>{if(this._onLoadingLabel&&e===0&&await this._onLoadingLabel(e,t),this._onStepStart)return await this._onStepStart(e,t)}}get onLoadingLabel(){return this._onLoadingLabel}get onStepEnd(){return this._onStepEnd}};var we=class extends ve{constructor(t,r,i){super(t,i);_(this,"_steps");this._steps=r;}get stepCount(){return this.steps.length}getStepById(t){return this.steps[t]}get steps(){return typeof this._steps=="function"?this._steps():this._steps}getStepSha(t){if(t<0||t>=this.steps.length)return L.warn("stepSha not found, setting to ERROR"),"error";try{let r=this.steps[t];return (0,ft.default)(r.toString().toLocaleLowerCase()).toString()}catch(r){return L.warn("stepSha not found, setting to ERROR",r),"error"}}};function bt(l,e,t){let r=new we(l,e,t);return ie.add(r),r}var wr=new Pe;
|
|
2
|
+
export{et as Close,we as Label,ve as LabelAbstract,c as NarrationManagerStatic,ie as RegisteredLabels,wr as narration,Rt as newChoiceOption,Ot as newCloseChoiceOption,bt as newLabel};
|
package/dist/storage.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var unifier=require('@drincs/pixi-vn/unifier');var Xt=Object.defineProperty;var Ut=l=>{throw TypeError(l)};var Qt=(l,t,i)=>t in l?Xt(l,t,{enumerable:true,configurable:true,writable:true,value:i}):l[t]=i;var m=(l,t,i)=>Qt(l,typeof t!="symbol"?t+"":t,i),Rt=(l,t,i)=>t.has(l)||Ut("Cannot "+i);var e=(l,t,i)=>(Rt(l,t,"read from private field"),i?i.call(l):t.get(l)),S=(l,t,i)=>t.has(l)?Ut("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(l):t.set(l,i),f=(l,t,i,s)=>(Rt(l,t,"write to private field"),t.set(l,i),i),h=(l,t,i)=>(Rt(l,t,"access private method"),i);var Ot=(l,t,i,s)=>({set _(n){f(l,t,n);},get _(){return e(l,t,s)}});var nt;(n=>(n.log=(r,...a)=>console.log(`[Pixi\u2019VN] ${r}`,...a),n.warn=(r,...a)=>console.warn(`[Pixi\u2019VN] ${r}`,...a),n.error=(r,...a)=>console.error(`[Pixi\u2019VN] ${r}`,...a),n.info=(r,...a)=>console.info(`[Pixi\u2019VN] ${r}`,...a)))(nt||(nt={}));function Ft(l){try{if(typeof l>"u")return l;let t=JSON.stringify(l);return JSON.parse(t)}catch(t){throw nt.error("Error creating exportable element",l,t),new Error("[Pixi\u2019VN] Error creating exportable element")}}var ct=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,$t=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}`);},zt=globalThis.AbortController,Nt=globalThis.AbortSignal;if(typeof zt>"u"){Nt=class{constructor(){m(this,"onabort");m(this,"_onabort",[]);m(this,"reason");m(this,"aborted",false);}addEventListener(s,n){this._onabort.push(n);}},zt=class{constructor(){m(this,"signal",new Nt);t();}abort(s){if(!this.signal.aborted){this.signal.reason=s,this.signal.aborted=true;for(let n of this.signal._onabort)n(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 Zt=l=>!$t.has(l),k=l=>l&&l===Math.floor(l)&&l>0&&isFinite(l),qt=l=>k(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,rt=class rt{constructor(t,i){m(this,"heap");m(this,"length");if(!e(rt,dt))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new i(t),this.length=0;}static create(t){let i=qt(t);if(!i)return [];f(rt,dt,true);let s=new rt(t,i);return f(rt,dt,false),s}push(t){this.heap[this.length++]=t;}pop(){return this.heap[--this.length]}};dt=new WeakMap,S(rt,dt,false);var Gt=rt,Ht,Kt,U,G,N,at,H,gt,pt,F,K,T,w,g,I,W,D,v,$,x,B,q,L,J,st,C,mt,o,Wt,ot,Q,_t,M,Jt,ht,St,Et,tt,et,Lt,vt,xt,b,Mt,yt,it,jt,Pt=class Pt{constructor(t){S(this,o);S(this,U);S(this,G);S(this,N);S(this,at);S(this,H);S(this,gt);S(this,pt);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");S(this,F);S(this,K);S(this,T);S(this,w);S(this,g);S(this,I);S(this,W);S(this,D);S(this,v);S(this,$);S(this,x);S(this,B);S(this,q);S(this,L);S(this,J);S(this,st);S(this,C);S(this,mt);S(this,ot,()=>{});S(this,Q,()=>{});S(this,_t,()=>{});S(this,M,()=>false);S(this,ht,t=>{});S(this,St,(t,i,s)=>{});S(this,Et,(t,i,s,n)=>{if(s||n)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});m(this,Ht,"LRUCache");let{max:i=0,ttl:s,ttlResolution:n=1,ttlAutopurge:r,updateAgeOnGet:a,updateAgeOnHas:d,allowStale:c,dispose:O,onInsert:Y,disposeAfter:y,noDisposeOnSet:Z,noUpdateTTL:j,maxSize:X=0,maxEntrySize:E=0,sizeCalculation:_,fetchMethod:p,memoMethod:R,noDeleteOnFetchRejection:V,noDeleteOnStaleGet:z,allowStaleOnFetchRejection:P,allowStaleOnFetchAbort:wt,ignoreFetchAbort:lt}=t;if(i!==0&&!k(i))throw new TypeError("max option must be a nonnegative integer");let At=i?qt(i):Array;if(!At)throw new Error("invalid max value: "+i);if(f(this,U,i),f(this,G,X),this.maxEntrySize=E||e(this,G),this.sizeCalculation=_,this.sizeCalculation){if(!e(this,G)&&!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(R!==void 0&&typeof R!="function")throw new TypeError("memoMethod must be a function if defined");if(f(this,pt,R),p!==void 0&&typeof p!="function")throw new TypeError("fetchMethod must be a function if specified");if(f(this,gt,p),f(this,st,!!p),f(this,T,new Map),f(this,w,new Array(i).fill(void 0)),f(this,g,new Array(i).fill(void 0)),f(this,I,new At(i)),f(this,W,new At(i)),f(this,D,0),f(this,v,0),f(this,$,Gt.create(i)),f(this,F,0),f(this,K,0),typeof O=="function"&&f(this,N,O),typeof Y=="function"&&f(this,at,Y),typeof y=="function"?(f(this,H,y),f(this,x,[])):(f(this,H,void 0),f(this,x,void 0)),f(this,J,!!e(this,N)),f(this,mt,!!e(this,at)),f(this,C,!!e(this,H)),this.noDisposeOnSet=!!Z,this.noUpdateTTL=!!j,this.noDeleteOnFetchRejection=!!V,this.allowStaleOnFetchRejection=!!P,this.allowStaleOnFetchAbort=!!wt,this.ignoreFetchAbort=!!lt,this.maxEntrySize!==0){if(e(this,G)!==0&&!k(e(this,G)))throw new TypeError("maxSize must be a positive integer if specified");if(!k(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");h(this,o,Jt).call(this);}if(this.allowStale=!!c,this.noDeleteOnStaleGet=!!z,this.updateAgeOnGet=!!a,this.updateAgeOnHas=!!d,this.ttlResolution=k(n)||n===0?n:1,this.ttlAutopurge=!!r,this.ttl=s||0,this.ttl){if(!k(this.ttl))throw new TypeError("ttl must be a positive integer if specified");h(this,o,Wt).call(this);}if(e(this,U)===0&&this.ttl===0&&e(this,G)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!e(this,U)&&!e(this,G)){let ft="LRU_CACHE_UNBOUNDED";Zt(ft)&&($t.add(ft),Bt("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",ft,Pt));}}static unsafeExposeInternals(t){return {starts:e(t,q),ttls:e(t,L),sizes:e(t,B),keyMap:e(t,T),keyList:e(t,w),valList:e(t,g),next:e(t,I),prev:e(t,W),get head(){return e(t,D)},get tail(){return e(t,v)},free:e(t,$),isBackgroundFetch:i=>{var s;return h(s=t,o,b).call(s,i)},backgroundFetch:(i,s,n,r)=>{var a;return h(a=t,o,xt).call(a,i,s,n,r)},moveToTail:i=>{var s;return h(s=t,o,yt).call(s,i)},indexes:i=>{var s;return h(s=t,o,tt).call(s,i)},rindexes:i=>{var s;return h(s=t,o,et).call(s,i)},isStale:i=>{var s;return e(s=t,M).call(s,i)}}}get max(){return e(this,U)}get maxSize(){return e(this,G)}get calculatedSize(){return e(this,K)}get size(){return e(this,F)}get fetchMethod(){return e(this,gt)}get memoMethod(){return e(this,pt)}get dispose(){return e(this,N)}get onInsert(){return e(this,at)}get disposeAfter(){return e(this,H)}getRemainingTTL(t){return e(this,T).has(t)?1/0:0}*entries(){for(let t of h(this,o,tt).call(this))e(this,g)[t]!==void 0&&e(this,w)[t]!==void 0&&!h(this,o,b).call(this,e(this,g)[t])&&(yield [e(this,w)[t],e(this,g)[t]]);}*rentries(){for(let t of h(this,o,et).call(this))e(this,g)[t]!==void 0&&e(this,w)[t]!==void 0&&!h(this,o,b).call(this,e(this,g)[t])&&(yield [e(this,w)[t],e(this,g)[t]]);}*keys(){for(let t of h(this,o,tt).call(this)){let i=e(this,w)[t];i!==void 0&&!h(this,o,b).call(this,e(this,g)[t])&&(yield i);}}*rkeys(){for(let t of h(this,o,et).call(this)){let i=e(this,w)[t];i!==void 0&&!h(this,o,b).call(this,e(this,g)[t])&&(yield i);}}*values(){for(let t of h(this,o,tt).call(this))e(this,g)[t]!==void 0&&!h(this,o,b).call(this,e(this,g)[t])&&(yield e(this,g)[t]);}*rvalues(){for(let t of h(this,o,et).call(this))e(this,g)[t]!==void 0&&!h(this,o,b).call(this,e(this,g)[t])&&(yield e(this,g)[t]);}[(Kt=Symbol.iterator,Ht=Symbol.toStringTag,Kt)](){return this.entries()}find(t,i={}){for(let s of h(this,o,tt).call(this)){let n=e(this,g)[s],r=h(this,o,b).call(this,n)?n.__staleWhileFetching:n;if(r!==void 0&&t(r,e(this,w)[s],this))return this.get(e(this,w)[s],i)}}forEach(t,i=this){for(let s of h(this,o,tt).call(this)){let n=e(this,g)[s],r=h(this,o,b).call(this,n)?n.__staleWhileFetching:n;r!==void 0&&t.call(i,r,e(this,w)[s],this);}}rforEach(t,i=this){for(let s of h(this,o,et).call(this)){let n=e(this,g)[s],r=h(this,o,b).call(this,n)?n.__staleWhileFetching:n;r!==void 0&&t.call(i,r,e(this,w)[s],this);}}purgeStale(){let t=false;for(let i of h(this,o,et).call(this,{allowStale:true}))e(this,M).call(this,i)&&(h(this,o,it).call(this,e(this,w)[i],"expire"),t=true);return t}info(t){let i=e(this,T).get(t);if(i===void 0)return;let s=e(this,g)[i],n=h(this,o,b).call(this,s)?s.__staleWhileFetching:s;if(n===void 0)return;let r={value:n};if(e(this,L)&&e(this,q)){let a=e(this,L)[i],d=e(this,q)[i];if(a&&d){let c=a-(ct.now()-d);r.ttl=c,r.start=Date.now();}}return e(this,B)&&(r.size=e(this,B)[i]),r}dump(){let t=[];for(let i of h(this,o,tt).call(this,{allowStale:true})){let s=e(this,w)[i],n=e(this,g)[i],r=h(this,o,b).call(this,n)?n.__staleWhileFetching:n;if(r===void 0||s===void 0)continue;let a={value:r};if(e(this,L)&&e(this,q)){a.ttl=e(this,L)[i];let d=ct.now()-e(this,q)[i];a.start=Math.floor(Date.now()-d);}e(this,B)&&(a.size=e(this,B)[i]),t.unshift([s,a]);}return t}load(t){this.clear();for(let[i,s]of t){if(s.start){let n=Date.now()-s.start;s.start=ct.now()-n;}this.set(i,s.value,s);}}set(t,i,s={}){var Z,j,X,E;if(i===void 0)return this.delete(t),this;let{ttl:n=this.ttl,start:r,noDisposeOnSet:a=this.noDisposeOnSet,sizeCalculation:d=this.sizeCalculation,status:c}=s,{noUpdateTTL:O=this.noUpdateTTL}=s,Y=e(this,Et).call(this,t,i,s.size||0,d);if(this.maxEntrySize&&Y>this.maxEntrySize)return c&&(c.set="miss",c.maxEntrySizeExceeded=true),h(this,o,it).call(this,t,"set"),this;let y=e(this,F)===0?void 0:e(this,T).get(t);if(y===void 0)y=e(this,F)===0?e(this,v):e(this,$).length!==0?e(this,$).pop():e(this,F)===e(this,U)?h(this,o,vt).call(this,false):e(this,F),e(this,w)[y]=t,e(this,g)[y]=i,e(this,T).set(t,y),e(this,I)[e(this,v)]=y,e(this,W)[y]=e(this,v),f(this,v,y),Ot(this,F)._++,e(this,St).call(this,y,Y,c),c&&(c.set="add"),O=false,e(this,mt)&&((Z=e(this,at))==null||Z.call(this,i,t,"add"));else {h(this,o,yt).call(this,y);let _=e(this,g)[y];if(i!==_){if(e(this,st)&&h(this,o,b).call(this,_)){_.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:p}=_;p!==void 0&&!a&&(e(this,J)&&((j=e(this,N))==null||j.call(this,p,t,"set")),e(this,C)&&e(this,x)?.push([p,t,"set"]));}else a||(e(this,J)&&((X=e(this,N))==null||X.call(this,_,t,"set")),e(this,C)&&e(this,x)?.push([_,t,"set"]));if(e(this,ht).call(this,y),e(this,St).call(this,y,Y,c),e(this,g)[y]=i,c){c.set="replace";let p=_&&h(this,o,b).call(this,_)?_.__staleWhileFetching:_;p!==void 0&&(c.oldValue=p);}}else c&&(c.set="update");e(this,mt)&&this.onInsert?.(i,t,i===_?"update":"replace");}if(n!==0&&!e(this,L)&&h(this,o,Wt).call(this),e(this,L)&&(O||e(this,_t).call(this,y,n,r),c&&e(this,Q).call(this,c,y)),!a&&e(this,C)&&e(this,x)){let _=e(this,x),p;for(;p=_?.shift();)(E=e(this,H))==null||E.call(this,...p);}return this}pop(){var t;try{for(;e(this,F);){let i=e(this,g)[e(this,D)];if(h(this,o,vt).call(this,!0),h(this,o,b).call(this,i)){if(i.__staleWhileFetching)return i.__staleWhileFetching}else if(i!==void 0)return i}}finally{if(e(this,C)&&e(this,x)){let i=e(this,x),s;for(;s=i?.shift();)(t=e(this,H))==null||t.call(this,...s);}}}has(t,i={}){let{updateAgeOnHas:s=this.updateAgeOnHas,status:n}=i,r=e(this,T).get(t);if(r!==void 0){let a=e(this,g)[r];if(h(this,o,b).call(this,a)&&a.__staleWhileFetching===void 0)return false;if(e(this,M).call(this,r))n&&(n.has="stale",e(this,Q).call(this,n,r));else return s&&e(this,ot).call(this,r),n&&(n.has="hit",e(this,Q).call(this,n,r)),true}else n&&(n.has="miss");return false}peek(t,i={}){let{allowStale:s=this.allowStale}=i,n=e(this,T).get(t);if(n===void 0||!s&&e(this,M).call(this,n))return;let r=e(this,g)[n];return h(this,o,b).call(this,r)?r.__staleWhileFetching:r}async fetch(t,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:n=this.updateAgeOnGet,noDeleteOnStaleGet:r=this.noDeleteOnStaleGet,ttl:a=this.ttl,noDisposeOnSet:d=this.noDisposeOnSet,size:c=0,sizeCalculation:O=this.sizeCalculation,noUpdateTTL:Y=this.noUpdateTTL,noDeleteOnFetchRejection:y=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:Z=this.allowStaleOnFetchRejection,ignoreFetchAbort:j=this.ignoreFetchAbort,allowStaleOnFetchAbort:X=this.allowStaleOnFetchAbort,context:E,forceRefresh:_=false,status:p,signal:R}=i;if(!e(this,st))return p&&(p.fetch="get"),this.get(t,{allowStale:s,updateAgeOnGet:n,noDeleteOnStaleGet:r,status:p});let V={allowStale:s,updateAgeOnGet:n,noDeleteOnStaleGet:r,ttl:a,noDisposeOnSet:d,size:c,sizeCalculation:O,noUpdateTTL:Y,noDeleteOnFetchRejection:y,allowStaleOnFetchRejection:Z,allowStaleOnFetchAbort:X,ignoreFetchAbort:j,status:p,signal:R},z=e(this,T).get(t);if(z===void 0){p&&(p.fetch="miss");let P=h(this,o,xt).call(this,t,z,V,E);return P.__returned=P}else {let P=e(this,g)[z];if(h(this,o,b).call(this,P)){let Ct=s&&P.__staleWhileFetching!==void 0;return p&&(p.fetch="inflight",Ct&&(p.returnedStale=true)),Ct?P.__staleWhileFetching:P.__returned=P}let wt=e(this,M).call(this,z);if(!_&&!wt)return p&&(p.fetch="hit"),h(this,o,yt).call(this,z),n&&e(this,ot).call(this,z),p&&e(this,Q).call(this,p,z),P;let lt=h(this,o,xt).call(this,t,z,V,E),ft=lt.__staleWhileFetching!==void 0&&s;return p&&(p.fetch=wt?"stale":"refresh",ft&&wt&&(p.returnedStale=true)),ft?lt.__staleWhileFetching:lt.__returned=lt}}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,pt);if(!s)throw new Error("no memoMethod provided to constructor");let{context:n,forceRefresh:r,...a}=i,d=this.get(t,a);if(!r&&d!==void 0)return d;let c=s(t,d,{options:a,context:n});return this.set(t,c,a),c}get(t,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:n=this.updateAgeOnGet,noDeleteOnStaleGet:r=this.noDeleteOnStaleGet,status:a}=i,d=e(this,T).get(t);if(d!==void 0){let c=e(this,g)[d],O=h(this,o,b).call(this,c);return a&&e(this,Q).call(this,a,d),e(this,M).call(this,d)?(a&&(a.get="stale"),O?(a&&s&&c.__staleWhileFetching!==void 0&&(a.returnedStale=true),s?c.__staleWhileFetching:void 0):(r||h(this,o,it).call(this,t,"expire"),a&&s&&(a.returnedStale=true),s?c:void 0)):(a&&(a.get="hit"),O?c.__staleWhileFetching:(h(this,o,yt).call(this,d),n&&e(this,ot).call(this,d),c))}else a&&(a.get="miss");}delete(t){return h(this,o,it).call(this,t,"delete")}clear(){return h(this,o,jt).call(this,"delete")}};U=new WeakMap,G=new WeakMap,N=new WeakMap,at=new WeakMap,H=new WeakMap,gt=new WeakMap,pt=new WeakMap,F=new WeakMap,K=new WeakMap,T=new WeakMap,w=new WeakMap,g=new WeakMap,I=new WeakMap,W=new WeakMap,D=new WeakMap,v=new WeakMap,$=new WeakMap,x=new WeakMap,B=new WeakMap,q=new WeakMap,L=new WeakMap,J=new WeakMap,st=new WeakMap,C=new WeakMap,mt=new WeakMap,o=new WeakSet,Wt=function(){let t=new ut(e(this,U)),i=new ut(e(this,U));f(this,L,t),f(this,q,i),f(this,_t,(r,a,d=ct.now())=>{if(i[r]=a!==0?d:0,t[r]=a,a!==0&&this.ttlAutopurge){let c=setTimeout(()=>{e(this,M).call(this,r)&&h(this,o,it).call(this,e(this,w)[r],"expire");},a+1);c.unref&&c.unref();}}),f(this,ot,r=>{i[r]=t[r]!==0?ct.now():0;}),f(this,Q,(r,a)=>{if(t[a]){let d=t[a],c=i[a];if(!d||!c)return;r.ttl=d,r.start=c,r.now=s||n();let O=r.now-c;r.remainingTTL=d-O;}});let s=0,n=()=>{let r=ct.now();if(this.ttlResolution>0){s=r;let a=setTimeout(()=>s=0,this.ttlResolution);a.unref&&a.unref();}return r};this.getRemainingTTL=r=>{let a=e(this,T).get(r);if(a===void 0)return 0;let d=t[a],c=i[a];if(!d||!c)return 1/0;let O=(s||n())-c;return d-O},f(this,M,r=>{let a=i[r],d=t[r];return !!d&&!!a&&(s||n())-a>d});},ot=new WeakMap,Q=new WeakMap,_t=new WeakMap,M=new WeakMap,Jt=function(){let t=new ut(e(this,U));f(this,K,0),f(this,B,t),f(this,ht,i=>{f(this,K,e(this,K)-t[i]),t[i]=0;}),f(this,Et,(i,s,n,r)=>{if(h(this,o,b).call(this,s))return 0;if(!k(n))if(r){if(typeof r!="function")throw new TypeError("sizeCalculation must be a function");if(n=r(s,i),!k(n))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 n}),f(this,St,(i,s,n)=>{if(t[i]=s,e(this,G)){let r=e(this,G)-t[i];for(;e(this,K)>r;)h(this,o,vt).call(this,true);}f(this,K,e(this,K)+t[i]),n&&(n.entrySize=s,n.totalCalculatedSize=e(this,K));});},ht=new WeakMap,St=new WeakMap,Et=new WeakMap,tt=function*({allowStale:t=this.allowStale}={}){if(e(this,F))for(let i=e(this,v);!(!h(this,o,Lt).call(this,i)||((t||!e(this,M).call(this,i))&&(yield i),i===e(this,D)));)i=e(this,W)[i];},et=function*({allowStale:t=this.allowStale}={}){if(e(this,F))for(let i=e(this,D);!(!h(this,o,Lt).call(this,i)||((t||!e(this,M).call(this,i))&&(yield i),i===e(this,v)));)i=e(this,I)[i];},Lt=function(t){return t!==void 0&&e(this,T).get(e(this,w)[t])===t},vt=function(t){var r;let i=e(this,D),s=e(this,w)[i],n=e(this,g)[i];return e(this,st)&&h(this,o,b).call(this,n)?n.__abortController.abort(new Error("evicted")):(e(this,J)||e(this,C))&&(e(this,J)&&((r=e(this,N))==null||r.call(this,n,s,"evict")),e(this,C)&&e(this,x)?.push([n,s,"evict"])),e(this,ht).call(this,i),t&&(e(this,w)[i]=void 0,e(this,g)[i]=void 0,e(this,$).push(i)),e(this,F)===1?(f(this,D,f(this,v,0)),e(this,$).length=0):f(this,D,e(this,I)[i]),e(this,T).delete(s),Ot(this,F)._--,i},xt=function(t,i,s,n){let r=i===void 0?void 0:e(this,g)[i];if(h(this,o,b).call(this,r))return r;let a=new zt,{signal:d}=s;d?.addEventListener("abort",()=>a.abort(d.reason),{signal:a.signal});let c={signal:a.signal,options:s,context:n},O=(E,_=false)=>{let{aborted:p}=a.signal,R=s.ignoreFetchAbort&&E!==void 0;if(s.status&&(p&&!_?(s.status.fetchAborted=true,s.status.fetchError=a.signal.reason,R&&(s.status.fetchAbortIgnored=true)):s.status.fetchResolved=true),p&&!R&&!_)return y(a.signal.reason);let V=j;return e(this,g)[i]===j&&(E===void 0?V.__staleWhileFetching?e(this,g)[i]=V.__staleWhileFetching:h(this,o,it).call(this,t,"fetch"):(s.status&&(s.status.fetchUpdated=true),this.set(t,E,c.options))),E},Y=E=>(s.status&&(s.status.fetchRejected=true,s.status.fetchError=E),y(E)),y=E=>{let{aborted:_}=a.signal,p=_&&s.allowStaleOnFetchAbort,R=p||s.allowStaleOnFetchRejection,V=R||s.noDeleteOnFetchRejection,z=j;if(e(this,g)[i]===j&&(!V||z.__staleWhileFetching===void 0?h(this,o,it).call(this,t,"fetch"):p||(e(this,g)[i]=z.__staleWhileFetching)),R)return s.status&&z.__staleWhileFetching!==void 0&&(s.status.returnedStale=true),z.__staleWhileFetching;if(z.__returned===z)throw E},Z=(E,_)=>{var R;let p=(R=e(this,gt))==null?void 0:R.call(this,t,r,c);p&&p instanceof Promise&&p.then(V=>E(V===void 0?void 0:V),_),a.signal.addEventListener("abort",()=>{(!s.ignoreFetchAbort||s.allowStaleOnFetchAbort)&&(E(void 0),s.allowStaleOnFetchAbort&&(E=V=>O(V,true)));});};s.status&&(s.status.fetchDispatched=true);let j=new Promise(Z).then(O,Y),X=Object.assign(j,{__abortController:a,__staleWhileFetching:r,__returned:void 0});return i===void 0?(this.set(t,X,{...c.options,status:void 0}),i=e(this,T).get(t)):e(this,g)[i]=X,X},b=function(t){if(!e(this,st))return false;let i=t;return !!i&&i instanceof Promise&&i.hasOwnProperty("__staleWhileFetching")&&i.__abortController instanceof zt},Mt=function(t,i){e(this,W)[i]=t,e(this,I)[t]=i;},yt=function(t){t!==e(this,v)&&(t===e(this,D)?f(this,D,e(this,I)[t]):h(this,o,Mt).call(this,e(this,W)[t],e(this,I)[t]),h(this,o,Mt).call(this,e(this,v),t),f(this,v,t));},it=function(t,i){var n,r;let s=false;if(e(this,F)!==0){let a=e(this,T).get(t);if(a!==void 0)if(s=true,e(this,F)===1)h(this,o,jt).call(this,i);else {e(this,ht).call(this,a);let d=e(this,g)[a];if(h(this,o,b).call(this,d)?d.__abortController.abort(new Error("deleted")):(e(this,J)||e(this,C))&&(e(this,J)&&((n=e(this,N))==null||n.call(this,d,t,i)),e(this,C)&&e(this,x)?.push([d,t,i])),e(this,T).delete(t),e(this,w)[a]=void 0,e(this,g)[a]=void 0,a===e(this,v))f(this,v,e(this,W)[a]);else if(a===e(this,D))f(this,D,e(this,I)[a]);else {let c=e(this,W)[a];e(this,I)[c]=e(this,I)[a];let O=e(this,I)[a];e(this,W)[O]=e(this,W)[a];}Ot(this,F)._--,e(this,$).push(a);}}if(e(this,C)&&e(this,x)?.length){let a=e(this,x),d;for(;d=a?.shift();)(r=e(this,H))==null||r.call(this,...d);}return s},jt=function(t){var i,s;for(let n of h(this,o,et).call(this,{allowStale:true})){let r=e(this,g)[n];if(h(this,o,b).call(this,r))r.__abortController.abort(new Error("deleted"));else {let a=e(this,w)[n];e(this,J)&&((i=e(this,N))==null||i.call(this,r,a,t)),e(this,C)&&e(this,x)?.push([r,a,t]);}}if(e(this,T).clear(),e(this,g).fill(void 0),e(this,w).fill(void 0),e(this,L)&&e(this,q)&&(e(this,L).fill(0),e(this,q).fill(0)),e(this,B)&&e(this,B).fill(0),f(this,D,0),f(this,v,0),e(this,$).length=0,f(this,K,0),f(this,F,0),e(this,C)&&e(this,x)){let n=e(this,x),r;for(;r=n?.shift();)(s=e(this,H))==null||s.call(this,...r);}};var Dt=Pt;var bt=class{constructor(t){m(this,"cache");m(this,"map",new Map);this.cache=new Dt({max:t.cacheSize}),this.map=new Map;}get[Symbol.iterator](){return this.map[Symbol.iterator]}get[Symbol.toStringTag](){return this.map[Symbol.toStringTag]}clear(){return this.cache.clear(),this.map.clear()}delete(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 A=class A{constructor(){}static clearOldTempVariables(t){A.tempStorageDeadlines.forEach((i,s)=>{i>t&&(A.tempStorage.delete(s),A.tempStorageDeadlines.delete(s),A.storage.cache.delete(s));});}static setVariable(t,i){let s=A.tempStorage.has(t);i==null?(A.storage.map.delete(t),!s&&A.storage.cache.delete(t)):(A.storage.map.set(t,i),!s&&A.storage.cache.set(t,i));}static getVariable(t){let i=A.storage.cache.get(t);return i===void 0&&(i=A.tempStorage.get(t)),i===void 0&&(i=A.storage.map.get(t)),Ft(i)}static removeVariable(t){A.storage.delete(t);}static setFlag(t,i){if(i)this.flags.includes(t)||this.flags.push(t);else {let s=this.flags.indexOf(t);s>-1&&this.flags.splice(s,1);}}static getFlag(t){return this.flags.includes(t)}};m(A,"storage",new bt({cacheSize:20})),m(A,"startingStorage",[]),m(A,"flags",Array()),m(A,"tempStorage",new Map),m(A,"tempStorageDeadlines",new Map);var u=A;var Tt=class{get storage(){return u.storage.map}get cache(){return u.storage.cache}get flags(){return u.flags}get tempStorage(){return u.tempStorage}get tempStorageDeadlines(){return u.tempStorageDeadlines}set startingStorage(t){let i=[],s=unifier.GameUnifier.stepCounter===0;Object.entries(t).forEach(([n,r])=>{i.push({key:n,value:r}),s&&u.storage.set(n,r);}),u.startingStorage=i;}setVariable(t,i){return u.setVariable(t,i)}getVariable(t){return u.getVariable(t)}removeVariable(t){return u.removeVariable(t)}setTempVariable(t,i){if(i==null){this.removeTempVariable(t);return}else u.tempStorage.set(t,i),u.storage.cache.set(t,i),u.tempStorageDeadlines.has(t)||u.tempStorageDeadlines.set(t,unifier.GameUnifier.openedLabels);}removeTempVariable(t){u.tempStorage.has(t)&&(u.tempStorage.delete(t),u.tempStorageDeadlines.delete(t),u.storage.cache.delete(t));}setFlag(t,i){return u.setFlag(t,i)}getFlag(t){return u.getFlag(t)}clear(){this.storage.clear(),this.cache.clear(),u.flags=[],u.tempStorage.clear(),u.tempStorageDeadlines.clear(),u.startingStorage.forEach(({key:t,value:i})=>{this.storage.set(t,i);});}export(){let t=[];[...this.storage.keys()].forEach(n=>{t.push({key:n,value:this.storage.get(n)});});let i=[];[...u.tempStorage.keys()].forEach(n=>{i.push({key:n,value:u.tempStorage.get(n)});});let s=[];return [...u.tempStorageDeadlines.keys()].forEach(n=>{s.push({key:n,value:u.tempStorageDeadlines.get(n)});}),Ft({base:t,temp:i,tempDeadlines:s,flags:u.flags})}restore(t){this.clear();try{t?(Array.isArray(t)&&t.forEach(i=>{if(i.key==="___temp_storage___"){let s=i.value;Object.entries(s).forEach(([n,r])=>{u.tempStorage.set(n,r);});}else if(i.key==="___temp_storage_deadlines___"){let s=i.value;Object.entries(s).forEach(([n,r])=>{u.tempStorageDeadlines.set(n,r);});}else i.key==="___flags___"?i.value.forEach(n=>{u.flags.push(n);}):this.storage.set(i.key,i.value);}),"base"in t&&"temp"in t&&"tempDeadlines"in t?(t.base?.forEach(i=>{this.storage.set(i.key,i.value);}),t.temp?.forEach(i=>{u.tempStorage.set(i.key,i.value);}),t.tempDeadlines?.forEach(i=>{u.tempStorageDeadlines.set(i.key,i.value);})):Object.entries(t).forEach(([i,s])=>{i==="___temp_storage___"?Object.entries(s).forEach(([n,r])=>{u.tempStorage.set(n,r);}):i==="___temp_storage_deadlines___"?Object.entries(s).forEach(([n,r])=>{u.tempStorageDeadlines.set(n,r);}):i==="___flags___"?s.forEach(n=>{u.flags.push(n);}):this.storage.set(i,s);})):nt.warn("No storage data found");}catch(i){nt.error("Error importing data",i);}}};var It=class{constructor(t,i){m(this,"_id");m(this,"categoryId");this.categoryId=t,this._id=i;}get id(){return this._id}setStorageProperty(t,i){let s=u.getVariable(this.categoryId);s||(s={}),s.hasOwnProperty(this.id)||(s[this.id]={}),i==null?s[this.id].hasOwnProperty(t)&&delete s[this.id][t]:s[this.id]={...s[this.id],[t]:i},Object.keys(s[this.id]).length===0&&delete s[this.id],u.setVariable(this.categoryId,s);}getStorageProperty(t,i=this.id){let s=u.getVariable(this.categoryId);if(s&&s.hasOwnProperty(i)&&s[i].hasOwnProperty(t))return s[i][t]}};var Fe=new Tt;exports.StorageManagerStatic=u;exports.StoredClassModel=It;exports.storage=Fe;
|
|
@@ -1,9 +1,23 @@
|
|
|
1
1
|
import { LRUCache } from 'lru-cache';
|
|
2
|
-
import {
|
|
3
|
-
export {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
import { a as StorageElementType } from './StorageElementType-dAIVJeiw.cjs';
|
|
3
|
+
export { S as StorageObjectType } from './StorageElementType-dAIVJeiw.cjs';
|
|
4
|
+
import { C as CachedMap } from './CachedMap-DZLvJAnA.cjs';
|
|
5
|
+
|
|
6
|
+
interface StorageGameStateItem<T = StorageElementType> {
|
|
7
|
+
key: string;
|
|
8
|
+
value: T;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Interface exported storage data
|
|
12
|
+
*/
|
|
13
|
+
type StorageGameState = {
|
|
14
|
+
base: StorageGameStateItem[];
|
|
15
|
+
temp: StorageGameStateItem[];
|
|
16
|
+
tempDeadlines: StorageGameStateItem<number>[];
|
|
17
|
+
flags: string[];
|
|
18
|
+
} | StorageGameStateItem[] | {
|
|
19
|
+
[key: string]: StorageElementType;
|
|
20
|
+
};
|
|
7
21
|
|
|
8
22
|
interface StorageManagerInterface {
|
|
9
23
|
/**
|
|
@@ -96,6 +110,61 @@ interface StorageManagerInterface {
|
|
|
96
110
|
restore(data: StorageGameState): void;
|
|
97
111
|
}
|
|
98
112
|
|
|
113
|
+
/**
|
|
114
|
+
* StoredClassModel is a abstract class that contains the methods to store a class in the game.
|
|
115
|
+
* I suggest you extend this class to create your own stored class.
|
|
116
|
+
* @example
|
|
117
|
+
* ```typescript
|
|
118
|
+
* export class CharacterBaseModel extends StoredClassModel implements CharacterBaseModelProps {
|
|
119
|
+
* constructor(id: string, props: CharacterBaseModelProps) {
|
|
120
|
+
* super("___character___", id)
|
|
121
|
+
* this.defaultName = props.name
|
|
122
|
+
* this.defaultSurname = props.surname
|
|
123
|
+
* }
|
|
124
|
+
* private defaultName: string = ""
|
|
125
|
+
* get name(): string {
|
|
126
|
+
* return this.getStorageProperty<string>("name") || this.defaultName
|
|
127
|
+
* }
|
|
128
|
+
* set name(value: string) {
|
|
129
|
+
* this.setStorageProperty<string>("name", value)
|
|
130
|
+
* }
|
|
131
|
+
* private defaultSurname?: string
|
|
132
|
+
* get surname(): string | undefined {
|
|
133
|
+
* return this.getStorageProperty<string>("surname") || this.defaultSurname
|
|
134
|
+
* }
|
|
135
|
+
* set surname(value: string | undefined) {
|
|
136
|
+
* this.setStorageProperty<string>("surname", value)
|
|
137
|
+
* }
|
|
138
|
+
* }
|
|
139
|
+
* ```
|
|
140
|
+
*/
|
|
141
|
+
declare class StoredClassModel {
|
|
142
|
+
/**
|
|
143
|
+
* @param categoryId The id of the category. For example if you are storing a character class, you can use "characters" as categoryId. so all instances of the character class will be stored in the "characters" category.
|
|
144
|
+
* @param id The id of instance of the class. This id must be unique for the category.
|
|
145
|
+
*/
|
|
146
|
+
constructor(categoryId: string, id: string);
|
|
147
|
+
private _id;
|
|
148
|
+
/**
|
|
149
|
+
* Is id of the stored class. is unique for this class.
|
|
150
|
+
*/
|
|
151
|
+
get id(): string;
|
|
152
|
+
private categoryId;
|
|
153
|
+
/**
|
|
154
|
+
* Update a property in the storage.
|
|
155
|
+
* @param propertyName The name of the property to set.
|
|
156
|
+
* @param value The value to set. If is undefined, the property will be removed from the storage.
|
|
157
|
+
*/
|
|
158
|
+
protected setStorageProperty<T>(propertyName: string, value: T | undefined): void;
|
|
159
|
+
/**
|
|
160
|
+
* Get a property from the storage.
|
|
161
|
+
* @param propertyName The name of the property to get.
|
|
162
|
+
* @param idToUse The id of the instance to get the property. @default this.id
|
|
163
|
+
* @returns The value of the property. If the property is not found, returns undefined.
|
|
164
|
+
*/
|
|
165
|
+
protected getStorageProperty<T>(propertyName: string, idToUse?: string): T | undefined;
|
|
166
|
+
}
|
|
167
|
+
|
|
99
168
|
declare class StorageManagerStatic {
|
|
100
169
|
static storage: CachedMap<string, any>;
|
|
101
170
|
static startingStorage: StorageGameStateItem[];
|
|
@@ -113,4 +182,4 @@ declare class StorageManagerStatic {
|
|
|
113
182
|
|
|
114
183
|
declare const storage: StorageManagerInterface;
|
|
115
184
|
|
|
116
|
-
export { StorageElementType, StorageGameState, type StorageManagerInterface, StorageManagerStatic, storage };
|
|
185
|
+
export { StorageElementType, type StorageGameState, type StorageManagerInterface, StorageManagerStatic, StoredClassModel, storage };
|