route-graphics 0.0.2-rc3 → 0.0.2-rc4

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.
@@ -1139,4 +1139,4 @@ ${u}`)}});return await Promise.all(c),o?s[n[0].src]:s}async unload(t){let r=Ot(t
1139
1139
  })();
1140
1140
  `,Vi=null,Xo=class{constructor(){Vi||(Vi=URL.createObjectURL(new Blob([qE],{type:"application/javascript"}))),this.worker=new Worker(Vi)}};Xo.revokeObjectURL=function(){Vi&&(URL.revokeObjectURL(Vi),Vi=null)};var sT=0,dd,fd=class{constructor(){this._initialized=!1,this._createdWorkers=0,this._workerPool=[],this._queue=[],this._resolveHash={}}isImageBitmapSupported(){return this._isImageBitmapSupported!==void 0?this._isImageBitmapSupported:(this._isImageBitmapSupported=new Promise(t=>{let{worker:e}=new zi;e.addEventListener("message",r=>{e.terminate(),zi.revokeObjectURL(),t(r.data)})}),this._isImageBitmapSupported)}loadImageBitmap(t,e){return this._run("loadImageBitmap",[t,e?.data?.alphaMode])}async _initWorkers(){this._initialized||(this._initialized=!0)}_getWorker(){dd===void 0&&(dd=navigator.hardwareConcurrency||4);let t=this._workerPool.pop();return!t&&this._createdWorkers<dd&&(this._createdWorkers++,t=new Xo().worker,t.addEventListener("message",e=>{this._complete(e.data),this._returnWorker(e.target),this._next()})),t}_returnWorker(t){this._workerPool.push(t)}_complete(t){t.error!==void 0?this._resolveHash[t.uuid].reject(t.error):this._resolveHash[t.uuid].resolve(t.data),this._resolveHash[t.uuid]=null}async _run(t,e){await this._initWorkers();let r=new Promise((s,o)=>{this._queue.push({id:t,arguments:e,resolve:s,reject:o})});return this._next(),r}_next(){if(!this._queue.length)return;let t=this._getWorker();if(!t)return;let e=this._queue.pop(),r=e.id;this._resolveHash[sT]={resolve:e.resolve,reject:e.reject},t.postMessage({data:e.arguments,uuid:sT++,id:r})}},pd=new fd;Ve();var ZE=[".jpeg",".jpg",".png",".webp",".avif"],QE=["image/jpeg","image/png","image/webp","image/avif"];async function JE(i,t){let e=await D.get().fetch(i);if(!e.ok)throw new Error(`[loadImageBitmap] Failed to fetch ${i}: ${e.status} ${e.statusText}`);let r=await e.blob();return t?.data?.alphaMode==="premultiplied-alpha"?createImageBitmap(r,{premultiplyAlpha:"none"}):createImageBitmap(r)}var ic={name:"loadTextures",extension:{type:x.LoadParser,priority:Et.High,name:"loadTextures"},config:{preferWorkers:!0,preferCreateImageBitmap:!0,crossOrigin:"anonymous"},test(i){return ue(i,QE)||de(i,ZE)},async load(i,t,e){let r=null;globalThis.createImageBitmap&&this.config.preferCreateImageBitmap?this.config.preferWorkers&&await pd.isImageBitmapSupported()?r=await pd.loadImageBitmap(i,t):r=await JE(i,t):r=await new Promise((o,n)=>{r=new Image,r.crossOrigin=this.config.crossOrigin,r.src=i,r.complete?o(r):(r.onload=()=>{o(r)},r.onerror=n)});let s=new qt({resource:r,alphaMode:"premultiply-alpha-on-upload",resolution:t.data?.resolution||Ni(i),...t.data});return Hi(s,e,i)},unload(i){i.destroy(!0)}};w();Cl();Al();var oT=[".mp4",".m4v",".webm",".ogg",".ogv",".h264",".avi",".mov"],tP=oT.map(i=>`video/${i.substring(1)}`);function eP(i,t,e){e===void 0&&!t.startsWith("data:")?i.crossOrigin=iP(t):e!==!1&&(i.crossOrigin=typeof e=="string"?e:"anonymous")}function rP(i){return new Promise((t,e)=>{i.addEventListener("canplaythrough",r),i.addEventListener("error",s),i.load();function r(){o(),t()}function s(n){o(),e(n)}function o(){i.removeEventListener("canplaythrough",r),i.removeEventListener("error",s)}})}function iP(i,t=globalThis.location){if(i.startsWith("data:"))return"";t||(t=globalThis.location);let e=new URL(i,document.baseURI);return e.hostname!==t.hostname||e.port!==t.port||e.protocol!==t.protocol?"anonymous":""}var nT={name:"loadVideo",extension:{type:x.LoadParser,name:"loadVideo"},test(i){let t=ue(i,tP),e=de(i,oT);return t||e},async load(i,t,e){let r={...ri.defaultOptions,resolution:t.data?.resolution||Ni(i),alphaMode:t.data?.alphaMode||await Bn(),...t.data},s=document.createElement("video"),o={preload:r.autoLoad!==!1?"auto":void 0,"webkit-playsinline":r.playsinline!==!1?"":void 0,playsinline:r.playsinline!==!1?"":void 0,muted:r.muted===!0?"":void 0,loop:r.loop===!0?"":void 0,autoplay:r.autoPlay!==!1?"":void 0};Object.keys(o).forEach(c=>{let l=o[c];l!==void 0&&s.setAttribute(c,l)}),r.muted===!0&&(s.muted=!0),eP(s,i,r.crossorigin);let n=document.createElement("source"),a;if(i.startsWith("data:"))a=i.slice(5,i.indexOf(";"));else if(!i.startsWith("blob:")){let c=i.split("?")[0].slice(i.lastIndexOf(".")+1).toLowerCase();a=ri.MIME_TYPES[c]||`video/${c}`}return n.src=i,a&&(n.type=a),new Promise(c=>{let l=async()=>{let h=new ri({...r,resource:s});s.removeEventListener("canplay",l),t.data.preload&&await rP(s),c(Hi(h,e,i))};s.addEventListener("canplay",l),s.appendChild(n)})},unload(i){i.destroy(!0)}};w();Jr();w();Jr();var sc={extension:{type:x.ResolveParser,name:"resolveTexture"},test:ic.test,parse:i=>({resolution:parseFloat(se.RETINA_PREFIX.exec(i)?.[1]??"1"),format:i.split(".").pop(),src:i})};var aT={extension:{type:x.ResolveParser,priority:-2,name:"resolveJson"},test:i=>se.RETINA_PREFIX.test(i)&&i.endsWith(".json"),parse:sc.parse};Jr();ms();wn();var oc=class{constructor(){this._detections=[],this._initialized=!1,this.resolver=new se,this.loader=new rc,this.cache=Q,this._backgroundLoader=new tc(this.loader),this._backgroundLoader.active=!0,this.reset()}async init(t={}){if(this._initialized){G("[Assets]AssetManager already initialized, did you load before calling this Assets.init()?");return}if(this._initialized=!0,t.defaultSearchParams&&this.resolver.setDefaultSearchParams(t.defaultSearchParams),t.basePath&&(this.resolver.basePath=t.basePath),t.bundleIdentifier&&this.resolver.setBundleIdentifier(t.bundleIdentifier),t.manifest){let o=t.manifest;typeof o=="string"&&(o=await this.load(o)),this.resolver.addManifest(o)}let e=t.texturePreference?.resolution??1,r=typeof e=="number"?[e]:e,s=await this._detectFormats({preferredFormats:t.texturePreference?.format,skipDetections:t.skipDetections,detections:this._detections});this.resolver.prefer({params:{format:s,resolution:r}}),t.preferences&&this.setPreferences(t.preferences)}add(t){this.resolver.add(t)}async load(t,e){this._initialized||await this.init();let r=Ar(t),s=Ot(t).map(a=>{if(typeof a!="string"){let c=this.resolver.getAlias(a);return c.some(l=>!this.resolver.hasKey(l))&&this.add(a),Array.isArray(c)?c[0]:c}return this.resolver.hasKey(a)||this.add({alias:a,src:a}),a}),o=this.resolver.resolve(s),n=await this._mapLoadToResolve(o,e);return r?n[s[0]]:n}addBundle(t,e){this.resolver.addBundle(t,e)}async loadBundle(t,e){this._initialized||await this.init();let r=!1;typeof t=="string"&&(r=!0,t=[t]);let s=this.resolver.resolveBundle(t),o={},n=Object.keys(s),a=0,c=0,l=()=>{e?.(++a/c)},h=n.map(u=>{let d=s[u];return c+=Object.keys(d).length,this._mapLoadToResolve(d,l).then(f=>{o[u]=f})});return await Promise.all(h),r?o[t[0]]:o}async backgroundLoad(t){this._initialized||await this.init(),typeof t=="string"&&(t=[t]);let e=this.resolver.resolve(t);this._backgroundLoader.add(Object.values(e))}async backgroundLoadBundle(t){this._initialized||await this.init(),typeof t=="string"&&(t=[t]);let e=this.resolver.resolveBundle(t);Object.values(e).forEach(r=>{this._backgroundLoader.add(Object.values(r))})}reset(){this.resolver.reset(),this.loader.reset(),this.cache.reset(),this._initialized=!1}get(t){if(typeof t=="string")return Q.get(t);let e={};for(let r=0;r<t.length;r++)e[r]=Q.get(t[r]);return e}async _mapLoadToResolve(t,e){let r=[...new Set(Object.values(t))];this._backgroundLoader.active=!1;let s=await this.loader.load(r,e);this._backgroundLoader.active=!0;let o={};return r.forEach(n=>{let a=s[n.src],c=[n.src];n.alias&&c.push(...n.alias),c.forEach(l=>{o[l]=a}),Q.set(c,a)}),o}async unload(t){this._initialized||await this.init();let e=Ot(t).map(s=>typeof s!="string"?s.src:s),r=this.resolver.resolve(e);await this._unloadFromResolved(r)}async unloadBundle(t){this._initialized||await this.init(),t=Ot(t);let e=this.resolver.resolveBundle(t),r=Object.keys(e).map(s=>this._unloadFromResolved(e[s]));await Promise.all(r)}async _unloadFromResolved(t){let e=Object.values(t);e.forEach(r=>{Q.remove(r.src)}),await this.loader.unload(e)}async _detectFormats(t){let e=[];t.preferredFormats&&(e=Array.isArray(t.preferredFormats)?t.preferredFormats:[t.preferredFormats]);for(let r of t.detections)t.skipDetections||await r.test()?e=await r.add(e):t.skipDetections||(e=await r.remove(e));return e=e.filter((r,s)=>e.indexOf(r)===s),e}get detections(){return this._detections}setPreferences(t){this.loader.parsers.forEach(e=>{e.config&&Object.keys(e.config).filter(r=>r in t).forEach(r=>{e.config[r]=t[r]})})}},be=new oc;R.handleByList(x.LoadParser,be.loader.parsers).handleByList(x.ResolveParser,be.resolver.parsers).handleByList(x.CacheParser,be.cache.parsers).handleByList(x.DetectionParser,be.detections);R.add($0,K0,X0,J0,q0,Z0,Q0,tT,eT,rT,iT,ic,nT,j0,V0,sc,aT);var cT={loader:x.LoadParser,resolver:x.ResolveParser,cache:x.CacheParser,detection:x.DetectionParser};R.handle(x.Asset,i=>{let t=i.ref;Object.entries(cT).filter(([e])=>!!t[e]).forEach(([e,r])=>R.add(Object.assign(t[e],{extension:t[e].extension??r})))},i=>{let t=i.ref;Object.keys(cT).filter(e=>!!t[e]).forEach(e=>R.remove(t[e]))});sn();dt();Sn();var nc=class extends tr{constructor(t,e){let{text:r,resolution:s,style:o,anchor:n,width:a,height:c,roundPixels:l,...h}=t;super({...h}),this.batched=!0,this._resolution=null,this._autoResolution=!0,this._didTextUpdate=!0,this._styleClass=e,this.text=r??"",this.style=o,this.resolution=s??null,this.allowChildren=!1,this._anchor=new Bt({_onUpdate:()=>{this.onViewUpdate()}}),n&&(this.anchor=n),this.roundPixels=l??!1,a!==void 0&&(this.width=a),c!==void 0&&(this.height=c)}get anchor(){return this._anchor}set anchor(t){typeof t=="number"?this._anchor.set(t):this._anchor.copyFrom(t)}set text(t){t=t.toString(),this._text!==t&&(this._text=t,this.onViewUpdate())}get text(){return this._text}set resolution(t){this._autoResolution=t===null,this._resolution=t,this.onViewUpdate()}get resolution(){return this._resolution}get style(){return this._style}set style(t){t||(t={}),this._style?.off("update",this.onViewUpdate,this),t instanceof this._styleClass?this._style=t:this._style=new this._styleClass(t),this._style.on("update",this.onViewUpdate,this),this.onViewUpdate()}get width(){return Math.abs(this.scale.x)*this.bounds.width}set width(t){this._setWidth(t,this.bounds.width)}get height(){return Math.abs(this.scale.y)*this.bounds.height}set height(t){this._setHeight(t,this.bounds.height)}getSize(t){return t||(t={}),t.width=Math.abs(this.scale.x)*this.bounds.width,t.height=Math.abs(this.scale.y)*this.bounds.height,t}setSize(t,e){typeof t=="object"?(e=t.height??t.width,t=t.width):e??(e=t),t!==void 0&&this._setWidth(t,this.bounds.width),e!==void 0&&this._setHeight(e,this.bounds.height)}containsPoint(t){let e=this.bounds.width,r=this.bounds.height,s=-e*this.anchor.x,o=0;return t.x>=s&&t.x<=s+e&&(o=-r*this.anchor.y,t.y>=o&&t.y<=o+r)}onViewUpdate(){this.didViewUpdate||(this._didTextUpdate=!0),super.onViewUpdate()}_getKey(){return`${this.text}:${this._style.styleKey}:${this._resolution}`}destroy(t=!1){super.destroy(t),this.owner=null,this._bounds=null,this._anchor=null,(typeof t=="boolean"?t:t?.style)&&this._style.destroy(t),this._style=null,this._text=null}};function lT(i,t){let e=i[0]??{};return(typeof e=="string"||i[1])&&(U(H,`use new ${t}({ text: "hi!", style }) instead`),e={text:e,style:i[1]}),e}Ns();Ur();var dr=class extends nc{constructor(...t){let e=lT(t,"Text");super(e,St),this.renderPipeId="text"}updateBounds(){let t=this._bounds,e=this._anchor,r=At.measureText(this._text,this._style),{width:s,height:o}=r;t.minX=-e._x*s,t.maxX=t.minX+s,t.minY=-e._y*o,t.maxY=t.minY+o}};Ve();vt();tt();Rl();me();Yh();An();Ns();Ur();kt();var sP=tn(oh(),1);R.add(xy,yy);var Vt={Add:"add",Remove:"remove"},ac=class{init(t){throw new Error("Method not implemented.")}render(t){throw new Error("Method not implemented.")}},fr=class{rendererName;rendererType;add=(t,e)=>{throw new Error("Method not implemented.")};remove=(t,e)=>{throw new Error("Method not implemented.")};update=(t,e)=>{throw new Error("Method not implemented.")}};var cc=(i=[],t=[])=>{let e=[],r=[],s=[],o=i.filter(a=>!a.hidden),n=t.filter(a=>!a.hidden);for(let a of o){let c=n.find(l=>l.id===a.id&&l.type===a.type);c?r.push({prev:a,next:c}):e.push(a)}for(let a of n)o.find(l=>l.id===a.id&&l.type===a.type)||s.push(a);for(let a of i){let c=t.find(l=>l.id===a.id&&l.type===a.type);c&&c.hidden&&!a.hidden&&e.push(a)}return{toDeleteElements:e,toUpdateElements:r,toAddElements:s}};var Lr=new(window.AudioContext||window.webkitAudioContext),ji=class i{static loadedAssets={};static load=async(t,e)=>{if(!i.loadedAssets[t]&&e.byteLength!==0)try{let r=await Lr.decodeAudioData(e);i.loadedAssets[t]=r}catch(r){console.error(`AudioAsset.load: Failed to decode ${t}:`,r)}};static getAsset=t=>i.loadedAssets[t]},md=class{_audioSource;_gainNode;volume=1;id;url;loop=!1;constructor(t,e){this.id=t,this.url=e.url,this.loop=e.loop||!1,this.volume=e.volume??1,this._gainNode=Lr.createGain(),this._gainNode.gain.value=this.volume,this._gainNode.connect(Lr.destination)}play=()=>{let t=ji.getAsset(this.url);if(!t){console.warn("AudioPlayer.play: Asset not found",this.url);return}this._audioSource=Lr.createBufferSource(),this._audioSource.buffer=t,this._audioSource.loop=this.loop,this._gainNode.gain.setValueAtTime(this.volume,Lr.currentTime),this._audioSource.connect(this._gainNode),this._audioSource.start(0)};stop=()=>{this._audioSource&&(this._audioSource.stop(),this._audioSource.disconnect(),this._gainNode.disconnect(),this._gainNode=Lr.createGain(),this._gainNode.gain.value=this.volume,this._gainNode.connect(Lr.destination))}},lc=class{audioPlayers=[];stageAudios=[];add=t=>{this.stageAudios.push(t)};remove=t=>{this.stageAudios=this.stageAudios.filter(e=>e.id!==t)};getById=t=>this.stageAudios.find(e=>e.id===t);tick=()=>{for(let e of this.stageAudios){let r=this.audioPlayers.find(s=>s.id===e.id);if(!r){let s=new md(e.id,{url:e.url,loop:e.loop,volume:e.volume??1});this.audioPlayers.push(s),s.play();return}(r.url!==e.url||r.loop!==e.loop)&&(r.stop(),r.url=e.url,r.loop=e.loop??!1,r.play()),r.volume!==(e.volume??1)&&(r.volume=e.volume??1,r._gainNode.gain.value=r.volume)}let t=[];for(let e of this.audioPlayers)this.stageAudios.find(r=>r.id===e.id)||(e.stop(),t.push(e.id));this.audioPlayers=this.audioPlayers.filter(e=>!t.includes(e.id))};destroy=()=>{for(let t of this.audioPlayers)t.stop();this.audioPlayers=[],this.stageAudios=[]}};var gd=function(i,t){return gd=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])},gd(i,t)};function Yo(i,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");gd(i,t);function e(){this.constructor=i}i.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}function hT(i,t,e,r){function s(o){return o instanceof e?o:new e(function(n){n(o)})}return new(e||(e=Promise))(function(o,n){function a(h){try{l(r.next(h))}catch(u){n(u)}}function c(h){try{l(r.throw(h))}catch(u){n(u)}}function l(h){h.done?o(h.value):s(h.value).then(a,c)}l((r=r.apply(i,t||[])).next())})}function hc(i,t){var e={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,s,o,n=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return n.next=a(0),n.throw=a(1),n.return=a(2),typeof Symbol=="function"&&(n[Symbol.iterator]=function(){return this}),n;function a(l){return function(h){return c([l,h])}}function c(l){if(r)throw new TypeError("Generator is already executing.");for(;n&&(n=0,l[0]&&(e=0)),e;)try{if(r=1,s&&(o=l[0]&2?s.return:l[0]?s.throw||((o=s.return)&&o.call(s),0):s.next)&&!(o=o.call(s,l[1])).done)return o;switch(s=0,o&&(l=[l[0]&2,o.value]),l[0]){case 0:case 1:o=l;break;case 4:return e.label++,{value:l[1],done:!1};case 5:e.label++,s=l[1],l=[0];continue;case 7:l=e.ops.pop(),e.trys.pop();continue;default:if(o=e.trys,!(o=o.length>0&&o[o.length-1])&&(l[0]===6||l[0]===2)){e=0;continue}if(l[0]===3&&(!o||l[1]>o[0]&&l[1]<o[3])){e.label=l[1];break}if(l[0]===6&&e.label<o[1]){e.label=o[1],o=l;break}if(o&&e.label<o[2]){e.label=o[2],e.ops.push(l);break}o[2]&&e.ops.pop(),e.trys.pop();continue}l=t.call(i,e)}catch(h){l=[6,h],s=0}finally{r=o=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}function Nr(i){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&i[t],r=0;if(e)return e.call(i);if(i&&typeof i.length=="number")return{next:function(){return i&&r>=i.length&&(i=void 0),{value:i&&i[r++],done:!i}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function $i(i,t){var e=typeof Symbol=="function"&&i[Symbol.iterator];if(!e)return i;var r=e.call(i),s,o=[],n;try{for(;(t===void 0||t-- >0)&&!(s=r.next()).done;)o.push(s.value)}catch(a){n={error:a}}finally{try{s&&!s.done&&(e=r.return)&&e.call(r)}finally{if(n)throw n.error}}return o}function Xi(i,t,e){if(e||arguments.length===2)for(var r=0,s=t.length,o;r<s;r++)(o||!(r in t))&&(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return i.concat(o||Array.prototype.slice.call(t))}function Hr(i){return this instanceof Hr?(this.v=i,this):new Hr(i)}function uT(i,t,e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=e.apply(i,t||[]),s,o=[];return s=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",n),s[Symbol.asyncIterator]=function(){return this},s;function n(f){return function(m){return Promise.resolve(m).then(f,u)}}function a(f,m){r[f]&&(s[f]=function(g){return new Promise(function(_,y){o.push([f,g,_,y])>1||c(f,g)})},m&&(s[f]=m(s[f])))}function c(f,m){try{l(r[f](m))}catch(g){d(o[0][3],g)}}function l(f){f.value instanceof Hr?Promise.resolve(f.value.v).then(h,u):d(o[0][2],f)}function h(f){c("next",f)}function u(f){c("throw",f)}function d(f,m){f(m),o.shift(),o.length&&c(o[0][0],o[0][1])}}function dT(i){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=i[Symbol.asyncIterator],e;return t?t.call(i):(i=typeof Nr=="function"?Nr(i):i[Symbol.iterator](),e={},r("next"),r("throw"),r("return"),e[Symbol.asyncIterator]=function(){return this},e);function r(o){e[o]=i[o]&&function(n){return new Promise(function(a,c){n=i[o](n),s(a,c,n.done,n.value)})}}function s(o,n,a,c){Promise.resolve(c).then(function(l){o({value:l,done:a})},n)}}function et(i){return typeof i=="function"}function fT(i){var t=function(r){Error.call(r),r.stack=new Error().stack},e=i(t);return e.prototype=Object.create(Error.prototype),e.prototype.constructor=e,e}var uc=fT(function(i){return function(e){i(this),this.message=e?e.length+` errors occurred during unsubscription:
1141
1141
  `+e.map(function(r,s){return s+1+") "+r.toString()}).join(`
1142
- `):"",this.name="UnsubscriptionError",this.errors=e}});function xd(i,t){if(i){var e=i.indexOf(t);0<=e&&i.splice(e,1)}}var dc=function(){function i(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return i.prototype.unsubscribe=function(){var t,e,r,s,o;if(!this.closed){this.closed=!0;var n=this._parentage;if(n)if(this._parentage=null,Array.isArray(n))try{for(var a=Nr(n),c=a.next();!c.done;c=a.next()){var l=c.value;l.remove(this)}}catch(g){t={error:g}}finally{try{c&&!c.done&&(e=a.return)&&e.call(a)}finally{if(t)throw t.error}}else n.remove(this);var h=this.initialTeardown;if(et(h))try{h()}catch(g){o=g instanceof uc?g.errors:[g]}var u=this._finalizers;if(u){this._finalizers=null;try{for(var d=Nr(u),f=d.next();!f.done;f=d.next()){var m=f.value;try{pT(m)}catch(g){o=o??[],g instanceof uc?o=Xi(Xi([],$i(o)),$i(g.errors)):o.push(g)}}}catch(g){r={error:g}}finally{try{f&&!f.done&&(s=d.return)&&s.call(d)}finally{if(r)throw r.error}}}if(o)throw new uc(o)}},i.prototype.add=function(t){var e;if(t&&t!==this)if(this.closed)pT(t);else{if(t instanceof i){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=(e=this._finalizers)!==null&&e!==void 0?e:[]).push(t)}},i.prototype._hasParent=function(t){var e=this._parentage;return e===t||Array.isArray(e)&&e.includes(t)},i.prototype._addParent=function(t){var e=this._parentage;this._parentage=Array.isArray(e)?(e.push(t),e):e?[e,t]:t},i.prototype._removeParent=function(t){var e=this._parentage;e===t?this._parentage=null:Array.isArray(e)&&xd(e,t)},i.prototype.remove=function(t){var e=this._finalizers;e&&xd(e,t),t instanceof i&&t._removeParent(this)},i.EMPTY=function(){var t=new i;return t.closed=!0,t}(),i}();var KY=dc.EMPTY;function fc(i){return i instanceof dc||i&&"closed"in i&&et(i.remove)&&et(i.add)&&et(i.unsubscribe)}function pT(i){et(i)?i():i.unsubscribe()}var ve={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};var Yi={setTimeout:function(i,t){for(var e=[],r=2;r<arguments.length;r++)e[r-2]=arguments[r];var s=Yi.delegate;return s?.setTimeout?s.setTimeout.apply(s,Xi([i,t],$i(e))):setTimeout.apply(void 0,Xi([i,t],$i(e)))},clearTimeout:function(i){var t=Yi.delegate;return(t?.clearTimeout||clearTimeout)(i)},delegate:void 0};function pc(i){Yi.setTimeout(function(){var t=ve.onUnhandledError;if(t)t(i);else throw i})}function _d(){}var mT=function(){return yd("C",void 0,void 0)}();function gT(i){return yd("E",void 0,i)}function xT(i){return yd("N",i,void 0)}function yd(i,t,e){return{kind:i,value:t,error:e}}var Wr=null;function _T(i){if(ve.useDeprecatedSynchronousErrorHandling){var t=!Wr;if(t&&(Wr={errorThrown:!1,error:null}),i(),t){var e=Wr,r=e.errorThrown,s=e.error;if(Wr=null,r)throw s}}else i()}function yT(i){ve.useDeprecatedSynchronousErrorHandling&&Wr&&(Wr.errorThrown=!0,Wr.error=i)}var Ko=function(i){Yo(t,i);function t(e){var r=i.call(this)||this;return r.isStopped=!1,e?(r.destination=e,fc(e)&&e.add(r)):r.destination=cP,r}return t.create=function(e,r,s){return new gc(e,r,s)},t.prototype.next=function(e){this.isStopped?vd(xT(e),this):this._next(e)},t.prototype.error=function(e){this.isStopped?vd(gT(e),this):(this.isStopped=!0,this._error(e))},t.prototype.complete=function(){this.isStopped?vd(mT,this):(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,i.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(e){this.destination.next(e)},t.prototype._error=function(e){try{this.destination.error(e)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(dc);var oP=Function.prototype.bind;function bd(i,t){return oP.call(i,t)}var nP=function(){function i(t){this.partialObserver=t}return i.prototype.next=function(t){var e=this.partialObserver;if(e.next)try{e.next(t)}catch(r){mc(r)}},i.prototype.error=function(t){var e=this.partialObserver;if(e.error)try{e.error(t)}catch(r){mc(r)}else mc(t)},i.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(e){mc(e)}},i}(),gc=function(i){Yo(t,i);function t(e,r,s){var o=i.call(this)||this,n;if(et(e)||!e)n={next:e??void 0,error:r??void 0,complete:s??void 0};else{var a;o&&ve.useDeprecatedNextContext?(a=Object.create(e),a.unsubscribe=function(){return o.unsubscribe()},n={next:e.next&&bd(e.next,a),error:e.error&&bd(e.error,a),complete:e.complete&&bd(e.complete,a)}):n=e}return o.destination=new nP(n),o}return t}(Ko);function mc(i){ve.useDeprecatedSynchronousErrorHandling?yT(i):pc(i)}function aP(i){throw i}function vd(i,t){var e=ve.onStoppedNotification;e&&Yi.setTimeout(function(){return e(i,t)})}var cP={closed:!0,next:_d,error:aP,complete:_d};var Ki=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function bT(i){return i}function vT(i){return i.length===0?bT:i.length===1?i[0]:function(e){return i.reduce(function(r,s){return s(r)},e)}}var at=function(){function i(t){t&&(this._subscribe=t)}return i.prototype.lift=function(t){var e=new i;return e.source=this,e.operator=t,e},i.prototype.subscribe=function(t,e,r){var s=this,o=hP(t)?t:new gc(t,e,r);return _T(function(){var n=s,a=n.operator,c=n.source;o.add(a?a.call(o,c):c?s._subscribe(o):s._trySubscribe(o))}),o},i.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(e){t.error(e)}},i.prototype.forEach=function(t,e){var r=this;return e=TT(e),new e(function(s,o){var n=new gc({next:function(a){try{t(a)}catch(c){o(c),n.unsubscribe()}},error:o,complete:s});r.subscribe(n)})},i.prototype._subscribe=function(t){var e;return(e=this.source)===null||e===void 0?void 0:e.subscribe(t)},i.prototype[Ki]=function(){return this},i.prototype.pipe=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return vT(t)(this)},i.prototype.toPromise=function(t){var e=this;return t=TT(t),new t(function(r,s){var o;e.subscribe(function(n){return o=n},function(n){return s(n)},function(){return r(o)})})},i.create=function(t){return new i(t)},i}();function TT(i){var t;return(t=i??ve.Promise)!==null&&t!==void 0?t:Promise}function lP(i){return i&&et(i.next)&&et(i.error)&&et(i.complete)}function hP(i){return i&&i instanceof Ko||lP(i)&&fc(i)}function uP(i){return et(i?.lift)}function Ue(i){return function(t){if(uP(t))return t.lift(function(e){try{return i(e,this)}catch(r){this.error(r)}});throw new TypeError("Unable to lift unknown Observable type")}}function zr(i,t,e,r,s){return new dP(i,t,e,r,s)}var dP=function(i){Yo(t,i);function t(e,r,s,o,n,a){var c=i.call(this,e)||this;return c.onFinalize=n,c.shouldUnsubscribe=a,c._next=r?function(l){try{r(l)}catch(h){e.error(h)}}:i.prototype._next,c._error=o?function(l){try{o(l)}catch(h){e.error(h)}finally{this.unsubscribe()}}:i.prototype._error,c._complete=s?function(){try{s()}catch(l){e.error(l)}finally{this.unsubscribe()}}:i.prototype._complete,c}return t.prototype.unsubscribe=function(){var e;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var r=this.closed;i.prototype.unsubscribe.call(this),!r&&((e=this.onFinalize)===null||e===void 0||e.call(this))}},t}(Ko);var xc=function(i){return i&&typeof i.length=="number"&&typeof i!="function"};function _c(i){return et(i?.then)}function yc(i){return et(i[Ki])}function bc(i){return Symbol.asyncIterator&&et(i?.[Symbol.asyncIterator])}function vc(i){return new TypeError("You provided "+(i!==null&&typeof i=="object"?"an invalid object":"'"+i+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}function fP(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var Tc=fP();function Sc(i){return et(i?.[Tc])}function wc(i){return uT(this,arguments,function(){var e,r,s,o;return hc(this,function(n){switch(n.label){case 0:e=i.getReader(),n.label=1;case 1:n.trys.push([1,,9,10]),n.label=2;case 2:return[4,Hr(e.read())];case 3:return r=n.sent(),s=r.value,o=r.done,o?[4,Hr(void 0)]:[3,5];case 4:return[2,n.sent()];case 5:return[4,Hr(s)];case 6:return[4,n.sent()];case 7:return n.sent(),[3,2];case 8:return[3,10];case 9:return e.releaseLock(),[7];case 10:return[2]}})})}function Ec(i){return et(i?.getReader)}function De(i){if(i instanceof at)return i;if(i!=null){if(yc(i))return pP(i);if(xc(i))return mP(i);if(_c(i))return gP(i);if(bc(i))return ST(i);if(Sc(i))return xP(i);if(Ec(i))return _P(i)}throw vc(i)}function pP(i){return new at(function(t){var e=i[Ki]();if(et(e.subscribe))return e.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function mP(i){return new at(function(t){for(var e=0;e<i.length&&!t.closed;e++)t.next(i[e]);t.complete()})}function gP(i){return new at(function(t){i.then(function(e){t.closed||(t.next(e),t.complete())},function(e){return t.error(e)}).then(null,pc)})}function xP(i){return new at(function(t){var e,r;try{for(var s=Nr(i),o=s.next();!o.done;o=s.next()){var n=o.value;if(t.next(n),t.closed)return}}catch(a){e={error:a}}finally{try{o&&!o.done&&(r=s.return)&&r.call(s)}finally{if(e)throw e.error}}t.complete()})}function ST(i){return new at(function(t){yP(i,t).catch(function(e){return t.error(e)})})}function _P(i){return ST(wc(i))}function yP(i,t){var e,r,s,o;return hT(this,void 0,void 0,function(){var n,a;return hc(this,function(c){switch(c.label){case 0:c.trys.push([0,5,6,11]),e=dT(i),c.label=1;case 1:return[4,e.next()];case 2:if(r=c.sent(),!!r.done)return[3,4];if(n=r.value,t.next(n),t.closed)return[2];c.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return a=c.sent(),s={error:a},[3,11];case 6:return c.trys.push([6,,9,10]),r&&!r.done&&(o=e.return)?[4,o.call(e)]:[3,8];case 7:c.sent(),c.label=8;case 8:return[3,10];case 9:if(s)throw s.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}})})}function fe(i,t,e,r,s){r===void 0&&(r=0),s===void 0&&(s=!1);var o=t.schedule(function(){e(),s?i.add(this.schedule(null,r)):this.unsubscribe()},r);if(i.add(o),!s)return o}function Pc(i,t){return t===void 0&&(t=0),Ue(function(e,r){e.subscribe(zr(r,function(s){return fe(r,i,function(){return r.next(s)},t)},function(){return fe(r,i,function(){return r.complete()},t)},function(s){return fe(r,i,function(){return r.error(s)},t)}))})}function Ac(i,t){return t===void 0&&(t=0),Ue(function(e,r){r.add(i.schedule(function(){return e.subscribe(r)},t))})}function wT(i,t){return De(i).pipe(Ac(t),Pc(t))}function ET(i,t){return De(i).pipe(Ac(t),Pc(t))}function PT(i,t){return new at(function(e){var r=0;return t.schedule(function(){r===i.length?e.complete():(e.next(i[r++]),e.closed||this.schedule())})})}function AT(i,t){return new at(function(e){var r;return fe(e,t,function(){r=i[Tc](),fe(e,t,function(){var s,o,n;try{s=r.next(),o=s.value,n=s.done}catch(a){e.error(a);return}n?e.complete():e.next(o)},0,!0)}),function(){return et(r?.return)&&r.return()}})}function Cc(i,t){if(!i)throw new Error("Iterable cannot be null");return new at(function(e){fe(e,t,function(){var r=i[Symbol.asyncIterator]();fe(e,t,function(){r.next().then(function(s){s.done?e.complete():e.next(s.value)})},0,!0)})})}function CT(i,t){return Cc(wc(i),t)}function MT(i,t){if(i!=null){if(yc(i))return wT(i,t);if(xc(i))return PT(i,t);if(_c(i))return ET(i,t);if(bc(i))return Cc(i,t);if(Sc(i))return AT(i,t);if(Ec(i))return CT(i,t)}throw vc(i)}function te(i,t){return t?MT(i,t):De(i)}function BT(i,t){return Ue(function(e,r){var s=0;e.subscribe(zr(r,function(o){r.next(i.call(t,o,s++))}))})}function RT(i,t,e,r,s,o,n,a){var c=[],l=0,h=0,u=!1,d=function(){u&&!c.length&&!l&&t.complete()},f=function(g){return l<r?m(g):c.push(g)},m=function(g){o&&t.next(g),l++;var _=!1;De(e(g,h++)).subscribe(zr(t,function(y){s?.(y),o?f(y):t.next(y)},function(){_=!0},void 0,function(){if(_)try{l--;for(var y=function(){var b=c.shift();n?fe(t,n,function(){return m(b)}):m(b)};c.length&&l<r;)y();d()}catch(b){t.error(b)}}))};return i.subscribe(zr(t,f,function(){u=!0,d()})),function(){a?.()}}function jt(i,t,e){return e===void 0&&(e=1/0),et(t)?jt(function(r,s){return BT(function(o,n){return t(r,o,s,n)})(De(i(r,s)))},e):(typeof t=="number"&&(e=t),Ue(function(r,s){return RT(r,s,i,e)}))}function qo(i){return Ue(function(t,e){try{t.subscribe(e)}finally{e.add(i)}})}var bP=i=>i.split("/").pop(),Td=class{name="advancedBufferLoader";priority=2;constructor(t){this.bufferMap=t}test(t){return!0}async load(t){let e=t.startsWith("file:")?t:bP(t),r=this.bufferMap[e];if(!r)throw new Error(`Buffer not found for key: ${e}`);return{data:r.buffer,type:r.type,metadata:null}}async testParse(t){return!0}async parse(t){if(t instanceof A)return t;let e=new Blob([t.data],{type:t.type}),r=await createImageBitmap(e);return new A.from(r)}async unload(t){t.destroy(!0)}},Sd=class i extends ac{static rendererName="pixi";_app;_audioStage=new lc;_state={elements:[]};_eventHandler;_plugins;_currentSubscription;_advancedLoader;get canvas(){return this._app.canvas}init=async t=>{let{eventHandler:e,plugins:r,width:s,height:o,backgroundColor:n}=t;for(let c of r)if(c.rendererName!==i.rendererName)throw new Error("Plugin does not match renderer name");this._plugins=r,this._eventHandler=e,this._app=new Qa,this._app.audioStage=this._audioStage,await this._app.init({width:s,height:o,backgroundColor:n});let a=new Wt;return a.rect(0,0,s,o),a.fill(n||0),this._app.stage.addChild(a),this._app.stage.width=s,this._app.stage.height=o,this._app.ticker.add(this._app.audioStage.tick),this};destroy=()=>{this._app.audioStage.destroy(),this._app.destroy()};loadAssets=async t=>{if(!t)throw new Error("assetBufferMap is required");let e={},r={};for(let[o,n]of Object.entries(t))n.type&&n.type.startsWith("audio/")?r[o]=n:e[o]=n;await Promise.all(Object.entries(r).map(([o,n])=>ji.load(o,n.buffer))),this._advancedLoader?Object.assign(this._advancedLoader.bufferMap,e):(this._advancedLoader=new Td(e),be.loader.parsers.length=0,be.reset(),R.add({name:"advanced-buffer-loader",extension:x.Asset,priority:Et.High,loader:this._advancedLoader}),typeof be.registerPlugin=="function"&&be.registerPlugin(this._advancedLoader));let s=Object.keys(e);return Promise.all(s.map(o=>be.load(o)))};loadAudioAssets=async t=>Promise.all(t.map(async e=>{let s=await(await fetch(e)).arrayBuffer();return ji.load(e,s)}));updatedBackgroundColor=t=>{this._app.renderer.background.color=t};render=t=>{this._render(this._app,this._app.stage,this._state,t,this._eventHandler),this._state=t};_getRendererByElement=t=>{for(let e of this._plugins)if(e.rendererType===t.type)return e;throw new Error(`No renderer found for element type: ${t.type}`)};_getTransitionByType=t=>{for(let e of this._plugins)if(e.transitionType===t)return e;throw new Error(`No transition found for transition type: ${t}`)};_render=async(t,e,r,s,o)=>{let n=Date.now(),{toAddElements:a,toUpdateElements:c,toDeleteElements:l}=cc(r.elements,s.elements),h=[];for(let u of l){let d=this._getRendererByElement(u);h.push(d.remove(t,{parent:e,element:u,transitions:s.transitions,getRendererByElement:this._getRendererByElement,getTransitionByType:this._getTransitionByType,eventHandler:o}))}for(let u of a){let d=this._getRendererByElement(u);h.push(d.add(t,{parent:e,element:u,getRendererByElement:this._getRendererByElement,transitions:s.transitions,getTransitionByType:this._getTransitionByType,eventHandler:o}))}for(let u of c){let d=this._getRendererByElement(u.next);h.push(d.update(t,{parent:e,prevElement:u.prev,nextElement:u.next,getRendererByElement:this._getRendererByElement,transitions:s.transitions,getTransitionByType:this._getTransitionByType,eventHandler:o}))}t.stage.children.sort((u,d)=>{let f=s.elements.findIndex(g=>g.id===u.label),m=s.elements.findIndex(g=>g.id===d.label);return f-m}),this._currentSubscription&&(this._currentSubscription.closed||this._currentSubscription.unsubscribe()),this._currentSubscription=te(h).pipe(jt(u=>u),qo(()=>{o&&o("completed",{id:s.id,diffTime:Date.now()-n}),this._currentSubscription=void 0})).subscribe({error:u=>{console.error("Error:",u)}})}},GT=Sd;var wd=class extends fr{static rendererName="pixi";rendererName="pixi";rendererType="sprite";add=(t,e)=>new at(r=>{let{parent:s,element:o,transitions:n=[],getTransitionByType:a,eventHandler:c}=e,l=A.from(o.url),h,u;o.hoverUrl&&(h=A.from(o.hoverUrl)),o.clickUrl&&(u=A.from(o.clickUrl));let d=new Lt(l);d.label=o.id,(o.eventName||o.hoverUrl||o.clickUrl)&&(d.cursor="pointer",d.eventMode="static"),o.xa!==void 0&&(typeof o.xa=="string"&&o.xa.endsWith("%")?d.pivot.x=Number(o.xa.replace("%",""))*d.width/100:d.pivot.x=o.xa),o.ya!==void 0&&(typeof o.ya=="string"&&o.ya.endsWith("%")?d.pivot.y=Number(o.ya.replace("%",""))*d.height/100:d.pivot.y=o.ya),o.x!==void 0&&(typeof o.x=="string"&&o.x.endsWith("%")?d.x=Number(o.x.replace("%",""))*t.screen.width/100:d.x=o.x),o.y!==void 0&&(typeof o.y=="string"&&o.y.endsWith("%")?d.y=Number(o.y.replace("%",""))*t.screen.height/100:d.y=o.y),o.width!==void 0&&(d.width=o.width),o.height!==void 0&&(d.height=o.height),o.zIndex!==void 0&&(d.zIndex=o.zIndex),o.alpha!==void 0&&(d.alpha=o.alpha),d.on("pointerup",()=>{d.texture=l}).on("pointerupoutside",()=>{d.texture=l}).on("pointerleave",()=>{d.texture=l}),u&&d.on("pointerdown",()=>{d.texture=u}),h&&d.on("pointerenter",()=>{d.texture=h}),d.on("pointerup",g=>{g.stopPropagation();let _=g.button;_===0?c&&c(o.eventName,o.eventPayload):_===2&&(o.rightClickEventName&&c?c(o.rightClickEventName):t.stage.emit("rightclick",event))});let f=[];for(let g of n)if(g.elementId===o.id&&g.event===Vt.Add){let _=a(g.type);if(!_)throw new Error(`Transition class not found for type ${g.type}`);f.push(_.add(t,d,g))}s.addChild(d);let m=te(f).pipe(jt(g=>g)).subscribe({error:g=>{console.error("Error:",g)},complete:()=>r.complete()});return()=>{m.unsubscribe()}});remove=(t,e)=>new at(r=>{let{parent:s,element:o,transitions:n=[],getTransitionByType:a}=e,c=s.getChildByName(o.id);if(!c)throw new Error(`Sprite with id ${o.id} not found`);let l=[];for(let u of n)if(u.elementId===o.id&&u.event===Vt.Remove){let d=a(u.type);if(!d)throw new Error(`Transition class not found for type ${u.type}`);l.push(d.remove(t,c,u))}let h=te(l).pipe(jt(u=>u)).subscribe({error:u=>{console.error("Error:",u)},complete:()=>{r.complete(),c&&c.destroy()}});return()=>{h.unsubscribe(),c&&c.destroy()}});update=(t,{parent:e,prevElement:r,nextElement:s,transitions:o,getTransitionByType:n,eventHandler:a})=>new at(c=>{let l=e.getChildByName(r.id);if(!l)throw new Error(`Sprite with id ${r.id} not found`);if(JSON.stringify(r)!==JSON.stringify(s)){let h=[this.add(t,{parent:e,element:s,transitions:o,getTransitionByType:n,eventHandler:a}),this.remove(t,{parent:e,element:r,transitions:o,getTransitionByType:n})],u=te(h).pipe(jt(d=>d)).subscribe({error:d=>{console.error("Error:",d)},complete:()=>c.complete()});return()=>{u.unsubscribe()}}else s.x!==void 0&&(typeof s.x=="string"&&s.x.endsWith("%")?l.x=Number(s.x.replace("%",""))*t.screen.width/100:l.x=s.x),s.y!==void 0&&(typeof s.y=="string"&&s.y.endsWith("%")?l.y=Number(s.y.replace("%",""))*t.screen.height/100:l.y=s.y),s.width!==void 0&&s.width!==r.width&&(l.width=s.width),s.height!==void 0&&s.height!==r.height&&(l.height=s.height),s.alpha!==void 0&&s.alpha!==r.alpha&&(l.alpha=s.alpha),c.complete();return()=>{}})};var Mc=(i,t=!1)=>new St({wordWrap:i.wordWrap||!0,breakWords:t,align:i.align,fill:i.fill,fontSize:i.fontSize,lineHeight:i.lineHeight,wordWrapWidth:i.wordWrapWidth,fontFamily:i.fontFamily||"Roboto",stroke:i.strokeColor?{color:i.strokeColor,width:i.strokeWidth}:void 0}),Ed=class{static rendererName="pixi";rendererName="pixi";rendererType="text";add=(t,e)=>new at(r=>{let{parent:s,element:o,transitions:n=[],getTransitionByType:a,eventHandler:c}=e,l=Mc(o.style),h=new dr({text:o.text,style:l}),u;o.hoverStyle&&(u=Mc(o.hoverStyle));let d;if(o.clickedStyle&&(d=Mc(o.clickedStyle)),(o.eventName||o.clickedStyle||o.hoverStyle)&&(h.cursor="pointer",h.eventMode="static"),h.label=o.id,o.x!==void 0&&(h.x=o.x),o.y!==void 0&&(h.y=o.y),o.xa!==void 0&&(h.anchor.x=o.xa),o.ya!==void 0&&(h.anchor.y=o.ya),o.xa!==void 0||o.ya!==void 0){let g=h.getLocalBounds();h.hitArea=new z(-g.width*h.anchor.x,-g.height*h.anchor.y,g.width,g.height)}h.on("pointerupoutside",()=>{h.style=l}).on("pointerup",()=>{h.style=l}).on("pointerleave",()=>{h.style=l}),h.on("pointerup",g=>{o.clickSoundUrl&&t.soundStage&&t.soundStage.add({id:`${o.id}-click-${Math.random()}`,url:o.clickSoundUrl,loop:!1,volume:o.clickSoundVolume??50/100}),g.stopPropagation(),c&&c(o.eventName,o.eventPayload)}),d&&h.on("pointerdown",()=>{h.style=d}),u&&h.on("pointerenter",()=>{h.style=u,o.hoverSoundUrl&&t.soundStage&&o.hoverSoundVolume!==void 0&&t.soundStage.add({id:`${o.id}-hover-${Math.random()}`,url:o.hoverSoundUrl,loop:!1,volume:o.hoverSoundVolume/100})});let f=[];for(let g of n)if(g.elementId===o.id&&g.event===Vt.Add){let _=a(g.type);if(!_)throw new Error(`Transition class not found for type ${g.type}`);f.push(_.add(t,h,g))}s.addChild(h);let m=te(f).pipe(jt(g=>g)).subscribe({error:g=>{console.error("Error:",g),r.error(g)},complete:()=>r.complete()});return()=>{m.unsubscribe()}});remove=(t,e)=>new at(r=>{let{parent:s,element:o,transitions:n=[],getTransitionByType:a}=e,c=s.getChildByName(o.id);if(!c){console.warn(`Text with id ${o.id} not found`),r.complete();return}let l=[];for(let u of n)if(u.elementId===o.id&&u.event===Vt.Remove){let d=a(u.type);if(!d)throw new Error(`Transition class not found for type ${u.type}`);l.push(d.remove(t,c,u))}let h=te(l).pipe(jt(u=>u)).subscribe({error:u=>{console.error("Error:",u),r.error(u)},complete:()=>{c.destroy(),r.complete()}});return()=>{h.unsubscribe(),c&&c.destroy()}});update=(t,e)=>new at(r=>{let{parent:s,prevElement:o,nextElement:n,transitions:a,getTransitionByType:c,eventHandler:l}=e,h=s.getChildByName(o.id);if(!h){console.warn(`Text with id ${o.id} not found`),r.complete();return}if(JSON.stringify(o)!==JSON.stringify(n)){let u=[this.add(t,{parent:s,element:n,transitions:a,getTransitionByType:c,eventHandler:l}),this.remove(t,{parent:s,element:o,transitions:a,getTransitionByType:c})],d=te(u).pipe(jt(f=>f)).subscribe({error:f=>{console.error("Error:",f),r.error(f)},complete:()=>r.complete()});return()=>{d.unsubscribe()}}else o.text!==n.text&&(h.text=n.text),JSON.stringify(o.style)!==JSON.stringify(n.style)&&(h.style=Mc(n?.style)),n.x!==void 0&&(h.x=n.x),n.y!==void 0&&(h.y=n.y),r.complete();return()=>{}})};var qi=(i,t=!1)=>new St({wordWrap:i.wordWrap||!0,breakWords:t,align:i.align,fill:i.fill,fontSize:i.fontSize,lineHeight:i.lineHeight,wordWrapWidth:i.wordWrapWidth,fontFamily:i.fontFamily||"Roboto",stroke:i.strokeColor?{color:i.strokeColor,width:i.strokeWidth}:void 0}),Pd=class{static rendererName="pixi";rendererName="pixi";rendererType="text-revealing";add=async(t,{parent:e,element:r})=>{let s=qi(r.style,r.text),o=new dr({text:"",style:s});o.label=r.id,o.text_id=r.text;let n=new nt;r.x!==void 0&&(n.x=r.x),r.y!==void 0&&(n.y=r.y),n.addChild(o),n.label=r.id,e.addChild(n);let a=r.style.wordWrapWidth||500,c=r.text?[{text:r.text,style:r.style}]:r.segments,l=[],h=[],u=0,d=0,f=0;for(;;){let S=c[0];if(!S){h.length>0&&l.push({lineParts:h,y:d});break}if(d>1e4)break;let E={...S.style,wordWrapWidth:a-u},C=At.measureText(S.text,qi(E));C.lineHeight>f&&(f=C.lineHeight);let I=At.measureText("a",qi(E)),k=At.measureText("a a",qi(E)).width-I.width*2;if(C.lineWidths[0]+u>a){u=0,l.push({lineParts:h,y:d}),d+=f,f=0,h=[];continue}let L=C.lines[0],Y=C.lines.slice(1).join(" "),mt={text:L,style:E,x:u,y:0};if(h.push(mt),Y&&Y.length>0?S.text=Y:c.shift(),!(!L||L.length===0)){if(S.furigana){let $t=At.measureText(S.furigana.text,qi(S.furigana.style)),N={text:S.furigana.text,style:S.furigana.style,x:u+(C.width-$t.width)/2,y:-10};h.push(N)}u+=C.lineWidths[0]+k}}l.forEach(S=>{let E=new nt;E.y=S.y,E.alpha=0,S.lineParts.forEach(C=>{let I=new dr({text:C.text,style:qi(C.style),x:C.x,y:C.y});E.addChild(I)}),n.addChild(E)});let m=new Wt,g=1e3,_=a/2,y=a/2;m.fill({color:16777215,alpha:1}),m.rect(0,0,_,g);for(let S=0;S<y;S++)m.fill({color:16777215,alpha:1-S/y}),m.rect(_+S,0,_+1,g);let b=t.renderer.generateTexture(m),v=new Lt(b);v.x=-1.35*_-y,t.stage.addChild(v);let T=0,P=1;if(l.length!==0){if(r.displaySpeed===100||r.hasEnded){n.children.forEach(S=>{t.stage.removeChild(v),S.mask=null,S.alpha=1});return}await new Promise(S=>{let E=C=>{if(P>n.children.length){S();return}n.getChildAt(P).mask||(n.getChildAt(P).mask=v,n.getChildAt(P).alpha=1),T+=C.deltaMS;let M=(r.displaySpeed||50)/1e3;v.x+=M*T,v.x>=0&&(n.getChildAt(P).mask=null,v.x=-1.35*_-y,P=P+1,T=0,P>=n.children.length&&(n.getChildAt(P-1).mask=null,t.ticker.remove(E),S()))};t.ticker.add(E)})}};remove=async(t,e)=>{let{parent:r,element:s,transitions:o=[],getTransitionByType:n}=e,a=r.getChildByName(s.id);if(!a){console.warn(`Text with id ${s.id} not found`,{parent:r});return}let c=[];for(let l of o)if(l.elementId===s.id&&l.event===Vt.Remove){let h=n(l.type);if(!h)throw new Error(`Transition class not found for type ${l.type}`);c.push(h.remove(t,a,l))}await Promise.all(c),a.destroy()};update=async(t,e)=>{let{parent:r,prevElement:s,nextElement:o}=e;if(!r.getChildByName(s.id)){console.warn(`Text with id ${s.id} not found`,{parent:r});return}await this.remove(t,{parent:r,element:s}),await this.add(t,{parent:r,element:o})}};var Te={TopLeft:"TopLeft",TopCenter:"TopCenter",TopRight:"TopRight",CenterLeft:"CenterLeft",CenterCenter:"CenterCenter",CenterRight:"CenterRight",BottomLeft:"BottomLeft",BottomCenter:"BottomCenter",BottomRight:"BottomRight"},kT={[Te.TopLeft]:{x:0,y:0},[Te.TopCenter]:{x:.5,y:0},[Te.TopRight]:{x:1,y:0},[Te.CenterLeft]:{x:0,y:.5},[Te.CenterCenter]:{x:.5,y:.5},[Te.CenterRight]:{x:1,y:.5},[Te.BottomLeft]:{x:0,y:1},[Te.BottomCenter]:{x:.5,y:1},[Te.BottomRight]:{x:1,y:1}},Ad=class{static rendererName="pixi";rendererName="pixi";rendererType="container";add=(t,e)=>new at(r=>{let{parent:s,element:o,transitions:n=[],getTransitionByType:a,getRendererByElement:c,eventHandler:l}=e,h=new nt;h.label=o.id;let u={};o.x!==void 0&&(typeof o.x=="string"&&o.x.endsWith("%")?h.x=Number(o.x.replace("%",""))*t.screen.width/100:h.x=o.x),o.y!==void 0&&(typeof o.y=="string"&&o.y.endsWith("%")?h.y=Number(o.y.replace("%",""))*t.screen.height/100:h.y=o.y),o.scaleX!==void 0&&(h.scale.x=o.scaleX),o.scaleY!==void 0&&(h.scale.y=o.scaleY),o.zIndex!==void 0&&(h.zIndex=o.zIndex),o.propagateEvents&&(h.eventMode="static",["pointerup","pointerupoutside","pointerleave","pointerdown","pointerenter"].forEach(y=>{h.on(y,b=>{b.stopPropagation();for(let v of h.children)v.emit(y)})}));let d=o.gap||0,f=new Wt().roundRect(0,0,o.width||0,o.height||0,1).fill(o.fill?o.fill.color:"transparent");if(o.direction){let y,b;o.direction==="horizontal"?(y=o.children.reduce((T,P)=>T+P.width+d,0),b=o.children.reduce((T,P)=>Math.max(T,P.height||0),0)):o.direction==="vertical"&&(y=o.children.reduce((T,P)=>Math.max(T,P.width||0),0),b=o.children.reduce((T,P)=>T+P.height+d,0));let v=kT[o.anchor||Te.TopLeft];o.direction==="horizontal"?this.layoutChildren({element:o,anchor:v,totalWidth:y,totalHeight:b,gap:d,direction:"horizontal",scroll:o.scroll}):o.direction==="vertical"&&this.layoutChildren({element:o,anchor:v,totalWidth:y,totalHeight:b,gap:d,direction:"vertical",scroll:o.scroll}),this.setupScrolling({container:h,element:o,totalHeight:b,totalWidth:y,eventHandler:l,sliderRef:u}),f=this.createContainerGraphic(o,y,b,v)}f.label=`${o.id}-container-background`,h.addChild(f);let m=[];(o.children||[]).forEach(y=>{let b=c(y);m.push(b.add(t,{parent:h,element:{zIndex:o.zIndex,...y},transitions:n,getTransitionByType:a,getRendererByElement:c,eventHandler:l}))});let g=[];for(let y of n)if(y.elementId===o.id&&y.event===Vt.Add){let b=a(y.type);if(!b)throw new Error(`Transition class not found for type ${y.type}`);g.push(b.add(t,h,y))}s.addChild(h);let _=te(m).pipe(jt(y=>y)).subscribe({error:y=>{console.error("Error:",y)},complete:()=>{console.log("complete"),r.complete()}});return()=>{_.unsubscribe()}});remove=(t,e)=>(console.log("remove container 11111111111"),new at(r=>{let{parent:s,element:o}=e,n=s.getChildByName(o.id);if(!n){console.warn(`Container with id ${o.id} not found`);return}return n.destroy(),()=>{n.destroy()}}));update=(t,e)=>new at(r=>{let{parent:s,prevElement:o,nextElement:n,getRendererByElement:a,transitions:c=[],getTransitionByType:l,eventHandler:h}=e,u=s.getChildByName(o.id);if(!u){console.warn(`Container with id ${o.id} not found`);return}if(n.x!==void 0&&n.x!==o.x&&(u.x=n.x),n.y!==void 0&&n.y!==o.y&&(u.y=n.y),n.direction){let _=n.gap||0,y,b;n.direction==="horizontal"?(y=n.children.reduce((P,S)=>P+S.width+_,0),b=n.children.reduce((P,S)=>Math.max(P,S.height||0),0)):n.direction==="vertical"&&(y=n.children.reduce((P,S)=>Math.max(P,S.width||0),0),b=n.children.reduce((P,S)=>P+S.height+_,0));let v=kT[n.anchor||Te.TopLeft];n.direction==="horizontal"?this.layoutChildren({element:n,anchor:v,totalWidth:y,totalHeight:b,gap:_,direction:"horizontal",scroll:n.scroll}):n.direction==="vertical"&&this.layoutChildren({element:n,anchor:v,totalWidth:y,totalHeight:b,gap:_,direction:"vertical",scroll:n.scroll});let T=u.children.find(P=>P.label===`${n.id}-container-background`);if(T){T.destroy();let P=this.createContainerGraphic(n,y,b,v);P.label=`${n.id}-container-background`,u.addChildAt(P,0)}o.scroll!==n.scroll&&this.setupScrolling({container:u,element:n,totalHeight:b,totalWidth:y,eventHandler:h,sliderRef:{}})}let d=[],{toAddElements:f,toUpdateElements:m,toDeleteElements:g}=cc(o.children,n.children);for(let _ of g){let y=a(_);d.push(y.remove(t,{parent:u,element:_,transitions:c,getTransitionByType:l,getRendererByElement:a,eventHandler:h}))}for(let _ of f){let y=a(_);d.push(y.add(t,{parent:u,element:_,transitions:c,getTransitionByType:l,getRendererByElement:a,eventHandler:h}))}for(let _ of m){let y=a(_.next);d.push(y.update(t,{parent:u,prevElement:_.prev,nextElement:_.next,transitions:c,getTransitionByType:l,getRendererByElement:a,eventHandler:h}))}return u.children.sort((_,y)=>{let b=n.children?.findIndex(T=>T.id===_.label),v=n.children?.findIndex(T=>T.id===y.label);return b-v}),this._currentSubscription=te(d).pipe(jt(_=>_),qo(()=>{r.complete()})).subscribe({error:_=>{r.error(_),console.error("Error:",_)}}),()=>{this._currentSubscription?.unsubscribe()}});layoutChildren({element:t,anchor:e,totalWidth:r,totalHeight:s,gap:o,direction:n,scroll:a}){let c=n==="horizontal",l=c?"x":"y",h=c?"y":"x",u=c?"width":"height",d=c?"height":"width",f=c?r:s,m=c?s:r,g=c?e.x:e.y,_=c?e.y:e.x;if(!a&&t[u]!==void 0&&t[u]<f){let b=0,v=0,T=0,P=0;(t.children||[]).forEach((S,E)=>{b>0&&b+S[u]>t[u]&&(this.alignRowElements(t.children.slice(P,E),l,g,t[u]),b=0,v+=T+o,T=0,P=E),S[l]=b,S[h]=v,b+=S[u]+o,T=Math.max(T,S[d]||0)}),P<t.children.length&&this.alignRowElements(t.children.slice(P),l,g,t[u])}else{if(g===0){let b=0;(t.children||[]).forEach(v=>{v[l]=b,b+=v[u]+o})}else if(g===1){let b=-f;(t.children||[]).forEach(v=>{v[l]=b,b+=v[u]+o})}else if(g===.5){let b=-f/2;(t.children||[]).forEach(v=>{v[l]=b,b+=v[u]+o})}_===0?(t.children||[]).forEach(b=>{b[h]=0}):_===.5?(t.children||[]).forEach(b=>{b[h]=-m/2}):_===1&&(t.children||[]).forEach(b=>{b[h]=-m})}}alignRowElements(t,e,r,s){if(!t.length)return;let o=t.reduce((n,a,c)=>n+a[e==="x"?"width":"height"]+(c>0,0),0);if(r===.5){let a=(s-o)/2;t.forEach(c=>{c[e]=a,a+=c[e==="x"?"width":"height"]+0})}else if(r===1){let a=s-o;t.forEach(c=>{c[e]=a,a+=c[e==="x"?"width":"height"]+0})}}createContainerGraphic(t,e,r,s){let o=new Wt().roundRect(0,0,e,r,1).fill(t.fill?t.fill.color:"transparent");return s.x===1&&(o.x-=t.width),s.x===-.5&&(o.x-=t.width/2),o}setupScrolling({container:t,element:e,totalHeight:r,totalWidth:s,eventHandler:o,sliderRef:n}){let a=e.scroll&&e.height&&r>e.height,c=e.scroll&&e.width&&s>e.width;if(a||c){let l=0,h=0,u=-r+e.height,d=-s+e.width,f=new Wt().rect(0,0,e.width||s,e.height||r).fill("red");t.mask=f,t.eventMode="static",t.addChild(f),t.on("wheel",m=>{if(a&&m.deltaY!==0&&(l-m.deltaY>0||l-m.deltaY<u||(l-=m.deltaY,t.y-=m.deltaY,f.y+=m.deltaY)),c&&(m.deltaX!==0||m.shiftKey&&m.deltaY!==0)){let g=m.deltaX!==0?m.deltaX:m.deltaY;if(h-g>0||h-g<d)return;h-=g,t.x-=g,f.x+=g}})}}};var vP={linear:i=>i},TP=(i,t,e,r)=>i+(t-i)*vP[r](e);function IT(i,t,e){typeof t=="string"&&(t=t.split("."));let r=i;for(let s of t){if(r==null)return e;r=r[s]}return r===void 0?e:r}function FT(i,t,e){typeof t=="string"&&(t=t.split("."));let r=i;for(let s=0;s<t.length-1;s++){let o=t[s];o in r||(r[o]={}),r=r[o]}return r[t[t.length-1]]=e,i}var SP=(i,t)=>{let e=[],r=0,s;i.forEach(({value:n,duration:a,easing:c,relative:l},h)=>{h===0?(s=n,e.push({time:r,value:n,easing:"linear"})):a!==void 0&&c!==void 0&&(r+=a,l?s=s+n:s=n,e.push({time:r,value:s,easing:c}))});let o=0;for(let n=0;n<e.length-1;n++){let{time:a,value:c,easing:l}=e[n],{time:h,value:u}=e[n+1];if(t>=a&&t<=h){let d=(t-a)/(h-a);o=TP(c,u,d,l);break}else t>h&&(o=u)}return o};function wP(i){return Math.max.apply(null,i)}var Cd=class{static rendererName="pixi";rendererName="pixi";transitionType="keyframes";_transition=(t,e,r)=>(console.log("keyframe transition setup"),new at(s=>{console.log("keyframe transition start");let{animationProperties:o}=r,n=Array.isArray(o)?o:Object.entries(o).map(([d,f])=>({...f,property:d})),a=n.map(d=>d.keyframes.reduce((f,m)=>f+m.duration||0,0)),c=wP(a),l=0,h={};n.forEach(d=>{h[d.property]=IT(e,d.property)});let u=d=>{if(l+=d.deltaMS,l>=c){t.ticker.remove(u),s.complete();return}let f={};n.forEach(m=>{let g=[];m.initialValue!==void 0?g=[{value:m.initialValue,duration:0}]:g=[{value:h[m.property],duration:0}],g=g.concat(m.keyframes),FT(f,m.property,SP(g,l))}),n.forEach(m=>{let{property:g}=m;e&&!e.destroyed&&FT(e,g,IT(f,g))})};return t.ticker.add(u),()=>{t.ticker.remove(u),u({deltaMS:c-l})}}));add=(t,e,r)=>this._transition(t,e,r);remove=(t,e,r)=>this._transition(t,e,r)};var Md=class{static rendererName="pixi";rendererName="pixi";rendererType="rect";add=async(t,e)=>{let{parent:r,element:s,transitions:o=[],getTransitionByType:n,eventHandler:a}=e,c=new Wt;c.label=s.id,s.x!==void 0&&(c.x=s.x),s.y!==void 0&&(c.y=s.y),s.alpha!==void 0&&(c.alpha=s.alpha),s.sx!==void 0&&(c.scale.x=s.sx),s.sy!==void 0&&(c.scale.y=s.sy),s.r!==void 0&&(c.rotation=s.r*Math.PI/180);let l=s.width!==void 0?s.width:s.w,h=s.height!==void 0?s.height:s.h;c.rect(0,0,l,h),c.fill(s.fill),(s.clickEventName||s.rightClickEventName)&&a&&(c.eventMode="static",c.on("pointerup",d=>{d.button===0?a(s.clickEventName):d.button===2&&a(s.rightClickEventName)})),s.wheelEventName&&a&&(c.eventMode="static",c.on("wheel",d=>{a(s.wheelEventName,{deltaY:d.deltaY})}));let u=[];for(let d of o)if(d.elementId===s.id&&d.event===Vt.Add){let f=n(d.type);if(!f)throw new Error(`Transition class not found for type ${d.type}`);u.push(f.add(t,c,d))}r.addChild(c),await Promise.all(u)};remove=async(t,e)=>{let{parent:r,element:s}=e,o=r.getChildByName(s.id);if(!o)throw new Error(`Sprite with id ${s.id} not found`);o.destroy()};update=async(t,e)=>{let{parent:r,prevElement:s,nextElement:o,transitions:n=[],getTransitionByType:a,eventHandler:c}=e;if(!r.getChildByName(s.id))throw new Error(`Container with id ${s.id} not found`);JSON.stringify(s)!==JSON.stringify(o)&&await Promise.all([this.remove(t,{parent:r,element:s,transitions:n,getTransitionByType:a,eventHandler:c}),this.add(t,{parent:r,element:o,transitions:n,getTransitionByType:a,eventHandler:c})])}};var Bd=class extends fr{static rendererName="pixi";rendererName="pixi";rendererType="slider";add=async(t,{parent:e,element:r,transitions:s=[],getTransitionByType:o,eventHandler:n,ref:a})=>{let{direction:c,idleThumb:l,hoverThumb:h,idleBar:u,hoverBar:d,dragEndEventName:f,dragEventName:m,dragEventPayload:g,initialValue:_}=r,y={horizontal:{axis:"x",size:"width"},vertical:{axis:"y",size:"height"}},b=y[c].axis,v=y[c].size,T=A.from(l),P=A.from(h),S=A.from(u),E=A.from(d),C=new Lt({texture:S,anchor:{x:0,y:0}});C.label=r.id;let I=C[v];C.x=r.x||0,C.y=r.y||0;let M=new Lt({texture:T,anchor:{x:.5,y:.5}});if(M.y=C.height/2,M.x=C.width/2,M.eventMode="static",M.cursor="pointer",C.eventMode="static",C.cursor="pointer",M.on("pointerdown",Y).on("pointerup",mt).on("pointerupoutside",mt),C.on("pointerdown",k).on("pointerup",L).on("pointerupoutside",L),C.addChild(M),_!==void 0){let F=M[v]/2;M[b]=_/100*(I-M[v])+F}function k(F){M.texture=P,C.texture=E,$t(F),t.stage.eventMode="static",t.stage.addEventListener("pointermove",$t)}function L(F){M.texture=T,C.texture=S,$t(F),t.stage.eventMode="auto",t.stage.removeEventListener("pointermove",$t)}function Y(F){F.stopPropagation(),M.texture=P,C.texture=E,t.stage.eventMode="static",t.stage.addEventListener("pointermove",$t)}function mt(F){if(M.texture=T,C.texture=S,t.stage.eventMode="auto",t.stage.removeEventListener("pointermove",$t),f){let Se=C.toLocal(F.global)[b],q=M[v]/2;M[b]=Math.max(0+q,Math.min(Se,I-q));let ee=Math.floor((M[b]-q)/(I-M[v])*100),Oe=JSON.stringify(g);n&&n(f,JSON.parse(Oe.replace('"{{ value }}"',String(ee))))}}function $t(F){let Se=C.toLocal(F.global)[b],q=M[v]/2;M[b]=Math.max(0+q,Math.min(Se,I-q));let ee=Math.floor((M[b]-q)/(I-M[v])*100);if(m){let Oe=JSON.stringify(g);n&&n(m,JSON.parse(Oe.replace('"{{ value }}"',String(ee))))}return ee}a&&(a.current={updateValue:F=>{let Se=M[v]/2;M[b]=F/100*(I-M[v])+Se}});let N=[];for(let F of s)if(F.elementId===r.id&&F.event===Vt.Add){let Se=o(F.type);if(!Se)throw new Error(`Transition class not found for type ${F.type}`);N.push(Se.add(t,C,F))}e.addChild(C),await Promise.all(N)};remove=async(t,e)=>{let{parent:r,element:s,transitions:o=[],getTransitionByType:n}=e,a=r.getChildByName(s.id);if(!a){console.warn(`Sprite with id ${s.id} not found`);return}let c=[];for(let l of o)if(l.elementId===s.id&&l.event===Vt.Remove){let h=n(l.type);if(!h)throw new Error(`Transition class not found for type ${l.type}`);c.push(h.remove(t,a,l))}await Promise.all(c),a.destroy()};update=async(t,{parent:e,prevElement:r,nextElement:s,transitions:o,getTransitionByType:n,eventHandler:a})=>{if(!e.getChildByName(r.id)){console.warn(`Slider with id ${r.id} not found`,{parent:e});return}JSON.stringify(r)!==JSON.stringify(s)&&await Promise.all([this.remove(t,{parent:e,element:r,transitions:o,getTransitionByType:n,eventHandler:a}),this.add(t,{parent:e,element:s,transitions:o,getTransitionByType:n,eventHandler:a})])}};var Rd=class extends fr{static rendererName="pixi";rendererName="pixi";rendererType="audio";add=async(t,{parent:e,element:r,transitions:s=[],getTransitionByType:o})=>{r.delay?setTimeout(()=>{t.audioStage.add({id:r.id,url:r.url,loop:r.loop??!1,volume:r.volume??1})},r.delay):t.audioStage.add({id:r.id,url:r.url,loop:r.loop??!1,volume:r.volume??1})};remove=async(t,e)=>{let{element:r}=e;t.audioStage.remove(r.id)};update=async(t,{parent:e,prevElement:r,nextElement:s,transitions:o,getTransitionByType:n})=>{if(r.url!==s.url||r.volume!==s.volume){let a=t.audioStage.getById(r.id);a&&(a.url=s.url,a.volume=s.volume??1)}}};var Gd=class{constructor(){this.cache=new Map}async load(t){let e=[];for(let[r,s]of Object.entries(t))this.cache.has(r)||e.push([r,s]);e.length>0&&await Promise.all(e.map(async([r,s])=>{let a={buffer:await(await fetch(s.url)).arrayBuffer(),type:s.type};this.cache.set(r,a)}))}getBufferMap(){let t={};for(let[e,r]of this.cache.entries())t[e]=r;return t}clear(){this.cache.clear()}size(){return this.cache.size}has(t){return this.cache.has(t)}},EP=()=>new Gd;var y7=GT;export{Rd as AudioPlugin,Ad as ContainerRendererPlugin,Cd as KeyframeTransitionPlugin,Md as RectRendererPlugin,Bd as SliderRendererPlugin,wd as SpriteRendererPlugin,Ed as TextRendererPlugin,Pd as TextRevealingRendererPlugin,EP as createAssetBufferManager,y7 as default};
1142
+ `):"",this.name="UnsubscriptionError",this.errors=e}});function xd(i,t){if(i){var e=i.indexOf(t);0<=e&&i.splice(e,1)}}var dc=function(){function i(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return i.prototype.unsubscribe=function(){var t,e,r,s,o;if(!this.closed){this.closed=!0;var n=this._parentage;if(n)if(this._parentage=null,Array.isArray(n))try{for(var a=Nr(n),c=a.next();!c.done;c=a.next()){var l=c.value;l.remove(this)}}catch(g){t={error:g}}finally{try{c&&!c.done&&(e=a.return)&&e.call(a)}finally{if(t)throw t.error}}else n.remove(this);var h=this.initialTeardown;if(et(h))try{h()}catch(g){o=g instanceof uc?g.errors:[g]}var u=this._finalizers;if(u){this._finalizers=null;try{for(var d=Nr(u),f=d.next();!f.done;f=d.next()){var m=f.value;try{pT(m)}catch(g){o=o??[],g instanceof uc?o=Xi(Xi([],$i(o)),$i(g.errors)):o.push(g)}}}catch(g){r={error:g}}finally{try{f&&!f.done&&(s=d.return)&&s.call(d)}finally{if(r)throw r.error}}}if(o)throw new uc(o)}},i.prototype.add=function(t){var e;if(t&&t!==this)if(this.closed)pT(t);else{if(t instanceof i){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=(e=this._finalizers)!==null&&e!==void 0?e:[]).push(t)}},i.prototype._hasParent=function(t){var e=this._parentage;return e===t||Array.isArray(e)&&e.includes(t)},i.prototype._addParent=function(t){var e=this._parentage;this._parentage=Array.isArray(e)?(e.push(t),e):e?[e,t]:t},i.prototype._removeParent=function(t){var e=this._parentage;e===t?this._parentage=null:Array.isArray(e)&&xd(e,t)},i.prototype.remove=function(t){var e=this._finalizers;e&&xd(e,t),t instanceof i&&t._removeParent(this)},i.EMPTY=function(){var t=new i;return t.closed=!0,t}(),i}();var KY=dc.EMPTY;function fc(i){return i instanceof dc||i&&"closed"in i&&et(i.remove)&&et(i.add)&&et(i.unsubscribe)}function pT(i){et(i)?i():i.unsubscribe()}var ve={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};var Yi={setTimeout:function(i,t){for(var e=[],r=2;r<arguments.length;r++)e[r-2]=arguments[r];var s=Yi.delegate;return s?.setTimeout?s.setTimeout.apply(s,Xi([i,t],$i(e))):setTimeout.apply(void 0,Xi([i,t],$i(e)))},clearTimeout:function(i){var t=Yi.delegate;return(t?.clearTimeout||clearTimeout)(i)},delegate:void 0};function pc(i){Yi.setTimeout(function(){var t=ve.onUnhandledError;if(t)t(i);else throw i})}function _d(){}var mT=function(){return yd("C",void 0,void 0)}();function gT(i){return yd("E",void 0,i)}function xT(i){return yd("N",i,void 0)}function yd(i,t,e){return{kind:i,value:t,error:e}}var Wr=null;function _T(i){if(ve.useDeprecatedSynchronousErrorHandling){var t=!Wr;if(t&&(Wr={errorThrown:!1,error:null}),i(),t){var e=Wr,r=e.errorThrown,s=e.error;if(Wr=null,r)throw s}}else i()}function yT(i){ve.useDeprecatedSynchronousErrorHandling&&Wr&&(Wr.errorThrown=!0,Wr.error=i)}var Ko=function(i){Yo(t,i);function t(e){var r=i.call(this)||this;return r.isStopped=!1,e?(r.destination=e,fc(e)&&e.add(r)):r.destination=cP,r}return t.create=function(e,r,s){return new gc(e,r,s)},t.prototype.next=function(e){this.isStopped?vd(xT(e),this):this._next(e)},t.prototype.error=function(e){this.isStopped?vd(gT(e),this):(this.isStopped=!0,this._error(e))},t.prototype.complete=function(){this.isStopped?vd(mT,this):(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,i.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(e){this.destination.next(e)},t.prototype._error=function(e){try{this.destination.error(e)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(dc);var oP=Function.prototype.bind;function bd(i,t){return oP.call(i,t)}var nP=function(){function i(t){this.partialObserver=t}return i.prototype.next=function(t){var e=this.partialObserver;if(e.next)try{e.next(t)}catch(r){mc(r)}},i.prototype.error=function(t){var e=this.partialObserver;if(e.error)try{e.error(t)}catch(r){mc(r)}else mc(t)},i.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(e){mc(e)}},i}(),gc=function(i){Yo(t,i);function t(e,r,s){var o=i.call(this)||this,n;if(et(e)||!e)n={next:e??void 0,error:r??void 0,complete:s??void 0};else{var a;o&&ve.useDeprecatedNextContext?(a=Object.create(e),a.unsubscribe=function(){return o.unsubscribe()},n={next:e.next&&bd(e.next,a),error:e.error&&bd(e.error,a),complete:e.complete&&bd(e.complete,a)}):n=e}return o.destination=new nP(n),o}return t}(Ko);function mc(i){ve.useDeprecatedSynchronousErrorHandling?yT(i):pc(i)}function aP(i){throw i}function vd(i,t){var e=ve.onStoppedNotification;e&&Yi.setTimeout(function(){return e(i,t)})}var cP={closed:!0,next:_d,error:aP,complete:_d};var Ki=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function bT(i){return i}function vT(i){return i.length===0?bT:i.length===1?i[0]:function(e){return i.reduce(function(r,s){return s(r)},e)}}var at=function(){function i(t){t&&(this._subscribe=t)}return i.prototype.lift=function(t){var e=new i;return e.source=this,e.operator=t,e},i.prototype.subscribe=function(t,e,r){var s=this,o=hP(t)?t:new gc(t,e,r);return _T(function(){var n=s,a=n.operator,c=n.source;o.add(a?a.call(o,c):c?s._subscribe(o):s._trySubscribe(o))}),o},i.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(e){t.error(e)}},i.prototype.forEach=function(t,e){var r=this;return e=TT(e),new e(function(s,o){var n=new gc({next:function(a){try{t(a)}catch(c){o(c),n.unsubscribe()}},error:o,complete:s});r.subscribe(n)})},i.prototype._subscribe=function(t){var e;return(e=this.source)===null||e===void 0?void 0:e.subscribe(t)},i.prototype[Ki]=function(){return this},i.prototype.pipe=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return vT(t)(this)},i.prototype.toPromise=function(t){var e=this;return t=TT(t),new t(function(r,s){var o;e.subscribe(function(n){return o=n},function(n){return s(n)},function(){return r(o)})})},i.create=function(t){return new i(t)},i}();function TT(i){var t;return(t=i??ve.Promise)!==null&&t!==void 0?t:Promise}function lP(i){return i&&et(i.next)&&et(i.error)&&et(i.complete)}function hP(i){return i&&i instanceof Ko||lP(i)&&fc(i)}function uP(i){return et(i?.lift)}function Ue(i){return function(t){if(uP(t))return t.lift(function(e){try{return i(e,this)}catch(r){this.error(r)}});throw new TypeError("Unable to lift unknown Observable type")}}function zr(i,t,e,r,s){return new dP(i,t,e,r,s)}var dP=function(i){Yo(t,i);function t(e,r,s,o,n,a){var c=i.call(this,e)||this;return c.onFinalize=n,c.shouldUnsubscribe=a,c._next=r?function(l){try{r(l)}catch(h){e.error(h)}}:i.prototype._next,c._error=o?function(l){try{o(l)}catch(h){e.error(h)}finally{this.unsubscribe()}}:i.prototype._error,c._complete=s?function(){try{s()}catch(l){e.error(l)}finally{this.unsubscribe()}}:i.prototype._complete,c}return t.prototype.unsubscribe=function(){var e;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var r=this.closed;i.prototype.unsubscribe.call(this),!r&&((e=this.onFinalize)===null||e===void 0||e.call(this))}},t}(Ko);var xc=function(i){return i&&typeof i.length=="number"&&typeof i!="function"};function _c(i){return et(i?.then)}function yc(i){return et(i[Ki])}function bc(i){return Symbol.asyncIterator&&et(i?.[Symbol.asyncIterator])}function vc(i){return new TypeError("You provided "+(i!==null&&typeof i=="object"?"an invalid object":"'"+i+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}function fP(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var Tc=fP();function Sc(i){return et(i?.[Tc])}function wc(i){return uT(this,arguments,function(){var e,r,s,o;return hc(this,function(n){switch(n.label){case 0:e=i.getReader(),n.label=1;case 1:n.trys.push([1,,9,10]),n.label=2;case 2:return[4,Hr(e.read())];case 3:return r=n.sent(),s=r.value,o=r.done,o?[4,Hr(void 0)]:[3,5];case 4:return[2,n.sent()];case 5:return[4,Hr(s)];case 6:return[4,n.sent()];case 7:return n.sent(),[3,2];case 8:return[3,10];case 9:return e.releaseLock(),[7];case 10:return[2]}})})}function Ec(i){return et(i?.getReader)}function De(i){if(i instanceof at)return i;if(i!=null){if(yc(i))return pP(i);if(xc(i))return mP(i);if(_c(i))return gP(i);if(bc(i))return ST(i);if(Sc(i))return xP(i);if(Ec(i))return _P(i)}throw vc(i)}function pP(i){return new at(function(t){var e=i[Ki]();if(et(e.subscribe))return e.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function mP(i){return new at(function(t){for(var e=0;e<i.length&&!t.closed;e++)t.next(i[e]);t.complete()})}function gP(i){return new at(function(t){i.then(function(e){t.closed||(t.next(e),t.complete())},function(e){return t.error(e)}).then(null,pc)})}function xP(i){return new at(function(t){var e,r;try{for(var s=Nr(i),o=s.next();!o.done;o=s.next()){var n=o.value;if(t.next(n),t.closed)return}}catch(a){e={error:a}}finally{try{o&&!o.done&&(r=s.return)&&r.call(s)}finally{if(e)throw e.error}}t.complete()})}function ST(i){return new at(function(t){yP(i,t).catch(function(e){return t.error(e)})})}function _P(i){return ST(wc(i))}function yP(i,t){var e,r,s,o;return hT(this,void 0,void 0,function(){var n,a;return hc(this,function(c){switch(c.label){case 0:c.trys.push([0,5,6,11]),e=dT(i),c.label=1;case 1:return[4,e.next()];case 2:if(r=c.sent(),!!r.done)return[3,4];if(n=r.value,t.next(n),t.closed)return[2];c.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return a=c.sent(),s={error:a},[3,11];case 6:return c.trys.push([6,,9,10]),r&&!r.done&&(o=e.return)?[4,o.call(e)]:[3,8];case 7:c.sent(),c.label=8;case 8:return[3,10];case 9:if(s)throw s.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}})})}function fe(i,t,e,r,s){r===void 0&&(r=0),s===void 0&&(s=!1);var o=t.schedule(function(){e(),s?i.add(this.schedule(null,r)):this.unsubscribe()},r);if(i.add(o),!s)return o}function Pc(i,t){return t===void 0&&(t=0),Ue(function(e,r){e.subscribe(zr(r,function(s){return fe(r,i,function(){return r.next(s)},t)},function(){return fe(r,i,function(){return r.complete()},t)},function(s){return fe(r,i,function(){return r.error(s)},t)}))})}function Ac(i,t){return t===void 0&&(t=0),Ue(function(e,r){r.add(i.schedule(function(){return e.subscribe(r)},t))})}function wT(i,t){return De(i).pipe(Ac(t),Pc(t))}function ET(i,t){return De(i).pipe(Ac(t),Pc(t))}function PT(i,t){return new at(function(e){var r=0;return t.schedule(function(){r===i.length?e.complete():(e.next(i[r++]),e.closed||this.schedule())})})}function AT(i,t){return new at(function(e){var r;return fe(e,t,function(){r=i[Tc](),fe(e,t,function(){var s,o,n;try{s=r.next(),o=s.value,n=s.done}catch(a){e.error(a);return}n?e.complete():e.next(o)},0,!0)}),function(){return et(r?.return)&&r.return()}})}function Cc(i,t){if(!i)throw new Error("Iterable cannot be null");return new at(function(e){fe(e,t,function(){var r=i[Symbol.asyncIterator]();fe(e,t,function(){r.next().then(function(s){s.done?e.complete():e.next(s.value)})},0,!0)})})}function CT(i,t){return Cc(wc(i),t)}function MT(i,t){if(i!=null){if(yc(i))return wT(i,t);if(xc(i))return PT(i,t);if(_c(i))return ET(i,t);if(bc(i))return Cc(i,t);if(Sc(i))return AT(i,t);if(Ec(i))return CT(i,t)}throw vc(i)}function te(i,t){return t?MT(i,t):De(i)}function BT(i,t){return Ue(function(e,r){var s=0;e.subscribe(zr(r,function(o){r.next(i.call(t,o,s++))}))})}function RT(i,t,e,r,s,o,n,a){var c=[],l=0,h=0,u=!1,d=function(){u&&!c.length&&!l&&t.complete()},f=function(g){return l<r?m(g):c.push(g)},m=function(g){o&&t.next(g),l++;var _=!1;De(e(g,h++)).subscribe(zr(t,function(y){s?.(y),o?f(y):t.next(y)},function(){_=!0},void 0,function(){if(_)try{l--;for(var y=function(){var b=c.shift();n?fe(t,n,function(){return m(b)}):m(b)};c.length&&l<r;)y();d()}catch(b){t.error(b)}}))};return i.subscribe(zr(t,f,function(){u=!0,d()})),function(){a?.()}}function jt(i,t,e){return e===void 0&&(e=1/0),et(t)?jt(function(r,s){return BT(function(o,n){return t(r,o,s,n)})(De(i(r,s)))},e):(typeof t=="number"&&(e=t),Ue(function(r,s){return RT(r,s,i,e)}))}function qo(i){return Ue(function(t,e){try{t.subscribe(e)}finally{e.add(i)}})}var bP=i=>i.split("/").pop(),Td=class{name="advancedBufferLoader";priority=2;constructor(t){this.bufferMap=t}test(t){return!0}async load(t){let e=t.startsWith("file:")?t:bP(t),r=this.bufferMap[e];if(!r)throw new Error(`Buffer not found for key: ${e}`);return{data:r.buffer,type:r.type,metadata:null}}async testParse(t){return!0}async parse(t){if(t instanceof A)return t;let e=new Blob([t.data],{type:t.type}),r=await createImageBitmap(e);return new A.from(r)}async unload(t){t.destroy(!0)}},Sd=class i extends ac{static rendererName="pixi";_app;_audioStage=new lc;_state={elements:[]};_eventHandler;_plugins;_currentSubscription;_advancedLoader;get canvas(){return this._app.canvas}init=async t=>{let{eventHandler:e,plugins:r,width:s,height:o,backgroundColor:n}=t;for(let c of r)if(c.rendererName!==i.rendererName)throw new Error("Plugin does not match renderer name");this._plugins=r,this._eventHandler=e,this._app=new Qa,this._app.audioStage=this._audioStage,await this._app.init({width:s,height:o,backgroundColor:n});let a=new Wt;return a.rect(0,0,s,o),a.fill(n||0),this._app.stage.addChild(a),this._app.stage.width=s,this._app.stage.height=o,this._app.ticker.add(this._app.audioStage.tick),this};destroy=()=>{this._app.audioStage.destroy(),this._app.destroy()};loadAssets=async t=>{if(!t)throw new Error("assetBufferMap is required");let e={},r={};for(let[o,n]of Object.entries(t))n.type&&n.type.startsWith("audio/")?r[o]=n:e[o]=n;await Promise.all(Object.entries(r).map(([o,n])=>ji.load(o,n.buffer))),this._advancedLoader?Object.assign(this._advancedLoader.bufferMap,e):(this._advancedLoader=new Td(e),be.loader.parsers.length=0,be.reset(),R.add({name:"advanced-buffer-loader",extension:x.Asset,priority:Et.High,loader:this._advancedLoader}),typeof be.registerPlugin=="function"&&be.registerPlugin(this._advancedLoader));let s=Object.keys(e);return Promise.all(s.map(o=>be.load(o)))};loadAudioAssets=async t=>Promise.all(t.map(async e=>{let s=await(await fetch(e)).arrayBuffer();return ji.load(e,s)}));updatedBackgroundColor=t=>{this._app.renderer.background.color=t};render=t=>{this._render(this._app,this._app.stage,this._state,t,this._eventHandler),this._state=t};_getRendererByElement=t=>{for(let e of this._plugins)if(e.rendererType===t.type)return e;throw new Error(`No renderer found for element type: ${t.type}`)};_getTransitionByType=t=>{for(let e of this._plugins)if(e.transitionType===t)return e;throw new Error(`No transition found for transition type: ${t}`)};_render=async(t,e,r,s,o)=>{let n=Date.now(),{toAddElements:a,toUpdateElements:c,toDeleteElements:l}=cc(r.elements,s.elements),h=[];for(let u of l){let d=this._getRendererByElement(u);h.push(d.remove(t,{parent:e,element:u,transitions:s.transitions,getRendererByElement:this._getRendererByElement,getTransitionByType:this._getTransitionByType,eventHandler:o}))}for(let u of a){let d=this._getRendererByElement(u);h.push(d.add(t,{parent:e,element:u,getRendererByElement:this._getRendererByElement,transitions:s.transitions,getTransitionByType:this._getTransitionByType,eventHandler:o}))}for(let u of c){let d=this._getRendererByElement(u.next);h.push(d.update(t,{parent:e,prevElement:u.prev,nextElement:u.next,getRendererByElement:this._getRendererByElement,transitions:s.transitions,getTransitionByType:this._getTransitionByType,eventHandler:o}))}t.stage.children.sort((u,d)=>{let f=s.elements.findIndex(g=>g.id===u.label),m=s.elements.findIndex(g=>g.id===d.label);return f-m}),this._currentSubscription&&(this._currentSubscription.closed||this._currentSubscription.unsubscribe()),this._currentSubscription=te(h).pipe(jt(u=>u),qo(()=>{o&&o("completed",{id:s.id,diffTime:Date.now()-n}),this._currentSubscription=void 0})).subscribe({error:u=>{console.error("Error:",u)}})}},GT=Sd;var wd=class extends fr{static rendererName="pixi";rendererName="pixi";rendererType="sprite";add=(t,e)=>new at(r=>{let{parent:s,element:o,transitions:n=[],getTransitionByType:a,eventHandler:c}=e,l=A.from(o.url),h,u;o.hoverUrl&&(h=A.from(o.hoverUrl)),o.clickUrl&&(u=A.from(o.clickUrl));let d=new Lt(l);d.label=o.id,(o.eventName||o.hoverUrl||o.clickUrl)&&(d.cursor="pointer",d.eventMode="static"),o.anchorX!==void 0&&(d.pivot.x=d.width*o.anchorX,console.log("sprite.width",d.width)),o.anchorY!==void 0&&(d.pivot.y=d.height*o.anchorY,console.log("sprite.height",d.height)),o.scaleX!==void 0&&(d.scale.x=o.scaleX),o.scaleY!==void 0&&(d.scale.y=o.scaleY),o.rotation!==void 0&&(d.rotation=o.rotation*Math.PI/180),o.x!==void 0&&(d.x=o.x),o.y!==void 0&&(d.y=o.y),o.width!==void 0&&(d.width=o.width),o.height!==void 0&&(d.height=o.height),o.zIndex!==void 0&&(d.zIndex=o.zIndex),o.alpha!==void 0&&(d.alpha=o.alpha),d.on("pointerup",()=>{d.texture=l}).on("pointerupoutside",()=>{d.texture=l}).on("pointerleave",()=>{d.texture=l}),u&&d.on("pointerdown",()=>{d.texture=u}),h&&d.on("pointerenter",()=>{d.texture=h}),d.on("pointerup",g=>{g.stopPropagation();let _=g.button;_===0?c&&c(o.eventName,o.eventPayload):_===2&&(o.rightClickEventName&&c?c(o.rightClickEventName):t.stage.emit("rightclick",event))});let f=[];for(let g of n)if(g.elementId===o.id&&g.event===Vt.Add){let _=a(g.type);if(!_)throw new Error(`Transition class not found for type ${g.type}`);f.push(_.add(t,d,g))}s.addChild(d);let m=te(f).pipe(jt(g=>g)).subscribe({error:g=>{console.error("Error:",g)},complete:()=>r.complete()});return()=>{m.unsubscribe()}});remove=(t,e)=>new at(r=>{let{parent:s,element:o,transitions:n=[],getTransitionByType:a}=e,c=s.getChildByName(o.id);if(!c)throw new Error(`Sprite with id ${o.id} not found`);let l=[];for(let u of n)if(u.elementId===o.id&&u.event===Vt.Remove){let d=a(u.type);if(!d)throw new Error(`Transition class not found for type ${u.type}`);l.push(d.remove(t,c,u))}let h=te(l).pipe(jt(u=>u)).subscribe({error:u=>{console.error("Error:",u)},complete:()=>{r.complete(),c&&c.destroy()}});return()=>{h.unsubscribe(),c&&c.destroy()}});update=(t,{parent:e,prevElement:r,nextElement:s,transitions:o,getTransitionByType:n,eventHandler:a})=>new at(c=>{let l=e.getChildByName(r.id);if(!l)throw new Error(`Sprite with id ${r.id} not found`);if(JSON.stringify(r)!==JSON.stringify(s)){let h=[this.add(t,{parent:e,element:s,transitions:o,getTransitionByType:n,eventHandler:a}),this.remove(t,{parent:e,element:r,transitions:o,getTransitionByType:n})],u=te(h).pipe(jt(d=>d)).subscribe({error:d=>{console.error("Error:",d)},complete:()=>c.complete()});return()=>{u.unsubscribe()}}else s.x!==void 0&&(l.x=s.x),s.y!==void 0&&(l.y=s.y),s.width!==void 0&&s.width!==r.width&&(l.width=s.width),s.height!==void 0&&s.height!==r.height&&(l.height=s.height),s.alpha!==void 0&&s.alpha!==r.alpha&&(l.alpha=s.alpha),c.complete();return()=>{}})};var Mc=(i,t=!1)=>new St({wordWrap:i.wordWrap||!0,breakWords:t,align:i.align,fill:i.fill,fontSize:i.fontSize,lineHeight:i.lineHeight,wordWrapWidth:i.wordWrapWidth,fontFamily:i.fontFamily||"Roboto",stroke:i.strokeColor?{color:i.strokeColor,width:i.strokeWidth}:void 0}),Ed=class{static rendererName="pixi";rendererName="pixi";rendererType="text";add=(t,e)=>new at(r=>{let{parent:s,element:o,transitions:n=[],getTransitionByType:a,eventHandler:c}=e,l=Mc(o.style),h=new dr({text:o.text,style:l}),u;o.hoverStyle&&(u=Mc(o.hoverStyle));let d;if(o.clickedStyle&&(d=Mc(o.clickedStyle)),(o.eventName||o.clickedStyle||o.hoverStyle)&&(h.cursor="pointer",h.eventMode="static"),h.label=o.id,o.x!==void 0&&(h.x=o.x),o.y!==void 0&&(h.y=o.y),o.xa!==void 0&&(h.anchor.x=o.xa),o.ya!==void 0&&(h.anchor.y=o.ya),o.xa!==void 0||o.ya!==void 0){let g=h.getLocalBounds();h.hitArea=new z(-g.width*h.anchor.x,-g.height*h.anchor.y,g.width,g.height)}h.on("pointerupoutside",()=>{h.style=l}).on("pointerup",()=>{h.style=l}).on("pointerleave",()=>{h.style=l}),h.on("pointerup",g=>{o.clickSoundUrl&&t.soundStage&&t.soundStage.add({id:`${o.id}-click-${Math.random()}`,url:o.clickSoundUrl,loop:!1,volume:o.clickSoundVolume??50/100}),g.stopPropagation(),c&&c(o.eventName,o.eventPayload)}),d&&h.on("pointerdown",()=>{h.style=d}),u&&h.on("pointerenter",()=>{h.style=u,o.hoverSoundUrl&&t.soundStage&&o.hoverSoundVolume!==void 0&&t.soundStage.add({id:`${o.id}-hover-${Math.random()}`,url:o.hoverSoundUrl,loop:!1,volume:o.hoverSoundVolume/100})});let f=[];for(let g of n)if(g.elementId===o.id&&g.event===Vt.Add){let _=a(g.type);if(!_)throw new Error(`Transition class not found for type ${g.type}`);f.push(_.add(t,h,g))}s.addChild(h);let m=te(f).pipe(jt(g=>g)).subscribe({error:g=>{console.error("Error:",g),r.error(g)},complete:()=>r.complete()});return()=>{m.unsubscribe()}});remove=(t,e)=>new at(r=>{let{parent:s,element:o,transitions:n=[],getTransitionByType:a}=e,c=s.getChildByName(o.id);if(!c){console.warn(`Text with id ${o.id} not found`),r.complete();return}let l=[];for(let u of n)if(u.elementId===o.id&&u.event===Vt.Remove){let d=a(u.type);if(!d)throw new Error(`Transition class not found for type ${u.type}`);l.push(d.remove(t,c,u))}let h=te(l).pipe(jt(u=>u)).subscribe({error:u=>{console.error("Error:",u),r.error(u)},complete:()=>{c.destroy(),r.complete()}});return()=>{h.unsubscribe(),c&&c.destroy()}});update=(t,e)=>new at(r=>{let{parent:s,prevElement:o,nextElement:n,transitions:a,getTransitionByType:c,eventHandler:l}=e,h=s.getChildByName(o.id);if(!h){console.warn(`Text with id ${o.id} not found`),r.complete();return}if(JSON.stringify(o)!==JSON.stringify(n)){let u=[this.add(t,{parent:s,element:n,transitions:a,getTransitionByType:c,eventHandler:l}),this.remove(t,{parent:s,element:o,transitions:a,getTransitionByType:c})],d=te(u).pipe(jt(f=>f)).subscribe({error:f=>{console.error("Error:",f),r.error(f)},complete:()=>r.complete()});return()=>{d.unsubscribe()}}else o.text!==n.text&&(h.text=n.text),JSON.stringify(o.style)!==JSON.stringify(n.style)&&(h.style=Mc(n?.style)),n.x!==void 0&&(h.x=n.x),n.y!==void 0&&(h.y=n.y),r.complete();return()=>{}})};var qi=(i,t=!1)=>new St({wordWrap:i.wordWrap||!0,breakWords:t,align:i.align,fill:i.fill,fontSize:i.fontSize,lineHeight:i.lineHeight,wordWrapWidth:i.wordWrapWidth,fontFamily:i.fontFamily||"Roboto",stroke:i.strokeColor?{color:i.strokeColor,width:i.strokeWidth}:void 0}),Pd=class{static rendererName="pixi";rendererName="pixi";rendererType="text-revealing";add=async(t,{parent:e,element:r})=>{let s=qi(r.style,r.text),o=new dr({text:"",style:s});o.label=r.id,o.text_id=r.text;let n=new nt;r.x!==void 0&&(n.x=r.x),r.y!==void 0&&(n.y=r.y),n.addChild(o),n.label=r.id,e.addChild(n);let a=r.style.wordWrapWidth||500,c=r.text?[{text:r.text,style:r.style}]:r.segments,l=[],h=[],u=0,d=0,f=0;for(;;){let S=c[0];if(!S){h.length>0&&l.push({lineParts:h,y:d});break}if(d>1e4)break;let E={...S.style,wordWrapWidth:a-u},C=At.measureText(S.text,qi(E));C.lineHeight>f&&(f=C.lineHeight);let I=At.measureText("a",qi(E)),k=At.measureText("a a",qi(E)).width-I.width*2;if(C.lineWidths[0]+u>a){u=0,l.push({lineParts:h,y:d}),d+=f,f=0,h=[];continue}let L=C.lines[0],Y=C.lines.slice(1).join(" "),mt={text:L,style:E,x:u,y:0};if(h.push(mt),Y&&Y.length>0?S.text=Y:c.shift(),!(!L||L.length===0)){if(S.furigana){let $t=At.measureText(S.furigana.text,qi(S.furigana.style)),N={text:S.furigana.text,style:S.furigana.style,x:u+(C.width-$t.width)/2,y:-10};h.push(N)}u+=C.lineWidths[0]+k}}l.forEach(S=>{let E=new nt;E.y=S.y,E.alpha=0,S.lineParts.forEach(C=>{let I=new dr({text:C.text,style:qi(C.style),x:C.x,y:C.y});E.addChild(I)}),n.addChild(E)});let m=new Wt,g=1e3,_=a/2,y=a/2;m.fill({color:16777215,alpha:1}),m.rect(0,0,_,g);for(let S=0;S<y;S++)m.fill({color:16777215,alpha:1-S/y}),m.rect(_+S,0,_+1,g);let b=t.renderer.generateTexture(m),v=new Lt(b);v.x=-1.35*_-y,t.stage.addChild(v);let T=0,P=1;if(l.length!==0){if(r.displaySpeed===100||r.hasEnded){n.children.forEach(S=>{t.stage.removeChild(v),S.mask=null,S.alpha=1});return}await new Promise(S=>{let E=C=>{if(P>n.children.length){S();return}n.getChildAt(P).mask||(n.getChildAt(P).mask=v,n.getChildAt(P).alpha=1),T+=C.deltaMS;let M=(r.displaySpeed||50)/1e3;v.x+=M*T,v.x>=0&&(n.getChildAt(P).mask=null,v.x=-1.35*_-y,P=P+1,T=0,P>=n.children.length&&(n.getChildAt(P-1).mask=null,t.ticker.remove(E),S()))};t.ticker.add(E)})}};remove=async(t,e)=>{let{parent:r,element:s,transitions:o=[],getTransitionByType:n}=e,a=r.getChildByName(s.id);if(!a){console.warn(`Text with id ${s.id} not found`,{parent:r});return}let c=[];for(let l of o)if(l.elementId===s.id&&l.event===Vt.Remove){let h=n(l.type);if(!h)throw new Error(`Transition class not found for type ${l.type}`);c.push(h.remove(t,a,l))}await Promise.all(c),a.destroy()};update=async(t,e)=>{let{parent:r,prevElement:s,nextElement:o}=e;if(!r.getChildByName(s.id)){console.warn(`Text with id ${s.id} not found`,{parent:r});return}await this.remove(t,{parent:r,element:s}),await this.add(t,{parent:r,element:o})}};var Te={TopLeft:"TopLeft",TopCenter:"TopCenter",TopRight:"TopRight",CenterLeft:"CenterLeft",CenterCenter:"CenterCenter",CenterRight:"CenterRight",BottomLeft:"BottomLeft",BottomCenter:"BottomCenter",BottomRight:"BottomRight"},kT={[Te.TopLeft]:{x:0,y:0},[Te.TopCenter]:{x:.5,y:0},[Te.TopRight]:{x:1,y:0},[Te.CenterLeft]:{x:0,y:.5},[Te.CenterCenter]:{x:.5,y:.5},[Te.CenterRight]:{x:1,y:.5},[Te.BottomLeft]:{x:0,y:1},[Te.BottomCenter]:{x:.5,y:1},[Te.BottomRight]:{x:1,y:1}},Ad=class{static rendererName="pixi";rendererName="pixi";rendererType="container";add=(t,e)=>new at(r=>{let{parent:s,element:o,transitions:n=[],getTransitionByType:a,getRendererByElement:c,eventHandler:l}=e,h=new nt;h.label=o.id;let u={};o.x!==void 0&&(typeof o.x=="string"&&o.x.endsWith("%")?h.x=Number(o.x.replace("%",""))*t.screen.width/100:h.x=o.x),o.y!==void 0&&(typeof o.y=="string"&&o.y.endsWith("%")?h.y=Number(o.y.replace("%",""))*t.screen.height/100:h.y=o.y),o.scaleX!==void 0&&(h.scale.x=o.scaleX),o.scaleY!==void 0&&(h.scale.y=o.scaleY),o.zIndex!==void 0&&(h.zIndex=o.zIndex),o.propagateEvents&&(h.eventMode="static",["pointerup","pointerupoutside","pointerleave","pointerdown","pointerenter"].forEach(y=>{h.on(y,b=>{b.stopPropagation();for(let v of h.children)v.emit(y)})}));let d=o.gap||0,f=new Wt().roundRect(0,0,o.width||0,o.height||0,1).fill(o.fill?o.fill.color:"transparent");if(o.direction){let y,b;o.direction==="horizontal"?(y=o.children.reduce((T,P)=>T+P.width+d,0),b=o.children.reduce((T,P)=>Math.max(T,P.height||0),0)):o.direction==="vertical"&&(y=o.children.reduce((T,P)=>Math.max(T,P.width||0),0),b=o.children.reduce((T,P)=>T+P.height+d,0));let v=kT[o.anchor||Te.TopLeft];o.direction==="horizontal"?this.layoutChildren({element:o,anchor:v,totalWidth:y,totalHeight:b,gap:d,direction:"horizontal",scroll:o.scroll}):o.direction==="vertical"&&this.layoutChildren({element:o,anchor:v,totalWidth:y,totalHeight:b,gap:d,direction:"vertical",scroll:o.scroll}),this.setupScrolling({container:h,element:o,totalHeight:b,totalWidth:y,eventHandler:l,sliderRef:u}),f=this.createContainerGraphic(o,y,b,v)}f.label=`${o.id}-container-background`,h.addChild(f);let m=[];(o.children||[]).forEach(y=>{let b=c(y);m.push(b.add(t,{parent:h,element:{zIndex:o.zIndex,...y},transitions:n,getTransitionByType:a,getRendererByElement:c,eventHandler:l}))});let g=[];for(let y of n)if(y.elementId===o.id&&y.event===Vt.Add){let b=a(y.type);if(!b)throw new Error(`Transition class not found for type ${y.type}`);g.push(b.add(t,h,y))}s.addChild(h);let _=te(m).pipe(jt(y=>y)).subscribe({error:y=>{console.error("Error:",y)},complete:()=>{console.log("complete"),r.complete()}});return()=>{_.unsubscribe()}});remove=(t,e)=>(console.log("remove container 11111111111"),new at(r=>{let{parent:s,element:o}=e,n=s.getChildByName(o.id);if(!n){console.warn(`Container with id ${o.id} not found`);return}return n.destroy(),()=>{n.destroy()}}));update=(t,e)=>new at(r=>{let{parent:s,prevElement:o,nextElement:n,getRendererByElement:a,transitions:c=[],getTransitionByType:l,eventHandler:h}=e,u=s.getChildByName(o.id);if(!u){console.warn(`Container with id ${o.id} not found`);return}if(n.x!==void 0&&n.x!==o.x&&(u.x=n.x),n.y!==void 0&&n.y!==o.y&&(u.y=n.y),n.direction){let _=n.gap||0,y,b;n.direction==="horizontal"?(y=n.children.reduce((P,S)=>P+S.width+_,0),b=n.children.reduce((P,S)=>Math.max(P,S.height||0),0)):n.direction==="vertical"&&(y=n.children.reduce((P,S)=>Math.max(P,S.width||0),0),b=n.children.reduce((P,S)=>P+S.height+_,0));let v=kT[n.anchor||Te.TopLeft];n.direction==="horizontal"?this.layoutChildren({element:n,anchor:v,totalWidth:y,totalHeight:b,gap:_,direction:"horizontal",scroll:n.scroll}):n.direction==="vertical"&&this.layoutChildren({element:n,anchor:v,totalWidth:y,totalHeight:b,gap:_,direction:"vertical",scroll:n.scroll});let T=u.children.find(P=>P.label===`${n.id}-container-background`);if(T){T.destroy();let P=this.createContainerGraphic(n,y,b,v);P.label=`${n.id}-container-background`,u.addChildAt(P,0)}o.scroll!==n.scroll&&this.setupScrolling({container:u,element:n,totalHeight:b,totalWidth:y,eventHandler:h,sliderRef:{}})}let d=[],{toAddElements:f,toUpdateElements:m,toDeleteElements:g}=cc(o.children,n.children);for(let _ of g){let y=a(_);d.push(y.remove(t,{parent:u,element:_,transitions:c,getTransitionByType:l,getRendererByElement:a,eventHandler:h}))}for(let _ of f){let y=a(_);d.push(y.add(t,{parent:u,element:_,transitions:c,getTransitionByType:l,getRendererByElement:a,eventHandler:h}))}for(let _ of m){let y=a(_.next);d.push(y.update(t,{parent:u,prevElement:_.prev,nextElement:_.next,transitions:c,getTransitionByType:l,getRendererByElement:a,eventHandler:h}))}return u.children.sort((_,y)=>{let b=n.children?.findIndex(T=>T.id===_.label),v=n.children?.findIndex(T=>T.id===y.label);return b-v}),this._currentSubscription=te(d).pipe(jt(_=>_),qo(()=>{r.complete()})).subscribe({error:_=>{r.error(_),console.error("Error:",_)}}),()=>{this._currentSubscription?.unsubscribe()}});layoutChildren({element:t,anchor:e,totalWidth:r,totalHeight:s,gap:o,direction:n,scroll:a}){let c=n==="horizontal",l=c?"x":"y",h=c?"y":"x",u=c?"width":"height",d=c?"height":"width",f=c?r:s,m=c?s:r,g=c?e.x:e.y,_=c?e.y:e.x;if(!a&&t[u]!==void 0&&t[u]<f){let b=0,v=0,T=0,P=0;(t.children||[]).forEach((S,E)=>{b>0&&b+S[u]>t[u]&&(this.alignRowElements(t.children.slice(P,E),l,g,t[u]),b=0,v+=T+o,T=0,P=E),S[l]=b,S[h]=v,b+=S[u]+o,T=Math.max(T,S[d]||0)}),P<t.children.length&&this.alignRowElements(t.children.slice(P),l,g,t[u])}else{if(g===0){let b=0;(t.children||[]).forEach(v=>{v[l]=b,b+=v[u]+o})}else if(g===1){let b=-f;(t.children||[]).forEach(v=>{v[l]=b,b+=v[u]+o})}else if(g===.5){let b=-f/2;(t.children||[]).forEach(v=>{v[l]=b,b+=v[u]+o})}_===0?(t.children||[]).forEach(b=>{b[h]=0}):_===.5?(t.children||[]).forEach(b=>{b[h]=-m/2}):_===1&&(t.children||[]).forEach(b=>{b[h]=-m})}}alignRowElements(t,e,r,s){if(!t.length)return;let o=t.reduce((n,a,c)=>n+a[e==="x"?"width":"height"]+(c>0,0),0);if(r===.5){let a=(s-o)/2;t.forEach(c=>{c[e]=a,a+=c[e==="x"?"width":"height"]+0})}else if(r===1){let a=s-o;t.forEach(c=>{c[e]=a,a+=c[e==="x"?"width":"height"]+0})}}createContainerGraphic(t,e,r,s){let o=new Wt().roundRect(0,0,e,r,1).fill(t.fill?t.fill.color:"transparent");return s.x===1&&(o.x-=t.width),s.x===-.5&&(o.x-=t.width/2),o}setupScrolling({container:t,element:e,totalHeight:r,totalWidth:s,eventHandler:o,sliderRef:n}){let a=e.scroll&&e.height&&r>e.height,c=e.scroll&&e.width&&s>e.width;if(a||c){let l=0,h=0,u=-r+e.height,d=-s+e.width,f=new Wt().rect(0,0,e.width||s,e.height||r).fill("red");t.mask=f,t.eventMode="static",t.addChild(f),t.on("wheel",m=>{if(a&&m.deltaY!==0&&(l-m.deltaY>0||l-m.deltaY<u||(l-=m.deltaY,t.y-=m.deltaY,f.y+=m.deltaY)),c&&(m.deltaX!==0||m.shiftKey&&m.deltaY!==0)){let g=m.deltaX!==0?m.deltaX:m.deltaY;if(h-g>0||h-g<d)return;h-=g,t.x-=g,f.x+=g}})}}};var vP={linear:i=>i},TP=(i,t,e,r)=>i+(t-i)*vP[r](e);function IT(i,t,e){typeof t=="string"&&(t=t.split("."));let r=i;for(let s of t){if(r==null)return e;r=r[s]}return r===void 0?e:r}function FT(i,t,e){typeof t=="string"&&(t=t.split("."));let r=i;for(let s=0;s<t.length-1;s++){let o=t[s];o in r||(r[o]={}),r=r[o]}return r[t[t.length-1]]=e,i}var SP=(i,t)=>{let e=[],r=0,s;i.forEach(({value:n,duration:a,easing:c,relative:l},h)=>{h===0?(s=n,e.push({time:r,value:n,easing:"linear"})):a!==void 0&&c!==void 0&&(r+=a,l?s=s+n:s=n,e.push({time:r,value:s,easing:c}))});let o=0;for(let n=0;n<e.length-1;n++){let{time:a,value:c,easing:l}=e[n],{time:h,value:u}=e[n+1];if(t>=a&&t<=h){let d=(t-a)/(h-a);o=TP(c,u,d,l);break}else t>h&&(o=u)}return o};function wP(i){return Math.max.apply(null,i)}var Cd=class{static rendererName="pixi";rendererName="pixi";transitionType="keyframes";_transition=(t,e,r)=>(console.log("keyframe transition setup"),new at(s=>{console.log("keyframe transition start");let{animationProperties:o}=r,n=Array.isArray(o)?o:Object.entries(o).map(([d,f])=>({...f,property:d})),a=n.map(d=>d.keyframes.reduce((f,m)=>f+m.duration||0,0)),c=wP(a),l=0,h={};n.forEach(d=>{h[d.property]=IT(e,d.property)});let u=d=>{if(l+=d.deltaMS,l>=c){t.ticker.remove(u),s.complete();return}let f={};n.forEach(m=>{let g=[];m.initialValue!==void 0?g=[{value:m.initialValue,duration:0}]:g=[{value:h[m.property],duration:0}],g=g.concat(m.keyframes),FT(f,m.property,SP(g,l))}),n.forEach(m=>{let{property:g}=m;e&&!e.destroyed&&FT(e,g,IT(f,g))})};return t.ticker.add(u),()=>{t.ticker.remove(u),u({deltaMS:c-l})}}));add=(t,e,r)=>this._transition(t,e,r);remove=(t,e,r)=>this._transition(t,e,r)};var Md=class{static rendererName="pixi";rendererName="pixi";rendererType="rect";add=async(t,e)=>{let{parent:r,element:s,transitions:o=[],getTransitionByType:n,eventHandler:a}=e,c=new Wt;c.label=s.id,s.x!==void 0&&(c.x=s.x),s.y!==void 0&&(c.y=s.y),s.alpha!==void 0&&(c.alpha=s.alpha),s.scaleX!==void 0&&(c.scale.x=s.scaleX),s.scaleY!==void 0&&(c.scale.y=s.scaleY),s.rotation!==void 0&&(c.rotation=s.rotation*Math.PI/180);let l=s.width,h=s.height;c.rect(0,0,l,h),c.fill(s.fill),s.anchorX!==void 0&&(c.pivot.x=l*s.anchorX),s.anchorY!==void 0&&(c.pivot.y=h*s.anchorY),(s.clickEventName||s.rightClickEventName)&&a&&(c.eventMode="static",c.on("pointerup",d=>{d.button===0?a(s.clickEventName):d.button===2&&a(s.rightClickEventName)})),s.wheelEventName&&a&&(c.eventMode="static",c.on("wheel",d=>{a(s.wheelEventName,{deltaY:d.deltaY})}));let u=[];for(let d of o)if(d.elementId===s.id&&d.event===Vt.Add){let f=n(d.type);if(!f)throw new Error(`Transition class not found for type ${d.type}`);u.push(f.add(t,c,d))}r.addChild(c),await Promise.all(u)};remove=async(t,e)=>{let{parent:r,element:s}=e,o=r.getChildByName(s.id);if(!o)throw new Error(`Sprite with id ${s.id} not found`);o.destroy()};update=async(t,e)=>{let{parent:r,prevElement:s,nextElement:o,transitions:n=[],getTransitionByType:a,eventHandler:c}=e;if(!r.getChildByName(s.id))throw new Error(`Container with id ${s.id} not found`);JSON.stringify(s)!==JSON.stringify(o)&&await Promise.all([this.remove(t,{parent:r,element:s,transitions:n,getTransitionByType:a,eventHandler:c}),this.add(t,{parent:r,element:o,transitions:n,getTransitionByType:a,eventHandler:c})])}};var Bd=class extends fr{static rendererName="pixi";rendererName="pixi";rendererType="slider";add=async(t,{parent:e,element:r,transitions:s=[],getTransitionByType:o,eventHandler:n,ref:a})=>{let{direction:c,idleThumb:l,hoverThumb:h,idleBar:u,hoverBar:d,dragEndEventName:f,dragEventName:m,dragEventPayload:g,initialValue:_}=r,y={horizontal:{axis:"x",size:"width"},vertical:{axis:"y",size:"height"}},b=y[c].axis,v=y[c].size,T=A.from(l),P=A.from(h),S=A.from(u),E=A.from(d),C=new Lt({texture:S,anchor:{x:0,y:0}});C.label=r.id;let I=C[v];C.x=r.x||0,C.y=r.y||0;let M=new Lt({texture:T,anchor:{x:.5,y:.5}});if(M.y=C.height/2,M.x=C.width/2,M.eventMode="static",M.cursor="pointer",C.eventMode="static",C.cursor="pointer",M.on("pointerdown",Y).on("pointerup",mt).on("pointerupoutside",mt),C.on("pointerdown",k).on("pointerup",L).on("pointerupoutside",L),C.addChild(M),_!==void 0){let F=M[v]/2;M[b]=_/100*(I-M[v])+F}function k(F){M.texture=P,C.texture=E,$t(F),t.stage.eventMode="static",t.stage.addEventListener("pointermove",$t)}function L(F){M.texture=T,C.texture=S,$t(F),t.stage.eventMode="auto",t.stage.removeEventListener("pointermove",$t)}function Y(F){F.stopPropagation(),M.texture=P,C.texture=E,t.stage.eventMode="static",t.stage.addEventListener("pointermove",$t)}function mt(F){if(M.texture=T,C.texture=S,t.stage.eventMode="auto",t.stage.removeEventListener("pointermove",$t),f){let Se=C.toLocal(F.global)[b],q=M[v]/2;M[b]=Math.max(0+q,Math.min(Se,I-q));let ee=Math.floor((M[b]-q)/(I-M[v])*100),Oe=JSON.stringify(g);n&&n(f,JSON.parse(Oe.replace('"{{ value }}"',String(ee))))}}function $t(F){let Se=C.toLocal(F.global)[b],q=M[v]/2;M[b]=Math.max(0+q,Math.min(Se,I-q));let ee=Math.floor((M[b]-q)/(I-M[v])*100);if(m){let Oe=JSON.stringify(g);n&&n(m,JSON.parse(Oe.replace('"{{ value }}"',String(ee))))}return ee}a&&(a.current={updateValue:F=>{let Se=M[v]/2;M[b]=F/100*(I-M[v])+Se}});let N=[];for(let F of s)if(F.elementId===r.id&&F.event===Vt.Add){let Se=o(F.type);if(!Se)throw new Error(`Transition class not found for type ${F.type}`);N.push(Se.add(t,C,F))}e.addChild(C),await Promise.all(N)};remove=async(t,e)=>{let{parent:r,element:s,transitions:o=[],getTransitionByType:n}=e,a=r.getChildByName(s.id);if(!a){console.warn(`Sprite with id ${s.id} not found`);return}let c=[];for(let l of o)if(l.elementId===s.id&&l.event===Vt.Remove){let h=n(l.type);if(!h)throw new Error(`Transition class not found for type ${l.type}`);c.push(h.remove(t,a,l))}await Promise.all(c),a.destroy()};update=async(t,{parent:e,prevElement:r,nextElement:s,transitions:o,getTransitionByType:n,eventHandler:a})=>{if(!e.getChildByName(r.id)){console.warn(`Slider with id ${r.id} not found`,{parent:e});return}JSON.stringify(r)!==JSON.stringify(s)&&await Promise.all([this.remove(t,{parent:e,element:r,transitions:o,getTransitionByType:n,eventHandler:a}),this.add(t,{parent:e,element:s,transitions:o,getTransitionByType:n,eventHandler:a})])}};var Rd=class extends fr{static rendererName="pixi";rendererName="pixi";rendererType="audio";add=async(t,{parent:e,element:r,transitions:s=[],getTransitionByType:o})=>{r.delay?setTimeout(()=>{t.audioStage.add({id:r.id,url:r.url,loop:r.loop??!1,volume:r.volume??1})},r.delay):t.audioStage.add({id:r.id,url:r.url,loop:r.loop??!1,volume:r.volume??1})};remove=async(t,e)=>{let{element:r}=e;t.audioStage.remove(r.id)};update=async(t,{parent:e,prevElement:r,nextElement:s,transitions:o,getTransitionByType:n})=>{if(r.url!==s.url||r.volume!==s.volume){let a=t.audioStage.getById(r.id);a&&(a.url=s.url,a.volume=s.volume??1)}}};var Gd=class{constructor(){this.cache=new Map}async load(t){let e=[];for(let[r,s]of Object.entries(t))this.cache.has(r)||e.push([r,s]);e.length>0&&await Promise.all(e.map(async([r,s])=>{let a={buffer:await(await fetch(s.url)).arrayBuffer(),type:s.type};this.cache.set(r,a)}))}getBufferMap(){let t={};for(let[e,r]of this.cache.entries())t[e]=r;return t}clear(){this.cache.clear()}size(){return this.cache.size}has(t){return this.cache.has(t)}},EP=()=>new Gd;var y7=GT;export{Rd as AudioPlugin,Ad as ContainerRendererPlugin,Cd as KeyframeTransitionPlugin,Md as RectRendererPlugin,Bd as SliderRendererPlugin,wd as SpriteRendererPlugin,Ed as TextRendererPlugin,Pd as TextRevealingRendererPlugin,EP as createAssetBufferManager,y7 as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "route-graphics",
3
- "version": "0.0.2-rc3",
3
+ "version": "0.0.2-rc4",
4
4
  "description": "A 2D graphics rendering interface that takes JSON input and renders pixels using PixiJS",
5
5
  "main": "dist/RouteGraphics.js",
6
6
  "type": "module",
@@ -26,6 +26,7 @@
26
26
  "lint:fix": "bunx prettier --check --write src",
27
27
  "build": "bun run esbuild.js",
28
28
  "vt:generate": "bun run esbuild.js && rtgl vt generate --skip-screenshots",
29
+ "vt:report": "bun run esbuild.js && rtgl vt generate && rtgl vt report",
29
30
  "test": "vitest",
30
31
  "serve": "bunx serve -p 3005 .rettangoli/vt/_site"
31
32
  },