1239 lines
975 KiB
JavaScript
1239 lines
975 KiB
JavaScript
var Tx=Object.defineProperty;var Mx=(i,e,t)=>e in i?Tx(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t;var A=(i,e,t)=>Mx(i,typeof e!="symbol"?e+"":e,t);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const n of document.querySelectorAll('link[rel="modulepreload"]'))s(n);new MutationObserver(n=>{for(const r of n)if(r.type==="childList")for(const o of r.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&s(o)}).observe(document,{childList:!0,subtree:!0});function t(n){const r={};return n.integrity&&(r.integrity=n.integrity),n.referrerPolicy&&(r.referrerPolicy=n.referrerPolicy),n.crossOrigin==="use-credentials"?r.credentials="include":n.crossOrigin==="anonymous"?r.credentials="omit":r.credentials="same-origin",r}function s(n){if(n.ep)return;n.ep=!0;const r=t(n);fetch(n.href,r)}})();/**
|
||
* @vue/shared v3.5.41
|
||
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
||
* @license MIT
|
||
**/function kd(i){const e=Object.create(null);for(const t of i.split(","))e[t]=1;return t=>t in e}const Ot={},io=[],Ys=()=>{},Mg=()=>!1,uh=i=>i.charCodeAt(0)===111&&i.charCodeAt(1)===110&&(i.charCodeAt(2)>122||i.charCodeAt(2)<97),dh=i=>i.startsWith("onUpdate:"),mi=Object.assign,Fd=(i,e)=>{const t=i.indexOf(e);t>-1&&i.splice(t,1)},Ex=Object.prototype.hasOwnProperty,Rt=(i,e)=>Ex.call(i,e),tt=Array.isArray,so=i=>xa(i)==="[object Map]",xo=i=>xa(i)==="[object Set]",xf=i=>xa(i)==="[object Date]",at=i=>typeof i=="function",qt=i=>typeof i=="string",Xi=i=>typeof i=="symbol",Ft=i=>i!==null&&typeof i=="object",Eg=i=>(Ft(i)||at(i))&&at(i.then)&&at(i.catch),Ag=Object.prototype.toString,xa=i=>Ag.call(i),Ax=i=>xa(i).slice(8,-1),Cg=i=>xa(i)==="[object Object]",fh=i=>qt(i)&&i!=="NaN"&&i[0]!=="-"&&""+parseInt(i,10)===i,Ko=kd(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),ph=i=>{const e=Object.create(null);return(t=>e[t]||(e[t]=i(t)))},Cx=/-\w/g,ls=ph(i=>i.replace(Cx,e=>e.slice(1).toUpperCase())),Ix=/\B([A-Z])/g,Jn=ph(i=>i.replace(Ix,"-$1").toLowerCase()),Ig=ph(i=>i.charAt(0).toUpperCase()+i.slice(1)),Yh=ph(i=>i?`on${Ig(i)}`:""),Ds=(i,e)=>!Object.is(i,e),cl=(i,...e)=>{for(let t=0;t<i.length;t++)i[t](...e)},Rg=(i,e,t,s=!1)=>{Object.defineProperty(i,e,{configurable:!0,enumerable:!1,writable:s,value:t})},mh=i=>{const e=parseFloat(i);return isNaN(e)?i:e};let bf;const gh=()=>bf||(bf=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function Pi(i){if(tt(i)){const e={};for(let t=0;t<i.length;t++){const s=i[t],n=qt(s)?Fx(s):Pi(s);if(n)for(const r in n)e[r]=n[r]}return e}else if(qt(i)||Ft(i))return i}const Rx=/;(?![^(]*\))/g,Px=/:([^]+)/,kx=/\/\*[^]*?\*\//g;function Fx(i){const e={};return i.replace(kx,"").split(Rx).forEach(t=>{if(t){const s=t.split(Px);s.length>1&&(e[s[0].trim()]=s[1].trim())}}),e}function Ze(i){let e="";if(qt(i))e=i;else if(tt(i))for(let t=0;t<i.length;t++){const s=Ze(i[t]);s&&(e+=s+" ")}else if(Ft(i))for(const t in i)i[t]&&(e+=t+" ");return e.trim()}const Ox="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",Bx=kd(Ox);function Pg(i){return!!i||i===""}function Lx(i,e){if(i.length!==e.length)return!1;let t=!0;for(let s=0;t&&s<i.length;s++)t=bo(i[s],e[s]);return t}function bo(i,e){if(i===e)return!0;let t=xf(i),s=xf(e);if(t||s)return t&&s?i.getTime()===e.getTime():!1;if(t=Xi(i),s=Xi(e),t||s)return i===e;if(t=tt(i),s=tt(e),t||s)return t&&s?Lx(i,e):!1;if(t=Ft(i),s=Ft(e),t||s){if(!t||!s)return!1;const n=Object.keys(i).length,r=Object.keys(e).length;if(n!==r)return!1;for(const o in i){const a=i.hasOwnProperty(o),h=e.hasOwnProperty(o);if(a&&!h||!a&&h||!bo(i[o],e[o]))return!1}}return String(i)===String(e)}function Od(i,e){return i.findIndex(t=>bo(t,e))}const kg=i=>!!(i&&i.__v_isRef===!0),Ye=i=>qt(i)?i:i==null?"":tt(i)||Ft(i)&&(i.toString===Ag||!at(i.toString))?kg(i)?Ye(i.value):JSON.stringify(i,Fg,2):String(i),Fg=(i,e)=>kg(e)?Fg(i,e.value):so(e)?{[`Map(${e.size})`]:[...e.entries()].reduce((t,[s,n],r)=>(t[$h(s,r)+" =>"]=n,t),{})}:xo(e)?{[`Set(${e.size})`]:[...e.values()].map(t=>$h(t))}:Xi(e)?$h(e):Ft(e)&&!tt(e)&&!Cg(e)?String(e):e,$h=(i,e="")=>{var t;return Xi(i)?`Symbol(${(t=i.description)!=null?t:e})`:i};/**
|
||
* @vue/reactivity v3.5.41
|
||
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
||
* @license MIT
|
||
**/let ri;class Og{constructor(e=!1){this.detached=e,this._active=!0,this._on=0,this.effects=[],this.cleanups=[],this._isPaused=!1,this._warnOnRun=!0,this.__v_skip=!0,!e&&ri&&(ri.active?(this.parent=ri,this.index=(ri.scopes||(ri.scopes=[])).push(this)-1):(this._active=!1,this._warnOnRun=!1))}get active(){return this._active}pause(){if(this._active){this._isPaused=!0;let e,t;if(this.scopes){const s=this.scopes.slice();for(e=0,t=s.length;e<t;e++)s[e].pause()}for(e=0,t=this.effects.length;e<t;e++)this.effects[e].pause()}}resume(){if(this._active&&this._isPaused){this._isPaused=!1;let e,t;if(this.scopes){const n=this.scopes.slice();for(e=0,t=n.length;e<t;e++)n[e].resume()}const s=this.effects.slice();for(e=0,t=s.length;e<t;e++)s[e].resume()}}run(e){if(this._active){const t=ri;try{return ri=this,e()}finally{ri=t}}}on(){++this._on===1&&(this.prevScope=ri,ri=this)}off(){if(this._on>0&&--this._on===0){if(ri===this)ri=this.prevScope;else{let e=ri;for(;e;){if(e.prevScope===this){e.prevScope=this.prevScope;break}e=e.prevScope}}this.prevScope=void 0}}stop(e){if(this._active){this._active=!1;let t,s;for(t=0,s=this.effects.length;t<s;t++)this.effects[t].stop();for(this.effects.length=0,t=0,s=this.cleanups.length;t<s;t++)this.cleanups[t]();if(this.cleanups.length=0,this.scopes){const n=this.scopes.slice();for(t=0,s=n.length;t<s;t++)n[t].stop(!0);this.scopes.length=0}if(!this.detached&&this.parent&&!e){const n=this.parent.scopes.pop();n&&n!==this&&(this.parent.scopes[this.index]=n,n.index=this.index)}this.parent=void 0}}}function Bg(i){return new Og(i)}function Lg(){return ri}function Dx(i,e=!1){ri&&ri.cleanups.push(i)}let Dt;const Gh=new WeakSet;class Dg{constructor(e){this.fn=e,this.deps=void 0,this.depsTail=void 0,this.flags=5,this.next=void 0,this.cleanup=void 0,this.scheduler=void 0,ri&&(ri.active?ri.effects.push(this):this.flags&=-2)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,Gh.has(this)&&(Gh.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||Ug(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,wf(this),Vg(this);const e=Dt,t=hs;Dt=this,hs=!0;try{return this.fn()}finally{Xg(this),Dt=e,hs=t,this.flags&=-3}}stop(){if(this.flags&1){for(let e=this.deps;e;e=e.nextDep)Dd(e);this.deps=this.depsTail=void 0,wf(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?Gh.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){Iu(this)&&this.run()}get dirty(){return Iu(this)}}let Ng=0,Zo,Jo;function Ug(i,e=!1){if(i.flags|=8,e){i.next=Jo,Jo=i;return}i.next=Zo,Zo=i}function Bd(){Ng++}function Ld(){if(--Ng>0)return;if(Jo){let e=Jo;for(Jo=void 0;e;){const t=e.next;e.next=void 0,e.flags&=-9,e=t}}let i;for(;Zo;){let e=Zo;for(Zo=void 0;e;){const t=e.next;if(e.next=void 0,e.flags&=-9,e.flags&1)try{e.trigger()}catch(s){i||(i=s)}e=t}}if(i)throw i}function Vg(i){for(let e=i.deps;e;e=e.nextDep)e.version=-1,e.prevActiveLink=e.dep.activeLink,e.dep.activeLink=e}function Xg(i){let e,t=i.depsTail,s=t;for(;s;){const n=s.prevDep;s.version===-1?(s===t&&(t=n),Dd(s),Nx(s)):e=s,s.dep.activeLink=s.prevActiveLink,s.prevActiveLink=void 0,s=n}i.deps=e,i.depsTail=t}function Iu(i){for(let e=i.deps;e;e=e.nextDep)if(e.dep.version!==e.version||e.dep.computed&&(Yg(e.dep.computed)||e.dep.version!==e.version))return!0;return!!i._dirty}function Yg(i){if(i.flags&4&&!(i.flags&16)||(i.flags&=-17,i.globalVersion===ra)||(i.globalVersion=ra,!i.isSSR&&i.flags&128&&(!i.deps&&!i._dirty||!Iu(i))))return;i.flags|=2;const e=i.dep,t=Dt,s=hs;Dt=i,hs=!0;try{Vg(i);const n=i.fn(i._value);(e.version===0||Ds(n,i._value))&&(i.flags|=128,i._value=n,e.version++)}catch(n){throw e.version++,n}finally{Dt=t,hs=s,Xg(i),i.flags&=-3}}function Dd(i,e=!1){const{dep:t,prevSub:s,nextSub:n}=i;if(s&&(s.nextSub=n,i.prevSub=void 0),n&&(n.prevSub=s,i.nextSub=void 0),t.subs===i&&(t.subs=s,!s&&t.computed)){t.computed.flags&=-5;for(let r=t.computed.deps;r;r=r.nextDep)Dd(r,!0)}!e&&!--t.sc&&t.map&&t.map.delete(t.key)}function Nx(i){const{prevDep:e,nextDep:t}=i;e&&(e.nextDep=t,i.prevDep=void 0),t&&(t.prevDep=e,i.nextDep=void 0)}let hs=!0;const $g=[];function xn(){$g.push(hs),hs=!1}function bn(){const i=$g.pop();hs=i===void 0?!0:i}function wf(i){const{cleanup:e}=i;if(i.cleanup=void 0,e){const t=Dt;Dt=void 0;try{e()}finally{Dt=t}}}let ra=0;class Ux{constructor(e,t){this.sub=e,this.dep=t,this.version=t.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}}class Nd{constructor(e){this.computed=e,this.version=0,this.activeLink=void 0,this.subs=void 0,this.map=void 0,this.key=void 0,this.sc=0,this.__v_skip=!0}track(e){if(!Dt||!hs||Dt===this.computed)return;let t=this.activeLink;if(t===void 0||t.sub!==Dt)t=this.activeLink=new Ux(Dt,this),Dt.deps?(t.prevDep=Dt.depsTail,Dt.depsTail.nextDep=t,Dt.depsTail=t):Dt.deps=Dt.depsTail=t,Gg(t);else if(t.version===-1&&(t.version=this.version,t.nextDep)){const s=t.nextDep;s.prevDep=t.prevDep,t.prevDep&&(t.prevDep.nextDep=s),t.prevDep=Dt.depsTail,t.nextDep=void 0,Dt.depsTail.nextDep=t,Dt.depsTail=t,Dt.deps===t&&(Dt.deps=s)}return t}trigger(e){this.version++,ra++,this.notify(e)}notify(e){Bd();try{for(let t=this.subs;t;t=t.prevSub)t.sub.notify()&&t.sub.dep.notify()}finally{Ld()}}}function Gg(i){if(i.dep.sc++,i.sub.flags&4){const e=i.dep.computed;if(e&&!i.dep.subs){e.flags|=20;for(let s=e.deps;s;s=s.nextDep)Gg(s)}const t=i.dep.subs;t!==i&&(i.prevSub=t,t&&(t.nextSub=i)),i.dep.subs=i}}const _l=new WeakMap,mr=Symbol(""),Ru=Symbol(""),oa=Symbol("");function yi(i,e,t){if(hs&&Dt){let s=_l.get(i);s||_l.set(i,s=new Map);let n=s.get(t);n||(s.set(t,n=new Nd),n.map=s,n.key=t),n.track()}}function cn(i,e,t,s,n,r){const o=_l.get(i);if(!o){ra++;return}const a=h=>{h&&h.trigger()};if(Bd(),e==="clear")o.forEach(a);else{const h=tt(i),l=h&&fh(t);if(h&&t==="length"){const c=Number(s);o.forEach((u,f)=>{(f==="length"||f===oa||!Xi(f)&&f>=c)&&a(u)})}else switch((t!==void 0||o.has(void 0))&&a(o.get(t)),l&&a(o.get(oa)),e){case"add":h?l&&a(o.get("length")):(a(o.get(mr)),so(i)&&a(o.get(Ru)));break;case"delete":h||(a(o.get(mr)),so(i)&&a(o.get(Ru)));break;case"set":so(i)&&a(o.get(mr));break}}Ld()}function Vx(i,e){const t=_l.get(i);return t&&t.get(e)}function Or(i){const e=Tt(i);return e===i?e:(yi(e,"iterate",oa),Vi(i)?e:e.map(ms))}function vh(i){return yi(i=Tt(i),"iterate",oa),i}function Os(i,e){return wn(i)?po(gn(i)?ms(e):e):ms(e)}const Xx={__proto__:null,[Symbol.iterator](){return jh(this,Symbol.iterator,i=>Os(this,i))},concat(...i){return Or(this).concat(...i.map(e=>tt(e)?Or(e):e))},entries(){return jh(this,"entries",i=>(i[1]=Os(this,i[1]),i))},every(i,e){return en(this,"every",i,e,void 0,arguments)},filter(i,e){return en(this,"filter",i,e,t=>t.map(s=>Os(this,s)),arguments)},find(i,e){return en(this,"find",i,e,t=>Os(this,t),arguments)},findIndex(i,e){return en(this,"findIndex",i,e,void 0,arguments)},findLast(i,e){return en(this,"findLast",i,e,t=>Os(this,t),arguments)},findLastIndex(i,e){return en(this,"findLastIndex",i,e,void 0,arguments)},forEach(i,e){return en(this,"forEach",i,e,void 0,arguments)},includes(...i){return Hh(this,"includes",i)},indexOf(...i){return Hh(this,"indexOf",i)},join(i){return Or(this).join(i)},lastIndexOf(...i){return Hh(this,"lastIndexOf",i)},map(i,e){return en(this,"map",i,e,void 0,arguments)},pop(){return Io(this,"pop")},push(...i){return Io(this,"push",i)},reduce(i,...e){return _f(this,"reduce",i,e)},reduceRight(i,...e){return _f(this,"reduceRight",i,e)},shift(){return Io(this,"shift")},some(i,e){return en(this,"some",i,e,void 0,arguments)},splice(...i){return Io(this,"splice",i)},toReversed(){return Or(this).toReversed()},toSorted(i){return Or(this).toSorted(i)},toSpliced(...i){return Or(this).toSpliced(...i)},unshift(...i){return Io(this,"unshift",i)},values(){return jh(this,"values",i=>Os(this,i))}};function jh(i,e,t){const s=vh(i),n=s[e]();return s!==i&&!Vi(i)&&(n._next=n.next,n.next=()=>{const r=n._next();return r.done||(r.value=t(r.value)),r}),n}const Yx=Array.prototype;function en(i,e,t,s,n,r){const o=vh(i),a=o!==i&&!Vi(i),h=o[e];if(h!==Yx[e]){const u=h.apply(i,r);return a?ms(u):u}let l=t;o!==i&&(a?l=function(u,f){return t.call(this,Os(i,u),f,i)}:t.length>2&&(l=function(u,f){return t.call(this,u,f,i)}));const c=h.call(o,l,s);return a&&n?n(c):c}function _f(i,e,t,s){const n=vh(i),r=n!==i&&!Vi(i);let o=t,a=!1;n!==i&&(r?(a=s.length===0,o=function(l,c,u){return a&&(a=!1,l=Os(i,l)),t.call(this,l,Os(i,c),u,i)}):t.length>3&&(o=function(l,c,u){return t.call(this,l,c,u,i)}));const h=n[e](o,...s);return a?Os(i,h):h}function Hh(i,e,t){const s=Tt(i);yi(s,"iterate",oa);const n=s[e](...t);return(n===-1||n===!1)&&yh(t[0])?(t[0]=Tt(t[0]),s[e](...t)):n}function Io(i,e,t=[]){xn(),Bd();const s=Tt(i)[e].apply(i,t);return Ld(),bn(),s}const $x=kd("__proto__,__v_isRef,__isVue"),jg=new Set(Object.getOwnPropertyNames(Symbol).filter(i=>i!=="arguments"&&i!=="caller").map(i=>Symbol[i]).filter(Xi));function Gx(i){Xi(i)||(i=String(i));const e=Tt(this);return yi(e,"has",i),e.hasOwnProperty(i)}class Hg{constructor(e=!1,t=!1){this._isReadonly=e,this._isShallow=t}get(e,t,s){if(t==="__v_skip")return e.__v_skip;const n=this._isReadonly,r=this._isShallow;if(t==="__v_isReactive")return!n;if(t==="__v_isReadonly")return n;if(t==="__v_isShallow")return r;if(t==="__v_raw")return s===(n?r?e1:Kg:r?qg:zg).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(s)?e:void 0;const o=tt(e);if(!n){let h;if(o&&(h=Xx[t]))return h;if(t==="hasOwnProperty")return Gx}const a=Reflect.get(e,t,Kt(e)?e:s);if((Xi(t)?jg.has(t):$x(t))||(n||yi(e,"get",t),r))return a;if(Kt(a)){const h=o&&fh(t)?a:a.value;return n&&Ft(h)?ku(h):h}return Ft(a)?n?ku(a):wo(a):a}}class Wg extends Hg{constructor(e=!1){super(!1,e)}set(e,t,s,n){let r=e[t];const o=tt(e)&&fh(t);if(!this._isShallow){const l=wn(r);if(!Vi(s)&&!wn(s)&&(r=Tt(r),s=Tt(s)),!o&&Kt(r)&&!Kt(s))return l||(r.value=s),!0}const a=o?Number(t)<e.length:Rt(e,t),h=Reflect.set(e,t,s,Kt(e)?e:n);return e===Tt(n)&&h&&(a?Ds(s,r)&&cn(e,"set",t,s):cn(e,"add",t,s)),h}deleteProperty(e,t){const s=Rt(e,t);e[t];const n=Reflect.deleteProperty(e,t);return n&&s&&cn(e,"delete",t,void 0),n}has(e,t){const s=Reflect.has(e,t);return(!Xi(t)||!jg.has(t))&&yi(e,"has",t),s}ownKeys(e){return yi(e,"iterate",tt(e)?"length":mr),Reflect.ownKeys(e)}}class jx extends Hg{constructor(e=!1){super(!0,e)}set(e,t){return!0}deleteProperty(e,t){return!0}}const Hx=new Wg,Wx=new jx,zx=new Wg(!0);const Pu=i=>i,Ia=i=>Reflect.getPrototypeOf(i);function qx(i,e,t){return function(...s){const n=this.__v_raw,r=Tt(n),o=so(r),a=i==="entries"||i===Symbol.iterator&&o,h=i==="keys"&&o,l=n[i](...s),c=t?Pu:e?po:ms;return!e&&yi(r,"iterate",h?Ru:mr),mi(Object.create(l),{next(){const{value:u,done:f}=l.next();return f?{value:u,done:f}:{value:a?[c(u[0]),c(u[1])]:c(u),done:f}}})}}function Ra(i){return function(...e){return i==="delete"?!1:i==="clear"?void 0:this}}function Kx(i,e){const t={get(n){const r=this.__v_raw,o=Tt(r),a=Tt(n);i||(Ds(n,a)&&yi(o,"get",n),yi(o,"get",a));const{has:h}=Ia(o),l=e?Pu:i?po:ms;if(h.call(o,n))return l(r.get(n));if(h.call(o,a))return l(r.get(a));r!==o&&r.get(n)},get size(){const n=this.__v_raw;return!i&&yi(Tt(n),"iterate",mr),n.size},has(n){const r=this.__v_raw,o=Tt(r),a=Tt(n);return i||(Ds(n,a)&&yi(o,"has",n),yi(o,"has",a)),n===a?r.has(n):r.has(n)||r.has(a)},forEach(n,r){const o=this,a=o.__v_raw,h=Tt(a),l=e?Pu:i?po:ms;return!i&&yi(h,"iterate",mr),a.forEach((c,u)=>n.call(r,l(c),l(u),o))}};return mi(t,i?{add:Ra("add"),set:Ra("set"),delete:Ra("delete"),clear:Ra("clear")}:{add(n){const r=Tt(this),o=Ia(r),a=Tt(n),h=!e&&!Vi(n)&&!wn(n)?a:n;return o.has.call(r,h)||Ds(n,h)&&o.has.call(r,n)||Ds(a,h)&&o.has.call(r,a)||(r.add(h),cn(r,"add",h,h)),this},set(n,r){!e&&!Vi(r)&&!wn(r)&&(r=Tt(r));const o=Tt(this),{has:a,get:h}=Ia(o);let l=a.call(o,n);l||(n=Tt(n),l=a.call(o,n));const c=h.call(o,n);return o.set(n,r),l?Ds(r,c)&&cn(o,"set",n,r):cn(o,"add",n,r),this},delete(n){const r=Tt(this),{has:o,get:a}=Ia(r);let h=o.call(r,n);h||(n=Tt(n),h=o.call(r,n)),a&&a.call(r,n);const l=r.delete(n);return h&&cn(r,"delete",n,void 0),l},clear(){const n=Tt(this),r=n.size!==0,o=n.clear();return r&&cn(n,"clear",void 0,void 0),o}}),["keys","values","entries",Symbol.iterator].forEach(n=>{t[n]=qx(n,i,e)}),t}function Ud(i,e){const t=Kx(i,e);return(s,n,r)=>n==="__v_isReactive"?!i:n==="__v_isReadonly"?i:n==="__v_raw"?s:Reflect.get(Rt(t,n)&&n in s?t:s,n,r)}const Zx={get:Ud(!1,!1)},Jx={get:Ud(!1,!0)},Qx={get:Ud(!0,!1)};const zg=new WeakMap,qg=new WeakMap,Kg=new WeakMap,e1=new WeakMap;function t1(i){switch(i){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function wo(i){return wn(i)?i:Vd(i,!1,Hx,Zx,zg)}function i1(i){return Vd(i,!1,zx,Jx,qg)}function ku(i){return Vd(i,!0,Wx,Qx,Kg)}function Vd(i,e,t,s,n){if(!Ft(i)||i.__v_raw&&!(e&&i.__v_isReactive)||i.__v_skip||!Object.isExtensible(i))return i;const r=n.get(i);if(r)return r;const o=t1(Ax(i));if(o===0)return i;const a=new Proxy(i,o===2?s:t);return n.set(i,a),a}function gn(i){return wn(i)?gn(i.__v_raw):!!(i&&i.__v_isReactive)}function wn(i){return!!(i&&i.__v_isReadonly)}function Vi(i){return!!(i&&i.__v_isShallow)}function yh(i){return i?!!i.__v_raw:!1}function Tt(i){const e=i&&i.__v_raw;return e?Tt(e):i}function $n(i){return!Rt(i,"__v_skip")&&Object.isExtensible(i)&&Rg(i,"__v_skip",!0),i}const ms=i=>Ft(i)?wo(i):i,po=i=>Ft(i)?ku(i):i;function Kt(i){return i?i.__v_isRef===!0:!1}function it(i){return s1(i,!1)}function s1(i,e){return Kt(i)?i:new n1(i,e)}class n1{constructor(e,t){this.dep=new Nd,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=t?e:Tt(e),this._value=t?e:ms(e),this.__v_isShallow=t}get value(){return this.dep.track(),this._value}set value(e){const t=this._rawValue,s=this.__v_isShallow||Vi(e)||wn(e);e=s?e:Tt(e),Ds(e,t)&&(this._rawValue=e,this._value=s?e:ms(e),this.dep.trigger())}}function Pe(i){return Kt(i)?i.value:i}const r1={get:(i,e,t)=>e==="__v_raw"?i:Pe(Reflect.get(i,e,t)),set:(i,e,t,s)=>{const n=i[e];return Kt(n)&&!Kt(t)?(n.value=t,!0):Reflect.set(i,e,t,s)}};function Zg(i){return gn(i)?i:new Proxy(i,r1)}function o1(i){const e=tt(i)?new Array(i.length):{};for(const t in i)e[t]=l1(i,t);return e}class a1{constructor(e,t,s){this._object=e,this._defaultValue=s,this.__v_isRef=!0,this._value=void 0,this._key=Xi(t)?t:String(t),this._raw=Tt(e);let n=!0,r=e;if(!tt(e)||Xi(this._key)||!fh(this._key))do n=!yh(r)||Vi(r);while(n&&(r=r.__v_raw));this._shallow=n}get value(){let e=this._object[this._key];return this._shallow&&(e=Pe(e)),this._value=e===void 0?this._defaultValue:e}set value(e){if(this._shallow&&Kt(this._raw[this._key])){const t=this._object[this._key];if(Kt(t)){t.value=e;return}}this._object[this._key]=e}get dep(){return Vx(this._raw,this._key)}}function l1(i,e,t){return new a1(i,e,t)}class h1{constructor(e,t,s){this.fn=e,this.setter=t,this._value=void 0,this.dep=new Nd(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=ra-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!t,this.isSSR=s}notify(){if(this.flags|=16,!(this.flags&8)&&Dt!==this)return Ug(this,!0),!0}get value(){const e=this.dep.track();return Yg(this),e&&(e.version=this.dep.version),this._value}set value(e){this.setter&&this.setter(e)}}function c1(i,e,t=!1){let s,n;return at(i)?s=i:(s=i.get,n=i.set),new h1(s,n,t)}const Pa={},Sl=new WeakMap;let lr;function u1(i,e=!1,t=lr){if(t){let s=Sl.get(t);s||Sl.set(t,s=[]),s.push(i)}}function d1(i,e,t=Ot){const{immediate:s,deep:n,once:r,scheduler:o,augmentJob:a,call:h}=t,l=S=>n?S:Vi(S)||n===!1||n===0?un(S,1):un(S);let c,u,f,d,m=!1,g=!1;if(Kt(i)?(u=()=>i.value,m=Vi(i)):gn(i)?(u=()=>l(i),m=!0):tt(i)?(g=!0,m=i.some(S=>gn(S)||Vi(S)),u=()=>i.map(S=>{if(Kt(S))return S.value;if(gn(S))return l(S);if(at(S))return h?h(S,2):S()})):at(i)?e?u=h?()=>h(i,2):i:u=()=>{if(f){xn();try{f()}finally{bn()}}const S=lr;lr=c;try{return h?h(i,3,[d]):i(d)}finally{lr=S}}:u=Ys,e&&n){const S=u,y=n===!0?1/0:n;u=()=>un(S(),y)}const b=Lg(),_=()=>{c.stop(),b&&b.active&&Fd(b.effects,c)};if(r&&e){const S=e;e=(...y)=>{const I=S(...y);return _(),I}}let M=g?new Array(i.length).fill(Pa):Pa;const v=S=>{if(!(!(c.flags&1)||!c.dirty&&!S))if(e){const y=c.run();if(S||n||m||(g?y.some((I,E)=>Ds(I,M[E])):Ds(y,M))){f&&f();const I=lr;lr=c;try{const E=[y,M===Pa?void 0:g&&M[0]===Pa?[]:M,d];M=y,h?h(e,3,E):e(...E)}finally{lr=I}}}else c.run()};return a&&a(v),c=new Dg(u),c.scheduler=o?()=>o(v,!1):v,d=S=>u1(S,!1,c),f=c.onStop=()=>{const S=Sl.get(c);if(S){if(h)h(S,4);else for(const y of S)y();Sl.delete(c)}},e?s?v(!0):M=c.run():o?o(v.bind(null,!0),!0):c.run(),_.pause=c.pause.bind(c),_.resume=c.resume.bind(c),_.stop=_,_}function un(i,e=1/0,t){if(e<=0||!Ft(i)||i.__v_skip||(t=t||new Map,(t.get(i)||0)>=e))return i;if(t.set(i,e),e--,Kt(i))un(i.value,e,t);else if(tt(i))for(let s=0;s<i.length;s++)un(i[s],e,t);else if(xo(i)||so(i))i.forEach(s=>{un(s,e,t)});else if(Cg(i)){for(const s in i)un(i[s],e,t);for(const s of Object.getOwnPropertySymbols(i))Object.prototype.propertyIsEnumerable.call(i,s)&&un(i[s],e,t)}return i}/**
|
||
* @vue/runtime-core v3.5.41
|
||
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
||
* @license MIT
|
||
**/function ba(i,e,t,s){try{return s?i(...s):i()}catch(n){xh(n,e,t)}}function gs(i,e,t,s){if(at(i)){const n=ba(i,e,t,s);return n&&Eg(n)&&n.catch(r=>{xh(r,e,t)}),n}if(tt(i)){const n=[];for(let r=0;r<i.length;r++)n.push(gs(i[r],e,t,s));return n}}function xh(i,e,t,s=!0){const n=e?e.vnode:null,{errorHandler:r,throwUnhandledErrorInProduction:o}=e&&e.appContext.config||Ot;if(e){let a=e.parent;const h=e.proxy,l=`https://vuejs.org/error-reference/#runtime-${t}`;for(;a;){const c=a.ec;if(c){for(let u=0;u<c.length;u++)if(c[u](i,h,l)===!1)return}a=a.parent}if(r){xn(),ba(r,null,10,[i,h,l]),bn();return}}f1(i,t,n,s,o)}function f1(i,e,t,s=!0,n=!1){if(n)throw i;console.error(i)}const Si=[];let Rs=-1;const no=[];let On=null,Gr=0;const Jg=Promise.resolve();let Tl=null;function Xd(i){const e=Tl||Jg;return i?e.then(this?i.bind(this):i):e}function p1(i){let e=Rs+1,t=Si.length;for(;e<t;){const s=e+t>>>1,n=Si[s],r=aa(n);r<i||r===i&&n.flags&2?e=s+1:t=s}return e}function Yd(i){if(!(i.flags&1)){const e=aa(i),t=Si[Si.length-1];!t||!(i.flags&2)&&e>=aa(t)?Si.push(i):Si.splice(p1(e),0,i),i.flags|=1,Qg()}}function Qg(){Tl||(Tl=Jg.then(t0))}function m1(i){if(!tt(i))On&&i.id===-1?On.splice(Gr+1,0,i):i.flags&1||(no.push(i),i.flags|=1);else for(let e=0;e<i.length;e++)no.push(i[e]);Qg()}function Sf(i,e,t=Rs+1){for(;t<Si.length;t++){const s=Si[t];if(s&&s.flags&2){if(i&&s.id!==i.uid)continue;Si.splice(t,1),t--,s.flags&4&&(s.flags&=-2),s(),s.flags&4||(s.flags&=-2)}}}function e0(i){if(no.length){const e=[...new Set(no)].sort((t,s)=>aa(t)-aa(s));if(no.length=0,On){for(let t=0;t<e.length;t++)On.push(e[t]);return}for(On=e,Gr=0;Gr<On.length;Gr++){const t=On[Gr];t.flags&4&&(t.flags&=-2),t.flags&8||t(),t.flags&=-2}On=null,Gr=0}}const aa=i=>i.id==null?i.flags&2?-1:1/0:i.id;function t0(i){try{for(Rs=0;Rs<Si.length;Rs++){const e=Si[Rs];e&&!(e.flags&8)&&(e.flags&4&&(e.flags&=-2),ba(e,e.i,e.i?15:14),e.flags&4||(e.flags&=-2))}}finally{for(;Rs<Si.length;Rs++){const e=Si[Rs];e&&(e.flags&=-2)}Rs=-1,Si.length=0,e0(),Tl=null,(Si.length||no.length)&&t0()}}let bi=null,i0=null;function Ml(i){const e=bi;return bi=i,i0=i&&i.type.__scopeId||null,e}function Fu(i,e=bi,t){if(!e||i._n)return i;const s=(...n)=>{s._d&&Of(-1);const r=Ml(e),o=vn.length;let a;try{a=i(...n)}finally{for(let h=vn.length;h>o;h--)zd();Ml(r),s._d&&Of(1)}return a};return s._n=!0,s._c=!0,s._d=!0,s}function xe(i,e){if(bi===null)return i;const t=Th(bi),s=i.dirs||(i.dirs=[]);for(let n=0;n<e.length;n++){let[r,o,a,h=Ot]=e[n];r&&(at(r)&&(r={mounted:r,updated:r}),r.deep&&un(o),s.push({dir:r,instance:t,value:o,oldValue:void 0,arg:a,modifiers:h}))}return i}function sr(i,e,t,s){const n=i.dirs,r=e&&e.dirs;for(let o=0;o<n.length;o++){const a=n[o];r&&(a.oldValue=r[o].value);let h=a.dir[s];h&&(xn(),gs(h,t,8,[i.el,a,i,e]),bn())}}function g1(i,e){if(Ti){let t=Ti.provides;const s=Ti.parent&&Ti.parent.provides;s===t&&(t=Ti.provides=Object.create(s)),t[i]=e}}function Qo(i,e,t=!1){const s=C0();if(s||gr){let n=gr?gr._context.provides:s?s.parent==null||s.ce?s.vnode.appContext&&s.vnode.appContext.provides:s.parent.provides:void 0;if(n&&i in n)return n[i];if(arguments.length>1)return t&&at(e)?e.call(s&&s.proxy):e}}function v1(){return!!(C0()||gr)}const y1=Symbol.for("v-scx"),x1=()=>Qo(y1);function No(i,e){return $d(i,null,e)}function cs(i,e,t){return $d(i,e,t)}function $d(i,e,t=Ot){const{immediate:s,deep:n,flush:r,once:o}=t,a=mi({},t),h=e&&s||!e&&r!=="post";let l;if(ca){if(r==="sync"){const d=x1();l=d.__watcherHandles||(d.__watcherHandles=[])}else if(!h){const d=()=>{};return d.stop=Ys,d.resume=Ys,d.pause=Ys,d}}const c=Ti;a.call=(d,m,g)=>gs(d,c,m,g);let u=!1;r==="post"?a.scheduler=d=>{Ai(d,c&&c.suspense)}:r!=="sync"&&(u=!0,a.scheduler=(d,m)=>{m?d():Yd(d)}),a.augmentJob=d=>{e&&(d.flags|=4),u&&(d.flags|=2,c&&(d.id=c.uid,d.i=c))};const f=d1(i,e,a);return ca&&(l?l.push(f):h&&f()),f}function b1(i,e,t){const s=this.proxy,n=qt(i)?i.includes(".")?s0(s,i):()=>s[i]:i.bind(s,s);let r;at(e)?r=e:(r=e.handler,t=e);const o=_a(this),a=$d(n,r.bind(s),t);return o(),a}function s0(i,e){const t=e.split(".");return()=>{let s=i;for(let n=0;n<t.length&&s;n++)s=s[t[n]];return s}}const w1=Symbol("_vte"),bh=i=>i.__isTeleport,Wh=Symbol("_leaveCb");function _1(i){let e=i[0];if(i.length>1){for(const t of i)if(t.type!==js){e=t;break}}return e}function n0(i){if(!jd(i))return bh(i.type)&&i.children?_1(i.children):i;if(i.component)return i.component.subTree;const{shapeFlag:e,children:t}=i;if(t){if(e&16)return t[0];if(e&32&&at(t.default))return t.default()}}function Gd(i,e){if(i.shapeFlag&6&&i.component){i.transition=e;const t=i.component.subTree;Gd(bh(t.type)&&n0(t)||t,e)}else i.shapeFlag&128?(i.ssContent.transition=e.clone(i.ssContent),i.ssFallback.transition=e.clone(i.ssFallback)):i.transition=e}function Ws(i,e){return at(i)?mi({name:i.name},e,{setup:i}):i}function r0(i){i.ids=[i.ids[0]+i.ids[2]+++"-",0,0]}function Tf(i,e){let t;return!!((t=Object.getOwnPropertyDescriptor(i,e))&&!t.configurable)}const El=new WeakMap;function ea(i,e,t,s,n=!1){if(tt(i)){i.forEach((g,b)=>ea(g,e&&(tt(e)?e[b]:e),t,s,n));return}if(ro(s)&&!n){s.shapeFlag&512&&s.type.__asyncResolved&&s.component.subTree.component&&ea(i,e,t,s.component.subTree);return}const r=s.shapeFlag&4?Th(s.component):s.el,o=n?null:r,{i:a,r:h}=i,l=e&&e.r,c=a.refs===Ot?a.refs={}:a.refs,u=a.setupState,f=Tt(u),d=u===Ot?Mg:g=>Tf(c,g)?!1:Rt(f,g),m=(g,b)=>!(b&&Tf(c,b));if(l!=null&&l!==h){if(Mf(e),qt(l))c[l]=null,d(l)&&(u[l]=null);else if(Kt(l)){const g=e;m(l,g.k)&&(l.value=null),g.k&&(c[g.k]=null)}}if(at(h))ba(h,a,12,[o,c]);else{const g=qt(h),b=Kt(h);if(g||b){const _=()=>{if(i.f){const M=g?d(h)?u[h]:c[h]:m()||!i.k?h.value:c[i.k];if(n)tt(M)&&Fd(M,r);else if(tt(M))M.includes(r)||M.push(r);else if(g)c[h]=[r],d(h)&&(u[h]=c[h]);else{const v=[r];m(h,i.k)&&(h.value=v),i.k&&(c[i.k]=v)}}else g?(c[h]=o,d(h)&&(u[h]=o)):b&&(m(h,i.k)&&(h.value=o),i.k&&(c[i.k]=o))};if(o){const M=()=>{_(),El.delete(i)};M.id=-1,El.set(i,M),Ai(M,t)}else Mf(i),_()}}}function Mf(i){const e=El.get(i);e&&(e.flags|=8,El.delete(i))}gh().requestIdleCallback;gh().cancelIdleCallback;const ro=i=>!!i.type.__asyncLoader,jd=i=>i.type.__isKeepAlive;function S1(i,e){o0(i,"a",e)}function T1(i,e){o0(i,"da",e)}function o0(i,e,t=Ti){const s=i.__wdc||(i.__wdc=()=>{let n=t;for(;n;){if(n.isDeactivated)return;n=n.parent}return i()});if(wh(e,s,t),t){let n=t.parent;for(;n&&n.parent;)jd(n.parent.vnode)&&M1(s,e,t,n),n=n.parent}}function M1(i,e,t,s){const n=wh(e,i,s,!0);wa(()=>{Fd(s[e],n)},t)}function wh(i,e,t=Ti,s=!1){if(t){const n=t[i]||(t[i]=[]),r=e.__weh||(e.__weh=(...o)=>{xn();const a=_a(t),h=gs(e,t,i,o);return a(),bn(),h});return s?n.unshift(r):n.push(r),r}}const Tn=i=>(e,t=Ti)=>{(!ca||i==="sp")&&wh(i,(...s)=>e(...s),t)},E1=Tn("bm"),_o=Tn("m"),A1=Tn("bu"),C1=Tn("u"),a0=Tn("bum"),wa=Tn("um"),I1=Tn("sp"),R1=Tn("rtg"),P1=Tn("rtc");function k1(i,e=Ti){wh("ec",i,e)}const F1=Symbol.for("v-ndc");function Ht(i,e,t,s){let n;const r=t,o=tt(i);if(o||qt(i)){const a=o&&gn(i);let h=!1,l=!1;a&&(h=!Vi(i),l=wn(i),i=vh(i)),n=new Array(i.length);for(let c=0,u=i.length;c<u;c++)n[c]=e(h?l?po(ms(i[c])):ms(i[c]):i[c],c,void 0,r)}else if(typeof i=="number"){n=new Array(i);for(let a=0;a<i;a++)n[a]=e(a+1,a,void 0,r)}else if(Ft(i))if(i[Symbol.iterator])n=Array.from(i,(a,h)=>e(a,h,void 0,r));else{const a=Object.keys(i);n=new Array(a.length);for(let h=0,l=a.length;h<l;h++){const c=a[h];n[h]=e(i[c],c,h,r)}}else n=[];return n}function O1(i,e,t,s,n,r){if(t==null&&(t={}),bi.ce||bi.parent&&ro(bi.parent)&&bi.parent.ce){const l=t,c=Object.keys(l).length>0;return se(),Et(qe,null,[Ne("slot",l,s)],c?-2:64)}let o=i[e];o&&o._c&&(o._d=!1);const a=vn.length;se();let h;try{const l=o&&l0(o(t)),c=t.key||r||l&&l.key;h=Et(qe,{key:(c&&!Xi(c)?c:`_${e}`)+(!l&&s?"_fb":"")},l||(s?s():[]),l&&i._===1?64:-2)}catch(l){for(let c=vn.length;c>a;c--)zd();throw l}finally{o&&o._c&&(o._d=!0)}return h}function l0(i){return i.some(e=>qd(e)?!(e.type===js||e.type===qe&&!l0(e.children)):!0)?i:null}const Ou=i=>i?I0(i)?Th(i):Ou(i.parent):null,ta=mi(Object.create(null),{$:i=>i,$el:i=>i.vnode.el,$data:i=>i.data,$props:i=>i.props,$attrs:i=>i.attrs,$slots:i=>i.slots,$refs:i=>i.refs,$parent:i=>Ou(i.parent),$root:i=>Ou(i.root),$host:i=>i.ce,$emit:i=>i.emit,$options:i=>c0(i),$forceUpdate:i=>i.f||(i.f=()=>{Yd(i.update)}),$nextTick:i=>i.n||(i.n=Xd.bind(i.proxy)),$watch:i=>b1.bind(i)}),zh=(i,e)=>i!==Ot&&!i.__isScriptSetup&&Rt(i,e),B1={get({_:i},e){if(e==="__v_skip")return!0;const{ctx:t,setupState:s,data:n,props:r,accessCache:o,type:a,appContext:h}=i;if(e[0]!=="$"){const f=o[e];if(f!==void 0)switch(f){case 1:return s[e];case 2:return n[e];case 4:return t[e];case 3:return r[e]}else{if(zh(s,e))return o[e]=1,s[e];if(n!==Ot&&Rt(n,e))return o[e]=2,n[e];if(Rt(r,e))return o[e]=3,r[e];if(t!==Ot&&Rt(t,e))return o[e]=4,t[e];Bu&&(o[e]=0)}}const l=ta[e];let c,u;if(l)return e==="$attrs"&&yi(i.attrs,"get",""),l(i);if((c=a.__cssModules)&&(c=c[e]))return c;if(t!==Ot&&Rt(t,e))return o[e]=4,t[e];if(u=h.config.globalProperties,Rt(u,e))return u[e]},set({_:i},e,t){const{data:s,setupState:n,ctx:r}=i;return zh(n,e)?(n[e]=t,!0):s!==Ot&&Rt(s,e)?(s[e]=t,!0):Rt(i.props,e)||e[0]==="$"&&e.slice(1)in i?!1:(r[e]=t,!0)},has({_:{data:i,setupState:e,accessCache:t,ctx:s,appContext:n,props:r,type:o}},a){let h;return!!(t[a]||i!==Ot&&a[0]!=="$"&&Rt(i,a)||zh(e,a)||Rt(r,a)||Rt(s,a)||Rt(ta,a)||Rt(n.config.globalProperties,a)||(h=o.__cssModules)&&h[a])},defineProperty(i,e,t){return t.get!=null?i._.accessCache[e]=0:Rt(t,"value")&&this.set(i,e,t.value,null),Reflect.defineProperty(i,e,t)}};function Ef(i){return tt(i)?i.reduce((e,t)=>(e[t]=null,e),{}):i}let Bu=!0;function L1(i){const e=c0(i),t=i.proxy,s=i.ctx;Bu=!1,e.beforeCreate&&Af(e.beforeCreate,i,"bc");const{data:n,computed:r,methods:o,watch:a,provide:h,inject:l,created:c,beforeMount:u,mounted:f,beforeUpdate:d,updated:m,activated:g,deactivated:b,beforeDestroy:_,beforeUnmount:M,destroyed:v,unmounted:S,render:y,renderTracked:I,renderTriggered:E,errorCaptured:C,serverPrefetch:R,expose:B,inheritAttrs:k,components:F,directives:D,filters:N}=e;if(l&&D1(l,s,null),o)for(const L in o){const P=o[L];at(P)&&(s[L]=P.bind(t))}if(n){const L=n.call(t,t);Ft(L)&&(i.data=wo(L))}if(Bu=!0,r)for(const L in r){const P=r[L],X=at(P)?P.bind(t,t):at(P.get)?P.get.bind(t,t):Ys,U=!at(P)&&at(P.set)?P.set.bind(t):Ys,Y=ut({get:X,set:U});Object.defineProperty(s,L,{enumerable:!0,configurable:!0,get:()=>Y.value,set:q=>Y.value=q})}if(a)for(const L in a)h0(a[L],s,t,L);if(h){const L=at(h)?h.call(t):h;Reflect.ownKeys(L).forEach(P=>{g1(P,L[P])})}c&&Af(c,i,"c");function O(L,P){tt(P)?P.forEach(X=>L(X.bind(t))):P&&L(P.bind(t))}if(O(E1,u),O(_o,f),O(A1,d),O(C1,m),O(S1,g),O(T1,b),O(k1,C),O(P1,I),O(R1,E),O(a0,M),O(wa,S),O(I1,R),tt(B))if(B.length){const L=i.exposed||(i.exposed={});B.forEach(P=>{Object.defineProperty(L,P,{get:()=>t[P],set:X=>t[P]=X,enumerable:!0})})}else i.exposed||(i.exposed={});y&&i.render===Ys&&(i.render=y),k!=null&&(i.inheritAttrs=k),F&&(i.components=F),D&&(i.directives=D),R&&r0(i)}function D1(i,e,t=Ys){tt(i)&&(i=Lu(i));for(const s in i){const n=i[s];let r;Ft(n)?"default"in n?r=Qo(n.from||s,n.default,!0):r=Qo(n.from||s):r=Qo(n),Kt(r)?Object.defineProperty(e,s,{enumerable:!0,configurable:!0,get:()=>r.value,set:o=>r.value=o}):e[s]=r}}function Af(i,e,t){gs(tt(i)?i.map(s=>s.bind(e.proxy)):i.bind(e.proxy),e,t)}function h0(i,e,t,s){let n=s.includes(".")?s0(t,s):()=>t[s];if(qt(i)){const r=e[i];at(r)&&cs(n,r)}else if(at(i))cs(n,i.bind(t));else if(Ft(i))if(tt(i))i.forEach(r=>h0(r,e,t,s));else{const r=at(i.handler)?i.handler.bind(t):e[i.handler];at(r)&&cs(n,r,i)}}function c0(i){const e=i.type,{mixins:t,extends:s}=e,{mixins:n,optionsCache:r,config:{optionMergeStrategies:o}}=i.appContext,a=r.get(e);let h;return a?h=a:!n.length&&!t&&!s?h=e:(h={},n.length&&n.forEach(l=>Al(h,l,o,!0)),Al(h,e,o)),Ft(e)&&r.set(e,h),h}function Al(i,e,t,s=!1){const{mixins:n,extends:r}=e;r&&Al(i,r,t,!0),n&&n.forEach(o=>Al(i,o,t,!0));for(const o in e)if(!(s&&o==="expose")){const a=N1[o]||t&&t[o];i[o]=a?a(i[o],e[o]):e[o]}return i}const N1={data:Cf,props:If,emits:If,methods:Uo,computed:Uo,beforeCreate:_i,created:_i,beforeMount:_i,mounted:_i,beforeUpdate:_i,updated:_i,beforeDestroy:_i,beforeUnmount:_i,destroyed:_i,unmounted:_i,activated:_i,deactivated:_i,errorCaptured:_i,serverPrefetch:_i,components:Uo,directives:Uo,watch:V1,provide:Cf,inject:U1};function Cf(i,e){return e?i?function(){return mi(at(i)?i.call(this,this):i,at(e)?e.call(this,this):e)}:e:i}function U1(i,e){return Uo(Lu(i),Lu(e))}function Lu(i){if(tt(i)){const e={};for(let t=0;t<i.length;t++)e[i[t]]=i[t];return e}return i}function _i(i,e){return i?[...new Set([].concat(i,e))]:e}function Uo(i,e){return i?mi(Object.create(null),i,e):e}function If(i,e){return i?tt(i)&&tt(e)?[...new Set([...i,...e])]:mi(Object.create(null),Ef(i),Ef(e??{})):e}function V1(i,e){if(!i)return e;if(!e)return i;const t=mi(Object.create(null),i);for(const s in e)t[s]=_i(i[s],e[s]);return t}function u0(){return{app:null,config:{isNativeTag:Mg,performance:!1,globalProperties:{},optionMergeStrategies:{},errorHandler:void 0,warnHandler:void 0,compilerOptions:{}},mixins:[],components:{},directives:{},provides:Object.create(null),optionsCache:new WeakMap,propsCache:new WeakMap,emitsCache:new WeakMap}}let X1=0;function Y1(i,e){return function(s,n=null){at(s)||(s=mi({},s)),n!=null&&!Ft(n)&&(n=null);const r=u0(),o=new WeakSet,a=[];let h=!1;const l=r.app={_uid:X1++,_component:s,_props:n,_container:null,_context:r,_instance:null,version:yb,get config(){return r.config},set config(c){},use(c,...u){return o.has(c)||(c&&at(c.install)?(o.add(c),c.install(l,...u)):at(c)&&(o.add(c),c(l,...u))),l},mixin(c){return r.mixins.includes(c)||r.mixins.push(c),l},component(c,u){return u?(r.components[c]=u,l):r.components[c]},directive(c,u){return u?(r.directives[c]=u,l):r.directives[c]},mount(c,u,f){if(!h){const d=l._ceVNode||Ne(s,n);return d.appContext=r,f===!0?f="svg":f===!1&&(f=void 0),i(d,c,f),h=!0,l._container=c,c.__vue_app__=l,Th(d.component)}},onUnmount(c){a.push(c)},unmount(){h&&(gs(a,l._instance,16),i(null,l._container),delete l._container.__vue_app__)},provide(c,u){return r.provides[c]=u,l},runWithContext(c){const u=gr;gr=l;try{return c()}finally{gr=u}}};return l}}let gr=null;const $1=(i,e)=>e==="modelValue"||e==="model-value"?i.modelModifiers:i[`${e}Modifiers`]||i[`${ls(e)}Modifiers`]||i[`${Jn(e)}Modifiers`];function G1(i,e,...t){if(i.isUnmounted)return;const s=i.vnode.props||Ot;let n=t;const r=e.startsWith("update:"),o=r&&$1(s,e.slice(7));o&&(o.trim&&(n=t.map(c=>qt(c)?c.trim():c)),o.number&&(n=t.map(mh)));let a,h=s[a=Yh(e)]||s[a=Yh(ls(e))];!h&&r&&(h=s[a=Yh(Jn(e))]),h&&gs(h,i,6,n);const l=s[a+"Once"];if(l){if(!i.emitted)i.emitted={};else if(i.emitted[a])return;i.emitted[a]=!0,gs(l,i,6,n)}}const j1=new WeakMap;function d0(i,e,t=!1){const s=t?j1:e.emitsCache,n=s.get(i);if(n!==void 0)return n;const r=i.emits;let o={},a=!1;if(!at(i)){const h=l=>{const c=d0(l,e,!0);c&&(a=!0,mi(o,c))};!t&&e.mixins.length&&e.mixins.forEach(h),i.extends&&h(i.extends),i.mixins&&i.mixins.forEach(h)}return!r&&!a?(Ft(i)&&s.set(i,null),null):(tt(r)?r.forEach(h=>o[h]=null):mi(o,r),Ft(i)&&s.set(i,o),o)}function _h(i,e){return!i||!uh(e)?!1:(e=e.slice(2),e=e==="Once"?e:e.replace(/Once$/,""),Rt(i,e[0].toLowerCase()+e.slice(1))||Rt(i,Jn(e))||Rt(i,e))}function Rf(i){const{type:e,vnode:t,proxy:s,withProxy:n,propsOptions:[r],slots:o,attrs:a,emit:h,render:l,renderCache:c,props:u,data:f,setupState:d,ctx:m,inheritAttrs:g}=i,b=Ml(i);let _,M;try{if(t.shapeFlag&4){const S=n||s,y=S;_=Bs(l.call(y,S,c,u,d,f,m)),M=a}else{const S=e;_=Bs(S.length>1?S(u,{attrs:a,slots:o,emit:h}):S(u,null)),M=e.props?a:H1(a)}}catch(S){vn.length=0,xh(S,i,1),_=Ne(js)}let v=_;if(M&&g!==!1){const S=Object.keys(M),{shapeFlag:y}=v;S.length&&y&7&&(r&&S.some(dh)&&(M=W1(M,r)),v=mo(v,M,!1,!0))}if(t.dirs&&(v=mo(v,null,!1,!0),v.dirs=v.dirs?v.dirs.concat(t.dirs):t.dirs),t.transition){const S=bh(v.type)&&n0(v)||v;Gd(S,t.transition)}return _=v,Ml(b),_}const H1=i=>{let e;for(const t in i)(t==="class"||t==="style"||uh(t))&&((e||(e={}))[t]=i[t]);return e},W1=(i,e)=>{const t={};for(const s in i)(!dh(s)||!(s.slice(9)in e))&&(t[s]=i[s]);return t};function z1(i,e,t){const{props:s,children:n,component:r}=i,{props:o,children:a,patchFlag:h}=e,l=r.emitsOptions;if(e.dirs||e.transition)return!0;if(t&&h>=0){if(h&1024)return!0;if(h&16)return s?Pf(s,o,l):!!o;if(h&8){const c=e.dynamicProps;for(let u=0;u<c.length;u++){const f=c[u];if(f0(o,s,f)&&!_h(l,f))return!0}}}else return(n||a)&&(!a||!a.$stable)?!0:s===o?!1:s?o?Pf(s,o,l):!0:!!o;return!1}function Pf(i,e,t){const s=Object.keys(e);if(s.length!==Object.keys(i).length)return!0;for(let n=0;n<s.length;n++){const r=s[n];if(f0(e,i,r)&&!_h(t,r))return!0}return!1}function f0(i,e,t){const s=i[t],n=e[t];return t==="style"&&Ft(s)&&Ft(n)?!bo(s,n):s!==n}function q1({vnode:i,parent:e,suspense:t},s){for(;e;){const n=e.subTree;if(n.suspense&&n.suspense.activeBranch===i&&(n.suspense.vnode.el=n.el=s,i=n),n===i)(i=e.vnode).el=s,e=e.parent;else break}t&&t.activeBranch===i&&(t.vnode.el=s)}const p0={},m0=()=>Object.create(p0),g0=i=>Object.getPrototypeOf(i)===p0;function K1(i,e,t,s=!1){const n={},r=m0();i.propsDefaults=Object.create(null),v0(i,e,n,r);for(const o in i.propsOptions[0])o in n||(n[o]=void 0);t?i.props=s?n:i1(n):i.type.props?i.props=n:i.props=r,i.attrs=r}function Z1(i,e,t,s){const{props:n,attrs:r,vnode:{patchFlag:o}}=i,a=Tt(n),[h]=i.propsOptions;let l=!1;if((s||o>0)&&!(o&16)){if(o&8){const c=i.vnode.dynamicProps;for(let u=0;u<c.length;u++){let f=c[u];if(_h(i.emitsOptions,f))continue;const d=e[f];if(h)if(Rt(r,f))d!==r[f]&&(r[f]=d,l=!0);else{const m=ls(f);n[m]=Du(h,a,m,d,i,!1)}else d!==r[f]&&(r[f]=d,l=!0)}}}else{v0(i,e,n,r)&&(l=!0);let c;for(const u in a)(!e||!Rt(e,u)&&((c=Jn(u))===u||!Rt(e,c)))&&(h?t&&(t[u]!==void 0||t[c]!==void 0)&&(n[u]=Du(h,a,u,void 0,i,!0)):delete n[u]);if(r!==a)for(const u in r)(!e||!Rt(e,u))&&(delete r[u],l=!0)}l&&cn(i.attrs,"set","")}function v0(i,e,t,s){const[n,r]=i.propsOptions;let o=!1,a;if(e)for(let h in e){if(Ko(h))continue;const l=e[h];let c;n&&Rt(n,c=ls(h))?!r||!r.includes(c)?t[c]=l:(a||(a={}))[c]=l:_h(i.emitsOptions,h)||(!(h in s)||l!==s[h])&&(s[h]=l,o=!0)}if(r){const h=Tt(t),l=a||Ot;for(let c=0;c<r.length;c++){const u=r[c];t[u]=Du(n,h,u,l[u],i,!Rt(l,u))}}return o}function Du(i,e,t,s,n,r){const o=i[t];if(o!=null){const a=Rt(o,"default");if(a&&s===void 0){const h=o.default;if(o.type!==Function&&!o.skipFactory&&at(h)){const{propsDefaults:l}=n;if(t in l)s=l[t];else{const c=_a(n);s=l[t]=h.call(null,e),c()}}else s=h;n.ce&&n.ce._setProp(t,s)}o[0]&&(r&&!a?s=!1:o[1]&&(s===""||s===Jn(t))&&(s=!0))}return s}const J1=new WeakMap;function y0(i,e,t=!1){const s=t?J1:e.propsCache,n=s.get(i);if(n)return n;const r=i.props,o={},a=[];let h=!1;if(!at(i)){const c=u=>{h=!0;const[f,d]=y0(u,e,!0);mi(o,f),d&&a.push(...d)};!t&&e.mixins.length&&e.mixins.forEach(c),i.extends&&c(i.extends),i.mixins&&i.mixins.forEach(c)}if(!r&&!h)return Ft(i)&&s.set(i,io),io;if(tt(r))for(let c=0;c<r.length;c++){const u=ls(r[c]);kf(u)&&(o[u]=Ot)}else if(r)for(const c in r){const u=ls(c);if(kf(u)){const f=r[c],d=o[u]=tt(f)||at(f)?{type:f}:mi({},f),m=d.type;let g=!1,b=!0;if(tt(m))for(let _=0;_<m.length;++_){const M=m[_],v=at(M)&&M.name;if(v==="Boolean"){g=!0;break}else v==="String"&&(b=!1)}else g=at(m)&&m.name==="Boolean";d[0]=g,d[1]=b,(g||Rt(d,"default"))&&a.push(u)}}const l=[o,a];return Ft(i)&&s.set(i,l),l}function kf(i){return i[0]!=="$"&&!Ko(i)}const Hd=i=>i==="_"||i==="_ctx"||i==="$stable",Wd=i=>tt(i)?i.map(Bs):[Bs(i)],Q1=(i,e,t)=>{if(e._n)return e;const s=Fu((...n)=>Wd(e(...n)),t);return s._c=!1,s},x0=(i,e,t)=>{const s=i._ctx;for(const n in i){if(Hd(n))continue;const r=i[n];if(at(r))e[n]=Q1(n,r,s);else if(r!=null){const o=Wd(r);e[n]=()=>o}}},b0=(i,e)=>{const t=Wd(e);i.slots.default=()=>t},w0=(i,e,t)=>{for(const s in e)(t||!Hd(s))&&(i[s]=e[s])},eb=(i,e,t)=>{const s=i.slots=m0();if(i.vnode.shapeFlag&32){const n=e._;n?(w0(s,e,t),t&&Rg(s,"_",n,!0)):x0(e,s)}else e&&b0(i,e)},tb=(i,e,t)=>{const{vnode:s,slots:n}=i;let r=!0,o=Ot;if(s.shapeFlag&32){const a=e._;a?t&&a===1?r=!1:w0(n,e,t):(r=!e.$stable,x0(e,n)),o=e}else e&&(b0(i,e),o={default:1});if(r)for(const a in n)!Hd(a)&&o[a]==null&&delete n[a]},Ai=ob;function ib(i){return sb(i)}function sb(i,e){const t=gh();t.__VUE__=!0;const{insert:s,remove:n,patchProp:r,createElement:o,createText:a,createComment:h,setText:l,setElementText:c,parentNode:u,nextSibling:f,setScopeId:d=Ys,insertStaticContent:m}=i,g=($,W,J,Q=null,ie=null,ue=null,Se=void 0,Me=null,Ee=!!W.dynamicChildren)=>{if($===W)return;$&&!Ro($,W)&&(Q=ae($),q($,ie,ue,!0),$=null),W.patchFlag===-2&&(Ee=!1,W.dynamicChildren=null);const{type:de,ref:De,shapeFlag:Ie}=W;switch(de){case Sh:b($,W,J,Q);break;case js:_($,W,J,Q);break;case ul:$==null&&M(W,J,Q,Se);break;case qe:F($,W,J,Q,ie,ue,Se,Me,Ee);break;default:Ie&1?y($,W,J,Q,ie,ue,Se,Me,Ee):Ie&6?D($,W,J,Q,ie,ue,Se,Me,Ee):(Ie&64||Ie&128)&&de.process($,W,J,Q,ie,ue,Se,Me,Ee,te)}De!=null&&ie?ea(De,$&&$.ref,ue,W||$,!W):De==null&&$&&$.ref!=null&&ea($.ref,null,ue,$,!0)},b=($,W,J,Q)=>{if($==null)s(W.el=a(W.children),J,Q);else{const ie=W.el=$.el;W.children!==$.children&&l(ie,W.children)}},_=($,W,J,Q)=>{$==null?s(W.el=h(W.children||""),J,Q):W.el=$.el},M=($,W,J,Q)=>{[$.el,$.anchor]=m($.children,W,J,Q,$.el,$.anchor)},v=({el:$,anchor:W},J,Q)=>{let ie;for(;$&&$!==W;)ie=f($),s($,J,Q),$=ie;s(W,J,Q)},S=({el:$,anchor:W})=>{let J;for(;$&&$!==W;)J=f($),n($),$=J;n(W)},y=($,W,J,Q,ie,ue,Se,Me,Ee)=>{if(W.type==="svg"?Se="svg":W.type==="math"&&(Se="mathml"),$==null)I(W,J,Q,ie,ue,Se,Me,Ee);else{const de=$.el&&$.el._isVueCE?$.el:null;try{de&&de._beginPatch(),R($,W,ie,ue,Se,Me,Ee)}finally{de&&de._endPatch()}}},I=($,W,J,Q,ie,ue,Se,Me)=>{let Ee,de;const{props:De,shapeFlag:Ie,transition:Be,dirs:Ke}=$;if(Ee=$.el=o($.type,ue,De&&De.is,De),Ie&8?c(Ee,$.children):Ie&16&&C($.children,Ee,null,Q,ie,qh($,ue),Se,Me),Ke&&sr($,null,Q,"created"),E(Ee,$,$.scopeId,Se,Q),De){for(const wt in De)wt!=="value"&&!Ko(wt)&&r(Ee,wt,null,De[wt],ue,Q);"value"in De&&r(Ee,"value",null,De.value,ue),(de=De.onVnodeBeforeMount)&&Ss(de,Q,$)}Ke&&sr($,null,Q,"beforeMount");const ct=nb(ie,Be);ct&&Be.beforeEnter(Ee),s(Ee,W,J),((de=De&&De.onVnodeMounted)||ct||Ke)&&Ai(()=>{try{de&&Ss(de,Q,$),ct&&Be.enter(Ee),Ke&&sr($,null,Q,"mounted")}finally{}},ie)},E=($,W,J,Q,ie)=>{if(J&&d($,J),Q)for(let ue=0;ue<Q.length;ue++)d($,Q[ue]);if(ie){let ue=ie.subTree;if(W===ue||M0(ue.type)&&(ue.ssContent===W||ue.ssFallback===W)){const Se=ie.vnode;E($,Se,Se.scopeId,Se.slotScopeIds,ie.parent)}}},C=($,W,J,Q,ie,ue,Se,Me,Ee=0)=>{for(let de=Ee;de<$.length;de++){const De=$[de]=Me?hn($[de]):Bs($[de]);g(null,De,W,J,Q,ie,ue,Se,Me)}},R=($,W,J,Q,ie,ue,Se)=>{const Me=W.el=$.el;let{patchFlag:Ee,dynamicChildren:de,dirs:De}=W;Ee|=$.patchFlag&16;const Ie=$.props||Ot,Be=W.props||Ot;let Ke;if(J&&nr(J,!1),(Ke=Be.onVnodeBeforeUpdate)&&Ss(Ke,J,W,$),De&&sr(W,$,J,"beforeUpdate"),J&&nr(J,!0),de&&(!$.dynamicChildren||$.dynamicChildren.length!==de.length)&&(Ee=0,Se=!1,de=null),(Ie.innerHTML&&Be.innerHTML==null||Ie.textContent&&Be.textContent==null)&&c(Me,""),de?B($.dynamicChildren,de,Me,J,Q,qh(W,ie),ue):Se||P($,W,Me,null,J,Q,qh(W,ie),ue,!1),Ee>0){if(Ee&16)k(Me,Ie,Be,J,ie);else if(Ee&2&&Ie.class!==Be.class&&r(Me,"class",null,Be.class,ie),Ee&4&&r(Me,"style",Ie.style,Be.style,ie),Ee&8){const ct=W.dynamicProps;for(let wt=0;wt<ct.length;wt++){const dt=ct[wt],Mt=Ie[dt],Ct=Be[dt];(Ct!==Mt||dt==="value")&&r(Me,dt,Mt,Ct,ie,J)}}Ee&1&&$.children!==W.children&&c(Me,W.children)}else!Se&&de==null&&k(Me,Ie,Be,J,ie);((Ke=Be.onVnodeUpdated)||De)&&Ai(()=>{Ke&&Ss(Ke,J,W,$),De&&sr(W,$,J,"updated")},Q)},B=($,W,J,Q,ie,ue,Se)=>{for(let Me=0;Me<W.length;Me++){const Ee=$[Me],de=W[Me],De=Ee.el&&(Ee.type===qe||!Ro(Ee,de)||Ee.shapeFlag&198)?u(Ee.el):J;g(Ee,de,De,null,Q,ie,ue,Se,!0)}},k=($,W,J,Q,ie)=>{if(W!==J){if(W!==Ot)for(const ue in W)!Ko(ue)&&!(ue in J)&&r($,ue,W[ue],null,ie,Q);for(const ue in J){if(Ko(ue))continue;const Se=J[ue],Me=W[ue];Se!==Me&&ue!=="value"&&r($,ue,Me,Se,ie,Q)}"value"in J&&r($,"value",W.value,J.value,ie)}},F=($,W,J,Q,ie,ue,Se,Me,Ee)=>{const de=W.el=$?$.el:a(""),De=W.anchor=$?$.anchor:a("");let{patchFlag:Ie,dynamicChildren:Be,slotScopeIds:Ke}=W;Ke&&(Me=Me?Me.concat(Ke):Ke),$==null?(s(de,J,Q),s(De,J,Q),C(W.children||[],J,De,ie,ue,Se,Me,Ee)):Ie>0&&Ie&64&&Be&&$.dynamicChildren&&$.dynamicChildren.length===Be.length?(B($.dynamicChildren,Be,J,ie,ue,Se,Me),(W.key!=null||ie&&W===ie.subTree)&&_0($,W,!0)):P($,W,J,De,ie,ue,Se,Me,Ee)},D=($,W,J,Q,ie,ue,Se,Me,Ee)=>{W.slotScopeIds=Me,$==null?W.shapeFlag&512?ie.ctx.activate(W,J,Q,Se,Ee):N(W,J,Q,ie,ue,Se,Ee):j($,W,Ee)},N=($,W,J,Q,ie,ue,Se)=>{const Me=$.component=db($,Q,ie);if(jd($)&&(Me.ctx.renderer=te),fb(Me,!1,Se),Me.asyncDep){if(ie&&ie.registerDep(Me,O,Se),!$.el){const Ee=Me.subTree=Ne(js);_(null,Ee,W,J),$.placeholder=Ee.el}}else O(Me,$,W,J,ie,ue,Se)},j=($,W,J)=>{const Q=W.component=$.component;if(z1($,W,J))if(Q.asyncDep&&!Q.asyncResolved){L(Q,W,J);return}else Q.next=W,Q.update();else W.el=$.el,Q.vnode=W},O=($,W,J,Q,ie,ue,Se)=>{const Me=()=>{if($.isMounted){let{next:Ie,bu:Be,u:Ke,parent:ct,vnode:wt}=$;{const Jt=S0($);if(Jt){Ie&&(Ie.el=wt.el,L($,Ie,Se)),Jt.asyncDep.then(()=>{Ai(()=>{$.isUnmounted||de()},ie)});return}}let dt=Ie,Mt;nr($,!1),Ie?(Ie.el=wt.el,L($,Ie,Se)):Ie=wt,Be&&cl(Be),(Mt=Ie.props&&Ie.props.onVnodeBeforeUpdate)&&Ss(Mt,ct,Ie,wt),nr($,!0);const Ct=Rf($),ai=$.subTree;$.subTree=Ct,g(ai,Ct,u(ai.el),ae(ai),$,ie,ue),Ie.el=Ct.el,dt===null&&q1($,Ct.el),Ke&&Ai(Ke,ie),(Mt=Ie.props&&Ie.props.onVnodeUpdated)&&Ai(()=>Ss(Mt,ct,Ie,wt),ie)}else{let Ie;const{el:Be,props:Ke}=W,{bm:ct,m:wt,parent:dt,root:Mt,type:Ct}=$,ai=ro(W);nr($,!1),ct&&cl(ct),!ai&&(Ie=Ke&&Ke.onVnodeBeforeMount)&&Ss(Ie,dt,W),nr($,!0);{Mt.ce&&Mt.ce._hasShadowRoot()&&Mt.ce._injectChildStyle(Ct,$.parent?$.parent.type:void 0);const Jt=$.subTree=Rf($);g(null,Jt,J,Q,$,ie,ue),W.el=Jt.el}if(wt&&Ai(wt,ie),!ai&&(Ie=Ke&&Ke.onVnodeMounted)){const Jt=W;Ai(()=>Ss(Ie,dt,Jt),ie)}(W.shapeFlag&256||dt&&ro(dt.vnode)&&dt.vnode.shapeFlag&256)&&$.a&&Ai($.a,ie),$.isMounted=!0,W=J=Q=null}};$.scope.on();const Ee=$.effect=new Dg(Me);$.scope.off();const de=$.update=Ee.run.bind(Ee),De=$.job=Ee.runIfDirty.bind(Ee);De.i=$,De.id=$.uid,Ee.scheduler=()=>Yd(De),nr($,!0),de()},L=($,W,J)=>{W.component=$;const Q=$.vnode.props;$.vnode=W,$.next=null,Z1($,W.props,Q,J),tb($,W.children,J),xn(),Sf($),bn()},P=($,W,J,Q,ie,ue,Se,Me,Ee=!1)=>{const de=$&&$.children,De=$?$.shapeFlag:0,Ie=W.children,{patchFlag:Be,shapeFlag:Ke}=W;if(Be>0){if(Be&128){U(de,Ie,J,Q,ie,ue,Se,Me,Ee);return}else if(Be&256){X(de,Ie,J,Q,ie,ue,Se,Me,Ee);return}}Ke&8?(De&16&&Z(de,ie,ue),Ie!==de&&c(J,Ie)):De&16?Ke&16?U(de,Ie,J,Q,ie,ue,Se,Me,Ee):Z(de,ie,ue,!0):(De&8&&c(J,""),Ke&16&&C(Ie,J,Q,ie,ue,Se,Me,Ee))},X=($,W,J,Q,ie,ue,Se,Me,Ee)=>{$=$||io,W=W||io;const de=$.length,De=W.length,Ie=Math.min(de,De);let Be;for(Be=0;Be<Ie;Be++){const Ke=W[Be]=Ee?hn(W[Be]):Bs(W[Be]);g($[Be],Ke,J,null,ie,ue,Se,Me,Ee)}de>De?Z($,ie,ue,!0,!1,Ie):C(W,J,Q,ie,ue,Se,Me,Ee,Ie)},U=($,W,J,Q,ie,ue,Se,Me,Ee)=>{let de=0;const De=W.length;let Ie=$.length-1,Be=De-1;for(;de<=Ie&&de<=Be;){const Ke=$[de],ct=W[de]=Ee?hn(W[de]):Bs(W[de]);if(Ro(Ke,ct))g(Ke,ct,J,null,ie,ue,Se,Me,Ee);else break;de++}for(;de<=Ie&&de<=Be;){const Ke=$[Ie],ct=W[Be]=Ee?hn(W[Be]):Bs(W[Be]);if(Ro(Ke,ct))g(Ke,ct,J,null,ie,ue,Se,Me,Ee);else break;Ie--,Be--}if(de>Ie){if(de<=Be){const Ke=Be+1,ct=Ke<De?W[Ke].el:Q;for(;de<=Be;)g(null,W[de]=Ee?hn(W[de]):Bs(W[de]),J,ct,ie,ue,Se,Me,Ee),de++}}else if(de>Be)for(;de<=Ie;)q($[de],ie,ue,!0),de++;else{const Ke=de,ct=de,wt=new Map;for(de=ct;de<=Be;de++){const $t=W[de]=Ee?hn(W[de]):Bs(W[de]);$t.key!=null&&wt.set($t.key,de)}let dt,Mt=0;const Ct=Be-ct+1;let ai=!1,Jt=0;const Zi=new Array(Ct);for(de=0;de<Ct;de++)Zi[de]=0;for(de=Ke;de<=Ie;de++){const $t=$[de];if(Mt>=Ct){q($t,ie,ue,!0);continue}let re;if($t.key!=null)re=wt.get($t.key);else for(dt=ct;dt<=Be;dt++)if(Zi[dt-ct]===0&&Ro($t,W[dt])){re=dt;break}re===void 0?q($t,ie,ue,!0):(Zi[re-ct]=de+1,re>=Jt?Jt=re:ai=!0,g($t,W[re],J,null,ie,ue,Se,Me,Ee),Mt++)}const xs=ai?rb(Zi):io;for(dt=xs.length-1,de=Ct-1;de>=0;de--){const $t=ct+de,re=W[$t],le=W[$t+1],ft=$t+1<De?le.el||T0(le):Q;Zi[de]===0?g(null,re,J,ft,ie,ue,Se,Me,Ee):ai&&(dt<0||de!==xs[dt]?Y(re,J,ft,2):dt--)}}},Y=($,W,J,Q,ie=null)=>{const{el:ue,type:Se,transition:Me,children:Ee,shapeFlag:de}=$;if(de&6){Y($.component.subTree,W,J,Q);return}if(de&128){$.suspense.move(W,J,Q);return}if(de&64){Se.move($,W,J,te);return}if(Se===qe){s(ue,W,J);for(let Ie=0;Ie<Ee.length;Ie++)Y(Ee[Ie],W,J,Q);s($.anchor,W,J);return}if(Se===ul){v($,W,J);return}if(Q!==2&&de&1&&Me)if(Q===0)Me.persisted&&!ue[Wh]?s(ue,W,J):(Me.beforeEnter(ue),s(ue,W,J),Ai(()=>Me.enter(ue),ie));else{const{leave:Ie,delayLeave:Be,afterLeave:Ke}=Me,ct=()=>{$.ctx.isUnmounted?n(ue):s(ue,W,J)},wt=()=>{const dt=ue._isLeaving||!!ue[Wh];ue._isLeaving&&ue[Wh](!0),Me.persisted&&!dt?ct():Ie(ue,()=>{ct(),Ke&&Ke()})};Be?Be(ue,ct,wt):wt()}else s(ue,W,J)},q=($,W,J,Q=!1,ie=!1)=>{const{type:ue,props:Se,ref:Me,children:Ee,dynamicChildren:de,shapeFlag:De,patchFlag:Ie,dirs:Be,cacheIndex:Ke,memo:ct}=$;if(Ie===-2&&(ie=!1),Me!=null&&(xn(),ea(Me,null,J,$,!0),bn()),Ke!=null&&(W.renderCache[Ke]=void 0),De&256){W.ctx.deactivate($);return}const wt=De&1&&Be,dt=!ro($);let Mt;if(dt&&(Mt=Se&&Se.onVnodeBeforeUnmount)&&Ss(Mt,W,$),De&6)H($.component,J,Q);else{if(De&128){$.suspense.unmount(J,Q);return}wt&&sr($,null,W,"beforeUnmount"),De&64?$.type.remove($,W,J,te,Q):de&&!de.hasOnce&&(ue!==qe||Ie>0&&Ie&64)?Z(de,W,J,!1,!0):(ue===qe&&Ie&384||!ie&&De&16)&&Z(Ee,W,J),Q&&z($)}const Ct=ct!=null&&Ke==null;(dt&&(Mt=Se&&Se.onVnodeUnmounted)||wt||Ct)&&Ai(()=>{Mt&&Ss(Mt,W,$),wt&&sr($,null,W,"unmounted"),Ct&&($.el=null)},J)},z=$=>{const{type:W,el:J,anchor:Q,transition:ie}=$;if(W===qe){ne(J,Q);return}if(W===ul){S($);return}const ue=()=>{n(J),ie&&!ie.persisted&&ie.afterLeave&&ie.afterLeave()};if($.shapeFlag&1&&ie&&!ie.persisted){const{leave:Se,delayLeave:Me}=ie,Ee=()=>Se(J,ue);Me?Me($.el,ue,Ee):Ee()}else ue()},ne=($,W)=>{let J;for(;$!==W;)J=f($),n($),$=J;n(W)},H=($,W,J)=>{const{bum:Q,scope:ie,job:ue,subTree:Se,um:Me,m:Ee,a:de}=$;Ff(Ee),Ff(de),Q&&cl(Q),ie.stop(),ue&&(ue.flags|=8,q(Se,$,W,J)),Me&&Ai(Me,W),Ai(()=>{$.isUnmounted=!0},W)},Z=($,W,J,Q=!1,ie=!1,ue=0)=>{for(let Se=ue;Se<$.length;Se++)q($[Se],W,J,Q,ie)},ae=$=>{if($.shapeFlag&6)return ae($.component.subTree);if($.shapeFlag&128)return $.suspense.next();const W=f($.anchor||$.el),J=W&&W[w1];return J?f(J):W};let me=!1;const _e=($,W,J)=>{let Q;$==null?W._vnode&&(q(W._vnode,null,null,!0),Q=W._vnode.component):g(W._vnode||null,$,W,null,null,null,J),W._vnode=$,me||(me=!0,Sf(Q),e0(),me=!1)},te={p:g,um:q,m:Y,r:z,mt:N,mc:C,pc:P,pbc:B,n:ae,o:i};return{render:_e,hydrate:void 0,createApp:Y1(_e)}}function qh({type:i,props:e},t){return t==="svg"&&i==="foreignObject"||t==="mathml"&&i==="annotation-xml"&&e&&e.encoding&&e.encoding.includes("html")?void 0:t}function nr({effect:i,job:e},t){t?(i.flags|=32,e.flags|=4):(i.flags&=-33,e.flags&=-5)}function nb(i,e){return(!i||i&&!i.pendingBranch)&&e&&!e.persisted}function _0(i,e,t=!1){const s=i.children,n=e.children;if(tt(s)&&tt(n))for(let r=0;r<s.length;r++){const o=s[r];let a=n[r];a.shapeFlag&1&&!a.dynamicChildren&&((a.patchFlag<=0||a.patchFlag===32)&&(a=n[r]=hn(n[r]),a.el=o.el),!t&&a.patchFlag!==-2&&_0(o,a)),a.type===Sh&&(a.patchFlag===-1&&(a=n[r]=hn(a)),a.el=o.el),a.type===js&&!a.el&&(a.el=o.el)}}function rb(i){const e=i.slice(),t=[0];let s,n,r,o,a;const h=i.length;for(s=0;s<h;s++){const l=i[s];if(l!==0){if(n=t[t.length-1],i[n]<l){e[s]=n,t.push(s);continue}for(r=0,o=t.length-1;r<o;)a=r+o>>1,i[t[a]]<l?r=a+1:o=a;l<i[t[r]]&&(r>0&&(e[s]=t[r-1]),t[r]=s)}}for(r=t.length,o=t[r-1];r-- >0;)t[r]=o,o=e[o];return t}function S0(i){const e=i.subTree.component;if(e)return e.asyncDep&&!e.asyncResolved?e:S0(e)}function Ff(i){if(i)for(let e=0;e<i.length;e++)i[e].flags|=8}function T0(i){if(i.placeholder)return i.placeholder;const e=i.component;return e?T0(e.subTree):null}const M0=i=>i.__isSuspense;function ob(i,e){e&&e.pendingBranch?tt(i)?e.effects.push(...i):e.effects.push(i):m1(i)}const qe=Symbol.for("v-fgt"),Sh=Symbol.for("v-txt"),js=Symbol.for("v-cmt"),ul=Symbol.for("v-stc"),vn=[];let Ui=null;function se(i=!1){vn.push(Ui=i?null:[])}function zd(){vn.pop(),Ui=vn[vn.length-1]||null}let la=1;function Of(i,e=!1){la+=i,i<0&&Ui&&e&&(Ui.hasOnce=!0)}function E0(i){return i.dynamicChildren=la>0?Ui||io:null,zd(),la>0&&Ui&&Ui.push(i),i}function ce(i,e,t,s,n,r){return E0(w(i,e,t,s,n,r,!0))}function Et(i,e,t,s,n){return E0(Ne(i,e,t,s,n,!0))}function qd(i){return i?i.__v_isVNode===!0:!1}function Ro(i,e){return i.type===e.type&&i.key===e.key}const A0=({key:i})=>i??null,dl=({ref:i,ref_key:e,ref_for:t})=>(typeof i=="number"&&(i=""+i),i!=null?qt(i)||Kt(i)||at(i)?{i:bi,r:i,k:e,f:!!t}:i:null);function w(i,e=null,t=null,s=0,n=null,r=i===qe?0:1,o=!1,a=!1){const h={__v_isVNode:!0,__v_skip:!0,type:i,props:e,key:e&&A0(e),ref:e&&dl(e),scopeId:i0,slotScopeIds:null,children:t,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:r,patchFlag:s,dynamicProps:n,dynamicChildren:null,appContext:null,ctx:bi};return a?(Cl(h,t),r&128&&i.normalize(h)):t&&(h.shapeFlag|=qt(t)?8:16),la>0&&!o&&Ui&&(h.patchFlag>0||r&6)&&h.patchFlag!==32&&Ui.push(h),h}const Ne=ab;function ab(i,e=null,t=null,s=0,n=null,r=!1){if((!i||i===F1)&&(i=js),qd(i)){const a=mo(i,e,!0);return t&&Cl(a,t),la>0&&!r&&Ui&&(a.shapeFlag&6?Ui[Ui.indexOf(i)]=a:Ui.push(a)),a.patchFlag=-2,a}if(vb(i)&&(i=i.__vccOpts),e){e=lb(e);let{class:a,style:h}=e;a&&!qt(a)&&(e.class=Ze(a)),Ft(h)&&(yh(h)&&!tt(h)&&(h=mi({},h)),e.style=Pi(h))}const o=qt(i)?1:M0(i)?128:bh(i)?64:Ft(i)?4:at(i)?2:0;return w(i,e,t,s,n,o,r,!0)}function lb(i){return i?yh(i)||g0(i)?mi({},i):i:null}function mo(i,e,t=!1,s=!1){const{props:n,ref:r,patchFlag:o,children:a,transition:h}=i,l=e?hb(n||{},e):n,c={__v_isVNode:!0,__v_skip:!0,type:i.type,props:l,key:l&&A0(l),ref:e&&e.ref?t&&r?tt(r)?r.concat(dl(e)):[r,dl(e)]:dl(e):r,scopeId:i.scopeId,slotScopeIds:i.slotScopeIds,children:a,target:i.target,targetStart:i.targetStart,targetAnchor:i.targetAnchor,staticCount:i.staticCount,shapeFlag:i.shapeFlag,patchFlag:e&&i.type!==qe?o===-1?16:o|16:o,dynamicProps:i.dynamicProps,dynamicChildren:i.dynamicChildren,appContext:i.appContext,dirs:i.dirs,transition:h,component:i.component,suspense:i.suspense,ssContent:i.ssContent&&mo(i.ssContent),ssFallback:i.ssFallback&&mo(i.ssFallback),placeholder:i.placeholder,el:i.el,anchor:i.anchor,ctx:i.ctx,ce:i.ce};return h&&s&&Gd(c,h.clone(c)),c}function Yt(i=" ",e=0){return Ne(Sh,null,i,e)}function Vo(i,e){const t=Ne(ul,null,i);return t.staticCount=e,t}function $e(i="",e=!1){return e?(se(),Et(js,null,i)):Ne(js,null,i)}function Bs(i){return i==null||typeof i=="boolean"?Ne(js):tt(i)?Ne(qe,null,i.slice()):qd(i)?hn(i):Ne(Sh,null,String(i))}function hn(i){return i.el===null&&i.patchFlag!==-1||i.memo?i:mo(i)}function Cl(i,e){let t=0;const{shapeFlag:s}=i;if(e==null)e=null;else if(tt(e))t=16;else if(typeof e=="object")if(s&65){const n=e.default;n&&(n._c&&(n._d=!1),Cl(i,n()),n._c&&(n._d=!0));return}else{t=32;const n=e._;!n&&!g0(e)?e._ctx=bi:n===3&&bi&&(bi.slots._===1?e._=1:(e._=2,i.patchFlag|=1024))}else if(at(e)){if(s&65){Cl(i,{default:e});return}e={default:e,_ctx:bi},t=32}else e=String(e),s&64?(t=16,e=[Yt(e)]):t=8;i.children=e,i.shapeFlag|=t}function hb(...i){const e={};for(let t=0;t<i.length;t++){const s=i[t];for(const n in s)if(n==="class")e.class!==s.class&&(e.class=Ze([e.class,s.class]));else if(n==="style")e.style=Pi([e.style,s.style]);else if(uh(n)){const r=e[n],o=s[n];o&&r!==o&&!(tt(r)&&r.includes(o))?e[n]=r?[].concat(r,o):o:o==null&&r==null&&!dh(n)&&(e[n]=o)}else n!==""&&(e[n]=s[n])}return e}function Ss(i,e,t,s=null){gs(i,e,7,[t,s])}const cb=u0();let ub=0;function db(i,e,t){const s=i.type,n=(e?e.appContext:i.appContext)||cb,r={uid:ub++,vnode:i,type:s,parent:e,appContext:n,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new Og(!0),render:null,proxy:null,exposed:null,exposeProxy:null,withProxy:null,provides:e?e.provides:Object.create(n.provides),ids:e?e.ids:["",0,0],accessCache:null,renderCache:[],components:null,directives:null,propsOptions:y0(s,n),emitsOptions:d0(s,n),emit:null,emitted:null,propsDefaults:Ot,inheritAttrs:s.inheritAttrs,ctx:Ot,data:Ot,props:Ot,attrs:Ot,slots:Ot,refs:Ot,setupState:Ot,setupContext:null,suspense:t,suspenseId:t?t.pendingId:0,asyncDep:null,asyncResolved:!1,isMounted:!1,isUnmounted:!1,isDeactivated:!1,bc:null,c:null,bm:null,m:null,bu:null,u:null,um:null,bum:null,da:null,a:null,rtg:null,rtc:null,ec:null,sp:null};return r.ctx={_:r},r.root=e?e.root:r,r.emit=G1.bind(null,r),i.ce&&i.ce(r),r}let Ti=null;const C0=()=>Ti||bi;let Il,ha;{const i=gh(),e=(t,s)=>{let n;return(n=i[t])||(n=i[t]=[]),n.push(s),r=>{n.length>1?n.forEach(o=>o(r)):n[0](r)}};Il=e("__VUE_INSTANCE_SETTERS__",t=>Ti=t),ha=e("__VUE_SSR_SETTERS__",t=>ca=t)}const _a=i=>{const e=Ti;return Il(i),i.scope.on(),()=>{i.scope.off(),Il(e)}},Bf=()=>{Ti&&Ti.scope.off(),Il(null)};function I0(i){return i.vnode.shapeFlag&4}let ca=!1;function fb(i,e=!1,t=!1){e&&ha(e);const{props:s,children:n}=i.vnode,r=I0(i);K1(i,s,r,e),eb(i,n,t||e);const o=r?pb(i,e):void 0;return e&&ha(!1),o}function pb(i,e){const t=i.type;i.accessCache=Object.create(null),i.proxy=new Proxy(i.ctx,B1);const{setup:s}=t;if(s){xn();const n=i.setupContext=s.length>1?gb(i):null,r=_a(i),o=ba(s,i,0,[i.props,n]),a=Eg(o);if(bn(),r(),(a||i.sp)&&!ro(i)&&r0(i),a){if(o.then(Bf,Bf),e)return o.then(h=>{ha(!0);try{Lf(i,h,e)}finally{ha(!1)}}).catch(h=>{xh(h,i,0)});i.asyncDep=o}else Lf(i,o)}else R0(i)}function Lf(i,e,t){at(e)?i.type.__ssrInlineRender?i.ssrRender=e:i.render=e:Ft(e)&&(i.setupState=Zg(e)),R0(i)}function R0(i,e,t){const s=i.type;i.render||(i.render=s.render||Ys);{const n=_a(i);xn();try{L1(i)}finally{bn(),n()}}}const mb={get(i,e){return yi(i,"get",""),i[e]}};function gb(i){const e=t=>{i.exposed=t||{}};return{attrs:new Proxy(i.attrs,mb),slots:i.slots,emit:i.emit,expose:e}}function Th(i){return i.exposed?i.exposeProxy||(i.exposeProxy=new Proxy(Zg($n(i.exposed)),{get(e,t){if(t in e)return e[t];if(t in ta)return ta[t](i)},has(e,t){return t in e||t in ta}})):i.proxy}function vb(i){return at(i)&&"__vccOpts"in i}const ut=(i,e)=>c1(i,e,ca),yb="3.5.41";/**
|
||
* @vue/runtime-dom v3.5.41
|
||
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
||
* @license MIT
|
||
**/let Nu;const Df=typeof window<"u"&&window.trustedTypes;if(Df)try{Nu=Df.createPolicy("vue",{createHTML:i=>i})}catch{}const P0=Nu?i=>Nu.createHTML(i):i=>i,xb="http://www.w3.org/2000/svg",bb="http://www.w3.org/1998/Math/MathML",rn=typeof document<"u"?document:null,Nf=rn&&rn.createElement("template"),wb={insert:(i,e,t)=>{e.insertBefore(i,t||null)},remove:i=>{const e=i.parentNode;e&&e.removeChild(i)},createElement:(i,e,t,s)=>{const n=e==="svg"?rn.createElementNS(xb,i):e==="mathml"?rn.createElementNS(bb,i):t?rn.createElement(i,{is:t}):rn.createElement(i);return i==="select"&&s&&s.multiple!=null&&n.setAttribute("multiple",s.multiple),n},createText:i=>rn.createTextNode(i),createComment:i=>rn.createComment(i),setText:(i,e)=>{i.nodeValue=e},setElementText:(i,e)=>{i.textContent=e},parentNode:i=>i.parentNode,nextSibling:i=>i.nextSibling,querySelector:i=>rn.querySelector(i),setScopeId(i,e){i.setAttribute(e,"")},insertStaticContent(i,e,t,s,n,r){const o=t?t.previousSibling:e.lastChild;if(n&&(n===r||n.nextSibling))for(;e.insertBefore(n.cloneNode(!0),t),!(n===r||!(n=n.nextSibling)););else{Nf.innerHTML=P0(s==="svg"?`<svg>${i}</svg>`:s==="mathml"?`<math>${i}</math>`:i);const a=Nf.content;if(s==="svg"||s==="mathml"){const h=a.firstChild;for(;h.firstChild;)a.appendChild(h.firstChild);a.removeChild(h)}e.insertBefore(a,t)}return[o?o.nextSibling:e.firstChild,t?t.previousSibling:e.lastChild]}},_b=Symbol("_vtc");function Sb(i,e,t){const s=i[_b];s&&(e=(e?[e,...s]:[...s]).join(" ")),e==null?i.removeAttribute("class"):t?i.setAttribute("class",e):i.className=e}const Rl=Symbol("_vod"),k0=Symbol("_vsh"),Cn={name:"show",beforeMount(i,{value:e},{transition:t}){i[Rl]=i.style.display==="none"?"":i.style.display,t&&e?t.beforeEnter(i):Po(i,e)},mounted(i,{value:e},{transition:t}){t&&e&&t.enter(i)},updated(i,{value:e,oldValue:t},{transition:s}){!e!=!t&&(s?e?(s.beforeEnter(i),Po(i,!0),s.enter(i)):s.leave(i,()=>{Po(i,!1)}):Po(i,e))},beforeUnmount(i,{value:e}){Po(i,e)}};function Po(i,e){i.style.display=e?i[Rl]:"none",i[k0]=!e}const Tb=Symbol(""),Mb=/(?:^|;)\s*display\s*:/;function Eb(i,e,t){const s=i.style,n=qt(t);let r=!1;if(t&&!n){if(e)if(qt(e))for(const o of e.split(";")){const a=o.slice(0,o.indexOf(":")).trim();t[a]==null&&Xo(s,a,"")}else for(const o in e)t[o]==null&&Xo(s,o,"");for(const o in t){o==="display"&&(r=!0);const a=t[o];a!=null?Cb(i,o,!qt(e)&&e?e[o]:void 0,a)||Xo(s,o,a):Xo(s,o,"")}}else if(n){if(e!==t){const o=s[Tb];o&&(t+=";"+o),s.cssText=t,r=Mb.test(t)}}else e&&i.removeAttribute("style");Rl in i&&(i[Rl]=r?s.display:"",i[k0]&&(s.display="none"))}const Uf=/\s*!important$/;function Xo(i,e,t){if(tt(t))t.forEach(s=>Xo(i,e,s));else if(t==null&&(t=""),e.startsWith("--"))i.setProperty(e,t);else{const s=Ab(i,e);Uf.test(t)?i.setProperty(Jn(s),t.replace(Uf,""),"important"):i[s]=t}}const Vf=["Webkit","Moz","ms"],Kh={};function Ab(i,e){const t=Kh[e];if(t)return t;let s=ls(e);if(s!=="filter"&&s in i)return Kh[e]=s;s=Ig(s);for(let n=0;n<Vf.length;n++){const r=Vf[n]+s;if(r in i)return Kh[e]=r}return e}function Cb(i,e,t,s){return i.tagName==="TEXTAREA"&&(e==="width"||e==="height")&&qt(s)&&t===s}const Xf="http://www.w3.org/1999/xlink";function Yf(i,e,t,s,n,r=Bx(e)){s&&e.startsWith("xlink:")?t==null?i.removeAttributeNS(Xf,e.slice(6,e.length)):i.setAttributeNS(Xf,e,t):t==null||r&&!Pg(t)?i.removeAttribute(e):i.setAttribute(e,r?"":Xi(t)?String(t):t)}function $f(i,e,t,s,n){if(e==="innerHTML"||e==="textContent"){t!=null&&(i[e]=e==="innerHTML"?P0(t):t);return}const r=i.tagName;if(e==="value"&&r!=="PROGRESS"&&!r.includes("-")){const a=r==="OPTION"?i.getAttribute("value")||"":i.value,h=t==null?i.type==="checkbox"?"on":"":String(t);(a!==h||!("_value"in i))&&(i.value=h),t==null&&i.removeAttribute(e),i._value=t;return}let o=!1;if(t===""||t==null){const a=typeof i[e];a==="boolean"?t=Pg(t):t==null&&a==="string"?(t="",o=!0):a==="number"&&(t=0,o=!0)}try{i[e]=t}catch{}o&&i.removeAttribute(n||e)}function Un(i,e,t,s){i.addEventListener(e,t,s)}function Ib(i,e,t,s){i.removeEventListener(e,t,s)}const Gf=Symbol("_vei");function Rb(i,e,t,s,n=null){const r=i[Gf]||(i[Gf]={}),o=r[e];if(s&&o)o.value=s;else{const[a,h]=Fb(e);if(s){const l=r[e]=Lb(s,n);Un(i,a,l,h)}else o&&(Ib(i,a,o,h),r[e]=void 0)}}const Pb=/(Once|Passive|Capture)$/,kb=/^on:?(?:Once|Passive|Capture)$/;function Fb(i){let e,t;for(;(t=i.match(Pb))&&!kb.test(i);)e||(e={}),i=i.slice(0,i.length-t[1].length),e[t[1].toLowerCase()]=!0;return[i[2]===":"?i.slice(3):Jn(i.slice(2)),e]}let Zh=0;const Ob=Promise.resolve(),Bb=()=>Zh||(Ob.then(()=>Zh=0),Zh=Date.now());function Lb(i,e){const t=s=>{if(!s._vts)s._vts=Date.now();else if(s._vts<=t.attached)return;const n=t.value;if(tt(n)){const r=s.stopImmediatePropagation;s.stopImmediatePropagation=()=>{r.call(s),s._stopped=!0};const o=n.slice(),a=[s];for(let h=0;h<o.length&&!s._stopped;h++){const l=o[h];l&&gs(l,e,5,a)}}else gs(n,e,5,[s])};return t.value=i,t.attached=Bb(),t}const jf=i=>i.charCodeAt(0)===111&&i.charCodeAt(1)===110&&i.charCodeAt(2)>96&&i.charCodeAt(2)<123,Db=(i,e,t,s,n,r)=>{const o=n==="svg";e==="class"?Sb(i,s,o):e==="style"?Eb(i,t,s):uh(e)?dh(e)||Rb(i,e,t,s,r):(e[0]==="."?(e=e.slice(1),!0):e[0]==="^"?(e=e.slice(1),!1):Nb(i,e,s,o))?($f(i,e,s),!i.tagName.includes("-")&&(e==="value"||e==="checked"||e==="selected")&&Yf(i,e,s,o,r,e!=="value")):i._isVueCE&&(Ub(i,e)||i._def.__asyncLoader&&(/[A-Z]/.test(e)||!qt(s)))?$f(i,ls(e),s,r,e):(e==="true-value"?i._trueValue=s:e==="false-value"&&(i._falseValue=s),Yf(i,e,s,o))};function Nb(i,e,t,s){if(s)return!!(e==="innerHTML"||e==="textContent"||e in i&&jf(e)&&at(t));if(e==="spellcheck"||e==="draggable"||e==="translate"||e==="autocorrect"||e==="sandbox"&&i.tagName==="IFRAME"||e==="form"||e==="list"&&i.tagName==="INPUT"||e==="type"&&i.tagName==="TEXTAREA")return!1;if(e==="width"||e==="height"){const n=i.tagName;if(n==="IMG"||n==="VIDEO"||n==="CANVAS"||n==="SOURCE")return!1}return jf(e)&&qt(t)?!1:e in i}function Ub(i,e){const t=i._def.props;if(!t)return!1;const s=ls(e);return Array.isArray(t)?t.some(n=>ls(n)===s):Object.keys(t).some(n=>ls(n)===s)}const go=i=>{const e=i.props["onUpdate:modelValue"]||!1;return tt(e)?t=>cl(e,t):e};function Vb(i){i.target.composing=!0}function Hf(i){const e=i.target;e.composing&&(e.composing=!1,e.dispatchEvent(new Event("input")))}const Ns=Symbol("_assign"),ka=Symbol("_initialValue");function Jh(i,e,t){return e&&(i=i.trim()),t&&(i=mh(i)),i}const Je={created(i,{modifiers:{lazy:e,trim:t,number:s}},n){i.parentNode&&(i.type==="text"?i[ka]=i.defaultValue.replace(/[\r\n]/g,""):i.type==="textarea"&&(i[ka]=i.defaultValue.replace(/\r\n?/g,`
|
||
`))),i[Ns]=go(n);const r=s||n.props&&n.props.type==="number";Un(i,e?"change":"input",o=>{o.target.composing||i[Ns](Jh(i.value,t,r))}),(t||r)&&Un(i,"change",()=>{i.value=Jh(i.value,t,r)}),e||(Un(i,"compositionstart",Vb),Un(i,"compositionend",Hf),Un(i,"change",Hf))},mounted(i,{value:e,modifiers:{trim:t,number:s}}){const n=e??"",r=i[ka];delete i[ka],r!==void 0&&(i.type==="text"||i.type==="textarea")&&i.value!==r?i[Ns](Jh(i.value,t,s)):i.value=n},beforeUpdate(i,{value:e,oldValue:t,modifiers:{lazy:s,trim:n,number:r}},o){if(i[Ns]=go(o),i.composing)return;const a=(r||i.type==="number")&&!/^0\d/.test(i.value)?mh(i.value):i.value,h=e??"";if(a===h)return;const l=i.getRootNode();(l instanceof Document||l instanceof ShadowRoot)&&l.activeElement===i&&i.type!=="range"&&(s&&e===t||n&&i.value.trim()===h)||(i.value=h)}},Lt={deep:!0,created(i,e,t){i[Ns]=go(t),Un(i,"change",()=>{const s=i._modelValue,n=ua(i),r=i.checked,o=i[Ns];if(tt(s)){const a=Od(s,n),h=a!==-1;if(r&&!h)o(s.concat(n));else if(!r&&h){const l=[...s];l.splice(a,1),o(l)}}else if(xo(s)){const a=new Set(s);r?a.add(n):a.delete(n),o(a)}else o(F0(i,r))})},mounted:Wf,beforeUpdate(i,e,t){i[Ns]=go(t),Wf(i,e,t)}};function Wf(i,{value:e,oldValue:t},s){i._modelValue=e;let n;if(tt(e))n=Od(e,s.props.value)>-1;else if(xo(e))n=e.has(s.props.value);else{if(e===t)return;n=bo(e,F0(i,!0))}i.checked!==n&&(i.checked=n)}const kt={deep:!0,created(i,{value:e,modifiers:{number:t}},s){i._modelValue=e,Un(i,"change",()=>{const n=Array.prototype.filter.call(i.options,r=>r.selected).map(r=>t?mh(ua(r)):ua(r));i[Ns](i.multiple?xo(i._modelValue)?new Set(n):n:n[0]),i._assigning=!0,Xd(()=>{i._assigning=!1})}),i[Ns]=go(s)},mounted(i,{value:e}){zf(i,e)},beforeUpdate(i,{value:e},t){i._modelValue=e,i[Ns]=go(t)},updated(i,{value:e}){i._assigning||zf(i,e)}};function zf(i,e){const t=i.multiple,s=tt(e);if(!(t&&!s&&!xo(e))){for(let n=0,r=i.options.length;n<r;n++){const o=i.options[n],a=ua(o);if(t)if(s){const h=typeof a;h==="string"||h==="number"?o.selected=e.some(l=>String(l)===String(a)):o.selected=Od(e,a)>-1}else o.selected=e.has(a);else if(bo(ua(o),e)){i.selectedIndex!==n&&(i.selectedIndex=n);return}}!t&&i.selectedIndex!==-1&&(i.selectedIndex=-1)}}function ua(i){return"_value"in i?i._value:i.value}function F0(i,e){const t=e?"_trueValue":"_falseValue";return t in i?i[t]:e}const Xb=["ctrl","shift","alt","meta"],Yb={stop:i=>i.stopPropagation(),prevent:i=>i.preventDefault(),self:i=>i.target!==i.currentTarget,ctrl:i=>!i.ctrlKey,shift:i=>!i.shiftKey,alt:i=>!i.altKey,meta:i=>!i.metaKey,left:i=>"button"in i&&i.button!==0,middle:i=>"button"in i&&i.button!==1,right:i=>"button"in i&&i.button!==2,exact:(i,e)=>Xb.some(t=>i[`${t}Key`]&&!e.includes(t))},xt=(i,e)=>{if(!i)return i;const t=i._withMods||(i._withMods={}),s=e.join(".");return t[s]||(t[s]=((n,...r)=>{for(let o=0;o<e.length;o++){const a=Yb[e[o]];if(a&&a(n,e))return}return i(n,...r)}))},$b={esc:"escape",space:" ",up:"arrow-up",left:"arrow-left",right:"arrow-right",down:"arrow-down",delete:"backspace"},da=(i,e)=>{const t=i._withKeys||(i._withKeys={}),s=e.join(".");return t[s]||(t[s]=(n=>{if(!("key"in n))return;const r=Jn(n.key);if(e.some(o=>o===r||$b[o]===r))return i(n)}))},Gb=mi({patchProp:Db},wb);let qf;function jb(){return qf||(qf=ib(Gb))}const Hb=((...i)=>{const e=jb().createApp(...i),{mount:t}=e;return e.mount=s=>{const n=zb(s);if(!n)return;const r=e._component;!at(r)&&!r.render&&!r.template&&(r.template=n.innerHTML),n.nodeType===1&&(n.textContent="");const o=t(n,!1,Wb(n));return n instanceof Element&&(n.removeAttribute("v-cloak"),n.setAttribute("data-v-app","")),o},e});function Wb(i){if(i instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&i instanceof MathMLElement)return"mathml"}function zb(i){return qt(i)?document.querySelector(i):i}/*!
|
||
* pinia v4.0.3
|
||
* (c) 2026 Eduardo San Martin Morote
|
||
* @license MIT
|
||
*/let O0;const Mh=i=>O0=i,B0=Symbol();function Kf(i){return i&&typeof i=="object"&&Object.prototype.toString.call(i)==="[object Object]"&&typeof i.toJSON!="function"}function qb(){const i=Bg(!0),e=i.run(()=>it({}));let t=[],s=[];const n=$n({install(r){Mh(n),n._a=r,r.provide(B0,n),r.config.globalProperties.$pinia=n,s.forEach(o=>t.push(o)),s=[]},use(r){return this._a?t.push(r):s.push(r),this},_p:t,_a:null,_e:i,_s:new Map,state:e});return n}const Uu=()=>{};function Zf(i,e,t,s=Uu){i.add(e);const n=()=>{i.delete(e)&&s()};return!t&&Lg()&&Dx(n),n}function Br(i,...e){i.forEach(t=>{t(...e)})}const Kb=i=>i(),Jf=Symbol(),Qh=Symbol();function Vu(i,e){i instanceof Map&&e instanceof Map?e.forEach((t,s)=>i.set(s,t)):i instanceof Set&&e instanceof Set&&e.forEach(i.add,i);for(const t in e){if(!Object.hasOwn(e,t))continue;const s=e[t],n=i[t];Kf(n)&&Kf(s)&&Object.hasOwn(i,t)&&!Kt(s)&&!gn(s)?i[t]=Vu(n,s):i[t]=s}return i}const Zb=Symbol();function Jb(i){return!i||typeof i!="object"||!Object.hasOwn(i,Zb)}const{assign:Pn}=Object;function Qb(i){return!!(Kt(i)&&i.effect)}function ew(i,e,t,s){const{state:n,actions:r,getters:o}=e,a=t.state.value[i];let h;function l(){a||(t.state.value[i]=n?n():{});const c=o1(t.state.value[i]);return Pn(c,r,Object.keys(o||{}).reduce((u,f)=>(u[f]=$n(ut(()=>{Mh(t);const d=t._s.get(i);return o[f].call(d,d)})),u),{}))}return h=L0(i,l,e,t,s,!0),h}function L0(i,e,t={},s,n,r){let o;const a=Pn({actions:{}},t),h={deep:!0};let l,c,u=new Set,f=new Set,d;const m=s.state.value[i];!r&&!m&&(s.state.value[i]={});let g;function b(E){let C;l=c=!1,typeof E=="function"?(E(s.state.value[i]),C={type:"patch function",storeId:i,events:d}):(Vu(s.state.value[i],E),C={type:"patch object",payload:E,storeId:i,events:d});const R=g=Symbol();Xd().then(()=>{g===R&&(l=!0)}),c=!0,Br(u,C,s.state.value[i])}const _=r?function(){const{state:C}=t,R=C?C():{};this.$patch(B=>{Pn(B,R)})}:Uu;function M(){o.stop(),u.clear(),f.clear(),s._s.delete(i)}const v=(E,C="")=>{if(Jf in E)return E[Qh]=C,E;const R=function(){Mh(s);const B=Array.from(arguments),k=new Set,F=new Set;function D(O){k.add(O)}function N(O){F.add(O)}Br(f,{args:B,name:R[Qh],store:y,after:D,onError:N});let j;try{j=E.apply(this&&this.$id===i?this:y,B)}catch(O){throw Br(F,O),O}return j instanceof Promise?j.then(O=>(Br(k,O),O)).catch(O=>(Br(F,O),Promise.reject(O))):(Br(k,j),j)};return R[Jf]=!0,R[Qh]=C,R},S={_p:s,$id:i,$onAction:Zf.bind(null,f),$patch:b,$reset:_,$subscribe(E,C={}){if(u.has(E))return Uu;const R=Zf(u,E,C.detached,()=>B()),B=o.run(()=>cs(()=>s.state.value[i],k=>{(C.flush==="sync"?c:l)&&E({storeId:i,type:"direct",events:d},k)},Pn({},h,C)));return R},$dispose:M},y=wo(S);s._s.set(i,y);const I=(s._a&&s._a.runWithContext||Kb)(()=>s._e.run(()=>(o=Bg()).run(()=>e({action:v}))));for(const E in I){const C=I[E];Kt(C)&&!Qb(C)||gn(C)?r||(m&&Jb(C)&&(Kt(C)?C.value=m[E]:((C instanceof Set||C instanceof Map)&&C.clear(),Vu(C,m[E]))),s.state.value[i][E]=C):typeof C=="function"&&(I[E]=v(C,E),a.actions[E]=C)}return Pn(y,I),Pn(Tt(y),I),Object.defineProperty(y,"$state",{get:()=>s.state.value[i],set:E=>{b(C=>{Pn(C,E)})}}),s._p.forEach(E=>{const C=o.run(()=>E({store:y,app:s._a,pinia:s,options:a}));Pn(y,C)}),m&&r&&t.hydrate&&t.hydrate(y.$state,m),l=!0,c=!0,y}/*! #__NO_SIDE_EFFECTS__ */function tw(i,e,t){let s;const n=typeof e=="function";s=n?t:e;function r(o,a){const h=v1();return o=o||(h?Qo(B0,null):null),o&&Mh(o),o=O0,o._s.has(i)||(n?L0(i,e,s,o):ew(i,s,o)),o._s.get(i)}return r.$id=i,r}var Cr=(i=>(i[i.WEBGL_LEGACY=0]="WEBGL_LEGACY",i[i.WEBGL=1]="WEBGL",i[i.WEBGL2=2]="WEBGL2",i))(Cr||{}),D0=(i=>(i[i.UNKNOWN=0]="UNKNOWN",i[i.WEBGL=1]="WEBGL",i[i.CANVAS=2]="CANVAS",i))(D0||{}),Xu=(i=>(i[i.COLOR=16384]="COLOR",i[i.DEPTH=256]="DEPTH",i[i.STENCIL=1024]="STENCIL",i))(Xu||{}),Qe=(i=>(i[i.NORMAL=0]="NORMAL",i[i.ADD=1]="ADD",i[i.MULTIPLY=2]="MULTIPLY",i[i.SCREEN=3]="SCREEN",i[i.OVERLAY=4]="OVERLAY",i[i.DARKEN=5]="DARKEN",i[i.LIGHTEN=6]="LIGHTEN",i[i.COLOR_DODGE=7]="COLOR_DODGE",i[i.COLOR_BURN=8]="COLOR_BURN",i[i.HARD_LIGHT=9]="HARD_LIGHT",i[i.SOFT_LIGHT=10]="SOFT_LIGHT",i[i.DIFFERENCE=11]="DIFFERENCE",i[i.EXCLUSION=12]="EXCLUSION",i[i.HUE=13]="HUE",i[i.SATURATION=14]="SATURATION",i[i.COLOR=15]="COLOR",i[i.LUMINOSITY=16]="LUMINOSITY",i[i.NORMAL_NPM=17]="NORMAL_NPM",i[i.ADD_NPM=18]="ADD_NPM",i[i.SCREEN_NPM=19]="SCREEN_NPM",i[i.NONE=20]="NONE",i[i.SRC_OVER=0]="SRC_OVER",i[i.SRC_IN=21]="SRC_IN",i[i.SRC_OUT=22]="SRC_OUT",i[i.SRC_ATOP=23]="SRC_ATOP",i[i.DST_OVER=24]="DST_OVER",i[i.DST_IN=25]="DST_IN",i[i.DST_OUT=26]="DST_OUT",i[i.DST_ATOP=27]="DST_ATOP",i[i.ERASE=26]="ERASE",i[i.SUBTRACT=28]="SUBTRACT",i[i.XOR=29]="XOR",i))(Qe||{}),Us=(i=>(i[i.POINTS=0]="POINTS",i[i.LINES=1]="LINES",i[i.LINE_LOOP=2]="LINE_LOOP",i[i.LINE_STRIP=3]="LINE_STRIP",i[i.TRIANGLES=4]="TRIANGLES",i[i.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",i[i.TRIANGLE_FAN=6]="TRIANGLE_FAN",i))(Us||{}),Re=(i=>(i[i.RGBA=6408]="RGBA",i[i.RGB=6407]="RGB",i[i.RG=33319]="RG",i[i.RED=6403]="RED",i[i.RGBA_INTEGER=36249]="RGBA_INTEGER",i[i.RGB_INTEGER=36248]="RGB_INTEGER",i[i.RG_INTEGER=33320]="RG_INTEGER",i[i.RED_INTEGER=36244]="RED_INTEGER",i[i.ALPHA=6406]="ALPHA",i[i.LUMINANCE=6409]="LUMINANCE",i[i.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",i[i.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",i[i.DEPTH_STENCIL=34041]="DEPTH_STENCIL",i))(Re||{}),oo=(i=>(i[i.TEXTURE_2D=3553]="TEXTURE_2D",i[i.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",i[i.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",i[i.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",i[i.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",i[i.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",i[i.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",i[i.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",i[i.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",i))(oo||{}),je=(i=>(i[i.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",i[i.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",i[i.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",i[i.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",i[i.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",i[i.UNSIGNED_INT=5125]="UNSIGNED_INT",i[i.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",i[i.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",i[i.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",i[i.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",i[i.BYTE=5120]="BYTE",i[i.SHORT=5122]="SHORT",i[i.INT=5124]="INT",i[i.FLOAT=5126]="FLOAT",i[i.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",i[i.HALF_FLOAT=36193]="HALF_FLOAT",i))(je||{}),Xe=(i=>(i[i.FLOAT=0]="FLOAT",i[i.INT=1]="INT",i[i.UINT=2]="UINT",i))(Xe||{}),as=(i=>(i[i.NEAREST=0]="NEAREST",i[i.LINEAR=1]="LINEAR",i))(as||{}),us=(i=>(i[i.CLAMP=33071]="CLAMP",i[i.REPEAT=10497]="REPEAT",i[i.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",i))(us||{}),Ki=(i=>(i[i.OFF=0]="OFF",i[i.POW2=1]="POW2",i[i.ON=2]="ON",i[i.ON_MANUAL=3]="ON_MANUAL",i))(Ki||{}),ui=(i=>(i[i.NPM=0]="NPM",i[i.UNPACK=1]="UNPACK",i[i.PMA=2]="PMA",i[i.NO_PREMULTIPLIED_ALPHA=0]="NO_PREMULTIPLIED_ALPHA",i[i.PREMULTIPLY_ON_UPLOAD=1]="PREMULTIPLY_ON_UPLOAD",i[i.PREMULTIPLIED_ALPHA=2]="PREMULTIPLIED_ALPHA",i))(ui||{}),Ls=(i=>(i[i.NO=0]="NO",i[i.YES=1]="YES",i[i.AUTO=2]="AUTO",i[i.BLEND=0]="BLEND",i[i.CLEAR=1]="CLEAR",i[i.BLIT=2]="BLIT",i))(Ls||{}),Kd=(i=>(i[i.AUTO=0]="AUTO",i[i.MANUAL=1]="MANUAL",i))(Kd||{}),zi=(i=>(i.LOW="lowp",i.MEDIUM="mediump",i.HIGH="highp",i))(zi||{}),si=(i=>(i[i.NONE=0]="NONE",i[i.SCISSOR=1]="SCISSOR",i[i.STENCIL=2]="STENCIL",i[i.SPRITE=3]="SPRITE",i[i.COLOR=4]="COLOR",i))(si||{}),ei=(i=>(i[i.NONE=0]="NONE",i[i.LOW=2]="LOW",i[i.MEDIUM=4]="MEDIUM",i[i.HIGH=8]="HIGH",i))(ei||{}),$s=(i=>(i[i.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",i[i.ARRAY_BUFFER=34962]="ARRAY_BUFFER",i[i.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",i))($s||{});const iw={createCanvas:(i,e)=>{const t=document.createElement("canvas");return t.width=i,t.height=e,t},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(i,e)=>fetch(i,e),parseXML:i=>new DOMParser().parseFromString(i,"text/xml")},Ve={ADAPTER:iw,RESOLUTION:1,CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1};var ec=/iPhone/i,Qf=/iPod/i,ep=/iPad/i,tp=/\biOS-universal(?:.+)Mac\b/i,tc=/\bAndroid(?:.+)Mobile\b/i,ip=/Android/i,Lr=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,Fa=/Silk/i,tn=/Windows Phone/i,sp=/\bWindows(?:.+)ARM\b/i,np=/BlackBerry/i,rp=/BB10/i,op=/Opera Mini/i,ap=/\b(CriOS|Chrome)(?:.+)Mobile/i,lp=/Mobile(?:.+)Firefox\b/i,hp=function(i){return typeof i<"u"&&i.platform==="MacIntel"&&typeof i.maxTouchPoints=="number"&&i.maxTouchPoints>1&&typeof MSStream>"u"};function sw(i){return function(e){return e.test(i)}}function cp(i){var e={userAgent:"",platform:"",maxTouchPoints:0};!i&&typeof navigator<"u"?e={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0}:typeof i=="string"?e.userAgent=i:i&&i.userAgent&&(e={userAgent:i.userAgent,platform:i.platform,maxTouchPoints:i.maxTouchPoints||0});var t=e.userAgent,s=t.split("[FBAN");typeof s[1]<"u"&&(t=s[0]),s=t.split("Twitter"),typeof s[1]<"u"&&(t=s[0]);var n=sw(t),r={apple:{phone:n(ec)&&!n(tn),ipod:n(Qf),tablet:!n(ec)&&(n(ep)||hp(e))&&!n(tn),universal:n(tp),device:(n(ec)||n(Qf)||n(ep)||n(tp)||hp(e))&&!n(tn)},amazon:{phone:n(Lr),tablet:!n(Lr)&&n(Fa),device:n(Lr)||n(Fa)},android:{phone:!n(tn)&&n(Lr)||!n(tn)&&n(tc),tablet:!n(tn)&&!n(Lr)&&!n(tc)&&(n(Fa)||n(ip)),device:!n(tn)&&(n(Lr)||n(Fa)||n(tc)||n(ip))||n(/\bokhttp\b/i)},windows:{phone:n(tn),tablet:n(sp),device:n(tn)||n(sp)},other:{blackberry:n(np),blackberry10:n(rp),opera:n(op),firefox:n(lp),chrome:n(ap),device:n(np)||n(rp)||n(op)||n(lp)||n(ap)},any:!1,phone:!1,tablet:!1};return r.any=r.apple.device||r.android.device||r.windows.device||r.other.device,r.phone=r.apple.phone||r.android.phone||r.windows.phone,r.tablet=r.apple.tablet||r.android.tablet||r.windows.tablet,r}const nw=cp.default??cp,dn=nw(globalThis.navigator);Ve.RETINA_PREFIX=/@([0-9\.]+)x/;Ve.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!1;var Pl=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function N0(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}function rw(i){if(Object.prototype.hasOwnProperty.call(i,"__esModule"))return i;var e=i.default;if(typeof e=="function"){var t=function s(){return this instanceof s?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(i).forEach(function(s){var n=Object.getOwnPropertyDescriptor(i,s);Object.defineProperty(t,s,n.get?n:{enumerable:!0,get:function(){return i[s]}})}),t}var ic={exports:{}},up;function ow(){return up||(up=1,(function(i){var e=Object.prototype.hasOwnProperty,t="~";function s(){}Object.create&&(s.prototype=Object.create(null),new s().__proto__||(t=!1));function n(h,l,c){this.fn=h,this.context=l,this.once=c||!1}function r(h,l,c,u,f){if(typeof c!="function")throw new TypeError("The listener must be a function");var d=new n(c,u||h,f),m=t?t+l:l;return h._events[m]?h._events[m].fn?h._events[m]=[h._events[m],d]:h._events[m].push(d):(h._events[m]=d,h._eventsCount++),h}function o(h,l){--h._eventsCount===0?h._events=new s:delete h._events[l]}function a(){this._events=new s,this._eventsCount=0}a.prototype.eventNames=function(){var l=[],c,u;if(this._eventsCount===0)return l;for(u in c=this._events)e.call(c,u)&&l.push(t?u.slice(1):u);return Object.getOwnPropertySymbols?l.concat(Object.getOwnPropertySymbols(c)):l},a.prototype.listeners=function(l){var c=t?t+l:l,u=this._events[c];if(!u)return[];if(u.fn)return[u.fn];for(var f=0,d=u.length,m=new Array(d);f<d;f++)m[f]=u[f].fn;return m},a.prototype.listenerCount=function(l){var c=t?t+l:l,u=this._events[c];return u?u.fn?1:u.length:0},a.prototype.emit=function(l,c,u,f,d,m){var g=t?t+l:l;if(!this._events[g])return!1;var b=this._events[g],_=arguments.length,M,v;if(b.fn){switch(b.once&&this.removeListener(l,b.fn,void 0,!0),_){case 1:return b.fn.call(b.context),!0;case 2:return b.fn.call(b.context,c),!0;case 3:return b.fn.call(b.context,c,u),!0;case 4:return b.fn.call(b.context,c,u,f),!0;case 5:return b.fn.call(b.context,c,u,f,d),!0;case 6:return b.fn.call(b.context,c,u,f,d,m),!0}for(v=1,M=new Array(_-1);v<_;v++)M[v-1]=arguments[v];b.fn.apply(b.context,M)}else{var S=b.length,y;for(v=0;v<S;v++)switch(b[v].once&&this.removeListener(l,b[v].fn,void 0,!0),_){case 1:b[v].fn.call(b[v].context);break;case 2:b[v].fn.call(b[v].context,c);break;case 3:b[v].fn.call(b[v].context,c,u);break;case 4:b[v].fn.call(b[v].context,c,u,f);break;default:if(!M)for(y=1,M=new Array(_-1);y<_;y++)M[y-1]=arguments[y];b[v].fn.apply(b[v].context,M)}}return!0},a.prototype.on=function(l,c,u){return r(this,l,c,u,!1)},a.prototype.once=function(l,c,u){return r(this,l,c,u,!0)},a.prototype.removeListener=function(l,c,u,f){var d=t?t+l:l;if(!this._events[d])return this;if(!c)return o(this,d),this;var m=this._events[d];if(m.fn)m.fn===c&&(!f||m.once)&&(!u||m.context===u)&&o(this,d);else{for(var g=0,b=[],_=m.length;g<_;g++)(m[g].fn!==c||f&&!m[g].once||u&&m[g].context!==u)&&b.push(m[g]);b.length?this._events[d]=b.length===1?b[0]:b:o(this,d)}return this},a.prototype.removeAllListeners=function(l){var c;return l?(c=t?t+l:l,this._events[c]&&o(this,c)):(this._events=new s,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=t,a.EventEmitter=a,i.exports=a})(ic)),ic.exports}var aw=ow();const Sa=N0(aw);var Oa={exports:{}},dp;function lw(){if(dp)return Oa.exports;dp=1,Oa.exports=i,Oa.exports.default=i;function i(O,L,P){P=P||2;var X=L&&L.length,U=X?L[0]*P:O.length,Y=e(O,0,U,P,!0),q=[];if(!Y||Y.next===Y.prev)return q;var z,ne,H,Z,ae,me,_e;if(X&&(Y=h(O,L,Y,P)),O.length>80*P){z=H=O[0],ne=Z=O[1];for(var te=P;te<U;te+=P)ae=O[te],me=O[te+1],ae<z&&(z=ae),me<ne&&(ne=me),ae>H&&(H=ae),me>Z&&(Z=me);_e=Math.max(H-z,Z-ne),_e=_e!==0?32767/_e:0}return s(Y,q,P,z,ne,_e,0),q}function e(O,L,P,X,U){var Y,q;if(U===j(O,L,P,X)>0)for(Y=L;Y<P;Y+=X)q=F(Y,O[Y],O[Y+1],q);else for(Y=P-X;Y>=L;Y-=X)q=F(Y,O[Y],O[Y+1],q);return q&&S(q,q.next)&&(D(q),q=q.next),q}function t(O,L){if(!O)return O;L||(L=O);var P=O,X;do if(X=!1,!P.steiner&&(S(P,P.next)||v(P.prev,P,P.next)===0)){if(D(P),P=L=P.prev,P===P.next)break;X=!0}else P=P.next;while(X||P!==L);return L}function s(O,L,P,X,U,Y,q){if(O){!q&&Y&&d(O,X,U,Y);for(var z=O,ne,H;O.prev!==O.next;){if(ne=O.prev,H=O.next,Y?r(O,X,U,Y):n(O)){L.push(ne.i/P|0),L.push(O.i/P|0),L.push(H.i/P|0),D(O),O=H.next,z=H.next;continue}if(O=H,O===z){q?q===1?(O=o(t(O),L,P),s(O,L,P,X,U,Y,2)):q===2&&a(O,L,P,X,U,Y):s(t(O),L,P,X,U,Y,1);break}}}}function n(O){var L=O.prev,P=O,X=O.next;if(v(L,P,X)>=0)return!1;for(var U=L.x,Y=P.x,q=X.x,z=L.y,ne=P.y,H=X.y,Z=U<Y?U<q?U:q:Y<q?Y:q,ae=z<ne?z<H?z:H:ne<H?ne:H,me=U>Y?U>q?U:q:Y>q?Y:q,_e=z>ne?z>H?z:H:ne>H?ne:H,te=X.next;te!==L;){if(te.x>=Z&&te.x<=me&&te.y>=ae&&te.y<=_e&&_(U,z,Y,ne,q,H,te.x,te.y)&&v(te.prev,te,te.next)>=0)return!1;te=te.next}return!0}function r(O,L,P,X){var U=O.prev,Y=O,q=O.next;if(v(U,Y,q)>=0)return!1;for(var z=U.x,ne=Y.x,H=q.x,Z=U.y,ae=Y.y,me=q.y,_e=z<ne?z<H?z:H:ne<H?ne:H,te=Z<ae?Z<me?Z:me:ae<me?ae:me,ve=z>ne?z>H?z:H:ne>H?ne:H,$=Z>ae?Z>me?Z:me:ae>me?ae:me,W=g(_e,te,L,P,X),J=g(ve,$,L,P,X),Q=O.prevZ,ie=O.nextZ;Q&&Q.z>=W&&ie&&ie.z<=J;){if(Q.x>=_e&&Q.x<=ve&&Q.y>=te&&Q.y<=$&&Q!==U&&Q!==q&&_(z,Z,ne,ae,H,me,Q.x,Q.y)&&v(Q.prev,Q,Q.next)>=0||(Q=Q.prevZ,ie.x>=_e&&ie.x<=ve&&ie.y>=te&&ie.y<=$&&ie!==U&&ie!==q&&_(z,Z,ne,ae,H,me,ie.x,ie.y)&&v(ie.prev,ie,ie.next)>=0))return!1;ie=ie.nextZ}for(;Q&&Q.z>=W;){if(Q.x>=_e&&Q.x<=ve&&Q.y>=te&&Q.y<=$&&Q!==U&&Q!==q&&_(z,Z,ne,ae,H,me,Q.x,Q.y)&&v(Q.prev,Q,Q.next)>=0)return!1;Q=Q.prevZ}for(;ie&&ie.z<=J;){if(ie.x>=_e&&ie.x<=ve&&ie.y>=te&&ie.y<=$&&ie!==U&&ie!==q&&_(z,Z,ne,ae,H,me,ie.x,ie.y)&&v(ie.prev,ie,ie.next)>=0)return!1;ie=ie.nextZ}return!0}function o(O,L,P){var X=O;do{var U=X.prev,Y=X.next.next;!S(U,Y)&&y(U,X,X.next,Y)&&R(U,Y)&&R(Y,U)&&(L.push(U.i/P|0),L.push(X.i/P|0),L.push(Y.i/P|0),D(X),D(X.next),X=O=Y),X=X.next}while(X!==O);return t(X)}function a(O,L,P,X,U,Y){var q=O;do{for(var z=q.next.next;z!==q.prev;){if(q.i!==z.i&&M(q,z)){var ne=k(q,z);q=t(q,q.next),ne=t(ne,ne.next),s(q,L,P,X,U,Y,0),s(ne,L,P,X,U,Y,0);return}z=z.next}q=q.next}while(q!==O)}function h(O,L,P,X){var U=[],Y,q,z,ne,H;for(Y=0,q=L.length;Y<q;Y++)z=L[Y]*X,ne=Y<q-1?L[Y+1]*X:O.length,H=e(O,z,ne,X,!1),H===H.next&&(H.steiner=!0),U.push(b(H));for(U.sort(l),Y=0;Y<U.length;Y++)P=c(U[Y],P);return P}function l(O,L){return O.x-L.x}function c(O,L){var P=u(O,L);if(!P)return L;var X=k(P,O);return t(X,X.next),t(P,P.next)}function u(O,L){var P=L,X=O.x,U=O.y,Y=-1/0,q;do{if(U<=P.y&&U>=P.next.y&&P.next.y!==P.y){var z=P.x+(U-P.y)*(P.next.x-P.x)/(P.next.y-P.y);if(z<=X&&z>Y&&(Y=z,q=P.x<P.next.x?P:P.next,z===X))return q}P=P.next}while(P!==L);if(!q)return null;var ne=q,H=q.x,Z=q.y,ae=1/0,me;P=q;do X>=P.x&&P.x>=H&&X!==P.x&&_(U<Z?X:Y,U,H,Z,U<Z?Y:X,U,P.x,P.y)&&(me=Math.abs(U-P.y)/(X-P.x),R(P,O)&&(me<ae||me===ae&&(P.x>q.x||P.x===q.x&&f(q,P)))&&(q=P,ae=me)),P=P.next;while(P!==ne);return q}function f(O,L){return v(O.prev,O,L.prev)<0&&v(L.next,O,O.next)<0}function d(O,L,P,X){var U=O;do U.z===0&&(U.z=g(U.x,U.y,L,P,X)),U.prevZ=U.prev,U.nextZ=U.next,U=U.next;while(U!==O);U.prevZ.nextZ=null,U.prevZ=null,m(U)}function m(O){var L,P,X,U,Y,q,z,ne,H=1;do{for(P=O,O=null,Y=null,q=0;P;){for(q++,X=P,z=0,L=0;L<H&&(z++,X=X.nextZ,!!X);L++);for(ne=H;z>0||ne>0&&X;)z!==0&&(ne===0||!X||P.z<=X.z)?(U=P,P=P.nextZ,z--):(U=X,X=X.nextZ,ne--),Y?Y.nextZ=U:O=U,U.prevZ=Y,Y=U;P=X}Y.nextZ=null,H*=2}while(q>1);return O}function g(O,L,P,X,U){return O=(O-P)*U|0,L=(L-X)*U|0,O=(O|O<<8)&16711935,O=(O|O<<4)&252645135,O=(O|O<<2)&858993459,O=(O|O<<1)&1431655765,L=(L|L<<8)&16711935,L=(L|L<<4)&252645135,L=(L|L<<2)&858993459,L=(L|L<<1)&1431655765,O|L<<1}function b(O){var L=O,P=O;do(L.x<P.x||L.x===P.x&&L.y<P.y)&&(P=L),L=L.next;while(L!==O);return P}function _(O,L,P,X,U,Y,q,z){return(U-q)*(L-z)>=(O-q)*(Y-z)&&(O-q)*(X-z)>=(P-q)*(L-z)&&(P-q)*(Y-z)>=(U-q)*(X-z)}function M(O,L){return O.next.i!==L.i&&O.prev.i!==L.i&&!C(O,L)&&(R(O,L)&&R(L,O)&&B(O,L)&&(v(O.prev,O,L.prev)||v(O,L.prev,L))||S(O,L)&&v(O.prev,O,O.next)>0&&v(L.prev,L,L.next)>0)}function v(O,L,P){return(L.y-O.y)*(P.x-L.x)-(L.x-O.x)*(P.y-L.y)}function S(O,L){return O.x===L.x&&O.y===L.y}function y(O,L,P,X){var U=E(v(O,L,P)),Y=E(v(O,L,X)),q=E(v(P,X,O)),z=E(v(P,X,L));return!!(U!==Y&&q!==z||U===0&&I(O,P,L)||Y===0&&I(O,X,L)||q===0&&I(P,O,X)||z===0&&I(P,L,X))}function I(O,L,P){return L.x<=Math.max(O.x,P.x)&&L.x>=Math.min(O.x,P.x)&&L.y<=Math.max(O.y,P.y)&&L.y>=Math.min(O.y,P.y)}function E(O){return O>0?1:O<0?-1:0}function C(O,L){var P=O;do{if(P.i!==O.i&&P.next.i!==O.i&&P.i!==L.i&&P.next.i!==L.i&&y(P,P.next,O,L))return!0;P=P.next}while(P!==O);return!1}function R(O,L){return v(O.prev,O,O.next)<0?v(O,L,O.next)>=0&&v(O,O.prev,L)>=0:v(O,L,O.prev)<0||v(O,O.next,L)<0}function B(O,L){var P=O,X=!1,U=(O.x+L.x)/2,Y=(O.y+L.y)/2;do P.y>Y!=P.next.y>Y&&P.next.y!==P.y&&U<(P.next.x-P.x)*(Y-P.y)/(P.next.y-P.y)+P.x&&(X=!X),P=P.next;while(P!==O);return X}function k(O,L){var P=new N(O.i,O.x,O.y),X=new N(L.i,L.x,L.y),U=O.next,Y=L.prev;return O.next=L,L.prev=O,P.next=U,U.prev=P,X.next=P,P.prev=X,Y.next=X,X.prev=Y,X}function F(O,L,P,X){var U=new N(O,L,P);return X?(U.next=X.next,U.prev=X,X.next.prev=U,X.next=U):(U.prev=U,U.next=U),U}function D(O){O.next.prev=O.prev,O.prev.next=O.next,O.prevZ&&(O.prevZ.nextZ=O.nextZ),O.nextZ&&(O.nextZ.prevZ=O.prevZ)}function N(O,L,P){this.i=O,this.x=L,this.y=P,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}i.deviation=function(O,L,P,X){var U=L&&L.length,Y=U?L[0]*P:O.length,q=Math.abs(j(O,0,Y,P));if(U)for(var z=0,ne=L.length;z<ne;z++){var H=L[z]*P,Z=z<ne-1?L[z+1]*P:O.length;q-=Math.abs(j(O,H,Z,P))}var ae=0;for(z=0;z<X.length;z+=3){var me=X[z]*P,_e=X[z+1]*P,te=X[z+2]*P;ae+=Math.abs((O[me]-O[te])*(O[_e+1]-O[me+1])-(O[me]-O[_e])*(O[te+1]-O[me+1]))}return q===0&&ae===0?0:Math.abs((ae-q)/q)};function j(O,L,P,X){for(var U=0,Y=L,q=P-X;Y<P;Y+=X)U+=(O[q]-O[Y])*(O[Y+1]+O[q+1]),q=Y;return U}return i.flatten=function(O){for(var L=O[0][0].length,P={vertices:[],holes:[],dimensions:L},X=0,U=0;U<O.length;U++){for(var Y=0;Y<O[U].length;Y++)for(var q=0;q<L;q++)P.vertices.push(O[U][Y][q]);U>0&&(X+=O[U-1].length,P.holes.push(X))}return P},Oa.exports}var hw=lw();const cw=N0(hw);var rr={},Yo={exports:{}};/*! https://mths.be/punycode v1.4.1 by @mathias */var uw=Yo.exports,fp;function dw(){return fp||(fp=1,(function(i,e){(function(t){var s=e&&!e.nodeType&&e,n=i&&!i.nodeType&&i,r=typeof Pl=="object"&&Pl;(r.global===r||r.window===r||r.self===r)&&(t=r);var o,a=2147483647,h=36,l=1,c=26,u=38,f=700,d=72,m=128,g="-",b=/^xn--/,_=/[^\x20-\x7E]/,M=/[\x2E\u3002\uFF0E\uFF61]/g,v={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},S=h-l,y=Math.floor,I=String.fromCharCode,E;function C(U){throw new RangeError(v[U])}function R(U,Y){for(var q=U.length,z=[];q--;)z[q]=Y(U[q]);return z}function B(U,Y){var q=U.split("@"),z="";q.length>1&&(z=q[0]+"@",U=q[1]),U=U.replace(M,".");var ne=U.split("."),H=R(ne,Y).join(".");return z+H}function k(U){for(var Y=[],q=0,z=U.length,ne,H;q<z;)ne=U.charCodeAt(q++),ne>=55296&&ne<=56319&&q<z?(H=U.charCodeAt(q++),(H&64512)==56320?Y.push(((ne&1023)<<10)+(H&1023)+65536):(Y.push(ne),q--)):Y.push(ne);return Y}function F(U){return R(U,function(Y){var q="";return Y>65535&&(Y-=65536,q+=I(Y>>>10&1023|55296),Y=56320|Y&1023),q+=I(Y),q}).join("")}function D(U){return U-48<10?U-22:U-65<26?U-65:U-97<26?U-97:h}function N(U,Y){return U+22+75*(U<26)-((Y!=0)<<5)}function j(U,Y,q){var z=0;for(U=q?y(U/f):U>>1,U+=y(U/Y);U>S*c>>1;z+=h)U=y(U/S);return y(z+(S+1)*U/(U+u))}function O(U){var Y=[],q=U.length,z,ne=0,H=m,Z=d,ae,me,_e,te,ve,$,W,J,Q;for(ae=U.lastIndexOf(g),ae<0&&(ae=0),me=0;me<ae;++me)U.charCodeAt(me)>=128&&C("not-basic"),Y.push(U.charCodeAt(me));for(_e=ae>0?ae+1:0;_e<q;){for(te=ne,ve=1,$=h;_e>=q&&C("invalid-input"),W=D(U.charCodeAt(_e++)),(W>=h||W>y((a-ne)/ve))&&C("overflow"),ne+=W*ve,J=$<=Z?l:$>=Z+c?c:$-Z,!(W<J);$+=h)Q=h-J,ve>y(a/Q)&&C("overflow"),ve*=Q;z=Y.length+1,Z=j(ne-te,z,te==0),y(ne/z)>a-H&&C("overflow"),H+=y(ne/z),ne%=z,Y.splice(ne++,0,H)}return F(Y)}function L(U){var Y,q,z,ne,H,Z,ae,me,_e,te,ve,$=[],W,J,Q,ie;for(U=k(U),W=U.length,Y=m,q=0,H=d,Z=0;Z<W;++Z)ve=U[Z],ve<128&&$.push(I(ve));for(z=ne=$.length,ne&&$.push(g);z<W;){for(ae=a,Z=0;Z<W;++Z)ve=U[Z],ve>=Y&&ve<ae&&(ae=ve);for(J=z+1,ae-Y>y((a-q)/J)&&C("overflow"),q+=(ae-Y)*J,Y=ae,Z=0;Z<W;++Z)if(ve=U[Z],ve<Y&&++q>a&&C("overflow"),ve==Y){for(me=q,_e=h;te=_e<=H?l:_e>=H+c?c:_e-H,!(me<te);_e+=h)ie=me-te,Q=h-te,$.push(I(N(te+ie%Q,0))),me=y(ie/Q);$.push(I(N(me,0))),H=j(q,J,z==ne),q=0,++z}++q,++Y}return $.join("")}function P(U){return B(U,function(Y){return b.test(Y)?O(Y.slice(4).toLowerCase()):Y})}function X(U){return B(U,function(Y){return _.test(Y)?"xn--"+L(Y):Y})}if(o={version:"1.4.1",ucs2:{decode:k,encode:F},decode:O,encode:L,toASCII:X,toUnicode:P},s&&n)if(i.exports==s)n.exports=o;else for(E in o)o.hasOwnProperty(E)&&(s[E]=o[E]);else t.punycode=o})(uw)})(Yo,Yo.exports)),Yo.exports}var sc,pp;function So(){return pp||(pp=1,sc=TypeError),sc}const fw={},pw=Object.freeze(Object.defineProperty({__proto__:null,default:fw},Symbol.toStringTag,{value:"Module"})),mw=rw(pw);var nc,mp;function Eh(){if(mp)return nc;mp=1;var i=typeof Map=="function"&&Map.prototype,e=Object.getOwnPropertyDescriptor&&i?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,t=i&&e&&typeof e.get=="function"?e.get:null,s=i&&Map.prototype.forEach,n=typeof Set=="function"&&Set.prototype,r=Object.getOwnPropertyDescriptor&&n?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,o=n&&r&&typeof r.get=="function"?r.get:null,a=n&&Set.prototype.forEach,h=typeof WeakMap=="function"&&WeakMap.prototype,l=h?WeakMap.prototype.has:null,c=typeof WeakSet=="function"&&WeakSet.prototype,u=c?WeakSet.prototype.has:null,f=typeof WeakRef=="function"&&WeakRef.prototype,d=f?WeakRef.prototype.deref:null,m=Boolean.prototype.valueOf,g=Object.prototype.toString,b=Function.prototype.toString,_=String.prototype.match,M=String.prototype.slice,v=String.prototype.replace,S=String.prototype.toUpperCase,y=String.prototype.toLowerCase,I=RegExp.prototype.test,E=Array.prototype.concat,C=Array.prototype.join,R=Array.prototype.slice,B=Math.floor,k=typeof BigInt=="function"?BigInt.prototype.valueOf:null,F=Object.getOwnPropertySymbols,D=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,N=typeof Symbol=="function"&&typeof Symbol.iterator=="object",j=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===N||!0)?Symbol.toStringTag:null,O=Object.prototype.propertyIsEnumerable,L=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(re){return re.__proto__}:null);function P(re,le){if(re===1/0||re===-1/0||re!==re||re&&re>-1e3&&re<1e3||I.call(/e/,le))return le;var ft=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof re=="number"){var It=re<0?-B(-re):B(re);if(It!==re){var Pt=String(It),nt=M.call(le,Pt.length+1);return v.call(Pt,ft,"$&_")+"."+v.call(v.call(nt,/([0-9]{3})/g,"$&_"),/_$/,"")}}return v.call(le,ft,"$&_")}var X=mw,U=X.custom,Y=J(U)?U:null,q={__proto__:null,double:'"',single:"'"},z={__proto__:null,double:/(["\\])/g,single:/(['\\])/g};nc=function re(le,ft,It,Pt){var nt=ft||{};if(ue(nt,"quoteStyle")&&!ue(q,nt.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(ue(nt,"maxStringLength")&&(typeof nt.maxStringLength=="number"?nt.maxStringLength<0&&nt.maxStringLength!==1/0:nt.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var $i=ue(nt,"customInspect")?nt.customInspect:!0;if(typeof $i!="boolean"&&$i!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(ue(nt,"indent")&&nt.indent!==null&&nt.indent!==" "&&!(parseInt(nt.indent,10)===nt.indent&&nt.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(ue(nt,"numericSeparator")&&typeof nt.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var Ji=nt.numericSeparator;if(typeof le>"u")return"undefined";if(le===null)return"null";if(typeof le=="boolean")return le?"true":"false";if(typeof le=="string")return wt(le,nt);if(typeof le=="number"){if(le===0)return 1/0/le>0?"0":"-0";var li=String(le);return Ji?P(le,li):li}if(typeof le=="bigint"){var Gi=String(le)+"n";return Ji?P(le,Gi):Gi}var er=typeof nt.depth>"u"?5:nt.depth;if(typeof It>"u"&&(It=0),It>=er&&er>0&&typeof le=="object")return ae(le)?"[Array]":"[Object]";var Oi=Zi(nt,It);if(typeof Pt>"u")Pt=[];else if(Ee(Pt,le)>=0)return"[Circular]";function Qt(V,K,oe){if(K&&(Pt=R.call(Pt),Pt.push(K)),oe){var pe={depth:nt.depth};return ue(nt,"quoteStyle")&&(pe.quoteStyle=nt.quoteStyle),re(V,pe,It+1,Pt)}return re(V,nt,It+1,Pt)}if(typeof le=="function"&&!_e(le)){var Pr=Me(le),kr=$t(le,Qt);return"[Function"+(Pr?": "+Pr:" (anonymous)")+"]"+(kr.length>0?" { "+C.call(kr,", ")+" }":"")}if(J(le)){var Mn=N?v.call(String(le),/^(Symbol\(.*\))_[^)]*$/,"$1"):D.call(le);return typeof le=="object"&&!N?Mt(Mn):Mn}if(ct(le)){for(var Zs="<"+y.call(String(le.nodeName)),En=le.attributes||[],Js=0;Js<En.length;Js++)Zs+=" "+En[Js].name+"="+ne(H(En[Js].value),"double",nt);return Zs+=">",le.childNodes&&le.childNodes.length&&(Zs+="..."),Zs+="</"+y.call(String(le.nodeName))+">",Zs}if(ae(le)){if(le.length===0)return"[]";var An=$t(le,Qt);return Oi&&!Jt(An)?"["+xs(An,Oi)+"]":"[ "+C.call(An,", ")+" ]"}if(te(le)){var bs=$t(le,Qt);return!("cause"in Error.prototype)&&"cause"in le&&!O.call(le,"cause")?"{ ["+String(le)+"] "+C.call(E.call("[cause]: "+Qt(le.cause),bs),", ")+" }":bs.length===0?"["+String(le)+"]":"{ ["+String(le)+"] "+C.call(bs,", ")+" }"}if(typeof le=="object"&&$i){if(Y&&typeof le[Y]=="function"&&X)return X(le,{depth:er-It});if($i!=="symbol"&&typeof le.inspect=="function")return le.inspect()}if(de(le)){var Bi=[];return s&&s.call(le,function(V,K){Bi.push(Qt(K,le,!0)+" => "+Qt(V,le))}),ai("Map",t.call(le),Bi,Oi)}if(Be(le)){var Qi=[];return a&&a.call(le,function(V){Qi.push(Qt(V,le))}),ai("Set",o.call(le),Qi,Oi)}if(De(le))return Ct("WeakMap");if(Ke(le))return Ct("WeakSet");if(Ie(le))return Ct("WeakRef");if($(le))return Mt(Qt(Number(le)));if(Q(le))return Mt(Qt(k.call(le)));if(W(le))return Mt(m.call(le));if(ve(le))return Mt(Qt(String(le)));if(typeof window<"u"&&le===window)return"{ [object Window] }";if(typeof globalThis<"u"&&le===globalThis||typeof Pl<"u"&&le===Pl)return"{ [object globalThis] }";if(!me(le)&&!_e(le)){var ws=$t(le,Qt),tr=L?L(le)===Object.prototype:le instanceof Object||le.constructor===Object,G=le instanceof Object?"":"null prototype",T=!tr&&j&&Object(le)===le&&j in le?M.call(Se(le),8,-1):G?"Object":"",p=tr||typeof le.constructor!="function"?"":le.constructor.name?le.constructor.name+" ":"",x=p+(T||G?"["+C.call(E.call([],T||[],G||[]),": ")+"] ":"");return ws.length===0?x+"{}":Oi?x+"{"+xs(ws,Oi)+"}":x+"{ "+C.call(ws,", ")+" }"}return String(le)};function ne(re,le,ft){var It=ft.quoteStyle||le,Pt=q[It];return Pt+re+Pt}function H(re){return v.call(String(re),/"/g,""")}function Z(re){return!j||!(typeof re=="object"&&(j in re||typeof re[j]<"u"))}function ae(re){return Se(re)==="[object Array]"&&Z(re)}function me(re){return Se(re)==="[object Date]"&&Z(re)}function _e(re){return Se(re)==="[object RegExp]"&&Z(re)}function te(re){return Se(re)==="[object Error]"&&Z(re)}function ve(re){return Se(re)==="[object String]"&&Z(re)}function $(re){return Se(re)==="[object Number]"&&Z(re)}function W(re){return Se(re)==="[object Boolean]"&&Z(re)}function J(re){if(N)return re&&typeof re=="object"&&re instanceof Symbol;if(typeof re=="symbol")return!0;if(!re||typeof re!="object"||!D)return!1;try{return D.call(re),!0}catch{}return!1}function Q(re){if(!re||typeof re!="object"||!k)return!1;try{return k.call(re),!0}catch{}return!1}var ie=Object.prototype.hasOwnProperty||function(re){return re in this};function ue(re,le){return ie.call(re,le)}function Se(re){return g.call(re)}function Me(re){if(re.name)return re.name;var le=_.call(b.call(re),/^function\s*([\w$]+)/);return le?le[1]:null}function Ee(re,le){if(re.indexOf)return re.indexOf(le);for(var ft=0,It=re.length;ft<It;ft++)if(re[ft]===le)return ft;return-1}function de(re){if(!t||!re||typeof re!="object")return!1;try{t.call(re);try{o.call(re)}catch{return!0}return re instanceof Map}catch{}return!1}function De(re){if(!l||!re||typeof re!="object")return!1;try{l.call(re,l);try{u.call(re,u)}catch{return!0}return re instanceof WeakMap}catch{}return!1}function Ie(re){if(!d||!re||typeof re!="object")return!1;try{return d.call(re),!0}catch{}return!1}function Be(re){if(!o||!re||typeof re!="object")return!1;try{o.call(re);try{t.call(re)}catch{return!0}return re instanceof Set}catch{}return!1}function Ke(re){if(!u||!re||typeof re!="object")return!1;try{u.call(re,u);try{l.call(re,l)}catch{return!0}return re instanceof WeakSet}catch{}return!1}function ct(re){return!re||typeof re!="object"?!1:typeof HTMLElement<"u"&&re instanceof HTMLElement?!0:typeof re.nodeName=="string"&&typeof re.getAttribute=="function"}function wt(re,le){if(re.length>le.maxStringLength){var ft=re.length-le.maxStringLength,It="... "+ft+" more character"+(ft>1?"s":"");return wt(M.call(re,0,le.maxStringLength),le)+It}var Pt=z[le.quoteStyle||"single"];Pt.lastIndex=0;var nt=v.call(v.call(re,Pt,"\\$1"),/[\x00-\x1f]/g,dt);return ne(nt,"single",le)}function dt(re){var le=re.charCodeAt(0),ft={8:"b",9:"t",10:"n",12:"f",13:"r"}[le];return ft?"\\"+ft:"\\x"+(le<16?"0":"")+S.call(le.toString(16))}function Mt(re){return"Object("+re+")"}function Ct(re){return re+" { ? }"}function ai(re,le,ft,It){var Pt=It?xs(ft,It):C.call(ft,", ");return re+" ("+le+") {"+Pt+"}"}function Jt(re){for(var le=0;le<re.length;le++)if(Ee(re[le],`
|
||
`)>=0)return!1;return!0}function Zi(re,le){var ft;if(re.indent===" ")ft=" ";else if(typeof re.indent=="number"&&re.indent>0)ft=C.call(Array(re.indent+1)," ");else return null;return{base:ft,prev:C.call(Array(le+1),ft)}}function xs(re,le){if(re.length===0)return"";var ft=`
|
||
`+le.prev+le.base;return ft+C.call(re,","+ft)+`
|
||
`+le.prev}function $t(re,le){var ft=ae(re),It=[];if(ft){It.length=re.length;for(var Pt=0;Pt<re.length;Pt++)It[Pt]=ue(re,Pt)?le(re[Pt],re):""}var nt=typeof F=="function"?F(re):[],$i;if(N){$i={};for(var Ji=0;Ji<nt.length;Ji++)$i["$"+nt[Ji]]=nt[Ji]}for(var li in re)ue(re,li)&&(ft&&String(Number(li))===li&&li<re.length||N&&$i["$"+li]instanceof Symbol||(I.call(/[^\w$]/,li)?It.push(le(li,re)+": "+le(re[li],re)):It.push(li+": "+le(re[li],re))));if(typeof F=="function")for(var Gi=0;Gi<nt.length;Gi++)O.call(re,nt[Gi])&&It.push("["+le(nt[Gi])+"]: "+le(re[nt[Gi]],re));return It}return nc}var rc,gp;function gw(){if(gp)return rc;gp=1;var i=Eh(),e=So(),t=function(a,h,l){for(var c=a,u;(u=c.next)!=null;c=u)if(u.key===h)return c.next=u.next,l||(u.next=a.next,a.next=u),u},s=function(a,h){if(a){var l=t(a,h);return l&&l.value}},n=function(a,h,l){var c=t(a,h);c?c.value=l:a.next={key:h,next:a.next,value:l}},r=function(a,h){return a?!!t(a,h):!1},o=function(a,h){if(a)return t(a,h,!0)};return rc=function(){var h,l={assert:function(c){if(!l.has(c))throw new e("Side channel does not contain "+i(c))},delete:function(c){var u=o(h,c);return u&&h&&!h.next&&(h=void 0),!!u},get:function(c){return s(h,c)},has:function(c){return r(h,c)},set:function(c,u){h||(h={next:void 0}),n(h,c,u)}};return l},rc}var oc,vp;function U0(){return vp||(vp=1,oc=Object),oc}var ac,yp;function vw(){return yp||(yp=1,ac=Error),ac}var lc,xp;function yw(){return xp||(xp=1,lc=EvalError),lc}var hc,bp;function xw(){return bp||(bp=1,hc=RangeError),hc}var cc,wp;function bw(){return wp||(wp=1,cc=ReferenceError),cc}var uc,_p;function ww(){return _p||(_p=1,uc=SyntaxError),uc}var dc,Sp;function _w(){return Sp||(Sp=1,dc=URIError),dc}var fc,Tp;function Sw(){return Tp||(Tp=1,fc=Math.abs),fc}var pc,Mp;function Tw(){return Mp||(Mp=1,pc=Math.floor),pc}var mc,Ep;function Mw(){return Ep||(Ep=1,mc=Math.max),mc}var gc,Ap;function Ew(){return Ap||(Ap=1,gc=Math.min),gc}var vc,Cp;function Aw(){return Cp||(Cp=1,vc=Math.pow),vc}var yc,Ip;function Cw(){return Ip||(Ip=1,yc=Math.round),yc}var xc,Rp;function Iw(){return Rp||(Rp=1,xc=Number.isNaN||function(e){return e!==e}),xc}var bc,Pp;function Rw(){if(Pp)return bc;Pp=1;var i=Iw();return bc=function(t){return i(t)||t===0?t:t<0?-1:1},bc}var wc,kp;function Pw(){return kp||(kp=1,wc=Object.getOwnPropertyDescriptor),wc}var _c,Fp;function V0(){if(Fp)return _c;Fp=1;var i=Pw();if(i)try{i([],"length")}catch{i=null}return _c=i,_c}var Sc,Op;function X0(){if(Op)return Sc;Op=1;var i=Object.defineProperty||!1;if(i)try{i({},"a",{value:1})}catch{i=!1}return Sc=i,Sc}var Tc,Bp;function kw(){return Bp||(Bp=1,Tc=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},t=Symbol("test"),s=Object(t);if(typeof t=="string"||Object.prototype.toString.call(t)!=="[object Symbol]"||Object.prototype.toString.call(s)!=="[object Symbol]")return!1;var n=42;e[t]=n;for(var r in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var o=Object.getOwnPropertySymbols(e);if(o.length!==1||o[0]!==t||!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var a=Object.getOwnPropertyDescriptor(e,t);if(a.value!==n||a.enumerable!==!0)return!1}return!0}),Tc}var Mc,Lp;function Fw(){if(Lp)return Mc;Lp=1;var i=typeof Symbol<"u"&&Symbol,e=kw();return Mc=function(){return typeof i!="function"||typeof Symbol!="function"||typeof i("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:e()},Mc}var Ec,Dp;function Y0(){return Dp||(Dp=1,Ec=typeof Reflect<"u"&&Reflect.getPrototypeOf||null),Ec}var Ac,Np;function $0(){if(Np)return Ac;Np=1;var i=U0();return Ac=i.getPrototypeOf||null,Ac}var Cc,Up;function Ow(){if(Up)return Cc;Up=1;var i="Function.prototype.bind called on incompatible ",e=Object.prototype.toString,t=Math.max,s="[object Function]",n=function(h,l){for(var c=[],u=0;u<h.length;u+=1)c[u]=h[u];for(var f=0;f<l.length;f+=1)c[f+h.length]=l[f];return c},r=function(h,l){for(var c=[],u=l,f=0;u<h.length;u+=1,f+=1)c[f]=h[u];return c},o=function(a,h){for(var l="",c=0;c<a.length;c+=1)l+=a[c],c+1<a.length&&(l+=h);return l};return Cc=function(h){var l=this;if(typeof l!="function"||e.apply(l)!==s)throw new TypeError(i+l);for(var c=r(arguments,1),u,f=function(){if(this instanceof u){var _=l.apply(this,n(c,arguments));return Object(_)===_?_:this}return l.apply(h,n(c,arguments))},d=t(0,l.length-c.length),m=[],g=0;g<d;g++)m[g]="$"+g;if(u=Function("binder","return function ("+o(m,",")+"){ return binder.apply(this,arguments); }")(f),l.prototype){var b=function(){};b.prototype=l.prototype,u.prototype=new b,b.prototype=null}return u},Cc}var Ic,Vp;function Ah(){if(Vp)return Ic;Vp=1;var i=Ow();return Ic=Function.prototype.bind||i,Ic}var Rc,Xp;function Zd(){return Xp||(Xp=1,Rc=Function.prototype.call),Rc}var Pc,Yp;function G0(){return Yp||(Yp=1,Pc=Function.prototype.apply),Pc}var kc,$p;function Bw(){return $p||($p=1,kc=typeof Reflect<"u"&&Reflect&&Reflect.apply),kc}var Fc,Gp;function Lw(){if(Gp)return Fc;Gp=1;var i=Ah(),e=G0(),t=Zd(),s=Bw();return Fc=s||i.call(t,e),Fc}var Oc,jp;function j0(){if(jp)return Oc;jp=1;var i=Ah(),e=So(),t=Zd(),s=Lw();return Oc=function(r){if(r.length<1||typeof r[0]!="function")throw new e("a function is required");return s(i,t,r)},Oc}var Bc,Hp;function Dw(){if(Hp)return Bc;Hp=1;var i=j0(),e=V0(),t;try{t=[].__proto__===Array.prototype}catch(o){if(!o||typeof o!="object"||!("code"in o)||o.code!=="ERR_PROTO_ACCESS")throw o}var s=!!t&&e&&e(Object.prototype,"__proto__"),n=Object,r=n.getPrototypeOf;return Bc=s&&typeof s.get=="function"?i([s.get]):typeof r=="function"?function(a){return r(a==null?a:n(a))}:!1,Bc}var Lc,Wp;function Nw(){if(Wp)return Lc;Wp=1;var i=Y0(),e=$0(),t=Dw();return Lc=i?function(n){return i(n)}:e?function(n){if(!n||typeof n!="object"&&typeof n!="function")throw new TypeError("getProto: not an object");return e(n)}:t?function(n){return t(n)}:null,Lc}var Dc,zp;function Uw(){if(zp)return Dc;zp=1;var i=Function.prototype.call,e=Object.prototype.hasOwnProperty,t=Ah();return Dc=t.call(i,e),Dc}var Nc,qp;function Jd(){if(qp)return Nc;qp=1;var i,e=U0(),t=vw(),s=yw(),n=xw(),r=bw(),o=ww(),a=So(),h=_w(),l=Sw(),c=Tw(),u=Mw(),f=Ew(),d=Aw(),m=Cw(),g=Rw(),b=Function,_=function(_e){try{return b('"use strict"; return ('+_e+").constructor;")()}catch{}},M=V0(),v=X0(),S=function(){throw new a},y=M?(function(){try{return arguments.callee,S}catch{try{return M(arguments,"callee").get}catch{return S}}})():S,I=Fw()(),E=Nw(),C=$0(),R=Y0(),B=G0(),k=Zd(),F={},D=typeof Uint8Array>"u"||!E?i:E(Uint8Array),N={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?i:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?i:ArrayBuffer,"%ArrayIteratorPrototype%":I&&E?E([][Symbol.iterator]()):i,"%AsyncFromSyncIteratorPrototype%":i,"%AsyncFunction%":F,"%AsyncGenerator%":F,"%AsyncGeneratorFunction%":F,"%AsyncIteratorPrototype%":F,"%Atomics%":typeof Atomics>"u"?i:Atomics,"%BigInt%":typeof BigInt>"u"?i:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?i:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?i:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?i:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":t,"%eval%":eval,"%EvalError%":s,"%Float16Array%":typeof Float16Array>"u"?i:Float16Array,"%Float32Array%":typeof Float32Array>"u"?i:Float32Array,"%Float64Array%":typeof Float64Array>"u"?i:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?i:FinalizationRegistry,"%Function%":b,"%GeneratorFunction%":F,"%Int8Array%":typeof Int8Array>"u"?i:Int8Array,"%Int16Array%":typeof Int16Array>"u"?i:Int16Array,"%Int32Array%":typeof Int32Array>"u"?i:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":I&&E?E(E([][Symbol.iterator]())):i,"%JSON%":typeof JSON=="object"?JSON:i,"%Map%":typeof Map>"u"?i:Map,"%MapIteratorPrototype%":typeof Map>"u"||!I||!E?i:E(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":e,"%Object.getOwnPropertyDescriptor%":M,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?i:Promise,"%Proxy%":typeof Proxy>"u"?i:Proxy,"%RangeError%":n,"%ReferenceError%":r,"%Reflect%":typeof Reflect>"u"?i:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?i:Set,"%SetIteratorPrototype%":typeof Set>"u"||!I||!E?i:E(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?i:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":I&&E?E(""[Symbol.iterator]()):i,"%Symbol%":I?Symbol:i,"%SyntaxError%":o,"%ThrowTypeError%":y,"%TypedArray%":D,"%TypeError%":a,"%Uint8Array%":typeof Uint8Array>"u"?i:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?i:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?i:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?i:Uint32Array,"%URIError%":h,"%WeakMap%":typeof WeakMap>"u"?i:WeakMap,"%WeakRef%":typeof WeakRef>"u"?i:WeakRef,"%WeakSet%":typeof WeakSet>"u"?i:WeakSet,"%Function.prototype.call%":k,"%Function.prototype.apply%":B,"%Object.defineProperty%":v,"%Object.getPrototypeOf%":C,"%Math.abs%":l,"%Math.floor%":c,"%Math.max%":u,"%Math.min%":f,"%Math.pow%":d,"%Math.round%":m,"%Math.sign%":g,"%Reflect.getPrototypeOf%":R};if(E)try{null.error}catch(_e){var j=E(E(_e));N["%Error.prototype%"]=j}var O=function _e(te){var ve;if(te==="%AsyncFunction%")ve=_("async function () {}");else if(te==="%GeneratorFunction%")ve=_("function* () {}");else if(te==="%AsyncGeneratorFunction%")ve=_("async function* () {}");else if(te==="%AsyncGenerator%"){var $=_e("%AsyncGeneratorFunction%");$&&(ve=$.prototype)}else if(te==="%AsyncIteratorPrototype%"){var W=_e("%AsyncGenerator%");W&&E&&(ve=E(W.prototype))}return N[te]=ve,ve},L={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},P=Ah(),X=Uw(),U=P.call(k,Array.prototype.concat),Y=P.call(B,Array.prototype.splice),q=P.call(k,String.prototype.replace),z=P.call(k,String.prototype.slice),ne=P.call(k,RegExp.prototype.exec),H=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,Z=/\\(\\)?/g,ae=function(te){var ve=z(te,0,1),$=z(te,-1);if(ve==="%"&&$!=="%")throw new o("invalid intrinsic syntax, expected closing `%`");if($==="%"&&ve!=="%")throw new o("invalid intrinsic syntax, expected opening `%`");var W=[];return q(te,H,function(J,Q,ie,ue){W[W.length]=ie?q(ue,Z,"$1"):Q||J}),W},me=function(te,ve){var $=te,W;if(X(L,$)&&(W=L[$],$="%"+W[0]+"%"),X(N,$)){var J=N[$];if(J===F&&(J=O($)),typeof J>"u"&&!ve)throw new a("intrinsic "+te+" exists, but is not available. Please file an issue!");return{alias:W,name:$,value:J}}throw new o("intrinsic "+te+" does not exist!")};return Nc=function(te,ve){if(typeof te!="string"||te.length===0)throw new a("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof ve!="boolean")throw new a('"allowMissing" argument must be a boolean');if(ne(/^%?[^%]*%?$/,te)===null)throw new o("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var $=ae(te),W=$.length>0?$[0]:"",J=me("%"+W+"%",ve),Q=J.name,ie=J.value,ue=!1,Se=J.alias;Se&&(W=Se[0],Y($,U([0,1],Se)));for(var Me=1,Ee=!0;Me<$.length;Me+=1){var de=$[Me],De=z(de,0,1),Ie=z(de,-1);if((De==='"'||De==="'"||De==="`"||Ie==='"'||Ie==="'"||Ie==="`")&&De!==Ie)throw new o("property names with quotes must have matching quotes");if((de==="constructor"||!Ee)&&(ue=!0),W+="."+de,Q="%"+W+"%",X(N,Q))ie=N[Q];else if(ie!=null){if(!(de in ie)){if(!ve)throw new a("base intrinsic for "+te+" exists, but the property is not available.");return}if(M&&Me+1>=$.length){var Be=M(ie,de);Ee=!!Be,Ee&&"get"in Be&&!("originalValue"in Be.get)?ie=Be.get:ie=ie[de]}else Ee=X(ie,de),ie=ie[de];Ee&&!ue&&(N[Q]=ie)}}return ie},Nc}var Uc,Kp;function H0(){if(Kp)return Uc;Kp=1;var i=Jd(),e=j0(),t=e([i("%String.prototype.indexOf%")]);return Uc=function(n,r){var o=i(n,!!r);return typeof o=="function"&&t(n,".prototype.")>-1?e([o]):o},Uc}var Vc,Zp;function W0(){if(Zp)return Vc;Zp=1;var i=Jd(),e=H0(),t=Eh(),s=So(),n=i("%Map%",!0),r=e("Map.prototype.get",!0),o=e("Map.prototype.set",!0),a=e("Map.prototype.has",!0),h=e("Map.prototype.delete",!0),l=e("Map.prototype.size",!0);return Vc=!!n&&function(){var u,f={assert:function(d){if(!f.has(d))throw new s("Side channel does not contain "+t(d))},delete:function(d){if(u){var m=h(u,d);return l(u)===0&&(u=void 0),m}return!1},get:function(d){if(u)return r(u,d)},has:function(d){return u?a(u,d):!1},set:function(d,m){u||(u=new n),o(u,d,m)}};return f},Vc}var Xc,Jp;function Vw(){if(Jp)return Xc;Jp=1;var i=Jd(),e=H0(),t=Eh(),s=W0(),n=So(),r=i("%WeakMap%",!0),o=e("WeakMap.prototype.get",!0),a=e("WeakMap.prototype.set",!0),h=e("WeakMap.prototype.has",!0),l=e("WeakMap.prototype.delete",!0);return Xc=r?function(){var u,f,d={assert:function(m){if(!d.has(m))throw new n("Side channel does not contain "+t(m))},delete:function(m){if(r&&m&&(typeof m=="object"||typeof m=="function")){if(u)return l(u,m)}else if(s&&f)return f.delete(m);return!1},get:function(m){return r&&m&&(typeof m=="object"||typeof m=="function")&&u?o(u,m):f&&f.get(m)},has:function(m){return r&&m&&(typeof m=="object"||typeof m=="function")&&u?h(u,m):!!f&&f.has(m)},set:function(m,g){r&&m&&(typeof m=="object"||typeof m=="function")?(u||(u=new r),a(u,m,g)):s&&(f||(f=s()),f.set(m,g))}};return d}:s,Xc}var Yc,Qp;function z0(){if(Qp)return Yc;Qp=1;var i=So(),e=Eh(),t=gw(),s=W0(),n=Vw(),r=n||s||t;return Yc=function(){var a,h={assert:function(l){if(!h.has(l)){var c=l&&Object(l)===l?"the given object key":e(l);throw new i("Side channel does not contain "+c)}},delete:function(l){return!!a&&a.delete(l)},get:function(l){return a&&a.get(l)},has:function(l){return!!a&&a.has(l)},set:function(l,c){a||(a=r()),a.set(l,c)}};return h},Yc}var $c,em;function Qd(){if(em)return $c;em=1;var i=String.prototype.replace,e=/%20/g,t={RFC1738:"RFC1738",RFC3986:"RFC3986"};return $c={default:t.RFC3986,formatters:{RFC1738:function(s){return i.call(s,e,"+")},RFC3986:function(s){return String(s)}},RFC1738:t.RFC1738,RFC3986:t.RFC3986},$c}var Gc,tm;function q0(){if(tm)return Gc;tm=1;var i=Qd(),e=z0(),t=X0(),s=Object.prototype.hasOwnProperty,n=Array.isArray,r=e(),o=function(R,B){return r.set(R,B),R},a=function(R){return r.has(R)},h=function(R){return r.get(R)},l=function(R,B){r.set(R,B)},c=(function(){for(var C=[],R=0;R<256;++R)C[C.length]="%"+((R<16?"0":"")+R.toString(16)).toUpperCase();return C})(),u=function(R){for(;R.length>1;){var B=R.pop(),k=B.obj[B.prop];if(n(k)){for(var F=[],D=0;D<k.length;++D)typeof k[D]<"u"&&(F[F.length]=k[D]);B.obj[B.prop]=F}}},f=function(R,B){for(var k=B&&B.plainObjects?{__proto__:null}:{},F=0;F<R.length;++F)typeof R[F]<"u"&&(k[F]=R[F]);return k},d=function(R,B,k){B==="__proto__"&&t?t(R,B,{configurable:!0,enumerable:!0,value:k,writable:!0}):R[B]=k},m=function C(R,B,k){if(!B)return R;if(typeof B!="object"&&typeof B!="function"){if(n(R)){var F=R.length;if(k&&typeof k.arrayLimit=="number"&&F>=k.arrayLimit){if(k.throwOnLimitExceeded)throw new RangeError("Array limit exceeded. Only "+k.arrayLimit+" element"+(k.arrayLimit===1?"":"s")+" allowed in an array.");return o(f(R.concat(B),k),F)}R[F]=B}else if(R&&typeof R=="object")if(a(R)){var D=h(R)+1;R[D]=B,l(R,D)}else{if(k&&k.strictMerge)return[R,B];(k&&(k.plainObjects||k.allowPrototypes)||!s.call(Object.prototype,B))&&(R[B]=!0)}else return[R,B];return R}if(!R||typeof R!="object"){if(a(B)){for(var N=Object.keys(B),j=k&&k.plainObjects?{__proto__:null,0:R}:{0:R},O=0;O<N.length;O++){var L=parseInt(N[O],10);j[L+1]=B[N[O]]}return o(j,h(B)+1)}var P=[R].concat(B);if(k&&typeof k.arrayLimit=="number"&&P.length>k.arrayLimit){if(k.throwOnLimitExceeded)throw new RangeError("Array limit exceeded. Only "+k.arrayLimit+" element"+(k.arrayLimit===1?"":"s")+" allowed in an array.");return o(f(P,k),P.length-1)}return P}var X=R;if(n(R)&&!n(B)&&(X=f(R,k)),n(R)&&n(B)){if(B.forEach(function(U,Y){if(s.call(R,Y)){var q=R[Y];q&&typeof q=="object"&&U&&typeof U=="object"?R[Y]=C(q,U,k):R[R.length]=U}else R[Y]=U}),k&&typeof k.arrayLimit=="number"&&R.length>k.arrayLimit){if(k.throwOnLimitExceeded)throw new RangeError("Array limit exceeded. Only "+k.arrayLimit+" element"+(k.arrayLimit===1?"":"s")+" allowed in an array.");return o(f(R,k),R.length-1)}return R}return Object.keys(B).reduce(function(U,Y){var q=B[Y];if(s.call(U,Y)?d(U,Y,C(U[Y],q,k)):d(U,Y,q),a(B)&&!a(U)&&o(U,h(B)),a(U)){var z=parseInt(Y,10);String(z)===Y&&z>=0&&z>h(U)&&l(U,z)}return U},X)},g=function(R,B){return Object.keys(B).reduce(function(k,F){return d(k,F,B[F]),k},R)},b=function(C,R,B){var k=C.replace(/\+/g," ");if(B==="iso-8859-1")return k.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(k)}catch{return k}},_=1024,M=function(R,B,k,F,D){if(R.length===0)return R;var N=R;if(typeof R=="symbol"?N=Symbol.prototype.toString.call(R):typeof R!="string"&&(N=String(R)),k==="iso-8859-1")return escape(N).replace(/%u[0-9a-f]{4}/gi,function(q){return"%26%23"+parseInt(q.slice(2),16)+"%3B"});for(var j="",O=0;O<N.length;O+=_){var L=N.length>=_?N.slice(O,O+_):N;if(O+_<N.length){var P=L.charCodeAt(L.length-1);P>=55296&&P<=56319&&(L=L.slice(0,-1),O-=1)}for(var X=[],U=0;U<L.length;++U){var Y=L.charCodeAt(U);if(Y===45||Y===46||Y===95||Y===126||Y>=48&&Y<=57||Y>=65&&Y<=90||Y>=97&&Y<=122||D===i.RFC1738&&(Y===40||Y===41)){X[X.length]=L.charAt(U);continue}if(Y<128){X[X.length]=c[Y];continue}if(Y<2048){X[X.length]=c[192|Y>>6]+c[128|Y&63];continue}if(Y<55296||Y>=57344){X[X.length]=c[224|Y>>12]+c[128|Y>>6&63]+c[128|Y&63];continue}U+=1,Y=65536+((Y&1023)<<10|L.charCodeAt(U)&1023),X[X.length]=c[240|Y>>18]+c[128|Y>>12&63]+c[128|Y>>6&63]+c[128|Y&63]}j+=X.join("")}return j},v=function(R){for(var B=[{obj:{o:R},prop:"o"}],k=e(),F=0;F<B.length;++F)for(var D=B[F],N=D.obj[D.prop],j=Object.keys(N),O=0;O<j.length;++O){var L=j[O],P=N[L];typeof P=="object"&&P!==null&&!k.has(P)&&(B[B.length]={obj:N,prop:L},k.set(P,!0))}return u(B),R},S=function(R){return Object.prototype.toString.call(R)==="[object RegExp]"},y=function(R){return!R||typeof R!="object"?!1:!!(R.constructor&&R.constructor.isBuffer&&R.constructor.isBuffer(R))},I=function(R,B,k,F,D){if(a(R)){if(D)throw new RangeError("Array limit exceeded. Only "+k+" element"+(k===1?"":"s")+" allowed in an array.");var N=h(R)+1;return R[N]=B,l(R,N),R}var j=[].concat(R,B);if(j.length>k){if(D)throw new RangeError("Array limit exceeded. Only "+k+" element"+(k===1?"":"s")+" allowed in an array.");return o(f(j,{plainObjects:F}),j.length-1)}return j},E=function(R,B){if(n(R)){for(var k=[],F=0;F<R.length;F+=1)k[k.length]=B(R[F]);return k}return B(R)};return Gc={arrayToObject:f,assign:g,combine:I,compact:v,decode:b,encode:M,isBuffer:y,isOverflow:a,isRegExp:S,markOverflow:o,maybeMap:E,merge:m},Gc}var jc,im;function Xw(){if(im)return jc;im=1;var i=z0(),e=q0(),t=Qd(),s=Object.prototype.hasOwnProperty,n={brackets:function(b){return b+"[]"},comma:"comma",indices:function(b,_){return b+"["+_+"]"},repeat:function(b){return b}},r=Array.isArray,o=Array.prototype.push,a=function(g,b){o.apply(g,r(b)?b:[b])},h=Date.prototype.toISOString,l=t.default,c={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,commaRoundTrip:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:e.encode,encodeValuesOnly:!1,filter:void 0,format:l,formatter:t.formatters[l],indices:!1,serializeDate:function(b){return h.call(b)},skipNulls:!1,strictNullHandling:!1},u=function(b){return typeof b=="string"||typeof b=="number"||typeof b=="boolean"||typeof b=="symbol"||typeof b=="bigint"},f={},d=function g(b,_,M,v,S,y,I,E,C,R,B,k,F,D,N,j,O,L){for(var P=b,X=L,U=0,Y=!1;(X=X.get(f))!==void 0&&!Y;){var q=X.get(b);if(U+=1,typeof q<"u"){if(q===U)throw new RangeError("Cyclic object value");Y=!0}typeof X.get(f)>"u"&&(U=0)}if(typeof R=="function"?P=R(_,P):P instanceof Date?P=F(P):M==="comma"&&r(P)&&(P=e.maybeMap(P,function(Q){return Q instanceof Date?F(Q):Q})),P===null){if(y)return N(C&&!j?C(_,c.encoder,O,"key",D):_);P=""}if(u(P)||e.isBuffer(P)){if(C){var z=j?_:C(_,c.encoder,O,"key",D);return[N(z)+"="+N(C(P,c.encoder,O,"value",D))]}return[N(_)+"="+N(String(P))]}var ne=[];if(typeof P>"u")return ne;var H;if(M==="comma"&&r(P))j&&C&&(P=e.maybeMap(P,function(Q){return Q==null?Q:C(Q)})),H=[{value:P.length>0?P.join(",")||null:void 0}];else if(r(R))H=R;else{var Z=Object.keys(P);H=B?Z.sort(B):Z}var ae=E?String(_).replace(/\./g,"%2E"):String(_),me=v&&r(P)&&P.length===1?ae+"[]":ae;if(S&&r(P)&&P.length===0)return me+"[]";for(var _e=0;_e<H.length;++_e){var te=H[_e],ve=typeof te=="object"&&te&&typeof te.value<"u"?te.value:P[te];if(!(I&&ve===null)){var $=k&&E?String(te).replace(/\./g,"%2E"):String(te),W=r(P)?typeof M=="function"?M(me,$):me:me+(k?"."+$:"["+$+"]");L.set(b,U);var J=i();J.set(f,L),a(ne,g(ve,W,M,v,S,y,I,E,M==="comma"&&j&&r(P)?null:C,R,B,k,F,D,N,j,O,J))}}return ne},m=function(b){if(!b)return c;if(typeof b.allowEmptyArrays<"u"&&typeof b.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof b.encodeDotInKeys<"u"&&typeof b.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(b.encoder!==null&&typeof b.encoder<"u"&&typeof b.encoder!="function")throw new TypeError("Encoder has to be a function.");var _=b.charset||c.charset;if(typeof b.charset<"u"&&b.charset!=="utf-8"&&b.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var M=t.default;if(typeof b.format<"u"){if(!s.call(t.formatters,b.format))throw new TypeError("Unknown format option provided.");M=b.format}var v=t.formatters[M],S=c.filter;(typeof b.filter=="function"||r(b.filter))&&(S=b.filter);var y;if(b.arrayFormat in n?y=b.arrayFormat:"indices"in b?y=b.indices?"indices":"repeat":y=c.arrayFormat,"commaRoundTrip"in b&&typeof b.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var I=typeof b.allowDots>"u"?b.encodeDotInKeys===!0?!0:c.allowDots:!!b.allowDots;return{addQueryPrefix:typeof b.addQueryPrefix=="boolean"?b.addQueryPrefix:c.addQueryPrefix,allowDots:I,allowEmptyArrays:typeof b.allowEmptyArrays=="boolean"?!!b.allowEmptyArrays:c.allowEmptyArrays,arrayFormat:y,charset:_,charsetSentinel:typeof b.charsetSentinel=="boolean"?b.charsetSentinel:c.charsetSentinel,commaRoundTrip:!!b.commaRoundTrip,delimiter:typeof b.delimiter>"u"?c.delimiter:b.delimiter,encode:typeof b.encode=="boolean"?b.encode:c.encode,encodeDotInKeys:typeof b.encodeDotInKeys=="boolean"?b.encodeDotInKeys:c.encodeDotInKeys,encoder:typeof b.encoder=="function"?b.encoder:c.encoder,encodeValuesOnly:typeof b.encodeValuesOnly=="boolean"?b.encodeValuesOnly:c.encodeValuesOnly,filter:S,format:M,formatter:v,serializeDate:typeof b.serializeDate=="function"?b.serializeDate:c.serializeDate,skipNulls:typeof b.skipNulls=="boolean"?b.skipNulls:c.skipNulls,sort:typeof b.sort=="function"?b.sort:null,strictNullHandling:typeof b.strictNullHandling=="boolean"?b.strictNullHandling:c.strictNullHandling}};return jc=function(g,b){var _=g,M=m(b),v,S;typeof M.filter=="function"?(S=M.filter,_=S("",_)):r(M.filter)&&(S=M.filter,v=S);var y=[];if(typeof _!="object"||_===null)return"";var I=n[M.arrayFormat],E=I==="comma"&&M.commaRoundTrip;v||(v=Object.keys(_)),M.sort&&v.sort(M.sort);for(var C=i(),R=0;R<v.length;++R){var B=v[R];if(!(typeof B>"u"||B===null)){var k=_[B];M.skipNulls&&k===null||a(y,d(k,B,I,E,M.allowEmptyArrays,M.strictNullHandling,M.skipNulls,M.encodeDotInKeys,M.encode?M.encoder:null,M.filter,M.sort,M.allowDots,M.serializeDate,M.format,M.formatter,M.encodeValuesOnly,M.charset,C))}}var F=y.join(M.delimiter),D=M.addQueryPrefix===!0?"?":"";return M.charsetSentinel&&(M.charset==="iso-8859-1"?D+="utf8=%26%2310003%3B"+M.delimiter:D+="utf8=%E2%9C%93"+M.delimiter),F.length>0?D+F:""},jc}var Hc,sm;function Yw(){if(sm)return Hc;sm=1;var i=q0(),e=Object.prototype.hasOwnProperty,t=Array.isArray,s={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:i.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictDepth:!1,strictMerge:!0,strictNullHandling:!1,throwOnLimitExceeded:!1},n=function(d){return d.replace(/&#(\d+);/g,function(m,g){return String.fromCharCode(parseInt(g,10))})},r=function(d,m,g,b){if(d&&typeof d=="string"&&m.comma&&d.indexOf(",")>-1){if(b&&m.throwOnLimitExceeded)for(var _=0,M=d.indexOf(",");M>-1;){if(_+=1,_>=m.arrayLimit)throw new RangeError("Array limit exceeded. Only "+m.arrayLimit+" element"+(m.arrayLimit===1?"":"s")+" allowed in an array.");M=d.indexOf(",",M+1)}return d.split(",")}if(m.throwOnLimitExceeded&&g>=m.arrayLimit)throw new RangeError("Array limit exceeded. Only "+m.arrayLimit+" element"+(m.arrayLimit===1?"":"s")+" allowed in an array.");return d},o="utf8=%26%2310003%3B",a="utf8=%E2%9C%93",h=function(m,g){var b={__proto__:null},_=g.ignoreQueryPrefix?m.replace(/^\?/,""):m;_=_.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var M=g.parameterLimit===1/0?void 0:g.parameterLimit,v=_.split(g.delimiter,g.throwOnLimitExceeded&&typeof M<"u"?M+1:M);if(g.throwOnLimitExceeded&&typeof M<"u"&&v.length>M)throw new RangeError("Parameter limit exceeded. Only "+M+" parameter"+(M===1?"":"s")+" allowed.");var S=-1,y,I=g.charset;if(g.charsetSentinel)for(y=0;y<v.length;++y)v[y].indexOf("utf8=")===0&&(v[y]===a?I="utf-8":v[y]===o&&(I="iso-8859-1"),S=y,y=v.length);for(y=0;y<v.length;++y)if(y!==S){var E=v[y],C=E.indexOf("]="),R=C===-1?E.indexOf("="):C+1,B,k;if(R===-1?(B=g.decoder(E,s.decoder,I,"key"),k=g.strictNullHandling?null:""):(B=g.decoder(E.slice(0,R),s.decoder,I,"key"),B!==null&&(k=i.maybeMap(r(E.slice(R+1),g,t(b[B])?b[B].length:0,E.indexOf("[]=")===-1),function(D){return g.decoder(D,s.decoder,I,"value")}))),k&&g.interpretNumericEntities&&I==="iso-8859-1"&&(k=n(String(k))),E.indexOf("[]=")>-1&&(k=t(k)?[k]:k),g.comma&&t(k)&&k.length>g.arrayLimit&&(k=i.combine([],k,g.arrayLimit,g.plainObjects,g.throwOnLimitExceeded)),B!==null){var F=e.call(b,B);F&&(g.duplicates==="combine"||E.indexOf("[]=")>-1)?b[B]=i.combine(b[B],k,g.arrayLimit,g.plainObjects,g.throwOnLimitExceeded):(!F||g.duplicates==="last")&&(b[B]=k)}}return b},l=function(d,m,g,b){var _=0;if(d.length>0&&d[d.length-1]==="[]"){var M=d.slice(0,-1).join("");_=Array.isArray(m)&&m[M]?m[M].length:0}for(var v=b?m:r(m,g,_),S=d.length-1;S>=0;--S){var y,I=d[S];if(I==="[]"&&g.parseArrays)i.isOverflow(v)?y=v:y=g.allowEmptyArrays&&(v===""||g.strictNullHandling&&v===null)?[]:i.combine([],v,g.arrayLimit,g.plainObjects,g.throwOnLimitExceeded);else{y=g.plainObjects?{__proto__:null}:{};var E=I.charAt(0)==="["&&I.charAt(I.length-1)==="]"?I.slice(1,-1):I,C=g.decodeDotInKeys?E.replace(/%2E/g,"."):E,R=parseInt(C,10),B=!isNaN(R)&&I!==C&&String(R)===C&&R>=0&&g.parseArrays;if(!g.parseArrays&&C==="")y={0:v};else if(B&&R<g.arrayLimit)y=[],y[R]=v;else{if(B&&g.throwOnLimitExceeded)throw new RangeError("Array limit exceeded. Only "+g.arrayLimit+" element"+(g.arrayLimit===1?"":"s")+" allowed in an array.");B?(y[R]=v,i.markOverflow(y,R)):C!=="__proto__"&&(y[C]=v)}}v=y}return v},c=function(m,g){var b=g.allowDots?m.replace(/\.([^.[]+)/g,"[$1]"):m;if(g.depth<=0)return!g.plainObjects&&e.call(Object.prototype,b)&&!g.allowPrototypes?void 0:[b];var _=[],M=b.indexOf("["),v=M>=0?b.slice(0,M):b;if(v){if(!g.plainObjects&&e.call(Object.prototype,v)&&!g.allowPrototypes)return;_[_.length]=v}for(var S=b.length,y=M,I=0;y>=0&&I<g.depth;){for(var E=1,C=y+1,R=-1;C<S&&R<0;){var B=b.charCodeAt(C);B===91?E+=1:B===93&&(E-=1,E===0&&(R=C)),C+=1}if(R<0)return _[_.length]="["+b.slice(y)+"]",_;var k=b.slice(y,R+1),F=k.slice(1,-1);if(!g.plainObjects&&e.call(Object.prototype,F)&&!g.allowPrototypes)return;_[_.length]=k,I+=1,y=b.indexOf("[",R+1)}if(y>=0){if(g.strictDepth===!0)throw new RangeError("Input depth exceeded depth option of "+g.depth+" and strictDepth is true");_[_.length]="["+b.slice(y)+"]"}return _},u=function(m,g,b,_){if(m){var M=c(m,b);if(M)return l(M,g,b,_)}},f=function(m){if(!m)return s;if(typeof m.allowEmptyArrays<"u"&&typeof m.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof m.decodeDotInKeys<"u"&&typeof m.decodeDotInKeys!="boolean")throw new TypeError("`decodeDotInKeys` option can only be `true` or `false`, when provided");if(m.decoder!==null&&typeof m.decoder<"u"&&typeof m.decoder!="function")throw new TypeError("Decoder has to be a function.");if(typeof m.charset<"u"&&m.charset!=="utf-8"&&m.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");if(typeof m.throwOnLimitExceeded<"u"&&typeof m.throwOnLimitExceeded!="boolean")throw new TypeError("`throwOnLimitExceeded` option must be a boolean");var g=typeof m.charset>"u"?s.charset:m.charset,b=typeof m.duplicates>"u"?s.duplicates:m.duplicates;if(b!=="combine"&&b!=="first"&&b!=="last")throw new TypeError("The duplicates option must be either combine, first, or last");var _=typeof m.allowDots>"u"?m.decodeDotInKeys===!0?!0:s.allowDots:!!m.allowDots;return{allowDots:_,allowEmptyArrays:typeof m.allowEmptyArrays=="boolean"?!!m.allowEmptyArrays:s.allowEmptyArrays,allowPrototypes:typeof m.allowPrototypes=="boolean"?m.allowPrototypes:s.allowPrototypes,allowSparse:typeof m.allowSparse=="boolean"?m.allowSparse:s.allowSparse,arrayLimit:typeof m.arrayLimit=="number"?m.arrayLimit:s.arrayLimit,charset:g,charsetSentinel:typeof m.charsetSentinel=="boolean"?m.charsetSentinel:s.charsetSentinel,comma:typeof m.comma=="boolean"?m.comma:s.comma,decodeDotInKeys:typeof m.decodeDotInKeys=="boolean"?m.decodeDotInKeys:s.decodeDotInKeys,decoder:typeof m.decoder=="function"?m.decoder:s.decoder,delimiter:typeof m.delimiter=="string"||i.isRegExp(m.delimiter)?m.delimiter:s.delimiter,depth:typeof m.depth=="number"||m.depth===!1?+m.depth:s.depth,duplicates:b,ignoreQueryPrefix:m.ignoreQueryPrefix===!0,interpretNumericEntities:typeof m.interpretNumericEntities=="boolean"?m.interpretNumericEntities:s.interpretNumericEntities,parameterLimit:typeof m.parameterLimit=="number"?m.parameterLimit:s.parameterLimit,parseArrays:m.parseArrays!==!1,plainObjects:typeof m.plainObjects=="boolean"?m.plainObjects:s.plainObjects,strictDepth:typeof m.strictDepth=="boolean"?!!m.strictDepth:s.strictDepth,strictMerge:typeof m.strictMerge=="boolean"?!!m.strictMerge:s.strictMerge,strictNullHandling:typeof m.strictNullHandling=="boolean"?m.strictNullHandling:s.strictNullHandling,throwOnLimitExceeded:typeof m.throwOnLimitExceeded=="boolean"?m.throwOnLimitExceeded:!1}};return Hc=function(d,m){var g=f(m);if(d===""||d===null||typeof d>"u")return g.plainObjects?{__proto__:null}:{};for(var b=typeof d=="string"?h(d,g):d,_=g.plainObjects?{__proto__:null}:{},M=Object.keys(b),v=0;v<M.length;++v){var S=M[v],y=u(S,b[S],g,typeof d=="string");_=i.merge(_,y,g)}return g.allowSparse===!0?_:i.compact(_)},Hc}var Wc,nm;function $w(){if(nm)return Wc;nm=1;var i=Xw(),e=Yw(),t=Qd();return Wc={formats:t,parse:e,stringify:i},Wc}var rm;function Gw(){if(rm)return rr;rm=1;var i=dw();function e(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}var t=/^([a-z0-9.+-]+:)/i,s=/:[0-9]*$/,n=/^(\/\/?(?!\/)[^?\s]*)(\?[^\s]*)?$/,r=["<",">",'"',"`"," ","\r",`
|
||
`," "],o=["{","}","|","\\","^","`"].concat(r),a=["'"].concat(o),h=["%","/","?",";","#"].concat(a),l=["/","?","#"],c=255,u=/^[+a-z0-9A-Z_-]{0,63}$/,f=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,d={javascript:!0,"javascript:":!0},m={javascript:!0,"javascript:":!0},g={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},b=$w();function _(y,I,E){if(y&&typeof y=="object"&&y instanceof e)return y;var C=new e;return C.parse(y,I,E),C}e.prototype.parse=function(y,I,E){if(typeof y!="string")throw new TypeError("Parameter 'url' must be a string, not "+typeof y);var C=y.indexOf("?"),R=C!==-1&&C<y.indexOf("#")?"?":"#",B=y.split(R),k=/\\/g;B[0]=B[0].replace(k,"/"),y=B.join(R);var F=y;if(F=F.trim(),!E&&y.split("#").length===1){var D=n.exec(F);if(D)return this.path=F,this.href=F,this.pathname=D[1],D[2]?(this.search=D[2],I?this.query=b.parse(this.search.substr(1)):this.query=this.search.substr(1)):I&&(this.search="",this.query={}),this}var N=t.exec(F);if(N){N=N[0];var j=N.toLowerCase();this.protocol=j,F=F.substr(N.length)}if(E||N||F.match(/^\/\/[^@/]+@[^@/]+/)){var O=F.substr(0,2)==="//";O&&!(N&&m[N])&&(F=F.substr(2),this.slashes=!0)}if(!m[N]&&(O||N&&!g[N])){for(var L=-1,P=0;P<l.length;P++){var X=F.indexOf(l[P]);X!==-1&&(L===-1||X<L)&&(L=X)}var U,Y;L===-1?Y=F.lastIndexOf("@"):Y=F.lastIndexOf("@",L),Y!==-1&&(U=F.slice(0,Y),F=F.slice(Y+1),this.auth=decodeURIComponent(U)),L=-1;for(var P=0;P<h.length;P++){var X=F.indexOf(h[P]);X!==-1&&(L===-1||X<L)&&(L=X)}L===-1&&(L=F.length),this.host=F.slice(0,L),F=F.slice(L),this.parseHost(),this.hostname=this.hostname||"";var q=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!q)for(var z=this.hostname.split(/\./),P=0,ne=z.length;P<ne;P++){var H=z[P];if(H&&!H.match(u)){for(var Z="",ae=0,me=H.length;ae<me;ae++)H.charCodeAt(ae)>127?Z+="x":Z+=H[ae];if(!Z.match(u)){var _e=z.slice(0,P),te=z.slice(P+1),ve=H.match(f);ve&&(_e.push(ve[1]),te.unshift(ve[2])),te.length&&(F="/"+te.join(".")+F),this.hostname=_e.join(".");break}}}this.hostname.length>c?this.hostname="":this.hostname=this.hostname.toLowerCase(),q||(this.hostname=i.toASCII(this.hostname));var $=this.port?":"+this.port:"",W=this.hostname||"";this.host=W+$,this.href+=this.host,q&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),F[0]!=="/"&&(F="/"+F))}if(!d[j])for(var P=0,ne=a.length;P<ne;P++){var J=a[P];if(F.indexOf(J)!==-1){var Q=encodeURIComponent(J);Q===J&&(Q=escape(J)),F=F.split(J).join(Q)}}var ie=F.indexOf("#");ie!==-1&&(this.hash=F.substr(ie),F=F.slice(0,ie));var ue=F.indexOf("?");if(ue!==-1?(this.search=F.substr(ue),this.query=F.substr(ue+1),I&&(this.query=b.parse(this.query)),F=F.slice(0,ue)):I&&(this.search="",this.query={}),F&&(this.pathname=F),g[j]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var $=this.pathname||"",Se=this.search||"";this.path=$+Se}return this.href=this.format(),this};function M(y){return typeof y=="string"&&(y=_(y)),y instanceof e?y.format():e.prototype.format.call(y)}e.prototype.format=function(){var y=this.auth||"";y&&(y=encodeURIComponent(y),y=y.replace(/%3A/i,":"),y+="@");var I=this.protocol||"",E=this.pathname||"",C=this.hash||"",R=!1,B="";this.host?R=y+this.host:this.hostname&&(R=y+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&(R+=":"+this.port)),this.query&&typeof this.query=="object"&&Object.keys(this.query).length&&(B=b.stringify(this.query,{arrayFormat:"repeat",addQueryPrefix:!1}));var k=this.search||B&&"?"+B||"";return I&&I.substr(-1)!==":"&&(I+=":"),this.slashes||(!I||g[I])&&R!==!1?(R="//"+(R||""),E&&E.charAt(0)!=="/"&&(E="/"+E)):R||(R=""),C&&C.charAt(0)!=="#"&&(C="#"+C),k&&k.charAt(0)!=="?"&&(k="?"+k),E=E.replace(/[?#]/g,function(F){return encodeURIComponent(F)}),k=k.replace("#","%23"),I+R+E+k+C};function v(y,I){return _(y,!1,!0).resolve(I)}e.prototype.resolve=function(y){return this.resolveObject(_(y,!1,!0)).format()};function S(y,I){return y?_(y,!1,!0).resolveObject(I):I}return e.prototype.resolveObject=function(y){if(typeof y=="string"){var I=new e;I.parse(y,!1,!0),y=I}for(var E=new e,C=Object.keys(this),R=0;R<C.length;R++){var B=C[R];E[B]=this[B]}if(E.hash=y.hash,y.href==="")return E.href=E.format(),E;if(y.slashes&&!y.protocol){for(var k=Object.keys(y),F=0;F<k.length;F++){var D=k[F];D!=="protocol"&&(E[D]=y[D])}return g[E.protocol]&&E.hostname&&!E.pathname&&(E.pathname="/",E.path=E.pathname),E.href=E.format(),E}if(y.protocol&&y.protocol!==E.protocol){if(!g[y.protocol]){for(var N=Object.keys(y),j=0;j<N.length;j++){var O=N[j];E[O]=y[O]}return E.href=E.format(),E}if(E.protocol=y.protocol,!y.host&&!m[y.protocol]){for(var ne=(y.pathname||"").split("/");ne.length&&!(y.host=ne.shift()););y.host||(y.host=""),y.hostname||(y.hostname=""),ne[0]!==""&&ne.unshift(""),ne.length<2&&ne.unshift(""),E.pathname=ne.join("/")}else E.pathname=y.pathname;if(E.search=y.search,E.query=y.query,E.host=y.host||"",E.auth=y.auth,E.hostname=y.hostname||y.host,E.port=y.port,E.pathname||E.search){var L=E.pathname||"",P=E.search||"";E.path=L+P}return E.slashes=E.slashes||y.slashes,E.href=E.format(),E}var X=E.pathname&&E.pathname.charAt(0)==="/",U=y.host||y.pathname&&y.pathname.charAt(0)==="/",Y=U||X||E.host&&y.pathname,q=Y,z=E.pathname&&E.pathname.split("/")||[],ne=y.pathname&&y.pathname.split("/")||[],H=E.protocol&&!g[E.protocol];if(H&&(E.hostname="",E.port=null,E.host&&(z[0]===""?z[0]=E.host:z.unshift(E.host)),E.host="",y.protocol&&(y.hostname=null,y.port=null,y.host&&(ne[0]===""?ne[0]=y.host:ne.unshift(y.host)),y.host=null),Y=Y&&(ne[0]===""||z[0]==="")),U)E.host=y.host||y.host===""?y.host:E.host,E.hostname=y.hostname||y.hostname===""?y.hostname:E.hostname,E.search=y.search,E.query=y.query,z=ne;else if(ne.length)z||(z=[]),z.pop(),z=z.concat(ne),E.search=y.search,E.query=y.query;else if(y.search!=null){if(H){E.host=z.shift(),E.hostname=E.host;var Z=E.host&&E.host.indexOf("@")>0?E.host.split("@"):!1;Z&&(E.auth=Z.shift(),E.hostname=Z.shift(),E.host=E.hostname)}return E.search=y.search,E.query=y.query,(E.pathname!==null||E.search!==null)&&(E.path=(E.pathname?E.pathname:"")+(E.search?E.search:"")),E.href=E.format(),E}if(!z.length)return E.pathname=null,E.search?E.path="/"+E.search:E.path=null,E.href=E.format(),E;for(var ae=z.slice(-1)[0],me=(E.host||y.host||z.length>1)&&(ae==="."||ae==="..")||ae==="",_e=0,te=z.length;te>=0;te--)ae=z[te],ae==="."?z.splice(te,1):ae===".."?(z.splice(te,1),_e++):_e&&(z.splice(te,1),_e--);if(!Y&&!q)for(;_e--;_e)z.unshift("..");Y&&z[0]!==""&&(!z[0]||z[0].charAt(0)!=="/")&&z.unshift(""),me&&z.join("/").substr(-1)!=="/"&&z.push("");var ve=z[0]===""||z[0]&&z[0].charAt(0)==="/";if(H){E.hostname=ve?"":z.length?z.shift():"",E.host=E.hostname;var Z=E.host&&E.host.indexOf("@")>0?E.host.split("@"):!1;Z&&(E.auth=Z.shift(),E.hostname=Z.shift(),E.host=E.hostname)}return Y=Y||E.host&&z.length,Y&&!ve&&z.unshift(""),z.length>0?E.pathname=z.join("/"):(E.pathname=null,E.path=null),(E.pathname!==null||E.search!==null)&&(E.path=(E.pathname?E.pathname:"")+(E.search?E.search:"")),E.auth=y.auth||E.auth,E.slashes=E.slashes||y.slashes,E.href=E.format(),E},e.prototype.parseHost=function(){var y=this.host,I=s.exec(y);I&&(I=I[0],I!==":"&&(this.port=I.substr(1)),y=y.substr(0,y.length-I.length)),y&&(this.hostname=y)},rr.parse=_,rr.resolve=v,rr.resolveObject=S,rr.format=M,rr.Url=e,rr}Gw();const om={};function pt(i,e,t=3){if(om[e])return;let s=new Error().stack;typeof s>"u"?console.warn("PixiJS Deprecation Warning: ",`${e}
|
||
Deprecated since v${i}`):(s=s.split(`
|
||
`).splice(t).join(`
|
||
`),console.groupCollapsed?(console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s","color:#614108;background:#fffbe6","font-weight:normal;color:#614108;background:#fffbe6",`${e}
|
||
Deprecated since v${i}`),console.warn(s),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",`${e}
|
||
Deprecated since v${i}`),console.warn(s))),om[e]=!0}function ts(i){if(typeof i!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(i)}`)}function ko(i){return i.split("?")[0].split("#")[0]}function jw(i){return i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Hw(i,e,t){return i.replace(new RegExp(jw(e),"g"),t)}function Ww(i,e){let t="",s=0,n=-1,r=0,o=-1;for(let a=0;a<=i.length;++a){if(a<i.length)o=i.charCodeAt(a);else{if(o===47)break;o=47}if(o===47){if(!(n===a-1||r===1))if(n!==a-1&&r===2){if(t.length<2||s!==2||t.charCodeAt(t.length-1)!==46||t.charCodeAt(t.length-2)!==46){if(t.length>2){const h=t.lastIndexOf("/");if(h!==t.length-1){h===-1?(t="",s=0):(t=t.slice(0,h),s=t.length-1-t.lastIndexOf("/")),n=a,r=0;continue}}else if(t.length===2||t.length===1){t="",s=0,n=a,r=0;continue}}}else t.length>0?t+=`/${i.slice(n+1,a)}`:t=i.slice(n+1,a),s=a-n-1;n=a,r=0}else o===46&&r!==-1?++r:r=-1}return t}const zt={toPosix(i){return Hw(i,"\\","/")},isUrl(i){return/^https?:/.test(this.toPosix(i))},isDataUrl(i){return/^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i.test(i)},isBlobUrl(i){return i.startsWith("blob:")},hasProtocol(i){return/^[^/:]+:/.test(this.toPosix(i))},getProtocol(i){ts(i),i=this.toPosix(i);const e=/^file:\/\/\//.exec(i);if(e)return e[0];const t=/^[^/:]+:\/{0,2}/.exec(i);return t?t[0]:""},toAbsolute(i,e,t){if(ts(i),this.isDataUrl(i)||this.isBlobUrl(i))return i;const s=ko(this.toPosix(e??Ve.ADAPTER.getBaseUrl())),n=ko(this.toPosix(t??this.rootname(s)));return i=this.toPosix(i),i.startsWith("/")?zt.join(n,i.slice(1)):this.isAbsolute(i)?i:this.join(s,i)},normalize(i){if(ts(i),i.length===0)return".";if(this.isDataUrl(i)||this.isBlobUrl(i))return i;i=this.toPosix(i);let e="";const t=i.startsWith("/");this.hasProtocol(i)&&(e=this.rootname(i),i=i.slice(e.length));const s=i.endsWith("/");return i=Ww(i),i.length>0&&s&&(i+="/"),t?`/${i}`:e+i},isAbsolute(i){return ts(i),i=this.toPosix(i),this.hasProtocol(i)?!0:i.startsWith("/")},join(...i){if(i.length===0)return".";let e;for(let t=0;t<i.length;++t){const s=i[t];if(ts(s),s.length>0)if(e===void 0)e=s;else{const n=i[t-1]??"";this.joinExtensions.includes(this.extname(n).toLowerCase())?e+=`/../${s}`:e+=`/${s}`}}return e===void 0?".":this.normalize(e)},dirname(i){if(ts(i),i.length===0)return".";i=this.toPosix(i);let e=i.charCodeAt(0);const t=e===47;let s=-1,n=!0;const r=this.getProtocol(i),o=i;i=i.slice(r.length);for(let a=i.length-1;a>=1;--a)if(e=i.charCodeAt(a),e===47){if(!n){s=a;break}}else n=!1;return s===-1?t?"/":this.isUrl(o)?r+i:r:t&&s===1?"//":r+i.slice(0,s)},rootname(i){ts(i),i=this.toPosix(i);let e="";if(i.startsWith("/")?e="/":e=this.getProtocol(i),this.isUrl(i)){const t=i.indexOf("/",e.length);t!==-1?e=i.slice(0,t):e=i,e.endsWith("/")||(e+="/")}return e},basename(i,e){ts(i),e&&ts(e),i=ko(this.toPosix(i));let t=0,s=-1,n=!0,r;if(e!==void 0&&e.length>0&&e.length<=i.length){if(e.length===i.length&&e===i)return"";let o=e.length-1,a=-1;for(r=i.length-1;r>=0;--r){const h=i.charCodeAt(r);if(h===47){if(!n){t=r+1;break}}else a===-1&&(n=!1,a=r+1),o>=0&&(h===e.charCodeAt(o)?--o===-1&&(s=r):(o=-1,s=a))}return t===s?s=a:s===-1&&(s=i.length),i.slice(t,s)}for(r=i.length-1;r>=0;--r)if(i.charCodeAt(r)===47){if(!n){t=r+1;break}}else s===-1&&(n=!1,s=r+1);return s===-1?"":i.slice(t,s)},extname(i){ts(i),i=ko(this.toPosix(i));let e=-1,t=0,s=-1,n=!0,r=0;for(let o=i.length-1;o>=0;--o){const a=i.charCodeAt(o);if(a===47){if(!n){t=o+1;break}continue}s===-1&&(n=!1,s=o+1),a===46?e===-1?e=o:r!==1&&(r=1):e!==-1&&(r=-1)}return e===-1||s===-1||r===0||r===1&&e===s-1&&e===t+1?"":i.slice(e,s)},parse(i){ts(i);const e={root:"",dir:"",base:"",ext:"",name:""};if(i.length===0)return e;i=ko(this.toPosix(i));let t=i.charCodeAt(0);const s=this.isAbsolute(i);let n;e.root=this.rootname(i),s||this.hasProtocol(i)?n=1:n=0;let r=-1,o=0,a=-1,h=!0,l=i.length-1,c=0;for(;l>=n;--l){if(t=i.charCodeAt(l),t===47){if(!h){o=l+1;break}continue}a===-1&&(h=!1,a=l+1),t===46?r===-1?r=l:c!==1&&(c=1):r!==-1&&(c=-1)}return r===-1||a===-1||c===0||c===1&&r===a-1&&r===o+1?a!==-1&&(o===0&&s?e.base=e.name=i.slice(1,a):e.base=e.name=i.slice(o,a)):(o===0&&s?(e.name=i.slice(1,r),e.base=i.slice(1,a)):(e.name=i.slice(o,r),e.base=i.slice(o,a)),e.ext=i.slice(r,a)),e.dir=this.dirname(i),e},sep:"/",delimiter:":",joinExtensions:[".html"]};let zc;async function zw(){return zc??(zc=(async()=>{var r;const i=document.createElement("canvas").getContext("webgl");if(!i)return ui.UNPACK;const e=await new Promise(o=>{const a=document.createElement("video");a.onloadeddata=()=>o(a),a.onerror=()=>o(null),a.autoplay=!1,a.crossOrigin="anonymous",a.preload="auto",a.src="data:video/webm;base64,GkXfo59ChoEBQveBAULygQRC84EIQoKEd2VibUKHgQJChYECGFOAZwEAAAAAAAHTEU2bdLpNu4tTq4QVSalmU6yBoU27i1OrhBZUrmtTrIHGTbuMU6uEElTDZ1OsggEXTbuMU6uEHFO7a1OsggG97AEAAAAAAABZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmoCrXsYMPQkBNgIRMYXZmV0GETGF2ZkSJiEBEAAAAAAAAFlSua8yuAQAAAAAAAEPXgQFzxYgAAAAAAAAAAZyBACK1nIN1bmSIgQCGhVZfVlA5g4EBI+ODhAJiWgDglLCBArqBApqBAlPAgQFVsIRVuYEBElTDZ9Vzc9JjwItjxYgAAAAAAAAAAWfInEWjh0VOQ09ERVJEh49MYXZjIGxpYnZweC12cDlnyKJFo4hEVVJBVElPTkSHlDAwOjAwOjAwLjA0MDAwMDAwMAAAH0O2dcfngQCgwqGggQAAAIJJg0IAABAAFgA4JBwYSgAAICAAEb///4r+AAB1oZ2mm+6BAaWWgkmDQgAAEAAWADgkHBhKAAAgIABIQBxTu2uRu4+zgQC3iveBAfGCAXHwgQM=",a.load()});if(!e)return ui.UNPACK;const t=i.createTexture();i.bindTexture(i.TEXTURE_2D,t);const s=i.createFramebuffer();i.bindFramebuffer(i.FRAMEBUFFER,s),i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,t,0),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,i.NONE),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,i.RGBA,i.UNSIGNED_BYTE,e);const n=new Uint8Array(4);return i.readPixels(0,0,1,1,i.RGBA,i.UNSIGNED_BYTE,n),i.deleteFramebuffer(s),i.deleteTexture(t),(r=i.getExtension("WEBGL_lose_context"))==null||r.loseContext(),n[0]<=n[3]?ui.PMA:ui.UNPACK})()),zc}let qc;function qw(){return typeof qc>"u"&&(qc=(function(){var e;const i={stencil:!0,failIfMajorPerformanceCaveat:Ve.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT};try{if(!Ve.ADAPTER.getWebGLRenderingContext())return!1;const t=Ve.ADAPTER.createCanvas();let s=t.getContext("webgl",i)||t.getContext("experimental-webgl",i);const n=!!((e=s==null?void 0:s.getContextAttributes())!=null&&e.stencil);if(s){const r=s.getExtension("WEBGL_lose_context");r&&r.loseContext()}return s=null,n}catch{return!1}})()),qc}var Kw={grad:.9,turn:360,rad:360/(2*Math.PI)},sn=function(i){return typeof i=="string"?i.length>0:typeof i=="number"},ci=function(i,e,t){return e===void 0&&(e=0),t===void 0&&(t=Math.pow(10,e)),Math.round(t*i)/t+0},qi=function(i,e,t){return e===void 0&&(e=0),t===void 0&&(t=1),i>t?t:i>e?i:e},K0=function(i){return(i=isFinite(i)?i%360:0)>0?i:i+360},am=function(i){return{r:qi(i.r,0,255),g:qi(i.g,0,255),b:qi(i.b,0,255),a:qi(i.a)}},Kc=function(i){return{r:ci(i.r),g:ci(i.g),b:ci(i.b),a:ci(i.a,3)}},Zw=/^#([0-9a-f]{3,8})$/i,Ba=function(i){var e=i.toString(16);return e.length<2?"0"+e:e},Z0=function(i){var e=i.r,t=i.g,s=i.b,n=i.a,r=Math.max(e,t,s),o=r-Math.min(e,t,s),a=o?r===e?(t-s)/o:r===t?2+(s-e)/o:4+(e-t)/o:0;return{h:60*(a<0?a+6:a),s:r?o/r*100:0,v:r/255*100,a:n}},J0=function(i){var e=i.h,t=i.s,s=i.v,n=i.a;e=e/360*6,t/=100,s/=100;var r=Math.floor(e),o=s*(1-t),a=s*(1-(e-r)*t),h=s*(1-(1-e+r)*t),l=r%6;return{r:255*[s,a,o,o,h,s][l],g:255*[h,s,s,a,o,o][l],b:255*[o,o,h,s,s,a][l],a:n}},lm=function(i){return{h:K0(i.h),s:qi(i.s,0,100),l:qi(i.l,0,100),a:qi(i.a)}},hm=function(i){return{h:ci(i.h),s:ci(i.s),l:ci(i.l),a:ci(i.a,3)}},cm=function(i){return J0((t=(e=i).s,{h:e.h,s:(t*=((s=e.l)<50?s:100-s)/100)>0?2*t/(s+t)*100:0,v:s+t,a:e.a}));var e,t,s},ia=function(i){return{h:(e=Z0(i)).h,s:(n=(200-(t=e.s))*(s=e.v)/100)>0&&n<200?t*s/100/(n<=100?n:200-n)*100:0,l:n/2,a:e.a};var e,t,s,n},Jw=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Qw=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,e_=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,t_=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Yu={string:[[function(i){var e=Zw.exec(i);return e?(i=e[1]).length<=4?{r:parseInt(i[0]+i[0],16),g:parseInt(i[1]+i[1],16),b:parseInt(i[2]+i[2],16),a:i.length===4?ci(parseInt(i[3]+i[3],16)/255,2):1}:i.length===6||i.length===8?{r:parseInt(i.substr(0,2),16),g:parseInt(i.substr(2,2),16),b:parseInt(i.substr(4,2),16),a:i.length===8?ci(parseInt(i.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(i){var e=e_.exec(i)||t_.exec(i);return e?e[2]!==e[4]||e[4]!==e[6]?null:am({r:Number(e[1])/(e[2]?100/255:1),g:Number(e[3])/(e[4]?100/255:1),b:Number(e[5])/(e[6]?100/255:1),a:e[7]===void 0?1:Number(e[7])/(e[8]?100:1)}):null},"rgb"],[function(i){var e=Jw.exec(i)||Qw.exec(i);if(!e)return null;var t,s,n=lm({h:(t=e[1],s=e[2],s===void 0&&(s="deg"),Number(t)*(Kw[s]||1)),s:Number(e[3]),l:Number(e[4]),a:e[5]===void 0?1:Number(e[5])/(e[6]?100:1)});return cm(n)},"hsl"]],object:[[function(i){var e=i.r,t=i.g,s=i.b,n=i.a,r=n===void 0?1:n;return sn(e)&&sn(t)&&sn(s)?am({r:Number(e),g:Number(t),b:Number(s),a:Number(r)}):null},"rgb"],[function(i){var e=i.h,t=i.s,s=i.l,n=i.a,r=n===void 0?1:n;if(!sn(e)||!sn(t)||!sn(s))return null;var o=lm({h:Number(e),s:Number(t),l:Number(s),a:Number(r)});return cm(o)},"hsl"],[function(i){var e=i.h,t=i.s,s=i.v,n=i.a,r=n===void 0?1:n;if(!sn(e)||!sn(t)||!sn(s))return null;var o=(function(a){return{h:K0(a.h),s:qi(a.s,0,100),v:qi(a.v,0,100),a:qi(a.a)}})({h:Number(e),s:Number(t),v:Number(s),a:Number(r)});return J0(o)},"hsv"]]},um=function(i,e){for(var t=0;t<e.length;t++){var s=e[t][0](i);if(s)return[s,e[t][1]]}return[null,void 0]},i_=function(i){return typeof i=="string"?um(i.trim(),Yu.string):typeof i=="object"&&i!==null?um(i,Yu.object):[null,void 0]},Zc=function(i,e){var t=ia(i);return{h:t.h,s:qi(t.s+100*e,0,100),l:t.l,a:t.a}},Jc=function(i){return(299*i.r+587*i.g+114*i.b)/1e3/255},dm=function(i,e){var t=ia(i);return{h:t.h,s:t.s,l:qi(t.l+100*e,0,100),a:t.a}},$u=(function(){function i(e){this.parsed=i_(e)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return i.prototype.isValid=function(){return this.parsed!==null},i.prototype.brightness=function(){return ci(Jc(this.rgba),2)},i.prototype.isDark=function(){return Jc(this.rgba)<.5},i.prototype.isLight=function(){return Jc(this.rgba)>=.5},i.prototype.toHex=function(){return e=Kc(this.rgba),t=e.r,s=e.g,n=e.b,o=(r=e.a)<1?Ba(ci(255*r)):"","#"+Ba(t)+Ba(s)+Ba(n)+o;var e,t,s,n,r,o},i.prototype.toRgb=function(){return Kc(this.rgba)},i.prototype.toRgbString=function(){return e=Kc(this.rgba),t=e.r,s=e.g,n=e.b,(r=e.a)<1?"rgba("+t+", "+s+", "+n+", "+r+")":"rgb("+t+", "+s+", "+n+")";var e,t,s,n,r},i.prototype.toHsl=function(){return hm(ia(this.rgba))},i.prototype.toHslString=function(){return e=hm(ia(this.rgba)),t=e.h,s=e.s,n=e.l,(r=e.a)<1?"hsla("+t+", "+s+"%, "+n+"%, "+r+")":"hsl("+t+", "+s+"%, "+n+"%)";var e,t,s,n,r},i.prototype.toHsv=function(){return e=Z0(this.rgba),{h:ci(e.h),s:ci(e.s),v:ci(e.v),a:ci(e.a,3)};var e},i.prototype.invert=function(){return Ts({r:255-(e=this.rgba).r,g:255-e.g,b:255-e.b,a:e.a});var e},i.prototype.saturate=function(e){return e===void 0&&(e=.1),Ts(Zc(this.rgba,e))},i.prototype.desaturate=function(e){return e===void 0&&(e=.1),Ts(Zc(this.rgba,-e))},i.prototype.grayscale=function(){return Ts(Zc(this.rgba,-1))},i.prototype.lighten=function(e){return e===void 0&&(e=.1),Ts(dm(this.rgba,e))},i.prototype.darken=function(e){return e===void 0&&(e=.1),Ts(dm(this.rgba,-e))},i.prototype.rotate=function(e){return e===void 0&&(e=15),this.hue(this.hue()+e)},i.prototype.alpha=function(e){return typeof e=="number"?Ts({r:(t=this.rgba).r,g:t.g,b:t.b,a:e}):ci(this.rgba.a,3);var t},i.prototype.hue=function(e){var t=ia(this.rgba);return typeof e=="number"?Ts({h:e,s:t.s,l:t.l,a:t.a}):ci(t.h)},i.prototype.isEqual=function(e){return this.toHex()===Ts(e).toHex()},i})(),Ts=function(i){return i instanceof $u?i:new $u(i)},fm=[],s_=function(i){i.forEach(function(e){fm.indexOf(e)<0&&(e($u,Yu),fm.push(e))})};function n_(i,e){var t={white:"#ffffff",bisque:"#ffe4c4",blue:"#0000ff",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",antiquewhite:"#faebd7",aqua:"#00ffff",azure:"#f0ffff",whitesmoke:"#f5f5f5",papayawhip:"#ffefd5",plum:"#dda0dd",blanchedalmond:"#ffebcd",black:"#000000",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",cornsilk:"#fff8dc",cornflowerblue:"#6495ed",burlywood:"#deb887",aquamarine:"#7fffd4",beige:"#f5f5dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkkhaki:"#bdb76b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",peachpuff:"#ffdab9",darkmagenta:"#8b008b",darkred:"#8b0000",darkorchid:"#9932cc",darkorange:"#ff8c00",darkslateblue:"#483d8b",gray:"#808080",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",deeppink:"#ff1493",deepskyblue:"#00bfff",wheat:"#f5deb3",firebrick:"#b22222",floralwhite:"#fffaf0",ghostwhite:"#f8f8ff",darkviolet:"#9400d3",magenta:"#ff00ff",green:"#008000",dodgerblue:"#1e90ff",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",blueviolet:"#8a2be2",forestgreen:"#228b22",lawngreen:"#7cfc00",indianred:"#cd5c5c",indigo:"#4b0082",fuchsia:"#ff00ff",brown:"#a52a2a",maroon:"#800000",mediumblue:"#0000cd",lightcoral:"#f08080",darkturquoise:"#00ced1",lightcyan:"#e0ffff",ivory:"#fffff0",lightyellow:"#ffffe0",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",linen:"#faf0e6",mediumaquamarine:"#66cdaa",lemonchiffon:"#fffacd",lime:"#00ff00",khaki:"#f0e68c",mediumseagreen:"#3cb371",limegreen:"#32cd32",mediumspringgreen:"#00fa9a",lightskyblue:"#87cefa",lightblue:"#add8e6",midnightblue:"#191970",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",mintcream:"#f5fffa",lightslategray:"#778899",lightslategrey:"#778899",navajowhite:"#ffdead",navy:"#000080",mediumvioletred:"#c71585",powderblue:"#b0e0e6",palegoldenrod:"#eee8aa",oldlace:"#fdf5e6",paleturquoise:"#afeeee",mediumturquoise:"#48d1cc",mediumorchid:"#ba55d3",rebeccapurple:"#663399",lightsteelblue:"#b0c4de",mediumslateblue:"#7b68ee",thistle:"#d8bfd8",tan:"#d2b48c",orchid:"#da70d6",mediumpurple:"#9370db",purple:"#800080",pink:"#ffc0cb",skyblue:"#87ceeb",springgreen:"#00ff7f",palegreen:"#98fb98",red:"#ff0000",yellow:"#ffff00",slateblue:"#6a5acd",lavenderblush:"#fff0f5",peru:"#cd853f",palevioletred:"#db7093",violet:"#ee82ee",teal:"#008080",slategray:"#708090",slategrey:"#708090",aliceblue:"#f0f8ff",darkseagreen:"#8fbc8f",darkolivegreen:"#556b2f",greenyellow:"#adff2f",seagreen:"#2e8b57",seashell:"#fff5ee",tomato:"#ff6347",silver:"#c0c0c0",sienna:"#a0522d",lavender:"#e6e6fa",lightgreen:"#90ee90",orange:"#ffa500",orangered:"#ff4500",steelblue:"#4682b4",royalblue:"#4169e1",turquoise:"#40e0d0",yellowgreen:"#9acd32",salmon:"#fa8072",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},s={};for(var n in t)s[t[n]]=n;var r={};i.prototype.toName=function(o){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var a,h,l=s[this.toHex()];if(l)return l;if(o!=null&&o.closest){var c=this.toRgb(),u=1/0,f="black";if(!r.length)for(var d in t)r[d]=new i(t[d]).toRgb();for(var m in t){var g=(a=c,h=r[m],Math.pow(a.r-h.r,2)+Math.pow(a.g-h.g,2)+Math.pow(a.b-h.b,2));g<u&&(u=g,f=m)}return f}},e.string.push([function(o){var a=o.toLowerCase(),h=a==="transparent"?"#0000":t[a];return h?new i(h).toRgb():null},"name"])}s_([n_]);const jr=class fl{constructor(e=16777215){this._value=null,this._components=new Float32Array(4),this._components.fill(1),this._int=16777215,this.value=e}get red(){return this._components[0]}get green(){return this._components[1]}get blue(){return this._components[2]}get alpha(){return this._components[3]}setValue(e){return this.value=e,this}set value(e){if(e instanceof fl)this._value=this.cloneSource(e._value),this._int=e._int,this._components.set(e._components);else{if(e===null)throw new Error("Cannot set PIXI.Color#value to null");(this._value===null||!this.isSourceEqual(this._value,e))&&(this.normalize(e),this._value=this.cloneSource(e))}}get value(){return this._value}cloneSource(e){return typeof e=="string"||typeof e=="number"||e instanceof Number||e===null?e:Array.isArray(e)||ArrayBuffer.isView(e)?e.slice(0):typeof e=="object"&&e!==null?{...e}:e}isSourceEqual(e,t){const s=typeof e;if(s!==typeof t)return!1;if(s==="number"||s==="string"||e instanceof Number)return e===t;if(Array.isArray(e)&&Array.isArray(t)||ArrayBuffer.isView(e)&&ArrayBuffer.isView(t))return e.length!==t.length?!1:e.every((n,r)=>n===t[r]);if(e!==null&&t!==null){const n=Object.keys(e),r=Object.keys(t);return n.length!==r.length?!1:n.every(o=>e[o]===t[o])}return e===t}toRgba(){const[e,t,s,n]=this._components;return{r:e,g:t,b:s,a:n}}toRgb(){const[e,t,s]=this._components;return{r:e,g:t,b:s}}toRgbaString(){const[e,t,s]=this.toUint8RgbArray();return`rgba(${e},${t},${s},${this.alpha})`}toUint8RgbArray(e){const[t,s,n]=this._components;return e=e??[],e[0]=Math.round(t*255),e[1]=Math.round(s*255),e[2]=Math.round(n*255),e}toRgbArray(e){e=e??[];const[t,s,n]=this._components;return e[0]=t,e[1]=s,e[2]=n,e}toNumber(){return this._int}toLittleEndianNumber(){const e=this._int;return(e>>16)+(e&65280)+((e&255)<<16)}multiply(e){const[t,s,n,r]=fl.temp.setValue(e)._components;return this._components[0]*=t,this._components[1]*=s,this._components[2]*=n,this._components[3]*=r,this.refreshInt(),this._value=null,this}premultiply(e,t=!0){return t&&(this._components[0]*=e,this._components[1]*=e,this._components[2]*=e),this._components[3]=e,this.refreshInt(),this._value=null,this}toPremultiplied(e,t=!0){if(e===1)return(255<<24)+this._int;if(e===0)return t?0:this._int;let s=this._int>>16&255,n=this._int>>8&255,r=this._int&255;return t&&(s=s*e+.5|0,n=n*e+.5|0,r=r*e+.5|0),(e*255<<24)+(s<<16)+(n<<8)+r}toHex(){const e=this._int.toString(16);return`#${"000000".substring(0,6-e.length)+e}`}toHexa(){const e=Math.round(this._components[3]*255).toString(16);return this.toHex()+"00".substring(0,2-e.length)+e}setAlpha(e){return this._components[3]=this._clamp(e),this}round(e){const[t,s,n]=this._components;return this._components[0]=Math.round(t*e)/e,this._components[1]=Math.round(s*e)/e,this._components[2]=Math.round(n*e)/e,this.refreshInt(),this._value=null,this}toArray(e){e=e??[];const[t,s,n,r]=this._components;return e[0]=t,e[1]=s,e[2]=n,e[3]=r,e}normalize(e){let t,s,n,r;if((typeof e=="number"||e instanceof Number)&&e>=0&&e<=16777215){const o=e;t=(o>>16&255)/255,s=(o>>8&255)/255,n=(o&255)/255,r=1}else if((Array.isArray(e)||e instanceof Float32Array)&&e.length>=3&&e.length<=4)e=this._clamp(e),[t,s,n,r=1]=e;else if((e instanceof Uint8Array||e instanceof Uint8ClampedArray)&&e.length>=3&&e.length<=4)e=this._clamp(e,0,255),[t,s,n,r=255]=e,t/=255,s/=255,n/=255,r/=255;else if(typeof e=="string"||typeof e=="object"){if(typeof e=="string"){const a=fl.HEX_PATTERN.exec(e);a&&(e=`#${a[2]}`)}const o=Ts(e);o.isValid()&&({r:t,g:s,b:n,a:r}=o.rgba,t/=255,s/=255,n/=255)}if(t!==void 0)this._components[0]=t,this._components[1]=s,this._components[2]=n,this._components[3]=r,this.refreshInt();else throw new Error(`Unable to convert color ${e}`)}refreshInt(){this._clamp(this._components);const[e,t,s]=this._components;this._int=(e*255<<16)+(t*255<<8)+(s*255|0)}_clamp(e,t=0,s=1){return typeof e=="number"?Math.min(Math.max(e,t),s):(e.forEach((n,r)=>{e[r]=Math.min(Math.max(n,t),s)}),e)}};jr.shared=new jr,jr.temp=new jr,jr.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;let At=jr;function r_(i){return pt("7.2.0","utils.hex2string is deprecated, use Color#toHex instead"),At.shared.setValue(i).toHex()}function o_(i){return pt("7.2.0","utils.rgb2hex is deprecated, use Color#toNumber instead"),At.shared.setValue(i).toNumber()}function a_(){const i=[],e=[];for(let s=0;s<32;s++)i[s]=s,e[s]=s;i[Qe.NORMAL_NPM]=Qe.NORMAL,i[Qe.ADD_NPM]=Qe.ADD,i[Qe.SCREEN_NPM]=Qe.SCREEN,e[Qe.NORMAL]=Qe.NORMAL_NPM,e[Qe.ADD]=Qe.ADD_NPM,e[Qe.SCREEN]=Qe.SCREEN_NPM;const t=[];return t.push(e),t.push(i),t}const Q0=a_();function ev(i,e){return Q0[e?1:0][i]}function l_(i,e=null){const t=i*6;if(e=e||new Uint16Array(t),e.length!==t)throw new Error(`Out buffer length is incorrect, got ${e.length} and expected ${t}`);for(let s=0,n=0;s<t;s+=6,n+=4)e[s+0]=n+0,e[s+1]=n+1,e[s+2]=n+2,e[s+3]=n+0,e[s+4]=n+2,e[s+5]=n+3;return e}function tv(i){if(i.BYTES_PER_ELEMENT===4)return i instanceof Float32Array?"Float32Array":i instanceof Uint32Array?"Uint32Array":"Int32Array";if(i.BYTES_PER_ELEMENT===2){if(i instanceof Uint16Array)return"Uint16Array"}else if(i.BYTES_PER_ELEMENT===1&&i instanceof Uint8Array)return"Uint8Array";return null}function kl(i){return i+=i===0?1:0,--i,i|=i>>>1,i|=i>>>2,i|=i>>>4,i|=i>>>8,i|=i>>>16,i+1}function pm(i){return!(i&i-1)&&!!i}function mm(i){let e=(i>65535?1:0)<<4;i>>>=e;let t=(i>255?1:0)<<3;return i>>>=t,e|=t,t=(i>15?1:0)<<2,i>>>=t,e|=t,t=(i>3?1:0)<<1,i>>>=t,e|=t,e|i>>1}function ao(i,e,t){const s=i.length;let n;if(e>=s||t===0)return;t=e+t>s?s-e:t;const r=s-t;for(n=e;n<r;++n)i[n]=i[n+t];i.length=r}function Gn(i){return i===0?0:i<0?-1:1}let h_=0;function _r(){return++h_}const Gu=class{constructor(i,e,t,s){this.left=i,this.top=e,this.right=t,this.bottom=s}get width(){return this.right-this.left}get height(){return this.bottom-this.top}isEmpty(){return this.left===this.right||this.top===this.bottom}};Gu.EMPTY=new Gu(0,0,0,0);let gm=Gu;const vm={},Ms=Object.create(null),In=Object.create(null);class c_{constructor(e,t,s){this._canvas=Ve.ADAPTER.createCanvas(),this._context=this._canvas.getContext("2d"),this.resolution=s||Ve.RESOLUTION,this.resize(e,t)}clear(){this._checkDestroyed(),this._context.setTransform(1,0,0,1,0,0),this._context.clearRect(0,0,this._canvas.width,this._canvas.height)}resize(e,t){this._checkDestroyed(),this._canvas.width=Math.round(e*this.resolution),this._canvas.height=Math.round(t*this.resolution)}destroy(){this._context=null,this._canvas=null}get width(){return this._checkDestroyed(),this._canvas.width}set width(e){this._checkDestroyed(),this._canvas.width=Math.round(e)}get height(){return this._checkDestroyed(),this._canvas.height}set height(e){this._checkDestroyed(),this._canvas.height=Math.round(e)}get canvas(){return this._checkDestroyed(),this._canvas}get context(){return this._checkDestroyed(),this._context}_checkDestroyed(){if(this._canvas===null)throw new TypeError("The CanvasRenderTarget has already been destroyed")}}function ym(i,e,t){for(let s=0,n=4*t*e;s<e;++s,n+=4)if(i[n+3]!==0)return!1;return!0}function xm(i,e,t,s,n){const r=4*e;for(let o=s,a=s*r+4*t;o<=n;++o,a+=r)if(i[a+3]!==0)return!1;return!0}function u_(i){const{width:e,height:t}=i,s=i.getContext("2d",{willReadFrequently:!0});if(s===null)throw new TypeError("Failed to get canvas 2D context");const n=s.getImageData(0,0,e,t).data;let r=0,o=0,a=e-1,h=t-1;for(;o<t&&ym(n,e,o);)++o;if(o===t)return gm.EMPTY;for(;ym(n,e,h);)--h;for(;xm(n,e,r,o,h);)++r;for(;xm(n,e,a,o,h);)--a;return++a,++h,new gm(r,o,a,h)}function d_(i){const e=u_(i),{width:t,height:s}=e;let n=null;if(!e.isEmpty()){const r=i.getContext("2d");if(r===null)throw new TypeError("Failed to get canvas 2D context");n=r.getImageData(e.left,e.top,t,s)}return{width:t,height:s,data:n}}function f_(i,e=globalThis.location){if(i.startsWith("data:"))return"";e=e||globalThis.location;const t=new URL(i,document.baseURI);return t.hostname!==e.hostname||t.port!==e.port||t.protocol!==e.protocol?"anonymous":""}function _n(i,e=1){var s;const t=(s=Ve.RETINA_PREFIX)==null?void 0:s.exec(i);return t?parseFloat(t[1]):e}var Oe=(i=>(i.Renderer="renderer",i.Application="application",i.RendererSystem="renderer-webgl-system",i.RendererPlugin="renderer-webgl-plugin",i.CanvasRendererSystem="renderer-canvas-system",i.CanvasRendererPlugin="renderer-canvas-plugin",i.Asset="asset",i.LoadParser="load-parser",i.ResolveParser="resolve-parser",i.CacheParser="cache-parser",i.DetectionParser="detection-parser",i))(Oe||{});const ju=i=>{if(typeof i=="function"||typeof i=="object"&&i.extension){if(!i.extension)throw new Error("Extension class must have an extension object");i={...typeof i.extension!="object"?{type:i.extension}:i.extension,ref:i}}if(typeof i=="object")i={...i};else throw new Error("Invalid extension type");return typeof i.type=="string"&&(i.type=[i.type]),i},bm=(i,e)=>ju(i).priority??e,He={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...i){return i.map(ju).forEach(e=>{e.type.forEach(t=>{var s,n;return(n=(s=this._removeHandlers)[t])==null?void 0:n.call(s,e)})}),this},add(...i){return i.map(ju).forEach(e=>{e.type.forEach(t=>{var r,o;const s=this._addHandlers,n=this._queue;s[t]?(r=s[t])==null||r.call(s,e):(n[t]=n[t]||[],(o=n[t])==null||o.push(e))})}),this},handle(i,e,t){var o;const s=this._addHandlers,n=this._removeHandlers;if(s[i]||n[i])throw new Error(`Extension type ${i} already has a handler`);s[i]=e,n[i]=t;const r=this._queue;return r[i]&&((o=r[i])==null||o.forEach(a=>e(a)),delete r[i]),this},handleByMap(i,e){return this.handle(i,t=>{t.name&&(e[t.name]=t.ref)},t=>{t.name&&delete e[t.name]})},handleByList(i,e,t=-1){return this.handle(i,s=>{e.includes(s.ref)||(e.push(s.ref),e.sort((n,r)=>bm(r,t)-bm(n,t)))},s=>{const n=e.indexOf(s.ref);n!==-1&&e.splice(n,1)})}};class Hu{constructor(e){typeof e=="number"?this.rawBinaryData=new ArrayBuffer(e):e instanceof Uint8Array?this.rawBinaryData=e.buffer:this.rawBinaryData=e,this.uint32View=new Uint32Array(this.rawBinaryData),this.float32View=new Float32Array(this.rawBinaryData)}get int8View(){return this._int8View||(this._int8View=new Int8Array(this.rawBinaryData)),this._int8View}get uint8View(){return this._uint8View||(this._uint8View=new Uint8Array(this.rawBinaryData)),this._uint8View}get int16View(){return this._int16View||(this._int16View=new Int16Array(this.rawBinaryData)),this._int16View}get uint16View(){return this._uint16View||(this._uint16View=new Uint16Array(this.rawBinaryData)),this._uint16View}get int32View(){return this._int32View||(this._int32View=new Int32Array(this.rawBinaryData)),this._int32View}view(e){return this[`${e}View`]}destroy(){this.rawBinaryData=null,this._int8View=null,this._uint8View=null,this._int16View=null,this._uint16View=null,this._int32View=null,this.uint32View=null,this.float32View=null}static sizeOf(e){switch(e){case"int8":case"uint8":return 1;case"int16":case"uint16":return 2;case"int32":case"uint32":case"float32":return 4;default:throw new Error(`${e} isn't a valid view type`)}}}const p_=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(`
|
||
`);function m_(i){let e="";for(let t=0;t<i;++t)t>0&&(e+=`
|
||
else `),t<i-1&&(e+=`if(test == ${t}.0){}`);return e}function g_(i,e){if(i===0)throw new Error("Invalid value of `0` passed to `checkMaxIfStatementsInShader`");const t=e.createShader(e.FRAGMENT_SHADER);for(;;){const s=p_.replace(/%forloop%/gi,m_(i));if(e.shaderSource(t,s),e.compileShader(t),!e.getShaderParameter(t,e.COMPILE_STATUS))i=i/2|0;else break}return i}const Qc=0,eu=1,tu=2,iu=3,su=4,nu=5;class zs{constructor(){this.data=0,this.blendMode=Qe.NORMAL,this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<<Qc)}set blend(e){!!(this.data&1<<Qc)!==e&&(this.data^=1<<Qc)}get offsets(){return!!(this.data&1<<eu)}set offsets(e){!!(this.data&1<<eu)!==e&&(this.data^=1<<eu)}get culling(){return!!(this.data&1<<tu)}set culling(e){!!(this.data&1<<tu)!==e&&(this.data^=1<<tu)}get depthTest(){return!!(this.data&1<<iu)}set depthTest(e){!!(this.data&1<<iu)!==e&&(this.data^=1<<iu)}get depthMask(){return!!(this.data&1<<nu)}set depthMask(e){!!(this.data&1<<nu)!==e&&(this.data^=1<<nu)}get clockwiseFrontFace(){return!!(this.data&1<<su)}set clockwiseFrontFace(e){!!(this.data&1<<su)!==e&&(this.data^=1<<su)}get blendMode(){return this._blendMode}set blendMode(e){this.blend=e!==Qe.NONE,this._blendMode=e}get polygonOffset(){return this._polygonOffset}set polygonOffset(e){this.offsets=!!e,this._polygonOffset=e}static for2d(){const e=new zs;return e.depthTest=!1,e.blend=!0,e}}zs.prototype.toString=function(){return`[@pixi/core:State blendMode=${this.blendMode} clockwiseFrontFace=${this.clockwiseFrontFace} culling=${this.culling} depthMask=${this.depthMask} polygonOffset=${this.polygonOffset}]`};const Wu=[];function iv(i,e){if(!i)return null;let t="";if(typeof i=="string"){const s=/\.(\w{3,4})(?:$|\?|#)/i.exec(i);s&&(t=s[1].toLowerCase())}for(let s=Wu.length-1;s>=0;--s){const n=Wu[s];if(n.test&&n.test(i,t))return new n(i,e)}throw new Error("Unrecognized source type to auto-detect Resource")}class ds{constructor(e){this.items=[],this._name=e,this._aliasCount=0}emit(e,t,s,n,r,o,a,h){if(arguments.length>8)throw new Error("max arguments reached");const{name:l,items:c}=this;this._aliasCount++;for(let u=0,f=c.length;u<f;u++)c[u][l](e,t,s,n,r,o,a,h);return c===this.items&&this._aliasCount--,this}ensureNonAliasedItems(){this._aliasCount>0&&this.items.length>1&&(this._aliasCount=0,this.items=this.items.slice(0))}add(e){return e[this._name]&&(this.ensureNonAliasedItems(),this.remove(e),this.items.push(e)),this}remove(e){const t=this.items.indexOf(e);return t!==-1&&(this.ensureNonAliasedItems(),this.items.splice(t,1)),this}contains(e){return this.items.includes(e)}removeAll(){return this.ensureNonAliasedItems(),this.items.length=0,this}destroy(){this.removeAll(),this.items.length=0,this._name=""}get empty(){return this.items.length===0}get name(){return this._name}}Object.defineProperties(ds.prototype,{dispatch:{value:ds.prototype.emit},run:{value:ds.prototype.emit}});class fa{constructor(e=0,t=0){this._width=e,this._height=t,this.destroyed=!1,this.internal=!1,this.onResize=new ds("setRealSize"),this.onUpdate=new ds("update"),this.onError=new ds("onError")}bind(e){this.onResize.add(e),this.onUpdate.add(e),this.onError.add(e),(this._width||this._height)&&this.onResize.emit(this._width,this._height)}unbind(e){this.onResize.remove(e),this.onUpdate.remove(e),this.onError.remove(e)}resize(e,t){(e!==this._width||t!==this._height)&&(this._width=e,this._height=t,this.onResize.emit(e,t))}get valid(){return!!this._width&&!!this._height}update(){this.destroyed||this.onUpdate.emit()}load(){return Promise.resolve(this)}get width(){return this._width}get height(){return this._height}style(e,t,s){return!1}dispose(){}destroy(){this.destroyed||(this.destroyed=!0,this.dispose(),this.onError.removeAll(),this.onError=null,this.onResize.removeAll(),this.onResize=null,this.onUpdate.removeAll(),this.onUpdate=null)}static test(e,t){return!1}}class Ch extends fa{constructor(e,t){const{width:s,height:n}=t||{};if(!s||!n)throw new Error("BufferResource width or height invalid");super(s,n),this.data=e,this.unpackAlignment=t.unpackAlignment??4}upload(e,t,s){const n=e.gl;n.pixelStorei(n.UNPACK_ALIGNMENT,this.unpackAlignment),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.alphaMode===ui.UNPACK);const r=t.realWidth,o=t.realHeight;return s.width===r&&s.height===o?n.texSubImage2D(t.target,0,0,0,r,o,t.format,s.type,this.data):(s.width=r,s.height=o,n.texImage2D(t.target,0,s.internalFormat,r,o,0,t.format,s.type,this.data)),!0}dispose(){this.data=null}static test(e){return e===null||e instanceof Int8Array||e instanceof Uint8Array||e instanceof Uint8ClampedArray||e instanceof Int16Array||e instanceof Uint16Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Float32Array}}const v_={scaleMode:as.NEAREST,alphaMode:ui.NPM},zu=class Hr extends Sa{constructor(e=null,t=null){super(),t=Object.assign({},Hr.defaultOptions,t);const{alphaMode:s,mipmap:n,anisotropicLevel:r,scaleMode:o,width:a,height:h,wrapMode:l,format:c,type:u,target:f,resolution:d,resourceOptions:m}=t;e&&!(e instanceof fa)&&(e=iv(e,m),e.internal=!0),this.resolution=d||Ve.RESOLUTION,this.width=Math.round((a||0)*this.resolution)/this.resolution,this.height=Math.round((h||0)*this.resolution)/this.resolution,this._mipmap=n,this.anisotropicLevel=r,this._wrapMode=l,this._scaleMode=o,this.format=c,this.type=u,this.target=f,this.alphaMode=s,this.uid=_r(),this.touched=0,this.isPowerOfTwo=!1,this._refreshPOT(),this._glTextures={},this.dirtyId=0,this.dirtyStyleId=0,this.cacheId=null,this.valid=a>0&&h>0,this.textureCacheIds=[],this.destroyed=!1,this.resource=null,this._batchEnabled=0,this._batchLocation=0,this.parentTextureArray=null,this.setResource(e)}get realWidth(){return Math.round(this.width*this.resolution)}get realHeight(){return Math.round(this.height*this.resolution)}get mipmap(){return this._mipmap}set mipmap(e){this._mipmap!==e&&(this._mipmap=e,this.dirtyStyleId++)}get scaleMode(){return this._scaleMode}set scaleMode(e){this._scaleMode!==e&&(this._scaleMode=e,this.dirtyStyleId++)}get wrapMode(){return this._wrapMode}set wrapMode(e){this._wrapMode!==e&&(this._wrapMode=e,this.dirtyStyleId++)}setStyle(e,t){let s;return e!==void 0&&e!==this.scaleMode&&(this.scaleMode=e,s=!0),t!==void 0&&t!==this.mipmap&&(this.mipmap=t,s=!0),s&&this.dirtyStyleId++,this}setSize(e,t,s){return s=s||this.resolution,this.setRealSize(e*s,t*s,s)}setRealSize(e,t,s){return this.resolution=s||this.resolution,this.width=Math.round(e)/this.resolution,this.height=Math.round(t)/this.resolution,this._refreshPOT(),this.update(),this}_refreshPOT(){this.isPowerOfTwo=pm(this.realWidth)&&pm(this.realHeight)}setResolution(e){const t=this.resolution;return t===e?this:(this.resolution=e,this.valid&&(this.width=Math.round(this.width*t)/e,this.height=Math.round(this.height*t)/e,this.emit("update",this)),this._refreshPOT(),this)}setResource(e){if(this.resource===e)return this;if(this.resource)throw new Error("Resource can be set only once");return e.bind(this),this.resource=e,this}update(){this.valid?(this.dirtyId++,this.dirtyStyleId++,this.emit("update",this)):this.width>0&&this.height>0&&(this.valid=!0,this.emit("loaded",this),this.emit("update",this))}onError(e){this.emit("error",this,e)}destroy(){this.resource&&(this.resource.unbind(this),this.resource.internal&&this.resource.destroy(),this.resource=null),this.cacheId&&(delete In[this.cacheId],delete Ms[this.cacheId],this.cacheId=null),this.valid=!1,this.dispose(),Hr.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0,this.emit("destroyed",this),this.removeAllListeners()}dispose(){this.emit("dispose",this)}castToBaseTexture(){return this}static from(e,t,s=Ve.STRICT_TEXTURE_CACHE){const n=typeof e=="string";let r=null;if(n)r=e;else{if(!e._pixiId){const a=(t==null?void 0:t.pixiIdPrefix)||"pixiid";e._pixiId=`${a}_${_r()}`}r=e._pixiId}let o=In[r];if(n&&s&&!o)throw new Error(`The cacheId "${r}" does not exist in BaseTextureCache.`);return o||(o=new Hr(e,t),o.cacheId=r,Hr.addToCache(o,r)),o}static fromBuffer(e,t,s,n){e=e||new Float32Array(t*s*4);const r=new Ch(e,{width:t,height:s,...n==null?void 0:n.resourceOptions});let o,a;return e instanceof Float32Array?(o=Re.RGBA,a=je.FLOAT):e instanceof Int32Array?(o=Re.RGBA_INTEGER,a=je.INT):e instanceof Uint32Array?(o=Re.RGBA_INTEGER,a=je.UNSIGNED_INT):e instanceof Int16Array?(o=Re.RGBA_INTEGER,a=je.SHORT):e instanceof Uint16Array?(o=Re.RGBA_INTEGER,a=je.UNSIGNED_SHORT):e instanceof Int8Array?(o=Re.RGBA,a=je.BYTE):(o=Re.RGBA,a=je.UNSIGNED_BYTE),r.internal=!0,new Hr(r,Object.assign({},v_,{type:a,format:o},n))}static addToCache(e,t){t&&(e.textureCacheIds.includes(t)||e.textureCacheIds.push(t),In[t]&&In[t]!==e&&console.warn(`BaseTexture added to the cache with an id [${t}] that already had an entry`),In[t]=e)}static removeFromCache(e){if(typeof e=="string"){const t=In[e];if(t){const s=t.textureCacheIds.indexOf(e);return s>-1&&t.textureCacheIds.splice(s,1),delete In[e],t}}else if(e!=null&&e.textureCacheIds){for(let t=0;t<e.textureCacheIds.length;++t)delete In[e.textureCacheIds[t]];return e.textureCacheIds.length=0,e}return null}};zu.defaultOptions={mipmap:Ki.POW2,anisotropicLevel:0,scaleMode:as.LINEAR,wrapMode:us.CLAMP,alphaMode:ui.UNPACK,target:oo.TEXTURE_2D,format:Re.RGBA,type:je.UNSIGNED_BYTE},zu._globalBatch=0;let st=zu;class qu{constructor(){this.texArray=null,this.blend=0,this.type=Us.TRIANGLES,this.start=0,this.size=0,this.data=null}}let y_=0;class Nt{constructor(e,t=!0,s=!1){this.data=e||new Float32Array(1),this._glBuffers={},this._updateID=0,this.index=s,this.static=t,this.id=y_++,this.disposeRunner=new ds("disposeBuffer")}update(e){e instanceof Array&&(e=new Float32Array(e)),this.data=e||this.data,this._updateID++}dispose(){this.disposeRunner.emit(this,!1)}destroy(){this.dispose(),this.data=null}set index(e){this.type=e?$s.ELEMENT_ARRAY_BUFFER:$s.ARRAY_BUFFER}get index(){return this.type===$s.ELEMENT_ARRAY_BUFFER}static from(e){return e instanceof Array&&(e=new Float32Array(e)),new Nt(e)}}class Fl{constructor(e,t=0,s=!1,n=je.FLOAT,r,o,a,h=1){this.buffer=e,this.size=t,this.normalized=s,this.type=n,this.stride=r,this.start=o,this.instance=a,this.divisor=h}destroy(){this.buffer=null}static from(e,t,s,n,r){return new Fl(e,t,s,n,r)}}const x_={Float32Array,Uint32Array,Int32Array,Uint8Array};function b_(i,e){let t=0,s=0;const n={};for(let h=0;h<i.length;h++)s+=e[h],t+=i[h].length;const r=new ArrayBuffer(t*4);let o=null,a=0;for(let h=0;h<i.length;h++){const l=e[h],c=i[h],u=tv(c);n[u]||(n[u]=new x_[u](r)),o=n[u];for(let f=0;f<c.length;f++){const d=(f/l|0)*s+a,m=f%l;o[d+m]=c[f]}a+=l}return new Float32Array(r)}const wm={5126:4,5123:2,5121:1};let w_=0;const __={Float32Array,Uint32Array,Int32Array,Uint8Array,Uint16Array};class Hs{constructor(e=[],t={}){this.buffers=e,this.indexBuffer=null,this.attributes=t,this.glVertexArrayObjects={},this.id=w_++,this.instanced=!1,this.instanceCount=1,this.disposeRunner=new ds("disposeGeometry"),this.refCount=0}addAttribute(e,t,s=0,n=!1,r,o,a,h=!1){if(!t)throw new Error("You must pass a buffer when creating an attribute");t instanceof Nt||(t instanceof Array&&(t=new Float32Array(t)),t=new Nt(t));const l=e.split("|");if(l.length>1){for(let u=0;u<l.length;u++)this.addAttribute(l[u],t,s,n,r);return this}let c=this.buffers.indexOf(t);return c===-1&&(this.buffers.push(t),c=this.buffers.length-1),this.attributes[e]=new Fl(c,s,n,r,o,a,h),this.instanced=this.instanced||h,this}getAttribute(e){return this.attributes[e]}getBuffer(e){return this.buffers[this.getAttribute(e).buffer]}addIndex(e){return e instanceof Nt||(e instanceof Array&&(e=new Uint16Array(e)),e=new Nt(e)),e.type=$s.ELEMENT_ARRAY_BUFFER,this.indexBuffer=e,this.buffers.includes(e)||this.buffers.push(e),this}getIndex(){return this.indexBuffer}interleave(){if(this.buffers.length===1||this.buffers.length===2&&this.indexBuffer)return this;const e=[],t=[],s=new Nt;let n;for(n in this.attributes){const r=this.attributes[n],o=this.buffers[r.buffer];e.push(o.data),t.push(r.size*wm[r.type]/4),r.buffer=0}for(s.data=b_(e,t),n=0;n<this.buffers.length;n++)this.buffers[n]!==this.indexBuffer&&this.buffers[n].destroy();return this.buffers=[s],this.indexBuffer&&this.buffers.push(this.indexBuffer),this}getSize(){for(const e in this.attributes){const t=this.attributes[e];return this.buffers[t.buffer].data.length/(t.stride/4||t.size)}return 0}dispose(){this.disposeRunner.emit(this,!1)}destroy(){this.dispose(),this.buffers=null,this.indexBuffer=null,this.attributes=null}clone(){const e=new Hs;for(let t=0;t<this.buffers.length;t++)e.buffers[t]=new Nt(this.buffers[t].data.slice(0));for(const t in this.attributes){const s=this.attributes[t];e.attributes[t]=new Fl(s.buffer,s.size,s.normalized,s.type,s.stride,s.start,s.instance)}return this.indexBuffer&&(e.indexBuffer=e.buffers[this.buffers.indexOf(this.indexBuffer)],e.indexBuffer.type=$s.ELEMENT_ARRAY_BUFFER),e}static merge(e){const t=new Hs,s=[],n=[],r=[];let o;for(let a=0;a<e.length;a++){o=e[a];for(let h=0;h<o.buffers.length;h++)n[h]=n[h]||0,n[h]+=o.buffers[h].data.length,r[h]=0}for(let a=0;a<o.buffers.length;a++)s[a]=new __[tv(o.buffers[a].data)](n[a]),t.buffers[a]=new Nt(s[a]);for(let a=0;a<e.length;a++){o=e[a];for(let h=0;h<o.buffers.length;h++)s[h].set(o.buffers[h].data,r[h]),r[h]+=o.buffers[h].data.length}if(t.attributes=o.attributes,o.indexBuffer){t.indexBuffer=t.buffers[o.buffers.indexOf(o.indexBuffer)],t.indexBuffer.type=$s.ELEMENT_ARRAY_BUFFER;let a=0,h=0,l=0,c=0;for(let u=0;u<o.buffers.length;u++)if(o.buffers[u]!==o.indexBuffer){c=u;break}for(const u in o.attributes){const f=o.attributes[u];(f.buffer|0)===c&&(h+=f.size*wm[f.type]/4)}for(let u=0;u<e.length;u++){const f=e[u].indexBuffer.data;for(let d=0;d<f.length;d++)t.indexBuffer.data[d+l]+=a;a+=e[u].buffers[c].data.length/h,l+=f.length}}return t}}class sv extends Hs{constructor(e=!1){super(),this._buffer=new Nt(null,e,!1),this._indexBuffer=new Nt(null,e,!0),this.addAttribute("aVertexPosition",this._buffer,2,!1,je.FLOAT).addAttribute("aTextureCoord",this._buffer,2,!1,je.FLOAT).addAttribute("aColor",this._buffer,4,!0,je.UNSIGNED_BYTE).addAttribute("aTextureId",this._buffer,1,!0,je.FLOAT).addIndex(this._indexBuffer)}}const Ol=Math.PI*2,S_=180/Math.PI,T_=Math.PI/180;var pi=(i=>(i[i.POLY=0]="POLY",i[i.RECT=1]="RECT",i[i.CIRC=2]="CIRC",i[i.ELIP=3]="ELIP",i[i.RREC=4]="RREC",i))(pi||{});class bt{constructor(e=0,t=0){this.x=0,this.y=0,this.x=e,this.y=t}clone(){return new bt(this.x,this.y)}copyFrom(e){return this.set(e.x,e.y),this}copyTo(e){return e.set(this.x,this.y),e}equals(e){return e.x===this.x&&e.y===this.y}set(e=0,t=e){return this.x=e,this.y=t,this}}bt.prototype.toString=function(){return`[@pixi/math:Point x=${this.x} y=${this.y}]`};const La=[new bt,new bt,new bt,new bt];class lt{constructor(e=0,t=0,s=0,n=0){this.x=Number(e),this.y=Number(t),this.width=Number(s),this.height=Number(n),this.type=pi.RECT}get left(){return this.x}get right(){return this.x+this.width}get top(){return this.y}get bottom(){return this.y+this.height}static get EMPTY(){return new lt(0,0,0,0)}clone(){return new lt(this.x,this.y,this.width,this.height)}copyFrom(e){return this.x=e.x,this.y=e.y,this.width=e.width,this.height=e.height,this}copyTo(e){return e.x=this.x,e.y=this.y,e.width=this.width,e.height=this.height,e}contains(e,t){return this.width<=0||this.height<=0?!1:e>=this.x&&e<this.x+this.width&&t>=this.y&&t<this.y+this.height}intersects(e,t){if(!t){const C=this.x<e.x?e.x:this.x;if((this.right>e.right?e.right:this.right)<=C)return!1;const R=this.y<e.y?e.y:this.y;return(this.bottom>e.bottom?e.bottom:this.bottom)>R}const s=this.left,n=this.right,r=this.top,o=this.bottom;if(n<=s||o<=r)return!1;const a=La[0].set(e.left,e.top),h=La[1].set(e.left,e.bottom),l=La[2].set(e.right,e.top),c=La[3].set(e.right,e.bottom);if(l.x<=a.x||h.y<=a.y)return!1;const u=Math.sign(t.a*t.d-t.b*t.c);if(u===0||(t.apply(a,a),t.apply(h,h),t.apply(l,l),t.apply(c,c),Math.max(a.x,h.x,l.x,c.x)<=s||Math.min(a.x,h.x,l.x,c.x)>=n||Math.max(a.y,h.y,l.y,c.y)<=r||Math.min(a.y,h.y,l.y,c.y)>=o))return!1;const f=u*(h.y-a.y),d=u*(a.x-h.x),m=f*s+d*r,g=f*n+d*r,b=f*s+d*o,_=f*n+d*o;if(Math.max(m,g,b,_)<=f*a.x+d*a.y||Math.min(m,g,b,_)>=f*c.x+d*c.y)return!1;const M=u*(a.y-l.y),v=u*(l.x-a.x),S=M*s+v*r,y=M*n+v*r,I=M*s+v*o,E=M*n+v*o;return!(Math.max(S,y,I,E)<=M*a.x+v*a.y||Math.min(S,y,I,E)>=M*c.x+v*c.y)}pad(e=0,t=e){return this.x-=e,this.y-=t,this.width+=e*2,this.height+=t*2,this}fit(e){const t=Math.max(this.x,e.x),s=Math.min(this.x+this.width,e.x+e.width),n=Math.max(this.y,e.y),r=Math.min(this.y+this.height,e.y+e.height);return this.x=t,this.width=Math.max(s-t,0),this.y=n,this.height=Math.max(r-n,0),this}ceil(e=1,t=.001){const s=Math.ceil((this.x+this.width-t)*e)/e,n=Math.ceil((this.y+this.height-t)*e)/e;return this.x=Math.floor((this.x+t)*e)/e,this.y=Math.floor((this.y+t)*e)/e,this.width=s-this.x,this.height=n-this.y,this}enlarge(e){const t=Math.min(this.x,e.x),s=Math.max(this.x+this.width,e.x+e.width),n=Math.min(this.y,e.y),r=Math.max(this.y+this.height,e.y+e.height);return this.x=t,this.width=s-t,this.y=n,this.height=r-n,this}}lt.prototype.toString=function(){return`[@pixi/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};class Ih{constructor(e=0,t=0,s=0){this.x=e,this.y=t,this.radius=s,this.type=pi.CIRC}clone(){return new Ih(this.x,this.y,this.radius)}contains(e,t){if(this.radius<=0)return!1;const s=this.radius*this.radius;let n=this.x-e,r=this.y-t;return n*=n,r*=r,n+r<=s}getBounds(){return new lt(this.x-this.radius,this.y-this.radius,this.radius*2,this.radius*2)}}Ih.prototype.toString=function(){return`[@pixi/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`};class Rh{constructor(e=0,t=0,s=0,n=0){this.x=e,this.y=t,this.width=s,this.height=n,this.type=pi.ELIP}clone(){return new Rh(this.x,this.y,this.width,this.height)}contains(e,t){if(this.width<=0||this.height<=0)return!1;let s=(e-this.x)/this.width,n=(t-this.y)/this.height;return s*=s,n*=n,s+n<=1}getBounds(){return new lt(this.x-this.width,this.y-this.height,this.width,this.height)}}Rh.prototype.toString=function(){return`[@pixi/math:Ellipse x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};class vr{constructor(...e){let t=Array.isArray(e[0])?e[0]:e;if(typeof t[0]!="number"){const s=[];for(let n=0,r=t.length;n<r;n++)s.push(t[n].x,t[n].y);t=s}this.points=t,this.type=pi.POLY,this.closeStroke=!0}clone(){const e=this.points.slice(),t=new vr(e);return t.closeStroke=this.closeStroke,t}contains(e,t){let s=!1;const n=this.points.length/2;for(let r=0,o=n-1;r<n;o=r++){const a=this.points[r*2],h=this.points[r*2+1],l=this.points[o*2],c=this.points[o*2+1];h>t!=c>t&&e<(l-a)*((t-h)/(c-h))+a&&(s=!s)}return s}}vr.prototype.toString=function(){return`[@pixi/math:PolygoncloseStroke=${this.closeStroke}points=${this.points.reduce((i,e)=>`${i}, ${e}`,"")}]`};class Ph{constructor(e=0,t=0,s=0,n=0,r=20){this.x=e,this.y=t,this.width=s,this.height=n,this.radius=r,this.type=pi.RREC}clone(){return new Ph(this.x,this.y,this.width,this.height,this.radius)}contains(e,t){if(this.width<=0||this.height<=0)return!1;if(e>=this.x&&e<=this.x+this.width&&t>=this.y&&t<=this.y+this.height){const s=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(t>=this.y+s&&t<=this.y+this.height-s||e>=this.x+s&&e<=this.x+this.width-s)return!0;let n=e-(this.x+s),r=t-(this.y+s);const o=s*s;if(n*n+r*r<=o||(n=e-(this.x+this.width-s),n*n+r*r<=o)||(r=t-(this.y+this.height-s),n*n+r*r<=o)||(n=e-(this.x+s),n*n+r*r<=o))return!0}return!1}}Ph.prototype.toString=function(){return`[@pixi/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`};class Vt{constructor(e=1,t=0,s=0,n=1,r=0,o=0){this.array=null,this.a=e,this.b=t,this.c=s,this.d=n,this.tx=r,this.ty=o}fromArray(e){this.a=e[0],this.b=e[1],this.c=e[3],this.d=e[4],this.tx=e[2],this.ty=e[5]}set(e,t,s,n,r,o){return this.a=e,this.b=t,this.c=s,this.d=n,this.tx=r,this.ty=o,this}toArray(e,t){this.array||(this.array=new Float32Array(9));const s=t||this.array;return e?(s[0]=this.a,s[1]=this.b,s[2]=0,s[3]=this.c,s[4]=this.d,s[5]=0,s[6]=this.tx,s[7]=this.ty,s[8]=1):(s[0]=this.a,s[1]=this.c,s[2]=this.tx,s[3]=this.b,s[4]=this.d,s[5]=this.ty,s[6]=0,s[7]=0,s[8]=1),s}apply(e,t){t=t||new bt;const s=e.x,n=e.y;return t.x=this.a*s+this.c*n+this.tx,t.y=this.b*s+this.d*n+this.ty,t}applyInverse(e,t){t=t||new bt;const s=1/(this.a*this.d+this.c*-this.b),n=e.x,r=e.y;return t.x=this.d*s*n+-this.c*s*r+(this.ty*this.c-this.tx*this.d)*s,t.y=this.a*s*r+-this.b*s*n+(-this.ty*this.a+this.tx*this.b)*s,t}translate(e,t){return this.tx+=e,this.ty+=t,this}scale(e,t){return this.a*=e,this.d*=t,this.c*=e,this.b*=t,this.tx*=e,this.ty*=t,this}rotate(e){const t=Math.cos(e),s=Math.sin(e),n=this.a,r=this.c,o=this.tx;return this.a=n*t-this.b*s,this.b=n*s+this.b*t,this.c=r*t-this.d*s,this.d=r*s+this.d*t,this.tx=o*t-this.ty*s,this.ty=o*s+this.ty*t,this}append(e){const t=this.a,s=this.b,n=this.c,r=this.d;return this.a=e.a*t+e.b*n,this.b=e.a*s+e.b*r,this.c=e.c*t+e.d*n,this.d=e.c*s+e.d*r,this.tx=e.tx*t+e.ty*n+this.tx,this.ty=e.tx*s+e.ty*r+this.ty,this}setTransform(e,t,s,n,r,o,a,h,l){return this.a=Math.cos(a+l)*r,this.b=Math.sin(a+l)*r,this.c=-Math.sin(a-h)*o,this.d=Math.cos(a-h)*o,this.tx=e-(s*this.a+n*this.c),this.ty=t-(s*this.b+n*this.d),this}prepend(e){const t=this.tx;if(e.a!==1||e.b!==0||e.c!==0||e.d!==1){const s=this.a,n=this.c;this.a=s*e.a+this.b*e.c,this.b=s*e.b+this.b*e.d,this.c=n*e.a+this.d*e.c,this.d=n*e.b+this.d*e.d}return this.tx=t*e.a+this.ty*e.c+e.tx,this.ty=t*e.b+this.ty*e.d+e.ty,this}decompose(e){const t=this.a,s=this.b,n=this.c,r=this.d,o=e.pivot,a=-Math.atan2(-n,r),h=Math.atan2(s,t),l=Math.abs(a+h);return l<1e-5||Math.abs(Ol-l)<1e-5?(e.rotation=h,e.skew.x=e.skew.y=0):(e.rotation=0,e.skew.x=a,e.skew.y=h),e.scale.x=Math.sqrt(t*t+s*s),e.scale.y=Math.sqrt(n*n+r*r),e.position.x=this.tx+(o.x*t+o.y*n),e.position.y=this.ty+(o.x*s+o.y*r),e}invert(){const e=this.a,t=this.b,s=this.c,n=this.d,r=this.tx,o=e*n-t*s;return this.a=n/o,this.b=-t/o,this.c=-s/o,this.d=e/o,this.tx=(s*this.ty-n*r)/o,this.ty=-(e*this.ty-t*r)/o,this}identity(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this}clone(){const e=new Vt;return e.a=this.a,e.b=this.b,e.c=this.c,e.d=this.d,e.tx=this.tx,e.ty=this.ty,e}copyTo(e){return e.a=this.a,e.b=this.b,e.c=this.c,e.d=this.d,e.tx=this.tx,e.ty=this.ty,e}copyFrom(e){return this.a=e.a,this.b=e.b,this.c=e.c,this.d=e.d,this.tx=e.tx,this.ty=e.ty,this}static get IDENTITY(){return new Vt}static get TEMP_MATRIX(){return new Vt}}Vt.prototype.toString=function(){return`[@pixi/math:Matrix a=${this.a} b=${this.b} c=${this.c} d=${this.d} tx=${this.tx} ty=${this.ty}]`};const hr=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],cr=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],ur=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],dr=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],Ku=[],nv=[],Da=Math.sign;function M_(){for(let i=0;i<16;i++){const e=[];Ku.push(e);for(let t=0;t<16;t++){const s=Da(hr[i]*hr[t]+ur[i]*cr[t]),n=Da(cr[i]*hr[t]+dr[i]*cr[t]),r=Da(hr[i]*ur[t]+ur[i]*dr[t]),o=Da(cr[i]*ur[t]+dr[i]*dr[t]);for(let a=0;a<16;a++)if(hr[a]===s&&cr[a]===n&&ur[a]===r&&dr[a]===o){e.push(a);break}}}for(let i=0;i<16;i++){const e=new Vt;e.set(hr[i],cr[i],ur[i],dr[i],0,0),nv.push(e)}}M_();const Gt={E:0,SE:1,S:2,SW:3,W:4,NW:5,N:6,NE:7,MIRROR_VERTICAL:8,MAIN_DIAGONAL:10,MIRROR_HORIZONTAL:12,REVERSE_DIAGONAL:14,uX:i=>hr[i],uY:i=>cr[i],vX:i=>ur[i],vY:i=>dr[i],inv:i=>i&8?i&15:-i&7,add:(i,e)=>Ku[i][e],sub:(i,e)=>Ku[i][Gt.inv(e)],rotate180:i=>i^4,isVertical:i=>(i&3)===2,byDirection:(i,e)=>Math.abs(i)*2<=Math.abs(e)?e>=0?Gt.S:Gt.N:Math.abs(e)*2<=Math.abs(i)?i>0?Gt.E:Gt.W:e>0?i>0?Gt.SE:Gt.SW:i>0?Gt.NE:Gt.NW,matrixAppendRotationInv:(i,e,t=0,s=0)=>{const n=nv[Gt.inv(e)];n.tx=t,n.ty=s,i.append(n)}};class fn{constructor(e,t,s=0,n=0){this._x=s,this._y=n,this.cb=e,this.scope=t}clone(e=this.cb,t=this.scope){return new fn(e,t,this._x,this._y)}set(e=0,t=e){return(this._x!==e||this._y!==t)&&(this._x=e,this._y=t,this.cb.call(this.scope)),this}copyFrom(e){return(this._x!==e.x||this._y!==e.y)&&(this._x=e.x,this._y=e.y,this.cb.call(this.scope)),this}copyTo(e){return e.set(this._x,this._y),e}equals(e){return e.x===this._x&&e.y===this._y}get x(){return this._x}set x(e){this._x!==e&&(this._x=e,this.cb.call(this.scope))}get y(){return this._y}set y(e){this._y!==e&&(this._y=e,this.cb.call(this.scope))}}fn.prototype.toString=function(){return`[@pixi/math:ObservablePoint x=${this.x} y=${this.y} scope=${this.scope}]`};const Zu=class{constructor(){this.worldTransform=new Vt,this.localTransform=new Vt,this.position=new fn(this.onChange,this,0,0),this.scale=new fn(this.onChange,this,1,1),this.pivot=new fn(this.onChange,this,0,0),this.skew=new fn(this.updateSkew,this,0,0),this._rotation=0,this._cx=1,this._sx=0,this._cy=0,this._sy=1,this._localID=0,this._currentLocalID=0,this._worldID=0,this._parentID=0}onChange(){this._localID++}updateSkew(){this._cx=Math.cos(this._rotation+this.skew.y),this._sx=Math.sin(this._rotation+this.skew.y),this._cy=-Math.sin(this._rotation-this.skew.x),this._sy=Math.cos(this._rotation-this.skew.x),this._localID++}updateLocalTransform(){const i=this.localTransform;this._localID!==this._currentLocalID&&(i.a=this._cx*this.scale.x,i.b=this._sx*this.scale.x,i.c=this._cy*this.scale.y,i.d=this._sy*this.scale.y,i.tx=this.position.x-(this.pivot.x*i.a+this.pivot.y*i.c),i.ty=this.position.y-(this.pivot.x*i.b+this.pivot.y*i.d),this._currentLocalID=this._localID,this._parentID=-1)}updateTransform(i){const e=this.localTransform;if(this._localID!==this._currentLocalID&&(e.a=this._cx*this.scale.x,e.b=this._sx*this.scale.x,e.c=this._cy*this.scale.y,e.d=this._sy*this.scale.y,e.tx=this.position.x-(this.pivot.x*e.a+this.pivot.y*e.c),e.ty=this.position.y-(this.pivot.x*e.b+this.pivot.y*e.d),this._currentLocalID=this._localID,this._parentID=-1),this._parentID!==i._worldID){const t=i.worldTransform,s=this.worldTransform;s.a=e.a*t.a+e.b*t.c,s.b=e.a*t.b+e.b*t.d,s.c=e.c*t.a+e.d*t.c,s.d=e.c*t.b+e.d*t.d,s.tx=e.tx*t.a+e.ty*t.c+t.tx,s.ty=e.tx*t.b+e.ty*t.d+t.ty,this._parentID=i._worldID,this._worldID++}}setFromMatrix(i){i.decompose(this),this._localID++}get rotation(){return this._rotation}set rotation(i){this._rotation!==i&&(this._rotation=i,this.updateSkew())}};Zu.IDENTITY=new Zu;let ef=Zu;ef.prototype.toString=function(){return`[@pixi/math:Transform position=(${this.position.x}, ${this.position.y}) rotation=${this.rotation} scale=(${this.scale.x}, ${this.scale.y}) skew=(${this.skew.x}, ${this.skew.y}) ]`};var E_=`varying vec2 vTextureCoord;
|
||
|
||
uniform sampler2D uSampler;
|
||
|
||
void main(void){
|
||
gl_FragColor *= texture2D(uSampler, vTextureCoord);
|
||
}`,A_=`attribute vec2 aVertexPosition;
|
||
attribute vec2 aTextureCoord;
|
||
|
||
uniform mat3 projectionMatrix;
|
||
|
||
varying vec2 vTextureCoord;
|
||
|
||
void main(void){
|
||
gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
|
||
vTextureCoord = aTextureCoord;
|
||
}
|
||
`;function _m(i,e,t){const s=i.createShader(e);return i.shaderSource(s,t),i.compileShader(s),s}function ru(i){const e=new Array(i);for(let t=0;t<e.length;t++)e[t]=!1;return e}function rv(i,e){switch(i){case"float":return 0;case"vec2":return new Float32Array(2*e);case"vec3":return new Float32Array(3*e);case"vec4":return new Float32Array(4*e);case"int":case"uint":case"sampler2D":case"sampler2DArray":return 0;case"ivec2":return new Int32Array(2*e);case"ivec3":return new Int32Array(3*e);case"ivec4":return new Int32Array(4*e);case"uvec2":return new Uint32Array(2*e);case"uvec3":return new Uint32Array(3*e);case"uvec4":return new Uint32Array(4*e);case"bool":return!1;case"bvec2":return ru(2*e);case"bvec3":return ru(3*e);case"bvec4":return ru(4*e);case"mat2":return new Float32Array([1,0,0,1]);case"mat3":return new Float32Array([1,0,0,0,1,0,0,0,1]);case"mat4":return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}return null}const lo=[{test:i=>i.type==="float"&&i.size===1&&!i.isArray,code:i=>`
|
||
if(uv["${i}"] !== ud["${i}"].value)
|
||
{
|
||
ud["${i}"].value = uv["${i}"]
|
||
gl.uniform1f(ud["${i}"].location, uv["${i}"])
|
||
}
|
||
`},{test:(i,e)=>(i.type==="sampler2D"||i.type==="samplerCube"||i.type==="sampler2DArray")&&i.size===1&&!i.isArray&&(e==null||e.castToBaseTexture!==void 0),code:i=>`t = syncData.textureCount++;
|
||
|
||
renderer.texture.bind(uv["${i}"], t);
|
||
|
||
if(ud["${i}"].value !== t)
|
||
{
|
||
ud["${i}"].value = t;
|
||
gl.uniform1i(ud["${i}"].location, t);
|
||
; // eslint-disable-line max-len
|
||
}`},{test:(i,e)=>i.type==="mat3"&&i.size===1&&!i.isArray&&e.a!==void 0,code:i=>`
|
||
gl.uniformMatrix3fv(ud["${i}"].location, false, uv["${i}"].toArray(true));
|
||
`,codeUbo:i=>`
|
||
var ${i}_matrix = uv.${i}.toArray(true);
|
||
|
||
data[offset] = ${i}_matrix[0];
|
||
data[offset+1] = ${i}_matrix[1];
|
||
data[offset+2] = ${i}_matrix[2];
|
||
|
||
data[offset + 4] = ${i}_matrix[3];
|
||
data[offset + 5] = ${i}_matrix[4];
|
||
data[offset + 6] = ${i}_matrix[5];
|
||
|
||
data[offset + 8] = ${i}_matrix[6];
|
||
data[offset + 9] = ${i}_matrix[7];
|
||
data[offset + 10] = ${i}_matrix[8];
|
||
`},{test:(i,e)=>i.type==="vec2"&&i.size===1&&!i.isArray&&e.x!==void 0,code:i=>`
|
||
cv = ud["${i}"].value;
|
||
v = uv["${i}"];
|
||
|
||
if(cv[0] !== v.x || cv[1] !== v.y)
|
||
{
|
||
cv[0] = v.x;
|
||
cv[1] = v.y;
|
||
gl.uniform2f(ud["${i}"].location, v.x, v.y);
|
||
}`,codeUbo:i=>`
|
||
v = uv.${i};
|
||
|
||
data[offset] = v.x;
|
||
data[offset+1] = v.y;
|
||
`},{test:i=>i.type==="vec2"&&i.size===1&&!i.isArray,code:i=>`
|
||
cv = ud["${i}"].value;
|
||
v = uv["${i}"];
|
||
|
||
if(cv[0] !== v[0] || cv[1] !== v[1])
|
||
{
|
||
cv[0] = v[0];
|
||
cv[1] = v[1];
|
||
gl.uniform2f(ud["${i}"].location, v[0], v[1]);
|
||
}
|
||
`},{test:(i,e)=>i.type==="vec4"&&i.size===1&&!i.isArray&&e.width!==void 0,code:i=>`
|
||
cv = ud["${i}"].value;
|
||
v = uv["${i}"];
|
||
|
||
if(cv[0] !== v.x || cv[1] !== v.y || cv[2] !== v.width || cv[3] !== v.height)
|
||
{
|
||
cv[0] = v.x;
|
||
cv[1] = v.y;
|
||
cv[2] = v.width;
|
||
cv[3] = v.height;
|
||
gl.uniform4f(ud["${i}"].location, v.x, v.y, v.width, v.height)
|
||
}`,codeUbo:i=>`
|
||
v = uv.${i};
|
||
|
||
data[offset] = v.x;
|
||
data[offset+1] = v.y;
|
||
data[offset+2] = v.width;
|
||
data[offset+3] = v.height;
|
||
`},{test:(i,e)=>i.type==="vec4"&&i.size===1&&!i.isArray&&e.red!==void 0,code:i=>`
|
||
cv = ud["${i}"].value;
|
||
v = uv["${i}"];
|
||
|
||
if(cv[0] !== v.red || cv[1] !== v.green || cv[2] !== v.blue || cv[3] !== v.alpha)
|
||
{
|
||
cv[0] = v.red;
|
||
cv[1] = v.green;
|
||
cv[2] = v.blue;
|
||
cv[3] = v.alpha;
|
||
gl.uniform4f(ud["${i}"].location, v.red, v.green, v.blue, v.alpha)
|
||
}`,codeUbo:i=>`
|
||
v = uv.${i};
|
||
|
||
data[offset] = v.red;
|
||
data[offset+1] = v.green;
|
||
data[offset+2] = v.blue;
|
||
data[offset+3] = v.alpha;
|
||
`},{test:(i,e)=>i.type==="vec3"&&i.size===1&&!i.isArray&&e.red!==void 0,code:i=>`
|
||
cv = ud["${i}"].value;
|
||
v = uv["${i}"];
|
||
|
||
if(cv[0] !== v.red || cv[1] !== v.green || cv[2] !== v.blue || cv[3] !== v.a)
|
||
{
|
||
cv[0] = v.red;
|
||
cv[1] = v.green;
|
||
cv[2] = v.blue;
|
||
|
||
gl.uniform3f(ud["${i}"].location, v.red, v.green, v.blue)
|
||
}`,codeUbo:i=>`
|
||
v = uv.${i};
|
||
|
||
data[offset] = v.red;
|
||
data[offset+1] = v.green;
|
||
data[offset+2] = v.blue;
|
||
`},{test:i=>i.type==="vec4"&&i.size===1&&!i.isArray,code:i=>`
|
||
cv = ud["${i}"].value;
|
||
v = uv["${i}"];
|
||
|
||
if(cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])
|
||
{
|
||
cv[0] = v[0];
|
||
cv[1] = v[1];
|
||
cv[2] = v[2];
|
||
cv[3] = v[3];
|
||
|
||
gl.uniform4f(ud["${i}"].location, v[0], v[1], v[2], v[3])
|
||
}`}],C_={float:`
|
||
if (cv !== v)
|
||
{
|
||
cu.value = v;
|
||
gl.uniform1f(location, v);
|
||
}`,vec2:`
|
||
if (cv[0] !== v[0] || cv[1] !== v[1])
|
||
{
|
||
cv[0] = v[0];
|
||
cv[1] = v[1];
|
||
|
||
gl.uniform2f(location, v[0], v[1])
|
||
}`,vec3:`
|
||
if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])
|
||
{
|
||
cv[0] = v[0];
|
||
cv[1] = v[1];
|
||
cv[2] = v[2];
|
||
|
||
gl.uniform3f(location, v[0], v[1], v[2])
|
||
}`,vec4:`
|
||
if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])
|
||
{
|
||
cv[0] = v[0];
|
||
cv[1] = v[1];
|
||
cv[2] = v[2];
|
||
cv[3] = v[3];
|
||
|
||
gl.uniform4f(location, v[0], v[1], v[2], v[3]);
|
||
}`,int:`
|
||
if (cv !== v)
|
||
{
|
||
cu.value = v;
|
||
|
||
gl.uniform1i(location, v);
|
||
}`,ivec2:`
|
||
if (cv[0] !== v[0] || cv[1] !== v[1])
|
||
{
|
||
cv[0] = v[0];
|
||
cv[1] = v[1];
|
||
|
||
gl.uniform2i(location, v[0], v[1]);
|
||
}`,ivec3:`
|
||
if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])
|
||
{
|
||
cv[0] = v[0];
|
||
cv[1] = v[1];
|
||
cv[2] = v[2];
|
||
|
||
gl.uniform3i(location, v[0], v[1], v[2]);
|
||
}`,ivec4:`
|
||
if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])
|
||
{
|
||
cv[0] = v[0];
|
||
cv[1] = v[1];
|
||
cv[2] = v[2];
|
||
cv[3] = v[3];
|
||
|
||
gl.uniform4i(location, v[0], v[1], v[2], v[3]);
|
||
}`,uint:`
|
||
if (cv !== v)
|
||
{
|
||
cu.value = v;
|
||
|
||
gl.uniform1ui(location, v);
|
||
}`,uvec2:`
|
||
if (cv[0] !== v[0] || cv[1] !== v[1])
|
||
{
|
||
cv[0] = v[0];
|
||
cv[1] = v[1];
|
||
|
||
gl.uniform2ui(location, v[0], v[1]);
|
||
}`,uvec3:`
|
||
if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])
|
||
{
|
||
cv[0] = v[0];
|
||
cv[1] = v[1];
|
||
cv[2] = v[2];
|
||
|
||
gl.uniform3ui(location, v[0], v[1], v[2]);
|
||
}`,uvec4:`
|
||
if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])
|
||
{
|
||
cv[0] = v[0];
|
||
cv[1] = v[1];
|
||
cv[2] = v[2];
|
||
cv[3] = v[3];
|
||
|
||
gl.uniform4ui(location, v[0], v[1], v[2], v[3]);
|
||
}`,bool:`
|
||
if (cv !== v)
|
||
{
|
||
cu.value = v;
|
||
gl.uniform1i(location, v);
|
||
}`,bvec2:`
|
||
if (cv[0] != v[0] || cv[1] != v[1])
|
||
{
|
||
cv[0] = v[0];
|
||
cv[1] = v[1];
|
||
|
||
gl.uniform2i(location, v[0], v[1]);
|
||
}`,bvec3:`
|
||
if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])
|
||
{
|
||
cv[0] = v[0];
|
||
cv[1] = v[1];
|
||
cv[2] = v[2];
|
||
|
||
gl.uniform3i(location, v[0], v[1], v[2]);
|
||
}`,bvec4:`
|
||
if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])
|
||
{
|
||
cv[0] = v[0];
|
||
cv[1] = v[1];
|
||
cv[2] = v[2];
|
||
cv[3] = v[3];
|
||
|
||
gl.uniform4i(location, v[0], v[1], v[2], v[3]);
|
||
}`,mat2:"gl.uniformMatrix2fv(location, false, v)",mat3:"gl.uniformMatrix3fv(location, false, v)",mat4:"gl.uniformMatrix4fv(location, false, v)",sampler2D:`
|
||
if (cv !== v)
|
||
{
|
||
cu.value = v;
|
||
|
||
gl.uniform1i(location, v);
|
||
}`,samplerCube:`
|
||
if (cv !== v)
|
||
{
|
||
cu.value = v;
|
||
|
||
gl.uniform1i(location, v);
|
||
}`,sampler2DArray:`
|
||
if (cv !== v)
|
||
{
|
||
cu.value = v;
|
||
|
||
gl.uniform1i(location, v);
|
||
}`},I_={float:"gl.uniform1fv(location, v)",vec2:"gl.uniform2fv(location, v)",vec3:"gl.uniform3fv(location, v)",vec4:"gl.uniform4fv(location, v)",mat4:"gl.uniformMatrix4fv(location, false, v)",mat3:"gl.uniformMatrix3fv(location, false, v)",mat2:"gl.uniformMatrix2fv(location, false, v)",int:"gl.uniform1iv(location, v)",ivec2:"gl.uniform2iv(location, v)",ivec3:"gl.uniform3iv(location, v)",ivec4:"gl.uniform4iv(location, v)",uint:"gl.uniform1uiv(location, v)",uvec2:"gl.uniform2uiv(location, v)",uvec3:"gl.uniform3uiv(location, v)",uvec4:"gl.uniform4uiv(location, v)",bool:"gl.uniform1iv(location, v)",bvec2:"gl.uniform2iv(location, v)",bvec3:"gl.uniform3iv(location, v)",bvec4:"gl.uniform4iv(location, v)",sampler2D:"gl.uniform1iv(location, v)",samplerCube:"gl.uniform1iv(location, v)",sampler2DArray:"gl.uniform1iv(location, v)"};function R_(i,e){var s;const t=[`
|
||
var v = null;
|
||
var cv = null;
|
||
var cu = null;
|
||
var t = 0;
|
||
var gl = renderer.gl;
|
||
`];for(const n in i.uniforms){const r=e[n];if(!r){((s=i.uniforms[n])==null?void 0:s.group)===!0&&(i.uniforms[n].ubo?t.push(`
|
||
renderer.shader.syncUniformBufferGroup(uv.${n}, '${n}');
|
||
`):t.push(`
|
||
renderer.shader.syncUniformGroup(uv.${n}, syncData);
|
||
`));continue}const o=i.uniforms[n];let a=!1;for(let h=0;h<lo.length;h++)if(lo[h].test(r,o)){t.push(lo[h].code(n,o)),a=!0;break}if(!a){const h=(r.size===1&&!r.isArray?C_:I_)[r.type].replace("location",`ud["${n}"].location`);t.push(`
|
||
cu = ud["${n}"];
|
||
cv = cu.value;
|
||
v = uv["${n}"];
|
||
${h};`)}}return new Function("ud","uv","renderer","syncData",t.join(`
|
||
`))}const ov={};let Dr=ov;function P_(){if(Dr===ov||Dr!=null&&Dr.isContextLost()){const i=Ve.ADAPTER.createCanvas();let e;Ve.PREFER_ENV>=Cr.WEBGL2&&(e=i.getContext("webgl2",{})),e||(e=i.getContext("webgl",{})||i.getContext("experimental-webgl",{}),e?e.getExtension("WEBGL_draw_buffers"):e=null),Dr=e}return Dr}let Na;function k_(){if(!Na){Na=zi.MEDIUM;const i=P_();if(i&&i.getShaderPrecisionFormat){const e=i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.HIGH_FLOAT);e&&(Na=e.precision?zi.HIGH:zi.MEDIUM)}}return Na}function Sm(i,e){const t=i.getShaderSource(e).split(`
|
||
`).map((l,c)=>`${c}: ${l}`),s=i.getShaderInfoLog(e),n=s.split(`
|
||
`),r={},o=n.map(l=>parseFloat(l.replace(/^ERROR\: 0\:([\d]+)\:.*$/,"$1"))).filter(l=>l&&!r[l]?(r[l]=!0,!0):!1),a=[""];o.forEach(l=>{t[l-1]=`%c${t[l-1]}%c`,a.push("background: #FF0000; color:#FFFFFF; font-size: 10px","font-size: 10px")});const h=t.join(`
|
||
`);a[0]=h,console.error(s),console.groupCollapsed("click to view full shader code"),console.warn(...a),console.groupEnd()}function F_(i,e,t,s){i.getProgramParameter(e,i.LINK_STATUS)||(i.getShaderParameter(t,i.COMPILE_STATUS)||Sm(i,t),i.getShaderParameter(s,i.COMPILE_STATUS)||Sm(i,s),console.error("PixiJS Error: Could not initialize shader."),i.getProgramInfoLog(e)!==""&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",i.getProgramInfoLog(e)))}const O_={float:1,vec2:2,vec3:3,vec4:4,int:1,ivec2:2,ivec3:3,ivec4:4,uint:1,uvec2:2,uvec3:3,uvec4:4,bool:1,bvec2:2,bvec3:3,bvec4:4,mat2:4,mat3:9,mat4:16,sampler2D:1};function av(i){return O_[i]}let Ua=null;const Tm={FLOAT:"float",FLOAT_VEC2:"vec2",FLOAT_VEC3:"vec3",FLOAT_VEC4:"vec4",INT:"int",INT_VEC2:"ivec2",INT_VEC3:"ivec3",INT_VEC4:"ivec4",UNSIGNED_INT:"uint",UNSIGNED_INT_VEC2:"uvec2",UNSIGNED_INT_VEC3:"uvec3",UNSIGNED_INT_VEC4:"uvec4",BOOL:"bool",BOOL_VEC2:"bvec2",BOOL_VEC3:"bvec3",BOOL_VEC4:"bvec4",FLOAT_MAT2:"mat2",FLOAT_MAT3:"mat3",FLOAT_MAT4:"mat4",SAMPLER_2D:"sampler2D",INT_SAMPLER_2D:"sampler2D",UNSIGNED_INT_SAMPLER_2D:"sampler2D",SAMPLER_CUBE:"samplerCube",INT_SAMPLER_CUBE:"samplerCube",UNSIGNED_INT_SAMPLER_CUBE:"samplerCube",SAMPLER_2D_ARRAY:"sampler2DArray",INT_SAMPLER_2D_ARRAY:"sampler2DArray",UNSIGNED_INT_SAMPLER_2D_ARRAY:"sampler2DArray"};function lv(i,e){if(!Ua){const t=Object.keys(Tm);Ua={};for(let s=0;s<t.length;++s){const n=t[s];Ua[i[n]]=Tm[n]}}return Ua[e]}function Mm(i,e,t){if(i.substring(0,9)!=="precision"){let s=e;return e===zi.HIGH&&t!==zi.HIGH&&(s=zi.MEDIUM),`precision ${s} float;
|
||
${i}`}else if(t!==zi.HIGH&&i.substring(0,15)==="precision highp")return i.replace("precision highp","precision mediump");return i}let Fo;function B_(){if(typeof Fo=="boolean")return Fo;try{Fo=new Function("param1","param2","param3","return param1[param2] === param3;")({a:"b"},"a","b")===!0}catch{Fo=!1}return Fo}let L_=0;const Va={},Ju=class Wr{constructor(e,t,s="pixi-shader",n={}){this.extra={},this.id=L_++,this.vertexSrc=e||Wr.defaultVertexSrc,this.fragmentSrc=t||Wr.defaultFragmentSrc,this.vertexSrc=this.vertexSrc.trim(),this.fragmentSrc=this.fragmentSrc.trim(),this.extra=n,this.vertexSrc.substring(0,8)!=="#version"&&(s=s.replace(/\s+/g,"-"),Va[s]?(Va[s]++,s+=`-${Va[s]}`):Va[s]=1,this.vertexSrc=`#define SHADER_NAME ${s}
|
||
${this.vertexSrc}`,this.fragmentSrc=`#define SHADER_NAME ${s}
|
||
${this.fragmentSrc}`,this.vertexSrc=Mm(this.vertexSrc,Wr.defaultVertexPrecision,zi.HIGH),this.fragmentSrc=Mm(this.fragmentSrc,Wr.defaultFragmentPrecision,k_())),this.glPrograms={},this.syncUniforms=null}static get defaultVertexSrc(){return A_}static get defaultFragmentSrc(){return E_}static from(e,t,s){const n=e+t;let r=vm[n];return r||(vm[n]=r=new Wr(e,t,s)),r}};Ju.defaultVertexPrecision=zi.HIGH,Ju.defaultFragmentPrecision=dn.apple.device?zi.HIGH:zi.MEDIUM;let Vs=Ju,D_=0;class fs{constructor(e,t,s){this.group=!0,this.syncUniforms={},this.dirtyId=0,this.id=D_++,this.static=!!t,this.ubo=!!s,e instanceof Nt?(this.buffer=e,this.buffer.type=$s.UNIFORM_BUFFER,this.autoManage=!1,this.ubo=!0):(this.uniforms=e,this.ubo&&(this.buffer=new Nt(new Float32Array(1)),this.buffer.type=$s.UNIFORM_BUFFER,this.autoManage=!0))}update(){this.dirtyId++,!this.autoManage&&this.buffer&&this.buffer.update()}add(e,t,s){if(!this.ubo)this.uniforms[e]=new fs(t,s);else throw new Error("[UniformGroup] uniform groups in ubo mode cannot be modified, or have uniform groups nested in them")}static from(e,t,s){return new fs(e,t,s)}static uboFrom(e,t){return new fs(e,t??!0,!0)}}class ps{constructor(e,t){this.uniformBindCount=0,this.program=e,t?t instanceof fs?this.uniformGroup=t:this.uniformGroup=new fs(t):this.uniformGroup=new fs({}),this.disposeRunner=new ds("disposeShader")}checkUniformExists(e,t){if(t.uniforms[e])return!0;for(const s in t.uniforms){const n=t.uniforms[s];if(n.group===!0&&this.checkUniformExists(e,n))return!0}return!1}destroy(){this.uniformGroup=null,this.disposeRunner.emit(this),this.disposeRunner.destroy()}get uniforms(){return this.uniformGroup.uniforms}static from(e,t,s){const n=Vs.from(e,t);return new ps(n,s)}}class hv{constructor(e,t){if(this.vertexSrc=e,this.fragTemplate=t,this.programCache={},this.defaultGroupCache={},!t.includes("%count%"))throw new Error('Fragment template must contain "%count%".');if(!t.includes("%forloop%"))throw new Error('Fragment template must contain "%forloop%".')}generateShader(e){if(!this.programCache[e]){const s=new Int32Array(e);for(let r=0;r<e;r++)s[r]=r;this.defaultGroupCache[e]=fs.from({uSamplers:s},!0);let n=this.fragTemplate;n=n.replace(/%count%/gi,`${e}`),n=n.replace(/%forloop%/gi,this.generateSampleSrc(e)),this.programCache[e]=new Vs(this.vertexSrc,n)}const t={tint:new Float32Array([1,1,1,1]),translationMatrix:new Vt,default:this.defaultGroupCache[e]};return new ps(this.programCache[e],t)}generateSampleSrc(e){let t="";t+=`
|
||
`,t+=`
|
||
`;for(let s=0;s<e;s++)s>0&&(t+=`
|
||
else `),s<e-1&&(t+=`if(vTextureId < ${s}.5)`),t+=`
|
||
{`,t+=`
|
||
color = texture2D(uSamplers[${s}], vTextureCoord);`,t+=`
|
||
}`;return t+=`
|
||
`,t+=`
|
||
`,t}}class Qu{constructor(){this.elements=[],this.ids=[],this.count=0}clear(){for(let e=0;e<this.count;e++)this.elements[e]=null;this.count=0}}function N_(){return!dn.apple.device}function U_(i){let e=!0;const t=Ve.ADAPTER.getNavigator();if(dn.tablet||dn.phone){if(dn.apple.device){const s=t.userAgent.match(/OS (\d+)_(\d+)?/);s&&parseInt(s[1],10)<11&&(e=!1)}if(dn.android.device){const s=t.userAgent.match(/Android\s([0-9.]*)/);s&&parseInt(s[1],10)<7&&(e=!1)}}return e?i:4}class kh{constructor(e){this.renderer=e}flush(){}destroy(){this.renderer=null}start(){}stop(){this.flush()}render(e){}}var V_=`varying vec2 vTextureCoord;
|
||
varying vec4 vColor;
|
||
varying float vTextureId;
|
||
uniform sampler2D uSamplers[%count%];
|
||
|
||
void main(void){
|
||
vec4 color;
|
||
%forloop%
|
||
gl_FragColor = color * vColor;
|
||
}
|
||
`,X_=`precision highp float;
|
||
attribute vec2 aVertexPosition;
|
||
attribute vec2 aTextureCoord;
|
||
attribute vec4 aColor;
|
||
attribute float aTextureId;
|
||
|
||
uniform mat3 projectionMatrix;
|
||
uniform mat3 translationMatrix;
|
||
uniform vec4 tint;
|
||
|
||
varying vec2 vTextureCoord;
|
||
varying vec4 vColor;
|
||
varying float vTextureId;
|
||
|
||
void main(void){
|
||
gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
|
||
|
||
vTextureCoord = aTextureCoord;
|
||
vTextureId = aTextureId;
|
||
vColor = aColor * tint;
|
||
}
|
||
`;const $o=class ns extends kh{constructor(e){super(e),this.setShaderGenerator(),this.geometryClass=sv,this.vertexSize=6,this.state=zs.for2d(),this.size=ns.defaultBatchSize*4,this._vertexCount=0,this._indexCount=0,this._bufferedElements=[],this._bufferedTextures=[],this._bufferSize=0,this._shader=null,this._packedGeometries=[],this._packedGeometryPoolSize=2,this._flushId=0,this._aBuffers={},this._iBuffers={},this.maxTextures=1,this.renderer.on("prerender",this.onPrerender,this),e.runners.contextChange.add(this),this._dcIndex=0,this._aIndex=0,this._iIndex=0,this._attributeBuffer=null,this._indexBuffer=null,this._tempBoundTextures=[]}static get defaultMaxTextures(){return this._defaultMaxTextures=this._defaultMaxTextures??U_(32),this._defaultMaxTextures}static set defaultMaxTextures(e){this._defaultMaxTextures=e}static get canUploadSameBuffer(){return this._canUploadSameBuffer=this._canUploadSameBuffer??N_(),this._canUploadSameBuffer}static set canUploadSameBuffer(e){this._canUploadSameBuffer=e}get MAX_TEXTURES(){return pt("7.1.0","BatchRenderer#MAX_TEXTURES renamed to BatchRenderer#maxTextures"),this.maxTextures}static get defaultVertexSrc(){return X_}static get defaultFragmentTemplate(){return V_}setShaderGenerator({vertex:e=ns.defaultVertexSrc,fragment:t=ns.defaultFragmentTemplate}={}){this.shaderGenerator=new hv(e,t)}contextChange(){const e=this.renderer.gl;Ve.PREFER_ENV===Cr.WEBGL_LEGACY?this.maxTextures=1:(this.maxTextures=Math.min(e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),ns.defaultMaxTextures),this.maxTextures=g_(this.maxTextures,e)),this._shader=this.shaderGenerator.generateShader(this.maxTextures);for(let t=0;t<this._packedGeometryPoolSize;t++)this._packedGeometries[t]=new this.geometryClass;this.initFlushBuffers()}initFlushBuffers(){const{_drawCallPool:e,_textureArrayPool:t}=ns,s=this.size/4,n=Math.floor(s/this.maxTextures)+1;for(;e.length<s;)e.push(new qu);for(;t.length<n;)t.push(new Qu);for(let r=0;r<this.maxTextures;r++)this._tempBoundTextures[r]=null}onPrerender(){this._flushId=0}render(e){e._texture.valid&&(this._vertexCount+e.vertexData.length/2>this.size&&this.flush(),this._vertexCount+=e.vertexData.length/2,this._indexCount+=e.indices.length,this._bufferedTextures[this._bufferSize]=e._texture.baseTexture,this._bufferedElements[this._bufferSize++]=e)}buildTexturesAndDrawCalls(){const{_bufferedTextures:e,maxTextures:t}=this,s=ns._textureArrayPool,n=this.renderer.batch,r=this._tempBoundTextures,o=this.renderer.textureGC.count;let a=++st._globalBatch,h=0,l=s[0],c=0;n.copyBoundTextures(r,t);for(let u=0;u<this._bufferSize;++u){const f=e[u];e[u]=null,f._batchEnabled!==a&&(l.count>=t&&(n.boundArray(l,r,a,t),this.buildDrawCalls(l,c,u),c=u,l=s[++h],++a),f._batchEnabled=a,f.touched=o,l.elements[l.count++]=f)}l.count>0&&(n.boundArray(l,r,a,t),this.buildDrawCalls(l,c,this._bufferSize),++h,++a);for(let u=0;u<r.length;u++)r[u]=null;st._globalBatch=a}buildDrawCalls(e,t,s){const{_bufferedElements:n,_attributeBuffer:r,_indexBuffer:o,vertexSize:a}=this,h=ns._drawCallPool;let l=this._dcIndex,c=this._aIndex,u=this._iIndex,f=h[l];f.start=this._iIndex,f.texArray=e;for(let d=t;d<s;++d){const m=n[d],g=m._texture.baseTexture,b=Q0[g.alphaMode?1:0][m.blendMode];n[d]=null,t<d&&f.blend!==b&&(f.size=u-f.start,t=d,f=h[++l],f.texArray=e,f.start=u),this.packInterleavedGeometry(m,r,o,c,u),c+=m.vertexData.length/2*a,u+=m.indices.length,f.blend=b}t<s&&(f.size=u-f.start,++l),this._dcIndex=l,this._aIndex=c,this._iIndex=u}bindAndClearTexArray(e){const t=this.renderer.texture;for(let s=0;s<e.count;s++)t.bind(e.elements[s],e.ids[s]),e.elements[s]=null;e.count=0}updateGeometry(){const{_packedGeometries:e,_attributeBuffer:t,_indexBuffer:s}=this;ns.canUploadSameBuffer?(e[this._flushId]._buffer.update(t.rawBinaryData),e[this._flushId]._indexBuffer.update(s),this.renderer.geometry.updateBuffers()):(this._packedGeometryPoolSize<=this._flushId&&(this._packedGeometryPoolSize++,e[this._flushId]=new this.geometryClass),e[this._flushId]._buffer.update(t.rawBinaryData),e[this._flushId]._indexBuffer.update(s),this.renderer.geometry.bind(e[this._flushId]),this.renderer.geometry.updateBuffers(),this._flushId++)}drawBatches(){const e=this._dcIndex,{gl:t,state:s}=this.renderer,n=ns._drawCallPool;let r=null;for(let o=0;o<e;o++){const{texArray:a,type:h,size:l,start:c,blend:u}=n[o];r!==a&&(r=a,this.bindAndClearTexArray(a)),this.state.blendMode=u,s.set(this.state),t.drawElements(h,l,t.UNSIGNED_SHORT,c*2)}}flush(){this._vertexCount!==0&&(this._attributeBuffer=this.getAttributeBuffer(this._vertexCount),this._indexBuffer=this.getIndexBuffer(this._indexCount),this._aIndex=0,this._iIndex=0,this._dcIndex=0,this.buildTexturesAndDrawCalls(),this.updateGeometry(),this.drawBatches(),this._bufferSize=0,this._vertexCount=0,this._indexCount=0)}start(){this.renderer.state.set(this.state),this.renderer.texture.ensureSamplerType(this.maxTextures),this.renderer.shader.bind(this._shader),ns.canUploadSameBuffer&&this.renderer.geometry.bind(this._packedGeometries[this._flushId])}stop(){this.flush()}destroy(){for(let e=0;e<this._packedGeometryPoolSize;e++)this._packedGeometries[e]&&this._packedGeometries[e].destroy();this.renderer.off("prerender",this.onPrerender,this),this._aBuffers=null,this._iBuffers=null,this._packedGeometries=null,this._attributeBuffer=null,this._indexBuffer=null,this._shader&&(this._shader.destroy(),this._shader=null),super.destroy()}getAttributeBuffer(e){const t=kl(Math.ceil(e/8)),s=mm(t),n=t*8;this._aBuffers.length<=s&&(this._iBuffers.length=s+1);let r=this._aBuffers[n];return r||(this._aBuffers[n]=r=new Hu(n*this.vertexSize*4)),r}getIndexBuffer(e){const t=kl(Math.ceil(e/12)),s=mm(t),n=t*12;this._iBuffers.length<=s&&(this._iBuffers.length=s+1);let r=this._iBuffers[s];return r||(this._iBuffers[s]=r=new Uint16Array(n)),r}packInterleavedGeometry(e,t,s,n,r){const{uint32View:o,float32View:a}=t,h=n/this.vertexSize,l=e.uvs,c=e.indices,u=e.vertexData,f=e._texture.baseTexture._batchLocation,d=Math.min(e.worldAlpha,1),m=At.shared.setValue(e._tintRGB).toPremultiplied(d,e._texture.baseTexture.alphaMode>0);for(let g=0;g<u.length;g+=2)a[n++]=u[g],a[n++]=u[g+1],a[n++]=l[g],a[n++]=l[g+1],o[n++]=m,a[n++]=f;for(let g=0;g<c.length;g++)s[r++]=h+c[g]}};$o.defaultBatchSize=4096,$o.extension={name:"batch",type:Oe.RendererPlugin},$o._drawCallPool=[],$o._textureArrayPool=[];let Bn=$o;He.add(Bn);var Y_=`varying vec2 vTextureCoord;
|
||
|
||
uniform sampler2D uSampler;
|
||
|
||
void main(void){
|
||
gl_FragColor = texture2D(uSampler, vTextureCoord);
|
||
}
|
||
`,$_=`attribute vec2 aVertexPosition;
|
||
|
||
uniform mat3 projectionMatrix;
|
||
|
||
varying vec2 vTextureCoord;
|
||
|
||
uniform vec4 inputSize;
|
||
uniform vec4 outputFrame;
|
||
|
||
vec4 filterVertexPosition( void )
|
||
{
|
||
vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;
|
||
|
||
return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);
|
||
}
|
||
|
||
vec2 filterTextureCoord( void )
|
||
{
|
||
return aVertexPosition * (outputFrame.zw * inputSize.zw);
|
||
}
|
||
|
||
void main(void)
|
||
{
|
||
gl_Position = filterVertexPosition();
|
||
vTextureCoord = filterTextureCoord();
|
||
}
|
||
`;const ed=class Go extends ps{constructor(e,t,s){const n=Vs.from(e||Go.defaultVertexSrc,t||Go.defaultFragmentSrc);super(n,s),this.padding=0,this.resolution=Go.defaultResolution,this.multisample=Go.defaultMultisample,this.enabled=!0,this.autoFit=!0,this.state=new zs}apply(e,t,s,n,r){e.applyFilter(this,t,s,n)}get blendMode(){return this.state.blendMode}set blendMode(e){this.state.blendMode=e}get resolution(){return this._resolution}set resolution(e){this._resolution=e}static get defaultVertexSrc(){return $_}static get defaultFragmentSrc(){return Y_}};ed.defaultResolution=1,ed.defaultMultisample=ei.NONE;let Mi=ed;class Bl{constructor(){this.clearBeforeRender=!0,this._backgroundColor=new At(0),this.alpha=1}init(e){this.clearBeforeRender=e.clearBeforeRender;const{backgroundColor:t,background:s,backgroundAlpha:n}=e,r=s??t;r!==void 0&&(this.color=r),this.alpha=n}get color(){return this._backgroundColor.value}set color(e){this._backgroundColor.setValue(e)}get alpha(){return this._backgroundColor.alpha}set alpha(e){this._backgroundColor.setAlpha(e)}get backgroundColor(){return this._backgroundColor}destroy(){}}Bl.defaultOptions={backgroundAlpha:1,backgroundColor:0,clearBeforeRender:!0},Bl.extension={type:[Oe.RendererSystem,Oe.CanvasRendererSystem],name:"background"};He.add(Bl);class cv{constructor(e){this.renderer=e,this.emptyRenderer=new kh(e),this.currentRenderer=this.emptyRenderer}setObjectRenderer(e){this.currentRenderer!==e&&(this.currentRenderer.stop(),this.currentRenderer=e,this.currentRenderer.start())}flush(){this.setObjectRenderer(this.emptyRenderer)}reset(){this.setObjectRenderer(this.emptyRenderer)}copyBoundTextures(e,t){const{boundTextures:s}=this.renderer.texture;for(let n=t-1;n>=0;--n)e[n]=s[n]||null,e[n]&&(e[n]._batchLocation=n)}boundArray(e,t,s,n){const{elements:r,ids:o,count:a}=e;let h=0;for(let l=0;l<a;l++){const c=r[l],u=c._batchLocation;if(u>=0&&u<n&&t[u]===c){o[l]=u;continue}for(;h<n;){const f=t[h];if(f&&f._batchEnabled===s&&f._batchLocation===h){h++;continue}o[l]=h,c._batchLocation=h,t[h]=c;break}}}destroy(){this.renderer=null}}cv.extension={type:Oe.RendererSystem,name:"batch"};He.add(cv);let Em=0;class Ll{constructor(e){this.renderer=e,this.webGLVersion=1,this.extensions={},this.supports={uint32Indices:!1},this.handleContextLost=this.handleContextLost.bind(this),this.handleContextRestored=this.handleContextRestored.bind(this)}get isLost(){return!this.gl||this.gl.isContextLost()}contextChange(e){this.gl=e,this.renderer.gl=e,this.renderer.CONTEXT_UID=Em++}init(e){if(e.context)this.initFromContext(e.context);else{const t=this.renderer.background.alpha<1,s=e.premultipliedAlpha;this.preserveDrawingBuffer=e.preserveDrawingBuffer,this.useContextAlpha=e.useContextAlpha,this.powerPreference=e.powerPreference,this.initFromOptions({alpha:t,premultipliedAlpha:s,antialias:e.antialias,stencil:!0,preserveDrawingBuffer:e.preserveDrawingBuffer,powerPreference:e.powerPreference})}}initFromContext(e){this.gl=e,this.validateContext(e),this.renderer.gl=e,this.renderer.CONTEXT_UID=Em++,this.renderer.runners.contextChange.emit(e);const t=this.renderer.view;t.addEventListener!==void 0&&(t.addEventListener("webglcontextlost",this.handleContextLost,!1),t.addEventListener("webglcontextrestored",this.handleContextRestored,!1))}initFromOptions(e){const t=this.createContext(this.renderer.view,e);this.initFromContext(t)}createContext(e,t){let s;if(Ve.PREFER_ENV>=Cr.WEBGL2&&(s=e.getContext("webgl2",t)),s)this.webGLVersion=2;else if(this.webGLVersion=1,s=e.getContext("webgl",t)||e.getContext("experimental-webgl",t),!s)throw new Error("This browser does not support WebGL. Try using the canvas renderer");return this.gl=s,this.getExtensions(),this.gl}getExtensions(){const{gl:e}=this,t={loseContext:e.getExtension("WEBGL_lose_context"),anisotropicFiltering:e.getExtension("EXT_texture_filter_anisotropic"),floatTextureLinear:e.getExtension("OES_texture_float_linear"),s3tc:e.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:e.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:e.getExtension("WEBGL_compressed_texture_etc"),etc1:e.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:e.getExtension("WEBGL_compressed_texture_atc"),astc:e.getExtension("WEBGL_compressed_texture_astc"),bptc:e.getExtension("EXT_texture_compression_bptc")};this.webGLVersion===1?Object.assign(this.extensions,t,{drawBuffers:e.getExtension("WEBGL_draw_buffers"),depthTexture:e.getExtension("WEBGL_depth_texture"),vertexArrayObject:e.getExtension("OES_vertex_array_object")||e.getExtension("MOZ_OES_vertex_array_object")||e.getExtension("WEBKIT_OES_vertex_array_object"),uint32ElementIndex:e.getExtension("OES_element_index_uint"),floatTexture:e.getExtension("OES_texture_float"),floatTextureLinear:e.getExtension("OES_texture_float_linear"),textureHalfFloat:e.getExtension("OES_texture_half_float"),textureHalfFloatLinear:e.getExtension("OES_texture_half_float_linear")}):this.webGLVersion===2&&Object.assign(this.extensions,t,{colorBufferFloat:e.getExtension("EXT_color_buffer_float")})}handleContextLost(e){e.preventDefault(),setTimeout(()=>{this.gl.isContextLost()&&this.extensions.loseContext&&this.extensions.loseContext.restoreContext()},0)}handleContextRestored(){this.renderer.runners.contextChange.emit(this.gl)}destroy(){const e=this.renderer.view;this.renderer=null,e.removeEventListener!==void 0&&(e.removeEventListener("webglcontextlost",this.handleContextLost),e.removeEventListener("webglcontextrestored",this.handleContextRestored)),this.gl.useProgram(null),this.extensions.loseContext&&this.extensions.loseContext.loseContext()}postrender(){this.renderer.objectRenderer.renderingToScreen&&this.gl.flush()}validateContext(e){const t=e.getContextAttributes(),s="WebGL2RenderingContext"in globalThis&&e instanceof globalThis.WebGL2RenderingContext;s&&(this.webGLVersion=2),t&&!t.stencil&&console.warn("Provided WebGL context does not have a stencil buffer, masks may not render correctly");const n=s||!!e.getExtension("OES_element_index_uint");this.supports.uint32Indices=n,n||console.warn("Provided WebGL context does not support 32 index buffer, complex graphics may not render correctly")}}Ll.defaultOptions={context:null,antialias:!1,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:"default"},Ll.extension={type:Oe.RendererSystem,name:"context"};He.add(Ll);class td{constructor(e,t){if(this.width=Math.round(e),this.height=Math.round(t),!this.width||!this.height)throw new Error("Framebuffer width or height is zero");this.stencil=!1,this.depth=!1,this.dirtyId=0,this.dirtyFormat=0,this.dirtySize=0,this.depthTexture=null,this.colorTextures=[],this.glFramebuffers={},this.disposeRunner=new ds("disposeFramebuffer"),this.multisample=ei.NONE}get colorTexture(){return this.colorTextures[0]}addColorTexture(e=0,t){return this.colorTextures[e]=t||new st(null,{scaleMode:as.NEAREST,resolution:1,mipmap:Ki.OFF,width:this.width,height:this.height}),this.dirtyId++,this.dirtyFormat++,this}addDepthTexture(e){return this.depthTexture=e||new st(null,{scaleMode:as.NEAREST,resolution:1,width:this.width,height:this.height,mipmap:Ki.OFF,format:Re.DEPTH_COMPONENT,type:je.UNSIGNED_SHORT}),this.dirtyId++,this.dirtyFormat++,this}enableDepth(){return this.depth=!0,this.dirtyId++,this.dirtyFormat++,this}enableStencil(){return this.stencil=!0,this.dirtyId++,this.dirtyFormat++,this}resize(e,t){if(e=Math.round(e),t=Math.round(t),!e||!t)throw new Error("Framebuffer width and height must not be zero");if(!(e===this.width&&t===this.height)){this.width=e,this.height=t,this.dirtyId++,this.dirtySize++;for(let s=0;s<this.colorTextures.length;s++){const n=this.colorTextures[s],r=n.resolution;n.setSize(e/r,t/r)}if(this.depthTexture){const s=this.depthTexture.resolution;this.depthTexture.setSize(e/s,t/s)}}}dispose(){this.disposeRunner.emit(this,!1)}destroyDepthTexture(){this.depthTexture&&(this.depthTexture.destroy(),this.depthTexture=null,++this.dirtyId,++this.dirtyFormat)}}class uv extends st{constructor(e={}){if(typeof e=="number"){const t=arguments[0],s=arguments[1],n=arguments[2],r=arguments[3];e={width:t,height:s,scaleMode:n,resolution:r}}e.width=e.width??100,e.height=e.height??100,e.multisample??(e.multisample=ei.NONE),super(null,e),this.mipmap=Ki.OFF,this.valid=!0,this._clear=new At([0,0,0,0]),this.framebuffer=new td(this.realWidth,this.realHeight).addColorTexture(0,this),this.framebuffer.multisample=e.multisample,this.maskStack=[],this.filterStack=[{}]}set clearColor(e){this._clear.setValue(e)}get clearColor(){return this._clear.value}get clear(){return this._clear}get multisample(){return this.framebuffer.multisample}set multisample(e){this.framebuffer.multisample=e}resize(e,t){this.framebuffer.resize(e*this.resolution,t*this.resolution),this.setRealSize(this.framebuffer.width,this.framebuffer.height)}dispose(){this.framebuffer.dispose(),super.dispose()}destroy(){super.destroy(),this.framebuffer.destroyDepthTexture(),this.framebuffer=null}}class Sn extends fa{constructor(e){const t=e,s=t.naturalWidth||t.videoWidth||t.displayWidth||t.width,n=t.naturalHeight||t.videoHeight||t.displayHeight||t.height;super(s,n),this.source=e,this.noSubImage=!1}static crossOrigin(e,t,s){s===void 0&&!t.startsWith("data:")?e.crossOrigin=f_(t):s!==!1&&(e.crossOrigin=typeof s=="string"?s:"anonymous")}upload(e,t,s,n){const r=e.gl,o=t.realWidth,a=t.realHeight;if(n=n||this.source,typeof HTMLImageElement<"u"&&n instanceof HTMLImageElement){if(!n.complete||n.naturalWidth===0)return!1}else if(typeof HTMLVideoElement<"u"&&n instanceof HTMLVideoElement&&n.readyState<=1)return!1;return r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.alphaMode===ui.UNPACK),!this.noSubImage&&t.target===r.TEXTURE_2D&&s.width===o&&s.height===a?r.texSubImage2D(r.TEXTURE_2D,0,0,0,t.format,s.type,n):(s.width=o,s.height=a,r.texImage2D(t.target,0,s.internalFormat,t.format,s.type,n)),!0}update(){if(this.destroyed)return;const e=this.source,t=e.naturalWidth||e.videoWidth||e.width,s=e.naturalHeight||e.videoHeight||e.height;this.resize(t,s),super.update()}dispose(){this.source=null}}class dv extends Sn{constructor(e,t){if(t=t||{},typeof e=="string"){const s=new Image;Sn.crossOrigin(s,e,t.crossorigin),s.src=e,e=s}super(e),!e.complete&&this._width&&this._height&&(this._width=0,this._height=0),this.url=e.src,this._process=null,this.preserveBitmap=!1,this.createBitmap=(t.createBitmap??Ve.CREATE_IMAGE_BITMAP)&&!!globalThis.createImageBitmap,this.alphaMode=typeof t.alphaMode=="number"?t.alphaMode:null,this.bitmap=null,this._load=null,t.autoLoad!==!1&&this.load()}load(e){return this._load?this._load:(e!==void 0&&(this.createBitmap=e),this._load=new Promise((t,s)=>{const n=this.source;this.url=n.src;const r=()=>{this.destroyed||(n.onload=null,n.onerror=null,this.update(),this._load=null,this.createBitmap?t(this.process()):t(this))};n.complete&&n.src?r():(n.onload=r,n.onerror=o=>{s(o),this.onError.emit(o)})}),this._load)}process(){const e=this.source;if(this._process!==null)return this._process;if(this.bitmap!==null||!globalThis.createImageBitmap)return Promise.resolve(this);const t=globalThis.createImageBitmap,s=!e.crossOrigin||e.crossOrigin==="anonymous";return this._process=fetch(e.src,{mode:s?"cors":"no-cors"}).then(n=>n.blob()).then(n=>t(n,0,0,e.width,e.height,{premultiplyAlpha:this.alphaMode===null||this.alphaMode===ui.UNPACK?"premultiply":"none"})).then(n=>this.destroyed?Promise.reject():(this.bitmap=n,this.update(),this._process=null,Promise.resolve(this))),this._process}upload(e,t,s){if(typeof this.alphaMode=="number"&&(t.alphaMode=this.alphaMode),!this.createBitmap)return super.upload(e,t,s);if(!this.bitmap&&(this.process(),!this.bitmap))return!1;if(super.upload(e,t,s,this.bitmap),!this.preserveBitmap){let n=!0;const r=t._glTextures;for(const o in r){const a=r[o];if(a!==s&&a.dirtyId!==t.dirtyId){n=!1;break}}n&&(this.bitmap.close&&this.bitmap.close(),this.bitmap=null)}return!0}dispose(){this.source.onload=null,this.source.onerror=null,super.dispose(),this.bitmap&&(this.bitmap.close(),this.bitmap=null),this._process=null,this._load=null}static test(e){return typeof HTMLImageElement<"u"&&(typeof e=="string"||e instanceof HTMLImageElement)}}class tf{constructor(){this.x0=0,this.y0=0,this.x1=1,this.y1=0,this.x2=1,this.y2=1,this.x3=0,this.y3=1,this.uvsFloat32=new Float32Array(8)}set(e,t,s){const n=t.width,r=t.height;if(s){const o=e.width/2/n,a=e.height/2/r,h=e.x/n+o,l=e.y/r+a;s=Gt.add(s,Gt.NW),this.x0=h+o*Gt.uX(s),this.y0=l+a*Gt.uY(s),s=Gt.add(s,2),this.x1=h+o*Gt.uX(s),this.y1=l+a*Gt.uY(s),s=Gt.add(s,2),this.x2=h+o*Gt.uX(s),this.y2=l+a*Gt.uY(s),s=Gt.add(s,2),this.x3=h+o*Gt.uX(s),this.y3=l+a*Gt.uY(s)}else this.x0=e.x/n,this.y0=e.y/r,this.x1=(e.x+e.width)/n,this.y1=e.y/r,this.x2=(e.x+e.width)/n,this.y2=(e.y+e.height)/r,this.x3=e.x/n,this.y3=(e.y+e.height)/r;this.uvsFloat32[0]=this.x0,this.uvsFloat32[1]=this.y0,this.uvsFloat32[2]=this.x1,this.uvsFloat32[3]=this.y1,this.uvsFloat32[4]=this.x2,this.uvsFloat32[5]=this.y2,this.uvsFloat32[6]=this.x3,this.uvsFloat32[7]=this.y3}}tf.prototype.toString=function(){return`[@pixi/core:TextureUvs x0=${this.x0} y0=${this.y0} x1=${this.x1} y1=${this.y1} x2=${this.x2} y2=${this.y2} x3=${this.x3} y3=${this.y3}]`};const Am=new tf;function Xa(i){i.destroy=function(){},i.on=function(){},i.once=function(){},i.emit=function(){}}let et=class Bt extends Sa{constructor(e,t,s,n,r,o,a){if(super(),this.noFrame=!1,t||(this.noFrame=!0,t=new lt(0,0,1,1)),e instanceof Bt&&(e=e.baseTexture),this.baseTexture=e,this._frame=t,this.trim=n,this.valid=!1,this.destroyed=!1,this._uvs=Am,this.uvMatrix=null,this.orig=s||t,this._rotate=Number(r||0),r===!0)this._rotate=2;else if(this._rotate%2!==0)throw new Error("attempt to use diamond-shaped UVs. If you are sure, set rotation manually");this.defaultAnchor=o?new bt(o.x,o.y):new bt(0,0),this.defaultBorders=a,this._updateID=0,this.textureCacheIds=[],e.valid?this.noFrame?e.valid&&this.onBaseTextureUpdated(e):this.frame=t:e.once("loaded",this.onBaseTextureUpdated,this),this.noFrame&&e.on("update",this.onBaseTextureUpdated,this)}update(){this.baseTexture.resource&&this.baseTexture.resource.update()}onBaseTextureUpdated(e){if(this.noFrame){if(!this.baseTexture.valid)return;this._frame.width=e.width,this._frame.height=e.height,this.valid=!0,this.updateUvs()}else this.frame=this._frame;this.emit("update",this)}destroy(e){if(this.baseTexture){if(e){const{resource:t}=this.baseTexture;t!=null&&t.url&&Ms[t.url]&&Bt.removeFromCache(t.url),this.baseTexture.destroy()}this.baseTexture.off("loaded",this.onBaseTextureUpdated,this),this.baseTexture.off("update",this.onBaseTextureUpdated,this),this.baseTexture=null}this._frame=null,this._uvs=null,this.trim=null,this.orig=null,this.valid=!1,Bt.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0,this.emit("destroyed",this),this.removeAllListeners()}clone(){var n;const e=this._frame.clone(),t=this._frame===this.orig?e:this.orig.clone(),s=new Bt(this.baseTexture,!this.noFrame&&e,t,(n=this.trim)==null?void 0:n.clone(),this.rotate,this.defaultAnchor,this.defaultBorders);return this.noFrame&&(s._frame=e),s}updateUvs(){this._uvs===Am&&(this._uvs=new tf),this._uvs.set(this._frame,this.baseTexture,this.rotate),this._updateID++}static from(e,t={},s=Ve.STRICT_TEXTURE_CACHE){const n=typeof e=="string";let r=null;if(n)r=e;else if(e instanceof st){if(!e.cacheId){const a=(t==null?void 0:t.pixiIdPrefix)||"pixiid";e.cacheId=`${a}-${_r()}`,st.addToCache(e,e.cacheId)}r=e.cacheId}else{if(!e._pixiId){const a=(t==null?void 0:t.pixiIdPrefix)||"pixiid";e._pixiId=`${a}_${_r()}`}r=e._pixiId}let o=Ms[r];if(n&&s&&!o)throw new Error(`The cacheId "${r}" does not exist in TextureCache.`);return!o&&!(e instanceof st)?(t.resolution||(t.resolution=_n(e)),o=new Bt(new st(e,t)),o.baseTexture.cacheId=r,st.addToCache(o.baseTexture,r),Bt.addToCache(o,r)):!o&&e instanceof st&&(o=new Bt(e),Bt.addToCache(o,r)),o}static fromURL(e,t){const s=Object.assign({autoLoad:!1},t==null?void 0:t.resourceOptions),n=Bt.from(e,Object.assign({resourceOptions:s},t),!1),r=n.baseTexture.resource;return n.baseTexture.valid?Promise.resolve(n):r.load().then(()=>Promise.resolve(n))}static fromBuffer(e,t,s,n){return new Bt(st.fromBuffer(e,t,s,n))}static fromLoader(e,t,s,n){const r=new st(e,Object.assign({scaleMode:st.defaultOptions.scaleMode,resolution:_n(t)},n)),{resource:o}=r;o instanceof dv&&(o.url=t);const a=new Bt(r);return s||(s=t),st.addToCache(a.baseTexture,s),Bt.addToCache(a,s),s!==t&&(st.addToCache(a.baseTexture,t),Bt.addToCache(a,t)),a.baseTexture.valid?Promise.resolve(a):new Promise(h=>{a.baseTexture.once("loaded",()=>h(a))})}static addToCache(e,t){t&&(e.textureCacheIds.includes(t)||e.textureCacheIds.push(t),Ms[t]&&Ms[t]!==e&&console.warn(`Texture added to the cache with an id [${t}] that already had an entry`),Ms[t]=e)}static removeFromCache(e){if(typeof e=="string"){const t=Ms[e];if(t){const s=t.textureCacheIds.indexOf(e);return s>-1&&t.textureCacheIds.splice(s,1),delete Ms[e],t}}else if(e!=null&&e.textureCacheIds){for(let t=0;t<e.textureCacheIds.length;++t)Ms[e.textureCacheIds[t]]===e&&delete Ms[e.textureCacheIds[t]];return e.textureCacheIds.length=0,e}return null}get resolution(){return this.baseTexture.resolution}get frame(){return this._frame}set frame(e){this._frame=e,this.noFrame=!1;const{x:t,y:s,width:n,height:r}=e,o=t+n>this.baseTexture.width,a=s+r>this.baseTexture.height;if(o||a){const h=o&&a?"and":"or",l=`X: ${t} + ${n} = ${t+n} > ${this.baseTexture.width}`,c=`Y: ${s} + ${r} = ${s+r} > ${this.baseTexture.height}`;throw new Error(`Texture Error: frame does not fit inside the base Texture dimensions: ${l} ${h} ${c}`)}this.valid=n&&r&&this.baseTexture.valid,!this.trim&&!this.rotate&&(this.orig=e),this.valid&&this.updateUvs()}get rotate(){return this._rotate}set rotate(e){this._rotate=e,this.valid&&this.updateUvs()}get width(){return this.orig.width}get height(){return this.orig.height}castToBaseTexture(){return this.baseTexture}static get EMPTY(){return Bt._EMPTY||(Bt._EMPTY=new Bt(new st),Xa(Bt._EMPTY),Xa(Bt._EMPTY.baseTexture)),Bt._EMPTY}static get WHITE(){if(!Bt._WHITE){const e=Ve.ADAPTER.createCanvas(16,16),t=e.getContext("2d");e.width=16,e.height=16,t.fillStyle="white",t.fillRect(0,0,16,16),Bt._WHITE=new Bt(st.from(e)),Xa(Bt._WHITE),Xa(Bt._WHITE.baseTexture)}return Bt._WHITE}};class Ir extends et{constructor(e,t){super(e,t),this.valid=!0,this.filterFrame=null,this.filterPoolKey=null,this.updateUvs()}get framebuffer(){return this.baseTexture.framebuffer}get multisample(){return this.framebuffer.multisample}set multisample(e){this.framebuffer.multisample=e}resize(e,t,s=!0){const n=this.baseTexture.resolution,r=Math.round(e*n)/n,o=Math.round(t*n)/n;this.valid=r>0&&o>0,this._frame.width=this.orig.width=r,this._frame.height=this.orig.height=o,s&&this.baseTexture.resize(r,o),this.updateUvs()}setResolution(e){const{baseTexture:t}=this;t.resolution!==e&&(t.setResolution(e),this.resize(t.width,t.height,!1))}static create(e){return new Ir(new uv(e))}}class fv{constructor(e){this.texturePool={},this.textureOptions=e||{},this.enableFullScreen=!1,this._pixelsWidth=0,this._pixelsHeight=0}createTexture(e,t,s=ei.NONE){const n=new uv(Object.assign({width:e,height:t,resolution:1,multisample:s},this.textureOptions));return new Ir(n)}getOptimalTexture(e,t,s=1,n=ei.NONE){let r;e=Math.max(Math.ceil(e*s-1e-6),1),t=Math.max(Math.ceil(t*s-1e-6),1),!this.enableFullScreen||e!==this._pixelsWidth||t!==this._pixelsHeight?(e=kl(e),t=kl(t),r=((e&65535)<<16|t&65535)>>>0,n>1&&(r+=n*4294967296)):r=n>1?-n:-1,this.texturePool[r]||(this.texturePool[r]=[]);let o=this.texturePool[r].pop();return o||(o=this.createTexture(e,t,n)),o.filterPoolKey=r,o.setResolution(s),o}getFilterTexture(e,t,s){const n=this.getOptimalTexture(e.width,e.height,t||e.resolution,s||ei.NONE);return n.filterFrame=e.filterFrame,n}returnTexture(e){const t=e.filterPoolKey;e.filterFrame=null,this.texturePool[t].push(e)}returnFilterTexture(e){this.returnTexture(e)}clear(e){if(e=e!==!1,e)for(const t in this.texturePool){const s=this.texturePool[t];if(s)for(let n=0;n<s.length;n++)s[n].destroy(!0)}this.texturePool={}}setScreenSize(e){if(!(e.width===this._pixelsWidth&&e.height===this._pixelsHeight)){this.enableFullScreen=e.width>0&&e.height>0;for(const t in this.texturePool){if(!(Number(t)<0))continue;const s=this.texturePool[t];if(s)for(let n=0;n<s.length;n++)s[n].destroy(!0);this.texturePool[t]=[]}this._pixelsWidth=e.width,this._pixelsHeight=e.height}}}fv.SCREEN_KEY=-1;class G_ extends Hs{constructor(){super(),this.addAttribute("aVertexPosition",new Float32Array([0,0,1,0,1,1,0,1])).addIndex([0,1,3,2])}}class pv extends Hs{constructor(){super(),this.vertices=new Float32Array([-1,-1,1,-1,1,1,-1,1]),this.uvs=new Float32Array([0,0,1,0,1,1,0,1]),this.vertexBuffer=new Nt(this.vertices),this.uvBuffer=new Nt(this.uvs),this.addAttribute("aVertexPosition",this.vertexBuffer).addAttribute("aTextureCoord",this.uvBuffer).addIndex([0,1,2,0,2,3])}map(e,t){let s=0,n=0;return this.uvs[0]=s,this.uvs[1]=n,this.uvs[2]=s+t.width/e.width,this.uvs[3]=n,this.uvs[4]=s+t.width/e.width,this.uvs[5]=n+t.height/e.height,this.uvs[6]=s,this.uvs[7]=n+t.height/e.height,s=t.x,n=t.y,this.vertices[0]=s,this.vertices[1]=n,this.vertices[2]=s+t.width,this.vertices[3]=n,this.vertices[4]=s+t.width,this.vertices[5]=n+t.height,this.vertices[6]=s,this.vertices[7]=n+t.height,this.invalidate(),this}invalidate(){return this.vertexBuffer._updateID++,this.uvBuffer._updateID++,this}}class j_{constructor(){this.renderTexture=null,this.target=null,this.legacy=!1,this.resolution=1,this.multisample=ei.NONE,this.sourceFrame=new lt,this.destinationFrame=new lt,this.bindingSourceFrame=new lt,this.bindingDestinationFrame=new lt,this.filters=[],this.transform=null}clear(){this.target=null,this.filters=null,this.renderTexture=null}}const Ya=[new bt,new bt,new bt,new bt],ou=new Vt;class mv{constructor(e){this.renderer=e,this.defaultFilterStack=[{}],this.texturePool=new fv,this.statePool=[],this.quad=new G_,this.quadUv=new pv,this.tempRect=new lt,this.activeState={},this.globalUniforms=new fs({outputFrame:new lt,inputSize:new Float32Array(4),inputPixel:new Float32Array(4),inputClamp:new Float32Array(4),resolution:1,filterArea:new Float32Array(4),filterClamp:new Float32Array(4)},!0),this.forceClear=!1,this.useMaxPadding=!1}init(){this.texturePool.setScreenSize(this.renderer.view)}push(e,t){const s=this.renderer,n=this.defaultFilterStack,r=this.statePool.pop()||new j_,o=s.renderTexture;let a,h;if(o.current){const b=o.current;a=b.resolution,h=b.multisample}else a=s.resolution,h=s.multisample;let l=t[0].resolution||a,c=t[0].multisample??h,u=t[0].padding,f=t[0].autoFit,d=t[0].legacy??!0;for(let b=1;b<t.length;b++){const _=t[b];l=Math.min(l,_.resolution||a),c=Math.min(c,_.multisample??h),u=this.useMaxPadding?Math.max(u,_.padding):u+_.padding,f=f&&_.autoFit,d=d||(_.legacy??!0)}n.length===1&&(this.defaultFilterStack[0].renderTexture=o.current),n.push(r),r.resolution=l,r.multisample=c,r.legacy=d,r.target=e,r.sourceFrame.copyFrom(e.filterArea||e.getBounds(!0)),r.sourceFrame.pad(u);const m=this.tempRect.copyFrom(o.sourceFrame);s.projection.transform&&this.transformAABB(ou.copyFrom(s.projection.transform).invert(),m),f?(r.sourceFrame.fit(m),(r.sourceFrame.width<=0||r.sourceFrame.height<=0)&&(r.sourceFrame.width=0,r.sourceFrame.height=0)):r.sourceFrame.intersects(m)||(r.sourceFrame.width=0,r.sourceFrame.height=0),this.roundFrame(r.sourceFrame,o.current?o.current.resolution:s.resolution,o.sourceFrame,o.destinationFrame,s.projection.transform),r.renderTexture=this.getOptimalFilterTexture(r.sourceFrame.width,r.sourceFrame.height,l,c),r.filters=t,r.destinationFrame.width=r.renderTexture.width,r.destinationFrame.height=r.renderTexture.height;const g=this.tempRect;g.x=0,g.y=0,g.width=r.sourceFrame.width,g.height=r.sourceFrame.height,r.renderTexture.filterFrame=r.sourceFrame,r.bindingSourceFrame.copyFrom(o.sourceFrame),r.bindingDestinationFrame.copyFrom(o.destinationFrame),r.transform=s.projection.transform,s.projection.transform=null,o.bind(r.renderTexture,r.sourceFrame,g),s.framebuffer.clear(0,0,0,0)}pop(){const e=this.defaultFilterStack,t=e.pop(),s=t.filters;this.activeState=t;const n=this.globalUniforms.uniforms;n.outputFrame=t.sourceFrame,n.resolution=t.resolution;const r=n.inputSize,o=n.inputPixel,a=n.inputClamp;if(r[0]=t.destinationFrame.width,r[1]=t.destinationFrame.height,r[2]=1/r[0],r[3]=1/r[1],o[0]=Math.round(r[0]*t.resolution),o[1]=Math.round(r[1]*t.resolution),o[2]=1/o[0],o[3]=1/o[1],a[0]=.5*o[2],a[1]=.5*o[3],a[2]=t.sourceFrame.width*r[2]-.5*o[2],a[3]=t.sourceFrame.height*r[3]-.5*o[3],t.legacy){const l=n.filterArea;l[0]=t.destinationFrame.width,l[1]=t.destinationFrame.height,l[2]=t.sourceFrame.x,l[3]=t.sourceFrame.y,n.filterClamp=n.inputClamp}this.globalUniforms.update();const h=e[e.length-1];if(this.renderer.framebuffer.blit(),s.length===1)s[0].apply(this,t.renderTexture,h.renderTexture,Ls.BLEND,t),this.returnFilterTexture(t.renderTexture);else{let l=t.renderTexture,c=this.getOptimalFilterTexture(l.width,l.height,t.resolution);c.filterFrame=l.filterFrame;let u=0;for(u=0;u<s.length-1;++u){u===1&&t.multisample>1&&(c=this.getOptimalFilterTexture(l.width,l.height,t.resolution),c.filterFrame=l.filterFrame),s[u].apply(this,l,c,Ls.CLEAR,t);const f=l;l=c,c=f}s[u].apply(this,l,h.renderTexture,Ls.BLEND,t),u>1&&t.multisample>1&&this.returnFilterTexture(t.renderTexture),this.returnFilterTexture(l),this.returnFilterTexture(c)}t.clear(),this.statePool.push(t)}bindAndClear(e,t=Ls.CLEAR){const{renderTexture:s,state:n}=this.renderer;if(e===this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?this.renderer.projection.transform=this.activeState.transform:this.renderer.projection.transform=null,e==null?void 0:e.filterFrame){const o=this.tempRect;o.x=0,o.y=0,o.width=e.filterFrame.width,o.height=e.filterFrame.height,s.bind(e,e.filterFrame,o)}else e!==this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?s.bind(e):this.renderer.renderTexture.bind(e,this.activeState.bindingSourceFrame,this.activeState.bindingDestinationFrame);const r=n.stateId&1||this.forceClear;(t===Ls.CLEAR||t===Ls.BLIT&&r)&&this.renderer.framebuffer.clear(0,0,0,0)}applyFilter(e,t,s,n){const r=this.renderer;r.state.set(e.state),this.bindAndClear(s,n),e.uniforms.uSampler=t,e.uniforms.filterGlobals=this.globalUniforms,r.shader.bind(e),e.legacy=!!e.program.attributeData.aTextureCoord,e.legacy?(this.quadUv.map(t._frame,t.filterFrame),r.geometry.bind(this.quadUv),r.geometry.draw(Us.TRIANGLES)):(r.geometry.bind(this.quad),r.geometry.draw(Us.TRIANGLE_STRIP))}calculateSpriteMatrix(e,t){const{sourceFrame:s,destinationFrame:n}=this.activeState,{orig:r}=t._texture,o=e.set(n.width,0,0,n.height,s.x,s.y),a=t.worldTransform.copyTo(Vt.TEMP_MATRIX);return a.invert(),o.prepend(a),o.scale(1/r.width,1/r.height),o.translate(t.anchor.x,t.anchor.y),o}destroy(){this.renderer=null,this.texturePool.clear(!1)}getOptimalFilterTexture(e,t,s=1,n=ei.NONE){return this.texturePool.getOptimalTexture(e,t,s,n)}getFilterTexture(e,t,s){if(typeof e=="number"){const r=e;e=t,t=r}e=e||this.activeState.renderTexture;const n=this.texturePool.getOptimalTexture(e.width,e.height,t||e.resolution,s||ei.NONE);return n.filterFrame=e.filterFrame,n}returnFilterTexture(e){this.texturePool.returnTexture(e)}emptyPool(){this.texturePool.clear(!0)}resize(){this.texturePool.setScreenSize(this.renderer.view)}transformAABB(e,t){const s=Ya[0],n=Ya[1],r=Ya[2],o=Ya[3];s.set(t.left,t.top),n.set(t.left,t.bottom),r.set(t.right,t.top),o.set(t.right,t.bottom),e.apply(s,s),e.apply(n,n),e.apply(r,r),e.apply(o,o);const a=Math.min(s.x,n.x,r.x,o.x),h=Math.min(s.y,n.y,r.y,o.y),l=Math.max(s.x,n.x,r.x,o.x),c=Math.max(s.y,n.y,r.y,o.y);t.x=a,t.y=h,t.width=l-a,t.height=c-h}roundFrame(e,t,s,n,r){if(!(e.width<=0||e.height<=0||s.width<=0||s.height<=0)){if(r){const{a:o,b:a,c:h,d:l}=r;if((Math.abs(a)>1e-4||Math.abs(h)>1e-4)&&(Math.abs(o)>1e-4||Math.abs(l)>1e-4))return}r=r?ou.copyFrom(r):ou.identity(),r.translate(-s.x,-s.y).scale(n.width/s.width,n.height/s.height).translate(n.x,n.y),this.transformAABB(r,e),e.ceil(t),this.transformAABB(r.invert(),e)}}}mv.extension={type:Oe.RendererSystem,name:"filter"};He.add(mv);class H_{constructor(e){this.framebuffer=e,this.stencil=null,this.dirtyId=-1,this.dirtyFormat=-1,this.dirtySize=-1,this.multisample=ei.NONE,this.msaaBuffer=null,this.blitFramebuffer=null,this.mipLevel=0}}const W_=new lt;class gv{constructor(e){this.renderer=e,this.managedFramebuffers=[],this.unknownFramebuffer=new td(10,10),this.msaaSamples=null}contextChange(){this.disposeAll(!0);const e=this.gl=this.renderer.gl;if(this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.current=this.unknownFramebuffer,this.viewport=new lt,this.hasMRT=!0,this.writeDepthTexture=!0,this.renderer.context.webGLVersion===1){let t=this.renderer.context.extensions.drawBuffers,s=this.renderer.context.extensions.depthTexture;Ve.PREFER_ENV===Cr.WEBGL_LEGACY&&(t=null,s=null),t?e.drawBuffers=n=>t.drawBuffersWEBGL(n):(this.hasMRT=!1,e.drawBuffers=()=>{}),s||(this.writeDepthTexture=!1)}else this.msaaSamples=e.getInternalformatParameter(e.RENDERBUFFER,e.RGBA8,e.SAMPLES)}bind(e,t,s=0){const{gl:n}=this;if(e){const r=e.glFramebuffers[this.CONTEXT_UID]||this.initFramebuffer(e);this.current!==e&&(this.current=e,n.bindFramebuffer(n.FRAMEBUFFER,r.framebuffer)),r.mipLevel!==s&&(e.dirtyId++,e.dirtyFormat++,r.mipLevel=s),r.dirtyId!==e.dirtyId&&(r.dirtyId=e.dirtyId,r.dirtyFormat!==e.dirtyFormat?(r.dirtyFormat=e.dirtyFormat,r.dirtySize=e.dirtySize,this.updateFramebuffer(e,s)):r.dirtySize!==e.dirtySize&&(r.dirtySize=e.dirtySize,this.resizeFramebuffer(e)));for(let o=0;o<e.colorTextures.length;o++){const a=e.colorTextures[o];this.renderer.texture.unbind(a.parentTextureArray||a)}if(e.depthTexture&&this.renderer.texture.unbind(e.depthTexture),t){const o=t.width>>s,a=t.height>>s,h=o/t.width;this.setViewport(t.x*h,t.y*h,o,a)}else{const o=e.width>>s,a=e.height>>s;this.setViewport(0,0,o,a)}}else this.current&&(this.current=null,n.bindFramebuffer(n.FRAMEBUFFER,null)),t?this.setViewport(t.x,t.y,t.width,t.height):this.setViewport(0,0,this.renderer.width,this.renderer.height)}setViewport(e,t,s,n){const r=this.viewport;e=Math.round(e),t=Math.round(t),s=Math.round(s),n=Math.round(n),(r.width!==s||r.height!==n||r.x!==e||r.y!==t)&&(r.x=e,r.y=t,r.width=s,r.height=n,this.gl.viewport(e,t,s,n))}get size(){return this.current?{x:0,y:0,width:this.current.width,height:this.current.height}:{x:0,y:0,width:this.renderer.width,height:this.renderer.height}}clear(e,t,s,n,r=Xu.COLOR|Xu.DEPTH){const{gl:o}=this;o.clearColor(e,t,s,n),o.clear(r)}initFramebuffer(e){const{gl:t}=this,s=new H_(t.createFramebuffer());return s.multisample=this.detectSamples(e.multisample),e.glFramebuffers[this.CONTEXT_UID]=s,this.managedFramebuffers.push(e),e.disposeRunner.add(this),s}resizeFramebuffer(e){const{gl:t}=this,s=e.glFramebuffers[this.CONTEXT_UID];if(s.stencil){t.bindRenderbuffer(t.RENDERBUFFER,s.stencil);let o;this.renderer.context.webGLVersion===1?o=t.DEPTH_STENCIL:e.depth&&e.stencil?o=t.DEPTH24_STENCIL8:e.depth?o=t.DEPTH_COMPONENT24:o=t.STENCIL_INDEX8,s.msaaBuffer?t.renderbufferStorageMultisample(t.RENDERBUFFER,s.multisample,o,e.width,e.height):t.renderbufferStorage(t.RENDERBUFFER,o,e.width,e.height)}const n=e.colorTextures;let r=n.length;t.drawBuffers||(r=Math.min(r,1));for(let o=0;o<r;o++){const a=n[o],h=a.parentTextureArray||a;this.renderer.texture.bind(h,0),o===0&&s.msaaBuffer&&(t.bindRenderbuffer(t.RENDERBUFFER,s.msaaBuffer),t.renderbufferStorageMultisample(t.RENDERBUFFER,s.multisample,h._glTextures[this.CONTEXT_UID].internalFormat,e.width,e.height))}e.depthTexture&&this.writeDepthTexture&&this.renderer.texture.bind(e.depthTexture,0)}updateFramebuffer(e,t){const{gl:s}=this,n=e.glFramebuffers[this.CONTEXT_UID],r=e.colorTextures;let o=r.length;s.drawBuffers||(o=Math.min(o,1)),n.multisample>1&&this.canMultisampleFramebuffer(e)?n.msaaBuffer=n.msaaBuffer||s.createRenderbuffer():n.msaaBuffer&&(s.deleteRenderbuffer(n.msaaBuffer),n.msaaBuffer=null,n.blitFramebuffer&&(n.blitFramebuffer.dispose(),n.blitFramebuffer=null));const a=[];for(let h=0;h<o;h++){const l=r[h],c=l.parentTextureArray||l;this.renderer.texture.bind(c,0),h===0&&n.msaaBuffer?(s.bindRenderbuffer(s.RENDERBUFFER,n.msaaBuffer),s.renderbufferStorageMultisample(s.RENDERBUFFER,n.multisample,c._glTextures[this.CONTEXT_UID].internalFormat,e.width,e.height),s.framebufferRenderbuffer(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0,s.RENDERBUFFER,n.msaaBuffer)):(s.framebufferTexture2D(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0+h,l.target,c._glTextures[this.CONTEXT_UID].texture,t),a.push(s.COLOR_ATTACHMENT0+h))}if(a.length>1&&s.drawBuffers(a),e.depthTexture&&this.writeDepthTexture){const h=e.depthTexture;this.renderer.texture.bind(h,0),s.framebufferTexture2D(s.FRAMEBUFFER,s.DEPTH_ATTACHMENT,s.TEXTURE_2D,h._glTextures[this.CONTEXT_UID].texture,t)}if((e.stencil||e.depth)&&!(e.depthTexture&&this.writeDepthTexture)){n.stencil=n.stencil||s.createRenderbuffer();let h,l;this.renderer.context.webGLVersion===1?(h=s.DEPTH_STENCIL_ATTACHMENT,l=s.DEPTH_STENCIL):e.depth&&e.stencil?(h=s.DEPTH_STENCIL_ATTACHMENT,l=s.DEPTH24_STENCIL8):e.depth?(h=s.DEPTH_ATTACHMENT,l=s.DEPTH_COMPONENT24):(h=s.STENCIL_ATTACHMENT,l=s.STENCIL_INDEX8),s.bindRenderbuffer(s.RENDERBUFFER,n.stencil),n.msaaBuffer?s.renderbufferStorageMultisample(s.RENDERBUFFER,n.multisample,l,e.width,e.height):s.renderbufferStorage(s.RENDERBUFFER,l,e.width,e.height),s.framebufferRenderbuffer(s.FRAMEBUFFER,h,s.RENDERBUFFER,n.stencil)}else n.stencil&&(s.deleteRenderbuffer(n.stencil),n.stencil=null)}canMultisampleFramebuffer(e){return this.renderer.context.webGLVersion!==1&&e.colorTextures.length<=1&&!e.depthTexture}detectSamples(e){const{msaaSamples:t}=this;let s=ei.NONE;if(e<=1||t===null)return s;for(let n=0;n<t.length;n++)if(t[n]<=e){s=t[n];break}return s===1&&(s=ei.NONE),s}blit(e,t,s){const{current:n,renderer:r,gl:o,CONTEXT_UID:a}=this;if(r.context.webGLVersion!==2||!n)return;const h=n.glFramebuffers[a];if(!h)return;if(!e){if(!h.msaaBuffer)return;const c=n.colorTextures[0];if(!c)return;h.blitFramebuffer||(h.blitFramebuffer=new td(n.width,n.height),h.blitFramebuffer.addColorTexture(0,c)),e=h.blitFramebuffer,e.colorTextures[0]!==c&&(e.colorTextures[0]=c,e.dirtyId++,e.dirtyFormat++),(e.width!==n.width||e.height!==n.height)&&(e.width=n.width,e.height=n.height,e.dirtyId++,e.dirtySize++)}t||(t=W_,t.width=n.width,t.height=n.height),s||(s=t);const l=t.width===s.width&&t.height===s.height;this.bind(e),o.bindFramebuffer(o.READ_FRAMEBUFFER,h.framebuffer),o.blitFramebuffer(t.left,t.top,t.right,t.bottom,s.left,s.top,s.right,s.bottom,o.COLOR_BUFFER_BIT,l?o.NEAREST:o.LINEAR),o.bindFramebuffer(o.READ_FRAMEBUFFER,e.glFramebuffers[this.CONTEXT_UID].framebuffer)}disposeFramebuffer(e,t){const s=e.glFramebuffers[this.CONTEXT_UID],n=this.gl;if(!s)return;delete e.glFramebuffers[this.CONTEXT_UID];const r=this.managedFramebuffers.indexOf(e);r>=0&&this.managedFramebuffers.splice(r,1),e.disposeRunner.remove(this),t||(n.deleteFramebuffer(s.framebuffer),s.msaaBuffer&&n.deleteRenderbuffer(s.msaaBuffer),s.stencil&&n.deleteRenderbuffer(s.stencil)),s.blitFramebuffer&&this.disposeFramebuffer(s.blitFramebuffer,t)}disposeAll(e){const t=this.managedFramebuffers;this.managedFramebuffers=[];for(let s=0;s<t.length;s++)this.disposeFramebuffer(t[s],e)}forceStencil(){const e=this.current;if(!e)return;const t=e.glFramebuffers[this.CONTEXT_UID];if(!t||t.stencil&&e.stencil)return;e.stencil=!0;const s=e.width,n=e.height,r=this.gl,o=t.stencil=r.createRenderbuffer();r.bindRenderbuffer(r.RENDERBUFFER,o);let a,h;this.renderer.context.webGLVersion===1?(a=r.DEPTH_STENCIL_ATTACHMENT,h=r.DEPTH_STENCIL):e.depth?(a=r.DEPTH_STENCIL_ATTACHMENT,h=r.DEPTH24_STENCIL8):(a=r.STENCIL_ATTACHMENT,h=r.STENCIL_INDEX8),t.msaaBuffer?r.renderbufferStorageMultisample(r.RENDERBUFFER,t.multisample,h,s,n):r.renderbufferStorage(r.RENDERBUFFER,h,s,n),r.framebufferRenderbuffer(r.FRAMEBUFFER,a,r.RENDERBUFFER,o)}reset(){this.current=this.unknownFramebuffer,this.viewport=new lt}destroy(){this.renderer=null}}gv.extension={type:Oe.RendererSystem,name:"framebuffer"};He.add(gv);const au={5126:4,5123:2,5121:1};class vv{constructor(e){this.renderer=e,this._activeGeometry=null,this._activeVao=null,this.hasVao=!0,this.hasInstance=!0,this.canUseUInt32ElementIndex=!1,this.managedGeometries={}}contextChange(){this.disposeAll(!0);const e=this.gl=this.renderer.gl,t=this.renderer.context;if(this.CONTEXT_UID=this.renderer.CONTEXT_UID,t.webGLVersion!==2){let s=this.renderer.context.extensions.vertexArrayObject;Ve.PREFER_ENV===Cr.WEBGL_LEGACY&&(s=null),s?(e.createVertexArray=()=>s.createVertexArrayOES(),e.bindVertexArray=n=>s.bindVertexArrayOES(n),e.deleteVertexArray=n=>s.deleteVertexArrayOES(n)):(this.hasVao=!1,e.createVertexArray=()=>null,e.bindVertexArray=()=>null,e.deleteVertexArray=()=>null)}if(t.webGLVersion!==2){const s=e.getExtension("ANGLE_instanced_arrays");s?(e.vertexAttribDivisor=(n,r)=>s.vertexAttribDivisorANGLE(n,r),e.drawElementsInstanced=(n,r,o,a,h)=>s.drawElementsInstancedANGLE(n,r,o,a,h),e.drawArraysInstanced=(n,r,o,a)=>s.drawArraysInstancedANGLE(n,r,o,a)):this.hasInstance=!1}this.canUseUInt32ElementIndex=t.webGLVersion===2||!!t.extensions.uint32ElementIndex}bind(e,t){t=t||this.renderer.shader.shader;const{gl:s}=this;let n=e.glVertexArrayObjects[this.CONTEXT_UID],r=!1;n||(this.managedGeometries[e.id]=e,e.disposeRunner.add(this),e.glVertexArrayObjects[this.CONTEXT_UID]=n={},r=!0);const o=n[t.program.id]||this.initGeometryVao(e,t,r);this._activeGeometry=e,this._activeVao!==o&&(this._activeVao=o,this.hasVao?s.bindVertexArray(o):this.activateVao(e,t.program)),this.updateBuffers()}reset(){this.unbind()}updateBuffers(){const e=this._activeGeometry,t=this.renderer.buffer;for(let s=0;s<e.buffers.length;s++){const n=e.buffers[s];t.update(n)}}checkCompatibility(e,t){const s=e.attributes,n=t.attributeData;for(const r in n)if(!s[r])throw new Error(`shader and geometry incompatible, geometry missing the "${r}" attribute`)}getSignature(e,t){const s=e.attributes,n=t.attributeData,r=["g",e.id];for(const o in s)n[o]&&r.push(o,n[o].location);return r.join("-")}initGeometryVao(e,t,s=!0){const n=this.gl,r=this.CONTEXT_UID,o=this.renderer.buffer,a=t.program;a.glPrograms[r]||this.renderer.shader.generateProgram(t),this.checkCompatibility(e,a);const h=this.getSignature(e,a),l=e.glVertexArrayObjects[this.CONTEXT_UID];let c=l[h];if(c)return l[a.id]=c,c;const u=e.buffers,f=e.attributes,d={},m={};for(const g in u)d[g]=0,m[g]=0;for(const g in f)!f[g].size&&a.attributeData[g]?f[g].size=a.attributeData[g].size:f[g].size||console.warn(`PIXI Geometry attribute '${g}' size cannot be determined (likely the bound shader does not have the attribute)`),d[f[g].buffer]+=f[g].size*au[f[g].type];for(const g in f){const b=f[g],_=b.size;b.stride===void 0&&(d[b.buffer]===_*au[b.type]?b.stride=0:b.stride=d[b.buffer]),b.start===void 0&&(b.start=m[b.buffer],m[b.buffer]+=_*au[b.type])}c=n.createVertexArray(),n.bindVertexArray(c);for(let g=0;g<u.length;g++){const b=u[g];o.bind(b),s&&b._glBuffers[r].refCount++}return this.activateVao(e,a),l[a.id]=c,l[h]=c,n.bindVertexArray(null),o.unbind($s.ARRAY_BUFFER),c}disposeGeometry(e,t){var a;if(!this.managedGeometries[e.id])return;delete this.managedGeometries[e.id];const s=e.glVertexArrayObjects[this.CONTEXT_UID],n=this.gl,r=e.buffers,o=(a=this.renderer)==null?void 0:a.buffer;if(e.disposeRunner.remove(this),!!s){if(o)for(let h=0;h<r.length;h++){const l=r[h]._glBuffers[this.CONTEXT_UID];l&&(l.refCount--,l.refCount===0&&!t&&o.dispose(r[h],t))}if(!t){for(const h in s)if(h[0]==="g"){const l=s[h];this._activeVao===l&&this.unbind(),n.deleteVertexArray(l)}}delete e.glVertexArrayObjects[this.CONTEXT_UID]}}disposeAll(e){const t=Object.keys(this.managedGeometries);for(let s=0;s<t.length;s++)this.disposeGeometry(this.managedGeometries[t[s]],e)}activateVao(e,t){const s=this.gl,n=this.CONTEXT_UID,r=this.renderer.buffer,o=e.buffers,a=e.attributes;e.indexBuffer&&r.bind(e.indexBuffer);let h=null;for(const l in a){const c=a[l],u=o[c.buffer],f=u._glBuffers[n];if(t.attributeData[l]){h!==f&&(r.bind(u),h=f);const d=t.attributeData[l].location;if(s.enableVertexAttribArray(d),s.vertexAttribPointer(d,c.size,c.type||s.FLOAT,c.normalized,c.stride,c.start),c.instance)if(this.hasInstance)s.vertexAttribDivisor(d,c.divisor);else throw new Error("geometry error, GPU Instancing is not supported on this device")}}}draw(e,t,s,n){const{gl:r}=this,o=this._activeGeometry;if(o.indexBuffer){const a=o.indexBuffer.data.BYTES_PER_ELEMENT,h=a===2?r.UNSIGNED_SHORT:r.UNSIGNED_INT;a===2||a===4&&this.canUseUInt32ElementIndex?o.instanced?r.drawElementsInstanced(e,t||o.indexBuffer.data.length,h,(s||0)*a,n||1):r.drawElements(e,t||o.indexBuffer.data.length,h,(s||0)*a):console.warn("unsupported index buffer type: uint32")}else o.instanced?r.drawArraysInstanced(e,s,t||o.getSize(),n||1):r.drawArrays(e,s,t||o.getSize());return this}unbind(){this.gl.bindVertexArray(null),this._activeVao=null,this._activeGeometry=null}destroy(){this.renderer=null}}vv.extension={type:Oe.RendererSystem,name:"geometry"};He.add(vv);const Cm=new Vt;class sf{constructor(e,t){this._texture=e,this.mapCoord=new Vt,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._textureID=-1,this._updateID=0,this.clampOffset=0,this.clampMargin=typeof t>"u"?.5:t,this.isSimple=!1}get texture(){return this._texture}set texture(e){this._texture=e,this._textureID=-1}multiplyUvs(e,t){t===void 0&&(t=e);const s=this.mapCoord;for(let n=0;n<e.length;n+=2){const r=e[n],o=e[n+1];t[n]=r*s.a+o*s.c+s.tx,t[n+1]=r*s.b+o*s.d+s.ty}return t}update(e){const t=this._texture;if(!t||!t.valid||!e&&this._textureID===t._updateID)return!1;this._textureID=t._updateID,this._updateID++;const s=t._uvs;this.mapCoord.set(s.x1-s.x0,s.y1-s.y0,s.x3-s.x0,s.y3-s.y0,s.x0,s.y0);const n=t.orig,r=t.trim;r&&(Cm.set(n.width/r.width,0,0,n.height/r.height,-r.x/r.width,-r.y/r.height),this.mapCoord.append(Cm));const o=t.baseTexture,a=this.uClampFrame,h=this.clampMargin/o.resolution,l=this.clampOffset;return a[0]=(t._frame.x+h+l)/o.width,a[1]=(t._frame.y+h+l)/o.height,a[2]=(t._frame.x+t._frame.width-h+l)/o.width,a[3]=(t._frame.y+t._frame.height-h+l)/o.height,this.uClampOffset[0]=l/o.realWidth,this.uClampOffset[1]=l/o.realHeight,this.isSimple=t._frame.width===o.width&&t._frame.height===o.height&&t.rotate===0,!0}}var z_=`varying vec2 vMaskCoord;
|
||
varying vec2 vTextureCoord;
|
||
|
||
uniform sampler2D uSampler;
|
||
uniform sampler2D mask;
|
||
uniform float alpha;
|
||
uniform float npmAlpha;
|
||
uniform vec4 maskClamp;
|
||
|
||
void main(void)
|
||
{
|
||
float clip = step(3.5,
|
||
step(maskClamp.x, vMaskCoord.x) +
|
||
step(maskClamp.y, vMaskCoord.y) +
|
||
step(vMaskCoord.x, maskClamp.z) +
|
||
step(vMaskCoord.y, maskClamp.w));
|
||
|
||
vec4 original = texture2D(uSampler, vTextureCoord);
|
||
vec4 masky = texture2D(mask, vMaskCoord);
|
||
float alphaMul = 1.0 - npmAlpha * (1.0 - masky.a);
|
||
|
||
original *= (alphaMul * masky.r * alpha * clip);
|
||
|
||
gl_FragColor = original;
|
||
}
|
||
`,q_=`attribute vec2 aVertexPosition;
|
||
attribute vec2 aTextureCoord;
|
||
|
||
uniform mat3 projectionMatrix;
|
||
uniform mat3 otherMatrix;
|
||
|
||
varying vec2 vMaskCoord;
|
||
varying vec2 vTextureCoord;
|
||
|
||
void main(void)
|
||
{
|
||
gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
|
||
|
||
vTextureCoord = aTextureCoord;
|
||
vMaskCoord = ( otherMatrix * vec3( aTextureCoord, 1.0) ).xy;
|
||
}
|
||
`;class K_ extends Mi{constructor(e,t,s){let n=null;typeof e!="string"&&t===void 0&&s===void 0&&(n=e,e=void 0,t=void 0,s=void 0),super(e||q_,t||z_,s),this.maskSprite=n,this.maskMatrix=new Vt}get maskSprite(){return this._maskSprite}set maskSprite(e){this._maskSprite=e,this._maskSprite&&(this._maskSprite.renderable=!1)}apply(e,t,s,n){const r=this._maskSprite,o=r._texture;o.valid&&(o.uvMatrix||(o.uvMatrix=new sf(o,0)),o.uvMatrix.update(),this.uniforms.npmAlpha=o.baseTexture.alphaMode?0:1,this.uniforms.mask=o,this.uniforms.otherMatrix=e.calculateSpriteMatrix(this.maskMatrix,r).prepend(o.uvMatrix.mapCoord),this.uniforms.alpha=r.worldAlpha,this.uniforms.maskClamp=o.uvMatrix.uClampFrame,e.applyFilter(this,t,s,n))}}class Z_{constructor(e=null){this.type=si.NONE,this.autoDetect=!0,this.maskObject=e||null,this.pooled=!1,this.isMaskData=!0,this.resolution=null,this.multisample=Mi.defaultMultisample,this.enabled=!0,this.colorMask=15,this._filters=null,this._stencilCounter=0,this._scissorCounter=0,this._scissorRect=null,this._scissorRectLocal=null,this._colorMask=15,this._target=null}get filter(){return this._filters?this._filters[0]:null}set filter(e){e?this._filters?this._filters[0]=e:this._filters=[e]:this._filters=null}reset(){this.pooled&&(this.maskObject=null,this.type=si.NONE,this.autoDetect=!0),this._target=null,this._scissorRectLocal=null}copyCountersOrReset(e){e?(this._stencilCounter=e._stencilCounter,this._scissorCounter=e._scissorCounter,this._scissorRect=e._scissorRect):(this._stencilCounter=0,this._scissorCounter=0,this._scissorRect=null)}}class yv{constructor(e){this.renderer=e,this.enableScissor=!0,this.alphaMaskPool=[],this.maskDataPool=[],this.maskStack=[],this.alphaMaskIndex=0}setMaskStack(e){this.maskStack=e,this.renderer.scissor.setMaskStack(e),this.renderer.stencil.setMaskStack(e)}push(e,t){let s=t;if(!s.isMaskData){const r=this.maskDataPool.pop()||new Z_;r.pooled=!0,r.maskObject=t,s=r}const n=this.maskStack.length!==0?this.maskStack[this.maskStack.length-1]:null;if(s.copyCountersOrReset(n),s._colorMask=n?n._colorMask:15,s.autoDetect&&this.detect(s),s._target=e,s.type!==si.SPRITE&&this.maskStack.push(s),s.enabled)switch(s.type){case si.SCISSOR:this.renderer.scissor.push(s);break;case si.STENCIL:this.renderer.stencil.push(s);break;case si.SPRITE:s.copyCountersOrReset(null),this.pushSpriteMask(s);break;case si.COLOR:this.pushColorMask(s);break}s.type===si.SPRITE&&this.maskStack.push(s)}pop(e){const t=this.maskStack.pop();if(!(!t||t._target!==e)){if(t.enabled)switch(t.type){case si.SCISSOR:this.renderer.scissor.pop(t);break;case si.STENCIL:this.renderer.stencil.pop(t.maskObject);break;case si.SPRITE:this.popSpriteMask(t);break;case si.COLOR:this.popColorMask(t);break}if(t.reset(),t.pooled&&this.maskDataPool.push(t),this.maskStack.length!==0){const s=this.maskStack[this.maskStack.length-1];s.type===si.SPRITE&&s._filters&&(s._filters[0].maskSprite=s.maskObject)}}}detect(e){const t=e.maskObject;t?t.isSprite?e.type=si.SPRITE:this.enableScissor&&this.renderer.scissor.testScissor(e)?e.type=si.SCISSOR:e.type=si.STENCIL:e.type=si.COLOR}pushSpriteMask(e){const{maskObject:t}=e,s=e._target;let n=e._filters;n||(n=this.alphaMaskPool[this.alphaMaskIndex],n||(n=this.alphaMaskPool[this.alphaMaskIndex]=[new K_])),n[0].resolution=e.resolution,n[0].multisample=e.multisample,n[0].maskSprite=t;const r=s.filterArea;s.filterArea=t.getBounds(!0),this.renderer.filter.push(s,n),s.filterArea=r,e._filters||this.alphaMaskIndex++}popSpriteMask(e){this.renderer.filter.pop(),e._filters?e._filters[0].maskSprite=null:(this.alphaMaskIndex--,this.alphaMaskPool[this.alphaMaskIndex][0].maskSprite=null)}pushColorMask(e){const t=e._colorMask,s=e._colorMask=t&e.colorMask;s!==t&&this.renderer.gl.colorMask((s&1)!==0,(s&2)!==0,(s&4)!==0,(s&8)!==0)}popColorMask(e){const t=e._colorMask,s=this.maskStack.length>0?this.maskStack[this.maskStack.length-1]._colorMask:15;s!==t&&this.renderer.gl.colorMask((s&1)!==0,(s&2)!==0,(s&4)!==0,(s&8)!==0)}destroy(){this.renderer=null}}yv.extension={type:Oe.RendererSystem,name:"mask"};He.add(yv);class xv{constructor(e){this.renderer=e,this.maskStack=[],this.glConst=0}getStackLength(){return this.maskStack.length}setMaskStack(e){const{gl:t}=this.renderer,s=this.getStackLength();this.maskStack=e;const n=this.getStackLength();n!==s&&(n===0?t.disable(this.glConst):(t.enable(this.glConst),this._useCurrent()))}_useCurrent(){}destroy(){this.renderer=null,this.maskStack=null}}const Im=new Vt,Rm=[],bv=class pl extends xv{constructor(e){super(e),this.glConst=Ve.ADAPTER.getWebGLRenderingContext().SCISSOR_TEST}getStackLength(){const e=this.maskStack[this.maskStack.length-1];return e?e._scissorCounter:0}calcScissorRect(e){if(e._scissorRectLocal)return;const t=e._scissorRect,{maskObject:s}=e,{renderer:n}=this,r=n.renderTexture,o=s.getBounds(!0,Rm.pop()??new lt);this.roundFrameToPixels(o,r.current?r.current.resolution:n.resolution,r.sourceFrame,r.destinationFrame,n.projection.transform),t&&o.fit(t),e._scissorRectLocal=o}static isMatrixRotated(e){if(!e)return!1;const{a:t,b:s,c:n,d:r}=e;return(Math.abs(s)>1e-4||Math.abs(n)>1e-4)&&(Math.abs(t)>1e-4||Math.abs(r)>1e-4)}testScissor(e){const{maskObject:t}=e;if(!t.isFastRect||!t.isFastRect()||pl.isMatrixRotated(t.worldTransform)||pl.isMatrixRotated(this.renderer.projection.transform))return!1;this.calcScissorRect(e);const s=e._scissorRectLocal;return s.width>0&&s.height>0}roundFrameToPixels(e,t,s,n,r){pl.isMatrixRotated(r)||(r=r?Im.copyFrom(r):Im.identity(),r.translate(-s.x,-s.y).scale(n.width/s.width,n.height/s.height).translate(n.x,n.y),this.renderer.filter.transformAABB(r,e),e.fit(n),e.x=Math.round(e.x*t),e.y=Math.round(e.y*t),e.width=Math.round(e.width*t),e.height=Math.round(e.height*t))}push(e){e._scissorRectLocal||this.calcScissorRect(e);const{gl:t}=this.renderer;e._scissorRect||t.enable(t.SCISSOR_TEST),e._scissorCounter++,e._scissorRect=e._scissorRectLocal,this._useCurrent()}pop(e){const{gl:t}=this.renderer;e&&Rm.push(e._scissorRectLocal),this.getStackLength()>0?this._useCurrent():t.disable(t.SCISSOR_TEST)}_useCurrent(){const e=this.maskStack[this.maskStack.length-1]._scissorRect;let t;this.renderer.renderTexture.current?t=e.y:t=this.renderer.height-e.height-e.y,this.renderer.gl.scissor(e.x,t,e.width,e.height)}};bv.extension={type:Oe.RendererSystem,name:"scissor"};let J_=bv;He.add(J_);class wv extends xv{constructor(e){super(e),this.glConst=Ve.ADAPTER.getWebGLRenderingContext().STENCIL_TEST}getStackLength(){const e=this.maskStack[this.maskStack.length-1];return e?e._stencilCounter:0}push(e){const t=e.maskObject,{gl:s}=this.renderer,n=e._stencilCounter;n===0&&(this.renderer.framebuffer.forceStencil(),s.clearStencil(0),s.clear(s.STENCIL_BUFFER_BIT),s.enable(s.STENCIL_TEST)),e._stencilCounter++;const r=e._colorMask;r!==0&&(e._colorMask=0,s.colorMask(!1,!1,!1,!1)),s.stencilFunc(s.EQUAL,n,4294967295),s.stencilOp(s.KEEP,s.KEEP,s.INCR),t.renderable=!0,t.render(this.renderer),this.renderer.batch.flush(),t.renderable=!1,r!==0&&(e._colorMask=r,s.colorMask((r&1)!==0,(r&2)!==0,(r&4)!==0,(r&8)!==0)),this._useCurrent()}pop(e){const t=this.renderer.gl;if(this.getStackLength()===0)t.disable(t.STENCIL_TEST);else{const s=this.maskStack.length!==0?this.maskStack[this.maskStack.length-1]:null,n=s?s._colorMask:15;n!==0&&(s._colorMask=0,t.colorMask(!1,!1,!1,!1)),t.stencilOp(t.KEEP,t.KEEP,t.DECR),e.renderable=!0,e.render(this.renderer),this.renderer.batch.flush(),e.renderable=!1,n!==0&&(s._colorMask=n,t.colorMask((n&1)!==0,(n&2)!==0,(n&4)!==0,(n&8)!==0)),this._useCurrent()}}_useCurrent(){const e=this.renderer.gl;e.stencilFunc(e.EQUAL,this.getStackLength(),4294967295),e.stencilOp(e.KEEP,e.KEEP,e.KEEP)}}wv.extension={type:Oe.RendererSystem,name:"stencil"};He.add(wv);class _v{constructor(e){this.renderer=e,this.plugins={},Object.defineProperties(this.plugins,{extract:{enumerable:!1,get(){return pt("7.0.0","renderer.plugins.extract has moved to renderer.extract"),e.extract}},prepare:{enumerable:!1,get(){return pt("7.0.0","renderer.plugins.prepare has moved to renderer.prepare"),e.prepare}},interaction:{enumerable:!1,get(){return pt("7.0.0","renderer.plugins.interaction has been deprecated, use renderer.events"),e.events}}})}init(){const e=this.rendererPlugins;for(const t in e)this.plugins[t]=new e[t](this.renderer)}destroy(){for(const e in this.plugins)this.plugins[e].destroy(),this.plugins[e]=null}}_v.extension={type:[Oe.RendererSystem,Oe.CanvasRendererSystem],name:"_plugin"};He.add(_v);class Sv{constructor(e){this.renderer=e,this.destinationFrame=null,this.sourceFrame=null,this.defaultFrame=null,this.projectionMatrix=new Vt,this.transform=null}update(e,t,s,n){this.destinationFrame=e||this.destinationFrame||this.defaultFrame,this.sourceFrame=t||this.sourceFrame||e,this.calculateProjection(this.destinationFrame,this.sourceFrame,s,n),this.transform&&this.projectionMatrix.append(this.transform);const r=this.renderer;r.globalUniforms.uniforms.projectionMatrix=this.projectionMatrix,r.globalUniforms.update(),r.shader.shader&&r.shader.syncUniformGroup(r.shader.shader.uniforms.globals)}calculateProjection(e,t,s,n){const r=this.projectionMatrix,o=n?-1:1;r.identity(),r.a=1/t.width*2,r.d=o*(1/t.height*2),r.tx=-1-t.x*r.a,r.ty=-o-t.y*r.d}setTransform(e){}destroy(){this.renderer=null}}Sv.extension={type:Oe.RendererSystem,name:"projection"};He.add(Sv);const Q_=new ef,Pm=new lt;class Tv{constructor(e){this.renderer=e,this._tempMatrix=new Vt}generateTexture(e,t){const{region:s,...n}=t||{},r=(s==null?void 0:s.copyTo(Pm))||e.getLocalBounds(Pm,!0),o=n.resolution||this.renderer.resolution;r.width=Math.max(r.width,1/o),r.height=Math.max(r.height,1/o),n.width=r.width,n.height=r.height,n.resolution=o,n.multisample??(n.multisample=this.renderer.multisample);const a=Ir.create(n);this._tempMatrix.tx=-r.x,this._tempMatrix.ty=-r.y;const h=e.transform;return e.transform=Q_,this.renderer.render(e,{renderTexture:a,transform:this._tempMatrix,skipUpdateTransform:!!e.parent,blit:!0}),e.transform=h,a}destroy(){}}Tv.extension={type:[Oe.RendererSystem,Oe.CanvasRendererSystem],name:"textureGenerator"};He.add(Tv);const or=new lt,Oo=new lt;class Mv{constructor(e){this.renderer=e,this.defaultMaskStack=[],this.current=null,this.sourceFrame=new lt,this.destinationFrame=new lt,this.viewportFrame=new lt}contextChange(){var t;const e=(t=this.renderer)==null?void 0:t.gl.getContextAttributes();this._rendererPremultipliedAlpha=!!(e&&e.alpha&&e.premultipliedAlpha)}bind(e=null,t,s){const n=this.renderer;this.current=e;let r,o,a;e?(r=e.baseTexture,a=r.resolution,t||(or.width=e.frame.width,or.height=e.frame.height,t=or),s||(Oo.x=e.frame.x,Oo.y=e.frame.y,Oo.width=t.width,Oo.height=t.height,s=Oo),o=r.framebuffer):(a=n.resolution,t||(or.width=n._view.screen.width,or.height=n._view.screen.height,t=or),s||(s=or,s.width=t.width,s.height=t.height));const h=this.viewportFrame;h.x=s.x*a,h.y=s.y*a,h.width=s.width*a,h.height=s.height*a,e||(h.y=n.view.height-(h.y+h.height)),h.ceil(),this.renderer.framebuffer.bind(o,h),this.renderer.projection.update(s,t,a,!o),e?this.renderer.mask.setMaskStack(r.maskStack):this.renderer.mask.setMaskStack(this.defaultMaskStack),this.sourceFrame.copyFrom(t),this.destinationFrame.copyFrom(s)}clear(e,t){const s=this.current?this.current.baseTexture.clear:this.renderer.background.backgroundColor,n=At.shared.setValue(e||s);(this.current&&this.current.baseTexture.alphaMode>0||!this.current&&this._rendererPremultipliedAlpha)&&n.premultiply(n.alpha);const r=this.destinationFrame,o=this.current?this.current.baseTexture:this.renderer._view.screen,a=r.width!==o.width||r.height!==o.height;if(a){let{x:h,y:l,width:c,height:u}=this.viewportFrame;h=Math.round(h),l=Math.round(l),c=Math.round(c),u=Math.round(u),this.renderer.gl.enable(this.renderer.gl.SCISSOR_TEST),this.renderer.gl.scissor(h,l,c,u)}this.renderer.framebuffer.clear(n.red,n.green,n.blue,n.alpha,t),a&&this.renderer.scissor.pop()}resize(){this.bind(null)}reset(){this.bind(null)}destroy(){this.renderer=null}}Mv.extension={type:Oe.RendererSystem,name:"renderTexture"};He.add(Mv);class eS{constructor(e,t){this.program=e,this.uniformData=t,this.uniformGroups={},this.uniformDirtyGroups={},this.uniformBufferBindings={}}destroy(){this.uniformData=null,this.uniformGroups=null,this.uniformDirtyGroups=null,this.uniformBufferBindings=null,this.program=null}}function tS(i,e){const t={},s=e.getProgramParameter(i,e.ACTIVE_ATTRIBUTES);for(let n=0;n<s;n++){const r=e.getActiveAttrib(i,n);if(r.name.startsWith("gl_"))continue;const o=lv(e,r.type),a={type:o,name:r.name,size:av(o),location:e.getAttribLocation(i,r.name)};t[r.name]=a}return t}function iS(i,e){const t={},s=e.getProgramParameter(i,e.ACTIVE_UNIFORMS);for(let n=0;n<s;n++){const r=e.getActiveUniform(i,n),o=r.name.replace(/\[.*?\]$/,""),a=!!r.name.match(/\[.*?\]$/),h=lv(e,r.type);t[o]={name:o,index:n,type:h,size:r.size,isArray:a,value:rv(h,r.size)}}return t}function sS(i,e){var a;const t=_m(i,i.VERTEX_SHADER,e.vertexSrc),s=_m(i,i.FRAGMENT_SHADER,e.fragmentSrc),n=i.createProgram();i.attachShader(n,t),i.attachShader(n,s);const r=(a=e.extra)==null?void 0:a.transformFeedbackVaryings;if(r&&(typeof i.transformFeedbackVaryings!="function"?console.warn("TransformFeedback is not supported but TransformFeedbackVaryings are given."):i.transformFeedbackVaryings(n,r.names,r.bufferMode==="separate"?i.SEPARATE_ATTRIBS:i.INTERLEAVED_ATTRIBS)),i.linkProgram(n),i.getProgramParameter(n,i.LINK_STATUS)||F_(i,n,t,s),e.attributeData=tS(n,i),e.uniformData=iS(n,i),!/^[ \t]*#[ \t]*version[ \t]+300[ \t]+es[ \t]*$/m.test(e.vertexSrc)){const h=Object.keys(e.attributeData);h.sort((l,c)=>l>c?1:-1);for(let l=0;l<h.length;l++)e.attributeData[h[l]].location=l,i.bindAttribLocation(n,l,h[l]);i.linkProgram(n)}i.deleteShader(t),i.deleteShader(s);const o={};for(const h in e.uniformData){const l=e.uniformData[h];o[h]={location:i.getUniformLocation(n,h),value:rv(l.type,l.size)}}return new eS(n,o)}function nS(i,e,t,s,n){t.buffer.update(n)}const rS={float:`
|
||
data[offset] = v;
|
||
`,vec2:`
|
||
data[offset] = v[0];
|
||
data[offset+1] = v[1];
|
||
`,vec3:`
|
||
data[offset] = v[0];
|
||
data[offset+1] = v[1];
|
||
data[offset+2] = v[2];
|
||
|
||
`,vec4:`
|
||
data[offset] = v[0];
|
||
data[offset+1] = v[1];
|
||
data[offset+2] = v[2];
|
||
data[offset+3] = v[3];
|
||
`,mat2:`
|
||
data[offset] = v[0];
|
||
data[offset+1] = v[1];
|
||
|
||
data[offset+4] = v[2];
|
||
data[offset+5] = v[3];
|
||
`,mat3:`
|
||
data[offset] = v[0];
|
||
data[offset+1] = v[1];
|
||
data[offset+2] = v[2];
|
||
|
||
data[offset + 4] = v[3];
|
||
data[offset + 5] = v[4];
|
||
data[offset + 6] = v[5];
|
||
|
||
data[offset + 8] = v[6];
|
||
data[offset + 9] = v[7];
|
||
data[offset + 10] = v[8];
|
||
`,mat4:`
|
||
for(var i = 0; i < 16; i++)
|
||
{
|
||
data[offset + i] = v[i];
|
||
}
|
||
`},Ev={float:4,vec2:8,vec3:12,vec4:16,int:4,ivec2:8,ivec3:12,ivec4:16,uint:4,uvec2:8,uvec3:12,uvec4:16,bool:4,bvec2:8,bvec3:12,bvec4:16,mat2:32,mat3:48,mat4:64};function oS(i){const e=i.map(r=>({data:r,offset:0,dataLen:0,dirty:0}));let t=0,s=0,n=0;for(let r=0;r<e.length;r++){const o=e[r];if(t=Ev[o.data.type],o.data.size>1&&(t=Math.max(t,16)*o.data.size),o.dataLen=t,s%t!==0&&s<16){const a=s%t%16;s+=a,n+=a}s+t>16?(n=Math.ceil(n/16)*16,o.offset=n,n+=t,s=t):(o.offset=n,s+=t,n+=t)}return n=Math.ceil(n/16)*16,{uboElements:e,size:n}}function aS(i,e){const t=[];for(const s in i)e[s]&&t.push(e[s]);return t.sort((s,n)=>s.index-n.index),t}function lS(i,e){if(!i.autoManage)return{size:0,syncFunc:nS};const t=aS(i.uniforms,e),{uboElements:s,size:n}=oS(t),r=[`
|
||
var v = null;
|
||
var v2 = null;
|
||
var cv = null;
|
||
var t = 0;
|
||
var gl = renderer.gl
|
||
var index = 0;
|
||
var data = buffer.data;
|
||
`];for(let o=0;o<s.length;o++){const a=s[o],h=i.uniforms[a.data.name],l=a.data.name;let c=!1;for(let u=0;u<lo.length;u++){const f=lo[u];if(f.codeUbo&&f.test(a.data,h)){r.push(`offset = ${a.offset/4};`,lo[u].codeUbo(a.data.name,h)),c=!0;break}}if(!c)if(a.data.size>1){const u=av(a.data.type),f=Math.max(Ev[a.data.type]/16,1),d=u/f,m=(4-d%4)%4;r.push(`
|
||
cv = ud.${l}.value;
|
||
v = uv.${l};
|
||
offset = ${a.offset/4};
|
||
|
||
t = 0;
|
||
|
||
for(var i=0; i < ${a.data.size*f}; i++)
|
||
{
|
||
for(var j = 0; j < ${d}; j++)
|
||
{
|
||
data[offset++] = v[t++];
|
||
}
|
||
offset += ${m};
|
||
}
|
||
|
||
`)}else{const u=rS[a.data.type];r.push(`
|
||
cv = ud.${l}.value;
|
||
v = uv.${l};
|
||
offset = ${a.offset/4};
|
||
${u};
|
||
`)}}return r.push(`
|
||
renderer.buffer.update(buffer);
|
||
`),{size:n,syncFunc:new Function("ud","uv","renderer","syncData","buffer",r.join(`
|
||
`))}}let hS=0;const $a={textureCount:0,uboCount:0};class Av{constructor(e){this.destroyed=!1,this.renderer=e,this.systemCheck(),this.gl=null,this.shader=null,this.program=null,this.cache={},this._uboCache={},this.id=hS++}systemCheck(){if(!B_())throw new Error("Current environment does not allow unsafe-eval, please use @pixi/unsafe-eval module to enable support.")}contextChange(e){this.gl=e,this.reset()}bind(e,t){e.disposeRunner.add(this),e.uniforms.globals=this.renderer.globalUniforms;const s=e.program,n=s.glPrograms[this.renderer.CONTEXT_UID]||this.generateProgram(e);return this.shader=e,this.program!==s&&(this.program=s,this.gl.useProgram(n.program)),t||($a.textureCount=0,$a.uboCount=0,this.syncUniformGroup(e.uniformGroup,$a)),n}setUniforms(e){const t=this.shader.program,s=t.glPrograms[this.renderer.CONTEXT_UID];t.syncUniforms(s.uniformData,e,this.renderer)}syncUniformGroup(e,t){const s=this.getGlProgram();(!e.static||e.dirtyId!==s.uniformDirtyGroups[e.id])&&(s.uniformDirtyGroups[e.id]=e.dirtyId,this.syncUniforms(e,s,t))}syncUniforms(e,t,s){(e.syncUniforms[this.shader.program.id]||this.createSyncGroups(e))(t.uniformData,e.uniforms,this.renderer,s)}createSyncGroups(e){const t=this.getSignature(e,this.shader.program.uniformData,"u");return this.cache[t]||(this.cache[t]=R_(e,this.shader.program.uniformData)),e.syncUniforms[this.shader.program.id]=this.cache[t],e.syncUniforms[this.shader.program.id]}syncUniformBufferGroup(e,t){const s=this.getGlProgram();if(!e.static||e.dirtyId!==0||!s.uniformGroups[e.id]){e.dirtyId=0;const n=s.uniformGroups[e.id]||this.createSyncBufferGroup(e,s,t);e.buffer.update(),n(s.uniformData,e.uniforms,this.renderer,$a,e.buffer)}this.renderer.buffer.bindBufferBase(e.buffer,s.uniformBufferBindings[t])}createSyncBufferGroup(e,t,s){const{gl:n}=this.renderer;this.renderer.buffer.bind(e.buffer);const r=this.gl.getUniformBlockIndex(t.program,s);t.uniformBufferBindings[s]=this.shader.uniformBindCount,n.uniformBlockBinding(t.program,r,this.shader.uniformBindCount),this.shader.uniformBindCount++;const o=this.getSignature(e,this.shader.program.uniformData,"ubo");let a=this._uboCache[o];if(a||(a=this._uboCache[o]=lS(e,this.shader.program.uniformData)),e.autoManage){const h=new Float32Array(a.size/4);e.buffer.update(h)}return t.uniformGroups[e.id]=a.syncFunc,t.uniformGroups[e.id]}getSignature(e,t,s){const n=e.uniforms,r=[`${s}-`];for(const o in n)r.push(o),t[o]&&r.push(t[o].type);return r.join("-")}getGlProgram(){return this.shader?this.shader.program.glPrograms[this.renderer.CONTEXT_UID]:null}generateProgram(e){const t=this.gl,s=e.program,n=sS(t,s);return s.glPrograms[this.renderer.CONTEXT_UID]=n,n}reset(){this.program=null,this.shader=null}disposeShader(e){this.shader===e&&(this.shader=null)}destroy(){this.renderer=null,this.destroyed=!0}}Av.extension={type:Oe.RendererSystem,name:"shader"};He.add(Av);class Dl{constructor(e){this.renderer=e}run(e){const{renderer:t}=this;t.runners.init.emit(t.options),e.hello&&console.log(`PixiJS 7.4.3 - ${t.rendererLogId} - https://pixijs.com`),t.resize(t.screen.width,t.screen.height)}destroy(){}}Dl.defaultOptions={hello:!1},Dl.extension={type:[Oe.RendererSystem,Oe.CanvasRendererSystem],name:"startup"};He.add(Dl);function cS(i,e=[]){return e[Qe.NORMAL]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],e[Qe.ADD]=[i.ONE,i.ONE],e[Qe.MULTIPLY]=[i.DST_COLOR,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA],e[Qe.SCREEN]=[i.ONE,i.ONE_MINUS_SRC_COLOR,i.ONE,i.ONE_MINUS_SRC_ALPHA],e[Qe.OVERLAY]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],e[Qe.DARKEN]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],e[Qe.LIGHTEN]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],e[Qe.COLOR_DODGE]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],e[Qe.COLOR_BURN]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],e[Qe.HARD_LIGHT]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],e[Qe.SOFT_LIGHT]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],e[Qe.DIFFERENCE]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],e[Qe.EXCLUSION]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],e[Qe.HUE]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],e[Qe.SATURATION]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],e[Qe.COLOR]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],e[Qe.LUMINOSITY]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],e[Qe.NONE]=[0,0],e[Qe.NORMAL_NPM]=[i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA],e[Qe.ADD_NPM]=[i.SRC_ALPHA,i.ONE,i.ONE,i.ONE],e[Qe.SCREEN_NPM]=[i.SRC_ALPHA,i.ONE_MINUS_SRC_COLOR,i.ONE,i.ONE_MINUS_SRC_ALPHA],e[Qe.SRC_IN]=[i.DST_ALPHA,i.ZERO],e[Qe.SRC_OUT]=[i.ONE_MINUS_DST_ALPHA,i.ZERO],e[Qe.SRC_ATOP]=[i.DST_ALPHA,i.ONE_MINUS_SRC_ALPHA],e[Qe.DST_OVER]=[i.ONE_MINUS_DST_ALPHA,i.ONE],e[Qe.DST_IN]=[i.ZERO,i.SRC_ALPHA],e[Qe.DST_OUT]=[i.ZERO,i.ONE_MINUS_SRC_ALPHA],e[Qe.DST_ATOP]=[i.ONE_MINUS_DST_ALPHA,i.SRC_ALPHA],e[Qe.XOR]=[i.ONE_MINUS_DST_ALPHA,i.ONE_MINUS_SRC_ALPHA],e[Qe.SUBTRACT]=[i.ONE,i.ONE,i.ONE,i.ONE,i.FUNC_REVERSE_SUBTRACT,i.FUNC_ADD],e}const uS=0,dS=1,fS=2,pS=3,mS=4,gS=5,Cv=class id{constructor(){this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode=Qe.NONE,this._blendEq=!1,this.map=[],this.map[uS]=this.setBlend,this.map[dS]=this.setOffset,this.map[fS]=this.setCullFace,this.map[pS]=this.setDepthTest,this.map[mS]=this.setFrontFace,this.map[gS]=this.setDepthMask,this.checks=[],this.defaultState=new zs,this.defaultState.blend=!0}contextChange(e){this.gl=e,this.blendModes=cS(e),this.set(this.defaultState),this.reset()}set(e){if(e=e||this.defaultState,this.stateId!==e.data){let t=this.stateId^e.data,s=0;for(;t;)t&1&&this.map[s].call(this,!!(e.data&1<<s)),t=t>>1,s++;this.stateId=e.data}for(let t=0;t<this.checks.length;t++)this.checks[t](this,e)}forceState(e){e=e||this.defaultState;for(let t=0;t<this.map.length;t++)this.map[t].call(this,!!(e.data&1<<t));for(let t=0;t<this.checks.length;t++)this.checks[t](this,e);this.stateId=e.data}setBlend(e){this.updateCheck(id.checkBlendMode,e),this.gl[e?"enable":"disable"](this.gl.BLEND)}setOffset(e){this.updateCheck(id.checkPolygonOffset,e),this.gl[e?"enable":"disable"](this.gl.POLYGON_OFFSET_FILL)}setDepthTest(e){this.gl[e?"enable":"disable"](this.gl.DEPTH_TEST)}setDepthMask(e){this.gl.depthMask(e)}setCullFace(e){this.gl[e?"enable":"disable"](this.gl.CULL_FACE)}setFrontFace(e){this.gl.frontFace(this.gl[e?"CW":"CCW"])}setBlendMode(e){if(e===this.blendMode)return;this.blendMode=e;const t=this.blendModes[e],s=this.gl;t.length===2?s.blendFunc(t[0],t[1]):s.blendFuncSeparate(t[0],t[1],t[2],t[3]),t.length===6?(this._blendEq=!0,s.blendEquationSeparate(t[4],t[5])):this._blendEq&&(this._blendEq=!1,s.blendEquationSeparate(s.FUNC_ADD,s.FUNC_ADD))}setPolygonOffset(e,t){this.gl.polygonOffset(e,t)}reset(){this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,!1),this.forceState(this.defaultState),this._blendEq=!0,this.blendMode=-1,this.setBlendMode(0)}updateCheck(e,t){const s=this.checks.indexOf(e);t&&s===-1?this.checks.push(e):!t&&s!==-1&&this.checks.splice(s,1)}static checkBlendMode(e,t){e.setBlendMode(t.blendMode)}static checkPolygonOffset(e,t){e.setPolygonOffset(1,t.polygonOffset)}destroy(){this.gl=null}};Cv.extension={type:Oe.RendererSystem,name:"state"};let vS=Cv;He.add(vS);class yS extends Sa{constructor(){super(...arguments),this.runners={},this._systemsHash={}}setup(e){this.addRunners(...e.runners);const t=(e.priority??[]).filter(n=>e.systems[n]),s=[...t,...Object.keys(e.systems).filter(n=>!t.includes(n))];for(const n of s)this.addSystem(e.systems[n],n)}addRunners(...e){e.forEach(t=>{this.runners[t]=new ds(t)})}addSystem(e,t){const s=new e(this);if(this[t])throw new Error(`Whoops! The name "${t}" is already in use`);this[t]=s,this._systemsHash[t]=s;for(const n in this.runners)this.runners[n].add(s);return this}emitWithCustomOptions(e,t){const s=Object.keys(this._systemsHash);e.items.forEach(n=>{const r=s.find(o=>this._systemsHash[o]===n);n[e.name](t[r])})}destroy(){Object.values(this.runners).forEach(e=>{e.destroy()}),this._systemsHash={}}}const jo=class ml{constructor(e){this.renderer=e,this.count=0,this.checkCount=0,this.maxIdle=ml.defaultMaxIdle,this.checkCountMax=ml.defaultCheckCountMax,this.mode=ml.defaultMode}postrender(){this.renderer.objectRenderer.renderingToScreen&&(this.count++,this.mode!==Kd.MANUAL&&(this.checkCount++,this.checkCount>this.checkCountMax&&(this.checkCount=0,this.run())))}run(){const e=this.renderer.texture,t=e.managedTextures;let s=!1;for(let n=0;n<t.length;n++){const r=t[n];r.resource&&this.count-r.touched>this.maxIdle&&(e.destroyTexture(r,!0),t[n]=null,s=!0)}if(s){let n=0;for(let r=0;r<t.length;r++)t[r]!==null&&(t[n++]=t[r]);t.length=n}}unload(e){const t=this.renderer.texture,s=e._texture;s&&!s.framebuffer&&t.destroyTexture(s);for(let n=e.children.length-1;n>=0;n--)this.unload(e.children[n])}destroy(){this.renderer=null}};jo.defaultMode=Kd.AUTO,jo.defaultMaxIdle=3600,jo.defaultCheckCountMax=600,jo.extension={type:Oe.RendererSystem,name:"textureGC"};let fr=jo;He.add(fr);class lu{constructor(e){this.texture=e,this.width=-1,this.height=-1,this.dirtyId=-1,this.dirtyStyleId=-1,this.mipmap=!1,this.wrapMode=33071,this.type=je.UNSIGNED_BYTE,this.internalFormat=Re.RGBA,this.samplerType=0}}function xS(i){let e;return"WebGL2RenderingContext"in globalThis&&i instanceof globalThis.WebGL2RenderingContext?e={[i.RGB]:Xe.FLOAT,[i.RGBA]:Xe.FLOAT,[i.ALPHA]:Xe.FLOAT,[i.LUMINANCE]:Xe.FLOAT,[i.LUMINANCE_ALPHA]:Xe.FLOAT,[i.R8]:Xe.FLOAT,[i.R8_SNORM]:Xe.FLOAT,[i.RG8]:Xe.FLOAT,[i.RG8_SNORM]:Xe.FLOAT,[i.RGB8]:Xe.FLOAT,[i.RGB8_SNORM]:Xe.FLOAT,[i.RGB565]:Xe.FLOAT,[i.RGBA4]:Xe.FLOAT,[i.RGB5_A1]:Xe.FLOAT,[i.RGBA8]:Xe.FLOAT,[i.RGBA8_SNORM]:Xe.FLOAT,[i.RGB10_A2]:Xe.FLOAT,[i.RGB10_A2UI]:Xe.FLOAT,[i.SRGB8]:Xe.FLOAT,[i.SRGB8_ALPHA8]:Xe.FLOAT,[i.R16F]:Xe.FLOAT,[i.RG16F]:Xe.FLOAT,[i.RGB16F]:Xe.FLOAT,[i.RGBA16F]:Xe.FLOAT,[i.R32F]:Xe.FLOAT,[i.RG32F]:Xe.FLOAT,[i.RGB32F]:Xe.FLOAT,[i.RGBA32F]:Xe.FLOAT,[i.R11F_G11F_B10F]:Xe.FLOAT,[i.RGB9_E5]:Xe.FLOAT,[i.R8I]:Xe.INT,[i.R8UI]:Xe.UINT,[i.R16I]:Xe.INT,[i.R16UI]:Xe.UINT,[i.R32I]:Xe.INT,[i.R32UI]:Xe.UINT,[i.RG8I]:Xe.INT,[i.RG8UI]:Xe.UINT,[i.RG16I]:Xe.INT,[i.RG16UI]:Xe.UINT,[i.RG32I]:Xe.INT,[i.RG32UI]:Xe.UINT,[i.RGB8I]:Xe.INT,[i.RGB8UI]:Xe.UINT,[i.RGB16I]:Xe.INT,[i.RGB16UI]:Xe.UINT,[i.RGB32I]:Xe.INT,[i.RGB32UI]:Xe.UINT,[i.RGBA8I]:Xe.INT,[i.RGBA8UI]:Xe.UINT,[i.RGBA16I]:Xe.INT,[i.RGBA16UI]:Xe.UINT,[i.RGBA32I]:Xe.INT,[i.RGBA32UI]:Xe.UINT,[i.DEPTH_COMPONENT16]:Xe.FLOAT,[i.DEPTH_COMPONENT24]:Xe.FLOAT,[i.DEPTH_COMPONENT32F]:Xe.FLOAT,[i.DEPTH_STENCIL]:Xe.FLOAT,[i.DEPTH24_STENCIL8]:Xe.FLOAT,[i.DEPTH32F_STENCIL8]:Xe.FLOAT}:e={[i.RGB]:Xe.FLOAT,[i.RGBA]:Xe.FLOAT,[i.ALPHA]:Xe.FLOAT,[i.LUMINANCE]:Xe.FLOAT,[i.LUMINANCE_ALPHA]:Xe.FLOAT,[i.DEPTH_STENCIL]:Xe.FLOAT},e}function bS(i){let e;return"WebGL2RenderingContext"in globalThis&&i instanceof globalThis.WebGL2RenderingContext?e={[je.UNSIGNED_BYTE]:{[Re.RGBA]:i.RGBA8,[Re.RGB]:i.RGB8,[Re.RG]:i.RG8,[Re.RED]:i.R8,[Re.RGBA_INTEGER]:i.RGBA8UI,[Re.RGB_INTEGER]:i.RGB8UI,[Re.RG_INTEGER]:i.RG8UI,[Re.RED_INTEGER]:i.R8UI,[Re.ALPHA]:i.ALPHA,[Re.LUMINANCE]:i.LUMINANCE,[Re.LUMINANCE_ALPHA]:i.LUMINANCE_ALPHA},[je.BYTE]:{[Re.RGBA]:i.RGBA8_SNORM,[Re.RGB]:i.RGB8_SNORM,[Re.RG]:i.RG8_SNORM,[Re.RED]:i.R8_SNORM,[Re.RGBA_INTEGER]:i.RGBA8I,[Re.RGB_INTEGER]:i.RGB8I,[Re.RG_INTEGER]:i.RG8I,[Re.RED_INTEGER]:i.R8I},[je.UNSIGNED_SHORT]:{[Re.RGBA_INTEGER]:i.RGBA16UI,[Re.RGB_INTEGER]:i.RGB16UI,[Re.RG_INTEGER]:i.RG16UI,[Re.RED_INTEGER]:i.R16UI,[Re.DEPTH_COMPONENT]:i.DEPTH_COMPONENT16},[je.SHORT]:{[Re.RGBA_INTEGER]:i.RGBA16I,[Re.RGB_INTEGER]:i.RGB16I,[Re.RG_INTEGER]:i.RG16I,[Re.RED_INTEGER]:i.R16I},[je.UNSIGNED_INT]:{[Re.RGBA_INTEGER]:i.RGBA32UI,[Re.RGB_INTEGER]:i.RGB32UI,[Re.RG_INTEGER]:i.RG32UI,[Re.RED_INTEGER]:i.R32UI,[Re.DEPTH_COMPONENT]:i.DEPTH_COMPONENT24},[je.INT]:{[Re.RGBA_INTEGER]:i.RGBA32I,[Re.RGB_INTEGER]:i.RGB32I,[Re.RG_INTEGER]:i.RG32I,[Re.RED_INTEGER]:i.R32I},[je.FLOAT]:{[Re.RGBA]:i.RGBA32F,[Re.RGB]:i.RGB32F,[Re.RG]:i.RG32F,[Re.RED]:i.R32F,[Re.DEPTH_COMPONENT]:i.DEPTH_COMPONENT32F},[je.HALF_FLOAT]:{[Re.RGBA]:i.RGBA16F,[Re.RGB]:i.RGB16F,[Re.RG]:i.RG16F,[Re.RED]:i.R16F},[je.UNSIGNED_SHORT_5_6_5]:{[Re.RGB]:i.RGB565},[je.UNSIGNED_SHORT_4_4_4_4]:{[Re.RGBA]:i.RGBA4},[je.UNSIGNED_SHORT_5_5_5_1]:{[Re.RGBA]:i.RGB5_A1},[je.UNSIGNED_INT_2_10_10_10_REV]:{[Re.RGBA]:i.RGB10_A2,[Re.RGBA_INTEGER]:i.RGB10_A2UI},[je.UNSIGNED_INT_10F_11F_11F_REV]:{[Re.RGB]:i.R11F_G11F_B10F},[je.UNSIGNED_INT_5_9_9_9_REV]:{[Re.RGB]:i.RGB9_E5},[je.UNSIGNED_INT_24_8]:{[Re.DEPTH_STENCIL]:i.DEPTH24_STENCIL8},[je.FLOAT_32_UNSIGNED_INT_24_8_REV]:{[Re.DEPTH_STENCIL]:i.DEPTH32F_STENCIL8}}:e={[je.UNSIGNED_BYTE]:{[Re.RGBA]:i.RGBA,[Re.RGB]:i.RGB,[Re.ALPHA]:i.ALPHA,[Re.LUMINANCE]:i.LUMINANCE,[Re.LUMINANCE_ALPHA]:i.LUMINANCE_ALPHA},[je.UNSIGNED_SHORT_5_6_5]:{[Re.RGB]:i.RGB},[je.UNSIGNED_SHORT_4_4_4_4]:{[Re.RGBA]:i.RGBA},[je.UNSIGNED_SHORT_5_5_5_1]:{[Re.RGBA]:i.RGBA}},e}class Iv{constructor(e){this.renderer=e,this.boundTextures=[],this.currentLocation=-1,this.managedTextures=[],this._unknownBoundTextures=!1,this.unknownTexture=new st,this.hasIntegerTextures=!1}contextChange(){const e=this.gl=this.renderer.gl;this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.webGLVersion=this.renderer.context.webGLVersion,this.internalFormats=bS(e),this.samplerTypes=xS(e);const t=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS);this.boundTextures.length=t;for(let n=0;n<t;n++)this.boundTextures[n]=null;this.emptyTextures={};const s=new lu(e.createTexture());e.bindTexture(e.TEXTURE_2D,s.texture),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,1,1,0,e.RGBA,e.UNSIGNED_BYTE,new Uint8Array(4)),this.emptyTextures[e.TEXTURE_2D]=s,this.emptyTextures[e.TEXTURE_CUBE_MAP]=new lu(e.createTexture()),e.bindTexture(e.TEXTURE_CUBE_MAP,this.emptyTextures[e.TEXTURE_CUBE_MAP].texture);for(let n=0;n<6;n++)e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+n,0,e.RGBA,1,1,0,e.RGBA,e.UNSIGNED_BYTE,null);e.texParameteri(e.TEXTURE_CUBE_MAP,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_CUBE_MAP,e.TEXTURE_MIN_FILTER,e.LINEAR);for(let n=0;n<this.boundTextures.length;n++)this.bind(null,n)}bind(e,t=0){const{gl:s}=this;if(e=e==null?void 0:e.castToBaseTexture(),(e==null?void 0:e.valid)&&!e.parentTextureArray){e.touched=this.renderer.textureGC.count;const n=e._glTextures[this.CONTEXT_UID]||this.initTexture(e);this.boundTextures[t]!==e&&(this.currentLocation!==t&&(this.currentLocation=t,s.activeTexture(s.TEXTURE0+t)),s.bindTexture(e.target,n.texture)),n.dirtyId!==e.dirtyId?(this.currentLocation!==t&&(this.currentLocation=t,s.activeTexture(s.TEXTURE0+t)),this.updateTexture(e)):n.dirtyStyleId!==e.dirtyStyleId&&this.updateTextureStyle(e),this.boundTextures[t]=e}else this.currentLocation!==t&&(this.currentLocation=t,s.activeTexture(s.TEXTURE0+t)),s.bindTexture(s.TEXTURE_2D,this.emptyTextures[s.TEXTURE_2D].texture),this.boundTextures[t]=null}reset(){this._unknownBoundTextures=!0,this.hasIntegerTextures=!1,this.currentLocation=-1;for(let e=0;e<this.boundTextures.length;e++)this.boundTextures[e]=this.unknownTexture}unbind(e){const{gl:t,boundTextures:s}=this;if(this._unknownBoundTextures){this._unknownBoundTextures=!1;for(let n=0;n<s.length;n++)s[n]===this.unknownTexture&&this.bind(null,n)}for(let n=0;n<s.length;n++)s[n]===e&&(this.currentLocation!==n&&(t.activeTexture(t.TEXTURE0+n),this.currentLocation=n),t.bindTexture(e.target,this.emptyTextures[e.target].texture),s[n]=null)}ensureSamplerType(e){const{boundTextures:t,hasIntegerTextures:s,CONTEXT_UID:n}=this;if(s)for(let r=e-1;r>=0;--r){const o=t[r];o&&o._glTextures[n].samplerType!==Xe.FLOAT&&this.renderer.texture.unbind(o)}}initTexture(e){const t=new lu(this.gl.createTexture());return t.dirtyId=-1,e._glTextures[this.CONTEXT_UID]=t,this.managedTextures.push(e),e.on("dispose",this.destroyTexture,this),t}initTextureType(e,t){var s;t.internalFormat=((s=this.internalFormats[e.type])==null?void 0:s[e.format])??e.format,t.samplerType=this.samplerTypes[t.internalFormat]??Xe.FLOAT,this.webGLVersion===2&&e.type===je.HALF_FLOAT?t.type=this.gl.HALF_FLOAT:t.type=e.type}updateTexture(e){var n;const t=e._glTextures[this.CONTEXT_UID];if(!t)return;const s=this.renderer;if(this.initTextureType(e,t),(n=e.resource)==null?void 0:n.upload(s,e,t))t.samplerType!==Xe.FLOAT&&(this.hasIntegerTextures=!0);else{const r=e.realWidth,o=e.realHeight,a=s.gl;(t.width!==r||t.height!==o||t.dirtyId<0)&&(t.width=r,t.height=o,a.texImage2D(e.target,0,t.internalFormat,r,o,0,e.format,t.type,null))}e.dirtyStyleId!==t.dirtyStyleId&&this.updateTextureStyle(e),t.dirtyId=e.dirtyId}destroyTexture(e,t){const{gl:s}=this;if(e=e.castToBaseTexture(),e._glTextures[this.CONTEXT_UID]&&(this.unbind(e),s.deleteTexture(e._glTextures[this.CONTEXT_UID].texture),e.off("dispose",this.destroyTexture,this),delete e._glTextures[this.CONTEXT_UID],!t)){const n=this.managedTextures.indexOf(e);n!==-1&&ao(this.managedTextures,n,1)}}updateTextureStyle(e){var s;const t=e._glTextures[this.CONTEXT_UID];t&&((e.mipmap===Ki.POW2||this.webGLVersion!==2)&&!e.isPowerOfTwo?t.mipmap=!1:t.mipmap=e.mipmap>=1,this.webGLVersion!==2&&!e.isPowerOfTwo?t.wrapMode=us.CLAMP:t.wrapMode=e.wrapMode,(s=e.resource)!=null&&s.style(this.renderer,e,t)||this.setStyle(e,t),t.dirtyStyleId=e.dirtyStyleId)}setStyle(e,t){const s=this.gl;if(t.mipmap&&e.mipmap!==Ki.ON_MANUAL&&s.generateMipmap(e.target),s.texParameteri(e.target,s.TEXTURE_WRAP_S,t.wrapMode),s.texParameteri(e.target,s.TEXTURE_WRAP_T,t.wrapMode),t.mipmap){s.texParameteri(e.target,s.TEXTURE_MIN_FILTER,e.scaleMode===as.LINEAR?s.LINEAR_MIPMAP_LINEAR:s.NEAREST_MIPMAP_NEAREST);const n=this.renderer.context.extensions.anisotropicFiltering;if(n&&e.anisotropicLevel>0&&e.scaleMode===as.LINEAR){const r=Math.min(e.anisotropicLevel,s.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT));s.texParameterf(e.target,n.TEXTURE_MAX_ANISOTROPY_EXT,r)}}else s.texParameteri(e.target,s.TEXTURE_MIN_FILTER,e.scaleMode===as.LINEAR?s.LINEAR:s.NEAREST);s.texParameteri(e.target,s.TEXTURE_MAG_FILTER,e.scaleMode===as.LINEAR?s.LINEAR:s.NEAREST)}destroy(){this.renderer=null}}Iv.extension={type:Oe.RendererSystem,name:"texture"};He.add(Iv);class Rv{constructor(e){this.renderer=e}contextChange(){this.gl=this.renderer.gl,this.CONTEXT_UID=this.renderer.CONTEXT_UID}bind(e){const{gl:t,CONTEXT_UID:s}=this,n=e._glTransformFeedbacks[s]||this.createGLTransformFeedback(e);t.bindTransformFeedback(t.TRANSFORM_FEEDBACK,n)}unbind(){const{gl:e}=this;e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,null)}beginTransformFeedback(e,t){const{gl:s,renderer:n}=this;t&&n.shader.bind(t),s.beginTransformFeedback(e)}endTransformFeedback(){const{gl:e}=this;e.endTransformFeedback()}createGLTransformFeedback(e){const{gl:t,renderer:s,CONTEXT_UID:n}=this,r=t.createTransformFeedback();e._glTransformFeedbacks[n]=r,t.bindTransformFeedback(t.TRANSFORM_FEEDBACK,r);for(let o=0;o<e.buffers.length;o++){const a=e.buffers[o];a&&(s.buffer.update(a),a._glBuffers[n].refCount++,t.bindBufferBase(t.TRANSFORM_FEEDBACK_BUFFER,o,a._glBuffers[n].buffer||null))}return t.bindTransformFeedback(t.TRANSFORM_FEEDBACK,null),e.disposeRunner.add(this),r}disposeTransformFeedback(e,t){const s=e._glTransformFeedbacks[this.CONTEXT_UID],n=this.gl;e.disposeRunner.remove(this);const r=this.renderer.buffer;if(r)for(let o=0;o<e.buffers.length;o++){const a=e.buffers[o];if(!a)continue;const h=a._glBuffers[this.CONTEXT_UID];h&&(h.refCount--,h.refCount===0&&!t&&r.dispose(a,t))}s&&(t||n.deleteTransformFeedback(s),delete e._glTransformFeedbacks[this.CONTEXT_UID])}destroy(){this.renderer=null}}Rv.extension={type:Oe.RendererSystem,name:"transformFeedback"};He.add(Rv);class Nl{constructor(e){this.renderer=e}init(e){this.screen=new lt(0,0,e.width,e.height),this.element=e.view||Ve.ADAPTER.createCanvas(),this.resolution=e.resolution||Ve.RESOLUTION,this.autoDensity=!!e.autoDensity}resizeView(e,t){this.element.width=Math.round(e*this.resolution),this.element.height=Math.round(t*this.resolution);const s=this.element.width/this.resolution,n=this.element.height/this.resolution;this.screen.width=s,this.screen.height=n,this.autoDensity&&(this.element.style.width=`${s}px`,this.element.style.height=`${n}px`),this.renderer.emit("resize",s,n),this.renderer.runners.resize.emit(this.screen.width,this.screen.height)}destroy(e){var t;e&&((t=this.element.parentNode)==null||t.removeChild(this.element)),this.renderer=null,this.element=null,this.screen=null}}Nl.defaultOptions={width:800,height:600,resolution:void 0,autoDensity:!1},Nl.extension={type:[Oe.RendererSystem,Oe.CanvasRendererSystem],name:"_view"};He.add(Nl);Ve.PREFER_ENV=Cr.WEBGL2;Ve.STRICT_TEXTURE_CACHE=!1;Ve.RENDER_OPTIONS={...Ll.defaultOptions,...Bl.defaultOptions,...Nl.defaultOptions,...Dl.defaultOptions};Object.defineProperties(Ve,{WRAP_MODE:{get(){return st.defaultOptions.wrapMode},set(i){pt("7.1.0","settings.WRAP_MODE is deprecated, use BaseTexture.defaultOptions.wrapMode"),st.defaultOptions.wrapMode=i}},SCALE_MODE:{get(){return st.defaultOptions.scaleMode},set(i){pt("7.1.0","settings.SCALE_MODE is deprecated, use BaseTexture.defaultOptions.scaleMode"),st.defaultOptions.scaleMode=i}},MIPMAP_TEXTURES:{get(){return st.defaultOptions.mipmap},set(i){pt("7.1.0","settings.MIPMAP_TEXTURES is deprecated, use BaseTexture.defaultOptions.mipmap"),st.defaultOptions.mipmap=i}},ANISOTROPIC_LEVEL:{get(){return st.defaultOptions.anisotropicLevel},set(i){pt("7.1.0","settings.ANISOTROPIC_LEVEL is deprecated, use BaseTexture.defaultOptions.anisotropicLevel"),st.defaultOptions.anisotropicLevel=i}},FILTER_RESOLUTION:{get(){return pt("7.1.0","settings.FILTER_RESOLUTION is deprecated, use Filter.defaultResolution"),Mi.defaultResolution},set(i){Mi.defaultResolution=i}},FILTER_MULTISAMPLE:{get(){return pt("7.1.0","settings.FILTER_MULTISAMPLE is deprecated, use Filter.defaultMultisample"),Mi.defaultMultisample},set(i){Mi.defaultMultisample=i}},SPRITE_MAX_TEXTURES:{get(){return Bn.defaultMaxTextures},set(i){pt("7.1.0","settings.SPRITE_MAX_TEXTURES is deprecated, use BatchRenderer.defaultMaxTextures"),Bn.defaultMaxTextures=i}},SPRITE_BATCH_SIZE:{get(){return Bn.defaultBatchSize},set(i){pt("7.1.0","settings.SPRITE_BATCH_SIZE is deprecated, use BatchRenderer.defaultBatchSize"),Bn.defaultBatchSize=i}},CAN_UPLOAD_SAME_BUFFER:{get(){return Bn.canUploadSameBuffer},set(i){pt("7.1.0","settings.CAN_UPLOAD_SAME_BUFFER is deprecated, use BatchRenderer.canUploadSameBuffer"),Bn.canUploadSameBuffer=i}},GC_MODE:{get(){return fr.defaultMode},set(i){pt("7.1.0","settings.GC_MODE is deprecated, use TextureGCSystem.defaultMode"),fr.defaultMode=i}},GC_MAX_IDLE:{get(){return fr.defaultMaxIdle},set(i){pt("7.1.0","settings.GC_MAX_IDLE is deprecated, use TextureGCSystem.defaultMaxIdle"),fr.defaultMaxIdle=i}},GC_MAX_CHECK_COUNT:{get(){return fr.defaultCheckCountMax},set(i){pt("7.1.0","settings.GC_MAX_CHECK_COUNT is deprecated, use TextureGCSystem.defaultCheckCountMax"),fr.defaultCheckCountMax=i}},PRECISION_VERTEX:{get(){return Vs.defaultVertexPrecision},set(i){pt("7.1.0","settings.PRECISION_VERTEX is deprecated, use Program.defaultVertexPrecision"),Vs.defaultVertexPrecision=i}},PRECISION_FRAGMENT:{get(){return Vs.defaultFragmentPrecision},set(i){pt("7.1.0","settings.PRECISION_FRAGMENT is deprecated, use Program.defaultFragmentPrecision"),Vs.defaultFragmentPrecision=i}}});var Sr=(i=>(i[i.INTERACTION=50]="INTERACTION",i[i.HIGH=25]="HIGH",i[i.NORMAL=0]="NORMAL",i[i.LOW=-25]="LOW",i[i.UTILITY=-50]="UTILITY",i))(Sr||{});class hu{constructor(e,t=null,s=0,n=!1){this.next=null,this.previous=null,this._destroyed=!1,this.fn=e,this.context=t,this.priority=s,this.once=n}match(e,t=null){return this.fn===e&&this.context===t}emit(e){this.fn&&(this.context?this.fn.call(this.context,e):this.fn(e));const t=this.next;return this.once&&this.destroy(!0),this._destroyed&&(this.next=null),t}connect(e){this.previous=e,e.next&&(e.next.previous=this),this.next=e.next,e.next=this}destroy(e=!1){this._destroyed=!0,this.fn=null,this.context=null,this.previous&&(this.previous.next=this.next),this.next&&(this.next.previous=this.previous);const t=this.next;return this.next=e?null:t,this.previous=null,t}}const Pv=class Li{constructor(){this.autoStart=!1,this.deltaTime=1,this.lastTime=-1,this.speed=1,this.started=!1,this._requestId=null,this._maxElapsedMS=100,this._minElapsedMS=0,this._protected=!1,this._lastFrame=-1,this._head=new hu(null,null,1/0),this.deltaMS=1/Li.targetFPMS,this.elapsedMS=1/Li.targetFPMS,this._tick=e=>{this._requestId=null,this.started&&(this.update(e),this.started&&this._requestId===null&&this._head.next&&(this._requestId=requestAnimationFrame(this._tick)))}}_requestIfNeeded(){this._requestId===null&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick))}_cancelIfNeeded(){this._requestId!==null&&(cancelAnimationFrame(this._requestId),this._requestId=null)}_startIfPossible(){this.started?this._requestIfNeeded():this.autoStart&&this.start()}add(e,t,s=Sr.NORMAL){return this._addListener(new hu(e,t,s))}addOnce(e,t,s=Sr.NORMAL){return this._addListener(new hu(e,t,s,!0))}_addListener(e){let t=this._head.next,s=this._head;if(!t)e.connect(s);else{for(;t;){if(e.priority>t.priority){e.connect(s);break}s=t,t=t.next}e.previous||e.connect(s)}return this._startIfPossible(),this}remove(e,t){let s=this._head.next;for(;s;)s.match(e,t)?s=s.destroy():s=s.next;return this._head.next||this._cancelIfNeeded(),this}get count(){if(!this._head)return 0;let e=0,t=this._head;for(;t=t.next;)e++;return e}start(){this.started||(this.started=!0,this._requestIfNeeded())}stop(){this.started&&(this.started=!1,this._cancelIfNeeded())}destroy(){if(!this._protected){this.stop();let e=this._head.next;for(;e;)e=e.destroy(!0);this._head.destroy(),this._head=null}}update(e=performance.now()){let t;if(e>this.lastTime){if(t=this.elapsedMS=e-this.lastTime,t>this._maxElapsedMS&&(t=this._maxElapsedMS),t*=this.speed,this._minElapsedMS){const r=e-this._lastFrame|0;if(r<this._minElapsedMS)return;this._lastFrame=e-r%this._minElapsedMS}this.deltaMS=t,this.deltaTime=this.deltaMS*Li.targetFPMS;const s=this._head;let n=s.next;for(;n;)n=n.emit(this.deltaTime);s.next||this._cancelIfNeeded()}else this.deltaTime=this.deltaMS=this.elapsedMS=0;this.lastTime=e}get FPS(){return 1e3/this.elapsedMS}get minFPS(){return 1e3/this._maxElapsedMS}set minFPS(e){const t=Math.min(this.maxFPS,e),s=Math.min(Math.max(0,t)/1e3,Li.targetFPMS);this._maxElapsedMS=1/s}get maxFPS(){return this._minElapsedMS?Math.round(1e3/this._minElapsedMS):0}set maxFPS(e){if(e===0)this._minElapsedMS=0;else{const t=Math.max(this.minFPS,e);this._minElapsedMS=1/(t/1e3)}}static get shared(){if(!Li._shared){const e=Li._shared=new Li;e.autoStart=!0,e._protected=!0}return Li._shared}static get system(){if(!Li._system){const e=Li._system=new Li;e.autoStart=!0,e._protected=!0}return Li._system}};Pv.targetFPMS=.06;let Ei=Pv;Object.defineProperties(Ve,{TARGET_FPMS:{get(){return Ei.targetFPMS},set(i){pt("7.1.0","settings.TARGET_FPMS is deprecated, use Ticker.targetFPMS"),Ei.targetFPMS=i}}});class kv{static init(e){e=Object.assign({autoStart:!0,sharedTicker:!1},e),Object.defineProperty(this,"ticker",{set(t){this._ticker&&this._ticker.remove(this.render,this),this._ticker=t,t&&t.add(this.render,this,Sr.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=e.sharedTicker?Ei.shared:new Ei,e.autoStart&&this.start()}static destroy(){if(this._ticker){const e=this._ticker;this.ticker=null,e.destroy()}}}kv.extension=Oe.Application;He.add(kv);const Fv=[];He.handleByList(Oe.Renderer,Fv);function wS(i){for(const e of Fv)if(e.test(i))return new e(i);throw new Error("Unable to auto-detect a suitable renderer.")}var _S=`attribute vec2 aVertexPosition;
|
||
attribute vec2 aTextureCoord;
|
||
|
||
uniform mat3 projectionMatrix;
|
||
|
||
varying vec2 vTextureCoord;
|
||
|
||
void main(void)
|
||
{
|
||
gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
|
||
vTextureCoord = aTextureCoord;
|
||
}`,SS=`attribute vec2 aVertexPosition;
|
||
|
||
uniform mat3 projectionMatrix;
|
||
|
||
varying vec2 vTextureCoord;
|
||
|
||
uniform vec4 inputSize;
|
||
uniform vec4 outputFrame;
|
||
|
||
vec4 filterVertexPosition( void )
|
||
{
|
||
vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;
|
||
|
||
return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);
|
||
}
|
||
|
||
vec2 filterTextureCoord( void )
|
||
{
|
||
return aVertexPosition * (outputFrame.zw * inputSize.zw);
|
||
}
|
||
|
||
void main(void)
|
||
{
|
||
gl_Position = filterVertexPosition();
|
||
vTextureCoord = filterTextureCoord();
|
||
}
|
||
`;const TS=_S,Ov=SS;class Bv{constructor(e){this.renderer=e}contextChange(e){let t;if(this.renderer.context.webGLVersion===1){const s=e.getParameter(e.FRAMEBUFFER_BINDING);e.bindFramebuffer(e.FRAMEBUFFER,null),t=e.getParameter(e.SAMPLES),e.bindFramebuffer(e.FRAMEBUFFER,s)}else{const s=e.getParameter(e.DRAW_FRAMEBUFFER_BINDING);e.bindFramebuffer(e.DRAW_FRAMEBUFFER,null),t=e.getParameter(e.SAMPLES),e.bindFramebuffer(e.DRAW_FRAMEBUFFER,s)}t>=ei.HIGH?this.multisample=ei.HIGH:t>=ei.MEDIUM?this.multisample=ei.MEDIUM:t>=ei.LOW?this.multisample=ei.LOW:this.multisample=ei.NONE}destroy(){}}Bv.extension={type:Oe.RendererSystem,name:"_multisample"};He.add(Bv);class MS{constructor(e){this.buffer=e||null,this.updateID=-1,this.byteLength=-1,this.refCount=0}}class Lv{constructor(e){this.renderer=e,this.managedBuffers={},this.boundBufferBases={}}destroy(){this.renderer=null}contextChange(){this.disposeAll(!0),this.gl=this.renderer.gl,this.CONTEXT_UID=this.renderer.CONTEXT_UID}bind(e){const{gl:t,CONTEXT_UID:s}=this,n=e._glBuffers[s]||this.createGLBuffer(e);t.bindBuffer(e.type,n.buffer)}unbind(e){const{gl:t}=this;t.bindBuffer(e,null)}bindBufferBase(e,t){const{gl:s,CONTEXT_UID:n}=this;if(this.boundBufferBases[t]!==e){const r=e._glBuffers[n]||this.createGLBuffer(e);this.boundBufferBases[t]=e,s.bindBufferBase(s.UNIFORM_BUFFER,t,r.buffer)}}bindBufferRange(e,t,s){const{gl:n,CONTEXT_UID:r}=this;s=s||0;const o=e._glBuffers[r]||this.createGLBuffer(e);n.bindBufferRange(n.UNIFORM_BUFFER,t||0,o.buffer,s*256,256)}update(e){const{gl:t,CONTEXT_UID:s}=this,n=e._glBuffers[s]||this.createGLBuffer(e);if(e._updateID!==n.updateID)if(n.updateID=e._updateID,t.bindBuffer(e.type,n.buffer),n.byteLength>=e.data.byteLength)t.bufferSubData(e.type,0,e.data);else{const r=e.static?t.STATIC_DRAW:t.DYNAMIC_DRAW;n.byteLength=e.data.byteLength,t.bufferData(e.type,e.data,r)}}dispose(e,t){if(!this.managedBuffers[e.id])return;delete this.managedBuffers[e.id];const s=e._glBuffers[this.CONTEXT_UID],n=this.gl;e.disposeRunner.remove(this),s&&(t||n.deleteBuffer(s.buffer),delete e._glBuffers[this.CONTEXT_UID])}disposeAll(e){const t=Object.keys(this.managedBuffers);for(let s=0;s<t.length;s++)this.dispose(this.managedBuffers[t[s]],e)}createGLBuffer(e){const{CONTEXT_UID:t,gl:s}=this;return e._glBuffers[t]=new MS(s.createBuffer()),this.managedBuffers[e.id]=e,e.disposeRunner.add(this),e._glBuffers[t]}}Lv.extension={type:Oe.RendererSystem,name:"buffer"};He.add(Lv);class Dv{constructor(e){this.renderer=e}render(e,t){const s=this.renderer;let n,r,o,a;if(t&&(n=t.renderTexture,r=t.clear,o=t.transform,a=t.skipUpdateTransform),this.renderingToScreen=!n,s.runners.prerender.emit(),s.emit("prerender"),s.projection.transform=o,!s.context.isLost){if(n||(this.lastObjectRendered=e),!a){const h=e.enableTempParent();e.updateTransform(),e.disableTempParent(h)}s.renderTexture.bind(n),s.batch.currentRenderer.start(),(r??s.background.clearBeforeRender)&&s.renderTexture.clear(),e.render(s),s.batch.currentRenderer.flush(),n&&(t.blit&&s.framebuffer.blit(),n.baseTexture.update()),s.runners.postrender.emit(),s.projection.transform=null,s.emit("postrender")}}destroy(){this.renderer=null,this.lastObjectRendered=null}}Dv.extension={type:Oe.RendererSystem,name:"objectRenderer"};He.add(Dv);const gl=class sd extends yS{constructor(e){super(),this.type=D0.WEBGL,e=Object.assign({},Ve.RENDER_OPTIONS,e),this.gl=null,this.CONTEXT_UID=0,this.globalUniforms=new fs({projectionMatrix:new Vt},!0);const t={runners:["init","destroy","contextChange","resolutionChange","reset","update","postrender","prerender","resize"],systems:sd.__systems,priority:["_view","textureGenerator","background","_plugin","startup","context","state","texture","buffer","geometry","framebuffer","transformFeedback","mask","scissor","stencil","projection","textureGC","filter","renderTexture","batch","objectRenderer","_multisample"]};this.setup(t),"useContextAlpha"in e&&(pt("7.0.0","options.useContextAlpha is deprecated, use options.premultipliedAlpha and options.backgroundAlpha instead"),e.premultipliedAlpha=e.useContextAlpha&&e.useContextAlpha!=="notMultiplied",e.backgroundAlpha=e.useContextAlpha===!1?1:e.backgroundAlpha),this._plugin.rendererPlugins=sd.__plugins,this.options=e,this.startup.run(this.options)}static test(e){return e!=null&&e.forceCanvas?!1:qw()}render(e,t){this.objectRenderer.render(e,t)}resize(e,t){this._view.resizeView(e,t)}reset(){return this.runners.reset.emit(),this}clear(){this.renderTexture.bind(),this.renderTexture.clear()}destroy(e=!1){this.runners.destroy.items.reverse(),this.emitWithCustomOptions(this.runners.destroy,{_view:e}),super.destroy()}get plugins(){return this._plugin.plugins}get multisample(){return this._multisample.multisample}get width(){return this._view.element.width}get height(){return this._view.element.height}get resolution(){return this._view.resolution}set resolution(e){this._view.resolution=e,this.runners.resolutionChange.emit(e)}get autoDensity(){return this._view.autoDensity}get view(){return this._view.element}get screen(){return this._view.screen}get lastObjectRendered(){return this.objectRenderer.lastObjectRendered}get renderingToScreen(){return this.objectRenderer.renderingToScreen}get rendererLogId(){return`WebGL ${this.context.webGLVersion}`}get clearBeforeRender(){return pt("7.0.0","renderer.clearBeforeRender has been deprecated, please use renderer.background.clearBeforeRender instead."),this.background.clearBeforeRender}get useContextAlpha(){return pt("7.0.0","renderer.useContextAlpha has been deprecated, please use renderer.context.premultipliedAlpha instead."),this.context.useContextAlpha}get preserveDrawingBuffer(){return pt("7.0.0","renderer.preserveDrawingBuffer has been deprecated, we cannot truly know this unless pixi created the context"),this.context.preserveDrawingBuffer}get backgroundColor(){return pt("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color}set backgroundColor(e){pt("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color=e}get backgroundAlpha(){return pt("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha}set backgroundAlpha(e){pt("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha=e}get powerPreference(){return pt("7.0.0","renderer.powerPreference has been deprecated, we can only know this if pixi creates the context"),this.context.powerPreference}generateTexture(e,t){return this.textureGenerator.generateTexture(e,t)}};gl.extension={type:Oe.Renderer,priority:1},gl.__plugins={},gl.__systems={};let nf=gl;He.handleByMap(Oe.RendererPlugin,nf.__plugins);He.handleByMap(Oe.RendererSystem,nf.__systems);He.add(nf);class Nv extends fa{constructor(e,t){const{width:s,height:n}=t||{};super(s,n),this.items=[],this.itemDirtyIds=[];for(let r=0;r<e;r++){const o=new st;this.items.push(o),this.itemDirtyIds.push(-2)}this.length=e,this._load=null,this.baseTexture=null}initFromArray(e,t){for(let s=0;s<this.length;s++)e[s]&&(e[s].castToBaseTexture?this.addBaseTextureAt(e[s].castToBaseTexture(),s):e[s]instanceof fa?this.addResourceAt(e[s],s):this.addResourceAt(iv(e[s],t),s))}dispose(){for(let e=0,t=this.length;e<t;e++)this.items[e].destroy();this.items=null,this.itemDirtyIds=null,this._load=null}addResourceAt(e,t){if(!this.items[t])throw new Error(`Index ${t} is out of bounds`);return e.valid&&!this.valid&&this.resize(e.width,e.height),this.items[t].setResource(e),this}bind(e){if(this.baseTexture!==null)throw new Error("Only one base texture per TextureArray is allowed");super.bind(e);for(let t=0;t<this.length;t++)this.items[t].parentTextureArray=e,this.items[t].on("update",e.update,e)}unbind(e){super.unbind(e);for(let t=0;t<this.length;t++)this.items[t].parentTextureArray=null,this.items[t].off("update",e.update,e)}load(){if(this._load)return this._load;const e=this.items.map(t=>t.resource).filter(t=>t).map(t=>t.load());return this._load=Promise.all(e).then(()=>{const{realWidth:t,realHeight:s}=this.items[0];return this.resize(t,s),this.update(),Promise.resolve(this)}),this._load}}class ES extends Nv{constructor(e,t){const{width:s,height:n}=t||{};let r,o;Array.isArray(e)?(r=e,o=e.length):o=e,super(o,{width:s,height:n}),r&&this.initFromArray(r,t)}addBaseTextureAt(e,t){if(e.resource)this.addResourceAt(e.resource,t);else throw new Error("ArrayResource does not support RenderTexture");return this}bind(e){super.bind(e),e.target=oo.TEXTURE_2D_ARRAY}upload(e,t,s){const{length:n,itemDirtyIds:r,items:o}=this,{gl:a}=e;s.dirtyId<0&&a.texImage3D(a.TEXTURE_2D_ARRAY,0,s.internalFormat,this._width,this._height,n,0,t.format,s.type,null);for(let h=0;h<n;h++){const l=o[h];r[h]<l.dirtyId&&(r[h]=l.dirtyId,l.valid&&a.texSubImage3D(a.TEXTURE_2D_ARRAY,0,0,0,h,l.resource.width,l.resource.height,1,t.format,s.type,l.resource.source))}return!0}}class AS extends Sn{constructor(e){super(e)}static test(e){const{OffscreenCanvas:t}=globalThis;return t&&e instanceof t?!0:globalThis.HTMLCanvasElement&&e instanceof HTMLCanvasElement}}const Uv=class Ho extends Nv{constructor(e,t){const{width:s,height:n,autoLoad:r,linkBaseTexture:o}=t||{};if(e&&e.length!==Ho.SIDES)throw new Error(`Invalid length. Got ${e.length}, expected 6`);super(6,{width:s,height:n});for(let a=0;a<Ho.SIDES;a++)this.items[a].target=oo.TEXTURE_CUBE_MAP_POSITIVE_X+a;this.linkBaseTexture=o!==!1,e&&this.initFromArray(e,t),r!==!1&&this.load()}bind(e){super.bind(e),e.target=oo.TEXTURE_CUBE_MAP}addBaseTextureAt(e,t,s){if(s===void 0&&(s=this.linkBaseTexture),!this.items[t])throw new Error(`Index ${t} is out of bounds`);if(!this.linkBaseTexture||e.parentTextureArray||Object.keys(e._glTextures).length>0)if(e.resource)this.addResourceAt(e.resource,t);else throw new Error("CubeResource does not support copying of renderTexture.");else e.target=oo.TEXTURE_CUBE_MAP_POSITIVE_X+t,e.parentTextureArray=this.baseTexture,this.items[t]=e;return e.valid&&!this.valid&&this.resize(e.realWidth,e.realHeight),this.items[t]=e,this}upload(e,t,s){const n=this.itemDirtyIds;for(let r=0;r<Ho.SIDES;r++){const o=this.items[r];(n[r]<o.dirtyId||s.dirtyId<t.dirtyId)&&(o.valid&&o.resource?(o.resource.upload(e,o,s),n[r]=o.dirtyId):n[r]<-1&&(e.gl.texImage2D(o.target,0,s.internalFormat,t.realWidth,t.realHeight,0,t.format,s.type,null),n[r]=-1))}return!0}static test(e){return Array.isArray(e)&&e.length===Ho.SIDES}};Uv.SIDES=6;let CS=Uv;class Zr extends Sn{constructor(e,t){t=t||{};let s,n,r;typeof e=="string"?(s=Zr.EMPTY,n=e,r=!0):(s=e,n=null,r=!1),super(s),this.url=n,this.crossOrigin=t.crossOrigin??!0,this.alphaMode=typeof t.alphaMode=="number"?t.alphaMode:null,this.ownsImageBitmap=t.ownsImageBitmap??r,this._load=null,t.autoLoad!==!1&&this.load()}load(){return this._load?this._load:(this._load=new Promise(async(e,t)=>{if(this.url===null){e(this);return}try{const s=await Ve.ADAPTER.fetch(this.url,{mode:this.crossOrigin?"cors":"no-cors"});if(this.destroyed)return;const n=await s.blob();if(this.destroyed)return;const r=await createImageBitmap(n,{premultiplyAlpha:this.alphaMode===null||this.alphaMode===ui.UNPACK?"premultiply":"none"});if(this.destroyed){r.close();return}this.source=r,this.update(),e(this)}catch(s){if(this.destroyed)return;t(s),this.onError.emit(s)}}),this._load)}upload(e,t,s){return this.source instanceof ImageBitmap?(typeof this.alphaMode=="number"&&(t.alphaMode=this.alphaMode),super.upload(e,t,s)):(this.load(),!1)}dispose(){this.ownsImageBitmap&&this.source instanceof ImageBitmap&&this.source.close(),super.dispose(),this._load=null}static test(e){return!!globalThis.createImageBitmap&&typeof ImageBitmap<"u"&&(typeof e=="string"||e instanceof ImageBitmap)}static get EMPTY(){return Zr._EMPTY=Zr._EMPTY??Ve.ADAPTER.createCanvas(0,0),Zr._EMPTY}}const nd=class vl extends Sn{constructor(e,t){t=t||{},super(Ve.ADAPTER.createCanvas()),this._width=0,this._height=0,this.svg=e,this.scale=t.scale||1,this._overrideWidth=t.width,this._overrideHeight=t.height,this._resolve=null,this._crossorigin=t.crossorigin,this._load=null,t.autoLoad!==!1&&this.load()}load(){return this._load?this._load:(this._load=new Promise(e=>{if(this._resolve=()=>{this.update(),e(this)},vl.SVG_XML.test(this.svg.trim())){if(!btoa)throw new Error("Your browser doesn't support base64 conversions.");this.svg=`data:image/svg+xml;base64,${btoa(unescape(encodeURIComponent(this.svg)))}`}this._loadSvg()}),this._load)}_loadSvg(){const e=new Image;Sn.crossOrigin(e,this.svg,this._crossorigin),e.src=this.svg,e.onerror=t=>{this._resolve&&(e.onerror=null,this.onError.emit(t))},e.onload=()=>{if(!this._resolve)return;const t=e.width,s=e.height;if(!t||!s)throw new Error("The SVG image must have width and height defined (in pixels), canvas API needs them.");let n=t*this.scale,r=s*this.scale;(this._overrideWidth||this._overrideHeight)&&(n=this._overrideWidth||this._overrideHeight/s*t,r=this._overrideHeight||this._overrideWidth/t*s),n=Math.round(n),r=Math.round(r);const o=this.source;o.width=n,o.height=r,o._pixiId=`canvas_${_r()}`,o.getContext("2d").drawImage(e,0,0,t,s,0,0,n,r),this._resolve(),this._resolve=null}}static getSize(e){const t=vl.SVG_SIZE.exec(e),s={};return t&&(s[t[1]]=Math.round(parseFloat(t[3])),s[t[5]]=Math.round(parseFloat(t[7]))),s}dispose(){super.dispose(),this._resolve=null,this._crossorigin=null}static test(e,t){return t==="svg"||typeof e=="string"&&e.startsWith("data:image/svg+xml")||typeof e=="string"&&vl.SVG_XML.test(e)}};nd.SVG_XML=/^(<\?xml[^?]+\?>)?\s*(<!--[^(-->)]*-->)?\s*\<svg/m,nd.SVG_SIZE=/<svg[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i;let rd=nd;class IS extends Sn{constructor(e){super(e)}static test(e){return!!globalThis.VideoFrame&&e instanceof globalThis.VideoFrame}}const od=class ad extends Sn{constructor(e,t){if(t=t||{},!(e instanceof HTMLVideoElement)){const s=document.createElement("video");t.autoLoad!==!1&&s.setAttribute("preload","auto"),t.playsinline!==!1&&(s.setAttribute("webkit-playsinline",""),s.setAttribute("playsinline","")),t.muted===!0&&(s.setAttribute("muted",""),s.muted=!0),t.loop===!0&&s.setAttribute("loop",""),t.autoPlay!==!1&&s.setAttribute("autoplay",""),typeof e=="string"&&(e=[e]);const n=e[0].src||e[0];Sn.crossOrigin(s,n,t.crossorigin);for(let r=0;r<e.length;++r){const o=document.createElement("source");let{src:a,mime:h}=e[r];if(a=a||e[r],a.startsWith("data:"))h=a.slice(5,a.indexOf(";"));else if(!a.startsWith("blob:")){const l=a.split("?").shift().toLowerCase(),c=l.slice(l.lastIndexOf(".")+1);h=h||ad.MIME_TYPES[c]||`video/${c}`}o.src=a,h&&(o.type=h),s.appendChild(o)}e=s}super(e),this.noSubImage=!0,this._autoUpdate=!0,this._isConnectedToTicker=!1,this._updateFPS=t.updateFPS||0,this._msToNextUpdate=0,this.autoPlay=t.autoPlay!==!1,this._videoFrameRequestCallback=this._videoFrameRequestCallback.bind(this),this._videoFrameRequestCallbackHandle=null,this._load=null,this._resolve=null,this._reject=null,this._onCanPlay=this._onCanPlay.bind(this),this._onError=this._onError.bind(this),this._onPlayStart=this._onPlayStart.bind(this),this._onPlayStop=this._onPlayStop.bind(this),this._onSeeked=this._onSeeked.bind(this),t.autoLoad!==!1&&this.load()}update(e=0){if(!this.destroyed){if(this._updateFPS){const t=Ei.shared.elapsedMS*this.source.playbackRate;this._msToNextUpdate=Math.floor(this._msToNextUpdate-t)}(!this._updateFPS||this._msToNextUpdate<=0)&&(super.update(),this._msToNextUpdate=this._updateFPS?Math.floor(1e3/this._updateFPS):0)}}_videoFrameRequestCallback(){this.update(),this.destroyed?this._videoFrameRequestCallbackHandle=null:this._videoFrameRequestCallbackHandle=this.source.requestVideoFrameCallback(this._videoFrameRequestCallback)}load(){if(this._load)return this._load;const e=this.source;return(e.readyState===e.HAVE_ENOUGH_DATA||e.readyState===e.HAVE_FUTURE_DATA)&&e.width&&e.height&&(e.complete=!0),e.addEventListener("play",this._onPlayStart),e.addEventListener("pause",this._onPlayStop),e.addEventListener("seeked",this._onSeeked),this._isSourceReady()?this._onCanPlay():(e.addEventListener("canplay",this._onCanPlay),e.addEventListener("canplaythrough",this._onCanPlay),e.addEventListener("error",this._onError,!0)),this._load=new Promise((t,s)=>{this.valid?t(this):(this._resolve=t,this._reject=s,e.load())}),this._load}_onError(e){this.source.removeEventListener("error",this._onError,!0),this.onError.emit(e),this._reject&&(this._reject(e),this._reject=null,this._resolve=null)}_isSourcePlaying(){const e=this.source;return!e.paused&&!e.ended}_isSourceReady(){return this.source.readyState>2}_onPlayStart(){this.valid||this._onCanPlay(),this._configureAutoUpdate()}_onPlayStop(){this._configureAutoUpdate()}_onSeeked(){this._autoUpdate&&!this._isSourcePlaying()&&(this._msToNextUpdate=0,this.update(),this._msToNextUpdate=0)}_onCanPlay(){const e=this.source;e.removeEventListener("canplay",this._onCanPlay),e.removeEventListener("canplaythrough",this._onCanPlay);const t=this.valid;this._msToNextUpdate=0,this.update(),this._msToNextUpdate=0,!t&&this._resolve&&(this._resolve(this),this._resolve=null,this._reject=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&e.play()}dispose(){this._configureAutoUpdate();const e=this.source;e&&(e.removeEventListener("play",this._onPlayStart),e.removeEventListener("pause",this._onPlayStop),e.removeEventListener("seeked",this._onSeeked),e.removeEventListener("canplay",this._onCanPlay),e.removeEventListener("canplaythrough",this._onCanPlay),e.removeEventListener("error",this._onError,!0),e.pause(),e.src="",e.load()),super.dispose()}get autoUpdate(){return this._autoUpdate}set autoUpdate(e){e!==this._autoUpdate&&(this._autoUpdate=e,this._configureAutoUpdate())}get updateFPS(){return this._updateFPS}set updateFPS(e){e!==this._updateFPS&&(this._updateFPS=e,this._configureAutoUpdate())}_configureAutoUpdate(){this._autoUpdate&&this._isSourcePlaying()?!this._updateFPS&&this.source.requestVideoFrameCallback?(this._isConnectedToTicker&&(Ei.shared.remove(this.update,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0),this._videoFrameRequestCallbackHandle===null&&(this._videoFrameRequestCallbackHandle=this.source.requestVideoFrameCallback(this._videoFrameRequestCallback))):(this._videoFrameRequestCallbackHandle!==null&&(this.source.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker||(Ei.shared.add(this.update,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.source.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(Ei.shared.remove(this.update,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(e,t){return globalThis.HTMLVideoElement&&e instanceof HTMLVideoElement||ad.TYPES.includes(t)}};od.TYPES=["mp4","m4v","webm","ogg","ogv","h264","avi","mov"],od.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};let Vv=od;Wu.push(Zr,dv,AS,Vv,IS,rd,Ch,CS,ES);class pa{constructor(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.rect=null,this.updateID=-1}isEmpty(){return this.minX>this.maxX||this.minY>this.maxY}clear(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0}getRectangle(e){return this.minX>this.maxX||this.minY>this.maxY?lt.EMPTY:(e=e||new lt(0,0,1,1),e.x=this.minX,e.y=this.minY,e.width=this.maxX-this.minX,e.height=this.maxY-this.minY,e)}addPoint(e){this.minX=Math.min(this.minX,e.x),this.maxX=Math.max(this.maxX,e.x),this.minY=Math.min(this.minY,e.y),this.maxY=Math.max(this.maxY,e.y)}addPointMatrix(e,t){const{a:s,b:n,c:r,d:o,tx:a,ty:h}=e,l=s*t.x+r*t.y+a,c=n*t.x+o*t.y+h;this.minX=Math.min(this.minX,l),this.maxX=Math.max(this.maxX,l),this.minY=Math.min(this.minY,c),this.maxY=Math.max(this.maxY,c)}addQuad(e){let t=this.minX,s=this.minY,n=this.maxX,r=this.maxY,o=e[0],a=e[1];t=o<t?o:t,s=a<s?a:s,n=o>n?o:n,r=a>r?a:r,o=e[2],a=e[3],t=o<t?o:t,s=a<s?a:s,n=o>n?o:n,r=a>r?a:r,o=e[4],a=e[5],t=o<t?o:t,s=a<s?a:s,n=o>n?o:n,r=a>r?a:r,o=e[6],a=e[7],t=o<t?o:t,s=a<s?a:s,n=o>n?o:n,r=a>r?a:r,this.minX=t,this.minY=s,this.maxX=n,this.maxY=r}addFrame(e,t,s,n,r){this.addFrameMatrix(e.worldTransform,t,s,n,r)}addFrameMatrix(e,t,s,n,r){const o=e.a,a=e.b,h=e.c,l=e.d,c=e.tx,u=e.ty;let f=this.minX,d=this.minY,m=this.maxX,g=this.maxY,b=o*t+h*s+c,_=a*t+l*s+u;f=b<f?b:f,d=_<d?_:d,m=b>m?b:m,g=_>g?_:g,b=o*n+h*s+c,_=a*n+l*s+u,f=b<f?b:f,d=_<d?_:d,m=b>m?b:m,g=_>g?_:g,b=o*t+h*r+c,_=a*t+l*r+u,f=b<f?b:f,d=_<d?_:d,m=b>m?b:m,g=_>g?_:g,b=o*n+h*r+c,_=a*n+l*r+u,f=b<f?b:f,d=_<d?_:d,m=b>m?b:m,g=_>g?_:g,this.minX=f,this.minY=d,this.maxX=m,this.maxY=g}addVertexData(e,t,s){let n=this.minX,r=this.minY,o=this.maxX,a=this.maxY;for(let h=t;h<s;h+=2){const l=e[h],c=e[h+1];n=l<n?l:n,r=c<r?c:r,o=l>o?l:o,a=c>a?c:a}this.minX=n,this.minY=r,this.maxX=o,this.maxY=a}addVertices(e,t,s,n){this.addVerticesMatrix(e.worldTransform,t,s,n)}addVerticesMatrix(e,t,s,n,r=0,o=r){const a=e.a,h=e.b,l=e.c,c=e.d,u=e.tx,f=e.ty;let d=this.minX,m=this.minY,g=this.maxX,b=this.maxY;for(let _=s;_<n;_+=2){const M=t[_],v=t[_+1],S=a*M+l*v+u,y=c*v+h*M+f;d=Math.min(d,S-r),g=Math.max(g,S+r),m=Math.min(m,y-o),b=Math.max(b,y+o)}this.minX=d,this.minY=m,this.maxX=g,this.maxY=b}addBounds(e){const t=this.minX,s=this.minY,n=this.maxX,r=this.maxY;this.minX=e.minX<t?e.minX:t,this.minY=e.minY<s?e.minY:s,this.maxX=e.maxX>n?e.maxX:n,this.maxY=e.maxY>r?e.maxY:r}addBoundsMask(e,t){const s=e.minX>t.minX?e.minX:t.minX,n=e.minY>t.minY?e.minY:t.minY,r=e.maxX<t.maxX?e.maxX:t.maxX,o=e.maxY<t.maxY?e.maxY:t.maxY;if(s<=r&&n<=o){const a=this.minX,h=this.minY,l=this.maxX,c=this.maxY;this.minX=s<a?s:a,this.minY=n<h?n:h,this.maxX=r>l?r:l,this.maxY=o>c?o:c}}addBoundsMatrix(e,t){this.addFrameMatrix(t,e.minX,e.minY,e.maxX,e.maxY)}addBoundsArea(e,t){const s=e.minX>t.x?e.minX:t.x,n=e.minY>t.y?e.minY:t.y,r=e.maxX<t.x+t.width?e.maxX:t.x+t.width,o=e.maxY<t.y+t.height?e.maxY:t.y+t.height;if(s<=r&&n<=o){const a=this.minX,h=this.minY,l=this.maxX,c=this.maxY;this.minX=s<a?s:a,this.minY=n<h?n:h,this.maxX=r>l?r:l,this.maxY=o>c?o:c}}pad(e=0,t=e){this.isEmpty()||(this.minX-=e,this.maxX+=e,this.minY-=t,this.maxY+=t)}addFramePad(e,t,s,n,r,o){e-=r,t-=o,s+=r,n+=o,this.minX=this.minX<e?this.minX:e,this.maxX=this.maxX>s?this.maxX:s,this.minY=this.minY<t?this.minY:t,this.maxY=this.maxY>n?this.maxY:n}}class Wt extends Sa{constructor(){super(),this.tempDisplayObjectParent=null,this.transform=new ef,this.alpha=1,this.visible=!0,this.renderable=!0,this.cullable=!1,this.cullArea=null,this.parent=null,this.worldAlpha=1,this._lastSortedIndex=0,this._zIndex=0,this.filterArea=null,this.filters=null,this._enabledFilters=null,this._bounds=new pa,this._localBounds=null,this._boundsID=0,this._boundsRect=null,this._localBoundsRect=null,this._mask=null,this._maskRefCount=0,this._destroyed=!1,this.isSprite=!1,this.isMask=!1}static mixin(e){const t=Object.keys(e);for(let s=0;s<t.length;++s){const n=t[s];Object.defineProperty(Wt.prototype,n,Object.getOwnPropertyDescriptor(e,n))}}get destroyed(){return this._destroyed}_recursivePostUpdateTransform(){this.parent?(this.parent._recursivePostUpdateTransform(),this.transform.updateTransform(this.parent.transform)):this.transform.updateTransform(this._tempDisplayObjectParent.transform)}updateTransform(){this._boundsID++,this.transform.updateTransform(this.parent.transform),this.worldAlpha=this.alpha*this.parent.worldAlpha}getBounds(e,t){return e||(this.parent?(this._recursivePostUpdateTransform(),this.updateTransform()):(this.parent=this._tempDisplayObjectParent,this.updateTransform(),this.parent=null)),this._bounds.updateID!==this._boundsID&&(this.calculateBounds(),this._bounds.updateID=this._boundsID),t||(this._boundsRect||(this._boundsRect=new lt),t=this._boundsRect),this._bounds.getRectangle(t)}getLocalBounds(e){e||(this._localBoundsRect||(this._localBoundsRect=new lt),e=this._localBoundsRect),this._localBounds||(this._localBounds=new pa);const t=this.transform,s=this.parent;this.parent=null,this._tempDisplayObjectParent.worldAlpha=(s==null?void 0:s.worldAlpha)??1,this.transform=this._tempDisplayObjectParent.transform;const n=this._bounds,r=this._boundsID;this._bounds=this._localBounds;const o=this.getBounds(!1,e);return this.parent=s,this.transform=t,this._bounds=n,this._bounds.updateID+=this._boundsID-r,o}toGlobal(e,t,s=!1){return s||(this._recursivePostUpdateTransform(),this.parent?this.displayObjectUpdateTransform():(this.parent=this._tempDisplayObjectParent,this.displayObjectUpdateTransform(),this.parent=null)),this.worldTransform.apply(e,t)}toLocal(e,t,s,n){return t&&(e=t.toGlobal(e,s,n)),n||(this._recursivePostUpdateTransform(),this.parent?this.displayObjectUpdateTransform():(this.parent=this._tempDisplayObjectParent,this.displayObjectUpdateTransform(),this.parent=null)),this.worldTransform.applyInverse(e,s)}setParent(e){if(!e||!e.addChild)throw new Error("setParent: Argument must be a Container");return e.addChild(this),e}removeFromParent(){var e;(e=this.parent)==null||e.removeChild(this)}setTransform(e=0,t=0,s=1,n=1,r=0,o=0,a=0,h=0,l=0){return this.position.x=e,this.position.y=t,this.scale.x=s||1,this.scale.y=n||1,this.rotation=r,this.skew.x=o,this.skew.y=a,this.pivot.x=h,this.pivot.y=l,this}destroy(e){this.removeFromParent(),this._destroyed=!0,this.transform=null,this.parent=null,this._bounds=null,this.mask=null,this.cullArea=null,this.filters=null,this.filterArea=null,this.hitArea=null,this.eventMode="auto",this.interactiveChildren=!1,this.emit("destroyed"),this.removeAllListeners()}get _tempDisplayObjectParent(){return this.tempDisplayObjectParent===null&&(this.tempDisplayObjectParent=new RS),this.tempDisplayObjectParent}enableTempParent(){const e=this.parent;return this.parent=this._tempDisplayObjectParent,e}disableTempParent(e){this.parent=e}get x(){return this.position.x}set x(e){this.transform.position.x=e}get y(){return this.position.y}set y(e){this.transform.position.y=e}get worldTransform(){return this.transform.worldTransform}get localTransform(){return this.transform.localTransform}get position(){return this.transform.position}set position(e){this.transform.position.copyFrom(e)}get scale(){return this.transform.scale}set scale(e){this.transform.scale.copyFrom(e)}get pivot(){return this.transform.pivot}set pivot(e){this.transform.pivot.copyFrom(e)}get skew(){return this.transform.skew}set skew(e){this.transform.skew.copyFrom(e)}get rotation(){return this.transform.rotation}set rotation(e){this.transform.rotation=e}get angle(){return this.transform.rotation*S_}set angle(e){this.transform.rotation=e*T_}get zIndex(){return this._zIndex}set zIndex(e){this._zIndex!==e&&(this._zIndex=e,this.parent&&(this.parent.sortDirty=!0))}get worldVisible(){let e=this;do{if(!e.visible)return!1;e=e.parent}while(e);return!0}get mask(){return this._mask}set mask(e){if(this._mask!==e){if(this._mask){const t=this._mask.isMaskData?this._mask.maskObject:this._mask;t&&(t._maskRefCount--,t._maskRefCount===0&&(t.renderable=!0,t.isMask=!1))}if(this._mask=e,this._mask){const t=this._mask.isMaskData?this._mask.maskObject:this._mask;t&&(t._maskRefCount===0&&(t.renderable=!1,t.isMask=!0),t._maskRefCount++)}}}}class RS extends Wt{constructor(){super(...arguments),this.sortDirty=null}}Wt.prototype.displayObjectUpdateTransform=Wt.prototype.updateTransform;const PS=new Vt;function kS(i,e){return i.zIndex===e.zIndex?i._lastSortedIndex-e._lastSortedIndex:i.zIndex-e.zIndex}const Xv=class ld extends Wt{constructor(){super(),this.children=[],this.sortableChildren=ld.defaultSortableChildren,this.sortDirty=!1}onChildrenChange(e){}addChild(...e){if(e.length>1)for(let t=0;t<e.length;t++)this.addChild(e[t]);else{const t=e[0];t.parent&&t.parent.removeChild(t),t.parent=this,this.sortDirty=!0,t.transform._parentID=-1,this.children.push(t),this._boundsID++,this.onChildrenChange(this.children.length-1),this.emit("childAdded",t,this,this.children.length-1),t.emit("added",this)}return e[0]}addChildAt(e,t){if(t<0||t>this.children.length)throw new Error(`${e}addChildAt: The index ${t} supplied is out of bounds ${this.children.length}`);return e.parent&&e.parent.removeChild(e),e.parent=this,this.sortDirty=!0,e.transform._parentID=-1,this.children.splice(t,0,e),this._boundsID++,this.onChildrenChange(t),e.emit("added",this),this.emit("childAdded",e,this,t),e}swapChildren(e,t){if(e===t)return;const s=this.getChildIndex(e),n=this.getChildIndex(t);this.children[s]=t,this.children[n]=e,this.onChildrenChange(s<n?s:n)}getChildIndex(e){const t=this.children.indexOf(e);if(t===-1)throw new Error("The supplied DisplayObject must be a child of the caller");return t}setChildIndex(e,t){if(t<0||t>=this.children.length)throw new Error(`The index ${t} supplied is out of bounds ${this.children.length}`);const s=this.getChildIndex(e);ao(this.children,s,1),this.children.splice(t,0,e),this.onChildrenChange(t)}getChildAt(e){if(e<0||e>=this.children.length)throw new Error(`getChildAt: Index (${e}) does not exist.`);return this.children[e]}removeChild(...e){if(e.length>1)for(let t=0;t<e.length;t++)this.removeChild(e[t]);else{const t=e[0],s=this.children.indexOf(t);if(s===-1)return null;t.parent=null,t.transform._parentID=-1,ao(this.children,s,1),this._boundsID++,this.onChildrenChange(s),t.emit("removed",this),this.emit("childRemoved",t,this,s)}return e[0]}removeChildAt(e){const t=this.getChildAt(e);return t.parent=null,t.transform._parentID=-1,ao(this.children,e,1),this._boundsID++,this.onChildrenChange(e),t.emit("removed",this),this.emit("childRemoved",t,this,e),t}removeChildren(e=0,t=this.children.length){const s=e,n=t,r=n-s;let o;if(r>0&&r<=n){o=this.children.splice(s,r);for(let a=0;a<o.length;++a)o[a].parent=null,o[a].transform&&(o[a].transform._parentID=-1);this._boundsID++,this.onChildrenChange(e);for(let a=0;a<o.length;++a)o[a].emit("removed",this),this.emit("childRemoved",o[a],this,a);return o}else if(r===0&&this.children.length===0)return[];throw new RangeError("removeChildren: numeric values are outside the acceptable range.")}sortChildren(){let e=!1;for(let t=0,s=this.children.length;t<s;++t){const n=this.children[t];n._lastSortedIndex=t,!e&&n.zIndex!==0&&(e=!0)}e&&this.children.length>1&&this.children.sort(kS),this.sortDirty=!1}updateTransform(){this.sortableChildren&&this.sortDirty&&this.sortChildren(),this._boundsID++,this.transform.updateTransform(this.parent.transform),this.worldAlpha=this.alpha*this.parent.worldAlpha;for(let e=0,t=this.children.length;e<t;++e){const s=this.children[e];s.visible&&s.updateTransform()}}calculateBounds(){this._bounds.clear(),this._calculateBounds();for(let e=0;e<this.children.length;e++){const t=this.children[e];if(!(!t.visible||!t.renderable))if(t.calculateBounds(),t._mask){const s=t._mask.isMaskData?t._mask.maskObject:t._mask;s?(s.calculateBounds(),this._bounds.addBoundsMask(t._bounds,s._bounds)):this._bounds.addBounds(t._bounds)}else t.filterArea?this._bounds.addBoundsArea(t._bounds,t.filterArea):this._bounds.addBounds(t._bounds)}this._bounds.updateID=this._boundsID}getLocalBounds(e,t=!1){const s=super.getLocalBounds(e);if(!t)for(let n=0,r=this.children.length;n<r;++n){const o=this.children[n];o.visible&&o.updateTransform()}return s}_calculateBounds(){}_renderWithCulling(e){const t=e.renderTexture.sourceFrame;if(!(t.width>0&&t.height>0))return;let s,n;this.cullArea?(s=this.cullArea,n=this.worldTransform):this._render!==ld.prototype._render&&(s=this.getBounds(!0));const r=e.projection.transform;if(r&&(n?(n=PS.copyFrom(n),n.prepend(r)):n=r),s&&t.intersects(s,n))this._render(e);else if(this.cullArea)return;for(let o=0,a=this.children.length;o<a;++o){const h=this.children[o],l=h.cullable;h.cullable=l||!this.cullArea,h.render(e),h.cullable=l}}render(e){var t;if(!(!this.visible||this.worldAlpha<=0||!this.renderable))if(this._mask||(t=this.filters)!=null&&t.length)this.renderAdvanced(e);else if(this.cullable)this._renderWithCulling(e);else{this._render(e);for(let s=0,n=this.children.length;s<n;++s)this.children[s].render(e)}}renderAdvanced(e){var r,o,a;const t=this.filters,s=this._mask;if(t){this._enabledFilters||(this._enabledFilters=[]),this._enabledFilters.length=0;for(let h=0;h<t.length;h++)t[h].enabled&&this._enabledFilters.push(t[h])}const n=t&&((r=this._enabledFilters)==null?void 0:r.length)||s&&(!s.isMaskData||s.enabled&&(s.autoDetect||s.type!==si.NONE));if(n&&e.batch.flush(),t&&((o=this._enabledFilters)!=null&&o.length)&&e.filter.push(this,this._enabledFilters),s&&e.mask.push(this,this._mask),this.cullable)this._renderWithCulling(e);else{this._render(e);for(let h=0,l=this.children.length;h<l;++h)this.children[h].render(e)}n&&e.batch.flush(),s&&e.mask.pop(this),t&&((a=this._enabledFilters)!=null&&a.length)&&e.filter.pop()}_render(e){}destroy(e){super.destroy(),this.sortDirty=!1;const t=typeof e=="boolean"?e:e==null?void 0:e.children,s=this.removeChildren(0,this.children.length);if(t)for(let n=0;n<s.length;++n)s[n].destroy(e)}get width(){return this.scale.x*this.getLocalBounds().width}set width(e){const t=this.getLocalBounds().width;t!==0?this.scale.x=e/t:this.scale.x=1,this._width=e}get height(){return this.scale.y*this.getLocalBounds().height}set height(e){const t=this.getLocalBounds().height;t!==0?this.scale.y=e/t:this.scale.y=1,this._height=e}};Xv.defaultSortableChildren=!1;let gi=Xv;gi.prototype.containerUpdateTransform=gi.prototype.updateTransform;Object.defineProperties(Ve,{SORTABLE_CHILDREN:{get(){return gi.defaultSortableChildren},set(i){pt("7.1.0","settings.SORTABLE_CHILDREN is deprecated, use Container.defaultSortableChildren"),gi.defaultSortableChildren=i}}});const Bo=new bt,FS=new Uint16Array([0,1,2,0,2,3]);class Qn extends gi{constructor(e){super(),this._anchor=new fn(this._onAnchorUpdate,this,e?e.defaultAnchor.x:0,e?e.defaultAnchor.y:0),this._texture=null,this._width=0,this._height=0,this._tintColor=new At(16777215),this._tintRGB=null,this.tint=16777215,this.blendMode=Qe.NORMAL,this._cachedTint=16777215,this.uvs=null,this.texture=e||et.EMPTY,this.vertexData=new Float32Array(8),this.vertexTrimmedData=null,this._transformID=-1,this._textureID=-1,this._transformTrimmedID=-1,this._textureTrimmedID=-1,this.indices=FS,this.pluginName="batch",this.isSprite=!0,this._roundPixels=Ve.ROUND_PIXELS}_onTextureUpdate(){this._textureID=-1,this._textureTrimmedID=-1,this._cachedTint=16777215,this._width&&(this.scale.x=Gn(this.scale.x)*this._width/this._texture.orig.width),this._height&&(this.scale.y=Gn(this.scale.y)*this._height/this._texture.orig.height)}_onAnchorUpdate(){this._transformID=-1,this._transformTrimmedID=-1}calculateVertices(){const e=this._texture;if(this._transformID===this.transform._worldID&&this._textureID===e._updateID)return;this._textureID!==e._updateID&&(this.uvs=this._texture._uvs.uvsFloat32),this._transformID=this.transform._worldID,this._textureID=e._updateID;const t=this.transform.worldTransform,s=t.a,n=t.b,r=t.c,o=t.d,a=t.tx,h=t.ty,l=this.vertexData,c=e.trim,u=e.orig,f=this._anchor;let d=0,m=0,g=0,b=0;if(c?(m=c.x-f._x*u.width,d=m+c.width,b=c.y-f._y*u.height,g=b+c.height):(m=-f._x*u.width,d=m+u.width,b=-f._y*u.height,g=b+u.height),l[0]=s*m+r*b+a,l[1]=o*b+n*m+h,l[2]=s*d+r*b+a,l[3]=o*b+n*d+h,l[4]=s*d+r*g+a,l[5]=o*g+n*d+h,l[6]=s*m+r*g+a,l[7]=o*g+n*m+h,this._roundPixels){const _=Ve.RESOLUTION;for(let M=0;M<l.length;++M)l[M]=Math.round(l[M]*_)/_}}calculateTrimmedVertices(){if(!this.vertexTrimmedData)this.vertexTrimmedData=new Float32Array(8);else if(this._transformTrimmedID===this.transform._worldID&&this._textureTrimmedID===this._texture._updateID)return;this._transformTrimmedID=this.transform._worldID,this._textureTrimmedID=this._texture._updateID;const e=this._texture,t=this.vertexTrimmedData,s=e.orig,n=this._anchor,r=this.transform.worldTransform,o=r.a,a=r.b,h=r.c,l=r.d,c=r.tx,u=r.ty,f=-n._x*s.width,d=f+s.width,m=-n._y*s.height,g=m+s.height;if(t[0]=o*f+h*m+c,t[1]=l*m+a*f+u,t[2]=o*d+h*m+c,t[3]=l*m+a*d+u,t[4]=o*d+h*g+c,t[5]=l*g+a*d+u,t[6]=o*f+h*g+c,t[7]=l*g+a*f+u,this._roundPixels){const b=Ve.RESOLUTION;for(let _=0;_<t.length;++_)t[_]=Math.round(t[_]*b)/b}}_render(e){this.calculateVertices(),e.batch.setObjectRenderer(e.plugins[this.pluginName]),e.plugins[this.pluginName].render(this)}_calculateBounds(){const e=this._texture.trim,t=this._texture.orig;!e||e.width===t.width&&e.height===t.height?(this.calculateVertices(),this._bounds.addQuad(this.vertexData)):(this.calculateTrimmedVertices(),this._bounds.addQuad(this.vertexTrimmedData))}getLocalBounds(e){return this.children.length===0?(this._localBounds||(this._localBounds=new pa),this._localBounds.minX=this._texture.orig.width*-this._anchor._x,this._localBounds.minY=this._texture.orig.height*-this._anchor._y,this._localBounds.maxX=this._texture.orig.width*(1-this._anchor._x),this._localBounds.maxY=this._texture.orig.height*(1-this._anchor._y),e||(this._localBoundsRect||(this._localBoundsRect=new lt),e=this._localBoundsRect),this._localBounds.getRectangle(e)):super.getLocalBounds.call(this,e)}containsPoint(e){this.worldTransform.applyInverse(e,Bo);const t=this._texture.orig.width,s=this._texture.orig.height,n=-t*this.anchor.x;let r=0;return Bo.x>=n&&Bo.x<n+t&&(r=-s*this.anchor.y,Bo.y>=r&&Bo.y<r+s)}destroy(e){if(super.destroy(e),this._texture.off("update",this._onTextureUpdate,this),this._anchor=null,typeof e=="boolean"?e:e==null?void 0:e.texture){const t=typeof e=="boolean"?e:e==null?void 0:e.baseTexture;this._texture.destroy(!!t)}this._texture=null}static from(e,t){const s=e instanceof et?e:et.from(e,t);return new Qn(s)}set roundPixels(e){this._roundPixels!==e&&(this._transformID=-1,this._transformTrimmedID=-1),this._roundPixels=e}get roundPixels(){return this._roundPixels}get width(){return Math.abs(this.scale.x)*this._texture.orig.width}set width(e){const t=Gn(this.scale.x)||1;this.scale.x=t*e/this._texture.orig.width,this._width=e}get height(){return Math.abs(this.scale.y)*this._texture.orig.height}set height(e){const t=Gn(this.scale.y)||1;this.scale.y=t*e/this._texture.orig.height,this._height=e}get anchor(){return this._anchor}set anchor(e){this._anchor.copyFrom(e)}get tint(){return this._tintColor.value}set tint(e){this._tintColor.setValue(e),this._tintRGB=this._tintColor.toLittleEndianNumber()}get tintValue(){return this._tintColor.toNumber()}get texture(){return this._texture}set texture(e){this._texture!==e&&(this._texture&&this._texture.off("update",this._onTextureUpdate,this),this._texture=e||et.EMPTY,this._cachedTint=16777215,this._textureID=-1,this._textureTrimmedID=-1,e&&(e.baseTexture.valid?this._onTextureUpdate():e.once("update",this._onTextureUpdate,this)))}}const Yv=new Vt;Wt.prototype._cacheAsBitmap=!1;Wt.prototype._cacheData=null;Wt.prototype._cacheAsBitmapResolution=null;Wt.prototype._cacheAsBitmapMultisample=null;class OS{constructor(){this.textureCacheId=null,this.originalRender=null,this.originalRenderCanvas=null,this.originalCalculateBounds=null,this.originalGetLocalBounds=null,this.originalUpdateTransform=null,this.originalDestroy=null,this.originalMask=null,this.originalFilterArea=null,this.originalContainsPoint=null,this.sprite=null}}Object.defineProperties(Wt.prototype,{cacheAsBitmapResolution:{get(){return this._cacheAsBitmapResolution},set(i){i!==this._cacheAsBitmapResolution&&(this._cacheAsBitmapResolution=i,this.cacheAsBitmap&&(this.cacheAsBitmap=!1,this.cacheAsBitmap=!0))}},cacheAsBitmapMultisample:{get(){return this._cacheAsBitmapMultisample},set(i){i!==this._cacheAsBitmapMultisample&&(this._cacheAsBitmapMultisample=i,this.cacheAsBitmap&&(this.cacheAsBitmap=!1,this.cacheAsBitmap=!0))}},cacheAsBitmap:{get(){return this._cacheAsBitmap},set(i){if(this._cacheAsBitmap===i)return;this._cacheAsBitmap=i;let e;i?(this._cacheData||(this._cacheData=new OS),e=this._cacheData,e.originalRender=this.render,e.originalRenderCanvas=this.renderCanvas,e.originalUpdateTransform=this.updateTransform,e.originalCalculateBounds=this.calculateBounds,e.originalGetLocalBounds=this.getLocalBounds,e.originalDestroy=this.destroy,e.originalContainsPoint=this.containsPoint,e.originalMask=this._mask,e.originalFilterArea=this.filterArea,this.render=this._renderCached,this.renderCanvas=this._renderCachedCanvas,this.destroy=this._cacheAsBitmapDestroy):(e=this._cacheData,e.sprite&&this._destroyCachedDisplayObject(),this.render=e.originalRender,this.renderCanvas=e.originalRenderCanvas,this.calculateBounds=e.originalCalculateBounds,this.getLocalBounds=e.originalGetLocalBounds,this.destroy=e.originalDestroy,this.updateTransform=e.originalUpdateTransform,this.containsPoint=e.originalContainsPoint,this._mask=e.originalMask,this.filterArea=e.originalFilterArea)}}});Wt.prototype._renderCached=function(i){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObject(i),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._render(i))};Wt.prototype._initCachedDisplayObject=function(i){var f,d;if((f=this._cacheData)!=null&&f.sprite)return;const e=this.alpha;this.alpha=1,i.batch.flush();const t=this.getLocalBounds(new lt,!0);if((d=this.filters)!=null&&d.length){const m=this.filters[0].padding;t.pad(m)}const s=this.cacheAsBitmapResolution||i.resolution;t.ceil(s),t.width=Math.max(t.width,1/s),t.height=Math.max(t.height,1/s);const n=i.renderTexture.current,r=i.renderTexture.sourceFrame.clone(),o=i.renderTexture.destinationFrame.clone(),a=i.projection.transform,h=Ir.create({width:t.width,height:t.height,resolution:s,multisample:this.cacheAsBitmapMultisample??i.multisample}),l=`cacheAsBitmap_${_r()}`;this._cacheData.textureCacheId=l,st.addToCache(h.baseTexture,l),et.addToCache(h,l);const c=this.transform.localTransform.copyTo(Yv).invert().translate(-t.x,-t.y);this.render=this._cacheData.originalRender,i.render(this,{renderTexture:h,clear:!0,transform:c,skipUpdateTransform:!1}),i.framebuffer.blit(),i.projection.transform=a,i.renderTexture.bind(n,r,o),this.render=this._renderCached,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null,this.alpha=e;const u=new Qn(h);u.transform.worldTransform=this.transform.worldTransform,u.anchor.x=-(t.x/t.width),u.anchor.y=-(t.y/t.height),u.alpha=e,u._bounds=this._bounds,this._cacheData.sprite=u,this.transform._parentID=-1,this.parent?this.updateTransform():(this.enableTempParent(),this.updateTransform(),this.disableTempParent(null)),this.containsPoint=u.containsPoint.bind(u)};Wt.prototype._renderCachedCanvas=function(i){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObjectCanvas(i),this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._renderCanvas(i))};Wt.prototype._initCachedDisplayObjectCanvas=function(i){var c;if((c=this._cacheData)!=null&&c.sprite)return;const e=this.getLocalBounds(new lt,!0),t=this.alpha;this.alpha=1;const s=i.canvasContext.activeContext,n=i._projTransform,r=this.cacheAsBitmapResolution||i.resolution;e.ceil(r),e.width=Math.max(e.width,1/r),e.height=Math.max(e.height,1/r);const o=Ir.create({width:e.width,height:e.height,resolution:r}),a=`cacheAsBitmap_${_r()}`;this._cacheData.textureCacheId=a,st.addToCache(o.baseTexture,a),et.addToCache(o,a);const h=Yv;this.transform.localTransform.copyTo(h),h.invert(),h.tx-=e.x,h.ty-=e.y,this.renderCanvas=this._cacheData.originalRenderCanvas,i.render(this,{renderTexture:o,clear:!0,transform:h,skipUpdateTransform:!1}),i.canvasContext.activeContext=s,i._projTransform=n,this.renderCanvas=this._renderCachedCanvas,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null,this.alpha=t;const l=new Qn(o);l.transform.worldTransform=this.transform.worldTransform,l.anchor.x=-(e.x/e.width),l.anchor.y=-(e.y/e.height),l.alpha=t,l._bounds=this._bounds,this._cacheData.sprite=l,this.transform._parentID=-1,this.parent?this.updateTransform():(this.parent=i._tempDisplayObjectParent,this.updateTransform(),this.parent=null),this.containsPoint=l.containsPoint.bind(l)};Wt.prototype._calculateCachedBounds=function(){this._bounds.clear(),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite._calculateBounds(),this._bounds.updateID=this._boundsID};Wt.prototype._getCachedLocalBounds=function(){return this._cacheData.sprite.getLocalBounds(null)};Wt.prototype._destroyCachedDisplayObject=function(){this._cacheData.sprite._texture.destroy(!0),this._cacheData.sprite=null,st.removeFromCache(this._cacheData.textureCacheId),et.removeFromCache(this._cacheData.textureCacheId),this._cacheData.textureCacheId=null};Wt.prototype._cacheAsBitmapDestroy=function(i){this.cacheAsBitmap=!1,this.destroy(i)};Wt.prototype.name=null;gi.prototype.getChildByName=function(i,e){for(let t=0,s=this.children.length;t<s;t++)if(this.children[t].name===i)return this.children[t];if(e)for(let t=0,s=this.children.length;t<s;t++){const n=this.children[t];if(!n.getChildByName)continue;const r=n.getChildByName(i,!0);if(r)return r}return null};Wt.prototype.getGlobalPosition=function(i=new bt,e=!1){return this.parent?this.parent.toGlobal(this.position,i,e):(i.x=this.position.x,i.y=this.position.y),i};var BS=`varying vec2 vTextureCoord;
|
||
|
||
uniform sampler2D uSampler;
|
||
uniform float uAlpha;
|
||
|
||
void main(void)
|
||
{
|
||
gl_FragColor = texture2D(uSampler, vTextureCoord) * uAlpha;
|
||
}
|
||
`;class LS extends Mi{constructor(e=1){super(TS,BS,{uAlpha:1}),this.alpha=e}get alpha(){return this.uniforms.uAlpha}set alpha(e){this.uniforms.uAlpha=e}}const DS={5:[.153388,.221461,.250301],7:[.071303,.131514,.189879,.214607],9:[.028532,.067234,.124009,.179044,.20236],11:[.0093,.028002,.065984,.121703,.175713,.198596],13:[.002406,.009255,.027867,.065666,.121117,.174868,.197641],15:[489e-6,.002403,.009246,.02784,.065602,.120999,.174697,.197448]},NS=["varying vec2 vBlurTexCoords[%size%];","uniform sampler2D uSampler;","void main(void)","{"," gl_FragColor = vec4(0.0);"," %blur%","}"].join(`
|
||
`);function US(i){const e=DS[i],t=e.length;let s=NS,n="";const r="gl_FragColor += texture2D(uSampler, vBlurTexCoords[%index%]) * %value%;";let o;for(let a=0;a<i;a++){let h=r.replace("%index%",a.toString());o=a,a>=t&&(o=i-a-1),h=h.replace("%value%",e[o].toString()),n+=h,n+=`
|
||
`}return s=s.replace("%blur%",n),s=s.replace("%size%",i.toString()),s}const VS=`
|
||
attribute vec2 aVertexPosition;
|
||
|
||
uniform mat3 projectionMatrix;
|
||
|
||
uniform float strength;
|
||
|
||
varying vec2 vBlurTexCoords[%size%];
|
||
|
||
uniform vec4 inputSize;
|
||
uniform vec4 outputFrame;
|
||
|
||
vec4 filterVertexPosition( void )
|
||
{
|
||
vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;
|
||
|
||
return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);
|
||
}
|
||
|
||
vec2 filterTextureCoord( void )
|
||
{
|
||
return aVertexPosition * (outputFrame.zw * inputSize.zw);
|
||
}
|
||
|
||
void main(void)
|
||
{
|
||
gl_Position = filterVertexPosition();
|
||
|
||
vec2 textureCoord = filterTextureCoord();
|
||
%blur%
|
||
}`;function XS(i,e){const t=Math.ceil(i/2);let s=VS,n="",r;e?r="vBlurTexCoords[%index%] = textureCoord + vec2(%sampleIndex% * strength, 0.0);":r="vBlurTexCoords[%index%] = textureCoord + vec2(0.0, %sampleIndex% * strength);";for(let o=0;o<i;o++){let a=r.replace("%index%",o.toString());a=a.replace("%sampleIndex%",`${o-(t-1)}.0`),n+=a,n+=`
|
||
`}return s=s.replace("%blur%",n),s=s.replace("%size%",i.toString()),s}class hd extends Mi{constructor(e,t=8,s=4,n=Mi.defaultResolution,r=5){const o=XS(r,e),a=US(r);super(o,a),this.horizontal=e,this.resolution=n,this._quality=0,this.quality=s,this.blur=t}apply(e,t,s,n){if(s?this.horizontal?this.uniforms.strength=1/s.width*(s.width/t.width):this.uniforms.strength=1/s.height*(s.height/t.height):this.horizontal?this.uniforms.strength=1/e.renderer.width*(e.renderer.width/t.width):this.uniforms.strength=1/e.renderer.height*(e.renderer.height/t.height),this.uniforms.strength*=this.strength,this.uniforms.strength/=this.passes,this.passes===1)e.applyFilter(this,t,s,n);else{const r=e.getFilterTexture(),o=e.renderer;let a=t,h=r;this.state.blend=!1,e.applyFilter(this,a,h,Ls.CLEAR);for(let l=1;l<this.passes-1;l++){e.bindAndClear(a,Ls.BLIT),this.uniforms.uSampler=h;const c=h;h=a,a=c,o.shader.bind(this),o.geometry.draw(5)}this.state.blend=!0,e.applyFilter(this,h,s,n),e.returnFilterTexture(r)}}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}}class YS extends Mi{constructor(e=8,t=4,s=Mi.defaultResolution,n=5){super(),this._repeatEdgePixels=!1,this.blurXFilter=new hd(!0,e,t,s,n),this.blurYFilter=new hd(!1,e,t,s,n),this.resolution=s,this.quality=t,this.blur=e,this.repeatEdgePixels=!1}apply(e,t,s,n){const r=Math.abs(this.blurXFilter.strength),o=Math.abs(this.blurYFilter.strength);if(r&&o){const a=e.getFilterTexture();this.blurXFilter.apply(e,t,a,Ls.CLEAR),this.blurYFilter.apply(e,a,s,n),e.returnFilterTexture(a)}else o?this.blurYFilter.apply(e,t,s,n):this.blurXFilter.apply(e,t,s,n)}updatePadding(){this._repeatEdgePixels?this.padding=0:this.padding=Math.max(Math.abs(this.blurXFilter.strength),Math.abs(this.blurYFilter.strength))*2}get blur(){return this.blurXFilter.blur}set blur(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 blurX(){return this.blurXFilter.blur}set blurX(e){this.blurXFilter.blur=e,this.updatePadding()}get blurY(){return this.blurYFilter.blur}set blurY(e){this.blurYFilter.blur=e,this.updatePadding()}get blendMode(){return this.blurYFilter.blendMode}set blendMode(e){this.blurYFilter.blendMode=e}get repeatEdgePixels(){return this._repeatEdgePixels}set repeatEdgePixels(e){this._repeatEdgePixels=e,this.updatePadding()}}var $S=`varying vec2 vTextureCoord;
|
||
uniform sampler2D uSampler;
|
||
uniform float m[20];
|
||
uniform float uAlpha;
|
||
|
||
void main(void)
|
||
{
|
||
vec4 c = texture2D(uSampler, vTextureCoord);
|
||
|
||
if (uAlpha == 0.0) {
|
||
gl_FragColor = c;
|
||
return;
|
||
}
|
||
|
||
// Un-premultiply alpha before applying the color matrix. See issue #3539.
|
||
if (c.a > 0.0) {
|
||
c.rgb /= c.a;
|
||
}
|
||
|
||
vec4 result;
|
||
|
||
result.r = (m[0] * c.r);
|
||
result.r += (m[1] * c.g);
|
||
result.r += (m[2] * c.b);
|
||
result.r += (m[3] * c.a);
|
||
result.r += m[4];
|
||
|
||
result.g = (m[5] * c.r);
|
||
result.g += (m[6] * c.g);
|
||
result.g += (m[7] * c.b);
|
||
result.g += (m[8] * c.a);
|
||
result.g += m[9];
|
||
|
||
result.b = (m[10] * c.r);
|
||
result.b += (m[11] * c.g);
|
||
result.b += (m[12] * c.b);
|
||
result.b += (m[13] * c.a);
|
||
result.b += m[14];
|
||
|
||
result.a = (m[15] * c.r);
|
||
result.a += (m[16] * c.g);
|
||
result.a += (m[17] * c.b);
|
||
result.a += (m[18] * c.a);
|
||
result.a += m[19];
|
||
|
||
vec3 rgb = mix(c.rgb, result.rgb, uAlpha);
|
||
|
||
// Premultiply alpha again.
|
||
rgb *= result.a;
|
||
|
||
gl_FragColor = vec4(rgb, result.a);
|
||
}
|
||
`;class cd extends Mi{constructor(){const e={m:new Float32Array([1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0]),uAlpha:1};super(Ov,$S,e),this.alpha=1}_loadMatrix(e,t=!1){let s=e;t&&(this._multiply(s,this.uniforms.m,e),s=this._colorMatrix(s)),this.uniforms.m=s}_multiply(e,t,s){return e[0]=t[0]*s[0]+t[1]*s[5]+t[2]*s[10]+t[3]*s[15],e[1]=t[0]*s[1]+t[1]*s[6]+t[2]*s[11]+t[3]*s[16],e[2]=t[0]*s[2]+t[1]*s[7]+t[2]*s[12]+t[3]*s[17],e[3]=t[0]*s[3]+t[1]*s[8]+t[2]*s[13]+t[3]*s[18],e[4]=t[0]*s[4]+t[1]*s[9]+t[2]*s[14]+t[3]*s[19]+t[4],e[5]=t[5]*s[0]+t[6]*s[5]+t[7]*s[10]+t[8]*s[15],e[6]=t[5]*s[1]+t[6]*s[6]+t[7]*s[11]+t[8]*s[16],e[7]=t[5]*s[2]+t[6]*s[7]+t[7]*s[12]+t[8]*s[17],e[8]=t[5]*s[3]+t[6]*s[8]+t[7]*s[13]+t[8]*s[18],e[9]=t[5]*s[4]+t[6]*s[9]+t[7]*s[14]+t[8]*s[19]+t[9],e[10]=t[10]*s[0]+t[11]*s[5]+t[12]*s[10]+t[13]*s[15],e[11]=t[10]*s[1]+t[11]*s[6]+t[12]*s[11]+t[13]*s[16],e[12]=t[10]*s[2]+t[11]*s[7]+t[12]*s[12]+t[13]*s[17],e[13]=t[10]*s[3]+t[11]*s[8]+t[12]*s[13]+t[13]*s[18],e[14]=t[10]*s[4]+t[11]*s[9]+t[12]*s[14]+t[13]*s[19]+t[14],e[15]=t[15]*s[0]+t[16]*s[5]+t[17]*s[10]+t[18]*s[15],e[16]=t[15]*s[1]+t[16]*s[6]+t[17]*s[11]+t[18]*s[16],e[17]=t[15]*s[2]+t[16]*s[7]+t[17]*s[12]+t[18]*s[17],e[18]=t[15]*s[3]+t[16]*s[8]+t[17]*s[13]+t[18]*s[18],e[19]=t[15]*s[4]+t[16]*s[9]+t[17]*s[14]+t[18]*s[19]+t[19],e}_colorMatrix(e){const t=new Float32Array(e);return t[4]/=255,t[9]/=255,t[14]/=255,t[19]/=255,t}brightness(e,t){const s=[e,0,0,0,0,0,e,0,0,0,0,0,e,0,0,0,0,0,1,0];this._loadMatrix(s,t)}tint(e,t){const[s,n,r]=At.shared.setValue(e).toArray(),o=[s,0,0,0,0,0,n,0,0,0,0,0,r,0,0,0,0,0,1,0];this._loadMatrix(o,t)}greyscale(e,t){const s=[e,e,e,0,0,e,e,e,0,0,e,e,e,0,0,0,0,0,1,0];this._loadMatrix(s,t)}blackAndWhite(e){const t=[.3,.6,.1,0,0,.3,.6,.1,0,0,.3,.6,.1,0,0,0,0,0,1,0];this._loadMatrix(t,e)}hue(e,t){e=(e||0)/180*Math.PI;const s=Math.cos(e),n=Math.sin(e),r=Math.sqrt,o=1/3,a=r(o),h=s+(1-s)*o,l=o*(1-s)-a*n,c=o*(1-s)+a*n,u=o*(1-s)+a*n,f=s+o*(1-s),d=o*(1-s)-a*n,m=o*(1-s)-a*n,g=o*(1-s)+a*n,b=s+o*(1-s),_=[h,l,c,0,0,u,f,d,0,0,m,g,b,0,0,0,0,0,1,0];this._loadMatrix(_,t)}contrast(e,t){const s=(e||0)+1,n=-.5*(s-1),r=[s,0,0,0,n,0,s,0,0,n,0,0,s,0,n,0,0,0,1,0];this._loadMatrix(r,t)}saturate(e=0,t){const s=e*2/3+1,n=(s-1)*-.5,r=[s,n,n,0,0,n,s,n,0,0,n,n,s,0,0,0,0,0,1,0];this._loadMatrix(r,t)}desaturate(){this.saturate(-1)}negative(e){const t=[-1,0,0,1,0,0,-1,0,1,0,0,0,-1,1,0,0,0,0,1,0];this._loadMatrix(t,e)}sepia(e){const t=[.393,.7689999,.18899999,0,0,.349,.6859999,.16799999,0,0,.272,.5339999,.13099999,0,0,0,0,0,1,0];this._loadMatrix(t,e)}technicolor(e){const t=[1.9125277891456083,-.8545344976951645,-.09155508482755585,0,11.793603434377337,-.3087833385928097,1.7658908555458428,-.10601743074722245,0,-70.35205161461398,-.231103377548616,-.7501899197440212,1.847597816108189,0,30.950940869491138,0,0,0,1,0];this._loadMatrix(t,e)}polaroid(e){const t=[1.438,-.062,-.062,0,0,-.122,1.378,-.122,0,0,-.016,-.016,1.483,0,0,0,0,0,1,0];this._loadMatrix(t,e)}toBGR(e){const t=[0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,1,0];this._loadMatrix(t,e)}kodachrome(e){const t=[1.1285582396593525,-.3967382283601348,-.03992559172921793,0,63.72958762196502,-.16404339962244616,1.0835251566291304,-.05498805115633132,0,24.732407896706203,-.16786010706155763,-.5603416277695248,1.6014850761964943,0,35.62982807460946,0,0,0,1,0];this._loadMatrix(t,e)}browni(e){const t=[.5997023498159715,.34553243048391263,-.2708298674538042,0,47.43192855600873,-.037703249837783157,.8609577587992641,.15059552388459913,0,-36.96841498319127,.24113635128153335,-.07441037908422492,.44972182064877153,0,-7.562075277591283,0,0,0,1,0];this._loadMatrix(t,e)}vintage(e){const t=[.6279345635605994,.3202183420819367,-.03965408211312453,0,9.651285835294123,.02578397704808868,.6441188644374771,.03259127616149294,0,7.462829176470591,.0466055556782719,-.0851232987247891,.5241648018700465,0,5.159190588235296,0,0,0,1,0];this._loadMatrix(t,e)}colorTone(e,t,s,n,r){e=e||.2,t=t||.15,s=s||16770432,n=n||3375104;const o=At.shared,[a,h,l]=o.setValue(s).toArray(),[c,u,f]=o.setValue(n).toArray(),d=[.3,.59,.11,0,0,a,h,l,e,0,c,u,f,t,0,a-c,h-u,l-f,0,0];this._loadMatrix(d,r)}night(e,t){e=e||.1;const s=[e*-2,-e,0,0,0,-e,0,e,0,0,0,e,e*2,0,0,0,0,0,1,0];this._loadMatrix(s,t)}predator(e,t){const s=[11.224130630493164*e,-4.794486999511719*e,-2.8746118545532227*e,0*e,.40342438220977783*e,-3.6330697536468506*e,9.193157196044922*e,-2.951810836791992*e,0*e,-1.316135048866272*e,-3.2184197902679443*e,-4.2375030517578125*e,7.476448059082031*e,0*e,.8044459223747253*e,0,0,0,1,0];this._loadMatrix(s,t)}lsd(e){const t=[2,-.4,.5,0,0,-.5,2,-.4,0,0,-.4,-.5,3,0,0,0,0,0,1,0];this._loadMatrix(t,e)}reset(){const e=[1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0];this._loadMatrix(e,!1)}get matrix(){return this.uniforms.m}set matrix(e){this.uniforms.m=e}get alpha(){return this.uniforms.uAlpha}set alpha(e){this.uniforms.uAlpha=e}}cd.prototype.grayscale=cd.prototype.greyscale;var GS=`varying vec2 vFilterCoord;
|
||
varying vec2 vTextureCoord;
|
||
|
||
uniform vec2 scale;
|
||
uniform mat2 rotation;
|
||
uniform sampler2D uSampler;
|
||
uniform sampler2D mapSampler;
|
||
|
||
uniform highp vec4 inputSize;
|
||
uniform vec4 inputClamp;
|
||
|
||
void main(void)
|
||
{
|
||
vec4 map = texture2D(mapSampler, vFilterCoord);
|
||
|
||
map -= 0.5;
|
||
map.xy = scale * inputSize.zw * (rotation * map.xy);
|
||
|
||
gl_FragColor = texture2D(uSampler, clamp(vec2(vTextureCoord.x + map.x, vTextureCoord.y + map.y), inputClamp.xy, inputClamp.zw));
|
||
}
|
||
`,jS=`attribute vec2 aVertexPosition;
|
||
|
||
uniform mat3 projectionMatrix;
|
||
uniform mat3 filterMatrix;
|
||
|
||
varying vec2 vTextureCoord;
|
||
varying vec2 vFilterCoord;
|
||
|
||
uniform vec4 inputSize;
|
||
uniform vec4 outputFrame;
|
||
|
||
vec4 filterVertexPosition( void )
|
||
{
|
||
vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;
|
||
|
||
return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);
|
||
}
|
||
|
||
vec2 filterTextureCoord( void )
|
||
{
|
||
return aVertexPosition * (outputFrame.zw * inputSize.zw);
|
||
}
|
||
|
||
void main(void)
|
||
{
|
||
gl_Position = filterVertexPosition();
|
||
vTextureCoord = filterTextureCoord();
|
||
vFilterCoord = ( filterMatrix * vec3( vTextureCoord, 1.0) ).xy;
|
||
}
|
||
`;class HS extends Mi{constructor(e,t){const s=new Vt;e.renderable=!1,super(jS,GS,{mapSampler:e._texture,filterMatrix:s,scale:{x:1,y:1},rotation:new Float32Array([1,0,0,1])}),this.maskSprite=e,this.maskMatrix=s,t==null&&(t=20),this.scale=new bt(t,t)}apply(e,t,s,n){this.uniforms.filterMatrix=e.calculateSpriteMatrix(this.maskMatrix,this.maskSprite),this.uniforms.scale.x=this.scale.x,this.uniforms.scale.y=this.scale.y;const r=this.maskSprite.worldTransform,o=Math.sqrt(r.a*r.a+r.b*r.b),a=Math.sqrt(r.c*r.c+r.d*r.d);o!==0&&a!==0&&(this.uniforms.rotation[0]=r.a/o,this.uniforms.rotation[1]=r.b/o,this.uniforms.rotation[2]=r.c/a,this.uniforms.rotation[3]=r.d/a),e.applyFilter(this,t,s,n)}get map(){return this.uniforms.mapSampler}set map(e){this.uniforms.mapSampler=e}}var WS=`varying vec2 v_rgbNW;
|
||
varying vec2 v_rgbNE;
|
||
varying vec2 v_rgbSW;
|
||
varying vec2 v_rgbSE;
|
||
varying vec2 v_rgbM;
|
||
|
||
varying vec2 vFragCoord;
|
||
uniform sampler2D uSampler;
|
||
uniform highp vec4 inputSize;
|
||
|
||
|
||
/**
|
||
Basic FXAA implementation based on the code on geeks3d.com with the
|
||
modification that the texture2DLod stuff was removed since it's
|
||
unsupported by WebGL.
|
||
|
||
--
|
||
|
||
From:
|
||
https://github.com/mitsuhiko/webgl-meincraft
|
||
|
||
Copyright (c) 2011 by Armin Ronacher.
|
||
|
||
Some rights reserved.
|
||
|
||
Redistribution and use in source and binary forms, with or without
|
||
modification, are permitted provided that the following conditions are
|
||
met:
|
||
|
||
* Redistributions of source code must retain the above copyright
|
||
notice, this list of conditions and the following disclaimer.
|
||
|
||
* Redistributions in binary form must reproduce the above
|
||
copyright notice, this list of conditions and the following
|
||
disclaimer in the documentation and/or other materials provided
|
||
with the distribution.
|
||
|
||
* The names of the contributors may not be used to endorse or
|
||
promote products derived from this software without specific
|
||
prior written permission.
|
||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||
*/
|
||
|
||
#ifndef FXAA_REDUCE_MIN
|
||
#define FXAA_REDUCE_MIN (1.0/ 128.0)
|
||
#endif
|
||
#ifndef FXAA_REDUCE_MUL
|
||
#define FXAA_REDUCE_MUL (1.0 / 8.0)
|
||
#endif
|
||
#ifndef FXAA_SPAN_MAX
|
||
#define FXAA_SPAN_MAX 8.0
|
||
#endif
|
||
|
||
//optimized version for mobile, where dependent
|
||
//texture reads can be a bottleneck
|
||
vec4 fxaa(sampler2D tex, vec2 fragCoord, vec2 inverseVP,
|
||
vec2 v_rgbNW, vec2 v_rgbNE,
|
||
vec2 v_rgbSW, vec2 v_rgbSE,
|
||
vec2 v_rgbM) {
|
||
vec4 color;
|
||
vec3 rgbNW = texture2D(tex, v_rgbNW).xyz;
|
||
vec3 rgbNE = texture2D(tex, v_rgbNE).xyz;
|
||
vec3 rgbSW = texture2D(tex, v_rgbSW).xyz;
|
||
vec3 rgbSE = texture2D(tex, v_rgbSE).xyz;
|
||
vec4 texColor = texture2D(tex, v_rgbM);
|
||
vec3 rgbM = texColor.xyz;
|
||
vec3 luma = vec3(0.299, 0.587, 0.114);
|
||
float lumaNW = dot(rgbNW, luma);
|
||
float lumaNE = dot(rgbNE, luma);
|
||
float lumaSW = dot(rgbSW, luma);
|
||
float lumaSE = dot(rgbSE, luma);
|
||
float lumaM = dot(rgbM, luma);
|
||
float lumaMin = min(lumaM, min(min(lumaNW, lumaNE), min(lumaSW, lumaSE)));
|
||
float lumaMax = max(lumaM, max(max(lumaNW, lumaNE), max(lumaSW, lumaSE)));
|
||
|
||
mediump vec2 dir;
|
||
dir.x = -((lumaNW + lumaNE) - (lumaSW + lumaSE));
|
||
dir.y = ((lumaNW + lumaSW) - (lumaNE + lumaSE));
|
||
|
||
float dirReduce = max((lumaNW + lumaNE + lumaSW + lumaSE) *
|
||
(0.25 * FXAA_REDUCE_MUL), FXAA_REDUCE_MIN);
|
||
|
||
float rcpDirMin = 1.0 / (min(abs(dir.x), abs(dir.y)) + dirReduce);
|
||
dir = min(vec2(FXAA_SPAN_MAX, FXAA_SPAN_MAX),
|
||
max(vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX),
|
||
dir * rcpDirMin)) * inverseVP;
|
||
|
||
vec3 rgbA = 0.5 * (
|
||
texture2D(tex, fragCoord * inverseVP + dir * (1.0 / 3.0 - 0.5)).xyz +
|
||
texture2D(tex, fragCoord * inverseVP + dir * (2.0 / 3.0 - 0.5)).xyz);
|
||
vec3 rgbB = rgbA * 0.5 + 0.25 * (
|
||
texture2D(tex, fragCoord * inverseVP + dir * -0.5).xyz +
|
||
texture2D(tex, fragCoord * inverseVP + dir * 0.5).xyz);
|
||
|
||
float lumaB = dot(rgbB, luma);
|
||
if ((lumaB < lumaMin) || (lumaB > lumaMax))
|
||
color = vec4(rgbA, texColor.a);
|
||
else
|
||
color = vec4(rgbB, texColor.a);
|
||
return color;
|
||
}
|
||
|
||
void main() {
|
||
|
||
vec4 color;
|
||
|
||
color = fxaa(uSampler, vFragCoord, inputSize.zw, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM);
|
||
|
||
gl_FragColor = color;
|
||
}
|
||
`,zS=`
|
||
attribute vec2 aVertexPosition;
|
||
|
||
uniform mat3 projectionMatrix;
|
||
|
||
varying vec2 v_rgbNW;
|
||
varying vec2 v_rgbNE;
|
||
varying vec2 v_rgbSW;
|
||
varying vec2 v_rgbSE;
|
||
varying vec2 v_rgbM;
|
||
|
||
varying vec2 vFragCoord;
|
||
|
||
uniform vec4 inputSize;
|
||
uniform vec4 outputFrame;
|
||
|
||
vec4 filterVertexPosition( void )
|
||
{
|
||
vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;
|
||
|
||
return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);
|
||
}
|
||
|
||
void texcoords(vec2 fragCoord, vec2 inverseVP,
|
||
out vec2 v_rgbNW, out vec2 v_rgbNE,
|
||
out vec2 v_rgbSW, out vec2 v_rgbSE,
|
||
out vec2 v_rgbM) {
|
||
v_rgbNW = (fragCoord + vec2(-1.0, -1.0)) * inverseVP;
|
||
v_rgbNE = (fragCoord + vec2(1.0, -1.0)) * inverseVP;
|
||
v_rgbSW = (fragCoord + vec2(-1.0, 1.0)) * inverseVP;
|
||
v_rgbSE = (fragCoord + vec2(1.0, 1.0)) * inverseVP;
|
||
v_rgbM = vec2(fragCoord * inverseVP);
|
||
}
|
||
|
||
void main(void) {
|
||
|
||
gl_Position = filterVertexPosition();
|
||
|
||
vFragCoord = aVertexPosition * outputFrame.zw;
|
||
|
||
texcoords(vFragCoord, inputSize.zw, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM);
|
||
}
|
||
`;class qS extends Mi{constructor(){super(zS,WS)}}var KS=`precision highp float;
|
||
|
||
varying vec2 vTextureCoord;
|
||
varying vec4 vColor;
|
||
|
||
uniform float uNoise;
|
||
uniform float uSeed;
|
||
uniform sampler2D uSampler;
|
||
|
||
float rand(vec2 co)
|
||
{
|
||
return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);
|
||
}
|
||
|
||
void main()
|
||
{
|
||
vec4 color = texture2D(uSampler, vTextureCoord);
|
||
float randomValue = rand(gl_FragCoord.xy * uSeed);
|
||
float diff = (randomValue - 0.5) * uNoise;
|
||
|
||
// Un-premultiply alpha before applying the color matrix. See issue #3539.
|
||
if (color.a > 0.0) {
|
||
color.rgb /= color.a;
|
||
}
|
||
|
||
color.r += diff;
|
||
color.g += diff;
|
||
color.b += diff;
|
||
|
||
// Premultiply alpha again.
|
||
color.rgb *= color.a;
|
||
|
||
gl_FragColor = color;
|
||
}
|
||
`;class ZS extends Mi{constructor(e=.5,t=Math.random()){super(Ov,KS,{uNoise:0,uSeed:0}),this.noise=e,this.seed=t}get noise(){return this.uniforms.uNoise}set noise(e){this.uniforms.uNoise=e}get seed(){return this.uniforms.uSeed}set seed(e){this.uniforms.uSeed=e}}const km={AlphaFilter:LS,BlurFilter:YS,BlurFilterPass:hd,ColorMatrixFilter:cd,DisplacementFilter:HS,FXAAFilter:qS,NoiseFilter:ZS};Object.entries(km).forEach(([i,e])=>{Object.defineProperty(km,i,{get(){return pt("7.1.0",`filters.${i} has moved to ${i}`),e}})});class JS{constructor(){this.interactionFrequency=10,this._deltaTime=0,this._didMove=!1,this.tickerAdded=!1,this._pauseUpdate=!0}init(e){this.removeTickerListener(),this.events=e,this.interactionFrequency=10,this._deltaTime=0,this._didMove=!1,this.tickerAdded=!1,this._pauseUpdate=!0}get pauseUpdate(){return this._pauseUpdate}set pauseUpdate(e){this._pauseUpdate=e}addTickerListener(){this.tickerAdded||!this.domElement||(Ei.system.add(this.tickerUpdate,this,Sr.INTERACTION),this.tickerAdded=!0)}removeTickerListener(){this.tickerAdded&&(Ei.system.remove(this.tickerUpdate,this),this.tickerAdded=!1)}pointerMoved(){this._didMove=!0}update(){if(!this.domElement||this._pauseUpdate)return;if(this._didMove){this._didMove=!1;return}const e=this.events.rootPointerEvent;this.events.supportsTouchEvents&&e.pointerType==="touch"||globalThis.document.dispatchEvent(new PointerEvent("pointermove",{clientX:e.clientX,clientY:e.clientY}))}tickerUpdate(e){this._deltaTime+=e,!(this._deltaTime<this.interactionFrequency)&&(this._deltaTime=0,this.update())}}const Vn=new JS;class Ta{constructor(e){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=Ta.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new bt,this.page=new bt,this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,this.manager=e}get layerX(){return this.layer.x}get layerY(){return this.layer.y}get pageX(){return this.page.x}get pageY(){return this.page.y}get data(){return this}composedPath(){return this.manager&&(!this.path||this.path[this.path.length-1]!==this.target)&&(this.path=this.target?this.manager.propagationPath(this.target):[]),this.path}initEvent(e,t,s){throw new Error("initEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}initUIEvent(e,t,s,n,r){throw new Error("initUIEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}preventDefault(){this.nativeEvent instanceof Event&&this.nativeEvent.cancelable&&this.nativeEvent.preventDefault(),this.defaultPrevented=!0}stopImmediatePropagation(){this.propagationImmediatelyStopped=!0}stopPropagation(){this.propagationStopped=!0}}class Ul extends Ta{constructor(){super(...arguments),this.client=new bt,this.movement=new bt,this.offset=new bt,this.global=new bt,this.screen=new bt}get clientX(){return this.client.x}get clientY(){return this.client.y}get x(){return this.clientX}get y(){return this.clientY}get movementX(){return this.movement.x}get movementY(){return this.movement.y}get offsetX(){return this.offset.x}get offsetY(){return this.offset.y}get globalX(){return this.global.x}get globalY(){return this.global.y}get screenX(){return this.screen.x}get screenY(){return this.screen.y}getLocalPosition(e,t,s){return e.worldTransform.applyInverse(s||this.global,t)}getModifierState(e){return"getModifierState"in this.nativeEvent&&this.nativeEvent.getModifierState(e)}initMouseEvent(e,t,s,n,r,o,a,h,l,c,u,f,d,m,g){throw new Error("Method not implemented.")}}class rs extends Ul{constructor(){super(...arguments),this.width=0,this.height=0,this.isPrimary=!1}getCoalescedEvents(){return this.type==="pointermove"||this.type==="mousemove"||this.type==="touchmove"?[this]:[]}getPredictedEvents(){throw new Error("getPredictedEvents is not supported!")}}class ho extends Ul{constructor(){super(...arguments),this.DOM_DELTA_PIXEL=0,this.DOM_DELTA_LINE=1,this.DOM_DELTA_PAGE=2}}ho.DOM_DELTA_PIXEL=0,ho.DOM_DELTA_LINE=1,ho.DOM_DELTA_PAGE=2;const QS=2048,eT=new bt,cu=new bt;class tT{constructor(e){this.dispatch=new Sa,this.moveOnAll=!1,this.enableGlobalMoveEvents=!0,this.mappingState={trackingData:{}},this.eventPool=new Map,this._allInteractiveElements=[],this._hitElements=[],this._isPointerMoveEvent=!1,this.rootTarget=e,this.hitPruneFn=this.hitPruneFn.bind(this),this.hitTestFn=this.hitTestFn.bind(this),this.mapPointerDown=this.mapPointerDown.bind(this),this.mapPointerMove=this.mapPointerMove.bind(this),this.mapPointerOut=this.mapPointerOut.bind(this),this.mapPointerOver=this.mapPointerOver.bind(this),this.mapPointerUp=this.mapPointerUp.bind(this),this.mapPointerUpOutside=this.mapPointerUpOutside.bind(this),this.mapWheel=this.mapWheel.bind(this),this.mappingTable={},this.addEventMapping("pointerdown",this.mapPointerDown),this.addEventMapping("pointermove",this.mapPointerMove),this.addEventMapping("pointerout",this.mapPointerOut),this.addEventMapping("pointerleave",this.mapPointerOut),this.addEventMapping("pointerover",this.mapPointerOver),this.addEventMapping("pointerup",this.mapPointerUp),this.addEventMapping("pointerupoutside",this.mapPointerUpOutside),this.addEventMapping("wheel",this.mapWheel)}addEventMapping(e,t){this.mappingTable[e]||(this.mappingTable[e]=[]),this.mappingTable[e].push({fn:t,priority:0}),this.mappingTable[e].sort((s,n)=>s.priority-n.priority)}dispatchEvent(e,t){e.propagationStopped=!1,e.propagationImmediatelyStopped=!1,this.propagate(e,t),this.dispatch.emit(t||e.type,e)}mapEvent(e){if(!this.rootTarget)return;const t=this.mappingTable[e.type];if(t)for(let s=0,n=t.length;s<n;s++)t[s].fn(e);else console.warn(`[EventBoundary]: Event mapping not defined for ${e.type}`)}hitTest(e,t){Vn.pauseUpdate=!0;const s=this._isPointerMoveEvent&&this.enableGlobalMoveEvents?"hitTestMoveRecursive":"hitTestRecursive",n=this[s](this.rootTarget,this.rootTarget.eventMode,eT.set(e,t),this.hitTestFn,this.hitPruneFn);return n&&n[0]}propagate(e,t){if(!e.target)return;const s=e.composedPath();e.eventPhase=e.CAPTURING_PHASE;for(let n=0,r=s.length-1;n<r;n++)if(e.currentTarget=s[n],this.notifyTarget(e,t),e.propagationStopped||e.propagationImmediatelyStopped)return;if(e.eventPhase=e.AT_TARGET,e.currentTarget=e.target,this.notifyTarget(e,t),!(e.propagationStopped||e.propagationImmediatelyStopped)){e.eventPhase=e.BUBBLING_PHASE;for(let n=s.length-2;n>=0;n--)if(e.currentTarget=s[n],this.notifyTarget(e,t),e.propagationStopped||e.propagationImmediatelyStopped)return}}all(e,t,s=this._allInteractiveElements){if(s.length===0)return;e.eventPhase=e.BUBBLING_PHASE;const n=Array.isArray(t)?t:[t];for(let r=s.length-1;r>=0;r--)n.forEach(o=>{e.currentTarget=s[r],this.notifyTarget(e,o)})}propagationPath(e){const t=[e];for(let s=0;s<QS&&e!==this.rootTarget;s++){if(!e.parent)throw new Error("Cannot find propagation path to disconnected target");t.push(e.parent),e=e.parent}return t.reverse(),t}hitTestMoveRecursive(e,t,s,n,r,o=!1){let a=!1;if(this._interactivePrune(e))return null;if((e.eventMode==="dynamic"||t==="dynamic")&&(Vn.pauseUpdate=!1),e.interactiveChildren&&e.children){const c=e.children;for(let u=c.length-1;u>=0;u--){const f=c[u],d=this.hitTestMoveRecursive(f,this._isInteractive(t)?t:f.eventMode,s,n,r,o||r(e,s));if(d){if(d.length>0&&!d[d.length-1].parent)continue;const m=e.isInteractive();(d.length>0||m)&&(m&&this._allInteractiveElements.push(e),d.push(e)),this._hitElements.length===0&&(this._hitElements=d),a=!0}}}const h=this._isInteractive(t),l=e.isInteractive();return h&&l&&this._allInteractiveElements.push(e),o||this._hitElements.length>0?null:a?this._hitElements:h&&!r(e,s)&&n(e,s)?l?[e]:[]:null}hitTestRecursive(e,t,s,n,r){if(this._interactivePrune(e)||r(e,s))return null;if((e.eventMode==="dynamic"||t==="dynamic")&&(Vn.pauseUpdate=!1),e.interactiveChildren&&e.children){const h=e.children;for(let l=h.length-1;l>=0;l--){const c=h[l],u=this.hitTestRecursive(c,this._isInteractive(t)?t:c.eventMode,s,n,r);if(u){if(u.length>0&&!u[u.length-1].parent)continue;const f=e.isInteractive();return(u.length>0||f)&&u.push(e),u}}}const o=this._isInteractive(t),a=e.isInteractive();return o&&n(e,s)?a?[e]:[]:null}_isInteractive(e){return e==="static"||e==="dynamic"}_interactivePrune(e){return!!(!e||e.isMask||!e.visible||!e.renderable||e.eventMode==="none"||e.eventMode==="passive"&&!e.interactiveChildren||e.isMask)}hitPruneFn(e,t){var s;if(e.hitArea&&(e.worldTransform.applyInverse(t,cu),!e.hitArea.contains(cu.x,cu.y)))return!0;if(e._mask){const n=e._mask.isMaskData?e._mask.maskObject:e._mask;if(n&&!((s=n.containsPoint)!=null&&s.call(n,t)))return!0}return!1}hitTestFn(e,t){return e.eventMode==="passive"?!1:e.hitArea?!0:e.containsPoint?e.containsPoint(t):!1}notifyTarget(e,t){var r,o;t=t??e.type;const s=`on${t}`;(o=(r=e.currentTarget)[s])==null||o.call(r,e);const n=e.eventPhase===e.CAPTURING_PHASE||e.eventPhase===e.AT_TARGET?`${t}capture`:t;this.notifyListeners(e,n),e.eventPhase===e.AT_TARGET&&this.notifyListeners(e,t)}mapPointerDown(e){if(!(e instanceof rs)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const t=this.createPointerEvent(e);if(this.dispatchEvent(t,"pointerdown"),t.pointerType==="touch")this.dispatchEvent(t,"touchstart");else if(t.pointerType==="mouse"||t.pointerType==="pen"){const n=t.button===2;this.dispatchEvent(t,n?"rightdown":"mousedown")}const s=this.trackingData(e.pointerId);s.pressTargetsByButton[e.button]=t.composedPath(),this.freeEvent(t)}mapPointerMove(e){var h,l;if(!(e instanceof rs)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}this._allInteractiveElements.length=0,this._hitElements.length=0,this._isPointerMoveEvent=!0;const t=this.createPointerEvent(e);this._isPointerMoveEvent=!1;const s=t.pointerType==="mouse"||t.pointerType==="pen",n=this.trackingData(e.pointerId),r=this.findMountedTarget(n.overTargets);if(((h=n.overTargets)==null?void 0:h.length)>0&&r!==t.target){const c=e.type==="mousemove"?"mouseout":"pointerout",u=this.createPointerEvent(e,c,r);if(this.dispatchEvent(u,"pointerout"),s&&this.dispatchEvent(u,"mouseout"),!t.composedPath().includes(r)){const f=this.createPointerEvent(e,"pointerleave",r);for(f.eventPhase=f.AT_TARGET;f.target&&!t.composedPath().includes(f.target);)f.currentTarget=f.target,this.notifyTarget(f),s&&this.notifyTarget(f,"mouseleave"),f.target=f.target.parent;this.freeEvent(f)}this.freeEvent(u)}if(r!==t.target){const c=e.type==="mousemove"?"mouseover":"pointerover",u=this.clonePointerEvent(t,c);this.dispatchEvent(u,"pointerover"),s&&this.dispatchEvent(u,"mouseover");let f=r==null?void 0:r.parent;for(;f&&f!==this.rootTarget.parent&&f!==t.target;)f=f.parent;if(!f||f===this.rootTarget.parent){const d=this.clonePointerEvent(t,"pointerenter");for(d.eventPhase=d.AT_TARGET;d.target&&d.target!==r&&d.target!==this.rootTarget.parent;)d.currentTarget=d.target,this.notifyTarget(d),s&&this.notifyTarget(d,"mouseenter"),d.target=d.target.parent;this.freeEvent(d)}this.freeEvent(u)}const o=[],a=this.enableGlobalMoveEvents??!0;this.moveOnAll?o.push("pointermove"):this.dispatchEvent(t,"pointermove"),a&&o.push("globalpointermove"),t.pointerType==="touch"&&(this.moveOnAll?o.splice(1,0,"touchmove"):this.dispatchEvent(t,"touchmove"),a&&o.push("globaltouchmove")),s&&(this.moveOnAll?o.splice(1,0,"mousemove"):this.dispatchEvent(t,"mousemove"),a&&o.push("globalmousemove"),this.cursor=(l=t.target)==null?void 0:l.cursor),o.length>0&&this.all(t,o),this._allInteractiveElements.length=0,this._hitElements.length=0,n.overTargets=t.composedPath(),this.freeEvent(t)}mapPointerOver(e){var o;if(!(e instanceof rs)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const t=this.trackingData(e.pointerId),s=this.createPointerEvent(e),n=s.pointerType==="mouse"||s.pointerType==="pen";this.dispatchEvent(s,"pointerover"),n&&this.dispatchEvent(s,"mouseover"),s.pointerType==="mouse"&&(this.cursor=(o=s.target)==null?void 0:o.cursor);const r=this.clonePointerEvent(s,"pointerenter");for(r.eventPhase=r.AT_TARGET;r.target&&r.target!==this.rootTarget.parent;)r.currentTarget=r.target,this.notifyTarget(r),n&&this.notifyTarget(r,"mouseenter"),r.target=r.target.parent;t.overTargets=s.composedPath(),this.freeEvent(s),this.freeEvent(r)}mapPointerOut(e){if(!(e instanceof rs)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const t=this.trackingData(e.pointerId);if(t.overTargets){const s=e.pointerType==="mouse"||e.pointerType==="pen",n=this.findMountedTarget(t.overTargets),r=this.createPointerEvent(e,"pointerout",n);this.dispatchEvent(r),s&&this.dispatchEvent(r,"mouseout");const o=this.createPointerEvent(e,"pointerleave",n);for(o.eventPhase=o.AT_TARGET;o.target&&o.target!==this.rootTarget.parent;)o.currentTarget=o.target,this.notifyTarget(o),s&&this.notifyTarget(o,"mouseleave"),o.target=o.target.parent;t.overTargets=null,this.freeEvent(r),this.freeEvent(o)}this.cursor=null}mapPointerUp(e){if(!(e instanceof rs)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const t=performance.now(),s=this.createPointerEvent(e);if(this.dispatchEvent(s,"pointerup"),s.pointerType==="touch")this.dispatchEvent(s,"touchend");else if(s.pointerType==="mouse"||s.pointerType==="pen"){const a=s.button===2;this.dispatchEvent(s,a?"rightup":"mouseup")}const n=this.trackingData(e.pointerId),r=this.findMountedTarget(n.pressTargetsByButton[e.button]);let o=r;if(r&&!s.composedPath().includes(r)){let a=r;for(;a&&!s.composedPath().includes(a);){if(s.currentTarget=a,this.notifyTarget(s,"pointerupoutside"),s.pointerType==="touch")this.notifyTarget(s,"touchendoutside");else if(s.pointerType==="mouse"||s.pointerType==="pen"){const h=s.button===2;this.notifyTarget(s,h?"rightupoutside":"mouseupoutside")}a=a.parent}delete n.pressTargetsByButton[e.button],o=a}if(o){const a=this.clonePointerEvent(s,"click");a.target=o,a.path=null,n.clicksByButton[e.button]||(n.clicksByButton[e.button]={clickCount:0,target:a.target,timeStamp:t});const h=n.clicksByButton[e.button];if(h.target===a.target&&t-h.timeStamp<200?++h.clickCount:h.clickCount=1,h.target=a.target,h.timeStamp=t,a.detail=h.clickCount,a.pointerType==="mouse"){const l=a.button===2;this.dispatchEvent(a,l?"rightclick":"click")}else a.pointerType==="touch"&&this.dispatchEvent(a,"tap");this.dispatchEvent(a,"pointertap"),this.freeEvent(a)}this.freeEvent(s)}mapPointerUpOutside(e){if(!(e instanceof rs)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const t=this.trackingData(e.pointerId),s=this.findMountedTarget(t.pressTargetsByButton[e.button]),n=this.createPointerEvent(e);if(s){let r=s;for(;r;)n.currentTarget=r,this.notifyTarget(n,"pointerupoutside"),n.pointerType==="touch"?this.notifyTarget(n,"touchendoutside"):(n.pointerType==="mouse"||n.pointerType==="pen")&&this.notifyTarget(n,n.button===2?"rightupoutside":"mouseupoutside"),r=r.parent;delete t.pressTargetsByButton[e.button]}this.freeEvent(n)}mapWheel(e){if(!(e instanceof ho)){console.warn("EventBoundary cannot map a non-wheel event as a wheel event");return}const t=this.createWheelEvent(e);this.dispatchEvent(t),this.freeEvent(t)}findMountedTarget(e){if(!e)return null;let t=e[0];for(let s=1;s<e.length&&e[s].parent===t;s++)t=e[s];return t}createPointerEvent(e,t,s){const n=this.allocateEvent(rs);return this.copyPointerData(e,n),this.copyMouseData(e,n),this.copyData(e,n),n.nativeEvent=e.nativeEvent,n.originalEvent=e,n.target=s??this.hitTest(n.global.x,n.global.y)??this._hitElements[0],typeof t=="string"&&(n.type=t),n}createWheelEvent(e){const t=this.allocateEvent(ho);return this.copyWheelData(e,t),this.copyMouseData(e,t),this.copyData(e,t),t.nativeEvent=e.nativeEvent,t.originalEvent=e,t.target=this.hitTest(t.global.x,t.global.y),t}clonePointerEvent(e,t){const s=this.allocateEvent(rs);return s.nativeEvent=e.nativeEvent,s.originalEvent=e.originalEvent,this.copyPointerData(e,s),this.copyMouseData(e,s),this.copyData(e,s),s.target=e.target,s.path=e.composedPath().slice(),s.type=t??s.type,s}copyWheelData(e,t){t.deltaMode=e.deltaMode,t.deltaX=e.deltaX,t.deltaY=e.deltaY,t.deltaZ=e.deltaZ}copyPointerData(e,t){e instanceof rs&&t instanceof rs&&(t.pointerId=e.pointerId,t.width=e.width,t.height=e.height,t.isPrimary=e.isPrimary,t.pointerType=e.pointerType,t.pressure=e.pressure,t.tangentialPressure=e.tangentialPressure,t.tiltX=e.tiltX,t.tiltY=e.tiltY,t.twist=e.twist)}copyMouseData(e,t){e instanceof Ul&&t instanceof Ul&&(t.altKey=e.altKey,t.button=e.button,t.buttons=e.buttons,t.client.copyFrom(e.client),t.ctrlKey=e.ctrlKey,t.metaKey=e.metaKey,t.movement.copyFrom(e.movement),t.screen.copyFrom(e.screen),t.shiftKey=e.shiftKey,t.global.copyFrom(e.global))}copyData(e,t){t.isTrusted=e.isTrusted,t.srcElement=e.srcElement,t.timeStamp=performance.now(),t.type=e.type,t.detail=e.detail,t.view=e.view,t.which=e.which,t.layer.copyFrom(e.layer),t.page.copyFrom(e.page)}trackingData(e){return this.mappingState.trackingData[e]||(this.mappingState.trackingData[e]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[e]}allocateEvent(e){this.eventPool.has(e)||this.eventPool.set(e,[]);const t=this.eventPool.get(e).pop()||new e(this);return t.eventPhase=t.NONE,t.currentTarget=null,t.path=null,t.target=null,t}freeEvent(e){if(e.manager!==this)throw new Error("It is illegal to free an event not managed by this EventBoundary!");const t=e.constructor;this.eventPool.has(t)||this.eventPool.set(t,[]),this.eventPool.get(t).push(e)}notifyListeners(e,t){const s=e.currentTarget._events[t];if(s&&e.currentTarget.isInteractive())if("fn"in s)s.once&&e.currentTarget.removeListener(t,s.fn,void 0,!0),s.fn.call(s.context,e);else for(let n=0,r=s.length;n<r&&!e.propagationImmediatelyStopped;n++)s[n].once&&e.currentTarget.removeListener(t,s[n].fn,void 0,!0),s[n].fn.call(s[n].context,e)}}const iT=1,sT={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},ud=class dd{constructor(e){this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.domElement=null,this.resolution=1,this.renderer=e,this.rootBoundary=new tT(null),Vn.init(this),this.autoPreventDefault=!0,this.eventsAdded=!1,this.rootPointerEvent=new rs(null),this.rootWheelEvent=new ho(null),this.cursorStyles={default:"inherit",pointer:"pointer"},this.features=new Proxy({...dd.defaultEventFeatures},{set:(t,s,n)=>(s==="globalMove"&&(this.rootBoundary.enableGlobalMoveEvents=n),t[s]=n,!0)}),this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.onPointerOverOut=this.onPointerOverOut.bind(this),this.onWheel=this.onWheel.bind(this)}static get defaultEventMode(){return this._defaultEventMode}init(e){const{view:t,resolution:s}=this.renderer;this.setTargetElement(t),this.resolution=s,dd._defaultEventMode=e.eventMode??"auto",Object.assign(this.features,e.eventFeatures??{}),this.rootBoundary.enableGlobalMoveEvents=this.features.globalMove}resolutionChange(e){this.resolution=e}destroy(){this.setTargetElement(null),this.renderer=null}setCursor(e){e=e||"default";let t=!0;if(globalThis.OffscreenCanvas&&this.domElement instanceof OffscreenCanvas&&(t=!1),this.currentCursor===e)return;this.currentCursor=e;const s=this.cursorStyles[e];if(s)switch(typeof s){case"string":t&&(this.domElement.style.cursor=s);break;case"function":s(e);break;case"object":t&&Object.assign(this.domElement.style,s);break}else t&&typeof e=="string"&&!Object.prototype.hasOwnProperty.call(this.cursorStyles,e)&&(this.domElement.style.cursor=e)}get pointer(){return this.rootPointerEvent}onPointerDown(e){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;const t=this.normalizeToPointerData(e);this.autoPreventDefault&&t[0].isNormalized&&(e.cancelable||!("cancelable"in e))&&e.preventDefault();for(let s=0,n=t.length;s<n;s++){const r=t[s],o=this.bootstrapEvent(this.rootPointerEvent,r);this.rootBoundary.mapEvent(o)}this.setCursor(this.rootBoundary.cursor)}onPointerMove(e){if(!this.features.move)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,Vn.pointerMoved();const t=this.normalizeToPointerData(e);for(let s=0,n=t.length;s<n;s++){const r=this.bootstrapEvent(this.rootPointerEvent,t[s]);this.rootBoundary.mapEvent(r)}this.setCursor(this.rootBoundary.cursor)}onPointerUp(e){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let t=e.target;e.composedPath&&e.composedPath().length>0&&(t=e.composedPath()[0]);const s=t!==this.domElement?"outside":"",n=this.normalizeToPointerData(e);for(let r=0,o=n.length;r<o;r++){const a=this.bootstrapEvent(this.rootPointerEvent,n[r]);a.type+=s,this.rootBoundary.mapEvent(a)}this.setCursor(this.rootBoundary.cursor)}onPointerOverOut(e){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;const t=this.normalizeToPointerData(e);for(let s=0,n=t.length;s<n;s++){const r=this.bootstrapEvent(this.rootPointerEvent,t[s]);this.rootBoundary.mapEvent(r)}this.setCursor(this.rootBoundary.cursor)}onWheel(e){if(!this.features.wheel)return;const t=this.normalizeWheelEvent(e);this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,this.rootBoundary.mapEvent(t)}setTargetElement(e){this.removeEvents(),this.domElement=e,Vn.domElement=e,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;Vn.addTickerListener();const e=this.domElement.style;e&&(globalThis.navigator.msPointerEnabled?(e.msContentZooming="none",e.msTouchAction="none"):this.supportsPointerEvents&&(e.touchAction="none")),this.supportsPointerEvents?(globalThis.document.addEventListener("pointermove",this.onPointerMove,!0),this.domElement.addEventListener("pointerdown",this.onPointerDown,!0),this.domElement.addEventListener("pointerleave",this.onPointerOverOut,!0),this.domElement.addEventListener("pointerover",this.onPointerOverOut,!0),globalThis.addEventListener("pointerup",this.onPointerUp,!0)):(globalThis.document.addEventListener("mousemove",this.onPointerMove,!0),this.domElement.addEventListener("mousedown",this.onPointerDown,!0),this.domElement.addEventListener("mouseout",this.onPointerOverOut,!0),this.domElement.addEventListener("mouseover",this.onPointerOverOut,!0),globalThis.addEventListener("mouseup",this.onPointerUp,!0),this.supportsTouchEvents&&(this.domElement.addEventListener("touchstart",this.onPointerDown,!0),this.domElement.addEventListener("touchend",this.onPointerUp,!0),this.domElement.addEventListener("touchmove",this.onPointerMove,!0))),this.domElement.addEventListener("wheel",this.onWheel,{passive:!0,capture:!0}),this.eventsAdded=!0}removeEvents(){if(!this.eventsAdded||!this.domElement)return;Vn.removeTickerListener();const e=this.domElement.style;globalThis.navigator.msPointerEnabled?(e.msContentZooming="",e.msTouchAction=""):this.supportsPointerEvents&&(e.touchAction=""),this.supportsPointerEvents?(globalThis.document.removeEventListener("pointermove",this.onPointerMove,!0),this.domElement.removeEventListener("pointerdown",this.onPointerDown,!0),this.domElement.removeEventListener("pointerleave",this.onPointerOverOut,!0),this.domElement.removeEventListener("pointerover",this.onPointerOverOut,!0),globalThis.removeEventListener("pointerup",this.onPointerUp,!0)):(globalThis.document.removeEventListener("mousemove",this.onPointerMove,!0),this.domElement.removeEventListener("mousedown",this.onPointerDown,!0),this.domElement.removeEventListener("mouseout",this.onPointerOverOut,!0),this.domElement.removeEventListener("mouseover",this.onPointerOverOut,!0),globalThis.removeEventListener("mouseup",this.onPointerUp,!0),this.supportsTouchEvents&&(this.domElement.removeEventListener("touchstart",this.onPointerDown,!0),this.domElement.removeEventListener("touchend",this.onPointerUp,!0),this.domElement.removeEventListener("touchmove",this.onPointerMove,!0))),this.domElement.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this.eventsAdded=!1}mapPositionToPoint(e,t,s){const n=this.domElement.isConnected?this.domElement.getBoundingClientRect():{width:this.domElement.width,height:this.domElement.height,left:0,top:0},r=1/this.resolution;e.x=(t-n.left)*(this.domElement.width/n.width)*r,e.y=(s-n.top)*(this.domElement.height/n.height)*r}normalizeToPointerData(e){const t=[];if(this.supportsTouchEvents&&e instanceof TouchEvent)for(let s=0,n=e.changedTouches.length;s<n;s++){const r=e.changedTouches[s];typeof r.button>"u"&&(r.button=0),typeof r.buttons>"u"&&(r.buttons=1),typeof r.isPrimary>"u"&&(r.isPrimary=e.touches.length===1&&e.type==="touchstart"),typeof r.width>"u"&&(r.width=r.radiusX||1),typeof r.height>"u"&&(r.height=r.radiusY||1),typeof r.tiltX>"u"&&(r.tiltX=0),typeof r.tiltY>"u"&&(r.tiltY=0),typeof r.pointerType>"u"&&(r.pointerType="touch"),typeof r.pointerId>"u"&&(r.pointerId=r.identifier||0),typeof r.pressure>"u"&&(r.pressure=r.force||.5),typeof r.twist>"u"&&(r.twist=0),typeof r.tangentialPressure>"u"&&(r.tangentialPressure=0),typeof r.layerX>"u"&&(r.layerX=r.offsetX=r.clientX),typeof r.layerY>"u"&&(r.layerY=r.offsetY=r.clientY),r.isNormalized=!0,r.type=e.type,t.push(r)}else if(!globalThis.MouseEvent||e instanceof MouseEvent&&(!this.supportsPointerEvents||!(e instanceof globalThis.PointerEvent))){const s=e;typeof s.isPrimary>"u"&&(s.isPrimary=!0),typeof s.width>"u"&&(s.width=1),typeof s.height>"u"&&(s.height=1),typeof s.tiltX>"u"&&(s.tiltX=0),typeof s.tiltY>"u"&&(s.tiltY=0),typeof s.pointerType>"u"&&(s.pointerType="mouse"),typeof s.pointerId>"u"&&(s.pointerId=iT),typeof s.pressure>"u"&&(s.pressure=.5),typeof s.twist>"u"&&(s.twist=0),typeof s.tangentialPressure>"u"&&(s.tangentialPressure=0),s.isNormalized=!0,t.push(s)}else t.push(e);return t}normalizeWheelEvent(e){const t=this.rootWheelEvent;return this.transferMouseData(t,e),t.deltaX=e.deltaX,t.deltaY=e.deltaY,t.deltaZ=e.deltaZ,t.deltaMode=e.deltaMode,this.mapPositionToPoint(t.screen,e.clientX,e.clientY),t.global.copyFrom(t.screen),t.offset.copyFrom(t.screen),t.nativeEvent=e,t.type=e.type,t}bootstrapEvent(e,t){return e.originalEvent=null,e.nativeEvent=t,e.pointerId=t.pointerId,e.width=t.width,e.height=t.height,e.isPrimary=t.isPrimary,e.pointerType=t.pointerType,e.pressure=t.pressure,e.tangentialPressure=t.tangentialPressure,e.tiltX=t.tiltX,e.tiltY=t.tiltY,e.twist=t.twist,this.transferMouseData(e,t),this.mapPositionToPoint(e.screen,t.clientX,t.clientY),e.global.copyFrom(e.screen),e.offset.copyFrom(e.screen),e.isTrusted=t.isTrusted,e.type==="pointerleave"&&(e.type="pointerout"),e.type.startsWith("mouse")&&(e.type=e.type.replace("mouse","pointer")),e.type.startsWith("touch")&&(e.type=sT[e.type]||e.type),e}transferMouseData(e,t){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=performance.now(),e.type=t.type,e.altKey=t.altKey,e.button=t.button,e.buttons=t.buttons,e.client.x=t.clientX,e.client.y=t.clientY,e.ctrlKey=t.ctrlKey,e.metaKey=t.metaKey,e.movement.x=t.movementX,e.movement.y=t.movementY,e.page.x=t.pageX,e.page.y=t.pageY,e.relatedTarget=null,e.shiftKey=t.shiftKey}};ud.extension={name:"events",type:[Oe.RendererSystem,Oe.CanvasRendererSystem]},ud.defaultEventFeatures={move:!0,globalMove:!0,click:!0,wheel:!0};let fd=ud;He.add(fd);function Fm(i){return i==="dynamic"||i==="static"}const nT={onclick:null,onmousedown:null,onmouseenter:null,onmouseleave:null,onmousemove:null,onglobalmousemove:null,onmouseout:null,onmouseover:null,onmouseup:null,onmouseupoutside:null,onpointercancel:null,onpointerdown:null,onpointerenter:null,onpointerleave:null,onpointermove:null,onglobalpointermove:null,onpointerout:null,onpointerover:null,onpointertap:null,onpointerup:null,onpointerupoutside:null,onrightclick:null,onrightdown:null,onrightup:null,onrightupoutside:null,ontap:null,ontouchcancel:null,ontouchend:null,ontouchendoutside:null,ontouchmove:null,onglobaltouchmove:null,ontouchstart:null,onwheel:null,_internalInteractive:void 0,get interactive(){return this._internalInteractive??Fm(fd.defaultEventMode)},set interactive(i){pt("7.2.0","Setting interactive is deprecated, use eventMode = 'none'/'passive'/'auto'/'static'/'dynamic' instead."),this._internalInteractive=i,this.eventMode=i?"static":"auto"},_internalEventMode:void 0,get eventMode(){return this._internalEventMode??fd.defaultEventMode},set eventMode(i){this._internalInteractive=Fm(i),this._internalEventMode=i},isInteractive(){return this.eventMode==="static"||this.eventMode==="dynamic"},interactiveChildren:!0,hitArea:null,addEventListener(i,e,t){const s=typeof t=="boolean"&&t||typeof t=="object"&&t.capture,n=typeof t=="object"?t.signal:void 0,r=typeof t=="object"?t.once===!0:!1,o=typeof e=="function"?void 0:e;i=s?`${i}capture`:i;const a=typeof e=="function"?e:e.handleEvent,h=this;n&&n.addEventListener("abort",()=>{h.off(i,a,o)}),r?h.once(i,a,o):h.on(i,a,o)},removeEventListener(i,e,t){const s=typeof t=="boolean"&&t||typeof t=="object"&&t.capture,n=typeof e=="function"?void 0:e;i=s?`${i}capture`:i,e=typeof e=="function"?e:e.handleEvent,this.off(i,e,n)},dispatchEvent(i){if(!(i instanceof Ta))throw new Error("DisplayObject cannot propagate events outside of the Federated Events API");return i.defaultPrevented=!1,i.path=null,i.target=this,i.manager.dispatchEvent(i),!i.defaultPrevented}};Wt.mixin(nT);const rT={accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:!1,_accessibleDiv:null,accessibleType:"button",accessiblePointerEvents:"auto",accessibleChildren:!0,renderId:-1};Wt.mixin(rT);const oT=9,Ga=100,aT=0,lT=0,Om=2,Bm=1,hT=-1e3,cT=-1e3,uT=2;class $v{constructor(e){this.debug=!1,this._isActive=!1,this._isMobileAccessibility=!1,this.pool=[],this.renderId=0,this.children=[],this.androidUpdateCount=0,this.androidUpdateFrequency=500,this._hookDiv=null,(dn.tablet||dn.phone)&&this.createTouchHook();const t=document.createElement("div");t.style.width=`${Ga}px`,t.style.height=`${Ga}px`,t.style.position="absolute",t.style.top=`${aT}px`,t.style.left=`${lT}px`,t.style.zIndex=Om.toString(),this.div=t,this.renderer=e,this._onKeyDown=this._onKeyDown.bind(this),this._onMouseMove=this._onMouseMove.bind(this),globalThis.addEventListener("keydown",this._onKeyDown,!1)}get isActive(){return this._isActive}get isMobileAccessibility(){return this._isMobileAccessibility}createTouchHook(){const e=document.createElement("button");e.style.width=`${Bm}px`,e.style.height=`${Bm}px`,e.style.position="absolute",e.style.top=`${hT}px`,e.style.left=`${cT}px`,e.style.zIndex=uT.toString(),e.style.backgroundColor="#FF0000",e.title="select to enable accessibility for this content",e.addEventListener("focus",()=>{this._isMobileAccessibility=!0,this.activate(),this.destroyTouchHook()}),document.body.appendChild(e),this._hookDiv=e}destroyTouchHook(){this._hookDiv&&(document.body.removeChild(this._hookDiv),this._hookDiv=null)}activate(){var e;this._isActive||(this._isActive=!0,globalThis.document.addEventListener("mousemove",this._onMouseMove,!0),globalThis.removeEventListener("keydown",this._onKeyDown,!1),this.renderer.on("postrender",this.update,this),(e=this.renderer.view.parentNode)==null||e.appendChild(this.div))}deactivate(){var e;!this._isActive||this._isMobileAccessibility||(this._isActive=!1,globalThis.document.removeEventListener("mousemove",this._onMouseMove,!0),globalThis.addEventListener("keydown",this._onKeyDown,!1),this.renderer.off("postrender",this.update),(e=this.div.parentNode)==null||e.removeChild(this.div))}updateAccessibleObjects(e){if(!e.visible||!e.accessibleChildren)return;e.accessible&&e.isInteractive()&&(e._accessibleActive||this.addChild(e),e.renderId=this.renderId);const t=e.children;if(t)for(let s=0;s<t.length;s++)this.updateAccessibleObjects(t[s])}update(){const e=performance.now();if(dn.android.device&&e<this.androidUpdateCount||(this.androidUpdateCount=e+this.androidUpdateFrequency,!this.renderer.renderingToScreen))return;this.renderer.lastObjectRendered&&this.updateAccessibleObjects(this.renderer.lastObjectRendered);const{x:t,y:s,width:n,height:r}=this.renderer.view.getBoundingClientRect(),{width:o,height:a,resolution:h}=this.renderer,l=n/o*h,c=r/a*h;let u=this.div;u.style.left=`${t}px`,u.style.top=`${s}px`,u.style.width=`${o}px`,u.style.height=`${a}px`;for(let f=0;f<this.children.length;f++){const d=this.children[f];if(d.renderId!==this.renderId)d._accessibleActive=!1,ao(this.children,f,1),this.div.removeChild(d._accessibleDiv),this.pool.push(d._accessibleDiv),d._accessibleDiv=null,f--;else{u=d._accessibleDiv;let m=d.hitArea;const g=d.worldTransform;d.hitArea?(u.style.left=`${(g.tx+m.x*g.a)*l}px`,u.style.top=`${(g.ty+m.y*g.d)*c}px`,u.style.width=`${m.width*g.a*l}px`,u.style.height=`${m.height*g.d*c}px`):(m=d.getBounds(),this.capHitArea(m),u.style.left=`${m.x*l}px`,u.style.top=`${m.y*c}px`,u.style.width=`${m.width*l}px`,u.style.height=`${m.height*c}px`,u.title!==d.accessibleTitle&&d.accessibleTitle!==null&&(u.title=d.accessibleTitle),u.getAttribute("aria-label")!==d.accessibleHint&&d.accessibleHint!==null&&u.setAttribute("aria-label",d.accessibleHint)),(d.accessibleTitle!==u.title||d.tabIndex!==u.tabIndex)&&(u.title=d.accessibleTitle,u.tabIndex=d.tabIndex,this.debug&&this.updateDebugHTML(u))}}this.renderId++}updateDebugHTML(e){e.innerHTML=`type: ${e.type}</br> title : ${e.title}</br> tabIndex: ${e.tabIndex}`}capHitArea(e){e.x<0&&(e.width+=e.x,e.x=0),e.y<0&&(e.height+=e.y,e.y=0);const{width:t,height:s}=this.renderer;e.x+e.width>t&&(e.width=t-e.x),e.y+e.height>s&&(e.height=s-e.y)}addChild(e){let t=this.pool.pop();t||(t=document.createElement("button"),t.style.width=`${Ga}px`,t.style.height=`${Ga}px`,t.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",t.style.position="absolute",t.style.zIndex=Om.toString(),t.style.borderStyle="none",navigator.userAgent.toLowerCase().includes("chrome")?t.setAttribute("aria-live","off"):t.setAttribute("aria-live","polite"),navigator.userAgent.match(/rv:.*Gecko\//)?t.setAttribute("aria-relevant","additions"):t.setAttribute("aria-relevant","text"),t.addEventListener("click",this._onClick.bind(this)),t.addEventListener("focus",this._onFocus.bind(this)),t.addEventListener("focusout",this._onFocusOut.bind(this))),t.style.pointerEvents=e.accessiblePointerEvents,t.type=e.accessibleType,e.accessibleTitle&&e.accessibleTitle!==null?t.title=e.accessibleTitle:(!e.accessibleHint||e.accessibleHint===null)&&(t.title=`displayObject ${e.tabIndex}`),e.accessibleHint&&e.accessibleHint!==null&&t.setAttribute("aria-label",e.accessibleHint),this.debug&&this.updateDebugHTML(t),e._accessibleActive=!0,e._accessibleDiv=t,t.displayObject=e,this.children.push(e),this.div.appendChild(e._accessibleDiv),e._accessibleDiv.tabIndex=e.tabIndex}_dispatchEvent(e,t){const{displayObject:s}=e.target,n=this.renderer.events.rootBoundary,r=Object.assign(new Ta(n),{target:s});n.rootTarget=this.renderer.lastObjectRendered,t.forEach(o=>n.dispatchEvent(r,o))}_onClick(e){this._dispatchEvent(e,["click","pointertap","tap"])}_onFocus(e){e.target.getAttribute("aria-live")||e.target.setAttribute("aria-live","assertive"),this._dispatchEvent(e,["mouseover"])}_onFocusOut(e){e.target.getAttribute("aria-live")||e.target.setAttribute("aria-live","polite"),this._dispatchEvent(e,["mouseout"])}_onKeyDown(e){e.keyCode===oT&&this.activate()}_onMouseMove(e){e.movementX===0&&e.movementY===0||this.deactivate()}destroy(){this.destroyTouchHook(),this.div=null,globalThis.document.removeEventListener("mousemove",this._onMouseMove,!0),globalThis.removeEventListener("keydown",this._onKeyDown),this.pool=null,this.children=null,this.renderer=null}}$v.extension={name:"accessibility",type:[Oe.RendererPlugin,Oe.CanvasRendererPlugin]};He.add($v);const Gv=class pd{constructor(e){this.stage=new gi,e=Object.assign({forceCanvas:!1},e),this.renderer=wS(e),pd._plugins.forEach(t=>{t.init.call(this,e)})}render(){this.renderer.render(this.stage)}get view(){var e;return(e=this.renderer)==null?void 0:e.view}get screen(){var e;return(e=this.renderer)==null?void 0:e.screen}destroy(e,t){const s=pd._plugins.slice(0);s.reverse(),s.forEach(n=>{n.destroy.call(this)}),this.stage.destroy(t),this.stage=null,this.renderer.destroy(e),this.renderer=null}};Gv._plugins=[];let jv=Gv;He.handleByList(Oe.Application,jv._plugins);class Hv{static init(e){Object.defineProperty(this,"resizeTo",{set(t){globalThis.removeEventListener("resize",this.queueResize),this._resizeTo=t,t&&(globalThis.addEventListener("resize",this.queueResize),this.resize())},get(){return this._resizeTo}}),this.queueResize=()=>{this._resizeTo&&(this.cancelResize(),this._resizeId=requestAnimationFrame(()=>this.resize()))},this.cancelResize=()=>{this._resizeId&&(cancelAnimationFrame(this._resizeId),this._resizeId=null)},this.resize=()=>{if(!this._resizeTo)return;this.cancelResize();let t,s;if(this._resizeTo===globalThis.window)t=globalThis.innerWidth,s=globalThis.innerHeight;else{const{clientWidth:n,clientHeight:r}=this._resizeTo;t=n,s=r}this.renderer.resize(t,s),this.render()},this._resizeId=null,this._resizeTo=null,this.resizeTo=e.resizeTo||null}static destroy(){globalThis.removeEventListener("resize",this.queueResize),this.cancelResize(),this.cancelResize=null,this.queueResize=null,this.resizeTo=null,this.resize=null}}Hv.extension=Oe.Application;He.add(Hv);const Lm={loader:Oe.LoadParser,resolver:Oe.ResolveParser,cache:Oe.CacheParser,detection:Oe.DetectionParser};He.handle(Oe.Asset,i=>{const e=i.ref;Object.entries(Lm).filter(([t])=>!!e[t]).forEach(([t,s])=>He.add(Object.assign(e[t],{extension:e[t].extension??s})))},i=>{const e=i.ref;Object.keys(Lm).filter(t=>!!e[t]).forEach(t=>He.remove(e[t]))});class dT{constructor(e,t=!1){this._loader=e,this._assetList=[],this._isLoading=!1,this._maxConcurrent=1,this.verbose=t}add(e){e.forEach(t=>{this._assetList.push(t)}),this.verbose&&console.log("[BackgroundLoader] assets: ",this._assetList),this._isActive&&!this._isLoading&&this._next()}async _next(){if(this._assetList.length&&this._isActive){this._isLoading=!0;const e=[],t=Math.min(this._assetList.length,this._maxConcurrent);for(let s=0;s<t;s++)e.push(this._assetList.pop());await this._loader.load(e),this._isLoading=!1,this._next()}}get active(){return this._isActive}set active(e){this._isActive!==e&&(this._isActive=e,e&&!this._isLoading&&this._next())}}function To(i,e){if(Array.isArray(e)){for(const t of e)if(i.startsWith(`data:${t}`))return!0;return!1}return i.startsWith(`data:${e}`)}function Fi(i,e){const t=i.split("?")[0],s=zt.extname(t).toLowerCase();return Array.isArray(e)?e.includes(s):s===e}const os=(i,e,t=!1)=>(Array.isArray(i)||(i=[i]),e?i.map(s=>typeof s=="string"||t?e(s):s):i),Vl=(i,e)=>{const t=e.split("?")[1];return t&&(i+=`?${t}`),i};function Wv(i,e,t,s,n){const r=e[t];for(let o=0;o<r.length;o++){const a=r[o];t<e.length-1?Wv(i.replace(s[t],a),e,t+1,s,n):n.push(i.replace(s[t],a))}}function fT(i){const e=/\{(.*?)\}/g,t=i.match(e),s=[];if(t){const n=[];t.forEach(r=>{const o=r.substring(1,r.length-1).split(",");n.push(o)}),Wv(i,n,0,t,s)}else s.push(i);return s}const Xl=i=>!Array.isArray(i);class pT{constructor(){this._parsers=[],this._cache=new Map,this._cacheMap=new Map}reset(){this._cacheMap.clear(),this._cache.clear()}has(e){return this._cache.has(e)}get(e){const t=this._cache.get(e);return t||console.warn(`[Assets] Asset id ${e} was not found in the Cache`),t}set(e,t){const s=os(e);let n;for(let a=0;a<this.parsers.length;a++){const h=this.parsers[a];if(h.test(t)){n=h.getCacheableAssets(s,t);break}}n||(n={},s.forEach(a=>{n[a]=t}));const r=Object.keys(n),o={cacheKeys:r,keys:s};if(s.forEach(a=>{this._cacheMap.set(a,o)}),r.forEach(a=>{const h=n?n[a]:t;this._cache.has(a)&&this._cache.get(a)!==h&&console.warn("[Cache] already has key:",a),this._cache.set(a,n[a])}),t instanceof et){const a=t;s.forEach(h=>{a.baseTexture!==et.EMPTY.baseTexture&&st.addToCache(a.baseTexture,h),et.addToCache(a,h)})}}remove(e){if(!this._cacheMap.has(e)){console.warn(`[Assets] Asset id ${e} was not found in the Cache`);return}const t=this._cacheMap.get(e);t.cacheKeys.forEach(s=>{this._cache.delete(s)}),t.keys.forEach(s=>{this._cacheMap.delete(s)})}get parsers(){return this._parsers}}const pr=new pT;class mT{constructor(){this._parsers=[],this._parsersValidated=!1,this.parsers=new Proxy(this._parsers,{set:(e,t,s)=>(this._parsersValidated=!1,e[t]=s,!0)}),this.promiseCache={}}reset(){this._parsersValidated=!1,this.promiseCache={}}_getLoadPromiseAndParser(e,t){const s={promise:null,parser:null};return s.promise=(async()=>{var o,a;let n=null,r=null;if(t.loadParser&&(r=this._parserHash[t.loadParser],r||console.warn(`[Assets] specified load parser "${t.loadParser}" not found while loading ${e}`)),!r){for(let h=0;h<this.parsers.length;h++){const l=this.parsers[h];if(l.load&&((o=l.test)!=null&&o.call(l,e,t,this))){r=l;break}}if(!r)return console.warn(`[Assets] ${e} could not be loaded as we don't know how to parse it, ensure the correct parser has been added`),null}n=await r.load(e,t,this),s.parser=r;for(let h=0;h<this.parsers.length;h++){const l=this.parsers[h];l.parse&&l.parse&&await((a=l.testParse)==null?void 0:a.call(l,n,t,this))&&(n=await l.parse(n,t,this)||n,s.parser=l)}return n})(),s}async load(e,t){this._parsersValidated||this._validateParsers();let s=0;const n={},r=Xl(e),o=os(e,l=>({alias:[l],src:l})),a=o.length,h=o.map(async l=>{const c=zt.toAbsolute(l.src);if(!n[l.src])try{this.promiseCache[c]||(this.promiseCache[c]=this._getLoadPromiseAndParser(c,l)),n[l.src]=await this.promiseCache[c].promise,t&&t(++s/a)}catch(u){throw delete this.promiseCache[c],delete n[l.src],new Error(`[Loader.load] Failed to load ${c}.
|
||
${u}`)}});return await Promise.all(h),r?n[o[0].src]:n}async unload(e){const t=os(e,s=>({alias:[s],src:s})).map(async s=>{var o,a;const n=zt.toAbsolute(s.src),r=this.promiseCache[n];if(r){const h=await r.promise;delete this.promiseCache[n],(a=(o=r.parser)==null?void 0:o.unload)==null||a.call(o,h,s,this)}});await Promise.all(t)}_validateParsers(){this._parsersValidated=!0,this._parserHash=this._parsers.filter(e=>e.name).reduce((e,t)=>(e[t.name]&&console.warn(`[Assets] loadParser name conflict "${t.name}"`),{...e,[t.name]:t}),{})}}var Yi=(i=>(i[i.Low=0]="Low",i[i.Normal=1]="Normal",i[i.High=2]="High",i))(Yi||{});const gT=".json",vT="application/json",yT={extension:{type:Oe.LoadParser,priority:Yi.Low},name:"loadJson",test(i){return To(i,vT)||Fi(i,gT)},async load(i){return await(await Ve.ADAPTER.fetch(i)).json()}};He.add(yT);const xT=".txt",bT="text/plain",wT={name:"loadTxt",extension:{type:Oe.LoadParser,priority:Yi.Low},test(i){return To(i,bT)||Fi(i,xT)},async load(i){return await(await Ve.ADAPTER.fetch(i)).text()}};He.add(wT);const _T=["normal","bold","100","200","300","400","500","600","700","800","900"],ST=[".ttf",".otf",".woff",".woff2"],TT=["font/ttf","font/otf","font/woff","font/woff2"],MT=/^(--|-?[A-Z_])[0-9A-Z_-]*$/i;function ET(i){const e=zt.extname(i),t=zt.basename(i,e).replace(/(-|_)/g," ").toLowerCase().split(" ").map(r=>r.charAt(0).toUpperCase()+r.slice(1));let s=t.length>0;for(const r of t)if(!r.match(MT)){s=!1;break}let n=t.join(" ");return s||(n=`"${n.replace(/[\\"]/g,"\\$&")}"`),n}const AT=/^[0-9A-Za-z%:/?#\[\]@!\$&'()\*\+,;=\-._~]*$/;function CT(i){return AT.test(i)?i:encodeURI(i)}const IT={extension:{type:Oe.LoadParser,priority:Yi.Low},name:"loadWebFont",test(i){return To(i,TT)||Fi(i,ST)},async load(i,e){var s,n,r;const t=Ve.ADAPTER.getFontFaceSet();if(t){const o=[],a=((s=e.data)==null?void 0:s.family)??ET(i),h=((r=(n=e.data)==null?void 0:n.weights)==null?void 0:r.filter(c=>_T.includes(c)))??["normal"],l=e.data??{};for(let c=0;c<h.length;c++){const u=h[c],f=new FontFace(a,`url(${CT(i)})`,{...l,weight:u});await f.load(),t.add(f),o.push(f)}return o.length===1?o[0]:o}return console.warn("[loadWebFont] FontFace API is not supported. Skipping loading font"),null},unload(i){(Array.isArray(i)?i:[i]).forEach(e=>Ve.ADAPTER.getFontFaceSet().delete(e))}};He.add(IT);const RT=`(function() {
|
||
"use strict";
|
||
const WHITE_PNG = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+ip1sAAAAASUVORK5CYII=";
|
||
async function checkImageBitmap() {
|
||
try {
|
||
if (typeof createImageBitmap != "function")
|
||
return !1;
|
||
const imageBlob = await (await fetch(WHITE_PNG)).blob(), imageBitmap = await createImageBitmap(imageBlob);
|
||
return imageBitmap.width === 1 && imageBitmap.height === 1;
|
||
} catch {
|
||
return !1;
|
||
}
|
||
}
|
||
checkImageBitmap().then((result) => {
|
||
self.postMessage(result);
|
||
});
|
||
})();
|
||
`;let co=null,md=class{constructor(){co||(co=URL.createObjectURL(new Blob([RT],{type:"application/javascript"}))),this.worker=new Worker(co)}};md.revokeObjectURL=function(){co&&(URL.revokeObjectURL(co),co=null)};const PT=`(function() {
|
||
"use strict";
|
||
async function loadImageBitmap(url) {
|
||
const response = await fetch(url);
|
||
if (!response.ok)
|
||
throw new Error(\`[WorkerManager.loadImageBitmap] Failed to fetch \${url}: \${response.status} \${response.statusText}\`);
|
||
const imageBlob = await response.blob();
|
||
return await createImageBitmap(imageBlob);
|
||
}
|
||
self.onmessage = async (event) => {
|
||
try {
|
||
const imageBitmap = await loadImageBitmap(event.data.data[0]);
|
||
self.postMessage({
|
||
data: imageBitmap,
|
||
uuid: event.data.uuid,
|
||
id: event.data.id
|
||
}, [imageBitmap]);
|
||
} catch (e) {
|
||
self.postMessage({
|
||
error: e,
|
||
uuid: event.data.uuid,
|
||
id: event.data.id
|
||
});
|
||
}
|
||
};
|
||
})();
|
||
`;let uo=null;class zv{constructor(){uo||(uo=URL.createObjectURL(new Blob([PT],{type:"application/javascript"}))),this.worker=new Worker(uo)}}zv.revokeObjectURL=function(){uo&&(URL.revokeObjectURL(uo),uo=null)};let Dm=0,uu;class kT{constructor(){this._initialized=!1,this._createdWorkers=0,this.workerPool=[],this.queue=[],this.resolveHash={}}isImageBitmapSupported(){return this._isImageBitmapSupported!==void 0?this._isImageBitmapSupported:(this._isImageBitmapSupported=new Promise(e=>{const{worker:t}=new md;t.addEventListener("message",s=>{t.terminate(),md.revokeObjectURL(),e(s.data)})}),this._isImageBitmapSupported)}loadImageBitmap(e){return this._run("loadImageBitmap",[e])}async _initWorkers(){this._initialized||(this._initialized=!0)}getWorker(){uu===void 0&&(uu=navigator.hardwareConcurrency||4);let e=this.workerPool.pop();return!e&&this._createdWorkers<uu&&(this._createdWorkers++,e=new zv().worker,e.addEventListener("message",t=>{this.complete(t.data),this.returnWorker(t.target),this.next()})),e}returnWorker(e){this.workerPool.push(e)}complete(e){e.error!==void 0?this.resolveHash[e.uuid].reject(e.error):this.resolveHash[e.uuid].resolve(e.data),this.resolveHash[e.uuid]=null}async _run(e,t){await this._initWorkers();const s=new Promise((n,r)=>{this.queue.push({id:e,arguments:t,resolve:n,reject:r})});return this.next(),s}next(){if(!this.queue.length)return;const e=this.getWorker();if(!e)return;const t=this.queue.pop(),s=t.id;this.resolveHash[Dm]={resolve:t.resolve,reject:t.reject},e.postMessage({data:t.arguments,uuid:Dm++,id:s})}}const Nm=new kT;function Ma(i,e,t){i.resource.internal=!0;const s=new et(i),n=()=>{delete e.promiseCache[t],pr.has(t)&&pr.remove(t)};return s.baseTexture.once("destroyed",()=>{t in e.promiseCache&&(console.warn("[Assets] A BaseTexture managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the BaseTexture."),n())}),s.once("destroyed",()=>{i.destroyed||(console.warn("[Assets] A Texture managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the Texture."),n())}),s}const FT=[".jpeg",".jpg",".png",".webp",".avif"],OT=["image/jpeg","image/png","image/webp","image/avif"];async function BT(i){const e=await Ve.ADAPTER.fetch(i);if(!e.ok)throw new Error(`[loadImageBitmap] Failed to fetch ${i}: ${e.status} ${e.statusText}`);const t=await e.blob();return await createImageBitmap(t)}const Fh={name:"loadTextures",extension:{type:Oe.LoadParser,priority:Yi.High},config:{preferWorkers:!0,preferCreateImageBitmap:!0,crossOrigin:"anonymous"},test(i){return To(i,OT)||Fi(i,FT)},async load(i,e,t){var a;const s=globalThis.createImageBitmap&&this.config.preferCreateImageBitmap;let n;s?this.config.preferWorkers&&await Nm.isImageBitmapSupported()?n=await Nm.loadImageBitmap(i):n=await BT(i):n=await new Promise((h,l)=>{const c=new Image;c.crossOrigin=this.config.crossOrigin,c.src=i,c.complete?h(c):(c.onload=()=>h(c),c.onerror=u=>l(u))});const r={...e.data};r.resolution??(r.resolution=_n(i)),s&&((a=r.resourceOptions)==null?void 0:a.ownsImageBitmap)===void 0&&(r.resourceOptions={...r.resourceOptions},r.resourceOptions.ownsImageBitmap=!0);const o=new st(n,r);return o.resource.src=i,Ma(o,t,i)},unload(i){i.destroy(!0)}};He.add(Fh);const LT=".svg",DT="image/svg+xml",NT={extension:{type:Oe.LoadParser,priority:Yi.High},name:"loadSVG",test(i){return To(i,DT)||Fi(i,LT)},async testParse(i){return rd.test(i)},async parse(i,e,t){var r;const s=new rd(i,(r=e==null?void 0:e.data)==null?void 0:r.resourceOptions);await s.load();const n=new st(s,{resolution:_n(i),...e==null?void 0:e.data});return n.resource.src=e.src,Ma(n,t,e.src)},async load(i,e){return(await Ve.ADAPTER.fetch(i)).text()},unload:Fh.unload};He.add(NT);const UT=[".mp4",".m4v",".webm",".ogv"],VT=["video/mp4","video/webm","video/ogg"],XT={name:"loadVideo",extension:{type:Oe.LoadParser,priority:Yi.High},config:{defaultAutoPlay:!0,defaultUpdateFPS:0,defaultLoop:!1,defaultMuted:!1,defaultPlaysinline:!0},test(i){return To(i,VT)||Fi(i,UT)},async load(i,e,t){var o;let s;const n=await(await Ve.ADAPTER.fetch(i)).blob(),r=URL.createObjectURL(n);try{const a={autoPlay:this.config.defaultAutoPlay,updateFPS:this.config.defaultUpdateFPS,loop:this.config.defaultLoop,muted:this.config.defaultMuted,playsinline:this.config.defaultPlaysinline,...(o=e==null?void 0:e.data)==null?void 0:o.resourceOptions,autoLoad:!0},h=new Vv(r,a);await h.load();const l=new st(h,{alphaMode:await zw(),resolution:_n(i),...e==null?void 0:e.data});l.resource.src=i,s=Ma(l,t,i),s.baseTexture.once("destroyed",()=>{URL.revokeObjectURL(r)})}catch(a){throw URL.revokeObjectURL(r),a}return s},unload(i){i.destroy(!0)}};He.add(XT);class YT{constructor(){this._defaultBundleIdentifierOptions={connector:"-",createBundleAssetId:(e,t)=>`${e}${this._bundleIdConnector}${t}`,extractAssetIdFromBundle:(e,t)=>t.replace(`${e}${this._bundleIdConnector}`,"")},this._bundleIdConnector=this._defaultBundleIdentifierOptions.connector,this._createBundleAssetId=this._defaultBundleIdentifierOptions.createBundleAssetId,this._extractAssetIdFromBundle=this._defaultBundleIdentifierOptions.extractAssetIdFromBundle,this._assetMap={},this._preferredOrder=[],this._parsers=[],this._resolverHash={},this._bundles={}}setBundleIdentifier(e){if(this._bundleIdConnector=e.connector??this._bundleIdConnector,this._createBundleAssetId=e.createBundleAssetId??this._createBundleAssetId,this._extractAssetIdFromBundle=e.extractAssetIdFromBundle??this._extractAssetIdFromBundle,this._extractAssetIdFromBundle("foo",this._createBundleAssetId("foo","bar"))!=="bar")throw new Error("[Resolver] GenerateBundleAssetId are not working correctly")}prefer(...e){e.forEach(t=>{this._preferredOrder.push(t),t.priority||(t.priority=Object.keys(t.params))}),this._resolverHash={}}set basePath(e){this._basePath=e}get basePath(){return this._basePath}set rootPath(e){this._rootPath=e}get rootPath(){return this._rootPath}get parsers(){return this._parsers}reset(){this.setBundleIdentifier(this._defaultBundleIdentifierOptions),this._assetMap={},this._preferredOrder=[],this._resolverHash={},this._rootPath=null,this._basePath=null,this._manifest=null,this._bundles={},this._defaultSearchParams=null}setDefaultSearchParams(e){if(typeof e=="string")this._defaultSearchParams=e;else{const t=e;this._defaultSearchParams=Object.keys(t).map(s=>`${encodeURIComponent(s)}=${encodeURIComponent(t[s])}`).join("&")}}getAlias(e){const{alias:t,name:s,src:n,srcs:r}=e;return os(t||s||n||r,o=>typeof o=="string"?o:Array.isArray(o)?o.map(a=>(a==null?void 0:a.src)??(a==null?void 0:a.srcs)??a):o!=null&&o.src||o!=null&&o.srcs?o.src??o.srcs:o,!0)}addManifest(e){this._manifest&&console.warn("[Resolver] Manifest already exists, this will be overwritten"),this._manifest=e,e.bundles.forEach(t=>{this.addBundle(t.name,t.assets)})}addBundle(e,t){const s=[];Array.isArray(t)?t.forEach(n=>{const r=n.src??n.srcs,o=n.alias??n.name;let a;if(typeof o=="string"){const h=this._createBundleAssetId(e,o);s.push(h),a=[o,h]}else{const h=o.map(l=>this._createBundleAssetId(e,l));s.push(...h),a=[...o,...h]}this.add({...n,alias:a,src:r})}):Object.keys(t).forEach(n=>{const r=[n,this._createBundleAssetId(e,n)];if(typeof t[n]=="string")this.add({alias:r,src:t[n]});else if(Array.isArray(t[n]))this.add({alias:r,src:t[n]});else{const o=t[n],a=o.src??o.srcs;this.add({...o,alias:r,src:Array.isArray(a)?a:[a]})}s.push(...r)}),this._bundles[e]=s}add(e,t,s,n,r){const o=[];typeof e=="string"||Array.isArray(e)&&typeof e[0]=="string"?(pt("7.2.0",`Assets.add now uses an object instead of individual parameters.
|
||
Please use Assets.add({ alias, src, data, format, loadParser }) instead.`),o.push({alias:e,src:t,data:s,format:n,loadParser:r})):Array.isArray(e)?o.push(...e):o.push(e);let a;a=h=>{this.hasKey(h)&&console.warn(`[Resolver] already has key: ${h} overwriting`)},os(o).forEach(h=>{const{src:l,srcs:c}=h;let{data:u,format:f,loadParser:d}=h;const m=os(l||c).map(_=>typeof _=="string"?fT(_):Array.isArray(_)?_:[_]),g=this.getAlias(h);Array.isArray(g)?g.forEach(a):a(g);const b=[];m.forEach(_=>{_.forEach(M=>{let v={};if(typeof M!="object"){v.src=M;for(let S=0;S<this._parsers.length;S++){const y=this._parsers[S];if(y.test(M)){v=y.parse(M);break}}}else u=M.data??u,f=M.format??f,d=M.loadParser??d,v={...v,...M};if(!g)throw new Error(`[Resolver] alias is undefined for this asset: ${v.src}`);v=this.buildResolvedAsset(v,{aliases:g,data:u,format:f,loadParser:d}),b.push(v)})}),g.forEach(_=>{this._assetMap[_]=b})})}resolveBundle(e){const t=Xl(e);e=os(e);const s={};return e.forEach(n=>{const r=this._bundles[n];if(r){const o=this.resolve(r),a={};for(const h in o){const l=o[h];a[this._extractAssetIdFromBundle(n,h)]=l}s[n]=a}}),t?s[e[0]]:s}resolveUrl(e){const t=this.resolve(e);if(typeof e!="string"){const s={};for(const n in t)s[n]=t[n].src;return s}return t.src}resolve(e){const t=Xl(e);e=os(e);const s={};return e.forEach(n=>{if(!this._resolverHash[n])if(this._assetMap[n]){let r=this._assetMap[n];const o=r[0],a=this._getPreferredOrder(r);a==null||a.priority.forEach(h=>{a.params[h].forEach(l=>{const c=r.filter(u=>u[h]?u[h]===l:!1);c.length&&(r=c)})}),this._resolverHash[n]=r[0]??o}else this._resolverHash[n]=this.buildResolvedAsset({alias:[n],src:n},{});s[n]=this._resolverHash[n]}),t?s[e[0]]:s}hasKey(e){return!!this._assetMap[e]}hasBundle(e){return!!this._bundles[e]}_getPreferredOrder(e){for(let t=0;t<e.length;t++){const s=e[0],n=this._preferredOrder.find(r=>r.params.format.includes(s.format));if(n)return n}return this._preferredOrder[0]}_appendDefaultSearchParams(e){if(!this._defaultSearchParams)return e;const t=/\?/.test(e)?"&":"?";return`${e}${t}${this._defaultSearchParams}`}buildResolvedAsset(e,t){const{aliases:s,data:n,loadParser:r,format:o}=t;return(this._basePath||this._rootPath)&&(e.src=zt.toAbsolute(e.src,this._basePath,this._rootPath)),e.alias=s??e.alias??[e.src],e.src=this._appendDefaultSearchParams(e.src),e.data={...n||{},...e.data},e.loadParser=r??e.loadParser,e.format=o??e.format??zt.extname(e.src).slice(1),e.srcs=e.src,e.name=e.alias,e}}class $T{constructor(){this._detections=[],this._initialized=!1,this.resolver=new YT,this.loader=new mT,this.cache=pr,this._backgroundLoader=new dT(this.loader),this._backgroundLoader.active=!0,this.reset()}async init(e={}){var r,o;if(this._initialized){console.warn("[Assets]AssetManager already initialized, did you load before calling this Assets.init()?");return}if(this._initialized=!0,e.defaultSearchParams&&this.resolver.setDefaultSearchParams(e.defaultSearchParams),e.basePath&&(this.resolver.basePath=e.basePath),e.bundleIdentifier&&this.resolver.setBundleIdentifier(e.bundleIdentifier),e.manifest){let a=e.manifest;typeof a=="string"&&(a=await this.load(a)),this.resolver.addManifest(a)}const t=((r=e.texturePreference)==null?void 0:r.resolution)??1,s=typeof t=="number"?[t]:t,n=await this._detectFormats({preferredFormats:(o=e.texturePreference)==null?void 0:o.format,skipDetections:e.skipDetections,detections:this._detections});this.resolver.prefer({params:{format:n,resolution:s}}),e.preferences&&this.setPreferences(e.preferences)}add(e,t,s,n,r){this.resolver.add(e,t,s,n,r)}async load(e,t){this._initialized||await this.init();const s=Xl(e),n=os(e).map(a=>{if(typeof a!="string"){const h=this.resolver.getAlias(a);return h.some(l=>!this.resolver.hasKey(l))&&this.add(a),Array.isArray(h)?h[0]:h}return this.resolver.hasKey(a)||this.add({alias:a,src:a}),a}),r=this.resolver.resolve(n),o=await this._mapLoadToResolve(r,t);return s?o[n[0]]:o}addBundle(e,t){this.resolver.addBundle(e,t)}async loadBundle(e,t){this._initialized||await this.init();let s=!1;typeof e=="string"&&(s=!0,e=[e]);const n=this.resolver.resolveBundle(e),r={},o=Object.keys(n);let a=0,h=0;const l=()=>{t==null||t(++a/h)},c=o.map(u=>{const f=n[u];return h+=Object.keys(f).length,this._mapLoadToResolve(f,l).then(d=>{r[u]=d})});return await Promise.all(c),s?r[e[0]]:r}async backgroundLoad(e){this._initialized||await this.init(),typeof e=="string"&&(e=[e]);const t=this.resolver.resolve(e);this._backgroundLoader.add(Object.values(t))}async backgroundLoadBundle(e){this._initialized||await this.init(),typeof e=="string"&&(e=[e]);const t=this.resolver.resolveBundle(e);Object.values(t).forEach(s=>{this._backgroundLoader.add(Object.values(s))})}reset(){this.resolver.reset(),this.loader.reset(),this.cache.reset(),this._initialized=!1}get(e){if(typeof e=="string")return pr.get(e);const t={};for(let s=0;s<e.length;s++)t[s]=pr.get(e[s]);return t}async _mapLoadToResolve(e,t){const s=Object.values(e),n=Object.keys(e);this._backgroundLoader.active=!1;const r=await this.loader.load(s,t);this._backgroundLoader.active=!0;const o={};return s.forEach((a,h)=>{const l=r[a.src],c=[a.src];a.alias&&c.push(...a.alias),o[n[h]]=l,pr.set(c,l)}),o}async unload(e){this._initialized||await this.init();const t=os(e).map(n=>typeof n!="string"?n.src:n),s=this.resolver.resolve(t);await this._unloadFromResolved(s)}async unloadBundle(e){this._initialized||await this.init(),e=os(e);const t=this.resolver.resolveBundle(e),s=Object.keys(t).map(n=>this._unloadFromResolved(t[n]));await Promise.all(s)}async _unloadFromResolved(e){const t=Object.values(e);t.forEach(s=>{pr.remove(s.src)}),await this.loader.unload(t)}async _detectFormats(e){let t=[];e.preferredFormats&&(t=Array.isArray(e.preferredFormats)?e.preferredFormats:[e.preferredFormats]);for(const s of e.detections)e.skipDetections||await s.test()?t=await s.add(t):e.skipDetections||(t=await s.remove(t));return t=t.filter((s,n)=>t.indexOf(s)===n),t}get detections(){return this._detections}get preferWorkers(){return Fh.config.preferWorkers}set preferWorkers(e){pt("7.2.0","Assets.prefersWorkers is deprecated, use Assets.setPreferences({ preferWorkers: true }) instead."),this.setPreferences({preferWorkers:e})}setPreferences(e){this.loader.parsers.forEach(t=>{t.config&&Object.keys(t.config).filter(s=>s in e).forEach(s=>{t.config[s]=e[s]})})}}const Xs=new $T;He.handleByList(Oe.LoadParser,Xs.loader.parsers).handleByList(Oe.ResolveParser,Xs.resolver.parsers).handleByList(Oe.CacheParser,Xs.cache.parsers).handleByList(Oe.DetectionParser,Xs.detections);const GT={extension:Oe.CacheParser,test:i=>Array.isArray(i)&&i.every(e=>e instanceof et),getCacheableAssets:(i,e)=>{const t={};return i.forEach(s=>{e.forEach((n,r)=>{t[s+(r===0?"":r+1)]=n})}),t}};He.add(GT);async function qv(i){if("Image"in globalThis)return new Promise(e=>{const t=new Image;t.onload=()=>{e(!0)},t.onerror=()=>{e(!1)},t.src=i});if("createImageBitmap"in globalThis&&"fetch"in globalThis){try{const e=await(await fetch(i)).blob();await createImageBitmap(e)}catch{return!1}return!0}return!1}const jT={extension:{type:Oe.DetectionParser,priority:1},test:async()=>qv("data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A="),add:async i=>[...i,"avif"],remove:async i=>i.filter(e=>e!=="avif")};He.add(jT);const HT={extension:{type:Oe.DetectionParser,priority:0},test:async()=>qv("data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA="),add:async i=>[...i,"webp"],remove:async i=>i.filter(e=>e!=="webp")};He.add(HT);const Um=["png","jpg","jpeg"],WT={extension:{type:Oe.DetectionParser,priority:-1},test:()=>Promise.resolve(!0),add:async i=>[...i,...Um],remove:async i=>i.filter(e=>!Um.includes(e))};He.add(WT);const zT="WorkerGlobalScope"in globalThis&&globalThis instanceof globalThis.WorkerGlobalScope;function rf(i){return zT?!1:document.createElement("video").canPlayType(i)!==""}const qT={extension:{type:Oe.DetectionParser,priority:0},test:async()=>rf("video/webm"),add:async i=>[...i,"webm"],remove:async i=>i.filter(e=>e!=="webm")};He.add(qT);const KT={extension:{type:Oe.DetectionParser,priority:0},test:async()=>rf("video/mp4"),add:async i=>[...i,"mp4","m4v"],remove:async i=>i.filter(e=>e!=="mp4"&&e!=="m4v")};He.add(KT);const ZT={extension:{type:Oe.DetectionParser,priority:0},test:async()=>rf("video/ogg"),add:async i=>[...i,"ogv"],remove:async i=>i.filter(e=>e!=="ogv")};He.add(ZT);const JT={extension:Oe.ResolveParser,test:Fh.test,parse:i=>{var e;return{resolution:parseFloat(((e=Ve.RETINA_PREFIX.exec(i))==null?void 0:e[1])??"1"),format:zt.extname(i).slice(1),src:i}}};He.add(JT);var di=(i=>(i[i.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",i[i.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",i[i.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",i[i.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",i[i.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT=35917]="COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT",i[i.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT=35918]="COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT",i[i.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT=35919]="COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT",i[i.COMPRESSED_SRGB_S3TC_DXT1_EXT=35916]="COMPRESSED_SRGB_S3TC_DXT1_EXT",i[i.COMPRESSED_R11_EAC=37488]="COMPRESSED_R11_EAC",i[i.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",i[i.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",i[i.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",i[i.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",i[i.COMPRESSED_RGBA8_ETC2_EAC=37496]="COMPRESSED_RGBA8_ETC2_EAC",i[i.COMPRESSED_SRGB8_ETC2=37493]="COMPRESSED_SRGB8_ETC2",i[i.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37497]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC",i[i.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37494]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",i[i.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37495]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",i[i.COMPRESSED_RGB_PVRTC_4BPPV1_IMG=35840]="COMPRESSED_RGB_PVRTC_4BPPV1_IMG",i[i.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG=35842]="COMPRESSED_RGBA_PVRTC_4BPPV1_IMG",i[i.COMPRESSED_RGB_PVRTC_2BPPV1_IMG=35841]="COMPRESSED_RGB_PVRTC_2BPPV1_IMG",i[i.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG=35843]="COMPRESSED_RGBA_PVRTC_2BPPV1_IMG",i[i.COMPRESSED_RGB_ETC1_WEBGL=36196]="COMPRESSED_RGB_ETC1_WEBGL",i[i.COMPRESSED_RGB_ATC_WEBGL=35986]="COMPRESSED_RGB_ATC_WEBGL",i[i.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL=35987]="COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL",i[i.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL=34798]="COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL",i[i.COMPRESSED_RGBA_ASTC_4x4_KHR=37808]="COMPRESSED_RGBA_ASTC_4x4_KHR",i[i.COMPRESSED_RGBA_BPTC_UNORM_EXT=36492]="COMPRESSED_RGBA_BPTC_UNORM_EXT",i[i.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT=36493]="COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT",i[i.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT=36494]="COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT",i[i.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT=36495]="COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT",i))(di||{});const Yl={33776:.5,33777:.5,33778:1,33779:1,35916:.5,35917:.5,35918:1,35919:1,37488:.5,37489:.5,37490:1,37491:1,37492:.5,37496:1,37493:.5,37497:1,37494:.5,37495:.5,35840:.5,35842:.5,35841:.25,35843:.25,36196:.5,35986:.5,35987:1,34798:1,37808:1,36492:1,36493:1,36494:1,36495:1};let Es,zr;function Vm(){zr={bptc:Es.getExtension("EXT_texture_compression_bptc"),astc:Es.getExtension("WEBGL_compressed_texture_astc"),etc:Es.getExtension("WEBGL_compressed_texture_etc"),s3tc:Es.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:Es.getExtension("WEBGL_compressed_texture_s3tc_srgb"),pvrtc:Es.getExtension("WEBGL_compressed_texture_pvrtc")||Es.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),etc1:Es.getExtension("WEBGL_compressed_texture_etc1"),atc:Es.getExtension("WEBGL_compressed_texture_atc")}}const QT={extension:{type:Oe.DetectionParser,priority:2},test:async()=>{const i=Ve.ADAPTER.createCanvas().getContext("webgl");return i?(Es=i,!0):(console.warn("WebGL not available for compressed textures."),!1)},add:async i=>{zr||Vm();const e=[];for(const t in zr)zr[t]&&e.push(t);return[...e,...i]},remove:async i=>(zr||Vm(),i.filter(e=>!(e in zr)))};He.add(QT);class eM extends Ch{constructor(e,t={width:1,height:1,autoLoad:!0}){let s,n;typeof e=="string"?(s=e,n=new Uint8Array):(s=null,n=e),super(n,t),this.origin=s,this.buffer=n?new Hu(n):null,this._load=null,this.loaded=!1,this.origin!==null&&t.autoLoad!==!1&&this.load(),this.origin===null&&this.buffer&&(this._load=Promise.resolve(this),this.loaded=!0,this.onBlobLoaded(this.buffer.rawBinaryData))}onBlobLoaded(e){}load(){return this._load?this._load:(this._load=fetch(this.origin).then(e=>e.blob()).then(e=>e.arrayBuffer()).then(e=>(this.data=new Uint32Array(e),this.buffer=new Hu(e),this.loaded=!0,this.onBlobLoaded(e),this.update(),this)),this._load)}}class yr extends eM{constructor(e,t){super(e,t),this.format=t.format,this.levels=t.levels||1,this._width=t.width,this._height=t.height,this._extension=yr._formatToExtension(this.format),(t.levelBuffers||this.buffer)&&(this._levelBuffers=t.levelBuffers||yr._createLevelBuffers(e instanceof Uint8Array?e:this.buffer.uint8View,this.format,this.levels,4,4,this.width,this.height))}upload(e,t,s){const n=e.gl;if(!e.context.extensions[this._extension])throw new Error(`${this._extension} textures are not supported on the current machine`);if(!this._levelBuffers)return!1;n.pixelStorei(n.UNPACK_ALIGNMENT,4);for(let r=0,o=this.levels;r<o;r++){const{levelID:a,levelWidth:h,levelHeight:l,levelBuffer:c}=this._levelBuffers[r];n.compressedTexImage2D(n.TEXTURE_2D,a,this.format,h,l,0,c)}return!0}onBlobLoaded(){this._levelBuffers=yr._createLevelBuffers(this.buffer.uint8View,this.format,this.levels,4,4,this.width,this.height)}static _formatToExtension(e){if(e>=33776&&e<=33779)return"s3tc";if(e>=35916&&e<=35919)return"s3tc_sRGB";if(e>=37488&&e<=37497)return"etc";if(e>=35840&&e<=35843)return"pvrtc";if(e===36196)return"etc1";if(e===35986||e===35987||e===34798)return"atc";if(e>=36492&&e<=36495)return"bptc";if(e===37808)return"astc";throw new Error(`Invalid (compressed) texture format given: ${e}`)}static _createLevelBuffers(e,t,s,n,r,o,a){const h=new Array(s);let l=e.byteOffset,c=o,u=a,f=c+n-1&~(n-1),d=u+r-1&~(r-1),m=f*d*Yl[t];for(let g=0;g<s;g++)h[g]={levelID:g,levelWidth:s>1?c:f,levelHeight:s>1?u:d,levelBuffer:new Uint8Array(e.buffer,l,m)},l+=m,c=c>>1||1,u=u>>1||1,f=c+n-1&~(n-1),d=u+r-1&~(r-1),m=f*d*Yl[t];return h}}const du=4,ja=124,tM=32,Xm=20,iM=542327876,Ha={HEIGHT:3,WIDTH:4,MIPMAP_COUNT:7,PIXEL_FORMAT:19},sM={FOURCC:2},Wa={DXGI_FORMAT:0,RESOURCE_DIMENSION:1,MISC_FLAG:2,ARRAY_SIZE:3},nM=1,rM=2,oM=4,aM=64,lM=512,hM=131072,cM=827611204,uM=861165636,dM=894720068,fM=808540228,pM=4,mM={[cM]:di.COMPRESSED_RGBA_S3TC_DXT1_EXT,[uM]:di.COMPRESSED_RGBA_S3TC_DXT3_EXT,[dM]:di.COMPRESSED_RGBA_S3TC_DXT5_EXT},gM={70:di.COMPRESSED_RGBA_S3TC_DXT1_EXT,71:di.COMPRESSED_RGBA_S3TC_DXT1_EXT,73:di.COMPRESSED_RGBA_S3TC_DXT3_EXT,74:di.COMPRESSED_RGBA_S3TC_DXT3_EXT,76:di.COMPRESSED_RGBA_S3TC_DXT5_EXT,77:di.COMPRESSED_RGBA_S3TC_DXT5_EXT,72:di.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,75:di.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,78:di.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT,96:di.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT,95:di.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT,98:di.COMPRESSED_RGBA_BPTC_UNORM_EXT,99:di.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT};function vM(i){const e=new Uint32Array(i);if(e[0]!==iM)throw new Error("Invalid DDS file magic word");const t=new Uint32Array(i,0,ja/Uint32Array.BYTES_PER_ELEMENT),s=t[Ha.HEIGHT],n=t[Ha.WIDTH],r=t[Ha.MIPMAP_COUNT],o=new Uint32Array(i,Ha.PIXEL_FORMAT*Uint32Array.BYTES_PER_ELEMENT,tM/Uint32Array.BYTES_PER_ELEMENT),a=o[nM];if(a&oM){const h=o[sM.FOURCC];if(h!==fM){const M=mM[h],v=du+ja,S=new Uint8Array(i,v);return[new yr(S,{format:M,width:n,height:s,levels:r})]}const l=du+ja,c=new Uint32Array(e.buffer,l,Xm/Uint32Array.BYTES_PER_ELEMENT),u=c[Wa.DXGI_FORMAT],f=c[Wa.RESOURCE_DIMENSION],d=c[Wa.MISC_FLAG],m=c[Wa.ARRAY_SIZE],g=gM[u];if(g===void 0)throw new Error(`DDSParser cannot parse texture data with DXGI format ${u}`);if(d===pM)throw new Error("DDSParser does not support cubemap textures");if(f===6)throw new Error("DDSParser does not supported 3D texture data");const b=new Array,_=du+ja+Xm;if(m===1)b.push(new Uint8Array(i,_));else{const M=Yl[g];let v=0,S=n,y=s;for(let E=0;E<r;E++){const C=Math.max(1,S+3&-4),R=Math.max(1,y+3&-4),B=C*R*M;v+=B,S=S>>>1,y=y>>>1}let I=_;for(let E=0;E<m;E++)b.push(new Uint8Array(i,I,v)),I+=v}return b.map(M=>new yr(M,{format:g,width:n,height:s,levels:r}))}throw a&aM?new Error("DDSParser does not support uncompressed texture data."):a&lM?new Error("DDSParser does not supported YUV uncompressed texture data."):a&hM?new Error("DDSParser does not support single-channel (lumninance) texture data!"):a&rM?new Error("DDSParser does not support single-channel (alpha) texture data!"):new Error("DDSParser failed to load a texture file due to an unknown reason!")}const Ym=[171,75,84,88,32,49,49,187,13,10,26,10],yM=67305985,is={ENDIANNESS:12,GL_TYPE:16,GL_FORMAT:24,GL_INTERNAL_FORMAT:28,PIXEL_WIDTH:36,PIXEL_HEIGHT:40,PIXEL_DEPTH:44,NUMBER_OF_ARRAY_ELEMENTS:48,NUMBER_OF_FACES:52,NUMBER_OF_MIPMAP_LEVELS:56,BYTES_OF_KEY_VALUE_DATA:60},gd=64,$m={[je.UNSIGNED_BYTE]:1,[je.UNSIGNED_SHORT]:2,[je.INT]:4,[je.UNSIGNED_INT]:4,[je.FLOAT]:4,[je.HALF_FLOAT]:8},xM={[Re.RGBA]:4,[Re.RGB]:3,[Re.RG]:2,[Re.RED]:1,[Re.LUMINANCE]:1,[Re.LUMINANCE_ALPHA]:2,[Re.ALPHA]:1},bM={[je.UNSIGNED_SHORT_4_4_4_4]:2,[je.UNSIGNED_SHORT_5_5_5_1]:2,[je.UNSIGNED_SHORT_5_6_5]:2};function wM(i,e,t=!1){const s=new DataView(e);if(!_M(i,s))return null;const n=s.getUint32(is.ENDIANNESS,!0)===yM,r=s.getUint32(is.GL_TYPE,n),o=s.getUint32(is.GL_FORMAT,n),a=s.getUint32(is.GL_INTERNAL_FORMAT,n),h=s.getUint32(is.PIXEL_WIDTH,n),l=s.getUint32(is.PIXEL_HEIGHT,n)||1,c=s.getUint32(is.PIXEL_DEPTH,n)||1,u=s.getUint32(is.NUMBER_OF_ARRAY_ELEMENTS,n)||1,f=s.getUint32(is.NUMBER_OF_FACES,n),d=s.getUint32(is.NUMBER_OF_MIPMAP_LEVELS,n),m=s.getUint32(is.BYTES_OF_KEY_VALUE_DATA,n);if(l===0||c!==1)throw new Error("Only 2D textures are supported");if(f!==1)throw new Error("CubeTextures are not supported by KTXLoader yet!");if(u!==1)throw new Error("WebGL does not support array textures");const g=4,b=4,_=h+3&-4,M=l+3&-4,v=new Array(u);let S=h*l;r===0&&(S=_*M);let y;if(r!==0?$m[r]?y=$m[r]*xM[o]:y=bM[r]:y=Yl[a],y===void 0)throw new Error("Unable to resolve the pixel format stored in the *.ktx file!");const I=t?TM(s,m,n):null;let E=S*y,C=h,R=l,B=_,k=M,F=gd+m;for(let D=0;D<d;D++){const N=s.getUint32(F,n);let j=F+4;for(let O=0;O<u;O++){let L=v[O];L||(L=v[O]=new Array(d)),L[D]={levelID:D,levelWidth:d>1||r!==0?C:B,levelHeight:d>1||r!==0?R:k,levelBuffer:new Uint8Array(e,j,E)},j+=E}F+=N+4,F=F%4!==0?F+4-F%4:F,C=C>>1||1,R=R>>1||1,B=C+g-1&-4,k=R+b-1&-4,E=B*k*y}return r!==0?{uncompressed:v.map(D=>{let N=D[0].levelBuffer,j=!1;return r===je.FLOAT?N=new Float32Array(D[0].levelBuffer.buffer,D[0].levelBuffer.byteOffset,D[0].levelBuffer.byteLength/4):r===je.UNSIGNED_INT?(j=!0,N=new Uint32Array(D[0].levelBuffer.buffer,D[0].levelBuffer.byteOffset,D[0].levelBuffer.byteLength/4)):r===je.INT&&(j=!0,N=new Int32Array(D[0].levelBuffer.buffer,D[0].levelBuffer.byteOffset,D[0].levelBuffer.byteLength/4)),{resource:new Ch(N,{width:D[0].levelWidth,height:D[0].levelHeight}),type:r,format:j?SM(o):o}}),kvData:I}:{compressed:v.map(D=>new yr(null,{format:a,width:h,height:l,levels:d,levelBuffers:D})),kvData:I}}function _M(i,e){for(let t=0;t<Ym.length;t++)if(e.getUint8(t)!==Ym[t])return console.error(`${i} is not a valid *.ktx file!`),!1;return!0}function SM(i){switch(i){case Re.RGBA:return Re.RGBA_INTEGER;case Re.RGB:return Re.RGB_INTEGER;case Re.RG:return Re.RG_INTEGER;case Re.RED:return Re.RED_INTEGER;default:return i}}function TM(i,e,t){const s=new Map;let n=0;for(;n<e;){const r=i.getUint32(gd+n,t),o=gd+n+4,a=3-(r+3)%4;if(r===0||r>e-n){console.error("KTXLoader: keyAndValueByteSize out of bounds");break}let h=0;for(;h<r&&i.getUint8(o+h)!==0;h++);if(h===-1){console.error("KTXLoader: Failed to find null byte terminating kvData key");break}const l=new TextDecoder().decode(new Uint8Array(i.buffer,o,h)),c=new DataView(i.buffer,o+h+1,r-h-1);s.set(l,c),n+=4+r+a}return s}const MM={extension:{type:Oe.LoadParser,priority:Yi.High},name:"loadDDS",test(i){return Fi(i,".dds")},async load(i,e,t){const s=await(await Ve.ADAPTER.fetch(i)).arrayBuffer(),n=vM(s).map(r=>{const o=new st(r,{mipmap:Ki.OFF,alphaMode:ui.NO_PREMULTIPLIED_ALPHA,resolution:_n(i),...e.data});return Ma(o,t,i)});return n.length===1?n[0]:n},unload(i){Array.isArray(i)?i.forEach(e=>e.destroy(!0)):i.destroy(!0)}};He.add(MM);const EM={extension:{type:Oe.LoadParser,priority:Yi.High},name:"loadKTX",test(i){return Fi(i,".ktx")},async load(i,e,t){const s=await(await Ve.ADAPTER.fetch(i)).arrayBuffer(),{compressed:n,uncompressed:r,kvData:o}=wM(i,s),a=n??r,h={mipmap:Ki.OFF,alphaMode:ui.NO_PREMULTIPLIED_ALPHA,resolution:_n(i),...e.data},l=a.map(c=>{a===r&&Object.assign(h,{type:c.type,format:c.format});const u=c.resource??c,f=new st(u,h);return f.ktxKeyValueData=o,Ma(f,t,i)});return l.length===1?l[0]:l},unload(i){Array.isArray(i)?i.forEach(e=>e.destroy(!0)):i.destroy(!0)}};He.add(EM);const AM=["s3tc","s3tc_sRGB","etc","etc1","pvrtc","atc","astc","bptc"],CM={extension:Oe.ResolveParser,test:i=>{const e=zt.extname(i).slice(1);return["basis","ktx","dds"].includes(e)},parse:i=>{var s,n;const e=i.split("."),t=e.pop();if(["ktx","dds"].includes(t)){const r=e.pop();if(AM.includes(r))return{resolution:parseFloat(((s=Ve.RETINA_PREFIX.exec(i))==null?void 0:s[1])??"1"),format:r,src:i}}return{resolution:parseFloat(((n=Ve.RETINA_PREFIX.exec(i))==null?void 0:n[1])??"1"),format:t,src:i}}};He.add(CM);const za=new lt,IM=4,Kv=class Wo{constructor(e){this.renderer=e,this._rendererPremultipliedAlpha=!1}contextChange(){var t;const e=(t=this.renderer)==null?void 0:t.gl.getContextAttributes();this._rendererPremultipliedAlpha=!!(e&&e.alpha&&e.premultipliedAlpha)}async image(e,t,s,n){const r=new Image;return r.src=await this.base64(e,t,s,n),r}async base64(e,t,s,n){const r=this.canvas(e,n);if(r.toBlob!==void 0)return new Promise((o,a)=>{r.toBlob(h=>{if(!h){a(new Error("ICanvas.toBlob failed!"));return}const l=new FileReader;l.onload=()=>o(l.result),l.onerror=a,l.readAsDataURL(h)},t,s)});if(r.toDataURL!==void 0)return r.toDataURL(t,s);if(r.convertToBlob!==void 0){const o=await r.convertToBlob({type:t,quality:s});return new Promise((a,h)=>{const l=new FileReader;l.onload=()=>a(l.result),l.onerror=h,l.readAsDataURL(o)})}throw new Error("Extract.base64() requires ICanvas.toDataURL, ICanvas.toBlob, or ICanvas.convertToBlob to be implemented")}canvas(e,t){const{pixels:s,width:n,height:r,flipY:o,premultipliedAlpha:a}=this._rawPixels(e,t);o&&Wo._flipY(s,n,r),a&&Wo._unpremultiplyAlpha(s);const h=new c_(n,r,1),l=new ImageData(new Uint8ClampedArray(s.buffer),n,r);return h.context.putImageData(l,0,0),h.canvas}pixels(e,t){const{pixels:s,width:n,height:r,flipY:o,premultipliedAlpha:a}=this._rawPixels(e,t);return o&&Wo._flipY(s,n,r),a&&Wo._unpremultiplyAlpha(s),s}_rawPixels(e,t){const s=this.renderer;if(!s)throw new Error("The Extract has already been destroyed");let n,r=!1,o=!1,a,h=!1;e&&(e instanceof Ir?a=e:(a=s.generateTexture(e,{region:t,resolution:s.resolution,multisample:s.multisample}),h=!0,t&&(za.width=t.width,za.height=t.height,t=za)));const l=s.gl;if(a){if(n=a.baseTexture.resolution,t=t??a.frame,r=!1,o=a.baseTexture.alphaMode>0&&a.baseTexture.format===Re.RGBA,!h){s.renderTexture.bind(a);const d=a.framebuffer.glFramebuffers[s.CONTEXT_UID];d.blitFramebuffer&&s.framebuffer.bind(d.blitFramebuffer)}}else n=s.resolution,t||(t=za,t.width=s.width/n,t.height=s.height/n),r=!0,o=this._rendererPremultipliedAlpha,s.renderTexture.bind();const c=Math.max(Math.round(t.width*n),1),u=Math.max(Math.round(t.height*n),1),f=new Uint8Array(IM*c*u);return l.readPixels(Math.round(t.x*n),Math.round(t.y*n),c,u,l.RGBA,l.UNSIGNED_BYTE,f),h&&(a==null||a.destroy(!0)),{pixels:f,width:c,height:u,flipY:r,premultipliedAlpha:o}}destroy(){this.renderer=null}static _flipY(e,t,s){const n=t<<2,r=s>>1,o=new Uint8Array(n);for(let a=0;a<r;a++){const h=a*n,l=(s-a-1)*n;o.set(e.subarray(h,h+n)),e.copyWithin(h,l,l+n),e.set(o,l)}}static _unpremultiplyAlpha(e){e instanceof Uint8ClampedArray&&(e=new Uint8Array(e.buffer));const t=e.length;for(let s=0;s<t;s+=4){const n=e[s+3];if(n!==0){const r=255.001/n;e[s]=e[s]*r+.5,e[s+1]=e[s+1]*r+.5,e[s+2]=e[s+2]*r+.5}}}};Kv.extension={name:"extract",type:Oe.RendererSystem};let RM=Kv;He.add(RM);const $l={build(i){const e=i.points;let t,s,n,r,o,a;if(i.type===pi.CIRC){const m=i.shape;t=m.x,s=m.y,o=a=m.radius,n=r=0}else if(i.type===pi.ELIP){const m=i.shape;t=m.x,s=m.y,o=m.width,a=m.height,n=r=0}else{const m=i.shape,g=m.width/2,b=m.height/2;t=m.x+g,s=m.y+b,o=a=Math.max(0,Math.min(m.radius,Math.min(g,b))),n=g-o,r=b-a}if(!(o>=0&&a>=0&&n>=0&&r>=0)){e.length=0;return}const h=Math.ceil(2.3*Math.sqrt(o+a)),l=h*8+(n?4:0)+(r?4:0);if(e.length=l,l===0)return;if(h===0){e.length=8,e[0]=e[6]=t+n,e[1]=e[3]=s+r,e[2]=e[4]=t-n,e[5]=e[7]=s-r;return}let c=0,u=h*4+(n?2:0)+2,f=u,d=l;{const m=n+o,g=r,b=t+m,_=t-m,M=s+g;if(e[c++]=b,e[c++]=M,e[--u]=M,e[--u]=_,r){const v=s-g;e[f++]=_,e[f++]=v,e[--d]=v,e[--d]=b}}for(let m=1;m<h;m++){const g=Math.PI/2*(m/h),b=n+Math.cos(g)*o,_=r+Math.sin(g)*a,M=t+b,v=t-b,S=s+_,y=s-_;e[c++]=M,e[c++]=S,e[--u]=S,e[--u]=v,e[f++]=v,e[f++]=y,e[--d]=y,e[--d]=M}{const m=n,g=r+a,b=t+m,_=t-m,M=s+g,v=s-g;e[c++]=b,e[c++]=M,e[--d]=v,e[--d]=b,n&&(e[c++]=_,e[c++]=M,e[--d]=v,e[--d]=_)}},triangulate(i,e){const t=i.points,s=e.points,n=e.indices;if(t.length===0)return;let r=s.length/2;const o=r;let a,h;if(i.type!==pi.RREC){const c=i.shape;a=c.x,h=c.y}else{const c=i.shape;a=c.x+c.width/2,h=c.y+c.height/2}const l=i.matrix;s.push(i.matrix?l.a*a+l.c*h+l.tx:a,i.matrix?l.b*a+l.d*h+l.ty:h),r++,s.push(t[0],t[1]);for(let c=2;c<t.length;c+=2)s.push(t[c],t[c+1]),n.push(r++,o,r);n.push(o+1,o,r)}};function Gm(i,e=!1){const t=i.length;if(t<6)return;let s=0;for(let n=0,r=i[t-2],o=i[t-1];n<t;n+=2){const a=i[n],h=i[n+1];s+=(a-r)*(h+o),r=a,o=h}if(!e&&s>0||e&&s<=0){const n=t/2;for(let r=n+n%2;r<t;r+=2){const o=t-r-2,a=t-r-1,h=r,l=r+1;[i[o],i[h]]=[i[h],i[o]],[i[a],i[l]]=[i[l],i[a]]}}}const Zv={build(i){i.points=i.shape.points.slice()},triangulate(i,e){let t=i.points;const s=i.holes,n=e.points,r=e.indices;if(t.length>=6){Gm(t,!1);const o=[];for(let l=0;l<s.length;l++){const c=s[l];Gm(c.points,!0),o.push(t.length/2),t=t.concat(c.points)}const a=cw(t,o,2);if(!a)return;const h=n.length/2;for(let l=0;l<a.length;l+=3)r.push(a[l]+h),r.push(a[l+1]+h),r.push(a[l+2]+h);for(let l=0;l<t.length;l++)n.push(t[l])}}},PM={build(i){const e=i.shape,t=e.x,s=e.y,n=e.width,r=e.height,o=i.points;o.length=0,n>=0&&r>=0&&o.push(t,s,t+n,s,t+n,s+r,t,s+r)},triangulate(i,e){const t=i.points,s=e.points;if(t.length===0)return;const n=s.length/2;s.push(t[0],t[1],t[2],t[3],t[6],t[7],t[4],t[5]),e.indices.push(n,n+1,n+2,n+1,n+2,n+3)}},kM={build(i){$l.build(i)},triangulate(i,e){$l.triangulate(i,e)}};var Hi=(i=>(i.MITER="miter",i.BEVEL="bevel",i.ROUND="round",i))(Hi||{}),jn=(i=>(i.BUTT="butt",i.ROUND="round",i.SQUARE="square",i))(jn||{});const vo={adaptive:!0,maxLength:10,minSegments:8,maxSegments:2048,epsilon:1e-4,_segmentsCount(i,e=20){if(!this.adaptive||!i||isNaN(i))return e;let t=Math.ceil(i/this.maxLength);return t<this.minSegments?t=this.minSegments:t>this.maxSegments&&(t=this.maxSegments),t}};class jm{static curveTo(e,t,s,n,r,o){const a=o[o.length-2],h=o[o.length-1]-t,l=a-e,c=n-t,u=s-e,f=Math.abs(h*u-l*c);if(f<1e-8||r===0)return(o[o.length-2]!==e||o[o.length-1]!==t)&&o.push(e,t),null;const d=h*h+l*l,m=c*c+u*u,g=h*c+l*u,b=r*Math.sqrt(d)/f,_=r*Math.sqrt(m)/f,M=b*g/d,v=_*g/m,S=b*u+_*l,y=b*c+_*h,I=l*(_+M),E=h*(_+M),C=u*(b+v),R=c*(b+v),B=Math.atan2(E-y,I-S),k=Math.atan2(R-y,C-S);return{cx:S+e,cy:y+t,radius:r,startAngle:B,endAngle:k,anticlockwise:l*c>u*h}}static arc(e,t,s,n,r,o,a,h,l){const c=a-o,u=vo._segmentsCount(Math.abs(c)*r,Math.ceil(Math.abs(c)/Ol)*40),f=c/(u*2),d=f*2,m=Math.cos(f),g=Math.sin(f),b=u-1,_=b%1/b;for(let M=0;M<=b;++M){const v=M+_*M,S=f+o+d*v,y=Math.cos(S),I=-Math.sin(S);l.push((m*y+g*I)*r+s,(m*-I+g*y)*r+n)}}}class FM{constructor(){this.reset()}begin(e,t,s){this.reset(),this.style=e,this.start=t,this.attribStart=s}end(e,t){this.attribSize=t-this.attribStart,this.size=e-this.start}reset(){this.style=null,this.size=0,this.start=0,this.attribStart=0,this.attribSize=0}}class of{static curveLength(e,t,s,n,r,o,a,h){let l=0,c=0,u=0,f=0,d=0,m=0,g=0,b=0,_=0,M=0,v=0,S=e,y=t;for(let I=1;I<=10;++I)c=I/10,u=c*c,f=u*c,d=1-c,m=d*d,g=m*d,b=g*e+3*m*c*s+3*d*u*r+f*a,_=g*t+3*m*c*n+3*d*u*o+f*h,M=S-b,v=y-_,S=b,y=_,l+=Math.sqrt(M*M+v*v);return l}static curveTo(e,t,s,n,r,o,a){const h=a[a.length-2],l=a[a.length-1];a.length-=2;const c=vo._segmentsCount(of.curveLength(h,l,e,t,s,n,r,o));let u=0,f=0,d=0,m=0,g=0;a.push(h,l);for(let b=1,_=0;b<=c;++b)_=b/c,u=1-_,f=u*u,d=f*u,m=_*_,g=m*_,a.push(d*h+3*f*_*e+3*u*m*s+g*r,d*l+3*f*_*t+3*u*m*n+g*o)}}function Hm(i,e,t,s,n,r,o,a){const h=i-t*n,l=e-s*n,c=i+t*r,u=e+s*r;let f,d;o?(f=s,d=-t):(f=-s,d=t);const m=h+f,g=l+d,b=c+f,_=u+d;return a.push(m,g,b,_),2}function ar(i,e,t,s,n,r,o,a){const h=t-i,l=s-e;let c=Math.atan2(h,l),u=Math.atan2(n-i,r-e);a&&c<u?c+=Math.PI*2:!a&&c>u&&(u+=Math.PI*2);let f=c;const d=u-c,m=Math.abs(d),g=Math.sqrt(h*h+l*l),b=(15*m*Math.sqrt(g)/Math.PI>>0)+1,_=d/b;if(f+=_,a){o.push(i,e,t,s);for(let M=1,v=f;M<b;M++,v+=_)o.push(i,e,i+Math.sin(v)*g,e+Math.cos(v)*g);o.push(i,e,n,r)}else{o.push(t,s,i,e);for(let M=1,v=f;M<b;M++,v+=_)o.push(i+Math.sin(v)*g,e+Math.cos(v)*g,i,e);o.push(n,r,i,e)}return b*2}function OM(i,e){const t=i.shape;let s=i.points||t.points.slice();const n=e.closePointEps;if(s.length===0)return;const r=i.lineStyle,o=new bt(s[0],s[1]),a=new bt(s[s.length-2],s[s.length-1]),h=t.type!==pi.POLY||t.closeStroke,l=Math.abs(o.x-a.x)<n&&Math.abs(o.y-a.y)<n;if(h){s=s.slice(),l&&(s.pop(),s.pop(),a.set(s[s.length-2],s[s.length-1]));const L=(o.x+a.x)*.5,P=(a.y+o.y)*.5;s.unshift(L,P),s.push(L,P)}const c=e.points,u=s.length/2;let f=s.length;const d=c.length/2,m=r.width/2,g=m*m,b=r.miterLimit*r.miterLimit;let _=s[0],M=s[1],v=s[2],S=s[3],y=0,I=0,E=-(M-S),C=_-v,R=0,B=0,k=Math.sqrt(E*E+C*C);E/=k,C/=k,E*=m,C*=m;const F=r.alignment,D=(1-F)*2,N=F*2;h||(r.cap===jn.ROUND?f+=ar(_-E*(D-N)*.5,M-C*(D-N)*.5,_-E*D,M-C*D,_+E*N,M+C*N,c,!0)+2:r.cap===jn.SQUARE&&(f+=Hm(_,M,E,C,D,N,!0,c))),c.push(_-E*D,M-C*D,_+E*N,M+C*N);for(let L=1;L<u-1;++L){_=s[(L-1)*2],M=s[(L-1)*2+1],v=s[L*2],S=s[L*2+1],y=s[(L+1)*2],I=s[(L+1)*2+1],E=-(M-S),C=_-v,k=Math.sqrt(E*E+C*C),E/=k,C/=k,E*=m,C*=m,R=-(S-I),B=v-y,k=Math.sqrt(R*R+B*B),R/=k,B/=k,R*=m,B*=m;const P=v-_,X=M-S,U=v-y,Y=I-S,q=P*U+X*Y,z=X*U-Y*P,ne=z<0;if(Math.abs(z)<.001*Math.abs(q)){c.push(v-E*D,S-C*D,v+E*N,S+C*N),q>=0&&(r.join===Hi.ROUND?f+=ar(v,S,v-E*D,S-C*D,v-R*D,S-B*D,c,!1)+4:f+=2,c.push(v-R*N,S-B*N,v+R*D,S+B*D));continue}const H=(-E+_)*(-C+S)-(-E+v)*(-C+M),Z=(-R+y)*(-B+S)-(-R+v)*(-B+I),ae=(P*Z-U*H)/z,me=(Y*H-X*Z)/z,_e=(ae-v)*(ae-v)+(me-S)*(me-S),te=v+(ae-v)*D,ve=S+(me-S)*D,$=v-(ae-v)*N,W=S-(me-S)*N,J=Math.min(P*P+X*X,U*U+Y*Y),Q=ne?D:N,ie=J+Q*Q*g,ue=_e<=ie;let Se=r.join;if(Se===Hi.MITER&&_e/g>b&&(Se=Hi.BEVEL),ue)switch(Se){case Hi.MITER:{c.push(te,ve,$,W);break}case Hi.BEVEL:{ne?c.push(te,ve,v+E*N,S+C*N,te,ve,v+R*N,S+B*N):c.push(v-E*D,S-C*D,$,W,v-R*D,S-B*D,$,W),f+=2;break}case Hi.ROUND:{ne?(c.push(te,ve,v+E*N,S+C*N),f+=ar(v,S,v+E*N,S+C*N,v+R*N,S+B*N,c,!0)+4,c.push(te,ve,v+R*N,S+B*N)):(c.push(v-E*D,S-C*D,$,W),f+=ar(v,S,v-E*D,S-C*D,v-R*D,S-B*D,c,!1)+4,c.push(v-R*D,S-B*D,$,W));break}}else{switch(c.push(v-E*D,S-C*D,v+E*N,S+C*N),Se){case Hi.MITER:{ne?c.push($,W,$,W):c.push(te,ve,te,ve),f+=2;break}case Hi.ROUND:{ne?f+=ar(v,S,v+E*N,S+C*N,v+R*N,S+B*N,c,!0)+2:f+=ar(v,S,v-E*D,S-C*D,v-R*D,S-B*D,c,!1)+2;break}}c.push(v-R*D,S-B*D,v+R*N,S+B*N),f+=2}}_=s[(u-2)*2],M=s[(u-2)*2+1],v=s[(u-1)*2],S=s[(u-1)*2+1],E=-(M-S),C=_-v,k=Math.sqrt(E*E+C*C),E/=k,C/=k,E*=m,C*=m,c.push(v-E*D,S-C*D,v+E*N,S+C*N),h||(r.cap===jn.ROUND?f+=ar(v-E*(D-N)*.5,S-C*(D-N)*.5,v-E*D,S-C*D,v+E*N,S+C*N,c,!1)+2:r.cap===jn.SQUARE&&(f+=Hm(v,S,E,C,D,N,!1,c)));const j=e.indices,O=vo.epsilon*vo.epsilon;for(let L=d;L<f+d-2;++L)_=c[L*2],M=c[L*2+1],v=c[(L+1)*2],S=c[(L+1)*2+1],y=c[(L+2)*2],I=c[(L+2)*2+1],!(Math.abs(_*(S-I)+v*(I-M)+y*(M-S))<O)&&j.push(L,L+1,L+2)}function BM(i,e){let t=0;const s=i.shape,n=i.points||s.points,r=s.type!==pi.POLY||s.closeStroke;if(n.length===0)return;const o=e.points,a=e.indices,h=n.length/2,l=o.length/2;let c=l;for(o.push(n[0],n[1]),t=1;t<h;t++)o.push(n[t*2],n[t*2+1]),a.push(c,c+1),c++;r&&a.push(c,l)}function Wm(i,e){i.lineStyle.native?BM(i,e):OM(i,e)}class af{static curveLength(e,t,s,n,r,o){const a=e-2*s+r,h=t-2*n+o,l=2*s-2*e,c=2*n-2*t,u=4*(a*a+h*h),f=4*(a*l+h*c),d=l*l+c*c,m=2*Math.sqrt(u+f+d),g=Math.sqrt(u),b=2*u*g,_=2*Math.sqrt(d),M=f/g;return(b*m+g*f*(m-_)+(4*d*u-f*f)*Math.log((2*g+M+m)/(M+_)))/(4*b)}static curveTo(e,t,s,n,r){const o=r[r.length-2],a=r[r.length-1],h=vo._segmentsCount(af.curveLength(o,a,e,t,s,n));let l=0,c=0;for(let u=1;u<=h;++u){const f=u/h;l=o+(e-o)*f,c=a+(t-a)*f,r.push(l+(e+(s-e)*f-l)*f,c+(t+(n-t)*f-c)*f)}}}const fu={[pi.POLY]:Zv,[pi.CIRC]:$l,[pi.ELIP]:$l,[pi.RECT]:PM,[pi.RREC]:kM},zm=[],qa=[];class Gl{constructor(e,t=null,s=null,n=null){this.points=[],this.holes=[],this.shape=e,this.lineStyle=s,this.fillStyle=t,this.matrix=n,this.type=e.type}clone(){return new Gl(this.shape,this.fillStyle,this.lineStyle,this.matrix)}destroy(){this.shape=null,this.holes.length=0,this.holes=null,this.points.length=0,this.points=null,this.lineStyle=null,this.fillStyle=null}}const Nr=new bt,Jv=class Qv extends sv{constructor(){super(),this.closePointEps=1e-4,this.boundsPadding=0,this.uvsFloat32=null,this.indicesUint16=null,this.batchable=!1,this.points=[],this.colors=[],this.uvs=[],this.indices=[],this.textureIds=[],this.graphicsData=[],this.drawCalls=[],this.batchDirty=-1,this.batches=[],this.dirty=0,this.cacheDirty=-1,this.clearDirty=0,this.shapeIndex=0,this._bounds=new pa,this.boundsDirty=-1}get bounds(){return this.updateBatches(),this.boundsDirty!==this.dirty&&(this.boundsDirty=this.dirty,this.calculateBounds()),this._bounds}invalidate(){this.boundsDirty=-1,this.dirty++,this.batchDirty++,this.shapeIndex=0,this.points.length=0,this.colors.length=0,this.uvs.length=0,this.indices.length=0,this.textureIds.length=0;for(let e=0;e<this.drawCalls.length;e++)this.drawCalls[e].texArray.clear(),qa.push(this.drawCalls[e]);this.drawCalls.length=0;for(let e=0;e<this.batches.length;e++){const t=this.batches[e];t.reset(),zm.push(t)}this.batches.length=0}clear(){return this.graphicsData.length>0&&(this.invalidate(),this.clearDirty++,this.graphicsData.length=0),this}drawShape(e,t=null,s=null,n=null){const r=new Gl(e,t,s,n);return this.graphicsData.push(r),this.dirty++,this}drawHole(e,t=null){if(!this.graphicsData.length)return null;const s=new Gl(e,null,null,t),n=this.graphicsData[this.graphicsData.length-1];return s.lineStyle=n.lineStyle,n.holes.push(s),this.dirty++,this}destroy(){super.destroy();for(let e=0;e<this.graphicsData.length;++e)this.graphicsData[e].destroy();this.points.length=0,this.points=null,this.colors.length=0,this.colors=null,this.uvs.length=0,this.uvs=null,this.indices.length=0,this.indices=null,this.indexBuffer.destroy(),this.indexBuffer=null,this.graphicsData.length=0,this.graphicsData=null,this.drawCalls.length=0,this.drawCalls=null,this.batches.length=0,this.batches=null,this._bounds=null}containsPoint(e){const t=this.graphicsData;for(let s=0;s<t.length;++s){const n=t[s];if(n.fillStyle.visible&&n.shape&&(n.matrix?n.matrix.applyInverse(e,Nr):Nr.copyFrom(e),n.shape.contains(Nr.x,Nr.y))){let r=!1;if(n.holes){for(let o=0;o<n.holes.length;o++)if(n.holes[o].shape.contains(Nr.x,Nr.y)){r=!0;break}}if(!r)return!0}}return!1}updateBatches(){if(!this.graphicsData.length){this.batchable=!0;return}if(!this.validateBatching())return;this.cacheDirty=this.dirty;const e=this.uvs,t=this.graphicsData;let s=null,n=null;this.batches.length>0&&(s=this.batches[this.batches.length-1],n=s.style);for(let h=this.shapeIndex;h<t.length;h++){this.shapeIndex++;const l=t[h],c=l.fillStyle,u=l.lineStyle;fu[l.type].build(l),l.matrix&&this.transformPoints(l.points,l.matrix),(c.visible||u.visible)&&this.processHoles(l.holes);for(let f=0;f<2;f++){const d=f===0?c:u;if(!d.visible)continue;const m=d.texture.baseTexture,g=this.indices.length,b=this.points.length/2;m.wrapMode=us.REPEAT,f===0?this.processFill(l):this.processLine(l);const _=this.points.length/2-b;_!==0&&(s&&!this._compareStyles(n,d)&&(s.end(g,b),s=null),s||(s=zm.pop()||new FM,s.begin(d,g,b),this.batches.push(s),n=d),this.addUvs(this.points,e,d.texture,b,_,d.matrix))}}const r=this.indices.length,o=this.points.length/2;if(s&&s.end(r,o),this.batches.length===0){this.batchable=!0;return}const a=o>65535;this.indicesUint16&&this.indices.length===this.indicesUint16.length&&a===this.indicesUint16.BYTES_PER_ELEMENT>2?this.indicesUint16.set(this.indices):this.indicesUint16=a?new Uint32Array(this.indices):new Uint16Array(this.indices),this.batchable=this.isBatchable(),this.batchable?this.packBatches():this.buildDrawCalls()}_compareStyles(e,t){return!(!e||!t||e.texture.baseTexture!==t.texture.baseTexture||e.color+e.alpha!==t.color+t.alpha||!!e.native!=!!t.native)}validateBatching(){if(this.dirty===this.cacheDirty||!this.graphicsData.length)return!1;for(let e=0,t=this.graphicsData.length;e<t;e++){const s=this.graphicsData[e],n=s.fillStyle,r=s.lineStyle;if(n&&!n.texture.baseTexture.valid||r&&!r.texture.baseTexture.valid)return!1}return!0}packBatches(){this.batchDirty++,this.uvsFloat32=new Float32Array(this.uvs);const e=this.batches;for(let t=0,s=e.length;t<s;t++){const n=e[t];for(let r=0;r<n.size;r++){const o=n.start+r;this.indicesUint16[o]=this.indicesUint16[o]-n.attribStart}}}isBatchable(){if(this.points.length>65535*2)return!1;const e=this.batches;for(let t=0;t<e.length;t++)if(e[t].style.native)return!1;return this.points.length<Qv.BATCHABLE_SIZE*2}buildDrawCalls(){let e=++st._globalBatch;for(let u=0;u<this.drawCalls.length;u++)this.drawCalls[u].texArray.clear(),qa.push(this.drawCalls[u]);this.drawCalls.length=0;const t=this.colors,s=this.textureIds;let n=qa.pop();n||(n=new qu,n.texArray=new Qu),n.texArray.count=0,n.start=0,n.size=0,n.type=Us.TRIANGLES;let r=0,o=null,a=0,h=!1,l=Us.TRIANGLES,c=0;this.drawCalls.push(n);for(let u=0;u<this.batches.length;u++){const f=this.batches[u],d=8,m=f.style,g=m.texture.baseTexture;h!==!!m.native&&(h=!!m.native,l=h?Us.LINES:Us.TRIANGLES,o=null,r=d,e++),o!==g&&(o=g,g._batchEnabled!==e&&(r===d&&(e++,r=0,n.size>0&&(n=qa.pop(),n||(n=new qu,n.texArray=new Qu),this.drawCalls.push(n)),n.start=c,n.size=0,n.texArray.count=0,n.type=l),g.touched=1,g._batchEnabled=e,g._batchLocation=r,g.wrapMode=us.REPEAT,n.texArray.elements[n.texArray.count++]=g,r++)),n.size+=f.size,c+=f.size,a=g._batchLocation,this.addColors(t,m.color,m.alpha,f.attribSize,f.attribStart),this.addTextureIds(s,a,f.attribSize,f.attribStart)}st._globalBatch=e,this.packAttributes()}packAttributes(){const e=this.points,t=this.uvs,s=this.colors,n=this.textureIds,r=new ArrayBuffer(e.length*3*4),o=new Float32Array(r),a=new Uint32Array(r);let h=0;for(let l=0;l<e.length/2;l++)o[h++]=e[l*2],o[h++]=e[l*2+1],o[h++]=t[l*2],o[h++]=t[l*2+1],a[h++]=s[l],o[h++]=n[l];this._buffer.update(r),this._indexBuffer.update(this.indicesUint16)}processFill(e){e.holes.length?Zv.triangulate(e,this):fu[e.type].triangulate(e,this)}processLine(e){Wm(e,this);for(let t=0;t<e.holes.length;t++)Wm(e.holes[t],this)}processHoles(e){for(let t=0;t<e.length;t++){const s=e[t];fu[s.type].build(s),s.matrix&&this.transformPoints(s.points,s.matrix)}}calculateBounds(){const e=this._bounds;e.clear(),e.addVertexData(this.points,0,this.points.length),e.pad(this.boundsPadding,this.boundsPadding)}transformPoints(e,t){for(let s=0;s<e.length/2;s++){const n=e[s*2],r=e[s*2+1];e[s*2]=t.a*n+t.c*r+t.tx,e[s*2+1]=t.b*n+t.d*r+t.ty}}addColors(e,t,s,n,r=0){const o=At.shared.setValue(t).toLittleEndianNumber(),a=At.shared.setValue(o).toPremultiplied(s);e.length=Math.max(e.length,r+n);for(let h=0;h<n;h++)e[r+h]=a}addTextureIds(e,t,s,n=0){e.length=Math.max(e.length,n+s);for(let r=0;r<s;r++)e[n+r]=t}addUvs(e,t,s,n,r,o=null){let a=0;const h=t.length,l=s.frame;for(;a<r;){let u=e[(n+a)*2],f=e[(n+a)*2+1];if(o){const d=o.a*u+o.c*f+o.tx;f=o.b*u+o.d*f+o.ty,u=d}a++,t.push(u/l.width,f/l.height)}const c=s.baseTexture;(l.width<c.width||l.height<c.height)&&this.adjustUvs(t,s,h,r)}adjustUvs(e,t,s,n){const r=t.baseTexture,o=1e-6,a=s+n*2,h=t.frame,l=h.width/r.width,c=h.height/r.height;let u=h.x/h.width,f=h.y/h.height,d=Math.floor(e[s]+o),m=Math.floor(e[s+1]+o);for(let g=s+2;g<a;g+=2)d=Math.min(d,Math.floor(e[g]+o)),m=Math.min(m,Math.floor(e[g+1]+o));u-=d,f-=m;for(let g=s;g<a;g+=2)e[g]=(e[g]+u)*l,e[g+1]=(e[g+1]+f)*c}};Jv.BATCHABLE_SIZE=100;let LM=Jv;class Oh{constructor(){this.color=16777215,this.alpha=1,this.texture=et.WHITE,this.matrix=null,this.visible=!1,this.reset()}clone(){const e=new Oh;return e.color=this.color,e.alpha=this.alpha,e.texture=this.texture,e.matrix=this.matrix,e.visible=this.visible,e}reset(){this.color=16777215,this.alpha=1,this.texture=et.WHITE,this.matrix=null,this.visible=!1}destroy(){this.texture=null,this.matrix=null}}class lf extends Oh{constructor(){super(...arguments),this.width=0,this.alignment=.5,this.native=!1,this.cap=jn.BUTT,this.join=Hi.MITER,this.miterLimit=10}clone(){const e=new lf;return e.color=this.color,e.alpha=this.alpha,e.texture=this.texture,e.matrix=this.matrix,e.visible=this.visible,e.width=this.width,e.alignment=this.alignment,e.native=this.native,e.cap=this.cap,e.join=this.join,e.miterLimit=this.miterLimit,e}reset(){super.reset(),this.color=0,this.alignment=.5,this.width=0,this.native=!1,this.cap=jn.BUTT,this.join=Hi.MITER,this.miterLimit=10}}const pu={},vd=class yl extends gi{constructor(e=null){super(),this.shader=null,this.pluginName="batch",this.currentPath=null,this.batches=[],this.batchTint=-1,this.batchDirty=-1,this.vertexData=null,this._fillStyle=new Oh,this._lineStyle=new lf,this._matrix=null,this._holeMode=!1,this.state=zs.for2d(),this._geometry=e||new LM,this._geometry.refCount++,this._transformID=-1,this._tintColor=new At(16777215),this.blendMode=Qe.NORMAL}get geometry(){return this._geometry}clone(){return this.finishPoly(),new yl(this._geometry)}set blendMode(e){this.state.blendMode=e}get blendMode(){return this.state.blendMode}get tint(){return this._tintColor.value}set tint(e){this._tintColor.setValue(e)}get fill(){return this._fillStyle}get line(){return this._lineStyle}lineStyle(e=null,t=0,s,n=.5,r=!1){return typeof e=="number"&&(e={width:e,color:t,alpha:s,alignment:n,native:r}),this.lineTextureStyle(e)}lineTextureStyle(e){const t={width:0,texture:et.WHITE,color:e!=null&&e.texture?16777215:0,matrix:null,alignment:.5,native:!1,cap:jn.BUTT,join:Hi.MITER,miterLimit:10};e=Object.assign(t,e),this.normalizeColor(e),this.currentPath&&this.startPoly();const s=e.width>0&&e.alpha>0;return s?(e.matrix&&(e.matrix=e.matrix.clone(),e.matrix.invert()),Object.assign(this._lineStyle,{visible:s},e)):this._lineStyle.reset(),this}startPoly(){if(this.currentPath){const e=this.currentPath.points,t=this.currentPath.points.length;t>2&&(this.drawShape(this.currentPath),this.currentPath=new vr,this.currentPath.closeStroke=!1,this.currentPath.points.push(e[t-2],e[t-1]))}else this.currentPath=new vr,this.currentPath.closeStroke=!1}finishPoly(){this.currentPath&&(this.currentPath.points.length>2?(this.drawShape(this.currentPath),this.currentPath=null):this.currentPath.points.length=0)}moveTo(e,t){return this.startPoly(),this.currentPath.points[0]=e,this.currentPath.points[1]=t,this}lineTo(e,t){this.currentPath||this.moveTo(0,0);const s=this.currentPath.points,n=s[s.length-2],r=s[s.length-1];return(n!==e||r!==t)&&s.push(e,t),this}_initCurve(e=0,t=0){this.currentPath?this.currentPath.points.length===0&&(this.currentPath.points=[e,t]):this.moveTo(e,t)}quadraticCurveTo(e,t,s,n){this._initCurve();const r=this.currentPath.points;return r.length===0&&this.moveTo(0,0),af.curveTo(e,t,s,n,r),this}bezierCurveTo(e,t,s,n,r,o){return this._initCurve(),of.curveTo(e,t,s,n,r,o,this.currentPath.points),this}arcTo(e,t,s,n,r){this._initCurve(e,t);const o=this.currentPath.points,a=jm.curveTo(e,t,s,n,r,o);if(a){const{cx:h,cy:l,radius:c,startAngle:u,endAngle:f,anticlockwise:d}=a;this.arc(h,l,c,u,f,d)}return this}arc(e,t,s,n,r,o=!1){if(n===r)return this;if(!o&&r<=n?r+=Ol:o&&n<=r&&(n+=Ol),r-n===0)return this;const a=e+Math.cos(n)*s,h=t+Math.sin(n)*s,l=this._geometry.closePointEps;let c=this.currentPath?this.currentPath.points:null;if(c){const u=Math.abs(c[c.length-2]-a),f=Math.abs(c[c.length-1]-h);u<l&&f<l||c.push(a,h)}else this.moveTo(a,h),c=this.currentPath.points;return jm.arc(a,h,e,t,s,n,r,o,c),this}beginFill(e=0,t){return this.beginTextureFill({texture:et.WHITE,color:e,alpha:t})}normalizeColor(e){const t=At.shared.setValue(e.color??0);e.color=t.toNumber(),e.alpha??(e.alpha=t.alpha)}beginTextureFill(e){const t={texture:et.WHITE,color:16777215,matrix:null};e=Object.assign(t,e),this.normalizeColor(e),this.currentPath&&this.startPoly();const s=e.alpha>0;return s?(e.matrix&&(e.matrix=e.matrix.clone(),e.matrix.invert()),Object.assign(this._fillStyle,{visible:s},e)):this._fillStyle.reset(),this}endFill(){return this.finishPoly(),this._fillStyle.reset(),this}drawRect(e,t,s,n){return this.drawShape(new lt(e,t,s,n))}drawRoundedRect(e,t,s,n,r){return this.drawShape(new Ph(e,t,s,n,r))}drawCircle(e,t,s){return this.drawShape(new Ih(e,t,s))}drawEllipse(e,t,s,n){return this.drawShape(new Rh(e,t,s,n))}drawPolygon(...e){let t,s=!0;const n=e[0];n.points?(s=n.closeStroke,t=n.points):Array.isArray(e[0])?t=e[0]:t=e;const r=new vr(t);return r.closeStroke=s,this.drawShape(r),this}drawShape(e){return this._holeMode?this._geometry.drawHole(e,this._matrix):this._geometry.drawShape(e,this._fillStyle.clone(),this._lineStyle.clone(),this._matrix),this}clear(){return this._geometry.clear(),this._lineStyle.reset(),this._fillStyle.reset(),this._boundsID++,this._matrix=null,this._holeMode=!1,this.currentPath=null,this}isFastRect(){const e=this._geometry.graphicsData;return e.length===1&&e[0].shape.type===pi.RECT&&!e[0].matrix&&!e[0].holes.length&&!(e[0].lineStyle.visible&&e[0].lineStyle.width)}_render(e){this.finishPoly();const t=this._geometry;t.updateBatches(),t.batchable?(this.batchDirty!==t.batchDirty&&this._populateBatches(),this._renderBatched(e)):(e.batch.flush(),this._renderDirect(e))}_populateBatches(){const e=this._geometry,t=this.blendMode,s=e.batches.length;this.batchTint=-1,this._transformID=-1,this.batchDirty=e.batchDirty,this.batches.length=s,this.vertexData=new Float32Array(e.points);for(let n=0;n<s;n++){const r=e.batches[n],o=r.style.color,a=new Float32Array(this.vertexData.buffer,r.attribStart*4*2,r.attribSize*2),h=new Float32Array(e.uvsFloat32.buffer,r.attribStart*4*2,r.attribSize*2),l=new Uint16Array(e.indicesUint16.buffer,r.start*2,r.size),c={vertexData:a,blendMode:t,indices:l,uvs:h,_batchRGB:At.shared.setValue(o).toRgbArray(),_tintRGB:o,_texture:r.style.texture,alpha:r.style.alpha,worldAlpha:1};this.batches[n]=c}}_renderBatched(e){if(this.batches.length){e.batch.setObjectRenderer(e.plugins[this.pluginName]),this.calculateVertices(),this.calculateTints();for(let t=0,s=this.batches.length;t<s;t++){const n=this.batches[t];n.worldAlpha=this.worldAlpha*n.alpha,e.plugins[this.pluginName].render(n)}}}_renderDirect(e){const t=this._resolveDirectShader(e),s=this._geometry,n=this.worldAlpha,r=t.uniforms,o=s.drawCalls;r.translationMatrix=this.transform.worldTransform,At.shared.setValue(this._tintColor).premultiply(n).toArray(r.tint),e.shader.bind(t),e.geometry.bind(s,t),e.state.set(this.state);for(let a=0,h=o.length;a<h;a++)this._renderDrawCallDirect(e,s.drawCalls[a])}_renderDrawCallDirect(e,t){const{texArray:s,type:n,size:r,start:o}=t,a=s.count;for(let h=0;h<a;h++)e.texture.bind(s.elements[h],h);e.geometry.draw(n,r,o)}_resolveDirectShader(e){let t=this.shader;const s=this.pluginName;if(!t){if(!pu[s]){const{maxTextures:n}=e.plugins[s],r=new Int32Array(n);for(let h=0;h<n;h++)r[h]=h;const o={tint:new Float32Array([1,1,1,1]),translationMatrix:new Vt,default:fs.from({uSamplers:r},!0)},a=e.plugins[s]._shader.program;pu[s]=new ps(a,o)}t=pu[s]}return t}_calculateBounds(){this.finishPoly();const e=this._geometry;if(!e.graphicsData.length)return;const{minX:t,minY:s,maxX:n,maxY:r}=e.bounds;this._bounds.addFrame(this.transform,t,s,n,r)}containsPoint(e){return this.worldTransform.applyInverse(e,yl._TEMP_POINT),this._geometry.containsPoint(yl._TEMP_POINT)}calculateTints(){if(this.batchTint!==this.tint){this.batchTint=this._tintColor.toNumber();for(let e=0;e<this.batches.length;e++){const t=this.batches[e];t._tintRGB=At.shared.setValue(this._tintColor).multiply(t._batchRGB).toLittleEndianNumber()}}}calculateVertices(){const e=this.transform._worldID;if(this._transformID===e)return;this._transformID=e;const t=this.transform.worldTransform,s=t.a,n=t.b,r=t.c,o=t.d,a=t.tx,h=t.ty,l=this._geometry.points,c=this.vertexData;let u=0;for(let f=0;f<l.length;f+=2){const d=l[f],m=l[f+1];c[u++]=s*d+r*m+a,c[u++]=o*m+n*d+h}}closePath(){const e=this.currentPath;return e&&(e.closeStroke=!0,this.finishPoly()),this}setMatrix(e){return this._matrix=e,this}beginHole(){return this.finishPoly(),this._holeMode=!0,this}endHole(){return this.finishPoly(),this._holeMode=!1,this}destroy(e){this._geometry.refCount--,this._geometry.refCount===0&&this._geometry.dispose(),this._matrix=null,this.currentPath=null,this._lineStyle.destroy(),this._lineStyle=null,this._fillStyle.destroy(),this._fillStyle=null,this._geometry=null,this.shader=null,this.vertexData=null,this.batches.length=0,this.batches=null,super.destroy(e)}};vd.curves=vo,vd._TEMP_POINT=new bt;let Ri=vd;class DM{constructor(e,t){this.uvBuffer=e,this.uvMatrix=t,this.data=null,this._bufferUpdateId=-1,this._textureUpdateId=-1,this._updateID=0}update(e){if(!e&&this._bufferUpdateId===this.uvBuffer._updateID&&this._textureUpdateId===this.uvMatrix._updateID)return;this._bufferUpdateId=this.uvBuffer._updateID,this._textureUpdateId=this.uvMatrix._updateID;const t=this.uvBuffer.data;(!this.data||this.data.length!==t.length)&&(this.data=new Float32Array(t.length)),this.uvMatrix.multiplyUvs(t,this.data),this._updateID++}}const mu=new bt,qm=new vr,ey=class ty extends gi{constructor(e,t,s,n=Us.TRIANGLES){super(),this.geometry=e,this.shader=t,this.state=s||zs.for2d(),this.drawMode=n,this.start=0,this.size=0,this.uvs=null,this.indices=null,this.vertexData=new Float32Array(1),this.vertexDirty=-1,this._transformID=-1,this._roundPixels=Ve.ROUND_PIXELS,this.batchUvs=null}get geometry(){return this._geometry}set geometry(e){this._geometry!==e&&(this._geometry&&(this._geometry.refCount--,this._geometry.refCount===0&&this._geometry.dispose()),this._geometry=e,this._geometry&&this._geometry.refCount++,this.vertexDirty=-1)}get uvBuffer(){return this.geometry.buffers[1]}get verticesBuffer(){return this.geometry.buffers[0]}set material(e){this.shader=e}get material(){return this.shader}set blendMode(e){this.state.blendMode=e}get blendMode(){return this.state.blendMode}set roundPixels(e){this._roundPixels!==e&&(this._transformID=-1),this._roundPixels=e}get roundPixels(){return this._roundPixels}get tint(){return"tint"in this.shader?this.shader.tint:null}set tint(e){this.shader.tint=e}get tintValue(){return this.shader.tintValue}get texture(){return"texture"in this.shader?this.shader.texture:null}set texture(e){this.shader.texture=e}_render(e){const t=this.geometry.buffers[0].data;this.shader.batchable&&this.drawMode===Us.TRIANGLES&&t.length<ty.BATCHABLE_SIZE*2?this._renderToBatch(e):this._renderDefault(e)}_renderDefault(e){const t=this.shader;t.alpha=this.worldAlpha,t.update&&t.update(),e.batch.flush(),t.uniforms.translationMatrix=this.transform.worldTransform.toArray(!0),e.shader.bind(t),e.state.set(this.state),e.geometry.bind(this.geometry,t),e.geometry.draw(this.drawMode,this.size,this.start,this.geometry.instanceCount)}_renderToBatch(e){const t=this.geometry,s=this.shader;s.uvMatrix&&(s.uvMatrix.update(),this.calculateUvs()),this.calculateVertices(),this.indices=t.indexBuffer.data,this._tintRGB=s._tintRGB,this._texture=s.texture;const n=this.material.pluginName;e.batch.setObjectRenderer(e.plugins[n]),e.plugins[n].render(this)}calculateVertices(){const e=this.geometry.buffers[0],t=e.data,s=e._updateID;if(s===this.vertexDirty&&this._transformID===this.transform._worldID)return;this._transformID=this.transform._worldID,this.vertexData.length!==t.length&&(this.vertexData=new Float32Array(t.length));const n=this.transform.worldTransform,r=n.a,o=n.b,a=n.c,h=n.d,l=n.tx,c=n.ty,u=this.vertexData;for(let f=0;f<u.length/2;f++){const d=t[f*2],m=t[f*2+1];u[f*2]=r*d+a*m+l,u[f*2+1]=o*d+h*m+c}if(this._roundPixels){const f=Ve.RESOLUTION;for(let d=0;d<u.length;++d)u[d]=Math.round(u[d]*f)/f}this.vertexDirty=s}calculateUvs(){const e=this.geometry.buffers[1],t=this.shader;t.uvMatrix.isSimple?this.uvs=e.data:(this.batchUvs||(this.batchUvs=new DM(e,t.uvMatrix)),this.batchUvs.update(),this.uvs=this.batchUvs.data)}_calculateBounds(){this.calculateVertices(),this._bounds.addVertexData(this.vertexData,0,this.vertexData.length)}containsPoint(e){if(!this.getBounds().contains(e.x,e.y))return!1;this.worldTransform.applyInverse(e,mu);const t=this.geometry.getBuffer("aVertexPosition").data,s=qm.points,n=this.geometry.getIndex().data,r=n.length,o=this.drawMode===4?3:1;for(let a=0;a+2<r;a+=o){const h=n[a]*2,l=n[a+1]*2,c=n[a+2]*2;if(s[0]=t[h],s[1]=t[h+1],s[2]=t[l],s[3]=t[l+1],s[4]=t[c],s[5]=t[c+1],qm.contains(mu.x,mu.y))return!0}return!1}destroy(e){super.destroy(e),this._cachedTexture&&(this._cachedTexture.destroy(),this._cachedTexture=null),this.geometry=null,this.shader=null,this.state=null,this.uvs=null,this.indices=null,this.vertexData=null}};ey.BATCHABLE_SIZE=100;let ma=ey;class hf extends Hs{constructor(e,t,s){super();const n=new Nt(e),r=new Nt(t,!0),o=new Nt(s,!0,!0);this.addAttribute("aVertexPosition",n,2,!1,je.FLOAT).addAttribute("aTextureCoord",r,2,!1,je.FLOAT).addIndex(o),this._updateId=-1}get vertexDirtyId(){return this.buffers[0]._updateID}}var NM=`varying vec2 vTextureCoord;
|
||
uniform vec4 uColor;
|
||
|
||
uniform sampler2D uSampler;
|
||
|
||
void main(void)
|
||
{
|
||
gl_FragColor = texture2D(uSampler, vTextureCoord) * uColor;
|
||
}
|
||
`,UM=`attribute vec2 aVertexPosition;
|
||
attribute vec2 aTextureCoord;
|
||
|
||
uniform mat3 projectionMatrix;
|
||
uniform mat3 translationMatrix;
|
||
uniform mat3 uTextureMatrix;
|
||
|
||
varying vec2 vTextureCoord;
|
||
|
||
void main(void)
|
||
{
|
||
gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
|
||
|
||
vTextureCoord = (uTextureMatrix * vec3(aTextureCoord, 1.0)).xy;
|
||
}
|
||
`;class jl extends ps{constructor(e,t){const s={uSampler:e,alpha:1,uTextureMatrix:Vt.IDENTITY,uColor:new Float32Array([1,1,1,1])};t=Object.assign({tint:16777215,alpha:1,pluginName:"batch"},t),t.uniforms&&Object.assign(s,t.uniforms),super(t.program||Vs.from(UM,NM),s),this._colorDirty=!1,this.uvMatrix=new sf(e),this.batchable=t.program===void 0,this.pluginName=t.pluginName,this._tintColor=new At(t.tint),this._tintRGB=this._tintColor.toLittleEndianNumber(),this._colorDirty=!0,this.alpha=t.alpha}get texture(){return this.uniforms.uSampler}set texture(e){this.uniforms.uSampler!==e&&(!this.uniforms.uSampler.baseTexture.alphaMode!=!e.baseTexture.alphaMode&&(this._colorDirty=!0),this.uniforms.uSampler=e,this.uvMatrix.texture=e)}set alpha(e){e!==this._alpha&&(this._alpha=e,this._colorDirty=!0)}get alpha(){return this._alpha}set tint(e){e!==this.tint&&(this._tintColor.setValue(e),this._tintRGB=this._tintColor.toLittleEndianNumber(),this._colorDirty=!0)}get tint(){return this._tintColor.value}get tintValue(){return this._tintColor.toNumber()}update(){if(this._colorDirty){this._colorDirty=!1;const e=this.texture.baseTexture.alphaMode;At.shared.setValue(this._tintColor).premultiply(this._alpha,e).toArray(this.uniforms.uColor)}this.uvMatrix.update()&&(this.uniforms.uTextureMatrix=this.uvMatrix.mapCoord)}}class VM extends ma{constructor(e=et.EMPTY,t,s,n,r){const o=new hf(t,s,n);o.getBuffer("aVertexPosition").static=!1;const a=new jl(e);super(o,a,null,r),this.autoUpdate=!0}get vertices(){return this.geometry.getBuffer("aVertexPosition").data}set vertices(e){this.geometry.getBuffer("aVertexPosition").data=e}_render(e){this.autoUpdate&&this.geometry.getBuffer("aVertexPosition").update(),super._render(e)}}class Km{constructor(e,t,s){this.geometry=new Hs,this.indexBuffer=null,this.size=s,this.dynamicProperties=[],this.staticProperties=[];for(let n=0;n<e.length;++n){let r=e[n];r={attributeName:r.attributeName,size:r.size,uploadFunction:r.uploadFunction,type:r.type||je.FLOAT,offset:r.offset},t[n]?this.dynamicProperties.push(r):this.staticProperties.push(r)}this.staticStride=0,this.staticBuffer=null,this.staticData=null,this.staticDataUint32=null,this.dynamicStride=0,this.dynamicBuffer=null,this.dynamicData=null,this.dynamicDataUint32=null,this._updateID=0,this.initBuffers()}initBuffers(){const e=this.geometry;let t=0;this.indexBuffer=new Nt(l_(this.size),!0,!0),e.addIndex(this.indexBuffer),this.dynamicStride=0;for(let o=0;o<this.dynamicProperties.length;++o){const a=this.dynamicProperties[o];a.offset=t,t+=a.size,this.dynamicStride+=a.size}const s=new ArrayBuffer(this.size*this.dynamicStride*4*4);this.dynamicData=new Float32Array(s),this.dynamicDataUint32=new Uint32Array(s),this.dynamicBuffer=new Nt(this.dynamicData,!1,!1);let n=0;this.staticStride=0;for(let o=0;o<this.staticProperties.length;++o){const a=this.staticProperties[o];a.offset=n,n+=a.size,this.staticStride+=a.size}const r=new ArrayBuffer(this.size*this.staticStride*4*4);this.staticData=new Float32Array(r),this.staticDataUint32=new Uint32Array(r),this.staticBuffer=new Nt(this.staticData,!0,!1);for(let o=0;o<this.dynamicProperties.length;++o){const a=this.dynamicProperties[o];e.addAttribute(a.attributeName,this.dynamicBuffer,0,a.type===je.UNSIGNED_BYTE,a.type,this.dynamicStride*4,a.offset*4)}for(let o=0;o<this.staticProperties.length;++o){const a=this.staticProperties[o];e.addAttribute(a.attributeName,this.staticBuffer,0,a.type===je.UNSIGNED_BYTE,a.type,this.staticStride*4,a.offset*4)}}uploadDynamic(e,t,s){for(let n=0;n<this.dynamicProperties.length;n++){const r=this.dynamicProperties[n];r.uploadFunction(e,t,s,r.type===je.UNSIGNED_BYTE?this.dynamicDataUint32:this.dynamicData,this.dynamicStride,r.offset)}this.dynamicBuffer._updateID++}uploadStatic(e,t,s){for(let n=0;n<this.staticProperties.length;n++){const r=this.staticProperties[n];r.uploadFunction(e,t,s,r.type===je.UNSIGNED_BYTE?this.staticDataUint32:this.staticData,this.staticStride,r.offset)}this.staticBuffer._updateID++}destroy(){this.indexBuffer=null,this.dynamicProperties=null,this.dynamicBuffer=null,this.dynamicData=null,this.dynamicDataUint32=null,this.staticProperties=null,this.staticBuffer=null,this.staticData=null,this.staticDataUint32=null,this.geometry.destroy()}}var XM=`varying vec2 vTextureCoord;
|
||
varying vec4 vColor;
|
||
|
||
uniform sampler2D uSampler;
|
||
|
||
void main(void){
|
||
vec4 color = texture2D(uSampler, vTextureCoord) * vColor;
|
||
gl_FragColor = color;
|
||
}`,YM=`attribute vec2 aVertexPosition;
|
||
attribute vec2 aTextureCoord;
|
||
attribute vec4 aColor;
|
||
|
||
attribute vec2 aPositionCoord;
|
||
attribute float aRotation;
|
||
|
||
uniform mat3 translationMatrix;
|
||
uniform vec4 uColor;
|
||
|
||
varying vec2 vTextureCoord;
|
||
varying vec4 vColor;
|
||
|
||
void main(void){
|
||
float x = (aVertexPosition.x) * cos(aRotation) - (aVertexPosition.y) * sin(aRotation);
|
||
float y = (aVertexPosition.x) * sin(aRotation) + (aVertexPosition.y) * cos(aRotation);
|
||
|
||
vec2 v = vec2(x, y);
|
||
v = v + aPositionCoord;
|
||
|
||
gl_Position = vec4((translationMatrix * vec3(v, 1.0)).xy, 0.0, 1.0);
|
||
|
||
vTextureCoord = aTextureCoord;
|
||
vColor = aColor * uColor;
|
||
}
|
||
`;class iy extends kh{constructor(e){super(e),this.shader=null,this.properties=null,this.tempMatrix=new Vt,this.properties=[{attributeName:"aVertexPosition",size:2,uploadFunction:this.uploadVertices,offset:0},{attributeName:"aPositionCoord",size:2,uploadFunction:this.uploadPosition,offset:0},{attributeName:"aRotation",size:1,uploadFunction:this.uploadRotation,offset:0},{attributeName:"aTextureCoord",size:2,uploadFunction:this.uploadUvs,offset:0},{attributeName:"aColor",size:1,type:je.UNSIGNED_BYTE,uploadFunction:this.uploadTint,offset:0}],this.shader=ps.from(YM,XM,{}),this.state=zs.for2d()}render(e){const t=e.children,s=e._maxSize,n=e._batchSize,r=this.renderer;let o=t.length;if(o===0)return;o>s&&!e.autoResize&&(o=s);let a=e._buffers;a||(a=e._buffers=this.generateBuffers(e));const h=t[0]._texture.baseTexture,l=h.alphaMode>0;this.state.blendMode=ev(e.blendMode,l),r.state.set(this.state);const c=r.gl,u=e.worldTransform.copyTo(this.tempMatrix);u.prepend(r.globalUniforms.uniforms.projectionMatrix),this.shader.uniforms.translationMatrix=u.toArray(!0),this.shader.uniforms.uColor=At.shared.setValue(e.tintRgb).premultiply(e.worldAlpha,l).toArray(this.shader.uniforms.uColor),this.shader.uniforms.uSampler=h,this.renderer.shader.bind(this.shader);let f=!1;for(let d=0,m=0;d<o;d+=n,m+=1){let g=o-d;g>n&&(g=n),m>=a.length&&a.push(this._generateOneMoreBuffer(e));const b=a[m];b.uploadDynamic(t,d,g);const _=e._bufferUpdateIDs[m]||0;f=f||b._updateID<_,f&&(b._updateID=e._updateID,b.uploadStatic(t,d,g)),r.geometry.bind(b.geometry),c.drawElements(c.TRIANGLES,g*6,c.UNSIGNED_SHORT,0)}}generateBuffers(e){const t=[],s=e._maxSize,n=e._batchSize,r=e._properties;for(let o=0;o<s;o+=n)t.push(new Km(this.properties,r,n));return t}_generateOneMoreBuffer(e){const t=e._batchSize,s=e._properties;return new Km(this.properties,s,t)}uploadVertices(e,t,s,n,r,o){let a=0,h=0,l=0,c=0;for(let u=0;u<s;++u){const f=e[t+u],d=f._texture,m=f.scale.x,g=f.scale.y,b=d.trim,_=d.orig;b?(h=b.x-f.anchor.x*_.width,a=h+b.width,c=b.y-f.anchor.y*_.height,l=c+b.height):(a=_.width*(1-f.anchor.x),h=_.width*-f.anchor.x,l=_.height*(1-f.anchor.y),c=_.height*-f.anchor.y),n[o]=h*m,n[o+1]=c*g,n[o+r]=a*m,n[o+r+1]=c*g,n[o+r*2]=a*m,n[o+r*2+1]=l*g,n[o+r*3]=h*m,n[o+r*3+1]=l*g,o+=r*4}}uploadPosition(e,t,s,n,r,o){for(let a=0;a<s;a++){const h=e[t+a].position;n[o]=h.x,n[o+1]=h.y,n[o+r]=h.x,n[o+r+1]=h.y,n[o+r*2]=h.x,n[o+r*2+1]=h.y,n[o+r*3]=h.x,n[o+r*3+1]=h.y,o+=r*4}}uploadRotation(e,t,s,n,r,o){for(let a=0;a<s;a++){const h=e[t+a].rotation;n[o]=h,n[o+r]=h,n[o+r*2]=h,n[o+r*3]=h,o+=r*4}}uploadUvs(e,t,s,n,r,o){for(let a=0;a<s;++a){const h=e[t+a]._texture._uvs;h?(n[o]=h.x0,n[o+1]=h.y0,n[o+r]=h.x1,n[o+r+1]=h.y1,n[o+r*2]=h.x2,n[o+r*2+1]=h.y2,n[o+r*3]=h.x3,n[o+r*3+1]=h.y3,o+=r*4):(n[o]=0,n[o+1]=0,n[o+r]=0,n[o+r+1]=0,n[o+r*2]=0,n[o+r*2+1]=0,n[o+r*3]=0,n[o+r*3+1]=0,o+=r*4)}}uploadTint(e,t,s,n,r,o){for(let a=0;a<s;++a){const h=e[t+a],l=At.shared.setValue(h._tintRGB).toPremultiplied(h.alpha,h.texture.baseTexture.alphaMode>0);n[o]=l,n[o+r]=l,n[o+r*2]=l,n[o+r*3]=l,o+=r*4}}destroy(){super.destroy(),this.shader&&(this.shader.destroy(),this.shader=null),this.tempMatrix=null}}iy.extension={name:"particle",type:Oe.RendererPlugin};He.add(iy);var Bh=(i=>(i[i.LINEAR_VERTICAL=0]="LINEAR_VERTICAL",i[i.LINEAR_HORIZONTAL=1]="LINEAR_HORIZONTAL",i))(Bh||{});const Ka={willReadFrequently:!0},As=class ze{static get experimentalLetterSpacingSupported(){let e=ze._experimentalLetterSpacingSupported;if(e!==void 0){const t=Ve.ADAPTER.getCanvasRenderingContext2D().prototype;e=ze._experimentalLetterSpacingSupported="letterSpacing"in t||"textLetterSpacing"in t}return e}constructor(e,t,s,n,r,o,a,h,l){this.text=e,this.style=t,this.width=s,this.height=n,this.lines=r,this.lineWidths=o,this.lineHeight=a,this.maxLineWidth=h,this.fontProperties=l}static measureText(e,t,s,n=ze._canvas){s=s??t.wordWrap;const r=t.toFontString(),o=ze.measureFont(r);o.fontSize===0&&(o.fontSize=t.fontSize,o.ascent=t.fontSize);const a=n.getContext("2d",Ka);a.font=r;const h=(s?ze.wordWrap(e,t,n):e).split(/(?:\r\n|\r|\n)/),l=new Array(h.length);let c=0;for(let m=0;m<h.length;m++){const g=ze._measureText(h[m],t.letterSpacing,a);l[m]=g,c=Math.max(c,g)}let u=c+t.strokeThickness;t.dropShadow&&(u+=t.dropShadowDistance);const f=t.lineHeight||o.fontSize+t.strokeThickness;let d=Math.max(f,o.fontSize+t.strokeThickness*2)+t.leading+(h.length-1)*(f+t.leading);return t.dropShadow&&(d+=t.dropShadowDistance),new ze(e,t,u,d,h,l,f+t.leading,c,o)}static _measureText(e,t,s){let n=!1;ze.experimentalLetterSpacingSupported&&(ze.experimentalLetterSpacing?(s.letterSpacing=`${t}px`,s.textLetterSpacing=`${t}px`,n=!0):(s.letterSpacing="0px",s.textLetterSpacing="0px"));let r=s.measureText(e).width;return r>0&&(n?r-=t:r+=(ze.graphemeSegmenter(e).length-1)*t),r}static wordWrap(e,t,s=ze._canvas){const n=s.getContext("2d",Ka);let r=0,o="",a="";const h=Object.create(null),{letterSpacing:l,whiteSpace:c}=t,u=ze.collapseSpaces(c),f=ze.collapseNewlines(c);let d=!u;const m=t.wordWrapWidth+l,g=ze.tokenize(e);for(let b=0;b<g.length;b++){let _=g[b];if(ze.isNewline(_)){if(!f){a+=ze.addLine(o),d=!u,o="",r=0;continue}_=" "}if(u){const v=ze.isBreakingSpace(_),S=ze.isBreakingSpace(o[o.length-1]);if(v&&S)continue}const M=ze.getFromCache(_,l,h,n);if(M>m)if(o!==""&&(a+=ze.addLine(o),o="",r=0),ze.canBreakWords(_,t.breakWords)){const v=ze.wordWrapSplit(_);for(let S=0;S<v.length;S++){let y=v[S],I=y,E=1;for(;v[S+E];){const R=v[S+E];if(!ze.canBreakChars(I,R,_,S,t.breakWords))y+=R;else break;I=R,E++}S+=E-1;const C=ze.getFromCache(y,l,h,n);C+r>m&&(a+=ze.addLine(o),d=!1,o="",r=0),o+=y,r+=C}}else{o.length>0&&(a+=ze.addLine(o),o="",r=0);const v=b===g.length-1;a+=ze.addLine(_,!v),d=!1,o="",r=0}else M+r>m&&(d=!1,a+=ze.addLine(o),o="",r=0),(o.length>0||!ze.isBreakingSpace(_)||d)&&(o+=_,r+=M)}return a+=ze.addLine(o,!1),a}static addLine(e,t=!0){return e=ze.trimRight(e),e=t?`${e}
|
||
`:e,e}static getFromCache(e,t,s,n){let r=s[e];return typeof r!="number"&&(r=ze._measureText(e,t,n)+t,s[e]=r),r}static collapseSpaces(e){return e==="normal"||e==="pre-line"}static collapseNewlines(e){return e==="normal"}static trimRight(e){if(typeof e!="string")return"";for(let t=e.length-1;t>=0;t--){const s=e[t];if(!ze.isBreakingSpace(s))break;e=e.slice(0,-1)}return e}static isNewline(e){return typeof e!="string"?!1:ze._newlines.includes(e.charCodeAt(0))}static isBreakingSpace(e,t){return typeof e!="string"?!1:ze._breakingSpaces.includes(e.charCodeAt(0))}static tokenize(e){const t=[];let s="";if(typeof e!="string")return t;for(let n=0;n<e.length;n++){const r=e[n],o=e[n+1];if(ze.isBreakingSpace(r,o)||ze.isNewline(r)){s!==""&&(t.push(s),s=""),t.push(r);continue}s+=r}return s!==""&&t.push(s),t}static canBreakWords(e,t){return t}static canBreakChars(e,t,s,n,r){return!0}static wordWrapSplit(e){return ze.graphemeSegmenter(e)}static measureFont(e){if(ze._fonts[e])return ze._fonts[e];const t={ascent:0,descent:0,fontSize:0},s=ze._canvas,n=ze._context;n.font=e;const r=ze.METRICS_STRING+ze.BASELINE_SYMBOL,o=Math.ceil(n.measureText(r).width);let a=Math.ceil(n.measureText(ze.BASELINE_SYMBOL).width);const h=Math.ceil(ze.HEIGHT_MULTIPLIER*a);if(a=a*ze.BASELINE_MULTIPLIER|0,o===0||h===0)return ze._fonts[e]=t,t;s.width=o,s.height=h,n.fillStyle="#f00",n.fillRect(0,0,o,h),n.font=e,n.textBaseline="alphabetic",n.fillStyle="#000",n.fillText(r,0,a);const l=n.getImageData(0,0,o,h).data,c=l.length,u=o*4;let f=0,d=0,m=!1;for(f=0;f<a;++f){for(let g=0;g<u;g+=4)if(l[d+g]!==255){m=!0;break}if(!m)d+=u;else break}for(t.ascent=a-f,d=c-u,m=!1,f=h;f>a;--f){for(let g=0;g<u;g+=4)if(l[d+g]!==255){m=!0;break}if(!m)d-=u;else break}return t.descent=f-a,t.fontSize=t.ascent+t.descent,ze._fonts[e]=t,t}static clearMetrics(e=""){e?delete ze._fonts[e]:ze._fonts={}}static get _canvas(){var e;if(!ze.__canvas){let t;try{const s=new OffscreenCanvas(0,0);if((e=s.getContext("2d",Ka))!=null&&e.measureText)return ze.__canvas=s,s;t=Ve.ADAPTER.createCanvas()}catch{t=Ve.ADAPTER.createCanvas()}t.width=t.height=10,ze.__canvas=t}return ze.__canvas}static get _context(){return ze.__context||(ze.__context=ze._canvas.getContext("2d",Ka)),ze.__context}};As.METRICS_STRING="|ÉqÅ",As.BASELINE_SYMBOL="M",As.BASELINE_MULTIPLIER=1.4,As.HEIGHT_MULTIPLIER=2,As.graphemeSegmenter=(()=>{if(typeof(Intl==null?void 0:Intl.Segmenter)=="function"){const i=new Intl.Segmenter;return e=>[...i.segment(e)].map(t=>t.segment)}return i=>[...i]})(),As.experimentalLetterSpacing=!1,As._fonts={},As._newlines=[10,13],As._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288];let Ln=As;const $M=["serif","sans-serif","monospace","cursive","fantasy","system-ui"],sy=class zo{constructor(e){this.styleID=0,this.reset(),vu(this,e,e)}clone(){const e={};return vu(e,this,zo.defaultStyle),new zo(e)}reset(){vu(this,zo.defaultStyle,zo.defaultStyle)}get align(){return this._align}set align(e){this._align!==e&&(this._align=e,this.styleID++)}get breakWords(){return this._breakWords}set breakWords(e){this._breakWords!==e&&(this._breakWords=e,this.styleID++)}get dropShadow(){return this._dropShadow}set dropShadow(e){this._dropShadow!==e&&(this._dropShadow=e,this.styleID++)}get dropShadowAlpha(){return this._dropShadowAlpha}set dropShadowAlpha(e){this._dropShadowAlpha!==e&&(this._dropShadowAlpha=e,this.styleID++)}get dropShadowAngle(){return this._dropShadowAngle}set dropShadowAngle(e){this._dropShadowAngle!==e&&(this._dropShadowAngle=e,this.styleID++)}get dropShadowBlur(){return this._dropShadowBlur}set dropShadowBlur(e){this._dropShadowBlur!==e&&(this._dropShadowBlur=e,this.styleID++)}get dropShadowColor(){return this._dropShadowColor}set dropShadowColor(e){const t=gu(e);this._dropShadowColor!==t&&(this._dropShadowColor=t,this.styleID++)}get dropShadowDistance(){return this._dropShadowDistance}set dropShadowDistance(e){this._dropShadowDistance!==e&&(this._dropShadowDistance=e,this.styleID++)}get fill(){return this._fill}set fill(e){const t=gu(e);this._fill!==t&&(this._fill=t,this.styleID++)}get fillGradientType(){return this._fillGradientType}set fillGradientType(e){this._fillGradientType!==e&&(this._fillGradientType=e,this.styleID++)}get fillGradientStops(){return this._fillGradientStops}set fillGradientStops(e){GM(this._fillGradientStops,e)||(this._fillGradientStops=e,this.styleID++)}get fontFamily(){return this._fontFamily}set fontFamily(e){this.fontFamily!==e&&(this._fontFamily=e,this.styleID++)}get fontSize(){return this._fontSize}set fontSize(e){this._fontSize!==e&&(this._fontSize=e,this.styleID++)}get fontStyle(){return this._fontStyle}set fontStyle(e){this._fontStyle!==e&&(this._fontStyle=e,this.styleID++)}get fontVariant(){return this._fontVariant}set fontVariant(e){this._fontVariant!==e&&(this._fontVariant=e,this.styleID++)}get fontWeight(){return this._fontWeight}set fontWeight(e){this._fontWeight!==e&&(this._fontWeight=e,this.styleID++)}get letterSpacing(){return this._letterSpacing}set letterSpacing(e){this._letterSpacing!==e&&(this._letterSpacing=e,this.styleID++)}get lineHeight(){return this._lineHeight}set lineHeight(e){this._lineHeight!==e&&(this._lineHeight=e,this.styleID++)}get leading(){return this._leading}set leading(e){this._leading!==e&&(this._leading=e,this.styleID++)}get lineJoin(){return this._lineJoin}set lineJoin(e){this._lineJoin!==e&&(this._lineJoin=e,this.styleID++)}get miterLimit(){return this._miterLimit}set miterLimit(e){this._miterLimit!==e&&(this._miterLimit=e,this.styleID++)}get padding(){return this._padding}set padding(e){this._padding!==e&&(this._padding=e,this.styleID++)}get stroke(){return this._stroke}set stroke(e){const t=gu(e);this._stroke!==t&&(this._stroke=t,this.styleID++)}get strokeThickness(){return this._strokeThickness}set strokeThickness(e){this._strokeThickness!==e&&(this._strokeThickness=e,this.styleID++)}get textBaseline(){return this._textBaseline}set textBaseline(e){this._textBaseline!==e&&(this._textBaseline=e,this.styleID++)}get trim(){return this._trim}set trim(e){this._trim!==e&&(this._trim=e,this.styleID++)}get whiteSpace(){return this._whiteSpace}set whiteSpace(e){this._whiteSpace!==e&&(this._whiteSpace=e,this.styleID++)}get wordWrap(){return this._wordWrap}set wordWrap(e){this._wordWrap!==e&&(this._wordWrap=e,this.styleID++)}get wordWrapWidth(){return this._wordWrapWidth}set wordWrapWidth(e){this._wordWrapWidth!==e&&(this._wordWrapWidth=e,this.styleID++)}toFontString(){const e=typeof this.fontSize=="number"?`${this.fontSize}px`:this.fontSize;let t=this.fontFamily;Array.isArray(this.fontFamily)||(t=this.fontFamily.split(","));for(let s=t.length-1;s>=0;s--){let n=t[s].trim();!/([\"\'])[^\'\"]+\1/.test(n)&&!$M.includes(n)&&(n=`"${n}"`),t[s]=n}return`${this.fontStyle} ${this.fontVariant} ${this.fontWeight} ${e} ${t.join(",")}`}};sy.defaultStyle={align:"left",breakWords:!1,dropShadow:!1,dropShadowAlpha:1,dropShadowAngle:Math.PI/6,dropShadowBlur:0,dropShadowColor:"black",dropShadowDistance:5,fill:"black",fillGradientType:Bh.LINEAR_VERTICAL,fillGradientStops:[],fontFamily:"Arial",fontSize:26,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",leading:0,letterSpacing:0,lineHeight:0,lineJoin:"miter",miterLimit:10,padding:0,stroke:"black",strokeThickness:0,textBaseline:"alphabetic",trim:!1,whiteSpace:"pre",wordWrap:!1,wordWrapWidth:100};let Kn=sy;function gu(i){const e=At.shared,t=s=>{const n=e.setValue(s);return n.alpha===1?n.toHex():n.toRgbaString()};return Array.isArray(i)?i.map(t):t(i)}function GM(i,e){if(!Array.isArray(i)||!Array.isArray(e)||i.length!==e.length)return!1;for(let t=0;t<i.length;++t)if(i[t]!==e[t])return!1;return!0}function vu(i,e,t){for(const s in t)Array.isArray(e[s])?i[s]=e[s].slice():i[s]=e[s]}const jM={texture:!0,children:!1,baseTexture:!0},ny=class yd extends Qn{constructor(e,t,s){let n=!1;s||(s=Ve.ADAPTER.createCanvas(),n=!0),s.width=3,s.height=3;const r=et.from(s);r.orig=new lt,r.trim=new lt,super(r),this._ownCanvas=n,this.canvas=s,this.context=s.getContext("2d",{willReadFrequently:!0}),this._resolution=yd.defaultResolution??Ve.RESOLUTION,this._autoResolution=yd.defaultAutoResolution,this._text=null,this._style=null,this._styleListener=null,this._font="",this.text=e,this.style=t,this.localStyleID=-1}static get experimentalLetterSpacing(){return Ln.experimentalLetterSpacing}static set experimentalLetterSpacing(e){pt("7.1.0","Text.experimentalLetterSpacing is deprecated, use TextMetrics.experimentalLetterSpacing"),Ln.experimentalLetterSpacing=e}updateText(e){const t=this._style;if(this.localStyleID!==t.styleID&&(this.dirty=!0,this.localStyleID=t.styleID),!this.dirty&&e)return;this._font=this._style.toFontString();const s=this.context,n=Ln.measureText(this._text||" ",this._style,this._style.wordWrap,this.canvas),r=n.width,o=n.height,a=n.lines,h=n.lineHeight,l=n.lineWidths,c=n.maxLineWidth,u=n.fontProperties;this.canvas.width=Math.ceil(Math.ceil(Math.max(1,r)+t.padding*2)*this._resolution),this.canvas.height=Math.ceil(Math.ceil(Math.max(1,o)+t.padding*2)*this._resolution),s.scale(this._resolution,this._resolution),s.clearRect(0,0,this.canvas.width,this.canvas.height),s.font=this._font,s.lineWidth=t.strokeThickness,s.textBaseline=t.textBaseline,s.lineJoin=t.lineJoin,s.miterLimit=t.miterLimit;let f,d;const m=t.dropShadow?2:1;for(let g=0;g<m;++g){const b=t.dropShadow&&g===0,_=b?Math.ceil(Math.max(1,o)+t.padding*2):0,M=_*this._resolution;if(b){s.fillStyle="black",s.strokeStyle="black";const S=t.dropShadowColor,y=t.dropShadowBlur*this._resolution,I=t.dropShadowDistance*this._resolution;s.shadowColor=At.shared.setValue(S).setAlpha(t.dropShadowAlpha).toRgbaString(),s.shadowBlur=y,s.shadowOffsetX=Math.cos(t.dropShadowAngle)*I,s.shadowOffsetY=Math.sin(t.dropShadowAngle)*I+M}else s.fillStyle=this._generateFillStyle(t,a,n),s.strokeStyle=t.stroke,s.shadowColor="black",s.shadowBlur=0,s.shadowOffsetX=0,s.shadowOffsetY=0;let v=(h-u.fontSize)/2;h-u.fontSize<0&&(v=0);for(let S=0;S<a.length;S++)f=t.strokeThickness/2,d=t.strokeThickness/2+S*h+u.ascent+v,t.align==="right"?f+=c-l[S]:t.align==="center"&&(f+=(c-l[S])/2),t.stroke&&t.strokeThickness&&this.drawLetterSpacing(a[S],f+t.padding,d+t.padding-_,!0),t.fill&&this.drawLetterSpacing(a[S],f+t.padding,d+t.padding-_)}this.updateTexture()}drawLetterSpacing(e,t,s,n=!1){const r=this._style.letterSpacing;let o=!1;if(Ln.experimentalLetterSpacingSupported&&(Ln.experimentalLetterSpacing?(this.context.letterSpacing=`${r}px`,this.context.textLetterSpacing=`${r}px`,o=!0):(this.context.letterSpacing="0px",this.context.textLetterSpacing="0px")),r===0||o){n?this.context.strokeText(e,t,s):this.context.fillText(e,t,s);return}let a=t;const h=Ln.graphemeSegmenter(e);let l=this.context.measureText(e).width,c=0;for(let u=0;u<h.length;++u){const f=h[u];n?this.context.strokeText(f,a,s):this.context.fillText(f,a,s);let d="";for(let m=u+1;m<h.length;++m)d+=h[m];c=this.context.measureText(d).width,a+=l-c+r,l=c}}updateTexture(){const e=this.canvas;if(this._style.trim){const o=d_(e);o.data&&(e.width=o.width,e.height=o.height,this.context.putImageData(o.data,0,0))}const t=this._texture,s=this._style,n=s.trim?0:s.padding,r=t.baseTexture;t.trim.width=t._frame.width=e.width/this._resolution,t.trim.height=t._frame.height=e.height/this._resolution,t.trim.x=-n,t.trim.y=-n,t.orig.width=t._frame.width-n*2,t.orig.height=t._frame.height-n*2,this._onTextureUpdate(),r.setRealSize(e.width,e.height,this._resolution),t.updateUvs(),this.dirty=!1}_render(e){this._autoResolution&&this._resolution!==e.resolution&&(this._resolution=e.resolution,this.dirty=!0),this.updateText(!0),super._render(e)}updateTransform(){this.updateText(!0),super.updateTransform()}getBounds(e,t){return this.updateText(!0),this._textureID===-1&&(e=!1),super.getBounds(e,t)}getLocalBounds(e){return this.updateText(!0),super.getLocalBounds.call(this,e)}_calculateBounds(){this.calculateVertices(),this._bounds.addQuad(this.vertexData)}_generateFillStyle(e,t,s){const n=e.fill;if(Array.isArray(n)){if(n.length===1)return n[0]}else return n;let r;const o=e.dropShadow?e.dropShadowDistance:0,a=e.padding||0,h=this.canvas.width/this._resolution-o-a*2,l=this.canvas.height/this._resolution-o-a*2,c=n.slice(),u=e.fillGradientStops.slice();if(!u.length){const f=c.length+1;for(let d=1;d<f;++d)u.push(d/f)}if(c.unshift(n[0]),u.unshift(0),c.push(n[n.length-1]),u.push(1),e.fillGradientType===Bh.LINEAR_VERTICAL){r=this.context.createLinearGradient(h/2,a,h/2,l+a);const f=s.fontProperties.fontSize+e.strokeThickness;for(let d=0;d<t.length;d++){const m=s.lineHeight*(d-1)+f,g=s.lineHeight*d;let b=g;d>0&&m>g&&(b=(g+m)/2);const _=g+f,M=s.lineHeight*(d+1);let v=_;d+1<t.length&&M<_&&(v=(_+M)/2);const S=(v-b)/l;for(let y=0;y<c.length;y++){let I=0;typeof u[y]=="number"?I=u[y]:I=y/c.length;let E=Math.min(1,Math.max(0,b/l+I*S));E=Number(E.toFixed(5)),r.addColorStop(E,c[y])}}}else{r=this.context.createLinearGradient(a,l/2,h+a,l/2);const f=c.length+1;let d=1;for(let m=0;m<c.length;m++){let g;typeof u[m]=="number"?g=u[m]:g=d/f,r.addColorStop(g,c[m]),d++}}return r}destroy(e){typeof e=="boolean"&&(e={children:e}),e=Object.assign({},jM,e),super.destroy(e),this._ownCanvas&&(this.canvas.height=this.canvas.width=0),this.context=null,this.canvas=null,this._style=null}get width(){return this.updateText(!0),Math.abs(this.scale.x)*this._texture.orig.width}set width(e){this.updateText(!0);const t=Gn(this.scale.x)||1;this.scale.x=t*e/this._texture.orig.width,this._width=e}get height(){return this.updateText(!0),Math.abs(this.scale.y)*this._texture.orig.height}set height(e){this.updateText(!0);const t=Gn(this.scale.y)||1;this.scale.y=t*e/this._texture.orig.height,this._height=e}get style(){return this._style}set style(e){e=e||{},e instanceof Kn?this._style=e:this._style=new Kn(e),this.localStyleID=-1,this.dirty=!0}get text(){return this._text}set text(e){e=String(e??""),this._text!==e&&(this._text=e,this.dirty=!0)}get resolution(){return this._resolution}set resolution(e){this._autoResolution=!1,this._resolution!==e&&(this._resolution=e,this.dirty=!0)}};ny.defaultAutoResolution=!0;let cf=ny;class HM{constructor(e){this.maxItemsPerFrame=e,this.itemsLeft=0}beginFrame(){this.itemsLeft=this.maxItemsPerFrame}allowedToUpload(){return this.itemsLeft-- >0}}function WM(i,e){var s;let t=!1;if((s=i==null?void 0:i._textures)!=null&&s.length){for(let n=0;n<i._textures.length;n++)if(i._textures[n]instanceof et){const r=i._textures[n].baseTexture;e.includes(r)||(e.push(r),t=!0)}}return t}function zM(i,e){if(i.baseTexture instanceof st){const t=i.baseTexture;return e.includes(t)||e.push(t),!0}return!1}function qM(i,e){if(i._texture&&i._texture instanceof et){const t=i._texture.baseTexture;return e.includes(t)||e.push(t),!0}return!1}function KM(i,e){return e instanceof cf?(e.updateText(!0),!0):!1}function ZM(i,e){if(e instanceof Kn){const t=e.toFontString();return Ln.measureFont(t),!0}return!1}function JM(i,e){if(i instanceof cf){e.includes(i.style)||e.push(i.style),e.includes(i)||e.push(i);const t=i._texture.baseTexture;return e.includes(t)||e.push(t),!0}return!1}function QM(i,e){return i instanceof Kn?(e.includes(i)||e.push(i),!0):!1}const ry=class oy{constructor(e){this.limiter=new HM(oy.uploadsPerFrame),this.renderer=e,this.uploadHookHelper=null,this.queue=[],this.addHooks=[],this.uploadHooks=[],this.completes=[],this.ticking=!1,this.delayedTick=()=>{this.queue&&this.prepareItems()},this.registerFindHook(JM),this.registerFindHook(QM),this.registerFindHook(WM),this.registerFindHook(zM),this.registerFindHook(qM),this.registerUploadHook(KM),this.registerUploadHook(ZM)}upload(e){return new Promise(t=>{e&&this.add(e),this.queue.length?(this.completes.push(t),this.ticking||(this.ticking=!0,Ei.system.addOnce(this.tick,this,Sr.UTILITY))):t()})}tick(){setTimeout(this.delayedTick,0)}prepareItems(){for(this.limiter.beginFrame();this.queue.length&&this.limiter.allowedToUpload();){const e=this.queue[0];let t=!1;if(e&&!e._destroyed){for(let s=0,n=this.uploadHooks.length;s<n;s++)if(this.uploadHooks[s](this.uploadHookHelper,e)){this.queue.shift(),t=!0;break}}t||this.queue.shift()}if(this.queue.length)Ei.system.addOnce(this.tick,this,Sr.UTILITY);else{this.ticking=!1;const e=this.completes.slice(0);this.completes.length=0;for(let t=0,s=e.length;t<s;t++)e[t]()}}registerFindHook(e){return e&&this.addHooks.push(e),this}registerUploadHook(e){return e&&this.uploadHooks.push(e),this}add(e){for(let t=0,s=this.addHooks.length;t<s&&!this.addHooks[t](e,this.queue);t++);if(e instanceof gi)for(let t=e.children.length-1;t>=0;t--)this.add(e.children[t]);return this}destroy(){this.ticking&&Ei.system.remove(this.tick,this),this.ticking=!1,this.addHooks=null,this.uploadHooks=null,this.renderer=null,this.completes=null,this.queue=null,this.limiter=null,this.uploadHookHelper=null}};ry.uploadsPerFrame=4;let xd=ry;Object.defineProperties(Ve,{UPLOADS_PER_FRAME:{get(){return xd.uploadsPerFrame},set(i){pt("7.1.0","settings.UPLOADS_PER_FRAME is deprecated, use prepare.BasePrepare.uploadsPerFrame"),xd.uploadsPerFrame=i}}});function ay(i,e){return e instanceof st?(e._glTextures[i.CONTEXT_UID]||i.texture.bind(e),!0):!1}function eE(i,e){if(!(e instanceof Ri))return!1;const{geometry:t}=e;e.finishPoly(),t.updateBatches();const{batches:s}=t;for(let n=0;n<s.length;n++){const{texture:r}=s[n].style;r&&ay(i,r.baseTexture)}return t.batchable||i.geometry.bind(t,e._resolveDirectShader(i)),!0}function tE(i,e){return i instanceof Ri?(e.push(i),!0):!1}class ly extends xd{constructor(e){super(e),this.uploadHookHelper=this.renderer,this.registerFindHook(tE),this.registerUploadHook(ay),this.registerUploadHook(eE)}}ly.extension={name:"prepare",type:Oe.RendererSystem};He.add(ly);var iE=`#version 300 es
|
||
#define SHADER_NAME Tiling-Sprite-100
|
||
|
||
precision lowp float;
|
||
|
||
in vec2 vTextureCoord;
|
||
|
||
out vec4 fragmentColor;
|
||
|
||
uniform sampler2D uSampler;
|
||
uniform vec4 uColor;
|
||
uniform mat3 uMapCoord;
|
||
uniform vec4 uClampFrame;
|
||
uniform vec2 uClampOffset;
|
||
|
||
void main(void)
|
||
{
|
||
vec2 coord = vTextureCoord + ceil(uClampOffset - vTextureCoord);
|
||
coord = (uMapCoord * vec3(coord, 1.0)).xy;
|
||
vec2 unclamped = coord;
|
||
coord = clamp(coord, uClampFrame.xy, uClampFrame.zw);
|
||
|
||
vec4 texSample = texture(uSampler, coord, unclamped == coord ? 0.0f : -32.0f);// lod-bias very negative to force lod 0
|
||
|
||
fragmentColor = texSample * uColor;
|
||
}
|
||
`,sE=`#version 300 es
|
||
#define SHADER_NAME Tiling-Sprite-300
|
||
|
||
precision lowp float;
|
||
|
||
in vec2 aVertexPosition;
|
||
in vec2 aTextureCoord;
|
||
|
||
uniform mat3 projectionMatrix;
|
||
uniform mat3 translationMatrix;
|
||
uniform mat3 uTransform;
|
||
|
||
out vec2 vTextureCoord;
|
||
|
||
void main(void)
|
||
{
|
||
gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
|
||
|
||
vTextureCoord = (uTransform * vec3(aTextureCoord, 1.0)).xy;
|
||
}
|
||
`,nE=`#version 100
|
||
#ifdef GL_EXT_shader_texture_lod
|
||
#extension GL_EXT_shader_texture_lod : enable
|
||
#endif
|
||
#define SHADER_NAME Tiling-Sprite-100
|
||
|
||
precision lowp float;
|
||
|
||
varying vec2 vTextureCoord;
|
||
|
||
uniform sampler2D uSampler;
|
||
uniform vec4 uColor;
|
||
uniform mat3 uMapCoord;
|
||
uniform vec4 uClampFrame;
|
||
uniform vec2 uClampOffset;
|
||
|
||
void main(void)
|
||
{
|
||
vec2 coord = vTextureCoord + ceil(uClampOffset - vTextureCoord);
|
||
coord = (uMapCoord * vec3(coord, 1.0)).xy;
|
||
vec2 unclamped = coord;
|
||
coord = clamp(coord, uClampFrame.xy, uClampFrame.zw);
|
||
|
||
#ifdef GL_EXT_shader_texture_lod
|
||
vec4 texSample = unclamped == coord
|
||
? texture2D(uSampler, coord)
|
||
: texture2DLodEXT(uSampler, coord, 0);
|
||
#else
|
||
vec4 texSample = texture2D(uSampler, coord);
|
||
#endif
|
||
|
||
gl_FragColor = texSample * uColor;
|
||
}
|
||
`,Zm=`#version 100
|
||
#define SHADER_NAME Tiling-Sprite-100
|
||
|
||
precision lowp float;
|
||
|
||
attribute vec2 aVertexPosition;
|
||
attribute vec2 aTextureCoord;
|
||
|
||
uniform mat3 projectionMatrix;
|
||
uniform mat3 translationMatrix;
|
||
uniform mat3 uTransform;
|
||
|
||
varying vec2 vTextureCoord;
|
||
|
||
void main(void)
|
||
{
|
||
gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
|
||
|
||
vTextureCoord = (uTransform * vec3(aTextureCoord, 1.0)).xy;
|
||
}
|
||
`,rE=`#version 100
|
||
#define SHADER_NAME Tiling-Sprite-Simple-100
|
||
|
||
precision lowp float;
|
||
|
||
varying vec2 vTextureCoord;
|
||
|
||
uniform sampler2D uSampler;
|
||
uniform vec4 uColor;
|
||
|
||
void main(void)
|
||
{
|
||
vec4 texSample = texture2D(uSampler, vTextureCoord);
|
||
gl_FragColor = texSample * uColor;
|
||
}
|
||
`;const Za=new Vt;class hy extends kh{constructor(e){super(e),e.runners.contextChange.add(this),this.quad=new pv,this.state=zs.for2d()}contextChange(){const e=this.renderer,t={globals:e.globalUniforms};this.simpleShader=ps.from(Zm,rE,t),this.shader=e.context.webGLVersion>1?ps.from(sE,iE,t):ps.from(Zm,nE,t)}render(e){const t=this.renderer,s=this.quad;let n=s.vertices;n[0]=n[6]=e._width*-e.anchor.x,n[1]=n[3]=e._height*-e.anchor.y,n[2]=n[4]=e._width*(1-e.anchor.x),n[5]=n[7]=e._height*(1-e.anchor.y);const r=e.uvRespectAnchor?e.anchor.x:0,o=e.uvRespectAnchor?e.anchor.y:0;n=s.uvs,n[0]=n[6]=-r,n[1]=n[3]=-o,n[2]=n[4]=1-r,n[5]=n[7]=1-o,s.invalidate();const a=e._texture,h=a.baseTexture,l=h.alphaMode>0,c=e.tileTransform.localTransform,u=e.uvMatrix;let f=h.isPowerOfTwo&&a.frame.width===h.width&&a.frame.height===h.height;f&&(h._glTextures[t.CONTEXT_UID]?f=h.wrapMode!==us.CLAMP:h.wrapMode===us.CLAMP&&(h.wrapMode=us.REPEAT));const d=f?this.simpleShader:this.shader,m=a.width,g=a.height,b=e._width,_=e._height;Za.set(c.a*m/b,c.b*m/_,c.c*g/b,c.d*g/_,c.tx/b,c.ty/_),Za.invert(),f?Za.prepend(u.mapCoord):(d.uniforms.uMapCoord=u.mapCoord.toArray(!0),d.uniforms.uClampFrame=u.uClampFrame,d.uniforms.uClampOffset=u.uClampOffset),d.uniforms.uTransform=Za.toArray(!0),d.uniforms.uColor=At.shared.setValue(e.tint).premultiply(e.worldAlpha,l).toArray(d.uniforms.uColor),d.uniforms.translationMatrix=e.transform.worldTransform.toArray(!0),d.uniforms.uSampler=a,t.shader.bind(d),t.geometry.bind(s),this.state.blendMode=ev(e.blendMode,l),t.state.set(this.state),t.geometry.draw(this.renderer.gl.TRIANGLES,6,0)}}hy.extension={name:"tilingSprite",type:Oe.RendererPlugin};He.add(hy);const cy=class qo{constructor(e,t,s){this.linkedSheets=[],(e instanceof st||e instanceof et)&&(e={texture:e,data:t,resolutionFilename:s});const{texture:n,data:r,resolutionFilename:o=null,cachePrefix:a=""}=e;this.cachePrefix=a,this._texture=n instanceof et?n:null,this.baseTexture=n instanceof st?n:this._texture.baseTexture,this.textures={},this.animations={},this.data=r;const h=this.baseTexture.resource;this.resolution=this._updateResolution(o||(h?h.url:null)),this._frames=this.data.frames,this._frameKeys=Object.keys(this._frames),this._batchIndex=0,this._callback=null}_updateResolution(e=null){const{scale:t}=this.data.meta;let s=_n(e,null);return s===null&&(s=typeof t=="number"?t:parseFloat(t??"1")),s!==1&&this.baseTexture.setResolution(s),s}parse(){return new Promise(e=>{this._callback=e,this._batchIndex=0,this._frameKeys.length<=qo.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()})}_processFrames(e){let t=e;const s=qo.BATCH_SIZE;for(;t-e<s&&t<this._frameKeys.length;){const n=this._frameKeys[t],r=this._frames[n],o=r.frame;if(o){let a=null,h=null;const l=r.trimmed!==!1&&r.sourceSize?r.sourceSize:r.frame,c=new lt(0,0,Math.floor(l.w)/this.resolution,Math.floor(l.h)/this.resolution);r.rotated?a=new lt(Math.floor(o.x)/this.resolution,Math.floor(o.y)/this.resolution,Math.floor(o.h)/this.resolution,Math.floor(o.w)/this.resolution):a=new lt(Math.floor(o.x)/this.resolution,Math.floor(o.y)/this.resolution,Math.floor(o.w)/this.resolution,Math.floor(o.h)/this.resolution),r.trimmed!==!1&&r.spriteSourceSize&&(h=new lt(Math.floor(r.spriteSourceSize.x)/this.resolution,Math.floor(r.spriteSourceSize.y)/this.resolution,Math.floor(o.w)/this.resolution,Math.floor(o.h)/this.resolution)),this.textures[n]=new et(this.baseTexture,a,c,h,r.rotated?2:0,r.anchor,r.borders),et.addToCache(this.textures[n],this.cachePrefix+n.toString())}t++}}_processAnimations(){const e=this.data.animations||{};for(const t in e){this.animations[t]=[];for(let s=0;s<e[t].length;s++){const n=e[t][s];this.animations[t].push(this.textures[n])}}}_parseComplete(){const e=this._callback;this._callback=null,this._batchIndex=0,e.call(this,this.textures)}_nextBatch(){this._processFrames(this._batchIndex*qo.BATCH_SIZE),this._batchIndex++,setTimeout(()=>{this._batchIndex*qo.BATCH_SIZE<this._frameKeys.length?this._nextBatch():(this._processAnimations(),this._parseComplete())},0)}destroy(e=!1){var t;for(const s in this.textures)this.textures[s].destroy();this._frames=null,this._frameKeys=null,this.data=null,this.textures=null,e&&((t=this._texture)==null||t.destroy(),this.baseTexture.destroy()),this._texture=null,this.baseTexture=null,this.linkedSheets=[]}};cy.BATCH_SIZE=1e3;let Jm=cy;const oE=["jpg","png","jpeg","avif","webp","s3tc","s3tc_sRGB","etc","etc1","pvrtc","atc","astc","bptc"];function uy(i,e,t){const s={};if(i.forEach(n=>{s[n]=e}),Object.keys(e.textures).forEach(n=>{s[`${e.cachePrefix}${n}`]=e.textures[n]}),!t){const n=zt.dirname(i[0]);e.linkedSheets.forEach((r,o)=>{Object.assign(s,uy([`${n}/${e.data.meta.related_multi_packs[o]}`],r,!0))})}return s}const aE={extension:Oe.Asset,cache:{test:i=>i instanceof Jm,getCacheableAssets:(i,e)=>uy(i,e,!1)},resolver:{test:i=>{const e=i.split("?")[0].split("."),t=e.pop(),s=e.pop();return t==="json"&&oE.includes(s)},parse:i=>{var t;const e=i.split(".");return{resolution:parseFloat(((t=Ve.RETINA_PREFIX.exec(i))==null?void 0:t[1])??"1"),format:e[e.length-2],src:i}}},loader:{name:"spritesheetLoader",extension:{type:Oe.LoadParser,priority:Yi.Normal},async testParse(i,e){return zt.extname(e.src).toLowerCase()===".json"&&!!i.frames},async parse(i,e,t){var c,u;const{texture:s,imageFilename:n,cachePrefix:r}=(e==null?void 0:e.data)??{};let o=zt.dirname(e.src);o&&o.lastIndexOf("/")!==o.length-1&&(o+="/");let a;if(s&&s.baseTexture)a=s;else{const f=Vl(o+(n??i.meta.image),e.src);a=(await t.load([f]))[f]}const h=new Jm({texture:a.baseTexture,data:i,resolutionFilename:e.src,cachePrefix:r});await h.parse();const l=(c=i==null?void 0:i.meta)==null?void 0:c.related_multi_packs;if(Array.isArray(l)){const f=[];for(const m of l){if(typeof m!="string")continue;let g=o+m;(u=e.data)!=null&&u.ignoreMultiPack||(g=Vl(g,e.src),f.push(t.load({src:g,data:{ignoreMultiPack:!0}})))}const d=await Promise.all(f);h.linkedSheets=d,d.forEach(m=>{m.linkedSheets=[h].concat(h.linkedSheets.filter(g=>g!==m))})}return h},unload(i){i.destroy(!0)}}};He.add(aE);class Hl{constructor(){this.info=[],this.common=[],this.page=[],this.char=[],this.kerning=[],this.distanceField=[]}}class xl{static test(e){return typeof e=="string"&&e.startsWith("info face=")}static parse(e){const t=e.match(/^[a-z]+\s+.+$/gm),s={info:[],common:[],page:[],char:[],chars:[],kerning:[],kernings:[],distanceField:[]};for(const r in t){const o=t[r].match(/^[a-z]+/gm)[0],a=t[r].match(/[a-zA-Z]+=([^\s"']+|"([^"]*)")/gm),h={};for(const l in a){const c=a[l].split("="),u=c[0],f=c[1].replace(/"/gm,""),d=parseFloat(f),m=isNaN(d)?f:d;h[u]=m}s[o].push(h)}const n=new Hl;return s.info.forEach(r=>n.info.push({face:r.face,size:parseInt(r.size,10)})),s.common.forEach(r=>n.common.push({lineHeight:parseInt(r.lineHeight,10)})),s.page.forEach(r=>n.page.push({id:parseInt(r.id,10),file:r.file})),s.char.forEach(r=>n.char.push({id:parseInt(r.id,10),page:parseInt(r.page,10),x:parseInt(r.x,10),y:parseInt(r.y,10),width:parseInt(r.width,10),height:parseInt(r.height,10),xoffset:parseInt(r.xoffset,10),yoffset:parseInt(r.yoffset,10),xadvance:parseInt(r.xadvance,10)})),s.kerning.forEach(r=>n.kerning.push({first:parseInt(r.first,10),second:parseInt(r.second,10),amount:parseInt(r.amount,10)})),s.distanceField.forEach(r=>n.distanceField.push({distanceRange:parseInt(r.distanceRange,10),fieldType:r.fieldType})),n}}class bd{static test(e){const t=e;return typeof e!="string"&&"getElementsByTagName"in e&&t.getElementsByTagName("page").length&&t.getElementsByTagName("info")[0].getAttribute("face")!==null}static parse(e){const t=new Hl,s=e.getElementsByTagName("info"),n=e.getElementsByTagName("common"),r=e.getElementsByTagName("page"),o=e.getElementsByTagName("char"),a=e.getElementsByTagName("kerning"),h=e.getElementsByTagName("distanceField");for(let l=0;l<s.length;l++)t.info.push({face:s[l].getAttribute("face"),size:parseInt(s[l].getAttribute("size"),10)});for(let l=0;l<n.length;l++)t.common.push({lineHeight:parseInt(n[l].getAttribute("lineHeight"),10)});for(let l=0;l<r.length;l++)t.page.push({id:parseInt(r[l].getAttribute("id"),10)||0,file:r[l].getAttribute("file")});for(let l=0;l<o.length;l++){const c=o[l];t.char.push({id:parseInt(c.getAttribute("id"),10),page:parseInt(c.getAttribute("page"),10)||0,x:parseInt(c.getAttribute("x"),10),y:parseInt(c.getAttribute("y"),10),width:parseInt(c.getAttribute("width"),10),height:parseInt(c.getAttribute("height"),10),xoffset:parseInt(c.getAttribute("xoffset"),10),yoffset:parseInt(c.getAttribute("yoffset"),10),xadvance:parseInt(c.getAttribute("xadvance"),10)})}for(let l=0;l<a.length;l++)t.kerning.push({first:parseInt(a[l].getAttribute("first"),10),second:parseInt(a[l].getAttribute("second"),10),amount:parseInt(a[l].getAttribute("amount"),10)});for(let l=0;l<h.length;l++)t.distanceField.push({fieldType:h[l].getAttribute("fieldType"),distanceRange:parseInt(h[l].getAttribute("distanceRange"),10)});return t}}class wd{static test(e){return typeof e=="string"&&e.includes("<font>")?bd.test(Ve.ADAPTER.parseXML(e)):!1}static parse(e){return bd.parse(Ve.ADAPTER.parseXML(e))}}const yu=[xl,bd,wd];function lE(i){for(let e=0;e<yu.length;e++)if(yu[e].test(i))return yu[e];return null}function hE(i,e,t,s,n,r){const o=t.fill;if(Array.isArray(o)){if(o.length===1)return o[0]}else return o;let a;const h=t.dropShadow?t.dropShadowDistance:0,l=t.padding||0,c=i.width/s-h-l*2,u=i.height/s-h-l*2,f=o.slice(),d=t.fillGradientStops.slice();if(!d.length){const m=f.length+1;for(let g=1;g<m;++g)d.push(g/m)}if(f.unshift(o[0]),d.unshift(0),f.push(o[o.length-1]),d.push(1),t.fillGradientType===Bh.LINEAR_VERTICAL){a=e.createLinearGradient(c/2,l,c/2,u+l);let m=0;const g=(r.fontProperties.fontSize+t.strokeThickness)/u;for(let b=0;b<n.length;b++){const _=r.lineHeight*b;for(let M=0;M<f.length;M++){let v=0;typeof d[M]=="number"?v=d[M]:v=M/f.length;const S=_/u+v*g;let y=Math.max(m,S);y=Math.min(y,1),a.addColorStop(y,f[M]),m=y}}}else{a=e.createLinearGradient(l,u/2,c+l,u/2);const m=f.length+1;let g=1;for(let b=0;b<f.length;b++){let _;typeof d[b]=="number"?_=d[b]:_=g/m,a.addColorStop(_,f[b]),g++}}return a}function cE(i,e,t,s,n,r,o){const a=t.text,h=t.fontProperties;e.translate(s,n),e.scale(r,r);const l=o.strokeThickness/2,c=-(o.strokeThickness/2);if(e.font=o.toFontString(),e.lineWidth=o.strokeThickness,e.textBaseline=o.textBaseline,e.lineJoin=o.lineJoin,e.miterLimit=o.miterLimit,e.fillStyle=hE(i,e,o,r,[a],t),e.strokeStyle=o.stroke,o.dropShadow){const u=o.dropShadowColor,f=o.dropShadowBlur*r,d=o.dropShadowDistance*r;e.shadowColor=At.shared.setValue(u).setAlpha(o.dropShadowAlpha).toRgbaString(),e.shadowBlur=f,e.shadowOffsetX=Math.cos(o.dropShadowAngle)*d,e.shadowOffsetY=Math.sin(o.dropShadowAngle)*d}else e.shadowColor="black",e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0;o.stroke&&o.strokeThickness&&e.strokeText(a,l,c+t.lineHeight-h.descent),o.fill&&e.fillText(a,l,c+t.lineHeight-h.descent),e.setTransform(1,0,0,1,0,0),e.fillStyle="rgba(0, 0, 0, 0)"}function bl(i){return i.codePointAt?i.codePointAt(0):i.charCodeAt(0)}function dy(i){return Array.from?Array.from(i):i.split("")}function uE(i){typeof i=="string"&&(i=[i]);const e=[];for(let t=0,s=i.length;t<s;t++){const n=i[t];if(Array.isArray(n)){if(n.length!==2)throw new Error(`[BitmapFont]: Invalid character range length, expecting 2 got ${n.length}.`);const r=n[0].charCodeAt(0),o=n[1].charCodeAt(0);if(o<r)throw new Error("[BitmapFont]: Invalid character range.");for(let a=r,h=o;a<=h;a++)e.push(String.fromCharCode(a))}else e.push(...dy(n))}if(e.length===0)throw new Error("[BitmapFont]: Empty set when resolving characters.");return e}const kn=class Cs{constructor(e,t,s){var c;const[n]=e.info,[r]=e.common,[o]=e.page,[a]=e.distanceField,h=_n(o.file),l={};this._ownsTextures=s,this.font=n.face,this.size=n.size,this.lineHeight=r.lineHeight/h,this.chars={},this.pageTextures=l;for(let u=0;u<e.page.length;u++){const{id:f,file:d}=e.page[u];l[f]=t instanceof Array?t[u]:t[d],a!=null&&a.fieldType&&a.fieldType!=="none"&&(l[f].baseTexture.alphaMode=ui.NO_PREMULTIPLIED_ALPHA,l[f].baseTexture.mipmap=Ki.OFF)}for(let u=0;u<e.char.length;u++){const{id:f,page:d}=e.char[u];let{x:m,y:g,width:b,height:_,xoffset:M,yoffset:v,xadvance:S}=e.char[u];m/=h,g/=h,b/=h,_/=h,M/=h,v/=h,S/=h;const y=new lt(m+l[d].frame.x/h,g+l[d].frame.y/h,b,_);this.chars[f]={xOffset:M,yOffset:v,xAdvance:S,kerning:{},texture:new et(l[d].baseTexture,y),page:d}}for(let u=0;u<e.kerning.length;u++){let{first:f,second:d,amount:m}=e.kerning[u];f/=h,d/=h,m/=h,this.chars[d]&&(this.chars[d].kerning[f]=m)}this.distanceFieldRange=a==null?void 0:a.distanceRange,this.distanceFieldType=((c=a==null?void 0:a.fieldType)==null?void 0:c.toLowerCase())??"none"}destroy(){for(const e in this.chars)this.chars[e].texture.destroy(),this.chars[e].texture=null;for(const e in this.pageTextures)this._ownsTextures&&this.pageTextures[e].destroy(!0),this.pageTextures[e]=null;this.chars=null,this.pageTextures=null}static install(e,t,s){let n;if(e instanceof Hl)n=e;else{const o=lE(e);if(!o)throw new Error("Unrecognized data format for font.");n=o.parse(e)}t instanceof et&&(t=[t]);const r=new Cs(n,t,s);return Cs.available[r.font]=r,r}static uninstall(e){const t=Cs.available[e];if(!t)throw new Error(`No font found named '${e}'`);t.destroy(),delete Cs.available[e]}static from(e,t,s){if(!e)throw new Error("[BitmapFont] Property `name` is required.");const{chars:n,padding:r,resolution:o,textureWidth:a,textureHeight:h,...l}=Object.assign({},Cs.defaultOptions,s),c=uE(n),u=t instanceof Kn?t:new Kn(t),f=a,d=new Hl;d.info[0]={face:u.fontFamily,size:u.fontSize},d.common[0]={lineHeight:u.fontSize};let m=0,g=0,b,_,M,v=0;const S=[];for(let I=0;I<c.length;I++){b||(b=Ve.ADAPTER.createCanvas(),b.width=a,b.height=h,_=b.getContext("2d"),M=new st(b,{resolution:o,...l}),S.push(new et(M)),d.page.push({id:S.length-1,file:""}));const E=c[I],C=Ln.measureText(E,u,!1,b),R=C.width,B=Math.ceil(C.height),k=Math.ceil((u.fontStyle==="italic"?2:1)*R);if(g>=h-B*o){if(g===0)throw new Error(`[BitmapFont] textureHeight ${h}px is too small (fontFamily: '${u.fontFamily}', fontSize: ${u.fontSize}px, char: '${E}')`);--I,b=null,_=null,M=null,g=0,m=0,v=0;continue}if(v=Math.max(B+C.fontProperties.descent,v),k*o+m>=f){if(m===0)throw new Error(`[BitmapFont] textureWidth ${a}px is too small (fontFamily: '${u.fontFamily}', fontSize: ${u.fontSize}px, char: '${E}')`);--I,g+=v*o,g=Math.ceil(g),m=0,v=0;continue}cE(b,_,C,m,g,o,u);const F=bl(C.text);d.char.push({id:F,page:S.length-1,x:m/o,y:g/o,width:k,height:B,xoffset:0,yoffset:0,xadvance:R-(u.dropShadow?u.dropShadowDistance:0)-(u.stroke?u.strokeThickness:0)}),m+=(k+2*r)*o,m=Math.ceil(m)}if(!(s!=null&&s.skipKerning))for(let I=0,E=c.length;I<E;I++){const C=c[I];for(let R=0;R<E;R++){const B=c[R],k=_.measureText(C).width,F=_.measureText(B).width,D=_.measureText(C+B).width-(k+F);D&&d.kerning.push({first:bl(C),second:bl(B),amount:D})}}const y=new Cs(d,S,!0);return Cs.available[e]!==void 0&&Cs.uninstall(e),Cs.available[e]=y,y}};kn.ALPHA=[["a","z"],["A","Z"]," "],kn.NUMERIC=[["0","9"]],kn.ALPHANUMERIC=[["a","z"],["A","Z"],["0","9"]," "],kn.ASCII=[[" ","~"]],kn.defaultOptions={resolution:1,textureWidth:512,textureHeight:512,padding:4,chars:kn.ALPHANUMERIC},kn.available={};let Fn=kn;var dE=`// Pixi texture info\r
|
||
varying vec2 vTextureCoord;\r
|
||
uniform sampler2D uSampler;\r
|
||
\r
|
||
// Tint\r
|
||
uniform vec4 uColor;\r
|
||
\r
|
||
// on 2D applications fwidth is screenScale / glyphAtlasScale * distanceFieldRange\r
|
||
uniform float uFWidth;\r
|
||
\r
|
||
void main(void) {\r
|
||
\r
|
||
// To stack MSDF and SDF we need a non-pre-multiplied-alpha texture.\r
|
||
vec4 texColor = texture2D(uSampler, vTextureCoord);\r
|
||
\r
|
||
// MSDF\r
|
||
float median = texColor.r + texColor.g + texColor.b -\r
|
||
min(texColor.r, min(texColor.g, texColor.b)) -\r
|
||
max(texColor.r, max(texColor.g, texColor.b));\r
|
||
// SDF\r
|
||
median = min(median, texColor.a);\r
|
||
\r
|
||
float screenPxDistance = uFWidth * (median - 0.5);\r
|
||
float alpha = clamp(screenPxDistance + 0.5, 0.0, 1.0);\r
|
||
if (median < 0.01) {\r
|
||
alpha = 0.0;\r
|
||
} else if (median > 0.99) {\r
|
||
alpha = 1.0;\r
|
||
}\r
|
||
\r
|
||
// Gamma correction for coverage-like alpha\r
|
||
float luma = dot(uColor.rgb, vec3(0.299, 0.587, 0.114));\r
|
||
float gamma = mix(1.0, 1.0 / 2.2, luma);\r
|
||
float coverage = pow(uColor.a * alpha, gamma); \r
|
||
\r
|
||
// NPM Textures, NPM outputs\r
|
||
gl_FragColor = vec4(uColor.rgb, coverage);\r
|
||
}\r
|
||
`,fE=`// Mesh material default fragment\r
|
||
attribute vec2 aVertexPosition;\r
|
||
attribute vec2 aTextureCoord;\r
|
||
\r
|
||
uniform mat3 projectionMatrix;\r
|
||
uniform mat3 translationMatrix;\r
|
||
uniform mat3 uTextureMatrix;\r
|
||
\r
|
||
varying vec2 vTextureCoord;\r
|
||
\r
|
||
void main(void)\r
|
||
{\r
|
||
gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\r
|
||
\r
|
||
vTextureCoord = (uTextureMatrix * vec3(aTextureCoord, 1.0)).xy;\r
|
||
}\r
|
||
`;const Qm=[],eg=[],tg=[],pE=class fy extends gi{constructor(e,t={}){super();const{align:s,tint:n,maxWidth:r,letterSpacing:o,fontName:a,fontSize:h}=Object.assign({},fy.styleDefaults,t);if(!Fn.available[a])throw new Error(`Missing BitmapFont "${a}"`);this._activePagesMeshData=[],this._textWidth=0,this._textHeight=0,this._align=s,this._tintColor=new At(n),this._font=void 0,this._fontName=a,this._fontSize=h,this.text=e,this._maxWidth=r,this._maxLineHeight=0,this._letterSpacing=o,this._anchor=new fn(()=>{this.dirty=!0},this,0,0),this._roundPixels=Ve.ROUND_PIXELS,this.dirty=!0,this._resolution=Ve.RESOLUTION,this._autoResolution=!0,this._textureCache={}}updateText(){var k;const e=Fn.available[this._fontName],t=this.fontSize,s=t/e.size,n=new bt,r=[],o=[],a=[],h=this._text.replace(/(?:\r\n|\r)/g,`
|
||
`)||" ",l=dy(h),c=this._maxWidth*e.size/t,u=e.distanceFieldType==="none"?Qm:eg;let f=null,d=0,m=0,g=0,b=-1,_=0,M=0,v=0,S=0;for(let F=0;F<l.length;F++){const D=l[F],N=bl(D);if(/(?:\s)/.test(D)&&(b=F,_=d,S++),D==="\r"||D===`
|
||
`){o.push(d),a.push(-1),m=Math.max(m,d),++g,++M,n.x=0,n.y+=e.lineHeight,f=null,S=0;continue}const j=e.chars[N];if(!j)continue;f&&j.kerning[f]&&(n.x+=j.kerning[f]);const O=tg.pop()||{texture:et.EMPTY,line:0,charCode:0,prevSpaces:0,position:new bt};O.texture=j.texture,O.line=g,O.charCode=N,O.position.x=Math.round(n.x+j.xOffset+this._letterSpacing/2),O.position.y=Math.round(n.y+j.yOffset),O.prevSpaces=S,r.push(O),d=O.position.x+Math.max(j.xAdvance-j.xOffset,j.texture.orig.width),n.x+=j.xAdvance+this._letterSpacing,v=Math.max(v,j.yOffset+j.texture.height),f=N,b!==-1&&c>0&&n.x>c&&(++M,ao(r,1+b-M,1+F-b),F=b,b=-1,o.push(_),a.push(r.length>0?r[r.length-1].prevSpaces:0),m=Math.max(m,_),g++,n.x=0,n.y+=e.lineHeight,f=null,S=0)}const y=l[l.length-1];y!=="\r"&&y!==`
|
||
`&&(/(?:\s)/.test(y)&&(d=_),o.push(d),m=Math.max(m,d),a.push(-1));const I=[];for(let F=0;F<=g;F++){let D=0;this._align==="right"?D=m-o[F]:this._align==="center"?D=(m-o[F])/2:this._align==="justify"&&(D=a[F]<0?0:(m-o[F])/a[F]),I.push(D)}const E=r.length,C={},R=[],B=this._activePagesMeshData;u.push(...B);for(let F=0;F<E;F++){const D=r[F].texture,N=D.baseTexture.uid;if(!C[N]){let j=u.pop();if(!j){const L=new hf;let P,X;e.distanceFieldType==="none"?(P=new jl(et.EMPTY),X=Qe.NORMAL):(P=new jl(et.EMPTY,{program:Vs.from(fE,dE),uniforms:{uFWidth:0}}),X=Qe.NORMAL_NPM);const U=new ma(L,P);U.blendMode=X,j={index:0,indexCount:0,vertexCount:0,uvsCount:0,total:0,mesh:U,vertices:null,uvs:null,indices:null}}j.index=0,j.indexCount=0,j.vertexCount=0,j.uvsCount=0,j.total=0;const{_textureCache:O}=this;O[N]=O[N]||new et(D.baseTexture),j.mesh.texture=O[N],j.mesh.tint=this._tintColor.value,R.push(j),C[N]=j}C[N].total++}for(let F=0;F<B.length;F++)R.includes(B[F])||this.removeChild(B[F].mesh);for(let F=0;F<R.length;F++)R[F].mesh.parent!==this&&this.addChild(R[F].mesh);this._activePagesMeshData=R;for(const F in C){const D=C[F],N=D.total;if(!(((k=D.indices)==null?void 0:k.length)>6*N)||D.vertices.length<ma.BATCHABLE_SIZE*2)D.vertices=new Float32Array(8*N),D.uvs=new Float32Array(8*N),D.indices=new Uint16Array(6*N);else{const j=D.total,O=D.vertices;for(let L=j*4*2;L<O.length;L++)O[L]=0}D.mesh.size=6*N}for(let F=0;F<E;F++){const D=r[F];let N=D.position.x+I[D.line]*(this._align==="justify"?D.prevSpaces:1);this._roundPixels&&(N=Math.round(N));const j=N*s,O=D.position.y*s,L=D.texture,P=C[L.baseTexture.uid],X=L.frame,U=L._uvs,Y=P.index++;P.indices[Y*6+0]=0+Y*4,P.indices[Y*6+1]=1+Y*4,P.indices[Y*6+2]=2+Y*4,P.indices[Y*6+3]=0+Y*4,P.indices[Y*6+4]=2+Y*4,P.indices[Y*6+5]=3+Y*4,P.vertices[Y*8+0]=j,P.vertices[Y*8+1]=O,P.vertices[Y*8+2]=j+X.width*s,P.vertices[Y*8+3]=O,P.vertices[Y*8+4]=j+X.width*s,P.vertices[Y*8+5]=O+X.height*s,P.vertices[Y*8+6]=j,P.vertices[Y*8+7]=O+X.height*s,P.uvs[Y*8+0]=U.x0,P.uvs[Y*8+1]=U.y0,P.uvs[Y*8+2]=U.x1,P.uvs[Y*8+3]=U.y1,P.uvs[Y*8+4]=U.x2,P.uvs[Y*8+5]=U.y2,P.uvs[Y*8+6]=U.x3,P.uvs[Y*8+7]=U.y3}this._textWidth=m*s,this._textHeight=(n.y+e.lineHeight)*s;for(const F in C){const D=C[F];if(this.anchor.x!==0||this.anchor.y!==0){let L=0;const P=this._textWidth*this.anchor.x,X=this._textHeight*this.anchor.y;for(let U=0;U<D.total;U++)D.vertices[L++]-=P,D.vertices[L++]-=X,D.vertices[L++]-=P,D.vertices[L++]-=X,D.vertices[L++]-=P,D.vertices[L++]-=X,D.vertices[L++]-=P,D.vertices[L++]-=X}this._maxLineHeight=v*s;const N=D.mesh.geometry.getBuffer("aVertexPosition"),j=D.mesh.geometry.getBuffer("aTextureCoord"),O=D.mesh.geometry.getIndex();N.data=D.vertices,j.data=D.uvs,O.data=D.indices,N.update(),j.update(),O.update()}for(let F=0;F<r.length;F++)tg.push(r[F]);this._font=e,this.dirty=!1}updateTransform(){this.validate(),this.containerUpdateTransform()}_render(e){this._autoResolution&&this._resolution!==e.resolution&&(this._resolution=e.resolution,this.dirty=!0);const{distanceFieldRange:t,distanceFieldType:s,size:n}=Fn.available[this._fontName];if(s!=="none"){const{a:r,b:o,c:a,d:h}=this.worldTransform,l=Math.sqrt(r*r+o*o),c=Math.sqrt(a*a+h*h),u=(Math.abs(l)+Math.abs(c))/2,f=this.fontSize/n,d=e._view.resolution;for(const m of this._activePagesMeshData)m.mesh.shader.uniforms.uFWidth=u*t*f*d}super._render(e)}getLocalBounds(){return this.validate(),super.getLocalBounds()}validate(){const e=Fn.available[this._fontName];if(!e)throw new Error(`Missing BitmapFont "${this._fontName}"`);this._font!==e&&(this.dirty=!0),this.dirty&&this.updateText()}get tint(){return this._tintColor.value}set tint(e){if(this.tint!==e){this._tintColor.setValue(e);for(let t=0;t<this._activePagesMeshData.length;t++)this._activePagesMeshData[t].mesh.tint=e}}get align(){return this._align}set align(e){this._align!==e&&(this._align=e,this.dirty=!0)}get fontName(){return this._fontName}set fontName(e){if(!Fn.available[e])throw new Error(`Missing BitmapFont "${e}"`);this._fontName!==e&&(this._fontName=e,this.dirty=!0)}get fontSize(){return this._fontSize??Fn.available[this._fontName].size}set fontSize(e){this._fontSize!==e&&(this._fontSize=e,this.dirty=!0)}get anchor(){return this._anchor}set anchor(e){typeof e=="number"?this._anchor.set(e):this._anchor.copyFrom(e)}get text(){return this._text}set text(e){e=String(e??""),this._text!==e&&(this._text=e,this.dirty=!0)}get maxWidth(){return this._maxWidth}set maxWidth(e){this._maxWidth!==e&&(this._maxWidth=e,this.dirty=!0)}get maxLineHeight(){return this.validate(),this._maxLineHeight}get textWidth(){return this.validate(),this._textWidth}get letterSpacing(){return this._letterSpacing}set letterSpacing(e){this._letterSpacing!==e&&(this._letterSpacing=e,this.dirty=!0)}get roundPixels(){return this._roundPixels}set roundPixels(e){e!==this._roundPixels&&(this._roundPixels=e,this.dirty=!0)}get textHeight(){return this.validate(),this._textHeight}get resolution(){return this._resolution}set resolution(e){this._autoResolution=!1,this._resolution!==e&&(this._resolution=e,this.dirty=!0)}destroy(e){const{_textureCache:t}=this,s=Fn.available[this._fontName].distanceFieldType==="none"?Qm:eg;s.push(...this._activePagesMeshData);for(const n of this._activePagesMeshData)this.removeChild(n.mesh);this._activePagesMeshData=[],s.filter(n=>t[n.mesh.texture.baseTexture.uid]).forEach(n=>{n.mesh.texture=et.EMPTY});for(const n in t)t[n].destroy(),delete t[n];this._font=null,this._tintColor=null,this._textureCache=null,super.destroy(e)}};pE.styleDefaults={align:"left",tint:16777215,maxWidth:0,letterSpacing:0};const mE=[".xml",".fnt"],gE={extension:{type:Oe.LoadParser,priority:Yi.Normal},name:"loadBitmapFont",test(i){return mE.includes(zt.extname(i).toLowerCase())},async testParse(i){return xl.test(i)||wd.test(i)},async parse(i,e,t){const s=xl.test(i)?xl.parse(i):wd.parse(i),{src:n}=e,{page:r}=s,o=[];for(let l=0;l<r.length;++l){const c=r[l].file;let u=zt.join(zt.dirname(n),c);u=Vl(u,n),o.push(u)}const a=await t.load(o),h=o.map(l=>a[l]);return Fn.install(s,h,!0)},async load(i,e){return(await Ve.ADAPTER.fetch(i)).text()},unload(i){i.destroy()}};He.add(gE);const _d=class qr extends Kn{constructor(){super(...arguments),this._fonts=[],this._overrides=[],this._stylesheet="",this.fontsDirty=!1}static from(e){return new qr(Object.keys(qr.defaultOptions).reduce((t,s)=>({...t,[s]:e[s]}),{}))}cleanFonts(){this._fonts.length>0&&(this._fonts.forEach(e=>{URL.revokeObjectURL(e.src),e.refs--,e.refs===0&&(e.fontFace&&document.fonts.delete(e.fontFace),delete qr.availableFonts[e.originalUrl])}),this.fontFamily="Arial",this._fonts.length=0,this.styleID++,this.fontsDirty=!0)}loadFont(e,t={}){const{availableFonts:s}=qr;if(s[e]){const n=s[e];return this._fonts.push(n),n.refs++,this.styleID++,this.fontsDirty=!0,Promise.resolve()}return Ve.ADAPTER.fetch(e).then(n=>n.blob()).then(async n=>new Promise((r,o)=>{const a=URL.createObjectURL(n),h=new FileReader;h.onload=()=>r([a,h.result]),h.onerror=o,h.readAsDataURL(n)})).then(async([n,r])=>{const o=Object.assign({family:zt.basename(e,zt.extname(e)),weight:"normal",style:"normal",display:"auto",src:n,dataSrc:r,refs:1,originalUrl:e,fontFace:null},t);s[e]=o,this._fonts.push(o),this.styleID++;const a=new FontFace(o.family,`url(${o.src})`,{weight:o.weight,style:o.style,display:o.display});o.fontFace=a,await a.load(),document.fonts.add(a),await document.fonts.ready,this.styleID++,this.fontsDirty=!0})}addOverride(...e){const t=e.filter(s=>!this._overrides.includes(s));t.length>0&&(this._overrides.push(...t),this.styleID++)}removeOverride(...e){const t=e.filter(s=>this._overrides.includes(s));t.length>0&&(this._overrides=this._overrides.filter(s=>!t.includes(s)),this.styleID++)}toCSS(e){return[`transform: scale(${e})`,"transform-origin: top left","display: inline-block",`color: ${this.normalizeColor(this.fill)}`,`font-size: ${this.fontSize}px`,`font-family: ${this.fontFamily}`,`font-weight: ${this.fontWeight}`,`font-style: ${this.fontStyle}`,`font-variant: ${this.fontVariant}`,`letter-spacing: ${this.letterSpacing}px`,`text-align: ${this.align}`,`padding: ${this.padding}px`,`white-space: ${this.whiteSpace}`,...this.lineHeight?[`line-height: ${this.lineHeight}px`]:[],...this.wordWrap?[`word-wrap: ${this.breakWords?"break-all":"break-word"}`,`max-width: ${this.wordWrapWidth}px`]:[],...this.strokeThickness?[`-webkit-text-stroke-width: ${this.strokeThickness}px`,`-webkit-text-stroke-color: ${this.normalizeColor(this.stroke)}`,`text-stroke-width: ${this.strokeThickness}px`,`text-stroke-color: ${this.normalizeColor(this.stroke)}`,"paint-order: stroke"]:[],...this.dropShadow?[this.dropShadowToCSS()]:[],...this._overrides].join(";")}toGlobalCSS(){return this._fonts.reduce((e,t)=>`${e}
|
||
@font-face {
|
||
font-family: "${t.family}";
|
||
src: url('${t.dataSrc}');
|
||
font-weight: ${t.weight};
|
||
font-style: ${t.style};
|
||
font-display: ${t.display};
|
||
}`,this._stylesheet)}get stylesheet(){return this._stylesheet}set stylesheet(e){this._stylesheet!==e&&(this._stylesheet=e,this.styleID++)}normalizeColor(e){return Array.isArray(e)&&(e=o_(e)),typeof e=="number"?r_(e):e}dropShadowToCSS(){let e=this.normalizeColor(this.dropShadowColor);const t=this.dropShadowAlpha,s=Math.round(Math.cos(this.dropShadowAngle)*this.dropShadowDistance),n=Math.round(Math.sin(this.dropShadowAngle)*this.dropShadowDistance);e.startsWith("#")&&t<1&&(e+=(t*255|0).toString(16).padStart(2,"0"));const r=`${s}px ${n}px`;return this.dropShadowBlur>0?`text-shadow: ${r} ${this.dropShadowBlur}px ${e}`:`text-shadow: ${r} ${e}`}reset(){Object.assign(this,qr.defaultOptions)}onBeforeDraw(){const{fontsDirty:e}=this;return this.fontsDirty=!1,this.isSafari&&this._fonts.length>0&&e?new Promise(t=>setTimeout(t,100)):Promise.resolve()}get isSafari(){const{userAgent:e}=Ve.ADAPTER.getNavigator();return/^((?!chrome|android).)*safari/i.test(e)}set fillGradientStops(e){console.warn("[HTMLTextStyle] fillGradientStops is not supported by HTMLText")}get fillGradientStops(){return super.fillGradientStops}set fillGradientType(e){console.warn("[HTMLTextStyle] fillGradientType is not supported by HTMLText")}get fillGradientType(){return super.fillGradientType}set miterLimit(e){console.warn("[HTMLTextStyle] miterLimit is not supported by HTMLText")}get miterLimit(){return super.miterLimit}set trim(e){console.warn("[HTMLTextStyle] trim is not supported by HTMLText")}get trim(){return super.trim}set textBaseline(e){console.warn("[HTMLTextStyle] textBaseline is not supported by HTMLText")}get textBaseline(){return super.textBaseline}set leading(e){console.warn("[HTMLTextStyle] leading is not supported by HTMLText")}get leading(){return super.leading}set lineJoin(e){console.warn("[HTMLTextStyle] lineJoin is not supported by HTMLText")}get lineJoin(){return super.lineJoin}};_d.availableFonts={},_d.defaultOptions={align:"left",breakWords:!1,dropShadow:!1,dropShadowAlpha:1,dropShadowAngle:Math.PI/6,dropShadowBlur:0,dropShadowColor:"black",dropShadowDistance:5,fill:"black",fontFamily:"Arial",fontSize:26,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",letterSpacing:0,lineHeight:0,padding:0,stroke:"black",strokeThickness:0,whiteSpace:"normal",wordWrap:!1,wordWrapWidth:100};let xu=_d;const Ja=class Kr extends Qn{constructor(e="",t={}){super(et.EMPTY),this._text=null,this._style=null,this._autoResolution=!0,this.localStyleID=-1,this.dirty=!1,this._updateID=0,this.ownsStyle=!1;const s=new Image,n=et.from(s,{scaleMode:Ve.SCALE_MODE,resourceOptions:{autoLoad:!1}});n.orig=new lt,n.trim=new lt,this.texture=n;const r="http://www.w3.org/2000/svg",o="http://www.w3.org/1999/xhtml",a=document.createElementNS(r,"svg"),h=document.createElementNS(r,"foreignObject"),l=document.createElementNS(o,"div"),c=document.createElementNS(o,"style");h.setAttribute("width","10000"),h.setAttribute("height","10000"),h.style.overflow="hidden",a.appendChild(h),this.maxWidth=Kr.defaultMaxWidth,this.maxHeight=Kr.defaultMaxHeight,this._domElement=l,this._styleElement=c,this._svgRoot=a,this._foreignObject=h,this._foreignObject.appendChild(c),this._foreignObject.appendChild(l),this._image=s,this._loadImage=new Image,this._autoResolution=Kr.defaultAutoResolution,this._resolution=Kr.defaultResolution??Ve.RESOLUTION,this.text=e,this.style=t}measureText(e){var c,u;const{text:t,style:s,resolution:n}=Object.assign({text:this._text,style:this._style,resolution:this._resolution},e);Object.assign(this._domElement,{innerHTML:t,style:s.toCSS(n)}),this._styleElement.textContent=s.toGlobalCSS(),document.body.appendChild(this._svgRoot);const r=this._domElement.getBoundingClientRect();this._svgRoot.remove();const{width:o,height:a}=r;(o>this.maxWidth||a>this.maxHeight)&&console.warn("[HTMLText] Large expanse of text, increase HTMLText.maxWidth or HTMLText.maxHeight property.");const h=Math.min(this.maxWidth,Math.ceil(o)),l=Math.min(this.maxHeight,Math.ceil(a));return this._svgRoot.setAttribute("width",h.toString()),this._svgRoot.setAttribute("height",l.toString()),t!==this._text&&(this._domElement.innerHTML=this._text),s!==this._style&&(Object.assign(this._domElement,{style:(c=this._style)==null?void 0:c.toCSS(n)}),this._styleElement.textContent=(u=this._style)==null?void 0:u.toGlobalCSS()),{width:h+s.padding*2,height:l+s.padding*2}}async updateText(e=!0){const{style:t,_image:s,_loadImage:n}=this;if(this.localStyleID!==t.styleID&&(this.dirty=!0,this.localStyleID=t.styleID),!this.dirty&&e)return;const{width:r,height:o}=this.measureText();s.width=n.width=Math.ceil(Math.max(1,r)),s.height=n.height=Math.ceil(Math.max(1,o)),this._updateID++;const a=this._updateID;await new Promise(h=>{n.onload=async()=>{if(a<this._updateID){h();return}await t.onBeforeDraw(),s.src=n.src,n.onload=null,n.src="",this.updateTexture(),h()};const l=new XMLSerializer().serializeToString(this._svgRoot);n.src=`data:image/svg+xml;charset=utf8,${encodeURIComponent(l)}`})}get source(){return this._image}updateTexture(){const{style:e,texture:t,_image:s,resolution:n}=this,{padding:r}=e,{baseTexture:o}=t;t.trim.width=t._frame.width=s.width/n,t.trim.height=t._frame.height=s.height/n,t.trim.x=-r,t.trim.y=-r,t.orig.width=t._frame.width-r*2,t.orig.height=t._frame.height-r*2,this._onTextureUpdate(),o.setRealSize(s.width,s.height,n),this.dirty=!1}_render(e){this._autoResolution&&this._resolution!==e.resolution&&(this._resolution=e.resolution,this.dirty=!0),this.updateText(!0),super._render(e)}_renderCanvas(e){this._autoResolution&&this._resolution!==e.resolution&&(this._resolution=e.resolution,this.dirty=!0),this.updateText(!0),super._renderCanvas(e)}getLocalBounds(e){return this.updateText(!0),super.getLocalBounds(e)}_calculateBounds(){this.updateText(!0),this.calculateVertices(),this._bounds.addQuad(this.vertexData)}_onStyleChange(){this.dirty=!0}destroy(e){var s,n,r,o,a;typeof e=="boolean"&&(e={children:e}),e=Object.assign({},Kr.defaultDestroyOptions,e),super.destroy(e);const t=null;this.ownsStyle&&((s=this._style)==null||s.cleanFonts()),this._style=t,(n=this._svgRoot)==null||n.remove(),this._svgRoot=t,(r=this._domElement)==null||r.remove(),this._domElement=t,(o=this._foreignObject)==null||o.remove(),this._foreignObject=t,(a=this._styleElement)==null||a.remove(),this._styleElement=t,this._loadImage.src="",this._loadImage.onload=null,this._loadImage=t,this._image.src="",this._image=t}get width(){return this.updateText(!0),Math.abs(this.scale.x)*this._image.width/this.resolution}set width(e){this.updateText(!0);const t=Gn(this.scale.x)||1;this.scale.x=t*e/this._image.width/this.resolution,this._width=e}get height(){return this.updateText(!0),Math.abs(this.scale.y)*this._image.height/this.resolution}set height(e){this.updateText(!0);const t=Gn(this.scale.y)||1;this.scale.y=t*e/this._image.height/this.resolution,this._height=e}get style(){return this._style}set style(e){this._style!==e&&(e=e||{},e instanceof xu?(this.ownsStyle=!1,this._style=e):e instanceof Kn?(console.warn("[HTMLText] Cloning TextStyle, if this is not what you want, use HTMLTextStyle"),this.ownsStyle=!0,this._style=xu.from(e)):(this.ownsStyle=!0,this._style=new xu(e)),this.localStyleID=-1,this.dirty=!0)}get text(){return this._text}set text(e){e=String(e===""||e===null||e===void 0?" ":e),e=this.sanitiseText(e),this._text!==e&&(this._text=e,this.dirty=!0)}get resolution(){return this._resolution}set resolution(e){this._autoResolution=!1,this._resolution!==e&&(this._resolution=e,this.dirty=!0)}sanitiseText(e){return e.replace(/<br>/gi,"<br/>").replace(/<hr>/gi,"<hr/>").replace(/ /gi," ")}};Ja.defaultDestroyOptions={texture:!0,children:!1,baseTexture:!0},Ja.defaultMaxWidth=2024,Ja.defaultMaxHeight=2024,Ja.defaultAutoResolution=!0;function ga(){return{texture:null,imageResources:[{id:1,texture:null,textureName:"star",textureFolder:"",previewUrl:"/images/star.png",imageMode:"fixed",sequencePlayback:"loop-forward",sequenceFps:30,sequenceFrames:[],weight:100,locked:!1,scale:1,anchorX:.5,anchorY:.5,colorMode:"fixed",colorStart:"#ffffff",colorEnd:"#ff4d4d",colorGradient:[{position:0,color:"#ffffff"},{position:1,color:"#ff4d4d"}],blend:"normal",independentAlpha:"off",alpha:1,alphaCurveMode:"跟随导出",alphaCurve:[{x:0,y:0},{x:.1,y:1},{x:.9,y:1},{x:1,y:0}]}],imageWeightVersion:1,name:"ParticleSystem1",mode:"stream",rate:20,streamBehavior:"normal",loopDurationFrames:30,generateLoopStartAnimation:!1,generateLoopEndAnimation:!1,burstCount:50,burstLoop:!1,delay:0,duration:1,shape:"point",radius:30,rectW:60,rectH:40,centerX:0,centerY:0,rootRotation:0,rootScaleX:1,rootScaleY:1,direction:0,spread:360,coneAngle:60,lifeMin:.6,lifeMax:1.8,lifeMode:"random",lifeCurve:[{x:0,y:0},{x:1,y:1}],speedMin:30,speedMax:140,speedMode:"random",speedCurve:[{x:0,y:0},{x:1,y:1}],scaleMin:.3,scaleMax:.8,scaleMode:"random",scaleAxisMode:"uniform",scaleYMin:.3,scaleYMax:.8,scaleCurve:[{x:0,y:0},{x:1,y:1}],scaleYCurve:[{x:0,y:0},{x:1,y:1}],scaleEndRatio:.3,initialRotationMode:"random",initialRotationMin:0,initialRotationMax:360,initialRotationCurve:[{x:0,y:0},{x:1,y:1}],alpha:.9,alphaEnd:0,rotationSpeedMin:-180,rotationSpeedMax:180,speedOverLifeEnabled:!1,speedOverLifeMode:"fixed",speedOverLifeMin:1,speedOverLifeMax:1,speedOverLifeCurve:[{x:0,y:1},{x:1,y:1}],scaleOverLifeEnabled:!1,scaleOverLifeMode:"curve",scaleOverLifeAxisMode:"uniform",scaleOverLifeMin:0,scaleOverLifeMax:1,scaleYOverLifeMin:0,scaleYOverLifeMax:1,scaleOverLifeCurve:[{x:0,y:1},{x:1,y:1}],scaleYOverLifeCurve:[{x:0,y:1},{x:1,y:1}],rotationOverLifeEnabled:!1,rotationOverLifeMode:"random",rotationOverLifeCurve:[{x:0,y:0},{x:1,y:1}],gravity:980,gravityMode:"fixed",gravityMin:980,gravityMax:980,gravityDirection:-90,gravityCurve:[{x:0,y:1},{x:1,y:1}],damping:0,seed:0,colorStart:"#ffffff",colorEnd:"#ff4d4d",colorOverLife:!1,blend:"add",alphaMode:"curve",curveMode:"线性",alphaCurve:[{x:0,y:0},{x:.2,y:1},{x:.8,y:1},{x:1,y:0}],textureName:"star",textureFolder:"",alphaScale:1,anchorX:.5,anchorY:.5,independentAlpha:"off",offsetX:0,offsetY:0,noise:!1,noiseAmt:30,noiseRange:100,noiseSpeed:1,useGravity:!1,wind:!1,windX:0,windY:0,windMode:"fixed",windMin:100,windMax:100,windDirection:0,windCurve:[{x:0,y:1},{x:1,y:1}],forceField:!1,forceStrength:10,forceRadius:100,forceCenterX:0,forceCenterY:0,forceFalloff:"linear",attraction:!1,attractionCenterX:200,attractionCenterY:0,attractionRadius:20,attractionDuration:.5,attractionDelay:.1,attractionDelayMode:"particle",attractionPath:"curve",trail:!1,trailConfigVersion:3,trailResources:[{id:1,texture:null,textureName:"trail",previewUrl:"/images/trail.png",weight:100,locked:!1,rotation:0,colorMode:"particle",color:"#ffffff",colorGradient:[{position:0,color:"#ffffff"},{position:1,color:"#ffffff"}],blend:"normal",alphaMode:"particle",alpha:1,alphaCurve:[{x:0,y:1},{x:1,y:1}],boneCount:3,trailRatio:100,lengthMode:"fixed",length:100,lengthMin:100,lengthMax:100,widthSizeMode:"fixed",width:100,widthMin:100,widthMax:100,widthMode:"particle",lifeLengthEnabled:!1,lifeLengthCurve:[{x:0,y:1},{x:1,y:1}],shapeEnabled:!1,shapeCurve:[{x:0,y:1},{x:1,y:1}]}],trailResourceVersion:6,trailTexture:null,trailTextureName:"trail",trailPreviewUrl:"/images/trail.png",trailColorMode:"particle",trailColor:"#ffffff",trailColorGradient:[{position:0,color:"#ffffff"},{position:1,color:"#ffffff"}],trailAlphaMode:"particle",trailAlpha:1,trailAlphaCurve:[{x:0,y:1},{x:1,y:1}],trailBoneCount:3,trailLength:100,trailWidth:100,trailWidthMode:"particle",trailLifeLengthEnabled:!1,trailLifeLengthCurve:[{x:0,y:1},{x:1,y:1}],trailShapeEnabled:!1,trailShapeCurve:[{x:0,y:1},{x:1,y:1}],trailGridRows:4,trailGridCols:4,collision:!1,pathFollow:!1,emitterFollow:!1,emitterFollowMode:"none",emitterFollowPathId:0,emitterFollowSpineId:0,emitterFollowBoneName:"",emitterFollowBoneOffsetX:0,emitterFollowBoneOffsetY:0,emitterFollowBoneRotation:0,emitterFollowBoneScaleX:1,emitterFollowBoneScaleY:1,emitterAngleMode:"fixed",emitterFollowCurve:[{x:0,y:0},{x:1,y:1}],emitterFollowDuration:2,emitterFollowSpace:"world",emitterFollowDirection:"forward",emitterFollowOffset:0}}function Tr(i){var M;const e=ga(),t=i,s=t.imageWeightVersion!==1,n=t.loopDurationFrames==null,r=t.gravityMode==null,o=Number(t.gravity),a=t.windMode==null,h=Number(t.windX),l=Number(t.windY),c=t.forceFalloff==null,u=Number(t.forceStrength),f=t.trailConfigVersion!==3,d=!Array.isArray(t.trailResources),m=t.trailResourceVersion!==6,g=t.trailTexture,b=String(t.trailTextureName||"trail"),_=String(t.trailPreviewUrl||"/images/trail.png").replace("/trails/trail.png","/images/trail.png");for(const[v,S]of Object.entries(e))t[v]!==void 0&&t[v]!==null||(t[v]=Array.isArray(S)?S.map(y=>typeof y=="object"&&y!==null?{...y}:y):S);i.streamBehavior!=="normal"&&i.streamBehavior!=="loop"&&(i.streamBehavior="normal"),(n||!Number.isFinite(i.loopDurationFrames))&&(i.loopDurationFrames=Math.ceil(Math.max(1/30,Number(i.duration)||1)*30)),i.loopDurationFrames=Math.min(1800,Math.max(1,Math.ceil(i.loopDurationFrames))),typeof i.generateLoopStartAnimation!="boolean"&&(i.generateLoopStartAnimation=!1),typeof i.generateLoopEndAnimation!="boolean"&&(i.generateLoopEndAnimation=!1),i.generateLoopStartAnimation&&i.generateLoopEndAnimation&&(i.generateLoopEndAnimation=!1),(!Array.isArray(i.imageResources)||i.imageResources.length===0)&&(i.imageResources=ga().imageResources);for(const v of i.imageResources){!v.texture&&i.texture&&(v.texture=i.texture),v.textureName||(v.textureName="star"),v.previewUrl==="/particles/star.png"&&(v.previewUrl="/images/star.png"),v.previewUrl||(v.previewUrl=v.textureName==="star"?"/images/star.png":""),v.imageMode!=="fixed"&&v.imageMode!=="sequence"&&(v.imageMode="fixed"),v.sequencePlayback==="once"?v.sequencePlayback="once-hold":v.sequencePlayback==="loop"?v.sequencePlayback="loop-forward":["once-hide","once-hold","loop-forward","loop-reverse"].includes(v.sequencePlayback)||(v.sequencePlayback="loop-forward"),Number.isFinite(v.sequenceFps)||(v.sequenceFps=30),v.sequenceFps=Math.min(120,Math.max(1,Number(v.sequenceFps)||30)),Array.isArray(v.sequenceFrames)||(v.sequenceFrames=[]);for(const S of v.sequenceFrames)typeof S.name!="string"&&(S.name=""),typeof S.previewUrl!="string"&&(S.previewUrl=""),S.texture===void 0&&(S.texture=null);Number.isFinite(v.weight)||(v.weight=100),typeof v.locked!="boolean"&&(v.locked=!1),Number.isFinite(v.scale)||(v.scale=1),Number.isFinite(v.anchorX)||(v.anchorX=.5),Number.isFinite(v.anchorY)||(v.anchorY=.5),v.colorMode!=="fixed"&&v.colorMode!=="lifetime"&&(v.colorMode=i.colorOverLife?"lifetime":"fixed"),v.colorStart||(v.colorStart=i.colorStart||"#ffffff"),v.colorEnd||(v.colorEnd=i.colorEnd||v.colorStart),(!Array.isArray(v.colorGradient)||v.colorGradient.length<2)&&(v.colorGradient=[{position:0,color:v.colorStart},{position:1,color:v.colorEnd}]),Object.prototype.hasOwnProperty.call(Dn,v.blend)||(v.blend=i.blend||"normal"),["off","fixed","curve"].includes(v.independentAlpha)||(v.independentAlpha=i.independentAlpha||"off"),Number.isFinite(v.alpha)||(v.alpha=Number.isFinite(i.alphaScale)?i.alphaScale:1),["跟随导出","线性","贝塞尔"].includes(v.alphaCurveMode)||(v.alphaCurveMode=i.curveMode||"跟随导出"),(!Array.isArray(v.alphaCurve)||v.alphaCurve.length<2)&&(v.alphaCurve=(i.alphaCurve||[{x:0,y:1},{x:1,y:1}]).map(S=>({...S})))}if(i.imageResources.length===1)i.imageResources[0].weight=100,i.imageResources[0].locked=!1;else if(s){const v=100/i.imageResources.length;i.imageResources.forEach((S,y)=>{S.weight=y===i.imageResources.length-1?100-v*(i.imageResources.length-1):v,S.locked=!1})}if(i.imageWeightVersion=1,r){const v=Number.isFinite(o)&&o!==0?o:980;i.gravity=v,i.gravityMin=v,i.gravityMax=v}if(a){const v=Number.isFinite(h)&&Number.isFinite(l)&&(h!==0||l!==0);i.windMin=v?Math.hypot(h,l):100,i.windMax=i.windMin,i.windDirection=v?Math.atan2(-l,h)*180/Math.PI:0}c&&(i.forceStrength=Number.isFinite(u)&&u!==0?u:10),f&&(i.trailConfigVersion=3,i.trailAlphaCurve=[{x:0,y:1},{x:1,y:1}],i.trailLifeLengthCurve=[{x:0,y:1},{x:1,y:1}],i.trailShapeCurve=[{x:0,y:1},{x:1,y:1}],i.trailGridRows=4,i.trailGridCols=4),(d||!i.trailResources.length)&&(i.trailResources=[{id:1,texture:g||null,textureName:b,previewUrl:_,weight:100,locked:!1,rotation:0,colorMode:i.trailColorMode,color:i.trailColor,colorGradient:i.trailColorGradient.map(v=>({...v})),blend:"normal",alphaMode:i.trailAlphaMode,alpha:i.trailAlpha,alphaCurve:i.trailAlphaCurve.map(v=>({...v})),boneCount:i.trailBoneCount,trailRatio:100,lengthMode:"fixed",length:i.trailLength,lengthMin:i.trailLength,lengthMax:i.trailLength,widthSizeMode:"fixed",width:i.trailWidth,widthMin:i.trailWidth,widthMax:i.trailWidth,widthMode:i.trailWidthMode,lifeLengthEnabled:i.trailLifeLengthEnabled,lifeLengthCurve:i.trailLifeLengthCurve.map(v=>({...v})),shapeEnabled:i.trailShapeEnabled,shapeCurve:i.trailShapeCurve.map(v=>({...v}))}]);for(const v of i.trailResources)v.textureName||(v.textureName="trail"),v.previewUrl==="/trails/trail.png"&&(v.previewUrl="/images/trail.png"),v.previewUrl||(v.previewUrl="/images/trail.png"),Number.isFinite(v.weight)||(v.weight=100),typeof v.locked!="boolean"&&(v.locked=!1),Number.isFinite(v.rotation)||(v.rotation=0),["particle","fixed","curve"].includes(v.colorMode)||(v.colorMode=i.trailColorMode||"particle"),v.color||(v.color=i.trailColor||"#ffffff"),(!Array.isArray(v.colorGradient)||v.colorGradient.length<2)&&(v.colorGradient=(i.trailColorGradient||[{position:0,color:"#ffffff"},{position:1,color:"#ffffff"}]).map(S=>({...S}))),Object.prototype.hasOwnProperty.call(Dn,v.blend)||(v.blend="normal"),["particle","fixed","curve"].includes(v.alphaMode)||(v.alphaMode=i.trailAlphaMode||"particle"),Number.isFinite(v.alpha)||(v.alpha=Number.isFinite(i.trailAlpha)?i.trailAlpha:1),(!Array.isArray(v.alphaCurve)||v.alphaCurve.length<2)&&(v.alphaCurve=(i.trailAlphaCurve||[{x:0,y:1},{x:1,y:1}]).map(S=>({...S}))),Number.isFinite(v.boneCount)||(v.boneCount=Number.isFinite(i.trailBoneCount)?i.trailBoneCount:3),Number.isFinite(v.trailRatio)||(v.trailRatio=100),v.trailRatio=Math.min(100,Math.max(0,v.trailRatio)),["fixed","random"].includes(v.lengthMode)||(v.lengthMode="fixed"),Number.isFinite(v.length)||(v.length=Number.isFinite(i.trailLength)?i.trailLength:100),Number.isFinite(v.lengthMin)||(v.lengthMin=v.length),Number.isFinite(v.lengthMax)||(v.lengthMax=v.length),["fixed","random"].includes(v.widthSizeMode)||(v.widthSizeMode="fixed"),Number.isFinite(v.width)||(v.width=Number.isFinite(i.trailWidth)?i.trailWidth:100),Number.isFinite(v.widthMin)||(v.widthMin=v.width),Number.isFinite(v.widthMax)||(v.widthMax=v.width),["particle","fixed"].includes(v.widthMode)||(v.widthMode=i.trailWidthMode||"particle"),typeof v.lifeLengthEnabled!="boolean"&&(v.lifeLengthEnabled=!!i.trailLifeLengthEnabled),(!Array.isArray(v.lifeLengthCurve)||v.lifeLengthCurve.length<2)&&(v.lifeLengthCurve=(i.trailLifeLengthCurve||[{x:0,y:1},{x:1,y:1}]).map(S=>({...S}))),typeof v.shapeEnabled!="boolean"&&(v.shapeEnabled=!!i.trailShapeEnabled),(!Array.isArray(v.shapeCurve)||v.shapeCurve.length<2)&&(v.shapeCurve=(i.trailShapeCurve||[{x:0,y:1},{x:1,y:1}]).map(S=>({...S})));if(i.trailResources.length===1&&(i.trailResources[0].weight=100,i.trailResources[0].locked=!1),m)for(const v of i.trailResources)v.alphaCurve=((M=v.alphaCurve)==null?void 0:M.length)>=2?v.alphaCurve:[{x:0,y:1},{x:1,y:1}];return i.trailResourceVersion=6,i}const Dn={normal:0,add:1,multiply:2,screen:3},vE=400;class yE extends gi{constructor(t,s=vE){super();A(this,"pool",[]);A(this,"cfg");A(this,"accumulator",0);A(this,"burstTimer",0);A(this,"_spawnSerial",0);A(this,"_elapsed",0);A(this,"_attractionEnabledAt",0);A(this,"_attractionWasEnabled",!1);A(this,"_emitterPos",null);A(this,"states",[]);A(this,"rng",Math.random);A(this,"_lastSeed",-1);A(this,"trailDebugGfx",new Ri);A(this,"colliders",[]);A(this,"followSpawnX",0);A(this,"followSpawnY",0);A(this,"followSpawnAngle",0);A(this,"followExportCurveMode","线性");A(this,"simulationTransform",null);this.cfg=Tr(t),this._ensurePool(s),this.addChild(this.trailDebugGfx)}setFollowExportCurveMode(t){this.followExportCurveMode=t}resolveCurveMode(t){return t==="跟随导出"?this.followExportCurveMode:t}reseed(){const t=this.cfg.seed;t!==this._lastSeed&&(this._lastSeed=t,this.rng=wu(t>>>0))}_ensurePool(t){for(;this.pool.length<t;){const s=this.pool.length,n=new Qn(this.cfg.texture);n.blendMode=Dn[this.cfg.blend],n.anchor.set(.5),n.visible=!1,this.addChild(n),this.pool.push({sprite:n,active:!1,boneName:"p_"+s,spawnId:-1,life:0,maxLife:1,x:0,y:0,vx:0,vy:0,scaleStartX:1,scaleStartY:1,alphaStart:1,alphaEnd:1,rotation:0,rotationSpeed:0,speedScale:1,speedScaleTarget:1,scaleOverLifeX:1,scaleOverLifeY:1,noisePhaseX:0,noisePhaseY:0,gravityStrength:980,windStrength:100,attractionActive:!1,attractionElapsed:0,attractionStartWorldX:0,attractionStartWorldY:0,attractionCurveSide:1,trailMesh:null,trailMeshSignature:"",trailHistory:[],trailBones:[],trailSkinWeights:[],trailCurrentWidth:0,trailCurrentAlpha:0,trailCurrentColor:16777215,trailResourceId:1,trailEnabled:!1,trailSampledLength:100,trailSampledWidth:100,resourceId:1,imageFrameIndex:0,collisionPaused:!1})}}setEmitterPos(t){this._emitterPos=t}setColliders(t){this.colliders=t}setEmitterFollowSpawn(t,s,n){this.followSpawnX=t,this.followSpawnY=s,this.followSpawnAngle=n}setSimulationTransform(t,s,n,r,o){this.simulationTransform={centerX:t,centerY:s,rotation:n,scaleX:r,scaleY:o}}applyColliders(t,s){if(!this.colliders.length)return!1;const n=this.cfg;let r=Ur(n,t.x,t.y,this.simulationTransform),o=xE(n,t.vx,t.vy,this.simulationTransform);for(const a of this.colliders){if(!a.enabled)continue;const h=wE(a,r.x,r.y);if(!h)continue;if(a.response==="destroy")return this.kill(s),!0;if(r={x:h.x,y:h.y},a.response==="pause")t.collisionPaused=!0,o={x:0,y:0};else{const u=o.x*h.nx+o.y*h.ny,f=o.x-u*h.nx,d=o.y-u*h.ny,m=Math.min(1,Math.max(0,a.elasticity)),g=1-Math.min(1,Math.max(0,a.friction)),b=u<0?-u*m:u;o.x=f*g+b*h.nx,o.y=d*g+b*h.ny}const l=ig(n,r.x,r.y,this.simulationTransform),c=bE(n,o.x,o.y,this.simulationTransform);t.x=l.x,t.y=l.y,t.vx=c.x,t.vy=c.y}return!1}update(t,s="normal"){var h,l,c,u,f,d;const n=this.cfg;if((n.lifeMode==null||n.speedMode==null||n.scaleMode==null||n.initialRotationMode==null||n.speedOverLifeEnabled==null||n.scaleOverLifeEnabled==null||n.rotationOverLifeEnabled==null||!Array.isArray(n.scaleOverLifeCurve)||n.attraction==null||n.trailBoneCount==null)&&Tr(n),this.reseed(),this._elapsed+=t,n.attraction&&!this._attractionWasEnabled){this._attractionEnabledAt=this._elapsed;for(const m of this.pool)m.attractionActive=!1,m.attractionElapsed=0}else if(!n.attraction&&this._attractionWasEnabled)for(const m of this.pool)m.attractionActive=!1;this._attractionWasEnabled=n.attraction;const r=s==="force"||s==="normal"&&(n.delay<=0||this._elapsed>=n.delay),o=s==="force"||s==="normal"&&(n.mode==="burst"||this._elapsed<n.delay+Math.max(1/30,n.duration));if(r&&o)if(n.mode==="stream")for(this.accumulator+=t*n.rate;this.accumulator>=1;)this.accumulator-=1,this.spawnOne();else this.burstTimer+=t,n.burstLoop?this.burstTimer>=1&&(this.burstTimer=0,this.emitBurst()):t>0&&this.burstTimer<=t&&this.emitBurst();const a=[];for(let m=0;m<this.pool.length;m++){const g=this.pool[m];if(!g.active)continue;if(g.life-=t,g.life<=0){this.kill(m);continue}const b=_E(g);if(!g.collisionPaused&&n.useGravity){const P=Math.min(1,Math.max(0,Ps(n.gravityCurve,b))),X=(n.gravityMode==="random"?g.gravityStrength:n.gravityMin)*P,U=n.gravityDirection*Math.PI/180;g.vx+=Math.cos(U)*X*t,g.vy+=-Math.sin(U)*X*t}if(!g.collisionPaused&&n.wind){const P=Math.min(1,Math.max(0,Ps(n.windCurve,b))),X=(n.windMode==="random"?g.windStrength:n.windMin)*P,U=n.windDirection*Math.PI/180;g.vx+=Math.cos(U)*X*t,g.vy+=-Math.sin(U)*X*t}if(!g.collisionPaused&&n.forceField&&n.forceStrength!==0&&n.forceRadius>0){const P=Math.max(1e-4,Math.abs(n.rootScaleX)),X=Math.max(1e-4,Math.abs(n.rootScaleY)),U=-(((h=this.simulationTransform)==null?void 0:h.rotation)??n.rootRotation)*Math.PI/180,Y=Math.cos(U),q=Math.sin(U),z=((l=this.simulationTransform)==null?void 0:l.centerX)??n.centerX,ne=((c=this.simulationTransform)==null?void 0:c.centerY)??n.centerY,H=z+Y*P*g.x-q*X*g.y,Z=-ne+q*P*g.x+Y*X*g.y,ae=H,me=-Z,_e=n.forceCenterX-ae,te=n.forceCenterY-me,ve=Math.hypot(_e,te);if(ve>1e-4&&ve<=n.forceRadius){let $=1;n.forceFalloff==="linear"?$=1-ve/n.forceRadius:n.forceFalloff==="inverse"&&($=Math.min(10,n.forceRadius/Math.max(ve,n.forceRadius*.1)));const W=n.forceStrength*$*10,J=_e/ve*W,Q=te/ve*W,ie=J,ue=-Q;g.vx+=(Y*ie+q*ue)/P*t,g.vy+=(-q*ie+Y*ue)/X*t}}if(!g.collisionPaused&&n.damping>0){const P=Math.max(0,1-n.damping*t);g.vx*=P,g.vy*=P}if(g.collisionPaused)g.vx=0,g.vy=0;else if(g.x+=g.vx*t,g.y+=g.vy*t,this.applyColliders(g,m))continue;if(n.attraction&&!g.collisionPaused){const P=g.maxLife-g.life;if(n.attractionDelayMode==="particle"?P>=Math.max(0,n.attractionDelay):this._elapsed-this._attractionEnabledAt>=Math.max(0,n.attractionDelay)){const U=Ur(n,g.x,g.y,this.simulationTransform),Y=n.attractionCenterX,q=n.attractionCenterY,z=Math.max(0,n.attractionRadius);if(!g.attractionActive){if(Math.hypot(Y-U.x,q-U.y)<=z){this.kill(m);continue}g.attractionActive=!0,g.attractionElapsed=0,g.attractionStartWorldX=U.x,g.attractionStartWorldY=U.y}g.attractionElapsed+=t;const ne=Math.max(1e-4,n.attractionDuration),H=Math.min(1,g.attractionElapsed/ne);let Z=ni(g.attractionStartWorldX,Y,H),ae=ni(g.attractionStartWorldY,q,H);if(n.attractionPath==="curve"){const te=Y-g.attractionStartWorldX,ve=q-g.attractionStartWorldY,$=Math.hypot(te,ve);if($>1e-4){const W=$*.25*g.attractionCurveSide,J=(g.attractionStartWorldX+Y)*.5-ve/$*W,Q=(g.attractionStartWorldY+q)*.5+te/$*W,ie=1-H;Z=ie*ie*g.attractionStartWorldX+2*ie*H*J+H*H*Y,ae=ie*ie*g.attractionStartWorldY+2*ie*H*Q+H*H*q}}const me=Math.hypot(Y-Z,q-ae);if(H>=1||me<=z){this.kill(m);continue}const _e=ig(n,Z,ae,this.simulationTransform);g.x=_e.x,g.y=_e.y,g.vx=0,g.vy=0}}const _=b,M=g.sprite,v=n.imageResources.find(P=>P.id===g.resourceId);if(v){const P=this.imageFrameState(v,g.maxLife-g.life);g.imageFrameIndex=P.index,M.texture=this.imageFrameTexture(v,g.imageFrameIndex),M.visible=P.visible}if(n.speedOverLifeEnabled){const P=Qa(bu(n.speedOverLifeMode,n.speedOverLifeMin,n.speedOverLifeMax,n.speedOverLifeCurve,_,g.speedScaleTarget),1),X=g.speedScale===0?P:P/g.speedScale;g.vx*=X,g.vy*=X,g.speedScale=P}let S=g.rotationSpeed;n.rotationOverLifeEnabled&&n.rotationOverLifeMode==="curve"&&(S=ni(n.rotationSpeedMin,n.rotationSpeedMax,Ps(n.rotationOverLifeCurve,_))),g.rotation+=S*t;let y=g.x,I=g.y;if(n.noise&&n.noiseAmt>0&&n.noiseRange>0&&n.noiseSpeed>0){const P=g.maxLife-g.life,X=Math.max(0,n.noiseRange)*Math.min(1,Math.max(0,n.noiseAmt)/100)*.5,U=P*Math.max(0,n.noiseSpeed)*Math.PI*2;y+=(Math.sin(g.noisePhaseX+U)-Math.sin(g.noisePhaseX))*X,I+=(Math.sin(g.noisePhaseY+U*.83)-Math.sin(g.noisePhaseY))*X}M.x=y,M.y=I,M.rotation=-g.rotation*Math.PI/180;let E=1,C=1;n.scaleOverLifeEnabled&&(E=bu(n.scaleOverLifeMode,n.scaleOverLifeMin,n.scaleOverLifeMax,n.scaleOverLifeCurve,_,g.scaleOverLifeX),C=n.scaleOverLifeAxisMode==="separate"?bu(n.scaleOverLifeMode,n.scaleYOverLifeMin,n.scaleYOverLifeMax,n.scaleYOverLifeCurve,_,g.scaleOverLifeY):E),M.scale.set(Qa(g.scaleStartX*E,1),Qa(g.scaleStartY*C,1));const R=n.alphaMode==="curve"?Ps(n.alphaCurve,_,this.resolveCurveMode(n.curveMode))*n.alphaScale:n.alpha*n.alphaScale;M.alpha=Qa((v==null?void 0:v.independentAlpha)==="fixed"?v.alpha:(v==null?void 0:v.independentAlpha)==="curve"?Ps(v.alphaCurve,_,this.resolveCurveMode(v.alphaCurveMode)):R,1);const B=(v==null?void 0:v.colorStart)||"#ffffff",k=(v==null?void 0:v.colorMode)==="lifetime"?ng(v.colorGradient,_):fo(B);M.tint=k,M.blendMode=Dn[(v==null?void 0:v.blend)||"normal"];const F=this.updateTrail(g,y,I,_,M),D=Ur(n,y,I,this.simulationTransform),N=((u=this.simulationTransform)==null?void 0:u.rotation)??n.rootRotation,j=Math.abs(((f=this.simulationTransform)==null?void 0:f.scaleX)??n.rootScaleX),O=Math.abs(((d=this.simulationTransform)==null?void 0:d.scaleY)??n.rootScaleY),L=F?{...F,bones:F.bones.map(P=>{const X=Ur(n,P.x,P.y,this.simulationTransform);return{...P,worldX:X.x,worldY:X.y,worldRotation:N-P.rotation}})}:void 0;a.push({boneName:g.boneName,spawnId:g.spawnId,x:y,y:I,rotation:g.rotation,scaleX:M.scale.x,scaleY:M.scale.y,worldX:D.x,worldY:D.y,worldRotation:N+g.rotation,worldScaleX:M.scale.x*j,worldScaleY:M.scale.y*O,alpha:M.alpha,colorHex:k,resourceId:g.resourceId,imageFrameIndex:g.imageFrameIndex,imageVisible:M.visible,trailState:L,active:!0})}return this.states=a,a}ensureTrailMesh(t){const s=this.cfg,n=s.trailResources.find(b=>b.id===t.trailResourceId)||s.trailResources[0],r=(n==null?void 0:n.texture)||et.EMPTY,o=Number(n==null?void 0:n.rotation)||0,a=Math.max(2,Math.min(16,Math.round(s.trailGridRows))),h=Math.max(2,Math.min(32,Math.round(s.trailGridCols))),l=Math.max(2,Math.min(16,Math.round((n==null?void 0:n.boneCount)??3))),c=`${a}:${h}:${l}:${(n==null?void 0:n.id)??0}:${o}`;if(t.trailMesh&&t.trailMeshSignature===c)return t.trailMesh.texture!==r&&(t.trailMesh.texture=r),t.trailMesh;t.trailMesh&&(this.removeChild(t.trailMesh),t.trailMesh.destroy()),t.trailMeshSignature&&t.trailMeshSignature!==c&&(t.trailHistory.length=0,t.trailBones.length=0);const u=new Float32Array(a*h*2),f=new Float32Array(a*h*2),d=[],m=[];for(let b=0;b<h;b++){const _=b/(h-1),M=_*(l-1),v=Math.min(l-1,Math.floor(M)),S=Math.min(l-1,v+1),y=M-v;for(let I=0;I<a;I++){const E=b*a+I,C=_,R=I/(a-1),B=o*Math.PI/180,k=Math.cos(B),F=Math.sin(B);f[E*2]=.5+k*(C-.5)-F*(R-.5),f[E*2+1]=.5+F*(C-.5)+k*(R-.5),m.push({boneA:v,boneB:S,weight:y})}}for(let b=0;b<h-1;b++)for(let _=0;_<a-1;_++){const M=b*a+_,v=(b+1)*a+_,S=M+1,y=v+1;d.push(M,v,S,v,y,S)}const g=new VM(r,u,f,new Uint16Array(d));return g.visible=!1,g.blendMode=Dn.normal,this.addChildAt(g,Math.max(0,this.getChildIndex(t.sprite))),t.trailMesh=g,t.trailMeshSignature=c,t.trailSkinWeights=m,g}appendTrailPoint(t,s,n,r){const o=t.trailHistory[0];!o||Math.hypot(o.x-s,o.y-n)>.05?t.trailHistory.unshift({x:s,y:n}):(o.x=s,o.y=n);const a=Math.max(1,r)*1.5;let h=0,l=t.trailHistory.length;for(let c=1;c<t.trailHistory.length;c++)if(h+=Math.hypot(t.trailHistory[c].x-t.trailHistory[c-1].x,t.trailHistory[c].y-t.trailHistory[c-1].y),h>=a||c>=239){l=c+1;break}t.trailHistory.length>l&&(t.trailHistory.length=l)}sampleTrailBones(t,s,n){const r=Math.max(2,Math.min(16,Math.round(n))),o=t.trailHistory,a=[];if(!o.length)return a;let h=0;for(let c=1;c<o.length;c++)h+=Math.hypot(o[c].x-o[c-1].x,o[c].y-o[c-1].y);const l=Math.min(Math.max(0,s),h);for(let c=0;c<r;c++){const u=l*c/(r-1);let f=0,d=o[o.length-1];for(let m=1;m<o.length;m++){const g=o[m-1],b=o[m],_=Math.hypot(b.x-g.x,b.y-g.y);if(f+_>=u&&_>1e-4){const M=(u-f)/_;d={x:ni(g.x,b.x,M),y:ni(g.y,b.y,M)};break}f+=_}a.push({boneName:`${t.boneName}_trail_${c}`,x:d.x,y:d.y,rotation:0})}for(let c=0;c<a.length;c++){const u=a[Math.min(a.length-1,c+1)],f=a[Math.max(0,c-1)],d=c<a.length-1?u.x-a[c].x:a[c].x-f.x,m=c<a.length-1?u.y-a[c].y:a[c].y-f.y;a[c].rotation=Math.atan2(m,d)*180/Math.PI}if(l+1e-4<Math.max(0,s)&&a.length>1){const c=a[0].rotation,f=(a[a.length-1].rotation-c+540)%360-180;for(let d=0;d<a.length;d++)a[d].rotation=c+f*d/(a.length-1)}return a}skinTrailMesh(t,s){const n=this.ensureTrailMesh(t),r=this.cfg,o=r.trailResources.find(u=>u.id===s.resourceId)||r.trailResources[0];if(!(o!=null&&o.texture)||s.bones.length<2){n.visible=!1;return}t.trailResourceId=o.id,n.texture!==o.texture&&(n.texture=o.texture);const a=Math.max(2,Math.min(16,Math.round(r.trailGridRows))),h=Math.max(2,Math.min(32,Math.round(r.trailGridCols))),l=n.vertices,c=[];for(let u=0;u<h;u++){const f=t.trailSkinWeights[u*a],d=s.bones[Math.min(s.bones.length-1,f.boneA)],m=s.bones[Math.min(s.bones.length-1,f.boneB)];c.push({x:ni(d.x,m.x,f.weight),y:ni(d.y,m.y,f.weight)})}for(let u=0;u<h;u++){const f=c[Math.max(0,u-1)],d=c[Math.min(h-1,u+1)],m=d.x-f.x,g=d.y-f.y,b=Math.max(1e-4,Math.hypot(m,g)),_=-g/b,M=m/b,v=u/(h-1),S=o.shapeEnabled?Math.max(0,Ps(o.shapeCurve,v)):1;for(let y=0;y<a;y++){const E=(y/(a-1)-.5)*s.width*S,C=(u*a+y)*2;l[C]=c[u].x+_*E,l[C+1]=c[u].y+M*E}}n.tint=s.colorHex,n.alpha=s.alpha,n.blendMode=Dn[o.blend],n.visible=Math.hypot(c[0].x-c[h-1].x,c[0].y-c[h-1].y)>.5&&s.alpha>0}updateTrail(t,s,n,r,o){const a=this.cfg;if(!a.trail||!t.trailEnabled||t.trailSampledLength<=0||t.trailSampledWidth<=0){t.trailHistory.length=0,t.trailBones.length=0,t.trailMesh&&(t.trailMesh.visible=!1);return}this.ensureTrailMesh(t);const h=a.trailResources.find(d=>d.id===t.trailResourceId)||a.trailResources[0];this.appendTrailPoint(t,s,n,t.trailSampledLength);const l=h!=null&&h.lifeLengthEnabled?Math.max(0,Ps(h.lifeLengthCurve,r)):1,c=Math.max(0,t.trailSampledLength)*l;t.trailBones=this.sampleTrailBones(t,c,(h==null?void 0:h.boneCount)??3),t.trailBones[0]&&(t.trailBones[0].x=s,t.trailBones[0].y=n);const u=(h==null?void 0:h.widthMode)==="particle"?(Math.abs(o.scale.x)+Math.abs(o.scale.y))*.5:1;t.trailCurrentWidth=Math.max(0,t.trailSampledWidth)*u,t.trailCurrentAlpha=(h==null?void 0:h.alphaMode)==="particle"?o.alpha:(h==null?void 0:h.alphaMode)==="curve"?Ps(h.alphaCurve,r):(h==null?void 0:h.alpha)??1,t.trailCurrentColor=(h==null?void 0:h.colorMode)==="particle"?o.tint:(h==null?void 0:h.colorMode)==="curve"?ng(h.colorGradient,r):fo((h==null?void 0:h.color)||"#ffffff");const f={bones:t.trailBones.map(d=>({...d})),activeBoneCount:t.trailBones.length,width:t.trailCurrentWidth,alpha:Math.min(1,Math.max(0,t.trailCurrentAlpha)),colorHex:t.trailCurrentColor,resourceId:t.trailResourceId};return this.skinTrailMesh(t,f),f}drawTrailMeshDebug(t){const s=this.trailDebugGfx;if(s.clear(),!t||!this.cfg.trail)return;const n=Math.max(2,Math.min(16,Math.round(this.cfg.trailGridRows))),r=Math.max(2,Math.min(32,Math.round(this.cfg.trailGridCols)));s.lineStyle(1,3790847,.72);for(const o of this.pool){const a=o.trailMesh;if(!(a!=null&&a.visible))continue;const h=a.vertices,l=(c,u)=>{const f=(c*n+u)*2;return{x:h[f],y:h[f+1]}};for(let c=0;c<n;c++)for(let u=0;u<r;u++){const f=l(u,c);u===0?s.moveTo(f.x,f.y):s.lineTo(f.x,f.y)}for(let c=0;c<r;c++)for(let u=0;u<n;u++){const f=l(c,u);u===0?s.moveTo(f.x,f.y):s.lineTo(f.x,f.y)}s.beginFill(9235711,.9);for(let c=0;c<r;c++)for(let u=0;u<n;u++){const f=l(c,u);s.drawCircle(f.x,f.y,1.6)}s.endFill()}}emitBurst(){for(let t=0;t<this.cfg.burstCount;t++)this.spawnOne()}spawnOrigin(){const t=this.cfg;let s=t.offsetX,n=t.offsetY;n=-n;const r=t.shape;if(r==="circle"){const o=this.rng()*Math.PI*2,a=this.rng()*t.radius;return this.applyFollowToOrigin(s+Math.cos(o)*a,n+Math.sin(o)*a)}else{if(r==="rect")return this.applyFollowToOrigin(s+(this.rng()-.5)*t.rectW,n+(this.rng()-.5)*t.rectH);if(r==="cone")return this.applyFollowToOrigin(s,n)}return this.applyFollowToOrigin(s,n)}applyFollowToOrigin(t,s){const n=this.followSpawnAngle*Math.PI/180,r=Math.cos(n),o=Math.sin(n);return{x:this.followSpawnX+r*t-o*s,y:this.followSpawnY+o*t+r*s}}spawnOne(){const t=this.cfg;let s=this.pool.findIndex(v=>!v.active);if(s===-1)return;const{x:n,y:r}=this.spawnOrigin(),o=Xr(t.lifeMode,t.lifeMin,t.lifeMax,t.lifeCurve,this.rng()),a=Xr(t.speedMode,t.speedMin,t.speedMax,t.speedCurve,this.rng());let h;t.shape==="cone"?h=(t.direction+this.followSpawnAngle+ni(-t.coneAngle/2,t.coneAngle/2,this.rng()))*Math.PI/180:h=(t.direction+this.followSpawnAngle+ni(-t.spread/2,t.spread/2,this.rng()))*Math.PI/180;const l=this.pool[s],c=this.pickImageResource(),u=this._spawnSerial++;l.spawnId=u;const f=this.pickTrailResource(Vr(t.seed,u,1540483477));l.noisePhaseX=Vr(t.seed,u,1757159915)*Math.PI*2,l.noisePhaseY=Vr(t.seed,u,48610963)*Math.PI*2,l.gravityStrength=t.useGravity&&t.gravityMode==="random"?ni(t.gravityMin,t.gravityMax,this.rng()):t.gravityMin,l.windStrength=t.wind&&t.windMode==="random"?ni(t.windMin,t.windMax,this.rng()):t.windMin,l.attractionActive=!1,l.attractionElapsed=0,l.collisionPaused=!1,l.attractionCurveSide=Vr(t.seed,u,2738958700)<.5?-1:1,l.trailHistory.length=0,l.trailBones.length=0,l.trailCurrentWidth=0,l.trailCurrentAlpha=0,l.trailCurrentColor=16777215,l.trailResourceId=f.id;const d=Math.min(100,Math.max(0,Number(f.trailRatio)||0)),m=t.mode==="burst"?Math.max(0,Math.round(t.burstCount)):Math.max(0,Math.floor(t.rate*(t.streamBehavior==="loop"?Math.max(1,t.loopDurationFrames)/30:Math.max(0,t.duration)))),g=d>0&&m===1&&u===0,b=Vr(t.seed,u,668265261)*100,_=(v,S,y,I,E)=>{if(v!=="random")return Math.max(0,Number(S)||0);const C=Math.max(0,Math.min(Number(y)||0,Number(I)||0)),R=Math.max(0,Math.max(Number(y)||0,Number(I)||0));return ni(C,R,Vr(t.seed,u,E))};l.trailSampledLength=_(f.lengthMode,f.length,f.lengthMin,f.lengthMax,374761393),l.trailSampledWidth=_(f.widthSizeMode,f.width,f.widthMin,f.widthMax,3550635116),l.trailEnabled=t.trail&&(g||b<d)&&l.trailSampledLength>0&&l.trailSampledWidth>0,l.trailMesh&&(l.trailMesh.visible=!1),l.active=!0,l.life=o,l.maxLife=o,l.x=n,l.y=r,l.trailEnabled&&l.trailHistory.push({x:n,y:r}),l.vx=Math.cos(h)*a,l.vy=(t.shape==="cone"?-Math.sin(h):Math.sin(h))*a,l.scaleStartX=Xr(t.scaleMode,t.scaleMin,t.scaleMax,t.scaleCurve,this.rng())*c.scale,l.scaleStartY=t.scaleAxisMode==="separate"?Xr(t.scaleMode,t.scaleYMin,t.scaleYMax,t.scaleYCurve,this.rng())*c.scale:l.scaleStartX,l.alphaStart=t.alpha,l.alphaEnd=t.alphaEnd,l.rotation=t.initialRotationMode==="direction"?-Math.atan2(l.vy,l.vx)*180/Math.PI+t.initialRotationMin:Xr(t.initialRotationMode,t.initialRotationMin,t.initialRotationMax,t.initialRotationCurve,this.rng()),l.rotationSpeed=t.rotationOverLifeEnabled?Xr(t.rotationOverLifeMode,t.rotationSpeedMin,t.rotationSpeedMax,t.rotationOverLifeCurve,this.rng()):0,l.speedScale=1,l.speedScaleTarget=t.speedOverLifeMode==="random"?ni(t.speedOverLifeMin,t.speedOverLifeMax,this.rng()):t.speedOverLifeMin,l.scaleOverLifeX=t.scaleOverLifeMode==="random"?ni(t.scaleOverLifeMin,t.scaleOverLifeMax,this.rng()):t.scaleOverLifeMin,l.scaleOverLifeY=t.scaleOverLifeMode==="random"?ni(t.scaleYOverLifeMin,t.scaleYOverLifeMax,this.rng()):t.scaleYOverLifeMin,l.resourceId=c.id;const M=this.imageFrameState(c,0);l.imageFrameIndex=M.index,l.sprite.texture=this.imageFrameTexture(c,M.index),l.sprite.anchor.set(c.anchorX,c.anchorY),l.sprite.blendMode=Dn[c.blend],l.sprite.tint=fo(c.colorStart),l.sprite.visible=!0}pickImageResource(){const t=this.cfg.imageResources.filter(r=>r.texture||r.sequenceFrames.some(o=>o.texture));if(!t.length)return{id:1,texture:this.cfg.texture,textureName:"star",textureFolder:"",previewUrl:"/images/star.png",imageMode:"fixed",sequencePlayback:"loop-forward",sequenceFps:30,sequenceFrames:[],weight:100,locked:!1,scale:1,anchorX:.5,anchorY:.5,colorMode:"fixed",colorStart:"#ffffff",colorEnd:"#ff4d4d",blend:"normal",colorGradient:[{position:0,color:"#ffffff"},{position:1,color:"#ff4d4d"}],independentAlpha:"off",alpha:1,alphaCurveMode:"跟随导出",alphaCurve:[{x:0,y:0},{x:.1,y:1},{x:.9,y:1},{x:1,y:0}]};const s=t.reduce((r,o)=>r+Math.max(0,o.weight),0);if(s<=0)return t[Math.floor(this.rng()*t.length)];let n=this.rng()*s;for(const r of t)if(n-=Math.max(0,r.weight),n<=0)return r;return t[t.length-1]}imageFrameState(t,s){if(t.imageMode!=="sequence"||t.sequenceFrames.length<=1)return{index:0,visible:!0};const n=Math.min(120,Math.max(1,Number(t.sequenceFps)||30)),r=Math.max(0,Math.floor(Math.max(0,s)*n)),o=t.sequenceFrames.length-1;return t.sequencePlayback==="once-hide"?{index:Math.min(o,r),visible:r<=o}:t.sequencePlayback==="once-hold"?{index:Math.min(o,r),visible:!0}:t.sequencePlayback==="loop-reverse"?{index:o-r%t.sequenceFrames.length,visible:!0}:{index:r%t.sequenceFrames.length,visible:!0}}imageFrameTexture(t,s){var n;return t.imageMode==="sequence"&&t.sequenceFrames.length?((n=t.sequenceFrames[Math.max(0,Math.min(t.sequenceFrames.length-1,s))])==null?void 0:n.texture)||t.texture||this.cfg.texture:t.texture||this.cfg.texture}pickTrailResource(t){const s=this.cfg.trailResources.filter(o=>o.texture);if(!s.length)return this.cfg.trailResources[0]||{id:1,texture:null,textureName:"trail",previewUrl:"/images/trail.png",weight:100,locked:!1,rotation:0,colorMode:"particle",color:"#ffffff",colorGradient:[{position:0,color:"#ffffff"},{position:1,color:"#ffffff"}],blend:"normal",alphaMode:"particle",alpha:1,alphaCurve:[{x:0,y:1},{x:1,y:1}],boneCount:3,trailRatio:100,lengthMode:"fixed",length:100,lengthMin:100,lengthMax:100,widthSizeMode:"fixed",width:100,widthMin:100,widthMax:100,widthMode:"particle",lifeLengthEnabled:!1,lifeLengthCurve:[{x:0,y:1},{x:1,y:1}],shapeEnabled:!1,shapeCurve:[{x:0,y:1},{x:1,y:1}]};const n=s.reduce((o,a)=>o+Math.max(0,a.weight),0);if(n<=0)return s[Math.min(s.length-1,Math.floor(t*s.length))];let r=t*n;for(const o of s)if(r-=Math.max(0,o.weight),r<=0)return o;return s[s.length-1]}kill(t){const s=this.pool[t];s.active=!1,s.sprite.visible=!1,s.trailHistory.length=0,s.trailBones.length=0,s.trailMesh&&(s.trailMesh.visible=!1)}clear(){for(const t of this.pool)t.active=!1,t.sprite.visible=!1,t.trailHistory.length=0,t.trailBones.length=0,t.trailMesh&&(t.trailMesh.visible=!1)}get activeCount(){let t=0;for(const s of this.pool)s.active&&t++;return t}capture(){const t=[];for(const s of this.pool)s.active&&t.push({boneName:s.boneName,spawnId:s.spawnId,x:s.sprite.x,y:s.sprite.y,rotation:s.rotation,scaleX:s.sprite.scale.x,scaleY:s.sprite.scale.y,...this.captureWorldTransform(s),alpha:s.sprite.alpha,colorHex:s.sprite.tint,resourceId:s.resourceId,imageFrameIndex:s.imageFrameIndex,imageVisible:s.sprite.visible,active:!0,trailState:this.cfg.trail&&s.trailBones.length?{bones:s.trailBones.map(n=>{var o;const r=Ur(this.cfg,n.x,n.y,this.simulationTransform);return{...n,worldX:r.x,worldY:r.y,worldRotation:(((o=this.simulationTransform)==null?void 0:o.rotation)??this.cfg.rootRotation)-n.rotation}}),activeBoneCount:s.trailBones.length,width:s.trailCurrentWidth,alpha:s.trailCurrentAlpha,colorHex:s.trailCurrentColor,resourceId:s.trailResourceId}:void 0});return t}captureWorldTransform(t){var r,o,a;const s=Ur(this.cfg,t.sprite.x,t.sprite.y,this.simulationTransform),n=((r=this.simulationTransform)==null?void 0:r.rotation)??this.cfg.rootRotation;return{worldX:s.x,worldY:s.y,worldRotation:n+t.rotation,worldScaleX:t.sprite.scale.x*Math.abs(((o=this.simulationTransform)==null?void 0:o.scaleX)??this.cfg.rootScaleX),worldScaleY:t.sprite.scale.y*Math.abs(((a=this.simulationTransform)==null?void 0:a.scaleY)??this.cfg.rootScaleY)}}apply(t){var n;const s=new Map;for(const r of t)s.set(r.boneName,r);for(const r of this.pool){const o=s.get(r.boneName);if(!o){r.active=!1,r.sprite.visible=!1,r.trailMesh&&(r.trailMesh.visible=!1);continue}r.active=o.active;const a=r.sprite;if(a.visible=o.active&&o.imageVisible!==!1,a.x=o.x,a.y=o.y,a.rotation=-o.rotation*Math.PI/180,a.scale.set(o.scaleX,o.scaleY),a.alpha=o.alpha,a.tint=o.colorHex,o.resourceId!=null){const h=this.cfg.imageResources.find(l=>l.id===o.resourceId);h&&(r.imageFrameIndex=o.imageFrameIndex??0,a.texture=this.imageFrameTexture(h,r.imageFrameIndex),a.anchor.set(h.anchorX,h.anchorY),a.blendMode=Dn[h.blend])}this.cfg.trail&&o.trailState?(r.trailResourceId=o.trailState.resourceId??((n=this.cfg.trailResources[0])==null?void 0:n.id)??1,r.trailBones=o.trailState.bones.map(h=>({...h})),r.trailCurrentWidth=o.trailState.width,r.trailCurrentAlpha=o.trailState.alpha,this.skinTrailMesh(r,o.trailState)):r.trailMesh&&(r.trailMesh.visible=!1)}}reset(){for(const t of this.pool)t.active=!1,t.sprite.visible=!1,t.trailHistory.length=0,t.trailBones.length=0,t.trailMesh&&(t.trailMesh.visible=!1);this.accumulator=0,this.burstTimer=0,this._spawnSerial=0,this._elapsed=0,this._attractionEnabledAt=0,this._attractionWasEnabled=!1,this._lastSeed=this.cfg.seed,this.rng=wu(this.cfg.seed>>>0)}restartEmissionCycle(){this.accumulator=0,this.burstTimer=0,this._spawnSerial=0,this._elapsed=0,this._attractionEnabledAt=0,this._attractionWasEnabled=this.cfg.attraction,this._lastSeed=this.cfg.seed,this.rng=wu(this.cfg.seed>>>0)}}function ni(i,e,t){return i+(e-i)*t}function Qa(i,e){return Number.isFinite(i)?i:e}function Ur(i,e,t,s=null){const n=Math.max(1e-4,Math.abs((s==null?void 0:s.scaleX)??i.rootScaleX)),r=Math.max(1e-4,Math.abs((s==null?void 0:s.scaleY)??i.rootScaleY)),o=-((s==null?void 0:s.rotation)??i.rootRotation)*Math.PI/180,a=Math.cos(o),h=Math.sin(o),l=(s==null?void 0:s.centerX)??i.centerX,c=(s==null?void 0:s.centerY)??i.centerY,u=l+a*n*e-h*r*t,f=-c+h*n*e+a*r*t;return{x:u,y:-f}}function ig(i,e,t,s=null){const n=Math.max(1e-4,Math.abs((s==null?void 0:s.scaleX)??i.rootScaleX)),r=Math.max(1e-4,Math.abs((s==null?void 0:s.scaleY)??i.rootScaleY)),o=-((s==null?void 0:s.rotation)??i.rootRotation)*Math.PI/180,a=Math.cos(o),h=Math.sin(o),l=e-((s==null?void 0:s.centerX)??i.centerX),c=-t+((s==null?void 0:s.centerY)??i.centerY);return{x:(a*l+h*c)/n,y:(-h*l+a*c)/r}}function xE(i,e,t,s=null){const n=Math.max(1e-4,Math.abs((s==null?void 0:s.scaleX)??i.rootScaleX)),r=Math.max(1e-4,Math.abs((s==null?void 0:s.scaleY)??i.rootScaleY)),o=-((s==null?void 0:s.rotation)??i.rootRotation)*Math.PI/180,a=Math.cos(o),h=Math.sin(o),l=a*n*e-h*r*t,c=h*n*e+a*r*t;return{x:l,y:-c}}function bE(i,e,t,s=null){const n=Math.max(1e-4,Math.abs((s==null?void 0:s.scaleX)??i.rootScaleX)),r=Math.max(1e-4,Math.abs((s==null?void 0:s.scaleY)??i.rootScaleY)),o=-((s==null?void 0:s.rotation)??i.rootRotation)*Math.PI/180,a=Math.cos(o),h=Math.sin(o),l=-t;return{x:(a*e+h*l)/n,y:(-h*e+a*l)/r}}function wE(i,e,t){const s=i.rotation*Math.PI/180,n=Math.cos(s),r=Math.sin(s),o=Math.max(1e-4,Math.abs(i.scaleX??1)),a=Math.max(1e-4,Math.abs(i.scaleY??1)),h=e-i.x,l=t-i.y,c=(n*h+r*l)/o,u=(-r*h+n*l)/a,f=(I,E,C,R)=>{const B=C/o,k=R/a,F=Math.max(1e-4,Math.hypot(B,k)),D=B/F,N=k/F,j=n*D-r*N,O=r*D+n*N;return{x:i.x+n*I*o-r*E*a+j*.05,y:i.y+r*I*o+n*E*a+O*.05,nx:j,ny:O}};if(i.shape==="circle"){const I=Math.max(.001,i.radius),E=Math.hypot(c,u);if(E>=I)return null;const C=E>1e-4?c/E:1,R=E>1e-4?u/E:0;return f(C*I,R*I,C,R)}if(i.shape==="ellipse"){const I=Math.max(.001,i.radiusX),E=Math.max(.001,i.radiusY),C=Math.hypot(c/I,u/E);if(C>=1)return null;const R=C>1e-4?1/C:1,B=C>1e-4?c*R:I,k=C>1e-4?u*R:0,F=Math.max(1e-4,Math.hypot(B/(I*I),k/(E*E)));return f(B,k,B/(I*I)/F,k/(E*E)/F)}if(i.shape==="rect"){const I=Math.max(.001,i.width*.5),E=Math.max(.001,i.height*.5);if(Math.abs(c)>=I||Math.abs(u)>=E)return null;const C=I-Math.abs(c),R=E-Math.abs(u);if(C<R){const k=c>=0?1:-1;return f(k*I,u,k,0)}const B=u>=0?1:-1;return f(c,B*E,0,B)}const d=Math.max(3,Math.min(16,Math.round(i.sides||(i.shape==="custom"?5:6)))),m=Math.max(.001,i.width*.5),g=Math.max(.001,i.height*.5),b=Array.from({length:d},(I,E)=>{const C=Math.PI*.5+E/d*Math.PI*2;return{x:Math.cos(C)*m,y:Math.sin(C)*g}});let _=!1;for(let I=0,E=b.length-1;I<b.length;E=I++){const C=b[I],R=b[E];C.y>u!=R.y>u&&c<(R.x-C.x)*(u-C.y)/(R.y-C.y)+C.x&&(_=!_)}if(!_)return null;let M=b[0].x,v=b[0].y,S=1/0;for(let I=0;I<b.length;I++){const E=b[I],C=b[(I+1)%b.length],R=C.x-E.x,B=C.y-E.y,k=Math.max(1e-4,R*R+B*B),F=Math.min(1,Math.max(0,((c-E.x)*R+(u-E.y)*B)/k)),D=E.x+R*F,N=E.y+B*F,j=Math.hypot(D-c,N-u);j<S&&(S=j,M=D,v=N)}const y=Math.max(1e-4,Math.hypot(M-c,v-u));return f(M,v,(M-c)/y,(v-u)/y)}function _E(i){return Math.min(1,Math.max(0,1-i.life/Math.max(1e-4,i.maxLife)))}function Vr(i,e,t){let s=(i>>>0^Math.imul(e+1,2654435761)^t)>>>0;return s^=s>>>16,s=Math.imul(s,2146121005),s^=s>>>15,s=Math.imul(s,2221713035),s^=s>>>16,(s>>>0)/4294967296}function Xr(i,e,t,s,n){return i==="fixed"?e:i==="curve"?ni(e,t,Ps(s,n)):ni(e,t,n)}function bu(i,e,t,s,n,r){return i==="curve"?ni(e,t,Ps(s,n)):i==="random"?r:e}function sg(i,e,t,s,n){const r=1-n;return r*r*r*i+3*r*r*n*e+3*r*n*n*t+n*n*n*s}function Ps(i,e,t="线性"){if(!Array.isArray(i)||i.length===0)return 1;const s=[...i].sort((n,r)=>n.x-r.x);if(e<=s[0].x)return s[0].y;if(e>=s[s.length-1].x)return s[s.length-1].y;for(let n=0;n<s.length-1;n++)if(e>=s[n].x&&e<=s[n+1].x){const r=s[n],o=s[n+1],a=o.x-r.x||1;if(t!=="贝塞尔")return ni(r.y,o.y,(e-r.x)/a);const h=r.x+(r.outX??a/3),l=r.y+(r.outY??(o.y-r.y)/3),c=o.x+(o.inX??-a/3),u=o.y+(o.inY??-(o.y-r.y)/3);let f=0,d=1;for(let m=0;m<14;m++){const g=(f+d)/2;sg(r.x,h,c,o.x,g)<e?f=g:d=g}return sg(r.y,l,u,o.y,(f+d)/2)}return s[s.length-1].y}function wu(i){let e=i>>>0;return function(){e|=0,e=e+1831565813|0;let t=Math.imul(e^e>>>15,1|e);return t=t+Math.imul(t^t>>>7,61|t)^t,((t^t>>>14)>>>0)/4294967296}}function fo(i){let e=i.replace("#","");return e.length===3&&(e=e.split("").map(t=>t+t).join("")),parseInt(e,16)}function SE(i,e,t){const s=rg(i),n=rg(e),r=Math.round(s[0]+(n[0]-s[0])*t),o=Math.round(s[1]+(n[1]-s[1])*t),a=Math.round(s[2]+(n[2]-s[2])*t);return r<<16|o<<8|a}function ng(i,e){if(!Array.isArray(i)||i.length===0)return 16777215;const t=[...i].sort((s,n)=>s.position-n.position);if(e<=t[0].position)return fo(t[0].color);if(e>=t[t.length-1].position)return fo(t[t.length-1].color);for(let s=0;s<t.length-1;s++){const n=t[s],r=t[s+1];if(e<n.position||e>r.position)continue;const o=(e-n.position)/Math.max(1e-4,r.position-n.position);return SE(n.color,r.color,o)}return fo(t[t.length-1].color)}function rg(i){let e=i.replace("#","");e.length===3&&(e=e.split("").map(s=>s+s).join(""));const t=parseInt(e,16);return[t>>16&255,t>>8&255,t&255]}const Mr=new Map,xr=new Map;function TE(i){return[...Mr.values()].some(e=>e===i)}function py(i){if(!(TE(i)||(xr.get(i)||0)>0)){xr.delete(i);for(const e of i.textures)e.destroy(!0)}}function ME(i){const e=xr.get(i)||0;e>1?xr.set(i,e-1):xr.delete(i),py(i)}function EE(i){return Mr.get(i)||null}function Lh(i,e){Ea(i),Mr.set(i,e)}function AE(i){const e=Mr.get(i);return e?(xr.set(e,(xr.get(e)||0)+1),e):null}function CE(i,e){const t=Mr.get(i);return t?(Lh(e,t),!0):!1}function Ea(i){const e=Mr.get(i);e&&(Mr.delete(i),py(e))}function Ut(i){if(Array.isArray(i))return i.map(e=>Ut(e));if(i&&typeof i=="object"){const e=Object.getPrototypeOf(i);if(e===Object.prototype||e===null){const t={};for(const[s,n]of Object.entries(i))t[s]=Ut(n);return t}}return i}const my=["3.8","4.0","4.1","4.2"];function Wl(i){const e=String(i||"").trim();return my.find(t=>e===t||e.startsWith(`${t}.`))||null}function Sd(){return my.join(" / ")}function uf(){return{imagesPath:"./images/",spineVersion:"4.2",keyframeCurve:"linear",fps:30,omitFps:!1,integerFrameAlignment:!0,bonePool:!0,excludeEmptyAnimations:!1,fileName:"SpineParticle.json"}}function gy(i){const e=Object.assign(uf(),i||{});return e.imagesPath=String(e.imagesPath||"./images/"),e.spineVersion=Wl(e.spineVersion)||"4.2",e.keyframeCurve=e.keyframeCurve==="bezier"?"bezier":"linear",e.fps=Math.min(240,Math.max(1,Math.round(Number(e.fps)||30))),e.omitFps=e.omitFps===!0,e.integerFrameAlignment=e.integerFrameAlignment!==!1,e.bonePool=e.bonePool!==!1,e.excludeEmptyAnimations=e.excludeEmptyAnimations===!0,e.fileName=String(e.fileName||"SpineParticle.json"),e}let el=1,tl=1,il=1,sl=1;function nl(i,e){const t=new Set(e),s=`${i} Copy`;if(!t.has(s))return s;let n=2;for(;t.has(`${s} ${n}`);)n++;return`${s} ${n}`}const Aa=tw("particle",{state:()=>({editor:{viewScale:1,viewX:0,viewY:0},systems:[],colliders:[],paths:[],spines:[],activeId:0,activeObjectType:"particle",activeObjectId:0,timeline:{playing:!0,loop:!0,frame:0,totalFrames:60,fps:30,recorded:!1,animation:"animation",animations:["animation"]},settings:{parameterPanelOnRight:!0,tickEnabled:!1,axisFontSize:12,tickWidth:1,showAxisLabels:!0,axisColor:"#7a86ad",undoLimit:20,backgroundX:0,backgroundY:0,backgroundOpacity:1,backgroundImageName:"",backgroundImageData:"",showEmitter:!0,showBones:!1,bonePointDrawSize:1,boneAxisDrawSize:2,showSkinMesh:!1,showGrid:!0,exportSettings:uf()}}),getters:{activeSystemCount:i=>i.systems.length},actions:{syncSceneSequences(){el=Math.max(el,...this.systems.map(i=>i.id+1),1),tl=Math.max(tl,...this.colliders.map(i=>i.id+1),1),il=Math.max(il,...this.paths.map(i=>i.id+1),1),sl=Math.max(sl,...this.spines.map(i=>i.id+1),1)},addSystem(i){const e=ga();i!=null&&i.config&&Object.assign(e,i.config);const t=new Set(this.systems.map(r=>r.config.name));if(t.has(e.name)){let r=0;for(const a of this.systems){const h=/^ParticleSystem(\d+)$/.exec(a.config.name);h&&(r=Math.max(r,parseInt(h[1],10)))}e.name=`ParticleSystem${r+1}`;let o=2;for(;t.has(e.name);)e.name=`ParticleSystem${r+o}`,o++}const s=this.timeline.animations.includes(this.timeline.animation)?this.timeline.animation:this.timeline.animations[0]||"animation",n={id:el++,visible:!0,animation:s,config:e};return this.systems.push(n),this.activeId=n.id,this.activeObjectType="particle",this.activeObjectId=n.id,n},removeSystem(i){var s;const e=this.systems.findIndex(n=>n.id===i);e>=0&&this.systems.splice(e,1),this.activeId===i&&(this.activeId=((s=this.systems[0])==null?void 0:s.id)??0);const t=this.systems.find(n=>n.id===this.activeId);if(t&&(this.timeline.animation=t.animation),this.activeObjectType==="particle"&&this.activeObjectId===i){const n=this.systems[0];this.activeObjectId=(n==null?void 0:n.id)??0}},selectSystem(i){this.activeId=i,this.activeObjectType="particle",this.activeObjectId=i;const e=this.systems.find(t=>t.id===i);e&&(this.timeline.animation=e.animation)},setSystemAnimation(i,e){if(!this.timeline.animations.includes(e))return;const t=this.systems.find(s=>s.id===i);t&&(t.animation=e,this.timeline.animation=e)},addAnimation(){const i=new Set(this.timeline.animations);let e=2,t=`animation${e}`;for(;i.has(t);)t=`animation${++e}`;this.timeline.animations.push(t),this.timeline.animation=t;const s=this.systems.find(n=>n.id===this.activeId);return s&&(s.animation=t),t},renameAnimation(i,e){const t=e.trim(),s=this.timeline.animations.indexOf(i);if(s<0||!t||t!==i&&this.timeline.animations.includes(t))return!1;this.timeline.animations[s]=t;for(const n of this.systems)n.animation===i&&(n.animation=t);return this.timeline.animation===i&&(this.timeline.animation=t),!0},removeAnimation(i){if(this.timeline.animations.length<=1)return!1;const e=this.timeline.animations.indexOf(i);if(e<0)return!1;this.timeline.animations.splice(e,1);const t=this.timeline.animations[Math.min(e,this.timeline.animations.length-1)];for(const s of this.systems)s.animation===i&&(s.animation=t);return this.timeline.animation===i&&(this.timeline.animation=t),!0},addCollider(){const i=tl++,e={id:i,name:`Collider${i}`,visible:!0,tags:["Default"],selectedTag:"Default",shape:"circle",enabled:!0,x:0,y:0,rotation:0,scaleX:1,scaleY:1,radius:50,radiusX:70,radiusY:45,width:120,height:80,sides:6,response:"physics",elasticity:.8,friction:.3,followPath:!1,followPathId:0,followDuration:2,followPathRotation:!1,followCurveMode:"跟随导出",followCurve:[{x:0,y:0},{x:1,y:1}]};return this.colliders.push(e),this.activeObjectType="collision",this.activeObjectId=e.id,e},addPath(){const i=il++,e={id:i,name:`Path${i}`,visible:!0,enabled:!0,x:0,y:0,rotation:0,scaleX:1,scaleY:1,closed:!1,color:"#ff933e",preset:"",points:[]};return this.paths.push(e),this.activeObjectType="path",this.activeObjectId=e.id,e},addSpine(){const i=sl++,e={id:i,name:`SpineSkeleton${i}`,enabled:!0,visible:!0,x:0,y:0,rotation:0,scaleX:1,scaleY:1,timeOffset:0,skeletonFileName:"",atlasFileName:"",textureFileNames:[],dataVersion:"",sourceBundle:null,selectedAnimation:"",selectedBone:"",animations:[],bones:[],assetVersion:0,status:"empty",error:""};return this.spines.push(e),this.activeObjectType="spine",this.activeObjectId=e.id,e},duplicateSelectedObject(){const i=this.activeObjectId;if(!i)return null;if(this.activeObjectType==="particle"){const s=this.systems.find(r=>r.id===i);if(!s)return null;const n=Ut(s);return n.id=el++,n.config.name=nl(s.config.name,this.systems.map(r=>r.config.name)),n.frames=void 0,this.systems.push(n),this.activeId=n.id,this.activeObjectId=n.id,this.timeline.animation=n.animation,n}if(this.activeObjectType==="collision"){const s=this.colliders.find(r=>r.id===i);if(!s)return null;const n=Ut(s);return n.id=tl++,n.name=nl(s.name,this.colliders.map(r=>r.name)),this.colliders.push(n),this.activeObjectId=n.id,n}if(this.activeObjectType==="path"){const s=this.paths.find(r=>r.id===i);if(!s)return null;const n=Ut(s);return n.id=il++,n.name=nl(s.name,this.paths.map(r=>r.name)),this.paths.push(n),this.activeObjectId=n.id,n}const e=this.spines.find(s=>s.id===i);if(!e)return null;const t=Ut(e);return t.id=sl++,t.name=nl(e.name,this.spines.map(s=>s.name)),t.selectedBone="",CE(e.id,t.id),this.spines.push(t),this.activeObjectId=t.id,t},selectSceneObject(i,e){if(this.activeObjectType=i,this.activeObjectId=e,i==="particle"){this.activeId=e;const t=this.systems.find(s=>s.id===e);t&&(this.timeline.animation=t.animation)}},removeCollider(i){var t;const e=this.colliders.findIndex(s=>s.id===i);if(e>=0&&this.colliders.splice(e,1),this.activeObjectType==="collision"&&this.activeObjectId===i){const s=this.systems[0];this.activeObjectType=s?"particle":"collision",this.activeObjectId=(s==null?void 0:s.id)??((t=this.colliders[0])==null?void 0:t.id)??0}},removePath(i){var t;const e=this.paths.findIndex(s=>s.id===i);if(e>=0&&this.paths.splice(e,1),this.activeObjectType==="path"&&this.activeObjectId===i){const s=this.systems[0];this.activeObjectType=s?"particle":"path",this.activeObjectId=(s==null?void 0:s.id)??((t=this.paths[0])==null?void 0:t.id)??0}},removeSpine(i){Ea(i);const e=this.spines.findIndex(t=>t.id===i);if(e>=0&&this.spines.splice(e,1),this.activeObjectType==="spine"&&this.activeObjectId===i){const t=this.systems[0],s=this.colliders[0],n=this.paths[0],r=this.spines[0];t?(this.activeObjectType="particle",this.activeObjectId=t.id,this.activeId=t.id):s?(this.activeObjectType="collision",this.activeObjectId=s.id):n?(this.activeObjectType="path",this.activeObjectId=n.id):(this.activeObjectType="spine",this.activeObjectId=(r==null?void 0:r.id)??0)}this.recalcTotalFrames()},play(){this.timeline.frame>=Math.max(0,this.timeline.totalFrames-1)&&(this.timeline.frame=0),this.timeline.playing=!0},pause(){this.timeline.playing=!1},togglePlay(){this.timeline.playing?this.pause():this.play()},toStart(){this.timeline.frame=0},previousFrame(){this.timeline.playing=!1,this.timeline.frame=Math.max(0,this.timeline.frame-1)},nextFrame(){this.timeline.playing=!1,this.timeline.frame=Math.min(Math.max(0,this.timeline.totalFrames-1),this.timeline.frame+1)},toEnd(){this.timeline.playing=!1,this.timeline.frame=Math.max(0,this.timeline.totalFrames-1)},toggleLoop(){this.timeline.loop=!this.timeline.loop},setFrame(i){this.timeline.frame=Math.max(0,Math.min(i,this.timeline.totalFrames-1))},recalcTotalFrames(){const i=this.timeline.fps||30;let e=0;for(const s of this.systems){const n=s.config,r=Math.max(0,Number(n.lifeMin)||0),o=Math.max(0,Number(n.lifeMax)||0),a=n.lifeMode==="fixed"?r:Math.max(r,o),h=n.mode==="stream"?n.streamBehavior==="loop"?Math.max(1/i,Math.ceil(Math.max(1,Number(n.loopDurationFrames)||1))/i):Math.max(1/i,Number(n.duration)||0):0;let l=Math.max(0,Number(n.delay)||0)+h+a;if(n.mode==="stream"&&n.streamBehavior==="loop")if(n.generateLoopEndAnimation)l=Math.max(0,Number(n.delay)||0)+a+1/i;else if(n.generateLoopStartAnimation){const c=Math.max(1,Math.ceil(a/h));l=Math.max(0,Number(n.delay)||0)+h*c}else l=Math.max(0,Number(n.delay)||0)+h;l>e&&(e=l)}for(const s of this.spines){const n=s.animations.find(o=>o.name===s.selectedAnimation);if(!n)continue;const r=Math.max(0,Number(s.timeOffset)||0)+Math.max(0,n.duration||0);r>e&&(e=r)}for(const s of this.colliders){if(!s.followPath||!s.followPathId)continue;const n=Math.max(0,Number(s.followDuration)||0);n>e&&(e=n)}const t=Math.max(1,Math.ceil(e*i)+1);return this.timeline.totalFrames=t,this.timeline.frame>=t&&(this.timeline.frame=t-1),t}}}),vy="SpineParticle.SystemSettings",yy=1,_u="SpineParticle.SystemSettings.v1";function Lo(i,e,t,s){const n=Number(i);return Math.min(t,Math.max(e,Number.isFinite(n)?n:s))}function IE(i){return{parameterPanelOnRight:i.parameterPanelOnRight,undoLimit:i.undoLimit,showEmitter:i.showEmitter,showBones:i.showBones,bonePointDrawSize:i.bonePointDrawSize,boneAxisDrawSize:i.boneAxisDrawSize,showSkinMesh:i.showSkinMesh,tickEnabled:i.tickEnabled,axisFontSize:i.axisFontSize,tickWidth:i.tickWidth,showAxisLabels:i.showAxisLabels,axisColor:i.axisColor}}function RE(i,e){const t=n=>i[n]==null?!!e[n]:i[n]===!0,s=typeof i.axisColor=="string"&&/^#[0-9a-f]{6}$/i.test(i.axisColor)?i.axisColor:e.axisColor;return{parameterPanelOnRight:t("parameterPanelOnRight"),undoLimit:Math.round(Lo(i.undoLimit,1,200,e.undoLimit)),showEmitter:t("showEmitter"),showBones:t("showBones"),bonePointDrawSize:Lo(i.bonePointDrawSize,.1,10,e.bonePointDrawSize),boneAxisDrawSize:Lo(i.boneAxisDrawSize,.1,10,e.boneAxisDrawSize),showSkinMesh:t("showSkinMesh"),tickEnabled:t("tickEnabled"),axisFontSize:Math.round(Lo(i.axisFontSize,8,40,e.axisFontSize)),tickWidth:Lo(i.tickWidth,1,5,e.tickWidth),showAxisLabels:t("showAxisLabels"),axisColor:s}}function PE(i){let e;try{e=JSON.parse(i)}catch{throw new Error("系统设置缓存不是有效的 JSON")}const t=e;if(t.format!==vy)throw new Error("不是 Spine粒子编辑器系统设置缓存");if(t.version!==yy)throw new Error(`暂不支持系统配置版本:${t.version??"未知"}`);if(!t.settings||typeof t.settings!="object")throw new Error("系统设置缓存缺少 settings");return t}function kE(i,e){Object.assign(i.settings,RE(e,i.settings))}let rl=null;function FE(i){rl==null||rl();try{const e=localStorage.getItem(_u);e&&kE(i,PE(e).settings)}catch{try{localStorage.removeItem(_u)}catch{}}rl=cs(()=>IE(i.settings),e=>{const t={format:vy,version:yy,savedAt:new Date().toISOString(),settings:e};try{localStorage.setItem(_u,JSON.stringify(t))}catch{}},{deep:!0})}if(typeof window<"u"&&window.PIXI){let i=window.require;window.require=e=>{if(i)return i(e);if(e.startsWith("@pixi/"))return window.PIXI}}class xy{constructor(){A(this,"entries",{});A(this,"size",0)}add(e){let t=this.entries[e];return this.entries[e]=!0,t?!1:(this.size++,!0)}addAll(e){let t=this.size;for(var s=0,n=e.length;s<n;s++)this.add(e[s]);return t!=this.size}contains(e){return this.entries[e]}clear(){this.entries={},this.size=0}}const Di=class Di{constructor(e=0,t=0,s=0,n=0){A(this,"r");A(this,"g");A(this,"b");A(this,"a");this.r=e,this.g=t,this.b=s,this.a=n}set(e,t,s,n){return this.r=e,this.g=t,this.b=s,this.a=n,this.clamp()}setFromColor(e){return this.r=e.r,this.g=e.g,this.b=e.b,this.a=e.a,this}setFromString(e){return e=e.charAt(0)=="#"?e.substr(1):e,this.r=parseInt(e.substr(0,2),16)/255,this.g=parseInt(e.substr(2,2),16)/255,this.b=parseInt(e.substr(4,2),16)/255,this.a=e.length!=8?1:parseInt(e.substr(6,2),16)/255,this}add(e,t,s,n){return this.r+=e,this.g+=t,this.b+=s,this.a+=n,this.clamp()}clamp(){return this.r<0?this.r=0:this.r>1&&(this.r=1),this.g<0?this.g=0:this.g>1&&(this.g=1),this.b<0?this.b=0:this.b>1&&(this.b=1),this.a<0?this.a=0:this.a>1&&(this.a=1),this}static rgba8888ToColor(e,t){e.r=((t&4278190080)>>>24)/255,e.g=((t&16711680)>>>16)/255,e.b=((t&65280)>>>8)/255,e.a=(t&255)/255}static rgb888ToColor(e,t){e.r=((t&16711680)>>>16)/255,e.g=((t&65280)>>>8)/255,e.b=(t&255)/255}toRgb888(){const e=t=>("0"+(t*255).toString(16)).slice(-2);return+("0x"+e(this.r)+e(this.g)+e(this.b))}static fromString(e,t=new Di){return t.setFromString(e)}};A(Di,"WHITE",new Di(1,1,1,1)),A(Di,"RED",new Di(1,0,0,1)),A(Di,"GREEN",new Di(0,1,0,1)),A(Di,"BLUE",new Di(0,0,1,1)),A(Di,"MAGENTA",new Di(1,0,1,1));let ot=Di;const ti=class ti{static clamp(e,t,s){return e<t?t:e>s?s:e}static cosDeg(e){return Math.cos(e*ti.degRad)}static sinDeg(e){return Math.sin(e*ti.degRad)}static atan2Deg(e,t){return Math.atan2(e,t)*ti.degRad}static signum(e){return e>0?1:e<0?-1:0}static toInt(e){return e>0?Math.floor(e):Math.ceil(e)}static cbrt(e){let t=Math.pow(Math.abs(e),.3333333333333333);return e<0?-t:t}static randomTriangular(e,t){return ti.randomTriangularWith(e,t,(e+t)*.5)}static randomTriangularWith(e,t,s){let n=Math.random(),r=t-e;return n<=(s-e)/r?e+Math.sqrt(n*r*(s-e)):t-Math.sqrt((1-n)*r*(t-s))}static isPowerOfTwo(e){return e&&(e&e-1)===0}};A(ti,"PI",3.1415927),A(ti,"PI2",ti.PI*2),A(ti,"invPI2",1/ti.PI2),A(ti,"radiansToDegrees",180/ti.PI),A(ti,"radDeg",ti.radiansToDegrees),A(ti,"degreesToRadians",ti.PI/180),A(ti,"degRad",ti.degreesToRadians);let ke=ti;const Nn=class Nn{static arrayCopy(e,t,s,n,r){for(let o=t,a=n;o<t+r;o++,a++)s[a]=e[o]}static arrayFill(e,t,s,n){for(let r=t;r<s;r++)e[r]=n}static setArraySize(e,t,s=0){let n=e.length;if(n==t)return e;if(e.length=t,n<t)for(let r=n;r<t;r++)e[r]=s;return e}static ensureArrayCapacity(e,t,s=0){return e.length>=t?e:Nn.setArraySize(e,t,s)}static newArray(e,t){let s=new Array(e);for(let n=0;n<e;n++)s[n]=t;return s}static newFloatArray(e){if(Nn.SUPPORTS_TYPED_ARRAYS)return new Float32Array(e);{let t=new Array(e);for(let s=0;s<t.length;s++)t[s]=0;return t}}static newShortArray(e){if(Nn.SUPPORTS_TYPED_ARRAYS)return new Int16Array(e);{let t=new Array(e);for(let s=0;s<t.length;s++)t[s]=0;return t}}static toFloatArray(e){return Nn.SUPPORTS_TYPED_ARRAYS?new Float32Array(e):e}static toSinglePrecision(e){return Nn.SUPPORTS_TYPED_ARRAYS?Math.fround(e):e}static webkit602BugfixHelper(e,t){}static contains(e,t,s=!0){for(var n=0;n<e.length;n++)if(e[n]==t)return!0;return!1}static enumValue(e,t){return e[t[0].toUpperCase()+t.slice(1)]}};A(Nn,"SUPPORTS_TYPED_ARRAYS",typeof Float32Array<"u");let Fe=Nn;class zl{constructor(e){A(this,"items",new Array);A(this,"instantiator");this.instantiator=e}obtain(){return this.items.length>0?this.items.pop():this.instantiator()}free(e){e.reset&&e.reset(),this.items.push(e)}freeAll(e){for(let t=0;t<e.length;t++)this.free(e[t])}clear(){this.items.length=0}}class ql{constructor(e=0,t=0){A(this,"x");A(this,"y");this.x=e,this.y=t}set(e,t){return this.x=e,this.y=t,this}length(){let e=this.x,t=this.y;return Math.sqrt(e*e+t*t)}normalize(){let e=this.length();return e!=0&&(this.x/=e,this.y/=e),this}}class by{constructor(e){A(this,"name");if(!e)throw new Error("name cannot be null.");this.name=e}}const ah=class ah extends by{constructor(t){super(t);A(this,"id",ah.nextID++);A(this,"bones",null);A(this,"vertices",[]);A(this,"worldVerticesLength",0);A(this,"timelineAttachment",this)}computeWorldVertices(t,s,n,r,o,a){n=o+(n>>1)*a;let h=t.bone.skeleton,l=t.deform,c=this.vertices,u=this.bones;if(!u){l.length>0&&(c=l);let g=t.bone,b=g.worldX,_=g.worldY,M=g.a,v=g.b,S=g.c,y=g.d;for(let I=s,E=o;E<n;I+=2,E+=a){let C=c[I],R=c[I+1];r[E]=C*M+R*v+b,r[E+1]=C*S+R*y+_}return}let f=0,d=0;for(let g=0;g<s;g+=2){let b=u[f];f+=b+1,d+=b}let m=h.bones;if(l.length==0)for(let g=o,b=d*3;g<n;g+=a){let _=0,M=0,v=u[f++];for(v+=f;f<v;f++,b+=3){let S=m[u[f]],y=c[b],I=c[b+1],E=c[b+2];_+=(y*S.a+I*S.b+S.worldX)*E,M+=(y*S.c+I*S.d+S.worldY)*E}r[g]=_,r[g+1]=M}else{let g=l;for(let b=o,_=d*3,M=d<<1;b<n;b+=a){let v=0,S=0,y=u[f++];for(y+=f;f<y;f++,_+=3,M+=2){let I=m[u[f]],E=c[_]+g[M],C=c[_+1]+g[M+1],R=c[_+2];v+=(E*I.a+C*I.b+I.worldX)*R,S+=(E*I.c+C*I.d+I.worldY)*R}r[b]=v,r[b+1]=S}}}copyTo(t){this.bones?(t.bones=new Array(this.bones.length),Fe.arrayCopy(this.bones,0,t.bones,0,this.bones.length)):t.bones=null,this.vertices&&(t.vertices=Fe.newFloatArray(this.vertices.length),Fe.arrayCopy(this.vertices,0,t.vertices,0,this.vertices.length)),t.worldVerticesLength=this.worldVerticesLength,t.timelineAttachment=this.timelineAttachment}};A(ah,"nextID",0);let vs=ah;const Qr=class Qr{constructor(e){A(this,"id",Qr.nextID());A(this,"regions");A(this,"start",0);A(this,"digits",0);A(this,"setupIndex",0);this.regions=new Array(e)}copy(){let e=new Qr(this.regions.length);return Fe.arrayCopy(this.regions,0,e.regions,0,this.regions.length),e.start=this.start,e.digits=this.digits,e.setupIndex=this.setupIndex,e}apply(e,t){let s=e.sequenceIndex;s==-1&&(s=this.setupIndex),s>=this.regions.length&&(s=this.regions.length-1);let n=this.regions[s];t.region!=n&&(t.region=n,t.updateRegion())}getPath(e,t){let s=e,n=(this.start+t).toString();for(let r=this.digits-n.length;r>0;r--)s+="0";return s+=n,s}static nextID(){return Qr._nextID++}};A(Qr,"_nextID",0);let Kl=Qr;var fi;(function(i){i[i.hold=0]="hold",i[i.once=1]="once",i[i.loop=2]="loop",i[i.pingpong=3]="pingpong",i[i.onceReverse=4]="onceReverse",i[i.loopReverse=5]="loopReverse",i[i.pingpongReverse=6]="pingpongReverse"})(fi||(fi={}));const wy=[fi.hold,fi.once,fi.loop,fi.pingpong,fi.onceReverse,fi.loopReverse,fi.pingpongReverse];class df{constructor(e,t,s){A(this,"name");A(this,"timelines",[]);A(this,"timelineIds",new xy);A(this,"duration");if(!e)throw new Error("name cannot be null.");this.name=e,this.setTimelines(t),this.duration=s}setTimelines(e){if(!e)throw new Error("timelines cannot be null.");this.timelines=e,this.timelineIds.clear();for(var t=0;t<e.length;t++)this.timelineIds.addAll(e[t].getPropertyIds())}hasTimeline(e){for(let t=0;t<e.length;t++)if(this.timelineIds.contains(e[t]))return!0;return!1}apply(e,t,s,n,r,o,a,h){if(!e)throw new Error("skeleton cannot be null.");n&&this.duration!=0&&(s%=this.duration,t>0&&(t%=this.duration));let l=this.timelines;for(let c=0,u=l.length;c<u;c++)l[c].apply(e,t,s,r,o,a,h)}}var we;(function(i){i[i.setup=0]="setup",i[i.first=1]="first",i[i.replace=2]="replace",i[i.add=3]="add"})(we||(we={}));var xi;(function(i){i[i.mixIn=0]="mixIn",i[i.mixOut=1]="mixOut"})(xi||(xi={}));const ht={rotate:0,x:1,y:2,scaleX:3,scaleY:4,shearX:5,shearY:6,inherit:7,rgb:8,alpha:9,rgb2:10,attachment:11,deform:12,event:13,drawOrder:14,ikConstraint:15,transformConstraint:16,pathConstraintPosition:17,pathConstraintSpacing:18,pathConstraintMix:19,physicsConstraintInertia:20,physicsConstraintStrength:21,physicsConstraintDamping:22,physicsConstraintMass:23,physicsConstraintWind:24,physicsConstraintGravity:25,physicsConstraintMix:26,physicsConstraintReset:27,sequence:28};let Xt=class{constructor(e,t){A(this,"propertyIds");A(this,"frames");this.propertyIds=t,this.frames=Fe.newFloatArray(e*this.getFrameEntries())}getPropertyIds(){return this.propertyIds}getFrameEntries(){return 1}getFrameCount(){return this.frames.length/this.getFrameEntries()}getDuration(){return this.frames[this.frames.length-this.getFrameEntries()]}static search1(e,t){let s=e.length;for(let n=1;n<s;n++)if(e[n]>t)return n-1;return s-1}static search(e,t,s){let n=e.length;for(let r=s;r<n;r+=s)if(e[r]>t)return r-s;return n-s}};class qs extends Xt{constructor(t,s,n){super(t,n);A(this,"curves");this.curves=Fe.newFloatArray(t+s*18),this.curves[t-1]=1}setLinear(t){this.curves[t]=0}setStepped(t){this.curves[t]=1}shrink(t){let s=this.getFrameCount()+t*18;if(this.curves.length>s){let n=Fe.newFloatArray(s);Fe.arrayCopy(this.curves,0,n,0,s),this.curves=n}}setBezier(t,s,n,r,o,a,h,l,c,u,f){let d=this.curves,m=this.getFrameCount()+t*18;n==0&&(d[s]=2+m);let g=(r-a*2+l)*.03,b=(o-h*2+c)*.03,_=((a-l)*3-r+u)*.006,M=((h-c)*3-o+f)*.006,v=g*2+_,S=b*2+M,y=(a-r)*.3+g+_*.16666667,I=(h-o)*.3+b+M*.16666667,E=r+y,C=o+I;for(let R=m+18;m<R;m+=2)d[m]=E,d[m+1]=C,y+=v,I+=S,v+=_,S+=M,E+=y,C+=I}getBezierValue(t,s,n,r){let o=this.curves;if(o[r]>t){let c=this.frames[s],u=this.frames[s+n];return u+(t-c)/(o[r]-c)*(o[r+1]-u)}let a=r+18;for(r+=2;r<a;r+=2)if(o[r]>=t){let c=o[r-2],u=o[r-1];return u+(t-c)/(o[r]-c)*(o[r+1]-u)}s+=this.getFrameEntries();let h=o[a-2],l=o[a-1];return l+(t-h)/(this.frames[s]-h)*(this.frames[s+n]-l)}}class ys extends qs{constructor(e,t,s){super(e,t,[s])}getFrameEntries(){return 2}setFrame(e,t,s){e<<=1,this.frames[e]=t,this.frames[e+1]=s}getCurveValue(e){let t=this.frames,s=t.length-2;for(let r=2;r<=s;r+=2)if(t[r]>e){s=r-2;break}let n=this.curves[s>>1];switch(n){case 0:let r=t[s],o=t[s+1];return o+(e-r)/(t[s+2]-r)*(t[s+2+1]-o);case 1:return t[s+1]}return this.getBezierValue(e,s,1,n-2)}getRelativeValue(e,t,s,n,r){if(e<this.frames[0]){switch(s){case we.setup:return r;case we.first:return n+(r-n)*t}return n}let o=this.getCurveValue(e);switch(s){case we.setup:return r+o*t;case we.first:case we.replace:o+=r-n}return n+o*t}getAbsoluteValue(e,t,s,n,r){if(e<this.frames[0]){switch(s){case we.setup:return r;case we.first:return n+(r-n)*t}return n}let o=this.getCurveValue(e);return s==we.setup?r+(o-r)*t:n+(o-n)*t}getAbsoluteValue2(e,t,s,n,r,o){if(e<this.frames[0]){switch(s){case we.setup:return r;case we.first:return n+(r-n)*t}return n}return s==we.setup?r+(o-r)*t:n+(o-n)*t}getScaleValue(e,t,s,n,r,o){const a=this.frames;if(e<a[0]){switch(s){case we.setup:return o;case we.first:return r+(o-r)*t}return r}let h=this.getCurveValue(e)*o;if(t==1)return s==we.add?r+h-o:h;if(n==xi.mixOut)switch(s){case we.setup:return o+(Math.abs(h)*ke.signum(o)-o)*t;case we.first:case we.replace:return r+(Math.abs(h)*ke.signum(r)-r)*t}else{let l=0;switch(s){case we.setup:return l=Math.abs(o)*ke.signum(h),l+(h-l)*t;case we.first:case we.replace:return l=Math.abs(r)*ke.signum(h),l+(h-l)*t}}return r+(h-o)*t}}class ff extends qs{constructor(e,t,s,n){super(e,t,[s,n])}getFrameEntries(){return 3}setFrame(e,t,s,n){e*=3,this.frames[e]=t,this.frames[e+1]=s,this.frames[e+2]=n}}class Zl extends ys{constructor(t,s,n){super(t,s,ht.rotate+"|"+n);A(this,"boneIndex",0);this.boneIndex=n}apply(t,s,n,r,o,a,h){let l=t.bones[this.boneIndex];l.active&&(l.rotation=this.getRelativeValue(n,o,a,l.rotation,l.data.rotation))}}class _y extends ff{constructor(t,s,n){super(t,s,ht.x+"|"+n,ht.y+"|"+n);A(this,"boneIndex",0);this.boneIndex=n}apply(t,s,n,r,o,a,h){let l=t.bones[this.boneIndex];if(!l.active)return;let c=this.frames;if(n<c[0]){switch(a){case we.setup:l.x=l.data.x,l.y=l.data.y;return;case we.first:l.x+=(l.data.x-l.x)*o,l.y+=(l.data.y-l.y)*o}return}let u=0,f=0,d=Xt.search(c,n,3),m=this.curves[d/3];switch(m){case 0:let g=c[d];u=c[d+1],f=c[d+2];let b=(n-g)/(c[d+3]-g);u+=(c[d+3+1]-u)*b,f+=(c[d+3+2]-f)*b;break;case 1:u=c[d+1],f=c[d+2];break;default:u=this.getBezierValue(n,d,1,m-2),f=this.getBezierValue(n,d,2,m+18-2)}switch(a){case we.setup:l.x=l.data.x+u*o,l.y=l.data.y+f*o;break;case we.first:case we.replace:l.x+=(l.data.x+u-l.x)*o,l.y+=(l.data.y+f-l.y)*o;break;case we.add:l.x+=u*o,l.y+=f*o}}}class Sy extends ys{constructor(t,s,n){super(t,s,ht.x+"|"+n);A(this,"boneIndex",0);this.boneIndex=n}apply(t,s,n,r,o,a,h){let l=t.bones[this.boneIndex];l.active&&(l.x=this.getRelativeValue(n,o,a,l.x,l.data.x))}}class Ty extends ys{constructor(t,s,n){super(t,s,ht.y+"|"+n);A(this,"boneIndex",0);this.boneIndex=n}apply(t,s,n,r,o,a,h){let l=t.bones[this.boneIndex];l.active&&(l.y=this.getRelativeValue(n,o,a,l.y,l.data.y))}}class My extends ff{constructor(t,s,n){super(t,s,ht.scaleX+"|"+n,ht.scaleY+"|"+n);A(this,"boneIndex",0);this.boneIndex=n}apply(t,s,n,r,o,a,h){let l=t.bones[this.boneIndex];if(!l.active)return;let c=this.frames;if(n<c[0]){switch(a){case we.setup:l.scaleX=l.data.scaleX,l.scaleY=l.data.scaleY;return;case we.first:l.scaleX+=(l.data.scaleX-l.scaleX)*o,l.scaleY+=(l.data.scaleY-l.scaleY)*o}return}let u,f,d=Xt.search(c,n,3),m=this.curves[d/3];switch(m){case 0:let g=c[d];u=c[d+1],f=c[d+2];let b=(n-g)/(c[d+3]-g);u+=(c[d+3+1]-u)*b,f+=(c[d+3+2]-f)*b;break;case 1:u=c[d+1],f=c[d+2];break;default:u=this.getBezierValue(n,d,1,m-2),f=this.getBezierValue(n,d,2,m+18-2)}if(u*=l.data.scaleX,f*=l.data.scaleY,o==1)a==we.add?(l.scaleX+=u-l.data.scaleX,l.scaleY+=f-l.data.scaleY):(l.scaleX=u,l.scaleY=f);else{let g=0,b=0;if(h==xi.mixOut)switch(a){case we.setup:g=l.data.scaleX,b=l.data.scaleY,l.scaleX=g+(Math.abs(u)*ke.signum(g)-g)*o,l.scaleY=b+(Math.abs(f)*ke.signum(b)-b)*o;break;case we.first:case we.replace:g=l.scaleX,b=l.scaleY,l.scaleX=g+(Math.abs(u)*ke.signum(g)-g)*o,l.scaleY=b+(Math.abs(f)*ke.signum(b)-b)*o;break;case we.add:l.scaleX+=(u-l.data.scaleX)*o,l.scaleY+=(f-l.data.scaleY)*o}else switch(a){case we.setup:g=Math.abs(l.data.scaleX)*ke.signum(u),b=Math.abs(l.data.scaleY)*ke.signum(f),l.scaleX=g+(u-g)*o,l.scaleY=b+(f-b)*o;break;case we.first:case we.replace:g=Math.abs(l.scaleX)*ke.signum(u),b=Math.abs(l.scaleY)*ke.signum(f),l.scaleX=g+(u-g)*o,l.scaleY=b+(f-b)*o;break;case we.add:l.scaleX+=(u-l.data.scaleX)*o,l.scaleY+=(f-l.data.scaleY)*o}}}}class Ey extends ys{constructor(t,s,n){super(t,s,ht.scaleX+"|"+n);A(this,"boneIndex",0);this.boneIndex=n}apply(t,s,n,r,o,a,h){let l=t.bones[this.boneIndex];l.active&&(l.scaleX=this.getScaleValue(n,o,a,h,l.scaleX,l.data.scaleX))}}class Ay extends ys{constructor(t,s,n){super(t,s,ht.scaleY+"|"+n);A(this,"boneIndex",0);this.boneIndex=n}apply(t,s,n,r,o,a,h){let l=t.bones[this.boneIndex];l.active&&(l.scaleY=this.getScaleValue(n,o,a,h,l.scaleY,l.data.scaleY))}}class Cy extends ff{constructor(t,s,n){super(t,s,ht.shearX+"|"+n,ht.shearY+"|"+n);A(this,"boneIndex",0);this.boneIndex=n}apply(t,s,n,r,o,a,h){let l=t.bones[this.boneIndex];if(!l.active)return;let c=this.frames;if(n<c[0]){switch(a){case we.setup:l.shearX=l.data.shearX,l.shearY=l.data.shearY;return;case we.first:l.shearX+=(l.data.shearX-l.shearX)*o,l.shearY+=(l.data.shearY-l.shearY)*o}return}let u=0,f=0,d=Xt.search(c,n,3),m=this.curves[d/3];switch(m){case 0:let g=c[d];u=c[d+1],f=c[d+2];let b=(n-g)/(c[d+3]-g);u+=(c[d+3+1]-u)*b,f+=(c[d+3+2]-f)*b;break;case 1:u=c[d+1],f=c[d+2];break;default:u=this.getBezierValue(n,d,1,m-2),f=this.getBezierValue(n,d,2,m+18-2)}switch(a){case we.setup:l.shearX=l.data.shearX+u*o,l.shearY=l.data.shearY+f*o;break;case we.first:case we.replace:l.shearX+=(l.data.shearX+u-l.shearX)*o,l.shearY+=(l.data.shearY+f-l.shearY)*o;break;case we.add:l.shearX+=u*o,l.shearY+=f*o}}}class Iy extends ys{constructor(t,s,n){super(t,s,ht.shearX+"|"+n);A(this,"boneIndex",0);this.boneIndex=n}apply(t,s,n,r,o,a,h){let l=t.bones[this.boneIndex];l.active&&(l.shearX=this.getRelativeValue(n,o,a,l.shearX,l.data.shearX))}}class Ry extends ys{constructor(t,s,n){super(t,s,ht.shearY+"|"+n);A(this,"boneIndex",0);this.boneIndex=n}apply(t,s,n,r,o,a,h){let l=t.bones[this.boneIndex];l.active&&(l.shearY=this.getRelativeValue(n,o,a,l.shearY,l.data.shearY))}}class Py extends Xt{constructor(t,s){super(t,[ht.inherit+"|"+s]);A(this,"boneIndex",0);this.boneIndex=s}getFrameEntries(){return 2}setFrame(t,s,n){t*=2,this.frames[t]=s,this.frames[t+1]=n}apply(t,s,n,r,o,a,h){let l=t.bones[this.boneIndex];if(!l.active)return;if(h==xi.mixOut){a==we.setup&&(l.inherit=l.data.inherit);return}let c=this.frames;if(n<c[0]){(a==we.setup||a==we.first)&&(l.inherit=l.data.inherit);return}l.inherit=this.frames[Xt.search(c,n,2)+1]}}class ky extends qs{constructor(t,s,n){super(t,s,[ht.rgb+"|"+n,ht.alpha+"|"+n]);A(this,"slotIndex",0);this.slotIndex=n}getFrameEntries(){return 5}setFrame(t,s,n,r,o,a){t*=5,this.frames[t]=s,this.frames[t+1]=n,this.frames[t+2]=r,this.frames[t+3]=o,this.frames[t+4]=a}apply(t,s,n,r,o,a,h){let l=t.slots[this.slotIndex];if(!l.bone.active)return;let c=this.frames,u=l.color;if(n<c[0]){let M=l.data.color;switch(a){case we.setup:u.setFromColor(M);return;case we.first:u.add((M.r-u.r)*o,(M.g-u.g)*o,(M.b-u.b)*o,(M.a-u.a)*o)}return}let f=0,d=0,m=0,g=0,b=Xt.search(c,n,5),_=this.curves[b/5];switch(_){case 0:let M=c[b];f=c[b+1],d=c[b+2],m=c[b+3],g=c[b+4];let v=(n-M)/(c[b+5]-M);f+=(c[b+5+1]-f)*v,d+=(c[b+5+2]-d)*v,m+=(c[b+5+3]-m)*v,g+=(c[b+5+4]-g)*v;break;case 1:f=c[b+1],d=c[b+2],m=c[b+3],g=c[b+4];break;default:f=this.getBezierValue(n,b,1,_-2),d=this.getBezierValue(n,b,2,_+18-2),m=this.getBezierValue(n,b,3,_+36-2),g=this.getBezierValue(n,b,4,_+54-2)}o==1?u.set(f,d,m,g):(a==we.setup&&u.setFromColor(l.data.color),u.add((f-u.r)*o,(d-u.g)*o,(m-u.b)*o,(g-u.a)*o))}}class Fy extends qs{constructor(t,s,n){super(t,s,[ht.rgb+"|"+n]);A(this,"slotIndex",0);this.slotIndex=n}getFrameEntries(){return 4}setFrame(t,s,n,r,o){t<<=2,this.frames[t]=s,this.frames[t+1]=n,this.frames[t+2]=r,this.frames[t+3]=o}apply(t,s,n,r,o,a,h){let l=t.slots[this.slotIndex];if(!l.bone.active)return;let c=this.frames,u=l.color;if(n<c[0]){let _=l.data.color;switch(a){case we.setup:u.r=_.r,u.g=_.g,u.b=_.b;return;case we.first:u.r+=(_.r-u.r)*o,u.g+=(_.g-u.g)*o,u.b+=(_.b-u.b)*o}return}let f=0,d=0,m=0,g=Xt.search(c,n,4),b=this.curves[g>>2];switch(b){case 0:let _=c[g];f=c[g+1],d=c[g+2],m=c[g+3];let M=(n-_)/(c[g+4]-_);f+=(c[g+4+1]-f)*M,d+=(c[g+4+2]-d)*M,m+=(c[g+4+3]-m)*M;break;case 1:f=c[g+1],d=c[g+2],m=c[g+3];break;default:f=this.getBezierValue(n,g,1,b-2),d=this.getBezierValue(n,g,2,b+18-2),m=this.getBezierValue(n,g,3,b+36-2)}if(o==1)u.r=f,u.g=d,u.b=m;else{if(a==we.setup){let _=l.data.color;u.r=_.r,u.g=_.g,u.b=_.b}u.r+=(f-u.r)*o,u.g+=(d-u.g)*o,u.b+=(m-u.b)*o}}}class Oy extends ys{constructor(t,s,n){super(t,s,ht.alpha+"|"+n);A(this,"slotIndex",0);this.slotIndex=n}apply(t,s,n,r,o,a,h){let l=t.slots[this.slotIndex];if(!l.bone.active)return;let c=l.color;if(n<this.frames[0]){let f=l.data.color;switch(a){case we.setup:c.a=f.a;return;case we.first:c.a+=(f.a-c.a)*o}return}let u=this.getCurveValue(n);o==1?c.a=u:(a==we.setup&&(c.a=l.data.color.a),c.a+=(u-c.a)*o)}}class By extends qs{constructor(t,s,n){super(t,s,[ht.rgb+"|"+n,ht.alpha+"|"+n,ht.rgb2+"|"+n]);A(this,"slotIndex",0);this.slotIndex=n}getFrameEntries(){return 8}setFrame(t,s,n,r,o,a,h,l,c){t<<=3,this.frames[t]=s,this.frames[t+1]=n,this.frames[t+2]=r,this.frames[t+3]=o,this.frames[t+4]=a,this.frames[t+5]=h,this.frames[t+6]=l,this.frames[t+7]=c}apply(t,s,n,r,o,a,h){let l=t.slots[this.slotIndex];if(!l.bone.active)return;let c=this.frames,u=l.color,f=l.darkColor;if(n<c[0]){let I=l.data.color,E=l.data.darkColor;switch(a){case we.setup:u.setFromColor(I),f.r=E.r,f.g=E.g,f.b=E.b;return;case we.first:u.add((I.r-u.r)*o,(I.g-u.g)*o,(I.b-u.b)*o,(I.a-u.a)*o),f.r+=(E.r-f.r)*o,f.g+=(E.g-f.g)*o,f.b+=(E.b-f.b)*o}return}let d=0,m=0,g=0,b=0,_=0,M=0,v=0,S=Xt.search(c,n,8),y=this.curves[S>>3];switch(y){case 0:let I=c[S];d=c[S+1],m=c[S+2],g=c[S+3],b=c[S+4],_=c[S+5],M=c[S+6],v=c[S+7];let E=(n-I)/(c[S+8]-I);d+=(c[S+8+1]-d)*E,m+=(c[S+8+2]-m)*E,g+=(c[S+8+3]-g)*E,b+=(c[S+8+4]-b)*E,_+=(c[S+8+5]-_)*E,M+=(c[S+8+6]-M)*E,v+=(c[S+8+7]-v)*E;break;case 1:d=c[S+1],m=c[S+2],g=c[S+3],b=c[S+4],_=c[S+5],M=c[S+6],v=c[S+7];break;default:d=this.getBezierValue(n,S,1,y-2),m=this.getBezierValue(n,S,2,y+18-2),g=this.getBezierValue(n,S,3,y+36-2),b=this.getBezierValue(n,S,4,y+54-2),_=this.getBezierValue(n,S,5,y+72-2),M=this.getBezierValue(n,S,6,y+90-2),v=this.getBezierValue(n,S,7,y+108-2)}if(o==1)u.set(d,m,g,b),f.r=_,f.g=M,f.b=v;else{if(a==we.setup){u.setFromColor(l.data.color);let I=l.data.darkColor;f.r=I.r,f.g=I.g,f.b=I.b}u.add((d-u.r)*o,(m-u.g)*o,(g-u.b)*o,(b-u.a)*o),f.r+=(_-f.r)*o,f.g+=(M-f.g)*o,f.b+=(v-f.b)*o}}}class Ly extends qs{constructor(t,s,n){super(t,s,[ht.rgb+"|"+n,ht.rgb2+"|"+n]);A(this,"slotIndex",0);this.slotIndex=n}getFrameEntries(){return 7}setFrame(t,s,n,r,o,a,h,l){t*=7,this.frames[t]=s,this.frames[t+1]=n,this.frames[t+2]=r,this.frames[t+3]=o,this.frames[t+4]=a,this.frames[t+5]=h,this.frames[t+6]=l}apply(t,s,n,r,o,a,h){let l=t.slots[this.slotIndex];if(!l.bone.active)return;let c=this.frames,u=l.color,f=l.darkColor;if(n<c[0]){let y=l.data.color,I=l.data.darkColor;switch(a){case we.setup:u.r=y.r,u.g=y.g,u.b=y.b,f.r=I.r,f.g=I.g,f.b=I.b;return;case we.first:u.r+=(y.r-u.r)*o,u.g+=(y.g-u.g)*o,u.b+=(y.b-u.b)*o,f.r+=(I.r-f.r)*o,f.g+=(I.g-f.g)*o,f.b+=(I.b-f.b)*o}return}let d=0,m=0,g=0,b=0,_=0,M=0,v=Xt.search(c,n,7),S=this.curves[v/7];switch(S){case 0:let y=c[v];d=c[v+1],m=c[v+2],g=c[v+3],b=c[v+4],_=c[v+5],M=c[v+6];let I=(n-y)/(c[v+7]-y);d+=(c[v+7+1]-d)*I,m+=(c[v+7+2]-m)*I,g+=(c[v+7+3]-g)*I,b+=(c[v+7+4]-b)*I,_+=(c[v+7+5]-_)*I,M+=(c[v+7+6]-M)*I;break;case 1:d=c[v+1],m=c[v+2],g=c[v+3],b=c[v+4],_=c[v+5],M=c[v+6];break;default:d=this.getBezierValue(n,v,1,S-2),m=this.getBezierValue(n,v,2,S+18-2),g=this.getBezierValue(n,v,3,S+36-2),b=this.getBezierValue(n,v,4,S+54-2),_=this.getBezierValue(n,v,5,S+72-2),M=this.getBezierValue(n,v,6,S+90-2)}if(o==1)u.r=d,u.g=m,u.b=g,f.r=b,f.g=_,f.b=M;else{if(a==we.setup){let y=l.data.color,I=l.data.darkColor;u.r=y.r,u.g=y.g,u.b=y.b,f.r=I.r,f.g=I.g,f.b=I.b}u.r+=(d-u.r)*o,u.g+=(m-u.g)*o,u.b+=(g-u.b)*o,f.r+=(b-f.r)*o,f.g+=(_-f.g)*o,f.b+=(M-f.b)*o}}}class Jr extends Xt{constructor(t,s){super(t,[ht.attachment+"|"+s]);A(this,"slotIndex",0);A(this,"attachmentNames");this.slotIndex=s,this.attachmentNames=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,s,n){this.frames[t]=s,this.attachmentNames[t]=n}apply(t,s,n,r,o,a,h){let l=t.slots[this.slotIndex];if(l.bone.active){if(h==xi.mixOut){a==we.setup&&this.setAttachment(t,l,l.data.attachmentName);return}if(n<this.frames[0]){(a==we.setup||a==we.first)&&this.setAttachment(t,l,l.data.attachmentName);return}this.setAttachment(t,l,this.attachmentNames[Xt.search1(this.frames,n)])}}setAttachment(t,s,n){s.setAttachment(n?t.getAttachment(this.slotIndex,n):null)}}class Dy extends qs{constructor(t,s,n,r){super(t,s,[ht.deform+"|"+n+"|"+r.id]);A(this,"slotIndex",0);A(this,"attachment");A(this,"vertices");this.slotIndex=n,this.attachment=r,this.vertices=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,s,n){this.frames[t]=s,this.vertices[t]=n}setBezier(t,s,n,r,o,a,h,l,c,u,f){let d=this.curves,m=this.getFrameCount()+t*18;n==0&&(d[s]=2+m);let g=(r-a*2+l)*.03,b=c*.03-h*.06,_=((a-l)*3-r+u)*.006,M=(h-c+.33333333)*.018,v=g*2+_,S=b*2+M,y=(a-r)*.3+g+_*.16666667,I=h*.3+b+M*.16666667,E=r+y,C=I;for(let R=m+18;m<R;m+=2)d[m]=E,d[m+1]=C,y+=v,I+=S,v+=_,S+=M,E+=y,C+=I}getCurvePercent(t,s){let n=this.curves,r=n[s];switch(r){case 0:let l=this.frames[s];return(t-l)/(this.frames[s+this.getFrameEntries()]-l);case 1:return 0}if(r-=2,n[r]>t){let l=this.frames[s];return n[r+1]*(t-l)/(n[r]-l)}let o=r+18;for(r+=2;r<o;r+=2)if(n[r]>=t){let l=n[r-2],c=n[r-1];return c+(t-l)/(n[r]-l)*(n[r+1]-c)}let a=n[o-2],h=n[o-1];return h+(1-h)*(t-a)/(this.frames[s+this.getFrameEntries()]-a)}apply(t,s,n,r,o,a,h){let l=t.slots[this.slotIndex];if(!l.bone.active)return;let c=l.getAttachment();if(!c||!(c instanceof vs)||c.timelineAttachment!=this.attachment)return;let u=l.deform;u.length==0&&(a=we.setup);let f=this.vertices,d=f[0].length,m=this.frames;if(n<m[0]){switch(a){case we.setup:u.length=0;return;case we.first:if(o==1){u.length=0;return}u.length=d;let S=c;if(S.bones){o=1-o;for(var g=0;g<d;g++)u[g]*=o}else{let y=S.vertices;for(var g=0;g<d;g++)u[g]+=(y[g]-u[g])*o}}return}if(u.length=d,n>=m[m.length-1]){let S=f[m.length-1];if(o==1)if(a==we.add){let y=c;if(y.bones)for(let I=0;I<d;I++)u[I]+=S[I];else{let I=y.vertices;for(let E=0;E<d;E++)u[E]+=S[E]-I[E]}}else Fe.arrayCopy(S,0,u,0,d);else switch(a){case we.setup:{let I=c;if(I.bones)for(let E=0;E<d;E++)u[E]=S[E]*o;else{let E=I.vertices;for(let C=0;C<d;C++){let R=E[C];u[C]=R+(S[C]-R)*o}}break}case we.first:case we.replace:for(let I=0;I<d;I++)u[I]+=(S[I]-u[I])*o;break;case we.add:let y=c;if(y.bones)for(let I=0;I<d;I++)u[I]+=S[I]*o;else{let I=y.vertices;for(let E=0;E<d;E++)u[E]+=(S[E]-I[E])*o}}return}let b=Xt.search1(m,n),_=this.getCurvePercent(n,b),M=f[b],v=f[b+1];if(o==1)if(a==we.add){let S=c;if(S.bones)for(let y=0;y<d;y++){let I=M[y];u[y]+=I+(v[y]-I)*_}else{let y=S.vertices;for(let I=0;I<d;I++){let E=M[I];u[I]+=E+(v[I]-E)*_-y[I]}}}else for(let S=0;S<d;S++){let y=M[S];u[S]=y+(v[S]-y)*_}else switch(a){case we.setup:{let y=c;if(y.bones)for(let I=0;I<d;I++){let E=M[I];u[I]=(E+(v[I]-E)*_)*o}else{let I=y.vertices;for(let E=0;E<d;E++){let C=M[E],R=I[E];u[E]=R+(C+(v[E]-C)*_-R)*o}}break}case we.first:case we.replace:for(let y=0;y<d;y++){let I=M[y];u[y]+=(I+(v[y]-I)*_-u[y])*o}break;case we.add:let S=c;if(S.bones)for(let y=0;y<d;y++){let I=M[y];u[y]+=(I+(v[y]-I)*_)*o}else{let y=S.vertices;for(let I=0;I<d;I++){let E=M[I];u[I]+=(E+(v[I]-E)*_-y[I])*o}}}}}const lh=class lh extends Xt{constructor(t){super(t,lh.propertyIds);A(this,"events");this.events=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,s){this.frames[t]=s.time,this.events[t]=s}apply(t,s,n,r,o,a,h){if(!r)return;let l=this.frames,c=this.frames.length;if(s>n)this.apply(t,s,Number.MAX_VALUE,r,o,a,h),s=-1;else if(s>=l[c-1])return;if(n<l[0])return;let u=0;if(s<l[0])u=0;else{u=Xt.search1(l,s)+1;let f=l[u];for(;u>0&&l[u-1]==f;)u--}for(;u<c&&n>=l[u];u++)r.push(this.events[u])}};A(lh,"propertyIds",[""+ht.event]);let va=lh;const hh=class hh extends Xt{constructor(t){super(t,hh.propertyIds);A(this,"drawOrders");this.drawOrders=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,s,n){this.frames[t]=s,this.drawOrders[t]=n}apply(t,s,n,r,o,a,h){if(h==xi.mixOut){a==we.setup&&Fe.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);return}if(n<this.frames[0]){(a==we.setup||a==we.first)&&Fe.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);return}let l=Xt.search1(this.frames,n),c=this.drawOrders[l];if(!c)Fe.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);else{let u=t.drawOrder,f=t.slots;for(let d=0,m=c.length;d<m;d++)u[d]=f[c[d]]}}};A(hh,"propertyIds",[""+ht.drawOrder]);let br=hh;class Ny extends qs{constructor(t,s,n){super(t,s,[ht.ikConstraint+"|"+n]);A(this,"constraintIndex",0);this.constraintIndex=n}getFrameEntries(){return 6}setFrame(t,s,n,r,o,a,h){t*=6,this.frames[t]=s,this.frames[t+1]=n,this.frames[t+2]=r,this.frames[t+3]=o,this.frames[t+4]=a?1:0,this.frames[t+5]=h?1:0}apply(t,s,n,r,o,a,h){let l=t.ikConstraints[this.constraintIndex];if(!l.active)return;let c=this.frames;if(n<c[0]){switch(a){case we.setup:l.mix=l.data.mix,l.softness=l.data.softness,l.bendDirection=l.data.bendDirection,l.compress=l.data.compress,l.stretch=l.data.stretch;return;case we.first:l.mix+=(l.data.mix-l.mix)*o,l.softness+=(l.data.softness-l.softness)*o,l.bendDirection=l.data.bendDirection,l.compress=l.data.compress,l.stretch=l.data.stretch}return}let u=0,f=0,d=Xt.search(c,n,6),m=this.curves[d/6];switch(m){case 0:let g=c[d];u=c[d+1],f=c[d+2];let b=(n-g)/(c[d+6]-g);u+=(c[d+6+1]-u)*b,f+=(c[d+6+2]-f)*b;break;case 1:u=c[d+1],f=c[d+2];break;default:u=this.getBezierValue(n,d,1,m-2),f=this.getBezierValue(n,d,2,m+18-2)}a==we.setup?(l.mix=l.data.mix+(u-l.data.mix)*o,l.softness=l.data.softness+(f-l.data.softness)*o,h==xi.mixOut?(l.bendDirection=l.data.bendDirection,l.compress=l.data.compress,l.stretch=l.data.stretch):(l.bendDirection=c[d+3],l.compress=c[d+4]!=0,l.stretch=c[d+5]!=0)):(l.mix+=(u-l.mix)*o,l.softness+=(f-l.softness)*o,h==xi.mixIn&&(l.bendDirection=c[d+3],l.compress=c[d+4]!=0,l.stretch=c[d+5]!=0))}}class Uy extends qs{constructor(t,s,n){super(t,s,[ht.transformConstraint+"|"+n]);A(this,"constraintIndex",0);this.constraintIndex=n}getFrameEntries(){return 7}setFrame(t,s,n,r,o,a,h,l){let c=this.frames;t*=7,c[t]=s,c[t+1]=n,c[t+2]=r,c[t+3]=o,c[t+4]=a,c[t+5]=h,c[t+6]=l}apply(t,s,n,r,o,a,h){let l=t.transformConstraints[this.constraintIndex];if(!l.active)return;let c=this.frames;if(n<c[0]){let v=l.data;switch(a){case we.setup:l.mixRotate=v.mixRotate,l.mixX=v.mixX,l.mixY=v.mixY,l.mixScaleX=v.mixScaleX,l.mixScaleY=v.mixScaleY,l.mixShearY=v.mixShearY;return;case we.first:l.mixRotate+=(v.mixRotate-l.mixRotate)*o,l.mixX+=(v.mixX-l.mixX)*o,l.mixY+=(v.mixY-l.mixY)*o,l.mixScaleX+=(v.mixScaleX-l.mixScaleX)*o,l.mixScaleY+=(v.mixScaleY-l.mixScaleY)*o,l.mixShearY+=(v.mixShearY-l.mixShearY)*o}return}let u,f,d,m,g,b,_=Xt.search(c,n,7),M=this.curves[_/7];switch(M){case 0:let v=c[_];u=c[_+1],f=c[_+2],d=c[_+3],m=c[_+4],g=c[_+5],b=c[_+6];let S=(n-v)/(c[_+7]-v);u+=(c[_+7+1]-u)*S,f+=(c[_+7+2]-f)*S,d+=(c[_+7+3]-d)*S,m+=(c[_+7+4]-m)*S,g+=(c[_+7+5]-g)*S,b+=(c[_+7+6]-b)*S;break;case 1:u=c[_+1],f=c[_+2],d=c[_+3],m=c[_+4],g=c[_+5],b=c[_+6];break;default:u=this.getBezierValue(n,_,1,M-2),f=this.getBezierValue(n,_,2,M+18-2),d=this.getBezierValue(n,_,3,M+36-2),m=this.getBezierValue(n,_,4,M+54-2),g=this.getBezierValue(n,_,5,M+72-2),b=this.getBezierValue(n,_,6,M+90-2)}if(a==we.setup){let v=l.data;l.mixRotate=v.mixRotate+(u-v.mixRotate)*o,l.mixX=v.mixX+(f-v.mixX)*o,l.mixY=v.mixY+(d-v.mixY)*o,l.mixScaleX=v.mixScaleX+(m-v.mixScaleX)*o,l.mixScaleY=v.mixScaleY+(g-v.mixScaleY)*o,l.mixShearY=v.mixShearY+(b-v.mixShearY)*o}else l.mixRotate+=(u-l.mixRotate)*o,l.mixX+=(f-l.mixX)*o,l.mixY+=(d-l.mixY)*o,l.mixScaleX+=(m-l.mixScaleX)*o,l.mixScaleY+=(g-l.mixScaleY)*o,l.mixShearY+=(b-l.mixShearY)*o}}class Vy extends ys{constructor(t,s,n){super(t,s,ht.pathConstraintPosition+"|"+n);A(this,"constraintIndex",0);this.constraintIndex=n}apply(t,s,n,r,o,a,h){let l=t.pathConstraints[this.constraintIndex];l.active&&(l.position=this.getAbsoluteValue(n,o,a,l.position,l.data.position))}}class Xy extends ys{constructor(t,s,n){super(t,s,ht.pathConstraintSpacing+"|"+n);A(this,"constraintIndex",0);this.constraintIndex=n}apply(t,s,n,r,o,a,h){let l=t.pathConstraints[this.constraintIndex];l.active&&(l.spacing=this.getAbsoluteValue(n,o,a,l.spacing,l.data.spacing))}}class Yy extends qs{constructor(t,s,n){super(t,s,[ht.pathConstraintMix+"|"+n]);A(this,"constraintIndex",0);this.constraintIndex=n}getFrameEntries(){return 4}setFrame(t,s,n,r,o){let a=this.frames;t<<=2,a[t]=s,a[t+1]=n,a[t+2]=r,a[t+3]=o}apply(t,s,n,r,o,a,h){let l=t.pathConstraints[this.constraintIndex];if(!l.active)return;let c=this.frames;if(n<c[0]){switch(a){case we.setup:l.mixRotate=l.data.mixRotate,l.mixX=l.data.mixX,l.mixY=l.data.mixY;return;case we.first:l.mixRotate+=(l.data.mixRotate-l.mixRotate)*o,l.mixX+=(l.data.mixX-l.mixX)*o,l.mixY+=(l.data.mixY-l.mixY)*o}return}let u,f,d,m=Xt.search(c,n,4),g=this.curves[m>>2];switch(g){case 0:let b=c[m];u=c[m+1],f=c[m+2],d=c[m+3];let _=(n-b)/(c[m+4]-b);u+=(c[m+4+1]-u)*_,f+=(c[m+4+2]-f)*_,d+=(c[m+4+3]-d)*_;break;case 1:u=c[m+1],f=c[m+2],d=c[m+3];break;default:u=this.getBezierValue(n,m,1,g-2),f=this.getBezierValue(n,m,2,g+18-2),d=this.getBezierValue(n,m,3,g+36-2)}if(a==we.setup){let b=l.data;l.mixRotate=b.mixRotate+(u-b.mixRotate)*o,l.mixX=b.mixX+(f-b.mixX)*o,l.mixY=b.mixY+(d-b.mixY)*o}else l.mixRotate+=(u-l.mixRotate)*o,l.mixX+=(f-l.mixX)*o,l.mixY+=(d-l.mixY)*o}}class Rr extends ys{constructor(t,s,n,r){super(t,s,r+"|"+n);A(this,"constraintIndex",0);this.constraintIndex=n}apply(t,s,n,r,o,a,h){let l;if(this.constraintIndex==-1){const c=n>=this.frames[0]?this.getCurveValue(n):0;for(const u of t.physicsConstraints)u.active&&this.global(u.data)&&this.set(u,this.getAbsoluteValue2(n,o,a,this.get(u),this.setup(u),c))}else l=t.physicsConstraints[this.constraintIndex],l.active&&this.set(l,this.getAbsoluteValue(n,o,a,this.get(l),this.setup(l)))}}class $y extends Rr{constructor(e,t,s){super(e,t,s,ht.physicsConstraintInertia)}setup(e){return e.data.inertia}get(e){return e.inertia}set(e,t){e.inertia=t}global(e){return e.inertiaGlobal}}class Gy extends Rr{constructor(e,t,s){super(e,t,s,ht.physicsConstraintStrength)}setup(e){return e.data.strength}get(e){return e.strength}set(e,t){e.strength=t}global(e){return e.strengthGlobal}}class jy extends Rr{constructor(e,t,s){super(e,t,s,ht.physicsConstraintDamping)}setup(e){return e.data.damping}get(e){return e.damping}set(e,t){e.damping=t}global(e){return e.dampingGlobal}}class Hy extends Rr{constructor(e,t,s){super(e,t,s,ht.physicsConstraintMass)}setup(e){return 1/e.data.massInverse}get(e){return 1/e.massInverse}set(e,t){e.massInverse=1/t}global(e){return e.massGlobal}}class Wy extends Rr{constructor(e,t,s){super(e,t,s,ht.physicsConstraintWind)}setup(e){return e.data.wind}get(e){return e.wind}set(e,t){e.wind=t}global(e){return e.windGlobal}}class zy extends Rr{constructor(e,t,s){super(e,t,s,ht.physicsConstraintGravity)}setup(e){return e.data.gravity}get(e){return e.gravity}set(e,t){e.gravity=t}global(e){return e.gravityGlobal}}class qy extends Rr{constructor(e,t,s){super(e,t,s,ht.physicsConstraintMix)}setup(e){return e.data.mix}get(e){return e.mix}set(e,t){e.mix=t}global(e){return e.mixGlobal}}const ch=class ch extends Xt{constructor(t,s){super(t,ch.propertyIds);A(this,"constraintIndex");this.constraintIndex=s}getFrameCount(){return this.frames.length}setFrame(t,s){this.frames[t]=s}apply(t,s,n,r,o,a,h){let l;if(this.constraintIndex!=-1&&(l=t.physicsConstraints[this.constraintIndex],!l.active))return;const c=this.frames;if(s>n)this.apply(t,s,Number.MAX_VALUE,[],o,a,h),s=-1;else if(s>=c[c.length-1])return;if(!(n<c[0])&&(s<c[0]||n>=c[Xt.search1(c,s)+1]))if(l!=null)l.reset();else for(const u of t.physicsConstraints)u.active&&u.reset()}};A(ch,"propertyIds",[ht.physicsConstraintReset.toString()]);let Jl=ch;const ji=class ji extends Xt{constructor(t,s,n){super(t,[ht.sequence+"|"+s+"|"+n.sequence.id]);A(this,"slotIndex");A(this,"attachment");this.slotIndex=s,this.attachment=n}getFrameEntries(){return ji.ENTRIES}getSlotIndex(){return this.slotIndex}getAttachment(){return this.attachment}setFrame(t,s,n,r,o){let a=this.frames;t*=ji.ENTRIES,a[t]=s,a[t+ji.MODE]=n|r<<4,a[t+ji.DELAY]=o}apply(t,s,n,r,o,a,h){let l=t.slots[this.slotIndex];if(!l.bone.active)return;let c=l.attachment,u=this.attachment;if(c!=u&&(!(c instanceof vs)||c.timelineAttachment!=u))return;if(h==xi.mixOut){a==we.setup&&(l.sequenceIndex=-1);return}let f=this.frames;if(n<f[0]){(a==we.setup||a==we.first)&&(l.sequenceIndex=-1);return}let d=Xt.search(f,n,ji.ENTRIES),m=f[d],g=f[d+ji.MODE],b=f[d+ji.DELAY];if(!this.attachment.sequence)return;let _=g>>4,M=this.attachment.sequence.regions.length,v=wy[g&15];if(v!=fi.hold)switch(_+=(n-m)/b+1e-5|0,v){case fi.once:_=Math.min(M-1,_);break;case fi.loop:_%=M;break;case fi.pingpong:{let S=(M<<1)-2;_=S==0?0:_%S,_>=M&&(_=S-_);break}case fi.onceReverse:_=Math.max(M-1-_,0);break;case fi.loopReverse:_=M-1-_%M;break;case fi.pingpongReverse:{let S=(M<<1)-2;_=S==0?0:(_+M-1)%S,_>=M&&(_=S-_)}}l.sequenceIndex=_}};A(ji,"ENTRIES",3),A(ji,"MODE",1),A(ji,"DELAY",2);let Ql=ji;const eo=class eo{constructor(e){A(this,"data");A(this,"tracks",new Array);A(this,"timeScale",1);A(this,"unkeyedState",0);A(this,"events",new Array);A(this,"listeners",new Array);A(this,"queue",new BE(this));A(this,"propertyIDs",new xy);A(this,"animationsChanged",!1);A(this,"trackEntryPool",new zl(()=>new OE));this.data=e}static emptyAnimation(){return eo._emptyAnimation}update(e){e*=this.timeScale;let t=this.tracks;for(let s=0,n=t.length;s<n;s++){let r=t[s];if(!r)continue;r.animationLast=r.nextAnimationLast,r.trackLast=r.nextTrackLast;let o=e*r.timeScale;if(r.delay>0){if(r.delay-=o,r.delay>0)continue;o=-r.delay,r.delay=0}let a=r.next;if(a){let h=r.trackLast-a.delay;if(h>=0){for(a.delay=0,a.trackTime+=r.timeScale==0?0:(h/r.timeScale+e)*a.timeScale,r.trackTime+=o,this.setCurrent(s,a,!0);a.mixingFrom;)a.mixTime+=e,a=a.mixingFrom;continue}}else if(r.trackLast>=r.trackEnd&&!r.mixingFrom){t[s]=null,this.queue.end(r),this.clearNext(r);continue}if(r.mixingFrom&&this.updateMixingFrom(r,e)){let h=r.mixingFrom;for(r.mixingFrom=null,h&&(h.mixingTo=null);h;)this.queue.end(h),h=h.mixingFrom}r.trackTime+=o}this.queue.drain()}updateMixingFrom(e,t){let s=e.mixingFrom;if(!s)return!0;let n=this.updateMixingFrom(s,t);return s.animationLast=s.nextAnimationLast,s.trackLast=s.nextTrackLast,e.nextTrackLast!=-1&&e.mixTime>=e.mixDuration?((s.totalAlpha==0||e.mixDuration==0)&&(e.mixingFrom=s.mixingFrom,s.mixingFrom!=null&&(s.mixingFrom.mixingTo=e),e.interruptAlpha=s.interruptAlpha,this.queue.end(s)),n):(s.trackTime+=t*s.timeScale,e.mixTime+=t,!1)}apply(e){if(!e)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();let t=this.events,s=this.tracks,n=!1;for(let f=0,d=s.length;f<d;f++){let m=s[f];if(!m||m.delay>0)continue;n=!0;let g=f==0?we.first:m.mixBlend,b=m.alpha;m.mixingFrom?b*=this.applyMixingFrom(m,e,g):m.trackTime>=m.trackEnd&&!m.next&&(b=0);let _=b>=m.alphaAttachmentThreshold,M=m.animationLast,v=m.getAnimationTime(),S=v,y=t;m.reverse&&(S=m.animation.duration-S,y=null);let I=m.animation.timelines,E=I.length;if(f==0&&b==1||g==we.add){f==0&&(_=!0);for(let C=0;C<E;C++){var r=I[C];r instanceof Jr?this.applyAttachmentTimeline(r,e,S,g,_):r.apply(e,M,S,y,b,g,xi.mixIn)}}else{let C=m.timelineMode,R=m.shortestRotation,B=!R&&m.timelinesRotation.length!=E<<1;B&&(m.timelinesRotation.length=E<<1);for(let k=0;k<E;k++){let F=I[k],D=C[k]==Su?g:we.setup;!R&&F instanceof Zl?this.applyRotateTimeline(F,e,S,b,D,m.timelinesRotation,k<<1,B):F instanceof Jr?this.applyAttachmentTimeline(F,e,S,g,_):F.apply(e,M,S,y,b,D,xi.mixIn)}}this.queueEvents(m,v),t.length=0,m.nextAnimationLast=v,m.nextTrackLast=m.trackTime}for(var o=this.unkeyedState+lg,a=e.slots,h=0,l=e.slots.length;h<l;h++){var c=a[h];if(c.attachmentState==o){var u=c.data.attachmentName;c.setAttachment(u?e.getAttachment(c.data.index,u):null)}}return this.unkeyedState+=2,this.queue.drain(),n}applyMixingFrom(e,t,s){let n=e.mixingFrom;n.mixingFrom&&this.applyMixingFrom(n,t,s);let r=0;e.mixDuration==0?(r=1,s==we.first&&(s=we.setup)):(r=e.mixTime/e.mixDuration,r>1&&(r=1),s!=we.first&&(s=n.mixBlend));let o=r<n.mixAttachmentThreshold,a=r<n.mixDrawOrderThreshold,h=n.animation.timelines,l=h.length,c=n.alpha*e.interruptAlpha,u=c*(1-r),f=n.animationLast,d=n.getAnimationTime(),m=d,g=null;if(n.reverse?m=n.animation.duration-m:r<n.eventThreshold&&(g=this.events),s==we.add)for(let b=0;b<l;b++)h[b].apply(t,f,m,g,u,s,xi.mixOut);else{let b=n.timelineMode,_=n.timelineHoldMix,M=n.shortestRotation,v=!M&&n.timelinesRotation.length!=l<<1;v&&(n.timelinesRotation.length=l<<1),n.totalAlpha=0;for(let S=0;S<l;S++){let y=h[S],I=xi.mixOut,E,C=0;switch(b[S]){case Su:if(!a&&y instanceof br)continue;E=s,C=u;break;case og:E=we.setup,C=u;break;case ag:E=s,C=c;break;case Tu:E=we.setup,C=c;break;default:E=we.setup;let R=_[S];C=c*Math.max(0,1-R.mixTime/R.mixDuration);break}n.totalAlpha+=C,!M&&y instanceof Zl?this.applyRotateTimeline(y,t,m,C,E,n.timelinesRotation,S<<1,v):y instanceof Jr?this.applyAttachmentTimeline(y,t,m,E,o&&C>=n.alphaAttachmentThreshold):(a&&y instanceof br&&E==we.setup&&(I=xi.mixIn),y.apply(t,f,m,g,C,E,I))}}return e.mixDuration>0&&this.queueEvents(n,d),this.events.length=0,n.nextAnimationLast=d,n.nextTrackLast=n.trackTime,r}applyAttachmentTimeline(e,t,s,n,r){var o=t.slots[e.slotIndex];o.bone.active&&(s<e.frames[0]?(n==we.setup||n==we.first)&&this.setAttachment(t,o,o.data.attachmentName,r):this.setAttachment(t,o,e.attachmentNames[Xt.search1(e.frames,s)],r),o.attachmentState<=this.unkeyedState&&(o.attachmentState=this.unkeyedState+lg))}setAttachment(e,t,s,n){t.setAttachment(s?e.getAttachment(t.data.index,s):null),n&&(t.attachmentState=this.unkeyedState+DE)}applyRotateTimeline(e,t,s,n,r,o,a,h){if(h&&(o[a]=0),n==1){e.apply(t,0,s,null,1,r,xi.mixIn);return}let l=t.bones[e.boneIndex];if(!l.active)return;let c=e.frames,u=0,f=0;if(s<c[0])switch(r){case we.setup:l.rotation=l.data.rotation;default:return;case we.first:u=l.rotation,f=l.data.rotation}else u=r==we.setup?l.data.rotation:l.rotation,f=l.data.rotation+e.getCurveValue(s);let d=0,m=f-u;if(m-=Math.ceil(m/360-.5)*360,m==0)d=o[a];else{let g=0,b=0;h?(g=0,b=m):(g=o[a],b=o[a+1]);let _=g-g%360;d=m+_;let M=m>=0,v=g>=0;Math.abs(b)<=90&&ke.signum(b)!=ke.signum(m)&&(Math.abs(g-_)>180?(d+=360*ke.signum(g),v=M):_!=0?d-=360*ke.signum(g):v=M),v!=M&&(d+=360*ke.signum(g)),o[a]=d}o[a+1]=m,l.rotation=u+d*n}queueEvents(e,t){let s=e.animationStart,n=e.animationEnd,r=n-s,o=e.trackLast%r,a=this.events,h=0,l=a.length;for(;h<l;h++){let u=a[h];if(u.time<o)break;u.time>n||this.queue.event(e,u)}let c=!1;if(e.loop)if(r==0)c=!0;else{const u=Math.floor(e.trackTime/r);c=u>0&&u>Math.floor(e.trackLast/r)}else c=t>=n&&e.animationLast<n;for(c&&this.queue.complete(e);h<l;h++){let u=a[h];u.time<s||this.queue.event(e,u)}}clearTracks(){let e=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let t=0,s=this.tracks.length;t<s;t++)this.clearTrack(t);this.tracks.length=0,this.queue.drainDisabled=e,this.queue.drain()}clearTrack(e){if(e>=this.tracks.length)return;let t=this.tracks[e];if(!t)return;this.queue.end(t),this.clearNext(t);let s=t;for(;;){let n=s.mixingFrom;if(!n)break;this.queue.end(n),s.mixingFrom=null,s.mixingTo=null,s=n}this.tracks[t.trackIndex]=null,this.queue.drain()}setCurrent(e,t,s){let n=this.expandToIndex(e);this.tracks[e]=t,t.previous=null,n&&(s&&this.queue.interrupt(n),t.mixingFrom=n,n.mixingTo=t,t.mixTime=0,n.mixingFrom&&n.mixDuration>0&&(t.interruptAlpha*=Math.min(1,n.mixTime/n.mixDuration)),n.timelinesRotation.length=0),this.queue.start(t)}setAnimation(e,t,s=!1){let n=this.data.skeletonData.findAnimation(t);if(!n)throw new Error("Animation not found: "+t);return this.setAnimationWith(e,n,s)}setAnimationWith(e,t,s=!1){if(!t)throw new Error("animation cannot be null.");let n=!0,r=this.expandToIndex(e);r&&(r.nextTrackLast==-1?(this.tracks[e]=r.mixingFrom,this.queue.interrupt(r),this.queue.end(r),this.clearNext(r),r=r.mixingFrom,n=!1):this.clearNext(r));let o=this.trackEntry(e,t,s,r);return this.setCurrent(e,o,n),this.queue.drain(),o}addAnimation(e,t,s=!1,n=0){let r=this.data.skeletonData.findAnimation(t);if(!r)throw new Error("Animation not found: "+t);return this.addAnimationWith(e,r,s,n)}addAnimationWith(e,t,s=!1,n=0){if(!t)throw new Error("animation cannot be null.");let r=this.expandToIndex(e);if(r)for(;r.next;)r=r.next;let o=this.trackEntry(e,t,s,r);return r?(r.next=o,o.previous=r,n<=0&&(n=Math.max(n+r.getTrackComplete()-o.mixDuration,0))):(this.setCurrent(e,o,!0),this.queue.drain(),n<0&&(n=0)),o.delay=n,o}setEmptyAnimation(e,t=0){let s=this.setAnimationWith(e,eo.emptyAnimation(),!1);return s.mixDuration=t,s.trackEnd=t,s}addEmptyAnimation(e,t=0,s=0){let n=this.addAnimationWith(e,eo.emptyAnimation(),!1,s);return s<=0&&(n.delay=Math.max(n.delay+n.mixDuration-t,0)),n.mixDuration=t,n.trackEnd=t,n}setEmptyAnimations(e=0){let t=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let s=0,n=this.tracks.length;s<n;s++){let r=this.tracks[s];r&&this.setEmptyAnimation(r.trackIndex,e)}this.queue.drainDisabled=t,this.queue.drain()}expandToIndex(e){return e<this.tracks.length?this.tracks[e]:(Fe.ensureArrayCapacity(this.tracks,e+1,null),this.tracks.length=e+1,null)}trackEntry(e,t,s,n){let r=this.trackEntryPool.obtain();return r.reset(),r.trackIndex=e,r.animation=t,r.loop=s,r.holdPrevious=!1,r.reverse=!1,r.shortestRotation=!1,r.eventThreshold=0,r.alphaAttachmentThreshold=0,r.mixAttachmentThreshold=0,r.mixDrawOrderThreshold=0,r.animationStart=0,r.animationEnd=t.duration,r.animationLast=-1,r.nextAnimationLast=-1,r.delay=0,r.trackTime=0,r.trackLast=-1,r.nextTrackLast=-1,r.trackEnd=Number.MAX_VALUE,r.timeScale=1,r.alpha=1,r.mixTime=0,r.mixDuration=n?this.data.getMix(n.animation,t):0,r.interruptAlpha=1,r.totalAlpha=0,r.mixBlend=we.replace,r}clearNext(e){let t=e.next;for(;t;)this.queue.dispose(t),t=t.next;e.next=null}_animationsChanged(){this.animationsChanged=!1,this.propertyIDs.clear();let e=this.tracks;for(let t=0,s=e.length;t<s;t++){let n=e[t];if(n){for(;n.mixingFrom;)n=n.mixingFrom;do(!n.mixingTo||n.mixBlend!=we.add)&&this.computeHold(n),n=n.mixingTo;while(n)}}}computeHold(e){let t=e.mixingTo,s=e.animation.timelines,n=e.animation.timelines.length,r=e.timelineMode;r.length=n;let o=e.timelineHoldMix;o.length=0;let a=this.propertyIDs;if(t&&t.holdPrevious){for(let h=0;h<n;h++)r[h]=a.addAll(s[h].getPropertyIds())?Tu:ag;return}e:for(let h=0;h<n;h++){let l=s[h],c=l.getPropertyIds();if(!a.addAll(c))r[h]=Su;else if(!t||l instanceof Jr||l instanceof br||l instanceof va||!t.animation.hasTimeline(c))r[h]=og;else{for(let u=t.mixingTo;u;u=u.mixingTo)if(!u.animation.hasTimeline(c)){if(e.mixDuration>0){r[h]=LE,o[h]=u;continue e}break}r[h]=Tu}}}getCurrent(e){return e>=this.tracks.length?null:this.tracks[e]}addListener(e){if(!e)throw new Error("listener cannot be null.");this.listeners.push(e)}removeListener(e){let t=this.listeners.indexOf(e);t>=0&&this.listeners.splice(t,1)}clearListeners(){this.listeners.length=0}clearListenerNotifications(){this.queue.clear()}};A(eo,"_emptyAnimation",new df("<empty>",[],0));let Td=eo;class OE{constructor(){A(this,"animation",null);A(this,"previous",null);A(this,"next",null);A(this,"mixingFrom",null);A(this,"mixingTo",null);A(this,"listener",null);A(this,"trackIndex",0);A(this,"loop",!1);A(this,"holdPrevious",!1);A(this,"reverse",!1);A(this,"shortestRotation",!1);A(this,"eventThreshold",0);A(this,"mixAttachmentThreshold",0);A(this,"alphaAttachmentThreshold",0);A(this,"mixDrawOrderThreshold",0);A(this,"animationStart",0);A(this,"animationEnd",0);A(this,"animationLast",0);A(this,"nextAnimationLast",0);A(this,"delay",0);A(this,"trackTime",0);A(this,"trackLast",0);A(this,"nextTrackLast",0);A(this,"trackEnd",0);A(this,"timeScale",0);A(this,"alpha",0);A(this,"mixTime",0);A(this,"_mixDuration",0);A(this,"interruptAlpha",0);A(this,"totalAlpha",0);A(this,"mixBlend",we.replace);A(this,"timelineMode",new Array);A(this,"timelineHoldMix",new Array);A(this,"timelinesRotation",new Array)}get mixDuration(){return this._mixDuration}set mixDuration(e){this._mixDuration=e}setMixDurationWithDelay(e,t){this._mixDuration=e,t<=0&&(this.previous!=null?t=Math.max(t+this.previous.getTrackComplete()-e,0):t=0),this.delay=t}reset(){this.next=null,this.previous=null,this.mixingFrom=null,this.mixingTo=null,this.animation=null,this.listener=null,this.timelineMode.length=0,this.timelineHoldMix.length=0,this.timelinesRotation.length=0}getAnimationTime(){if(this.loop){let e=this.animationEnd-this.animationStart;return e==0?this.animationStart:this.trackTime%e+this.animationStart}return Math.min(this.trackTime+this.animationStart,this.animationEnd)}setAnimationLast(e){this.animationLast=e,this.nextAnimationLast=e}isComplete(){return this.trackTime>=this.animationEnd-this.animationStart}resetRotationDirections(){this.timelinesRotation.length=0}getTrackComplete(){let e=this.animationEnd-this.animationStart;if(e!=0){if(this.loop)return e*(1+(this.trackTime/e|0));if(this.trackTime<e)return e}return this.trackTime}wasApplied(){return this.nextTrackLast!=-1}isNextReady(){return this.next!=null&&this.nextTrackLast-this.next.delay>=0}}class BE{constructor(e){A(this,"objects",[]);A(this,"drainDisabled",!1);A(this,"animState");this.animState=e}start(e){this.objects.push(Ci.start),this.objects.push(e),this.animState.animationsChanged=!0}interrupt(e){this.objects.push(Ci.interrupt),this.objects.push(e)}end(e){this.objects.push(Ci.end),this.objects.push(e),this.animState.animationsChanged=!0}dispose(e){this.objects.push(Ci.dispose),this.objects.push(e)}complete(e){this.objects.push(Ci.complete),this.objects.push(e)}event(e,t){this.objects.push(Ci.event),this.objects.push(e),this.objects.push(t)}drain(){if(this.drainDisabled)return;this.drainDisabled=!0;let e=this.objects;for(let t=0;t<e.length;t+=2){let s=e[t],n=e[t+1],r=this.animState.listeners.slice();switch(s){case Ci.start:n.listener&&n.listener.start&&n.listener.start(n);for(let a=0;a<r.length;a++){let h=r[a];h.start&&h.start(n)}break;case Ci.interrupt:n.listener&&n.listener.interrupt&&n.listener.interrupt(n);for(let a=0;a<r.length;a++){let h=r[a];h.interrupt&&h.interrupt(n)}break;case Ci.end:n.listener&&n.listener.end&&n.listener.end(n);for(let a=0;a<r.length;a++){let h=r[a];h.end&&h.end(n)}case Ci.dispose:n.listener&&n.listener.dispose&&n.listener.dispose(n);for(let a=0;a<r.length;a++){let h=r[a];h.dispose&&h.dispose(n)}this.animState.trackEntryPool.free(n);break;case Ci.complete:n.listener&&n.listener.complete&&n.listener.complete(n);for(let a=0;a<r.length;a++){let h=r[a];h.complete&&h.complete(n)}break;case Ci.event:let o=e[t+++2];n.listener&&n.listener.event&&n.listener.event(n,o);for(let a=0;a<r.length;a++){let h=r[a];h.event&&h.event(n,o)}break}}this.clear(),this.drainDisabled=!1}clear(){this.objects.length=0}}var Ci;(function(i){i[i.start=0]="start",i[i.interrupt=1]="interrupt",i[i.end=2]="end",i[i.dispose=3]="dispose",i[i.complete=4]="complete",i[i.event=5]="event"})(Ci||(Ci={}));const Su=0,og=1,ag=2,Tu=3,LE=4,lg=1,DE=2;class NE{constructor(e){A(this,"skeletonData");A(this,"animationToMixTime",{});A(this,"defaultMix",0);if(!e)throw new Error("skeletonData cannot be null.");this.skeletonData=e}setMix(e,t,s){let n=this.skeletonData.findAnimation(e);if(!n)throw new Error("Animation not found: "+e);let r=this.skeletonData.findAnimation(t);if(!r)throw new Error("Animation not found: "+t);this.setMixWith(n,r,s)}setMixWith(e,t,s){if(!e)throw new Error("from cannot be null.");if(!t)throw new Error("to cannot be null.");let n=e.name+"."+t.name;this.animationToMixTime[n]=s}getMix(e,t){let s=e.name+"."+t.name,n=this.animationToMixTime[s];return n===void 0?this.defaultMix:n}}class Dh extends vs{constructor(t){super(t);A(this,"color",new ot(1,1,1,1))}copy(){let t=new Dh(this.name);return this.copyTo(t),t.color.setFromColor(this.color),t}}class zn extends vs{constructor(t){super(t);A(this,"endSlot",null);A(this,"color",new ot(.2275,.2275,.8078,1))}copy(){let t=new zn(this.name);return this.copyTo(t),t.endSlot=this.endSlot,t.color.setFromColor(this.color),t}}class UE{constructor(e){A(this,"_image");this._image=e}getImage(){return this._image}}var hi;(function(i){i[i.Nearest=9728]="Nearest",i[i.Linear=9729]="Linear",i[i.MipMap=9987]="MipMap",i[i.MipMapNearestNearest=9984]="MipMapNearestNearest",i[i.MipMapLinearNearest=9985]="MipMapLinearNearest",i[i.MipMapNearestLinear=9986]="MipMapNearestLinear",i[i.MipMapLinearLinear=9987]="MipMapLinearLinear"})(hi||(hi={}));var yn;(function(i){i[i.MirroredRepeat=33648]="MirroredRepeat",i[i.ClampToEdge=33071]="ClampToEdge",i[i.Repeat=10497]="Repeat"})(yn||(yn={}));class VE{constructor(){A(this,"texture");A(this,"u",0);A(this,"v",0);A(this,"u2",0);A(this,"v2",0);A(this,"width",0);A(this,"height",0);A(this,"degrees",0);A(this,"offsetX",0);A(this,"offsetY",0);A(this,"originalWidth",0);A(this,"originalHeight",0)}}class Ky{constructor(e){A(this,"pages",new Array);A(this,"regions",new Array);let t=new XE(e),s=new Array(4),n={};n.size=c=>{c.width=parseInt(s[1]),c.height=parseInt(s[2])},n.format=()=>{},n.filter=c=>{c.minFilter=Fe.enumValue(hi,s[1]),c.magFilter=Fe.enumValue(hi,s[2])},n.repeat=c=>{s[1].indexOf("x")!=-1&&(c.uWrap=yn.Repeat),s[1].indexOf("y")!=-1&&(c.vWrap=yn.Repeat)},n.pma=c=>{c.pma=s[1]=="true"};var r={};r.xy=c=>{c.x=parseInt(s[1]),c.y=parseInt(s[2])},r.size=c=>{c.width=parseInt(s[1]),c.height=parseInt(s[2])},r.bounds=c=>{c.x=parseInt(s[1]),c.y=parseInt(s[2]),c.width=parseInt(s[3]),c.height=parseInt(s[4])},r.offset=c=>{c.offsetX=parseInt(s[1]),c.offsetY=parseInt(s[2])},r.orig=c=>{c.originalWidth=parseInt(s[1]),c.originalHeight=parseInt(s[2])},r.offsets=c=>{c.offsetX=parseInt(s[1]),c.offsetY=parseInt(s[2]),c.originalWidth=parseInt(s[3]),c.originalHeight=parseInt(s[4])},r.rotate=c=>{let u=s[1];u=="true"?c.degrees=90:u!="false"&&(c.degrees=parseInt(u))},r.index=c=>{c.index=parseInt(s[1])};let o=t.readLine();for(;o&&o.trim().length==0;)o=t.readLine();for(;!(!o||o.trim().length==0||t.readEntry(s,o)==0);)o=t.readLine();let a=null,h=null,l=null;for(;o!==null;)if(o.trim().length==0)a=null,o=t.readLine();else if(a){let c=new Zy(a,o);for(;;){let u=t.readEntry(s,o=t.readLine());if(u==0)break;let f=r[s[0]];if(f)f(c);else{h||(h=[]),l||(l=[]),h.push(s[0]);let d=[];for(let m=0;m<u;m++)d.push(parseInt(s[m+1]));l.push(d)}}c.originalWidth==0&&c.originalHeight==0&&(c.originalWidth=c.width,c.originalHeight=c.height),h&&h.length>0&&l&&l.length>0&&(c.names=h,c.values=l,h=null,l=null),c.u=c.x/a.width,c.v=c.y/a.height,c.degrees==90?(c.u2=(c.x+c.height)/a.width,c.v2=(c.y+c.width)/a.height):(c.u2=(c.x+c.width)/a.width,c.v2=(c.y+c.height)/a.height),this.regions.push(c)}else{for(a=new YE(o.trim());t.readEntry(s,o=t.readLine())!=0;){let c=n[s[0]];c&&c(a)}this.pages.push(a)}}findRegion(e){for(let t=0;t<this.regions.length;t++)if(this.regions[t].name==e)return this.regions[t];return null}setTextures(e,t=""){for(let s of this.pages)s.setTexture(e.get(t+s.name))}dispose(){var e;for(let t=0;t<this.pages.length;t++)(e=this.pages[t].texture)==null||e.dispose()}}class XE{constructor(e){A(this,"lines");A(this,"index",0);this.lines=e.split(/\r\n|\r|\n/)}readLine(){return this.index>=this.lines.length?null:this.lines[this.index++]}readEntry(e,t){if(!t||(t=t.trim(),t.length==0))return 0;let s=t.indexOf(":");if(s==-1)return 0;e[0]=t.substr(0,s).trim();for(let n=1,r=s+1;;n++){let o=t.indexOf(",",r);if(o==-1)return e[n]=t.substr(r).trim(),n;if(e[n]=t.substr(r,o-r).trim(),r=o+1,n==4)return 4}}}class YE{constructor(e){A(this,"name");A(this,"minFilter",hi.Nearest);A(this,"magFilter",hi.Nearest);A(this,"uWrap",yn.ClampToEdge);A(this,"vWrap",yn.ClampToEdge);A(this,"texture",null);A(this,"width",0);A(this,"height",0);A(this,"pma",!1);A(this,"regions",new Array);this.name=e}setTexture(e){this.texture=e,e.setFilters(this.minFilter,this.magFilter),e.setWraps(this.uWrap,this.vWrap);for(let t of this.regions)t.texture=e}}class Zy extends VE{constructor(t,s){super();A(this,"page");A(this,"name");A(this,"x",0);A(this,"y",0);A(this,"offsetX",0);A(this,"offsetY",0);A(this,"originalWidth",0);A(this,"originalHeight",0);A(this,"index",0);A(this,"degrees",0);A(this,"names",null);A(this,"values",null);this.page=t,this.name=s,t.regions.push(this)}}class Zn extends vs{constructor(t,s){super(t);A(this,"region",null);A(this,"path");A(this,"regionUVs",[]);A(this,"uvs",[]);A(this,"triangles",[]);A(this,"color",new ot(1,1,1,1));A(this,"width",0);A(this,"height",0);A(this,"hullLength",0);A(this,"edges",[]);A(this,"parentMesh",null);A(this,"sequence",null);A(this,"tempColor",new ot(0,0,0,0));this.path=s}updateRegion(){if(!this.region)throw new Error("Region not set.");let t=this.regionUVs;(!this.uvs||this.uvs.length!=t.length)&&(this.uvs=Fe.newFloatArray(t.length));let s=this.uvs,n=this.uvs.length,r=this.region.u,o=this.region.v,a=0,h=0;if(this.region instanceof Zy){let l=this.region,c=l.page,u=c.width,f=c.height;switch(l.degrees){case 90:r-=(l.originalHeight-l.offsetY-l.height)/u,o-=(l.originalWidth-l.offsetX-l.width)/f,a=l.originalHeight/u,h=l.originalWidth/f;for(let d=0;d<n;d+=2)s[d]=r+t[d+1]*a,s[d+1]=o+(1-t[d])*h;return;case 180:r-=(l.originalWidth-l.offsetX-l.width)/u,o-=l.offsetY/f,a=l.originalWidth/u,h=l.originalHeight/f;for(let d=0;d<n;d+=2)s[d]=r+(1-t[d])*a,s[d+1]=o+(1-t[d+1])*h;return;case 270:r-=l.offsetY/u,o-=l.offsetX/f,a=l.originalHeight/u,h=l.originalWidth/f;for(let d=0;d<n;d+=2)s[d]=r+(1-t[d+1])*a,s[d+1]=o+t[d]*h;return}r-=l.offsetX/u,o-=(l.originalHeight-l.offsetY-l.height)/f,a=l.originalWidth/u,h=l.originalHeight/f}else this.region?(a=this.region.u2-r,h=this.region.v2-o):(r=o=0,a=h=1);for(let l=0;l<n;l+=2)s[l]=r+t[l]*a,s[l+1]=o+t[l+1]*h}getParentMesh(){return this.parentMesh}setParentMesh(t){this.parentMesh=t,t&&(this.bones=t.bones,this.vertices=t.vertices,this.worldVerticesLength=t.worldVerticesLength,this.regionUVs=t.regionUVs,this.triangles=t.triangles,this.hullLength=t.hullLength,this.worldVerticesLength=t.worldVerticesLength)}copy(){if(this.parentMesh)return this.newLinkedMesh();let t=new Zn(this.name,this.path);return t.region=this.region,t.color.setFromColor(this.color),this.copyTo(t),t.regionUVs=new Array(this.regionUVs.length),Fe.arrayCopy(this.regionUVs,0,t.regionUVs,0,this.regionUVs.length),t.uvs=this.uvs instanceof Float32Array?Fe.newFloatArray(this.uvs.length):new Array(this.uvs.length),Fe.arrayCopy(this.uvs,0,t.uvs,0,this.uvs.length),t.triangles=new Array(this.triangles.length),Fe.arrayCopy(this.triangles,0,t.triangles,0,this.triangles.length),t.hullLength=this.hullLength,t.sequence=this.sequence!=null?this.sequence.copy():null,this.edges&&(t.edges=new Array(this.edges.length),Fe.arrayCopy(this.edges,0,t.edges,0,this.edges.length)),t.width=this.width,t.height=this.height,t}computeWorldVertices(t,s,n,r,o,a){this.sequence!=null&&this.sequence.apply(t,this),super.computeWorldVertices(t,s,n,r,o,a)}newLinkedMesh(){let t=new Zn(this.name,this.path);return t.region=this.region,t.color.setFromColor(this.color),t.timelineAttachment=this.timelineAttachment,t.setParentMesh(this.parentMesh?this.parentMesh:this),t.region!=null&&t.updateRegion(),t}}class Er extends vs{constructor(t){super(t);A(this,"lengths",[]);A(this,"closed",!1);A(this,"constantSpeed",!1);A(this,"color",new ot(1,1,1,1))}copy(){let t=new Er(this.name);return this.copyTo(t),t.lengths=new Array(this.lengths.length),Fe.arrayCopy(this.lengths,0,t.lengths,0,this.lengths.length),t.closed=closed,t.constantSpeed=this.constantSpeed,t.color.setFromColor(this.color),t}}class Nh extends vs{constructor(t){super(t);A(this,"x",0);A(this,"y",0);A(this,"rotation",0);A(this,"color",new ot(.38,.94,0,1))}computeWorldPosition(t,s){return s.x=this.x*t.a+this.y*t.b+t.worldX,s.y=this.x*t.c+this.y*t.d+t.worldY,s}computeWorldRotation(t){const s=this.rotation*ke.degRad,n=Math.cos(s),r=Math.sin(s),o=n*t.a+r*t.b,a=n*t.c+r*t.d;return ke.atan2Deg(a,o)}copy(){let t=new Nh(this.name);return t.x=this.x,t.y=this.y,t.rotation=this.rotation,t.color.setFromColor(this.color),t}}const vt=class vt extends by{constructor(t,s){super(t);A(this,"x",0);A(this,"y",0);A(this,"scaleX",1);A(this,"scaleY",1);A(this,"rotation",0);A(this,"width",0);A(this,"height",0);A(this,"color",new ot(1,1,1,1));A(this,"path");A(this,"region",null);A(this,"sequence",null);A(this,"offset",Fe.newFloatArray(8));A(this,"uvs",Fe.newFloatArray(8));A(this,"tempColor",new ot(1,1,1,1));this.path=s}updateRegion(){if(!this.region)throw new Error("Region not set.");let t=this.region,s=this.uvs;if(t==null){s[0]=0,s[1]=0,s[2]=0,s[3]=1,s[4]=1,s[5]=1,s[6]=1,s[7]=0;return}let n=this.width/this.region.originalWidth*this.scaleX,r=this.height/this.region.originalHeight*this.scaleY,o=-this.width/2*this.scaleX+this.region.offsetX*n,a=-this.height/2*this.scaleY+this.region.offsetY*r,h=o+this.region.width*n,l=a+this.region.height*r,c=this.rotation*ke.degRad,u=Math.cos(c),f=Math.sin(c),d=this.x,m=this.y,g=o*u+d,b=o*f,_=a*u+m,M=a*f,v=h*u+d,S=h*f,y=l*u+m,I=l*f,E=this.offset;E[0]=g-M,E[1]=_+b,E[2]=g-I,E[3]=y+b,E[4]=v-I,E[5]=y+S,E[6]=v-M,E[7]=_+S,t.degrees==90?(s[0]=t.u2,s[1]=t.v2,s[2]=t.u,s[3]=t.v2,s[4]=t.u,s[5]=t.v,s[6]=t.u2,s[7]=t.v):(s[0]=t.u,s[1]=t.v2,s[2]=t.u,s[3]=t.v,s[4]=t.u2,s[5]=t.v,s[6]=t.u2,s[7]=t.v2)}computeWorldVertices(t,s,n,r){this.sequence!=null&&this.sequence.apply(t,this);let o=t.bone,a=this.offset,h=o.worldX,l=o.worldY,c=o.a,u=o.b,f=o.c,d=o.d,m=0,g=0;m=a[0],g=a[1],s[n]=m*c+g*u+h,s[n+1]=m*f+g*d+l,n+=r,m=a[2],g=a[3],s[n]=m*c+g*u+h,s[n+1]=m*f+g*d+l,n+=r,m=a[4],g=a[5],s[n]=m*c+g*u+h,s[n+1]=m*f+g*d+l,n+=r,m=a[6],g=a[7],s[n]=m*c+g*u+h,s[n+1]=m*f+g*d+l}copy(){let t=new vt(this.name,this.path);return t.region=this.region,t.x=this.x,t.y=this.y,t.scaleX=this.scaleX,t.scaleY=this.scaleY,t.rotation=this.rotation,t.width=this.width,t.height=this.height,Fe.arrayCopy(this.uvs,0,t.uvs,0,8),Fe.arrayCopy(this.offset,0,t.offset,0,8),t.color.setFromColor(this.color),t.sequence=this.sequence!=null?this.sequence.copy():null,t}};A(vt,"X1",0),A(vt,"Y1",1),A(vt,"C1R",2),A(vt,"C1G",3),A(vt,"C1B",4),A(vt,"C1A",5),A(vt,"U1",6),A(vt,"V1",7),A(vt,"X2",8),A(vt,"Y2",9),A(vt,"C2R",10),A(vt,"C2G",11),A(vt,"C2B",12),A(vt,"C2A",13),A(vt,"U2",14),A(vt,"V2",15),A(vt,"X3",16),A(vt,"Y3",17),A(vt,"C3R",18),A(vt,"C3G",19),A(vt,"C3B",20),A(vt,"C3A",21),A(vt,"U3",22),A(vt,"V3",23),A(vt,"X4",24),A(vt,"Y4",25),A(vt,"C4R",26),A(vt,"C4G",27),A(vt,"C4B",28),A(vt,"C4A",29),A(vt,"U4",30),A(vt,"V4",31);let yo=vt;class Md{constructor(e){A(this,"atlas");this.atlas=e}loadSequence(e,t,s){let n=s.regions;for(let r=0,o=n.length;r<o;r++){let a=s.getPath(t,r),h=this.atlas.findRegion(a);if(h==null)throw new Error("Region not found in atlas: "+a+" (sequence: "+e+")");n[r]=h}}newRegionAttachment(e,t,s,n){let r=new yo(t,s);if(n!=null)this.loadSequence(t,s,n);else{let o=this.atlas.findRegion(s);if(!o)throw new Error("Region not found in atlas: "+s+" (region attachment: "+t+")");r.region=o}return r}newMeshAttachment(e,t,s,n){let r=new Zn(t,s);if(n!=null)this.loadSequence(t,s,n);else{let o=this.atlas.findRegion(s);if(!o)throw new Error("Region not found in atlas: "+s+" (mesh attachment: "+t+")");r.region=o}return r}newBoundingBoxAttachment(e,t){return new Dh(t)}newPathAttachment(e,t){return new Er(t)}newPointAttachment(e,t){return new Nh(t)}newClippingAttachment(e,t){return new zn(t)}}class Jy{constructor(e,t,s){A(this,"index",0);A(this,"name");A(this,"parent",null);A(this,"length",0);A(this,"x",0);A(this,"y",0);A(this,"rotation",0);A(this,"scaleX",1);A(this,"scaleY",1);A(this,"shearX",0);A(this,"shearY",0);A(this,"inherit",jt.Normal);A(this,"skinRequired",!1);A(this,"color",new ot);A(this,"icon");A(this,"visible",!1);if(e<0)throw new Error("index must be >= 0.");if(!t)throw new Error("name cannot be null.");this.index=e,this.name=t,this.parent=s}}var jt;(function(i){i[i.Normal=0]="Normal",i[i.OnlyTranslation=1]="OnlyTranslation",i[i.NoRotationOrReflection=2]="NoRotationOrReflection",i[i.NoScale=3]="NoScale",i[i.NoScaleOrReflection=4]="NoScaleOrReflection"})(jt||(jt={}));class hg{constructor(e,t,s){A(this,"data");A(this,"skeleton");A(this,"parent",null);A(this,"children",new Array);A(this,"x",0);A(this,"y",0);A(this,"rotation",0);A(this,"scaleX",0);A(this,"scaleY",0);A(this,"shearX",0);A(this,"shearY",0);A(this,"ax",0);A(this,"ay",0);A(this,"arotation",0);A(this,"ascaleX",0);A(this,"ascaleY",0);A(this,"ashearX",0);A(this,"ashearY",0);A(this,"a",0);A(this,"b",0);A(this,"c",0);A(this,"d",0);A(this,"worldY",0);A(this,"worldX",0);A(this,"inherit",jt.Normal);A(this,"sorted",!1);A(this,"active",!1);if(!e)throw new Error("data cannot be null.");if(!t)throw new Error("skeleton cannot be null.");this.data=e,this.skeleton=t,this.parent=s,this.setToSetupPose()}isActive(){return this.active}update(e){this.updateWorldTransformWith(this.ax,this.ay,this.arotation,this.ascaleX,this.ascaleY,this.ashearX,this.ashearY)}updateWorldTransform(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)}updateWorldTransformWith(e,t,s,n,r,o,a){this.ax=e,this.ay=t,this.arotation=s,this.ascaleX=n,this.ascaleY=r,this.ashearX=o,this.ashearY=a;let h=this.parent;if(!h){let d=this.skeleton;const m=d.scaleX,g=d.scaleY,b=(s+o)*ke.degRad,_=(s+90+a)*ke.degRad;this.a=Math.cos(b)*n*m,this.b=Math.cos(_)*r*m,this.c=Math.sin(b)*n*g,this.d=Math.sin(_)*r*g,this.worldX=e*m+d.x,this.worldY=t*g+d.y;return}let l=h.a,c=h.b,u=h.c,f=h.d;switch(this.worldX=l*e+c*t+h.worldX,this.worldY=u*e+f*t+h.worldY,this.inherit){case jt.Normal:{const d=(s+o)*ke.degRad,m=(s+90+a)*ke.degRad,g=Math.cos(d)*n,b=Math.cos(m)*r,_=Math.sin(d)*n,M=Math.sin(m)*r;this.a=l*g+c*_,this.b=l*b+c*M,this.c=u*g+f*_,this.d=u*b+f*M;return}case jt.OnlyTranslation:{const d=(s+o)*ke.degRad,m=(s+90+a)*ke.degRad;this.a=Math.cos(d)*n,this.b=Math.cos(m)*r,this.c=Math.sin(d)*n,this.d=Math.sin(m)*r;break}case jt.NoRotationOrReflection:{let d=1/this.skeleton.scaleX,m=1/this.skeleton.scaleY;l*=d,u*=m;let g=l*l+u*u,b=0;g>1e-4?(g=Math.abs(l*f*m-c*d*u)/g,c=u*g,f=l*g,b=Math.atan2(u,l)*ke.radDeg):(l=0,u=0,b=90-Math.atan2(f,c)*ke.radDeg);const _=(s+o-b)*ke.degRad,M=(s+a-b+90)*ke.degRad,v=Math.cos(_)*n,S=Math.cos(M)*r,y=Math.sin(_)*n,I=Math.sin(M)*r;this.a=l*v-c*y,this.b=l*S-c*I,this.c=u*v+f*y,this.d=u*S+f*I;break}case jt.NoScale:case jt.NoScaleOrReflection:{s*=ke.degRad;const d=Math.cos(s),m=Math.sin(s);let g=(l*d+c*m)/this.skeleton.scaleX,b=(u*d+f*m)/this.skeleton.scaleY,_=Math.sqrt(g*g+b*b);_>1e-5&&(_=1/_),g*=_,b*=_,_=Math.sqrt(g*g+b*b),this.inherit==jt.NoScale&&l*f-c*u<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(_=-_),s=Math.PI/2+Math.atan2(b,g);const M=Math.cos(s)*_,v=Math.sin(s)*_;o*=ke.degRad,a=(90+a)*ke.degRad;const S=Math.cos(o)*n,y=Math.cos(a)*r,I=Math.sin(o)*n,E=Math.sin(a)*r;this.a=g*S+M*I,this.b=g*y+M*E,this.c=b*S+v*I,this.d=b*y+v*E;break}}this.a*=this.skeleton.scaleX,this.b*=this.skeleton.scaleX,this.c*=this.skeleton.scaleY,this.d*=this.skeleton.scaleY}setToSetupPose(){let e=this.data;this.x=e.x,this.y=e.y,this.rotation=e.rotation,this.scaleX=e.scaleX,this.scaleY=e.scaleY,this.shearX=e.shearX,this.shearY=e.shearY,this.inherit=e.inherit}updateAppliedTransform(){let e=this.parent;if(!e){this.ax=this.worldX-this.skeleton.x,this.ay=this.worldY-this.skeleton.y,this.arotation=Math.atan2(this.c,this.a)*ke.radDeg,this.ascaleX=Math.sqrt(this.a*this.a+this.c*this.c),this.ascaleY=Math.sqrt(this.b*this.b+this.d*this.d),this.ashearX=0,this.ashearY=Math.atan2(this.a*this.b+this.c*this.d,this.a*this.d-this.b*this.c)*ke.radDeg;return}let t=e.a,s=e.b,n=e.c,r=e.d,o=1/(t*r-s*n),a=r*o,h=s*o,l=n*o,c=t*o,u=this.worldX-e.worldX,f=this.worldY-e.worldY;this.ax=u*a-f*h,this.ay=f*c-u*l;let d,m,g,b;if(this.inherit==jt.OnlyTranslation)d=this.a,m=this.b,g=this.c,b=this.d;else{switch(this.inherit){case jt.NoRotationOrReflection:{let y=Math.abs(t*r-s*n)/(t*t+n*n);s=-n*this.skeleton.scaleX*y/this.skeleton.scaleY,r=t*this.skeleton.scaleY*y/this.skeleton.scaleX,o=1/(t*r-s*n),a=r*o,h=s*o;break}case jt.NoScale:case jt.NoScaleOrReflection:let _=ke.cosDeg(this.rotation),M=ke.sinDeg(this.rotation);t=(t*_+s*M)/this.skeleton.scaleX,n=(n*_+r*M)/this.skeleton.scaleY;let v=Math.sqrt(t*t+n*n);v>1e-5&&(v=1/v),t*=v,n*=v,v=Math.sqrt(t*t+n*n),this.inherit==jt.NoScale&&o<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(v=-v);let S=ke.PI/2+Math.atan2(n,t);s=Math.cos(S)*v,r=Math.sin(S)*v,o=1/(t*r-s*n),a=r*o,h=s*o,l=n*o,c=t*o}d=a*this.a-h*this.c,m=a*this.b-h*this.d,g=c*this.c-l*this.a,b=c*this.d-l*this.b}if(this.ashearX=0,this.ascaleX=Math.sqrt(d*d+g*g),this.ascaleX>1e-4){let _=d*b-m*g;this.ascaleY=_/this.ascaleX,this.ashearY=-Math.atan2(d*m+g*b,_)*ke.radDeg,this.arotation=Math.atan2(g,d)*ke.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(m*m+b*b),this.ashearY=0,this.arotation=90-Math.atan2(b,m)*ke.radDeg}getWorldRotationX(){return Math.atan2(this.c,this.a)*ke.radDeg}getWorldRotationY(){return Math.atan2(this.d,this.b)*ke.radDeg}getWorldScaleX(){return Math.sqrt(this.a*this.a+this.c*this.c)}getWorldScaleY(){return Math.sqrt(this.b*this.b+this.d*this.d)}worldToLocal(e){let t=1/(this.a*this.d-this.b*this.c),s=e.x-this.worldX,n=e.y-this.worldY;return e.x=s*this.d*t-n*this.b*t,e.y=n*this.a*t-s*this.c*t,e}localToWorld(e){let t=e.x,s=e.y;return e.x=t*this.a+s*this.b+this.worldX,e.y=t*this.c+s*this.d+this.worldY,e}worldToParent(e){if(e==null)throw new Error("world cannot be null.");return this.parent==null?e:this.parent.worldToLocal(e)}parentToWorld(e){if(e==null)throw new Error("world cannot be null.");return this.parent==null?e:this.parent.localToWorld(e)}worldToLocalRotation(e){let t=ke.sinDeg(e),s=ke.cosDeg(e);return Math.atan2(this.a*t-this.c*s,this.d*s-this.b*t)*ke.radDeg+this.rotation-this.shearX}localToWorldRotation(e){e-=this.rotation-this.shearX;let t=ke.sinDeg(e),s=ke.cosDeg(e);return Math.atan2(s*this.c+t*this.d,s*this.a+t*this.b)*ke.radDeg}rotateWorld(e){e*=ke.degRad;const t=Math.sin(e),s=Math.cos(e),n=this.a,r=this.b;this.a=s*n-t*this.c,this.b=s*r-t*this.d,this.c=t*n+s*this.c,this.d=t*r+s*this.d}}class Uh{constructor(e,t,s){A(this,"name");A(this,"order");A(this,"skinRequired");this.name=e,this.order=t,this.skinRequired=s}}let Qy=class{constructor(e,t){A(this,"data");A(this,"intValue",0);A(this,"floatValue",0);A(this,"stringValue",null);A(this,"time",0);A(this,"volume",0);A(this,"balance",0);if(!t)throw new Error("data cannot be null.");this.time=e,this.data=t}};class ex{constructor(e){A(this,"name");A(this,"intValue",0);A(this,"floatValue",0);A(this,"stringValue",null);A(this,"audioPath",null);A(this,"volume",0);A(this,"balance",0);this.name=e}}class $E{constructor(e,t){A(this,"data");A(this,"bones");A(this,"target");A(this,"bendDirection",0);A(this,"compress",!1);A(this,"stretch",!1);A(this,"mix",1);A(this,"softness",0);A(this,"active",!1);if(!e)throw new Error("data cannot be null.");if(!t)throw new Error("skeleton cannot be null.");this.data=e,this.bones=new Array;for(let n=0;n<e.bones.length;n++){let r=t.findBone(e.bones[n].name);if(!r)throw new Error(`Couldn't find bone ${e.bones[n].name}`);this.bones.push(r)}let s=t.findBone(e.target.name);if(!s)throw new Error(`Couldn't find bone ${e.target.name}`);this.target=s,this.mix=e.mix,this.softness=e.softness,this.bendDirection=e.bendDirection,this.compress=e.compress,this.stretch=e.stretch}isActive(){return this.active}setToSetupPose(){const e=this.data;this.mix=e.mix,this.softness=e.softness,this.bendDirection=e.bendDirection,this.compress=e.compress,this.stretch=e.stretch}update(e){if(this.mix==0)return;let t=this.target,s=this.bones;switch(s.length){case 1:this.apply1(s[0],t.worldX,t.worldY,this.compress,this.stretch,this.data.uniform,this.mix);break;case 2:this.apply2(s[0],s[1],t.worldX,t.worldY,this.bendDirection,this.stretch,this.data.uniform,this.softness,this.mix);break}}apply1(e,t,s,n,r,o,a){let h=e.parent;if(!h)throw new Error("IK bone must have parent.");let l=h.a,c=h.b,u=h.c,f=h.d,d=-e.ashearX-e.arotation,m=0,g=0;switch(e.inherit){case jt.OnlyTranslation:m=(t-e.worldX)*ke.signum(e.skeleton.scaleX),g=(s-e.worldY)*ke.signum(e.skeleton.scaleY);break;case jt.NoRotationOrReflection:let M=Math.abs(l*f-c*u)/Math.max(1e-4,l*l+u*u),v=l/e.skeleton.scaleX,S=u/e.skeleton.scaleY;c=-S*M*e.skeleton.scaleX,f=v*M*e.skeleton.scaleY,d+=Math.atan2(S,v)*ke.radDeg;default:let y=t-h.worldX,I=s-h.worldY,E=l*f-c*u;Math.abs(E)<=1e-4?(m=0,g=0):(m=(y*f-I*c)/E-e.ax,g=(I*l-y*u)/E-e.ay)}d+=Math.atan2(g,m)*ke.radDeg,e.ascaleX<0&&(d+=180),d>180?d-=360:d<-180&&(d+=360);let b=e.ascaleX,_=e.ascaleY;if(n||r){switch(e.inherit){case jt.NoScale:case jt.NoScaleOrReflection:m=t-e.worldX,g=s-e.worldY}const M=e.data.length*b;if(M>1e-4){const v=m*m+g*g;if(n&&v<M*M||r&&v>M*M){const S=(Math.sqrt(v)/M-1)*a+1;b*=S,o&&(_*=S)}}}e.updateWorldTransformWith(e.ax,e.ay,e.arotation+d*a,b,_,e.ashearX,e.ashearY)}apply2(e,t,s,n,r,o,a,h,l){if(e.inherit!=jt.Normal||t.inherit!=jt.Normal)return;let c=e.ax,u=e.ay,f=e.ascaleX,d=e.ascaleY,m=f,g=d,b=t.ascaleX,_=0,M=0,v=0;f<0?(f=-f,_=180,v=-1):(_=0,v=1),d<0&&(d=-d,v=-v),b<0?(b=-b,M=180):M=0;let S=t.ax,y=0,I=0,E=0,C=e.a,R=e.b,B=e.c,k=e.d,F=Math.abs(f-d)<=1e-4;!F||o?(y=0,I=C*S+e.worldX,E=B*S+e.worldY):(y=t.ay,I=C*S+R*y+e.worldX,E=B*S+k*y+e.worldY);let D=e.parent;if(!D)throw new Error("IK parent must itself have a parent.");C=D.a,R=D.b,B=D.c,k=D.d;let N=C*k-R*B,j=I-D.worldX,O=E-D.worldY;N=Math.abs(N)<=1e-4?0:1/N;let L=(j*k-O*R)*N-c,P=(O*C-j*B)*N-u,X=Math.sqrt(L*L+P*P),U=t.data.length*b,Y,q;if(X<1e-4){this.apply1(e,s,n,!1,o,!1,l),t.updateWorldTransformWith(S,y,0,t.ascaleX,t.ascaleY,t.ashearX,t.ashearY);return}j=s-D.worldX,O=n-D.worldY;let z=(j*k-O*R)*N-c,ne=(O*C-j*B)*N-u,H=z*z+ne*ne;if(h!=0){h*=f*(b+1)*.5;let me=Math.sqrt(H),_e=me-X-U*f+h;if(_e>0){let te=Math.min(1,_e/(h*2))-1;te=(_e-h*(1-te*te))/me,z-=te*z,ne-=te*ne,H=z*z+ne*ne}}e:if(F){U*=f;let me=(H-X*X-U*U)/(2*X*U);me<-1?(me=-1,q=Math.PI*r):me>1?(me=1,q=0,o&&(C=(Math.sqrt(H)/(X+U)-1)*l+1,m*=C,a&&(g*=C))):q=Math.acos(me)*r,C=X+U*me,R=U*Math.sin(q),Y=Math.atan2(ne*C-z*R,z*C+ne*R)}else{C=f*U,R=d*U;let me=C*C,_e=R*R,te=Math.atan2(ne,z);B=_e*X*X+me*H-me*_e;let ve=-2*_e*X,$=_e-me;if(k=ve*ve-4*$*B,k>=0){let de=Math.sqrt(k);ve<0&&(de=-de),de=-(ve+de)*.5;let De=de/$,Ie=B/de,Be=Math.abs(De)<Math.abs(Ie)?De:Ie;if(De=H-Be*Be,De>=0){O=Math.sqrt(De)*r,Y=te-Math.atan2(O,Be),q=Math.atan2(O/d,(Be-X)/f);break e}}let W=ke.PI,J=X-C,Q=J*J,ie=0,ue=0,Se=X+C,Me=Se*Se,Ee=0;B=-C*X/(me-_e),B>=-1&&B<=1&&(B=Math.acos(B),j=C*Math.cos(B)+X,O=R*Math.sin(B),k=j*j+O*O,k<Q&&(W=B,Q=k,J=j,ie=O),k>Me&&(ue=B,Me=k,Se=j,Ee=O)),H<=(Q+Me)*.5?(Y=te-Math.atan2(ie*r,J),q=W*r):(Y=te-Math.atan2(Ee*r,Se),q=ue*r)}let Z=Math.atan2(y,S)*v,ae=e.arotation;Y=(Y-Z)*ke.radDeg+_-ae,Y>180?Y-=360:Y<-180&&(Y+=360),e.updateWorldTransformWith(c,u,ae+Y*l,m,g,0,0),ae=t.arotation,q=((q+Z)*ke.radDeg-t.ashearX)*v+M-ae,q>180?q-=360:q<-180&&(q+=360),t.updateWorldTransformWith(S,y,ae+q*l,t.ascaleX,t.ascaleY,t.ashearX,t.ashearY)}}class tx extends Uh{constructor(t){super(t,0,!1);A(this,"bones",new Array);A(this,"_target",null);A(this,"bendDirection",0);A(this,"compress",!1);A(this,"stretch",!1);A(this,"uniform",!1);A(this,"mix",0);A(this,"softness",0)}set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("BoneData not set.")}}class ix extends Uh{constructor(t){super(t,0,!1);A(this,"bones",new Array);A(this,"_target",null);A(this,"positionMode",Gs.Fixed);A(this,"spacingMode",oi.Fixed);A(this,"rotateMode",wr.Chain);A(this,"offsetRotation",0);A(this,"position",0);A(this,"spacing",0);A(this,"mixRotate",0);A(this,"mixX",0);A(this,"mixY",0)}set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("SlotData not set.")}}var Gs;(function(i){i[i.Fixed=0]="Fixed",i[i.Percent=1]="Percent"})(Gs||(Gs={}));var oi;(function(i){i[i.Length=0]="Length",i[i.Fixed=1]="Fixed",i[i.Percent=2]="Percent",i[i.Proportional=3]="Proportional"})(oi||(oi={}));var wr;(function(i){i[i.Tangent=0]="Tangent",i[i.Chain=1]="Chain",i[i.ChainScale=2]="ChainScale"})(wr||(wr={}));const Ni=class Ni{constructor(e,t){A(this,"data");A(this,"bones");A(this,"target");A(this,"position",0);A(this,"spacing",0);A(this,"mixRotate",0);A(this,"mixX",0);A(this,"mixY",0);A(this,"spaces",new Array);A(this,"positions",new Array);A(this,"world",new Array);A(this,"curves",new Array);A(this,"lengths",new Array);A(this,"segments",new Array);A(this,"active",!1);if(!e)throw new Error("data cannot be null.");if(!t)throw new Error("skeleton cannot be null.");this.data=e,this.bones=new Array;for(let n=0,r=e.bones.length;n<r;n++){let o=t.findBone(e.bones[n].name);if(!o)throw new Error(`Couldn't find bone ${e.bones[n].name}.`);this.bones.push(o)}let s=t.findSlot(e.target.name);if(!s)throw new Error(`Couldn't find target bone ${e.target.name}`);this.target=s,this.position=e.position,this.spacing=e.spacing,this.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY}isActive(){return this.active}setToSetupPose(){const e=this.data;this.position=e.position,this.spacing=e.spacing,this.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY}update(e){let t=this.target.getAttachment();if(!(t instanceof Er))return;let s=this.mixRotate,n=this.mixX,r=this.mixY;if(s==0&&n==0&&r==0)return;let o=this.data,a=o.rotateMode==wr.Tangent,h=o.rotateMode==wr.ChainScale,l=this.bones,c=l.length,u=a?c:c+1,f=Fe.setArraySize(this.spaces,u),d=h?this.lengths=Fe.setArraySize(this.lengths,c):[],m=this.spacing;switch(o.spacingMode){case oi.Percent:if(h)for(let I=0,E=u-1;I<E;I++){let C=l[I],R=C.data.length,B=R*C.a,k=R*C.c;d[I]=Math.sqrt(B*B+k*k)}Fe.arrayFill(f,1,u,m);break;case oi.Proportional:let S=0;for(let I=0,E=u-1;I<E;){let C=l[I],R=C.data.length;if(R<Ni.epsilon)h&&(d[I]=0),f[++I]=m;else{let B=R*C.a,k=R*C.c,F=Math.sqrt(B*B+k*k);h&&(d[I]=F),f[++I]=F,S+=F}}if(S>0){S=u/S*m;for(let I=1;I<u;I++)f[I]*=S}break;default:let y=o.spacingMode==oi.Length;for(let I=0,E=u-1;I<E;){let C=l[I],R=C.data.length;if(R<Ni.epsilon)h&&(d[I]=0),f[++I]=m;else{let B=R*C.a,k=R*C.c,F=Math.sqrt(B*B+k*k);h&&(d[I]=F),f[++I]=(y?R+m:m)*F/R}}}let g=this.computeWorldPositions(t,u,a),b=g[0],_=g[1],M=o.offsetRotation,v=!1;if(M==0)v=o.rotateMode==wr.Chain;else{v=!1;let S=this.target.bone;M*=S.a*S.d-S.b*S.c>0?ke.degRad:-.01745329277777778}for(let S=0,y=3;S<c;S++,y+=3){let I=l[S];I.worldX+=(b-I.worldX)*n,I.worldY+=(_-I.worldY)*r;let E=g[y],C=g[y+1],R=E-b,B=C-_;if(h){let k=d[S];if(k!=0){let F=(Math.sqrt(R*R+B*B)/k-1)*s+1;I.a*=F,I.c*=F}}if(b=E,_=C,s>0){let k=I.a,F=I.b,D=I.c,N=I.d,j=0,O=0,L=0;if(a?j=g[y-1]:f[S+1]==0?j=g[y+2]:j=Math.atan2(B,R),j-=Math.atan2(D,k),v){O=Math.cos(j),L=Math.sin(j);let P=I.data.length;b+=(P*(O*k-L*D)-R)*s,_+=(P*(L*k+O*D)-B)*s}else j+=M;j>ke.PI?j-=ke.PI2:j<-3.1415927&&(j+=ke.PI2),j*=s,O=Math.cos(j),L=Math.sin(j),I.a=O*k-L*D,I.b=O*F-L*N,I.c=L*k+O*D,I.d=L*F+O*N}I.updateAppliedTransform()}}computeWorldPositions(e,t,s){let n=this.target,r=this.position,o=this.spaces,a=Fe.setArraySize(this.positions,t*3+2),h=this.world,l=e.closed,c=e.worldVerticesLength,u=c/6,f=Ni.NONE;if(!e.constantSpeed){let P=e.lengths;u-=l?1:2;let X=P[u];this.data.positionMode==Gs.Percent&&(r*=X);let U;switch(this.data.spacingMode){case oi.Percent:U=X;break;case oi.Proportional:U=X/t;break;default:U=1}h=Fe.setArraySize(this.world,8);for(let Y=0,q=0,z=0;Y<t;Y++,q+=3){let ne=o[Y]*U;r+=ne;let H=r;if(l)H%=X,H<0&&(H+=X),z=0;else if(H<0){f!=Ni.BEFORE&&(f=Ni.BEFORE,e.computeWorldVertices(n,2,4,h,0,2)),this.addBeforePosition(H,h,0,a,q);continue}else if(H>X){f!=Ni.AFTER&&(f=Ni.AFTER,e.computeWorldVertices(n,c-6,4,h,0,2)),this.addAfterPosition(H-X,h,0,a,q);continue}for(;;z++){let Z=P[z];if(!(H>Z)){if(z==0)H/=Z;else{let ae=P[z-1];H=(H-ae)/(Z-ae)}break}}z!=f&&(f=z,l&&z==u?(e.computeWorldVertices(n,c-4,4,h,0,2),e.computeWorldVertices(n,0,4,h,4,2)):e.computeWorldVertices(n,z*6+2,8,h,0,2)),this.addCurvePosition(H,h[0],h[1],h[2],h[3],h[4],h[5],h[6],h[7],a,q,s||Y>0&&ne==0)}return a}l?(c+=2,h=Fe.setArraySize(this.world,c),e.computeWorldVertices(n,2,c-4,h,0,2),e.computeWorldVertices(n,0,2,h,c-4,2),h[c-2]=h[0],h[c-1]=h[1]):(u--,c-=4,h=Fe.setArraySize(this.world,c),e.computeWorldVertices(n,2,c,h,0,2));let d=Fe.setArraySize(this.curves,u),m=0,g=h[0],b=h[1],_=0,M=0,v=0,S=0,y=0,I=0,E=0,C=0,R=0,B=0,k=0,F=0,D=0,N=0;for(let P=0,X=2;P<u;P++,X+=6)_=h[X],M=h[X+1],v=h[X+2],S=h[X+3],y=h[X+4],I=h[X+5],E=(g-_*2+v)*.1875,C=(b-M*2+S)*.1875,R=((_-v)*3-g+y)*.09375,B=((M-S)*3-b+I)*.09375,k=E*2+R,F=C*2+B,D=(_-g)*.75+E+R*.16666667,N=(M-b)*.75+C+B*.16666667,m+=Math.sqrt(D*D+N*N),D+=k,N+=F,k+=R,F+=B,m+=Math.sqrt(D*D+N*N),D+=k,N+=F,m+=Math.sqrt(D*D+N*N),D+=k+R,N+=F+B,m+=Math.sqrt(D*D+N*N),d[P]=m,g=y,b=I;this.data.positionMode==Gs.Percent&&(r*=m);let j;switch(this.data.spacingMode){case oi.Percent:j=m;break;case oi.Proportional:j=m/t;break;default:j=1}let O=this.segments,L=0;for(let P=0,X=0,U=0,Y=0;P<t;P++,X+=3){let q=o[P]*j;r+=q;let z=r;if(l)z%=m,z<0&&(z+=m),U=0;else if(z<0){this.addBeforePosition(z,h,0,a,X);continue}else if(z>m){this.addAfterPosition(z-m,h,c-4,a,X);continue}for(;;U++){let ne=d[U];if(!(z>ne)){if(U==0)z/=ne;else{let H=d[U-1];z=(z-H)/(ne-H)}break}}if(U!=f){f=U;let ne=U*6;for(g=h[ne],b=h[ne+1],_=h[ne+2],M=h[ne+3],v=h[ne+4],S=h[ne+5],y=h[ne+6],I=h[ne+7],E=(g-_*2+v)*.03,C=(b-M*2+S)*.03,R=((_-v)*3-g+y)*.006,B=((M-S)*3-b+I)*.006,k=E*2+R,F=C*2+B,D=(_-g)*.3+E+R*.16666667,N=(M-b)*.3+C+B*.16666667,L=Math.sqrt(D*D+N*N),O[0]=L,ne=1;ne<8;ne++)D+=k,N+=F,k+=R,F+=B,L+=Math.sqrt(D*D+N*N),O[ne]=L;D+=k,N+=F,L+=Math.sqrt(D*D+N*N),O[8]=L,D+=k+R,N+=F+B,L+=Math.sqrt(D*D+N*N),O[9]=L,Y=0}for(z*=L;;Y++){let ne=O[Y];if(!(z>ne)){if(Y==0)z/=ne;else{let H=O[Y-1];z=Y+(z-H)/(ne-H)}break}}this.addCurvePosition(z*.1,g,b,_,M,v,S,y,I,a,X,s||P>0&&q==0)}return a}addBeforePosition(e,t,s,n,r){let o=t[s],a=t[s+1],h=t[s+2]-o,l=t[s+3]-a,c=Math.atan2(l,h);n[r]=o+e*Math.cos(c),n[r+1]=a+e*Math.sin(c),n[r+2]=c}addAfterPosition(e,t,s,n,r){let o=t[s+2],a=t[s+3],h=o-t[s],l=a-t[s+1],c=Math.atan2(l,h);n[r]=o+e*Math.cos(c),n[r+1]=a+e*Math.sin(c),n[r+2]=c}addCurvePosition(e,t,s,n,r,o,a,h,l,c,u,f){if(e==0||isNaN(e)){c[u]=t,c[u+1]=s,c[u+2]=Math.atan2(r-s,n-t);return}let d=e*e,m=d*e,g=1-e,b=g*g,_=b*g,M=g*e,v=M*3,S=g*v,y=v*e,I=t*_+n*S+o*y+h*m,E=s*_+r*S+a*y+l*m;c[u]=I,c[u+1]=E,f&&(e<.001?c[u+2]=Math.atan2(r-s,n-t):c[u+2]=Math.atan2(E-(s*b+r*M*2+a*d),I-(t*b+n*M*2+o*d)))}};A(Ni,"NONE",-1),A(Ni,"BEFORE",-2),A(Ni,"AFTER",-3),A(Ni,"epsilon",1e-5);let Ed=Ni;class GE{constructor(e,t){A(this,"data");A(this,"_bone",null);A(this,"inertia",0);A(this,"strength",0);A(this,"damping",0);A(this,"massInverse",0);A(this,"wind",0);A(this,"gravity",0);A(this,"mix",0);A(this,"_reset",!0);A(this,"ux",0);A(this,"uy",0);A(this,"cx",0);A(this,"cy",0);A(this,"tx",0);A(this,"ty",0);A(this,"xOffset",0);A(this,"xVelocity",0);A(this,"yOffset",0);A(this,"yVelocity",0);A(this,"rotateOffset",0);A(this,"rotateVelocity",0);A(this,"scaleOffset",0);A(this,"scaleVelocity",0);A(this,"active",!1);A(this,"skeleton");A(this,"remaining",0);A(this,"lastTime",0);this.data=e,this.skeleton=t,this.bone=t.bones[e.bone.index],this.inertia=e.inertia,this.strength=e.strength,this.damping=e.damping,this.massInverse=e.massInverse,this.wind=e.wind,this.gravity=e.gravity,this.mix=e.mix}set bone(e){this._bone=e}get bone(){if(this._bone)return this._bone;throw new Error("Bone not set.")}reset(){this.remaining=0,this.lastTime=this.skeleton.time,this._reset=!0,this.xOffset=0,this.xVelocity=0,this.yOffset=0,this.yVelocity=0,this.rotateOffset=0,this.rotateVelocity=0,this.scaleOffset=0,this.scaleVelocity=0}setToSetupPose(){const e=this.data;this.inertia=e.inertia,this.strength=e.strength,this.damping=e.damping,this.massInverse=e.massInverse,this.wind=e.wind,this.gravity=e.gravity,this.mix=e.mix}isActive(){return this.active}update(e){const t=this.mix;if(t==0)return;const s=this.data.x>0,n=this.data.y>0,r=this.data.rotate>0||this.data.shearX>0,o=this.data.scaleX>0,a=this.bone,h=a.data.length;switch(e){case Xn.none:return;case Xn.reset:this.reset();case Xn.update:const l=this.skeleton,c=Math.max(this.skeleton.time-this.lastTime,0);this.remaining+=c,this.lastTime=l.time;const u=a.worldX,f=a.worldY;if(this._reset)this._reset=!1,this.ux=u,this.uy=f;else{let d=this.remaining,m=this.inertia,g=this.data.step,b=this.skeleton.data.referenceScale,_=-1,M=this.data.limit*c,v=M*Math.abs(l.scaleY);if(M*=Math.abs(l.scaleX),s||n){if(s){const S=(this.ux-u)*m;this.xOffset+=S>M?M:S<-M?-M:S,this.ux=u}if(n){const S=(this.uy-f)*m;this.yOffset+=S>v?v:S<-v?-v:S,this.uy=f}if(d>=g){_=Math.pow(this.damping,60*g);const S=this.massInverse*g,y=this.strength,I=this.wind*b*l.scaleX,E=this.gravity*b*l.scaleY;do s&&(this.xVelocity+=(I-this.xOffset*y)*S,this.xOffset+=this.xVelocity*g,this.xVelocity*=_),n&&(this.yVelocity-=(E+this.yOffset*y)*S,this.yOffset+=this.yVelocity*g,this.yVelocity*=_),d-=g;while(d>=g)}s&&(a.worldX+=this.xOffset*t*this.data.x),n&&(a.worldY+=this.yOffset*t*this.data.y)}if(r||o){let S=Math.atan2(a.c,a.a),y=0,I=0,E=0,C=this.cx-a.worldX,R=this.cy-a.worldY;if(C>M?C=M:C<-M&&(C=-M),R>v?R=v:R<-v&&(R=-v),r){E=(this.data.rotate+this.data.shearX)*t;let B=Math.atan2(R+this.ty,C+this.tx)-S-this.rotateOffset*E;this.rotateOffset+=(B-Math.ceil(B*ke.invPI2-.5)*ke.PI2)*m,B=this.rotateOffset*E+S,y=Math.cos(B),I=Math.sin(B),o&&(B=h*a.getWorldScaleX(),B>0&&(this.scaleOffset+=(C*y+R*I)*m/B))}else{y=Math.cos(S),I=Math.sin(S);const B=h*a.getWorldScaleX();B>0&&(this.scaleOffset+=(C*y+R*I)*m/B)}if(d=this.remaining,d>=g){_==-1&&(_=Math.pow(this.damping,60*g));const B=this.massInverse*g,k=this.strength,F=this.wind,D=ya.yDown?-this.gravity:this.gravity,N=h/b;for(;;)if(d-=g,o&&(this.scaleVelocity+=(F*y-D*I-this.scaleOffset*k)*B,this.scaleOffset+=this.scaleVelocity*g,this.scaleVelocity*=_),r){if(this.rotateVelocity-=((F*I+D*y)*N+this.rotateOffset*k)*B,this.rotateOffset+=this.rotateVelocity*g,this.rotateVelocity*=_,d<g)break;const j=this.rotateOffset*E+S;y=Math.cos(j),I=Math.sin(j)}else if(d<g)break}}this.remaining=d}this.cx=a.worldX,this.cy=a.worldY;break;case Xn.pose:s&&(a.worldX+=this.xOffset*t*this.data.x),n&&(a.worldY+=this.yOffset*t*this.data.y)}if(r){let l=this.rotateOffset*t,c=0,u=0,f=0;if(this.data.shearX>0){let d=0;this.data.rotate>0&&(d=l*this.data.rotate,c=Math.sin(d),u=Math.cos(d),f=a.b,a.b=u*f-c*a.d,a.d=c*f+u*a.d),d+=l*this.data.shearX,c=Math.sin(d),u=Math.cos(d),f=a.a,a.a=u*f-c*a.c,a.c=c*f+u*a.c}else l*=this.data.rotate,c=Math.sin(l),u=Math.cos(l),f=a.a,a.a=u*f-c*a.c,a.c=c*f+u*a.c,f=a.b,a.b=u*f-c*a.d,a.d=c*f+u*a.d}if(o){const l=1+this.scaleOffset*t*this.data.scaleX;a.a*=l,a.c*=l}e!=Xn.pose&&(this.tx=h*a.a,this.ty=h*a.c),a.updateAppliedTransform()}translate(e,t){this.ux-=e,this.uy-=t,this.cx-=e,this.cy-=t}rotate(e,t,s){const n=s*ke.degRad,r=Math.cos(n),o=Math.sin(n),a=this.cx-e,h=this.cy-t;this.translate(a*r-h*o-a,a*o+h*r-h)}}class jE{constructor(e,t){A(this,"data");A(this,"bone");A(this,"color");A(this,"darkColor",null);A(this,"attachment",null);A(this,"attachmentState",0);A(this,"sequenceIndex",-1);A(this,"deform",new Array);if(!e)throw new Error("data cannot be null.");if(!t)throw new Error("bone cannot be null.");this.data=e,this.bone=t,this.color=new ot,this.darkColor=e.darkColor?new ot:null,this.setToSetupPose()}getSkeleton(){return this.bone.skeleton}getAttachment(){return this.attachment}setAttachment(e){this.attachment!=e&&((!(e instanceof vs)||!(this.attachment instanceof vs)||e.timelineAttachment!=this.attachment.timelineAttachment)&&(this.deform.length=0),this.attachment=e,this.sequenceIndex=-1)}setToSetupPose(){this.color.setFromColor(this.data.color),this.darkColor&&this.darkColor.setFromColor(this.data.darkColor),this.data.attachmentName?(this.attachment=null,this.setAttachment(this.bone.skeleton.getAttachment(this.data.index,this.data.attachmentName))):this.attachment=null}}class HE{constructor(e,t){A(this,"data");A(this,"bones");A(this,"target");A(this,"mixRotate",0);A(this,"mixX",0);A(this,"mixY",0);A(this,"mixScaleX",0);A(this,"mixScaleY",0);A(this,"mixShearY",0);A(this,"temp",new ql);A(this,"active",!1);if(!e)throw new Error("data cannot be null.");if(!t)throw new Error("skeleton cannot be null.");this.data=e,this.bones=new Array;for(let n=0;n<e.bones.length;n++){let r=t.findBone(e.bones[n].name);if(!r)throw new Error(`Couldn't find bone ${e.bones[n].name}.`);this.bones.push(r)}let s=t.findBone(e.target.name);if(!s)throw new Error(`Couldn't find target bone ${e.target.name}.`);this.target=s,this.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY,this.mixScaleX=e.mixScaleX,this.mixScaleY=e.mixScaleY,this.mixShearY=e.mixShearY}isActive(){return this.active}setToSetupPose(){const e=this.data;this.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY,this.mixScaleX=e.mixScaleX,this.mixScaleY=e.mixScaleY,this.mixShearY=e.mixShearY}update(e){this.mixRotate==0&&this.mixX==0&&this.mixY==0&&this.mixScaleX==0&&this.mixScaleY==0&&this.mixShearY==0||(this.data.local?this.data.relative?this.applyRelativeLocal():this.applyAbsoluteLocal():this.data.relative?this.applyRelativeWorld():this.applyAbsoluteWorld())}applyAbsoluteWorld(){let e=this.mixRotate,t=this.mixX,s=this.mixY,n=this.mixScaleX,r=this.mixScaleY,o=this.mixShearY,a=t!=0||s!=0,h=this.target,l=h.a,c=h.b,u=h.c,f=h.d,d=l*f-c*u>0?ke.degRad:-.01745329277777778,m=this.data.offsetRotation*d,g=this.data.offsetShearY*d,b=this.bones;for(let _=0,M=b.length;_<M;_++){let v=b[_];if(e!=0){let S=v.a,y=v.b,I=v.c,E=v.d,C=Math.atan2(u,l)-Math.atan2(I,S)+m;C>ke.PI?C-=ke.PI2:C<-3.1415927&&(C+=ke.PI2),C*=e;let R=Math.cos(C),B=Math.sin(C);v.a=R*S-B*I,v.b=R*y-B*E,v.c=B*S+R*I,v.d=B*y+R*E}if(a){let S=this.temp;h.localToWorld(S.set(this.data.offsetX,this.data.offsetY)),v.worldX+=(S.x-v.worldX)*t,v.worldY+=(S.y-v.worldY)*s}if(n!=0){let S=Math.sqrt(v.a*v.a+v.c*v.c);S!=0&&(S=(S+(Math.sqrt(l*l+u*u)-S+this.data.offsetScaleX)*n)/S),v.a*=S,v.c*=S}if(r!=0){let S=Math.sqrt(v.b*v.b+v.d*v.d);S!=0&&(S=(S+(Math.sqrt(c*c+f*f)-S+this.data.offsetScaleY)*r)/S),v.b*=S,v.d*=S}if(o>0){let S=v.b,y=v.d,I=Math.atan2(y,S),E=Math.atan2(f,c)-Math.atan2(u,l)-(I-Math.atan2(v.c,v.a));E>ke.PI?E-=ke.PI2:E<-3.1415927&&(E+=ke.PI2),E=I+(E+g)*o;let C=Math.sqrt(S*S+y*y);v.b=Math.cos(E)*C,v.d=Math.sin(E)*C}v.updateAppliedTransform()}}applyRelativeWorld(){let e=this.mixRotate,t=this.mixX,s=this.mixY,n=this.mixScaleX,r=this.mixScaleY,o=this.mixShearY,a=t!=0||s!=0,h=this.target,l=h.a,c=h.b,u=h.c,f=h.d,d=l*f-c*u>0?ke.degRad:-.01745329277777778,m=this.data.offsetRotation*d,g=this.data.offsetShearY*d,b=this.bones;for(let _=0,M=b.length;_<M;_++){let v=b[_];if(e!=0){let S=v.a,y=v.b,I=v.c,E=v.d,C=Math.atan2(u,l)+m;C>ke.PI?C-=ke.PI2:C<-3.1415927&&(C+=ke.PI2),C*=e;let R=Math.cos(C),B=Math.sin(C);v.a=R*S-B*I,v.b=R*y-B*E,v.c=B*S+R*I,v.d=B*y+R*E}if(a){let S=this.temp;h.localToWorld(S.set(this.data.offsetX,this.data.offsetY)),v.worldX+=S.x*t,v.worldY+=S.y*s}if(n!=0){let S=(Math.sqrt(l*l+u*u)-1+this.data.offsetScaleX)*n+1;v.a*=S,v.c*=S}if(r!=0){let S=(Math.sqrt(c*c+f*f)-1+this.data.offsetScaleY)*r+1;v.b*=S,v.d*=S}if(o>0){let S=Math.atan2(f,c)-Math.atan2(u,l);S>ke.PI?S-=ke.PI2:S<-3.1415927&&(S+=ke.PI2);let y=v.b,I=v.d;S=Math.atan2(I,y)+(S-ke.PI/2+g)*o;let E=Math.sqrt(y*y+I*I);v.b=Math.cos(S)*E,v.d=Math.sin(S)*E}v.updateAppliedTransform()}}applyAbsoluteLocal(){let e=this.mixRotate,t=this.mixX,s=this.mixY,n=this.mixScaleX,r=this.mixScaleY,o=this.mixShearY,a=this.target,h=this.bones;for(let l=0,c=h.length;l<c;l++){let u=h[l],f=u.arotation;e!=0&&(f+=(a.arotation-f+this.data.offsetRotation)*e);let d=u.ax,m=u.ay;d+=(a.ax-d+this.data.offsetX)*t,m+=(a.ay-m+this.data.offsetY)*s;let g=u.ascaleX,b=u.ascaleY;n!=0&&g!=0&&(g=(g+(a.ascaleX-g+this.data.offsetScaleX)*n)/g),r!=0&&b!=0&&(b=(b+(a.ascaleY-b+this.data.offsetScaleY)*r)/b);let _=u.ashearY;o!=0&&(_+=(a.ashearY-_+this.data.offsetShearY)*o),u.updateWorldTransformWith(d,m,f,g,b,u.ashearX,_)}}applyRelativeLocal(){let e=this.mixRotate,t=this.mixX,s=this.mixY,n=this.mixScaleX,r=this.mixScaleY,o=this.mixShearY,a=this.target,h=this.bones;for(let l=0,c=h.length;l<c;l++){let u=h[l],f=u.arotation+(a.arotation+this.data.offsetRotation)*e,d=u.ax+(a.ax+this.data.offsetX)*t,m=u.ay+(a.ay+this.data.offsetY)*s,g=u.ascaleX*((a.ascaleX-1+this.data.offsetScaleX)*n+1),b=u.ascaleY*((a.ascaleY-1+this.data.offsetScaleY)*r+1),_=u.ashearY+(a.ashearY+this.data.offsetShearY)*o;u.updateWorldTransformWith(d,m,f,g,b,u.ashearX,_)}}}const to=class to{constructor(e){A(this,"data");A(this,"bones");A(this,"slots");A(this,"drawOrder");A(this,"ikConstraints");A(this,"transformConstraints");A(this,"pathConstraints");A(this,"physicsConstraints");A(this,"_updateCache",new Array);A(this,"skin",null);A(this,"color");A(this,"scaleX",1);A(this,"_scaleY",1);A(this,"x",0);A(this,"y",0);A(this,"time",0);if(!e)throw new Error("data cannot be null.");this.data=e,this.bones=new Array;for(let t=0;t<e.bones.length;t++){let s=e.bones[t],n;if(!s.parent)n=new hg(s,this,null);else{let r=this.bones[s.parent.index];n=new hg(s,this,r),r.children.push(n)}this.bones.push(n)}this.slots=new Array,this.drawOrder=new Array;for(let t=0;t<e.slots.length;t++){let s=e.slots[t],n=this.bones[s.boneData.index],r=new jE(s,n);this.slots.push(r),this.drawOrder.push(r)}this.ikConstraints=new Array;for(let t=0;t<e.ikConstraints.length;t++){let s=e.ikConstraints[t];this.ikConstraints.push(new $E(s,this))}this.transformConstraints=new Array;for(let t=0;t<e.transformConstraints.length;t++){let s=e.transformConstraints[t];this.transformConstraints.push(new HE(s,this))}this.pathConstraints=new Array;for(let t=0;t<e.pathConstraints.length;t++){let s=e.pathConstraints[t];this.pathConstraints.push(new Ed(s,this))}this.physicsConstraints=new Array;for(let t=0;t<e.physicsConstraints.length;t++){let s=e.physicsConstraints[t];this.physicsConstraints.push(new GE(s,this))}this.color=new ot(1,1,1,1),this.updateCache()}get scaleY(){return to.yDown?-this._scaleY:this._scaleY}set scaleY(e){this._scaleY=e}updateCache(){let e=this._updateCache;e.length=0;let t=this.bones;for(let f=0,d=t.length;f<d;f++){let m=t[f];m.sorted=m.data.skinRequired,m.active=!m.sorted}if(this.skin){let f=this.skin.bones;for(let d=0,m=this.skin.bones.length;d<m;d++){let g=this.bones[f[d].index];do g.sorted=!1,g.active=!0,g=g.parent;while(g)}}let s=this.ikConstraints,n=this.transformConstraints,r=this.pathConstraints,o=this.physicsConstraints,a=s.length,h=n.length,l=r.length,c=this.physicsConstraints.length,u=a+h+l+c;e:for(let f=0;f<u;f++){for(let d=0;d<a;d++){let m=s[d];if(m.data.order==f){this.sortIkConstraint(m);continue e}}for(let d=0;d<h;d++){let m=n[d];if(m.data.order==f){this.sortTransformConstraint(m);continue e}}for(let d=0;d<l;d++){let m=r[d];if(m.data.order==f){this.sortPathConstraint(m);continue e}}for(let d=0;d<c;d++){const m=o[d];if(m.data.order==f){this.sortPhysicsConstraint(m);continue e}}}for(let f=0,d=t.length;f<d;f++)this.sortBone(t[f])}sortIkConstraint(e){if(e.active=e.target.isActive()&&(!e.data.skinRequired||this.skin&&Fe.contains(this.skin.constraints,e.data,!0)),!e.active)return;let t=e.target;this.sortBone(t);let s=e.bones,n=s[0];if(this.sortBone(n),s.length==1)this._updateCache.push(e),this.sortReset(n.children);else{let r=s[s.length-1];this.sortBone(r),this._updateCache.push(e),this.sortReset(n.children),r.sorted=!0}}sortPathConstraint(e){if(e.active=e.target.bone.isActive()&&(!e.data.skinRequired||this.skin&&Fe.contains(this.skin.constraints,e.data,!0)),!e.active)return;let t=e.target,s=t.data.index,n=t.bone;this.skin&&this.sortPathConstraintAttachment(this.skin,s,n),this.data.defaultSkin&&this.data.defaultSkin!=this.skin&&this.sortPathConstraintAttachment(this.data.defaultSkin,s,n);for(let h=0,l=this.data.skins.length;h<l;h++)this.sortPathConstraintAttachment(this.data.skins[h],s,n);let r=t.getAttachment();r instanceof Er&&this.sortPathConstraintAttachmentWith(r,n);let o=e.bones,a=o.length;for(let h=0;h<a;h++)this.sortBone(o[h]);this._updateCache.push(e);for(let h=0;h<a;h++)this.sortReset(o[h].children);for(let h=0;h<a;h++)o[h].sorted=!0}sortTransformConstraint(e){if(e.active=e.target.isActive()&&(!e.data.skinRequired||this.skin&&Fe.contains(this.skin.constraints,e.data,!0)),!e.active)return;this.sortBone(e.target);let t=e.bones,s=t.length;if(e.data.local)for(let n=0;n<s;n++){let r=t[n];this.sortBone(r.parent),this.sortBone(r)}else for(let n=0;n<s;n++)this.sortBone(t[n]);this._updateCache.push(e);for(let n=0;n<s;n++)this.sortReset(t[n].children);for(let n=0;n<s;n++)t[n].sorted=!0}sortPathConstraintAttachment(e,t,s){let n=e.attachments[t];if(n)for(let r in n)this.sortPathConstraintAttachmentWith(n[r],s)}sortPathConstraintAttachmentWith(e,t){if(!(e instanceof Er))return;let s=e.bones;if(!s)this.sortBone(t);else{let n=this.bones;for(let r=0,o=s.length;r<o;){let a=s[r++];for(a+=r;r<a;)this.sortBone(n[s[r++]])}}}sortPhysicsConstraint(e){const t=e.bone;e.active=t.active&&(!e.data.skinRequired||this.skin!=null&&Fe.contains(this.skin.constraints,e.data,!0)),e.active&&(this.sortBone(t),this._updateCache.push(e),this.sortReset(t.children),t.sorted=!0)}sortBone(e){if(!e||e.sorted)return;let t=e.parent;t&&this.sortBone(t),e.sorted=!0,this._updateCache.push(e)}sortReset(e){for(let t=0,s=e.length;t<s;t++){let n=e[t];n.active&&(n.sorted&&this.sortReset(n.children),n.sorted=!1)}}updateWorldTransform(e){if(e==null)throw new Error("physics is undefined");let t=this.bones;for(let n=0,r=t.length;n<r;n++){let o=t[n];o.ax=o.x,o.ay=o.y,o.arotation=o.rotation,o.ascaleX=o.scaleX,o.ascaleY=o.scaleY,o.ashearX=o.shearX,o.ashearY=o.shearY}let s=this._updateCache;for(let n=0,r=s.length;n<r;n++)s[n].update(e)}updateWorldTransformWith(e,t){if(!t)throw new Error("parent cannot be null.");let s=this.bones;for(let b=1,_=s.length;b<_;b++){let M=s[b];M.ax=M.x,M.ay=M.y,M.arotation=M.rotation,M.ascaleX=M.scaleX,M.ascaleY=M.scaleY,M.ashearX=M.shearX,M.ashearY=M.shearY}let n=this.getRootBone();if(!n)throw new Error("Root bone must not be null.");let r=t.a,o=t.b,a=t.c,h=t.d;n.worldX=r*this.x+o*this.y+t.worldX,n.worldY=a*this.x+h*this.y+t.worldY;const l=(n.rotation+n.shearX)*ke.degRad,c=(n.rotation+90+n.shearY)*ke.degRad,u=Math.cos(l)*n.scaleX,f=Math.cos(c)*n.scaleY,d=Math.sin(l)*n.scaleX,m=Math.sin(c)*n.scaleY;n.a=(r*u+o*d)*this.scaleX,n.b=(r*f+o*m)*this.scaleX,n.c=(a*u+h*d)*this.scaleY,n.d=(a*f+h*m)*this.scaleY;let g=this._updateCache;for(let b=0,_=g.length;b<_;b++){let M=g[b];M!=n&&M.update(e)}}setToSetupPose(){this.setBonesToSetupPose(),this.setSlotsToSetupPose()}setBonesToSetupPose(){for(const e of this.bones)e.setToSetupPose();for(const e of this.ikConstraints)e.setToSetupPose();for(const e of this.transformConstraints)e.setToSetupPose();for(const e of this.pathConstraints)e.setToSetupPose();for(const e of this.physicsConstraints)e.setToSetupPose()}setSlotsToSetupPose(){let e=this.slots;Fe.arrayCopy(e,0,this.drawOrder,0,e.length);for(let t=0,s=e.length;t<s;t++)e[t].setToSetupPose()}getRootBone(){return this.bones.length==0?null:this.bones[0]}findBone(e){if(!e)throw new Error("boneName cannot be null.");let t=this.bones;for(let s=0,n=t.length;s<n;s++){let r=t[s];if(r.data.name==e)return r}return null}findSlot(e){if(!e)throw new Error("slotName cannot be null.");let t=this.slots;for(let s=0,n=t.length;s<n;s++){let r=t[s];if(r.data.name==e)return r}return null}setSkinByName(e){let t=this.data.findSkin(e);if(!t)throw new Error("Skin not found: "+e);this.setSkin(t)}setSkin(e){if(e!=this.skin){if(e)if(this.skin)e.attachAll(this,this.skin);else{let t=this.slots;for(let s=0,n=t.length;s<n;s++){let r=t[s],o=r.data.attachmentName;if(o){let a=e.getAttachment(s,o);a&&r.setAttachment(a)}}}this.skin=e,this.updateCache()}}getAttachmentByName(e,t){let s=this.data.findSlot(e);if(!s)throw new Error(`Can't find slot with name ${e}`);return this.getAttachment(s.index,t)}getAttachment(e,t){if(!t)throw new Error("attachmentName cannot be null.");if(this.skin){let s=this.skin.getAttachment(e,t);if(s)return s}return this.data.defaultSkin?this.data.defaultSkin.getAttachment(e,t):null}setAttachment(e,t){if(!e)throw new Error("slotName cannot be null.");let s=this.slots;for(let n=0,r=s.length;n<r;n++){let o=s[n];if(o.data.name==e){let a=null;if(t&&(a=this.getAttachment(n,t),!a))throw new Error("Attachment not found: "+t+", for slot: "+e);o.setAttachment(a);return}}throw new Error("Slot not found: "+e)}findIkConstraint(e){if(!e)throw new Error("constraintName cannot be null.");return this.ikConstraints.find(t=>t.data.name==e)??null}findTransformConstraint(e){if(!e)throw new Error("constraintName cannot be null.");return this.transformConstraints.find(t=>t.data.name==e)??null}findPathConstraint(e){if(!e)throw new Error("constraintName cannot be null.");return this.pathConstraints.find(t=>t.data.name==e)??null}findPhysicsConstraint(e){if(e==null)throw new Error("constraintName cannot be null.");return this.physicsConstraints.find(t=>t.data.name==e)??null}getBoundsRect(e){let t=new ql,s=new ql;return this.getBounds(t,s,void 0,e),{x:t.x,y:t.y,width:s.x,height:s.y}}getBounds(e,t,s=new Array(2),n=null){if(!e)throw new Error("offset cannot be null.");if(!t)throw new Error("size cannot be null.");let r=this.drawOrder,o=Number.POSITIVE_INFINITY,a=Number.POSITIVE_INFINITY,h=Number.NEGATIVE_INFINITY,l=Number.NEGATIVE_INFINITY;for(let c=0,u=r.length;c<u;c++){let f=r[c];if(!f.bone.active)continue;let d=0,m=null,g=null,b=f.getAttachment();if(b instanceof yo)d=8,m=Fe.setArraySize(s,d,0),b.computeWorldVertices(f,m,0,2),g=to.quadTriangles;else if(b instanceof Zn){let _=b;d=_.worldVerticesLength,m=Fe.setArraySize(s,d,0),_.computeWorldVertices(f,0,d,m,0,2),g=_.triangles}else if(b instanceof zn&&n!=null){n.clipStart(f,b);continue}if(m&&g){n!=null&&n.isClipping()&&(n.clipTriangles(m,g,g.length),m=n.clippedVertices,d=n.clippedVertices.length);for(let _=0,M=m.length;_<M;_+=2){let v=m[_],S=m[_+1];o=Math.min(o,v),a=Math.min(a,S),h=Math.max(h,v),l=Math.max(l,S)}}n!=null&&n.clipEndWithSlot(f)}n!=null&&n.clipEnd(),e.set(o,a),t.set(h-o,l-a)}update(e){this.time+=e}physicsTranslate(e,t){const s=this.physicsConstraints;for(let n=0,r=s.length;n<r;n++)s[n].translate(e,t)}physicsRotate(e,t,s){const n=this.physicsConstraints;for(let r=0,o=n.length;r<o;r++)n[r].rotate(e,t,s)}};A(to,"quadTriangles",[0,1,2,2,3,0]),A(to,"yDown",!1);let ya=to;var Xn;(function(i){i[i.none=0]="none",i[i.reset=1]="reset",i[i.update=2]="update",i[i.pose=3]="pose"})(Xn||(Xn={}));class sx extends Uh{constructor(t){super(t,0,!1);A(this,"_bone",null);A(this,"x",0);A(this,"y",0);A(this,"rotate",0);A(this,"scaleX",0);A(this,"shearX",0);A(this,"limit",0);A(this,"step",0);A(this,"inertia",0);A(this,"strength",0);A(this,"damping",0);A(this,"massInverse",0);A(this,"wind",0);A(this,"gravity",0);A(this,"mix",0);A(this,"inertiaGlobal",!1);A(this,"strengthGlobal",!1);A(this,"dampingGlobal",!1);A(this,"massGlobal",!1);A(this,"windGlobal",!1);A(this,"gravityGlobal",!1);A(this,"mixGlobal",!1)}set bone(t){this._bone=t}get bone(){if(this._bone)return this._bone;throw new Error("BoneData not set.")}}class eh{constructor(){A(this,"name",null);A(this,"bones",new Array);A(this,"slots",new Array);A(this,"skins",new Array);A(this,"defaultSkin",null);A(this,"events",new Array);A(this,"animations",new Array);A(this,"ikConstraints",new Array);A(this,"transformConstraints",new Array);A(this,"pathConstraints",new Array);A(this,"physicsConstraints",new Array);A(this,"x",0);A(this,"y",0);A(this,"width",0);A(this,"height",0);A(this,"referenceScale",100);A(this,"version",null);A(this,"hash",null);A(this,"fps",0);A(this,"imagesPath",null);A(this,"audioPath",null)}findBone(e){if(!e)throw new Error("boneName cannot be null.");let t=this.bones;for(let s=0,n=t.length;s<n;s++){let r=t[s];if(r.name==e)return r}return null}findSlot(e){if(!e)throw new Error("slotName cannot be null.");let t=this.slots;for(let s=0,n=t.length;s<n;s++){let r=t[s];if(r.name==e)return r}return null}findSkin(e){if(!e)throw new Error("skinName cannot be null.");let t=this.skins;for(let s=0,n=t.length;s<n;s++){let r=t[s];if(r.name==e)return r}return null}findEvent(e){if(!e)throw new Error("eventDataName cannot be null.");let t=this.events;for(let s=0,n=t.length;s<n;s++){let r=t[s];if(r.name==e)return r}return null}findAnimation(e){if(!e)throw new Error("animationName cannot be null.");let t=this.animations;for(let s=0,n=t.length;s<n;s++){let r=t[s];if(r.name==e)return r}return null}findIkConstraint(e){if(!e)throw new Error("constraintName cannot be null.");const t=this.ikConstraints;for(let s=0,n=t.length;s<n;s++){const r=t[s];if(r.name==e)return r}return null}findTransformConstraint(e){if(!e)throw new Error("constraintName cannot be null.");const t=this.transformConstraints;for(let s=0,n=t.length;s<n;s++){const r=t[s];if(r.name==e)return r}return null}findPathConstraint(e){if(!e)throw new Error("constraintName cannot be null.");const t=this.pathConstraints;for(let s=0,n=t.length;s<n;s++){const r=t[s];if(r.name==e)return r}return null}findPhysicsConstraint(e){if(!e)throw new Error("constraintName cannot be null.");const t=this.physicsConstraints;for(let s=0,n=t.length;s<n;s++){const r=t[s];if(r.name==e)return r}return null}}class cg{constructor(e=0,t,s){A(this,"slotIndex");A(this,"name");A(this,"attachment");this.slotIndex=e,this.name=t,this.attachment=s}}class Ad{constructor(e){A(this,"name");A(this,"attachments",new Array);A(this,"bones",Array());A(this,"constraints",new Array);A(this,"color",new ot(.99607843,.61960787,.30980393,1));if(!e)throw new Error("name cannot be null.");this.name=e}setAttachment(e,t,s){if(!s)throw new Error("attachment cannot be null.");let n=this.attachments;e>=n.length&&(n.length=e+1),n[e]||(n[e]={}),n[e][t]=s}addSkin(e){for(let n=0;n<e.bones.length;n++){let r=e.bones[n],o=!1;for(let a=0;a<this.bones.length;a++)if(this.bones[a]==r){o=!0;break}o||this.bones.push(r)}for(let n=0;n<e.constraints.length;n++){let r=e.constraints[n],o=!1;for(let a=0;a<this.constraints.length;a++)if(this.constraints[a]==r){o=!0;break}o||this.constraints.push(r)}let t=e.getAttachments();for(let n=0;n<t.length;n++){var s=t[n];this.setAttachment(s.slotIndex,s.name,s.attachment)}}copySkin(e){for(let n=0;n<e.bones.length;n++){let r=e.bones[n],o=!1;for(let a=0;a<this.bones.length;a++)if(this.bones[a]==r){o=!0;break}o||this.bones.push(r)}for(let n=0;n<e.constraints.length;n++){let r=e.constraints[n],o=!1;for(let a=0;a<this.constraints.length;a++)if(this.constraints[a]==r){o=!0;break}o||this.constraints.push(r)}let t=e.getAttachments();for(let n=0;n<t.length;n++){var s=t[n];s.attachment&&(s.attachment instanceof Zn?(s.attachment=s.attachment.newLinkedMesh(),this.setAttachment(s.slotIndex,s.name,s.attachment)):(s.attachment=s.attachment.copy(),this.setAttachment(s.slotIndex,s.name,s.attachment)))}}getAttachment(e,t){let s=this.attachments[e];return s?s[t]:null}removeAttachment(e,t){let s=this.attachments[e];s&&delete s[t]}getAttachments(){let e=new Array;for(var t=0;t<this.attachments.length;t++){let s=this.attachments[t];if(s)for(let n in s){let r=s[n];r&&e.push(new cg(t,n,r))}}return e}getAttachmentsForSlot(e,t){let s=this.attachments[e];if(s)for(let n in s){let r=s[n];r&&t.push(new cg(e,n,r))}}clear(){this.attachments.length=0,this.bones.length=0,this.constraints.length=0}attachAll(e,t){let s=0;for(let n=0;n<e.slots.length;n++){let r=e.slots[n],o=r.getAttachment();if(o&&s<t.attachments.length){let a=t.attachments[s];for(let h in a){let l=a[h];if(o==l){let c=this.getAttachment(s,h);c&&r.setAttachment(c);break}}}s++}}}class nx{constructor(e,t,s){A(this,"index",0);A(this,"name");A(this,"boneData");A(this,"color",new ot(1,1,1,1));A(this,"darkColor",null);A(this,"attachmentName",null);A(this,"blendMode",Hn.Normal);A(this,"visible",!0);if(e<0)throw new Error("index must be >= 0.");if(!t)throw new Error("name cannot be null.");if(!s)throw new Error("boneData cannot be null.");this.index=e,this.name=t,this.boneData=s}}var Hn;(function(i){i[i.Normal=0]="Normal",i[i.Additive=1]="Additive",i[i.Multiply=2]="Multiply",i[i.Screen=3]="Screen"})(Hn||(Hn={}));class rx extends Uh{constructor(t){super(t,0,!1);A(this,"bones",new Array);A(this,"_target",null);A(this,"mixRotate",0);A(this,"mixX",0);A(this,"mixY",0);A(this,"mixScaleX",0);A(this,"mixScaleY",0);A(this,"mixShearY",0);A(this,"offsetRotation",0);A(this,"offsetX",0);A(this,"offsetY",0);A(this,"offsetScaleX",0);A(this,"offsetScaleY",0);A(this,"offsetShearY",0);A(this,"relative",!1);A(this,"local",!1)}set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("BoneData not set.")}}class Cd{constructor(e){A(this,"scale",1);A(this,"attachmentLoader");A(this,"linkedMeshes",new Array);this.attachmentLoader=e}readSkeletonData(e){let t=this.scale,s=new eh;s.name="";let n=new WE(e),r=n.readInt32(),o=n.readInt32();s.hash=o==0&&r==0?null:o.toString(16)+r.toString(16),s.version=n.readString(),s.x=n.readFloat(),s.y=n.readFloat(),s.width=n.readFloat(),s.height=n.readFloat(),s.referenceScale=n.readFloat()*t;let a=n.readBoolean();a&&(s.fps=n.readFloat(),s.imagesPath=n.readString(),s.audioPath=n.readString());let h=0;h=n.readInt(!0);for(let c=0;c<h;c++){let u=n.readString();if(!u)throw new Error("String in string table must not be null.");n.strings.push(u)}h=n.readInt(!0);for(let c=0;c<h;c++){let u=n.readString();if(!u)throw new Error("Bone name must not be null.");let f=c==0?null:s.bones[n.readInt(!0)],d=new Jy(c,u,f);d.rotation=n.readFloat(),d.x=n.readFloat()*t,d.y=n.readFloat()*t,d.scaleX=n.readFloat(),d.scaleY=n.readFloat(),d.shearX=n.readFloat(),d.shearY=n.readFloat(),d.length=n.readFloat()*t,d.inherit=n.readByte(),d.skinRequired=n.readBoolean(),a&&(ot.rgba8888ToColor(d.color,n.readInt32()),d.icon=n.readString()??void 0,d.visible=n.readBoolean()),s.bones.push(d)}h=n.readInt(!0);for(let c=0;c<h;c++){let u=n.readString();if(!u)throw new Error("Slot name must not be null.");let f=s.bones[n.readInt(!0)],d=new nx(c,u,f);ot.rgba8888ToColor(d.color,n.readInt32());let m=n.readInt32();m!=-1&&ot.rgb888ToColor(d.darkColor=new ot,m),d.attachmentName=n.readStringRef(),d.blendMode=n.readInt(!0),a&&(d.visible=n.readBoolean()),s.slots.push(d)}h=n.readInt(!0);for(let c=0,u;c<h;c++){let f=n.readString();if(!f)throw new Error("IK constraint data name must not be null.");let d=new tx(f);d.order=n.readInt(!0),u=n.readInt(!0);for(let g=0;g<u;g++)d.bones.push(s.bones[n.readInt(!0)]);d.target=s.bones[n.readInt(!0)];let m=n.readByte();d.skinRequired=(m&1)!=0,d.bendDirection=(m&2)!=0?1:-1,d.compress=(m&4)!=0,d.stretch=(m&8)!=0,d.uniform=(m&16)!=0,(m&32)!=0&&(d.mix=(m&64)!=0?n.readFloat():1),(m&128)!=0&&(d.softness=n.readFloat()*t),s.ikConstraints.push(d)}h=n.readInt(!0);for(let c=0,u;c<h;c++){let f=n.readString();if(!f)throw new Error("Transform constraint data name must not be null.");let d=new rx(f);d.order=n.readInt(!0),u=n.readInt(!0);for(let g=0;g<u;g++)d.bones.push(s.bones[n.readInt(!0)]);d.target=s.bones[n.readInt(!0)];let m=n.readByte();d.skinRequired=(m&1)!=0,d.local=(m&2)!=0,d.relative=(m&4)!=0,(m&8)!=0&&(d.offsetRotation=n.readFloat()),(m&16)!=0&&(d.offsetX=n.readFloat()*t),(m&32)!=0&&(d.offsetY=n.readFloat()*t),(m&64)!=0&&(d.offsetScaleX=n.readFloat()),(m&128)!=0&&(d.offsetScaleY=n.readFloat()),m=n.readByte(),(m&1)!=0&&(d.offsetShearY=n.readFloat()),(m&2)!=0&&(d.mixRotate=n.readFloat()),(m&4)!=0&&(d.mixX=n.readFloat()),(m&8)!=0&&(d.mixY=n.readFloat()),(m&16)!=0&&(d.mixScaleX=n.readFloat()),(m&32)!=0&&(d.mixScaleY=n.readFloat()),(m&64)!=0&&(d.mixShearY=n.readFloat()),s.transformConstraints.push(d)}h=n.readInt(!0);for(let c=0,u;c<h;c++){let f=n.readString();if(!f)throw new Error("Path constraint data name must not be null.");let d=new ix(f);d.order=n.readInt(!0),d.skinRequired=n.readBoolean(),u=n.readInt(!0);for(let g=0;g<u;g++)d.bones.push(s.bones[n.readInt(!0)]);d.target=s.slots[n.readInt(!0)];const m=n.readByte();d.positionMode=m&1,d.spacingMode=m>>1&3,d.rotateMode=m>>3&3,(m&128)!=0&&(d.offsetRotation=n.readFloat()),d.position=n.readFloat(),d.positionMode==Gs.Fixed&&(d.position*=t),d.spacing=n.readFloat(),(d.spacingMode==oi.Length||d.spacingMode==oi.Fixed)&&(d.spacing*=t),d.mixRotate=n.readFloat(),d.mixX=n.readFloat(),d.mixY=n.readFloat(),s.pathConstraints.push(d)}h=n.readInt(!0);for(let c=0,u;c<h;c++){const f=n.readString();if(!f)throw new Error("Physics constraint data name must not be null.");const d=new sx(f);d.order=n.readInt(!0),d.bone=s.bones[n.readInt(!0)];let m=n.readByte();d.skinRequired=(m&1)!=0,(m&2)!=0&&(d.x=n.readFloat()),(m&4)!=0&&(d.y=n.readFloat()),(m&8)!=0&&(d.rotate=n.readFloat()),(m&16)!=0&&(d.scaleX=n.readFloat()),(m&32)!=0&&(d.shearX=n.readFloat()),d.limit=((m&64)!=0?n.readFloat():5e3)*t,d.step=1/n.readUnsignedByte(),d.inertia=n.readFloat(),d.strength=n.readFloat(),d.damping=n.readFloat(),d.massInverse=(m&128)!=0?n.readFloat():1,d.wind=n.readFloat(),d.gravity=n.readFloat(),m=n.readByte(),(m&1)!=0&&(d.inertiaGlobal=!0),(m&2)!=0&&(d.strengthGlobal=!0),(m&4)!=0&&(d.dampingGlobal=!0),(m&8)!=0&&(d.massGlobal=!0),(m&16)!=0&&(d.windGlobal=!0),(m&32)!=0&&(d.gravityGlobal=!0),(m&64)!=0&&(d.mixGlobal=!0),d.mix=(m&128)!=0?n.readFloat():1,s.physicsConstraints.push(d)}let l=this.readSkin(n,s,!0,a);l&&(s.defaultSkin=l,s.skins.push(l));{let c=s.skins.length;for(Fe.setArraySize(s.skins,h=c+n.readInt(!0));c<h;c++){let u=this.readSkin(n,s,!1,a);if(!u)throw new Error("readSkin() should not have returned null.");s.skins[c]=u}}h=this.linkedMeshes.length;for(let c=0;c<h;c++){let u=this.linkedMeshes[c];const f=s.skins[u.skinIndex];if(!u.parent)throw new Error("Linked mesh parent must not be null");let d=f.getAttachment(u.slotIndex,u.parent);if(!d)throw new Error(`Parent mesh not found: ${u.parent}`);u.mesh.timelineAttachment=u.inheritTimeline?d:u.mesh,u.mesh.setParentMesh(d),u.mesh.region!=null&&u.mesh.updateRegion()}this.linkedMeshes.length=0,h=n.readInt(!0);for(let c=0;c<h;c++){let u=n.readString();if(!u)throw new Error("Event data name must not be null");let f=new ex(u);f.intValue=n.readInt(!1),f.floatValue=n.readFloat(),f.stringValue=n.readString(),f.audioPath=n.readString(),f.audioPath&&(f.volume=n.readFloat(),f.balance=n.readFloat()),s.events.push(f)}h=n.readInt(!0);for(let c=0;c<h;c++){let u=n.readString();if(!u)throw new Error("Animatio name must not be null.");s.animations.push(this.readAnimation(n,u,s))}return s}readSkin(e,t,s,n){let r=null,o=0;if(s){if(o=e.readInt(!0),o==0)return null;r=new Ad("default")}else{let a=e.readString();if(!a)throw new Error("Skin name must not be null.");r=new Ad(a),n&&ot.rgba8888ToColor(r.color,e.readInt32()),r.bones.length=e.readInt(!0);for(let h=0,l=r.bones.length;h<l;h++)r.bones[h]=t.bones[e.readInt(!0)];for(let h=0,l=e.readInt(!0);h<l;h++)r.constraints.push(t.ikConstraints[e.readInt(!0)]);for(let h=0,l=e.readInt(!0);h<l;h++)r.constraints.push(t.transformConstraints[e.readInt(!0)]);for(let h=0,l=e.readInt(!0);h<l;h++)r.constraints.push(t.pathConstraints[e.readInt(!0)]);for(let h=0,l=e.readInt(!0);h<l;h++)r.constraints.push(t.physicsConstraints[e.readInt(!0)]);o=e.readInt(!0)}for(let a=0;a<o;a++){let h=e.readInt(!0);for(let l=0,c=e.readInt(!0);l<c;l++){let u=e.readStringRef();if(!u)throw new Error("Attachment name must not be null");let f=this.readAttachment(e,t,r,h,u,n);f&&r.setAttachment(h,u,f)}}return r}readAttachment(e,t,s,n,r,o){let a=this.scale,h=e.readByte();const l=(h&8)!=0?e.readStringRef():r;if(!l)throw new Error("Attachment name must not be null");switch(h&7){case on.Region:{let c=(h&16)!=0?e.readStringRef():null;const u=(h&32)!=0?e.readInt32():4294967295,f=(h&64)!=0?this.readSequence(e):null;let d=(h&128)!=0?e.readFloat():0,m=e.readFloat(),g=e.readFloat(),b=e.readFloat(),_=e.readFloat(),M=e.readFloat(),v=e.readFloat();c||(c=l);let S=this.attachmentLoader.newRegionAttachment(s,l,c,f);return S?(S.path=c,S.x=m*a,S.y=g*a,S.scaleX=b,S.scaleY=_,S.rotation=d,S.width=M*a,S.height=v*a,ot.rgba8888ToColor(S.color,u),S.sequence=f,f==null&&S.updateRegion(),S):null}case on.BoundingBox:{let c=this.readVertices(e,(h&16)!=0),u=o?e.readInt32():0,f=this.attachmentLoader.newBoundingBoxAttachment(s,l);return f?(f.worldVerticesLength=c.length,f.vertices=c.vertices,f.bones=c.bones,o&&ot.rgba8888ToColor(f.color,u),f):null}case on.Mesh:{let c=(h&16)!=0?e.readStringRef():l;const u=(h&32)!=0?e.readInt32():4294967295,f=(h&64)!=0?this.readSequence(e):null,d=e.readInt(!0),m=this.readVertices(e,(h&128)!=0),g=this.readFloatArray(e,m.length,1),b=this.readShortArray(e,(m.length-d-2)*3);let _=[],M=0,v=0;o&&(_=this.readShortArray(e,e.readInt(!0)),M=e.readFloat(),v=e.readFloat()),c||(c=l);let S=this.attachmentLoader.newMeshAttachment(s,l,c,f);return S?(S.path=c,ot.rgba8888ToColor(S.color,u),S.bones=m.bones,S.vertices=m.vertices,S.worldVerticesLength=m.length,S.triangles=b,S.regionUVs=g,f==null&&S.updateRegion(),S.hullLength=d<<1,S.sequence=f,o&&(S.edges=_,S.width=M*a,S.height=v*a),S):null}case on.LinkedMesh:{const c=(h&16)!=0?e.readStringRef():l;if(c==null)throw new Error("Path of linked mesh must not be null");const u=(h&32)!=0?e.readInt32():4294967295,f=(h&64)!=0?this.readSequence(e):null,d=(h&128)!=0,m=e.readInt(!0),g=e.readStringRef();let b=0,_=0;o&&(b=e.readFloat(),_=e.readFloat());let M=this.attachmentLoader.newMeshAttachment(s,l,c,f);return M?(M.path=c,ot.rgba8888ToColor(M.color,u),M.sequence=f,o&&(M.width=b*a,M.height=_*a),this.linkedMeshes.push(new zE(M,m,n,g,d)),M):null}case on.Path:{const c=(h&16)!=0,u=(h&32)!=0,f=this.readVertices(e,(h&64)!=0),d=Fe.newArray(f.length/6,0);for(let b=0,_=d.length;b<_;b++)d[b]=e.readFloat()*a;const m=o?e.readInt32():0,g=this.attachmentLoader.newPathAttachment(s,l);return g?(g.closed=c,g.constantSpeed=u,g.worldVerticesLength=f.length,g.vertices=f.vertices,g.bones=f.bones,g.lengths=d,o&&ot.rgba8888ToColor(g.color,m),g):null}case on.Point:{const c=e.readFloat(),u=e.readFloat(),f=e.readFloat(),d=o?e.readInt32():0,m=this.attachmentLoader.newPointAttachment(s,l);return m?(m.x=u*a,m.y=f*a,m.rotation=c,o&&ot.rgba8888ToColor(m.color,d),m):null}case on.Clipping:{const c=e.readInt(!0),u=this.readVertices(e,(h&16)!=0);let f=o?e.readInt32():0,d=this.attachmentLoader.newClippingAttachment(s,l);return d?(d.endSlot=t.slots[c],d.worldVerticesLength=u.length,d.vertices=u.vertices,d.bones=u.bones,o&&ot.rgba8888ToColor(d.color,f),d):null}}return null}readSequence(e){let t=new Kl(e.readInt(!0));return t.start=e.readInt(!0),t.digits=e.readInt(!0),t.setupIndex=e.readInt(!0),t}readVertices(e,t){const s=this.scale,n=e.readInt(!0),r=new qE;if(r.length=n<<1,!t)return r.vertices=this.readFloatArray(e,r.length,s),r;let o=new Array,a=new Array;for(let h=0;h<n;h++){let l=e.readInt(!0);a.push(l);for(let c=0;c<l;c++)a.push(e.readInt(!0)),o.push(e.readFloat()*s),o.push(e.readFloat()*s),o.push(e.readFloat())}return r.vertices=Fe.toFloatArray(o),r.bones=a,r}readFloatArray(e,t,s){let n=new Array(t);if(s==1)for(let r=0;r<t;r++)n[r]=e.readFloat();else for(let r=0;r<t;r++)n[r]=e.readFloat()*s;return n}readShortArray(e,t){let s=new Array(t);for(let n=0;n<t;n++)s[n]=e.readInt(!0);return s}readAnimation(e,t,s){e.readInt(!0);let n=new Array,r=this.scale;for(let l=0,c=e.readInt(!0);l<c;l++){let u=e.readInt(!0);for(let f=0,d=e.readInt(!0);f<d;f++){let m=e.readByte(),g=e.readInt(!0),b=g-1;switch(m){case aA:{let _=new Jr(g,u);for(let M=0;M<g;M++)_.setFrame(M,e.readFloat(),e.readStringRef());n.push(_);break}case lA:{let _=e.readInt(!0),M=new ky(g,_,u),v=e.readFloat(),S=e.readUnsignedByte()/255,y=e.readUnsignedByte()/255,I=e.readUnsignedByte()/255,E=e.readUnsignedByte()/255;for(let C=0,R=0;M.setFrame(C,v,S,y,I,E),C!=b;C++){let B=e.readFloat(),k=e.readUnsignedByte()/255,F=e.readUnsignedByte()/255,D=e.readUnsignedByte()/255,N=e.readUnsignedByte()/255;switch(e.readByte()){case ks:M.setStepped(C);break;case Fs:gt(e,M,R++,C,0,v,B,S,k,1),gt(e,M,R++,C,1,v,B,y,F,1),gt(e,M,R++,C,2,v,B,I,D,1),gt(e,M,R++,C,3,v,B,E,N,1)}v=B,S=k,y=F,I=D,E=N}n.push(M);break}case hA:{let _=e.readInt(!0),M=new Fy(g,_,u),v=e.readFloat(),S=e.readUnsignedByte()/255,y=e.readUnsignedByte()/255,I=e.readUnsignedByte()/255;for(let E=0,C=0;M.setFrame(E,v,S,y,I),E!=b;E++){let R=e.readFloat(),B=e.readUnsignedByte()/255,k=e.readUnsignedByte()/255,F=e.readUnsignedByte()/255;switch(e.readByte()){case ks:M.setStepped(E);break;case Fs:gt(e,M,C++,E,0,v,R,S,B,1),gt(e,M,C++,E,1,v,R,y,k,1),gt(e,M,C++,E,2,v,R,I,F,1)}v=R,S=B,y=k,I=F}n.push(M);break}case cA:{let _=e.readInt(!0),M=new By(g,_,u),v=e.readFloat(),S=e.readUnsignedByte()/255,y=e.readUnsignedByte()/255,I=e.readUnsignedByte()/255,E=e.readUnsignedByte()/255,C=e.readUnsignedByte()/255,R=e.readUnsignedByte()/255,B=e.readUnsignedByte()/255;for(let k=0,F=0;M.setFrame(k,v,S,y,I,E,C,R,B),k!=b;k++){let D=e.readFloat(),N=e.readUnsignedByte()/255,j=e.readUnsignedByte()/255,O=e.readUnsignedByte()/255,L=e.readUnsignedByte()/255,P=e.readUnsignedByte()/255,X=e.readUnsignedByte()/255,U=e.readUnsignedByte()/255;switch(e.readByte()){case ks:M.setStepped(k);break;case Fs:gt(e,M,F++,k,0,v,D,S,N,1),gt(e,M,F++,k,1,v,D,y,j,1),gt(e,M,F++,k,2,v,D,I,O,1),gt(e,M,F++,k,3,v,D,E,L,1),gt(e,M,F++,k,4,v,D,C,P,1),gt(e,M,F++,k,5,v,D,R,X,1),gt(e,M,F++,k,6,v,D,B,U,1)}v=D,S=N,y=j,I=O,E=L,C=P,R=X,B=U}n.push(M);break}case uA:{let _=e.readInt(!0),M=new Ly(g,_,u),v=e.readFloat(),S=e.readUnsignedByte()/255,y=e.readUnsignedByte()/255,I=e.readUnsignedByte()/255,E=e.readUnsignedByte()/255,C=e.readUnsignedByte()/255,R=e.readUnsignedByte()/255;for(let B=0,k=0;M.setFrame(B,v,S,y,I,E,C,R),B!=b;B++){let F=e.readFloat(),D=e.readUnsignedByte()/255,N=e.readUnsignedByte()/255,j=e.readUnsignedByte()/255,O=e.readUnsignedByte()/255,L=e.readUnsignedByte()/255,P=e.readUnsignedByte()/255;switch(e.readByte()){case ks:M.setStepped(B);break;case Fs:gt(e,M,k++,B,0,v,F,S,D,1),gt(e,M,k++,B,1,v,F,y,N,1),gt(e,M,k++,B,2,v,F,I,j,1),gt(e,M,k++,B,3,v,F,E,O,1),gt(e,M,k++,B,4,v,F,C,L,1),gt(e,M,k++,B,5,v,F,R,P,1)}v=F,S=D,y=N,I=j,E=O,C=L,R=P}n.push(M);break}case dA:{let _=new Oy(g,e.readInt(!0),u),M=e.readFloat(),v=e.readUnsignedByte()/255;for(let S=0,y=0;_.setFrame(S,M,v),S!=b;S++){let I=e.readFloat(),E=e.readUnsignedByte()/255;switch(e.readByte()){case ks:_.setStepped(S);break;case Fs:gt(e,_,y++,S,0,M,I,v,E,1)}M=I,v=E}n.push(_)}}}}for(let l=0,c=e.readInt(!0);l<c;l++){let u=e.readInt(!0);for(let f=0,d=e.readInt(!0);f<d;f++){let m=e.readByte(),g=e.readInt(!0);if(m==oA){let _=new Py(g,u);for(let M=0;M<g;M++)_.setFrame(M,e.readFloat(),e.readByte());n.push(_);continue}let b=e.readInt(!0);switch(m){case KE:n.push(vi(e,new Zl(g,b,u),1));break;case ZE:n.push(Mu(e,new _y(g,b,u),r));break;case JE:n.push(vi(e,new Sy(g,b,u),r));break;case QE:n.push(vi(e,new Ty(g,b,u),r));break;case eA:n.push(Mu(e,new My(g,b,u),1));break;case tA:n.push(vi(e,new Ey(g,b,u),1));break;case iA:n.push(vi(e,new Ay(g,b,u),1));break;case sA:n.push(Mu(e,new Cy(g,b,u),1));break;case nA:n.push(vi(e,new Iy(g,b,u),1));break;case rA:n.push(vi(e,new Ry(g,b,u),1))}}}for(let l=0,c=e.readInt(!0);l<c;l++){let u=e.readInt(!0),f=e.readInt(!0),d=f-1,m=new Ny(f,e.readInt(!0),u),g=e.readByte(),b=e.readFloat(),_=(g&1)!=0?(g&2)!=0?e.readFloat():1:0,M=(g&4)!=0?e.readFloat()*r:0;for(let v=0,S=0;m.setFrame(v,b,_,M,(g&8)!=0?1:-1,(g&16)!=0,(g&32)!=0),v!=d;v++){g=e.readByte();const y=e.readFloat(),I=(g&1)!=0?(g&2)!=0?e.readFloat():1:0,E=(g&4)!=0?e.readFloat()*r:0;(g&64)!=0?m.setStepped(v):(g&128)!=0&&(gt(e,m,S++,v,0,b,y,_,I,1),gt(e,m,S++,v,1,b,y,M,E,r)),b=y,_=I,M=E}n.push(m)}for(let l=0,c=e.readInt(!0);l<c;l++){let u=e.readInt(!0),f=e.readInt(!0),d=f-1,m=new Uy(f,e.readInt(!0),u),g=e.readFloat(),b=e.readFloat(),_=e.readFloat(),M=e.readFloat(),v=e.readFloat(),S=e.readFloat(),y=e.readFloat();for(let I=0,E=0;m.setFrame(I,g,b,_,M,v,S,y),I!=d;I++){let C=e.readFloat(),R=e.readFloat(),B=e.readFloat(),k=e.readFloat(),F=e.readFloat(),D=e.readFloat(),N=e.readFloat();switch(e.readByte()){case ks:m.setStepped(I);break;case Fs:gt(e,m,E++,I,0,g,C,b,R,1),gt(e,m,E++,I,1,g,C,_,B,1),gt(e,m,E++,I,2,g,C,M,k,1),gt(e,m,E++,I,3,g,C,v,F,1),gt(e,m,E++,I,4,g,C,S,D,1),gt(e,m,E++,I,5,g,C,y,N,1)}g=C,b=R,_=B,M=k,v=F,S=D,y=N}n.push(m)}for(let l=0,c=e.readInt(!0);l<c;l++){let u=e.readInt(!0),f=s.pathConstraints[u];for(let d=0,m=e.readInt(!0);d<m;d++){const g=e.readByte(),b=e.readInt(!0),_=e.readInt(!0);switch(g){case mA:n.push(vi(e,new Vy(b,_,u),f.positionMode==Gs.Fixed?r:1));break;case gA:n.push(vi(e,new Xy(b,_,u),f.spacingMode==oi.Length||f.spacingMode==oi.Fixed?r:1));break;case vA:let M=new Yy(b,_,u),v=e.readFloat(),S=e.readFloat(),y=e.readFloat(),I=e.readFloat();for(let E=0,C=0,R=M.getFrameCount()-1;M.setFrame(E,v,S,y,I),E!=R;E++){let B=e.readFloat(),k=e.readFloat(),F=e.readFloat(),D=e.readFloat();switch(e.readByte()){case ks:M.setStepped(E);break;case Fs:gt(e,M,C++,E,0,v,B,S,k,1),gt(e,M,C++,E,1,v,B,y,F,1),gt(e,M,C++,E,2,v,B,I,D,1)}v=B,S=k,y=F,I=D}n.push(M)}}}for(let l=0,c=e.readInt(!0);l<c;l++){const u=e.readInt(!0)-1;for(let f=0,d=e.readInt(!0);f<d;f++){const m=e.readByte(),g=e.readInt(!0);if(m==MA){const _=new Jl(g,u);for(let M=0;M<g;M++)_.setFrame(M,e.readFloat());n.push(_);continue}const b=e.readInt(!0);switch(m){case yA:n.push(vi(e,new $y(g,b,u),1));break;case xA:n.push(vi(e,new Gy(g,b,u),1));break;case bA:n.push(vi(e,new jy(g,b,u),1));break;case wA:n.push(vi(e,new Hy(g,b,u),1));break;case _A:n.push(vi(e,new Wy(g,b,u),1));break;case SA:n.push(vi(e,new zy(g,b,u),1));break;case TA:n.push(vi(e,new qy(g,b,u),1))}}}for(let l=0,c=e.readInt(!0);l<c;l++){let u=s.skins[e.readInt(!0)];for(let f=0,d=e.readInt(!0);f<d;f++){let m=e.readInt(!0);for(let g=0,b=e.readInt(!0);g<b;g++){let _=e.readStringRef();if(!_)throw new Error("attachmentName must not be null.");let M=u.getAttachment(m,_),v=e.readByte(),S=e.readInt(!0),y=S-1;switch(v){case fA:{let I=M,E=I.bones,C=I.vertices,R=E?C.length/3*2:C.length,B=e.readInt(!0),k=new Dy(S,B,m,I),F=e.readFloat();for(let D=0,N=0;;D++){let j,O=e.readInt(!0);if(O==0)j=E?Fe.newFloatArray(R):C;else{j=Fe.newFloatArray(R);let P=e.readInt(!0);if(O+=P,r==1)for(let X=P;X<O;X++)j[X]=e.readFloat();else for(let X=P;X<O;X++)j[X]=e.readFloat()*r;if(!E)for(let X=0,U=j.length;X<U;X++)j[X]+=C[X]}if(k.setFrame(D,F,j),D==y)break;let L=e.readFloat();switch(e.readByte()){case ks:k.setStepped(D);break;case Fs:gt(e,k,N++,D,0,F,L,0,1,1)}F=L}n.push(k);break}case pA:{let I=new Ql(S,m,M);for(let E=0;E<S;E++){let C=e.readFloat(),R=e.readInt32();I.setFrame(E,C,wy[R&15],R>>4,e.readFloat())}n.push(I);break}}}}}let o=e.readInt(!0);if(o>0){let l=new br(o),c=s.slots.length;for(let u=0;u<o;u++){let f=e.readFloat(),d=e.readInt(!0),m=Fe.newArray(c,0);for(let M=c-1;M>=0;M--)m[M]=-1;let g=Fe.newArray(c-d,0),b=0,_=0;for(let M=0;M<d;M++){let v=e.readInt(!0);for(;b!=v;)g[_++]=b++;m[b+e.readInt(!0)]=b++}for(;b<c;)g[_++]=b++;for(let M=c-1;M>=0;M--)m[M]==-1&&(m[M]=g[--_]);l.setFrame(u,f,m)}n.push(l)}let a=e.readInt(!0);if(a>0){let l=new va(a);for(let c=0;c<a;c++){let u=e.readFloat(),f=s.events[e.readInt(!0)],d=new Qy(u,f);d.intValue=e.readInt(!1),d.floatValue=e.readFloat(),d.stringValue=e.readString(),d.stringValue==null&&(d.stringValue=f.stringValue),d.data.audioPath&&(d.volume=e.readFloat(),d.balance=e.readFloat()),l.setFrame(c,d)}n.push(l)}let h=0;for(let l=0,c=n.length;l<c;l++)h=Math.max(h,n[l].getDuration());return new df(t,n,h)}}class WE{constructor(e,t=new Array,s=0,n=new DataView(e instanceof ArrayBuffer?e:e.buffer)){A(this,"strings");A(this,"index");A(this,"buffer");this.strings=t,this.index=s,this.buffer=n}readByte(){return this.buffer.getInt8(this.index++)}readUnsignedByte(){return this.buffer.getUint8(this.index++)}readShort(){let e=this.buffer.getInt16(this.index);return this.index+=2,e}readInt32(){let e=this.buffer.getInt32(this.index);return this.index+=4,e}readInt(e){let t=this.readByte(),s=t&127;return(t&128)!=0&&(t=this.readByte(),s|=(t&127)<<7,(t&128)!=0&&(t=this.readByte(),s|=(t&127)<<14,(t&128)!=0&&(t=this.readByte(),s|=(t&127)<<21,(t&128)!=0&&(t=this.readByte(),s|=(t&127)<<28)))),e?s:s>>>1^-(s&1)}readStringRef(){let e=this.readInt(!0);return e==0?null:this.strings[e-1]}readString(){let e=this.readInt(!0);switch(e){case 0:return null;case 1:return""}e--;let t="";for(let s=0;s<e;){let n=this.readUnsignedByte();switch(n>>4){case 12:case 13:t+=String.fromCharCode((n&31)<<6|this.readByte()&63),s+=2;break;case 14:t+=String.fromCharCode((n&15)<<12|(this.readByte()&63)<<6|this.readByte()&63),s+=3;break;default:t+=String.fromCharCode(n),s++}}return t}readFloat(){let e=this.buffer.getFloat32(this.index);return this.index+=4,e}readBoolean(){return this.readByte()!=0}}let zE=class{constructor(e,t,s,n,r){A(this,"parent");A(this,"skinIndex");A(this,"slotIndex");A(this,"mesh");A(this,"inheritTimeline");this.mesh=e,this.skinIndex=t,this.slotIndex=s,this.parent=n,this.inheritTimeline=r}};class qE{constructor(e=null,t=null,s=0){A(this,"bones");A(this,"vertices");A(this,"length");this.bones=e,this.vertices=t,this.length=s}}var on;(function(i){i[i.Region=0]="Region",i[i.BoundingBox=1]="BoundingBox",i[i.Mesh=2]="Mesh",i[i.LinkedMesh=3]="LinkedMesh",i[i.Path=4]="Path",i[i.Point=5]="Point",i[i.Clipping=6]="Clipping"})(on||(on={}));function vi(i,e,t){let s=i.readFloat(),n=i.readFloat()*t;for(let r=0,o=0,a=e.getFrameCount()-1;e.setFrame(r,s,n),r!=a;r++){let h=i.readFloat(),l=i.readFloat()*t;switch(i.readByte()){case ks:e.setStepped(r);break;case Fs:gt(i,e,o++,r,0,s,h,n,l,t)}s=h,n=l}return e}function Mu(i,e,t){let s=i.readFloat(),n=i.readFloat()*t,r=i.readFloat()*t;for(let o=0,a=0,h=e.getFrameCount()-1;e.setFrame(o,s,n,r),o!=h;o++){let l=i.readFloat(),c=i.readFloat()*t,u=i.readFloat()*t;switch(i.readByte()){case ks:e.setStepped(o);break;case Fs:gt(i,e,a++,o,0,s,l,n,c,t),gt(i,e,a++,o,1,s,l,r,u,t)}s=l,n=c,r=u}return e}function gt(i,e,t,s,n,r,o,a,h,l){e.setBezier(t,s,n,r,a,i.readFloat(),i.readFloat()*l,i.readFloat(),i.readFloat()*l,o,h)}const KE=0,ZE=1,JE=2,QE=3,eA=4,tA=5,iA=6,sA=7,nA=8,rA=9,oA=10,aA=0,lA=1,hA=2,cA=3,uA=4,dA=5,fA=0,pA=1,mA=0,gA=1,vA=2,yA=0,xA=1,bA=2,wA=4,_A=5,SA=6,TA=7,MA=8,ks=1,Fs=2;class Ii{constructor(){A(this,"convexPolygons",new Array);A(this,"convexPolygonsIndices",new Array);A(this,"indicesArray",new Array);A(this,"isConcaveArray",new Array);A(this,"triangles",new Array);A(this,"polygonPool",new zl(()=>new Array));A(this,"polygonIndicesPool",new zl(()=>new Array))}triangulate(e){let t=e,s=e.length>>1,n=this.indicesArray;n.length=0;for(let a=0;a<s;a++)n[a]=a;let r=this.isConcaveArray;r.length=0;for(let a=0,h=s;a<h;++a)r[a]=Ii.isConcave(a,s,t,n);let o=this.triangles;for(o.length=0;s>3;){let a=s-1,h=0,l=1;for(;;){e:if(!r[h]){let f=n[a]<<1,d=n[h]<<1,m=n[l]<<1,g=t[f],b=t[f+1],_=t[d],M=t[d+1],v=t[m],S=t[m+1];for(let y=(l+1)%s;y!=a;y=(y+1)%s){if(!r[y])continue;let I=n[y]<<1,E=t[I],C=t[I+1];if(Ii.positiveArea(v,S,g,b,E,C)&&Ii.positiveArea(g,b,_,M,E,C)&&Ii.positiveArea(_,M,v,S,E,C))break e}break}if(l==0){do{if(!r[h])break;h--}while(h>0);break}a=h,h=l,l=(l+1)%s}o.push(n[(s+h-1)%s]),o.push(n[h]),o.push(n[(h+1)%s]),n.splice(h,1),r.splice(h,1),s--;let c=(s+h-1)%s,u=h==s?0:h;r[c]=Ii.isConcave(c,s,t,n),r[u]=Ii.isConcave(u,s,t,n)}return s==3&&(o.push(n[2]),o.push(n[0]),o.push(n[1])),o}decompose(e,t){let s=e,n=this.convexPolygons;this.polygonPool.freeAll(n),n.length=0;let r=this.convexPolygonsIndices;this.polygonIndicesPool.freeAll(r),r.length=0;let o=this.polygonIndicesPool.obtain();o.length=0;let a=this.polygonPool.obtain();a.length=0;let h=-1,l=0;for(let c=0,u=t.length;c<u;c+=3){let f=t[c]<<1,d=t[c+1]<<1,m=t[c+2]<<1,g=s[f],b=s[f+1],_=s[d],M=s[d+1],v=s[m],S=s[m+1],y=!1;if(h==f){let I=a.length-4,E=Ii.winding(a[I],a[I+1],a[I+2],a[I+3],v,S),C=Ii.winding(v,S,a[0],a[1],a[2],a[3]);E==l&&C==l&&(a.push(v),a.push(S),o.push(m),y=!0)}y||(a.length>0?(n.push(a),r.push(o)):(this.polygonPool.free(a),this.polygonIndicesPool.free(o)),a=this.polygonPool.obtain(),a.length=0,a.push(g),a.push(b),a.push(_),a.push(M),a.push(v),a.push(S),o=this.polygonIndicesPool.obtain(),o.length=0,o.push(f),o.push(d),o.push(m),l=Ii.winding(g,b,_,M,v,S),h=f)}a.length>0&&(n.push(a),r.push(o));for(let c=0,u=n.length;c<u;c++){if(o=r[c],o.length==0)continue;let f=o[0],d=o[o.length-1];a=n[c];let m=a.length-4,g=a[m],b=a[m+1],_=a[m+2],M=a[m+3],v=a[0],S=a[1],y=a[2],I=a[3],E=Ii.winding(g,b,_,M,v,S);for(let C=0;C<u;C++){if(C==c)continue;let R=r[C];if(R.length!=3)continue;let B=R[0],k=R[1],F=R[2],D=n[C],N=D[D.length-2],j=D[D.length-1];if(B!=f||k!=d)continue;let O=Ii.winding(g,b,_,M,N,j),L=Ii.winding(N,j,v,S,y,I);O==E&&L==E&&(D.length=0,R.length=0,a.push(N),a.push(j),o.push(F),g=_,b=M,_=N,M=j,C=0)}}for(let c=n.length-1;c>=0;c--)a=n[c],a.length==0&&(n.splice(c,1),this.polygonPool.free(a),o=r[c],r.splice(c,1),this.polygonIndicesPool.free(o));return n}static isConcave(e,t,s,n){let r=n[(t+e-1)%t]<<1,o=n[e]<<1,a=n[(e+1)%t]<<1;return!this.positiveArea(s[r],s[r+1],s[o],s[o+1],s[a],s[a+1])}static positiveArea(e,t,s,n,r,o){return e*(o-n)+s*(t-o)+r*(n-t)>=0}static winding(e,t,s,n,r,o){let a=s-e,h=n-t;return r*h-o*a+a*t-e*h>=0?1:-1}}class th{constructor(){A(this,"triangulator",new Ii);A(this,"clippingPolygon",new Array);A(this,"clipOutput",new Array);A(this,"clippedVertices",new Array);A(this,"clippedUVs",new Array);A(this,"clippedTriangles",new Array);A(this,"scratch",new Array);A(this,"clipAttachment",null);A(this,"clippingPolygons",null)}clipStart(e,t){if(this.clipAttachment)return 0;this.clipAttachment=t;let s=t.worldVerticesLength,n=Fe.setArraySize(this.clippingPolygon,s);t.computeWorldVertices(e,0,s,n,0,2);let r=this.clippingPolygon;th.makeClockwise(r);let o=this.clippingPolygons=this.triangulator.decompose(r,this.triangulator.triangulate(r));for(let a=0,h=o.length;a<h;a++){let l=o[a];th.makeClockwise(l),l.push(l[0]),l.push(l[1])}return o.length}clipEndWithSlot(e){this.clipAttachment&&this.clipAttachment.endSlot==e.data&&this.clipEnd()}clipEnd(){this.clipAttachment&&(this.clipAttachment=null,this.clippingPolygons=null,this.clippedVertices.length=0,this.clippedTriangles.length=0,this.clippingPolygon.length=0)}isClipping(){return this.clipAttachment!=null}clipTriangles(e,t,s,n,r,o,a,h){let l,c,u,f,d,m;typeof t=="number"?(l=s,c=n,u=r,f=o,d=a,m=h):(l=t,c=s,u=n,f=r,d=o,m=a),u&&f&&d&&typeof m=="boolean"?this.clipTrianglesRender(e,l,c,u,f,d,m):this.clipTrianglesNoRender(e,l,c)}clipTrianglesNoRender(e,t,s){let n=this.clipOutput,r=this.clippedVertices,o=this.clippedTriangles,a=this.clippingPolygons,h=a.length,l=0;r.length=0,o.length=0;for(let c=0;c<s;c+=3){let u=t[c]<<1,f=e[u],d=e[u+1];u=t[c+1]<<1;let m=e[u],g=e[u+1];u=t[c+2]<<1;let b=e[u],_=e[u+1];for(let M=0;M<h;M++){let v=r.length;if(this.clip(f,d,m,g,b,_,a[M],n)){let S=n.length;if(S==0)continue;let y=S>>1,I=this.clipOutput,E=Fe.setArraySize(r,v+y*2);for(let R=0;R<S;R+=2,v+=2){let B=I[R],k=I[R+1];E[v]=B,E[v+1]=k}v=o.length;let C=Fe.setArraySize(o,v+3*(y-2));y--;for(let R=1;R<y;R++,v+=3)C[v]=l,C[v+1]=l+R,C[v+2]=l+R+1;l+=y+1}else{let S=Fe.setArraySize(r,v+6);S[v]=f,S[v+1]=d,S[v+2]=m,S[v+3]=g,S[v+4]=b,S[v+5]=_,v=o.length;let y=Fe.setArraySize(o,v+3);y[v]=l,y[v+1]=l+1,y[v+2]=l+2,l+=3;break}}}}clipTrianglesRender(e,t,s,n,r,o,a){let h=this.clipOutput,l=this.clippedVertices,c=this.clippedTriangles,u=this.clippingPolygons,f=u.length,d=a?12:8,m=0;l.length=0,c.length=0;for(let g=0;g<s;g+=3){let b=t[g]<<1,_=e[b],M=e[b+1],v=n[b],S=n[b+1];b=t[g+1]<<1;let y=e[b],I=e[b+1],E=n[b],C=n[b+1];b=t[g+2]<<1;let R=e[b],B=e[b+1],k=n[b],F=n[b+1];for(let D=0;D<f;D++){let N=l.length;if(this.clip(_,M,y,I,R,B,u[D],h)){let j=h.length;if(j==0)continue;let O=I-B,L=R-y,P=_-R,X=B-M,U=1/(O*P+L*(M-B)),Y=j>>1,q=this.clipOutput,z=Fe.setArraySize(l,N+Y*d);for(let H=0;H<j;H+=2,N+=d){let Z=q[H],ae=q[H+1];z[N]=Z,z[N+1]=ae,z[N+2]=r.r,z[N+3]=r.g,z[N+4]=r.b,z[N+5]=r.a;let me=Z-R,_e=ae-B,te=(O*me+L*_e)*U,ve=(X*me+P*_e)*U,$=1-te-ve;z[N+6]=v*te+E*ve+k*$,z[N+7]=S*te+C*ve+F*$,a&&(z[N+8]=o.r,z[N+9]=o.g,z[N+10]=o.b,z[N+11]=o.a)}N=c.length;let ne=Fe.setArraySize(c,N+3*(Y-2));Y--;for(let H=1;H<Y;H++,N+=3)ne[N]=m,ne[N+1]=m+H,ne[N+2]=m+H+1;m+=Y+1}else{let j=Fe.setArraySize(l,N+3*d);j[N]=_,j[N+1]=M,j[N+2]=r.r,j[N+3]=r.g,j[N+4]=r.b,j[N+5]=r.a,a?(j[N+6]=v,j[N+7]=S,j[N+8]=o.r,j[N+9]=o.g,j[N+10]=o.b,j[N+11]=o.a,j[N+12]=y,j[N+13]=I,j[N+14]=r.r,j[N+15]=r.g,j[N+16]=r.b,j[N+17]=r.a,j[N+18]=E,j[N+19]=C,j[N+20]=o.r,j[N+21]=o.g,j[N+22]=o.b,j[N+23]=o.a,j[N+24]=R,j[N+25]=B,j[N+26]=r.r,j[N+27]=r.g,j[N+28]=r.b,j[N+29]=r.a,j[N+30]=k,j[N+31]=F,j[N+32]=o.r,j[N+33]=o.g,j[N+34]=o.b,j[N+35]=o.a):(j[N+6]=v,j[N+7]=S,j[N+8]=y,j[N+9]=I,j[N+10]=r.r,j[N+11]=r.g,j[N+12]=r.b,j[N+13]=r.a,j[N+14]=E,j[N+15]=C,j[N+16]=R,j[N+17]=B,j[N+18]=r.r,j[N+19]=r.g,j[N+20]=r.b,j[N+21]=r.a,j[N+22]=k,j[N+23]=F),N=c.length;let O=Fe.setArraySize(c,N+3);O[N]=m,O[N+1]=m+1,O[N+2]=m+2,m+=3;break}}}}clipTrianglesUnpacked(e,t,s,n){let r=this.clipOutput,o=this.clippedVertices,a=this.clippedUVs,h=this.clippedTriangles,l=this.clippingPolygons,c=l.length,u=0;o.length=0,a.length=0,h.length=0;for(let f=0;f<s;f+=3){let d=t[f]<<1,m=e[d],g=e[d+1],b=n[d],_=n[d+1];d=t[f+1]<<1;let M=e[d],v=e[d+1],S=n[d],y=n[d+1];d=t[f+2]<<1;let I=e[d],E=e[d+1],C=n[d],R=n[d+1];for(let B=0;B<c;B++){let k=o.length;if(this.clip(m,g,M,v,I,E,l[B],r)){let F=r.length;if(F==0)continue;let D=v-E,N=I-M,j=m-I,O=E-g,L=1/(D*j+N*(g-E)),P=F>>1,X=this.clipOutput,U=Fe.setArraySize(o,k+P*2),Y=Fe.setArraySize(a,k+P*2);for(let z=0;z<F;z+=2,k+=2){let ne=X[z],H=X[z+1];U[k]=ne,U[k+1]=H;let Z=ne-I,ae=H-E,me=(D*Z+N*ae)*L,_e=(O*Z+j*ae)*L,te=1-me-_e;Y[k]=b*me+S*_e+C*te,Y[k+1]=_*me+y*_e+R*te}k=h.length;let q=Fe.setArraySize(h,k+3*(P-2));P--;for(let z=1;z<P;z++,k+=3)q[k]=u,q[k+1]=u+z,q[k+2]=u+z+1;u+=P+1}else{let F=Fe.setArraySize(o,k+6);F[k]=m,F[k+1]=g,F[k+2]=M,F[k+3]=v,F[k+4]=I,F[k+5]=E;let D=Fe.setArraySize(a,k+6);D[k]=b,D[k+1]=_,D[k+2]=S,D[k+3]=y,D[k+4]=C,D[k+5]=R,k=h.length;let N=Fe.setArraySize(h,k+3);N[k]=u,N[k+1]=u+1,N[k+2]=u+2,u+=3;break}}}}clip(e,t,s,n,r,o,a,h){let l=h,c=!1,u;a.length%4>=2?(u=h,h=this.scratch):u=this.scratch,u.length=0,u.push(e),u.push(t),u.push(s),u.push(n),u.push(r),u.push(o),u.push(e),u.push(t),h.length=0;let f=a.length-4,d=a;for(let m=0;;m+=2){let g=d[m],b=d[m+1],_=g-d[m+2],M=b-d[m+3],v=h.length,S=u;for(let I=0,E=u.length-2;I<E;){let C=S[I],R=S[I+1];I+=2;let B=S[I],k=S[I+1],F=M*(g-B)>_*(b-k),D=M*(g-C)-_*(b-R);if(D>0){if(F){h.push(B),h.push(k);continue}let N=B-C,j=k-R,O=D/(N*M-j*_);if(O>=0&&O<=1)h.push(C+N*O),h.push(R+j*O);else{h.push(B),h.push(k);continue}}else if(F){let N=B-C,j=k-R,O=D/(N*M-j*_);if(O>=0&&O<=1)h.push(C+N*O),h.push(R+j*O),h.push(B),h.push(k);else{h.push(B),h.push(k);continue}}c=!0}if(v==h.length)return l.length=0,!0;if(h.push(h[0]),h.push(h[1]),m==f)break;let y=h;h=u,h.length=0,u=y}if(l!=h){l.length=0;for(let m=0,g=h.length-2;m<g;m++)l[m]=h[m]}else l.length=l.length-2;return c}static makeClockwise(e){let t=e,s=e.length,n=t[s-2]*t[1]-t[0]*t[s-1],r=0,o=0,a=0,h=0;for(let l=0,c=s-3;l<c;l+=2)r=t[l],o=t[l+1],a=t[l+2],h=t[l+3],n+=r*h-a*o;if(!(n<0))for(let l=0,c=s-2,u=s>>1;l<u;l+=2){let f=t[l],d=t[l+1],m=c-l;t[l]=t[m],t[l+1]=t[m+1],t[m]=f,t[m+1]=d}}}class ih{constructor(e){A(this,"attachmentLoader");A(this,"scale",1);A(this,"linkedMeshes",new Array);this.attachmentLoader=e}readSkeletonData(e){let t=this.scale,s=new eh,n=typeof e=="string"?JSON.parse(e):e,r=n.skeleton;if(r&&(s.hash=r.hash,s.version=r.spine,s.x=r.x,s.y=r.y,s.width=r.width,s.height=r.height,s.referenceScale=ee(r,"referenceScale",100)*t,s.fps=r.fps,s.imagesPath=r.images??null,s.audioPath=r.audio??null),n.bones)for(let o=0;o<n.bones.length;o++){let a=n.bones[o],h=null,l=ee(a,"parent",null);l&&(h=s.findBone(l));let c=new Jy(s.bones.length,a.name,h);c.length=ee(a,"length",0)*t,c.x=ee(a,"x",0)*t,c.y=ee(a,"y",0)*t,c.rotation=ee(a,"rotation",0),c.scaleX=ee(a,"scaleX",1),c.scaleY=ee(a,"scaleY",1),c.shearX=ee(a,"shearX",0),c.shearY=ee(a,"shearY",0),c.inherit=Fe.enumValue(jt,ee(a,"inherit","Normal")),c.skinRequired=ee(a,"skin",!1);let u=ee(a,"color",null);u&&c.color.setFromString(u),s.bones.push(c)}if(n.slots)for(let o=0;o<n.slots.length;o++){let a=n.slots[o],h=a.name,l=s.findBone(a.bone);if(!l)throw new Error(`Couldn't find bone ${a.bone} for slot ${h}`);let c=new nx(s.slots.length,h,l),u=ee(a,"color",null);u&&c.color.setFromString(u);let f=ee(a,"dark",null);f&&(c.darkColor=ot.fromString(f)),c.attachmentName=ee(a,"attachment",null),c.blendMode=Fe.enumValue(Hn,ee(a,"blend","normal")),c.visible=ee(a,"visible",!0),s.slots.push(c)}if(n.ik)for(let o=0;o<n.ik.length;o++){let a=n.ik[o],h=new tx(a.name);h.order=ee(a,"order",0),h.skinRequired=ee(a,"skin",!1);for(let c=0;c<a.bones.length;c++){let u=s.findBone(a.bones[c]);if(!u)throw new Error(`Couldn't find bone ${a.bones[c]} for IK constraint ${a.name}.`);h.bones.push(u)}let l=s.findBone(a.target);if(!l)throw new Error(`Couldn't find target bone ${a.target} for IK constraint ${a.name}.`);h.target=l,h.mix=ee(a,"mix",1),h.softness=ee(a,"softness",0)*t,h.bendDirection=ee(a,"bendPositive",!0)?1:-1,h.compress=ee(a,"compress",!1),h.stretch=ee(a,"stretch",!1),h.uniform=ee(a,"uniform",!1),s.ikConstraints.push(h)}if(n.transform)for(let o=0;o<n.transform.length;o++){let a=n.transform[o],h=new rx(a.name);h.order=ee(a,"order",0),h.skinRequired=ee(a,"skin",!1);for(let u=0;u<a.bones.length;u++){let f=a.bones[u],d=s.findBone(f);if(!d)throw new Error(`Couldn't find bone ${f} for transform constraint ${a.name}.`);h.bones.push(d)}let l=a.target,c=s.findBone(l);if(!c)throw new Error(`Couldn't find target bone ${l} for transform constraint ${a.name}.`);h.target=c,h.local=ee(a,"local",!1),h.relative=ee(a,"relative",!1),h.offsetRotation=ee(a,"rotation",0),h.offsetX=ee(a,"x",0)*t,h.offsetY=ee(a,"y",0)*t,h.offsetScaleX=ee(a,"scaleX",0),h.offsetScaleY=ee(a,"scaleY",0),h.offsetShearY=ee(a,"shearY",0),h.mixRotate=ee(a,"mixRotate",1),h.mixX=ee(a,"mixX",1),h.mixY=ee(a,"mixY",h.mixX),h.mixScaleX=ee(a,"mixScaleX",1),h.mixScaleY=ee(a,"mixScaleY",h.mixScaleX),h.mixShearY=ee(a,"mixShearY",1),s.transformConstraints.push(h)}if(n.path)for(let o=0;o<n.path.length;o++){let a=n.path[o],h=new ix(a.name);h.order=ee(a,"order",0),h.skinRequired=ee(a,"skin",!1);for(let u=0;u<a.bones.length;u++){let f=a.bones[u],d=s.findBone(f);if(!d)throw new Error(`Couldn't find bone ${f} for path constraint ${a.name}.`);h.bones.push(d)}let l=a.target,c=s.findSlot(l);if(!c)throw new Error(`Couldn't find target slot ${l} for path constraint ${a.name}.`);h.target=c,h.positionMode=Fe.enumValue(Gs,ee(a,"positionMode","Percent")),h.spacingMode=Fe.enumValue(oi,ee(a,"spacingMode","Length")),h.rotateMode=Fe.enumValue(wr,ee(a,"rotateMode","Tangent")),h.offsetRotation=ee(a,"rotation",0),h.position=ee(a,"position",0),h.positionMode==Gs.Fixed&&(h.position*=t),h.spacing=ee(a,"spacing",0),(h.spacingMode==oi.Length||h.spacingMode==oi.Fixed)&&(h.spacing*=t),h.mixRotate=ee(a,"mixRotate",1),h.mixX=ee(a,"mixX",1),h.mixY=ee(a,"mixY",h.mixX),s.pathConstraints.push(h)}if(n.physics)for(let o=0;o<n.physics.length;o++){const a=n.physics[o],h=new sx(a.name);h.order=ee(a,"order",0),h.skinRequired=ee(a,"skin",!1);const l=a.bone,c=s.findBone(l);if(c==null)throw new Error("Physics bone not found: "+l);h.bone=c,h.x=ee(a,"x",0),h.y=ee(a,"y",0),h.rotate=ee(a,"rotate",0),h.scaleX=ee(a,"scaleX",0),h.shearX=ee(a,"shearX",0),h.limit=ee(a,"limit",5e3)*t,h.step=1/ee(a,"fps",60),h.inertia=ee(a,"inertia",1),h.strength=ee(a,"strength",100),h.damping=ee(a,"damping",1),h.massInverse=1/ee(a,"mass",1),h.wind=ee(a,"wind",0),h.gravity=ee(a,"gravity",0),h.mix=ee(a,"mix",1),h.inertiaGlobal=ee(a,"inertiaGlobal",!1),h.strengthGlobal=ee(a,"strengthGlobal",!1),h.dampingGlobal=ee(a,"dampingGlobal",!1),h.massGlobal=ee(a,"massGlobal",!1),h.windGlobal=ee(a,"windGlobal",!1),h.gravityGlobal=ee(a,"gravityGlobal",!1),h.mixGlobal=ee(a,"mixGlobal",!1),s.physicsConstraints.push(h)}if(n.skins)for(let o=0;o<n.skins.length;o++){let a=n.skins[o],h=new Ad(a.name);if(a.bones)for(let l=0;l<a.bones.length;l++){let c=a.bones[l],u=s.findBone(c);if(!u)throw new Error(`Couldn't find bone ${c} for skin ${a.name}.`);h.bones.push(u)}if(a.ik)for(let l=0;l<a.ik.length;l++){let c=a.ik[l],u=s.findIkConstraint(c);if(!u)throw new Error(`Couldn't find IK constraint ${c} for skin ${a.name}.`);h.constraints.push(u)}if(a.transform)for(let l=0;l<a.transform.length;l++){let c=a.transform[l],u=s.findTransformConstraint(c);if(!u)throw new Error(`Couldn't find transform constraint ${c} for skin ${a.name}.`);h.constraints.push(u)}if(a.path)for(let l=0;l<a.path.length;l++){let c=a.path[l],u=s.findPathConstraint(c);if(!u)throw new Error(`Couldn't find path constraint ${c} for skin ${a.name}.`);h.constraints.push(u)}if(a.physics)for(let l=0;l<a.physics.length;l++){let c=a.physics[l],u=s.findPhysicsConstraint(c);if(!u)throw new Error(`Couldn't find physics constraint ${c} for skin ${a.name}.`);h.constraints.push(u)}for(let l in a.attachments){let c=s.findSlot(l);if(!c)throw new Error(`Couldn't find slot ${l} for skin ${a.name}.`);let u=a.attachments[l];for(let f in u){let d=this.readAttachment(u[f],h,c.index,f,s);d&&h.setAttachment(c.index,f,d)}}s.skins.push(h),h.name=="default"&&(s.defaultSkin=h)}for(let o=0,a=this.linkedMeshes.length;o<a;o++){let h=this.linkedMeshes[o],l=h.skin?s.findSkin(h.skin):s.defaultSkin;if(!l)throw new Error(`Skin not found: ${h.skin}`);let c=l.getAttachment(h.slotIndex,h.parent);if(!c)throw new Error(`Parent mesh not found: ${h.parent}`);h.mesh.timelineAttachment=h.inheritTimeline?c:h.mesh,h.mesh.setParentMesh(c),h.mesh.region!=null&&h.mesh.updateRegion()}if(this.linkedMeshes.length=0,n.events)for(let o in n.events){let a=n.events[o],h=new ex(o);h.intValue=ee(a,"int",0),h.floatValue=ee(a,"float",0),h.stringValue=ee(a,"string",""),h.audioPath=ee(a,"audio",null),h.audioPath&&(h.volume=ee(a,"volume",1),h.balance=ee(a,"balance",0)),s.events.push(h)}if(n.animations)for(let o in n.animations){let a=n.animations[o];this.readAnimation(a,o,s)}return s}readAttachment(e,t,s,n,r){let o=this.scale;switch(n=ee(e,"name",n),ee(e,"type","region")){case"region":{let a=ee(e,"path",n),h=this.readSequence(ee(e,"sequence",null)),l=this.attachmentLoader.newRegionAttachment(t,n,a,h);if(!l)return null;l.path=a,l.x=ee(e,"x",0)*o,l.y=ee(e,"y",0)*o,l.scaleX=ee(e,"scaleX",1),l.scaleY=ee(e,"scaleY",1),l.rotation=ee(e,"rotation",0),l.width=e.width*o,l.height=e.height*o,l.sequence=h;let c=ee(e,"color",null);return c&&l.color.setFromString(c),l.region!=null&&l.updateRegion(),l}case"boundingbox":{let a=this.attachmentLoader.newBoundingBoxAttachment(t,n);if(!a)return null;this.readVertices(e,a,e.vertexCount<<1);let h=ee(e,"color",null);return h&&a.color.setFromString(h),a}case"mesh":case"linkedmesh":{let a=ee(e,"path",n),h=this.readSequence(ee(e,"sequence",null)),l=this.attachmentLoader.newMeshAttachment(t,n,a,h);if(!l)return null;l.path=a;let c=ee(e,"color",null);c&&l.color.setFromString(c),l.width=ee(e,"width",0)*o,l.height=ee(e,"height",0)*o,l.sequence=h;let u=ee(e,"parent",null);if(u)return this.linkedMeshes.push(new EA(l,ee(e,"skin",null),s,u,ee(e,"timelines",!0))),l;let f=e.uvs;return this.readVertices(e,l,f.length),l.triangles=e.triangles,l.regionUVs=f,l.region!=null&&l.updateRegion(),l.edges=ee(e,"edges",null),l.hullLength=ee(e,"hull",0)*2,l}case"path":{let a=this.attachmentLoader.newPathAttachment(t,n);if(!a)return null;a.closed=ee(e,"closed",!1),a.constantSpeed=ee(e,"constantSpeed",!0);let h=e.vertexCount;this.readVertices(e,a,h<<1);let l=Fe.newArray(h/3,0);for(let u=0;u<e.lengths.length;u++)l[u]=e.lengths[u]*o;a.lengths=l;let c=ee(e,"color",null);return c&&a.color.setFromString(c),a}case"point":{let a=this.attachmentLoader.newPointAttachment(t,n);if(!a)return null;a.x=ee(e,"x",0)*o,a.y=ee(e,"y",0)*o,a.rotation=ee(e,"rotation",0);let h=ee(e,"color",null);return h&&a.color.setFromString(h),a}case"clipping":{let a=this.attachmentLoader.newClippingAttachment(t,n);if(!a)return null;let h=ee(e,"end",null);h&&(a.endSlot=r.findSlot(h));let l=e.vertexCount;this.readVertices(e,a,l<<1);let c=ee(e,"color",null);return c&&a.color.setFromString(c),a}}return null}readSequence(e){if(e==null)return null;let t=new Kl(ee(e,"count",0));return t.start=ee(e,"start",1),t.digits=ee(e,"digits",0),t.setupIndex=ee(e,"setup",0),t}readVertices(e,t,s){let n=this.scale;t.worldVerticesLength=s;let r=e.vertices;if(s==r.length){let h=Fe.toFloatArray(r);if(n!=1)for(let l=0,c=r.length;l<c;l++)h[l]*=n;t.vertices=h;return}let o=new Array,a=new Array;for(let h=0,l=r.length;h<l;){let c=r[h++];a.push(c);for(let u=h+c*4;h<u;h+=4)a.push(r[h]),o.push(r[h+1]*n),o.push(r[h+2]*n),o.push(r[h+3])}t.bones=a,t.vertices=Fe.toFloatArray(o)}readAnimation(e,t,s){let n=this.scale,r=new Array;if(e.slots)for(let a in e.slots){let h=e.slots[a],l=s.findSlot(a);if(!l)throw new Error("Slot not found: "+a);let c=l.index;for(let u in h){let f=h[u];if(!f)continue;let d=f.length;if(u=="attachment"){let m=new Jr(d,c);for(let g=0;g<d;g++){let b=f[g];m.setFrame(g,ee(b,"time",0),ee(b,"name",null))}r.push(m)}else if(u=="rgba"){let m=new ky(d,d<<2,c),g=f[0],b=ee(g,"time",0),_=ot.fromString(g.color);for(let M=0,v=0;;M++){m.setFrame(M,b,_.r,_.g,_.b,_.a);let S=f[M+1];if(!S){m.shrink(v);break}let y=ee(S,"time",0),I=ot.fromString(S.color),E=g.curve;E&&(v=yt(E,m,v,M,0,b,y,_.r,I.r,1),v=yt(E,m,v,M,1,b,y,_.g,I.g,1),v=yt(E,m,v,M,2,b,y,_.b,I.b,1),v=yt(E,m,v,M,3,b,y,_.a,I.a,1)),b=y,_=I,g=S}r.push(m)}else if(u=="rgb"){let m=new Fy(d,d*3,c),g=f[0],b=ee(g,"time",0),_=ot.fromString(g.color);for(let M=0,v=0;;M++){m.setFrame(M,b,_.r,_.g,_.b);let S=f[M+1];if(!S){m.shrink(v);break}let y=ee(S,"time",0),I=ot.fromString(S.color),E=g.curve;E&&(v=yt(E,m,v,M,0,b,y,_.r,I.r,1),v=yt(E,m,v,M,1,b,y,_.g,I.g,1),v=yt(E,m,v,M,2,b,y,_.b,I.b,1)),b=y,_=I,g=S}r.push(m)}else if(u=="alpha")r.push(ss(f,new Oy(d,d,c),0,1));else if(u=="rgba2"){let m=new By(d,d*7,c),g=f[0],b=ee(g,"time",0),_=ot.fromString(g.light),M=ot.fromString(g.dark);for(let v=0,S=0;;v++){m.setFrame(v,b,_.r,_.g,_.b,_.a,M.r,M.g,M.b);let y=f[v+1];if(!y){m.shrink(S);break}let I=ee(y,"time",0),E=ot.fromString(y.light),C=ot.fromString(y.dark),R=g.curve;R&&(S=yt(R,m,S,v,0,b,I,_.r,E.r,1),S=yt(R,m,S,v,1,b,I,_.g,E.g,1),S=yt(R,m,S,v,2,b,I,_.b,E.b,1),S=yt(R,m,S,v,3,b,I,_.a,E.a,1),S=yt(R,m,S,v,4,b,I,M.r,C.r,1),S=yt(R,m,S,v,5,b,I,M.g,C.g,1),S=yt(R,m,S,v,6,b,I,M.b,C.b,1)),b=I,_=E,M=C,g=y}r.push(m)}else if(u=="rgb2"){let m=new Ly(d,d*6,c),g=f[0],b=ee(g,"time",0),_=ot.fromString(g.light),M=ot.fromString(g.dark);for(let v=0,S=0;;v++){m.setFrame(v,b,_.r,_.g,_.b,M.r,M.g,M.b);let y=f[v+1];if(!y){m.shrink(S);break}let I=ee(y,"time",0),E=ot.fromString(y.light),C=ot.fromString(y.dark),R=g.curve;R&&(S=yt(R,m,S,v,0,b,I,_.r,E.r,1),S=yt(R,m,S,v,1,b,I,_.g,E.g,1),S=yt(R,m,S,v,2,b,I,_.b,E.b,1),S=yt(R,m,S,v,3,b,I,M.r,C.r,1),S=yt(R,m,S,v,4,b,I,M.g,C.g,1),S=yt(R,m,S,v,5,b,I,M.b,C.b,1)),b=I,_=E,M=C,g=y}r.push(m)}}}if(e.bones)for(let a in e.bones){let h=e.bones[a],l=s.findBone(a);if(!l)throw new Error("Bone not found: "+a);let c=l.index;for(let u in h){let f=h[u],d=f.length;if(d!=0){if(u==="rotate")r.push(ss(f,new Zl(d,d,c),0,1));else if(u==="translate"){let m=new _y(d,d<<1,c);r.push(Eu(f,m,"x","y",0,n))}else if(u==="translatex"){let m=new Sy(d,d,c);r.push(ss(f,m,0,n))}else if(u==="translatey"){let m=new Ty(d,d,c);r.push(ss(f,m,0,n))}else if(u==="scale"){let m=new My(d,d<<1,c);r.push(Eu(f,m,"x","y",1,1))}else if(u==="scalex"){let m=new Ey(d,d,c);r.push(ss(f,m,1,1))}else if(u==="scaley"){let m=new Ay(d,d,c);r.push(ss(f,m,1,1))}else if(u==="shear"){let m=new Cy(d,d<<1,c);r.push(Eu(f,m,"x","y",0,1))}else if(u==="shearx"){let m=new Iy(d,d,c);r.push(ss(f,m,0,1))}else if(u==="sheary"){let m=new Ry(d,d,c);r.push(ss(f,m,0,1))}else if(u==="inherit"){let m=new Py(d,l.index);for(let g=0;g<f.length;g++){let b=f[g];m.setFrame(g,ee(b,"time",0),Fe.enumValue(jt,ee(b,"inherit","Normal")))}r.push(m)}}}}if(e.ik)for(let a in e.ik){let h=e.ik[a],l=h[0];if(!l)continue;let c=s.findIkConstraint(a);if(!c)throw new Error("IK Constraint not found: "+a);let u=s.ikConstraints.indexOf(c),f=new Ny(h.length,h.length<<1,u),d=ee(l,"time",0),m=ee(l,"mix",1),g=ee(l,"softness",0)*n;for(let b=0,_=0;;b++){f.setFrame(b,d,m,g,ee(l,"bendPositive",!0)?1:-1,ee(l,"compress",!1),ee(l,"stretch",!1));let M=h[b+1];if(!M){f.shrink(_);break}let v=ee(M,"time",0),S=ee(M,"mix",1),y=ee(M,"softness",0)*n,I=l.curve;I&&(_=yt(I,f,_,b,0,d,v,m,S,1),_=yt(I,f,_,b,1,d,v,g,y,n)),d=v,m=S,g=y,l=M}r.push(f)}if(e.transform)for(let a in e.transform){let h=e.transform[a],l=h[0];if(!l)continue;let c=s.findTransformConstraint(a);if(!c)throw new Error("Transform constraint not found: "+a);let u=s.transformConstraints.indexOf(c),f=new Uy(h.length,h.length*6,u),d=ee(l,"time",0),m=ee(l,"mixRotate",1),g=ee(l,"mixX",1),b=ee(l,"mixY",g),_=ee(l,"mixScaleX",1),M=ee(l,"mixScaleY",_),v=ee(l,"mixShearY",1);for(let S=0,y=0;;S++){f.setFrame(S,d,m,g,b,_,M,v);let I=h[S+1];if(!I){f.shrink(y);break}let E=ee(I,"time",0),C=ee(I,"mixRotate",1),R=ee(I,"mixX",1),B=ee(I,"mixY",R),k=ee(I,"mixScaleX",1),F=ee(I,"mixScaleY",k),D=ee(I,"mixShearY",1),N=l.curve;N&&(y=yt(N,f,y,S,0,d,E,m,C,1),y=yt(N,f,y,S,1,d,E,g,R,1),y=yt(N,f,y,S,2,d,E,b,B,1),y=yt(N,f,y,S,3,d,E,_,k,1),y=yt(N,f,y,S,4,d,E,M,F,1),y=yt(N,f,y,S,5,d,E,v,D,1)),d=E,m=C,g=R,b=B,_=k,M=F,_=k,l=I}r.push(f)}if(e.path)for(let a in e.path){let h=e.path[a],l=s.findPathConstraint(a);if(!l)throw new Error("Path constraint not found: "+a);let c=s.pathConstraints.indexOf(l);for(let u in h){let f=h[u],d=f[0];if(!d)continue;let m=f.length;if(u==="position"){let g=new Vy(m,m,c);r.push(ss(f,g,0,l.positionMode==Gs.Fixed?n:1))}else if(u==="spacing"){let g=new Xy(m,m,c);r.push(ss(f,g,0,l.spacingMode==oi.Length||l.spacingMode==oi.Fixed?n:1))}else if(u==="mix"){let g=new Yy(m,m*3,c),b=ee(d,"time",0),_=ee(d,"mixRotate",1),M=ee(d,"mixX",1),v=ee(d,"mixY",M);for(let S=0,y=0;;S++){g.setFrame(S,b,_,M,v);let I=f[S+1];if(!I){g.shrink(y);break}let E=ee(I,"time",0),C=ee(I,"mixRotate",1),R=ee(I,"mixX",1),B=ee(I,"mixY",R),k=d.curve;k&&(y=yt(k,g,y,S,0,b,E,_,C,1),y=yt(k,g,y,S,1,b,E,M,R,1),y=yt(k,g,y,S,2,b,E,v,B,1)),b=E,_=C,M=R,v=B,d=I}r.push(g)}}}if(e.physics)for(let a in e.physics){let h=e.physics[a],l=-1;if(a.length>0){let c=s.findPhysicsConstraint(a);if(!c)throw new Error("Physics constraint not found: "+a);l=s.physicsConstraints.indexOf(c)}for(let c in h){let u=h[c],f=u[0];if(!f)continue;let d=u.length;if(c=="reset"){const g=new Jl(d,l);for(let b=0;f!=null;f=u[b+1],b++)g.setFrame(b,ee(f,"time",0));r.push(g);continue}let m;if(c=="inertia")m=new $y(d,d,l);else if(c=="strength")m=new Gy(d,d,l);else if(c=="damping")m=new jy(d,d,l);else if(c=="mass")m=new Hy(d,d,l);else if(c=="wind")m=new Wy(d,d,l);else if(c=="gravity")m=new zy(d,d,l);else if(c=="mix")m=new qy(d,d,l);else continue;r.push(ss(u,m,0,1))}}if(e.attachments)for(let a in e.attachments){let h=e.attachments[a],l=s.findSkin(a);if(!l)throw new Error("Skin not found: "+a);for(let c in h){let u=h[c],f=s.findSlot(c);if(!f)throw new Error("Slot not found: "+c);let d=f.index;for(let m in u){let g=u[m],b=l.getAttachment(d,m);for(let _ in g){let M=g[_],v=M[0];if(v){if(_=="deform"){let S=b.bones,y=b.vertices,I=S?y.length/3*2:y.length,E=new Dy(M.length,M.length,d,b),C=ee(v,"time",0);for(let R=0,B=0;;R++){let k,F=ee(v,"vertices",null);if(!F)k=S?Fe.newFloatArray(I):y;else{k=Fe.newFloatArray(I);let O=ee(v,"offset",0);if(Fe.arrayCopy(F,0,k,O,F.length),n!=1)for(let L=O,P=L+F.length;L<P;L++)k[L]*=n;if(!S)for(let L=0;L<I;L++)k[L]+=y[L]}E.setFrame(R,C,k);let D=M[R+1];if(!D){E.shrink(B);break}let N=ee(D,"time",0),j=v.curve;j&&(B=yt(j,E,B,R,0,C,N,0,1,1)),C=N,v=D}r.push(E)}else if(_=="sequence"){let S=new Ql(M.length,d,b),y=0;for(let I=0;I<M.length;I++){let E=ee(v,"delay",y),C=ee(v,"time",0),R=fi[ee(v,"mode","hold")],B=ee(v,"index",0);S.setFrame(I,C,R,B,E),y=E,v=M[I+1]}r.push(S)}}}}}}if(e.drawOrder){let a=new br(e.drawOrder.length),h=s.slots.length,l=0;for(let c=0;c<e.drawOrder.length;c++,l++){let u=e.drawOrder[c],f=null,d=ee(u,"offsets",null);if(d){f=Fe.newArray(h,-1);let m=Fe.newArray(h-d.length,0),g=0,b=0;for(let _=0;_<d.length;_++){let M=d[_],v=s.findSlot(M.slot);if(!v)throw new Error("Slot not found: "+v);let S=v.index;for(;g!=S;)m[b++]=g++;f[g+M.offset]=g++}for(;g<h;)m[b++]=g++;for(let _=h-1;_>=0;_--)f[_]==-1&&(f[_]=m[--b])}a.setFrame(l,ee(u,"time",0),f)}r.push(a)}if(e.events){let a=new va(e.events.length),h=0;for(let l=0;l<e.events.length;l++,h++){let c=e.events[l],u=s.findEvent(c.name);if(!u)throw new Error("Event not found: "+c.name);let f=new Qy(Fe.toSinglePrecision(ee(c,"time",0)),u);f.intValue=ee(c,"int",u.intValue),f.floatValue=ee(c,"float",u.floatValue),f.stringValue=ee(c,"string",u.stringValue),f.data.audioPath&&(f.volume=ee(c,"volume",1),f.balance=ee(c,"balance",0)),a.setFrame(h,f)}r.push(a)}let o=0;for(let a=0,h=r.length;a<h;a++)o=Math.max(o,r[a].getDuration());s.animations.push(new df(t,r,o))}}class EA{constructor(e,t,s,n,r){A(this,"parent");A(this,"skin");A(this,"slotIndex");A(this,"mesh");A(this,"inheritTimeline");this.mesh=e,this.skin=t,this.slotIndex=s,this.parent=n,this.inheritTimeline=r}}function ss(i,e,t,s){let n=i[0],r=ee(n,"time",0),o=ee(n,"value",t)*s,a=0;for(let h=0;;h++){e.setFrame(h,r,o);let l=i[h+1];if(!l)return e.shrink(a),e;let c=ee(l,"time",0),u=ee(l,"value",t)*s;n.curve&&(a=yt(n.curve,e,a,h,0,r,c,o,u,s)),r=c,o=u,n=l}}function Eu(i,e,t,s,n,r){let o=i[0],a=ee(o,"time",0),h=ee(o,t,n)*r,l=ee(o,s,n)*r,c=0;for(let u=0;;u++){e.setFrame(u,a,h,l);let f=i[u+1];if(!f)return e.shrink(c),e;let d=ee(f,"time",0),m=ee(f,t,n)*r,g=ee(f,s,n)*r,b=o.curve;b&&(c=yt(b,e,c,u,0,a,d,h,m,r),c=yt(b,e,c,u,1,a,d,l,g,r)),a=d,h=m,l=g,o=f}}function yt(i,e,t,s,n,r,o,a,h,l){if(i=="stepped")return e.setStepped(s),t;let c=n<<2,u=i[c],f=i[c+1]*l,d=i[c+2],m=i[c+3]*l;return e.setBezier(t,s,n,r,a,u,f,d,m,o,h),t+1}function ee(i,e,t){return i[e]!==void 0?i[e]:t}typeof Math.fround>"u"&&(Math.fround=(function(i){return function(e){return i[0]=e,i[0]}})(new Float32Array(1)));const an=class an extends UE{constructor(t){super(t.resource.source);A(this,"texture");this.texture=et.from(t)}static from(t){return an.textureMap.has(t)?an.textureMap.get(t):new an(t)}setFilters(t,s){this.texture.baseTexture.scaleMode=an.toPixiTextureFilter(t),this.texture.baseTexture.mipmap=an.toPixiMipMap(t)}setWraps(t,s){this.texture.baseTexture.wrapMode=an.toPixiTextureWrap(t)}dispose(){this.texture.destroy()}static toPixiTextureFilter(t){switch(t){case hi.Nearest:case hi.MipMapNearestLinear:case hi.MipMapNearestNearest:return as.NEAREST;case hi.Linear:case hi.MipMapLinearLinear:case hi.MipMapLinearNearest:return as.LINEAR;default:throw new Error(`Unknown texture filter: ${String(t)}`)}}static toPixiMipMap(t){switch(t){case hi.Nearest:case hi.Linear:return Ki.OFF;case hi.MipMapNearestLinear:case hi.MipMapNearestNearest:case hi.MipMapLinearLinear:case hi.MipMapLinearNearest:return Ki.ON;default:throw new Error(`Unknown texture filter: ${String(t)}`)}}static toPixiTextureWrap(t){switch(t){case yn.ClampToEdge:return us.CLAMP;case yn.MirroredRepeat:return us.MIRRORED_REPEAT;case yn.Repeat:return us.REPEAT;default:throw new Error(`Unknown texture wrap: ${String(t)}`)}}static toPixiBlending(t){switch(t){case Hn.Normal:return Qe.NORMAL;case Hn.Additive:return Qe.ADD;case Hn.Multiply:return Qe.MULTIPLY;case Hn.Screen:return Qe.SCREEN;default:throw new Error(`Unknown blendMode: ${String(t)}`)}}};A(an,"textureMap",new Map);let Ar=an;const ln=class ln extends ma{constructor(){const t=new hf;t.getBuffer("aVertexPosition").static=!1,t.getBuffer("aTextureCoord").static=!1;const s=new jl(et.EMPTY);super(t,s);A(this,"name","");A(this,"warnedTwoTint",!1)}updateFromSpineData(t,s,n,r,o,a,h,l){var _,M;this.texture=t.texture;const c=o/(l?12:8)*2,u=this.geometry.getBuffer("aTextureCoord");((_=u.data)==null?void 0:_.length)!==c&&(u.data=new Float32Array(c));const f=this.geometry.getBuffer("aVertexPosition");((M=f.data)==null?void 0:M.length)!==c&&(f.data=new Float32Array(c));let d=0,m=u.data,g=f.data;for(let v=0;v<o;v+=l?12:8){let S=v;g[d]=r[S++],g[d+1]=r[S++],S+=4,m[d]=r[S++],m[d+1]=r[S++],d+=2}l&&!this.warnedTwoTint&&(console.warn("DarkTint is not enabled by default. To enable use a DarkSlotMesh factory while creating the Spine object."),this.warnedTwoTint=!0),ln.auxColor[0]=r[2],ln.auxColor[1]=r[3],ln.auxColor[2]=r[4],ln.auxColor[3]=r[5],this.tint=ln.auxColor,this.alpha=ln.auxColor[3],this.blendMode=Ar.toPixiBlending(s);const b=this.geometry.indexBuffer;if(b.data.length!==a.length)b.data=new Uint32Array(a);else{const v=b.data;for(let S=0;S<h;S++)v[S]=a[S]}this.name=n,u.update(),f.update(),b.update()}};A(ln,"auxColor",[0,0,0,0]);let Id=ln;class AA extends Hs{constructor(e=!1){super();const t=new Nt(void 0),s=new Nt(void 0,!0),n=new Nt(void 0,!0,!0);this.addAttribute("aVertexPosition",t,2,!1,je.FLOAT),this.addAttribute("aTextureCoord",s,2,!1,je.FLOAT),this.addIndex(n)}}const CA=`
|
||
attribute vec2 aVertexPosition;
|
||
attribute vec2 aTextureCoord;
|
||
|
||
uniform mat3 projectionMatrix;
|
||
uniform mat3 translationMatrix;
|
||
uniform mat3 uTextureMatrix;
|
||
|
||
varying vec2 vTextureCoord;
|
||
|
||
void main(void)
|
||
{
|
||
gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
|
||
|
||
vTextureCoord = (uTextureMatrix * vec3(aTextureCoord, 1.0)).xy;
|
||
}
|
||
`,IA=`
|
||
varying vec2 vTextureCoord;
|
||
uniform vec4 uColor;
|
||
uniform vec4 uDarkColor;
|
||
|
||
uniform sampler2D uSampler;
|
||
|
||
void main(void)
|
||
{
|
||
vec4 texColor = texture2D(uSampler, vTextureCoord);
|
||
gl_FragColor.a = texColor.a * uColor.a;
|
||
gl_FragColor.rgb = ((texColor.a - 1.0) * uDarkColor.a + 1.0 - texColor.rgb) * uDarkColor.rgb + texColor.rgb * uColor.rgb;
|
||
}
|
||
`;class RA extends ps{constructor(t){const s={uSampler:t??et.EMPTY,alpha:1,uTextureMatrix:Vt.IDENTITY,uColor:new Float32Array([1,1,1,1]),uDarkColor:new Float32Array([0,0,0,0])},n={tint:16777215,darkTint:0,alpha:1,pluginName:"darkTintBatch"};super(Vs.from(CA,IA),s);A(this,"uvMatrix");A(this,"batchable");A(this,"pluginName");A(this,"_tintRGB");A(this,"_darkTintRGB");A(this,"_colorDirty");A(this,"_alpha");A(this,"_tintColor");A(this,"_darkTintColor");this._colorDirty=!1,this.uvMatrix=new sf(s.uSampler),this.batchable=!0,this.pluginName=n.pluginName,this._tintColor=new At(n.tint),this._darkTintColor=new At(n.darkTint),this._tintRGB=this._tintColor.toLittleEndianNumber(),this._darkTintRGB=this._darkTintColor.toLittleEndianNumber(),this._alpha=n.alpha,this._colorDirty=!0}get texture(){return this.uniforms.uSampler}set texture(t){this.uniforms.uSampler!==t&&(!this.uniforms.uSampler.baseTexture.alphaMode!=!t.baseTexture.alphaMode&&(this._colorDirty=!0),this.uniforms.uSampler=t,this.uvMatrix.texture=t)}set alpha(t){t!==this._alpha&&(this._alpha=t,this._colorDirty=!0)}get alpha(){return this._alpha}set tint(t){t!==this.tint&&(this._tintColor.setValue(t),this._tintRGB=this._tintColor.toLittleEndianNumber(),this._colorDirty=!0)}get tint(){return this._tintColor.value}set darkTint(t){t!==this.darkTint&&(this._darkTintColor.setValue(t),this._darkTintRGB=this._darkTintColor.toLittleEndianNumber(),this._colorDirty=!0)}get darkTint(){return this._darkTintColor.value}get tintValue(){return this._tintColor.toNumber()}get darkTintValue(){return this._darkTintColor.toNumber()}update(){this._colorDirty&&(this._colorDirty=!1,At.shared.setValue(this._tintColor).premultiply(this._alpha,!0).toArray(this.uniforms.uColor),At.shared.setValue(this._darkTintColor).premultiply(this._alpha,!0).premultiply(1,!1).toArray(this.uniforms.uDarkColor)),this.uvMatrix.update()&&(this.uniforms.uTextureMatrix=this.uvMatrix.mapCoord)}}class PA extends ma{constructor(t){super(new AA,new RA(t),void 0,void 0);A(this,"_darkTintRGB",0)}get darkTint(){return"darkTint"in this.shader?this.shader.darkTint:null}set darkTint(t){this.shader.darkTint=t}get darkTintValue(){return this.shader.darkTintValue}_renderToBatch(t){const s=this.geometry,n=this.shader;n.uvMatrix&&(n.uvMatrix.update(),this.calculateUvs()),this.calculateVertices(),this.indices=s.indexBuffer.data,this._tintRGB=n._tintRGB,this._darkTintRGB=n._darkTintRGB,this._texture=n.texture;const r=this.material.pluginName;t.batch.setObjectRenderer(t.plugins[r]),t.plugins[r].render(this)}}const ii=class ii extends PA{constructor(){super();A(this,"name","")}updateFromSpineData(t,s,n,r,o,a,h,l){var _,M;this.texture=t.texture;const c=o/(l?12:8)*2,u=this.geometry.getBuffer("aTextureCoord");((_=u.data)==null?void 0:_.length)!==c&&(u.data=new Float32Array(c));const f=this.geometry.getBuffer("aVertexPosition");((M=f.data)==null?void 0:M.length)!==c&&(f.data=new Float32Array(c));let d=0,m=u.data,g=f.data;for(let v=0;v<o;v+=l?12:8){let S=v;g[d]=r[S++],g[d+1]=r[S++],S+=4,m[d]=r[S++],m[d+1]=r[S++],d+=2}l?(ii.auxColor[0]=r[8],ii.auxColor[1]=r[9],ii.auxColor[2]=r[10],ii.auxColor[3]=r[11],this.darkTint=ii.auxColor,ii.auxColor[0]=r[2],ii.auxColor[1]=r[3],ii.auxColor[2]=r[4],ii.auxColor[3]=r[5],this.tint=ii.auxColor):(ii.auxColor[0]=r[2],ii.auxColor[1]=r[3],ii.auxColor[2]=r[4],ii.auxColor[3]=r[5],this.tint=ii.auxColor),this.blendMode=Ar.toPixiBlending(s),this.alpha=ii.auxColor[3];const b=this.geometry.indexBuffer;if(b.data.length!==a.length)b.data=new Uint32Array(a);else{const v=b.data;for(let S=0;S<h;S++)v[S]=a[S]}this.name=n,u.update(),f.update(),b.update()}};A(ii,"auxColor",[0,0,0,0]);let sa=ii;const St=class St extends gi{constructor(t,s){if(t instanceof eh)t={...s,skeletonData:t};else if(s)throw new Error("You cannot use options and oldOptions together.");super();A(this,"skeleton");A(this,"state");A(this,"darkTint",!1);A(this,"hasNeverUpdated",!0);A(this,"_debug");A(this,"slotMeshFactory",()=>new Id);A(this,"beforeUpdateWorldTransforms",()=>{});A(this,"afterUpdateWorldTransforms",()=>{});A(this,"_autoUpdate",!1);A(this,"_ticker",Ei.shared);A(this,"meshesCache",new Map);A(this,"lightColor",new ot);A(this,"darkColor",new ot);A(this,"_boundsProvider");A(this,"_boundsPoint",new bt);A(this,"_boundsSpineID",-1);A(this,"_boundsSpineDirty",!0);A(this,"slotsObject",new Map);A(this,"verticesCache",Fe.newFloatArray(1024));A(this,"clippingSlotToPixiMasks",{});A(this,"currentClippingSlot");const n=t instanceof eh?t:t.skeletonData;this.skeleton=new ya(n);const r=new NE(n);this.state=new Td(r),(t==null?void 0:t.darkTint)!==void 0||(s==null?void 0:s.slotMeshFactory)===void 0?(this.darkTint=(t==null?void 0:t.darkTint)===void 0?this.skeleton.slots.some(o=>!!o.data.darkColor):t==null?void 0:t.darkTint,this.darkTint&&(this.slotMeshFactory=()=>new sa)):this.initializeMeshFactory(s==null?void 0:s.slotMeshFactory),t!=null&&t.ticker&&(this._ticker=t.ticker),this.autoUpdate=(t==null?void 0:t.autoUpdate)??!0,this.boundsProvider=t.boundsProvider}get debug(){return this._debug}set debug(t){this._debug&&this._debug.unregisterSpine(this),t&&t.registerSpine(this),this._debug=t}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t&&!this._autoUpdate?this._ticker.add(this.internalUpdate,this):!t&&this._autoUpdate&&this._ticker.remove(this.internalUpdate,this),this._autoUpdate=t}get ticker(){return this._ticker}set ticker(t){t=t??Ei.shared,this._ticker!==t&&(this._autoUpdate&&(this._ticker.remove(this.internalUpdate,this),t.add(this.internalUpdate,this)),this._ticker=t)}get boundsProvider(){return this._boundsProvider}set boundsProvider(t){this._boundsProvider=t,t?(this._boundsSpineID=-1,this._boundsSpineDirty=!0,this.interactiveChildren=!1):(this.interactiveChildren=!0,this.hitArea=null),this.hasNeverUpdated||this.calculateBounds()}initializeMeshFactory(t){if(t){this.slotMeshFactory=t;const s=this.slotMeshFactory();s instanceof sa&&(this.darkTint=!0),s.destroy()}else for(let s=0;s<this.skeleton.slots.length;s++)if(this.skeleton.slots[s].data.darkColor){this.slotMeshFactory=()=>new sa,this.darkTint=!0;break}}update(t){this.internalUpdate(0,t)}internalUpdate(t,s){this.hasNeverUpdated=!1;const n=s??this._ticker.deltaMS/1e3;this.state.update(n),this.state.apply(this.skeleton),this.beforeUpdateWorldTransforms(this),this.skeleton.update(n),this.skeleton.updateWorldTransform(Xn.update),this.afterUpdateWorldTransforms(this)}updateTransform(){var t;this.renderMeshes(),this.sortChildren(),(t=this.debug)==null||t.renderDebug(this),super.updateTransform()}destroy(t){var s;this.autoUpdate&&(this.autoUpdate=!1),this._ticker=null;for(const[,n]of this.meshesCache)n==null||n.destroy();this.state.clearListeners(),this.debug=void 0,this.meshesCache.clear(),this.slotsObject.clear();for(let n in this.clippingSlotToPixiMasks)(s=this.clippingSlotToPixiMasks[n].mask)==null||s.destroy(),delete this.clippingSlotToPixiMasks[n];super.destroy(t)}resetMeshes(){for(const[,t]of this.meshesCache)t.zIndex=-1,t.visible=!1}_calculateBounds(){this.hasNeverUpdated&&(this.internalUpdate(0,0),this.renderMeshes())}hasMeshForSlot(t){return this.meshesCache.has(t)}getMeshForSlot(t){if(this.hasMeshForSlot(t)){let s=this.meshesCache.get(t);return s.visible=!0,s}else{let s=this.slotMeshFactory();return this.addChild(s),this.meshesCache.set(t,s),s}}getSlotFromRef(t){let s;if(typeof t=="number"?s=this.skeleton.slots[t]:typeof t=="string"?s=this.skeleton.findSlot(t):s=t,!s)throw new Error(`No slot found with the given slot reference: ${t}`);return s}addSlotObject(t,s,n){var a;let r=this.getSlotFromRef(t);const o=(a=this.slotsObject.get(r))==null?void 0:a.container;if(!(o&&o===s)){for(const[h,{container:l}]of this.slotsObject)if(h!==r&&l===s){this.removeSlotObject(h,s);break}o&&this.removeChild(o),this.slotsObject.set(r,{container:s,followAttachmentTimeline:(n==null?void 0:n.followAttachmentTimeline)||!1,followSlotColor:(n==null?void 0:n.followSlotColor)||!1}),this.addChild(s)}}getSlotObject(t){const s=this.slotsObject.get(this.getSlotFromRef(t));return s?s.container:void 0}removeSlotObject(t,s){var o;let n=this.getSlotFromRef(t),r=(o=this.slotsObject.get(n))==null?void 0:o.container;r&&(s&&s!==r||(this.removeChild(r),this.slotsObject.delete(n)))}removeSlotObjects(){for(const[,t]of this.slotsObject)t.container.removeFromParent();this.slotsObject.clear()}updateSlotObject(t,s,n){const{container:r,followAttachmentTimeline:o}=t,a=o?!!s.attachment:!0;if(r.visible=this.skeleton.drawOrder.includes(s)&&a,r.visible){let h=s.bone;const l=r.localTransform;l.a=h.a,l.b=h.c,l.c=-h.b,l.d=-h.d,l.tx=h.worldX,l.ty=h.worldY,r.transform.setFromMatrix(l),r.zIndex=n,r.alpha=this.skeleton.color.a*s.color.a,t.followSlotColor&&this.setSlotObjectTint(r,255*this.skeleton.color.r*s.color.r<<16|255*this.skeleton.color.g*s.color.g<<8|255*this.skeleton.color.b*s.color.b)}}setSlotObjectTint(t,s){const n=t;"tint"in n&&(n.tint=s);for(const r of n.children??[])this.setSlotObjectTint(r,s)}updateAndSetPixiMask(t,s){var a,h;const n=t.attachment;if(n&&n instanceof zn){const l=(a=this.clippingSlotToPixiMasks)[h=t.data.name]||(a[h]={slot:t,vertices:new Array});l.maskComputed=!1,this.currentClippingSlot=l;return}let r=this.currentClippingSlot;const o=this.slotsObject.get(t);if(r&&o){let l=r.mask;if(l||(l=ug.obtain(),r.mask=l,this.addChild(l)),!r.maskComputed){let c=r.slot,u=c.attachment;r.maskComputed=!0;const f=u.worldVerticesLength,d=r.vertices;u.computeWorldVertices(c,0,f,d,0,2),l.clear().lineStyle(0).beginFill(0).drawPolygon(d).endFill()}o.container.mask=l}else o!=null&&o.container.mask&&(o.container.mask=null);if(r&&r.slot.attachment.endSlot==t.data&&(this.currentClippingSlot=void 0),s){for(const l in this.clippingSlotToPixiMasks){const c=this.clippingSlotToPixiMasks[l];(!(c.slot.attachment instanceof zn)||!c.maskComputed)&&c.mask&&(this.removeChild(c.mask),ug.free(c.mask),c.mask=void 0)}this.currentClippingSlot=void 0}}renderMeshes(){var r,o;this.resetMeshes();let t=null,s=null;const n=this.skeleton.drawOrder;for(let a=0,h=n.length,l=0;a<h;a++){const c=n[a];let u=this.slotsObject.get(c),f=a+l;u&&(this.updateSlotObject(u,c,f+1),l++),this.updateAndSetPixiMask(c,a===n.length-1);const d=c.darkColor!=null,m=St.clipper.isClipping()?2:d?St.DARK_VERTEX_SIZE:St.VERTEX_SIZE;if(!c.bone.active){St.clipper.clipEndWithSlot(c);continue}const g=c.getAttachment();let b,_,M=0;if(g instanceof yo){const v=g;b=v.color,M=m*4,v.computeWorldVertices(c,this.verticesCache,0,m),t=St.QUAD_TRIANGLES,s=v.uvs,_=(r=v.region)==null?void 0:r.texture}else if(g instanceof Zn){const v=g;b=v.color,M=(v.worldVerticesLength>>1)*m,M>this.verticesCache.length&&(this.verticesCache=Fe.newFloatArray(M)),v.computeWorldVertices(c,0,v.worldVerticesLength,this.verticesCache,0,m),t=v.triangles,s=v.uvs,_=(o=v.region)==null?void 0:o.texture}else if(g instanceof zn){St.clipper.clipStart(c,g);continue}else{this.hasMeshForSlot(c)&&(this.getMeshForSlot(c).visible=!1),St.clipper.clipEndWithSlot(c);continue}if(_!=null){const S=c.bone.skeleton.color,y=c.color,I=S.a*y.a*b.a;this.lightColor.set(S.r*y.r*b.r,S.g*y.g*b.g,S.b*y.b*b.b,I),c.darkColor!=null?this.darkColor.set(c.darkColor.r,c.darkColor.g,c.darkColor.b,1):this.darkColor.set(0,0,0,1);let E,C,R,B;if(St.clipper.isClipping())St.clipper.clipTriangles(this.verticesCache,t,t.length,s,this.lightColor,this.darkColor,d),E=St.clipper.clippedVertices,C=E.length,R=St.clipper.clippedTriangles,B=R.length;else{const F=this.verticesCache;for(let D=2,N=0,j=M;D<j;D+=m,N+=2){let O=D;F[O++]=this.lightColor.r,F[O++]=this.lightColor.g,F[O++]=this.lightColor.b,F[O++]=this.lightColor.a,F[O++]=s[N],F[O++]=s[N+1],d&&(F[O++]=this.darkColor.r,F[O++]=this.darkColor.g,F[O++]=this.darkColor.b,F[O++]=this.darkColor.a)}E=this.verticesCache,C=M,R=t,B=t.length}if(C==0||B==0){St.clipper.clipEndWithSlot(c);continue}const k=this.getMeshForSlot(c);k.renderable=!0,k.zIndex=f,k.updateFromSpineData(_,c.data.blendMode,c.data.name,E,C,R,B,d)}St.clipper.clipEndWithSlot(c)}St.clipper.clipEnd()}calculateBounds(){if(!this._boundsProvider){super.calculateBounds();return}const t=this.transform;if(this._boundsSpineID===t._worldID)return;this.updateBounds();const s=this._localBounds,n=this._boundsPoint;n.set(s.minX,s.minY),t.worldTransform.apply(n,n),this._bounds.minX=n.x,this._bounds.minY=n.y,n.set(s.maxX,s.maxY),t.worldTransform.apply(n,n),this._bounds.maxX=n.x,this._bounds.maxY=n.y}updateBounds(){if(!this._boundsProvider||!this._boundsSpineDirty)return;this._boundsSpineDirty=!1,this._localBounds||(this._localBounds=new pa);const t=this._boundsProvider.calculateBounds(this),s=this._localBounds;s.clear(),s.minX=t.x,s.minY=t.y,s.maxX=t.x+t.width,s.maxY=t.y+t.height,this.hitArea=this._localBounds.getRectangle()}setBonePosition(t,s){const n=t;if(typeof t=="string"&&(t=this.skeleton.findBone(t)),!t)throw Error(`Cannot set bone position, bone ${String(n)} not found`);if(St.vectorAux.set(s.x,s.y),t.parent){const r=t.parent.worldToLocal(St.vectorAux);t.x=r.x,t.y=r.y}else t.x=St.vectorAux.x,t.y=St.vectorAux.y}getBonePosition(t,s){const n=t;return typeof t=="string"&&(t=this.skeleton.findBone(t)),t?(s||(s={x:0,y:0}),s.x=t.worldX,s.y=t.worldY,s):(console.error(`Cannot get bone position! Bone ${String(n)} not found`),s)}skeletonToPixiWorldCoordinates(t){this.worldTransform.apply(t,t)}pixiWorldCoordinatesToSkeleton(t){this.worldTransform.applyInverse(t,t)}pixiWorldCoordinatesToBone(t,s){this.pixiWorldCoordinatesToSkeleton(t),s.parent?s.parent.worldToLocal(t):s.worldToLocal(t)}static from(t,s,n){if(typeof t=="string")return St.oldFrom(t,s,n);const{skeleton:r,atlas:o,scale:a=1,darkTint:h,autoUpdate:l,boundsProvider:c,ticker:u}=t,f=`${r}-${o}-${a}`;let d=St.skeletonCache[f];if(!d){const m=Xs.get(r),g=Xs.get(o),b=new Md(g);let _=m instanceof Uint8Array?new Cd(b):new ih(b);_.scale=a,d=_.readSkeletonData(m),St.skeletonCache[f]=d}return new St({skeletonData:d,darkTint:h,autoUpdate:l,boundsProvider:c,ticker:u})}static oldFrom(t,s,n){const r=`${t}-${s}-${(n==null?void 0:n.scale)??1}`;let o=St.skeletonCache[r];if(o)return new St(o,n);const a=Xs.get(t),h=Xs.get(s),l=new Md(h);let c=a instanceof Uint8Array?new Cd(l):new ih(l);return c.scale=(n==null?void 0:n.scale)??1,o=c.readSkeletonData(a),St.skeletonCache[r]=o,new this(o,n)}get tint(){return this.skeleton.color.toRgb888()}set tint(t){ot.rgb888ToColor(this.skeleton.color,t)}};A(St,"vectorAux",new ql),A(St,"clipper",new th),A(St,"QUAD_TRIANGLES",[0,1,2,2,3,0]),A(St,"VERTEX_SIZE",8),A(St,"DARK_VERTEX_SIZE",12),A(St,"skeletonCache",Object.create(null));let Rd=St;const ug=new zl(()=>new Ri);ya.yDown=!0;const ol="spineTextureAtlasLoader",kA={extension:Oe.Asset,resolver:{test:i=>Fi(i,".atlas"),parse:i=>{var t,s;const e=i.split(".");return{resolution:parseFloat(((s=(t=Ve.RETINA_PREFIX)==null?void 0:t.exec(i))==null?void 0:s[1])??"1"),format:e[e.length-2],src:i}}},loader:{name:ol,extension:{type:Oe.LoadParser,priority:Yi.Normal,name:ol},test(i){return Fi(i,".atlas")},async load(i){const e=await Ve.ADAPTER.fetch(i);if(!e.ok)throw new Error(`[${ol}] Failed to fetch ${i}: ${e.status} ${e.statusText}`);return await e.text()},testParse(i,e){const t=Fi(e.src,".atlas"),s=typeof i=="string",n=e.loadParser===ol;return Promise.resolve((t||n)&&s)},unload(i){i.dispose()},async parse(i,e,t){var h;const s=e.data||{};let n=zt.dirname(e.src);n&&n.lastIndexOf("/")!==n.length-1&&(n+="/");const r=new Ky(i);if(s.images instanceof st||typeof s.images=="string"){const l=s.images;s.images={},s.images[r.pages[0].name]=l}const o=[];let a=!0;for(const l of t.parsers)if(l.name=="loadTextures"){a=(h=l.config)==null?void 0:h.preferCreateImageBitmap;break}Xs.setPreferences({preferCreateImageBitmap:!1});for(const l of r.pages){const c=l.name,u=s!=null&&s.images?s.images[c]:void 0;if(u instanceof st)l.setTexture(Ar.from(u));else{const f=u??zt.normalize([...n.split(zt.sep),c].join(zt.sep)),d={src:Vl(f,e.src),data:{...s.imageMetadata,alphaMode:l.pma?ui.PMA:ui.UNPACK}},m=t.load(d).then(g=>{l.setTexture(Ar.from(g.baseTexture))});o.push(m)}}return await Promise.all(o),Xs.setPreferences({preferCreateImageBitmap:a}),r}}};He.add(kA);const al="spineSkeletonLoader";function FA(i){return i.hasOwnProperty("bones")}function OA(i){return i instanceof Uint8Array}const BA={extension:Oe.Asset,loader:{name:al,extension:{type:Oe.LoadParser,priority:Yi.Normal,name:al},test(i){return Fi(i,".skel")},async load(i){const e=await Ve.ADAPTER.fetch(i);if(!e.ok)throw new Error(`[${al}] Failed to fetch ${i}: ${e.status} ${e.statusText}`);return new Uint8Array(await e.arrayBuffer())},testParse(i,e){const t=Fi(e.src,".json")&&FA(i),s=Fi(e.src,".skel")&&OA(i),n=e.loadParser===al;return Promise.resolve(t||s||n)}}};He.add(BA);class LA extends Hs{constructor(t=!1){super();A(this,"_buffer");A(this,"_indexBuffer");this._buffer=new Nt(void 0,t,!1),this._indexBuffer=new Nt(void 0,t,!0),this.addAttribute("aVertexPosition",this._buffer,2,!1,je.FLOAT).addAttribute("aTextureCoord",this._buffer,2,!1,je.FLOAT).addAttribute("aColor",this._buffer,4,!0,je.UNSIGNED_BYTE).addAttribute("aDarkColor",this._buffer,4,!0,je.UNSIGNED_BYTE).addAttribute("aTextureId",this._buffer,1,!0,je.FLOAT).addIndex(this._indexBuffer)}}const DA=`
|
||
precision highp float;
|
||
attribute vec2 aVertexPosition;
|
||
attribute vec2 aTextureCoord;
|
||
attribute vec4 aColor;
|
||
attribute vec4 aDarkColor;
|
||
attribute float aTextureId;
|
||
|
||
uniform mat3 projectionMatrix;
|
||
uniform mat3 translationMatrix;
|
||
uniform vec4 tint;
|
||
|
||
varying vec2 vTextureCoord;
|
||
varying vec4 vColor;
|
||
varying vec4 vDarkColor;
|
||
varying float vTextureId;
|
||
|
||
void main(void){
|
||
gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
|
||
|
||
vTextureCoord = aTextureCoord;
|
||
vTextureId = aTextureId;
|
||
vColor = aColor * tint;
|
||
vDarkColor = aDarkColor * tint;
|
||
|
||
}
|
||
`,NA=`
|
||
varying vec2 vTextureCoord;
|
||
varying vec4 vColor;
|
||
varying vec4 vDarkColor;
|
||
varying float vTextureId;
|
||
uniform sampler2D uSamplers[%count%];
|
||
|
||
void main(void){
|
||
vec4 color;
|
||
%forloop%
|
||
|
||
|
||
gl_FragColor.a = color.a * vColor.a;
|
||
gl_FragColor.rgb = ((color.a - 1.0) * vDarkColor.a + 1.0 - color.rgb) * vDarkColor.rgb + color.rgb * vColor.rgb;
|
||
}
|
||
`;class ox extends Bn{constructor(e){super(e),this.shaderGenerator=new hv(DA,NA),this.geometryClass=LA,this.vertexSize=7}packInterleavedGeometry(e,t,s,n,r){const{uint32View:o,float32View:a}=t,h=n/this.vertexSize,l=e.uvs,c=e.indices,u=e.vertexData,f=e._texture.baseTexture._batchLocation,d=Math.min(e.worldAlpha,1),m=At.shared.setValue(e._tintRGB).toPremultiplied(d,!0),g=At.shared.setValue(e._darkTintRGB).premultiply(d,!0).toPremultiplied(1,!1);for(let b=0;b<u.length;b+=2)a[n++]=u[b],a[n++]=u[b+1],a[n++]=l[b],a[n++]=l[b+1],o[n++]=m,o[n++]=g,a[n++]=f;for(let b=0;b<c.length;b++)s[r++]=h+c[b]}}A(ox,"extension",{name:"darkTintBatch",type:Oe.RendererPlugin});He.add(ox);class UA{constructor(){A(this,"container",new gi);A(this,"entries",new Map)}sync(e,t,s){var n;for(const[r,o]of this.entries)e.some(a=>a.id===r)||(this.container.removeChild(o.root),o.root.destroy({children:!0}),this.entries.delete(r));for(const r of e){const o=EE(r.id);let a=this.entries.get(r.id);if(a&&a.assetVersion!==r.assetVersion&&!o&&(this.container.removeChild(a.root),a.root.destroy({children:!0}),this.entries.delete(r.id),a=void 0),(!a||a.assetVersion!==r.assetVersion)&&o){a&&(this.container.removeChild(a.root),a.root.destroy({children:!0}));const f=new gi,d=new Rd({skeletonData:o.skeletonData,autoUpdate:!1,darkTint:!1});o.skeletonData.defaultSkin&&d.skeleton.setSkin(o.skeletonData.defaultSkin),d.skeleton.setSlotsToSetupPose(),f.addChild(d),this.container.addChild(f),a={root:f,spine:d,assetVersion:r.assetVersion,animation:""},this.entries.set(r.id,a)}if(!a)continue;const h=a.root,l=a.spine,c=r.visible!==!1&&r.enabled;h.visible=c,h.renderable=c,h.position.set(r.x,-r.y),h.rotation=-r.rotation*Math.PI/180,h.scale.set(r.scaleX,r.scaleY),a.animation!==r.selectedAnimation&&(a.animation=r.selectedAnimation,l.skeleton.setToSetupPose(),l.state.clearTracks(),a.animation&&l.state.setAnimation(0,a.animation,!1));const u=l.state.getCurrent(0);if(u){const f=((n=r.animations.find(m=>m.name===r.selectedAnimation))==null?void 0:n.duration)||0,d=Math.max(0,t/Math.max(1,s)-r.timeOffset);u.trackTime=f>0?Math.min(d,f):d}l.update(0)}}getBoneWorldTransform(e,t){const s=this.entries.get(e),n=s==null?void 0:s.spine.skeleton.findBone(t);if(!s||!n||!n.active)return null;const r=s.root,o=Math.cos(r.rotation),a=Math.sin(r.rotation),h=o*r.scale.x,l=-a*r.scale.y,c=a*r.scale.x,u=o*r.scale.y,f=h*n.a+l*n.c,d=h*n.b+l*n.d,m=c*n.a+u*n.c,g=c*n.b+u*n.d,b=r.position.x+h*n.worldX+l*n.worldY,_=r.position.y+c*n.worldX+u*n.worldY;return{x:b,y:-_,rotation:-Math.atan2(m,f)*180/Math.PI,scaleX:Math.max(1e-4,Math.hypot(f,m)),scaleY:Math.max(1e-4,Math.hypot(d,g))}}destroy(){for(const e of this.entries.values())e.root.removeFromParent(),e.root.destroy({children:!0});this.entries.clear(),this.container.removeFromParent(),this.container.destroy({children:!0})}}function Yn(i,e,t){const s=Number(i[e]);return Number.isFinite(s)?s:t}function ki(i,e,t,s){i[e]==null&&(i[e]=Yn(i,t,s))}function pf(i,e,t){if(typeof i.curve!="number")return;const s=Yn(i,"time",0),r=Yn(e,"time",0)-s,o=i.curve,a=Yn(i,"c2",0),h=Yn(i,"c3",1),l=Yn(i,"c4",1);i.curve=t.flatMap(([c,u])=>[s+r*o,c+(u-c)*a,s+r*h,c+(u-c)*l]),delete i.c2,delete i.c3,delete i.c4}function Wn(i,e){if(Array.isArray(i))for(let t=0;t<i.length-1;t++){const s=i[t],n=i[t+1];pf(s,n,e.map(({key:r,fallback:o})=>[Yn(s,r,o),Yn(n,r,o)]))}}function VA(i){if(Array.isArray(i))for(let e=0;e<i.length-1;e++)pf(i[e],i[e+1],[[0,1]])}function Yr(i,e){const t=typeof i=="string"?i.replace(/^#/,""):"",s=t.length===6?`${t}ff`:t.padEnd(8,"f").slice(0,8),n=[0,2,4,6].map(r=>Number.parseInt(s.slice(r,r+2),16)/255);return e?n:n.slice(0,3)}function dg(i,e){if(Array.isArray(i))for(let t=0;t<i.length-1;t++){const s=i[t],n=i[t+1],r=e?[...Yr(s.light,!0),...Yr(s.dark,!1)]:Yr(s.color,!0),o=e?[...Yr(n.light,!0),...Yr(n.dark,!1)]:Yr(n.color,!0);pf(s,n,r.map((a,h)=>[a,o[h]]))}}function XA(i){for(const e of i.bones||[])e.inherit==null&&e.transform!=null&&(e.inherit=e.transform);for(const e of i.transform||[])ki(e,"mixRotate","rotateMix",1),ki(e,"mixX","translateMix",1),e.mixY==null&&(e.mixY=e.mixX),ki(e,"mixScaleX","scaleMix",1),e.mixScaleY==null&&(e.mixScaleY=e.mixScaleX),ki(e,"mixShearY","shearMix",1);for(const e of i.path||[])ki(e,"mixRotate","rotateMix",1),ki(e,"mixX","translateMix",1),e.mixY==null&&(e.mixY=e.mixX)}function YA(i){for(const e of i.skins||[])for(const t of Object.values(e.attachments||{}))for(const s of Object.values(t||{}))s.parent!=null&&s.timelines==null&&s.deform!=null&&(s.timelines=s.deform)}function $A(i){for(const e of Object.values(i.slots||{}))e.color&&!e.rgba&&(e.rgba=e.color,delete e.color),e.twoColor&&!e.rgba2&&(e.rgba2=e.twoColor,delete e.twoColor),dg(e.rgba,!1),dg(e.rgba2,!0)}function GA(i){for(const e of Object.values(i.bones||{})){for(const t of e.rotate||[])ki(t,"value","angle",0);Wn(e.rotate,[{key:"value",fallback:0}]),Wn(e.translate,[{key:"x",fallback:0},{key:"y",fallback:0}]),Wn(e.scale,[{key:"x",fallback:1},{key:"y",fallback:1}]),Wn(e.shear,[{key:"x",fallback:0},{key:"y",fallback:0}])}}function jA(i){for(const e of Object.values(i.ik||{}))Wn(e,[{key:"mix",fallback:1},{key:"softness",fallback:0}])}function HA(i){for(const e of Object.values(i.transform||{})){for(const t of e)ki(t,"mixRotate","rotateMix",1),ki(t,"mixX","translateMix",1),t.mixY==null&&(t.mixY=t.mixX),ki(t,"mixScaleX","scaleMix",1),t.mixScaleY==null&&(t.mixScaleY=t.mixScaleX),ki(t,"mixShearY","shearMix",1);Wn(e,[{key:"mixRotate",fallback:1},{key:"mixX",fallback:1},{key:"mixY",fallback:1},{key:"mixScaleX",fallback:1},{key:"mixScaleY",fallback:1},{key:"mixShearY",fallback:1}])}}function WA(i){for(const e of Object.values(i.path||{})){for(const s of["position","spacing"]){const n=e[s];for(const r of n||[])ki(r,"value",s,0);Wn(n,[{key:"value",fallback:0}])}const t=e.mix;for(const s of t||[])ki(s,"mixRotate","rotateMix",1),ki(s,"mixX","translateMix",1),s.mixY==null&&(s.mixY=s.mixX);Wn(t,[{key:"mixRotate",fallback:1},{key:"mixX",fallback:1},{key:"mixY",fallback:1}])}}function zA(i){if(!i.deform)return;const e=i.attachments||(i.attachments={});for(const[t,s]of Object.entries(i.deform)){const n=e[t]||(e[t]={});for(const[r,o]of Object.entries(s)){const a=n[r]||(n[r]={});for(const[h,l]of Object.entries(o)){const c=a[h]||(a[h]={});c.deform=l,VA(l)}}}delete i.deform}function ax(i){XA(i),YA(i);for(const e of Object.values(i.animations||{}))$A(e),GA(e),jA(e),HA(e),WA(e),zA(e),!e.drawOrder&&e.draworder&&(e.drawOrder=e.draworder);return i}function fg(i){return i.replace(/\\/g,"/").split("/").pop()||i}async function qA(i){const e=URL.createObjectURL(i);return await et.fromURL(e)}function KA(i){const e=new Map;return i.bones.map(t=>{var r;const s=((r=t.parent)==null?void 0:r.name)||null,n=s?(e.get(s)||0)+1:0;return e.set(t.name,n),{name:t.name,parent:s,depth:n}})}async function lx(i,e,t){var o;if(!/\.(json|skel)$/i.test(i.name))throw new Error("Spine 数据仅支持 .json 或 .skel");if(!/\.atlas$/i.test(e.name))throw new Error("图集文件仅支持 .atlas");if(!t.length)throw new Error("请至少选择一张纹理图片");const s=new Ky(await e.text()),n=new Map(t.map(a=>[fg(a.name).toLowerCase(),a])),r=[];try{for(const c of s.pages){const u=n.get(fg(c.name).toLowerCase());if(!u)throw new Error(`Atlas 引用的纹理未选择:${c.name}`);const f=await qA(u);f.baseTexture.alphaMode=c.pma?ui.PMA:ui.UNPACK,r.push(f),c.setTexture(Ar.from(f.baseTexture))}const a=new Md(s);let h,l=null;if(/\.skel$/i.test(i.name))h=new Cd(a).readSkeletonData(await i.arrayBuffer()),l=Wl(h.version);else{let c;try{c=JSON.parse(await i.text())}catch{throw new Error("Spine JSON 文件格式无效")}if(l=Wl((o=c==null?void 0:c.skeleton)==null?void 0:o.spine),!l)throw new Error(`Spine JSON 版本不受支持,仅支持 ${Sd()}`);l==="3.8"&&ax(c),h=new ih(a).readSkeletonData(c)}if(!l)throw new Error(`Spine 数据版本不受支持,仅支持 ${Sd()}`);return{skeletonData:h,textures:r,dataVersion:l,animations:h.animations.map(c=>({name:c.name,duration:c.duration})),bones:KA(h)}}catch(a){for(const h of r)h.destroy(!0);throw a}}function wl(i){return new Promise((e,t)=>{const s=new FileReader;s.onload=()=>e(String(s.result||"")),s.onerror=()=>t(s.error),s.readAsDataURL(i)})}async function ZA(i,e,t){return{skeleton:{name:i.name,dataUrl:await wl(i)},atlas:{name:e.name,dataUrl:await wl(e)},textures:await Promise.all(t.map(async s=>({name:s.name,dataUrl:await wl(s)})))}}async function Au(i){const e=await fetch(i.dataUrl);if(!e.ok)throw new Error(`无法读取内嵌 Spine 文件:${i.name}`);return new File([await e.blob()],i.name)}async function JA(i){return{skeleton:await Au(i.skeleton),atlas:await Au(i.atlas),textures:await Promise.all(i.textures.map(Au))}}const hx="SpineParticle.EditorConfig",cx=1;function ux(i){return{backgroundX:i.backgroundX,backgroundY:i.backgroundY,backgroundOpacity:i.backgroundOpacity,backgroundImageName:i.backgroundImageName,backgroundImageData:i.backgroundImageData,showGrid:i.showGrid,exportSettings:Ut(i.exportSettings)}}function QA(i){return JSON.parse(JSON.stringify(i,(e,t)=>{if(!(e==="texture"||e==="trailTexture"||e==="frames"))return t}))}function eC(i){const e=ux(i.settings);return QA({format:hx,version:cx,savedAt:new Date().toISOString(),editor:Ut(i.editor),settings:e,timeline:{fps:i.timeline.fps,loop:i.timeline.loop,animations:[...i.timeline.animations]},selection:{type:i.activeObjectType,id:i.activeObjectId},scene:{systems:i.systems.map(t=>({...Ut(t),frames:void 0})),colliders:Ut(i.colliders),paths:Ut(i.paths),spines:Ut(i.spines)}})}function tC(){return`SpineParticle-${new Date().toISOString().replace(/[-:]/g,"").replace(/\.\d{3}Z$/,"").replace("T","-")}.json`}function dx(i){const e=eC(i),t=new Blob([JSON.stringify(e,null,2)],{type:"application/json;charset=utf-8"}),s=URL.createObjectURL(t),n=document.createElement("a");return n.href=s,n.download=tC(),document.body.appendChild(n),n.click(),n.remove(),setTimeout(()=>URL.revokeObjectURL(s),0),e}function fx(i){let e;try{e=JSON.parse(i)}catch{throw new Error("配置文件不是有效的 JSON")}const t=e;if(t.format!==hx)throw new Error("不是 SpineParticle 编辑器配置文件");if(t.version!==cx)throw new Error(`暂不支持配置版本:${t.version??"未知"}`);if(!t.scene||!Array.isArray(t.scene.systems)||!Array.isArray(t.scene.colliders)||!Array.isArray(t.scene.paths)||!Array.isArray(t.scene.spines))throw new Error("配置文件缺少完整场景数据");return t}async function iC(i){const e=new Map,t=n=>{const r=n==="/particles/star.png"?"/images/star.png":n==="/trails/trail.png"?"/images/trail.png":n||"/images/star.png";let o=e.get(r);return o||(o=et.fromURL(r).then(a=>$n(a)),e.set(r,o)),o},s=await t("/images/star.png");await Promise.all(i.map(async n=>{var o;const r=Tr(n.config);r.texture=s,await Promise.all(r.imageResources.map(async a=>{a.texture=await t(a.previewUrl||"/images/star.png"),await Promise.all(a.sequenceFrames.map(async h=>{h.texture=await t(h.previewUrl||a.previewUrl||"/images/star.png")}))})),await Promise.all(r.trailResources.map(async a=>{a.texture=await t(a.previewUrl||"/images/trail.png")})),r.trailTexture=((o=r.trailResources[0])==null?void 0:o.texture)||null,n.frames=[]}))}async function sC(i){const e=new Map;try{for(const t of i){if(!t.sourceBundle)continue;const s=await JA(t.sourceBundle);e.set(t.id,await lx(s.skeleton,s.atlas,s.textures))}return e}catch(t){for(const s of e.values())for(const n of s.textures)n.destroy(!0);throw t}}function nC(i,e){const t=(e==null?void 0:e.type)||"particle",s=Number(e==null?void 0:e.id)||0;(t==="particle"?i.systems.some(r=>r.id===s):t==="collision"?i.colliders.some(r=>r.id===s):t==="path"?i.paths.some(r=>r.id===s):i.spines.some(r=>r.id===s))?i.selectSceneObject(t,s):i.systems[0]?i.selectSceneObject("particle",i.systems[0].id):i.colliders[0]?i.selectSceneObject("collision",i.colliders[0].id):i.paths[0]?i.selectSceneObject("path",i.paths[0].id):i.spines[0]?i.selectSceneObject("spine",i.spines[0].id):(i.activeObjectType="particle",i.activeObjectId=0,i.activeId=0)}async function rC(i,e){var c,u,f,d,m;const t=fx(JSON.stringify(e)),s=Ut(t.scene.systems),n=Ut(t.scene.colliders),r=Ut(t.scene.paths),o=Ut(t.scene.spines);for(const g of o)g.sourceBundle==null&&(g.sourceBundle=null),g.dataVersion==null&&(g.dataVersion="");await iC(s);const a=await sC(o),h=new Map(i.spines.map(g=>[g.id,g.assetVersion]));for(const g of i.spines)Ea(g.id);i.systems=s,i.colliders=n,i.paths=r,i.spines=o,Object.assign(i.editor,Ut(t.editor||{}));const l=t.settings;if(l)for(const g of["backgroundX","backgroundY","backgroundOpacity","backgroundImageName","backgroundImageData","showGrid"])Object.prototype.hasOwnProperty.call(l,g)&&(i.settings[g]=l[g]);i.settings.exportSettings=gy((c=t.settings)==null?void 0:c.exportSettings),i.settings.undoLimit=Math.min(200,Math.max(1,Math.round(Number(i.settings.undoLimit)||20))),i.timeline.fps=Math.max(1,Math.round(Number((u=t.timeline)==null?void 0:u.fps)||30)),i.timeline.loop=((f=t.timeline)==null?void 0:f.loop)!==!1,i.timeline.animations=Array.isArray((d=t.timeline)==null?void 0:d.animations)&&t.timeline.animations.length?[...new Set(t.timeline.animations.filter(g=>typeof g=="string"&&g.trim()).map(g=>g.trim()))]:["animation"];for(const g of i.spines){const b=a.get(g.id);if(g.assetVersion=Math.max(Number(g.assetVersion)||0,h.get(g.id)||0)+1,!b){g.status="empty",g.error=g.skeletonFileName?"配置未包含可复用的 Spine 原始资源":"",g.animations=[],g.bones=[],g.selectedAnimation="";continue}Lh(g.id,b),g.dataVersion=b.dataVersion,g.animations=b.animations,g.bones=b.bones,b.animations.some(_=>_.name===g.selectedAnimation)||(g.selectedAnimation=((m=b.animations[0])==null?void 0:m.name)||""),g.status="ready",g.error=""}i.syncSceneSequences(),nC(i,t.selection),i.timeline.frame=0,i.timeline.recorded=!1,i.timeline.playing=!0;for(const g of i.systems)i.timeline.animations.includes(g.animation)||(g.animation=i.timeline.animations[0]);return i.recalcTotalFrames(),t}async function px(i,e){return rC(i,fx(e))}async function oC(i,e){if(!/\.json$/i.test(e.name))throw new Error("请选择 .json 配置文件");return px(i,await e.text())}const Vh=wo({undoCount:0});let sh=null,pn=null,qn=[],Do=null,mn=null,nh=!1;function mf(i){return{systems:i.systems.map(t=>{const s=Ut(t);return s.frames=void 0,s}),colliders:Ut(i.colliders),paths:Ut(i.paths),spines:Ut(i.spines),animations:[...i.timeline.animations],settings:ux(i.settings)}}function gf(i){return JSON.stringify(i,(e,t)=>e==="texture"||e==="trailTexture"?null:typeof t=="string"&&t.startsWith("data:")&&t.length>256?`${t.length}:${t.slice(0,96)}:${t.slice(-48)}`:t)}function mx(i,e=mf(i),t=gf(e)){const s=new Map;for(const n of e.spines){const r=AE(n.id);r&&s.set(n.id,r)}return{data:e,signature:t,spineAssets:s}}function rh(i){if(i){for(const e of i.spineAssets.values())ME(e);i.spineAssets.clear()}}function gx(i){for(;qn.length>i;)rh(qn.shift()||null);Vh.undoCount=qn.length}function vx(){const i=sh;if(!i||!pn||nh)return;const e=mf(i),t=gf(e);t!==pn.signature&&(qn.push(pn),pn=mx(i,e,t),gx(i.settings.undoLimit))}function aC(){nh||(mn&&clearTimeout(mn),mn=setTimeout(()=>{mn=null,vx()},250))}function lC(i){const e=i.activeObjectId;return i.activeObjectType==="particle"?i.systems.some(t=>t.id===e):i.activeObjectType==="collision"?i.colliders.some(t=>t.id===e):i.activeObjectType==="path"?i.paths.some(t=>t.id===e):i.spines.some(t=>t.id===e)}function hC(i){var t,s;if(!lC(i)){const n=i.systems[0],r=i.colliders[0],o=i.paths[0],a=i.spines[0];n?(i.activeObjectType="particle",i.activeObjectId=n.id):r?(i.activeObjectType="collision",i.activeObjectId=r.id):o?(i.activeObjectType="path",i.activeObjectId=o.id):(i.activeObjectType="spine",i.activeObjectId=(a==null?void 0:a.id)||0)}const e=i.activeObjectType==="particle"?i.systems.find(n=>n.id===i.activeObjectId):i.systems.find(n=>n.id===i.activeId);i.activeId=(e==null?void 0:e.id)||((t=i.systems[0])==null?void 0:t.id)||0,i.timeline.animation=(e==null?void 0:e.animation)||((s=i.systems[0])==null?void 0:s.animation)||i.timeline.animations[0]||"animation"}function cC(i,e){const t=pn;nh=!0;try{for(const s of i.spines)Ea(s.id);i.systems=Ut(e.data.systems),i.colliders=Ut(e.data.colliders),i.paths=Ut(e.data.paths),i.spines=Ut(e.data.spines),i.timeline.animations=[...e.data.animations],Object.assign(i.settings,Ut(e.data.settings));for(const[s,n]of e.spineAssets)Lh(s,n);for(const s of i.systems)s.frames=[];i.timeline.recorded=!1,i.timeline.playing=!1,hC(i),i.recalcTotalFrames(),pn=e}finally{nh=!1,rh(t)}}function uC(i){if(!(sh===i&&Do)){Do==null||Do(),mn&&clearTimeout(mn),rh(pn);for(const e of qn)rh(e);qn=[],sh=i,pn=mx(i),Vh.undoCount=0,Do=cs(()=>gf(mf(i)),aC,{flush:"post"})}}function dC(i,e){const t=Math.min(200,Math.max(1,Math.round(Number(e)||20)));i.settings.undoLimit=t,gx(t)}function Cu(){const i=sh;if(!i||!pn)return!1;mn&&(clearTimeout(mn),mn=null),vx();const e=qn.pop();return e?(cC(i,e),Vh.undoCount=qn.length,!0):!1}function fC(i){const e=i instanceof HTMLElement?i:null;return!!(e!=null&&e.closest('input, textarea, select, [contenteditable="true"]'))}function pC(i){function e(s){var r;const n=s.target instanceof Node?s.target:null;i.canvasFocused.value=!!n&&!!((r=i.canvasElement.value)!=null&&r.contains(n))}function t(s){const n=s.key.toLowerCase();if((s.ctrlKey||s.metaKey)&&!s.altKey&&n==="s"){s.preventDefault(),s.stopPropagation(),i.save();return}if((s.ctrlKey||s.metaKey)&&!s.altKey&&n==="z"){s.preventDefault(),s.stopPropagation(),i.undo();return}if(s.ctrlKey||s.metaKey||s.altKey||fC(s.target))return;if(n==="d"){s.preventDefault(),i.togglePlay();return}if(n==="s"){s.preventDefault(),i.toStart();return}if(!i.canvasFocused.value)return;const r={q:"",w:"translate",e:"rotate",r:"scale"};n in r&&(s.preventDefault(),i.setTool(r[n]))}_o(()=>{document.addEventListener("pointerdown",e,!0),window.addEventListener("keydown",t,!0)}),wa(()=>{document.removeEventListener("pointerdown",e,!0),window.removeEventListener("keydown",t,!0)})}const mC={class:"stage-wrap"},gC={class:"topbar"},vC=["disabled"],yC={class:"tool-group"},xC={class:"tool-group"},bC={key:0,class:"background-panel"},wC=["disabled"],_C=["title"],SC={class:"background-position-row"},TC={class:"background-opacity-row"},MC={class:"zoom-pct"},EC={key:0,class:"settings-panel"},AC={class:"sp-head"},CC={class:"sp-switch-row"},IC={class:"sp-switch-control"},RC={class:"sp-row"},PC={class:"sp-chk"},kC={class:"sp-chk"},FC={class:"sp-row"},OC={class:"sp-row"},BC={class:"sp-chk"},LC={class:"sp-chk"},DC={class:"sp-row"},NC={class:"sp-row"},UC={class:"sp-row"},VC={class:"sp-hex"},XC={class:"sp-chk"},YC={class:"help-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"help-title"},$C={class:"help-head"},GC={key:2,class:"hud"},jC={class:"hud-number hud-system-count"},HC={class:"hud-number hud-particle-count"},WC=Ws({__name:"Stage",setup(i){const e=Aa(),t=it(null),s=it(null),n=it(!1),r=it(!1),o=it(!1),a=it(null),h=ut(()=>e.settings.backgroundImageName),l=it(""),c=it(!1);function u(G){l.value=l.value===G?"":G}e.settings.undoLimit>0||(e.settings.undoLimit=20),e.settings.parameterPanelOnRight==null&&(e.settings.parameterPanelOnRight=!0),Number.isFinite(e.settings.backgroundX)||(e.settings.backgroundX=0),Number.isFinite(e.settings.backgroundY)||(e.settings.backgroundY=0),Number.isFinite(e.settings.backgroundOpacity)||(e.settings.backgroundOpacity=1),e.settings.backgroundImageName==null&&(e.settings.backgroundImageName=""),e.settings.backgroundImageData==null&&(e.settings.backgroundImageData=""),e.settings.showEmitter==null&&(e.settings.showEmitter=!0),e.settings.showBones==null&&(e.settings.showBones=!1),e.settings.bonePointDrawSize>0||(e.settings.bonePointDrawSize=1),e.settings.boneAxisDrawSize>0||(e.settings.boneAxisDrawSize=2),e.settings.showSkinMesh==null&&(e.settings.showSkinMesh=!1),e.settings.showGrid==null&&(e.settings.showGrid=!0);function f(){e.settings.bonePointDrawSize=Math.min(10,Math.max(.1,Number(e.settings.bonePointDrawSize)||1)),e.settings.boneAxisDrawSize=Math.min(10,Math.max(.1,Number(e.settings.boneAxisDrawSize)||2))}pC({canvasElement:t,canvasFocused:c,undo:Cu,save:()=>dx(e),togglePlay:()=>e.togglePlay(),toStart:()=>e.toStart(),setTool:G=>{l.value=G}});let d=null,m=null,g=null,b=null,_=0,M=null,v=null,S=null,y=null,I=null,E=null,C=null,R=null,B=null,k=null,F=null,D=null,N=[],j=0,O=0,L=0,P=0,X=null,U=null;const Y=new Map,q=new Map;let z=[];const ne=new Map,H=new Set;let Z=!1;cs(()=>[e.activeObjectType,e.activeObjectId],()=>H.clear());async function ae(){if(X&&U)return X;const[G,T]=await Promise.all([et.fromURL("/images/star.png"),et.fromURL("/images/trail.png")]);return X=G,U=T,X}function me(){m=new gi,d.stage.addChild(m),F=new gi,d.stage.addChild(F),g=new Qn(et.EMPTY),g.anchor.set(.5),g.visible=!1,m.addChild(g),k=new Ri,m.addChild(k),D=new UA,m.addChild(D.container),v=new Ri,m.addChild(v),M=new Ri,m.addChild(M),y=new Ri,m.addChild(y),I=new Ri,m.addChild(I),E=new Ri,m.addChild(E),C=new Ri,m.addChild(C),R=new Ri,m.addChild(R),B=new Ri,m.addChild(B),S=new Ri,m.addChild(S)}function _e(){r.value=!r.value,r.value&&(n.value=!1)}function te(){o.value=!0,n.value=!1,r.value=!1}function ve(G){G.key==="Escape"&&o.value&&(o.value=!1)}function $(){n.value=!n.value,n.value&&(r.value=!1)}function W(G){dC(e,Number(G.target.value))}async function J(G){var x;const T=G.target,p=(x=T.files)==null?void 0:x[0];if(p)try{e.settings.backgroundImageData=await wl(p),e.settings.backgroundImageName=p.name}catch(V){console.error("背景图加载失败",V)}finally{T.value=""}}async function Q(G){const T=++_;if(!G){g&&(g.texture=et.EMPTY,g.visible=!1),b&&b.destroy(!0),b=null;return}try{const p=await et.fromURL(G);if(T!==_||!g){p.destroy(!0);return}const x=b;b=p,g.texture=p,g.visible=!0,x&&x.destroy(!0)}catch(p){console.error("背景图恢复失败",p)}}function ie(G=!0){e.settings.backgroundImageData="",e.settings.backgroundImageName="",a.value&&(a.value.value=""),G&&(e.settings.backgroundX=0,e.settings.backgroundY=0,e.settings.backgroundOpacity=1)}function ue(G,T=0){if(G<=0)return 1;const p=Math.pow(10,Math.floor(Math.log10(G))),x=[1,2,5,10,20,50,100];let V=1;for(const K of x)if(K*p>=G){V=K*p;break}return Math.max(V,T)}function Se(){if(!k)return;const G=k;G.clear();const T=e.settings;if(!T.tickEnabled){for(const ge of N)ge.visible=!1;return}const p=0,x=0,V=d.screen.width/e.editor.viewScale,K=d.screen.height/e.editor.viewScale,oe=+("0x"+T.axisColor.replace("#",""));G.lineStyle(1.5,oe,.35),G.moveTo(-V,x),G.lineTo(V,x),G.moveTo(p,-K),G.lineTo(p,K);const pe=e.editor.viewScale,he=ue(50/pe),be=V,fe=K,Te=Math.max(1,T.tickWidth);if(T.tickEnabled){for(let ge=0;ge<=V;ge+=he){const rt=Math.round(ge/he)*he;rt!==0&&(G.lineStyle(Te,oe,.25),G.moveTo(rt,x-4),G.lineTo(rt,x+4))}for(let ge=0;ge<=K;ge+=he)Math.round(ge/he)*he!==0&&(G.lineStyle(Te,oe,.25),G.moveTo(p-4,ge),G.lineTo(p+4,ge))}const Ce=d.screen.width/2+e.editor.viewX,Le=d.screen.height*.5+e.editor.viewY,Ue=T.axisFontSize,Ae=+("0x"+T.axisColor.replace("#",""));for(;N.length<64;){const ge=new cf("",{fontFamily:"monospace",fontSize:Ue,fill:Ae});ge.anchor.set(.5,.5),F.addChild(ge),N.push(ge)}let ye=0;const We=T.showAxisLabels&&T.tickEnabled;for(let ge=0;ge<=V;ge+=he){const rt=Math.round(ge/he)*he;if(rt===0||!We||rt>be)continue;const mt=N[ye++];if(!mt)break;mt.style.fontSize=Ue,mt.text=String(rt),mt.position.set(Ce+rt*pe,Le+9),mt.visible=!0;const _t=N[ye++];if(!_t)break;_t.style.fontSize=Ue,_t.text=String(-rt),_t.position.set(Ce-rt*pe,Le+9),_t.visible=!0}for(let ge=0;ge<=K;ge+=he){const rt=Math.round(ge/he)*he;if(rt===0||!We||rt>fe)continue;const mt=N[ye++];if(!mt)break;mt.style.fontSize=Ue,mt.text=String(rt),mt.position.set(Ce+8,Le-ge*pe),mt.visible=!0;const _t=N[ye++];if(!_t)break;_t.style.fontSize=Ue,_t.text=String(-rt),_t.position.set(Ce+8,Le+ge*pe),_t.visible=!0}for(;ye<N.length;){const ge=N[ye++];ge&&(ge.visible=!1)}}function Me(G){const T=t.value.getBoundingClientRect(),p=G.clientX-T.left,x=G.clientY-T.top,V=G.deltaY<0?1.12:1/1.12,K=e.editor.viewScale,oe=Math.max(.01,K*V),pe=d.screen.width/2,he=d.screen.height*.5,be=e.editor.viewX,fe=e.editor.viewY,Te=(p-pe-be)/K,Ce=(x-he-fe)/K;e.editor.viewX=p-pe-Te*oe,e.editor.viewY=x-he-Ce*oe,e.editor.viewScale=oe}function Ee(G){if(G.button!==0)return;if(l.value&&Jt()){Zi(G);return}if(wt(G)||Mt(G)||ai(G)||Ct(G))return;const T=G.clientX,p=G.clientY,x=e.editor.viewX,V=e.editor.viewY,K=pe=>{e.editor.viewX=x+(pe.clientX-T),e.editor.viewY=V+(pe.clientY-p)},oe=()=>{window.removeEventListener("pointermove",K),window.removeEventListener("pointerup",oe),window.removeEventListener("pointercancel",oe)};window.addEventListener("pointermove",K),window.addEventListener("pointerup",oe),window.addEventListener("pointercancel",oe)}function de(G,T){const p=t.value.getBoundingClientRect(),x=Math.max(1e-4,e.editor.viewScale),V=G-p.left,K=T-p.top;return{x:(V-d.screen.width/2-e.editor.viewX)/x,y:-(K-d.screen.height*.5-e.editor.viewY)/x}}function De(G,T,p){const x=G.rotation*Math.PI/180,V=Math.cos(x),K=Math.sin(x),oe=Math.max(1e-4,Math.abs(G.scaleX??1)),pe=Math.max(1e-4,Math.abs(G.scaleY??1));return{x:G.x+V*T*oe-K*p*pe,y:G.y+K*T*oe+V*p*pe}}function Ie(G,T,p){const x=G.rotation*Math.PI/180,V=Math.cos(x),K=Math.sin(x),oe=Math.max(1e-4,Math.abs(G.scaleX??1)),pe=Math.max(1e-4,Math.abs(G.scaleY??1)),he=T-G.x,be=p-G.y;return{x:(V*he+K*be)/oe,y:(-K*he+V*be)/pe}}function Be(){if(e.activeObjectType!=="path")return null;const G=e.paths.find(T=>T.id===e.activeObjectId)||null;return(G==null?void 0:G.visible)===!1?null:G}function Ke(G,T,p){if(G.points.length<2)return G.points.length;const x=G.closed?G.points.length:G.points.length-1;let V=G.points.length,K=1/0;for(let oe=0;oe<x;oe++){const pe=G.points[oe],he=G.points[(oe+1)%G.points.length],be=he.x-pe.x,fe=he.y-pe.y,Te=Math.max(1e-4,be*be+fe*fe),Ce=Math.min(1,Math.max(0,((T-pe.x)*be+(p-pe.y)*fe)/Te)),Le=pe.x+be*Ce,Ue=pe.y+fe*Ce,Ae=Math.hypot(T-Le,p-Ue);Ae<K&&(K=Ae,V=oe+1)}return V}function ct(G){const T=Be();if(!T||!T.enabled)return;if(Z){Z=!1;return}const p=de(G.clientX,G.clientY),x=Ie(T,p.x,p.y),V=9/Math.max(.01,e.editor.viewScale),K=T.points.findIndex(pe=>Math.hypot(pe.x-x.x,pe.y-x.y)<=V);if(K>=0){T.points.splice(K,1),H.clear();return}const oe=Ke(T,x.x,x.y);T.points.splice(oe,0,{x:x.x,y:x.y,inX:0,inY:0,outX:0,outY:0}),H.clear(),H.add(oe)}function wt(G){const T=Be();if(!T||!T.enabled)return!1;const p=de(G.clientX,G.clientY),x=Ie(T,p.x,p.y),V=9/Math.max(.01,e.editor.viewScale);if(G.detail>=2){if(T.points.findIndex(fe=>Math.hypot(fe.x-x.x,fe.y-x.y)<=V)>=0)return!0;const he={x:x.x,y:x.y,inX:0,inY:0,outX:0,outY:0},be=Ke(T,x.x,x.y);return T.points.splice(be,0,he),H.clear(),H.add(be),Z=!0,dt(fe=>{const Te=de(fe.clientX,fe.clientY),Ce=Ie(T,Te.x,Te.y);he.outX=Ce.x-he.x,he.outY=Ce.y-he.y,he.inX=-he.outX,he.inY=-he.outY}),!0}let K=null;for(const pe of H){const he=T.points[pe];he&&(Math.hypot(he.x+he.inX-x.x,he.y+he.inY-x.y)<=V&&(K={index:pe,side:"in"}),Math.hypot(he.x+he.outX-x.x,he.y+he.outY-x.y)<=V&&(K={index:pe,side:"out"}))}if(K){const pe=T.points[K.index],he=K.side==="in"?Math.hypot(pe.outX,pe.outY):Math.hypot(pe.inX,pe.inY);return dt(fe=>{const Te=de(fe.clientX,fe.clientY),Ce=Ie(T,Te.x,Te.y),Le=Ce.x-pe.x,Ue=Ce.y-pe.y;if(K.side==="in"?(pe.inX=Le,pe.inY=Ue):(pe.outX=Le,pe.outY=Ue),!fe.altKey){const Ae=Math.max(1e-4,Math.hypot(Le,Ue)),ye=fe.shiftKey?Ae:he;K.side==="in"?(pe.outX=-Le/Ae*ye,pe.outY=-Ue/Ae*ye):(pe.inX=-Le/Ae*ye,pe.inY=-Ue/Ae*ye)}}),!0}const oe=T.points.findIndex(pe=>Math.hypot(pe.x-x.x,pe.y-x.y)<=V);if(oe>=0){if(G.altKey)return H.delete(oe),!0;G.ctrlKey||G.metaKey?H.add(oe):H.has(oe)||(H.clear(),H.add(oe));const pe=x,he=[...H].map(fe=>({index:fe,x:T.points[fe].x,y:T.points[fe].y}));return dt(fe=>{const Te=de(fe.clientX,fe.clientY),Ce=Ie(T,Te.x,Te.y);for(const Le of he)T.points[Le.index].x=Le.x+Ce.x-pe.x,T.points[Le.index].y=Le.y+Ce.y-pe.y}),!0}if(G.altKey&&!G.ctrlKey&&!G.metaKey)return H.clear(),!0;if(G.ctrlKey||G.metaKey||G.altKey){const pe=x,he=G.altKey,be=fe=>{const Te=de(fe.clientX,fe.clientY),Ce=Ie(T,Te.x,Te.y),Le=Math.min(pe.x,Ce.x),Ue=Math.max(pe.x,Ce.x),Ae=Math.min(pe.y,Ce.y),ye=Math.max(pe.y,Ce.y);T.points.forEach((We,ge)=>{We.x>=Le&&We.x<=Ue&&We.y>=Ae&&We.y<=ye&&(he?H.delete(ge):H.add(ge))}),window.removeEventListener("pointerup",be),window.removeEventListener("pointercancel",be)};return window.addEventListener("pointerup",be),window.addEventListener("pointercancel",be),!0}return!1}function dt(G){const T=()=>{window.removeEventListener("pointermove",G),window.removeEventListener("pointerup",T),window.removeEventListener("pointercancel",T)};window.addEventListener("pointermove",G),window.addEventListener("pointerup",T),window.addEventListener("pointercancel",T)}function Mt(G){if(e.activeObjectType!=="collision")return!1;const T=e.colliders.find(ye=>ye.id===e.activeObjectId);if(!(T!=null&&T.enabled)||T.visible===!1)return!1;const p=de(G.clientX,G.clientY),x=T.rotation*Math.PI/180,V=Math.cos(x),K=Math.sin(x),oe=Math.max(1e-4,Math.abs(T.scaleX??1)),pe=Math.max(1e-4,Math.abs(T.scaleY??1)),he=p.x-T.x,be=p.y-T.y,fe=(V*he+K*be)/oe,Te=(-K*he+V*be)/pe;if(!(T.shape==="circle"?Math.hypot(fe,Te)<=T.radius:T.shape==="ellipse"?Math.hypot(fe/Math.max(1,T.radiusX),Te/Math.max(1,T.radiusY))<=1:Math.abs(fe)<=T.width*.5&&Math.abs(Te)<=T.height*.5))return!1;const Le=T.x,Ue=T.y,Ae=p;return dt(ye=>{const We=de(ye.clientX,ye.clientY);T.x=Le+We.x-Ae.x,T.y=Ue+We.y-Ae.y}),!0}function Ct(G){const T=e.systems.find(be=>be.id===e.activeId);if((T==null?void 0:T.visible)===!1)return!1;const p=T==null?void 0:T.config;if(!(p!=null&&p.forceField)||p.forceRadius<=0)return!1;const x=de(G.clientX,G.clientY);if(Math.hypot(x.x-p.forceCenterX,x.y-p.forceCenterY)>p.forceRadius)return!1;const K=p.forceCenterX,oe=p.forceCenterY;t.value&&(t.value.style.cursor="grabbing");const pe=be=>{const fe=de(be.clientX,be.clientY);p.forceCenterX=K+fe.x-x.x,p.forceCenterY=oe+fe.y-x.y},he=()=>{t.value&&(t.value.style.cursor=""),window.removeEventListener("pointermove",pe),window.removeEventListener("pointerup",he),window.removeEventListener("pointercancel",he)};return window.addEventListener("pointermove",pe),window.addEventListener("pointerup",he),window.addEventListener("pointercancel",he),G.preventDefault(),!0}function ai(G){const T=e.systems.find(fe=>fe.id===e.activeId);if((T==null?void 0:T.visible)===!1)return!1;const p=T==null?void 0:T.config;if(!(p!=null&&p.attraction))return!1;const x=de(G.clientX,G.clientY),V=Math.max(p.attractionRadius,12/Math.max(1e-4,e.editor.viewScale));if(Math.hypot(x.x-p.attractionCenterX,x.y-p.attractionCenterY)>V)return!1;const oe=p.attractionCenterX,pe=p.attractionCenterY;t.value&&(t.value.style.cursor="grabbing");const he=fe=>{const Te=de(fe.clientX,fe.clientY);p.attractionCenterX=oe+Te.x-x.x,p.attractionCenterY=pe+Te.y-x.y},be=()=>{t.value&&(t.value.style.cursor=""),window.removeEventListener("pointermove",he),window.removeEventListener("pointerup",be),window.removeEventListener("pointercancel",be)};return window.addEventListener("pointermove",he),window.addEventListener("pointerup",be),window.addEventListener("pointercancel",be),G.preventDefault(),!0}function Jt(){const G=e.activeObjectId;if(e.activeObjectType==="particle"){const x=e.systems.find(K=>K.id===G);if(!x||x.visible===!1)return null;const V=x.config;return{x:V.centerX,y:V.centerY,rotation:V.rootRotation,scaleX:V.rootScaleX??1,scaleY:V.rootScaleY??1,setPosition:(K,oe)=>{V.centerX=K,V.centerY=oe},setRotation:K=>{V.rootRotation=K},setScale:(K,oe)=>{V.rootScaleX=K,V.rootScaleY=oe}}}const p=(e.activeObjectType==="collision"?e.colliders:e.activeObjectType==="path"?e.paths:e.spines).find(x=>x.id===G);return!p||p.visible===!1?null:{x:Number(p.x)||0,y:Number(p.y)||0,rotation:Number(p.rotation)||0,scaleX:Math.max(.05,Number(p.scaleX)||1),scaleY:Math.max(.05,Number(p.scaleY)||1),setPosition:(x,V)=>{p.x=x,p.y=V},setRotation:x=>{p.rotation=x},setScale:(x,V)=>{p.scaleX=x,p.scaleY=V}}}function Zi(G){const T=Jt();if(!T)return;const p=e.editor.viewScale,x=t.value.getBoundingClientRect(),V=x.left+d.screen.width/2+e.editor.viewX+T.x*p,K=x.top+d.screen.height*.5+e.editor.viewY+-T.y*p,oe=G.clientX,pe=G.clientY,he=l.value,be=T.x,fe=T.y,Te=T.rotation,Ce=T.scaleX,Le=T.scaleY,Ue=Math.hypot(oe-V,pe-K)||1,Ae=Math.atan2(pe-K,oe-V),ye=ge=>{const rt=(ge.clientX-oe)/p,mt=(ge.clientY-pe)/p;if(he==="translate")T.setPosition(be+rt,fe-mt);else if(he==="rotate"){const _t=Math.atan2(ge.clientY-K,ge.clientX-V);T.setRotation(Te-(_t-Ae)*180/Math.PI)}else if(he==="scale"){const wi=Math.hypot(ge.clientX-V,ge.clientY-K)/Ue;T.setScale(Math.max(.05,Ce*wi),Math.max(.05,Le*wi))}},We=()=>{window.removeEventListener("pointermove",ye),window.removeEventListener("pointerup",We),window.removeEventListener("pointercancel",We)};window.addEventListener("pointermove",ye),window.addEventListener("pointerup",We),window.addEventListener("pointercancel",We)}function xs(){re(1.2)}function $t(){re(1/1.2)}function re(G){const T=Math.max(.01,e.editor.viewScale*G);e.editor.viewScale=T}function le(){e.editor.viewScale=1,e.editor.viewX=0,e.editor.viewY=0}function ft(){e.editor.viewScale=1,e.editor.viewX=0,e.editor.viewY=0}function It(){e.settings.showGrid=!e.settings.showGrid}function Pt(){if(m){for(const[G,T]of Y){const p=e.systems.find(x=>x.id===G);(!p||q.get(G)!==p.config)&&(m.removeChild(T),T.destroy({children:!0}),Y.delete(G),q.delete(G))}for(const G of e.systems){X&&!G.config.texture&&(G.config.texture=X);const T=Tr(G.config);if(U)for(const x of T.trailResources)!x.texture&&(x.previewUrl==="/images/trail.png"||x.previewUrl==="/trails/trail.png")&&(x.texture=U);if(X)for(const x of T.imageResources)!x.texture&&x.textureName==="star"&&(x.texture=X);if(Y.has(G.id))continue;const p=new yE(G.config);p.setEmitterPos(()=>({x:G.config.centerX,y:G.config.centerY})),m.addChild(p),Y.set(G.id,p),q.set(G.id,G.config)}}}function nt(){if(!M)return;const G=M;if(G.clear(),!!e.settings.showEmitter&&e.systems.length)for(const T of e.systems){if(T.visible===!1)continue;const p=ne.get(T.id),x=(p==null?void 0:p.x)??T.config.centerX??0,V=-((p==null?void 0:p.y)??T.config.centerY??0),K=e.activeObjectType==="particle"&&T.id===e.activeId,oe=K?16763955:9082040,pe=K?.4:.2;G.lineStyle(1,oe,pe),G.drawCircle(x,V,10),G.beginFill(oe,K?.8:.4),G.drawCircle(x,V,3),G.endFill(),G.lineStyle(1,oe,K?.3:.15),G.moveTo(x-16,V),G.lineTo(x+16,V),G.moveTo(x,V-16),G.lineTo(x,V+16)}}function $i(){var p;if(!v)return;const G=v;(p=G.parent)==null||p.addChild(G),G.clear();const T=new Map;for(const x of e.spines)x.visible===!1||!x.selectedBone||x.status!=="ready"||T.set(`${x.id}:${x.selectedBone}`,{spineId:x.id,boneName:x.selectedBone});for(const x of e.systems){if(x.visible===!1)continue;const V=x.config;if(!V.emitterFollow||V.emitterFollowMode!=="bone"||!V.emitterFollowSpineId||!V.emitterFollowBoneName)continue;const K=e.spines.find(oe=>oe.id===V.emitterFollowSpineId);!K||K.visible===!1||T.set(`${V.emitterFollowSpineId}:${V.emitterFollowBoneName}`,{spineId:V.emitterFollowSpineId,boneName:V.emitterFollowBoneName})}for(const x of T.values()){const V=D==null?void 0:D.getBoneWorldTransform(x.spineId,x.boneName);if(!V)continue;const K=V.x,oe=-V.y;G.lineStyle(2,12881151,.95),G.beginFill(12881151,.2),G.drawCircle(K,oe,8),G.endFill(),G.beginFill(15919103,1),G.drawCircle(K,oe,3.5),G.endFill()}}function Ji(){if(!y)return;const G=y;if(G.clear(),!e.settings.showEmitter)return;const T=e.systems.find(Ae=>Ae.id===e.activeId);if(!T||T.visible===!1)return;const p=T.config,x=ne.get(T.id),V=(x==null?void 0:x.x)??p.centerX??0,K=-((x==null?void 0:x.y)??p.centerY??0),oe=p.shape;if(oe==="point"||oe==="orbit")return;const pe=p.rootScaleX??1,he=p.rootScaleY??1,be=-((x==null?void 0:x.rotation)??p.rootRotation??0)*Math.PI/180,fe=Math.cos(be),Te=Math.sin(be),Ce=p.offsetX??0,Le=p.offsetY??0,Ue=(Ae,ye)=>{const We=Ae+Ce,ge=-ye-Le,rt=We*pe,mt=ge*he;return[V+rt*fe-mt*Te,K+(rt*Te+mt*fe)]};if(oe==="circle"){G.lineStyle(2,3991658,.7);const Ae=48;for(let ye=0;ye<=Ae;ye++){const We=ye/Ae*Math.PI*2,[ge,rt]=Ue(Math.cos(We)*p.radius,Math.sin(We)*p.radius);ye===0?G.moveTo(ge,rt):G.lineTo(ge,rt)}}else if(oe==="rect"){const Ae=p.rectW/2,ye=p.rectH/2,We=Ue(-Ae,-ye),ge=Ue(Ae,-ye),rt=Ue(Ae,ye),mt=Ue(-Ae,ye);G.lineStyle(2,4885759,.7),G.moveTo(We[0],We[1]),G.lineTo(ge[0],ge[1]),G.lineTo(rt[0],rt[1]),G.lineTo(mt[0],mt[1]),G.lineTo(We[0],We[1])}else if(oe==="cone"){const Ae=p.radius,ye=p.coneAngle/2*Math.PI/180,We=p.direction*Math.PI/180,ge=Ue(Math.cos(We-ye)*Ae,Math.sin(We-ye)*Ae),rt=Ue(Math.cos(We+ye)*Ae,Math.sin(We+ye)*Ae);G.lineStyle(2,3991658,.7),G.moveTo(V,K),G.lineTo(ge[0],ge[1]),G.moveTo(V,K),G.lineTo(rt[0],rt[1]),G.lineStyle(1,3991658,.5);const mt=24;for(let _t=0;_t<=mt;_t++){const wi=We-ye+2*ye*_t/mt,[Mo,Qs]=Ue(Math.cos(wi)*Ae,Math.sin(wi)*Ae);_t===0?G.moveTo(Mo,Qs):G.lineTo(Mo,Qs)}}}function li(){if(!I)return;const G=I;G.clear();const T=e.systems.find(oe=>oe.id===e.activeId);if((T==null?void 0:T.visible)===!1)return;const p=T==null?void 0:T.config;if(!(p!=null&&p.forceField)||p.forceRadius<=0)return;const x=p.forceCenterX,V=-p.forceCenterY,K=p.forceStrength>=0?5818367:16739194;G.lineStyle(2,K,.85),G.beginFill(K,.08),G.drawCircle(x,V,p.forceRadius),G.endFill(),G.lineStyle(1,K,.7),G.moveTo(x-9,V),G.lineTo(x+9,V),G.moveTo(x,V-9),G.lineTo(x,V+9),G.beginFill(K,.95),G.drawCircle(x,V,4),G.endFill()}function Gi(){if(!E)return;const G=E;G.clear();const T=e.systems.find(pe=>pe.id===e.activeId);if((T==null?void 0:T.visible)===!1)return;const p=T==null?void 0:T.config;if(!(p!=null&&p.attraction))return;const x=p.attractionCenterX,V=-p.attractionCenterY,K=Math.max(0,p.attractionRadius),oe=16731487;K>0&&(G.lineStyle(2,oe,.95),G.beginFill(oe,.09),G.drawCircle(x,V,K),G.endFill()),G.lineStyle(1,oe,.85),G.moveTo(x-10,V),G.lineTo(x+10,V),G.moveTo(x,V-10),G.lineTo(x,V+10),G.beginFill(oe,1),G.drawCircle(x,V,K>0?4:6),G.endFill()}function er(){if(!B)return;const G=B;if(G.clear(),!l.value)return;const T=Jt();if(!T)return;const p=T.x,x=-T.y,V=T.scaleX,K=T.scaleY,oe=-T.rotation*Math.PI/180,pe=Math.cos(oe),he=Math.sin(oe),be=(Ce,Le)=>{const Ue=Ce*V,Ae=-Le*K;return[p+Ue*pe-Ae*he,x+(Ue*he+Ae*pe)]},fe=(Ce,Le,Ue,Ae)=>{const ye=be(Ce,Le),We=be(Ue,Ae);G.moveTo(ye[0],ye[1]),G.lineTo(We[0],We[1])},Te=26;if(G.lineStyle(2,3526911,.9),G.beginFill(3526911,.25),G.drawCircle(p,x,6),G.endFill(),l.value==="translate")G.lineStyle(2,3526911,.9),fe(-Te,0,Te,0),fe(0,-Te,0,Te),fe(Te-6,-4,Te,0),fe(Te,0,Te-6,4),fe(-20,-4,-Te,0),fe(-Te,0,-20,4),fe(-4,Te-6,0,Te),fe(0,Te,4,Te-6),fe(-4,-20,0,-Te),fe(0,-Te,4,-20);else if(l.value==="rotate"){G.lineStyle(2,3526911,.8);const Ce=48;for(let Ae=0;Ae<=Ce;Ae++){const ye=Ae/Ce*Math.PI*2,[We,ge]=be(Math.cos(ye)*Te,Math.sin(ye)*Te);Ae===0?G.moveTo(We,ge):G.lineTo(We,ge)}const[Le,Ue]=be(0,Te);G.beginFill(3526911,.95),G.drawCircle(Le,Ue,4),G.endFill()}else if(l.value==="scale"){G.lineStyle(2,3526911,.9);const Le=[[-Te,-Te],[Te,-Te],[Te,Te],[-Te,Te]].map(([Ue,Ae])=>be(Ue,Ae));G.moveTo(Le[0][0],Le[0][1]),G.lineTo(Le[1][0],Le[1][1]),G.lineTo(Le[2][0],Le[2][1]),G.lineTo(Le[3][0],Le[3][1]),G.lineTo(Le[0][0],Le[0][1]),G.beginFill(3526911,.9);for(const Ue of Le)G.drawRect(Ue[0]-3,Ue[1]-3,6,6);G.endFill()}}function Oi(G,T){var p;G.push({boneName:T.boneName,x:T.x,y:T.y,rotation:-T.rotation}),(p=T.trailState)!=null&&p.bones.length&&T.trailState.bones.forEach(x=>{G.push({boneName:x.boneName,x:x.x,y:x.y,rotation:x.rotation,parentX:0,parentY:0,trail:!0})})}function Qt(G){return G.map(T=>({...T,trailState:T.trailState?{...T.trailState,bones:T.trailState.bones.map(p=>({...p}))}:void 0}))}function Pr(G){const T=new Map;for(const x of G)for(const V of x)T.has(V.boneName)||T.set(V.boneName,Qt([V])[0]);const p=[...T.keys()].sort((x,V)=>{const K=Number(x.replace(/^p_/,"")),oe=Number(V.replace(/^p_/,""));return Number.isFinite(K)&&Number.isFinite(oe)?K-oe:x.localeCompare(V)});for(let x=0;x<G.length;x++){const V=new Map(G[x].map(K=>[K.boneName,K]));G[x]=p.map(K=>{const oe=V.get(K);return oe||{...Qt([T.get(K)])[0],alpha:0,imageVisible:!1,trailState:void 0,active:!0}})}}function kr(G,T,p,x){var Le;const V=G.config,K=1/Math.max(1,p),oe=V.lifeMode==="fixed"?Math.max(0,Number(V.lifeMin)||0):Math.max(0,Number(V.lifeMin)||0,Number(V.lifeMax)||0),pe=Math.max(1,Math.ceil(Number(V.loopDurationFrames)||1)),he=Math.max(1,Math.ceil(oe*p)),be=Math.max(1,Math.ceil(he/pe)),fe=Math.max(0,Math.ceil(Math.max(0,Number(V.delay)||0)*p)),Te=[];if(T.reset(),V.generateLoopStartAnimation){for(let Ue=0;Ue<fe;Ue++)Te.push([]);Te.push([]);for(let Ue=0;Ue<be;Ue++){Ue>0&&T.restartEmissionCycle();for(let Ae=0;Ae<pe;Ae++)T.update(K,"force"),Te.push(T.capture())}}else{for(let Ae=0;Ae<be;Ae++){Ae>0&&T.restartEmissionCycle();for(let ye=0;ye<pe;ye++)T.update(K,"force")}const Ue=T.capture();for(let Ae=0;Ae<fe;Ae++)Te.push(Qt(Ue));if(Te.push(Qt(Ue)),V.generateLoopEndAnimation){const Ae=Math.max(1,Math.ceil(oe*p)+2);for(let ye=0;ye<Ae&&T.activeCount>0;ye++)T.update(K,"off"),Te.push(T.capture());(Le=Te[Te.length-1])!=null&&Le.length&&Te.push([])}else{T.restartEmissionCycle();for(let Ae=0;Ae<pe;Ae++)T.update(K,"force"),Te.push(T.capture());Pr(Te)}}const Ce=Qt(Te[Te.length-1]||[]);for(Te.length>x&&(Te.length=x);Te.length<x;)Te.push(Qt(Ce));G.frames=Te,T.apply(Te[0]||[])}function Mn(G){if(!S)return;const T=S;if(T.clear(),!e.settings.showBones)return;const p=0,x=0,V=Math.max(.25,Math.abs(e.editor.viewScale)||1),K=Math.min(10,Math.max(.1,Number(e.settings.bonePointDrawSize)||1)),oe=Math.min(10,Math.max(.1,Number(e.settings.boneAxisDrawSize)||2)),pe=2.5*K/V,he=4.5*oe/V,be=2.5*oe/V,fe=Math.max(.65,oe*.625)/V,Te=Math.max(.55,oe*.5)/V;for(const Ce of G){const Le=Ce.trail?16731533:16747610;T.lineStyle(1,Le,Ce.trail?.65:.35),T.moveTo(Ce.parentX??p,Ce.parentY??x),T.lineTo(Ce.x,Ce.y);const Ue=Ce.rotation*Math.PI/180,Ae=Math.cos(Ue),ye=Math.sin(Ue);T.lineStyle(fe,3725823,.95),T.moveTo(Ce.x,Ce.y),T.lineTo(Ce.x+Ae*he,Ce.y+ye*he),T.beginFill(3725823,.95),T.drawCircle(Ce.x+Ae*he,Ce.y+ye*he,Math.max(.8,oe*.625)/V),T.endFill(),T.lineStyle(Te,16765286,.85),T.moveTo(Ce.x,Ce.y),T.lineTo(Ce.x-ye*be,Ce.y+Ae*be),T.beginFill(Le,.9),T.drawCircle(Ce.x,Ce.y,pe),T.endFill()}}function Zs(G,T=16777215){const p=Number.parseInt(G.replace("#",""),16);return Number.isFinite(p)?p:T}function En(){if(!C)return;const G=C;G.clear();for(const T of z){if(T.visible===!1)continue;const p=e.activeObjectType==="collision"&&e.activeObjectId===T.id,x=T.enabled?p?16735858:13911899:5792116,V=T.rotation*Math.PI/180,K=Math.cos(V),oe=Math.sin(V),pe=Math.max(1e-4,Math.abs(T.scaleX??1)),he=Math.max(1e-4,Math.abs(T.scaleY??1)),be=(Ce,Le)=>({x:T.x+K*Ce*pe-oe*Le*he,y:-(T.y+oe*Ce*pe+K*Le*he)});let fe=[];if(T.shape==="circle"||T.shape==="ellipse"){const Ce=T.shape==="circle"?T.radius:T.radiusX,Le=T.shape==="circle"?T.radius:T.radiusY;fe=Array.from({length:49},(Ue,Ae)=>{const ye=Ae/48*Math.PI*2;return be(Math.cos(ye)*Ce,Math.sin(ye)*Le)})}else if(T.shape==="rect"){const Ce=T.width*.5,Le=T.height*.5;fe=[be(-Ce,-Le),be(Ce,-Le),be(Ce,Le),be(-Ce,Le),be(-Ce,-Le)]}else{const Ce=Math.max(3,Math.min(16,Math.round(T.sides)));fe=Array.from({length:Ce+1},(Le,Ue)=>{const Ae=Math.PI*.5+Ue%Ce/Ce*Math.PI*2;return be(Math.cos(Ae)*T.width*.5,Math.sin(Ae)*T.height*.5)})}if(!fe.length)continue;G.lineStyle(p?2.5:1.5,x,T.enabled?.95:.45),G.beginFill(x,p?.12:.055),G.moveTo(fe[0].x,fe[0].y);for(let Ce=1;Ce<fe.length;Ce++)G.lineTo(fe[Ce].x,fe[Ce].y);G.endFill();const Te=be(0,0);G.lineStyle(1,x,.8),G.moveTo(Te.x-7,Te.y),G.lineTo(Te.x+7,Te.y),G.moveTo(Te.x,Te.y-7),G.lineTo(Te.x,Te.y+7)}}function Js(){if(!R)return;const G=R;G.clear();for(const T of e.paths){if(T.visible===!1||!T.enabled||!T.points.length)continue;const p=e.activeObjectType==="path"&&e.activeObjectId===T.id,x=Zs(T.color,16749374),V=(he,be)=>{const fe=De(T,he,be);return{x:fe.x,y:-fe.y}},K=T.points[0],oe=V(K.x,K.y);G.lineStyle(p?2.5:1.8,x,p?1:.75),G.moveTo(oe.x,oe.y);const pe=T.closed?T.points.length:T.points.length-1;for(let he=0;he<pe;he++){const be=T.points[he],fe=T.points[(he+1)%T.points.length],Te=V(be.x+be.outX,be.y+be.outY),Ce=V(fe.x+fe.inX,fe.y+fe.inY),Le=V(fe.x,fe.y);G.bezierCurveTo(Te.x,Te.y,Ce.x,Ce.y,Le.x,Le.y)}p&&T.points.forEach((he,be)=>{const fe=V(he.x,he.y),Te=V(he.x+he.inX,he.y+he.inY),Ce=V(he.x+he.outX,he.y+he.outY),Le=Math.hypot(he.inX,he.inY)>.01,Ue=Math.hypot(he.outX,he.outY)>.01;G.lineStyle(1,11121867,.65),Le&&(G.moveTo(fe.x,fe.y),G.lineTo(Te.x,Te.y)),Ue&&(G.moveTo(fe.x,fe.y),G.lineTo(Ce.x,Ce.y)),Le&&(G.beginFill(14015724,.95),G.drawCircle(Te.x,Te.y,3),G.endFill()),Ue&&(G.beginFill(14015724,.95),G.drawCircle(Ce.x,Ce.y,3),G.endFill()),G.beginFill(H.has(be)?16777215:x,1),G.lineStyle(1.5,H.has(be)?6126847:16777215,.95),G.drawCircle(fe.x,fe.y,H.has(be)?5:4),G.endFill()})}}function An(G,T,p="linear"){if(!G.length)return T;const x=[...G].sort((V,K)=>V.x-K.x);if(T<=x[0].x)return x[0].y;for(let V=1;V<x.length;V++){const K=x[V-1],oe=x[V];if(T<=oe.x){let pe=(T-K.x)/Math.max(1e-4,oe.x-K.x);if(p==="bezier"){const he=K.x+(K.outX??(oe.x-K.x)/3),be=oe.x+(oe.inX??-(oe.x-K.x)/3);let fe=0,Te=1;for(let Ce=0;Ce<18;Ce++){const Le=(fe+Te)/2;bs(K.x,he,be,oe.x,Le)<T?fe=Le:Te=Le}return pe=(fe+Te)/2,bs(K.y,K.y+(K.outY??(oe.y-K.y)/3),oe.y+(oe.inY??-(oe.y-K.y)/3),oe.y,pe)}return K.y+(oe.y-K.y)*pe}}return x[x.length-1].y}function bs(G,T,p,x,V){const K=1-V;return K*K*K*G+3*K*K*V*T+3*K*V*V*p+V*V*V*x}function Bi(G,T){if(!G.points.length)return null;if(G.points.length===1)return{...De(G,G.points[0].x,G.points[0].y),angle:G.rotation};const p=G.closed?G.points.length:G.points.length-1,x=[];let V=0;for(let Ue=0;Ue<p;Ue++){const Ae=G.points[Ue],ye=G.points[(Ue+1)%G.points.length];for(let We=0;We<=20;We++){if(Ue>0&&We===0)continue;const ge=We/20,rt=bs(Ae.x,Ae.x+Ae.outX,ye.x+ye.inX,ye.x,ge),mt=bs(Ae.y,Ae.y+Ae.outY,ye.y+ye.inY,ye.y,ge),_t=De(G,rt,mt),wi=x[x.length-1];wi&&(V+=Math.hypot(_t.x-wi.x,_t.y-wi.y)),x.push({..._t,distance:V})}}const K=Math.min(1,Math.max(0,T))*V;let oe=x.findIndex(Ue=>Ue.distance>=K);oe<0&&(oe=x.length-1);const pe=x[oe],he=x[Math.max(0,oe-1)],be=x[Math.min(x.length-1,oe+1)],fe=he.distance,Te=oe>0?(K-fe)/Math.max(1e-4,pe.distance-fe):0,Ce=he.x+(pe.x-he.x)*Math.min(1,Math.max(0,Te)),Le=he.y+(pe.y-he.y)*Math.min(1,Math.max(0,Te));return{x:Ce,y:Le,angle:Math.atan2(be.y-he.y,be.x-he.x)*180/Math.PI}}function Qi(G){z=e.colliders.map(T=>{if(!T.followPath||!T.followPathId)return T;const p=e.paths.find(be=>be.id===T.followPathId&&be.enabled);if(!(p!=null&&p.points.length))return T;const x=Math.max(.05,Number(T.followDuration)||2),V=Math.min(1,Math.max(0,G/x)),K=Array.isArray(T.followCurve)?T.followCurve:[{x:0,y:0},{x:1,y:1}],oe=T.followCurveMode==="跟随导出"?e.settings.exportSettings.keyframeCurve==="bezier"?"bezier":"linear":T.followCurveMode==="贝塞尔"?"bezier":"linear",pe=Math.min(1,Math.max(0,An(K,V,oe))),he=Bi(p,pe);return he?{...T,x:he.x,y:he.y,rotation:T.rotation+(T.followPathRotation?he.angle:0)}:T})}function ws(G,T,p,x=Math.max(1e-4,Math.abs(G.rootScaleX)),V=Math.max(1e-4,Math.abs(G.rootScaleY))){const K=-G.rootRotation*Math.PI/180,oe=Math.cos(K),pe=Math.sin(K),he=T-G.centerX,be=-p+G.centerY;return{x:(oe*he+pe*be)/x,y:(-pe*he+oe*be)/V}}function tr(){var p,x,V;P=requestAnimationFrame(tr);const G=performance.now()/1e3;let T=G-j;if(j=G,T>.1&&(T=.1),d&&m){m.scale.set(e.editor.viewScale),m.position.set(d.screen.width/2+e.editor.viewX,d.screen.height*.5+e.editor.viewY),g&&(g.position.set(Number(e.settings.backgroundX)||0,-(Number(e.settings.backgroundY)||0)),g.alpha=Math.min(1,Math.max(0,Number(e.settings.backgroundOpacity)||0))),Se(),Pt();const K=Math.max(1,e.timeline.fps),oe=e.timeline.frame,pe=oe/K;D==null||D.sync(e.spines,oe,K),Qi(pe);for(const Ae of e.systems){const ye=Y.get(Ae.id);if(!ye)continue;ye.setFollowExportCurveMode(e.settings.exportSettings.keyframeCurve==="bezier"?"贝塞尔":"线性");const We=Ae.visible!==!1;ye.visible=We,ye.renderable=We;const ge=Ae.config;ye.scale.set(ge.rootScaleX,ge.rootScaleY),ye.setColliders(z),ye.setEmitterFollowSpawn(0,0,0);let rt={x:ge.centerX,y:ge.centerY,rotation:ge.rootRotation};const mt=ge.emitterFollow&&ge.emitterFollowMode==="bone"?e.spines.find(es=>es.id===ge.emitterFollowSpineId&&es.enabled&&es.status==="ready"):null,_t=mt&&(D==null?void 0:D.getBoneWorldTransform(mt.id,ge.emitterFollowBoneName))||null,wi=ge.emitterFollow&&ge.emitterFollowMode==="path"?e.paths.find(es=>es.id===ge.emitterFollowPathId&&es.enabled):null,Mo=Math.max(.05,ge.emitterFollowDuration),Qs=Math.min(1,Math.max(0,pe/Mo)),vf=Math.min(1,Math.max(0,An(ge.emitterFollowCurve,Qs))),Xh=Math.min(1,Math.max(0,ge.emitterFollowOffset)),_x=ge.emitterFollowDirection==="reverse"?(1-Xh)*(1-vf):Xh+(1-Xh)*vf,_s=wi?Bi(wi,_x):null;if(_t){const es=ge.emitterFollowBoneOffsetX,Eo=ge.emitterFollowBoneOffsetY,ir=_t.x+es,Fr=_t.y+Eo,Ca=ge.rootRotation+ge.emitterFollowBoneRotation,Ao=Math.max(1e-4,Math.abs(ge.rootScaleX*ge.emitterFollowBoneScaleX)),Co=Math.max(1e-4,Math.abs(ge.rootScaleY*ge.emitterFollowBoneScaleY));if(rt={x:ir,y:Fr,rotation:Ca},ge.emitterFollowSpace==="local")ye.position.set(ir,-Fr),ye.rotation=-Ca*Math.PI/180,ye.scale.set(Ao,Co),ye.setSimulationTransform(ir,Fr,Ca,Ao,Co);else{ye.position.set(ge.centerX,-ge.centerY),ye.rotation=-ge.rootRotation*Math.PI/180,ye.scale.set(Ao,Co),ye.setSimulationTransform(ge.centerX,ge.centerY,ge.rootRotation,Ao,Co);const yf=ws(ge,ir,Fr,Ao,Co),Sx=-(Ca-ge.rootRotation);ye.setEmitterFollowSpawn(yf.x,yf.y,Sx)}}else if(_s){const es=_s.angle+(ge.emitterFollowDirection==="reverse"?180:0),Eo=ge.emitterAngleMode==="direction"?es:ge.rootRotation;if(rt={x:_s.x,y:_s.y,rotation:Eo},ge.emitterFollowSpace==="local")ye.position.set(_s.x,-_s.y),ye.rotation=-Eo*Math.PI/180,ye.setSimulationTransform(_s.x,_s.y,Eo);else{ye.position.set(ge.centerX,-ge.centerY),ye.rotation=-ge.rootRotation*Math.PI/180,ye.setSimulationTransform(ge.centerX,ge.centerY,ge.rootRotation);const ir=ws(ge,_s.x,_s.y),Fr=ge.emitterAngleMode==="direction"?-(es-ge.rootRotation):0;ye.setEmitterFollowSpawn(ir.x,ir.y,Fr)}}else ye.position.set(ge.centerX,-ge.centerY),ye.rotation=-ge.rootRotation*Math.PI/180,ye.setSimulationTransform(ge.centerX,ge.centerY,ge.rootRotation);ne.set(Ae.id,rt)}let he=0;const be=[],fe=e.timeline,Te=fe.fps,Ce=1/Math.max(1,Te);let Le=L,Ue=0;if(fe.playing?(O+=T,Ue=Math.floor(O/Ce),Ue>0&&(O-=Ue*Ce)):O=0,fe.playing&&Ue>0)for(let Ae=0;Ae<Ue;Ae++)if(Le=fe.frame,be.length=0,he=0,fe.recorded){for(const ye of e.systems){const We=Y.get(ye.id),ge=(x=ye.frames)==null?void 0:x[fe.frame];if(We&&ge){We.apply(ge);for(const rt of ge)rt.active&&(ye.visible!==!1&&Oi(be,rt),he++)}}if(fe.frame++,fe.frame>=fe.totalFrames)if(fe.loop)fe.frame=0;else{fe.frame=fe.totalFrames-1,fe.playing=!1;break}}else{if(fe.frame===0)for(const ye of e.systems){const We=Y.get(ye.id);We&&(ye.config.mode==="stream"&&ye.config.streamBehavior==="loop"?kr(ye,We,Te,fe.totalFrames):We.reset())}for(const[ye,We]of Y){const ge=e.systems.find(Qs=>Qs.id===ye),rt=(ge==null?void 0:ge.config.mode)==="stream"&&ge.config.streamBehavior==="loop",mt=rt?(p=ge.frames)==null?void 0:p[fe.frame]:void 0,_t=fe.frame===0&&!rt,wi=_t?[]:mt||We.update(Ce);if(_t?We.apply([]):mt&&We.apply(mt),(ge==null?void 0:ge.visible)!==!1)for(const Qs of wi)Qs.active&&Oi(be,Qs);he+=wi.length}for(const ye of e.systems){if(!ye.config.texture)continue;ye.frames=ye.frames||[];const We=Y.get(ye.id);We&&!(ye.config.mode==="stream"&&ye.config.streamBehavior==="loop")&&(ye.frames[fe.frame]=We.capture())}fe.frame++,fe.frame>=fe.totalFrames&&(fe.frame=0,fe.recorded=!0)}else{fe.playing||(Le=fe.frame);for(const Ae of e.systems){const ye=Y.get(Ae.id),We=fe.playing?L:fe.frame,ge=(V=Ae.frames)==null?void 0:V[We],rt=Ae.config.mode==="stream"&&Ae.config.streamBehavior==="loop"&&!!ge;if((fe.recorded||rt)&&ye&&ge){ye.apply(ge);for(const mt of ge)mt.active&&(Ae.visible!==!1&&Oi(be,mt),he++)}else if(ye){const mt=fe.frame===0?[]:ye.update(0);if(fe.frame===0&&ye.apply([]),Ae.visible!==!1)for(const _t of mt)_t.active&&Oi(be,_t);he+=ye.activeCount}}}L=Le,D==null||D.sync(e.spines,Le,Te);for(const[,Ae]of Y)Ae.drawTrailMeshDebug(e.settings.showSkinMesh);En(),Js(),$i(),nt(),Ji(),li(),Gi(),er(),Mn(be),s.value&&(s.value.systems=e.systems.length,s.value.particles=he)}}return _o(async()=>{window.addEventListener("keydown",ve);const G=t.value;d=new jv({width:G.clientWidth||800,height:G.clientHeight||600,backgroundAlpha:0,antialias:!0}),G.appendChild(d.view),me(),cs(()=>e.settings.backgroundImageData,Q,{immediate:!0}),await ae();const T=X;for(const p of e.systems){p.config.texture=T;const x=Tr(p.config);if(U)for(const V of x.trailResources)!V.texture&&(V.previewUrl==="/images/trail.png"||V.previewUrl==="/trails/trail.png")&&(V.texture=U);for(const V of x.imageResources)!V.texture&&V.textureName==="star"&&(V.texture=T)}s.value={systems:e.systems.length,particles:0},e.timeline.recorded=!1,e.timeline.frame=0,O=0,L=0,e.timeline.playing=!0,e.timeline.loop=!0;for(const p of e.systems)p.frames=[];e.recalcTotalFrames(),j=performance.now()/1e3,tr(),cs(()=>e.systems.map(p=>JSON.stringify(p.config,(x,V)=>x==="texture"||x==="trailTexture"||x==="previewUrl"?void 0:V)).join("|")+`|colliders:${JSON.stringify(e.colliders)}|paths:${JSON.stringify(e.paths)}`,()=>{e.recalcTotalFrames(),e.timeline.recorded=!1,e.timeline.frame=0;for(const p of e.systems)p.frames=[];e.timeline.playing=!0,e.timeline.loop=!0}),uC(e)}),wa(()=>{window.removeEventListener("keydown",ve),cancelAnimationFrame(P),D==null||D.destroy(),D=null,_++,b&&b.destroy(!0),b=null,g=null,d&&(d.destroy(!0,{children:!0}),d=null)}),(G,T)=>(se(),ce("div",mC,[w("div",{ref_key:"holder",ref:t,class:Ze(["stage-holder",{grid:Pe(e).settings.showGrid}]),tabindex:"0",onWheel:xt(Me,["prevent"]),onPointerdown:Ee,onDblclick:xt(ct,["prevent"])},null,34),w("div",gC,[w("button",{class:"settings-btn",onClick:$,title:"系统设置"},"系统设置"),w("button",{class:"undo-btn",disabled:Pe(Vh).undoCount===0,onClick:T[0]||(T[0]=(...p)=>Pe(Cu)&&Pe(Cu)(...p)),title:"撤回上一步 (Ctrl+Z)"},"↶",8,vC),w("div",yC,[w("button",{class:Ze(["tool-btn",{on:l.value===""}]),onClick:T[1]||(T[1]=p=>u("")),title:"拖动画布 (Q)"},"✋",2),w("button",{class:Ze(["tool-btn",{on:l.value==="translate"}]),onClick:T[2]||(T[2]=p=>u("translate")),title:"位移 (W)"},"✥",2),w("button",{class:Ze(["tool-btn",{on:l.value==="rotate"}]),onClick:T[3]||(T[3]=p=>u("rotate")),title:"旋转 (E)"},"⟳",2),w("button",{class:Ze(["tool-btn",{on:l.value==="scale"}]),onClick:T[4]||(T[4]=p=>u("scale")),title:"缩放 (R)"},"⤢",2)]),w("div",xC,[w("button",{class:"tool-btn",onClick:xs,title:"放大"},"+"),w("button",{class:"tool-btn",onClick:$t,title:"缩小"},"-"),w("button",{class:"tool-btn",onClick:le,title:"适配画布"},"⤢"),w("button",{class:Ze(["tool-btn",{on:Pe(e).settings.showGrid}]),onClick:It,title:"切换网格"},"▦",2),w("button",{class:"tool-btn",onClick:ft,title:"重置视图"},"⟳")]),w("div",{class:"background-menu",onClick:T[10]||(T[10]=xt(()=>{},["stop"]))},[w("button",{class:Ze(["background-btn",{on:r.value}]),title:"背景图显示设置",onClick:_e},"背景图",2),r.value?(se(),ce("div",bC,[w("button",{class:"background-upload",onClick:T[5]||(T[5]=p=>{var x;return(x=a.value)==null?void 0:x.click()})},Ye(h.value?"更换图像":"上传图像"),1),w("button",{class:"background-clear",disabled:!h.value,onClick:T[6]||(T[6]=p=>ie())},"清除背景",8,wC),w("input",{ref_key:"backgroundFileInput",ref:a,class:"background-file-input",type:"file",accept:"image/png,image/jpeg,image/webp",onChange:J},null,544),w("div",{class:"background-file-name",title:h.value},Ye(h.value||"未上传图像"),9,_C),w("div",SC,[w("label",null,[T[28]||(T[28]=w("span",null,"X",-1)),xe(w("input",{"onUpdate:modelValue":T[7]||(T[7]=p=>Pe(e).settings.backgroundX=p),type:"number",step:"1","aria-label":"背景图 X 偏移"},null,512),[[Je,Pe(e).settings.backgroundX,void 0,{number:!0}]])]),w("label",null,[T[29]||(T[29]=w("span",null,"Y",-1)),xe(w("input",{"onUpdate:modelValue":T[8]||(T[8]=p=>Pe(e).settings.backgroundY=p),type:"number",step:"1","aria-label":"背景图 Y 偏移"},null,512),[[Je,Pe(e).settings.backgroundY,void 0,{number:!0}]])])]),w("label",TC,[T[30]||(T[30]=w("span",null,"透明度",-1)),xe(w("input",{"onUpdate:modelValue":T[9]||(T[9]=p=>Pe(e).settings.backgroundOpacity=p),type:"range",min:"0",max:"1",step:"0.01","aria-label":"背景图透明度"},null,512),[[Je,Pe(e).settings.backgroundOpacity,void 0,{number:!0}]]),w("b",null,Ye(Math.round(Pe(e).settings.backgroundOpacity*100))+"%",1)])])):$e("",!0)]),w("button",{class:Ze(["help-btn",{on:o.value}]),title:"查看使用说明",onClick:te},"使用说明",2),w("span",MC,Ye(Math.round(Pe(e).editor.viewScale*100))+"%",1)]),n.value?(se(),ce("div",EC,[w("div",AC,[T[31]||(T[31]=Yt("系统设置 ",-1)),w("button",{class:"sp-close",onClick:T[11]||(T[11]=p=>n.value=!1)},"✕")]),T[45]||(T[45]=w("div",{class:"sp-section-title"},"界面布局",-1)),w("label",CC,[T[33]||(T[33]=w("span",null,"参数面板位置",-1)),w("span",IC,[xe(w("input",{type:"checkbox","onUpdate:modelValue":T[12]||(T[12]=p=>Pe(e).settings.parameterPanelOnRight=p),"aria-label":"参数面板显示在右侧"},null,512),[[Lt,Pe(e).settings.parameterPanelOnRight]]),T[32]||(T[32]=w("span",{class:"sp-switch-ui","aria-hidden":"true"},null,-1)),w("b",null,Ye(Pe(e).settings.parameterPanelOnRight?"右侧":"左侧"),1)])]),T[46]||(T[46]=w("div",{class:"sp-divider"},null,-1)),T[47]||(T[47]=w("div",{class:"sp-section-title"},"操作历史",-1)),w("label",RC,[T[34]||(T[34]=w("span",null,"最大撤回步数",-1)),xe(w("input",{class:"sp-num sp-undo-limit",type:"number",min:"1",max:"200","onUpdate:modelValue":T[13]||(T[13]=p=>Pe(e).settings.undoLimit=p),"aria-label":"最大撤回步数",onChange:W},null,544),[[Je,Pe(e).settings.undoLimit,void 0,{number:!0}]])]),T[48]||(T[48]=w("div",{class:"sp-divider"},null,-1)),T[49]||(T[49]=w("div",{class:"sp-section-title"},"画布辅助显示",-1)),w("label",PC,[xe(w("input",{type:"checkbox","onUpdate:modelValue":T[14]||(T[14]=p=>Pe(e).settings.showEmitter=p)},null,512),[[Lt,Pe(e).settings.showEmitter]]),T[35]||(T[35]=Yt("发射点",-1))]),w("label",kC,[xe(w("input",{type:"checkbox","onUpdate:modelValue":T[15]||(T[15]=p=>Pe(e).settings.showBones=p)},null,512),[[Lt,Pe(e).settings.showBones]]),T[36]||(T[36]=Yt("骨骼连线",-1))]),Pe(e).settings.showBones?(se(),ce(qe,{key:0},[w("label",FC,[T[37]||(T[37]=w("span",null,"骨骼点绘制大小",-1)),xe(w("input",{class:"sp-num",type:"number",min:"0.1",max:"10",step:"0.1","onUpdate:modelValue":T[16]||(T[16]=p=>Pe(e).settings.bonePointDrawSize=p),"aria-label":"骨骼点绘制大小",onChange:f},null,544),[[Je,Pe(e).settings.bonePointDrawSize,void 0,{number:!0}]])]),w("label",OC,[T[38]||(T[38]=w("span",null,"坐标轴绘制大小",-1)),xe(w("input",{class:"sp-num",type:"number",min:"0.1",max:"10",step:"0.1","onUpdate:modelValue":T[17]||(T[17]=p=>Pe(e).settings.boneAxisDrawSize=p),"aria-label":"坐标轴绘制大小",onChange:f},null,544),[[Je,Pe(e).settings.boneAxisDrawSize,void 0,{number:!0}]])])],64)):$e("",!0),w("label",BC,[xe(w("input",{type:"checkbox","onUpdate:modelValue":T[18]||(T[18]=p=>Pe(e).settings.showSkinMesh=p)},null,512),[[Lt,Pe(e).settings.showSkinMesh]]),T[39]||(T[39]=Yt("蒙皮网格",-1))]),T[50]||(T[50]=w("div",{class:"sp-divider"},null,-1)),w("label",LC,[xe(w("input",{type:"checkbox","onUpdate:modelValue":T[19]||(T[19]=p=>Pe(e).settings.tickEnabled=p)},null,512),[[Lt,Pe(e).settings.tickEnabled]]),T[40]||(T[40]=Yt("启用刻度",-1))]),Pe(e).settings.tickEnabled?(se(),ce(qe,{key:1},[w("label",DC,[T[41]||(T[41]=w("span",null,"刻度文字大小",-1)),xe(w("input",{type:"range",min:"8",max:"40",step:"1","onUpdate:modelValue":T[20]||(T[20]=p=>Pe(e).settings.axisFontSize=p)},null,512),[[Je,Pe(e).settings.axisFontSize,void 0,{number:!0}]]),xe(w("input",{type:"number",min:"8",max:"40","onUpdate:modelValue":T[21]||(T[21]=p=>Pe(e).settings.axisFontSize=p),class:"sp-num"},null,512),[[Je,Pe(e).settings.axisFontSize,void 0,{number:!0}]])]),w("label",NC,[T[42]||(T[42]=w("span",null,"刻度线粗细",-1)),xe(w("input",{type:"range",min:"1",max:"5",step:"0.5","onUpdate:modelValue":T[22]||(T[22]=p=>Pe(e).settings.tickWidth=p)},null,512),[[Je,Pe(e).settings.tickWidth,void 0,{number:!0}]]),xe(w("input",{type:"number",min:"1",max:"5","onUpdate:modelValue":T[23]||(T[23]=p=>Pe(e).settings.tickWidth=p),class:"sp-num"},null,512),[[Je,Pe(e).settings.tickWidth,void 0,{number:!0}]])]),w("label",UC,[T[43]||(T[43]=w("span",null,"坐标轴颜色",-1)),xe(w("input",{type:"color","onUpdate:modelValue":T[24]||(T[24]=p=>Pe(e).settings.axisColor=p),class:"sp-colr"},null,512),[[Je,Pe(e).settings.axisColor]]),w("span",VC,Ye(Pe(e).settings.axisColor),1)]),w("label",XC,[xe(w("input",{type:"checkbox","onUpdate:modelValue":T[25]||(T[25]=p=>Pe(e).settings.showAxisLabels=p)},null,512),[[Lt,Pe(e).settings.showAxisLabels]]),T[44]||(T[44]=Yt("显示刻度数值",-1))])],64)):$e("",!0),T[51]||(T[51]=w("div",{class:"sp-cache-note"},"整个系统设置会自动保存到当前浏览器",-1))])):$e("",!0),o.value?(se(),ce("div",{key:1,class:"help-overlay",role:"presentation",onClick:T[27]||(T[27]=xt(p=>o.value=!1,["self"]))},[w("section",YC,[w("header",$C,[T[52]||(T[52]=w("div",null,[w("h2",{id:"help-title"},"使用说明"),w("p",null,"从创建粒子到保存、导出的快速入门")],-1)),w("button",{class:"help-close","aria-label":"关闭使用说明",title:"关闭 (Esc)",onClick:T[26]||(T[26]=p=>o.value=!1)},"✕")]),T[53]||(T[53]=Vo('<div class="help-body" data-v-1b609e97><section class="help-section help-start" data-v-1b609e97><h3 data-v-1b609e97>快速开始</h3><ol data-v-1b609e97><li data-v-1b609e97><b data-v-1b609e97>创建对象:</b>在左侧“场景对象”中添加粒子、碰撞、路径或 Spine。</li><li data-v-1b609e97><b data-v-1b609e97>编辑粒子:</b>选中粒子系统,依次调整发射、形状、属性、外观资源和修改器。</li><li data-v-1b609e97><b data-v-1b609e97>查看效果:</b>使用底部时间轴播放、暂停或拖动到指定帧;修改参数后会自动重新计算。</li><li data-v-1b609e97><b data-v-1b609e97>保存成果:</b>配置文件用于继续编辑;“导出 Spine Json”支持 Spine 3.8、4.0、4.1 和 4.2。</li></ol></section><div class="help-grid" data-v-1b609e97><section class="help-section" data-v-1b609e97><h3 data-v-1b609e97>常用功能</h3><dl class="help-list" data-v-1b609e97><div data-v-1b609e97><dt data-v-1b609e97>小眼睛</dt><dd data-v-1b609e97>单独显示或隐藏场景对象;隐藏的粒子系统不会导出。</dd></div><div data-v-1b609e97><dt data-v-1b609e97>+Copy</dt><dd data-v-1b609e97>完整复制当前选中对象,方便对比不同参数效果。</dd></div><div data-v-1b609e97><dt data-v-1b609e97>背景图</dt><dd data-v-1b609e97>上传参考图并调整位置和透明度,只用于画布预览。</dd></div><div data-v-1b609e97><dt data-v-1b609e97>系统设置</dt><dd data-v-1b609e97>管理界面与辅助显示,并自动保存在当前浏览器中。</dd></div><div data-v-1b609e97><dt data-v-1b609e97>配置管理</dt><dd data-v-1b609e97>保存当前项目数据、加载配置,或直接使用预设文件;不包含系统设置。</dd></div><div data-v-1b609e97><dt data-v-1b609e97>Spine 骨骼</dt><dd data-v-1b609e97>在层级树搜索并选择骨骼,可用于粒子发射器跟随。</dd></div></dl></section><section class="help-section" data-v-1b609e97><h3 data-v-1b609e97>快捷键</h3><div class="shortcut-list" data-v-1b609e97><div data-v-1b609e97><kbd data-v-1b609e97>Ctrl/⌘</kbd><span data-v-1b609e97>+</span><kbd data-v-1b609e97>Z</kbd><em data-v-1b609e97>撤回上一步</em></div><div data-v-1b609e97><kbd data-v-1b609e97>Ctrl/⌘</kbd><span data-v-1b609e97>+</span><kbd data-v-1b609e97>S</kbd><em data-v-1b609e97>保存配置</em></div><div data-v-1b609e97><kbd data-v-1b609e97>Q</kbd><em data-v-1b609e97>拖动画布</em></div><div data-v-1b609e97><kbd data-v-1b609e97>W</kbd><em data-v-1b609e97>位移工具</em></div><div data-v-1b609e97><kbd data-v-1b609e97>E</kbd><em data-v-1b609e97>旋转工具</em></div><div data-v-1b609e97><kbd data-v-1b609e97>R</kbd><em data-v-1b609e97>缩放工具</em></div><div data-v-1b609e97><kbd data-v-1b609e97>D</kbd><em data-v-1b609e97>播放 / 暂停</em></div><div data-v-1b609e97><kbd data-v-1b609e97>S</kbd><em data-v-1b609e97>回到第一帧</em></div></div><p class="help-note" data-v-1b609e97>Q / W / E / R 需要先点击画布。光标位于输入框时,单键快捷键不会触发。</p></section></div><section class="help-section help-export" data-v-1b609e97><h3 data-v-1b609e97>配置与导出有什么区别?</h3><p data-v-1b609e97><b data-v-1b609e97>保存配置</b>会保存编辑器中的全部对象和参数,之后可以继续修改;<b data-v-1b609e97>导出 Spine Json</b>只导出显示中的粒子系统,并把跟随、碰撞和拖尾结果烘焙为独立动画数据。</p></section></div>',1))])])):$e("",!0),s.value?(se(),ce("div",GC,[T[54]||(T[54]=Yt(" 系统: ",-1)),w("b",jC,Ye(s.value.systems),1),T[55]||(T[55]=Yt(" · 粒子(骨骼): ",-1)),w("b",HC,Ye(s.value.particles),1),T[56]||(T[56]=Yt(" · 根骨骼: ",-1)),T[57]||(T[57]=w("b",null,"root",-1)),T[58]||(T[58]=w("span",{class:"hud-tip"},"滚轮缩放 · 左键拖动画布",-1))])):$e("",!0)]))}}),Ks=(i,e)=>{const t=i.__vccOpts||i;for(const[s,n]of e)t[s]=n;return t},zC=Ks(WC,[["__scopeId","data-v-1b609e97"]]),qC={class:"ns-label"},KC=["min","max","step","value","disabled"],ZC=["min","max","step","value","disabled"],JC=Ws({__name:"NumSlider",props:{label:{},modelValue:{},min:{},max:{},step:{},disabled:{type:Boolean}},emits:["update:modelValue"],setup(i,{emit:e}){const t=i,s=e,n=it(String(t.modelValue));cs(()=>t.modelValue,h=>{n.value=String(h)});function r(h){const l=parseFloat(h.target.value);Number.isNaN(l)||s("update:modelValue",l)}function o(h){n.value=h.target.value;const l=parseFloat(n.value);Number.isNaN(l)||s("update:modelValue",l)}function a(){const h=parseFloat(n.value);Number.isNaN(h)&&(n.value=String(t.modelValue))}return(h,l)=>(se(),ce("div",{class:Ze(["ns",{disabled:i.disabled}])},[w("span",qC,Ye(i.label),1),w("input",{type:"range",class:"ns-range",min:i.min,max:i.max,step:i.step,value:i.modelValue,disabled:i.disabled,onInput:r},null,40,KC),w("input",{type:"number",class:"ns-num",min:i.min,max:i.max,step:i.step,value:n.value,disabled:i.disabled,onInput:o,onBlur:a},null,40,ZC)],2))}}),Ge=Ks(JC,[["__scopeId","data-v-7c2fbed0"]]),QC={class:"ce"},e2={class:"ce-editor"},t2={class:"ce-grid"},i2=["x1","x2","y2"],s2=["y1","x2","y2"],n2=["x","y","width","height"],r2=["d"],o2={key:0,class:"ce-handles"},a2=["x1","y1","x2","y2"],l2=["cx","cy","onPointerdown"],h2=["x1","y1","x2","y2"],c2=["cx","cy","onPointerdown"],u2=["cx","cy"],d2=["cx","cy","onPointerdown","onDblclick"],f2={class:"ce-nav"},p2={class:"ce-tip"},Rn=8,m2=Ws({__name:"CurveEditor",props:{modelValue:{},defaultValue:{default:()=>[{x:0,y:0},{x:1,y:1}]},mode:{default:"linear"}},emits:["update:modelValue"],setup(i,{emit:e}){const t=i,s=e,n=it(null),r=it(300),o=it(110);let a=null;function h(){if(!n.value)return;const k=n.value.getBoundingClientRect();r.value=k.width,o.value=k.height}function l(k){return Rn+k*(r.value-Rn*2)}function c(k){return Rn+(1-k)*(o.value-Rn*2)}function u(){return[...t.modelValue].sort((k,F)=>k.x-F.x)}function f(k){s("update:modelValue",[...k].sort((F,D)=>F.x-D.x))}function d(){f(t.defaultValue.map(k=>({...k})))}const m=ut(()=>u());function g(k){const F=m.value[k],D=m.value[Math.max(0,k-1)];return{x:F.x-(F.x-D.x)/3,y:F.y-(F.y-D.y)/3}}function b(k){const F=m.value[k],D=m.value[Math.min(m.value.length-1,k+1)];return{x:F.x+(D.x-F.x)/3,y:F.y+(D.y-F.y)/3}}function _(k){const F=m.value[k],D=g(k);return{x:F.x+(F.inX??D.x-F.x),y:F.y+(F.inY??D.y-F.y)}}function M(k){const F=m.value[k],D=b(k);return{x:F.x+(F.outX??D.x-F.x),y:F.y+(F.outY??D.y-F.y)}}const v=ut(()=>{if(!m.value.length)return"";let k=`M ${l(m.value[0].x)} ${c(m.value[0].y)}`;for(let F=1;F<m.value.length;F++){const D=m.value[F];if(t.mode==="bezier"){const N=M(F-1),j=_(F);k+=` C ${l(N.x)} ${c(N.y)} ${l(j.x)} ${c(j.y)} ${l(D.x)} ${c(D.y)}`}else k+=` L ${l(D.x)} ${c(D.y)}`}return k});function S(k,F){const D=n.value.getBoundingClientRect(),N=(k-D.left-Rn)/(r.value-Rn*2),j=(F-D.top-Rn)/(o.value-Rn*2);return{x:Math.min(1,Math.max(0,Math.round(N*100)/100)),y:Math.min(1,Math.max(0,Math.round((1-j)*100)/100))}}let y=0;function I(k){if(k.target.classList.contains("ce-hit")||Date.now()-y<400)return;const{x:F,y:D}=S(k.clientX,k.clientY),N=u().filter(j=>Math.abs(j.x-F)>.02);N.push({x:F,y:D}),f(N)}let E={t:0,i:-1,x:0,y:0};function C(k,F){k.stopPropagation();const D=u().findIndex(L=>Math.abs(L.x-m.value[F].x)<1e-6&&Math.abs(L.y-m.value[F].y)<1e-6);if(D<0)return;const N=Date.now();if(N-E.t<300&&E.i===F&&Math.abs(k.clientX-E.x)<8&&Math.abs(k.clientY-E.y)<8){E={t:0,i:-1,x:0,y:0},B(F);return}E={t:N,i:F,x:k.clientX,y:k.clientY};const j=L=>{(Math.abs(L.clientX-k.clientX)>8||Math.abs(L.clientY-k.clientY)>8)&&(E={t:0,i:-1,x:0,y:0});const{x:P,y:X}=S(L.clientX,L.clientY),U=u();U[D]={x:P,y:X},f(U)},O=()=>{window.removeEventListener("pointermove",j),window.removeEventListener("pointerup",O)};window.addEventListener("pointermove",j),window.addEventListener("pointerup",O)}function R(k,F,D){k.stopPropagation();const N=O=>{const L=S(O.clientX,O.clientY),P=u(),X=P[F],U=D==="in"?P[Math.max(0,F-1)].x:X.x,Y=D==="in"?X.x:P[Math.min(P.length-1,F+1)].x,q=Math.min(Y,Math.max(U,L.x)),z=Math.round((q-X.x)*100)/100,ne=Math.round((L.y-X.y)*100)/100;P[F]=D==="in"?{...X,inX:z,inY:ne}:{...X,outX:z,outY:ne},f(P)},j=()=>{window.removeEventListener("pointermove",N),window.removeEventListener("pointerup",j)};window.addEventListener("pointermove",N),window.addEventListener("pointerup",j)}function B(k,F){F==null||F.stopPropagation();const D=u();D.length<=2||(y=Date.now(),f(D.filter((N,j)=>j!==k)))}return _o(()=>{h(),a=new ResizeObserver(h),n.value&&a.observe(n.value)}),wa(()=>{a==null||a.disconnect()}),(k,F)=>(se(),ce("div",QC,[w("div",e2,[(se(),ce("svg",{ref_key:"svg",ref:n,class:"ce-svg",onDblclick:I},[w("g",t2,[(se(),ce(qe,null,Ht([.25,.5,.75],D=>w("line",{key:"v"+D,x1:l(D),y1:"0",x2:l(D),y2:c(0)},null,8,i2)),64)),(se(),ce(qe,null,Ht([.25,.5,.75],D=>w("line",{key:"h"+D,x1:"0",y1:c(D),x2:l(1),y2:c(D)},null,8,s2)),64))]),w("rect",{x:l(0),y:c(1),width:l(1)-l(0),height:c(0)-c(1),class:"ce-frame",fill:"none"},null,8,n2),w("path",{d:v.value,class:"ce-line",fill:"none"},null,8,r2),i.mode==="bezier"?(se(),ce("g",o2,[(se(!0),ce(qe,null,Ht(m.value,(D,N)=>(se(),ce(qe,{key:"handles-"+N},[N>0?(se(),ce("line",{key:0,x1:l(D.x),y1:c(D.y),x2:l(_(N).x),y2:c(_(N).y)},null,8,a2)):$e("",!0),N>0?(se(),ce("circle",{key:1,cx:l(_(N).x),cy:c(_(N).y),r:"4",onPointerdown:j=>R(j,N,"in")},null,40,l2)):$e("",!0),N<m.value.length-1?(se(),ce("line",{key:2,x1:l(D.x),y1:c(D.y),x2:l(M(N).x),y2:c(M(N).y)},null,8,h2)):$e("",!0),N<m.value.length-1?(se(),ce("circle",{key:3,cx:l(M(N).x),cy:c(M(N).y),r:"4",onPointerdown:j=>R(j,N,"out")},null,40,c2)):$e("",!0)],64))),128))])):$e("",!0),(se(!0),ce(qe,null,Ht(m.value,(D,N)=>(se(),ce("g",{key:N},[w("circle",{cx:l(D.x),cy:c(D.y),r:"5",class:"ce-node"},null,8,u2),w("circle",{cx:l(D.x),cy:c(D.y),r:"9",class:"ce-hit",onPointerdown:j=>C(j,N),onDblclick:j=>B(N,j)},null,40,d2)]))),128))],544)),w("div",f2,[w("span",p2,Ye(i.mode==="bezier"?"拖动方形手柄调整弧度·双击空白新建·双击节点删除":"双击空白新建·双击节点删除·拖动节点调整"),1)])]),w("button",{class:"ce-reset",type:"button",title:"恢复默认曲线",onClick:d},"重置")]))}}),Is=Ks(m2,[["__scopeId","data-v-9bfb7b31"]]),g2={class:"pac"},v2={class:"pac-head"},y2={class:"pac-label"},x2={key:0,class:"pac-modes"},b2=["onClick"],w2={class:"pac-range"},_2={class:"pac-curve"},S2={class:"pac-axis"},T2=Ws({__name:"ParticleAttributeControl",props:{label:{},mode:{},valueMin:{},valueMax:{},curve:{},defaultCurve:{default:()=>[{x:0,y:0},{x:1,y:1}]},min:{},max:{},step:{default:1},allowDirection:{type:Boolean,default:!1},allowCurve:{type:Boolean,default:!0},showModes:{type:Boolean,default:!0},curveLabel:{default:"曲线输入 →"}},emits:["update:mode","update:valueMin","update:valueMax","update:curve"],setup(i){const e=i,t=ut(()=>{const s=[{label:"固定",value:"fixed"},{label:"随机",value:"random"}];return e.allowCurve&&s.push({label:"曲线",value:"curve"}),e.allowDirection&&s.push({label:"发射方向",value:"direction"}),s});return(s,n)=>(se(),ce("div",g2,[w("div",v2,[w("span",y2,Ye(i.label),1),i.showModes?(se(),ce("div",x2,[(se(!0),ce(qe,null,Ht(t.value,r=>(se(),ce("button",{key:r.value,class:Ze(["pac-mode",{on:i.mode===r.value}]),onClick:o=>s.$emit("update:mode",r.value)},Ye(r.label),11,b2))),128))])):$e("",!0)]),i.mode==="fixed"||i.mode==="direction"?(se(),Et(Ge,{key:0,label:i.mode==="direction"?"角度偏移":"数值",min:i.min,max:i.max,step:i.step,"model-value":i.valueMin,"onUpdate:modelValue":n[0]||(n[0]=r=>s.$emit("update:valueMin",r))},null,8,["label","min","max","step","model-value"])):i.mode==="random"?(se(),ce(qe,{key:1},[Ne(Ge,{label:"下限",min:i.min,max:i.max,step:i.step,"model-value":i.valueMin,"onUpdate:modelValue":n[1]||(n[1]=r=>s.$emit("update:valueMin",r))},null,8,["min","max","step","model-value"]),Ne(Ge,{label:"上限",min:i.min,max:i.max,step:i.step,"model-value":i.valueMax,"onUpdate:modelValue":n[2]||(n[2]=r=>s.$emit("update:valueMax",r))},null,8,["min","max","step","model-value"])],64)):(se(),ce(qe,{key:2},[w("div",w2,[Ne(Ge,{label:"范围下限",min:i.min,max:i.max,step:i.step,"model-value":i.valueMin,"onUpdate:modelValue":n[3]||(n[3]=r=>s.$emit("update:valueMin",r))},null,8,["min","max","step","model-value"]),Ne(Ge,{label:"范围上限",min:i.min,max:i.max,step:i.step,"model-value":i.valueMax,"onUpdate:modelValue":n[4]||(n[4]=r=>s.$emit("update:valueMax",r))},null,8,["min","max","step","model-value"])]),w("div",_2,[Ne(Is,{"model-value":i.curve,"default-value":i.defaultCurve,"onUpdate:modelValue":n[5]||(n[5]=r=>s.$emit("update:curve",r))},null,8,["model-value","default-value"]),w("div",S2,[n[6]||(n[6]=w("span",null,"0",-1)),w("span",null,Ye(i.curveLabel),1),n[7]||(n[7]=w("span",null,"1",-1))])])],64))]))}}),nn=Ks(T2,[["__scopeId","data-v-238f838c"]]),M2={class:"gradient-editor"},E2=["title","onClick","onDblclick","onPointerdown"],A2={key:0,class:"gradient-controls"},C2=["value"],I2=["value"],R2={class:"gradient-position"},P2=["value"],k2=["disabled"],F2=Ws({__name:"ColorGradientEditor",props:{modelValue:{}},emits:["update:modelValue"],setup(i,{emit:e}){const t=i,s=e,n=it(null),r=it(0),o=ut(()=>t.modelValue[r.value]||null),a=ut(()=>[...t.modelValue].sort((C,R)=>C.position-R.position)),h=ut(()=>{const C=a.value;return C.length?`linear-gradient(90deg, ${C.map(R=>`${R.color} ${l(R.position)*100}%`).join(", ")})`:"#ffffff"});cs(()=>t.modelValue.length,C=>{r.value>=C&&(r.value=Math.max(0,C-1))});function l(C){return Math.min(1,Math.max(0,Number(C)||0))}function c(){return t.modelValue.map(C=>({position:l(C.position),color:C.color}))}function u(C,R){const B=c();B[C]&&(B[C]={...B[C],...R},s("update:modelValue",B))}function f(C){u(r.value,{color:C.target.value})}function d(C){var k;const R=C.target,B=E(R.value,((k=o.value)==null?void 0:k.color)||"#ffffff");R.value=B,u(r.value,{color:B})}function m(C){const R=C.target;d(C),R.blur()}function g(C){const R=Number(C.target.value);Number.isFinite(R)&&u(r.value,{position:l(R/100)})}function b(C){const R=c();R.push({position:l(C),color:y(R,C)}),r.value=R.length-1,s("update:modelValue",R)}function _(C){if(!n.value)return;const R=n.value.getBoundingClientRect();b((C.clientX-R.left)/Math.max(1,R.width))}function M(){const C=a.value;let R=.5;if(C.length>1){let B=-1;for(let k=0;k<C.length-1;k++){const F=C[k+1].position-C[k].position;F>B&&(B=F,R=(C[k].position+C[k+1].position)/2)}}b(R)}function v(C){if(t.modelValue.length<=2||C<0)return;const R=c().filter((B,k)=>k!==C);r.value=Math.min(C,R.length-1),s("update:modelValue",R)}function S(C,R){if(!n.value)return;r.value=R;const B=F=>{const D=n.value.getBoundingClientRect();u(R,{position:l((F.clientX-D.left)/Math.max(1,D.width))})},k=()=>{window.removeEventListener("pointermove",B),window.removeEventListener("pointerup",k),window.removeEventListener("pointercancel",k)};window.addEventListener("pointermove",B),window.addEventListener("pointerup",k),window.addEventListener("pointercancel",k),C.preventDefault()}function y(C,R){const B=[...C].sort((k,F)=>k.position-F.position);if(!B.length)return"#ffffff";if(R<=B[0].position)return B[0].color;if(R>=B[B.length-1].position)return B[B.length-1].color;for(let k=0;k<B.length-1;k++){const F=B[k],D=B[k+1];if(R<F.position||R>D.position)continue;const N=(R-F.position)/Math.max(1e-4,D.position-F.position);return I(F.color,D.color,N)}return B[B.length-1].color}function I(C,R,B){const k=j=>{const O=parseInt(j.replace("#","").padEnd(6,"0").slice(0,6),16);return[O>>16&255,O>>8&255,O&255]},F=k(C),D=k(R),N=j=>Math.round(F[j]+(D[j]-F[j])*B);return`#${[N(0),N(1),N(2)].map(j=>j.toString(16).padStart(2,"0")).join("")}`}function E(C,R){let B=C.trim().replace(/^#/,"");return/^[0-9a-f]{3}$/i.test(B)&&(B=B.split("").map(k=>k+k).join("")),/^[0-9a-f]{6}$/i.test(B)?`#${B.toLowerCase()}`:R}return(C,R)=>(se(),ce("div",M2,[w("div",{ref_key:"bar",ref:n,class:"gradient-bar",style:Pi({background:h.value}),title:"双击色带添加色标",onDblclick:_},[(se(!0),ce(qe,null,Ht(i.modelValue,(B,k)=>(se(),ce("button",{key:k,type:"button",class:Ze(["gradient-stop",{selected:k===r.value}]),style:Pi({left:`${l(B.position)*100}%`,"--stop-color":B.color}),title:`${Math.round(l(B.position)*100)}% · ${B.color}`,onClick:xt(F=>r.value=k,["stop"]),onDblclick:xt(F=>v(k),["stop"]),onPointerdown:xt(F=>S(F,k),["stop"])},null,46,E2))),128))],36),o.value?(se(),ce("div",A2,[w("input",{type:"color",class:"gradient-color",value:o.value.color,"aria-label":"色标颜色",onInput:f},null,40,C2),w("input",{type:"text",class:"gradient-hex-input",value:o.value.color,"aria-label":"色标颜色值",spellcheck:"false",onChange:d,onKeydown:da(m,["enter"])},null,40,I2),w("label",R2,[w("input",{type:"number",min:"0",max:"100",step:"1",value:Math.round(l(o.value.position)*100),"aria-label":"色标位置",onInput:g},null,40,P2),R[1]||(R[1]=w("span",null,"%",-1))]),w("button",{type:"button",class:"gradient-action",title:"在中间新增颜色",onClick:M},"+"),w("button",{type:"button",class:"gradient-action danger",title:"删除当前色标",disabled:i.modelValue.length<=2,onClick:R[0]||(R[0]=B=>v(r.value))},"×",8,k2)])):$e("",!0),R[2]||(R[2]=w("div",{class:"gradient-hint"},"双击色带新增 · 拖动色标调整位置 · 双击色标删除",-1))]))}}),pg=Ks(F2,[["__scopeId","data-v-f6ab10bf"]]),O2={class:"image-card"},B2={class:"imgrow"},L2=["title"],D2=["src","alt"],N2={key:1,viewBox:"0 0 24 24",width:"22",height:"22",fill:"none",stroke:"#8a93bb","stroke-width":"1.6"},U2={class:"img-fields"},V2={key:0,class:"row"},X2={class:"row"},Y2=["placeholder"],$2={class:"img-actions"},G2=["title"],j2=["disabled"],H2={class:"thumb-note"},W2={key:0,class:"row"},z2={class:"row"},q2={class:"row"},K2={class:"sequence-note"},Z2={class:"resource-weight-row"},J2=["disabled","title"],Q2={key:0,viewBox:"0 0 24 24","aria-hidden":"true"},eI={key:1,viewBox:"0 0 24 24","aria-hidden":"true"},tI=Ws({__name:"ImageResourceCard",props:{resource:{},resourceCount:{},defaultFile:{},namePlaceholder:{default:"particle"},showFolder:{type:Boolean,default:!0},supportsSequence:{type:Boolean,default:!1}},emits:["pick","pickSequence","reset","remove","updateWeight","toggleLock"],setup(i,{emit:e}){const t=i,s=e,n=ut(()=>{var l,c;if(t.resource.imageMode==="sequence"){const u=t.resource.sequenceFrames||[];if(!u.length)return"未选择序列帧";const f=((l=u[0])==null?void 0:l.name)||"第 1 帧",d=((c=u[u.length-1])==null?void 0:c.name)||f;return u.length===1?`1 帧 · ${f}`:`${u.length} 帧 · ${f} → ${d}`}const h=t.resource.textureName||t.defaultFile.replace(/\.[^.]+$/,"");return h.includes(".")?h:`${h}.png`}),r=ut(()=>{var h,l;return t.resource.imageMode==="sequence"?((l=(h=t.resource.sequenceFrames)==null?void 0:h[0])==null?void 0:l.previewUrl)||"":t.resource.previewUrl}),o=ut(()=>{var u,f;const h=t.resource.sequenceFrames||[];if(!h.length)return"未选择序列帧";const l=((u=h[0])==null?void 0:u.name)||"第一张图片",c=((f=h[h.length-1])==null?void 0:f.name)||"最后一张图片";return`已选择 ${h.length} 帧,按 ${l}-${c} 顺序播放`});function a(){t.supportsSequence&&t.resource.imageMode==="sequence"?s("pickSequence",t.resource.id):s("pick",t.resource.id)}return(h,l)=>(se(),ce("div",O2,[w("div",B2,[w("button",{class:"img-thumb",title:i.supportsSequence&&i.resource.imageMode==="sequence"?"选择序列帧图片":"选择本地图片",onClick:a},[r.value?(se(),ce("img",{key:0,src:r.value,alt:i.resource.textureName},null,8,D2)):(se(),ce("svg",N2,[...l[10]||(l[10]=[w("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"},null,-1),w("circle",{cx:"8.5",cy:"8.5",r:"1.6"},null,-1),w("path",{d:"M21 15l-5-5-9 9"},null,-1)])]))],8,L2),w("div",U2,[i.showFolder?(se(),ce("label",V2,[l[11]||(l[11]=w("span",null,"子文件夹",-1)),xe(w("input",{"onUpdate:modelValue":l[0]||(l[0]=c=>i.resource.textureFolder=c),type:"text",class:"inp",placeholder:"subfolder/"},null,512),[[Je,i.resource.textureFolder]])])):$e("",!0),w("label",X2,[l[12]||(l[12]=w("span",null,"名称",-1)),xe(w("input",{"onUpdate:modelValue":l[1]||(l[1]=c=>i.resource.textureName=c),type:"text",class:"inp",placeholder:i.namePlaceholder},null,8,Y2),[[Je,i.resource.textureName]])])]),w("div",$2,[w("button",{class:"mini-btn2",title:`恢复 ${i.defaultFile}`,onClick:l[2]||(l[2]=c=>h.$emit("reset",i.resource.id))},"⟳",8,G2),w("button",{class:"mini-btn2",title:"删除图片资源",disabled:i.resourceCount===1,onClick:l[3]||(l[3]=c=>h.$emit("remove",i.resource.id))},"🗑",8,j2)])]),w("div",H2,Ye(n.value),1),i.supportsSequence?(se(),ce("label",W2,[l[14]||(l[14]=w("span",null,"图片模式",-1)),xe(w("select",{"onUpdate:modelValue":l[4]||(l[4]=c=>i.resource.imageMode=c),class:"inp"},[...l[13]||(l[13]=[w("option",{value:"fixed"},"固定",-1),w("option",{value:"sequence"},"序列帧",-1)])],512),[[kt,i.resource.imageMode]])])):$e("",!0),i.supportsSequence&&i.resource.imageMode==="sequence"?(se(),ce(qe,{key:1},[w("label",z2,[l[16]||(l[16]=w("span",null,"播放模式",-1)),xe(w("select",{"onUpdate:modelValue":l[5]||(l[5]=c=>i.resource.sequencePlayback=c),class:"inp"},[...l[15]||(l[15]=[w("option",{value:"once-hide"},"单次-尾帧消失",-1),w("option",{value:"once-hold"},"单次-尾帧固定",-1),w("option",{value:"loop-forward"},"正向循环",-1),w("option",{value:"loop-reverse"},"反向循环",-1)])],512),[[kt,i.resource.sequencePlayback]])]),w("label",q2,[l[17]||(l[17]=w("span",null,"播放帧率",-1)),xe(w("input",{"onUpdate:modelValue":l[6]||(l[6]=c=>i.resource.sequenceFps=c),type:"number",min:"1",max:"120",step:"1",class:"inp"},null,512),[[Je,i.resource.sequenceFps,void 0,{number:!0}]])]),w("button",{class:"sequence-pick",onClick:l[7]||(l[7]=c=>h.$emit("pickSequence",i.resource.id))},"选择序列帧(多选)"),w("div",K2,Ye(o.value),1)],64)):$e("",!0),w("div",Z2,[Ne(Ge,{class:"resource-weight-control",label:"占比%",min:0,max:100,step:1,"model-value":i.resource.weight,disabled:i.resource.locked||i.resourceCount===1,"onUpdate:modelValue":l[8]||(l[8]=c=>h.$emit("updateWeight",i.resource.id,c))},null,8,["model-value","disabled"]),w("button",{class:Ze(["weight-lock",{on:i.resource.locked}]),disabled:i.resourceCount===1,title:i.resource.locked?"解除占比锁定":"锁定当前占比",onClick:l[9]||(l[9]=c=>h.$emit("toggleLock",i.resource.id))},[i.resource.locked?(se(),ce("svg",Q2,[...l[18]||(l[18]=[w("rect",{x:"5",y:"10",width:"14",height:"10",rx:"2"},null,-1),w("path",{d:"M8 10V7a4 4 0 0 1 8 0v3"},null,-1)])])):(se(),ce("svg",eI,[...l[19]||(l[19]=[w("rect",{x:"5",y:"10",width:"14",height:"10",rx:"2"},null,-1),w("path",{d:"M16 10V7a4 4 0 0 0-7.5-2"},null,-1)])]))],10,J2)]),O1(h.$slots,"default",{},void 0)]))}}),mg=Ks(tI,[["__scopeId","data-v-68ff5314"]]),iI={class:"spine-editor"},sI={class:"field wide"},nI={class:"grid three"},rI={class:"field"},oI={class:"field"},aI={class:"field"},lI={class:"grid three"},hI={class:"field"},cI={class:"field"},uI={class:"field"},dI=["disabled"],fI={class:"asset-row"},pI=["title"],mI={class:"asset-row"},gI=["title"],vI={class:"asset-row"},yI=["title"],xI={class:"asset-actions"},bI=["disabled"],wI={class:"runtime-note"},_I={key:0},SI={key:0,class:"error"},TI={class:"section-box"},MI={key:0,class:"empty"},EI={key:1,class:"field wide"},AI=["value"],CI={class:"section-box"},II={class:"tree-title-row"},RI=["disabled","title"],PI={key:0,class:"empty"},kI={key:1,class:"bone-search"},FI={key:2,class:"empty"},OI={key:3,class:"bone-tree"},BI=["onClick","onKeydown"],LI=["title","onClick"],DI={key:1,class:"bone-leaf"},NI={class:"bone-name"},UI=Ws({__name:"SpineObjectPanel",props:{spineObject:{}},setup(i){const e=i,t=Aa(),s=it(null),n=it(null),r=it(null),o=it(null),a=it(new Set),h=it(""),l=it(null),c=it(null),u=it([]);e.spineObject.selectedBone==null&&(e.spineObject.selectedBone=""),e.spineObject.sourceBundle==null&&(e.spineObject.sourceBundle=null),e.spineObject.dataVersion==null&&(e.spineObject.dataVersion="");const f=ut(()=>{var L;return((L=l.value)==null?void 0:L.name)||e.spineObject.skeletonFileName}),d=ut(()=>{var L;return((L=c.value)==null?void 0:L.name)||e.spineObject.atlasFileName}),m=ut(()=>u.value.length?u.value.map(L=>L.name):e.spineObject.textureFileNames),g=ut(()=>m.value.length?`${m.value.length} 张:${m.value.join(", ")}`:"PNG / JPEG / WebP..."),b=ut(()=>new Set(e.spineObject.bones.map(L=>L.parent).filter(L=>!!L))),_=ut(()=>new Map(e.spineObject.bones.map(L=>[L.name,L]))),M=ut(()=>e.spineObject.bones.filter(L=>{var U;const P=h.value.trim().toLocaleLowerCase();if(P)return L.name.toLocaleLowerCase().includes(P);let X=L.parent;for(;X;){if(a.value.has(X))return!1;X=((U=_.value.get(X))==null?void 0:U.parent)||null}return!0})),v=ut(()=>b.value.size>0&&[...b.value].every(L=>a.value.has(L)));function S(L){const P=e.spineObject.selectedBone===L;for(const X of t.spines)X.selectedBone="";P||(e.spineObject.selectedBone=L)}function y(L){a.value.has(L)?a.value.delete(L):a.value.add(L)}function I(){a.value=v.value?new Set:new Set(b.value)}function E(L){var P;return((P=L.target.files)==null?void 0:P[0])||null}function C(L){l.value=E(L)}function R(L){c.value=E(L)}function B(L){u.value=Array.from(L.target.files||[])}function k(L){return L.name.replace(/\.[^.]+$/,"").toLocaleLowerCase()}async function F(L){const P=Array.from(L.target.files||[]);if(!P.length)return;const X=P.filter(H=>/\.(json|skel)$/i.test(H.name)),U=P.filter(H=>/\.atlas$/i.test(H.name)),Y=P.filter(H=>/\.(png|jpe?g|webp|wepb)$/i.test(H.name)),q=U.map(H=>({atlas:H,skeleton:X.find(Z=>k(Z)===k(H))})).find(H=>H.skeleton),z=(q==null?void 0:q.skeleton)||X[0]||null,ne=(q==null?void 0:q.atlas)||U[0]||null;if(l.value=z,c.value=ne,u.value=Y,!z||!ne||!Y.length){const H=[!z&&"JSON / SKEL",!ne&&"Atlas",!Y.length&&"纹理图片"].filter(Boolean).join("、");e.spineObject.status="error",e.spineObject.error=`所选文件夹缺少:${H}`;return}await j()}function D(){t.recalcTotalFrames()}function N(){D(),t.timeline.frame=0}async function j(){var X;const L=l.value,P=c.value;if(!L||!P||!u.value.length){e.spineObject.status="error",e.spineObject.error="请依次选择 Spine 数据、Atlas 和全部纹理图片";return}e.spineObject.status="loading",e.spineObject.error="";try{const U=await lx(L,P,u.value);Lh(e.spineObject.id,U),e.spineObject.skeletonFileName=L.name,e.spineObject.atlasFileName=P.name,e.spineObject.textureFileNames=u.value.map(Y=>Y.name),e.spineObject.dataVersion=U.dataVersion,e.spineObject.animations=U.animations,e.spineObject.bones=U.bones,e.spineObject.selectedBone="",h.value="",a.value=new Set,e.spineObject.selectedAnimation=((X=U.animations[0])==null?void 0:X.name)||"",e.spineObject.assetVersion++,e.spineObject.status="ready",D(),t.timeline.frame=0;try{e.spineObject.sourceBundle=await ZA(L,P,u.value)}catch(Y){e.spineObject.sourceBundle=null,console.warn("Spine 配置资源嵌入失败",Y)}}catch(U){e.spineObject.status="error",e.spineObject.error=U instanceof Error?U.message:String(U)}}function O(){Ea(e.spineObject.id),l.value=null,c.value=null,u.value=[],s.value&&(s.value.value=""),n.value&&(n.value.value=""),r.value&&(r.value.value=""),o.value&&(o.value.value=""),e.spineObject.skeletonFileName="",e.spineObject.atlasFileName="",e.spineObject.textureFileNames=[],e.spineObject.dataVersion="",e.spineObject.sourceBundle=null,e.spineObject.animations=[],e.spineObject.bones=[],e.spineObject.selectedBone="",h.value="",a.value=new Set,e.spineObject.selectedAnimation="",e.spineObject.assetVersion++,e.spineObject.status="empty",e.spineObject.error="",D()}return(L,P)=>(se(),ce("div",iI,[P[30]||(P[30]=w("div",{class:"editor-title"},"Spine 属性",-1)),w("label",sI,[P[15]||(P[15]=w("span",null,"Spine 名称",-1)),xe(w("input",{"onUpdate:modelValue":P[0]||(P[0]=X=>i.spineObject.name=X)},null,512),[[Je,i.spineObject.name]])]),w("div",nI,[w("label",rI,[P[16]||(P[16]=w("span",null,"X 位置",-1)),xe(w("input",{"onUpdate:modelValue":P[1]||(P[1]=X=>i.spineObject.x=X),type:"number"},null,512),[[Je,i.spineObject.x,void 0,{number:!0}]])]),w("label",oI,[P[17]||(P[17]=w("span",null,"Y 位置",-1)),xe(w("input",{"onUpdate:modelValue":P[2]||(P[2]=X=>i.spineObject.y=X),type:"number"},null,512),[[Je,i.spineObject.y,void 0,{number:!0}]])]),w("label",aI,[P[18]||(P[18]=w("span",null,"旋转",-1)),xe(w("input",{"onUpdate:modelValue":P[3]||(P[3]=X=>i.spineObject.rotation=X),type:"number"},null,512),[[Je,i.spineObject.rotation,void 0,{number:!0}]])])]),w("div",lI,[w("label",hI,[P[19]||(P[19]=w("span",null,"Scale X",-1)),xe(w("input",{"onUpdate:modelValue":P[4]||(P[4]=X=>i.spineObject.scaleX=X),type:"number",step:"0.05"},null,512),[[Je,i.spineObject.scaleX,void 0,{number:!0}]])]),w("label",cI,[P[20]||(P[20]=w("span",null,"Scale Y",-1)),xe(w("input",{"onUpdate:modelValue":P[5]||(P[5]=X=>i.spineObject.scaleY=X),type:"number",step:"0.05"},null,512),[[Je,i.spineObject.scaleY,void 0,{number:!0}]])]),w("label",uI,[P[21]||(P[21]=w("span",null,"开始时间",-1)),xe(w("input",{"onUpdate:modelValue":P[6]||(P[6]=X=>i.spineObject.timeOffset=X),type:"number",min:"0",step:"0.033333",onChange:D},null,544),[[Je,i.spineObject.timeOffset,void 0,{number:!0}]])])]),P[31]||(P[31]=w("div",{class:"divider"},null,-1)),P[32]||(P[32]=w("div",{class:"section-title"},"Spine 资源",-1)),w("input",{ref_key:"skeletonInput",ref:s,hidden:"",type:"file",accept:".json,.skel,application/json,application/octet-stream",onChange:C},null,544),w("input",{ref_key:"atlasInput",ref:n,hidden:"",type:"file",accept:".atlas,text/plain",onChange:R},null,544),w("input",{ref_key:"textureInput",ref:r,hidden:"",type:"file",multiple:"",accept:".png,.jpg,.jpeg,.webp,.wepb,image/png,image/jpeg,image/webp",onChange:B},null,544),w("input",{ref_key:"folderInput",ref:o,hidden:"",type:"file",multiple:"",webkitdirectory:"",directory:"",onChange:F},null,544),w("button",{class:"folder-select",disabled:i.spineObject.status==="loading",onClick:P[7]||(P[7]=X=>{var U;return(U=o.value)==null?void 0:U.click()})},"选择文件夹并加载",8,dI),P[33]||(P[33]=w("div",{class:"folder-hint"},"一次读取文件夹中的 JSON / SKEL、Atlas 和全部纹理;仍可在下方单独替换资源。",-1)),w("div",fI,[w("div",{class:"asset-name",title:f.value},Ye(f.value||"JSON / SKEL..."),9,pI),w("button",{onClick:P[8]||(P[8]=X=>{var U;return(U=s.value)==null?void 0:U.click()})},"选择")]),w("div",mI,[w("div",{class:"asset-name",title:d.value},Ye(d.value||"Atlas..."),9,gI),w("button",{onClick:P[9]||(P[9]=X=>{var U;return(U=n.value)==null?void 0:U.click()})},"选择")]),w("div",vI,[w("div",{class:"asset-name",title:m.value.join(", ")},Ye(g.value),9,yI),w("button",{onClick:P[10]||(P[10]=X=>{var U;return(U=r.value)==null?void 0:U.click()})},"选择(多选)")]),w("div",xI,[w("button",{class:"load",disabled:i.spineObject.status==="loading",onClick:j},Ye(i.spineObject.status==="loading"?"加载中…":"↧ 加载"),9,bI),w("button",{class:"clear",onClick:O},"清除")]),w("div",wI,[P[22]||(P[22]=Yt(" 支持 Spine 3.8 / 4.0 / 4.1 / 4.2 JSON · 4.2.119 预览运行时 · 本地离线 ",-1)),i.spineObject.dataVersion?(se(),ce("span",_I," · 当前资源 "+Ye(i.spineObject.dataVersion),1)):$e("",!0)]),i.spineObject.error?(se(),ce("div",SI,Ye(i.spineObject.error),1)):$e("",!0),w("div",TI,[P[25]||(P[25]=w("div",{class:"section-title"},"Spine 动画",-1)),i.spineObject.animations.length?(se(),ce("label",EI,[P[24]||(P[24]=w("span",null,"时间轴播放动画",-1)),xe(w("select",{"onUpdate:modelValue":P[11]||(P[11]=X=>i.spineObject.selectedAnimation=X),onChange:N},[P[23]||(P[23]=w("option",{value:""},"无",-1)),(se(!0),ce(qe,null,Ht(i.spineObject.animations,X=>(se(),ce("option",{key:X.name,value:X.name},Ye(X.name)+"("+Ye(X.duration.toFixed(2))+"s) ",9,AI))),128))],544),[[kt,i.spineObject.selectedAnimation]])])):(se(),ce("div",MI,"无可用动画"))]),w("div",CI,[w("div",II,[P[29]||(P[29]=w("div",{class:"section-title"},"层级树",-1)),w("button",{class:Ze(["selected-bone",{active:i.spineObject.selectedBone}]),disabled:!i.spineObject.selectedBone,title:i.spineObject.selectedBone?"点击清除骨骼选择":"当前未选择骨骼",onClick:P[12]||(P[12]=X=>i.spineObject.selectedBone="")},[i.spineObject.selectedBone?(se(),ce(qe,{key:0},[P[26]||(P[26]=Yt("清除选中骨骼:",-1)),w("strong",null,Ye(i.spineObject.selectedBone),1)],64)):(se(),ce(qe,{key:1},[P[27]||(P[27]=Yt("当前骨骼:",-1)),P[28]||(P[28]=w("strong",null,"未选择",-1))],64))],10,RI),i.spineObject.bones.length?(se(),ce("button",{key:0,class:"tree-action",onClick:I},Ye(v.value?"全部展开":"全部折叠"),1)):$e("",!0)]),i.spineObject.bones.length?(se(),ce("div",kI,[xe(w("input",{"onUpdate:modelValue":P[13]||(P[13]=X=>h.value=X),type:"search","aria-label":"搜索骨骼",placeholder:"搜索骨骼名称…"},null,512),[[Je,h.value,void 0,{trim:!0}]]),h.value?(se(),ce("button",{key:0,title:"清空搜索","aria-label":"清空骨骼搜索",onClick:P[14]||(P[14]=X=>h.value="")},"✕")):$e("",!0)])):(se(),ce("div",PI,"未加载 Spine")),i.spineObject.bones.length&&!M.value.length?(se(),ce("div",FI,"未找到匹配的骨骼")):i.spineObject.bones.length?(se(),ce("div",OI,[(se(!0),ce(qe,null,Ht(M.value,X=>(se(),ce("div",{key:X.name,class:Ze(["bone",{selected:i.spineObject.selectedBone===X.name}]),style:Pi({paddingLeft:`${6+X.depth*16}px`}),role:"button",tabindex:"0",onClick:U=>S(X.name),onKeydown:da(xt(U=>S(X.name),["prevent"]),["enter"])},[b.value.has(X.name)?(se(),ce("button",{key:0,class:"bone-toggle",title:a.value.has(X.name)?"展开子骨骼":"折叠子骨骼",onClick:xt(U=>y(X.name),["stop"])},Ye(a.value.has(X.name)?"▸":"▾"),9,LI)):(se(),ce("span",DI,"•")),w("span",NI,Ye(X.name),1)],46,BI))),128))])):$e("",!0)])]))}}),VI=Ks(UI,[["__scopeId","data-v-af64e8e8"]]),XI="3.8";function Wi(i,e,t){i[e]==null&&i[t]!=null&&(i[e]=i[t]),delete i[t]}function Pd(i){if(!i||typeof i!="object")return;if(Array.isArray(i)){for(const t of i)Pd(t);return}const e=i;Array.isArray(e.curve)&&delete e.curve;for(const t of Object.values(e))Pd(t)}function YI(i){for(const e of i.bones)Wi(e,"transform","inherit");for(const e of i.transform||[])Wi(e,"rotateMix","mixRotate"),e.translateMix==null&&(e.translateMix=e.mixX??e.mixY),e.scaleMix==null&&(e.scaleMix=e.mixScaleX??e.mixScaleY),Wi(e,"shearMix","mixShearY"),delete e.mixX,delete e.mixY,delete e.mixScaleX,delete e.mixScaleY;for(const e of i.path||[])Wi(e,"rotateMix","mixRotate"),e.translateMix==null&&(e.translateMix=e.mixX??e.mixY),delete e.mixX,delete e.mixY;for(const e of i.skins)for(const t of Object.values(e.attachments||{}))for(const s of Object.values(t||{}))s.parent!=null&&Wi(s,"deform","timelines")}function $I(i){for(const e of Object.values(i.slots||{}))Wi(e,"color","rgba"),Wi(e,"twoColor","rgba2")}function GI(i){for(const e of Object.values(i.bones||{}))for(const t of e.rotate||[])Wi(t,"angle","value")}function jI(i){for(const e of Object.values(i.transform||{}))for(const t of e)Wi(t,"rotateMix","mixRotate"),t.translateMix==null&&(t.translateMix=t.mixX??t.mixY),t.scaleMix==null&&(t.scaleMix=t.mixScaleX??t.mixScaleY),Wi(t,"shearMix","mixShearY"),delete t.mixX,delete t.mixY,delete t.mixScaleX,delete t.mixScaleY}function HI(i){for(const e of Object.values(i.path||{})){for(const t of["position","spacing"])for(const s of e[t]||[])Wi(s,t,"value");for(const t of e.mix||[])Wi(t,"rotateMix","mixRotate"),t.translateMix==null&&(t.translateMix=t.mixX??t.mixY),delete t.mixX,delete t.mixY}}function WI(i){if(!i.attachments)return;const e=i.deform||(i.deform={});for(const[t,s]of Object.entries(i.attachments)){const n=e[t]||(e[t]={});for(const[r,o]of Object.entries(s)){const a=n[r]||(n[r]={});for(const[h,l]of Object.entries(o))l.deform&&(a[h]=l.deform)}}delete i.attachments}function zI(i){i.skeleton.spine=XI,YI(i);for(const e of Object.values(i.animations))$I(e),GI(e),jI(e),HI(e),WI(e);return Pd(i.animations),i}function qI(i,e,t,s){const n=t.frame-e.frame,r=n<=0?0:(i.frame-e.frame)/n;let o=0;for(let a=0;a<i.values.length;a++){const h=e.values[a]+(t.values[a]-e.values[a])*r;o=Math.max(o,Math.abs(i.values[a]-h)/Math.max(1e-9,s[a]??s[0]??.001))}return o}function yx(i,e,t=new Set){if(i.length<=2)return i.slice();const s=new Set([0,i.length-1]);for(let o=1;o<i.length-1;o++)t.has(i[o].frame)&&s.add(o);const n=()=>[...s].sort((o,a)=>o-a);let r=!0;for(;r;){r=!1;const o=n();for(let a=0;a<o.length-1;a++){const h=o[a],l=o[a+1];let c=-1,u=1;for(let f=h+1;f<l;f++){const d=qI(i[f],i[h],i[l],e);d>u&&(u=d,c=f)}c>=0&&(s.add(c),r=!0)}}return n().map(o=>i[o])}function gg(i,e,t,s,n){const r=t-e+1;if(r<2)return 0;const o=n?e:t,a=n?e+1:t-1,h=n?e+2:t-2,l=Math.abs(i[a].frame-i[o].frame);if(r>=3&&l>0&&Math.abs(Math.abs(i[h].frame-i[a].frame)-l)<1e-6){const u=i[o].values[s],f=i[a].values[s],d=i[h].values[s];return n?(-3*u+4*f-d)/(2*l):(3*u-4*f+d)/(2*l)}const c=i[a].frame-i[o].frame;return c?(i[a].values[s]-i[o].values[s])/c:0}function vg(i,e,t){const s=i[t].frame-i[e].frame,n=[];for(let r=0;r<i[e].values.length;r++){const o=i[e].values[r],a=i[t].values[r],h=Math.min(...i.slice(e,t+1).map(f=>f.values[r])),l=Math.max(...i.slice(e,t+1).map(f=>f.values[r])),c=o+gg(i,e,t,r,!0)*s/3,u=a-gg(i,e,t,r,!1)*s/3;n.push([Math.max(h,Math.min(l,c)),Math.max(h,Math.min(l,u))])}return{values:n}}function KI(i,e,t,s,n){const r=1-n;return r*r*r*i+3*r*r*n*e+3*r*n*n*t+n*n*n*s}function ZI(i,e,t,s,n){const r=t.frame-e.frame,o=r<=0?0:(i.frame-e.frame)/r;let a=0;for(let h=0;h<i.values.length;h++){const l=s.values[h],c=KI(e.values[h],l[0],l[1],t.values[h],o);a=Math.max(a,Math.abs(i.values[h]-c)/Math.max(1e-9,n[h]??n[0]??.001))}return a}function xx(i,e,t=new Set){if(i.length<=1)return{samples:i.slice(),controls:[]};const s=new Set([0,i.length-1]);for(let a=1;a<i.length-1;a++)t.has(i[a].frame)&&s.add(a);const n=()=>[...s].sort((a,h)=>a-h);let r=!0;for(;r;){r=!1;const a=n();for(let h=0;h<a.length-1;h++){const l=a[h],c=a[h+1];if(c-l<=1)continue;const u=vg(i,l,c);let f=-1,d=1;for(let m=l+1;m<c;m++){const g=ZI(i[m],i[l],i[c],u,e);g>d&&(d=g,f=m)}f>=0&&(s.add(f),r=!0)}}const o=n();return{samples:o.map(a=>i[a]),controls:o.slice(0,-1).map((a,h)=>vg(i,a,o[h+1]))}}function JI(i){if(!i.length)return[];const e=[i[0]];for(let t=1;t<i.length;t++){let s=i[t];for(;s-e[t-1]>180;)s-=360;for(;s-e[t-1]<-180;)s+=360;e.push(s)}return e}function Zt(i){if(!Number.isFinite(i))return 0;const e=Math.round(i*1e5)/1e5;return Object.is(e,-0)?0:e}function QI(i,e,t,s){const n=Math.max(2,Math.min(16,Math.round(Number(i.trailGridRows)||2))),r=Math.max(2,Math.min(32,Math.round(Number(i.trailGridCols)||2))),o=Math.max(2,t.length),a=e.lengthMode==="random"?Math.max(1,Number(e.lengthMin)||0,Number(e.lengthMax)||0):Math.max(.001,Number(e.length)||100),h=e.widthSizeMode==="random"?Math.max(1,Number(e.widthMin)||0,Number(e.widthMax)||0):Math.max(.001,Number(e.width)||100),l=(Number(e.rotation)||0)*Math.PI/180,c=Math.cos(l),u=Math.sin(l),f=[],d=[],m=[],g=[],b=[];for(let v=0;v<r;v++)b.push({col:v,row:0});for(let v=1;v<n;v++)b.push({col:r-1,row:v});for(let v=r-2;v>=0;v--)b.push({col:v,row:n-1});for(let v=n-2;v>=1;v--)b.push({col:0,row:v});const _=b.length;for(let v=1;v<r-1;v++)for(let S=1;S<n-1;S++)b.push({col:v,row:S});const M=new Map;for(let v=0;v<b.length;v++){const{col:S,row:y}=b[v];M.set(`${S}:${y}`,v);const I=S/(r-1),E=I*(o-1),C=Math.min(o-1,Math.floor(E)),R=Math.min(o-1,C+1),B=E-C,k=y/(n-1),F=.5+c*(I-.5)-u*(k-.5),D=.5+u*(I-.5)+c*(k-.5);f.push(Zt(F),Zt(D));const N=(.5-k)*h;C===R||B<1e-6?m.push(1,t[C],0,Zt(N),1):m.push(2,t[C],0,Zt(N),Zt(1-B),t[R],0,Zt(N),Zt(B))}for(let v=0;v<r-1;v++)for(let S=0;S<n-1;S++){const y=M.get(`${v}:${S}`),I=M.get(`${v+1}:${S}`),E=M.get(`${v}:${S+1}`),C=M.get(`${v+1}:${S+1}`);d.push(y,I,E,I,C,E)}for(let v=0;v<_;v++)g.push(v*2,(v+1)%_*2);return{type:"mesh",path:s,uvs:f,triangles:d,vertices:m,hull:_,edges:g,width:a,height:h}}const yg={normal:"normal",add:"additive",multiply:"multiply",screen:"screen"},xg=.1,bg=.1,wg=.01,ll=.01;function eR(i,e){return String(i||"").trim().replace(/[\\/:*?"<>|\s]+/g,"_").replace(/^_+|_+$/g,"")||e}function bx(i,e){let t=i,s=2;for(;e.has(t);)t=`${i}_${s++}`;return e.add(t),t}function tR(i){return i.replace(/\.[^./\\]+$/,"")}function wx(i,e){return tR([i,e].filter(Boolean).join("/").replace(/\\/g,"/").replace(/\/{2,}/g,"/").replace(/^\.\//,""))}function iR(i){var s,n;const e=Number(((s=i==null?void 0:i.orig)==null?void 0:s.width)??(i==null?void 0:i.width))||0,t=Number(((n=i==null?void 0:i.orig)==null?void 0:n.height)??(i==null?void 0:i.height))||0;return{width:e,height:t}}function hl(i){return Math.round(Math.max(0,Math.min(1,i))*255).toString(16).padStart(2,"0")}function _g(i,e){return[(i>>16&255)/255,(i>>8&255)/255,(i&255)/255,Math.max(0,Math.min(1,e))]}function na(i,e){return Zt(i/e)}function sR(i,e){const t=i.config,s=t.lifeMode==="fixed"?Math.max(0,Number(t.lifeMin)||0):Math.max(0,Number(t.lifeMin)||0,Number(t.lifeMax)||0),n=Math.max(0,Number(t.delay)||0);let r;if(t.mode!=="stream")r=n+s;else if(t.streamBehavior!=="loop")r=n+Math.max(1/e,Number(t.duration)||0)+s;else{const o=Math.max(1,Math.ceil(Number(t.loopDurationFrames)||1))/e;t.generateLoopEndAnimation?r=n+s+1/e:t.generateLoopStartAnimation?r=n+o*Math.max(1,Math.ceil(s/o)):r=n+o}return Math.max(1,Math.ceil(r*e)+1)}function oh(i,e){return e?i.boneName:`${i.spawnId??"legacy"}_${i.boneName}`}function nR(i,e,t){const s=new Set;for(const n of i)for(const r of n)s.add(oh(r,e));return[...s].sort().map((n,r)=>({key:n,name:bx(`_particle_${String(r).padStart(3,"0")}`,t),states:i.map(o=>o.find(a=>oh(a,e)===n)||null)}))}function rR(i,e,t,s){const n=e*t/s,r=Math.min(i.states.length-1,Math.max(0,Math.floor(n))),o=Math.min(i.states.length-1,r+1),a=i.states[r],h=i.states[o];if(!a||!h||oh(a,!0)!==oh(h,!0)||a.spawnId!==h.spawnId)return a;const l=n-r;if(l<=1e-6)return a;const c=(f,d)=>(f??0)+((d??f??0)-(f??0))*l,u=a.trailState&&h.trailState&&a.trailState.resourceId===h.trailState.resourceId?{...a.trailState,width:c(a.trailState.width,h.trailState.width),alpha:c(a.trailState.alpha,h.trailState.alpha),bones:a.trailState.bones.map((f,d)=>{const m=h.trailState.bones[d]||f;return{...f,worldX:c(f.worldX??f.x,m.worldX??m.x),worldY:c(f.worldY??f.y,m.worldY??m.y),worldRotation:c(f.worldRotation??-f.rotation,m.worldRotation??-m.rotation)}})}:a.trailState;return{...a,worldX:c(a.worldX,h.worldX),worldY:c(a.worldY,h.worldY),worldRotation:c(a.worldRotation,h.worldRotation),worldScaleX:c(a.worldScaleX,h.worldScaleX),worldScaleY:c(a.worldScaleY,h.worldScaleY),alpha:c(a.alpha,h.alpha),trailState:u}}function Sg(i,e){return!i||i==="跟随导出"?e.keyframeCurve:i==="贝塞尔"?"bezier":"linear"}function $r(i,e,t,s,n,r=new Set,o=n.keyframeCurve){if(!i.length)return[];const a=o==="bezier"&&n.spineVersion!=="3.8"?xx(i,s,r):{samples:yx(i,s,r),controls:[]},h=a.samples.map(l=>{const c={time:na(l.frame,e)};return t.forEach((u,f)=>{c[u]=Zt(l.values[f])}),c});for(let l=0;l<a.controls.length;l++){const c=Number(h[l].time)||0,u=Number(h[l+1].time)||0,f=[];for(let d=0;d<t.length;d++){const m=a.controls[l].values[d];f.push(Zt(c+(u-c)/3),Zt(m[0]),Zt(c+(u-c)*2/3),Zt(m[1]))}h[l].curve=f}return h}function oR(i){const e=new Set;for(let t=0;t<i.length;t++){const s=i[t],n=t?i[t-1]:null,r=!!s&&!!n&&s.spawnId!==n.spawnId;(!!s!=!!n||r)&&(t>0&&n&&e.add(t-1),s&&e.add(t))}return e}function aR(i){const e=new Set;for(let t=0;t<i.length;t++){const s=i[t],n=t?i[t-1]:void 0;!!s!=!!n&&(t>0&&n&&e.add(t-1),s&&e.add(t))}return e}function lR(i,e){var s;if(!i.shapeEnabled||!((s=i.shapeCurve)!=null&&s.length))return 1;const t=[...i.shapeCurve].sort((n,r)=>n.x-r.x);if(e<=t[0].x)return Math.max(0,t[0].y);for(let n=1;n<t.length;n++){const r=t[n-1],o=t[n];if(e<=o.x){const a=(e-r.x)/Math.max(1e-6,o.x-r.x);return Math.max(0,r.y+(o.y-r.y)*a)}}return Math.max(0,t[t.length-1].y)}function hR(i,e,t){const s=[];let n=Symbol();return i.forEach((r,o)=>{r!==n&&(s.push(t(r,o)),n=r)}),s}function cR(i,e,t){const s=i.imageMode==="sequence"?i.sequenceFrames[e]:void 0,n=(s==null?void 0:s.name)||i.textureName||`image_${i.id}`,r=(s==null?void 0:s.texture)||i.texture,o=iR(r);(!o.width||!o.height)&&t.push({code:"missing-image",message:`图片“${n}”缺失或尺寸不可读,已保留路径。`});const a=o.width||1,h=o.height||1;return{path:wx(i.textureFolder,n),x:Zt((.5-i.anchorX)*a),y:Zt((i.anchorY-.5)*h),width:Zt(a),height:Zt(h)}}function uR(i,e,t,s,n=s.keyframeCurve){if(!i.length)return[];const r=new Set;for(let c=1;c<e.length;c++){const u=e[c],f=e[c-1],d=(u==null?void 0:u.replace(/_\d+$/,""))??null,m=(f==null?void 0:f.replace(/_\d+$/,""))??null;d!==m&&(r.add(c),r.add(c-1))}const o=i.map((c,u)=>({frame:u,values:c})),a=1/255,h=n==="bezier"&&s.spineVersion!=="3.8"?xx(o,[a,a,a,.01],r):{samples:yx(o,[a,a,a,.01],r),controls:[]},l=h.samples.map(c=>({time:na(c.frame,t),color:`${hl(c.values[0])}${hl(c.values[1])}${hl(c.values[2])}${hl(c.values[3])}`}));if(h.controls.length)for(let c=0;c<h.controls.length;c++){const u=na(h.samples[c].frame,t),f=na(h.samples[c+1].frame,t),d=[];for(let m=0;m<4;m++){const g=h.controls[c].values[m];d.push(Zt(u+(f-u)/3),Zt(g[0]),Zt(u+(f-u)*2/3),Zt(g[1]))}l[c].curve=d}return l}function Tg(i,e,t,s,n,r,o=r.keyframeCurve){var c;const a=(c=i.slots)[e]||(c[e]={}),h=hR(t,n,(u,f)=>({time:na(f,n),name:u??null}));h.length&&(a.attachment=h);const l=uR(s,t,n,r,o);l.length&&(a.rgba=l)}function dR(i){var m;const e=i.settings,t=Math.max(1,Number(i.timeline.fps)||30),s=Math.max(1,Math.round(e.fps||30)),n=e.integerFrameAlignment?s:t,r=[],o=i.systems.filter(g=>g.visible!==!1),a={skeleton:{hash:"",spine:e.spineVersion,x:0,y:0,width:0,height:0,images:e.imagesPath||"./images/"},bones:[{name:"root"}],slots:[],skins:[{name:"default",attachments:{}}],animations:{}};e.omitFps||(a.skeleton.fps=s);const h=a.skins[0].attachments,l=new Set(["root"]),c=[...new Set([...i.timeline.animations.length?i.timeline.animations:["animation"],...o.map(g=>g.animation||"animation")])],u=new Map;for(const g of o){const b=Math.min(((m=g.frames)==null?void 0:m.length)||0,sR(g,t)),_=(g.frames||[]).slice(0,b);_.length||r.push({code:"empty-cache",message:`“${g.config.name}”没有可用帧缓存。`});const M=bx(eR(g.config.name,`system_${g.id}`),l);a.bones.push({name:M,parent:"root"});const v=nR(_,e.bonePool,l),S=Math.max(0,(b-1)/t),y=Math.max(1,Math.ceil(S*n)+1),I=u.get(g.animation)||[];I.push({system:g,tracks:v,targetFrames:y}),u.set(g.animation,I);for(const E of v){a.bones.push({name:E.name,parent:M});const C=new Set(g.config.imageResources.map(F=>F.blend));for(const F of C){const D=`${E.name}_image_${F}`;a.slots.push({name:D,bone:E.name,color:"ffffff00",blend:yg[F]});const N=h[D]||(h[D]={});for(const j of g.config.imageResources.filter(O=>O.blend===F)){const O=j.imageMode==="sequence"?Math.max(1,j.sequenceFrames.length):1;for(let L=0;L<O;L++)N[`image_${j.id}_${L}`]=cR(j,L,r)}}if(g.config.trail)for(const F of g.config.trailResources){if(!E.states.some(P=>{var X;return((X=P==null?void 0:P.trailState)==null?void 0:X.resourceId)===F.id}))continue;const D=Math.max(2,Math.min(16,Math.round(F.boneCount||3))),N=[];for(let P=0;P<D;P++){const X=`${E.name}_trail_${F.id}_${P}`;N.push(X),a.bones.push({name:X,parent:M})}const j=`${E.name}_trail_${F.id}`;a.slots.push({name:j,bone:N[0],color:"ffffff00",blend:yg[F.blend]});const O=N.map(P=>a.bones.findIndex(X=>X.name===P)),L=wx("",F.textureName||`trail_${F.id}`);(h[j]||(h[j]={}))[`trail_${F.id}`]=QI(g.config,F,O,L),F.texture||r.push({code:"missing-image",message:`拖尾图片“${F.textureName||F.id}”缺失,已保留路径。`})}const R=`${E.name}_image_`,B=`${E.name}_trail_`,k=a.slots.filter(F=>String(F.name).startsWith(R)||String(F.name).startsWith(B));k.length&&(a.slots=a.slots.filter(F=>!k.includes(F)),a.slots.push(...k.filter(F=>String(F.name).startsWith(B)),...k.filter(F=>String(F.name).startsWith(R))))}}for(const g of c){const b=u.get(g)||[],_={bones:{},slots:{}};let M=!1;for(const{system:v,tracks:S,targetFrames:y}of b)for(const I of S){const E=Array.from({length:y},(U,Y)=>rR(I,Y,t,n)),C=E.map(U=>!!(U!=null&&U.active)),R=[],B=[],k=[];E.forEach((U,Y)=>{U!=null&&U.active&&(R.push({frame:Y,values:[U.worldX??U.x,U.worldY??U.y]}),B.push(U.worldRotation??U.rotation),k.push({frame:Y,values:[U.worldScaleX??U.scaleX,U.worldScaleY??U.scaleY]}))});const F=JI(B),D=R.map((U,Y)=>({frame:U.frame,values:[F[Y]??0]})),N=oR(E),j={},O=$r(R,n,["x","y"],[xg,xg],e,N),L=$r(D,n,["value"],[wg],e,N),P=$r(k,n,["x","y"],[ll,ll],e,N);O.length&&(j.translate=O),L.length&&(j.rotate=L),P.length&&(j.scale=P),Object.keys(j).length&&(_.bones[I.name]=j,M=!0);const X=new Set(v.config.imageResources.map(U=>U.blend));for(const U of X){const Y=[],q=[];let z=16777215;for(let ae=0;ae<y;ae++){const me=E[ae],_e=me?v.config.imageResources.find(ve=>ve.id===me.resourceId):void 0,te=!!me&&C[ae]&&me.imageVisible!==!1&&(_e==null?void 0:_e.blend)===U;me&&(_e==null?void 0:_e.blend)===U&&(z=me.colorHex),Y.push(te?`image_${_e.id}_${me.imageFrameIndex??0}`:null),q.push(_g(z,te?me.alpha:0))}const H=v.config.imageResources.filter(ae=>ae.blend===U).filter(ae=>ae.independentAlpha==="curve").map(ae=>Sg(ae.alphaCurveMode,e)),Z=H.length?H.includes("bezier")?"bezier":"linear":Sg(v.config.alphaMode==="curve"?v.config.curveMode:void 0,e);Tg(_,`${I.name}_image_${U}`,Y,q,n,e,Z),Y.some(Boolean)&&(M=!0)}if(v.config.trail)for(const U of v.config.trailResources){const Y=Math.max(2,Math.min(16,Math.round(U.boneCount||3))),q=E.map(ve=>{var $;return(($=ve==null?void 0:ve.trailState)==null?void 0:$.resourceId)===U.id?ve.trailState:void 0}),z=q.find(ve=>!!ve);if(!z)continue;const ne=aR(q),H=U.widthSizeMode==="random"?Math.max(1,Number(U.widthMin)||0,Number(U.widthMax)||0):Math.max(.001,Number(U.width)||100);let Z=z;const ae=q.map(ve=>(ve&&(Z=ve),Z));for(let ve=0;ve<Y;ve++){const $=[],W=[],J=[],Q=new Set(ne),ie=lR(U,ve/Math.max(1,Y-1));ae.forEach((De,Ie)=>{const Be=De==null?void 0:De.bones[Math.min(De.bones.length-1,ve)];if(!Be)return;const Ke={x:Be.worldX??Be.x,y:Be.worldY??Be.y,rotation:Be.worldRotation??-Be.rotation};$.push({frame:Ie,values:[Ke.x,Ke.y]}),W.push({frame:Ie,values:[Ke.rotation]}),J.push({frame:Ie,values:[1,Math.max(0,De.width/H)*ie]})});const ue=`${I.name}_trail_${U.id}_${ve}`,Se={},Me=$r($,n,["x","y"],[bg,bg],e,Q),Ee=$r(W,n,["value"],[wg],e,Q),de=$r(J,n,["x","y"],[ll,ll],e,Q);Me.length&&(Se.translate=Me),Ee.length&&(Se.rotate=Ee),de.length&&(Se.scale=de),Object.keys(Se).length&&(_.bones[ue]=Se)}const me=q.map(()=>`trail_${U.id}`);let _e=z.colorHex;const te=q.map(ve=>(ve&&(_e=ve.colorHex),_g(_e,ve?ve.alpha:0)));Tg(_,`${I.name}_trail_${U.id}`,me,te,n,e),M=!0}}(M||!e.excludeEmptyAnimations)&&(a.animations[g]=_)}!Object.keys(a.animations).length&&!e.excludeEmptyAnimations&&(a.animations.animation={bones:{},slots:{}});const f=e.spineVersion==="3.8"?zI(a):a,d=JSON.stringify(f,null,2);return{json:f,text:d,warnings:r,particleSystemCount:o.length,animationCount:Object.keys(f.animations).length,boneCount:f.bones.length}}function fR(i,e){const t=new Blob([i.text],{type:"application/json;charset=utf-8"}),s=URL.createObjectURL(t),n=document.createElement("a");n.href=s,n.download=/\.json$/i.test(e)?e:`${e||"SpineParticle"}.json`,n.style.display="none",document.body.appendChild(n),n.click(),n.remove(),setTimeout(()=>URL.revokeObjectURL(s),1e3)}class pR{newRegionAttachment(e,t,s,n){return new yo(t,s)}newMeshAttachment(e,t,s,n){return new Zn(t,s)}newBoundingBoxAttachment(e,t){return new Dh(t)}newPathAttachment(e,t){return new Er(t)}newPointAttachment(e,t){return new Nh(t)}newClippingAttachment(e,t){return new zn(t)}}const mR=new Set(["normal","onlyTranslation","noRotationOrReflection","noScale","noScaleOrReflection"]);function gR(i,e,t){const s=i.uvs,n=i.vertices,r=i.triangles;if(!Array.isArray(s)||!s.length||s.length%2)throw new Error(`拖尾网格“${e}”的 UV 数据无效`);if(!Array.isArray(n)||!n.length)throw new Error(`拖尾网格“${e}”缺少顶点数据`);const o=s.length/2;if(!Array.isArray(r)||r.some(c=>!Number.isInteger(c)||c<0||c>=o))throw new Error(`拖尾网格“${e}”的三角形索引越界`);const a=Number(i.hull)||0;if(!Number.isInteger(a)||a<0||a>o)throw new Error(`拖尾网格“${e}”的外轮廓数量无效`);if(Array.isArray(i.edges)&&i.edges.some(c=>!Number.isInteger(c)||c<0||c>=o*2||c%2))throw new Error(`拖尾网格“${e}”的外轮廓边索引越界`);if(n.length===s.length)return;let h=0,l=0;for(;h<n.length;){const c=n[h++];if(!Number.isInteger(c)||c<1)throw new Error(`拖尾网格“${e}”包含无效骨骼权重数量`);let u=0;for(let f=0;f<c;f++){const d=n[h++],m=n[h++],g=n[h++],b=n[h++];if(!Number.isInteger(d)||d<0||d>=t)throw new Error(`拖尾网格“${e}”引用了不存在的骨骼`);if(![m,g,b].every(Number.isFinite)||b<0)throw new Error(`拖尾网格“${e}”包含无效权重数据`);u+=b}if(Math.abs(u-1)>.001)throw new Error(`拖尾网格“${e}”的顶点权重之和不为 1`);l++}if(h!==n.length||l!==o)throw new Error(`拖尾网格“${e}”的顶点数量与 UV 不一致`)}function vR(i,e){var r,o,a,h;const t=Array.isArray(i.bones)?i.bones:[],s=new Map(t.map(l=>[String(l.name||""),l])),n=new Set;for(const l of t){if(l.inherit!=null&&!mR.has(l.inherit))throw new Error(`骨骼“${l.name||""}”的 inherit 值“${l.inherit}”不符合 Spine ${e} JSON 格式`);if(/_particle_\d+_trail_/.test(String(l.name||""))){const c=s.get(String(l.parent||""));if(!c||/_particle_\d+_trail_/.test(String(c.name||"")))throw new Error(`拖尾骨骼“${l.name||""}”必须直接挂在粒子系统骨骼下,不能组成骨骼链`)}}for(const l of Array.isArray(i.skins)?i.skins:[]){const c=(l==null?void 0:l.attachments)||{};for(const u of Object.keys(c))for(const f of Object.keys(c[u]||{})){const d=c[u][f];(d==null?void 0:d.type)==="mesh"&&(gR(d,f,t.length),((r=d.vertices)==null?void 0:r.length)!==((o=d.uvs)==null?void 0:o.length)&&n.add(u))}}for(const l of Object.values(i.animations||{}))for(const c of n){const u=(h=(a=l==null?void 0:l.slots)==null?void 0:a[c])==null?void 0:h.attachment;if(Array.isArray(u)&&u.some(f=>!(f!=null&&f.name)))throw new Error(`加权拖尾插槽“${c}”不能使用空附件,未出现或死亡阶段应将对应骨骼缩放设为 0`)}}function yR(i){var e;if(String(((e=i==null?void 0:i.skeleton)==null?void 0:e.spine)||"")!=="3.8")throw new Error("Spine 3.8 导出的版本标识必须为 3.8");for(const t of i.bones||[])if(t.inherit!=null)throw new Error(`Spine 3.8 骨骼“${t.name||""}”应使用 transform,不能使用 inherit`);for(const t of Object.values(i.animations||{})){for(const n of Object.values(t.slots||{})){if(n.rgba||n.rgba2)throw new Error("Spine 3.8 插槽颜色时间轴必须使用 color / twoColor");for(const r of n.attachment||[])if(!Object.prototype.hasOwnProperty.call(r,"name"))throw new Error("Spine 3.8 附件时间轴的隐藏帧必须显式写入 name: null")}for(const n of Object.values(t.bones||{}))for(const r of n.rotate||[])if(r.value!=null||r.angle==null)throw new Error("Spine 3.8 旋转时间轴必须使用 angle");const s=[t];for(;s.length;){const n=s.pop();if(!(!n||typeof n!="object")){if(!Array.isArray(n)&&Array.isArray(n.curve))throw new Error("Spine 3.8 不支持 4.x 数组曲线格式");s.push(...Object.values(n))}}}}function xR(i,e){var a;const t=JSON.parse(i),s=Wl((a=t==null?void 0:t.skeleton)==null?void 0:a.spine);if(!s)throw new Error(`导出版本不受支持,仅支持 Spine ${Sd()}`);if(e&&s!==e)throw new Error(`导出版本不一致:设置为 Spine ${e},JSON 标记为 Spine ${s}`);vR(t,s),s==="3.8"&&yR(t);const n=s==="3.8"?ax(JSON.parse(JSON.stringify(t))):t,o=new ih(new pR).readSkeletonData(n);if(!o.bones.length)throw new Error("导出结果缺少骨骼");return{version:s,bones:o.bones.length,slots:o.slots.length,animations:o.animations.length}}const bR={class:"panel"},wR={class:"panel-scroll"},_R={class:"group config-management"},SR={class:"caret"},TR={class:"group-body config-management-body"},MR={class:"config-toolbar"},ER=["disabled"],AR={value:""},CR=["value"],IR={class:"group"},RR={class:"caret"},PR={class:"scene-actions"},kR=["disabled"],FR={class:"group-body"},OR={class:"tree scene-tree"},BR=["onClick"],LR={class:"tlabel"},DR=["title","aria-label","onClick"],NR={viewBox:"0 0 24 24","aria-hidden":"true"},UR={key:0,class:"eye-slash",d:"M4 4l16 16"},VR=["onClick"],XR=["onClick"],YR={class:"tlabel"},$R=["title","aria-label","onClick"],GR={viewBox:"0 0 24 24","aria-hidden":"true"},jR={key:0,class:"eye-slash",d:"M4 4l16 16"},HR=["onClick"],WR=["onClick"],zR={class:"tlabel"},qR=["title","aria-label","onClick"],KR={viewBox:"0 0 24 24","aria-hidden":"true"},ZR={key:0,class:"eye-slash",d:"M4 4l16 16"},JR=["onClick"],QR=["onClick"],eP={class:"tlabel"},tP=["title","aria-label","onClick"],iP={viewBox:"0 0 24 24","aria-hidden":"true"},sP={key:0,class:"eye-slash",d:"M4 4l16 16"},nP=["onClick"],rP={key:0,class:"empty"},oP={class:"row"},aP={class:"seed-row scene-seed"},lP={class:"field-block"},hP={class:"field-block"},cP={class:"tag-editor"},uP=["onClick"],dP={class:"field-grid"},fP={class:"field-block"},pP={class:"field-block check-field"},mP={class:"field-grid"},gP={class:"compact-field"},vP={class:"compact-field"},yP={class:"field-grid"},xP={class:"compact-field"},bP={class:"compact-field"},wP={key:1,class:"field-grid"},_P={class:"compact-field"},SP={class:"compact-field"},TP={key:2,class:"field-grid"},MP={class:"compact-field"},EP={class:"compact-field"},AP={class:"field-block"},CP={key:4,class:"field-grid"},IP={class:"compact-field"},RP={class:"compact-field"},PP={class:"collider-follow-section"},kP={class:"follow-path"},FP={class:"field-block"},OP=["value"],BP={class:"field-grid"},LP={class:"compact-field"},DP={class:"compact-field"},NP={class:"follow-path"},UP={class:"field-block"},VP={class:"field-grid"},XP={class:"compact-field"},YP={class:"compact-field"},$P={class:"field-grid"},GP={class:"compact-field"},jP={class:"compact-field"},HP={class:"setting-line"},WP={class:"setting-line"},zP={class:"field-block"},qP={key:4,class:"panel-hint"},KP={class:"group"},ZP={class:"caret"},JP={class:"group-body"},QP={class:"segs"},ek={class:"segs stream-behavior-segs"},tk={key:2,class:"stream-loop-options"},ik={class:"switch-row"},sk=["checked"],nk={class:"switch-row"},rk=["checked"],ok={key:3,class:"modifier-hint stream-loop-hint"},ak={class:"group"},lk={class:"caret"},hk={class:"group-body"},ck={class:"row"},uk={class:"group"},dk={class:"caret"},fk={class:"group-body attr-body"},pk={class:"attr-axis-head"},mk={class:"axis-modes"},gk={class:"life-item"},vk={class:"switch-row"},yk={class:"life-item"},xk={class:"switch-row"},bk={class:"axis-modes life-axis"},wk={class:"life-item"},_k={class:"switch-row"},Sk={class:"group"},Tk={class:"caret"},Mk={class:"group-body"},Ek={class:"seg"},Ak={class:"row"},Ck={class:"curve-wrap"},Ik={class:"row"},Rk=["onUpdate:modelValue"],Pk=["onUpdate:modelValue"],kk={class:"row resource-color-row"},Fk=["onUpdate:modelValue"],Ok=["onUpdate:modelValue"],Bk={key:0,class:"row resource-color-picker"},Lk=["onUpdate:modelValue"],Dk=["value","onChange","onKeydown"],Nk={class:"resource-alpha-head"},Uk={class:"alpha-modes"},Vk=["onClick"],Xk=["onClick"],Yk=["onClick"],$k={class:"row"},Gk=["onUpdate:modelValue"],jk={class:"resource-alpha-curve"},Hk={class:"group"},Wk={class:"caret"},zk={class:"group-body"},qk={class:"modifier-item"},Kk={class:"switch-row modifier-switch"},Zk={key:0,class:"modifier-params"},Jk={class:"modifier-item"},Qk={class:"switch-row modifier-switch"},eF={key:0,class:"modifier-params gravity-params"},tF={class:"modifier-mode-row"},iF={class:"modifier-item"},sF={class:"switch-row modifier-switch"},nF={key:0,class:"modifier-params gravity-params"},rF={class:"modifier-mode-row"},oF={class:"modifier-item"},aF={class:"switch-row modifier-switch"},lF={key:0,class:"modifier-params"},hF={class:"row"},cF={class:"modifier-item"},uF={class:"switch-row modifier-switch"},dF={key:0,class:"modifier-params"},fF={class:"row"},pF={class:"row"},mF={class:"modifier-item"},gF={class:"switch-row modifier-switch"},vF={key:0,class:"modifier-params trail-params"},yF={class:"row"},xF=["onUpdate:modelValue"],bF={class:"row"},wF=["onUpdate:modelValue"],_F={class:"row"},SF=["onUpdate:modelValue"],TF={class:"switch-row trail-sub-switch"},MF=["onUpdate:modelValue"],EF={class:"switch-row trail-sub-switch"},AF=["onUpdate:modelValue"],CF={class:"trail-mode-head"},IF={class:"alpha-modes"},RF=["onClick"],PF=["onClick"],kF=["onClick"],FF={class:"row"},OF=["onUpdate:modelValue"],BF={key:6,class:"row trail-fixed-color"},LF=["onUpdate:modelValue"],DF=["value","onChange","onKeydown"],NF={class:"trail-mode-head"},UF={class:"alpha-modes"},VF=["onClick"],XF=["onClick"],YF=["onClick"],$F={class:"trail-grid-row"},GF={class:"modifier-item"},jF={class:"switch-row modifier-switch"},HF=["disabled"],WF={key:0,class:"modifier-params emitter-follow-params"},zF={class:"field-block"},qF=["value"],KF={key:0,value:"bone"},ZF={class:"field-block"},JF=["value"],QF={class:"field-block"},eO={class:"field-grid follow-grid"},tO={class:"compact-field"},iO={class:"compact-field"},sO={class:"field-block"},nO={key:0,class:"bone-follow-target"},rO={key:1,class:"bone-follow-missing"},oO={class:"field-block"},aO={class:"field-grid follow-grid"},lO={class:"compact-field"},hO={class:"compact-field"},cO={class:"bone-follow-transform-grid"},uO={class:"compact-field"},dO={class:"compact-field"},fO={class:"compact-field"},pO={class:"group"},mO={class:"caret"},gO={class:"group-body export-settings"},vO={class:"export-field"},yO={class:"export-field"},xO={class:"export-field"},bO={key:0,class:"export-help"},wO={class:"export-fps-row"},_O={class:"export-field export-fps-field"},SO={class:"export-checkbox"},TO={class:"export-switches"},MO={class:"switch-row export-switch"},EO={class:"switch-row export-switch"},AO={class:"switch-row export-switch export-switch-last"},CO=["disabled","title"],IO=Ws({__name:"ParticlePanel",setup(i){const e=Aa();e.settings.exportSettings=gy(e.settings.exportSettings);const t=ut(()=>e.settings.exportSettings),s=it(null),n=it(""),r=it([]),o=it(!1),a=it(""),h=it(!1),l=it(!1),c=it(""),u=it(!1);function f(T){return T==="跟随导出"?t.value.keyframeCurve==="bezier"?"bezier":"linear":T==="贝塞尔"?"bezier":"linear"}e.systems.length||e.addSystem();function d(){dx(e),h.value=!1,a.value="配置已保存到本地"}async function m(T){var V;const p=T.target,x=(V=p.files)==null?void 0:V[0];if(x){a.value="正在加载配置…",h.value=!1;try{await oC(e,x),a.value=`已加载:${x.name}`}catch(K){h.value=!0,a.value=K instanceof Error?K.message:String(K)}finally{p.value=""}}}async function g(){try{const T=await fetch(`/Preset/index.json?t=${Date.now()}`,{cache:"no-store"});if(!T.ok)throw new Error("无法读取预设列表");const p=await T.json();r.value=Array.isArray(p)?p.filter(x=>!!x&&typeof x.name=="string"&&typeof x.file=="string"):[]}catch{r.value=[]}}async function b(){const T=n.value;if(T){o.value=!0,h.value=!1,a.value="正在加载预设…";try{const p=await fetch(`/Preset/${encodeURIComponent(T)}`,{cache:"no-store"});if(!p.ok)throw new Error(`无法读取预设:${T}`);await px(e,await p.text()),a.value=`已加载预设:${T.replace(/\.json$/i,"")}`}catch(p){h.value=!0;const x=p instanceof Error?p.message:String(p);a.value=`${x},请检查预设文件命名`}finally{o.value=!1,n.value=""}}}_o(g);function _(){return new Promise(T=>requestAnimationFrame(()=>T()))}async function M(){e.timeline.playing=!1,e.timeline.frame=0,e.timeline.recorded=!1;for(const x of e.systems)x.frames=void 0;e.recalcTotalFrames(),await _(),e.timeline.playing=!0;const T=e.timeline.totalFrames/Math.max(1,e.timeline.fps)*1e3,p=performance.now()+Math.max(8e3,T*2.5+3e3);for(;!e.timeline.recorded;){if(performance.now()>p)throw new Error("重新计算动画超时,请确认页面仍在运行后重试");await new Promise(x=>setTimeout(x,50))}}async function v(){if(!l.value){l.value=!0,u.value=!1,c.value="正在重新计算粒子动画…";try{await M();const T=dR({systems:e.systems,timeline:e.timeline,settings:t.value});xR(T.text,t.value.spineVersion),fR(T,t.value.fileName);const p=T.warnings.length?`;${T.warnings.length} 条资源提示(缺图仍已导出)`:"";c.value=`已导出 Spine ${t.value.spineVersion}:${T.particleSystemCount} 个粒子系统、${T.animationCount} 个动画、${T.boneCount} 根骨骼${p}`}catch(T){u.value=!0,c.value=T instanceof Error?T.message:String(T)}finally{l.value=!1}}}const S=ut(()=>{const T=e.systems.findIndex(p=>p.id===e.activeId);return T>=0?T:0}),y=ut(()=>e.systems[S.value]||null),I=ut(()=>{var p;const T=(p=y.value)==null?void 0:p.config;return T?Math.max(1,Math.ceil(Number(T.loopDurationFrames)||1)):1}),E=ut(()=>e.activeObjectType),C=ut(()=>e.activeObjectType==="collision"&&e.colliders.find(T=>T.id===e.activeObjectId)||null),R=ut(()=>e.activeObjectType==="path"&&e.paths.find(T=>T.id===e.activeObjectId)||null),B=ut(()=>e.activeObjectType==="spine"&&e.spines.find(T=>T.id===e.activeObjectId)||null),k=ut(()=>e.activeObjectType==="particle"?e.systems.some(T=>T.id===e.activeObjectId):e.activeObjectType==="collision"?e.colliders.some(T=>T.id===e.activeObjectId):e.activeObjectType==="path"?e.paths.some(T=>T.id===e.activeObjectId):e.spines.some(T=>T.id===e.activeObjectId)),F=ut(()=>{const T=e.spines.find(p=>p.selectedBone&&p.bones.some(x=>x.name===p.selectedBone));return T?{spine:T,boneName:T.selectedBone}:null}),D=ut(()=>{var x;const T=(x=y.value)==null?void 0:x.config;if(!T||T.emitterFollowMode!=="bone")return null;const p=e.spines.find(V=>V.id===T.emitterFollowSpineId);return!p||!p.bones.some(V=>V.name===T.emitterFollowBoneName)?null:{spine:p,boneName:T.emitterFollowBoneName}});No(()=>{for(const T of e.systems)T.visible==null&&(T.visible=!0);for(const T of e.colliders)T.visible==null&&(T.visible=!0);for(const T of e.paths)T.visible==null&&(T.visible=!0);for(const T of e.spines)T.visible==null&&(T.visible=!0)}),No(()=>{if(!y.value)return;const T=Tr(y.value.config);T.lifeMode==="curve"&&(T.lifeMode="random"),T.speedMode==="curve"&&(T.speedMode="random"),T.scaleMode==="curve"&&(T.scaleMode="random"),T.initialRotationMode==="curve"&&(T.initialRotationMode="random"),T.mode==="stream"&&!(T.duration>0)&&(T.duration=1),T.streamBehavior==="loop"&&(T.emitterFollow||T.emitterFollowMode!=="none")&&ne(T)}),No(()=>{for(const T of e.systems){const p=Tr(T.config);if(p.emitterFollowMode!=="bone")continue;const x=e.spines.find(K=>K.id===p.emitterFollowSpineId);!!(x!=null&&x.bones.some(K=>K.name===p.emitterFollowBoneName))||(p.emitterFollowMode="none",p.emitterFollowSpineId=0,p.emitterFollowBoneName="")}}),No(()=>{for(const T of e.colliders)T.followPathId==null&&(T.followPathId=0),T.followDuration>0||(T.followDuration=2),T.followPathRotation==null&&(T.followPathRotation=!1),["跟随导出","线性","贝塞尔"].includes(T.followCurveMode)||(T.followCurveMode="跟随导出"),(!Array.isArray(T.followCurve)||T.followCurve.length<2)&&(T.followCurve=[{x:0,y:0},{x:1,y:1}])});const N=[{x:0,y:0},{x:1,y:1}],j=[{x:0,y:1},{x:1,y:1}],O=[{x:0,y:0},{x:.2,y:1},{x:.8,y:1},{x:1,y:0}],L=[{x:0,y:0},{x:.1,y:1},{x:.9,y:1},{x:1,y:0}],P=[{x:0,y:1},{x:1,y:1}],X=[{x:0,y:1},{x:1,y:1}],U=wo({config:!0,scene:!1,emitMode:!0,shape:!0,attr:!0,look:!0,mods:!0,export:!1});function Y(T){U[T]=!U[T]}function q(T){var x;const p=(x=y.value)==null?void 0:x.config;p&&(p.mode=T,T==="stream"&&!(p.duration>0)&&(p.duration=1))}function z(T){var V;const p=(V=y.value)==null?void 0:V.config;if(!p)return;const x=Math.min(1800,Math.max(1,Math.ceil(Number(T)||1)));p.loopDurationFrames=x}function ne(T){const p=ga();T.emitterFollow=!1,T.emitterFollowMode="none",T.emitterFollowPathId=p.emitterFollowPathId,T.emitterFollowSpineId=p.emitterFollowSpineId,T.emitterFollowBoneName=p.emitterFollowBoneName,T.emitterFollowBoneOffsetX=p.emitterFollowBoneOffsetX,T.emitterFollowBoneOffsetY=p.emitterFollowBoneOffsetY,T.emitterFollowBoneRotation=p.emitterFollowBoneRotation,T.emitterFollowBoneScaleX=p.emitterFollowBoneScaleX,T.emitterFollowBoneScaleY=p.emitterFollowBoneScaleY,T.emitterAngleMode=p.emitterAngleMode,T.emitterFollowCurve=p.emitterFollowCurve.map(x=>({...x})),T.emitterFollowDuration=p.emitterFollowDuration,T.emitterFollowSpace=p.emitterFollowSpace,T.emitterFollowDirection=p.emitterFollowDirection,T.emitterFollowOffset=p.emitterFollowOffset}function H(T){var K;const p=(K=y.value)==null?void 0:K.config;if(!p||p.streamBehavior===T)return;const x=T==="loop",V=x?"进入循环持续模式后,粒子跟随设置会失效并恢复默认值。是否继续?":"退出循环持续模式后,粒子跟随设置会失效并恢复默认值。是否继续?";window.confirm(V)&&(ne(p),p.streamBehavior=T,x||(p.generateLoopStartAnimation=!1,p.generateLoopEndAnimation=!1))}function Z(T,p){var K;const x=(K=y.value)==null?void 0:K.config;if(!x)return;const V=p.target.checked;T==="start"?(x.generateLoopStartAnimation=V,V&&(x.generateLoopEndAnimation=!1)):(x.generateLoopEndAnimation=V,V&&(x.generateLoopStartAnimation=!1))}function ae(T,p){const x=T.target.value;if(p.emitterFollowMode=x,x!=="bone"){p.emitterFollowSpineId=0,p.emitterFollowBoneName="";return}me(p)}function me(T){const p=F.value;if(!p){T.emitterFollowMode="none",T.emitterFollowSpineId=0,T.emitterFollowBoneName="";return}T.emitterFollowMode="bone",T.emitterFollowSpineId=p.spine.id,T.emitterFollowBoneName=p.boneName}const _e={emitMode:["mode","rate","streamBehavior","loopDurationFrames","generateLoopStartAnimation","generateLoopEndAnimation","burstCount","burstLoop","delay","duration"],shape:["shape","radius","rectW","rectH","direction","spread","coneAngle"],attr:["lifeMin","lifeMax","lifeMode","lifeCurve","speedMin","speedMax","speedMode","speedCurve","scaleMin","scaleMax","scaleMode","scaleAxisMode","scaleYMin","scaleYMax","scaleCurve","scaleYCurve","scaleEndRatio","initialRotationMode","initialRotationMin","initialRotationMax","initialRotationCurve","rotationSpeedMin","rotationSpeedMax","speedOverLifeEnabled","speedOverLifeMode","speedOverLifeMin","speedOverLifeMax","speedOverLifeCurve","scaleOverLifeEnabled","scaleOverLifeMode","scaleOverLifeAxisMode","scaleOverLifeMin","scaleOverLifeMax","scaleYOverLifeMin","scaleYOverLifeMax","scaleOverLifeCurve","scaleYOverLifeCurve","rotationOverLifeEnabled","rotationOverLifeMode","rotationOverLifeCurve"],look:["texture","imageResources","imageWeightVersion","alpha","alphaEnd","colorStart","colorEnd","colorOverLife","blend","alphaMode","curveMode","alphaCurve","textureName","textureFolder","alphaScale","anchorX","anchorY","independentAlpha"],mods:["noise","noiseAmt","noiseRange","noiseSpeed","useGravity","gravity","gravityMode","gravityMin","gravityMax","gravityDirection","gravityCurve","wind","windX","windY","windMode","windMin","windMax","windDirection","windCurve","forceField","forceStrength","forceRadius","forceCenterX","forceCenterY","forceFalloff","attraction","attractionCenterX","attractionCenterY","attractionRadius","attractionDuration","attractionDelay","attractionDelayMode","attractionPath","trail","trailConfigVersion","trailResources","trailResourceVersion","trailTexture","trailTextureName","trailPreviewUrl","trailColorMode","trailColor","trailColorGradient","trailAlphaMode","trailAlpha","trailAlphaCurve","trailBoneCount","trailLength","trailWidth","trailWidthMode","trailLifeLengthEnabled","trailLifeLengthCurve","trailShapeEnabled","trailShapeCurve","trailGridRows","trailGridCols","collision","pathFollow","emitterFollow","emitterFollowMode","emitterFollowPathId","emitterFollowSpineId","emitterFollowBoneName","emitterFollowBoneOffsetX","emitterFollowBoneOffsetY","emitterFollowBoneRotation","emitterFollowBoneScaleX","emitterFollowBoneScaleY","emitterAngleMode","emitterFollowCurve","emitterFollowDuration","emitterFollowSpace","emitterFollowDirection","emitterFollowOffset","damping"]};function te(T){var V;const p=(V=y.value)==null?void 0:V.config;if(T==="export"){e.settings.exportSettings=uf();return}if(!p)return;const x=ga();for(const K of _e[T])p[K]=x[K]}function ve(){t.value.fps=Math.min(240,Math.max(1,Math.round(Number(t.value.fps)||30)))}function $(T){var p;e.selectSystem(((p=e.systems[T])==null?void 0:p.id)??0)}function W(){e.addSystem()}function J(){e.addCollider()}function Q(){e.addPath()}function ie(){e.addSpine()}function ue(){e.duplicateSelectedObject()}function Se(){const T=C.value;if(!T)return;let p=T.tags.length+1,x=`Tag ${p}`;for(;T.tags.includes(x);)x=`Tag ${++p}`;T.tags.push(x),T.selectedTag=x}function Me(T,p,x=0,V=0,K=0,oe=0){return{x:T,y:p,inX:x,inY:V,outX:K,outY:oe}}function Ee(){const T=R.value;if(!(!T||!T.preset))if(T.preset==="circle"){const x=60.751328;T.points=[Me(110,0,0,-x,0,x),Me(0,110,x,0,-x,0),Me(-110,0,0,x,0,-x),Me(0,-110,-x,0,x,0)],T.closed=!0}else if(T.preset==="square")T.points=[Me(-100,-100),Me(100,-100),Me(100,100),Me(-100,100)],T.closed=!0;else{const p=T.preset==="star"?10:6;T.points=Array.from({length:p},(x,V)=>{const K=T.preset==="star"&&V%2?50:110,oe=-Math.PI*.5+V/p*Math.PI*2;return Me(Math.cos(oe)*K,Math.sin(oe)*K)}),T.closed=!0}}function de(){R.value&&(R.value.points=[])}function De(){y.value&&(y.value.config.seed=Math.floor(Math.random()*999999)+1)}function Ie(T){var x;const p=(x=y.value)==null?void 0:x.config;!p||T==="direction"||(p.speedOverLifeMode=T,T==="curve"&&p.speedOverLifeMin===p.speedOverLifeMax&&(p.speedOverLifeMin=0,p.speedOverLifeMax=1))}function Be(){var p;const T=(p=y.value)==null?void 0:p.config;!T||T.scaleOverLifeMode!=="curve"||(T.scaleOverLifeMin===T.scaleOverLifeMax&&(T.scaleOverLifeMin=0,T.scaleOverLifeMax=1),T.scaleYOverLifeMin===T.scaleYOverLifeMax&&(T.scaleYOverLifeMin=0,T.scaleYOverLifeMax=1))}function Ke(T){var x;const p=(x=y.value)==null?void 0:x.config;!p||T==="direction"||(p.scaleOverLifeMode=T,Be())}const ct={point:{direction:0,spread:360},circle:{radius:100,direction:-90,spread:0},rect:{rectW:200,rectH:100,direction:-90,spread:0},cone:{radius:100,coneAngle:90,direction:90},orbit:{}};function wt(){var x;const T=(x=y.value)==null?void 0:x.config;if(!T)return;const p=ct[T.shape];p&&Object.assign(T,p)}const dt=it(null),Mt=it(null),Ct=it(null),ai=it(null),Jt=it(null);function Zi(){var x;const T=(x=y.value)==null?void 0:x.config;if(!T)return;const p=Math.max(0,...T.trailResources.map(V=>V.id))+1;T.trailResources.push({id:p,texture:null,textureName:"trail",previewUrl:"/images/trail.png",weight:100,locked:!1,rotation:0,colorMode:"particle",color:"#ffffff",colorGradient:[{position:0,color:"#ffffff"},{position:1,color:"#ffffff"}],blend:"normal",alphaMode:"particle",alpha:1,alphaCurve:P.map(V=>({...V})),boneCount:3,trailRatio:100,lengthMode:"fixed",length:100,lengthMin:100,lengthMax:100,widthSizeMode:"fixed",width:100,widthMin:100,widthMax:100,widthMode:"particle",lifeLengthEnabled:!1,lifeLengthCurve:j.map(V=>({...V})),shapeEnabled:!1,shapeCurve:X.map(V=>({...V}))}),nt()}function xs(T){var p;Jt.value=T,(p=ai.value)==null||p.click()}function $t(T,p){var K;const x=(K=y.value)==null?void 0:K.config;if(!x)return;const V=T==="trailGridCols"?32:16;x[T]=Math.min(V,Math.max(2,Math.round(Number(p)||2)))}function re(T,p){var V;const x=(V=y.value)==null?void 0:V.config.trailResources.find(K=>K.id===T);x&&(x.boneCount=Math.min(16,Math.max(2,Math.round(Number(p)||2))))}function le(T,p){var V;const x=(V=y.value)==null?void 0:V.config.trailResources.find(K=>K.id===T);x&&(x.rotation=Math.max(-360,Math.min(360,Number(p)||0)))}async function ft(T){var pe,he;const p=T.target,x=(pe=p.files)==null?void 0:pe[0],V=(he=y.value)==null?void 0:he.config,K=V==null?void 0:V.trailResources.find(be=>be.id===Jt.value);if(!x||!K){p.value="";return}const oe=await Mn(x);K.texture=$n(await et.fromURL(oe)),K.previewUrl=oe,K.textureName=x.name.replace(/\.[^.]+$/,"")||"trail",p.value="",Jt.value=null}async function It(T){var V;const p=(V=y.value)==null?void 0:V.config,x=p==null?void 0:p.trailResources.find(K=>K.id===T);x&&(x.texture=$n(await et.fromURL("/images/trail.png")),x.previewUrl="/images/trail.png",x.textureName="trail",x.weight=100,x.locked=!1,x.rotation=0,x.boneCount=3,x.trailRatio=100,x.lengthMode="fixed",x.length=100,x.lengthMin=100,x.lengthMax=100,x.widthSizeMode="fixed",x.width=100,x.widthMin=100,x.widthMax=100,x.widthMode="particle",x.lifeLengthEnabled=!1,x.lifeLengthCurve=j.map(K=>({...K})),x.shapeEnabled=!1,x.shapeCurve=X.map(K=>({...K})),x.colorMode="particle",x.color="#ffffff",x.colorGradient=[{position:0,color:"#ffffff"},{position:1,color:"#ffffff"}],x.blend="normal",x.alphaMode="particle",x.alpha=1,x.alphaCurve=P.map(K=>({...K})),nt())}function Pt(T){var V;const p=(V=y.value)==null?void 0:V.config.trailResources;if(!p||p.length<=1)return;const x=p.findIndex(K=>K.id===T);x>=0&&p.splice(x,1),nt()}function nt(){var K;const T=(K=y.value)==null?void 0:K.config.trailResources;if(!(T!=null&&T.length))return;if(T.length===1){T[0].weight=100,T[0].locked=!1;return}const p=T.filter(oe=>oe.locked),x=T.filter(oe=>!oe.locked);let V=p.reduce((oe,pe)=>oe+Math.max(0,Number(pe.weight)||0),0);V>100&&(Qi(p,100,!0),V=100),Qi(x,100-V)}function $i(T,p){var he;const x=(he=y.value)==null?void 0:he.config.trailResources;if(!(x!=null&&x.length))return;if(x.length===1){x[0].weight=100,x[0].locked=!1;return}const V=x.find(be=>be.id===T);if(!V||V.locked)return;const K=x.filter(be=>be.id!==T&&be.locked).reduce((be,fe)=>be+Math.max(0,Number(fe.weight)||0),0),oe=Math.max(0,100-K),pe=x.filter(be=>be.id!==T&&!be.locked);V.weight=Bi(Math.min(oe,Math.max(0,Number(p)||0))),pe.length?Qi(pe,oe-V.weight,!0):V.weight=Bi(oe)}function Ji(T){var V;const p=(V=y.value)==null?void 0:V.config.trailResources;if(!p||p.length===1)return;const x=p.find(K=>K.id===T);x&&(x.locked=!x.locked)}function li(T,p){const x=p.target;T.color=En(x.value,T.color),x.value=T.color}function Gi(T,p){li(T,p),p.target.blur()}function er(){var x;const T=(x=y.value)==null?void 0:x.config;if(!T)return;const p=Math.max(0,...T.imageResources.map(V=>V.id))+1;T.imageResources.push({id:p,texture:T.texture,textureName:"star",textureFolder:"",previewUrl:"/images/star.png",imageMode:"fixed",sequencePlayback:"loop-forward",sequenceFps:30,sequenceFrames:[],weight:100,locked:!1,scale:1,anchorX:.5,anchorY:.5,colorMode:"fixed",colorStart:"#ffffff",colorEnd:"#ff4d4d",colorGradient:[{position:0,color:"#ffffff"},{position:1,color:"#ff4d4d"}],blend:"normal",independentAlpha:"off",alpha:1,alphaCurveMode:"跟随导出",alphaCurve:L.map(V=>({...V}))}),ws()}function Oi(T){var p;Ct.value=T,(p=dt.value)==null||p.click()}function Qt(T){var p;Ct.value=T,(p=Mt.value)==null||p.click()}async function Pr(T){var he,be;const p=T.target,x=(he=p.files)==null?void 0:he[0],V=(be=y.value)==null?void 0:be.config,K=V==null?void 0:V.imageResources.find(fe=>fe.id===Ct.value);if(!x||!K){p.value="";return}const oe=await Mn(x),pe=$n(await et.fromURL(oe));K.texture=pe,K.previewUrl=oe,K.textureFolder="",K.textureName=x.name.replace(/\.[^.]+$/,"")||"particle",p.value="",Ct.value=null}async function kr(T){var oe;const p=T.target,x=Array.from(p.files||[]).sort((pe,he)=>pe.name.localeCompare(he.name,void 0,{numeric:!0,sensitivity:"base"})),V=(oe=y.value)==null?void 0:oe.config,K=V==null?void 0:V.imageResources.find(pe=>pe.id===Ct.value);if(!x.length||!K){p.value="";return}K.sequenceFrames=await Promise.all(x.map(async pe=>{const he=await Mn(pe);return{name:pe.name,previewUrl:he,texture:$n(await et.fromURL(he))}})),K.imageMode="sequence",p.value="",Ct.value=null}function Mn(T){return new Promise((p,x)=>{const V=new FileReader;V.onload=()=>p(String(V.result||"")),V.onerror=()=>x(V.error),V.readAsDataURL(T)})}function Zs(T){var V;const p=(V=y.value)==null?void 0:V.config,x=p==null?void 0:p.imageResources.find(K=>K.id===T);!p||!x||(x.texture=p.texture,x.textureName="star",x.textureFolder="",x.previewUrl="/images/star.png",x.imageMode="fixed",x.sequencePlayback="loop-forward",x.sequenceFps=30,x.sequenceFrames=[],x.scale=1,x.anchorX=.5,x.anchorY=.5,x.colorMode="fixed",x.colorStart="#ffffff",x.colorEnd="#ff4d4d",x.colorGradient=[{position:0,color:"#ffffff"},{position:1,color:"#ff4d4d"}],x.blend="normal",x.independentAlpha="off",x.alpha=1,x.alphaCurveMode="跟随导出",x.alphaCurve=L.map(K=>({...K})),x.locked=!1,ws())}function En(T,p){let x=T.trim().replace(/^#/,"");return/^[0-9a-f]{3}$/i.test(x)&&(x=x.split("").map(V=>V+V).join("")),/^[0-9a-f]{6}$/i.test(x)?`#${x.toLowerCase()}`:p}function Js(T,p){const x=p.target;T.colorStart=En(x.value,T.colorStart),x.value=T.colorStart}function An(T,p){Js(T,p),p.target.blur()}function bs(T){var V;const p=(V=y.value)==null?void 0:V.config.imageResources;if(!p||p.length<=1)return;const x=p.findIndex(K=>K.id===T);x>=0&&p.splice(x,1),ws()}function Bi(T){return Math.round(T)}function Qi(T,p,x=!1){if(!T.length)return;const V=Math.max(0,Bi(p)),K=x?T.reduce((pe,he)=>pe+Math.max(0,Number(he.weight)||0),0):0;let oe=0;T.forEach((pe,he)=>{const be=he===T.length-1,fe=Bi(be?V-oe:K>0?V*Math.max(0,Number(pe.weight)||0)/K:V/T.length);pe.weight=fe,oe+=fe})}function ws(){var K;const T=(K=y.value)==null?void 0:K.config.imageResources;if(!(T!=null&&T.length))return;if(T.length===1){T[0].weight=100,T[0].locked=!1;return}const p=T.filter(oe=>oe.locked),x=T.filter(oe=>!oe.locked);let V=p.reduce((oe,pe)=>oe+Math.max(0,Number(pe.weight)||0),0);V>100&&(Qi(p,100,!0),V=100),Qi(x,100-V)}function tr(T,p){var he;const x=(he=y.value)==null?void 0:he.config.imageResources;if(!(x!=null&&x.length))return;if(x.length===1){x[0].weight=100,x[0].locked=!1;return}const V=x.find(be=>be.id===T);if(!V||V.locked)return;const K=x.filter(be=>be.id!==T&&be.locked).reduce((be,fe)=>be+Math.max(0,Number(fe.weight)||0),0),oe=Math.max(0,100-K),pe=x.filter(be=>be.id!==T&&!be.locked);if(V.weight=Bi(Math.min(oe,Math.max(0,Number(p)||0))),!pe.length){V.weight=Bi(oe);return}Qi(pe,oe-V.weight,!0)}function G(T){var V;const p=(V=y.value)==null?void 0:V.config.imageResources;if(!p||p.length===1)return;const x=p.find(K=>K.id===T);x&&(x.locked=!x.locked)}return(T,p)=>(se(),ce("div",bR,[p[362]||(p[362]=w("div",{class:"panel-header"},[w("span",null,"Spine粒子编辑器-Yeomai")],-1)),w("div",wR,[w("div",_R,[w("div",{class:"group-head",onClick:p[0]||(p[0]=x=>Y("config"))},[w("span",SR,Ye(U.config?"▸":"▾"),1),p[182]||(p[182]=w("span",null,"配置管理",-1))]),xe(w("div",TR,[w("div",MR,[w("button",{title:"保存全部编辑器配置 (Ctrl+S)",onClick:d},"保存配置"),w("button",{title:"加载本地编辑器配置",onClick:p[1]||(p[1]=x=>{var V;return(V=s.value)==null?void 0:V.click()})},"加载配置"),xe(w("select",{"onUpdate:modelValue":p[2]||(p[2]=x=>n.value=x),"aria-label":"预设列表",disabled:!r.value.length||o.value,onPointerdown:g,onFocus:g,onChange:b},[w("option",AR,Ye(r.value.length?"选择预设":"无预设文件"),1),(se(!0),ce(qe,null,Ht(r.value,x=>(se(),ce("option",{key:x.file,value:x.file},Ye(x.name),9,CR))),128))],40,ER),[[kt,n.value]]),w("input",{ref_key:"configFileInput",ref:s,hidden:"",type:"file",accept:".json,application/json",onChange:m},null,544)]),a.value?(se(),ce("div",{key:0,class:Ze(["config-message",{error:h.value}])},Ye(a.value),3)):$e("",!0)],512),[[Cn,!U.config]])]),w("div",IR,[w("div",{class:"group-head scene-head",onClick:p[3]||(p[3]=x=>Y("scene"))},[w("span",RR,Ye(U.scene?"▸":"▾"),1),p[183]||(p[183]=w("span",null,"场景对象",-1)),w("div",PR,[w("button",{class:"scene-add",title:"添加粒子系统",onClick:xt(W,["stop"])},"+粒子"),w("button",{class:"scene-add",title:"添加碰撞体",onClick:xt(J,["stop"])},"+碰撞"),w("button",{class:"scene-add",title:"添加路径",onClick:xt(Q,["stop"])},"+路径"),w("button",{class:"scene-add",title:"添加 Spine",onClick:xt(ie,["stop"])},"+Spine"),w("button",{class:"scene-add",disabled:!k.value,title:"复制当前选中的场景对象",onClick:xt(ue,["stop"])},"+Copy",8,kR)])]),xe(w("div",FR,[w("div",OR,[(se(!0),ce(qe,null,Ht(Pe(e).systems,(x,V)=>(se(),ce("div",{key:`particle-${x.id}`,class:Ze(["tree-item scene-object-item",{on:E.value==="particle"&&x.id===Pe(e).activeObjectId}]),onClick:K=>$(V)},[p[186]||(p[186]=w("span",{class:"tdot"},"●",-1)),w("span",LR,Ye(x.config.name||"ParticleSystem"+(V+1)),1),w("button",{class:Ze(["scene-object-eye",{off:x.visible===!1}]),title:x.visible===!1?"显示粒子系统":"隐藏粒子系统","aria-label":x.visible===!1?"显示粒子系统":"隐藏粒子系统",onClick:xt(K=>x.visible=x.visible===!1,["stop"])},[(se(),ce("svg",NR,[p[184]||(p[184]=w("path",{d:"M2.5 12s3.5-6 9.5-6 9.5 6 9.5 6-3.5 6-9.5 6-9.5-6-9.5-6Z"},null,-1)),p[185]||(p[185]=w("circle",{cx:"12",cy:"12",r:"2.8"},null,-1)),x.visible===!1?(se(),ce("path",UR)):$e("",!0)]))],10,DR),p[187]||(p[187]=w("span",{class:"scene-object-kind"},"粒子",-1)),w("button",{class:"scene-object-delete",title:"删除粒子系统",onClick:xt(K=>Pe(e).removeSystem(x.id),["stop"])},"✕",8,VR)],10,BR))),128)),(se(!0),ce(qe,null,Ht(Pe(e).colliders,x=>(se(),ce("div",{key:`collision-${x.id}`,class:Ze(["tree-item scene-object-item",{on:E.value==="collision"&&x.id===Pe(e).activeObjectId}]),onClick:V=>Pe(e).selectSceneObject("collision",x.id)},[p[190]||(p[190]=w("span",{class:"tdot collision-dot"},"■",-1)),w("span",YR,Ye(x.name),1),w("button",{class:Ze(["scene-object-eye",{off:x.visible===!1}]),title:x.visible===!1?"显示碰撞体":"隐藏碰撞体","aria-label":x.visible===!1?"显示碰撞体":"隐藏碰撞体",onClick:xt(V=>x.visible=x.visible===!1,["stop"])},[(se(),ce("svg",GR,[p[188]||(p[188]=w("path",{d:"M2.5 12s3.5-6 9.5-6 9.5 6 9.5 6-3.5 6-9.5 6-9.5-6-9.5-6Z"},null,-1)),p[189]||(p[189]=w("circle",{cx:"12",cy:"12",r:"2.8"},null,-1)),x.visible===!1?(se(),ce("path",jR)):$e("",!0)]))],10,$R),p[191]||(p[191]=w("span",{class:"scene-object-kind"},"碰撞",-1)),w("button",{class:"scene-object-delete",title:"删除碰撞体",onClick:xt(V=>Pe(e).removeCollider(x.id),["stop"])},"✕",8,HR)],10,XR))),128)),(se(!0),ce(qe,null,Ht(Pe(e).paths,x=>(se(),ce("div",{key:`path-${x.id}`,class:Ze(["tree-item scene-object-item",{on:E.value==="path"&&x.id===Pe(e).activeObjectId}]),onClick:V=>Pe(e).selectSceneObject("path",x.id)},[p[194]||(p[194]=w("span",{class:"tdot path-dot"},"◇",-1)),w("span",zR,Ye(x.name),1),w("button",{class:Ze(["scene-object-eye",{off:x.visible===!1}]),title:x.visible===!1?"显示路径":"隐藏路径","aria-label":x.visible===!1?"显示路径":"隐藏路径",onClick:xt(V=>x.visible=x.visible===!1,["stop"])},[(se(),ce("svg",KR,[p[192]||(p[192]=w("path",{d:"M2.5 12s3.5-6 9.5-6 9.5 6 9.5 6-3.5 6-9.5 6-9.5-6-9.5-6Z"},null,-1)),p[193]||(p[193]=w("circle",{cx:"12",cy:"12",r:"2.8"},null,-1)),x.visible===!1?(se(),ce("path",ZR)):$e("",!0)]))],10,qR),p[195]||(p[195]=w("span",{class:"scene-object-kind"},"路径",-1)),w("button",{class:"scene-object-delete",title:"删除路径",onClick:xt(V=>Pe(e).removePath(x.id),["stop"])},"✕",8,JR)],10,WR))),128)),(se(!0),ce(qe,null,Ht(Pe(e).spines,x=>(se(),ce("div",{key:`spine-${x.id}`,class:Ze(["tree-item scene-object-item",{on:E.value==="spine"&&x.id===Pe(e).activeObjectId}]),onClick:V=>Pe(e).selectSceneObject("spine",x.id)},[p[198]||(p[198]=w("span",{class:"tdot spine-dot"},"◆",-1)),w("span",eP,Ye(x.name),1),w("button",{class:Ze(["scene-object-eye",{off:x.visible===!1}]),title:x.visible===!1?"显示 Spine":"隐藏 Spine","aria-label":x.visible===!1?"显示 Spine":"隐藏 Spine",onClick:xt(V=>x.visible=x.visible===!1,["stop"])},[(se(),ce("svg",iP,[p[196]||(p[196]=w("path",{d:"M2.5 12s3.5-6 9.5-6 9.5 6 9.5 6-3.5 6-9.5 6-9.5-6-9.5-6Z"},null,-1)),p[197]||(p[197]=w("circle",{cx:"12",cy:"12",r:"2.8"},null,-1)),x.visible===!1?(se(),ce("path",sP)):$e("",!0)]))],10,tP),p[199]||(p[199]=w("span",{class:"scene-object-kind"},"Spine",-1)),w("button",{class:"scene-object-delete",title:"删除 Spine",onClick:xt(V=>Pe(e).removeSpine(x.id),["stop"])},"✕",8,nP)],10,QR))),128)),!Pe(e).systems.length&&!Pe(e).colliders.length&&!Pe(e).paths.length&&!Pe(e).spines.length?(se(),ce("div",rP,"场景中暂无对象")):$e("",!0)]),E.value==="particle"&&y.value?(se(),ce(qe,{key:0},[w("label",oP,[p[200]||(p[200]=w("span",null,"名称",-1)),xe(w("input",{"onUpdate:modelValue":p[4]||(p[4]=x=>y.value.config.name=x),class:"inp"},null,512),[[Je,y.value.config.name]])]),Ne(Ge,{label:"位置X",min:-2e3,max:2e3,step:1,modelValue:y.value.config.centerX,"onUpdate:modelValue":p[5]||(p[5]=x=>y.value.config.centerX=x)},null,8,["modelValue"]),Ne(Ge,{label:"位置Y",min:-2e3,max:2e3,step:1,modelValue:y.value.config.centerY,"onUpdate:modelValue":p[6]||(p[6]=x=>y.value.config.centerY=x)},null,8,["modelValue"]),Ne(Ge,{label:"偏移X",min:-2e3,max:2e3,step:1,modelValue:y.value.config.offsetX,"onUpdate:modelValue":p[7]||(p[7]=x=>y.value.config.offsetX=x)},null,8,["modelValue"]),Ne(Ge,{label:"偏移Y",min:-2e3,max:2e3,step:1,modelValue:y.value.config.offsetY,"onUpdate:modelValue":p[8]||(p[8]=x=>y.value.config.offsetY=x)},null,8,["modelValue"]),Ne(Ge,{label:"旋转",min:-360,max:360,step:1,modelValue:y.value.config.rootRotation,"onUpdate:modelValue":p[9]||(p[9]=x=>y.value.config.rootRotation=x)},null,8,["modelValue"]),Ne(Ge,{label:"缩放X",min:.05,max:10,step:.05,modelValue:y.value.config.rootScaleX,"onUpdate:modelValue":p[10]||(p[10]=x=>y.value.config.rootScaleX=x)},null,8,["modelValue"]),Ne(Ge,{label:"缩放Y",min:.05,max:10,step:.05,modelValue:y.value.config.rootScaleY,"onUpdate:modelValue":p[11]||(p[11]=x=>y.value.config.rootScaleY=x)},null,8,["modelValue"]),w("div",aP,[p[201]||(p[201]=w("label",{for:"system-seed"},"随机种子",-1)),xe(w("input",{id:"system-seed",class:"seed-input",type:"number",min:"0",step:"1","onUpdate:modelValue":p[12]||(p[12]=x=>y.value.config.seed=x),title:"控制粒子系统内全部随机属性、资源选择与修改器随机采样"},null,512),[[Je,y.value.config.seed,void 0,{number:!0}]]),w("button",{class:"seed-random",title:"生成新的全局随机种子",onClick:De},"⚄")]),p[202]||(p[202]=w("div",{class:"seed-hint"},"控制初始随机参数、资源选择和修改器随机采样;相同种子可复现相同效果",-1))],64)):C.value?(se(),ce(qe,{key:1},[p[229]||(p[229]=w("div",{class:"object-editor-title"},"碰撞体属性",-1)),w("label",lP,[p[203]||(p[203]=w("span",null,"碰撞体名称",-1)),xe(w("input",{"onUpdate:modelValue":p[13]||(p[13]=x=>C.value.name=x),class:"inp"},null,512),[[Je,C.value.name]])]),w("div",hP,[p[204]||(p[204]=w("span",null,"碰撞体标签",-1)),w("div",cP,[(se(!0),ce(qe,null,Ht(C.value.tags,x=>(se(),ce("button",{key:x,class:Ze(["object-tag",{on:C.value.selectedTag===x}]),onClick:V=>C.value.selectedTag=x},Ye(x),11,uP))),128)),w("button",{class:"tag-add",title:"新增标签",onClick:Se},"+")]),p[205]||(p[205]=w("small",null,"点击标签为当前碰撞体选择标签;点击+新增标签。",-1))]),w("div",dP,[w("label",fP,[p[207]||(p[207]=w("span",null,"类型",-1)),xe(w("select",{"onUpdate:modelValue":p[14]||(p[14]=x=>C.value.shape=x),class:"inp"},[...p[206]||(p[206]=[Vo('<option value="circle" data-v-6eba135a>圆形</option><option value="ellipse" data-v-6eba135a>椭圆</option><option value="rect" data-v-6eba135a>矩形</option><option value="polygon" data-v-6eba135a>多边形</option><option value="custom" data-v-6eba135a>自定义</option>',5)])],512),[[kt,C.value.shape]])]),w("label",pP,[p[208]||(p[208]=w("span",null,"启用",-1)),xe(w("input",{"onUpdate:modelValue":p[15]||(p[15]=x=>C.value.enabled=x),type:"checkbox"},null,512),[[Lt,C.value.enabled]])])]),w("div",mP,[w("label",gP,[p[209]||(p[209]=w("span",null,"X 位置",-1)),xe(w("input",{"onUpdate:modelValue":p[16]||(p[16]=x=>C.value.x=x),type:"number",class:"inp"},null,512),[[Je,C.value.x,void 0,{number:!0}]])]),w("label",vP,[p[210]||(p[210]=w("span",null,"Y 位置",-1)),xe(w("input",{"onUpdate:modelValue":p[17]||(p[17]=x=>C.value.y=x),type:"number",class:"inp"},null,512),[[Je,C.value.y,void 0,{number:!0}]])])]),Ne(Ge,{label:"旋转",min:-360,max:360,step:1,modelValue:C.value.rotation,"onUpdate:modelValue":p[18]||(p[18]=x=>C.value.rotation=x)},null,8,["modelValue"]),w("div",yP,[w("label",xP,[p[211]||(p[211]=w("span",null,"缩放 X",-1)),xe(w("input",{"onUpdate:modelValue":p[19]||(p[19]=x=>C.value.scaleX=x),type:"number",min:"0.05",step:"0.05",class:"inp"},null,512),[[Je,C.value.scaleX,void 0,{number:!0}]])]),w("label",bP,[p[212]||(p[212]=w("span",null,"缩放 Y",-1)),xe(w("input",{"onUpdate:modelValue":p[20]||(p[20]=x=>C.value.scaleY=x),type:"number",min:"0.05",step:"0.05",class:"inp"},null,512),[[Je,C.value.scaleY,void 0,{number:!0}]])])]),C.value.shape==="circle"?(se(),Et(Ge,{key:0,label:"半径",min:1,max:1e3,step:1,modelValue:C.value.radius,"onUpdate:modelValue":p[21]||(p[21]=x=>C.value.radius=x)},null,8,["modelValue"])):C.value.shape==="ellipse"?(se(),ce("div",wP,[w("label",_P,[p[213]||(p[213]=w("span",null,"X 半径",-1)),xe(w("input",{"onUpdate:modelValue":p[22]||(p[22]=x=>C.value.radiusX=x),type:"number",min:"1",class:"inp"},null,512),[[Je,C.value.radiusX,void 0,{number:!0}]])]),w("label",SP,[p[214]||(p[214]=w("span",null,"Y 半径",-1)),xe(w("input",{"onUpdate:modelValue":p[23]||(p[23]=x=>C.value.radiusY=x),type:"number",min:"1",class:"inp"},null,512),[[Je,C.value.radiusY,void 0,{number:!0}]])])])):(se(),ce("div",TP,[w("label",MP,[p[215]||(p[215]=w("span",null,"宽度",-1)),xe(w("input",{"onUpdate:modelValue":p[24]||(p[24]=x=>C.value.width=x),type:"number",min:"1",class:"inp"},null,512),[[Je,C.value.width,void 0,{number:!0}]])]),w("label",EP,[p[216]||(p[216]=w("span",null,"高度",-1)),xe(w("input",{"onUpdate:modelValue":p[25]||(p[25]=x=>C.value.height=x),type:"number",min:"1",class:"inp"},null,512),[[Je,C.value.height,void 0,{number:!0}]])])])),C.value.shape==="polygon"||C.value.shape==="custom"?(se(),Et(Ge,{key:3,label:"边数",min:3,max:16,step:1,modelValue:C.value.sides,"onUpdate:modelValue":p[26]||(p[26]=x=>C.value.sides=x)},null,8,["modelValue"])):$e("",!0),w("label",AP,[p[218]||(p[218]=w("span",null,"碰撞响应",-1)),xe(w("select",{"onUpdate:modelValue":p[27]||(p[27]=x=>C.value.response=x),class:"inp"},[...p[217]||(p[217]=[w("option",{value:"physics"},"物理(弹跳/摩擦)",-1),w("option",{value:"pause"},"暂停(停止不动)",-1),w("option",{value:"destroy"},"消失(立即销毁)",-1)])],512),[[kt,C.value.response]])]),C.value.response==="physics"?(se(),ce("div",CP,[w("label",IP,[p[219]||(p[219]=w("span",null,"弹性 (0-1)",-1)),xe(w("input",{"onUpdate:modelValue":p[28]||(p[28]=x=>C.value.elasticity=x),type:"number",min:"0",max:"1",step:"0.01",class:"inp"},null,512),[[Je,C.value.elasticity,void 0,{number:!0}]])]),w("label",RP,[p[220]||(p[220]=w("span",null,"摩擦 (0-1)",-1)),xe(w("input",{"onUpdate:modelValue":p[29]||(p[29]=x=>C.value.friction=x),type:"number",min:"0",max:"1",step:"0.01",class:"inp"},null,512),[[Je,C.value.friction,void 0,{number:!0}]])])])):$e("",!0),w("div",PP,[w("label",kP,[xe(w("input",{"onUpdate:modelValue":p[30]||(p[30]=x=>C.value.followPath=x),type:"checkbox"},null,512),[[Lt,C.value.followPath]]),p[221]||(p[221]=Yt("跟随路径移动",-1))]),C.value.followPath?(se(),ce(qe,{key:0},[w("label",FP,[p[223]||(p[223]=w("span",null,"目标路径",-1)),xe(w("select",{"onUpdate:modelValue":p[31]||(p[31]=x=>C.value.followPathId=x),class:"inp"},[p[222]||(p[222]=w("option",{value:0},"(未选择)",-1)),(se(!0),ce(qe,null,Ht(Pe(e).paths,x=>(se(),ce("option",{key:x.id,value:x.id},Ye(x.name),9,OP))),128))],512),[[kt,C.value.followPathId,void 0,{number:!0}]])]),w("div",BP,[w("label",LP,[p[224]||(p[224]=w("span",null,"移动时长(秒)",-1)),xe(w("input",{"onUpdate:modelValue":p[32]||(p[32]=x=>C.value.followDuration=x),type:"number",min:"0.05",step:"0.05",class:"inp"},null,512),[[Je,C.value.followDuration,void 0,{number:!0}]])]),w("label",DP,[p[226]||(p[226]=w("span",null,"曲线模式",-1)),xe(w("select",{"onUpdate:modelValue":p[33]||(p[33]=x=>C.value.followCurveMode=x),class:"inp"},[...p[225]||(p[225]=[w("option",null,"跟随导出",-1),w("option",null,"线性",-1),w("option",null,"贝塞尔",-1)])],512),[[kt,C.value.followCurveMode]])])]),w("label",NP,[xe(w("input",{"onUpdate:modelValue":p[34]||(p[34]=x=>C.value.followPathRotation=x),type:"checkbox"},null,512),[[Lt,C.value.followPathRotation]]),p[227]||(p[227]=Yt("方向沿路径",-1))]),p[228]||(p[228]=w("div",{class:"collider-curve-title"},[Yt("移动进度曲线 "),w("small",null,"横轴:实时/移动时长 纵轴:路径进度(0=起点 → 1=终点)")],-1)),Ne(Is,{"model-value":C.value.followCurve||N,"default-value":N,mode:f(C.value.followCurveMode),"onUpdate:modelValue":p[35]||(p[35]=x=>C.value.followCurve=x)},null,8,["model-value","mode"])],64)):$e("",!0)])],64)):R.value?(se(),ce(qe,{key:2},[p[239]||(p[239]=w("div",{class:"object-editor-title"},"路径属性",-1)),w("label",UP,[p[230]||(p[230]=w("span",null,"路径名称",-1)),xe(w("input",{"onUpdate:modelValue":p[36]||(p[36]=x=>R.value.name=x),class:"inp"},null,512),[[Je,R.value.name]])]),w("div",VP,[w("label",XP,[p[231]||(p[231]=w("span",null,"X 位置",-1)),xe(w("input",{"onUpdate:modelValue":p[37]||(p[37]=x=>R.value.x=x),type:"number",class:"inp"},null,512),[[Je,R.value.x,void 0,{number:!0}]])]),w("label",YP,[p[232]||(p[232]=w("span",null,"Y 位置",-1)),xe(w("input",{"onUpdate:modelValue":p[38]||(p[38]=x=>R.value.y=x),type:"number",class:"inp"},null,512),[[Je,R.value.y,void 0,{number:!0}]])])]),Ne(Ge,{label:"旋转",min:-360,max:360,step:1,modelValue:R.value.rotation,"onUpdate:modelValue":p[39]||(p[39]=x=>R.value.rotation=x)},null,8,["modelValue"]),w("div",$P,[w("label",GP,[p[233]||(p[233]=w("span",null,"缩放 X",-1)),xe(w("input",{"onUpdate:modelValue":p[40]||(p[40]=x=>R.value.scaleX=x),type:"number",min:"0.05",step:"0.05",class:"inp"},null,512),[[Je,R.value.scaleX,void 0,{number:!0}]])]),w("label",jP,[p[234]||(p[234]=w("span",null,"缩放 Y",-1)),xe(w("input",{"onUpdate:modelValue":p[41]||(p[41]=x=>R.value.scaleY=x),type:"number",min:"0.05",step:"0.05",class:"inp"},null,512),[[Je,R.value.scaleY,void 0,{number:!0}]])])]),w("label",HP,[p[235]||(p[235]=w("span",null,"闭合路径",-1)),xe(w("input",{"onUpdate:modelValue":p[42]||(p[42]=x=>R.value.closed=x),type:"checkbox"},null,512),[[Lt,R.value.closed]])]),w("label",WP,[p[236]||(p[236]=w("span",null,"路径颜色",-1)),xe(w("input",{"onUpdate:modelValue":p[43]||(p[43]=x=>R.value.color=x),type:"color",class:"path-color"},null,512),[[Je,R.value.color]])]),p[240]||(p[240]=Vo('<div class="path-help" data-v-6eba135a><span data-v-6eba135a>操作说明:</span><ul data-v-6eba135a><li data-v-6eba135a>双击空白处/曲线:新建锚点</li><li data-v-6eba135a>双击锚点:删除节点</li><li data-v-6eba135a>双击第二下按住拖动:新建并拉出手柄</li><li data-v-6eba135a>拖动锚点移动位置,拖动手柄调整曲线</li><li data-v-6eba135a>Shift+拖动手柄:两侧完全对称</li><li data-v-6eba135a>Alt+拖动手柄:独立控制单侧</li><li data-v-6eba135a>Ctrl+点击/框选:加选节点</li><li data-v-6eba135a>Alt+点击/框选:减选节点</li><li data-v-6eba135a>Alt+单击空白处:清除全部选中</li><li data-v-6eba135a>选中多个节点后可整体拖动</li></ul></div>',1)),w("label",zP,[p[238]||(p[238]=w("span",null,"应用预设形状",-1)),xe(w("select",{"onUpdate:modelValue":p[44]||(p[44]=x=>R.value.preset=x),class:"inp"},[...p[237]||(p[237]=[Vo('<option value="" data-v-6eba135a>选择预设...</option><option value="circle" data-v-6eba135a>圆形</option><option value="square" data-v-6eba135a>方形</option><option value="polygon" data-v-6eba135a>多边形</option><option value="star" data-v-6eba135a>星形</option>',5)])],512),[[kt,R.value.preset]])]),w("button",{class:"path-action primary",onClick:Ee},"应用预设"),w("button",{class:"path-action",onClick:de},"清空锚点")],64)):B.value?(se(),Et(VI,{key:3,"spine-object":B.value},null,8,["spine-object"])):(se(),ce("div",qP,"使用右上角按钮创建场景对象"))],512),[[Cn,!U.scene]])]),E.value==="particle"&&y.value?(se(),ce(qe,{key:0},[w("div",KP,[w("div",{class:"group-head",onClick:p[46]||(p[46]=x=>Y("emitMode"))},[w("span",ZP,Ye(U.emitMode?"▸":"▾"),1),p[241]||(p[241]=w("span",null,"发射模式",-1)),w("button",{class:"group-reset",title:"重置发射模式参数",onClick:p[45]||(p[45]=xt(x=>te("emitMode"),["stop"]))},"重置")]),xe(w("div",JP,[w("div",QP,[w("button",{class:Ze(["seg",{on:y.value.config.mode==="stream"}]),onClick:p[47]||(p[47]=x=>q("stream"))},"持续",2),w("button",{class:Ze(["seg",{on:y.value.config.mode==="burst"}]),onClick:p[48]||(p[48]=x=>q("burst"))},"爆发",2)]),y.value.config.mode==="stream"?(se(),ce(qe,{key:0},[w("div",ek,[w("button",{class:Ze(["seg",{on:y.value.config.streamBehavior==="normal"}]),onClick:p[49]||(p[49]=x=>H("normal"))},"常规持续",2),w("button",{class:Ze(["seg",{on:y.value.config.streamBehavior==="loop"}]),onClick:p[50]||(p[50]=x=>H("loop"))},"循环持续",2)]),Ne(Ge,{label:"发射速率",min:1,max:300,step:1,modelValue:y.value.config.rate,"onUpdate:modelValue":p[51]||(p[51]=x=>y.value.config.rate=x)},null,8,["modelValue"]),y.value.config.streamBehavior==="normal"?(se(),Et(Ge,{key:0,label:"发射时长",min:1/30,max:60,step:1/30,modelValue:y.value.config.duration,"onUpdate:modelValue":p[52]||(p[52]=x=>y.value.config.duration=x)},null,8,["modelValue"])):(se(),Et(Ge,{key:1,label:"发射时长 (f)",min:1,max:1800,step:1,"model-value":I.value,"onUpdate:modelValue":z},null,8,["model-value"])),y.value.config.streamBehavior==="loop"?(se(),ce("div",tk,[w("label",ik,[w("input",{type:"checkbox",checked:y.value.config.generateLoopStartAnimation,onChange:p[53]||(p[53]=x=>Z("start",x))},null,40,sk),p[242]||(p[242]=w("span",{class:"switch-ui"},null,-1)),p[243]||(p[243]=w("span",null,"生成开始循环动画",-1))]),w("label",nk,[w("input",{type:"checkbox",checked:y.value.config.generateLoopEndAnimation,onChange:p[54]||(p[54]=x=>Z("end",x))},null,40,rk),p[244]||(p[244]=w("span",{class:"switch-ui"},null,-1)),p[245]||(p[245]=w("span",null,"生成结束循环动画",-1))])])):$e("",!0),y.value.config.streamBehavior==="loop"?(se(),ce("div",ok,"循环持续模式不支持骨骼跟随和路径跟随;进入或退出时会将粒子跟随设置恢复默认值。")):$e("",!0)],64)):(se(),Et(Ge,{key:1,label:"单次数量",min:1,max:1e3,step:1,modelValue:y.value.config.burstCount,"onUpdate:modelValue":p[55]||(p[55]=x=>y.value.config.burstCount=x)},null,8,["modelValue"])),Ne(Ge,{label:"延迟时间",min:0,max:5,step:.1,modelValue:y.value.config.delay,"onUpdate:modelValue":p[56]||(p[56]=x=>y.value.config.delay=x)},null,8,["modelValue"])],512),[[Cn,!U.emitMode]])]),w("div",ak,[w("div",{class:"group-head",onClick:p[58]||(p[58]=x=>Y("shape"))},[w("span",lk,Ye(U.shape?"▸":"▾"),1),p[246]||(p[246]=w("span",null,"发射器形状",-1)),w("button",{class:"group-reset",title:"重置发射器形状参数",onClick:p[57]||(p[57]=xt(x=>te("shape"),["stop"]))},"重置")]),xe(w("div",hk,[w("label",ck,[p[248]||(p[248]=w("span",null,"形状",-1)),xe(w("select",{"onUpdate:modelValue":p[59]||(p[59]=x=>y.value.config.shape=x),class:"inp",onChange:wt},[...p[247]||(p[247]=[Vo('<option value="point" data-v-6eba135a>点</option><option value="circle" data-v-6eba135a>圆形</option><option value="rect" data-v-6eba135a>矩形</option><option value="cone" data-v-6eba135a>锥体</option><option value="orbit" data-v-6eba135a>轨道</option>',5)])],544),[[kt,y.value.config.shape]])]),y.value.config.shape==="circle"||y.value.config.shape==="cone"?(se(),Et(Ge,{key:0,label:"半径",min:0,max:300,step:1,modelValue:y.value.config.radius,"onUpdate:modelValue":p[60]||(p[60]=x=>y.value.config.radius=x)},null,8,["modelValue"])):$e("",!0),y.value.config.shape==="cone"?(se(),Et(Ge,{key:1,label:"锥形开口角度",min:1,max:360,step:1,modelValue:y.value.config.coneAngle,"onUpdate:modelValue":p[61]||(p[61]=x=>y.value.config.coneAngle=x)},null,8,["modelValue"])):y.value.config.shape==="rect"?(se(),ce(qe,{key:2},[Ne(Ge,{label:"宽",min:1,max:400,step:1,modelValue:y.value.config.rectW,"onUpdate:modelValue":p[62]||(p[62]=x=>y.value.config.rectW=x)},null,8,["modelValue"]),Ne(Ge,{label:"高",min:1,max:400,step:1,modelValue:y.value.config.rectH,"onUpdate:modelValue":p[63]||(p[63]=x=>y.value.config.rectH=x)},null,8,["modelValue"])],64)):$e("",!0),p[249]||(p[249]=w("div",{class:"divider"},null,-1)),Ne(Ge,{label:y.value.config.shape==="cone"?"锥形朝向":"发射角度",min:-360,max:360,step:1,modelValue:y.value.config.direction,"onUpdate:modelValue":p[64]||(p[64]=x=>y.value.config.direction=x)},null,8,["label","modelValue"]),y.value.config.shape!=="cone"?(se(),Et(Ge,{key:3,label:"扩散角度",min:0,max:360,step:1,modelValue:y.value.config.spread,"onUpdate:modelValue":p[65]||(p[65]=x=>y.value.config.spread=x)},null,8,["modelValue"])):$e("",!0)],512),[[Cn,!U.shape]])]),w("div",uk,[w("div",{class:"group-head",onClick:p[67]||(p[67]=x=>Y("attr"))},[w("span",dk,Ye(U.attr?"▸":"▾"),1),p[250]||(p[250]=w("span",null,"粒子属性",-1)),w("button",{class:"group-reset",title:"重置粒子属性参数",onClick:p[66]||(p[66]=xt(x=>te("attr"),["stop"]))},"重置")]),xe(w("div",fk,[p[258]||(p[258]=w("div",{class:"attr-section-title"},"粒子初始参数",-1)),Ne(nn,{label:"初始生命周期","allow-curve":!1,mode:y.value.config.lifeMode,"onUpdate:mode":p[68]||(p[68]=x=>y.value.config.lifeMode=x),"value-min":y.value.config.lifeMin,"onUpdate:valueMin":p[69]||(p[69]=x=>y.value.config.lifeMin=x),"value-max":y.value.config.lifeMax,"onUpdate:valueMax":p[70]||(p[70]=x=>y.value.config.lifeMax=x),curve:y.value.config.lifeCurve,"onUpdate:curve":p[71]||(p[71]=x=>y.value.config.lifeCurve=x),min:.1,max:10,step:.1,"curve-label":"随机采样 →"},null,8,["mode","value-min","value-max","curve"]),Ne(nn,{label:"初始速度","allow-curve":!1,mode:y.value.config.speedMode,"onUpdate:mode":p[72]||(p[72]=x=>y.value.config.speedMode=x),"value-min":y.value.config.speedMin,"onUpdate:valueMin":p[73]||(p[73]=x=>y.value.config.speedMin=x),"value-max":y.value.config.speedMax,"onUpdate:valueMax":p[74]||(p[74]=x=>y.value.config.speedMax=x),curve:y.value.config.speedCurve,"onUpdate:curve":p[75]||(p[75]=x=>y.value.config.speedCurve=x),min:0,max:1e3,step:1,"curve-label":"随机采样 →"},null,8,["mode","value-min","value-max","curve"]),w("div",pk,[p[251]||(p[251]=w("span",null,"初始缩放",-1)),w("div",mk,[w("button",{class:Ze(["axis-mode",{on:y.value.config.scaleAxisMode==="uniform"}]),onClick:p[76]||(p[76]=x=>y.value.config.scaleAxisMode="uniform")},"统一",2),w("button",{class:Ze(["axis-mode",{on:y.value.config.scaleAxisMode==="separate"}]),onClick:p[77]||(p[77]=x=>y.value.config.scaleAxisMode="separate")},"XY分离",2)])]),Ne(nn,{label:y.value.config.scaleAxisMode==="uniform"?"初始缩放":"缩放 X","allow-curve":!1,mode:y.value.config.scaleMode,"onUpdate:mode":p[78]||(p[78]=x=>y.value.config.scaleMode=x),"value-min":y.value.config.scaleMin,"onUpdate:valueMin":p[79]||(p[79]=x=>y.value.config.scaleMin=x),"value-max":y.value.config.scaleMax,"onUpdate:valueMax":p[80]||(p[80]=x=>y.value.config.scaleMax=x),curve:y.value.config.scaleCurve,"onUpdate:curve":p[81]||(p[81]=x=>y.value.config.scaleCurve=x),min:0,max:5,step:.05,"curve-label":"随机采样 →"},null,8,["label","mode","value-min","value-max","curve"]),y.value.config.scaleAxisMode==="separate"?(se(),Et(nn,{key:0,label:"缩放 Y","show-modes":!1,"allow-curve":!1,mode:y.value.config.scaleMode,"onUpdate:mode":p[82]||(p[82]=x=>y.value.config.scaleMode=x),"value-min":y.value.config.scaleYMin,"onUpdate:valueMin":p[83]||(p[83]=x=>y.value.config.scaleYMin=x),"value-max":y.value.config.scaleYMax,"onUpdate:valueMax":p[84]||(p[84]=x=>y.value.config.scaleYMax=x),curve:y.value.config.scaleYCurve,"onUpdate:curve":p[85]||(p[85]=x=>y.value.config.scaleYCurve=x),min:0,max:5,step:.05,"curve-label":"随机采样 →"},null,8,["mode","value-min","value-max","curve"])):$e("",!0),Ne(nn,{label:"初始旋转","allow-direction":"","allow-curve":!1,mode:y.value.config.initialRotationMode,"onUpdate:mode":p[86]||(p[86]=x=>y.value.config.initialRotationMode=x),"value-min":y.value.config.initialRotationMin,"onUpdate:valueMin":p[87]||(p[87]=x=>y.value.config.initialRotationMin=x),"value-max":y.value.config.initialRotationMax,"onUpdate:valueMax":p[88]||(p[88]=x=>y.value.config.initialRotationMax=x),curve:y.value.config.initialRotationCurve,"onUpdate:curve":p[89]||(p[89]=x=>y.value.config.initialRotationCurve=x),min:-360,max:360,step:1,"curve-label":"随机采样 →"},null,8,["mode","value-min","value-max","curve"]),p[259]||(p[259]=w("div",{class:"attr-section-title life-title"},"粒子生命周期变化参数",-1)),w("div",gk,[w("label",vk,[xe(w("input",{type:"checkbox","onUpdate:modelValue":p[90]||(p[90]=x=>y.value.config.speedOverLifeEnabled=x)},null,512),[[Lt,y.value.config.speedOverLifeEnabled]]),p[252]||(p[252]=w("span",{class:"switch-ui"},null,-1)),p[253]||(p[253]=w("span",null,"生命周期内速度",-1))]),y.value.config.speedOverLifeEnabled?(se(),Et(nn,{key:0,label:"速度倍率",mode:y.value.config.speedOverLifeMode,"onUpdate:mode":Ie,"value-min":y.value.config.speedOverLifeMin,"onUpdate:valueMin":p[91]||(p[91]=x=>y.value.config.speedOverLifeMin=x),"value-max":y.value.config.speedOverLifeMax,"onUpdate:valueMax":p[92]||(p[92]=x=>y.value.config.speedOverLifeMax=x),curve:y.value.config.speedOverLifeCurve,"onUpdate:curve":p[93]||(p[93]=x=>y.value.config.speedOverLifeCurve=x),"default-curve":j,min:0,max:3,step:.05,"curve-label":"生命周期 →"},null,8,["mode","value-min","value-max","curve"])):$e("",!0)]),w("div",yk,[w("label",xk,[xe(w("input",{type:"checkbox","onUpdate:modelValue":p[94]||(p[94]=x=>y.value.config.scaleOverLifeEnabled=x),onChange:Be},null,544),[[Lt,y.value.config.scaleOverLifeEnabled]]),p[254]||(p[254]=w("span",{class:"switch-ui"},null,-1)),p[255]||(p[255]=w("span",null,"生命周期内缩放",-1))]),y.value.config.scaleOverLifeEnabled?(se(),ce(qe,{key:0},[w("div",bk,[w("button",{class:Ze(["axis-mode",{on:y.value.config.scaleOverLifeAxisMode==="uniform"}]),onClick:p[95]||(p[95]=x=>y.value.config.scaleOverLifeAxisMode="uniform")},"统一",2),w("button",{class:Ze(["axis-mode",{on:y.value.config.scaleOverLifeAxisMode==="separate"}]),onClick:p[96]||(p[96]=x=>y.value.config.scaleOverLifeAxisMode="separate")},"XY分离",2)]),Ne(nn,{label:y.value.config.scaleOverLifeAxisMode==="uniform"?"缩放倍率":"倍率 X",mode:y.value.config.scaleOverLifeMode,"onUpdate:mode":Ke,"value-min":y.value.config.scaleOverLifeMin,"onUpdate:valueMin":p[97]||(p[97]=x=>y.value.config.scaleOverLifeMin=x),"value-max":y.value.config.scaleOverLifeMax,"onUpdate:valueMax":p[98]||(p[98]=x=>y.value.config.scaleOverLifeMax=x),curve:y.value.config.scaleOverLifeCurve,"onUpdate:curve":p[99]||(p[99]=x=>y.value.config.scaleOverLifeCurve=x),"default-curve":j,min:0,max:3,step:.05,"curve-label":"生命周期 →"},null,8,["label","mode","value-min","value-max","curve"]),y.value.config.scaleOverLifeAxisMode==="separate"?(se(),Et(nn,{key:0,label:"倍率 Y","show-modes":!1,mode:y.value.config.scaleOverLifeMode,"onUpdate:mode":p[100]||(p[100]=x=>y.value.config.scaleOverLifeMode=x),"value-min":y.value.config.scaleYOverLifeMin,"onUpdate:valueMin":p[101]||(p[101]=x=>y.value.config.scaleYOverLifeMin=x),"value-max":y.value.config.scaleYOverLifeMax,"onUpdate:valueMax":p[102]||(p[102]=x=>y.value.config.scaleYOverLifeMax=x),curve:y.value.config.scaleYOverLifeCurve,"onUpdate:curve":p[103]||(p[103]=x=>y.value.config.scaleYOverLifeCurve=x),"default-curve":j,min:0,max:3,step:.05,"curve-label":"生命周期 →"},null,8,["mode","value-min","value-max","curve"])):$e("",!0)],64)):$e("",!0)]),w("div",wk,[w("label",_k,[xe(w("input",{type:"checkbox","onUpdate:modelValue":p[104]||(p[104]=x=>y.value.config.rotationOverLifeEnabled=x)},null,512),[[Lt,y.value.config.rotationOverLifeEnabled]]),p[256]||(p[256]=w("span",{class:"switch-ui"},null,-1)),p[257]||(p[257]=w("span",null,"生命周期内旋转",-1))]),y.value.config.rotationOverLifeEnabled?(se(),Et(nn,{key:0,label:"旋转速度",mode:y.value.config.rotationOverLifeMode,"onUpdate:mode":p[105]||(p[105]=x=>y.value.config.rotationOverLifeMode=x),"value-min":y.value.config.rotationSpeedMin,"onUpdate:valueMin":p[106]||(p[106]=x=>y.value.config.rotationSpeedMin=x),"value-max":y.value.config.rotationSpeedMax,"onUpdate:valueMax":p[107]||(p[107]=x=>y.value.config.rotationSpeedMax=x),curve:y.value.config.rotationOverLifeCurve,"onUpdate:curve":p[108]||(p[108]=x=>y.value.config.rotationOverLifeCurve=x),"default-curve":N,min:-720,max:720,step:10,"curve-label":"生命周期 →"},null,8,["mode","value-min","value-max","curve"])):$e("",!0)])],512),[[Cn,!U.attr]])]),w("div",Sk,[w("div",{class:"group-head",onClick:p[110]||(p[110]=x=>Y("look"))},[w("span",Tk,Ye(U.look?"▸":"▾"),1),p[260]||(p[260]=w("span",null,"外观与资源",-1)),w("button",{class:"group-reset",title:"重置外观与资源参数",onClick:p[109]||(p[109]=xt(x=>te("look"),["stop"]))},"重置")]),xe(w("div",Mk,[p[274]||(p[274]=w("div",{class:"look-title"},"透明度",-1)),w("div",Ek,[w("button",{class:Ze(["seg-btn",{active:y.value.config.alphaMode==="curve"}]),onClick:p[111]||(p[111]=x=>y.value.config.alphaMode="curve")},"曲线",2),w("button",{class:Ze(["seg-btn",{active:y.value.config.alphaMode==="fixed"}]),onClick:p[112]||(p[112]=x=>y.value.config.alphaMode="fixed")},"固定",2)]),y.value.config.alphaMode==="fixed"?(se(),Et(Ge,{key:0,label:"透明度",min:0,max:1,step:.01,modelValue:y.value.config.alpha,"onUpdate:modelValue":p[113]||(p[113]=x=>y.value.config.alpha=x)},null,8,["modelValue"])):(se(),ce(qe,{key:1},[w("label",Ak,[p[262]||(p[262]=w("span",null,"曲线模式",-1)),xe(w("select",{"onUpdate:modelValue":p[114]||(p[114]=x=>y.value.config.curveMode=x),class:"inp"},[...p[261]||(p[261]=[w("option",null,"跟随导出",-1),w("option",null,"线性",-1),w("option",null,"贝塞尔",-1)])],512),[[kt,y.value.config.curveMode]])]),w("div",Ck,[Ne(Is,{modelValue:y.value.config.alphaCurve,"onUpdate:modelValue":p[115]||(p[115]=x=>y.value.config.alphaCurve=x),"default-value":O,mode:f(y.value.config.curveMode)},null,8,["modelValue","mode"]),p[263]||(p[263]=w("div",{class:"curve-labels"},[w("span",null,"0(透明)"),w("span",null,"生命周期 →"),w("span",null,"1(不透明)")],-1))])],64)),w("div",{class:"look-title image-title"},[p[264]||(p[264]=w("span",null,"图片资源",-1)),w("button",{class:"image-add",title:"新增图片资源",onClick:er},"+")]),(se(!0),ce(qe,null,Ht(y.value.config.imageResources,x=>(se(),Et(mg,{key:x.id,resource:x,"resource-count":y.value.config.imageResources.length,"supports-sequence":"","default-file":"star.png",onPick:Oi,onPickSequence:Qt,onReset:Zs,onRemove:bs,onUpdateWeight:tr,onToggleLock:G},{default:Fu(()=>[Ne(Ge,{label:"缩放",min:.1,max:3,step:.05,modelValue:x.scale,"onUpdate:modelValue":V=>x.scale=V},null,8,["modelValue","onUpdate:modelValue"]),w("label",Ik,[p[265]||(p[265]=w("span",null,"轴心 x,y",-1)),xe(w("input",{type:"number",step:"0.05",class:"inp tiny","onUpdate:modelValue":V=>x.anchorX=V},null,8,Rk),[[Je,x.anchorX,void 0,{number:!0}]]),xe(w("input",{type:"number",step:"0.05",class:"inp tiny","onUpdate:modelValue":V=>x.anchorY=V},null,8,Pk),[[Je,x.anchorY,void 0,{number:!0}]])]),p[273]||(p[273]=w("div",{class:"resource-divider"},null,-1)),w("label",kk,[p[268]||(p[268]=w("span",null,"颜色",-1)),xe(w("select",{"onUpdate:modelValue":V=>x.colorMode=V,class:"inp"},[...p[266]||(p[266]=[w("option",{value:"fixed"},"固定色",-1),w("option",{value:"lifetime"},"生命周期",-1)])],8,Fk),[[kt,x.colorMode]]),xe(w("select",{"onUpdate:modelValue":V=>x.blend=V,class:"inp blend-select"},[...p[267]||(p[267]=[w("option",{value:"normal"},"正常",-1),w("option",{value:"add"},"相加",-1),w("option",{value:"multiply"},"相乘",-1),w("option",{value:"screen"},"滤色",-1)])],8,Ok),[[kt,x.blend]])]),x.colorMode==="fixed"?(se(),ce("label",Bk,[p[269]||(p[269]=w("span",null,"固定色",-1)),xe(w("input",{type:"color","onUpdate:modelValue":V=>x.colorStart=V,class:"colr"},null,8,Lk),[[Je,x.colorStart]]),w("input",{type:"text",class:"hex-input",value:x.colorStart,spellcheck:"false","aria-label":"固定颜色值",onChange:V=>Js(x,V),onKeydown:da(V=>An(x,V),["enter"])},null,40,Dk)])):(se(),Et(pg,{key:1,modelValue:x.colorGradient,"onUpdate:modelValue":V=>x.colorGradient=V},null,8,["modelValue","onUpdate:modelValue"])),w("div",Nk,[p[270]||(p[270]=w("span",null,"独立透明度",-1)),w("div",Uk,[w("button",{class:Ze({on:x.independentAlpha==="off"}),onClick:V=>x.independentAlpha="off"},"关闭",10,Vk),w("button",{class:Ze({on:x.independentAlpha==="fixed"}),onClick:V=>x.independentAlpha="fixed"},"固定",10,Xk),w("button",{class:Ze({on:x.independentAlpha==="curve"}),onClick:V=>x.independentAlpha="curve"},"曲线",10,Yk)])]),x.independentAlpha==="fixed"?(se(),Et(Ge,{key:2,label:"透明度",min:0,max:1,step:.01,modelValue:x.alpha,"onUpdate:modelValue":V=>x.alpha=V},null,8,["modelValue","onUpdate:modelValue"])):x.independentAlpha==="curve"?(se(),ce(qe,{key:3},[w("label",$k,[p[272]||(p[272]=w("span",null,"曲线模式",-1)),xe(w("select",{"onUpdate:modelValue":V=>x.alphaCurveMode=V,class:"inp"},[...p[271]||(p[271]=[w("option",null,"跟随导出",-1),w("option",null,"线性",-1),w("option",null,"贝塞尔",-1)])],8,Gk),[[kt,x.alphaCurveMode]])]),w("div",jk,[Ne(Is,{modelValue:x.alphaCurve,"onUpdate:modelValue":V=>x.alphaCurve=V,"default-value":L,mode:f(x.alphaCurveMode)},null,8,["modelValue","onUpdate:modelValue","mode"])])],64)):$e("",!0)]),_:2},1032,["resource","resource-count"]))),128)),w("input",{ref_key:"textureFileInput",ref:dt,class:"file-input",type:"file",accept:"image/png,image/jpeg,image/webp,image/gif",onChange:Pr},null,544),w("input",{ref_key:"sequenceFileInput",ref:Mt,class:"file-input",type:"file",multiple:"",accept:"image/png,image/jpeg,image/webp,image/gif",onChange:kr},null,544)],512),[[Cn,!U.look]])]),w("div",Hk,[w("div",{class:"group-head",onClick:p[117]||(p[117]=x=>Y("mods"))},[w("span",Wk,Ye(U.mods?"▸":"▾"),1),p[275]||(p[275]=w("span",null,"修改器",-1)),w("button",{class:"group-reset",title:"重置修改器参数",onClick:p[116]||(p[116]=xt(x=>te("mods"),["stop"]))},"重置")]),xe(w("div",zk,[w("div",qk,[w("label",Kk,[xe(w("input",{type:"checkbox","onUpdate:modelValue":p[118]||(p[118]=x=>y.value.config.noise=x)},null,512),[[Lt,y.value.config.noise]]),p[276]||(p[276]=w("span",{class:"switch-ui"},null,-1)),p[277]||(p[277]=w("span",null,"开启移动噪声",-1))]),y.value.config.noise?(se(),ce("div",Zk,[Ne(Ge,{label:"强度",min:0,max:100,step:1,modelValue:y.value.config.noiseAmt,"onUpdate:modelValue":p[119]||(p[119]=x=>y.value.config.noiseAmt=x)},null,8,["modelValue"]),Ne(Ge,{label:"波动范围",min:0,max:500,step:1,modelValue:y.value.config.noiseRange,"onUpdate:modelValue":p[120]||(p[120]=x=>y.value.config.noiseRange=x)},null,8,["modelValue"]),Ne(Ge,{label:"时间流速",min:0,max:10,step:.1,modelValue:y.value.config.noiseSpeed,"onUpdate:modelValue":p[121]||(p[121]=x=>y.value.config.noiseSpeed=x)},null,8,["modelValue"]),p[278]||(p[278]=w("div",{class:"modifier-hint"},"强度控制影响比例 · 波动范围控制最大偏移 · 时间流速控制变化速度",-1))])):$e("",!0)]),w("div",Jk,[w("label",Qk,[xe(w("input",{type:"checkbox","onUpdate:modelValue":p[122]||(p[122]=x=>y.value.config.useGravity=x)},null,512),[[Lt,y.value.config.useGravity]]),p[279]||(p[279]=w("span",{class:"switch-ui"},null,-1)),p[280]||(p[280]=w("span",null,"开启重力",-1))]),y.value.config.useGravity?(se(),ce("div",eF,[w("div",tF,[w("button",{class:Ze(["axis-mode",{on:y.value.config.gravityMode==="fixed"}]),onClick:p[123]||(p[123]=x=>y.value.config.gravityMode="fixed")},"固定",2),w("button",{class:Ze(["axis-mode",{on:y.value.config.gravityMode==="random"}]),onClick:p[124]||(p[124]=x=>y.value.config.gravityMode="random")},"随机",2)]),y.value.config.gravityMode==="fixed"?(se(),Et(Ge,{key:0,label:"重力强度",min:-3e3,max:3e3,step:10,modelValue:y.value.config.gravityMin,"onUpdate:modelValue":p[125]||(p[125]=x=>y.value.config.gravityMin=x)},null,8,["modelValue"])):(se(),ce(qe,{key:1},[Ne(Ge,{label:"强度 min",min:-3e3,max:3e3,step:10,modelValue:y.value.config.gravityMin,"onUpdate:modelValue":p[126]||(p[126]=x=>y.value.config.gravityMin=x)},null,8,["modelValue"]),Ne(Ge,{label:"强度 max",min:-3e3,max:3e3,step:10,modelValue:y.value.config.gravityMax,"onUpdate:modelValue":p[127]||(p[127]=x=>y.value.config.gravityMax=x)},null,8,["modelValue"])],64)),Ne(Ge,{label:"方向",min:-360,max:360,step:1,modelValue:y.value.config.gravityDirection,"onUpdate:modelValue":p[128]||(p[128]=x=>y.value.config.gravityDirection=x)},null,8,["modelValue"]),p[281]||(p[281]=w("div",{class:"gravity-curve-title"},[w("span",null,"生命周期内重力"),w("span",null,"纵轴:强度 0~1")],-1)),Ne(Is,{modelValue:y.value.config.gravityCurve,"onUpdate:modelValue":p[129]||(p[129]=x=>y.value.config.gravityCurve=x),"default-value":j},null,8,["modelValue"]),p[282]||(p[282]=w("div",{class:"gravity-curve-axis"},[w("span",null,"0"),w("span",null,"生命周期 →"),w("span",null,"1")],-1)),p[283]||(p[283]=w("div",{class:"modifier-hint"},"0° 向右 · -90° 向下 · 负强度会反转方向",-1))])):$e("",!0)]),w("div",iF,[w("label",sF,[xe(w("input",{type:"checkbox","onUpdate:modelValue":p[130]||(p[130]=x=>y.value.config.wind=x)},null,512),[[Lt,y.value.config.wind]]),p[284]||(p[284]=w("span",{class:"switch-ui"},null,-1)),p[285]||(p[285]=w("span",null,"开启风力",-1))]),y.value.config.wind?(se(),ce("div",nF,[w("div",rF,[w("button",{class:Ze(["axis-mode",{on:y.value.config.windMode==="fixed"}]),onClick:p[131]||(p[131]=x=>y.value.config.windMode="fixed")},"固定",2),w("button",{class:Ze(["axis-mode",{on:y.value.config.windMode==="random"}]),onClick:p[132]||(p[132]=x=>y.value.config.windMode="random")},"随机",2)]),y.value.config.windMode==="fixed"?(se(),Et(Ge,{key:0,label:"风力强度",min:-3e3,max:3e3,step:10,modelValue:y.value.config.windMin,"onUpdate:modelValue":p[133]||(p[133]=x=>y.value.config.windMin=x)},null,8,["modelValue"])):(se(),ce(qe,{key:1},[Ne(Ge,{label:"强度 min",min:-3e3,max:3e3,step:10,modelValue:y.value.config.windMin,"onUpdate:modelValue":p[134]||(p[134]=x=>y.value.config.windMin=x)},null,8,["modelValue"]),Ne(Ge,{label:"强度 max",min:-3e3,max:3e3,step:10,modelValue:y.value.config.windMax,"onUpdate:modelValue":p[135]||(p[135]=x=>y.value.config.windMax=x)},null,8,["modelValue"])],64)),Ne(Ge,{label:"方向",min:-360,max:360,step:1,modelValue:y.value.config.windDirection,"onUpdate:modelValue":p[136]||(p[136]=x=>y.value.config.windDirection=x)},null,8,["modelValue"]),p[286]||(p[286]=w("div",{class:"gravity-curve-title"},[w("span",null,"生命周期内风力"),w("span",null,"纵轴:强度 0~1")],-1)),Ne(Is,{modelValue:y.value.config.windCurve,"onUpdate:modelValue":p[137]||(p[137]=x=>y.value.config.windCurve=x),"default-value":j},null,8,["modelValue"]),p[287]||(p[287]=w("div",{class:"gravity-curve-axis"},[w("span",null,"0"),w("span",null,"生命周期 →"),w("span",null,"1")],-1)),p[288]||(p[288]=w("div",{class:"modifier-hint"},"0° 向右 · -90° 向下 · 负强度会反转方向",-1))])):$e("",!0)]),w("div",oF,[w("label",aF,[xe(w("input",{type:"checkbox","onUpdate:modelValue":p[138]||(p[138]=x=>y.value.config.forceField=x)},null,512),[[Lt,y.value.config.forceField]]),p[289]||(p[289]=w("span",{class:"switch-ui"},null,-1)),p[290]||(p[290]=w("span",null,"开启力场",-1))]),y.value.config.forceField?(se(),ce("div",lF,[Ne(Ge,{label:"中心 X",min:-5e3,max:5e3,step:1,modelValue:y.value.config.forceCenterX,"onUpdate:modelValue":p[139]||(p[139]=x=>y.value.config.forceCenterX=x)},null,8,["modelValue"]),Ne(Ge,{label:"中心 Y",min:-5e3,max:5e3,step:1,modelValue:y.value.config.forceCenterY,"onUpdate:modelValue":p[140]||(p[140]=x=>y.value.config.forceCenterY=x)},null,8,["modelValue"]),Ne(Ge,{label:"力场强度",min:-300,max:300,step:1,modelValue:y.value.config.forceStrength,"onUpdate:modelValue":p[141]||(p[141]=x=>y.value.config.forceStrength=x)},null,8,["modelValue"]),Ne(Ge,{label:"力场半径",min:1,max:2e3,step:1,modelValue:y.value.config.forceRadius,"onUpdate:modelValue":p[142]||(p[142]=x=>y.value.config.forceRadius=x)},null,8,["modelValue"]),w("label",hF,[p[292]||(p[292]=w("span",null,"衰减模式",-1)),xe(w("select",{"onUpdate:modelValue":p[143]||(p[143]=x=>y.value.config.forceFalloff=x),class:"inp"},[...p[291]||(p[291]=[w("option",{value:"constant"},"恒定(范围内力度不变)",-1),w("option",{value:"linear"},"线性衰减(边缘为 0)",-1),w("option",{value:"inverse"},"距离反比(中心最强)",-1)])],512),[[kt,y.value.config.forceFalloff]])]),p[293]||(p[293]=w("div",{class:"modifier-hint"},"正数吸向中心 · 负数向外排斥 · 可在画布内拖动力场圆",-1))])):$e("",!0)]),w("div",cF,[w("label",uF,[xe(w("input",{type:"checkbox","onUpdate:modelValue":p[144]||(p[144]=x=>y.value.config.attraction=x)},null,512),[[Lt,y.value.config.attraction]]),p[294]||(p[294]=w("span",{class:"switch-ui"},null,-1)),p[295]||(p[295]=w("span",null,"开启吸附",-1))]),y.value.config.attraction?(se(),ce("div",dF,[Ne(Ge,{label:"吸附点 X",min:-5e3,max:5e3,step:1,modelValue:y.value.config.attractionCenterX,"onUpdate:modelValue":p[145]||(p[145]=x=>y.value.config.attractionCenterX=x)},null,8,["modelValue"]),Ne(Ge,{label:"吸附点 Y",min:-5e3,max:5e3,step:1,modelValue:y.value.config.attractionCenterY,"onUpdate:modelValue":p[146]||(p[146]=x=>y.value.config.attractionCenterY=x)},null,8,["modelValue"]),Ne(Ge,{label:"吸附半径",min:0,max:2e3,step:1,modelValue:y.value.config.attractionRadius,"onUpdate:modelValue":p[147]||(p[147]=x=>y.value.config.attractionRadius=x)},null,8,["modelValue"]),Ne(Ge,{label:"吸附时长",min:.05,max:30,step:.05,modelValue:y.value.config.attractionDuration,"onUpdate:modelValue":p[148]||(p[148]=x=>y.value.config.attractionDuration=x)},null,8,["modelValue"]),Ne(Ge,{label:"延迟时间",min:0,max:30,step:.05,modelValue:y.value.config.attractionDelay,"onUpdate:modelValue":p[149]||(p[149]=x=>y.value.config.attractionDelay=x)},null,8,["modelValue"]),w("label",fF,[p[297]||(p[297]=w("span",null,"延迟方式",-1)),xe(w("select",{"onUpdate:modelValue":p[150]||(p[150]=x=>y.value.config.attractionDelayMode=x),class:"inp"},[...p[296]||(p[296]=[w("option",{value:"global"},"统一时间",-1),w("option",{value:"particle"},"单粒子生命",-1)])],512),[[kt,y.value.config.attractionDelayMode]])]),w("label",pF,[p[299]||(p[299]=w("span",null,"吸附方式",-1)),xe(w("select",{"onUpdate:modelValue":p[151]||(p[151]=x=>y.value.config.attractionPath=x),class:"inp"},[...p[298]||(p[298]=[w("option",{value:"linear"},"直线",-1),w("option",{value:"curve"},"曲线",-1)])],512),[[kt,y.value.config.attractionPath]])]),p[300]||(p[300]=w("div",{class:"modifier-hint"},"延迟后从当前位置开始吸附 · 到达红色范围即死亡 · 可在画布内拖动吸附圆",-1))])):$e("",!0)]),w("div",mF,[w("label",gF,[xe(w("input",{type:"checkbox","onUpdate:modelValue":p[152]||(p[152]=x=>y.value.config.trail=x)},null,512),[[Lt,y.value.config.trail]]),p[301]||(p[301]=w("span",{class:"switch-ui"},null,-1)),p[302]||(p[302]=w("span",null,"开启拖尾",-1))]),y.value.config.trail?(se(),ce("div",vF,[w("div",{class:"trail-section-head"},[p[303]||(p[303]=w("div",{class:"trail-section-title"},"拖尾独立图片",-1)),w("button",{class:"image-add",title:"增加拖尾图片资源",onClick:Zi},"+")]),(se(!0),ce(qe,null,Ht(y.value.config.trailResources,x=>(se(),Et(mg,{key:x.id,resource:x,"resource-count":y.value.config.trailResources.length,"default-file":"trail.png","name-placeholder":"trail","show-folder":!1,onPick:xs,onReset:It,onRemove:Pt,onUpdateWeight:$i,onToggleLock:Ji},{default:Fu(()=>[p[319]||(p[319]=w("div",{class:"resource-divider"},null,-1)),Ne(Ge,{label:"旋转",min:-360,max:360,step:1,"model-value":x.rotation,"onUpdate:modelValue":V=>le(x.id,V)},null,8,["model-value","onUpdate:modelValue"]),Ne(Ge,{label:"拖尾骨骼数",min:2,max:16,step:1,"model-value":x.boneCount,"onUpdate:modelValue":V=>re(x.id,V)},null,8,["model-value","onUpdate:modelValue"]),Ne(Ge,{label:"拖尾比例 (%)",min:0,max:100,step:1,modelValue:x.trailRatio,"onUpdate:modelValue":V=>x.trailRatio=V},null,8,["modelValue","onUpdate:modelValue"]),w("label",yF,[p[305]||(p[305]=w("span",null,"拖尾长度",-1)),xe(w("select",{"onUpdate:modelValue":V=>x.lengthMode=V,class:"inp"},[...p[304]||(p[304]=[w("option",{value:"fixed"},"固定",-1),w("option",{value:"random"},"随机范围",-1)])],8,xF),[[kt,x.lengthMode]])]),x.lengthMode==="fixed"?(se(),Et(Ge,{key:0,label:"长度比例 (%)",min:0,max:500,step:1,modelValue:x.length,"onUpdate:modelValue":V=>x.length=V},null,8,["modelValue","onUpdate:modelValue"])):(se(),ce(qe,{key:1},[Ne(Ge,{label:"长度最小 (%)",min:0,max:500,step:1,modelValue:x.lengthMin,"onUpdate:modelValue":V=>x.lengthMin=V},null,8,["modelValue","onUpdate:modelValue"]),Ne(Ge,{label:"长度最大 (%)",min:0,max:500,step:1,modelValue:x.lengthMax,"onUpdate:modelValue":V=>x.lengthMax=V},null,8,["modelValue","onUpdate:modelValue"])],64)),w("label",bF,[p[307]||(p[307]=w("span",null,"拖尾宽度",-1)),xe(w("select",{"onUpdate:modelValue":V=>x.widthSizeMode=V,class:"inp"},[...p[306]||(p[306]=[w("option",{value:"fixed"},"固定",-1),w("option",{value:"random"},"随机范围",-1)])],8,wF),[[kt,x.widthSizeMode]])]),x.widthSizeMode==="fixed"?(se(),Et(Ge,{key:2,label:"宽度比例 (%)",min:0,max:500,step:1,modelValue:x.width,"onUpdate:modelValue":V=>x.width=V},null,8,["modelValue","onUpdate:modelValue"])):(se(),ce(qe,{key:3},[Ne(Ge,{label:"宽度最小 (%)",min:0,max:500,step:1,modelValue:x.widthMin,"onUpdate:modelValue":V=>x.widthMin=V},null,8,["modelValue","onUpdate:modelValue"]),Ne(Ge,{label:"宽度最大 (%)",min:0,max:500,step:1,modelValue:x.widthMax,"onUpdate:modelValue":V=>x.widthMax=V},null,8,["modelValue","onUpdate:modelValue"])],64)),w("label",_F,[p[309]||(p[309]=w("span",null,"宽度缩放",-1)),xe(w("select",{"onUpdate:modelValue":V=>x.widthMode=V,class:"inp"},[...p[308]||(p[308]=[w("option",{value:"particle"},"跟随粒子",-1),w("option",{value:"fixed"},"固定",-1)])],8,SF),[[kt,x.widthMode]])]),w("label",TF,[xe(w("input",{type:"checkbox","onUpdate:modelValue":V=>x.lifeLengthEnabled=V},null,8,MF),[[Lt,x.lifeLengthEnabled]]),p[310]||(p[310]=w("span",{class:"switch-ui"},null,-1)),p[311]||(p[311]=w("span",null,"生命周期长度曲线",-1))]),x.lifeLengthEnabled?(se(),Et(Is,{key:4,modelValue:x.lifeLengthCurve,"onUpdate:modelValue":V=>x.lifeLengthCurve=V,"default-value":j},null,8,["modelValue","onUpdate:modelValue"])):$e("",!0),w("label",EF,[xe(w("input",{type:"checkbox","onUpdate:modelValue":V=>x.shapeEnabled=V},null,8,AF),[[Lt,x.shapeEnabled]]),p[312]||(p[312]=w("span",{class:"switch-ui"},null,-1)),p[313]||(p[313]=w("span",null,"形状曲线(首端 → 尾端宽度)",-1))]),x.shapeEnabled?(se(),Et(Is,{key:5,modelValue:x.shapeCurve,"onUpdate:modelValue":V=>x.shapeCurve=V,"default-value":X},null,8,["modelValue","onUpdate:modelValue"])):$e("",!0),w("div",CF,[p[314]||(p[314]=w("span",null,"颜色模式",-1)),w("div",IF,[w("button",{class:Ze(["axis-mode",{on:x.colorMode==="particle"}]),onClick:V=>x.colorMode="particle"},"跟随粒子",10,RF),w("button",{class:Ze(["axis-mode",{on:x.colorMode==="fixed"}]),onClick:V=>x.colorMode="fixed"},"固定",10,PF),w("button",{class:Ze(["axis-mode",{on:x.colorMode==="curve"}]),onClick:V=>x.colorMode="curve"},"曲线",10,kF)])]),w("label",FF,[p[316]||(p[316]=w("span",null,"混合模式",-1)),xe(w("select",{"onUpdate:modelValue":V=>x.blend=V,class:"inp"},[...p[315]||(p[315]=[w("option",{value:"normal"},"正常",-1),w("option",{value:"add"},"相加",-1),w("option",{value:"multiply"},"相乘",-1),w("option",{value:"screen"},"滤色",-1)])],8,OF),[[kt,x.blend]])]),x.colorMode==="fixed"?(se(),ce("label",BF,[p[317]||(p[317]=w("span",null,"固定颜色",-1)),xe(w("input",{class:"colr",type:"color","onUpdate:modelValue":V=>x.color=V},null,8,LF),[[Je,x.color]]),w("input",{class:"hex-input",value:x.color,onChange:V=>li(x,V),onKeydown:da(xt(V=>Gi(x,V),["prevent"]),["enter"])},null,40,DF)])):x.colorMode==="curve"?(se(),Et(pg,{key:7,modelValue:x.colorGradient,"onUpdate:modelValue":V=>x.colorGradient=V},null,8,["modelValue","onUpdate:modelValue"])):$e("",!0),w("div",NF,[p[318]||(p[318]=w("span",null,"透明度模式",-1)),w("div",UF,[w("button",{class:Ze(["axis-mode",{on:x.alphaMode==="particle"}]),onClick:V=>x.alphaMode="particle"},"跟随粒子",10,VF),w("button",{class:Ze(["axis-mode",{on:x.alphaMode==="fixed"}]),onClick:V=>x.alphaMode="fixed"},"固定",10,XF),w("button",{class:Ze(["axis-mode",{on:x.alphaMode==="curve"}]),onClick:V=>x.alphaMode="curve"},"曲线",10,YF)])]),x.alphaMode==="fixed"?(se(),Et(Ge,{key:8,label:"透明度",min:0,max:1,step:.01,modelValue:x.alpha,"onUpdate:modelValue":V=>x.alpha=V},null,8,["modelValue","onUpdate:modelValue"])):$e("",!0),x.alphaMode==="curve"?(se(),Et(Is,{key:9,modelValue:x.alphaCurve,"onUpdate:modelValue":V=>x.alphaCurve=V,"default-value":P},null,8,["modelValue","onUpdate:modelValue"])):$e("",!0)]),_:2},1032,["resource","resource-count"]))),128)),w("input",{ref_key:"trailTextureFileInput",ref:ai,class:"file-input",type:"file",accept:"image/png,image/jpeg,image/webp",onChange:ft},null,544),w("div",$F,[Ne(Ge,{label:"网格行数",min:2,max:16,step:1,"model-value":y.value.config.trailGridRows,"onUpdate:modelValue":p[153]||(p[153]=x=>$t("trailGridRows",x))},null,8,["model-value"]),Ne(Ge,{label:"网格列数",min:2,max:32,step:1,"model-value":y.value.config.trailGridCols,"onUpdate:modelValue":p[154]||(p[154]=x=>$t("trailGridCols",x))},null,8,["model-value"])]),p[320]||(p[320]=w("div",{class:"modifier-hint"},"每个粒子按资源比例生成一组同级拖尾骨骼;随机长度与宽度在粒子出生时确定,相同种子可稳定复现",-1))])):$e("",!0)]),w("div",GF,[w("label",jF,[xe(w("input",{type:"checkbox","onUpdate:modelValue":p[155]||(p[155]=x=>y.value.config.emitterFollow=x),disabled:y.value.config.streamBehavior==="loop"},null,8,HF),[[Lt,y.value.config.emitterFollow]]),p[321]||(p[321]=w("span",{class:"switch-ui"},null,-1)),p[322]||(p[322]=w("span",null,"开启发射器跟随",-1))]),y.value.config.emitterFollow&&y.value.config.streamBehavior!=="loop"?(se(),ce("div",WF,[w("label",zF,[p[325]||(p[325]=w("span",null,"跟随模式",-1)),w("select",{value:y.value.config.emitterFollowMode,class:"inp",onChange:p[156]||(p[156]=x=>ae(x,y.value.config))},[p[323]||(p[323]=w("option",{value:"none"},"无",-1)),p[324]||(p[324]=w("option",{value:"path"},"跟随路径",-1)),F.value||y.value.config.emitterFollowMode==="bone"?(se(),ce("option",KF,"选中的骨骼")):$e("",!0)],40,qF)]),y.value.config.emitterFollowMode==="path"?(se(),ce(qe,{key:0},[w("label",ZF,[p[327]||(p[327]=w("span",null,"跟随路径",-1)),xe(w("select",{"onUpdate:modelValue":p[157]||(p[157]=x=>y.value.config.emitterFollowPathId=x),class:"inp"},[p[326]||(p[326]=w("option",{value:0},"无",-1)),(se(!0),ce(qe,null,Ht(Pe(e).paths,x=>(se(),ce("option",{key:x.id,value:x.id},Ye(x.name),9,JF))),128))],512),[[kt,y.value.config.emitterFollowPathId,void 0,{number:!0}]])]),w("label",QF,[p[329]||(p[329]=w("span",null,"发射器角度模式",-1)),xe(w("select",{"onUpdate:modelValue":p[158]||(p[158]=x=>y.value.config.emitterAngleMode=x),class:"inp"},[...p[328]||(p[328]=[w("option",{value:"fixed"},"固定角度",-1),w("option",{value:"direction"},"跟随移动方向",-1)])],512),[[kt,y.value.config.emitterAngleMode]])]),p[335]||(p[335]=w("div",{class:"gravity-curve-title"},[w("span",null,"移动进度曲线 (0→1)")],-1)),Ne(Is,{modelValue:y.value.config.emitterFollowCurve,"onUpdate:modelValue":p[159]||(p[159]=x=>y.value.config.emitterFollowCurve=x),"default-value":N},null,8,["modelValue"]),w("div",eO,[w("label",tO,[p[330]||(p[330]=w("span",null,"移动时长 (s)",-1)),xe(w("input",{"onUpdate:modelValue":p[160]||(p[160]=x=>y.value.config.emitterFollowDuration=x),type:"number",min:"0.05",step:"0.05",class:"inp"},null,512),[[Je,y.value.config.emitterFollowDuration,void 0,{number:!0}]])]),w("label",iO,[p[332]||(p[332]=w("span",null,"跟随空间",-1)),xe(w("select",{"onUpdate:modelValue":p[161]||(p[161]=x=>y.value.config.emitterFollowSpace=x),class:"inp"},[...p[331]||(p[331]=[w("option",{value:"local"},"局部空间(GEN 移动)",-1),w("option",{value:"world"},"世界空间(粒子生成点移动)",-1)])],512),[[kt,y.value.config.emitterFollowSpace]])])]),w("label",sO,[p[334]||(p[334]=w("span",null,"移动方向",-1)),xe(w("select",{"onUpdate:modelValue":p[162]||(p[162]=x=>y.value.config.emitterFollowDirection=x),class:"inp"},[...p[333]||(p[333]=[w("option",{value:"forward"},"正向(起点 → 终点)",-1),w("option",{value:"reverse"},"反向(终点 → 起点)",-1)])],512),[[kt,y.value.config.emitterFollowDirection]])]),Ne(Ge,{label:"偏移起始点 (0-1)",min:0,max:1,step:.01,modelValue:y.value.config.emitterFollowOffset,"onUpdate:modelValue":p[163]||(p[163]=x=>y.value.config.emitterFollowOffset=x)},null,8,["modelValue"]),p[336]||(p[336]=w("div",{class:"modifier-hint"},"局部空间会移动整个发射器;世界空间只移动新粒子的生成点,已出生粒子留在世界位置。",-1))],64)):y.value.config.emitterFollowMode==="bone"?(se(),ce(qe,{key:1},[D.value?(se(),ce("div",nO,[p[337]||(p[337]=Yt("跟随目标:",-1)),w("strong",null,Ye(D.value.spine.name)+" / "+Ye(D.value.boneName),1)])):(se(),ce("div",rO,"尚未绑定有效骨骼,请先在 Spine 层级树中选择骨骼。")),F.value&&(!D.value||F.value.spine.id!==D.value.spine.id||F.value.boneName!==D.value.boneName)?(se(),ce("button",{key:2,class:"bone-follow-rebind",onClick:p[164]||(p[164]=x=>me(y.value.config))},Ye(D.value?"重新绑定":"绑定")+"当前选中骨骼:"+Ye(F.value.spine.name)+" / "+Ye(F.value.boneName),1)):$e("",!0),D.value?(se(),ce(qe,{key:3},[w("label",oO,[p[339]||(p[339]=w("span",null,"跟随空间",-1)),xe(w("select",{"onUpdate:modelValue":p[165]||(p[165]=x=>y.value.config.emitterFollowSpace=x),class:"inp"},[...p[338]||(p[338]=[w("option",{value:"local"},"本地空间(随骨骼移动)",-1),w("option",{value:"world"},"世界空间(粒子生成后保持位置)",-1)])],512),[[kt,y.value.config.emitterFollowSpace]])]),w("div",aO,[w("label",lO,[p[340]||(p[340]=w("span",null,"位移偏移 X",-1)),xe(w("input",{"onUpdate:modelValue":p[166]||(p[166]=x=>y.value.config.emitterFollowBoneOffsetX=x),type:"number",step:"1",class:"inp"},null,512),[[Je,y.value.config.emitterFollowBoneOffsetX,void 0,{number:!0}]])]),w("label",hO,[p[341]||(p[341]=w("span",null,"位移偏移 Y",-1)),xe(w("input",{"onUpdate:modelValue":p[167]||(p[167]=x=>y.value.config.emitterFollowBoneOffsetY=x),type:"number",step:"1",class:"inp"},null,512),[[Je,y.value.config.emitterFollowBoneOffsetY,void 0,{number:!0}]])])]),w("div",cO,[w("label",uO,[p[342]||(p[342]=w("span",null,"旋转偏移",-1)),xe(w("input",{"onUpdate:modelValue":p[168]||(p[168]=x=>y.value.config.emitterFollowBoneRotation=x),type:"number",step:"1",class:"inp"},null,512),[[Je,y.value.config.emitterFollowBoneRotation,void 0,{number:!0}]])]),w("label",dO,[p[343]||(p[343]=w("span",null,"缩放偏移 X",-1)),xe(w("input",{"onUpdate:modelValue":p[169]||(p[169]=x=>y.value.config.emitterFollowBoneScaleX=x),type:"number",step:"0.05",class:"inp"},null,512),[[Je,y.value.config.emitterFollowBoneScaleX,void 0,{number:!0}]])]),w("label",fO,[p[344]||(p[344]=w("span",null,"缩放偏移 Y",-1)),xe(w("input",{"onUpdate:modelValue":p[170]||(p[170]=x=>y.value.config.emitterFollowBoneScaleY=x),type:"number",step:"0.05",class:"inp"},null,512),[[Je,y.value.config.emitterFollowBoneScaleY,void 0,{number:!0}]])])]),p[345]||(p[345]=w("div",{class:"modifier-hint"},"发射器只跟随所选 Spine 骨骼的位置,不继承 Spine 的旋转或缩放;粒子变换使用粒子系统自身参数和上方偏移。",-1))],64)):$e("",!0)],64)):$e("",!0)])):$e("",!0)]),Ne(Ge,{label:"阻尼",min:0,max:2,step:.05,modelValue:y.value.config.damping,"onUpdate:modelValue":p[171]||(p[171]=x=>y.value.config.damping=x)},null,8,["modelValue"])],512),[[Cn,!U.mods]])]),w("div",pO,[w("div",{class:"group-head",onClick:p[173]||(p[173]=x=>Y("export"))},[w("span",mO,Ye(U.export?"▸":"▾"),1),p[346]||(p[346]=w("span",null,"导出设置",-1)),w("button",{class:"group-reset",title:"重置导出设置",onClick:p[172]||(p[172]=xt(x=>te("export"),["stop"]))},"重置")]),xe(w("div",gO,[w("label",vO,[p[347]||(p[347]=w("span",null,"图片路径 (Spine Images Path)",-1)),xe(w("input",{"onUpdate:modelValue":p[174]||(p[174]=x=>t.value.imagesPath=x),class:"inp export-input",type:"text",placeholder:"./images/"},null,512),[[Je,t.value.imagesPath,void 0,{trim:!0}]])]),w("label",yO,[p[349]||(p[349]=w("span",null,"Spine 版本",-1)),xe(w("select",{"onUpdate:modelValue":p[175]||(p[175]=x=>t.value.spineVersion=x),class:"inp export-input"},[...p[348]||(p[348]=[w("option",{value:"3.8"},"Spine 3.8",-1),w("option",{value:"4.0"},"Spine 4.0",-1),w("option",{value:"4.1"},"Spine 4.1",-1),w("option",{value:"4.2"},"Spine 4.2",-1)])],512),[[kt,t.value.spineVersion]])]),w("label",xO,[p[351]||(p[351]=w("span",null,"关键帧插值曲线",-1)),xe(w("select",{"onUpdate:modelValue":p[176]||(p[176]=x=>t.value.keyframeCurve=x),class:"inp export-input"},[...p[350]||(p[350]=[w("option",{value:"linear"},"线性 (Linear)",-1),w("option",{value:"bezier"},"平滑贝塞尔 (Smooth Bézier)",-1)])],512),[[kt,t.value.keyframeCurve]])]),p[360]||(p[360]=w("div",{class:"export-help"},"平滑贝塞尔会在误差允许范围内拟合连续运动;出生、死亡、附件切换和突变仍使用阶跃关键帧。",-1)),t.value.spineVersion==="3.8"?(se(),ce("div",bO,"Spine 3.8 不支持 4.x 的逐通道数组贝塞尔,导出时会转换为经过容差精简的分段线性关键帧。")):$e("",!0),w("div",wO,[w("label",_O,[p[352]||(p[352]=w("span",null,"导出 FPS",-1)),xe(w("input",{"onUpdate:modelValue":p[177]||(p[177]=x=>t.value.fps=x),class:"inp export-input",type:"number",min:"1",max:"240",step:"1",onChange:ve},null,544),[[Je,t.value.fps,void 0,{number:!0}]])]),w("label",SO,[xe(w("input",{"onUpdate:modelValue":p[178]||(p[178]=x=>t.value.omitFps=x),type:"checkbox"},null,512),[[Lt,t.value.omitFps]]),p[353]||(p[353]=Yt("不写 fps",-1))])]),p[361]||(p[361]=w("div",{class:"export-help"},"修改 FPS 时保持动画实际秒数不变;“不写 fps”只省略 Spine 的 fps 元数据。",-1)),w("div",TO,[w("label",MO,[xe(w("input",{"onUpdate:modelValue":p[179]||(p[179]=x=>t.value.integerFrameAlignment=x),type:"checkbox"},null,512),[[Lt,t.value.integerFrameAlignment]]),p[354]||(p[354]=w("span",{class:"switch-ui"},null,-1)),p[355]||(p[355]=w("span",null,"整数帧对齐",-1))]),w("label",EO,[xe(w("input",{"onUpdate:modelValue":p[180]||(p[180]=x=>t.value.bonePool=x),type:"checkbox"},null,512),[[Lt,t.value.bonePool]]),p[356]||(p[356]=w("span",{class:"switch-ui"},null,-1)),p[357]||(p[357]=w("span",null,"骨骼对象池",-1))]),w("label",AO,[xe(w("input",{"onUpdate:modelValue":p[181]||(p[181]=x=>t.value.excludeEmptyAnimations=x),type:"checkbox"},null,512),[[Lt,t.value.excludeEmptyAnimations]]),p[358]||(p[358]=w("span",{class:"switch-ui"},null,-1)),p[359]||(p[359]=w("span",null,"排除无内容动画",-1))])])],512),[[Cn,!U.export]])])],64)):$e("",!0)]),w("button",{type:"button",class:"export-spine-json",disabled:l.value,title:l.value?"正在重新计算并烘焙动画":`导出 Spine ${t.value.spineVersion} JSON`,onClick:v},Ye(l.value?"正在准备导出…":"导出Spine Json"),9,CO),c.value?(se(),ce("div",{key:0,class:Ze(["export-message",{error:u.value}])},Ye(c.value),3)):$e("",!0)]))}}),RO=Ks(IO,[["__scopeId","data-v-6eba135a"]]),PO={class:"timeline"},kO={class:"tl-controls"},FO=["title"],OO={class:"tl-frame"},BO=["disabled"],LO=["onClick"],DO={key:0},NO={class:"tl-animation-editor"},UO={key:0,class:"tl-animation-error"},VO={class:"tl-animation-actions"},XO=["disabled"],YO={key:1,class:"tl-animation-hint"},$O={class:"tl-anim tl-spine-preview"},GO=["value","disabled"],jO={value:""},HO=["value"],WO={class:"tl-zoom"},zO={class:"tl-ticks"},qO={class:"tl-ticklabel"},KO={class:"tl-lanes"},ZO=["onPointerdown"],JO={class:"lane-name"},QO=["onPointerdown"],e3=["onPointerdown"],t3={class:"lane-name"},i3={key:0,class:"tl-empty"},s3=Ws({__name:"Timeline",setup(i){const e=Aa(),t=it(null),s=it(null),n=it(!1),r=it("animation"),o=it("");No(()=>{(!Array.isArray(e.timeline.animations)||!e.timeline.animations.length)&&(e.timeline.animations=["animation"]),e.timeline.animations.includes(e.timeline.animation)||(e.timeline.animation=e.timeline.animations[0]);for(const H of e.systems)(!H.animation||!e.timeline.animations.includes(H.animation))&&(H.animation=e.timeline.animations[0])});const a=ut(()=>e.systems.find(H=>H.id===e.activeId)||null);function h(){a.value&&(n.value=!n.value,r.value=a.value.animation,o.value="")}function l(H){const Z=a.value;Z&&(e.setSystemAnimation(Z.id,H),r.value=H,o.value="")}function c(){const H=e.addAnimation();r.value=H,o.value=""}function u(){var ae;const H=((ae=a.value)==null?void 0:ae.animation)||e.timeline.animation,Z=r.value.trim();if(!Z){o.value="动画名称不能为空";return}if(Z!==H&&e.timeline.animations.includes(Z)){o.value="动画名称不能重复";return}if(!e.renameAnimation(H,Z)){o.value="无法修改动画名称";return}r.value=Z,o.value=""}function f(){var ae,me;const H=((ae=a.value)==null?void 0:ae.animation)||e.timeline.animation;if(!e.removeAnimation(H)){o.value="至少需要保留一个动画";return}const Z=((me=a.value)==null?void 0:me.animation)||e.timeline.animation;r.value=Z,o.value=""}function d(H){var Z;(Z=s.value)!=null&&Z.contains(H.target)||(n.value=!1)}_o(()=>document.addEventListener("pointerdown",d)),a0(()=>document.removeEventListener("pointerdown",d));const m=ut(()=>Math.max(1,e.timeline.fps||30)),g=it(120),b=it({}),_=it({}),M=it({}),v=ut(()=>e.timeline.totalFrames),S=ut(()=>g.value<=30?"放大":g.value>=300?"缩小":"适中"),y=ut(()=>e.spines.filter(H=>H.selectedAnimation&&H.animations.some(Z=>Z.name===H.selectedAnimation&&Z.duration>0))),I=ut(()=>(e.activeObjectType==="spine"?e.spines.find(Z=>Z.id===e.activeObjectId&&Z.animations.length):null)||e.spines.find(Z=>Z.animations.length)||null);function E(H){const Z=I.value;Z&&(Z.selectedAnimation=H.target.value,e.recalcTotalFrames(),e.timeline.frame=0)}function C(){var Z;const H=((Z=t.value)==null?void 0:Z.clientWidth)||600;return g.value/H}const R=ut(()=>{const H=[],Z=g.value;let ae=1;g.value<=10?ae=1:g.value<=50?ae=5:g.value<=200?ae=10:g.value<=500?ae=50:ae=100;for(let me=0;me<=Z;me+=ae)H.push({f:me,px:me/C()});return H}),B=ut(()=>e.timeline.frame/C());function k(H){const Z=H.config;return(b.value[H.id]??Math.max(0,Number(Z.delay)||0))*m.value/C()}function F(H){const Z=H.config,ae=Math.max(0,Number(Z.lifeMin)||0),me=Math.max(0,Number(Z.lifeMax)||0);return Z.lifeMode==="fixed"?ae:Math.max(ae,me)}function D(H){return j(H)}function N(H){if(H.config.mode!=="stream"||O(H))return 0;if(H.config.streamBehavior==="loop"){const ae=H.config,me=Math.max(1,Math.ceil(Number(ae.loopDurationFrames)||1));if(ae.generateLoopStartAnimation){const _e=Math.max(1,Math.ceil(F(H)*m.value/me));return me*_e/C()}return me/C()}return(_.value[H.id]??Math.max(1/m.value,Number(H.config.duration)||1))*m.value/C()}function j(H){const Z=H.config;return Z.mode==="stream"&&Z.streamBehavior==="loop"?Z.generateLoopEndAnimation?(F(H)*m.value+1)/C():N(H):N(H)+F(H)*m.value/C()}function O(H){const Z=H.config;return Z.mode==="stream"&&Z.streamBehavior==="loop"&&Z.generateLoopEndAnimation}function L(H){var Z;return((Z=H.animations.find(ae=>ae.name===H.selectedAnimation))==null?void 0:Z.duration)||0}function P(H){return(M.value[H.id]??Math.max(0,Number(H.timeOffset)||0))*m.value/C()}function X(H){return L(H)*m.value/C()}function U(H){const Z=H.deltaY<0?.8:1.25;let ae=g.value*Z;ae=Math.min(2e3,Math.max(10,ae)),g.value=Math.round(ae)}function Y(H){const Z=t.value,ae=_e=>{const te=Z.getBoundingClientRect(),ve=Math.floor((_e.clientX-te.left)/te.width*g.value);e.timeline.frame=Math.max(0,Math.min(ve,v.value-1))};ae(H);const me=()=>{window.removeEventListener("pointermove",ae),window.removeEventListener("pointerup",me)};window.addEventListener("pointermove",ae),window.addEventListener("pointerup",me)}function q(H,Z){H.stopPropagation();const ae=H.clientX,me=Math.max(0,Number(Z.config.delay)||0),_e=C()/m.value,te=J=>{const Q=(J.clientX-ae)*_e,ie=Math.max(0,Math.min(me+Q,600));b.value[Z.id]=Math.round(ie*m.value)/m.value},ve=J=>{window.removeEventListener("pointermove",te),window.removeEventListener("pointerup",$),window.removeEventListener("pointercancel",W);const Q=b.value[Z.id];delete b.value[Z.id],J&&Q!=null&&Q!==me&&(Z.config.delay=Q)},$=()=>ve(!0),W=()=>ve(!1);window.addEventListener("pointermove",te),window.addEventListener("pointerup",$),window.addEventListener("pointercancel",W)}function z(H,Z){var Q;if(H.stopPropagation(),O(Z))return;const ae=Math.max(0,Number(Z.config.duration)||0),me=C()/m.value,_e=((Q=H.currentTarget.closest(".lane-bar"))==null?void 0:Q.getBoundingClientRect().left)??H.clientX;let te=!1;const ve=ie=>{te=!0;const ue=Math.max(1/m.value,Math.min((ie.clientX-_e)*me,600));_.value[Z.id]=Math.round(ue*m.value)/m.value},$=ie=>{window.removeEventListener("pointermove",ve),window.removeEventListener("pointerup",W),window.removeEventListener("pointercancel",J);const ue=_.value[Z.id];delete _.value[Z.id],ie&&te&&ue!=null&&ue!==ae&&(Z.config.duration=ue)},W=()=>$(!0),J=()=>$(!1);window.addEventListener("pointermove",ve),window.addEventListener("pointerup",W),window.addEventListener("pointercancel",J)}function ne(H,Z){H.stopPropagation();const ae=H.clientX,me=Math.max(0,Number(Z.timeOffset)||0),_e=C()/m.value,te=J=>{const Q=Math.max(0,Math.min(me+(J.clientX-ae)*_e,600));M.value[Z.id]=Math.round(Q*m.value)/m.value},ve=J=>{window.removeEventListener("pointermove",te),window.removeEventListener("pointerup",$),window.removeEventListener("pointercancel",W);const Q=M.value[Z.id];delete M.value[Z.id],J&&Q!=null&&Q!==me&&(Z.timeOffset=Q,e.recalcTotalFrames())},$=()=>ve(!0),W=()=>ve(!1);window.addEventListener("pointermove",te),window.addEventListener("pointerup",$),window.addEventListener("pointercancel",W)}return(H,Z)=>{var ae,me,_e;return se(),ce("div",PO,[w("div",kO,[w("button",{class:Ze(["tl-btn",{on:Pe(e).timeline.playing}]),onClick:Z[0]||(Z[0]=te=>Pe(e).togglePlay()),title:Pe(e).timeline.playing?"暂停 (D)":"播放 (D)"},Ye(Pe(e).timeline.playing?"❚❚":"▶"),11,FO),w("button",{class:"tl-btn",onClick:Z[1]||(Z[1]=te=>Pe(e).toStart()),title:"回到第一帧 (S)"},"⏮"),w("button",{class:"tl-btn",onClick:Z[2]||(Z[2]=te=>Pe(e).previousFrame()),title:"前一帧"},"◀"),w("button",{class:"tl-btn",onClick:Z[3]||(Z[3]=te=>Pe(e).nextFrame()),title:"后一帧"},"▶"),w("button",{class:"tl-btn",onClick:Z[4]||(Z[4]=te=>Pe(e).toEnd()),title:"移动到最后一帧"},"⏭"),w("button",{class:Ze(["tl-btn",{on:Pe(e).timeline.loop}]),onClick:Z[5]||(Z[5]=te=>Pe(e).toggleLoop()),title:"循环"},"⟳",2),w("span",OO,[Z[8]||(Z[8]=Yt("帧 ",-1)),w("b",null,Ye(Pe(e).timeline.frame),1),Z[9]||(Z[9]=Yt(" / ",-1)),w("b",null,Ye(Math.max(0,Pe(e).timeline.totalFrames-1)),1)]),Z[14]||(Z[14]=w("span",{class:"tl-legend"},[w("i",{class:"legend-emission"}),Yt("持续发射 "),w("i",{class:"legend-life"}),Yt("粒子存在 "),w("i",{class:"legend-spine"}),Yt("Spine 动画")],-1)),w("div",{ref_key:"animationMenuRef",ref:s,class:"tl-anim tl-owner-animation"},[Z[12]||(Z[12]=w("span",null,"所属动画",-1)),w("button",{class:"tl-animation-trigger",disabled:!a.value,title:"设置当前粒子系统所属的动画",onClick:xt(h,["stop"])},[w("span",null,Ye(((ae=a.value)==null?void 0:ae.animation)||Pe(e).timeline.animation),1),Z[10]||(Z[10]=w("i",null,"⌄",-1))],8,BO),n.value?(se(),ce("div",{key:0,class:"tl-animation-menu",onPointerdown:Z[7]||(Z[7]=xt(()=>{},["stop"]))},[Z[11]||(Z[11]=w("div",{class:"tl-animation-menu-title"},"选择所属动画",-1)),(se(!0),ce(qe,null,Ht(Pe(e).timeline.animations,te=>{var ve,$;return se(),ce("button",{key:te,class:Ze(["tl-animation-option",{on:((ve=a.value)==null?void 0:ve.animation)===te}]),onClick:W=>l(te)},[w("span",null,Ye(te),1),(($=a.value)==null?void 0:$.animation)===te?(se(),ce("i",DO,"✓")):$e("",!0)],10,LO)}),128)),w("div",NO,[xe(w("input",{"onUpdate:modelValue":Z[6]||(Z[6]=te=>r.value=te),class:"tl-animation-name",maxlength:"64","aria-label":"动画名称",onKeydown:da(u,["enter"])},null,544),[[Je,r.value]]),w("button",{title:"重命名当前动画",onClick:u},"重命名")]),o.value?(se(),ce("div",UO,Ye(o.value),1)):$e("",!0),w("div",VO,[w("button",{onClick:c},"+ 新增"),w("button",{disabled:Pe(e).timeline.animations.length<=1,onClick:f},"删除",8,XO)]),Pe(e).timeline.animations.length<=1?(se(),ce("div",YO,"至少需要保留一个动画")):$e("",!0)],32)):$e("",!0)],512),w("label",$O,[Z[13]||(Z[13]=Yt("Spine 预览动画 ",-1)),w("select",{class:"tl-sel",value:((me=I.value)==null?void 0:me.selectedAnimation)||"",disabled:!I.value,onChange:E},[w("option",jO,Ye(I.value?"无":"无可用 Spine 动画"),1),(se(!0),ce(qe,null,Ht(((_e=I.value)==null?void 0:_e.animations)||[],te=>(se(),ce("option",{key:te.name,value:te.name},Ye(te.name)+"("+Ye(te.duration.toFixed(2))+"s) ",9,HO))),128))],40,GO)]),w("span",WO,Ye(S.value),1)]),w("div",{class:"tl-viewport",ref_key:"vpRef",ref:t,onWheel:xt(U,["prevent"]),onPointerdown:Y},[w("div",zO,[(se(!0),ce(qe,null,Ht(R.value,te=>(se(),ce("div",{key:te.f,class:"tl-tickline",style:Pi({left:te.px+"px"})},[w("span",qO,Ye(te.f)+"f",1)],4))),128))]),w("div",{class:"tl-playhead",style:Pi({left:B.value+"px"})},null,4),w("div",KO,[(se(!0),ce(qe,null,Ht(Pe(e).systems,(te,ve)=>(se(),ce("div",{key:te.id,class:"tl-lane"},[Z[15]||(Z[15]=w("span",{class:"lane-ico"},"●",-1)),w("div",{class:"lane-bar",style:Pi({left:k(te)+"px",width:D(te)+"px"}),onPointerdown:xt($=>q($,te),["stop"])},[w("span",JO,Ye(te.config.name||"系统 "+(ve+1)),1),w("span",{class:"bar-life",style:Pi({width:j(te)+"px"})},null,4),te.config.mode==="stream"&&!O(te)?(se(),ce("span",{key:0,class:"bar-emission",style:Pi({width:N(te)+"px"})},[w("span",{class:"bar-handle",title:"拖动持续发射时长",onPointerdown:xt($=>z($,te),["stop"])},null,40,QO)],4)):$e("",!0)],44,ZO)]))),128)),(se(!0),ce(qe,null,Ht(y.value,te=>(se(),ce("div",{key:`spine-${te.id}`,class:"tl-lane spine-lane"},[Z[16]||(Z[16]=w("span",{class:"lane-ico spine-ico"},"◆",-1)),w("div",{class:"spine-bar",style:Pi({left:P(te)+"px",width:X(te)+"px"}),title:"拖动调整动画开始时间",onPointerdown:xt(ve=>ne(ve,te),["stop"])},[w("span",t3,Ye(te.name)+" · "+Ye(te.selectedAnimation),1)],44,e3)]))),128)),!Pe(e).systems.length&&!y.value.length?(se(),ce("div",i3,"暂无可显示的动画数据")):$e("",!0)])],544)])}}}),n3=Ks(s3,[["__scopeId","data-v-0ef42eef"]]),r3={class:"right"},o3={class:"stage-area"},a3=Ws({__name:"App",setup(i){const e=Aa();FE(e);const t=it(360),s=it(180);function n(o){o.preventDefault();const a=l=>{const c=e.settings.parameterPanelOnRight?window.innerWidth-l.clientX:l.clientX,u=Math.max(240,Math.min(c,window.innerWidth-200));t.value=u},h=()=>{window.removeEventListener("pointermove",a),window.removeEventListener("pointerup",h)};window.addEventListener("pointermove",a),window.addEventListener("pointerup",h)}function r(o){o.preventDefault();const a=o.clientY,h=s.value,l=u=>{const f=Math.max(80,Math.min(h+(a-u.clientY),window.innerHeight-200));s.value=f},c=()=>{window.removeEventListener("pointermove",l),window.removeEventListener("pointerup",c)};window.addEventListener("pointermove",l),window.addEventListener("pointerup",c)}return(o,a)=>(se(),ce("div",{class:Ze(["layout",{"panel-right":Pe(e).settings.parameterPanelOnRight}])},[w("div",{class:"parameter-panel",style:Pi({width:t.value+"px"})},[Ne(RO)],4),w("div",{class:"resizer-col",onPointerdown:n},null,32),w("div",r3,[w("div",o3,[Ne(zC)]),w("div",{class:"resizer-row",onPointerdown:r,title:"拖动调整时间轴高度"},null,32),w("div",{class:"timeline-area",style:Pi({height:s.value+"px"})},[Ne(n3)],4)])],2))}}),l3=Ks(a3,[["__scopeId","data-v-8eacccdc"]]);Hb(l3).use(qb()).mount("#app");
|