@drincs/pixi-vn 1.9.4 → 1.9.5

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/tickers.cjs CHANGED
@@ -1 +1 @@
1
- 'use strict';var core=require('@drincs/pixi-vn/core'),At=require('@drincs/pixi-vn/pixi.js');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var At__default=/*#__PURE__*/_interopDefault(At);var mt=Object.create;var He=Object.defineProperty;var Tt=Object.getOwnPropertyDescriptor;var kt=Object.getOwnPropertyNames;var yt=Object.getPrototypeOf,vt=Object.prototype.hasOwnProperty;var Je=s=>{throw TypeError(s)};var St=(s,e,i)=>e in s?He(s,e,{enumerable:true,configurable:true,writable:true,value:i}):s[e]=i;var qe=(s=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(s,{get:(e,i)=>(typeof require<"u"?require:e)[i]}):s)(function(s){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+s+'" is not supported')});var Xe=(s,e)=>()=>(e||s((e={exports:{}}).exports,e),e.exports);var _t=(s,e,i,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of kt(e))!vt.call(s,n)&&n!==i&&He(s,n,{get:()=>e[n],enumerable:!(r=Tt(e,n))||r.enumerable});return s};var Qe=(s,e,i)=>(i=s!=null?mt(yt(s)):{},_t(He(i,"default",{value:s,enumerable:true}),s));var U=(s,e,i)=>St(s,typeof e!="symbol"?e+"":e,i),Le=(s,e,i)=>e.has(s)||Je("Cannot "+i);var t=(s,e,i)=>(Le(s,e,"read from private field"),i?i.call(s):e.get(s)),b=(s,e,i)=>e.has(s)?Je("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(s):e.set(s,i),m=(s,e,i,r)=>(Le(s,e,"write to private field"),e.set(s,i),i),d=(s,e,i)=>(Le(s,e,"access private method"),i);var Oe=(s,e,i,r)=>({set _(n){m(s,e,n);},get _(){return t(s,e,r)}});var et=Xe((Re,Ze)=>{(function(s,e){typeof Re=="object"?Ze.exports=Re=e():typeof define=="function"&&define.amd?define([],e):s.CryptoJS=e();})(Re,function(){var s=s||(function(e,i){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 qe=="function")try{r=qe("crypto");}catch{}var n=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.")},o=Object.create||(function(){function c(){}return function(u){var w;return c.prototype=u,w=new c,c.prototype=null,w}})(),a={},l=a.lib={},h=l.Base=(function(){return {extend:function(c){var u=o(this);return c&&u.mixIn(c),(!u.hasOwnProperty("init")||this.init===u.init)&&(u.init=function(){u.$super.init.apply(this,arguments);}),u.init.prototype=u,u.$super=this,u},create:function(){var c=this.extend();return c.init.apply(c,arguments),c},init:function(){},mixIn:function(c){for(var u in c)c.hasOwnProperty(u)&&(this[u]=c[u]);c.hasOwnProperty("toString")&&(this.toString=c.toString);},clone:function(){return this.init.prototype.extend(this)}}})(),g=l.WordArray=h.extend({init:function(c,u){c=this.words=c||[],u!=i?this.sigBytes=u:this.sigBytes=c.length*4;},toString:function(c){return (c||T).stringify(this)},concat:function(c){var u=this.words,w=c.words,_=this.sigBytes,E=c.sigBytes;if(this.clamp(),_%4)for(var I=0;I<E;I++){var re=w[I>>>2]>>>24-I%4*8&255;u[_+I>>>2]|=re<<24-(_+I)%4*8;}else for(var P=0;P<E;P+=4)u[_+P>>>2]=w[P>>>2];return this.sigBytes+=E,this},clamp:function(){var c=this.words,u=this.sigBytes;c[u>>>2]&=4294967295<<32-u%4*8,c.length=e.ceil(u/4);},clone:function(){var c=h.clone.call(this);return c.words=this.words.slice(0),c},random:function(c){for(var u=[],w=0;w<c;w+=4)u.push(n());return new g.init(u,c)}}),k=a.enc={},T=k.Hex={stringify:function(c){for(var u=c.words,w=c.sigBytes,_=[],E=0;E<w;E++){var I=u[E>>>2]>>>24-E%4*8&255;_.push((I>>>4).toString(16)),_.push((I&15).toString(16));}return _.join("")},parse:function(c){for(var u=c.length,w=[],_=0;_<u;_+=2)w[_>>>3]|=parseInt(c.substr(_,2),16)<<24-_%8*4;return new g.init(w,u/2)}},y=k.Latin1={stringify:function(c){for(var u=c.words,w=c.sigBytes,_=[],E=0;E<w;E++){var I=u[E>>>2]>>>24-E%4*8&255;_.push(String.fromCharCode(I));}return _.join("")},parse:function(c){for(var u=c.length,w=[],_=0;_<u;_++)w[_>>>2]|=(c.charCodeAt(_)&255)<<24-_%4*8;return new g.init(w,u)}},A=k.Utf8={stringify:function(c){try{return decodeURIComponent(escape(y.stringify(c)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(c){return y.parse(unescape(encodeURIComponent(c)))}},O=l.BufferedBlockAlgorithm=h.extend({reset:function(){this._data=new g.init,this._nDataBytes=0;},_append:function(c){typeof c=="string"&&(c=A.parse(c)),this._data.concat(c),this._nDataBytes+=c.sigBytes;},_process:function(c){var u,w=this._data,_=w.words,E=w.sigBytes,I=this.blockSize,re=I*4,P=E/re;c?P=e.ceil(P):P=e.max((P|0)-this._minBufferSize,0);var Y=P*I,ge=e.min(Y*4,E);if(Y){for(var Ue=0;Ue<Y;Ue+=I)this._doProcessBlock(_,Ue);u=_.splice(0,Y),w.sigBytes-=ge;}return new g.init(u,ge)},clone:function(){var c=h.clone.call(this);return c._data=this._data.clone(),c},_minBufferSize:0});l.Hasher=O.extend({cfg:h.extend(),init:function(c){this.cfg=this.cfg.extend(c),this.reset();},reset:function(){O.reset.call(this),this._doReset();},update:function(c){return this._append(c),this._process(),this},finalize:function(c){c&&this._append(c);var u=this._doFinalize();return u},blockSize:512/32,_createHelper:function(c){return function(u,w){return new c.init(w).finalize(u)}},_createHmacHelper:function(c){return function(u,w){return new v.HMAC.init(c,w).finalize(u)}}});var v=a.algo={};return a})(Math);return s});});var je=Xe((Ce,tt)=>{(function(s,e){typeof Ce=="object"?tt.exports=Ce=e(et()):typeof define=="function"&&define.amd?define(["./core"],e):e(s.CryptoJS);})(Ce,function(s){return (function(){var e=s,i=e.lib,r=i.WordArray,n=i.Hasher,o=e.algo,a=[],l=o.SHA1=n.extend({_doReset:function(){this._hash=new r.init([1732584193,4023233417,2562383102,271733878,3285377520]);},_doProcessBlock:function(h,g){for(var k=this._hash.words,T=k[0],y=k[1],A=k[2],O=k[3],x=k[4],v=0;v<80;v++){if(v<16)a[v]=h[g+v]|0;else {var c=a[v-3]^a[v-8]^a[v-14]^a[v-16];a[v]=c<<1|c>>>31;}var u=(T<<5|T>>>27)+x+a[v];v<20?u+=(y&A|~y&O)+1518500249:v<40?u+=(y^A^O)+1859775393:v<60?u+=(y&A|y&O|A&O)-1894007588:u+=(y^A^O)-899497514,x=O,O=A,A=y<<30|y>>>2,y=T,T=u;}k[0]=k[0]+T|0,k[1]=k[1]+y|0,k[2]=k[2]+A|0,k[3]=k[3]+O|0,k[4]=k[4]+x|0;},_doFinalize:function(){var h=this._data,g=h.words,k=this._nDataBytes*8,T=h.sigBytes*8;return g[T>>>5]|=128<<24-T%32,g[(T+64>>>9<<4)+14]=Math.floor(k/4294967296),g[(T+64>>>9<<4)+15]=k,h.sigBytes=g.length*4,this._process(),this._hash},clone:function(){var h=n.clone.call(this);return h._hash=this._hash.clone(),h}});e.SHA1=n._createHelper(l),e.HmacSHA1=n._createHmacHelper(l);})(),s.SHA1});});var it=Qe(je());var B;(n=>(n.log=(o,...a)=>console.log(`[Pixi\u2019VN] ${o}`,...a),n.warn=(o,...a)=>console.warn(`[Pixi\u2019VN] ${o}`,...a),n.error=(o,...a)=>console.error(`[Pixi\u2019VN] ${o}`,...a),n.info=(o,...a)=>console.info(`[Pixi\u2019VN] ${o}`,...a)))(B||={});var Ie=class{constructor(e,i){this.alias=this.constructor.prototype.id;let{duration:r,priority:n,id:o=this.generateTickerId(this.alias,i),canvasElementAliases:a=[]}=i||{};this.args=e,this.duration=r,this.priority=n,this.id=o,this.canvasElementAliases=a;}alias;id;args;duration;priority;ticker=new At__default.default.Ticker;canvasElementAliases=[];generateTickerId(...e){try{return (0,it.default)(JSON.stringify(e)).toString()+"_"+Math.random().toString(36).substring(7)}catch(i){throw new core.PixiError("not_json_serializable",`Error to generate ticker id: ${i}`)}}fnValue;complete(e){this.stop();}stop(){let e=this.fnValue;if(!e){B.warn("TickerBase.stop() called without fnValue set. This may cause issues.");return}this.ticker.remove(e,null);}start(){let e=this.id,i=()=>this.fn(this.ticker,this.args,this.canvasElementAliases,e);this.fnValue=i,this.ticker.add(i,null,this.priority),this.ticker.start();}pause(){this.ticker.stop();}play(){this.ticker.start();}get paused(){return !this.ticker.started}};var Et=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,ot=new Set,Ne=typeof process=="object"&&process?process:{},at=(s,e,i,r)=>{typeof Ne.emitWarning=="function"?Ne.emitWarning(s,e,i,r):console.error(`[${i}] ${e}: ${s}`);},De=globalThis.AbortController,rt=globalThis.AbortSignal;if(typeof De>"u"){rt=class{onabort;_onabort=[];reason;aborted=false;addEventListener(i,r){this._onabort.push(r);}},De=class{constructor(){e();}signal=new rt;abort(i){if(!this.signal.aborted){this.signal.reason=i,this.signal.aborted=true;for(let r of this.signal._onabort)r(i);this.signal.onabort?.(i);}}};let s=Ne.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{s&&(s=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 bt=s=>!ot.has(s);var oe=s=>s&&s===Math.floor(s)&&s>0&&isFinite(s),ct=s=>oe(s)?s<=Math.pow(2,8)?Uint8Array:s<=Math.pow(2,16)?Uint16Array:s<=Math.pow(2,32)?Uint32Array:s<=Number.MAX_SAFE_INTEGER?Fe:null:null,Fe=class extends Array{constructor(s){super(s),this.fill(0);}},se,me,xt=(se=class{heap;length;static create(e){let i=ct(e);if(!i)return [];m(se,me,true);let r=new se(e,i);return m(se,me,false),r}constructor(e,i){if(!t(se,me))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new i(e),this.length=0;}push(e){this.heap[this.length++]=e;}pop(){return this.heap[--this.length]}},me=new WeakMap,b(se,me,false),se),st,nt,$,j,K,fe,J,Te,ke,X,z,Q,F,C,S,q,N,H,D,Z,W,ee,te,M,V,ie,le,L,ye,f,Me,ue,ne,Ee,G,lt,de,ve,be,ae,ce,Ve,ze,Be,R,Ge,Ae,he,$e,Se,ht=(Se=class{constructor(e){b(this,f);b(this,$);b(this,j);b(this,K);b(this,fe);b(this,J);b(this,Te);b(this,ke);b(this,X);U(this,"ttl");U(this,"ttlResolution");U(this,"ttlAutopurge");U(this,"updateAgeOnGet");U(this,"updateAgeOnHas");U(this,"allowStale");U(this,"noDisposeOnSet");U(this,"noUpdateTTL");U(this,"maxEntrySize");U(this,"sizeCalculation");U(this,"noDeleteOnFetchRejection");U(this,"noDeleteOnStaleGet");U(this,"allowStaleOnFetchAbort");U(this,"allowStaleOnFetchRejection");U(this,"ignoreFetchAbort");b(this,z);b(this,Q);b(this,F);b(this,C);b(this,S);b(this,q);b(this,N);b(this,H);b(this,D);b(this,Z);b(this,W);b(this,ee);b(this,te);b(this,M);b(this,V);b(this,ie);b(this,le);b(this,L);b(this,ye);b(this,ue,()=>{});b(this,ne,()=>{});b(this,Ee,()=>{});b(this,G,()=>false);b(this,de,e=>{});b(this,ve,(e,i,r)=>{});b(this,be,(e,i,r,n)=>{if(r||n)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});U(this,st,"LRUCache");let{max:i=0,ttl:r,ttlResolution:n=1,ttlAutopurge:o,updateAgeOnGet:a,updateAgeOnHas:l,allowStale:h,dispose:g,onInsert:k,disposeAfter:T,noDisposeOnSet:y,noUpdateTTL:A,maxSize:O=0,maxEntrySize:x=0,sizeCalculation:v,fetchMethod:c,memoMethod:u,noDeleteOnFetchRejection:w,noDeleteOnStaleGet:_,allowStaleOnFetchRejection:E,allowStaleOnFetchAbort:I,ignoreFetchAbort:re,perf:P}=e;if(P!==void 0&&typeof P?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(m(this,X,P??Et),i!==0&&!oe(i))throw new TypeError("max option must be a nonnegative integer");let Y=i?ct(i):Array;if(!Y)throw new Error("invalid max value: "+i);if(m(this,$,i),m(this,j,O),this.maxEntrySize=x||t(this,j),this.sizeCalculation=v,this.sizeCalculation){if(!t(this,j)&&!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(u!==void 0&&typeof u!="function")throw new TypeError("memoMethod must be a function if defined");if(m(this,ke,u),c!==void 0&&typeof c!="function")throw new TypeError("fetchMethod must be a function if specified");if(m(this,Te,c),m(this,le,!!c),m(this,F,new Map),m(this,C,new Array(i).fill(void 0)),m(this,S,new Array(i).fill(void 0)),m(this,q,new Y(i)),m(this,N,new Y(i)),m(this,H,0),m(this,D,0),m(this,Z,xt.create(i)),m(this,z,0),m(this,Q,0),typeof g=="function"&&m(this,K,g),typeof k=="function"&&m(this,fe,k),typeof T=="function"?(m(this,J,T),m(this,W,[])):(m(this,J,void 0),m(this,W,void 0)),m(this,ie,!!t(this,K)),m(this,ye,!!t(this,fe)),m(this,L,!!t(this,J)),this.noDisposeOnSet=!!y,this.noUpdateTTL=!!A,this.noDeleteOnFetchRejection=!!w,this.allowStaleOnFetchRejection=!!E,this.allowStaleOnFetchAbort=!!I,this.ignoreFetchAbort=!!re,this.maxEntrySize!==0){if(t(this,j)!==0&&!oe(t(this,j)))throw new TypeError("maxSize must be a positive integer if specified");if(!oe(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");d(this,f,lt).call(this);}if(this.allowStale=!!h,this.noDeleteOnStaleGet=!!_,this.updateAgeOnGet=!!a,this.updateAgeOnHas=!!l,this.ttlResolution=oe(n)||n===0?n:1,this.ttlAutopurge=!!o,this.ttl=r||0,this.ttl){if(!oe(this.ttl))throw new TypeError("ttl must be a positive integer if specified");d(this,f,Me).call(this);}if(t(this,$)===0&&this.ttl===0&&t(this,j)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!t(this,$)&&!t(this,j)){let ge="LRU_CACHE_UNBOUNDED";bt(ge)&&(ot.add(ge),at("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",ge,Se));}}get perf(){return t(this,X)}static unsafeExposeInternals(e){return {starts:t(e,te),ttls:t(e,M),autopurgeTimers:t(e,V),sizes:t(e,ee),keyMap:t(e,F),keyList:t(e,C),valList:t(e,S),next:t(e,q),prev:t(e,N),get head(){return t(e,H)},get tail(){return t(e,D)},free:t(e,Z),isBackgroundFetch:i=>{var r;return d(r=e,f,R).call(r,i)},backgroundFetch:(i,r,n,o)=>{var a;return d(a=e,f,Be).call(a,i,r,n,o)},moveToTail:i=>{var r;return d(r=e,f,Ae).call(r,i)},indexes:i=>{var r;return d(r=e,f,ae).call(r,i)},rindexes:i=>{var r;return d(r=e,f,ce).call(r,i)},isStale:i=>{var r;return t(r=e,G).call(r,i)}}}get max(){return t(this,$)}get maxSize(){return t(this,j)}get calculatedSize(){return t(this,Q)}get size(){return t(this,z)}get fetchMethod(){return t(this,Te)}get memoMethod(){return t(this,ke)}get dispose(){return t(this,K)}get onInsert(){return t(this,fe)}get disposeAfter(){return t(this,J)}getRemainingTTL(e){return t(this,F).has(e)?1/0:0}*entries(){for(let e of d(this,f,ae).call(this))t(this,S)[e]!==void 0&&t(this,C)[e]!==void 0&&!d(this,f,R).call(this,t(this,S)[e])&&(yield [t(this,C)[e],t(this,S)[e]]);}*rentries(){for(let e of d(this,f,ce).call(this))t(this,S)[e]!==void 0&&t(this,C)[e]!==void 0&&!d(this,f,R).call(this,t(this,S)[e])&&(yield [t(this,C)[e],t(this,S)[e]]);}*keys(){for(let e of d(this,f,ae).call(this)){let i=t(this,C)[e];i!==void 0&&!d(this,f,R).call(this,t(this,S)[e])&&(yield i);}}*rkeys(){for(let e of d(this,f,ce).call(this)){let i=t(this,C)[e];i!==void 0&&!d(this,f,R).call(this,t(this,S)[e])&&(yield i);}}*values(){for(let e of d(this,f,ae).call(this))t(this,S)[e]!==void 0&&!d(this,f,R).call(this,t(this,S)[e])&&(yield t(this,S)[e]);}*rvalues(){for(let e of d(this,f,ce).call(this))t(this,S)[e]!==void 0&&!d(this,f,R).call(this,t(this,S)[e])&&(yield t(this,S)[e]);}[(nt=Symbol.iterator,st=Symbol.toStringTag,nt)](){return this.entries()}find(e,i={}){for(let r of d(this,f,ae).call(this)){let n=t(this,S)[r],o=d(this,f,R).call(this,n)?n.__staleWhileFetching:n;if(o!==void 0&&e(o,t(this,C)[r],this))return this.get(t(this,C)[r],i)}}forEach(e,i=this){for(let r of d(this,f,ae).call(this)){let n=t(this,S)[r],o=d(this,f,R).call(this,n)?n.__staleWhileFetching:n;o!==void 0&&e.call(i,o,t(this,C)[r],this);}}rforEach(e,i=this){for(let r of d(this,f,ce).call(this)){let n=t(this,S)[r],o=d(this,f,R).call(this,n)?n.__staleWhileFetching:n;o!==void 0&&e.call(i,o,t(this,C)[r],this);}}purgeStale(){let e=false;for(let i of d(this,f,ce).call(this,{allowStale:true}))t(this,G).call(this,i)&&(d(this,f,he).call(this,t(this,C)[i],"expire"),e=true);return e}info(e){let i=t(this,F).get(e);if(i===void 0)return;let r=t(this,S)[i],n=d(this,f,R).call(this,r)?r.__staleWhileFetching:r;if(n===void 0)return;let o={value:n};if(t(this,M)&&t(this,te)){let a=t(this,M)[i],l=t(this,te)[i];if(a&&l){let h=a-(t(this,X).now()-l);o.ttl=h,o.start=Date.now();}}return t(this,ee)&&(o.size=t(this,ee)[i]),o}dump(){let e=[];for(let i of d(this,f,ae).call(this,{allowStale:true})){let r=t(this,C)[i],n=t(this,S)[i],o=d(this,f,R).call(this,n)?n.__staleWhileFetching:n;if(o===void 0||r===void 0)continue;let a={value:o};if(t(this,M)&&t(this,te)){a.ttl=t(this,M)[i];let l=t(this,X).now()-t(this,te)[i];a.start=Math.floor(Date.now()-l);}t(this,ee)&&(a.size=t(this,ee)[i]),e.unshift([r,a]);}return e}load(e){this.clear();for(let[i,r]of e){if(r.start){let n=Date.now()-r.start;r.start=t(this,X).now()-n;}this.set(i,r.value,r);}}set(e,i,r={}){var y,A,O,x;if(i===void 0)return this.delete(e),this;let{ttl:n=this.ttl,start:o,noDisposeOnSet:a=this.noDisposeOnSet,sizeCalculation:l=this.sizeCalculation,status:h}=r,{noUpdateTTL:g=this.noUpdateTTL}=r,k=t(this,be).call(this,e,i,r.size||0,l);if(this.maxEntrySize&&k>this.maxEntrySize)return h&&(h.set="miss",h.maxEntrySizeExceeded=true),d(this,f,he).call(this,e,"set"),this;let T=t(this,z)===0?void 0:t(this,F).get(e);if(T===void 0)T=t(this,z)===0?t(this,D):t(this,Z).length!==0?t(this,Z).pop():t(this,z)===t(this,$)?d(this,f,ze).call(this,false):t(this,z),t(this,C)[T]=e,t(this,S)[T]=i,t(this,F).set(e,T),t(this,q)[t(this,D)]=T,t(this,N)[T]=t(this,D),m(this,D,T),Oe(this,z)._++,t(this,ve).call(this,T,k,h),h&&(h.set="add"),g=false,t(this,ye)&&((y=t(this,fe))==null||y.call(this,i,e,"add"));else {d(this,f,Ae).call(this,T);let v=t(this,S)[T];if(i!==v){if(t(this,le)&&d(this,f,R).call(this,v)){v.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:c}=v;c!==void 0&&!a&&(t(this,ie)&&((A=t(this,K))==null||A.call(this,c,e,"set")),t(this,L)&&t(this,W)?.push([c,e,"set"]));}else a||(t(this,ie)&&((O=t(this,K))==null||O.call(this,v,e,"set")),t(this,L)&&t(this,W)?.push([v,e,"set"]));if(t(this,de).call(this,T),t(this,ve).call(this,T,k,h),t(this,S)[T]=i,h){h.set="replace";let c=v&&d(this,f,R).call(this,v)?v.__staleWhileFetching:v;c!==void 0&&(h.oldValue=c);}}else h&&(h.set="update");t(this,ye)&&this.onInsert?.(i,e,i===v?"update":"replace");}if(n!==0&&!t(this,M)&&d(this,f,Me).call(this),t(this,M)&&(g||t(this,Ee).call(this,T,n,o),h&&t(this,ne).call(this,h,T)),!a&&t(this,L)&&t(this,W)){let v=t(this,W),c;for(;c=v?.shift();)(x=t(this,J))==null||x.call(this,...c);}return this}pop(){var e;try{for(;t(this,z);){let i=t(this,S)[t(this,H)];if(d(this,f,ze).call(this,!0),d(this,f,R).call(this,i)){if(i.__staleWhileFetching)return i.__staleWhileFetching}else if(i!==void 0)return i}}finally{if(t(this,L)&&t(this,W)){let i=t(this,W),r;for(;r=i?.shift();)(e=t(this,J))==null||e.call(this,...r);}}}has(e,i={}){let{updateAgeOnHas:r=this.updateAgeOnHas,status:n}=i,o=t(this,F).get(e);if(o!==void 0){let a=t(this,S)[o];if(d(this,f,R).call(this,a)&&a.__staleWhileFetching===void 0)return false;if(t(this,G).call(this,o))n&&(n.has="stale",t(this,ne).call(this,n,o));else return r&&t(this,ue).call(this,o),n&&(n.has="hit",t(this,ne).call(this,n,o)),true}else n&&(n.has="miss");return false}peek(e,i={}){let{allowStale:r=this.allowStale}=i,n=t(this,F).get(e);if(n===void 0||!r&&t(this,G).call(this,n))return;let o=t(this,S)[n];return d(this,f,R).call(this,o)?o.__staleWhileFetching:o}async fetch(e,i={}){let{allowStale:r=this.allowStale,updateAgeOnGet:n=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,ttl:a=this.ttl,noDisposeOnSet:l=this.noDisposeOnSet,size:h=0,sizeCalculation:g=this.sizeCalculation,noUpdateTTL:k=this.noUpdateTTL,noDeleteOnFetchRejection:T=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:y=this.allowStaleOnFetchRejection,ignoreFetchAbort:A=this.ignoreFetchAbort,allowStaleOnFetchAbort:O=this.allowStaleOnFetchAbort,context:x,forceRefresh:v=false,status:c,signal:u}=i;if(!t(this,le))return c&&(c.fetch="get"),this.get(e,{allowStale:r,updateAgeOnGet:n,noDeleteOnStaleGet:o,status:c});let w={allowStale:r,updateAgeOnGet:n,noDeleteOnStaleGet:o,ttl:a,noDisposeOnSet:l,size:h,sizeCalculation:g,noUpdateTTL:k,noDeleteOnFetchRejection:T,allowStaleOnFetchRejection:y,allowStaleOnFetchAbort:O,ignoreFetchAbort:A,status:c,signal:u},_=t(this,F).get(e);if(_===void 0){c&&(c.fetch="miss");let E=d(this,f,Be).call(this,e,_,w,x);return E.__returned=E}else {let E=t(this,S)[_];if(d(this,f,R).call(this,E)){let Y=r&&E.__staleWhileFetching!==void 0;return c&&(c.fetch="inflight",Y&&(c.returnedStale=true)),Y?E.__staleWhileFetching:E.__returned=E}let I=t(this,G).call(this,_);if(!v&&!I)return c&&(c.fetch="hit"),d(this,f,Ae).call(this,_),n&&t(this,ue).call(this,_),c&&t(this,ne).call(this,c,_),E;let re=d(this,f,Be).call(this,e,_,w,x),P=re.__staleWhileFetching!==void 0&&r;return c&&(c.fetch=I?"stale":"refresh",P&&I&&(c.returnedStale=true)),P?re.__staleWhileFetching:re.__returned=re}}async forceFetch(e,i={}){let r=await this.fetch(e,i);if(r===void 0)throw new Error("fetch() returned undefined");return r}memo(e,i={}){let r=t(this,ke);if(!r)throw new Error("no memoMethod provided to constructor");let{context:n,forceRefresh:o,...a}=i,l=this.get(e,a);if(!o&&l!==void 0)return l;let h=r(e,l,{options:a,context:n});return this.set(e,h,a),h}get(e,i={}){let{allowStale:r=this.allowStale,updateAgeOnGet:n=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,status:a}=i,l=t(this,F).get(e);if(l!==void 0){let h=t(this,S)[l],g=d(this,f,R).call(this,h);return a&&t(this,ne).call(this,a,l),t(this,G).call(this,l)?(a&&(a.get="stale"),g?(a&&r&&h.__staleWhileFetching!==void 0&&(a.returnedStale=true),r?h.__staleWhileFetching:void 0):(o||d(this,f,he).call(this,e,"expire"),a&&r&&(a.returnedStale=true),r?h:void 0)):(a&&(a.get="hit"),g?h.__staleWhileFetching:(d(this,f,Ae).call(this,l),n&&t(this,ue).call(this,l),h))}else a&&(a.get="miss");}delete(e){return d(this,f,he).call(this,e,"delete")}clear(){return d(this,f,$e).call(this,"delete")}},$=new WeakMap,j=new WeakMap,K=new WeakMap,fe=new WeakMap,J=new WeakMap,Te=new WeakMap,ke=new WeakMap,X=new WeakMap,z=new WeakMap,Q=new WeakMap,F=new WeakMap,C=new WeakMap,S=new WeakMap,q=new WeakMap,N=new WeakMap,H=new WeakMap,D=new WeakMap,Z=new WeakMap,W=new WeakMap,ee=new WeakMap,te=new WeakMap,M=new WeakMap,V=new WeakMap,ie=new WeakMap,le=new WeakMap,L=new WeakMap,ye=new WeakMap,f=new WeakSet,Me=function(){let e=new Fe(t(this,$)),i=new Fe(t(this,$));m(this,M,e),m(this,te,i);let r=this.ttlAutopurge?new Array(t(this,$)):void 0;m(this,V,r),m(this,Ee,(l,h,g=t(this,X).now())=>{i[l]=h!==0?g:0,e[l]=h,n(l,h);}),m(this,ue,l=>{i[l]=e[l]!==0?t(this,X).now():0,n(l,e[l]);});let n=this.ttlAutopurge?(l,h)=>{if(r?.[l]&&(clearTimeout(r[l]),r[l]=void 0),h&&h!==0&&r){let g=setTimeout(()=>{t(this,G).call(this,l)&&d(this,f,he).call(this,t(this,C)[l],"expire");},h+1);g.unref&&g.unref(),r[l]=g;}}:()=>{};m(this,ne,(l,h)=>{if(e[h]){let g=e[h],k=i[h];if(!g||!k)return;l.ttl=g,l.start=k,l.now=o||a();let T=l.now-k;l.remainingTTL=g-T;}});let o=0,a=()=>{let l=t(this,X).now();if(this.ttlResolution>0){o=l;let h=setTimeout(()=>o=0,this.ttlResolution);h.unref&&h.unref();}return l};this.getRemainingTTL=l=>{let h=t(this,F).get(l);if(h===void 0)return 0;let g=e[h],k=i[h];if(!g||!k)return 1/0;let T=(o||a())-k;return g-T},m(this,G,l=>{let h=i[l],g=e[l];return !!g&&!!h&&(o||a())-h>g});},ue=new WeakMap,ne=new WeakMap,Ee=new WeakMap,G=new WeakMap,lt=function(){let e=new Fe(t(this,$));m(this,Q,0),m(this,ee,e),m(this,de,i=>{m(this,Q,t(this,Q)-e[i]),e[i]=0;}),m(this,be,(i,r,n,o)=>{if(d(this,f,R).call(this,r))return 0;if(!oe(n))if(o){if(typeof o!="function")throw new TypeError("sizeCalculation must be a function");if(n=o(r,i),!oe(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}),m(this,ve,(i,r,n)=>{if(e[i]=r,t(this,j)){let o=t(this,j)-e[i];for(;t(this,Q)>o;)d(this,f,ze).call(this,true);}m(this,Q,t(this,Q)+e[i]),n&&(n.entrySize=r,n.totalCalculatedSize=t(this,Q));});},de=new WeakMap,ve=new WeakMap,be=new WeakMap,ae=function*({allowStale:e=this.allowStale}={}){if(t(this,z))for(let i=t(this,D);!(!d(this,f,Ve).call(this,i)||((e||!t(this,G).call(this,i))&&(yield i),i===t(this,H)));)i=t(this,N)[i];},ce=function*({allowStale:e=this.allowStale}={}){if(t(this,z))for(let i=t(this,H);!(!d(this,f,Ve).call(this,i)||((e||!t(this,G).call(this,i))&&(yield i),i===t(this,D)));)i=t(this,q)[i];},Ve=function(e){return e!==void 0&&t(this,F).get(t(this,C)[e])===e},ze=function(e){var o;let i=t(this,H),r=t(this,C)[i],n=t(this,S)[i];return t(this,le)&&d(this,f,R).call(this,n)?n.__abortController.abort(new Error("evicted")):(t(this,ie)||t(this,L))&&(t(this,ie)&&((o=t(this,K))==null||o.call(this,n,r,"evict")),t(this,L)&&t(this,W)?.push([n,r,"evict"])),t(this,de).call(this,i),t(this,V)?.[i]&&(clearTimeout(t(this,V)[i]),t(this,V)[i]=void 0),e&&(t(this,C)[i]=void 0,t(this,S)[i]=void 0,t(this,Z).push(i)),t(this,z)===1?(m(this,H,m(this,D,0)),t(this,Z).length=0):m(this,H,t(this,q)[i]),t(this,F).delete(r),Oe(this,z)._--,i},Be=function(e,i,r,n){let o=i===void 0?void 0:t(this,S)[i];if(d(this,f,R).call(this,o))return o;let a=new De,{signal:l}=r;l?.addEventListener("abort",()=>a.abort(l.reason),{signal:a.signal});let h={signal:a.signal,options:r,context:n},g=(x,v=false)=>{let{aborted:c}=a.signal,u=r.ignoreFetchAbort&&x!==void 0,w=r.ignoreFetchAbort||!!(r.allowStaleOnFetchAbort&&x!==void 0);if(r.status&&(c&&!v?(r.status.fetchAborted=true,r.status.fetchError=a.signal.reason,u&&(r.status.fetchAbortIgnored=true)):r.status.fetchResolved=true),c&&!u&&!v)return T(a.signal.reason,w);let _=A,E=t(this,S)[i];return (E===A||u&&v&&E===void 0)&&(x===void 0?_.__staleWhileFetching!==void 0?t(this,S)[i]=_.__staleWhileFetching:d(this,f,he).call(this,e,"fetch"):(r.status&&(r.status.fetchUpdated=true),this.set(e,x,h.options))),x},k=x=>(r.status&&(r.status.fetchRejected=true,r.status.fetchError=x),T(x,false)),T=(x,v)=>{let{aborted:c}=a.signal,u=c&&r.allowStaleOnFetchAbort,w=u||r.allowStaleOnFetchRejection,_=w||r.noDeleteOnFetchRejection,E=A;if(t(this,S)[i]===A&&(!_||!v&&E.__staleWhileFetching===void 0?d(this,f,he).call(this,e,"fetch"):u||(t(this,S)[i]=E.__staleWhileFetching)),w)return r.status&&E.__staleWhileFetching!==void 0&&(r.status.returnedStale=true),E.__staleWhileFetching;if(E.__returned===E)throw x},y=(x,v)=>{var u;let c=(u=t(this,Te))==null?void 0:u.call(this,e,o,h);c&&c instanceof Promise&&c.then(w=>x(w===void 0?void 0:w),v),a.signal.addEventListener("abort",()=>{(!r.ignoreFetchAbort||r.allowStaleOnFetchAbort)&&(x(void 0),r.allowStaleOnFetchAbort&&(x=w=>g(w,true)));});};r.status&&(r.status.fetchDispatched=true);let A=new Promise(y).then(g,k),O=Object.assign(A,{__abortController:a,__staleWhileFetching:o,__returned:void 0});return i===void 0?(this.set(e,O,{...h.options,status:void 0}),i=t(this,F).get(e)):t(this,S)[i]=O,O},R=function(e){if(!t(this,le))return false;let i=e;return !!i&&i instanceof Promise&&i.hasOwnProperty("__staleWhileFetching")&&i.__abortController instanceof De},Ge=function(e,i){t(this,N)[i]=e,t(this,q)[e]=i;},Ae=function(e){e!==t(this,D)&&(e===t(this,H)?m(this,H,t(this,q)[e]):d(this,f,Ge).call(this,t(this,N)[e],t(this,q)[e]),d(this,f,Ge).call(this,t(this,D),e),m(this,D,e));},he=function(e,i){var n,o;let r=false;if(t(this,z)!==0){let a=t(this,F).get(e);if(a!==void 0)if(t(this,V)?.[a]&&(clearTimeout(t(this,V)?.[a]),t(this,V)[a]=void 0),r=true,t(this,z)===1)d(this,f,$e).call(this,i);else {t(this,de).call(this,a);let l=t(this,S)[a];if(d(this,f,R).call(this,l)?l.__abortController.abort(new Error("deleted")):(t(this,ie)||t(this,L))&&(t(this,ie)&&((n=t(this,K))==null||n.call(this,l,e,i)),t(this,L)&&t(this,W)?.push([l,e,i])),t(this,F).delete(e),t(this,C)[a]=void 0,t(this,S)[a]=void 0,a===t(this,D))m(this,D,t(this,N)[a]);else if(a===t(this,H))m(this,H,t(this,q)[a]);else {let h=t(this,N)[a];t(this,q)[h]=t(this,q)[a];let g=t(this,q)[a];t(this,N)[g]=t(this,N)[a];}Oe(this,z)._--,t(this,Z).push(a);}}if(t(this,L)&&t(this,W)?.length){let a=t(this,W),l;for(;l=a?.shift();)(o=t(this,J))==null||o.call(this,...l);}return r},$e=function(e){var i,r;for(let n of d(this,f,ce).call(this,{allowStale:true})){let o=t(this,S)[n];if(d(this,f,R).call(this,o))o.__abortController.abort(new Error("deleted"));else {let a=t(this,C)[n];t(this,ie)&&((i=t(this,K))==null||i.call(this,o,a,e)),t(this,L)&&t(this,W)?.push([o,a,e]);}}if(t(this,F).clear(),t(this,S).fill(void 0),t(this,C).fill(void 0),t(this,M)&&t(this,te)){t(this,M).fill(0),t(this,te).fill(0);for(let n of t(this,V)??[])n!==void 0&&clearTimeout(n);t(this,V)?.fill(void 0);}if(t(this,ee)&&t(this,ee).fill(0),m(this,H,0),m(this,D,0),t(this,Z).length=0,m(this,Q,0),m(this,z,0),t(this,L)&&t(this,W)){let n=t(this,W),o;for(;o=n?.shift();)(r=t(this,J))==null||r.call(this,...o);}},Se);var xe=class{cache;map=new Map;constructor(e){this.cache=new ht({max:e.cacheSize}),this.map=new Map;}get[Symbol.iterator](){return this.map[Symbol.iterator]}get[Symbol.toStringTag](){return this.map[Symbol.toStringTag]}clear(){this.cache.clear(),this.map.clear();}delete(e){let i=this.map.delete(e);return i&&this.cache.delete(e),i}get forEach(){return this.map.forEach}get(e){let i=this.cache.get(e);return i||this.map.get(e)}has(e){return this.map.has(e)}set(e,i){return this.map.set(e,i),this.cache.set(e,i),this}get size(){return this.map.size}entries(){return this.map.entries()}keys(){return this.map.keys()}values(){return this.map.values()}};var pe=new xe({cacheSize:5});function Ot(s){return function(e){Ye.add(e,s);}}var Ye;(a=>{function s(l,h){h||(h=l.name),pe.get(h)&&B.info(`Ticker "${h}" already exists, it will be overwritten`),l.prototype.id=h,pe.set(h,l);}a.add=s;function e(l){try{let h=pe.get(l);if(!h){B.error(`Event "${l}" not found, did you forget to register it with the tickerDecorator?`);return}return h}catch(h){B.error(`Error while getting Event "${l}"`,h);return}}a.get=e;function i(l,h,g){try{let k=pe.get(l);if(!k){B.error(`Ticker "${l}" not found, did you forget to register it with the tickerDecorator?`);return}return new k(h,g)}catch(k){B.error(`Error while getting Ticker "${l}"`,k);return}}a.getInstance=i;function r(){return Array.from(pe.values())}a.values=r;function n(l){return pe.has(l)}a.has=n;function o(){return Array.from(pe.keys())}a.keys=o;})(Ye||={});var _e=Ye;function We(s){try{if(typeof s>"u")return s;let e=JSON.stringify(s);return JSON.parse(e)}catch(e){throw B.error("Error creating exportable element",s,e),new core.PixiError("not_json_serializable","Error creating exportable element")}}var ft=Qe(je());exports.TickersManagerStatic=void 0;(T=>{function s(){return Object.fromEntries(Array.from(T._currentTickers.entries()).filter(([y,A])=>!A.createdByTicketSteps).map(([y,A])=>[y,{id:A.ticker.alias,args:A.ticker.args,canvasElementAliases:A.ticker.canvasElementAliases,priority:A.ticker.priority,duration:A.ticker.duration,paused:A.ticker.paused}]))}T.currentTickersWithoutCreatedBySteps=s,T._currentTickers=new Map,T._currentTickersSequence=new Map;function r(){return Object.fromEntries(Array.from(T._currentTickersSequence.entries()).map(([y,A])=>[y,Object.fromEntries(A)]))}T.currentTickersSequence=r,T._currentTickersTimeouts=new Map,T._tickersToCompleteOnStepEnd={tikersIds:[],stepAlias:[]};function a(...y){try{return `${(0,ft.default)(JSON.stringify(y)).toString()}_${Math.random().toString(36).substring(7)}`}catch(A){throw new core.PixiError("not_json_serializable",`Error to generate ticker id: ${A}`)}}T.generateTickerId=a;function l(y,A,O,x){typeof y=="string"&&(y=[y]),T._currentTickersTimeouts.set(O,{aliases:y,ticker:A,canBeDeletedBeforeEnd:x});}T.addTickerTimeoutInfo=l;function h(y){typeof y!="string"&&(y=y.toString()),T._currentTickersTimeouts.delete(y);}T.removeTickerTimeoutInfo=h;function g(y){typeof y!="string"&&(y=y.toString()),clearTimeout(Number(y)),h(y);}T.removeTickerTimeout=g;function k(y,A){T._currentTickersTimeouts.forEach((O,x)=>{let v=O.aliases.filter(c=>c!==y);if(v.length===0){let c=O.canBeDeletedBeforeEnd;(!A||c)&&g(x);}else O.aliases=v;});}T.removeTickerTimeoutsByAlias=k;})(exports.TickersManagerStatic||={});var ut="aliasToRemoveAfter";function It(s){let e=exports.TickersManagerStatic._currentTickers.get(s);if(e)return e.ticker}function pt(s,e){let i=e.id,r=e.alias;if(typeof s=="string"&&(s=[s]),e.canvasElementAliases=s,!_e.has(r)){B.error(`Ticker ${r} not found`);return}let n={ticker:e};if(exports.TickersManagerStatic._currentTickers.set(i,n),n.ticker.start(),e.duration){let o=setTimeout(()=>{exports.TickersManagerStatic.removeTickerTimeoutInfo(o),exports.TickersManagerStatic._currentTickersTimeouts.get(o.toString())&&n.ticker.complete({ignoreTickerSteps:true});},e.duration*1e3);exports.TickersManagerStatic.addTickerTimeoutInfo(s,r,o.toString(),true);}return i}function Ft(s,e,i=0){if(e.length===0){B.warn("The steps of the tickers is empty");return}exports.TickersManagerStatic._currentTickersSequence.has(s)||exports.TickersManagerStatic._currentTickersSequence.set(s,new Map);let r={currentStepNumber:i,steps:e.map(o=>({ticker:o.alias,args:We(o.args),duration:o.duration}))},n=exports.TickersManagerStatic.generateTickerId(r);return exports.TickersManagerStatic._currentTickersSequence.get(s)?.set(n,r),Pe(s,n),n}function Pe(s,e){let i=exports.TickersManagerStatic._currentTickersSequence.get(s);if(!i?.has(e))return;let r=i.get(e).steps[i.get(e).currentStepNumber],n=_e.getInstance(r.ticker,r.args,{canvasElementAliases:[s],duration:r.duration,priority:r.priority});if(!n){B.error(`Ticker ${r.ticker} not found`);return}let o=n.alias,a=n.id;n.canvasElementAliases=[s];let l={createdByTicketSteps:{canvasElementAlias:s,id:e},ticker:n};if(exports.TickersManagerStatic._currentTickers.set(a,l),l.ticker.start(),n.duration){let h=setTimeout(()=>{let g=exports.TickersManagerStatic._currentTickersTimeouts.get(h.toString());g&&(l.ticker.complete({ignoreTickerSteps:true}),g.aliases.forEach(k=>{gt(k,e);})),exports.TickersManagerStatic.removeTickerTimeoutInfo(h);},n.duration*1e3);exports.TickersManagerStatic.addTickerTimeoutInfo(s,o,h.toString(),false);}}function gt(s,e){let i=exports.TickersManagerStatic._currentTickersSequence.get(s);if(i?.has(e)){let r=i.get(e);r.currentStepNumber+1<r.steps.length?(r.currentStepNumber++,i.set(e,r),Pe(s,e)):e&&i.has(e)&&(i.delete(e),exports.TickersManagerStatic._currentTickers.forEach((n,o)=>{n.createdByTicketSteps?.canvasElementAlias===s&&n.createdByTicketSteps.id===e&&we(o);}));}}function zt(s,e){let{stopTicker:i=true,aliasToRemoveAfter:r,tickerAliasToResume:n,tickerIdToResume:o}=e,a=exports.TickersManagerStatic._currentTickers.get(s),l=e.ignoreTickerSteps||false;core.GameUnifier.removeCanvasComponent(r),n.forEach(h=>{Ke({canvasAlias:h});}),Ke({id:o}),a&&(we(s,{stopTicker:i}),!l&&a.ticker.duration===void 0&&a.createdByTicketSteps&&gt(a.createdByTicketSteps.canvasElementAlias,a.createdByTicketSteps.id));}function Bt(s,e){if(typeof s=="string"&&(s=[s]),!e){s.forEach(r=>{exports.TickersManagerStatic._currentTickers.forEach((n,o)=>{n.ticker.canvasElementAliases.includes(r)&&(n.ticker.canvasElementAliases.length===1?we(o):n.ticker.canvasElementAliases=n.ticker.canvasElementAliases.filter(a=>a!==r));}),exports.TickersManagerStatic._currentTickersSequence.has(r)&&exports.TickersManagerStatic._currentTickersSequence.delete(r),exports.TickersManagerStatic.removeTickerTimeoutsByAlias(r,false);});return}let i;typeof e=="string"?i=e:i=e.prototype.id,s.forEach(r=>{let n=exports.TickersManagerStatic._currentTickersSequence.get(r);n&&n.forEach((o,a)=>{o.steps.find(l=>typeof l=="object"&&"ticker"in l&&l.ticker===i)&&n.delete(a);});}),exports.TickersManagerStatic._currentTickers.forEach(r=>{r.ticker.alias===i&&(r.ticker.canvasElementAliases=r.ticker.canvasElementAliases.filter(n=>!s.includes(n)));}),exports.TickersManagerStatic._currentTickersTimeouts.forEach(r=>{r.ticker===i&&r.canBeDeletedBeforeEnd&&(r.aliases=r.aliases.filter(n=>!s.includes(n)));}),Dt();}function Dt(){exports.TickersManagerStatic._currentTickers.forEach(s=>{s.ticker.canvasElementAliases=s.ticker.canvasElementAliases.filter(e=>core.GameUnifier.canvasComponentExists(e)),s.ticker.canvasElementAliases.length===0&&s.ticker.complete({ignoreTickerSteps:true});}),exports.TickersManagerStatic._currentTickersSequence.forEach((s,e)=>{s===void 0&&exports.TickersManagerStatic._currentTickersSequence.delete(e);}),Array.from(exports.TickersManagerStatic._currentTickersTimeouts.keys()).forEach(s=>{let e=exports.TickersManagerStatic._currentTickersTimeouts.get(s);e&&e.aliases.length===0&&exports.TickersManagerStatic.removeTickerTimeout(s);});}function Wt(){exports.TickersManagerStatic._currentTickersSequence.clear(),Array.from(exports.TickersManagerStatic._currentTickers.keys()).forEach(s=>{we(s);}),exports.TickersManagerStatic._currentTickers.clear(),Array.from(exports.TickersManagerStatic._currentTickersTimeouts.keys()).forEach(s=>{exports.TickersManagerStatic.removeTickerTimeout(s);}),exports.TickersManagerStatic._tickersToCompleteOnStepEnd.tikersIds.length=0,exports.TickersManagerStatic._tickersToCompleteOnStepEnd.stepAlias.length=0;}function we(s,e={stopTicker:true}){typeof s=="string"&&(s=[s]),s.forEach(i=>{let r=exports.TickersManagerStatic._currentTickers.get(i);r&&(e.stopTicker&&r.ticker.stop(),exports.TickersManagerStatic._currentTickers.delete(i));});}function Pt(s){let e=[];if("canvasAlias"in s){let{canvasAlias:i,tickerIdsExcluded:r=[]}=s;exports.TickersManagerStatic._currentTickers.forEach((n,o)=>{n.ticker.canvasElementAliases.includes(i)&&!r.includes(n.ticker.alias)&&n.ticker.paused===false&&(n.ticker.pause(),e.push(o));});}else if("id"in s){let{id:i}=s;typeof i=="string"&&(i=[i]),[...new Set(i)].forEach(r=>{let n=exports.TickersManagerStatic._currentTickers.get(r);n?n.ticker.paused===false&&(n.ticker.pause(),e.push(r)):B.error(`Ticker with id ${r} not found`);});}return e}function Ke(s){if("canvasAlias"in s){let{canvasAlias:e}=s;exports.TickersManagerStatic._currentTickers.forEach(i=>{i.ticker.canvasElementAliases.includes(e)&&i.ticker.play();});}else if("id"in s){let{id:e}=s;typeof e=="string"&&(e=[e]),[...new Set(e)].forEach(i=>{let r=exports.TickersManagerStatic._currentTickers.get(i);r?r.ticker.play():B.error(`Ticker with id ${i} not found`);});}}function Ut(s,e){return false}function Ht(s,e,i="move"){let r=exports.TickersManagerStatic._currentTickersSequence.get(s);if(r){let o=new Map(Array.from(r.entries()).map(([a,l])=>[a,We(l)]));exports.TickersManagerStatic._currentTickersSequence.set(e,o);}exports.TickersManagerStatic._currentTickers.forEach((o,a)=>{if(o.createdByTicketSteps?.canvasElementAlias===s&&we(a),o.ticker.canvasElementAliases.includes(s)){let l=_e.getInstance(o.ticker.alias,We(o.ticker.args),{duration:o.ticker.duration,priority:o.ticker.priority,canvasElementAliases:[e]});if(l?(pt(e,l),o.ticker.paused&&l.pause()):B.error(`Ticker ${o.ticker.alias} not found`),i==="move"&&(o.ticker.canvasElementAliases=o.ticker.canvasElementAliases.filter(h=>h!==s)),Object.hasOwn(o.ticker.args,ut)){let h=o.ticker.args.aliasToRemoveAfter;typeof h=="string"&&(h=[h]),Array.isArray(h)&&(i==="move"?o.ticker.args.aliasToRemoveAfter=h.map(g=>g===s?e:g):i==="duplicate"&&h.find(g=>g===s)&&(o.ticker.args.aliasToRemoveAfter=[...h,e]));}}}),exports.TickersManagerStatic._currentTickersTimeouts.forEach(o=>{o.aliases.includes(s)&&(i==="move"?o.aliases=o.aliases.map(a=>a===s?e:a):i==="duplicate"&&o.aliases.find(a=>a===s)&&o.aliases.push(e));});let n=exports.TickersManagerStatic._currentTickersSequence.get(e);if(n&&n.forEach((o,a)=>{Pe(e,a);}),i==="duplicate"){let o=exports.TickersManagerStatic._currentTickersSequence.get(s);o&&o.forEach((a,l)=>{Pe(s,l);});}}function qt(s){s.alias?exports.TickersManagerStatic._tickersToCompleteOnStepEnd.stepAlias.push({id:s.id,alias:s.alias}):exports.TickersManagerStatic._tickersToCompleteOnStepEnd.tikersIds.push({id:s.id});}async function Lt(s,e){if(e){let i=exports.TickersManagerStatic._currentTickersSequence.get(e),r=i?.get(s);if(i&&r){let n=r.steps.map(o=>{if(typeof o=="object"&&"ticker"in o){let a=_e.getInstance(o.ticker,o.args,{duration:o.duration,canvasElementAliases:[e],priority:o.priority});if(a)return a.complete()}return Promise.resolve()});await Promise.all(n);}}else {let i=exports.TickersManagerStatic._currentTickers.get(s);i&&await i.ticker.complete();}}function Ti(){let s=exports.TickersManagerStatic._tickersToCompleteOnStepEnd.tikersIds.splice(0,exports.TickersManagerStatic._tickersToCompleteOnStepEnd.tikersIds.length),e=exports.TickersManagerStatic._tickersToCompleteOnStepEnd.stepAlias.splice(0,exports.TickersManagerStatic._tickersToCompleteOnStepEnd.stepAlias.length);return {tikersIds:s,stepAlias:e}}var ki={transfer:Ht,get currentTickers(){return exports.TickersManagerStatic._currentTickers},get currentTickersSteps(){return exports.TickersManagerStatic._currentTickersSequence},find:It,add:pt,addSequence:Ft,unlinkComponent:Bt,removeAll:Wt,remove:we,pause:Pt,resume:Ke,isPaused:Ut,completeOnStepEnd:qt,forceCompletion:Lt,onComplete:zt};exports.RegisteredTickers=_e;exports.TickerBase=Ie;exports.drainCompleteOnStepEndQueue=Ti;exports.removeTicker=we;exports.runTickersSequence=Pe;exports.tickerDecorator=Ot;exports.tickers=ki;
1
+ 'use strict';var core=require('@drincs/pixi-vn/core'),At=require('@drincs/pixi-vn/pixi.js');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var At__default=/*#__PURE__*/_interopDefault(At);var mt=Object.create;var Ue=Object.defineProperty;var Tt=Object.getOwnPropertyDescriptor;var kt=Object.getOwnPropertyNames;var yt=Object.getPrototypeOf,vt=Object.prototype.hasOwnProperty;var Ke=s=>{throw TypeError(s)};var St=(s,e,t)=>e in s?Ue(s,e,{enumerable:true,configurable:true,writable:true,value:t}):s[e]=t;var He=(s=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(s,{get:(e,t)=>(typeof require<"u"?require:e)[t]}):s)(function(s){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+s+'" is not supported')});var Xe=(s,e)=>()=>(e||s((e={exports:{}}).exports,e),e.exports);var _t=(s,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of kt(e))!vt.call(s,n)&&n!==t&&Ue(s,n,{get:()=>e[n],enumerable:!(r=Tt(e,n))||r.enumerable});return s};var Qe=(s,e,t)=>(t=s!=null?mt(yt(s)):{},_t(Ue(t,"default",{value:s,enumerable:true}),s));var M=(s,e,t)=>St(s,typeof e!="symbol"?e+"":e,t),qe=(s,e,t)=>e.has(s)||Ke("Cannot "+t);var i=(s,e,t)=>(qe(s,e,"read from private field"),t?t.call(s):e.get(s)),b=(s,e,t)=>e.has(s)?Ke("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(s):e.set(s,t),m=(s,e,t,r)=>(qe(s,e,"write to private field"),e.set(s,t),t),d=(s,e,t)=>(qe(s,e,"access private method"),t);var Oe=(s,e,t,r)=>({set _(n){m(s,e,n);},get _(){return i(s,e,r)}});var et=Xe((Re,Ze)=>{(function(s,e){typeof Re=="object"?Ze.exports=Re=e():typeof define=="function"&&define.amd?define([],e):s.CryptoJS=e();})(Re,function(){var s=s||(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 He=="function")try{r=He("crypto");}catch{}var n=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.")},o=Object.create||(function(){function c(){}return function(f){var w;return c.prototype=f,w=new c,c.prototype=null,w}})(),a={},l=a.lib={},h=l.Base=(function(){return {extend:function(c){var f=o(this);return c&&f.mixIn(c),(!f.hasOwnProperty("init")||this.init===f.init)&&(f.init=function(){f.$super.init.apply(this,arguments);}),f.init.prototype=f,f.$super=this,f},create:function(){var c=this.extend();return c.init.apply(c,arguments),c},init:function(){},mixIn:function(c){for(var f in c)c.hasOwnProperty(f)&&(this[f]=c[f]);c.hasOwnProperty("toString")&&(this.toString=c.toString);},clone:function(){return this.init.prototype.extend(this)}}})(),g=l.WordArray=h.extend({init:function(c,f){c=this.words=c||[],f!=t?this.sigBytes=f:this.sigBytes=c.length*4;},toString:function(c){return (c||T).stringify(this)},concat:function(c){var f=this.words,w=c.words,_=this.sigBytes,x=c.sigBytes;if(this.clamp(),_%4)for(var I=0;I<x;I++){var re=w[I>>>2]>>>24-I%4*8&255;f[_+I>>>2]|=re<<24-(_+I)%4*8;}else for(var W=0;W<x;W+=4)f[_+W>>>2]=w[W>>>2];return this.sigBytes+=x,this},clamp:function(){var c=this.words,f=this.sigBytes;c[f>>>2]&=4294967295<<32-f%4*8,c.length=e.ceil(f/4);},clone:function(){var c=h.clone.call(this);return c.words=this.words.slice(0),c},random:function(c){for(var f=[],w=0;w<c;w+=4)f.push(n());return new g.init(f,c)}}),k=a.enc={},T=k.Hex={stringify:function(c){for(var f=c.words,w=c.sigBytes,_=[],x=0;x<w;x++){var I=f[x>>>2]>>>24-x%4*8&255;_.push((I>>>4).toString(16)),_.push((I&15).toString(16));}return _.join("")},parse:function(c){for(var f=c.length,w=[],_=0;_<f;_+=2)w[_>>>3]|=parseInt(c.substr(_,2),16)<<24-_%8*4;return new g.init(w,f/2)}},y=k.Latin1={stringify:function(c){for(var f=c.words,w=c.sigBytes,_=[],x=0;x<w;x++){var I=f[x>>>2]>>>24-x%4*8&255;_.push(String.fromCharCode(I));}return _.join("")},parse:function(c){for(var f=c.length,w=[],_=0;_<f;_++)w[_>>>2]|=(c.charCodeAt(_)&255)<<24-_%4*8;return new g.init(w,f)}},A=k.Utf8={stringify:function(c){try{return decodeURIComponent(escape(y.stringify(c)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(c){return y.parse(unescape(encodeURIComponent(c)))}},O=l.BufferedBlockAlgorithm=h.extend({reset:function(){this._data=new g.init,this._nDataBytes=0;},_append:function(c){typeof c=="string"&&(c=A.parse(c)),this._data.concat(c),this._nDataBytes+=c.sigBytes;},_process:function(c){var f,w=this._data,_=w.words,x=w.sigBytes,I=this.blockSize,re=I*4,W=x/re;c?W=e.ceil(W):W=e.max((W|0)-this._minBufferSize,0);var Y=W*I,ge=e.min(Y*4,x);if(Y){for(var Me=0;Me<Y;Me+=I)this._doProcessBlock(_,Me);f=_.splice(0,Y),w.sigBytes-=ge;}return new g.init(f,ge)},clone:function(){var c=h.clone.call(this);return c._data=this._data.clone(),c},_minBufferSize:0});l.Hasher=O.extend({cfg:h.extend(),init:function(c){this.cfg=this.cfg.extend(c),this.reset();},reset:function(){O.reset.call(this),this._doReset();},update:function(c){return this._append(c),this._process(),this},finalize:function(c){c&&this._append(c);var f=this._doFinalize();return f},blockSize:512/32,_createHelper:function(c){return function(f,w){return new c.init(w).finalize(f)}},_createHmacHelper:function(c){return function(f,w){return new v.HMAC.init(c,w).finalize(f)}}});var v=a.algo={};return a})(Math);return s});});var Le=Xe((Ce,tt)=>{(function(s,e){typeof Ce=="object"?tt.exports=Ce=e(et()):typeof define=="function"&&define.amd?define(["./core"],e):e(s.CryptoJS);})(Ce,function(s){return (function(){var e=s,t=e.lib,r=t.WordArray,n=t.Hasher,o=e.algo,a=[],l=o.SHA1=n.extend({_doReset:function(){this._hash=new r.init([1732584193,4023233417,2562383102,271733878,3285377520]);},_doProcessBlock:function(h,g){for(var k=this._hash.words,T=k[0],y=k[1],A=k[2],O=k[3],E=k[4],v=0;v<80;v++){if(v<16)a[v]=h[g+v]|0;else {var c=a[v-3]^a[v-8]^a[v-14]^a[v-16];a[v]=c<<1|c>>>31;}var f=(T<<5|T>>>27)+E+a[v];v<20?f+=(y&A|~y&O)+1518500249:v<40?f+=(y^A^O)+1859775393:v<60?f+=(y&A|y&O|A&O)-1894007588:f+=(y^A^O)-899497514,E=O,O=A,A=y<<30|y>>>2,y=T,T=f;}k[0]=k[0]+T|0,k[1]=k[1]+y|0,k[2]=k[2]+A|0,k[3]=k[3]+O|0,k[4]=k[4]+E|0;},_doFinalize:function(){var h=this._data,g=h.words,k=this._nDataBytes*8,T=h.sigBytes*8;return g[T>>>5]|=128<<24-T%32,g[(T+64>>>9<<4)+14]=Math.floor(k/4294967296),g[(T+64>>>9<<4)+15]=k,h.sigBytes=g.length*4,this._process(),this._hash},clone:function(){var h=n.clone.call(this);return h._hash=this._hash.clone(),h}});e.SHA1=n._createHelper(l),e.HmacSHA1=n._createHmacHelper(l);})(),s.SHA1});});var it=Qe(Le());var B;(n=>(n.log=(o,...a)=>console.log(`[Pixi\u2019VN] ${o}`,...a),n.warn=(o,...a)=>console.warn(`[Pixi\u2019VN] ${o}`,...a),n.error=(o,...a)=>console.error(`[Pixi\u2019VN] ${o}`,...a),n.info=(o,...a)=>console.info(`[Pixi\u2019VN] ${o}`,...a)))(B||={});var Ie=class{constructor(e,t){this.alias=this.constructor.prototype.id;let{duration:r,priority:n,id:o=this.generateTickerId(this.alias,t),canvasElementAliases:a=[]}=t||{};this.args=e,this.duration=r,this.priority=n,this.id=o,this.canvasElementAliases=a;}alias;id;args;duration;priority;ticker=new At__default.default.Ticker;canvasElementAliases=[];generateTickerId(...e){try{return (0,it.default)(JSON.stringify(e)).toString()+"_"+Math.random().toString(36).substring(7)}catch(t){throw new core.PixiError("not_json_serializable",`Error to generate ticker id: ${t}`)}}fnValue;complete(e){this.stop();}stop(){let e=this.fnValue;if(!e){B.warn("TickerBase.stop() called without fnValue set. This may cause issues.");return}this.ticker.remove(e,null);}start(){let e=this.id,t=()=>this.fn(this.ticker,this.args,this.canvasElementAliases,e);this.fnValue=t,this.ticker.add(t,null,this.priority),this.ticker.start();}pause(){this.ticker.stop();}play(){this.ticker.start();}get paused(){return !this.ticker.started}};var xt=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,ot=new Set,je=typeof process=="object"&&process?process:{},at=(s,e,t,r)=>{typeof je.emitWarning=="function"?je.emitWarning(s,e,t,r):console.error(`[${t}] ${e}: ${s}`);},De=globalThis.AbortController,rt=globalThis.AbortSignal;if(typeof De>"u"){rt=class{onabort;_onabort=[];reason;aborted=false;addEventListener(t,r){this._onabort.push(r);}},De=class{constructor(){e();}signal=new rt;abort(t){if(!this.signal.aborted){this.signal.reason=t,this.signal.aborted=true;for(let r of this.signal._onabort)r(t);this.signal.onabort?.(t);}}};let s=je.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{s&&(s=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 bt=s=>!ot.has(s);var oe=s=>s&&s===Math.floor(s)&&s>0&&isFinite(s),ct=s=>oe(s)?s<=Math.pow(2,8)?Uint8Array:s<=Math.pow(2,16)?Uint16Array:s<=Math.pow(2,32)?Uint32Array:s<=Number.MAX_SAFE_INTEGER?ze:null:null,ze=class extends Array{constructor(s){super(s),this.fill(0);}},se,me,Et=(se=class{heap;length;static create(e){let t=ct(e);if(!t)return [];m(se,me,true);let r=new se(e,t);return m(se,me,false),r}constructor(e,t){if(!i(se,me))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new t(e),this.length=0;}push(e){this.heap[this.length++]=e;}pop(){return this.heap[--this.length]}},me=new WeakMap,b(se,me,false),se),st,nt,$,L,J,ue,K,Te,ke,X,F,Q,z,C,S,H,j,U,D,Z,P,ee,te,N,G,ie,le,q,ye,u,Ne,fe,ne,xe,V,lt,de,ve,be,ae,ce,Ge,Fe,Be,R,Ve,Ae,he,$e,Se,ht=(Se=class{constructor(e){b(this,u);b(this,$);b(this,L);b(this,J);b(this,ue);b(this,K);b(this,Te);b(this,ke);b(this,X);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");b(this,F);b(this,Q);b(this,z);b(this,C);b(this,S);b(this,H);b(this,j);b(this,U);b(this,D);b(this,Z);b(this,P);b(this,ee);b(this,te);b(this,N);b(this,G);b(this,ie);b(this,le);b(this,q);b(this,ye);b(this,fe,()=>{});b(this,ne,()=>{});b(this,xe,()=>{});b(this,V,()=>false);b(this,de,e=>{});b(this,ve,(e,t,r)=>{});b(this,be,(e,t,r,n)=>{if(r||n)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});M(this,st,"LRUCache");let{max:t=0,ttl:r,ttlResolution:n=1,ttlAutopurge:o,updateAgeOnGet:a,updateAgeOnHas:l,allowStale:h,dispose:g,onInsert:k,disposeAfter:T,noDisposeOnSet:y,noUpdateTTL:A,maxSize:O=0,maxEntrySize:E=0,sizeCalculation:v,fetchMethod:c,memoMethod:f,noDeleteOnFetchRejection:w,noDeleteOnStaleGet:_,allowStaleOnFetchRejection:x,allowStaleOnFetchAbort:I,ignoreFetchAbort:re,perf:W}=e;if(W!==void 0&&typeof W?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(m(this,X,W??xt),t!==0&&!oe(t))throw new TypeError("max option must be a nonnegative integer");let Y=t?ct(t):Array;if(!Y)throw new Error("invalid max value: "+t);if(m(this,$,t),m(this,L,O),this.maxEntrySize=E||i(this,L),this.sizeCalculation=v,this.sizeCalculation){if(!i(this,L)&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(f!==void 0&&typeof f!="function")throw new TypeError("memoMethod must be a function if defined");if(m(this,ke,f),c!==void 0&&typeof c!="function")throw new TypeError("fetchMethod must be a function if specified");if(m(this,Te,c),m(this,le,!!c),m(this,z,new Map),m(this,C,new Array(t).fill(void 0)),m(this,S,new Array(t).fill(void 0)),m(this,H,new Y(t)),m(this,j,new Y(t)),m(this,U,0),m(this,D,0),m(this,Z,Et.create(t)),m(this,F,0),m(this,Q,0),typeof g=="function"&&m(this,J,g),typeof k=="function"&&m(this,ue,k),typeof T=="function"?(m(this,K,T),m(this,P,[])):(m(this,K,void 0),m(this,P,void 0)),m(this,ie,!!i(this,J)),m(this,ye,!!i(this,ue)),m(this,q,!!i(this,K)),this.noDisposeOnSet=!!y,this.noUpdateTTL=!!A,this.noDeleteOnFetchRejection=!!w,this.allowStaleOnFetchRejection=!!x,this.allowStaleOnFetchAbort=!!I,this.ignoreFetchAbort=!!re,this.maxEntrySize!==0){if(i(this,L)!==0&&!oe(i(this,L)))throw new TypeError("maxSize must be a positive integer if specified");if(!oe(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");d(this,u,lt).call(this);}if(this.allowStale=!!h,this.noDeleteOnStaleGet=!!_,this.updateAgeOnGet=!!a,this.updateAgeOnHas=!!l,this.ttlResolution=oe(n)||n===0?n:1,this.ttlAutopurge=!!o,this.ttl=r||0,this.ttl){if(!oe(this.ttl))throw new TypeError("ttl must be a positive integer if specified");d(this,u,Ne).call(this);}if(i(this,$)===0&&this.ttl===0&&i(this,L)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!i(this,$)&&!i(this,L)){let ge="LRU_CACHE_UNBOUNDED";bt(ge)&&(ot.add(ge),at("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",ge,Se));}}get perf(){return i(this,X)}static unsafeExposeInternals(e){return {starts:i(e,te),ttls:i(e,N),autopurgeTimers:i(e,G),sizes:i(e,ee),keyMap:i(e,z),keyList:i(e,C),valList:i(e,S),next:i(e,H),prev:i(e,j),get head(){return i(e,U)},get tail(){return i(e,D)},free:i(e,Z),isBackgroundFetch:t=>{var r;return d(r=e,u,R).call(r,t)},backgroundFetch:(t,r,n,o)=>{var a;return d(a=e,u,Be).call(a,t,r,n,o)},moveToTail:t=>{var r;return d(r=e,u,Ae).call(r,t)},indexes:t=>{var r;return d(r=e,u,ae).call(r,t)},rindexes:t=>{var r;return d(r=e,u,ce).call(r,t)},isStale:t=>{var r;return i(r=e,V).call(r,t)}}}get max(){return i(this,$)}get maxSize(){return i(this,L)}get calculatedSize(){return i(this,Q)}get size(){return i(this,F)}get fetchMethod(){return i(this,Te)}get memoMethod(){return i(this,ke)}get dispose(){return i(this,J)}get onInsert(){return i(this,ue)}get disposeAfter(){return i(this,K)}getRemainingTTL(e){return i(this,z).has(e)?1/0:0}*entries(){for(let e of d(this,u,ae).call(this))i(this,S)[e]!==void 0&&i(this,C)[e]!==void 0&&!d(this,u,R).call(this,i(this,S)[e])&&(yield [i(this,C)[e],i(this,S)[e]]);}*rentries(){for(let e of d(this,u,ce).call(this))i(this,S)[e]!==void 0&&i(this,C)[e]!==void 0&&!d(this,u,R).call(this,i(this,S)[e])&&(yield [i(this,C)[e],i(this,S)[e]]);}*keys(){for(let e of d(this,u,ae).call(this)){let t=i(this,C)[e];t!==void 0&&!d(this,u,R).call(this,i(this,S)[e])&&(yield t);}}*rkeys(){for(let e of d(this,u,ce).call(this)){let t=i(this,C)[e];t!==void 0&&!d(this,u,R).call(this,i(this,S)[e])&&(yield t);}}*values(){for(let e of d(this,u,ae).call(this))i(this,S)[e]!==void 0&&!d(this,u,R).call(this,i(this,S)[e])&&(yield i(this,S)[e]);}*rvalues(){for(let e of d(this,u,ce).call(this))i(this,S)[e]!==void 0&&!d(this,u,R).call(this,i(this,S)[e])&&(yield i(this,S)[e]);}[(nt=Symbol.iterator,st=Symbol.toStringTag,nt)](){return this.entries()}find(e,t={}){for(let r of d(this,u,ae).call(this)){let n=i(this,S)[r],o=d(this,u,R).call(this,n)?n.__staleWhileFetching:n;if(o!==void 0&&e(o,i(this,C)[r],this))return this.get(i(this,C)[r],t)}}forEach(e,t=this){for(let r of d(this,u,ae).call(this)){let n=i(this,S)[r],o=d(this,u,R).call(this,n)?n.__staleWhileFetching:n;o!==void 0&&e.call(t,o,i(this,C)[r],this);}}rforEach(e,t=this){for(let r of d(this,u,ce).call(this)){let n=i(this,S)[r],o=d(this,u,R).call(this,n)?n.__staleWhileFetching:n;o!==void 0&&e.call(t,o,i(this,C)[r],this);}}purgeStale(){let e=false;for(let t of d(this,u,ce).call(this,{allowStale:true}))i(this,V).call(this,t)&&(d(this,u,he).call(this,i(this,C)[t],"expire"),e=true);return e}info(e){let t=i(this,z).get(e);if(t===void 0)return;let r=i(this,S)[t],n=d(this,u,R).call(this,r)?r.__staleWhileFetching:r;if(n===void 0)return;let o={value:n};if(i(this,N)&&i(this,te)){let a=i(this,N)[t],l=i(this,te)[t];if(a&&l){let h=a-(i(this,X).now()-l);o.ttl=h,o.start=Date.now();}}return i(this,ee)&&(o.size=i(this,ee)[t]),o}dump(){let e=[];for(let t of d(this,u,ae).call(this,{allowStale:true})){let r=i(this,C)[t],n=i(this,S)[t],o=d(this,u,R).call(this,n)?n.__staleWhileFetching:n;if(o===void 0||r===void 0)continue;let a={value:o};if(i(this,N)&&i(this,te)){a.ttl=i(this,N)[t];let l=i(this,X).now()-i(this,te)[t];a.start=Math.floor(Date.now()-l);}i(this,ee)&&(a.size=i(this,ee)[t]),e.unshift([r,a]);}return e}load(e){this.clear();for(let[t,r]of e){if(r.start){let n=Date.now()-r.start;r.start=i(this,X).now()-n;}this.set(t,r.value,r);}}set(e,t,r={}){var y,A,O,E;if(t===void 0)return this.delete(e),this;let{ttl:n=this.ttl,start:o,noDisposeOnSet:a=this.noDisposeOnSet,sizeCalculation:l=this.sizeCalculation,status:h}=r,{noUpdateTTL:g=this.noUpdateTTL}=r,k=i(this,be).call(this,e,t,r.size||0,l);if(this.maxEntrySize&&k>this.maxEntrySize)return h&&(h.set="miss",h.maxEntrySizeExceeded=true),d(this,u,he).call(this,e,"set"),this;let T=i(this,F)===0?void 0:i(this,z).get(e);if(T===void 0)T=i(this,F)===0?i(this,D):i(this,Z).length!==0?i(this,Z).pop():i(this,F)===i(this,$)?d(this,u,Fe).call(this,false):i(this,F),i(this,C)[T]=e,i(this,S)[T]=t,i(this,z).set(e,T),i(this,H)[i(this,D)]=T,i(this,j)[T]=i(this,D),m(this,D,T),Oe(this,F)._++,i(this,ve).call(this,T,k,h),h&&(h.set="add"),g=false,i(this,ye)&&((y=i(this,ue))==null||y.call(this,t,e,"add"));else {d(this,u,Ae).call(this,T);let v=i(this,S)[T];if(t!==v){if(i(this,le)&&d(this,u,R).call(this,v)){v.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:c}=v;c!==void 0&&!a&&(i(this,ie)&&((A=i(this,J))==null||A.call(this,c,e,"set")),i(this,q)&&i(this,P)?.push([c,e,"set"]));}else a||(i(this,ie)&&((O=i(this,J))==null||O.call(this,v,e,"set")),i(this,q)&&i(this,P)?.push([v,e,"set"]));if(i(this,de).call(this,T),i(this,ve).call(this,T,k,h),i(this,S)[T]=t,h){h.set="replace";let c=v&&d(this,u,R).call(this,v)?v.__staleWhileFetching:v;c!==void 0&&(h.oldValue=c);}}else h&&(h.set="update");i(this,ye)&&this.onInsert?.(t,e,t===v?"update":"replace");}if(n!==0&&!i(this,N)&&d(this,u,Ne).call(this),i(this,N)&&(g||i(this,xe).call(this,T,n,o),h&&i(this,ne).call(this,h,T)),!a&&i(this,q)&&i(this,P)){let v=i(this,P),c;for(;c=v?.shift();)(E=i(this,K))==null||E.call(this,...c);}return this}pop(){var e;try{for(;i(this,F);){let t=i(this,S)[i(this,U)];if(d(this,u,Fe).call(this,!0),d(this,u,R).call(this,t)){if(t.__staleWhileFetching)return t.__staleWhileFetching}else if(t!==void 0)return t}}finally{if(i(this,q)&&i(this,P)){let t=i(this,P),r;for(;r=t?.shift();)(e=i(this,K))==null||e.call(this,...r);}}}has(e,t={}){let{updateAgeOnHas:r=this.updateAgeOnHas,status:n}=t,o=i(this,z).get(e);if(o!==void 0){let a=i(this,S)[o];if(d(this,u,R).call(this,a)&&a.__staleWhileFetching===void 0)return false;if(i(this,V).call(this,o))n&&(n.has="stale",i(this,ne).call(this,n,o));else return r&&i(this,fe).call(this,o),n&&(n.has="hit",i(this,ne).call(this,n,o)),true}else n&&(n.has="miss");return false}peek(e,t={}){let{allowStale:r=this.allowStale}=t,n=i(this,z).get(e);if(n===void 0||!r&&i(this,V).call(this,n))return;let o=i(this,S)[n];return d(this,u,R).call(this,o)?o.__staleWhileFetching:o}async fetch(e,t={}){let{allowStale:r=this.allowStale,updateAgeOnGet:n=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,ttl:a=this.ttl,noDisposeOnSet:l=this.noDisposeOnSet,size:h=0,sizeCalculation:g=this.sizeCalculation,noUpdateTTL:k=this.noUpdateTTL,noDeleteOnFetchRejection:T=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:y=this.allowStaleOnFetchRejection,ignoreFetchAbort:A=this.ignoreFetchAbort,allowStaleOnFetchAbort:O=this.allowStaleOnFetchAbort,context:E,forceRefresh:v=false,status:c,signal:f}=t;if(!i(this,le))return c&&(c.fetch="get"),this.get(e,{allowStale:r,updateAgeOnGet:n,noDeleteOnStaleGet:o,status:c});let w={allowStale:r,updateAgeOnGet:n,noDeleteOnStaleGet:o,ttl:a,noDisposeOnSet:l,size:h,sizeCalculation:g,noUpdateTTL:k,noDeleteOnFetchRejection:T,allowStaleOnFetchRejection:y,allowStaleOnFetchAbort:O,ignoreFetchAbort:A,status:c,signal:f},_=i(this,z).get(e);if(_===void 0){c&&(c.fetch="miss");let x=d(this,u,Be).call(this,e,_,w,E);return x.__returned=x}else {let x=i(this,S)[_];if(d(this,u,R).call(this,x)){let Y=r&&x.__staleWhileFetching!==void 0;return c&&(c.fetch="inflight",Y&&(c.returnedStale=true)),Y?x.__staleWhileFetching:x.__returned=x}let I=i(this,V).call(this,_);if(!v&&!I)return c&&(c.fetch="hit"),d(this,u,Ae).call(this,_),n&&i(this,fe).call(this,_),c&&i(this,ne).call(this,c,_),x;let re=d(this,u,Be).call(this,e,_,w,E),W=re.__staleWhileFetching!==void 0&&r;return c&&(c.fetch=I?"stale":"refresh",W&&I&&(c.returnedStale=true)),W?re.__staleWhileFetching:re.__returned=re}}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=i(this,ke);if(!r)throw new Error("no memoMethod provided to constructor");let{context:n,forceRefresh:o,...a}=t,l=this.get(e,a);if(!o&&l!==void 0)return l;let h=r(e,l,{options:a,context:n});return this.set(e,h,a),h}get(e,t={}){let{allowStale:r=this.allowStale,updateAgeOnGet:n=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,status:a}=t,l=i(this,z).get(e);if(l!==void 0){let h=i(this,S)[l],g=d(this,u,R).call(this,h);return a&&i(this,ne).call(this,a,l),i(this,V).call(this,l)?(a&&(a.get="stale"),g?(a&&r&&h.__staleWhileFetching!==void 0&&(a.returnedStale=true),r?h.__staleWhileFetching:void 0):(o||d(this,u,he).call(this,e,"expire"),a&&r&&(a.returnedStale=true),r?h:void 0)):(a&&(a.get="hit"),g?h.__staleWhileFetching:(d(this,u,Ae).call(this,l),n&&i(this,fe).call(this,l),h))}else a&&(a.get="miss");}delete(e){return d(this,u,he).call(this,e,"delete")}clear(){return d(this,u,$e).call(this,"delete")}},$=new WeakMap,L=new WeakMap,J=new WeakMap,ue=new WeakMap,K=new WeakMap,Te=new WeakMap,ke=new WeakMap,X=new WeakMap,F=new WeakMap,Q=new WeakMap,z=new WeakMap,C=new WeakMap,S=new WeakMap,H=new WeakMap,j=new WeakMap,U=new WeakMap,D=new WeakMap,Z=new WeakMap,P=new WeakMap,ee=new WeakMap,te=new WeakMap,N=new WeakMap,G=new WeakMap,ie=new WeakMap,le=new WeakMap,q=new WeakMap,ye=new WeakMap,u=new WeakSet,Ne=function(){let e=new ze(i(this,$)),t=new ze(i(this,$));m(this,N,e),m(this,te,t);let r=this.ttlAutopurge?new Array(i(this,$)):void 0;m(this,G,r),m(this,xe,(l,h,g=i(this,X).now())=>{t[l]=h!==0?g:0,e[l]=h,n(l,h);}),m(this,fe,l=>{t[l]=e[l]!==0?i(this,X).now():0,n(l,e[l]);});let n=this.ttlAutopurge?(l,h)=>{if(r?.[l]&&(clearTimeout(r[l]),r[l]=void 0),h&&h!==0&&r){let g=setTimeout(()=>{i(this,V).call(this,l)&&d(this,u,he).call(this,i(this,C)[l],"expire");},h+1);g.unref&&g.unref(),r[l]=g;}}:()=>{};m(this,ne,(l,h)=>{if(e[h]){let g=e[h],k=t[h];if(!g||!k)return;l.ttl=g,l.start=k,l.now=o||a();let T=l.now-k;l.remainingTTL=g-T;}});let o=0,a=()=>{let l=i(this,X).now();if(this.ttlResolution>0){o=l;let h=setTimeout(()=>o=0,this.ttlResolution);h.unref&&h.unref();}return l};this.getRemainingTTL=l=>{let h=i(this,z).get(l);if(h===void 0)return 0;let g=e[h],k=t[h];if(!g||!k)return 1/0;let T=(o||a())-k;return g-T},m(this,V,l=>{let h=t[l],g=e[l];return !!g&&!!h&&(o||a())-h>g});},fe=new WeakMap,ne=new WeakMap,xe=new WeakMap,V=new WeakMap,lt=function(){let e=new ze(i(this,$));m(this,Q,0),m(this,ee,e),m(this,de,t=>{m(this,Q,i(this,Q)-e[t]),e[t]=0;}),m(this,be,(t,r,n,o)=>{if(d(this,u,R).call(this,r))return 0;if(!oe(n))if(o){if(typeof o!="function")throw new TypeError("sizeCalculation must be a function");if(n=o(r,t),!oe(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}),m(this,ve,(t,r,n)=>{if(e[t]=r,i(this,L)){let o=i(this,L)-e[t];for(;i(this,Q)>o;)d(this,u,Fe).call(this,true);}m(this,Q,i(this,Q)+e[t]),n&&(n.entrySize=r,n.totalCalculatedSize=i(this,Q));});},de=new WeakMap,ve=new WeakMap,be=new WeakMap,ae=function*({allowStale:e=this.allowStale}={}){if(i(this,F))for(let t=i(this,D);!(!d(this,u,Ge).call(this,t)||((e||!i(this,V).call(this,t))&&(yield t),t===i(this,U)));)t=i(this,j)[t];},ce=function*({allowStale:e=this.allowStale}={}){if(i(this,F))for(let t=i(this,U);!(!d(this,u,Ge).call(this,t)||((e||!i(this,V).call(this,t))&&(yield t),t===i(this,D)));)t=i(this,H)[t];},Ge=function(e){return e!==void 0&&i(this,z).get(i(this,C)[e])===e},Fe=function(e){var o;let t=i(this,U),r=i(this,C)[t],n=i(this,S)[t];return i(this,le)&&d(this,u,R).call(this,n)?n.__abortController.abort(new Error("evicted")):(i(this,ie)||i(this,q))&&(i(this,ie)&&((o=i(this,J))==null||o.call(this,n,r,"evict")),i(this,q)&&i(this,P)?.push([n,r,"evict"])),i(this,de).call(this,t),i(this,G)?.[t]&&(clearTimeout(i(this,G)[t]),i(this,G)[t]=void 0),e&&(i(this,C)[t]=void 0,i(this,S)[t]=void 0,i(this,Z).push(t)),i(this,F)===1?(m(this,U,m(this,D,0)),i(this,Z).length=0):m(this,U,i(this,H)[t]),i(this,z).delete(r),Oe(this,F)._--,t},Be=function(e,t,r,n){let o=t===void 0?void 0:i(this,S)[t];if(d(this,u,R).call(this,o))return o;let a=new De,{signal:l}=r;l?.addEventListener("abort",()=>a.abort(l.reason),{signal:a.signal});let h={signal:a.signal,options:r,context:n},g=(E,v=false)=>{let{aborted:c}=a.signal,f=r.ignoreFetchAbort&&E!==void 0,w=r.ignoreFetchAbort||!!(r.allowStaleOnFetchAbort&&E!==void 0);if(r.status&&(c&&!v?(r.status.fetchAborted=true,r.status.fetchError=a.signal.reason,f&&(r.status.fetchAbortIgnored=true)):r.status.fetchResolved=true),c&&!f&&!v)return T(a.signal.reason,w);let _=A,x=i(this,S)[t];return (x===A||f&&v&&x===void 0)&&(E===void 0?_.__staleWhileFetching!==void 0?i(this,S)[t]=_.__staleWhileFetching:d(this,u,he).call(this,e,"fetch"):(r.status&&(r.status.fetchUpdated=true),this.set(e,E,h.options))),E},k=E=>(r.status&&(r.status.fetchRejected=true,r.status.fetchError=E),T(E,false)),T=(E,v)=>{let{aborted:c}=a.signal,f=c&&r.allowStaleOnFetchAbort,w=f||r.allowStaleOnFetchRejection,_=w||r.noDeleteOnFetchRejection,x=A;if(i(this,S)[t]===A&&(!_||!v&&x.__staleWhileFetching===void 0?d(this,u,he).call(this,e,"fetch"):f||(i(this,S)[t]=x.__staleWhileFetching)),w)return r.status&&x.__staleWhileFetching!==void 0&&(r.status.returnedStale=true),x.__staleWhileFetching;if(x.__returned===x)throw E},y=(E,v)=>{var f;let c=(f=i(this,Te))==null?void 0:f.call(this,e,o,h);c&&c instanceof Promise&&c.then(w=>E(w===void 0?void 0:w),v),a.signal.addEventListener("abort",()=>{(!r.ignoreFetchAbort||r.allowStaleOnFetchAbort)&&(E(void 0),r.allowStaleOnFetchAbort&&(E=w=>g(w,true)));});};r.status&&(r.status.fetchDispatched=true);let A=new Promise(y).then(g,k),O=Object.assign(A,{__abortController:a,__staleWhileFetching:o,__returned:void 0});return t===void 0?(this.set(e,O,{...h.options,status:void 0}),t=i(this,z).get(e)):i(this,S)[t]=O,O},R=function(e){if(!i(this,le))return false;let t=e;return !!t&&t instanceof Promise&&t.hasOwnProperty("__staleWhileFetching")&&t.__abortController instanceof De},Ve=function(e,t){i(this,j)[t]=e,i(this,H)[e]=t;},Ae=function(e){e!==i(this,D)&&(e===i(this,U)?m(this,U,i(this,H)[e]):d(this,u,Ve).call(this,i(this,j)[e],i(this,H)[e]),d(this,u,Ve).call(this,i(this,D),e),m(this,D,e));},he=function(e,t){var n,o;let r=false;if(i(this,F)!==0){let a=i(this,z).get(e);if(a!==void 0)if(i(this,G)?.[a]&&(clearTimeout(i(this,G)?.[a]),i(this,G)[a]=void 0),r=true,i(this,F)===1)d(this,u,$e).call(this,t);else {i(this,de).call(this,a);let l=i(this,S)[a];if(d(this,u,R).call(this,l)?l.__abortController.abort(new Error("deleted")):(i(this,ie)||i(this,q))&&(i(this,ie)&&((n=i(this,J))==null||n.call(this,l,e,t)),i(this,q)&&i(this,P)?.push([l,e,t])),i(this,z).delete(e),i(this,C)[a]=void 0,i(this,S)[a]=void 0,a===i(this,D))m(this,D,i(this,j)[a]);else if(a===i(this,U))m(this,U,i(this,H)[a]);else {let h=i(this,j)[a];i(this,H)[h]=i(this,H)[a];let g=i(this,H)[a];i(this,j)[g]=i(this,j)[a];}Oe(this,F)._--,i(this,Z).push(a);}}if(i(this,q)&&i(this,P)?.length){let a=i(this,P),l;for(;l=a?.shift();)(o=i(this,K))==null||o.call(this,...l);}return r},$e=function(e){var t,r;for(let n of d(this,u,ce).call(this,{allowStale:true})){let o=i(this,S)[n];if(d(this,u,R).call(this,o))o.__abortController.abort(new Error("deleted"));else {let a=i(this,C)[n];i(this,ie)&&((t=i(this,J))==null||t.call(this,o,a,e)),i(this,q)&&i(this,P)?.push([o,a,e]);}}if(i(this,z).clear(),i(this,S).fill(void 0),i(this,C).fill(void 0),i(this,N)&&i(this,te)){i(this,N).fill(0),i(this,te).fill(0);for(let n of i(this,G)??[])n!==void 0&&clearTimeout(n);i(this,G)?.fill(void 0);}if(i(this,ee)&&i(this,ee).fill(0),m(this,U,0),m(this,D,0),i(this,Z).length=0,m(this,Q,0),m(this,F,0),i(this,q)&&i(this,P)){let n=i(this,P),o;for(;o=n?.shift();)(r=i(this,K))==null||r.call(this,...o);}},Se);var Ee=class{cache;map=new Map;constructor(e){this.cache=new ht({max:e.cacheSize}),this.map=new Map;}get[Symbol.iterator](){return this.map[Symbol.iterator]}get[Symbol.toStringTag](){return this.map[Symbol.toStringTag]}clear(){this.cache.clear(),this.map.clear();}delete(e){let 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 pe=new Ee({cacheSize:5});function Ot(s){return function(e){Ye.add(e,s);}}var Ye;(a=>{function s(l,h){h||(h=l.name),pe.get(h)&&B.info(`Ticker "${h}" already exists, it will be overwritten`),l.prototype.id=h,pe.set(h,l);}a.add=s;function e(l){try{let h=pe.get(l);if(!h){B.error(`Event "${l}" not found, did you forget to register it with the tickerDecorator?`);return}return h}catch(h){B.error(`Error while getting Event "${l}"`,h);return}}a.get=e;function t(l,h,g){try{let k=pe.get(l);if(!k){B.error(`Ticker "${l}" not found, did you forget to register it with the tickerDecorator?`);return}return new k(h,g)}catch(k){B.error(`Error while getting Ticker "${l}"`,k);return}}a.getInstance=t;function r(){return Array.from(pe.values())}a.values=r;function n(l){return pe.has(l)}a.has=n;function o(){return Array.from(pe.keys())}a.keys=o;})(Ye||={});var _e=Ye;function Rt(s,e,t){let r=[0],n=s;for(let o=0;o<t;o++)r.push(n,-n*.6,n*.3,0),n*=e;return r}function Ct(s,e,t,r){let n=t.reduce((k,T)=>T.enabled?k+T.padding:k,0),o=s.x,a=s.y,l=s.x+s.width,h=s.y+s.height;r&&(o=Math.max(o,0),a=Math.max(a,0),l=Math.min(l,r.width),h=Math.min(h,r.height));let g={x:o-n,y:a-n,width:l-o+n*2,height:h-a+n*2};return {x:s.x+e.x*s.width-g.x,y:s.y+e.y*s.height-g.y,area:g}}function It(s,e,t,r){return Math.max(0,Math.ceil(e-Math.min(s.x,s.y,t-s.x,r-s.y)))}function zt(s,e,t,r){let n=Math.min(Math.max(e,0),.5),o=Math.hypot(Math.max(s.x,t-s.x),Math.max(s.y,r-s.y));return Math.ceil(o*n/(1-n))}function Ft(s,e,t,r){return r>0?r:Math.hypot(Math.max(s.x,e.width-s.x),Math.max(s.y,e.height-s.y))+t/2}function Pe(s){try{if(typeof s>"u")return s;let e=JSON.stringify(s);return JSON.parse(e)}catch(e){throw B.error("Error creating exportable element",s,e),new core.PixiError("not_json_serializable","Error creating exportable element")}}var ut=Qe(Le());exports.TickersManagerStatic=void 0;(T=>{function s(){return Object.fromEntries(Array.from(T._currentTickers.entries()).filter(([y,A])=>!A.createdByTicketSteps).map(([y,A])=>[y,{id:A.ticker.alias,args:A.ticker.args,canvasElementAliases:A.ticker.canvasElementAliases,priority:A.ticker.priority,duration:A.ticker.duration,paused:A.ticker.paused}]))}T.currentTickersWithoutCreatedBySteps=s,T._currentTickers=new Map,T._currentTickersSequence=new Map;function r(){return Object.fromEntries(Array.from(T._currentTickersSequence.entries()).map(([y,A])=>[y,Object.fromEntries(A)]))}T.currentTickersSequence=r,T._currentTickersTimeouts=new Map,T._tickersToCompleteOnStepEnd={tikersIds:[],stepAlias:[]};function a(...y){try{return `${(0,ut.default)(JSON.stringify(y)).toString()}_${Math.random().toString(36).substring(7)}`}catch(A){throw new core.PixiError("not_json_serializable",`Error to generate ticker id: ${A}`)}}T.generateTickerId=a;function l(y,A,O,E){typeof y=="string"&&(y=[y]),T._currentTickersTimeouts.set(O,{aliases:y,ticker:A,canBeDeletedBeforeEnd:E});}T.addTickerTimeoutInfo=l;function h(y){typeof y!="string"&&(y=y.toString()),T._currentTickersTimeouts.delete(y);}T.removeTickerTimeoutInfo=h;function g(y){typeof y!="string"&&(y=y.toString()),clearTimeout(Number(y)),h(y);}T.removeTickerTimeout=g;function k(y,A){T._currentTickersTimeouts.forEach((O,E)=>{let v=O.aliases.filter(c=>c!==y);if(v.length===0){let c=O.canBeDeletedBeforeEnd;(!A||c)&&g(E);}else O.aliases=v;});}T.removeTickerTimeoutsByAlias=k;})(exports.TickersManagerStatic||={});var ft="aliasToRemoveAfter";function Pt(s){let e=exports.TickersManagerStatic._currentTickers.get(s);if(e)return e.ticker}function pt(s,e){let t=e.id,r=e.alias;if(typeof s=="string"&&(s=[s]),e.canvasElementAliases=s,!_e.has(r)){B.error(`Ticker ${r} not found`);return}let n={ticker:e};if(exports.TickersManagerStatic._currentTickers.set(t,n),n.ticker.start(),e.duration){let o=setTimeout(()=>{exports.TickersManagerStatic._currentTickersTimeouts.get(o.toString())&&(exports.TickersManagerStatic.removeTickerTimeout(o),exports.TickersManagerStatic._currentTickers.get(t)===n&&n.ticker.complete({ignoreTickerSteps:true}));},e.duration*1e3);exports.TickersManagerStatic.addTickerTimeoutInfo(s,r,o.toString(),true);}return t}function Wt(s,e,t=0){if(e.length===0){B.warn("The steps of the tickers is empty");return}exports.TickersManagerStatic._currentTickersSequence.has(s)||exports.TickersManagerStatic._currentTickersSequence.set(s,new Map);let r={currentStepNumber:t,steps:e.map(o=>({ticker:o.alias,args:Pe(o.args),duration:o.duration}))},n=exports.TickersManagerStatic.generateTickerId(r);return exports.TickersManagerStatic._currentTickersSequence.get(s)?.set(n,r),We(s,n),n}function We(s,e){let t=exports.TickersManagerStatic._currentTickersSequence.get(s);if(!t?.has(e))return;let r=t.get(e).steps[t.get(e).currentStepNumber],n=_e.getInstance(r.ticker,r.args,{canvasElementAliases:[s],duration:r.duration,priority:r.priority});if(!n){B.error(`Ticker ${r.ticker} not found`);return}let o=n.alias,a=n.id;n.canvasElementAliases=[s];let l={createdByTicketSteps:{canvasElementAlias:s,id:e},ticker:n};if(exports.TickersManagerStatic._currentTickers.set(a,l),l.ticker.start(),n.duration){let h=setTimeout(()=>{let g=exports.TickersManagerStatic._currentTickersTimeouts.get(h.toString());g&&(l.ticker.complete({ignoreTickerSteps:true}),g.aliases.forEach(k=>{gt(k,e);})),exports.TickersManagerStatic.removeTickerTimeoutInfo(h);},n.duration*1e3);exports.TickersManagerStatic.addTickerTimeoutInfo(s,o,h.toString(),false);}}function gt(s,e){let t=exports.TickersManagerStatic._currentTickersSequence.get(s);if(t?.has(e)){let r=t.get(e);r.currentStepNumber+1<r.steps.length?(r.currentStepNumber++,t.set(e,r),We(s,e)):e&&t.has(e)&&(t.delete(e),exports.TickersManagerStatic._currentTickers.forEach((n,o)=>{n.createdByTicketSteps?.canvasElementAlias===s&&n.createdByTicketSteps.id===e&&we(o);}));}}function Mt(s,e){let{stopTicker:t=true,aliasToRemoveAfter:r,tickerAliasToResume:n,tickerIdToResume:o}=e,a=exports.TickersManagerStatic._currentTickers.get(s),l=e.ignoreTickerSteps||false;core.GameUnifier.removeCanvasComponent(r),n.forEach(h=>{Je({canvasAlias:h});}),Je({id:o}),a&&(we(s,{stopTicker:t}),!l&&a.ticker.duration===void 0&&a.createdByTicketSteps&&gt(a.createdByTicketSteps.canvasElementAlias,a.createdByTicketSteps.id));}function Ut(s,e){if(typeof s=="string"&&(s=[s]),!e){s.forEach(r=>{exports.TickersManagerStatic._currentTickers.forEach((n,o)=>{n.ticker.canvasElementAliases.includes(r)&&(n.ticker.canvasElementAliases.length===1?we(o):n.ticker.canvasElementAliases=n.ticker.canvasElementAliases.filter(a=>a!==r));}),exports.TickersManagerStatic._currentTickersSequence.has(r)&&exports.TickersManagerStatic._currentTickersSequence.delete(r),exports.TickersManagerStatic.removeTickerTimeoutsByAlias(r,false);});return}let t;typeof e=="string"?t=e:t=e.prototype.id,s.forEach(r=>{let n=exports.TickersManagerStatic._currentTickersSequence.get(r);n&&n.forEach((o,a)=>{o.steps.find(l=>typeof l=="object"&&"ticker"in l&&l.ticker===t)&&n.delete(a);});}),exports.TickersManagerStatic._currentTickers.forEach(r=>{r.ticker.alias===t&&(r.ticker.canvasElementAliases=r.ticker.canvasElementAliases.filter(n=>!s.includes(n)));}),exports.TickersManagerStatic._currentTickersTimeouts.forEach(r=>{r.ticker===t&&r.canBeDeletedBeforeEnd&&(r.aliases=r.aliases.filter(n=>!s.includes(n)));}),Ht();}function Ht(){exports.TickersManagerStatic._currentTickers.forEach(s=>{s.ticker.canvasElementAliases=s.ticker.canvasElementAliases.filter(e=>core.GameUnifier.canvasComponentExists(e)),s.ticker.canvasElementAliases.length===0&&s.ticker.complete({ignoreTickerSteps:true});}),exports.TickersManagerStatic._currentTickersSequence.forEach((s,e)=>{s===void 0&&exports.TickersManagerStatic._currentTickersSequence.delete(e);}),Array.from(exports.TickersManagerStatic._currentTickersTimeouts.keys()).forEach(s=>{let e=exports.TickersManagerStatic._currentTickersTimeouts.get(s);e&&e.aliases.length===0&&exports.TickersManagerStatic.removeTickerTimeout(s);});}function qt(){exports.TickersManagerStatic._currentTickersSequence.clear(),Array.from(exports.TickersManagerStatic._currentTickers.keys()).forEach(s=>{we(s);}),exports.TickersManagerStatic._currentTickers.clear(),Array.from(exports.TickersManagerStatic._currentTickersTimeouts.keys()).forEach(s=>{exports.TickersManagerStatic.removeTickerTimeout(s);}),exports.TickersManagerStatic._tickersToCompleteOnStepEnd.tikersIds.length=0,exports.TickersManagerStatic._tickersToCompleteOnStepEnd.stepAlias.length=0;}function we(s,e={stopTicker:true}){typeof s=="string"&&(s=[s]),s.forEach(t=>{let r=exports.TickersManagerStatic._currentTickers.get(t);r&&(e.stopTicker&&r.ticker.stop(),exports.TickersManagerStatic._currentTickers.delete(t));});}function Lt(s){let e=[];if("canvasAlias"in s){let{canvasAlias:t,tickerIdsExcluded:r=[]}=s;exports.TickersManagerStatic._currentTickers.forEach((n,o)=>{n.ticker.canvasElementAliases.includes(t)&&!r.includes(n.ticker.alias)&&n.ticker.paused===false&&(n.ticker.pause(),e.push(o));});}else if("id"in s){let{id:t}=s;typeof t=="string"&&(t=[t]),[...new Set(t)].forEach(r=>{let n=exports.TickersManagerStatic._currentTickers.get(r);n?n.ticker.paused===false&&(n.ticker.pause(),e.push(r)):B.error(`Ticker with id ${r} not found`);});}return e}function Je(s){if("canvasAlias"in s){let{canvasAlias:e}=s;exports.TickersManagerStatic._currentTickers.forEach(t=>{t.ticker.canvasElementAliases.includes(e)&&t.ticker.play();});}else if("id"in s){let{id:e}=s;typeof e=="string"&&(e=[e]),[...new Set(e)].forEach(t=>{let r=exports.TickersManagerStatic._currentTickers.get(t);r?r.ticker.play():B.error(`Ticker with id ${t} not found`);});}}function jt(s,e){return false}function Nt(s,e,t="move"){let r=exports.TickersManagerStatic._currentTickersSequence.get(s);if(r){let o=new Map(Array.from(r.entries()).map(([a,l])=>[a,Pe(l)]));exports.TickersManagerStatic._currentTickersSequence.set(e,o);}exports.TickersManagerStatic._currentTickers.forEach((o,a)=>{if(o.createdByTicketSteps?.canvasElementAlias===s&&we(a),o.ticker.canvasElementAliases.includes(s)){let l=_e.getInstance(o.ticker.alias,Pe(o.ticker.args),{duration:o.ticker.duration,priority:o.ticker.priority,canvasElementAliases:[e]});if(l?(pt(e,l),o.ticker.paused&&l.pause()):B.error(`Ticker ${o.ticker.alias} not found`),t==="move"&&(o.ticker.canvasElementAliases=o.ticker.canvasElementAliases.filter(h=>h!==s)),Object.hasOwn(o.ticker.args,ft)){let h=o.ticker.args.aliasToRemoveAfter;typeof h=="string"&&(h=[h]),Array.isArray(h)&&(t==="move"?o.ticker.args.aliasToRemoveAfter=h.map(g=>g===s?e:g):t==="duplicate"&&h.find(g=>g===s)&&(o.ticker.args.aliasToRemoveAfter=[...h,e]));}}}),exports.TickersManagerStatic._currentTickersTimeouts.forEach(o=>{o.aliases.includes(s)&&(t==="move"?o.aliases=o.aliases.map(a=>a===s?e:a):t==="duplicate"&&o.aliases.find(a=>a===s)&&o.aliases.push(e));});let n=exports.TickersManagerStatic._currentTickersSequence.get(e);if(n&&n.forEach((o,a)=>{We(e,a);}),t==="duplicate"){let o=exports.TickersManagerStatic._currentTickersSequence.get(s);o&&o.forEach((a,l)=>{We(s,l);});}}function Gt(s){s.alias?exports.TickersManagerStatic._tickersToCompleteOnStepEnd.stepAlias.push({id:s.id,alias:s.alias}):exports.TickersManagerStatic._tickersToCompleteOnStepEnd.tikersIds.push({id:s.id});}async function Vt(s,e){if(e){let t=exports.TickersManagerStatic._currentTickersSequence.get(e),r=t?.get(s);if(t&&r){let n=r.steps.map(o=>{if(typeof o=="object"&&"ticker"in o){let a=_e.getInstance(o.ticker,o.args,{duration:o.duration,canvasElementAliases:[e],priority:o.priority});if(a)return a.complete()}return Promise.resolve()});await Promise.all(n);}}else {let t=exports.TickersManagerStatic._currentTickers.get(s);t&&await t.ticker.complete();}}function wi(){let s=exports.TickersManagerStatic._tickersToCompleteOnStepEnd.tikersIds.splice(0,exports.TickersManagerStatic._tickersToCompleteOnStepEnd.tikersIds.length),e=exports.TickersManagerStatic._tickersToCompleteOnStepEnd.stepAlias.splice(0,exports.TickersManagerStatic._tickersToCompleteOnStepEnd.stepAlias.length);return {tikersIds:s,stepAlias:e}}var Ai={transfer:Nt,get currentTickers(){return exports.TickersManagerStatic._currentTickers},get currentTickersSteps(){return exports.TickersManagerStatic._currentTickersSequence},find:Pt,add:pt,addSequence:Wt,unlinkComponent:Ut,removeAll:qt,remove:we,pause:Lt,resume:Je,isPaused:jt,completeOnStepEnd:Gt,forceCompletion:Vt,onComplete:Mt};exports.RegisteredTickers=_e;exports.TickerBase=Ie;exports.buildGlitchJitter=Rt;exports.circleOverhang=It;exports.drainCompleteOnStepEndQueue=wi;exports.filterAreaCenter=Ct;exports.removeTicker=we;exports.runTickersSequence=We;exports.shockwaveTravel=Ft;exports.tickerDecorator=Ot;exports.tickers=Ai;exports.zoomBlurPadding=zt;
@@ -485,6 +485,76 @@ type CommonTickerProps = {
485
485
  completeOnContinue?: boolean;
486
486
  };
487
487
 
488
+ /**
489
+ * Keyframe/geometry helpers shared by the filter-based `effects` (`canvas-effect.ts`) and
490
+ * `transitions` (`canvas-transition.ts`). Kept in their own module because `canvas-effect.ts` already
491
+ * imports from `canvas-transition.ts`, so the reverse import would be circular.
492
+ */
493
+ /**
494
+ * Builds a jittery `[0, a, -0.6a, 0.3a, 0, ...]` glitch envelope: each burst snaps to `a`, kicks back
495
+ * the other way, twitches and settles, with `a` shrinking by `decay` per burst. The sign flips reverse
496
+ * the slice displacement mid-burst, which reads as a glitch rather than a smooth slide.
497
+ */
498
+ declare function buildGlitchJitter(peak: number, decay: number, bursts: number): number[];
499
+ interface Rect {
500
+ x: number;
501
+ y: number;
502
+ width: number;
503
+ height: number;
504
+ }
505
+ /**
506
+ * Where an `origin` normalized (0-1) to the component's bounds lands, in pixels, inside the area
507
+ * PixiJS renders the component's filters into - the coordinates `ShockwaveFilter`/`ZoomBlurFilter`
508
+ * (`center`) and `TwistFilter` (`offset`) expect. Mirrors `FilterSystem._calculateFilterBounds`: the
509
+ * component's global bounds, clipped to the viewport, then grown on every side by the **sum** of every
510
+ * enabled filter's `padding`. Call it once all of the effect's filters are attached; it's a snapshot,
511
+ * so adding/removing padded filters later shifts the area.
512
+ */
513
+ declare function filterAreaCenter(bounds: Rect, origin: {
514
+ x: number;
515
+ y: number;
516
+ }, filters: readonly {
517
+ padding: number;
518
+ enabled: boolean;
519
+ }[], viewport?: {
520
+ width: number;
521
+ height: number;
522
+ }): {
523
+ x: number;
524
+ y: number;
525
+ area: Rect;
526
+ };
527
+ /**
528
+ * How far (pixels) content can be pushed past the component's own bounds by a deformation confined to
529
+ * a circle of `radius` around `center` (twist, bulge): the circle's overhang beyond the bounds.
530
+ */
531
+ declare function circleOverhang(center: {
532
+ x: number;
533
+ y: number;
534
+ }, radius: number, width: number, height: number): number;
535
+ /**
536
+ * Padding a `ZoomBlurFilter` needs for its streaks to extend past the component instead of being cut:
537
+ * a pixel at distance `d` from the center samples back to `d * (1 - strength)`, so content at distance
538
+ * `D` reaches `D / (1 - strength)`. `strength` is capped at 0.5 (padding at most `D`) - the outermost
539
+ * streaks are faint anyway.
540
+ */
541
+ declare function zoomBlurPadding(center: {
542
+ x: number;
543
+ y: number;
544
+ }, strength: number, width: number, height: number): number;
545
+ /**
546
+ * How far (pixels) a `ShockwaveFilter` ring has to travel to fully leave the component: from `center`
547
+ * to the farthest corner of `bounds`, plus half a `wavelength` - or just `radius` when the ring is
548
+ * capped (`radius > 0`).
549
+ */
550
+ declare function shockwaveTravel(center: {
551
+ x: number;
552
+ y: number;
553
+ }, bounds: {
554
+ width: number;
555
+ height: number;
556
+ }, wavelength: number, radius: number): number;
557
+
488
558
  /**
489
559
  * Static, module-scoped ticker bookkeeping - moved out of `CanvasManagerStatic` (formerly
490
560
  * `CanvasManagerStatic`'s "Edit Tickers Methods" section) so the `tickers` module can own its own
@@ -552,4 +622,4 @@ declare function drainCompleteOnStepEndQueue(): {
552
622
  */
553
623
  declare const tickers: TickersInterface;
554
624
 
555
- export { type CommonTickerProps, RegisteredTickers, type Ticker, type TickerArgs, TickerBase, type TickerHistory, type TickerInfo, type TickerProgrationExponential, type TickerProgrationLinear, type TickerProgrationType, type TickerTimeoutHistory, type TickerValue, type TickersInterface, TickersManagerStatic, type TickersSequence, drainCompleteOnStepEndQueue, removeTicker, runTickersSequence, tickerDecorator, tickers };
625
+ export { type CommonTickerProps, RegisteredTickers, type Ticker, type TickerArgs, TickerBase, type TickerHistory, type TickerInfo, type TickerProgrationExponential, type TickerProgrationLinear, type TickerProgrationType, type TickerTimeoutHistory, type TickerValue, type TickersInterface, TickersManagerStatic, type TickersSequence, buildGlitchJitter, circleOverhang, drainCompleteOnStepEndQueue, filterAreaCenter, removeTicker, runTickersSequence, shockwaveTravel, tickerDecorator, tickers, zoomBlurPadding };
package/dist/tickers.d.ts CHANGED
@@ -485,6 +485,76 @@ type CommonTickerProps = {
485
485
  completeOnContinue?: boolean;
486
486
  };
487
487
 
488
+ /**
489
+ * Keyframe/geometry helpers shared by the filter-based `effects` (`canvas-effect.ts`) and
490
+ * `transitions` (`canvas-transition.ts`). Kept in their own module because `canvas-effect.ts` already
491
+ * imports from `canvas-transition.ts`, so the reverse import would be circular.
492
+ */
493
+ /**
494
+ * Builds a jittery `[0, a, -0.6a, 0.3a, 0, ...]` glitch envelope: each burst snaps to `a`, kicks back
495
+ * the other way, twitches and settles, with `a` shrinking by `decay` per burst. The sign flips reverse
496
+ * the slice displacement mid-burst, which reads as a glitch rather than a smooth slide.
497
+ */
498
+ declare function buildGlitchJitter(peak: number, decay: number, bursts: number): number[];
499
+ interface Rect {
500
+ x: number;
501
+ y: number;
502
+ width: number;
503
+ height: number;
504
+ }
505
+ /**
506
+ * Where an `origin` normalized (0-1) to the component's bounds lands, in pixels, inside the area
507
+ * PixiJS renders the component's filters into - the coordinates `ShockwaveFilter`/`ZoomBlurFilter`
508
+ * (`center`) and `TwistFilter` (`offset`) expect. Mirrors `FilterSystem._calculateFilterBounds`: the
509
+ * component's global bounds, clipped to the viewport, then grown on every side by the **sum** of every
510
+ * enabled filter's `padding`. Call it once all of the effect's filters are attached; it's a snapshot,
511
+ * so adding/removing padded filters later shifts the area.
512
+ */
513
+ declare function filterAreaCenter(bounds: Rect, origin: {
514
+ x: number;
515
+ y: number;
516
+ }, filters: readonly {
517
+ padding: number;
518
+ enabled: boolean;
519
+ }[], viewport?: {
520
+ width: number;
521
+ height: number;
522
+ }): {
523
+ x: number;
524
+ y: number;
525
+ area: Rect;
526
+ };
527
+ /**
528
+ * How far (pixels) content can be pushed past the component's own bounds by a deformation confined to
529
+ * a circle of `radius` around `center` (twist, bulge): the circle's overhang beyond the bounds.
530
+ */
531
+ declare function circleOverhang(center: {
532
+ x: number;
533
+ y: number;
534
+ }, radius: number, width: number, height: number): number;
535
+ /**
536
+ * Padding a `ZoomBlurFilter` needs for its streaks to extend past the component instead of being cut:
537
+ * a pixel at distance `d` from the center samples back to `d * (1 - strength)`, so content at distance
538
+ * `D` reaches `D / (1 - strength)`. `strength` is capped at 0.5 (padding at most `D`) - the outermost
539
+ * streaks are faint anyway.
540
+ */
541
+ declare function zoomBlurPadding(center: {
542
+ x: number;
543
+ y: number;
544
+ }, strength: number, width: number, height: number): number;
545
+ /**
546
+ * How far (pixels) a `ShockwaveFilter` ring has to travel to fully leave the component: from `center`
547
+ * to the farthest corner of `bounds`, plus half a `wavelength` - or just `radius` when the ring is
548
+ * capped (`radius > 0`).
549
+ */
550
+ declare function shockwaveTravel(center: {
551
+ x: number;
552
+ y: number;
553
+ }, bounds: {
554
+ width: number;
555
+ height: number;
556
+ }, wavelength: number, radius: number): number;
557
+
488
558
  /**
489
559
  * Static, module-scoped ticker bookkeeping - moved out of `CanvasManagerStatic` (formerly
490
560
  * `CanvasManagerStatic`'s "Edit Tickers Methods" section) so the `tickers` module can own its own
@@ -552,4 +622,4 @@ declare function drainCompleteOnStepEndQueue(): {
552
622
  */
553
623
  declare const tickers: TickersInterface;
554
624
 
555
- export { type CommonTickerProps, RegisteredTickers, type Ticker, type TickerArgs, TickerBase, type TickerHistory, type TickerInfo, type TickerProgrationExponential, type TickerProgrationLinear, type TickerProgrationType, type TickerTimeoutHistory, type TickerValue, type TickersInterface, TickersManagerStatic, type TickersSequence, drainCompleteOnStepEndQueue, removeTicker, runTickersSequence, tickerDecorator, tickers };
625
+ export { type CommonTickerProps, RegisteredTickers, type Ticker, type TickerArgs, TickerBase, type TickerHistory, type TickerInfo, type TickerProgrationExponential, type TickerProgrationLinear, type TickerProgrationType, type TickerTimeoutHistory, type TickerValue, type TickersInterface, TickersManagerStatic, type TickersSequence, buildGlitchJitter, circleOverhang, drainCompleteOnStepEndQueue, filterAreaCenter, removeTicker, runTickersSequence, shockwaveTravel, tickerDecorator, tickers, zoomBlurPadding };
package/dist/tickers.mjs CHANGED
@@ -1 +1 @@
1
- import {a}from'./chunk-5MVDNAT4.mjs';import {a as a$1}from'./chunk-S7HZUIEI.mjs';import {c,d as d$1,e}from'./chunk-AW5XWF24.mjs';import {PixiError,GameUnifier}from'@drincs/pixi-vn/core';import N from'@drincs/pixi-vn/pixi.js';var O=c(a(),1);var E=class{constructor(r,t){this.alias=this.constructor.prototype.id;let{duration:s,priority:c,id:n=this.generateTickerId(this.alias,t),canvasElementAliases:o=[]}=t||{};this.args=r,this.duration=s,this.priority=c,this.id=n,this.canvasElementAliases=o;}alias;id;args;duration;priority;ticker=new N.Ticker;canvasElementAliases=[];generateTickerId(...r){try{return (0,O.default)(JSON.stringify(r)).toString()+"_"+Math.random().toString(36).substring(7)}catch(t){throw new PixiError("not_json_serializable",`Error to generate ticker id: ${t}`)}}fnValue;complete(r){this.stop();}stop(){let r=this.fnValue;if(!r){e.warn("TickerBase.stop() called without fnValue set. This may cause issues.");return}this.ticker.remove(r,null);}start(){let r=this.id,t=()=>this.fn(this.ticker,this.args,this.canvasElementAliases,r);this.fnValue=t,this.ticker.add(t,null,this.priority),this.ticker.start();}pause(){this.ticker.stop();}play(){this.ticker.start();}get paused(){return !this.ticker.started}};var m=new d$1({cacheSize:5});function j(e){return function(r){I.add(r,e);}}var I;(o=>{function e$1(a,u){u||(u=a.name),m.get(u)&&e.info(`Ticker "${u}" already exists, it will be overwritten`),a.prototype.id=u,m.set(u,a);}o.add=e$1;function r(a){try{let u=m.get(a);if(!u){e.error(`Event "${a}" not found, did you forget to register it with the tickerDecorator?`);return}return u}catch(u){e.error(`Error while getting Event "${a}"`,u);return}}o.get=r;function t(a,u,T){try{let g=m.get(a);if(!g){e.error(`Ticker "${a}" not found, did you forget to register it with the tickerDecorator?`);return}return new g(u,T)}catch(g){e.error(`Error while getting Ticker "${a}"`,g);return}}o.getInstance=t;function s(){return Array.from(m.values())}o.values=s;function c(a){return m.has(a)}o.has=c;function n(){return Array.from(m.keys())}o.keys=n;})(I||={});var d=I;var w=c(a(),1);var i;(l=>{function e(){return Object.fromEntries(Array.from(l._currentTickers.entries()).filter(([k,f])=>!f.createdByTicketSteps).map(([k,f])=>[k,{id:f.ticker.alias,args:f.ticker.args,canvasElementAliases:f.ticker.canvasElementAliases,priority:f.ticker.priority,duration:f.ticker.duration,paused:f.ticker.paused}]))}l.currentTickersWithoutCreatedBySteps=e,l._currentTickers=new Map,l._currentTickersSequence=new Map;function s(){return Object.fromEntries(Array.from(l._currentTickersSequence.entries()).map(([k,f])=>[k,Object.fromEntries(f)]))}l.currentTickersSequence=s,l._currentTickersTimeouts=new Map,l._tickersToCompleteOnStepEnd={tikersIds:[],stepAlias:[]};function o(...k){try{return `${(0,w.default)(JSON.stringify(k)).toString()}_${Math.random().toString(36).substring(7)}`}catch(f){throw new PixiError("not_json_serializable",`Error to generate ticker id: ${f}`)}}l.generateTickerId=o;function a(k,f,A,v){typeof k=="string"&&(k=[k]),l._currentTickersTimeouts.set(A,{aliases:k,ticker:f,canBeDeletedBeforeEnd:v});}l.addTickerTimeoutInfo=a;function u(k){typeof k!="string"&&(k=k.toString()),l._currentTickersTimeouts.delete(k);}l.removeTickerTimeoutInfo=u;function T(k){typeof k!="string"&&(k=k.toString()),clearTimeout(Number(k)),u(k);}l.removeTickerTimeout=T;function g(k,f){l._currentTickersTimeouts.forEach((A,v)=>{let R=A.aliases.filter(_=>_!==k);if(R.length===0){let _=A.canBeDeletedBeforeEnd;(!f||_)&&T(v);}else A.aliases=R;});}l.removeTickerTimeoutsByAlias=g;})(i||={});var C="aliasToRemoveAfter";function U(e){let r=i._currentTickers.get(e);if(r)return r.ticker}function D(e$1,r){let t=r.id,s=r.alias;if(typeof e$1=="string"&&(e$1=[e$1]),r.canvasElementAliases=e$1,!d.has(s)){e.error(`Ticker ${s} not found`);return}let c={ticker:r};if(i._currentTickers.set(t,c),c.ticker.start(),r.duration){let n=setTimeout(()=>{i.removeTickerTimeoutInfo(n),i._currentTickersTimeouts.get(n.toString())&&c.ticker.complete({ignoreTickerSteps:true});},r.duration*1e3);i.addTickerTimeoutInfo(e$1,s,n.toString(),true);}return t}function Y(e$1,r,t=0){if(r.length===0){e.warn("The steps of the tickers is empty");return}i._currentTickersSequence.has(e$1)||i._currentTickersSequence.set(e$1,new Map);let s={currentStepNumber:t,steps:r.map(n=>({ticker:n.alias,args:a$1(n.args),duration:n.duration}))},c=i.generateTickerId(s);return i._currentTickersSequence.get(e$1)?.set(c,s),S(e$1,c),c}function S(e$1,r){let t=i._currentTickersSequence.get(e$1);if(!t?.has(r))return;let s=t.get(r).steps[t.get(r).currentStepNumber],c=d.getInstance(s.ticker,s.args,{canvasElementAliases:[e$1],duration:s.duration,priority:s.priority});if(!c){e.error(`Ticker ${s.ticker} not found`);return}let n=c.alias,o=c.id;c.canvasElementAliases=[e$1];let a={createdByTicketSteps:{canvasElementAlias:e$1,id:r},ticker:c};if(i._currentTickers.set(o,a),a.ticker.start(),c.duration){let u=setTimeout(()=>{let T=i._currentTickersTimeouts.get(u.toString());T&&(a.ticker.complete({ignoreTickerSteps:true}),T.aliases.forEach(g=>{$(g,r);})),i.removeTickerTimeoutInfo(u);},c.duration*1e3);i.addTickerTimeoutInfo(e$1,n,u.toString(),false);}}function $(e,r){let t=i._currentTickersSequence.get(e);if(t?.has(r)){let s=t.get(r);s.currentStepNumber+1<s.steps.length?(s.currentStepNumber++,t.set(r,s),S(e,r)):r&&t.has(r)&&(t.delete(r),i._currentTickers.forEach((c,n)=>{c.createdByTicketSteps?.canvasElementAlias===e&&c.createdByTicketSteps.id===r&&y(n);}));}}function M(e,r){let{stopTicker:t=true,aliasToRemoveAfter:s,tickerAliasToResume:c,tickerIdToResume:n}=r,o=i._currentTickers.get(e),a=r.ignoreTickerSteps||false;GameUnifier.removeCanvasComponent(s),c.forEach(u=>{x({canvasAlias:u});}),x({id:n}),o&&(y(e,{stopTicker:t}),!a&&o.ticker.duration===void 0&&o.createdByTicketSteps&&$(o.createdByTicketSteps.canvasElementAlias,o.createdByTicketSteps.id));}function J(e,r){if(typeof e=="string"&&(e=[e]),!r){e.forEach(s=>{i._currentTickers.forEach((c,n)=>{c.ticker.canvasElementAliases.includes(s)&&(c.ticker.canvasElementAliases.length===1?y(n):c.ticker.canvasElementAliases=c.ticker.canvasElementAliases.filter(o=>o!==s));}),i._currentTickersSequence.has(s)&&i._currentTickersSequence.delete(s),i.removeTickerTimeoutsByAlias(s,false);});return}let t;typeof r=="string"?t=r:t=r.prototype.id,e.forEach(s=>{let c=i._currentTickersSequence.get(s);c&&c.forEach((n,o)=>{n.steps.find(a=>typeof a=="object"&&"ticker"in a&&a.ticker===t)&&c.delete(o);});}),i._currentTickers.forEach(s=>{s.ticker.alias===t&&(s.ticker.canvasElementAliases=s.ticker.canvasElementAliases.filter(c=>!e.includes(c)));}),i._currentTickersTimeouts.forEach(s=>{s.ticker===t&&s.canBeDeletedBeforeEnd&&(s.aliases=s.aliases.filter(c=>!e.includes(c)));}),z();}function z(){i._currentTickers.forEach(e=>{e.ticker.canvasElementAliases=e.ticker.canvasElementAliases.filter(r=>GameUnifier.canvasComponentExists(r)),e.ticker.canvasElementAliases.length===0&&e.ticker.complete({ignoreTickerSteps:true});}),i._currentTickersSequence.forEach((e,r)=>{e===void 0&&i._currentTickersSequence.delete(r);}),Array.from(i._currentTickersTimeouts.keys()).forEach(e=>{let r=i._currentTickersTimeouts.get(e);r&&r.aliases.length===0&&i.removeTickerTimeout(e);});}function W(){i._currentTickersSequence.clear(),Array.from(i._currentTickers.keys()).forEach(e=>{y(e);}),i._currentTickers.clear(),Array.from(i._currentTickersTimeouts.keys()).forEach(e=>{i.removeTickerTimeout(e);}),i._tickersToCompleteOnStepEnd.tikersIds.length=0,i._tickersToCompleteOnStepEnd.stepAlias.length=0;}function y(e,r={stopTicker:true}){typeof e=="string"&&(e=[e]),e.forEach(t=>{let s=i._currentTickers.get(t);s&&(r.stopTicker&&s.ticker.stop(),i._currentTickers.delete(t));});}function F(e$1){let r=[];if("canvasAlias"in e$1){let{canvasAlias:t,tickerIdsExcluded:s=[]}=e$1;i._currentTickers.forEach((c,n)=>{c.ticker.canvasElementAliases.includes(t)&&!s.includes(c.ticker.alias)&&c.ticker.paused===false&&(c.ticker.pause(),r.push(n));});}else if("id"in e$1){let{id:t}=e$1;typeof t=="string"&&(t=[t]),[...new Set(t)].forEach(s=>{let c=i._currentTickers.get(s);c?c.ticker.paused===false&&(c.ticker.pause(),r.push(s)):e.error(`Ticker with id ${s} not found`);});}return r}function x(e$1){if("canvasAlias"in e$1){let{canvasAlias:r}=e$1;i._currentTickers.forEach(t=>{t.ticker.canvasElementAliases.includes(r)&&t.ticker.play();});}else if("id"in e$1){let{id:r}=e$1;typeof r=="string"&&(r=[r]),[...new Set(r)].forEach(t=>{let s=i._currentTickers.get(t);s?s.ticker.play():e.error(`Ticker with id ${t} not found`);});}}function G(e,r){return false}function L(e$1,r,t="move"){let s=i._currentTickersSequence.get(e$1);if(s){let n=new Map(Array.from(s.entries()).map(([o,a])=>[o,a$1(a)]));i._currentTickersSequence.set(r,n);}i._currentTickers.forEach((n,o)=>{if(n.createdByTicketSteps?.canvasElementAlias===e$1&&y(o),n.ticker.canvasElementAliases.includes(e$1)){let a=d.getInstance(n.ticker.alias,a$1(n.ticker.args),{duration:n.ticker.duration,priority:n.ticker.priority,canvasElementAliases:[r]});if(a?(D(r,a),n.ticker.paused&&a.pause()):e.error(`Ticker ${n.ticker.alias} not found`),t==="move"&&(n.ticker.canvasElementAliases=n.ticker.canvasElementAliases.filter(u=>u!==e$1)),Object.hasOwn(n.ticker.args,C)){let u=n.ticker.args.aliasToRemoveAfter;typeof u=="string"&&(u=[u]),Array.isArray(u)&&(t==="move"?n.ticker.args.aliasToRemoveAfter=u.map(T=>T===e$1?r:T):t==="duplicate"&&u.find(T=>T===e$1)&&(n.ticker.args.aliasToRemoveAfter=[...u,r]));}}}),i._currentTickersTimeouts.forEach(n=>{n.aliases.includes(e$1)&&(t==="move"?n.aliases=n.aliases.map(o=>o===e$1?r:o):t==="duplicate"&&n.aliases.find(o=>o===e$1)&&n.aliases.push(r));});let c=i._currentTickersSequence.get(r);if(c&&c.forEach((n,o)=>{S(r,o);}),t==="duplicate"){let n=i._currentTickersSequence.get(e$1);n&&n.forEach((o,a)=>{S(e$1,a);});}}function Q(e){e.alias?i._tickersToCompleteOnStepEnd.stepAlias.push({id:e.id,alias:e.alias}):i._tickersToCompleteOnStepEnd.tikersIds.push({id:e.id});}async function X(e,r){if(r){let t=i._currentTickersSequence.get(r),s=t?.get(e);if(t&&s){let c=s.steps.map(n=>{if(typeof n=="object"&&"ticker"in n){let o=d.getInstance(n.ticker,n.args,{duration:n.duration,canvasElementAliases:[r],priority:n.priority});if(o)return o.complete()}return Promise.resolve()});await Promise.all(c);}}else {let t=i._currentTickers.get(e);t&&await t.ticker.complete();}}function le(){let e=i._tickersToCompleteOnStepEnd.tikersIds.splice(0,i._tickersToCompleteOnStepEnd.tikersIds.length),r=i._tickersToCompleteOnStepEnd.stepAlias.splice(0,i._tickersToCompleteOnStepEnd.stepAlias.length);return {tikersIds:e,stepAlias:r}}var ge={transfer:L,get currentTickers(){return i._currentTickers},get currentTickersSteps(){return i._currentTickersSequence},find:U,add:D,addSequence:Y,unlinkComponent:J,removeAll:W,remove:y,pause:F,resume:x,isPaused:G,completeOnStepEnd:Q,forceCompletion:X,onComplete:M};export{d as RegisteredTickers,E as TickerBase,i as TickersManagerStatic,le as drainCompleteOnStepEndQueue,y as removeTicker,S as runTickersSequence,j as tickerDecorator,ge as tickers};
1
+ import {a}from'./chunk-5MVDNAT4.mjs';export{a as buildGlitchJitter,c as circleOverhang,b as filterAreaCenter,e as shockwaveTravel,d as zoomBlurPadding}from'./chunk-XLRCR56W.mjs';import {a as a$1}from'./chunk-S7HZUIEI.mjs';import {c,d as d$1,e}from'./chunk-AW5XWF24.mjs';import {PixiError,GameUnifier}from'@drincs/pixi-vn/core';import M from'@drincs/pixi-vn/pixi.js';var O=c(a(),1);var E=class{constructor(r,t){this.alias=this.constructor.prototype.id;let{duration:s,priority:c,id:n=this.generateTickerId(this.alias,t),canvasElementAliases:o=[]}=t||{};this.args=r,this.duration=s,this.priority=c,this.id=n,this.canvasElementAliases=o;}alias;id;args;duration;priority;ticker=new M.Ticker;canvasElementAliases=[];generateTickerId(...r){try{return (0,O.default)(JSON.stringify(r)).toString()+"_"+Math.random().toString(36).substring(7)}catch(t){throw new PixiError("not_json_serializable",`Error to generate ticker id: ${t}`)}}fnValue;complete(r){this.stop();}stop(){let r=this.fnValue;if(!r){e.warn("TickerBase.stop() called without fnValue set. This may cause issues.");return}this.ticker.remove(r,null);}start(){let r=this.id,t=()=>this.fn(this.ticker,this.args,this.canvasElementAliases,r);this.fnValue=t,this.ticker.add(t,null,this.priority),this.ticker.start();}pause(){this.ticker.stop();}play(){this.ticker.start();}get paused(){return !this.ticker.started}};var m=new d$1({cacheSize:5});function J(e){return function(r){I.add(r,e);}}var I;(o=>{function e$1(a,u){u||(u=a.name),m.get(u)&&e.info(`Ticker "${u}" already exists, it will be overwritten`),a.prototype.id=u,m.set(u,a);}o.add=e$1;function r(a){try{let u=m.get(a);if(!u){e.error(`Event "${a}" not found, did you forget to register it with the tickerDecorator?`);return}return u}catch(u){e.error(`Error while getting Event "${a}"`,u);return}}o.get=r;function t(a,u,T){try{let g=m.get(a);if(!g){e.error(`Ticker "${a}" not found, did you forget to register it with the tickerDecorator?`);return}return new g(u,T)}catch(g){e.error(`Error while getting Ticker "${a}"`,g);return}}o.getInstance=t;function s(){return Array.from(m.values())}o.values=s;function c(a){return m.has(a)}o.has=c;function n(){return Array.from(m.keys())}o.keys=n;})(I||={});var d=I;var w=c(a(),1);var i;(l=>{function e(){return Object.fromEntries(Array.from(l._currentTickers.entries()).filter(([k,f])=>!f.createdByTicketSteps).map(([k,f])=>[k,{id:f.ticker.alias,args:f.ticker.args,canvasElementAliases:f.ticker.canvasElementAliases,priority:f.ticker.priority,duration:f.ticker.duration,paused:f.ticker.paused}]))}l.currentTickersWithoutCreatedBySteps=e,l._currentTickers=new Map,l._currentTickersSequence=new Map;function s(){return Object.fromEntries(Array.from(l._currentTickersSequence.entries()).map(([k,f])=>[k,Object.fromEntries(f)]))}l.currentTickersSequence=s,l._currentTickersTimeouts=new Map,l._tickersToCompleteOnStepEnd={tikersIds:[],stepAlias:[]};function o(...k){try{return `${(0,w.default)(JSON.stringify(k)).toString()}_${Math.random().toString(36).substring(7)}`}catch(f){throw new PixiError("not_json_serializable",`Error to generate ticker id: ${f}`)}}l.generateTickerId=o;function a(k,f,h,v){typeof k=="string"&&(k=[k]),l._currentTickersTimeouts.set(h,{aliases:k,ticker:f,canBeDeletedBeforeEnd:v});}l.addTickerTimeoutInfo=a;function u(k){typeof k!="string"&&(k=k.toString()),l._currentTickersTimeouts.delete(k);}l.removeTickerTimeoutInfo=u;function T(k){typeof k!="string"&&(k=k.toString()),clearTimeout(Number(k)),u(k);}l.removeTickerTimeout=T;function g(k,f){l._currentTickersTimeouts.forEach((h,v)=>{let b=h.aliases.filter(_=>_!==k);if(b.length===0){let _=h.canBeDeletedBeforeEnd;(!f||_)&&T(v);}else h.aliases=b;});}l.removeTickerTimeoutsByAlias=g;})(i||={});var C="aliasToRemoveAfter";function W(e){let r=i._currentTickers.get(e);if(r)return r.ticker}function D(e$1,r){let t=r.id,s=r.alias;if(typeof e$1=="string"&&(e$1=[e$1]),r.canvasElementAliases=e$1,!d.has(s)){e.error(`Ticker ${s} not found`);return}let c={ticker:r};if(i._currentTickers.set(t,c),c.ticker.start(),r.duration){let n=setTimeout(()=>{i._currentTickersTimeouts.get(n.toString())&&(i.removeTickerTimeout(n),i._currentTickers.get(t)===c&&c.ticker.complete({ignoreTickerSteps:true}));},r.duration*1e3);i.addTickerTimeoutInfo(e$1,s,n.toString(),true);}return t}function G(e$1,r,t=0){if(r.length===0){e.warn("The steps of the tickers is empty");return}i._currentTickersSequence.has(e$1)||i._currentTickersSequence.set(e$1,new Map);let s={currentStepNumber:t,steps:r.map(n=>({ticker:n.alias,args:a$1(n.args),duration:n.duration}))},c=i.generateTickerId(s);return i._currentTickersSequence.get(e$1)?.set(c,s),S(e$1,c),c}function S(e$1,r){let t=i._currentTickersSequence.get(e$1);if(!t?.has(r))return;let s=t.get(r).steps[t.get(r).currentStepNumber],c=d.getInstance(s.ticker,s.args,{canvasElementAliases:[e$1],duration:s.duration,priority:s.priority});if(!c){e.error(`Ticker ${s.ticker} not found`);return}let n=c.alias,o=c.id;c.canvasElementAliases=[e$1];let a={createdByTicketSteps:{canvasElementAlias:e$1,id:r},ticker:c};if(i._currentTickers.set(o,a),a.ticker.start(),c.duration){let u=setTimeout(()=>{let T=i._currentTickersTimeouts.get(u.toString());T&&(a.ticker.complete({ignoreTickerSteps:true}),T.aliases.forEach(g=>{$(g,r);})),i.removeTickerTimeoutInfo(u);},c.duration*1e3);i.addTickerTimeoutInfo(e$1,n,u.toString(),false);}}function $(e,r){let t=i._currentTickersSequence.get(e);if(t?.has(r)){let s=t.get(r);s.currentStepNumber+1<s.steps.length?(s.currentStepNumber++,t.set(r,s),S(e,r)):r&&t.has(r)&&(t.delete(r),i._currentTickers.forEach((c,n)=>{c.createdByTicketSteps?.canvasElementAlias===e&&c.createdByTicketSteps.id===r&&y(n);}));}}function F(e,r){let{stopTicker:t=true,aliasToRemoveAfter:s,tickerAliasToResume:c,tickerIdToResume:n}=r,o=i._currentTickers.get(e),a=r.ignoreTickerSteps||false;GameUnifier.removeCanvasComponent(s),c.forEach(u=>{x({canvasAlias:u});}),x({id:n}),o&&(y(e,{stopTicker:t}),!a&&o.ticker.duration===void 0&&o.createdByTicketSteps&&$(o.createdByTicketSteps.canvasElementAlias,o.createdByTicketSteps.id));}function L(e,r){if(typeof e=="string"&&(e=[e]),!r){e.forEach(s=>{i._currentTickers.forEach((c,n)=>{c.ticker.canvasElementAliases.includes(s)&&(c.ticker.canvasElementAliases.length===1?y(n):c.ticker.canvasElementAliases=c.ticker.canvasElementAliases.filter(o=>o!==s));}),i._currentTickersSequence.has(s)&&i._currentTickersSequence.delete(s),i.removeTickerTimeoutsByAlias(s,false);});return}let t;typeof r=="string"?t=r:t=r.prototype.id,e.forEach(s=>{let c=i._currentTickersSequence.get(s);c&&c.forEach((n,o)=>{n.steps.find(a=>typeof a=="object"&&"ticker"in a&&a.ticker===t)&&c.delete(o);});}),i._currentTickers.forEach(s=>{s.ticker.alias===t&&(s.ticker.canvasElementAliases=s.ticker.canvasElementAliases.filter(c=>!e.includes(c)));}),i._currentTickersTimeouts.forEach(s=>{s.ticker===t&&s.canBeDeletedBeforeEnd&&(s.aliases=s.aliases.filter(c=>!e.includes(c)));}),Q();}function Q(){i._currentTickers.forEach(e=>{e.ticker.canvasElementAliases=e.ticker.canvasElementAliases.filter(r=>GameUnifier.canvasComponentExists(r)),e.ticker.canvasElementAliases.length===0&&e.ticker.complete({ignoreTickerSteps:true});}),i._currentTickersSequence.forEach((e,r)=>{e===void 0&&i._currentTickersSequence.delete(r);}),Array.from(i._currentTickersTimeouts.keys()).forEach(e=>{let r=i._currentTickersTimeouts.get(e);r&&r.aliases.length===0&&i.removeTickerTimeout(e);});}function X(){i._currentTickersSequence.clear(),Array.from(i._currentTickers.keys()).forEach(e=>{y(e);}),i._currentTickers.clear(),Array.from(i._currentTickersTimeouts.keys()).forEach(e=>{i.removeTickerTimeout(e);}),i._tickersToCompleteOnStepEnd.tikersIds.length=0,i._tickersToCompleteOnStepEnd.stepAlias.length=0;}function y(e,r={stopTicker:true}){typeof e=="string"&&(e=[e]),e.forEach(t=>{let s=i._currentTickers.get(t);s&&(r.stopTicker&&s.ticker.stop(),i._currentTickers.delete(t));});}function K(e$1){let r=[];if("canvasAlias"in e$1){let{canvasAlias:t,tickerIdsExcluded:s=[]}=e$1;i._currentTickers.forEach((c,n)=>{c.ticker.canvasElementAliases.includes(t)&&!s.includes(c.ticker.alias)&&c.ticker.paused===false&&(c.ticker.pause(),r.push(n));});}else if("id"in e$1){let{id:t}=e$1;typeof t=="string"&&(t=[t]),[...new Set(t)].forEach(s=>{let c=i._currentTickers.get(s);c?c.ticker.paused===false&&(c.ticker.pause(),r.push(s)):e.error(`Ticker with id ${s} not found`);});}return r}function x(e$1){if("canvasAlias"in e$1){let{canvasAlias:r}=e$1;i._currentTickers.forEach(t=>{t.ticker.canvasElementAliases.includes(r)&&t.ticker.play();});}else if("id"in e$1){let{id:r}=e$1;typeof r=="string"&&(r=[r]),[...new Set(r)].forEach(t=>{let s=i._currentTickers.get(t);s?s.ticker.play():e.error(`Ticker with id ${t} not found`);});}}function Z(e,r){return false}function ee(e$1,r,t="move"){let s=i._currentTickersSequence.get(e$1);if(s){let n=new Map(Array.from(s.entries()).map(([o,a])=>[o,a$1(a)]));i._currentTickersSequence.set(r,n);}i._currentTickers.forEach((n,o)=>{if(n.createdByTicketSteps?.canvasElementAlias===e$1&&y(o),n.ticker.canvasElementAliases.includes(e$1)){let a=d.getInstance(n.ticker.alias,a$1(n.ticker.args),{duration:n.ticker.duration,priority:n.ticker.priority,canvasElementAliases:[r]});if(a?(D(r,a),n.ticker.paused&&a.pause()):e.error(`Ticker ${n.ticker.alias} not found`),t==="move"&&(n.ticker.canvasElementAliases=n.ticker.canvasElementAliases.filter(u=>u!==e$1)),Object.hasOwn(n.ticker.args,C)){let u=n.ticker.args.aliasToRemoveAfter;typeof u=="string"&&(u=[u]),Array.isArray(u)&&(t==="move"?n.ticker.args.aliasToRemoveAfter=u.map(T=>T===e$1?r:T):t==="duplicate"&&u.find(T=>T===e$1)&&(n.ticker.args.aliasToRemoveAfter=[...u,r]));}}}),i._currentTickersTimeouts.forEach(n=>{n.aliases.includes(e$1)&&(t==="move"?n.aliases=n.aliases.map(o=>o===e$1?r:o):t==="duplicate"&&n.aliases.find(o=>o===e$1)&&n.aliases.push(r));});let c=i._currentTickersSequence.get(r);if(c&&c.forEach((n,o)=>{S(r,o);}),t==="duplicate"){let n=i._currentTickersSequence.get(e$1);n&&n.forEach((o,a)=>{S(e$1,a);});}}function re(e){e.alias?i._tickersToCompleteOnStepEnd.stepAlias.push({id:e.id,alias:e.alias}):i._tickersToCompleteOnStepEnd.tikersIds.push({id:e.id});}async function te(e,r){if(r){let t=i._currentTickersSequence.get(r),s=t?.get(e);if(t&&s){let c=s.steps.map(n=>{if(typeof n=="object"&&"ticker"in n){let o=d.getInstance(n.ticker,n.args,{duration:n.duration,canvasElementAliases:[r],priority:n.priority});if(o)return o.complete()}return Promise.resolve()});await Promise.all(c);}}else {let t=i._currentTickers.get(e);t&&await t.ticker.complete();}}function he(){let e=i._tickersToCompleteOnStepEnd.tikersIds.splice(0,i._tickersToCompleteOnStepEnd.tikersIds.length),r=i._tickersToCompleteOnStepEnd.stepAlias.splice(0,i._tickersToCompleteOnStepEnd.stepAlias.length);return {tikersIds:e,stepAlias:r}}var Ae={transfer:ee,get currentTickers(){return i._currentTickers},get currentTickersSteps(){return i._currentTickersSequence},find:W,add:D,addSequence:G,unlinkComponent:L,removeAll:X,remove:y,pause:K,resume:x,isPaused:Z,completeOnStepEnd:re,forceCompletion:te,onComplete:F};export{d as RegisteredTickers,E as TickerBase,i as TickersManagerStatic,he as drainCompleteOnStepEndQueue,y as removeTicker,S as runTickersSequence,J as tickerDecorator,Ae as tickers};
package/dist/worker.cjs CHANGED
@@ -1 +1 @@
1
- 'use strict';var i=class extends Error{code;constructor(t,r,a,o,m){super(`[Pixi\u2019VN] ${r}`),this.code=t,a==="canvas"&&(this.canvasElementInfo=o,this.parent=m);}canvasElementInfo;parent};var n;(o=>(o.log=(m,...l)=>console.log(`[Pixi\u2019VN] ${m}`,...l),o.warn=(m,...l)=>console.warn(`[Pixi\u2019VN] ${m}`,...l),o.error=(m,...l)=>console.error(`[Pixi\u2019VN] ${m}`,...l),o.info=(m,...l)=>console.info(`[Pixi\u2019VN] ${m}`,...l)))(n||={});(class e{static init(t){t.navigate&&(e._navigate=t.navigate),e._getStepCounter=t.getStepCounter,e._setStepCounter=t.setStepCounter,e._getCurrentGameStepState=t.getCurrentGameStepState,e._restoreGameStepState=t.restoreGameStepState,e._getOpenedLabels=t.getOpenedLabels,e._processNavigationRequests=t.processNavigationRequests,e._getVariable=t.getVariable,e._setVariable=t.setVariable,e._removeVariable=t.removeVariable,e._getFlag=t.getFlag,e._setFlag=t.setFlag,t.onLabelClosing&&(e._onLabelClosing=t.onLabelClosing),e._addHistoryItem=t.addHistoryItem,e._getCharacter=t.getCharacter,e._animate=t.animate,e._animateFilter=t.animateFilter,e._removeCanvasComponent=t.removeCanvasComponent,e._canvasComponentExists=t.canvasComponentExists;}static _navigate=()=>{n.warn("Navigate function not initialized. You should add the navigate function in the Game.init() method.");};static get navigate(){return e._navigate}static set navigate(t){e._navigate=t;}static _getStepCounter=()=>{throw n.error("Method not implemented, you should initialize the Game: Game.init()"),new i("not_implemented","Method not implemented, you should initialize the Game: Game.init()")};static _setStepCounter=()=>{throw n.error("Method not implemented, you should initialize the Game: Game.init()"),new i("not_implemented","Method not implemented, you should initialize the Game: Game.init()")};static get stepCounter(){return e._getStepCounter()}static set stepCounter(t){e._setStepCounter(t);}static _getCurrentGameStepState=()=>{throw n.error("Method not implemented, you should initialize the Game: Game.init()"),new i("not_implemented","Method not implemented, you should initialize the Game: Game.init()")};static get currentGameStepState(){return e._getCurrentGameStepState()}static _restoreGameStepState=()=>{throw n.error("Method not implemented, you should initialize the Game: Game.init()"),new i("not_implemented","Method not implemented, you should initialize the Game: Game.init()")};static get restoreGameStepState(){return e._restoreGameStepState}static _getOpenedLabels=()=>{throw n.error("Method not implemented, you should initialize the Game: Game.init()"),new i("not_implemented","Method not implemented, you should initialize the Game: Game.init()")};static get openedLabels(){return e._getOpenedLabels()}static _onPreContinueHandlers=[];static addOnPreContinue(t){e._onPreContinueHandlers.push(t);}static removeOnPreContinue(t){e._onPreContinueHandlers=e._onPreContinueHandlers.filter(r=>r!==t);}static clearOnPreContinueHandlers(){e._onPreContinueHandlers=[];}static async runOnPreContinue(){let t=e._onPreContinueHandlers.slice();await Promise.all(t.map(r=>r()));}static get onPreContinue(){return e.runOnPreContinue}static navigationRequestsCount=0;static processNavigationLock=Promise.resolve();static get continueRequestsCount(){return e.navigationRequestsCount}static increaseContinueRequest(t=1){e.navigationRequestsCount+=t;}static get backRequestsCount(){return -1*e.navigationRequestsCount}static increaseBackRequest(t=1){e.navigationRequestsCount-=t;}static _processNavigationRequests=()=>{throw n.error("Method not implemented, you should initialize the Game: Game.init()"),new i("not_implemented","Method not implemented, you should initialize the Game: Game.init()")};static async processNavigationRequests(t){let r=e._processNavigationRequests(e.navigationRequestsCount,t);return e.navigationRequestsCount=r.newValue,await r.result}static _getVariable=()=>{throw n.error("Method not implemented, you should initialize the Game: Game.init()"),new i("not_implemented","Method not implemented, you should initialize the Game: Game.init()")};static get getVariable(){return e._getVariable}static _setVariable=()=>{throw n.error("Method not implemented, you should initialize the Game: Game.init()"),new i("not_implemented","Method not implemented, you should initialize the Game: Game.init()")};static get setVariable(){return e._setVariable}static _removeVariable=()=>{throw n.error("Method not implemented, you should initialize the Game: Game.init()"),new i("not_implemented","Method not implemented, you should initialize the Game: Game.init()")};static get removeVariable(){return e._removeVariable}static _getFlag=()=>{throw n.error("Method not implemented, you should initialize the Game: Game.init()"),new i("not_implemented","Method not implemented, you should initialize the Game: Game.init()")};static get getFlag(){return e._getFlag}static _setFlag=()=>{throw n.error("Method not implemented, you should initialize the Game: Game.init()"),new i("not_implemented","Method not implemented, you should initialize the Game: Game.init()")};static get setFlag(){return e._setFlag}static _onLabelClosing=()=>{};static get onLabelClosing(){return e._onLabelClosing}static _addHistoryItem=()=>{throw n.error("Method not implemented, you should initialize the Game: Game.init()"),new i("not_implemented","Method not implemented, you should initialize the Game: Game.init()")};static get addHistoryItem(){return e._addHistoryItem}static runningStepsCount=0;static _getCharacter=()=>{throw n.error("Method not implemented, you should initialize the Game: Game.init()"),new i("not_implemented","Method not implemented.")};static get getCharacter(){return e._getCharacter}static onEnd;static _onErrorHandlers=[];static addOnError(t){return e._onErrorHandlers.push(t),()=>e.removeOnError(t)}static removeOnError(t){e._onErrorHandlers=e._onErrorHandlers.filter(r=>r!==t);}static clearOnErrorHandlers(){e._onErrorHandlers.length=0;}static async runOnError(t,r){for(let a of e._onErrorHandlers.slice())try{await a(t,r);}catch(o){n.error("Error in onError handler",o);}}static _animate=()=>{throw n.error("Method not implemented, you should initialize the Game: Game.init()"),new i("not_implemented","Method not implemented, you should initialize the Game: Game.init()")};static get animate(){return e._animate}static _animateFilter=()=>{throw n.error("Method not implemented, you should initialize the Game: Game.init()"),new i("not_implemented","Method not implemented, you should initialize the Game: Game.init()")};static get animateFilter(){return e._animateFilter}static _removeCanvasComponent=()=>{throw n.error("Method not implemented, you should initialize the Game: Game.init()"),new i("not_implemented","Method not implemented, you should initialize the Game: Game.init()")};static get removeCanvasComponent(){return e._removeCanvasComponent}static _canvasComponentExists=()=>{throw n.error("Method not implemented, you should initialize the Game: Game.init()"),new i("not_implemented","Method not implemented, you should initialize the Game: Game.init()")};static get canvasComponentExists(){return e._canvasComponentExists}});function y(e){try{if(typeof e>"u")return e;let t=JSON.stringify(e);return JSON.parse(t)}catch(t){throw n.error("Error creating exportable element",e,t),new i("not_json_serializable","Error creating exportable element")}}function h(e,t){let r=y(e);return t.length>1&&"type"in t[0]&&(t=t.slice().reverse()),t.forEach(a=>{k(r,a);}),r}function k(e,t){let r=e;t.path&&t.path.length>0?t.path.forEach((a,o)=>{if(t.path&&o===t.path.length-1)switch(t.type){case "CHANGE":case "REMOVE":r[a]=t.oldValue;break;case "CREATE":Array.isArray(r)&&typeof a=="number"?r.splice(a,1):delete r[a];break}else r=r[a];}):n.warn("No path found, skipping diff",t);}var w=["Date","RegExp","String","Number"],E=Object.getOwnPropertyNames(globalThis.Temporal||{});function c(e,t,r={cyclesFix:true},a=[]){let o=[],m=Array.isArray(e);for(let p in e){let s=e[p],v=m?+p:p;if(!(p in t)){o.push({type:"REMOVE",path:[v],oldValue:s});continue}let u=t[p],G=typeof s=="object"&&typeof u=="object"&&Array.isArray(s)===Array.isArray(u),g=G&&s?Object.getPrototypeOf(s)?.constructor?.name:void 0;if(s&&u&&G&&!w.includes(g)&&!E.includes(g)&&(!r.cyclesFix||!a.includes(s))){r.cyclesFix&&a.push(s);let S=c(s,u,r,a);r.cyclesFix&&a.pop();for(let C of S)C.path.unshift(v),o.push(C);}else Object.is(s,u)||E.includes(g)&&String(s)===String(u)||w.includes(g)&&(isNaN(s)?s+""==u+"":+s==+u)||o.push({path:[v],type:"CHANGE",value:u,oldValue:s});}let l=Array.isArray(t);for(let p in t)p in e||o.push({type:"CREATE",path:[l?+p:p],value:t[p]});return o}var b=new Map;function x(e,t){b.set(e,t);}function P(e){b.delete(e);}function T(e){return b.get(e)}async function M(e){try{switch(e.type){case "restore-diff":{let t=h(e.state,e.diff);return {id:e.id,type:"restore-diff-result",result:t}}case "diff":{let t=c(e.before,e.after);return {id:e.id,type:"diff-result",result:t}}case "clone":{let t=JSON.parse(JSON.stringify(e.value));return {id:e.id,type:"clone-result",result:t}}case "custom":{let t=T(e.kind);if(!t)throw new Error(`No game worker handler registered for kind "${e.kind}"`);let r=await t(e.payload);return {id:e.id,type:"custom-result",result:r}}}}catch(t){return {id:e.id,type:"error",error:t instanceof Error?t.message:String(t)}}}var d=class e{static _worker;static _pending=new Map;static _nextId=0;static get isAvailable(){return e._worker!==void 0}static register(t){e.unregister(),e._worker=t,t.addEventListener("message",e._handleMessage);}static unregister(){let t=e._worker;if(t){t.removeEventListener("message",e._handleMessage),e._worker=void 0;for(let{reject:r}of e._pending.values())r(new Error("Game worker was unregistered"));e._pending.clear();}}static _handleMessage=t=>{let r=e._pending.get(t.data.id);r&&(e._pending.delete(t.data.id),t.data.type==="error"?r.reject(new Error(t.data.error)):r.resolve(t.data.result));};static _request(t){let r=e._worker;if(!r)return Promise.reject(new Error("No game worker is registered"));let a=e._nextId++;return new Promise((o,m)=>{e._pending.set(a,{resolve:o,reject:m});try{r.postMessage({...t,id:a});}catch(l){e._pending.delete(a),n.error("Error posting message to game worker",l),m(l);}})}static async restoreDiff(t,r){return await e._request({type:"restore-diff",state:t,diff:r})}static async diff(t,r){return await e._request({type:"diff",before:t,after:r})}static async clone(t){return await e._request({type:"clone",value:t})}static async custom(t,r){return await e._request({type:"custom",kind:t,payload:r})}};async function R(e,t){if(d.isAvailable)try{return await d.restoreDiff(e,t)}catch(r){n.warn("Game worker failed to restore diff, falling back to the main thread",r);}return h(e,t)}async function O(e,t){if(d.isAvailable)try{return await d.diff(e,t)}catch(r){n.warn("Game worker failed to compute diff, falling back to the main thread",r);}return c(e,t)}async function H(e){if(d.isAvailable)try{return await d.clone(e)}catch(t){n.warn("Game worker failed to clone value, falling back to the main thread",t);}return y(e)}exports.GameWorkerManager=d;exports.cloneMaybeOffloaded=H;exports.diffMaybeOffloaded=O;exports.handleGameWorkerMessage=M;exports.registerGameWorkerHandler=x;exports.restoreDiffMaybeOffloaded=R;exports.unregisterGameWorkerHandler=P;
1
+ 'use strict';var i=class extends Error{code;constructor(t,r,a,o,m){super(`[Pixi\u2019VN] ${r}`),this.code=t,a==="canvas"&&(this.canvasElementInfo=o,this.parent=m);}canvasElementInfo;parent};var n;(o=>(o.log=(m,...l)=>console.log(`[Pixi\u2019VN] ${m}`,...l),o.warn=(m,...l)=>console.warn(`[Pixi\u2019VN] ${m}`,...l),o.error=(m,...l)=>console.error(`[Pixi\u2019VN] ${m}`,...l),o.info=(m,...l)=>console.info(`[Pixi\u2019VN] ${m}`,...l)))(n||={});(class e{static init(t){t.navigate&&(e._navigate=t.navigate),e._getStepCounter=t.getStepCounter,e._setStepCounter=t.setStepCounter,e._getCurrentGameStepState=t.getCurrentGameStepState,e._restoreGameStepState=t.restoreGameStepState,e._getOpenedLabels=t.getOpenedLabels,e._processNavigationRequests=t.processNavigationRequests,e._getVariable=t.getVariable,e._setVariable=t.setVariable,e._removeVariable=t.removeVariable,e._getFlag=t.getFlag,e._setFlag=t.setFlag,t.onLabelClosing&&(e._onLabelClosing=t.onLabelClosing),e._addHistoryItem=t.addHistoryItem,e._getCharacter=t.getCharacter,e._animate=t.animate,e._animateFilter=t.animateFilter,e._removeCanvasComponent=t.removeCanvasComponent,e._canvasComponentExists=t.canvasComponentExists;}static _navigate=()=>{n.warn("Navigate function not initialized. You should add the navigate function in the Game.init() method.");};static get navigate(){return e._navigate}static set navigate(t){e._navigate=t;}static _getStepCounter=()=>{throw n.error("Method not implemented, you should initialize the Game: Game.init()"),new i("not_implemented","Method not implemented, you should initialize the Game: Game.init()")};static _setStepCounter=()=>{throw n.error("Method not implemented, you should initialize the Game: Game.init()"),new i("not_implemented","Method not implemented, you should initialize the Game: Game.init()")};static get stepCounter(){return e._getStepCounter()}static set stepCounter(t){e._setStepCounter(t);}static _getCurrentGameStepState=()=>{throw n.error("Method not implemented, you should initialize the Game: Game.init()"),new i("not_implemented","Method not implemented, you should initialize the Game: Game.init()")};static get currentGameStepState(){return e._getCurrentGameStepState()}static _restoreGameStepState=()=>{throw n.error("Method not implemented, you should initialize the Game: Game.init()"),new i("not_implemented","Method not implemented, you should initialize the Game: Game.init()")};static get restoreGameStepState(){return e._restoreGameStepState}static _getOpenedLabels=()=>{throw n.error("Method not implemented, you should initialize the Game: Game.init()"),new i("not_implemented","Method not implemented, you should initialize the Game: Game.init()")};static get openedLabels(){return e._getOpenedLabels()}static _onPreContinueHandlers=[];static addOnPreContinue(t){e._onPreContinueHandlers.push(t);}static removeOnPreContinue(t){e._onPreContinueHandlers=e._onPreContinueHandlers.filter(r=>r!==t);}static clearOnPreContinueHandlers(){e._onPreContinueHandlers=[];}static async runOnPreContinue(){let t=e._onPreContinueHandlers.slice();await Promise.all(t.map(r=>r()));}static get onPreContinue(){return e.runOnPreContinue}static navigationRequestsCount=0;static processNavigationLock=Promise.resolve();static get continueRequestsCount(){return e.navigationRequestsCount}static increaseContinueRequest(t=1){e.navigationRequestsCount+=t;}static get backRequestsCount(){return -1*e.navigationRequestsCount}static increaseBackRequest(t=1){e.navigationRequestsCount-=t;}static _processNavigationRequests=()=>{throw n.error("Method not implemented, you should initialize the Game: Game.init()"),new i("not_implemented","Method not implemented, you should initialize the Game: Game.init()")};static async processNavigationRequests(t){let r=e._processNavigationRequests(e.navigationRequestsCount,t);return e.navigationRequestsCount=r.newValue,await r.result}static _getVariable=()=>{throw n.error("Method not implemented, you should initialize the Game: Game.init()"),new i("not_implemented","Method not implemented, you should initialize the Game: Game.init()")};static get getVariable(){return e._getVariable}static _setVariable=()=>{throw n.error("Method not implemented, you should initialize the Game: Game.init()"),new i("not_implemented","Method not implemented, you should initialize the Game: Game.init()")};static get setVariable(){return e._setVariable}static _removeVariable=()=>{throw n.error("Method not implemented, you should initialize the Game: Game.init()"),new i("not_implemented","Method not implemented, you should initialize the Game: Game.init()")};static get removeVariable(){return e._removeVariable}static _getFlag=()=>{throw n.error("Method not implemented, you should initialize the Game: Game.init()"),new i("not_implemented","Method not implemented, you should initialize the Game: Game.init()")};static get getFlag(){return e._getFlag}static _setFlag=()=>{throw n.error("Method not implemented, you should initialize the Game: Game.init()"),new i("not_implemented","Method not implemented, you should initialize the Game: Game.init()")};static get setFlag(){return e._setFlag}static _onLabelClosing=()=>{};static get onLabelClosing(){return e._onLabelClosing}static _addHistoryItem=()=>{throw n.error("Method not implemented, you should initialize the Game: Game.init()"),new i("not_implemented","Method not implemented, you should initialize the Game: Game.init()")};static get addHistoryItem(){return e._addHistoryItem}static runningStepsCount=0;static _getCharacter=()=>{throw n.error("Method not implemented, you should initialize the Game: Game.init()"),new i("not_implemented","Method not implemented.")};static get getCharacter(){return e._getCharacter}static onEnd;static _onErrorHandlers=[];static addOnError(t){return e._onErrorHandlers.push(t),()=>e.removeOnError(t)}static removeOnError(t){e._onErrorHandlers=e._onErrorHandlers.filter(r=>r!==t);}static clearOnErrorHandlers(){e._onErrorHandlers.length=0;}static async runOnError(t,r){for(let a of e._onErrorHandlers.slice())try{await a(t,r);}catch(o){n.error("Error in onError handler",o);}}static _animate=()=>{throw n.error("Method not implemented, you should initialize the Game: Game.init()"),new i("not_implemented","Method not implemented, you should initialize the Game: Game.init()")};static get animate(){return e._animate}static _animateFilter=()=>{throw n.error("Method not implemented, you should initialize the Game: Game.init()"),new i("not_implemented","Method not implemented, you should initialize the Game: Game.init()")};static get animateFilter(){return e._animateFilter}static _removeCanvasComponent=()=>{throw n.error("Method not implemented, you should initialize the Game: Game.init()"),new i("not_implemented","Method not implemented, you should initialize the Game: Game.init()")};static get removeCanvasComponent(){return e._removeCanvasComponent}static _canvasComponentExists=()=>{throw n.error("Method not implemented, you should initialize the Game: Game.init()"),new i("not_implemented","Method not implemented, you should initialize the Game: Game.init()")};static get canvasComponentExists(){return e._canvasComponentExists}});function y(e){try{if(typeof e>"u")return e;let t=JSON.stringify(e);return JSON.parse(t)}catch(t){throw n.error("Error creating exportable element",e,t),new i("not_json_serializable","Error creating exportable element")}}function h(e,t){let r=y(e);return t.length>1&&"type"in t[0]&&(t=t.slice().reverse()),t.forEach(a=>{S(r,a);}),r}function S(e,t){let r=e;t.path&&t.path.length>0?t.path.forEach((a,o)=>{if(t.path&&o===t.path.length-1)switch(t.type){case "CHANGE":case "REMOVE":r[a]=t.oldValue;break;case "CREATE":Array.isArray(r)&&typeof a=="number"?r.splice(a,1):delete r[a];break}else r=r[a];}):n.warn("No path found, skipping diff",t);}var w=["Date","RegExp","String","Number"],E=Object.getOwnPropertyNames(globalThis.Temporal||{});function c(e,t,r={cyclesFix:true},a=[]){let o=[],m=Array.isArray(e);for(let p in e){let s=e[p],v=m?+p:p;if(!(p in t)){o.push({type:"REMOVE",path:[v],oldValue:s});continue}let u=t[p],G=typeof s=="object"&&typeof u=="object"&&Array.isArray(s)===Array.isArray(u),g=G&&s?Object.getPrototypeOf(s)?.constructor?.name:void 0;if(s&&u&&G&&!w.includes(g)&&!E.includes(g)&&(!r.cyclesFix||!a.includes(s))){r.cyclesFix&&a.push(s);let k=c(s,u,r,a);r.cyclesFix&&a.pop();for(let C of k)C.path.unshift(v),o.push(C);}else Object.is(s,u)||E.includes(g)&&String(s)===String(u)||w.includes(g)&&(isNaN(s)?s+""==u+"":+s==+u)||o.push({path:[v],type:"CHANGE",value:u,oldValue:s});}let l=Array.isArray(t);for(let p in t)p in e||o.push({type:"CREATE",path:[l?+p:p],value:t[p]});return o}var b=new Map;function x(e,t){b.set(e,t);}function P(e){b.delete(e);}function T(e){return b.get(e)}async function M(e){try{switch(e.type){case "restore-diff":{let t=h(e.state,e.diff);return {id:e.id,type:"restore-diff-result",result:t}}case "diff":{let t=c(e.before,e.after);return {id:e.id,type:"diff-result",result:t}}case "clone":{let t=JSON.parse(JSON.stringify(e.value));return {id:e.id,type:"clone-result",result:t}}case "custom":{let t=T(e.kind);if(!t)throw new Error(`No game worker handler registered for kind "${e.kind}"`);let r=await t(e.payload);return {id:e.id,type:"custom-result",result:r}}}}catch(t){return {id:e.id,type:"error",error:t instanceof Error?t.message:String(t)}}}var d=class e{static _worker;static _pending=new Map;static _nextId=0;static get isAvailable(){return e._worker!==void 0}static register(t){e.unregister(),e._worker=t,t.addEventListener("message",e._handleMessage);}static unregister(){let t=e._worker;if(t){t.removeEventListener("message",e._handleMessage),e._worker=void 0;for(let{reject:r}of e._pending.values())r(new Error("Game worker was unregistered"));e._pending.clear();}}static _handleMessage=t=>{let r=e._pending.get(t.data.id);r&&(e._pending.delete(t.data.id),t.data.type==="error"?r.reject(new Error(t.data.error)):r.resolve(t.data.result));};static _request(t){let r=e._worker;if(!r)return Promise.reject(new Error("No game worker is registered"));let a=e._nextId++;return new Promise((o,m)=>{e._pending.set(a,{resolve:o,reject:m});try{r.postMessage({...t,id:a});}catch(l){e._pending.delete(a),n.error("Error posting message to game worker",l),m(l);}})}static async restoreDiff(t,r){return await e._request({type:"restore-diff",state:t,diff:r})}static async diff(t,r){return await e._request({type:"diff",before:t,after:r})}static async clone(t){return await e._request({type:"clone",value:t})}static async custom(t,r){return await e._request({type:"custom",kind:t,payload:r})}};async function R(e,t){if(d.isAvailable)try{return await d.restoreDiff(e,t)}catch(r){n.warn("Game worker failed to restore diff, falling back to the main thread",r);}return h(e,t)}async function O(e,t){if(d.isAvailable)try{return await d.diff(e,t)}catch(r){n.warn("Game worker failed to compute diff, falling back to the main thread",r);}return c(e,t)}async function H(e){if(d.isAvailable)try{return await d.clone(e)}catch(t){n.warn("Game worker failed to clone value, falling back to the main thread",t);}return y(e)}exports.GameWorkerManager=d;exports.cloneMaybeOffloaded=H;exports.diffMaybeOffloaded=O;exports.handleGameWorkerMessage=M;exports.registerGameWorkerHandler=x;exports.restoreDiffMaybeOffloaded=R;exports.unregisterGameWorkerHandler=P;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drincs/pixi-vn",
3
- "version": "1.9.4",
3
+ "version": "1.9.5",
4
4
  "type": "module",
5
5
  "description": "Pixi'VN is a very versatile and powerful game/story-driven engine.",
6
6
  "main": "./dist/index.cjs",