route-graphics 1.23.0 → 1.23.1
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 +2 -2
- package/package.json +1 -1
package/dist/RouteGraphics.js
CHANGED
|
@@ -1260,7 +1260,7 @@ fn mainFragment(
|
|
|
1260
1260
|
}`;function tI(t,e){let r=kf[e],i=r.length,s=[],o=[],n=[];for(let h=0;h<e;h++){s[h]=`@location(${h}) offset${h}: vec2<f32>,`,t?o[h]=`filteredCord + vec2(${h-i+1} * pixelStrength, 0.0),`:o[h]=`filteredCord + vec2(0.0, ${h-i+1} * pixelStrength),`;let d=h<i?h:e-h-1,f=r[d].toString();n[h]=`finalColor += textureSample(uTexture, uSampler, offset${h}) * ${f};`}let a=s.join(`
|
|
1261
1261
|
`),l=o.join(`
|
|
1262
1262
|
`),c=n.join(`
|
|
1263
|
-
`),u=eI.replace("%blur-struct%",a).replace("%blur-vertex-out%",l).replace("%blur-fragment-in%",a).replace("%blur-sampling%",c).replace("%dimension%",t?"z":"w");return cr.from({vertex:{source:u,entryPoint:"mainVertex"},fragment:{source:u,entryPoint:"mainFragment"}})}var rI=class iI extends Ir{constructor(e){e={...iI.defaultOptions,...e};let r=JM(e.horizontal,e.kernelSize),i=tI(e.horizontal,e.kernelSize);super({glProgram:r,gpuProgram:i,resources:{blurUniforms:{uStrength:{value:0,type:"f32"}}},...e}),this.horizontal=e.horizontal,this._quality=0,this.quality=e.quality,this.blur=e.strength,this._uniforms=this.resources.blurUniforms.uniforms}apply(e,r,i,s){if(this._uniforms.uStrength=this.strength/this.passes,this.passes===1)e.applyFilter(this,r,i,s);else{let o=Ue.getSameSizeTexture(r),n=r,a=o;this._state.blend=!1;let l=e.renderer.type===Ne.WEBGPU;for(let c=0;c<this.passes-1;c++){e.applyFilter(this,n,a,c===0?!0:l);let u=a;a=n,n=u}this._state.blend=!0,e.applyFilter(this,n,i,s),Ue.returnTexture(o)}}get blur(){return this.strength}set blur(e){this.padding=1+Math.abs(e)*2,this.strength=e}get quality(){return this._quality}set quality(e){this._quality=e,this.passes=e}};rI.defaultOptions={strength:8,quality:4,kernelSize:5};var Uf=rI;var ra=class extends Ir{constructor(...e){let r=e[0]??{};typeof r=="number"&&(q(le,"BlurFilter constructor params are now options object. See params: { strength, quality, resolution, kernelSize }"),r={strength:r},e[1]!==void 0&&(r.quality=e[1]),e[2]!==void 0&&(r.resolution=e[2]||"inherit"),e[3]!==void 0&&(r.kernelSize=e[3])),r={...Uf.defaultOptions,...r};let{strength:i,strengthX:s,strengthY:o,quality:n,...a}=r;super({...a,compatibleRenderers:Ne.BOTH,resources:{}}),this._repeatEdgePixels=!1,this.blurXFilter=new Uf({horizontal:!0,...r}),this.blurYFilter=new Uf({horizontal:!1,...r}),this.quality=n,this.strengthX=s??i,this.strengthY=o??i,this.repeatEdgePixels=!1}apply(e,r,i,s){let o=Math.abs(this.blurXFilter.strength),n=Math.abs(this.blurYFilter.strength);if(o&&n){let a=Ue.getSameSizeTexture(r);this.blurXFilter.blendMode="normal",this.blurXFilter.apply(e,r,a,!0),this.blurYFilter.blendMode=this.blendMode,this.blurYFilter.apply(e,a,i,s),Ue.returnTexture(a)}else n?(this.blurYFilter.blendMode=this.blendMode,this.blurYFilter.apply(e,r,i,s)):(this.blurXFilter.blendMode=this.blendMode,this.blurXFilter.apply(e,r,i,s))}updatePadding(){this._repeatEdgePixels?this.padding=0:this.padding=Math.max(Math.abs(this.blurXFilter.blur),Math.abs(this.blurYFilter.blur))*2}get strength(){if(this.strengthX!==this.strengthY)throw new Error("BlurFilter's strengthX and strengthY are different");return this.strengthX}set strength(e){this.blurXFilter.blur=this.blurYFilter.blur=e,this.updatePadding()}get quality(){return this.blurXFilter.quality}set quality(e){this.blurXFilter.quality=this.blurYFilter.quality=e}get strengthX(){return this.blurXFilter.blur}set strengthX(e){this.blurXFilter.blur=e,this.updatePadding()}get strengthY(){return this.blurYFilter.blur}set strengthY(e){this.blurYFilter.blur=e,this.updatePadding()}get blur(){return q("8.3.0","BlurFilter.blur is deprecated, please use BlurFilter.strength instead."),this.strength}set blur(e){q("8.3.0","BlurFilter.blur is deprecated, please use BlurFilter.strength instead."),this.strength=e}get blurX(){return q("8.3.0","BlurFilter.blurX is deprecated, please use BlurFilter.strengthX instead."),this.strengthX}set blurX(e){q("8.3.0","BlurFilter.blurX is deprecated, please use BlurFilter.strengthX instead."),this.strengthX=e}get blurY(){return q("8.3.0","BlurFilter.blurY is deprecated, please use BlurFilter.strengthY instead."),this.strengthY}set blurY(e){q("8.3.0","BlurFilter.blurY is deprecated, please use BlurFilter.strengthY instead."),this.strengthY=e}get repeatEdgePixels(){return this._repeatEdgePixels}set repeatEdgePixels(e){this._repeatEdgePixels=e,this.updatePadding()}};ra.defaultOptions={strength:8,quality:4,kernelSize:5};Ce();vl();dn();Rl();var vs=class t extends Re{constructor(...e){let r=e[0];Array.isArray(e[0])&&(r={textures:e[0],autoUpdate:e[1]});let{animationSpeed:i=1,autoPlay:s=!1,autoUpdate:o=!0,loop:n=!0,onComplete:a=null,onFrameChange:l=null,onLoop:c=null,textures:u,updateAnchor:h=!1,...d}=r,[f]=u;super({...d,texture:f instanceof F?f:f.texture}),this._textures=null,this._durations=null,this._autoUpdate=o,this._isConnectedToTicker=!1,this.animationSpeed=i,this.loop=n,this.updateAnchor=h,this.onComplete=a,this.onFrameChange=l,this.onLoop=c,this._currentTime=0,this._playing=!1,this._previousFrame=null,this.textures=u,s&&this.play()}stop(){this._playing&&(this._playing=!1,this._autoUpdate&&this._isConnectedToTicker&&(yt.shared.remove(this.update,this),this._isConnectedToTicker=!1))}play(){this._playing||(this._playing=!0,this._autoUpdate&&!this._isConnectedToTicker&&(yt.shared.add(this.update,this,li.HIGH),this._isConnectedToTicker=!0))}gotoAndStop(e){this.stop(),this.currentFrame=e}gotoAndPlay(e){this.currentFrame=e,this.play()}update(e){if(!this._playing)return;let r=e.deltaTime,i=this.animationSpeed*r,s=this.currentFrame;if(this._durations!==null){let o=this._currentTime%1*this._durations[this.currentFrame];for(o+=i/60*1e3;o<0;)this._currentTime--,o+=this._durations[this.currentFrame];let n=Math.sign(this.animationSpeed*r);for(this._currentTime=Math.floor(this._currentTime);o>=this._durations[this.currentFrame];)o-=this._durations[this.currentFrame]*n,this._currentTime+=n;this._currentTime+=o/this._durations[this.currentFrame]}else this._currentTime+=i;this._currentTime<0&&!this.loop?(this.gotoAndStop(0),this.onComplete&&this.onComplete()):this._currentTime>=this._textures.length&&!this.loop?(this.gotoAndStop(this._textures.length-1),this.onComplete&&this.onComplete()):s!==this.currentFrame&&(this.loop&&this.onLoop&&(this.animationSpeed>0&&this.currentFrame<s||this.animationSpeed<0&&this.currentFrame>s)&&this.onLoop(),this._updateTexture())}_updateTexture(){let e=this.currentFrame;this._previousFrame!==e&&(this._previousFrame=e,this.texture=this._textures[e],this.updateAnchor&&this.texture.defaultAnchor&&this.anchor.copyFrom(this.texture.defaultAnchor),this.onFrameChange&&this.onFrameChange(this.currentFrame))}destroy(){this.stop(),super.destroy(),this.onComplete=null,this.onFrameChange=null,this.onLoop=null}static fromFrames(e){let r=[];for(let i=0;i<e.length;++i)r.push(F.from(e[i]));return new t(r)}static fromImages(e){let r=[];for(let i=0;i<e.length;++i)r.push(F.from(e[i]));return new t(r)}get totalFrames(){return this._textures.length}get textures(){return this._textures}set textures(e){if(e[0]instanceof F)this._textures=e,this._durations=null;else{this._textures=[],this._durations=[];for(let r=0;r<e.length;r++)this._textures.push(e[r].texture),this._durations.push(e[r].time)}this._previousFrame=null,this.gotoAndStop(0),this._updateTexture()}get currentFrame(){let e=Math.floor(this._currentTime)%this._textures.length;return e<0&&(e+=this._textures.length),e}set currentFrame(e){if(e<0||e>this.totalFrames-1)throw new Error(`[AnimatedSprite]: Invalid frame index value ${e}, expected to be between 0 and totalFrames ${this.totalFrames}.`);let r=this.currentFrame;this._currentTime=e,r!==this.currentFrame&&this._updateTexture()}get playing(){return this._playing}get autoUpdate(){return this._autoUpdate}set autoUpdate(e){e!==this._autoUpdate&&(this._autoUpdate=e,!this._autoUpdate&&this._isConnectedToTicker?(yt.shared.remove(this.update,this),this._isConnectedToTicker=!1):this._autoUpdate&&!this._isConnectedToTicker&&this._playing&&(yt.shared.add(this.update,this),this._isConnectedToTicker=!0))}};kh();je();Qh();var Of=class extends as{constructor(e,r){let{text:i,resolution:s,style:o,anchor:n,width:a,height:l,roundPixels:c,...u}=e;super({...u}),this.batched=!0,this._resolution=null,this._autoResolution=!0,this._didTextUpdate=!0,this._styleClass=r,this.text=i??"",this.style=o,this.resolution=s??null,this.allowChildren=!1,this._anchor=new It({_onUpdate:()=>{this.onViewUpdate()}}),n&&(this.anchor=n),this.roundPixels=c??!1,a!==void 0&&(this.width=a),l!==void 0&&(this.height=l)}get anchor(){return this._anchor}set anchor(e){typeof e=="number"?this._anchor.set(e):this._anchor.copyFrom(e)}set text(e){e=e.toString(),this._text!==e&&(this._text=e,this.onViewUpdate())}get text(){return this._text}set resolution(e){this._autoResolution=e===null,this._resolution=e,this.onViewUpdate()}get resolution(){return this._resolution}get style(){return this._style}set style(e){e||(e={}),this._style?.off("update",this.onViewUpdate,this),e instanceof this._styleClass?this._style=e:this._style=new this._styleClass(e),this._style.on("update",this.onViewUpdate,this),this.onViewUpdate()}get width(){return Math.abs(this.scale.x)*this.bounds.width}set width(e){this._setWidth(e,this.bounds.width)}get height(){return Math.abs(this.scale.y)*this.bounds.height}set height(e){this._setHeight(e,this.bounds.height)}getSize(e){return e||(e={}),e.width=Math.abs(this.scale.x)*this.bounds.width,e.height=Math.abs(this.scale.y)*this.bounds.height,e}setSize(e,r){typeof e=="object"?(r=e.height??e.width,e=e.width):r??(r=e),e!==void 0&&this._setWidth(e,this.bounds.width),r!==void 0&&this._setHeight(r,this.bounds.height)}containsPoint(e){let r=this.bounds.width,i=this.bounds.height,s=-r*this.anchor.x,o=0;return e.x>=s&&e.x<=s+r&&(o=-i*this.anchor.y,e.y>=o&&e.y<=o+i)}onViewUpdate(){this.didViewUpdate||(this._didTextUpdate=!0),super.onViewUpdate()}_getKey(){return`${this.text}:${this._style.styleKey}:${this._resolution}`}destroy(e=!1){super.destroy(e),this.owner=null,this._bounds=null,this._anchor=null,(typeof e=="boolean"?e:e?.style)&&this._style.destroy(e),this._style=null,this._text=null}};function sI(t,e){let r=t[0]??{};return(typeof r=="string"||t[1])&&(q(le,`use new ${e}({ text: "hi!", style }) instead`),r={text:r,style:t[1]}),r}Ql();ho();var br=class extends Of{constructor(...e){let r=sI(e,"Text");super(r,Be),this.renderPipeId="text"}updateBounds(){let e=this._bounds,r=this._anchor,i=Ve.measureText(this._text,this._style),{width:s,height:o}=i;e.minX=-r._x*s,e.maxX=e.minX+s,e.minY=-r._y*o,e.maxY=e.minY+o}};ac();Te();mr();xt();io();Nt();Wy();qt();Ce();of();Xg();_r();$r();co();ly();Rl();Ql();ho();Lg();Gt();var zN=zs(vd(),1);$.add(lP,uP);var $N=new(window.AudioContext||window.webkitAudioContext),Lf={},au={},XN=(t,e)=>{if(Lf[t])return Lf[t];if(au[t])return au[t];if(e.byteLength!==0)return au[t]=$N.decodeAudioData(e).then(r=>(Lf[t]=r,r)).catch(r=>{console.error(`AudioAsset.load: Failed to decode ${t}:`,r)}).finally(()=>{delete au[t]}),au[t]},YN=t=>Lf[t],ia={load:XN,getAsset:YN};var at=({type:t,add:e,update:r,delete:i,parse:s,shouldUpdateUnchanged:o})=>({type:t,add:e,update:r,delete:i,parse:s,shouldUpdateUnchanged:o});var R_=({type:t})=>({type:t});var M_=({type:t,add:e,update:r,delete:i})=>({type:t,add:e,update:r,delete:i});var Gf={alpha:"alpha",x:"x",y:"y",translateX:"translateX",translateY:"translateY",scaleX:"scaleX",scaleY:"scaleY",rotation:"rotation",blurX:"blurX",blurY:"blurY",uProgress:"uProgress"};var Df={scaleX:["scale","x"],scaleY:["scale","y"],x:["x"],y:["y"],alpha:["alpha"],rotation:["rotation"],blurX:["_routeGraphicsBlur","x"],blurY:["_routeGraphicsBlur","y"],uProgress:["uProgress"]};var vr={RECT:"rect",TEXT:"text",INPUT:"input",CONTAINER:"container",SPRITE:"sprite",TEXT_REVEALING:"text-revealing",SLIDER:"slider",PARTICLES:"particles",SPRITESHEET_ANIMATION:"spritesheet-animation",VIDEO:"video"};var Ge={fill:"black",fontFamily:"Arial",fontSize:16,align:"left",lineHeight:1.2,wordWrap:!1,breakWords:!1,strokeColor:"transparent",strokeWidth:0,wordWrapWidth:0};var oI={color:"black",alpha:1,blur:0,offsetX:2,offsetY:2},jN=(t={})=>{let e=typeof t.stroke=="object"&&t.stroke!==null?t.stroke:{};return{...e,color:t.strokeColor??e.color??Ge.strokeColor,width:t.strokeWidth??e.width??Ge.strokeWidth}},qN=t=>{if(t===void 0)return;if(t===null||t===!1)return null;let e=typeof t=="object"&&t!==null?{...oI,...t}:oI,r=e.offsetX,i=e.offsetY,s=Math.hypot(r,i);return{alpha:e.alpha,angle:s===0?0:Math.atan2(i,r),blur:e.blur,color:e.color,distance:s}},KN=t=>t?Math.ceil(Math.max(0,t.blur)+t.distance):0,Ft=(t={},e={})=>{let r=e.includeShadow!==!1,{strokeColor:i,strokeWidth:s,stroke:o,shadow:n,...a}=t;delete a.dropShadow;let l={...a,stroke:jN({strokeColor:i,strokeWidth:s,stroke:o})};if(r){let c=qN(n),u=KN(c),h=Math.max(a.padding??0,u);n!==void 0&&(l.dropShadow=c),h>0&&(l.padding=h)}return l};var vi=(t,e)=>{let r={fill:e?.fill??Ge.fill,fontFamily:e?.fontFamily??Ge.fontFamily,fontSize:e?.fontSize??Ge.fontSize,align:e?.align??Ge.align,lineHeight:e?.lineHeight??Ge.lineHeight,wordWrap:e?.wordWrap??Ge.wordWrap,breakWords:e?.breakWords??Ge.breakWords,strokeColor:e?.strokeColor??Ge.strokeColor,strokeWidth:e?.strokeWidth??Ge.strokeWidth,wordWrapWidth:e?.wordWrapWidth??Ge.wordWrapWidth,...Object.prototype.hasOwnProperty.call(e??{},"shadow")?{shadow:e.shadow}:{}};t.style=Ft(r)};var xo=(t=0)=>t*Math.PI/180,I_=(t=0)=>t*180/Math.PI,nI=t=>typeof t=="number"&&Number.isFinite(t)&&t!==0?t:1,Nf=t=>({x:Math.round((t.x??0)+(t.originX??0)),y:Math.round((t.y??0)+(t.originY??0))}),kr=(t,e)=>{let r=e.originX??0,i=e.originY??0,s=nI(t.scale?.x),o=nI(t.scale?.y),n=Nf(e);t.pivot?.set?.(r/s,i/o),t.x=n.x,t.y=n.y,t.rotation=xo(e.rotation??0)},Ur=(t,e={})=>{let r=Nf(t),i={x:r.x,y:r.y,...e};return t.rotation!==void 0&&(i.rotation=t.rotation),i};var Ts=t=>t==="translateX"||t==="translateY",cI=(t,e)=>typeof e!="string"?e:t[e]??e,ZN=(t,e,r,i)=>{let s=cI(r,e);if(typeof s=="string"){let n=t[s];return n===void 0?i:e==="rotation"?I_(n):n}let o=t;for(let n of s){if(o==null)return i;o=o[n]}return o===void 0?i:e==="rotation"?I_(o):o},QN=(t,e,r,i)=>{let s=cI(r,e),o=e==="rotation"?xo(i):i;if(typeof s=="string")return t[s]=o,t;let n=t;for(let a=0;a<s.length-1;a++){let l=s[a];l in n||(n[l]={}),n=n[l]}return n[s[s.length-1]]=o,t},aI=t=>typeof t=="number"&&Number.isFinite(t),JN=t=>{let e=t?.getLocalBounds?.();return e?.rectangle??e??null},lI=(t,e)=>{let r=e==="x"?t?.width:t?.height;if(aI(r)&&r>0)return r;let i=JN(t),s=e==="x"?i?.width:i?.height,o=e==="x"?t?.scale?.x:t?.scale?.y;return aI(s)&&s>0?Math.abs(s*(o??1)):0},Ss=t=>({x:t?.x??0,y:t?.y??0,width:lI(t,"x"),height:lI(t,"y")}),uI=({object:t,property:e,propertyPathMap:r,subjectState:i,defaultValue:s=0})=>e==="translateX"||e==="translateY"?s:ZN(t,e,r,s),lu=({object:t,property:e,propertyPathMap:r,subjectState:i,value:s})=>e==="translateX"?(t.x=i.x+s*i.width,t):e==="translateY"?(t.y=i.y+s*i.height,t):QN(t,e,r,s);var hI=(t,e,r=Df,i)=>{let s=i;for(let o of e)for(let[n,a]of Object.entries(o.tween)){if(!Gf[n])throw new Error(`${n} is not a supported property for animation.`);a.initialValue!==void 0&&(!s&&Ts(n)&&(s=Ss(t)),lu({object:t,property:n,propertyPathMap:r,subjectState:s,value:a.initialValue}))}},Vf=({animations:t,animationBus:e,completionTracker:r,element:i,targetState:s,onComplete:o,animationBaseState:n})=>{for(let a of t){if(typeof e?.hasContext=="function"&&e.hasContext(a.id))continue;for(let[u,h]of Object.entries(a.tween))if(h.auto&&(!s||!Object.prototype.hasOwnProperty.call(s,u)))throw new Error(`Animation "${a.id}" cannot auto-resolve property "${u}" from targetState.`);let l=a.playback?.continuity!=="persistent",c=l?r.getVersion():null;l&&r.track(c),e.dispatch({type:"START",payload:{id:a.id,animationType:a.type,targetId:a.targetId,continuity:a.playback?.continuity??"render",playbackSpeed:a.playback?.speed,signature:a.signature??JSON.stringify({type:a.type,tween:a.tween,playback:a.playback??null}),element:i,properties:a.tween,targetState:s,animationBaseState:n,onComplete:()=>{l&&r.complete(c),o?.(a)}}})}};var e3=t=>{if(!t?.dropShadow||typeof t.clone!="function")return t;let e=t.clone();return e.dropShadow=null,e};function Hf(t,e){let r=t.text.substring(0,e),s=Ve.measureText(r,e3(t.style)).width;return t.x+s}var t3=async(t,e)=>new Promise((r,i)=>{if(e?.aborted)return i(new DOMException("The operation was aborted.","AbortError"));let s,o=()=>{s&&e?.removeEventListener("abort",s)},n=setTimeout(()=>{o(),r()},t);s=()=>{clearTimeout(n),o(),i(e.reason)},e?.addEventListener("abort",s,{once:!0})}),Wf=t3;var cu={softness:1.25,easing:"linear",lineOverlap:0,lineDelay:0},r3=18,i3=64,F_={linear:t=>t,easeOutCubic:t=>1-(1-t)**3},s3=(t,e,r)=>Math.max(e,Math.min(r,t)),B_=(t,e)=>typeof t=="number"&&Number.isFinite(t)?t:e,yo=(t={})=>{let e=t&&typeof t=="object"?t:{};return{softness:Math.max(0,B_(e.softness,cu.softness)),easing:Object.prototype.hasOwnProperty.call(F_,e.easing)?e.easing:cu.easing,lineOverlap:s3(B_(e.lineOverlap,cu.lineOverlap),0,.95),lineDelay:Math.max(0,B_(e.lineDelay,cu.lineDelay))}},k_=t=>F_[t]??F_[cu.easing],U_=({maxLineHeight:t,softWipe:e})=>Math.max(r3,Math.min(i3,Math.round(t*e.softness)));var sa=(t,e,r,i)=>{if(!r)return;let s=o=>{o?.detail?.elementId===e&&typeof o?.detail?.frameIndex=="number"&&(t.gotoAndStop(o?.detail?.frameIndex),i?.())};window.addEventListener("snapShotAnimatedSpriteFrame",s),t._snapShotKeyFrameHandler=s},_o=t=>{t._snapShotKeyFrameHandler&&(window.removeEventListener("snapShotAnimatedSpriteFrame",t._snapShotKeyFrameHandler),delete t._snapShotKeyFrameHandler)};var dI=(t={})=>{if(t.frame){let n=t.frame.w??0,a=t.frame.h??0,l=t.sourceSize?.w??n,c=t.sourceSize?.h??a,u={frame:{x:t.frame.x??0,y:t.frame.y??0,w:n,h:a},rotated:t.rotated??!1,trimmed:t.trimmed??!1,spriteSourceSize:{x:t.spriteSourceSize?.x??0,y:t.spriteSourceSize?.y??0,w:t.spriteSourceSize?.w??n,h:t.spriteSourceSize?.h??a},sourceSize:{w:l,h:c}};return t.anchor?u.anchor={x:t.anchor.x??0,y:t.anchor.y??0}:t.pivot&&(u.anchor={x:t.pivot.x??0,y:t.pivot.y??0}),t.borders&&(u.borders={...t.borders}),u}let e=t.width??t.w??0,r=t.height??t.h??0,i=t.sourceWidth??e,s=t.sourceHeight??r,o={frame:{x:t.x??0,y:t.y??0,w:e,h:r},rotated:t.rotated??!1,trimmed:t.trimmed??!1,spriteSourceSize:{x:t.offsetX??0,y:t.offsetY??0,w:e,h:r},sourceSize:{w:i,h:s}};return t.anchor?o.anchor={x:t.anchor.x??0,y:t.anchor.y??0}:t.pivot&&(o.anchor={x:t.pivot.x??0,y:t.pivot.y??0}),t.borders&&(o.borders={...t.borders}),o},O_=(t={})=>!t||typeof t!="object"?{}:Object.fromEntries(Object.entries(t).map(([e,r])=>[e,Array.isArray(r)?r.map(i=>String(i)):[]])),o3=(t,e={})=>{let r=Math.max(0,Number(e.from??0)),i=Math.min(t.length-1,Number(e.to??r));if(!Number.isFinite(r)||!Number.isFinite(i)||i<r)return[];let s=t.slice(r,i+1),o=String(e.direction??"forward").toLowerCase();if(o==="reverse"||o==="backward")return[...s].reverse();if(o==="pingpong")return[...s,...s.slice(1,-1).reverse()];if(o==="pingpong_reverse"){let n=[...s].reverse();return[...n,...n.slice(1,-1).reverse()]}return s},n3=(t=[],e=[])=>!Array.isArray(t)||e.length===0?{}:Object.fromEntries(t.map(r=>{let i=typeof r?.name=="string"?r.name:"";return i?[i,o3(e,r)]:null}).filter(Boolean)),Kr=(t={})=>{let e=t??{},r=O_(e.animations);return{frames:Array.isArray(e.frames)?Object.fromEntries(e.frames.map(s=>{let o=s?.filename??s?.name;return typeof o!="string"||o.length===0?null:[o,dI(s)]}).filter(Boolean)):Object.fromEntries(Object.entries(e.frames??{}).map(([s,o])=>[s,dI(o)])),...Object.keys(r).length>0?{animations:r}:{},meta:{...e.meta??{},scale:String(e.scale??e.meta?.scale??1),...e.width!=null||e.height!=null?{size:{w:e.width??e.meta?.size?.w??0,h:e.height??e.meta?.size?.h??0}}:{}}}},Zr=(t={},e={},r={},i=[])=>({...n3(r?.frameTags,i),...O_(e),...O_(t)}),a3=(t,e)=>{if(!Array.isArray(e?.frames))return[];let r=Object.keys(t.frames??{});return e.frames.map(i=>typeof i=="number"?r[i]:String(i)).filter(Boolean)},Or=({atlas:t={frames:{}},clips:e={},playback:r,legacyAnimation:i})=>{let s=r??i??{},o={fps:s.fps??null,loop:s.loop??!0,autoplay:s.autoplay??!0};return typeof s.clip=="string"&&s.clip.length>0&&(o.clip=s.clip),Array.isArray(s.frames)?o.frames=s.frames.map(n=>typeof n=="number"?Object.keys(t.frames??{})[n]:String(n)).filter(Boolean):o.clip||(o.frames=a3(t,i)),o.fps==null&&(typeof s.animationSpeed=="number"?o.fps=s.animationSpeed*60:o.fps=30),o.clip&&(!Array.isArray(o.frames)||o.frames.length===0)&&(o.frames=Array.isArray(e[o.clip])?[...e[o.clip]]:[]),Array.isArray(o.frames)||(o.frames=[]),o},oa=({spritesheet:t,atlas:e,clips:r={},playback:i,legacyAnimation:s})=>{let o=Or({atlas:e,clips:r,playback:i,legacyAnimation:s});return{frameTextures:o.frames.map(a=>t.textures[a]),playback:o}},na=t=>typeof t=="number"?t/60:.5;var Wi=Symbol("textRevealRuntime"),zf=Symbol("textRevealSnapshot"),aa=Symbol("textRevealIndicator"),xI=Symbol("textRevealIndicatorPlayback"),D_=50,l3=0,H_=100,L_=H_-1,fI=10,yI=120,c3=.9,u3=360,h3=1.2,G_=20,d3=16,f3=0,p3=(t,e,r)=>Math.max(e,Math.min(r,t)),_I=(t=D_)=>typeof t!="number"||!Number.isFinite(t)?D_:Math.max(l3,Math.min(H_,t)),m3=t=>_I(t)>=H_,W_=(t,{maxRate:e=yI,curve:r=c3}={})=>{let i=Math.min(_I(t),L_),o=(L_>0?i/L_:0)**r;return fI*(e/fI)**o},g3=t=>W_(t,{maxRate:u3,curve:h3}),x3=t=>{let e=1e3/t;return e>=G_||t<=yI?{stepDelay:Math.max(1,Math.floor(e)),charactersPerStep:1}:{stepDelay:G_,charactersPerStep:Math.max(2,Math.round(t*G_/1e3))}},y3=t=>t?.revealEffect==="softWipe"?"softWipe":"typewriter",z_=t=>{let e=t?.initialRevealedCharacters;return typeof e!="number"||!Number.isFinite(e)?0:Math.max(0,Math.floor(e))},_3=t=>(t?.content??[]).reduce((e,r)=>e+(r.lineParts??[]).reduce((i,s)=>i+(s.text?.length??0),0),0),la=t=>t?.revealEffect==="none"||m3(t?.speed??D_),N_=t=>t!==null&&typeof t=="object"&&typeof t.then=="function",$_=(t={})=>t.kind??(t.atlas!==void 0||t.clips!==void 0||t.playback!==void 0?"spritesheet":"image"),b3=t=>["revealing","complete"].some(e=>$_(t?.indicator?.[e])==="spritesheet"&&!!t?.indicator?.[e]?.src),bI=t=>`${t.id}-indicator`,vI=(t,e,r)=>{typeof e?.width=="number"?t.width=e.width:r?.width&&(t.width=r.width),typeof e?.height=="number"?t.height=e.height:r?.height&&(t.height=r.height)},TI=(t={})=>{let e=t?.src?F.from(t.src):F.EMPTY,r=new Re(e);return vI(r,t,e),r},v3=(t={},{app:e,element:r})=>{if(!t?.src)return TI(t);let i=Kr(t.atlas),s=Zr(t.clips,t.atlas?.animations,t.atlas?.meta,Object.keys(i.frames??{})),o=Or({atlas:i,clips:s,playback:t.playback});return(async()=>{let n=new hi(F.from(t.src),i);await n.parse();let{frameTextures:a}=oa({spritesheet:n,atlas:i,clips:s,playback:o}),l=new vs(a.length>0?a:[F.EMPTY]);return l.animationSpeed=na(o.fps),l.loop=o.loop,l[xI]=o,vI(l,t,a[0]),e?.debug&&sa(l,bI(r),e.debug,()=>{typeof e.render=="function"&&e.render()}),l})()},pI=(t,e)=>$_(t)==="spritesheet"?v3(t,e):TI(t),mI=(t,e)=>{t instanceof vs&&!e?.debug&&t[xI]?.autoplay!==!1&&t.play()},SI=t=>{!t||t.destroyed||(_o(t),typeof t.stop=="function"&&t.stop(),t.destroy({children:!0}))},V_=t=>{let e=t?.[aa];if(e){for(let r of e.displays)_o(r);for(let r of e.displays)r?.parent!==t&&SI(r);delete t[aa]}t.destroy({children:!0})},T3=({element:t,app:e,revealingDisplay:r,completeDisplay:i})=>{let s=new ee({label:bI(t)}),o=new Set([r]);return i&&o.add(i),s.addChild(r),s[aa]={displays:o,currentDisplay:r,completeDisplay:i,start(){mI(this.currentDisplay,e)},showComplete(){if(!this.completeDisplay||this.currentDisplay===this.completeDisplay)return;let n=this.currentDisplay;n?.parent===s&&s.removeChild(n),SI(n),o.delete(n),this.currentDisplay=this.completeDisplay,s.addChild(this.completeDisplay),mI(this.completeDisplay,e)}},s},S3=(t,{app:e}={})=>{let r=t?.indicator?.revealing??{},i=t?.indicator?.complete,s=pI(r,{app:e,element:t}),o=i?.src||$_(i)==="spritesheet"?pI(i,{app:e,element:t}):null,n=(a,l)=>T3({element:t,app:e,revealingDisplay:a,completeDisplay:l});return N_(s)||N_(o)?Promise.all([s,o]).then(([a,l])=>n(a,l)):n(s,o)},w3=t=>{t?.[aa]?.showComplete()},ca=t=>({x:t?.indicator?.offsetX??d3,y:t?.indicator?.offsetY??f3}),E3=(t,e)=>{if(!e)return 0;let r=Math.max(0,e.lineMaxHeight??0),i=Math.max(0,t?.height??0);return e.y+Math.max(0,r-i)},zi=(t,e,r)=>{t.x=r.x,t.y=E3(t,e)+r.y},wI=(t,e,r)=>{if(!e||e.text.length===0){t.x=r.x;return}t.x=Hf(e,e.text.length-1)+r.x},ws=(t,e,r,i)=>{w3(t),zi(t,e,i),wI(t,r,i)},A3=(t,e)=>{if(t[Wi]){let r=t[Wi];delete t[Wi],r()}t[Wi]=e},P3=t=>t?.[zf]??null,uu=(t,e)=>t?e?(t[zf]=e,e):(delete t[zf],null):null,EI=t=>{let e=P3(t);return!e||e.mode!=="typewriter"||e.completed===!0?null:e},AI=t=>!!EI(t),X_=t=>{if(t[Wi]){let r=t[Wi];delete t[Wi],r()}delete t[zf],t.onRender=void 0,t.removeChildren().forEach(r=>{if(r?.[aa]){V_(r);return}r.destroy({children:!0})})},Y_=(t,e="",r="")=>{let i=new Be(Ft(t.textStyle)),s=new br({text:e,style:i,x:Math.round(t.x),y:Math.round(t.y)}),o=null;if(t.furigana){let n=new Be(Ft(t.furigana.textStyle));o=new br({text:r,style:n,x:Math.round(t.furigana.x),y:Math.round(t.furigana.y)})}return{text:s,furiganaText:o}},j_=(t,e)=>{let r=null,i=null,s=0,o=0,n=[];for(let a=0;a<e.content.length;a++){let l=e.content[a],c=new ee({label:`${e.id}-line-${a}`}),u=[],h=null,d=0;t.addChild(c),i=l,o=Math.max(o,l.lineMaxHeight??0);for(let f=0;f<l.lineParts.length;f++){let g=l.lineParts[f],{text:m,furiganaText:x}=Y_(g,g.text,g.furigana?.text||"");x&&(c.addChild(x),u.push(x)),c.addChild(m),u.push(m),r=m,h=m,s+=g.text.length,d+=g.text.length}if(u.length>0){let f=c.getLocalBounds();n.push({chunk:l,container:c,lastTextObject:h,totalCharacters:d,bounds:{x:f.x,y:f.y,width:f.width,height:f.height}})}else c.destroy()}return{lines:n,lastTextObject:r,lastChunk:i,totalCharacters:s,maxLineHeight:o,bounds:t.getLocalBounds()}},gI=({contentContainer:t,indicatorSprite:e,element:r})=>{let i=ca(r),{lastTextObject:s,lastChunk:o}=j_(t,r);ws(e,o,s,i)},C3=({contentContainer:t,indicatorSprite:e,element:r,revealedCharacters:i})=>{let s=ca(r),o=r.content[0]??null,n=_3(r),a=Math.min(i,Math.max(0,n)),l=null,c=null;if(a<=0){zi(e,o,s);return}e:for(let u=0;u<r.content.length;u++){let h=r.content[u];for(let d=0;d<h.lineParts.length;d++){let f=h.lineParts[d],g=Math.min(f.text.length,a);if(g<=0)break e;let m=f.furigana?.text||"",x=m.length,v=f.text.length>0?Math.round(g/f.text.length*x):0,{text:_,furiganaText:p}=Y_(f,f.text.substring(0,g),m.substring(0,v));if(p&&t.addChild(p),t.addChild(_),l=_,c=h,a-=g,g<f.text.length)break e}}c?(zi(e,c,s),wI(e,l,s)):zi(e,o,s),i>=n&&ws(e,c??o,l,s)},R3=({contentContainer:t,indicatorSprite:e,element:r})=>{let i=z_(r);if(i<=0){let s=ca(r),o=r.content[0]??null;zi(e,o,s);return}r.revealEffect==="softWipe"?k3({contentContainer:t,indicatorSprite:e,element:r,revealedCharacters:i}):C3({contentContainer:t,indicatorSprite:e,element:r,revealedCharacters:i})},M3=async({contentContainer:t,indicatorSprite:e,element:r,signal:i,startAtCharacter:s=0,snapshot:o=null})=>{let n=g3(r.speed??50),a=ca(r),{stepDelay:l,charactersPerStep:c}=x3(n),u=Math.max(l,Math.floor(4e3/n)),h=Math.max(0,Math.floor(s)),d=!1,f=null,g=null;o&&(o.revealedCharacters=h,o.completed=!1);for(let m=0;m<r.content.length;m++){if(i?.aborted||t.destroyed)return!1;let x=r.content[m],v=!1;zi(e,x,a);for(let _=0;_<x.lineParts.length;_++){if(i?.aborted||t.destroyed)return!1;let p=x.lineParts[_],{text:b,furiganaText:y}=Y_(p);y&&t.addChild(y),t.addChild(b);let S=p.text,E=p.furigana?.text||"";S.length>0&&(f=b,g=x);let P=E.length,C=Math.min(S.length,h),M=S.length>0?Math.round(C/S.length*P):0;b.text=S.substring(0,C),y&&(y.text=E.substring(0,M)),h-=C,C>0&&(e.x=Hf(b,C-1)+a.x);let R=C;for(;R<S.length;){if(i?.aborted||t.destroyed)return!1;let B=Math.min(S.length,R+c),A=B-1;if(b.text=S.substring(0,B),e.x=Hf(b,A)+a.x,v=!0,d=!0,o&&(o.revealedCharacters+=B-R),y){let O=Math.round(B/S.length*P);y.text=E.substring(0,O)}R=B,R<S.length&&await Wf(l,i)}}m<r.content.length-1&&v&&await Wf(u,i)}return d&&(await Wf(l,i),i?.aborted||t.destroyed)?!1:(ws(e,g,f,a),o&&(o.completed=!0),!0)},PI=({lines:t,edgeWidth:e,baseDuration:r,softWipe:i})=>{let s=t.map(c=>{let u=Math.max(1,c.totalCharacters),h=1+e/Math.max(1,c.bounds.width);return u*h}),o=s.reduce((c,u)=>c+u,0),n=[],a=0,l=0;for(let c=0;c<t.length;c++){let u=s[c],h=o>0?Math.max(1,r*u/o):r,d=Math.max(0,a),f=d+h;n.push({...t[c],startTime:d,endTime:f,duration:h}),l=Math.max(l,f),a=f-h*i.lineOverlap+i.lineDelay}return{timedLines:n,duration:Math.max(1,Math.ceil(l))}},I3=({currentTime:t,line:e,easing:r})=>{let i=e.duration>0?(t-e.startTime)/e.duration:1;return r(Math.max(0,Math.min(i,1)))},B3=({progress:t,easingName:e})=>{let r=p3(t,0,1);return e==="easeOutCubic"?1-Math.cbrt(1-r):r},CI=({timedLines:t,initialRevealedCharacters:e,softWipe:r,easingName:i})=>{let s=Math.max(0,Math.floor(e)),o=s<=0,n=0,a=0;return{timedLines:t.map(c=>{let u=Math.max(0,c.totalCharacters??0),h=0,d=!1;if(!o&&s>0)if(u<=0||s>=u)s-=u,h=1,d=!0;else{let m=s/u;h=B3({progress:m,easingName:i}),s=0,o=!0}if(d)return{...c,startTime:-c.duration,endTime:0};o=!0;let f=h>0?-h*c.duration:Math.max(0,n),g=f+c.duration;return a=Math.max(a,g),n=g-c.duration*r.lineOverlap+r.lineDelay,{...c,startTime:f,endTime:g}}),duration:Math.max(1,Math.ceil(a))}},F3=t=>{t.forEach(e=>{e&&(e.line.container.mask===e.sprite&&(e.line.container.mask=null),e.sprite.parent&&e.sprite.parent.removeChild(e.sprite),e.sprite.destroy(),e.texture.destroy(!0))})},RI=({contentContainer:t,timedLines:e,edgeWidth:r})=>{let i=e.map(s=>{let o=document.createElement("canvas");o.width=Math.max(1,Math.ceil(s.bounds.width+r)),o.height=Math.max(1,Math.ceil(s.bounds.height));let n=o.getContext("2d");if(!n)return null;let a=go(o),l=new Re(a);return l.x=Math.floor(s.bounds.x-r),l.y=Math.floor(s.bounds.y),s.container.mask=l,t.addChild(l),{canvas:o,context:n,texture:a,sprite:l,line:s,edgeWidth:r}});return i.some(s=>s===null)?(F3(i),null):i},MI=({timedLines:t,lineMasks:e,easing:r,indicatorSprite:i,indicatorOffsets:s,currentTime:o})=>{let n=t[0],a=n.bounds.x;for(let l=0;l<t.length;l++){let c=t[l],u=e[l],h=I3({currentTime:o,line:c,easing:r}),{context:d,canvas:f,texture:g}=u;if(d.clearRect(0,0,f.width,f.height),h<=0){g.source.update();continue}let m=0,x=c.bounds.width+u.edgeWidth,v=u.edgeWidth,_=v+h*x,p=Math.max(v,_-u.edgeWidth);p>v&&(d.fillStyle="#ffffff",d.fillRect(v,m,Math.min(p-v,c.bounds.width),c.bounds.height));let b=Math.max(v,_-u.edgeWidth),y=Math.min(v+c.bounds.width,_);if(y>b){let S=d.createLinearGradient(b,0,y,0);S.addColorStop(0,"rgba(255, 255, 255, 1)"),S.addColorStop(1,"rgba(255, 255, 255, 0)"),d.fillStyle=S,d.fillRect(b,m,y-b,c.bounds.height)}g.source.update(),n=c,a=c.bounds.x+Math.min(x,Math.max(0,_-v))}zi(i,n.chunk,s),i.x=a+s.x},k3=({contentContainer:t,indicatorSprite:e,element:r,revealedCharacters:i})=>{let s=ca(r),{lines:o,lastTextObject:n,lastChunk:a,totalCharacters:l,maxLineHeight:c}=j_(t,r);if(zi(e,a,s),o.length===0||l===0||i>=l||!o.some(_=>_.bounds.width>0&&_.bounds.height>0)||!globalThis.document){ws(e,a,n,s);return}let u=yo(r.softWipe),h=k_(u.easing),d=U_({maxLineHeight:c,softWipe:u}),f=W_(r.speed??50),g=Math.max(1,Math.round(l/f*1e3)),m=PI({lines:o,edgeWidth:d,baseDuration:g,softWipe:u}),{timedLines:x}=CI({timedLines:m.timedLines,initialRevealedCharacters:i,softWipe:u,easingName:u.easing}),v=RI({contentContainer:t,timedLines:x,edgeWidth:d});if(!v){ws(e,a,n,s);return}MI({timedLines:x,lineMasks:v,easing:h,indicatorSprite:e,indicatorOffsets:s,currentTime:0})},U3=({container:t,contentContainer:e,indicatorSprite:r,element:i,animationBus:s,completionTracker:o})=>{let n=ca(i),a=W_(i.speed??50),{lines:l,lastTextObject:c,lastChunk:u,totalCharacters:h,maxLineHeight:d}=j_(e,i),f=z_(i);if(zi(r,u,n),l.length===0||h===0||f>=h||!l.some(R=>R.bounds.width>0&&R.bounds.height>0)||!globalThis.document||!s)return ws(r,u,c,n),!1;let g=yo(i.softWipe),m=k_(g.easing),x=U_({maxLineHeight:d,softWipe:g}),v=Math.max(1,Math.round(h/a*1e3)),_=PI({lines:l,edgeWidth:x,baseDuration:v,softWipe:g}),{timedLines:p,duration:b}=CI({timedLines:_.timedLines,initialRevealedCharacters:f,softWipe:g,easingName:g.easing}),y=o.getVersion(),S=`${i.id}-soft-wipe`,E=RI({contentContainer:e,timedLines:p,edgeWidth:x});if(!E)return ws(r,u,c,n),!1;let P=!1,C=R=>{P||(P=!0,t[Wi]===M&&delete t[Wi],E.forEach(B=>{B.line.container.mask===B.sprite&&(B.line.container.mask=null),B.sprite.parent&&B.sprite.parent.removeChild(B.sprite),B.sprite.destroy(),B.texture.destroy(!0)}),R&&ws(r,u,c,n))},M=()=>{s.dispatch({type:"CANCEL",id:S}),C(!1)};return A3(t,M),o.track(y),s.dispatch({type:"START",payload:{id:S,driver:"custom",duration:b,applyFrame:R=>{MI({timedLines:p,lineMasks:E,easing:m,indicatorSprite:r,indicatorOffsets:n,currentTime:Math.min(b,R)})},applyTargetState:()=>{C(!1)},onComplete:()=>{o.complete(y),C(!0)},onCancel:()=>{o.complete(y),C(!1)},isValid:()=>!!t&&!t.destroyed&&!e.destroyed&&!r.destroyed}}),!0},$i=async({container:t,element:e,completionTracker:r,animationBus:i,zIndex:s,signal:o,app:n,playback:a="autoplay"})=>{if(o?.aborted||t.destroyed)return;let l=la(e),c=a==="resume"?EI(t):null,u=z_(e);if(a==="resume"&&!c)return;let h=r?.getVersion?.(),d=b3(e),f=!1,g=()=>{!d||f||(r?.track?.(h),f=!0)},m=()=>{f&&(f=!1,r?.complete?.(h))};g(),X_(t),t.zIndex=s;let x=new ee({label:`${e.id}-content`}),v;try{let _=S3(e,{app:n});if(v=N_(_)?await _:_,o?.aborted||t.destroyed){V_(v),m();return}if(t.addChild(x),t.addChild(v),v?.[aa]?.start(),a==="paused-initial"){l||uu(t,{mode:y3(e),revealedCharacters:u,completed:!1}),l?(uu(t,{mode:"none",completed:!0}),gI({contentContainer:x,indicatorSprite:v,element:e})):R3({contentContainer:x,indicatorSprite:v,element:e}),m();return}let p=r.getVersion(),b=!1;if(l)r.track(p),m(),uu(t,{mode:"none",completed:!0}),gI({contentContainer:x,indicatorSprite:v,element:e}),b=!0;else if(e.revealEffect==="softWipe")if(uu(t,{mode:"softWipe",revealedCharacters:u,completed:!1}),!U3({container:t,contentContainer:x,indicatorSprite:v,element:e,animationBus:i,completionTracker:r})&&!o?.aborted&&!t.destroyed)r.track(p),m(),b=!0;else{m();return}else{r.track(p),m();let y=c?.revealedCharacters??u,S=uu(t,{mode:"typewriter",revealedCharacters:y,completed:!1});b=await M3({contentContainer:x,indicatorSprite:v,element:e,signal:o,startAtCharacter:y,snapshot:S})}b&&!o?.aborted&&!t.destroyed&&r.complete(p)}catch(_){if(m(),v&&!v.destroyed&&!v.parent&&V_(v),_?.name!=="AbortError"&&!o?.aborted)throw _}};var $f=({suppressAnimations:t=!1,deferredMountOperations:e=[]}={})=>({suppressAnimations:t,deferredMountOperations:e}),II=t=>{switch(t?.type){case"play-animated-sprite":t.animatedSprite?.destroyed||t.animatedSprite?.play();return;case"play-video":t.video?.play();return;case"start-particles":if(t.app?.debug){let e=r=>{if(t.emitter.destroyed){window.removeEventListener("snapShotKeyFrame",e);return}r?.detail?.deltaMS&&(t.emitter.update(Number(r.detail.deltaMS)/1e3),typeof t.app?.render=="function"&&t.app.render())};window.addEventListener("snapShotKeyFrame",e),t.container.customTickerHandler=e;return}t.app.ticker.add(t.tickerCallback);return;case"autoplay-text-reveal":$i({container:t.container,element:t.element,completionTracker:t.completionTracker,animationBus:t.animationBus,zIndex:t.zIndex,signal:t.signal,app:t.app,playback:"autoplay"});return;case"start-update-animations":if(!t.element||t.element.destroyed)return;Vf({animations:t.animations,animationBus:t.animationBus,completionTracker:t.completionTracker,element:t.element,targetState:t.targetState,animationBaseState:t.animationBaseState});return}},hu=(t,e)=>{if(e?.type){if(!t?.suppressAnimations){II(e);return}t.deferredMountOperations.push(e)}},du=t=>{t?.deferredMountOperations&&(t.deferredMountOperations.length=0)},BI=(t,e)=>hu(t,{type:"play-animated-sprite",animatedSprite:e}),FI=(t,e)=>hu(t,{type:"play-video",video:e}),kI=(t,{app:e,emitter:r,container:i,tickerCallback:s})=>hu(t,{type:"start-particles",app:e,emitter:r,container:i,tickerCallback:s}),Xf=(t,{app:e,container:r,element:i,completionTracker:s,animationBus:o,zIndex:n,signal:a})=>hu(t,{type:"autoplay-text-reveal",app:e,container:r,element:i,completionTracker:s,animationBus:o,zIndex:n,signal:a}),UI=(t,{animations:e,animationBus:r,completionTracker:i,element:s,targetState:o,animationBaseState:n})=>hu(t,{type:"start-update-animations",animations:e,animationBus:r,completionTracker:i,element:s,targetState:o,animationBaseState:n}),OI=t=>{if(!t?.deferredMountOperations?.length)return;let e=t.deferredMountOperations.splice(0);for(let r of e)II(r)};var O3=Object.prototype.hasOwnProperty,ge=(t,e)=>{if(Object.is(t,e))return!0;if(t===null||e===null||typeof t!="object"||typeof e!="object")return!1;let r=Array.isArray(t),i=Array.isArray(e);if(r!==i)return!1;if(r&&i){if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(!ge(t[n],e[n]))return!1;return!0}let s=Object.keys(t),o=Object.keys(e);if(s.length!==o.length)return!1;for(let n of s)if(!O3.call(e,n)||!ge(t[n],e[n]))return!1;return!0};var bo=t=>{let e=new Set;if(t.id&&e.add(t.id),t.children&&Array.isArray(t.children))for(let r of t.children)for(let i of bo(r))e.add(i);return e};var GI=(t=[])=>{if(t instanceof Map)return t;let e=new Map;for(let r of t)e.has(r.targetId)||e.set(r.targetId,[]),e.get(r.targetId).push(r);return e},Yf=(t,e)=>t?t instanceof Map?t.get(e)??[]:t.filter(r=>r.targetId===e):[],DI=(t,e)=>Yf(t,e).filter(r=>r.type==="update"),jf=(t,e)=>Yf(t,e).find(r=>r.type==="transition")??null,LI=(t=[])=>t.some(e=>Object.keys(e.tween??{}).some(Ts)),fu=(t=[],e,r=[])=>{for(let i of t){if(i?.id===e)return{element:i,ancestorIds:r};if(Array.isArray(i?.children)){let s=fu(i.children,e,[...r,i.id]);if(s)return s}}return null},NI=(t,e)=>ge(t?.ancestorIds??null,e?.ancestorIds??null),L3=({subtreeRoot:t,nextAnimations:e,continuingAnimationId:r})=>{if(!t)return!1;let i=bo(t);for(let s of e??[])if(!(!s||s.id===r)&&i.has(s.targetId))return!0;return!1},q_=(t={})=>t.type==="update"?JSON.stringify({type:t.type,tween:t.tween,playback:t.playback??null}):JSON.stringify({type:t.type,prev:t.prev??null,next:t.next??null,mask:t.mask??null,compositor:t.compositor??null,tween:t.tween??null,playback:t.playback??null}),G3=({prevState:t,nextState:e,animation:r})=>{let i=fu(t?.elements,r.targetId),s=fu(e?.elements,r.targetId);return i!==null&&s!==null&&NI(i,s)&&ge(i.element,s.element)},D3=({prevState:t,nextState:e,animation:r})=>{let i=fu(t?.elements,r.targetId),s=fu(e?.elements,r.targetId);return i===null&&s===null?!0:i===null||s===null||!NI(i,s)||!ge(i.element,s.element)?!1:!L3({subtreeRoot:s.element,nextAnimations:e?.animations,continuingAnimationId:r.id})},VI=({prevState:t,nextState:e,activeAnimations:r})=>{let i=new Set,s=r instanceof Map?r:new Map(r?.map(o=>[o.id,o])??[]);for(let o of e?.animations??[]){if(o?.playback?.continuity!=="persistent")continue;let n=s.get(o.id);if(n&&!(n.type!==o.type||n.targetId!==o.targetId||n.signature!==q_(o))){if(o.type==="update"){G3({prevState:t,nextState:e,animation:o})&&i.add(o.id);continue}D3({prevState:t,nextState:e,animation:o})&&i.add(o.id)}}return{continuedAnimationIds:i}},N3=({animations:t,targetId:e,animationBus:r,completionTracker:i,element:s,targetState:o,onComplete:n,renderContext:a})=>{let l=DI(t,e),c=l.filter(h=>typeof r?.hasContext=="function"?r.hasContext(h.id):!1),u=l.filter(h=>!c.includes(h));if(l.length===0)return!1;if(u.length===0)return!0;if(a?.suppressAnimations){if(n)throw new Error("Deferred update animations do not support onComplete hooks.");let h=LI(u)?Ss(s):void 0;return hI(s,u,void 0,h),UI(a,{animations:u,animationBus:r,completionTracker:i,element:s,targetState:o,animationBaseState:h}),!0}return Vf({animations:u,animationBus:r,completionTracker:i,element:s,targetState:o,onComplete:n,animationBaseState:LI(u)?Ss(s):void 0}),!0},ua=DI;var re=N3;var HI=t=>!!t&&typeof t=="object"&&!Array.isArray(t),V3=(t,e)=>e===void 0?t:e===null||e===!1?null:HI(e)?{...HI(t)?t:{},...e}:e,Ti=(t={},e={})=>{if(!e)return{...t};let r={...t,...e};return Object.prototype.hasOwnProperty.call(e,"shadow")&&(r.shadow=V3(t?.shadow,e.shadow)),r};var zI=Symbol("routeGraphicsTextAnchorRatios"),vo=Symbol("routeGraphicsTextLayoutState"),WI=(t,e)=>typeof t!="number"||t===0?0:e/t,K_=t=>t?.align??Ge.align,H3=t=>{let e=t[vo];return e?.fixedWidth&&typeof e.layoutWidth=="number"?e.layoutWidth:typeof e?.measuredWidth=="number"?e.measuredWidth:t.width},W3=(t,e)=>{let r=Ve.measureText(String(t??""),new Be(Ft(e,{includeShadow:!1})));return{width:r.width,height:r.height}},$I=t=>t?.shadow!==void 0&&t.shadow!==null&&t.shadow!==!1,J_=(t,e)=>$I(e)?W3(t.text,e):{width:t.width,height:t.height},Z_=t=>{let e=t[vo];return typeof e?.measuredWidth=="number"?e.measuredWidth:t.width},z3=t=>{let e=t[vo];return typeof e?.measuredHeight=="number"?e.measuredHeight:t.height},XI=(t,e,r)=>{let i=!!e.__fixedWidth,s=r??J_(t,e.textStyle),o=s.width??e.measuredWidth??e.width,n=s.height??e.height??t.height;t[vo]={fixedWidth:i,layoutWidth:i?e.width:o,measuredWidth:o,measuredHeight:n}},Q_=(t,e,r)=>{let i=Math.max(0,t-e);return r==="center"?i/2:r==="right"?i:0},eb=t=>{let e=t.measuredWidth??t.width,r=Q_(t.width,e,K_(t.textStyle));return{x:t.x+r,y:t.y}},qf=(t,e)=>{let r=J_(t,e.textStyle),i=e.__fixedWidth&&typeof e.width=="number"?e.width:r.width,s=r.height,o=typeof e.__anchorXRatio=="number"?e.__anchorXRatio:WI(i,e.originX),n=typeof e.__anchorYRatio=="number"?e.__anchorYRatio:WI(s,e.originY);t[zI]={x:o,y:n},XI(t,e,r)},$3=t=>typeof t?.fontSize!="number"||t.fontSize===0||typeof t?.lineHeight!="number"?Ge.lineHeight:t.lineHeight/t.fontSize,X3=(t,e)=>{if(!e)return t;let r=Ti(t,e);if(e.fontSize!==void 0||e.lineHeight!==void 0){let i=e.lineHeight??$3(t);r.lineHeight=Math.round(r.fontSize*i)}return r},YI=(t,e,r)=>{let i=t[zI],s=H3(t),o=X3(e,r);if(!i){vi(t,o);return}let n=Q_(s,Z_(t),K_(t.style)),l=t.x-n+s*i.x,c=t.y+z3(t)*i.y;vi(t,o);let u=J_(t,o),d=t[vo]?.fixedWidth===!0?s:u.width,f=Q_(d,u.width,K_(o));t.x=l-d*i.x+f,t.y=c-u.height*i.y,t[vo]={...t[vo]??{},layoutWidth:d,measuredWidth:u.width,measuredHeight:u.height}},Kf=(t,e)=>{XI(t,e);let r=$I(e.textStyle)?e.measuredWidth??Z_(t):Z_(t),i=eb({...e,measuredWidth:r,width:e.__fixedWidth&&typeof e.width=="number"?e.width:r});t.x=i.x,t.y=i.y};var $e=(t,e=100)=>Math.min(Math.max(t??e,0),100)/100;var jI=t=>{if(!(!t||typeof t!="object")){if(typeof t.button=="number")return t.button;if(typeof t.data?.button=="number")return t.data.button;if(typeof t.nativeEvent?.button=="number")return t.nativeEvent.button}},kt=t=>{let e=jI(t);return e===void 0||e===0},qI=t=>jI(t)===2;var tb=Symbol.for("routeGraphics.setInheritedHover"),KI=Symbol.for("routeGraphics.treeInheritedHoverActive"),rb=Symbol.for("routeGraphics.setInheritedPress"),ZI=Symbol.for("routeGraphics.treeInheritedPressActive"),ib=Symbol.for("routeGraphics.setInheritedRightPress"),QI=Symbol.for("routeGraphics.treeInheritedRightPressActive"),ha=t=>Array.isArray(t?.children)?t.children:[],sb=({displayObject:t,symbol:e,source:r,isActive:i})=>{let s=t?.[e];typeof s=="function"&&s(r,i)},Zf=({displayObject:t,symbol:e})=>{t&&e in t&&delete t[e]},ob=({displayObject:t,symbol:e,onStateChange:r})=>{let i=!1,s=new Set,o=({nextDirectActive:n=i,onInheritedChange:a})=>{let l=i||s.size>0;i=n,a?.(s);let c=i||s.size>0;return l!==c&&r(c),c};return t[e]=(n,a)=>o({onInheritedChange:l=>{if(n){if(a){l.add(n);return}l.delete(n)}}}),{setDirectState:n=>o({nextDirectActive:n}),isActive:()=>i||s.size>0,destroy:()=>{Zf({displayObject:t,symbol:e})}}},da=t=>Zf({displayObject:t,symbol:tb}),Qf=t=>Zf({displayObject:t,symbol:rb}),Jf=t=>Zf({displayObject:t,symbol:ib}),Es=({displayObject:t,onHoverChange:e})=>{let r=ob({displayObject:t,symbol:tb,onStateChange:e});return{setDirectHover:r.setDirectState,isHovering:r.isActive,destroy:r.destroy}},fa=({displayObject:t,onPressChange:e})=>{let r=ob({displayObject:t,symbol:rb,onStateChange:e});return{setDirectPress:r.setDirectState,isPressed:r.isActive,destroy:r.destroy}},pa=({displayObject:t,onPressChange:e})=>{let r=ob({displayObject:t,symbol:ib,onStateChange:e});return{setDirectPress:r.setDirectState,isPressed:r.isActive,destroy:r.destroy}},nb=t=>t?.[KI]===!0,ab=t=>t?.[ZI]===!0,lb=t=>t?.[QI]===!0,ma=({root:t,isHovered:e})=>{if(!t)return;t[KI]=e;let r=[...ha(t)];for(;r.length>0;){let i=r.pop();sb({displayObject:i,symbol:tb,source:t,isActive:e}),r.push(...ha(i))}},To=({root:t,isPressed:e})=>{if(!t)return;t[ZI]=e;let r=[...ha(t)];for(;r.length>0;){let i=r.pop();sb({displayObject:i,symbol:rb,source:t,isActive:e}),r.push(...ha(i))}},Xi=({root:t,isPressed:e})=>{if(!t)return;t[QI]=e;let r=[...ha(t)];for(;r.length>0;){let i=r.pop();sb({displayObject:i,symbol:ib,source:t,isActive:e}),r.push(...ha(i))}};var JI="__rtglScrollHandled",eB=t=>t?.payload&&typeof t.payload=="object"?t.payload:{},Lr=({canvas:t,displayObject:e,width:r,height:i,scrollUpEvent:s,scrollDownEvent:o,eventHandler:n})=>{if(!s&&!o)return;let a=!1,l=Number.isFinite(r)&&Number.isFinite(i)&&r>0&&i>0;e.eventMode="static",l&&(e.hitArea=new Q(0,0,Math.round(r),Math.round(i)));let c=(g,m)=>{m?.[JI]||(m&&(m[JI]=!0),g<0&&s&&n?n("scrollUp",{_event:{id:e.label},...eB(s)}):g>0&&o&&n&&n("scrollDown",{_event:{id:e.label},...eB(o)}))},u=()=>{a=!0},h=()=>{a=!1},d=g=>{g.preventDefault?.(),c(g.deltaY,g.nativeEvent)},f=g=>{a&&(g.preventDefault(),c(g.deltaY,g))};e.on("pointerover",u),e.on("pointerout",h),e.on("wheel",d),t?.addEventListener("wheel",f,{passive:!1}),e._cleanupScrollInteraction=()=>{a=!1,e.off("pointerover",u),e.off("pointerout",h),e.off("wheel",d),t?.removeEventListener("wheel",f),l&&(e.hitArea=null),delete e._cleanupScrollInteraction}},cb=({root:t})=>{t?._cleanupScrollInteraction?.(),t?.children?.forEach(e=>{cb({root:e})})};var ga=t=>{t._cleanupScrollInteraction?.(),t.removeAllListeners("pointerover"),t.removeAllListeners("pointerout"),t.removeAllListeners("pointerdown"),t.removeAllListeners("pointerupoutside"),t.removeAllListeners("pointerup"),t.removeAllListeners("rightdown"),t.removeAllListeners("rightclick"),t.removeAllListeners("rightup"),t.removeAllListeners("rightupoutside"),t.removeAllListeners("wheel"),da(t),Qf(t),Jf(t),t.cursor="auto",t.eventMode="auto"},pu=({app:t,displayObject:e,textComputedNode:r,eventHandler:i,applyStyle:s})=>{let o=r?.hover,n=r?.click,a=r?.rightClick,l=r?.scrollUp,c=r?.scrollDown,u=null,h=null,d=null,f=()=>{let g=u?.isHovering()??!1,m=h?.isPressed()??!1;(d?.isPressed()??!1)&&a?.textStyle?s(a.textStyle):m&&n?.textStyle?s(n.textStyle):g&&o?.textStyle?s(o.textStyle):s()};if(o){let{cursor:g,soundSrc:m,payload:x}=o;e.eventMode="static",u=Es({displayObject:e,onHoverChange:f});let v=()=>{u.setDirectHover(!0),x&&i&&i("hover",{_event:{id:e.label},...x}),g&&(e.cursor=g),m&&t.audioStage.add({id:`hover-${Date.now()}`,url:m,loop:!1})},_=()=>{u.setDirectHover(!1),e.cursor="auto"};e.on("pointerover",v),e.on("pointerout",_)}if(n){let{soundSrc:g,soundVolume:m,payload:x}=n;e.eventMode="static",h=fa({displayObject:e,onPressChange:f});let v=b=>{kt(b)&&h.setDirectPress(!0)},_=b=>{kt(b)&&(h.setDirectPress(!1),x&&i&&i("click",{_event:{id:e.label},...x}),g&&t.audioStage.add({id:`click-${Date.now()}`,url:g,loop:!1,volume:$e(m)}))},p=()=>{h.setDirectPress(!1)};e.on("pointerdown",v),e.on("pointerup",_),e.on("pointerupoutside",p)}if(a){let{soundSrc:g,payload:m}=a;e.eventMode="static",d=pa({displayObject:e,onPressChange:f});let x=()=>{d.setDirectPress(!0)},v=()=>{d.setDirectPress(!1)},_=()=>{d.setDirectPress(!1),m&&i&&i("rightClick",{_event:{id:e.label},...m}),g&&t.audioStage.add({id:`rightClick-${Date.now()}`,url:g,loop:!1})},p=()=>{d.setDirectPress(!1)};e.on("rightdown",x),e.on("rightup",v),e.on("rightclick",_),e.on("rightupoutside",p)}(l||c)&&Lr({canvas:t.canvas,displayObject:e,scrollUpEvent:l,scrollDownEvent:c,eventHandler:i})};var iB=Symbol("routeGraphicsRichTextDisplay"),Y3=t=>t?.align??Ge.align,j3=(t,e,r)=>{let i=Math.max(0,t-e.width),s=0;return r==="center"?s=i/2:r==="right"&&(s=i),s-e.x},q3=t=>{t.removeChildren().forEach(r=>{r.destroy({children:!0})})},tB=({text:t,style:e,x:r,y:i})=>new br({text:t,style:new Be(Ft(e)),x:Math.round(r),y:Math.round(i)}),rB=(t,e)=>e?Ti(t,e):t,So=t=>Array.isArray(t?.content),sB=t=>!!t?.[iB],oB=t=>({x:t.x,y:t.y}),mu=(t,e,r)=>{q3(t),t.label=e.id,t.x=Math.round(e.x??0),t.y=Math.round(e.y??0),t.alpha=e.alpha??1;let i=e.width??e.measuredWidth??0;for(let s=0;s<e.content.length;s++){let o=e.content[s],n=new ee({label:`${e.id}-line-${s}`});for(let l of o.lineParts??[])l.furigana&&n.addChild(tB({text:l.furigana.text,style:rB(l.furigana.textStyle,r),x:l.furigana.x,y:l.furigana.y})),n.addChild(tB({text:l.text,style:rB(l.textStyle,r),x:l.x,y:l.y}));let a=n.getLocalBounds();n.x=j3(i,a,Y3(e.textStyle)),t.addChild(n)}t.hitArea=new Q(0,0,Math.max(0,i),Math.max(0,e.height??0))},nB=(t,e)=>{let r=new ee({label:t.id});return r[iB]=!0,r.zIndex=e,mu(r,t),r};var ub="__routeGraphicsManagedFilters",K3=["shadow","blur","shader"],Z3=t=>(t[ub]||Object.defineProperty(t,ub,{value:new Map,enumerable:!1,configurable:!0}),t[ub]),Q3=t=>t.filters?Array.isArray(t.filters)?t.filters:[t.filters]:[],ep=t=>t?Array.isArray(t)?t.filter(Boolean):[t]:[],J3=(t,e,r)=>{let i=new Set;for(let a of e.values())for(let l of ep(a))i.add(l);for(let a of ep(r))i.add(a);let s=Q3(t).filter(a=>!i.has(a)),n=[...K3.flatMap(a=>ep(e.get(a))),...s];t.filters=n.length>0?n:null},eV=t=>{for(let e of ep(t))e.destroy?.()},wo=(t,e,r)=>{let i=Z3(t),s=i.get(e);r?i.set(e,r):i.delete(e),J3(t,i,s),s&&s!==r&&eV(s)};var aB=/^[a-z][A-Za-z0-9]*$/;var tV=new Set(["shader"]),lB=new Set(["normal","add","multiply","screen"]),cB=new Set(["clamp","repeat"]),rV=new Set(["uTexture","uPrevTexture","uNextTexture","uNextTextureMatrix","uNextTextureClamp","uProgress","uResolution","uSampler","GlobalFilterUniforms","ShaderUniforms","VSOutput","gfu","shaderUniforms","mainVertex","mainFragment","uInputSize","uInputPixel","uInputClamp","uOutputFrame","uGlobalFrame","uOutputTexture"]),iV=t=>!!t&&typeof t=="object"&&!Array.isArray(t),uB=t=>typeof t=="number"&&Number.isFinite(t),As=(t,e)=>{if(!iV(t))throw new Error(`Input Error: ${e} must be an object`)},gu=(t,e)=>{if(typeof t!="string"||t.length===0)throw new Error(`Input Error: ${e} must be a non-empty string`)},hB=(t,e)=>{if(!aB.test(t))throw new Error(`Input Error: ${e} must match ${aB.source}`)},dB=t=>t.charAt(0).toUpperCase()+t.slice(1),sV=t=>`u${dB(t)}`,oV=t=>`u${dB(t)}Texture`,fB=({key:t,symbol:e,path:r,symbols:i,kind:s})=>{if(rV.has(e))throw new Error(`Input Error: ${r}.${t} generates reserved shader symbol ${e}`);if(i.has(e))throw new Error(`Input Error: ${r}.${t} generates duplicate shader symbol ${e}`);i.set(e,{key:t,kind:s})},nV=(t,e)=>{if(uB(t))return{type:"f32",value:t};if(Array.isArray(t)&&(t.length===2||t.length===4)&&t.every(uB))return{type:t.length===2?"vec2<f32>":"vec4<f32>",value:[...t]};throw new Error(`Input Error: ${e} must be a number, a length-2 number array, or a length-4 number array`)},aV=(t,e,r)=>t===void 0?[]:(As(t,e),Object.keys(t).sort().map(i=>{hB(i,`${e}.${i}`);let s=sV(i);return fB({key:i,symbol:s,path:e,symbols:r,kind:"uniform"}),{key:i,symbol:s,...nV(t[i],`${e}.${i}`)}})),lV=({textures:t,path:e,symbols:r,maxTextures:i})=>{if(t===void 0)return[];As(t,e);let s=Object.keys(t).sort();if(s.length>i)throw new Error(`Input Error: ${e} supports at most ${i} custom textures`);return s.map(o=>{hB(o,`${e}.${o}`),gu(t[o],`${e}.${o}`);let n=oV(o);return fB({key:o,symbol:n,path:e,symbols:r,kind:"texture"}),{key:o,symbol:n,src:t[o]}})},cV=(t,e)=>{if(t===void 0)return{blend:"normal",textureWrap:"clamp",mipmap:!1};As(t,e);let r=t.blend??"normal";if(!lB.has(r))throw new Error(`Input Error: ${e}.blend must be one of: ${Array.from(lB).join(", ")}`);let i=t.textureWrap??"clamp";if(!cB.has(i))throw new Error(`Input Error: ${e}.textureWrap must be one of: ${Array.from(cB).join(", ")}`);let s=t.mipmap??!1;if(typeof s!="boolean")throw new Error(`Input Error: ${e}.mipmap must be a boolean`);return{blend:r,textureWrap:i,mipmap:s}},uV=(t,e)=>{if(As(t,e),As(t.webgl,`${e}.webgl`),As(t.webgpu,`${e}.webgpu`),t.webgl.vertex!==void 0&&typeof t.webgl.vertex!="string")throw new Error(`Input Error: ${e}.webgl.vertex must be a string`);if(gu(t.webgl.fragment,`${e}.webgl.fragment`),gu(t.webgpu.source,`${e}.webgpu.source`),!t.webgpu.source.includes("mainVertex")||!t.webgpu.source.includes("mainFragment"))throw new Error(`Input Error: ${e}.webgpu.source must define mainVertex and mainFragment`);return{webgl:{...t.webgl.vertex!==void 0?{vertex:t.webgl.vertex}:{},fragment:t.webgl.fragment},webgpu:{source:t.webgpu.source}}},hV=(t,e)=>{if(t===void 0)return{grid:[1,1]};if(As(t,e),!Array.isArray(t.grid)||t.grid.length!==2||!t.grid.every(r=>Number.isInteger(r)&&r>=1))throw new Error(`Input Error: ${e}.grid must be [columns, rows] with positive integers`);return{grid:[t.grid[0],t.grid[1]]}},pB=({shader:t,path:e,requireId:r,textureLimit:i,allowMesh:s})=>{if(As(t,e),!tV.has(t.type))throw new Error(`Input Error: ${e}.type must be shader`);let o={type:"shader"};r?(gu(t.id,`${e}.id`),o.id=t.id):t.id!==void 0&&(gu(t.id,`${e}.id`),o.id=t.id);let n=new Map;if(o.uniforms=aV(t.uniforms,`${e}.uniforms`,n),o.textures=lV({textures:t.textures,path:`${e}.textures`,symbols:n,maxTextures:i}),o.pipeline=cV(t.pipeline,`${e}.pipeline`),o.source=uV(t.source,`${e}.source`),t.mesh!==void 0&&!s)throw new Error(`Input Error: ${e}.mesh is only valid for compositors`);return s&&(o.mesh=hV(t.mesh,`${e}.mesh`)),o},mB=(t,e="filters")=>{if(t===void 0)return;if(!Array.isArray(t))throw new Error(`Input Error: ${e} must be an array`);let r=new Set;return t.map((i,s)=>{let o=pB({shader:i,path:`${e}[${s}]`,requireId:!0,textureLimit:7,allowMesh:!1});if(r.has(o.id))throw new Error(`Input Error: ${e}[${s}].id must be unique within filters`);return r.add(o.id),o})},gB=(t,e="compositor")=>pB({shader:t,path:e,requireId:!1,textureLimit:6,allowMesh:!0}),xB=t=>JSON.stringify(t??null);var db="__routeGraphicsShaderFilters",Eo="__routeGraphicsShaderProgress",yB="__routeGraphicsShaderDestroyCleanup",dV=`
|
|
1263
|
+
`),u=eI.replace("%blur-struct%",a).replace("%blur-vertex-out%",l).replace("%blur-fragment-in%",a).replace("%blur-sampling%",c).replace("%dimension%",t?"z":"w");return cr.from({vertex:{source:u,entryPoint:"mainVertex"},fragment:{source:u,entryPoint:"mainFragment"}})}var rI=class iI extends Ir{constructor(e){e={...iI.defaultOptions,...e};let r=JM(e.horizontal,e.kernelSize),i=tI(e.horizontal,e.kernelSize);super({glProgram:r,gpuProgram:i,resources:{blurUniforms:{uStrength:{value:0,type:"f32"}}},...e}),this.horizontal=e.horizontal,this._quality=0,this.quality=e.quality,this.blur=e.strength,this._uniforms=this.resources.blurUniforms.uniforms}apply(e,r,i,s){if(this._uniforms.uStrength=this.strength/this.passes,this.passes===1)e.applyFilter(this,r,i,s);else{let o=Ue.getSameSizeTexture(r),n=r,a=o;this._state.blend=!1;let l=e.renderer.type===Ne.WEBGPU;for(let c=0;c<this.passes-1;c++){e.applyFilter(this,n,a,c===0?!0:l);let u=a;a=n,n=u}this._state.blend=!0,e.applyFilter(this,n,i,s),Ue.returnTexture(o)}}get blur(){return this.strength}set blur(e){this.padding=1+Math.abs(e)*2,this.strength=e}get quality(){return this._quality}set quality(e){this._quality=e,this.passes=e}};rI.defaultOptions={strength:8,quality:4,kernelSize:5};var Uf=rI;var ra=class extends Ir{constructor(...e){let r=e[0]??{};typeof r=="number"&&(q(le,"BlurFilter constructor params are now options object. See params: { strength, quality, resolution, kernelSize }"),r={strength:r},e[1]!==void 0&&(r.quality=e[1]),e[2]!==void 0&&(r.resolution=e[2]||"inherit"),e[3]!==void 0&&(r.kernelSize=e[3])),r={...Uf.defaultOptions,...r};let{strength:i,strengthX:s,strengthY:o,quality:n,...a}=r;super({...a,compatibleRenderers:Ne.BOTH,resources:{}}),this._repeatEdgePixels=!1,this.blurXFilter=new Uf({horizontal:!0,...r}),this.blurYFilter=new Uf({horizontal:!1,...r}),this.quality=n,this.strengthX=s??i,this.strengthY=o??i,this.repeatEdgePixels=!1}apply(e,r,i,s){let o=Math.abs(this.blurXFilter.strength),n=Math.abs(this.blurYFilter.strength);if(o&&n){let a=Ue.getSameSizeTexture(r);this.blurXFilter.blendMode="normal",this.blurXFilter.apply(e,r,a,!0),this.blurYFilter.blendMode=this.blendMode,this.blurYFilter.apply(e,a,i,s),Ue.returnTexture(a)}else n?(this.blurYFilter.blendMode=this.blendMode,this.blurYFilter.apply(e,r,i,s)):(this.blurXFilter.blendMode=this.blendMode,this.blurXFilter.apply(e,r,i,s))}updatePadding(){this._repeatEdgePixels?this.padding=0:this.padding=Math.max(Math.abs(this.blurXFilter.blur),Math.abs(this.blurYFilter.blur))*2}get strength(){if(this.strengthX!==this.strengthY)throw new Error("BlurFilter's strengthX and strengthY are different");return this.strengthX}set strength(e){this.blurXFilter.blur=this.blurYFilter.blur=e,this.updatePadding()}get quality(){return this.blurXFilter.quality}set quality(e){this.blurXFilter.quality=this.blurYFilter.quality=e}get strengthX(){return this.blurXFilter.blur}set strengthX(e){this.blurXFilter.blur=e,this.updatePadding()}get strengthY(){return this.blurYFilter.blur}set strengthY(e){this.blurYFilter.blur=e,this.updatePadding()}get blur(){return q("8.3.0","BlurFilter.blur is deprecated, please use BlurFilter.strength instead."),this.strength}set blur(e){q("8.3.0","BlurFilter.blur is deprecated, please use BlurFilter.strength instead."),this.strength=e}get blurX(){return q("8.3.0","BlurFilter.blurX is deprecated, please use BlurFilter.strengthX instead."),this.strengthX}set blurX(e){q("8.3.0","BlurFilter.blurX is deprecated, please use BlurFilter.strengthX instead."),this.strengthX=e}get blurY(){return q("8.3.0","BlurFilter.blurY is deprecated, please use BlurFilter.strengthY instead."),this.strengthY}set blurY(e){q("8.3.0","BlurFilter.blurY is deprecated, please use BlurFilter.strengthY instead."),this.strengthY=e}get repeatEdgePixels(){return this._repeatEdgePixels}set repeatEdgePixels(e){this._repeatEdgePixels=e,this.updatePadding()}};ra.defaultOptions={strength:8,quality:4,kernelSize:5};Ce();vl();dn();Rl();var vs=class t extends Re{constructor(...e){let r=e[0];Array.isArray(e[0])&&(r={textures:e[0],autoUpdate:e[1]});let{animationSpeed:i=1,autoPlay:s=!1,autoUpdate:o=!0,loop:n=!0,onComplete:a=null,onFrameChange:l=null,onLoop:c=null,textures:u,updateAnchor:h=!1,...d}=r,[f]=u;super({...d,texture:f instanceof F?f:f.texture}),this._textures=null,this._durations=null,this._autoUpdate=o,this._isConnectedToTicker=!1,this.animationSpeed=i,this.loop=n,this.updateAnchor=h,this.onComplete=a,this.onFrameChange=l,this.onLoop=c,this._currentTime=0,this._playing=!1,this._previousFrame=null,this.textures=u,s&&this.play()}stop(){this._playing&&(this._playing=!1,this._autoUpdate&&this._isConnectedToTicker&&(yt.shared.remove(this.update,this),this._isConnectedToTicker=!1))}play(){this._playing||(this._playing=!0,this._autoUpdate&&!this._isConnectedToTicker&&(yt.shared.add(this.update,this,li.HIGH),this._isConnectedToTicker=!0))}gotoAndStop(e){this.stop(),this.currentFrame=e}gotoAndPlay(e){this.currentFrame=e,this.play()}update(e){if(!this._playing)return;let r=e.deltaTime,i=this.animationSpeed*r,s=this.currentFrame;if(this._durations!==null){let o=this._currentTime%1*this._durations[this.currentFrame];for(o+=i/60*1e3;o<0;)this._currentTime--,o+=this._durations[this.currentFrame];let n=Math.sign(this.animationSpeed*r);for(this._currentTime=Math.floor(this._currentTime);o>=this._durations[this.currentFrame];)o-=this._durations[this.currentFrame]*n,this._currentTime+=n;this._currentTime+=o/this._durations[this.currentFrame]}else this._currentTime+=i;this._currentTime<0&&!this.loop?(this.gotoAndStop(0),this.onComplete&&this.onComplete()):this._currentTime>=this._textures.length&&!this.loop?(this.gotoAndStop(this._textures.length-1),this.onComplete&&this.onComplete()):s!==this.currentFrame&&(this.loop&&this.onLoop&&(this.animationSpeed>0&&this.currentFrame<s||this.animationSpeed<0&&this.currentFrame>s)&&this.onLoop(),this._updateTexture())}_updateTexture(){let e=this.currentFrame;this._previousFrame!==e&&(this._previousFrame=e,this.texture=this._textures[e],this.updateAnchor&&this.texture.defaultAnchor&&this.anchor.copyFrom(this.texture.defaultAnchor),this.onFrameChange&&this.onFrameChange(this.currentFrame))}destroy(){this.stop(),super.destroy(),this.onComplete=null,this.onFrameChange=null,this.onLoop=null}static fromFrames(e){let r=[];for(let i=0;i<e.length;++i)r.push(F.from(e[i]));return new t(r)}static fromImages(e){let r=[];for(let i=0;i<e.length;++i)r.push(F.from(e[i]));return new t(r)}get totalFrames(){return this._textures.length}get textures(){return this._textures}set textures(e){if(e[0]instanceof F)this._textures=e,this._durations=null;else{this._textures=[],this._durations=[];for(let r=0;r<e.length;r++)this._textures.push(e[r].texture),this._durations.push(e[r].time)}this._previousFrame=null,this.gotoAndStop(0),this._updateTexture()}get currentFrame(){let e=Math.floor(this._currentTime)%this._textures.length;return e<0&&(e+=this._textures.length),e}set currentFrame(e){if(e<0||e>this.totalFrames-1)throw new Error(`[AnimatedSprite]: Invalid frame index value ${e}, expected to be between 0 and totalFrames ${this.totalFrames}.`);let r=this.currentFrame;this._currentTime=e,r!==this.currentFrame&&this._updateTexture()}get playing(){return this._playing}get autoUpdate(){return this._autoUpdate}set autoUpdate(e){e!==this._autoUpdate&&(this._autoUpdate=e,!this._autoUpdate&&this._isConnectedToTicker?(yt.shared.remove(this.update,this),this._isConnectedToTicker=!1):this._autoUpdate&&!this._isConnectedToTicker&&this._playing&&(yt.shared.add(this.update,this),this._isConnectedToTicker=!0))}};kh();je();Qh();var Of=class extends as{constructor(e,r){let{text:i,resolution:s,style:o,anchor:n,width:a,height:l,roundPixels:c,...u}=e;super({...u}),this.batched=!0,this._resolution=null,this._autoResolution=!0,this._didTextUpdate=!0,this._styleClass=r,this.text=i??"",this.style=o,this.resolution=s??null,this.allowChildren=!1,this._anchor=new It({_onUpdate:()=>{this.onViewUpdate()}}),n&&(this.anchor=n),this.roundPixels=c??!1,a!==void 0&&(this.width=a),l!==void 0&&(this.height=l)}get anchor(){return this._anchor}set anchor(e){typeof e=="number"?this._anchor.set(e):this._anchor.copyFrom(e)}set text(e){e=e.toString(),this._text!==e&&(this._text=e,this.onViewUpdate())}get text(){return this._text}set resolution(e){this._autoResolution=e===null,this._resolution=e,this.onViewUpdate()}get resolution(){return this._resolution}get style(){return this._style}set style(e){e||(e={}),this._style?.off("update",this.onViewUpdate,this),e instanceof this._styleClass?this._style=e:this._style=new this._styleClass(e),this._style.on("update",this.onViewUpdate,this),this.onViewUpdate()}get width(){return Math.abs(this.scale.x)*this.bounds.width}set width(e){this._setWidth(e,this.bounds.width)}get height(){return Math.abs(this.scale.y)*this.bounds.height}set height(e){this._setHeight(e,this.bounds.height)}getSize(e){return e||(e={}),e.width=Math.abs(this.scale.x)*this.bounds.width,e.height=Math.abs(this.scale.y)*this.bounds.height,e}setSize(e,r){typeof e=="object"?(r=e.height??e.width,e=e.width):r??(r=e),e!==void 0&&this._setWidth(e,this.bounds.width),r!==void 0&&this._setHeight(r,this.bounds.height)}containsPoint(e){let r=this.bounds.width,i=this.bounds.height,s=-r*this.anchor.x,o=0;return e.x>=s&&e.x<=s+r&&(o=-i*this.anchor.y,e.y>=o&&e.y<=o+i)}onViewUpdate(){this.didViewUpdate||(this._didTextUpdate=!0),super.onViewUpdate()}_getKey(){return`${this.text}:${this._style.styleKey}:${this._resolution}`}destroy(e=!1){super.destroy(e),this.owner=null,this._bounds=null,this._anchor=null,(typeof e=="boolean"?e:e?.style)&&this._style.destroy(e),this._style=null,this._text=null}};function sI(t,e){let r=t[0]??{};return(typeof r=="string"||t[1])&&(q(le,`use new ${e}({ text: "hi!", style }) instead`),r={text:r,style:t[1]}),r}Ql();ho();var br=class extends Of{constructor(...e){let r=sI(e,"Text");super(r,Be),this.renderPipeId="text"}updateBounds(){let e=this._bounds,r=this._anchor,i=Ve.measureText(this._text,this._style),{width:s,height:o}=i;e.minX=-r._x*s,e.maxX=e.minX+s,e.minY=-r._y*o,e.maxY=e.minY+o}};ac();Te();mr();xt();io();Nt();Wy();qt();Ce();of();Xg();_r();$r();co();ly();Rl();Ql();ho();Lg();Gt();var zN=zs(vd(),1);$.add(lP,uP);var $N=new(window.AudioContext||window.webkitAudioContext),Lf={},au={},XN=(t,e)=>{if(Lf[t])return Lf[t];if(au[t])return au[t];if(e.byteLength!==0)return au[t]=$N.decodeAudioData(e).then(r=>(Lf[t]=r,r)).catch(r=>{console.error(`AudioAsset.load: Failed to decode ${t}:`,r)}).finally(()=>{delete au[t]}),au[t]},YN=t=>Lf[t],ia={load:XN,getAsset:YN};var at=({type:t,add:e,update:r,delete:i,parse:s,shouldUpdateUnchanged:o})=>({type:t,add:e,update:r,delete:i,parse:s,shouldUpdateUnchanged:o});var R_=({type:t})=>({type:t});var M_=({type:t,add:e,update:r,delete:i})=>({type:t,add:e,update:r,delete:i});var Gf={alpha:"alpha",x:"x",y:"y",translateX:"translateX",translateY:"translateY",scaleX:"scaleX",scaleY:"scaleY",rotation:"rotation",blurX:"blurX",blurY:"blurY",uProgress:"uProgress"};var Df={scaleX:["scale","x"],scaleY:["scale","y"],x:["x"],y:["y"],alpha:["alpha"],rotation:["rotation"],blurX:["_routeGraphicsBlur","x"],blurY:["_routeGraphicsBlur","y"],uProgress:["uProgress"]};var vr={RECT:"rect",TEXT:"text",INPUT:"input",CONTAINER:"container",SPRITE:"sprite",TEXT_REVEALING:"text-revealing",SLIDER:"slider",PARTICLES:"particles",SPRITESHEET_ANIMATION:"spritesheet-animation",VIDEO:"video"};var Ge={fill:"black",fontFamily:"Arial",fontSize:16,align:"left",lineHeight:1.2,wordWrap:!1,breakWords:!1,strokeColor:"transparent",strokeWidth:0,wordWrapWidth:0};var oI={color:"black",alpha:1,blur:0,offsetX:2,offsetY:2},jN=(t={})=>{let e=typeof t.stroke=="object"&&t.stroke!==null?t.stroke:{};return{...e,color:t.strokeColor??e.color??Ge.strokeColor,width:t.strokeWidth??e.width??Ge.strokeWidth}},qN=t=>{if(t===void 0)return;if(t===null||t===!1)return null;let e=typeof t=="object"&&t!==null?{...oI,...t}:oI,r=e.offsetX,i=e.offsetY,s=Math.hypot(r,i);return{alpha:e.alpha,angle:s===0?0:Math.atan2(i,r),blur:e.blur,color:e.color,distance:s}},KN=t=>t?Math.ceil(Math.max(0,t.blur)+t.distance):0,Ft=(t={},e={})=>{let r=e.includeShadow!==!1,{strokeColor:i,strokeWidth:s,stroke:o,shadow:n,...a}=t;delete a.dropShadow;let l={...a,stroke:jN({strokeColor:i,strokeWidth:s,stroke:o})};if(r){let c=qN(n),u=KN(c),h=Math.max(a.padding??0,u);n!==void 0&&(l.dropShadow=c),h>0&&(l.padding=h)}return l};var vi=(t,e)=>{let r={fill:e?.fill??Ge.fill,fontFamily:e?.fontFamily??Ge.fontFamily,fontSize:e?.fontSize??Ge.fontSize,align:e?.align??Ge.align,lineHeight:e?.lineHeight??Ge.lineHeight,wordWrap:e?.wordWrap??Ge.wordWrap,breakWords:e?.breakWords??Ge.breakWords,strokeColor:e?.strokeColor??Ge.strokeColor,strokeWidth:e?.strokeWidth??Ge.strokeWidth,wordWrapWidth:e?.wordWrapWidth??Ge.wordWrapWidth,...Object.prototype.hasOwnProperty.call(e??{},"shadow")?{shadow:e.shadow}:{}};t.style=Ft(r)};var xo=(t=0)=>t*Math.PI/180,I_=(t=0)=>t*180/Math.PI,nI=t=>typeof t=="number"&&Number.isFinite(t)&&t!==0?t:1,Nf=t=>({x:Math.round((t.x??0)+(t.originX??0)),y:Math.round((t.y??0)+(t.originY??0))}),kr=(t,e)=>{let r=e.originX??0,i=e.originY??0,s=nI(t.scale?.x),o=nI(t.scale?.y),n=Nf(e);t.pivot?.set?.(r/s,i/o),t.x=n.x,t.y=n.y,t.rotation=xo(e.rotation??0)},Ur=(t,e={})=>{let r=Nf(t),i={x:r.x,y:r.y,...e};return t.rotation!==void 0&&(i.rotation=t.rotation),i};var Ts=t=>t==="translateX"||t==="translateY",cI=(t,e)=>typeof e!="string"?e:t[e]??e,ZN=(t,e,r,i)=>{let s=cI(r,e);if(typeof s=="string"){let n=t[s];return n===void 0?i:e==="rotation"?I_(n):n}let o=t;for(let n of s){if(o==null)return i;o=o[n]}return o===void 0?i:e==="rotation"?I_(o):o},QN=(t,e,r,i)=>{let s=cI(r,e),o=e==="rotation"?xo(i):i;if(typeof s=="string")return t[s]=o,t;let n=t;for(let a=0;a<s.length-1;a++){let l=s[a];l in n||(n[l]={}),n=n[l]}return n[s[s.length-1]]=o,t},aI=t=>typeof t=="number"&&Number.isFinite(t),JN=t=>{let e=t?.getLocalBounds?.();return e?.rectangle??e??null},lI=(t,e)=>{let r=e==="x"?t?.width:t?.height;if(aI(r)&&r>0)return r;let i=JN(t),s=e==="x"?i?.width:i?.height,o=e==="x"?t?.scale?.x:t?.scale?.y;return aI(s)&&s>0?Math.abs(s*(o??1)):0},Ss=t=>({x:t?.x??0,y:t?.y??0,width:lI(t,"x"),height:lI(t,"y")}),uI=({object:t,property:e,propertyPathMap:r,subjectState:i,defaultValue:s=0})=>e==="translateX"||e==="translateY"?s:ZN(t,e,r,s),lu=({object:t,property:e,propertyPathMap:r,subjectState:i,value:s})=>e==="translateX"?(t.x=i.x+s*i.width,t):e==="translateY"?(t.y=i.y+s*i.height,t):QN(t,e,r,s);var hI=(t,e,r=Df,i)=>{let s=i;for(let o of e)for(let[n,a]of Object.entries(o.tween)){if(!Gf[n])throw new Error(`${n} is not a supported property for animation.`);a.initialValue!==void 0&&(!s&&Ts(n)&&(s=Ss(t)),lu({object:t,property:n,propertyPathMap:r,subjectState:s,value:a.initialValue}))}},Vf=({animations:t,animationBus:e,completionTracker:r,element:i,targetState:s,onComplete:o,animationBaseState:n})=>{for(let a of t){if(typeof e?.hasContext=="function"&&e.hasContext(a.id))continue;for(let[u,h]of Object.entries(a.tween))if(h.auto&&(!s||!Object.prototype.hasOwnProperty.call(s,u)))throw new Error(`Animation "${a.id}" cannot auto-resolve property "${u}" from targetState.`);let l=a.playback?.continuity!=="persistent",c=l?r.getVersion():null;l&&r.track(c),e.dispatch({type:"START",payload:{id:a.id,animationType:a.type,targetId:a.targetId,continuity:a.playback?.continuity??"render",playbackSpeed:a.playback?.speed,signature:a.signature??JSON.stringify({type:a.type,tween:a.tween,playback:a.playback??null}),element:i,properties:a.tween,targetState:s,animationBaseState:n,onComplete:()=>{l&&r.complete(c),o?.(a)}}})}};var e3=t=>{if(!t?.dropShadow||typeof t.clone!="function")return t;let e=t.clone();return e.dropShadow=null,e};function Hf(t,e){let r=t.text.substring(0,e),s=Ve.measureText(r,e3(t.style)).width;return t.x+s}var t3=async(t,e)=>new Promise((r,i)=>{if(e?.aborted)return i(new DOMException("The operation was aborted.","AbortError"));let s,o=()=>{s&&e?.removeEventListener("abort",s)},n=setTimeout(()=>{o(),r()},t);s=()=>{clearTimeout(n),o(),i(e.reason)},e?.addEventListener("abort",s,{once:!0})}),Wf=t3;var cu={softness:1.25,easing:"linear",lineOverlap:0,lineDelay:0},r3=18,i3=64,F_={linear:t=>t,easeOutCubic:t=>1-(1-t)**3},s3=(t,e,r)=>Math.max(e,Math.min(r,t)),B_=(t,e)=>typeof t=="number"&&Number.isFinite(t)?t:e,yo=(t={})=>{let e=t&&typeof t=="object"?t:{};return{softness:Math.max(0,B_(e.softness,cu.softness)),easing:Object.prototype.hasOwnProperty.call(F_,e.easing)?e.easing:cu.easing,lineOverlap:s3(B_(e.lineOverlap,cu.lineOverlap),0,.95),lineDelay:Math.max(0,B_(e.lineDelay,cu.lineDelay))}},k_=t=>F_[t]??F_[cu.easing],U_=({maxLineHeight:t,softWipe:e})=>Math.max(r3,Math.min(i3,Math.round(t*e.softness)));var sa=(t,e,r,i)=>{if(!r)return;let s=o=>{o?.detail?.elementId===e&&typeof o?.detail?.frameIndex=="number"&&(t.gotoAndStop(o?.detail?.frameIndex),i?.())};window.addEventListener("snapShotAnimatedSpriteFrame",s),t._snapShotKeyFrameHandler=s},_o=t=>{t._snapShotKeyFrameHandler&&(window.removeEventListener("snapShotAnimatedSpriteFrame",t._snapShotKeyFrameHandler),delete t._snapShotKeyFrameHandler)};var dI=(t={})=>{if(t.frame){let n=t.frame.w??0,a=t.frame.h??0,l=t.sourceSize?.w??n,c=t.sourceSize?.h??a,u={frame:{x:t.frame.x??0,y:t.frame.y??0,w:n,h:a},rotated:t.rotated??!1,trimmed:t.trimmed??!1,spriteSourceSize:{x:t.spriteSourceSize?.x??0,y:t.spriteSourceSize?.y??0,w:t.spriteSourceSize?.w??n,h:t.spriteSourceSize?.h??a},sourceSize:{w:l,h:c}};return t.anchor?u.anchor={x:t.anchor.x??0,y:t.anchor.y??0}:t.pivot&&(u.anchor={x:t.pivot.x??0,y:t.pivot.y??0}),t.borders&&(u.borders={...t.borders}),u}let e=t.width??t.w??0,r=t.height??t.h??0,i=t.sourceWidth??e,s=t.sourceHeight??r,o={frame:{x:t.x??0,y:t.y??0,w:e,h:r},rotated:t.rotated??!1,trimmed:t.trimmed??!1,spriteSourceSize:{x:t.offsetX??0,y:t.offsetY??0,w:e,h:r},sourceSize:{w:i,h:s}};return t.anchor?o.anchor={x:t.anchor.x??0,y:t.anchor.y??0}:t.pivot&&(o.anchor={x:t.pivot.x??0,y:t.pivot.y??0}),t.borders&&(o.borders={...t.borders}),o},O_=(t={})=>!t||typeof t!="object"?{}:Object.fromEntries(Object.entries(t).map(([e,r])=>[e,Array.isArray(r)?r.map(i=>String(i)):[]])),o3=(t,e={})=>{let r=Math.max(0,Number(e.from??0)),i=Math.min(t.length-1,Number(e.to??r));if(!Number.isFinite(r)||!Number.isFinite(i)||i<r)return[];let s=t.slice(r,i+1),o=String(e.direction??"forward").toLowerCase();if(o==="reverse"||o==="backward")return[...s].reverse();if(o==="pingpong")return[...s,...s.slice(1,-1).reverse()];if(o==="pingpong_reverse"){let n=[...s].reverse();return[...n,...n.slice(1,-1).reverse()]}return s},n3=(t=[],e=[])=>!Array.isArray(t)||e.length===0?{}:Object.fromEntries(t.map(r=>{let i=typeof r?.name=="string"?r.name:"";return i?[i,o3(e,r)]:null}).filter(Boolean)),Kr=(t={})=>{let e=t??{},r=O_(e.animations);return{frames:Array.isArray(e.frames)?Object.fromEntries(e.frames.map(s=>{let o=s?.filename??s?.name;return typeof o!="string"||o.length===0?null:[o,dI(s)]}).filter(Boolean)):Object.fromEntries(Object.entries(e.frames??{}).map(([s,o])=>[s,dI(o)])),...Object.keys(r).length>0?{animations:r}:{},meta:{...e.meta??{},scale:String(e.scale??e.meta?.scale??1),...e.width!=null||e.height!=null?{size:{w:e.width??e.meta?.size?.w??0,h:e.height??e.meta?.size?.h??0}}:{}}}},Zr=(t={},e={},r={},i=[])=>({...n3(r?.frameTags,i),...O_(e),...O_(t)}),a3=(t,e)=>{if(!Array.isArray(e?.frames))return[];let r=Object.keys(t.frames??{});return e.frames.map(i=>typeof i=="number"?r[i]:String(i)).filter(Boolean)},Or=({atlas:t={frames:{}},clips:e={},playback:r,legacyAnimation:i})=>{let s=r??i??{},o={fps:s.fps??null,loop:s.loop??!0,autoplay:s.autoplay??!0};return typeof s.clip=="string"&&s.clip.length>0&&(o.clip=s.clip),Array.isArray(s.frames)?o.frames=s.frames.map(n=>typeof n=="number"?Object.keys(t.frames??{})[n]:String(n)).filter(Boolean):o.clip||(o.frames=a3(t,i)),o.fps==null&&(typeof s.animationSpeed=="number"?o.fps=s.animationSpeed*60:o.fps=30),o.clip&&(!Array.isArray(o.frames)||o.frames.length===0)&&(o.frames=Array.isArray(e[o.clip])?[...e[o.clip]]:[]),Array.isArray(o.frames)||(o.frames=[]),o},oa=({spritesheet:t,atlas:e,clips:r={},playback:i,legacyAnimation:s})=>{let o=Or({atlas:e,clips:r,playback:i,legacyAnimation:s});return{frameTextures:o.frames.map(a=>t.textures[a]),playback:o}},na=t=>typeof t=="number"?t/60:.5;var Wi=Symbol("textRevealRuntime"),zf=Symbol("textRevealSnapshot"),aa=Symbol("textRevealIndicator"),xI=Symbol("textRevealIndicatorPlayback"),D_=50,l3=0,H_=100,L_=H_-1,fI=10,yI=120,c3=.9,u3=360,h3=1.2,G_=20,d3=16,f3=0,p3=(t,e,r)=>Math.max(e,Math.min(r,t)),_I=(t=D_)=>typeof t!="number"||!Number.isFinite(t)?D_:Math.max(l3,Math.min(H_,t)),m3=t=>_I(t)>=H_,W_=(t,{maxRate:e=yI,curve:r=c3}={})=>{let i=Math.min(_I(t),L_),o=(L_>0?i/L_:0)**r;return fI*(e/fI)**o},g3=t=>W_(t,{maxRate:u3,curve:h3}),x3=t=>{let e=1e3/t;return e>=G_||t<=yI?{stepDelay:Math.max(1,Math.floor(e)),charactersPerStep:1}:{stepDelay:G_,charactersPerStep:Math.max(2,Math.round(t*G_/1e3))}},y3=t=>t?.revealEffect==="softWipe"?"softWipe":"typewriter",z_=t=>{let e=t?.initialRevealedCharacters;return typeof e!="number"||!Number.isFinite(e)?0:Math.max(0,Math.floor(e))},_3=t=>(t?.content??[]).reduce((e,r)=>e+(r.lineParts??[]).reduce((i,s)=>i+(s.text?.length??0),0),0),la=t=>t?.revealEffect==="none"||m3(t?.speed??D_),N_=t=>t!==null&&typeof t=="object"&&typeof t.then=="function",$_=(t={})=>t.kind??(t.atlas!==void 0||t.clips!==void 0||t.playback!==void 0?"spritesheet":"image"),b3=t=>["revealing","complete"].some(e=>$_(t?.indicator?.[e])==="spritesheet"&&!!t?.indicator?.[e]?.src),bI=t=>`${t.id}-indicator`,vI=(t,e,r)=>{typeof e?.width=="number"?t.width=e.width:r?.width&&(t.width=r.width),typeof e?.height=="number"?t.height=e.height:r?.height&&(t.height=r.height)},TI=(t={})=>{let e=t?.src?F.from(t.src):F.EMPTY,r=new Re(e);return vI(r,t,e),r},v3=(t={},{app:e,element:r})=>{if(!t?.src)return TI(t);let i=Kr(t.atlas),s=Zr(t.clips,t.atlas?.animations,t.atlas?.meta,Object.keys(i.frames??{})),o=Or({atlas:i,clips:s,playback:t.playback});return(async()=>{let n=new hi(F.from(t.src),i);await n.parse();let{frameTextures:a}=oa({spritesheet:n,atlas:i,clips:s,playback:o}),l=new vs(a.length>0?a:[F.EMPTY]);return l.animationSpeed=na(o.fps),l.loop=o.loop,l[xI]=o,vI(l,t,a[0]),e?.debug&&sa(l,bI(r),e.debug,()=>{typeof e.render=="function"&&e.render()}),l})()},pI=(t,e)=>$_(t)==="spritesheet"?v3(t,e):TI(t),mI=(t,e)=>{t instanceof vs&&!e?.debug&&t[xI]?.autoplay!==!1&&t.play()},SI=t=>{!t||t.destroyed||(_o(t),typeof t.stop=="function"&&t.stop(),t.destroy({children:!0}))},V_=t=>{let e=t?.[aa];if(e){for(let r of e.displays)_o(r);for(let r of e.displays)r?.parent!==t&&SI(r);delete t[aa]}t.destroy({children:!0})},T3=({element:t,app:e,revealingDisplay:r,completeDisplay:i})=>{let s=new ee({label:bI(t)}),o=new Set([r]);return i&&o.add(i),s.addChild(r),s[aa]={displays:o,currentDisplay:r,completeDisplay:i,start(){mI(this.currentDisplay,e)},showComplete(){if(!this.completeDisplay||this.currentDisplay===this.completeDisplay)return;let n=this.currentDisplay;n?.parent===s&&s.removeChild(n),SI(n),o.delete(n),this.currentDisplay=this.completeDisplay,s.addChild(this.completeDisplay),mI(this.completeDisplay,e)}},s},S3=(t,{app:e}={})=>{let r=t?.indicator?.revealing??{},i=t?.indicator?.complete,s=pI(r,{app:e,element:t}),o=i?.src||$_(i)==="spritesheet"?pI(i,{app:e,element:t}):null,n=(a,l)=>T3({element:t,app:e,revealingDisplay:a,completeDisplay:l});return N_(s)||N_(o)?Promise.all([s,o]).then(([a,l])=>n(a,l)):n(s,o)},w3=t=>{t?.[aa]?.showComplete()},ca=(t,e="revealing")=>{let r=t?.indicator?.[e]??{};return{x:r.offsetX??t?.indicator?.offsetX??d3,y:r.offsetY??t?.indicator?.offsetY??f3}},E3=(t,e)=>{if(!e)return 0;let r=Math.max(0,e.lineMaxHeight??0),i=Math.max(0,t?.height??0);return e.y+Math.max(0,r-i)},zi=(t,e,r)=>{t.x=r.x,t.y=E3(t,e)+r.y},wI=(t,e,r)=>{if(!e||e.text.length===0){t.x=r.x;return}t.x=Hf(e,e.text.length-1)+r.x},ws=(t,e,r,i)=>{w3(t);let s=ca(i,"complete");zi(t,e,s),wI(t,r,s)},A3=(t,e)=>{if(t[Wi]){let r=t[Wi];delete t[Wi],r()}t[Wi]=e},P3=t=>t?.[zf]??null,uu=(t,e)=>t?e?(t[zf]=e,e):(delete t[zf],null):null,EI=t=>{let e=P3(t);return!e||e.mode!=="typewriter"||e.completed===!0?null:e},AI=t=>!!EI(t),X_=t=>{if(t[Wi]){let r=t[Wi];delete t[Wi],r()}delete t[zf],t.onRender=void 0,t.removeChildren().forEach(r=>{if(r?.[aa]){V_(r);return}r.destroy({children:!0})})},Y_=(t,e="",r="")=>{let i=new Be(Ft(t.textStyle)),s=new br({text:e,style:i,x:Math.round(t.x),y:Math.round(t.y)}),o=null;if(t.furigana){let n=new Be(Ft(t.furigana.textStyle));o=new br({text:r,style:n,x:Math.round(t.furigana.x),y:Math.round(t.furigana.y)})}return{text:s,furiganaText:o}},j_=(t,e)=>{let r=null,i=null,s=0,o=0,n=[];for(let a=0;a<e.content.length;a++){let l=e.content[a],c=new ee({label:`${e.id}-line-${a}`}),u=[],h=null,d=0;t.addChild(c),i=l,o=Math.max(o,l.lineMaxHeight??0);for(let f=0;f<l.lineParts.length;f++){let g=l.lineParts[f],{text:m,furiganaText:x}=Y_(g,g.text,g.furigana?.text||"");x&&(c.addChild(x),u.push(x)),c.addChild(m),u.push(m),r=m,h=m,s+=g.text.length,d+=g.text.length}if(u.length>0){let f=c.getLocalBounds();n.push({chunk:l,container:c,lastTextObject:h,totalCharacters:d,bounds:{x:f.x,y:f.y,width:f.width,height:f.height}})}else c.destroy()}return{lines:n,lastTextObject:r,lastChunk:i,totalCharacters:s,maxLineHeight:o,bounds:t.getLocalBounds()}},gI=({contentContainer:t,indicatorSprite:e,element:r})=>{let{lastTextObject:i,lastChunk:s}=j_(t,r);ws(e,s,i,r)},C3=({contentContainer:t,indicatorSprite:e,element:r,revealedCharacters:i})=>{let s=ca(r),o=r.content[0]??null,n=_3(r),a=Math.min(i,Math.max(0,n)),l=null,c=null;if(a<=0){zi(e,o,s);return}e:for(let u=0;u<r.content.length;u++){let h=r.content[u];for(let d=0;d<h.lineParts.length;d++){let f=h.lineParts[d],g=Math.min(f.text.length,a);if(g<=0)break e;let m=f.furigana?.text||"",x=m.length,v=f.text.length>0?Math.round(g/f.text.length*x):0,{text:_,furiganaText:p}=Y_(f,f.text.substring(0,g),m.substring(0,v));if(p&&t.addChild(p),t.addChild(_),l=_,c=h,a-=g,g<f.text.length)break e}}c?(zi(e,c,s),wI(e,l,s)):zi(e,o,s),i>=n&&ws(e,c??o,l,r)},R3=({contentContainer:t,indicatorSprite:e,element:r})=>{let i=z_(r);if(i<=0){let s=ca(r),o=r.content[0]??null;zi(e,o,s);return}r.revealEffect==="softWipe"?k3({contentContainer:t,indicatorSprite:e,element:r,revealedCharacters:i}):C3({contentContainer:t,indicatorSprite:e,element:r,revealedCharacters:i})},M3=async({contentContainer:t,indicatorSprite:e,element:r,signal:i,startAtCharacter:s=0,snapshot:o=null})=>{let n=g3(r.speed??50),a=ca(r),{stepDelay:l,charactersPerStep:c}=x3(n),u=Math.max(l,Math.floor(4e3/n)),h=Math.max(0,Math.floor(s)),d=!1,f=null,g=null;o&&(o.revealedCharacters=h,o.completed=!1);for(let m=0;m<r.content.length;m++){if(i?.aborted||t.destroyed)return!1;let x=r.content[m],v=!1;zi(e,x,a);for(let _=0;_<x.lineParts.length;_++){if(i?.aborted||t.destroyed)return!1;let p=x.lineParts[_],{text:b,furiganaText:y}=Y_(p);y&&t.addChild(y),t.addChild(b);let S=p.text,E=p.furigana?.text||"";S.length>0&&(f=b,g=x);let P=E.length,C=Math.min(S.length,h),M=S.length>0?Math.round(C/S.length*P):0;b.text=S.substring(0,C),y&&(y.text=E.substring(0,M)),h-=C,C>0&&(e.x=Hf(b,C-1)+a.x);let R=C;for(;R<S.length;){if(i?.aborted||t.destroyed)return!1;let B=Math.min(S.length,R+c),A=B-1;if(b.text=S.substring(0,B),e.x=Hf(b,A)+a.x,v=!0,d=!0,o&&(o.revealedCharacters+=B-R),y){let O=Math.round(B/S.length*P);y.text=E.substring(0,O)}R=B,R<S.length&&await Wf(l,i)}}m<r.content.length-1&&v&&await Wf(u,i)}return d&&(await Wf(l,i),i?.aborted||t.destroyed)?!1:(ws(e,g,f,r),o&&(o.completed=!0),!0)},PI=({lines:t,edgeWidth:e,baseDuration:r,softWipe:i})=>{let s=t.map(c=>{let u=Math.max(1,c.totalCharacters),h=1+e/Math.max(1,c.bounds.width);return u*h}),o=s.reduce((c,u)=>c+u,0),n=[],a=0,l=0;for(let c=0;c<t.length;c++){let u=s[c],h=o>0?Math.max(1,r*u/o):r,d=Math.max(0,a),f=d+h;n.push({...t[c],startTime:d,endTime:f,duration:h}),l=Math.max(l,f),a=f-h*i.lineOverlap+i.lineDelay}return{timedLines:n,duration:Math.max(1,Math.ceil(l))}},I3=({currentTime:t,line:e,easing:r})=>{let i=e.duration>0?(t-e.startTime)/e.duration:1;return r(Math.max(0,Math.min(i,1)))},B3=({progress:t,easingName:e})=>{let r=p3(t,0,1);return e==="easeOutCubic"?1-Math.cbrt(1-r):r},CI=({timedLines:t,initialRevealedCharacters:e,softWipe:r,easingName:i})=>{let s=Math.max(0,Math.floor(e)),o=s<=0,n=0,a=0;return{timedLines:t.map(c=>{let u=Math.max(0,c.totalCharacters??0),h=0,d=!1;if(!o&&s>0)if(u<=0||s>=u)s-=u,h=1,d=!0;else{let m=s/u;h=B3({progress:m,easingName:i}),s=0,o=!0}if(d)return{...c,startTime:-c.duration,endTime:0};o=!0;let f=h>0?-h*c.duration:Math.max(0,n),g=f+c.duration;return a=Math.max(a,g),n=g-c.duration*r.lineOverlap+r.lineDelay,{...c,startTime:f,endTime:g}}),duration:Math.max(1,Math.ceil(a))}},F3=t=>{t.forEach(e=>{e&&(e.line.container.mask===e.sprite&&(e.line.container.mask=null),e.sprite.parent&&e.sprite.parent.removeChild(e.sprite),e.sprite.destroy(),e.texture.destroy(!0))})},RI=({contentContainer:t,timedLines:e,edgeWidth:r})=>{let i=e.map(s=>{let o=document.createElement("canvas");o.width=Math.max(1,Math.ceil(s.bounds.width+r)),o.height=Math.max(1,Math.ceil(s.bounds.height));let n=o.getContext("2d");if(!n)return null;let a=go(o),l=new Re(a);return l.x=Math.floor(s.bounds.x-r),l.y=Math.floor(s.bounds.y),s.container.mask=l,t.addChild(l),{canvas:o,context:n,texture:a,sprite:l,line:s,edgeWidth:r}});return i.some(s=>s===null)?(F3(i),null):i},MI=({timedLines:t,lineMasks:e,easing:r,indicatorSprite:i,indicatorOffsets:s,currentTime:o})=>{let n=t[0],a=n.bounds.x;for(let l=0;l<t.length;l++){let c=t[l],u=e[l],h=I3({currentTime:o,line:c,easing:r}),{context:d,canvas:f,texture:g}=u;if(d.clearRect(0,0,f.width,f.height),h<=0){g.source.update();continue}let m=0,x=c.bounds.width+u.edgeWidth,v=u.edgeWidth,_=v+h*x,p=Math.max(v,_-u.edgeWidth);p>v&&(d.fillStyle="#ffffff",d.fillRect(v,m,Math.min(p-v,c.bounds.width),c.bounds.height));let b=Math.max(v,_-u.edgeWidth),y=Math.min(v+c.bounds.width,_);if(y>b){let S=d.createLinearGradient(b,0,y,0);S.addColorStop(0,"rgba(255, 255, 255, 1)"),S.addColorStop(1,"rgba(255, 255, 255, 0)"),d.fillStyle=S,d.fillRect(b,m,y-b,c.bounds.height)}g.source.update(),n=c,a=c.bounds.x+Math.min(x,Math.max(0,_-v))}zi(i,n.chunk,s),i.x=a+s.x},k3=({contentContainer:t,indicatorSprite:e,element:r,revealedCharacters:i})=>{let s=ca(r),{lines:o,lastTextObject:n,lastChunk:a,totalCharacters:l,maxLineHeight:c}=j_(t,r);if(zi(e,a,s),o.length===0||l===0||i>=l||!o.some(_=>_.bounds.width>0&&_.bounds.height>0)||!globalThis.document){ws(e,a,n,r);return}let u=yo(r.softWipe),h=k_(u.easing),d=U_({maxLineHeight:c,softWipe:u}),f=W_(r.speed??50),g=Math.max(1,Math.round(l/f*1e3)),m=PI({lines:o,edgeWidth:d,baseDuration:g,softWipe:u}),{timedLines:x}=CI({timedLines:m.timedLines,initialRevealedCharacters:i,softWipe:u,easingName:u.easing}),v=RI({contentContainer:t,timedLines:x,edgeWidth:d});if(!v){ws(e,a,n,r);return}MI({timedLines:x,lineMasks:v,easing:h,indicatorSprite:e,indicatorOffsets:s,currentTime:0})},U3=({container:t,contentContainer:e,indicatorSprite:r,element:i,animationBus:s,completionTracker:o})=>{let n=ca(i),a=W_(i.speed??50),{lines:l,lastTextObject:c,lastChunk:u,totalCharacters:h,maxLineHeight:d}=j_(e,i),f=z_(i);if(zi(r,u,n),l.length===0||h===0||f>=h||!l.some(R=>R.bounds.width>0&&R.bounds.height>0)||!globalThis.document||!s)return ws(r,u,c,i),!1;let g=yo(i.softWipe),m=k_(g.easing),x=U_({maxLineHeight:d,softWipe:g}),v=Math.max(1,Math.round(h/a*1e3)),_=PI({lines:l,edgeWidth:x,baseDuration:v,softWipe:g}),{timedLines:p,duration:b}=CI({timedLines:_.timedLines,initialRevealedCharacters:f,softWipe:g,easingName:g.easing}),y=o.getVersion(),S=`${i.id}-soft-wipe`,E=RI({contentContainer:e,timedLines:p,edgeWidth:x});if(!E)return ws(r,u,c,i),!1;let P=!1,C=R=>{P||(P=!0,t[Wi]===M&&delete t[Wi],E.forEach(B=>{B.line.container.mask===B.sprite&&(B.line.container.mask=null),B.sprite.parent&&B.sprite.parent.removeChild(B.sprite),B.sprite.destroy(),B.texture.destroy(!0)}),R&&ws(r,u,c,i))},M=()=>{s.dispatch({type:"CANCEL",id:S}),C(!1)};return A3(t,M),o.track(y),s.dispatch({type:"START",payload:{id:S,driver:"custom",duration:b,applyFrame:R=>{MI({timedLines:p,lineMasks:E,easing:m,indicatorSprite:r,indicatorOffsets:n,currentTime:Math.min(b,R)})},applyTargetState:()=>{C(!1)},onComplete:()=>{o.complete(y),C(!0)},onCancel:()=>{o.complete(y),C(!1)},isValid:()=>!!t&&!t.destroyed&&!e.destroyed&&!r.destroyed}}),!0},$i=async({container:t,element:e,completionTracker:r,animationBus:i,zIndex:s,signal:o,app:n,playback:a="autoplay"})=>{if(o?.aborted||t.destroyed)return;let l=la(e),c=a==="resume"?EI(t):null,u=z_(e);if(a==="resume"&&!c)return;let h=r?.getVersion?.(),d=b3(e),f=!1,g=()=>{!d||f||(r?.track?.(h),f=!0)},m=()=>{f&&(f=!1,r?.complete?.(h))};g(),X_(t),t.zIndex=s;let x=new ee({label:`${e.id}-content`}),v;try{let _=S3(e,{app:n});if(v=N_(_)?await _:_,o?.aborted||t.destroyed){V_(v),m();return}if(t.addChild(x),t.addChild(v),v?.[aa]?.start(),a==="paused-initial"){l||uu(t,{mode:y3(e),revealedCharacters:u,completed:!1}),l?(uu(t,{mode:"none",completed:!0}),gI({contentContainer:x,indicatorSprite:v,element:e})):R3({contentContainer:x,indicatorSprite:v,element:e}),m();return}let p=r.getVersion(),b=!1;if(l)r.track(p),m(),uu(t,{mode:"none",completed:!0}),gI({contentContainer:x,indicatorSprite:v,element:e}),b=!0;else if(e.revealEffect==="softWipe")if(uu(t,{mode:"softWipe",revealedCharacters:u,completed:!1}),!U3({container:t,contentContainer:x,indicatorSprite:v,element:e,animationBus:i,completionTracker:r})&&!o?.aborted&&!t.destroyed)r.track(p),m(),b=!0;else{m();return}else{r.track(p),m();let y=c?.revealedCharacters??u,S=uu(t,{mode:"typewriter",revealedCharacters:y,completed:!1});b=await M3({contentContainer:x,indicatorSprite:v,element:e,signal:o,startAtCharacter:y,snapshot:S})}b&&!o?.aborted&&!t.destroyed&&r.complete(p)}catch(_){if(m(),v&&!v.destroyed&&!v.parent&&V_(v),_?.name!=="AbortError"&&!o?.aborted)throw _}};var $f=({suppressAnimations:t=!1,deferredMountOperations:e=[]}={})=>({suppressAnimations:t,deferredMountOperations:e}),II=t=>{switch(t?.type){case"play-animated-sprite":t.animatedSprite?.destroyed||t.animatedSprite?.play();return;case"play-video":t.video?.play();return;case"start-particles":if(t.app?.debug){let e=r=>{if(t.emitter.destroyed){window.removeEventListener("snapShotKeyFrame",e);return}r?.detail?.deltaMS&&(t.emitter.update(Number(r.detail.deltaMS)/1e3),typeof t.app?.render=="function"&&t.app.render())};window.addEventListener("snapShotKeyFrame",e),t.container.customTickerHandler=e;return}t.app.ticker.add(t.tickerCallback);return;case"autoplay-text-reveal":$i({container:t.container,element:t.element,completionTracker:t.completionTracker,animationBus:t.animationBus,zIndex:t.zIndex,signal:t.signal,app:t.app,playback:"autoplay"});return;case"start-update-animations":if(!t.element||t.element.destroyed)return;Vf({animations:t.animations,animationBus:t.animationBus,completionTracker:t.completionTracker,element:t.element,targetState:t.targetState,animationBaseState:t.animationBaseState});return}},hu=(t,e)=>{if(e?.type){if(!t?.suppressAnimations){II(e);return}t.deferredMountOperations.push(e)}},du=t=>{t?.deferredMountOperations&&(t.deferredMountOperations.length=0)},BI=(t,e)=>hu(t,{type:"play-animated-sprite",animatedSprite:e}),FI=(t,e)=>hu(t,{type:"play-video",video:e}),kI=(t,{app:e,emitter:r,container:i,tickerCallback:s})=>hu(t,{type:"start-particles",app:e,emitter:r,container:i,tickerCallback:s}),Xf=(t,{app:e,container:r,element:i,completionTracker:s,animationBus:o,zIndex:n,signal:a})=>hu(t,{type:"autoplay-text-reveal",app:e,container:r,element:i,completionTracker:s,animationBus:o,zIndex:n,signal:a}),UI=(t,{animations:e,animationBus:r,completionTracker:i,element:s,targetState:o,animationBaseState:n})=>hu(t,{type:"start-update-animations",animations:e,animationBus:r,completionTracker:i,element:s,targetState:o,animationBaseState:n}),OI=t=>{if(!t?.deferredMountOperations?.length)return;let e=t.deferredMountOperations.splice(0);for(let r of e)II(r)};var O3=Object.prototype.hasOwnProperty,ge=(t,e)=>{if(Object.is(t,e))return!0;if(t===null||e===null||typeof t!="object"||typeof e!="object")return!1;let r=Array.isArray(t),i=Array.isArray(e);if(r!==i)return!1;if(r&&i){if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(!ge(t[n],e[n]))return!1;return!0}let s=Object.keys(t),o=Object.keys(e);if(s.length!==o.length)return!1;for(let n of s)if(!O3.call(e,n)||!ge(t[n],e[n]))return!1;return!0};var bo=t=>{let e=new Set;if(t.id&&e.add(t.id),t.children&&Array.isArray(t.children))for(let r of t.children)for(let i of bo(r))e.add(i);return e};var GI=(t=[])=>{if(t instanceof Map)return t;let e=new Map;for(let r of t)e.has(r.targetId)||e.set(r.targetId,[]),e.get(r.targetId).push(r);return e},Yf=(t,e)=>t?t instanceof Map?t.get(e)??[]:t.filter(r=>r.targetId===e):[],DI=(t,e)=>Yf(t,e).filter(r=>r.type==="update"),jf=(t,e)=>Yf(t,e).find(r=>r.type==="transition")??null,LI=(t=[])=>t.some(e=>Object.keys(e.tween??{}).some(Ts)),fu=(t=[],e,r=[])=>{for(let i of t){if(i?.id===e)return{element:i,ancestorIds:r};if(Array.isArray(i?.children)){let s=fu(i.children,e,[...r,i.id]);if(s)return s}}return null},NI=(t,e)=>ge(t?.ancestorIds??null,e?.ancestorIds??null),L3=({subtreeRoot:t,nextAnimations:e,continuingAnimationId:r})=>{if(!t)return!1;let i=bo(t);for(let s of e??[])if(!(!s||s.id===r)&&i.has(s.targetId))return!0;return!1},q_=(t={})=>t.type==="update"?JSON.stringify({type:t.type,tween:t.tween,playback:t.playback??null}):JSON.stringify({type:t.type,prev:t.prev??null,next:t.next??null,mask:t.mask??null,compositor:t.compositor??null,tween:t.tween??null,playback:t.playback??null}),G3=({prevState:t,nextState:e,animation:r})=>{let i=fu(t?.elements,r.targetId),s=fu(e?.elements,r.targetId);return i!==null&&s!==null&&NI(i,s)&&ge(i.element,s.element)},D3=({prevState:t,nextState:e,animation:r})=>{let i=fu(t?.elements,r.targetId),s=fu(e?.elements,r.targetId);return i===null&&s===null?!0:i===null||s===null||!NI(i,s)||!ge(i.element,s.element)?!1:!L3({subtreeRoot:s.element,nextAnimations:e?.animations,continuingAnimationId:r.id})},VI=({prevState:t,nextState:e,activeAnimations:r})=>{let i=new Set,s=r instanceof Map?r:new Map(r?.map(o=>[o.id,o])??[]);for(let o of e?.animations??[]){if(o?.playback?.continuity!=="persistent")continue;let n=s.get(o.id);if(n&&!(n.type!==o.type||n.targetId!==o.targetId||n.signature!==q_(o))){if(o.type==="update"){G3({prevState:t,nextState:e,animation:o})&&i.add(o.id);continue}D3({prevState:t,nextState:e,animation:o})&&i.add(o.id)}}return{continuedAnimationIds:i}},N3=({animations:t,targetId:e,animationBus:r,completionTracker:i,element:s,targetState:o,onComplete:n,renderContext:a})=>{let l=DI(t,e),c=l.filter(h=>typeof r?.hasContext=="function"?r.hasContext(h.id):!1),u=l.filter(h=>!c.includes(h));if(l.length===0)return!1;if(u.length===0)return!0;if(a?.suppressAnimations){if(n)throw new Error("Deferred update animations do not support onComplete hooks.");let h=LI(u)?Ss(s):void 0;return hI(s,u,void 0,h),UI(a,{animations:u,animationBus:r,completionTracker:i,element:s,targetState:o,animationBaseState:h}),!0}return Vf({animations:u,animationBus:r,completionTracker:i,element:s,targetState:o,onComplete:n,animationBaseState:LI(u)?Ss(s):void 0}),!0},ua=DI;var re=N3;var HI=t=>!!t&&typeof t=="object"&&!Array.isArray(t),V3=(t,e)=>e===void 0?t:e===null||e===!1?null:HI(e)?{...HI(t)?t:{},...e}:e,Ti=(t={},e={})=>{if(!e)return{...t};let r={...t,...e};return Object.prototype.hasOwnProperty.call(e,"shadow")&&(r.shadow=V3(t?.shadow,e.shadow)),r};var zI=Symbol("routeGraphicsTextAnchorRatios"),vo=Symbol("routeGraphicsTextLayoutState"),WI=(t,e)=>typeof t!="number"||t===0?0:e/t,K_=t=>t?.align??Ge.align,H3=t=>{let e=t[vo];return e?.fixedWidth&&typeof e.layoutWidth=="number"?e.layoutWidth:typeof e?.measuredWidth=="number"?e.measuredWidth:t.width},W3=(t,e)=>{let r=Ve.measureText(String(t??""),new Be(Ft(e,{includeShadow:!1})));return{width:r.width,height:r.height}},$I=t=>t?.shadow!==void 0&&t.shadow!==null&&t.shadow!==!1,J_=(t,e)=>$I(e)?W3(t.text,e):{width:t.width,height:t.height},Z_=t=>{let e=t[vo];return typeof e?.measuredWidth=="number"?e.measuredWidth:t.width},z3=t=>{let e=t[vo];return typeof e?.measuredHeight=="number"?e.measuredHeight:t.height},XI=(t,e,r)=>{let i=!!e.__fixedWidth,s=r??J_(t,e.textStyle),o=s.width??e.measuredWidth??e.width,n=s.height??e.height??t.height;t[vo]={fixedWidth:i,layoutWidth:i?e.width:o,measuredWidth:o,measuredHeight:n}},Q_=(t,e,r)=>{let i=Math.max(0,t-e);return r==="center"?i/2:r==="right"?i:0},eb=t=>{let e=t.measuredWidth??t.width,r=Q_(t.width,e,K_(t.textStyle));return{x:t.x+r,y:t.y}},qf=(t,e)=>{let r=J_(t,e.textStyle),i=e.__fixedWidth&&typeof e.width=="number"?e.width:r.width,s=r.height,o=typeof e.__anchorXRatio=="number"?e.__anchorXRatio:WI(i,e.originX),n=typeof e.__anchorYRatio=="number"?e.__anchorYRatio:WI(s,e.originY);t[zI]={x:o,y:n},XI(t,e,r)},$3=t=>typeof t?.fontSize!="number"||t.fontSize===0||typeof t?.lineHeight!="number"?Ge.lineHeight:t.lineHeight/t.fontSize,X3=(t,e)=>{if(!e)return t;let r=Ti(t,e);if(e.fontSize!==void 0||e.lineHeight!==void 0){let i=e.lineHeight??$3(t);r.lineHeight=Math.round(r.fontSize*i)}return r},YI=(t,e,r)=>{let i=t[zI],s=H3(t),o=X3(e,r);if(!i){vi(t,o);return}let n=Q_(s,Z_(t),K_(t.style)),l=t.x-n+s*i.x,c=t.y+z3(t)*i.y;vi(t,o);let u=J_(t,o),d=t[vo]?.fixedWidth===!0?s:u.width,f=Q_(d,u.width,K_(o));t.x=l-d*i.x+f,t.y=c-u.height*i.y,t[vo]={...t[vo]??{},layoutWidth:d,measuredWidth:u.width,measuredHeight:u.height}},Kf=(t,e)=>{XI(t,e);let r=$I(e.textStyle)?e.measuredWidth??Z_(t):Z_(t),i=eb({...e,measuredWidth:r,width:e.__fixedWidth&&typeof e.width=="number"?e.width:r});t.x=i.x,t.y=i.y};var $e=(t,e=100)=>Math.min(Math.max(t??e,0),100)/100;var jI=t=>{if(!(!t||typeof t!="object")){if(typeof t.button=="number")return t.button;if(typeof t.data?.button=="number")return t.data.button;if(typeof t.nativeEvent?.button=="number")return t.nativeEvent.button}},kt=t=>{let e=jI(t);return e===void 0||e===0},qI=t=>jI(t)===2;var tb=Symbol.for("routeGraphics.setInheritedHover"),KI=Symbol.for("routeGraphics.treeInheritedHoverActive"),rb=Symbol.for("routeGraphics.setInheritedPress"),ZI=Symbol.for("routeGraphics.treeInheritedPressActive"),ib=Symbol.for("routeGraphics.setInheritedRightPress"),QI=Symbol.for("routeGraphics.treeInheritedRightPressActive"),ha=t=>Array.isArray(t?.children)?t.children:[],sb=({displayObject:t,symbol:e,source:r,isActive:i})=>{let s=t?.[e];typeof s=="function"&&s(r,i)},Zf=({displayObject:t,symbol:e})=>{t&&e in t&&delete t[e]},ob=({displayObject:t,symbol:e,onStateChange:r})=>{let i=!1,s=new Set,o=({nextDirectActive:n=i,onInheritedChange:a})=>{let l=i||s.size>0;i=n,a?.(s);let c=i||s.size>0;return l!==c&&r(c),c};return t[e]=(n,a)=>o({onInheritedChange:l=>{if(n){if(a){l.add(n);return}l.delete(n)}}}),{setDirectState:n=>o({nextDirectActive:n}),isActive:()=>i||s.size>0,destroy:()=>{Zf({displayObject:t,symbol:e})}}},da=t=>Zf({displayObject:t,symbol:tb}),Qf=t=>Zf({displayObject:t,symbol:rb}),Jf=t=>Zf({displayObject:t,symbol:ib}),Es=({displayObject:t,onHoverChange:e})=>{let r=ob({displayObject:t,symbol:tb,onStateChange:e});return{setDirectHover:r.setDirectState,isHovering:r.isActive,destroy:r.destroy}},fa=({displayObject:t,onPressChange:e})=>{let r=ob({displayObject:t,symbol:rb,onStateChange:e});return{setDirectPress:r.setDirectState,isPressed:r.isActive,destroy:r.destroy}},pa=({displayObject:t,onPressChange:e})=>{let r=ob({displayObject:t,symbol:ib,onStateChange:e});return{setDirectPress:r.setDirectState,isPressed:r.isActive,destroy:r.destroy}},nb=t=>t?.[KI]===!0,ab=t=>t?.[ZI]===!0,lb=t=>t?.[QI]===!0,ma=({root:t,isHovered:e})=>{if(!t)return;t[KI]=e;let r=[...ha(t)];for(;r.length>0;){let i=r.pop();sb({displayObject:i,symbol:tb,source:t,isActive:e}),r.push(...ha(i))}},To=({root:t,isPressed:e})=>{if(!t)return;t[ZI]=e;let r=[...ha(t)];for(;r.length>0;){let i=r.pop();sb({displayObject:i,symbol:rb,source:t,isActive:e}),r.push(...ha(i))}},Xi=({root:t,isPressed:e})=>{if(!t)return;t[QI]=e;let r=[...ha(t)];for(;r.length>0;){let i=r.pop();sb({displayObject:i,symbol:ib,source:t,isActive:e}),r.push(...ha(i))}};var JI="__rtglScrollHandled",eB=t=>t?.payload&&typeof t.payload=="object"?t.payload:{},Lr=({canvas:t,displayObject:e,width:r,height:i,scrollUpEvent:s,scrollDownEvent:o,eventHandler:n})=>{if(!s&&!o)return;let a=!1,l=Number.isFinite(r)&&Number.isFinite(i)&&r>0&&i>0;e.eventMode="static",l&&(e.hitArea=new Q(0,0,Math.round(r),Math.round(i)));let c=(g,m)=>{m?.[JI]||(m&&(m[JI]=!0),g<0&&s&&n?n("scrollUp",{_event:{id:e.label},...eB(s)}):g>0&&o&&n&&n("scrollDown",{_event:{id:e.label},...eB(o)}))},u=()=>{a=!0},h=()=>{a=!1},d=g=>{g.preventDefault?.(),c(g.deltaY,g.nativeEvent)},f=g=>{a&&(g.preventDefault(),c(g.deltaY,g))};e.on("pointerover",u),e.on("pointerout",h),e.on("wheel",d),t?.addEventListener("wheel",f,{passive:!1}),e._cleanupScrollInteraction=()=>{a=!1,e.off("pointerover",u),e.off("pointerout",h),e.off("wheel",d),t?.removeEventListener("wheel",f),l&&(e.hitArea=null),delete e._cleanupScrollInteraction}},cb=({root:t})=>{t?._cleanupScrollInteraction?.(),t?.children?.forEach(e=>{cb({root:e})})};var ga=t=>{t._cleanupScrollInteraction?.(),t.removeAllListeners("pointerover"),t.removeAllListeners("pointerout"),t.removeAllListeners("pointerdown"),t.removeAllListeners("pointerupoutside"),t.removeAllListeners("pointerup"),t.removeAllListeners("rightdown"),t.removeAllListeners("rightclick"),t.removeAllListeners("rightup"),t.removeAllListeners("rightupoutside"),t.removeAllListeners("wheel"),da(t),Qf(t),Jf(t),t.cursor="auto",t.eventMode="auto"},pu=({app:t,displayObject:e,textComputedNode:r,eventHandler:i,applyStyle:s})=>{let o=r?.hover,n=r?.click,a=r?.rightClick,l=r?.scrollUp,c=r?.scrollDown,u=null,h=null,d=null,f=()=>{let g=u?.isHovering()??!1,m=h?.isPressed()??!1;(d?.isPressed()??!1)&&a?.textStyle?s(a.textStyle):m&&n?.textStyle?s(n.textStyle):g&&o?.textStyle?s(o.textStyle):s()};if(o){let{cursor:g,soundSrc:m,payload:x}=o;e.eventMode="static",u=Es({displayObject:e,onHoverChange:f});let v=()=>{u.setDirectHover(!0),x&&i&&i("hover",{_event:{id:e.label},...x}),g&&(e.cursor=g),m&&t.audioStage.add({id:`hover-${Date.now()}`,url:m,loop:!1})},_=()=>{u.setDirectHover(!1),e.cursor="auto"};e.on("pointerover",v),e.on("pointerout",_)}if(n){let{soundSrc:g,soundVolume:m,payload:x}=n;e.eventMode="static",h=fa({displayObject:e,onPressChange:f});let v=b=>{kt(b)&&h.setDirectPress(!0)},_=b=>{kt(b)&&(h.setDirectPress(!1),x&&i&&i("click",{_event:{id:e.label},...x}),g&&t.audioStage.add({id:`click-${Date.now()}`,url:g,loop:!1,volume:$e(m)}))},p=()=>{h.setDirectPress(!1)};e.on("pointerdown",v),e.on("pointerup",_),e.on("pointerupoutside",p)}if(a){let{soundSrc:g,payload:m}=a;e.eventMode="static",d=pa({displayObject:e,onPressChange:f});let x=()=>{d.setDirectPress(!0)},v=()=>{d.setDirectPress(!1)},_=()=>{d.setDirectPress(!1),m&&i&&i("rightClick",{_event:{id:e.label},...m}),g&&t.audioStage.add({id:`rightClick-${Date.now()}`,url:g,loop:!1})},p=()=>{d.setDirectPress(!1)};e.on("rightdown",x),e.on("rightup",v),e.on("rightclick",_),e.on("rightupoutside",p)}(l||c)&&Lr({canvas:t.canvas,displayObject:e,scrollUpEvent:l,scrollDownEvent:c,eventHandler:i})};var iB=Symbol("routeGraphicsRichTextDisplay"),Y3=t=>t?.align??Ge.align,j3=(t,e,r)=>{let i=Math.max(0,t-e.width),s=0;return r==="center"?s=i/2:r==="right"&&(s=i),s-e.x},q3=t=>{t.removeChildren().forEach(r=>{r.destroy({children:!0})})},tB=({text:t,style:e,x:r,y:i})=>new br({text:t,style:new Be(Ft(e)),x:Math.round(r),y:Math.round(i)}),rB=(t,e)=>e?Ti(t,e):t,So=t=>Array.isArray(t?.content),sB=t=>!!t?.[iB],oB=t=>({x:t.x,y:t.y}),mu=(t,e,r)=>{q3(t),t.label=e.id,t.x=Math.round(e.x??0),t.y=Math.round(e.y??0),t.alpha=e.alpha??1;let i=e.width??e.measuredWidth??0;for(let s=0;s<e.content.length;s++){let o=e.content[s],n=new ee({label:`${e.id}-line-${s}`});for(let l of o.lineParts??[])l.furigana&&n.addChild(tB({text:l.furigana.text,style:rB(l.furigana.textStyle,r),x:l.furigana.x,y:l.furigana.y})),n.addChild(tB({text:l.text,style:rB(l.textStyle,r),x:l.x,y:l.y}));let a=n.getLocalBounds();n.x=j3(i,a,Y3(e.textStyle)),t.addChild(n)}t.hitArea=new Q(0,0,Math.max(0,i),Math.max(0,e.height??0))},nB=(t,e)=>{let r=new ee({label:t.id});return r[iB]=!0,r.zIndex=e,mu(r,t),r};var ub="__routeGraphicsManagedFilters",K3=["shadow","blur","shader"],Z3=t=>(t[ub]||Object.defineProperty(t,ub,{value:new Map,enumerable:!1,configurable:!0}),t[ub]),Q3=t=>t.filters?Array.isArray(t.filters)?t.filters:[t.filters]:[],ep=t=>t?Array.isArray(t)?t.filter(Boolean):[t]:[],J3=(t,e,r)=>{let i=new Set;for(let a of e.values())for(let l of ep(a))i.add(l);for(let a of ep(r))i.add(a);let s=Q3(t).filter(a=>!i.has(a)),n=[...K3.flatMap(a=>ep(e.get(a))),...s];t.filters=n.length>0?n:null},eV=t=>{for(let e of ep(t))e.destroy?.()},wo=(t,e,r)=>{let i=Z3(t),s=i.get(e);r?i.set(e,r):i.delete(e),J3(t,i,s),s&&s!==r&&eV(s)};var aB=/^[a-z][A-Za-z0-9]*$/;var tV=new Set(["shader"]),lB=new Set(["normal","add","multiply","screen"]),cB=new Set(["clamp","repeat"]),rV=new Set(["uTexture","uPrevTexture","uNextTexture","uNextTextureMatrix","uNextTextureClamp","uProgress","uResolution","uSampler","GlobalFilterUniforms","ShaderUniforms","VSOutput","gfu","shaderUniforms","mainVertex","mainFragment","uInputSize","uInputPixel","uInputClamp","uOutputFrame","uGlobalFrame","uOutputTexture"]),iV=t=>!!t&&typeof t=="object"&&!Array.isArray(t),uB=t=>typeof t=="number"&&Number.isFinite(t),As=(t,e)=>{if(!iV(t))throw new Error(`Input Error: ${e} must be an object`)},gu=(t,e)=>{if(typeof t!="string"||t.length===0)throw new Error(`Input Error: ${e} must be a non-empty string`)},hB=(t,e)=>{if(!aB.test(t))throw new Error(`Input Error: ${e} must match ${aB.source}`)},dB=t=>t.charAt(0).toUpperCase()+t.slice(1),sV=t=>`u${dB(t)}`,oV=t=>`u${dB(t)}Texture`,fB=({key:t,symbol:e,path:r,symbols:i,kind:s})=>{if(rV.has(e))throw new Error(`Input Error: ${r}.${t} generates reserved shader symbol ${e}`);if(i.has(e))throw new Error(`Input Error: ${r}.${t} generates duplicate shader symbol ${e}`);i.set(e,{key:t,kind:s})},nV=(t,e)=>{if(uB(t))return{type:"f32",value:t};if(Array.isArray(t)&&(t.length===2||t.length===4)&&t.every(uB))return{type:t.length===2?"vec2<f32>":"vec4<f32>",value:[...t]};throw new Error(`Input Error: ${e} must be a number, a length-2 number array, or a length-4 number array`)},aV=(t,e,r)=>t===void 0?[]:(As(t,e),Object.keys(t).sort().map(i=>{hB(i,`${e}.${i}`);let s=sV(i);return fB({key:i,symbol:s,path:e,symbols:r,kind:"uniform"}),{key:i,symbol:s,...nV(t[i],`${e}.${i}`)}})),lV=({textures:t,path:e,symbols:r,maxTextures:i})=>{if(t===void 0)return[];As(t,e);let s=Object.keys(t).sort();if(s.length>i)throw new Error(`Input Error: ${e} supports at most ${i} custom textures`);return s.map(o=>{hB(o,`${e}.${o}`),gu(t[o],`${e}.${o}`);let n=oV(o);return fB({key:o,symbol:n,path:e,symbols:r,kind:"texture"}),{key:o,symbol:n,src:t[o]}})},cV=(t,e)=>{if(t===void 0)return{blend:"normal",textureWrap:"clamp",mipmap:!1};As(t,e);let r=t.blend??"normal";if(!lB.has(r))throw new Error(`Input Error: ${e}.blend must be one of: ${Array.from(lB).join(", ")}`);let i=t.textureWrap??"clamp";if(!cB.has(i))throw new Error(`Input Error: ${e}.textureWrap must be one of: ${Array.from(cB).join(", ")}`);let s=t.mipmap??!1;if(typeof s!="boolean")throw new Error(`Input Error: ${e}.mipmap must be a boolean`);return{blend:r,textureWrap:i,mipmap:s}},uV=(t,e)=>{if(As(t,e),As(t.webgl,`${e}.webgl`),As(t.webgpu,`${e}.webgpu`),t.webgl.vertex!==void 0&&typeof t.webgl.vertex!="string")throw new Error(`Input Error: ${e}.webgl.vertex must be a string`);if(gu(t.webgl.fragment,`${e}.webgl.fragment`),gu(t.webgpu.source,`${e}.webgpu.source`),!t.webgpu.source.includes("mainVertex")||!t.webgpu.source.includes("mainFragment"))throw new Error(`Input Error: ${e}.webgpu.source must define mainVertex and mainFragment`);return{webgl:{...t.webgl.vertex!==void 0?{vertex:t.webgl.vertex}:{},fragment:t.webgl.fragment},webgpu:{source:t.webgpu.source}}},hV=(t,e)=>{if(t===void 0)return{grid:[1,1]};if(As(t,e),!Array.isArray(t.grid)||t.grid.length!==2||!t.grid.every(r=>Number.isInteger(r)&&r>=1))throw new Error(`Input Error: ${e}.grid must be [columns, rows] with positive integers`);return{grid:[t.grid[0],t.grid[1]]}},pB=({shader:t,path:e,requireId:r,textureLimit:i,allowMesh:s})=>{if(As(t,e),!tV.has(t.type))throw new Error(`Input Error: ${e}.type must be shader`);let o={type:"shader"};r?(gu(t.id,`${e}.id`),o.id=t.id):t.id!==void 0&&(gu(t.id,`${e}.id`),o.id=t.id);let n=new Map;if(o.uniforms=aV(t.uniforms,`${e}.uniforms`,n),o.textures=lV({textures:t.textures,path:`${e}.textures`,symbols:n,maxTextures:i}),o.pipeline=cV(t.pipeline,`${e}.pipeline`),o.source=uV(t.source,`${e}.source`),t.mesh!==void 0&&!s)throw new Error(`Input Error: ${e}.mesh is only valid for compositors`);return s&&(o.mesh=hV(t.mesh,`${e}.mesh`)),o},mB=(t,e="filters")=>{if(t===void 0)return;if(!Array.isArray(t))throw new Error(`Input Error: ${e} must be an array`);let r=new Set;return t.map((i,s)=>{let o=pB({shader:i,path:`${e}[${s}]`,requireId:!0,textureLimit:7,allowMesh:!1});if(r.has(o.id))throw new Error(`Input Error: ${e}[${s}].id must be unique within filters`);return r.add(o.id),o})},gB=(t,e="compositor")=>pB({shader:t,path:e,requireId:!1,textureLimit:6,allowMesh:!0}),xB=t=>JSON.stringify(t??null);var db="__routeGraphicsShaderFilters",Eo="__routeGraphicsShaderProgress",yB="__routeGraphicsShaderDestroyCleanup",dV=`
|
|
1264
1264
|
precision mediump float;
|
|
1265
1265
|
|
|
1266
1266
|
in vec2 aPosition;
|
|
@@ -1291,7 +1291,7 @@ void main(void)
|
|
|
1291
1291
|
gl_Position = filterVertexPosition();
|
|
1292
1292
|
vTextureCoord = filterTextureCoord();
|
|
1293
1293
|
}
|
|
1294
|
-
`,fb=t=>Number.isFinite(t)?t:0,fV=(t,e)=>t?t instanceof Map?t.get(e)??[]:t.filter(r=>r?.targetId===e):[],Xe=(t,e)=>fV(t,e).some(r=>r?.type==="update"&&r.tween?.uProgress!==void 0),pV=t=>t.type==="f32"?t.value:new Float32Array(t.value),mV=(t,e,r,i,{includeNextTextureTransform:s=!1}={})=>{let o={uProgress:{value:fb(i),type:"f32"},uResolution:{value:new Float32Array([Math.max(1,e),Math.max(1,r)]),type:"vec2<f32>"}};s&&(o.uNextTextureMatrix={value:new V,type:"mat3x3<f32>"},o.uNextTextureClamp={value:new Float32Array([0,0,1,1]),type:"vec4<f32>"});for(let n of t.uniforms??[])o[n.symbol]={value:pV(n),type:n.type};return new we(o)},gV=t=>t?.textureWrap==="repeat"?"repeat":"clamp-to-edge",xV=t=>t?.mipmap===!0?"linear":"nearest",yV=(t,e)=>!t||!t.resource||t.uploadMethodId==="video"?t:Ee.from({...t.options??{},resource:t.resource,width:t.width,height:t.height,resolution:t.resolution,format:t.format,dimensions:t.dimension,mipLevelCount:t.mipLevelCount,autoGenerateMipmaps:e?.mipmap===!0,sampleCount:t.sampleCount,antialias:t.antialias,alphaMode:t.alphaMode,addressMode:gV(e),mipmapFilter:xV(e)}),_V=t=>{let e={},r=[];for(let i of t.textures??[]){let s=F.from(i.src).source,o=yV(s,t.pipeline);e[i.symbol]=o,o!==s&&r.push(o)}return{resources:e,ownedTextureSources:r}},bV=(t=[1,1])=>{let e=Math.max(1,t[0]??1),r=Math.max(1,t[1]??1);if(e===1&&r===1)return null;let i=[],s=[];for(let n=0;n<=r;n++)for(let a=0;a<=e;a++)i.push(a/e,n/r);let o=e+1;for(let n=0;n<r;n++)for(let a=0;a<e;a++){let l=n*o+a,c=l+1,u=l+o,h=u+1;s.push(l,c,u,c,h,u)}return new Jt({attributes:{aPosition:{buffer:new Float32Array(i),format:"float32x2",stride:2*4,offset:0}},indexBuffer:new Uint32Array(s)})},vV=({filterManager:t,filter:e,geometry:r,input:i,output:s,clear:o})=>{let n=t.renderer,a=t._filterStack[t._filterStackIndex],l=a.bounds,c=ye.shared,h=a.previousRenderSurface===s,d=n.renderTarget.rootRenderTarget.colorTexture.source._resolution,f=t._filterStackIndex-1;for(;f>0&&t._filterStack[f].skip;)f--;f>0&&(d=t._filterStack[f].inputTexture.source._resolution);let g=t._filterGlobalUniforms,m=g.uniforms,x=m.uOutputFrame,v=m.uInputSize,_=m.uInputPixel,p=m.uInputClamp,b=m.uGlobalFrame,y=m.uOutputTexture;if(h){let P=t._filterStackIndex;for(;P>0;){P--;let C=t._filterStack[P];if(!C.skip){c.x=C.bounds.minX,c.y=C.bounds.minY;break}}x[0]=l.minX-c.x,x[1]=l.minY-c.y}else x[0]=0,x[1]=0;x[2]=i.frame.width,x[3]=i.frame.height,v[0]=i.source.width,v[1]=i.source.height,v[2]=1/v[0],v[3]=1/v[1],_[0]=i.source.pixelWidth,_[1]=i.source.pixelHeight,_[2]=1/_[0],_[3]=1/_[1],p[0]=.5*_[2],p[1]=.5*_[3],p[2]=i.frame.width*v[2]-.5*_[2],p[3]=i.frame.height*v[3]-.5*_[3];let S=n.renderTarget.rootRenderTarget.colorTexture;b[0]=c.x*d,b[1]=c.y*d,b[2]=S.source.width*d,b[3]=S.source.height*d;let E=n.renderTarget.getRenderTarget(s);if(n.renderTarget.bind(s,!!o),s instanceof F?(y[0]=s.frame.width,y[1]=s.frame.height):(y[0]=E.width,y[1]=E.height),y[2]=E.isRoot?-1:1,g.update(),n.renderPipes.uniformBatch){let P=n.renderPipes.uniformBatch.getUboResource(g);t._globalFilterBindGroup.setResource(P,0)}else t._globalFilterBindGroup.setResource(g,0);t._globalFilterBindGroup.setResource(i.source,1),t._globalFilterBindGroup.setResource(i.source.style,2),e.groups[0]=t._globalFilterBindGroup,n.encoder.draw({geometry:r,shader:e,state:e._state,topology:"triangle-list"}),n.type===Ne.WEBGL&&n.renderTarget.finishRenderPass()},tp=(t,e)=>{let r=t?.resources?.shaderUniforms;r?.uniforms&&(r.uniforms.uProgress=fb(e),r.update())},pb=(t,e,r)=>{let i=t?.resources?.shaderUniforms;i?.uniforms&&(i.uniforms.uResolution=new Float32Array([Math.max(1,e),Math.max(1,r)]),i.update())},mb=({shader:t,width:e,height:r,progress:i=0,nextTextureSource:s,name:o="route-graphics-shader-filter"})=>{let n=mV(t,e,r,i,{includeNextTextureTransform:!!s}),a=_V(t),l={shaderUniforms:n,...s?{uNextTexture:s}:{},...a.resources},c=Ir.from({gpu:{vertex:{source:t.source.webgpu.source,entryPoint:"mainVertex"},fragment:{source:t.source.webgpu.source,entryPoint:"mainFragment"}},gl:{vertex:t.source.webgl.vertex??dV,fragment:t.source.webgl.fragment,name:o},resources:l,blendMode:t.pipeline?.blend??"normal"}),u=bV(t.mesh?.grid);if(u&&(c.apply=(h,d,f,g)=>{vV({filterManager:h,filter:c,geometry:u,input:d,output:f,clear:g})}),u||a.ownedTextureSources.length>0){let h=c.destroy.bind(c);c.destroy=(...d)=>{h(...d),u?.destroy();for(let f of a.ownedTextureSources)f.destroy()}}return c},gb=t=>t?.[db]??null,TV=(t,e)=>{Object.defineProperty(t,db,{value:e,enumerable:!1,configurable:!0,writable:!0})},SV=t=>{if(!t||typeof t.destroy!="function"||t[yB])return;let e=t.destroy;Object.defineProperty(t,yB,{value:!0,enumerable:!1,configurable:!0}),t.destroy=function(...i){return hb(this),e.apply(this,i)}},wV=(t,e)=>{let r=gb(t);for(let i of r?.filters??[])tp(i,e)},EV=t=>{if(!t)return;t[Eo]===void 0&&Object.defineProperty(t,Eo,{value:0,enumerable:!1,configurable:!0,writable:!0});let e=Object.getOwnPropertyDescriptor(t,"uProgress");e?.get||e?.set||Object.defineProperty(t,"uProgress",{get(){return this[Eo]??0},set(r){this[Eo]=fb(r),wV(this,this[Eo])},enumerable:!1,configurable:!0})},Gr=t=>{!t||t[Eo]===void 0||(t.uProgress=0)},AV=t=>t?.filters?.some(e=>e?.type==="shader")??!1,_B=(t,e)=>{if(!t||!e)return null;if(t.label===e)return t;for(let r of t.children??[]){let i=_B(r,e);if(i)return i}return null},bB=({parent:t,element:e,animations:r})=>{if(!e)return!1;if(AV(e)&&!Xe(r,e.id)){let i=_B(t,e.id);if(i?.[Eo]!==void 0&&i.uProgress!==0)return!0}return xb({parent:t,elements:e.children,animations:r})},xb=({parent:t,elements:e=[],animations:r})=>(e??[]).some(i=>bB({parent:t,element:i,animations:r})),Dr=({parent:t,nextElement:e,animations:r})=>bB({parent:t,element:e,animations:r}),hb=t=>{gb(t)&&(wo(t,"shader",null),delete t[db])},Ie=(t,e,{width:r,height:i,force:s=!1}={})=>{if(!t)return;if(!e?.length&&!s){hb(t);return}if(EV(t),SV(t),!e?.length){hb(t);return}let o=Math.max(1,Math.round(r??t.width??1)),n=Math.max(1,Math.round(i??t.height??1)),a=xB(e),l=gb(t);if(l?.signature===a){for(let u of l.filters)pb(u,o,n),tp(u,t.uProgress);wo(t,"shader",l.filters);return}let c=e.map(u=>mb({shader:u,width:o,height:n,progress:t.uProgress,name:`route-graphics-shader-filter-${u.id}`}));TV(t,{signature:a,filters:c}),wo(t,"shader",c)},Ze=(t,{force:e=!1}={})=>!t?.filters?.length&&!e?{}:{uProgress:0};var yb=t=>({...So(t)?oB(t):eb(t),alpha:t.alpha}),_b=(t,e)=>{if(So(t))return nB(t,e);let r=new br({label:t.id});return r.zIndex=e,r.text=t.content,vi(r,t.textStyle),qf(r,t),r.alpha=t.alpha,Kf(r,t),Ie(r,t.filters,{width:t.width,height:t.height}),r},rp=(t,e,r)=>{if(So(e)){mu(t,e,r);return}YI(t,e.textStyle,r)},vB=({app:t,parent:e,element:r,animations:i,eventHandler:s,animationBus:o,completionTracker:n,renderContext:a,zIndex:l})=>{let c=_b(r,l),u=Xe(i,r.id);Ie(c,r.filters,{width:r.width,height:r.height,force:u}),pu({app:t,displayObject:c,textComputedNode:r,eventHandler:s,applyStyle:h=>rp(c,r,h)}),e.addChild(c),re({animations:i,targetId:r.id,animationBus:o,completionTracker:n,element:c,targetState:{...yb(r),...Ze(r,{force:u})},renderContext:a})};var PV=(t,e)=>sB(t)!==So(e),CV=({app:t,parent:e,displayObject:r,textComputedNode:i,eventHandler:s,zIndex:o})=>{ga(r);let n=_b(i,o);return pu({app:t,displayObject:n,textComputedNode:i,eventHandler:s,applyStyle:a=>rp(n,i,a)}),e.addChild(n),r.destroy({children:!0}),n},RV=(t,e)=>{t.text=e.content,vi(t,e.textStyle),qf(t,e),Kf(t,e),t.alpha=e.alpha},MV=({displayObject:t,textComputedNode:e,app:r,eventHandler:i})=>{So(e)?mu(t,e):RV(t,e),ga(t),pu({app:r,displayObject:t,textComputedNode:e,eventHandler:i,applyStyle:s=>rp(t,e,s)})},TB=({app:t,parent:e,prevElement:r,nextElement:i,eventHandler:s,animations:o,animationBus:n,completionTracker:a,zIndex:l})=>{let c=e.children.find(f=>f.label===r.id);if(!c)return;c.zIndex=l;let u=Xe(o,r.id);u?Ie(c,r.filters,{width:r.width,height:r.height,force:!0}):Gr(c);let h=()=>{if(!ge(r,i)){if(PV(c,i)){c=CV({app:t,parent:e,displayObject:c,textComputedNode:i,eventHandler:s,zIndex:l}),Ie(c,i.filters,{width:i.width,height:i.height,force:u});return}MV({displayObject:c,textComputedNode:i,app:t,eventHandler:s}),Ie(c,i.filters,{width:i.width,height:i.height,force:u})}};re({animations:o,targetId:r.id,animationBus:n,completionTracker:a,element:c,targetState:{...yb(i),...Ze(i,{force:u})},onComplete:()=>{h()}})||h()};var SB=({parent:t,element:e,animations:r,animationBus:i,completionTracker:s})=>{let o=t.getChildByLabel(e.id);if(!o)return;re({animations:r,targetId:e.id,animationBus:i,completionTracker:s,element:o,targetState:null,onComplete:()=>{o&&!o.destroyed&&(ga(o),o.destroy({children:!0}))}})||(ga(o),o.destroy({children:!0}))};var wB=({positionX:t=0,positionY:e=0,width:r,height:i,anchorX:s=0,anchorY:o=0})=>{if(typeof r!="number"||typeof i!="number")throw new Error("Input Error: Width or height is missing");let n={x:r*s,y:i*o},a=t-n.x,l=e-n.y;return{x:a,y:l,originX:n.x,originY:n.y}};var IV=new Set([vr.RECT,vr.TEXT,vr.CONTAINER,vr.SPRITE,vr.SPRITESHEET_ANIMATION,vr.VIDEO]),vt=t=>{if(typeof t.width!="number"||typeof t.height!="number")throw new Error("Input Error: Width or height is missing");if(!Object.values(vr).includes(t.type))throw new Error("Input Error: Type must be one of "+Object.values(vr).join(", "));if(!t.id)throw new Error("Input Error: Id is missing");let e=t.scaleX?t.scaleX*t.width:t.width,r=t.scaleY?t.scaleY*t.height:t.height;t.type===vr.CONTAINER&&(e=t.width,r=t.height);let{x:i,y:s,originX:o,originY:n}=wB({positionX:t.x,positionY:t.y,width:e,height:r,anchorX:t.anchorX,anchorY:t.anchorY}),a=typeof t.originX=="number"?t.originX:o,l=typeof t.originY=="number"?t.originY:n,c={id:t.id,type:t.type,width:Math.round(e),height:Math.round(r),x:Math.round(i),y:Math.round(s),originX:Math.round(a),originY:Math.round(l),alpha:t.alpha??1};if(t.hover&&(c.hover=t.hover),t.click&&(c.click=t.click),t.filters!==void 0){if(!IV.has(t.type))throw new Error(`Input Error: filters are not supported on ${t.type} elements`);c.filters=mB(t.filters)}return c};var BV=t=>typeof t!="number"||!Number.isFinite(t)?0:Math.max(0,Math.floor(t)),FV="top",kV=2,AB=["top","bottom"],UV=new Set(AB),OV=16,LV=0,PB=["image","spritesheet"],GV=new Set(PB),DV=(t,e)=>{if(t===void 0)return FV;if(UV.has(t))return t;throw new Error(`Input Error: ${e}.placement must be one of ${AB.join(", ")}.`)},NV=(t,e)=>{if(t===void 0)return 0;if(typeof t=="number"&&Number.isFinite(t)&&t>=0)return t;throw new Error(`Input Error: ${e}.gap must be a finite number >= 0.`)},VV=(t={})=>t.kind??(t.atlas!==void 0||t.clips!==void 0||t.playback!==void 0?"spritesheet":"image"),EB=(t={},e)=>{let r=VV(t);if(!GV.has(r))throw new Error(`Input Error: ${e}.kind must be one of ${PB.join(", ")}.`);let i={kind:r,src:t.src??"",width:t.width??12,height:t.height??12};if(r==="image")return i;let s=t.atlas,o=Kr(s),n=Zr(t.clips,s?.animations,s?.meta,Object.keys(o.frames??{})),a=Or({atlas:o,clips:n,playback:t.playback});return{...i,atlas:o,clips:n,playback:a}},HV=({placement:t,gap:e,x:r,y:i,partWidth:s,partHeight:o,furiganaWidth:n,furiganaHeight:a})=>{let l=Math.round(r+(s-n)/2);return t==="bottom"?{x:l,y:i+o+e}:{x:l,y:i-a+kV-e}},WV=t=>t===`
|
|
1294
|
+
`,fb=t=>Number.isFinite(t)?t:0,fV=(t,e)=>t?t instanceof Map?t.get(e)??[]:t.filter(r=>r?.targetId===e):[],Xe=(t,e)=>fV(t,e).some(r=>r?.type==="update"&&r.tween?.uProgress!==void 0),pV=t=>t.type==="f32"?t.value:new Float32Array(t.value),mV=(t,e,r,i,{includeNextTextureTransform:s=!1}={})=>{let o={uProgress:{value:fb(i),type:"f32"},uResolution:{value:new Float32Array([Math.max(1,e),Math.max(1,r)]),type:"vec2<f32>"}};s&&(o.uNextTextureMatrix={value:new V,type:"mat3x3<f32>"},o.uNextTextureClamp={value:new Float32Array([0,0,1,1]),type:"vec4<f32>"});for(let n of t.uniforms??[])o[n.symbol]={value:pV(n),type:n.type};return new we(o)},gV=t=>t?.textureWrap==="repeat"?"repeat":"clamp-to-edge",xV=t=>t?.mipmap===!0?"linear":"nearest",yV=(t,e)=>!t||!t.resource||t.uploadMethodId==="video"?t:Ee.from({...t.options??{},resource:t.resource,width:t.width,height:t.height,resolution:t.resolution,format:t.format,dimensions:t.dimension,mipLevelCount:t.mipLevelCount,autoGenerateMipmaps:e?.mipmap===!0,sampleCount:t.sampleCount,antialias:t.antialias,alphaMode:t.alphaMode,addressMode:gV(e),mipmapFilter:xV(e)}),_V=t=>{let e={},r=[];for(let i of t.textures??[]){let s=F.from(i.src).source,o=yV(s,t.pipeline);e[i.symbol]=o,o!==s&&r.push(o)}return{resources:e,ownedTextureSources:r}},bV=(t=[1,1])=>{let e=Math.max(1,t[0]??1),r=Math.max(1,t[1]??1);if(e===1&&r===1)return null;let i=[],s=[];for(let n=0;n<=r;n++)for(let a=0;a<=e;a++)i.push(a/e,n/r);let o=e+1;for(let n=0;n<r;n++)for(let a=0;a<e;a++){let l=n*o+a,c=l+1,u=l+o,h=u+1;s.push(l,c,u,c,h,u)}return new Jt({attributes:{aPosition:{buffer:new Float32Array(i),format:"float32x2",stride:2*4,offset:0}},indexBuffer:new Uint32Array(s)})},vV=({filterManager:t,filter:e,geometry:r,input:i,output:s,clear:o})=>{let n=t.renderer,a=t._filterStack[t._filterStackIndex],l=a.bounds,c=ye.shared,h=a.previousRenderSurface===s,d=n.renderTarget.rootRenderTarget.colorTexture.source._resolution,f=t._filterStackIndex-1;for(;f>0&&t._filterStack[f].skip;)f--;f>0&&(d=t._filterStack[f].inputTexture.source._resolution);let g=t._filterGlobalUniforms,m=g.uniforms,x=m.uOutputFrame,v=m.uInputSize,_=m.uInputPixel,p=m.uInputClamp,b=m.uGlobalFrame,y=m.uOutputTexture;if(h){let P=t._filterStackIndex;for(;P>0;){P--;let C=t._filterStack[P];if(!C.skip){c.x=C.bounds.minX,c.y=C.bounds.minY;break}}x[0]=l.minX-c.x,x[1]=l.minY-c.y}else x[0]=0,x[1]=0;x[2]=i.frame.width,x[3]=i.frame.height,v[0]=i.source.width,v[1]=i.source.height,v[2]=1/v[0],v[3]=1/v[1],_[0]=i.source.pixelWidth,_[1]=i.source.pixelHeight,_[2]=1/_[0],_[3]=1/_[1],p[0]=.5*_[2],p[1]=.5*_[3],p[2]=i.frame.width*v[2]-.5*_[2],p[3]=i.frame.height*v[3]-.5*_[3];let S=n.renderTarget.rootRenderTarget.colorTexture;b[0]=c.x*d,b[1]=c.y*d,b[2]=S.source.width*d,b[3]=S.source.height*d;let E=n.renderTarget.getRenderTarget(s);if(n.renderTarget.bind(s,!!o),s instanceof F?(y[0]=s.frame.width,y[1]=s.frame.height):(y[0]=E.width,y[1]=E.height),y[2]=E.isRoot?-1:1,g.update(),n.renderPipes.uniformBatch){let P=n.renderPipes.uniformBatch.getUboResource(g);t._globalFilterBindGroup.setResource(P,0)}else t._globalFilterBindGroup.setResource(g,0);t._globalFilterBindGroup.setResource(i.source,1),t._globalFilterBindGroup.setResource(i.source.style,2),e.groups[0]=t._globalFilterBindGroup,n.encoder.draw({geometry:r,shader:e,state:e._state,topology:"triangle-list"}),n.type===Ne.WEBGL&&n.renderTarget.finishRenderPass()},tp=(t,e)=>{let r=t?.resources?.shaderUniforms;r?.uniforms&&(r.uniforms.uProgress=fb(e),r.update())},pb=(t,e,r)=>{let i=t?.resources?.shaderUniforms;i?.uniforms&&(i.uniforms.uResolution=new Float32Array([Math.max(1,e),Math.max(1,r)]),i.update())},mb=({shader:t,width:e,height:r,progress:i=0,nextTextureSource:s,name:o="route-graphics-shader-filter"})=>{let n=mV(t,e,r,i,{includeNextTextureTransform:!!s}),a=_V(t),l={shaderUniforms:n,...s?{uNextTexture:s}:{},...a.resources},c=Ir.from({gpu:{vertex:{source:t.source.webgpu.source,entryPoint:"mainVertex"},fragment:{source:t.source.webgpu.source,entryPoint:"mainFragment"}},gl:{vertex:t.source.webgl.vertex??dV,fragment:t.source.webgl.fragment,name:o},resources:l,blendMode:t.pipeline?.blend??"normal"}),u=bV(t.mesh?.grid);if(u&&(c.apply=(h,d,f,g)=>{vV({filterManager:h,filter:c,geometry:u,input:d,output:f,clear:g})}),u||a.ownedTextureSources.length>0){let h=c.destroy.bind(c);c.destroy=(...d)=>{h(...d),u?.destroy();for(let f of a.ownedTextureSources)f.destroy()}}return c},gb=t=>t?.[db]??null,TV=(t,e)=>{Object.defineProperty(t,db,{value:e,enumerable:!1,configurable:!0,writable:!0})},SV=t=>{if(!t||typeof t.destroy!="function"||t[yB])return;let e=t.destroy;Object.defineProperty(t,yB,{value:!0,enumerable:!1,configurable:!0}),t.destroy=function(...i){return hb(this),e.apply(this,i)}},wV=(t,e)=>{let r=gb(t);for(let i of r?.filters??[])tp(i,e)},EV=t=>{if(!t)return;t[Eo]===void 0&&Object.defineProperty(t,Eo,{value:0,enumerable:!1,configurable:!0,writable:!0});let e=Object.getOwnPropertyDescriptor(t,"uProgress");e?.get||e?.set||Object.defineProperty(t,"uProgress",{get(){return this[Eo]??0},set(r){this[Eo]=fb(r),wV(this,this[Eo])},enumerable:!1,configurable:!0})},Gr=t=>{!t||t[Eo]===void 0||(t.uProgress=0)},AV=t=>t?.filters?.some(e=>e?.type==="shader")??!1,_B=(t,e)=>{if(!t||!e)return null;if(t.label===e)return t;for(let r of t.children??[]){let i=_B(r,e);if(i)return i}return null},bB=({parent:t,element:e,animations:r})=>{if(!e)return!1;if(AV(e)&&!Xe(r,e.id)){let i=_B(t,e.id);if(i?.[Eo]!==void 0&&i.uProgress!==0)return!0}return xb({parent:t,elements:e.children,animations:r})},xb=({parent:t,elements:e=[],animations:r})=>(e??[]).some(i=>bB({parent:t,element:i,animations:r})),Dr=({parent:t,nextElement:e,animations:r})=>bB({parent:t,element:e,animations:r}),hb=t=>{gb(t)&&(wo(t,"shader",null),delete t[db])},Ie=(t,e,{width:r,height:i,force:s=!1}={})=>{if(!t)return;if(!e?.length&&!s){hb(t);return}if(EV(t),SV(t),!e?.length){hb(t);return}let o=Math.max(1,Math.round(r??t.width??1)),n=Math.max(1,Math.round(i??t.height??1)),a=xB(e),l=gb(t);if(l?.signature===a){for(let u of l.filters)pb(u,o,n),tp(u,t.uProgress);wo(t,"shader",l.filters);return}let c=e.map(u=>mb({shader:u,width:o,height:n,progress:t.uProgress,name:`route-graphics-shader-filter-${u.id}`}));TV(t,{signature:a,filters:c}),wo(t,"shader",c)},Ze=(t,{force:e=!1}={})=>!t?.filters?.length&&!e?{}:{uProgress:0};var yb=t=>({...So(t)?oB(t):eb(t),alpha:t.alpha}),_b=(t,e)=>{if(So(t))return nB(t,e);let r=new br({label:t.id});return r.zIndex=e,r.text=t.content,vi(r,t.textStyle),qf(r,t),r.alpha=t.alpha,Kf(r,t),Ie(r,t.filters,{width:t.width,height:t.height}),r},rp=(t,e,r)=>{if(So(e)){mu(t,e,r);return}YI(t,e.textStyle,r)},vB=({app:t,parent:e,element:r,animations:i,eventHandler:s,animationBus:o,completionTracker:n,renderContext:a,zIndex:l})=>{let c=_b(r,l),u=Xe(i,r.id);Ie(c,r.filters,{width:r.width,height:r.height,force:u}),pu({app:t,displayObject:c,textComputedNode:r,eventHandler:s,applyStyle:h=>rp(c,r,h)}),e.addChild(c),re({animations:i,targetId:r.id,animationBus:o,completionTracker:n,element:c,targetState:{...yb(r),...Ze(r,{force:u})},renderContext:a})};var PV=(t,e)=>sB(t)!==So(e),CV=({app:t,parent:e,displayObject:r,textComputedNode:i,eventHandler:s,zIndex:o})=>{ga(r);let n=_b(i,o);return pu({app:t,displayObject:n,textComputedNode:i,eventHandler:s,applyStyle:a=>rp(n,i,a)}),e.addChild(n),r.destroy({children:!0}),n},RV=(t,e)=>{t.text=e.content,vi(t,e.textStyle),qf(t,e),Kf(t,e),t.alpha=e.alpha},MV=({displayObject:t,textComputedNode:e,app:r,eventHandler:i})=>{So(e)?mu(t,e):RV(t,e),ga(t),pu({app:r,displayObject:t,textComputedNode:e,eventHandler:i,applyStyle:s=>rp(t,e,s)})},TB=({app:t,parent:e,prevElement:r,nextElement:i,eventHandler:s,animations:o,animationBus:n,completionTracker:a,zIndex:l})=>{let c=e.children.find(f=>f.label===r.id);if(!c)return;c.zIndex=l;let u=Xe(o,r.id);u?Ie(c,r.filters,{width:r.width,height:r.height,force:!0}):Gr(c);let h=()=>{if(!ge(r,i)){if(PV(c,i)){c=CV({app:t,parent:e,displayObject:c,textComputedNode:i,eventHandler:s,zIndex:l}),Ie(c,i.filters,{width:i.width,height:i.height,force:u});return}MV({displayObject:c,textComputedNode:i,app:t,eventHandler:s}),Ie(c,i.filters,{width:i.width,height:i.height,force:u})}};re({animations:o,targetId:r.id,animationBus:n,completionTracker:a,element:c,targetState:{...yb(i),...Ze(i,{force:u})},onComplete:()=>{h()}})||h()};var SB=({parent:t,element:e,animations:r,animationBus:i,completionTracker:s})=>{let o=t.getChildByLabel(e.id);if(!o)return;re({animations:r,targetId:e.id,animationBus:i,completionTracker:s,element:o,targetState:null,onComplete:()=>{o&&!o.destroyed&&(ga(o),o.destroy({children:!0}))}})||(ga(o),o.destroy({children:!0}))};var wB=({positionX:t=0,positionY:e=0,width:r,height:i,anchorX:s=0,anchorY:o=0})=>{if(typeof r!="number"||typeof i!="number")throw new Error("Input Error: Width or height is missing");let n={x:r*s,y:i*o},a=t-n.x,l=e-n.y;return{x:a,y:l,originX:n.x,originY:n.y}};var IV=new Set([vr.RECT,vr.TEXT,vr.CONTAINER,vr.SPRITE,vr.SPRITESHEET_ANIMATION,vr.VIDEO]),vt=t=>{if(typeof t.width!="number"||typeof t.height!="number")throw new Error("Input Error: Width or height is missing");if(!Object.values(vr).includes(t.type))throw new Error("Input Error: Type must be one of "+Object.values(vr).join(", "));if(!t.id)throw new Error("Input Error: Id is missing");let e=t.scaleX?t.scaleX*t.width:t.width,r=t.scaleY?t.scaleY*t.height:t.height;t.type===vr.CONTAINER&&(e=t.width,r=t.height);let{x:i,y:s,originX:o,originY:n}=wB({positionX:t.x,positionY:t.y,width:e,height:r,anchorX:t.anchorX,anchorY:t.anchorY}),a=typeof t.originX=="number"?t.originX:o,l=typeof t.originY=="number"?t.originY:n,c={id:t.id,type:t.type,width:Math.round(e),height:Math.round(r),x:Math.round(i),y:Math.round(s),originX:Math.round(a),originY:Math.round(l),alpha:t.alpha??1};if(t.hover&&(c.hover=t.hover),t.click&&(c.click=t.click),t.filters!==void 0){if(!IV.has(t.type))throw new Error(`Input Error: filters are not supported on ${t.type} elements`);c.filters=mB(t.filters)}return c};var BV=t=>typeof t!="number"||!Number.isFinite(t)?0:Math.max(0,Math.floor(t)),FV="top",kV=2,AB=["top","bottom"],UV=new Set(AB),OV=16,LV=0,PB=["image","spritesheet"],GV=new Set(PB),DV=(t,e)=>{if(t===void 0)return FV;if(UV.has(t))return t;throw new Error(`Input Error: ${e}.placement must be one of ${AB.join(", ")}.`)},NV=(t,e)=>{if(t===void 0)return 0;if(typeof t=="number"&&Number.isFinite(t)&&t>=0)return t;throw new Error(`Input Error: ${e}.gap must be a finite number >= 0.`)},VV=(t={})=>t.kind??(t.atlas!==void 0||t.clips!==void 0||t.playback!==void 0?"spritesheet":"image"),EB=(t={},e)=>{let r=VV(t);if(!GV.has(r))throw new Error(`Input Error: ${e}.kind must be one of ${PB.join(", ")}.`);let i={kind:r,src:t.src??"",width:t.width??12,height:t.height??12};if(t.offsetX!==void 0&&(i.offsetX=t.offsetX),t.offsetY!==void 0&&(i.offsetY=t.offsetY),r==="image")return i;let s=t.atlas,o=Kr(s),n=Zr(t.clips,s?.animations,s?.meta,Object.keys(o.frames??{})),a=Or({atlas:o,clips:n,playback:t.playback});return{...i,atlas:o,clips:n,playback:a}},HV=({placement:t,gap:e,x:r,y:i,partWidth:s,partHeight:o,furiganaWidth:n,furiganaHeight:a})=>{let l=Math.round(r+(s-n)/2);return t==="bottom"?{x:l,y:i+o+e}:{x:l,y:i-a+kV-e}},WV=t=>t===`
|
|
1295
1295
|
`||t==="\r",zV=t=>typeof t=="string"&&Ve.isBreakingSpace(t),$V=(t,e,r)=>{let i=0,s=0;for(;i<t.length&&s<e.length&&t[i]===e[s];)i+=1,s+=1;if(s<e.length){let a=Math.min(t.length,e.length);return{remainingText:t.slice(a),consumedExplicitNewline:!1}}let o=i,n=o;for(;n<t.length&&zV(t[n]);)n+=1;if(WV(t[n])){let a=n+1;return t[n]==="\r"&&t[n+1]===`
|
|
1296
1296
|
`&&(a+=1),{remainingText:t.slice(a),consumedExplicitNewline:!0}}return r?{remainingText:t.slice(n),consumedExplicitNewline:!1}:{remainingText:t.slice(o),consumedExplicitNewline:!1}},bb=(t,e,{minimumWidth:r=e}={})=>{let i=[],s=[],o=0,n=0,a=0,l=0,c=0,u=[...t],h=new WeakSet,d=Math.max(10,t.reduce((m,x)=>m+(x?.text?.length??0),0)*4),f=()=>{i.push({lineParts:[...s],y:n,lineMaxHeight:a}),o=0,n+=a,a=0,s=[]};for(;u.length>0;){if(c+=1,c>d)throw new Error("[parseTextRevealing] Failed to make progress while wrapping text.");let m=u[0];if(!m.text||m.text.length===0){u.shift();continue}let x=m.text,v=Math.max(1,Math.round(e-o)),_=m.textStyle.wordWrap?{...m.textStyle,wordWrapWidth:v}:m.textStyle,p=Ve.measureText(m.text,new Be(Ft(_,{includeShadow:!1})));if(p.lineWidths[0]>v&&s.length>0){f();continue}let b=p.lines[0]??"",y=p.lines.length>1,S="",E=!1;if(p.lines.length===1&&m.text.endsWith(" ")&&!b.endsWith(" ")&&(b+=" "),b.length>0){let R=$V(x,b,y);S=R.remainingText,E=R.consumedExplicitNewline}if(b.length===0&&x.length>0){let R=x.match(/^\s+/)?.[0]??"";b=R.length>0?R:x[0],S=x.slice(b.length)}if(S===x){let R=x.match(/^\s+/)?.[0]??x[0]??"";if(R.length===0)throw new Error("[parseTextRevealing] Failed to consume text while wrapping.");b=R,S=x.slice(R.length)}let P=Ve.measureText(b,new Be({...Ft(m.textStyle,{includeShadow:!1}),wordWrap:!1,breakWords:!1})),C=Math.max(0,Math.round(P.width??p.lineWidths[0]??0)),M={text:b,textStyle:_,height:P.height,x:o,y:n};if(m.furigana&&!h.has(m)){h.add(m);let R=Ve.measureText(m.furigana.text,new Be(Ft(m.furigana.textStyle,{includeShadow:!1}))),B=HV({placement:m.furigana.placement,gap:m.furigana.gap,x:o,y:n,partWidth:C,partHeight:P.height,furiganaWidth:R.width,furiganaHeight:R.height}),A={text:m.furigana.text,textStyle:m.furigana.textStyle,x:B.x,y:B.y};M.furigana=A}s.push(M),a=Math.max(a,P.height),o+=C,l=Math.max(l,o),S&&S.length>0?m.text=S:u.shift(),(y||E)&&o>0&&f()}s.length>0&&i.push({lineParts:s,y:n,lineMaxHeight:a});for(let m=0;m<i.length;m++){let x=i[m].lineMaxHeight;i[m].lineParts=i[m].lineParts.map(v=>{let _=v.height;v.height&&delete v.height;let p=v.y+(x-_),b=v.furigana;return b&&(b.y=b.y-v.y+p),{...v,...b&&{furigana:b},y:p}})}let g=i.length>0?i[i.length-1].y+i[i.length-1].lineMaxHeight:0;return{chunks:i,width:Math.max(l,r),height:g}},vb=({content:t,defaultTextStyle:e,width:r})=>(t||[]).map((i,s)=>{let o=Ti(e,i.textStyle);o.lineHeight=Math.round(o.lineHeight*o.fontSize),typeof r=="number"&&(o.wordWrapWidth=r,o.wordWrap=!0);let n=null;if(i.furigana){let l=Ti(e,i.furigana.textStyle);l.lineHeight=Math.round(l.lineHeight*l.fontSize),typeof r=="number"&&(l.wordWrapWidth=r,l.wordWrap=!0),n={text:String(i.furigana.text),textStyle:l,placement:DV(i.furigana.placement,`content[${s}].furigana`),gap:NV(i.furigana.gap,`content[${s}].furigana`)}}return{text:String(i.text).replace(/ +$/,l=>"\xA0".repeat(l.length)),textStyle:o,...n&&{furigana:n}}}),CB=({state:t})=>{let e=Ti({...Ge,wordWrap:!0},t.textStyle),r=vb({content:t.content,defaultTextStyle:e,width:t.width||void 0}),i=t.width||500,{chunks:s,width:o,height:n}=bb(r,i),a=t.width||o,c=vt({...t,width:a,height:n});if(c.alpha=t.alpha??1,t.indicator){let u=t.indicator;if(u.offset!==void 0)throw new Error("Input Error: indicator.offset is no longer supported. Use offsetX and offsetY.");c.indicator={revealing:EB(u.revealing,"indicator.revealing"),complete:EB(u.complete,"indicator.complete"),offsetX:u.offsetX??OV,offsetY:u.offsetY??LV}}return{...c,content:s,textStyle:{...e},speed:t.speed??50,revealEffect:t.revealEffect??"typewriter",...t.softWipe!==void 0&&{softWipe:yo(t.softWipe)},...t.initialRevealedCharacters!==void 0&&{initialRevealedCharacters:BV(t.initialRevealedCharacters)},...t.width!==void 0&&{width:t.width},...t.complete&&{complete:t.complete}}};var XV=1e5,YV=(t,e)=>typeof t.width=="number"?t.width:e.wordWrap&&typeof e.wordWrapWidth=="number"&&Number.isFinite(e.wordWrapWidth)&&e.wordWrapWidth>0?e.wordWrapWidth:XV,RB=({state:t})=>{let e=Array.isArray(t.content),r=Ti(Ge,t.textStyle),i={...r};if(i.lineHeight=Math.round(i.fontSize*i.lineHeight),typeof t.width=="number"&&(i.wordWrapWidth=t.width,i.wordWrap=!0),e){let d=YV(t,r),f=vb({content:t.content,defaultTextStyle:r,width:typeof t.width=="number"?t.width:void 0}),{chunks:g,width:m,height:x}=bb(f,d,{minimumWidth:0}),v=Math.round(m),_=Math.round(x),p=typeof t.width=="number"?Math.round(t.width):v,y={...vt({...t,width:p,height:_}),content:g,measuredWidth:v,textStyle:{...i},...t.hover&&{hover:t.hover},...t.click&&{click:t.click},...t.rightClick&&{rightClick:t.rightClick},...t.scrollUp&&{scrollUp:t.scrollUp},...t.scrollDown&&{scrollDown:t.scrollDown}};return Object.defineProperties(y,{__anchorXRatio:{value:t.anchorX??0,enumerable:!1},__anchorYRatio:{value:t.anchorY??0,enumerable:!1},__fixedWidth:{value:typeof t.width=="number",enumerable:!1}}),y}let s=String(t.content??""),{width:o,height:n}=Ve.measureText(s,new Be(Ft(i,{includeShadow:!1}))),a=Math.round(o),l=Math.round(n),c=typeof t.width=="number"?Math.round(t.width):a,h={...vt({...t,width:c,height:l}),content:s,measuredWidth:a,textStyle:{...i},...t.hover&&{hover:t.hover},...t.click&&{click:t.click},...t.rightClick&&{rightClick:t.rightClick},...t.scrollUp&&{scrollUp:t.scrollUp},...t.scrollDown&&{scrollDown:t.scrollDown}};return Object.defineProperties(h,{__anchorXRatio:{value:t.anchorX??0,enumerable:!1},__anchorYRatio:{value:t.anchorY??0,enumerable:!1},__fixedWidth:{value:typeof t.width=="number",enumerable:!1}}),h};var jV=at({type:"text",add:vB,update:TB,delete:SB,parse:RB,shouldUpdateUnchanged:Dr});var MB={color:0,alpha:0},qV={x:0,y:0},KV={x:0,y:1},ZV={x:.5,y:.5},IB=t=>t==null||t===""||t==="transparent",BB=t=>[...t].sort((e,r)=>e.offset-r.offset),QV=(t,e)=>{if(!t||!e)return t;let r=e.originX??0,i=e.originY??0,s=Nf(e),o=xo(e.rotation??0),n=Math.cos(o),a=Math.sin(o),l=t.x-s.x,c=t.y-s.y;return{x:r+l*n+c*a,y:i-l*a+c*n}},ip=(t,e,r,i)=>e.coordinateSpace==="global"?QV(t??i,r):t,Ps=t=>{t._rtglFillResource?.destroy(),delete t._rtglFillResource},JV=(t,e)=>IB(t)?MB:typeof t=="string"?t:t.type==="solid"?IB(t.color)?MB:t.color:t.type==="linear-gradient"?new bt({type:"linear",start:ip(t.start,t,e,qV),end:ip(t.end,t,e,KV),colorStops:BB(t.stops),textureSpace:t.coordinateSpace,textureSize:t.textureSize,wrapMode:t.wrapMode}):t.type==="radial-gradient"?new bt({type:"radial",center:ip(t.innerCenter,t,e,ZV),innerRadius:t.innerRadius,outerCenter:ip(t.outerCenter,t,e),outerRadius:t.outerRadius,colorStops:BB(t.stops),textureSpace:t.coordinateSpace,textureSize:t.textureSize,wrapMode:t.wrapMode,scale:t.scale,rotation:t.rotation}):t,xa=(t,e,r)=>{Ps(t);let i=JV(e,r);return i instanceof bt&&(t._rtglFillResource=i),i};var FB=({app:t,parent:e,element:r,animations:i,animationBus:s,eventHandler:o,zIndex:n,completionTracker:a,renderContext:l})=>{let{id:c,width:u,height:h,fill:d,border:f,alpha:g,scaleX:m,scaleY:x}=r,v=Xe(i,c),_=new ze;_.label=c,_.zIndex=n,_.on("destroyed",()=>{Ps(_)});let p=Ur(r,{alpha:g});m!==void 0&&(p.scaleX=m),x!==void 0&&(p.scaleY=x),(()=>{_.clear(),_.rect(0,0,Math.round(u),Math.round(h)).fill(xa(_,d,r)),_.alpha=g,_.scale.x=1,_.scale.y=1,kr(_,r),f&&_.stroke({color:f.color,alpha:f.alpha,width:Math.round(f.width)}),Ie(_,r.filters,{width:u,height:h,force:v})})();let y=r?.hover,S=r?.click,E=r?.rightClick,P=r?.scrollUp,C=r?.scrollDown,M=r?.drag;if(y){let{cursor:R,soundSrc:B,payload:A}=y;_.eventMode="static";let O=()=>{A&&o&&o("hover",{_event:{id:_.label},...A}),R&&(_.cursor=R),B&&t.audioStage.add({id:`hover-${Date.now()}`,url:B,loop:!1})},U=()=>{_.cursor="auto"};_.on("pointerover",O),_.on("pointerout",U)}if(S){let{soundSrc:R,soundVolume:B,payload:A}=S;_.eventMode="static";let O=U=>{kt(U)&&(A&&o&&o("click",{_event:{id:_.label},...A}),R&&t.audioStage.add({id:`click-${Date.now()}`,url:R,loop:!1,volume:$e(B)}))};_.on("pointerup",O)}if(E){let{soundSrc:R,payload:B}=E;_.eventMode="static";let A=()=>{B&&o&&o("rightClick",{_event:{id:_.label},...B}),R&&t.audioStage.add({id:`rightClick-${Date.now()}`,url:R,loop:!1})};_.on("rightclick",A)}if((P||C)&&Lr({canvas:t.canvas,displayObject:_,width:u,height:h,scrollUpEvent:P,scrollDownEvent:C,eventHandler:o}),M){let{start:R,end:B,move:A}=M;_.eventMode="static";let O=()=>{_._isDragging=!0,R&&o&&o("dragStart",{_event:{id:_.label},...typeof R?.payload=="object"?R.payload:{}})},U=()=>{_._isDragging=!1,B&&o&&o("dragEnd",{_event:{id:_.label},...typeof B?.payload=="object"?B.payload:{}})},k=G=>{A&&o&&_._isDragging&&o("dragMove",{_event:{id:_.label,x:G.global.x,y:G.global.y},...typeof A?.payload=="object"?A.payload:{}})};_.on("pointerdown",O),_.on("pointerup",U),_.on("globalpointermove",k),_.on("pointerupoutside",U)}e.addChild(_),re({animations:i,targetId:c,animationBus:s,completionTracker:a,element:_,targetState:{...p,...Ze(r,{force:v})},renderContext:l})};var kB=({app:t,parent:e,prevElement:r,nextElement:i,animations:s,animationBus:o,eventHandler:n,zIndex:a,completionTracker:l})=>{let c=e.children.find(y=>y.label===r.id);if(!c)return;c.zIndex=a;let{width:u,height:h,fill:d,border:f,alpha:g,scaleX:m,scaleY:x}=i,v=Xe(s,r.id);v?Ie(c,r.filters,{width:r.width,height:r.height,force:!0}):Gr(c);let _=Ur(i,{alpha:g});m!==void 0&&(_.scaleX=m),x!==void 0&&(_.scaleY=x);let p=()=>{if(!ge(r,i)){c._cleanupScrollInteraction?.(),c.clear(),c.rect(0,0,Math.round(u),Math.round(h)).fill(xa(c,d,i)),c.alpha=g,c.scale.x=1,c.scale.y=1,kr(c,i),f&&c.stroke({color:f.color,alpha:f.alpha,width:Math.round(f.width)}),Ie(c,i.filters,{width:u,height:h,force:v}),c.removeAllListeners("pointerover"),c.removeAllListeners("pointerout"),c.removeAllListeners("pointerup"),c.removeAllListeners("rightclick"),c.removeAllListeners("wheel"),c.removeAllListeners("pointerdown"),c.removeAllListeners("globalpointermove"),c.removeAllListeners("pointerupoutside");let y=i?.hover,S=i?.click,E=i?.rightClick,P=i?.scrollUp,C=i?.scrollDown,M=i?.drag;if(y){let{cursor:R,soundSrc:B,payload:A}=y;c.eventMode="static";let O=()=>{A&&n&&n("hover",{_event:{id:c.label},...A}),R&&(c.cursor=R),B&&t.audioStage.add({id:`hover-${Date.now()}`,url:B,loop:!1})},U=()=>{c.cursor="auto"};c.on("pointerover",O),c.on("pointerout",U)}if(S){let{soundSrc:R,soundVolume:B,payload:A}=S;c.eventMode="static";let O=U=>{kt(U)&&(A&&n&&n("click",{_event:{id:c.label},...A}),R&&t.audioStage.add({id:`click-${Date.now()}`,url:R,loop:!1,volume:$e(B)}))};c.on("pointerup",O)}if(E){let{soundSrc:R,payload:B}=E;c.eventMode="static";let A=()=>{B&&n&&n("rightClick",{_event:{id:c.label},...B}),R&&t.audioStage.add({id:`rightClick-${Date.now()}`,url:R,loop:!1})};c.on("rightclick",A)}if((P||C)&&Lr({canvas:t.canvas,displayObject:c,width:u,height:h,scrollUpEvent:P,scrollDownEvent:C,eventHandler:n}),M){let{start:R,end:B,move:A}=M;c.eventMode="static";let O=()=>{c._isDragging=!0,R&&n&&n("dragStart",{_event:{id:c.label},...typeof R?.payload=="object"?R.payload:{}})},U=()=>{c._isDragging=!1,B&&n&&n("dragEnd",{_event:{id:c.label},...typeof B?.payload=="object"?B.payload:{}})},k=G=>{A&&n&&c._isDragging&&n("dragMove",{_event:{id:c.label,x:G.global.x,y:G.global.y},...typeof A?.payload=="object"?A.payload:{}})};c.on("pointerdown",O),c.on("pointerup",U),c.on("globalpointermove",k),c.on("pointerupoutside",U)}}};re({animations:s,targetId:r.id,animationBus:o,completionTracker:l,element:c,targetState:{..._,...Ze(i,{force:v})},onComplete:()=>{p()}})||p()};var UB=({parent:t,element:e,animations:r,animationBus:i,completionTracker:s})=>{let o=t.getChildByLabel(e.id);if(!o)return;re({animations:r,targetId:e.id,animationBus:i,completionTracker:s,element:o,targetState:null,onComplete:()=>{o&&!o.destroyed&&(o._cleanupScrollInteraction?.(),Ps(o),o.destroy())}})||(o._cleanupScrollInteraction?.(),Ps(o),o.destroy())};var OB=({state:t})=>{let e=vt(t),r=t.border?.width,i=e;return typeof r=="number"&&r>0&&(i={...e,border:{alpha:t.border?.alpha??1,color:t.border?.color??"black",width:r}}),{...i,...t.fill!==void 0?{fill:t.fill}:{},...t.scaleX!==void 0?{scaleX:t.scaleX}:{},...t.scaleY!==void 0?{scaleY:t.scaleY}:{},rotation:t.rotation??0,...t.drag&&{drag:t.drag},...t.rightClick&&{rightClick:t.rightClick},...t.scrollUp&&{scrollUp:t.scrollUp},...t.scrollDown&&{scrollDown:t.scrollDown}}};var eH=at({type:"rect",add:FB,update:kB,delete:UB,parse:OB,shouldUpdateUnchanged:Dr});var GB="_routeGraphicsBlur",op="_routeGraphicsBlurFilter",Tb="_routeGraphicsBlurOptions",tH=new Set([5,7,9,11,13,15]),sp={quality:4,kernelSize:5,repeatEdgePixels:!1},DB=t=>typeof t=="number"&&Number.isFinite(t),LB=(t,e)=>{if(!DB(t)||t<0)throw new Error(`Input Error: ${e} must be a finite number >= 0`)},Cs=(t,e="blur")=>{if(t===void 0)return;if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`Input Error: ${e} must be an object`);if(t.x===void 0||t.y===void 0)throw new Error(`Input Error: ${e}.x and ${e}.y are required`);LB(t.x,`${e}.x`),LB(t.y,`${e}.y`);let r=t.quality??sp.quality;if(!DB(r)||r<1)throw new Error(`Input Error: ${e}.quality must be a finite number >= 1`);let i=t.kernelSize??sp.kernelSize;if(!tH.has(i))throw new Error(`Input Error: ${e}.kernelSize must be one of 5, 7, 9, 11, 13, 15`);let s=t.repeatEdgePixels??sp.repeatEdgePixels;if(typeof s!="boolean")throw new Error(`Input Error: ${e}.repeatEdgePixels must be a boolean`);return{x:t.x,y:t.y,quality:r,kernelSize:i,repeatEdgePixels:s}},rH=(t,e)=>t?t instanceof Map?t.get(e)??[]:t.filter(r=>r?.targetId===e):[],Ht=(t,e)=>rH(t,e).some(r=>r?.type==="update"&&(r.tween?.blurX||r.tween?.blurY)),iH=t=>({get x(){return t.strengthX},set x(e){t.strengthX=Math.max(0,e)},get y(){return t.strengthY},set y(e){t.strengthY=Math.max(0,e)}}),sH=(t,e)=>{let r=t[Tb];return t[op]&&r?.quality===e.quality&&r?.kernelSize===e.kernelSize&&r?.repeatEdgePixels===e.repeatEdgePixels},oH=t=>{wo(t,"blur",null),delete t[GB],delete t[op],delete t[Tb]},ht=(t,e,{force:r=!1}={})=>{if(!e&&!r){oH(t);return}let i=e??{x:0,y:0,...sp},s=sH(t,i)?t[op]:new ra({strengthX:i.x,strengthY:i.y,quality:i.quality,kernelSize:i.kernelSize});s.repeatEdgePixels=i.repeatEdgePixels,s.strengthX=i.x,s.strengthY=i.y,t[op]=s,t[Tb]={quality:i.quality,kernelSize:i.kernelSize,repeatEdgePixels:i.repeatEdgePixels},t[GB]=iH(s),wo(t,"blur",s)},Wt=(t,{force:e=!1}={})=>!t?.blur&&!e?{}:{blurX:t?.blur?.x??0,blurY:t?.blur?.y??0};var NB=({app:t,parent:e,element:r,animations:i,eventHandler:s,animationBus:o,completionTracker:n,renderContext:a,zIndex:l})=>{let{id:c,width:u,height:h,src:d,alpha:f}=r,g=d?F.from(d):F.EMPTY,m=new Re(g);m.label=c,m.zIndex=l,m.width=Math.round(u),m.height=Math.round(h),m.alpha=f,kr(m,r);let x=Ht(i,c);ht(m,r.blur,{force:x});let v=Xe(i,c);Ie(m,r.filters,{width:u,height:h,force:v});let _=r?.hover,p=r?.click,b=r?.rightClick,y=r?.scrollUp,S=r?.scrollDown,E=null,P=null,C=null,M=()=>{let R=E?.isHovering()??!1,B=P?.isPressed()??!1;if((C?.isPressed()??!1)&&b?.src){let O=F.from(b.src);m.texture=O}else if(B&&p?.src){let O=F.from(p.src);m.texture=O}else if(R&&_?.src){let O=F.from(_.src);m.texture=O}else m.texture=g};if(_){let{cursor:R,soundSrc:B,payload:A}=_;m.eventMode="static",E=Es({displayObject:m,onHoverChange:M});let O=()=>{E.setDirectHover(!0),A&&s&&s("hover",{_event:{id:m.label},...A}),R&&(m.cursor=R),B&&t.audioStage.add({id:`hover-${Date.now()}`,url:B,loop:!1})},U=()=>{E.setDirectHover(!1),m.cursor="auto"};m.on("pointerover",O),m.on("pointerout",U)}if(p){let{soundSrc:R,soundVolume:B,payload:A}=p;m.eventMode="static",P=fa({displayObject:m,onPressChange:M});let O=G=>{kt(G)&&P.setDirectPress(!0)},U=G=>{kt(G)&&(P.setDirectPress(!1),A&&s&&s("click",{_event:{id:m.label},...A}),R&&t.audioStage.add({id:`click-${Date.now()}`,url:R,loop:!1,volume:$e(B)}))},k=()=>{P.setDirectPress(!1)};m.on("pointerdown",O),m.on("pointerup",U),m.on("pointerupoutside",k)}if(b){let{soundSrc:R,payload:B}=b;m.eventMode="static",C=pa({displayObject:m,onPressChange:M});let A=()=>{C.setDirectPress(!0)},O=()=>{C.setDirectPress(!1)},U=()=>{C.setDirectPress(!1),B&&s&&s("rightClick",{_event:{id:m.label},...B}),R&&t.audioStage.add({id:`rightClick-${Date.now()}`,url:R,loop:!1})},k=()=>{C.setDirectPress(!1)};m.on("rightdown",A),m.on("rightup",O),m.on("rightclick",U),m.on("rightupoutside",k)}(y||S)&&Lr({canvas:t.canvas,displayObject:m,scrollUpEvent:y,scrollDownEvent:S,eventHandler:s}),e.addChild(m),re({animations:i,targetId:c,animationBus:o,completionTracker:n,element:m,targetState:{...Ur(r),width:u,height:h,alpha:f,...Wt(r,{force:x}),...Ze(r,{force:v})},renderContext:a})};var VB=({app:t,parent:e,prevElement:r,nextElement:i,animations:s,animationBus:o,completionTracker:n,eventHandler:a,zIndex:l})=>{let c=e.children.find(P=>P.label===r.id);if(!c)return;c.zIndex=l;let{width:u,height:h,src:d,alpha:f}=i,g=Ht(s,r.id);g&&ht(c,r.blur,{force:!0});let m=Xe(s,r.id);m?Ie(c,r.filters,{width:r.width,height:r.height,force:!0}):Gr(c);let x=!1,v=ua(s,r.id),_=v.length>0,p=P=>v.some(C=>Object.prototype.hasOwnProperty.call(C.tween??{},P)),b=P=>{c._cleanupScrollInteraction?.(),c.removeAllListeners("pointerover"),c.removeAllListeners("pointerout"),c.removeAllListeners("pointerdown"),c.removeAllListeners("pointerupoutside"),c.removeAllListeners("pointerup"),c.removeAllListeners("rightdown"),c.removeAllListeners("rightclick"),c.removeAllListeners("rightup"),c.removeAllListeners("rightupoutside"),c.removeAllListeners("wheel"),da(c),Qf(c),Jf(c);let C=i?.hover,M=i?.click,R=i?.rightClick,B=i?.scrollUp,A=i?.scrollDown,O=null,U=null,k=null,G=()=>{let D=O?.isHovering()??!1,N=U?.isPressed()??!1;if((k?.isPressed()??!1)&&R?.src){let K=F.from(R.src);c.texture=K}else if(N&&M?.src){let K=F.from(M.src);c.texture=K}else if(D&&C?.src){let K=F.from(C.src);c.texture=K}else c.texture=P};if(C){let{cursor:D,soundSrc:N,payload:H}=C;c.eventMode="static",O=Es({displayObject:c,onHoverChange:G});let K=()=>{O.setDirectHover(!0),H&&a&&a("hover",{_event:{id:c.label},...H}),D&&(c.cursor=D),N&&t.audioStage.add({id:`hover-${Date.now()}`,url:N,loop:!1})},oe=()=>{O.setDirectHover(!1),c.cursor="auto"};c.on("pointerover",K),c.on("pointerout",oe)}if(M){let{soundSrc:D,soundVolume:N,payload:H}=M;c.eventMode="static",U=fa({displayObject:c,onPressChange:G});let K=ce=>{kt(ce)&&U.setDirectPress(!0)},oe=ce=>{kt(ce)&&(U.setDirectPress(!1),H&&a&&a("click",{_event:{id:c.label},...H}),D&&t.audioStage.add({id:`click-${Date.now()}`,url:D,loop:!1,volume:$e(N)}))},pe=()=>{U.setDirectPress(!1)};c.on("pointerdown",K),c.on("pointerup",oe),c.on("pointerupoutside",pe)}if(R){let{soundSrc:D,payload:N}=R;c.eventMode="static",k=pa({displayObject:c,onPressChange:G});let H=()=>{k.setDirectPress(!0)},K=()=>{k.setDirectPress(!1)},oe=()=>{k.setDirectPress(!1),N&&a&&a("rightClick",{_event:{id:c.label},...N}),D&&t.audioStage.add({id:`rightClick-${Date.now()}`,url:D,loop:!1})},pe=()=>{k.setDirectPress(!1)};c.on("rightdown",H),c.on("rightup",K),c.on("rightclick",oe),c.on("rightupoutside",pe)}(B||A)&&Lr({canvas:t.canvas,displayObject:c,scrollUpEvent:B,scrollDownEvent:A,eventHandler:a})},y=({preserveWidth:P=!1,preserveHeight:C=!1}={})=>{let M=c.width,R=c.height,B=d?F.from(d):F.EMPTY;c.texture=B,c.width=Math.round(P?M:u),c.height=Math.round(C?R:h),b(B)},S=()=>{ge(r,i)||(x||y(),c.width=Math.round(u),c.height=Math.round(h),c.alpha=f,kr(c,i),ht(c,i.blur,{force:g}),Ie(c,i.filters,{width:u,height:h,force:m}))};r.src!==i.src&&_&&(y({preserveWidth:p("width"),preserveHeight:p("height")}),x=!0),re({animations:s,targetId:r.id,animationBus:o,completionTracker:n,element:c,targetState:{...Ur(i),width:u,height:h,alpha:f,...Wt(i,{force:g}),...Ze(i,{force:m})},onComplete:()=>{S()}})||S()};var HB=({parent:t,element:e,animations:r,animationBus:i,completionTracker:s})=>{let o=t.children.find(a=>a.label===e.id);if(!o)return;re({animations:r,targetId:e.id,animationBus:i,completionTracker:s,element:o,targetState:null,onComplete:()=>{o&&!o.destroyed&&(o._cleanupScrollInteraction?.(),o.destroy())}})||(o._cleanupScrollInteraction?.(),o.destroy())};var WB=({state:t})=>({...vt(t),src:t.src??"",alpha:t.alpha??1,rotation:t.rotation??0,...t.blur!==void 0&&{blur:Cs(t.blur)},...t.hover&&{hover:t.hover},...t.click&&{click:t.click},...t.rightClick&&{rightClick:t.rightClick},...t.scrollUp&&{scrollUp:t.scrollUp},...t.scrollDown&&{scrollDown:t.scrollDown}});var nH=at({type:"sprite",add:NB,update:VB,delete:HB,parse:WB,shouldUpdateUnchanged:Dr});var aH=t=>!t||t.ended?!0:Number.isFinite(t.duration)&&t.duration>0&&t.currentTime>=t.duration,Sb=({videoElement:t,video:e})=>{e&&t?._videoEndedListener&&e.removeEventListener("ended",t._videoEndedListener),t&&(t._videoEndedListener=void 0,t._playbackStateVersion=null)},np=({videoElement:t,video:e,loop:r,completionTracker:i})=>{if(Sb({videoElement:t,video:e}),(r??!1)||aH(e))return;let s=i.getVersion();i.track(s);let o=()=>{i.complete(s)};e.addEventListener("ended",o),t._videoEndedListener=o,t._playbackStateVersion=s};var zB=({parent:t,element:e,animations:r,animationBus:i,renderContext:s,completionTracker:o,zIndex:n})=>{let{id:a,x:l,y:c,width:u,height:h,src:d,volume:f,loop:g,alpha:m}=e,x=F.from(d),v=x.source.resource;v.pause(),v.currentTime=0,v.loop=g??!1,v.volume=$e(f),v.muted=!1;let _=new Re(x);_.label=a,_.zIndex=n,_._videoEndedListener=void 0,_._playbackStateVersion=null,_.x=Math.round(l),_.y=Math.round(c),_.width=Math.round(u),_.height=Math.round(h),_.alpha=m??1;let p=Ht(r,a);ht(_,e.blur,{force:p});let b=Xe(r,a);Ie(_,e.filters,{width:u,height:h,force:b}),np({videoElement:_,video:v,loop:g,completionTracker:o}),FI(s,v),t.addChild(_),re({animations:r,targetId:a,animationBus:i,completionTracker:o,element:_,targetState:{x:l,y:c,width:u,height:h,alpha:m??1,...Wt(e,{force:p}),...Ze(e,{force:b})},renderContext:s})};var $B=({parent:t,prevElement:e,nextElement:r,animations:i,animationBus:s,eventHandler:o,completionTracker:n,zIndex:a})=>{let l=t.children.find(P=>P.label===e.id);if(!l)return;l.zIndex=a;let{x:c,y:u,width:h,height:d,alpha:f}=r,g=Ht(i,e.id);g&&ht(l,e.blur,{force:!0});let m=Xe(i,e.id);m?Ie(l,e.filters,{width:e.width,height:e.height,force:!0}):Gr(l);let x=e.src,v=!1,_=ua(i,e.id),p=_.length>0,b=P=>_.some(C=>Object.prototype.hasOwnProperty.call(C.tween??{},P)),y=()=>{let P=l.texture.source.resource,C=x!==r.src;if(C){let M=P;Sb({videoElement:l,video:M}),M&&M.pause();let R=F.from(r.src);l.texture=R,P=R.source.resource,P.muted=!1,P.pause(),P.currentTime=0,x=r.src}np({videoElement:l,video:P,loop:r.loop,completionTracker:n}),P.volume=$e(r.volume),P.loop=r.loop??!1,C&&P.play()},S=()=>{ge(e,r)||(l.x=Math.round(c),l.y=Math.round(u),l.width=Math.round(h),l.height=Math.round(d),l.alpha=f??1,ht(l,r.blur,{force:g}),Ie(l,r.filters,{width:h,height:d,force:m}),v||y())};if(e.src!==r.src&&p){let P=l.width,C=l.height;y(),l.width=Math.round(b("width")?P:h),l.height=Math.round(b("height")?C:d),v=!0}re({animations:i,targetId:e.id,animationBus:s,completionTracker:n,element:l,targetState:{x:c,y:u,width:h,height:d,alpha:f??1,...Wt(r,{force:g}),...Ze(r,{force:m})},onComplete:S})||S()};var XB=({parent:t,element:e,animations:r,animationBus:i,completionTracker:s})=>{let o=t.children.find(l=>l.label===e.id);if(!o)return;let n=()=>{if(o&&!o.destroyed){o._playbackStateVersion!==null&&s.complete(o._playbackStateVersion);let l=o.texture.source.resource;l&&(o._videoEndedListener&&l.removeEventListener("ended",o._videoEndedListener),l.pause()),t.removeChild(o),o.destroy()}};re({animations:r,targetId:e.id,animationBus:i,completionTracker:s,element:o,targetState:null,onComplete:n})||n()};var YB=({state:t})=>({...vt(t),src:t.src,volume:t.volume??100,loop:t.loop??!1,...t.blur!==void 0&&{blur:Cs(t.blur)}});var lH=at({type:"video",add:zB,update:$B,delete:XB,parse:YB,shouldUpdateUnchanged:Dr});var jB=0,qB=16,ya=Symbol("routeGraphicsSliderRuntime"),cH=(t,e)=>t!==null&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,e),Ab=t=>Math.max(0,Math.min(1,t)),KB=t=>t.initialValue??t.min,wb=t=>{if(!(!t||typeof t!="object")){if(typeof t.pointerId=="number")return t.pointerId;if(typeof t.nativeEvent?.pointerId=="number")return t.nativeEvent.pointerId;if(typeof t.data?.pointerId=="number")return t.data.pointerId}},uH=t=>{if(!t||typeof t!="object")return null;if(typeof t.clientX=="number"&&typeof t.clientY=="number")return{x:t.clientX,y:t.clientY};let e=t.changedTouches?.[0]??t.touches?.[0];return e&&typeof e.clientX=="number"&&typeof e.clientY=="number"?{x:e.clientX,y:e.clientY}:null},ZB=t=>typeof globalThis.addEventListener=="function"&&typeof globalThis.removeEventListener=="function"&&typeof globalThis.document?.addEventListener=="function"&&typeof globalThis.document?.removeEventListener=="function"&&typeof t?.renderer?.events?.mapPositionToPoint=="function",hH=({app:t,nativeEvent:e})=>{let r=uH(e);if(!r)return null;let i={x:0,y:0};return t.renderer.events.mapPositionToPoint(i,r.x,r.y),i},QB=t=>{t.removeNativeDragListeners?.(),t.removeNativeDragListeners=null},dH=({runtime:t,moveListener:e,upListener:r})=>{if(!ZB(t.app)||t.removeNativeDragListeners)return;let i=[],s=(o,n,a)=>{o.addEventListener(n,a,!0),i.push([o,n,a])};typeof globalThis.PointerEvent=="function"?(s(globalThis.document,"pointermove",e),s(globalThis,"pointerup",r),s(globalThis,"pointercancel",r)):(s(globalThis.document,"mousemove",e),s(globalThis,"mouseup",r),"ontouchstart"in globalThis&&(s(globalThis.document,"touchmove",e),s(globalThis,"touchend",r),s(globalThis,"touchcancel",r))),t.removeNativeDragListeners=()=>{for(let[o,n,a]of i)o.removeEventListener(n,a,!0)}},Ao=t=>t?F.from(t):F.EMPTY,_a=t=>({bar:`${t}-bar`,inactiveBar:`${t}-inactive-bar`,barMask:`${t}-bar-mask`,thumb:`${t}-thumb`}),JB=({sliderContainer:t,fromId:e,toId:r})=>{if(e===r)return;let i=_a(e),s=_a(r);for(let[o,n]of Object.entries(i)){let a=t.getChildByLabel(n);a&&(a.label=s[o])}},ba=({sliderContainer:t,id:e})=>{let r=_a(e);return{bar:t.getChildByLabel(r.bar),inactiveBar:t.getChildByLabel(r.inactiveBar),barMask:t.getChildByLabel(r.barMask),thumb:t.getChildByLabel(r.thumb)}},Eb=({baseValue:t,override:e,key:r})=>cH(e,r)?e[r]??"":t??"",fH=(t,e=null)=>({thumbSrc:Eb({baseValue:t.thumbSrc,override:e,key:"thumbSrc"}),barSrc:Eb({baseValue:t.barSrc,override:e,key:"barSrc"}),inactiveBarSrc:Eb({baseValue:t.inactiveBarSrc,override:e,key:"inactiveBarSrc"})}),pH=t=>{let e=new Re(F.EMPTY);return e.label=t,e.eventMode="static",e.zIndex=0,e},mH=t=>{let e=new ze;return e.label=t,e.zIndex=0,e},gH=({sliderContainer:t,id:e,bar:r})=>{let i=_a(e),{inactiveBar:s,barMask:o}=ba({sliderContainer:t,id:e});return s||(s=pH(i.inactiveBar),t.addChild(s)),o||(o=mH(i.barMask),t.addChild(o)),r.mask=o,{inactiveBar:s,barMask:o}},xH=({sliderContainer:t,id:e,bar:r})=>{let{inactiveBar:i,barMask:s}=ba({sliderContainer:t,id:e});r?.mask===s&&(r.mask=null),i&&(t.removeChild(i),i.destroy()),s&&(t.removeChild(s),s.destroy())},eF=({currentValue:t,min:e,max:r})=>{let i=r-e;return i<=0?0:Ab((t-e)/i)},yH=({barMask:t,direction:e,width:r,height:i,currentValue:s,min:o,max:n})=>{if(!t)return;let a=eF({currentValue:s,min:o,max:n}),l=Math.round(e==="horizontal"?r*a:r),c=Math.round(e==="horizontal"?i:i*a);t.clear(),!(l<=0||c<=0)&&t.rect(0,0,l,c).fill({color:16777215,alpha:0})},_H=({thumb:t,direction:e,currentValue:r,min:i,max:s,trackWidth:o,trackHeight:n})=>{let a=eF({currentValue:r,min:i,max:s});if(e==="horizontal"){t.x=a*(o-t.width),t.y=(n-t.height)/2;return}t.x=(o-t.width)/2,t.y=a*(n-t.height)},lp=({thumb:t,thumbSrc:e,direction:r,trackWidth:i,trackHeight:s})=>{let o=r==="horizontal"?s-jB*2:i-jB*2,n=Ao(e),a=n.width||qB,l=n.height||qB,c=o/a,u=o/l,h=Math.min(c,u);t.width=a*h,t.height=l*h},bH=({sliderContainer:t,sliderComputedNode:e,thumb:r,currentValue:i,hoverOverride:s=null})=>{let{id:o,width:n,height:a,direction:l,min:c,max:u}=e,{barSrc:h,inactiveBarSrc:d,thumbSrc:f}=fH(e,s),{bar:g}=ba({sliderContainer:t,id:o});if(g){if(g.texture=Ao(h),g.width=n,g.height=a,r.texture=Ao(f),d){let{inactiveBar:m,barMask:x}=gH({sliderContainer:t,id:o,bar:g});m.texture=Ao(d),m.width=n,m.height=a,yH({barMask:x,direction:l,width:n,height:a,currentValue:i,min:c,max:u})}else xH({sliderContainer:t,id:o,bar:g});_H({thumb:r,direction:l,currentValue:i,min:c,max:u,trackWidth:n,trackHeight:a})}},vH=({position:t,thumb:e,direction:r,min:i,max:s,step:o,trackWidth:n,trackHeight:a})=>{let l=s-i,c;if(r==="horizontal"){let h=t.x-e.width/2,d=Math.max(n-e.width,1);c=Ab(h/d)}else{let h=t.y-e.height/2,d=Math.max(a-e.height,1);c=Ab(h/d)}let u=i+c*l;return o>0&&(u=Math.round((u-i)/o)*o+i,u=Math.max(i,Math.min(s,u))),u},tF=({sliderContainer:t,sliderComputedNode:e,cursor:r})=>{let i=r??"auto",{bar:s,inactiveBar:o,thumb:n}=ba({sliderContainer:t,id:e.id});t.cursor=i,s&&(s.cursor=i),o&&(o.cursor=i),n&&(n.cursor=i)},xu=t=>{bH({sliderContainer:t.sliderContainer,sliderComputedNode:t.sliderComputedNode,thumb:t.thumb,currentValue:t.currentValue,hoverOverride:t.sliderComputedNode.hover&&t.hoverController?.isHovering()?t.sliderComputedNode.hover:null})},ap=t=>{let e=t.hoverController?.isHovering()===!0?t.sliderComputedNode.hover?.cursor:null;tF({sliderContainer:t.sliderContainer,sliderComputedNode:t.sliderComputedNode,cursor:e})},rF=({app:t,sliderContainer:e,sliderComputedNode:r,thumb:i,eventHandler:s})=>{let o=e[ya];return o||(da(e),o={app:t,sliderContainer:e,sliderComputedNode:r,thumb:i,eventHandler:s,currentValue:KB(r),isDragging:!1,activePointerId:void 0,listenersBound:!1,hoverController:null,removeNativeDragListeners:null},o.hoverController=Es({displayObject:e,onHoverChange:()=>{xu(o),ap(o)}}),e[ya]=o),o.app=t,o.sliderContainer=e,o.sliderComputedNode=r,o.thumb=i,o.eventHandler=s,o},cp=({app:t,sliderContainer:e,sliderComputedNode:r,thumb:i,eventHandler:s,adoptExternalValue:o=!0})=>{let n=rF({app:t,sliderContainer:e,sliderComputedNode:r,thumb:i,eventHandler:s});return o&&(n.currentValue=KB(r)),xu(n),ap(n),n},iF=({sliderContainer:t})=>{let e=t?.[ya];e&&(QB(e),e.hoverController?.destroy?.(),delete t[ya])},sF=({app:t,sliderContainer:e,sliderComputedNode:r,thumb:i,eventHandler:s})=>{let o=rF({app:t,sliderContainer:e,sliderComputedNode:r,thumb:i,eventHandler:s});if(o.listenersBound)return;o.listenersBound=!0;let n=g=>{let{sliderComputedNode:m}=o,x=o.sliderContainer.toLocal(g),v=vH({position:x,thumb:o.thumb,direction:m.direction,min:m.min,max:m.max,step:m.step,trackWidth:m.width,trackHeight:m.height});v!==o.currentValue&&(o.currentValue=v,xu(o),m.change?.payload&&o.eventHandler&&o.eventHandler("change",{_event:{id:m.id,value:o.currentValue},...m.change.payload}))},a=g=>{g?.global&&n(g.global)},l=g=>{let m=wb(g);o.activePointerId!==void 0&&m!==void 0&&m!==o.activePointerId||o.isDragging&&(o.isDragging=!1,o.activePointerId=void 0,QB(o))},c=g=>{if(!o.isDragging)return;let m=wb(g);if(o.activePointerId!==void 0&&m!==void 0&&m!==o.activePointerId)return;let x=hH({app:o.app,nativeEvent:g});x&&n(x)},u=g=>{o.isDragging=!0,o.activePointerId=wb(g),dH({runtime:o,moveListener:c,upListener:l}),a(g)},h=g=>{o.isDragging&&a(g)};e.on("pointerdown",u),ZB(t)||e.on("globalpointermove",h),e.on("pointerup",l),e.on("pointerupoutside",l);let d=()=>{o.hoverController?.setDirectHover(!0),xu(o),ap(o);let g=o.sliderComputedNode.hover;g&&(tF({sliderContainer:o.sliderContainer,sliderComputedNode:o.sliderComputedNode,cursor:g.cursor}),g.soundSrc&&o.app?.audioStage?.add({id:`hover-${Date.now()}`,url:g.soundSrc,loop:!1}))},f=()=>{o.isDragging||(o.hoverController?.setDirectHover(!1),xu(o),ap(o))};e.on("pointerover",d),e.on("pointerout",f),e.on("pointerupoutside",f)};var oF=({app:t,parent:e,element:r,animations:i,animationBus:s,completionTracker:o,eventHandler:n,renderContext:a,zIndex:l})=>{let{id:c,x:u,y:h,width:d,height:f,alpha:g,thumbSrc:m,barSrc:x}=r,v=new ee;v.label=c,v.zIndex=l,v.x=u,v.y=h,v.alpha=g,v.sortableChildren=!0,v.eventMode="static";let _=_a(c),p=new Re(Ao(x));p.label=_.bar,p.eventMode="static",p.zIndex=1;let b=new Re(Ao(m));b.label=_.thumb,b.eventMode="static",b.zIndex=2,lp({thumb:b,thumbSrc:m,direction:r.direction,trackWidth:d,trackHeight:f}),v.addChild(p),v.addChild(b),sF({app:t,sliderContainer:v,sliderComputedNode:r,thumb:b,eventHandler:n}),cp({app:t,sliderContainer:v,sliderComputedNode:r,thumb:b,eventHandler:n}),e.addChild(v),re({animations:i,targetId:c,animationBus:s,completionTracker:o,element:v,targetState:{x:u,y:h,alpha:g},renderContext:a})};var nF=({app:t,parent:e,prevElement:r,nextElement:i,animations:s,animationBus:o,completionTracker:n,eventHandler:a,zIndex:l})=>{let c=e.children.find(m=>m.label===r.id);if(!c)return;c.zIndex=l;let u=()=>{if(!ge(r,i)){c.x=i.x,c.y=i.y,c.alpha=i.alpha,c.label=i.id,c.pivot.set(i.originX,i.originY),JB({sliderContainer:c,fromId:r.id,toId:i.id});let{bar:m,thumb:x}=ba({sliderContainer:c,id:i.id});if(m&&x&&lp({thumb:x,thumbSrc:i.thumbSrc,direction:i.direction,trackWidth:i.width,trackHeight:i.height}),!m||!x)return;let v=c[ya]?.isDragging!==!0||r.initialValue!==i.initialValue;cp({app:t,sliderContainer:c,sliderComputedNode:i,thumb:x,eventHandler:a,adoptExternalValue:v})}},{x:h,y:d,alpha:f}=i;re({animations:s,targetId:r.id,animationBus:o,completionTracker:n,element:c,targetState:{x:h,y:d,alpha:f},onComplete:u})||u()};var aF=({app:t,parent:e,element:r,animations:i,animationBus:s,completionTracker:o})=>{let n=e.getChildByLabel(r.id);if(!n)return;let a=()=>{n&&!n.destroyed&&(iF({sliderContainer:n}),n.destroy({children:!0}))};re({animations:i,targetId:r.id,animationBus:s,completionTracker:o,element:n,targetState:null,onComplete:a})||a()};var TH=(t,e,r)=>Math.max(e,Math.min(r,t)),lF=({state:t})=>{let e=vt(t),r=t.min??0,i=t.max??100;if(i<=r)throw new Error("Input error: the max value of a slider must be larger than the min value");if(t.initialValue===void 0)throw new Error("Input error: slider initialValue is required");if(typeof t.initialValue!="number"||Number.isNaN(t.initialValue))throw new Error("Input error: slider initialValue must be a valid number");let s=TH(t.initialValue,r,i);return{...e,direction:t.direction??"horizontal",thumbSrc:t.thumbSrc??"",barSrc:t.barSrc??"",...t.inactiveBarSrc!==void 0&&{inactiveBarSrc:t.inactiveBarSrc??""},alpha:t.alpha??1,min:r,max:i,step:t.step??1,initialValue:s,...t.hover&&{hover:t.hover},...t.change&&{change:t.change}}};var SH=at({type:"slider",add:oF,update:nF,delete:aF,parse:lF});var Ta=Symbol("routeGraphicsInputRuntime"),up={top:10,right:12,bottom:10,left:12},Cb="#FFFFFF",Rb={color:"#2E2E2E",width:1,alpha:1},Mb={color:"#4A89FF",width:2,alpha:1},cF={fill:"#4A89FF",alpha:.3},Pb={fill:"#111111",width:2},wH=(t={})=>{let e=t.fontSize??Ge.fontSize,r=t.lineHeight??Ge.lineHeight;return typeof r!="number"?Math.round(e*Ge.lineHeight):r>8?Math.round(r):Math.round(e*r)},pp=(t={},e={})=>({...Ge,...t,align:t.align??"left",lineHeight:wH(t),wordWrap:!1,breakWords:!1,wordWrapWidth:e.wordWrapWidth??0,whiteSpace:"pre"}),Ib=t=>typeof t=="number"?{top:t,right:t,bottom:t,left:t}:Array.isArray(t)?{top:t[0]??0,right:t[1]??t[0]??0,bottom:t[2]??t[0]??0,left:t[3]??t[1]??t[0]??0}:{top:t?.top??up.top,right:t?.right??up.right,bottom:t?.bottom??up.bottom,left:t?.left??up.left},EH=(t,e)=>typeof t!="number"||!Number.isFinite(t)?e:Math.max(0,Math.round(t)),AH=(t,e)=>typeof t=="number"&&Number.isFinite(t)?t:e,Bb=(t,e)=>({color:t?.color??e.color,width:EH(t?.width,e.width),alpha:AH(t?.alpha,e.alpha)}),va=t=>String(t??"").replace(/\r\n/g,`
|
|
1297
1297
|
`).replace(/\r/g,`
|