route-graphics 1.8.2 → 1.8.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/RouteGraphics.js +1 -1
- package/package.json +1 -1
package/dist/RouteGraphics.js
CHANGED
|
@@ -1412,7 +1412,7 @@ fn mainFragment(@location(0) uv: vec2<f32>) -> @location(0) vec4<f32>
|
|
|
1412
1412
|
|
|
1413
1413
|
return vec4(outputValue, outputValue, outputValue, 1.0);
|
|
1414
1414
|
}
|
|
1415
|
-
`,tD=(r,e)=>{let t=document.createElement("canvas");t.width=r,t.height=e;let i=t.getContext("2d",{willReadFrequently:!0});if(!i)throw new Error("Replace mask composition could not create a 2D canvas.");return{canvas:t,context:i}},rD=(r,e,t="red")=>{switch(t){case"green":return r[e+1];case"blue":return r[e+2];case"alpha":return r[e+3];default:return r[e]}},iD=({app:r,texture:e,width:t,height:i,channel:s="red",invert:o=!1})=>{let n=new Uint8ClampedArray(t*i),a=new Te(B.from(e));a.width=t,a.height=i;let l=new te;l.addChild(a);let c=Ki.create({width:t,height:i});r.renderer.render({container:l,target:c,clear:!0});let u=r.renderer.extract.pixels(c).pixels;for(let h=0,d=0;h<n.length;h++,d+=4){let f=rD(u,d,s);o&&(f=255-f),n[h]=f}return l.destroy({children:!0}),c.destroy(!0),n},sD=(r,e,t,i)=>{let s=null;for(let o of e.items){let n=iD({app:r,texture:o.texture,width:t,height:i,channel:o.channel??"red",invert:o.invert??!1});if(!s){s=n;continue}for(let a=0;a<s.length;a++)switch(e.combine??"max"){case"min":s[a]=Math.min(s[a],n[a]);break;case"multiply":s[a]=Math.round(s[a]/255*(n[a]/255)*255);break;case"add":s[a]=Math.min(255,s[a]+n[a]);break;default:s[a]=Math.max(s[a],n[a]);break}}return s??new Uint8ClampedArray(t*i)},df=(r="red")=>{switch(r){case"green":return new Float32Array([0,1,0,0]);case"blue":return new Float32Array([0,0,1,0]);case"alpha":return new Float32Array([0,0,0,1]);default:return new Float32Array([1,0,0,0])}},e_=df("red"),t_=(r,e)=>Ki.create({width:r,height:e,resolution:1}),oD=(r,e)=>{let t=new be({uMaskInvert:{value:e?1:0,type:"f32"},uMaskChannelWeights:{value:r,type:"vec4<f32>"}});return{filter:rn.from({gpu:{vertex:{source:UR,entryPoint:"mainVertex"},fragment:{source:UR,entryPoint:"mainFragment"}},gl:{vertex:NR,fragment:eD,name:"replace-mask-channel-filter"},resources:{maskChannelUniforms:t}}),maskChannelUniforms:t}},GR=({app:r,texture:e,width:t,height:i,channelWeights:s,invert:o=!1})=>{let n=B.from(e),a=new Te(n);a.width=t,a.height=i,a.filterArea=new Q(0,0,t,i);let l=new te;l.addChild(a);let c=t_(t,i),{filter:u}=oD(s,o);return a.filters=[u],r.renderer.render({container:l,target:c,clear:!0}),a.filters=[],l.destroy({children:!0}),u.destroy(),c},nD=(r,e,t)=>{let{canvas:i,context:s}=tD(r,e),o=s.createImageData(r,e),n=o.data;for(let a=0,l=0;a<t.length;a++,l+=4){let c=t[a];n[l]=c,n[l+1]=c,n[l+2]=c,n[l+3]=255}return s.putImageData(o,0,0),B.from(i)},aD=(r,e,t,i)=>{if(!e)return{textures:[B.WHITE.source],channelWeights:df("red"),invert:0,destroy:()=>{}};if(e.kind==="single"){let o=GR({app:r,texture:e.texture,width:t,height:i,channelWeights:df(e.channel??"red"),invert:e.invert??!1});return{textures:[o.source],channelWeights:e_,invert:0,destroy:()=>{o.destroy(!0)}}}if(e.kind==="sequence"){let o=e.textures.map(n=>GR({app:r,texture:n,width:t,height:i,channelWeights:df(e.channel??"red"),invert:e.invert??!1}));return{textures:o.map(n=>n.source),channelWeights:e_,invert:0,destroy:()=>{for(let n of o)n.destroy(!0)}}}let s=nD(t,i,sD(r,e,t,i));return{textures:[s.source],channelWeights:e_,invert:0,destroy:()=>{s.destroyed||s.destroy(!0)}}},lD=()=>{let r=new be({uProgress:{value:0,type:"f32"},uSoftness:{value:.001,type:"f32"},uMaskMix:{value:0,type:"f32"},uMaskInvert:{value:0,type:"f32"},uMaskChannelWeights:{value:new Float32Array([1,0,0,0]),type:"vec4<f32>"},uSecondaryMatrix:{value:new L,type:"mat3x3<f32>"},uSecondaryClamp:{value:new Float32Array([0,0,1,1]),type:"vec4<f32>"}});return{filter:rn.from({gpu:{vertex:{source:OR,entryPoint:"mainVertex"},fragment:{source:OR,entryPoint:"mainFragment"}},gl:{vertex:NR,fragment:JL,name:"replace-mask-filter"},resources:{replaceMaskUniforms:r,uNextTexture:B.EMPTY.source,uMaskTextureA:B.EMPTY.source,uMaskTextureB:B.EMPTY.source}}),replaceMaskUniforms:r}},cD=({progress:r=0,frameCount:e=0,sampleMode:t="hold"}={})=>{if(e<=1)return{fromIndex:0,toIndex:0,mix:0};let i=r_(r)*Math.max(0,e-1);if(t==="linear"){let o=Math.floor(i),n=Math.min(e-1,o+1);return{fromIndex:o,toIndex:n,mix:i-o}}let s=Math.min(e-1,Math.max(0,Math.round(i)));return{fromIndex:s,toIndex:s,mix:0}},uD=(r,e,t,i,s)=>{let o=QL(e),n=yc([{timeline:o}]),a=Math.max(e?.softness??.001,1e-4),{textures:l,channelWeights:c,invert:u,destroy:h}=aD(r,e,t,i),d=s.resources.replaceMaskUniforms,f=-1,p=-1;return{duration:n,progressTimeline:o,apply:m=>{let g=e?.kind==="sequence"?cD({progress:m,frameCount:l.length,sampleMode:e.sample??"hold"}):{fromIndex:0,toIndex:0,mix:0};g.fromIndex!==f&&(s.resources.uMaskTextureA=l[g.fromIndex]??B.EMPTY.source,f=g.fromIndex),g.toIndex!==p&&(s.resources.uMaskTextureB=l[g.toIndex]??B.EMPTY.source,p=g.toIndex),d.uniforms.uProgress=r_(m),d.uniforms.uSoftness=a,d.uniforms.uMaskMix=g.mix,d.uniforms.uMaskInvert=u,d.uniforms.uMaskChannelWeights=c,d.update()},destroy:h}},hD=(r,e)=>{let t=Math.max(1,r),i=Math.max(1,e);return new Float32Array([.5/t,.5/i,1-.5/t,1-.5/i])},dD=r=>{let e=new te;for(let t of r)t?.wrapper&&e.addChild(t.wrapper);return DR(LR(e))},hf=({app:r,container:e,target:t,frame:i})=>{r.renderer.render({container:e,target:t,clear:!0,transform:new L(1,0,0,1,-i.x,-i.y)})},Hs=r=>{r?.wrapper&&!r.wrapper.destroyed&&r.wrapper.destroy({children:!0}),r?.texture?.destroy(!0)},fD=({prevElement:r,nextElement:e,animation:t,prevSubject:i,nextSubject:s})=>{if(!i||!s||r?.id!==e?.id)return{prevSubject:i,nextSubject:s};let o=i,n=s;return t.mask!==void 0&&t.prev===void 0&&t.next===void 0?{prevSubject:o,nextSubject:n}:(t.prev===void 0&&(o=null),t.next===void 0&&(n=null),{prevSubject:o,nextSubject:n})},pD=({app:r,animation:e,prevSubject:t,nextSubject:i,zIndex:s})=>{let o=new te;o.zIndex=s,t?.wrapper&&o.addChild(t.wrapper),i?.wrapper&&o.addChild(i.wrapper);let n=ff(t?.wrapper??null,e.prev?.tween,r),a=ff(i?.wrapper??null,e.next?.tween,r);return{overlay:o,duration:Math.max(n.duration,a.duration),apply:l=>{n.apply(l),a.apply(l)},destroy:()=>{o.removeFromParent(),o.destroy({children:!0}),Hs(t),Hs(i)}}},mD=({app:r,animation:e,prevSubject:t,nextSubject:i,zIndex:s})=>{let o=dD([t,i]),n=new te,a=new te;t?.wrapper&&n.addChild(t.wrapper),i?.wrapper&&a.addChild(i.wrapper);let l=t_(o.width,o.height),c=t_(o.width,o.height),u=new te;u.zIndex=s;let h=new Te(l);h.x=o.x,h.y=o.y,h.filterArea=new Q(0,0,o.width,o.height),u.addChild(h);let{filter:d}=lD();d.resources.uNextTexture=c.source,h.filters=[d];let f=hD(o.width,o.height),p=typeof d.apply=="function"?d.apply.bind(d):(T,b,E,w)=>{T.applyFilter(d,b,E,w)};d.apply=(T,b,E,w)=>{let I=d.resources.replaceMaskUniforms;T.calculateSpriteMatrix(I.uniforms.uSecondaryMatrix,h),I.uniforms.uSecondaryClamp=f,I.update(),p(T,b,E,w)};let m=uD(r,e.mask,o.width,o.height,d),g=ff(t?.wrapper??null,e.prev?.tween,r),y=ff(i?.wrapper??null,e.next?.tween,r),v=!1,x=!1;return t?.wrapper||hf({app:r,container:n,target:l,frame:o}),i?.wrapper||hf({app:r,container:a,target:c,frame:o}),{overlay:u,duration:Math.max(g.duration,y.duration,m.duration),apply:T=>{g.apply(T),y.apply(T),t?.wrapper&&(g.duration>0||!v)&&(hf({app:r,container:n,target:l,frame:o}),v=!0),i?.wrapper&&(y.duration>0||!x)&&(hf({app:r,container:a,target:c,frame:o}),x=!0);let b=r_(_c(m.progressTimeline,T));m.apply(b)},destroy:()=>{u.removeFromParent(),h.filters=[],d.destroy(),u.destroy({children:!0}),n.destroy({children:!0}),a.destroy({children:!0}),l.destroy(!0),c.destroy(!0),Hs(t),Hs(i),m.destroy()}}},gD=({app:r,animation:e,prevSubject:t,nextSubject:i,zIndex:s})=>e.mask?mD({app:r,animation:e,prevSubject:t,nextSubject:i,zIndex:s}):pD({app:r,animation:e,prevSubject:t,nextSubject:i,zIndex:s}),xD=({app:r,parent:e,nextElement:t,plugin:i,animations:s,eventHandler:o,animationBus:n,completionTracker:a,elementPlugins:l,renderContext:c,zIndex:u,signal:h})=>{if(!t)return null;let d=i.add({app:r,parent:e,element:t,animations:s,eventHandler:o,animationBus:n,completionTracker:a,elementPlugins:l,renderContext:c,zIndex:u,signal:h});return d&&typeof d.then=="function"?d.then(()=>h?.aborted||e.destroyed?null:e.children.find(f=>f.label===t.id)??null):h?.aborted||e.destroyed?null:e.children.find(f=>f.label===t.id)??null},yD=async r=>r&&typeof r.then=="function"?r:r??null,pf=({app:r,parent:e,prevElement:t,nextElement:i,animation:s,animations:o,animationBus:n,completionTracker:a,eventHandler:l,elementPlugins:c,renderContext:u,plugin:h,zIndex:d,signal:f})=>{if(!t&&!i)throw new Error(`Replace animation "${s.id}" must receive prevElement and/or nextElement.`);if(f?.aborted||e.destroyed)return;let p=t?e.children.find(P=>P.label===t.id)??null:null;if(t&&!p)throw new Error(`Transition animation "${s.id}" could not find the previous element "${t.id}".`);let m=p?FR(r,p):null,g=new te,y=Gd({suppressAnimations:!0}),v=a.getVersion(),x=!1,T=()=>{x||(a.track(v),x=!0)},b=()=>{x&&(a.complete(v),x=!1)},E=({flushDeferredEffects:P})=>{if(!k){if(k=!0,w.value&&!w.value.destroyed&&(w.value.visible=!0),I.value?.destroy(),P){TM(y);return}Ld(y)}},w={value:null},I={value:null},k=!1;T();let M=P=>{if(f?.aborted||e.destroyed){Ld(y),g.destroy({children:!0}),Hs(m),b();return}if(i&&!P)throw Ld(y),b(),new Error(`Transition animation "${s.id}" could not create the next element "${i.id}".`);w.value=P;let R=P?FR(r,P):null,C=fD({prevElement:t,nextElement:i,animation:s,prevSubject:m,nextSubject:R});C.prevSubject!==m&&Hs(m),C.nextSubject!==R&&Hs(R),g.destroy({children:!1}),p&&h.delete({app:r,parent:e,element:t,animations:[],animationBus:n,completionTracker:a,eventHandler:l,elementPlugins:c,renderContext:u,signal:f}),P&&(P.zIndex=d,e.addChild(P),P.visible=!1);let O=gD({app:r,animation:s,prevSubject:C.prevSubject,nextSubject:C.nextSubject,zIndex:d});I.value=O,e.addChild(O.overlay),n.dispatch({type:"START",payload:{id:s.id,driver:"custom",duration:O.duration,applyFrame:O.apply,applyTargetState:()=>{E({flushDeferredEffects:!1})},onComplete:()=>{try{E({flushDeferredEffects:!0})}finally{b()}},onCancel:()=>{b()},isValid:()=>!!O.overlay&&!O.overlay.destroyed&&(!P||!P.destroyed)}})},A=i?xD({app:r,parent:g,nextElement:i,plugin:h,animations:o,eventHandler:l,animationBus:n,completionTracker:a,elementPlugins:c,renderContext:y,zIndex:d,signal:f}):null;if(A&&typeof A.then=="function"){yD(A).then(M);return}M(A??null)};var Vs=({app:r,parent:e,prevComputedTree:t,nextComputedTree:i,animations:s,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:c=Gd(),signal:u})=>{e.sortableChildren=!0;let h=new Map(l.map(b=>[b.type,b])),d=SM(s),f=new Map,p=new Map;for(let b of t)f.set(b.id,b);for(let b=0;b<i.length;b++)p.set(i[b].id,b);let{toAddElement:m,toDeleteElement:g,toUpdateElement:y}=BR(t,i,s),v=new Set(y.map(({next:b})=>b.id)),x=b=>{let E=h.get(b);if(!E)throw new Error(`No plugin found for element type: ${b}`);return E},T=b=>e.children.find(E=>E.label===b)?.zIndex??-1;for(let b of i){let E=f.get(b.id);!E||v.has(b.id)||!xe(E,b)||x(b.type).shouldUpdateUnchanged?.({app:r,parent:e,prevElement:E,nextElement:b,animations:d,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:c,zIndex:p.get(b.id)??-1,signal:u})!==!0||(y.push({prev:E,next:b}),v.add(b.id))}for(let b of e.children){let E=p.get(b.label);E!==void 0&&(b.zIndex=E)}for(let b of g){let E=c.suppressAnimations?null:Hd(d,b.id),w=x(b.type);if(E){pf({app:r,parent:e,prevElement:b,nextElement:null,animation:E,animations:d,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:c,plugin:w,zIndex:T(b.id),signal:u});continue}w.delete({app:r,parent:e,element:b,animations:[],animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:c,signal:u})}for(let b of m){let E=c.suppressAnimations?null:Hd(d,b.id),w=x(b.type),I=p.get(b.id)??-1;if(E){pf({app:r,parent:e,prevElement:null,nextElement:b,animation:E,animations:d,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:c,plugin:w,zIndex:I,signal:u});continue}w.add({app:r,parent:e,element:b,animations:d,eventHandler:a,animationBus:o,completionTracker:n,elementPlugins:l,renderContext:c,zIndex:I,signal:u})}for(let{prev:b,next:E}of y){let w=x(E.type),I=p.get(E.id)??-1,k=c.suppressAnimations?null:Hd(d,E.id);if(k){pf({app:r,parent:e,prevElement:b,nextElement:E,animation:k,animations:d,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:c,plugin:w,zIndex:I,signal:u});continue}w.update({app:r,parent:e,prevElement:b,nextElement:E,animations:d,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:c,zIndex:I,signal:u})}};var _D=(r=[])=>{let e=new Set;for(let t of r)if(t?.id){if(e.has(t.id))return!0;e.add(t.id)}return!1},bD=({app:r,container:e,children:t,eventHandler:i,animationBus:s,elementPlugins:o,renderContext:n,completionTracker:a,signal:l})=>{for(let c of t){let u=o.find(h=>h.type===c.type);if(!u)throw new Error(`No plugin found for child element type: ${c.type}`);u.add({app:r,parent:e,element:c,animations:[],eventHandler:i,animationBus:s,elementPlugins:o,renderContext:n,completionTracker:a,signal:l})}},HR=({app:r,parent:e,element:t,animations:i,eventHandler:s,animationBus:o,elementPlugins:n,renderContext:a,zIndex:l,completionTracker:c,signal:u})=>{let{id:h,x:d,y:f,children:p,scroll:m,alpha:g}=t,y=new te;y.label=h,y.zIndex=l,y.x=Math.round(d),y.y=Math.round(f),y.alpha=g,e.addChild(y),p&&p.length>0&&(_D(p)?bD({app:r,container:y,children:p,eventHandler:s,animationBus:o,elementPlugins:n,renderContext:a,completionTracker:c,signal:u}):Vs({app:r,parent:y,prevComputedTree:[],nextComputedTree:p,animations:i,animationBus:o,completionTracker:c,eventHandler:s,elementPlugins:n,renderContext:a,signal:u})),(m||t.anchorToBottom)&&gc({container:y,element:t,interactive:!!m,allowViewportWithoutScroll:!!t.anchorToBottom}),lf({app:r,container:y,element:t,eventHandler:s})};var VR=({app:r,parent:e,prevElement:t,nextElement:i,eventHandler:s,animations:o,animationBus:n,elementPlugins:a,renderContext:l,zIndex:c,completionTracker:u,signal:h})=>{let d=e.children.find(v=>v.label===t.id);if(!d)return;d.zIndex=c;let{x:f,y:p,alpha:m}=i,g=()=>{if(!xe(t,i)){d.x=Math.round(f),d.y=Math.round(p),d.label=i.id,d.alpha=m,d.scale.x=1,d.scale.y=1;let b=t.scroll||t.anchorToBottom,E=i.scroll||i.anchorToBottom,w=E?CR({container:d}):null;b!==E?E?gc({container:d,element:i,interactive:!!i.scroll,allowViewportWithoutScroll:!!i.anchorToBottom,previousState:w}):Qy({container:d}):E&&(Qy({container:d}),gc({container:d,element:i,interactive:!!i.scroll,allowViewportWithoutScroll:!!i.anchorToBottom,previousState:w})),lf({app:r,container:d,element:i,eventHandler:s})}let v=!xe(t.children,i.children),x=xc({children:i.children}),T=Array.from(x).some(b=>Nd(o,b).length>0);if(v||T){let E=d.children.find(w=>w.label===`${i.id}-content`)||d;Vs({app:r,parent:E,nextComputedTree:i.children,prevComputedTree:t.children,eventHandler:s,elementPlugins:a,animations:o,animationBus:n,completionTracker:u,renderContext:l,signal:h}),MR({container:d}),RR({container:d}),IR({container:d})}};ne({animations:o,targetId:t.id,animationBus:n,completionTracker:u,element:d,targetState:{x:f,y:p,alpha:m},onComplete:()=>{g()}})||g()};var WR=({app:r,parent:e,element:t,animationBus:i,animations:s,eventHandler:o,completionTracker:n})=>{let a=e.getChildByLabel(t.id);if(!a)return;let l=()=>{a&&!a.destroyed&&(e.removeChild(a),a.destroy({children:!0}))};ne({animations:s,targetId:t.id,animationBus:i,completionTracker:n,element:a,targetState:null,onComplete:l})||l()};var zR=({state:r,parserPlugins:e=[]})=>{let t=r.direction??"",i=!!r.scroll,s=r.gapX??0,o=r.gapY??0,n=structuredClone(r.children||[]),a=[];if(r.gap!==void 0)throw new Error("Input Error: container.gap is no longer supported. Use gapX and gapY.");let l=0,c=0,u=0,h=0,d=0,f=0,p=0,m=0,g=0,y=0;for(let T=0;T<n.length;T++){let b=n[T];T>0?t==="horizontal"?(b.x=u,b.y=p):t==="vertical"&&(b.x=m,b.y=h):(t==="horizontal"||t==="vertical")&&(b.x=0,b.y=0);let E=e.find(w=>w.type===b.type);if(E){let w=b.scaleX!==void 0||r.scaleX!==void 0,I=b.scaleY!==void 0||r.scaleY!==void 0,k=(b.scaleX??1)*(r.scaleX??1),M=(b.scaleY??1)*(r.scaleY??1);b=E.parse({state:{...b,...w?{scaleX:k}:{},...I?{scaleY:M}:{}},parserPlugins:e})}if(t==="horizontal"){let w=T<n.length-1?s:0;r.width&&b.width+g>r.width&&!i&&!r.anchorToBottom?(u=0,g=0,p+=d+o,d=b.height,b.x=0,b.y=p):d=Math.max(d,b.height),u+=b.width+w,g=b.x+b.width,l=Math.max(u,l),c=Math.max(b.height+b.y,c)}else if(t==="vertical"){let w=T<n.length-1?o:0;r.height&&b.height+y>r.height&&!i&&!r.anchorToBottom?(h=0,y=0,m+=f+s,f=b.width,b.x=m,b.y=0):f=Math.max(f,b.width),h+=b.height+w,y=b.y+b.height,l=Math.max(b.width+b.x,l),c=Math.max(h,c)}else l=Math.max(b.width+b.x,l),c=Math.max(b.height+b.y,c);a.push(b)}let x={...yt({...r,width:r.width?r.width:l,height:r.height?r.height:c}),children:a,direction:t,gapX:s,gapY:o,scroll:i,...r.anchorToBottom&&{anchorToBottom:!0},...r.scrollbar&&{scrollbar:structuredClone(r.scrollbar)},rotation:r.rotation??0};return r.rightClick&&(x.rightClick=r.rightClick),x};var vD=et({type:"container",add:HR,update:VR,delete:WR,parse:zR});var $R=async({parent:r,element:e,animationBus:t,renderContext:i,completionTracker:s,zIndex:o,signal:n})=>{if(n?.aborted)return;let a=new te;if(a.label=e.id,a.zIndex=o,e.x!==void 0&&(a.x=Math.round(e.x)),e.y!==void 0&&(a.y=Math.round(e.y)),e.alpha!==void 0&&(a.alpha=e.alpha),r.addChild(a),i?.suppressAnimations&&!bn(e)){await Ti({container:a,element:e,completionTracker:s,animationBus:t,zIndex:o,signal:n,playback:"paused-initial"}),Dd(i,{container:a,element:e,completionTracker:s,animationBus:t,zIndex:o,signal:n});return}await Ti({container:a,element:e,completionTracker:s,animationBus:t,zIndex:o,signal:n,playback:"autoplay"})};var XR=(r={})=>JSON.stringify({content:r.content??null,revealEffect:r.revealEffect??"typewriter",softWipe:(r.revealEffect??"typewriter")==="softWipe"?_n(r.softWipe):null,speed:r.speed??50,width:r.width??null,indicator:r.indicator??null,x:r.x??null,y:r.y??null,alpha:r.alpha??1}),TD=(r,e)=>XR(r)!==XR(e),jR=async({parent:r,prevElement:e,nextElement:t,animations:i,animationBus:s,renderContext:o,completionTracker:n,zIndex:a,signal:l})=>{if(l?.aborted)return;let c=r.children.find(d=>d.label===e.id);if(!c)return;let u=async()=>{if(t.x!==void 0&&(c.x=t.x),t.y!==void 0&&(c.y=t.y),t.alpha!==void 0&&(c.alpha=t.alpha),!TD(e,t)){o?.suppressAnimations!==!0&&!bn(t)&&await Ti({container:c,element:t,completionTracker:n,animationBus:s,zIndex:a,signal:l,playback:"resume"});return}if(o?.suppressAnimations===!0&&!bn(t)){await Ti({container:c,element:t,completionTracker:n,animationBus:s,zIndex:a,signal:l,playback:"paused-initial"}),Dd(o,{container:c,element:t,completionTracker:n,animationBus:s,zIndex:a,signal:l});return}await Ti({container:c,element:t,completionTracker:n,animationBus:s,zIndex:a,signal:l,playback:"autoplay"})};ne({animations:i,targetId:e.id,animationBus:s,completionTracker:n,element:c,targetState:{x:t.x??c.x,y:t.y??c.y,alpha:t.alpha??c.alpha},onComplete:()=>{u()}})||await u()};var YR=({parent:r,element:e,animations:t,animationBus:i,completionTracker:s})=>{let o=r.getChildByLabel(e.id);if(!o||o.destroyed)return;let n=()=>{o&&!o.destroyed&&(ky(o),o.destroy({children:!0}))};ne({animations:t,targetId:e.id,animationBus:i,completionTracker:s,element:o,targetState:null,onComplete:n})||n()};var SD=r=>r===`
|
|
1415
|
+
`,tD=(r,e)=>{let t=document.createElement("canvas");t.width=r,t.height=e;let i=t.getContext("2d",{willReadFrequently:!0});if(!i)throw new Error("Replace mask composition could not create a 2D canvas.");return{canvas:t,context:i}},rD=(r,e,t="red")=>{switch(t){case"green":return r[e+1];case"blue":return r[e+2];case"alpha":return r[e+3];default:return r[e]}},iD=({app:r,texture:e,width:t,height:i,channel:s="red",invert:o=!1})=>{let n=new Uint8ClampedArray(t*i),a=new Te(B.from(e));a.width=t,a.height=i;let l=new te;l.addChild(a);let c=Ki.create({width:t,height:i});r.renderer.render({container:l,target:c,clear:!0});let u=r.renderer.extract.pixels(c).pixels;for(let h=0,d=0;h<n.length;h++,d+=4){let f=rD(u,d,s);o&&(f=255-f),n[h]=f}return l.destroy({children:!0}),c.destroy(!0),n},sD=(r,e,t,i)=>{let s=null;for(let o of e.items){let n=iD({app:r,texture:o.texture,width:t,height:i,channel:o.channel??"red",invert:o.invert??!1});if(!s){s=n;continue}for(let a=0;a<s.length;a++)switch(e.combine??"max"){case"min":s[a]=Math.min(s[a],n[a]);break;case"multiply":s[a]=Math.round(s[a]/255*(n[a]/255)*255);break;case"add":s[a]=Math.min(255,s[a]+n[a]);break;default:s[a]=Math.max(s[a],n[a]);break}}return s??new Uint8ClampedArray(t*i)},df=(r="red")=>{switch(r){case"green":return new Float32Array([0,1,0,0]);case"blue":return new Float32Array([0,0,1,0]);case"alpha":return new Float32Array([0,0,0,1]);default:return new Float32Array([1,0,0,0])}},e_=df("red"),t_=(r,e)=>Ki.create({width:r,height:e,resolution:1}),oD=(r,e)=>{let t=new be({uMaskInvert:{value:e?1:0,type:"f32"},uMaskChannelWeights:{value:r,type:"vec4<f32>"}});return{filter:rn.from({gpu:{vertex:{source:UR,entryPoint:"mainVertex"},fragment:{source:UR,entryPoint:"mainFragment"}},gl:{vertex:NR,fragment:eD,name:"replace-mask-channel-filter"},resources:{maskChannelUniforms:t}}),maskChannelUniforms:t}},GR=({app:r,texture:e,width:t,height:i,channelWeights:s,invert:o=!1})=>{let n=B.from(e),a=new Te(n);a.width=t,a.height=i,a.filterArea=new Q(0,0,t,i);let l=new te;l.addChild(a);let c=t_(t,i),{filter:u}=oD(s,o);return a.filters=[u],r.renderer.render({container:l,target:c,clear:!0}),a.filters=[],l.destroy({children:!0}),u.destroy(),c},nD=(r,e,t)=>{let{canvas:i,context:s}=tD(r,e),o=s.createImageData(r,e),n=o.data;for(let a=0,l=0;a<t.length;a++,l+=4){let c=t[a];n[l]=c,n[l+1]=c,n[l+2]=c,n[l+3]=255}return s.putImageData(o,0,0),B.from(i)},aD=(r,e,t,i)=>{if(!e)return{textures:[B.WHITE.source],channelWeights:df("red"),invert:0,destroy:()=>{}};if(e.kind==="single"){let o=GR({app:r,texture:e.texture,width:t,height:i,channelWeights:df(e.channel??"red"),invert:e.invert??!1});return{textures:[o.source],channelWeights:e_,invert:0,destroy:()=>{o.destroy(!0)}}}if(e.kind==="sequence"){let o=e.textures.map(n=>GR({app:r,texture:n,width:t,height:i,channelWeights:df(e.channel??"red"),invert:e.invert??!1}));return{textures:o.map(n=>n.source),channelWeights:e_,invert:0,destroy:()=>{for(let n of o)n.destroy(!0)}}}let s=nD(t,i,sD(r,e,t,i));return{textures:[s.source],channelWeights:e_,invert:0,destroy:()=>{s.destroyed||s.destroy(!0)}}},lD=()=>{let r=new be({uProgress:{value:0,type:"f32"},uSoftness:{value:.001,type:"f32"},uMaskMix:{value:0,type:"f32"},uMaskInvert:{value:0,type:"f32"},uMaskChannelWeights:{value:new Float32Array([1,0,0,0]),type:"vec4<f32>"},uSecondaryMatrix:{value:new L,type:"mat3x3<f32>"},uSecondaryClamp:{value:new Float32Array([0,0,1,1]),type:"vec4<f32>"}});return{filter:rn.from({gpu:{vertex:{source:OR,entryPoint:"mainVertex"},fragment:{source:OR,entryPoint:"mainFragment"}},gl:{vertex:NR,fragment:JL,name:"replace-mask-filter"},resources:{replaceMaskUniforms:r,uNextTexture:B.EMPTY.source,uMaskTextureA:B.EMPTY.source,uMaskTextureB:B.EMPTY.source}}),replaceMaskUniforms:r}},cD=({progress:r=0,frameCount:e=0,sampleMode:t="hold"}={})=>{if(e<=1)return{fromIndex:0,toIndex:0,mix:0};let i=r_(r)*Math.max(0,e-1);if(t==="linear"){let o=Math.floor(i),n=Math.min(e-1,o+1);return{fromIndex:o,toIndex:n,mix:i-o}}let s=Math.min(e-1,Math.max(0,Math.round(i)));return{fromIndex:s,toIndex:s,mix:0}},uD=(r,e,t,i,s)=>{let o=QL(e),n=yc([{timeline:o}]),a=Math.max(e?.softness??.001,1e-4),{textures:l,channelWeights:c,invert:u,destroy:h}=aD(r,e,t,i),d=s.resources.replaceMaskUniforms,f=-1,p=-1;return{duration:n,progressTimeline:o,apply:m=>{let g=e?.kind==="sequence"?cD({progress:m,frameCount:l.length,sampleMode:e.sample??"hold"}):{fromIndex:0,toIndex:0,mix:0};g.fromIndex!==f&&(s.resources.uMaskTextureA=l[g.fromIndex]??B.EMPTY.source,f=g.fromIndex),g.toIndex!==p&&(s.resources.uMaskTextureB=l[g.toIndex]??B.EMPTY.source,p=g.toIndex),d.uniforms.uProgress=r_(m),d.uniforms.uSoftness=a,d.uniforms.uMaskMix=g.mix,d.uniforms.uMaskInvert=u,d.uniforms.uMaskChannelWeights=c,d.update()},destroy:h}},hD=(r,e)=>{let t=Math.max(1,r),i=Math.max(1,e);return new Float32Array([.5/t,.5/i,1-.5/t,1-.5/i])},dD=r=>{let e=new te;for(let t of r)t?.wrapper&&e.addChild(t.wrapper);return DR(LR(e))},hf=({app:r,container:e,target:t,frame:i})=>{r.renderer.render({container:e,target:t,clear:!0,transform:new L(1,0,0,1,-i.x,-i.y)})},Hs=r=>{r?.wrapper&&!r.wrapper.destroyed&&r.wrapper.destroy({children:!0}),r?.texture?.destroy(!0)},fD=({prevElement:r,nextElement:e,animation:t,prevSubject:i,nextSubject:s})=>{if(!i||!s||r?.id!==e?.id)return{prevSubject:i,nextSubject:s};let o=i,n=s;return t.mask!==void 0&&t.prev===void 0&&t.next===void 0?{prevSubject:o,nextSubject:n}:(t.prev===void 0&&(o=null),t.next===void 0&&(n=null),{prevSubject:o,nextSubject:n})},pD=({app:r,animation:e,prevSubject:t,nextSubject:i,zIndex:s})=>{let o=new te;o.zIndex=s,t?.wrapper&&o.addChild(t.wrapper),i?.wrapper&&o.addChild(i.wrapper);let n=ff(t?.wrapper??null,e.prev?.tween,r),a=ff(i?.wrapper??null,e.next?.tween,r);return{overlay:o,duration:Math.max(n.duration,a.duration),apply:l=>{n.apply(l),a.apply(l)},destroy:()=>{o.removeFromParent(),o.destroy({children:!0}),Hs(t),Hs(i)}}},mD=({app:r,animation:e,prevSubject:t,nextSubject:i,zIndex:s})=>{let o=dD([t,i]),n=new te,a=new te;t?.wrapper&&n.addChild(t.wrapper),i?.wrapper&&a.addChild(i.wrapper);let l=t_(o.width,o.height),c=t_(o.width,o.height),u=new te;u.zIndex=s;let h=new Te(l);h.x=o.x,h.y=o.y,h.filterArea=new Q(0,0,o.width,o.height),u.addChild(h);let{filter:d}=lD();d.resources.uNextTexture=c.source,h.filters=[d];let f=hD(o.width,o.height),p=typeof d.apply=="function"?d.apply.bind(d):(T,b,E,w)=>{T.applyFilter(d,b,E,w)};d.apply=(T,b,E,w)=>{let I=d.resources.replaceMaskUniforms;T.calculateSpriteMatrix(I.uniforms.uSecondaryMatrix,h),I.uniforms.uSecondaryClamp=f,I.update(),p(T,b,E,w)};let m=uD(r,e.mask,o.width,o.height,d),g=ff(t?.wrapper??null,e.prev?.tween,r),y=ff(i?.wrapper??null,e.next?.tween,r),v=!1,x=!1;return t?.wrapper||hf({app:r,container:n,target:l,frame:o}),i?.wrapper||hf({app:r,container:a,target:c,frame:o}),{overlay:u,duration:Math.max(g.duration,y.duration,m.duration),apply:T=>{g.apply(T),y.apply(T),t?.wrapper&&(g.duration>0||!v)&&(hf({app:r,container:n,target:l,frame:o}),v=!0),i?.wrapper&&(y.duration>0||!x)&&(hf({app:r,container:a,target:c,frame:o}),x=!0);let b=r_(_c(m.progressTimeline,T));m.apply(b)},destroy:()=>{u.removeFromParent(),h.filters=[],d.destroy(),u.destroy({children:!0}),n.destroy({children:!0}),a.destroy({children:!0}),l.destroy(!0),c.destroy(!0),Hs(t),Hs(i),m.destroy()}}},gD=({app:r,animation:e,prevSubject:t,nextSubject:i,zIndex:s})=>e.mask?mD({app:r,animation:e,prevSubject:t,nextSubject:i,zIndex:s}):pD({app:r,animation:e,prevSubject:t,nextSubject:i,zIndex:s}),xD=({app:r,parent:e,nextElement:t,plugin:i,animations:s,eventHandler:o,animationBus:n,completionTracker:a,elementPlugins:l,renderContext:c,zIndex:u,signal:h})=>{if(!t)return null;let d=i.add({app:r,parent:e,element:t,animations:s,eventHandler:o,animationBus:n,completionTracker:a,elementPlugins:l,renderContext:c,zIndex:u,signal:h});return d&&typeof d.then=="function"?d.then(()=>h?.aborted||e.destroyed?null:e.children.find(f=>f.label===t.id)??null):h?.aborted||e.destroyed?null:e.children.find(f=>f.label===t.id)??null},yD=async r=>r&&typeof r.then=="function"?r:r??null,pf=({app:r,parent:e,prevElement:t,nextElement:i,animation:s,animations:o,animationBus:n,completionTracker:a,eventHandler:l,elementPlugins:c,renderContext:u,plugin:h,zIndex:d,signal:f})=>{if(!t&&!i)throw new Error(`Replace animation "${s.id}" must receive prevElement and/or nextElement.`);if(f?.aborted||e.destroyed)return;let p=t?e.children.find(P=>P.label===t.id)??null:null;if(t&&!p)throw new Error(`Transition animation "${s.id}" could not find the previous element "${t.id}".`);let m=p?FR(r,p):null,g=new te,y=Gd({suppressAnimations:!0}),v=a.getVersion(),x=!1,T=()=>{x||(a.track(v),x=!0)},b=()=>{x&&(a.complete(v),x=!1)},E=({flushDeferredEffects:P})=>{if(!k){if(k=!0,w.value&&!w.value.destroyed&&(w.value.visible=!0),I.value?.destroy(),P){TM(y);return}Ld(y)}},w={value:null},I={value:null},k=!1;T();let M=P=>{if(f?.aborted||e.destroyed){Ld(y),g.destroy({children:!0}),Hs(m),b();return}if(i&&!P)throw Ld(y),b(),new Error(`Transition animation "${s.id}" could not create the next element "${i.id}".`);w.value=P;let R=P?FR(r,P):null,C=fD({prevElement:t,nextElement:i,animation:s,prevSubject:m,nextSubject:R});C.prevSubject!==m&&Hs(m),C.nextSubject!==R&&Hs(R),g.destroy({children:!1}),p&&h.delete({app:r,parent:e,element:t,animations:[],animationBus:n,completionTracker:a,eventHandler:l,elementPlugins:c,renderContext:u,signal:f}),P&&(P.zIndex=d,e.addChild(P),P.visible=!1);let O=gD({app:r,animation:s,prevSubject:C.prevSubject,nextSubject:C.nextSubject,zIndex:d});I.value=O,e.addChild(O.overlay),n.dispatch({type:"START",payload:{id:s.id,driver:"custom",duration:O.duration,applyFrame:O.apply,applyTargetState:()=>{E({flushDeferredEffects:!1})},onComplete:()=>{try{E({flushDeferredEffects:!0})}finally{b()}},onCancel:()=>{b()},isValid:()=>!!O.overlay&&!O.overlay.destroyed&&(!P||!P.destroyed)}})},A=i?xD({app:r,parent:g,nextElement:i,plugin:h,animations:o,eventHandler:l,animationBus:n,completionTracker:a,elementPlugins:c,renderContext:y,zIndex:d,signal:f}):null;if(A&&typeof A.then=="function"){yD(A).then(M);return}M(A??null)};var Vs=({app:r,parent:e,prevComputedTree:t,nextComputedTree:i,animations:s,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:c=Gd(),signal:u})=>{e.sortableChildren=!0;let h=new Map(l.map(b=>[b.type,b])),d=SM(s),f=new Map,p=new Map;for(let b of t)f.set(b.id,b);for(let b=0;b<i.length;b++)p.set(i[b].id,b);let{toAddElement:m,toDeleteElement:g,toUpdateElement:y}=BR(t,i,s),v=new Set(y.map(({next:b})=>b.id)),x=b=>{let E=h.get(b);if(!E)throw new Error(`No plugin found for element type: ${b}`);return E},T=b=>e.children.find(E=>E.label===b)?.zIndex??-1;for(let b of i){let E=f.get(b.id);!E||v.has(b.id)||!xe(E,b)||x(b.type).shouldUpdateUnchanged?.({app:r,parent:e,prevElement:E,nextElement:b,animations:d,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:c,zIndex:p.get(b.id)??-1,signal:u})!==!0||(y.push({prev:E,next:b}),v.add(b.id))}for(let b of e.children){let E=p.get(b.label);E!==void 0&&(b.zIndex=E)}for(let b of g){let E=c.suppressAnimations?null:Hd(d,b.id),w=x(b.type);if(E){pf({app:r,parent:e,prevElement:b,nextElement:null,animation:E,animations:d,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:c,plugin:w,zIndex:T(b.id),signal:u});continue}w.delete({app:r,parent:e,element:b,animations:[],animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:c,signal:u})}for(let b of m){let E=c.suppressAnimations?null:Hd(d,b.id),w=x(b.type),I=p.get(b.id)??-1;if(E){pf({app:r,parent:e,prevElement:null,nextElement:b,animation:E,animations:d,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:c,plugin:w,zIndex:I,signal:u});continue}w.add({app:r,parent:e,element:b,animations:d,eventHandler:a,animationBus:o,completionTracker:n,elementPlugins:l,renderContext:c,zIndex:I,signal:u})}for(let{prev:b,next:E}of y){let w=x(E.type),I=p.get(E.id)??-1,k=c.suppressAnimations?null:Hd(d,E.id);if(k){pf({app:r,parent:e,prevElement:b,nextElement:E,animation:k,animations:d,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:c,plugin:w,zIndex:I,signal:u});continue}w.update({app:r,parent:e,prevElement:b,nextElement:E,animations:d,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:c,zIndex:I,signal:u})}};var _D=(r=[])=>{let e=new Set;for(let t of r)if(t?.id){if(e.has(t.id))return!0;e.add(t.id)}return!1},bD=({app:r,container:e,children:t,eventHandler:i,animationBus:s,elementPlugins:o,renderContext:n,completionTracker:a,signal:l})=>{for(let c of t){let u=o.find(h=>h.type===c.type);if(!u)throw new Error(`No plugin found for child element type: ${c.type}`);u.add({app:r,parent:e,element:c,animations:[],eventHandler:i,animationBus:s,elementPlugins:o,renderContext:n,completionTracker:a,signal:l})}},HR=({app:r,parent:e,element:t,animations:i,eventHandler:s,animationBus:o,elementPlugins:n,renderContext:a,zIndex:l,completionTracker:c,signal:u})=>{let{id:h,x:d,y:f,children:p,scroll:m,alpha:g}=t,y=new te;y.label=h,y.zIndex=l,y.x=Math.round(d),y.y=Math.round(f),y.alpha=g,e.addChild(y),p&&p.length>0&&(_D(p)?bD({app:r,container:y,children:p,eventHandler:s,animationBus:o,elementPlugins:n,renderContext:a,completionTracker:c,signal:u}):Vs({app:r,parent:y,prevComputedTree:[],nextComputedTree:p,animations:i,animationBus:o,completionTracker:c,eventHandler:s,elementPlugins:n,renderContext:a,signal:u})),(m||t.anchorToBottom)&&gc({container:y,element:t,interactive:!!m,allowViewportWithoutScroll:!!t.anchorToBottom}),lf({app:r,container:y,element:t,eventHandler:s})};var VR=({app:r,parent:e,prevElement:t,nextElement:i,eventHandler:s,animations:o,animationBus:n,elementPlugins:a,renderContext:l,zIndex:c,completionTracker:u,signal:h})=>{let d=e.children.find(v=>v.label===t.id);if(!d)return;d.zIndex=c;let{x:f,y:p,alpha:m}=i,g=()=>{if(!xe(t,i)){d.x=Math.round(f),d.y=Math.round(p),d.label=i.id,d.alpha=m,d.scale.x=1,d.scale.y=1;let b=t.scroll||t.anchorToBottom,E=i.scroll||i.anchorToBottom,w=E?CR({container:d}):null;b!==E?E?gc({container:d,element:i,interactive:!!i.scroll,allowViewportWithoutScroll:!!i.anchorToBottom,previousState:w}):Qy({container:d}):E&&(Qy({container:d}),gc({container:d,element:i,interactive:!!i.scroll,allowViewportWithoutScroll:!!i.anchorToBottom,previousState:w})),lf({app:r,container:d,element:i,eventHandler:s})}let v=!xe(t.children,i.children),x=xc({children:i.children}),T=Array.from(x).some(b=>Nd(o,b).length>0);if(v||T){let E=d.children.find(w=>w.label===`${i.id}-content`)||d;Vs({app:r,parent:E,nextComputedTree:i.children,prevComputedTree:t.children,eventHandler:s,elementPlugins:a,animations:o,animationBus:n,completionTracker:u,renderContext:l,signal:h}),MR({container:d}),RR({container:d}),IR({container:d})}};ne({animations:o,targetId:t.id,animationBus:n,completionTracker:u,element:d,targetState:{x:f,y:p,alpha:m},onComplete:()=>{g()}})||g()};var WR=({app:r,parent:e,element:t,animationBus:i,animations:s,eventHandler:o,completionTracker:n})=>{let a=e.getChildByLabel(t.id);if(!a)return;let l=()=>{a&&!a.destroyed&&(e.removeChild(a),a.destroy({children:!0}))};ne({animations:s,targetId:t.id,animationBus:i,completionTracker:n,element:a,targetState:null,onComplete:l})||l()};var zR=({state:r,parserPlugins:e=[]})=>{let t=r.direction==="horizontal"||r.direction==="vertical"?r.direction:"absolute",i=!!r.scroll,s=r.gapX??0,o=r.gapY??0,n=structuredClone(r.children||[]),a=[];if(r.gap!==void 0)throw new Error("Input Error: container.gap is no longer supported. Use gapX and gapY.");let l=0,c=0,u=0,h=0,d=0,f=0,p=0,m=0,g=0,y=0;for(let T=0;T<n.length;T++){let b=n[T];T>0?t==="horizontal"?(b.x=u,b.y=p):t==="vertical"&&(b.x=m,b.y=h):(t==="horizontal"||t==="vertical")&&(b.x=0,b.y=0);let E=e.find(w=>w.type===b.type);if(E){let w=b.scaleX!==void 0||r.scaleX!==void 0,I=b.scaleY!==void 0||r.scaleY!==void 0,k=(b.scaleX??1)*(r.scaleX??1),M=(b.scaleY??1)*(r.scaleY??1);b=E.parse({state:{...b,...w?{scaleX:k}:{},...I?{scaleY:M}:{}},parserPlugins:e})}if(t==="horizontal"){let w=T<n.length-1?s:0;r.width&&b.width+g>r.width&&!i&&!r.anchorToBottom?(u=0,g=0,p+=d+o,d=b.height,b.x=0,b.y=p):d=Math.max(d,b.height),u+=b.width+w,g=b.x+b.width,l=Math.max(u,l),c=Math.max(b.height+b.y,c)}else if(t==="vertical"){let w=T<n.length-1?o:0;r.height&&b.height+y>r.height&&!i&&!r.anchorToBottom?(h=0,y=0,m+=f+s,f=b.width,b.x=m,b.y=0):f=Math.max(f,b.width),h+=b.height+w,y=b.y+b.height,l=Math.max(b.width+b.x,l),c=Math.max(h,c)}else l=Math.max(b.width+b.x,l),c=Math.max(b.height+b.y,c);a.push(b)}let x={...yt({...r,width:r.width?r.width:l,height:r.height?r.height:c}),children:a,direction:t,gapX:s,gapY:o,scroll:i,...r.anchorToBottom&&{anchorToBottom:!0},...r.scrollbar&&{scrollbar:structuredClone(r.scrollbar)},rotation:r.rotation??0};return r.rightClick&&(x.rightClick=r.rightClick),x};var vD=et({type:"container",add:HR,update:VR,delete:WR,parse:zR});var $R=async({parent:r,element:e,animationBus:t,renderContext:i,completionTracker:s,zIndex:o,signal:n})=>{if(n?.aborted)return;let a=new te;if(a.label=e.id,a.zIndex=o,e.x!==void 0&&(a.x=Math.round(e.x)),e.y!==void 0&&(a.y=Math.round(e.y)),e.alpha!==void 0&&(a.alpha=e.alpha),r.addChild(a),i?.suppressAnimations&&!bn(e)){await Ti({container:a,element:e,completionTracker:s,animationBus:t,zIndex:o,signal:n,playback:"paused-initial"}),Dd(i,{container:a,element:e,completionTracker:s,animationBus:t,zIndex:o,signal:n});return}await Ti({container:a,element:e,completionTracker:s,animationBus:t,zIndex:o,signal:n,playback:"autoplay"})};var XR=(r={})=>JSON.stringify({content:r.content??null,revealEffect:r.revealEffect??"typewriter",softWipe:(r.revealEffect??"typewriter")==="softWipe"?_n(r.softWipe):null,speed:r.speed??50,width:r.width??null,indicator:r.indicator??null,x:r.x??null,y:r.y??null,alpha:r.alpha??1}),TD=(r,e)=>XR(r)!==XR(e),jR=async({parent:r,prevElement:e,nextElement:t,animations:i,animationBus:s,renderContext:o,completionTracker:n,zIndex:a,signal:l})=>{if(l?.aborted)return;let c=r.children.find(d=>d.label===e.id);if(!c)return;let u=async()=>{if(t.x!==void 0&&(c.x=t.x),t.y!==void 0&&(c.y=t.y),t.alpha!==void 0&&(c.alpha=t.alpha),!TD(e,t)){o?.suppressAnimations!==!0&&!bn(t)&&await Ti({container:c,element:t,completionTracker:n,animationBus:s,zIndex:a,signal:l,playback:"resume"});return}if(o?.suppressAnimations===!0&&!bn(t)){await Ti({container:c,element:t,completionTracker:n,animationBus:s,zIndex:a,signal:l,playback:"paused-initial"}),Dd(o,{container:c,element:t,completionTracker:n,animationBus:s,zIndex:a,signal:l});return}await Ti({container:c,element:t,completionTracker:n,animationBus:s,zIndex:a,signal:l,playback:"autoplay"})};ne({animations:i,targetId:e.id,animationBus:s,completionTracker:n,element:c,targetState:{x:t.x??c.x,y:t.y??c.y,alpha:t.alpha??c.alpha},onComplete:()=>{u()}})||await u()};var YR=({parent:r,element:e,animations:t,animationBus:i,completionTracker:s})=>{let o=r.getChildByLabel(e.id);if(!o||o.destroyed)return;let n=()=>{o&&!o.destroyed&&(ky(o),o.destroy({children:!0}))};ne({animations:t,targetId:e.id,animationBus:i,completionTracker:s,element:o,targetState:null,onComplete:n})||n()};var SD=r=>r===`
|
|
1416
1416
|
`||r==="\r",wD=r=>typeof r=="string"&&Le.isBreakingSpace(r),ED=(r,e,t)=>{let i=0,s=0;for(;i<r.length&&s<e.length&&r[i]===e[s];)i+=1,s+=1;if(s<e.length){let a=Math.min(r.length,e.length);return{remainingText:r.slice(a),consumedExplicitNewline:!1}}let o=i,n=o;for(;n<r.length&&wD(r[n]);)n+=1;if(SD(r[n])){let a=n+1;return r[n]==="\r"&&r[n+1]===`
|
|
1417
1417
|
`&&(a+=1),{remainingText:r.slice(a),consumedExplicitNewline:!0}}return t?{remainingText:r.slice(n),consumedExplicitNewline:!1}:{remainingText:r.slice(o),consumedExplicitNewline:!1}},AD=(r,e)=>{let t=[],i=[],s=0,o=0,n=0,a=0,l=0,c=[...r],u=new WeakSet,h=Math.max(10,r.reduce((p,m)=>p+(m?.text?.length??0),0)*4),d=()=>{t.push({lineParts:[...i],y:o,lineMaxHeight:n}),s=0,o+=n,n=0,i=[]};for(;c.length>0;){if(l+=1,l>h)throw new Error("[parseTextRevealing] Failed to make progress while wrapping text.");let p=c[0];if(!p.text||p.text.length===0){c.shift();continue}let m=p.text,g=Math.max(1,Math.round(e-s)),y={...p.textStyle,wordWrapWidth:g},v=Le.measureText(p.text,new Oe(ir(y)));if(v.lineWidths[0]>g&&i.length>0){d();continue}let x=v.lines[0]??"",T=v.lines.length>1,b="",E=!1;if(v.lines.length===1&&p.text.endsWith(" ")&&!x.endsWith(" ")&&(x+=" "),x.length>0){let M=ED(m,x,T);b=M.remainingText,E=M.consumedExplicitNewline}if(x.length===0&&m.length>0){let M=m.match(/^\s+/)?.[0]??"";x=M.length>0?M:m[0],b=m.slice(x.length)}if(b===m){let M=m.match(/^\s+/)?.[0]??m[0]??"";if(M.length===0)throw new Error("[parseTextRevealing] Failed to consume text while wrapping.");x=M,b=m.slice(M.length)}let w=Le.measureText(x,new Oe({...ir(p.textStyle),wordWrap:!1,breakWords:!1})),I=Math.max(0,Math.round(w.width??v.lineWidths[0]??0)),k={text:x,textStyle:y,height:w.height,x:s,y:o};if(p.furigana&&!u.has(p)){u.add(p);let M=Le.measureText(p.furigana.text,new Oe(ir(p.furigana.textStyle))),A=-M.height+o+2,P={text:p.furigana.text,textStyle:p.furigana.textStyle,x:Math.round(s+(I-M.width)/2),y:A};k.furigana=P}i.push(k),n=Math.max(n,w.height),s+=I,a=Math.max(a,s),b&&b.length>0?p.text=b:c.shift(),(T||E)&&s>0&&d()}i.length>0&&t.push({lineParts:i,y:o,lineMaxHeight:n});for(let p=0;p<t.length;p++){let m=t[p].lineMaxHeight;t[p].lineParts=t[p].lineParts.map(g=>{let y=g.height;g.height&&delete g.height;let v=g.y+(m-y),x=g.furigana;return x&&(x.y=x.y-g.y+v),{...g,...x&&{furigana:x},y:v}})}let f=t.length>0?t[t.length-1].y+t[t.length-1].lineMaxHeight:0;return{chunks:t,width:Math.max(a,e),height:f}},qR=({state:r})=>{let e={...Ge,wordWrap:!0,...r.textStyle||{}},t=(r.content||[]).map(u=>{let h={...e,...u.textStyle||{}};h.lineHeight=Math.round(h.lineHeight*h.fontSize),r.width&&(h.wordWrapWidth=r.width,h.wordWrap=!0);let d=null;if(u.furigana){let p={...e,...u.furigana.textStyle||{}};p.lineHeight=Math.round(p.lineHeight*p.fontSize),r.width&&(p.wordWrapWidth=r.width,p.wordWrap=!0),d={text:String(u.furigana.text),textStyle:p}}return{text:String(u.text).replace(/ +$/,p=>"\xA0".repeat(p.length)),textStyle:h,...d&&{furigana:d}}}),i=r.width||500,{chunks:s,width:o,height:n}=AD(t,i),a=r.width||o,c=yt({...r,width:a,height:n});if(c.alpha=r.alpha??1,r.indicator){let u=r.indicator;c.indicator={revealing:{src:u.revealing?.src??"",width:u.revealing?.width??12,height:u.revealing?.height??12},complete:{src:u.complete?.src??"",width:u.complete?.width??12,height:u.complete?.height??12},offset:u.offset??12}}return{...c,content:s,textStyle:{...e,...r.textStyle||{}},speed:r.speed??50,revealEffect:r.revealEffect??"typewriter",...r.softWipe!==void 0&&{softWipe:_n(r.softWipe)},...r.width!==void 0&&{width:r.width},...r.complete&&{complete:r.complete}}};var CD=et({type:"text-revealing",add:$R,update:jR,delete:YR,parse:qR,shouldUpdateUnchanged:({parent:r,nextElement:e})=>pM(r.children.find(t=>t.label===e.id))});var mf=(r,e,t,i)=>{if(!t)return;let s=o=>{o?.detail?.elementId===e&&typeof o?.detail?.frameIndex=="number"&&(r.gotoAndStop(o?.detail?.frameIndex),i?.())};window.addEventListener("snapShotAnimatedSpriteFrame",s),r._snapShotKeyFrameHandler=s},gf=r=>{r._snapShotKeyFrameHandler&&(window.removeEventListener("snapShotAnimatedSpriteFrame",r._snapShotKeyFrameHandler),delete r._snapShotKeyFrameHandler)};var KR=(r={})=>{if(r.frame){let n=r.frame.w??0,a=r.frame.h??0,l=r.sourceSize?.w??n,c=r.sourceSize?.h??a,u={frame:{x:r.frame.x??0,y:r.frame.y??0,w:n,h:a},rotated:r.rotated??!1,trimmed:r.trimmed??!1,spriteSourceSize:{x:r.spriteSourceSize?.x??0,y:r.spriteSourceSize?.y??0,w:r.spriteSourceSize?.w??n,h:r.spriteSourceSize?.h??a},sourceSize:{w:l,h:c}};return r.anchor?u.anchor={x:r.anchor.x??0,y:r.anchor.y??0}:r.pivot&&(u.anchor={x:r.pivot.x??0,y:r.pivot.y??0}),r.borders&&(u.borders={...r.borders}),u}let e=r.width??r.w??0,t=r.height??r.h??0,i=r.sourceWidth??e,s=r.sourceHeight??t,o={frame:{x:r.x??0,y:r.y??0,w:e,h:t},rotated:r.rotated??!1,trimmed:r.trimmed??!1,spriteSourceSize:{x:r.offsetX??0,y:r.offsetY??0,w:e,h:t},sourceSize:{w:i,h:s}};return r.anchor?o.anchor={x:r.anchor.x??0,y:r.anchor.y??0}:r.pivot&&(o.anchor={x:r.pivot.x??0,y:r.pivot.y??0}),r.borders&&(o.borders={...r.borders}),o},i_=(r={})=>!r||typeof r!="object"?{}:Object.fromEntries(Object.entries(r).map(([e,t])=>[e,Array.isArray(t)?t.map(i=>String(i)):[]])),PD=(r,e={})=>{let t=Math.max(0,Number(e.from??0)),i=Math.min(r.length-1,Number(e.to??t));if(!Number.isFinite(t)||!Number.isFinite(i)||i<t)return[];let s=r.slice(t,i+1),o=String(e.direction??"forward").toLowerCase();if(o==="reverse"||o==="backward")return[...s].reverse();if(o==="pingpong")return[...s,...s.slice(1,-1).reverse()];if(o==="pingpong_reverse"){let n=[...s].reverse();return[...n,...n.slice(1,-1).reverse()]}return s},MD=(r=[],e=[])=>!Array.isArray(r)||e.length===0?{}:Object.fromEntries(r.map(t=>{let i=typeof t?.name=="string"?t.name:"";return i?[i,PD(e,t)]:null}).filter(Boolean)),Bn=(r={})=>{let e=r??{},t=i_(e.animations);return{frames:Array.isArray(e.frames)?Object.fromEntries(e.frames.map(s=>{let o=s?.filename??s?.name;return typeof o!="string"||o.length===0?null:[o,KR(s)]}).filter(Boolean)):Object.fromEntries(Object.entries(e.frames??{}).map(([s,o])=>[s,KR(o)])),...Object.keys(t).length>0?{animations:t}:{},meta:{...e.meta??{},scale:String(e.scale??e.meta?.scale??1),...e.width!=null||e.height!=null?{size:{w:e.width??e.meta?.size?.w??0,h:e.height??e.meta?.size?.h??0}}:{}}}},kn=(r={},e={},t={},i=[])=>({...MD(t?.frameTags,i),...i_(e),...i_(r)}),RD=(r,e)=>{if(!Array.isArray(e?.frames))return[];let t=Object.keys(r.frames??{});return e.frames.map(i=>typeof i=="number"?t[i]:String(i)).filter(Boolean)},Ws=({atlas:r={frames:{}},clips:e={},playback:t,legacyAnimation:i})=>{let s=t??i??{},o={fps:s.fps??null,loop:s.loop??!0,autoplay:s.autoplay??!0};return typeof s.clip=="string"&&s.clip.length>0&&(o.clip=s.clip),Array.isArray(s.frames)?o.frames=s.frames.map(n=>typeof n=="number"?Object.keys(r.frames??{})[n]:String(n)).filter(Boolean):o.clip||(o.frames=RD(r,i)),o.fps==null&&(typeof s.animationSpeed=="number"?o.fps=s.animationSpeed*60:o.fps=30),o.clip&&(!Array.isArray(o.frames)||o.frames.length===0)&&(o.frames=Array.isArray(e[o.clip])?[...e[o.clip]]:[]),Array.isArray(o.frames)||(o.frames=[]),o},xf=({spritesheet:r,atlas:e,clips:t={},playback:i,legacyAnimation:s})=>{let o=Ws({atlas:e,clips:t,playback:i,legacyAnimation:s});return{frameTextures:o.frames.map(a=>r.textures[a]),playback:o}},yf=r=>typeof r=="number"?r/60:.5;var ZR=async({app:r,parent:e,element:t,renderContext:i,completionTracker:s,zIndex:o,signal:n})=>{if(n?.aborted)return;let{id:a,x:l,y:c,width:u,height:h,src:d,atlas:f,clips:p,playback:m,alpha:g}=t,y=Bn(f),v=kn(p,f?.animations,f?.meta,Object.keys(y.frames??{})),x=Ws({atlas:y,clips:v,playback:m}),T=s?.getVersion?.();s?.track?.(T);try{let b=new Ni(B.from(d),y);if(await b.parse(),n?.aborted||e.destroyed)return;let{frameTextures:E}=xf({spritesheet:b,atlas:y,clips:v,playback:x}),w=new lc(E);w.label=a,w.zIndex=o,w.animationSpeed=yf(x.fps),w.loop=x.loop,r.debug?mf(w,a,r.debug,()=>{typeof r.render=="function"&&r.render()}):x.autoplay&&yM(i,w),w.x=Math.round(l),w.y=Math.round(c),w.width=Math.round(u),w.height=Math.round(h),w.alpha=g,e.addChild(w),typeof r.render=="function"&&r.render()}finally{s?.complete?.(T)}};var QR=async({app:r,parent:e,prevElement:t,nextElement:i,animations:s,animationBus:o,completionTracker:n,zIndex:a,signal:l})=>{if(l?.aborted)return;let c=e.children.find(y=>y.label===t.id);if(!c)return;c.zIndex=a;let u=async()=>{if(!(l?.aborted||c.destroyed)&&!xe(t,i)){let y=i.src,v=Bn(i.atlas),x=kn(i.clips,i.atlas?.animations,i.atlas?.meta,Object.keys(v.frames??{})),T=Ws({atlas:v,clips:x,playback:i.playback});c.x=Math.round(i.x),c.y=Math.round(i.y),c.width=Math.round(i.width),c.height=Math.round(i.height),c.alpha=i.alpha;let b=!xe(t.playback,i.playback),E=!xe(t.clips,i.clips),w=t.src!==y||!xe(t.atlas,i.atlas);if(c.animationSpeed=yf(T.fps),c.loop=T.loop,b||E||w){let I=n?.getVersion?.();n?.track?.(I);try{let k=new Ni(B.from(y),v);if(await k.parse(),l?.aborted||c.destroyed)return;let{frameTextures:M}=xf({spritesheet:k,atlas:v,clips:x,playback:T});c.textures=M,typeof r.render=="function"&&r.render(),!r.debug&&T.autoplay?c.play():(r.debug||c.stop?.(),t.id!==i.id&&(gf(c),mf(c,i.id,r.debug,()=>{typeof r.render=="function"&&r.render()})))}finally{n?.complete?.(I)}}}},{x:h,y:d,width:f,height:p,alpha:m}=i;ne({animations:s,targetId:t.id,animationBus:o,completionTracker:n,element:c,targetState:{x:h,y:d,width:f,height:p,alpha:m},onComplete:()=>{u()}})||await u()};var JR=({app:r,parent:e,element:t,animations:i,animationBus:s,completionTracker:o})=>{let n=e.children.find(c=>c.label===t.id);if(!n)return;let a=()=>{r.debug&&gf(n),n&&!n.destroyed&&(n.stop(),n.destroy())};ne({animations:i,targetId:t.id,animationBus:s,completionTracker:o,element:n,targetState:null,onComplete:a})||a()};var eI=({state:r})=>{let e=yt(r),t=r.atlas,i=Bn(t),s=kn(r.clips,t?.animations,t?.meta,Object.keys(i.frames??{})),o=Ws({atlas:i,clips:s,playback:r.playback});return{...e,type:"spritesheet-animation",src:r.src??"",atlas:i,clips:s,playback:o,alpha:r.alpha??1}};var tI=et({type:"spritesheet-animation",add:ZR,update:QR,delete:JR,parse:eI}),ID=tI;var BD=Ey({type:"tween"});var zs=new Map,kD=r=>({id:r.id,url:r.src,loop:r.loop??!1,volume:We(r.volume,80)}),rI=r=>zs.has(r),bc=r=>{let e=zs.get(r);e!==void 0&&(clearTimeout(e),zs.delete(r))},s_=({app:r,element:e})=>{let t=kD(e);if(bc(t.id),e.delay&&e.delay>0){let i=setTimeout(()=>{zs.delete(t.id),r.audioStage.add(t)},e.delay);zs.set(t.id,i);return}r.audioStage.add(t)},o_=()=>{for(let r of zs.values())clearTimeout(r);zs.clear()},iI=({app:r,element:e})=>{s_({app:r,element:e})};var sI=({app:r,prevElement:e,nextElement:t})=>{let i=e.id;if((t.delay??0)>0){r.audioStage.remove(i),s_({app:r,element:t});return}if(rI(i)){bc(i),r.audioStage.add({id:i,url:t.src,loop:t.loop??!1,volume:We(t.volume,80)});return}let o=r.audioStage.getById(i);if(!o){r.audioStage.add({id:i,url:t.src,loop:t.loop??!1,volume:We(t.volume,80)});return}o.url=t.src,o.loop=t.loop??!1,o.volume=We(t.volume,80)};var oI=({app:r,element:e})=>{bc(e.id),r.audioStage.remove(e.id)};var FD=Ay({type:"sound",add:iI,update:sI,delete:oI});var vc=class extends Te{emitter=null;maxLife=0;age=0;oneOverLife=0;get agePercent(){return this.age*this.oneOverLife}velocity={x:0,y:0};rotationSpeed=0;config={};next=null;prev=null;constructor(e){super(),this.emitter=e,this.anchor.set(.5,.5)}init(e){this.maxLife=e,this.age=0,this.oneOverLife=1/e,this.rotation=0,this.position.set(0,0),this.scale.set(1,1),this.tint=16777215,this.alpha=1,this.visible=!0,this.velocity.x=0,this.velocity.y=0,this.rotationSpeed=0,this.config={}}kill(){this.emitter.recycle(this)}destroy(){this.parent&&this.parent.removeChild(this),this.emitter=null,this.next=null,this.prev=null,super.destroy()}};function n_(r){let e=new Ue;return e.circle(0,0,3),e.fill({color:16777215}),r.renderer.generateTexture(e)}function a_(r){let e=new Ue;return e.rect(0,0,1,8),e.fill({color:8965375}),r.renderer.generateTexture(e)}function l_(r){let e=new Ue;return e.circle(0,0,4),e.fill({color:16777215}),r.renderer.generateTexture(e)}function Tc(r,e,t){return r+(e-r)*t}function bf(r){if(typeof r=="number")return r;let e=r.replace(/^(#|0x)/,"");return parseInt(e,16)}function nI(r,e,t){let i=r>>16&255,s=r>>8&255,o=r&255,n=e>>16&255,a=e>>8&255,l=e&255,c=Math.round(Tc(i,n,t)),u=Math.round(Tc(s,a,t)),h=Math.round(Tc(o,l,t));return c<<16|u<<8|h}var _f=class r{constructor(e,t,i=!1){this.value=i?bf(e):e,this.time=t,this.next=null}static createList(e,t=!1){let i=[...e].sort((n,a)=>n.time-a.time),s=new r(i[0].value,i[0].time,t),o=s;for(let n=1;n<i.length;n++)o.next=new r(i[n].value,i[n].time,t),o=o.next;return s}},kr=class{constructor(e=!1){this.first=null,this.isColor=e,this.ease=null}reset(e){Array.isArray(e)?this.first=_f.createList(e,this.isColor):this.first=e}getValue(e){if(this.ease&&(e=this.ease(e)),!this.first.next||e<=this.first.time)return this.first.value;let t=this.first;for(;t.next&&t.next.time<e;)t=t.next;if(!t.next||e>=t.next.time)return t.next?t.next.value:t.value;let i=(e-t.time)/(t.next.time-t.time);return this.isColor?nI(t.value,t.next.value,i):Tc(t.value,t.next.value,i)}};var vf=class{static type="alpha";constructor(e){this.list=new kr(!1),this.list.reset(e.list)}initParticles(e){let t=e,i=this.list.getValue(0);for(;t;)t.alpha=i,t=t.next}updateParticle(e,t){e.alpha=this.list.getValue(e.agePercent)}},Tf=class{static type="alphaStatic";constructor(e){this.alpha=e.alpha}initParticles(e){let t=e;for(;t;)t.alpha=this.alpha,t=t.next}updateParticle(e,t){}};function aI(r,e,t){return Math.min(Math.max(r,e),t)}function It(r,e){if(typeof e=="number")return e;let t=e.min,i=e.max??e.min;if(t===i)return t;let s=e.distribution;return!s||s.kind==="uniform"?t+r()*(i-t):s.kind==="bias"?t+OD(r,s)*(i-t):s.kind==="normal"?UD(r,t,i,s):t+r()*(i-t)}function OD(r,e){let t=e.toward??"min",i=aI(e.strength??.5,0,1),s=1+i*4;if(t==="max")return 1-Math.pow(1-r(),s);if(t==="center"){let o=(r()+r())/2;return r()*(1-i)+o*i}return Math.pow(r(),s)}function UD(r,e,t,i){let s=i.mean??(e+t)/2,o=i.deviation??(t-e)/6,n=Math.max(r(),1e-7),a=r(),l=Math.sqrt(-2*Math.log(n))*Math.cos(2*Math.PI*a);return aI(s+l*o,e,t)}var Sf=class{static type="scale";constructor(e){this.list=new kr(!1),this.list.reset(e.list),this.minMult=e.minMult??1}initParticles(e){let t=e;for(;t;){let i=this.minMult<1?t.emitter.random()*(1-this.minMult)+this.minMult:1;t.config.scaleMult=i;let s=this.list.getValue(0)*i;t.scale.set(s,s),t=t.next}}updateParticle(e,t){let i=this.list.getValue(e.agePercent)*e.config.scaleMult;e.scale.set(i,i)}},wf=class{static type="scaleStatic";constructor(e){this.min=e.min,this.max=e.max,this.distribution=e.distribution}initParticles(e){let t=e;for(;t;){let i=It(t.emitter.random.bind(t.emitter),{min:this.min,max:this.max,distribution:this.distribution});t.scale.set(i,i),t=t.next}}updateParticle(e,t){}};var GD=Math.PI/180,Ef=class{static type="speed";constructor(e){this.list=new kr(!1),this.list.reset(e.list),this.minMult=e.minMult??1}initParticles(e){let t=e;for(;t;){let i=this.minMult<1?t.emitter.random()*(1-this.minMult)+this.minMult:1;t.config.speedMult=i;let s=this.list.getValue(0)*i;t.velocity.x=Math.cos(t.rotation)*s,t.velocity.y=Math.sin(t.rotation)*s,t=t.next}}updateParticle(e,t){let i=this.list.getValue(e.agePercent)*e.config.speedMult,s=Math.sqrt(e.velocity.x*e.velocity.x+e.velocity.y*e.velocity.y);s>0&&(e.velocity.x=e.velocity.x/s*i,e.velocity.y=e.velocity.y/s*i),e.x+=e.velocity.x*t,e.y+=e.velocity.y*t}},Af=class{static type="speedStatic";constructor(e){this.min=e.min,this.max=e.max,this.distribution=e.distribution}initParticles(e){let t=e;for(;t;){let i=It(t.emitter.random.bind(t.emitter),{min:this.min,max:this.max,distribution:this.distribution});t.velocity.x=Math.cos(t.rotation)*i,t.velocity.y=Math.sin(t.rotation)*i,t=t.next}}updateParticle(e,t){e.x+=e.velocity.x*t,e.y+=e.velocity.y*t}},Cf=class{static type="movePoint";constructor(e){this.speed={min:e.speed.min,max:e.speed.max??e.speed.min,distribution:e.speed.distribution},this.direction=e.direction}initParticles(e){let t=e;for(;t;){let i=It(t.emitter.random.bind(t.emitter),this.speed),s=It(t.emitter.random.bind(t.emitter),this.direction)*GD;t.velocity.x=Math.cos(s)*i,t.velocity.y=Math.sin(s)*i,t=t.next}}updateParticle(e,t){e.x+=e.velocity.x*t,e.y+=e.velocity.y*t}};var Pye=Math.PI/180,Pf=class{static type="acceleration";constructor(e){this.accelX=e.accel.x,this.accelY=e.accel.y,this.minStart=e.minStart,this.maxStart=e.maxStart,this.rotate=e.rotate??!1,this.maxSpeed=e.maxSpeed??0}initParticles(e){let t=e;for(;t;){let i=t.emitter.random()*(this.maxStart-this.minStart)+this.minStart;t.velocity.x=Math.cos(t.rotation)*i,t.velocity.y=Math.sin(t.rotation)*i,t=t.next}}updateParticle(e,t){let i=e.velocity,s=i.x,o=i.y;if(i.x+=this.accelX*t,i.y+=this.accelY*t,this.maxSpeed>0){let n=Math.sqrt(i.x*i.x+i.y*i.y);if(n>this.maxSpeed){let a=this.maxSpeed/n;i.x*=a,i.y*=a}}e.x+=(s+i.x)/2*t,e.y+=(o+i.y)/2*t,this.rotate&&(e.rotation=Math.atan2(i.y,i.x))}},Mf=class{static type="gravity";constructor(e){this.gravity=e.gravity}initParticles(e){}updateParticle(e,t){e.velocity.y+=this.gravity*t,e.x+=e.velocity.x*t,e.y+=e.velocity.y*t}};var Sc=Math.PI/180,Rf=class{static type="rotation";constructor(e){this.startRange={min:e.minStart,max:e.maxStart??e.minStart,distribution:e.startDistribution},this.speedRange={min:e.minSpeed,max:e.maxSpeed??e.minSpeed,distribution:e.speedDistribution},this.accel=(e.accel??0)*Sc}initParticles(e){let t=e;for(;t;)t.rotation=It(t.emitter.random.bind(t.emitter),this.startRange)*Sc,t.rotationSpeed=It(t.emitter.random.bind(t.emitter),this.speedRange)*Sc,t=t.next}updateParticle(e,t){if(this.accel!==0){let i=e.rotationSpeed;e.rotationSpeed+=this.accel*t,e.rotation+=(i+e.rotationSpeed)/2*t}else e.rotation+=e.rotationSpeed*t}},If=class{static type="rotationStatic";constructor(e){this.range={min:e.min,max:e.max??e.min,distribution:e.distribution}}initParticles(e){let t=e;for(;t;)t.rotation=It(t.emitter.random.bind(t.emitter),this.range)*Sc,t=t.next}updateParticle(e,t){}},Bf=class{static type="noRotation";constructor(e){this.rotation=(e.rotation??0)*Sc}initParticles(e){let t=e;for(;t;)t.rotation=this.rotation,t=t.next}updateParticle(e,t){e.rotation=this.rotation}};var kf=class{static type="color";constructor(e){this.list=new kr(!0),this.list.reset(e.list)}initParticles(e){let t=e,i=this.list.getValue(0);for(;t;)t.tint=i,t=t.next}updateParticle(e,t){e.tint=this.list.getValue(e.agePercent)}},Ff=class{static type="colorStatic";constructor(e){this.color=bf(e.color)}initParticles(e){let t=e;for(;t;)t.tint=this.color,t=t.next}updateParticle(e,t){}};var Of=class{constructor(e){this.x=e.x,this.y=e.y,this.w=e.w,this.h=e.h}getRandPos(e,t){e.x=this.x+t.random()*this.w,e.y=this.y+t.random()*this.h}},Uf=class{constructor(e){this.x=e.x,this.y=e.y,this.radius=e.radius,this.innerRadius=e.innerRadius??0,this.affectRotation=e.affectRotation??!1}getRandPos(e,t){let i=t.random()*Math.PI*2,s=this.radius-this.innerRadius,o=t.random()*s+this.innerRadius;e.x=this.x+Math.cos(i)*o,e.y=this.y+Math.sin(i)*o,this.affectRotation&&(e.rotation=i)}},c_=class{constructor(e){this.x=e.x,this.y=e.y}getRandPos(e,t){e.x=this.x,e.y=this.y}},u_=class{constructor(e){this.x1=e.x1,this.y1=e.y1,this.x2=e.x2,this.y2=e.y2}getRandPos(e,t){let i=t.random();e.x=this.x1+(this.x2-this.x1)*i,e.y=this.y1+(this.y2-this.y1)*i}},LD={rect:Of,rectangle:Of,torus:Uf,circle:Uf,point:c_,line:u_};var Gf=class{static type="spawnShape";constructor(e){let t=LD[e.type];if(!t)throw new Error(`Unknown spawn shape type: ${e.type}`);this.shape=new t(e.data)}initParticles(e){let t=e,i={x:0,y:0,rotation:void 0};for(;t;)this.shape.getRandPos(i,t.emitter),t.x=i.x,t.y=i.y,i.rotation!==void 0&&(t.rotation=i.rotation),t=t.next}updateParticle(e,t){}},Lf=class{static type="spawnBurst";constructor(e){this.x=e.x,this.y=e.y,this.spacing=(e.spacing??0)*Math.PI/180,this.startAngle=(e.startAngle??0)*Math.PI/180}initParticles(e){let t=e,i=this.startAngle;for(;t;)t.x=this.x,t.y=this.y,t.rotation=i,i+=this.spacing,t=t.next}updateParticle(e,t){}};var lI=Math.PI/180,Df=class{static type="movement";constructor(e={}){this.velocity=e.velocity??null,this.accelX=e.acceleration?.x??0,this.accelY=e.acceleration?.y??0,this.maxSpeed=e.maxSpeed??0,this.faceVelocity=e.faceVelocity??!1}initParticles(e){let t=e;for(;t;){if(this.velocity){let i=this.#t(t.emitter.random.bind(t.emitter)),s=It(t.emitter.random.bind(t.emitter),this.velocity.speed);t.velocity.x=Math.cos(i)*s,t.velocity.y=Math.sin(i)*s,this.faceVelocity&&s>0&&(t.rotation=i)}t=t.next}}updateParticle(e,t){let i=e.velocity;if(this.accelX!==0||this.accelY!==0){let o=i.x,n=i.y;i.x+=this.accelX*t,i.y+=this.accelY*t,this.#e(i),e.x+=(o+i.x)/2*t,e.y+=(n+i.y)/2*t}else this.#e(i),e.x+=i.x*t,e.y+=i.y*t;this.faceVelocity&&Math.sqrt(i.x*i.x+i.y*i.y)>0&&(e.rotation=Math.atan2(i.y,i.x))}#t(e){return this.velocity?this.velocity.kind==="radial"?It(e,this.velocity.angle??{min:0,max:360})*lI:It(e,this.velocity.direction??0)*lI:0}#e(e){if(this.maxSpeed<=0)return;let t=Math.sqrt(e.x*e.x+e.y*e.y);if(t>this.maxSpeed&&t>0){let i=this.maxSpeed/t;e.x*=i,e.y*=i}}};var cI=new Map,uI=new Map;function h_(r,e){cI.set(r,e)}function wt(r){uI.set(r.type,r)}function hI(r,e){let t=cI.get(r);return t?t(e):null}function dI(r){return uI.get(r)}h_("circle",l_);h_("snowflake",n_);h_("raindrop",a_);wt(vf);wt(Tf);wt(Sf);wt(wf);wt(Ef);wt(Af);wt(Cf);wt(Pf);wt(Mf);wt(Rf);wt(If);wt(Bf);wt(kf);wt(Ff);wt(Gf);wt(Lf);wt(Df);var Nf=class{constructor(e){this.seed=e,this.state=e}next(){let e=this.state+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}reset(){this.state=this.seed}};function DD(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)&&typeof r.mode=="string"&&Array.isArray(r.items)}var wc=class{container=null;texture=null;textureSelector=null;_textureCycleIndex=0;_activeFirst=null;_activeLast=null;_poolFirst=null;particleCount=0;maxParticles=1e3;lifetime={min:1,max:2};frequency=.1;particlesPerWave=1;_spawnTimer=0;emitterLifetime=-1;_emitterAge=0;emit=!0;destroyed=!1;initBehaviors=[];updateBehaviors=[];recycleBehaviors=[];spawnBounds=null;recycleOnBounds=!1;rng=null;constructor(e,t){this.container=e,this.init(t)}init(e){if(this.rng=e.seed!==void 0&&e.seed!==null?new Nf(e.seed):null,e.texture&&(DD(e.texture)?(this.textureSelector=e.texture,this.texture=e.texture.items[0]?.texture??null):(this.textureSelector=null,this.texture=e.texture)),this._textureCycleIndex=0,e.lifetime&&(this.lifetime.min=e.lifetime.min??1,this.lifetime.max=e.lifetime.max??e.lifetime.min??2,this.lifetime.distribution=e.lifetime.distribution),this.frequency=e.frequency??.1,this.particlesPerWave=e.particlesPerWave??1,this.maxParticles=e.maxParticles??1e3,this.emitterLifetime=e.emitterLifetime??-1,this.spawnBounds=null,this.recycleOnBounds=!1,e.spawnBounds&&(this.spawnBounds=e.spawnBounds,this.recycleOnBounds=e.recycleOnBounds??!1),this.initBehaviors=[],this.updateBehaviors=[],this.recycleBehaviors=[],e.behaviors)for(let t of e.behaviors){let i=dI(t.type);if(!i){console.warn(`Unknown behavior type: ${t.type}`);continue}let s=new i(t.config);s.initParticles&&this.initBehaviors.push(s),s.updateParticle&&this.updateBehaviors.push(s),s.recycleParticle&&this.recycleBehaviors.push(s)}this._spawnTimer=0,this._emitterAge=0,this.emit=e.emit??!0}_createParticle(){let e;return this._poolFirst?(e=this._poolFirst,this._poolFirst=e.next,e.next=null):e=new vc(this),e}spawn(e){if(this.destroyed||e<=0)return null;let t=this.maxParticles-this.particleCount;if(e=Math.min(e,t),e<=0)return null;let i=this.textureSelector?.pick==="perWave"?this._pickTexture():null,s=null,o=null;for(let n=0;n<e;n++){let a=this._createParticle();a.texture=i??this._pickTexture();let l=It(this.random.bind(this),this.lifetime);a.init(l),s||(s=a),o&&(o.next=a,a.prev=o),o=a,this.container.addChild(a)}for(let n of this.initBehaviors)n.initParticles(s);return this._activeLast?(this._activeLast.next=s,s.prev=this._activeLast):this._activeFirst=s,this._activeLast=o,this.particleCount+=e,s}emitNow(){this.spawn(this.particlesPerWave)}recycle(e){for(let t of this.recycleBehaviors)t.recycleParticle(e);e.prev?e.prev.next=e.next:this._activeFirst=e.next,e.next?e.next.prev=e.prev:this._activeLast=e.prev,e.prev=null,e.next=null,e.parent&&e.parent.removeChild(e),e.next=this._poolFirst,this._poolFirst=e,this.particleCount--}update(e){if(this.destroyed)return;if(this.emitterLifetime>0&&(this._emitterAge+=e,this._emitterAge>=this.emitterLifetime&&(this.emit=!1)),this.emit)if(this.frequency<=0)this.spawn(this.particlesPerWave),this.emit=!1;else for(this._spawnTimer+=e;this._spawnTimer>=this.frequency;)this._spawnTimer-=this.frequency,this.spawn(this.particlesPerWave);let t=this._activeFirst;for(;t;){let i=t.next;if(t.age+=e,t.age>=t.maxLife){this.recycle(t),t=i;continue}if(this.recycleOnBounds&&this.spawnBounds){let s=this.spawnBounds;if(t.x<s.x||t.x>s.x+s.width||t.y<s.y||t.y>s.y+s.height){this.recycle(t),t=i;continue}}for(let s of this.updateBehaviors)s.updateParticle(t,e);t=i}}stop(e=!1){if(this.emit=!1,e)for(;this._activeFirst;)this.recycle(this._activeFirst)}restart(){this._emitterAge=0,this._spawnTimer=0,this.emit=!0}random(){return this.rng?this.rng.next():Math.random()}_pickTexture(){if(!this.textureSelector)return this.texture;let{mode:e,items:t}=this.textureSelector;if(!t.length)return this.texture;if(e==="cycle"){let i=t[this._textureCycleIndex%t.length];return this._textureCycleIndex+=1,i.texture}if(e==="random"){let i=t.reduce((o,n)=>o+(n.weight??1),0),s=this.random()*i;for(let o of t)if(s-=o.weight??1,s<=0)return o.texture;return t[t.length-1].texture}return t[0].texture}destroy(){if(this.destroyed)return;this.destroyed=!0,this.emit=!1;let e=this._activeFirst;for(;e;){let t=e.next;e.destroy(),e=t}for(e=this._poolFirst;e;){let t=e.next;e.destroy(),e=t}this._activeFirst=null,this._activeLast=null,this._poolFirst=null,this.initBehaviors=[],this.updateBehaviors=[],this.recycleBehaviors=[]}};function ND(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)&&typeof r.mode=="string"&&Array.isArray(r.items)}function HD(r,e){let t=new Ue,i=e.color??"#ffffff";switch(e.shape){case"circle":{let s=e.radius??3;t.circle(0,0,s),t.fill({color:i});break}case"ellipse":{let s=e.width??2,o=e.height??6;t.ellipse(0,0,s/2,o/2),t.fill({color:i});break}case"rect":{let s=e.width??4,o=e.height??4;t.rect(-s/2,-o/2,s,o),t.fill({color:i});break}default:t.circle(0,0,3),t.fill({color:i})}return r.renderer.generateTexture(t)}function fI(r,e){if(typeof e=="object"&&e?.shape)return HD(r,e);let t=e??"circle",i=hI(t,r);if(!i)try{i=B.from(t)}catch{return console.warn(`Failed to load particle texture: ${t}`),null}return i}function VD(r,e){let t=[];for(let i of e.items){let s=i.src?i.src:i,o=fI(r,s);if(!o)return null;t.push(i.weight===void 0?{texture:o}:{texture:o,weight:i.weight})}return{mode:e.mode,pick:e.pick??"perParticle",items:t}}var Ec=({app:r,parent:e,element:t,renderContext:i,zIndex:s})=>{let o=new te;o.label=t.id,o.zIndex=s,e.addChild(o);let n=t.width,a=t.height;o.x=t.x??0,o.y=t.y??0;let l={lifetime:t.emitter?.lifetime??{min:1,max:2},frequency:t.emitter?.frequency??.1,particlesPerWave:t.emitter?.particlesPerWave??1,maxParticles:t.emitter?.maxParticles??t.count??100,emitterLifetime:t.emitter?.emitterLifetime??-1,spawnBounds:t.emitter?.spawnBounds,recycleOnBounds:t.emitter?.recycleOnBounds??!1,seed:t.emitter?.seed,behaviors:t.behaviors},c=ND(t.texture)?VD(r,t.texture):fI(r,t.texture);if(!c)return;l.texture=c;let u=new wc(o,l);o.emitter=u;let h=l.frequency<=0;if(h){u.emitNow(),u.emit=!1;let f=p=>{if(!p.length)return;let[m,...g]=p;(m===0&&typeof requestAnimationFrame=="function"?requestAnimationFrame:v=>setTimeout(v,m))(()=>{u.destroyed||u.particleCount>0||(u.emitNow(),f(g))})};f([0,50,150])}if(l.recycleOnBounds&&!h){let f=Math.min(t.count??100,l.maxParticles);u.spawn(f);let p=u._activeFirst;for(;p;)p.y=u.random()*a,p.age=u.random()*p.maxLife*.8,p=p.next}let d=f=>{if(u.destroyed){r.ticker.remove(d);return}let p=Math.min(typeof f.deltaMS=="number"?f.deltaMS/1e3:f.deltaTime/60,.1);u.update(p)};o.tickerCallback=d,bM(i,{app:r,emitter:u,container:o,tickerCallback:d}),t.alpha!==void 0&&(o.alpha=t.alpha)};var Hf=({app:r,parent:e,element:t,animationBus:i,animations:s,completionTracker:o})=>{let n=e.getChildByLabel(t.id);if(!n)return;let a=()=>{n&&!n.destroyed&&(n.emitter&&n.emitter.destroy(),n.tickerCallback&&r.ticker.remove(n.tickerCallback),n.customTickerHandler&&window.removeEventListener("snapShotKeyFrame",n.customTickerHandler),n.destroy({children:!0}))};ne({animations:s,targetId:t.id,animationBus:i,completionTracker:o,element:n,targetState:null,onComplete:a})||a()};var pI=({app:r,parent:e,prevElement:t,nextElement:i,animations:s,animationBus:o,completionTracker:n,renderContext:a,zIndex:l})=>{let c=e.children.find(h=>h.label===t.id);if(!c){Ec({app:r,parent:e,element:i,animations:s,animationBus:o,completionTracker:n,renderContext:a,zIndex:l});return}if(c.zIndex=l,WD(t,i))Hf({app:r,parent:e,element:t,animations:s,animationBus:o,completionTracker:n}),Ec({app:r,parent:e,element:i,animations:s,animationBus:o,completionTracker:n,renderContext:a,zIndex:l});else{let h=()=>{i.alpha!==void 0&&(c.alpha=i.alpha),i.x!==void 0&&(c.x=i.x),i.y!==void 0&&(c.y=i.y)};ne({animations:s,targetId:t.id,animationBus:o,completionTracker:n,element:c,targetState:{x:i.x??c.x,y:i.y??c.y,alpha:i.alpha??c.alpha},onComplete:h})||h()}};function WD(r,e){return r.count!==e.count||!xe(r.texture,e.texture)||!xe(r.behaviors,e.behaviors)||!xe(r.emitter,e.emitter)||r.width!==e.width||r.height!==e.height}function d_(r){if(!r.id)throw new Error("Input Error: Id is missing");if(!Object.values(Us).includes(r.type))throw new Error("Input Error: Type must be one of "+Object.values(Us).join(", "));if(typeof r.width!="number"||typeof r.height!="number")throw new Error("Input Error: Width and height must be numbers");if(r.width<=0||r.height<=0)throw new Error("Input Error: Width and height must be positive")}function mI(r){if(!r.texture)throw new Error("Input Error: Particles require 'texture'");let e=typeof r.texture=="string",t=typeof r.texture=="object"&&r.texture!==null&&!Array.isArray(r.texture);if(!e&&!t)throw new Error("Input Error: texture must be a string or shape object");if(t){if(!r.texture.shape)throw new Error("Input Error: texture object must have 'shape' property");if(!["circle","ellipse","rect"].includes(r.texture.shape))throw new Error(`Input Error: texture.shape must be 'circle', 'ellipse', or 'rect', got '${r.texture.shape}'`)}}function gI(r){if(!r.behaviors)throw new Error("Input Error: Particles require 'behaviors'");if(!Array.isArray(r.behaviors))throw new Error("Input Error: 'behaviors' must be an array");if(r.behaviors.length===0)throw new Error("Input Error: 'behaviors' array cannot be empty");for(let e=0;e<r.behaviors.length;e++){let t=r.behaviors[e];if(typeof t!="object"||t===null||Array.isArray(t))throw new Error(`Input Error: behaviors[${e}] must be an object`);if(!t.type||typeof t.type!="string")throw new Error(`Input Error: behaviors[${e}] must have a 'type' string property`)}}function xI(r){if(!r.emitter)throw new Error("Input Error: Particles require 'emitter'");if(typeof r.emitter!="object"||Array.isArray(r.emitter))throw new Error("Input Error: 'emitter' must be an object");if(!r.emitter.lifetime)throw new Error("Input Error: emitter.lifetime is required");if(typeof r.emitter.lifetime!="object"||Array.isArray(r.emitter.lifetime))throw new Error("Input Error: emitter.lifetime must be an object");if(typeof r.emitter.lifetime.min!="number"||typeof r.emitter.lifetime.max!="number")throw new Error("Input Error: emitter.lifetime.min and max must be numbers");if(r.emitter.lifetime.min<0||r.emitter.lifetime.max<0)throw new Error("Input Error: emitter.lifetime.min and max must be non-negative");if(r.emitter.lifetime.min>r.emitter.lifetime.max)throw new Error("Input Error: emitter.lifetime.min cannot be greater than max")}function yI(r){if(r.emitter.frequency!==void 0){if(typeof r.emitter.frequency!="number")throw new Error("Input Error: emitter.frequency must be a number");if(r.emitter.frequency<0)throw new Error("Input Error: emitter.frequency must be non-negative")}if(r.emitter.particlesPerWave!==void 0){if(typeof r.emitter.particlesPerWave!="number")throw new Error("Input Error: emitter.particlesPerWave must be a number");if(r.emitter.particlesPerWave<=0)throw new Error("Input Error: emitter.particlesPerWave must be positive");if(!Number.isInteger(r.emitter.particlesPerWave))throw new Error("Input Error: emitter.particlesPerWave must be an integer")}if(r.emitter.maxParticles!==void 0){if(typeof r.emitter.maxParticles!="number")throw new Error("Input Error: emitter.maxParticles must be a number");if(r.emitter.maxParticles<=0)throw new Error("Input Error: emitter.maxParticles must be positive");if(!Number.isInteger(r.emitter.maxParticles))throw new Error("Input Error: emitter.maxParticles must be an integer")}}function _I(r){if(r.count!==void 0){if(typeof r.count!="number")throw new Error("Input Error: count must be a number");if(r.count<=0)throw new Error("Input Error: count must be positive");if(!Number.isInteger(r.count))throw new Error("Input Error: count must be an integer")}if(r.alpha!==void 0){if(typeof r.alpha!="number")throw new Error("Input Error: alpha must be a number");if(r.alpha<0||r.alpha>1)throw new Error("Input Error: alpha must be between 0 and 1")}if(r.x!==void 0&&typeof r.x!="number")throw new Error("Input Error: x must be a number");if(r.y!==void 0&&typeof r.y!="number")throw new Error("Input Error: y must be a number")}var zD=new Set(["continuous","burst"]),$D=new Set(["point","rect","circle","line"]),XD=new Set(["single","random","cycle"]),jD=new Set(["perParticle","perWave"]),bI=new Set(["uniform","normal","bias"]),vI=new Set(["min","max","center"]),YD=new Set(["none","fixed","random","spin"]);function EI(r){if(qD(r),!r.modules||typeof r.modules!="object"||Array.isArray(r.modules))throw new Error("Input Error: Particles require 'modules'");let{emission:e,movement:t,appearance:i,bounds:s}=r.modules;if(!e||typeof e!="object"||Array.isArray(e))throw new Error("Input Error: modules.emission must be an object");if(!i||typeof i!="object"||Array.isArray(i))throw new Error("Input Error: modules.appearance must be an object");KD(e),QD(t,i),JD(i),sN(s)}function qD(r){if(r.texture!==void 0||r.behaviors!==void 0||r.emitter!==void 0)throw new Error("Input Error: Structured particles cannot mix 'modules' with legacy texture/behaviors/emitter fields");if(r.count!==void 0)throw new Error("Input Error: Structured particles do not support legacy 'count'");if(r.alpha!==void 0&&(ce(r.alpha,"alpha"),r.alpha<0||r.alpha>1))throw new Error("Input Error: alpha must be between 0 and 1");r.x!==void 0&&ce(r.x,"x"),r.y!==void 0&&ce(r.y,"y"),r.seed!==void 0&&ce(r.seed,"seed")}function KD(r){if(!zD.has(r.mode))throw new Error("Input Error: modules.emission.mode must be 'continuous' or 'burst'");if(r.mode==="continuous"){if(ce(r.rate,"modules.emission.rate"),r.rate<=0)throw new Error("Input Error: modules.emission.rate must be positive")}else if(wI(r.burstCount,"modules.emission.burstCount"),r.burstCount<=0)throw new Error("Input Error: modules.emission.burstCount must be positive");if(r.maxActive!==void 0&&(wI(r.maxActive,"modules.emission.maxActive"),r.maxActive<=0))throw new Error("Input Error: modules.emission.maxActive must be positive");if(r.duration!==void 0&&r.duration!=="infinite"&&(ce(r.duration,"modules.emission.duration"),r.duration<0))throw new Error("Input Error: modules.emission.duration must be non-negative");if(ss(r.particleLifetime,"modules.emission.particleLifetime",{allowNegative:!1}),!r.source||typeof r.source!="object"||Array.isArray(r.source))throw new Error("Input Error: modules.emission.source must be an object");if(!$D.has(r.source.kind))throw new Error("Input Error: modules.emission.source.kind must be one of point, rect, circle, line");if(!r.source.data||typeof r.source.data!="object"||Array.isArray(r.source.data))throw new Error("Input Error: modules.emission.source.data must be an object");ZD(r.source.kind,r.source.data)}function ZD(r,e){if(r==="point"){ce(e.x,"modules.emission.source.data.x"),ce(e.y,"modules.emission.source.data.y");return}if(r==="rect"){if(ce(e.x,"modules.emission.source.data.x"),ce(e.y,"modules.emission.source.data.y"),ce(e.width,"modules.emission.source.data.width"),ce(e.height,"modules.emission.source.data.height"),e.width<=0||e.height<=0)throw new Error("Input Error: modules.emission.source.data.width and height must be positive");return}if(r==="circle"){if(ce(e.x,"modules.emission.source.data.x"),ce(e.y,"modules.emission.source.data.y"),ce(e.radius,"modules.emission.source.data.radius"),e.radius<=0)throw new Error("Input Error: modules.emission.source.data.radius must be positive");if(e.innerRadius!==void 0&&(ce(e.innerRadius,"modules.emission.source.data.innerRadius"),e.innerRadius<0||e.innerRadius>e.radius))throw new Error("Input Error: modules.emission.source.data.innerRadius must be between 0 and radius");if(e.affectRotation!==void 0&&typeof e.affectRotation!="boolean")throw new Error("Input Error: modules.emission.source.data.affectRotation must be a boolean");return}ce(e.x1,"modules.emission.source.data.x1"),ce(e.y1,"modules.emission.source.data.y1"),ce(e.x2,"modules.emission.source.data.x2"),ce(e.y2,"modules.emission.source.data.y2")}function QD(r,e){if(r!==void 0){if(!r||typeof r!="object"||Array.isArray(r))throw new Error("Input Error: modules.movement must be an object");if(r.velocity!==void 0){if(!r.velocity||typeof r.velocity!="object"||Array.isArray(r.velocity))throw new Error("Input Error: modules.movement.velocity must be an object");let{velocity:t}=r;if(t.kind!=="directional"&&t.kind!=="radial")throw new Error("Input Error: modules.movement.velocity.kind must be 'directional' or 'radial'");ss(t.speed,"modules.movement.velocity.speed",{allowNegative:!1}),t.kind==="directional"?ss(t.direction,"modules.movement.velocity.direction",{allowNegative:!0}):t.angle!==void 0&&ss(t.angle,"modules.movement.velocity.angle",{allowNegative:!0})}if(r.acceleration!==void 0){if(!r.acceleration||typeof r.acceleration!="object"||Array.isArray(r.acceleration))throw new Error("Input Error: modules.movement.acceleration must be an object");ce(r.acceleration.x,"modules.movement.acceleration.x"),ce(r.acceleration.y,"modules.movement.acceleration.y")}if(r.maxSpeed!==void 0&&(ce(r.maxSpeed,"modules.movement.maxSpeed"),r.maxSpeed<0))throw new Error("Input Error: modules.movement.maxSpeed must be non-negative");if(r.faceVelocity!==void 0&&typeof r.faceVelocity!="boolean")throw new Error("Input Error: modules.movement.faceVelocity must be a boolean");if(!r.velocity&&!r.acceleration)throw new Error("Input Error: modules.movement must define velocity, acceleration, or both");if(r.faceVelocity&&e?.rotation&&e.rotation.mode!=="none")throw new Error("Input Error: modules.appearance.rotation cannot be combined with modules.movement.faceVelocity")}}function JD(r){eN(r.texture),r.scale!==void 0&&TI(r.scale,"modules.appearance.scale",{allowNegative:!1,modes:["single","range","curve"]}),r.alpha!==void 0&&TI(r.alpha,"modules.appearance.alpha",{min:0,max:1,modes:["single","curve"]}),r.color!==void 0&&rN(r.color,"modules.appearance.color"),r.rotation!==void 0&&iN(r.rotation)}function eN(r){if(r===void 0)throw new Error("Input Error: modules.appearance.texture is required");if(typeof r!="string"){if(!r||typeof r!="object"||Array.isArray(r))throw new Error("Input Error: modules.appearance.texture must be a string or object");if(r.shape){AI(r,"modules.appearance.texture");return}if(!XD.has(r.mode))throw new Error("Input Error: modules.appearance.texture.mode must be 'single', 'random', or 'cycle'");if(r.pick!==void 0&&!jD.has(r.pick))throw new Error("Input Error: modules.appearance.texture.pick must be 'perParticle' or 'perWave'");if(!Array.isArray(r.items)||r.items.length===0)throw new Error("Input Error: modules.appearance.texture.items must be a non-empty array");if(r.mode==="single"&&r.items.length!==1)throw new Error("Input Error: modules.appearance.texture.mode 'single' requires exactly one item");for(let e=0;e<r.items.length;e++){let t=r.items[e];tN(t,`modules.appearance.texture.items[${e}]`)}}}function tN(r,e){if(!r||typeof r!="object"||Array.isArray(r))throw new Error(`Input Error: ${e} must be an object`);if(r.src!==void 0){if(typeof r.src!="string"||r.src.length===0)throw new Error(`Input Error: ${e}.src must be a non-empty string`)}else if(r.shape)AI(r,e);else throw new Error(`Input Error: ${e} must define either 'src' or shape fields`);if(r.weight!==void 0&&(ce(r.weight,`${e}.weight`),r.weight<=0))throw new Error(`Input Error: ${e}.weight must be positive`)}function AI(r,e){if(!["circle","ellipse","rect"].includes(r.shape))throw new Error(`Input Error: ${e}.shape must be 'circle', 'ellipse', or 'rect'`);if(r.radius!==void 0&&ce(r.radius,`${e}.radius`),r.width!==void 0&&ce(r.width,`${e}.width`),r.height!==void 0&&ce(r.height,`${e}.height`),r.color!==void 0&&typeof r.color!="string"&&typeof r.color!="number")throw new Error(`Input Error: ${e}.color must be a string or number`)}function TI(r,e,t){if(!r||typeof r!="object"||Array.isArray(r))throw new Error(`Input Error: ${e} must be an object`);if(!t.modes.includes(r.mode))throw new Error(`Input Error: ${e}.mode must be one of ${t.modes.join(", ")}`);if(r.mode==="single"){Ac(r.value,`${e}.value`,t);return}if(r.mode==="range"){ss(r,e,t);return}if(!Array.isArray(r.keys)||r.keys.length===0)throw new Error(`Input Error: ${e}.keys must be a non-empty array`);let i=-1/0;for(let s=0;s<r.keys.length;s++){let o=r.keys[s];if(!o||typeof o!="object"||Array.isArray(o))throw new Error(`Input Error: ${e}.keys[${s}] must be an object`);if(ce(o.time,`${e}.keys[${s}].time`),o.time<0||o.time>1)throw new Error(`Input Error: ${e}.keys[${s}].time must be between 0 and 1`);if(o.time<i)throw new Error(`Input Error: ${e}.keys must be sorted by time`);i=o.time,Ac(o.value,`${e}.keys[${s}].value`,t)}}function rN(r,e){if(!r||typeof r!="object"||Array.isArray(r))throw new Error(`Input Error: ${e} must be an object`);if(r.mode==="single"){SI(r.value,`${e}.value`);return}if(r.mode!=="gradient")throw new Error("Input Error: modules.appearance.color.mode must be 'single' or 'gradient'");if(!Array.isArray(r.keys)||r.keys.length===0)throw new Error(`Input Error: ${e}.keys must be a non-empty array`);let t=-1/0;for(let i=0;i<r.keys.length;i++){let s=r.keys[i];if(!s||typeof s!="object"||Array.isArray(s))throw new Error(`Input Error: ${e}.keys[${i}] must be an object`);if(ce(s.time,`${e}.keys[${i}].time`),s.time<0||s.time>1)throw new Error(`Input Error: ${e}.keys[${i}].time must be between 0 and 1`);if(s.time<t)throw new Error(`Input Error: ${e}.keys must be sorted by time`);t=s.time,SI(s.value,`${e}.keys[${i}].value`)}}function SI(r,e){if(typeof r!="string"&&typeof r!="number")throw new Error(`Input Error: ${e} must be a string or number`)}function iN(r){if(!r||typeof r!="object"||Array.isArray(r))throw new Error("Input Error: modules.appearance.rotation must be an object");if(!YD.has(r.mode))throw new Error("Input Error: modules.appearance.rotation.mode must be 'none', 'fixed', 'random', or 'spin'");if(r.mode!=="none"){if(r.mode==="fixed"){ce(r.value,"modules.appearance.rotation.value");return}if(r.mode==="random"){ss(r,"modules.appearance.rotation",{allowNegative:!0});return}ss(r.start,"modules.appearance.rotation.start",{allowNegative:!0}),ss(r.speed,"modules.appearance.rotation.speed",{allowNegative:!0})}}function sN(r){if(r!==void 0){if(!r||typeof r!="object"||Array.isArray(r))throw new Error("Input Error: modules.bounds must be an object");if(r.mode!=="none"&&r.mode!=="recycle")throw new Error("Input Error: modules.bounds.mode must be 'none' or 'recycle'");if(r.mode!=="none"){if(r.source!=="area"&&r.source!=="custom")throw new Error("Input Error: modules.bounds.source must be 'area' or 'custom'");if(r.padding!==void 0&&oN(r.padding,"modules.bounds.padding"),r.source==="custom"){if(!r.custom||typeof r.custom!="object"||Array.isArray(r.custom))throw new Error("Input Error: modules.bounds.custom must be an object");ce(r.custom.x,"modules.bounds.custom.x"),ce(r.custom.y,"modules.bounds.custom.y"),ce(r.custom.width,"modules.bounds.custom.width"),ce(r.custom.height,"modules.bounds.custom.height")}}}}function oN(r,e){if(typeof r!="number"){if(!r||typeof r!="object"||Array.isArray(r))throw new Error(`Input Error: ${e} must be a number or object`);for(let t of["top","right","bottom","left"])ce(r[t],`${e}.${t}`)}}function ss(r,e,t={}){if(typeof r=="number"){Ac(r,e,t);return}if(!r||typeof r!="object"||Array.isArray(r))throw new Error(`Input Error: ${e} must be a number or range object`);if(ce(r.min,`${e}.min`),ce(r.max??r.min,`${e}.max`),Ac(r.min,`${e}.min`,t),Ac(r.max??r.min,`${e}.max`,t),r.min>(r.max??r.min))throw new Error(`Input Error: ${e}.min cannot be greater than max`);r.distribution!==void 0&&nN(r.distribution,`${e}.distribution`)}function Ac(r,e,t={}){if(ce(r,e),!t.allowNegative&&r<0)throw new Error(`Input Error: ${e} must be non-negative`);if(t.min!==void 0&&r<t.min)throw new Error(`Input Error: ${e} must be at least ${t.min}`);if(t.max!==void 0&&r>t.max)throw new Error(`Input Error: ${e} must be at most ${t.max}`)}function nN(r,e){if(!r||typeof r!="object"||Array.isArray(r))throw new Error(`Input Error: ${e} must be an object`);if(!bI.has(r.kind))throw new Error(`Input Error: ${e}.kind must be one of ${[...bI].join(", ")}`);if(r.kind==="bias"){if(!vI.has(r.toward??"min"))throw new Error(`Input Error: ${e}.toward must be one of ${[...vI].join(", ")}`);r.strength!==void 0&&ce(r.strength,`${e}.strength`)}r.kind==="normal"&&(r.mean!==void 0&&ce(r.mean,`${e}.mean`),r.deviation!==void 0&&ce(r.deviation,`${e}.deviation`))}function ce(r,e){if(typeof r!="number"||Number.isNaN(r))throw new Error(`Input Error: ${e} must be a number`)}function wI(r,e){if(ce(r,e),!Number.isInteger(r))throw new Error(`Input Error: ${e} must be an integer`)}function CI(r){let e=aN(r),t=[];t.push(lN(r.modules.emission.source));let i=uN(r.modules.movement);i&&t.push(i),t.push(...hN(r.modules.appearance));let s=yN(r.modules.bounds,r.width,r.height);s&&(e.spawnBounds=s.spawnBounds,e.recycleOnBounds=!0);let o=dN(r.modules.appearance.texture),n=e.maxParticles;return{id:r.id,type:r.type,count:n,texture:o,behaviors:t,emitter:e,x:r.x??0,y:r.y??0,width:r.width,height:r.height,alpha:r.alpha??1}}function aN(r){let{emission:e}=r.modules,t={lifetime:os(e.particleLifetime),maxParticles:e.mode==="burst"?Math.max(e.maxActive??e.burstCount,e.burstCount):e.maxActive??100,emitterLifetime:e.duration===void 0||e.duration==="infinite"?-1:e.duration,seed:r.seed};return e.mode==="continuous"?(t.frequency=1/e.rate,t.particlesPerWave=1):(t.frequency=0,t.particlesPerWave=e.burstCount),t}function lN(r){return{type:"spawnShape",config:{type:r.kind,data:cN(r.kind,r.data)}}}function cN(r,e){return r==="rect"?{x:e.x,y:e.y,w:e.width,h:e.height}:{...e}}function uN(r){if(!r)return null;let e={maxSpeed:r.maxSpeed??0,faceVelocity:r.faceVelocity??!1};return r.velocity&&(e.velocity={kind:r.velocity.kind,speed:os(r.velocity.speed)},r.velocity.kind==="directional"?e.velocity.direction=os(r.velocity.direction):e.velocity.angle=os(r.velocity.angle??{min:0,max:360})),r.acceleration&&(e.acceleration={x:r.acceleration.x,y:r.acceleration.y}),{type:"movement",config:e}}function hN(r){let e=[];if(r.scale&&e.push(pN(r.scale)),r.alpha&&e.push(mN(r.alpha)),r.color&&e.push(gN(r.color)),r.rotation){let t=xN(r.rotation);t&&e.push(t)}return e}function dN(r){if(typeof r=="string")return r;if(r.shape)return{...r};let e={mode:r.mode,pick:r.pick??"perParticle",items:r.items.map(fN)};if(e.mode==="single"&&e.items.length===1){let[t]=e.items;return t.src??PI(t)}return e}function fN(r){if(r.src)return r.weight===void 0?{src:r.src}:{src:r.src,weight:r.weight};let e=PI(r);return r.weight!==void 0&&(e.weight=r.weight),e}function PI(r){return{shape:r.shape,...r.radius!==void 0?{radius:r.radius}:{},...r.width!==void 0?{width:r.width}:{},...r.height!==void 0?{height:r.height}:{},...r.color!==void 0?{color:r.color}:{}}}function pN(r){return r.mode==="curve"?{type:"scale",config:{list:f_(r.keys)}}:{type:"scaleStatic",config:r.mode==="single"?{min:r.value,max:r.value}:os(r)}}function mN(r){return r.mode==="curve"?{type:"alpha",config:{list:f_(r.keys)}}:{type:"alphaStatic",config:{alpha:r.value}}}function gN(r){return r.mode==="gradient"?{type:"color",config:{list:f_(r.keys)}}:{type:"colorStatic",config:{color:r.value}}}function xN(r){if(r.mode==="none")return null;if(r.mode==="fixed")return{type:"noRotation",config:{rotation:r.value}};if(r.mode==="random"){let i=os(r);return{type:"rotationStatic",config:{min:i.min,max:i.max,distribution:i.distribution}}}let e=os(r.start),t=os(r.speed);return{type:"rotation",config:{minStart:e.min,maxStart:e.max,startDistribution:e.distribution,minSpeed:t.min,maxSpeed:t.max,speedDistribution:t.distribution,accel:r.accel??0}}}function yN(r,e,t){if(!r||r.mode==="none")return null;if(r.source==="custom")return{spawnBounds:{...r.custom}};let i=_N(r.padding??0);return{spawnBounds:{x:-i.left,y:-i.top,width:e+i.left+i.right,height:t+i.top+i.bottom}}}function _N(r){return typeof r=="number"?{top:r,right:r,bottom:r,left:r}:{top:r.top,right:r.right,bottom:r.bottom,left:r.left}}function f_(r){return r.map(e=>({time:e.time,value:e.value}))}function os(r){return typeof r=="number"?{min:r,max:r}:{min:r.min,max:r.max??r.min,...r.distribution!==void 0?{distribution:{...r.distribution}}:{}}}var MI=({state:r})=>{if(r.modules)return d_(r),EI(r),CI(r);d_(r),mI(r),gI(r),xI(r),yI(r),_I(r);let e=r.emitter?.maxParticles??r.count??100,t=r.emitter;return t&&t.maxParticles===void 0&&r.count!==void 0&&(t={...t,maxParticles:e}),{id:r.id,type:r.type,count:e,texture:r.texture,behaviors:r.behaviors,emitter:t,x:r.x??0,y:r.y??0,width:r.width,height:r.height,alpha:r.alpha??1}};var bN=et({type:"particles",add:Ec,update:pI,delete:Hf,parse:MI});var RI=(r=[],e=[])=>{let t=new Set,i=new Map,s=new Map,o=[],n=[],a=[];for(let l of r)t.add(l.id),i.set(l.id,l);for(let l of e)t.add(l.id),s.set(l.id,l);for(let l of t){let c=i.get(l),u=s.get(l);!c&&u?o.push(u):c&&!u?n.push(c):(c.src!==u.src||c.volume!==u.volume||c.loop!==u.loop||c.delay!==u.delay)&&a.push({prev:c,next:u})}return{toAddElement:o,toDeleteElement:n,toUpdateElement:a}};var p_=({app:r,prevAudioTree:e,nextAudioTree:t,audioPlugins:i})=>{let{toAddElement:s,toDeleteElement:o,toUpdateElement:n}=RI(e,t);for(let a of o){let l=i.find(c=>c.type===a.type);if(!l)throw new Error(`No audio plugin found for type: ${a.type}`);l.delete({app:r,element:a})}for(let a of s){let l=i.find(c=>c.type===a.type);if(!l)throw new Error(`No audio plugin found for type: ${a.type}`);l.add({app:r,element:a})}for(let{prev:a,next:l}of n){let c=i.find(u=>u.type===l.type);if(!c)throw new Error(`No audio plugin found for type: ${l.type}`);c.update({app:r,prevElement:a,nextElement:l})}};var sr=(r=>(r[r.WEBGL_LEGACY=0]="WEBGL_LEGACY",r[r.WEBGL=1]="WEBGL",r[r.WEBGL2=2]="WEBGL2",r))(sr||{}),m_=(r=>(r[r.UNKNOWN=0]="UNKNOWN",r[r.WEBGL=1]="WEBGL",r[r.CANVAS=2]="CANVAS",r))(m_||{}),Vf=(r=>(r[r.COLOR=16384]="COLOR",r[r.DEPTH=256]="DEPTH",r[r.STENCIL=1024]="STENCIL",r))(Vf||{}),re=(r=>(r[r.NORMAL=0]="NORMAL",r[r.ADD=1]="ADD",r[r.MULTIPLY=2]="MULTIPLY",r[r.SCREEN=3]="SCREEN",r[r.OVERLAY=4]="OVERLAY",r[r.DARKEN=5]="DARKEN",r[r.LIGHTEN=6]="LIGHTEN",r[r.COLOR_DODGE=7]="COLOR_DODGE",r[r.COLOR_BURN=8]="COLOR_BURN",r[r.HARD_LIGHT=9]="HARD_LIGHT",r[r.SOFT_LIGHT=10]="SOFT_LIGHT",r[r.DIFFERENCE=11]="DIFFERENCE",r[r.EXCLUSION=12]="EXCLUSION",r[r.HUE=13]="HUE",r[r.SATURATION=14]="SATURATION",r[r.COLOR=15]="COLOR",r[r.LUMINOSITY=16]="LUMINOSITY",r[r.NORMAL_NPM=17]="NORMAL_NPM",r[r.ADD_NPM=18]="ADD_NPM",r[r.SCREEN_NPM=19]="SCREEN_NPM",r[r.NONE=20]="NONE",r[r.SRC_OVER=0]="SRC_OVER",r[r.SRC_IN=21]="SRC_IN",r[r.SRC_OUT=22]="SRC_OUT",r[r.SRC_ATOP=23]="SRC_ATOP",r[r.DST_OVER=24]="DST_OVER",r[r.DST_IN=25]="DST_IN",r[r.DST_OUT=26]="DST_OUT",r[r.DST_ATOP=27]="DST_ATOP",r[r.ERASE=26]="ERASE",r[r.SUBTRACT=28]="SUBTRACT",r[r.XOR=29]="XOR",r))(re||{}),Fn=(r=>(r[r.POINTS=0]="POINTS",r[r.LINES=1]="LINES",r[r.LINE_LOOP=2]="LINE_LOOP",r[r.LINE_STRIP=3]="LINE_STRIP",r[r.TRIANGLES=4]="TRIANGLES",r[r.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",r[r.TRIANGLE_FAN=6]="TRIANGLE_FAN",r))(Fn||{}),H=(r=>(r[r.RGBA=6408]="RGBA",r[r.RGB=6407]="RGB",r[r.RG=33319]="RG",r[r.RED=6403]="RED",r[r.RGBA_INTEGER=36249]="RGBA_INTEGER",r[r.RGB_INTEGER=36248]="RGB_INTEGER",r[r.RG_INTEGER=33320]="RG_INTEGER",r[r.RED_INTEGER=36244]="RED_INTEGER",r[r.ALPHA=6406]="ALPHA",r[r.LUMINANCE=6409]="LUMINANCE",r[r.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",r[r.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",r[r.DEPTH_STENCIL=34041]="DEPTH_STENCIL",r))(H||{}),wi=(r=>(r[r.TEXTURE_2D=3553]="TEXTURE_2D",r[r.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",r[r.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",r[r.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",r[r.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",r[r.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",r[r.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",r))(wi||{}),ae=(r=>(r[r.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",r[r.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",r[r.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",r[r.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",r[r.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",r[r.UNSIGNED_INT=5125]="UNSIGNED_INT",r[r.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",r[r.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",r[r.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",r[r.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",r[r.BYTE=5120]="BYTE",r[r.SHORT=5122]="SHORT",r[r.INT=5124]="INT",r[r.FLOAT=5126]="FLOAT",r[r.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",r[r.HALF_FLOAT=36193]="HALF_FLOAT",r))(ae||{}),z=(r=>(r[r.FLOAT=0]="FLOAT",r[r.INT=1]="INT",r[r.UINT=2]="UINT",r))(z||{}),vr=(r=>(r[r.NEAREST=0]="NEAREST",r[r.LINEAR=1]="LINEAR",r))(vr||{}),Cc=(r=>(r[r.CLAMP=33071]="CLAMP",r[r.REPEAT=10497]="REPEAT",r[r.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",r))(Cc||{}),Fr=(r=>(r[r.OFF=0]="OFF",r[r.POW2=1]="POW2",r[r.ON=2]="ON",r[r.ON_MANUAL=3]="ON_MANUAL",r))(Fr||{}),or=(r=>(r[r.NPM=0]="NPM",r[r.UNPACK=1]="UNPACK",r[r.PMA=2]="PMA",r[r.NO_PREMULTIPLIED_ALPHA=0]="NO_PREMULTIPLIED_ALPHA",r[r.PREMULTIPLY_ON_UPLOAD=1]="PREMULTIPLY_ON_UPLOAD",r[r.PREMULTIPLIED_ALPHA=2]="PREMULTIPLIED_ALPHA",r))(or||{}),ns=(r=>(r[r.NO=0]="NO",r[r.YES=1]="YES",r[r.AUTO=2]="AUTO",r[r.BLEND=0]="BLEND",r[r.CLEAR=1]="CLEAR",r[r.BLIT=2]="BLIT",r))(ns||{}),Wf=(r=>(r[r.AUTO=0]="AUTO",r[r.MANUAL=1]="MANUAL",r))(Wf||{}),Vt=(r=>(r.LOW="lowp",r.MEDIUM="mediump",r.HIGH="highp",r))(Vt||{}),nt=(r=>(r[r.NONE=0]="NONE",r[r.SCISSOR=1]="SCISSOR",r[r.STENCIL=2]="STENCIL",r[r.SPRITE=3]="SPRITE",r[r.COLOR=4]="COLOR",r))(nt||{});var Ce=(r=>(r[r.NONE=0]="NONE",r[r.LOW=2]="LOW",r[r.MEDIUM=4]="MEDIUM",r[r.HIGH=8]="HIGH",r))(Ce||{}),Zt=(r=>(r[r.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",r[r.ARRAY_BUFFER=34962]="ARRAY_BUFFER",r[r.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",r))(Zt||{});var g_={createCanvas:(r,e)=>{let t=document.createElement("canvas");return t.width=r,t.height=e,t},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(r,e)=>fetch(r,e),parseXML:r=>new DOMParser().parseFromString(r,"text/xml")};var K={ADAPTER:g_,RESOLUTION:1,CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1};bm();var vN=Gi.default??Gi,Or=vN(globalThis.navigator);K.RETINA_PREFIX=/@([0-9\.]+)x/;K.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!1;var Zs=fs(BI(),1),dV=fs(yh(),1);var K_=fs(Yk(),1);var qk={};function fe(r,e,t=3){if(qk[e])return;let i=new Error().stack;typeof i>"u"?console.warn("PixiJS Deprecation Warning: ",`${e}
|
|
1418
1418
|
Deprecated since v${r}`):(i=i.split(`
|