route-graphics 1.5.4 → 1.5.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/RouteGraphics.js +1 -1
- package/package.json +1 -1
package/dist/RouteGraphics.js
CHANGED
|
@@ -1145,7 +1145,7 @@ ${u}`)}});return await Promise.all(l),o?s[n[0].src]:s}async unload(t){let i=Ue(t
|
|
|
1145
1145
|
`).replace(/\r/g,`
|
|
1146
1146
|
`),dG=(r,t,e)=>{let i=Math.max(0,r-t);return e==="center"?i/2:e==="right"?i:0},MR=r=>new It(r),Ye=(r,t)=>kt.measureText(r,MR(t)).width,Zi=(r,t,e)=>Math.max(t,Math.min(e,r)),CR=({text:r,style:t,targetX:e})=>{let i=Number.isFinite(e)?e:0;if(i<=0||r.length===0)return 0;let s=Ye(r,t);if(i>=s)return r.length;for(let o=1;o<=r.length;o+=1){let n=Ye(r.slice(0,o-1),t),a=Ye(r.slice(0,o),t),l=n+(a-n)/2;if(i<l)return o-1}return r.length},RR=(r,t)=>{let e=Math.max(r.x,t.x),i=Math.max(r.y,t.y),s=Math.min(r.x+r.width,t.x+t.width),o=Math.min(r.y+r.height,t.y+t.height),n=s-e,a=o-i;return n<=0||a<=0?null:{x:e,y:i,width:n,height:a}},fG=r=>{let t=r?.mask;if(!t?.getBounds)return null;let e=t.getBounds();return!e||e.width<=0||e.height<=0?null:{x:e.x,y:e.y,width:e.width,height:e.height}},pG=({app:r,container:t,fallbackElement:e})=>{if(!t||t.destroyed)return null;let i=t.getBounds?.(),s=i?{x:i.x,y:i.y,width:i.width,height:i.height}:{x:t.x??e.x,y:t.y??e.y,width:e.width,height:e.height};if(s.width<=0||s.height<=0)return null;let o={...s},n=t;for(;n;){if(n.visible===!1||n.renderable===!1)return{fullBounds:s,visibleBounds:null};let l=fG(n);if(l&&(o=RR(o,l),!o))return{fullBounds:s,visibleBounds:null};n=n.parent}let a=r?.renderer?{x:0,y:0,width:r.renderer.width,height:r.renderer.height}:null;return a&&(o=RR(o,a)),{fullBounds:s,visibleBounds:o}},mG=(r,t)=>t?{top:Math.max(0,t.y-r.y),right:Math.max(0,r.x+r.width-(t.x+t.width)),bottom:Math.max(0,r.y+r.height-(t.y+t.height)),left:Math.max(0,t.x-r.x)}:{top:r.height,right:0,bottom:0,left:0},gG=({displayedValue:r,textStyle:t})=>{let e=Ye(r,t);return{lines:[{text:r,width:e,startIndex:0}],lineHeight:t.lineHeight,totalHeight:t.lineHeight,maxLineWidth:e,textValue:r}},xG=({displayedValue:r,textStyle:t})=>{let e=xn(r),i=e.split(`
|
|
1147
1147
|
`),s=i.map((a,l)=>({text:a,width:Ye(a,t),startIndex:l===0?0:i.slice(0,l).reduce((c,h)=>c+h.length+1,0)})),o=s.reduce((a,l)=>Math.max(a,l.width),0),n=t.lineHeight;return{lines:s,lineHeight:n,totalHeight:s.length*n,maxLineWidth:o,textValue:e}},yG=({element:r,displayedValue:t,textStyle:e})=>r.multiline?xG({displayedValue:t,textStyle:e}):gG({displayedValue:t,textStyle:e}),Ld=({value:r,index:t})=>{let e=xn(r),i=Zi(t,0,e.length),s=0,o=0;for(let n=0;n<i;n+=1){if(e[n]===`
|
|
1148
|
-
`){s+=1,o=0;continue}o+=1}return{line:s,column:o}},Sy=({contentWidth:r,lineWidth:t,align:e})=>dG(r,t,e),_G=r=>new Cr({label:r,text:""}),bG=(r,t)=>{for(;r.textNodes.length<t;){let e=_G(`${r.element.id}-text-line-${r.textNodes.length}`);r.text.addChild(e),r.textNodes.push(e)}for(;r.textNodes.length>t;){let e=r.textNodes.pop();e?.removeFromParent(),e?.destroy()}},Dd=({contentWidth:r,lineWidth:t,align:e,scrollOffsetX:i})=>t>r?-i:Sy({contentWidth:r,lineWidth:t,align:e}),IR=({contentWidth:r,lineWidth:t,align:e})=>Sy({contentWidth:r,lineWidth:t,align:e}),Nd=({padding:r,contentWidth:t,lineWidth:e,align:i,scrollOffsetX:s})=>r.left+IR({contentWidth:t,lineWidth:e,align:i})-s,BR=r=>{let t=new Bt;t.label=`${r.id}-background`;let e=new Bt;e.label=`${r.id}-selection`;let i=new J;i.label=`${r.id}-text`;let s=new Cr({label:`${r.id}-placeholder`,text:r.placeholder}),o=new Bt;o.label=`${r.id}-caret`;let n=new Bt;return n.label=`${r.id}-clip`,i.mask=n,s.mask=n,e.mask=n,o.mask=n,{background:t,selection:e,text:i,placeholder:s,caret:o,clip:n}},FR=({app:r,container:t,display:e,element:i})=>({app:r,container:t,...e,value:xn(i.value??""),selectionStart:xn(i.value??"").length,selectionEnd:xn(i.value??"").length,focused:!1,nativeFocused:!1,composing:!1,blinkVisible:!0,blinkTick:0,scrollOffsetX:0,scrollOffsetY:0,selectionAnchor:null,draggingSelection:!1,textNodes:[],layoutState:null,lastExternalValue:xn(i.value??""),tickerListener:null,element:i}),Vd=(r,t,e)=>{let i=pG({app:r,container:t,fallbackElement:e});if(!i)return null;let{fullBounds:s,visibleBounds:o}=i,n=mG(s,o);return{x:s.x,y:s.y,width:s.width,height:s.height,visible:!!o&&t.visible!==!1&&t.renderable!==!1,clipInsets:n}},Qt=(r,t)=>{let e=Ty(t.padding),i=Math.max(0,t.width-e.left-e.right),s=Math.max(0,t.height-e.top-e.bottom),o=Hd(t.textStyle,{wordWrapWidth:i}),n=Hd({...t.textStyle,fill:"#7A7A7A"},{wordWrapWidth:i}),a=String(r.value??""),l=yG({element:t,displayedValue:a,textStyle:o}),c=o.align??"left",h=Zi(Math.min(r.selectionStart,r.selectionEnd),0,a.length),u=Zi(Math.max(r.selectionStart,r.selectionEnd),0,a.length),d=Zi(r.selectionEnd??a.length,0,a.length);if(r.layoutState={padding:e,contentWidth:i,contentHeight:s,textStyle:o,placeholderStyle:n,displayedValue:a,layout:l,align:c},bG(r,l.lines.length),r.textNodes.forEach((p,m)=>{let x=l.lines[m]??{text:"",width:0};Yr(p,o),p.text=x.text}),Yr(r.placeholder,n),r.placeholder.text=t.placeholder??"",t.multiline){let p=Ld({value:a,index:d}),m=l.lines[p.line]??l.lines.at(-1),x=m?.width??0,_=Ye((m?.text??"").slice(0,p.column),o),T=l.totalHeight,g=p.line*l.lineHeight,w=g+l.lineHeight;if(x<=i)r.scrollOffsetX=0;else if(r.focused){let S=Math.max(0,x-i);_-r.scrollOffsetX>i-8?r.scrollOffsetX=_-(i-8):_-r.scrollOffsetX<8&&(r.scrollOffsetX=_-8),r.scrollOffsetX=Zi(r.scrollOffsetX,0,S)}else r.scrollOffsetX=0;if(T<=s)r.scrollOffsetY=0;else if(r.focused){let b=Math.max(0,T-s);w-r.scrollOffsetY>s?r.scrollOffsetY=w-s:g-r.scrollOffsetY<0&&(r.scrollOffsetY=g),r.scrollOffsetY=Zi(r.scrollOffsetY,0,b)}else r.scrollOffsetY=0}else{let p=l.lines[0],m=Ye(p.text.slice(0,d),o);if(p.width<=i)r.scrollOffsetX=0;else if(r.focused){let _=Math.max(0,p.width-i);m-r.scrollOffsetX>i-8?r.scrollOffsetX=m-(i-8):m-r.scrollOffsetX<8&&(r.scrollOffsetX=m-8),r.scrollOffsetX=Zi(r.scrollOffsetX,0,_)}else r.scrollOffsetX=0;r.scrollOffsetY=0}if(t.multiline)r.text.x=e.left-r.scrollOffsetX,r.text.y=e.top-r.scrollOffsetY,r.textNodes.forEach((p,m)=>{let x=l.lines[m]??{width:0};p.x=IR({contentWidth:i,lineWidth:x.width,align:c}),p.y=m*l.lineHeight});else{let p=l.lines[0],m=r.textNodes[0],x=Dd({contentWidth:i,lineWidth:p.width,align:c,scrollOffsetX:r.scrollOffsetX});m.x=0,m.y=0,r.text.x=e.left+x,r.text.y=e.top+Math.max(0,(s-m.height)/2)}let f=kt.measureText(r.placeholder.text,MR(n));if(r.placeholder.x=e.left,r.placeholder.y=t.multiline?e.top:e.top+Math.max(0,(s-r.placeholder.height)/2),f.width<=i&&(r.placeholder.x+=Sy({contentWidth:i,lineWidth:f.width,align:c})),r.placeholder.visible=r.value.length===0&&r.composing!==!0,r.background.clear(),r.background.rect(0,0,t.width,t.height),r.background.fill({color:gn.fill,alpha:gn.fillAlpha}),gn.strokeWidth>0&&r.background.stroke({color:gn.strokeColor,alpha:gn.strokeAlpha,width:gn.strokeWidth}),r.focused&&Gd.strokeWidth>0&&t.disabled!==!0&&r.background.stroke({color:Gd.strokeColor,alpha:Gd.strokeAlpha,width:Gd.strokeWidth}),r.clip.clear(),r.clip.rect(e.left,e.top,i,Math.max(0,s)),r.clip.fill({color:16777215,alpha:1}),r.selection.clear(),r.focused&&h!==u&&t.disabled!==!0){if(t.multiline){let p=Ld({value:a,index:h}),m=Ld({value:a,index:u});for(let x=p.line;x<=m.line;x+=1){let _=l.lines[x];if(!_)continue;let T=x===p.line?p.column:0,g=x===m.line?m.column:_.text.length,w=Nd({padding:e,contentWidth:i,lineWidth:_.width,align:c,scrollOffsetX:r.scrollOffsetX})+Ye(_.text.slice(0,T),o),b=Nd({padding:e,contentWidth:i,lineWidth:_.width,align:c,scrollOffsetX:r.scrollOffsetX})+Ye(_.text.slice(0,g),o),S=e.top+x*l.lineHeight-r.scrollOffsetY;r.selection.rect(w,S,Math.max(b-w,1),l.lineHeight)}}else{let p=l.lines[0],m=Dd({contentWidth:i,lineWidth:p.width,align:c,scrollOffsetX:r.scrollOffsetX}),x=e.left+m+Ye(p.text.slice(0,h),o),_=e.left+m+Ye(p.text.slice(0,u),o),T=e.top+Math.max(0,(s-r.text.height)/2);r.selection.rect(x,T,Math.max(_-x,1),Math.max(r.text.height,o.lineHeight))}r.selection.fill({color:PR.fill,alpha:PR.alpha})}if(r.caret.clear(),r.focused&&r.selectionStart===r.selectionEnd&&r.blinkVisible!==!1&&t.disabled!==!0){if(t.multiline){let p=Ld({value:a,index:d}),m=l.lines[p.line]??l.lines.at(-1),x=Nd({padding:e,contentWidth:i,lineWidth:m?.width??0,align:c,scrollOffsetX:r.scrollOffsetX})+Ye((m?.text??"").slice(0,p.column),o),_=e.top+p.line*l.lineHeight-r.scrollOffsetY;r.caret.rect(x,_,vy.width,l.lineHeight)}else{let p=l.lines[0],m=Dd({contentWidth:i,lineWidth:p.width,align:c,scrollOffsetX:r.scrollOffsetX}),x=e.left+m+Ye(p.text.slice(0,d),o),_=e.top+Math.max(0,(s-r.text.height)/2);r.caret.rect(x,_,vy.width,Math.max(r.text.height,o.lineHeight))}r.caret.fill({color:vy.fill,alpha:1})}},wy=(r,t)=>{let e=r.layoutState;if(!e)return 0;let{padding:i,contentWidth:s,textStyle:o,displayedValue:n,layout:a,align:l}=e,c=t?.x??0,h=t?.y??0;if(!r.element.multiline){let m=a.lines[0]??{text:n,width:Ye(n,o)},x=Dd({contentWidth:s,lineWidth:m.width,align:l,scrollOffsetX:r.scrollOffsetX}),_=i.left+x;return CR({text:m.text,style:o,targetX:c-_})}let u=a.lineHeight||o.lineHeight||1,d=Zi(Math.floor((h-i.top+r.scrollOffsetY)/u),0,Math.max(a.lines.length-1,0)),f=a.lines[d]??{text:"",startIndex:0},p=CR({text:f.text,style:o,targetX:c-Nd({padding:i,contentWidth:s,lineWidth:f.width??0,align:l,scrollOffsetX:r.scrollOffsetX})});return f.startIndex+p};var Qi=({eventHandler:r,eventName:t,element:e,eventConfig:i,snapshot:s})=>{!r||!i||r(t,{_event:{id:e.id,value:s.value,selectionStart:s.selectionStart,selectionEnd:s.selectionEnd,composing:s.composing},...i.payload??{}})},vG=({app:r,container:t,element:e,runtime:i,eventHandler:s})=>({onValueChange:o=>{i.value=o.value,i.selectionStart=o.selectionStart,i.selectionEnd=o.selectionEnd,i.lastExternalValue=o.value,Qt(i,e),Qi({eventHandler:s,eventName:"change",element:e,eventConfig:e.change,snapshot:o})},onFocus:o=>{let n=i.nativeFocused===!0;i.nativeFocused=!0,i.focused=!0,i.selectionStart=o.selectionStart,i.selectionEnd=o.selectionEnd,i.selectionAnchor=o.selectionStart===o.selectionEnd?o.selectionEnd:i.selectionAnchor,i.blinkVisible=!0,i.blinkTick=0,Qt(i,e),!n&&Qi({eventHandler:s,eventName:"focus",element:e,eventConfig:e.focusEvent,snapshot:o})},onBlur:o=>{i.nativeFocused=!1,i.focused=!1,i.selectionStart=o.selectionStart,i.selectionEnd=o.selectionEnd,i.blinkVisible=!1,i.composing=!1,Qt(i,e),Qi({eventHandler:s,eventName:"blur",element:e,eventConfig:e.blurEvent,snapshot:o})},onSelectionChange:o=>{i.nativeFocused=o.focused,i.focused=o.focused,i.selectionStart=o.selectionStart,i.selectionEnd=o.selectionEnd,o.selectionStart===o.selectionEnd&&(i.selectionAnchor=o.selectionEnd),Qt(i,e),Qi({eventHandler:s,eventName:"selectionChange",element:e,eventConfig:e.selectionChange,snapshot:o})},onSubmit:o=>{Qi({eventHandler:s,eventName:"submit",element:e,eventConfig:e.submit,snapshot:o})},onCompositionStart:o=>{i.composing=!0,Qt(i,e),Qi({eventHandler:s,eventName:"compositionStart",element:e,eventConfig:e.compositionStart,snapshot:o})},onCompositionUpdate:o=>{i.composing=!0,i.selectionStart=o.selectionStart,i.selectionEnd=o.selectionEnd,Qt(i,e),Qi({eventHandler:s,eventName:"compositionUpdate",element:e,eventConfig:e.compositionUpdate,snapshot:o})},onCompositionEnd:o=>{i.composing=!1,i.value=o.value,i.selectionStart=o.selectionStart,i.selectionEnd=o.selectionEnd,Qt(i,e),Qi({eventHandler:s,eventName:"compositionEnd",element:e,eventConfig:e.compositionEnd,snapshot:o})}}),kR=({app:r,parent:t,element:e,eventHandler:i,zIndex:s})=>{if(!r.inputDomBridge?.mount||!r.inputDomBridge?.focus||!r.inputDomBridge?.setSelection)throw new Error("Input plugin requires app.inputDomBridge to be initialized");let o=new J({label:e.id});o.zIndex=s,o.sortableChildren=!0,o.eventMode="static",o.cursor=e.disabled?"default":"text",o.x=Math.round(e.x),o.y=Math.round(e.y),o.alpha=e.alpha;let n=BR(e),a=FR({app:r,container:o,display:n,element:e});o.addChild(a.background,a.selection,a.text,a.placeholder,a.caret,a.clip),a.tickerListener=f=>{if(!a.focused){if(a.blinkVisible===!1)return;a.blinkVisible=!1,Qt(a,a.element);return}a.blinkTick+=f.deltaMS??f.deltaTime??16,a.blinkTick>=530&&(a.blinkTick=0,a.blinkVisible=!a.blinkVisible,Qt(a,a.element))},r.ticker?.add?.(a.tickerListener);let l=({start:f,end:p,shouldFocus:m=!1})=>{if(m){r.inputDomBridge.focus(e.id,{selectionStart:f,selectionEnd:p});return}r.inputDomBridge.setSelection(e.id,f,p)},c=({start:f,end:p,shouldFocus:m=!1,anchor:x=a.selectionAnchor})=>{a.focused=!0,a.selectionStart=f,a.selectionEnd=p,a.selectionAnchor=x,a.blinkVisible=!0,a.blinkTick=0,Qt(a,a.element),l({start:f,end:p,shouldFocus:m})},h=f=>{if(a.element.disabled===!0)return;let p=o.toLocal(f.global),m=wy(a,p),x=!!f.shiftKey&&a.focused,_=x?a.selectionAnchor??(a.selectionStart!==a.selectionEnd?a.selectionStart:a.selectionEnd):m,T=x?Math.min(_,m):m,g=x?Math.max(_,m):m;a.draggingSelection=!0,c({start:T,end:g,shouldFocus:!0,anchor:_})},u=f=>{if(!a.draggingSelection||a.element.disabled===!0)return;let p=o.toLocal(f.global),m=wy(a,p),x=a.selectionAnchor??m,_=Math.min(x,m),T=Math.max(x,m);c({start:_,end:T,anchor:x})},d=()=>{a.draggingSelection=!1};o.on("pointerdown",h),o.on("globalpointermove",u),o.on("pointerup",d),o.on("pointerupoutside",d),o.on("pointerup",()=>{a.element.disabled!==!0&&r.inputDomBridge.focus(e.id,{selectionStart:a.selectionStart,selectionEnd:a.selectionEnd})}),o[yn]=a,Qt(a,e),r.inputDomBridge.mount(e.id,{...e,value:a.value,callbacks:vG({app:r,container:o,element:e,runtime:a,eventHandler:i}),getGeometry:()=>Vd(r,o,e)}),t.addChild(o)};var Ji=({eventHandler:r,eventName:t,element:e,eventConfig:i,snapshot:s})=>{!r||!i||r(t,{_event:{id:e.id,value:s.value,selectionStart:s.selectionStart,selectionEnd:s.selectionEnd,composing:s.composing},...i.payload??{}})},TG=({element:r,runtime:t,eventHandler:e})=>({onValueChange:i=>{t.value=i.value,t.selectionStart=i.selectionStart,t.selectionEnd=i.selectionEnd,t.lastExternalValue=i.value,Qt(t,r),Ji({eventHandler:e,eventName:"change",element:r,eventConfig:r.change,snapshot:i})},onFocus:i=>{let s=t.nativeFocused===!0;t.nativeFocused=!0,t.focused=!0,t.selectionStart=i.selectionStart,t.selectionEnd=i.selectionEnd,t.selectionAnchor=i.selectionStart===i.selectionEnd?i.selectionEnd:t.selectionAnchor,t.blinkVisible=!0,t.blinkTick=0,Qt(t,r),!s&&Ji({eventHandler:e,eventName:"focus",element:r,eventConfig:r.focusEvent,snapshot:i})},onBlur:i=>{t.nativeFocused=!1,t.focused=!1,t.selectionStart=i.selectionStart,t.selectionEnd=i.selectionEnd,t.blinkVisible=!1,t.composing=!1,Qt(t,r),Ji({eventHandler:e,eventName:"blur",element:r,eventConfig:r.blurEvent,snapshot:i})},onSelectionChange:i=>{t.nativeFocused=i.focused,t.focused=i.focused,t.selectionStart=i.selectionStart,t.selectionEnd=i.selectionEnd,i.selectionStart===i.selectionEnd&&(t.selectionAnchor=i.selectionEnd),Qt(t,r),Ji({eventHandler:e,eventName:"selectionChange",element:r,eventConfig:r.selectionChange,snapshot:i})},onSubmit:i=>{Ji({eventHandler:e,eventName:"submit",element:r,eventConfig:r.submit,snapshot:i})},onCompositionStart:i=>{t.composing=!0,Qt(t,r),Ji({eventHandler:e,eventName:"compositionStart",element:r,eventConfig:r.compositionStart,snapshot:i})},onCompositionUpdate:i=>{t.composing=!0,t.selectionStart=i.selectionStart,t.selectionEnd=i.selectionEnd,Qt(t,r),Ji({eventHandler:e,eventName:"compositionUpdate",element:r,eventConfig:r.compositionUpdate,snapshot:i})},onCompositionEnd:i=>{t.composing=!1,t.value=i.value,t.selectionStart=i.selectionStart,t.selectionEnd=i.selectionEnd,Qt(t,r),Ji({eventHandler:e,eventName:"compositionEnd",element:r,eventConfig:r.compositionEnd,snapshot:i})}}),OR=({app:r,parent:t,prevElement:e,nextElement:i,eventHandler:s,zIndex:o})=>{let n=t.children.find(h=>h.label===e.id);if(!n)return;if(!r.inputDomBridge?.update)throw new Error("Input plugin requires app.inputDomBridge to be initialized");n.zIndex=o;let a=n[yn];if(!a)return;let l={...i},c=a.focused!==!0||i.value!==e.value;c&&a.composing!==!0?(a.value=i.value,a.lastExternalValue=i.value):l.value=a.value,a.element=l,n.label=i.id,n.cursor=i.disabled?"default":"text",n.x=Math.round(i.x),n.y=Math.round(i.y),n.alpha=i.alpha,i.disabled===!0&&(a.draggingSelection=!1),(!gt(e,i)||c)&&Qt(a,l),r.inputDomBridge.update(i.id,{...l,value:a.value,callbacks:TG({element:l,runtime:a,eventHandler:s}),getGeometry:()=>Vd(r,n,l)})};var UR=({app:r,parent:t,element:e})=>{let i=t.getChildByLabel(e.id);if(!i)return;if(!r.inputDomBridge?.unmount)throw new Error("Input plugin requires app.inputDomBridge to be initialized");let s=i[yn];s?.tickerListener&&r.ticker?.remove?.(s.tickerListener),r.inputDomBridge.unmount(e.id),i.destroy({children:!0})};var GR=({state:r})=>{let t=ge(r),e=String(r.value??""),i=String(r.placeholder??"");return delete t.originX,delete t.originY,{...t,value:e,placeholder:i,multiline:r.multiline===!0,disabled:r.disabled===!0,...typeof r.maxLength=="number"&&{maxLength:Math.round(r.maxLength)},textStyle:Hd(r.textStyle),padding:Ty(r.padding),...r.change&&{change:r.change},...r.submit&&{submit:r.submit},...r.focusEvent&&{focusEvent:r.focusEvent},...r.blurEvent&&{blurEvent:r.blurEvent},...r.selectionChange&&{selectionChange:r.selectionChange},...r.compositionStart&&{compositionStart:r.compositionStart},...r.compositionUpdate&&{compositionUpdate:r.compositionUpdate},...r.compositionEnd&&{compositionEnd:r.compositionEnd}}};var SG=Zt({type:"input",add:kR,update:OR,delete:UR,parse:GR});var wG=24,EG=24,ks=(r,t,e)=>Math.min(e,Math.max(t,r)),NR=r=>ks(r,0,1),_n=r=>{r?.stopPropagation?.()},AG=r=>r?B.from(r):B.EMPTY,Wd=({label:r})=>{let t=new Tt(B.EMPTY);return t.label=r,t.eventMode="static",t.cursor="pointer",t},PG=({config:r,state:t})=>r?t?.pressed&&r.pressSrc?r.pressSrc:t?.hovered&&r.hoverSrc?r.hoverSrc:r.src??"":"",zd=({sprite:r,config:t,state:e,width:i,height:s})=>{r&&(r.texture=AG(PG({config:t,state:e})),r.width=Math.max(i,0),r.height=Math.max(s,0),r.visible=r.width>0&&r.height>0,r.eventMode=r.visible?"static":"none")},CG=r=>({root:`${r}-scrollbar-vertical`,track:`${r}-scrollbar-vertical-track`,thumb:`${r}-scrollbar-vertical-thumb`,startButton:`${r}-scrollbar-vertical-start-button`,endButton:`${r}-scrollbar-vertical-end-button`}),LR=(r,t)=>Math.abs(r-t)<.5,DR=({hasOverflow:r,minScroll:t,previousOffset:e,wasAtEnd:i,anchorToEnd:s})=>r?s&&(e===void 0||i)?t:typeof e=="number"?ks(e,t,0):0:0,RG=({controller:r})=>{let t=CG(r.container.label),e=r.element.scrollbar?.vertical;if(!e)return null;let i=new J({label:t.root});i.eventMode="static",i.cursor="pointer";let s=Wd({label:t.track}),o=Wd({label:t.thumb}),n={config:e,root:i,track:s,thumb:o,startButton:null,endButton:null,states:{track:{hovered:!1,pressed:!1},thumb:{hovered:!1,pressed:!1,dragging:!1},startButton:{hovered:!1,pressed:!1},endButton:{hovered:!1,pressed:!1}},dragOffsetY:0};i.addChild(s),i.addChild(o),e.startButton&&(n.startButton=Wd({label:t.startButton}),i.addChild(n.startButton)),e.endButton&&(n.endButton=Wd({label:t.endButton}),i.addChild(n.endButton));let a=()=>{HR({controller:r})};s.on("pointerover",()=>{n.states.track.hovered=!0,a()}),s.on("pointerout",()=>{n.states.track.hovered=!1,a()}),s.on("pointerdown",u=>{_n(u),n.states.track.pressed=!0,a();let d=i.toLocal(u.global),{thumb:f}=n,p=r.viewportHeight;d.y<f.y?r.setScrollOffsets({y:r.scrollYOffset+p,source:"track"}):d.y>f.y+f.height&&r.setScrollOffsets({y:r.scrollYOffset-p,source:"track"})});let l=u=>{_n(u),n.states.track.pressed=!1,a()};s.on("pointerup",l),s.on("pointerupoutside",l),o.on("pointerover",()=>{n.states.thumb.hovered=!0,a()}),o.on("pointerout",()=>{n.states.thumb.hovered=!1,n.states.thumb.dragging||a()}),o.on("pointerdown",u=>{_n(u);let d=i.toLocal(u.global);n.states.thumb.pressed=!0,n.states.thumb.dragging=!0,n.dragOffsetY=d.y-n.thumb.y,a()});let c=u=>{if(_n(u),!n.states.thumb.dragging){n.states.thumb.pressed=!1,a();return}n.states.thumb.dragging=!1,n.states.thumb.pressed=!1,a()};i.on("globalpointermove",u=>{if(!n.states.thumb.dragging)return;let d=i.toLocal(u.global),f=n.track.y,p=Math.max(n.track.height-n.thumb.height,0);if(p<=0||r.minScrollY===0){r.setScrollOffsets({y:0,source:"thumb"});return}let m=ks(d.y-n.dragOffsetY,f,f+p),x=NR((m-f)/p);r.setScrollOffsets({y:r.minScrollY*x,source:"thumb"})}),o.on("pointerup",c),o.on("pointerupoutside",c),i.on("pointerup",c),i.on("pointerupoutside",c);let h=({sprite:u,config:d,state:f,deltaDirection:p})=>{if(!u||!d)return;u.on("pointerover",()=>{f.hovered=!0,a()}),u.on("pointerout",()=>{f.hovered=!1,a()}),u.on("pointerdown",x=>{_n(x),f.pressed=!0,a(),r.setScrollOffsets({y:r.scrollYOffset+p*Math.max(d.step??wG,0),source:"button"})});let m=x=>{_n(x),f.pressed=!1,a()};u.on("pointerup",m),u.on("pointerupoutside",m)};return h({sprite:n.startButton,config:e.startButton,state:n.states.startButton,deltaDirection:1}),h({sprite:n.endButton,config:e.endButton,state:n.states.endButton,deltaDirection:-1}),r.container.addChild(i),n},HR=({controller:r})=>{let t=r.verticalScrollbar;if(!t)return;let{config:e,root:i,track:s,thumb:o,startButton:n,endButton:a,states:l}=t,c=Math.max(e.thickness??0,0),h=n?Math.max(e.startButton?.size??c,0):0,u=a?Math.max(e.endButton?.size??c,0):0,d=Math.max(r.viewportHeight-h-u,0),f=Math.min(EG,d),p=e.thumb?.length,m=typeof p=="number"?p:r.totalHeight>0?Math.round(r.viewportHeight/r.totalHeight*d):d,x=d>0?typeof p=="number"?ks(m,0,d):ks(m,f,d):0,_=Math.max(d-x,0),T=r.minScrollY===0?0:NR(r.scrollYOffset/r.minScrollY);i.visible=r.hasVerticalOverflow&&r.element.scroll&&c>0&&r.viewportHeight>0,i.x=Math.max(r.viewportWidth-c,0),i.y=0,s.x=0,s.y=h,zd({sprite:s,config:e.track,state:l.track,width:c,height:d}),o.x=0,o.y=h+_*T,zd({sprite:o,config:e.thumb,state:l.thumb,width:c,height:x}),n&&(n.x=0,n.y=0,zd({sprite:n,config:e.startButton,state:l.startButton,width:c,height:h})),a&&(a.x=0,a.y=r.viewportHeight-u,zd({sprite:a,config:e.endButton,state:l.endButton,width:c,height:u}))},VR=({container:r})=>{let t=r.__routeGraphicsScrollController;return t?{scrollXOffset:t.scrollXOffset,scrollYOffset:t.scrollYOffset,wasAtHorizontalEnd:t.hasHorizontalOverflow&&LR(t.scrollXOffset,t.minScrollX),wasAtVerticalEnd:t.hasVerticalOverflow&&LR(t.scrollYOffset,t.minScrollY)}:null},ec=({container:r,element:t,interactive:e=!0,allowViewportWithoutScroll:i=!1,previousState:s=null})=>{let o=0,n=0;t.children.forEach(h=>{o=Math.max(h.width+h.x,o),n=Math.max(h.height+h.y,n)});let a=!!(t.height&&n>t.height),l=!!(t.width&&o>t.width);if((t.scroll||i)&&(a||l)){let h=new J({label:`${r.label}-content`});[...r.children].forEach(x=>{h.addChild(x)}),r.addChild(h);let d=new Bt({label:`${r.label}-clip`}).rect(0,0,t.width||o,t.height||n).fill({color:16711680,alpha:0});r.addChild(d),h.mask=d;let f=-(n-(t.height||n)),p=-(o-(t.width||o)),m={container:r,contentContainer:h,clip:d,element:t,totalWidth:o,totalHeight:n,viewportWidth:t.width||o,viewportHeight:t.height||n,hasHorizontalOverflow:l,hasVerticalOverflow:a,minScrollX:p,minScrollY:f,scrollXOffset:DR({hasOverflow:l,minScroll:p,previousOffset:s?.scrollXOffset,wasAtEnd:s?.wasAtHorizontalEnd,anchorToEnd:!!t.anchorToBottom}),scrollYOffset:DR({hasOverflow:a,minScroll:f,previousOffset:s?.scrollYOffset,wasAtEnd:s?.wasAtVerticalEnd,anchorToEnd:!!t.anchorToBottom}),verticalScrollbar:null,setScrollOffsets:({x,y:_})=>{let T=x??m.scrollXOffset,g=_??m.scrollYOffset;m.scrollXOffset=m.hasHorizontalOverflow?ks(T,m.minScrollX,0):0,m.scrollYOffset=m.hasVerticalOverflow?ks(g,m.minScrollY,0):0,m.contentContainer.x=m.scrollXOffset,m.contentContainer.y=m.scrollYOffset,HR({controller:m})}};r.__routeGraphicsScrollController=m,m.verticalScrollbar=RG({controller:m}),m.setScrollOffsets({x:m.scrollXOffset,y:m.scrollYOffset,source:"initial"}),e&&(r.eventMode="static",r.hitArea=new Q(0,0,t.width||o,t.height||n),r.on("wheel",x=>{if(x.preventDefault(),a&&x.deltaY!==0&&m.setScrollOffsets({y:m.scrollYOffset-x.deltaY,source:"wheel"}),l&&(x.deltaX!==0||x.shiftKey&&x.deltaY!==0)){let _=x.deltaX!==0?x.deltaX:x.deltaY;m.setScrollOffsets({x:m.scrollXOffset-_,source:"wheel"})}}))}},Ey=({container:r})=>{let t=r.__routeGraphicsScrollController,e=r.children.find(o=>o.label&&o.label.endsWith("-content")),i=r.children.find(o=>o.label&&o.label.endsWith("-clip")),s=r.children.find(o=>o.label&&o.label.endsWith("-scrollbar-vertical"));e&&([...e.children].forEach(n=>{n.mask=null,r.addChild(n)}),r.removeChild(e),e.destroy({children:!1})),i&&(r.removeChild(i),i.destroy()),s&&(r.removeChild(s),s.destroy({children:!0})),r.eventMode="auto",r.hitArea=null,r.removeAllListeners("wheel"),t&&(r.__routeGraphicsScrollController=void 0)};var Ay=({container:r,element:t,enabled:e})=>{if(e){r.hitArea=new Q(0,0,t.width,t.height);return}r.hitArea=null},WR=(r,t)=>{let e=t??null;for(;e;){if(e===r)return!0;e=e.parent??null}return!1},Os=(r,t)=>{let e=t??null;for(;e;){if(e===r)return!1;if(typeof e.label=="string"&&e.label.startsWith(`${r.label}-scrollbar-`))return!0;e=e.parent??null}return!1},MG=(r,t)=>{if(!t||typeof t.x!="number"||typeof t.y!="number")return!1;let e=r.toLocal(t),i=r.hitArea;return i?.contains?i.contains(e.x,e.y):!1},$d=({app:r,container:t,element:e,eventHandler:i})=>{let s=my(t),o=gy(t),n=xy(t),a=s;fn({root:t,isHovered:!1}),Bs({root:t,isPressed:!1}),bi({root:t,isPressed:!1}),t.removeAllListeners("pointerover"),t.removeAllListeners("pointerout"),t.removeAllListeners("pointerdown"),t.removeAllListeners("pointerup"),t.removeAllListeners("pointerupoutside"),t.removeAllListeners("rightdown"),t.removeAllListeners("rightup"),t.removeAllListeners("rightupoutside"),t.removeAllListeners("rightclick"),t.cursor="auto",e.scroll||(t.eventMode="auto",Ay({container:t,element:e,enabled:!1}));let l=e?.hover,c=e?.click,h=e?.rightClick;if(!!(l||c||h)&&(t.eventMode="static",e.scroll?t.hitArea||Ay({container:t,element:e,enabled:!0}):Ay({container:t,element:e,enabled:!1})),l){let{cursor:d,soundSrc:f,payload:p,inheritToChildren:m}=l,x=T=>{WR(t,T?.relatedTarget)||a||(a=!0,p&&i&&i("hover",{_event:{id:t.label},...p}),d&&(t.cursor=d),f&&r.audioStage.add({id:`hover-${Date.now()}`,url:f,loop:!1}),m&&fn({root:t,isHovered:!0}))},_=T=>{WR(t,T?.relatedTarget)||MG(t,T?.global)||a&&(a=!1,t.cursor="auto",m&&fn({root:t,isHovered:!1}))};t.on("pointerover",x),t.on("pointerout",_)}if(c){let{soundSrc:d,soundVolume:f,payload:p,inheritToChildren:m}=c,x=g=>{ie(g)&&(Os(t,g?.target)||m&&Bs({root:t,isPressed:!0}))},_=g=>{ie(g)&&(Os(t,g?.target)||(m&&Bs({root:t,isPressed:!1}),p&&i&&i("click",{_event:{id:t.label},...p}),d&&r.audioStage.add({id:`click-${Date.now()}`,url:d,loop:!1,volume:(f??1e3)/1e3})))},T=g=>{ie(g)&&(Os(t,g?.target)||m&&Bs({root:t,isPressed:!1}))};t.on("pointerdown",x),t.on("pointerup",_),t.on("pointerupoutside",T)}if(h){let{soundSrc:d,payload:f,inheritToChildren:p}=h,m=w=>{Os(t,w?.target)||p&&bi({root:t,isPressed:!0})},x=w=>{Os(t,w?.target)||p&&bi({root:t,isPressed:!1})},_=w=>{KC(w)&&(Os(t,w?.target)||p&&bi({root:t,isPressed:!1}))},T=w=>{Os(t,w?.target)||(p&&bi({root:t,isPressed:!1}),f&&i&&i("rightClick",{_event:{id:t.label},...f}),d&&r.audioStage.add({id:`rightClick-${Date.now()}`,url:d,loop:!1}))},g=()=>{p&&bi({root:t,isPressed:!1})};t.on("rightdown",m),t.on("rightup",x),t.on("pointerup",_),t.on("rightclick",T),t.on("pointerupoutside",_),t.on("rightupoutside",g)}l?.inheritToChildren&&s&&fn({root:t,isHovered:!0}),c?.inheritToChildren&&o&&Bs({root:t,isPressed:!0}),h?.inheritToChildren&&n&&bi({root:t,isPressed:!0})},zR=({container:r})=>{my(r)&&fn({root:r,isHovered:!0})},$R=({container:r})=>{gy(r)&&Bs({root:r,isPressed:!0})},XR=({container:r})=>{xy(r)&&bi({root:r,isPressed:!0})};var rc=r=>{let t=new Set;if(r.id&&t.add(r.id),r.children&&Array.isArray(r.children))for(let e of r.children)for(let i of rc(e))t.add(i);return t};var jR=(r,t,e=[])=>{let i=new Set,s=new Map,o=new Map,n=[],a=[],l=[];for(let c of r)i.add(c.id),s.set(c.id,c);for(let c of t)i.add(c.id),o.set(c.id,c);for(let c of i){let h=s.get(c),u=o.get(c);if(!h&&u)n.push(u);else if(h&&!u)a.push(h);else{let d=rc(u),f=e instanceof Map?Array.from(e.keys()).some(p=>d.has(p)):e.find(p=>d.has(p.targetId));(!gt(h,u)||f)&&l.push({prev:h,next:u})}}return{toAddElement:n,toDeleteElement:a,toUpdateElement:l}};var Xd=r=>r<.36363636363636365?7.5625*r*r:r<.7272727272727273?7.5625*(r-=.5454545454545454)*r+.75:r<.9090909090909091?7.5625*(r-=.8181818181818182)*r+.9375:7.5625*(r-=.9545454545454546)*r+.984375,IG=r=>r,BG=r=>r*r,FG=r=>1-(1-r)*(1-r),kG=r=>r<.5?2*r*r:1-Math.pow(-2*r+2,2)/2,YR=Object.freeze({linear:IG,easeInQuad:BG,easeOutQuad:FG,easeInOutQuad:kG,easeInCubic:r=>r*r*r,easeOutCubic:r=>1-Math.pow(1-r,3),easeInOutCubic:r=>r<.5?4*r*r*r:1-Math.pow(-2*r+2,3)/2,easeInQuart:r=>r*r*r*r,easeOutQuart:r=>1-Math.pow(1-r,4),easeInOutQuart:r=>r<.5?8*r*r*r*r:1-Math.pow(-2*r+2,4)/2,easeInQuint:r=>r*r*r*r*r,easeOutQuint:r=>1-Math.pow(1-r,5),easeInOutQuint:r=>r<.5?16*r*r*r*r*r:1-Math.pow(-2*r+2,5)/2,easeInSine:r=>1-Math.cos(r*Math.PI/2),easeOutSine:r=>Math.sin(r*Math.PI/2),easeInOutSine:r=>-(Math.cos(Math.PI*r)-1)/2,easeInExpo:r=>r===0?0:Math.pow(2,10*r-10),easeOutExpo:r=>r===1?1:1-Math.pow(2,-10*r),easeInOutExpo:r=>r===0?0:r===1?1:r<.5?Math.pow(2,20*r-10)/2:(2-Math.pow(2,-20*r+10))/2,easeInCirc:r=>1-Math.sqrt(1-Math.pow(r,2)),easeOutCirc:r=>Math.sqrt(1-Math.pow(r-1,2)),easeInOutCirc:r=>r<.5?(1-Math.sqrt(1-Math.pow(2*r,2)))/2:(Math.sqrt(1-Math.pow(-2*r+2,2))+1)/2,easeInBack:r=>2.70158*r*r*r-1.70158*r*r,easeOutBack:r=>1+2.70158*Math.pow(r-1,3)+1.70158*Math.pow(r-1,2),easeInOutBack:r=>{let e=2.5949095;return r<.5?Math.pow(2*r,2)*((e+1)*2*r-e)/2:(Math.pow(2*r-2,2)*((e+1)*(r*2-2)+e)+2)/2},easeInBounce:r=>1-Xd(1-r),easeOutBounce:Xd,easeInOutBounce:r=>r<.5?(1-Xd(1-2*r))/2:(1+Xd(2*r-1))/2,easeInElastic:r=>{let t=2*Math.PI/3;return r===0?0:r===1?1:-Math.pow(2,10*r-10)*Math.sin((r*10-10.75)*t)},easeOutElastic:r=>{let t=2*Math.PI/3;return r===0?0:r===1?1:Math.pow(2,-10*r)*Math.sin((r*10-.75)*t)+1},easeInOutElastic:r=>{let t=2*Math.PI/4.5;return r===0?0:r===1?1:r<.5?-(Math.pow(2,20*r-10)*Math.sin((20*r-11.125)*t))/2:Math.pow(2,-20*r+10)*Math.sin((20*r-11.125)*t)/2+1}}),jd=Object.freeze(Object.keys(YR)),OG=(r="linear")=>{let t=YR[r];if(!t)throw new Error(`Unsupported easing: ${r}`);return t},bn=r=>{let t=[],e=0,i;return r.forEach(({value:s,duration:o,easing:n="linear",relative:a},l)=>{if(l===0){i=s,t.push({time:e,value:s,easing:"linear"});return}o!==void 0&&(e+=o,i=a?i+s:s,t.push({time:e,value:i,easing:n}))}),t},ic=r=>{let t=0;for(let{timeline:e}of r){let i=e[e.length-1];i&&i.time>t&&(t=i.time)}return t},sc=(r,t)=>{if(r.length===0)return 0;if(t<=r[0].time)return r[0].value;if(t>=r[r.length-1].time)return r[r.length-1].value;for(let e=0;e<r.length-1;e++){let{time:i,value:s,easing:o}=r[e],{time:n,value:a}=r[e+1];if(t>=i&&t<=n){let l=(t-i)/(n-i);return s+(a-s)*OG(o)(l)}}return r[r.length-1].value};var UG={translateX:0,translateY:0,alpha:1,scaleX:1,scaleY:1,rotation:0},Cy=r=>Math.min(1,Math.max(0,r)),Yd=(r,t,e)=>{if(r===t)return e<r?0:1;let i=Cy((e-r)/(t-r));return i*i*(3-2*i)},ZR=r=>r.getLocalBounds().rectangle.clone(),QR=r=>(r.width=Math.max(1,Math.ceil(r.width)),r.height=Math.max(1,Math.ceil(r.height)),r),qR=(r,t)=>{let e=QR(ZR(t)),i=r.renderer.generateTexture({target:t,frame:e}),s=new Tt(i);s.x=e.x,s.y=e.y;let o=new J;return o.x=t.x??0,o.y=t.y??0,o.scale.set(t.scale?.x??1,t.scale?.y??1),o.rotation=t.rotation??0,o.alpha=t.alpha??1,o.addChild(s),{wrapper:o,texture:i}},GG=(r={})=>Object.entries(r).map(([t,e])=>({property:t,timeline:bn([{value:e.initialValue??UG[t]??0},...e.keyframes])})),qd=(r,t,e)=>{if(!r||!t)return{duration:0,apply:()=>{}};let i=GG(t),s={x:r.x,y:r.y,alpha:r.alpha,scaleX:r.scale.x,scaleY:r.scale.y,rotation:r.rotation};return{duration:ic(i),apply:o=>{r.x=s.x,r.y=s.y,r.alpha=s.alpha,r.scale.x=s.scaleX,r.scale.y=s.scaleY,r.rotation=s.rotation;for(let{property:n,timeline:a}of i){let l=sc(a,o);switch(n){case"translateX":r.x=s.x+l*e.renderer.width;break;case"translateY":r.y=s.y+l*e.renderer.height;break;case"alpha":r.alpha=s.alpha*l;break;case"scaleX":r.scale.x=s.scaleX*l;break;case"scaleY":r.scale.y=s.scaleY*l;break;case"rotation":r.rotation=s.rotation+l;break}}}}},LG=r=>bn([{value:r?.progress?.initialValue??0},...r?.progress?.keyframes??[]]),DG=(r,t)=>{let e=document.createElement("canvas");e.width=r,e.height=t;let i=e.getContext("2d",{willReadFrequently:!0});if(!i)throw new Error("Replace mask composition could not create a 2D canvas.");return{canvas:e,context:i}},NG=(r,t,e="red")=>{switch(e){case"green":return r[t+1];case"blue":return r[t+2];case"alpha":return r[t+3];default:return r[t]}},Py=({app:r,texture:t,width:e,height:i,channel:s="red",invert:o=!1})=>{let n=new Uint8ClampedArray(e*i),a=new Tt(B.from(t));a.width=e,a.height=i;let l=new J;l.addChild(a);let c=gi.create({width:e,height:i});r.renderer.render({container:l,target:c,clear:!0});let h=r.renderer.extract.pixels(c).pixels;for(let u=0,d=0;u<n.length;u++,d+=4){let f=NG(h,d,s);o&&(f=255-f),n[u]=f}return l.destroy({children:!0}),c.destroy(!0),n},HG=(r,t,e,i)=>{let s=null;for(let o of t.items){let n=Py({app:r,texture:o.texture,width:e,height:i,channel:o.channel??"red",invert:o.invert??!1});if(!s){s=n;continue}for(let a=0;a<s.length;a++)switch(t.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(e*i)},VG=(r,t,e,i)=>{let s=LG(t),o=ic([{timeline:s}]),n=Math.max(t?.softness??.001,1e-4);if(!t)return{duration:o,progressTimeline:s,sample:()=>0,destroy:()=>{}};if(t.kind==="single"){let l=Py({app:r,texture:t.texture,width:e,height:i,channel:t.channel??"red",invert:t.invert??!1});return{duration:o,progressTimeline:s,sample:(c,h)=>Yd(c-n,c+n,l[h]/255),destroy:()=>{}}}if(t.kind==="sequence"){let l=t.textures.map(c=>Py({app:r,texture:c,width:e,height:i,channel:t.channel??"red",invert:t.invert??!1}));return{duration:o,progressTimeline:s,sample:(c,h)=>{let u=Cy(c)*Math.max(0,l.length-1);if(t.sample==="linear"&&l.length>1){let f=Math.floor(u),p=Math.min(l.length-1,f+1),m=u-f,x=(l[f][h]*(1-m)+l[p][h]*m)/255;return Yd(c-n,c+n,x)}let d=Math.min(l.length-1,Math.max(0,Math.round(u)));return Yd(c-n,c+n,l[d][h]/255)},destroy:()=>{}}}let a=HG(r,t,e,i);return{duration:o,progressTimeline:s,sample:(l,c)=>Yd(l-n,l+n,a[c]/255),destroy:()=>{}}},WG=r=>{let t=new J;for(let e of r)e?.wrapper&&t.addChild(e.wrapper);return QR(ZR(t))},KR=({app:r,container:t,target:e,frame:i})=>{r.renderer.render({container:t,target:e,clear:!0,transform:new U(1,0,0,1,-i.x,-i.y)})},oc=r=>{r?.texture?.destroy(!0)},zG=({app:r,animation:t,prevSubject:e,nextSubject:i,zIndex:s})=>{let o=new J;o.zIndex=s,e?.wrapper&&o.addChild(e.wrapper),i?.wrapper&&o.addChild(i.wrapper);let n=qd(e?.wrapper??null,t.prev?.tween,r),a=qd(i?.wrapper??null,t.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}),oc(e),oc(i)}}},$G=({app:r,animation:t,prevSubject:e,nextSubject:i,zIndex:s})=>{let o=WG([e,i]),n=new J,a=new J;e?.wrapper&&n.addChild(e.wrapper),i?.wrapper&&a.addChild(i.wrapper);let l=gi.create({width:o.width,height:o.height}),c=gi.create({width:o.width,height:o.height}),{canvas:h,context:u}=DG(o.width,o.height),d=u.createImageData(o.width,o.height),f=B.from(h),p=new J;p.zIndex=s;let m=new Tt(f);m.x=o.x,m.y=o.y,p.addChild(m);let x=VG(r,t.mask,o.width,o.height),_=qd(e?.wrapper??null,t.prev?.tween,r),T=qd(i?.wrapper??null,t.next?.tween,r),g=new Uint8ClampedArray(o.width*o.height*4);return{overlay:p,duration:Math.max(_.duration,T.duration,x.duration),apply:w=>{_.apply(w),T.apply(w);let b=g,S=g;e?.wrapper&&(KR({app:r,container:n,target:l,frame:o}),b=r.renderer.extract.pixels(l).pixels),i?.wrapper&&(KR({app:r,container:a,target:c,frame:o}),S=r.renderer.extract.pixels(c).pixels);let v=Cy(sc(x.progressTimeline,w)),P=d.data;for(let C=0,A=0;C<P.length;C+=4,A+=1){let R=x.sample(v,A),M=1-R;P[C]=Math.round(b[C]*M+S[C]*R),P[C+1]=Math.round(b[C+1]*M+S[C+1]*R),P[C+2]=Math.round(b[C+2]*M+S[C+2]*R),P[C+3]=Math.round(b[C+3]*M+S[C+3]*R)}u.putImageData(d,0,0),f.source.update()},destroy:()=>{p.removeFromParent(),p.destroy({children:!0}),n.destroy({children:!0}),a.destroy({children:!0}),l.destroy(!0),c.destroy(!0),f.destroy(!0),oc(e),oc(i),x.destroy()}}},XG=({app:r,animation:t,prevSubject:e,nextSubject:i,zIndex:s})=>t.mask?$G({app:r,animation:t,prevSubject:e,nextSubject:i,zIndex:s}):zG({app:r,animation:t,prevSubject:e,nextSubject:i,zIndex:s}),jG=({app:r,parent:t,nextElement:e,plugin:i,animations:s,eventHandler:o,animationBus:n,completionTracker:a,elementPlugins:l,renderContext:c,zIndex:h,signal:u})=>{if(!e)return null;let d=i.add({app:r,parent:t,element:e,animations:s,eventHandler:o,animationBus:n,completionTracker:a,elementPlugins:l,renderContext:c,zIndex:h,signal:u});return d&&typeof d.then=="function"?d.then(()=>u?.aborted||t.destroyed?null:t.children.find(f=>f.label===e.id)??null):u?.aborted||t.destroyed?null:t.children.find(f=>f.label===e.id)??null},YG=async r=>r&&typeof r.then=="function"?r:r??null,Kd=({app:r,parent:t,prevElement:e,nextElement:i,animation:s,animations:o,animationBus:n,completionTracker:a,eventHandler:l,elementPlugins:c,renderContext:h,plugin:u,zIndex:d,signal:f})=>{if(!e&&!i)throw new Error(`Replace animation "${s.id}" must receive prevElement and/or nextElement.`);if(f?.aborted||t.destroyed)return;let p=e?t.children.find(M=>M.label===e.id)??null:null;if(e&&!p)throw new Error(`Transition animation "${s.id}" could not find the previous element "${e.id}".`);let m=p?qR(r,p):null,x=new J,_=Td({suppressAnimations:!0}),T=a.getVersion(),g=!1,w=()=>{g||(a.track(T),g=!0)},b=()=>{g&&(a.complete(T),g=!1)},S=({flushDeferredEffects:M})=>{if(!C){if(C=!0,v.value&&!v.value.destroyed&&(v.value.visible=!0),P.value?.destroy(),M){WC(_);return}Sd(_)}},v={value:null},P={value:null},C=!1;w();let A=M=>{if(f?.aborted||t.destroyed){Sd(_),x.destroy({children:!0}),oc(m),b();return}if(i&&!M)throw Sd(_),b(),new Error(`Transition animation "${s.id}" could not create the next element "${i.id}".`);v.value=M;let I=M?qR(r,M):null;x.destroy({children:!1}),p&&u.delete({app:r,parent:t,element:e,animations:[],animationBus:n,completionTracker:a,eventHandler:l,elementPlugins:c,renderContext:h,signal:f}),M&&(M.zIndex=d,t.addChild(M),M.visible=!1);let k=XG({app:r,animation:s,prevSubject:m,nextSubject:I,zIndex:d});P.value=k,t.addChild(k.overlay),n.dispatch({type:"START",payload:{id:s.id,driver:"custom",duration:k.duration,applyFrame:k.apply,applyTargetState:()=>{S({flushDeferredEffects:!1})},onComplete:()=>{S({flushDeferredEffects:!0}),b()},onCancel:()=>{b()},isValid:()=>!!k.overlay&&!k.overlay.destroyed&&(!M||!M.destroyed)}})},R=i?jG({app:r,parent:x,nextElement:i,plugin:u,animations:o,eventHandler:l,animationBus:n,completionTracker:a,elementPlugins:c,renderContext:_,zIndex:d,signal:f}):null;if(R&&typeof R.then=="function"){YG(R).then(A);return}A(R??null)};var Us=({app:r,parent:t,prevComputedTree:e,nextComputedTree:i,animations:s,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:c=Td(),signal:h})=>{t.sortableChildren=!0;let u=new Map(l.map(b=>[b.type,b])),d=zC(s),f=new Map,p=new Map;for(let b of e)f.set(b.id,b);for(let b=0;b<i.length;b++)p.set(i[b].id,b);let{toAddElement:m,toDeleteElement:x,toUpdateElement:_}=jR(e,i,s),T=new Set(_.map(({next:b})=>b.id)),g=b=>{let S=u.get(b);if(!S)throw new Error(`No plugin found for element type: ${b}`);return S},w=b=>t.children.find(S=>S.label===b)?.zIndex??-1;for(let b of i){let S=f.get(b.id);!S||T.has(b.id)||!gt(S,b)||g(b.type).shouldUpdateUnchanged?.({app:r,parent:t,prevElement:S,nextElement:b,animations:d,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:c,zIndex:p.get(b.id)??-1,signal:h})!==!0||(_.push({prev:S,next:b}),T.add(b.id))}for(let b of t.children){let S=p.get(b.label);S!==void 0&&(b.zIndex=S)}for(let b of x){let S=c.suppressAnimations?null:Ad(d,b.id),v=g(b.type);if(S){Kd({app:r,parent:t,prevElement:b,nextElement:null,animation:S,animations:d,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:c,plugin:v,zIndex:w(b.id),signal:h});continue}v.delete({app:r,parent:t,element:b,animations:[],animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:c,signal:h})}for(let b of m){let S=c.suppressAnimations?null:Ad(d,b.id),v=g(b.type),P=p.get(b.id)??-1;if(S){Kd({app:r,parent:t,prevElement:null,nextElement:b,animation:S,animations:d,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:c,plugin:v,zIndex:P,signal:h});continue}v.add({app:r,parent:t,element:b,animations:c.suppressAnimations||b.type==="container"?d:[],eventHandler:a,animationBus:o,completionTracker:n,elementPlugins:l,renderContext:c,zIndex:P,signal:h})}for(let{prev:b,next:S}of _){let v=g(S.type),P=p.get(S.id)??-1,C=c.suppressAnimations?null:Ad(d,S.id);if(C){Kd({app:r,parent:t,prevElement:b,nextElement:S,animation:C,animations:d,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:c,plugin:v,zIndex:P,signal:h});continue}v.update({app:r,parent:t,prevElement:b,nextElement:S,animations:d,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:c,zIndex:P,signal:h})}};var qG=(r=[])=>{let t=new Set;for(let e of r)if(e?.id){if(t.has(e.id))return!0;t.add(e.id)}return!1},KG=({app:r,container:t,children:e,eventHandler:i,animationBus:s,elementPlugins:o,renderContext:n,completionTracker:a,signal:l})=>{for(let c of e){let h=o.find(u=>u.type===c.type);if(!h)throw new Error(`No plugin found for child element type: ${c.type}`);h.add({app:r,parent:t,element:c,animations:[],eventHandler:i,animationBus:s,elementPlugins:o,renderContext:n,completionTracker:a,signal:l})}},JR=({app:r,parent:t,element:e,animations:i,eventHandler:s,animationBus:o,elementPlugins:n,renderContext:a,zIndex:l,completionTracker:c,signal:h})=>{let{id:u,x:d,y:f,children:p,scroll:m,alpha:x}=e,_=new J;_.label=u,_.zIndex=l,_.x=Math.round(d),_.y=Math.round(f),_.alpha=x,t.addChild(_),p&&p.length>0&&(qG(p)?KG({app:r,container:_,children:p,eventHandler:s,animationBus:o,elementPlugins:n,renderContext:a,completionTracker:c,signal:h}):Us({app:r,parent:_,prevComputedTree:[],nextComputedTree:p,animations:i,animationBus:o,completionTracker:c,eventHandler:s,elementPlugins:n,renderContext:a,signal:h})),(m||e.anchorToBottom)&&ec({container:_,element:e,interactive:!!m,allowViewportWithoutScroll:!!e.anchorToBottom}),$d({app:r,container:_,element:e,eventHandler:s})};var tM=({app:r,parent:t,prevElement:e,nextElement:i,eventHandler:s,animations:o,animationBus:n,elementPlugins:a,renderContext:l,zIndex:c,completionTracker:h,signal:u})=>{let d=t.children.find(T=>T.label===e.id);if(!d)return;d.zIndex=c;let{x:f,y:p,alpha:m}=i,x=()=>{if(!gt(e,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=e.scroll||e.anchorToBottom,S=i.scroll||i.anchorToBottom,v=S?VR({container:d}):null;b!==S?S?ec({container:d,element:i,interactive:!!i.scroll,allowViewportWithoutScroll:!!i.anchorToBottom,previousState:v}):Ey({container:d}):S&&(Ey({container:d}),ec({container:d,element:i,interactive:!!i.scroll,allowViewportWithoutScroll:!!i.anchorToBottom,previousState:v})),$d({app:r,container:d,element:i,eventHandler:s})}let T=!gt(e.children,i.children),g=rc({children:i.children}),w=Array.from(g).some(b=>Ed(o,b).length>0);if(T||w){let S=d.children.find(v=>v.label===`${i.id}-content`)||d;Us({app:r,parent:S,nextComputedTree:i.children,prevComputedTree:e.children,eventHandler:s,elementPlugins:a,animations:o,animationBus:n,completionTracker:h,renderContext:l,signal:u}),zR({container:d}),$R({container:d}),XR({container:d})}};ot({animations:o,targetId:e.id,animationBus:n,completionTracker:h,element:d,targetState:{x:f,y:p,alpha:m},onComplete:()=>{x()}})||x()};var eM=({app:r,parent:t,element:e,animationBus:i,animations:s,eventHandler:o,completionTracker:n})=>{let a=t.getChildByLabel(e.id);if(!a)return;let l=()=>{a&&!a.destroyed&&(t.removeChild(a),a.destroy({children:!0}))};ot({animations:s,targetId:e.id,animationBus:i,completionTracker:n,element:a,targetState:null,onComplete:l})||l()};var rM=({state:r,parserPlugins:t=[]})=>{let e=r.direction??"",i=!!r.scroll,s=r.gap||0,o=structuredClone(r.children||[]),n=[],a=0,l=0,c=0,h=0,u=0,d=0,f=0,p=0,m=0,x=0;for(let g=0;g<o.length;g++){let w=g<o.length-1?s:0,b=o[g];g>0?e==="horizontal"?(b.x=c,b.y=f):e==="vertical"&&(b.x=p,b.y=h):(e==="horizontal"||e==="vertical")&&(b.x=0,b.y=0);let S=t.find(v=>v.type===b.type);if(S){let v=b.scaleX!==void 0||r.scaleX!==void 0,P=b.scaleY!==void 0||r.scaleY!==void 0,C=(b.scaleX??1)*(r.scaleX??1),A=(b.scaleY??1)*(r.scaleY??1);b=S.parse({state:{...b,...v?{scaleX:C}:{},...P?{scaleY:A}:{}},parserPlugins:t})}e==="horizontal"?(r.width&&b.width+m>r.width&&!i&&!r.anchorToBottom?(c=0,m=0,f+=u+s,u=b.height,b.x=0,b.y=f):u=Math.max(u,b.height),c+=b.width+w,m=b.x+b.width,a=Math.max(c,a),l=Math.max(b.height+b.y,l)):e==="vertical"?(r.height&&b.height+x>r.height&&!i&&!r.anchorToBottom?(h=0,x=0,p+=d+s,d=b.width,b.x=p,b.y=0):d=Math.max(d,b.width),h+=b.height+w,x=b.y+b.height,a=Math.max(b.width+b.x,a),l=Math.max(h,l)):(a=Math.max(b.width+b.x,a),l=Math.max(b.height+b.y,l)),n.push(b)}let T={...ge({...r,width:r.width?r.width:a,height:r.height?r.height:l}),children:n,direction:e,gap:s,scroll:i,...r.anchorToBottom&&{anchorToBottom:!0},...r.scrollbar&&{scrollbar:structuredClone(r.scrollbar)},rotation:r.rotation??0};return r.rightClick&&(T.rightClick=r.rightClick),T};var ZG=Zt({type:"container",add:JR,update:tM,delete:eM,parse:rM});var iM=async({parent:r,element:t,animationBus:e,renderContext:i,completionTracker:s,zIndex:o,signal:n})=>{if(n?.aborted)return;let a=new J;if(a.label=t.id,a.zIndex=o,t.x!==void 0&&(a.x=Math.round(t.x)),t.y!==void 0&&(a.y=Math.round(t.y)),t.alpha!==void 0&&(a.alpha=t.alpha),r.addChild(a),i?.suppressAnimations&&t.revealEffect!=="none"){await _i({container:a,element:t,completionTracker:s,animationBus:e,zIndex:o,signal:n,playback:"paused-initial"}),wd(i,{container:a,element:t,completionTracker:s,animationBus:e,zIndex:o,signal:n});return}await _i({container:a,element:t,completionTracker:s,animationBus:e,zIndex:o,signal:n,playback:"autoplay"})};var sM=(r={})=>JSON.stringify({content:r.content??null,revealEffect:r.revealEffect??"typewriter",speed:r.speed??50,width:r.width??null,indicator:r.indicator??null,x:r.x??null,y:r.y??null,alpha:r.alpha??1}),QG=(r,t)=>sM(r)!==sM(t),oM=async({parent:r,prevElement:t,nextElement:e,animations:i,animationBus:s,renderContext:o,completionTracker:n,zIndex:a,signal:l})=>{if(l?.aborted)return;let c=r.children.find(d=>d.label===t.id);if(!c)return;let h=async()=>{if(e.x!==void 0&&(c.x=e.x),e.y!==void 0&&(c.y=e.y),e.alpha!==void 0&&(c.alpha=e.alpha),!QG(t,e)){o?.suppressAnimations!==!0&&e.revealEffect!=="none"&&await _i({container:c,element:e,completionTracker:n,animationBus:s,zIndex:a,signal:l,playback:"resume"});return}if(o?.suppressAnimations===!0&&e.revealEffect!=="none"){await _i({container:c,element:e,completionTracker:n,animationBus:s,zIndex:a,signal:l,playback:"paused-initial"}),wd(o,{container:c,element:e,completionTracker:n,animationBus:s,zIndex:a,signal:l});return}await _i({container:c,element:e,completionTracker:n,animationBus:s,zIndex:a,signal:l,playback:"autoplay"})};ot({animations:i,targetId:t.id,animationBus:s,completionTracker:n,element:c,targetState:{x:e.x??c.x,y:e.y??c.y,alpha:e.alpha??c.alpha},onComplete:()=>{h()}})||await h()};var nM=({parent:r,element:t,animations:e,animationBus:i,completionTracker:s})=>{let o=r.getChildByLabel(t.id);if(!o||o.destroyed)return;let n=()=>{o&&!o.destroyed&&(ay(o),o.destroy({children:!0}))};ot({animations:e,targetId:t.id,animationBus:i,completionTracker:s,element:o,targetState:null,onComplete:n})||n()};var JG=r=>r===`
|
|
1148
|
+
`){s+=1,o=0;continue}o+=1}return{line:s,column:o}},Sy=({contentWidth:r,lineWidth:t,align:e})=>dG(r,t,e),_G=r=>new Cr({label:r,text:""}),bG=(r,t)=>{for(;r.textNodes.length<t;){let e=_G(`${r.element.id}-text-line-${r.textNodes.length}`);r.text.addChild(e),r.textNodes.push(e)}for(;r.textNodes.length>t;){let e=r.textNodes.pop();e?.removeFromParent(),e?.destroy()}},Dd=({contentWidth:r,lineWidth:t,align:e,scrollOffsetX:i})=>t>r?-i:Sy({contentWidth:r,lineWidth:t,align:e}),IR=({contentWidth:r,lineWidth:t,align:e})=>Sy({contentWidth:r,lineWidth:t,align:e}),Nd=({padding:r,contentWidth:t,lineWidth:e,align:i,scrollOffsetX:s})=>r.left+IR({contentWidth:t,lineWidth:e,align:i})-s,BR=r=>{let t=new Bt;t.label=`${r.id}-background`;let e=new Bt;e.label=`${r.id}-selection`;let i=new J;i.label=`${r.id}-text`;let s=new Cr({label:`${r.id}-placeholder`,text:r.placeholder}),o=new Bt;o.label=`${r.id}-caret`;let n=new Bt;return n.label=`${r.id}-clip`,i.mask=n,s.mask=n,e.mask=n,o.mask=n,{background:t,selection:e,text:i,placeholder:s,caret:o,clip:n}},FR=({app:r,container:t,display:e,element:i})=>({app:r,container:t,...e,value:xn(i.value??""),selectionStart:xn(i.value??"").length,selectionEnd:xn(i.value??"").length,focused:!1,nativeFocused:!1,composing:!1,blinkVisible:!0,blinkTick:0,scrollOffsetX:0,scrollOffsetY:0,selectionAnchor:null,draggingSelection:!1,textNodes:[],layoutState:null,lastExternalValue:xn(i.value??""),tickerListener:null,element:i}),Vd=(r,t,e)=>{let i=pG({app:r,container:t,fallbackElement:e});if(!i)return null;let{fullBounds:s,visibleBounds:o}=i,n=mG(s,o);return{x:s.x,y:s.y,width:s.width,height:s.height,visible:!!o&&t.visible!==!1&&t.renderable!==!1,clipInsets:n}},Qt=(r,t)=>{let e=Ty(t.padding),i=Math.max(0,t.width-e.left-e.right),s=Math.max(0,t.height-e.top-e.bottom),o=Hd(t.textStyle,{wordWrapWidth:i}),n=Hd({...t.textStyle,fill:"#7A7A7A"},{wordWrapWidth:i}),a=String(r.value??""),l=yG({element:t,displayedValue:a,textStyle:o}),c=o.align??"left",h=Zi(Math.min(r.selectionStart,r.selectionEnd),0,a.length),u=Zi(Math.max(r.selectionStart,r.selectionEnd),0,a.length),d=Zi(r.selectionEnd??a.length,0,a.length);if(r.layoutState={padding:e,contentWidth:i,contentHeight:s,textStyle:o,placeholderStyle:n,displayedValue:a,layout:l,align:c},bG(r,l.lines.length),r.textNodes.forEach((p,m)=>{let x=l.lines[m]??{text:"",width:0};Yr(p,o),p.text=x.text}),Yr(r.placeholder,n),r.placeholder.text=t.placeholder??"",t.multiline){let p=Ld({value:a,index:d}),m=l.lines[p.line]??l.lines.at(-1),x=m?.width??0,_=Ye((m?.text??"").slice(0,p.column),o),T=l.totalHeight,g=p.line*l.lineHeight,w=g+l.lineHeight;if(x<=i)r.scrollOffsetX=0;else if(r.focused){let S=Math.max(0,x-i);_-r.scrollOffsetX>i-8?r.scrollOffsetX=_-(i-8):_-r.scrollOffsetX<8&&(r.scrollOffsetX=_-8),r.scrollOffsetX=Zi(r.scrollOffsetX,0,S)}else r.scrollOffsetX=0;if(T<=s)r.scrollOffsetY=0;else if(r.focused){let b=Math.max(0,T-s);w-r.scrollOffsetY>s?r.scrollOffsetY=w-s:g-r.scrollOffsetY<0&&(r.scrollOffsetY=g),r.scrollOffsetY=Zi(r.scrollOffsetY,0,b)}else r.scrollOffsetY=0}else{let p=l.lines[0],m=Ye(p.text.slice(0,d),o);if(p.width<=i)r.scrollOffsetX=0;else if(r.focused){let _=Math.max(0,p.width-i);m-r.scrollOffsetX>i-8?r.scrollOffsetX=m-(i-8):m-r.scrollOffsetX<8&&(r.scrollOffsetX=m-8),r.scrollOffsetX=Zi(r.scrollOffsetX,0,_)}else r.scrollOffsetX=0;r.scrollOffsetY=0}if(t.multiline)r.text.x=e.left-r.scrollOffsetX,r.text.y=e.top-r.scrollOffsetY,r.textNodes.forEach((p,m)=>{let x=l.lines[m]??{width:0};p.x=IR({contentWidth:i,lineWidth:x.width,align:c}),p.y=m*l.lineHeight});else{let p=l.lines[0],m=r.textNodes[0],x=Dd({contentWidth:i,lineWidth:p.width,align:c,scrollOffsetX:r.scrollOffsetX});m.x=0,m.y=0,r.text.x=e.left+x,r.text.y=e.top+Math.max(0,(s-m.height)/2)}let f=kt.measureText(r.placeholder.text,MR(n));if(r.placeholder.x=e.left,r.placeholder.y=t.multiline?e.top:e.top+Math.max(0,(s-r.placeholder.height)/2),f.width<=i&&(r.placeholder.x+=Sy({contentWidth:i,lineWidth:f.width,align:c})),r.placeholder.visible=r.value.length===0&&r.composing!==!0,r.background.clear(),r.background.rect(0,0,t.width,t.height),r.background.fill({color:gn.fill,alpha:gn.fillAlpha}),gn.strokeWidth>0&&r.background.stroke({color:gn.strokeColor,alpha:gn.strokeAlpha,width:gn.strokeWidth}),r.focused&&Gd.strokeWidth>0&&t.disabled!==!0&&r.background.stroke({color:Gd.strokeColor,alpha:Gd.strokeAlpha,width:Gd.strokeWidth}),r.clip.clear(),r.clip.rect(e.left,e.top,i,Math.max(0,s)),r.clip.fill({color:16777215,alpha:1}),r.selection.clear(),r.focused&&h!==u&&t.disabled!==!0){if(t.multiline){let p=Ld({value:a,index:h}),m=Ld({value:a,index:u});for(let x=p.line;x<=m.line;x+=1){let _=l.lines[x];if(!_)continue;let T=x===p.line?p.column:0,g=x===m.line?m.column:_.text.length,w=Nd({padding:e,contentWidth:i,lineWidth:_.width,align:c,scrollOffsetX:r.scrollOffsetX})+Ye(_.text.slice(0,T),o),b=Nd({padding:e,contentWidth:i,lineWidth:_.width,align:c,scrollOffsetX:r.scrollOffsetX})+Ye(_.text.slice(0,g),o),S=e.top+x*l.lineHeight-r.scrollOffsetY;r.selection.rect(w,S,Math.max(b-w,1),l.lineHeight)}}else{let p=l.lines[0],m=Dd({contentWidth:i,lineWidth:p.width,align:c,scrollOffsetX:r.scrollOffsetX}),x=e.left+m+Ye(p.text.slice(0,h),o),_=e.left+m+Ye(p.text.slice(0,u),o),T=e.top+Math.max(0,(s-r.text.height)/2);r.selection.rect(x,T,Math.max(_-x,1),Math.max(r.text.height,o.lineHeight))}r.selection.fill({color:PR.fill,alpha:PR.alpha})}if(r.caret.clear(),r.focused&&r.selectionStart===r.selectionEnd&&r.blinkVisible!==!1&&t.disabled!==!0){if(t.multiline){let p=Ld({value:a,index:d}),m=l.lines[p.line]??l.lines.at(-1),x=Nd({padding:e,contentWidth:i,lineWidth:m?.width??0,align:c,scrollOffsetX:r.scrollOffsetX})+Ye((m?.text??"").slice(0,p.column),o),_=e.top+p.line*l.lineHeight-r.scrollOffsetY;r.caret.rect(x,_,vy.width,l.lineHeight)}else{let p=l.lines[0],m=Dd({contentWidth:i,lineWidth:p.width,align:c,scrollOffsetX:r.scrollOffsetX}),x=e.left+m+Ye(p.text.slice(0,d),o),_=e.top+Math.max(0,(s-r.text.height)/2);r.caret.rect(x,_,vy.width,Math.max(r.text.height,o.lineHeight))}r.caret.fill({color:vy.fill,alpha:1})}},wy=(r,t)=>{let e=r.layoutState;if(!e)return 0;let{padding:i,contentWidth:s,textStyle:o,displayedValue:n,layout:a,align:l}=e,c=t?.x??0,h=t?.y??0;if(!r.element.multiline){let m=a.lines[0]??{text:n,width:Ye(n,o)},x=Dd({contentWidth:s,lineWidth:m.width,align:l,scrollOffsetX:r.scrollOffsetX}),_=i.left+x;return CR({text:m.text,style:o,targetX:c-_})}let u=a.lineHeight||o.lineHeight||1,d=Zi(Math.floor((h-i.top+r.scrollOffsetY)/u),0,Math.max(a.lines.length-1,0)),f=a.lines[d]??{text:"",startIndex:0},p=CR({text:f.text,style:o,targetX:c-Nd({padding:i,contentWidth:s,lineWidth:f.width??0,align:l,scrollOffsetX:r.scrollOffsetX})});return f.startIndex+p};var Qi=({eventHandler:r,eventName:t,element:e,eventConfig:i,snapshot:s})=>{!r||!i||r(t,{_event:{id:e.id,value:s.value,selectionStart:s.selectionStart,selectionEnd:s.selectionEnd,composing:s.composing},...i.payload??{}})},vG=({app:r,container:t,element:e,runtime:i,eventHandler:s})=>({onValueChange:o=>{i.value=o.value,i.selectionStart=o.selectionStart,i.selectionEnd=o.selectionEnd,i.lastExternalValue=o.value,Qt(i,e),Qi({eventHandler:s,eventName:"change",element:e,eventConfig:e.change,snapshot:o})},onFocus:o=>{let n=i.nativeFocused===!0;i.nativeFocused=!0,i.focused=!0,i.selectionStart=o.selectionStart,i.selectionEnd=o.selectionEnd,i.selectionAnchor=o.selectionStart===o.selectionEnd?o.selectionEnd:i.selectionAnchor,i.blinkVisible=!0,i.blinkTick=0,Qt(i,e),!n&&Qi({eventHandler:s,eventName:"focus",element:e,eventConfig:e.focusEvent,snapshot:o})},onBlur:o=>{i.nativeFocused=!1,i.focused=!1,i.selectionStart=o.selectionStart,i.selectionEnd=o.selectionEnd,i.blinkVisible=!1,i.composing=!1,Qt(i,e),Qi({eventHandler:s,eventName:"blur",element:e,eventConfig:e.blurEvent,snapshot:o})},onSelectionChange:o=>{i.nativeFocused=o.focused,i.focused=o.focused,i.selectionStart=o.selectionStart,i.selectionEnd=o.selectionEnd,o.selectionStart===o.selectionEnd&&(i.selectionAnchor=o.selectionEnd),Qt(i,e),Qi({eventHandler:s,eventName:"selectionChange",element:e,eventConfig:e.selectionChange,snapshot:o})},onSubmit:o=>{Qi({eventHandler:s,eventName:"submit",element:e,eventConfig:e.submit,snapshot:o})},onCompositionStart:o=>{i.composing=!0,Qt(i,e),Qi({eventHandler:s,eventName:"compositionStart",element:e,eventConfig:e.compositionStart,snapshot:o})},onCompositionUpdate:o=>{i.composing=!0,i.selectionStart=o.selectionStart,i.selectionEnd=o.selectionEnd,Qt(i,e),Qi({eventHandler:s,eventName:"compositionUpdate",element:e,eventConfig:e.compositionUpdate,snapshot:o})},onCompositionEnd:o=>{i.composing=!1,i.value=o.value,i.selectionStart=o.selectionStart,i.selectionEnd=o.selectionEnd,Qt(i,e),Qi({eventHandler:s,eventName:"compositionEnd",element:e,eventConfig:e.compositionEnd,snapshot:o})}}),kR=({app:r,parent:t,element:e,eventHandler:i,zIndex:s})=>{if(!r.inputDomBridge?.mount||!r.inputDomBridge?.focus||!r.inputDomBridge?.setSelection)throw new Error("Input plugin requires app.inputDomBridge to be initialized");let o=new J({label:e.id});o.zIndex=s,o.sortableChildren=!0,o.eventMode="static",o.cursor=e.disabled?"default":"text",o.x=Math.round(e.x),o.y=Math.round(e.y),o.alpha=e.alpha;let n=BR(e),a=FR({app:r,container:o,display:n,element:e});o.addChild(a.background,a.selection,a.text,a.placeholder,a.caret,a.clip),a.tickerListener=f=>{if(!a.focused){if(a.blinkVisible===!1)return;a.blinkVisible=!1,Qt(a,a.element);return}a.blinkTick+=f.deltaMS??f.deltaTime??16,a.blinkTick>=530&&(a.blinkTick=0,a.blinkVisible=!a.blinkVisible,Qt(a,a.element))},r.ticker?.add?.(a.tickerListener);let l=({start:f,end:p,shouldFocus:m=!1})=>{if(m){r.inputDomBridge.focus(e.id,{selectionStart:f,selectionEnd:p});return}r.inputDomBridge.setSelection(e.id,f,p)},c=({start:f,end:p,shouldFocus:m=!1,anchor:x=a.selectionAnchor})=>{a.focused=!0,a.selectionStart=f,a.selectionEnd=p,a.selectionAnchor=x,a.blinkVisible=!0,a.blinkTick=0,Qt(a,a.element),l({start:f,end:p,shouldFocus:m})},h=f=>{if(a.element.disabled===!0)return;let p=o.toLocal(f.global),m=wy(a,p),x=!!f.shiftKey&&a.focused,_=x?a.selectionAnchor??(a.selectionStart!==a.selectionEnd?a.selectionStart:a.selectionEnd):m,T=x?Math.min(_,m):m,g=x?Math.max(_,m):m;a.draggingSelection=!0,c({start:T,end:g,shouldFocus:!0,anchor:_})},u=f=>{if(!a.draggingSelection||a.element.disabled===!0)return;let p=o.toLocal(f.global),m=wy(a,p),x=a.selectionAnchor??m,_=Math.min(x,m),T=Math.max(x,m);c({start:_,end:T,anchor:x})},d=()=>{a.draggingSelection=!1};o.on("pointerdown",h),o.on("globalpointermove",u),o.on("pointerup",d),o.on("pointerupoutside",d),o.on("pointerup",()=>{a.element.disabled!==!0&&r.inputDomBridge.focus(e.id,{selectionStart:a.selectionStart,selectionEnd:a.selectionEnd})}),o[yn]=a,Qt(a,e),r.inputDomBridge.mount(e.id,{...e,value:a.value,callbacks:vG({app:r,container:o,element:e,runtime:a,eventHandler:i}),getGeometry:()=>Vd(r,o,e)}),t.addChild(o)};var Ji=({eventHandler:r,eventName:t,element:e,eventConfig:i,snapshot:s})=>{!r||!i||r(t,{_event:{id:e.id,value:s.value,selectionStart:s.selectionStart,selectionEnd:s.selectionEnd,composing:s.composing},...i.payload??{}})},TG=({element:r,runtime:t,eventHandler:e})=>({onValueChange:i=>{t.value=i.value,t.selectionStart=i.selectionStart,t.selectionEnd=i.selectionEnd,t.lastExternalValue=i.value,Qt(t,r),Ji({eventHandler:e,eventName:"change",element:r,eventConfig:r.change,snapshot:i})},onFocus:i=>{let s=t.nativeFocused===!0;t.nativeFocused=!0,t.focused=!0,t.selectionStart=i.selectionStart,t.selectionEnd=i.selectionEnd,t.selectionAnchor=i.selectionStart===i.selectionEnd?i.selectionEnd:t.selectionAnchor,t.blinkVisible=!0,t.blinkTick=0,Qt(t,r),!s&&Ji({eventHandler:e,eventName:"focus",element:r,eventConfig:r.focusEvent,snapshot:i})},onBlur:i=>{t.nativeFocused=!1,t.focused=!1,t.selectionStart=i.selectionStart,t.selectionEnd=i.selectionEnd,t.blinkVisible=!1,t.composing=!1,Qt(t,r),Ji({eventHandler:e,eventName:"blur",element:r,eventConfig:r.blurEvent,snapshot:i})},onSelectionChange:i=>{t.nativeFocused=i.focused,t.focused=i.focused,t.selectionStart=i.selectionStart,t.selectionEnd=i.selectionEnd,i.selectionStart===i.selectionEnd&&(t.selectionAnchor=i.selectionEnd),Qt(t,r),Ji({eventHandler:e,eventName:"selectionChange",element:r,eventConfig:r.selectionChange,snapshot:i})},onSubmit:i=>{Ji({eventHandler:e,eventName:"submit",element:r,eventConfig:r.submit,snapshot:i})},onCompositionStart:i=>{t.composing=!0,Qt(t,r),Ji({eventHandler:e,eventName:"compositionStart",element:r,eventConfig:r.compositionStart,snapshot:i})},onCompositionUpdate:i=>{t.composing=!0,t.selectionStart=i.selectionStart,t.selectionEnd=i.selectionEnd,Qt(t,r),Ji({eventHandler:e,eventName:"compositionUpdate",element:r,eventConfig:r.compositionUpdate,snapshot:i})},onCompositionEnd:i=>{t.composing=!1,t.value=i.value,t.selectionStart=i.selectionStart,t.selectionEnd=i.selectionEnd,Qt(t,r),Ji({eventHandler:e,eventName:"compositionEnd",element:r,eventConfig:r.compositionEnd,snapshot:i})}}),OR=({app:r,parent:t,prevElement:e,nextElement:i,eventHandler:s,zIndex:o})=>{let n=t.children.find(h=>h.label===e.id);if(!n)return;if(!r.inputDomBridge?.update)throw new Error("Input plugin requires app.inputDomBridge to be initialized");n.zIndex=o;let a=n[yn];if(!a)return;let l={...i},c=a.focused!==!0||i.value!==e.value;c&&a.composing!==!0?(a.value=i.value,a.lastExternalValue=i.value):l.value=a.value,a.element=l,n.label=i.id,n.cursor=i.disabled?"default":"text",n.x=Math.round(i.x),n.y=Math.round(i.y),n.alpha=i.alpha,i.disabled===!0&&(a.draggingSelection=!1),(!gt(e,i)||c)&&Qt(a,l),r.inputDomBridge.update(i.id,{...l,value:a.value,callbacks:TG({element:l,runtime:a,eventHandler:s}),getGeometry:()=>Vd(r,n,l)})};var UR=({app:r,parent:t,element:e})=>{let i=t.getChildByLabel(e.id);if(!i)return;if(!r.inputDomBridge?.unmount)throw new Error("Input plugin requires app.inputDomBridge to be initialized");let s=i[yn];s?.tickerListener&&r.ticker?.remove?.(s.tickerListener),r.inputDomBridge.unmount(e.id),i.destroy({children:!0})};var GR=({state:r})=>{let t=ge(r),e=String(r.value??""),i=String(r.placeholder??"");return delete t.originX,delete t.originY,{...t,value:e,placeholder:i,multiline:r.multiline===!0,disabled:r.disabled===!0,...typeof r.maxLength=="number"&&{maxLength:Math.round(r.maxLength)},textStyle:Hd(r.textStyle),padding:Ty(r.padding),...r.change&&{change:r.change},...r.submit&&{submit:r.submit},...r.focusEvent&&{focusEvent:r.focusEvent},...r.blurEvent&&{blurEvent:r.blurEvent},...r.selectionChange&&{selectionChange:r.selectionChange},...r.compositionStart&&{compositionStart:r.compositionStart},...r.compositionUpdate&&{compositionUpdate:r.compositionUpdate},...r.compositionEnd&&{compositionEnd:r.compositionEnd}}};var SG=Zt({type:"input",add:kR,update:OR,delete:UR,parse:GR});var wG=24,EG=24,ks=(r,t,e)=>Math.min(e,Math.max(t,r)),NR=r=>ks(r,0,1),_n=r=>{r?.stopPropagation?.()},AG=r=>r?B.from(r):B.EMPTY,Wd=({label:r})=>{let t=new Tt(B.EMPTY);return t.label=r,t.eventMode="static",t.cursor="pointer",t},PG=({config:r,state:t})=>r?t?.pressed&&r.pressSrc?r.pressSrc:t?.hovered&&r.hoverSrc?r.hoverSrc:r.src??"":"",zd=({sprite:r,config:t,state:e,width:i,height:s})=>{r&&(r.texture=AG(PG({config:t,state:e})),r.width=Math.max(i,0),r.height=Math.max(s,0),r.visible=r.width>0&&r.height>0,r.eventMode=r.visible?"static":"none")},CG=r=>({root:`${r}-scrollbar-vertical`,track:`${r}-scrollbar-vertical-track`,thumb:`${r}-scrollbar-vertical-thumb`,startButton:`${r}-scrollbar-vertical-start-button`,endButton:`${r}-scrollbar-vertical-end-button`}),LR=(r,t)=>Math.abs(r-t)<.5,DR=({hasOverflow:r,minScroll:t,previousOffset:e,wasAtEnd:i,anchorToEnd:s})=>r?s&&(e===void 0||i)?t:typeof e=="number"?ks(e,t,0):0:0,RG=({controller:r})=>{let t=CG(r.container.label),e=r.element.scrollbar?.vertical;if(!e)return null;let i=new J({label:t.root});i.eventMode="static",i.cursor="pointer";let s=Wd({label:t.track}),o=Wd({label:t.thumb}),n={config:e,root:i,track:s,thumb:o,startButton:null,endButton:null,states:{track:{hovered:!1,pressed:!1},thumb:{hovered:!1,pressed:!1,dragging:!1},startButton:{hovered:!1,pressed:!1},endButton:{hovered:!1,pressed:!1}},dragOffsetY:0};i.addChild(s),i.addChild(o),e.startButton&&(n.startButton=Wd({label:t.startButton}),i.addChild(n.startButton)),e.endButton&&(n.endButton=Wd({label:t.endButton}),i.addChild(n.endButton));let a=()=>{HR({controller:r})};s.on("pointerover",()=>{n.states.track.hovered=!0,a()}),s.on("pointerout",()=>{n.states.track.hovered=!1,a()}),s.on("pointerdown",u=>{_n(u),n.states.track.pressed=!0,a();let d=i.toLocal(u.global),{thumb:f}=n,p=r.viewportHeight;d.y<f.y?r.setScrollOffsets({y:r.scrollYOffset+p,source:"track"}):d.y>f.y+f.height&&r.setScrollOffsets({y:r.scrollYOffset-p,source:"track"})});let l=u=>{_n(u),n.states.track.pressed=!1,a()};s.on("pointerup",l),s.on("pointerupoutside",l),o.on("pointerover",()=>{n.states.thumb.hovered=!0,a()}),o.on("pointerout",()=>{n.states.thumb.hovered=!1,n.states.thumb.dragging||a()}),o.on("pointerdown",u=>{_n(u);let d=i.toLocal(u.global);n.states.thumb.pressed=!0,n.states.thumb.dragging=!0,n.dragOffsetY=d.y-n.thumb.y,a()});let c=u=>{if(_n(u),!n.states.thumb.dragging){n.states.thumb.pressed=!1,a();return}n.states.thumb.dragging=!1,n.states.thumb.pressed=!1,a()};i.on("globalpointermove",u=>{if(!n.states.thumb.dragging)return;let d=i.toLocal(u.global),f=n.track.y,p=Math.max(n.track.height-n.thumb.height,0);if(p<=0||r.minScrollY===0){r.setScrollOffsets({y:0,source:"thumb"});return}let m=ks(d.y-n.dragOffsetY,f,f+p),x=NR((m-f)/p);r.setScrollOffsets({y:r.minScrollY*x,source:"thumb"})}),o.on("pointerup",c),o.on("pointerupoutside",c),i.on("pointerup",c),i.on("pointerupoutside",c);let h=({sprite:u,config:d,state:f,deltaDirection:p})=>{if(!u||!d)return;u.on("pointerover",()=>{f.hovered=!0,a()}),u.on("pointerout",()=>{f.hovered=!1,a()}),u.on("pointerdown",x=>{_n(x),f.pressed=!0,a(),r.setScrollOffsets({y:r.scrollYOffset+p*Math.max(d.step??wG,0),source:"button"})});let m=x=>{_n(x),f.pressed=!1,a()};u.on("pointerup",m),u.on("pointerupoutside",m)};return h({sprite:n.startButton,config:e.startButton,state:n.states.startButton,deltaDirection:1}),h({sprite:n.endButton,config:e.endButton,state:n.states.endButton,deltaDirection:-1}),r.container.addChild(i),n},HR=({controller:r})=>{let t=r.verticalScrollbar;if(!t)return;let{config:e,root:i,track:s,thumb:o,startButton:n,endButton:a,states:l}=t,c=Math.max(e.thickness??0,0),h=n?Math.max(e.startButton?.size??c,0):0,u=a?Math.max(e.endButton?.size??c,0):0,d=Math.max(r.viewportHeight-h-u,0),f=Math.min(EG,d),p=e.thumb?.length,m=typeof p=="number"?p:r.totalHeight>0?Math.round(r.viewportHeight/r.totalHeight*d):d,x=d>0?typeof p=="number"?ks(m,0,d):ks(m,f,d):0,_=Math.max(d-x,0),T=r.minScrollY===0?0:NR(r.scrollYOffset/r.minScrollY);i.visible=r.hasVerticalOverflow&&r.element.scroll&&c>0&&r.viewportHeight>0,i.x=Math.max(r.viewportWidth-c,0),i.y=0,s.x=0,s.y=h,zd({sprite:s,config:e.track,state:l.track,width:c,height:d}),o.x=0,o.y=h+_*T,zd({sprite:o,config:e.thumb,state:l.thumb,width:c,height:x}),n&&(n.x=0,n.y=0,zd({sprite:n,config:e.startButton,state:l.startButton,width:c,height:h})),a&&(a.x=0,a.y=r.viewportHeight-u,zd({sprite:a,config:e.endButton,state:l.endButton,width:c,height:u}))},VR=({container:r})=>{let t=r.__routeGraphicsScrollController;return t?{scrollXOffset:t.scrollXOffset,scrollYOffset:t.scrollYOffset,wasAtHorizontalEnd:t.hasHorizontalOverflow&&LR(t.scrollXOffset,t.minScrollX),wasAtVerticalEnd:t.hasVerticalOverflow&&LR(t.scrollYOffset,t.minScrollY)}:null},ec=({container:r,element:t,interactive:e=!0,allowViewportWithoutScroll:i=!1,previousState:s=null})=>{let o=0,n=0;t.children.forEach(h=>{o=Math.max(h.width+h.x,o),n=Math.max(h.height+h.y,n)});let a=!!(t.height&&n>t.height),l=!!(t.width&&o>t.width);if((t.scroll||i)&&(a||l)){let h=new J({label:`${r.label}-content`});[...r.children].forEach(x=>{h.addChild(x)}),r.addChild(h);let d=new Bt({label:`${r.label}-clip`}).rect(0,0,t.width||o,t.height||n).fill({color:16711680,alpha:0});r.addChild(d),h.mask=d;let f=-(n-(t.height||n)),p=-(o-(t.width||o)),m={container:r,contentContainer:h,clip:d,element:t,totalWidth:o,totalHeight:n,viewportWidth:t.width||o,viewportHeight:t.height||n,hasHorizontalOverflow:l,hasVerticalOverflow:a,minScrollX:p,minScrollY:f,scrollXOffset:DR({hasOverflow:l,minScroll:p,previousOffset:s?.scrollXOffset,wasAtEnd:s?.wasAtHorizontalEnd,anchorToEnd:!!t.anchorToBottom}),scrollYOffset:DR({hasOverflow:a,minScroll:f,previousOffset:s?.scrollYOffset,wasAtEnd:s?.wasAtVerticalEnd,anchorToEnd:!!t.anchorToBottom}),verticalScrollbar:null,setScrollOffsets:({x,y:_})=>{let T=x??m.scrollXOffset,g=_??m.scrollYOffset;m.scrollXOffset=m.hasHorizontalOverflow?ks(T,m.minScrollX,0):0,m.scrollYOffset=m.hasVerticalOverflow?ks(g,m.minScrollY,0):0,m.contentContainer.x=m.scrollXOffset,m.contentContainer.y=m.scrollYOffset,HR({controller:m})}};r.__routeGraphicsScrollController=m,m.verticalScrollbar=RG({controller:m}),m.setScrollOffsets({x:m.scrollXOffset,y:m.scrollYOffset,source:"initial"}),e&&(r.eventMode="static",r.hitArea=new Q(0,0,t.width||o,t.height||n),r.on("wheel",x=>{if(x.preventDefault(),a&&x.deltaY!==0&&m.setScrollOffsets({y:m.scrollYOffset-x.deltaY,source:"wheel"}),l&&(x.deltaX!==0||x.shiftKey&&x.deltaY!==0)){let _=x.deltaX!==0?x.deltaX:x.deltaY;m.setScrollOffsets({x:m.scrollXOffset-_,source:"wheel"})}}))}},Ey=({container:r})=>{let t=r.__routeGraphicsScrollController,e=r.children.find(o=>o.label&&o.label.endsWith("-content")),i=r.children.find(o=>o.label&&o.label.endsWith("-clip")),s=r.children.find(o=>o.label&&o.label.endsWith("-scrollbar-vertical"));e&&([...e.children].forEach(n=>{n.mask=null,r.addChild(n)}),r.removeChild(e),e.destroy({children:!1})),i&&(r.removeChild(i),i.destroy()),s&&(r.removeChild(s),s.destroy({children:!0})),r.eventMode="auto",r.hitArea=null,r.removeAllListeners("wheel"),t&&(r.__routeGraphicsScrollController=void 0)};var Ay=({container:r,element:t,enabled:e})=>{let i=Number.isFinite(t?.width)?t.width:0,s=Number.isFinite(t?.height)?t.height:0;if(e&&i>0&&s>0){r.hitArea=new Q(0,0,i,s);return}r.hitArea=null},WR=(r,t)=>{let e=t??null;for(;e;){if(e===r)return!0;e=e.parent??null}return!1},Os=(r,t)=>{let e=t??null;for(;e;){if(e===r)return!1;if(typeof e.label=="string"&&e.label.startsWith(`${r.label}-scrollbar-`))return!0;e=e.parent??null}return!1},MG=(r,t)=>{if(!t||typeof t.x!="number"||typeof t.y!="number")return!1;let e=r.toLocal(t),i=r.hitArea;return i?.contains?i.contains(e.x,e.y):!1},$d=({app:r,container:t,element:e,eventHandler:i})=>{let s=my(t),o=gy(t),n=xy(t),a=s;fn({root:t,isHovered:!1}),Bs({root:t,isPressed:!1}),bi({root:t,isPressed:!1}),t.removeAllListeners("pointerover"),t.removeAllListeners("pointerout"),t.removeAllListeners("pointerdown"),t.removeAllListeners("pointerup"),t.removeAllListeners("pointerupoutside"),t.removeAllListeners("rightdown"),t.removeAllListeners("rightup"),t.removeAllListeners("rightupoutside"),t.removeAllListeners("rightclick"),t.cursor="auto",e.scroll||(t.eventMode="auto",Ay({container:t,element:e,enabled:!1}));let l=e?.hover,c=e?.click,h=e?.rightClick;if(!!(l||c||h)&&(t.eventMode="static",e.scroll?t.hitArea||Ay({container:t,element:e,enabled:!0}):Ay({container:t,element:e,enabled:!0})),l){let{cursor:d,soundSrc:f,payload:p,inheritToChildren:m}=l,x=T=>{WR(t,T?.relatedTarget)||a||(a=!0,p&&i&&i("hover",{_event:{id:t.label},...p}),d&&(t.cursor=d),f&&r.audioStage.add({id:`hover-${Date.now()}`,url:f,loop:!1}),m&&fn({root:t,isHovered:!0}))},_=T=>{WR(t,T?.relatedTarget)||MG(t,T?.global)||a&&(a=!1,t.cursor="auto",m&&fn({root:t,isHovered:!1}))};t.on("pointerover",x),t.on("pointerout",_)}if(c){let{soundSrc:d,soundVolume:f,payload:p,inheritToChildren:m}=c,x=g=>{ie(g)&&(Os(t,g?.target)||m&&Bs({root:t,isPressed:!0}))},_=g=>{ie(g)&&(Os(t,g?.target)||(m&&Bs({root:t,isPressed:!1}),p&&i&&i("click",{_event:{id:t.label},...p}),d&&r.audioStage.add({id:`click-${Date.now()}`,url:d,loop:!1,volume:(f??1e3)/1e3})))},T=g=>{ie(g)&&(Os(t,g?.target)||m&&Bs({root:t,isPressed:!1}))};t.on("pointerdown",x),t.on("pointerup",_),t.on("pointerupoutside",T)}if(h){let{soundSrc:d,payload:f,inheritToChildren:p}=h,m=w=>{Os(t,w?.target)||p&&bi({root:t,isPressed:!0})},x=w=>{Os(t,w?.target)||p&&bi({root:t,isPressed:!1})},_=w=>{KC(w)&&(Os(t,w?.target)||p&&bi({root:t,isPressed:!1}))},T=w=>{Os(t,w?.target)||(p&&bi({root:t,isPressed:!1}),f&&i&&i("rightClick",{_event:{id:t.label},...f}),d&&r.audioStage.add({id:`rightClick-${Date.now()}`,url:d,loop:!1}))},g=()=>{p&&bi({root:t,isPressed:!1})};t.on("rightdown",m),t.on("rightup",x),t.on("pointerup",_),t.on("rightclick",T),t.on("pointerupoutside",_),t.on("rightupoutside",g)}l?.inheritToChildren&&s&&fn({root:t,isHovered:!0}),c?.inheritToChildren&&o&&Bs({root:t,isPressed:!0}),h?.inheritToChildren&&n&&bi({root:t,isPressed:!0})},zR=({container:r})=>{my(r)&&fn({root:r,isHovered:!0})},$R=({container:r})=>{gy(r)&&Bs({root:r,isPressed:!0})},XR=({container:r})=>{xy(r)&&bi({root:r,isPressed:!0})};var rc=r=>{let t=new Set;if(r.id&&t.add(r.id),r.children&&Array.isArray(r.children))for(let e of r.children)for(let i of rc(e))t.add(i);return t};var jR=(r,t,e=[])=>{let i=new Set,s=new Map,o=new Map,n=[],a=[],l=[];for(let c of r)i.add(c.id),s.set(c.id,c);for(let c of t)i.add(c.id),o.set(c.id,c);for(let c of i){let h=s.get(c),u=o.get(c);if(!h&&u)n.push(u);else if(h&&!u)a.push(h);else{let d=rc(u),f=e instanceof Map?Array.from(e.keys()).some(p=>d.has(p)):e.find(p=>d.has(p.targetId));(!gt(h,u)||f)&&l.push({prev:h,next:u})}}return{toAddElement:n,toDeleteElement:a,toUpdateElement:l}};var Xd=r=>r<.36363636363636365?7.5625*r*r:r<.7272727272727273?7.5625*(r-=.5454545454545454)*r+.75:r<.9090909090909091?7.5625*(r-=.8181818181818182)*r+.9375:7.5625*(r-=.9545454545454546)*r+.984375,IG=r=>r,BG=r=>r*r,FG=r=>1-(1-r)*(1-r),kG=r=>r<.5?2*r*r:1-Math.pow(-2*r+2,2)/2,YR=Object.freeze({linear:IG,easeInQuad:BG,easeOutQuad:FG,easeInOutQuad:kG,easeInCubic:r=>r*r*r,easeOutCubic:r=>1-Math.pow(1-r,3),easeInOutCubic:r=>r<.5?4*r*r*r:1-Math.pow(-2*r+2,3)/2,easeInQuart:r=>r*r*r*r,easeOutQuart:r=>1-Math.pow(1-r,4),easeInOutQuart:r=>r<.5?8*r*r*r*r:1-Math.pow(-2*r+2,4)/2,easeInQuint:r=>r*r*r*r*r,easeOutQuint:r=>1-Math.pow(1-r,5),easeInOutQuint:r=>r<.5?16*r*r*r*r*r:1-Math.pow(-2*r+2,5)/2,easeInSine:r=>1-Math.cos(r*Math.PI/2),easeOutSine:r=>Math.sin(r*Math.PI/2),easeInOutSine:r=>-(Math.cos(Math.PI*r)-1)/2,easeInExpo:r=>r===0?0:Math.pow(2,10*r-10),easeOutExpo:r=>r===1?1:1-Math.pow(2,-10*r),easeInOutExpo:r=>r===0?0:r===1?1:r<.5?Math.pow(2,20*r-10)/2:(2-Math.pow(2,-20*r+10))/2,easeInCirc:r=>1-Math.sqrt(1-Math.pow(r,2)),easeOutCirc:r=>Math.sqrt(1-Math.pow(r-1,2)),easeInOutCirc:r=>r<.5?(1-Math.sqrt(1-Math.pow(2*r,2)))/2:(Math.sqrt(1-Math.pow(-2*r+2,2))+1)/2,easeInBack:r=>2.70158*r*r*r-1.70158*r*r,easeOutBack:r=>1+2.70158*Math.pow(r-1,3)+1.70158*Math.pow(r-1,2),easeInOutBack:r=>{let e=2.5949095;return r<.5?Math.pow(2*r,2)*((e+1)*2*r-e)/2:(Math.pow(2*r-2,2)*((e+1)*(r*2-2)+e)+2)/2},easeInBounce:r=>1-Xd(1-r),easeOutBounce:Xd,easeInOutBounce:r=>r<.5?(1-Xd(1-2*r))/2:(1+Xd(2*r-1))/2,easeInElastic:r=>{let t=2*Math.PI/3;return r===0?0:r===1?1:-Math.pow(2,10*r-10)*Math.sin((r*10-10.75)*t)},easeOutElastic:r=>{let t=2*Math.PI/3;return r===0?0:r===1?1:Math.pow(2,-10*r)*Math.sin((r*10-.75)*t)+1},easeInOutElastic:r=>{let t=2*Math.PI/4.5;return r===0?0:r===1?1:r<.5?-(Math.pow(2,20*r-10)*Math.sin((20*r-11.125)*t))/2:Math.pow(2,-20*r+10)*Math.sin((20*r-11.125)*t)/2+1}}),jd=Object.freeze(Object.keys(YR)),OG=(r="linear")=>{let t=YR[r];if(!t)throw new Error(`Unsupported easing: ${r}`);return t},bn=r=>{let t=[],e=0,i;return r.forEach(({value:s,duration:o,easing:n="linear",relative:a},l)=>{if(l===0){i=s,t.push({time:e,value:s,easing:"linear"});return}o!==void 0&&(e+=o,i=a?i+s:s,t.push({time:e,value:i,easing:n}))}),t},ic=r=>{let t=0;for(let{timeline:e}of r){let i=e[e.length-1];i&&i.time>t&&(t=i.time)}return t},sc=(r,t)=>{if(r.length===0)return 0;if(t<=r[0].time)return r[0].value;if(t>=r[r.length-1].time)return r[r.length-1].value;for(let e=0;e<r.length-1;e++){let{time:i,value:s,easing:o}=r[e],{time:n,value:a}=r[e+1];if(t>=i&&t<=n){let l=(t-i)/(n-i);return s+(a-s)*OG(o)(l)}}return r[r.length-1].value};var UG={translateX:0,translateY:0,alpha:1,scaleX:1,scaleY:1,rotation:0},Cy=r=>Math.min(1,Math.max(0,r)),Yd=(r,t,e)=>{if(r===t)return e<r?0:1;let i=Cy((e-r)/(t-r));return i*i*(3-2*i)},ZR=r=>r.getLocalBounds().rectangle.clone(),QR=r=>(r.width=Math.max(1,Math.ceil(r.width)),r.height=Math.max(1,Math.ceil(r.height)),r),qR=(r,t)=>{let e=QR(ZR(t)),i=r.renderer.generateTexture({target:t,frame:e}),s=new Tt(i);s.x=e.x,s.y=e.y;let o=new J;return o.x=t.x??0,o.y=t.y??0,o.scale.set(t.scale?.x??1,t.scale?.y??1),o.rotation=t.rotation??0,o.alpha=t.alpha??1,o.addChild(s),{wrapper:o,texture:i}},GG=(r={})=>Object.entries(r).map(([t,e])=>({property:t,timeline:bn([{value:e.initialValue??UG[t]??0},...e.keyframes])})),qd=(r,t,e)=>{if(!r||!t)return{duration:0,apply:()=>{}};let i=GG(t),s={x:r.x,y:r.y,alpha:r.alpha,scaleX:r.scale.x,scaleY:r.scale.y,rotation:r.rotation};return{duration:ic(i),apply:o=>{r.x=s.x,r.y=s.y,r.alpha=s.alpha,r.scale.x=s.scaleX,r.scale.y=s.scaleY,r.rotation=s.rotation;for(let{property:n,timeline:a}of i){let l=sc(a,o);switch(n){case"translateX":r.x=s.x+l*e.renderer.width;break;case"translateY":r.y=s.y+l*e.renderer.height;break;case"alpha":r.alpha=s.alpha*l;break;case"scaleX":r.scale.x=s.scaleX*l;break;case"scaleY":r.scale.y=s.scaleY*l;break;case"rotation":r.rotation=s.rotation+l;break}}}}},LG=r=>bn([{value:r?.progress?.initialValue??0},...r?.progress?.keyframes??[]]),DG=(r,t)=>{let e=document.createElement("canvas");e.width=r,e.height=t;let i=e.getContext("2d",{willReadFrequently:!0});if(!i)throw new Error("Replace mask composition could not create a 2D canvas.");return{canvas:e,context:i}},NG=(r,t,e="red")=>{switch(e){case"green":return r[t+1];case"blue":return r[t+2];case"alpha":return r[t+3];default:return r[t]}},Py=({app:r,texture:t,width:e,height:i,channel:s="red",invert:o=!1})=>{let n=new Uint8ClampedArray(e*i),a=new Tt(B.from(t));a.width=e,a.height=i;let l=new J;l.addChild(a);let c=gi.create({width:e,height:i});r.renderer.render({container:l,target:c,clear:!0});let h=r.renderer.extract.pixels(c).pixels;for(let u=0,d=0;u<n.length;u++,d+=4){let f=NG(h,d,s);o&&(f=255-f),n[u]=f}return l.destroy({children:!0}),c.destroy(!0),n},HG=(r,t,e,i)=>{let s=null;for(let o of t.items){let n=Py({app:r,texture:o.texture,width:e,height:i,channel:o.channel??"red",invert:o.invert??!1});if(!s){s=n;continue}for(let a=0;a<s.length;a++)switch(t.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(e*i)},VG=(r,t,e,i)=>{let s=LG(t),o=ic([{timeline:s}]),n=Math.max(t?.softness??.001,1e-4);if(!t)return{duration:o,progressTimeline:s,sample:()=>0,destroy:()=>{}};if(t.kind==="single"){let l=Py({app:r,texture:t.texture,width:e,height:i,channel:t.channel??"red",invert:t.invert??!1});return{duration:o,progressTimeline:s,sample:(c,h)=>Yd(c-n,c+n,l[h]/255),destroy:()=>{}}}if(t.kind==="sequence"){let l=t.textures.map(c=>Py({app:r,texture:c,width:e,height:i,channel:t.channel??"red",invert:t.invert??!1}));return{duration:o,progressTimeline:s,sample:(c,h)=>{let u=Cy(c)*Math.max(0,l.length-1);if(t.sample==="linear"&&l.length>1){let f=Math.floor(u),p=Math.min(l.length-1,f+1),m=u-f,x=(l[f][h]*(1-m)+l[p][h]*m)/255;return Yd(c-n,c+n,x)}let d=Math.min(l.length-1,Math.max(0,Math.round(u)));return Yd(c-n,c+n,l[d][h]/255)},destroy:()=>{}}}let a=HG(r,t,e,i);return{duration:o,progressTimeline:s,sample:(l,c)=>Yd(l-n,l+n,a[c]/255),destroy:()=>{}}},WG=r=>{let t=new J;for(let e of r)e?.wrapper&&t.addChild(e.wrapper);return QR(ZR(t))},KR=({app:r,container:t,target:e,frame:i})=>{r.renderer.render({container:t,target:e,clear:!0,transform:new U(1,0,0,1,-i.x,-i.y)})},oc=r=>{r?.texture?.destroy(!0)},zG=({app:r,animation:t,prevSubject:e,nextSubject:i,zIndex:s})=>{let o=new J;o.zIndex=s,e?.wrapper&&o.addChild(e.wrapper),i?.wrapper&&o.addChild(i.wrapper);let n=qd(e?.wrapper??null,t.prev?.tween,r),a=qd(i?.wrapper??null,t.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}),oc(e),oc(i)}}},$G=({app:r,animation:t,prevSubject:e,nextSubject:i,zIndex:s})=>{let o=WG([e,i]),n=new J,a=new J;e?.wrapper&&n.addChild(e.wrapper),i?.wrapper&&a.addChild(i.wrapper);let l=gi.create({width:o.width,height:o.height}),c=gi.create({width:o.width,height:o.height}),{canvas:h,context:u}=DG(o.width,o.height),d=u.createImageData(o.width,o.height),f=B.from(h),p=new J;p.zIndex=s;let m=new Tt(f);m.x=o.x,m.y=o.y,p.addChild(m);let x=VG(r,t.mask,o.width,o.height),_=qd(e?.wrapper??null,t.prev?.tween,r),T=qd(i?.wrapper??null,t.next?.tween,r),g=new Uint8ClampedArray(o.width*o.height*4);return{overlay:p,duration:Math.max(_.duration,T.duration,x.duration),apply:w=>{_.apply(w),T.apply(w);let b=g,S=g;e?.wrapper&&(KR({app:r,container:n,target:l,frame:o}),b=r.renderer.extract.pixels(l).pixels),i?.wrapper&&(KR({app:r,container:a,target:c,frame:o}),S=r.renderer.extract.pixels(c).pixels);let v=Cy(sc(x.progressTimeline,w)),P=d.data;for(let C=0,A=0;C<P.length;C+=4,A+=1){let R=x.sample(v,A),M=1-R;P[C]=Math.round(b[C]*M+S[C]*R),P[C+1]=Math.round(b[C+1]*M+S[C+1]*R),P[C+2]=Math.round(b[C+2]*M+S[C+2]*R),P[C+3]=Math.round(b[C+3]*M+S[C+3]*R)}u.putImageData(d,0,0),f.source.update()},destroy:()=>{p.removeFromParent(),p.destroy({children:!0}),n.destroy({children:!0}),a.destroy({children:!0}),l.destroy(!0),c.destroy(!0),f.destroy(!0),oc(e),oc(i),x.destroy()}}},XG=({app:r,animation:t,prevSubject:e,nextSubject:i,zIndex:s})=>t.mask?$G({app:r,animation:t,prevSubject:e,nextSubject:i,zIndex:s}):zG({app:r,animation:t,prevSubject:e,nextSubject:i,zIndex:s}),jG=({app:r,parent:t,nextElement:e,plugin:i,animations:s,eventHandler:o,animationBus:n,completionTracker:a,elementPlugins:l,renderContext:c,zIndex:h,signal:u})=>{if(!e)return null;let d=i.add({app:r,parent:t,element:e,animations:s,eventHandler:o,animationBus:n,completionTracker:a,elementPlugins:l,renderContext:c,zIndex:h,signal:u});return d&&typeof d.then=="function"?d.then(()=>u?.aborted||t.destroyed?null:t.children.find(f=>f.label===e.id)??null):u?.aborted||t.destroyed?null:t.children.find(f=>f.label===e.id)??null},YG=async r=>r&&typeof r.then=="function"?r:r??null,Kd=({app:r,parent:t,prevElement:e,nextElement:i,animation:s,animations:o,animationBus:n,completionTracker:a,eventHandler:l,elementPlugins:c,renderContext:h,plugin:u,zIndex:d,signal:f})=>{if(!e&&!i)throw new Error(`Replace animation "${s.id}" must receive prevElement and/or nextElement.`);if(f?.aborted||t.destroyed)return;let p=e?t.children.find(M=>M.label===e.id)??null:null;if(e&&!p)throw new Error(`Transition animation "${s.id}" could not find the previous element "${e.id}".`);let m=p?qR(r,p):null,x=new J,_=Td({suppressAnimations:!0}),T=a.getVersion(),g=!1,w=()=>{g||(a.track(T),g=!0)},b=()=>{g&&(a.complete(T),g=!1)},S=({flushDeferredEffects:M})=>{if(!C){if(C=!0,v.value&&!v.value.destroyed&&(v.value.visible=!0),P.value?.destroy(),M){WC(_);return}Sd(_)}},v={value:null},P={value:null},C=!1;w();let A=M=>{if(f?.aborted||t.destroyed){Sd(_),x.destroy({children:!0}),oc(m),b();return}if(i&&!M)throw Sd(_),b(),new Error(`Transition animation "${s.id}" could not create the next element "${i.id}".`);v.value=M;let I=M?qR(r,M):null;x.destroy({children:!1}),p&&u.delete({app:r,parent:t,element:e,animations:[],animationBus:n,completionTracker:a,eventHandler:l,elementPlugins:c,renderContext:h,signal:f}),M&&(M.zIndex=d,t.addChild(M),M.visible=!1);let k=XG({app:r,animation:s,prevSubject:m,nextSubject:I,zIndex:d});P.value=k,t.addChild(k.overlay),n.dispatch({type:"START",payload:{id:s.id,driver:"custom",duration:k.duration,applyFrame:k.apply,applyTargetState:()=>{S({flushDeferredEffects:!1})},onComplete:()=>{S({flushDeferredEffects:!0}),b()},onCancel:()=>{b()},isValid:()=>!!k.overlay&&!k.overlay.destroyed&&(!M||!M.destroyed)}})},R=i?jG({app:r,parent:x,nextElement:i,plugin:u,animations:o,eventHandler:l,animationBus:n,completionTracker:a,elementPlugins:c,renderContext:_,zIndex:d,signal:f}):null;if(R&&typeof R.then=="function"){YG(R).then(A);return}A(R??null)};var Us=({app:r,parent:t,prevComputedTree:e,nextComputedTree:i,animations:s,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:c=Td(),signal:h})=>{t.sortableChildren=!0;let u=new Map(l.map(b=>[b.type,b])),d=zC(s),f=new Map,p=new Map;for(let b of e)f.set(b.id,b);for(let b=0;b<i.length;b++)p.set(i[b].id,b);let{toAddElement:m,toDeleteElement:x,toUpdateElement:_}=jR(e,i,s),T=new Set(_.map(({next:b})=>b.id)),g=b=>{let S=u.get(b);if(!S)throw new Error(`No plugin found for element type: ${b}`);return S},w=b=>t.children.find(S=>S.label===b)?.zIndex??-1;for(let b of i){let S=f.get(b.id);!S||T.has(b.id)||!gt(S,b)||g(b.type).shouldUpdateUnchanged?.({app:r,parent:t,prevElement:S,nextElement:b,animations:d,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:c,zIndex:p.get(b.id)??-1,signal:h})!==!0||(_.push({prev:S,next:b}),T.add(b.id))}for(let b of t.children){let S=p.get(b.label);S!==void 0&&(b.zIndex=S)}for(let b of x){let S=c.suppressAnimations?null:Ad(d,b.id),v=g(b.type);if(S){Kd({app:r,parent:t,prevElement:b,nextElement:null,animation:S,animations:d,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:c,plugin:v,zIndex:w(b.id),signal:h});continue}v.delete({app:r,parent:t,element:b,animations:[],animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:c,signal:h})}for(let b of m){let S=c.suppressAnimations?null:Ad(d,b.id),v=g(b.type),P=p.get(b.id)??-1;if(S){Kd({app:r,parent:t,prevElement:null,nextElement:b,animation:S,animations:d,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:c,plugin:v,zIndex:P,signal:h});continue}v.add({app:r,parent:t,element:b,animations:c.suppressAnimations||b.type==="container"?d:[],eventHandler:a,animationBus:o,completionTracker:n,elementPlugins:l,renderContext:c,zIndex:P,signal:h})}for(let{prev:b,next:S}of _){let v=g(S.type),P=p.get(S.id)??-1,C=c.suppressAnimations?null:Ad(d,S.id);if(C){Kd({app:r,parent:t,prevElement:b,nextElement:S,animation:C,animations:d,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:c,plugin:v,zIndex:P,signal:h});continue}v.update({app:r,parent:t,prevElement:b,nextElement:S,animations:d,animationBus:o,completionTracker:n,eventHandler:a,elementPlugins:l,renderContext:c,zIndex:P,signal:h})}};var qG=(r=[])=>{let t=new Set;for(let e of r)if(e?.id){if(t.has(e.id))return!0;t.add(e.id)}return!1},KG=({app:r,container:t,children:e,eventHandler:i,animationBus:s,elementPlugins:o,renderContext:n,completionTracker:a,signal:l})=>{for(let c of e){let h=o.find(u=>u.type===c.type);if(!h)throw new Error(`No plugin found for child element type: ${c.type}`);h.add({app:r,parent:t,element:c,animations:[],eventHandler:i,animationBus:s,elementPlugins:o,renderContext:n,completionTracker:a,signal:l})}},JR=({app:r,parent:t,element:e,animations:i,eventHandler:s,animationBus:o,elementPlugins:n,renderContext:a,zIndex:l,completionTracker:c,signal:h})=>{let{id:u,x:d,y:f,children:p,scroll:m,alpha:x}=e,_=new J;_.label=u,_.zIndex=l,_.x=Math.round(d),_.y=Math.round(f),_.alpha=x,t.addChild(_),p&&p.length>0&&(qG(p)?KG({app:r,container:_,children:p,eventHandler:s,animationBus:o,elementPlugins:n,renderContext:a,completionTracker:c,signal:h}):Us({app:r,parent:_,prevComputedTree:[],nextComputedTree:p,animations:i,animationBus:o,completionTracker:c,eventHandler:s,elementPlugins:n,renderContext:a,signal:h})),(m||e.anchorToBottom)&&ec({container:_,element:e,interactive:!!m,allowViewportWithoutScroll:!!e.anchorToBottom}),$d({app:r,container:_,element:e,eventHandler:s})};var tM=({app:r,parent:t,prevElement:e,nextElement:i,eventHandler:s,animations:o,animationBus:n,elementPlugins:a,renderContext:l,zIndex:c,completionTracker:h,signal:u})=>{let d=t.children.find(T=>T.label===e.id);if(!d)return;d.zIndex=c;let{x:f,y:p,alpha:m}=i,x=()=>{if(!gt(e,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=e.scroll||e.anchorToBottom,S=i.scroll||i.anchorToBottom,v=S?VR({container:d}):null;b!==S?S?ec({container:d,element:i,interactive:!!i.scroll,allowViewportWithoutScroll:!!i.anchorToBottom,previousState:v}):Ey({container:d}):S&&(Ey({container:d}),ec({container:d,element:i,interactive:!!i.scroll,allowViewportWithoutScroll:!!i.anchorToBottom,previousState:v})),$d({app:r,container:d,element:i,eventHandler:s})}let T=!gt(e.children,i.children),g=rc({children:i.children}),w=Array.from(g).some(b=>Ed(o,b).length>0);if(T||w){let S=d.children.find(v=>v.label===`${i.id}-content`)||d;Us({app:r,parent:S,nextComputedTree:i.children,prevComputedTree:e.children,eventHandler:s,elementPlugins:a,animations:o,animationBus:n,completionTracker:h,renderContext:l,signal:u}),zR({container:d}),$R({container:d}),XR({container:d})}};ot({animations:o,targetId:e.id,animationBus:n,completionTracker:h,element:d,targetState:{x:f,y:p,alpha:m},onComplete:()=>{x()}})||x()};var eM=({app:r,parent:t,element:e,animationBus:i,animations:s,eventHandler:o,completionTracker:n})=>{let a=t.getChildByLabel(e.id);if(!a)return;let l=()=>{a&&!a.destroyed&&(t.removeChild(a),a.destroy({children:!0}))};ot({animations:s,targetId:e.id,animationBus:i,completionTracker:n,element:a,targetState:null,onComplete:l})||l()};var rM=({state:r,parserPlugins:t=[]})=>{let e=r.direction??"",i=!!r.scroll,s=r.gap||0,o=structuredClone(r.children||[]),n=[],a=0,l=0,c=0,h=0,u=0,d=0,f=0,p=0,m=0,x=0;for(let g=0;g<o.length;g++){let w=g<o.length-1?s:0,b=o[g];g>0?e==="horizontal"?(b.x=c,b.y=f):e==="vertical"&&(b.x=p,b.y=h):(e==="horizontal"||e==="vertical")&&(b.x=0,b.y=0);let S=t.find(v=>v.type===b.type);if(S){let v=b.scaleX!==void 0||r.scaleX!==void 0,P=b.scaleY!==void 0||r.scaleY!==void 0,C=(b.scaleX??1)*(r.scaleX??1),A=(b.scaleY??1)*(r.scaleY??1);b=S.parse({state:{...b,...v?{scaleX:C}:{},...P?{scaleY:A}:{}},parserPlugins:t})}e==="horizontal"?(r.width&&b.width+m>r.width&&!i&&!r.anchorToBottom?(c=0,m=0,f+=u+s,u=b.height,b.x=0,b.y=f):u=Math.max(u,b.height),c+=b.width+w,m=b.x+b.width,a=Math.max(c,a),l=Math.max(b.height+b.y,l)):e==="vertical"?(r.height&&b.height+x>r.height&&!i&&!r.anchorToBottom?(h=0,x=0,p+=d+s,d=b.width,b.x=p,b.y=0):d=Math.max(d,b.width),h+=b.height+w,x=b.y+b.height,a=Math.max(b.width+b.x,a),l=Math.max(h,l)):(a=Math.max(b.width+b.x,a),l=Math.max(b.height+b.y,l)),n.push(b)}let T={...ge({...r,width:r.width?r.width:a,height:r.height?r.height:l}),children:n,direction:e,gap:s,scroll:i,...r.anchorToBottom&&{anchorToBottom:!0},...r.scrollbar&&{scrollbar:structuredClone(r.scrollbar)},rotation:r.rotation??0};return r.rightClick&&(T.rightClick=r.rightClick),T};var ZG=Zt({type:"container",add:JR,update:tM,delete:eM,parse:rM});var iM=async({parent:r,element:t,animationBus:e,renderContext:i,completionTracker:s,zIndex:o,signal:n})=>{if(n?.aborted)return;let a=new J;if(a.label=t.id,a.zIndex=o,t.x!==void 0&&(a.x=Math.round(t.x)),t.y!==void 0&&(a.y=Math.round(t.y)),t.alpha!==void 0&&(a.alpha=t.alpha),r.addChild(a),i?.suppressAnimations&&t.revealEffect!=="none"){await _i({container:a,element:t,completionTracker:s,animationBus:e,zIndex:o,signal:n,playback:"paused-initial"}),wd(i,{container:a,element:t,completionTracker:s,animationBus:e,zIndex:o,signal:n});return}await _i({container:a,element:t,completionTracker:s,animationBus:e,zIndex:o,signal:n,playback:"autoplay"})};var sM=(r={})=>JSON.stringify({content:r.content??null,revealEffect:r.revealEffect??"typewriter",speed:r.speed??50,width:r.width??null,indicator:r.indicator??null,x:r.x??null,y:r.y??null,alpha:r.alpha??1}),QG=(r,t)=>sM(r)!==sM(t),oM=async({parent:r,prevElement:t,nextElement:e,animations:i,animationBus:s,renderContext:o,completionTracker:n,zIndex:a,signal:l})=>{if(l?.aborted)return;let c=r.children.find(d=>d.label===t.id);if(!c)return;let h=async()=>{if(e.x!==void 0&&(c.x=e.x),e.y!==void 0&&(c.y=e.y),e.alpha!==void 0&&(c.alpha=e.alpha),!QG(t,e)){o?.suppressAnimations!==!0&&e.revealEffect!=="none"&&await _i({container:c,element:e,completionTracker:n,animationBus:s,zIndex:a,signal:l,playback:"resume"});return}if(o?.suppressAnimations===!0&&e.revealEffect!=="none"){await _i({container:c,element:e,completionTracker:n,animationBus:s,zIndex:a,signal:l,playback:"paused-initial"}),wd(o,{container:c,element:e,completionTracker:n,animationBus:s,zIndex:a,signal:l});return}await _i({container:c,element:e,completionTracker:n,animationBus:s,zIndex:a,signal:l,playback:"autoplay"})};ot({animations:i,targetId:t.id,animationBus:s,completionTracker:n,element:c,targetState:{x:e.x??c.x,y:e.y??c.y,alpha:e.alpha??c.alpha},onComplete:()=>{h()}})||await h()};var nM=({parent:r,element:t,animations:e,animationBus:i,completionTracker:s})=>{let o=r.getChildByLabel(t.id);if(!o||o.destroyed)return;let n=()=>{o&&!o.destroyed&&(ay(o),o.destroy({children:!0}))};ot({animations:e,targetId:t.id,animationBus:i,completionTracker:s,element:o,targetState:null,onComplete:n})||n()};var JG=r=>r===`
|
|
1149
1149
|
`||r==="\r",tL=r=>typeof r=="string"&&kt.isBreakingSpace(r),eL=(r,t,e)=>{let i=0,s=0;for(;i<r.length&&s<t.length&&r[i]===t[s];)i+=1,s+=1;if(s<t.length){let a=Math.min(r.length,t.length);return{remainingText:r.slice(a),consumedExplicitNewline:!1}}let o=i,n=o;for(;n<r.length&&tL(r[n]);)n+=1;if(JG(r[n])){let a=n+1;return r[n]==="\r"&&r[n+1]===`
|
|
1150
1150
|
`&&(a+=1),{remainingText:r.slice(a),consumedExplicitNewline:!0}}return e?{remainingText:r.slice(n),consumedExplicitNewline:!1}:{remainingText:r.slice(o),consumedExplicitNewline:!1}},rL=(r,t)=>{let e=[],i=[],s=0,o=0,n=0,a=0,l=0,c=[...r],h=new WeakSet,u=Math.max(10,r.reduce((p,m)=>p+(m?.text?.length??0),0)*4),d=()=>{e.push({lineParts:[...i],y:o,lineMaxHeight:n}),s=0,o+=n,n=0,i=[]};for(;c.length>0;){if(l+=1,l>u)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,x=Math.max(1,Math.round(t-s)),_={...p.textStyle,wordWrapWidth:x},T=kt.measureText(p.text,new It(_));if(T.lineWidths[0]>x&&i.length>0){d();continue}let g=T.lines[0]??"",w=T.lines.length>1,b="",S=!1;if(T.lines.length===1&&p.text.endsWith(" ")&&!g.endsWith(" ")&&(g+=" "),g.length>0){let A=eL(m,g,w);b=A.remainingText,S=A.consumedExplicitNewline}if(g.length===0&&m.length>0){let A=m.match(/^\s+/)?.[0]??"";g=A.length>0?A:m[0],b=m.slice(g.length)}if(b===m){let A=m.match(/^\s+/)?.[0]??m[0]??"";if(A.length===0)throw new Error("[parseTextRevealing] Failed to consume text while wrapping.");g=A,b=m.slice(A.length)}let v=kt.measureText(g,new It({...p.textStyle,wordWrap:!1,breakWords:!1})),P=Math.max(0,Math.round(v.width??T.lineWidths[0]??0)),C={text:g,textStyle:_,height:v.height,x:s,y:o};if(p.furigana&&!h.has(p)){h.add(p);let A=kt.measureText(p.furigana.text,new It(p.furigana.textStyle)),R=-A.height+o+2,M={text:p.furigana.text,textStyle:p.furigana.textStyle,x:Math.round(s+(P-A.width)/2),y:R};C.furigana=M}i.push(C),n=Math.max(n,v.height),s+=P,a=Math.max(a,s),b&&b.length>0?p.text=b:c.shift(),(w||S)&&s>0&&d()}i.length>0&&e.push({lineParts:i,y:o,lineMaxHeight:n});for(let p=0;p<e.length;p++){let m=e[p].lineMaxHeight;e[p].lineParts=e[p].lineParts.map(x=>{let _=x.height;x.height&&delete x.height;let T=x.y+(m-_),g=x.furigana;return g&&(g.y=g.y-x.y+T),{...x,...g&&{furigana:g},y:T}})}let f=e.length>0?e[e.length-1].y+e[e.length-1].lineMaxHeight:0;return{chunks:e,width:Math.max(a,t),height:f}},aM=({state:r})=>{let t={...zt,wordWrap:!0,...r.textStyle||{}},e=(r.content||[]).map(h=>{let u={...t,...h.textStyle||{}};u.lineHeight=Math.round(u.lineHeight*u.fontSize),r.width&&(u.wordWrapWidth=r.width,u.wordWrap=!0);let d=null;if(h.furigana){let p={...t,...h.furigana.textStyle||{}};p.lineHeight=Math.round(p.lineHeight*p.fontSize),r.width&&(p.wordWrapWidth=r.width,p.wordWrap=!0),d={text:String(h.furigana.text),textStyle:p}}return{text:String(h.text).replace(/ +$/,p=>"\xA0".repeat(p.length)),textStyle:u,...d&&{furigana:d}}}),i=r.width||500,{chunks:s,width:o,height:n}=rL(e,i),a=r.width||o,c=ge({...r,width:a,height:n});if(c.alpha=r.alpha??1,r.indicator){let h=r.indicator;c.indicator={revealing:{src:h.revealing?.src??"",width:h.revealing?.width??12,height:h.revealing?.height??12},complete:{src:h.complete?.src??"",width:h.complete?.width??12,height:h.complete?.height??12},offset:h.offset??12}}return{...c,content:s,textStyle:{...t,...r.textStyle||{}},speed:r.speed??50,revealEffect:r.revealEffect??"typewriter",...r.width!==void 0&&{width:r.width},...r.complete&&{complete:r.complete}}};var iL=Zt({type:"text-revealing",add:iM,update:oM,delete:nM,parse:aM,shouldUpdateUnchanged:({parent:r,nextElement:t})=>OC(r.children.find(e=>e.label===t.id))});var Zd=(r,t,e)=>{if(!e)return;let i=s=>{s?.detail?.elementId===t&&typeof s?.detail?.frameIndex=="number"&&r.gotoAndStop(s?.detail?.frameIndex)};window.addEventListener("snapShotAnimatedSpriteFrame",i),r._snapShotKeyFrameHandler=i},Qd=r=>{r._snapShotKeyFrameHandler&&(window.removeEventListener("snapShotAnimatedSpriteFrame",r._snapShotKeyFrameHandler),delete r._snapShotKeyFrameHandler)};var lM=async({app:r,parent:t,element:e,renderContext:i,zIndex:s,signal:o})=>{if(o?.aborted)return;let{id:n,x:a,y:l,width:c,height:h,spritesheetSrc:u,spritesheetData:d,animation:f,alpha:p}=e,m=d,x=Object.keys(m.frames),_=new Gi(B.from(u),m);if(await _.parse(),o?.aborted||t.destroyed)return;let T=f.frames.map(w=>_.textures[x[w]]),g=new ql(T);g.label=n,g.zIndex=s,g.animationSpeed=f.animationSpeed??.5,g.loop=f.loop??!0,r.debug?Zd(g,n,r.debug):DC(i,g),g.x=Math.round(a),g.y=Math.round(l),g.width=Math.round(c),g.height=Math.round(h),g.alpha=p,t.addChild(g)};var cM=async({app:r,parent:t,prevElement:e,nextElement:i,animations:s,animationBus:o,completionTracker:n,zIndex:a,signal:l})=>{if(l?.aborted)return;let c=t.children.find(_=>_.label===e.id);if(!c)return;c.zIndex=a;let h=async()=>{if(!(l?.aborted||c.destroyed)&&!gt(e,i)&&(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,!gt(e.animation,i.animation))){c.animationSpeed=i.animation.animationSpeed??.5,c.loop=i.animation.loop??!0;let _=i.spritesheetData,T=Object.keys(_.frames),g=new Gi(B.from(i.spritesheetSrc),_);if(await g.parse(),l?.aborted||c.destroyed)return;let w=i.animation.frames.map(b=>g.textures[T[b]]);c.textures=w,r.debug?e.id!==i.id&&(Qd(c),Zd(c,i.id,r.debug)):c.play()}},{x:u,y:d,width:f,height:p,alpha:m}=i;ot({animations:s,targetId:e.id,animationBus:o,completionTracker:n,element:c,targetState:{x:u,y:d,width:f,height:p,alpha:m},onComplete:()=>{h()}})||await h()};var hM=({app:r,parent:t,element:e,animations:i,animationBus:s,completionTracker:o})=>{let n=t.children.find(c=>c.label===e.id);if(!n)return;let a=()=>{r.debug&&Qd(n),n&&!n.destroyed&&(n.stop(),n.destroy())};ot({animations:i,targetId:e.id,animationBus:s,completionTracker:o,element:n,targetState:null,onComplete:a})||a()};var uM=({state:r})=>({...ge(r),spritesheetSrc:r.spritesheetSrc??"",spritesheetData:{frames:{},meta:{},...r.spritesheetData??{}},animation:{frames:[],animationSpeed:.5,loop:!0,...r.animation??{}},alpha:r.alpha??1});var sL=Zt({type:"animated-sprite",add:lM,update:cM,delete:hM,parse:uM});var oL=sy({type:"tween"});var Gs=new Map,nL=r=>({id:r.id,url:r.src,loop:r.loop??!1,volume:(r.volume??800)/1e3}),dM=r=>Gs.has(r),nc=r=>{let t=Gs.get(r);t!==void 0&&(clearTimeout(t),Gs.delete(r))},Ry=({app:r,element:t})=>{let e=nL(t);if(nc(e.id),t.delay&&t.delay>0){let i=setTimeout(()=>{Gs.delete(e.id),r.audioStage.add(e)},t.delay);Gs.set(e.id,i);return}r.audioStage.add(e)},My=()=>{for(let r of Gs.values())clearTimeout(r);Gs.clear()},fM=({app:r,element:t})=>{Ry({app:r,element:t})};var pM=({app:r,prevElement:t,nextElement:e})=>{let i=t.id;if((e.delay??0)>0){r.audioStage.remove(i),Ry({app:r,element:e});return}if(dM(i)){nc(i),r.audioStage.add({id:i,url:e.src,loop:e.loop??!1,volume:(e.volume??800)/1e3});return}let o=r.audioStage.getById(i);if(!o){r.audioStage.add({id:i,url:e.src,loop:e.loop??!1,volume:(e.volume??800)/1e3});return}o.url=e.src,o.loop=e.loop??!1,o.volume=(e.volume??800)/1e3};var mM=({app:r,element:t})=>{nc(t.id),r.audioStage.remove(t.id)};var aL=oy({type:"sound",add:fM,update:pM,delete:mM});var ac=class extends Tt{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(t){super(),this.emitter=t,this.anchor.set(.5,.5)}init(t){this.maxLife=t,this.age=0,this.oneOverLife=1/t,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 Iy(r){let t=new Bt;return t.circle(0,0,3),t.fill({color:16777215}),r.renderer.generateTexture(t)}function By(r){let t=new Bt;return t.rect(0,0,1,8),t.fill({color:8965375}),r.renderer.generateTexture(t)}function Fy(r){let t=new Bt;return t.circle(0,0,4),t.fill({color:16777215}),r.renderer.generateTexture(t)}function lc(r,t,e){return r+(t-r)*e}function tf(r){if(typeof r=="number")return r;let t=r.replace(/^(#|0x)/,"");return parseInt(t,16)}function gM(r,t,e){let i=r>>16&255,s=r>>8&255,o=r&255,n=t>>16&255,a=t>>8&255,l=t&255,c=Math.round(lc(i,n,e)),h=Math.round(lc(s,a,e)),u=Math.round(lc(o,l,e));return c<<16|h<<8|u}var Jd=class r{constructor(t,e,i=!1){this.value=i?tf(t):t,this.time=e,this.next=null}static createList(t,e=!1){let i=[...t].sort((n,a)=>n.time-a.time),s=new r(i[0].value,i[0].time,e),o=s;for(let n=1;n<i.length;n++)o.next=new r(i[n].value,i[n].time,e),o=o.next;return s}},Rr=class{constructor(t=!1){this.first=null,this.isColor=t,this.ease=null}reset(t){Array.isArray(t)?this.first=Jd.createList(t,this.isColor):this.first=t}getValue(t){if(this.ease&&(t=this.ease(t)),!this.first.next||t<=this.first.time)return this.first.value;let e=this.first;for(;e.next&&e.next.time<t;)e=e.next;if(!e.next||t>=e.next.time)return e.next?e.next.value:e.value;let i=(t-e.time)/(e.next.time-e.time);return this.isColor?gM(e.value,e.next.value,i):lc(e.value,e.next.value,i)}};var ef=class{static type="alpha";constructor(t){this.list=new Rr(!1),this.list.reset(t.list)}initParticles(t){let e=t,i=this.list.getValue(0);for(;e;)e.alpha=i,e=e.next}updateParticle(t,e){t.alpha=this.list.getValue(t.agePercent)}},rf=class{static type="alphaStatic";constructor(t){this.alpha=t.alpha}initParticles(t){let e=t;for(;e;)e.alpha=this.alpha,e=e.next}updateParticle(t,e){}};var sf=class{static type="scale";constructor(t){this.list=new Rr(!1),this.list.reset(t.list),this.minMult=t.minMult??1}initParticles(t){let e=t;for(;e;){let i=this.minMult<1?e.emitter.random()*(1-this.minMult)+this.minMult:1;e.config.scaleMult=i;let s=this.list.getValue(0)*i;e.scale.set(s,s),e=e.next}}updateParticle(t,e){let i=this.list.getValue(t.agePercent)*t.config.scaleMult;t.scale.set(i,i)}},of=class{static type="scaleStatic";constructor(t){this.min=t.min,this.max=t.max}initParticles(t){let e=t;for(;e;){let i=e.emitter.random()*(this.max-this.min)+this.min;e.scale.set(i,i),e=e.next}}updateParticle(t,e){}};var lL=Math.PI/180,nf=class{static type="speed";constructor(t){this.list=new Rr(!1),this.list.reset(t.list),this.minMult=t.minMult??1}initParticles(t){let e=t;for(;e;){let i=this.minMult<1?e.emitter.random()*(1-this.minMult)+this.minMult:1;e.config.speedMult=i;let s=this.list.getValue(0)*i;e.velocity.x=Math.cos(e.rotation)*s,e.velocity.y=Math.sin(e.rotation)*s,e=e.next}}updateParticle(t,e){let i=this.list.getValue(t.agePercent)*t.config.speedMult,s=Math.sqrt(t.velocity.x*t.velocity.x+t.velocity.y*t.velocity.y);s>0&&(t.velocity.x=t.velocity.x/s*i,t.velocity.y=t.velocity.y/s*i),t.x+=t.velocity.x*e,t.y+=t.velocity.y*e}},af=class{static type="speedStatic";constructor(t){this.min=t.min,this.max=t.max}initParticles(t){let e=t;for(;e;){let i=e.emitter.random()*(this.max-this.min)+this.min;e.velocity.x=Math.cos(e.rotation)*i,e.velocity.y=Math.sin(e.rotation)*i,e=e.next}}updateParticle(t,e){t.x+=t.velocity.x*e,t.y+=t.velocity.y*e}},lf=class{static type="movePoint";constructor(t){this.minSpeed=t.speed.min,this.maxSpeed=t.speed.max,this.direction=t.direction*lL}initParticles(t){let e=t;for(;e;){let i=e.emitter.random()*(this.maxSpeed-this.minSpeed)+this.minSpeed;e.velocity.x=Math.cos(this.direction)*i,e.velocity.y=Math.sin(this.direction)*i,e=e.next}}updateParticle(t,e){t.x+=t.velocity.x*e,t.y+=t.velocity.y*e}};var Wmt=Math.PI/180,cf=class{static type="acceleration";constructor(t){this.accelX=t.accel.x,this.accelY=t.accel.y,this.minStart=t.minStart,this.maxStart=t.maxStart,this.rotate=t.rotate??!1,this.maxSpeed=t.maxSpeed??0}initParticles(t){let e=t;for(;e;){let i=e.emitter.random()*(this.maxStart-this.minStart)+this.minStart;e.velocity.x=Math.cos(e.rotation)*i,e.velocity.y=Math.sin(e.rotation)*i,e=e.next}}updateParticle(t,e){let i=t.velocity,s=i.x,o=i.y;if(i.x+=this.accelX*e,i.y+=this.accelY*e,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}}t.x+=(s+i.x)/2*e,t.y+=(o+i.y)/2*e,this.rotate&&(t.rotation=Math.atan2(i.y,i.x))}},hf=class{static type="gravity";constructor(t){this.gravity=t.gravity}initParticles(t){}updateParticle(t,e){t.velocity.y+=this.gravity*e,t.x+=t.velocity.x*e,t.y+=t.velocity.y*e}};var ts=Math.PI/180,uf=class{static type="rotation";constructor(t){this.minStart=t.minStart*ts,this.maxStart=t.maxStart*ts,this.minSpeed=t.minSpeed*ts,this.maxSpeed=t.maxSpeed*ts,this.accel=(t.accel??0)*ts}initParticles(t){let e=t;for(;e;)e.rotation=e.emitter.random()*(this.maxStart-this.minStart)+this.minStart,e.rotationSpeed=e.emitter.random()*(this.maxSpeed-this.minSpeed)+this.minSpeed,e=e.next}updateParticle(t,e){if(this.accel!==0){let i=t.rotationSpeed;t.rotationSpeed+=this.accel*e,t.rotation+=(i+t.rotationSpeed)/2*e}else t.rotation+=t.rotationSpeed*e}},df=class{static type="rotationStatic";constructor(t){this.min=t.min*ts,this.max=t.max*ts}initParticles(t){let e=t;for(;e;)e.rotation=e.emitter.random()*(this.max-this.min)+this.min,e=e.next}updateParticle(t,e){}},ff=class{static type="noRotation";constructor(t){this.rotation=(t.rotation??0)*ts}initParticles(t){let e=t;for(;e;)e.rotation=this.rotation,e=e.next}updateParticle(t,e){t.rotation=this.rotation}};var pf=class{static type="color";constructor(t){this.list=new Rr(!0),this.list.reset(t.list)}initParticles(t){let e=t,i=this.list.getValue(0);for(;e;)e.tint=i,e=e.next}updateParticle(t,e){t.tint=this.list.getValue(t.agePercent)}},mf=class{static type="colorStatic";constructor(t){this.color=tf(t.color)}initParticles(t){let e=t;for(;e;)e.tint=this.color,e=e.next}updateParticle(t,e){}};var gf=class{constructor(t){this.x=t.x,this.y=t.y,this.w=t.w,this.h=t.h}getRandPos(t,e){t.x=this.x+e.random()*this.w,t.y=this.y+e.random()*this.h}},xf=class{constructor(t){this.x=t.x,this.y=t.y,this.radius=t.radius,this.innerRadius=t.innerRadius??0,this.affectRotation=t.affectRotation??!1}getRandPos(t,e){let i=e.random()*Math.PI*2,s=this.radius-this.innerRadius,o=e.random()*s+this.innerRadius;t.x=this.x+Math.cos(i)*o,t.y=this.y+Math.sin(i)*o,this.affectRotation&&(t.rotation=i)}},ky=class{constructor(t){this.x=t.x,this.y=t.y}getRandPos(t,e){t.x=this.x,t.y=this.y}},Oy=class{constructor(t){this.x1=t.x1,this.y1=t.y1,this.x2=t.x2,this.y2=t.y2}getRandPos(t,e){let i=e.random();t.x=this.x1+(this.x2-this.x1)*i,t.y=this.y1+(this.y2-this.y1)*i}},cL={rect:gf,rectangle:gf,torus:xf,circle:xf,point:ky,line:Oy};var yf=class{static type="spawnShape";constructor(t){let e=cL[t.type];if(!e)throw new Error(`Unknown spawn shape type: ${t.type}`);this.shape=new e(t.data)}initParticles(t){let e=t,i={x:0,y:0,rotation:void 0};for(;e;)this.shape.getRandPos(i,e.emitter),e.x=i.x,e.y=i.y,i.rotation!==void 0&&(e.rotation=i.rotation),e=e.next}updateParticle(t,e){}},_f=class{static type="spawnBurst";constructor(t){this.x=t.x,this.y=t.y,this.spacing=(t.spacing??0)*Math.PI/180,this.startAngle=(t.startAngle??0)*Math.PI/180}initParticles(t){let e=t,i=this.startAngle;for(;e;)e.x=this.x,e.y=this.y,e.rotation=i,i+=this.spacing,e=e.next}updateParticle(t,e){}};var xM=new Map,yM=new Map;function Uy(r,t){xM.set(r,t)}function Ce(r){yM.set(r.type,r)}function _M(r,t){let e=xM.get(r);return e?e(t):null}function bM(r){return yM.get(r)}Uy("circle",Fy);Uy("snowflake",Iy);Uy("raindrop",By);Ce(ef);Ce(rf);Ce(sf);Ce(of);Ce(nf);Ce(af);Ce(lf);Ce(cf);Ce(hf);Ce(uf);Ce(df);Ce(ff);Ce(pf);Ce(mf);Ce(yf);Ce(_f);var bf=class{constructor(t){this.seed=t,this.state=t}next(){let t=this.state+=1831565813;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}reset(){this.state=this.seed}};var cc=class{container=null;texture=null;_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(t,e){this.container=t,this.init(e)}init(t){if(t.seed!==void 0&&t.seed!==null&&(this.rng=new bf(t.seed)),t.texture&&(this.texture=t.texture),t.lifetime&&(this.lifetime.min=t.lifetime.min??1,this.lifetime.max=t.lifetime.max??t.lifetime.min??2),this.frequency=t.frequency??.1,this.particlesPerWave=t.particlesPerWave??1,this.maxParticles=t.maxParticles??1e3,this.emitterLifetime=t.emitterLifetime??-1,t.spawnBounds&&(this.spawnBounds=t.spawnBounds,this.recycleOnBounds=t.recycleOnBounds??!1),this.initBehaviors=[],this.updateBehaviors=[],this.recycleBehaviors=[],t.behaviors)for(let e of t.behaviors){let i=bM(e.type);if(!i){console.warn(`Unknown behavior type: ${e.type}`);continue}let s=new i(e.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=t.emit??!0}_createParticle(){let t;return this._poolFirst?(t=this._poolFirst,this._poolFirst=t.next,t.next=null):t=new ac(this),t.texture=this.texture,t}spawn(t){if(this.destroyed||t<=0)return null;let e=this.maxParticles-this.particleCount;if(t=Math.min(t,e),t<=0)return null;let i=null,s=null;for(let o=0;o<t;o++){let n=this._createParticle(),a=this.lifetime.min+this.random()*(this.lifetime.max-this.lifetime.min);n.init(a),i||(i=n),s&&(s.next=n,n.prev=s),s=n,this.container.addChild(n)}for(let o of this.initBehaviors)o.initParticles(i);return this._activeLast?(this._activeLast.next=i,i.prev=this._activeLast):this._activeFirst=i,this._activeLast=s,this.particleCount+=t,i}emitNow(){this.spawn(this.particlesPerWave)}recycle(t){for(let e of this.recycleBehaviors)e.recycleParticle(t);t.prev?t.prev.next=t.next:this._activeFirst=t.next,t.next?t.next.prev=t.prev:this._activeLast=t.prev,t.prev=null,t.next=null,t.parent&&t.parent.removeChild(t),t.next=this._poolFirst,this._poolFirst=t,this.particleCount--}update(t){if(this.destroyed)return;if(this.emitterLifetime>0&&(this._emitterAge+=t,this._emitterAge>=this.emitterLifetime&&(this.emit=!1)),this.emit)if(this.frequency<=0)this.spawn(this.particlesPerWave),this.emit=!1;else for(this._spawnTimer+=t;this._spawnTimer>=this.frequency;)this._spawnTimer-=this.frequency,this.spawn(this.particlesPerWave);let e=this._activeFirst;for(;e;){let i=e.next;if(e.age+=t,e.age>=e.maxLife){this.recycle(e),e=i;continue}if(this.recycleOnBounds&&this.spawnBounds){let s=this.spawnBounds;if(e.x<s.x||e.x>s.x+s.width||e.y<s.y||e.y>s.y+s.height){this.recycle(e),e=i;continue}}for(let s of this.updateBehaviors)s.updateParticle(e,t);e=i}}stop(t=!1){if(this.emit=!1,t)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()}destroy(){if(this.destroyed)return;this.destroyed=!0,this.emit=!1;let t=this._activeFirst;for(;t;){let e=t.next;t.destroy(),t=e}for(t=this._poolFirst;t;){let e=t.next;t.destroy(),t=e}this._activeFirst=null,this._activeLast=null,this._poolFirst=null,this.initBehaviors=[],this.updateBehaviors=[],this.recycleBehaviors=[]}};function hL(r,t){let e=new Bt,i=t.color??"#ffffff";switch(t.shape){case"circle":{let s=t.radius??3;e.circle(0,0,s),e.fill({color:i});break}case"ellipse":{let s=t.width??2,o=t.height??6;e.ellipse(0,0,s/2,o/2),e.fill({color:i});break}case"rect":{let s=t.width??4,o=t.height??4;e.rect(-s/2,-o/2,s,o),e.fill({color:i});break}default:e.circle(0,0,3),e.fill({color:i})}return r.renderer.generateTexture(e)}var hc=({app:r,parent:t,element:e,renderContext:i,zIndex:s})=>{let o=new J;o.label=e.id,o.zIndex=s,t.addChild(o);let n=e.width,a=e.height;o.x=e.x??0,o.y=e.y??0;let l={lifetime:e.emitter?.lifetime??{min:1,max:2},frequency:e.emitter?.frequency??.1,particlesPerWave:e.emitter?.particlesPerWave??1,maxParticles:e.emitter?.maxParticles??e.count??100,emitterLifetime:e.emitter?.emitterLifetime??-1,spawnBounds:e.emitter?.spawnBounds,recycleOnBounds:e.emitter?.recycleOnBounds??!1,seed:e.emitter?.seed,behaviors:e.behaviors},c;if(typeof e.texture=="object"&&e.texture.shape)c=hL(r,e.texture);else{let d=e.texture??"circle";if(c=_M(d,r),!c)try{c=B.from(d)}catch{console.warn(`Failed to load particle texture: ${d}`);return}}l.texture=c;let h=new cc(o,l);if(o.emitter=h,l.recycleOnBounds){let d=Math.min(e.count??100,l.maxParticles);h.spawn(d);let f=h._activeFirst;for(;f;)f.y=h.random()*a,f.age=h.random()*f.maxLife*.8,f=f.next}let u=d=>{if(h.destroyed){r.ticker.remove(u);return}h.update(d.deltaTime/60)};o.tickerCallback=u,HC(i,{app:r,emitter:h,container:o,tickerCallback:u}),e.alpha!==void 0&&(o.alpha=e.alpha)};var vf=({app:r,parent:t,element:e,animationBus:i,animations:s,completionTracker:o})=>{let n=t.getChildByLabel(e.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}))};ot({animations:s,targetId:e.id,animationBus:i,completionTracker:o,element:n,targetState:null,onComplete:a})||a()};var vM=({app:r,parent:t,prevElement:e,nextElement:i,animations:s,animationBus:o,completionTracker:n,zIndex:a})=>{let l=t.children.find(h=>h.label===e.id);if(!l){hc({app:r,parent:t,element:i,animations:s,animationBus:o,completionTracker:n,zIndex:a});return}if(l.zIndex=a,uL(e,i))vf({app:r,parent:t,element:e,animations:s,animationBus:o,completionTracker:n}),hc({app:r,parent:t,element:i,animations:s,animationBus:o,completionTracker:n,zIndex:a});else{let h=()=>{i.alpha!==void 0&&(l.alpha=i.alpha),i.x!==void 0&&(l.x=i.x),i.y!==void 0&&(l.y=i.y)};ot({animations:s,targetId:e.id,animationBus:o,completionTracker:n,element:l,targetState:{x:i.x??l.x,y:i.y??l.y,alpha:i.alpha??l.alpha},onComplete:h})||h()}};function uL(r,t){return r.count!==t.count||!gt(r.texture,t.texture)||!gt(r.behaviors,t.behaviors)||!gt(r.emitter,t.emitter)||r.width!==t.width||r.height!==t.height}function TM(r){if(!r.id)throw new Error("Input Error: Id is missing");if(!Object.values(Is).includes(r.type))throw new Error("Input Error: Type must be one of "+Object.values(Is).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 SM(r){if(!r.texture)throw new Error("Input Error: Particles require 'texture'");let t=typeof r.texture=="string",e=typeof r.texture=="object"&&r.texture!==null&&!Array.isArray(r.texture);if(!t&&!e)throw new Error("Input Error: texture must be a string or shape object");if(e){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 wM(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 t=0;t<r.behaviors.length;t++){let e=r.behaviors[t];if(typeof e!="object"||e===null||Array.isArray(e))throw new Error(`Input Error: behaviors[${t}] must be an object`);if(!e.type||typeof e.type!="string")throw new Error(`Input Error: behaviors[${t}] must have a 'type' string property`)}}function EM(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 AM(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 PM(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 CM=({state:r})=>{TM(r),SM(r),wM(r),EM(r),AM(r),PM(r);let t=r.emitter?.maxParticles??r.count??100,e=r.emitter;return e&&e.maxParticles===void 0&&r.count!==void 0&&(e={...e,maxParticles:t}),{id:r.id,type:r.type,count:t,texture:r.texture,behaviors:r.behaviors,emitter:e,x:r.x??0,y:r.y??0,width:r.width,height:r.height,alpha:r.alpha??1}};var dL=Zt({type:"particles",add:hc,update:vM,delete:vf,parse:CM});var RM=(r=[],t=[])=>{let e=new Set,i=new Map,s=new Map,o=[],n=[],a=[];for(let l of r)e.add(l.id),i.set(l.id,l);for(let l of t)e.add(l.id),s.set(l.id,l);for(let l of e){let c=i.get(l),h=s.get(l);!c&&h?o.push(h):c&&!h?n.push(c):(c.src!==h.src||c.volume!==h.volume||c.loop!==h.loop||c.delay!==h.delay)&&a.push({prev:c,next:h})}return{toAddElement:o,toDeleteElement:n,toUpdateElement:a}};var Gy=({app:r,prevAudioTree:t,nextAudioTree:e,audioPlugins:i})=>{let{toAddElement:s,toDeleteElement:o,toUpdateElement:n}=RM(t,e);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(h=>h.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 tr=(r=>(r[r.WEBGL_LEGACY=0]="WEBGL_LEGACY",r[r.WEBGL=1]="WEBGL",r[r.WEBGL2=2]="WEBGL2",r))(tr||{}),Ly=(r=>(r[r.UNKNOWN=0]="UNKNOWN",r[r.WEBGL=1]="WEBGL",r[r.CANVAS=2]="CANVAS",r))(Ly||{}),Tf=(r=>(r[r.COLOR=16384]="COLOR",r[r.DEPTH=256]="DEPTH",r[r.STENCIL=1024]="STENCIL",r))(Tf||{}),tt=(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))(tt||{}),vn=(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))(vn||{}),L=(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))(L||{}),vi=(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))(vi||{}),nt=(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))(nt||{}),H=(r=>(r[r.FLOAT=0]="FLOAT",r[r.INT=1]="INT",r[r.UINT=2]="UINT",r))(H||{}),xr=(r=>(r[r.NEAREST=0]="NEAREST",r[r.LINEAR=1]="LINEAR",r))(xr||{}),uc=(r=>(r[r.CLAMP=33071]="CLAMP",r[r.REPEAT=10497]="REPEAT",r[r.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",r))(uc||{}),Mr=(r=>(r[r.OFF=0]="OFF",r[r.POW2=1]="POW2",r[r.ON=2]="ON",r[r.ON_MANUAL=3]="ON_MANUAL",r))(Mr||{}),er=(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))(er||{}),es=(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))(es||{}),Sf=(r=>(r[r.AUTO=0]="AUTO",r[r.MANUAL=1]="MANUAL",r))(Sf||{}),Ne=(r=>(r.LOW="lowp",r.MEDIUM="mediump",r.HIGH="highp",r))(Ne||{}),se=(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))(se||{});var At=(r=>(r[r.NONE=0]="NONE",r[r.LOW=2]="LOW",r[r.MEDIUM=4]="MEDIUM",r[r.HIGH=8]="HIGH",r))(At||{}),qe=(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))(qe||{});var Dy={createCanvas:(r,t)=>{let e=document.createElement("canvas");return e.width=r,e.height=t,e},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(r,t)=>fetch(r,t),parseXML:r=>new DOMParser().parseFromString(r,"text/xml")};var q={ADAPTER:Dy,RESOLUTION:1,CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1};tm();var fL=ki.default??ki,Ir=fL(globalThis.navigator);q.RETINA_PREFIX=/@([0-9\.]+)x/;q.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!1;var zs=ls(IM(),1),s3=ls(ru(),1);var __=ls(jB(),1);var YB={};function ht(r,t,e=3){if(YB[t])return;let i=new Error().stack;typeof i>"u"?console.warn("PixiJS Deprecation Warning: ",`${t}
|
|
1151
1151
|
Deprecated since v${r}`):(i=i.split(`
|