const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-B1oGFzi8.js","assets/index-BUbc0qUx.js"])))=>i.map(i=>d[i]); var ES=Object.defineProperty;var CS=(s,e,t)=>e in s?ES(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var x=(s,e,t)=>CS(s,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"]'))i(n);new MutationObserver(n=>{for(const r of n)if(r.type==="childList")for(const a of r.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&i(a)}).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 i(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 qm(s){const e=Object.create(null);for(const t of s.split(","))e[t]=1;return t=>t in e}const ti={},fo=[],On=()=>{},xy=()=>!1,Qh=s=>s.charCodeAt(0)===111&&s.charCodeAt(1)===110&&(s.charCodeAt(2)>122||s.charCodeAt(2)<97),eu=s=>s.startsWith("onUpdate:"),Oi=Object.assign,Km=(s,e)=>{const t=s.indexOf(e);t>-1&&s.splice(t,1)},IS=Object.prototype.hasOwnProperty,zt=(s,e)=>IS.call(s,e),ft=Array.isArray,mo=s=>Vl(s)==="[object Map]",Oo=s=>Vl(s)==="[object Set]",Yp=s=>Vl(s)==="[object Date]",Mt=s=>typeof s=="function",vi=s=>typeof s=="string",Cs=s=>typeof s=="symbol",qt=s=>s!==null&&typeof s=="object",by=s=>(qt(s)||Mt(s))&&Mt(s.then)&&Mt(s.catch),wy=Object.prototype.toString,Vl=s=>wy.call(s),RS=s=>Vl(s).slice(8,-1),Sy=s=>Vl(s)==="[object Object]",tu=s=>vi(s)&&s!=="NaN"&&s[0]!=="-"&&""+parseInt(s,10)===s,cl=qm(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),iu=s=>{const e=Object.create(null);return(t=>e[t]||(e[t]=s(t)))},PS=/-\w/g,nn=iu(s=>s.replace(PS,e=>e.slice(1).toUpperCase())),kS=/\B([A-Z])/g,qr=iu(s=>s.replace(kS,"-$1").toLowerCase()),My=iu(s=>s.charAt(0).toUpperCase()+s.slice(1)),Ou=iu(s=>s?`on${My(s)}`:""),In=(s,e)=>!Object.is(s,e),Uc=(s,...e)=>{for(let t=0;t{Object.defineProperty(s,e,{configurable:!0,enumerable:!1,writable:i,value:t})},su=s=>{const e=parseFloat(s);return isNaN(e)?s:e},FS=s=>{const e=vi(s)?Number(s):NaN;return isNaN(e)?s:e};let $p;const nu=()=>$p||($p=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function Li(s){if(ft(s)){const e={};for(let t=0;t{if(t){const i=t.split(BS);i.length>1&&(e[i[0].trim()]=i[1].trim())}}),e}function Ze(s){let e="";if(vi(s))e=s;else if(ft(s))for(let t=0;tBo(t,e))}const Ay=s=>!!(s&&s.__v_isRef===!0),Xe=s=>vi(s)?s:s==null?"":ft(s)||qt(s)&&(s.toString===wy||!Mt(s.toString))?Ay(s)?Xe(s.value):JSON.stringify(s,Ey,2):String(s),Ey=(s,e)=>Ay(e)?Ey(s,e.value):mo(e)?{[`Map(${e.size})`]:[...e.entries()].reduce((t,[i,n],r)=>(t[Bu(i,r)+" =>"]=n,t),{})}:Oo(e)?{[`Set(${e.size})`]:[...e.values()].map(t=>Bu(t))}:Cs(e)?Bu(e):qt(e)&&!ft(e)&&!Sy(e)?String(e):e,Bu=(s,e="")=>{var t;return Cs(s)?`Symbol(${(t=s.description)!=null?t:e})`:s};/** * @vue/reactivity v3.5.41 * (c) 2018-present Yuxi (Evan) You and Vue contributors * @license MIT **/let Pi;class Cy{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&&Pi&&(Pi.active?(this.parent=Pi,this.index=(Pi.scopes||(Pi.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 i=this.scopes.slice();for(e=0,t=i.length;e0&&--this._on===0){if(Pi===this)Pi=this.prevScope;else{let e=Pi;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,i;for(t=0,i=this.effects.length;t0)return;if(ul){let e=ul;for(ul=void 0;e;){const t=e.next;e.next=void 0,e.flags&=-9,e=t}}let s;for(;hl;){let e=hl;for(hl=void 0;e;){const t=e.next;if(e.next=void 0,e.flags&=-9,e.flags&1)try{e.trigger()}catch(i){s||(s=i)}e=t}}if(s)throw s}function Oy(s){for(let e=s.deps;e;e=e.nextDep)e.version=-1,e.prevActiveLink=e.dep.activeLink,e.dep.activeLink=e}function By(s){let e,t=s.depsTail,i=t;for(;i;){const n=i.prevDep;i.version===-1?(i===t&&(t=n),ep(i),YS(i)):e=i,i.dep.activeLink=i.prevActiveLink,i.prevActiveLink=void 0,i=n}s.deps=e,s.depsTail=t}function If(s){for(let e=s.deps;e;e=e.nextDep)if(e.dep.version!==e.version||e.dep.computed&&(Ly(e.dep.computed)||e.dep.version!==e.version))return!0;return!!s._dirty}function Ly(s){if(s.flags&4&&!(s.flags&16)||(s.flags&=-17,s.globalVersion===_l)||(s.globalVersion=_l,!s.isSSR&&s.flags&128&&(!s.deps&&!s._dirty||!If(s))))return;s.flags|=2;const e=s.dep,t=ai,i=rn;ai=s,rn=!0;try{Oy(s);const n=s.fn(s._value);(e.version===0||In(n,s._value))&&(s.flags|=128,s._value=n,e.version++)}catch(n){throw e.version++,n}finally{ai=t,rn=i,By(s),s.flags&=-3}}function ep(s,e=!1){const{dep:t,prevSub:i,nextSub:n}=s;if(i&&(i.nextSub=n,s.prevSub=void 0),n&&(n.prevSub=i,s.nextSub=void 0),t.subs===s&&(t.subs=i,!i&&t.computed)){t.computed.flags&=-5;for(let r=t.computed.deps;r;r=r.nextDep)ep(r,!0)}!e&&!--t.sc&&t.map&&t.map.delete(t.key)}function YS(s){const{prevDep:e,nextDep:t}=s;e&&(e.nextDep=t,s.prevDep=void 0),t&&(t.prevDep=e,s.nextDep=void 0)}let rn=!0;const Dy=[];function dr(){Dy.push(rn),rn=!1}function fr(){const s=Dy.pop();rn=s===void 0?!0:s}function Gp(s){const{cleanup:e}=s;if(s.cleanup=void 0,e){const t=ai;ai=void 0;try{e()}finally{ai=t}}}let _l=0;class $S{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 tp{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(!ai||!rn||ai===this.computed)return;let t=this.activeLink;if(t===void 0||t.sub!==ai)t=this.activeLink=new $S(ai,this),ai.deps?(t.prevDep=ai.depsTail,ai.depsTail.nextDep=t,ai.depsTail=t):ai.deps=ai.depsTail=t,Ny(t);else if(t.version===-1&&(t.version=this.version,t.nextDep)){const i=t.nextDep;i.prevDep=t.prevDep,t.prevDep&&(t.prevDep.nextDep=i),t.prevDep=ai.depsTail,t.nextDep=void 0,ai.depsTail.nextDep=t,ai.depsTail=t,ai.deps===t&&(ai.deps=i)}return t}trigger(e){this.version++,_l++,this.notify(e)}notify(e){Jm();try{for(let t=this.subs;t;t=t.prevSub)t.sub.notify()&&t.sub.dep.notify()}finally{Qm()}}}function Ny(s){if(s.dep.sc++,s.sub.flags&4){const e=s.dep.computed;if(e&&!s.dep.subs){e.flags|=20;for(let i=e.deps;i;i=i.nextDep)Ny(i)}const t=s.dep.subs;t!==s&&(s.prevSub=t,t&&(t.nextSub=s)),s.dep.subs=s}}const ih=new WeakMap,Ta=Symbol(""),Rf=Symbol(""),Tl=Symbol("");function Qi(s,e,t){if(rn&&ai){let i=ih.get(s);i||ih.set(s,i=new Map);let n=i.get(t);n||(i.set(t,n=new tp),n.map=i,n.key=t),n.track()}}function Qn(s,e,t,i,n,r){const a=ih.get(s);if(!a){_l++;return}const o=h=>{h&&h.trigger()};if(Jm(),e==="clear")a.forEach(o);else{const h=ft(s),l=h&&tu(t);if(h&&t==="length"){const c=Number(i);a.forEach((u,d)=>{(d==="length"||d===Tl||!Cs(d)&&d>=c)&&o(u)})}else switch((t!==void 0||a.has(void 0))&&o(a.get(t)),l&&o(a.get(Tl)),e){case"add":h?l&&o(a.get("length")):(o(a.get(Ta)),mo(s)&&o(a.get(Rf)));break;case"delete":h||(o(a.get(Ta)),mo(s)&&o(a.get(Rf)));break;case"set":mo(s)&&o(a.get(Ta));break}}Qm()}function GS(s,e){const t=ih.get(s);return t&&t.get(e)}function ja(s){const e=$t(s);return e===s?e:(Qi(e,"iterate",Tl),Es(s)?e:e.map(hn))}function ru(s){return Qi(s=$t(s),"iterate",Tl),s}function An(s,e){return mr(s)?Ao(cr(s)?hn(e):e):hn(e)}const HS={__proto__:null,[Symbol.iterator](){return Du(this,Symbol.iterator,s=>An(this,s))},concat(...s){return ja(this).concat(...s.map(e=>ft(e)?ja(e):e))},entries(){return Du(this,"entries",s=>(s[1]=An(this,s[1]),s))},every(s,e){return Yn(this,"every",s,e,void 0,arguments)},filter(s,e){return Yn(this,"filter",s,e,t=>t.map(i=>An(this,i)),arguments)},find(s,e){return Yn(this,"find",s,e,t=>An(this,t),arguments)},findIndex(s,e){return Yn(this,"findIndex",s,e,void 0,arguments)},findLast(s,e){return Yn(this,"findLast",s,e,t=>An(this,t),arguments)},findLastIndex(s,e){return Yn(this,"findLastIndex",s,e,void 0,arguments)},forEach(s,e){return Yn(this,"forEach",s,e,void 0,arguments)},includes(...s){return Nu(this,"includes",s)},indexOf(...s){return Nu(this,"indexOf",s)},join(s){return ja(this).join(s)},lastIndexOf(...s){return Nu(this,"lastIndexOf",s)},map(s,e){return Yn(this,"map",s,e,void 0,arguments)},pop(){return Yo(this,"pop")},push(...s){return Yo(this,"push",s)},reduce(s,...e){return Hp(this,"reduce",s,e)},reduceRight(s,...e){return Hp(this,"reduceRight",s,e)},shift(){return Yo(this,"shift")},some(s,e){return Yn(this,"some",s,e,void 0,arguments)},splice(...s){return Yo(this,"splice",s)},toReversed(){return ja(this).toReversed()},toSorted(s){return ja(this).toSorted(s)},toSpliced(...s){return ja(this).toSpliced(...s)},unshift(...s){return Yo(this,"unshift",s)},values(){return Du(this,"values",s=>An(this,s))}};function Du(s,e,t){const i=ru(s),n=i[e]();return i!==s&&!Es(s)&&(n._next=n.next,n.next=()=>{const r=n._next();return r.done||(r.value=t(r.value)),r}),n}const jS=Array.prototype;function Yn(s,e,t,i,n,r){const a=ru(s),o=a!==s&&!Es(s),h=a[e];if(h!==jS[e]){const u=h.apply(s,r);return o?hn(u):u}let l=t;a!==s&&(o?l=function(u,d){return t.call(this,An(s,u),d,s)}:t.length>2&&(l=function(u,d){return t.call(this,u,d,s)}));const c=h.call(a,l,i);return o&&n?n(c):c}function Hp(s,e,t,i){const n=ru(s),r=n!==s&&!Es(s);let a=t,o=!1;n!==s&&(r?(o=i.length===0,a=function(l,c,u){return o&&(o=!1,l=An(s,l)),t.call(this,l,An(s,c),u,s)}):t.length>3&&(a=function(l,c,u){return t.call(this,l,c,u,s)}));const h=n[e](a,...i);return o?An(s,h):h}function Nu(s,e,t){const i=$t(s);Qi(i,"iterate",Tl);const n=i[e](...t);return(n===-1||n===!1)&&au(t[0])?(t[0]=$t(t[0]),i[e](...t)):n}function Yo(s,e,t=[]){dr(),Jm();const i=$t(s)[e].apply(s,t);return Qm(),fr(),i}const WS=qm("__proto__,__v_isRef,__isVue"),Uy=new Set(Object.getOwnPropertyNames(Symbol).filter(s=>s!=="arguments"&&s!=="caller").map(s=>Symbol[s]).filter(Cs));function zS(s){Cs(s)||(s=String(s));const e=$t(this);return Qi(e,"has",s),e.hasOwnProperty(s)}class Xy{constructor(e=!1,t=!1){this._isReadonly=e,this._isShallow=t}get(e,t,i){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 i===(n?r?nM:Gy:r?$y:Yy).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(i)?e:void 0;const a=ft(e);if(!n){let h;if(a&&(h=HS[t]))return h;if(t==="hasOwnProperty")return zS}const o=Reflect.get(e,t,Si(e)?e:i);if((Cs(t)?Uy.has(t):WS(t))||(n||Qi(e,"get",t),r))return o;if(Si(o)){const h=a&&tu(t)?o:o.value;return n&&qt(h)?kf(h):h}return qt(o)?n?kf(o):Da(o):o}}class Vy extends Xy{constructor(e=!1){super(!1,e)}set(e,t,i,n){let r=e[t];const a=ft(e)&&tu(t);if(!this._isShallow){const l=mr(r);if(!Es(i)&&!mr(i)&&(r=$t(r),i=$t(i)),!a&&Si(r)&&!Si(i))return l||(r.value=i),!0}const o=a?Number(t)s,ic=s=>Reflect.getPrototypeOf(s);function QS(s,e,t){return function(...i){const n=this.__v_raw,r=$t(n),a=mo(r),o=s==="entries"||s===Symbol.iterator&&a,h=s==="keys"&&a,l=n[s](...i),c=t?Pf:e?Ao:hn;return!e&&Qi(r,"iterate",h?Rf:Ta),Oi(Object.create(l),{next(){const{value:u,done:d}=l.next();return d?{value:u,done:d}:{value:o?[c(u[0]),c(u[1])]:c(u),done:d}}})}}function sc(s){return function(...e){return s==="delete"?!1:s==="clear"?void 0:this}}function eM(s,e){const t={get(n){const r=this.__v_raw,a=$t(r),o=$t(n);s||(In(n,o)&&Qi(a,"get",n),Qi(a,"get",o));const{has:h}=ic(a),l=e?Pf:s?Ao:hn;if(h.call(a,n))return l(r.get(n));if(h.call(a,o))return l(r.get(o));r!==a&&r.get(n)},get size(){const n=this.__v_raw;return!s&&Qi($t(n),"iterate",Ta),n.size},has(n){const r=this.__v_raw,a=$t(r),o=$t(n);return s||(In(n,o)&&Qi(a,"has",n),Qi(a,"has",o)),n===o?r.has(n):r.has(n)||r.has(o)},forEach(n,r){const a=this,o=a.__v_raw,h=$t(o),l=e?Pf:s?Ao:hn;return!s&&Qi(h,"iterate",Ta),o.forEach((c,u)=>n.call(r,l(c),l(u),a))}};return Oi(t,s?{add:sc("add"),set:sc("set"),delete:sc("delete"),clear:sc("clear")}:{add(n){const r=$t(this),a=ic(r),o=$t(n),h=!e&&!Es(n)&&!mr(n)?o:n;return a.has.call(r,h)||In(n,h)&&a.has.call(r,n)||In(o,h)&&a.has.call(r,o)||(r.add(h),Qn(r,"add",h,h)),this},set(n,r){!e&&!Es(r)&&!mr(r)&&(r=$t(r));const a=$t(this),{has:o,get:h}=ic(a);let l=o.call(a,n);l||(n=$t(n),l=o.call(a,n));const c=h.call(a,n);return a.set(n,r),l?In(r,c)&&Qn(a,"set",n,r):Qn(a,"add",n,r),this},delete(n){const r=$t(this),{has:a,get:o}=ic(r);let h=a.call(r,n);h||(n=$t(n),h=a.call(r,n)),o&&o.call(r,n);const l=r.delete(n);return h&&Qn(r,"delete",n,void 0),l},clear(){const n=$t(this),r=n.size!==0,a=n.clear();return r&&Qn(n,"clear",void 0,void 0),a}}),["keys","values","entries",Symbol.iterator].forEach(n=>{t[n]=QS(n,s,e)}),t}function ip(s,e){const t=eM(s,e);return(i,n,r)=>n==="__v_isReactive"?!s:n==="__v_isReadonly"?s:n==="__v_raw"?i:Reflect.get(zt(t,n)&&n in i?t:i,n,r)}const tM={get:ip(!1,!1)},iM={get:ip(!1,!0)},sM={get:ip(!0,!1)};const Yy=new WeakMap,$y=new WeakMap,Gy=new WeakMap,nM=new WeakMap;function rM(s){switch(s){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function Da(s){return mr(s)?s:sp(s,!1,KS,tM,Yy)}function aM(s){return sp(s,!1,JS,iM,$y)}function kf(s){return sp(s,!0,ZS,sM,Gy)}function sp(s,e,t,i,n){if(!qt(s)||s.__v_raw&&!(e&&s.__v_isReactive)||s.__v_skip||!Object.isExtensible(s))return s;const r=n.get(s);if(r)return r;const a=rM(RS(s));if(a===0)return s;const o=new Proxy(s,a===2?i:t);return n.set(s,o),o}function cr(s){return mr(s)?cr(s.__v_raw):!!(s&&s.__v_isReactive)}function mr(s){return!!(s&&s.__v_isReadonly)}function Es(s){return!!(s&&s.__v_isShallow)}function au(s){return s?!!s.__v_raw:!1}function $t(s){const e=s&&s.__v_raw;return e?$t(e):s}function Dr(s){return!zt(s,"__v_skip")&&Object.isExtensible(s)&&_y(s,"__v_skip",!0),s}const hn=s=>qt(s)?Da(s):s,Ao=s=>qt(s)?kf(s):s;function Si(s){return s?s.__v_isRef===!0:!1}function lt(s){return oM(s,!1)}function oM(s,e){return Si(s)?s:new lM(s,e)}class lM{constructor(e,t){this.dep=new tp,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=t?e:$t(e),this._value=t?e:hn(e),this.__v_isShallow=t}get value(){return this.dep.track(),this._value}set value(e){const t=this._rawValue,i=this.__v_isShallow||Es(e)||mr(e);e=i?e:$t(e),In(e,t)&&(this._rawValue=e,this._value=i?e:hn(e),this.dep.trigger())}}function ke(s){return Si(s)?s.value:s}const cM={get:(s,e,t)=>e==="__v_raw"?s:ke(Reflect.get(s,e,t)),set:(s,e,t,i)=>{const n=s[e];return Si(n)&&!Si(t)?(n.value=t,!0):Reflect.set(s,e,t,i)}};function Hy(s){return cr(s)?s:new Proxy(s,cM)}function hM(s){const e=ft(s)?new Array(s.length):{};for(const t in s)e[t]=dM(s,t);return e}class uM{constructor(e,t,i){this._object=e,this._defaultValue=i,this.__v_isRef=!0,this._value=void 0,this._key=Cs(t)?t:String(t),this._raw=$t(e);let n=!0,r=e;if(!ft(e)||Cs(this._key)||!tu(this._key))do n=!au(r)||Es(r);while(n&&(r=r.__v_raw));this._shallow=n}get value(){let e=this._object[this._key];return this._shallow&&(e=ke(e)),this._value=e===void 0?this._defaultValue:e}set value(e){if(this._shallow&&Si(this._raw[this._key])){const t=this._object[this._key];if(Si(t)){t.value=e;return}}this._object[this._key]=e}get dep(){return GS(this._raw,this._key)}}function dM(s,e,t){return new uM(s,e,t)}class fM{constructor(e,t,i){this.fn=e,this.setter=t,this._value=void 0,this.dep=new tp(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=_l-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!t,this.isSSR=i}notify(){if(this.flags|=16,!(this.flags&8)&&ai!==this)return Fy(this,!0),!0}get value(){const e=this.dep.track();return Ly(this),e&&(e.version=this.dep.version),this._value}set value(e){this.setter&&this.setter(e)}}function mM(s,e,t=!1){let i,n;return Mt(s)?i=s:(i=s.get,n=s.set),new fM(i,n,t)}const nc={},sh=new WeakMap;let ha;function pM(s,e=!1,t=ha){if(t){let i=sh.get(t);i||sh.set(t,i=[]),i.push(s)}}function gM(s,e,t=ti){const{immediate:i,deep:n,once:r,scheduler:a,augmentJob:o,call:h}=t,l=w=>n?w:Es(w)||n===!1||n===0?er(w,1):er(w);let c,u,d,f,p=!1,m=!1;if(Si(s)?(u=()=>s.value,p=Es(s)):cr(s)?(u=()=>l(s),p=!0):ft(s)?(m=!0,p=s.some(w=>cr(w)||Es(w)),u=()=>s.map(w=>{if(Si(w))return w.value;if(cr(w))return l(w);if(Mt(w))return h?h(w,2):w()})):Mt(s)?e?u=h?()=>h(s,2):s:u=()=>{if(d){dr();try{d()}finally{fr()}}const w=ha;ha=c;try{return h?h(s,3,[f]):s(f)}finally{ha=w}}:u=On,e&&n){const w=u,A=n===!0?1/0:n;u=()=>er(w(),A)}const g=Ry(),v=()=>{c.stop(),g&&g.active&&Km(g.effects,c)};if(r&&e){const w=e;e=(...A)=>{const T=w(...A);return v(),T}}let b=m?new Array(s.length).fill(nc):nc;const y=w=>{if(!(!(c.flags&1)||!c.dirty&&!w))if(e){const A=c.run();if(w||n||p||(m?A.some((T,_)=>In(T,b[_])):In(A,b))){d&&d();const T=ha;ha=c;try{const _=[A,b===nc?void 0:m&&b[0]===nc?[]:b,f];b=A,h?h(e,3,_):e(..._)}finally{ha=T}}}else c.run()};return o&&o(y),c=new Py(u),c.scheduler=a?()=>a(y,!1):y,f=w=>pM(w,!1,c),d=c.onStop=()=>{const w=sh.get(c);if(w){if(h)h(w,4);else for(const A of w)A();sh.delete(c)}},e?i?y(!0):b=c.run():a?a(y.bind(null,!0),!0):c.run(),v.pause=c.pause.bind(c),v.resume=c.resume.bind(c),v.stop=v,v}function er(s,e=1/0,t){if(e<=0||!qt(s)||s.__v_skip||(t=t||new Map,(t.get(s)||0)>=e))return s;if(t.set(s,e),e--,Si(s))er(s.value,e,t);else if(ft(s))for(let i=0;i{er(i,e,t)});else if(Sy(s)){for(const i in s)er(s[i],e,t);for(const i of Object.getOwnPropertySymbols(s))Object.prototype.propertyIsEnumerable.call(s,i)&&er(s[i],e,t)}return s}/** * @vue/runtime-core v3.5.41 * (c) 2018-present Yuxi (Evan) You and Vue contributors * @license MIT **/function Yl(s,e,t,i){try{return i?s(...i):s()}catch(n){ou(n,e,t)}}function Vs(s,e,t,i){if(Mt(s)){const n=Yl(s,e,t,i);return n&&by(n)&&n.catch(r=>{ou(r,e,t)}),n}if(ft(s)){const n=[];for(let r=0;r>>1,n=ls[i],r=Al(n);r=Al(t)?ls.push(s):ls.splice(yM(e),0,s),s.flags|=1,Wy()}}function Wy(){nh||(nh=jy.then(qy))}function xM(s){if(!ft(s))Er&&s.id===-1?Er.splice(to+1,0,s):s.flags&1||(po.push(s),s.flags|=1);else for(let e=0;eAl(t)-Al(i));if(po.length=0,Er){for(let t=0;ts.id==null?s.flags&2?-1:1/0:s.id;function qy(s){try{for(bn=0;bn{i._d&&hh(-1);const r=rh(e),a=hr.length;let o;try{o=s(...n)}finally{for(let h=hr.length;h>a;h--)lp();rh(r),i._d&&hh(1)}return o};return i._n=!0,i._c=!0,i._d=!0,i}function ye(s,e){if(is===null)return s;const t=mu(is),i=s.dirs||(s.dirs=[]);for(let n=0;n1)return t&&Mt(e)?e.call(i&&i.proxy):e}}function wM(){return!!(cp()||Aa)}const SM=Symbol.for("v-scx"),MM=()=>dl(SM);function Jo(s,e){return rp(s,null,e)}function fs(s,e,t){return rp(s,e,t)}function rp(s,e,t=ti){const{immediate:i,deep:n,flush:r,once:a}=t,o=Oi({},t),h=e&&i||!e&&r!=="post";let l;if(Pl){if(r==="sync"){const f=MM();l=f.__watcherHandles||(f.__watcherHandles=[])}else if(!h){const f=()=>{};return f.stop=On,f.resume=On,f.pause=On,f}}const c=cs;o.call=(f,p,m)=>Vs(f,c,p,m);let u=!1;r==="post"?o.scheduler=f=>{ms(f,c&&c.suspense)}:r!=="sync"&&(u=!0,o.scheduler=(f,p)=>{p?f():np(f)}),o.augmentJob=f=>{e&&(f.flags|=4),u&&(f.flags|=2,c&&(f.id=c.uid,f.i=c))};const d=gM(s,e,o);return Pl&&(l?l.push(d):h&&d()),d}function _M(s,e,t){const i=this.proxy,n=vi(s)?s.includes(".")?Zy(i,s):()=>i[s]:s.bind(i,i);let r;Mt(e)?r=e:(r=e.handler,t=e);const a=Hl(this),o=rp(n,r.bind(i),t);return a(),o}function Zy(s,e){const t=e.split(".");return()=>{let i=s;for(let n=0;ns.__isTeleport,Ds=Symbol("_leaveCb"),$o=Symbol("_enterCb");function AM(){const s={isMounted:!1,isLeaving:!1,isUnmounting:!1,leavingVNodes:new Map};return Kr(()=>{s.isMounted=!0}),$l(()=>{s.isUnmounting=!0}),s}const Fs=[Function,Array],Jy={mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:Fs,onEnter:Fs,onAfterEnter:Fs,onEnterCancelled:Fs,onBeforeLeave:Fs,onLeave:Fs,onAfterLeave:Fs,onLeaveCancelled:Fs,onBeforeAppear:Fs,onAppear:Fs,onAfterAppear:Fs,onAppearCancelled:Fs},Qy=s=>{const e=s.subTree;return e.component?Qy(e.component):e},EM={name:"BaseTransition",props:Jy,setup(s,{slots:e}){const t=cp(),i=AM();return()=>{const n=e.default&&ix(e.default(),!0),r=n&&n.length?ex(n):t.subTree?Ve():void 0;if(!r)return;const a=$t(s),{mode:o}=a;if(i.isLeaving)return Uu(r);const h=oh(r);if(!h)return Uu(r);let l=Ff(h,a,i,t,u=>l=u);h.type!==ts&&El(h,l);let c=t.subTree&&oh(t.subTree);if(c&&c.type!==ts&&!ga(c,h)&&Qy(t).type!==ts){let u=Ff(c,a,i,t);if(El(c,u),o==="out-in"&&h.type!==ts)return i.isLeaving=!0,u.afterLeave=()=>{i.isLeaving=!1,t.job.flags&8||t.update(),delete u.afterLeave,c=void 0},Uu(r);o==="in-out"&&h.type!==ts?u.delayLeave=(d,f,p)=>{const m=tx(i,c);m[String(c.key)]=c,d[Ds]=()=>{f(),d[Ds]=void 0,delete l.delayedLeave,c=void 0},l.delayedLeave=()=>{p(),delete l.delayedLeave,c=void 0}}:c=void 0}else c&&(c=void 0);return r}}};function ex(s){let e=s[0];if(s.length>1){for(const t of s)if(t.type!==ts){e=t;break}}return e}const CM=EM;function tx(s,e){const{leavingVNodes:t}=s;let i=t.get(e.type);return i||(i=Object.create(null),t.set(e.type,i)),i}function Ff(s,e,t,i,n){const{appear:r,mode:a,persisted:o=!1,onBeforeEnter:h,onEnter:l,onAfterEnter:c,onEnterCancelled:u,onBeforeLeave:d,onLeave:f,onAfterLeave:p,onLeaveCancelled:m,onBeforeAppear:g,onAppear:v,onAfterAppear:b,onAppearCancelled:y}=e,w=String(s.key),A=tx(t,s),T=(P,F)=>{P&&Vs(P,i,9,F)},_=(P,F)=>{const I=F[1];T(P,F),ft(P)?P.every(k=>k.length<=1)&&I():P.length<=1&&I()},R={mode:a,persisted:o,beforeEnter(P){let F=h;if(!t.isMounted)if(r)F=g||h;else return;P[Ds]&&P[Ds](!0);const I=A[w];I&&ga(s,I)&&I.el[Ds]&&I.el[Ds](),T(F,[P])},enter(P){if(A[w]===s)return;let F=l,I=c,k=u;if(!t.isMounted)if(r)F=v||l,I=b||c,k=y||u;else return;let B=!1;P[$o]=U=>{B||(B=!0,U?T(k,[P]):T(I,[P]),R.delayedLeave&&R.delayedLeave(),P[$o]=void 0)};const D=P[$o].bind(null,!1);F?_(F,[P,D]):D()},leave(P,F){const I=String(s.key);if(P[$o]&&P[$o](!0),t.isUnmounting)return F();T(d,[P]);let k=!1;P[Ds]=D=>{k||(k=!0,F(),D?T(m,[P]):T(p,[P]),P[Ds]=void 0,A[I]===s&&delete A[I])};const B=P[Ds].bind(null,!1);A[I]=s,f?_(f,[P,B]):B()},clone(P){const F=Ff(P,e,t,i,n);return n&&n(F),F}};return R}function Uu(s){if(hu(s))return s=Hr(s),s.children=null,s}function oh(s){if(!hu(s))return cu(s.type)&&s.children?ex(s.children):s;if(s.component)return s.component.subTree;const{shapeFlag:e,children:t}=s;if(t){if(e&16)return t[0];if(e&32&&Mt(t.default))return t.default()}}function El(s,e){if(s.shapeFlag&6&&s.component){s.transition=e;const t=s.component.subTree;El(cu(t.type)&&oh(t)||t,e)}else s.shapeFlag&128?(s.ssContent.transition=e.clone(s.ssContent),s.ssFallback.transition=e.clone(s.ssFallback)):s.transition=e}function ix(s,e=!1,t){let i=[],n=0;for(let r=0;r1)for(let r=0;rfl(m,e&&(ft(e)?e[g]:e),t,i,n));return}if(go(i)&&!n){i.shapeFlag&512&&i.type.__asyncResolved&&i.component.subTree.component&&fl(s,e,t,i.component.subTree);return}const r=i.shapeFlag&4?mu(i.component):i.el,a=n?null:r,{i:o,r:h}=s,l=e&&e.r,c=o.refs===ti?o.refs={}:o.refs,u=o.setupState,d=$t(u),f=u===ti?xy:m=>Wp(c,m)?!1:zt(d,m),p=(m,g)=>!(g&&Wp(c,g));if(l!=null&&l!==h){if(zp(e),vi(l))c[l]=null,f(l)&&(u[l]=null);else if(Si(l)){const m=e;p(l,m.k)&&(l.value=null),m.k&&(c[m.k]=null)}}if(Mt(h))Yl(h,o,12,[a,c]);else{const m=vi(h),g=Si(h);if(m||g){const v=()=>{if(s.f){const b=m?f(h)?u[h]:c[h]:p()||!s.k?h.value:c[s.k];if(n)ft(b)&&Km(b,r);else if(ft(b))b.includes(r)||b.push(r);else if(m)c[h]=[r],f(h)&&(u[h]=c[h]);else{const y=[r];p(h,s.k)&&(h.value=y),s.k&&(c[s.k]=y)}}else m?(c[h]=a,f(h)&&(u[h]=a)):g&&(p(h,s.k)&&(h.value=a),s.k&&(c[s.k]=a))};if(a){const b=()=>{v(),lh.delete(s)};b.id=-1,lh.set(s,b),ms(b,t)}else zp(s),v()}}}function zp(s){const e=lh.get(s);e&&(e.flags|=8,lh.delete(s))}nu().requestIdleCallback;nu().cancelIdleCallback;const go=s=>!!s.type.__asyncLoader,hu=s=>s.type.__isKeepAlive;function IM(s,e){nx(s,"a",e)}function RM(s,e){nx(s,"da",e)}function nx(s,e,t=cs){const i=s.__wdc||(s.__wdc=()=>{let n=t;for(;n;){if(n.isDeactivated)return;n=n.parent}return s()});if(uu(e,i,t),t){let n=t.parent;for(;n&&n.parent;)hu(n.parent.vnode)&&PM(i,e,t,n),n=n.parent}}function PM(s,e,t,i){const n=uu(e,s,i,!0);Gl(()=>{Km(i[e],n)},t)}function uu(s,e,t=cs,i=!1){if(t){const n=t[s]||(t[s]=[]),r=e.__weh||(e.__weh=(...a)=>{dr();const o=Hl(t),h=Vs(e,t,s,a);return o(),fr(),h});return i?n.unshift(r):n.push(r),r}}const xr=s=>(e,t=cs)=>{(!Pl||s==="sp")&&uu(s,(...i)=>e(...i),t)},kM=xr("bm"),Kr=xr("m"),FM=xr("bu"),OM=xr("u"),$l=xr("bum"),Gl=xr("um"),BM=xr("sp"),LM=xr("rtg"),DM=xr("rtc");function NM(s,e=cs){uu("ec",s,e)}const UM=Symbol.for("v-ndc");function ci(s,e,t,i){let n;const r=t,a=ft(s);if(a||vi(s)){const o=a&&cr(s);let h=!1,l=!1;o&&(h=!Es(s),l=mr(s),s=ru(s)),n=new Array(s.length);for(let c=0,u=s.length;ce(o,h,void 0,r));else{const o=Object.keys(s);n=new Array(o.length);for(let h=0,l=o.length;h0;return ie(),Jt(Ke,null,[Ue("slot",l,i)],c?-2:64)}let a=s[e];a&&a._c&&(a._d=!1);const o=hr.length;ie();let h;try{const l=a&&rx(a(t)),c=t.key||r||l&&l.key;h=Jt(Ke,{key:(c&&!Cs(c)?c:`_${e}`)+(!l&&i?"_fb":"")},l||(i?i():[]),l&&s._===1?64:-2)}catch(l){for(let c=hr.length;c>o;c--)lp();throw l}finally{a&&a._c&&(a._d=!0)}return h}function rx(s){return s.some(e=>Il(e)?!(e.type===ts||e.type===Ke&&!rx(e.children)):!0)?s:null}const Of=s=>s?Tx(s)?mu(s):Of(s.parent):null,ml=Oi(Object.create(null),{$:s=>s,$el:s=>s.vnode.el,$data:s=>s.data,$props:s=>s.props,$attrs:s=>s.attrs,$slots:s=>s.slots,$refs:s=>s.refs,$parent:s=>Of(s.parent),$root:s=>Of(s.root),$host:s=>s.ce,$emit:s=>s.emit,$options:s=>ox(s),$forceUpdate:s=>s.f||(s.f=()=>{np(s.update)}),$nextTick:s=>s.n||(s.n=lu.bind(s.proxy)),$watch:s=>_M.bind(s)}),Xu=(s,e)=>s!==ti&&!s.__isScriptSetup&&zt(s,e),VM={get({_:s},e){if(e==="__v_skip")return!0;const{ctx:t,setupState:i,data:n,props:r,accessCache:a,type:o,appContext:h}=s;if(e[0]!=="$"){const d=a[e];if(d!==void 0)switch(d){case 1:return i[e];case 2:return n[e];case 4:return t[e];case 3:return r[e]}else{if(Xu(i,e))return a[e]=1,i[e];if(n!==ti&&zt(n,e))return a[e]=2,n[e];if(zt(r,e))return a[e]=3,r[e];if(t!==ti&&zt(t,e))return a[e]=4,t[e];Bf&&(a[e]=0)}}const l=ml[e];let c,u;if(l)return e==="$attrs"&&Qi(s.attrs,"get",""),l(s);if((c=o.__cssModules)&&(c=c[e]))return c;if(t!==ti&&zt(t,e))return a[e]=4,t[e];if(u=h.config.globalProperties,zt(u,e))return u[e]},set({_:s},e,t){const{data:i,setupState:n,ctx:r}=s;return Xu(n,e)?(n[e]=t,!0):i!==ti&&zt(i,e)?(i[e]=t,!0):zt(s.props,e)||e[0]==="$"&&e.slice(1)in s?!1:(r[e]=t,!0)},has({_:{data:s,setupState:e,accessCache:t,ctx:i,appContext:n,props:r,type:a}},o){let h;return!!(t[o]||s!==ti&&o[0]!=="$"&&zt(s,o)||Xu(e,o)||zt(r,o)||zt(i,o)||zt(ml,o)||zt(n.config.globalProperties,o)||(h=a.__cssModules)&&h[o])},defineProperty(s,e,t){return t.get!=null?s._.accessCache[e]=0:zt(t,"value")&&this.set(s,e,t.value,null),Reflect.defineProperty(s,e,t)}};function qp(s){return ft(s)?s.reduce((e,t)=>(e[t]=null,e),{}):s}let Bf=!0;function YM(s){const e=ox(s),t=s.proxy,i=s.ctx;Bf=!1,e.beforeCreate&&Kp(e.beforeCreate,s,"bc");const{data:n,computed:r,methods:a,watch:o,provide:h,inject:l,created:c,beforeMount:u,mounted:d,beforeUpdate:f,updated:p,activated:m,deactivated:g,beforeDestroy:v,beforeUnmount:b,destroyed:y,unmounted:w,render:A,renderTracked:T,renderTriggered:_,errorCaptured:R,serverPrefetch:P,expose:F,inheritAttrs:I,components:k,directives:B,filters:D}=e;if(l&&$M(l,i,null),a)for(const N in a){const O=a[N];Mt(O)&&(i[N]=O.bind(t))}if(n){const N=n.call(t,t);qt(N)&&(s.data=Da(N))}if(Bf=!0,r)for(const N in r){const O=r[N],X=Mt(O)?O.bind(t,t):Mt(O.get)?O.get.bind(t,t):On,E=!Mt(O)&&Mt(O.set)?O.set.bind(t):On,V=vt({get:X,set:E});Object.defineProperty(i,N,{enumerable:!0,configurable:!0,get:()=>V.value,set:q=>V.value=q})}if(o)for(const N in o)ax(o[N],i,t,N);if(h){const N=Mt(h)?h.call(t):h;Reflect.ownKeys(N).forEach(O=>{bM(O,N[O])})}c&&Kp(c,s,"c");function L(N,O){ft(O)?O.forEach(X=>N(X.bind(t))):O&&N(O.bind(t))}if(L(kM,u),L(Kr,d),L(FM,f),L(OM,p),L(IM,m),L(RM,g),L(NM,R),L(DM,T),L(LM,_),L($l,b),L(Gl,w),L(BM,P),ft(F))if(F.length){const N=s.exposed||(s.exposed={});F.forEach(O=>{Object.defineProperty(N,O,{get:()=>t[O],set:X=>t[O]=X,enumerable:!0})})}else s.exposed||(s.exposed={});A&&s.render===On&&(s.render=A),I!=null&&(s.inheritAttrs=I),k&&(s.components=k),B&&(s.directives=B),P&&sx(s)}function $M(s,e,t=On){ft(s)&&(s=Lf(s));for(const i in s){const n=s[i];let r;qt(n)?"default"in n?r=dl(n.from||i,n.default,!0):r=dl(n.from||i):r=dl(n),Si(r)?Object.defineProperty(e,i,{enumerable:!0,configurable:!0,get:()=>r.value,set:a=>r.value=a}):e[i]=r}}function Kp(s,e,t){Vs(ft(s)?s.map(i=>i.bind(e.proxy)):s.bind(e.proxy),e,t)}function ax(s,e,t,i){let n=i.includes(".")?Zy(t,i):()=>t[i];if(vi(s)){const r=e[s];Mt(r)&&fs(n,r)}else if(Mt(s))fs(n,s.bind(t));else if(qt(s))if(ft(s))s.forEach(r=>ax(r,e,t,i));else{const r=Mt(s.handler)?s.handler.bind(t):e[s.handler];Mt(r)&&fs(n,r,s)}}function ox(s){const e=s.type,{mixins:t,extends:i}=e,{mixins:n,optionsCache:r,config:{optionMergeStrategies:a}}=s.appContext,o=r.get(e);let h;return o?h=o:!n.length&&!t&&!i?h=e:(h={},n.length&&n.forEach(l=>ch(h,l,a,!0)),ch(h,e,a)),qt(e)&&r.set(e,h),h}function ch(s,e,t,i=!1){const{mixins:n,extends:r}=e;r&&ch(s,r,t,!0),n&&n.forEach(a=>ch(s,a,t,!0));for(const a in e)if(!(i&&a==="expose")){const o=GM[a]||t&&t[a];s[a]=o?o(s[a],e[a]):e[a]}return s}const GM={data:Zp,props:Jp,emits:Jp,methods:Qo,computed:Qo,beforeCreate:as,created:as,beforeMount:as,mounted:as,beforeUpdate:as,updated:as,beforeDestroy:as,beforeUnmount:as,destroyed:as,unmounted:as,activated:as,deactivated:as,errorCaptured:as,serverPrefetch:as,components:Qo,directives:Qo,watch:jM,provide:Zp,inject:HM};function Zp(s,e){return e?s?function(){return Oi(Mt(s)?s.call(this,this):s,Mt(e)?e.call(this,this):e)}:e:s}function HM(s,e){return Qo(Lf(s),Lf(e))}function Lf(s){if(ft(s)){const e={};for(let t=0;te==="modelValue"||e==="model-value"?s.modelModifiers:s[`${e}Modifiers`]||s[`${nn(e)}Modifiers`]||s[`${qr(e)}Modifiers`];function KM(s,e,...t){if(s.isUnmounted)return;const i=s.vnode.props||ti;let n=t;const r=e.startsWith("update:"),a=r&&qM(i,e.slice(7));a&&(a.trim&&(n=t.map(c=>vi(c)?c.trim():c)),a.number&&(n=t.map(su)));let o,h=i[o=Ou(e)]||i[o=Ou(nn(e))];!h&&r&&(h=i[o=Ou(qr(e))]),h&&Vs(h,s,6,n);const l=i[o+"Once"];if(l){if(!s.emitted)s.emitted={};else if(s.emitted[o])return;s.emitted[o]=!0,Vs(l,s,6,n)}}const ZM=new WeakMap;function cx(s,e,t=!1){const i=t?ZM:e.emitsCache,n=i.get(s);if(n!==void 0)return n;const r=s.emits;let a={},o=!1;if(!Mt(s)){const h=l=>{const c=cx(l,e,!0);c&&(o=!0,Oi(a,c))};!t&&e.mixins.length&&e.mixins.forEach(h),s.extends&&h(s.extends),s.mixins&&s.mixins.forEach(h)}return!r&&!o?(qt(s)&&i.set(s,null),null):(ft(r)?r.forEach(h=>a[h]=null):Oi(a,r),qt(s)&&i.set(s,a),a)}function du(s,e){return!s||!Qh(e)?!1:(e=e.slice(2),e=e==="Once"?e:e.replace(/Once$/,""),zt(s,e[0].toLowerCase()+e.slice(1))||zt(s,qr(e))||zt(s,e))}function Qp(s){const{type:e,vnode:t,proxy:i,withProxy:n,propsOptions:[r],slots:a,attrs:o,emit:h,render:l,renderCache:c,props:u,data:d,setupState:f,ctx:p,inheritAttrs:m}=s,g=rh(s);let v,b;try{if(t.shapeFlag&4){const w=n||i,A=w;v=En(l.call(A,w,c,u,f,d,p)),b=o}else{const w=e;v=En(w.length>1?w(u,{attrs:o,slots:a,emit:h}):w(u,null)),b=e.props?o:JM(o)}}catch(w){hr.length=0,ou(w,s,1),v=Ue(ts)}let y=v;if(b&&m!==!1){const w=Object.keys(b),{shapeFlag:A}=y;w.length&&A&7&&(r&&w.some(eu)&&(b=QM(b,r)),y=Hr(y,b,!1,!0))}if(t.dirs&&(y=Hr(y,null,!1,!0),y.dirs=y.dirs?y.dirs.concat(t.dirs):t.dirs),t.transition){const w=cu(y.type)&&oh(y)||y;El(w,t.transition)}return v=y,rh(g),v}const JM=s=>{let e;for(const t in s)(t==="class"||t==="style"||Qh(t))&&((e||(e={}))[t]=s[t]);return e},QM=(s,e)=>{const t={};for(const i in s)(!eu(i)||!(i.slice(9)in e))&&(t[i]=s[i]);return t};function e_(s,e,t){const{props:i,children:n,component:r}=s,{props:a,children:o,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 i?eg(i,a,l):!!a;if(h&8){const c=e.dynamicProps;for(let u=0;uObject.create(ux),fx=s=>Object.getPrototypeOf(s)===ux;function i_(s,e,t,i=!1){const n={},r=dx();s.propsDefaults=Object.create(null),mx(s,e,n,r);for(const a in s.propsOptions[0])a in n||(n[a]=void 0);t?s.props=i?n:aM(n):s.type.props?s.props=n:s.props=r,s.attrs=r}function s_(s,e,t,i){const{props:n,attrs:r,vnode:{patchFlag:a}}=s,o=$t(n),[h]=s.propsOptions;let l=!1;if((i||a>0)&&!(a&16)){if(a&8){const c=s.vnode.dynamicProps;for(let u=0;u{h=!0;const[d,f]=px(u,e,!0);Oi(a,d),f&&o.push(...f)};!t&&e.mixins.length&&e.mixins.forEach(c),s.extends&&c(s.extends),s.mixins&&s.mixins.forEach(c)}if(!r&&!h)return qt(s)&&i.set(s,fo),fo;if(ft(r))for(let c=0;cs==="_"||s==="_ctx"||s==="$stable",op=s=>ft(s)?s.map(En):[En(s)],r_=(s,e,t)=>{if(e._n)return e;const i=ah((...n)=>op(e(...n)),t);return i._c=!1,i},gx=(s,e,t)=>{const i=s._ctx;for(const n in s){if(ap(n))continue;const r=s[n];if(Mt(r))e[n]=r_(n,r,i);else if(r!=null){const a=op(r);e[n]=()=>a}}},vx=(s,e)=>{const t=op(e);s.slots.default=()=>t},yx=(s,e,t)=>{for(const i in e)(t||!ap(i))&&(s[i]=e[i])},a_=(s,e,t)=>{const i=s.slots=dx();if(s.vnode.shapeFlag&32){const n=e._;n?(yx(i,e,t),t&&_y(i,"_",n,!0)):gx(e,i)}else e&&vx(s,e)},o_=(s,e,t)=>{const{vnode:i,slots:n}=s;let r=!0,a=ti;if(i.shapeFlag&32){const o=e._;o?t&&o===1?r=!1:yx(n,e,t):(r=!e.$stable,gx(e,n)),a=e}else e&&(vx(s,e),a={default:1});if(r)for(const o in n)!ap(o)&&a[o]==null&&delete n[o]},ms=d_;function l_(s){return c_(s)}function c_(s,e){const t=nu();t.__VUE__=!0;const{insert:i,remove:n,patchProp:r,createElement:a,createText:o,createComment:h,setText:l,setElementText:c,parentNode:u,nextSibling:d,setScopeId:f=On,insertStaticContent:p}=s,m=(G,Z,z,j=null,te=null,he=null,xe=void 0,oe=null,ge=!!Z.dynamicChildren)=>{if(G===Z)return;G&&!ga(G,Z)&&(j=me(G),q(G,te,he,!0),G=null),Z.patchFlag===-2&&(ge=!1,Z.dynamicChildren=null);const{type:le,ref:Oe,shapeFlag:Fe}=Z;switch(le){case fu:g(G,Z,z,j);break;case ts:v(G,Z,z,j);break;case Xc:G==null&&b(Z,z,j,xe);break;case Ke:k(G,Z,z,j,te,he,xe,oe,ge);break;default:Fe&1?A(G,Z,z,j,te,he,xe,oe,ge):Fe&6?B(G,Z,z,j,te,he,xe,oe,ge):(Fe&64||Fe&128)&&le.process(G,Z,z,j,te,he,xe,oe,ge,pe)}Oe!=null&&te?fl(Oe,G&&G.ref,he,Z||G,!Z):Oe==null&&G&&G.ref!=null&&fl(G.ref,null,he,G,!0)},g=(G,Z,z,j)=>{if(G==null)i(Z.el=o(Z.children),z,j);else{const te=Z.el=G.el;Z.children!==G.children&&l(te,Z.children)}},v=(G,Z,z,j)=>{G==null?i(Z.el=h(Z.children||""),z,j):Z.el=G.el},b=(G,Z,z,j)=>{[G.el,G.anchor]=p(G.children,Z,z,j,G.el,G.anchor)},y=({el:G,anchor:Z},z,j)=>{let te;for(;G&&G!==Z;)te=d(G),i(G,z,j),G=te;i(Z,z,j)},w=({el:G,anchor:Z})=>{let z;for(;G&&G!==Z;)z=d(G),n(G),G=z;n(Z)},A=(G,Z,z,j,te,he,xe,oe,ge)=>{if(Z.type==="svg"?xe="svg":Z.type==="math"&&(xe="mathml"),G==null)T(Z,z,j,te,he,xe,oe,ge);else{const le=G.el&&G.el._isVueCE?G.el:null;try{le&&le._beginPatch(),P(G,Z,te,he,xe,oe,ge)}finally{le&&le._endPatch()}}},T=(G,Z,z,j,te,he,xe,oe)=>{let ge,le;const{props:Oe,shapeFlag:Fe,transition:Be,dirs:st}=G;if(ge=G.el=a(G.type,he,Oe&&Oe.is,Oe),Fe&8?c(ge,G.children):Fe&16&&R(G.children,ge,null,j,te,Vu(G,he),xe,oe),st&&ia(G,null,j,"created"),_(ge,G,G.scopeId,xe,j),Oe){for(const At in Oe)At!=="value"&&!cl(At)&&r(ge,At,null,Oe[At],he,j);"value"in Oe&&r(ge,"value",null,Oe.value,he),(le=Oe.onVnodeBeforeMount)&&fn(le,j,G)}st&&ia(G,null,j,"beforeMount");const St=h_(te,Be);St&&Be.beforeEnter(ge),i(ge,Z,z),((le=Oe&&Oe.onVnodeMounted)||St||st)&&ms(()=>{try{le&&fn(le,j,G),St&&Be.enter(ge),st&&ia(G,null,j,"mounted")}finally{}},te)},_=(G,Z,z,j,te)=>{if(z&&f(G,z),j)for(let he=0;he{for(let le=ge;le{const oe=Z.el=G.el;let{patchFlag:ge,dynamicChildren:le,dirs:Oe}=Z;ge|=G.patchFlag&16;const Fe=G.props||ti,Be=Z.props||ti;let st;if(z&&sa(z,!1),(st=Be.onVnodeBeforeUpdate)&&fn(st,z,Z,G),Oe&&ia(Z,G,z,"beforeUpdate"),z&&sa(z,!0),le&&(!G.dynamicChildren||G.dynamicChildren.length!==le.length)&&(ge=0,xe=!1,le=null),(Fe.innerHTML&&Be.innerHTML==null||Fe.textContent&&Be.textContent==null)&&c(oe,""),le?F(G.dynamicChildren,le,oe,z,j,Vu(Z,te),he):xe||O(G,Z,oe,null,z,j,Vu(Z,te),he,!1),ge>0){if(ge&16)I(oe,Fe,Be,z,te);else if(ge&2&&Fe.class!==Be.class&&r(oe,"class",null,Be.class,te),ge&4&&r(oe,"style",Fe.style,Be.style,te),ge&8){const St=Z.dynamicProps;for(let At=0;At{st&&fn(st,z,Z,G),Oe&&ia(Z,G,z,"updated")},j)},F=(G,Z,z,j,te,he,xe)=>{for(let oe=0;oe{if(Z!==z){if(Z!==ti)for(const he in Z)!cl(he)&&!(he in z)&&r(G,he,Z[he],null,te,j);for(const he in z){if(cl(he))continue;const xe=z[he],oe=Z[he];xe!==oe&&he!=="value"&&r(G,he,oe,xe,te,j)}"value"in z&&r(G,"value",Z.value,z.value,te)}},k=(G,Z,z,j,te,he,xe,oe,ge)=>{const le=Z.el=G?G.el:o(""),Oe=Z.anchor=G?G.anchor:o("");let{patchFlag:Fe,dynamicChildren:Be,slotScopeIds:st}=Z;st&&(oe=oe?oe.concat(st):st),G==null?(i(le,z,j),i(Oe,z,j),R(Z.children||[],z,Oe,te,he,xe,oe,ge)):Fe>0&&Fe&64&&Be&&G.dynamicChildren&&G.dynamicChildren.length===Be.length?(F(G.dynamicChildren,Be,z,te,he,xe,oe),(Z.key!=null||te&&Z===te.subTree)&&xx(G,Z,!0)):O(G,Z,z,Oe,te,he,xe,oe,ge)},B=(G,Z,z,j,te,he,xe,oe,ge)=>{Z.slotScopeIds=oe,G==null?Z.shapeFlag&512?te.ctx.activate(Z,z,j,xe,ge):D(Z,z,j,te,he,xe,ge):U(G,Z,ge)},D=(G,Z,z,j,te,he,xe)=>{const oe=G.component=y_(G,j,te);if(hu(G)&&(oe.ctx.renderer=pe),x_(oe,!1,xe),oe.asyncDep){if(te&&te.registerDep(oe,L,xe),!G.el){const ge=oe.subTree=Ue(ts);v(null,ge,Z,z),G.placeholder=ge.el}}else L(oe,G,Z,z,te,he,xe)},U=(G,Z,z)=>{const j=Z.component=G.component;if(e_(G,Z,z))if(j.asyncDep&&!j.asyncResolved){N(j,Z,z);return}else j.next=Z,j.update();else Z.el=G.el,j.vnode=Z},L=(G,Z,z,j,te,he,xe)=>{const oe=()=>{if(G.isMounted){let{next:Fe,bu:Be,u:st,parent:St,vnode:At}=G;{const Wi=bx(G);if(Wi){Fe&&(Fe.el=At.el,N(G,Fe,xe)),Wi.asyncDep.then(()=>{ms(()=>{G.isUnmounted||le()},te)});return}}let Et=Fe,It;sa(G,!1),Fe?(Fe.el=At.el,N(G,Fe,xe)):Fe=At,Be&&Uc(Be),(It=Fe.props&&Fe.props.onVnodeBeforeUpdate)&&fn(It,St,Fe,At),sa(G,!0);const Kt=Qp(G),Ti=G.subTree;G.subTree=Kt,m(Ti,Kt,u(Ti.el),me(Ti),G,te,he),Fe.el=Kt.el,Et===null&&t_(G,Kt.el),st&&ms(st,te),(It=Fe.props&&Fe.props.onVnodeUpdated)&&ms(()=>fn(It,St,Fe,At),te)}else{let Fe;const{el:Be,props:st}=Z,{bm:St,m:At,parent:Et,root:It,type:Kt}=G,Ti=go(Z);sa(G,!1),St&&Uc(St),!Ti&&(Fe=st&&st.onVnodeBeforeMount)&&fn(Fe,Et,Z),sa(G,!0);{It.ce&&It.ce._hasShadowRoot()&&It.ce._injectChildStyle(Kt,G.parent?G.parent.type:void 0);const Wi=G.subTree=Qp(G);m(null,Wi,z,j,G,te,he),Z.el=Wi.el}if(At&&ms(At,te),!Ti&&(Fe=st&&st.onVnodeMounted)){const Wi=Z;ms(()=>fn(Fe,Et,Wi),te)}(Z.shapeFlag&256||Et&&go(Et.vnode)&&Et.vnode.shapeFlag&256)&&G.a&&ms(G.a,te),G.isMounted=!0,Z=z=j=null}};G.scope.on();const ge=G.effect=new Py(oe);G.scope.off();const le=G.update=ge.run.bind(ge),Oe=G.job=ge.runIfDirty.bind(ge);Oe.i=G,Oe.id=G.uid,ge.scheduler=()=>np(Oe),sa(G,!0),le()},N=(G,Z,z)=>{Z.component=G;const j=G.vnode.props;G.vnode=Z,G.next=null,s_(G,Z.props,j,z),o_(G,Z.children,z),dr(),jp(G),fr()},O=(G,Z,z,j,te,he,xe,oe,ge=!1)=>{const le=G&&G.children,Oe=G?G.shapeFlag:0,Fe=Z.children,{patchFlag:Be,shapeFlag:st}=Z;if(Be>0){if(Be&128){E(le,Fe,z,j,te,he,xe,oe,ge);return}else if(Be&256){X(le,Fe,z,j,te,he,xe,oe,ge);return}}st&8?(Oe&16&&fe(le,te,he),Fe!==le&&c(z,Fe)):Oe&16?st&16?E(le,Fe,z,j,te,he,xe,oe,ge):fe(le,te,he,!0):(Oe&8&&c(z,""),st&16&&R(Fe,z,j,te,he,xe,oe,ge))},X=(G,Z,z,j,te,he,xe,oe,ge)=>{G=G||fo,Z=Z||fo;const le=G.length,Oe=Z.length,Fe=Math.min(le,Oe);let Be;for(Be=0;BeOe?fe(G,te,he,!0,!1,Fe):R(Z,z,j,te,he,xe,oe,ge,Fe)},E=(G,Z,z,j,te,he,xe,oe,ge)=>{let le=0;const Oe=Z.length;let Fe=G.length-1,Be=Oe-1;for(;le<=Fe&&le<=Be;){const st=G[le],St=Z[le]=ge?Jn(Z[le]):En(Z[le]);if(ga(st,St))m(st,St,z,null,te,he,xe,oe,ge);else break;le++}for(;le<=Fe&&le<=Be;){const st=G[Fe],St=Z[Be]=ge?Jn(Z[Be]):En(Z[Be]);if(ga(st,St))m(st,St,z,null,te,he,xe,oe,ge);else break;Fe--,Be--}if(le>Fe){if(le<=Be){const st=Be+1,St=stBe)for(;le<=Fe;)q(G[le],te,he,!0),le++;else{const st=le,St=le,At=new Map;for(le=St;le<=Be;le++){const di=Z[le]=ge?Jn(Z[le]):En(Z[le]);di.key!=null&&At.set(di.key,le)}let Et,It=0;const Kt=Be-St+1;let Ti=!1,Wi=0;const zi=new Array(Kt);for(le=0;le=Kt){q(di,te,he,!0);continue}let ce;if(di.key!=null)ce=At.get(di.key);else for(Et=St;Et<=Be;Et++)if(zi[Et-St]===0&&ga(di,Z[Et])){ce=Et;break}ce===void 0?q(di,te,he,!0):(zi[ce-St]=le+1,ce>=Wi?Wi=ce:Ti=!0,m(di,Z[ce],z,null,te,he,xe,oe,ge),It++)}const dn=Ti?u_(zi):fo;for(Et=dn.length-1,le=Kt-1;le>=0;le--){const di=St+le,ce=Z[di],de=Z[di+1],Rt=di+1{const{el:he,type:xe,transition:oe,children:ge,shapeFlag:le}=G;if(le&6){V(G.component.subTree,Z,z,j);return}if(le&128){G.suspense.move(Z,z,j);return}if(le&64){xe.move(G,Z,z,pe);return}if(xe===Ke){i(he,Z,z);for(let Fe=0;Feoe.enter(he),te));else{const{leave:Fe,delayLeave:Be,afterLeave:st}=oe,St=()=>{G.ctx.isUnmounted?n(he):i(he,Z,z)},At=()=>{const Et=he._isLeaving||!!he[Ds];he._isLeaving&&he[Ds](!0),oe.persisted&&!Et?St():Fe(he,()=>{St(),st&&st()})};Be?Be(he,St,At):At()}else i(he,Z,z)},q=(G,Z,z,j=!1,te=!1)=>{const{type:he,props:xe,ref:oe,children:ge,dynamicChildren:le,shapeFlag:Oe,patchFlag:Fe,dirs:Be,cacheIndex:st,memo:St}=G;if(Fe===-2&&(te=!1),oe!=null&&(dr(),fl(oe,null,z,G,!0),fr()),st!=null&&(Z.renderCache[st]=void 0),Oe&256){Z.ctx.deactivate(G);return}const At=Oe&1&&Be,Et=!go(G);let It;if(Et&&(It=xe&&xe.onVnodeBeforeUnmount)&&fn(It,Z,G),Oe&6)K(G.component,z,j);else{if(Oe&128){G.suspense.unmount(z,j);return}At&&ia(G,null,Z,"beforeUnmount"),Oe&64?G.type.remove(G,Z,z,pe,j):le&&!le.hasOnce&&(he!==Ke||Fe>0&&Fe&64)?fe(le,Z,z,!1,!0):(he===Ke&&Fe&384||!te&&Oe&16)&&fe(ge,Z,z),j&&W(G)}const Kt=St!=null&&st==null;(Et&&(It=xe&&xe.onVnodeUnmounted)||At||Kt)&&ms(()=>{It&&fn(It,Z,G),At&&ia(G,null,Z,"unmounted"),Kt&&(G.el=null)},z)},W=G=>{const{type:Z,el:z,anchor:j,transition:te}=G;if(Z===Ke){J(z,j);return}if(Z===Xc){w(G);return}const he=()=>{n(z),te&&!te.persisted&&te.afterLeave&&te.afterLeave()};if(G.shapeFlag&1&&te&&!te.persisted){const{leave:xe,delayLeave:oe}=te,ge=()=>xe(z,he);oe?oe(G.el,he,ge):ge()}else he()},J=(G,Z)=>{let z;for(;G!==Z;)z=d(G),n(G),G=z;n(Z)},K=(G,Z,z)=>{const{bum:j,scope:te,job:he,subTree:xe,um:oe,m:ge,a:le}=G;ig(ge),ig(le),j&&Uc(j),te.stop(),he&&(he.flags|=8,q(xe,G,Z,z)),oe&&ms(oe,Z),ms(()=>{G.isUnmounted=!0},Z)},fe=(G,Z,z,j=!1,te=!1,he=0)=>{for(let xe=he;xe{if(G.shapeFlag&6)return me(G.component.subTree);if(G.shapeFlag&128)return G.suspense.next();const Z=d(G.anchor||G.el),z=Z&&Z[TM];return z?d(z):Z};let we=!1;const Ee=(G,Z,z)=>{let j;G==null?Z._vnode&&(q(Z._vnode,null,null,!0),j=Z._vnode.component):m(Z._vnode||null,G,Z,null,null,null,z),Z._vnode=G,we||(we=!0,jp(j),zy(),we=!1)},pe={p:m,um:q,m:V,r:W,mt:D,mc:R,pc:O,pbc:F,n:me,o:s};return{render:Ee,hydrate:void 0,createApp:zM(Ee)}}function Vu({type:s,props:e},t){return t==="svg"&&s==="foreignObject"||t==="mathml"&&s==="annotation-xml"&&e&&e.encoding&&e.encoding.includes("html")?void 0:t}function sa({effect:s,job:e},t){t?(s.flags|=32,e.flags|=4):(s.flags&=-33,e.flags&=-5)}function h_(s,e){return(!s||s&&!s.pendingBranch)&&e&&!e.persisted}function xx(s,e,t=!1){const i=s.children,n=e.children;if(ft(i)&&ft(n))for(let r=0;r>1,s[t[o]]0&&(e[i]=t[r-1]),t[r]=i)}}for(r=t.length,a=t[r-1];r-- >0;)t[r]=a,a=e[a];return t}function bx(s){const e=s.subTree.component;if(e)return e.asyncDep&&!e.asyncResolved?e:bx(e)}function ig(s){if(s)for(let e=0;es.__isSuspense;function d_(s,e){e&&e.pendingBranch?ft(s)?e.effects.push(...s):e.effects.push(s):xM(s)}const Ke=Symbol.for("v-fgt"),fu=Symbol.for("v-txt"),ts=Symbol.for("v-cmt"),Xc=Symbol.for("v-stc"),hr=[];let As=null;function ie(s=!1){hr.push(As=s?null:[])}function lp(){hr.pop(),As=hr[hr.length-1]||null}let Cl=1;function hh(s,e=!1){Cl+=s,s<0&&As&&e&&(As.hasOnce=!0)}function Mx(s){return s.dynamicChildren=Cl>0?As||fo:null,lp(),Cl>0&&As&&As.push(s),s}function ae(s,e,t,i,n,r){return Mx(M(s,e,t,i,n,r,!0))}function Jt(s,e,t,i,n){return Mx(Ue(s,e,t,i,n,!0))}function Il(s){return s?s.__v_isVNode===!0:!1}function ga(s,e){return s.type===e.type&&s.key===e.key}const _x=({key:s})=>s??null,Vc=({ref:s,ref_key:e,ref_for:t})=>(typeof s=="number"&&(s=""+s),s!=null?vi(s)||Si(s)||Mt(s)?{i:is,r:s,k:e,f:!!t}:s:null);function M(s,e=null,t=null,i=0,n=null,r=s===Ke?0:1,a=!1,o=!1){const h={__v_isVNode:!0,__v_skip:!0,type:s,props:e,key:e&&_x(e),ref:e&&Vc(e),scopeId:Ky,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:i,dynamicProps:n,dynamicChildren:null,appContext:null,ctx:is};return o?(uh(h,t),r&128&&s.normalize(h)):t&&(h.shapeFlag|=vi(t)?8:16),Cl>0&&!a&&As&&(h.patchFlag>0||r&6)&&h.patchFlag!==32&&As.push(h),h}const Ue=f_;function f_(s,e=null,t=null,i=0,n=null,r=!1){if((!s||s===UM)&&(s=ts),Il(s)){const o=Hr(s,e,!0);return t&&uh(o,t),Cl>0&&!r&&As&&(o.shapeFlag&6?As[As.indexOf(s)]=o:As.push(o)),o.patchFlag=-2,o}if(M_(s)&&(s=s.__vccOpts),e){e=m_(e);let{class:o,style:h}=e;o&&!vi(o)&&(e.class=Ze(o)),qt(h)&&(au(h)&&!ft(h)&&(h=Oi({},h)),e.style=Li(h))}const a=vi(s)?1:Sx(s)?128:cu(s)?64:qt(s)?4:Mt(s)?2:0;return M(s,e,t,i,n,a,r,!0)}function m_(s){return s?au(s)||fx(s)?Oi({},s):s:null}function Hr(s,e,t=!1,i=!1){const{props:n,ref:r,patchFlag:a,children:o,transition:h}=s,l=e?p_(n||{},e):n,c={__v_isVNode:!0,__v_skip:!0,type:s.type,props:l,key:l&&_x(l),ref:e&&e.ref?t&&r?ft(r)?r.concat(Vc(e)):[r,Vc(e)]:Vc(e):r,scopeId:s.scopeId,slotScopeIds:s.slotScopeIds,children:o,target:s.target,targetStart:s.targetStart,targetAnchor:s.targetAnchor,staticCount:s.staticCount,shapeFlag:s.shapeFlag,patchFlag:e&&s.type!==Ke?a===-1?16:a|16:a,dynamicProps:s.dynamicProps,dynamicChildren:s.dynamicChildren,appContext:s.appContext,dirs:s.dirs,transition:h,component:s.component,suspense:s.suspense,ssContent:s.ssContent&&Hr(s.ssContent),ssFallback:s.ssFallback&&Hr(s.ssFallback),placeholder:s.placeholder,el:s.el,anchor:s.anchor,ctx:s.ctx,ce:s.ce};return h&&i&&El(c,h.clone(c)),c}function Qt(s=" ",e=0){return Ue(fu,null,s,e)}function Ts(s,e){const t=Ue(Xc,null,s);return t.staticCount=e,t}function Ve(s="",e=!1){return e?(ie(),Jt(ts,null,s)):Ue(ts,null,s)}function En(s){return s==null||typeof s=="boolean"?Ue(ts):ft(s)?Ue(Ke,null,s.slice()):Il(s)?Jn(s):Ue(fu,null,String(s))}function Jn(s){return s.el===null&&s.patchFlag!==-1||s.memo?s:Hr(s)}function uh(s,e){let t=0;const{shapeFlag:i}=s;if(e==null)e=null;else if(ft(e))t=16;else if(typeof e=="object")if(i&65){const n=e.default;n&&(n._c&&(n._d=!1),uh(s,n()),n._c&&(n._d=!0));return}else{t=32;const n=e._;!n&&!fx(e)?e._ctx=is:n===3&&is&&(is.slots._===1?e._=1:(e._=2,s.patchFlag|=1024))}else if(Mt(e)){if(i&65){uh(s,{default:e});return}e={default:e,_ctx:is},t=32}else e=String(e),i&64?(t=16,e=[Qt(e)]):t=8;s.children=e,s.shapeFlag|=t}function p_(...s){const e={};for(let t=0;tcs||is;let dh,Rl;{const s=nu(),e=(t,i)=>{let n;return(n=s[t])||(n=s[t]=[]),n.push(i),r=>{n.length>1?n.forEach(a=>a(r)):n[0](r)}};dh=e("__VUE_INSTANCE_SETTERS__",t=>cs=t),Rl=e("__VUE_SSR_SETTERS__",t=>Pl=t)}const Hl=s=>{const e=cs;return dh(s),s.scope.on(),()=>{s.scope.off(),dh(e)}},sg=()=>{cs&&cs.scope.off(),dh(null)};function Tx(s){return s.vnode.shapeFlag&4}let Pl=!1;function x_(s,e=!1,t=!1){e&&Rl(e);const{props:i,children:n}=s.vnode,r=Tx(s);i_(s,i,r,e),a_(s,n,t||e);const a=r?b_(s,e):void 0;return e&&Rl(!1),a}function b_(s,e){const t=s.type;s.accessCache=Object.create(null),s.proxy=new Proxy(s.ctx,VM);const{setup:i}=t;if(i){dr();const n=s.setupContext=i.length>1?S_(s):null,r=Hl(s),a=Yl(i,s,0,[s.props,n]),o=by(a);if(fr(),r(),(o||s.sp)&&!go(s)&&sx(s),o){if(a.then(sg,sg),e)return a.then(h=>{Rl(!0);try{ng(s,h,e)}finally{Rl(!1)}}).catch(h=>{ou(h,s,0)});s.asyncDep=a}else ng(s,a)}else Ax(s)}function ng(s,e,t){Mt(e)?s.type.__ssrInlineRender?s.ssrRender=e:s.render=e:qt(e)&&(s.setupState=Hy(e)),Ax(s)}function Ax(s,e,t){const i=s.type;s.render||(s.render=i.render||On);{const n=Hl(s);dr();try{YM(s)}finally{fr(),n()}}}const w_={get(s,e){return Qi(s,"get",""),s[e]}};function S_(s){const e=t=>{s.exposed=t||{}};return{attrs:new Proxy(s.attrs,w_),slots:s.slots,emit:s.emit,expose:e}}function mu(s){return s.exposed?s.exposeProxy||(s.exposeProxy=new Proxy(Hy(Dr(s.exposed)),{get(e,t){if(t in e)return e[t];if(t in ml)return ml[t](s)},has(e,t){return t in e||t in ml}})):s.proxy}function M_(s){return Mt(s)&&"__vccOpts"in s}const vt=(s,e)=>mM(s,e,Pl);function __(s,e,t){try{hh(-1);const i=arguments.length;return i===2?qt(e)&&!ft(e)?Il(e)?Ue(s,null,[e]):Ue(s,e):Ue(s,null,e):(i>3?t=Array.prototype.slice.call(arguments,2):i===3&&Il(t)&&(t=[t]),Ue(s,e,t))}finally{hh(1)}}const T_="3.5.41";/** * @vue/runtime-dom v3.5.41 * (c) 2018-present Yuxi (Evan) You and Vue contributors * @license MIT **/let Nf;const rg=typeof window<"u"&&window.trustedTypes;if(rg)try{Nf=rg.createPolicy("vue",{createHTML:s=>s})}catch{}const Ex=Nf?s=>Nf.createHTML(s):s=>s,A_="http://www.w3.org/2000/svg",E_="http://www.w3.org/1998/Math/MathML",Wn=typeof document<"u"?document:null,ag=Wn&&Wn.createElement("template"),C_={insert:(s,e,t)=>{e.insertBefore(s,t||null)},remove:s=>{const e=s.parentNode;e&&e.removeChild(s)},createElement:(s,e,t,i)=>{const n=e==="svg"?Wn.createElementNS(A_,s):e==="mathml"?Wn.createElementNS(E_,s):t?Wn.createElement(s,{is:t}):Wn.createElement(s);return s==="select"&&i&&i.multiple!=null&&n.setAttribute("multiple",i.multiple),n},createText:s=>Wn.createTextNode(s),createComment:s=>Wn.createComment(s),setText:(s,e)=>{s.nodeValue=e},setElementText:(s,e)=>{s.textContent=e},parentNode:s=>s.parentNode,nextSibling:s=>s.nextSibling,querySelector:s=>Wn.querySelector(s),setScopeId(s,e){s.setAttribute(e,"")},insertStaticContent(s,e,t,i,n,r){const a=t?t.previousSibling:e.lastChild;if(n&&(n===r||n.nextSibling))for(;e.insertBefore(n.cloneNode(!0),t),!(n===r||!(n=n.nextSibling)););else{ag.innerHTML=Ex(i==="svg"?`${s}`:i==="mathml"?`${s}`:s);const o=ag.content;if(i==="svg"||i==="mathml"){const h=o.firstChild;for(;h.firstChild;)o.appendChild(h.firstChild);o.removeChild(h)}e.insertBefore(o,t)}return[a?a.nextSibling:e.firstChild,t?t.previousSibling:e.lastChild]}},wr="transition",Go="animation",kl=Symbol("_vtc"),Cx={name:String,type:String,css:{type:Boolean,default:!0},duration:[String,Number,Object],enterFromClass:String,enterActiveClass:String,enterToClass:String,appearFromClass:String,appearActiveClass:String,appearToClass:String,leaveFromClass:String,leaveActiveClass:String,leaveToClass:String},I_=Oi({},Jy,Cx),R_=s=>(s.displayName="Transition",s.props=I_,s),P_=R_((s,{slots:e})=>__(CM,k_(s),e)),na=(s,e=[])=>{ft(s)?s.forEach(t=>t(...e)):s&&s(...e)},og=s=>s?ft(s)?s.some(e=>e.length>1):s.length>1:!1;function k_(s){const e={};for(const k in s)k in Cx||(e[k]=s[k]);if(s.css===!1)return e;const{name:t="v",type:i,duration:n,enterFromClass:r=`${t}-enter-from`,enterActiveClass:a=`${t}-enter-active`,enterToClass:o=`${t}-enter-to`,appearFromClass:h=r,appearActiveClass:l=a,appearToClass:c=o,leaveFromClass:u=`${t}-leave-from`,leaveActiveClass:d=`${t}-leave-active`,leaveToClass:f=`${t}-leave-to`}=s,p=F_(n),m=p&&p[0],g=p&&p[1],{onBeforeEnter:v,onEnter:b,onEnterCancelled:y,onLeave:w,onLeaveCancelled:A,onBeforeAppear:T=v,onAppear:_=b,onAppearCancelled:R=y}=e,P=(k,B,D,U)=>{k._enterCancelled=U,ra(k,B?c:o),ra(k,B?l:a),D&&D()},F=(k,B)=>{k._isLeaving=!1,ra(k,u),ra(k,f),ra(k,d),B&&B()},I=k=>(B,D)=>{const U=k?_:b,L=()=>P(B,k,D);na(U,[B,L]),lg(()=>{ra(B,k?h:r),$n(B,k?c:o),og(U)||cg(B,i,m,L)})};return Oi(e,{onBeforeEnter(k){na(v,[k]),$n(k,r),$n(k,a)},onBeforeAppear(k){na(T,[k]),$n(k,h),$n(k,l)},onEnter:I(!1),onAppear:I(!0),onLeave(k,B){k._isLeaving=!0;const D=()=>F(k,B);$n(k,u),k._enterCancelled?($n(k,d),dg(k)):(dg(k),$n(k,d)),lg(()=>{k._isLeaving&&(ra(k,u),$n(k,f),og(w)||cg(k,i,g,D))}),na(w,[k,D])},onEnterCancelled(k){P(k,!1,void 0,!0),na(y,[k])},onAppearCancelled(k){P(k,!0,void 0,!0),na(R,[k])},onLeaveCancelled(k){F(k),na(A,[k])}})}function F_(s){if(s==null)return null;if(qt(s))return[Yu(s.enter),Yu(s.leave)];{const e=Yu(s);return[e,e]}}function Yu(s){return FS(s)}function $n(s,e){e.split(/\s+/).forEach(t=>t&&s.classList.add(t)),(s[kl]||(s[kl]=new Set)).add(e)}function ra(s,e){e.split(/\s+/).forEach(i=>i&&s.classList.remove(i));const t=s[kl];t&&(t.delete(e),t.size||(s[kl]=void 0))}function lg(s){requestAnimationFrame(()=>{requestAnimationFrame(s)})}let O_=0;function cg(s,e,t,i){const n=s._endId=++O_,r=()=>{n===s._endId&&i()};if(t!=null)return setTimeout(r,t);const{type:a,timeout:o,propCount:h}=B_(s,e);if(!a)return i();const l=a+"end";let c=0;const u=()=>{s.removeEventListener(l,d),r()},d=f=>{f.target===s&&++c>=h&&u()};setTimeout(()=>{c(t[p]||"").split(", "),n=i(`${wr}Delay`),r=i(`${wr}Duration`),a=hg(n,r),o=i(`${Go}Delay`),h=i(`${Go}Duration`),l=hg(o,h);let c=null,u=0,d=0;e===wr?a>0&&(c=wr,u=a,d=r.length):e===Go?l>0&&(c=Go,u=l,d=h.length):(u=Math.max(a,l),c=u>0?a>l?wr:Go:null,d=c?c===wr?r.length:h.length:0);const f=c===wr&&/\b(?:transform|all)(?:,|$)/.test(i(`${wr}Property`).toString());return{type:c,timeout:u,propCount:d,hasTransform:f}}function hg(s,e){for(;s.lengthug(t)+ug(s[i])))}function ug(s){return s==="auto"?0:Number(s.slice(0,-1).replace(",","."))*1e3}function dg(s){return(s?s.ownerDocument:document).body.offsetHeight}function L_(s,e,t){const i=s[kl];i&&(e=(e?[e,...i]:[...i]).join(" ")),e==null?s.removeAttribute("class"):t?s.setAttribute("class",e):s.className=e}const fh=Symbol("_vod"),Ix=Symbol("_vsh"),Yi={name:"show",beforeMount(s,{value:e},{transition:t}){s[fh]=s.style.display==="none"?"":s.style.display,t&&e?t.beforeEnter(s):Ho(s,e)},mounted(s,{value:e},{transition:t}){t&&e&&t.enter(s)},updated(s,{value:e,oldValue:t},{transition:i}){!e!=!t&&(i?e?(i.beforeEnter(s),Ho(s,!0),i.enter(s)):i.leave(s,()=>{Ho(s,!1)}):Ho(s,e))},beforeUnmount(s,{value:e}){Ho(s,e)}};function Ho(s,e){s.style.display=e?s[fh]:"none",s[Ix]=!e}const D_=Symbol(""),N_=/(?:^|;)\s*display\s*:/;function U_(s,e,t){const i=s.style,n=vi(t);let r=!1;if(t&&!n){if(e)if(vi(e))for(const a of e.split(";")){const o=a.slice(0,a.indexOf(":")).trim();t[o]==null&&el(i,o,"")}else for(const a in e)t[a]==null&&el(i,a,"");for(const a in t){a==="display"&&(r=!0);const o=t[a];o!=null?V_(s,a,!vi(e)&&e?e[a]:void 0,o)||el(i,a,o):el(i,a,"")}}else if(n){if(e!==t){const a=i[D_];a&&(t+=";"+a),i.cssText=t,r=N_.test(t)}}else e&&s.removeAttribute("style");fh in s&&(s[fh]=r?i.display:"",s[Ix]&&(i.display="none"))}const fg=/\s*!important$/;function el(s,e,t){if(ft(t))t.forEach(i=>el(s,e,i));else if(t==null&&(t=""),e.startsWith("--"))s.setProperty(e,t);else{const i=X_(s,e);fg.test(t)?s.setProperty(qr(i),t.replace(fg,""),"important"):s[i]=t}}const mg=["Webkit","Moz","ms"],$u={};function X_(s,e){const t=$u[e];if(t)return t;let i=nn(e);if(i!=="filter"&&i in s)return $u[e]=i;i=My(i);for(let n=0;nGu||(W_.then(()=>Gu=0),Gu=Date.now());function q_(s,e){const t=i=>{if(!i._vts)i._vts=Date.now();else if(i._vts<=t.attached)return;const n=t.value;if(ft(n)){const r=i.stopImmediatePropagation;i.stopImmediatePropagation=()=>{r.call(i),i._stopped=!0};const a=n.slice(),o=[i];for(let h=0;hs.charCodeAt(0)===111&&s.charCodeAt(1)===110&&s.charCodeAt(2)>96&&s.charCodeAt(2)<123,K_=(s,e,t,i,n,r)=>{const a=n==="svg";e==="class"?L_(s,i,a):e==="style"?U_(s,t,i):Qh(e)?eu(e)||$_(s,e,t,i,r):(e[0]==="."?(e=e.slice(1),!0):e[0]==="^"?(e=e.slice(1),!1):Z_(s,e,i,a))?(vg(s,e,i),!s.tagName.includes("-")&&(e==="value"||e==="checked"||e==="selected")&&gg(s,e,i,a,r,e!=="value")):s._isVueCE&&(J_(s,e)||s._def.__asyncLoader&&(/[A-Z]/.test(e)||!vi(i)))?vg(s,nn(e),i,r,e):(e==="true-value"?s._trueValue=i:e==="false-value"&&(s._falseValue=i),gg(s,e,i,a))};function Z_(s,e,t,i){if(i)return!!(e==="innerHTML"||e==="textContent"||e in s&&xg(e)&&Mt(t));if(e==="spellcheck"||e==="draggable"||e==="translate"||e==="autocorrect"||e==="sandbox"&&s.tagName==="IFRAME"||e==="form"||e==="list"&&s.tagName==="INPUT"||e==="type"&&s.tagName==="TEXTAREA")return!1;if(e==="width"||e==="height"){const n=s.tagName;if(n==="IMG"||n==="VIDEO"||n==="CANVAS"||n==="SOURCE")return!1}return xg(e)&&vi(t)?!1:e in s}function J_(s,e){const t=s._def.props;if(!t)return!1;const i=nn(e);return Array.isArray(t)?t.some(n=>nn(n)===i):Object.keys(t).some(n=>nn(n)===i)}const Eo=s=>{const e=s.props["onUpdate:modelValue"]||!1;return ft(e)?t=>Uc(e,t):e};function Q_(s){s.target.composing=!0}function bg(s){const e=s.target;e.composing&&(e.composing=!1,e.dispatchEvent(new Event("input")))}const Rn=Symbol("_assign"),rc=Symbol("_initialValue");function Hu(s,e,t){return e&&(s=s.trim()),t&&(s=su(s)),s}const ht={created(s,{modifiers:{lazy:e,trim:t,number:i}},n){s.parentNode&&(s.type==="text"?s[rc]=s.defaultValue.replace(/[\r\n]/g,""):s.type==="textarea"&&(s[rc]=s.defaultValue.replace(/\r\n?/g,` `))),s[Rn]=Eo(n);const r=i||n.props&&n.props.type==="number";Fr(s,e?"change":"input",a=>{a.target.composing||s[Rn](Hu(s.value,t,r))}),(t||r)&&Fr(s,"change",()=>{s.value=Hu(s.value,t,r)}),e||(Fr(s,"compositionstart",Q_),Fr(s,"compositionend",bg),Fr(s,"change",bg))},mounted(s,{value:e,modifiers:{trim:t,number:i}}){const n=e??"",r=s[rc];delete s[rc],r!==void 0&&(s.type==="text"||s.type==="textarea")&&s.value!==r?s[Rn](Hu(s.value,t,i)):s.value=n},beforeUpdate(s,{value:e,oldValue:t,modifiers:{lazy:i,trim:n,number:r}},a){if(s[Rn]=Eo(a),s.composing)return;const o=(r||s.type==="number")&&!/^0\d/.test(s.value)?su(s.value):s.value,h=e??"";if(o===h)return;const l=s.getRootNode();(l instanceof Document||l instanceof ShadowRoot)&&l.activeElement===s&&s.type!=="range"&&(i&&e===t||n&&s.value.trim()===h)||(s.value=h)}},ei={deep:!0,created(s,e,t){s[Rn]=Eo(t),Fr(s,"change",()=>{const i=s._modelValue,n=Fl(s),r=s.checked,a=s[Rn];if(ft(i)){const o=Zm(i,n),h=o!==-1;if(r&&!h)a(i.concat(n));else if(!r&&h){const l=[...i];l.splice(o,1),a(l)}}else if(Oo(i)){const o=new Set(i);r?o.add(n):o.delete(n),a(o)}else a(Rx(s,r))})},mounted:wg,beforeUpdate(s,e,t){s[Rn]=Eo(t),wg(s,e,t)}};function wg(s,{value:e,oldValue:t},i){s._modelValue=e;let n;if(ft(e))n=Zm(e,i.props.value)>-1;else if(Oo(e))n=e.has(i.props.value);else{if(e===t)return;n=Bo(e,Rx(s,!0))}s.checked!==n&&(s.checked=n)}const Ht={deep:!0,created(s,{value:e,modifiers:{number:t}},i){s._modelValue=e,Fr(s,"change",()=>{const n=Array.prototype.filter.call(s.options,r=>r.selected).map(r=>t?su(Fl(r)):Fl(r));s[Rn](s.multiple?Oo(s._modelValue)?new Set(n):n:n[0]),s._assigning=!0,lu(()=>{s._assigning=!1})}),s[Rn]=Eo(i)},mounted(s,{value:e}){Sg(s,e)},beforeUpdate(s,{value:e},t){s._modelValue=e,s[Rn]=Eo(t)},updated(s,{value:e}){s._assigning||Sg(s,e)}};function Sg(s,e){const t=s.multiple,i=ft(e);if(!(t&&!i&&!Oo(e))){for(let n=0,r=s.options.length;nString(l)===String(o)):a.selected=Zm(e,o)>-1}else a.selected=e.has(o);else if(Bo(Fl(a),e)){s.selectedIndex!==n&&(s.selectedIndex=n);return}}!t&&s.selectedIndex!==-1&&(s.selectedIndex=-1)}}function Fl(s){return"_value"in s?s._value:s.value}function Rx(s,e){const t=e?"_trueValue":"_falseValue";return t in s?s[t]:e}const eT=["ctrl","shift","alt","meta"],tT={stop:s=>s.stopPropagation(),prevent:s=>s.preventDefault(),self:s=>s.target!==s.currentTarget,ctrl:s=>!s.ctrlKey,shift:s=>!s.shiftKey,alt:s=>!s.altKey,meta:s=>!s.metaKey,left:s=>"button"in s&&s.button!==0,middle:s=>"button"in s&&s.button!==1,right:s=>"button"in s&&s.button!==2,exact:(s,e)=>eT.some(t=>s[`${t}Key`]&&!e.includes(t))},bt=(s,e)=>{if(!s)return s;const t=s._withMods||(s._withMods={}),i=e.join(".");return t[i]||(t[i]=((n,...r)=>{for(let a=0;a{const t=s._withKeys||(s._withKeys={}),i=e.join(".");return t[i]||(t[i]=(n=>{if(!("key"in n))return;const r=qr(n.key);if(e.some(a=>a===r||iT[a]===r))return s(n)}))},sT=Oi({patchProp:K_},C_);let Mg;function nT(){return Mg||(Mg=l_(sT))}const rT=((...s)=>{const e=nT().createApp(...s),{mount:t}=e;return e.mount=i=>{const n=oT(i);if(!n)return;const r=e._component;!Mt(r)&&!r.render&&!r.template&&(r.template=n.innerHTML),n.nodeType===1&&(n.textContent="");const a=t(n,!1,aT(n));return n instanceof Element&&(n.removeAttribute("v-cloak"),n.setAttribute("data-v-app","")),a},e});function aT(s){if(s instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&s instanceof MathMLElement)return"mathml"}function oT(s){return vi(s)?document.querySelector(s):s}/*! * pinia v4.0.3 * (c) 2026 Eduardo San Martin Morote * @license MIT */let Px;const pu=s=>Px=s,kx=Symbol();function _g(s){return s&&typeof s=="object"&&Object.prototype.toString.call(s)==="[object Object]"&&typeof s.toJSON!="function"}function lT(){const s=Iy(!0),e=s.run(()=>lt({}));let t=[],i=[];const n=Dr({install(r){pu(n),n._a=r,r.provide(kx,n),r.config.globalProperties.$pinia=n,i.forEach(a=>t.push(a)),i=[]},use(r){return this._a?t.push(r):i.push(r),this},_p:t,_a:null,_e:s,_s:new Map,state:e});return n}const Uf=()=>{};function Tg(s,e,t,i=Uf){s.add(e);const n=()=>{s.delete(e)&&i()};return!t&&Ry()&&VS(n),n}function Wa(s,...e){s.forEach(t=>{t(...e)})}const cT=s=>s(),Ag=Symbol(),ju=Symbol();function Xf(s,e){s instanceof Map&&e instanceof Map?e.forEach((t,i)=>s.set(i,t)):s instanceof Set&&e instanceof Set&&e.forEach(s.add,s);for(const t in e){if(!Object.hasOwn(e,t))continue;const i=e[t],n=s[t];_g(n)&&_g(i)&&Object.hasOwn(s,t)&&!Si(i)&&!cr(i)?s[t]=Xf(n,i):s[t]=i}return s}const hT=Symbol();function uT(s){return!s||typeof s!="object"||!Object.hasOwn(s,hT)}const{assign:_r}=Object;function dT(s){return!!(Si(s)&&s.effect)}function fT(s,e,t,i){const{state:n,actions:r,getters:a}=e,o=t.state.value[s];let h;function l(){o||(t.state.value[s]=n?n():{});const c=hM(t.state.value[s]);return _r(c,r,Object.keys(a||{}).reduce((u,d)=>(u[d]=Dr(vt(()=>{pu(t);const f=t._s.get(s);return a[d].call(f,f)})),u),{}))}return h=Fx(s,l,e,t,i,!0),h}function Fx(s,e,t={},i,n,r){let a;const o=_r({actions:{}},t),h={deep:!0};let l,c,u=new Set,d=new Set,f;const p=i.state.value[s];!r&&!p&&(i.state.value[s]={});let m;function g(_){let R;l=c=!1,typeof _=="function"?(_(i.state.value[s]),R={type:"patch function",storeId:s,events:f}):(Xf(i.state.value[s],_),R={type:"patch object",payload:_,storeId:s,events:f});const P=m=Symbol();lu().then(()=>{m===P&&(l=!0)}),c=!0,Wa(u,R,i.state.value[s])}const v=r?function(){const{state:R}=t,P=R?R():{};this.$patch(F=>{_r(F,P)})}:Uf;function b(){a.stop(),u.clear(),d.clear(),i._s.delete(s)}const y=(_,R="")=>{if(Ag in _)return _[ju]=R,_;const P=function(){pu(i);const F=Array.from(arguments),I=new Set,k=new Set;function B(L){I.add(L)}function D(L){k.add(L)}Wa(d,{args:F,name:P[ju],store:A,after:B,onError:D});let U;try{U=_.apply(this&&this.$id===s?this:A,F)}catch(L){throw Wa(k,L),L}return U instanceof Promise?U.then(L=>(Wa(I,L),L)).catch(L=>(Wa(k,L),Promise.reject(L))):(Wa(I,U),U)};return P[Ag]=!0,P[ju]=R,P},w={_p:i,$id:s,$onAction:Tg.bind(null,d),$patch:g,$reset:v,$subscribe(_,R={}){if(u.has(_))return Uf;const P=Tg(u,_,R.detached,()=>F()),F=a.run(()=>fs(()=>i.state.value[s],I=>{(R.flush==="sync"?c:l)&&_({storeId:s,type:"direct",events:f},I)},_r({},h,R)));return P},$dispose:b},A=Da(w);i._s.set(s,A);const T=(i._a&&i._a.runWithContext||cT)(()=>i._e.run(()=>(a=Iy()).run(()=>e({action:y}))));for(const _ in T){const R=T[_];Si(R)&&!dT(R)||cr(R)?r||(p&&uT(R)&&(Si(R)?R.value=p[_]:((R instanceof Set||R instanceof Map)&&R.clear(),Xf(R,p[_]))),i.state.value[s][_]=R):typeof R=="function"&&(T[_]=y(R,_),o.actions[_]=R)}return _r(A,T),_r($t(A),T),Object.defineProperty(A,"$state",{get:()=>i.state.value[s],set:_=>{g(R=>{_r(R,_)})}}),i._p.forEach(_=>{const R=a.run(()=>_({store:A,app:i._a,pinia:i,options:o}));_r(A,R)}),p&&r&&t.hydrate&&t.hydrate(A.$state,p),l=!0,c=!0,A}/*! #__NO_SIDE_EFFECTS__ */function mT(s,e,t){let i;const n=typeof e=="function";i=n?t:e;function r(a,o){const h=wM();return a=a||(h?dl(kx,null):null),a&&pu(a),a=Px,a._s.has(s)||(n?Fx(s,e,i,a):fT(s,i,a)),a._s.get(s)}return r.$id=s,r}var Na=(s=>(s[s.WEBGL_LEGACY=0]="WEBGL_LEGACY",s[s.WEBGL=1]="WEBGL",s[s.WEBGL2=2]="WEBGL2",s))(Na||{}),Ox=(s=>(s[s.UNKNOWN=0]="UNKNOWN",s[s.WEBGL=1]="WEBGL",s[s.CANVAS=2]="CANVAS",s))(Ox||{}),Vf=(s=>(s[s.COLOR=16384]="COLOR",s[s.DEPTH=256]="DEPTH",s[s.STENCIL=1024]="STENCIL",s))(Vf||{}),dt=(s=>(s[s.NORMAL=0]="NORMAL",s[s.ADD=1]="ADD",s[s.MULTIPLY=2]="MULTIPLY",s[s.SCREEN=3]="SCREEN",s[s.OVERLAY=4]="OVERLAY",s[s.DARKEN=5]="DARKEN",s[s.LIGHTEN=6]="LIGHTEN",s[s.COLOR_DODGE=7]="COLOR_DODGE",s[s.COLOR_BURN=8]="COLOR_BURN",s[s.HARD_LIGHT=9]="HARD_LIGHT",s[s.SOFT_LIGHT=10]="SOFT_LIGHT",s[s.DIFFERENCE=11]="DIFFERENCE",s[s.EXCLUSION=12]="EXCLUSION",s[s.HUE=13]="HUE",s[s.SATURATION=14]="SATURATION",s[s.COLOR=15]="COLOR",s[s.LUMINOSITY=16]="LUMINOSITY",s[s.NORMAL_NPM=17]="NORMAL_NPM",s[s.ADD_NPM=18]="ADD_NPM",s[s.SCREEN_NPM=19]="SCREEN_NPM",s[s.NONE=20]="NONE",s[s.SRC_OVER=0]="SRC_OVER",s[s.SRC_IN=21]="SRC_IN",s[s.SRC_OUT=22]="SRC_OUT",s[s.SRC_ATOP=23]="SRC_ATOP",s[s.DST_OVER=24]="DST_OVER",s[s.DST_IN=25]="DST_IN",s[s.DST_OUT=26]="DST_OUT",s[s.DST_ATOP=27]="DST_ATOP",s[s.ERASE=26]="ERASE",s[s.SUBTRACT=28]="SUBTRACT",s[s.XOR=29]="XOR",s))(dt||{}),Pn=(s=>(s[s.POINTS=0]="POINTS",s[s.LINES=1]="LINES",s[s.LINE_LOOP=2]="LINE_LOOP",s[s.LINE_STRIP=3]="LINE_STRIP",s[s.TRIANGLES=4]="TRIANGLES",s[s.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",s[s.TRIANGLE_FAN=6]="TRIANGLE_FAN",s))(Pn||{}),Ne=(s=>(s[s.RGBA=6408]="RGBA",s[s.RGB=6407]="RGB",s[s.RG=33319]="RG",s[s.RED=6403]="RED",s[s.RGBA_INTEGER=36249]="RGBA_INTEGER",s[s.RGB_INTEGER=36248]="RGB_INTEGER",s[s.RG_INTEGER=33320]="RG_INTEGER",s[s.RED_INTEGER=36244]="RED_INTEGER",s[s.ALPHA=6406]="ALPHA",s[s.LUMINANCE=6409]="LUMINANCE",s[s.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",s[s.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",s[s.DEPTH_STENCIL=34041]="DEPTH_STENCIL",s))(Ne||{}),vo=(s=>(s[s.TEXTURE_2D=3553]="TEXTURE_2D",s[s.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",s[s.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",s[s.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",s[s.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",s[s.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",s[s.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",s[s.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",s[s.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",s))(vo||{}),et=(s=>(s[s.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",s[s.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",s[s.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",s[s.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",s[s.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",s[s.UNSIGNED_INT=5125]="UNSIGNED_INT",s[s.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",s[s.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",s[s.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",s[s.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",s[s.BYTE=5120]="BYTE",s[s.SHORT=5122]="SHORT",s[s.INT=5124]="INT",s[s.FLOAT=5126]="FLOAT",s[s.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",s[s.HALF_FLOAT=36193]="HALF_FLOAT",s))(et||{}),ze=(s=>(s[s.FLOAT=0]="FLOAT",s[s.INT=1]="INT",s[s.UINT=2]="UINT",s))(ze||{}),sn=(s=>(s[s.NEAREST=0]="NEAREST",s[s.LINEAR=1]="LINEAR",s))(sn||{}),an=(s=>(s[s.CLAMP=33071]="CLAMP",s[s.REPEAT=10497]="REPEAT",s[s.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",s))(an||{}),Ys=(s=>(s[s.OFF=0]="OFF",s[s.POW2=1]="POW2",s[s.ON=2]="ON",s[s.ON_MANUAL=3]="ON_MANUAL",s))(Ys||{}),Ni=(s=>(s[s.NPM=0]="NPM",s[s.UNPACK=1]="UNPACK",s[s.PMA=2]="PMA",s[s.NO_PREMULTIPLIED_ALPHA=0]="NO_PREMULTIPLIED_ALPHA",s[s.PREMULTIPLY_ON_UPLOAD=1]="PREMULTIPLY_ON_UPLOAD",s[s.PREMULTIPLIED_ALPHA=2]="PREMULTIPLIED_ALPHA",s))(Ni||{}),Cn=(s=>(s[s.NO=0]="NO",s[s.YES=1]="YES",s[s.AUTO=2]="AUTO",s[s.BLEND=0]="BLEND",s[s.CLEAR=1]="CLEAR",s[s.BLIT=2]="BLIT",s))(Cn||{}),hp=(s=>(s[s.AUTO=0]="AUTO",s[s.MANUAL=1]="MANUAL",s))(hp||{}),Us=(s=>(s.LOW="lowp",s.MEDIUM="mediump",s.HIGH="highp",s))(Us||{}),Ri=(s=>(s[s.NONE=0]="NONE",s[s.SCISSOR=1]="SCISSOR",s[s.STENCIL=2]="STENCIL",s[s.SPRITE=3]="SPRITE",s[s.COLOR=4]="COLOR",s))(Ri||{}),Ei=(s=>(s[s.NONE=0]="NONE",s[s.LOW=2]="LOW",s[s.MEDIUM=4]="MEDIUM",s[s.HIGH=8]="HIGH",s))(Ei||{}),Bn=(s=>(s[s.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",s[s.ARRAY_BUFFER=34962]="ARRAY_BUFFER",s[s.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",s))(Bn||{});const pT={createCanvas:(s,e)=>{const t=document.createElement("canvas");return t.width=s,t.height=e,t},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(s,e)=>fetch(s,e),parseXML:s=>new DOMParser().parseFromString(s,"text/xml")},We={ADAPTER:pT,RESOLUTION:1,CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1};var Wu=/iPhone/i,Eg=/iPod/i,Cg=/iPad/i,Ig=/\biOS-universal(?:.+)Mac\b/i,zu=/\bAndroid(?:.+)Mobile\b/i,Rg=/Android/i,za=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,ac=/Silk/i,Gn=/Windows Phone/i,Pg=/\bWindows(?:.+)ARM\b/i,kg=/BlackBerry/i,Fg=/BB10/i,Og=/Opera Mini/i,Bg=/\b(CriOS|Chrome)(?:.+)Mobile/i,Lg=/Mobile(?:.+)Firefox\b/i,Dg=function(s){return typeof s<"u"&&s.platform==="MacIntel"&&typeof s.maxTouchPoints=="number"&&s.maxTouchPoints>1&&typeof MSStream>"u"};function gT(s){return function(e){return e.test(s)}}function Ng(s){var e={userAgent:"",platform:"",maxTouchPoints:0};!s&&typeof navigator<"u"?e={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0}:typeof s=="string"?e.userAgent=s:s&&s.userAgent&&(e={userAgent:s.userAgent,platform:s.platform,maxTouchPoints:s.maxTouchPoints||0});var t=e.userAgent,i=t.split("[FBAN");typeof i[1]<"u"&&(t=i[0]),i=t.split("Twitter"),typeof i[1]<"u"&&(t=i[0]);var n=gT(t),r={apple:{phone:n(Wu)&&!n(Gn),ipod:n(Eg),tablet:!n(Wu)&&(n(Cg)||Dg(e))&&!n(Gn),universal:n(Ig),device:(n(Wu)||n(Eg)||n(Cg)||n(Ig)||Dg(e))&&!n(Gn)},amazon:{phone:n(za),tablet:!n(za)&&n(ac),device:n(za)||n(ac)},android:{phone:!n(Gn)&&n(za)||!n(Gn)&&n(zu),tablet:!n(Gn)&&!n(za)&&!n(zu)&&(n(ac)||n(Rg)),device:!n(Gn)&&(n(za)||n(ac)||n(zu)||n(Rg))||n(/\bokhttp\b/i)},windows:{phone:n(Gn),tablet:n(Pg),device:n(Gn)||n(Pg)},other:{blackberry:n(kg),blackberry10:n(Fg),opera:n(Og),firefox:n(Lg),chrome:n(Bg),device:n(kg)||n(Fg)||n(Og)||n(Lg)||n(Bg)},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 vT=Ng.default??Ng,ir=vT(globalThis.navigator);We.RETINA_PREFIX=/@([0-9\.]+)x/;We.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!1;var mh=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Bx(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}function yT(s){if(Object.prototype.hasOwnProperty.call(s,"__esModule"))return s;var e=s.default;if(typeof e=="function"){var t=function i(){return this instanceof i?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(s).forEach(function(i){var n=Object.getOwnPropertyDescriptor(s,i);Object.defineProperty(t,i,n.get?n:{enumerable:!0,get:function(){return s[i]}})}),t}var qu={exports:{}},Ug;function xT(){return Ug||(Ug=1,(function(s){var e=Object.prototype.hasOwnProperty,t="~";function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(t=!1));function n(h,l,c){this.fn=h,this.context=l,this.once=c||!1}function r(h,l,c,u,d){if(typeof c!="function")throw new TypeError("The listener must be a function");var f=new n(c,u||h,d),p=t?t+l:l;return h._events[p]?h._events[p].fn?h._events[p]=[h._events[p],f]:h._events[p].push(f):(h._events[p]=f,h._eventsCount++),h}function a(h,l){--h._eventsCount===0?h._events=new i:delete h._events[l]}function o(){this._events=new i,this._eventsCount=0}o.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},o.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 d=0,f=u.length,p=new Array(f);d80*O){W=K=L[0],J=fe=L[1];for(var pe=O;peK&&(K=me),we>fe&&(fe=we);Ee=Math.max(K-W,fe-J),Ee=Ee!==0?32767/Ee:0}return i(V,q,O,W,J,Ee,0),q}function e(L,N,O,X,E){var V,q;if(E===U(L,N,O,X)>0)for(V=N;V=N;V-=X)q=k(V,L[V],L[V+1],q);return q&&w(q,q.next)&&(B(q),q=q.next),q}function t(L,N){if(!L)return L;N||(N=L);var O=L,X;do if(X=!1,!O.steiner&&(w(O,O.next)||y(O.prev,O,O.next)===0)){if(B(O),O=N=O.prev,O===O.next)break;X=!0}else O=O.next;while(X||O!==N);return N}function i(L,N,O,X,E,V,q){if(L){!q&&V&&f(L,X,E,V);for(var W=L,J,K;L.prev!==L.next;){if(J=L.prev,K=L.next,V?r(L,X,E,V):n(L)){N.push(J.i/O|0),N.push(L.i/O|0),N.push(K.i/O|0),B(L),L=K.next,W=K.next;continue}if(L=K,L===W){q?q===1?(L=a(t(L),N,O),i(L,N,O,X,E,V,2)):q===2&&o(L,N,O,X,E,V):i(t(L),N,O,X,E,V,1);break}}}}function n(L){var N=L.prev,O=L,X=L.next;if(y(N,O,X)>=0)return!1;for(var E=N.x,V=O.x,q=X.x,W=N.y,J=O.y,K=X.y,fe=EV?E>q?E:q:V>q?V:q,Ee=W>J?W>K?W:K:J>K?J:K,pe=X.next;pe!==N;){if(pe.x>=fe&&pe.x<=we&&pe.y>=me&&pe.y<=Ee&&v(E,W,V,J,q,K,pe.x,pe.y)&&y(pe.prev,pe,pe.next)>=0)return!1;pe=pe.next}return!0}function r(L,N,O,X){var E=L.prev,V=L,q=L.next;if(y(E,V,q)>=0)return!1;for(var W=E.x,J=V.x,K=q.x,fe=E.y,me=V.y,we=q.y,Ee=WJ?W>K?W:K:J>K?J:K,G=fe>me?fe>we?fe:we:me>we?me:we,Z=m(Ee,pe,N,O,X),z=m(Ae,G,N,O,X),j=L.prevZ,te=L.nextZ;j&&j.z>=Z&&te&&te.z<=z;){if(j.x>=Ee&&j.x<=Ae&&j.y>=pe&&j.y<=G&&j!==E&&j!==q&&v(W,fe,J,me,K,we,j.x,j.y)&&y(j.prev,j,j.next)>=0||(j=j.prevZ,te.x>=Ee&&te.x<=Ae&&te.y>=pe&&te.y<=G&&te!==E&&te!==q&&v(W,fe,J,me,K,we,te.x,te.y)&&y(te.prev,te,te.next)>=0))return!1;te=te.nextZ}for(;j&&j.z>=Z;){if(j.x>=Ee&&j.x<=Ae&&j.y>=pe&&j.y<=G&&j!==E&&j!==q&&v(W,fe,J,me,K,we,j.x,j.y)&&y(j.prev,j,j.next)>=0)return!1;j=j.prevZ}for(;te&&te.z<=z;){if(te.x>=Ee&&te.x<=Ae&&te.y>=pe&&te.y<=G&&te!==E&&te!==q&&v(W,fe,J,me,K,we,te.x,te.y)&&y(te.prev,te,te.next)>=0)return!1;te=te.nextZ}return!0}function a(L,N,O){var X=L;do{var E=X.prev,V=X.next.next;!w(E,V)&&A(E,X,X.next,V)&&P(E,V)&&P(V,E)&&(N.push(E.i/O|0),N.push(X.i/O|0),N.push(V.i/O|0),B(X),B(X.next),X=L=V),X=X.next}while(X!==L);return t(X)}function o(L,N,O,X,E,V){var q=L;do{for(var W=q.next.next;W!==q.prev;){if(q.i!==W.i&&b(q,W)){var J=I(q,W);q=t(q,q.next),J=t(J,J.next),i(q,N,O,X,E,V,0),i(J,N,O,X,E,V,0);return}W=W.next}q=q.next}while(q!==L)}function h(L,N,O,X){var E=[],V,q,W,J,K;for(V=0,q=N.length;V=O.next.y&&O.next.y!==O.y){var W=O.x+(E-O.y)*(O.next.x-O.x)/(O.next.y-O.y);if(W<=X&&W>V&&(V=W,q=O.x=O.x&&O.x>=K&&X!==O.x&&v(Eq.x||O.x===q.x&&d(q,O)))&&(q=O,me=we)),O=O.next;while(O!==J);return q}function d(L,N){return y(L.prev,L,N.prev)<0&&y(N.next,L,L.next)<0}function f(L,N,O,X){var E=L;do E.z===0&&(E.z=m(E.x,E.y,N,O,X)),E.prevZ=E.prev,E.nextZ=E.next,E=E.next;while(E!==L);E.prevZ.nextZ=null,E.prevZ=null,p(E)}function p(L){var N,O,X,E,V,q,W,J,K=1;do{for(O=L,L=null,V=null,q=0;O;){for(q++,X=O,W=0,N=0;N0||J>0&&X;)W!==0&&(J===0||!X||O.z<=X.z)?(E=O,O=O.nextZ,W--):(E=X,X=X.nextZ,J--),V?V.nextZ=E:L=E,E.prevZ=V,V=E;O=X}V.nextZ=null,K*=2}while(q>1);return L}function m(L,N,O,X,E){return L=(L-O)*E|0,N=(N-X)*E|0,L=(L|L<<8)&16711935,L=(L|L<<4)&252645135,L=(L|L<<2)&858993459,L=(L|L<<1)&1431655765,N=(N|N<<8)&16711935,N=(N|N<<4)&252645135,N=(N|N<<2)&858993459,N=(N|N<<1)&1431655765,L|N<<1}function g(L){var N=L,O=L;do(N.x=(L-q)*(V-W)&&(L-q)*(X-W)>=(O-q)*(N-W)&&(O-q)*(V-W)>=(E-q)*(X-W)}function b(L,N){return L.next.i!==N.i&&L.prev.i!==N.i&&!R(L,N)&&(P(L,N)&&P(N,L)&&F(L,N)&&(y(L.prev,L,N.prev)||y(L,N.prev,N))||w(L,N)&&y(L.prev,L,L.next)>0&&y(N.prev,N,N.next)>0)}function y(L,N,O){return(N.y-L.y)*(O.x-N.x)-(N.x-L.x)*(O.y-N.y)}function w(L,N){return L.x===N.x&&L.y===N.y}function A(L,N,O,X){var E=_(y(L,N,O)),V=_(y(L,N,X)),q=_(y(O,X,L)),W=_(y(O,X,N));return!!(E!==V&&q!==W||E===0&&T(L,O,N)||V===0&&T(L,X,N)||q===0&&T(O,L,X)||W===0&&T(O,N,X))}function T(L,N,O){return N.x<=Math.max(L.x,O.x)&&N.x>=Math.min(L.x,O.x)&&N.y<=Math.max(L.y,O.y)&&N.y>=Math.min(L.y,O.y)}function _(L){return L>0?1:L<0?-1:0}function R(L,N){var O=L;do{if(O.i!==L.i&&O.next.i!==L.i&&O.i!==N.i&&O.next.i!==N.i&&A(O,O.next,L,N))return!0;O=O.next}while(O!==L);return!1}function P(L,N){return y(L.prev,L,L.next)<0?y(L,N,L.next)>=0&&y(L,L.prev,N)>=0:y(L,N,L.prev)<0||y(L,L.next,N)<0}function F(L,N){var O=L,X=!1,E=(L.x+N.x)/2,V=(L.y+N.y)/2;do O.y>V!=O.next.y>V&&O.next.y!==O.y&&E<(O.next.x-O.x)*(V-O.y)/(O.next.y-O.y)+O.x&&(X=!X),O=O.next;while(O!==L);return X}function I(L,N){var O=new D(L.i,L.x,L.y),X=new D(N.i,N.x,N.y),E=L.next,V=N.prev;return L.next=N,N.prev=L,O.next=E,E.prev=O,X.next=O,O.prev=X,V.next=X,X.prev=V,X}function k(L,N,O,X){var E=new D(L,N,O);return X?(E.next=X.next,E.prev=X,X.next.prev=E,X.next=E):(E.prev=E,E.next=E),E}function B(L){L.next.prev=L.prev,L.prev.next=L.next,L.prevZ&&(L.prevZ.nextZ=L.nextZ),L.nextZ&&(L.nextZ.prevZ=L.prevZ)}function D(L,N,O){this.i=L,this.x=N,this.y=O,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}s.deviation=function(L,N,O,X){var E=N&&N.length,V=E?N[0]*O:L.length,q=Math.abs(U(L,0,V,O));if(E)for(var W=0,J=N.length;W0&&(X+=L[E-1].length,O.holes.push(X))}return O},oc.exports}var ST=wT();const MT=Bx(ST);var aa={},tl={exports:{}};/*! https://mths.be/punycode v1.4.1 by @mathias */var _T=tl.exports,Vg;function TT(){return Vg||(Vg=1,(function(s,e){(function(t){var i=e&&!e.nodeType&&e,n=s&&!s.nodeType&&s,r=typeof mh=="object"&&mh;(r.global===r||r.window===r||r.self===r)&&(t=r);var a,o=2147483647,h=36,l=1,c=26,u=38,d=700,f=72,p=128,m="-",g=/^xn--/,v=/[^\x20-\x7E]/,b=/[\x2E\u3002\uFF0E\uFF61]/g,y={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},w=h-l,A=Math.floor,T=String.fromCharCode,_;function R(E){throw new RangeError(y[E])}function P(E,V){for(var q=E.length,W=[];q--;)W[q]=V(E[q]);return W}function F(E,V){var q=E.split("@"),W="";q.length>1&&(W=q[0]+"@",E=q[1]),E=E.replace(b,".");var J=E.split("."),K=P(J,V).join(".");return W+K}function I(E){for(var V=[],q=0,W=E.length,J,K;q=55296&&J<=56319&&q65535&&(V-=65536,q+=T(V>>>10&1023|55296),V=56320|V&1023),q+=T(V),q}).join("")}function B(E){return E-48<10?E-22:E-65<26?E-65:E-97<26?E-97:h}function D(E,V){return E+22+75*(E<26)-((V!=0)<<5)}function U(E,V,q){var W=0;for(E=q?A(E/d):E>>1,E+=A(E/V);E>w*c>>1;W+=h)E=A(E/w);return A(W+(w+1)*E/(E+u))}function L(E){var V=[],q=E.length,W,J=0,K=p,fe=f,me,we,Ee,pe,Ae,G,Z,z,j;for(me=E.lastIndexOf(m),me<0&&(me=0),we=0;we=128&&R("not-basic"),V.push(E.charCodeAt(we));for(Ee=me>0?me+1:0;Ee=q&&R("invalid-input"),Z=B(E.charCodeAt(Ee++)),(Z>=h||Z>A((o-J)/Ae))&&R("overflow"),J+=Z*Ae,z=G<=fe?l:G>=fe+c?c:G-fe,!(ZA(o/j)&&R("overflow"),Ae*=j;W=V.length+1,fe=U(J-pe,W,pe==0),A(J/W)>o-K&&R("overflow"),K+=A(J/W),J%=W,V.splice(J++,0,K)}return k(V)}function N(E){var V,q,W,J,K,fe,me,we,Ee,pe,Ae,G=[],Z,z,j,te;for(E=I(E),Z=E.length,V=p,q=0,K=f,fe=0;fe=V&&AeA((o-q)/z)&&R("overflow"),q+=(me-V)*z,V=me,fe=0;feo&&R("overflow"),Ae==V){for(we=q,Ee=h;pe=Ee<=K?l:Ee>=K+c?c:Ee-K,!(we-1e3&&ce<1e3||T.call(/e/,de))return de;var Rt=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof ce=="number"){var Wt=ce<0?-F(-ce):F(ce);if(Wt!==ce){var Zt=String(Wt),pt=b.call(de,Zt.length+1);return y.call(Zt,Rt,"$&_")+"."+y.call(y.call(pt,/([0-9]{3})/g,"$&_"),/_$/,"")}}return y.call(de,Rt,"$&_")}var X=CT,E=X.custom,V=z(E)?E:null,q={__proto__:null,double:'"',single:"'"},W={__proto__:null,double:/(["\\])/g,single:/(['\\])/g};Zu=function ce(de,Rt,Wt,Zt){var pt=Rt||{};if(he(pt,"quoteStyle")&&!he(q,pt.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(he(pt,"maxStringLength")&&(typeof pt.maxStringLength=="number"?pt.maxStringLength<0&&pt.maxStringLength!==1/0:pt.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var Rs=he(pt,"customInspect")?pt.customInspect:!0;if(typeof Rs!="boolean"&&Rs!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(he(pt,"indent")&&pt.indent!==null&&pt.indent!==" "&&!(parseInt(pt.indent,10)===pt.indent&&pt.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(he(pt,"numericSeparator")&&typeof pt.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var Hs=pt.numericSeparator;if(typeof de>"u")return"undefined";if(de===null)return"null";if(typeof de=="boolean")return de?"true":"false";if(typeof de=="string")return At(de,pt);if(typeof de=="number"){if(de===0)return 1/0/de>0?"0":"-0";var Ui=String(de);return Hs?O(de,Ui):Ui}if(typeof de=="bigint"){var Ps=String(de)+"n";return Hs?O(de,Ps):Ps}var br=typeof pt.depth>"u"?5:pt.depth;if(typeof Wt>"u"&&(Wt=0),Wt>=br&&br>0&&typeof de=="object")return me(de)?"[Array]":"[Object]";var js=zi(pt,Wt);if(typeof Zt>"u")Zt=[];else if(ge(Zt,de)>=0)return"[Circular]";function ss(Me,be,De){if(be&&(Zt=P.call(Zt),Zt.push(be)),De){var Ie={depth:pt.depth};return he(pt,"quoteStyle")&&(Ie.quoteStyle=pt.quoteStyle),ce(Me,Ie,Wt+1,Zt)}return ce(Me,pt,Wt+1,Zt)}if(typeof de=="function"&&!Ee(de)){var $a=oe(de),Ga=di(de,ss);return"[Function"+($a?": "+$a:" (anonymous)")+"]"+(Ga.length>0?" { "+R.call(Ga,", ")+" }":"")}if(z(de)){var Qr=D?y.call(String(de),/^(Symbol\(.*\))_[^)]*$/,"$1"):B.call(de);return typeof de=="object"&&!D?It(Qr):Qr}if(St(de)){for(var Ws="<"+A.call(String(de.nodeName)),ws=de.attributes||[],Vn=0;Vn",Ws}if(me(de)){if(de.length===0)return"[]";var ks=di(de,ss);return js&&!Wi(ks)?"["+dn(ks,js)+"]":"[ "+R.call(ks,", ")+" ]"}if(pe(de)){var ea=di(de,ss);return!("cause"in Error.prototype)&&"cause"in de&&!L.call(de,"cause")?"{ ["+String(de)+"] "+R.call(_.call("[cause]: "+ss(de.cause),ea),", ")+" }":ea.length===0?"["+String(de)+"]":"{ ["+String(de)+"] "+R.call(ea,", ")+" }"}if(typeof de=="object"&&Rs){if(V&&typeof de[V]=="function"&&X)return X(de,{depth:br-Wt});if(Rs!=="symbol"&&typeof de.inspect=="function")return de.inspect()}if(le(de)){var ta=[];return i&&i.call(de,function(Me,be){ta.push(ss(be,de,!0)+" => "+ss(Me,de))}),Ti("Map",t.call(de),ta,js)}if(Be(de)){var H=[];return o&&o.call(de,function(Me){H.push(ss(Me,de))}),Ti("Set",a.call(de),H,js)}if(Oe(de))return Kt("WeakMap");if(st(de))return Kt("WeakSet");if(Fe(de))return Kt("WeakRef");if(G(de))return It(ss(Number(de)));if(j(de))return It(ss(I.call(de)));if(Z(de))return It(p.call(de));if(Ae(de))return It(ss(String(de)));if(typeof window<"u"&&de===window)return"{ [object Window] }";if(typeof globalThis<"u"&&de===globalThis||typeof mh<"u"&&de===mh)return"{ [object globalThis] }";if(!we(de)&&!Ee(de)){var Y=di(de,ss),ee=N?N(de)===Object.prototype:de instanceof Object||de.constructor===Object,ne=de instanceof Object?"":"null prototype",ue=!ee&&U&&Object(de)===de&&U in de?b.call(xe(de),8,-1):ne?"Object":"",ve=ee||typeof de.constructor!="function"?"":de.constructor.name?de.constructor.name+" ":"",_e=ve+(ue||ne?"["+R.call(_.call([],ue||[],ne||[]),": ")+"] ":"");return Y.length===0?_e+"{}":js?_e+"{"+dn(Y,js)+"}":_e+"{ "+R.call(Y,", ")+" }"}return String(de)};function J(ce,de,Rt){var Wt=Rt.quoteStyle||de,Zt=q[Wt];return Zt+ce+Zt}function K(ce){return y.call(String(ce),/"/g,""")}function fe(ce){return!U||!(typeof ce=="object"&&(U in ce||typeof ce[U]<"u"))}function me(ce){return xe(ce)==="[object Array]"&&fe(ce)}function we(ce){return xe(ce)==="[object Date]"&&fe(ce)}function Ee(ce){return xe(ce)==="[object RegExp]"&&fe(ce)}function pe(ce){return xe(ce)==="[object Error]"&&fe(ce)}function Ae(ce){return xe(ce)==="[object String]"&&fe(ce)}function G(ce){return xe(ce)==="[object Number]"&&fe(ce)}function Z(ce){return xe(ce)==="[object Boolean]"&&fe(ce)}function z(ce){if(D)return ce&&typeof ce=="object"&&ce instanceof Symbol;if(typeof ce=="symbol")return!0;if(!ce||typeof ce!="object"||!B)return!1;try{return B.call(ce),!0}catch{}return!1}function j(ce){if(!ce||typeof ce!="object"||!I)return!1;try{return I.call(ce),!0}catch{}return!1}var te=Object.prototype.hasOwnProperty||function(ce){return ce in this};function he(ce,de){return te.call(ce,de)}function xe(ce){return m.call(ce)}function oe(ce){if(ce.name)return ce.name;var de=v.call(g.call(ce),/^function\s*([\w$]+)/);return de?de[1]:null}function ge(ce,de){if(ce.indexOf)return ce.indexOf(de);for(var Rt=0,Wt=ce.length;Rtde.maxStringLength){var Rt=ce.length-de.maxStringLength,Wt="... "+Rt+" more character"+(Rt>1?"s":"");return At(b.call(ce,0,de.maxStringLength),de)+Wt}var Zt=W[de.quoteStyle||"single"];Zt.lastIndex=0;var pt=y.call(y.call(ce,Zt,"\\$1"),/[\x00-\x1f]/g,Et);return J(pt,"single",de)}function Et(ce){var de=ce.charCodeAt(0),Rt={8:"b",9:"t",10:"n",12:"f",13:"r"}[de];return Rt?"\\"+Rt:"\\x"+(de<16?"0":"")+w.call(de.toString(16))}function It(ce){return"Object("+ce+")"}function Kt(ce){return ce+" { ? }"}function Ti(ce,de,Rt,Wt){var Zt=Wt?dn(Rt,Wt):R.call(Rt,", ");return ce+" ("+de+") {"+Zt+"}"}function Wi(ce){for(var de=0;de=0)return!1;return!0}function zi(ce,de){var Rt;if(ce.indent===" ")Rt=" ";else if(typeof ce.indent=="number"&&ce.indent>0)Rt=R.call(Array(ce.indent+1)," ");else return null;return{base:Rt,prev:R.call(Array(de+1),Rt)}}function dn(ce,de){if(ce.length===0)return"";var Rt=` `+de.prev+de.base;return Rt+R.call(ce,","+Rt)+` `+de.prev}function di(ce,de){var Rt=me(ce),Wt=[];if(Rt){Wt.length=ce.length;for(var Zt=0;Zt"u"||!_?s:_(Uint8Array),D={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?s:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?s:ArrayBuffer,"%ArrayIteratorPrototype%":T&&_?_([][Symbol.iterator]()):s,"%AsyncFromSyncIteratorPrototype%":s,"%AsyncFunction%":k,"%AsyncGenerator%":k,"%AsyncGeneratorFunction%":k,"%AsyncIteratorPrototype%":k,"%Atomics%":typeof Atomics>"u"?s:Atomics,"%BigInt%":typeof BigInt>"u"?s:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?s:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?s:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?s:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":t,"%eval%":eval,"%EvalError%":i,"%Float16Array%":typeof Float16Array>"u"?s:Float16Array,"%Float32Array%":typeof Float32Array>"u"?s:Float32Array,"%Float64Array%":typeof Float64Array>"u"?s:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?s:FinalizationRegistry,"%Function%":g,"%GeneratorFunction%":k,"%Int8Array%":typeof Int8Array>"u"?s:Int8Array,"%Int16Array%":typeof Int16Array>"u"?s:Int16Array,"%Int32Array%":typeof Int32Array>"u"?s:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":T&&_?_(_([][Symbol.iterator]())):s,"%JSON%":typeof JSON=="object"?JSON:s,"%Map%":typeof Map>"u"?s:Map,"%MapIteratorPrototype%":typeof Map>"u"||!T||!_?s:_(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":e,"%Object.getOwnPropertyDescriptor%":b,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?s:Promise,"%Proxy%":typeof Proxy>"u"?s:Proxy,"%RangeError%":n,"%ReferenceError%":r,"%Reflect%":typeof Reflect>"u"?s:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?s:Set,"%SetIteratorPrototype%":typeof Set>"u"||!T||!_?s:_(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?s:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":T&&_?_(""[Symbol.iterator]()):s,"%Symbol%":T?Symbol:s,"%SyntaxError%":a,"%ThrowTypeError%":A,"%TypedArray%":B,"%TypeError%":o,"%Uint8Array%":typeof Uint8Array>"u"?s:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?s:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?s:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?s:Uint32Array,"%URIError%":h,"%WeakMap%":typeof WeakMap>"u"?s:WeakMap,"%WeakRef%":typeof WeakRef>"u"?s:WeakRef,"%WeakSet%":typeof WeakSet>"u"?s:WeakSet,"%Function.prototype.call%":I,"%Function.prototype.apply%":F,"%Object.defineProperty%":y,"%Object.getPrototypeOf%":R,"%Math.abs%":l,"%Math.floor%":c,"%Math.max%":u,"%Math.min%":d,"%Math.pow%":f,"%Math.round%":p,"%Math.sign%":m,"%Reflect.getPrototypeOf%":P};if(_)try{null.error}catch(Ee){var U=_(_(Ee));D["%Error.prototype%"]=U}var L=function Ee(pe){var Ae;if(pe==="%AsyncFunction%")Ae=v("async function () {}");else if(pe==="%GeneratorFunction%")Ae=v("function* () {}");else if(pe==="%AsyncGeneratorFunction%")Ae=v("async function* () {}");else if(pe==="%AsyncGenerator%"){var G=Ee("%AsyncGeneratorFunction%");G&&(Ae=G.prototype)}else if(pe==="%AsyncIteratorPrototype%"){var Z=Ee("%AsyncGenerator%");Z&&_&&(Ae=_(Z.prototype))}return D[pe]=Ae,Ae},N={__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"]},O=vu(),X=JT(),E=O.call(I,Array.prototype.concat),V=O.call(F,Array.prototype.splice),q=O.call(I,String.prototype.replace),W=O.call(I,String.prototype.slice),J=O.call(I,RegExp.prototype.exec),K=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,fe=/\\(\\)?/g,me=function(pe){var Ae=W(pe,0,1),G=W(pe,-1);if(Ae==="%"&&G!=="%")throw new a("invalid intrinsic syntax, expected closing `%`");if(G==="%"&&Ae!=="%")throw new a("invalid intrinsic syntax, expected opening `%`");var Z=[];return q(pe,K,function(z,j,te,he){Z[Z.length]=te?q(he,fe,"$1"):j||z}),Z},we=function(pe,Ae){var G=pe,Z;if(X(N,G)&&(Z=N[G],G="%"+Z[0]+"%"),X(D,G)){var z=D[G];if(z===k&&(z=L(G)),typeof z>"u"&&!Ae)throw new o("intrinsic "+pe+" exists, but is not available. Please file an issue!");return{alias:Z,name:G,value:z}}throw new a("intrinsic "+pe+" does not exist!")};return Pd=function(pe,Ae){if(typeof pe!="string"||pe.length===0)throw new o("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof Ae!="boolean")throw new o('"allowMissing" argument must be a boolean');if(J(/^%?[^%]*%?$/,pe)===null)throw new a("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var G=me(pe),Z=G.length>0?G[0]:"",z=we("%"+Z+"%",Ae),j=z.name,te=z.value,he=!1,xe=z.alias;xe&&(Z=xe[0],V(G,E([0,1],xe)));for(var oe=1,ge=!0;oe=G.length){var Be=b(te,le);ge=!!Be,ge&&"get"in Be&&!("originalValue"in Be.get)?te=Be.get:te=te[le]}else ge=X(te,le),te=te[le];ge&&!he&&(D[j]=te)}}return te},Pd}var kd,_0;function $x(){if(_0)return kd;_0=1;var s=dp(),e=Yx(),t=e([s("%String.prototype.indexOf%")]);return kd=function(n,r){var a=s(n,!!r);return typeof a=="function"&&t(n,".prototype.")>-1?e([a]):a},kd}var Fd,T0;function Gx(){if(T0)return Fd;T0=1;var s=dp(),e=$x(),t=gu(),i=Lo(),n=s("%Map%",!0),r=e("Map.prototype.get",!0),a=e("Map.prototype.set",!0),o=e("Map.prototype.has",!0),h=e("Map.prototype.delete",!0),l=e("Map.prototype.size",!0);return Fd=!!n&&function(){var u,d={assert:function(f){if(!d.has(f))throw new i("Side channel does not contain "+t(f))},delete:function(f){if(u){var p=h(u,f);return l(u)===0&&(u=void 0),p}return!1},get:function(f){if(u)return r(u,f)},has:function(f){return u?o(u,f):!1},set:function(f,p){u||(u=new n),a(u,f,p)}};return d},Fd}var Od,A0;function QT(){if(A0)return Od;A0=1;var s=dp(),e=$x(),t=gu(),i=Gx(),n=Lo(),r=s("%WeakMap%",!0),a=e("WeakMap.prototype.get",!0),o=e("WeakMap.prototype.set",!0),h=e("WeakMap.prototype.has",!0),l=e("WeakMap.prototype.delete",!0);return Od=r?function(){var u,d,f={assert:function(p){if(!f.has(p))throw new n("Side channel does not contain "+t(p))},delete:function(p){if(r&&p&&(typeof p=="object"||typeof p=="function")){if(u)return l(u,p)}else if(i&&d)return d.delete(p);return!1},get:function(p){return r&&p&&(typeof p=="object"||typeof p=="function")&&u?a(u,p):d&&d.get(p)},has:function(p){return r&&p&&(typeof p=="object"||typeof p=="function")&&u?h(u,p):!!d&&d.has(p)},set:function(p,m){r&&p&&(typeof p=="object"||typeof p=="function")?(u||(u=new r),o(u,p,m)):i&&(d||(d=i()),d.set(p,m))}};return f}:i,Od}var Bd,E0;function Hx(){if(E0)return Bd;E0=1;var s=Lo(),e=gu(),t=IT(),i=Gx(),n=QT(),r=n||i||t;return Bd=function(){var o,h={assert:function(l){if(!h.has(l)){var c=l&&Object(l)===l?"the given object key":e(l);throw new s("Side channel does not contain "+c)}},delete:function(l){return!!o&&o.delete(l)},get:function(l){return o&&o.get(l)},has:function(l){return!!o&&o.has(l)},set:function(l,c){o||(o=r()),o.set(l,c)}};return h},Bd}var Ld,C0;function fp(){if(C0)return Ld;C0=1;var s=String.prototype.replace,e=/%20/g,t={RFC1738:"RFC1738",RFC3986:"RFC3986"};return Ld={default:t.RFC3986,formatters:{RFC1738:function(i){return s.call(i,e,"+")},RFC3986:function(i){return String(i)}},RFC1738:t.RFC1738,RFC3986:t.RFC3986},Ld}var Dd,I0;function jx(){if(I0)return Dd;I0=1;var s=fp(),e=Hx(),t=Nx(),i=Object.prototype.hasOwnProperty,n=Array.isArray,r=e(),a=function(P,F){return r.set(P,F),P},o=function(P){return r.has(P)},h=function(P){return r.get(P)},l=function(P,F){r.set(P,F)},c=(function(){for(var R=[],P=0;P<256;++P)R[R.length]="%"+((P<16?"0":"")+P.toString(16)).toUpperCase();return R})(),u=function(P){for(;P.length>1;){var F=P.pop(),I=F.obj[F.prop];if(n(I)){for(var k=[],B=0;B=I.arrayLimit){if(I.throwOnLimitExceeded)throw new RangeError("Array limit exceeded. Only "+I.arrayLimit+" element"+(I.arrayLimit===1?"":"s")+" allowed in an array.");return a(d(P.concat(F),I),k)}P[k]=F}else if(P&&typeof P=="object")if(o(P)){var B=h(P)+1;P[B]=F,l(P,B)}else{if(I&&I.strictMerge)return[P,F];(I&&(I.plainObjects||I.allowPrototypes)||!i.call(Object.prototype,F))&&(P[F]=!0)}else return[P,F];return P}if(!P||typeof P!="object"){if(o(F)){for(var D=Object.keys(F),U=I&&I.plainObjects?{__proto__:null,0:P}:{0:P},L=0;LI.arrayLimit){if(I.throwOnLimitExceeded)throw new RangeError("Array limit exceeded. Only "+I.arrayLimit+" element"+(I.arrayLimit===1?"":"s")+" allowed in an array.");return a(d(O,I),O.length-1)}return O}var X=P;if(n(P)&&!n(F)&&(X=d(P,I)),n(P)&&n(F)){if(F.forEach(function(E,V){if(i.call(P,V)){var q=P[V];q&&typeof q=="object"&&E&&typeof E=="object"?P[V]=R(q,E,I):P[P.length]=E}else P[V]=E}),I&&typeof I.arrayLimit=="number"&&P.length>I.arrayLimit){if(I.throwOnLimitExceeded)throw new RangeError("Array limit exceeded. Only "+I.arrayLimit+" element"+(I.arrayLimit===1?"":"s")+" allowed in an array.");return a(d(P,I),P.length-1)}return P}return Object.keys(F).reduce(function(E,V){var q=F[V];if(i.call(E,V)?f(E,V,R(E[V],q,I)):f(E,V,q),o(F)&&!o(E)&&a(E,h(F)),o(E)){var W=parseInt(V,10);String(W)===V&&W>=0&&W>h(E)&&l(E,W)}return E},X)},m=function(P,F){return Object.keys(F).reduce(function(I,k){return f(I,k,F[k]),I},P)},g=function(R,P,F){var I=R.replace(/\+/g," ");if(F==="iso-8859-1")return I.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(I)}catch{return I}},v=1024,b=function(P,F,I,k,B){if(P.length===0)return P;var D=P;if(typeof P=="symbol"?D=Symbol.prototype.toString.call(P):typeof P!="string"&&(D=String(P)),I==="iso-8859-1")return escape(D).replace(/%u[0-9a-f]{4}/gi,function(q){return"%26%23"+parseInt(q.slice(2),16)+"%3B"});for(var U="",L=0;L=v?D.slice(L,L+v):D;if(L+v=55296&&O<=56319&&(N=N.slice(0,-1),L-=1)}for(var X=[],E=0;E=48&&V<=57||V>=65&&V<=90||V>=97&&V<=122||B===s.RFC1738&&(V===40||V===41)){X[X.length]=N.charAt(E);continue}if(V<128){X[X.length]=c[V];continue}if(V<2048){X[X.length]=c[192|V>>6]+c[128|V&63];continue}if(V<55296||V>=57344){X[X.length]=c[224|V>>12]+c[128|V>>6&63]+c[128|V&63];continue}E+=1,V=65536+((V&1023)<<10|N.charCodeAt(E)&1023),X[X.length]=c[240|V>>18]+c[128|V>>12&63]+c[128|V>>6&63]+c[128|V&63]}U+=X.join("")}return U},y=function(P){for(var F=[{obj:{o:P},prop:"o"}],I=e(),k=0;kI){if(B)throw new RangeError("Array limit exceeded. Only "+I+" element"+(I===1?"":"s")+" allowed in an array.");return a(d(U,{plainObjects:k}),U.length-1)}return U},_=function(P,F){if(n(P)){for(var I=[],k=0;k"u"&&(E=0)}if(typeof P=="function"?O=P(v,O):O instanceof Date?O=k(O):b==="comma"&&r(O)&&(O=e.maybeMap(O,function(j){return j instanceof Date?k(j):j})),O===null){if(A)return D(R&&!U?R(v,c.encoder,L,"key",B):v);O=""}if(u(O)||e.isBuffer(O)){if(R){var W=U?v:R(v,c.encoder,L,"key",B);return[D(W)+"="+D(R(O,c.encoder,L,"value",B))]}return[D(v)+"="+D(String(O))]}var J=[];if(typeof O>"u")return J;var K;if(b==="comma"&&r(O))U&&R&&(O=e.maybeMap(O,function(j){return j==null?j:R(j)})),K=[{value:O.length>0?O.join(",")||null:void 0}];else if(r(P))K=P;else{var fe=Object.keys(O);K=F?fe.sort(F):fe}var me=_?String(v).replace(/\./g,"%2E"):String(v),we=y&&r(O)&&O.length===1?me+"[]":me;if(w&&r(O)&&O.length===0)return we+"[]";for(var Ee=0;Ee"u"?g.encodeDotInKeys===!0?!0:c.allowDots:!!g.allowDots;return{addQueryPrefix:typeof g.addQueryPrefix=="boolean"?g.addQueryPrefix:c.addQueryPrefix,allowDots:T,allowEmptyArrays:typeof g.allowEmptyArrays=="boolean"?!!g.allowEmptyArrays:c.allowEmptyArrays,arrayFormat:A,charset:v,charsetSentinel:typeof g.charsetSentinel=="boolean"?g.charsetSentinel:c.charsetSentinel,commaRoundTrip:!!g.commaRoundTrip,delimiter:typeof g.delimiter>"u"?c.delimiter:g.delimiter,encode:typeof g.encode=="boolean"?g.encode:c.encode,encodeDotInKeys:typeof g.encodeDotInKeys=="boolean"?g.encodeDotInKeys:c.encodeDotInKeys,encoder:typeof g.encoder=="function"?g.encoder:c.encoder,encodeValuesOnly:typeof g.encodeValuesOnly=="boolean"?g.encodeValuesOnly:c.encodeValuesOnly,filter:w,format:b,formatter:y,serializeDate:typeof g.serializeDate=="function"?g.serializeDate:c.serializeDate,skipNulls:typeof g.skipNulls=="boolean"?g.skipNulls:c.skipNulls,sort:typeof g.sort=="function"?g.sort:null,strictNullHandling:typeof g.strictNullHandling=="boolean"?g.strictNullHandling:c.strictNullHandling}};return Nd=function(m,g){var v=m,b=p(g),y,w;typeof b.filter=="function"?(w=b.filter,v=w("",v)):r(b.filter)&&(w=b.filter,y=w);var A=[];if(typeof v!="object"||v===null)return"";var T=n[b.arrayFormat],_=T==="comma"&&b.commaRoundTrip;y||(y=Object.keys(v)),b.sort&&y.sort(b.sort);for(var R=s(),P=0;P"u"||F===null)){var I=v[F];b.skipNulls&&I===null||o(A,f(I,F,T,_,b.allowEmptyArrays,b.strictNullHandling,b.skipNulls,b.encodeDotInKeys,b.encode?b.encoder:null,b.filter,b.sort,b.allowDots,b.serializeDate,b.format,b.formatter,b.encodeValuesOnly,b.charset,R))}}var k=A.join(b.delimiter),B=b.addQueryPrefix===!0?"?":"";return b.charsetSentinel&&(b.charset==="iso-8859-1"?B+="utf8=%26%2310003%3B"+b.delimiter:B+="utf8=%E2%9C%93"+b.delimiter),k.length>0?B+k:""},Nd}var Ud,P0;function tA(){if(P0)return Ud;P0=1;var s=jx(),e=Object.prototype.hasOwnProperty,t=Array.isArray,i={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:s.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(f){return f.replace(/&#(\d+);/g,function(p,m){return String.fromCharCode(parseInt(m,10))})},r=function(f,p,m,g){if(f&&typeof f=="string"&&p.comma&&f.indexOf(",")>-1){if(g&&p.throwOnLimitExceeded)for(var v=0,b=f.indexOf(",");b>-1;){if(v+=1,v>=p.arrayLimit)throw new RangeError("Array limit exceeded. Only "+p.arrayLimit+" element"+(p.arrayLimit===1?"":"s")+" allowed in an array.");b=f.indexOf(",",b+1)}return f.split(",")}if(p.throwOnLimitExceeded&&m>=p.arrayLimit)throw new RangeError("Array limit exceeded. Only "+p.arrayLimit+" element"+(p.arrayLimit===1?"":"s")+" allowed in an array.");return f},a="utf8=%26%2310003%3B",o="utf8=%E2%9C%93",h=function(p,m){var g={__proto__:null},v=m.ignoreQueryPrefix?p.replace(/^\?/,""):p;v=v.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var b=m.parameterLimit===1/0?void 0:m.parameterLimit,y=v.split(m.delimiter,m.throwOnLimitExceeded&&typeof b<"u"?b+1:b);if(m.throwOnLimitExceeded&&typeof b<"u"&&y.length>b)throw new RangeError("Parameter limit exceeded. Only "+b+" parameter"+(b===1?"":"s")+" allowed.");var w=-1,A,T=m.charset;if(m.charsetSentinel)for(A=0;A-1&&(I=t(I)?[I]:I),m.comma&&t(I)&&I.length>m.arrayLimit&&(I=s.combine([],I,m.arrayLimit,m.plainObjects,m.throwOnLimitExceeded)),F!==null){var k=e.call(g,F);k&&(m.duplicates==="combine"||_.indexOf("[]=")>-1)?g[F]=s.combine(g[F],I,m.arrayLimit,m.plainObjects,m.throwOnLimitExceeded):(!k||m.duplicates==="last")&&(g[F]=I)}}return g},l=function(f,p,m,g){var v=0;if(f.length>0&&f[f.length-1]==="[]"){var b=f.slice(0,-1).join("");v=Array.isArray(p)&&p[b]?p[b].length:0}for(var y=g?p:r(p,m,v),w=f.length-1;w>=0;--w){var A,T=f[w];if(T==="[]"&&m.parseArrays)s.isOverflow(y)?A=y:A=m.allowEmptyArrays&&(y===""||m.strictNullHandling&&y===null)?[]:s.combine([],y,m.arrayLimit,m.plainObjects,m.throwOnLimitExceeded);else{A=m.plainObjects?{__proto__:null}:{};var _=T.charAt(0)==="["&&T.charAt(T.length-1)==="]"?T.slice(1,-1):T,R=m.decodeDotInKeys?_.replace(/%2E/g,"."):_,P=parseInt(R,10),F=!isNaN(P)&&T!==R&&String(P)===R&&P>=0&&m.parseArrays;if(!m.parseArrays&&R==="")A={0:y};else if(F&&P=0?g.slice(0,b):g;if(y){if(!m.plainObjects&&e.call(Object.prototype,y)&&!m.allowPrototypes)return;v[v.length]=y}for(var w=g.length,A=b,T=0;A>=0&&T=0){if(m.strictDepth===!0)throw new RangeError("Input depth exceeded depth option of "+m.depth+" and strictDepth is true");v[v.length]="["+g.slice(A)+"]"}return v},u=function(p,m,g,v){if(p){var b=c(p,g);if(b)return l(b,m,g,v)}},d=function(p){if(!p)return i;if(typeof p.allowEmptyArrays<"u"&&typeof p.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof p.decodeDotInKeys<"u"&&typeof p.decodeDotInKeys!="boolean")throw new TypeError("`decodeDotInKeys` option can only be `true` or `false`, when provided");if(p.decoder!==null&&typeof p.decoder<"u"&&typeof p.decoder!="function")throw new TypeError("Decoder has to be a function.");if(typeof p.charset<"u"&&p.charset!=="utf-8"&&p.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");if(typeof p.throwOnLimitExceeded<"u"&&typeof p.throwOnLimitExceeded!="boolean")throw new TypeError("`throwOnLimitExceeded` option must be a boolean");var m=typeof p.charset>"u"?i.charset:p.charset,g=typeof p.duplicates>"u"?i.duplicates:p.duplicates;if(g!=="combine"&&g!=="first"&&g!=="last")throw new TypeError("The duplicates option must be either combine, first, or last");var v=typeof p.allowDots>"u"?p.decodeDotInKeys===!0?!0:i.allowDots:!!p.allowDots;return{allowDots:v,allowEmptyArrays:typeof p.allowEmptyArrays=="boolean"?!!p.allowEmptyArrays:i.allowEmptyArrays,allowPrototypes:typeof p.allowPrototypes=="boolean"?p.allowPrototypes:i.allowPrototypes,allowSparse:typeof p.allowSparse=="boolean"?p.allowSparse:i.allowSparse,arrayLimit:typeof p.arrayLimit=="number"?p.arrayLimit:i.arrayLimit,charset:m,charsetSentinel:typeof p.charsetSentinel=="boolean"?p.charsetSentinel:i.charsetSentinel,comma:typeof p.comma=="boolean"?p.comma:i.comma,decodeDotInKeys:typeof p.decodeDotInKeys=="boolean"?p.decodeDotInKeys:i.decodeDotInKeys,decoder:typeof p.decoder=="function"?p.decoder:i.decoder,delimiter:typeof p.delimiter=="string"||s.isRegExp(p.delimiter)?p.delimiter:i.delimiter,depth:typeof p.depth=="number"||p.depth===!1?+p.depth:i.depth,duplicates:g,ignoreQueryPrefix:p.ignoreQueryPrefix===!0,interpretNumericEntities:typeof p.interpretNumericEntities=="boolean"?p.interpretNumericEntities:i.interpretNumericEntities,parameterLimit:typeof p.parameterLimit=="number"?p.parameterLimit:i.parameterLimit,parseArrays:p.parseArrays!==!1,plainObjects:typeof p.plainObjects=="boolean"?p.plainObjects:i.plainObjects,strictDepth:typeof p.strictDepth=="boolean"?!!p.strictDepth:i.strictDepth,strictMerge:typeof p.strictMerge=="boolean"?!!p.strictMerge:i.strictMerge,strictNullHandling:typeof p.strictNullHandling=="boolean"?p.strictNullHandling:i.strictNullHandling,throwOnLimitExceeded:typeof p.throwOnLimitExceeded=="boolean"?p.throwOnLimitExceeded:!1}};return Ud=function(f,p){var m=d(p);if(f===""||f===null||typeof f>"u")return m.plainObjects?{__proto__:null}:{};for(var g=typeof f=="string"?h(f,m):f,v=m.plainObjects?{__proto__:null}:{},b=Object.keys(g),y=0;y",'"',"`"," ","\r",` `," "],a=["{","}","|","\\","^","`"].concat(r),o=["'"].concat(a),h=["%","/","?",";","#"].concat(o),l=["/","?","#"],c=255,u=/^[+a-z0-9A-Z_-]{0,63}$/,d=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,f={javascript:!0,"javascript:":!0},p={javascript:!0,"javascript:":!0},m={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},g=iA();function v(A,T,_){if(A&&typeof A=="object"&&A instanceof e)return A;var R=new e;return R.parse(A,T,_),R}e.prototype.parse=function(A,T,_){if(typeof A!="string")throw new TypeError("Parameter 'url' must be a string, not "+typeof A);var R=A.indexOf("?"),P=R!==-1&&R127?fe+="x":fe+=K[me];if(!fe.match(u)){var Ee=W.slice(0,O),pe=W.slice(O+1),Ae=K.match(d);Ae&&(Ee.push(Ae[1]),pe.unshift(Ae[2])),pe.length&&(k="/"+pe.join(".")+k),this.hostname=Ee.join(".");break}}}this.hostname.length>c?this.hostname="":this.hostname=this.hostname.toLowerCase(),q||(this.hostname=s.toASCII(this.hostname));var G=this.port?":"+this.port:"",Z=this.hostname||"";this.host=Z+G,this.href+=this.host,q&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),k[0]!=="/"&&(k="/"+k))}if(!f[U])for(var O=0,J=o.length;O0?_.host.split("@"):!1;fe&&(_.auth=fe.shift(),_.hostname=fe.shift(),_.host=_.hostname)}return _.search=A.search,_.query=A.query,(_.pathname!==null||_.search!==null)&&(_.path=(_.pathname?_.pathname:"")+(_.search?_.search:"")),_.href=_.format(),_}if(!W.length)return _.pathname=null,_.search?_.path="/"+_.search:_.path=null,_.href=_.format(),_;for(var me=W.slice(-1)[0],we=(_.host||A.host||W.length>1)&&(me==="."||me==="..")||me==="",Ee=0,pe=W.length;pe>=0;pe--)me=W[pe],me==="."?W.splice(pe,1):me===".."?(W.splice(pe,1),Ee++):Ee&&(W.splice(pe,1),Ee--);if(!V&&!q)for(;Ee--;Ee)W.unshift("..");V&&W[0]!==""&&(!W[0]||W[0].charAt(0)!=="/")&&W.unshift(""),we&&W.join("/").substr(-1)!=="/"&&W.push("");var Ae=W[0]===""||W[0]&&W[0].charAt(0)==="/";if(K){_.hostname=Ae?"":W.length?W.shift():"",_.host=_.hostname;var fe=_.host&&_.host.indexOf("@")>0?_.host.split("@"):!1;fe&&(_.auth=fe.shift(),_.hostname=fe.shift(),_.host=_.hostname)}return V=V||_.host&&W.length,V&&!Ae&&W.unshift(""),W.length>0?_.pathname=W.join("/"):(_.pathname=null,_.path=null),(_.pathname!==null||_.search!==null)&&(_.path=(_.pathname?_.pathname:"")+(_.search?_.search:"")),_.auth=A.auth||_.auth,_.slashes=_.slashes||A.slashes,_.href=_.format(),_},e.prototype.parseHost=function(){var A=this.host,T=i.exec(A);T&&(T=T[0],T!==":"&&(this.port=T.substr(1)),A=A.substr(0,A.length-T.length)),A&&(this.hostname=A)},aa.parse=v,aa.resolve=y,aa.resolveObject=w,aa.format=b,aa.Url=e,aa}sA();const O0={};function kt(s,e,t=3){if(O0[e])return;let i=new Error().stack;typeof i>"u"?console.warn("PixiJS Deprecation Warning: ",`${e} Deprecated since v${s}`):(i=i.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${s}`),console.warn(i),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",`${e} Deprecated since v${s}`),console.warn(i))),O0[e]=!0}function zs(s){if(typeof s!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(s)}`)}function jo(s){return s.split("?")[0].split("#")[0]}function nA(s){return s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function rA(s,e,t){return s.replace(new RegExp(nA(e),"g"),t)}function aA(s,e){let t="",i=0,n=-1,r=0,a=-1;for(let o=0;o<=s.length;++o){if(o2){const h=t.lastIndexOf("/");if(h!==t.length-1){h===-1?(t="",i=0):(t=t.slice(0,h),i=t.length-1-t.lastIndexOf("/")),n=o,r=0;continue}}else if(t.length===2||t.length===1){t="",i=0,n=o,r=0;continue}}}else t.length>0?t+=`/${s.slice(n+1,o)}`:t=s.slice(n+1,o),i=o-n-1;n=o,r=0}else a===46&&r!==-1?++r:r=-1}return t}const wi={toPosix(s){return rA(s,"\\","/")},isUrl(s){return/^https?:/.test(this.toPosix(s))},isDataUrl(s){return/^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i.test(s)},isBlobUrl(s){return s.startsWith("blob:")},hasProtocol(s){return/^[^/:]+:/.test(this.toPosix(s))},getProtocol(s){zs(s),s=this.toPosix(s);const e=/^file:\/\/\//.exec(s);if(e)return e[0];const t=/^[^/:]+:\/{0,2}/.exec(s);return t?t[0]:""},toAbsolute(s,e,t){if(zs(s),this.isDataUrl(s)||this.isBlobUrl(s))return s;const i=jo(this.toPosix(e??We.ADAPTER.getBaseUrl())),n=jo(this.toPosix(t??this.rootname(i)));return s=this.toPosix(s),s.startsWith("/")?wi.join(n,s.slice(1)):this.isAbsolute(s)?s:this.join(i,s)},normalize(s){if(zs(s),s.length===0)return".";if(this.isDataUrl(s)||this.isBlobUrl(s))return s;s=this.toPosix(s);let e="";const t=s.startsWith("/");this.hasProtocol(s)&&(e=this.rootname(s),s=s.slice(e.length));const i=s.endsWith("/");return s=aA(s),s.length>0&&i&&(s+="/"),t?`/${s}`:e+s},isAbsolute(s){return zs(s),s=this.toPosix(s),this.hasProtocol(s)?!0:s.startsWith("/")},join(...s){if(s.length===0)return".";let e;for(let t=0;t0)if(e===void 0)e=i;else{const n=s[t-1]??"";this.joinExtensions.includes(this.extname(n).toLowerCase())?e+=`/../${i}`:e+=`/${i}`}}return e===void 0?".":this.normalize(e)},dirname(s){if(zs(s),s.length===0)return".";s=this.toPosix(s);let e=s.charCodeAt(0);const t=e===47;let i=-1,n=!0;const r=this.getProtocol(s),a=s;s=s.slice(r.length);for(let o=s.length-1;o>=1;--o)if(e=s.charCodeAt(o),e===47){if(!n){i=o;break}}else n=!1;return i===-1?t?"/":this.isUrl(a)?r+s:r:t&&i===1?"//":r+s.slice(0,i)},rootname(s){zs(s),s=this.toPosix(s);let e="";if(s.startsWith("/")?e="/":e=this.getProtocol(s),this.isUrl(s)){const t=s.indexOf("/",e.length);t!==-1?e=s.slice(0,t):e=s,e.endsWith("/")||(e+="/")}return e},basename(s,e){zs(s),e&&zs(e),s=jo(this.toPosix(s));let t=0,i=-1,n=!0,r;if(e!==void 0&&e.length>0&&e.length<=s.length){if(e.length===s.length&&e===s)return"";let a=e.length-1,o=-1;for(r=s.length-1;r>=0;--r){const h=s.charCodeAt(r);if(h===47){if(!n){t=r+1;break}}else o===-1&&(n=!1,o=r+1),a>=0&&(h===e.charCodeAt(a)?--a===-1&&(i=r):(a=-1,i=o))}return t===i?i=o:i===-1&&(i=s.length),s.slice(t,i)}for(r=s.length-1;r>=0;--r)if(s.charCodeAt(r)===47){if(!n){t=r+1;break}}else i===-1&&(n=!1,i=r+1);return i===-1?"":s.slice(t,i)},extname(s){zs(s),s=jo(this.toPosix(s));let e=-1,t=0,i=-1,n=!0,r=0;for(let a=s.length-1;a>=0;--a){const o=s.charCodeAt(a);if(o===47){if(!n){t=a+1;break}continue}i===-1&&(n=!1,i=a+1),o===46?e===-1?e=a:r!==1&&(r=1):e!==-1&&(r=-1)}return e===-1||i===-1||r===0||r===1&&e===i-1&&e===t+1?"":s.slice(e,i)},parse(s){zs(s);const e={root:"",dir:"",base:"",ext:"",name:""};if(s.length===0)return e;s=jo(this.toPosix(s));let t=s.charCodeAt(0);const i=this.isAbsolute(s);let n;e.root=this.rootname(s),i||this.hasProtocol(s)?n=1:n=0;let r=-1,a=0,o=-1,h=!0,l=s.length-1,c=0;for(;l>=n;--l){if(t=s.charCodeAt(l),t===47){if(!h){a=l+1;break}continue}o===-1&&(h=!1,o=l+1),t===46?r===-1?r=l:c!==1&&(c=1):r!==-1&&(c=-1)}return r===-1||o===-1||c===0||c===1&&r===o-1&&r===a+1?o!==-1&&(a===0&&i?e.base=e.name=s.slice(1,o):e.base=e.name=s.slice(a,o)):(a===0&&i?(e.name=s.slice(1,r),e.base=s.slice(1,o)):(e.name=s.slice(a,r),e.base=s.slice(a,o)),e.ext=s.slice(r,o)),e.dir=this.dirname(s),e},sep:"/",delimiter:":",joinExtensions:[".html"]};let Vd;async function oA(){return Vd??(Vd=(async()=>{var r;const s=document.createElement("canvas").getContext("webgl");if(!s)return Ni.UNPACK;const e=await new Promise(a=>{const o=document.createElement("video");o.onloadeddata=()=>a(o),o.onerror=()=>a(null),o.autoplay=!1,o.crossOrigin="anonymous",o.preload="auto",o.src="data:video/webm;base64,GkXfo59ChoEBQveBAULygQRC84EIQoKEd2VibUKHgQJChYECGFOAZwEAAAAAAAHTEU2bdLpNu4tTq4QVSalmU6yBoU27i1OrhBZUrmtTrIHGTbuMU6uEElTDZ1OsggEXTbuMU6uEHFO7a1OsggG97AEAAAAAAABZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmoCrXsYMPQkBNgIRMYXZmV0GETGF2ZkSJiEBEAAAAAAAAFlSua8yuAQAAAAAAAEPXgQFzxYgAAAAAAAAAAZyBACK1nIN1bmSIgQCGhVZfVlA5g4EBI+ODhAJiWgDglLCBArqBApqBAlPAgQFVsIRVuYEBElTDZ9Vzc9JjwItjxYgAAAAAAAAAAWfInEWjh0VOQ09ERVJEh49MYXZjIGxpYnZweC12cDlnyKJFo4hEVVJBVElPTkSHlDAwOjAwOjAwLjA0MDAwMDAwMAAAH0O2dcfngQCgwqGggQAAAIJJg0IAABAAFgA4JBwYSgAAICAAEb///4r+AAB1oZ2mm+6BAaWWgkmDQgAAEAAWADgkHBhKAAAgIABIQBxTu2uRu4+zgQC3iveBAfGCAXHwgQM=",o.load()});if(!e)return Ni.UNPACK;const t=s.createTexture();s.bindTexture(s.TEXTURE_2D,t);const i=s.createFramebuffer();s.bindFramebuffer(s.FRAMEBUFFER,i),s.framebufferTexture2D(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0,s.TEXTURE_2D,t,0),s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),s.pixelStorei(s.UNPACK_COLORSPACE_CONVERSION_WEBGL,s.NONE),s.texImage2D(s.TEXTURE_2D,0,s.RGBA,s.RGBA,s.UNSIGNED_BYTE,e);const n=new Uint8Array(4);return s.readPixels(0,0,1,1,s.RGBA,s.UNSIGNED_BYTE,n),s.deleteFramebuffer(i),s.deleteTexture(t),(r=s.getExtension("WEBGL_lose_context"))==null||r.loseContext(),n[0]<=n[3]?Ni.PMA:Ni.UNPACK})()),Vd}let Yd;function lA(){return typeof Yd>"u"&&(Yd=(function(){var e;const s={stencil:!0,failIfMajorPerformanceCaveat:We.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT};try{if(!We.ADAPTER.getWebGLRenderingContext())return!1;const t=We.ADAPTER.createCanvas();let i=t.getContext("webgl",s)||t.getContext("experimental-webgl",s);const n=!!((e=i==null?void 0:i.getContextAttributes())!=null&&e.stencil);if(i){const r=i.getExtension("WEBGL_lose_context");r&&r.loseContext()}return i=null,n}catch{return!1}})()),Yd}var cA={grad:.9,turn:360,rad:360/(2*Math.PI)},Hn=function(s){return typeof s=="string"?s.length>0:typeof s=="number"},Di=function(s,e,t){return e===void 0&&(e=0),t===void 0&&(t=Math.pow(10,e)),Math.round(t*s)/t+0},Xs=function(s,e,t){return e===void 0&&(e=0),t===void 0&&(t=1),s>t?t:s>e?s:e},Wx=function(s){return(s=isFinite(s)?s%360:0)>0?s:s+360},B0=function(s){return{r:Xs(s.r,0,255),g:Xs(s.g,0,255),b:Xs(s.b,0,255),a:Xs(s.a)}},$d=function(s){return{r:Di(s.r),g:Di(s.g),b:Di(s.b),a:Di(s.a,3)}},hA=/^#([0-9a-f]{3,8})$/i,lc=function(s){var e=s.toString(16);return e.length<2?"0"+e:e},zx=function(s){var e=s.r,t=s.g,i=s.b,n=s.a,r=Math.max(e,t,i),a=r-Math.min(e,t,i),o=a?r===e?(t-i)/a:r===t?2+(i-e)/a:4+(e-t)/a:0;return{h:60*(o<0?o+6:o),s:r?a/r*100:0,v:r/255*100,a:n}},qx=function(s){var e=s.h,t=s.s,i=s.v,n=s.a;e=e/360*6,t/=100,i/=100;var r=Math.floor(e),a=i*(1-t),o=i*(1-(e-r)*t),h=i*(1-(1-e+r)*t),l=r%6;return{r:255*[i,o,a,a,h,i][l],g:255*[h,i,i,o,a,a][l],b:255*[a,a,h,i,i,o][l],a:n}},L0=function(s){return{h:Wx(s.h),s:Xs(s.s,0,100),l:Xs(s.l,0,100),a:Xs(s.a)}},D0=function(s){return{h:Di(s.h),s:Di(s.s),l:Di(s.l),a:Di(s.a,3)}},N0=function(s){return qx((t=(e=s).s,{h:e.h,s:(t*=((i=e.l)<50?i:100-i)/100)>0?2*t/(i+t)*100:0,v:i+t,a:e.a}));var e,t,i},pl=function(s){return{h:(e=zx(s)).h,s:(n=(200-(t=e.s))*(i=e.v)/100)>0&&n<200?t*i/100/(n<=100?n:200-n)*100:0,l:n/2,a:e.a};var e,t,i,n},uA=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,dA=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,fA=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,mA=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Yf={string:[[function(s){var e=hA.exec(s);return e?(s=e[1]).length<=4?{r:parseInt(s[0]+s[0],16),g:parseInt(s[1]+s[1],16),b:parseInt(s[2]+s[2],16),a:s.length===4?Di(parseInt(s[3]+s[3],16)/255,2):1}:s.length===6||s.length===8?{r:parseInt(s.substr(0,2),16),g:parseInt(s.substr(2,2),16),b:parseInt(s.substr(4,2),16),a:s.length===8?Di(parseInt(s.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(s){var e=fA.exec(s)||mA.exec(s);return e?e[2]!==e[4]||e[4]!==e[6]?null:B0({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(s){var e=uA.exec(s)||dA.exec(s);if(!e)return null;var t,i,n=L0({h:(t=e[1],i=e[2],i===void 0&&(i="deg"),Number(t)*(cA[i]||1)),s:Number(e[3]),l:Number(e[4]),a:e[5]===void 0?1:Number(e[5])/(e[6]?100:1)});return N0(n)},"hsl"]],object:[[function(s){var e=s.r,t=s.g,i=s.b,n=s.a,r=n===void 0?1:n;return Hn(e)&&Hn(t)&&Hn(i)?B0({r:Number(e),g:Number(t),b:Number(i),a:Number(r)}):null},"rgb"],[function(s){var e=s.h,t=s.s,i=s.l,n=s.a,r=n===void 0?1:n;if(!Hn(e)||!Hn(t)||!Hn(i))return null;var a=L0({h:Number(e),s:Number(t),l:Number(i),a:Number(r)});return N0(a)},"hsl"],[function(s){var e=s.h,t=s.s,i=s.v,n=s.a,r=n===void 0?1:n;if(!Hn(e)||!Hn(t)||!Hn(i))return null;var a=(function(o){return{h:Wx(o.h),s:Xs(o.s,0,100),v:Xs(o.v,0,100),a:Xs(o.a)}})({h:Number(e),s:Number(t),v:Number(i),a:Number(r)});return qx(a)},"hsv"]]},U0=function(s,e){for(var t=0;t=.5},s.prototype.toHex=function(){return e=$d(this.rgba),t=e.r,i=e.g,n=e.b,a=(r=e.a)<1?lc(Di(255*r)):"","#"+lc(t)+lc(i)+lc(n)+a;var e,t,i,n,r,a},s.prototype.toRgb=function(){return $d(this.rgba)},s.prototype.toRgbString=function(){return e=$d(this.rgba),t=e.r,i=e.g,n=e.b,(r=e.a)<1?"rgba("+t+", "+i+", "+n+", "+r+")":"rgb("+t+", "+i+", "+n+")";var e,t,i,n,r},s.prototype.toHsl=function(){return D0(pl(this.rgba))},s.prototype.toHslString=function(){return e=D0(pl(this.rgba)),t=e.h,i=e.s,n=e.l,(r=e.a)<1?"hsla("+t+", "+i+"%, "+n+"%, "+r+")":"hsl("+t+", "+i+"%, "+n+"%)";var e,t,i,n,r},s.prototype.toHsv=function(){return e=zx(this.rgba),{h:Di(e.h),s:Di(e.s),v:Di(e.v),a:Di(e.a,3)};var e},s.prototype.invert=function(){return mn({r:255-(e=this.rgba).r,g:255-e.g,b:255-e.b,a:e.a});var e},s.prototype.saturate=function(e){return e===void 0&&(e=.1),mn(Gd(this.rgba,e))},s.prototype.desaturate=function(e){return e===void 0&&(e=.1),mn(Gd(this.rgba,-e))},s.prototype.grayscale=function(){return mn(Gd(this.rgba,-1))},s.prototype.lighten=function(e){return e===void 0&&(e=.1),mn(X0(this.rgba,e))},s.prototype.darken=function(e){return e===void 0&&(e=.1),mn(X0(this.rgba,-e))},s.prototype.rotate=function(e){return e===void 0&&(e=15),this.hue(this.hue()+e)},s.prototype.alpha=function(e){return typeof e=="number"?mn({r:(t=this.rgba).r,g:t.g,b:t.b,a:e}):Di(this.rgba.a,3);var t},s.prototype.hue=function(e){var t=pl(this.rgba);return typeof e=="number"?mn({h:e,s:t.s,l:t.l,a:t.a}):Di(t.h)},s.prototype.isEqual=function(e){return this.toHex()===mn(e).toHex()},s})(),mn=function(s){return s instanceof $f?s:new $f(s)},V0=[],gA=function(s){s.forEach(function(e){V0.indexOf(e)<0&&(e($f,Yf),V0.push(e))})};function vA(s,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"},i={};for(var n in t)i[t[n]]=n;var r={};s.prototype.toName=function(a){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var o,h,l=i[this.toHex()];if(l)return l;if(a!=null&&a.closest){var c=this.toRgb(),u=1/0,d="black";if(!r.length)for(var f in t)r[f]=new s(t[f]).toRgb();for(var p in t){var m=(o=c,h=r[p],Math.pow(o.r-h.r,2)+Math.pow(o.g-h.g,2)+Math.pow(o.b-h.b,2));mn===t[r]);if(e!==null&&t!==null){const n=Object.keys(e),r=Object.keys(t);return n.length!==r.length?!1:n.every(a=>e[a]===t[a])}return e===t}toRgba(){const[e,t,i,n]=this._components;return{r:e,g:t,b:i,a:n}}toRgb(){const[e,t,i]=this._components;return{r:e,g:t,b:i}}toRgbaString(){const[e,t,i]=this.toUint8RgbArray();return`rgba(${e},${t},${i},${this.alpha})`}toUint8RgbArray(e){const[t,i,n]=this._components;return e=e??[],e[0]=Math.round(t*255),e[1]=Math.round(i*255),e[2]=Math.round(n*255),e}toRgbArray(e){e=e??[];const[t,i,n]=this._components;return e[0]=t,e[1]=i,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,i,n,r]=Yc.temp.setValue(e)._components;return this._components[0]*=t,this._components[1]*=i,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 i=this._int>>16&255,n=this._int>>8&255,r=this._int&255;return t&&(i=i*e+.5|0,n=n*e+.5|0,r=r*e+.5|0),(e*255<<24)+(i<<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,i,n]=this._components;return this._components[0]=Math.round(t*e)/e,this._components[1]=Math.round(i*e)/e,this._components[2]=Math.round(n*e)/e,this.refreshInt(),this._value=null,this}toArray(e){e=e??[];const[t,i,n,r]=this._components;return e[0]=t,e[1]=i,e[2]=n,e[3]=r,e}normalize(e){let t,i,n,r;if((typeof e=="number"||e instanceof Number)&&e>=0&&e<=16777215){const a=e;t=(a>>16&255)/255,i=(a>>8&255)/255,n=(a&255)/255,r=1}else if((Array.isArray(e)||e instanceof Float32Array)&&e.length>=3&&e.length<=4)e=this._clamp(e),[t,i,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,i,n,r=255]=e,t/=255,i/=255,n/=255,r/=255;else if(typeof e=="string"||typeof e=="object"){if(typeof e=="string"){const o=Yc.HEX_PATTERN.exec(e);o&&(e=`#${o[2]}`)}const a=mn(e);a.isValid()&&({r:t,g:i,b:n,a:r}=a.rgba,t/=255,i/=255,n/=255)}if(t!==void 0)this._components[0]=t,this._components[1]=i,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,i]=this._components;this._int=(e*255<<16)+(t*255<<8)+(i*255|0)}_clamp(e,t=0,i=1){return typeof e=="number"?Math.min(Math.max(e,t),i):(e.forEach((n,r)=>{e[r]=Math.min(Math.max(n,t),i)}),e)}};io.shared=new io,io.temp=new io,io.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;let jt=io;function yA(s){return kt("7.2.0","utils.hex2string is deprecated, use Color#toHex instead"),jt.shared.setValue(s).toHex()}function xA(s){return kt("7.2.0","utils.rgb2hex is deprecated, use Color#toNumber instead"),jt.shared.setValue(s).toNumber()}function bA(){const s=[],e=[];for(let i=0;i<32;i++)s[i]=i,e[i]=i;s[dt.NORMAL_NPM]=dt.NORMAL,s[dt.ADD_NPM]=dt.ADD,s[dt.SCREEN_NPM]=dt.SCREEN,e[dt.NORMAL]=dt.NORMAL_NPM,e[dt.ADD]=dt.ADD_NPM,e[dt.SCREEN]=dt.SCREEN_NPM;const t=[];return t.push(e),t.push(s),t}const Kx=bA();function Zx(s,e){return Kx[e?1:0][s]}function wA(s,e=null){const t=s*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 i=0,n=0;i>>1,s|=s>>>2,s|=s>>>4,s|=s>>>8,s|=s>>>16,s+1}function Y0(s){return!(s&s-1)&&!!s}function $0(s){let e=(s>65535?1:0)<<4;s>>>=e;let t=(s>255?1:0)<<3;return s>>>=t,e|=t,t=(s>15?1:0)<<2,s>>>=t,e|=t,t=(s>3?1:0)<<1,s>>>=t,e|=t,e|s>>1}function yo(s,e,t){const i=s.length;let n;if(e>=i||t===0)return;t=e+t>i?i-e:t;const r=i-t;for(n=e;n(s.Renderer="renderer",s.Application="application",s.RendererSystem="renderer-webgl-system",s.RendererPlugin="renderer-webgl-plugin",s.CanvasRendererSystem="renderer-canvas-system",s.CanvasRendererPlugin="renderer-canvas-plugin",s.Asset="asset",s.LoadParser="load-parser",s.ResolveParser="resolve-parser",s.CacheParser="cache-parser",s.DetectionParser="detection-parser",s))(He||{});const Hf=s=>{if(typeof s=="function"||typeof s=="object"&&s.extension){if(!s.extension)throw new Error("Extension class must have an extension object");s={...typeof s.extension!="object"?{type:s.extension}:s.extension,ref:s}}if(typeof s=="object")s={...s};else throw new Error("Invalid extension type");return typeof s.type=="string"&&(s.type=[s.type]),s},z0=(s,e)=>Hf(s).priority??e,tt={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...s){return s.map(Hf).forEach(e=>{e.type.forEach(t=>{var i,n;return(n=(i=this._removeHandlers)[t])==null?void 0:n.call(i,e)})}),this},add(...s){return s.map(Hf).forEach(e=>{e.type.forEach(t=>{var r,a;const i=this._addHandlers,n=this._queue;i[t]?(r=i[t])==null||r.call(i,e):(n[t]=n[t]||[],(a=n[t])==null||a.push(e))})}),this},handle(s,e,t){var a;const i=this._addHandlers,n=this._removeHandlers;if(i[s]||n[s])throw new Error(`Extension type ${s} already has a handler`);i[s]=e,n[s]=t;const r=this._queue;return r[s]&&((a=r[s])==null||a.forEach(o=>e(o)),delete r[s]),this},handleByMap(s,e){return this.handle(s,t=>{t.name&&(e[t.name]=t.ref)},t=>{t.name&&delete e[t.name]})},handleByList(s,e,t=-1){return this.handle(s,i=>{e.includes(i.ref)||(e.push(i.ref),e.sort((n,r)=>z0(r,t)-z0(n,t)))},i=>{const n=e.indexOf(i.ref);n!==-1&&e.splice(n,1)})}};class jf{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 EA=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(` `);function CA(s){let e="";for(let t=0;t0&&(e+=` else `),t=0;--i){const n=Wf[i];if(n.test&&n.test(s,t))return new n(s,e)}throw new Error("Unrecognized source type to auto-detect Resource")}class on{constructor(e){this.items=[],this._name=e,this._aliasCount=0}emit(e,t,i,n,r,a,o,h){if(arguments.length>8)throw new Error("max arguments reached");const{name:l,items:c}=this;this._aliasCount++;for(let u=0,d=c.length;u0&&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(on.prototype,{dispatch:{value:on.prototype.emit},run:{value:on.prototype.emit}});class Ol{constructor(e=0,t=0){this._width=e,this._height=t,this.destroyed=!1,this.internal=!1,this.onResize=new on("setRealSize"),this.onUpdate=new on("update"),this.onError=new on("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,i){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 yu extends Ol{constructor(e,t){const{width:i,height:n}=t||{};if(!i||!n)throw new Error("BufferResource width or height invalid");super(i,n),this.data=e,this.unpackAlignment=t.unpackAlignment??4}upload(e,t,i){const n=e.gl;n.pixelStorei(n.UNPACK_ALIGNMENT,this.unpackAlignment),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.alphaMode===Ni.UNPACK);const r=t.realWidth,a=t.realHeight;return i.width===r&&i.height===a?n.texSubImage2D(t.target,0,0,0,r,a,t.format,i.type,this.data):(i.width=r,i.height=a,n.texImage2D(t.target,0,i.internalFormat,r,a,0,t.format,i.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 RA={scaleMode:sn.NEAREST,alphaMode:Ni.NPM},zf=class so extends jl{constructor(e=null,t=null){super(),t=Object.assign({},so.defaultOptions,t);const{alphaMode:i,mipmap:n,anisotropicLevel:r,scaleMode:a,width:o,height:h,wrapMode:l,format:c,type:u,target:d,resolution:f,resourceOptions:p}=t;e&&!(e instanceof Ol)&&(e=Qx(e,p),e.internal=!0),this.resolution=f||We.RESOLUTION,this.width=Math.round((o||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=a,this.format=c,this.type=u,this.target=d,this.alphaMode=i,this.uid=Fa(),this.touched=0,this.isPowerOfTwo=!1,this._refreshPOT(),this._glTextures={},this.dirtyId=0,this.dirtyStyleId=0,this.cacheId=null,this.valid=o>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 i;return e!==void 0&&e!==this.scaleMode&&(this.scaleMode=e,i=!0),t!==void 0&&t!==this.mipmap&&(this.mipmap=t,i=!0),i&&this.dirtyStyleId++,this}setSize(e,t,i){return i=i||this.resolution,this.setRealSize(e*i,t*i,i)}setRealSize(e,t,i){return this.resolution=i||this.resolution,this.width=Math.round(e)/this.resolution,this.height=Math.round(t)/this.resolution,this._refreshPOT(),this.update(),this}_refreshPOT(){this.isPowerOfTwo=Y0(this.realWidth)&&Y0(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 Sr[this.cacheId],delete pn[this.cacheId],this.cacheId=null),this.valid=!1,this.dispose(),so.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,i=We.STRICT_TEXTURE_CACHE){const n=typeof e=="string";let r=null;if(n)r=e;else{if(!e._pixiId){const o=(t==null?void 0:t.pixiIdPrefix)||"pixiid";e._pixiId=`${o}_${Fa()}`}r=e._pixiId}let a=Sr[r];if(n&&i&&!a)throw new Error(`The cacheId "${r}" does not exist in BaseTextureCache.`);return a||(a=new so(e,t),a.cacheId=r,so.addToCache(a,r)),a}static fromBuffer(e,t,i,n){e=e||new Float32Array(t*i*4);const r=new yu(e,{width:t,height:i,...n==null?void 0:n.resourceOptions});let a,o;return e instanceof Float32Array?(a=Ne.RGBA,o=et.FLOAT):e instanceof Int32Array?(a=Ne.RGBA_INTEGER,o=et.INT):e instanceof Uint32Array?(a=Ne.RGBA_INTEGER,o=et.UNSIGNED_INT):e instanceof Int16Array?(a=Ne.RGBA_INTEGER,o=et.SHORT):e instanceof Uint16Array?(a=Ne.RGBA_INTEGER,o=et.UNSIGNED_SHORT):e instanceof Int8Array?(a=Ne.RGBA,o=et.BYTE):(a=Ne.RGBA,o=et.UNSIGNED_BYTE),r.internal=!0,new so(r,Object.assign({},RA,{type:o,format:a},n))}static addToCache(e,t){t&&(e.textureCacheIds.includes(t)||e.textureCacheIds.push(t),Sr[t]&&Sr[t]!==e&&console.warn(`BaseTexture added to the cache with an id [${t}] that already had an entry`),Sr[t]=e)}static removeFromCache(e){if(typeof e=="string"){const t=Sr[e];if(t){const i=t.textureCacheIds.indexOf(e);return i>-1&&t.textureCacheIds.splice(i,1),delete Sr[e],t}}else if(e!=null&&e.textureCacheIds){for(let t=0;t1){for(let u=0;u(s[s.POLY=0]="POLY",s[s.RECT=1]="RECT",s[s.CIRC=2]="CIRC",s[s.ELIP=3]="ELIP",s[s.RREC=4]="RREC",s))(Hi||{});class Ut{constructor(e=0,t=0){this.x=0,this.y=0,this.x=e,this.y=t}clone(){return new Ut(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}}Ut.prototype.toString=function(){return`[@pixi/math:Point x=${this.x} y=${this.y}]`};const cc=[new Ut,new Ut,new Ut,new Ut];class Tt{constructor(e=0,t=0,i=0,n=0){this.x=Number(e),this.y=Number(t),this.width=Number(i),this.height=Number(n),this.type=Hi.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 Tt(0,0,0,0)}clone(){return new Tt(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.y&&te.right?e.right:this.right)<=R)return!1;const P=this.ye.bottom?e.bottom:this.bottom)>P}const i=this.left,n=this.right,r=this.top,a=this.bottom;if(n<=i||a<=r)return!1;const o=cc[0].set(e.left,e.top),h=cc[1].set(e.left,e.bottom),l=cc[2].set(e.right,e.top),c=cc[3].set(e.right,e.bottom);if(l.x<=o.x||h.y<=o.y)return!1;const u=Math.sign(t.a*t.d-t.b*t.c);if(u===0||(t.apply(o,o),t.apply(h,h),t.apply(l,l),t.apply(c,c),Math.max(o.x,h.x,l.x,c.x)<=i||Math.min(o.x,h.x,l.x,c.x)>=n||Math.max(o.y,h.y,l.y,c.y)<=r||Math.min(o.y,h.y,l.y,c.y)>=a))return!1;const d=u*(h.y-o.y),f=u*(o.x-h.x),p=d*i+f*r,m=d*n+f*r,g=d*i+f*a,v=d*n+f*a;if(Math.max(p,m,g,v)<=d*o.x+f*o.y||Math.min(p,m,g,v)>=d*c.x+f*c.y)return!1;const b=u*(o.y-l.y),y=u*(l.x-o.x),w=b*i+y*r,A=b*n+y*r,T=b*i+y*a,_=b*n+y*a;return!(Math.max(w,A,T,_)<=b*o.x+y*o.y||Math.min(w,A,T,_)>=b*c.x+y*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),i=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(i-t,0),this.y=n,this.height=Math.max(r-n,0),this}ceil(e=1,t=.001){const i=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=i-this.x,this.height=n-this.y,this}enlarge(e){const t=Math.min(this.x,e.x),i=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=i-t,this.y=n,this.height=r-n,this}}Tt.prototype.toString=function(){return`[@pixi/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};class xu{constructor(e=0,t=0,i=0){this.x=e,this.y=t,this.radius=i,this.type=Hi.CIRC}clone(){return new xu(this.x,this.y,this.radius)}contains(e,t){if(this.radius<=0)return!1;const i=this.radius*this.radius;let n=this.x-e,r=this.y-t;return n*=n,r*=r,n+r<=i}getBounds(){return new Tt(this.x-this.radius,this.y-this.radius,this.radius*2,this.radius*2)}}xu.prototype.toString=function(){return`[@pixi/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`};class bu{constructor(e=0,t=0,i=0,n=0){this.x=e,this.y=t,this.width=i,this.height=n,this.type=Hi.ELIP}clone(){return new bu(this.x,this.y,this.width,this.height)}contains(e,t){if(this.width<=0||this.height<=0)return!1;let i=(e-this.x)/this.width,n=(t-this.y)/this.height;return i*=i,n*=n,i+n<=1}getBounds(){return new Tt(this.x-this.width,this.y-this.height,this.width,this.height)}}bu.prototype.toString=function(){return`[@pixi/math:Ellipse x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};class Ca{constructor(...e){let t=Array.isArray(e[0])?e[0]:e;if(typeof t[0]!="number"){const i=[];for(let n=0,r=t.length;nt!=c>t&&e<(l-o)*((t-h)/(c-h))+o&&(i=!i)}return i}}Ca.prototype.toString=function(){return`[@pixi/math:PolygoncloseStroke=${this.closeStroke}points=${this.points.reduce((s,e)=>`${s}, ${e}`,"")}]`};class wu{constructor(e=0,t=0,i=0,n=0,r=20){this.x=e,this.y=t,this.width=i,this.height=n,this.radius=r,this.type=Hi.RREC}clone(){return new wu(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 i=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(t>=this.y+i&&t<=this.y+this.height-i||e>=this.x+i&&e<=this.x+this.width-i)return!0;let n=e-(this.x+i),r=t-(this.y+i);const a=i*i;if(n*n+r*r<=a||(n=e-(this.x+this.width-i),n*n+r*r<=a)||(r=t-(this.y+this.height-i),n*n+r*r<=a)||(n=e-(this.x+i),n*n+r*r<=a))return!0}return!1}}wu.prototype.toString=function(){return`[@pixi/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`};class li{constructor(e=1,t=0,i=0,n=1,r=0,a=0){this.array=null,this.a=e,this.b=t,this.c=i,this.d=n,this.tx=r,this.ty=a}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,i,n,r,a){return this.a=e,this.b=t,this.c=i,this.d=n,this.tx=r,this.ty=a,this}toArray(e,t){this.array||(this.array=new Float32Array(9));const i=t||this.array;return e?(i[0]=this.a,i[1]=this.b,i[2]=0,i[3]=this.c,i[4]=this.d,i[5]=0,i[6]=this.tx,i[7]=this.ty,i[8]=1):(i[0]=this.a,i[1]=this.c,i[2]=this.tx,i[3]=this.b,i[4]=this.d,i[5]=this.ty,i[6]=0,i[7]=0,i[8]=1),i}apply(e,t){t=t||new Ut;const i=e.x,n=e.y;return t.x=this.a*i+this.c*n+this.tx,t.y=this.b*i+this.d*n+this.ty,t}applyInverse(e,t){t=t||new Ut;const i=1/(this.a*this.d+this.c*-this.b),n=e.x,r=e.y;return t.x=this.d*i*n+-this.c*i*r+(this.ty*this.c-this.tx*this.d)*i,t.y=this.a*i*r+-this.b*i*n+(-this.ty*this.a+this.tx*this.b)*i,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),i=Math.sin(e),n=this.a,r=this.c,a=this.tx;return this.a=n*t-this.b*i,this.b=n*i+this.b*t,this.c=r*t-this.d*i,this.d=r*i+this.d*t,this.tx=a*t-this.ty*i,this.ty=a*i+this.ty*t,this}append(e){const t=this.a,i=this.b,n=this.c,r=this.d;return this.a=e.a*t+e.b*n,this.b=e.a*i+e.b*r,this.c=e.c*t+e.d*n,this.d=e.c*i+e.d*r,this.tx=e.tx*t+e.ty*n+this.tx,this.ty=e.tx*i+e.ty*r+this.ty,this}setTransform(e,t,i,n,r,a,o,h,l){return this.a=Math.cos(o+l)*r,this.b=Math.sin(o+l)*r,this.c=-Math.sin(o-h)*a,this.d=Math.cos(o-h)*a,this.tx=e-(i*this.a+n*this.c),this.ty=t-(i*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 i=this.a,n=this.c;this.a=i*e.a+this.b*e.c,this.b=i*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,i=this.b,n=this.c,r=this.d,a=e.pivot,o=-Math.atan2(-n,r),h=Math.atan2(i,t),l=Math.abs(o+h);return l<1e-5||Math.abs(vh-l)<1e-5?(e.rotation=h,e.skew.x=e.skew.y=0):(e.rotation=0,e.skew.x=o,e.skew.y=h),e.scale.x=Math.sqrt(t*t+i*i),e.scale.y=Math.sqrt(n*n+r*r),e.position.x=this.tx+(a.x*t+a.y*n),e.position.y=this.ty+(a.x*i+a.y*r),e}invert(){const e=this.a,t=this.b,i=this.c,n=this.d,r=this.tx,a=e*n-t*i;return this.a=n/a,this.b=-t/a,this.c=-i/a,this.d=e/a,this.tx=(i*this.ty-n*r)/a,this.ty=-(e*this.ty-t*r)/a,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 li;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 li}static get TEMP_MATRIX(){return new li}}li.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 ua=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],da=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],fa=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],ma=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],Kf=[],tb=[],hc=Math.sign;function NA(){for(let s=0;s<16;s++){const e=[];Kf.push(e);for(let t=0;t<16;t++){const i=hc(ua[s]*ua[t]+fa[s]*da[t]),n=hc(da[s]*ua[t]+ma[s]*da[t]),r=hc(ua[s]*fa[t]+fa[s]*ma[t]),a=hc(da[s]*fa[t]+ma[s]*ma[t]);for(let o=0;o<16;o++)if(ua[o]===i&&da[o]===n&&fa[o]===r&&ma[o]===a){e.push(o);break}}}for(let s=0;s<16;s++){const e=new li;e.set(ua[s],da[s],fa[s],ma[s],0,0),tb.push(e)}}NA();const mi={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:s=>ua[s],uY:s=>da[s],vX:s=>fa[s],vY:s=>ma[s],inv:s=>s&8?s&15:-s&7,add:(s,e)=>Kf[s][e],sub:(s,e)=>Kf[s][mi.inv(e)],rotate180:s=>s^4,isVertical:s=>(s&3)===2,byDirection:(s,e)=>Math.abs(s)*2<=Math.abs(e)?e>=0?mi.S:mi.N:Math.abs(e)*2<=Math.abs(s)?s>0?mi.E:mi.W:e>0?s>0?mi.SE:mi.SW:s>0?mi.NE:mi.NW,matrixAppendRotationInv:(s,e,t=0,i=0)=>{const n=tb[mi.inv(e)];n.tx=t,n.ty=i,s.append(n)}};class sr{constructor(e,t,i=0,n=0){this._x=i,this._y=n,this.cb=e,this.scope=t}clone(e=this.cb,t=this.scope){return new sr(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))}}sr.prototype.toString=function(){return`[@pixi/math:ObservablePoint x=${this.x} y=${this.y} scope=${this.scope}]`};const Zf=class{constructor(){this.worldTransform=new li,this.localTransform=new li,this.position=new sr(this.onChange,this,0,0),this.scale=new sr(this.onChange,this,1,1),this.pivot=new sr(this.onChange,this,0,0),this.skew=new sr(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 s=this.localTransform;this._localID!==this._currentLocalID&&(s.a=this._cx*this.scale.x,s.b=this._sx*this.scale.x,s.c=this._cy*this.scale.y,s.d=this._sy*this.scale.y,s.tx=this.position.x-(this.pivot.x*s.a+this.pivot.y*s.c),s.ty=this.position.y-(this.pivot.x*s.b+this.pivot.y*s.d),this._currentLocalID=this._localID,this._parentID=-1)}updateTransform(s){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!==s._worldID){const t=s.worldTransform,i=this.worldTransform;i.a=e.a*t.a+e.b*t.c,i.b=e.a*t.b+e.b*t.d,i.c=e.c*t.a+e.d*t.c,i.d=e.c*t.b+e.d*t.d,i.tx=e.tx*t.a+e.ty*t.c+t.tx,i.ty=e.tx*t.b+e.ty*t.d+t.ty,this._parentID=s._worldID,this._worldID++}}setFromMatrix(s){s.decompose(this),this._localID++}get rotation(){return this._rotation}set rotation(s){this._rotation!==s&&(this._rotation=s,this.updateSkew())}};Zf.IDENTITY=new Zf;let mp=Zf;mp.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 UA=`varying vec2 vTextureCoord; uniform sampler2D uSampler; void main(void){ gl_FragColor *= texture2D(uSampler, vTextureCoord); }`,XA=`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 K0(s,e,t){const i=s.createShader(e);return s.shaderSource(i,t),s.compileShader(i),i}function Jd(s){const e=new Array(s);for(let t=0;ts.type==="float"&&s.size===1&&!s.isArray,code:s=>` if(uv["${s}"] !== ud["${s}"].value) { ud["${s}"].value = uv["${s}"] gl.uniform1f(ud["${s}"].location, uv["${s}"]) } `},{test:(s,e)=>(s.type==="sampler2D"||s.type==="samplerCube"||s.type==="sampler2DArray")&&s.size===1&&!s.isArray&&(e==null||e.castToBaseTexture!==void 0),code:s=>`t = syncData.textureCount++; renderer.texture.bind(uv["${s}"], t); if(ud["${s}"].value !== t) { ud["${s}"].value = t; gl.uniform1i(ud["${s}"].location, t); ; // eslint-disable-line max-len }`},{test:(s,e)=>s.type==="mat3"&&s.size===1&&!s.isArray&&e.a!==void 0,code:s=>` gl.uniformMatrix3fv(ud["${s}"].location, false, uv["${s}"].toArray(true)); `,codeUbo:s=>` var ${s}_matrix = uv.${s}.toArray(true); data[offset] = ${s}_matrix[0]; data[offset+1] = ${s}_matrix[1]; data[offset+2] = ${s}_matrix[2]; data[offset + 4] = ${s}_matrix[3]; data[offset + 5] = ${s}_matrix[4]; data[offset + 6] = ${s}_matrix[5]; data[offset + 8] = ${s}_matrix[6]; data[offset + 9] = ${s}_matrix[7]; data[offset + 10] = ${s}_matrix[8]; `},{test:(s,e)=>s.type==="vec2"&&s.size===1&&!s.isArray&&e.x!==void 0,code:s=>` cv = ud["${s}"].value; v = uv["${s}"]; if(cv[0] !== v.x || cv[1] !== v.y) { cv[0] = v.x; cv[1] = v.y; gl.uniform2f(ud["${s}"].location, v.x, v.y); }`,codeUbo:s=>` v = uv.${s}; data[offset] = v.x; data[offset+1] = v.y; `},{test:s=>s.type==="vec2"&&s.size===1&&!s.isArray,code:s=>` cv = ud["${s}"].value; v = uv["${s}"]; if(cv[0] !== v[0] || cv[1] !== v[1]) { cv[0] = v[0]; cv[1] = v[1]; gl.uniform2f(ud["${s}"].location, v[0], v[1]); } `},{test:(s,e)=>s.type==="vec4"&&s.size===1&&!s.isArray&&e.width!==void 0,code:s=>` cv = ud["${s}"].value; v = uv["${s}"]; 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["${s}"].location, v.x, v.y, v.width, v.height) }`,codeUbo:s=>` v = uv.${s}; data[offset] = v.x; data[offset+1] = v.y; data[offset+2] = v.width; data[offset+3] = v.height; `},{test:(s,e)=>s.type==="vec4"&&s.size===1&&!s.isArray&&e.red!==void 0,code:s=>` cv = ud["${s}"].value; v = uv["${s}"]; 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["${s}"].location, v.red, v.green, v.blue, v.alpha) }`,codeUbo:s=>` v = uv.${s}; data[offset] = v.red; data[offset+1] = v.green; data[offset+2] = v.blue; data[offset+3] = v.alpha; `},{test:(s,e)=>s.type==="vec3"&&s.size===1&&!s.isArray&&e.red!==void 0,code:s=>` cv = ud["${s}"].value; v = uv["${s}"]; 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["${s}"].location, v.red, v.green, v.blue) }`,codeUbo:s=>` v = uv.${s}; data[offset] = v.red; data[offset+1] = v.green; data[offset+2] = v.blue; `},{test:s=>s.type==="vec4"&&s.size===1&&!s.isArray,code:s=>` cv = ud["${s}"].value; v = uv["${s}"]; 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["${s}"].location, v[0], v[1], v[2], v[3]) }`}],VA={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); }`},YA={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 $A(s,e){var i;const t=[` var v = null; var cv = null; var cu = null; var t = 0; var gl = renderer.gl; `];for(const n in s.uniforms){const r=e[n];if(!r){((i=s.uniforms[n])==null?void 0:i.group)===!0&&(s.uniforms[n].ubo?t.push(` renderer.shader.syncUniformBufferGroup(uv.${n}, '${n}'); `):t.push(` renderer.shader.syncUniformGroup(uv.${n}, syncData); `));continue}const a=s.uniforms[n];let o=!1;for(let h=0;h=Na.WEBGL2&&(e=s.getContext("webgl2",{})),e||(e=s.getContext("webgl",{})||s.getContext("experimental-webgl",{}),e?e.getExtension("WEBGL_draw_buffers"):e=null),qa=e}return qa}let uc;function HA(){if(!uc){uc=Us.MEDIUM;const s=GA();if(s&&s.getShaderPrecisionFormat){const e=s.getShaderPrecisionFormat(s.FRAGMENT_SHADER,s.HIGH_FLOAT);e&&(uc=e.precision?Us.HIGH:Us.MEDIUM)}}return uc}function Z0(s,e){const t=s.getShaderSource(e).split(` `).map((l,c)=>`${c}: ${l}`),i=s.getShaderInfoLog(e),n=i.split(` `),r={},a=n.map(l=>parseFloat(l.replace(/^ERROR\: 0\:([\d]+)\:.*$/,"$1"))).filter(l=>l&&!r[l]?(r[l]=!0,!0):!1),o=[""];a.forEach(l=>{t[l-1]=`%c${t[l-1]}%c`,o.push("background: #FF0000; color:#FFFFFF; font-size: 10px","font-size: 10px")});const h=t.join(` `);o[0]=h,console.error(i),console.groupCollapsed("click to view full shader code"),console.warn(...o),console.groupEnd()}function jA(s,e,t,i){s.getProgramParameter(e,s.LINK_STATUS)||(s.getShaderParameter(t,s.COMPILE_STATUS)||Z0(s,t),s.getShaderParameter(i,s.COMPILE_STATUS)||Z0(s,i),console.error("PixiJS Error: Could not initialize shader."),s.getProgramInfoLog(e)!==""&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",s.getProgramInfoLog(e)))}const WA={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 nb(s){return WA[s]}let dc=null;const J0={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 rb(s,e){if(!dc){const t=Object.keys(J0);dc={};for(let i=0;i0&&(t+=` else `),ithis.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,i=Zs._textureArrayPool,n=this.renderer.batch,r=this._tempBoundTextures,a=this.renderer.textureGC.count;let o=++yt._globalBatch,h=0,l=i[0],c=0;n.copyBoundTextures(r,t);for(let u=0;u=t&&(n.boundArray(l,r,o,t),this.buildDrawCalls(l,c,u),c=u,l=i[++h],++o),d._batchEnabled=o,d.touched=a,l.elements[l.count++]=d)}l.count>0&&(n.boundArray(l,r,o,t),this.buildDrawCalls(l,c,this._bufferSize),++h,++o);for(let u=0;u0);for(let m=0;m=0;--n)e[n]=i[n]||null,e[n]&&(e[n]._batchLocation=n)}boundArray(e,t,i,n){const{elements:r,ids:a,count:o}=e;let h=0;for(let l=0;l=0&&u=Na.WEBGL2&&(i=e.getContext("webgl2",t)),i)this.webGLVersion=2;else if(this.webGLVersion=1,i=e.getContext("webgl",t)||e.getContext("experimental-webgl",t),!i)throw new Error("This browser does not support WebGL. Try using the canvas renderer");return this.gl=i,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(),i="WebGL2RenderingContext"in globalThis&&e instanceof globalThis.WebGL2RenderingContext;i&&(this.webGLVersion=2),t&&!t.stencil&&console.warn("Provided WebGL context does not have a stencil buffer, masks may not render correctly");const n=i||!!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")}}xh.defaultOptions={context:null,antialias:!1,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:"default"},xh.extension={type:He.RendererSystem,name:"context"};tt.add(xh);class tm{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 on("disposeFramebuffer"),this.multisample=Ei.NONE}get colorTexture(){return this.colorTextures[0]}addColorTexture(e=0,t){return this.colorTextures[e]=t||new yt(null,{scaleMode:sn.NEAREST,resolution:1,mipmap:Ys.OFF,width:this.width,height:this.height}),this.dirtyId++,this.dirtyFormat++,this}addDepthTexture(e){return this.depthTexture=e||new yt(null,{scaleMode:sn.NEAREST,resolution:1,width:this.width,height:this.height,mipmap:Ys.OFF,format:Ne.DEPTH_COMPONENT,type:et.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 i=0;i{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=a=>{i(a),this.onError.emit(a)})}),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,i=!e.crossOrigin||e.crossOrigin==="anonymous";return this._process=fetch(e.src,{mode:i?"cors":"no-cors"}).then(n=>n.blob()).then(n=>t(n,0,0,e.width,e.height,{premultiplyAlpha:this.alphaMode===null||this.alphaMode===Ni.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,i){if(typeof this.alphaMode=="number"&&(t.alphaMode=this.alphaMode),!this.createBitmap)return super.upload(e,t,i);if(!this.bitmap&&(this.process(),!this.bitmap))return!1;if(super.upload(e,t,i,this.bitmap),!this.preserveBitmap){let n=!0;const r=t._glTextures;for(const a in r){const o=r[a];if(o!==i&&o.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 pp{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,i){const n=t.width,r=t.height;if(i){const a=e.width/2/n,o=e.height/2/r,h=e.x/n+a,l=e.y/r+o;i=mi.add(i,mi.NW),this.x0=h+a*mi.uX(i),this.y0=l+o*mi.uY(i),i=mi.add(i,2),this.x1=h+a*mi.uX(i),this.y1=l+o*mi.uY(i),i=mi.add(i,2),this.x2=h+a*mi.uX(i),this.y2=l+o*mi.uY(i),i=mi.add(i,2),this.x3=h+a*mi.uX(i),this.y3=l+o*mi.uY(i)}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}}pp.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 tv=new pp;function mc(s){s.destroy=function(){},s.on=function(){},s.once=function(){},s.emit=function(){}}let gt=class ri extends jl{constructor(e,t,i,n,r,a,o){if(super(),this.noFrame=!1,t||(this.noFrame=!0,t=new Tt(0,0,1,1)),e instanceof ri&&(e=e.baseTexture),this.baseTexture=e,this._frame=t,this.trim=n,this.valid=!1,this.destroyed=!1,this._uvs=tv,this.uvMatrix=null,this.orig=i||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=a?new Ut(a.x,a.y):new Ut(0,0),this.defaultBorders=o,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&&pn[t.url]&&ri.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,ri.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(),i=new ri(this.baseTexture,!this.noFrame&&e,t,(n=this.trim)==null?void 0:n.clone(),this.rotate,this.defaultAnchor,this.defaultBorders);return this.noFrame&&(i._frame=e),i}updateUvs(){this._uvs===tv&&(this._uvs=new pp),this._uvs.set(this._frame,this.baseTexture,this.rotate),this._updateID++}static from(e,t={},i=We.STRICT_TEXTURE_CACHE){const n=typeof e=="string";let r=null;if(n)r=e;else if(e instanceof yt){if(!e.cacheId){const o=(t==null?void 0:t.pixiIdPrefix)||"pixiid";e.cacheId=`${o}-${Fa()}`,yt.addToCache(e,e.cacheId)}r=e.cacheId}else{if(!e._pixiId){const o=(t==null?void 0:t.pixiIdPrefix)||"pixiid";e._pixiId=`${o}_${Fa()}`}r=e._pixiId}let a=pn[r];if(n&&i&&!a)throw new Error(`The cacheId "${r}" does not exist in TextureCache.`);return!a&&!(e instanceof yt)?(t.resolution||(t.resolution=pr(e)),a=new ri(new yt(e,t)),a.baseTexture.cacheId=r,yt.addToCache(a.baseTexture,r),ri.addToCache(a,r)):!a&&e instanceof yt&&(a=new ri(e),ri.addToCache(a,r)),a}static fromURL(e,t){const i=Object.assign({autoLoad:!1},t==null?void 0:t.resourceOptions),n=ri.from(e,Object.assign({resourceOptions:i},t),!1),r=n.baseTexture.resource;return n.baseTexture.valid?Promise.resolve(n):r.load().then(()=>Promise.resolve(n))}static fromBuffer(e,t,i,n){return new ri(yt.fromBuffer(e,t,i,n))}static fromLoader(e,t,i,n){const r=new yt(e,Object.assign({scaleMode:yt.defaultOptions.scaleMode,resolution:pr(t)},n)),{resource:a}=r;a instanceof cb&&(a.url=t);const o=new ri(r);return i||(i=t),yt.addToCache(o.baseTexture,i),ri.addToCache(o,i),i!==t&&(yt.addToCache(o.baseTexture,t),ri.addToCache(o,t)),o.baseTexture.valid?Promise.resolve(o):new Promise(h=>{o.baseTexture.once("loaded",()=>h(o))})}static addToCache(e,t){t&&(e.textureCacheIds.includes(t)||e.textureCacheIds.push(t),pn[t]&&pn[t]!==e&&console.warn(`Texture added to the cache with an id [${t}] that already had an entry`),pn[t]=e)}static removeFromCache(e){if(typeof e=="string"){const t=pn[e];if(t){const i=t.textureCacheIds.indexOf(e);return i>-1&&t.textureCacheIds.splice(i,1),delete pn[e],t}}else if(e!=null&&e.textureCacheIds){for(let t=0;tthis.baseTexture.width,o=i+r>this.baseTexture.height;if(a||o){const h=a&&o?"and":"or",l=`X: ${t} + ${n} = ${t+n} > ${this.baseTexture.width}`,c=`Y: ${i} + ${r} = ${i+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 ri._EMPTY||(ri._EMPTY=new ri(new yt),mc(ri._EMPTY),mc(ri._EMPTY.baseTexture)),ri._EMPTY}static get WHITE(){if(!ri._WHITE){const e=We.ADAPTER.createCanvas(16,16),t=e.getContext("2d");e.width=16,e.height=16,t.fillStyle="white",t.fillRect(0,0,16,16),ri._WHITE=new ri(yt.from(e)),mc(ri._WHITE),mc(ri._WHITE.baseTexture)}return ri._WHITE}};class Ua extends gt{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,i=!0){const n=this.baseTexture.resolution,r=Math.round(e*n)/n,a=Math.round(t*n)/n;this.valid=r>0&&a>0,this._frame.width=this.orig.width=r,this._frame.height=this.orig.height=a,i&&this.baseTexture.resize(r,a),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 Ua(new lb(e))}}class hb{constructor(e){this.texturePool={},this.textureOptions=e||{},this.enableFullScreen=!1,this._pixelsWidth=0,this._pixelsHeight=0}createTexture(e,t,i=Ei.NONE){const n=new lb(Object.assign({width:e,height:t,resolution:1,multisample:i},this.textureOptions));return new Ua(n)}getOptimalTexture(e,t,i=1,n=Ei.NONE){let r;e=Math.max(Math.ceil(e*i-1e-6),1),t=Math.max(Math.ceil(t*i-1e-6),1),!this.enableFullScreen||e!==this._pixelsWidth||t!==this._pixelsHeight?(e=ph(e),t=ph(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 a=this.texturePool[r].pop();return a||(a=this.createTexture(e,t,n)),a.filterPoolKey=r,a.setResolution(i),a}getFilterTexture(e,t,i){const n=this.getOptimalTexture(e.width,e.height,t||e.resolution,i||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 i=this.texturePool[t];if(i)for(let n=0;n0&&e.height>0;for(const t in this.texturePool){if(!(Number(t)<0))continue;const i=this.texturePool[t];if(i)for(let n=0;n1&&(c=this.getOptimalFilterTexture(l.width,l.height,t.resolution),c.filterFrame=l.filterFrame),i[u].apply(this,l,c,Cn.CLEAR,t);const d=l;l=c,c=d}i[u].apply(this,l,h.renderTexture,Cn.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=Cn.CLEAR){const{renderTexture:i,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 a=this.tempRect;a.x=0,a.y=0,a.width=e.filterFrame.width,a.height=e.filterFrame.height,i.bind(e,e.filterFrame,a)}else e!==this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?i.bind(e):this.renderer.renderTexture.bind(e,this.activeState.bindingSourceFrame,this.activeState.bindingDestinationFrame);const r=n.stateId&1||this.forceClear;(t===Cn.CLEAR||t===Cn.BLIT&&r)&&this.renderer.framebuffer.clear(0,0,0,0)}applyFilter(e,t,i,n){const r=this.renderer;r.state.set(e.state),this.bindAndClear(i,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(Pn.TRIANGLES)):(r.geometry.bind(this.quad),r.geometry.draw(Pn.TRIANGLE_STRIP))}calculateSpriteMatrix(e,t){const{sourceFrame:i,destinationFrame:n}=this.activeState,{orig:r}=t._texture,a=e.set(n.width,0,0,n.height,i.x,i.y),o=t.worldTransform.copyTo(li.TEMP_MATRIX);return o.invert(),a.prepend(o),a.scale(1/r.width,1/r.height),a.translate(t.anchor.x,t.anchor.y),a}destroy(){this.renderer=null,this.texturePool.clear(!1)}getOptimalFilterTexture(e,t,i=1,n=Ei.NONE){return this.texturePool.getOptimalTexture(e,t,i,n)}getFilterTexture(e,t,i){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,i||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 i=pc[0],n=pc[1],r=pc[2],a=pc[3];i.set(t.left,t.top),n.set(t.left,t.bottom),r.set(t.right,t.top),a.set(t.right,t.bottom),e.apply(i,i),e.apply(n,n),e.apply(r,r),e.apply(a,a);const o=Math.min(i.x,n.x,r.x,a.x),h=Math.min(i.y,n.y,r.y,a.y),l=Math.max(i.x,n.x,r.x,a.x),c=Math.max(i.y,n.y,r.y,a.y);t.x=o,t.y=h,t.width=l-o,t.height=c-h}roundFrame(e,t,i,n,r){if(!(e.width<=0||e.height<=0||i.width<=0||i.height<=0)){if(r){const{a,b:o,c:h,d:l}=r;if((Math.abs(o)>1e-4||Math.abs(h)>1e-4)&&(Math.abs(a)>1e-4||Math.abs(l)>1e-4))return}r=r?Qd.copyFrom(r):Qd.identity(),r.translate(-i.x,-i.y).scale(n.width/i.width,n.height/i.height).translate(n.x,n.y),this.transformAABB(r,e),e.ceil(t),this.transformAABB(r.invert(),e)}}}db.extension={type:He.RendererSystem,name:"filter"};tt.add(db);class rE{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 aE=new Tt;class fb{constructor(e){this.renderer=e,this.managedFramebuffers=[],this.unknownFramebuffer=new tm(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 Tt,this.hasMRT=!0,this.writeDepthTexture=!0,this.renderer.context.webGLVersion===1){let t=this.renderer.context.extensions.drawBuffers,i=this.renderer.context.extensions.depthTexture;We.PREFER_ENV===Na.WEBGL_LEGACY&&(t=null,i=null),t?e.drawBuffers=n=>t.drawBuffersWEBGL(n):(this.hasMRT=!1,e.drawBuffers=()=>{}),i||(this.writeDepthTexture=!1)}else this.msaaSamples=e.getInternalformatParameter(e.RENDERBUFFER,e.RGBA8,e.SAMPLES)}bind(e,t,i=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!==i&&(e.dirtyId++,e.dirtyFormat++,r.mipLevel=i),r.dirtyId!==e.dirtyId&&(r.dirtyId=e.dirtyId,r.dirtyFormat!==e.dirtyFormat?(r.dirtyFormat=e.dirtyFormat,r.dirtySize=e.dirtySize,this.updateFramebuffer(e,i)):r.dirtySize!==e.dirtySize&&(r.dirtySize=e.dirtySize,this.resizeFramebuffer(e)));for(let a=0;a>i,o=t.height>>i,h=a/t.width;this.setViewport(t.x*h,t.y*h,a,o)}else{const a=e.width>>i,o=e.height>>i;this.setViewport(0,0,a,o)}}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,i,n){const r=this.viewport;e=Math.round(e),t=Math.round(t),i=Math.round(i),n=Math.round(n),(r.width!==i||r.height!==n||r.x!==e||r.y!==t)&&(r.x=e,r.y=t,r.width=i,r.height=n,this.gl.viewport(e,t,i,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,i,n,r=Vf.COLOR|Vf.DEPTH){const{gl:a}=this;a.clearColor(e,t,i,n),a.clear(r)}initFramebuffer(e){const{gl:t}=this,i=new rE(t.createFramebuffer());return i.multisample=this.detectSamples(e.multisample),e.glFramebuffers[this.CONTEXT_UID]=i,this.managedFramebuffers.push(e),e.disposeRunner.add(this),i}resizeFramebuffer(e){const{gl:t}=this,i=e.glFramebuffers[this.CONTEXT_UID];if(i.stencil){t.bindRenderbuffer(t.RENDERBUFFER,i.stencil);let a;this.renderer.context.webGLVersion===1?a=t.DEPTH_STENCIL:e.depth&&e.stencil?a=t.DEPTH24_STENCIL8:e.depth?a=t.DEPTH_COMPONENT24:a=t.STENCIL_INDEX8,i.msaaBuffer?t.renderbufferStorageMultisample(t.RENDERBUFFER,i.multisample,a,e.width,e.height):t.renderbufferStorage(t.RENDERBUFFER,a,e.width,e.height)}const n=e.colorTextures;let r=n.length;t.drawBuffers||(r=Math.min(r,1));for(let a=0;a1&&this.canMultisampleFramebuffer(e)?n.msaaBuffer=n.msaaBuffer||i.createRenderbuffer():n.msaaBuffer&&(i.deleteRenderbuffer(n.msaaBuffer),n.msaaBuffer=null,n.blitFramebuffer&&(n.blitFramebuffer.dispose(),n.blitFramebuffer=null));const o=[];for(let h=0;h1&&i.drawBuffers(o),e.depthTexture&&this.writeDepthTexture){const h=e.depthTexture;this.renderer.texture.bind(h,0),i.framebufferTexture2D(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.TEXTURE_2D,h._glTextures[this.CONTEXT_UID].texture,t)}if((e.stencil||e.depth)&&!(e.depthTexture&&this.writeDepthTexture)){n.stencil=n.stencil||i.createRenderbuffer();let h,l;this.renderer.context.webGLVersion===1?(h=i.DEPTH_STENCIL_ATTACHMENT,l=i.DEPTH_STENCIL):e.depth&&e.stencil?(h=i.DEPTH_STENCIL_ATTACHMENT,l=i.DEPTH24_STENCIL8):e.depth?(h=i.DEPTH_ATTACHMENT,l=i.DEPTH_COMPONENT24):(h=i.STENCIL_ATTACHMENT,l=i.STENCIL_INDEX8),i.bindRenderbuffer(i.RENDERBUFFER,n.stencil),n.msaaBuffer?i.renderbufferStorageMultisample(i.RENDERBUFFER,n.multisample,l,e.width,e.height):i.renderbufferStorage(i.RENDERBUFFER,l,e.width,e.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,h,i.RENDERBUFFER,n.stencil)}else n.stencil&&(i.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 i=Ei.NONE;if(e<=1||t===null)return i;for(let n=0;n=0&&this.managedFramebuffers.splice(r,1),e.disposeRunner.remove(this),t||(n.deleteFramebuffer(i.framebuffer),i.msaaBuffer&&n.deleteRenderbuffer(i.msaaBuffer),i.stencil&&n.deleteRenderbuffer(i.stencil)),i.blitFramebuffer&&this.disposeFramebuffer(i.blitFramebuffer,t)}disposeAll(e){const t=this.managedFramebuffers;this.managedFramebuffers=[];for(let i=0;ii.createVertexArrayOES(),e.bindVertexArray=n=>i.bindVertexArrayOES(n),e.deleteVertexArray=n=>i.deleteVertexArrayOES(n)):(this.hasVao=!1,e.createVertexArray=()=>null,e.bindVertexArray=()=>null,e.deleteVertexArray=()=>null)}if(t.webGLVersion!==2){const i=e.getExtension("ANGLE_instanced_arrays");i?(e.vertexAttribDivisor=(n,r)=>i.vertexAttribDivisorANGLE(n,r),e.drawElementsInstanced=(n,r,a,o,h)=>i.drawElementsInstancedANGLE(n,r,a,o,h),e.drawArraysInstanced=(n,r,a,o)=>i.drawArraysInstancedANGLE(n,r,a,o)):this.hasInstance=!1}this.canUseUInt32ElementIndex=t.webGLVersion===2||!!t.extensions.uint32ElementIndex}bind(e,t){t=t||this.renderer.shader.shader;const{gl:i}=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 a=n[t.program.id]||this.initGeometryVao(e,t,r);this._activeGeometry=e,this._activeVao!==a&&(this._activeVao=a,this.hasVao?i.bindVertexArray(a):this.activateVao(e,t.program)),this.updateBuffers()}reset(){this.unbind()}updateBuffers(){const e=this._activeGeometry,t=this.renderer.buffer;for(let i=0;i"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 i=this.mapCoord;for(let n=0;n0?this.maskStack[this.maskStack.length-1]._colorMask:15;i!==t&&this.renderer.gl.colorMask((i&1)!==0,(i&2)!==0,(i&4)!==0,(i&8)!==0)}destroy(){this.renderer=null}}pb.extension={type:He.RendererSystem,name:"mask"};tt.add(pb);class gb{constructor(e){this.renderer=e,this.maskStack=[],this.glConst=0}getStackLength(){return this.maskStack.length}setMaskStack(e){const{gl:t}=this.renderer,i=this.getStackLength();this.maskStack=e;const n=this.getStackLength();n!==i&&(n===0?t.disable(this.glConst):(t.enable(this.glConst),this._useCurrent()))}_useCurrent(){}destroy(){this.renderer=null,this.maskStack=null}}const sv=new li,nv=[],vb=class $c extends gb{constructor(e){super(e),this.glConst=We.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:i}=e,{renderer:n}=this,r=n.renderTexture,a=i.getBounds(!0,nv.pop()??new Tt);this.roundFrameToPixels(a,r.current?r.current.resolution:n.resolution,r.sourceFrame,r.destinationFrame,n.projection.transform),t&&a.fit(t),e._scissorRectLocal=a}static isMatrixRotated(e){if(!e)return!1;const{a:t,b:i,c:n,d:r}=e;return(Math.abs(i)>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()||$c.isMatrixRotated(t.worldTransform)||$c.isMatrixRotated(this.renderer.projection.transform))return!1;this.calcScissorRect(e);const i=e._scissorRectLocal;return i.width>0&&i.height>0}roundFrameToPixels(e,t,i,n,r){$c.isMatrixRotated(r)||(r=r?sv.copyFrom(r):sv.identity(),r.translate(-i.x,-i.y).scale(n.width/i.width,n.height/i.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&&nv.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)}};vb.extension={type:He.RendererSystem,name:"scissor"};let uE=vb;tt.add(uE);class yb extends gb{constructor(e){super(e),this.glConst=We.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:i}=this.renderer,n=e._stencilCounter;n===0&&(this.renderer.framebuffer.forceStencil(),i.clearStencil(0),i.clear(i.STENCIL_BUFFER_BIT),i.enable(i.STENCIL_TEST)),e._stencilCounter++;const r=e._colorMask;r!==0&&(e._colorMask=0,i.colorMask(!1,!1,!1,!1)),i.stencilFunc(i.EQUAL,n,4294967295),i.stencilOp(i.KEEP,i.KEEP,i.INCR),t.renderable=!0,t.render(this.renderer),this.renderer.batch.flush(),t.renderable=!1,r!==0&&(e._colorMask=r,i.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 i=this.maskStack.length!==0?this.maskStack[this.maskStack.length-1]:null,n=i?i._colorMask:15;n!==0&&(i._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&&(i._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)}}yb.extension={type:He.RendererSystem,name:"stencil"};tt.add(yb);class xb{constructor(e){this.renderer=e,this.plugins={},Object.defineProperties(this.plugins,{extract:{enumerable:!1,get(){return kt("7.0.0","renderer.plugins.extract has moved to renderer.extract"),e.extract}},prepare:{enumerable:!1,get(){return kt("7.0.0","renderer.plugins.prepare has moved to renderer.prepare"),e.prepare}},interaction:{enumerable:!1,get(){return kt("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}}xb.extension={type:[He.RendererSystem,He.CanvasRendererSystem],name:"_plugin"};tt.add(xb);class bb{constructor(e){this.renderer=e,this.destinationFrame=null,this.sourceFrame=null,this.defaultFrame=null,this.projectionMatrix=new li,this.transform=null}update(e,t,i,n){this.destinationFrame=e||this.destinationFrame||this.defaultFrame,this.sourceFrame=t||this.sourceFrame||e,this.calculateProjection(this.destinationFrame,this.sourceFrame,i,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,i,n){const r=this.projectionMatrix,a=n?-1:1;r.identity(),r.a=1/t.width*2,r.d=a*(1/t.height*2),r.tx=-1-t.x*r.a,r.ty=-a-t.y*r.d}setTransform(e){}destroy(){this.renderer=null}}bb.extension={type:He.RendererSystem,name:"projection"};tt.add(bb);const dE=new mp,rv=new Tt;class wb{constructor(e){this.renderer=e,this._tempMatrix=new li}generateTexture(e,t){const{region:i,...n}=t||{},r=(i==null?void 0:i.copyTo(rv))||e.getLocalBounds(rv,!0),a=n.resolution||this.renderer.resolution;r.width=Math.max(r.width,1/a),r.height=Math.max(r.height,1/a),n.width=r.width,n.height=r.height,n.resolution=a,n.multisample??(n.multisample=this.renderer.multisample);const o=Ua.create(n);this._tempMatrix.tx=-r.x,this._tempMatrix.ty=-r.y;const h=e.transform;return e.transform=dE,this.renderer.render(e,{renderTexture:o,transform:this._tempMatrix,skipUpdateTransform:!!e.parent,blit:!0}),e.transform=h,o}destroy(){}}wb.extension={type:[He.RendererSystem,He.CanvasRendererSystem],name:"textureGenerator"};tt.add(wb);const oa=new Tt,zo=new Tt;class Sb{constructor(e){this.renderer=e,this.defaultMaskStack=[],this.current=null,this.sourceFrame=new Tt,this.destinationFrame=new Tt,this.viewportFrame=new Tt}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,i){const n=this.renderer;this.current=e;let r,a,o;e?(r=e.baseTexture,o=r.resolution,t||(oa.width=e.frame.width,oa.height=e.frame.height,t=oa),i||(zo.x=e.frame.x,zo.y=e.frame.y,zo.width=t.width,zo.height=t.height,i=zo),a=r.framebuffer):(o=n.resolution,t||(oa.width=n._view.screen.width,oa.height=n._view.screen.height,t=oa),i||(i=oa,i.width=t.width,i.height=t.height));const h=this.viewportFrame;h.x=i.x*o,h.y=i.y*o,h.width=i.width*o,h.height=i.height*o,e||(h.y=n.view.height-(h.y+h.height)),h.ceil(),this.renderer.framebuffer.bind(a,h),this.renderer.projection.update(i,t,o,!a),e?this.renderer.mask.setMaskStack(r.maskStack):this.renderer.mask.setMaskStack(this.defaultMaskStack),this.sourceFrame.copyFrom(t),this.destinationFrame.copyFrom(i)}clear(e,t){const i=this.current?this.current.baseTexture.clear:this.renderer.background.backgroundColor,n=jt.shared.setValue(e||i);(this.current&&this.current.baseTexture.alphaMode>0||!this.current&&this._rendererPremultipliedAlpha)&&n.premultiply(n.alpha);const r=this.destinationFrame,a=this.current?this.current.baseTexture:this.renderer._view.screen,o=r.width!==a.width||r.height!==a.height;if(o){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),o&&this.renderer.scissor.pop()}resize(){this.bind(null)}reset(){this.bind(null)}destroy(){this.renderer=null}}Sb.extension={type:He.RendererSystem,name:"renderTexture"};tt.add(Sb);class fE{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 mE(s,e){const t={},i=e.getProgramParameter(s,e.ACTIVE_ATTRIBUTES);for(let n=0;nl>c?1:-1);for(let l=0;l({data:r,offset:0,dataLen:0,dirty:0}));let t=0,i=0,n=0;for(let r=0;r1&&(t=Math.max(t,16)*a.data.size),a.dataLen=t,i%t!==0&&i<16){const o=i%t%16;i+=o,n+=o}i+t>16?(n=Math.ceil(n/16)*16,a.offset=n,n+=t,i=t):(a.offset=n,i+=t,n+=t)}return n=Math.ceil(n/16)*16,{uboElements:e,size:n}}function bE(s,e){const t=[];for(const i in s)e[i]&&t.push(e[i]);return t.sort((i,n)=>i.index-n.index),t}function wE(s,e){if(!s.autoManage)return{size:0,syncFunc:vE};const t=bE(s.uniforms,e),{uboElements:i,size:n}=xE(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 a=0;a1){const u=nb(o.data.type),d=Math.max(Mb[o.data.type]/16,1),f=u/d,p=(4-f%4)%4;r.push(` cv = ud.${l}.value; v = uv.${l}; offset = ${o.offset/4}; t = 0; for(var i=0; i < ${o.data.size*d}; i++) { for(var j = 0; j < ${f}; j++) { data[offset++] = v[t++]; } offset += ${p}; } `)}else{const u=yE[o.data.type];r.push(` cv = ud.${l}.value; v = uv.${l}; offset = ${o.offset/4}; ${u}; `)}}return r.push(` renderer.buffer.update(buffer); `),{size:n,syncFunc:new Function("ud","uv","renderer","syncData","buffer",r.join(` `))}}let SE=0;const gc={textureCount:0,uboCount:0};class _b{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=SE++}systemCheck(){if(!zA())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 i=e.program,n=i.glPrograms[this.renderer.CONTEXT_UID]||this.generateProgram(e);return this.shader=e,this.program!==i&&(this.program=i,this.gl.useProgram(n.program)),t||(gc.textureCount=0,gc.uboCount=0,this.syncUniformGroup(e.uniformGroup,gc)),n}setUniforms(e){const t=this.shader.program,i=t.glPrograms[this.renderer.CONTEXT_UID];t.syncUniforms(i.uniformData,e,this.renderer)}syncUniformGroup(e,t){const i=this.getGlProgram();(!e.static||e.dirtyId!==i.uniformDirtyGroups[e.id])&&(i.uniformDirtyGroups[e.id]=e.dirtyId,this.syncUniforms(e,i,t))}syncUniforms(e,t,i){(e.syncUniforms[this.shader.program.id]||this.createSyncGroups(e))(t.uniformData,e.uniforms,this.renderer,i)}createSyncGroups(e){const t=this.getSignature(e,this.shader.program.uniformData,"u");return this.cache[t]||(this.cache[t]=$A(e,this.shader.program.uniformData)),e.syncUniforms[this.shader.program.id]=this.cache[t],e.syncUniforms[this.shader.program.id]}syncUniformBufferGroup(e,t){const i=this.getGlProgram();if(!e.static||e.dirtyId!==0||!i.uniformGroups[e.id]){e.dirtyId=0;const n=i.uniformGroups[e.id]||this.createSyncBufferGroup(e,i,t);e.buffer.update(),n(i.uniformData,e.uniforms,this.renderer,gc,e.buffer)}this.renderer.buffer.bindBufferBase(e.buffer,i.uniformBufferBindings[t])}createSyncBufferGroup(e,t,i){const{gl:n}=this.renderer;this.renderer.buffer.bind(e.buffer);const r=this.gl.getUniformBlockIndex(t.program,i);t.uniformBufferBindings[i]=this.shader.uniformBindCount,n.uniformBlockBinding(t.program,r,this.shader.uniformBindCount),this.shader.uniformBindCount++;const a=this.getSignature(e,this.shader.program.uniformData,"ubo");let o=this._uboCache[a];if(o||(o=this._uboCache[a]=wE(e,this.shader.program.uniformData)),e.autoManage){const h=new Float32Array(o.size/4);e.buffer.update(h)}return t.uniformGroups[e.id]=o.syncFunc,t.uniformGroups[e.id]}getSignature(e,t,i){const n=e.uniforms,r=[`${i}-`];for(const a in n)r.push(a),t[a]&&r.push(t[a].type);return r.join("-")}getGlProgram(){return this.shader?this.shader.program.glPrograms[this.renderer.CONTEXT_UID]:null}generateProgram(e){const t=this.gl,i=e.program,n=gE(t,i);return i.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}}_b.extension={type:He.RendererSystem,name:"shader"};tt.add(_b);class bh{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(){}}bh.defaultOptions={hello:!1},bh.extension={type:[He.RendererSystem,He.CanvasRendererSystem],name:"startup"};tt.add(bh);function ME(s,e=[]){return e[dt.NORMAL]=[s.ONE,s.ONE_MINUS_SRC_ALPHA],e[dt.ADD]=[s.ONE,s.ONE],e[dt.MULTIPLY]=[s.DST_COLOR,s.ONE_MINUS_SRC_ALPHA,s.ONE,s.ONE_MINUS_SRC_ALPHA],e[dt.SCREEN]=[s.ONE,s.ONE_MINUS_SRC_COLOR,s.ONE,s.ONE_MINUS_SRC_ALPHA],e[dt.OVERLAY]=[s.ONE,s.ONE_MINUS_SRC_ALPHA],e[dt.DARKEN]=[s.ONE,s.ONE_MINUS_SRC_ALPHA],e[dt.LIGHTEN]=[s.ONE,s.ONE_MINUS_SRC_ALPHA],e[dt.COLOR_DODGE]=[s.ONE,s.ONE_MINUS_SRC_ALPHA],e[dt.COLOR_BURN]=[s.ONE,s.ONE_MINUS_SRC_ALPHA],e[dt.HARD_LIGHT]=[s.ONE,s.ONE_MINUS_SRC_ALPHA],e[dt.SOFT_LIGHT]=[s.ONE,s.ONE_MINUS_SRC_ALPHA],e[dt.DIFFERENCE]=[s.ONE,s.ONE_MINUS_SRC_ALPHA],e[dt.EXCLUSION]=[s.ONE,s.ONE_MINUS_SRC_ALPHA],e[dt.HUE]=[s.ONE,s.ONE_MINUS_SRC_ALPHA],e[dt.SATURATION]=[s.ONE,s.ONE_MINUS_SRC_ALPHA],e[dt.COLOR]=[s.ONE,s.ONE_MINUS_SRC_ALPHA],e[dt.LUMINOSITY]=[s.ONE,s.ONE_MINUS_SRC_ALPHA],e[dt.NONE]=[0,0],e[dt.NORMAL_NPM]=[s.SRC_ALPHA,s.ONE_MINUS_SRC_ALPHA,s.ONE,s.ONE_MINUS_SRC_ALPHA],e[dt.ADD_NPM]=[s.SRC_ALPHA,s.ONE,s.ONE,s.ONE],e[dt.SCREEN_NPM]=[s.SRC_ALPHA,s.ONE_MINUS_SRC_COLOR,s.ONE,s.ONE_MINUS_SRC_ALPHA],e[dt.SRC_IN]=[s.DST_ALPHA,s.ZERO],e[dt.SRC_OUT]=[s.ONE_MINUS_DST_ALPHA,s.ZERO],e[dt.SRC_ATOP]=[s.DST_ALPHA,s.ONE_MINUS_SRC_ALPHA],e[dt.DST_OVER]=[s.ONE_MINUS_DST_ALPHA,s.ONE],e[dt.DST_IN]=[s.ZERO,s.SRC_ALPHA],e[dt.DST_OUT]=[s.ZERO,s.ONE_MINUS_SRC_ALPHA],e[dt.DST_ATOP]=[s.ONE_MINUS_DST_ALPHA,s.SRC_ALPHA],e[dt.XOR]=[s.ONE_MINUS_DST_ALPHA,s.ONE_MINUS_SRC_ALPHA],e[dt.SUBTRACT]=[s.ONE,s.ONE,s.ONE,s.ONE,s.FUNC_REVERSE_SUBTRACT,s.FUNC_ADD],e}const _E=0,TE=1,AE=2,EE=3,CE=4,IE=5,Tb=class im{constructor(){this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode=dt.NONE,this._blendEq=!1,this.map=[],this.map[_E]=this.setBlend,this.map[TE]=this.setOffset,this.map[AE]=this.setCullFace,this.map[EE]=this.setDepthTest,this.map[CE]=this.setFrontFace,this.map[IE]=this.setDepthMask,this.checks=[],this.defaultState=new Un,this.defaultState.blend=!0}contextChange(e){this.gl=e,this.blendModes=ME(e),this.set(this.defaultState),this.reset()}set(e){if(e=e||this.defaultState,this.stateId!==e.data){let t=this.stateId^e.data,i=0;for(;t;)t&1&&this.map[i].call(this,!!(e.data&1<>1,i++;this.stateId=e.data}for(let t=0;te.systems[n]),i=[...t,...Object.keys(e.systems).filter(n=>!t.includes(n))];for(const n of i)this.addSystem(e.systems[n],n)}addRunners(...e){e.forEach(t=>{this.runners[t]=new on(t)})}addSystem(e,t){const i=new e(this);if(this[t])throw new Error(`Whoops! The name "${t}" is already in use`);this[t]=i,this._systemsHash[t]=i;for(const n in this.runners)this.runners[n].add(i);return this}emitWithCustomOptions(e,t){const i=Object.keys(this._systemsHash);e.items.forEach(n=>{const r=i.find(a=>this._systemsHash[a]===n);n[e.name](t[r])})}destroy(){Object.values(this.runners).forEach(e=>{e.destroy()}),this._systemsHash={}}}const nl=class Gc{constructor(e){this.renderer=e,this.count=0,this.checkCount=0,this.maxIdle=Gc.defaultMaxIdle,this.checkCountMax=Gc.defaultCheckCountMax,this.mode=Gc.defaultMode}postrender(){this.renderer.objectRenderer.renderingToScreen&&(this.count++,this.mode!==hp.MANUAL&&(this.checkCount++,this.checkCount>this.checkCountMax&&(this.checkCount=0,this.run())))}run(){const e=this.renderer.texture,t=e.managedTextures;let i=!1;for(let n=0;nthis.maxIdle&&(e.destroyTexture(r,!0),t[n]=null,i=!0)}if(i){let n=0;for(let r=0;r=0;n--)this.unload(e.children[n])}destroy(){this.renderer=null}};nl.defaultMode=hp.AUTO,nl.defaultMaxIdle=3600,nl.defaultCheckCountMax=600,nl.extension={type:He.RendererSystem,name:"textureGC"};let pa=nl;tt.add(pa);class tf{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=et.UNSIGNED_BYTE,this.internalFormat=Ne.RGBA,this.samplerType=0}}function kE(s){let e;return"WebGL2RenderingContext"in globalThis&&s instanceof globalThis.WebGL2RenderingContext?e={[s.RGB]:ze.FLOAT,[s.RGBA]:ze.FLOAT,[s.ALPHA]:ze.FLOAT,[s.LUMINANCE]:ze.FLOAT,[s.LUMINANCE_ALPHA]:ze.FLOAT,[s.R8]:ze.FLOAT,[s.R8_SNORM]:ze.FLOAT,[s.RG8]:ze.FLOAT,[s.RG8_SNORM]:ze.FLOAT,[s.RGB8]:ze.FLOAT,[s.RGB8_SNORM]:ze.FLOAT,[s.RGB565]:ze.FLOAT,[s.RGBA4]:ze.FLOAT,[s.RGB5_A1]:ze.FLOAT,[s.RGBA8]:ze.FLOAT,[s.RGBA8_SNORM]:ze.FLOAT,[s.RGB10_A2]:ze.FLOAT,[s.RGB10_A2UI]:ze.FLOAT,[s.SRGB8]:ze.FLOAT,[s.SRGB8_ALPHA8]:ze.FLOAT,[s.R16F]:ze.FLOAT,[s.RG16F]:ze.FLOAT,[s.RGB16F]:ze.FLOAT,[s.RGBA16F]:ze.FLOAT,[s.R32F]:ze.FLOAT,[s.RG32F]:ze.FLOAT,[s.RGB32F]:ze.FLOAT,[s.RGBA32F]:ze.FLOAT,[s.R11F_G11F_B10F]:ze.FLOAT,[s.RGB9_E5]:ze.FLOAT,[s.R8I]:ze.INT,[s.R8UI]:ze.UINT,[s.R16I]:ze.INT,[s.R16UI]:ze.UINT,[s.R32I]:ze.INT,[s.R32UI]:ze.UINT,[s.RG8I]:ze.INT,[s.RG8UI]:ze.UINT,[s.RG16I]:ze.INT,[s.RG16UI]:ze.UINT,[s.RG32I]:ze.INT,[s.RG32UI]:ze.UINT,[s.RGB8I]:ze.INT,[s.RGB8UI]:ze.UINT,[s.RGB16I]:ze.INT,[s.RGB16UI]:ze.UINT,[s.RGB32I]:ze.INT,[s.RGB32UI]:ze.UINT,[s.RGBA8I]:ze.INT,[s.RGBA8UI]:ze.UINT,[s.RGBA16I]:ze.INT,[s.RGBA16UI]:ze.UINT,[s.RGBA32I]:ze.INT,[s.RGBA32UI]:ze.UINT,[s.DEPTH_COMPONENT16]:ze.FLOAT,[s.DEPTH_COMPONENT24]:ze.FLOAT,[s.DEPTH_COMPONENT32F]:ze.FLOAT,[s.DEPTH_STENCIL]:ze.FLOAT,[s.DEPTH24_STENCIL8]:ze.FLOAT,[s.DEPTH32F_STENCIL8]:ze.FLOAT}:e={[s.RGB]:ze.FLOAT,[s.RGBA]:ze.FLOAT,[s.ALPHA]:ze.FLOAT,[s.LUMINANCE]:ze.FLOAT,[s.LUMINANCE_ALPHA]:ze.FLOAT,[s.DEPTH_STENCIL]:ze.FLOAT},e}function FE(s){let e;return"WebGL2RenderingContext"in globalThis&&s instanceof globalThis.WebGL2RenderingContext?e={[et.UNSIGNED_BYTE]:{[Ne.RGBA]:s.RGBA8,[Ne.RGB]:s.RGB8,[Ne.RG]:s.RG8,[Ne.RED]:s.R8,[Ne.RGBA_INTEGER]:s.RGBA8UI,[Ne.RGB_INTEGER]:s.RGB8UI,[Ne.RG_INTEGER]:s.RG8UI,[Ne.RED_INTEGER]:s.R8UI,[Ne.ALPHA]:s.ALPHA,[Ne.LUMINANCE]:s.LUMINANCE,[Ne.LUMINANCE_ALPHA]:s.LUMINANCE_ALPHA},[et.BYTE]:{[Ne.RGBA]:s.RGBA8_SNORM,[Ne.RGB]:s.RGB8_SNORM,[Ne.RG]:s.RG8_SNORM,[Ne.RED]:s.R8_SNORM,[Ne.RGBA_INTEGER]:s.RGBA8I,[Ne.RGB_INTEGER]:s.RGB8I,[Ne.RG_INTEGER]:s.RG8I,[Ne.RED_INTEGER]:s.R8I},[et.UNSIGNED_SHORT]:{[Ne.RGBA_INTEGER]:s.RGBA16UI,[Ne.RGB_INTEGER]:s.RGB16UI,[Ne.RG_INTEGER]:s.RG16UI,[Ne.RED_INTEGER]:s.R16UI,[Ne.DEPTH_COMPONENT]:s.DEPTH_COMPONENT16},[et.SHORT]:{[Ne.RGBA_INTEGER]:s.RGBA16I,[Ne.RGB_INTEGER]:s.RGB16I,[Ne.RG_INTEGER]:s.RG16I,[Ne.RED_INTEGER]:s.R16I},[et.UNSIGNED_INT]:{[Ne.RGBA_INTEGER]:s.RGBA32UI,[Ne.RGB_INTEGER]:s.RGB32UI,[Ne.RG_INTEGER]:s.RG32UI,[Ne.RED_INTEGER]:s.R32UI,[Ne.DEPTH_COMPONENT]:s.DEPTH_COMPONENT24},[et.INT]:{[Ne.RGBA_INTEGER]:s.RGBA32I,[Ne.RGB_INTEGER]:s.RGB32I,[Ne.RG_INTEGER]:s.RG32I,[Ne.RED_INTEGER]:s.R32I},[et.FLOAT]:{[Ne.RGBA]:s.RGBA32F,[Ne.RGB]:s.RGB32F,[Ne.RG]:s.RG32F,[Ne.RED]:s.R32F,[Ne.DEPTH_COMPONENT]:s.DEPTH_COMPONENT32F},[et.HALF_FLOAT]:{[Ne.RGBA]:s.RGBA16F,[Ne.RGB]:s.RGB16F,[Ne.RG]:s.RG16F,[Ne.RED]:s.R16F},[et.UNSIGNED_SHORT_5_6_5]:{[Ne.RGB]:s.RGB565},[et.UNSIGNED_SHORT_4_4_4_4]:{[Ne.RGBA]:s.RGBA4},[et.UNSIGNED_SHORT_5_5_5_1]:{[Ne.RGBA]:s.RGB5_A1},[et.UNSIGNED_INT_2_10_10_10_REV]:{[Ne.RGBA]:s.RGB10_A2,[Ne.RGBA_INTEGER]:s.RGB10_A2UI},[et.UNSIGNED_INT_10F_11F_11F_REV]:{[Ne.RGB]:s.R11F_G11F_B10F},[et.UNSIGNED_INT_5_9_9_9_REV]:{[Ne.RGB]:s.RGB9_E5},[et.UNSIGNED_INT_24_8]:{[Ne.DEPTH_STENCIL]:s.DEPTH24_STENCIL8},[et.FLOAT_32_UNSIGNED_INT_24_8_REV]:{[Ne.DEPTH_STENCIL]:s.DEPTH32F_STENCIL8}}:e={[et.UNSIGNED_BYTE]:{[Ne.RGBA]:s.RGBA,[Ne.RGB]:s.RGB,[Ne.ALPHA]:s.ALPHA,[Ne.LUMINANCE]:s.LUMINANCE,[Ne.LUMINANCE_ALPHA]:s.LUMINANCE_ALPHA},[et.UNSIGNED_SHORT_5_6_5]:{[Ne.RGB]:s.RGB},[et.UNSIGNED_SHORT_4_4_4_4]:{[Ne.RGBA]:s.RGBA},[et.UNSIGNED_SHORT_5_5_5_1]:{[Ne.RGBA]:s.RGBA}},e}class Ab{constructor(e){this.renderer=e,this.boundTextures=[],this.currentLocation=-1,this.managedTextures=[],this._unknownBoundTextures=!1,this.unknownTexture=new yt,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=FE(e),this.samplerTypes=kE(e);const t=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS);this.boundTextures.length=t;for(let n=0;n=0;--r){const a=t[r];a&&a._glTextures[n].samplerType!==ze.FLOAT&&this.renderer.texture.unbind(a)}}initTexture(e){const t=new tf(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 i;t.internalFormat=((i=this.internalFormats[e.type])==null?void 0:i[e.format])??e.format,t.samplerType=this.samplerTypes[t.internalFormat]??ze.FLOAT,this.webGLVersion===2&&e.type===et.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 i=this.renderer;if(this.initTextureType(e,t),(n=e.resource)==null?void 0:n.upload(i,e,t))t.samplerType!==ze.FLOAT&&(this.hasIntegerTextures=!0);else{const r=e.realWidth,a=e.realHeight,o=i.gl;(t.width!==r||t.height!==a||t.dirtyId<0)&&(t.width=r,t.height=a,o.texImage2D(e.target,0,t.internalFormat,r,a,0,e.format,t.type,null))}e.dirtyStyleId!==t.dirtyStyleId&&this.updateTextureStyle(e),t.dirtyId=e.dirtyId}destroyTexture(e,t){const{gl:i}=this;if(e=e.castToBaseTexture(),e._glTextures[this.CONTEXT_UID]&&(this.unbind(e),i.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&&yo(this.managedTextures,n,1)}}updateTextureStyle(e){var i;const t=e._glTextures[this.CONTEXT_UID];t&&((e.mipmap===Ys.POW2||this.webGLVersion!==2)&&!e.isPowerOfTwo?t.mipmap=!1:t.mipmap=e.mipmap>=1,this.webGLVersion!==2&&!e.isPowerOfTwo?t.wrapMode=an.CLAMP:t.wrapMode=e.wrapMode,(i=e.resource)!=null&&i.style(this.renderer,e,t)||this.setStyle(e,t),t.dirtyStyleId=e.dirtyStyleId)}setStyle(e,t){const i=this.gl;if(t.mipmap&&e.mipmap!==Ys.ON_MANUAL&&i.generateMipmap(e.target),i.texParameteri(e.target,i.TEXTURE_WRAP_S,t.wrapMode),i.texParameteri(e.target,i.TEXTURE_WRAP_T,t.wrapMode),t.mipmap){i.texParameteri(e.target,i.TEXTURE_MIN_FILTER,e.scaleMode===sn.LINEAR?i.LINEAR_MIPMAP_LINEAR:i.NEAREST_MIPMAP_NEAREST);const n=this.renderer.context.extensions.anisotropicFiltering;if(n&&e.anisotropicLevel>0&&e.scaleMode===sn.LINEAR){const r=Math.min(e.anisotropicLevel,i.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT));i.texParameterf(e.target,n.TEXTURE_MAX_ANISOTROPY_EXT,r)}}else i.texParameteri(e.target,i.TEXTURE_MIN_FILTER,e.scaleMode===sn.LINEAR?i.LINEAR:i.NEAREST);i.texParameteri(e.target,i.TEXTURE_MAG_FILTER,e.scaleMode===sn.LINEAR?i.LINEAR:i.NEAREST)}destroy(){this.renderer=null}}Ab.extension={type:He.RendererSystem,name:"texture"};tt.add(Ab);class Eb{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:i}=this,n=e._glTransformFeedbacks[i]||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:i,renderer:n}=this;t&&n.shader.bind(t),i.beginTransformFeedback(e)}endTransformFeedback(){const{gl:e}=this;e.endTransformFeedback()}createGLTransformFeedback(e){const{gl:t,renderer:i,CONTEXT_UID:n}=this,r=t.createTransformFeedback();e._glTransformFeedbacks[n]=r,t.bindTransformFeedback(t.TRANSFORM_FEEDBACK,r);for(let a=0;a(s[s.INTERACTION=50]="INTERACTION",s[s.HIGH=25]="HIGH",s[s.NORMAL=0]="NORMAL",s[s.LOW=-25]="LOW",s[s.UTILITY=-50]="UTILITY",s))(Oa||{});class sf{constructor(e,t=null,i=0,n=!1){this.next=null,this.previous=null,this._destroyed=!1,this.fn=e,this.context=t,this.priority=i,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 Cb=class Ms{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 sf(null,null,1/0),this.deltaMS=1/Ms.targetFPMS,this.elapsedMS=1/Ms.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,i=Oa.NORMAL){return this._addListener(new sf(e,t,i))}addOnce(e,t,i=Oa.NORMAL){return this._addListener(new sf(e,t,i,!0))}_addListener(e){let t=this._head.next,i=this._head;if(!t)e.connect(i);else{for(;t;){if(e.priority>t.priority){e.connect(i);break}i=t,t=t.next}e.previous||e.connect(i)}return this._startIfPossible(),this}remove(e,t){let i=this._head.next;for(;i;)i.match(e,t)?i=i.destroy():i=i.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._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=e.sharedTicker?ds.shared:new ds,e.autoStart&&this.start()}static destroy(){if(this._ticker){const e=this._ticker;this.ticker=null,e.destroy()}}}Ib.extension=He.Application;tt.add(Ib);const Rb=[];tt.handleByList(He.Renderer,Rb);function OE(s){for(const e of Rb)if(e.test(s))return new e(s);throw new Error("Unable to auto-detect a suitable renderer.")}var BE=`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; }`,LE=`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 DE=BE,Pb=LE;class kb{constructor(e){this.renderer=e}contextChange(e){let t;if(this.renderer.context.webGLVersion===1){const i=e.getParameter(e.FRAMEBUFFER_BINDING);e.bindFramebuffer(e.FRAMEBUFFER,null),t=e.getParameter(e.SAMPLES),e.bindFramebuffer(e.FRAMEBUFFER,i)}else{const i=e.getParameter(e.DRAW_FRAMEBUFFER_BINDING);e.bindFramebuffer(e.DRAW_FRAMEBUFFER,null),t=e.getParameter(e.SAMPLES),e.bindFramebuffer(e.DRAW_FRAMEBUFFER,i)}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(){}}kb.extension={type:He.RendererSystem,name:"_multisample"};tt.add(kb);class NE{constructor(e){this.buffer=e||null,this.updateID=-1,this.byteLength=-1,this.refCount=0}}class Fb{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:i}=this,n=e._glBuffers[i]||this.createGLBuffer(e);t.bindBuffer(e.type,n.buffer)}unbind(e){const{gl:t}=this;t.bindBuffer(e,null)}bindBufferBase(e,t){const{gl:i,CONTEXT_UID:n}=this;if(this.boundBufferBases[t]!==e){const r=e._glBuffers[n]||this.createGLBuffer(e);this.boundBufferBases[t]=e,i.bindBufferBase(i.UNIFORM_BUFFER,t,r.buffer)}}bindBufferRange(e,t,i){const{gl:n,CONTEXT_UID:r}=this;i=i||0;const a=e._glBuffers[r]||this.createGLBuffer(e);n.bindBufferRange(n.UNIFORM_BUFFER,t||0,a.buffer,i*256,256)}update(e){const{gl:t,CONTEXT_UID:i}=this,n=e._glBuffers[i]||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 i=e._glBuffers[this.CONTEXT_UID],n=this.gl;e.disposeRunner.remove(this),i&&(t||n.deleteBuffer(i.buffer),delete e._glBuffers[this.CONTEXT_UID])}disposeAll(e){const t=Object.keys(this.managedBuffers);for(let i=0;it.resource).filter(t=>t).map(t=>t.load());return this._load=Promise.all(e).then(()=>{const{realWidth:t,realHeight:i}=this.items[0];return this.resize(t,i),this.update(),Promise.resolve(this)}),this._load}}class UE extends Bb{constructor(e,t){const{width:i,height:n}=t||{};let r,a;Array.isArray(e)?(r=e,a=e.length):a=e,super(a,{width:i,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=vo.TEXTURE_2D_ARRAY}upload(e,t,i){const{length:n,itemDirtyIds:r,items:a}=this,{gl:o}=e;i.dirtyId<0&&o.texImage3D(o.TEXTURE_2D_ARRAY,0,i.internalFormat,this._width,this._height,n,0,t.format,i.type,null);for(let h=0;h0)if(e.resource)this.addResourceAt(e.resource,t);else throw new Error("CubeResource does not support copying of renderTexture.");else e.target=vo.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,i){const n=this.itemDirtyIds;for(let r=0;r{if(this.url===null){e(this);return}try{const i=await We.ADAPTER.fetch(this.url,{mode:this.crossOrigin?"cors":"no-cors"});if(this.destroyed)return;const n=await i.blob();if(this.destroyed)return;const r=await createImageBitmap(n,{premultiplyAlpha:this.alphaMode===null||this.alphaMode===Ni.UNPACK?"premultiply":"none"});if(this.destroyed){r.close();return}this.source=r,this.update(),e(this)}catch(i){if(this.destroyed)return;t(i),this.onError.emit(i)}}),this._load)}upload(e,t,i){return this.source instanceof ImageBitmap?(typeof this.alphaMode=="number"&&(t.alphaMode=this.alphaMode),super.upload(e,t,i)):(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 lo._EMPTY=lo._EMPTY??We.ADAPTER.createCanvas(0,0),lo._EMPTY}}const nm=class jc extends gr{constructor(e,t){t=t||{},super(We.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)},jc.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;gr.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,i=e.height;if(!t||!i)throw new Error("The SVG image must have width and height defined (in pixels), canvas API needs them.");let n=t*this.scale,r=i*this.scale;(this._overrideWidth||this._overrideHeight)&&(n=this._overrideWidth||this._overrideHeight/i*t,r=this._overrideHeight||this._overrideWidth/t*i),n=Math.round(n),r=Math.round(r);const a=this.source;a.width=n,a.height=r,a._pixiId=`canvas_${Fa()}`,a.getContext("2d").drawImage(e,0,0,t,i,0,0,n,r),this._resolve(),this._resolve=null}}static getSize(e){const t=jc.SVG_SIZE.exec(e),i={};return t&&(i[t[1]]=Math.round(parseFloat(t[3])),i[t[5]]=Math.round(parseFloat(t[7]))),i}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"&&jc.SVG_XML.test(e)}};nm.SVG_XML=/^(<\?xml[^?]+\?>)?\s*()]*-->)?\s*\]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i;let rm=nm;class YE extends gr{constructor(e){super(e)}static test(e){return!!globalThis.VideoFrame&&e instanceof globalThis.VideoFrame}}const am=class om extends gr{constructor(e,t){if(t=t||{},!(e instanceof HTMLVideoElement)){const i=document.createElement("video");t.autoLoad!==!1&&i.setAttribute("preload","auto"),t.playsinline!==!1&&(i.setAttribute("webkit-playsinline",""),i.setAttribute("playsinline","")),t.muted===!0&&(i.setAttribute("muted",""),i.muted=!0),t.loop===!0&&i.setAttribute("loop",""),t.autoPlay!==!1&&i.setAttribute("autoplay",""),typeof e=="string"&&(e=[e]);const n=e[0].src||e[0];gr.crossOrigin(i,n,t.crossorigin);for(let r=0;r{this.valid?t(this):(this._resolve=t,this._reject=i,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&&(ds.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||(ds.shared.add(this.update,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.source.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(ds.shared.remove(this.update,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(e,t){return globalThis.HTMLVideoElement&&e instanceof HTMLVideoElement||om.TYPES.includes(t)}};am.TYPES=["mp4","m4v","webm","ogg","ogv","h264","avi","mov"],am.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};let Db=am;Wf.push(lo,cb,XE,Db,YE,rm,yu,VE,UE);class Bl{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?Tt.EMPTY:(e=e||new Tt(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:i,b:n,c:r,d:a,tx:o,ty:h}=e,l=i*t.x+r*t.y+o,c=n*t.x+a*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,i=this.minY,n=this.maxX,r=this.maxY,a=e[0],o=e[1];t=an?a:n,r=o>r?o:r,a=e[2],o=e[3],t=an?a:n,r=o>r?o:r,a=e[4],o=e[5],t=an?a:n,r=o>r?o:r,a=e[6],o=e[7],t=an?a:n,r=o>r?o:r,this.minX=t,this.minY=i,this.maxX=n,this.maxY=r}addFrame(e,t,i,n,r){this.addFrameMatrix(e.worldTransform,t,i,n,r)}addFrameMatrix(e,t,i,n,r){const a=e.a,o=e.b,h=e.c,l=e.d,c=e.tx,u=e.ty;let d=this.minX,f=this.minY,p=this.maxX,m=this.maxY,g=a*t+h*i+c,v=o*t+l*i+u;d=gp?g:p,m=v>m?v:m,g=a*n+h*i+c,v=o*n+l*i+u,d=gp?g:p,m=v>m?v:m,g=a*t+h*r+c,v=o*t+l*r+u,d=gp?g:p,m=v>m?v:m,g=a*n+h*r+c,v=o*n+l*r+u,d=gp?g:p,m=v>m?v:m,this.minX=d,this.minY=f,this.maxX=p,this.maxY=m}addVertexData(e,t,i){let n=this.minX,r=this.minY,a=this.maxX,o=this.maxY;for(let h=t;ha?l:a,o=c>o?c:o}this.minX=n,this.minY=r,this.maxX=a,this.maxY=o}addVertices(e,t,i,n){this.addVerticesMatrix(e.worldTransform,t,i,n)}addVerticesMatrix(e,t,i,n,r=0,a=r){const o=e.a,h=e.b,l=e.c,c=e.d,u=e.tx,d=e.ty;let f=this.minX,p=this.minY,m=this.maxX,g=this.maxY;for(let v=i;vn?e.maxX:n,this.maxY=e.maxY>r?e.maxY:r}addBoundsMask(e,t){const i=e.minX>t.minX?e.minX:t.minX,n=e.minY>t.minY?e.minY:t.minY,r=e.maxXl?r:l,this.maxY=a>c?a:c}}addBoundsMatrix(e,t){this.addFrameMatrix(t,e.minX,e.minY,e.maxX,e.maxY)}addBoundsArea(e,t){const i=e.minX>t.x?e.minX:t.x,n=e.minY>t.y?e.minY:t.y,r=e.maxXl?r:l,this.maxY=a>c?a:c}}pad(e=0,t=e){this.isEmpty()||(this.minX-=e,this.maxX+=e,this.minY-=t,this.maxY+=t)}addFramePad(e,t,i,n,r,a){e-=r,t-=a,i+=r,n+=a,this.minX=this.minXi?this.maxX:i,this.minY=this.minYn?this.maxY:n}}class yi extends jl{constructor(){super(),this.tempDisplayObjectParent=null,this.transform=new mp,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 Bl,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 i=0;i1)for(let t=0;tthis.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 i=this.getChildIndex(e),n=this.getChildIndex(t);this.children[i]=t,this.children[n]=e,this.onChildrenChange(i=this.children.length)throw new Error(`The index ${t} supplied is out of bounds ${this.children.length}`);const i=this.getChildIndex(e);yo(this.children,i,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;t0&&r<=n){a=this.children.splice(i,r);for(let o=0;o1&&this.children.sort(HE),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;e0&&t.height>0))return;let i,n;this.cullArea?(i=this.cullArea,n=this.worldTransform):this._render!==lm.prototype._render&&(i=this.getBounds(!0));const r=e.projection.transform;if(r&&(n?(n=GE.copyFrom(n),n.prepend(r)):n=r),i&&t.intersects(i,n))this._render(e);else if(this.cullArea)return;for(let a=0,o=this.children.length;a=n&&qo.x=r&&qo.y=t&&(a=s-o-1),h=h.replace("%value%",e[a].toString()),n+=h,n+=` `}return i=i.replace("%blur%",n),i=i.replace("%size%",s.toString()),i}const QE=` 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 eC(s,e){const t=Math.ceil(s/2);let i=QE,n="",r;e?r="vBlurTexCoords[%index%] = textureCoord + vec2(%sampleIndex% * strength, 0.0);":r="vBlurTexCoords[%index%] = textureCoord + vec2(0.0, %sampleIndex% * strength);";for(let a=0;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 hm extends us{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(Pb,iC,e),this.alpha=1}_loadMatrix(e,t=!1){let i=e;t&&(this._multiply(i,this.uniforms.m,e),i=this._colorMatrix(i)),this.uniforms.m=i}_multiply(e,t,i){return e[0]=t[0]*i[0]+t[1]*i[5]+t[2]*i[10]+t[3]*i[15],e[1]=t[0]*i[1]+t[1]*i[6]+t[2]*i[11]+t[3]*i[16],e[2]=t[0]*i[2]+t[1]*i[7]+t[2]*i[12]+t[3]*i[17],e[3]=t[0]*i[3]+t[1]*i[8]+t[2]*i[13]+t[3]*i[18],e[4]=t[0]*i[4]+t[1]*i[9]+t[2]*i[14]+t[3]*i[19]+t[4],e[5]=t[5]*i[0]+t[6]*i[5]+t[7]*i[10]+t[8]*i[15],e[6]=t[5]*i[1]+t[6]*i[6]+t[7]*i[11]+t[8]*i[16],e[7]=t[5]*i[2]+t[6]*i[7]+t[7]*i[12]+t[8]*i[17],e[8]=t[5]*i[3]+t[6]*i[8]+t[7]*i[13]+t[8]*i[18],e[9]=t[5]*i[4]+t[6]*i[9]+t[7]*i[14]+t[8]*i[19]+t[9],e[10]=t[10]*i[0]+t[11]*i[5]+t[12]*i[10]+t[13]*i[15],e[11]=t[10]*i[1]+t[11]*i[6]+t[12]*i[11]+t[13]*i[16],e[12]=t[10]*i[2]+t[11]*i[7]+t[12]*i[12]+t[13]*i[17],e[13]=t[10]*i[3]+t[11]*i[8]+t[12]*i[13]+t[13]*i[18],e[14]=t[10]*i[4]+t[11]*i[9]+t[12]*i[14]+t[13]*i[19]+t[14],e[15]=t[15]*i[0]+t[16]*i[5]+t[17]*i[10]+t[18]*i[15],e[16]=t[15]*i[1]+t[16]*i[6]+t[17]*i[11]+t[18]*i[16],e[17]=t[15]*i[2]+t[16]*i[7]+t[17]*i[12]+t[18]*i[17],e[18]=t[15]*i[3]+t[16]*i[8]+t[17]*i[13]+t[18]*i[18],e[19]=t[15]*i[4]+t[16]*i[9]+t[17]*i[14]+t[18]*i[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 i=[e,0,0,0,0,0,e,0,0,0,0,0,e,0,0,0,0,0,1,0];this._loadMatrix(i,t)}tint(e,t){const[i,n,r]=jt.shared.setValue(e).toArray(),a=[i,0,0,0,0,0,n,0,0,0,0,0,r,0,0,0,0,0,1,0];this._loadMatrix(a,t)}greyscale(e,t){const i=[e,e,e,0,0,e,e,e,0,0,e,e,e,0,0,0,0,0,1,0];this._loadMatrix(i,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 i=Math.cos(e),n=Math.sin(e),r=Math.sqrt,a=1/3,o=r(a),h=i+(1-i)*a,l=a*(1-i)-o*n,c=a*(1-i)+o*n,u=a*(1-i)+o*n,d=i+a*(1-i),f=a*(1-i)-o*n,p=a*(1-i)-o*n,m=a*(1-i)+o*n,g=i+a*(1-i),v=[h,l,c,0,0,u,d,f,0,0,p,m,g,0,0,0,0,0,1,0];this._loadMatrix(v,t)}contrast(e,t){const i=(e||0)+1,n=-.5*(i-1),r=[i,0,0,0,n,0,i,0,0,n,0,0,i,0,n,0,0,0,1,0];this._loadMatrix(r,t)}saturate(e=0,t){const i=e*2/3+1,n=(i-1)*-.5,r=[i,n,n,0,0,n,i,n,0,0,n,n,i,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,i,n,r){e=e||.2,t=t||.15,i=i||16770432,n=n||3375104;const a=jt.shared,[o,h,l]=a.setValue(i).toArray(),[c,u,d]=a.setValue(n).toArray(),f=[.3,.59,.11,0,0,o,h,l,e,0,c,u,d,t,0,o-c,h-u,l-d,0,0];this._loadMatrix(f,r)}night(e,t){e=e||.1;const i=[e*-2,-e,0,0,0,-e,0,e,0,0,0,e,e*2,0,0,0,0,0,1,0];this._loadMatrix(i,t)}predator(e,t){const i=[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(i,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}}hm.prototype.grayscale=hm.prototype.greyscale;var sC=`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)); } `,nC=`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 rC extends us{constructor(e,t){const i=new li;e.renderable=!1,super(nC,sC,{mapSampler:e._texture,filterMatrix:i,scale:{x:1,y:1},rotation:new Float32Array([1,0,0,1])}),this.maskSprite=e,this.maskMatrix=i,t==null&&(t=20),this.scale=new Ut(t,t)}apply(e,t,i,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,a=Math.sqrt(r.a*r.a+r.b*r.b),o=Math.sqrt(r.c*r.c+r.d*r.d);a!==0&&o!==0&&(this.uniforms.rotation[0]=r.a/a,this.uniforms.rotation[1]=r.b/a,this.uniforms.rotation[2]=r.c/o,this.uniforms.rotation[3]=r.d/o),e.applyFilter(this,t,i,n)}get map(){return this.uniforms.mapSampler}set map(e){this.uniforms.mapSampler=e}}var aC=`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; } `,oC=` 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 lC extends us{constructor(){super(oC,aC)}}var cC=`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 hC extends us{constructor(e=.5,t=Math.random()){super(Pb,cC,{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 av={AlphaFilter:qE,BlurFilter:tC,BlurFilterPass:cm,ColorMatrixFilter:hm,DisplacementFilter:rC,FXAAFilter:lC,NoiseFilter:hC};Object.entries(av).forEach(([s,e])=>{Object.defineProperty(av,s,{get(){return kt("7.1.0",`filters.${s} has moved to ${s}`),e}})});class uC{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||(ds.system.add(this.tickerUpdate,this,Oa.INTERACTION),this.tickerAdded=!0)}removeTickerListener(){this.tickerAdded&&(ds.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._deltaTimei.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 i=0,n=t.length;i=0;n--)if(e.currentTarget=i[n],this.notifyTarget(e,t),e.propagationStopped||e.propagationImmediatelyStopped)return}}all(e,t,i=this._allInteractiveElements){if(i.length===0)return;e.eventPhase=e.BUBBLING_PHASE;const n=Array.isArray(t)?t:[t];for(let r=i.length-1;r>=0;r--)n.forEach(a=>{e.currentTarget=i[r],this.notifyTarget(e,a)})}propagationPath(e){const t=[e];for(let i=0;i=0;u--){const d=c[u],f=this.hitTestMoveRecursive(d,this._isInteractive(t)?t:d.eventMode,i,n,r,a||r(e,i));if(f){if(f.length>0&&!f[f.length-1].parent)continue;const p=e.isInteractive();(f.length>0||p)&&(p&&this._allInteractiveElements.push(e),f.push(e)),this._hitElements.length===0&&(this._hitElements=f),o=!0}}}const h=this._isInteractive(t),l=e.isInteractive();return h&&l&&this._allInteractiveElements.push(e),a||this._hitElements.length>0?null:o?this._hitElements:h&&!r(e,i)&&n(e,i)?l?[e]:[]:null}hitTestRecursive(e,t,i,n,r){if(this._interactivePrune(e)||r(e,i))return null;if((e.eventMode==="dynamic"||t==="dynamic")&&(Or.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,i,n,r);if(u){if(u.length>0&&!u[u.length-1].parent)continue;const d=e.isInteractive();return(u.length>0||d)&&u.push(e),u}}}const a=this._isInteractive(t),o=e.isInteractive();return a&&n(e,i)?o?[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 i;if(e.hitArea&&(e.worldTransform.applyInverse(t,nf),!e.hitArea.contains(nf.x,nf.y)))return!0;if(e._mask){const n=e._mask.isMaskData?e._mask.maskObject:e._mask;if(n&&!((i=n.containsPoint)!=null&&i.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,a;t=t??e.type;const i=`on${t}`;(a=(r=e.currentTarget)[i])==null||a.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 Js)){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 i=this.trackingData(e.pointerId);i.pressTargetsByButton[e.button]=t.composedPath(),this.freeEvent(t)}mapPointerMove(e){var h,l;if(!(e instanceof Js)){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 i=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"),i&&this.dispatchEvent(u,"mouseout"),!t.composedPath().includes(r)){const d=this.createPointerEvent(e,"pointerleave",r);for(d.eventPhase=d.AT_TARGET;d.target&&!t.composedPath().includes(d.target);)d.currentTarget=d.target,this.notifyTarget(d),i&&this.notifyTarget(d,"mouseleave"),d.target=d.target.parent;this.freeEvent(d)}this.freeEvent(u)}if(r!==t.target){const c=e.type==="mousemove"?"mouseover":"pointerover",u=this.clonePointerEvent(t,c);this.dispatchEvent(u,"pointerover"),i&&this.dispatchEvent(u,"mouseover");let d=r==null?void 0:r.parent;for(;d&&d!==this.rootTarget.parent&&d!==t.target;)d=d.parent;if(!d||d===this.rootTarget.parent){const f=this.clonePointerEvent(t,"pointerenter");for(f.eventPhase=f.AT_TARGET;f.target&&f.target!==r&&f.target!==this.rootTarget.parent;)f.currentTarget=f.target,this.notifyTarget(f),i&&this.notifyTarget(f,"mouseenter"),f.target=f.target.parent;this.freeEvent(f)}this.freeEvent(u)}const a=[],o=this.enableGlobalMoveEvents??!0;this.moveOnAll?a.push("pointermove"):this.dispatchEvent(t,"pointermove"),o&&a.push("globalpointermove"),t.pointerType==="touch"&&(this.moveOnAll?a.splice(1,0,"touchmove"):this.dispatchEvent(t,"touchmove"),o&&a.push("globaltouchmove")),i&&(this.moveOnAll?a.splice(1,0,"mousemove"):this.dispatchEvent(t,"mousemove"),o&&a.push("globalmousemove"),this.cursor=(l=t.target)==null?void 0:l.cursor),a.length>0&&this.all(t,a),this._allInteractiveElements.length=0,this._hitElements.length=0,n.overTargets=t.composedPath(),this.freeEvent(t)}mapPointerOver(e){var a;if(!(e instanceof Js)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const t=this.trackingData(e.pointerId),i=this.createPointerEvent(e),n=i.pointerType==="mouse"||i.pointerType==="pen";this.dispatchEvent(i,"pointerover"),n&&this.dispatchEvent(i,"mouseover"),i.pointerType==="mouse"&&(this.cursor=(a=i.target)==null?void 0:a.cursor);const r=this.clonePointerEvent(i,"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=i.composedPath(),this.freeEvent(i),this.freeEvent(r)}mapPointerOut(e){if(!(e instanceof Js)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const t=this.trackingData(e.pointerId);if(t.overTargets){const i=e.pointerType==="mouse"||e.pointerType==="pen",n=this.findMountedTarget(t.overTargets),r=this.createPointerEvent(e,"pointerout",n);this.dispatchEvent(r),i&&this.dispatchEvent(r,"mouseout");const a=this.createPointerEvent(e,"pointerleave",n);for(a.eventPhase=a.AT_TARGET;a.target&&a.target!==this.rootTarget.parent;)a.currentTarget=a.target,this.notifyTarget(a),i&&this.notifyTarget(a,"mouseleave"),a.target=a.target.parent;t.overTargets=null,this.freeEvent(r),this.freeEvent(a)}this.cursor=null}mapPointerUp(e){if(!(e instanceof Js)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const t=performance.now(),i=this.createPointerEvent(e);if(this.dispatchEvent(i,"pointerup"),i.pointerType==="touch")this.dispatchEvent(i,"touchend");else if(i.pointerType==="mouse"||i.pointerType==="pen"){const o=i.button===2;this.dispatchEvent(i,o?"rightup":"mouseup")}const n=this.trackingData(e.pointerId),r=this.findMountedTarget(n.pressTargetsByButton[e.button]);let a=r;if(r&&!i.composedPath().includes(r)){let o=r;for(;o&&!i.composedPath().includes(o);){if(i.currentTarget=o,this.notifyTarget(i,"pointerupoutside"),i.pointerType==="touch")this.notifyTarget(i,"touchendoutside");else if(i.pointerType==="mouse"||i.pointerType==="pen"){const h=i.button===2;this.notifyTarget(i,h?"rightupoutside":"mouseupoutside")}o=o.parent}delete n.pressTargetsByButton[e.button],a=o}if(a){const o=this.clonePointerEvent(i,"click");o.target=a,o.path=null,n.clicksByButton[e.button]||(n.clicksByButton[e.button]={clickCount:0,target:o.target,timeStamp:t});const h=n.clicksByButton[e.button];if(h.target===o.target&&t-h.timeStamp<200?++h.clickCount:h.clickCount=1,h.target=o.target,h.timeStamp=t,o.detail=h.clickCount,o.pointerType==="mouse"){const l=o.button===2;this.dispatchEvent(o,l?"rightclick":"click")}else o.pointerType==="touch"&&this.dispatchEvent(o,"tap");this.dispatchEvent(o,"pointertap"),this.freeEvent(o)}this.freeEvent(i)}mapPointerUpOutside(e){if(!(e instanceof Js)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const t=this.trackingData(e.pointerId),i=this.findMountedTarget(t.pressTargetsByButton[e.button]),n=this.createPointerEvent(e);if(i){let r=i;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 bo)){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 i=1;i(i==="globalMove"&&(this.rootBoundary.enableGlobalMoveEvents=n),t[i]=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:i}=this.renderer;this.setTargetElement(t),this.resolution=i,dm._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 i=this.cursorStyles[e];if(i)switch(typeof i){case"string":t&&(this.domElement.style.cursor=i);break;case"function":i(e);break;case"object":t&&Object.assign(this.domElement.style,i);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 i=0,n=t.length;i0&&(t=e.composedPath()[0]);const i=t!==this.domElement?"outside":"",n=this.normalizeToPointerData(e);for(let r=0,a=n.length;r"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 i=e;typeof i.isPrimary>"u"&&(i.isPrimary=!0),typeof i.width>"u"&&(i.width=1),typeof i.height>"u"&&(i.height=1),typeof i.tiltX>"u"&&(i.tiltX=0),typeof i.tiltY>"u"&&(i.tiltY=0),typeof i.pointerType>"u"&&(i.pointerType="mouse"),typeof i.pointerId>"u"&&(i.pointerId=pC),typeof i.pressure>"u"&&(i.pressure=.5),typeof i.twist>"u"&&(i.twist=0),typeof i.tangentialPressure>"u"&&(i.tangentialPressure=0),i.isNormalized=!0,t.push(i)}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=gC[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}};um.extension={name:"events",type:[He.RendererSystem,He.CanvasRendererSystem]},um.defaultEventFeatures={move:!0,globalMove:!0,click:!0,wheel:!0};let fm=um;tt.add(fm);function ov(s){return s==="dynamic"||s==="static"}const vC={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??ov(fm.defaultEventMode)},set interactive(s){kt("7.2.0","Setting interactive is deprecated, use eventMode = 'none'/'passive'/'auto'/'static'/'dynamic' instead."),this._internalInteractive=s,this.eventMode=s?"static":"auto"},_internalEventMode:void 0,get eventMode(){return this._internalEventMode??fm.defaultEventMode},set eventMode(s){this._internalInteractive=ov(s),this._internalEventMode=s},isInteractive(){return this.eventMode==="static"||this.eventMode==="dynamic"},interactiveChildren:!0,hitArea:null,addEventListener(s,e,t){const i=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,a=typeof e=="function"?void 0:e;s=i?`${s}capture`:s;const o=typeof e=="function"?e:e.handleEvent,h=this;n&&n.addEventListener("abort",()=>{h.off(s,o,a)}),r?h.once(s,o,a):h.on(s,o,a)},removeEventListener(s,e,t){const i=typeof t=="boolean"&&t||typeof t=="object"&&t.capture,n=typeof e=="function"?void 0:e;s=i?`${s}capture`:s,e=typeof e=="function"?e:e.handleEvent,this.off(s,e,n)},dispatchEvent(s){if(!(s instanceof Wl))throw new Error("DisplayObject cannot propagate events outside of the Federated Events API");return s.defaultPrevented=!1,s.path=null,s.target=this,s.manager.dispatchEvent(s),!s.defaultPrevented}};yi.mixin(vC);const yC={accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:!1,_accessibleDiv:null,accessibleType:"button",accessiblePointerEvents:"auto",accessibleChildren:!0,renderId:-1};yi.mixin(yC);const xC=9,vc=100,bC=0,wC=0,lv=2,cv=1,SC=-1e3,MC=-1e3,_C=2;class Xb{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,(ir.tablet||ir.phone)&&this.createTouchHook();const t=document.createElement("div");t.style.width=`${vc}px`,t.style.height=`${vc}px`,t.style.position="absolute",t.style.top=`${bC}px`,t.style.left=`${wC}px`,t.style.zIndex=lv.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=`${cv}px`,e.style.height=`${cv}px`,e.style.position="absolute",e.style.top=`${SC}px`,e.style.left=`${MC}px`,e.style.zIndex=_C.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 i=0;i title : ${e.title}
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:i}=this.renderer;e.x+e.width>t&&(e.width=t-e.x),e.y+e.height>i&&(e.height=i-e.y)}addChild(e){let t=this.pool.pop();t||(t=document.createElement("button"),t.style.width=`${vc}px`,t.style.height=`${vc}px`,t.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",t.style.position="absolute",t.style.zIndex=lv.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:i}=e.target,n=this.renderer.events.rootBoundary,r=Object.assign(new Wl(n),{target:i});n.rootTarget=this.renderer.lastObjectRendered,t.forEach(a=>n.dispatchEvent(r,a))}_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===xC&&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}}Xb.extension={name:"accessibility",type:[He.RendererPlugin,He.CanvasRendererPlugin]};tt.add(Xb);const Vb=class mm{constructor(e){this.stage=new ji,e=Object.assign({forceCanvas:!1},e),this.renderer=OE(e),mm._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 i=mm._plugins.slice(0);i.reverse(),i.forEach(n=>{n.destroy.call(this)}),this.stage.destroy(t),this.stage=null,this.renderer.destroy(e),this.renderer=null}};Vb._plugins=[];let Yb=Vb;tt.handleByList(He.Application,Yb._plugins);class $b{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,i;if(this._resizeTo===globalThis.window)t=globalThis.innerWidth,i=globalThis.innerHeight;else{const{clientWidth:n,clientHeight:r}=this._resizeTo;t=n,i=r}this.renderer.resize(t,i),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}}$b.extension=He.Application;tt.add($b);const hv={loader:He.LoadParser,resolver:He.ResolveParser,cache:He.CacheParser,detection:He.DetectionParser};tt.handle(He.Asset,s=>{const e=s.ref;Object.entries(hv).filter(([t])=>!!e[t]).forEach(([t,i])=>tt.add(Object.assign(e[t],{extension:e[t].extension??i})))},s=>{const e=s.ref;Object.keys(hv).filter(t=>!!e[t]).forEach(t=>tt.remove(e[t]))});class TC{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 i=0;i(Array.isArray(s)||(s=[s]),e?s.map(i=>typeof i=="string"||t?e(i):i):s),Mh=(s,e)=>{const t=e.split("?")[1];return t&&(s+=`?${t}`),s};function Gb(s,e,t,i,n){const r=e[t];for(let a=0;a{const a=r.substring(1,r.length-1).split(",");n.push(a)}),Gb(s,n,0,t,i)}else i.push(s);return i}const _h=s=>!Array.isArray(s);class EC{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 i=en(e);let n;for(let o=0;o{n[o]=t}));const r=Object.keys(n),a={cacheKeys:r,keys:i};if(i.forEach(o=>{this._cacheMap.set(o,a)}),r.forEach(o=>{const h=n?n[o]:t;this._cache.has(o)&&this._cache.get(o)!==h&&console.warn("[Cache] already has key:",o),this._cache.set(o,n[o])}),t instanceof gt){const o=t;i.forEach(h=>{o.baseTexture!==gt.EMPTY.baseTexture&&yt.addToCache(o.baseTexture,h),gt.addToCache(o,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(i=>{this._cache.delete(i)}),t.keys.forEach(i=>{this._cacheMap.delete(i)})}get parsers(){return this._parsers}}const va=new EC;class CC{constructor(){this._parsers=[],this._parsersValidated=!1,this.parsers=new Proxy(this._parsers,{set:(e,t,i)=>(this._parsersValidated=!1,e[t]=i,!0)}),this.promiseCache={}}reset(){this._parsersValidated=!1,this.promiseCache={}}_getLoadPromiseAndParser(e,t){const i={promise:null,parser:null};return i.promise=(async()=>{var a,o;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({alias:[l],src:l})),o=a.length,h=a.map(async l=>{const c=wi.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(++i/o)}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[a[0].src]:n}async unload(e){const t=en(e,i=>({alias:[i],src:i})).map(async i=>{var a,o;const n=wi.toAbsolute(i.src),r=this.promiseCache[n];if(r){const h=await r.promise;delete this.promiseCache[n],(o=(a=r.parser)==null?void 0:a.unload)==null||o.call(a,h,i,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 Is=(s=>(s[s.Low=0]="Low",s[s.Normal=1]="Normal",s[s.High=2]="High",s))(Is||{});const IC=".json",RC="application/json",PC={extension:{type:He.LoadParser,priority:Is.Low},name:"loadJson",test(s){return Do(s,RC)||bs(s,IC)},async load(s){return await(await We.ADAPTER.fetch(s)).json()}};tt.add(PC);const kC=".txt",FC="text/plain",OC={name:"loadTxt",extension:{type:He.LoadParser,priority:Is.Low},test(s){return Do(s,FC)||bs(s,kC)},async load(s){return await(await We.ADAPTER.fetch(s)).text()}};tt.add(OC);const BC=["normal","bold","100","200","300","400","500","600","700","800","900"],LC=[".ttf",".otf",".woff",".woff2"],DC=["font/ttf","font/otf","font/woff","font/woff2"],NC=/^(--|-?[A-Z_])[0-9A-Z_-]*$/i;function UC(s){const e=wi.extname(s),t=wi.basename(s,e).replace(/(-|_)/g," ").toLowerCase().split(" ").map(r=>r.charAt(0).toUpperCase()+r.slice(1));let i=t.length>0;for(const r of t)if(!r.match(NC)){i=!1;break}let n=t.join(" ");return i||(n=`"${n.replace(/[\\"]/g,"\\$&")}"`),n}const XC=/^[0-9A-Za-z%:/?#\[\]@!\$&'()\*\+,;=\-._~]*$/;function VC(s){return XC.test(s)?s:encodeURI(s)}const YC={extension:{type:He.LoadParser,priority:Is.Low},name:"loadWebFont",test(s){return Do(s,DC)||bs(s,LC)},async load(s,e){var i,n,r;const t=We.ADAPTER.getFontFaceSet();if(t){const a=[],o=((i=e.data)==null?void 0:i.family)??UC(s),h=((r=(n=e.data)==null?void 0:n.weights)==null?void 0:r.filter(c=>BC.includes(c)))??["normal"],l=e.data??{};for(let c=0;cWe.ADAPTER.getFontFaceSet().delete(e))}};tt.add(YC);const $C=`(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 wo=null,pm=class{constructor(){wo||(wo=URL.createObjectURL(new Blob([$C],{type:"application/javascript"}))),this.worker=new Worker(wo)}};pm.revokeObjectURL=function(){wo&&(URL.revokeObjectURL(wo),wo=null)};const GC=`(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 So=null;class Hb{constructor(){So||(So=URL.createObjectURL(new Blob([GC],{type:"application/javascript"}))),this.worker=new Worker(So)}}Hb.revokeObjectURL=function(){So&&(URL.revokeObjectURL(So),So=null)};let uv=0,rf;class HC{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 pm;t.addEventListener("message",i=>{t.terminate(),pm.revokeObjectURL(),e(i.data)})}),this._isImageBitmapSupported)}loadImageBitmap(e){return this._run("loadImageBitmap",[e])}async _initWorkers(){this._initialized||(this._initialized=!0)}getWorker(){rf===void 0&&(rf=navigator.hardwareConcurrency||4);let e=this.workerPool.pop();return!e&&this._createdWorkers{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 i=new Promise((n,r)=>{this.queue.push({id:e,arguments:t,resolve:n,reject:r})});return this.next(),i}next(){if(!this.queue.length)return;const e=this.getWorker();if(!e)return;const t=this.queue.pop(),i=t.id;this.resolveHash[uv]={resolve:t.resolve,reject:t.reject},e.postMessage({data:t.arguments,uuid:uv++,id:i})}}const dv=new HC;function zl(s,e,t){s.resource.internal=!0;const i=new gt(s),n=()=>{delete e.promiseCache[t],va.has(t)&&va.remove(t)};return i.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())}),i.once("destroyed",()=>{s.destroyed||(console.warn("[Assets] A Texture managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the Texture."),n())}),i}const jC=[".jpeg",".jpg",".png",".webp",".avif"],WC=["image/jpeg","image/png","image/webp","image/avif"];async function zC(s){const e=await We.ADAPTER.fetch(s);if(!e.ok)throw new Error(`[loadImageBitmap] Failed to fetch ${s}: ${e.status} ${e.statusText}`);const t=await e.blob();return await createImageBitmap(t)}const Mu={name:"loadTextures",extension:{type:He.LoadParser,priority:Is.High},config:{preferWorkers:!0,preferCreateImageBitmap:!0,crossOrigin:"anonymous"},test(s){return Do(s,WC)||bs(s,jC)},async load(s,e,t){var o;const i=globalThis.createImageBitmap&&this.config.preferCreateImageBitmap;let n;i?this.config.preferWorkers&&await dv.isImageBitmapSupported()?n=await dv.loadImageBitmap(s):n=await zC(s):n=await new Promise((h,l)=>{const c=new Image;c.crossOrigin=this.config.crossOrigin,c.src=s,c.complete?h(c):(c.onload=()=>h(c),c.onerror=u=>l(u))});const r={...e.data};r.resolution??(r.resolution=pr(s)),i&&((o=r.resourceOptions)==null?void 0:o.ownsImageBitmap)===void 0&&(r.resourceOptions={...r.resourceOptions},r.resourceOptions.ownsImageBitmap=!0);const a=new yt(n,r);return a.resource.src=s,zl(a,t,s)},unload(s){s.destroy(!0)}};tt.add(Mu);const qC=".svg",KC="image/svg+xml",ZC={extension:{type:He.LoadParser,priority:Is.High},name:"loadSVG",test(s){return Do(s,KC)||bs(s,qC)},async testParse(s){return rm.test(s)},async parse(s,e,t){var r;const i=new rm(s,(r=e==null?void 0:e.data)==null?void 0:r.resourceOptions);await i.load();const n=new yt(i,{resolution:pr(s),...e==null?void 0:e.data});return n.resource.src=e.src,zl(n,t,e.src)},async load(s,e){return(await We.ADAPTER.fetch(s)).text()},unload:Mu.unload};tt.add(ZC);const JC=[".mp4",".m4v",".webm",".ogv"],QC=["video/mp4","video/webm","video/ogg"],e2={name:"loadVideo",extension:{type:He.LoadParser,priority:Is.High},config:{defaultAutoPlay:!0,defaultUpdateFPS:0,defaultLoop:!1,defaultMuted:!1,defaultPlaysinline:!0},test(s){return Do(s,QC)||bs(s,JC)},async load(s,e,t){var a;let i;const n=await(await We.ADAPTER.fetch(s)).blob(),r=URL.createObjectURL(n);try{const o={autoPlay:this.config.defaultAutoPlay,updateFPS:this.config.defaultUpdateFPS,loop:this.config.defaultLoop,muted:this.config.defaultMuted,playsinline:this.config.defaultPlaysinline,...(a=e==null?void 0:e.data)==null?void 0:a.resourceOptions,autoLoad:!0},h=new Db(r,o);await h.load();const l=new yt(h,{alphaMode:await oA(),resolution:pr(s),...e==null?void 0:e.data});l.resource.src=s,i=zl(l,t,s),i.baseTexture.once("destroyed",()=>{URL.revokeObjectURL(r)})}catch(o){throw URL.revokeObjectURL(r),o}return i},unload(s){s.destroy(!0)}};tt.add(e2);class t2{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(i=>`${encodeURIComponent(i)}=${encodeURIComponent(t[i])}`).join("&")}}getAlias(e){const{alias:t,name:i,src:n,srcs:r}=e;return en(t||i||n||r,a=>typeof a=="string"?a:Array.isArray(a)?a.map(o=>(o==null?void 0:o.src)??(o==null?void 0:o.srcs)??o):a!=null&&a.src||a!=null&&a.srcs?a.src??a.srcs:a,!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 i=[];Array.isArray(t)?t.forEach(n=>{const r=n.src??n.srcs,a=n.alias??n.name;let o;if(typeof a=="string"){const h=this._createBundleAssetId(e,a);i.push(h),o=[a,h]}else{const h=a.map(l=>this._createBundleAssetId(e,l));i.push(...h),o=[...a,...h]}this.add({...n,alias:o,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 a=t[n],o=a.src??a.srcs;this.add({...a,alias:r,src:Array.isArray(o)?o:[o]})}i.push(...r)}),this._bundles[e]=i}add(e,t,i,n,r){const a=[];typeof e=="string"||Array.isArray(e)&&typeof e[0]=="string"?(kt("7.2.0",`Assets.add now uses an object instead of individual parameters. Please use Assets.add({ alias, src, data, format, loadParser }) instead.`),a.push({alias:e,src:t,data:i,format:n,loadParser:r})):Array.isArray(e)?a.push(...e):a.push(e);let o;o=h=>{this.hasKey(h)&&console.warn(`[Resolver] already has key: ${h} overwriting`)},en(a).forEach(h=>{const{src:l,srcs:c}=h;let{data:u,format:d,loadParser:f}=h;const p=en(l||c).map(v=>typeof v=="string"?AC(v):Array.isArray(v)?v:[v]),m=this.getAlias(h);Array.isArray(m)?m.forEach(o):o(m);const g=[];p.forEach(v=>{v.forEach(b=>{let y={};if(typeof b!="object"){y.src=b;for(let w=0;w{this._assetMap[v]=g})})}resolveBundle(e){const t=_h(e);e=en(e);const i={};return e.forEach(n=>{const r=this._bundles[n];if(r){const a=this.resolve(r),o={};for(const h in a){const l=a[h];o[this._extractAssetIdFromBundle(n,h)]=l}i[n]=o}}),t?i[e[0]]:i}resolveUrl(e){const t=this.resolve(e);if(typeof e!="string"){const i={};for(const n in t)i[n]=t[n].src;return i}return t.src}resolve(e){const t=_h(e);e=en(e);const i={};return e.forEach(n=>{if(!this._resolverHash[n])if(this._assetMap[n]){let r=this._assetMap[n];const a=r[0],o=this._getPreferredOrder(r);o==null||o.priority.forEach(h=>{o.params[h].forEach(l=>{const c=r.filter(u=>u[h]?u[h]===l:!1);c.length&&(r=c)})}),this._resolverHash[n]=r[0]??a}else this._resolverHash[n]=this.buildResolvedAsset({alias:[n],src:n},{});i[n]=this._resolverHash[n]}),t?i[e[0]]:i}hasKey(e){return!!this._assetMap[e]}hasBundle(e){return!!this._bundles[e]}_getPreferredOrder(e){for(let t=0;tr.params.format.includes(i.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:i,data:n,loadParser:r,format:a}=t;return(this._basePath||this._rootPath)&&(e.src=wi.toAbsolute(e.src,this._basePath,this._rootPath)),e.alias=i??e.alias??[e.src],e.src=this._appendDefaultSearchParams(e.src),e.data={...n||{},...e.data},e.loadParser=r??e.loadParser,e.format=a??e.format??wi.extname(e.src).slice(1),e.srcs=e.src,e.name=e.alias,e}}class i2{constructor(){this._detections=[],this._initialized=!1,this.resolver=new t2,this.loader=new CC,this.cache=va,this._backgroundLoader=new TC(this.loader),this._backgroundLoader.active=!0,this.reset()}async init(e={}){var r,a;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 o=e.manifest;typeof o=="string"&&(o=await this.load(o)),this.resolver.addManifest(o)}const t=((r=e.texturePreference)==null?void 0:r.resolution)??1,i=typeof t=="number"?[t]:t,n=await this._detectFormats({preferredFormats:(a=e.texturePreference)==null?void 0:a.format,skipDetections:e.skipDetections,detections:this._detections});this.resolver.prefer({params:{format:n,resolution:i}}),e.preferences&&this.setPreferences(e.preferences)}add(e,t,i,n,r){this.resolver.add(e,t,i,n,r)}async load(e,t){this._initialized||await this.init();const i=_h(e),n=en(e).map(o=>{if(typeof o!="string"){const h=this.resolver.getAlias(o);return h.some(l=>!this.resolver.hasKey(l))&&this.add(o),Array.isArray(h)?h[0]:h}return this.resolver.hasKey(o)||this.add({alias:o,src:o}),o}),r=this.resolver.resolve(n),a=await this._mapLoadToResolve(r,t);return i?a[n[0]]:a}addBundle(e,t){this.resolver.addBundle(e,t)}async loadBundle(e,t){this._initialized||await this.init();let i=!1;typeof e=="string"&&(i=!0,e=[e]);const n=this.resolver.resolveBundle(e),r={},a=Object.keys(n);let o=0,h=0;const l=()=>{t==null||t(++o/h)},c=a.map(u=>{const d=n[u];return h+=Object.keys(d).length,this._mapLoadToResolve(d,l).then(f=>{r[u]=f})});return await Promise.all(c),i?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(i=>{this._backgroundLoader.add(Object.values(i))})}reset(){this.resolver.reset(),this.loader.reset(),this.cache.reset(),this._initialized=!1}get(e){if(typeof e=="string")return va.get(e);const t={};for(let i=0;i{const l=r[o.src],c=[o.src];o.alias&&c.push(...o.alias),a[n[h]]=l,va.set(c,l)}),a}async unload(e){this._initialized||await this.init();const t=en(e).map(n=>typeof n!="string"?n.src:n),i=this.resolver.resolve(t);await this._unloadFromResolved(i)}async unloadBundle(e){this._initialized||await this.init(),e=en(e);const t=this.resolver.resolveBundle(e),i=Object.keys(t).map(n=>this._unloadFromResolved(t[n]));await Promise.all(i)}async _unloadFromResolved(e){const t=Object.values(e);t.forEach(i=>{va.remove(i.src)}),await this.loader.unload(t)}async _detectFormats(e){let t=[];e.preferredFormats&&(t=Array.isArray(e.preferredFormats)?e.preferredFormats:[e.preferredFormats]);for(const i of e.detections)e.skipDetections||await i.test()?t=await i.add(t):e.skipDetections||(t=await i.remove(t));return t=t.filter((i,n)=>t.indexOf(i)===n),t}get detections(){return this._detections}get preferWorkers(){return Mu.config.preferWorkers}set preferWorkers(e){kt("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(i=>i in e).forEach(i=>{t.config[i]=e[i]})})}}const Fn=new i2;tt.handleByList(He.LoadParser,Fn.loader.parsers).handleByList(He.ResolveParser,Fn.resolver.parsers).handleByList(He.CacheParser,Fn.cache.parsers).handleByList(He.DetectionParser,Fn.detections);const s2={extension:He.CacheParser,test:s=>Array.isArray(s)&&s.every(e=>e instanceof gt),getCacheableAssets:(s,e)=>{const t={};return s.forEach(i=>{e.forEach((n,r)=>{t[i+(r===0?"":r+1)]=n})}),t}};tt.add(s2);async function jb(s){if("Image"in globalThis)return new Promise(e=>{const t=new Image;t.onload=()=>{e(!0)},t.onerror=()=>{e(!1)},t.src=s});if("createImageBitmap"in globalThis&&"fetch"in globalThis){try{const e=await(await fetch(s)).blob();await createImageBitmap(e)}catch{return!1}return!0}return!1}const n2={extension:{type:He.DetectionParser,priority:1},test:async()=>jb("data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A="),add:async s=>[...s,"avif"],remove:async s=>s.filter(e=>e!=="avif")};tt.add(n2);const r2={extension:{type:He.DetectionParser,priority:0},test:async()=>jb("data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA="),add:async s=>[...s,"webp"],remove:async s=>s.filter(e=>e!=="webp")};tt.add(r2);const fv=["png","jpg","jpeg"],a2={extension:{type:He.DetectionParser,priority:-1},test:()=>Promise.resolve(!0),add:async s=>[...s,...fv],remove:async s=>s.filter(e=>!fv.includes(e))};tt.add(a2);const o2="WorkerGlobalScope"in globalThis&&globalThis instanceof globalThis.WorkerGlobalScope;function yp(s){return o2?!1:document.createElement("video").canPlayType(s)!==""}const l2={extension:{type:He.DetectionParser,priority:0},test:async()=>yp("video/webm"),add:async s=>[...s,"webm"],remove:async s=>s.filter(e=>e!=="webm")};tt.add(l2);const c2={extension:{type:He.DetectionParser,priority:0},test:async()=>yp("video/mp4"),add:async s=>[...s,"mp4","m4v"],remove:async s=>s.filter(e=>e!=="mp4"&&e!=="m4v")};tt.add(c2);const h2={extension:{type:He.DetectionParser,priority:0},test:async()=>yp("video/ogg"),add:async s=>[...s,"ogv"],remove:async s=>s.filter(e=>e!=="ogv")};tt.add(h2);const u2={extension:He.ResolveParser,test:Mu.test,parse:s=>{var e;return{resolution:parseFloat(((e=We.RETINA_PREFIX.exec(s))==null?void 0:e[1])??"1"),format:wi.extname(s).slice(1),src:s}}};tt.add(u2);var Xi=(s=>(s[s.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",s[s.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",s[s.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",s[s.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",s[s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT=35917]="COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT",s[s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT=35918]="COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT",s[s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT=35919]="COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT",s[s.COMPRESSED_SRGB_S3TC_DXT1_EXT=35916]="COMPRESSED_SRGB_S3TC_DXT1_EXT",s[s.COMPRESSED_R11_EAC=37488]="COMPRESSED_R11_EAC",s[s.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",s[s.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",s[s.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",s[s.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",s[s.COMPRESSED_RGBA8_ETC2_EAC=37496]="COMPRESSED_RGBA8_ETC2_EAC",s[s.COMPRESSED_SRGB8_ETC2=37493]="COMPRESSED_SRGB8_ETC2",s[s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37497]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC",s[s.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37494]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",s[s.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37495]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",s[s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG=35840]="COMPRESSED_RGB_PVRTC_4BPPV1_IMG",s[s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG=35842]="COMPRESSED_RGBA_PVRTC_4BPPV1_IMG",s[s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG=35841]="COMPRESSED_RGB_PVRTC_2BPPV1_IMG",s[s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG=35843]="COMPRESSED_RGBA_PVRTC_2BPPV1_IMG",s[s.COMPRESSED_RGB_ETC1_WEBGL=36196]="COMPRESSED_RGB_ETC1_WEBGL",s[s.COMPRESSED_RGB_ATC_WEBGL=35986]="COMPRESSED_RGB_ATC_WEBGL",s[s.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL=35987]="COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL",s[s.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL=34798]="COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL",s[s.COMPRESSED_RGBA_ASTC_4x4_KHR=37808]="COMPRESSED_RGBA_ASTC_4x4_KHR",s[s.COMPRESSED_RGBA_BPTC_UNORM_EXT=36492]="COMPRESSED_RGBA_BPTC_UNORM_EXT",s[s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT=36493]="COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT",s[s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT=36494]="COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT",s[s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT=36495]="COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT",s))(Xi||{});const Th={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 gn,ro;function mv(){ro={bptc:gn.getExtension("EXT_texture_compression_bptc"),astc:gn.getExtension("WEBGL_compressed_texture_astc"),etc:gn.getExtension("WEBGL_compressed_texture_etc"),s3tc:gn.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:gn.getExtension("WEBGL_compressed_texture_s3tc_srgb"),pvrtc:gn.getExtension("WEBGL_compressed_texture_pvrtc")||gn.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),etc1:gn.getExtension("WEBGL_compressed_texture_etc1"),atc:gn.getExtension("WEBGL_compressed_texture_atc")}}const d2={extension:{type:He.DetectionParser,priority:2},test:async()=>{const s=We.ADAPTER.createCanvas().getContext("webgl");return s?(gn=s,!0):(console.warn("WebGL not available for compressed textures."),!1)},add:async s=>{ro||mv();const e=[];for(const t in ro)ro[t]&&e.push(t);return[...e,...s]},remove:async s=>(ro||mv(),s.filter(e=>!(e in ro)))};tt.add(d2);class f2 extends yu{constructor(e,t={width:1,height:1,autoLoad:!0}){let i,n;typeof e=="string"?(i=e,n=new Uint8Array):(i=null,n=e),super(n,t),this.origin=i,this.buffer=n?new jf(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 jf(e),this.loaded=!0,this.onBlobLoaded(e),this.update(),this)),this._load)}}class Ia extends f2{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=Ia._formatToExtension(this.format),(t.levelBuffers||this.buffer)&&(this._levelBuffers=t.levelBuffers||Ia._createLevelBuffers(e instanceof Uint8Array?e:this.buffer.uint8View,this.format,this.levels,4,4,this.width,this.height))}upload(e,t,i){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,a=this.levels;r=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,i,n,r,a,o){const h=new Array(i);let l=e.byteOffset,c=a,u=o,d=c+n-1&~(n-1),f=u+r-1&~(r-1),p=d*f*Th[t];for(let m=0;m1?c:d,levelHeight:i>1?u:f,levelBuffer:new Uint8Array(e.buffer,l,p)},l+=p,c=c>>1||1,u=u>>1||1,d=c+n-1&~(n-1),f=u+r-1&~(r-1),p=d*f*Th[t];return h}}const af=4,yc=124,m2=32,pv=20,p2=542327876,xc={HEIGHT:3,WIDTH:4,MIPMAP_COUNT:7,PIXEL_FORMAT:19},g2={FOURCC:2},bc={DXGI_FORMAT:0,RESOURCE_DIMENSION:1,MISC_FLAG:2,ARRAY_SIZE:3},v2=1,y2=2,x2=4,b2=64,w2=512,S2=131072,M2=827611204,_2=861165636,T2=894720068,A2=808540228,E2=4,C2={[M2]:Xi.COMPRESSED_RGBA_S3TC_DXT1_EXT,[_2]:Xi.COMPRESSED_RGBA_S3TC_DXT3_EXT,[T2]:Xi.COMPRESSED_RGBA_S3TC_DXT5_EXT},I2={70:Xi.COMPRESSED_RGBA_S3TC_DXT1_EXT,71:Xi.COMPRESSED_RGBA_S3TC_DXT1_EXT,73:Xi.COMPRESSED_RGBA_S3TC_DXT3_EXT,74:Xi.COMPRESSED_RGBA_S3TC_DXT3_EXT,76:Xi.COMPRESSED_RGBA_S3TC_DXT5_EXT,77:Xi.COMPRESSED_RGBA_S3TC_DXT5_EXT,72:Xi.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,75:Xi.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,78:Xi.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT,96:Xi.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT,95:Xi.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT,98:Xi.COMPRESSED_RGBA_BPTC_UNORM_EXT,99:Xi.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT};function R2(s){const e=new Uint32Array(s);if(e[0]!==p2)throw new Error("Invalid DDS file magic word");const t=new Uint32Array(s,0,yc/Uint32Array.BYTES_PER_ELEMENT),i=t[xc.HEIGHT],n=t[xc.WIDTH],r=t[xc.MIPMAP_COUNT],a=new Uint32Array(s,xc.PIXEL_FORMAT*Uint32Array.BYTES_PER_ELEMENT,m2/Uint32Array.BYTES_PER_ELEMENT),o=a[v2];if(o&x2){const h=a[g2.FOURCC];if(h!==A2){const b=C2[h],y=af+yc,w=new Uint8Array(s,y);return[new Ia(w,{format:b,width:n,height:i,levels:r})]}const l=af+yc,c=new Uint32Array(e.buffer,l,pv/Uint32Array.BYTES_PER_ELEMENT),u=c[bc.DXGI_FORMAT],d=c[bc.RESOURCE_DIMENSION],f=c[bc.MISC_FLAG],p=c[bc.ARRAY_SIZE],m=I2[u];if(m===void 0)throw new Error(`DDSParser cannot parse texture data with DXGI format ${u}`);if(f===E2)throw new Error("DDSParser does not support cubemap textures");if(d===6)throw new Error("DDSParser does not supported 3D texture data");const g=new Array,v=af+yc+pv;if(p===1)g.push(new Uint8Array(s,v));else{const b=Th[m];let y=0,w=n,A=i;for(let _=0;_>>1,A=A>>>1}let T=v;for(let _=0;_new Ia(b,{format:m,width:n,height:i,levels:r}))}throw o&b2?new Error("DDSParser does not support uncompressed texture data."):o&w2?new Error("DDSParser does not supported YUV uncompressed texture data."):o&S2?new Error("DDSParser does not support single-channel (lumninance) texture data!"):o&y2?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 gv=[171,75,84,88,32,49,49,187,13,10,26,10],P2=67305985,qs={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},gm=64,vv={[et.UNSIGNED_BYTE]:1,[et.UNSIGNED_SHORT]:2,[et.INT]:4,[et.UNSIGNED_INT]:4,[et.FLOAT]:4,[et.HALF_FLOAT]:8},k2={[Ne.RGBA]:4,[Ne.RGB]:3,[Ne.RG]:2,[Ne.RED]:1,[Ne.LUMINANCE]:1,[Ne.LUMINANCE_ALPHA]:2,[Ne.ALPHA]:1},F2={[et.UNSIGNED_SHORT_4_4_4_4]:2,[et.UNSIGNED_SHORT_5_5_5_1]:2,[et.UNSIGNED_SHORT_5_6_5]:2};function O2(s,e,t=!1){const i=new DataView(e);if(!B2(s,i))return null;const n=i.getUint32(qs.ENDIANNESS,!0)===P2,r=i.getUint32(qs.GL_TYPE,n),a=i.getUint32(qs.GL_FORMAT,n),o=i.getUint32(qs.GL_INTERNAL_FORMAT,n),h=i.getUint32(qs.PIXEL_WIDTH,n),l=i.getUint32(qs.PIXEL_HEIGHT,n)||1,c=i.getUint32(qs.PIXEL_DEPTH,n)||1,u=i.getUint32(qs.NUMBER_OF_ARRAY_ELEMENTS,n)||1,d=i.getUint32(qs.NUMBER_OF_FACES,n),f=i.getUint32(qs.NUMBER_OF_MIPMAP_LEVELS,n),p=i.getUint32(qs.BYTES_OF_KEY_VALUE_DATA,n);if(l===0||c!==1)throw new Error("Only 2D textures are supported");if(d!==1)throw new Error("CubeTextures are not supported by KTXLoader yet!");if(u!==1)throw new Error("WebGL does not support array textures");const m=4,g=4,v=h+3&-4,b=l+3&-4,y=new Array(u);let w=h*l;r===0&&(w=v*b);let A;if(r!==0?vv[r]?A=vv[r]*k2[a]:A=F2[r]:A=Th[o],A===void 0)throw new Error("Unable to resolve the pixel format stored in the *.ktx file!");const T=t?D2(i,p,n):null;let _=w*A,R=h,P=l,F=v,I=b,k=gm+p;for(let B=0;B1||r!==0?R:F,levelHeight:f>1||r!==0?P:I,levelBuffer:new Uint8Array(e,U,_)},U+=_}k+=D+4,k=k%4!==0?k+4-k%4:k,R=R>>1||1,P=P>>1||1,F=R+m-1&-4,I=P+g-1&-4,_=F*I*A}return r!==0?{uncompressed:y.map(B=>{let D=B[0].levelBuffer,U=!1;return r===et.FLOAT?D=new Float32Array(B[0].levelBuffer.buffer,B[0].levelBuffer.byteOffset,B[0].levelBuffer.byteLength/4):r===et.UNSIGNED_INT?(U=!0,D=new Uint32Array(B[0].levelBuffer.buffer,B[0].levelBuffer.byteOffset,B[0].levelBuffer.byteLength/4)):r===et.INT&&(U=!0,D=new Int32Array(B[0].levelBuffer.buffer,B[0].levelBuffer.byteOffset,B[0].levelBuffer.byteLength/4)),{resource:new yu(D,{width:B[0].levelWidth,height:B[0].levelHeight}),type:r,format:U?L2(a):a}}),kvData:T}:{compressed:y.map(B=>new Ia(null,{format:o,width:h,height:l,levels:f,levelBuffers:B})),kvData:T}}function B2(s,e){for(let t=0;te-n){console.error("KTXLoader: keyAndValueByteSize out of bounds");break}let h=0;for(;h{const a=new yt(r,{mipmap:Ys.OFF,alphaMode:Ni.NO_PREMULTIPLIED_ALPHA,resolution:pr(s),...e.data});return zl(a,t,s)});return n.length===1?n[0]:n},unload(s){Array.isArray(s)?s.forEach(e=>e.destroy(!0)):s.destroy(!0)}};tt.add(N2);const U2={extension:{type:He.LoadParser,priority:Is.High},name:"loadKTX",test(s){return bs(s,".ktx")},async load(s,e,t){const i=await(await We.ADAPTER.fetch(s)).arrayBuffer(),{compressed:n,uncompressed:r,kvData:a}=O2(s,i),o=n??r,h={mipmap:Ys.OFF,alphaMode:Ni.NO_PREMULTIPLIED_ALPHA,resolution:pr(s),...e.data},l=o.map(c=>{o===r&&Object.assign(h,{type:c.type,format:c.format});const u=c.resource??c,d=new yt(u,h);return d.ktxKeyValueData=a,zl(d,t,s)});return l.length===1?l[0]:l},unload(s){Array.isArray(s)?s.forEach(e=>e.destroy(!0)):s.destroy(!0)}};tt.add(U2);const X2=["s3tc","s3tc_sRGB","etc","etc1","pvrtc","atc","astc","bptc"],V2={extension:He.ResolveParser,test:s=>{const e=wi.extname(s).slice(1);return["basis","ktx","dds"].includes(e)},parse:s=>{var i,n;const e=s.split("."),t=e.pop();if(["ktx","dds"].includes(t)){const r=e.pop();if(X2.includes(r))return{resolution:parseFloat(((i=We.RETINA_PREFIX.exec(s))==null?void 0:i[1])??"1"),format:r,src:s}}return{resolution:parseFloat(((n=We.RETINA_PREFIX.exec(s))==null?void 0:n[1])??"1"),format:t,src:s}}};tt.add(V2);const wc=new Tt,Y2=4,Wb=class al{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,i,n){const r=new Image;return r.src=await this.base64(e,t,i,n),r}async base64(e,t,i,n){const r=this.canvas(e,n);if(r.toBlob!==void 0)return new Promise((a,o)=>{r.toBlob(h=>{if(!h){o(new Error("ICanvas.toBlob failed!"));return}const l=new FileReader;l.onload=()=>a(l.result),l.onerror=o,l.readAsDataURL(h)},t,i)});if(r.toDataURL!==void 0)return r.toDataURL(t,i);if(r.convertToBlob!==void 0){const a=await r.convertToBlob({type:t,quality:i});return new Promise((o,h)=>{const l=new FileReader;l.onload=()=>o(l.result),l.onerror=h,l.readAsDataURL(a)})}throw new Error("Extract.base64() requires ICanvas.toDataURL, ICanvas.toBlob, or ICanvas.convertToBlob to be implemented")}canvas(e,t){const{pixels:i,width:n,height:r,flipY:a,premultipliedAlpha:o}=this._rawPixels(e,t);a&&al._flipY(i,n,r),o&&al._unpremultiplyAlpha(i);const h=new MA(n,r,1),l=new ImageData(new Uint8ClampedArray(i.buffer),n,r);return h.context.putImageData(l,0,0),h.canvas}pixels(e,t){const{pixels:i,width:n,height:r,flipY:a,premultipliedAlpha:o}=this._rawPixels(e,t);return a&&al._flipY(i,n,r),o&&al._unpremultiplyAlpha(i),i}_rawPixels(e,t){const i=this.renderer;if(!i)throw new Error("The Extract has already been destroyed");let n,r=!1,a=!1,o,h=!1;e&&(e instanceof Ua?o=e:(o=i.generateTexture(e,{region:t,resolution:i.resolution,multisample:i.multisample}),h=!0,t&&(wc.width=t.width,wc.height=t.height,t=wc)));const l=i.gl;if(o){if(n=o.baseTexture.resolution,t=t??o.frame,r=!1,a=o.baseTexture.alphaMode>0&&o.baseTexture.format===Ne.RGBA,!h){i.renderTexture.bind(o);const f=o.framebuffer.glFramebuffers[i.CONTEXT_UID];f.blitFramebuffer&&i.framebuffer.bind(f.blitFramebuffer)}}else n=i.resolution,t||(t=wc,t.width=i.width/n,t.height=i.height/n),r=!0,a=this._rendererPremultipliedAlpha,i.renderTexture.bind();const c=Math.max(Math.round(t.width*n),1),u=Math.max(Math.round(t.height*n),1),d=new Uint8Array(Y2*c*u);return l.readPixels(Math.round(t.x*n),Math.round(t.y*n),c,u,l.RGBA,l.UNSIGNED_BYTE,d),h&&(o==null||o.destroy(!0)),{pixels:d,width:c,height:u,flipY:r,premultipliedAlpha:a}}destroy(){this.renderer=null}static _flipY(e,t,i){const n=t<<2,r=i>>1,a=new Uint8Array(n);for(let o=0;o=0&&o>=0&&n>=0&&r>=0)){e.length=0;return}const h=Math.ceil(2.3*Math.sqrt(a+o)),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]=i+r,e[2]=e[4]=t-n,e[5]=e[7]=i-r;return}let c=0,u=h*4+(n?2:0)+2,d=u,f=l;{const p=n+a,m=r,g=t+p,v=t-p,b=i+m;if(e[c++]=g,e[c++]=b,e[--u]=b,e[--u]=v,r){const y=i-m;e[d++]=v,e[d++]=y,e[--f]=y,e[--f]=g}}for(let p=1;p0||e&&i<=0){const n=t/2;for(let r=n+n%2;r=6){yv(t,!1);const a=[];for(let l=0;l=0&&r>=0&&a.push(t,i,t+n,i,t+n,i+r,t,i+r)},triangulate(s,e){const t=s.points,i=e.points;if(t.length===0)return;const n=i.length/2;i.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)}},H2={build(s){Ah.build(s)},triangulate(s,e){Ah.triangulate(s,e)}};var Ls=(s=>(s.MITER="miter",s.BEVEL="bevel",s.ROUND="round",s))(Ls||{}),Ur=(s=>(s.BUTT="butt",s.ROUND="round",s.SQUARE="square",s))(Ur||{});const Co={adaptive:!0,maxLength:10,minSegments:8,maxSegments:2048,epsilon:1e-4,_segmentsCount(s,e=20){if(!this.adaptive||!s||isNaN(s))return e;let t=Math.ceil(s/this.maxLength);return tthis.maxSegments&&(t=this.maxSegments),t}};class xv{static curveTo(e,t,i,n,r,a){const o=a[a.length-2],h=a[a.length-1]-t,l=o-e,c=n-t,u=i-e,d=Math.abs(h*u-l*c);if(d<1e-8||r===0)return(a[a.length-2]!==e||a[a.length-1]!==t)&&a.push(e,t),null;const f=h*h+l*l,p=c*c+u*u,m=h*c+l*u,g=r*Math.sqrt(f)/d,v=r*Math.sqrt(p)/d,b=g*m/f,y=v*m/p,w=g*u+v*l,A=g*c+v*h,T=l*(v+b),_=h*(v+b),R=u*(g+y),P=c*(g+y),F=Math.atan2(_-A,T-w),I=Math.atan2(P-A,R-w);return{cx:w+e,cy:A+t,radius:r,startAngle:F,endAngle:I,anticlockwise:l*c>u*h}}static arc(e,t,i,n,r,a,o,h,l){const c=o-a,u=Co._segmentsCount(Math.abs(c)*r,Math.ceil(Math.abs(c)/vh)*40),d=c/(u*2),f=d*2,p=Math.cos(d),m=Math.sin(d),g=u-1,v=g%1/g;for(let b=0;b<=g;++b){const y=b+v*b,w=d+a+f*y,A=Math.cos(w),T=-Math.sin(w);l.push((p*A+m*T)*r+i,(p*-T+m*A)*r+n)}}}class j2{constructor(){this.reset()}begin(e,t,i){this.reset(),this.style=e,this.start=t,this.attribStart=i}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 xp{static curveLength(e,t,i,n,r,a,o,h){let l=0,c=0,u=0,d=0,f=0,p=0,m=0,g=0,v=0,b=0,y=0,w=e,A=t;for(let T=1;T<=10;++T)c=T/10,u=c*c,d=u*c,f=1-c,p=f*f,m=p*f,g=m*e+3*p*c*i+3*f*u*r+d*o,v=m*t+3*p*c*n+3*f*u*a+d*h,b=w-g,y=A-v,w=g,A=v,l+=Math.sqrt(b*b+y*y);return l}static curveTo(e,t,i,n,r,a,o){const h=o[o.length-2],l=o[o.length-1];o.length-=2;const c=Co._segmentsCount(xp.curveLength(h,l,e,t,i,n,r,a));let u=0,d=0,f=0,p=0,m=0;o.push(h,l);for(let g=1,v=0;g<=c;++g)v=g/c,u=1-v,d=u*u,f=d*u,p=v*v,m=p*v,o.push(f*h+3*d*v*e+3*u*p*i+m*r,f*l+3*d*v*t+3*u*p*n+m*a)}}function bv(s,e,t,i,n,r,a,o){const h=s-t*n,l=e-i*n,c=s+t*r,u=e+i*r;let d,f;a?(d=i,f=-t):(d=-i,f=t);const p=h+d,m=l+f,g=c+d,v=u+f;return o.push(p,m,g,v),2}function la(s,e,t,i,n,r,a,o){const h=t-s,l=i-e;let c=Math.atan2(h,l),u=Math.atan2(n-s,r-e);o&&cu&&(u+=Math.PI*2);let d=c;const f=u-c,p=Math.abs(f),m=Math.sqrt(h*h+l*l),g=(15*p*Math.sqrt(m)/Math.PI>>0)+1,v=f/g;if(d+=v,o){a.push(s,e,t,i);for(let b=1,y=d;b=0&&(r.join===Ls.ROUND?d+=la(y,w,y-_*B,w-R*B,y-P*B,w-F*B,c,!1)+4:d+=2,c.push(y-P*D,w-F*D,y+P*B,w+F*B));continue}const K=(-_+v)*(-R+w)-(-_+y)*(-R+b),fe=(-P+A)*(-F+w)-(-P+y)*(-F+T),me=(O*fe-E*K)/W,we=(V*K-X*fe)/W,Ee=(me-y)*(me-y)+(we-w)*(we-w),pe=y+(me-y)*B,Ae=w+(we-w)*B,G=y-(me-y)*D,Z=w-(we-w)*D,z=Math.min(O*O+X*X,E*E+V*V),j=J?B:D,te=z+j*j*m,he=Ee<=te;let xe=r.join;if(xe===Ls.MITER&&Ee/m>g&&(xe=Ls.BEVEL),he)switch(xe){case Ls.MITER:{c.push(pe,Ae,G,Z);break}case Ls.BEVEL:{J?c.push(pe,Ae,y+_*D,w+R*D,pe,Ae,y+P*D,w+F*D):c.push(y-_*B,w-R*B,G,Z,y-P*B,w-F*B,G,Z),d+=2;break}case Ls.ROUND:{J?(c.push(pe,Ae,y+_*D,w+R*D),d+=la(y,w,y+_*D,w+R*D,y+P*D,w+F*D,c,!0)+4,c.push(pe,Ae,y+P*D,w+F*D)):(c.push(y-_*B,w-R*B,G,Z),d+=la(y,w,y-_*B,w-R*B,y-P*B,w-F*B,c,!1)+4,c.push(y-P*B,w-F*B,G,Z));break}}else{switch(c.push(y-_*B,w-R*B,y+_*D,w+R*D),xe){case Ls.MITER:{J?c.push(G,Z,G,Z):c.push(pe,Ae,pe,Ae),d+=2;break}case Ls.ROUND:{J?d+=la(y,w,y+_*D,w+R*D,y+P*D,w+F*D,c,!0)+2:d+=la(y,w,y-_*B,w-R*B,y-P*B,w-F*B,c,!1)+2;break}}c.push(y-P*B,w-F*B,y+P*D,w+F*D),d+=2}}v=i[(u-2)*2],b=i[(u-2)*2+1],y=i[(u-1)*2],w=i[(u-1)*2+1],_=-(b-w),R=v-y,I=Math.sqrt(_*_+R*R),_/=I,R/=I,_*=p,R*=p,c.push(y-_*B,w-R*B,y+_*D,w+R*D),h||(r.cap===Ur.ROUND?d+=la(y-_*(B-D)*.5,w-R*(B-D)*.5,y-_*B,w-R*B,y+_*D,w+R*D,c,!1)+2:r.cap===Ur.SQUARE&&(d+=bv(y,w,_,R,B,D,!1,c)));const U=e.indices,L=Co.epsilon*Co.epsilon;for(let N=f;N0&&(this.invalidate(),this.clearDirty++,this.graphicsData.length=0),this}drawShape(e,t=null,i=null,n=null){const r=new Eh(e,t,i,n);return this.graphicsData.push(r),this.dirty++,this}drawHole(e,t=null){if(!this.graphicsData.length)return null;const i=new Eh(e,null,null,t),n=this.graphicsData[this.graphicsData.length-1];return i.lineStyle=n.lineStyle,n.holes.push(i),this.dirty++,this}destroy(){super.destroy();for(let e=0;e0&&(i=this.batches[this.batches.length-1],n=i.style);for(let h=this.shapeIndex;h65535;this.indicesUint16&&this.indices.length===this.indicesUint16.length&&o===this.indicesUint16.BYTES_PER_ELEMENT>2?this.indicesUint16.set(this.indices):this.indicesUint16=o?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;e65535*2)return!1;const e=this.batches;for(let t=0;t0&&(n=Sc.pop(),n||(n=new qf,n.texArray=new Qf),this.drawCalls.push(n)),n.start=c,n.size=0,n.texArray.count=0,n.type=l),m.touched=1,m._batchEnabled=e,m._batchLocation=r,m.wrapMode=an.REPEAT,n.texArray.elements[n.texArray.count++]=m,r++)),n.size+=d.size,c+=d.size,o=m._batchLocation,this.addColors(t,p.color,p.alpha,d.attribSize,d.attribStart),this.addTextureIds(i,o,d.attribSize,d.attribStart)}yt._globalBatch=e,this.packAttributes()}packAttributes(){const e=this.points,t=this.uvs,i=this.colors,n=this.textureIds,r=new ArrayBuffer(e.length*3*4),a=new Float32Array(r),o=new Uint32Array(r);let h=0;for(let l=0;l0&&e.alpha>0;return i?(e.matrix&&(e.matrix=e.matrix.clone(),e.matrix.invert()),Object.assign(this._lineStyle,{visible:i},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 Ca,this.currentPath.closeStroke=!1,this.currentPath.points.push(e[t-2],e[t-1]))}else this.currentPath=new Ca,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 i=this.currentPath.points,n=i[i.length-2],r=i[i.length-1];return(n!==e||r!==t)&&i.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,i,n){this._initCurve();const r=this.currentPath.points;return r.length===0&&this.moveTo(0,0),bp.curveTo(e,t,i,n,r),this}bezierCurveTo(e,t,i,n,r,a){return this._initCurve(),xp.curveTo(e,t,i,n,r,a,this.currentPath.points),this}arcTo(e,t,i,n,r){this._initCurve(e,t);const a=this.currentPath.points,o=xv.curveTo(e,t,i,n,r,a);if(o){const{cx:h,cy:l,radius:c,startAngle:u,endAngle:d,anticlockwise:f}=o;this.arc(h,l,c,u,d,f)}return this}arc(e,t,i,n,r,a=!1){if(n===r)return this;if(!a&&r<=n?r+=vh:a&&n<=r&&(n+=vh),r-n===0)return this;const o=e+Math.cos(n)*i,h=t+Math.sin(n)*i,l=this._geometry.closePointEps;let c=this.currentPath?this.currentPath.points:null;if(c){const u=Math.abs(c[c.length-2]-o),d=Math.abs(c[c.length-1]-h);u0;return i?(e.matrix&&(e.matrix=e.matrix.clone(),e.matrix.invert()),Object.assign(this._fillStyle,{visible:i},e)):this._fillStyle.reset(),this}endFill(){return this.finishPoly(),this._fillStyle.reset(),this}drawRect(e,t,i,n){return this.drawShape(new Tt(e,t,i,n))}drawRoundedRect(e,t,i,n,r){return this.drawShape(new wu(e,t,i,n,r))}drawCircle(e,t,i){return this.drawShape(new xu(e,t,i))}drawEllipse(e,t,i,n){return this.drawShape(new bu(e,t,i,n))}drawPolygon(...e){let t,i=!0;const n=e[0];n.points?(i=n.closeStroke,t=n.points):Array.isArray(e[0])?t=e[0]:t=e;const r=new Ca(t);return r.closeStroke=i,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===Hi.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,i=e.batches.length;this.batchTint=-1,this._transformID=-1,this.batchDirty=e.batchDirty,this.batches.length=i,this.vertexData=new Float32Array(e.points);for(let n=0;ni&&!e.autoResize&&(a=i);let o=e._buffers;o||(o=e._buffers=this.generateBuffers(e));const h=t[0]._texture.baseTexture,l=h.alphaMode>0;this.state.blendMode=Zx(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=jt.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 d=!1;for(let f=0,p=0;fn&&(m=n),p>=o.length&&o.push(this._generateOneMoreBuffer(e));const g=o[p];g.uploadDynamic(t,f,m);const v=e._bufferUpdateIDs[p]||0;d=d||g._updateID0);n[a]=l,n[a+r]=l,n[a+r*2]=l,n[a+r*3]=l,a+=r*4}}destroy(){super.destroy(),this.shader&&(this.shader.destroy(),this.shader=null),this.tempMatrix=null}}Qb.extension={name:"particle",type:He.RendererPlugin};tt.add(Qb);var Tu=(s=>(s[s.LINEAR_VERTICAL=0]="LINEAR_VERTICAL",s[s.LINEAR_HORIZONTAL=1]="LINEAR_HORIZONTAL",s))(Tu||{});const Mc={willReadFrequently:!0},vn=class ot{static get experimentalLetterSpacingSupported(){let e=ot._experimentalLetterSpacingSupported;if(e!==void 0){const t=We.ADAPTER.getCanvasRenderingContext2D().prototype;e=ot._experimentalLetterSpacingSupported="letterSpacing"in t||"textLetterSpacing"in t}return e}constructor(e,t,i,n,r,a,o,h,l){this.text=e,this.style=t,this.width=i,this.height=n,this.lines=r,this.lineWidths=a,this.lineHeight=o,this.maxLineWidth=h,this.fontProperties=l}static measureText(e,t,i,n=ot._canvas){i=i??t.wordWrap;const r=t.toFontString(),a=ot.measureFont(r);a.fontSize===0&&(a.fontSize=t.fontSize,a.ascent=t.fontSize);const o=n.getContext("2d",Mc);o.font=r;const h=(i?ot.wordWrap(e,t,n):e).split(/(?:\r\n|\r|\n)/),l=new Array(h.length);let c=0;for(let p=0;p0&&(n?r-=t:r+=(ot.graphemeSegmenter(e).length-1)*t),r}static wordWrap(e,t,i=ot._canvas){const n=i.getContext("2d",Mc);let r=0,a="",o="";const h=Object.create(null),{letterSpacing:l,whiteSpace:c}=t,u=ot.collapseSpaces(c),d=ot.collapseNewlines(c);let f=!u;const p=t.wordWrapWidth+l,m=ot.tokenize(e);for(let g=0;gp)if(a!==""&&(o+=ot.addLine(a),a="",r=0),ot.canBreakWords(v,t.breakWords)){const y=ot.wordWrapSplit(v);for(let w=0;wp&&(o+=ot.addLine(a),f=!1,a="",r=0),a+=A,r+=R}}else{a.length>0&&(o+=ot.addLine(a),a="",r=0);const y=g===m.length-1;o+=ot.addLine(v,!y),f=!1,a="",r=0}else b+r>p&&(f=!1,o+=ot.addLine(a),a="",r=0),(a.length>0||!ot.isBreakingSpace(v)||f)&&(a+=v,r+=b)}return o+=ot.addLine(a,!1),o}static addLine(e,t=!0){return e=ot.trimRight(e),e=t?`${e} `:e,e}static getFromCache(e,t,i,n){let r=i[e];return typeof r!="number"&&(r=ot._measureText(e,t,n)+t,i[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 i=e[t];if(!ot.isBreakingSpace(i))break;e=e.slice(0,-1)}return e}static isNewline(e){return typeof e!="string"?!1:ot._newlines.includes(e.charCodeAt(0))}static isBreakingSpace(e,t){return typeof e!="string"?!1:ot._breakingSpaces.includes(e.charCodeAt(0))}static tokenize(e){const t=[];let i="";if(typeof e!="string")return t;for(let n=0;no;--d){for(let m=0;m{if(typeof(Intl==null?void 0:Intl.Segmenter)=="function"){const s=new Intl.Segmenter;return e=>[...s.segment(e)].map(t=>t.segment)}return s=>[...s]})(),vn.experimentalLetterSpacing=!1,vn._fonts={},vn._newlines=[10,13],vn._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288];let Ir=vn;const iI=["serif","sans-serif","monospace","cursive","fantasy","system-ui"],e1=class ol{constructor(e){this.styleID=0,this.reset(),uf(this,e,e)}clone(){const e={};return uf(e,this,ol.defaultStyle),new ol(e)}reset(){uf(this,ol.defaultStyle,ol.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=hf(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=hf(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){sI(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=hf(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 i=t.length-1;i>=0;i--){let n=t[i].trim();!/([\"\'])[^\'\"]+\1/.test(n)&&!iI.includes(n)&&(n=`"${n}"`),t[i]=n}return`${this.fontStyle} ${this.fontVariant} ${this.fontWeight} ${e} ${t.join(",")}`}};e1.defaultStyle={align:"left",breakWords:!1,dropShadow:!1,dropShadowAlpha:1,dropShadowAngle:Math.PI/6,dropShadowBlur:0,dropShadowColor:"black",dropShadowDistance:5,fill:"black",fillGradientType:Tu.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 jr=e1;function hf(s){const e=jt.shared,t=i=>{const n=e.setValue(i);return n.alpha===1?n.toHex():n.toRgbaString()};return Array.isArray(s)?s.map(t):t(s)}function sI(s,e){if(!Array.isArray(s)||!Array.isArray(e)||s.length!==e.length)return!1;for(let t=0;t0&&p>m&&(g=(m+p)/2);const v=m+d,b=i.lineHeight*(f+1);let y=v;f+10}}function aI(s,e){var i;let t=!1;if((i=s==null?void 0:s._textures)!=null&&i.length){for(let n=0;n{this.queue&&this.prepareItems()},this.registerFindHook(uI),this.registerFindHook(dI),this.registerFindHook(aI),this.registerFindHook(oI),this.registerFindHook(lI),this.registerUploadHook(cI),this.registerUploadHook(hI)}upload(e){return new Promise(t=>{e&&this.add(e),this.queue.length?(this.completes.push(t),this.ticking||(this.ticking=!0,ds.system.addOnce(this.tick,this,Oa.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 i=0,n=this.uploadHooks.length;i=0;t--)this.add(e.children[t]);return this}destroy(){this.ticking&&ds.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}};i1.uploadsPerFrame=4;let xm=i1;Object.defineProperties(We,{UPLOADS_PER_FRAME:{get(){return xm.uploadsPerFrame},set(s){kt("7.1.0","settings.UPLOADS_PER_FRAME is deprecated, use prepare.BasePrepare.uploadsPerFrame"),xm.uploadsPerFrame=s}}});function n1(s,e){return e instanceof yt?(e._glTextures[s.CONTEXT_UID]||s.texture.bind(e),!0):!1}function fI(s,e){if(!(e instanceof ys))return!1;const{geometry:t}=e;e.finishPoly(),t.updateBatches();const{batches:i}=t;for(let n=0;n1?cn.from(gI,pI,t):cn.from(Tv,vI,t)}render(e){const t=this.renderer,i=this.quad;let n=i.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,a=e.uvRespectAnchor?e.anchor.y:0;n=i.uvs,n[0]=n[6]=-r,n[1]=n[3]=-a,n[2]=n[4]=1-r,n[5]=n[7]=1-a,i.invalidate();const o=e._texture,h=o.baseTexture,l=h.alphaMode>0,c=e.tileTransform.localTransform,u=e.uvMatrix;let d=h.isPowerOfTwo&&o.frame.width===h.width&&o.frame.height===h.height;d&&(h._glTextures[t.CONTEXT_UID]?d=h.wrapMode!==an.CLAMP:h.wrapMode===an.CLAMP&&(h.wrapMode=an.REPEAT));const f=d?this.simpleShader:this.shader,p=o.width,m=o.height,g=e._width,v=e._height;_c.set(c.a*p/g,c.b*p/v,c.c*m/g,c.d*m/v,c.tx/g,c.ty/v),_c.invert(),d?_c.prepend(u.mapCoord):(f.uniforms.uMapCoord=u.mapCoord.toArray(!0),f.uniforms.uClampFrame=u.uClampFrame,f.uniforms.uClampOffset=u.uClampOffset),f.uniforms.uTransform=_c.toArray(!0),f.uniforms.uColor=jt.shared.setValue(e.tint).premultiply(e.worldAlpha,l).toArray(f.uniforms.uColor),f.uniforms.translationMatrix=e.transform.worldTransform.toArray(!0),f.uniforms.uSampler=o,t.shader.bind(f),t.geometry.bind(i),this.state.blendMode=Zx(e.blendMode,l),t.state.set(this.state),t.geometry.draw(this.renderer.gl.TRIANGLES,6,0)}}a1.extension={name:"tilingSprite",type:He.RendererPlugin};tt.add(a1);const o1=class ll{constructor(e,t,i){this.linkedSheets=[],(e instanceof yt||e instanceof gt)&&(e={texture:e,data:t,resolutionFilename:i});const{texture:n,data:r,resolutionFilename:a=null,cachePrefix:o=""}=e;this.cachePrefix=o,this._texture=n instanceof gt?n:null,this.baseTexture=n instanceof yt?n:this._texture.baseTexture,this.textures={},this.animations={},this.data=r;const h=this.baseTexture.resource;this.resolution=this._updateResolution(a||(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 i=pr(e,null);return i===null&&(i=typeof t=="number"?t:parseFloat(t??"1")),i!==1&&this.baseTexture.setResolution(i),i}parse(){return new Promise(e=>{this._callback=e,this._batchIndex=0,this._frameKeys.length<=ll.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()})}_processFrames(e){let t=e;const i=ll.BATCH_SIZE;for(;t-e{this._batchIndex*ll.BATCH_SIZE{i[n]=e}),Object.keys(e.textures).forEach(n=>{i[`${e.cachePrefix}${n}`]=e.textures[n]}),!t){const n=wi.dirname(s[0]);e.linkedSheets.forEach((r,a)=>{Object.assign(i,l1([`${n}/${e.data.meta.related_multi_packs[a]}`],r,!0))})}return i}const bI={extension:He.Asset,cache:{test:s=>s instanceof Av,getCacheableAssets:(s,e)=>l1(s,e,!1)},resolver:{test:s=>{const e=s.split("?")[0].split("."),t=e.pop(),i=e.pop();return t==="json"&&xI.includes(i)},parse:s=>{var t;const e=s.split(".");return{resolution:parseFloat(((t=We.RETINA_PREFIX.exec(s))==null?void 0:t[1])??"1"),format:e[e.length-2],src:s}}},loader:{name:"spritesheetLoader",extension:{type:He.LoadParser,priority:Is.Normal},async testParse(s,e){return wi.extname(e.src).toLowerCase()===".json"&&!!s.frames},async parse(s,e,t){var c,u;const{texture:i,imageFilename:n,cachePrefix:r}=(e==null?void 0:e.data)??{};let a=wi.dirname(e.src);a&&a.lastIndexOf("/")!==a.length-1&&(a+="/");let o;if(i&&i.baseTexture)o=i;else{const d=Mh(a+(n??s.meta.image),e.src);o=(await t.load([d]))[d]}const h=new Av({texture:o.baseTexture,data:s,resolutionFilename:e.src,cachePrefix:r});await h.parse();const l=(c=s==null?void 0:s.meta)==null?void 0:c.related_multi_packs;if(Array.isArray(l)){const d=[];for(const p of l){if(typeof p!="string")continue;let m=a+p;(u=e.data)!=null&&u.ignoreMultiPack||(m=Mh(m,e.src),d.push(t.load({src:m,data:{ignoreMultiPack:!0}})))}const f=await Promise.all(d);h.linkedSheets=f,f.forEach(p=>{p.linkedSheets=[h].concat(h.linkedSheets.filter(m=>m!==p))})}return h},unload(s){s.destroy(!0)}}};tt.add(bI);class Ih{constructor(){this.info=[],this.common=[],this.page=[],this.char=[],this.kerning=[],this.distanceField=[]}}class zc{static test(e){return typeof e=="string"&&e.startsWith("info face=")}static parse(e){const t=e.match(/^[a-z]+\s+.+$/gm),i={info:[],common:[],page:[],char:[],chars:[],kerning:[],kernings:[],distanceField:[]};for(const r in t){const a=t[r].match(/^[a-z]+/gm)[0],o=t[r].match(/[a-zA-Z]+=([^\s"']+|"([^"]*)")/gm),h={};for(const l in o){const c=o[l].split("="),u=c[0],d=c[1].replace(/"/gm,""),f=parseFloat(d),p=isNaN(f)?d:f;h[u]=p}i[a].push(h)}const n=new Ih;return i.info.forEach(r=>n.info.push({face:r.face,size:parseInt(r.size,10)})),i.common.forEach(r=>n.common.push({lineHeight:parseInt(r.lineHeight,10)})),i.page.forEach(r=>n.page.push({id:parseInt(r.id,10),file:r.file})),i.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)})),i.kerning.forEach(r=>n.kerning.push({first:parseInt(r.first,10),second:parseInt(r.second,10),amount:parseInt(r.amount,10)})),i.distanceField.forEach(r=>n.distanceField.push({distanceRange:parseInt(r.distanceRange,10),fieldType:r.fieldType})),n}}class bm{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 Ih,i=e.getElementsByTagName("info"),n=e.getElementsByTagName("common"),r=e.getElementsByTagName("page"),a=e.getElementsByTagName("char"),o=e.getElementsByTagName("kerning"),h=e.getElementsByTagName("distanceField");for(let l=0;l")?bm.test(We.ADAPTER.parseXML(e)):!1}static parse(e){return bm.parse(We.ADAPTER.parseXML(e))}}const df=[zc,bm,wm];function wI(s){for(let e=0;e=h-F*a){if(m===0)throw new Error(`[BitmapFont] textureHeight ${h}px is too small (fontFamily: '${u.fontFamily}', fontSize: ${u.fontSize}px, char: '${_}')`);--T,g=null,v=null,b=null,m=0,p=0,y=0;continue}if(y=Math.max(F+R.fontProperties.descent,y),I*a+p>=d){if(p===0)throw new Error(`[BitmapFont] textureWidth ${o}px is too small (fontFamily: '${u.fontFamily}', fontSize: ${u.fontSize}px, char: '${_}')`);--T,m+=y*a,m=Math.ceil(m),p=0,y=0;continue}MI(g,v,R,p,m,a,u);const k=qc(R.text);f.char.push({id:k,page:w.length-1,x:p/a,y:m/a,width:I,height:F,xoffset:0,yoffset:0,xadvance:P-(u.dropShadow?u.dropShadowDistance:0)-(u.stroke?u.strokeThickness:0)}),p+=(I+2*r)*a,p=Math.ceil(p)}if(!(i!=null&&i.skipKerning))for(let T=0,_=c.length;T<_;T++){const R=c[T];for(let P=0;P<_;P++){const F=c[P],I=v.measureText(R).width,k=v.measureText(F).width,B=v.measureText(R+F).width-(I+k);B&&f.kerning.push({first:qc(R),second:qc(F),amount:B})}}const A=new yn(f,w,!0);return yn.available[e]!==void 0&&yn.uninstall(e),yn.available[e]=A,A}};Tr.ALPHA=[["a","z"],["A","Z"]," "],Tr.NUMERIC=[["0","9"]],Tr.ALPHANUMERIC=[["a","z"],["A","Z"],["0","9"]," "],Tr.ASCII=[[" ","~"]],Tr.defaultOptions={resolution:1,textureWidth:512,textureHeight:512,padding:4,chars:Tr.ALPHANUMERIC},Tr.available={};let Ar=Tr;var TI=`// 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 `,AI=`// 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 Ev=[],Cv=[],Iv=[],EI=class h1 extends ji{constructor(e,t={}){super();const{align:i,tint:n,maxWidth:r,letterSpacing:a,fontName:o,fontSize:h}=Object.assign({},h1.styleDefaults,t);if(!Ar.available[o])throw new Error(`Missing BitmapFont "${o}"`);this._activePagesMeshData=[],this._textWidth=0,this._textHeight=0,this._align=i,this._tintColor=new jt(n),this._font=void 0,this._fontName=o,this._fontSize=h,this.text=e,this._maxWidth=r,this._maxLineHeight=0,this._letterSpacing=a,this._anchor=new sr(()=>{this.dirty=!0},this,0,0),this._roundPixels=We.ROUND_PIXELS,this.dirty=!0,this._resolution=We.RESOLUTION,this._autoResolution=!0,this._textureCache={}}updateText(){var I;const e=Ar.available[this._fontName],t=this.fontSize,i=t/e.size,n=new Ut,r=[],a=[],o=[],h=this._text.replace(/(?:\r\n|\r)/g,` `)||" ",l=c1(h),c=this._maxWidth*e.size/t,u=e.distanceFieldType==="none"?Ev:Cv;let d=null,f=0,p=0,m=0,g=-1,v=0,b=0,y=0,w=0;for(let k=0;k0&&n.x>c&&(++b,yo(r,1+g-b,1+k-g),k=g,g=-1,a.push(v),o.push(r.length>0?r[r.length-1].prevSpaces:0),p=Math.max(p,v),m++,n.x=0,n.y+=e.lineHeight,d=null,w=0)}const A=l[l.length-1];A!=="\r"&&A!==` `&&(/(?:\s)/.test(A)&&(f=v),a.push(f),p=Math.max(p,f),o.push(-1));const T=[];for(let k=0;k<=m;k++){let B=0;this._align==="right"?B=p-a[k]:this._align==="center"?B=(p-a[k])/2:this._align==="justify"&&(B=o[k]<0?0:(p-a[k])/o[k]),T.push(B)}const _=r.length,R={},P=[],F=this._activePagesMeshData;u.push(...F);for(let k=0;k<_;k++){const B=r[k].texture,D=B.baseTexture.uid;if(!R[D]){let U=u.pop();if(!U){const N=new Sp;let O,X;e.distanceFieldType==="none"?(O=new Ch(gt.EMPTY),X=dt.NORMAL):(O=new Ch(gt.EMPTY,{program:kn.from(AI,TI),uniforms:{uFWidth:0}}),X=dt.NORMAL_NPM);const E=new Ll(N,O);E.blendMode=X,U={index:0,indexCount:0,vertexCount:0,uvsCount:0,total:0,mesh:E,vertices:null,uvs:null,indices:null}}U.index=0,U.indexCount=0,U.vertexCount=0,U.uvsCount=0,U.total=0;const{_textureCache:L}=this;L[D]=L[D]||new gt(B.baseTexture),U.mesh.texture=L[D],U.mesh.tint=this._tintColor.value,P.push(U),R[D]=U}R[D].total++}for(let k=0;k6*D)||B.vertices.lengtht[n.mesh.texture.baseTexture.uid]).forEach(n=>{n.mesh.texture=gt.EMPTY});for(const n in t)t[n].destroy(),delete t[n];this._font=null,this._tintColor=null,this._textureCache=null,super.destroy(e)}};EI.styleDefaults={align:"left",tint:16777215,maxWidth:0,letterSpacing:0};const CI=[".xml",".fnt"],II={extension:{type:He.LoadParser,priority:Is.Normal},name:"loadBitmapFont",test(s){return CI.includes(wi.extname(s).toLowerCase())},async testParse(s){return zc.test(s)||wm.test(s)},async parse(s,e,t){const i=zc.test(s)?zc.parse(s):wm.parse(s),{src:n}=e,{page:r}=i,a=[];for(let l=0;lo[l]);return Ar.install(i,h,!0)},async load(s,e){return(await We.ADAPTER.fetch(s)).text()},unload(s){s.destroy()}};tt.add(II);const Sm=class ao extends jr{constructor(){super(...arguments),this._fonts=[],this._overrides=[],this._stylesheet="",this.fontsDirty=!1}static from(e){return new ao(Object.keys(ao.defaultOptions).reduce((t,i)=>({...t,[i]:e[i]}),{}))}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 ao.availableFonts[e.originalUrl])}),this.fontFamily="Arial",this._fonts.length=0,this.styleID++,this.fontsDirty=!0)}loadFont(e,t={}){const{availableFonts:i}=ao;if(i[e]){const n=i[e];return this._fonts.push(n),n.refs++,this.styleID++,this.fontsDirty=!0,Promise.resolve()}return We.ADAPTER.fetch(e).then(n=>n.blob()).then(async n=>new Promise((r,a)=>{const o=URL.createObjectURL(n),h=new FileReader;h.onload=()=>r([o,h.result]),h.onerror=a,h.readAsDataURL(n)})).then(async([n,r])=>{const a=Object.assign({family:wi.basename(e,wi.extname(e)),weight:"normal",style:"normal",display:"auto",src:n,dataSrc:r,refs:1,originalUrl:e,fontFace:null},t);i[e]=a,this._fonts.push(a),this.styleID++;const o=new FontFace(a.family,`url(${a.src})`,{weight:a.weight,style:a.style,display:a.display});a.fontFace=o,await o.load(),document.fonts.add(o),await document.fonts.ready,this.styleID++,this.fontsDirty=!0})}addOverride(...e){const t=e.filter(i=>!this._overrides.includes(i));t.length>0&&(this._overrides.push(...t),this.styleID++)}removeOverride(...e){const t=e.filter(i=>this._overrides.includes(i));t.length>0&&(this._overrides=this._overrides.filter(i=>!t.includes(i)),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=xA(e)),typeof e=="number"?yA(e):e}dropShadowToCSS(){let e=this.normalizeColor(this.dropShadowColor);const t=this.dropShadowAlpha,i=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=`${i}px ${n}px`;return this.dropShadowBlur>0?`text-shadow: ${r} ${this.dropShadowBlur}px ${e}`:`text-shadow: ${r} ${e}`}reset(){Object.assign(this,ao.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}=We.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}};Sm.availableFonts={},Sm.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 ff=Sm;const Tc=class oo extends Zr{constructor(e="",t={}){super(gt.EMPTY),this._text=null,this._style=null,this._autoResolution=!0,this.localStyleID=-1,this.dirty=!1,this._updateID=0,this.ownsStyle=!1;const i=new Image,n=gt.from(i,{scaleMode:We.SCALE_MODE,resourceOptions:{autoLoad:!1}});n.orig=new Tt,n.trim=new Tt,this.texture=n;const r="http://www.w3.org/2000/svg",a="http://www.w3.org/1999/xhtml",o=document.createElementNS(r,"svg"),h=document.createElementNS(r,"foreignObject"),l=document.createElementNS(a,"div"),c=document.createElementNS(a,"style");h.setAttribute("width","10000"),h.setAttribute("height","10000"),h.style.overflow="hidden",o.appendChild(h),this.maxWidth=oo.defaultMaxWidth,this.maxHeight=oo.defaultMaxHeight,this._domElement=l,this._styleElement=c,this._svgRoot=o,this._foreignObject=h,this._foreignObject.appendChild(c),this._foreignObject.appendChild(l),this._image=i,this._loadImage=new Image,this._autoResolution=oo.defaultAutoResolution,this._resolution=oo.defaultResolution??We.RESOLUTION,this.text=e,this.style=t}measureText(e){var c,u;const{text:t,style:i,resolution:n}=Object.assign({text:this._text,style:this._style,resolution:this._resolution},e);Object.assign(this._domElement,{innerHTML:t,style:i.toCSS(n)}),this._styleElement.textContent=i.toGlobalCSS(),document.body.appendChild(this._svgRoot);const r=this._domElement.getBoundingClientRect();this._svgRoot.remove();const{width:a,height:o}=r;(a>this.maxWidth||o>this.maxHeight)&&console.warn("[HTMLText] Large expanse of text, increase HTMLText.maxWidth or HTMLText.maxHeight property.");const h=Math.min(this.maxWidth,Math.ceil(a)),l=Math.min(this.maxHeight,Math.ceil(o));return this._svgRoot.setAttribute("width",h.toString()),this._svgRoot.setAttribute("height",l.toString()),t!==this._text&&(this._domElement.innerHTML=this._text),i!==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+i.padding*2,height:l+i.padding*2}}async updateText(e=!0){const{style:t,_image:i,_loadImage:n}=this;if(this.localStyleID!==t.styleID&&(this.dirty=!0,this.localStyleID=t.styleID),!this.dirty&&e)return;const{width:r,height:a}=this.measureText();i.width=n.width=Math.ceil(Math.max(1,r)),i.height=n.height=Math.ceil(Math.max(1,a)),this._updateID++;const o=this._updateID;await new Promise(h=>{n.onload=async()=>{if(o/gi,"

").replace(/
/gi,"
").replace(/ /gi," ")}};Tc.defaultDestroyOptions={texture:!0,children:!1,baseTexture:!0},Tc.defaultMaxWidth=2024,Tc.defaultMaxHeight=2024,Tc.defaultAutoResolution=!0;function Rh(s,e){const t=Math.max(0,Number(s)||0),i=Math.max(0,Number(e)||0);return{inner:Math.min(t,i),outer:Math.max(t,i)}}function u1(s){const e=Math.max(0,Number(s.outerRectW)||0),t=Math.max(0,Number(s.outerRectH)||0);return{innerW:Math.min(e,Math.max(0,Number(s.innerRectW)||0)),innerH:Math.min(t,Math.max(0,Number(s.innerRectH)||0)),outerW:e,outerH:t}}function RI(s,e,t,i,n){if(s==="random")return n();const r=Math.max(1,Math.round(t)),a=Math.max(0,Math.round(e))%r;return i?a/r:r<=1?.5:a/(r-1)}function Rv(s,e,t,i){const n=Math.sqrt(s*s+i()*(e*e-s*s));return{x:Math.cos(t)*n,y:-Math.sin(t)*n,radialAngle:-t*180/Math.PI}}function PI(s,e){const{innerW:t,innerH:i,outerW:n,outerH:r}=u1(s),a=Math.max(0,(n-t)/2),o=Math.max(0,(r-i)/2),h=a*r,l=t*o,c=h*2+l*2;if(c<=0){const p=n*2+r*2;if(p<=0)return{x:0,y:0,radialAngle:0};let m=e()*p,g,v;return mtypeof B=="object"&&B!==null?{...B}:B):k);i&&(s.innerRadius=0,s.outerRadius=Math.max(0,Number.isFinite(n)?n:e.outerRadius),s.innerRectW=0,s.innerRectH=0,s.outerRectW=Math.max(0,Number.isFinite(r)?r:e.outerRectW),s.outerRectH=Math.max(0,Number.isFinite(a)?a:e.outerRectH),s.coneDirection=Number.isFinite(o)?o:90,s.emissionAngleMode=Number.isFinite(h)&&h>0?"random":"fixed",l==="cone"&&(s.spread=Math.max(0,Number(s.coneAngle)||0)),s.shapeRangeVersion=1),s.shape==="orbit"&&(s.shape="path"),["fixed","random","radial","path-normal","path-tangent"].includes(s.emissionAngleMode)||(s.emissionAngleMode="fixed"),!["circle","rect","cone"].includes(s.shape)&&s.emissionAngleMode==="radial"&&(s.emissionAngleMode="fixed"),s.shape!=="path"&&(s.emissionAngleMode==="path-normal"||s.emissionAngleMode==="path-tangent")&&(s.emissionAngleMode="fixed"),s.spawnPathId=Math.max(0,Math.round(Number(s.spawnPathId)||0)),s.spawnPathDistribution!=="fixed"&&s.spawnPathDistribution!=="random"&&(s.spawnPathDistribution="fixed"),s.innerRadius=Math.max(0,Number(s.innerRadius)||0),s.outerRadius=Math.max(s.innerRadius,Number(s.outerRadius)||0),s.innerRectW=Math.max(0,Number(s.innerRectW)||0),s.innerRectH=Math.max(0,Number(s.innerRectH)||0),s.outerRectW=Math.max(s.innerRectW,Number(s.outerRectW)||0),s.outerRectH=Math.max(s.innerRectH,Number(s.outerRectH)||0);const P=Array.from(new Set((Array.isArray(s.collisionColliderIds)?s.collisionColliderIds:[]).map(I=>Math.round(Number(I))).filter(I=>Number.isFinite(I)&&I>0)));(P.length!==s.collisionColliderIds.length||P.some((I,k)=>I!==s.collisionColliderIds[k]))&&(s.collisionColliderIds=P),s.streamBehavior!=="normal"&&s.streamBehavior!=="loop"&&(s.streamBehavior="normal"),(u||!Number.isFinite(s.loopDurationFrames))&&(s.loopDurationFrames=Math.ceil(Math.max(1/30,Number(s.duration)||1)*30)),s.loopDurationFrames=Math.min(1800,Math.max(1,Math.ceil(s.loopDurationFrames))),typeof s.generateLoopStartAnimation!="boolean"&&(s.generateLoopStartAnimation=!1),typeof s.generateLoopEndAnimation!="boolean"&&(s.generateLoopEndAnimation=!1),typeof s.loopStartUseCustomDuration!="boolean"&&(s.loopStartUseCustomDuration=!1),typeof s.loopEndUseCustomDuration!="boolean"&&(s.loopEndUseCustomDuration=!1),s.loopStartDurationFrames=Math.min(1800,Math.max(1,Math.ceil(Number(s.loopStartDurationFrames)||30))),s.loopEndDurationFrames=Math.min(1800,Math.max(1,Math.ceil(Number(s.loopEndDurationFrames)||30))),(!Array.isArray(s.imageResources)||s.imageResources.length===0)&&(s.imageResources=Dl().imageResources);for(const I of s.imageResources){!I.texture&&s.texture&&(I.texture=s.texture),I.textureName||(I.textureName="star"),I.previewUrl==="/particles/star.png"&&(I.previewUrl="/images/star.png"),I.previewUrl||(I.previewUrl=I.textureName==="star"?"/images/star.png":""),I.imageMode!=="fixed"&&I.imageMode!=="sequence"&&(I.imageMode="fixed"),I.sequencePlayback==="once"?I.sequencePlayback="once-hold":I.sequencePlayback==="loop"?I.sequencePlayback="loop-forward":["once-hide","once-hold","loop-forward","loop-reverse"].includes(I.sequencePlayback)||(I.sequencePlayback="loop-forward"),Number.isFinite(I.sequenceFps)||(I.sequenceFps=30),I.sequenceFps=Math.min(120,Math.max(1,Number(I.sequenceFps)||30)),Array.isArray(I.sequenceFrames)||(I.sequenceFrames=[]);for(const k of I.sequenceFrames)typeof k.name!="string"&&(k.name=""),typeof k.previewUrl!="string"&&(k.previewUrl=""),k.texture===void 0&&(k.texture=null);Number.isFinite(I.weight)||(I.weight=100),typeof I.locked!="boolean"&&(I.locked=!1),Number.isFinite(I.scale)||(I.scale=1),Number.isFinite(I.anchorX)||(I.anchorX=.5),Number.isFinite(I.anchorY)||(I.anchorY=.5),I.colorMode!=="fixed"&&I.colorMode!=="random"&&I.colorMode!=="lifetime"&&(I.colorMode=s.colorOverLife?"lifetime":"fixed"),I.colorStart||(I.colorStart=s.colorStart||"#ffffff"),I.colorEnd||(I.colorEnd=s.colorEnd||I.colorStart),(!Array.isArray(I.colorGradient)||I.colorGradient.length<2)&&(I.colorGradient=[{position:0,color:I.colorStart},{position:1,color:I.colorEnd}]),Object.prototype.hasOwnProperty.call(Rr,I.blend)||(I.blend=s.blend||"normal"),["off","fixed","curve"].includes(I.independentAlpha)||(I.independentAlpha=s.independentAlpha||"off"),Number.isFinite(I.alpha)||(I.alpha=Number.isFinite(s.alphaScale)?s.alphaScale:1),["跟随导出","线性","贝塞尔"].includes(I.alphaCurveMode)||(I.alphaCurveMode=s.curveMode||"跟随导出"),(!Array.isArray(I.alphaCurve)||I.alphaCurve.length<2)&&(I.alphaCurve=(s.alphaCurve||[{x:0,y:1},{x:1,y:1}]).map(k=>({...k})))}if(s.imageResources.length===1)s.imageResources[0].weight=100,s.imageResources[0].locked=!1;else if(c){const I=100/s.imageResources.length;s.imageResources.forEach((k,B)=>{k.weight=B===s.imageResources.length-1?100-I*(s.imageResources.length-1):I,k.locked=!1})}if(s.imageWeightVersion=1,d){const I=Number.isFinite(f)&&f!==0?f:980;s.gravity=I,s.gravityMin=I,s.gravityMax=I}if(p){const I=Number.isFinite(m)&&Number.isFinite(g)&&(m!==0||g!==0);s.windMin=I?Math.hypot(m,g):100,s.windMax=s.windMin,s.windDirection=I?Math.atan2(-g,m)*180/Math.PI:0}v&&(s.forceStrength=Number.isFinite(b)&&b!==0?b:10),y&&(s.trailConfigVersion=3,s.trailAlphaCurve=[{x:0,y:1},{x:1,y:1}],s.trailLifeLengthCurve=[{x:0,y:1},{x:1,y:1}],s.trailShapeCurve=[{x:0,y:1},{x:1,y:1}],s.trailGridRows=4,s.trailGridCols=4),(w||!s.trailResources.length)&&(s.trailResources=[{id:1,texture:T||null,textureName:_,previewUrl:R,weight:100,locked:!1,rotation:0,colorMode:s.trailColorMode,color:s.trailColor,colorGradient:s.trailColorGradient.map(I=>({...I})),blend:"normal",alphaMode:s.trailAlphaMode,alpha:s.trailAlpha,alphaCurve:s.trailAlphaCurve.map(I=>({...I})),boneCount:s.trailBoneCount,trailRatio:100,lengthMode:"fixed",length:s.trailLength,lengthMin:s.trailLength,lengthMax:s.trailLength,widthSizeMode:"fixed",width:s.trailWidth,widthMin:s.trailWidth,widthMax:s.trailWidth,widthMode:s.trailWidthMode,lifeLengthEnabled:s.trailLifeLengthEnabled,lifeLengthCurve:s.trailLifeLengthCurve.map(I=>({...I})),shapeEnabled:s.trailShapeEnabled,shapeCurve:s.trailShapeCurve.map(I=>({...I}))}]);for(const I of s.trailResources)I.textureName||(I.textureName="trail"),I.previewUrl==="/trails/trail.png"&&(I.previewUrl="/images/trail.png"),I.previewUrl||(I.previewUrl="/images/trail.png"),Number.isFinite(I.weight)||(I.weight=100),typeof I.locked!="boolean"&&(I.locked=!1),Number.isFinite(I.rotation)||(I.rotation=0),["particle","fixed","curve"].includes(I.colorMode)||(I.colorMode=s.trailColorMode||"particle"),I.color||(I.color=s.trailColor||"#ffffff"),(!Array.isArray(I.colorGradient)||I.colorGradient.length<2)&&(I.colorGradient=(s.trailColorGradient||[{position:0,color:"#ffffff"},{position:1,color:"#ffffff"}]).map(k=>({...k}))),Object.prototype.hasOwnProperty.call(Rr,I.blend)||(I.blend="normal"),["particle","fixed","curve"].includes(I.alphaMode)||(I.alphaMode=s.trailAlphaMode||"particle"),Number.isFinite(I.alpha)||(I.alpha=Number.isFinite(s.trailAlpha)?s.trailAlpha:1),(!Array.isArray(I.alphaCurve)||I.alphaCurve.length<2)&&(I.alphaCurve=(s.trailAlphaCurve||[{x:0,y:1},{x:1,y:1}]).map(k=>({...k}))),Number.isFinite(I.boneCount)||(I.boneCount=Number.isFinite(s.trailBoneCount)?s.trailBoneCount:3),Number.isFinite(I.trailRatio)||(I.trailRatio=100),I.trailRatio=Math.min(100,Math.max(0,I.trailRatio)),["fixed","random"].includes(I.lengthMode)||(I.lengthMode="fixed"),Number.isFinite(I.length)||(I.length=Number.isFinite(s.trailLength)?s.trailLength:100),Number.isFinite(I.lengthMin)||(I.lengthMin=I.length),Number.isFinite(I.lengthMax)||(I.lengthMax=I.length),["fixed","random"].includes(I.widthSizeMode)||(I.widthSizeMode="fixed"),Number.isFinite(I.width)||(I.width=Number.isFinite(s.trailWidth)?s.trailWidth:100),Number.isFinite(I.widthMin)||(I.widthMin=I.width),Number.isFinite(I.widthMax)||(I.widthMax=I.width),["particle","fixed"].includes(I.widthMode)||(I.widthMode=s.trailWidthMode||"particle"),typeof I.lifeLengthEnabled!="boolean"&&(I.lifeLengthEnabled=!!s.trailLifeLengthEnabled),(!Array.isArray(I.lifeLengthCurve)||I.lifeLengthCurve.length<2)&&(I.lifeLengthCurve=(s.trailLifeLengthCurve||[{x:0,y:1},{x:1,y:1}]).map(k=>({...k}))),typeof I.shapeEnabled!="boolean"&&(I.shapeEnabled=!!s.trailShapeEnabled),(!Array.isArray(I.shapeCurve)||I.shapeCurve.length<2)&&(I.shapeCurve=(s.trailShapeCurve||[{x:0,y:1},{x:1,y:1}]).map(k=>({...k})));if(s.trailResources.length===1&&(s.trailResources[0].weight=100,s.trailResources[0].locked=!1),A)for(const I of s.trailResources)I.alphaCurve=((F=I.alphaCurve)==null?void 0:F.length)>=2?I.alphaCurve:[{x:0,y:1},{x:1,y:1}];return s.trailResourceVersion=6,s}const Rr={normal:0,add:1,multiply:2,screen:3},OI=400;class BI extends ji{constructor(t,i=OI){super();x(this,"pool",[]);x(this,"cfg");x(this,"accumulator",0);x(this,"burstTimer",0);x(this,"_spawnSerial",0);x(this,"_elapsed",0);x(this,"_attractionEnabledAt",0);x(this,"_attractionWasEnabled",!1);x(this,"_emitterPos",null);x(this,"states",[]);x(this,"rng",Math.random);x(this,"_lastSeed",-1);x(this,"trailDebugGfx",new ys);x(this,"colliders",[]);x(this,"followSpawnX",0);x(this,"followSpawnY",0);x(this,"followSpawnAngle",0);x(this,"spawnPathSampler",null);x(this,"spawnPathClosed",!1);x(this,"followExportCurveMode","线性");x(this,"simulationTransform",null);this.cfg=Wr(t),this._ensurePool(i),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=pf(t>>>0))}_ensurePool(t){for(;this.pool.length=n.delay),a=i==="force"||i==="normal"&&(n.mode==="burst"||this._elapsed=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 o=[];for(let p=0;p0){const O=Math.max(1e-4,Math.abs(n.rootScaleX)),X=Math.max(1e-4,Math.abs(n.rootScaleY)),E=-(((h=this.simulationTransform)==null?void 0:h.rotation)??n.rootRotation)*Math.PI/180,V=Math.cos(E),q=Math.sin(E),W=((l=this.simulationTransform)==null?void 0:l.centerX)??n.centerX,J=((c=this.simulationTransform)==null?void 0:c.centerY)??n.centerY,K=W+V*O*m.x-q*X*m.y,fe=-J+q*O*m.x+V*X*m.y,me=K,we=-fe,Ee=n.forceCenterX-me,pe=n.forceCenterY-we,Ae=Math.hypot(Ee,pe);if(Ae>1e-4&&Ae<=n.forceRadius){let G=1;n.forceFalloff==="linear"?G=1-Ae/n.forceRadius:n.forceFalloff==="inverse"&&(G=Math.min(10,n.forceRadius/Math.max(Ae,n.forceRadius*.1)));const Z=n.forceStrength*G*10,z=Ee/Ae*Z,j=pe/Ae*Z,te=z,he=-j;m.vx+=(V*te+q*he)/O*t,m.vy+=(-q*te+V*he)/X*t}}if(!m.collisionPaused&&n.damping>0){const O=Math.max(0,1-n.damping*t);m.vx*=O,m.vy*=O}if(m.collisionPaused)m.vx=0,m.vy=0;else if(m.x+=m.vx*t,m.y+=m.vy*t,this.applyColliders(m,p))continue;if(n.attraction&&!m.collisionPaused){const O=m.maxLife-m.life;if(n.attractionDelayMode==="particle"?O>=Math.max(0,n.attractionDelay):this._elapsed-this._attractionEnabledAt>=Math.max(0,n.attractionDelay)){const E=Za(n,m.x,m.y,this.simulationTransform),V=n.attractionCenterX,q=n.attractionCenterY,W=Math.max(0,n.attractionRadius);if(!m.attractionActive){if(Math.hypot(V-E.x,q-E.y)<=W){this.kill(p);continue}m.attractionActive=!0,m.attractionElapsed=0,m.attractionStartWorldX=E.x,m.attractionStartWorldY=E.y}m.attractionElapsed+=t;const J=Math.max(1e-4,n.attractionDuration),K=Math.min(1,m.attractionElapsed/J);let fe=Vi(m.attractionStartWorldX,V,K),me=Vi(m.attractionStartWorldY,q,K);if(n.attractionPath==="curve"){const pe=V-m.attractionStartWorldX,Ae=q-m.attractionStartWorldY,G=Math.hypot(pe,Ae);if(G>1e-4){const Z=G*.25*m.attractionCurveSide,z=(m.attractionStartWorldX+V)*.5-Ae/G*Z,j=(m.attractionStartWorldY+q)*.5+pe/G*Z,te=1-K;fe=te*te*m.attractionStartWorldX+2*te*K*z+K*K*V,me=te*te*m.attractionStartWorldY+2*te*K*j+K*K*q}}const we=Math.hypot(V-fe,q-me);if(K>=1||we<=W){this.kill(p);continue}const Ee=Pv(n,fe,me,this.simulationTransform);m.x=Ee.x,m.y=Ee.y,m.vx=0,m.vy=0}}const v=g,b=m.sprite,y=n.imageResources.find(O=>O.id===m.resourceId);if(y){const O=this.imageFrameState(y,m.maxLife-m.life);m.imageFrameIndex=O.index,b.texture=this.imageFrameTexture(y,m.imageFrameIndex),b.visible=O.visible}if(n.speedOverLifeEnabled){const O=Ac(mf(n.speedOverLifeMode,n.speedOverLifeMin,n.speedOverLifeMax,n.speedOverLifeCurve,v,m.speedScaleTarget),1),X=m.speedScale===0?O:O/m.speedScale;m.vx*=X,m.vy*=X,m.speedScale=O}let w=m.rotationSpeed;n.rotationOverLifeEnabled&&n.rotationOverLifeMode==="curve"&&(w=Vi(n.rotationSpeedMin,n.rotationSpeedMax,wn(n.rotationOverLifeCurve,v))),m.rotation+=w*t;let A=m.x,T=m.y;if(n.noise&&n.noiseAmt>0&&n.noiseRange>0&&n.noiseSpeed>0){const O=m.maxLife-m.life,X=Math.max(0,n.noiseRange)*Math.min(1,Math.max(0,n.noiseAmt)/100)*.5,E=O*Math.max(0,n.noiseSpeed)*Math.PI*2;A+=(Math.sin(m.noisePhaseX+E)-Math.sin(m.noisePhaseX))*X,T+=(Math.sin(m.noisePhaseY+E*.83)-Math.sin(m.noisePhaseY))*X}b.x=A,b.y=T,b.rotation=-m.rotation*Math.PI/180;let _=1,R=1;n.scaleOverLifeEnabled&&(_=mf(n.scaleOverLifeMode,n.scaleOverLifeMin,n.scaleOverLifeMax,n.scaleOverLifeCurve,v,m.scaleOverLifeX),R=n.scaleOverLifeAxisMode==="separate"?mf(n.scaleOverLifeMode,n.scaleYOverLifeMin,n.scaleYOverLifeMax,n.scaleYOverLifeCurve,v,m.scaleOverLifeY):_),b.scale.set(Ac(m.scaleStartX*_,1),Ac(m.scaleStartY*R,1));const P=n.alphaMode==="curve"?wn(n.alphaCurve,v,this.resolveCurveMode(n.curveMode))*n.alphaScale:n.alpha*n.alphaScale;b.alpha=Ac((y==null?void 0:y.independentAlpha)==="fixed"?y.alpha:(y==null?void 0:y.independentAlpha)==="curve"?wn(y.alphaCurve,v,this.resolveCurveMode(y.alphaCurveMode)):P,1);const F=(y==null?void 0:y.colorStart)||"#ffffff",I=(y==null?void 0:y.colorMode)==="lifetime"?gf(y.colorGradient,v):(y==null?void 0:y.colorMode)==="random"?m.colorSample:Mo(F);b.tint=I,b.blendMode=Rr[(y==null?void 0:y.blend)||"normal"];const k=this.updateTrail(m,A,T,v,b),B=Za(n,A,T,this.simulationTransform),D=((u=this.simulationTransform)==null?void 0:u.rotation)??n.rootRotation,U=Math.abs(((d=this.simulationTransform)==null?void 0:d.scaleX)??n.rootScaleX),L=Math.abs(((f=this.simulationTransform)==null?void 0:f.scaleY)??n.rootScaleY),N=k?{...k,bones:k.bones.map(O=>{const X=Za(n,O.x,O.y,this.simulationTransform);return{...O,worldX:X.x,worldY:X.y,worldRotation:D-O.rotation}})}:void 0;o.push({boneName:m.boneName,spawnId:m.spawnId,x:A,y:T,rotation:m.rotation,scaleX:b.scale.x,scaleY:b.scale.y,worldX:B.x,worldY:B.y,worldRotation:D+m.rotation,worldScaleX:b.scale.x*U,worldScaleY:b.scale.y*L,alpha:b.alpha,colorHex:I,resourceId:m.resourceId,imageFrameIndex:m.imageFrameIndex,imageVisible:b.visible,trailState:N,active:!0})}return this.states=o,o}ensureTrailMesh(t){const i=this.cfg,n=i.trailResources.find(g=>g.id===t.trailResourceId)||i.trailResources[0],r=(n==null?void 0:n.texture)||gt.EMPTY,a=Number(n==null?void 0:n.rotation)||0,o=Math.max(2,Math.min(16,Math.round(i.trailGridRows))),h=Math.max(2,Math.min(32,Math.round(i.trailGridCols))),l=Math.max(2,Math.min(16,Math.round((n==null?void 0:n.boneCount)??3))),c=`${o}:${h}:${l}:${(n==null?void 0:n.id)??0}:${a}`;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(o*h*2),d=new Float32Array(o*h*2),f=[],p=[];for(let g=0;g.05?t.trailHistory.unshift({x:i,y:n}):(a.x=i,a.y=n);const o=Math.max(1,r)*1.5;let h=0,l=t.trailHistory.length;for(let c=1;c=o||c>=239){l=c+1;break}t.trailHistory.length>l&&(t.trailHistory.length=l)}sampleTrailBones(t,i,n){const r=Math.max(2,Math.min(16,Math.round(n))),a=t.trailHistory,o=[];if(!a.length)return o;let h=0;for(let c=1;c=u&&v>1e-4){const b=(u-d)/v;f={x:Vi(m.x,g.x,b),y:Vi(m.y,g.y,b)};break}d+=v}o.push({boneName:`${t.boneName}_trail_${c}`,x:f.x,y:f.y,rotation:0})}for(let c=0;c1){const c=o[0].rotation,d=(o[o.length-1].rotation-c+540)%360-180;for(let f=0;fu.id===i.resourceId)||r.trailResources[0];if(!(a!=null&&a.texture)||i.bones.length<2){n.visible=!1;return}t.trailResourceId=a.id,n.texture!==a.texture&&(n.texture=a.texture);const o=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.5&&i.alpha>0}updateTrail(t,i,n,r,a){const o=this.cfg;if(!o.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=o.trailResources.find(f=>f.id===t.trailResourceId)||o.trailResources[0];this.appendTrailPoint(t,i,n,t.trailSampledLength);const l=h!=null&&h.lifeLengthEnabled?Math.max(0,wn(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=i,t.trailBones[0].y=n);const u=(h==null?void 0:h.widthMode)==="particle"?(Math.abs(a.scale.x)+Math.abs(a.scale.y))*.5:1;t.trailCurrentWidth=Math.max(0,t.trailSampledWidth)*u,t.trailCurrentAlpha=(h==null?void 0:h.alphaMode)==="particle"?a.alpha:(h==null?void 0:h.alphaMode)==="curve"?wn(h.alphaCurve,r):(h==null?void 0:h.alpha)??1,t.trailCurrentColor=(h==null?void 0:h.colorMode)==="particle"?a.tint:(h==null?void 0:h.colorMode)==="curve"?gf(h.colorGradient,r):Mo((h==null?void 0:h.color)||"#ffffff");const d={bones:t.trailBones.map(f=>({...f})),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,d),d}drawTrailMeshDebug(t){const i=this.trailDebugGfx;if(i.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)));i.lineStyle(1,3790847,.72);for(const a of this.pool){const o=a.trailMesh;if(!(o!=null&&o.visible))continue;const h=o.vertices,l=(c,u)=>{const d=(c*n+u)*2;return{x:h[d],y:h[d+1]}};for(let c=0;c0&&this.spawnPathSampler){const o=this.estimatedEmissionCount(),h=RI(t.spawnPathDistribution,this._spawnSerial,o,this.spawnPathClosed,this.rng),l=this.spawnPathSampler(h);if(l)return{...this.applyFollowToOrigin(l.x+i,l.y+n),radialAngle:0,pathAngle:l.angle}}const r=kI(t,this.rng);return{...this.applyFollowToOrigin(i+r.x,n+r.y),radialAngle:r.radialAngle}}estimatedEmissionCount(){const t=this.cfg;return t.mode==="burst"?Math.max(1,Math.round(t.burstCount)):Math.max(1,Math.floor(t.rate*(t.streamBehavior==="loop"?Math.max(1,t.loopDurationFrames)/30:Math.max(0,t.duration))))}applyFollowToOrigin(t,i){const n=this.followSpawnAngle*Math.PI/180,r=Math.cos(n),a=Math.sin(n);return{x:this.followSpawnX+r*t-a*i,y:this.followSpawnY+a*t+r*i}}spawnOne(){const t=this.cfg;let i=this.pool.findIndex(w=>!w.active);if(i===-1)return;const n=this.spawnOrigin(),{x:r,y:a}=n,o=Ja(t.lifeMode,t.lifeMin,t.lifeMax,t.lifeCurve,this.rng()),h=Ja(t.speedMode,t.speedMin,t.speedMax,t.speedCurve,this.rng()),l=FI(t,n,this.followSpawnAngle,this.rng),c=this.pool[i],u=this.pickImageResource(),d=this._spawnSerial++;c.spawnId=d;const f=this.pickTrailResource(ca(t.seed,d,1540483477));c.noisePhaseX=ca(t.seed,d,1757159915)*Math.PI*2,c.noisePhaseY=ca(t.seed,d,48610963)*Math.PI*2,c.gravityStrength=t.useGravity&&t.gravityMode==="random"?Vi(t.gravityMin,t.gravityMax,this.rng()):t.gravityMin,c.windStrength=t.wind&&t.windMode==="random"?Vi(t.windMin,t.windMax,this.rng()):t.windMin,c.attractionActive=!1,c.attractionElapsed=0,c.collisionPaused=!1,c.attractionCurveSide=ca(t.seed,d,2738958700)<.5?-1:1,c.trailHistory.length=0,c.trailBones.length=0,c.trailCurrentWidth=0,c.trailCurrentAlpha=0,c.trailCurrentColor=16777215,c.trailResourceId=f.id;const p=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=p>0&&m===1&&d===0,v=ca(t.seed,d,668265261)*100,b=(w,A,T,_,R)=>{if(w!=="random")return Math.max(0,Number(A)||0);const P=Math.max(0,Math.min(Number(T)||0,Number(_)||0)),F=Math.max(0,Math.max(Number(T)||0,Number(_)||0));return Vi(P,F,ca(t.seed,d,R))};c.trailSampledLength=b(f.lengthMode,f.length,f.lengthMin,f.lengthMax,374761393),c.trailSampledWidth=b(f.widthSizeMode,f.width,f.widthMin,f.widthMax,3550635116),c.trailEnabled=t.trail&&(g||v0&&c.trailSampledWidth>0,c.trailMesh&&(c.trailMesh.visible=!1),c.active=!0,c.life=o,c.maxLife=o,c.x=r,c.y=a,c.trailEnabled&&c.trailHistory.push({x:r,y:a}),c.vx=Math.cos(l)*h,c.vy=Math.sin(l)*h,c.scaleStartX=Ja(t.scaleMode,t.scaleMin,t.scaleMax,t.scaleCurve,this.rng())*u.scale,c.scaleStartY=t.scaleAxisMode==="separate"?Ja(t.scaleMode,t.scaleYMin,t.scaleYMax,t.scaleYCurve,this.rng())*u.scale:c.scaleStartX,c.alphaStart=t.alpha,c.alphaEnd=t.alphaEnd,c.rotation=t.initialRotationMode==="direction"?-Math.atan2(c.vy,c.vx)*180/Math.PI+t.initialRotationMin:Ja(t.initialRotationMode,t.initialRotationMin,t.initialRotationMax,t.initialRotationCurve,this.rng()),c.rotationSpeed=t.rotationOverLifeEnabled?Ja(t.rotationOverLifeMode,t.rotationSpeedMin,t.rotationSpeedMax,t.rotationOverLifeCurve,this.rng()):0,c.speedScale=1,c.speedScaleTarget=t.speedOverLifeMode==="random"?Vi(t.speedOverLifeMin,t.speedOverLifeMax,this.rng()):t.speedOverLifeMin,c.scaleOverLifeX=t.scaleOverLifeMode==="random"?Vi(t.scaleOverLifeMin,t.scaleOverLifeMax,this.rng()):t.scaleOverLifeMin,c.scaleOverLifeY=t.scaleOverLifeMode==="random"?Vi(t.scaleYOverLifeMin,t.scaleYOverLifeMax,this.rng()):t.scaleYOverLifeMin,c.resourceId=u.id,c.colorSample=u.colorMode==="random"?gf(u.colorGradient,ca(t.seed,d,2654435769)):Mo(u.colorStart);const y=this.imageFrameState(u,0);c.imageFrameIndex=y.index,c.sprite.texture=this.imageFrameTexture(u,y.index),c.sprite.anchor.set(u.anchorX,u.anchorY),c.sprite.blendMode=Rr[u.blend],c.sprite.tint=c.colorSample,c.sprite.visible=!0}pickImageResource(){const t=this.cfg.imageResources.filter(r=>r.texture||r.sequenceFrames.some(a=>a.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 i=t.reduce((r,a)=>r+Math.max(0,a.weight),0);if(i<=0)return t[Math.floor(this.rng()*t.length)];let n=this.rng()*i;for(const r of t)if(n-=Math.max(0,r.weight),n<=0)return r;return t[t.length-1]}imageFrameState(t,i){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,i)*n)),a=t.sequenceFrames.length-1;return t.sequencePlayback==="once-hide"?{index:Math.min(a,r),visible:r<=a}:t.sequencePlayback==="once-hold"?{index:Math.min(a,r),visible:!0}:t.sequencePlayback==="loop-reverse"?{index:a-r%t.sequenceFrames.length,visible:!0}:{index:r%t.sequenceFrames.length,visible:!0}}imageFrameTexture(t,i){var n;return t.imageMode==="sequence"&&t.sequenceFrames.length?((n=t.sequenceFrames[Math.max(0,Math.min(t.sequenceFrames.length-1,i))])==null?void 0:n.texture)||t.texture||this.cfg.texture:t.texture||this.cfg.texture}pickTrailResource(t){const i=this.cfg.trailResources.filter(a=>a.texture);if(!i.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=i.reduce((a,o)=>a+Math.max(0,o.weight),0);if(n<=0)return i[Math.min(i.length-1,Math.floor(t*i.length))];let r=t*n;for(const a of i)if(r-=Math.max(0,a.weight),r<=0)return a;return i[i.length-1]}kill(t){const i=this.pool[t];i.active=!1,i.sprite.visible=!1,i.trailHistory.length=0,i.trailBones.length=0,i.trailMesh&&(i.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 i of this.pool)i.active&&t++;return t}capture(){const t=[];for(const i of this.pool)i.active&&t.push({boneName:i.boneName,spawnId:i.spawnId,x:i.sprite.x,y:i.sprite.y,rotation:i.rotation,scaleX:i.sprite.scale.x,scaleY:i.sprite.scale.y,...this.captureWorldTransform(i),alpha:i.sprite.alpha,colorHex:i.sprite.tint,resourceId:i.resourceId,imageFrameIndex:i.imageFrameIndex,imageVisible:i.sprite.visible,active:!0,trailState:this.cfg.trail&&i.trailBones.length?{bones:i.trailBones.map(n=>{var a;const r=Za(this.cfg,n.x,n.y,this.simulationTransform);return{...n,worldX:r.x,worldY:r.y,worldRotation:(((a=this.simulationTransform)==null?void 0:a.rotation)??this.cfg.rootRotation)-n.rotation}}),activeBoneCount:i.trailBones.length,width:i.trailCurrentWidth,alpha:i.trailCurrentAlpha,colorHex:i.trailCurrentColor,resourceId:i.trailResourceId}:void 0});return t}captureWorldTransform(t){var r,a,o;const i=Za(this.cfg,t.sprite.x,t.sprite.y,this.simulationTransform),n=((r=this.simulationTransform)==null?void 0:r.rotation)??this.cfg.rootRotation;return{worldX:i.x,worldY:i.y,worldRotation:n+t.rotation,worldScaleX:t.sprite.scale.x*Math.abs(((a=this.simulationTransform)==null?void 0:a.scaleX)??this.cfg.rootScaleX),worldScaleY:t.sprite.scale.y*Math.abs(((o=this.simulationTransform)==null?void 0:o.scaleY)??this.cfg.rootScaleY)}}apply(t){var n;const i=new Map;for(const r of t)i.set(r.boneName,r);for(const r of this.pool){const a=i.get(r.boneName);if(!a){r.active=!1,r.sprite.visible=!1,r.trailMesh&&(r.trailMesh.visible=!1);continue}r.active=a.active;const o=r.sprite;if(o.visible=a.active&&a.imageVisible!==!1,o.x=a.x,o.y=a.y,o.rotation=-a.rotation*Math.PI/180,o.scale.set(a.scaleX,a.scaleY),o.alpha=a.alpha,o.tint=a.colorHex,a.resourceId!=null){const h=this.cfg.imageResources.find(l=>l.id===a.resourceId);h&&(r.imageFrameIndex=a.imageFrameIndex??0,o.texture=this.imageFrameTexture(h,r.imageFrameIndex),o.anchor.set(h.anchorX,h.anchorY),o.blendMode=Rr[h.blend])}this.cfg.trail&&a.trailState?(r.trailResourceId=a.trailState.resourceId??((n=this.cfg.trailResources[0])==null?void 0:n.id)??1,r.trailBones=a.trailState.bones.map(h=>({...h})),r.trailCurrentWidth=a.trailState.width,r.trailCurrentAlpha=a.trailState.alpha,this.skinTrailMesh(r,a.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=pf(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=pf(this.cfg.seed>>>0)}}function Vi(s,e,t){return s+(e-s)*t}function Ac(s,e){return Number.isFinite(s)?s:e}function Za(s,e,t,i=null){const n=Math.max(1e-4,Math.abs((i==null?void 0:i.scaleX)??s.rootScaleX)),r=Math.max(1e-4,Math.abs((i==null?void 0:i.scaleY)??s.rootScaleY)),a=-((i==null?void 0:i.rotation)??s.rootRotation)*Math.PI/180,o=Math.cos(a),h=Math.sin(a),l=(i==null?void 0:i.centerX)??s.centerX,c=(i==null?void 0:i.centerY)??s.centerY,u=l+o*n*e-h*r*t,d=-c+h*n*e+o*r*t;return{x:u,y:-d}}function Pv(s,e,t,i=null){const n=Math.max(1e-4,Math.abs((i==null?void 0:i.scaleX)??s.rootScaleX)),r=Math.max(1e-4,Math.abs((i==null?void 0:i.scaleY)??s.rootScaleY)),a=-((i==null?void 0:i.rotation)??s.rootRotation)*Math.PI/180,o=Math.cos(a),h=Math.sin(a),l=e-((i==null?void 0:i.centerX)??s.centerX),c=-t+((i==null?void 0:i.centerY)??s.centerY);return{x:(o*l+h*c)/n,y:(-h*l+o*c)/r}}function LI(s,e,t,i=null){const n=Math.max(1e-4,Math.abs((i==null?void 0:i.scaleX)??s.rootScaleX)),r=Math.max(1e-4,Math.abs((i==null?void 0:i.scaleY)??s.rootScaleY)),a=-((i==null?void 0:i.rotation)??s.rootRotation)*Math.PI/180,o=Math.cos(a),h=Math.sin(a),l=o*n*e-h*r*t,c=h*n*e+o*r*t;return{x:l,y:-c}}function DI(s,e,t,i=null){const n=Math.max(1e-4,Math.abs((i==null?void 0:i.scaleX)??s.rootScaleX)),r=Math.max(1e-4,Math.abs((i==null?void 0:i.scaleY)??s.rootScaleY)),a=-((i==null?void 0:i.rotation)??s.rootRotation)*Math.PI/180,o=Math.cos(a),h=Math.sin(a),l=-t;return{x:(o*e+h*l)/n,y:(-h*e+o*l)/r}}function NI(s,e,t){const i=s.rotation*Math.PI/180,n=Math.cos(i),r=Math.sin(i),a=Math.max(1e-4,Math.abs(s.scaleX??1)),o=Math.max(1e-4,Math.abs(s.scaleY??1)),h=e-s.x,l=t-s.y,c=(n*h+r*l)/a,u=(-r*h+n*l)/o,d=(T,_,R,P)=>{const F=R/a,I=P/o,k=Math.max(1e-4,Math.hypot(F,I)),B=F/k,D=I/k,U=n*B-r*D,L=r*B+n*D;return{x:s.x+n*T*a-r*_*o+U*.05,y:s.y+r*T*a+n*_*o+L*.05,nx:U,ny:L}};if(s.shape==="circle"){const T=Math.max(.001,s.radius),_=Math.hypot(c,u);if(_>=T)return null;const R=_>1e-4?c/_:1,P=_>1e-4?u/_:0;return d(R*T,P*T,R,P)}if(s.shape==="ellipse"){const T=Math.max(.001,s.radiusX),_=Math.max(.001,s.radiusY),R=Math.hypot(c/T,u/_);if(R>=1)return null;const P=R>1e-4?1/R:1,F=R>1e-4?c*P:T,I=R>1e-4?u*P:0,k=Math.max(1e-4,Math.hypot(F/(T*T),I/(_*_)));return d(F,I,F/(T*T)/k,I/(_*_)/k)}if(s.shape==="rect"){const T=Math.max(.001,s.width*.5),_=Math.max(.001,s.height*.5);if(Math.abs(c)>=T||Math.abs(u)>=_)return null;const R=T-Math.abs(c),P=_-Math.abs(u);if(R=0?1:-1;return d(I*T,u,I,0)}const F=u>=0?1:-1;return d(c,F*_,0,F)}const f=Math.max(3,Math.min(16,Math.round(s.sides||(s.shape==="custom"?5:6)))),p=Math.max(.001,s.width*.5),m=Math.max(.001,s.height*.5),g=Array.from({length:f},(T,_)=>{const R=Math.PI*.5+_/f*Math.PI*2;return{x:Math.cos(R)*p,y:Math.sin(R)*m}});let v=!1;for(let T=0,_=g.length-1;Tu!=P.y>u&&c<(P.x-R.x)*(u-R.y)/(P.y-R.y)+R.x&&(v=!v)}if(!v)return null;let b=g[0].x,y=g[0].y,w=1/0;for(let T=0;T>>0^Math.imul(e+1,2654435761)^t)>>>0;return i^=i>>>16,i=Math.imul(i,2146121005),i^=i>>>15,i=Math.imul(i,2221713035),i^=i>>>16,(i>>>0)/4294967296}function Ja(s,e,t,i,n){return s==="fixed"?e:s==="curve"?Vi(e,t,wn(i,n)):Vi(e,t,n)}function mf(s,e,t,i,n,r){return s==="curve"?Vi(e,t,wn(i,n)):s==="random"?r:e}function kv(s,e,t,i,n){const r=1-n;return r*r*r*s+3*r*r*n*e+3*r*n*n*t+n*n*n*i}function wn(s,e,t="线性"){if(!Array.isArray(s)||s.length===0)return 1;const i=[...s].sort((n,r)=>n.x-r.x);if(e<=i[0].x)return i[0].y;if(e>=i[i.length-1].x)return i[i.length-1].y;for(let n=0;n=i[n].x&&e<=i[n+1].x){const r=i[n],a=i[n+1],o=a.x-r.x||1;if(t!=="贝塞尔")return Vi(r.y,a.y,(e-r.x)/o);const h=r.x+(r.outX??o/3),l=r.y+(r.outY??(a.y-r.y)/3),c=a.x+(a.inX??-o/3),u=a.y+(a.inY??-(a.y-r.y)/3);let d=0,f=1;for(let p=0;p<14;p++){const m=(d+f)/2;kv(r.x,h,c,a.x,m)>>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 Mo(s){let e=s.replace("#","");return e.length===3&&(e=e.split("").map(t=>t+t).join("")),parseInt(e,16)}function XI(s,e,t){const i=Fv(s),n=Fv(e),r=Math.round(i[0]+(n[0]-i[0])*t),a=Math.round(i[1]+(n[1]-i[1])*t),o=Math.round(i[2]+(n[2]-i[2])*t);return r<<16|a<<8|o}function gf(s,e){if(!Array.isArray(s)||s.length===0)return 16777215;const t=[...s].sort((i,n)=>i.position-n.position);if(e<=t[0].position)return Mo(t[0].color);if(e>=t[t.length-1].position)return Mo(t[t.length-1].color);for(let i=0;ir.position)continue;const a=(e-n.position)/Math.max(1e-4,r.position-n.position);return XI(n.color,r.color,a)}return Mo(t[t.length-1].color)}function Fv(s){let e=s.replace("#","");e.length===3&&(e=e.split("").map(i=>i+i).join(""));const t=parseInt(e,16);return[t>>16&255,t>>8&255,t&255]}const Ba=new Map,Ra=new Map;function VI(s){return[...Ba.values()].some(e=>e===s)}function d1(s){if(!(VI(s)||(Ra.get(s)||0)>0)){Ra.delete(s);for(const e of s.textures)e.destroy(!0)}}function YI(s){const e=Ra.get(s)||0;e>1?Ra.set(s,e-1):Ra.delete(s),d1(s)}function $I(s){return Ba.get(s)||null}function Au(s,e){ql(s),Ba.set(s,e)}function GI(s){const e=Ba.get(s);return e?(Ra.set(e,(Ra.get(e)||0)+1),e):null}function HI(s,e){const t=Ba.get(s);return t?(Au(e,t),!0):!1}function ql(s){const e=Ba.get(s);e&&(Ba.delete(s),d1(e))}function hi(s){if(Array.isArray(s))return s.map(e=>hi(e));if(s&&typeof s=="object"){const e=Object.getPrototypeOf(s);if(e===Object.prototype||e===null){const t={};for(const[i,n]of Object.entries(s))t[i]=hi(n);return t}}return s}const f1=["3.8","4.0","4.1","4.2","4.3"];function Ph(s){const e=String(s||"").trim();return f1.find(t=>e===t||e.startsWith(`${t}.`))||null}function Mm(){return f1.join(" / ")}function jI(s){return s==="4.3"?"4.3":"4.2"}function _p(){return{imagesPath:"./images/",spineVersion:"4.2",keyframeCurve:"linear",fps:30,omitFps:!1,integerFrameAlignment:!0,bonePool:!0,excludeEmptyAnimations:!1,fileName:"SpineParticle.json"}}function m1(s){const e=Object.assign(_p(),s||{});return e.imagesPath=String(e.imagesPath||"./images/"),e.spineVersion=Ph(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}const _m=30;function Kc(s,e=1){return Math.min(1800,Math.max(1,Math.ceil(Number(s)||e)))}function p1(s,e=30){const t=Math.max(0,Number(s.lifeMin)||0),i=Math.max(0,Number(s.lifeMax)||0),n=s.lifeMode==="fixed"?t:Math.max(t,i);return Kc(Math.ceil(n*Math.max(1,e)),_m)}function Xr(s,e=30){const t=Kc(s.loopDurationFrames),i=p1(s,e),n=s.generateLoopStartAnimation?s.loopStartUseCustomDuration?Kc(s.loopStartDurationFrames,_m):i:0,r=s.generateLoopEndAnimation?s.loopEndUseCustomDuration?Kc(s.loopEndDurationFrames,_m):i:0;return{start:n,loop:t,end:r,total:n+t+r}}function g1(s,e){const t=Xr(s,e),n=Math.max(0,Math.ceil(Math.max(0,Number(s.delay)||0)*Math.max(1,e)))+t.start;return{start:n,end:n+t.loop}}function Zc(s,e,t){const i=Math.max(1,Math.floor(t)-1),n=Math.min(i-1,Math.max(0,Math.floor(Number(s)||0))),r=Math.min(i,Math.max(n+1,Math.floor(Number(e)||i)));return{start:n,end:r}}function WI(s,e,t){const i=Math.max(1,e-1),n=Math.max(1,t-1),r=s.end>=i?n:s.end;return Zc(s.start,r,t)}let Ec=1,Cc=1,Ic=1,Rc=1;function Pc(s,e){const t=new Set(e),i=`${s} Copy`;if(!t.has(i))return i;let n=2;for(;t.has(`${i} ${n}`);)n++;return`${i} ${n}`}const Kl=mT("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,playbackStart:0,playbackEnd:59,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:_p()}}),getters:{activeSystemCount:s=>s.systems.length},actions:{syncSceneSequences(){Ec=Math.max(Ec,...this.systems.map(s=>s.id+1),1),Cc=Math.max(Cc,...this.colliders.map(s=>s.id+1),1),Ic=Math.max(Ic,...this.paths.map(s=>s.id+1),1),Rc=Math.max(Rc,...this.spines.map(s=>s.id+1),1)},addSystem(s){const e=Dl();s!=null&&s.config&&Object.assign(e,s.config);const t=new Set(this.systems.map(r=>r.config.name));if(t.has(e.name)){let r=0;for(const o of this.systems){const h=/^ParticleSystem(\d+)$/.exec(o.config.name);h&&(r=Math.max(r,parseInt(h[1],10)))}e.name=`ParticleSystem${r+1}`;let a=2;for(;t.has(e.name);)e.name=`ParticleSystem${r+a}`,a++}const i=this.timeline.animations.includes(this.timeline.animation)?this.timeline.animation:this.timeline.animations[0]||"animation",n={id:Ec++,visible:!0,animation:i,config:e};return this.systems.push(n),this.activeId=n.id,this.activeObjectType="particle",this.activeObjectId=n.id,n},removeSystem(s){var i;const e=this.systems.findIndex(n=>n.id===s);e>=0&&this.systems.splice(e,1),this.activeId===s&&(this.activeId=((i=this.systems[0])==null?void 0:i.id)??0);const t=this.systems.find(n=>n.id===this.activeId);if(t&&(this.timeline.animation=t.animation),this.activeObjectType==="particle"&&this.activeObjectId===s){const n=this.systems[0];this.activeObjectId=(n==null?void 0:n.id)??0}},selectSystem(s){this.activeId=s,this.activeObjectType="particle",this.activeObjectId=s;const e=this.systems.find(t=>t.id===s);e&&(this.timeline.animation=e.animation)},setSystemAnimation(s,e){if(!this.timeline.animations.includes(e))return;const t=this.systems.find(i=>i.id===s);t&&(t.animation=e,this.timeline.animation=e)},addAnimation(){const s=new Set(this.timeline.animations);let e=2,t=`animation${e}`;for(;s.has(t);)t=`animation${++e}`;this.timeline.animations.push(t),this.timeline.animation=t;const i=this.systems.find(n=>n.id===this.activeId);return i&&(i.animation=t),t},renameAnimation(s,e){const t=e.trim(),i=this.timeline.animations.indexOf(s);if(i<0||!t||t!==s&&this.timeline.animations.includes(t))return!1;this.timeline.animations[i]=t;for(const n of this.systems)n.animation===s&&(n.animation=t);return this.timeline.animation===s&&(this.timeline.animation=t),!0},removeAnimation(s){if(this.timeline.animations.length<=1)return!1;const e=this.timeline.animations.indexOf(s);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 i of this.systems)i.animation===s&&(i.animation=t);return this.timeline.animation===s&&(this.timeline.animation=t),!0},addCollider(){const s=Cc++,e={id:s,name:`Collider${s}`,visible:!0,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 s=Ic++,e={id:s,name:`Path${s}`,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 s=Rc++,e={id:s,name:`SpineSkeleton${s}`,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 s=this.activeObjectId;if(!s)return null;if(this.activeObjectType==="particle"){const i=this.systems.find(r=>r.id===s);if(!i)return null;const n=hi(i);return n.id=Ec++,n.config.name=Pc(i.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 i=this.colliders.find(r=>r.id===s);if(!i)return null;const n=hi(i);return n.id=Cc++,n.name=Pc(i.name,this.colliders.map(r=>r.name)),this.colliders.push(n),this.activeObjectId=n.id,n}if(this.activeObjectType==="path"){const i=this.paths.find(r=>r.id===s);if(!i)return null;const n=hi(i);return n.id=Ic++,n.name=Pc(i.name,this.paths.map(r=>r.name)),this.paths.push(n),this.activeObjectId=n.id,n}const e=this.spines.find(i=>i.id===s);if(!e)return null;const t=hi(e);return t.id=Rc++,t.name=Pc(e.name,this.spines.map(i=>i.name)),t.selectedBone="",HI(e.id,t.id),this.spines.push(t),this.activeObjectId=t.id,t},selectSceneObject(s,e){if(this.activeObjectType=s,this.activeObjectId=e,s==="particle"){this.activeId=e;const t=this.systems.find(i=>i.id===e);t&&(this.timeline.animation=t.animation)}},removeCollider(s){var t;const e=this.colliders.findIndex(i=>i.id===s);e>=0&&this.colliders.splice(e,1);for(const i of this.systems){const n=Wr(i.config);n.collisionColliderIds=n.collisionColliderIds.filter(r=>r!==s)}if(this.activeObjectType==="collision"&&this.activeObjectId===s){const i=this.systems[0];this.activeObjectType=i?"particle":"collision",this.activeObjectId=(i==null?void 0:i.id)??((t=this.colliders[0])==null?void 0:t.id)??0}},removePath(s){var t;const e=this.paths.findIndex(i=>i.id===s);if(e>=0&&this.paths.splice(e,1),this.activeObjectType==="path"&&this.activeObjectId===s){const i=this.systems[0];this.activeObjectType=i?"particle":"path",this.activeObjectId=(i==null?void 0:i.id)??((t=this.paths[0])==null?void 0:t.id)??0}},removeSpine(s){ql(s);const e=this.spines.findIndex(t=>t.id===s);if(e>=0&&this.spines.splice(e,1),this.activeObjectType==="spine"&&this.activeObjectId===s){const t=this.systems[0],i=this.colliders[0],n=this.paths[0],r=this.spines[0];t?(this.activeObjectType="particle",this.activeObjectId=t.id,this.activeId=t.id):i?(this.activeObjectType="collision",this.activeObjectId=i.id):n?(this.activeObjectType="path",this.activeObjectId=n.id):(this.activeObjectType="spine",this.activeObjectId=(r==null?void 0:r.id)??0)}this.recalcTotalFrames()},play(){const s=Zc(this.timeline.playbackStart,this.timeline.playbackEnd,this.timeline.totalFrames);(this.timeline.frame=s.end)&&(this.timeline.frame=s.start),this.timeline.playing=!0},pause(){this.timeline.playing=!1},togglePlay(){this.timeline.playing?this.pause():this.play()},toStart(){this.timeline.frame=this.timeline.playbackStart},previousFrame(){this.timeline.playing=!1,this.timeline.frame=Math.max(this.timeline.playbackStart,this.timeline.frame-1)},nextFrame(){this.timeline.playing=!1,this.timeline.frame=Math.min(this.timeline.playbackEnd,this.timeline.frame+1)},toEnd(){this.timeline.playing=!1,this.timeline.frame=this.timeline.playbackEnd},toggleLoop(){this.timeline.loop=!this.timeline.loop},setFrame(s){this.timeline.frame=Math.max(0,Math.min(s,this.timeline.totalFrames-1))},setPlaybackStart(s){const e=Zc(s,this.timeline.playbackEnd,this.timeline.totalFrames);this.timeline.playbackStart=e.start,this.timeline.playbackEnd=e.end,this.timeline.framee.end&&(this.timeline.frame=e.end)},recalcTotalFrames(){const s=this.timeline.fps||30;let e=0;for(const r of this.systems){const a=r.config,o=Math.max(0,Number(a.lifeMin)||0),h=Math.max(0,Number(a.lifeMax)||0),l=a.lifeMode==="fixed"?o:Math.max(o,h),c=a.mode==="stream"?a.streamBehavior==="loop"?Math.max(1/s,Math.ceil(Math.max(1,Number(a.loopDurationFrames)||1))/s):Math.max(1/s,Number(a.duration)||0):0;let u=Math.max(0,Number(a.delay)||0)+c+l;a.mode==="stream"&&a.streamBehavior==="loop"&&(u=Math.max(0,Number(a.delay)||0)+Xr(a,s).total/s),u>e&&(e=u)}for(const r of this.spines){const a=r.animations.find(h=>h.name===r.selectedAnimation);if(!a)continue;const o=Math.max(0,Number(r.timeOffset)||0)+Math.max(0,a.duration||0);o>e&&(e=o)}for(const r of this.colliders){if(!r.followPath||!r.followPathId)continue;const a=Math.max(0,Number(r.followDuration)||0);a>e&&(e=a)}const t=this.timeline.totalFrames,i=Math.max(2,Math.ceil(e*s)+1);this.timeline.totalFrames=i;const n=WI({start:this.timeline.playbackStart,end:this.timeline.playbackEnd},t,i);return this.timeline.playbackStart=n.start,this.timeline.playbackEnd=n.end,this.timeline.frame>=i&&(this.timeline.frame=i-1),i}}}),v1="SpineParticle.SystemSettings",y1=1,vf="SpineParticle.SystemSettings.v1";function Ko(s,e,t,i){const n=Number(s);return Math.min(t,Math.max(e,Number.isFinite(n)?n:i))}function zI(s){return{parameterPanelOnRight:s.parameterPanelOnRight,undoLimit:s.undoLimit,showEmitter:s.showEmitter,showBones:s.showBones,bonePointDrawSize:s.bonePointDrawSize,boneAxisDrawSize:s.boneAxisDrawSize,showSkinMesh:s.showSkinMesh,tickEnabled:s.tickEnabled,axisFontSize:s.axisFontSize,tickWidth:s.tickWidth,showAxisLabels:s.showAxisLabels,axisColor:s.axisColor}}function qI(s,e){const t=n=>s[n]==null?!!e[n]:s[n]===!0,i=typeof s.axisColor=="string"&&/^#[0-9a-f]{6}$/i.test(s.axisColor)?s.axisColor:e.axisColor;return{parameterPanelOnRight:t("parameterPanelOnRight"),undoLimit:Math.round(Ko(s.undoLimit,1,200,e.undoLimit)),showEmitter:t("showEmitter"),showBones:t("showBones"),bonePointDrawSize:Ko(s.bonePointDrawSize,.1,10,e.bonePointDrawSize),boneAxisDrawSize:Ko(s.boneAxisDrawSize,.1,10,e.boneAxisDrawSize),showSkinMesh:t("showSkinMesh"),tickEnabled:t("tickEnabled"),axisFontSize:Math.round(Ko(s.axisFontSize,8,40,e.axisFontSize)),tickWidth:Ko(s.tickWidth,1,5,e.tickWidth),showAxisLabels:t("showAxisLabels"),axisColor:i}}function KI(s){let e;try{e=JSON.parse(s)}catch{throw new Error("系统设置缓存不是有效的 JSON")}const t=e;if(t.format!==v1)throw new Error("不是 Spine粒子编辑器系统设置缓存");if(t.version!==y1)throw new Error(`暂不支持系统配置版本:${t.version??"未知"}`);if(!t.settings||typeof t.settings!="object")throw new Error("系统设置缓存缺少 settings");return t}function ZI(s,e){Object.assign(s.settings,qI(e,s.settings))}let kc=null;function JI(s){kc==null||kc();try{const e=localStorage.getItem(vf);e&&ZI(s,KI(e).settings)}catch{try{localStorage.removeItem(vf)}catch{}}kc=fs(()=>zI(s.settings),e=>{const t={format:v1,version:y1,savedAt:new Date().toISOString(),settings:e};try{localStorage.setItem(vf,JSON.stringify(t))}catch{}},{deep:!0})}function Ov(s,e,t,i,n){const r=1-n;return r*r*r*s+3*r*r*n*e+3*r*n*n*t+n*n*n*i}function Bv(s,e,t){const i=s.rotation*Math.PI/180,n=Math.cos(i),r=Math.sin(i),a=Math.max(1e-4,Math.abs(s.scaleX??1)),o=Math.max(1e-4,Math.abs(s.scaleY??1));return{x:s.x+n*e*a-r*t*o,y:s.y+r*e*a+n*t*o}}function yf(s,e){if(!s.points.length)return null;if(s.points.length===1)return{...Bv(s,s.points[0].x,s.points[0].y),angle:s.rotation};const t=s.closed?s.points.length:s.points.length-1,i=[];let n=0;for(let p=0;p0&&v===0)continue;const b=v/20,y=Ov(m.x,m.x+m.outX,g.x+g.inX,g.x,b),w=Ov(m.y,m.y+m.outY,g.y+g.inY,g.y,b),A=Bv(s,y,w),T=i[i.length-1];T&&(n+=Math.hypot(A.x-T.x,A.y-T.y)),i.push({...A,distance:n})}}const r=Math.min(1,Math.max(0,e))*n;let a=i.findIndex(p=>p.distance>=r);a<0&&(a=i.length-1);const o=i[a],h=i[Math.max(0,a-1)],l=i[Math.min(i.length-1,a+1)],c=h.distance,u=a>0?(r-c)/Math.max(1e-4,o.distance-c):0,d=h.x+(o.x-h.x)*Math.min(1,Math.max(0,u)),f=h.y+(o.y-h.y)*Math.min(1,Math.max(0,u));return{x:d,y:f,angle:Math.atan2(l.y-h.y,l.x-h.x)*180/Math.PI}}function Zi(s){return s.map(e=>({...e,trailState:e.trailState?{...e.trailState,bones:e.trailState.bones.map(t=>({...t}))}:void 0}))}function QI(s){const e=new Map;for(const i of s)for(const n of i)e.has(n.boneName)||e.set(n.boneName,Zi([n])[0]);const t=[...e.keys()].sort((i,n)=>{const r=Number(i.replace(/^p_/,"")),a=Number(n.replace(/^p_/,""));return Number.isFinite(r)&&Number.isFinite(a)?r-a:i.localeCompare(n)});for(let i=0;i[r.boneName,r]));s[i]=t.map(r=>{const a=n.get(r);return a||{...Zi([e.get(r)])[0],alpha:0,imageVisible:!1,trailState:void 0,active:!0}})}}function eR(s){s.length<2||(s[s.length-1]=Zi(s[0]))}function tR(s,e){const t=Math.max(0,s.length-1),i=[];for(let n=0;n<=e;n++){const r=Math.min(t,Math.round(n/e*t));i.push(Zi(s[r]||[]))}return i}function xf(s){return`${s.boneName}:${s.spawnId??"legacy"}`}function Lv(s){return{...Zi([s])[0],alpha:0,imageVisible:!1,trailState:void 0,active:!0}}function iR(s,e,t,i){const n=Math.min(s.length,i+1),r=s.slice(Math.max(0,s.length-n)),a=new Map;for(const l of e){if(l.imageVisible===!1||l.alpha<=0)continue;const c=xf(l),u=new Map;let d=!1;for(let f=r.length-1;f>=0;f--){const p=r[f].find(m=>xf(m)===c);if(p)d=!0,u.set(f,p);else if(d)break}a.set(c,u)}const o=Math.max(0,r.length-1),h=[];for(let l=0;l<=t;l++){const c=Math.min(o,Math.round(l/t*o));h.push(e.map(u=>{var f;if(u.imageVisible===!1||u.alpha<=0)return Zi([u])[0];const d=(f=a.get(xf(u)))==null?void 0:f.get(c);return d?Zi([d])[0]:Lv(u)}))}return h[0]=h[0].map(Lv),h[h.length-1]=Zi(e),h}function Dv(s,e){const t=s.length?1:0;for(let i=t;i{const y=b?[[]]:[];e.reset();for(let w=0;w0&&e.restartEmissionCycle();for(let A=0;A0;w++)e.update(r,"off"),b.push(e.capture());(v=b[b.length-1])!=null&&v.length&&b.push([]),Dv(u,tR(b,o.end))}const g=Zi(u[u.length-1]||[]);for(u.length>i&&(u.length=i);u.lengtho.id===r)||(this.container.removeChild(a.root),a.root.destroy({children:!0}),this.entries.delete(r));for(const r of e){const a=$I(r.id);let o=this.entries.get(r.id);if(o&&o.assetVersion!==r.assetVersion&&!a&&(this.container.removeChild(o.root),o.root.destroy({children:!0}),this.entries.delete(r.id),o=void 0),(!o||o.assetVersion!==r.assetVersion)&&a){o&&(this.container.removeChild(o.root),o.root.destroy({children:!0}));const d=new ji,f=new a.SpineClass({skeletonData:a.skeletonData,autoUpdate:!1,darkTint:!1});a.skeletonData.defaultSkin&&f.skeleton.setSkin(a.skeletonData.defaultSkin),a.runtimeVersion==="4.3"?f.skeleton.setupPoseSlots():f.skeleton.setSlotsToSetupPose(),d.addChild(f),this.container.addChild(d),o={root:d,spine:f,runtimeVersion:a.runtimeVersion,assetVersion:r.assetVersion,animation:""},this.entries.set(r.id,o)}if(!o)continue;const h=o.root,l=o.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),o.animation!==r.selectedAnimation&&(o.animation=r.selectedAnimation,o.runtimeVersion==="4.3"?l.skeleton.setupPose():l.skeleton.setToSetupPose(),l.state.clearTracks(),o.animation&&l.state.setAnimation(0,o.animation,!1));const u=o.runtimeVersion==="4.3"?l.state.getTrack(0):l.state.getCurrent(0);if(u){const d=((n=r.animations.find(p=>p.name===r.selectedAnimation))==null?void 0:n.duration)||0,f=Math.max(0,t/Math.max(1,i)-r.timeOffset);u.trackTime=d>0?Math.min(f,d):f}l.update(0)}}getBoneWorldTransform(e,t){const i=this.entries.get(e),n=i==null?void 0:i.spine.skeleton.findBone(t);if(!i||!n||!n.active)return null;const r=i.runtimeVersion==="4.3"?n.appliedPose:n,a=i.root,o=Math.cos(a.rotation),h=Math.sin(a.rotation),l=o*a.scale.x,c=-h*a.scale.y,u=h*a.scale.x,d=o*a.scale.y,f=l*r.a+c*r.c,p=l*r.b+c*r.d,m=u*r.a+d*r.c,g=u*r.b+d*r.d,v=a.position.x+l*r.worldX+c*r.worldY,b=a.position.y+u*r.worldX+d*r.worldY;return{x:v,y:-b,rotation:-Math.atan2(m,f)*180/Math.PI,scaleX:Math.max(1e-4,Math.hypot(f,m)),scaleY:Math.max(1e-4,Math.hypot(p,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})}}let x1=class{constructor(){x(this,"entries",{});x(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 i=0,n=e.length;i1&&(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 Ki){return t.setFromString(e)}},x(Ki,"WHITE",new Ki(1,1,1,1)),x(Ki,"RED",new Ki(1,0,0,1)),x(Ki,"GREEN",new Ki(0,1,0,1)),x(Ki,"BLUE",new Ki(0,0,1,1)),x(Ki,"MAGENTA",new Ki(1,0,1,1)),Ki);var bi;let $e=(bi=class{static clamp(e,t,i){return ei?i:e}static cosDeg(e){return Math.cos(e*bi.degRad)}static sinDeg(e){return Math.sin(e*bi.degRad)}static atan2Deg(e,t){return Math.atan2(e,t)*bi.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 bi.randomTriangularWith(e,t,(e+t)*.5)}static randomTriangularWith(e,t,i){let n=Math.random(),r=t-e;return n<=(i-e)/r?e+Math.sqrt(n*r*(i-e)):t-Math.sqrt((1-n)*r*(t-i))}static isPowerOfTwo(e){return e&&(e&e-1)===0}},x(bi,"PI",3.1415927),x(bi,"PI2",bi.PI*2),x(bi,"invPI2",1/bi.PI2),x(bi,"radiansToDegrees",180/bi.PI),x(bi,"radDeg",bi.radiansToDegrees),x(bi,"degreesToRadians",bi.PI/180),x(bi,"degRad",bi.degreesToRadians),bi);var tn;let Ge=(tn=class{static arrayCopy(e,t,i,n,r){for(let a=t,o=n;a=t?e:tn.setArraySize(e,t,i)}static newArray(e,t){let i=new Array(e);for(let n=0;n0?this.items.pop():this.instantiator()}free(e){e.reset&&e.reset(),this.items.push(e)}freeAll(e){for(let t=0;t>1)*o;let h=t.bone.skeleton,l=t.deform,c=this.vertices,u=this.bones;if(!u){l.length>0&&(c=l);let m=t.bone,g=m.worldX,v=m.worldY,b=m.a,y=m.b,w=m.c,A=m.d;for(let T=i,_=a;_=this.regions.length&&(i=this.regions.length-1);let n=this.regions[i];t.region!=n&&(t.region=n,t.updateRegion())}getPath(e,t){let i=e,n=(this.start+t).toString();for(let r=this.digits-n.length;r>0;r--)i+="0";return i+=n,i}static nextID(){return or._nextID++}},x(or,"_nextID",0),or);var $i;(function(s){s[s.hold=0]="hold",s[s.once=1]="once",s[s.loop=2]="loop",s[s.pingpong=3]="pingpong",s[s.onceReverse=4]="onceReverse",s[s.loopReverse=5]="loopReverse",s[s.pingpongReverse=6]="pingpongReverse"})($i||($i={}));const S1=[$i.hold,$i.once,$i.loop,$i.pingpong,$i.onceReverse,$i.loopReverse,$i.pingpongReverse];let Tp=class{constructor(e,t,i){x(this,"name");x(this,"timelines",[]);x(this,"timelineIds",new x1);x(this,"duration");if(!e)throw new Error("name cannot be null.");this.name=e,this.setTimelines(t),this.duration=i}setTimelines(e){if(!e)throw new Error("timelines cannot be null.");this.timelines=e,this.timelineIds.clear();for(var t=0;t0&&(t%=this.duration));let l=this.timelines;for(let c=0,u=l.length;ct)return n-1;return i-1}static search(e,t,i){let n=e.length;for(let r=i;rt)return r-i;return n-i}},Xn=class extends ui{constructor(t,i,n){super(t,n);x(this,"curves");this.curves=Ge.newFloatArray(t+i*18),this.curves[t-1]=1}setLinear(t){this.curves[t]=0}setStepped(t){this.curves[t]=1}shrink(t){let i=this.getFrameCount()+t*18;if(this.curves.length>i){let n=Ge.newFloatArray(i);Ge.arrayCopy(this.curves,0,n,0,i),this.curves=n}}setBezier(t,i,n,r,a,o,h,l,c,u,d){let f=this.curves,p=this.getFrameCount()+t*18;n==0&&(f[i]=2+p);let m=(r-o*2+l)*.03,g=(a-h*2+c)*.03,v=((o-l)*3-r+u)*.006,b=((h-c)*3-a+d)*.006,y=m*2+v,w=g*2+b,A=(o-r)*.3+m+v*.16666667,T=(h-a)*.3+g+b*.16666667,_=r+A,R=a+T;for(let P=p+18;pt){let c=this.frames[i],u=this.frames[i+n];return u+(t-c)/(a[r]-c)*(a[r+1]-u)}let o=r+18;for(r+=2;r=t){let c=a[r-2],u=a[r-1];return u+(t-c)/(a[r]-c)*(a[r+1]-u)}i+=this.getFrameEntries();let h=a[o-2],l=a[o-1];return l+(t-h)/(this.frames[i]-h)*(this.frames[i+n]-l)}},un=class extends Xn{constructor(e,t,i){super(e,t,[i])}getFrameEntries(){return 2}setFrame(e,t,i){e<<=1,this.frames[e]=t,this.frames[e+1]=i}getCurveValue(e){let t=this.frames,i=t.length-2;for(let r=2;r<=i;r+=2)if(t[r]>e){i=r-2;break}let n=this.curves[i>>1];switch(n){case 0:let r=t[i],a=t[i+1];return a+(e-r)/(t[i+2]-r)*(t[i+2+1]-a);case 1:return t[i+1]}return this.getBezierValue(e,i,1,n-2)}getRelativeValue(e,t,i,n,r){if(e>2];switch(g){case 0:let v=c[m];d=c[m+1],f=c[m+2],p=c[m+3];let b=(n-v)/(c[m+4]-v);d+=(c[m+4+1]-d)*b,f+=(c[m+4+2]-f)*b,p+=(c[m+4+3]-p)*b;break;case 1:d=c[m+1],f=c[m+2],p=c[m+3];break;default:d=this.getBezierValue(n,m,1,g-2),f=this.getBezierValue(n,m,2,g+18-2),p=this.getBezierValue(n,m,3,g+36-2)}if(a==1)u.r=d,u.g=f,u.b=p;else{if(o==Ce.setup){let v=l.data.color;u.r=v.r,u.g=v.g,u.b=v.b}u.r+=(d-u.r)*a,u.g+=(f-u.g)*a,u.b+=(p-u.b)*a}}},B1=class extends un{constructor(t,i,n){super(t,i,Ct.alpha+"|"+n);x(this,"slotIndex",0);this.slotIndex=n}apply(t,i,n,r,a,o,h){let l=t.slots[this.slotIndex];if(!l.bone.active)return;let c=l.color;if(n>3];switch(A){case 0:let T=c[w];f=c[w+1],p=c[w+2],m=c[w+3],g=c[w+4],v=c[w+5],b=c[w+6],y=c[w+7];let _=(n-T)/(c[w+8]-T);f+=(c[w+8+1]-f)*_,p+=(c[w+8+2]-p)*_,m+=(c[w+8+3]-m)*_,g+=(c[w+8+4]-g)*_,v+=(c[w+8+5]-v)*_,b+=(c[w+8+6]-b)*_,y+=(c[w+8+7]-y)*_;break;case 1:f=c[w+1],p=c[w+2],m=c[w+3],g=c[w+4],v=c[w+5],b=c[w+6],y=c[w+7];break;default:f=this.getBezierValue(n,w,1,A-2),p=this.getBezierValue(n,w,2,A+18-2),m=this.getBezierValue(n,w,3,A+36-2),g=this.getBezierValue(n,w,4,A+54-2),v=this.getBezierValue(n,w,5,A+72-2),b=this.getBezierValue(n,w,6,A+90-2),y=this.getBezierValue(n,w,7,A+108-2)}if(a==1)u.set(f,p,m,g),d.r=v,d.g=b,d.b=y;else{if(o==Ce.setup){u.setFromColor(l.data.color);let T=l.data.darkColor;d.r=T.r,d.g=T.g,d.b=T.b}u.add((f-u.r)*a,(p-u.g)*a,(m-u.b)*a,(g-u.a)*a),d.r+=(v-d.r)*a,d.g+=(b-d.g)*a,d.b+=(y-d.b)*a}}},D1=class extends Xn{constructor(t,i,n){super(t,i,[Ct.rgb+"|"+n,Ct.rgb2+"|"+n]);x(this,"slotIndex",0);this.slotIndex=n}getFrameEntries(){return 7}setFrame(t,i,n,r,a,o,h,l){t*=7,this.frames[t]=i,this.frames[t+1]=n,this.frames[t+2]=r,this.frames[t+3]=a,this.frames[t+4]=o,this.frames[t+5]=h,this.frames[t+6]=l}apply(t,i,n,r,a,o,h){let l=t.slots[this.slotIndex];if(!l.bone.active)return;let c=this.frames,u=l.color,d=l.darkColor;if(nt){let l=this.frames[i];return n[r+1]*(t-l)/(n[r]-l)}let a=r+18;for(r+=2;r=t){let l=n[r-2],c=n[r-1];return c+(t-l)/(n[r]-l)*(n[r+1]-c)}let o=n[a-2],h=n[a-1];return h+(1-h)*(t-o)/(this.frames[i+this.getFrameEntries()]-o)}apply(t,i,n,r,a,o,h){let l=t.slots[this.slotIndex];if(!l.bone.active)return;let c=l.getAttachment();if(!c||!(c instanceof vr)||c.timelineAttachment!=this.attachment)return;let u=l.deform;u.length==0&&(o=Ce.setup);let d=this.vertices,f=d[0].length,p=this.frames;if(n=p[p.length-1]){let w=d[p.length-1];if(a==1)if(o==Ce.add){let A=c;if(A.bones)for(let T=0;Tn)this.apply(t,i,Number.MAX_VALUE,r,a,o,h),i=-1;else if(i>=l[c-1])return;if(n0&&l[u-1]==d;)u--}for(;u=l[u];u++)r.push(this.events[u])}},x(Sa,"propertyIds",[""+Ct.event]),Sa);var Ma;let gl=(Ma=class extends ui{constructor(t){super(t,Ma.propertyIds);x(this,"drawOrders");this.drawOrders=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,i,n){this.frames[t]=i,this.drawOrders[t]=n}apply(t,i,n,r,a,o,h){if(h==es.mixOut){o==Ce.setup&&Ge.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);return}if(n>2];switch(m){case 0:let g=c[p];u=c[p+1],d=c[p+2],f=c[p+3];let v=(n-g)/(c[p+4]-g);u+=(c[p+4+1]-u)*v,d+=(c[p+4+2]-d)*v,f+=(c[p+4+3]-f)*v;break;case 1:u=c[p+1],d=c[p+2],f=c[p+3];break;default:u=this.getBezierValue(n,p,1,m-2),d=this.getBezierValue(n,p,2,m+18-2),f=this.getBezierValue(n,p,3,m+36-2)}if(o==Ce.setup){let g=l.data;l.mixRotate=g.mixRotate+(u-g.mixRotate)*a,l.mixX=g.mixX+(d-g.mixX)*a,l.mixY=g.mixY+(f-g.mixY)*a}else l.mixRotate+=(u-l.mixRotate)*a,l.mixX+=(d-l.mixX)*a,l.mixY+=(f-l.mixY)*a}},Xa=class extends un{constructor(t,i,n,r){super(t,i,r+"|"+n);x(this,"constraintIndex",0);this.constraintIndex=n}apply(t,i,n,r,a,o,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,a,o,this.get(u),this.setup(u),c))}else l=t.physicsConstraints[this.constraintIndex],l.active&&this.set(l,this.getAbsoluteValue(n,a,o,this.get(l),this.setup(l)))}},G1=class extends Xa{constructor(e,t,i){super(e,t,i,Ct.physicsConstraintInertia)}setup(e){return e.data.inertia}get(e){return e.inertia}set(e,t){e.inertia=t}global(e){return e.inertiaGlobal}},H1=class extends Xa{constructor(e,t,i){super(e,t,i,Ct.physicsConstraintStrength)}setup(e){return e.data.strength}get(e){return e.strength}set(e,t){e.strength=t}global(e){return e.strengthGlobal}},j1=class extends Xa{constructor(e,t,i){super(e,t,i,Ct.physicsConstraintDamping)}setup(e){return e.data.damping}get(e){return e.damping}set(e,t){e.damping=t}global(e){return e.dampingGlobal}},W1=class extends Xa{constructor(e,t,i){super(e,t,i,Ct.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}},z1=class extends Xa{constructor(e,t,i){super(e,t,i,Ct.physicsConstraintWind)}setup(e){return e.data.wind}get(e){return e.wind}set(e,t){e.wind=t}global(e){return e.windGlobal}},q1=class extends Xa{constructor(e,t,i){super(e,t,i,Ct.physicsConstraintGravity)}setup(e){return e.data.gravity}get(e){return e.gravity}set(e,t){e.gravity=t}global(e){return e.gravityGlobal}},K1=class extends Xa{constructor(e,t,i){super(e,t,i,Ct.physicsConstraintMix)}setup(e){return e.data.mix}get(e){return e.mix}set(e,t){e.mix=t}global(e){return e.mixGlobal}};var _a;let Z1=(_a=class extends ui{constructor(t,i){super(t,_a.propertyIds);x(this,"constraintIndex");this.constraintIndex=i}getFrameCount(){return this.frames.length}setFrame(t,i){this.frames[t]=i}apply(t,i,n,r,a,o,h){let l;if(this.constraintIndex!=-1&&(l=t.physicsConstraints[this.constraintIndex],!l.active))return;const c=this.frames;if(i>n)this.apply(t,i,Number.MAX_VALUE,[],a,o,h),i=-1;else if(i>=c[c.length-1])return;if(!(n=c[ui.search1(c,i)+1]))if(l!=null)l.reset();else for(const u of t.physicsConstraints)u.active&&u.reset()}},x(_a,"propertyIds",[Ct.physicsConstraintReset.toString()]),_a);var os;let J1=(os=class extends ui{constructor(t,i,n){super(t,[Ct.sequence+"|"+i+"|"+n.sequence.id]);x(this,"slotIndex");x(this,"attachment");this.slotIndex=i,this.attachment=n}getFrameEntries(){return os.ENTRIES}getSlotIndex(){return this.slotIndex}getAttachment(){return this.attachment}setFrame(t,i,n,r,a){let o=this.frames;t*=os.ENTRIES,o[t]=i,o[t+os.MODE]=n|r<<4,o[t+os.DELAY]=a}apply(t,i,n,r,a,o,h){let l=t.slots[this.slotIndex];if(!l.bone.active)return;let c=l.attachment,u=this.attachment;if(c!=u&&(!(c instanceof vr)||c.timelineAttachment!=u))return;if(h==es.mixOut){o==Ce.setup&&(l.sequenceIndex=-1);return}let d=this.frames;if(n>4,b=this.attachment.sequence.regions.length,y=S1[m&15];if(y!=$i.hold)switch(v+=(n-p)/g+1e-5|0,y){case $i.once:v=Math.min(b-1,v);break;case $i.loop:v%=b;break;case $i.pingpong:{let w=(b<<1)-2;v=w==0?0:v%w,v>=b&&(v=w-v);break}case $i.onceReverse:v=Math.max(b-1-v,0);break;case $i.loopReverse:v=b-1-v%b;break;case $i.pingpongReverse:{let w=(b<<1)-2;v=w==0?0:(v+b-1)%w,v>=b&&(v=w-v)}}l.sequenceIndex=v}},x(os,"ENTRIES",3),x(os,"MODE",1),x(os,"DELAY",2),os);var lr;let rR=(lr=class{constructor(e){x(this,"data");x(this,"tracks",new Array);x(this,"timeScale",1);x(this,"unkeyedState",0);x(this,"events",new Array);x(this,"listeners",new Array);x(this,"queue",new oR(this));x(this,"propertyIDs",new x1);x(this,"animationsChanged",!1);x(this,"trackEntryPool",new kh(()=>new aR));this.data=e}static emptyAnimation(){return lr._emptyAnimation}update(e){e*=this.timeScale;let t=this.tracks;for(let i=0,n=t.length;i0){if(r.delay-=a,r.delay>0)continue;a=-r.delay,r.delay=0}let o=r.next;if(o){let h=r.trackLast-o.delay;if(h>=0){for(o.delay=0,o.trackTime+=r.timeScale==0?0:(h/r.timeScale+e)*o.timeScale,r.trackTime+=a,this.setCurrent(i,o,!0);o.mixingFrom;)o.mixTime+=e,o=o.mixingFrom;continue}}else if(r.trackLast>=r.trackEnd&&!r.mixingFrom){t[i]=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+=a}this.queue.drain()}updateMixingFrom(e,t){let i=e.mixingFrom;if(!i)return!0;let n=this.updateMixingFrom(i,t);return i.animationLast=i.nextAnimationLast,i.trackLast=i.nextTrackLast,e.nextTrackLast!=-1&&e.mixTime>=e.mixDuration?((i.totalAlpha==0||e.mixDuration==0)&&(e.mixingFrom=i.mixingFrom,i.mixingFrom!=null&&(i.mixingFrom.mixingTo=e),e.interruptAlpha=i.interruptAlpha,this.queue.end(i)),n):(i.trackTime+=t*i.timeScale,e.mixTime+=t,!1)}apply(e){if(!e)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();let t=this.events,i=this.tracks,n=!1;for(let d=0,f=i.length;d0)continue;n=!0;let m=d==0?Ce.first:p.mixBlend,g=p.alpha;p.mixingFrom?g*=this.applyMixingFrom(p,e,m):p.trackTime>=p.trackEnd&&!p.next&&(g=0);let v=g>=p.alphaAttachmentThreshold,b=p.animationLast,y=p.getAnimationTime(),w=y,A=t;p.reverse&&(w=p.animation.duration-w,A=null);let T=p.animation.timelines,_=T.length;if(d==0&&g==1||m==Ce.add){d==0&&(v=!0);for(let R=0;R<_;R++){var r=T[R];r instanceof co?this.applyAttachmentTimeline(r,e,w,m,v):r.apply(e,b,w,A,g,m,es.mixIn)}}else{let R=p.timelineMode,P=p.shortestRotation,F=!P&&p.timelinesRotation.length!=_<<1;F&&(p.timelinesRotation.length=_<<1);for(let I=0;I<_;I++){let k=T[I],B=R[I]==bf?m:Ce.setup;!P&&k instanceof Oh?this.applyRotateTimeline(k,e,w,g,B,p.timelinesRotation,I<<1,F):k instanceof co?this.applyAttachmentTimeline(k,e,w,m,v):k.apply(e,b,w,A,g,B,es.mixIn)}}this.queueEvents(p,y),t.length=0,p.nextAnimationLast=y,p.nextTrackLast=p.trackTime}for(var a=this.unkeyedState+Xv,o=e.slots,h=0,l=e.slots.length;h1&&(r=1),i!=Ce.first&&(i=n.mixBlend));let a=r=n.alphaAttachmentThreshold):(o&&A instanceof gl&&_==Ce.setup&&(T=es.mixIn),A.apply(t,d,p,m,R,_,T))}}return e.mixDuration>0&&this.queueEvents(n,f),this.events.length=0,n.nextAnimationLast=f,n.nextTrackLast=n.trackTime,r}applyAttachmentTimeline(e,t,i,n,r){var a=t.slots[e.slotIndex];a.bone.active&&(i=0,y=m>=0;Math.abs(g)<=90&&$e.signum(g)!=$e.signum(p)&&(Math.abs(m-v)>180?(f+=360*$e.signum(m),y=b):v!=0?f-=360*$e.signum(m):y=b),y!=b&&(f+=360*$e.signum(m)),a[o]=f}a[o+1]=p,l.rotation=u+f*n}queueEvents(e,t){let i=e.animationStart,n=e.animationEnd,r=n-i,a=e.trackLast%r,o=this.events,h=0,l=o.length;for(;hn||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=this.tracks.length)return;let t=this.tracks[e];if(!t)return;this.queue.end(t),this.clearNext(t);let i=t;for(;;){let n=i.mixingFrom;if(!n)break;this.queue.end(n),i.mixingFrom=null,i.mixingTo=null,i=n}this.tracks[t.trackIndex]=null,this.queue.drain()}setCurrent(e,t,i){let n=this.expandToIndex(e);this.tracks[e]=t,t.previous=null,n&&(i&&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,i=!1){let n=this.data.skeletonData.findAnimation(t);if(!n)throw new Error("Animation not found: "+t);return this.setAnimationWith(e,n,i)}setAnimationWith(e,t,i=!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 a=this.trackEntry(e,t,i,r);return this.setCurrent(e,a,n),this.queue.drain(),a}addAnimation(e,t,i=!1,n=0){let r=this.data.skeletonData.findAnimation(t);if(!r)throw new Error("Animation not found: "+t);return this.addAnimationWith(e,r,i,n)}addAnimationWith(e,t,i=!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 a=this.trackEntry(e,t,i,r);return r?(r.next=a,a.previous=r,n<=0&&(n=Math.max(n+r.getTrackComplete()-a.mixDuration,0))):(this.setCurrent(e,a,!0),this.queue.drain(),n<0&&(n=0)),a.delay=n,a}setEmptyAnimation(e,t=0){let i=this.setAnimationWith(e,lr.emptyAnimation(),!1);return i.mixDuration=t,i.trackEnd=t,i}addEmptyAnimation(e,t=0,i=0){let n=this.addAnimationWith(e,lr.emptyAnimation(),!1,i);return i<=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 i=0,n=this.tracks.length;i0){r[h]=lR,a[h]=u;continue e}break}r[h]=wf}}}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()}},x(lr,"_emptyAnimation",new Tp("",[],0)),lr),aR=class{constructor(){x(this,"animation",null);x(this,"previous",null);x(this,"next",null);x(this,"mixingFrom",null);x(this,"mixingTo",null);x(this,"listener",null);x(this,"trackIndex",0);x(this,"loop",!1);x(this,"holdPrevious",!1);x(this,"reverse",!1);x(this,"shortestRotation",!1);x(this,"eventThreshold",0);x(this,"mixAttachmentThreshold",0);x(this,"alphaAttachmentThreshold",0);x(this,"mixDrawOrderThreshold",0);x(this,"animationStart",0);x(this,"animationEnd",0);x(this,"animationLast",0);x(this,"nextAnimationLast",0);x(this,"delay",0);x(this,"trackTime",0);x(this,"trackLast",0);x(this,"nextTrackLast",0);x(this,"trackEnd",0);x(this,"timeScale",0);x(this,"alpha",0);x(this,"mixTime",0);x(this,"_mixDuration",0);x(this,"interruptAlpha",0);x(this,"totalAlpha",0);x(this,"mixBlend",Ce.replace);x(this,"timelineMode",new Array);x(this,"timelineHoldMix",new Array);x(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=0}},oR=class{constructor(e){x(this,"objects",[]);x(this,"drainDisabled",!1);x(this,"animState");this.animState=e}start(e){this.objects.push(ps.start),this.objects.push(e),this.animState.animationsChanged=!0}interrupt(e){this.objects.push(ps.interrupt),this.objects.push(e)}end(e){this.objects.push(ps.end),this.objects.push(e),this.animState.animationsChanged=!0}dispose(e){this.objects.push(ps.dispose),this.objects.push(e)}complete(e){this.objects.push(ps.complete),this.objects.push(e)}event(e,t){this.objects.push(ps.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{c.width=parseInt(i[1]),c.height=parseInt(i[2])},n.format=()=>{},n.filter=c=>{c.minFilter=Ge.enumValue(Bi,i[1]),c.magFilter=Ge.enumValue(Bi,i[2])},n.repeat=c=>{i[1].indexOf("x")!=-1&&(c.uWrap=ur.Repeat),i[1].indexOf("y")!=-1&&(c.vWrap=ur.Repeat)},n.pma=c=>{c.pma=i[1]=="true"};var r={};r.xy=c=>{c.x=parseInt(i[1]),c.y=parseInt(i[2])},r.size=c=>{c.width=parseInt(i[1]),c.height=parseInt(i[2])},r.bounds=c=>{c.x=parseInt(i[1]),c.y=parseInt(i[2]),c.width=parseInt(i[3]),c.height=parseInt(i[4])},r.offset=c=>{c.offsetX=parseInt(i[1]),c.offsetY=parseInt(i[2])},r.orig=c=>{c.originalWidth=parseInt(i[1]),c.originalHeight=parseInt(i[2])},r.offsets=c=>{c.offsetX=parseInt(i[1]),c.offsetY=parseInt(i[2]),c.originalWidth=parseInt(i[3]),c.originalHeight=parseInt(i[4])},r.rotate=c=>{let u=i[1];u=="true"?c.degrees=90:u!="false"&&(c.degrees=parseInt(u))},r.index=c=>{c.index=parseInt(i[1])};let a=t.readLine();for(;a&&a.trim().length==0;)a=t.readLine();for(;!(!a||a.trim().length==0||t.readEntry(i,a)==0);)a=t.readLine();let o=null,h=null,l=null;for(;a!==null;)if(a.trim().length==0)o=null,a=t.readLine();else if(o){let c=new sw(o,a);for(;;){let u=t.readEntry(i,a=t.readLine());if(u==0)break;let d=r[i[0]];if(d)d(c);else{h||(h=[]),l||(l=[]),h.push(i[0]);let f=[];for(let p=0;p0&&l&&l.length>0&&(c.names=h,c.values=l,h=null,l=null),c.u=c.x/o.width,c.v=c.y/o.height,c.degrees==90?(c.u2=(c.x+c.height)/o.width,c.v2=(c.y+c.width)/o.height):(c.u2=(c.x+c.width)/o.width,c.v2=(c.y+c.height)/o.height),this.regions.push(c)}else{for(o=new mR(a.trim());t.readEntry(i,a=t.readLine())!=0;){let c=n[i[0]];c&&c(o)}this.pages.push(o)}}findRegion(e){for(let t=0;t=this.lines.length?null:this.lines[this.index++]}readEntry(e,t){if(!t||(t=t.trim(),t.length==0))return 0;let i=t.indexOf(":");if(i==-1)return 0;e[0]=t.substr(0,i).trim();for(let n=1,r=i+1;;n++){let a=t.indexOf(",",r);if(a==-1)return e[n]=t.substr(r).trim(),n;if(e[n]=t.substr(r,a-r).trim(),r=a+1,n==4)return 4}}},mR=class{constructor(e){x(this,"name");x(this,"minFilter",Bi.Nearest);x(this,"magFilter",Bi.Nearest);x(this,"uWrap",ur.ClampToEdge);x(this,"vWrap",ur.ClampToEdge);x(this,"texture",null);x(this,"width",0);x(this,"height",0);x(this,"pma",!1);x(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}},sw=class extends dR{constructor(t,i){super();x(this,"page");x(this,"name");x(this,"x",0);x(this,"y",0);x(this,"offsetX",0);x(this,"offsetY",0);x(this,"originalWidth",0);x(this,"originalHeight",0);x(this,"index",0);x(this,"degrees",0);x(this,"names",null);x(this,"values",null);this.page=t,this.name=i,t.regions.push(this)}},Zl=class Tm extends vr{constructor(t,i){super(t);x(this,"region",null);x(this,"path");x(this,"regionUVs",[]);x(this,"uvs",[]);x(this,"triangles",[]);x(this,"color",new _t(1,1,1,1));x(this,"width",0);x(this,"height",0);x(this,"hullLength",0);x(this,"edges",[]);x(this,"parentMesh",null);x(this,"sequence",null);x(this,"tempColor",new _t(0,0,0,0));this.path=i}updateRegion(){if(!this.region)throw new Error("Region not set.");let t=this.regionUVs;(!this.uvs||this.uvs.length!=t.length)&&(this.uvs=Ge.newFloatArray(t.length));let i=this.uvs,n=this.uvs.length,r=this.region.u,a=this.region.v,o=0,h=0;if(this.region instanceof sw){let l=this.region,c=l.page,u=c.width,d=c.height;switch(l.degrees){case 90:r-=(l.originalHeight-l.offsetY-l.height)/u,a-=(l.originalWidth-l.offsetX-l.width)/d,o=l.originalHeight/u,h=l.originalWidth/d;for(let f=0;f= 0.");if(!t)throw new Error("name cannot be null.");this.index=e,this.name=t,this.parent=i}};var gi;(function(s){s[s.Normal=0]="Normal",s[s.OnlyTranslation=1]="OnlyTranslation",s[s.NoRotationOrReflection=2]="NoRotationOrReflection",s[s.NoScale=3]="NoScale",s[s.NoScaleOrReflection=4]="NoScaleOrReflection"})(gi||(gi={}));let Vv=class{constructor(e,t,i){x(this,"data");x(this,"skeleton");x(this,"parent",null);x(this,"children",new Array);x(this,"x",0);x(this,"y",0);x(this,"rotation",0);x(this,"scaleX",0);x(this,"scaleY",0);x(this,"shearX",0);x(this,"shearY",0);x(this,"ax",0);x(this,"ay",0);x(this,"arotation",0);x(this,"ascaleX",0);x(this,"ascaleY",0);x(this,"ashearX",0);x(this,"ashearY",0);x(this,"a",0);x(this,"b",0);x(this,"c",0);x(this,"d",0);x(this,"worldY",0);x(this,"worldX",0);x(this,"inherit",gi.Normal);x(this,"sorted",!1);x(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=i,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,i,n,r,a,o){this.ax=e,this.ay=t,this.arotation=i,this.ascaleX=n,this.ascaleY=r,this.ashearX=a,this.ashearY=o;let h=this.parent;if(!h){let f=this.skeleton;const p=f.scaleX,m=f.scaleY,g=(i+a)*$e.degRad,v=(i+90+o)*$e.degRad;this.a=Math.cos(g)*n*p,this.b=Math.cos(v)*r*p,this.c=Math.sin(g)*n*m,this.d=Math.sin(v)*r*m,this.worldX=e*p+f.x,this.worldY=t*m+f.y;return}let l=h.a,c=h.b,u=h.c,d=h.d;switch(this.worldX=l*e+c*t+h.worldX,this.worldY=u*e+d*t+h.worldY,this.inherit){case gi.Normal:{const f=(i+a)*$e.degRad,p=(i+90+o)*$e.degRad,m=Math.cos(f)*n,g=Math.cos(p)*r,v=Math.sin(f)*n,b=Math.sin(p)*r;this.a=l*m+c*v,this.b=l*g+c*b,this.c=u*m+d*v,this.d=u*g+d*b;return}case gi.OnlyTranslation:{const f=(i+a)*$e.degRad,p=(i+90+o)*$e.degRad;this.a=Math.cos(f)*n,this.b=Math.cos(p)*r,this.c=Math.sin(f)*n,this.d=Math.sin(p)*r;break}case gi.NoRotationOrReflection:{let f=1/this.skeleton.scaleX,p=1/this.skeleton.scaleY;l*=f,u*=p;let m=l*l+u*u,g=0;m>1e-4?(m=Math.abs(l*d*p-c*f*u)/m,c=u*m,d=l*m,g=Math.atan2(u,l)*$e.radDeg):(l=0,u=0,g=90-Math.atan2(d,c)*$e.radDeg);const v=(i+a-g)*$e.degRad,b=(i+o-g+90)*$e.degRad,y=Math.cos(v)*n,w=Math.cos(b)*r,A=Math.sin(v)*n,T=Math.sin(b)*r;this.a=l*y-c*A,this.b=l*w-c*T,this.c=u*y+d*A,this.d=u*w+d*T;break}case gi.NoScale:case gi.NoScaleOrReflection:{i*=$e.degRad;const f=Math.cos(i),p=Math.sin(i);let m=(l*f+c*p)/this.skeleton.scaleX,g=(u*f+d*p)/this.skeleton.scaleY,v=Math.sqrt(m*m+g*g);v>1e-5&&(v=1/v),m*=v,g*=v,v=Math.sqrt(m*m+g*g),this.inherit==gi.NoScale&&l*d-c*u<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(v=-v),i=Math.PI/2+Math.atan2(g,m);const b=Math.cos(i)*v,y=Math.sin(i)*v;a*=$e.degRad,o=(90+o)*$e.degRad;const w=Math.cos(a)*n,A=Math.cos(o)*r,T=Math.sin(a)*n,_=Math.sin(o)*r;this.a=m*w+b*T,this.b=m*A+b*_,this.c=g*w+y*T,this.d=g*A+y*_;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)*$e.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)*$e.radDeg;return}let t=e.a,i=e.b,n=e.c,r=e.d,a=1/(t*r-i*n),o=r*a,h=i*a,l=n*a,c=t*a,u=this.worldX-e.worldX,d=this.worldY-e.worldY;this.ax=u*o-d*h,this.ay=d*c-u*l;let f,p,m,g;if(this.inherit==gi.OnlyTranslation)f=this.a,p=this.b,m=this.c,g=this.d;else{switch(this.inherit){case gi.NoRotationOrReflection:{let A=Math.abs(t*r-i*n)/(t*t+n*n);i=-n*this.skeleton.scaleX*A/this.skeleton.scaleY,r=t*this.skeleton.scaleY*A/this.skeleton.scaleX,a=1/(t*r-i*n),o=r*a,h=i*a;break}case gi.NoScale:case gi.NoScaleOrReflection:let v=$e.cosDeg(this.rotation),b=$e.sinDeg(this.rotation);t=(t*v+i*b)/this.skeleton.scaleX,n=(n*v+r*b)/this.skeleton.scaleY;let y=Math.sqrt(t*t+n*n);y>1e-5&&(y=1/y),t*=y,n*=y,y=Math.sqrt(t*t+n*n),this.inherit==gi.NoScale&&a<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(y=-y);let w=$e.PI/2+Math.atan2(n,t);i=Math.cos(w)*y,r=Math.sin(w)*y,a=1/(t*r-i*n),o=r*a,h=i*a,l=n*a,c=t*a}f=o*this.a-h*this.c,p=o*this.b-h*this.d,m=c*this.c-l*this.a,g=c*this.d-l*this.b}if(this.ashearX=0,this.ascaleX=Math.sqrt(f*f+m*m),this.ascaleX>1e-4){let v=f*g-p*m;this.ascaleY=v/this.ascaleX,this.ashearY=-Math.atan2(f*p+m*g,v)*$e.radDeg,this.arotation=Math.atan2(m,f)*$e.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(p*p+g*g),this.ashearY=0,this.arotation=90-Math.atan2(g,p)*$e.radDeg}getWorldRotationX(){return Math.atan2(this.c,this.a)*$e.radDeg}getWorldRotationY(){return Math.atan2(this.d,this.b)*$e.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),i=e.x-this.worldX,n=e.y-this.worldY;return e.x=i*this.d*t-n*this.b*t,e.y=n*this.a*t-i*this.c*t,e}localToWorld(e){let t=e.x,i=e.y;return e.x=t*this.a+i*this.b+this.worldX,e.y=t*this.c+i*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=$e.sinDeg(e),i=$e.cosDeg(e);return Math.atan2(this.a*t-this.c*i,this.d*i-this.b*t)*$e.radDeg+this.rotation-this.shearX}localToWorldRotation(e){e-=this.rotation-this.shearX;let t=$e.sinDeg(e),i=$e.cosDeg(e);return Math.atan2(i*this.c+t*this.d,i*this.a+t*this.b)*$e.radDeg}rotateWorld(e){e*=$e.degRad;const t=Math.sin(e),i=Math.cos(e),n=this.a,r=this.b;this.a=i*n-t*this.c,this.b=i*r-t*this.d,this.c=t*n+i*this.c,this.d=t*r+i*this.d}},Cu=class{constructor(e,t,i){x(this,"name");x(this,"order");x(this,"skinRequired");this.name=e,this.order=t,this.skinRequired=i}},lw=class{constructor(e,t){x(this,"data");x(this,"intValue",0);x(this,"floatValue",0);x(this,"stringValue",null);x(this,"time",0);x(this,"volume",0);x(this,"balance",0);if(!t)throw new Error("data cannot be null.");this.time=e,this.data=t}},cw=class{constructor(e){x(this,"name");x(this,"intValue",0);x(this,"floatValue",0);x(this,"stringValue",null);x(this,"audioPath",null);x(this,"volume",0);x(this,"balance",0);this.name=e}},pR=class{constructor(e,t){x(this,"data");x(this,"bones");x(this,"target");x(this,"bendDirection",0);x(this,"compress",!1);x(this,"stretch",!1);x(this,"mix",1);x(this,"softness",0);x(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;n180?f-=360:f<-180&&(f+=360);let g=e.ascaleX,v=e.ascaleY;if(n||r){switch(e.inherit){case gi.NoScale:case gi.NoScaleOrReflection:p=t-e.worldX,m=i-e.worldY}const b=e.data.length*g;if(b>1e-4){const y=p*p+m*m;if(n&&yb*b){const w=(Math.sqrt(y)/b-1)*o+1;g*=w,a&&(v*=w)}}}e.updateWorldTransformWith(e.ax,e.ay,e.arotation+f*o,g,v,e.ashearX,e.ashearY)}apply2(e,t,i,n,r,a,o,h,l){if(e.inherit!=gi.Normal||t.inherit!=gi.Normal)return;let c=e.ax,u=e.ay,d=e.ascaleX,f=e.ascaleY,p=d,m=f,g=t.ascaleX,v=0,b=0,y=0;d<0?(d=-d,v=180,y=-1):(v=0,y=1),f<0&&(f=-f,y=-y),g<0?(g=-g,b=180):b=0;let w=t.ax,A=0,T=0,_=0,R=e.a,P=e.b,F=e.c,I=e.d,k=Math.abs(d-f)<=1e-4;!k||a?(A=0,T=R*w+e.worldX,_=F*w+e.worldY):(A=t.ay,T=R*w+P*A+e.worldX,_=F*w+I*A+e.worldY);let B=e.parent;if(!B)throw new Error("IK parent must itself have a parent.");R=B.a,P=B.b,F=B.c,I=B.d;let D=R*I-P*F,U=T-B.worldX,L=_-B.worldY;D=Math.abs(D)<=1e-4?0:1/D;let N=(U*I-L*P)*D-c,O=(L*R-U*F)*D-u,X=Math.sqrt(N*N+O*O),E=t.data.length*g,V,q;if(X<1e-4){this.apply1(e,i,n,!1,a,!1,l),t.updateWorldTransformWith(w,A,0,t.ascaleX,t.ascaleY,t.ashearX,t.ashearY);return}U=i-B.worldX,L=n-B.worldY;let W=(U*I-L*P)*D-c,J=(L*R-U*F)*D-u,K=W*W+J*J;if(h!=0){h*=d*(g+1)*.5;let we=Math.sqrt(K),Ee=we-X-E*d+h;if(Ee>0){let pe=Math.min(1,Ee/(h*2))-1;pe=(Ee-h*(1-pe*pe))/we,W-=pe*W,J-=pe*J,K=W*W+J*J}}e:if(k){E*=d;let we=(K-X*X-E*E)/(2*X*E);we<-1?(we=-1,q=Math.PI*r):we>1?(we=1,q=0,a&&(R=(Math.sqrt(K)/(X+E)-1)*l+1,p*=R,o&&(m*=R))):q=Math.acos(we)*r,R=X+E*we,P=E*Math.sin(q),V=Math.atan2(J*R-W*P,W*R+J*P)}else{R=d*E,P=f*E;let we=R*R,Ee=P*P,pe=Math.atan2(J,W);F=Ee*X*X+we*K-we*Ee;let Ae=-2*Ee*X,G=Ee-we;if(I=Ae*Ae-4*G*F,I>=0){let le=Math.sqrt(I);Ae<0&&(le=-le),le=-(Ae+le)*.5;let Oe=le/G,Fe=F/le,Be=Math.abs(Oe)=0){L=Math.sqrt(Oe)*r,V=pe-Math.atan2(L,Be),q=Math.atan2(L/f,(Be-X)/d);break e}}let Z=$e.PI,z=X-R,j=z*z,te=0,he=0,xe=X+R,oe=xe*xe,ge=0;F=-R*X/(we-Ee),F>=-1&&F<=1&&(F=Math.acos(F),U=R*Math.cos(F)+X,L=P*Math.sin(F),I=U*U+L*L,Ioe&&(he=F,oe=I,xe=U,ge=L)),K<=(j+oe)*.5?(V=pe-Math.atan2(te*r,z),q=Z*r):(V=pe-Math.atan2(ge*r,xe),q=he*r)}let fe=Math.atan2(A,w)*y,me=e.arotation;V=(V-fe)*$e.radDeg+v-me,V>180?V-=360:V<-180&&(V+=360),e.updateWorldTransformWith(c,u,me+V*l,p,m,0,0),me=t.arotation,q=((q+fe)*$e.radDeg-t.ashearX)*y+b-me,q>180?q-=360:q<-180&&(q+=360),t.updateWorldTransformWith(w,A,me+q*l,t.ascaleX,t.ascaleY,t.ashearX,t.ashearY)}},hw=class extends Cu{constructor(t){super(t,0,!1);x(this,"bones",new Array);x(this,"_target",null);x(this,"bendDirection",0);x(this,"compress",!1);x(this,"stretch",!1);x(this,"uniform",!1);x(this,"mix",0);x(this,"softness",0)}set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("BoneData not set.")}},uw=class extends Cu{constructor(t){super(t,0,!1);x(this,"bones",new Array);x(this,"_target",null);x(this,"positionMode",Ln.Fixed);x(this,"spacingMode",ki.Fixed);x(this,"rotateMode",Pa.Chain);x(this,"offsetRotation",0);x(this,"position",0);x(this,"spacing",0);x(this,"mixRotate",0);x(this,"mixX",0);x(this,"mixY",0)}set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("SlotData not set.")}};var Ln;(function(s){s[s.Fixed=0]="Fixed",s[s.Percent=1]="Percent"})(Ln||(Ln={}));var ki;(function(s){s[s.Length=0]="Length",s[s.Fixed=1]="Fixed",s[s.Percent=2]="Percent",s[s.Proportional=3]="Proportional"})(ki||(ki={}));var Pa;(function(s){s[s.Tangent=0]="Tangent",s[s.Chain=1]="Chain",s[s.ChainScale=2]="ChainScale"})(Pa||(Pa={}));var Ji;let gR=(Ji=class{constructor(e,t){x(this,"data");x(this,"bones");x(this,"target");x(this,"position",0);x(this,"spacing",0);x(this,"mixRotate",0);x(this,"mixX",0);x(this,"mixY",0);x(this,"spaces",new Array);x(this,"positions",new Array);x(this,"world",new Array);x(this,"curves",new Array);x(this,"lengths",new Array);x(this,"segments",new Array);x(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;n0){w=u/w*p;for(let T=1;T0?$e.degRad:-.01745329277777778}for(let w=0,A=3;w0){let I=T.a,k=T.b,B=T.c,D=T.d,U=0,L=0,N=0;if(o?U=m[A-1]:d[w+1]==0?U=m[A+2]:U=Math.atan2(F,P),U-=Math.atan2(B,I),y){L=Math.cos(U),N=Math.sin(U);let O=T.data.length;g+=(O*(L*I-N*B)-P)*i,v+=(O*(N*I+L*B)-F)*i}else U+=b;U>$e.PI?U-=$e.PI2:U<-3.1415927&&(U+=$e.PI2),U*=i,L=Math.cos(U),N=Math.sin(U),T.a=L*I-N*B,T.b=L*k-N*D,T.c=N*I+L*B,T.d=N*k+L*D}T.updateAppliedTransform()}}computeWorldPositions(e,t,i){let n=this.target,r=this.position,a=this.spaces,o=Ge.setArraySize(this.positions,t*3+2),h=this.world,l=e.closed,c=e.worldVerticesLength,u=c/6,d=Ji.NONE;if(!e.constantSpeed){let O=e.lengths;u-=l?1:2;let X=O[u];this.data.positionMode==Ln.Percent&&(r*=X);let E;switch(this.data.spacingMode){case ki.Percent:E=X;break;case ki.Proportional:E=X/t;break;default:E=1}h=Ge.setArraySize(this.world,8);for(let V=0,q=0,W=0;VX){d!=Ji.AFTER&&(d=Ji.AFTER,e.computeWorldVertices(n,c-6,4,h,0,2)),this.addAfterPosition(K-X,h,0,o,q);continue}for(;;W++){let fe=O[W];if(!(K>fe)){if(W==0)K/=fe;else{let me=O[W-1];K=(K-me)/(fe-me)}break}}W!=d&&(d=W,l&&W==u?(e.computeWorldVertices(n,c-4,4,h,0,2),e.computeWorldVertices(n,0,4,h,4,2)):e.computeWorldVertices(n,W*6+2,8,h,0,2)),this.addCurvePosition(K,h[0],h[1],h[2],h[3],h[4],h[5],h[6],h[7],o,q,i||V>0&&J==0)}return o}l?(c+=2,h=Ge.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=Ge.setArraySize(this.world,c),e.computeWorldVertices(n,2,c,h,0,2));let f=Ge.setArraySize(this.curves,u),p=0,m=h[0],g=h[1],v=0,b=0,y=0,w=0,A=0,T=0,_=0,R=0,P=0,F=0,I=0,k=0,B=0,D=0;for(let O=0,X=2;Op){this.addAfterPosition(W-p,h,c-4,o,X);continue}for(;;E++){let J=f[E];if(!(W>J)){if(E==0)W/=J;else{let K=f[E-1];W=(W-K)/(J-K)}break}}if(E!=d){d=E;let J=E*6;for(m=h[J],g=h[J+1],v=h[J+2],b=h[J+3],y=h[J+4],w=h[J+5],A=h[J+6],T=h[J+7],_=(m-v*2+y)*.03,R=(g-b*2+w)*.03,P=((v-y)*3-m+A)*.006,F=((b-w)*3-g+T)*.006,I=_*2+P,k=R*2+F,B=(v-m)*.3+_+P*.16666667,D=(b-g)*.3+R+F*.16666667,N=Math.sqrt(B*B+D*D),L[0]=N,J=1;J<8;J++)B+=I,D+=k,I+=P,k+=F,N+=Math.sqrt(B*B+D*D),L[J]=N;B+=I,D+=k,N+=Math.sqrt(B*B+D*D),L[8]=N,B+=I+P,D+=k+F,N+=Math.sqrt(B*B+D*D),L[9]=N,V=0}for(W*=N;;V++){let J=L[V];if(!(W>J)){if(V==0)W/=J;else{let K=L[V-1];W=V+(W-K)/(J-K)}break}}this.addCurvePosition(W*.1,m,g,v,b,y,w,A,T,o,X,i||O>0&&q==0)}return o}addBeforePosition(e,t,i,n,r){let a=t[i],o=t[i+1],h=t[i+2]-a,l=t[i+3]-o,c=Math.atan2(l,h);n[r]=a+e*Math.cos(c),n[r+1]=o+e*Math.sin(c),n[r+2]=c}addAfterPosition(e,t,i,n,r){let a=t[i+2],o=t[i+3],h=a-t[i],l=o-t[i+1],c=Math.atan2(l,h);n[r]=a+e*Math.cos(c),n[r+1]=o+e*Math.sin(c),n[r+2]=c}addCurvePosition(e,t,i,n,r,a,o,h,l,c,u,d){if(e==0||isNaN(e)){c[u]=t,c[u+1]=i,c[u+2]=Math.atan2(r-i,n-t);return}let f=e*e,p=f*e,m=1-e,g=m*m,v=g*m,b=m*e,y=b*3,w=m*y,A=y*e,T=t*v+n*w+a*A+h*p,_=i*v+r*w+o*A+l*p;c[u]=T,c[u+1]=_,d&&(e<.001?c[u+2]=Math.atan2(r-i,n-t):c[u+2]=Math.atan2(_-(i*g+r*b*2+o*f),T-(t*g+n*b*2+a*f)))}},x(Ji,"NONE",-1),x(Ji,"BEFORE",-2),x(Ji,"AFTER",-3),x(Ji,"epsilon",1e-5),Ji),vR=class{constructor(e,t){x(this,"data");x(this,"_bone",null);x(this,"inertia",0);x(this,"strength",0);x(this,"damping",0);x(this,"massInverse",0);x(this,"wind",0);x(this,"gravity",0);x(this,"mix",0);x(this,"_reset",!0);x(this,"ux",0);x(this,"uy",0);x(this,"cx",0);x(this,"cy",0);x(this,"tx",0);x(this,"ty",0);x(this,"xOffset",0);x(this,"xVelocity",0);x(this,"yOffset",0);x(this,"yVelocity",0);x(this,"rotateOffset",0);x(this,"rotateVelocity",0);x(this,"scaleOffset",0);x(this,"scaleVelocity",0);x(this,"active",!1);x(this,"skeleton");x(this,"remaining",0);x(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 i=this.data.x>0,n=this.data.y>0,r=this.data.rotate>0||this.data.shearX>0,a=this.data.scaleX>0,o=this.bone,h=o.data.length;switch(e){case Br.none:return;case Br.reset:this.reset();case Br.update:const l=this.skeleton,c=Math.max(this.skeleton.time-this.lastTime,0);this.remaining+=c,this.lastTime=l.time;const u=o.worldX,d=o.worldY;if(this._reset)this._reset=!1,this.ux=u,this.uy=d;else{let f=this.remaining,p=this.inertia,m=this.data.step,g=this.skeleton.data.referenceScale,v=-1,b=this.data.limit*c,y=b*Math.abs(l.scaleY);if(b*=Math.abs(l.scaleX),i||n){if(i){const w=(this.ux-u)*p;this.xOffset+=w>b?b:w<-b?-b:w,this.ux=u}if(n){const w=(this.uy-d)*p;this.yOffset+=w>y?y:w<-y?-y:w,this.uy=d}if(f>=m){v=Math.pow(this.damping,60*m);const w=this.massInverse*m,A=this.strength,T=this.wind*g*l.scaleX,_=this.gravity*g*l.scaleY;do i&&(this.xVelocity+=(T-this.xOffset*A)*w,this.xOffset+=this.xVelocity*m,this.xVelocity*=v),n&&(this.yVelocity-=(_+this.yOffset*A)*w,this.yOffset+=this.yVelocity*m,this.yVelocity*=v),f-=m;while(f>=m)}i&&(o.worldX+=this.xOffset*t*this.data.x),n&&(o.worldY+=this.yOffset*t*this.data.y)}if(r||a){let w=Math.atan2(o.c,o.a),A=0,T=0,_=0,R=this.cx-o.worldX,P=this.cy-o.worldY;if(R>b?R=b:R<-b&&(R=-b),P>y?P=y:P<-y&&(P=-y),r){_=(this.data.rotate+this.data.shearX)*t;let F=Math.atan2(P+this.ty,R+this.tx)-w-this.rotateOffset*_;this.rotateOffset+=(F-Math.ceil(F*$e.invPI2-.5)*$e.PI2)*p,F=this.rotateOffset*_+w,A=Math.cos(F),T=Math.sin(F),a&&(F=h*o.getWorldScaleX(),F>0&&(this.scaleOffset+=(R*A+P*T)*p/F))}else{A=Math.cos(w),T=Math.sin(w);const F=h*o.getWorldScaleX();F>0&&(this.scaleOffset+=(R*A+P*T)*p/F)}if(f=this.remaining,f>=m){v==-1&&(v=Math.pow(this.damping,60*m));const F=this.massInverse*m,I=this.strength,k=this.wind,B=Cp.yDown?-this.gravity:this.gravity,D=h/g;for(;;)if(f-=m,a&&(this.scaleVelocity+=(k*A-B*T-this.scaleOffset*I)*F,this.scaleOffset+=this.scaleVelocity*m,this.scaleVelocity*=v),r){if(this.rotateVelocity-=((k*T+B*A)*D+this.rotateOffset*I)*F,this.rotateOffset+=this.rotateVelocity*m,this.rotateVelocity*=v,f0){let f=0;this.data.rotate>0&&(f=l*this.data.rotate,c=Math.sin(f),u=Math.cos(f),d=o.b,o.b=u*d-c*o.d,o.d=c*d+u*o.d),f+=l*this.data.shearX,c=Math.sin(f),u=Math.cos(f),d=o.a,o.a=u*d-c*o.c,o.c=c*d+u*o.c}else l*=this.data.rotate,c=Math.sin(l),u=Math.cos(l),d=o.a,o.a=u*d-c*o.c,o.c=c*d+u*o.c,d=o.b,o.b=u*d-c*o.d,o.d=c*d+u*o.d}if(a){const l=1+this.scaleOffset*t*this.data.scaleX;o.a*=l,o.c*=l}e!=Br.pose&&(this.tx=h*o.a,this.ty=h*o.c),o.updateAppliedTransform()}translate(e,t){this.ux-=e,this.uy-=t,this.cx-=e,this.cy-=t}rotate(e,t,i){const n=i*$e.degRad,r=Math.cos(n),a=Math.sin(n),o=this.cx-e,h=this.cy-t;this.translate(o*r-h*a-o,o*a+h*r-h)}},yR=class{constructor(e,t){x(this,"data");x(this,"bone");x(this,"color");x(this,"darkColor",null);x(this,"attachment",null);x(this,"attachmentState",0);x(this,"sequenceIndex",-1);x(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 _t,this.darkColor=e.darkColor?new _t:null,this.setToSetupPose()}getSkeleton(){return this.bone.skeleton}getAttachment(){return this.attachment}setAttachment(e){this.attachment!=e&&((!(e instanceof vr)||!(this.attachment instanceof vr)||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}},xR=class{constructor(e,t){x(this,"data");x(this,"bones");x(this,"target");x(this,"mixRotate",0);x(this,"mixX",0);x(this,"mixY",0);x(this,"mixScaleX",0);x(this,"mixScaleY",0);x(this,"mixShearY",0);x(this,"temp",new Fh);x(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;n0?$e.degRad:-.01745329277777778,p=this.data.offsetRotation*f,m=this.data.offsetShearY*f,g=this.bones;for(let v=0,b=g.length;v$e.PI?R-=$e.PI2:R<-3.1415927&&(R+=$e.PI2),R*=e;let P=Math.cos(R),F=Math.sin(R);y.a=P*w-F*T,y.b=P*A-F*_,y.c=F*w+P*T,y.d=F*A+P*_}if(o){let w=this.temp;h.localToWorld(w.set(this.data.offsetX,this.data.offsetY)),y.worldX+=(w.x-y.worldX)*t,y.worldY+=(w.y-y.worldY)*i}if(n!=0){let w=Math.sqrt(y.a*y.a+y.c*y.c);w!=0&&(w=(w+(Math.sqrt(l*l+u*u)-w+this.data.offsetScaleX)*n)/w),y.a*=w,y.c*=w}if(r!=0){let w=Math.sqrt(y.b*y.b+y.d*y.d);w!=0&&(w=(w+(Math.sqrt(c*c+d*d)-w+this.data.offsetScaleY)*r)/w),y.b*=w,y.d*=w}if(a>0){let w=y.b,A=y.d,T=Math.atan2(A,w),_=Math.atan2(d,c)-Math.atan2(u,l)-(T-Math.atan2(y.c,y.a));_>$e.PI?_-=$e.PI2:_<-3.1415927&&(_+=$e.PI2),_=T+(_+m)*a;let R=Math.sqrt(w*w+A*A);y.b=Math.cos(_)*R,y.d=Math.sin(_)*R}y.updateAppliedTransform()}}applyRelativeWorld(){let e=this.mixRotate,t=this.mixX,i=this.mixY,n=this.mixScaleX,r=this.mixScaleY,a=this.mixShearY,o=t!=0||i!=0,h=this.target,l=h.a,c=h.b,u=h.c,d=h.d,f=l*d-c*u>0?$e.degRad:-.01745329277777778,p=this.data.offsetRotation*f,m=this.data.offsetShearY*f,g=this.bones;for(let v=0,b=g.length;v$e.PI?R-=$e.PI2:R<-3.1415927&&(R+=$e.PI2),R*=e;let P=Math.cos(R),F=Math.sin(R);y.a=P*w-F*T,y.b=P*A-F*_,y.c=F*w+P*T,y.d=F*A+P*_}if(o){let w=this.temp;h.localToWorld(w.set(this.data.offsetX,this.data.offsetY)),y.worldX+=w.x*t,y.worldY+=w.y*i}if(n!=0){let w=(Math.sqrt(l*l+u*u)-1+this.data.offsetScaleX)*n+1;y.a*=w,y.c*=w}if(r!=0){let w=(Math.sqrt(c*c+d*d)-1+this.data.offsetScaleY)*r+1;y.b*=w,y.d*=w}if(a>0){let w=Math.atan2(d,c)-Math.atan2(u,l);w>$e.PI?w-=$e.PI2:w<-3.1415927&&(w+=$e.PI2);let A=y.b,T=y.d;w=Math.atan2(T,A)+(w-$e.PI/2+m)*a;let _=Math.sqrt(A*A+T*T);y.b=Math.cos(w)*_,y.d=Math.sin(w)*_}y.updateAppliedTransform()}}applyAbsoluteLocal(){let e=this.mixRotate,t=this.mixX,i=this.mixY,n=this.mixScaleX,r=this.mixScaleY,a=this.mixShearY,o=this.target,h=this.bones;for(let l=0,c=h.length;lt.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 Fh,i=new Fh;return this.getBounds(t,i,void 0,e),{x:t.x,y:t.y,width:i.x,height:i.y}}getBounds(e,t,i=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,a=Number.POSITIVE_INFINITY,o=Number.POSITIVE_INFINITY,h=Number.NEGATIVE_INFINITY,l=Number.NEGATIVE_INFINITY;for(let c=0,u=r.length;c=n.length&&(n.length=e+1),n[e]||(n[e]={}),n[e][t]=i}addSkin(e){for(let n=0;n= 0.");if(!t)throw new Error("name cannot be null.");if(!i)throw new Error("boneData cannot be null.");this.index=e,this.name=t,this.boneData=i}};var Vr;(function(s){s[s.Normal=0]="Normal",s[s.Additive=1]="Additive",s[s.Multiply=2]="Multiply",s[s.Screen=3]="Screen"})(Vr||(Vr={}));let mw=class extends Cu{constructor(t){super(t,0,!1);x(this,"bones",new Array);x(this,"_target",null);x(this,"mixRotate",0);x(this,"mixX",0);x(this,"mixY",0);x(this,"mixScaleX",0);x(this,"mixScaleY",0);x(this,"mixShearY",0);x(this,"offsetRotation",0);x(this,"offsetX",0);x(this,"offsetY",0);x(this,"offsetScaleX",0);x(this,"offsetScaleY",0);x(this,"offsetShearY",0);x(this,"relative",!1);x(this,"local",!1)}set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("BoneData not set.")}},Cm=class{constructor(e){x(this,"scale",1);x(this,"attachmentLoader");x(this,"linkedMeshes",new Array);this.attachmentLoader=e}readSkeletonData(e){let t=this.scale,i=new Bh;i.name="";let n=new bR(e),r=n.readInt32(),a=n.readInt32();i.hash=a==0&&r==0?null:a.toString(16)+r.toString(16),i.version=n.readString(),i.x=n.readFloat(),i.y=n.readFloat(),i.width=n.readFloat(),i.height=n.readFloat(),i.referenceScale=n.readFloat()*t;let o=n.readBoolean();o&&(i.fps=n.readFloat(),i.imagesPath=n.readString(),i.audioPath=n.readString());let h=0;h=n.readInt(!0);for(let c=0;c>1&3,f.rotateMode=p>>3&3,(p&128)!=0&&(f.offsetRotation=n.readFloat()),f.position=n.readFloat(),f.positionMode==Ln.Fixed&&(f.position*=t),f.spacing=n.readFloat(),(f.spacingMode==ki.Length||f.spacingMode==ki.Fixed)&&(f.spacing*=t),f.mixRotate=n.readFloat(),f.mixX=n.readFloat(),f.mixY=n.readFloat(),i.pathConstraints.push(f)}h=n.readInt(!0);for(let c=0,u;c>4,e.readFloat())}n.push(T);break}}}}}let a=e.readInt(!0);if(a>0){let l=new gl(a),c=i.slots.length;for(let u=0;u=0;b--)p[b]=-1;let m=Ge.newArray(c-f,0),g=0,v=0;for(let b=0;b=0;b--)p[b]==-1&&(p[b]=m[--v]);l.setFrame(u,d,p)}n.push(l)}let o=e.readInt(!0);if(o>0){let l=new Ep(o);for(let c=0;c>>1^-(i&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 i=0;i>4){case 12:case 13:t+=String.fromCharCode((n&31)<<6|this.readByte()&63),i+=2;break;case 14:t+=String.fromCharCode((n&15)<<12|(this.readByte()&63)<<6|this.readByte()&63),i+=3;break;default:t+=String.fromCharCode(n),i++}}return t}readFloat(){let e=this.buffer.getFloat32(this.index);return this.index+=4,e}readBoolean(){return this.readByte()!=0}},wR=class{constructor(e,t,i,n,r){x(this,"parent");x(this,"skinIndex");x(this,"slotIndex");x(this,"mesh");x(this,"inheritTimeline");this.mesh=e,this.skinIndex=t,this.slotIndex=i,this.parent=n,this.inheritTimeline=r}},SR=class{constructor(e=null,t=null,i=0){x(this,"bones");x(this,"vertices");x(this,"length");this.bones=e,this.vertices=t,this.length=i}};var zn;(function(s){s[s.Region=0]="Region",s[s.BoundingBox=1]="BoundingBox",s[s.Mesh=2]="Mesh",s[s.LinkedMesh=3]="LinkedMesh",s[s.Path=4]="Path",s[s.Point=5]="Point",s[s.Clipping=6]="Clipping"})(zn||(zn={}));function qi(s,e,t){let i=s.readFloat(),n=s.readFloat()*t;for(let r=0,a=0,o=e.getFrameCount()-1;e.setFrame(r,i,n),r!=o;r++){let h=s.readFloat(),l=s.readFloat()*t;switch(s.readByte()){case Sn:e.setStepped(r);break;case Mn:Ft(s,e,a++,r,0,i,h,n,l,t)}i=h,n=l}return e}function Sf(s,e,t){let i=s.readFloat(),n=s.readFloat()*t,r=s.readFloat()*t;for(let a=0,o=0,h=e.getFrameCount()-1;e.setFrame(a,i,n,r),a!=h;a++){let l=s.readFloat(),c=s.readFloat()*t,u=s.readFloat()*t;switch(s.readByte()){case Sn:e.setStepped(a);break;case Mn:Ft(s,e,o++,a,0,i,l,n,c,t),Ft(s,e,o++,a,1,i,l,r,u,t)}i=l,n=c,r=u}return e}function Ft(s,e,t,i,n,r,a,o,h,l){e.setBezier(t,i,n,r,o,s.readFloat(),s.readFloat()*l,s.readFloat(),s.readFloat()*l,a,h)}const MR=0,_R=1,TR=2,AR=3,ER=4,CR=5,IR=6,RR=7,PR=8,kR=9,FR=10,OR=0,BR=1,LR=2,DR=3,NR=4,UR=5,XR=0,VR=1,YR=0,$R=1,GR=2,HR=0,jR=1,WR=2,zR=4,qR=5,KR=6,ZR=7,JR=8,Sn=1,Mn=2;class gs{constructor(){x(this,"convexPolygons",new Array);x(this,"convexPolygonsIndices",new Array);x(this,"indicesArray",new Array);x(this,"isConcaveArray",new Array);x(this,"triangles",new Array);x(this,"polygonPool",new kh(()=>new Array));x(this,"polygonIndicesPool",new kh(()=>new Array))}triangulate(e){let t=e,i=e.length>>1,n=this.indicesArray;n.length=0;for(let o=0;o3;){let o=i-1,h=0,l=1;for(;;){e:if(!r[h]){let d=n[o]<<1,f=n[h]<<1,p=n[l]<<1,m=t[d],g=t[d+1],v=t[f],b=t[f+1],y=t[p],w=t[p+1];for(let A=(l+1)%i;A!=o;A=(A+1)%i){if(!r[A])continue;let T=n[A]<<1,_=t[T],R=t[T+1];if(gs.positiveArea(y,w,m,g,_,R)&&gs.positiveArea(m,g,v,b,_,R)&&gs.positiveArea(v,b,y,w,_,R))break e}break}if(l==0){do{if(!r[h])break;h--}while(h>0);break}o=h,h=l,l=(l+1)%i}a.push(n[(i+h-1)%i]),a.push(n[h]),a.push(n[(h+1)%i]),n.splice(h,1),r.splice(h,1),i--;let c=(i+h-1)%i,u=h==i?0:h;r[c]=gs.isConcave(c,i,t,n),r[u]=gs.isConcave(u,i,t,n)}return i==3&&(a.push(n[2]),a.push(n[0]),a.push(n[1])),a}decompose(e,t){let i=e,n=this.convexPolygons;this.polygonPool.freeAll(n),n.length=0;let r=this.convexPolygonsIndices;this.polygonIndicesPool.freeAll(r),r.length=0;let a=this.polygonIndicesPool.obtain();a.length=0;let o=this.polygonPool.obtain();o.length=0;let h=-1,l=0;for(let c=0,u=t.length;c0?(n.push(o),r.push(a)):(this.polygonPool.free(o),this.polygonIndicesPool.free(a)),o=this.polygonPool.obtain(),o.length=0,o.push(m),o.push(g),o.push(v),o.push(b),o.push(y),o.push(w),a=this.polygonIndicesPool.obtain(),a.length=0,a.push(d),a.push(f),a.push(p),l=gs.winding(m,g,v,b,y,w),h=d)}o.length>0&&(n.push(o),r.push(a));for(let c=0,u=n.length;c=0;c--)o=n[c],o.length==0&&(n.splice(c,1),this.polygonPool.free(o),a=r[c],r.splice(c,1),this.polygonIndicesPool.free(a));return n}static isConcave(e,t,i,n){let r=n[(t+e-1)%t]<<1,a=n[e]<<1,o=n[(e+1)%t]<<1;return!this.positiveArea(i[r],i[r+1],i[a],i[a+1],i[o],i[o+1])}static positiveArea(e,t,i,n,r,a){return e*(a-n)+i*(t-a)+r*(n-t)>=0}static winding(e,t,i,n,r,a){let o=i-e,h=n-t;return r*h-a*o+o*t-e*h>=0?1:-1}}class Lh{constructor(){x(this,"triangulator",new gs);x(this,"clippingPolygon",new Array);x(this,"clipOutput",new Array);x(this,"clippedVertices",new Array);x(this,"clippedUVs",new Array);x(this,"clippedTriangles",new Array);x(this,"scratch",new Array);x(this,"clipAttachment",null);x(this,"clippingPolygons",null)}clipStart(e,t){if(this.clipAttachment)return 0;this.clipAttachment=t;let i=t.worldVerticesLength,n=Ge.setArraySize(this.clippingPolygon,i);t.computeWorldVertices(e,0,i,n,0,2);let r=this.clippingPolygon;Lh.makeClockwise(r);let a=this.clippingPolygons=this.triangulator.decompose(r,this.triangulator.triangulate(r));for(let o=0,h=a.length;o>1,T=this.clipOutput,_=Ge.setArraySize(r,y+A*2);for(let P=0;P>1,q=this.clipOutput,W=Ge.setArraySize(l,D+V*f);for(let K=0;K>1,X=this.clipOutput,E=Ge.setArraySize(a,I+O*2),V=Ge.setArraySize(o,I+O*2);for(let W=0;W=2?(u=h,h=this.scratch):u=this.scratch,u.length=0,u.push(e),u.push(t),u.push(i),u.push(n),u.push(r),u.push(a),u.push(e),u.push(t),h.length=0;let d=o.length-4,f=o;for(let p=0;;p+=2){let m=f[p],g=f[p+1],v=m-f[p+2],b=g-f[p+3],y=h.length,w=u;for(let T=0,_=u.length-2;T<_;){let R=w[T],P=w[T+1];T+=2;let F=w[T],I=w[T+1],k=b*(m-F)>v*(g-I),B=b*(m-R)-v*(g-P);if(B>0){if(k){h.push(F),h.push(I);continue}let D=F-R,U=I-P,L=B/(D*b-U*v);if(L>=0&&L<=1)h.push(R+D*L),h.push(P+U*L);else{h.push(F),h.push(I);continue}}else if(k){let D=F-R,U=I-P,L=B/(D*b-U*v);if(L>=0&&L<=1)h.push(R+D*L),h.push(P+U*L),h.push(F),h.push(I);else{h.push(F),h.push(I);continue}}c=!0}if(y==h.length)return l.length=0,!0;if(h.push(h[0]),h.push(h[1]),p==d)break;let A=h;h=u,h.length=0,u=A}if(l!=h){l.length=0;for(let p=0,m=h.length-2;p>1;l0){let c=i.findPhysicsConstraint(o);if(!c)throw new Error("Physics constraint not found: "+o);l=i.physicsConstraints.indexOf(c)}for(let c in h){let u=h[c],d=u[0];if(!d)continue;let f=u.length;if(c=="reset"){const m=new Z1(f,l);for(let g=0;d!=null;d=u[g+1],g++)m.setFrame(g,re(d,"time",0));r.push(m);continue}let p;if(c=="inertia")p=new G1(f,f,l);else if(c=="strength")p=new H1(f,f,l);else if(c=="damping")p=new j1(f,f,l);else if(c=="mass")p=new W1(f,f,l);else if(c=="wind")p=new z1(f,f,l);else if(c=="gravity")p=new q1(f,f,l);else if(c=="mix")p=new K1(f,f,l);else continue;r.push(Ks(u,p,0,1))}}if(e.attachments)for(let o in e.attachments){let h=e.attachments[o],l=i.findSkin(o);if(!l)throw new Error("Skin not found: "+o);for(let c in h){let u=h[c],d=i.findSlot(c);if(!d)throw new Error("Slot not found: "+c);let f=d.index;for(let p in u){let m=u[p],g=l.getAttachment(f,p);for(let v in m){let b=m[v],y=b[0];if(y){if(v=="deform"){let w=g.bones,A=g.vertices,T=w?A.length/3*2:A.length,_=new N1(b.length,b.length,f,g),R=re(y,"time",0);for(let P=0,F=0;;P++){let I,k=re(y,"vertices",null);if(!k)I=w?Ge.newFloatArray(T):A;else{I=Ge.newFloatArray(T);let L=re(y,"offset",0);if(Ge.arrayCopy(k,0,I,L,k.length),n!=1)for(let N=L,O=N+k.length;N=0;v--)d[v]==-1&&(d[v]=p[--g])}o.setFrame(l,re(u,"time",0),d)}r.push(o)}if(e.events){let o=new Ep(e.events.length),h=0;for(let l=0;l"u"&&(Math.fround=(function(s){return function(e){return s[0]=e,s[0]}})(new Float32Array(1)));if(typeof window<"u"&&window.PIXI){let s=window.require;window.require=e=>{if(s)return s(e);if(e.startsWith("@pixi/"))return window.PIXI}}const Kn=class Kn extends uR{constructor(t){super(t.resource.source);x(this,"texture");this.texture=gt.from(t)}static from(t){return Kn.textureMap.has(t)?Kn.textureMap.get(t):new Kn(t)}setFilters(t,i){this.texture.baseTexture.scaleMode=Kn.toPixiTextureFilter(t),this.texture.baseTexture.mipmap=Kn.toPixiMipMap(t)}setWraps(t,i){this.texture.baseTexture.wrapMode=Kn.toPixiTextureWrap(t)}dispose(){this.texture.destroy()}static toPixiTextureFilter(t){switch(t){case Bi.Nearest:case Bi.MipMapNearestLinear:case Bi.MipMapNearestNearest:return sn.NEAREST;case Bi.Linear:case Bi.MipMapLinearLinear:case Bi.MipMapLinearNearest:return sn.LINEAR;default:throw new Error(`Unknown texture filter: ${String(t)}`)}}static toPixiMipMap(t){switch(t){case Bi.Nearest:case Bi.Linear:return Ys.OFF;case Bi.MipMapNearestLinear:case Bi.MipMapNearestNearest:case Bi.MipMapLinearLinear:case Bi.MipMapLinearNearest:return Ys.ON;default:throw new Error(`Unknown texture filter: ${String(t)}`)}}static toPixiTextureWrap(t){switch(t){case ur.ClampToEdge:return an.CLAMP;case ur.MirroredRepeat:return an.MIRRORED_REPEAT;case ur.Repeat:return an.REPEAT;default:throw new Error(`Unknown texture wrap: ${String(t)}`)}}static toPixiBlending(t){switch(t){case Vr.Normal:return dt.NORMAL;case Vr.Additive:return dt.ADD;case Vr.Multiply:return dt.MULTIPLY;case Vr.Screen:return dt.SCREEN;default:throw new Error(`Unknown blendMode: ${String(t)}`)}}};x(Kn,"textureMap",new Map);let La=Kn;const Zn=class Zn extends Ll{constructor(){const t=new Sp;t.getBuffer("aVertexPosition").static=!1,t.getBuffer("aTextureCoord").static=!1;const i=new Ch(gt.EMPTY);super(t,i);x(this,"name","");x(this,"warnedTwoTint",!1)}updateFromSpineData(t,i,n,r,a,o,h,l){var v,b;this.texture=t.texture;const c=a/(l?12:8)*2,u=this.geometry.getBuffer("aTextureCoord");((v=u.data)==null?void 0:v.length)!==c&&(u.data=new Float32Array(c));const d=this.geometry.getBuffer("aVertexPosition");((b=d.data)==null?void 0:b.length)!==c&&(d.data=new Float32Array(c));let f=0,p=u.data,m=d.data;for(let y=0;ynew Im);x(this,"beforeUpdateWorldTransforms",()=>{});x(this,"afterUpdateWorldTransforms",()=>{});x(this,"_autoUpdate",!1);x(this,"_ticker",ds.shared);x(this,"meshesCache",new Map);x(this,"lightColor",new _t);x(this,"darkColor",new _t);x(this,"_boundsProvider");x(this,"_boundsPoint",new Ut);x(this,"_boundsSpineID",-1);x(this,"_boundsSpineDirty",!0);x(this,"slotsObject",new Map);x(this,"verticesCache",Ge.newFloatArray(1024));x(this,"clippingSlotToPixiMasks",{});x(this,"currentClippingSlot");const n=t instanceof Bh?t:t.skeletonData;this.skeleton=new Cp(n);const r=new hR(n);this.state=new rR(r),(t==null?void 0:t.darkTint)!==void 0||(i==null?void 0:i.slotMeshFactory)===void 0?(this.darkTint=(t==null?void 0:t.darkTint)===void 0?this.skeleton.slots.some(a=>!!a.data.darkColor):t==null?void 0:t.darkTint,this.darkTint&&(this.slotMeshFactory=()=>new vl)):this.initializeMeshFactory(i==null?void 0:i.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??ds.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 i=this.slotMeshFactory();i instanceof vl&&(this.darkTint=!0),i.destroy()}else for(let i=0;inew vl,this.darkTint=!0;break}}update(t){this.internalUpdate(0,t)}internalUpdate(t,i){this.hasNeverUpdated=!1;const n=i??this._ticker.deltaMS/1e3;this.state.update(n),this.state.apply(this.skeleton),this.beforeUpdateWorldTransforms(this),this.skeleton.update(n),this.skeleton.updateWorldTransform(Br.update),this.afterUpdateWorldTransforms(this)}updateTransform(){var t;this.renderMeshes(),this.sortChildren(),(t=this.debug)==null||t.renderDebug(this),super.updateTransform()}destroy(t){var i;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)(i=this.clippingSlotToPixiMasks[n].mask)==null||i.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 i=this.meshesCache.get(t);return i.visible=!0,i}else{let i=this.slotMeshFactory();return this.addChild(i),this.meshesCache.set(t,i),i}}getSlotFromRef(t){let i;if(typeof t=="number"?i=this.skeleton.slots[t]:typeof t=="string"?i=this.skeleton.findSlot(t):i=t,!i)throw new Error(`No slot found with the given slot reference: ${t}`);return i}addSlotObject(t,i,n){var o;let r=this.getSlotFromRef(t);const a=(o=this.slotsObject.get(r))==null?void 0:o.container;if(!(a&&a===i)){for(const[h,{container:l}]of this.slotsObject)if(h!==r&&l===i){this.removeSlotObject(h,i);break}a&&this.removeChild(a),this.slotsObject.set(r,{container:i,followAttachmentTimeline:(n==null?void 0:n.followAttachmentTimeline)||!1,followSlotColor:(n==null?void 0:n.followSlotColor)||!1}),this.addChild(i)}}getSlotObject(t){const i=this.slotsObject.get(this.getSlotFromRef(t));return i?i.container:void 0}removeSlotObject(t,i){var a;let n=this.getSlotFromRef(t),r=(a=this.slotsObject.get(n))==null?void 0:a.container;r&&(i&&i!==r||(this.removeChild(r),this.slotsObject.delete(n)))}removeSlotObjects(){for(const[,t]of this.slotsObject)t.container.removeFromParent();this.slotsObject.clear()}updateSlotObject(t,i,n){const{container:r,followAttachmentTimeline:a}=t,o=a?!!i.attachment:!0;if(r.visible=this.skeleton.drawOrder.includes(i)&&o,r.visible){let h=i.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*i.color.a,t.followSlotColor&&this.setSlotObjectTint(r,255*this.skeleton.color.r*i.color.r<<16|255*this.skeleton.color.g*i.color.g<<8|255*this.skeleton.color.b*i.color.b)}}setSlotObjectTint(t,i){const n=t;"tint"in n&&(n.tint=i);for(const r of n.children??[])this.setSlotObjectTint(r,i)}updateAndSetPixiMask(t,i){var o,h;const n=t.attachment;if(n&&n instanceof _o){const l=(o=this.clippingSlotToPixiMasks)[h=t.data.name]||(o[h]={slot:t,vertices:new Array});l.maskComputed=!1,this.currentClippingSlot=l;return}let r=this.currentClippingSlot;const a=this.slotsObject.get(t);if(r&&a){let l=r.mask;if(l||(l=$v.obtain(),r.mask=l,this.addChild(l)),!r.maskComputed){let c=r.slot,u=c.attachment;r.maskComputed=!0;const d=u.worldVerticesLength,f=r.vertices;u.computeWorldVertices(c,0,d,f,0,2),l.clear().lineStyle(0).beginFill(0).drawPolygon(f).endFill()}a.container.mask=l}else a!=null&&a.container.mask&&(a.container.mask=null);if(r&&r.slot.attachment.endSlot==t.data&&(this.currentClippingSlot=void 0),i){for(const l in this.clippingSlotToPixiMasks){const c=this.clippingSlotToPixiMasks[l];(!(c.slot.attachment instanceof _o)||!c.maskComputed)&&c.mask&&(this.removeChild(c.mask),$v.free(c.mask),c.mask=void 0)}this.currentClippingSlot=void 0}}renderMeshes(){var r,a;this.resetMeshes();let t=null,i=null;const n=this.skeleton.drawOrder;for(let o=0,h=n.length,l=0;o>1)*p,b>this.verticesCache.length&&(this.verticesCache=Ge.newFloatArray(b)),y.computeWorldVertices(c,0,y.worldVerticesLength,this.verticesCache,0,p),t=y.triangles,i=y.uvs,v=(a=y.region)==null?void 0:a.texture}else if(m instanceof _o){Yt.clipper.clipStart(c,m);continue}else{this.hasMeshForSlot(c)&&(this.getMeshForSlot(c).visible=!1),Yt.clipper.clipEndWithSlot(c);continue}if(v!=null){const w=c.bone.skeleton.color,A=c.color,T=w.a*A.a*g.a;this.lightColor.set(w.r*A.r*g.r,w.g*A.g*g.g,w.b*A.b*g.b,T),c.darkColor!=null?this.darkColor.set(c.darkColor.r,c.darkColor.g,c.darkColor.b,1):this.darkColor.set(0,0,0,1);let _,R,P,F;if(Yt.clipper.isClipping())Yt.clipper.clipTriangles(this.verticesCache,t,t.length,i,this.lightColor,this.darkColor,f),_=Yt.clipper.clippedVertices,R=_.length,P=Yt.clipper.clippedTriangles,F=P.length;else{const k=this.verticesCache;for(let B=2,D=0,U=b;Bnew ys);Cp.yDown=!0;const Fc="spineTextureAtlasLoader",rP={extension:He.Asset,resolver:{test:s=>bs(s,".atlas"),parse:s=>{var t,i;const e=s.split(".");return{resolution:parseFloat(((i=(t=We.RETINA_PREFIX)==null?void 0:t.exec(s))==null?void 0:i[1])??"1"),format:e[e.length-2],src:s}}},loader:{name:Fc,extension:{type:He.LoadParser,priority:Is.Normal,name:Fc},test(s){return bs(s,".atlas")},async load(s){const e=await We.ADAPTER.fetch(s);if(!e.ok)throw new Error(`[${Fc}] Failed to fetch ${s}: ${e.status} ${e.statusText}`);return await e.text()},testParse(s,e){const t=bs(e.src,".atlas"),i=typeof s=="string",n=e.loadParser===Fc;return Promise.resolve((t||n)&&i)},unload(s){s.dispose()},async parse(s,e,t){var h;const i=e.data||{};let n=wi.dirname(e.src);n&&n.lastIndexOf("/")!==n.length-1&&(n+="/");const r=new iw(s);if(i.images instanceof yt||typeof i.images=="string"){const l=i.images;i.images={},i.images[r.pages[0].name]=l}const a=[];let o=!0;for(const l of t.parsers)if(l.name=="loadTextures"){o=(h=l.config)==null?void 0:h.preferCreateImageBitmap;break}Fn.setPreferences({preferCreateImageBitmap:!1});for(const l of r.pages){const c=l.name,u=i!=null&&i.images?i.images[c]:void 0;if(u instanceof yt)l.setTexture(La.from(u));else{const d=u??wi.normalize([...n.split(wi.sep),c].join(wi.sep)),f={src:Mh(d,e.src),data:{...i.imageMetadata,alphaMode:l.pma?Ni.PMA:Ni.UNPACK}},p=t.load(f).then(m=>{l.setTexture(La.from(m.baseTexture))});a.push(p)}}return await Promise.all(a),Fn.setPreferences({preferCreateImageBitmap:o}),r}}};tt.add(rP);const Oc="spineSkeletonLoader";function aP(s){return s.hasOwnProperty("bones")}function oP(s){return s instanceof Uint8Array}const lP={extension:He.Asset,loader:{name:Oc,extension:{type:He.LoadParser,priority:Is.Normal,name:Oc},test(s){return bs(s,".skel")},async load(s){const e=await We.ADAPTER.fetch(s);if(!e.ok)throw new Error(`[${Oc}] Failed to fetch ${s}: ${e.status} ${e.statusText}`);return new Uint8Array(await e.arrayBuffer())},testParse(s,e){const t=bs(e.src,".json")&&aP(s),i=bs(e.src,".skel")&&oP(s),n=e.loadParser===Oc;return Promise.resolve(t||i||n)}}};tt.add(lP);class cP extends Nn{constructor(t=!1){super();x(this,"_buffer");x(this,"_indexBuffer");this._buffer=new oi(void 0,t,!1),this._indexBuffer=new oi(void 0,t,!0),this.addAttribute("aVertexPosition",this._buffer,2,!1,et.FLOAT).addAttribute("aTextureCoord",this._buffer,2,!1,et.FLOAT).addAttribute("aColor",this._buffer,4,!0,et.UNSIGNED_BYTE).addAttribute("aDarkColor",this._buffer,4,!0,et.UNSIGNED_BYTE).addAttribute("aTextureId",this._buffer,1,!0,et.FLOAT).addIndex(this._indexBuffer)}}const hP=` 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; } `,uP=` 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 pw extends Cr{constructor(e){super(e),this.shaderGenerator=new ab(hP,uP),this.geometryClass=cP,this.vertexSize=7}packInterleavedGeometry(e,t,i,n,r){const{uint32View:a,float32View:o}=t,h=n/this.vertexSize,l=e.uvs,c=e.indices,u=e.vertexData,d=e._texture.baseTexture._batchLocation,f=Math.min(e.worldAlpha,1),p=jt.shared.setValue(e._tintRGB).toPremultiplied(f,!0),m=jt.shared.setValue(e._darkTintRGB).premultiply(f,!0).toPremultiplied(1,!1);for(let g=0;g0){let a=function(l){return Promise.all(l.map(c=>Promise.resolve(c).then(u=>({status:"fulfilled",value:u}),u=>({status:"rejected",reason:u}))))};document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),h=(o==null?void 0:o.nonce)||(o==null?void 0:o.getAttribute("nonce"));n=a(t.map(l=>{if(l=gP(l),l in Gv)return;Gv[l]=!0;const c=l.endsWith(".css"),u=c?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${l}"]${u}`))return;const d=document.createElement("link");if(d.rel=c?"stylesheet":pP,c||(d.as="script"),d.crossOrigin="",d.href=l,h&&d.setAttribute("nonce",h),document.head.appendChild(d),c)return new Promise((f,p)=>{d.addEventListener("load",f),d.addEventListener("error",()=>p(new Error(`Unable to preload CSS for ${l}`)))})}))}function r(a){const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=a,window.dispatchEvent(o),!o.defaultPrevented)throw a}return n.then(a=>{for(const o of a||[])o.status==="rejected"&&r(o.reason);return e().catch(r)})};async function vw(){const[s,e]=await Promise.all([Hv(()=>import("./index-BUbc0qUx.js"),[]),Hv(()=>import("./index-B1oGFzi8.js"),__vite__mapDeps([0,1]))]);return{core:s,pixi:e}}async function vP(s,e,t){const{core:i,pixi:n}=await vw(),r=new i.TextureAtlas(e);return Ip(r,t,n.SpineTexture),{skeletonData:new i.SkeletonJson(new i.AtlasAttachmentLoader(r)).readSkeletonData(s),SpineClass:n.Spine}}async function yP(s,e,t){const{core:i,pixi:n}=await vw(),r=new i.TextureAtlas(e);return Ip(r,t,n.SpineTexture),{skeletonData:new i.SkeletonBinary(new i.AtlasAttachmentLoader(r)).readSkeletonData(s),SpineClass:n.Spine}}function Lr(s,e,t){const i=Number(s[e]);return Number.isFinite(i)?i:t}function xs(s,e,t,i){s[e]==null&&(s[e]=Lr(s,t,i))}function Rp(s,e,t){if(typeof s.curve!="number")return;const i=Lr(s,"time",0),r=Lr(e,"time",0)-i,a=s.curve,o=Lr(s,"c2",0),h=Lr(s,"c3",1),l=Lr(s,"c4",1);s.curve=t.flatMap(([c,u])=>[i+r*a,c+(u-c)*o,i+r*h,c+(u-c)*l]),delete s.c2,delete s.c3,delete s.c4}function Yr(s,e){if(Array.isArray(s))for(let t=0;t[Lr(i,r,a),Lr(n,r,a)]))}}function xP(s){if(Array.isArray(s))for(let e=0;eNumber.parseInt(i.slice(r,r+2),16)/255);return e?n:n.slice(0,3)}function jv(s,e){if(Array.isArray(s))for(let t=0;t[o,a[h]]))}}function bP(s){for(const e of s.bones||[])e.inherit==null&&e.transform!=null&&(e.inherit=e.transform);for(const e of s.transform||[])xs(e,"mixRotate","rotateMix",1),xs(e,"mixX","translateMix",1),e.mixY==null&&(e.mixY=e.mixX),xs(e,"mixScaleX","scaleMix",1),e.mixScaleY==null&&(e.mixScaleY=e.mixScaleX),xs(e,"mixShearY","shearMix",1);for(const e of s.path||[])xs(e,"mixRotate","rotateMix",1),xs(e,"mixX","translateMix",1),e.mixY==null&&(e.mixY=e.mixX)}function wP(s){for(const e of s.skins||[])for(const t of Object.values(e.attachments||{}))for(const i of Object.values(t||{}))i.parent!=null&&i.timelines==null&&i.deform!=null&&(i.timelines=i.deform)}function SP(s){for(const e of Object.values(s.slots||{}))e.color&&!e.rgba&&(e.rgba=e.color,delete e.color),e.twoColor&&!e.rgba2&&(e.rgba2=e.twoColor,delete e.twoColor),jv(e.rgba,!1),jv(e.rgba2,!0)}function MP(s){for(const e of Object.values(s.bones||{})){for(const t of e.rotate||[])xs(t,"value","angle",0);Yr(e.rotate,[{key:"value",fallback:0}]),Yr(e.translate,[{key:"x",fallback:0},{key:"y",fallback:0}]),Yr(e.scale,[{key:"x",fallback:1},{key:"y",fallback:1}]),Yr(e.shear,[{key:"x",fallback:0},{key:"y",fallback:0}])}}function _P(s){for(const e of Object.values(s.ik||{}))Yr(e,[{key:"mix",fallback:1},{key:"softness",fallback:0}])}function TP(s){for(const e of Object.values(s.transform||{})){for(const t of e)xs(t,"mixRotate","rotateMix",1),xs(t,"mixX","translateMix",1),t.mixY==null&&(t.mixY=t.mixX),xs(t,"mixScaleX","scaleMix",1),t.mixScaleY==null&&(t.mixScaleY=t.mixScaleX),xs(t,"mixShearY","shearMix",1);Yr(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 AP(s){for(const e of Object.values(s.path||{})){for(const i of["position","spacing"]){const n=e[i];for(const r of n||[])xs(r,"value",i,0);Yr(n,[{key:"value",fallback:0}])}const t=e.mix;for(const i of t||[])xs(i,"mixRotate","rotateMix",1),xs(i,"mixX","translateMix",1),i.mixY==null&&(i.mixY=i.mixX);Yr(t,[{key:"mixRotate",fallback:1},{key:"mixX",fallback:1},{key:"mixY",fallback:1}])}}function EP(s){if(!s.deform)return;const e=s.attachments||(s.attachments={});for(const[t,i]of Object.entries(s.deform)){const n=e[t]||(e[t]={});for(const[r,a]of Object.entries(i)){const o=n[r]||(n[r]={});for(const[h,l]of Object.entries(a)){const c=o[h]||(o[h]={});c.deform=l,xP(l)}}}delete s.deform}function yw(s){bP(s),wP(s);for(const e of Object.values(s.animations||{}))SP(e),MP(e),_P(e),TP(e),AP(e),EP(e),!e.drawOrder&&e.draworder&&(e.drawOrder=e.draworder);return s}function CP(s){return s.replace(/\\/g,"/").split("/").pop()||s}async function IP(s){const e=await Promise.all(s.map(async t=>{const i=URL.createObjectURL(t);try{return[CP(t.name).toLowerCase(),await gt.fromURL(i)]}finally{URL.revokeObjectURL(i)}}));return new Map(e)}function RP(s){const e=new Map;return s.bones.map(t=>{var r;const i=((r=t.parent)==null?void 0:r.name)||null,n=i?(e.get(i)||0)+1:0;return e.set(t.name,n),{name:t.name,parent:i,depth:n}})}async function xw(s,e,t){var a;if(!/\.(json|skel)$/i.test(s.name))throw new Error("Spine 数据仅支持 .json 或 .skel");if(!/\.atlas$/i.test(e.name))throw new Error("图集文件仅支持 .atlas");if(!t.length)throw new Error("请至少选择一张纹理图片");const i=await e.text(),n=await IP(t),r=[...n.values()];try{let o,h,l=null,c;if(/\.skel$/i.test(s.name)){const u=await s.arrayBuffer();try{({skeletonData:o,SpineClass:h}=await yP(u,i,n)),c="4.3"}catch(d){try{({skeletonData:o,SpineClass:h}=mP(u,i,n)),c="4.2"}catch(f){const p=d instanceof Error?d.message:String(d),m=f instanceof Error?f.message:String(f);throw new Error(`Spine 二进制解析失败(4.3:${p};旧版:${m})`)}}l=Ph(o.version)}else{let u;try{u=JSON.parse(await s.text())}catch{throw new Error("Spine JSON 文件格式无效")}if(l=Ph((a=u==null?void 0:u.skeleton)==null?void 0:a.spine),!l)throw new Error(`Spine JSON 版本不受支持,仅支持 ${Mm()}`);c=jI(l),l==="3.8"&&yw(u);const d=c==="4.3"?await vP(u,i,n):fP(u,i,n);o=d.skeletonData,h=d.SpineClass}if(!l)throw new Error(`Spine 数据版本不受支持,仅支持 ${Mm()}`);return{skeletonData:o,textures:r,runtimeVersion:c,SpineClass:h,dataVersion:l,animations:o.animations.map(u=>({name:u.name,duration:u.duration})),bones:RP(o)}}catch(o){for(const h of r)h.destroy(!0);throw o}}function Jc(s){return new Promise((e,t)=>{const i=new FileReader;i.onload=()=>e(String(i.result||"")),i.onerror=()=>t(i.error),i.readAsDataURL(s)})}async function PP(s,e,t){return{skeleton:{name:s.name,dataUrl:await Jc(s)},atlas:{name:e.name,dataUrl:await Jc(e)},textures:await Promise.all(t.map(async i=>({name:i.name,dataUrl:await Jc(i)})))}}async function _f(s){const e=await fetch(s.dataUrl);if(!e.ok)throw new Error(`无法读取内嵌 Spine 文件:${s.name}`);return new File([await e.blob()],s.name)}async function kP(s){return{skeleton:await _f(s.skeleton),atlas:await _f(s.atlas),textures:await Promise.all(s.textures.map(_f))}}const bw="SpineParticle.EditorConfig",ww=1;function Sw(s){return{backgroundX:s.backgroundX,backgroundY:s.backgroundY,backgroundOpacity:s.backgroundOpacity,backgroundImageName:s.backgroundImageName,backgroundImageData:s.backgroundImageData,showGrid:s.showGrid,exportSettings:hi(s.exportSettings)}}function FP(s){return JSON.parse(JSON.stringify(s,(e,t)=>{if(!(e==="texture"||e==="trailTexture"||e==="frames"))return t}))}function Mw(s){const e=hi(s);return delete e.tags,delete e.selectedTag,e}function OP(s){const e=Sw(s.settings);return FP({format:bw,version:ww,savedAt:new Date().toISOString(),editor:hi(s.editor),settings:e,timeline:{fps:s.timeline.fps,loop:s.timeline.loop,playbackStart:s.timeline.playbackStart,playbackEnd:s.timeline.playbackEnd,animations:[...s.timeline.animations]},selection:{type:s.activeObjectType,id:s.activeObjectId},scene:{systems:s.systems.map(t=>({...hi(t),frames:void 0})),colliders:s.colliders.map(Mw),paths:hi(s.paths),spines:hi(s.spines)}})}function BP(){return`SpineParticle-${new Date().toISOString().replace(/[-:]/g,"").replace(/\.\d{3}Z$/,"").replace("T","-")}.json`}function _w(s){const e=OP(s),t=new Blob([JSON.stringify(e,null,2)],{type:"application/json;charset=utf-8"}),i=URL.createObjectURL(t),n=document.createElement("a");return n.href=i,n.download=BP(),document.body.appendChild(n),n.click(),n.remove(),setTimeout(()=>URL.revokeObjectURL(i),0),e}function Tw(s){let e;try{e=JSON.parse(s)}catch{throw new Error("配置文件不是有效的 JSON")}const t=e;if(t.format!==bw)throw new Error("不是 SpineParticle 编辑器配置文件");if(t.version!==ww)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 LP(s){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 a=e.get(r);return a||(a=gt.fromURL(r).then(o=>Dr(o)),e.set(r,a)),a},i=await t("/images/star.png");await Promise.all(s.map(async n=>{var a;const r=Wr(n.config);r.texture=i,await Promise.all(r.imageResources.map(async o=>{o.texture=await t(o.previewUrl||"/images/star.png"),await Promise.all(o.sequenceFrames.map(async h=>{h.texture=await t(h.previewUrl||o.previewUrl||"/images/star.png")}))})),await Promise.all(r.trailResources.map(async o=>{o.texture=await t(o.previewUrl||"/images/trail.png")})),r.trailTexture=((a=r.trailResources[0])==null?void 0:a.texture)||null,n.frames=[]}))}async function DP(s){const e=new Map;try{for(const t of s){if(!t.sourceBundle)continue;const i=await kP(t.sourceBundle);e.set(t.id,await xw(i.skeleton,i.atlas,i.textures))}return e}catch(t){for(const i of e.values())for(const n of i.textures)n.destroy(!0);throw t}}function NP(s,e){const t=(e==null?void 0:e.type)||"particle",i=Number(e==null?void 0:e.id)||0;(t==="particle"?s.systems.some(r=>r.id===i):t==="collision"?s.colliders.some(r=>r.id===i):t==="path"?s.paths.some(r=>r.id===i):s.spines.some(r=>r.id===i))?s.selectSceneObject(t,i):s.systems[0]?s.selectSceneObject("particle",s.systems[0].id):s.colliders[0]?s.selectSceneObject("collision",s.colliders[0].id):s.paths[0]?s.selectSceneObject("path",s.paths[0].id):s.spines[0]?s.selectSceneObject("spine",s.spines[0].id):(s.activeObjectType="particle",s.activeObjectId=0,s.activeId=0)}async function UP(s,e){var c,u,d,f,p,m,g;const t=Tw(JSON.stringify(e)),i=hi(t.scene.systems),n=t.scene.colliders.map(Mw),r=hi(t.scene.paths),a=hi(t.scene.spines);for(const v of a)v.sourceBundle==null&&(v.sourceBundle=null),v.dataVersion==null&&(v.dataVersion="");await LP(i);const o=await DP(a),h=new Map(s.spines.map(v=>[v.id,v.assetVersion]));for(const v of s.spines)ql(v.id);s.systems=i,s.colliders=n,s.paths=r,s.spines=a,Object.assign(s.editor,hi(t.editor||{}));const l=t.settings;if(l)for(const v of["backgroundX","backgroundY","backgroundOpacity","backgroundImageName","backgroundImageData","showGrid"])Object.prototype.hasOwnProperty.call(l,v)&&(s.settings[v]=l[v]);s.settings.exportSettings=m1((c=t.settings)==null?void 0:c.exportSettings),s.settings.undoLimit=Math.min(200,Math.max(1,Math.round(Number(s.settings.undoLimit)||20))),s.timeline.fps=Math.max(1,Math.round(Number((u=t.timeline)==null?void 0:u.fps)||30)),s.timeline.loop=((d=t.timeline)==null?void 0:d.loop)!==!1,s.timeline.animations=Array.isArray((f=t.timeline)==null?void 0:f.animations)&&t.timeline.animations.length?[...new Set(t.timeline.animations.filter(v=>typeof v=="string"&&v.trim()).map(v=>v.trim()))]:["animation"];for(const v of s.spines){const b=o.get(v.id);if(v.assetVersion=Math.max(Number(v.assetVersion)||0,h.get(v.id)||0)+1,!b){v.status="empty",v.error=v.skeletonFileName?"配置未包含可复用的 Spine 原始资源":"",v.animations=[],v.bones=[],v.selectedAnimation="";continue}Au(v.id,b),v.dataVersion=b.dataVersion,v.animations=b.animations,v.bones=b.bones,b.animations.some(y=>y.name===v.selectedAnimation)||(v.selectedAnimation=((p=b.animations[0])==null?void 0:p.name)||""),v.status="ready",v.error=""}s.syncSceneSequences(),NP(s,t.selection),s.timeline.playbackStart=Math.max(0,Math.floor(Number((m=t.timeline)==null?void 0:m.playbackStart)||0)),s.timeline.playbackEnd=Math.max(1,Math.floor(Number((g=t.timeline)==null?void 0:g.playbackEnd)||Number.MAX_SAFE_INTEGER)),s.timeline.frame=0,s.timeline.recorded=!1,s.timeline.playing=!0;for(const v of s.systems)s.timeline.animations.includes(v.animation)||(v.animation=s.timeline.animations[0]);return s.recalcTotalFrames(),s.timeline.frame=s.timeline.playbackStart,t}async function Aw(s,e){return UP(s,Tw(e))}async function XP(s,e){if(!/\.json$/i.test(e.name))throw new Error("请选择 .json 配置文件");return Aw(s,await e.text())}const Iu=Da({undoCount:0});let Uh=null,nr=null,$r=[],Zo=null,rr=null,Xh=!1;function Pp(s){return{systems:s.systems.map(t=>{const i=hi(t);return i.frames=void 0,i}),colliders:hi(s.colliders),paths:hi(s.paths),spines:hi(s.spines),animations:[...s.timeline.animations],settings:Sw(s.settings)}}function kp(s){return JSON.stringify(s,(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 Ew(s,e=Pp(s),t=kp(e)){const i=new Map;for(const n of e.spines){const r=GI(n.id);r&&i.set(n.id,r)}return{data:e,signature:t,spineAssets:i}}function Vh(s){if(s){for(const e of s.spineAssets.values())YI(e);s.spineAssets.clear()}}function Cw(s){for(;$r.length>s;)Vh($r.shift()||null);Iu.undoCount=$r.length}function Iw(){const s=Uh;if(!s||!nr||Xh)return;const e=Pp(s),t=kp(e);t!==nr.signature&&($r.push(nr),nr=Ew(s,e,t),Cw(s.settings.undoLimit))}function VP(){Xh||(rr&&clearTimeout(rr),rr=setTimeout(()=>{rr=null,Iw()},250))}function YP(s){const e=s.activeObjectId;return s.activeObjectType==="particle"?s.systems.some(t=>t.id===e):s.activeObjectType==="collision"?s.colliders.some(t=>t.id===e):s.activeObjectType==="path"?s.paths.some(t=>t.id===e):s.spines.some(t=>t.id===e)}function $P(s){var t,i;if(!YP(s)){const n=s.systems[0],r=s.colliders[0],a=s.paths[0],o=s.spines[0];n?(s.activeObjectType="particle",s.activeObjectId=n.id):r?(s.activeObjectType="collision",s.activeObjectId=r.id):a?(s.activeObjectType="path",s.activeObjectId=a.id):(s.activeObjectType="spine",s.activeObjectId=(o==null?void 0:o.id)||0)}const e=s.activeObjectType==="particle"?s.systems.find(n=>n.id===s.activeObjectId):s.systems.find(n=>n.id===s.activeId);s.activeId=(e==null?void 0:e.id)||((t=s.systems[0])==null?void 0:t.id)||0,s.timeline.animation=(e==null?void 0:e.animation)||((i=s.systems[0])==null?void 0:i.animation)||s.timeline.animations[0]||"animation"}function GP(s,e){const t=nr;Xh=!0;try{for(const i of s.spines)ql(i.id);s.systems=hi(e.data.systems),s.colliders=hi(e.data.colliders),s.paths=hi(e.data.paths),s.spines=hi(e.data.spines),s.timeline.animations=[...e.data.animations],Object.assign(s.settings,hi(e.data.settings));for(const[i,n]of e.spineAssets)Au(i,n);for(const i of s.systems)i.frames=[];s.timeline.recorded=!1,s.timeline.playing=!1,$P(s),s.recalcTotalFrames(),nr=e}finally{Xh=!1,Vh(t)}}function HP(s){if(!(Uh===s&&Zo)){Zo==null||Zo(),rr&&clearTimeout(rr),Vh(nr);for(const e of $r)Vh(e);$r=[],Uh=s,nr=Ew(s),Iu.undoCount=0,Zo=fs(()=>kp(Pp(s)),VP,{flush:"post"})}}function jP(s,e){const t=Math.min(200,Math.max(1,Math.round(Number(e)||20)));s.settings.undoLimit=t,Cw(t)}function Tf(){const s=Uh;if(!s||!nr)return!1;rr&&(clearTimeout(rr),rr=null),Iw();const e=$r.pop();return e?(GP(s,e),Iu.undoCount=$r.length,!0):!1}function WP(s){const e=s instanceof HTMLElement?s:null;return!!(e!=null&&e.closest('input, textarea, select, [contenteditable="true"]'))}function zP(s){function e(i){var r;const n=i.target instanceof Node?i.target:null;s.canvasFocused.value=!!n&&!!((r=s.canvasElement.value)!=null&&r.contains(n))}function t(i){const n=i.key.toLowerCase();if((i.ctrlKey||i.metaKey)&&!i.altKey&&n==="s"){i.preventDefault(),i.stopPropagation(),s.save();return}if((i.ctrlKey||i.metaKey)&&!i.altKey&&n==="z"){i.preventDefault(),i.stopPropagation(),s.undo();return}if(i.ctrlKey||i.metaKey||i.altKey||WP(i.target))return;if(n==="d"){i.preventDefault(),s.togglePlay();return}if(n==="s"){i.preventDefault(),s.toStart();return}if(!s.canvasFocused.value)return;const r={q:"",w:"translate",e:"rotate",r:"scale"};n in r&&(i.preventDefault(),s.setTool(r[n]))}Kr(()=>{document.addEventListener("pointerdown",e,!0),window.addEventListener("keydown",t,!0)}),Gl(()=>{document.removeEventListener("pointerdown",e,!0),window.removeEventListener("keydown",t,!0)})}const qP={class:"help-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"help-title"},KP={class:"help-body"},ZP=["aria-expanded"],JP={class:"caret"},QP={class:"help-module-body"},ek=["aria-expanded"],tk={class:"caret"},ik={class:"help-module-body"},sk=["aria-expanded"],nk={class:"caret"},rk={class:"help-module-body"},ak=["aria-expanded"],ok={class:"caret"},lk={class:"help-module-body"},ck=["aria-expanded"],hk={class:"caret"},uk={class:"help-module-body"},dk=["aria-expanded"],fk={class:"caret"},mk={class:"help-module-body"},pk=["aria-expanded"],gk={class:"caret"},vk={class:"help-module-body"},yk=["aria-expanded"],xk={class:"caret"},bk={class:"help-module-body"},wk=["aria-expanded"],Sk={class:"caret"},Mk={class:"help-module-body"},_k=$s({__name:"HelpDialog",props:{show:{type:Boolean}},emits:["close"],setup(s,{emit:e}){const t=e,i=lt(Array.from({length:9},()=>!1));function n(){t("close")}function r(a){a.key==="Escape"&&n()}return Kr(()=>window.addEventListener("keydown",r)),$l(()=>window.removeEventListener("keydown",r)),(a,o)=>s.show?(ie(),ae("div",{key:0,class:"help-overlay",role:"presentation",onClick:bt(n,["self"])},[M("section",qP,[M("header",{class:"help-head"},[o[9]||(o[9]=M("div",null,[M("h2",{id:"help-title"},"使用说明"),M("p",null,"从创建粒子到保存、导出的快速入门")],-1)),M("button",{class:"help-close","aria-label":"关闭使用说明",title:"关闭 (Esc)",onClick:n},"✕")]),M("div",KP,[o[37]||(o[37]=Ts('

快速开始

  1. 创建对象:在左侧“场景对象”中用 +粒子 / +碰撞 / +路径 / +Spine 添加场景对象。
  2. 编辑粒子:选中某个粒子系统,依次调整“发射模式 → 发射器形状 → 粒子属性 → 外观与资源 → 修改器”。
  3. 查看效果:底部时间轴可播放、暂停、逐帧或拖动;修改任意参数后会自动重新计算。
  4. 保存与导出:用“保存配置”保留工程;“导出 Spine Json / images 包 / .spine 包”输出成品。

每个模块组标题右侧的“重置”可把该组参数恢复默认;系统设置会自动保存在当前浏览器。

常用操作

小眼睛
单独显示/隐藏对象;隐藏的粒子系统不会被导出。
+Copy
完整复制当前选中对象,方便对比不同参数。
背景图
上传参考图并调整位置和透明度,只用于画布预览。
系统设置
管理界面布局、辅助显示、刻度等,自动存入浏览器。
撤销/重做
Ctrl+Z 撤回一步;可达成的步数在系统设置中调整。
Spine 骨骼
在层级树搜索并选择骨骼,可用于粒子发射器跟随。

快捷键

Ctrl/⌘+Z撤回上一步
Ctrl/⌘+S保存配置
Q拖动画布
W位移工具
E旋转工具
R缩放工具
D播放 / 暂停
S回到第一帧

Q / W / E / R 需先点击画布;光标位于输入框时,单键快捷键不会触发。

功能模块详解
',3)),M("section",{class:Ze(["help-section help-module",{open:i.value[0]}])},[M("button",{type:"button",class:"help-module-head","aria-expanded":i.value[0]?"true":"false",onClick:o[0]||(o[0]=h=>i.value[0]=!i.value[0])},[o[10]||(o[10]=M("span",{class:"mnum"},"1",-1)),o[11]||(o[11]=M("span",{class:"mtitle"},"配置管理",-1)),M("span",JP,Xe(i.value[0]?"▾":"▸"),1)],8,ZP),ye(M("div",QP,[...o[12]||(o[12]=[Ts('
保存配置
把当前全部场景对象和参数保存为工程 JSON 文件(也支持 Ctrl+S)。
加载配置
选择本地配置文件,恢复完整工程。
预设
从下拉中选择已保存的预设快速套用;点击下拉即可刷新列表。
范围
配置只含对象与参数,不含“系统设置”;系统设置单独存于浏览器。
',1)])],512),[[Yi,i.value[0]]])],2),M("section",{class:Ze(["help-section help-module",{open:i.value[1]}])},[M("button",{type:"button",class:"help-module-head","aria-expanded":i.value[1]?"true":"false",onClick:o[1]||(o[1]=h=>i.value[1]=!i.value[1])},[o[13]||(o[13]=M("span",{class:"mnum"},"2",-1)),o[14]||(o[14]=M("span",{class:"mtitle"},"场景对象",-1)),M("span",tk,Xe(i.value[1]?"▾":"▸"),1)],8,ek),ye(M("div",ik,[...o[15]||(o[15]=[Ts('
粒子
核心对象。可设名称、位置 X/Y、偏移、旋转、缩放 X/Y,以及“随机种子”——相同种子可精确复现同一次效果。
碰撞
圆形/椭圆/矩形/多边形/自定义;启用开关、碰撞响应(物理弹跳/暂停/销毁)、弹性与摩擦,还可沿某条路径移动并带进度曲线。
路径
贝塞尔路径,可双击新建/删除锚点、拖手柄调曲线;内置圆/方/多边形/星形预设,支持闭合与颜色。
Spine
加载 .json+.atlas+.png 预览骨骼动画,可查看/搜索骨骼层级树,用于粒子“发射器跟随”。
通用
每个对象都有小眼睛显隐;“+Copy”可以复制当前对象;隐藏的粒子系统不会进入导出。
',1)])],512),[[Yi,i.value[1]]])],2),M("section",{class:Ze(["help-section help-module",{open:i.value[2]}])},[M("button",{type:"button",class:"help-module-head","aria-expanded":i.value[2]?"true":"false",onClick:o[2]||(o[2]=h=>i.value[2]=!i.value[2])},[o[16]||(o[16]=M("span",{class:"mnum"},"3",-1)),o[17]||(o[17]=M("span",{class:"mtitle"},"发射模式",-1)),M("span",nk,Xe(i.value[2]?"▾":"▸"),1)],8,sk),ye(M("div",rk,[...o[18]||(o[18]=[Ts('
持续
按“每秒发射数量”持续喷射;再分“常规持续”(发射时长)与“循环持续”(三段式:开始循环 / 纯循环 / 结束循环,可自动或自定义帧长,做到无缝衔接)。
爆发
一次性发射“单次数量”颗粒子。
延迟时间
粒子条左端位置,表示发射开始前的等待时间。
注意
循环持续模式不支持骨骼跟随和路径跟随;开关时会把跟随设置恢复默认。
',1)])],512),[[Yi,i.value[2]]])],2),M("section",{class:Ze(["help-section help-module",{open:i.value[3]}])},[M("button",{type:"button",class:"help-module-head","aria-expanded":i.value[3]?"true":"false",onClick:o[3]||(o[3]=h=>i.value[3]=!i.value[3])},[o[19]||(o[19]=M("span",{class:"mnum"},"4",-1)),o[20]||(o[20]=M("span",{class:"mtitle"},"发射器形状",-1)),M("span",ok,Xe(i.value[3]?"▾":"▸"),1)],8,ak),ye(M("div",lk,[...o[21]||(o[21]=[Ts('
形状
点 / 圆形 / 矩形 / 锥形 / 路径。
圆·锥
内半径与外半径,形成环形或锥形发射区;锥形额外有“锥形朝向”和“开口角度”。
矩形
“外框 − 内框”形成环带,可分别设置内外宽高。
路径
选一条场景路径作为出生线;出生分布可选等距固定或随机。
发射角度
固定 / 随机(基准角度 + 随机范围)/ 径向(圆、矩、锥中心向外)/ 垂直于路径 / 沿路径方向。
',1)])],512),[[Yi,i.value[3]]])],2),M("section",{class:Ze(["help-section help-module",{open:i.value[4]}])},[M("button",{type:"button",class:"help-module-head","aria-expanded":i.value[4]?"true":"false",onClick:o[4]||(o[4]=h=>i.value[4]=!i.value[4])},[o[22]||(o[22]=M("span",{class:"mnum"},"5",-1)),o[23]||(o[23]=M("span",{class:"mtitle"},"粒子属性",-1)),M("span",hk,Xe(i.value[4]?"▾":"▸"),1)],8,ck),ye(M("div",uk,[...o[24]||(o[24]=[M("dl",{class:"help-list"},[M("div",null,[M("dt",null,"初始参数"),M("dd",null,"生命周期、速度、缩放(统一或 X/Y 分离)、初始旋转(可跟随发射方向)。每个属性支持固定 / 随机 / 曲线三种取值。")]),M("div",null,[M("dt",null,"生命周期变化"),M("dd",null,"速度倍率、缩放倍率(统一/分离)、旋转速度,均可用“生命周期 → 倍率”曲线控制。")]),M("div",null,[M("dt",null,"曲线含义"),M("dd",null,"横轴为粒子生命周期 0→1,纵轴为倍率或对应数值。")])],-1)])],512),[[Yi,i.value[4]]])],2),M("section",{class:Ze(["help-section help-module",{open:i.value[5]}])},[M("button",{type:"button",class:"help-module-head","aria-expanded":i.value[5]?"true":"false",onClick:o[5]||(o[5]=h=>i.value[5]=!i.value[5])},[o[25]||(o[25]=M("span",{class:"mnum"},"6",-1)),o[26]||(o[26]=M("span",{class:"mtitle"},"外观与资源",-1)),M("span",fk,Xe(i.value[5]?"▾":"▸"),1)],8,dk),ye(M("div",mk,[...o[27]||(o[27]=[M("dl",{class:"help-list"},[M("div",null,[M("dt",null,"透明度"),M("dd",null,"曲线或固定;曲线模式可选“跟随导出 / 线性 / 贝塞尔”。")]),M("div",null,[M("dt",null,"图片资源"),M("dd",null,"“+”新增,可上传单图或序列帧;多张图片按权重随机。每张可调缩放、轴心、颜色(固定/随机/生命周期渐变)、混合模式(正常/相加/相乘/滤色)、独立透明度(关/固定/曲线)。")]),M("div",null,[M("dt",null,"序列帧"),M("dd",null,"播放方式:单次隐藏 / 单次定格 / 正向循环 / 反向循环,可设每秒帧数。")])],-1)])],512),[[Yi,i.value[5]]])],2),M("section",{class:Ze(["help-section help-module",{open:i.value[6]}])},[M("button",{type:"button",class:"help-module-head","aria-expanded":i.value[6]?"true":"false",onClick:o[6]||(o[6]=h=>i.value[6]=!i.value[6])},[o[28]||(o[28]=M("span",{class:"mnum"},"7",-1)),o[29]||(o[29]=M("span",{class:"mtitle"},"修改器",-1)),M("span",gk,Xe(i.value[6]?"▾":"▸"),1)],8,pk),ye(M("div",vk,[...o[30]||(o[30]=[Ts('
移动噪声
强度、波动范围、时间流速,让粒子轨迹产生抖动。
重力 / 风力
固定或随机强度、方向,以及生命周期内强度曲线。
力场
中心 X/Y、强度(正吸负斥)、半径、衰减(恒定/线性/反比)。
吸附
延迟后把粒子吸到指定点,到达范围即死亡;可直线或曲线。
拖尾
独立拖尾图片(多资源按权重)、旋转、拖尾骨骼数、拖尾比例;长度/宽度可固定或随机并支持放大;可加生命周期长度曲线与形状曲线;颜色/透明度可跟随粒子、固定或曲线。
发射器跟随
跟随某条路径(局部/世界、正/反向、进度曲线),或跟随 Spine 骨骼(选中的骨骼 + 偏移)。
碰撞 + 阻尼
选择场景中已启用的碰撞对象参与,并设置速度阻尼。
',1)])],512),[[Yi,i.value[6]]])],2),M("section",{class:Ze(["help-section help-module",{open:i.value[7]}])},[M("button",{type:"button",class:"help-module-head","aria-expanded":i.value[7]?"true":"false",onClick:o[7]||(o[7]=h=>i.value[7]=!i.value[7])},[o[31]||(o[31]=M("span",{class:"mnum"},"8",-1)),o[32]||(o[32]=M("span",{class:"mtitle"},"导出设置",-1)),M("span",xk,Xe(i.value[7]?"▾":"▸"),1)],8,yk),ye(M("div",bk,[...o[33]||(o[33]=[Ts('
图片路径
写入 Spine 的 images 路径,例如 ./images/。
Spine 版本
3.8 / 4.0 / 4.1 / 4.2 / 4.3。
关键帧曲线
线性或平滑贝塞尔;出生、死亡、突变仍使用阶跃关键帧。
导出 FPS
修改 FPS 会保持动画实际秒数不变;“不写 fps”只省略元数据。
其它
整数帧对齐、骨骼对象池、排除无内容动画。
导出按钮
“导出 Spine Json”生成骨骼动画文件;“导出 images 包”单独下载图片 ZIP;“导出 .spine 包”需要连接器。
',1)])],512),[[Yi,i.value[7]]])],2),M("section",{class:Ze(["help-section help-module help-connector",{open:i.value[8]}])},[M("button",{type:"button",class:"help-module-head","aria-expanded":i.value[8]?"true":"false",onClick:o[8]||(o[8]=h=>i.value[8]=!i.value[8])},[o[34]||(o[34]=M("span",{class:"mnum"},"9",-1)),o[35]||(o[35]=M("span",{class:"mtitle"},"连接器(Spine 连接器)使用说明",-1)),M("span",Sk,Xe(i.value[8]?"▾":"▸"),1)],8,wk),ye(M("div",Mk,[...o[36]||(o[36]=[Ts('

连接器用于把网页生成的 JSON 和图片,调用你电脑上已安装并激活的 Spine,转换成可编辑的 .spine 工程。

前置
电脑已安装并激活 Spine;并已启动连接器(桌面版 App,或运行“npm run connector”)。
网页端
导出区状态显示“连接器可用 · Spine 已就绪”后,点击“导出 .spine 包”。
首次授权
生产网站首次连接会显示“授权当前网站”;点击后在本机确认页核对完整来源(协议 + 域名 + 端口),再点“允许此网站”。授权一次后本机会保存白名单。本地 127.0.0.1:5173 默认允许。
路径设置
连接器自动检测 Spine 安装位置;检测不到时可在桌面窗口手动指定:Windows 选 Spine.com,macOS 选 Spine.app/Contents/MacOS/Spine。
下载结果
得到 ZIP 包,内含 .spine 工程和图片目录(如 images/star.png)。
版本
连接器按请求与 JSON 内的版本自动匹配 3.8~4.3,使用最新可用补丁。
安全
仅监听本机 127.0.0.1:27843;授权与白名单保存在连接器里;文件在临时目录转换后清理,并有大小限制。
',2)])],512),[[Yi,i.value[8]]])],2),o[38]||(o[38]=M("section",{class:"help-section help-export"},[M("h3",null,"配置与导出有什么区别?"),M("p",null,[M("b",null,"保存配置"),Qt("会保存编辑器中的全部对象和参数,之后可以继续修改;"),M("b",null,"导出 Spine Json"),Qt("只导出显示中的粒子系统,并把跟随、碰撞和拖尾结果烘焙为独立动画数据。")])],-1))])])])):Ve("",!0)}}),Gs=(s,e)=>{const t=s.__vccOpts||s;for(const[i,n]of e)t[i]=n;return t},Tk=Gs(_k,[["__scopeId","data-v-ae69ecd7"]]),Ak={class:"stage-wrap"},Ek={class:"topbar"},Ck=["disabled"],Ik={class:"tool-group"},Rk={class:"tool-group"},Pk={key:0,class:"background-panel"},kk=["disabled"],Fk=["title"],Ok={class:"background-position-row"},Bk={class:"background-opacity-row"},Lk={class:"zoom-pct"},Dk={key:0,class:"settings-panel"},Nk={class:"sp-head"},Uk={class:"sp-switch-row"},Xk={class:"sp-switch-control"},Vk={class:"sp-row"},Yk={class:"sp-chk"},$k={class:"sp-chk"},Gk={class:"sp-row"},Hk={class:"sp-row"},jk={class:"sp-chk"},Wk={class:"sp-chk"},zk={class:"sp-row"},qk={class:"sp-row"},Kk={class:"sp-row"},Zk={class:"sp-hex"},Jk={class:"sp-chk"},Qk={key:1,class:"hud"},eF={class:"hud-number hud-system-count"},tF={class:"hud-number hud-particle-count"},iF=$s({__name:"Stage",setup(s){const e=Kl(),t=lt(null),i=lt(null),n=lt(!1),r=lt(!1),a=lt(!1),o=lt(null),h=vt(()=>e.settings.backgroundImageName),l=lt(""),c=lt(!1);function u(H){l.value=l.value===H?"":H}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 d(){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))}zP({canvasElement:t,canvasFocused:c,undo:Tf,save:()=>_w(e),togglePlay:()=>e.togglePlay(),toStart:()=>e.toStart(),setTool:H=>{l.value=H}});let f=null,p=null,m=null,g=null,v=0,b=null,y=null,w=null,A=null,T=null,_=null,R=null,P=null,F=null,I=null,k=null,B=null,D=[],U=0,L=0,N=0,O=0,X=null,E=null;const V=new Map,q=new Map;let W=[];const J=new Map,K=new Set;let fe=!1;fs(()=>[e.activeObjectType,e.activeObjectId],()=>K.clear());async function me(){if(X&&E)return X;const[H,Y]=await Promise.all([gt.fromURL("/images/star.png"),gt.fromURL("/images/trail.png")]);return X=H,E=Y,X}function we(){p=new ji,f.stage.addChild(p),k=new ji,f.stage.addChild(k),m=new Zr(gt.EMPTY),m.anchor.set(.5),m.visible=!1,p.addChild(m),I=new ys,p.addChild(I),B=new nR,p.addChild(B.container),y=new ys,p.addChild(y),b=new ys,p.addChild(b),A=new ys,p.addChild(A),T=new ys,p.addChild(T),_=new ys,p.addChild(_),R=new ys,p.addChild(R),P=new ys,p.addChild(P),F=new ys,p.addChild(F),w=new ys,p.addChild(w)}function Ee(){r.value=!r.value,r.value&&(n.value=!1)}function pe(){a.value=!0,n.value=!1,r.value=!1}function Ae(){n.value=!n.value,n.value&&(r.value=!1)}function G(H){jP(e,Number(H.target.value))}async function Z(H){var ne;const Y=H.target,ee=(ne=Y.files)==null?void 0:ne[0];if(ee)try{e.settings.backgroundImageData=await Jc(ee),e.settings.backgroundImageName=ee.name}catch(ue){console.error("背景图加载失败",ue)}finally{Y.value=""}}async function z(H){const Y=++v;if(!H){m&&(m.texture=gt.EMPTY,m.visible=!1),g&&g.destroy(!0),g=null;return}try{const ee=await gt.fromURL(H);if(Y!==v||!m){ee.destroy(!0);return}const ne=g;g=ee,m.texture=ee,m.visible=!0,ne&&ne.destroy(!0)}catch(ee){console.error("背景图恢复失败",ee)}}function j(H=!0){e.settings.backgroundImageData="",e.settings.backgroundImageName="",o.value&&(o.value.value=""),H&&(e.settings.backgroundX=0,e.settings.backgroundY=0,e.settings.backgroundOpacity=1)}function te(H,Y=0){if(H<=0)return 1;const ee=Math.pow(10,Math.floor(Math.log10(H))),ne=[1,2,5,10,20,50,100];let ue=1;for(const ve of ne)if(ve*ee>=H){ue=ve*ee;break}return Math.max(ue,Y)}function he(){if(!I)return;const H=I;H.clear();const Y=e.settings;if(!Y.tickEnabled){for(const Se of D)Se.visible=!1;return}const ee=0,ne=0,ue=f.screen.width/e.editor.viewScale,ve=f.screen.height/e.editor.viewScale,_e=+("0x"+Y.axisColor.replace("#",""));H.lineStyle(1.5,_e,.35),H.moveTo(-ue,ne),H.lineTo(ue,ne),H.moveTo(ee,-ve),H.lineTo(ee,ve);const Me=e.editor.viewScale,be=te(50/Me),De=ue,Ie=ve,Le=Math.max(1,Y.tickWidth);if(Y.tickEnabled){for(let Se=0;Se<=ue;Se+=be){const at=Math.round(Se/be)*be;at!==0&&(H.lineStyle(Le,_e,.25),H.moveTo(at,ne-4),H.lineTo(at,ne+4),H.moveTo(-at,ne-4),H.lineTo(-at,ne+4))}for(let Se=0;Se<=ve;Se+=be)Math.round(Se/be)*be!==0&&(H.lineStyle(Le,_e,.25),H.moveTo(ee-4,Se),H.lineTo(ee+4,Se),H.moveTo(ee-4,-Se),H.lineTo(ee+4,-Se))}const Te=f.screen.width/2+e.editor.viewX,je=f.screen.height*.5+e.editor.viewY,rt=Y.axisFontSize,Je=+("0x"+Y.axisColor.replace("#",""));for(;D.length<64;){const Se=new Mp("",{fontFamily:"monospace",fontSize:rt,fill:Je});Se.anchor.set(.5,.5),k.addChild(Se),D.push(Se)}let nt=0;const Qe=Y.showAxisLabels&&Y.tickEnabled;for(let Se=0;Se<=ue;Se+=be){const at=Math.round(Se/be)*be;if(at===0||!Qe||at>De)continue;const Pe=D[nt++];if(!Pe)break;Pe.style.fontSize=rt,Pe.text=String(at),Pe.position.set(Te+at*Me,je+9),Pe.visible=!0;const Xt=D[nt++];if(!Xt)break;Xt.style.fontSize=rt,Xt.text=String(-at),Xt.position.set(Te-at*Me,je+9),Xt.visible=!0}for(let Se=0;Se<=ve;Se+=be){const at=Math.round(Se/be)*be;if(at===0||!Qe||at>Ie)continue;const Pe=D[nt++];if(!Pe)break;Pe.style.fontSize=rt,Pe.text=String(at),Pe.position.set(Te+8,je-Se*Me),Pe.visible=!0;const Xt=D[nt++];if(!Xt)break;Xt.style.fontSize=rt,Xt.text=String(-at),Xt.position.set(Te+8,je+Se*Me),Xt.visible=!0}for(;nt{e.editor.viewX=ne+(Me.clientX-Y),e.editor.viewY=ue+(Me.clientY-ee)},_e=()=>{window.removeEventListener("pointermove",ve),window.removeEventListener("pointerup",_e),window.removeEventListener("pointercancel",_e)};window.addEventListener("pointermove",ve),window.addEventListener("pointerup",_e),window.addEventListener("pointercancel",_e)}function ge(H,Y){const ee=t.value.getBoundingClientRect(),ne=Math.max(1e-4,e.editor.viewScale),ue=H-ee.left,ve=Y-ee.top;return{x:(ue-f.screen.width/2-e.editor.viewX)/ne,y:-(ve-f.screen.height*.5-e.editor.viewY)/ne}}function le(H,Y,ee){const ne=H.rotation*Math.PI/180,ue=Math.cos(ne),ve=Math.sin(ne),_e=Math.max(1e-4,Math.abs(H.scaleX??1)),Me=Math.max(1e-4,Math.abs(H.scaleY??1));return{x:H.x+ue*Y*_e-ve*ee*Me,y:H.y+ve*Y*_e+ue*ee*Me}}function Oe(H,Y,ee){const ne=H.rotation*Math.PI/180,ue=Math.cos(ne),ve=Math.sin(ne),_e=Math.max(1e-4,Math.abs(H.scaleX??1)),Me=Math.max(1e-4,Math.abs(H.scaleY??1)),be=Y-H.x,De=ee-H.y;return{x:(ue*be+ve*De)/_e,y:(-ve*be+ue*De)/Me}}function Fe(){if(e.activeObjectType!=="path")return null;const H=e.paths.find(Y=>Y.id===e.activeObjectId)||null;return(H==null?void 0:H.visible)===!1?null:H}function Be(H,Y,ee){if(H.points.length<2)return H.points.length;const ne=H.closed?H.points.length:H.points.length-1;let ue=H.points.length,ve=1/0;for(let _e=0;_eMath.hypot(Me.x-ne.x,Me.y-ne.y)<=ue);if(ve>=0){Y.points.splice(ve,1),K.clear();return}const _e=Be(Y,ne.x,ne.y);Y.points.splice(_e,0,{x:ne.x,y:ne.y,inX:0,inY:0,outX:0,outY:0}),K.clear(),K.add(_e)}function St(H){const Y=Fe();if(!Y||!Y.enabled)return!1;const ee=ge(H.clientX,H.clientY),ne=Oe(Y,ee.x,ee.y),ue=9/Math.max(.01,e.editor.viewScale);if(H.detail>=2){if(Y.points.findIndex(Ie=>Math.hypot(Ie.x-ne.x,Ie.y-ne.y)<=ue)>=0)return!0;const be={x:ne.x,y:ne.y,inX:0,inY:0,outX:0,outY:0},De=Be(Y,ne.x,ne.y);return Y.points.splice(De,0,be),K.clear(),K.add(De),fe=!0,At(Ie=>{const Le=ge(Ie.clientX,Ie.clientY),Te=Oe(Y,Le.x,Le.y);be.outX=Te.x-be.x,be.outY=Te.y-be.y,be.inX=-be.outX,be.inY=-be.outY}),!0}let ve=null;for(const Me of K){const be=Y.points[Me];be&&(Math.hypot(be.x+be.inX-ne.x,be.y+be.inY-ne.y)<=ue&&(ve={index:Me,side:"in"}),Math.hypot(be.x+be.outX-ne.x,be.y+be.outY-ne.y)<=ue&&(ve={index:Me,side:"out"}))}if(ve){const Me=Y.points[ve.index],be=ve.side==="in"?Math.hypot(Me.outX,Me.outY):Math.hypot(Me.inX,Me.inY);return At(Ie=>{const Le=ge(Ie.clientX,Ie.clientY),Te=Oe(Y,Le.x,Le.y),je=Te.x-Me.x,rt=Te.y-Me.y;if(ve.side==="in"?(Me.inX=je,Me.inY=rt):(Me.outX=je,Me.outY=rt),!Ie.altKey){const Je=Math.max(1e-4,Math.hypot(je,rt)),nt=Ie.shiftKey?Je:be;ve.side==="in"?(Me.outX=-je/Je*nt,Me.outY=-rt/Je*nt):(Me.inX=-je/Je*nt,Me.inY=-rt/Je*nt)}}),!0}const _e=Y.points.findIndex(Me=>Math.hypot(Me.x-ne.x,Me.y-ne.y)<=ue);if(_e>=0){if(H.altKey)return K.delete(_e),!0;H.ctrlKey||H.metaKey?K.add(_e):K.has(_e)||(K.clear(),K.add(_e));const Me=ne,be=[...K].map(Ie=>({index:Ie,x:Y.points[Ie].x,y:Y.points[Ie].y}));return At(Ie=>{const Le=ge(Ie.clientX,Ie.clientY),Te=Oe(Y,Le.x,Le.y);for(const je of be)Y.points[je.index].x=je.x+Te.x-Me.x,Y.points[je.index].y=je.y+Te.y-Me.y}),!0}if(H.altKey&&!H.ctrlKey&&!H.metaKey)return K.clear(),!0;if(H.ctrlKey||H.metaKey||H.altKey){const Me=ne,be=H.altKey,De=Ie=>{const Le=ge(Ie.clientX,Ie.clientY),Te=Oe(Y,Le.x,Le.y),je=Math.min(Me.x,Te.x),rt=Math.max(Me.x,Te.x),Je=Math.min(Me.y,Te.y),nt=Math.max(Me.y,Te.y);Y.points.forEach((Qe,Se)=>{Qe.x>=je&&Qe.x<=rt&&Qe.y>=Je&&Qe.y<=nt&&(be?K.delete(Se):K.add(Se))}),window.removeEventListener("pointerup",De),window.removeEventListener("pointercancel",De)};return window.addEventListener("pointerup",De),window.addEventListener("pointercancel",De),!0}return!1}function At(H){const Y=()=>{window.removeEventListener("pointermove",H),window.removeEventListener("pointerup",Y),window.removeEventListener("pointercancel",Y)};window.addEventListener("pointermove",H),window.addEventListener("pointerup",Y),window.addEventListener("pointercancel",Y)}function Et(H){if(e.activeObjectType!=="collision")return!1;const Y=e.colliders.find(nt=>nt.id===e.activeObjectId);if(!(Y!=null&&Y.enabled)||Y.visible===!1)return!1;const ee=ge(H.clientX,H.clientY),ne=Y.rotation*Math.PI/180,ue=Math.cos(ne),ve=Math.sin(ne),_e=Math.max(1e-4,Math.abs(Y.scaleX??1)),Me=Math.max(1e-4,Math.abs(Y.scaleY??1)),be=ee.x-Y.x,De=ee.y-Y.y,Ie=(ue*be+ve*De)/_e,Le=(-ve*be+ue*De)/Me;if(!(Y.shape==="circle"?Math.hypot(Ie,Le)<=Y.radius:Y.shape==="ellipse"?Math.hypot(Ie/Math.max(1,Y.radiusX),Le/Math.max(1,Y.radiusY))<=1:Math.abs(Ie)<=Y.width*.5&&Math.abs(Le)<=Y.height*.5))return!1;const je=Y.x,rt=Y.y,Je=ee;return At(nt=>{const Qe=ge(nt.clientX,nt.clientY);Y.x=je+Qe.x-Je.x,Y.y=rt+Qe.y-Je.y}),!0}function It(H){const Y=e.systems.find(De=>De.id===e.activeId);if((Y==null?void 0:Y.visible)===!1)return!1;const ee=Y==null?void 0:Y.config;if(!(ee!=null&&ee.forceField)||ee.forceRadius<=0)return!1;const ne=ge(H.clientX,H.clientY);if(Math.hypot(ne.x-ee.forceCenterX,ne.y-ee.forceCenterY)>ee.forceRadius)return!1;const ve=ee.forceCenterX,_e=ee.forceCenterY;t.value&&(t.value.style.cursor="grabbing");const Me=De=>{const Ie=ge(De.clientX,De.clientY);ee.forceCenterX=ve+Ie.x-ne.x,ee.forceCenterY=_e+Ie.y-ne.y},be=()=>{t.value&&(t.value.style.cursor=""),window.removeEventListener("pointermove",Me),window.removeEventListener("pointerup",be),window.removeEventListener("pointercancel",be)};return window.addEventListener("pointermove",Me),window.addEventListener("pointerup",be),window.addEventListener("pointercancel",be),H.preventDefault(),!0}function Kt(H){const Y=e.systems.find(Ie=>Ie.id===e.activeId);if((Y==null?void 0:Y.visible)===!1)return!1;const ee=Y==null?void 0:Y.config;if(!(ee!=null&&ee.attraction))return!1;const ne=ge(H.clientX,H.clientY),ue=Math.max(ee.attractionRadius,12/Math.max(1e-4,e.editor.viewScale));if(Math.hypot(ne.x-ee.attractionCenterX,ne.y-ee.attractionCenterY)>ue)return!1;const _e=ee.attractionCenterX,Me=ee.attractionCenterY;t.value&&(t.value.style.cursor="grabbing");const be=Ie=>{const Le=ge(Ie.clientX,Ie.clientY);ee.attractionCenterX=_e+Le.x-ne.x,ee.attractionCenterY=Me+Le.y-ne.y},De=()=>{t.value&&(t.value.style.cursor=""),window.removeEventListener("pointermove",be),window.removeEventListener("pointerup",De),window.removeEventListener("pointercancel",De)};return window.addEventListener("pointermove",be),window.addEventListener("pointerup",De),window.addEventListener("pointercancel",De),H.preventDefault(),!0}function Ti(){const H=e.activeObjectId;if(e.activeObjectType==="particle"){const ne=e.systems.find(ve=>ve.id===H);if(!ne||ne.visible===!1)return null;const ue=ne.config;return{x:ue.centerX,y:ue.centerY,rotation:ue.rootRotation,scaleX:ue.rootScaleX??1,scaleY:ue.rootScaleY??1,setPosition:(ve,_e)=>{ue.centerX=ve,ue.centerY=_e},setRotation:ve=>{ue.rootRotation=ve},setScale:(ve,_e)=>{ue.rootScaleX=ve,ue.rootScaleY=_e}}}const ee=(e.activeObjectType==="collision"?e.colliders:e.activeObjectType==="path"?e.paths:e.spines).find(ne=>ne.id===H);return!ee||ee.visible===!1?null:{x:Number(ee.x)||0,y:Number(ee.y)||0,rotation:Number(ee.rotation)||0,scaleX:Math.max(.05,Number(ee.scaleX)||1),scaleY:Math.max(.05,Number(ee.scaleY)||1),setPosition:(ne,ue)=>{ee.x=ne,ee.y=ue},setRotation:ne=>{ee.rotation=ne},setScale:(ne,ue)=>{ee.scaleX=ne,ee.scaleY=ue}}}function Wi(H){const Y=Ti();if(!Y)return;const ee=e.editor.viewScale,ne=t.value.getBoundingClientRect(),ue=ne.left+f.screen.width/2+e.editor.viewX+Y.x*ee,ve=ne.top+f.screen.height*.5+e.editor.viewY+-Y.y*ee,_e=H.clientX,Me=H.clientY,be=l.value,De=Y.x,Ie=Y.y,Le=Y.rotation,Te=Y.scaleX,je=Y.scaleY,rt=Math.hypot(_e-ue,Me-ve)||1,Je=Math.atan2(Me-ve,_e-ue),nt=Se=>{const at=(Se.clientX-_e)/ee,Pe=(Se.clientY-Me)/ee;if(be==="translate")Y.setPosition(De+at,Ie-Pe);else if(be==="rotate"){const Xt=Math.atan2(Se.clientY-ve,Se.clientX-ue);Y.setRotation(Le-(Xt-Je)*180/Math.PI)}else if(be==="scale"){const Bt=Math.hypot(Se.clientX-ue,Se.clientY-ve)/rt;Y.setScale(Math.max(.05,Te*Bt),Math.max(.05,je*Bt))}},Qe=()=>{window.removeEventListener("pointermove",nt),window.removeEventListener("pointerup",Qe),window.removeEventListener("pointercancel",Qe)};window.addEventListener("pointermove",nt),window.addEventListener("pointerup",Qe),window.addEventListener("pointercancel",Qe)}function zi(){di(1.2)}function dn(){di(1/1.2)}function di(H){const Y=Math.max(.01,e.editor.viewScale*H);e.editor.viewScale=Y}function ce(){e.editor.viewScale=1,e.editor.viewX=0,e.editor.viewY=0}function de(){e.editor.viewScale=1,e.editor.viewX=0,e.editor.viewY=0}function Rt(){e.settings.showGrid=!e.settings.showGrid}function Wt(){if(p){for(const[H,Y]of V){const ee=e.systems.find(ne=>ne.id===H);(!ee||q.get(H)!==ee.config)&&(p.removeChild(Y),Y.destroy({children:!0}),V.delete(H),q.delete(H))}for(const H of e.systems){X&&!H.config.texture&&(H.config.texture=X);const Y=Wr(H.config);if(E)for(const ne of Y.trailResources)!ne.texture&&(ne.previewUrl==="/images/trail.png"||ne.previewUrl==="/trails/trail.png")&&(ne.texture=E);if(X)for(const ne of Y.imageResources)!ne.texture&&ne.textureName==="star"&&(ne.texture=X);if(V.has(H.id))continue;const ee=new BI(H.config);ee.setEmitterPos(()=>({x:H.config.centerX,y:H.config.centerY})),p.addChild(ee),V.set(H.id,ee),q.set(H.id,H.config)}}}function Zt(){if(!b)return;const H=b;if(H.clear(),!!e.settings.showEmitter&&e.systems.length)for(const Y of e.systems){if(Y.visible===!1)continue;const ee=J.get(Y.id),ne=(ee==null?void 0:ee.x)??Y.config.centerX??0,ue=-((ee==null?void 0:ee.y)??Y.config.centerY??0),ve=e.activeObjectType==="particle"&&Y.id===e.activeId,_e=ve?16763955:9082040,Me=ve?.4:.2;H.lineStyle(1,_e,Me),H.drawCircle(ne,ue,10),H.beginFill(_e,ve?.8:.4),H.drawCircle(ne,ue,3),H.endFill(),H.lineStyle(1,_e,ve?.3:.15),H.moveTo(ne-16,ue),H.lineTo(ne+16,ue),H.moveTo(ne,ue-16),H.lineTo(ne,ue+16)}}function pt(){var ee;if(!y)return;const H=y;(ee=H.parent)==null||ee.addChild(H),H.clear();const Y=new Map;for(const ne of e.spines)ne.visible===!1||!ne.selectedBone||ne.status!=="ready"||Y.set(`${ne.id}:${ne.selectedBone}`,{spineId:ne.id,boneName:ne.selectedBone});for(const ne of e.systems){if(ne.visible===!1)continue;const ue=ne.config;if(!ue.emitterFollow||ue.emitterFollowMode!=="bone"||!ue.emitterFollowSpineId||!ue.emitterFollowBoneName)continue;const ve=e.spines.find(_e=>_e.id===ue.emitterFollowSpineId);!ve||ve.visible===!1||Y.set(`${ue.emitterFollowSpineId}:${ue.emitterFollowBoneName}`,{spineId:ue.emitterFollowSpineId,boneName:ue.emitterFollowBoneName})}for(const ne of Y.values()){const ue=B==null?void 0:B.getBoneWorldTransform(ne.spineId,ne.boneName);if(!ue)continue;const ve=ue.x,_e=-ue.y;H.lineStyle(2,12881151,.95),H.beginFill(12881151,.2),H.drawCircle(ve,_e,8),H.endFill(),H.beginFill(15919103,1),H.drawCircle(ve,_e,3.5),H.endFill()}}function Rs(){if(!A)return;const H=A;if(H.clear(),!e.settings.showEmitter)return;const Y=e.systems.find(Je=>Je.id===e.activeId);if(!Y||Y.visible===!1)return;const ee=Y.config,ne=J.get(Y.id),ue=(ne==null?void 0:ne.x)??ee.centerX??0,ve=-((ne==null?void 0:ne.y)??ee.centerY??0),_e=ee.shape;if(_e==="point"||_e==="path")return;const Me=ee.rootScaleX??1,be=ee.rootScaleY??1,De=-((ne==null?void 0:ne.rotation)??ee.rootRotation??0)*Math.PI/180,Ie=Math.cos(De),Le=Math.sin(De),Te=ee.offsetX??0,je=ee.offsetY??0,rt=(Je,nt)=>{const Qe=Je+Te,Se=-nt-je,at=Qe*Me,Pe=Se*be;return[ue+at*Ie-Pe*Le,ve+(at*Le+Pe*Ie)]};if(_e==="circle"){const Je=Rh(ee.innerRadius,ee.outerRadius);H.lineStyle(2,3991658,.7);const nt=48;for(const Qe of[Je.outer,Je.inner])if(!(Qe<=0))for(let Se=0;Se<=nt;Se++){const at=Se/nt*Math.PI*2,[Pe,Xt]=rt(Math.cos(at)*Qe,Math.sin(at)*Qe);Se===0?H.moveTo(Pe,Xt):H.lineTo(Pe,Xt)}}else if(_e==="rect"){const Je=u1(ee);H.lineStyle(2,4885759,.7);for(const[nt,Qe]of[[Je.outerW,Je.outerH],[Je.innerW,Je.innerH]]){if(nt<=0||Qe<=0)continue;const Se=nt/2,at=Qe/2,Pe=rt(-Se,-at),Xt=rt(Se,-at),Bt=rt(Se,at),si=rt(-Se,at);H.moveTo(Pe[0],Pe[1]),H.lineTo(Xt[0],Xt[1]),H.lineTo(Bt[0],Bt[1]),H.lineTo(si[0],si[1]),H.lineTo(Pe[0],Pe[1])}}else if(_e==="cone"){const Je=Rh(ee.innerRadius,ee.outerRadius),nt=ee.coneAngle/2*Math.PI/180,Qe=ee.coneDirection*Math.PI/180,Se=rt(Math.cos(Qe-nt)*Je.inner,Math.sin(Qe-nt)*Je.inner),at=rt(Math.cos(Qe+nt)*Je.inner,Math.sin(Qe+nt)*Je.inner),Pe=rt(Math.cos(Qe-nt)*Je.outer,Math.sin(Qe-nt)*Je.outer),Xt=rt(Math.cos(Qe+nt)*Je.outer,Math.sin(Qe+nt)*Je.outer);H.lineStyle(2,3991658,.7),H.moveTo(Se[0],Se[1]),H.lineTo(Pe[0],Pe[1]),H.moveTo(at[0],at[1]),H.lineTo(Xt[0],Xt[1]),H.lineStyle(1,3991658,.5);const Bt=24;for(const si of[Je.outer,Je.inner])if(!(si<=0))for(let Ci=0;Ci<=Bt;Ci++){const ns=Qe-nt+2*nt*Ci/Bt,[Ha,$]=rt(Math.cos(ns)*si,Math.sin(ns)*si);Ci===0?H.moveTo(Ha,$):H.lineTo(Ha,$)}}}function Hs(){if(!T)return;const H=T;H.clear();const Y=e.systems.find(_e=>_e.id===e.activeId);if((Y==null?void 0:Y.visible)===!1)return;const ee=Y==null?void 0:Y.config;if(!(ee!=null&&ee.forceField)||ee.forceRadius<=0)return;const ne=ee.forceCenterX,ue=-ee.forceCenterY,ve=ee.forceStrength>=0?5818367:16739194;H.lineStyle(2,ve,.85),H.beginFill(ve,.08),H.drawCircle(ne,ue,ee.forceRadius),H.endFill(),H.lineStyle(1,ve,.7),H.moveTo(ne-9,ue),H.lineTo(ne+9,ue),H.moveTo(ne,ue-9),H.lineTo(ne,ue+9),H.beginFill(ve,.95),H.drawCircle(ne,ue,4),H.endFill()}function Ui(){if(!_)return;const H=_;H.clear();const Y=e.systems.find(Me=>Me.id===e.activeId);if((Y==null?void 0:Y.visible)===!1)return;const ee=Y==null?void 0:Y.config;if(!(ee!=null&&ee.attraction))return;const ne=ee.attractionCenterX,ue=-ee.attractionCenterY,ve=Math.max(0,ee.attractionRadius),_e=16731487;ve>0&&(H.lineStyle(2,_e,.95),H.beginFill(_e,.09),H.drawCircle(ne,ue,ve),H.endFill()),H.lineStyle(1,_e,.85),H.moveTo(ne-10,ue),H.lineTo(ne+10,ue),H.moveTo(ne,ue-10),H.lineTo(ne,ue+10),H.beginFill(_e,1),H.drawCircle(ne,ue,ve>0?4:6),H.endFill()}function Ps(){if(!F)return;const H=F;if(H.clear(),!l.value)return;const Y=Ti();if(!Y)return;const ee=Y.x,ne=-Y.y,ue=Y.scaleX,ve=Y.scaleY,_e=-Y.rotation*Math.PI/180,Me=Math.cos(_e),be=Math.sin(_e),De=(Te,je)=>{const rt=Te*ue,Je=-je*ve;return[ee+rt*Me-Je*be,ne+(rt*be+Je*Me)]},Ie=(Te,je,rt,Je)=>{const nt=De(Te,je),Qe=De(rt,Je);H.moveTo(nt[0],nt[1]),H.lineTo(Qe[0],Qe[1])},Le=26;if(H.lineStyle(2,3526911,.9),H.beginFill(3526911,.25),H.drawCircle(ee,ne,6),H.endFill(),l.value==="translate")H.lineStyle(2,3526911,.9),Ie(-Le,0,Le,0),Ie(0,-Le,0,Le),Ie(Le-6,-4,Le,0),Ie(Le,0,Le-6,4),Ie(-20,-4,-Le,0),Ie(-Le,0,-20,4),Ie(-4,Le-6,0,Le),Ie(0,Le,4,Le-6),Ie(-4,-20,0,-Le),Ie(0,-Le,4,-20);else if(l.value==="rotate"){H.lineStyle(2,3526911,.8);const Te=48;for(let Je=0;Je<=Te;Je++){const nt=Je/Te*Math.PI*2,[Qe,Se]=De(Math.cos(nt)*Le,Math.sin(nt)*Le);Je===0?H.moveTo(Qe,Se):H.lineTo(Qe,Se)}const[je,rt]=De(0,Le);H.beginFill(3526911,.95),H.drawCircle(je,rt,4),H.endFill()}else if(l.value==="scale"){H.lineStyle(2,3526911,.9);const je=[[-Le,-Le],[Le,-Le],[Le,Le],[-Le,Le]].map(([rt,Je])=>De(rt,Je));H.moveTo(je[0][0],je[0][1]),H.lineTo(je[1][0],je[1][1]),H.lineTo(je[2][0],je[2][1]),H.lineTo(je[3][0],je[3][1]),H.lineTo(je[0][0],je[0][1]),H.beginFill(3526911,.9);for(const rt of je)H.drawRect(rt[0]-3,rt[1]-3,6,6);H.endFill()}}function br(H,Y,ee,ne){var _e;const ue=Number.isFinite(Y.worldX)&&Number.isFinite(Y.worldY),ve=Number.isFinite(Y.worldRotation);H.push({boneName:Y.boneName,x:ue?Y.worldX:Y.x,y:ue?-Y.worldY:Y.y,rotation:ve?-Y.worldRotation:-Y.rotation,parentX:ee,parentY:ne}),(_e=Y.trailState)!=null&&_e.bones.length&&Y.trailState.bones.forEach(Me=>{const be=Number.isFinite(Me.worldX)&&Number.isFinite(Me.worldY),De=Number.isFinite(Me.worldRotation);H.push({boneName:Me.boneName,x:be?Me.worldX:Me.x,y:be?-Me.worldY:Me.y,rotation:De?-Me.worldRotation:Me.rotation,parentX:ee,parentY:ne,trail:!0})})}function js(H,Y,ee,ne,ue,ve,_e,Me){const be=ve*.62,De=Y+ne*ve,Ie=ee+ue*ve,Le=Math.max(2.5,ve*.32),Te=Math.max(1.7,ve*.22),je=De-ne*Le,rt=Ie-ue*Le,Je=-ue,nt=ne;H.lineStyle(_e,Me,.95),H.moveTo(Y-ne*be,ee-ue*be),H.lineTo(je,rt),H.lineStyle(0),H.beginFill(Me,.95),H.drawPolygon([De,Ie,je+Je*Te,rt+nt*Te,je-Je*Te,rt-nt*Te]),H.endFill()}function ss(H){if(!w)return;const Y=w;if(Y.clear(),!e.settings.showBones)return;const ee=0,ne=0,ue=Math.max(.25,Math.abs(e.editor.viewScale)||1),ve=Math.min(10,Math.max(.1,Number(e.settings.bonePointDrawSize)||1)),_e=Math.min(10,Math.max(.1,Number(e.settings.boneAxisDrawSize)||2)),Me=2.5*ve/ue,be=4.5*_e/ue,De=Math.max(.65,_e*.625)/ue;for(const Ie of H){const Le=Ie.trail?16731533:16747610;Y.lineStyle(1,Le,Ie.trail?.65:.35),Y.moveTo(Ie.parentX??ee,Ie.parentY??ne),Y.lineTo(Ie.x,Ie.y);const Te=Ie.rotation*Math.PI/180,je=Math.cos(Te),rt=Math.sin(Te);js(Y,Ie.x,Ie.y,je,rt,be,De,15684432),js(Y,Ie.x,Ie.y,rt,-je,be,De,5622123),Y.beginFill(Le,.9),Y.drawCircle(Ie.x,Ie.y,Me),Y.endFill()}}function $a(H,Y=16777215){const ee=Number.parseInt(H.replace("#",""),16);return Number.isFinite(ee)?ee:Y}function Ga(){if(!R)return;const H=R;H.clear();for(const Y of W){if(Y.visible===!1)continue;const ee=e.activeObjectType==="collision"&&e.activeObjectId===Y.id,ne=Y.enabled?ee?16735858:13911899:5792116,ue=Y.rotation*Math.PI/180,ve=Math.cos(ue),_e=Math.sin(ue),Me=Math.max(1e-4,Math.abs(Y.scaleX??1)),be=Math.max(1e-4,Math.abs(Y.scaleY??1)),De=(Te,je)=>({x:Y.x+ve*Te*Me-_e*je*be,y:-(Y.y+_e*Te*Me+ve*je*be)});let Ie=[];if(Y.shape==="circle"||Y.shape==="ellipse"){const Te=Y.shape==="circle"?Y.radius:Y.radiusX,je=Y.shape==="circle"?Y.radius:Y.radiusY;Ie=Array.from({length:49},(rt,Je)=>{const nt=Je/48*Math.PI*2;return De(Math.cos(nt)*Te,Math.sin(nt)*je)})}else if(Y.shape==="rect"){const Te=Y.width*.5,je=Y.height*.5;Ie=[De(-Te,-je),De(Te,-je),De(Te,je),De(-Te,je),De(-Te,-je)]}else{const Te=Math.max(3,Math.min(16,Math.round(Y.sides)));Ie=Array.from({length:Te+1},(je,rt)=>{const Je=Math.PI*.5+rt%Te/Te*Math.PI*2;return De(Math.cos(Je)*Y.width*.5,Math.sin(Je)*Y.height*.5)})}if(!Ie.length)continue;H.lineStyle(ee?2.5:1.5,ne,Y.enabled?.95:.45),H.beginFill(ne,ee?.12:.055),H.moveTo(Ie[0].x,Ie[0].y);for(let Te=1;Te{const Ie=le(Y,be,De);return{x:Ie.x,y:-Ie.y}},ve=Y.points[0],_e=ue(ve.x,ve.y);H.lineStyle(ee?2.5:1.8,ne,ee?1:.75),H.moveTo(_e.x,_e.y);const Me=Y.closed?Y.points.length:Y.points.length-1;for(let be=0;be{const Ie=ue(be.x,be.y),Le=ue(be.x+be.inX,be.y+be.inY),Te=ue(be.x+be.outX,be.y+be.outY),je=Math.hypot(be.inX,be.inY)>.01,rt=Math.hypot(be.outX,be.outY)>.01;H.lineStyle(1,11121867,.65),je&&(H.moveTo(Ie.x,Ie.y),H.lineTo(Le.x,Le.y)),rt&&(H.moveTo(Ie.x,Ie.y),H.lineTo(Te.x,Te.y)),je&&(H.beginFill(14015724,.95),H.drawCircle(Le.x,Le.y,3),H.endFill()),rt&&(H.beginFill(14015724,.95),H.drawCircle(Te.x,Te.y,3),H.endFill()),H.beginFill(K.has(De)?16777215:ne,1),H.lineStyle(1.5,K.has(De)?6126847:16777215,.95),H.drawCircle(Ie.x,Ie.y,K.has(De)?5:4),H.endFill()})}}function Ws(H,Y,ee="linear"){if(!H.length)return Y;const ne=[...H].sort((ue,ve)=>ue.x-ve.x);if(Y<=ne[0].x)return ne[0].y;for(let ue=1;ue{if(!Y.followPath||!Y.followPathId)return Y;const ee=e.paths.find(De=>De.id===Y.followPathId&&De.enabled);if(!(ee!=null&&ee.points.length))return Y;const ne=Math.max(.05,Number(Y.followDuration)||2),ue=Math.min(1,Math.max(0,H/ne)),ve=Array.isArray(Y.followCurve)?Y.followCurve:[{x:0,y:0},{x:1,y:1}],_e=Y.followCurveMode==="跟随导出"?e.settings.exportSettings.keyframeCurve==="bezier"?"bezier":"linear":Y.followCurveMode==="贝塞尔"?"bezier":"linear",Me=Math.min(1,Math.max(0,Ws(ve,ue,_e))),be=yf(ee,Me);return be?{...Y,x:be.x,y:be.y,rotation:Y.rotation+(Y.followPathRotation?be.angle:0)}:Y})}function ks(H,Y,ee,ne=Math.max(1e-4,Math.abs(H.rootScaleX)),ue=Math.max(1e-4,Math.abs(H.rootScaleY))){const ve=-H.rootRotation*Math.PI/180,_e=Math.cos(ve),Me=Math.sin(ve),be=Y-H.centerX,De=-ee+H.centerY;return{x:(_e*be+Me*De)/ne,y:(-Me*be+_e*De)/ue}}function ea(H,Y,ee){const ne=yf(Y,ee);if(!ne)return null;const ue=ks(H,ne.x,ne.y),ve=ne.angle*Math.PI/180,_e=ks(H,ne.x+Math.cos(ve),ne.y+Math.sin(ve)),Me=Math.atan2(_e.y-ue.y,_e.x-ue.x)*180/Math.PI;return{...ue,angle:Me}}function ta(){var ee,ne,ue;O=requestAnimationFrame(ta);const H=performance.now()/1e3;let Y=H-U;if(U=H,Y>.1&&(Y=.1),f&&p){p.scale.set(e.editor.viewScale),p.position.set(f.screen.width/2+e.editor.viewX,f.screen.height*.5+e.editor.viewY),m&&(m.position.set(Number(e.settings.backgroundX)||0,-(Number(e.settings.backgroundY)||0)),m.alpha=Math.min(1,Math.max(0,Number(e.settings.backgroundOpacity)||0))),he(),Wt();const ve=Math.max(1,e.timeline.fps),_e=e.timeline.frame,Me=_e/ve;B==null||B.sync(e.spines,_e,ve),Vn(Me);for(const Qe of e.systems){const Se=V.get(Qe.id);if(!Se)continue;Se.setFollowExportCurveMode(e.settings.exportSettings.keyframeCurve==="bezier"?"贝塞尔":"线性");const at=Qe.visible!==!1;Se.visible=at,Se.renderable=at;const Pe=Qe.config;Se.scale.set(Pe.rootScaleX,Pe.rootScaleY);const Xt=new Set(Pe.collisionColliderIds);Se.setColliders(Pe.collision?W.filter(ut=>Xt.has(ut.id)):[]),Se.setEmitterFollowSpawn(0,0,0);let Bt={x:Pe.centerX,y:Pe.centerY,rotation:Pe.rootRotation};const si=Pe.emitterFollow&&Pe.emitterFollowMode==="bone"?e.spines.find(ut=>ut.id===Pe.emitterFollowSpineId&&ut.enabled&&ut.status==="ready"):null,Ci=si&&(B==null?void 0:B.getBoneWorldTransform(si.id,Pe.emitterFollowBoneName))||null,ns=Pe.emitterFollow&&Pe.emitterFollowMode==="path"?e.paths.find(ut=>ut.id===Pe.emitterFollowPathId&&ut.enabled):null,Ha=Math.max(.05,Pe.emitterFollowDuration),$=Math.min(1,Math.max(0,Me/Ha)),S=Math.min(1,Math.max(0,Ws(Pe.emitterFollowCurve,$))),C=Math.min(1,Math.max(0,Pe.emitterFollowOffset)),Q=Pe.emitterFollowDirection==="reverse"?(1-C)*(1-S):C+(1-C)*S,Re=ns?yf(ns,Q):null;if(Ci){const ut=Pe.emitterFollowBoneOffsetX,ni=Pe.emitterFollowBoneOffsetY,Vt=Ci.x+ut,rs=Ci.y+ni,tc=Pe.rootRotation+Pe.emitterFollowBoneRotation,Xo=Math.max(1e-4,Math.abs(Pe.rootScaleX*Pe.emitterFollowBoneScaleX)),Vo=Math.max(1e-4,Math.abs(Pe.rootScaleY*Pe.emitterFollowBoneScaleY));if(Bt={x:Vt,y:rs,rotation:tc},Pe.emitterFollowSpace==="local")Se.position.set(Vt,-rs),Se.rotation=-tc*Math.PI/180,Se.scale.set(Xo,Vo),Se.setSimulationTransform(Vt,rs,tc,Xo,Vo);else{Se.position.set(Pe.centerX,-Pe.centerY),Se.rotation=-Pe.rootRotation*Math.PI/180,Se.scale.set(Xo,Vo),Se.setSimulationTransform(Pe.centerX,Pe.centerY,Pe.rootRotation,Xo,Vo);const Vp=ks(Pe,Vt,rs,Xo,Vo),AS=-(tc-Pe.rootRotation);Se.setEmitterFollowSpawn(Vp.x,Vp.y,AS)}}else if(Re){const ut=Re.angle+(Pe.emitterFollowDirection==="reverse"?180:0),ni=Pe.emitterAngleMode==="direction"?ut:Pe.rootRotation;if(Bt={x:Re.x,y:Re.y,rotation:ni},Pe.emitterFollowSpace==="local")Se.position.set(Re.x,-Re.y),Se.rotation=-ni*Math.PI/180,Se.setSimulationTransform(Re.x,Re.y,ni);else{Se.position.set(Pe.centerX,-Pe.centerY),Se.rotation=-Pe.rootRotation*Math.PI/180,Se.setSimulationTransform(Pe.centerX,Pe.centerY,Pe.rootRotation);const Vt=ks(Pe,Re.x,Re.y),rs=Pe.emitterAngleMode==="direction"?-(ut-Pe.rootRotation):0;Se.setEmitterFollowSpawn(Vt.x,Vt.y,rs)}}else Se.position.set(Pe.centerX,-Pe.centerY),Se.rotation=-Pe.rootRotation*Math.PI/180,Se.setSimulationTransform(Pe.centerX,Pe.centerY,Pe.rootRotation);const mt=Pe.shape==="path"&&Pe.spawnPathId>0&&e.paths.find(ut=>ut.id===Pe.spawnPathId&&ut.enabled&&ut.points.length>0)||null;Se.setSpawnPathSampler(mt?ut=>ea(Pe,mt,ut):null,(mt==null?void 0:mt.closed)===!0),J.set(Qe.id,Bt)}let be=0;const De=[],Ie=e.settings.showBones&&e.activeObjectType==="particle"?e.activeObjectId:0,Le=(Qe,Se,at)=>{!Qe||Qe.id!==Ie||Qe.visible===!1||br(De,at,Se.position.x,Se.position.y)},Te=e.timeline,je=Te.fps,rt=1/Math.max(1,je);let Je=N,nt=0;if(Te.playing?(L+=Y,nt=Math.floor(L/rt),nt>0&&(L-=nt*rt)):L=0,Te.playing&&nt>0)for(let Qe=0;QeBt.id===e.activeId),at=(Se==null?void 0:Se.config.mode)==="stream"&&Se.config.streamBehavior==="loop"?g1(Se.config,je):null,Xt=Te.loop&&(at==null?void 0:at.start)===Te.playbackStart&&at.end===Te.playbackEnd?Te.playbackEnd-1:Te.playbackEnd;if(Te.frame>Xt)if(Te.loop)Te.frame=Te.playbackStart;else{Te.frame=Te.playbackEnd,Te.playing=!1;break}}else{if(Te.frame===0)for(const Se of e.systems){const at=V.get(Se.id);at&&(Se.config.mode==="stream"&&Se.config.streamBehavior==="loop"?sR(Se,at,je,Te.totalFrames):at.reset())}for(const[Se,at]of V){const Pe=e.systems.find(ns=>ns.id===Se),Xt=(Pe==null?void 0:Pe.config.mode)==="stream"&&Pe.config.streamBehavior==="loop",Bt=Xt?(ee=Pe.frames)==null?void 0:ee[Te.frame]:void 0,si=Te.frame===0&&!Xt,Ci=si?[]:Bt||at.update(rt);if(si?at.apply([]):Bt&&at.apply(Bt),(Pe==null?void 0:Pe.visible)!==!1)for(const ns of Ci)ns.active&&Le(Pe,at,ns);be+=Ci.length}for(const Se of e.systems){if(!Se.config.texture)continue;Se.frames=Se.frames||[];const at=V.get(Se.id);at&&!(Se.config.mode==="stream"&&Se.config.streamBehavior==="loop")&&(Se.frames[Te.frame]=at.capture())}Te.frame++,Te.frame>=Te.totalFrames&&(Te.frame=Te.playbackStart,Te.recorded=!0)}else{Te.playing||(Je=Te.frame);for(const Qe of e.systems){const Se=V.get(Qe.id),at=Te.playing?N:Te.frame,Pe=(ue=Qe.frames)==null?void 0:ue[at],Xt=Qe.config.mode==="stream"&&Qe.config.streamBehavior==="loop"&&!!Pe;if((Te.recorded||Xt)&&Se&&Pe){Se.apply(Pe);for(const Bt of Pe)Bt.active&&(Le(Qe,Se,Bt),be++)}else if(Se){const Bt=Te.frame===0?[]:Se.update(0);if(Te.frame===0&&Se.apply([]),Qe.visible!==!1)for(const si of Bt)si.active&&Le(Qe,Se,si);be+=Se.activeCount}}}N=Je,B==null||B.sync(e.spines,Je,je);for(const[,Qe]of V)Qe.drawTrailMeshDebug(e.settings.showSkinMesh);Ga(),Qr(),pt(),Zt(),Rs(),Hs(),Ui(),Ps(),ss(De),i.value&&(i.value.systems=e.systems.length,i.value.particles=be)}}return Kr(async()=>{const H=t.value;f=new Yb({width:H.clientWidth||800,height:H.clientHeight||600,backgroundAlpha:0,antialias:!0}),H.appendChild(f.view),we(),fs(()=>e.settings.backgroundImageData,z,{immediate:!0}),await me();const Y=X;for(const ee of e.systems){ee.config.texture=Y;const ne=Wr(ee.config);if(E)for(const ue of ne.trailResources)!ue.texture&&(ue.previewUrl==="/images/trail.png"||ue.previewUrl==="/trails/trail.png")&&(ue.texture=E);for(const ue of ne.imageResources)!ue.texture&&ue.textureName==="star"&&(ue.texture=Y)}i.value={systems:e.systems.length,particles:0},e.timeline.recorded=!1,e.timeline.frame=0,L=0,N=0,e.timeline.playing=!0,e.timeline.loop=!0;for(const ee of e.systems)ee.frames=[];e.recalcTotalFrames(),U=performance.now()/1e3,ta(),fs(()=>e.systems.map(ee=>JSON.stringify(ee.config,(ne,ue)=>ne==="texture"||ne==="trailTexture"||ne==="previewUrl"?void 0:ue)).join("|")+`|colliders:${JSON.stringify(e.colliders)}|paths:${JSON.stringify(e.paths)}`,()=>{e.recalcTotalFrames(),e.timeline.recorded=!1,e.timeline.frame=0;for(const ee of e.systems)ee.frames=[];e.timeline.playing=!0,e.timeline.loop=!0}),HP(e)}),Gl(()=>{cancelAnimationFrame(O),B==null||B.destroy(),B=null,v++,g&&g.destroy(!0),g=null,m=null,f&&(f.destroy(!0,{children:!0}),f=null)}),(H,Y)=>(ie(),ae("div",Ak,[M("div",{ref_key:"holder",ref:t,class:Ze(["stage-holder",{grid:ke(e).settings.showGrid}]),tabindex:"0",onWheel:bt(xe,["prevent"]),onPointerdown:oe,onDblclick:bt(st,["prevent"])},null,34),M("div",Ek,[M("button",{class:"settings-btn",onClick:Ae,title:"系统设置"},"系统设置"),M("button",{class:"undo-btn",disabled:ke(Iu).undoCount===0,onClick:Y[0]||(Y[0]=(...ee)=>ke(Tf)&&ke(Tf)(...ee)),title:"撤回上一步 (Ctrl+Z)"},"↶",8,Ck),M("div",Ik,[M("button",{class:Ze(["tool-btn",{on:l.value===""}]),onClick:Y[1]||(Y[1]=ee=>u("")),title:"拖动画布 (Q)"},"✋",2),M("button",{class:Ze(["tool-btn",{on:l.value==="translate"}]),onClick:Y[2]||(Y[2]=ee=>u("translate")),title:"位移 (W)"},"✥",2),M("button",{class:Ze(["tool-btn",{on:l.value==="rotate"}]),onClick:Y[3]||(Y[3]=ee=>u("rotate")),title:"旋转 (E)"},"⟳",2),M("button",{class:Ze(["tool-btn",{on:l.value==="scale"}]),onClick:Y[4]||(Y[4]=ee=>u("scale")),title:"缩放 (R)"},"⤢",2)]),M("div",Rk,[M("button",{class:"tool-btn",onClick:zi,title:"放大"},"+"),M("button",{class:"tool-btn",onClick:dn,title:"缩小"},"-"),M("button",{class:"tool-btn",onClick:ce,title:"适配画布"},"⤢"),M("button",{class:Ze(["tool-btn",{on:ke(e).settings.showGrid}]),onClick:Rt,title:"切换网格"},"▦",2),M("button",{class:"tool-btn",onClick:de,title:"重置视图"},"⟳")]),M("div",{class:"background-menu",onClick:Y[10]||(Y[10]=bt(()=>{},["stop"]))},[M("button",{class:Ze(["background-btn",{on:r.value}]),title:"背景图显示设置",onClick:Ee},"背景图",2),r.value?(ie(),ae("div",Pk,[M("button",{class:"background-upload",onClick:Y[5]||(Y[5]=ee=>{var ne;return(ne=o.value)==null?void 0:ne.click()})},Xe(h.value?"更换图像":"上传图像"),1),M("button",{class:"background-clear",disabled:!h.value,onClick:Y[6]||(Y[6]=ee=>j())},"清除背景",8,kk),M("input",{ref_key:"backgroundFileInput",ref:o,class:"background-file-input",type:"file",accept:"image/png,image/jpeg,image/webp",onChange:Z},null,544),M("div",{class:"background-file-name",title:h.value},Xe(h.value||"未上传图像"),9,Fk),M("div",Ok,[M("label",null,[Y[27]||(Y[27]=M("span",null,"X",-1)),ye(M("input",{"onUpdate:modelValue":Y[7]||(Y[7]=ee=>ke(e).settings.backgroundX=ee),type:"number",step:"1","aria-label":"背景图 X 偏移"},null,512),[[ht,ke(e).settings.backgroundX,void 0,{number:!0}]])]),M("label",null,[Y[28]||(Y[28]=M("span",null,"Y",-1)),ye(M("input",{"onUpdate:modelValue":Y[8]||(Y[8]=ee=>ke(e).settings.backgroundY=ee),type:"number",step:"1","aria-label":"背景图 Y 偏移"},null,512),[[ht,ke(e).settings.backgroundY,void 0,{number:!0}]])])]),M("label",Bk,[Y[29]||(Y[29]=M("span",null,"透明度",-1)),ye(M("input",{"onUpdate:modelValue":Y[9]||(Y[9]=ee=>ke(e).settings.backgroundOpacity=ee),type:"range",min:"0",max:"1",step:"0.01","aria-label":"背景图透明度"},null,512),[[ht,ke(e).settings.backgroundOpacity,void 0,{number:!0}]]),M("b",null,Xe(Math.round(ke(e).settings.backgroundOpacity*100))+"%",1)])])):Ve("",!0)]),M("button",{class:Ze(["help-btn",{on:a.value}]),title:"查看使用说明",onClick:pe},"使用说明",2),M("span",Lk,Xe(Math.round(ke(e).editor.viewScale*100))+"%",1)]),n.value?(ie(),ae("div",Dk,[M("div",Nk,[Y[30]||(Y[30]=Qt("系统设置 ",-1)),M("button",{class:"sp-close",onClick:Y[11]||(Y[11]=ee=>n.value=!1)},"✕")]),Y[44]||(Y[44]=M("div",{class:"sp-section-title"},"界面布局",-1)),M("label",Uk,[Y[32]||(Y[32]=M("span",null,"参数面板位置",-1)),M("span",Xk,[ye(M("input",{type:"checkbox","onUpdate:modelValue":Y[12]||(Y[12]=ee=>ke(e).settings.parameterPanelOnRight=ee),"aria-label":"参数面板显示在右侧"},null,512),[[ei,ke(e).settings.parameterPanelOnRight]]),Y[31]||(Y[31]=M("span",{class:"sp-switch-ui","aria-hidden":"true"},null,-1)),M("b",null,Xe(ke(e).settings.parameterPanelOnRight?"右侧":"左侧"),1)])]),Y[45]||(Y[45]=M("div",{class:"sp-divider"},null,-1)),Y[46]||(Y[46]=M("div",{class:"sp-section-title"},"操作历史",-1)),M("label",Vk,[Y[33]||(Y[33]=M("span",null,"最大撤回步数",-1)),ye(M("input",{class:"sp-num sp-undo-limit",type:"number",min:"1",max:"200","onUpdate:modelValue":Y[13]||(Y[13]=ee=>ke(e).settings.undoLimit=ee),"aria-label":"最大撤回步数",onChange:G},null,544),[[ht,ke(e).settings.undoLimit,void 0,{number:!0}]])]),Y[47]||(Y[47]=M("div",{class:"sp-divider"},null,-1)),Y[48]||(Y[48]=M("div",{class:"sp-section-title"},"画布辅助显示",-1)),M("label",Yk,[ye(M("input",{type:"checkbox","onUpdate:modelValue":Y[14]||(Y[14]=ee=>ke(e).settings.showEmitter=ee)},null,512),[[ei,ke(e).settings.showEmitter]]),Y[34]||(Y[34]=Qt("发射点",-1))]),M("label",$k,[ye(M("input",{type:"checkbox","onUpdate:modelValue":Y[15]||(Y[15]=ee=>ke(e).settings.showBones=ee)},null,512),[[ei,ke(e).settings.showBones]]),Y[35]||(Y[35]=Qt("骨骼连线",-1))]),ke(e).settings.showBones?(ie(),ae(Ke,{key:0},[M("label",Gk,[Y[36]||(Y[36]=M("span",null,"骨骼点绘制大小",-1)),ye(M("input",{class:"sp-num",type:"number",min:"0.1",max:"10",step:"0.1","onUpdate:modelValue":Y[16]||(Y[16]=ee=>ke(e).settings.bonePointDrawSize=ee),"aria-label":"骨骼点绘制大小",onChange:d},null,544),[[ht,ke(e).settings.bonePointDrawSize,void 0,{number:!0}]])]),M("label",Hk,[Y[37]||(Y[37]=M("span",null,"坐标轴绘制大小",-1)),ye(M("input",{class:"sp-num",type:"number",min:"0.1",max:"10",step:"0.1","onUpdate:modelValue":Y[17]||(Y[17]=ee=>ke(e).settings.boneAxisDrawSize=ee),"aria-label":"坐标轴绘制大小",onChange:d},null,544),[[ht,ke(e).settings.boneAxisDrawSize,void 0,{number:!0}]])])],64)):Ve("",!0),M("label",jk,[ye(M("input",{type:"checkbox","onUpdate:modelValue":Y[18]||(Y[18]=ee=>ke(e).settings.showSkinMesh=ee)},null,512),[[ei,ke(e).settings.showSkinMesh]]),Y[38]||(Y[38]=Qt("蒙皮网格",-1))]),Y[49]||(Y[49]=M("div",{class:"sp-divider"},null,-1)),M("label",Wk,[ye(M("input",{type:"checkbox","onUpdate:modelValue":Y[19]||(Y[19]=ee=>ke(e).settings.tickEnabled=ee)},null,512),[[ei,ke(e).settings.tickEnabled]]),Y[39]||(Y[39]=Qt("启用刻度",-1))]),ke(e).settings.tickEnabled?(ie(),ae(Ke,{key:1},[M("label",zk,[Y[40]||(Y[40]=M("span",null,"刻度文字大小",-1)),ye(M("input",{type:"range",min:"8",max:"40",step:"1","onUpdate:modelValue":Y[20]||(Y[20]=ee=>ke(e).settings.axisFontSize=ee)},null,512),[[ht,ke(e).settings.axisFontSize,void 0,{number:!0}]]),ye(M("input",{type:"number",min:"8",max:"40","onUpdate:modelValue":Y[21]||(Y[21]=ee=>ke(e).settings.axisFontSize=ee),class:"sp-num"},null,512),[[ht,ke(e).settings.axisFontSize,void 0,{number:!0}]])]),M("label",qk,[Y[41]||(Y[41]=M("span",null,"刻度线粗细",-1)),ye(M("input",{type:"range",min:"1",max:"5",step:"0.5","onUpdate:modelValue":Y[22]||(Y[22]=ee=>ke(e).settings.tickWidth=ee)},null,512),[[ht,ke(e).settings.tickWidth,void 0,{number:!0}]]),ye(M("input",{type:"number",min:"1",max:"5","onUpdate:modelValue":Y[23]||(Y[23]=ee=>ke(e).settings.tickWidth=ee),class:"sp-num"},null,512),[[ht,ke(e).settings.tickWidth,void 0,{number:!0}]])]),M("label",Kk,[Y[42]||(Y[42]=M("span",null,"坐标轴颜色",-1)),ye(M("input",{type:"color","onUpdate:modelValue":Y[24]||(Y[24]=ee=>ke(e).settings.axisColor=ee),class:"sp-colr"},null,512),[[ht,ke(e).settings.axisColor]]),M("span",Zk,Xe(ke(e).settings.axisColor),1)]),M("label",Jk,[ye(M("input",{type:"checkbox","onUpdate:modelValue":Y[25]||(Y[25]=ee=>ke(e).settings.showAxisLabels=ee)},null,512),[[ei,ke(e).settings.showAxisLabels]]),Y[43]||(Y[43]=Qt("显示刻度数值",-1))])],64)):Ve("",!0),Y[50]||(Y[50]=M("div",{class:"sp-cache-note"},"整个系统设置会自动保存到当前浏览器",-1))])):Ve("",!0),Ue(Tk,{show:a.value,onClose:Y[26]||(Y[26]=ee=>a.value=!1)},null,8,["show"]),i.value?(ie(),ae("div",Qk,[Y[51]||(Y[51]=Qt(" 系统: ",-1)),M("b",eF,Xe(i.value.systems),1),Y[52]||(Y[52]=Qt(" · 粒子(骨骼): ",-1)),M("b",tF,Xe(i.value.particles),1),Y[53]||(Y[53]=Qt(" · 根骨骼: ",-1)),Y[54]||(Y[54]=M("b",null,"root",-1)),Y[55]||(Y[55]=M("span",{class:"hud-tip"},"滚轮缩放 · 左键拖动画布",-1))])):Ve("",!0)]))}}),sF=Gs(iF,[["__scopeId","data-v-373478e7"]]),nF={class:"ns-label"},rF=["min","max","step","value","disabled"],aF=["min","max","step","value","disabled"],oF=$s({__name:"NumSlider",props:{label:{},modelValue:{},min:{},max:{},step:{},disabled:{type:Boolean}},emits:["update:modelValue"],setup(s,{emit:e}){const t=s,i=e,n=lt(String(t.modelValue));fs(()=>t.modelValue,h=>{n.value=String(h)});function r(h){const l=parseFloat(h.target.value);Number.isNaN(l)||i("update:modelValue",l)}function a(h){n.value=h.target.value;const l=parseFloat(n.value);Number.isNaN(l)||i("update:modelValue",l)}function o(){const h=parseFloat(n.value);Number.isNaN(h)&&(n.value=String(t.modelValue))}return(h,l)=>(ie(),ae("div",{class:Ze(["ns",{disabled:s.disabled}])},[M("span",nF,Xe(s.label),1),M("input",{type:"range",class:"ns-range",min:s.min,max:s.max,step:s.step,value:s.modelValue,disabled:s.disabled,onInput:r},null,40,rF),M("input",{type:"number",class:"ns-num",min:s.min,max:s.max,step:s.step,value:n.value,disabled:s.disabled,onInput:a,onBlur:o},null,40,aF)],2))}}),qe=Gs(oF,[["__scopeId","data-v-45669c72"]]),lF={class:"ce"},cF={class:"ce-editor"},hF={class:"ce-grid"},uF=["x1","x2","y2"],dF=["y1","x2","y2"],fF=["x","y","width","height"],mF=["d"],pF={key:0,class:"ce-handles"},gF=["x1","y1","x2","y2"],vF=["cx","cy","onPointerdown"],yF=["x1","y1","x2","y2"],xF=["cx","cy","onPointerdown"],bF=["cx","cy"],wF=["cx","cy","onPointerdown","onDblclick"],SF={class:"ce-nav"},MF={class:"ce-tip"},Mr=8,_F=$s({__name:"CurveEditor",props:{modelValue:{},defaultValue:{default:()=>[{x:0,y:0},{x:1,y:1}]},mode:{default:"linear"}},emits:["update:modelValue"],setup(s,{emit:e}){const t=s,i=e,n=lt(null),r=lt(300),a=lt(110);let o=null;function h(){if(!n.value)return;const I=n.value.getBoundingClientRect();r.value=I.width,a.value=I.height}function l(I){return Mr+I*(r.value-Mr*2)}function c(I){return Mr+(1-I)*(a.value-Mr*2)}function u(){return[...t.modelValue].sort((I,k)=>I.x-k.x)}function d(I){i("update:modelValue",[...I].sort((k,B)=>k.x-B.x))}function f(){d(t.defaultValue.map(I=>({...I})))}const p=vt(()=>u());function m(I){const k=p.value[I],B=p.value[Math.max(0,I-1)];return{x:k.x-(k.x-B.x)/3,y:k.y-(k.y-B.y)/3}}function g(I){const k=p.value[I],B=p.value[Math.min(p.value.length-1,I+1)];return{x:k.x+(B.x-k.x)/3,y:k.y+(B.y-k.y)/3}}function v(I){const k=p.value[I],B=m(I);return{x:k.x+(k.inX??B.x-k.x),y:k.y+(k.inY??B.y-k.y)}}function b(I){const k=p.value[I],B=g(I);return{x:k.x+(k.outX??B.x-k.x),y:k.y+(k.outY??B.y-k.y)}}const y=vt(()=>{if(!p.value.length)return"";let I=`M ${l(p.value[0].x)} ${c(p.value[0].y)}`;for(let k=1;kMath.abs(U.x-k)>.02);D.push({x:k,y:B}),d(D)}let _={t:0,i:-1,x:0,y:0};function R(I,k){I.stopPropagation();const B=u().findIndex(N=>Math.abs(N.x-p.value[k].x)<1e-6&&Math.abs(N.y-p.value[k].y)<1e-6);if(B<0)return;const D=Date.now();if(D-_.t<300&&_.i===k&&Math.abs(I.clientX-_.x)<8&&Math.abs(I.clientY-_.y)<8){_={t:0,i:-1,x:0,y:0},F(k);return}_={t:D,i:k,x:I.clientX,y:I.clientY};const U=N=>{(Math.abs(N.clientX-I.clientX)>8||Math.abs(N.clientY-I.clientY)>8)&&(_={t:0,i:-1,x:0,y:0});const{x:O,y:X}=w(N.clientX,N.clientY),E=u();E[B]={x:O,y:X},d(E)},L=()=>{window.removeEventListener("pointermove",U),window.removeEventListener("pointerup",L)};window.addEventListener("pointermove",U),window.addEventListener("pointerup",L)}function P(I,k,B){I.stopPropagation();const D=L=>{const N=w(L.clientX,L.clientY),O=u(),X=O[k],E=B==="in"?O[Math.max(0,k-1)].x:X.x,V=B==="in"?X.x:O[Math.min(O.length-1,k+1)].x,q=Math.min(V,Math.max(E,N.x)),W=Math.round((q-X.x)*100)/100,J=Math.round((N.y-X.y)*100)/100;O[k]=B==="in"?{...X,inX:W,inY:J}:{...X,outX:W,outY:J},d(O)},U=()=>{window.removeEventListener("pointermove",D),window.removeEventListener("pointerup",U)};window.addEventListener("pointermove",D),window.addEventListener("pointerup",U)}function F(I,k){k==null||k.stopPropagation();const B=u();B.length<=2||(A=Date.now(),d(B.filter((D,U)=>U!==I)))}return Kr(()=>{h(),o=new ResizeObserver(h),n.value&&o.observe(n.value)}),Gl(()=>{o==null||o.disconnect()}),(I,k)=>(ie(),ae("div",lF,[M("div",cF,[(ie(),ae("svg",{ref_key:"svg",ref:n,class:"ce-svg",onDblclick:T},[M("g",hF,[(ie(),ae(Ke,null,ci([.25,.5,.75],B=>M("line",{key:"v"+B,x1:l(B),y1:"0",x2:l(B),y2:c(0)},null,8,uF)),64)),(ie(),ae(Ke,null,ci([.25,.5,.75],B=>M("line",{key:"h"+B,x1:"0",y1:c(B),x2:l(1),y2:c(B)},null,8,dF)),64))]),M("rect",{x:l(0),y:c(1),width:l(1)-l(0),height:c(0)-c(1),class:"ce-frame",fill:"none"},null,8,fF),M("path",{d:y.value,class:"ce-line",fill:"none"},null,8,mF),s.mode==="bezier"?(ie(),ae("g",pF,[(ie(!0),ae(Ke,null,ci(p.value,(B,D)=>(ie(),ae(Ke,{key:"handles-"+D},[D>0?(ie(),ae("line",{key:0,x1:l(B.x),y1:c(B.y),x2:l(v(D).x),y2:c(v(D).y)},null,8,gF)):Ve("",!0),D>0?(ie(),ae("circle",{key:1,cx:l(v(D).x),cy:c(v(D).y),r:"4",onPointerdown:U=>P(U,D,"in")},null,40,vF)):Ve("",!0),DP(U,D,"out")},null,40,xF)):Ve("",!0)],64))),128))])):Ve("",!0),(ie(!0),ae(Ke,null,ci(p.value,(B,D)=>(ie(),ae("g",{key:D},[M("circle",{cx:l(B.x),cy:c(B.y),r:"5",class:"ce-node"},null,8,bF),M("circle",{cx:l(B.x),cy:c(B.y),r:"9",class:"ce-hit",onPointerdown:U=>R(U,D),onDblclick:U=>F(D,U)},null,40,wF)]))),128))],544)),M("div",SF,[M("span",MF,Xe(s.mode==="bezier"?"拖动方形手柄调整弧度·双击空白新建·双击节点删除":"双击空白新建·双击节点删除·拖动节点调整"),1)])]),M("button",{class:"ce-reset",type:"button",title:"恢复默认曲线",onClick:f},"重置")]))}}),xn=Gs(_F,[["__scopeId","data-v-3c8d1b94"]]),TF={class:"pac"},AF={class:"pac-head"},EF={class:"pac-label"},CF={key:0,class:"pac-modes"},IF=["onClick"],RF={class:"pac-range"},PF={class:"pac-curve"},kF={class:"pac-axis"},FF=$s({__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(s){const e=s,t=vt(()=>{const i=[{label:"固定",value:"fixed"},{label:"随机",value:"random"}];return e.allowCurve&&i.push({label:"曲线",value:"curve"}),e.allowDirection&&i.push({label:"发射方向",value:"direction"}),i});return(i,n)=>(ie(),ae("div",TF,[M("div",AF,[M("span",EF,Xe(s.label),1),s.showModes?(ie(),ae("div",CF,[(ie(!0),ae(Ke,null,ci(t.value,r=>(ie(),ae("button",{key:r.value,class:Ze(["pac-mode",{on:s.mode===r.value}]),onClick:a=>i.$emit("update:mode",r.value)},Xe(r.label),11,IF))),128))])):Ve("",!0)]),s.mode==="fixed"||s.mode==="direction"?(ie(),Jt(qe,{key:0,label:s.mode==="direction"?"角度偏移":"数值",min:s.min,max:s.max,step:s.step,"model-value":s.valueMin,"onUpdate:modelValue":n[0]||(n[0]=r=>i.$emit("update:valueMin",r))},null,8,["label","min","max","step","model-value"])):s.mode==="random"?(ie(),ae(Ke,{key:1},[Ue(qe,{label:"下限",min:s.min,max:s.max,step:s.step,"model-value":s.valueMin,"onUpdate:modelValue":n[1]||(n[1]=r=>i.$emit("update:valueMin",r))},null,8,["min","max","step","model-value"]),Ue(qe,{label:"上限",min:s.min,max:s.max,step:s.step,"model-value":s.valueMax,"onUpdate:modelValue":n[2]||(n[2]=r=>i.$emit("update:valueMax",r))},null,8,["min","max","step","model-value"])],64)):(ie(),ae(Ke,{key:2},[M("div",RF,[Ue(qe,{label:"范围下限",min:s.min,max:s.max,step:s.step,"model-value":s.valueMin,"onUpdate:modelValue":n[3]||(n[3]=r=>i.$emit("update:valueMin",r))},null,8,["min","max","step","model-value"]),Ue(qe,{label:"范围上限",min:s.min,max:s.max,step:s.step,"model-value":s.valueMax,"onUpdate:modelValue":n[4]||(n[4]=r=>i.$emit("update:valueMax",r))},null,8,["min","max","step","model-value"])]),M("div",PF,[Ue(xn,{"model-value":s.curve,"default-value":s.defaultCurve,"onUpdate:modelValue":n[5]||(n[5]=r=>i.$emit("update:curve",r))},null,8,["model-value","default-value"]),M("div",kF,[n[6]||(n[6]=M("span",null,"0",-1)),M("span",null,Xe(s.curveLabel),1),n[7]||(n[7]=M("span",null,"1",-1))])])],64))]))}}),jn=Gs(FF,[["__scopeId","data-v-7a931847"]]),OF={class:"gradient-editor"},BF=["title","onClick","onDblclick","onPointerdown"],LF={key:0,class:"gradient-controls"},DF=["value"],NF=["value"],UF={class:"gradient-position"},XF=["value"],VF=["disabled"],YF=$s({__name:"ColorGradientEditor",props:{modelValue:{}},emits:["update:modelValue"],setup(s,{emit:e}){const t=s,i=e,n=lt(null),r=lt(0),a=vt(()=>t.modelValue[r.value]||null),o=vt(()=>[...t.modelValue].sort((R,P)=>R.position-P.position)),h=vt(()=>{const R=o.value;return R.length?`linear-gradient(90deg, ${R.map(P=>`${P.color} ${l(P.position)*100}%`).join(", ")})`:"#ffffff"});fs(()=>t.modelValue.length,R=>{r.value>=R&&(r.value=Math.max(0,R-1))});function l(R){return Math.min(1,Math.max(0,Number(R)||0))}function c(){return t.modelValue.map(R=>({position:l(R.position),color:R.color}))}function u(R,P){const F=c();F[R]&&(F[R]={...F[R],...P},i("update:modelValue",F))}function d(R){u(r.value,{color:R.target.value})}function f(R){var I;const P=R.target,F=_(P.value,((I=a.value)==null?void 0:I.color)||"#ffffff");P.value=F,u(r.value,{color:F})}function p(R){const P=R.target;f(R),P.blur()}function m(R){const P=Number(R.target.value);Number.isFinite(P)&&u(r.value,{position:l(P/100)})}function g(R){const P=c();P.push({position:l(R),color:A(P,R)}),r.value=P.length-1,i("update:modelValue",P)}function v(R){if(!n.value)return;const P=n.value.getBoundingClientRect();g((R.clientX-P.left)/Math.max(1,P.width))}function b(){const R=o.value;let P=.5;if(R.length>1){let F=-1;for(let I=0;IF&&(F=k,P=(R[I].position+R[I+1].position)/2)}}g(P)}function y(R){if(t.modelValue.length<=2||R<0)return;const P=c().filter((F,I)=>I!==R);r.value=Math.min(R,P.length-1),i("update:modelValue",P)}function w(R,P){if(!n.value)return;r.value=P;const F=k=>{const B=n.value.getBoundingClientRect();u(P,{position:l((k.clientX-B.left)/Math.max(1,B.width))})},I=()=>{window.removeEventListener("pointermove",F),window.removeEventListener("pointerup",I),window.removeEventListener("pointercancel",I)};window.addEventListener("pointermove",F),window.addEventListener("pointerup",I),window.addEventListener("pointercancel",I),R.preventDefault()}function A(R,P){const F=[...R].sort((I,k)=>I.position-k.position);if(!F.length)return"#ffffff";if(P<=F[0].position)return F[0].color;if(P>=F[F.length-1].position)return F[F.length-1].color;for(let I=0;IB.position)continue;const D=(P-k.position)/Math.max(1e-4,B.position-k.position);return T(k.color,B.color,D)}return F[F.length-1].color}function T(R,P,F){const I=U=>{const L=parseInt(U.replace("#","").padEnd(6,"0").slice(0,6),16);return[L>>16&255,L>>8&255,L&255]},k=I(R),B=I(P),D=U=>Math.round(k[U]+(B[U]-k[U])*F);return`#${[D(0),D(1),D(2)].map(U=>U.toString(16).padStart(2,"0")).join("")}`}function _(R,P){let F=R.trim().replace(/^#/,"");return/^[0-9a-f]{3}$/i.test(F)&&(F=F.split("").map(I=>I+I).join("")),/^[0-9a-f]{6}$/i.test(F)?`#${F.toLowerCase()}`:P}return(R,P)=>(ie(),ae("div",OF,[M("div",{ref_key:"bar",ref:n,class:"gradient-bar",style:Li({background:h.value}),title:"双击色带添加色标",onDblclick:v},[(ie(!0),ae(Ke,null,ci(s.modelValue,(F,I)=>(ie(),ae("button",{key:I,type:"button",class:Ze(["gradient-stop",{selected:I===r.value}]),style:Li({left:`${l(F.position)*100}%`,"--stop-color":F.color}),title:`${Math.round(l(F.position)*100)}% · ${F.color}`,onClick:bt(k=>r.value=I,["stop"]),onDblclick:bt(k=>y(I),["stop"]),onPointerdown:bt(k=>w(k,I),["stop"])},null,46,BF))),128))],36),a.value?(ie(),ae("div",LF,[M("input",{type:"color",class:"gradient-color",value:a.value.color,"aria-label":"色标颜色",onInput:d},null,40,DF),M("input",{type:"text",class:"gradient-hex-input",value:a.value.color,"aria-label":"色标颜色值",spellcheck:"false",onChange:f,onKeydown:Ea(p,["enter"])},null,40,NF),M("label",UF,[M("input",{type:"number",min:"0",max:"100",step:"1",value:Math.round(l(a.value.position)*100),"aria-label":"色标位置",onInput:m},null,40,XF),P[1]||(P[1]=M("span",null,"%",-1))]),M("button",{type:"button",class:"gradient-action",title:"在中间新增颜色",onClick:b},"+"),M("button",{type:"button",class:"gradient-action danger",title:"删除当前色标",disabled:s.modelValue.length<=2,onClick:P[0]||(P[0]=F=>y(r.value))},"×",8,VF)])):Ve("",!0),P[2]||(P[2]=M("div",{class:"gradient-hint"},"双击色带新增 · 拖动色标调整位置 · 双击色标删除",-1))]))}}),Wv=Gs(YF,[["__scopeId","data-v-8816e4a4"]]),$F={class:"image-card"},GF={class:"imgrow"},HF=["title"],jF=["src","alt"],WF={key:1,viewBox:"0 0 24 24",width:"22",height:"22",fill:"none",stroke:"#8a93bb","stroke-width":"1.6"},zF={class:"img-fields"},qF={key:0,class:"row"},KF={class:"row"},ZF=["placeholder"],JF={class:"img-actions"},QF=["title"],e3=["disabled"],t3={class:"thumb-note"},i3={key:0,class:"row"},s3={class:"row"},n3={class:"row"},r3={class:"sequence-note"},a3={class:"resource-weight-row"},o3=["disabled","title"],l3={key:0,viewBox:"0 0 24 24","aria-hidden":"true"},c3={key:1,viewBox:"0 0 24 24","aria-hidden":"true"},h3=$s({__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(s,{emit:e}){const t=s,i=e,n=vt(()=>{var l,c;if(t.resource.imageMode==="sequence"){const u=t.resource.sequenceFrames||[];if(!u.length)return"未选择序列帧";const d=((l=u[0])==null?void 0:l.name)||"第 1 帧",f=((c=u[u.length-1])==null?void 0:c.name)||d;return u.length===1?`1 帧 · ${d}`:`${u.length} 帧 · ${d} → ${f}`}const h=t.resource.textureName||t.defaultFile.replace(/\.[^.]+$/,"");return h.includes(".")?h:`${h}.png`}),r=vt(()=>{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}),a=vt(()=>{var u,d;const h=t.resource.sequenceFrames||[];if(!h.length)return"未选择序列帧";const l=((u=h[0])==null?void 0:u.name)||"第一张图片",c=((d=h[h.length-1])==null?void 0:d.name)||"最后一张图片";return`已选择 ${h.length} 帧,按 ${l}-${c} 顺序播放`});function o(){t.supportsSequence&&t.resource.imageMode==="sequence"?i("pickSequence",t.resource.id):i("pick",t.resource.id)}return(h,l)=>(ie(),ae("div",$F,[M("div",GF,[M("button",{class:"img-thumb",title:s.supportsSequence&&s.resource.imageMode==="sequence"?"选择序列帧图片":"选择本地图片",onClick:o},[r.value?(ie(),ae("img",{key:0,src:r.value,alt:s.resource.textureName},null,8,jF)):(ie(),ae("svg",WF,[...l[10]||(l[10]=[M("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"},null,-1),M("circle",{cx:"8.5",cy:"8.5",r:"1.6"},null,-1),M("path",{d:"M21 15l-5-5-9 9"},null,-1)])]))],8,HF),M("div",zF,[s.showFolder?(ie(),ae("label",qF,[l[11]||(l[11]=M("span",null,"子文件夹",-1)),ye(M("input",{"onUpdate:modelValue":l[0]||(l[0]=c=>s.resource.textureFolder=c),type:"text",class:"inp",placeholder:"subfolder/"},null,512),[[ht,s.resource.textureFolder]])])):Ve("",!0),M("label",KF,[l[12]||(l[12]=M("span",null,"名称",-1)),ye(M("input",{"onUpdate:modelValue":l[1]||(l[1]=c=>s.resource.textureName=c),type:"text",class:"inp",placeholder:s.namePlaceholder},null,8,ZF),[[ht,s.resource.textureName]])])]),M("div",JF,[M("button",{class:"mini-btn2",title:`恢复 ${s.defaultFile}`,onClick:l[2]||(l[2]=c=>h.$emit("reset",s.resource.id))},"⟳",8,QF),M("button",{class:"mini-btn2",title:"删除图片资源",disabled:s.resourceCount===1,onClick:l[3]||(l[3]=c=>h.$emit("remove",s.resource.id))},"🗑",8,e3)])]),M("div",t3,Xe(n.value),1),s.supportsSequence?(ie(),ae("label",i3,[l[14]||(l[14]=M("span",null,"图片模式",-1)),ye(M("select",{"onUpdate:modelValue":l[4]||(l[4]=c=>s.resource.imageMode=c),class:"inp"},[...l[13]||(l[13]=[M("option",{value:"fixed"},"固定",-1),M("option",{value:"sequence"},"序列帧",-1)])],512),[[Ht,s.resource.imageMode]])])):Ve("",!0),s.supportsSequence&&s.resource.imageMode==="sequence"?(ie(),ae(Ke,{key:1},[M("label",s3,[l[16]||(l[16]=M("span",null,"播放模式",-1)),ye(M("select",{"onUpdate:modelValue":l[5]||(l[5]=c=>s.resource.sequencePlayback=c),class:"inp"},[...l[15]||(l[15]=[M("option",{value:"once-hide"},"单次-尾帧消失",-1),M("option",{value:"once-hold"},"单次-尾帧固定",-1),M("option",{value:"loop-forward"},"正向循环",-1),M("option",{value:"loop-reverse"},"反向循环",-1)])],512),[[Ht,s.resource.sequencePlayback]])]),M("label",n3,[l[17]||(l[17]=M("span",null,"播放帧率",-1)),ye(M("input",{"onUpdate:modelValue":l[6]||(l[6]=c=>s.resource.sequenceFps=c),type:"number",min:"1",max:"120",step:"1",class:"inp"},null,512),[[ht,s.resource.sequenceFps,void 0,{number:!0}]])]),M("button",{class:"sequence-pick",onClick:l[7]||(l[7]=c=>h.$emit("pickSequence",s.resource.id))},"选择序列帧(多选)"),M("div",r3,Xe(a.value),1)],64)):Ve("",!0),M("div",a3,[Ue(qe,{class:"resource-weight-control",label:"占比%",min:0,max:100,step:1,"model-value":s.resource.weight,disabled:s.resource.locked||s.resourceCount===1,"onUpdate:modelValue":l[8]||(l[8]=c=>h.$emit("updateWeight",s.resource.id,c))},null,8,["model-value","disabled"]),M("button",{class:Ze(["weight-lock",{on:s.resource.locked}]),disabled:s.resourceCount===1,title:s.resource.locked?"解除占比锁定":"锁定当前占比",onClick:l[9]||(l[9]=c=>h.$emit("toggleLock",s.resource.id))},[s.resource.locked?(ie(),ae("svg",l3,[...l[18]||(l[18]=[M("rect",{x:"5",y:"10",width:"14",height:"10",rx:"2"},null,-1),M("path",{d:"M8 10V7a4 4 0 0 1 8 0v3"},null,-1)])])):(ie(),ae("svg",c3,[...l[19]||(l[19]=[M("rect",{x:"5",y:"10",width:"14",height:"10",rx:"2"},null,-1),M("path",{d:"M16 10V7a4 4 0 0 0-7.5-2"},null,-1)])]))],10,o3)]),XM(h.$slots,"default",{},void 0)]))}}),zv=Gs(h3,[["__scopeId","data-v-7a2d016a"]]),u3={class:"spine-editor"},d3={class:"field wide"},f3={class:"grid three"},m3={class:"field"},p3={class:"field"},g3={class:"field"},v3={class:"grid three"},y3={class:"field"},x3={class:"field"},b3={class:"field"},w3=["disabled"],S3={class:"asset-row"},M3=["title"],_3={class:"asset-row"},T3=["title"],A3={class:"asset-row"},E3=["title"],C3={class:"asset-actions"},I3=["disabled"],R3={class:"runtime-note"},P3={key:0},k3={key:0,class:"error"},F3={class:"section-box"},O3={key:0,class:"empty"},B3={key:1,class:"field wide"},L3=["value"],D3={class:"section-box"},N3={class:"tree-title-row"},U3=["disabled","title"],X3={key:0,class:"empty"},V3={key:1,class:"bone-search"},Y3={key:2,class:"empty"},$3={key:3,class:"bone-tree"},G3=["onClick","onKeydown"],H3=["title","onClick"],j3={key:1,class:"bone-leaf"},W3={class:"bone-name"},z3=$s({__name:"SpineObjectPanel",props:{spineObject:{}},setup(s){const e=s,t=Kl(),i=lt(null),n=lt(null),r=lt(null),a=lt(null),o=lt(new Set),h=lt(""),l=lt(null),c=lt(null),u=lt([]);e.spineObject.selectedBone==null&&(e.spineObject.selectedBone=""),e.spineObject.sourceBundle==null&&(e.spineObject.sourceBundle=null),e.spineObject.dataVersion==null&&(e.spineObject.dataVersion="");const d=vt(()=>{var N;return((N=l.value)==null?void 0:N.name)||e.spineObject.skeletonFileName}),f=vt(()=>{var N;return((N=c.value)==null?void 0:N.name)||e.spineObject.atlasFileName}),p=vt(()=>u.value.length?u.value.map(N=>N.name):e.spineObject.textureFileNames),m=vt(()=>p.value.length?`${p.value.length} 张:${p.value.join(", ")}`:"PNG / JPEG / WebP..."),g=vt(()=>new Set(e.spineObject.bones.map(N=>N.parent).filter(N=>!!N))),v=vt(()=>new Map(e.spineObject.bones.map(N=>[N.name,N]))),b=vt(()=>e.spineObject.bones.filter(N=>{var E;const O=h.value.trim().toLocaleLowerCase();if(O)return N.name.toLocaleLowerCase().includes(O);let X=N.parent;for(;X;){if(o.value.has(X))return!1;X=((E=v.value.get(X))==null?void 0:E.parent)||null}return!0})),y=vt(()=>g.value.size>0&&[...g.value].every(N=>o.value.has(N)));function w(N){const O=e.spineObject.selectedBone===N;for(const X of t.spines)X.selectedBone="";O||(e.spineObject.selectedBone=N)}function A(N){o.value.has(N)?o.value.delete(N):o.value.add(N)}function T(){o.value=y.value?new Set:new Set(g.value)}function _(N){var O;return((O=N.target.files)==null?void 0:O[0])||null}function R(N){l.value=_(N)}function P(N){c.value=_(N)}function F(N){u.value=Array.from(N.target.files||[])}function I(N){return N.name.replace(/\.[^.]+$/,"").toLocaleLowerCase()}async function k(N){const O=Array.from(N.target.files||[]);if(!O.length)return;const X=O.filter(K=>/\.(json|skel)$/i.test(K.name)),E=O.filter(K=>/\.atlas$/i.test(K.name)),V=O.filter(K=>/\.(png|jpe?g|webp|wepb)$/i.test(K.name)),q=E.map(K=>({atlas:K,skeleton:X.find(fe=>I(fe)===I(K))})).find(K=>K.skeleton),W=(q==null?void 0:q.skeleton)||X[0]||null,J=(q==null?void 0:q.atlas)||E[0]||null;if(l.value=W,c.value=J,u.value=V,!W||!J||!V.length){const K=[!W&&"JSON / SKEL",!J&&"Atlas",!V.length&&"纹理图片"].filter(Boolean).join("、");e.spineObject.status="error",e.spineObject.error=`所选文件夹缺少:${K}`;return}await U()}function B(){t.recalcTotalFrames()}function D(){B(),t.timeline.frame=0}async function U(){var X;const N=l.value,O=c.value;if(!N||!O||!u.value.length){e.spineObject.status="error",e.spineObject.error="请依次选择 Spine 数据、Atlas 和全部纹理图片";return}e.spineObject.status="loading",e.spineObject.error="";try{const E=await xw(N,O,u.value);Au(e.spineObject.id,E),e.spineObject.skeletonFileName=N.name,e.spineObject.atlasFileName=O.name,e.spineObject.textureFileNames=u.value.map(V=>V.name),e.spineObject.dataVersion=E.dataVersion,e.spineObject.animations=E.animations,e.spineObject.bones=E.bones,e.spineObject.selectedBone="",h.value="",o.value=new Set,e.spineObject.selectedAnimation=((X=E.animations[0])==null?void 0:X.name)||"",e.spineObject.assetVersion++,e.spineObject.status="ready",B(),t.timeline.frame=0;try{e.spineObject.sourceBundle=await PP(N,O,u.value)}catch(V){e.spineObject.sourceBundle=null,console.warn("Spine 配置资源嵌入失败",V)}}catch(E){e.spineObject.status="error",e.spineObject.error=E instanceof Error?E.message:String(E)}}function L(){ql(e.spineObject.id),l.value=null,c.value=null,u.value=[],i.value&&(i.value.value=""),n.value&&(n.value.value=""),r.value&&(r.value.value=""),a.value&&(a.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="",o.value=new Set,e.spineObject.selectedAnimation="",e.spineObject.assetVersion++,e.spineObject.status="empty",e.spineObject.error="",B()}return(N,O)=>(ie(),ae("div",u3,[O[30]||(O[30]=M("div",{class:"editor-title"},"Spine 属性",-1)),M("label",d3,[O[15]||(O[15]=M("span",null,"Spine 名称",-1)),ye(M("input",{"onUpdate:modelValue":O[0]||(O[0]=X=>s.spineObject.name=X)},null,512),[[ht,s.spineObject.name]])]),M("div",f3,[M("label",m3,[O[16]||(O[16]=M("span",null,"X 位置",-1)),ye(M("input",{"onUpdate:modelValue":O[1]||(O[1]=X=>s.spineObject.x=X),type:"number"},null,512),[[ht,s.spineObject.x,void 0,{number:!0}]])]),M("label",p3,[O[17]||(O[17]=M("span",null,"Y 位置",-1)),ye(M("input",{"onUpdate:modelValue":O[2]||(O[2]=X=>s.spineObject.y=X),type:"number"},null,512),[[ht,s.spineObject.y,void 0,{number:!0}]])]),M("label",g3,[O[18]||(O[18]=M("span",null,"旋转",-1)),ye(M("input",{"onUpdate:modelValue":O[3]||(O[3]=X=>s.spineObject.rotation=X),type:"number"},null,512),[[ht,s.spineObject.rotation,void 0,{number:!0}]])])]),M("div",v3,[M("label",y3,[O[19]||(O[19]=M("span",null,"Scale X",-1)),ye(M("input",{"onUpdate:modelValue":O[4]||(O[4]=X=>s.spineObject.scaleX=X),type:"number",step:"0.05"},null,512),[[ht,s.spineObject.scaleX,void 0,{number:!0}]])]),M("label",x3,[O[20]||(O[20]=M("span",null,"Scale Y",-1)),ye(M("input",{"onUpdate:modelValue":O[5]||(O[5]=X=>s.spineObject.scaleY=X),type:"number",step:"0.05"},null,512),[[ht,s.spineObject.scaleY,void 0,{number:!0}]])]),M("label",b3,[O[21]||(O[21]=M("span",null,"开始时间",-1)),ye(M("input",{"onUpdate:modelValue":O[6]||(O[6]=X=>s.spineObject.timeOffset=X),type:"number",min:"0",step:"0.033333",onChange:B},null,544),[[ht,s.spineObject.timeOffset,void 0,{number:!0}]])])]),O[31]||(O[31]=M("div",{class:"divider"},null,-1)),O[32]||(O[32]=M("div",{class:"section-title"},"Spine 资源",-1)),M("input",{ref_key:"skeletonInput",ref:i,hidden:"",type:"file",accept:".json,.skel,application/json,application/octet-stream",onChange:R},null,544),M("input",{ref_key:"atlasInput",ref:n,hidden:"",type:"file",accept:".atlas,text/plain",onChange:P},null,544),M("input",{ref_key:"textureInput",ref:r,hidden:"",type:"file",multiple:"",accept:".png,.jpg,.jpeg,.webp,.wepb,image/png,image/jpeg,image/webp",onChange:F},null,544),M("input",{ref_key:"folderInput",ref:a,hidden:"",type:"file",multiple:"",webkitdirectory:"",directory:"",onChange:k},null,544),M("button",{class:"folder-select",disabled:s.spineObject.status==="loading",onClick:O[7]||(O[7]=X=>{var E;return(E=a.value)==null?void 0:E.click()})},"选择文件夹并加载",8,w3),O[33]||(O[33]=M("div",{class:"folder-hint"},"一次读取文件夹中的 JSON / SKEL、Atlas 和全部纹理;仍可在下方单独替换资源。",-1)),M("div",S3,[M("div",{class:"asset-name",title:d.value},Xe(d.value||"JSON / SKEL..."),9,M3),M("button",{onClick:O[8]||(O[8]=X=>{var E;return(E=i.value)==null?void 0:E.click()})},"选择")]),M("div",_3,[M("div",{class:"asset-name",title:f.value},Xe(f.value||"Atlas..."),9,T3),M("button",{onClick:O[9]||(O[9]=X=>{var E;return(E=n.value)==null?void 0:E.click()})},"选择")]),M("div",A3,[M("div",{class:"asset-name",title:p.value.join(", ")},Xe(m.value),9,E3),M("button",{onClick:O[10]||(O[10]=X=>{var E;return(E=r.value)==null?void 0:E.click()})},"选择(多选)")]),M("div",C3,[M("button",{class:"load",disabled:s.spineObject.status==="loading",onClick:U},Xe(s.spineObject.status==="loading"?"加载中…":"↧ 加载"),9,I3),M("button",{class:"clear",onClick:L},"清除")]),M("div",R3,[O[22]||(O[22]=Qt(" 支持 Spine 3.8 / 4.0 / 4.1 / 4.2 / 4.3 JSON · 对应版本运行时按需加载 · 本地离线 ",-1)),s.spineObject.dataVersion?(ie(),ae("span",P3," · 当前资源 "+Xe(s.spineObject.dataVersion),1)):Ve("",!0)]),s.spineObject.error?(ie(),ae("div",k3,Xe(s.spineObject.error),1)):Ve("",!0),M("div",F3,[O[25]||(O[25]=M("div",{class:"section-title"},"Spine 动画",-1)),s.spineObject.animations.length?(ie(),ae("label",B3,[O[24]||(O[24]=M("span",null,"时间轴播放动画",-1)),ye(M("select",{"onUpdate:modelValue":O[11]||(O[11]=X=>s.spineObject.selectedAnimation=X),onChange:D},[O[23]||(O[23]=M("option",{value:""},"无",-1)),(ie(!0),ae(Ke,null,ci(s.spineObject.animations,X=>(ie(),ae("option",{key:X.name,value:X.name},Xe(X.name)+"("+Xe(X.duration.toFixed(2))+"s) ",9,L3))),128))],544),[[Ht,s.spineObject.selectedAnimation]])])):(ie(),ae("div",O3,"无可用动画"))]),M("div",D3,[M("div",N3,[O[29]||(O[29]=M("div",{class:"section-title"},"层级树",-1)),M("button",{class:Ze(["selected-bone",{active:s.spineObject.selectedBone}]),disabled:!s.spineObject.selectedBone,title:s.spineObject.selectedBone?"点击清除骨骼选择":"当前未选择骨骼",onClick:O[12]||(O[12]=X=>s.spineObject.selectedBone="")},[s.spineObject.selectedBone?(ie(),ae(Ke,{key:0},[O[26]||(O[26]=Qt("清除选中骨骼:",-1)),M("strong",null,Xe(s.spineObject.selectedBone),1)],64)):(ie(),ae(Ke,{key:1},[O[27]||(O[27]=Qt("当前骨骼:",-1)),O[28]||(O[28]=M("strong",null,"未选择",-1))],64))],10,U3),s.spineObject.bones.length?(ie(),ae("button",{key:0,class:"tree-action",onClick:T},Xe(y.value?"全部展开":"全部折叠"),1)):Ve("",!0)]),s.spineObject.bones.length?(ie(),ae("div",V3,[ye(M("input",{"onUpdate:modelValue":O[13]||(O[13]=X=>h.value=X),type:"search","aria-label":"搜索骨骼",placeholder:"搜索骨骼名称…"},null,512),[[ht,h.value,void 0,{trim:!0}]]),h.value?(ie(),ae("button",{key:0,title:"清空搜索","aria-label":"清空骨骼搜索",onClick:O[14]||(O[14]=X=>h.value="")},"✕")):Ve("",!0)])):(ie(),ae("div",X3,"未加载 Spine")),s.spineObject.bones.length&&!b.value.length?(ie(),ae("div",Y3,"未找到匹配的骨骼")):s.spineObject.bones.length?(ie(),ae("div",$3,[(ie(!0),ae(Ke,null,ci(b.value,X=>(ie(),ae("div",{key:X.name,class:Ze(["bone",{selected:s.spineObject.selectedBone===X.name}]),style:Li({paddingLeft:`${6+X.depth*16}px`}),role:"button",tabindex:"0",onClick:E=>w(X.name),onKeydown:Ea(bt(E=>w(X.name),["prevent"]),["enter"])},[g.value.has(X.name)?(ie(),ae("button",{key:0,class:"bone-toggle",title:o.value.has(X.name)?"展开子骨骼":"折叠子骨骼",onClick:bt(E=>A(X.name),["stop"])},Xe(o.value.has(X.name)?"▸":"▾"),9,H3)):(ie(),ae("span",j3,"•")),M("span",W3,Xe(X.name),1)],46,G3))),128))])):Ve("",!0)])]))}}),q3=Gs(z3,[["__scopeId","data-v-3af7b738"]]),xi=Da({visible:!1,title:"",detail:"",progress:0,indeterminate:!1,failed:!1});let Bc=0;function K3(s){return new Promise(e=>window.setTimeout(e,s))}function qv(s,e){const t=++Bc,i=performance.now();Object.assign(xi,{visible:!0,title:s,detail:e,progress:0,indeterminate:!1,failed:!1});const n=(a,o)=>{t===Bc&&(xi.indeterminate=a==null,a!=null&&(xi.progress=Math.min(100,Math.max(0,a))),o&&(xi.detail=o))},r=async(a,o)=>{if(t!==Bc)return;xi.failed=a,xi.indeterminate=!1,xi.progress=a?xi.progress:100,xi.detail=o,await K3(Math.max(180,(a?850:450)-(performance.now()-i))),t===Bc&&(xi.visible=!1)};return{update:n,paint:()=>new Promise(a=>requestAnimationFrame(()=>a())),finish:(a="已完成")=>r(!1,a),fail:(a="操作失败")=>r(!0,a)}}async function Z3(s,e){if(!s.body)return e(null),s.text();const t=Number(s.headers.get("content-length")),i=Number.isFinite(t)&&t>0,n=s.body.getReader(),r=new TextDecoder;let a=0,o="";for(e(i?0:null);;){const{done:h,value:l}=await n.read();if(h)break;a+=l.byteLength,o+=r.decode(l,{stream:!0}),e(i?Math.min(1,a/t):null)}return o+=r.decode(),i&&e(1),o}const J3="3.8";function Ns(s,e,t){s[e]==null&&s[t]!=null&&(s[e]=s[t]),delete s[t]}function Rm(s){if(!s||typeof s!="object")return;if(Array.isArray(s)){for(const t of s)Rm(t);return}const e=s;Array.isArray(e.curve)&&delete e.curve;for(const t of Object.values(e))Rm(t)}function Q3(s){for(const e of s.bones)Ns(e,"transform","inherit");for(const e of s.transform||[])Ns(e,"rotateMix","mixRotate"),e.translateMix==null&&(e.translateMix=e.mixX??e.mixY),e.scaleMix==null&&(e.scaleMix=e.mixScaleX??e.mixScaleY),Ns(e,"shearMix","mixShearY"),delete e.mixX,delete e.mixY,delete e.mixScaleX,delete e.mixScaleY;for(const e of s.path||[])Ns(e,"rotateMix","mixRotate"),e.translateMix==null&&(e.translateMix=e.mixX??e.mixY),delete e.mixX,delete e.mixY;for(const e of s.skins)for(const t of Object.values(e.attachments||{}))for(const i of Object.values(t||{}))i.parent!=null&&Ns(i,"deform","timelines")}function eO(s){for(const e of Object.values(s.slots||{}))Ns(e,"color","rgba"),Ns(e,"twoColor","rgba2")}function tO(s){for(const e of Object.values(s.bones||{}))for(const t of e.rotate||[])Ns(t,"angle","value")}function iO(s){for(const e of Object.values(s.transform||{}))for(const t of e)Ns(t,"rotateMix","mixRotate"),t.translateMix==null&&(t.translateMix=t.mixX??t.mixY),t.scaleMix==null&&(t.scaleMix=t.mixScaleX??t.mixScaleY),Ns(t,"shearMix","mixShearY"),delete t.mixX,delete t.mixY,delete t.mixScaleX,delete t.mixScaleY}function sO(s){for(const e of Object.values(s.path||{})){for(const t of["position","spacing"])for(const i of e[t]||[])Ns(i,t,"value");for(const t of e.mix||[])Ns(t,"rotateMix","mixRotate"),t.translateMix==null&&(t.translateMix=t.mixX??t.mixY),delete t.mixX,delete t.mixY}}function nO(s){if(!s.attachments)return;const e=s.deform||(s.deform={});for(const[t,i]of Object.entries(s.attachments)){const n=e[t]||(e[t]={});for(const[r,a]of Object.entries(i)){const o=n[r]||(n[r]={});for(const[h,l]of Object.entries(a))l.deform&&(o[h]=l.deform)}}delete s.attachments}function rO(s){s.skeleton.spine=J3,Q3(s);for(const e of Object.values(s.animations))eO(e),tO(e),iO(e),sO(e),nO(e);return Rm(s.animations),s}function aO(s,e,t,i){const n=t.frame-e.frame,r=n<=0?0:(s.frame-e.frame)/n;let a=0;for(let o=0;o[...i].sort((a,o)=>a-o);let r=!0;for(;r;){r=!1;const a=n();for(let o=0;ou&&(u=f,c=d)}c>=0&&(i.add(c),r=!0)}}return n().map(a=>s[a])}function Kv(s,e,t,i,n){const r=t-e+1;if(r<2)return 0;const a=n?e:t,o=n?e+1:t-1,h=n?e+2:t-2,l=Math.abs(s[o].frame-s[a].frame);if(r>=3&&l>0&&Math.abs(Math.abs(s[h].frame-s[o].frame)-l)<1e-6){const u=s[a].values[i],d=s[o].values[i],f=s[h].values[i];return n?(-3*u+4*d-f)/(2*l):(3*u-4*d+f)/(2*l)}const c=s[o].frame-s[a].frame;return c?(s[o].values[i]-s[a].values[i])/c:0}function Zv(s,e,t){const i=s[t].frame-s[e].frame,n=[];for(let r=0;rd.values[r])),l=Math.max(...s.slice(e,t+1).map(d=>d.values[r])),c=a+Kv(s,e,t,r,!0)*i/3,u=o-Kv(s,e,t,r,!1)*i/3;n.push([Math.max(h,Math.min(l,c)),Math.max(h,Math.min(l,u))])}return{values:n}}function oO(s,e,t,i,n){const r=1-n;return r*r*r*s+3*r*r*n*e+3*r*n*n*t+n*n*n*i}function lO(s,e,t,i,n){const r=t.frame-e.frame,a=r<=0?0:(s.frame-e.frame)/r;let o=0;for(let h=0;h[...i].sort((o,h)=>o-h);let r=!0;for(;r;){r=!1;const o=n();for(let h=0;hf&&(f=m,d=p)}d>=0&&(i.add(d),r=!0)}}const a=n();return{samples:a.map(o=>s[o]),controls:a.slice(0,-1).map((o,h)=>Zv(s,o,a[h+1]))}}function cO(s){if(!s.length)return[];const e=[s[0]];for(let t=1;t180;)i-=360;for(;i-e[t-1]<-180;)i+=360;e.push(i)}return e}function _i(s){if(!Number.isFinite(s))return 0;const e=Math.round(s*1e5)/1e5;return Object.is(e,-0)?0:e}function hO(s,e,t,i){const n=Math.max(2,Math.min(16,Math.round(Number(s.trailGridRows)||2))),r=Math.max(2,Math.min(32,Math.round(Number(s.trailGridCols)||2))),a=Math.max(2,t.length),o=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),d=[],f=[],p=[],m=[],g=[];for(let y=0;y=0;y--)g.push({col:y,row:n-1});for(let y=n-2;y>=1;y--)g.push({col:0,row:y});const v=g.length;for(let y=1;y|\s]+/g,"_").replace(/^_+|_+$/g,"")||e}function kw(s,e){let t=s,i=2;for(;e.has(t);)t=`${s}_${i++}`;return e.add(t),t}function dO(s){return s.replace(/\.[^./\\]+$/,"")}function Fw(s,e){return dO([s,e].filter(Boolean).join("/").replace(/\\/g,"/").replace(/\/{2,}/g,"/").replace(/^\.\//,""))}function fO(s){var i,n;const e=Number(((i=s==null?void 0:s.orig)==null?void 0:i.width)??(s==null?void 0:s.width))||0,t=Number(((n=s==null?void 0:s.orig)==null?void 0:n.height)??(s==null?void 0:s.height))||0;return{width:e,height:t}}function Dc(s){return Math.round(Math.max(0,Math.min(1,s))*255).toString(16).padStart(2,"0")}function iy(s,e){return[(s>>16&255)/255,(s>>8&255)/255,(s&255)/255,Math.max(0,Math.min(1,e))]}function yl(s,e){return _i(s/e)}function mO(s,e){const t=s.config,i=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;return t.mode!=="stream"?r=n+i:t.streamBehavior!=="loop"?r=n+Math.max(1/e,Number(t.duration)||0)+i:r=n+Xr(t,e).total/e,Math.max(1,Math.ceil(r*e)+1)}function Yh(s,e){return e?s.boneName:`${s.spawnId??"legacy"}_${s.boneName}`}function pO(s,e,t){const i=new Set;for(const n of s)for(const r of n)i.add(Yh(r,e));return[...i].sort().map((n,r)=>({key:n,name:kw(`_particle_${String(r).padStart(3,"0")}`,t),states:s.map(a=>a.find(o=>Yh(o,e)===n)||null)}))}function gO(s,e,t,i){const n=e*t/i,r=Math.min(s.states.length-1,Math.max(0,Math.floor(n))),a=Math.min(s.states.length-1,r+1),o=s.states[r],h=s.states[a];if(!o||!h||Yh(o,!0)!==Yh(h,!0)||o.spawnId!==h.spawnId)return o;const l=n-r;if(l<=1e-6)return o;const c=(d,f)=>(d??0)+((f??d??0)-(d??0))*l,u=o.trailState&&h.trailState&&o.trailState.resourceId===h.trailState.resourceId?{...o.trailState,width:c(o.trailState.width,h.trailState.width),alpha:c(o.trailState.alpha,h.trailState.alpha),bones:o.trailState.bones.map((d,f)=>{const p=h.trailState.bones[f]||d;return{...d,worldX:c(d.worldX??d.x,p.worldX??p.x),worldY:c(d.worldY??d.y,p.worldY??p.y),worldRotation:c(d.worldRotation??-d.rotation,p.worldRotation??-p.rotation)}})}:o.trailState;return{...o,worldX:c(o.worldX,h.worldX),worldY:c(o.worldY,h.worldY),worldRotation:c(o.worldRotation,h.worldRotation),worldScaleX:c(o.worldScaleX,h.worldScaleX),worldScaleY:c(o.worldScaleY,h.worldScaleY),alpha:c(o.alpha,h.alpha),trailState:u}}function sy(s,e){return!s||s==="跟随导出"?e.keyframeCurve:s==="贝塞尔"?"bezier":"linear"}function eo(s,e,t,i,n,r=new Set,a=n.keyframeCurve){if(!s.length)return[];const o=a==="bezier"&&n.spineVersion!=="3.8"?Pw(s,i,r):{samples:Rw(s,i,r),controls:[]},h=o.samples.map(l=>{const c={time:yl(l.frame,e)};return t.forEach((u,d)=>{c[u]=_i(l.values[d])}),c});for(let l=0;l0&&n&&e.add(t-1),i&&e.add(t))}return e}function yO(s){const e=new Set;for(let t=0;t0&&n&&e.add(t-1),i&&e.add(t))}return e}function xO(s,e){var i;if(!s.shapeEnabled||!((i=s.shapeCurve)!=null&&i.length))return 1;const t=[...s.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{r!==n&&(i.push(t(r,a)),n=r)}),i}function wO(s,e,t){const i=s.imageMode==="sequence"?s.sequenceFrames[e]:void 0,n=(i==null?void 0:i.name)||s.textureName||`image_${s.id}`,r=(i==null?void 0:i.texture)||s.texture,a=fO(r);(!a.width||!a.height)&&t.push({code:"missing-image",message:`图片“${n}”缺失或尺寸不可读,已保留路径。`});const o=a.width||1,h=a.height||1;return{path:Fw(s.textureFolder,n),x:_i((.5-s.anchorX)*o),y:_i((s.anchorY-.5)*h),width:_i(o),height:_i(h)}}function SO(s,e,t,i,n=i.keyframeCurve){if(!s.length)return[];const r=new Set;for(let c=1;c({frame:u,values:c})),o=1/255,h=n==="bezier"&&i.spineVersion!=="3.8"?Pw(a,[o,o,o,.01],r):{samples:Rw(a,[o,o,o,.01],r),controls:[]},l=h.samples.map(c=>({time:yl(c.frame,t),color:`${Dc(c.values[0])}${Dc(c.values[1])}${Dc(c.values[2])}${Dc(c.values[3])}`}));if(h.controls.length)for(let c=0;c({time:yl(d,n),name:u??null}));h.length&&(o.attachment=h);const l=SO(i,t,n,r,a);l.length&&(o.rgba=l)}function ry(s){var p;const e=s.settings,t=Math.max(1,Number(s.timeline.fps)||30),i=Math.max(1,Math.round(e.fps||30)),n=e.integerFrameAlignment?i:t,r=[],a=s.systems.filter(m=>m.visible!==!1),o={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||(o.skeleton.fps=i);const h=o.skins[0].attachments,l=new Set(["root"]),c=[...new Set([...s.timeline.animations.length?s.timeline.animations:["animation"],...a.map(m=>m.animation||"animation")])],u=new Map;for(const m of a){const g=Math.min(((p=m.frames)==null?void 0:p.length)||0,mO(m,t)),v=(m.frames||[]).slice(0,g);v.length||r.push({code:"empty-cache",message:`“${m.config.name}”没有可用帧缓存。`});const b=kw(uO(m.config.name,`system_${m.id}`),l);o.bones.push({name:b,parent:"root"});const y=pO(v,e.bonePool,l),w=Math.max(0,(g-1)/t),A=Math.max(1,Math.ceil(w*n)+1),T=u.get(m.animation)||[];T.push({system:m,tracks:y,targetFrames:A}),u.set(m.animation,T);for(const _ of y){o.bones.push({name:_.name,parent:b});const R=new Set(m.config.imageResources.map(k=>k.blend));for(const k of R){const B=`${_.name}_image_${k}`;o.slots.push({name:B,bone:_.name,color:"ffffff00",blend:Jv[k]});const D=h[B]||(h[B]={});for(const U of m.config.imageResources.filter(L=>L.blend===k)){const L=U.imageMode==="sequence"?Math.max(1,U.sequenceFrames.length):1;for(let N=0;N{var X;return((X=O==null?void 0:O.trailState)==null?void 0:X.resourceId)===k.id}))continue;const B=Math.max(2,Math.min(16,Math.round(k.boneCount||3))),D=[];for(let O=0;Oo.bones.findIndex(X=>X.name===O)),N=Fw("",k.textureName||`trail_${k.id}`);(h[U]||(h[U]={}))[`trail_${k.id}`]=hO(m.config,k,L,N),k.texture||r.push({code:"missing-image",message:`拖尾图片“${k.textureName||k.id}”缺失,已保留路径。`})}const P=`${_.name}_image_`,F=`${_.name}_trail_`,I=o.slots.filter(k=>String(k.name).startsWith(P)||String(k.name).startsWith(F));I.length&&(o.slots=o.slots.filter(k=>!I.includes(k)),o.slots.push(...I.filter(k=>String(k.name).startsWith(F)),...I.filter(k=>String(k.name).startsWith(P))))}}for(const m of c){const g=u.get(m)||[],v={bones:{},slots:{}};let b=!1;for(const{system:y,tracks:w,targetFrames:A}of g)for(const T of w){const _=Array.from({length:A},(E,V)=>gO(T,V,t,n)),R=_.map(E=>!!(E!=null&&E.active)),P=[],F=[],I=[];_.forEach((E,V)=>{E!=null&&E.active&&(P.push({frame:V,values:[E.worldX??E.x,E.worldY??E.y]}),F.push(E.worldRotation??E.rotation),I.push({frame:V,values:[E.worldScaleX??E.scaleX,E.worldScaleY??E.scaleY]}))});const k=cO(F),B=P.map((E,V)=>({frame:E.frame,values:[k[V]??0]})),D=vO(_),U={},L=eo(P,n,["x","y"],[Qv,Qv],e,D),N=eo(B,n,["value"],[ty],e,D),O=eo(I,n,["x","y"],[Lc,Lc],e,D);L.length&&(U.translate=L),N.length&&(U.rotate=N),O.length&&(U.scale=O),Object.keys(U).length&&(v.bones[T.name]=U,b=!0);const X=new Set(y.config.imageResources.map(E=>E.blend));for(const E of X){const V=[],q=[];let W=16777215;for(let me=0;meAe.id===we.resourceId):void 0,pe=!!we&&R[me]&&we.imageVisible!==!1&&(Ee==null?void 0:Ee.blend)===E;we&&(Ee==null?void 0:Ee.blend)===E&&(W=we.colorHex),V.push(pe?`image_${Ee.id}_${we.imageFrameIndex??0}`:null),q.push(iy(W,pe?we.alpha:0))}const K=y.config.imageResources.filter(me=>me.blend===E).filter(me=>me.independentAlpha==="curve").map(me=>sy(me.alphaCurveMode,e)),fe=K.length?K.includes("bezier")?"bezier":"linear":sy(y.config.alphaMode==="curve"?y.config.curveMode:void 0,e);ny(v,`${T.name}_image_${E}`,V,q,n,e,fe),V.some(Boolean)&&(b=!0)}if(y.config.trail)for(const E of y.config.trailResources){const V=Math.max(2,Math.min(16,Math.round(E.boneCount||3))),q=_.map(Ae=>{var G;return((G=Ae==null?void 0:Ae.trailState)==null?void 0:G.resourceId)===E.id?Ae.trailState:void 0}),W=q.find(Ae=>!!Ae);if(!W)continue;const J=yO(q),K=E.widthSizeMode==="random"?Math.max(1,Number(E.widthMin)||0,Number(E.widthMax)||0):Math.max(.001,Number(E.width)||100);let fe=W;const me=q.map(Ae=>(Ae&&(fe=Ae),fe));for(let Ae=0;Ae{const Be=Oe==null?void 0:Oe.bones[Math.min(Oe.bones.length-1,Ae)];if(!Be)return;const st={x:Be.worldX??Be.x,y:Be.worldY??Be.y,rotation:Be.worldRotation??-Be.rotation};G.push({frame:Fe,values:[st.x,st.y]}),Z.push({frame:Fe,values:[st.rotation]}),z.push({frame:Fe,values:[1,Math.max(0,Oe.width/K)*te]})});const he=`${T.name}_trail_${E.id}_${Ae}`,xe={},oe=eo(G,n,["x","y"],[ey,ey],e,j),ge=eo(Z,n,["value"],[ty],e,j),le=eo(z,n,["x","y"],[Lc,Lc],e,j);oe.length&&(xe.translate=oe),ge.length&&(xe.rotate=ge),le.length&&(xe.scale=le),Object.keys(xe).length&&(v.bones[he]=xe)}const we=q.map(()=>`trail_${E.id}`);let Ee=W.colorHex;const pe=q.map(Ae=>(Ae&&(Ee=Ae.colorHex),iy(Ee,Ae?Ae.alpha:0)));ny(v,`${T.name}_trail_${E.id}`,we,pe,n,e),b=!0}}(b||!e.excludeEmptyAnimations)&&(o.animations[m]=v)}!Object.keys(o.animations).length&&!e.excludeEmptyAnimations&&(o.animations.animation={bones:{},slots:{}});const d=e.spineVersion==="3.8"?rO(o):o,f=JSON.stringify(d,null,2);return{json:d,text:f,warnings:r,particleSystemCount:a.length,animationCount:Object.keys(d.animations).length,boneCount:d.bones.length}}function MO(s,e){const t=new Blob([s.text],{type:"application/json;charset=utf-8"}),i=URL.createObjectURL(t),n=document.createElement("a");n.href=i,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(i),1e3)}class q6{constructor(){x(this,"array",[])}add(e){const t=this.contains(e);return this.array[e|0]=e|0,!t}contains(e){return this.array[e|0]!==void 0}remove(e){this.array[e|0]=void 0}clear(){this.array.length=0}}class _O{constructor(){x(this,"entries",{});x(this,"size",0)}add(e){const t=this.entries[e];return this.entries[e]=!0,t?!1:(this.size++,!0)}addAll(e){const t=this.size;for(let i=0,n=e.length;i1&&(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 _s){return t.setFromString(e)}};x(_s,"WHITE",new _s(1,1,1,1)),x(_s,"RED",new _s(1,0,0,1)),x(_s,"GREEN",new _s(0,1,0,1)),x(_s,"BLUE",new _s(0,0,1,1)),x(_s,"MAGENTA",new _s(1,0,1,1));let wt=_s;const fi=class fi{static clamp(e,t,i){return ei?i:e}static cosDeg(e){return Math.cos(e*fi.degRad)}static sinDeg(e){return Math.sin(e*fi.degRad)}static atan2Deg(e,t){return Math.atan2(e,t)*fi.radDeg}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){const t=Math.pow(Math.abs(e),.3333333333333333);return e<0?-t:t}static randomTriangular(e,t){return fi.randomTriangularWith(e,t,(e+t)*.5)}static randomTriangularWith(e,t,i){const n=Math.random(),r=t-e;return n<=(i-e)/r?e+Math.sqrt(n*r*(i-e)):t-Math.sqrt((1-n)*r*(t-i))}static isPowerOfTwo(e){return e&&(e&e-1)===0}};x(fi,"epsilon",1e-5),x(fi,"epsilon2",fi.epsilon*fi.epsilon),x(fi,"PI",3.1415927),x(fi,"PI2",fi.PI*2),x(fi,"invPI2",1/fi.PI2),x(fi,"radiansToDegrees",180/fi.PI),x(fi,"radDeg",fi.radiansToDegrees),x(fi,"degreesToRadians",fi.PI/180),x(fi,"degRad",fi.degreesToRadians);let Ye=fi;const Os=class Os{apply(e,t,i){return t===void 0||i===void 0?this.applyInternal(e):e+(t-e)*this.applyInternal(i)}};x(Os,"linear",new class extends Os{applyInternal(e){return e}}),x(Os,"smooth",new class extends Os{applyInternal(e){return e*e*(3-2*e)}}),x(Os,"slowFast",new class extends Os{applyInternal(e){return e*e}}),x(Os,"fastSlow",new class extends Os{applyInternal(e){return(e-1)*(e-1)*-1+1}}),x(Os,"circle",new class extends Os{applyInternal(e){return e<=.5?(e*=2,(1-Math.sqrt(1-e*e))/2):(e--,e*=2,(Math.sqrt(1-e*e)+1)/2)}});let To=Os;class TO extends To{constructor(t){super();x(this,"power",2);this.power=t}applyInternal(t){return t<=.5?Math.pow(t*2,this.power)/2:Math.pow((t-1)*2,this.power)/(this.power%2===0?-2:2)+1}}class K6 extends TO{constructor(e){super(e)}applyInternal(e){return Math.pow(e-1,this.power)*(this.power%2===0?-1:1)+1}}const kr=class kr{static arrayCopy(e,t,i,n,r){for(let a=t,o=n;a=t?e:kr.setArraySize(e,t,i)}static newArray(e,t){const i=[];for(let n=0;n0?this.items.pop():this.instantiator()}free(e){var t;(t=e.reset)==null||t.call(e),this.items.push(e)}freeAll(e){for(let t=0;tthis.maxDelta&&(this.delta=this.maxDelta),this.lastTime=e,this.frameCount++,this.frameTime>1&&(this.framesPerSecond=this.frameCount/this.frameTime,this.frameTime=0,this.frameCount=0)}}class Q6{constructor(e=32){x(this,"values");x(this,"addedValues",0);x(this,"lastValue",0);x(this,"mean",0);x(this,"dirty",!0);this.values=new Array(e)}hasEnoughData(){return this.addedValues>=this.values.length}addValue(e){this.addedValuesthis.values.length-1&&(this.lastValue=0),this.dirty=!0}getMean(){if(this.hasEnoughData()){if(this.dirty){let e=0;for(let t=0;t{c.width=parseInt(i[1]),c.height=parseInt(i[2])},n.format=()=>{},n.filter=c=>{c.minFilter=ct.enumValue(Io,i[1]),c.magFilter=ct.enumValue(Io,i[2])},n.repeat=c=>{i[1].indexOf("x")!==-1&&(c.uWrap=Ro.Repeat),i[1].indexOf("y")!==-1&&(c.vWrap=Ro.Repeat)},n.pma=c=>{c.pma=i[1]==="true"};var r={};r.xy=c=>{c.x=parseInt(i[1]),c.y=parseInt(i[2])},r.size=c=>{c.width=parseInt(i[1]),c.height=parseInt(i[2])},r.bounds=c=>{c.x=parseInt(i[1]),c.y=parseInt(i[2]),c.width=parseInt(i[3]),c.height=parseInt(i[4])},r.offset=c=>{c.offsetX=parseInt(i[1]),c.offsetY=parseInt(i[2])},r.orig=c=>{c.originalWidth=parseInt(i[1]),c.originalHeight=parseInt(i[2])},r.offsets=c=>{c.offsetX=parseInt(i[1]),c.offsetY=parseInt(i[2]),c.originalWidth=parseInt(i[3]),c.originalHeight=parseInt(i[4])},r.rotate=c=>{const u=i[1];u==="true"?c.degrees=90:u!=="false"&&(c.degrees=parseInt(u))},r.index=c=>{c.index=parseInt(i[1])};let a=t.readLine();for(;a&&a.trim().length===0;)a=t.readLine();for(;!(!a||a.trim().length===0||t.readEntry(i,a)===0);)a=t.readLine();let o=null,h=null,l=null;for(;a!==null;)if(a.trim().length===0)o=null,a=t.readLine();else if(o){const c=new Bw(o,a);for(;;){const u=t.readEntry(i,a=t.readLine());if(u===0)break;const d=r[i[0]];if(d)d(c);else{h||(h=[]),l||(l=[]),h.push(i[0]);const f=[];for(let p=0;p0&&l&&l.length>0&&(c.names=h,c.values=l,h=null,l=null),c.u=c.x/o.width,c.v=c.y/o.height,c.degrees===90?(c.u2=(c.x+c.height)/o.width,c.v2=(c.y+c.width)/o.height):(c.u2=(c.x+c.width)/o.width,c.v2=(c.y+c.height)/o.height),this.regions.push(c)}else{for(o=new IO(a.trim());t.readEntry(i,a=t.readLine())!==0;){const c=n[i[0]];c&&c(o)}this.pages.push(o)}}findRegion(e){for(let t=0;t=this.lines.length?null:this.lines[this.index++]}readEntry(e,t){if(!t||(t=t.trim(),t.length===0))return 0;const i=t.indexOf(":");if(i===-1)return 0;e[0]=t.substr(0,i).trim();for(let n=1,r=i+1;;n++){const a=t.indexOf(",",r);if(a===-1)return e[n]=t.substr(r).trim(),n;if(e[n]=t.substr(r,a-r).trim(),r=a+1,n===4)return 4}}}class IO{constructor(e){x(this,"name");x(this,"minFilter",Io.Nearest);x(this,"magFilter",Io.Nearest);x(this,"uWrap",Ro.ClampToEdge);x(this,"vWrap",Ro.ClampToEdge);x(this,"texture",null);x(this,"width",0);x(this,"height",0);x(this,"pma",!1);x(this,"regions",[]);this.name=e}setTexture(e){this.texture=e,e.setFilters(this.minFilter,this.magFilter),e.setWraps(this.uWrap,this.vWrap);for(const t of this.regions)t.texture=e}}class Bw extends Ow{constructor(t,i){super();x(this,"page");x(this,"name");x(this,"x",0);x(this,"y",0);x(this,"offsetX",0);x(this,"offsetY",0);x(this,"originalWidth",0);x(this,"originalHeight",0);x(this,"index",0);x(this,"degrees",0);x(this,"names",null);x(this,"values",null);this.page=t,this.name=i,t.regions.push(this)}}const qh=class qh{constructor(e){x(this,"name");x(this,"timelineAttachment");x(this,"timelineSlots",qh.empty);if(!e)throw new Error("name cannot be null.");this.name=e,this.timelineAttachment=this}isTimelineActive(e,t,i){let n=e[t];if(n.bone.isActive()){const r=(i?n.getAppliedPose():n.getPose()).getAttachment();if(r!=null&&r.timelineAttachment===this)return!0}for(let r=0,a=this.timelineSlots.length;r>1)*h;const l=i.appliedPose.deform;let c=this.vertices;const u=this.bones;if(!u){l.length>0&&(c=l);const m=i.bone.appliedPose,g=m.worldX,v=m.worldY,b=m.a,y=m.b,w=m.c,A=m.d;for(let T=n,_=o;_=this.regions.length&&(t=this.regions.length-1),t}getUVs(e){return this.uvs[e]}hasPathSuffix(){return this.pathSuffix}getPath(e,t){if(!this.pathSuffix)return e;let i=e;const n=(this.start+t).toString();for(let r=this.digits-n.length;r>0;r--)i+="0";return i+=n,i}static nextID(){return ho._nextID++}};x(ho,"_nextID",0);let ko=ho;var Gi;(function(s){s[s.hold=0]="hold",s[s.once=1]="once",s[s.loop=2]="loop",s[s.pingpong=3]="pingpong",s[s.onceReverse=4]="onceReverse",s[s.loopReverse=5]="loopReverse",s[s.pingpongReverse=6]="pingpongReverse"})(Gi||(Gi={}));const Lw=[Gi.hold,Gi.once,Gi.loop,Gi.pingpong,Gi.onceReverse,Gi.loopReverse,Gi.pingpongReverse];class Fp{constructor(e,t,i){x(this,"name");x(this,"timelines",[]);x(this,"timelineIds");x(this,"bones");x(this,"color",new wt(1,1,1,1));x(this,"duration");if(!e)throw new Error("name cannot be null.");this.name=e,this.duration=i,this.timelineIds=new _O,this.bones=[],this.setTimelines(t)}setTimelines(e){if(!e)throw new Error("timelines cannot be null.");this.timelines=e;const t=e.length;this.timelineIds.clear(),this.bones.length=0;const i=new Set,n=e;for(let r=0;r0&&(t%=this.duration));const u=this.timelines;for(let d=0,f=u.length;dt)return r-i;return n-i}};function RO(s){return typeof s=="object"&&s!==null&&typeof s.slotIndex=="number"}class Va extends ii{constructor(t,i,...n){super(t,...n);x(this,"curves");this.curves=ct.newFloatArray(t+i*18),this.curves[t-1]=1}setLinear(t){this.curves[t]=0}setStepped(t){this.curves[t]=1}shrink(t){const i=this.getFrameCount()+t*18;if(this.curves.length>i){const n=ct.newFloatArray(i);ct.arrayCopy(this.curves,0,n,0,i),this.curves=n}}setBezier(t,i,n,r,a,o,h,l,c,u,d){const f=this.curves;let p=this.getFrameCount()+t*18;n===0&&(f[i]=2+p);const m=(r-o*2+l)*.03,g=(a-h*2+c)*.03,v=((o-l)*3-r+u)*.006,b=((h-c)*3-a+d)*.006;let y=m*2+v,w=g*2+b,A=(o-r)*.3+m+v*.16666667,T=(h-a)*.3+g+b*.16666667,_=r+A,R=a+T;for(let P=p+18;pt){const c=this.frames[i],u=this.frames[i+n];return u+(t-c)/(a[r]-c)*(a[r+1]-u)}const o=r+18;for(r+=2;r=t){const c=a[r-2],u=a[r-1];return u+(t-c)/(a[r]-c)*(a[r+1]-u)}i+=this.getFrameEntries();const h=a[o-2],l=a[o-1];return l+(t-h)/(this.frames[i]-h)*(this.frames[i+n]-l)}}class ar extends Va{constructor(e,t,i){super(e,t,i)}getFrameEntries(){return 2}setFrame(e,t,i){e<<=1,this.frames[e]=t,this.frames[e+1]=i}getCurveValue(e){const t=this.frames;let i=t.length-2;for(let r=2;r<=i;r+=2)if(t[r]>e){i=r-2;break}const n=this.curves[i>>1];switch(n){case 0:{const r=t[i],a=t[i+1];return a+(e-r)/(t[i+2]-r)*(t[i+2+1]-a)}case 1:return t[i+1]}return this.getBezierValue(e,i,1,n-2)}getRelativeValue(e,t,i,n,r,a){if(e>2];switch(f){case 0:{const p=u[d];h=u[d+1],l=u[d+2],c=u[d+3];const m=(i-p)/(u[d+4]-p);h+=(u[d+4+1]-h)*m,l+=(u[d+4+2]-l)*m,c+=(u[d+4+3]-c)*m;break}case 1:h=u[d+1],l=u[d+2],c=u[d+3];break;default:h=this.getBezierValue(i,d,1,f-2),l=this.getBezierValue(i,d,2,f+18-2),c=this.getBezierValue(i,d,3,f+36-2)}if(n!==1)if(r===it.setup){const p=e.data.setupPose.color;h=p.r+(h-p.r)*n,l=p.g+(l-p.g)*n,c=p.b+(c-p.b)*n}else h=o.r+(h-o.r)*n,l=o.g+(l-o.g)*n,c=o.b+(c-o.b)*n;o.r=h<0?0:h>1?1:h,o.g=l<0?0:l>1?1:l,o.b=c<0?0:c>1?1:c}}class qw extends ar{constructor(t,i,n){super(t,i,`${xt.alpha}|${n}`);x(this,"slotIndex",0);this.slotIndex=n}apply(t,i,n,r,a,o,h,l,c){const u=t.slots[this.slotIndex];if(!u.bone.active)return;const d=(c?u.appliedPose:u.pose).color;let f=0;const p=this.frames;if(n1?1:f}}class Kw extends Ru{constructor(e,t,i){super(e,t,i,`${xt.rgb}|${i}`,`${xt.alpha}|${i}`,`${xt.rgb2}|${i}`)}getFrameEntries(){return 8}setFrame(e,t,i,n,r,a,o,h,l){e<<=3,this.frames[e]=t,this.frames[e+1]=i,this.frames[e+2]=n,this.frames[e+3]=r,this.frames[e+4]=a,this.frames[e+5]=o,this.frames[e+6]=h,this.frames[e+7]=l}apply1(e,t,i,n,r,a){const o=t.color,h=t.darkColor;let l=0,c=0,u=0;const d=this.frames;if(i>3];switch(b){case 0:{const y=d[v];f=d[v+1],p=d[v+2],m=d[v+3],g=d[v+4],l=d[v+5],c=d[v+6],u=d[v+7];const w=(i-y)/(d[v+8]-y);f+=(d[v+8+1]-f)*w,p+=(d[v+8+2]-p)*w,m+=(d[v+8+3]-m)*w,g+=(d[v+8+4]-g)*w,l+=(d[v+8+5]-l)*w,c+=(d[v+8+6]-c)*w,u+=(d[v+8+7]-u)*w;break}case 1:f=d[v+1],p=d[v+2],m=d[v+3],g=d[v+4],l=d[v+5],c=d[v+6],u=d[v+7];break;default:f=this.getBezierValue(i,v,1,b-2),p=this.getBezierValue(i,v,2,b+18-2),m=this.getBezierValue(i,v,3,b+36-2),g=this.getBezierValue(i,v,4,b+54-2),l=this.getBezierValue(i,v,5,b+72-2),c=this.getBezierValue(i,v,6,b+90-2),u=this.getBezierValue(i,v,7,b+108-2)}if(n===1)o.set(f,p,m,g);else if(r===it.setup){const y=e.data.setupPose;let w=y.color;o.set(w.r+(f-w.r)*n,w.g+(p-w.g)*n,w.b+(m-w.b)*n,w.a+(g-w.a)*n),w=y.darkColor,l=w.r+(l-w.r)*n,c=w.g+(c-w.g)*n,u=w.b+(u-w.b)*n}else o.add((f-o.r)*n,(p-o.g)*n,(m-o.b)*n,(g-o.a)*n),l=h.r+(l-h.r)*n,c=h.g+(c-h.g)*n,u=h.b+(u-h.b)*n;h.r=l<0?0:l>1?1:l,h.g=c<0?0:c>1?1:c,h.b=u<0?0:u>1?1:u}}class Zw extends Ru{constructor(e,t,i){super(e,t,i,`${xt.rgb}|${i}`,`${xt.rgb2}|${i}`)}getFrameEntries(){return 7}setFrame(e,t,i,n,r,a,o,h){e*=7,this.frames[e]=t,this.frames[e+1]=i,this.frames[e+2]=n,this.frames[e+3]=r,this.frames[e+4]=a,this.frames[e+5]=o,this.frames[e+6]=h}apply1(e,t,i,n,r,a){const o=t.color,h=t.darkColor;let l=0,c=0,u=0,d=0,f=0,p=0;const m=this.frames;if(i1?1:l,o.g=c<0?0:c>1?1:c,o.b=u<0?0:u>1?1:u,h.r=d<0?0:d>1?1:d,h.g=f<0?0:f>1?1:f,h.b=p<0?0:p>1?1:p}}class xl extends ii{constructor(t,i){super(t,`${xt.attachment}|${i}`);x(this,"slotIndex",0);x(this,"attachmentNames");this.slotIndex=i,this.attachmentNames=new Array(t),this.instant=!0}getFrameCount(){return this.frames.length}setFrame(t,i,n){this.frames[t]=i,this.attachmentNames[t]=n}apply(t,i,n,r,a,o,h,l,c){const u=t.slots[this.slotIndex];if(!u.bone.active)return;const d=c?u.appliedPose:u.pose;l||nt){const l=this.frames[i];return n[r+1]*(t-l)/(n[r]-l)}const a=r+18;for(r+=2;r=t){const l=n[r-2],c=n[r-1];return c+(t-l)/(n[r]-l)*(n[r+1]-c)}const o=n[a-2],h=n[a-1];return h+(1-h)*(t-o)/(this.frames[i+this.getFrameEntries()]-o)}apply(t,i,n,r,a,o,h,l,c){const u=t.slots;if(!this.attachment.isTimelineActive(u,this.slotIndex,c))return;const d=this.attachment.timelineSlots,f=this.frames;if(n=f[f.length-1])g=0,p=this.vertices[f.length-1],m=null;else{const b=ii.search(f,n);g=this.getCurvePercent(n,b),p=this.vertices[b],m=this.vertices[b+1]}const v=this.vertices[0].length;this.applyToSlot(u[this.slotIndex],c,p,m,g,v,a,o,h);for(const b of d)this.applyToSlot(u[b],c,p,m,g,v,a,o,h)}applyBeforeFirst(t,i,n,r){if(!t.bone.active)return;const a=i?t.appliedPose:t.pose;if(a.attachment==null||a.attachment.timelineAttachment!==this.attachment)return;const o=a.deform;switch(o.length===0&&(r=it.setup),r){case it.setup:o.length=0;break;case it.first:{if(n===1){o.length=0;return}const h=this.vertices[0].length;o.length=h;const l=o,c=a.attachment;if(c.bones===null){const u=c.vertices;for(let d=0;d>4,c=h.attachment.sequence.regions.length;const u=Lw[a&15];if(u!==Gi.hold)switch(l+=(n-r)/o+1e-5|0,u){case Gi.once:l=Math.min(c-1,l);break;case Gi.loop:l%=c;break;case Gi.pingpong:{const d=(c<<1)-2;l=d===0?0:l%d,l>=c&&(l=d-l);break}case Gi.onceReverse:l=Math.max(c-1-l,0);break;case Gi.loopReverse:l=c-1-l%c;break;case Gi.pingpongReverse:{const d=(c<<1)-2;l=d===0?0:(l+c-1)%d,l>=c&&(l=d-l)}}h.sequenceIndex=l}};x(Bs,"ENTRIES",3),x(Bs,"MODE",1),x(Bs,"DELAY",2);let Hh=Bs;const Zh=class Zh extends ii{constructor(t){super(t,...Zh.propertyIds);x(this,"events");this.events=new Array(t),this.instant=!0}getFrameCount(){return this.frames.length}setFrame(t,i){this.frames[t]=i.time,this.events[t]=i}apply(t,i,n,r,a,o,h,l,c){if(!r)return;const u=this.frames,d=this.frames.length;if(i>n)this.apply(null,i,Number.MAX_VALUE,r,0,o,!1,!1,!1),i=-1;else if(i>=u[d-1])return;if(n0&&u[f-1]===p;)f--}for(;f=u[f];f++)r.push(this.events[f])}};x(Zh,"propertyIds",[`${xt.event}`]);let Ul=Zh;const uo=class uo extends ii{constructor(t){super(t,...uo.propertyIds);x(this,"drawOrders");this.drawOrders=new Array(t),this.instant=!0}getFrameCount(){return this.frames.length}setFrame(t,i,n){this.frames[t]=i,this.drawOrders[t]=n}apply(t,i,n,r,a,o,h,l,c){const u=c?t.drawOrder.appliedPose:t.drawOrder.pose,d=t.slots;if(l||n>2];switch(b){case 0:{const w=f[v];p=f[v+1],m=f[v+2],g=f[v+3];const A=(n-w)/(f[v+4]-w);p+=(f[v+4+1]-p)*A,m+=(f[v+4+2]-m)*A,g+=(f[v+4+3]-g)*A;break}case 1:p=f[v+1],m=f[v+2],g=f[v+3];break;default:p=this.getBezierValue(n,v,1,b-2),m=this.getBezierValue(n,v,2,b+18-2),g=this.getBezierValue(n,v,3,b+36-2)}const y=o===it.setup?u.data.setupPose:d;h?(d.mixRotate=y.mixRotate+p*a,d.mixX=y.mixX+m*a,d.mixY=y.mixY+g*a):(d.mixRotate=y.mixRotate+(p-y.mixRotate)*a,d.mixX=y.mixX+(m-y.mixX)*a,d.mixY=y.mixY+(g-y.mixY)*a)}}class Jr extends Jl{constructor(e,t,i,n){super(e,t,i,n)}apply(e,t,i,n,r,a,o,h,l){if(o&&!this.additive&&(o=!1),this.constraintIndex===-1){const c=i>=this.frames[0]?this.getCurveValue(i):0,u=e.physics;for(const d of u)if(d.active&&this.global(d.data)){const f=l?d.appliedPose:d.pose;this.set(f,this.getAbsoluteValue(i,r,a,o,this.get(f),this.get(d.data.setupPose),c))}}else{const c=e.constraints[this.constraintIndex];if(c.active){const u=l?c.appliedPose:c.pose;this.set(u,this.getAbsoluteValue(i,r,a,o,this.get(u),this.get(c.data.setupPose)))}}}}class nS extends Jr{constructor(e,t,i){super(e,t,i,xt.physicsConstraintInertia)}get(e){return e.inertia}set(e,t){e.inertia=t}global(e){return e.inertiaGlobal}}class rS extends Jr{constructor(e,t,i){super(e,t,i,xt.physicsConstraintStrength)}get(e){return e.strength}set(e,t){e.strength=t}global(e){return e.strengthGlobal}}class aS extends Jr{constructor(e,t,i){super(e,t,i,xt.physicsConstraintDamping)}get(e){return e.damping}set(e,t){e.damping=t}global(e){return e.dampingGlobal}}class oS extends Jr{constructor(e,t,i){super(e,t,i,xt.physicsConstraintMass)}get(e){return 1/e.massInverse}set(e,t){e.massInverse=1/t}global(e){return e.massGlobal}}class lS extends Jr{constructor(e,t,i){super(e,t,i,xt.physicsConstraintWind),this.additive=!0}get(e){return e.wind}set(e,t){e.wind=t}global(e){return e.windGlobal}}class cS extends Jr{constructor(e,t,i){super(e,t,i,xt.physicsConstraintGravity),this.additive=!0}get(e){return e.gravity}set(e,t){e.gravity=t}global(e){return e.gravityGlobal}}class hS extends Jr{constructor(e,t,i){super(e,t,i,xt.physicsConstraintMix)}get(e){return e.mix}set(e,t){e.mix=t}global(e){return e.mixGlobal}}const Jh=class Jh extends ii{constructor(t,i){super(t,...Jh.propertyIds);x(this,"constraintIndex");this.constraintIndex=i,this.instant=!0}getFrameCount(){return this.frames.length}setFrame(t,i){this.frames[t]=i}apply(t,i,n,r,a,o,h,l,c){let u;if(this.constraintIndex!==-1&&(u=t.constraints[this.constraintIndex],!u.active))return;const d=this.frames;if(i>n)this.apply(t,i,Number.MAX_VALUE,[],a,o,!1,!1,!1),i=-1;else if(i>=d[d.length-1])return;if(!(n=d[ii.search(d,i)+1]))if(u!=null)u.reset(t);else for(const f of t.physics)f.active&&f.reset(t)}};x(Jh,"propertyIds",[xt.physicsConstraintReset.toString()]);let jh=Jh;class uS extends Jl{constructor(e,t,i){super(e,t,i,xt.sliderTime)}apply(e,t,i,n,r,a,o,h,l){const c=e.constraints[this.constraintIndex];if(c.active){const u=l?c.appliedPose:c.pose;u.time=this.getAbsoluteValue(i,r,a,o,u.time,c.data.setupPose.time)}}}class dS extends Jl{constructor(e,t,i){super(e,t,i,xt.sliderMix),this.additive=!0}apply(e,t,i,n,r,a,o,h,l){const c=e.constraints[this.constraintIndex];if(c.active){const u=l?c.appliedPose:c.pose;u.mix=this.getAbsoluteValue(i,r,a,o,u.mix,c.data.setupPose.mix)}}}const Sl=class Sl{constructor(e){x(this,"data");x(this,"tracks",[]);x(this,"timeScale",1);x(this,"unkeyedState",0);x(this,"events",[]);x(this,"listeners",[]);x(this,"queue",new OO(this));x(this,"propertyIds",new Map);x(this,"animationsChanged",!1);x(this,"trackEntryPool",new AO(()=>new FO));this.data=e}update(e){e*=this.timeScale;const t=this.tracks;for(let i=0,n=t.length;i0){if(r.delay-=a,r.delay>0)continue;a=-r.delay,r.delay=0}let o=r.next;if(o){const h=r.trackLast-o.delay;if(h>=0){for(o.delay=0,o.trackTime+=r.timeScale===0?0:(h/r.timeScale+e)*o.timeScale,r.trackTime+=a,this.setTrack(i,o,!0);o.mixingFrom;)o.mixTime+=e,o=o.mixingFrom;continue}}else if(r.trackLast>=r.trackEnd&&!r.mixingFrom){t[i]=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+=a}this.queue.drain()}updateMixingFrom(e,t){const i=e.mixingFrom;if(!i)return!0;const n=this.updateMixingFrom(i,t);if(i.animationLast=i.nextAnimationLast,i.trackLast=i.nextTrackLast,e.nextTrackLast!==-1&&e.mixTime>=e.mixDuration){if(i.totalAlpha===0||e.mixDuration===0){if(e.mixingFrom=i.mixingFrom,i.mixingFrom!=null&&(i.mixingFrom.mixingTo=e),i.totalAlpha===0)for(let r=e;r.mixingTo!=null;r=r.mixingTo)r.keepHold=!0;this.queue.end(i)}return n}return i.trackTime+=t*i.timeScale,e.mixTime+=t,!1}apply(e){if(!e)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();const t=this.events,i=this.tracks;let n=!1;for(let o=0,h=i.length;o0)continue;n=!0;let c=l.alpha;l.mixingFrom?c*=this.applyMixingFrom(l,e):l.trackTime>=l.trackEnd&&!l.next&&(c=0);let u=l.animationLast,d=l.getAnimationTime(),f=d,p=t;l.reverse&&(f=l.animation.duration-f,p=null);const m=l.animation.timelines,g=m.length;if(o===0&&c===1)for(let v=0;v=l.alphaAttachmentThreshold,y=l.additive,w=y||l.shortestRotation,A=!w&&l.timelinesRotation.length!==g<<1;A&&(l.timelinesRotation.length=g<<1);for(let T=0;T0?h/o:a,c=i.animation.timelines,u=c.length,d=i.timelineMode,f=i.timelineHoldMix,p=r=i.alphaAttachmentThreshold);else{const B=!m||!(P instanceof Gr)||I===it.current;P.apply(t,w,T,_,k,I,g,B,!1)}}return i.reverse&&r0&&this.queueEvents(i,A),this.events.length=0,i.nextAnimationLast=A,i.nextTrackLast=i.trackTime,r}applyAttachmentTimeline(e,t,i,n,r){const a=t.slots[e.slotIndex];if(!a.bone.active||!r&&a.attachmentState===this.unkeyedState+dy)return;let o=i=0,A=v>=0;Math.abs(b)<=90&&Ye.signum(b)!==Ye.signum(g)&&(Math.abs(v-y)>180?(m+=360*Ye.signum(v),A=w):y!==0?m-=360*Ye.signum(v):A=w),A!==w&&(m+=360*Ye.signum(v)),a[o]=m}a[o+1]=g,c.rotation=f+m*n}queueEvents(e,t){const i=e.animationStart,n=e.animationEnd,r=n-i,a=e.reverse;let o=e.trackLast%r;a&&(o=r-o);const h=this.events;let l=0,c=h.length;for(;l=i&&d.time<=n&&this.queue.event(e,d)}let u=!1;if(e.loop)if(r===0)u=!0;else{const d=Math.floor(e.trackTime/r);u=d>0&&d>Math.floor(e.trackLast/r)}else u=t>=n&&e.animationLast=i&&d.time<=n&&this.queue.event(e,d)}}eventsReverse(e,t,i){const n=e.animation.duration,r=n-t,a=n-i,o=e.animation.timelines;for(let h=0,l=e.animation.timelines.length;h=a){for(let p=0;p=r)break;this.events.push(u[p])}}else{for(let m=0;m=r);m++)this.events.push(u[m]);let p=0;for(;p=a);p++);for(;p= 0.");if(e>=this.tracks.length)return;const t=this.tracks[e];if(!t)return;this.queue.end(t),this.clearNext(t);let i=t;for(;;){const n=i.mixingFrom;if(!n)break;this.queue.end(n),i.mixingFrom=null,i.mixingTo=null,i=n}this.tracks[t.trackIndex]=null,this.queue.drain()}setTrack(e,t,i){const n=this.expandToIndex(e);this.tracks[e]=t,t.previous=null,n&&(n.next=null,i&&this.queue.interrupt(n),t.mixingFrom=n,n.mixingTo=t,t.mixTime=0,n.timelinesRotation.length=0),this.queue.start(t)}setAnimation(e,t,i=!1){return typeof t=="string"?this.setAnimation1(e,t,i):this.setAnimation2(e,t,i)}setAnimation1(e,t,i=!1){const n=this.data.skeletonData.findAnimation(t);if(!n)throw new Error(`Animation not found: ${t}`);return this.setAnimation2(e,n,i)}setAnimation2(e,t,i=!1){if(e<0)throw new Error("trackIndex must be >= 0.");if(!t)throw new Error("animation cannot be null.");let n=!0,r=this.expandToIndex(e);r&&(r.nextTrackLast===-1&&r.animation===t?(this.tracks[e]=r.mixingFrom,this.queue.interrupt(r),this.queue.end(r),this.clearNext(r),r=r.mixingFrom,n=!1):this.clearNext(r));const a=this.trackEntry(e,t,i,r);return this.setTrack(e,a,n),this.queue.drain(),a}addAnimation(e,t,i=!1,n=0){return typeof t=="string"?this.addAnimation1(e,t,i,n):this.addAnimation2(e,t,i,n)}addAnimation1(e,t,i=!1,n=0){const r=this.data.skeletonData.findAnimation(t);if(!r)throw new Error(`Animation not found: ${t}`);return this.addAnimation2(e,r,i,n)}addAnimation2(e,t,i=!1,n=0){if(e<0)throw new Error("trackIndex must be >= 0.");if(!t)throw new Error("animation cannot be null.");let r=this.expandToIndex(e);if(r)for(;r.next;)r=r.next;const a=this.trackEntry(e,t,i,r);return r?(r.next=a,a.previous=r,n<=0&&(n=Math.max(n+r.getTrackComplete()-a.mixDuration,0))):(this.setTrack(e,a,!0),this.queue.drain(),n<0&&(n=0)),a.delay=n,a}setEmptyAnimation(e,t=0){const i=this.setAnimation(e,Sl.emptyAnimation,!1);return i.mixDuration=t,i.trackEnd=t,i}addEmptyAnimation(e,t=0,i=0){const n=this.addAnimation(e,Sl.emptyAnimation,!1,i);return i<=0&&(n.delay=Math.max(n.delay+n.mixDuration-t,0)),n.mixDuration=t,n.trackEnd=t,n}setEmptyAnimations(e=0){const t=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let i=0,n=this.tracks.length;i0&&(a[d]=v);break}}h&&(g=g&~Nc|r[d]&Nc),r[d]=g}}from(e,t,i){const n=this.propertyIds;let r=BO;for(let a=0,o=i.length;a= 0.");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){const t=this.listeners.indexOf(e);t>=0&&this.listeners.splice(t,1)}clearListeners(){this.listeners.length=0}clearListenerNotifications(){this.queue.clear()}};x(Sl,"emptyAnimation",new Fp("",[],0));let oy=Sl;class FO{constructor(){x(this,"animation",null);x(this,"previous",null);x(this,"next",null);x(this,"mixingFrom",null);x(this,"mixingTo",null);x(this,"listener",null);x(this,"trackIndex",0);x(this,"loop",!1);x(this,"additive",!1);x(this,"reverse",!1);x(this,"shortestRotation",!1);x(this,"keepHold",!1);x(this,"eventThreshold",0);x(this,"mixAttachmentThreshold",0);x(this,"alphaAttachmentThreshold",0);x(this,"mixDrawOrderThreshold",0);x(this,"animationStart",0);x(this,"animationEnd",0);x(this,"animationLast",0);x(this,"nextAnimationLast",0);x(this,"delay",0);x(this,"trackTime",0);x(this,"trackLast",0);x(this,"nextTrackLast",0);x(this,"trackEnd",0);x(this,"timeScale",0);x(this,"alpha",0);x(this,"mixTime",0);x(this,"mixDuration",0);x(this,"totalAlpha",0);x(this,"mixInterpolation",To.linear);x(this,"timelineMode",[]);x(this,"timelineHoldMix",[]);x(this,"timelinesRotation",[])}setMixDuration(e,t){this.mixDuration=e,t!==void 0&&(t<=0&&(t=this.previous==null?0:Math.max(t+this.previous.getTrackComplete()-e,0)),this.delay=t)}setMixInterpolation(e){if(!e)throw new Error("mixInterpolation cannot be null.");this.mixInterpolation=e}mix(){if(this.mixDuration===0)return 1;let e=this.mixTime/this.mixDuration;return e>=1?1:this.mixInterpolation===To.linear?e:(e=this.mixInterpolation.apply(e),e<0?0:e>1?1:e)}reset(){this.next=null,this.previous=null,this.mixingFrom=null,this.mixingTo=null,this.mixInterpolation=To.linear,this.animation=null,this.listener=null,this.timelineMode.length=0,this.timelineHoldMix.length=0,this.timelinesRotation.length=0}getAnimationTime(){if(!this.loop)return Math.min(this.trackTime+this.animationStart,this.animationEnd);const e=this.animationEnd-this.animationStart;return e===0?this.animationStart:this.trackTime%e+this.animationStart}setAnimationLast(e){this.animationLast=e,this.nextAnimationLast=e}isComplete(){return this.trackTime>=this.animationEnd-this.animationStart}resetRotationDirections(){this.timelinesRotation.length=0}getTrackComplete(){const e=this.animationEnd-this.animationStart;if(e!==0){if(this.loop)return e*(1+(this.trackTime/e|0));if(this.trackTime=0}}class OO{constructor(e){x(this,"objects",[]);x(this,"drainDisabled",!1);x(this,"animState");this.animState=e}start(e){this.objects.push(vs.start),this.objects.push(e),this.animState.animationsChanged=!0}interrupt(e){this.objects.push(vs.interrupt),this.objects.push(e)}end(e){this.objects.push(vs.end),this.objects.push(e),this.animState.animationsChanged=!0}dispose(e){this.objects.push(vs.dispose),this.objects.push(e)}complete(e){this.objects.push(vs.complete),this.objects.push(e)}event(e,t){this.objects.push(vs.event),this.objects.push(e),this.objects.push(t)}drain(){var e,t,i,n,r,a;if(!this.drainDisabled){this.drainDisabled=!0;for(let o=0;o= 0.");if(!i)throw new Error("name cannot be null.");this.index=t,this.parent=n}copy(t){const i=new ku(this.index,this.name,t);return i.length=this.length,i.setupPose.set(this.setupPose),i}}var pi;(function(s){s[s.Normal=0]="Normal",s[s.OnlyTranslation=1]="OnlyTranslation",s[s.NoRotationOrReflection=2]="NoRotationOrReflection",s[s.NoScale=3]="NoScale",s[s.NoScaleOrReflection=4]="NoScaleOrReflection"})(pi||(pi={}));class Pm{constructor(){x(this,"bone");x(this,"x",0);x(this,"y",0);x(this,"rotation",0);x(this,"scaleX",0);x(this,"scaleY",0);x(this,"shearX",0);x(this,"shearY",0);x(this,"inherit",pi.Normal);x(this,"a",0);x(this,"b",0);x(this,"c",0);x(this,"d",0);x(this,"worldY",0);x(this,"worldX",0);x(this,"world",0);x(this,"local",0)}set(e){if(e==null)throw new Error("pose cannot be null.");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}setPosition(e,t){this.x=e,this.y=t}setScale(e,t){this.scaleX=e,this.scaleY=t===void 0?e:t}getInherit(){return this.inherit}setInherit(e){if(e==null)throw new Error("inherit cannot be null.");this.inherit=e}update(e,t){this.world!==e._update&&this.updateWorldTransform(e)}updateWorldTransform(e){this.local===e._update?this.updateLocalTransform(e):this.world=e._update;const t=this.rotation,i=this.scaleX,n=this.scaleY,r=this.shearX,a=this.shearY;if(!this.bone.parent){const d=e.scaleX,f=e.scaleY,p=(t+r)*Ye.degRad,m=(t+90+a)*Ye.degRad;this.a=Math.cos(p)*i*d,this.b=Math.cos(m)*n*d,this.c=Math.sin(p)*i*f,this.d=Math.sin(m)*n*f,this.worldX=this.x*d+e.x,this.worldY=this.y*f+e.y;return}const o=this.bone.parent.appliedPose;let h=o.a,l=o.b,c=o.c,u=o.d;switch(this.worldX=h*this.x+l*this.y+o.worldX,this.worldY=c*this.x+u*this.y+o.worldY,this.inherit){case pi.Normal:{const d=(t+r)*Ye.degRad,f=(t+90+a)*Ye.degRad,p=Math.cos(d)*i,m=Math.cos(f)*n,g=Math.sin(d)*i,v=Math.sin(f)*n;this.a=h*p+l*g,this.b=h*m+l*v,this.c=c*p+u*g,this.d=c*m+u*v;return}case pi.OnlyTranslation:{const d=e.scaleX,f=e.scaleY,p=(t+r)*Ye.degRad,m=(t+90+a)*Ye.degRad;this.a=Math.cos(p)*i*d,this.b=Math.cos(m)*n*d,this.c=Math.sin(p)*i*f,this.d=Math.sin(m)*n*f;break}case pi.NoRotationOrReflection:{const d=e.scaleX,f=e.scaleY,p=1/d,m=1/f;h*=p,c*=m;let g=h*h+c*c,v=0;g>Ye.epsilon2?(g=Math.abs(h*u*m-l*p*c)/g,l=c*g,u=h*g,v=t-Ye.atan2Deg(c,h)):(h=0,c=0,v=t-90+Ye.atan2Deg(u,l));const b=(v+r)*Ye.degRad,y=(v+a+90)*Ye.degRad,w=Math.cos(b)*i,A=Math.cos(y)*n,T=Math.sin(b)*i,_=Math.sin(y)*n;this.a=(h*w-l*T)*d,this.b=(h*A-l*_)*d,this.c=(c*w+u*T)*f,this.d=(c*A+u*_)*f;break}case pi.NoScale:case pi.NoScaleOrReflection:{const d=e.scaleX,f=e.scaleY,p=1/d,m=1/f,g=t*Ye.degRad,v=Math.cos(g),b=Math.sin(g);let y=(h*v+l*b)*p,w=(c*v+u*b)*m;const A=1/Math.sqrt(y*y+w*w);y*=A,w*=A;let T=-w,_=y;this.inherit===pi.NoScale&&h*u-l*c<0!=(d<0!=f<0)&&(T=-T,_=-_);const R=r*Ye.degRad,P=(90+a)*Ye.degRad,F=Math.cos(R)*i,I=Math.cos(P)*n,k=Math.sin(R)*i,B=Math.sin(P)*n;this.a=(y*F+T*k)*d,this.b=(y*I+T*B)*d,this.c=(w*F+_*k)*f,this.d=(w*I+_*B)*f;break}}}updateLocalTransform(e){this.local=0,this.world=e._update;const t=e.scaleX,i=e.scaleY;if(!this.bone.parent){const v=1/t,b=1/i;this.x=(this.worldX-e.x)*v,this.y=(this.worldY-e.y)*b,this.set5(this.a*v,this.b*v,this.c*b,this.d*b,0);return}const n=this.bone.parent.appliedPose;let r=n.a,a=n.b,o=n.c,h=n.d;const l=r*h-a*o,c=1/(r*h-a*o),u=h*c,d=a*c,f=o*c,p=r*c,m=this.worldX-n.worldX,g=this.worldY-n.worldY;switch(this.x=m*u-g*d,this.y=g*p-m*f,this.inherit){case pi.Normal:this.set5(u*this.a-d*this.c,u*this.b-d*this.d,p*this.c-f*this.a,p*this.d-f*this.b,0);break;case pi.OnlyTranslation:{const v=1/t,b=1/i;this.set5(this.a*v,this.b*v,this.c*b,this.d*b,0);break}case pi.NoRotationOrReflection:{const v=1/t,b=1/i;r*=v,o*=b;const y=this.a*v,w=this.b*v,A=this.c*b,T=this.d*b,_=1/(r*r+o*o),R=1/Math.abs(l*v*b);this.set5((r*y+o*A)*_,(r*w+o*T)*_,(r*A-o*y)*R,(r*T-o*w)*R,Ye.atan2Deg(o,r));break}case pi.NoScale:case pi.NoScaleOrReflection:{const v=1/t,b=1/i,y=this.a*v,w=this.b*v,A=this.c*b,T=this.d*b;let _=h*this.a-a*this.c,R=r*this.c-o*this.a;l<0&&(_=-_,R=-R);let P=Ye.atan2Deg(R,_);this.rotation=P,P*=Ye.degRad;const F=Math.cos(P),I=Math.sin(P);let k=(r*F+a*I)*v,B=(o*F+h*I)*b;const D=1/Math.sqrt(k*k+B*B);k*=D,B*=D;const U=this.inherit===pi.NoScale&&l<0!=(t<0!=i<0)?-1:1;this.set4(k*y+B*A,k*w+B*T,(k*A-B*y)*U,(k*T-B*w)*U)}}}set4(e,t,i,n){const r=e*e+i*i,a=t*t+n*n;r>Ye.epsilon2?(this.shearX=Ye.atan2Deg(i,e),this.scaleX=Math.sqrt(r)):(this.shearX=0,this.scaleX=0),this.scaleY=Math.sqrt(a),a>Ye.epsilon2?(this.shearY=Ye.atan2Deg(n,t),e*n-t*i<0?(this.scaleY=-this.scaleY,this.shearY+=90):this.shearY-=90,this.shearY>180?this.shearY-=360:this.shearY<=-180&&(this.shearY+=360)):this.shearY=0}set5(e,t,i,n,r){this.shearX=0;const a=e*e+i*i,o=t*t+n*n;if(a>Ye.epsilon2){const h=Ye.atan2Deg(i,e);this.rotation=h+r,this.scaleX=Math.sqrt(a),this.scaleY=Math.sqrt(o),o>Ye.epsilon2?(this.shearY=Ye.atan2Deg(n,t),e*n-t*i<0?(this.scaleY=-this.scaleY,this.shearY+=90-h):this.shearY-=90+h,this.shearY>180?this.shearY-=360:this.shearY<=-180&&(this.shearY+=360)):this.shearY=0}else this.scaleX=0,this.scaleY=Math.sqrt(o),this.shearY=0,this.rotation=o>Ye.epsilon2?Ye.atan2Deg(n,t)-90+r:r}validateLocalTransform(e){this.local===e._update&&this.updateLocalTransform(e)}modifyLocal(e){this.local===e._update&&this.updateLocalTransform(e),this.world=0,this.resetWorld(e,e._update)}modifyWorld(e){const t=e._update;this.local=t,this.world=t,this.resetWorld(e,t)}resetWorld(e,t){const i=this.bone.children;for(let n=0,r=i.length;n1&&t.constrained(this.bones[1].bone)}isSourceActive(){return this.target.active}static apply(t,i,n,r,a,o,h,l,c,u){typeof n=="number"?Pr.apply1(t,i,n,r,a,o,h,l):Pr.apply2(t,i,n,r,a,o,h,l,c,u)}static apply1(t,i,n,r,a,o,h,l){i.modifyLocal(t);const c=i.bone.parent.appliedPose;let u=c.a,d=c.b,f=c.c,p=c.d,m=-i.shearX-i.rotation,g=0,v=0;switch(i.inherit){case pi.OnlyTranslation:g=(n-i.worldX)*Ye.signum(t.scaleX),v=(r-i.worldY)*Ye.signum(t.scaleY);break;case pi.NoRotationOrReflection:{const b=Math.abs(u*p-d*f)/Math.max(Ye.epsilon,u*u+f*f),y=u/t.scaleX,w=f/t.scaleY;d=-w*b*t.scaleX,p=y*b*t.scaleY,m+=Ye.atan2Deg(w,y)}default:{const b=n-c.worldX,y=r-c.worldY,w=u*p-d*f;Math.abs(w)<=Ye.epsilon?(g=0,v=0):(g=(b*p-y*d)/w-i.x,v=(y*u-b*f)/w-i.y)}}if(m+=Ye.atan2Deg(v,g),i.scaleX<0&&(m+=180),m>180?m-=360:m<=-180&&(m+=360),i.rotation+=m*l,a||o){switch(i.inherit){case pi.NoScale:case pi.NoScaleOrReflection:g=n-i.worldX,v=r-i.worldY}const b=i.bone.data.length*i.scaleX;if(b>Ye.epsilon){const y=g*g+v*v;if(a&&yb*b){const w=(Math.sqrt(y)/b-1)*l+1;switch(i.scaleX*=w,h){case hs.Uniform:i.scaleY*=w;break;case hs.Volume:i.scaleY/=w<.7?.25+.642857*w:w}}}}}static apply2(t,i,n,r,a,o,h,l,c,u){if(i.inherit!==pi.Normal||n.inherit!==pi.Normal)return;i.modifyLocal(t),n.modifyLocal(t);let d=i.x,f=i.y,p=i.scaleX,m=i.scaleY,g=n.scaleX,v=0,b=0,y=0;p<0?(p=-p,v=180,y=-1):(v=0,y=1),m<0&&(m=-m,y=-y),g<0?(g=-g,b=180):b=0;let w=0,A=0,T=i.a,_=i.b,R=i.c,P=i.d;const F=Math.abs(p-m)<=Ye.epsilon;!F||h?(n.y=0,w=T*n.x+i.worldX,A=R*n.x+i.worldY):(w=T*n.x+_*n.y+i.worldX,A=R*n.x+P*n.y+i.worldY);const I=i.bone.parent.appliedPose;T=I.a,_=I.b,R=I.c,P=I.d;let k=T*P-_*R,B=w-I.worldX,D=A-I.worldY;k=Math.abs(k)<=Ye.epsilon?0:1/k;const U=(B*P-D*_)*k-d,L=(D*T-B*R)*k-f;let N=Math.sqrt(U*U+L*L),O=n.bone.data.length*g,X,E;if(N0){let me=Math.min(1,fe/(c*2))-1;me=(fe-c*(1-me*me))/K,V-=me*V,q-=me*q,W=V*V+q*q}}e:if(F){O*=p;let K=(W-N*N-O*O)/(2*N*O);if(K<-1)K=-1,E=Math.PI*o;else if(K>1){if(K=1,E=0,h)switch(T=(Math.sqrt(W)/(N+O)-1)*u+1,i.scaleX*=T,l){case hs.Uniform:i.scaleY*=T;break;case hs.Volume:i.scaleY/=T<.7?.25+.642857*T:T}}else E=Math.acos(K)*o;T=N+O*K,_=O*Math.sin(E),X=Math.atan2(q*T-V*_,V*T+q*_)}else{T=p*O,_=m*O;const K=T*T,fe=_*_,me=Math.atan2(q,V);R=fe*N*N+K*W-K*fe;const we=-2*fe*N,Ee=fe-K;if(P=we*we-4*Ee*R,P>=0){let xe=Math.sqrt(P);we<0&&(xe=-xe),xe=-(we+xe)*.5;let oe=xe/Ee,ge=R/xe;const le=Math.abs(oe)=0){D=Math.sqrt(oe)*o,X=me-Math.atan2(D,le),E=Math.atan2(D/m,(le-N)/p);break e}}let pe=Ye.PI,Ae=N-T,G=Ae*Ae,Z=0,z=0,j=N+T,te=j*j,he=0;R=-T*N/(K-fe),R>=-1&&R<=1&&(R=Math.acos(R),B=T*Math.cos(R)+N,D=_*Math.sin(R),P=B*B+D*D,Pte&&(z=R,te=P,j=B,he=D)),W<=(G+te)*.5?(X=me-Math.atan2(Z*o,Ae),E=pe*o):(X=me-Math.atan2(he*o,j),E=z*o)}const J=Math.atan2(n.y,n.x)*y;X=(X-J)*Ye.radDeg+v-i.rotation,X>180?X-=360:X<=-180&&(X+=360),i.rotation+=X*u,E=((E+J)*Ye.radDeg-n.shearX)*y+b-n.rotation,E>180?E-=360:E<=-180&&(E+=360),n.rotation+=E*u}}class Qc extends ec{constructor(t){super(t,new km);x(this,"bones",[]);x(this,"_target",null);x(this,"_scaleYMode",hs.None)}set target(t){this._target=t}get target(){if(!this._target)throw new Error("target cannot be null.");return this._target}set scaleYMode(t){this._scaleYMode=t}get scaleYMode(){if(this._scaleYMode==null)throw new Error("scaleYMode cannot be null.");return this._scaleYMode}create(t){return new Pr(this,t)}}class Fm{constructor(){x(this,"position",0);x(this,"spacing",0);x(this,"mixRotate",0);x(this,"mixX",0);x(this,"mixY",0)}set(e){this.position=e.position,this.spacing=e.spacing,this.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY}}class eh extends ec{constructor(t){super(t,new Fm);x(this,"bones",[]);x(this,"_slot",null);x(this,"positionMode",Dn.Fixed);x(this,"spacingMode",Fi.Fixed);x(this,"rotateMode",ka.Chain);x(this,"offsetRotation",0)}set slot(t){this._slot=t}get slot(){if(this._slot)return this._slot;throw new Error("SlotData not set.")}create(t){return new Om(this,t)}}var Dn;(function(s){s[s.Fixed=0]="Fixed",s[s.Percent=1]="Percent"})(Dn||(Dn={}));var Fi;(function(s){s[s.Length=0]="Length",s[s.Fixed=1]="Fixed",s[s.Percent=2]="Percent",s[s.Proportional=3]="Proportional"})(Fi||(Fi={}));var ka;(function(s){s[s.Tangent=0]="Tangent",s[s.Chain=1]="Chain",s[s.ChainScale=2]="ChainScale"})(ka||(ka={}));const Qs=class Qs extends Ql{constructor(t,i){super(t,new Fm,new Fm);x(this,"data");x(this,"bones");x(this,"slot");x(this,"spaces",[]);x(this,"positions",[]);x(this,"world",[]);x(this,"curves",[]);x(this,"lengths",[]);x(this,"segments",[]);if(!i)throw new Error("skeleton cannot be null.");this.data=t,this.bones=[];for(const n of this.data.bones)this.bones.push(i.bones[n.index].constrainedPose);this.slot=i.slots[t.slot.index]}copy(t){var i=new Qs(this.data,t);return i.pose.set(this.pose),i}update(t,i){const n=this.slot.appliedPose.attachment;if(!(n instanceof Xl))return;const r=this.appliedPose,a=r.mixRotate,o=r.mixX,h=r.mixY;if(a===0&&o===0&&h===0)return;const l=this.data,c=l.rotateMode===ka.Tangent,u=l.rotateMode===ka.ChainScale,d=this.bones,f=d.length,p=c?f:f+1,m=ct.setArraySize(this.spaces,p),g=u?this.lengths=ct.setArraySize(this.lengths,f):[],v=r.spacing;switch(l.spacingMode){case Fi.Percent:if(u)for(let _=0,R=p-1;_0){_=p/_*v;for(let R=1;R0?Ye.degRad:-Ye.degRad}for(let _=0,R=3;_0){let D=P.a,U=P.b,L=P.c,N=P.d,O=0,X=0,E=0;if(c?O=b[R-1]:m[_+1]===0?O=b[R+2]:O=Math.atan2(B,k),O-=Math.atan2(L,D),T){X=Math.cos(O),E=Math.sin(O);const V=P.bone.data.length;y+=(V*(X*D-E*L)-k)*a,w+=(V*(E*D+X*L)-B)*a}else O+=A;O>Ye.PI?O-=Ye.PI2:O<-Ye.PI&&(O+=Ye.PI2),O*=a,X=Math.cos(O),E=Math.sin(O),P.a=X*D-E*L,P.b=X*U-E*N,P.c=E*D+X*L,P.d=E*U+X*N}}}computeWorldPositions(t,i,n,r){const a=this.slot;let o=this.appliedPose.position,h=this.spaces,l=ct.setArraySize(this.positions,n*3+2),c=this.world;const u=i.closed;let d=i.worldVerticesLength,f=d/6,p=Qs.NONE;if(!i.constantSpeed){const E=i.lengths;f-=u?1:2;const V=E[f];this.data.positionMode===Dn.Percent&&(o*=V);let q;switch(this.data.spacingMode){case Fi.Percent:q=V;break;case Fi.Proportional:q=V/n;break;default:q=1}c=ct.setArraySize(this.world,8);for(let W=0,J=0,K=0;WV){p!==Qs.AFTER&&(p=Qs.AFTER,i.computeWorldVertices(t,a,d-6,4,c,0,2)),this.addAfterPosition(me-V,c,0,l,J);continue}for(;;K++){const we=E[K];if(!(me>we)){if(K===0)me/=we;else{const Ee=E[K-1];me=(me-Ee)/(we-Ee)}break}}K!==p&&(p=K,u&&K===f?(i.computeWorldVertices(t,a,d-4,4,c,0,2),i.computeWorldVertices(t,a,0,4,c,4,2)):i.computeWorldVertices(t,a,K*6+2,8,c,0,2)),this.addCurvePosition(me,c[0],c[1],c[2],c[3],c[4],c[5],c[6],c[7],l,J,r||W>0&&fe===0)}return l}u?(d+=2,c=ct.setArraySize(this.world,d),i.computeWorldVertices(t,a,2,d-4,c,0,2),i.computeWorldVertices(t,a,0,2,c,d-4,2),c[d-2]=c[0],c[d-1]=c[1]):(f--,d-=4,c=ct.setArraySize(this.world,d),i.computeWorldVertices(t,a,2,d,c,0,2));const m=ct.setArraySize(this.curves,f);let g=0,v=c[0],b=c[1],y=0,w=0,A=0,T=0,_=0,R=0,P=0,F=0,I=0,k=0,B=0,D=0,U=0,L=0;for(let E=0,V=2;Eg){this.addAfterPosition(K-g,c,d-4,l,V);continue}for(;;q++){const fe=m[q];if(!(K>fe)){if(q===0)K/=fe;else{const me=m[q-1];K=(K-me)/(fe-me)}break}}if(q!==p){p=q;let fe=q*6;for(v=c[fe],b=c[fe+1],y=c[fe+2],w=c[fe+3],A=c[fe+4],T=c[fe+5],_=c[fe+6],R=c[fe+7],P=(v-y*2+A)*.03,F=(b-w*2+T)*.03,I=((y-A)*3-v+_)*.006,k=((w-T)*3-b+R)*.006,B=P*2+I,D=F*2+k,U=(y-v)*.3+P+I*.16666667,L=(w-b)*.3+F+k*.16666667,X=Math.sqrt(U*U+L*L),O[0]=X,fe=1;fe<8;fe++)U+=B,L+=D,B+=I,D+=k,X+=Math.sqrt(U*U+L*L),O[fe]=X;U+=B,L+=D,X+=Math.sqrt(U*U+L*L),O[8]=X,U+=B+I,L+=D+k,X+=Math.sqrt(U*U+L*L),O[9]=X,W=0}for(K*=X;;W++){const fe=O[W];if(!(K>fe)){if(W===0)K/=fe;else{const me=O[W-1];K=W+(K-me)/(fe-me)}break}}this.addCurvePosition(K*.1,v,b,y,w,A,T,_,R,l,V,r||E>0&&J===0)}return l}addBeforePosition(t,i,n,r,a){const o=i[n],h=i[n+1],l=i[n+2]-o,c=i[n+3]-h,u=Math.atan2(c,l);r[a]=o+t*Math.cos(u),r[a+1]=h+t*Math.sin(u),r[a+2]=u}addAfterPosition(t,i,n,r,a){const o=i[n+2],h=i[n+3],l=o-i[n],c=h-i[n+1],u=Math.atan2(c,l);r[a]=o+t*Math.cos(u),r[a+1]=h+t*Math.sin(u),r[a+2]=u}addCurvePosition(t,i,n,r,a,o,h,l,c,u,d,f){if(t===0||Number.isNaN(t)){u[d]=i,u[d+1]=n,u[d+2]=Math.atan2(a-n,r-i);return}const p=t*t,m=p*t,g=1-t,v=g*g,b=v*g,y=g*t,w=y*3,A=g*w,T=w*t,_=i*b+r*A+o*T+l*m,R=n*b+a*A+h*T+c*m;u[d]=_,u[d+1]=R,f&&(t<.001?u[d+2]=Math.atan2(a-n,r-i):u[d+2]=Math.atan2(R-(n*v+a*y*2+h*p),_-(i*v+r*y*2+o*p)))}sort(t){const i=this.slot.data.index,n=this.slot.bone;t.skin!=null&&this.sortPathSlot(t,t.skin,i,n),t.data.defaultSkin!=null&&t.data.defaultSkin!==t.skin&&this.sortPathSlot(t,t.data.defaultSkin,i,n),this.sortPath(t,this.slot.pose.attachment,n);const r=this.bones,a=this.bones.length;for(let o=0;o0,o=this.data.y>0,h=this.data.rotate>0||this.data.shearX>0,l=this.data.scaleX>0,c=this.bone;let u=c.bone.data.length,d=this.data.step,f=0;if(i!==ya.none){switch(c.modifyWorld(t),i){case ya.reset:this.reset(t);case ya.update:{const p=Math.max(t.time-this.lastTime,0),m=this.remaining;this.remaining+=p,this.lastTime=t.time;const g=c.worldX,v=c.worldY;if(this._reset)this._reset=!1,this.ux=g,this.uy=v;else{let b=this.remaining,y=n.inertia,w=t.data.referenceScale,A=-1,T=0,_=0,R=this.data.limit*p,P=R*Math.abs(t.scaleY);if(R*=Math.abs(t.scaleX),a||o){if(a){const F=(this.ux-g)*y;this.xOffset+=F>R?R:F<-R?-R:F,this.ux=g}if(o){const F=(this.uy-v)*y;this.yOffset+=F>P?P:F<-P?-P:F,this.uy=v}if(b>=d){const F=this.xOffset,I=this.yOffset;A=n.damping**(60*d),T=d*n.massInverse,_=n.strength;const k=w*n.wind,B=w*n.gravity,D=(k*t.windX+B*t.gravityX)*t.scaleX,U=(k*t.windY+B*t.gravityY)*t.scaleY;do a&&(this.xVelocity+=(D-this.xOffset*_)*T,this.xOffset+=this.xVelocity*d,this.xVelocity*=A),o&&(this.yVelocity-=(U+this.yOffset*_)*T,this.yOffset+=this.yVelocity*d,this.yVelocity*=A),b-=d;while(b>=d);this.xLag=this.xOffset-F,this.yLag=this.yOffset-I}f=Math.max(0,1-b/d),a&&(c.worldX+=(this.xOffset-this.xLag*f)*r*this.data.x),o&&(c.worldY+=(this.yOffset-this.yLag*f)*r*this.data.y)}if(h||l){let F=Math.atan2(c.c,c.a),I=0,k=0,B=0,D=this.cx-c.worldX,U=this.cy-c.worldY;if(D>R?D=R:D<-R&&(D=-R),U>P?U=P:U<-P&&(U=-P),b=this.remaining,h){B=(this.data.rotate+this.data.shearX)*r,f=this.rotateLag*Math.max(0,1-m/d);let L=Math.atan2(U+this.ty,D+this.tx)-F-(this.rotateOffset-f)*B;this.rotateOffset+=(L-Math.ceil(L*Ye.invPI2-.5)*Ye.PI2)*y,L=(this.rotateOffset-f)*B+F,I=Math.cos(L),k=Math.sin(L),l&&(L=u*c.getWorldScaleX(),L>0&&(this.scaleOffset+=(D*I+U*k)*y/L))}else{I=Math.cos(F),k=Math.sin(F);const L=u*c.getWorldScaleX()-this.scaleLag*Math.max(0,1-m/d);L>0&&(this.scaleOffset+=(D*I+U*k)*y/L)}if(b>=d){A===-1&&(A=n.damping**(60*d),T=d*n.massInverse,_=n.strength);const L=n.wind*t.windX+n.gravity*t.gravityX,N=(n.wind*t.windY+n.gravity*t.gravityY)*Dm.yDir,O=this.rotateOffset,X=this.scaleOffset,E=u/w;for(;;)if(b-=d,l&&(this.scaleVelocity+=(L*I-N*k-this.scaleOffset*_)*T,this.scaleOffset+=this.scaleVelocity*d,this.scaleVelocity*=A),h){if(this.rotateVelocity-=((L*k+N*I)*E+this.rotateOffset*_)*T,this.rotateOffset+=this.rotateVelocity*d,this.rotateVelocity*=A,b0){let b=0;this.data.rotate>0&&(b=p*this.data.rotate,m=Math.sin(b),g=Math.cos(b),v=c.b,c.b=g*v-m*c.d,c.d=m*v+g*c.d),b+=p*this.data.shearX,m=Math.sin(b),g=Math.cos(b),v=c.a,c.a=g*v-m*c.c,c.c=m*v+g*c.c}else p*=this.data.rotate,m=Math.sin(p),g=Math.cos(p),v=c.a,c.a=g*v-m*c.c,c.c=m*v+g*c.c,v=c.b,c.b=g*v-m*c.d,c.d=m*v+g*c.d}if(l){let p=1+(this.scaleOffset-this.scaleLag*f)*r*this.data.scaleX;switch(c.a*=p,c.c*=p,this.data.scaleYMode){case hs.Uniform:c.b*=p,c.d*=p;break;case hs.Volume:p=Math.abs(p),p=p>=.7?1/p:4-3.67347*p,c.b*=p,c.d*=p}}i!==ya.pose&&(this.tx=u*c.a,this.ty=u*c.c)}}sort(t){const i=this.bone.bone;t.sortBone(i),t._updateCache.push(this),t.sortReset(i.children),t.constrained(i)}isSourceActive(){return this.bone.bone.active}}class th extends ec{constructor(t){super(t,new Bm);x(this,"_bone",null);x(this,"x",0);x(this,"y",0);x(this,"rotate",0);x(this,"scaleX",0);x(this,"shearX",0);x(this,"limit",0);x(this,"step",0);x(this,"inertiaGlobal",!1);x(this,"strengthGlobal",!1);x(this,"dampingGlobal",!1);x(this,"massGlobal",!1);x(this,"windGlobal",!1);x(this,"gravityGlobal",!1);x(this,"mixGlobal",!1);x(this,"_scaleYMode",hs.None)}set bone(t){this._bone=t}get bone(){if(this._bone)return this._bone;throw new Error("BoneData not set.")}get scaleYMode(){return this._scaleYMode}set scaleYMode(t){if(t==null)throw new Error("scaleYMode cannot be null.");this._scaleYMode=t}create(t){return new Fu(this,t)}}typeof Math.fround>"u"&&(Math.fround=(s=>e=>(s[0]=e,s[0]))(new Float32Array(1)));class Nm{constructor(){x(this,"time",0);x(this,"mix",0)}set(e){this.time=e.time,this.mix=e.mix}}const Ml=class Ml extends Ql{constructor(t,i){super(t,new Nm,new Nm);x(this,"bone",null);if(!i)throw new Error("skeleton cannot be null.");t.bone!=null&&(this.bone=i.bones[t.bone.index])}copy(t){var i=new Ml(this.data,t);return i.pose.set(this.pose),i}update(t,i){const n=this.appliedPose;if(n.mix===0)return;const r=this.data,a=r.animation,o=this.bone;if(o!==null){if(!o.active)return;r.local&&o.appliedPose.validateLocalTransform(t),n.time=r.offset+(r.property.value(t,o.appliedPose,r.local,Ml.offsets)-r.property.offset)*r.scale,r.loop?n.time=a.duration+n.time%a.duration:n.time=Math.max(0,n.time)}const h=t.bones,l=a.bones;for(let c=0,u=a.bones.length;c=n.length&&(n.length=e+1),n[e]||(n[e]={}),n[e][t]=i}addSkin(e){for(let i=0;i= 0.");if(!n)throw new Error("boneData cannot be null.");this.index=t,this.boneData=n}}var Wh;(function(s){s[s.Normal=0]="Normal",s[s.Additive=1]="Additive",s[s.Multiply=2]="Multiply",s[s.Screen=3]="Screen"})(Wh||(Wh={}));class Vm{constructor(){x(this,"mixRotate",0);x(this,"mixX",0);x(this,"mixY",0);x(this,"mixScaleX",0);x(this,"mixScaleY",0);x(this,"mixShearY",0)}set(e){this.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY,this.mixScaleX=e.mixScaleX,this.mixScaleY=e.mixScaleY,this.mixShearY=e.mixShearY}}class Xp extends Ql{constructor(t,i){super(t,new Vm,new Vm);x(this,"bones");x(this,"source");if(!i)throw new Error("skeleton cannot be null.");this.bones=[];for(const r of t.bones)this.bones.push(i.bones[r.index].constrainedPose);const n=i.bones[t.source.index];if(n==null)throw new Error("source cannot be null.");this.source=n}copy(t){var i=new Xp(this.data,t);return i.pose.set(this.pose),i}update(t,i){const n=this.appliedPose;if(n.mixRotate===0&&n.mixX===0&&n.mixY===0&&n.mixScaleX===0&&n.mixScaleY===0&&n.mixShearY===0)return;const r=this.data,a=r.localSource,o=r.localTarget,h=r.additive,l=r.clamp,c=r.offsets,u=this.source.appliedPose;a&&u.validateLocalTransform(t);const d=r.properties,f=r.properties.length,p=this.bones;for(let m=0,g=this.bones.length;m0?n[Gt.ROTATION]:-n[Gt.ROTATION]);return o<0&&(o+=360),o}}class yS extends Uo{mix(e){return e.mixRotate}apply(e,t,i,n,r,a){if(r)i.rotation+=(a?n:n-i.rotation)*t.mixRotate;else{const o=e.scaleX,h=e.scaleY,l=1/o,c=1/h,u=i.a*l,d=i.b*l,f=i.c*c,p=i.d*c;n*=Ye.degRad,a||(n-=Math.atan2(f,u)),n>Ye.PI?n-=Ye.PI2:n<-Ye.PI&&(n+=Ye.PI2),n*=t.mixRotate;const m=Math.cos(n),g=Math.sin(n);i.a=(m*u-g*f)*o,i.b=(m*d-g*p)*o,i.c=(g*u+m*f)*h,i.d=(g*d+m*p)*h}}}class $m extends No{value(e,t,i,n){return i?t.x+n[Gt.X]:(n[Gt.X]*t.a+n[Gt.Y]*t.b+t.worldX)/e.scaleX}}class xS extends Uo{mix(e){return e.mixX}apply(e,t,i,n,r,a){r?i.x+=(a?n:n-i.x)*t.mixX:(a||(n-=i.worldX/e.scaleX),i.worldX+=n*t.mixX*e.scaleX)}}class Gm extends No{value(e,t,i,n){return i?t.y+n[Gt.Y]:(n[Gt.X]*t.c+n[Gt.Y]*t.d+t.worldY)/e.scaleY}}class bS extends Uo{mix(e){return e.mixY}apply(e,t,i,n,r,a){r?i.y+=(a?n:n-i.y)*t.mixY:(a||(n-=i.worldY/e.scaleY),i.worldY+=n*t.mixY*e.scaleY)}}class Hm extends No{value(e,t,i,n){if(i)return t.scaleX+n[Gt.SCALEX];const r=t.a/e.scaleX,a=t.c/e.scaleY;return Math.sqrt(r*r+a*a)+n[Gt.SCALEX]}}class wS extends Uo{mix(e){return e.mixScaleX}apply(e,t,i,n,r,a){if(r)a?i.scaleX*=1+(n-1)*t.mixScaleX:i.scaleX!==0&&(i.scaleX+=(n-i.scaleX)*t.mixScaleX);else if(a){const o=1+(n-1)*t.mixScaleX;i.a*=o,i.c*=o}else{let o=i.a/e.scaleX,h=i.c/e.scaleY,l=Math.sqrt(o*o+h*h);l!==0&&(l=1+(n-l)*t.mixScaleX/l,i.a*=l,i.c*=l)}}}class jm extends No{value(e,t,i,n){if(i)return t.scaleY+n[Gt.SCALEY];const r=t.b/e.scaleX,a=t.d/e.scaleY;return Math.sqrt(r*r+a*a)+n[Gt.SCALEY]}}class SS extends Uo{mix(e){return e.mixScaleY}apply(e,t,i,n,r,a){if(r)a?i.scaleY*=1+(n-1)*t.mixScaleY:i.scaleY!==0&&(i.scaleY+=(n-i.scaleY)*t.mixScaleY);else if(a){const o=1+(n-1)*t.mixScaleY;i.b*=o,i.d*=o}else{let o=i.b/e.scaleX,h=i.d/e.scaleY,l=Math.sqrt(o*o+h*h);l!==0&&(l=1+(n-l)*t.mixScaleY/l,i.b*=l,i.d*=l)}}}class Wm extends No{value(e,t,i,n){if(i)return t.shearY+n[Gt.SHEARY];const r=1/e.scaleX,a=1/e.scaleY;return(Math.atan2(t.d*a,t.b*r)-Math.atan2(t.c*a,t.a*r))*Ye.radDeg-90+n[Gt.SHEARY]}}class MS extends Uo{mix(e){return e.mixShearY}apply(e,t,i,n,r,a){if(r)a||(n-=i.shearY),i.shearY+=n*t.mixShearY;else{const o=e.scaleX,h=e.scaleY,l=i.b/o,c=i.d/h,u=Math.atan2(c,l);n=(n+90)*Ye.degRad,a?n-=Ye.PI/2:(n-=u-Math.atan2(i.c/h,i.a/o),n>Ye.PI?n-=Ye.PI2:n<-Ye.PI&&(n+=Ye.PI2)),n=u+n*t.mixShearY;const d=Math.sqrt(l*l+c*c);i.b=Math.cos(n)*d*o,i.d=Math.sin(n)*d*h}}}class r8{constructor(e){x(this,"scale",1);x(this,"attachmentLoader");x(this,"linkedMeshes",[]);this.attachmentLoader=e}readSkeletonData(e){const t=this.scale,i=new gS;i.name="";const n=new DO(e),r=n.readInt32(),a=n.readInt32();i.hash=a===0&&r===0?null:a.toString(16)+r.toString(16),i.version=n.readString(),i.x=n.readFloat(),i.y=n.readFloat(),i.width=n.readFloat(),i.height=n.readFloat(),i.referenceScale=n.readFloat()*t;const o=n.readBoolean();o&&(i.fps=n.readFloat(),i.imagesPath=n.readString(),i.audioPath=n.readString());let h=0;h=n.readInt(!0);for(let p=0;p>5;for(let w=0,A;w>1&1,v.spacingMode=b>>2&3,v.rotateMode=b>>4&3,(b&128)!==0&&(v.offsetRotation=n.readFloat());const y=v.setupPose;y.position=n.readFloat(),v.positionMode===Dn.Fixed&&(y.position*=t),y.spacing=n.readFloat(),(v.spacingMode===Fi.Length||v.spacingMode===Fi.Fixed)&&(y.spacing*=t),y.mixRotate=n.readFloat(),y.mixX=n.readFloat(),y.mixY=n.readFloat(),c.push(v);break}case oB:{const v=new th(m);v.bone=l[n.readInt(!0)];let b=n.readByte();if(v.skinRequired=(b&1)!==0,(b&2)!==0&&(v.x=n.readFloat()),(b&4)!==0&&(v.y=n.readFloat()),(b&8)!==0&&(v.rotate=n.readFloat()),(b&16)!==0){let w=n.readFloat();w<-2?(v.scaleYMode=hs.Volume,w=-2-w):w<0&&(v.scaleYMode=hs.Uniform,w=-1-w),v.scaleX=w}(b&32)!==0&&(v.shearX=n.readFloat()),v.limit=((b&64)!==0?n.readFloat():5e3)*t,v.step=1/n.readUnsignedByte();const y=v.setupPose;y.inertia=n.readFloat(),y.strength=n.readFloat(),y.damping=n.readFloat(),y.massInverse=(b&128)!==0?n.readFloat():1,y.wind=n.readFloat(),y.gravity=n.readFloat(),b=n.readByte(),(b&1)!==0&&(v.inertiaGlobal=!0),(b&2)!==0&&(v.strengthGlobal=!0),(b&4)!==0&&(v.dampingGlobal=!0),(b&8)!==0&&(v.massGlobal=!0),(b&16)!==0&&(v.windGlobal=!0),(b&32)!==0&&(v.gravityGlobal=!0),(b&64)!==0&&(v.mixGlobal=!0),y.mix=(b&128)!==0?n.readFloat():1,c.push(v);break}case lB:{const v=new ba(m),b=n.readByte();if(v.skinRequired=(b&1)!==0,v.loop=(b&2)!==0,v.additive=(b&4)!==0,(b&8)!==0){const y=n.readFloat();o&&(b&64)!==0?v.max=y:v.setupPose.time=y}if((b&16)!==0&&(v.setupPose.mix=(b&32)!==0?n.readFloat():1),(b&64)!==0){v.local=(b&128)!==0,v.bone=l[n.readInt(!0)];const y=n.readFloat();let w=1;switch(n.readByte()){case 0:v.property=new Ym;break;case 1:{w=t,v.property=new $m;break}case 2:{w=t,v.property=new Gm;break}case 3:v.property=new Hm;break;case 4:v.property=new jm;break;case 5:v.property=new Wm;break;default:continue}v.property.offset=y*w,v.offset=n.readFloat(),v.scale=n.readFloat()/w}c.push(v);break}}}const d=this.readSkin(n,i,!0,o);d&&(i.defaultSkin=d,i.skins.push(d));{let p=i.skins.length;for(ct.setArraySize(i.skins,h=p+n.readInt(!0));p0){b=[];for(let _=0;_>4,e.readFloat())}r.push(F);break}}}}}const o=i.slots.length,h=e.readInt(!0);if(h>0){const f=new Gr(h);for(let p=0;p0){const f=new Ul(c);for(let p=0;p>>1^-(i&1)}readStringRef(){const 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 i=0;i>4){case 12:case 13:t+=String.fromCharCode((n&31)<<6|this.readByte()&63),i+=2;break;case 14:t+=String.fromCharCode((n&15)<<12|(this.readByte()&63)<<6|this.readByte()&63),i+=3;break;default:t+=String.fromCharCode(n),i++}}return t}readFloat(){const e=this.buffer.getFloat32(this.index);return this.index+=4,e}readBoolean(){return this.readByte()!==0}}let NO=class{constructor(e,t,i,n,r,a){x(this,"source");x(this,"skinIndex");x(this,"slotIndex");x(this,"sourceIndex");x(this,"mesh");x(this,"inheritTimelines");this.mesh=e,this.skinIndex=t,this.slotIndex=i,this.sourceIndex=n,this.source=r,this.inheritTimelines=a}};class my{constructor(e=null,t,i=0){x(this,"bones");x(this,"vertices");x(this,"length");this.bones=e,this.vertices=t,this.length=i}}var qn;(function(s){s[s.Region=0]="Region",s[s.BoundingBox=1]="BoundingBox",s[s.Mesh=2]="Mesh",s[s.LinkedMesh=3]="LinkedMesh",s[s.Path=4]="Path",s[s.Point=5]="Point",s[s.Clipping=6]="Clipping"})(qn||(qn={}));function Mi(s,e,t,i){t instanceof ar?UO(s,e,t,i):XO(s,e,t,i)}function UO(s,e,t,i){let n=s.readFloat(),r=s.readFloat()*i;for(let a=0,o=0,h=t.getFrameCount()-1;t.setFrame(a,n,r),a!==h;a++){const l=s.readFloat(),c=s.readFloat()*i;switch(s.readByte()){case _n:t.setStepped(a);break;case Tn:Ot(s,t,o++,a,0,n,l,r,c,i)}n=l,r=c}e.push(t)}function XO(s,e,t,i){let n=s.readFloat(),r=s.readFloat()*i,a=s.readFloat()*i;for(let o=0,h=0,l=t.getFrameCount()-1;t.setFrame(o,n,r,a),o!==l;o++){const c=s.readFloat(),u=s.readFloat()*i,d=s.readFloat()*i;switch(s.readByte()){case _n:t.setStepped(o);break;case Tn:Ot(s,t,h++,o,0,n,c,r,u,i),Ot(s,t,h++,o,1,n,c,a,d,i)}n=c,r=u,a=d}e.push(t)}function py(s,e){const t=s.readInt(!0);if(t===0)return null;const i=new Array(e).fill(-1),n=new Array(e-t);let r=0,a=0;for(let o=0;o=0;o--)i[o]===-1&&(i[o]=n[--a]);return i}function Ot(s,e,t,i,n,r,a,o,h,l){e.setBezier(t,i,n,r,o,s.readFloat(),s.readFloat()*l,s.readFloat(),s.readFloat()*l,a,h)}const VO=0,YO=1,$O=2,GO=3,HO=4,jO=5,WO=6,zO=7,qO=8,KO=9,ZO=10,JO=0,QO=1,eB=2,tB=3,iB=4,sB=5,nB=0,rB=1,aB=2,oB=3,lB=4,cB=0,hB=1,uB=0,dB=1,fB=2,mB=0,pB=1,gB=2,vB=4,yB=5,xB=6,bB=7,wB=8,SB=0,MB=1,_n=1,Tn=2;class _B{constructor(e){x(this,"attachmentLoader");x(this,"scale",1);x(this,"linkedMeshes",[]);this.attachmentLoader=e}readSkeletonData(e){const t=this.scale,i=new gS,n=typeof e=="string"?JSON.parse(e):e,r=n.skeleton;if(r&&(i.hash=r.hash,i.version=r.spine,i.x=r.x,i.y=r.y,i.width=r.width,i.height=r.height,i.referenceScale=se(r,"referenceScale",100)*t,i.fps=r.fps,i.imagesPath=r.images??null,i.audioPath=r.audio??null),n.bones)for(let a=0;a0&&l.properties.push(T)}l.offsets[Gt.ROTATION]=se(a,"rotation",0),l.offsets[Gt.X]=se(a,"x",0)*t,l.offsets[Gt.Y]=se(a,"y",0)*t,l.offsets[Gt.SCALEX]=se(a,"scaleX",0),l.offsets[Gt.SCALEY]=se(a,"scaleY",0),l.offsets[Gt.SHEARY]=se(a,"shearY",0);const y=l.setupPose;d&&(y.mixRotate=se(a,"mixRotate",1)),f&&(y.mixX=se(a,"mixX",1)),p&&(y.mixY=se(a,"mixY",y.mixX)),m&&(y.mixScaleX=se(a,"mixScaleX",1)),g&&(y.mixScaleY=se(a,"mixScaleY",y.mixScaleX)),v&&(y.mixShearY=se(a,"mixShearY",1)),i.constraints.push(l);break}case"path":{const l=new eh(o);l.skinRequired=h;for(let f=0;f0){const d=i.findConstraint(l,th);if(!d)throw new Error(`Physics constraint not found: ${l}`);u=i.constraints.indexOf(d)}for(const d in c){const f=c[d];let p=f[0];if(!p)continue;const m=f.length;let g,v=0;if(d==="reset"){const b=new jh(m,u);for(let y=0;p!=null;p=f[y+1],y++)b.setFrame(y,se(p,"time",0));r.push(b);continue}switch(d){case"inertia":g=new nS(m,m,u);break;case"strength":g=new rS(m,m,u);break;case"damping":g=new aS(m,m,u);break;case"mass":g=new oS(m,m,u);break;case"wind":g=new lS(m,m,u);break;case"gravity":g=new cS(m,m,u);break;case"mix":{v=1,g=new hS(m,m,u);break}default:continue}Ss(r,f,g,v,1)}}if(e.slider)for(const l in e.slider){const c=e.slider[l],u=i.findConstraint(l,ba);if(!u)throw new Error(`Slider not found: ${l}`);const d=i.constraints.indexOf(u);for(const f in c){const p=c[f];if(!p[0])continue;const g=p.length;switch(f){case"time":Ss(r,p,new uS(g,g,d),1,1);break;case"mix":Ss(r,p,new dS(g,g,d),1,1);break}}}if(e.attachments)for(const l in e.attachments){const c=e.attachments[l],u=i.findSkin(l);if(!u)throw new Error(`Skin not found: ${l}`);for(const d in c){const f=c[d],p=i.findSlot(d);if(!p)throw new Error(`Attachment slot not found: ${d}`);const m=p.index;for(const g in f){const v=f[g],b=u.getAttachment(m,g);if(!b)throw new Error(`Timeline attachment not found: ${g}`);for(const y in v){const w=v[y];let A=w[0];if(A){if(y==="deform"){const T=b.bones,_=b.vertices,R=T?_.length/3*2:_.length,P=new Jw(w.length,w.length,m,b);let F=se(A,"time",0);for(let I=0,k=0;;I++){let B;const D=se(A,"vertices",null);if(!D)B=T?ct.newFloatArray(R):_;else{B=ct.newFloatArray(R);const O=se(A,"offset",0);if(ct.arrayCopy(D,0,B,O,D.length),n!==1)for(let X=O,E=X+D.length;X=0;l--)r[l]===-1&&(r[l]=a[--h]);return r}function Nt(s,e,t,i,n,r,a,o,h,l){if(s==="stepped")return e.setStepped(i),t;const c=n<<2,u=s[c],d=s[c+1]*l,f=s[c+2],p=s[c+3]*l;return e.setBezier(t,i,n,r,o,u,d,f,p,a,h),t+1}function se(s,e,t){return s[e]!==void 0?s[e]:t}class AB{newRegionAttachment(e,t,i,n){return new Eu(t,i)}newMeshAttachment(e,t,i,n){return new Zl(t,i)}newBoundingBoxAttachment(e,t){return new Q1(t)}newPathAttachment(e,t){return new Nl(t)}newPointAttachment(e,t){return new rw(t)}newClippingAttachment(e,t){return new _o(t)}}class EB{sequence(e){for(let t=0;t!Number.isInteger(c)||c<0||c>=a))throw new Error(`拖尾网格“${e}”的三角形索引越界`);const o=Number(s.hull)||0;if(!Number.isInteger(o)||o<0||o>a)throw new Error(`拖尾网格“${e}”的外轮廓数量无效`);if(Array.isArray(s.edges)&&s.edges.some(c=>!Number.isInteger(c)||c<0||c>=a*2||c%2))throw new Error(`拖尾网格“${e}”的外轮廓边索引越界`);if(n.length===i.length)return;let h=0,l=0;for(;h=t)throw new Error(`拖尾网格“${e}”引用了不存在的骨骼`);if(![p,m,g].every(Number.isFinite)||g<0)throw new Error(`拖尾网格“${e}”包含无效权重数据`);u+=g}if(Math.abs(u-1)>.001)throw new Error(`拖尾网格“${e}”的顶点权重之和不为 1`);l++}if(h!==n.length||l!==a)throw new Error(`拖尾网格“${e}”的顶点数量与 UV 不一致`)}function RB(s,e){var r,a,o,h;const t=Array.isArray(s.bones)?s.bones:[],i=new Map(t.map(l=>[String(l.name||""),l])),n=new Set;for(const l of t){if(l.inherit!=null&&!CB.has(l.inherit))throw new Error(`骨骼“${l.name||""}”的 inherit 值“${l.inherit}”不符合 Spine ${e} JSON 格式`);if(/_particle_\d+_trail_/.test(String(l.name||""))){const c=i.get(String(l.parent||""));if(!c||/_particle_\d+_trail_/.test(String(c.name||"")))throw new Error(`拖尾骨骼“${l.name||""}”必须直接挂在粒子系统骨骼下,不能组成骨骼链`)}}for(const l of Array.isArray(s.skins)?s.skins:[]){const c=(l==null?void 0:l.attachments)||{};for(const u of Object.keys(c))for(const d of Object.keys(c[u]||{})){const f=c[u][d];(f==null?void 0:f.type)==="mesh"&&(IB(f,d,t.length),((r=f.vertices)==null?void 0:r.length)!==((a=f.uvs)==null?void 0:a.length)&&n.add(u))}}for(const l of Object.values(s.animations||{}))for(const c of n){const u=(h=(o=l==null?void 0:l.slots)==null?void 0:o[c])==null?void 0:h.attachment;if(Array.isArray(u)&&u.some(d=>!(d!=null&&d.name)))throw new Error(`加权拖尾插槽“${c}”不能使用空附件,未出现或死亡阶段应将对应骨骼缩放设为 0`)}}function PB(s){var e;if(String(((e=s==null?void 0:s.skeleton)==null?void 0:e.spine)||"")!=="3.8")throw new Error("Spine 3.8 导出的版本标识必须为 3.8");for(const t of s.bones||[])if(t.inherit!=null)throw new Error(`Spine 3.8 骨骼“${t.name||""}”应使用 transform,不能使用 inherit`);for(const t of Object.values(s.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 i=[t];for(;i.length;){const n=i.pop();if(!(!n||typeof n!="object")){if(!Array.isArray(n)&&Array.isArray(n.curve))throw new Error("Spine 3.8 不支持 4.x 数组曲线格式");i.push(...Object.values(n))}}}}function vy(s,e){var a;const t=JSON.parse(s),i=Ph((a=t==null?void 0:t.skeleton)==null?void 0:a.spine);if(!i)throw new Error(`导出版本不受支持,仅支持 Spine ${Mm()}`);if(e&&i!==e)throw new Error(`导出版本不一致:设置为 Spine ${e},JSON 标记为 Spine ${i}`);RB(t,i),i==="3.8"&&PB(t);const n=i==="3.8"?yw(JSON.parse(JSON.stringify(t))):t,r=i==="4.3"?new _B(new EB).readSkeletonData(n):new Dh(new AB).readSkeletonData(n);if(!r.bones.length)throw new Error("导出结果缺少骨骼");return{version:i,bones:r.bones.length,slots:r.slots.length,animations:r.animations.length}}const _S="http://127.0.0.1:27843";class zh extends Error{constructor(t,i="CONNECTOR_ERROR",n){super(t);x(this,"code");x(this,"pairUrl");this.name="SpineConnectorError",this.code=i,this.pairUrl=n}}function zm(s,e){return String(s||"").trim().replace(/[\\/:*?"<>|]+/g,"_").replace(/^\.+/,"")||e}function kB(s,e){const t=/\.([a-z0-9]{2,5})$/i.exec(s);return t?`.${t[1].toLowerCase()}`:e.includes("jpeg")?".jpg":e.includes("webp")?".webp":e.includes("gif")?".gif":".png"}function FB(s,e,t){const i=String(s||"").replace(/\\/g,"/").split("/").filter(Boolean).map(r=>zm(r,"images")),n=zm(e.replace(/\.[^./\\]+$/,""),"image");return[...i,`${n}${kB(e,t)}`].join("/")}async function Ef(s,e,t){if(!s)return null;const i=await fetch(s);if(!i.ok)throw new Error(`无法读取导出图片:${t}`);const n=await i.blob(),r=new Uint8Array(await n.arrayBuffer());let a="";const o=32768;for(let h=0;ha.finally(()=>{i++,e==null||e(i,t.length)});for(const a of s.filter(o=>o.visible!==!1)){for(const o of a.config.imageResources)if(o.imageMode==="sequence"&&o.sequenceFrames.length)for(const h of o.sequenceFrames)t.push(n(Ef(h.previewUrl,o.textureFolder,h.name||o.textureName)));else t.push(n(Ef(o.previewUrl,o.textureFolder,o.textureName)));if(a.config.trail)for(const o of a.config.trailResources)t.push(n(Ef(o.previewUrl,"",o.textureName)))}const r=new Map;for(const a of await Promise.all(t))a&&!r.has(a.path)&&r.set(a.path,a);return[...r.values()]}async function OB(){try{const s=await fetch(`${_S}/v1/health`,{cache:"no-store"});if(!s.ok)throw new Error(`HTTP ${s.status}`);return{available:!0,...await s.json()}}catch(s){return{available:!1,authorized:!1,error:s instanceof Error?s.message:String(s)}}}async function BB(s,e){const t=await TS(s.systems,(n,r)=>{e==null||e({phase:"images",progress:r?n/r:1})}),i=JSON.stringify({schemaVersion:1,projectName:s.projectName,spineVersion:s.spineVersion,skeletonJson:s.skeletonJson,images:t});return new Promise((n,r)=>{const a=new XMLHttpRequest;a.open("POST",`${_S}/v1/convert`),a.responseType="blob",a.setRequestHeader("Content-Type","application/json"),a.upload.onprogress=o=>{e==null||e({phase:"upload",progress:o.lengthComputable&&o.total>0?o.loaded/o.total:null})},a.upload.onloadend=()=>e==null?void 0:e({phase:"processing",progress:null}),a.onprogress=o=>{e==null||e({phase:"download",progress:o.lengthComputable&&o.total>0?o.loaded/o.total:null})},a.onerror=()=>r(new zh("未检测到本地 Spine 连接器,请先启动连接器","CONNECTOR_OFFLINE")),a.onload=async()=>{const o=a.response;if(a.status<200||a.status>=300){let c={};try{c=JSON.parse(await o.text())}catch{}r(new zh(c.message||`Spine 连接器返回错误:HTTP ${a.status}`,c.code,c.pairUrl));return}const h=a.getResponseHeader("X-Spine-File-Name");let l=`${zm(s.projectName,"SpineParticle")}.zip`;if(h)try{l=decodeURIComponent(h)}catch{}n({blob:o,fileName:l,spineEditorVersion:a.getResponseHeader("X-Spine-Editor-Version")||s.spineVersion,imageCount:t.length})},a.send(i)})}function LB(s,e){const t=URL.createObjectURL(s),i=document.createElement("a");i.href=t,i.download=/\.zip$/i.test(e)?e:`${e}.zip`,i.style.display="none",document.body.appendChild(i),i.click(),i.remove(),setTimeout(()=>URL.revokeObjectURL(t),1e3)}const DB=Array.from({length:256},(s,e)=>{let t=e;for(let i=0;i<8;i++)t=t&1?3988292384^t>>>1:t>>>1;return t>>>0});function NB(s){let e=4294967295;for(const t of s)e=DB[(e^t)&255]^e>>>8;return(e^4294967295)>>>0}function UB(s){const e=String(s||"").replace(/\\/g,"/").split("/").filter(t=>t&&t!==".");if(!e.length||e.some(t=>t===".."))throw new Error("ZIP 文件路径无效");return e.join("/")}function XB(s=new Date){const e=Math.max(1980,s.getFullYear());return{time:s.getHours()<<11|s.getMinutes()<<5|Math.floor(s.getSeconds()/2),date:e-1980<<9|s.getMonth()+1<<5|s.getDate()}}function Cf(s){const e=new Uint8Array(s);return{bytes:e,view:new DataView(e.buffer)}}function yy(s){const e=new Uint8Array(s.reduce((i,n)=>i+n.length,0));let t=0;for(const i of s)e.set(i,t),t+=i.length;return e}function VB(s){const e=new TextEncoder,t=[],i=[],n=XB();let r=0;for(const h of s){const l=e.encode(UB(h.name)),c=NB(h.data),u=Cf(30);u.view.setUint32(0,67324752,!0),u.view.setUint16(4,20,!0),u.view.setUint16(6,2048,!0),u.view.setUint16(10,n.time,!0),u.view.setUint16(12,n.date,!0),u.view.setUint32(14,c,!0),u.view.setUint32(18,h.data.length,!0),u.view.setUint32(22,h.data.length,!0),u.view.setUint16(26,l.length,!0),t.push(u.bytes,l,h.data);const d=Cf(46);d.view.setUint32(0,33639248,!0),d.view.setUint16(4,20,!0),d.view.setUint16(6,20,!0),d.view.setUint16(8,2048,!0),d.view.setUint16(12,n.time,!0),d.view.setUint16(14,n.date,!0),d.view.setUint32(16,c,!0),d.view.setUint32(20,h.data.length,!0),d.view.setUint32(24,h.data.length,!0),d.view.setUint16(28,l.length,!0),d.view.setUint32(42,r,!0),i.push(d.bytes,l),r+=u.bytes.length+l.length+h.data.length}const a=yy(i),o=Cf(22);return o.view.setUint32(0,101010256,!0),o.view.setUint16(8,s.length,!0),o.view.setUint16(10,s.length,!0),o.view.setUint32(12,a.length,!0),o.view.setUint32(16,r,!0),new Blob([yy([...t,a,o.bytes])],{type:"application/zip"})}function YB(s){const e=atob(s),t=new Uint8Array(e.length);for(let i=0;ii===".."||/^[a-z]+:/i.test(i))?"images":t.join("/")}function GB(s){return String(s||"SpineParticle").replace(/\.json$/i,"").replace(/[\\/:*?"<>|]+/g,"_").replace(/^\.+/,"")||"SpineParticle"}async function HB(s){const e=await TS(s.systems);if(!e.length)throw new Error("当前可见粒子系统没有可导出的图片");const t=$B(s.imagesPath);return{blob:VB(e.map(n=>({name:`${t}/${n.path}`,data:YB(n.dataBase64)}))),imageCount:e.length,folder:t}}function jB(s,e){const t=`${GB(e)}-images.zip`,i=URL.createObjectURL(s),n=document.createElement("a");return n.href=i,n.download=t,n.style.display="none",document.body.appendChild(n),n.click(),n.remove(),setTimeout(()=>URL.revokeObjectURL(i),1e3),t}const WB={class:"panel"},zB={class:"panel-scroll"},qB={class:"group config-management"},KB={class:"caret"},ZB={class:"group-body config-management-body"},JB={class:"config-toolbar"},QB=["disabled"],eL={value:""},tL=["value"],iL={class:"group"},sL={class:"caret"},nL={class:"scene-actions"},rL=["disabled"],aL={class:"group-body"},oL={class:"tree scene-tree"},lL=["onClick"],cL={class:"tlabel"},hL=["title","aria-label","onClick"],uL={viewBox:"0 0 24 24","aria-hidden":"true"},dL={key:0,class:"eye-slash",d:"M4 4l16 16"},fL=["onClick"],mL=["onClick"],pL={class:"tlabel"},gL=["title","aria-label","onClick"],vL={viewBox:"0 0 24 24","aria-hidden":"true"},yL={key:0,class:"eye-slash",d:"M4 4l16 16"},xL=["onClick"],bL=["onClick"],wL={class:"tlabel"},SL=["title","aria-label","onClick"],ML={viewBox:"0 0 24 24","aria-hidden":"true"},_L={key:0,class:"eye-slash",d:"M4 4l16 16"},TL=["onClick"],AL=["onClick"],EL={class:"tlabel"},CL=["title","aria-label","onClick"],IL={viewBox:"0 0 24 24","aria-hidden":"true"},RL={key:0,class:"eye-slash",d:"M4 4l16 16"},PL=["onClick"],kL={key:0,class:"empty"},FL={class:"row"},OL={class:"seed-row scene-seed"},BL={class:"field-block"},LL={class:"field-grid"},DL={class:"field-block"},NL={class:"field-block check-field"},UL={class:"field-grid"},XL={class:"compact-field"},VL={class:"compact-field"},YL={class:"field-grid"},$L={class:"compact-field"},GL={class:"compact-field"},HL={key:1,class:"field-grid"},jL={class:"compact-field"},WL={class:"compact-field"},zL={key:2,class:"field-grid"},qL={class:"compact-field"},KL={class:"compact-field"},ZL={class:"field-block"},JL={key:4,class:"field-grid"},QL={class:"compact-field"},eD={class:"compact-field"},tD={class:"collider-follow-section"},iD={class:"follow-path"},sD={class:"field-block"},nD=["value"],rD={class:"field-grid"},aD={class:"compact-field"},oD={class:"compact-field"},lD={class:"follow-path"},cD={class:"field-block"},hD={class:"field-grid"},uD={class:"compact-field"},dD={class:"compact-field"},fD={class:"field-grid"},mD={class:"compact-field"},pD={class:"compact-field"},gD={class:"setting-line"},vD={class:"setting-line"},yD={class:"field-block"},xD={key:4,class:"panel-hint"},bD={class:"group"},wD={class:"caret"},SD={class:"group-body"},MD={class:"segs"},_D={class:"segs stream-behavior-segs"},TD={key:2,class:"stream-loop-options"},AD={class:"loop-section-row"},ED={class:"switch-row"},CD=["checked"],ID={key:0,class:"loop-duration-control"},RD={class:"switch-row loop-duration-toggle"},PD=["checked"],kD={class:"loop-section-duration"},FD=["value"],OD={key:1},BD={key:2,class:"loop-auto-duration"},LD={class:"loop-section-row"},DD={class:"switch-row"},ND=["checked"],UD={key:0,class:"loop-duration-control"},XD={class:"switch-row loop-duration-toggle"},VD=["checked"],YD={class:"loop-section-duration"},$D=["value"],GD={key:1},HD={key:2,class:"loop-auto-duration"},jD={key:3,class:"modifier-hint stream-loop-hint"},WD={class:"group"},zD={class:"caret"},qD={class:"group-body"},KD={class:"row"},ZD={class:"row"},JD=["value","disabled"],QD={key:0,class:"row"},eN={class:"row"},tN={key:0,value:"radial"},iN={key:1,value:"path-normal"},sN={key:2,value:"path-tangent"},nN={class:"group"},rN={class:"caret"},aN={class:"group-body attr-body"},oN={class:"attr-axis-head"},lN={class:"axis-modes"},cN={class:"life-item"},hN={class:"switch-row"},uN={class:"life-item"},dN={class:"switch-row"},fN={class:"axis-modes life-axis"},mN={class:"life-item"},pN={class:"switch-row"},gN={class:"group"},vN={class:"caret"},yN={class:"group-body"},xN={class:"seg"},bN={class:"row"},wN={class:"curve-wrap"},SN={class:"row"},MN=["onUpdate:modelValue"],_N=["onUpdate:modelValue"],TN={class:"row resource-color-row"},AN=["onUpdate:modelValue"],EN=["onUpdate:modelValue"],CN={key:0,class:"row resource-color-picker"},IN=["onUpdate:modelValue"],RN=["value","onChange","onKeydown"],PN={key:0,class:"random-color-hint"},kN={class:"resource-alpha-head"},FN={class:"alpha-modes"},ON=["onClick"],BN=["onClick"],LN=["onClick"],DN={class:"row"},NN=["onUpdate:modelValue"],UN={class:"resource-alpha-curve"},XN={class:"group"},VN={class:"caret"},YN={class:"group-body"},$N={class:"modifier-item"},GN={class:"switch-row modifier-switch"},HN={key:0,class:"modifier-params"},jN={class:"modifier-item"},WN={class:"switch-row modifier-switch"},zN={key:0,class:"modifier-params gravity-params"},qN={class:"modifier-mode-row"},KN={class:"modifier-item"},ZN={class:"switch-row modifier-switch"},JN={key:0,class:"modifier-params gravity-params"},QN={class:"modifier-mode-row"},e4={class:"modifier-item"},t4={class:"switch-row modifier-switch"},i4={key:0,class:"modifier-params"},s4={class:"row"},n4={class:"modifier-item"},r4={class:"switch-row modifier-switch"},a4={key:0,class:"modifier-params"},o4={class:"row"},l4={class:"row"},c4={class:"modifier-item"},h4={class:"switch-row modifier-switch"},u4={key:0,class:"modifier-params trail-params"},d4={class:"row"},f4=["onUpdate:modelValue"],m4={class:"row"},p4=["onUpdate:modelValue"],g4={class:"row"},v4=["onUpdate:modelValue"],y4={class:"switch-row trail-sub-switch"},x4=["onUpdate:modelValue"],b4={class:"switch-row trail-sub-switch"},w4=["onUpdate:modelValue"],S4={class:"trail-mode-head"},M4={class:"alpha-modes"},_4=["onClick"],T4=["onClick"],A4=["onClick"],E4={class:"row"},C4=["onUpdate:modelValue"],I4={key:6,class:"row trail-fixed-color"},R4=["onUpdate:modelValue"],P4=["value","onChange","onKeydown"],k4={class:"trail-mode-head"},F4={class:"alpha-modes"},O4=["onClick"],B4=["onClick"],L4=["onClick"],D4={class:"trail-grid-row"},N4={class:"modifier-item"},U4={class:"switch-row modifier-switch"},X4=["disabled"],V4={key:0,class:"modifier-params emitter-follow-params"},Y4={class:"field-block"},$4=["value"],G4={key:0,value:"bone"},H4={class:"field-block"},j4=["value"],W4={class:"field-block"},z4={class:"field-grid follow-grid"},q4={class:"compact-field"},K4={class:"compact-field"},Z4={class:"field-block"},J4={key:0,class:"bone-follow-target"},Q4={key:1,class:"bone-follow-missing"},e5={class:"field-block"},t5={class:"field-grid follow-grid"},i5={class:"compact-field"},s5={class:"compact-field"},n5={class:"bone-follow-transform-grid"},r5={class:"compact-field"},a5={class:"compact-field"},o5={class:"compact-field"},l5={class:"modifier-item"},c5={class:"switch-row modifier-switch"},h5={key:0,class:"modifier-params collision-filter-params"},u5={class:"collision-filter-tags"},d5=["title"],f5=["aria-label","onClick"],m5=["disabled","title"],p5={key:0,class:"collision-filter-empty"},g5={key:1,class:"collision-filter-picker"},v5=["onClick"],y5={class:"group"},x5={class:"caret"},b5={class:"group-body export-settings"},w5={class:"export-field"},S5={class:"export-field"},M5={class:"export-field"},_5={key:0,class:"export-help"},T5={class:"export-fps-row"},A5={class:"export-field export-fps-field"},E5={class:"export-checkbox"},C5={class:"export-switches"},I5={class:"switch-row export-switch"},R5={class:"switch-row export-switch"},P5={class:"switch-row export-switch export-switch-last"},k5={class:"spine-export-actions"},F5=["disabled","title"],O5=["disabled"],B5=["disabled","title"],L5={key:0},D5=["href"],N5=["href"],U5=$s({__name:"ParticlePanel",setup(s){const e=Kl();e.settings.exportSettings=m1(e.settings.exportSettings);const t=vt(()=>e.settings.exportSettings),i=lt(null),n=lt(""),r=lt([]),a=lt(!1),o=lt(""),h=lt(!1),l=lt(!1),c=lt(null),u=lt(""),d=lt(!1),f=lt(null),p=lt(""),m=lt(""),g=vt(()=>{const $=f.value;return $?$.available?$.spineFound?$.authorized?"连接器可用 · Spine 已就绪":"连接器已启动,当前网站尚未授权":"连接器已启动,但未找到 Spine":"本地 Spine 连接器未启动":"正在检测本地 Spine 连接器…"}),v=vt(()=>{var $,S,C,Q,Re,mt;return{ready:!!(($=f.value)!=null&&$.available)&&!!((S=f.value)!=null&&S.spineFound)&&!!((C=f.value)!=null&&C.authorized),warning:!!((Q=f.value)!=null&&Q.available)&&(!((Re=f.value)!=null&&Re.spineFound)||!((mt=f.value)!=null&&mt.authorized))}}),b=vt(()=>{var $,S,C;return!!(($=f.value)!=null&&$.available)&&!!((S=f.value)!=null&&S.spineFound)&&!!((C=f.value)!=null&&C.authorized)}),y=vt(()=>{const $=f.value;return!($!=null&&$.available)||!$.spineFound||$.authorized||typeof window>"u"?"":`http://127.0.0.1:27843/pair?origin=${encodeURIComponent(window.location.origin)}`}),w=vt(()=>{const $=f.value;return $?$.available?$.spineFound?$.authorized?"":"未授权":"未找到 Spine":"未启动":"检测中"}),A=vt(()=>l.value?"正在重新计算并生成 Spine 工程":w.value?`暂不可用:${w.value}`:`调用本机 Spine 自动生成 ${t.value.spineVersion} 工程`);function T($){return $==="跟随导出"?t.value.keyframeCurve==="bezier"?"bezier":"linear":$==="贝塞尔"?"bezier":"linear"}e.systems.length||e.addSystem();function _(){_w(e),h.value=!1,o.value="配置已保存到本地"}async function R($){var Q;const S=$.target,C=(Q=S.files)==null?void 0:Q[0];if(C){o.value="正在加载配置…",h.value=!1;try{await XP(e,C),o.value=`已加载:${C.name}`}catch(Re){h.value=!0,o.value=Re instanceof Error?Re.message:String(Re)}finally{S.value=""}}}async function P(){try{const $=await fetch(`/Preset/index.json?t=${Date.now()}`,{cache:"no-store"});if(!$.ok)throw new Error("无法读取预设列表");const S=await $.json();r.value=Array.isArray(S)?S.filter(C=>!!C&&typeof C.name=="string"&&typeof C.file=="string"):[]}catch{r.value=[]}}async function F(){const $=n.value;if(!$)return;a.value=!0,h.value=!1,o.value="正在加载预设…";const S=qv("加载预设",`正在下载 ${$}…`);try{await S.paint();const C=await fetch(`/Preset/${encodeURIComponent($)}`,{cache:"no-store"});if(!C.ok)throw new Error(`无法读取预设:${$}`);const Q=await Z3(C,Re=>{S.update(Re==null?null:Re*55,`正在下载 ${$}…`)});S.update(58,"正在解析预设配置…"),S.update(70,"正在解析并恢复预设资源…"),await Aw(e,Q),o.value=`已加载预设:${$.replace(/\.json$/i,"")}`,await S.finish("预设加载完成")}catch(C){h.value=!0;const Q=C instanceof Error?C.message:String(C);o.value=`${Q},请检查预设文件命名`,await S.fail(Q)}finally{a.value=!1,n.value=""}}Kr(()=>{P(),B(),I=window.setInterval(B,3e3)});let I,k=0;$l(()=>{I!==void 0&&window.clearInterval(I)});async function B(){const $=++k,S=await OB();if($!==k)return;f.value=S;const C=m.value;(C==="CONNECTOR_OFFLINE"?S.available:C==="SPINE_NOT_FOUND"?S.available&&S.spineFound:C==="ORIGIN_NOT_ALLOWED"?S.available&&S.spineFound&&S.authorized:!!C&&S.available&&S.spineFound&&S.authorized)&&(m.value="",p.value="",d.value&&(d.value=!1,u.value=""))}function D(){return new Promise($=>requestAnimationFrame(()=>$()))}async function U($){e.timeline.playing=!1,e.timeline.frame=0,e.timeline.recorded=!1;for(const Q of e.systems)Q.frames=void 0;e.recalcTotalFrames(),await D(),e.timeline.playing=!0;const S=e.timeline.totalFrames/Math.max(1,e.timeline.fps)*1e3,C=performance.now()+Math.max(8e3,S*2.5+3e3);for(;!e.timeline.recorded;){if(performance.now()>C)throw new Error("重新计算动画超时,请确认页面仍在运行后重试");$==null||$(Math.min(.98,e.timeline.frame/Math.max(1,e.timeline.totalFrames-1))),await new Promise(Q=>setTimeout(Q,50))}$==null||$(1)}async function L(){if(!l.value){l.value=!0,c.value="json",d.value=!1,m.value="",p.value="",u.value="正在重新计算粒子动画…";try{await U();const $=ry({systems:e.systems,timeline:e.timeline,settings:t.value});vy($.text,t.value.spineVersion),MO($,t.value.fileName);const S=$.warnings.length?`;${$.warnings.length} 条资源提示(缺图仍已导出)`:"";u.value=`已导出 Spine ${t.value.spineVersion}:${$.particleSystemCount} 个粒子系统、${$.animationCount} 个动画、${$.boneCount} 根骨骼${S}`}catch($){d.value=!0,u.value=$ instanceof Error?$.message:String($)}finally{l.value=!1,c.value=null}}}async function N(){if(l.value)return;l.value=!0,c.value="spine",d.value=!1,m.value="",p.value="",u.value="正在重新计算粒子动画…";const $=qv("导出 Spine 包","正在重新计算粒子动画…");try{await $.paint(),await U(Re=>$.update(Re*18,"正在重新计算粒子动画…")),$.update(20,"正在生成 Spine JSON…");const S=ry({systems:e.systems,timeline:e.timeline,settings:t.value});vy(S.text,t.value.spineVersion),u.value="正在整理图片并调用本机 Spine…";const C=t.value.fileName.replace(/\.json$/i,"")||"SpineParticle",Q=await BB({projectName:C,spineVersion:t.value.spineVersion,skeletonJson:S.text,systems:e.systems},({phase:Re,progress:mt})=>{Re==="images"?$.update(mt==null?null:22+mt*18,"正在整理工程图片…"):Re==="upload"?$.update(mt==null?null:40+mt*30,"正在上传数据到 Spine 连接器…"):Re==="processing"?$.update(null,"Spine 正在转换工程,请稍候…"):$.update(mt==null?null:82+mt*16,"正在下载生成的 Spine 工程包…")});$.update(99,"正在交给浏览器下载…"),LB(Q.blob,Q.fileName),u.value=`已生成 ${Q.fileName}:包含 .spine 工程和 ${Q.imageCount} 张图片,Spine ${Q.spineEditorVersion}`,await B(),await $.finish("Spine 工程包已开始下载")}catch(S){const C=S instanceof Error?S.message:String(S);d.value=!0,m.value=S instanceof zh?S.code:"",S instanceof zh&&S.pairUrl&&(p.value=S.pairUrl),u.value=C,await B(),await $.fail(C)}finally{l.value=!1,c.value=null}}async function O(){if(!l.value){l.value=!0,c.value="images",d.value=!1,m.value="",p.value="",u.value="正在整理当前粒子系统使用的图片…";try{const $=await HB({systems:e.systems,imagesPath:t.value.imagesPath}),S=jB($.blob,t.value.fileName);u.value=`已生成 ${S}:${$.folder}/ 内包含 ${$.imageCount} 张图片`}catch($){d.value=!0,u.value=$ instanceof Error?$.message:String($)}finally{l.value=!1,c.value=null}}}const X=vt(()=>{const $=e.systems.findIndex(S=>S.id===e.activeId);return $>=0?$:0}),E=vt(()=>e.systems[X.value]||null),V=vt(()=>E.value?p1(E.value.config,e.timeline.fps):30),q=vt(()=>{var S;const $=(S=E.value)==null?void 0:S.config;return $?Math.max(1,Math.ceil(Number($.loopDurationFrames)||1)):1}),W=vt(()=>e.activeObjectType),J=vt(()=>e.activeObjectType==="collision"&&e.colliders.find($=>$.id===e.activeObjectId)||null),K=vt(()=>e.activeObjectType==="path"&&e.paths.find($=>$.id===e.activeObjectId)||null),fe=vt(()=>e.activeObjectType==="spine"&&e.spines.find($=>$.id===e.activeObjectId)||null),me=vt(()=>e.activeObjectType==="particle"?e.systems.some($=>$.id===e.activeObjectId):e.activeObjectType==="collision"?e.colliders.some($=>$.id===e.activeObjectId):e.activeObjectType==="path"?e.paths.some($=>$.id===e.activeObjectId):e.spines.some($=>$.id===e.activeObjectId)),we=vt(()=>{const $=e.spines.find(S=>S.selectedBone&&S.bones.some(C=>C.name===S.selectedBone));return $?{spine:$,boneName:$.selectedBone}:null}),Ee=vt(()=>{var C;const $=(C=E.value)==null?void 0:C.config;if(!$||$.emitterFollowMode!=="bone")return null;const S=e.spines.find(Q=>Q.id===$.emitterFollowSpineId);return!S||!S.bones.some(Q=>Q.name===$.emitterFollowBoneName)?null:{spine:S,boneName:$.emitterFollowBoneName}}),pe=lt(!1),Ae=vt(()=>{var S;const $=new Set(((S=E.value)==null?void 0:S.config.collisionColliderIds)||[]);return e.colliders.filter(C=>$.has(C.id))}),G=vt(()=>{var S;const $=new Set(((S=E.value)==null?void 0:S.config.collisionColliderIds)||[]);return e.colliders.filter(C=>!$.has(C.id))});fs(()=>{var $,S;return[($=E.value)==null?void 0:$.id,(S=E.value)==null?void 0:S.config.collision]},()=>{pe.value=!1});function Z($){var C;const S=(C=E.value)==null?void 0:C.config;!S||S.collisionColliderIds.includes($)||(S.collisionColliderIds.push($),pe.value=!1)}function z($){var C;const S=(C=E.value)==null?void 0:C.config;S&&(S.collisionColliderIds=S.collisionColliderIds.filter(Q=>Q!==$))}Jo(()=>{for(const $ of e.systems)$.visible==null&&($.visible=!0);for(const $ of e.colliders)$.visible==null&&($.visible=!0);for(const $ of e.paths)$.visible==null&&($.visible=!0);for(const $ of e.spines)$.visible==null&&($.visible=!0)}),Jo(()=>{if(!E.value)return;const $=Wr(E.value.config);$.lifeMode==="curve"&&($.lifeMode="random"),$.speedMode==="curve"&&($.speedMode="random"),$.scaleMode==="curve"&&($.scaleMode="random"),$.initialRotationMode==="curve"&&($.initialRotationMode="random"),$.mode==="stream"&&!($.duration>0)&&($.duration=1),$.streamBehavior==="loop"&&($.emitterFollow||$.emitterFollowMode!=="none")&&st($)}),Jo(()=>{const $=new Set(e.colliders.map(S=>S.id));for(const S of e.systems){const C=Wr(S.config),Q=C.collisionColliderIds.filter(ut=>$.has(ut));if(Q.length!==C.collisionColliderIds.length&&(C.collisionColliderIds=Q),C.spawnPathId>0&&!e.paths.some(ut=>ut.id===C.spawnPathId)&&(C.spawnPathId=0,(C.emissionAngleMode==="path-normal"||C.emissionAngleMode==="path-tangent")&&(C.emissionAngleMode="fixed")),C.emitterFollowMode!=="bone")continue;const Re=e.spines.find(ut=>ut.id===C.emitterFollowSpineId);!!(Re!=null&&Re.bones.some(ut=>ut.name===C.emitterFollowBoneName))||(C.emitterFollowMode="none",C.emitterFollowSpineId=0,C.emitterFollowBoneName="")}}),Jo(()=>{for(const $ of e.colliders)$.followPathId==null&&($.followPathId=0),$.followDuration>0||($.followDuration=2),$.followPathRotation==null&&($.followPathRotation=!1),["跟随导出","线性","贝塞尔"].includes($.followCurveMode)||($.followCurveMode="跟随导出"),(!Array.isArray($.followCurve)||$.followCurve.length<2)&&($.followCurve=[{x:0,y:0},{x:1,y:1}])});const j=[{x:0,y:0},{x:1,y:1}],te=[{x:0,y:1},{x:1,y:1}],he=[{x:0,y:0},{x:.2,y:1},{x:.8,y:1},{x:1,y:0}],xe=[{x:0,y:0},{x:.1,y:1},{x:.9,y:1},{x:1,y:0}],oe=[{x:0,y:1},{x:1,y:1}],ge=[{x:0,y:1},{x:1,y:1}],le=Da({config:!0,scene:!1,emitMode:!0,shape:!0,attr:!0,look:!0,mods:!0,export:!1});function Oe($){le[$]=!le[$]}function Fe($){var C;const S=(C=E.value)==null?void 0:C.config;S&&(S.mode=$,$==="stream"&&!(S.duration>0)&&(S.duration=1))}function Be($){var Q;const S=(Q=E.value)==null?void 0:Q.config;if(!S)return;const C=Math.min(1800,Math.max(1,Math.ceil(Number($)||1)));S.loopDurationFrames=C}function st($){const S=Dl();$.emitterFollow=!1,$.emitterFollowMode="none",$.emitterFollowPathId=S.emitterFollowPathId,$.emitterFollowSpineId=S.emitterFollowSpineId,$.emitterFollowBoneName=S.emitterFollowBoneName,$.emitterFollowBoneOffsetX=S.emitterFollowBoneOffsetX,$.emitterFollowBoneOffsetY=S.emitterFollowBoneOffsetY,$.emitterFollowBoneRotation=S.emitterFollowBoneRotation,$.emitterFollowBoneScaleX=S.emitterFollowBoneScaleX,$.emitterFollowBoneScaleY=S.emitterFollowBoneScaleY,$.emitterAngleMode=S.emitterAngleMode,$.emitterFollowCurve=S.emitterFollowCurve.map(C=>({...C})),$.emitterFollowDuration=S.emitterFollowDuration,$.emitterFollowSpace=S.emitterFollowSpace,$.emitterFollowDirection=S.emitterFollowDirection,$.emitterFollowOffset=S.emitterFollowOffset}function St($){var Re;const S=(Re=E.value)==null?void 0:Re.config;if(!S||S.streamBehavior===$)return;const C=$==="loop",Q=C?"进入循环持续模式后,粒子跟随设置会失效并恢复默认值。是否继续?":"退出循环持续模式后,粒子跟随设置会失效并恢复默认值。是否继续?";window.confirm(Q)&&(st(S),S.streamBehavior=$,C||(S.generateLoopStartAnimation=!1,S.generateLoopEndAnimation=!1))}function At($,S){var Re;const C=(Re=E.value)==null?void 0:Re.config;if(!C)return;const Q=S.target.checked;$==="start"?C.generateLoopStartAnimation=Q:C.generateLoopEndAnimation=Q}function Et($,S){var Re;const C=(Re=E.value)==null?void 0:Re.config;if(!C)return;const Q=Math.min(1800,Math.max(1,Math.ceil(Number(S.target.value)||30)));$==="start"?C.loopStartDurationFrames=Q:C.loopEndDurationFrames=Q}function It($,S){var Re;const C=(Re=E.value)==null?void 0:Re.config;if(!C)return;const Q=S.target.checked;$==="start"?C.loopStartUseCustomDuration=Q:C.loopEndUseCustomDuration=Q}function Kt($,S){const C=$.target.value;if(S.emitterFollowMode=C,C!=="bone"){S.emitterFollowSpineId=0,S.emitterFollowBoneName="";return}Ti(S)}function Ti($){const S=we.value;if(!S){$.emitterFollowMode="none",$.emitterFollowSpineId=0,$.emitterFollowBoneName="";return}$.emitterFollowMode="bone",$.emitterFollowSpineId=S.spine.id,$.emitterFollowBoneName=S.boneName}const Wi={emitMode:["mode","rate","streamBehavior","loopDurationFrames","generateLoopStartAnimation","loopStartUseCustomDuration","loopStartDurationFrames","generateLoopEndAnimation","loopEndUseCustomDuration","loopEndDurationFrames","burstCount","burstLoop","delay","duration"],shape:["shape","shapeRangeVersion","innerRadius","outerRadius","innerRectW","innerRectH","outerRectW","outerRectH","spawnPathId","spawnPathDistribution","radius","rectW","rectH","emissionAngleMode","direction","spread","coneDirection","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","collisionColliderIds","pathFollow","emitterFollow","emitterFollowMode","emitterFollowPathId","emitterFollowSpineId","emitterFollowBoneName","emitterFollowBoneOffsetX","emitterFollowBoneOffsetY","emitterFollowBoneRotation","emitterFollowBoneScaleX","emitterFollowBoneScaleY","emitterAngleMode","emitterFollowCurve","emitterFollowDuration","emitterFollowSpace","emitterFollowDirection","emitterFollowOffset","damping"]};function zi($){var Q;const S=(Q=E.value)==null?void 0:Q.config;if($==="export"){e.settings.exportSettings=_p();return}if(!S)return;const C=Dl();for(const Re of Wi[$])S[Re]=C[Re]}function dn(){t.value.fps=Math.min(240,Math.max(1,Math.round(Number(t.value.fps)||30)))}function di($){var S;e.selectSystem(((S=e.systems[$])==null?void 0:S.id)??0)}function ce(){e.addSystem()}function de(){e.addCollider()}function Rt(){e.addPath()}function Wt(){e.addSpine()}function Zt(){e.duplicateSelectedObject()}function pt($,S,C=0,Q=0,Re=0,mt=0){return{x:$,y:S,inX:C,inY:Q,outX:Re,outY:mt}}function Rs(){const $=K.value;if(!(!$||!$.preset))if($.preset==="circle"){const C=60.751328;$.points=[pt(110,0,0,-C,0,C),pt(0,110,C,0,-C,0),pt(-110,0,0,C,0,-C),pt(0,-110,-C,0,C,0)],$.closed=!0}else if($.preset==="square")$.points=[pt(-100,-100),pt(100,-100),pt(100,100),pt(-100,100)],$.closed=!0;else{const S=$.preset==="star"?10:6;$.points=Array.from({length:S},(C,Q)=>{const Re=$.preset==="star"&&Q%2?50:110,mt=-Math.PI*.5+Q/S*Math.PI*2;return pt(Math.cos(mt)*Re,Math.sin(mt)*Re)}),$.closed=!0}}function Hs(){K.value&&(K.value.points=[])}function Ui(){E.value&&(E.value.config.seed=Math.floor(Math.random()*999999)+1)}function Ps($){var C;const S=(C=E.value)==null?void 0:C.config;!S||$==="direction"||(S.speedOverLifeMode=$,$==="curve"&&S.speedOverLifeMin===S.speedOverLifeMax&&(S.speedOverLifeMin=0,S.speedOverLifeMax=1))}function br(){var S;const $=(S=E.value)==null?void 0:S.config;!$||$.scaleOverLifeMode!=="curve"||($.scaleOverLifeMin===$.scaleOverLifeMax&&($.scaleOverLifeMin=0,$.scaleOverLifeMax=1),$.scaleYOverLifeMin===$.scaleYOverLifeMax&&($.scaleYOverLifeMin=0,$.scaleYOverLifeMax=1))}function js($){var C;const S=(C=E.value)==null?void 0:C.config;!S||$==="direction"||(S.scaleOverLifeMode=$,br())}const ss={point:{emissionAngleMode:"random",direction:0,spread:360},circle:{innerRadius:0,outerRadius:100,emissionAngleMode:"fixed",direction:-90,spread:0},rect:{innerRectW:0,innerRectH:0,outerRectW:200,outerRectH:100,emissionAngleMode:"fixed",direction:-90,spread:0},cone:{innerRadius:0,outerRadius:100,coneAngle:90,coneDirection:90,emissionAngleMode:"random",direction:90,spread:90},path:{spawnPathId:0,spawnPathDistribution:"fixed",emissionAngleMode:"fixed",direction:0,spread:0}};function $a(){var C;const $=(C=E.value)==null?void 0:C.config;if(!$)return;const S=ss[$.shape];S&&Object.assign($,S)}function Ga(){var S;const $=(S=E.value)==null?void 0:S.config;!$||$.spawnPathId>0||($.emissionAngleMode==="path-normal"||$.emissionAngleMode==="path-tangent")&&($.emissionAngleMode="fixed")}const Qr=lt(null),Ws=lt(null),ws=lt(null),Vn=lt(null),ks=lt(null);function ea(){var C;const $=(C=E.value)==null?void 0:C.config;if(!$)return;const S=Math.max(0,...$.trailResources.map(Q=>Q.id))+1;$.trailResources.push({id:S,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:oe.map(Q=>({...Q})),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:te.map(Q=>({...Q})),shapeEnabled:!1,shapeCurve:ge.map(Q=>({...Q}))}),_e()}function ta($){var S;ks.value=$,(S=Vn.value)==null||S.click()}function H($,S){var Re;const C=(Re=E.value)==null?void 0:Re.config;if(!C)return;const Q=$==="trailGridCols"?32:16;C[$]=Math.min(Q,Math.max(2,Math.round(Number(S)||2)))}function Y($,S){var Q;const C=(Q=E.value)==null?void 0:Q.config.trailResources.find(Re=>Re.id===$);C&&(C.boneCount=Math.min(16,Math.max(2,Math.round(Number(S)||2))))}function ee($,S){var Q;const C=(Q=E.value)==null?void 0:Q.config.trailResources.find(Re=>Re.id===$);C&&(C.rotation=Math.max(-360,Math.min(360,Number(S)||0)))}async function ne($){var ut,ni;const S=$.target,C=(ut=S.files)==null?void 0:ut[0],Q=(ni=E.value)==null?void 0:ni.config,Re=Q==null?void 0:Q.trailResources.find(Vt=>Vt.id===ks.value);if(!C||!Re){S.value="";return}const mt=await nt(C);Re.texture=Dr(await gt.fromURL(mt)),Re.previewUrl=mt,Re.textureName=C.name.replace(/\.[^.]+$/,"")||"trail",S.value="",ks.value=null}async function ue($){var Q;const S=(Q=E.value)==null?void 0:Q.config,C=S==null?void 0:S.trailResources.find(Re=>Re.id===$);C&&(C.texture=Dr(await gt.fromURL("/images/trail.png")),C.previewUrl="/images/trail.png",C.textureName="trail",C.weight=100,C.locked=!1,C.rotation=0,C.boneCount=3,C.trailRatio=100,C.lengthMode="fixed",C.length=100,C.lengthMin=100,C.lengthMax=100,C.widthSizeMode="fixed",C.width=100,C.widthMin=100,C.widthMax=100,C.widthMode="particle",C.lifeLengthEnabled=!1,C.lifeLengthCurve=te.map(Re=>({...Re})),C.shapeEnabled=!1,C.shapeCurve=ge.map(Re=>({...Re})),C.colorMode="particle",C.color="#ffffff",C.colorGradient=[{position:0,color:"#ffffff"},{position:1,color:"#ffffff"}],C.blend="normal",C.alphaMode="particle",C.alpha=1,C.alphaCurve=oe.map(Re=>({...Re})),_e())}function ve($){var Q;const S=(Q=E.value)==null?void 0:Q.config.trailResources;if(!S||S.length<=1)return;const C=S.findIndex(Re=>Re.id===$);C>=0&&S.splice(C,1),_e()}function _e(){var Re;const $=(Re=E.value)==null?void 0:Re.config.trailResources;if(!($!=null&&$.length))return;if($.length===1){$[0].weight=100,$[0].locked=!1;return}const S=$.filter(mt=>mt.locked),C=$.filter(mt=>!mt.locked);let Q=S.reduce((mt,ut)=>mt+Math.max(0,Number(ut.weight)||0),0);Q>100&&(si(S,100,!0),Q=100),si(C,100-Q)}function Me($,S){var ni;const C=(ni=E.value)==null?void 0:ni.config.trailResources;if(!(C!=null&&C.length))return;if(C.length===1){C[0].weight=100,C[0].locked=!1;return}const Q=C.find(Vt=>Vt.id===$);if(!Q||Q.locked)return;const Re=C.filter(Vt=>Vt.id!==$&&Vt.locked).reduce((Vt,rs)=>Vt+Math.max(0,Number(rs.weight)||0),0),mt=Math.max(0,100-Re),ut=C.filter(Vt=>Vt.id!==$&&!Vt.locked);Q.weight=Bt(Math.min(mt,Math.max(0,Number(S)||0))),ut.length?si(ut,mt-Q.weight,!0):Q.weight=Bt(mt)}function be($){var Q;const S=(Q=E.value)==null?void 0:Q.config.trailResources;if(!S||S.length===1)return;const C=S.find(Re=>Re.id===$);C&&(C.locked=!C.locked)}function De($,S){const C=S.target;$.color=Se(C.value,$.color),C.value=$.color}function Ie($,S){De($,S),S.target.blur()}function Le(){var C;const $=(C=E.value)==null?void 0:C.config;if(!$)return;const S=Math.max(0,...$.imageResources.map(Q=>Q.id))+1;$.imageResources.push({id:S,texture:$.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:xe.map(Q=>({...Q}))}),Ci()}function Te($){var S;ws.value=$,(S=Qr.value)==null||S.click()}function je($){var S;ws.value=$,(S=Ws.value)==null||S.click()}async function rt($){var ni,Vt;const S=$.target,C=(ni=S.files)==null?void 0:ni[0],Q=(Vt=E.value)==null?void 0:Vt.config,Re=Q==null?void 0:Q.imageResources.find(rs=>rs.id===ws.value);if(!C||!Re){S.value="";return}const mt=await nt(C),ut=Dr(await gt.fromURL(mt));Re.texture=ut,Re.previewUrl=mt,Re.textureFolder="",Re.textureName=C.name.replace(/\.[^.]+$/,"")||"particle",S.value="",ws.value=null}async function Je($){var mt;const S=$.target,C=Array.from(S.files||[]).sort((ut,ni)=>ut.name.localeCompare(ni.name,void 0,{numeric:!0,sensitivity:"base"})),Q=(mt=E.value)==null?void 0:mt.config,Re=Q==null?void 0:Q.imageResources.find(ut=>ut.id===ws.value);if(!C.length||!Re){S.value="";return}Re.sequenceFrames=await Promise.all(C.map(async ut=>{const ni=await nt(ut);return{name:ut.name,previewUrl:ni,texture:Dr(await gt.fromURL(ni))}})),Re.imageMode="sequence",S.value="",ws.value=null}function nt($){return new Promise((S,C)=>{const Q=new FileReader;Q.onload=()=>S(String(Q.result||"")),Q.onerror=()=>C(Q.error),Q.readAsDataURL($)})}function Qe($){var Q;const S=(Q=E.value)==null?void 0:Q.config,C=S==null?void 0:S.imageResources.find(Re=>Re.id===$);!S||!C||(C.texture=S.texture,C.textureName="star",C.textureFolder="",C.previewUrl="/images/star.png",C.imageMode="fixed",C.sequencePlayback="loop-forward",C.sequenceFps=30,C.sequenceFrames=[],C.scale=1,C.anchorX=.5,C.anchorY=.5,C.colorMode="fixed",C.colorStart="#ffffff",C.colorEnd="#ff4d4d",C.colorGradient=[{position:0,color:"#ffffff"},{position:1,color:"#ff4d4d"}],C.blend="normal",C.independentAlpha="off",C.alpha=1,C.alphaCurveMode="跟随导出",C.alphaCurve=xe.map(Re=>({...Re})),C.locked=!1,Ci())}function Se($,S){let C=$.trim().replace(/^#/,"");return/^[0-9a-f]{3}$/i.test(C)&&(C=C.split("").map(Q=>Q+Q).join("")),/^[0-9a-f]{6}$/i.test(C)?`#${C.toLowerCase()}`:S}function at($,S){const C=S.target;$.colorStart=Se(C.value,$.colorStart),C.value=$.colorStart}function Pe($,S){at($,S),S.target.blur()}function Xt($){var Q;const S=(Q=E.value)==null?void 0:Q.config.imageResources;if(!S||S.length<=1)return;const C=S.findIndex(Re=>Re.id===$);C>=0&&S.splice(C,1),Ci()}function Bt($){return Math.round($)}function si($,S,C=!1){if(!$.length)return;const Q=Math.max(0,Bt(S)),Re=C?$.reduce((ut,ni)=>ut+Math.max(0,Number(ni.weight)||0),0):0;let mt=0;$.forEach((ut,ni)=>{const Vt=ni===$.length-1,rs=Bt(Vt?Q-mt:Re>0?Q*Math.max(0,Number(ut.weight)||0)/Re:Q/$.length);ut.weight=rs,mt+=rs})}function Ci(){var Re;const $=(Re=E.value)==null?void 0:Re.config.imageResources;if(!($!=null&&$.length))return;if($.length===1){$[0].weight=100,$[0].locked=!1;return}const S=$.filter(mt=>mt.locked),C=$.filter(mt=>!mt.locked);let Q=S.reduce((mt,ut)=>mt+Math.max(0,Number(ut.weight)||0),0);Q>100&&(si(S,100,!0),Q=100),si(C,100-Q)}function ns($,S){var ni;const C=(ni=E.value)==null?void 0:ni.config.imageResources;if(!(C!=null&&C.length))return;if(C.length===1){C[0].weight=100,C[0].locked=!1;return}const Q=C.find(Vt=>Vt.id===$);if(!Q||Q.locked)return;const Re=C.filter(Vt=>Vt.id!==$&&Vt.locked).reduce((Vt,rs)=>Vt+Math.max(0,Number(rs.weight)||0),0),mt=Math.max(0,100-Re),ut=C.filter(Vt=>Vt.id!==$&&!Vt.locked);if(Q.weight=Bt(Math.min(mt,Math.max(0,Number(S)||0))),!ut.length){Q.weight=Bt(mt);return}si(ut,mt-Q.weight,!0)}function Ha($){var Q;const S=(Q=E.value)==null?void 0:Q.config.imageResources;if(!S||S.length===1)return;const C=S.find(Re=>Re.id===$);C&&(C.locked=!C.locked)}return($,S)=>(ie(),ae("div",WB,[S[391]||(S[391]=M("div",{class:"panel-header"},[M("span",null,"Spine粒子编辑器-Yeomai")],-1)),M("div",zB,[M("div",qB,[M("div",{class:"group-head",onClick:S[0]||(S[0]=C=>Oe("config"))},[M("span",KB,Xe(le.config?"▸":"▾"),1),S[197]||(S[197]=M("span",null,"配置管理",-1))]),ye(M("div",ZB,[M("div",JB,[M("button",{title:"保存全部编辑器配置 (Ctrl+S)",onClick:_},"保存配置"),M("button",{title:"加载本地编辑器配置",onClick:S[1]||(S[1]=C=>{var Q;return(Q=i.value)==null?void 0:Q.click()})},"加载配置"),ye(M("select",{"onUpdate:modelValue":S[2]||(S[2]=C=>n.value=C),"aria-label":"预设列表",disabled:!r.value.length||a.value,onPointerdown:P,onFocus:P,onChange:F},[M("option",eL,Xe(r.value.length?"选择预设":"无预设文件"),1),(ie(!0),ae(Ke,null,ci(r.value,C=>(ie(),ae("option",{key:C.file,value:C.file},Xe(C.name),9,tL))),128))],40,QB),[[Ht,n.value]]),M("input",{ref_key:"configFileInput",ref:i,hidden:"",type:"file",accept:".json,application/json",onChange:R},null,544)]),o.value?(ie(),ae("div",{key:0,class:Ze(["config-message",{error:h.value}])},Xe(o.value),3)):Ve("",!0)],512),[[Yi,!le.config]])]),M("div",iL,[M("div",{class:"group-head scene-head",onClick:S[3]||(S[3]=C=>Oe("scene"))},[M("span",sL,Xe(le.scene?"▸":"▾"),1),S[198]||(S[198]=M("span",null,"场景对象",-1)),M("div",nL,[M("button",{class:"scene-add",title:"添加粒子系统",onClick:bt(ce,["stop"])},"+粒子"),M("button",{class:"scene-add",title:"添加碰撞体",onClick:bt(de,["stop"])},"+碰撞"),M("button",{class:"scene-add",title:"添加路径",onClick:bt(Rt,["stop"])},"+路径"),M("button",{class:"scene-add",title:"添加 Spine",onClick:bt(Wt,["stop"])},"+Spine"),M("button",{class:"scene-add",disabled:!me.value,title:"复制当前选中的场景对象",onClick:bt(Zt,["stop"])},"+Copy",8,rL)])]),ye(M("div",aL,[M("div",oL,[(ie(!0),ae(Ke,null,ci(ke(e).systems,(C,Q)=>(ie(),ae("div",{key:`particle-${C.id}`,class:Ze(["tree-item scene-object-item",{on:W.value==="particle"&&C.id===ke(e).activeObjectId}]),onClick:Re=>di(Q)},[S[201]||(S[201]=M("span",{class:"tdot"},"●",-1)),M("span",cL,Xe(C.config.name||"ParticleSystem"+(Q+1)),1),M("button",{class:Ze(["scene-object-eye",{off:C.visible===!1}]),title:C.visible===!1?"显示粒子系统":"隐藏粒子系统","aria-label":C.visible===!1?"显示粒子系统":"隐藏粒子系统",onClick:bt(Re=>C.visible=C.visible===!1,["stop"])},[(ie(),ae("svg",uL,[S[199]||(S[199]=M("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)),S[200]||(S[200]=M("circle",{cx:"12",cy:"12",r:"2.8"},null,-1)),C.visible===!1?(ie(),ae("path",dL)):Ve("",!0)]))],10,hL),S[202]||(S[202]=M("span",{class:"scene-object-kind"},"粒子",-1)),M("button",{class:"scene-object-delete",title:"删除粒子系统",onClick:bt(Re=>ke(e).removeSystem(C.id),["stop"])},"✕",8,fL)],10,lL))),128)),(ie(!0),ae(Ke,null,ci(ke(e).colliders,C=>(ie(),ae("div",{key:`collision-${C.id}`,class:Ze(["tree-item scene-object-item",{on:W.value==="collision"&&C.id===ke(e).activeObjectId}]),onClick:Q=>ke(e).selectSceneObject("collision",C.id)},[S[205]||(S[205]=M("span",{class:"tdot collision-dot"},"■",-1)),M("span",pL,Xe(C.name),1),M("button",{class:Ze(["scene-object-eye",{off:C.visible===!1}]),title:C.visible===!1?"显示碰撞体":"隐藏碰撞体","aria-label":C.visible===!1?"显示碰撞体":"隐藏碰撞体",onClick:bt(Q=>C.visible=C.visible===!1,["stop"])},[(ie(),ae("svg",vL,[S[203]||(S[203]=M("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)),S[204]||(S[204]=M("circle",{cx:"12",cy:"12",r:"2.8"},null,-1)),C.visible===!1?(ie(),ae("path",yL)):Ve("",!0)]))],10,gL),S[206]||(S[206]=M("span",{class:"scene-object-kind"},"碰撞",-1)),M("button",{class:"scene-object-delete",title:"删除碰撞体",onClick:bt(Q=>ke(e).removeCollider(C.id),["stop"])},"✕",8,xL)],10,mL))),128)),(ie(!0),ae(Ke,null,ci(ke(e).paths,C=>(ie(),ae("div",{key:`path-${C.id}`,class:Ze(["tree-item scene-object-item",{on:W.value==="path"&&C.id===ke(e).activeObjectId}]),onClick:Q=>ke(e).selectSceneObject("path",C.id)},[S[209]||(S[209]=M("span",{class:"tdot path-dot"},"◇",-1)),M("span",wL,Xe(C.name),1),M("button",{class:Ze(["scene-object-eye",{off:C.visible===!1}]),title:C.visible===!1?"显示路径":"隐藏路径","aria-label":C.visible===!1?"显示路径":"隐藏路径",onClick:bt(Q=>C.visible=C.visible===!1,["stop"])},[(ie(),ae("svg",ML,[S[207]||(S[207]=M("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)),S[208]||(S[208]=M("circle",{cx:"12",cy:"12",r:"2.8"},null,-1)),C.visible===!1?(ie(),ae("path",_L)):Ve("",!0)]))],10,SL),S[210]||(S[210]=M("span",{class:"scene-object-kind"},"路径",-1)),M("button",{class:"scene-object-delete",title:"删除路径",onClick:bt(Q=>ke(e).removePath(C.id),["stop"])},"✕",8,TL)],10,bL))),128)),(ie(!0),ae(Ke,null,ci(ke(e).spines,C=>(ie(),ae("div",{key:`spine-${C.id}`,class:Ze(["tree-item scene-object-item",{on:W.value==="spine"&&C.id===ke(e).activeObjectId}]),onClick:Q=>ke(e).selectSceneObject("spine",C.id)},[S[213]||(S[213]=M("span",{class:"tdot spine-dot"},"◆",-1)),M("span",EL,Xe(C.name),1),M("button",{class:Ze(["scene-object-eye",{off:C.visible===!1}]),title:C.visible===!1?"显示 Spine":"隐藏 Spine","aria-label":C.visible===!1?"显示 Spine":"隐藏 Spine",onClick:bt(Q=>C.visible=C.visible===!1,["stop"])},[(ie(),ae("svg",IL,[S[211]||(S[211]=M("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)),S[212]||(S[212]=M("circle",{cx:"12",cy:"12",r:"2.8"},null,-1)),C.visible===!1?(ie(),ae("path",RL)):Ve("",!0)]))],10,CL),S[214]||(S[214]=M("span",{class:"scene-object-kind"},"Spine",-1)),M("button",{class:"scene-object-delete",title:"删除 Spine",onClick:bt(Q=>ke(e).removeSpine(C.id),["stop"])},"✕",8,PL)],10,AL))),128)),!ke(e).systems.length&&!ke(e).colliders.length&&!ke(e).paths.length&&!ke(e).spines.length?(ie(),ae("div",kL,"场景中暂无对象")):Ve("",!0)]),W.value==="particle"&&E.value?(ie(),ae(Ke,{key:0},[M("label",FL,[S[215]||(S[215]=M("span",null,"名称",-1)),ye(M("input",{"onUpdate:modelValue":S[4]||(S[4]=C=>E.value.config.name=C),class:"inp"},null,512),[[ht,E.value.config.name]])]),Ue(qe,{label:"位置X",min:-2e3,max:2e3,step:1,modelValue:E.value.config.centerX,"onUpdate:modelValue":S[5]||(S[5]=C=>E.value.config.centerX=C)},null,8,["modelValue"]),Ue(qe,{label:"位置Y",min:-2e3,max:2e3,step:1,modelValue:E.value.config.centerY,"onUpdate:modelValue":S[6]||(S[6]=C=>E.value.config.centerY=C)},null,8,["modelValue"]),Ue(qe,{label:"偏移X",min:-2e3,max:2e3,step:1,modelValue:E.value.config.offsetX,"onUpdate:modelValue":S[7]||(S[7]=C=>E.value.config.offsetX=C)},null,8,["modelValue"]),Ue(qe,{label:"偏移Y",min:-2e3,max:2e3,step:1,modelValue:E.value.config.offsetY,"onUpdate:modelValue":S[8]||(S[8]=C=>E.value.config.offsetY=C)},null,8,["modelValue"]),Ue(qe,{label:"旋转",min:-360,max:360,step:1,modelValue:E.value.config.rootRotation,"onUpdate:modelValue":S[9]||(S[9]=C=>E.value.config.rootRotation=C)},null,8,["modelValue"]),Ue(qe,{label:"缩放X",min:.05,max:10,step:.05,modelValue:E.value.config.rootScaleX,"onUpdate:modelValue":S[10]||(S[10]=C=>E.value.config.rootScaleX=C)},null,8,["modelValue"]),Ue(qe,{label:"缩放Y",min:.05,max:10,step:.05,modelValue:E.value.config.rootScaleY,"onUpdate:modelValue":S[11]||(S[11]=C=>E.value.config.rootScaleY=C)},null,8,["modelValue"]),M("div",OL,[S[216]||(S[216]=M("label",{for:"system-seed"},"随机种子",-1)),ye(M("input",{id:"system-seed",class:"seed-input",type:"number",min:"0",step:"1","onUpdate:modelValue":S[12]||(S[12]=C=>E.value.config.seed=C),title:"控制粒子系统内全部随机属性、资源选择与修改器随机采样"},null,512),[[ht,E.value.config.seed,void 0,{number:!0}]]),M("button",{class:"seed-random",title:"生成新的全局随机种子",onClick:Ui},"⚄")]),S[217]||(S[217]=M("div",{class:"seed-hint"},"控制初始随机参数、资源选择和修改器随机采样;相同种子可复现相同效果",-1))],64)):J.value?(ie(),ae(Ke,{key:1},[S[242]||(S[242]=M("div",{class:"object-editor-title"},"碰撞体属性",-1)),M("label",BL,[S[218]||(S[218]=M("span",null,"碰撞体名称",-1)),ye(M("input",{"onUpdate:modelValue":S[13]||(S[13]=C=>J.value.name=C),class:"inp"},null,512),[[ht,J.value.name]])]),M("div",LL,[M("label",DL,[S[220]||(S[220]=M("span",null,"类型",-1)),ye(M("select",{"onUpdate:modelValue":S[14]||(S[14]=C=>J.value.shape=C),class:"inp"},[...S[219]||(S[219]=[Ts('',5)])],512),[[Ht,J.value.shape]])]),M("label",NL,[S[221]||(S[221]=M("span",null,"启用",-1)),ye(M("input",{"onUpdate:modelValue":S[15]||(S[15]=C=>J.value.enabled=C),type:"checkbox"},null,512),[[ei,J.value.enabled]])])]),M("div",UL,[M("label",XL,[S[222]||(S[222]=M("span",null,"X 位置",-1)),ye(M("input",{"onUpdate:modelValue":S[16]||(S[16]=C=>J.value.x=C),type:"number",class:"inp"},null,512),[[ht,J.value.x,void 0,{number:!0}]])]),M("label",VL,[S[223]||(S[223]=M("span",null,"Y 位置",-1)),ye(M("input",{"onUpdate:modelValue":S[17]||(S[17]=C=>J.value.y=C),type:"number",class:"inp"},null,512),[[ht,J.value.y,void 0,{number:!0}]])])]),Ue(qe,{label:"旋转",min:-360,max:360,step:1,modelValue:J.value.rotation,"onUpdate:modelValue":S[18]||(S[18]=C=>J.value.rotation=C)},null,8,["modelValue"]),M("div",YL,[M("label",$L,[S[224]||(S[224]=M("span",null,"缩放 X",-1)),ye(M("input",{"onUpdate:modelValue":S[19]||(S[19]=C=>J.value.scaleX=C),type:"number",min:"0.05",step:"0.05",class:"inp"},null,512),[[ht,J.value.scaleX,void 0,{number:!0}]])]),M("label",GL,[S[225]||(S[225]=M("span",null,"缩放 Y",-1)),ye(M("input",{"onUpdate:modelValue":S[20]||(S[20]=C=>J.value.scaleY=C),type:"number",min:"0.05",step:"0.05",class:"inp"},null,512),[[ht,J.value.scaleY,void 0,{number:!0}]])])]),J.value.shape==="circle"?(ie(),Jt(qe,{key:0,label:"半径",min:1,max:1e3,step:1,modelValue:J.value.radius,"onUpdate:modelValue":S[21]||(S[21]=C=>J.value.radius=C)},null,8,["modelValue"])):J.value.shape==="ellipse"?(ie(),ae("div",HL,[M("label",jL,[S[226]||(S[226]=M("span",null,"X 半径",-1)),ye(M("input",{"onUpdate:modelValue":S[22]||(S[22]=C=>J.value.radiusX=C),type:"number",min:"1",class:"inp"},null,512),[[ht,J.value.radiusX,void 0,{number:!0}]])]),M("label",WL,[S[227]||(S[227]=M("span",null,"Y 半径",-1)),ye(M("input",{"onUpdate:modelValue":S[23]||(S[23]=C=>J.value.radiusY=C),type:"number",min:"1",class:"inp"},null,512),[[ht,J.value.radiusY,void 0,{number:!0}]])])])):(ie(),ae("div",zL,[M("label",qL,[S[228]||(S[228]=M("span",null,"宽度",-1)),ye(M("input",{"onUpdate:modelValue":S[24]||(S[24]=C=>J.value.width=C),type:"number",min:"1",class:"inp"},null,512),[[ht,J.value.width,void 0,{number:!0}]])]),M("label",KL,[S[229]||(S[229]=M("span",null,"高度",-1)),ye(M("input",{"onUpdate:modelValue":S[25]||(S[25]=C=>J.value.height=C),type:"number",min:"1",class:"inp"},null,512),[[ht,J.value.height,void 0,{number:!0}]])])])),J.value.shape==="polygon"||J.value.shape==="custom"?(ie(),Jt(qe,{key:3,label:"边数",min:3,max:16,step:1,modelValue:J.value.sides,"onUpdate:modelValue":S[26]||(S[26]=C=>J.value.sides=C)},null,8,["modelValue"])):Ve("",!0),M("label",ZL,[S[231]||(S[231]=M("span",null,"碰撞响应",-1)),ye(M("select",{"onUpdate:modelValue":S[27]||(S[27]=C=>J.value.response=C),class:"inp"},[...S[230]||(S[230]=[M("option",{value:"physics"},"物理(弹跳/摩擦)",-1),M("option",{value:"pause"},"暂停(停止不动)",-1),M("option",{value:"destroy"},"消失(立即销毁)",-1)])],512),[[Ht,J.value.response]])]),J.value.response==="physics"?(ie(),ae("div",JL,[M("label",QL,[S[232]||(S[232]=M("span",null,"弹性 (0-1)",-1)),ye(M("input",{"onUpdate:modelValue":S[28]||(S[28]=C=>J.value.elasticity=C),type:"number",min:"0",max:"1",step:"0.01",class:"inp"},null,512),[[ht,J.value.elasticity,void 0,{number:!0}]])]),M("label",eD,[S[233]||(S[233]=M("span",null,"摩擦 (0-1)",-1)),ye(M("input",{"onUpdate:modelValue":S[29]||(S[29]=C=>J.value.friction=C),type:"number",min:"0",max:"1",step:"0.01",class:"inp"},null,512),[[ht,J.value.friction,void 0,{number:!0}]])])])):Ve("",!0),M("div",tD,[M("label",iD,[ye(M("input",{"onUpdate:modelValue":S[30]||(S[30]=C=>J.value.followPath=C),type:"checkbox"},null,512),[[ei,J.value.followPath]]),S[234]||(S[234]=Qt("跟随路径移动",-1))]),J.value.followPath?(ie(),ae(Ke,{key:0},[M("label",sD,[S[236]||(S[236]=M("span",null,"目标路径",-1)),ye(M("select",{"onUpdate:modelValue":S[31]||(S[31]=C=>J.value.followPathId=C),class:"inp"},[S[235]||(S[235]=M("option",{value:0},"(未选择)",-1)),(ie(!0),ae(Ke,null,ci(ke(e).paths,C=>(ie(),ae("option",{key:C.id,value:C.id},Xe(C.name),9,nD))),128))],512),[[Ht,J.value.followPathId,void 0,{number:!0}]])]),M("div",rD,[M("label",aD,[S[237]||(S[237]=M("span",null,"移动时长(秒)",-1)),ye(M("input",{"onUpdate:modelValue":S[32]||(S[32]=C=>J.value.followDuration=C),type:"number",min:"0.05",step:"0.05",class:"inp"},null,512),[[ht,J.value.followDuration,void 0,{number:!0}]])]),M("label",oD,[S[239]||(S[239]=M("span",null,"曲线模式",-1)),ye(M("select",{"onUpdate:modelValue":S[33]||(S[33]=C=>J.value.followCurveMode=C),class:"inp"},[...S[238]||(S[238]=[M("option",null,"跟随导出",-1),M("option",null,"线性",-1),M("option",null,"贝塞尔",-1)])],512),[[Ht,J.value.followCurveMode]])])]),M("label",lD,[ye(M("input",{"onUpdate:modelValue":S[34]||(S[34]=C=>J.value.followPathRotation=C),type:"checkbox"},null,512),[[ei,J.value.followPathRotation]]),S[240]||(S[240]=Qt("方向沿路径",-1))]),S[241]||(S[241]=M("div",{class:"collider-curve-title"},[Qt("移动进度曲线 "),M("small",null,"横轴:实时/移动时长 纵轴:路径进度(0=起点 → 1=终点)")],-1)),Ue(xn,{"model-value":J.value.followCurve||j,"default-value":j,mode:T(J.value.followCurveMode),"onUpdate:modelValue":S[35]||(S[35]=C=>J.value.followCurve=C)},null,8,["model-value","mode"])],64)):Ve("",!0)])],64)):K.value?(ie(),ae(Ke,{key:2},[S[252]||(S[252]=M("div",{class:"object-editor-title"},"路径属性",-1)),M("label",cD,[S[243]||(S[243]=M("span",null,"路径名称",-1)),ye(M("input",{"onUpdate:modelValue":S[36]||(S[36]=C=>K.value.name=C),class:"inp"},null,512),[[ht,K.value.name]])]),M("div",hD,[M("label",uD,[S[244]||(S[244]=M("span",null,"X 位置",-1)),ye(M("input",{"onUpdate:modelValue":S[37]||(S[37]=C=>K.value.x=C),type:"number",class:"inp"},null,512),[[ht,K.value.x,void 0,{number:!0}]])]),M("label",dD,[S[245]||(S[245]=M("span",null,"Y 位置",-1)),ye(M("input",{"onUpdate:modelValue":S[38]||(S[38]=C=>K.value.y=C),type:"number",class:"inp"},null,512),[[ht,K.value.y,void 0,{number:!0}]])])]),Ue(qe,{label:"旋转",min:-360,max:360,step:1,modelValue:K.value.rotation,"onUpdate:modelValue":S[39]||(S[39]=C=>K.value.rotation=C)},null,8,["modelValue"]),M("div",fD,[M("label",mD,[S[246]||(S[246]=M("span",null,"缩放 X",-1)),ye(M("input",{"onUpdate:modelValue":S[40]||(S[40]=C=>K.value.scaleX=C),type:"number",min:"0.05",step:"0.05",class:"inp"},null,512),[[ht,K.value.scaleX,void 0,{number:!0}]])]),M("label",pD,[S[247]||(S[247]=M("span",null,"缩放 Y",-1)),ye(M("input",{"onUpdate:modelValue":S[41]||(S[41]=C=>K.value.scaleY=C),type:"number",min:"0.05",step:"0.05",class:"inp"},null,512),[[ht,K.value.scaleY,void 0,{number:!0}]])])]),M("label",gD,[S[248]||(S[248]=M("span",null,"闭合路径",-1)),ye(M("input",{"onUpdate:modelValue":S[42]||(S[42]=C=>K.value.closed=C),type:"checkbox"},null,512),[[ei,K.value.closed]])]),M("label",vD,[S[249]||(S[249]=M("span",null,"路径颜色",-1)),ye(M("input",{"onUpdate:modelValue":S[43]||(S[43]=C=>K.value.color=C),type:"color",class:"path-color"},null,512),[[ht,K.value.color]])]),S[253]||(S[253]=Ts('
操作说明:
  • 双击空白处/曲线:新建锚点
  • 双击锚点:删除节点
  • 双击第二下按住拖动:新建并拉出手柄
  • 拖动锚点移动位置,拖动手柄调整曲线
  • Shift+拖动手柄:两侧完全对称
  • Alt+拖动手柄:独立控制单侧
  • Ctrl+点击/框选:加选节点
  • Alt+点击/框选:减选节点
  • Alt+单击空白处:清除全部选中
  • 选中多个节点后可整体拖动
',1)),M("label",yD,[S[251]||(S[251]=M("span",null,"应用预设形状",-1)),ye(M("select",{"onUpdate:modelValue":S[44]||(S[44]=C=>K.value.preset=C),class:"inp"},[...S[250]||(S[250]=[Ts('',5)])],512),[[Ht,K.value.preset]])]),M("button",{class:"path-action primary",onClick:Rs},"应用预设"),M("button",{class:"path-action",onClick:Hs},"清空锚点")],64)):fe.value?(ie(),Jt(q3,{key:3,"spine-object":fe.value},null,8,["spine-object"])):(ie(),ae("div",xD,"使用右上角按钮创建场景对象"))],512),[[Yi,!le.scene]])]),W.value==="particle"&&E.value?(ie(),ae(Ke,{key:0},[M("div",bD,[M("div",{class:"group-head",onClick:S[46]||(S[46]=C=>Oe("emitMode"))},[M("span",wD,Xe(le.emitMode?"▸":"▾"),1),S[254]||(S[254]=M("span",null,"发射模式",-1)),M("button",{class:"group-reset",title:"重置发射模式参数",onClick:S[45]||(S[45]=bt(C=>zi("emitMode"),["stop"]))},"重置")]),ye(M("div",SD,[M("div",MD,[M("button",{class:Ze(["seg",{on:E.value.config.mode==="stream"}]),onClick:S[47]||(S[47]=C=>Fe("stream"))},"持续",2),M("button",{class:Ze(["seg",{on:E.value.config.mode==="burst"}]),onClick:S[48]||(S[48]=C=>Fe("burst"))},"爆发",2)]),E.value.config.mode==="stream"?(ie(),ae(Ke,{key:0},[M("div",_D,[M("button",{class:Ze(["seg",{on:E.value.config.streamBehavior==="normal"}]),onClick:S[49]||(S[49]=C=>St("normal"))},"常规持续",2),M("button",{class:Ze(["seg",{on:E.value.config.streamBehavior==="loop"}]),onClick:S[50]||(S[50]=C=>St("loop"))},"循环持续",2)]),Ue(qe,{label:"发射速率",min:1,max:300,step:1,modelValue:E.value.config.rate,"onUpdate:modelValue":S[51]||(S[51]=C=>E.value.config.rate=C)},null,8,["modelValue"]),E.value.config.streamBehavior==="normal"?(ie(),Jt(qe,{key:0,label:"发射时长",min:1/30,max:60,step:1/30,modelValue:E.value.config.duration,"onUpdate:modelValue":S[52]||(S[52]=C=>E.value.config.duration=C)},null,8,["modelValue"])):(ie(),Jt(qe,{key:1,label:"发射时长 (f)",min:1,max:1800,step:1,"model-value":q.value,"onUpdate:modelValue":Be},null,8,["model-value"])),E.value.config.streamBehavior==="loop"?(ie(),ae("div",TD,[M("div",AD,[M("label",ED,[M("input",{type:"checkbox",checked:E.value.config.generateLoopStartAnimation,onChange:S[53]||(S[53]=C=>At("start",C))},null,40,CD),S[255]||(S[255]=M("span",{class:"switch-ui"},null,-1)),S[256]||(S[256]=M("span",null,"生成开始循环动画",-1))]),E.value.config.generateLoopStartAnimation?(ie(),ae("div",ID,[M("label",RD,[M("input",{type:"checkbox",checked:E.value.config.loopStartUseCustomDuration,onChange:S[54]||(S[54]=C=>It("start",C))},null,40,PD),S[257]||(S[257]=M("span",{class:"switch-ui"},null,-1)),S[258]||(S[258]=M("span",null,"指定时长",-1))]),M("label",kD,[E.value.config.loopStartUseCustomDuration?(ie(),ae("input",{key:0,value:E.value.config.loopStartDurationFrames,type:"number",min:"1",max:"1800",step:"1","aria-label":"开始循环段时长",onChange:S[55]||(S[55]=C=>Et("start",C))},null,40,FD)):Ve("",!0),E.value.config.loopStartUseCustomDuration?(ie(),ae("span",OD,"f")):(ie(),ae("span",BD,"自动 "+Xe(V.value)+"f",1))])])):Ve("",!0)]),M("div",LD,[M("label",DD,[M("input",{type:"checkbox",checked:E.value.config.generateLoopEndAnimation,onChange:S[56]||(S[56]=C=>At("end",C))},null,40,ND),S[259]||(S[259]=M("span",{class:"switch-ui"},null,-1)),S[260]||(S[260]=M("span",null,"生成结束循环动画",-1))]),E.value.config.generateLoopEndAnimation?(ie(),ae("div",UD,[M("label",XD,[M("input",{type:"checkbox",checked:E.value.config.loopEndUseCustomDuration,onChange:S[57]||(S[57]=C=>It("end",C))},null,40,VD),S[261]||(S[261]=M("span",{class:"switch-ui"},null,-1)),S[262]||(S[262]=M("span",null,"指定时长",-1))]),M("label",YD,[E.value.config.loopEndUseCustomDuration?(ie(),ae("input",{key:0,value:E.value.config.loopEndDurationFrames,type:"number",min:"1",max:"1800",step:"1","aria-label":"结束循环段时长",onChange:S[58]||(S[58]=C=>Et("end",C))},null,40,$D)):Ve("",!0),E.value.config.loopEndUseCustomDuration?(ie(),ae("span",GD,"f")):(ie(),ae("span",HD,"自动 "+Xe(V.value)+"f",1))])])):Ve("",!0)])])):Ve("",!0),E.value.config.streamBehavior==="loop"?(ie(),ae("div",jD,"循环持续模式不支持骨骼跟随和路径跟随;进入或退出时会将粒子跟随设置恢复默认值。")):Ve("",!0)],64)):(ie(),Jt(qe,{key:1,label:"单次数量",min:1,max:1e3,step:1,modelValue:E.value.config.burstCount,"onUpdate:modelValue":S[59]||(S[59]=C=>E.value.config.burstCount=C)},null,8,["modelValue"])),Ue(qe,{label:"延迟时间",min:0,max:5,step:.1,modelValue:E.value.config.delay,"onUpdate:modelValue":S[60]||(S[60]=C=>E.value.config.delay=C)},null,8,["modelValue"])],512),[[Yi,!le.emitMode]])]),M("div",WD,[M("div",{class:"group-head",onClick:S[62]||(S[62]=C=>Oe("shape"))},[M("span",zD,Xe(le.shape?"▸":"▾"),1),S[263]||(S[263]=M("span",null,"发射器形状",-1)),M("button",{class:"group-reset",title:"重置发射器形状参数",onClick:S[61]||(S[61]=bt(C=>zi("shape"),["stop"]))},"重置")]),ye(M("div",qD,[M("label",KD,[S[265]||(S[265]=M("span",null,"形状",-1)),ye(M("select",{"onUpdate:modelValue":S[63]||(S[63]=C=>E.value.config.shape=C),class:"inp",onChange:$a},[...S[264]||(S[264]=[Ts('',5)])],544),[[Ht,E.value.config.shape]])]),E.value.config.shape==="circle"||E.value.config.shape==="cone"?(ie(),ae(Ke,{key:0},[Ue(qe,{label:E.value.config.shape==="cone"?"内径":"内半径",min:0,max:E.value.config.outerRadius,step:1,modelValue:E.value.config.innerRadius,"onUpdate:modelValue":S[64]||(S[64]=C=>E.value.config.innerRadius=C)},null,8,["label","max","modelValue"]),Ue(qe,{label:E.value.config.shape==="cone"?"外径":"外半径",min:E.value.config.innerRadius,max:300,step:1,modelValue:E.value.config.outerRadius,"onUpdate:modelValue":S[65]||(S[65]=C=>E.value.config.outerRadius=C)},null,8,["label","min","modelValue"])],64)):Ve("",!0),E.value.config.shape==="cone"?(ie(),ae(Ke,{key:1},[Ue(qe,{label:"锥形朝向",min:-360,max:360,step:1,modelValue:E.value.config.coneDirection,"onUpdate:modelValue":S[66]||(S[66]=C=>E.value.config.coneDirection=C)},null,8,["modelValue"]),Ue(qe,{label:"锥形开口角度",min:1,max:360,step:1,modelValue:E.value.config.coneAngle,"onUpdate:modelValue":S[67]||(S[67]=C=>E.value.config.coneAngle=C)},null,8,["modelValue"])],64)):E.value.config.shape==="rect"?(ie(),ae(Ke,{key:2},[Ue(qe,{label:"内宽",min:0,max:E.value.config.outerRectW,step:1,modelValue:E.value.config.innerRectW,"onUpdate:modelValue":S[68]||(S[68]=C=>E.value.config.innerRectW=C)},null,8,["max","modelValue"]),Ue(qe,{label:"内高",min:0,max:E.value.config.outerRectH,step:1,modelValue:E.value.config.innerRectH,"onUpdate:modelValue":S[69]||(S[69]=C=>E.value.config.innerRectH=C)},null,8,["max","modelValue"]),Ue(qe,{label:"外宽",min:E.value.config.innerRectW,max:400,step:1,modelValue:E.value.config.outerRectW,"onUpdate:modelValue":S[70]||(S[70]=C=>E.value.config.outerRectW=C)},null,8,["min","modelValue"]),Ue(qe,{label:"外高",min:E.value.config.innerRectH,max:400,step:1,modelValue:E.value.config.outerRectH,"onUpdate:modelValue":S[71]||(S[71]=C=>E.value.config.outerRectH=C)},null,8,["min","modelValue"])],64)):E.value.config.shape==="path"?(ie(),ae(Ke,{key:3},[M("label",ZD,[S[267]||(S[267]=M("span",null,"选择路径",-1)),ye(M("select",{"onUpdate:modelValue":S[72]||(S[72]=C=>E.value.config.spawnPathId=C),class:"inp",onChange:Ga},[S[266]||(S[266]=M("option",{value:0},"无路径(点发射)",-1)),(ie(!0),ae(Ke,null,ci(ke(e).paths,C=>(ie(),ae("option",{key:C.id,value:C.id,disabled:!C.enabled},Xe(C.name),9,JD))),128))],544),[[Ht,E.value.config.spawnPathId,void 0,{number:!0}]])]),E.value.config.spawnPathId>0?(ie(),ae("label",QD,[S[269]||(S[269]=M("span",null,"出生分布",-1)),ye(M("select",{"onUpdate:modelValue":S[73]||(S[73]=C=>E.value.config.spawnPathDistribution=C),class:"inp"},[...S[268]||(S[268]=[M("option",{value:"fixed"},"等间距固定分布",-1),M("option",{value:"random"},"随机分布",-1)])],512),[[Ht,E.value.config.spawnPathDistribution]])])):Ve("",!0)],64)):Ve("",!0),S[273]||(S[273]=M("div",{class:"divider"},null,-1)),M("label",eN,[S[272]||(S[272]=M("span",null,"发射角度",-1)),ye(M("select",{"onUpdate:modelValue":S[74]||(S[74]=C=>E.value.config.emissionAngleMode=C),class:"inp"},[S[270]||(S[270]=M("option",{value:"fixed"},"固定",-1)),S[271]||(S[271]=M("option",{value:"random"},"随机",-1)),E.value.config.shape==="circle"||E.value.config.shape==="rect"||E.value.config.shape==="cone"?(ie(),ae("option",tN,"径向(中心向外)")):Ve("",!0),E.value.config.shape==="path"&&E.value.config.spawnPathId>0?(ie(),ae("option",iN,"垂直于路径")):Ve("",!0),E.value.config.shape==="path"&&E.value.config.spawnPathId>0?(ie(),ae("option",sN,"沿路径方向")):Ve("",!0)],512),[[Ht,E.value.config.emissionAngleMode]])]),E.value.config.emissionAngleMode==="fixed"?(ie(),Jt(qe,{key:4,label:"固定角度",min:-360,max:360,step:1,modelValue:E.value.config.direction,"onUpdate:modelValue":S[75]||(S[75]=C=>E.value.config.direction=C)},null,8,["modelValue"])):E.value.config.emissionAngleMode==="random"?(ie(),ae(Ke,{key:5},[Ue(qe,{label:"基准角度",min:-360,max:360,step:1,modelValue:E.value.config.direction,"onUpdate:modelValue":S[76]||(S[76]=C=>E.value.config.direction=C)},null,8,["modelValue"]),Ue(qe,{label:"随机范围",min:0,max:360,step:1,modelValue:E.value.config.spread,"onUpdate:modelValue":S[77]||(S[77]=C=>E.value.config.spread=C)},null,8,["modelValue"])],64)):Ve("",!0)],512),[[Yi,!le.shape]])]),M("div",nN,[M("div",{class:"group-head",onClick:S[79]||(S[79]=C=>Oe("attr"))},[M("span",rN,Xe(le.attr?"▸":"▾"),1),S[274]||(S[274]=M("span",null,"粒子属性",-1)),M("button",{class:"group-reset",title:"重置粒子属性参数",onClick:S[78]||(S[78]=bt(C=>zi("attr"),["stop"]))},"重置")]),ye(M("div",aN,[S[282]||(S[282]=M("div",{class:"attr-section-title"},"粒子初始参数",-1)),Ue(jn,{label:"初始生命周期","allow-curve":!1,mode:E.value.config.lifeMode,"onUpdate:mode":S[80]||(S[80]=C=>E.value.config.lifeMode=C),"value-min":E.value.config.lifeMin,"onUpdate:valueMin":S[81]||(S[81]=C=>E.value.config.lifeMin=C),"value-max":E.value.config.lifeMax,"onUpdate:valueMax":S[82]||(S[82]=C=>E.value.config.lifeMax=C),curve:E.value.config.lifeCurve,"onUpdate:curve":S[83]||(S[83]=C=>E.value.config.lifeCurve=C),min:.1,max:10,step:.1,"curve-label":"随机采样 →"},null,8,["mode","value-min","value-max","curve"]),Ue(jn,{label:"初始速度","allow-curve":!1,mode:E.value.config.speedMode,"onUpdate:mode":S[84]||(S[84]=C=>E.value.config.speedMode=C),"value-min":E.value.config.speedMin,"onUpdate:valueMin":S[85]||(S[85]=C=>E.value.config.speedMin=C),"value-max":E.value.config.speedMax,"onUpdate:valueMax":S[86]||(S[86]=C=>E.value.config.speedMax=C),curve:E.value.config.speedCurve,"onUpdate:curve":S[87]||(S[87]=C=>E.value.config.speedCurve=C),min:0,max:1e3,step:1,"curve-label":"随机采样 →"},null,8,["mode","value-min","value-max","curve"]),M("div",oN,[S[275]||(S[275]=M("span",null,"初始缩放",-1)),M("div",lN,[M("button",{class:Ze(["axis-mode",{on:E.value.config.scaleAxisMode==="uniform"}]),onClick:S[88]||(S[88]=C=>E.value.config.scaleAxisMode="uniform")},"统一",2),M("button",{class:Ze(["axis-mode",{on:E.value.config.scaleAxisMode==="separate"}]),onClick:S[89]||(S[89]=C=>E.value.config.scaleAxisMode="separate")},"XY分离",2)])]),Ue(jn,{label:E.value.config.scaleAxisMode==="uniform"?"初始缩放":"缩放 X","allow-curve":!1,mode:E.value.config.scaleMode,"onUpdate:mode":S[90]||(S[90]=C=>E.value.config.scaleMode=C),"value-min":E.value.config.scaleMin,"onUpdate:valueMin":S[91]||(S[91]=C=>E.value.config.scaleMin=C),"value-max":E.value.config.scaleMax,"onUpdate:valueMax":S[92]||(S[92]=C=>E.value.config.scaleMax=C),curve:E.value.config.scaleCurve,"onUpdate:curve":S[93]||(S[93]=C=>E.value.config.scaleCurve=C),min:0,max:5,step:.05,"curve-label":"随机采样 →"},null,8,["label","mode","value-min","value-max","curve"]),E.value.config.scaleAxisMode==="separate"?(ie(),Jt(jn,{key:0,label:"缩放 Y","show-modes":!1,"allow-curve":!1,mode:E.value.config.scaleMode,"onUpdate:mode":S[94]||(S[94]=C=>E.value.config.scaleMode=C),"value-min":E.value.config.scaleYMin,"onUpdate:valueMin":S[95]||(S[95]=C=>E.value.config.scaleYMin=C),"value-max":E.value.config.scaleYMax,"onUpdate:valueMax":S[96]||(S[96]=C=>E.value.config.scaleYMax=C),curve:E.value.config.scaleYCurve,"onUpdate:curve":S[97]||(S[97]=C=>E.value.config.scaleYCurve=C),min:0,max:5,step:.05,"curve-label":"随机采样 →"},null,8,["mode","value-min","value-max","curve"])):Ve("",!0),Ue(jn,{label:"初始旋转","allow-direction":"","allow-curve":!1,mode:E.value.config.initialRotationMode,"onUpdate:mode":S[98]||(S[98]=C=>E.value.config.initialRotationMode=C),"value-min":E.value.config.initialRotationMin,"onUpdate:valueMin":S[99]||(S[99]=C=>E.value.config.initialRotationMin=C),"value-max":E.value.config.initialRotationMax,"onUpdate:valueMax":S[100]||(S[100]=C=>E.value.config.initialRotationMax=C),curve:E.value.config.initialRotationCurve,"onUpdate:curve":S[101]||(S[101]=C=>E.value.config.initialRotationCurve=C),min:-360,max:360,step:1,"curve-label":"随机采样 →"},null,8,["mode","value-min","value-max","curve"]),S[283]||(S[283]=M("div",{class:"attr-section-title life-title"},"粒子生命周期变化参数",-1)),M("div",cN,[M("label",hN,[ye(M("input",{type:"checkbox","onUpdate:modelValue":S[102]||(S[102]=C=>E.value.config.speedOverLifeEnabled=C)},null,512),[[ei,E.value.config.speedOverLifeEnabled]]),S[276]||(S[276]=M("span",{class:"switch-ui"},null,-1)),S[277]||(S[277]=M("span",null,"生命周期内速度",-1))]),E.value.config.speedOverLifeEnabled?(ie(),Jt(jn,{key:0,label:"速度倍率",mode:E.value.config.speedOverLifeMode,"onUpdate:mode":Ps,"value-min":E.value.config.speedOverLifeMin,"onUpdate:valueMin":S[103]||(S[103]=C=>E.value.config.speedOverLifeMin=C),"value-max":E.value.config.speedOverLifeMax,"onUpdate:valueMax":S[104]||(S[104]=C=>E.value.config.speedOverLifeMax=C),curve:E.value.config.speedOverLifeCurve,"onUpdate:curve":S[105]||(S[105]=C=>E.value.config.speedOverLifeCurve=C),"default-curve":te,min:0,max:3,step:.05,"curve-label":"生命周期 →"},null,8,["mode","value-min","value-max","curve"])):Ve("",!0)]),M("div",uN,[M("label",dN,[ye(M("input",{type:"checkbox","onUpdate:modelValue":S[106]||(S[106]=C=>E.value.config.scaleOverLifeEnabled=C),onChange:br},null,544),[[ei,E.value.config.scaleOverLifeEnabled]]),S[278]||(S[278]=M("span",{class:"switch-ui"},null,-1)),S[279]||(S[279]=M("span",null,"生命周期内缩放",-1))]),E.value.config.scaleOverLifeEnabled?(ie(),ae(Ke,{key:0},[M("div",fN,[M("button",{class:Ze(["axis-mode",{on:E.value.config.scaleOverLifeAxisMode==="uniform"}]),onClick:S[107]||(S[107]=C=>E.value.config.scaleOverLifeAxisMode="uniform")},"统一",2),M("button",{class:Ze(["axis-mode",{on:E.value.config.scaleOverLifeAxisMode==="separate"}]),onClick:S[108]||(S[108]=C=>E.value.config.scaleOverLifeAxisMode="separate")},"XY分离",2)]),Ue(jn,{label:E.value.config.scaleOverLifeAxisMode==="uniform"?"缩放倍率":"倍率 X",mode:E.value.config.scaleOverLifeMode,"onUpdate:mode":js,"value-min":E.value.config.scaleOverLifeMin,"onUpdate:valueMin":S[109]||(S[109]=C=>E.value.config.scaleOverLifeMin=C),"value-max":E.value.config.scaleOverLifeMax,"onUpdate:valueMax":S[110]||(S[110]=C=>E.value.config.scaleOverLifeMax=C),curve:E.value.config.scaleOverLifeCurve,"onUpdate:curve":S[111]||(S[111]=C=>E.value.config.scaleOverLifeCurve=C),"default-curve":te,min:0,max:3,step:.05,"curve-label":"生命周期 →"},null,8,["label","mode","value-min","value-max","curve"]),E.value.config.scaleOverLifeAxisMode==="separate"?(ie(),Jt(jn,{key:0,label:"倍率 Y","show-modes":!1,mode:E.value.config.scaleOverLifeMode,"onUpdate:mode":S[112]||(S[112]=C=>E.value.config.scaleOverLifeMode=C),"value-min":E.value.config.scaleYOverLifeMin,"onUpdate:valueMin":S[113]||(S[113]=C=>E.value.config.scaleYOverLifeMin=C),"value-max":E.value.config.scaleYOverLifeMax,"onUpdate:valueMax":S[114]||(S[114]=C=>E.value.config.scaleYOverLifeMax=C),curve:E.value.config.scaleYOverLifeCurve,"onUpdate:curve":S[115]||(S[115]=C=>E.value.config.scaleYOverLifeCurve=C),"default-curve":te,min:0,max:3,step:.05,"curve-label":"生命周期 →"},null,8,["mode","value-min","value-max","curve"])):Ve("",!0)],64)):Ve("",!0)]),M("div",mN,[M("label",pN,[ye(M("input",{type:"checkbox","onUpdate:modelValue":S[116]||(S[116]=C=>E.value.config.rotationOverLifeEnabled=C)},null,512),[[ei,E.value.config.rotationOverLifeEnabled]]),S[280]||(S[280]=M("span",{class:"switch-ui"},null,-1)),S[281]||(S[281]=M("span",null,"生命周期内旋转",-1))]),E.value.config.rotationOverLifeEnabled?(ie(),Jt(jn,{key:0,label:"旋转速度",mode:E.value.config.rotationOverLifeMode,"onUpdate:mode":S[117]||(S[117]=C=>E.value.config.rotationOverLifeMode=C),"value-min":E.value.config.rotationSpeedMin,"onUpdate:valueMin":S[118]||(S[118]=C=>E.value.config.rotationSpeedMin=C),"value-max":E.value.config.rotationSpeedMax,"onUpdate:valueMax":S[119]||(S[119]=C=>E.value.config.rotationSpeedMax=C),curve:E.value.config.rotationOverLifeCurve,"onUpdate:curve":S[120]||(S[120]=C=>E.value.config.rotationOverLifeCurve=C),"default-curve":j,min:-720,max:720,step:10,"curve-label":"生命周期 →"},null,8,["mode","value-min","value-max","curve"])):Ve("",!0)])],512),[[Yi,!le.attr]])]),M("div",gN,[M("div",{class:"group-head",onClick:S[122]||(S[122]=C=>Oe("look"))},[M("span",vN,Xe(le.look?"▸":"▾"),1),S[284]||(S[284]=M("span",null,"外观与资源",-1)),M("button",{class:"group-reset",title:"重置外观与资源参数",onClick:S[121]||(S[121]=bt(C=>zi("look"),["stop"]))},"重置")]),ye(M("div",yN,[S[298]||(S[298]=M("div",{class:"look-title"},"透明度",-1)),M("div",xN,[M("button",{class:Ze(["seg-btn",{active:E.value.config.alphaMode==="curve"}]),onClick:S[123]||(S[123]=C=>E.value.config.alphaMode="curve")},"曲线",2),M("button",{class:Ze(["seg-btn",{active:E.value.config.alphaMode==="fixed"}]),onClick:S[124]||(S[124]=C=>E.value.config.alphaMode="fixed")},"固定",2)]),E.value.config.alphaMode==="fixed"?(ie(),Jt(qe,{key:0,label:"透明度",min:0,max:1,step:.01,modelValue:E.value.config.alpha,"onUpdate:modelValue":S[125]||(S[125]=C=>E.value.config.alpha=C)},null,8,["modelValue"])):(ie(),ae(Ke,{key:1},[M("label",bN,[S[286]||(S[286]=M("span",null,"曲线模式",-1)),ye(M("select",{"onUpdate:modelValue":S[126]||(S[126]=C=>E.value.config.curveMode=C),class:"inp"},[...S[285]||(S[285]=[M("option",null,"跟随导出",-1),M("option",null,"线性",-1),M("option",null,"贝塞尔",-1)])],512),[[Ht,E.value.config.curveMode]])]),M("div",wN,[Ue(xn,{modelValue:E.value.config.alphaCurve,"onUpdate:modelValue":S[127]||(S[127]=C=>E.value.config.alphaCurve=C),"default-value":he,mode:T(E.value.config.curveMode)},null,8,["modelValue","mode"]),S[287]||(S[287]=M("div",{class:"curve-labels"},[M("span",null,"0(透明)"),M("span",null,"生命周期 →"),M("span",null,"1(不透明)")],-1))])],64)),M("div",{class:"look-title image-title"},[S[288]||(S[288]=M("span",null,"图片资源",-1)),M("button",{class:"image-add",title:"新增图片资源",onClick:Le},"+")]),(ie(!0),ae(Ke,null,ci(E.value.config.imageResources,C=>(ie(),Jt(zv,{key:C.id,resource:C,"resource-count":E.value.config.imageResources.length,"supports-sequence":"","default-file":"star.png",onPick:Te,onPickSequence:je,onReset:Qe,onRemove:Xt,onUpdateWeight:ns,onToggleLock:Ha},{default:ah(()=>[Ue(qe,{label:"缩放",min:.1,max:3,step:.05,modelValue:C.scale,"onUpdate:modelValue":Q=>C.scale=Q},null,8,["modelValue","onUpdate:modelValue"]),M("label",SN,[S[289]||(S[289]=M("span",null,"轴心 x,y",-1)),ye(M("input",{type:"number",step:"0.05",class:"inp tiny","onUpdate:modelValue":Q=>C.anchorX=Q},null,8,MN),[[ht,C.anchorX,void 0,{number:!0}]]),ye(M("input",{type:"number",step:"0.05",class:"inp tiny","onUpdate:modelValue":Q=>C.anchorY=Q},null,8,_N),[[ht,C.anchorY,void 0,{number:!0}]])]),S[297]||(S[297]=M("div",{class:"resource-divider"},null,-1)),M("label",TN,[S[292]||(S[292]=M("span",null,"颜色",-1)),ye(M("select",{"onUpdate:modelValue":Q=>C.colorMode=Q,class:"inp"},[...S[290]||(S[290]=[M("option",{value:"fixed"},"固定色",-1),M("option",{value:"random"},"随机颜色",-1),M("option",{value:"lifetime"},"生命周期",-1)])],8,AN),[[Ht,C.colorMode]]),ye(M("select",{"onUpdate:modelValue":Q=>C.blend=Q,class:"inp blend-select"},[...S[291]||(S[291]=[M("option",{value:"normal"},"正常",-1),M("option",{value:"add"},"相加",-1),M("option",{value:"multiply"},"相乘",-1),M("option",{value:"screen"},"滤色",-1)])],8,EN),[[Ht,C.blend]])]),C.colorMode==="fixed"?(ie(),ae("label",CN,[S[293]||(S[293]=M("span",null,"固定色",-1)),ye(M("input",{type:"color","onUpdate:modelValue":Q=>C.colorStart=Q,class:"colr"},null,8,IN),[[ht,C.colorStart]]),M("input",{type:"text",class:"hex-input",value:C.colorStart,spellcheck:"false","aria-label":"固定颜色值",onChange:Q=>at(C,Q),onKeydown:Ea(Q=>Pe(C,Q),["enter"])},null,40,RN)])):(ie(),ae(Ke,{key:1},[Ue(Wv,{modelValue:C.colorGradient,"onUpdate:modelValue":Q=>C.colorGradient=Q},null,8,["modelValue","onUpdate:modelValue"]),C.colorMode==="random"?(ie(),ae("div",PN,"每个粒子出生时从色带随机取色,生命周期内保持不变")):Ve("",!0)],64)),M("div",kN,[S[294]||(S[294]=M("span",null,"独立透明度",-1)),M("div",FN,[M("button",{class:Ze({on:C.independentAlpha==="off"}),onClick:Q=>C.independentAlpha="off"},"关闭",10,ON),M("button",{class:Ze({on:C.independentAlpha==="fixed"}),onClick:Q=>C.independentAlpha="fixed"},"固定",10,BN),M("button",{class:Ze({on:C.independentAlpha==="curve"}),onClick:Q=>C.independentAlpha="curve"},"曲线",10,LN)])]),C.independentAlpha==="fixed"?(ie(),Jt(qe,{key:2,label:"透明度",min:0,max:1,step:.01,modelValue:C.alpha,"onUpdate:modelValue":Q=>C.alpha=Q},null,8,["modelValue","onUpdate:modelValue"])):C.independentAlpha==="curve"?(ie(),ae(Ke,{key:3},[M("label",DN,[S[296]||(S[296]=M("span",null,"曲线模式",-1)),ye(M("select",{"onUpdate:modelValue":Q=>C.alphaCurveMode=Q,class:"inp"},[...S[295]||(S[295]=[M("option",null,"跟随导出",-1),M("option",null,"线性",-1),M("option",null,"贝塞尔",-1)])],8,NN),[[Ht,C.alphaCurveMode]])]),M("div",UN,[Ue(xn,{modelValue:C.alphaCurve,"onUpdate:modelValue":Q=>C.alphaCurve=Q,"default-value":xe,mode:T(C.alphaCurveMode)},null,8,["modelValue","onUpdate:modelValue","mode"])])],64)):Ve("",!0)]),_:2},1032,["resource","resource-count"]))),128)),M("input",{ref_key:"textureFileInput",ref:Qr,class:"file-input",type:"file",accept:"image/png,image/jpeg,image/webp,image/gif",onChange:rt},null,544),M("input",{ref_key:"sequenceFileInput",ref:Ws,class:"file-input",type:"file",multiple:"",accept:"image/png,image/jpeg,image/webp,image/gif",onChange:Je},null,544)],512),[[Yi,!le.look]])]),M("div",XN,[M("div",{class:"group-head",onClick:S[129]||(S[129]=C=>Oe("mods"))},[M("span",VN,Xe(le.mods?"▸":"▾"),1),S[299]||(S[299]=M("span",null,"修改器",-1)),M("button",{class:"group-reset",title:"重置修改器参数",onClick:S[128]||(S[128]=bt(C=>zi("mods"),["stop"]))},"重置")]),ye(M("div",YN,[M("div",$N,[M("label",GN,[ye(M("input",{type:"checkbox","onUpdate:modelValue":S[130]||(S[130]=C=>E.value.config.noise=C)},null,512),[[ei,E.value.config.noise]]),S[300]||(S[300]=M("span",{class:"switch-ui"},null,-1)),S[301]||(S[301]=M("span",null,"开启移动噪声",-1))]),E.value.config.noise?(ie(),ae("div",HN,[Ue(qe,{label:"强度",min:0,max:100,step:1,modelValue:E.value.config.noiseAmt,"onUpdate:modelValue":S[131]||(S[131]=C=>E.value.config.noiseAmt=C)},null,8,["modelValue"]),Ue(qe,{label:"波动范围",min:0,max:500,step:1,modelValue:E.value.config.noiseRange,"onUpdate:modelValue":S[132]||(S[132]=C=>E.value.config.noiseRange=C)},null,8,["modelValue"]),Ue(qe,{label:"时间流速",min:0,max:10,step:.1,modelValue:E.value.config.noiseSpeed,"onUpdate:modelValue":S[133]||(S[133]=C=>E.value.config.noiseSpeed=C)},null,8,["modelValue"]),S[302]||(S[302]=M("div",{class:"modifier-hint"},"强度控制影响比例 · 波动范围控制最大偏移 · 时间流速控制变化速度",-1))])):Ve("",!0)]),M("div",jN,[M("label",WN,[ye(M("input",{type:"checkbox","onUpdate:modelValue":S[134]||(S[134]=C=>E.value.config.useGravity=C)},null,512),[[ei,E.value.config.useGravity]]),S[303]||(S[303]=M("span",{class:"switch-ui"},null,-1)),S[304]||(S[304]=M("span",null,"开启重力",-1))]),E.value.config.useGravity?(ie(),ae("div",zN,[M("div",qN,[M("button",{class:Ze(["axis-mode",{on:E.value.config.gravityMode==="fixed"}]),onClick:S[135]||(S[135]=C=>E.value.config.gravityMode="fixed")},"固定",2),M("button",{class:Ze(["axis-mode",{on:E.value.config.gravityMode==="random"}]),onClick:S[136]||(S[136]=C=>E.value.config.gravityMode="random")},"随机",2)]),E.value.config.gravityMode==="fixed"?(ie(),Jt(qe,{key:0,label:"重力强度",min:-3e3,max:3e3,step:10,modelValue:E.value.config.gravityMin,"onUpdate:modelValue":S[137]||(S[137]=C=>E.value.config.gravityMin=C)},null,8,["modelValue"])):(ie(),ae(Ke,{key:1},[Ue(qe,{label:"强度 min",min:-3e3,max:3e3,step:10,modelValue:E.value.config.gravityMin,"onUpdate:modelValue":S[138]||(S[138]=C=>E.value.config.gravityMin=C)},null,8,["modelValue"]),Ue(qe,{label:"强度 max",min:-3e3,max:3e3,step:10,modelValue:E.value.config.gravityMax,"onUpdate:modelValue":S[139]||(S[139]=C=>E.value.config.gravityMax=C)},null,8,["modelValue"])],64)),Ue(qe,{label:"方向",min:-360,max:360,step:1,modelValue:E.value.config.gravityDirection,"onUpdate:modelValue":S[140]||(S[140]=C=>E.value.config.gravityDirection=C)},null,8,["modelValue"]),S[305]||(S[305]=M("div",{class:"gravity-curve-title"},[M("span",null,"生命周期内重力"),M("span",null,"纵轴:强度 0~1")],-1)),Ue(xn,{modelValue:E.value.config.gravityCurve,"onUpdate:modelValue":S[141]||(S[141]=C=>E.value.config.gravityCurve=C),"default-value":te},null,8,["modelValue"]),S[306]||(S[306]=M("div",{class:"gravity-curve-axis"},[M("span",null,"0"),M("span",null,"生命周期 →"),M("span",null,"1")],-1)),S[307]||(S[307]=M("div",{class:"modifier-hint"},"0° 向右 · -90° 向下 · 负强度会反转方向",-1))])):Ve("",!0)]),M("div",KN,[M("label",ZN,[ye(M("input",{type:"checkbox","onUpdate:modelValue":S[142]||(S[142]=C=>E.value.config.wind=C)},null,512),[[ei,E.value.config.wind]]),S[308]||(S[308]=M("span",{class:"switch-ui"},null,-1)),S[309]||(S[309]=M("span",null,"开启风力",-1))]),E.value.config.wind?(ie(),ae("div",JN,[M("div",QN,[M("button",{class:Ze(["axis-mode",{on:E.value.config.windMode==="fixed"}]),onClick:S[143]||(S[143]=C=>E.value.config.windMode="fixed")},"固定",2),M("button",{class:Ze(["axis-mode",{on:E.value.config.windMode==="random"}]),onClick:S[144]||(S[144]=C=>E.value.config.windMode="random")},"随机",2)]),E.value.config.windMode==="fixed"?(ie(),Jt(qe,{key:0,label:"风力强度",min:-3e3,max:3e3,step:10,modelValue:E.value.config.windMin,"onUpdate:modelValue":S[145]||(S[145]=C=>E.value.config.windMin=C)},null,8,["modelValue"])):(ie(),ae(Ke,{key:1},[Ue(qe,{label:"强度 min",min:-3e3,max:3e3,step:10,modelValue:E.value.config.windMin,"onUpdate:modelValue":S[146]||(S[146]=C=>E.value.config.windMin=C)},null,8,["modelValue"]),Ue(qe,{label:"强度 max",min:-3e3,max:3e3,step:10,modelValue:E.value.config.windMax,"onUpdate:modelValue":S[147]||(S[147]=C=>E.value.config.windMax=C)},null,8,["modelValue"])],64)),Ue(qe,{label:"方向",min:-360,max:360,step:1,modelValue:E.value.config.windDirection,"onUpdate:modelValue":S[148]||(S[148]=C=>E.value.config.windDirection=C)},null,8,["modelValue"]),S[310]||(S[310]=M("div",{class:"gravity-curve-title"},[M("span",null,"生命周期内风力"),M("span",null,"纵轴:强度 0~1")],-1)),Ue(xn,{modelValue:E.value.config.windCurve,"onUpdate:modelValue":S[149]||(S[149]=C=>E.value.config.windCurve=C),"default-value":te},null,8,["modelValue"]),S[311]||(S[311]=M("div",{class:"gravity-curve-axis"},[M("span",null,"0"),M("span",null,"生命周期 →"),M("span",null,"1")],-1)),S[312]||(S[312]=M("div",{class:"modifier-hint"},"0° 向右 · -90° 向下 · 负强度会反转方向",-1))])):Ve("",!0)]),M("div",e4,[M("label",t4,[ye(M("input",{type:"checkbox","onUpdate:modelValue":S[150]||(S[150]=C=>E.value.config.forceField=C)},null,512),[[ei,E.value.config.forceField]]),S[313]||(S[313]=M("span",{class:"switch-ui"},null,-1)),S[314]||(S[314]=M("span",null,"开启力场",-1))]),E.value.config.forceField?(ie(),ae("div",i4,[Ue(qe,{label:"中心 X",min:-5e3,max:5e3,step:1,modelValue:E.value.config.forceCenterX,"onUpdate:modelValue":S[151]||(S[151]=C=>E.value.config.forceCenterX=C)},null,8,["modelValue"]),Ue(qe,{label:"中心 Y",min:-5e3,max:5e3,step:1,modelValue:E.value.config.forceCenterY,"onUpdate:modelValue":S[152]||(S[152]=C=>E.value.config.forceCenterY=C)},null,8,["modelValue"]),Ue(qe,{label:"力场强度",min:-300,max:300,step:1,modelValue:E.value.config.forceStrength,"onUpdate:modelValue":S[153]||(S[153]=C=>E.value.config.forceStrength=C)},null,8,["modelValue"]),Ue(qe,{label:"力场半径",min:1,max:2e3,step:1,modelValue:E.value.config.forceRadius,"onUpdate:modelValue":S[154]||(S[154]=C=>E.value.config.forceRadius=C)},null,8,["modelValue"]),M("label",s4,[S[316]||(S[316]=M("span",null,"衰减模式",-1)),ye(M("select",{"onUpdate:modelValue":S[155]||(S[155]=C=>E.value.config.forceFalloff=C),class:"inp"},[...S[315]||(S[315]=[M("option",{value:"constant"},"恒定(范围内力度不变)",-1),M("option",{value:"linear"},"线性衰减(边缘为 0)",-1),M("option",{value:"inverse"},"距离反比(中心最强)",-1)])],512),[[Ht,E.value.config.forceFalloff]])]),S[317]||(S[317]=M("div",{class:"modifier-hint"},"正数吸向中心 · 负数向外排斥 · 可在画布内拖动力场圆",-1))])):Ve("",!0)]),M("div",n4,[M("label",r4,[ye(M("input",{type:"checkbox","onUpdate:modelValue":S[156]||(S[156]=C=>E.value.config.attraction=C)},null,512),[[ei,E.value.config.attraction]]),S[318]||(S[318]=M("span",{class:"switch-ui"},null,-1)),S[319]||(S[319]=M("span",null,"开启吸附",-1))]),E.value.config.attraction?(ie(),ae("div",a4,[Ue(qe,{label:"吸附点 X",min:-5e3,max:5e3,step:1,modelValue:E.value.config.attractionCenterX,"onUpdate:modelValue":S[157]||(S[157]=C=>E.value.config.attractionCenterX=C)},null,8,["modelValue"]),Ue(qe,{label:"吸附点 Y",min:-5e3,max:5e3,step:1,modelValue:E.value.config.attractionCenterY,"onUpdate:modelValue":S[158]||(S[158]=C=>E.value.config.attractionCenterY=C)},null,8,["modelValue"]),Ue(qe,{label:"吸附半径",min:0,max:2e3,step:1,modelValue:E.value.config.attractionRadius,"onUpdate:modelValue":S[159]||(S[159]=C=>E.value.config.attractionRadius=C)},null,8,["modelValue"]),Ue(qe,{label:"吸附时长",min:.05,max:30,step:.05,modelValue:E.value.config.attractionDuration,"onUpdate:modelValue":S[160]||(S[160]=C=>E.value.config.attractionDuration=C)},null,8,["modelValue"]),Ue(qe,{label:"延迟时间",min:0,max:30,step:.05,modelValue:E.value.config.attractionDelay,"onUpdate:modelValue":S[161]||(S[161]=C=>E.value.config.attractionDelay=C)},null,8,["modelValue"]),M("label",o4,[S[321]||(S[321]=M("span",null,"延迟方式",-1)),ye(M("select",{"onUpdate:modelValue":S[162]||(S[162]=C=>E.value.config.attractionDelayMode=C),class:"inp"},[...S[320]||(S[320]=[M("option",{value:"global"},"统一时间",-1),M("option",{value:"particle"},"单粒子生命",-1)])],512),[[Ht,E.value.config.attractionDelayMode]])]),M("label",l4,[S[323]||(S[323]=M("span",null,"吸附方式",-1)),ye(M("select",{"onUpdate:modelValue":S[163]||(S[163]=C=>E.value.config.attractionPath=C),class:"inp"},[...S[322]||(S[322]=[M("option",{value:"linear"},"直线",-1),M("option",{value:"curve"},"曲线",-1)])],512),[[Ht,E.value.config.attractionPath]])]),S[324]||(S[324]=M("div",{class:"modifier-hint"},"延迟后从当前位置开始吸附 · 到达红色范围即死亡 · 可在画布内拖动吸附圆",-1))])):Ve("",!0)]),M("div",c4,[M("label",h4,[ye(M("input",{type:"checkbox","onUpdate:modelValue":S[164]||(S[164]=C=>E.value.config.trail=C)},null,512),[[ei,E.value.config.trail]]),S[325]||(S[325]=M("span",{class:"switch-ui"},null,-1)),S[326]||(S[326]=M("span",null,"开启拖尾",-1))]),E.value.config.trail?(ie(),ae("div",u4,[M("div",{class:"trail-section-head"},[S[327]||(S[327]=M("div",{class:"trail-section-title"},"拖尾独立图片",-1)),M("button",{class:"image-add",title:"增加拖尾图片资源",onClick:ea},"+")]),(ie(!0),ae(Ke,null,ci(E.value.config.trailResources,C=>(ie(),Jt(zv,{key:C.id,resource:C,"resource-count":E.value.config.trailResources.length,"default-file":"trail.png","name-placeholder":"trail","show-folder":!1,onPick:ta,onReset:ue,onRemove:ve,onUpdateWeight:Me,onToggleLock:be},{default:ah(()=>[S[343]||(S[343]=M("div",{class:"resource-divider"},null,-1)),Ue(qe,{label:"旋转",min:-360,max:360,step:1,"model-value":C.rotation,"onUpdate:modelValue":Q=>ee(C.id,Q)},null,8,["model-value","onUpdate:modelValue"]),Ue(qe,{label:"拖尾骨骼数",min:2,max:16,step:1,"model-value":C.boneCount,"onUpdate:modelValue":Q=>Y(C.id,Q)},null,8,["model-value","onUpdate:modelValue"]),Ue(qe,{label:"拖尾比例 (%)",min:0,max:100,step:1,modelValue:C.trailRatio,"onUpdate:modelValue":Q=>C.trailRatio=Q},null,8,["modelValue","onUpdate:modelValue"]),M("label",d4,[S[329]||(S[329]=M("span",null,"拖尾长度",-1)),ye(M("select",{"onUpdate:modelValue":Q=>C.lengthMode=Q,class:"inp"},[...S[328]||(S[328]=[M("option",{value:"fixed"},"固定",-1),M("option",{value:"random"},"随机范围",-1)])],8,f4),[[Ht,C.lengthMode]])]),C.lengthMode==="fixed"?(ie(),Jt(qe,{key:0,label:"长度比例 (%)",min:0,max:500,step:1,modelValue:C.length,"onUpdate:modelValue":Q=>C.length=Q},null,8,["modelValue","onUpdate:modelValue"])):(ie(),ae(Ke,{key:1},[Ue(qe,{label:"长度最小 (%)",min:0,max:500,step:1,modelValue:C.lengthMin,"onUpdate:modelValue":Q=>C.lengthMin=Q},null,8,["modelValue","onUpdate:modelValue"]),Ue(qe,{label:"长度最大 (%)",min:0,max:500,step:1,modelValue:C.lengthMax,"onUpdate:modelValue":Q=>C.lengthMax=Q},null,8,["modelValue","onUpdate:modelValue"])],64)),M("label",m4,[S[331]||(S[331]=M("span",null,"拖尾宽度",-1)),ye(M("select",{"onUpdate:modelValue":Q=>C.widthSizeMode=Q,class:"inp"},[...S[330]||(S[330]=[M("option",{value:"fixed"},"固定",-1),M("option",{value:"random"},"随机范围",-1)])],8,p4),[[Ht,C.widthSizeMode]])]),C.widthSizeMode==="fixed"?(ie(),Jt(qe,{key:2,label:"宽度比例 (%)",min:0,max:500,step:1,modelValue:C.width,"onUpdate:modelValue":Q=>C.width=Q},null,8,["modelValue","onUpdate:modelValue"])):(ie(),ae(Ke,{key:3},[Ue(qe,{label:"宽度最小 (%)",min:0,max:500,step:1,modelValue:C.widthMin,"onUpdate:modelValue":Q=>C.widthMin=Q},null,8,["modelValue","onUpdate:modelValue"]),Ue(qe,{label:"宽度最大 (%)",min:0,max:500,step:1,modelValue:C.widthMax,"onUpdate:modelValue":Q=>C.widthMax=Q},null,8,["modelValue","onUpdate:modelValue"])],64)),M("label",g4,[S[333]||(S[333]=M("span",null,"宽度缩放",-1)),ye(M("select",{"onUpdate:modelValue":Q=>C.widthMode=Q,class:"inp"},[...S[332]||(S[332]=[M("option",{value:"particle"},"跟随粒子",-1),M("option",{value:"fixed"},"固定",-1)])],8,v4),[[Ht,C.widthMode]])]),M("label",y4,[ye(M("input",{type:"checkbox","onUpdate:modelValue":Q=>C.lifeLengthEnabled=Q},null,8,x4),[[ei,C.lifeLengthEnabled]]),S[334]||(S[334]=M("span",{class:"switch-ui"},null,-1)),S[335]||(S[335]=M("span",null,"生命周期长度曲线",-1))]),C.lifeLengthEnabled?(ie(),Jt(xn,{key:4,modelValue:C.lifeLengthCurve,"onUpdate:modelValue":Q=>C.lifeLengthCurve=Q,"default-value":te},null,8,["modelValue","onUpdate:modelValue"])):Ve("",!0),M("label",b4,[ye(M("input",{type:"checkbox","onUpdate:modelValue":Q=>C.shapeEnabled=Q},null,8,w4),[[ei,C.shapeEnabled]]),S[336]||(S[336]=M("span",{class:"switch-ui"},null,-1)),S[337]||(S[337]=M("span",null,"形状曲线(首端 → 尾端宽度)",-1))]),C.shapeEnabled?(ie(),Jt(xn,{key:5,modelValue:C.shapeCurve,"onUpdate:modelValue":Q=>C.shapeCurve=Q,"default-value":ge},null,8,["modelValue","onUpdate:modelValue"])):Ve("",!0),M("div",S4,[S[338]||(S[338]=M("span",null,"颜色模式",-1)),M("div",M4,[M("button",{class:Ze(["axis-mode",{on:C.colorMode==="particle"}]),onClick:Q=>C.colorMode="particle"},"跟随粒子",10,_4),M("button",{class:Ze(["axis-mode",{on:C.colorMode==="fixed"}]),onClick:Q=>C.colorMode="fixed"},"固定",10,T4),M("button",{class:Ze(["axis-mode",{on:C.colorMode==="curve"}]),onClick:Q=>C.colorMode="curve"},"曲线",10,A4)])]),M("label",E4,[S[340]||(S[340]=M("span",null,"混合模式",-1)),ye(M("select",{"onUpdate:modelValue":Q=>C.blend=Q,class:"inp"},[...S[339]||(S[339]=[M("option",{value:"normal"},"正常",-1),M("option",{value:"add"},"相加",-1),M("option",{value:"multiply"},"相乘",-1),M("option",{value:"screen"},"滤色",-1)])],8,C4),[[Ht,C.blend]])]),C.colorMode==="fixed"?(ie(),ae("label",I4,[S[341]||(S[341]=M("span",null,"固定颜色",-1)),ye(M("input",{class:"colr",type:"color","onUpdate:modelValue":Q=>C.color=Q},null,8,R4),[[ht,C.color]]),M("input",{class:"hex-input",value:C.color,onChange:Q=>De(C,Q),onKeydown:Ea(bt(Q=>Ie(C,Q),["prevent"]),["enter"])},null,40,P4)])):C.colorMode==="curve"?(ie(),Jt(Wv,{key:7,modelValue:C.colorGradient,"onUpdate:modelValue":Q=>C.colorGradient=Q},null,8,["modelValue","onUpdate:modelValue"])):Ve("",!0),M("div",k4,[S[342]||(S[342]=M("span",null,"透明度模式",-1)),M("div",F4,[M("button",{class:Ze(["axis-mode",{on:C.alphaMode==="particle"}]),onClick:Q=>C.alphaMode="particle"},"跟随粒子",10,O4),M("button",{class:Ze(["axis-mode",{on:C.alphaMode==="fixed"}]),onClick:Q=>C.alphaMode="fixed"},"固定",10,B4),M("button",{class:Ze(["axis-mode",{on:C.alphaMode==="curve"}]),onClick:Q=>C.alphaMode="curve"},"曲线",10,L4)])]),C.alphaMode==="fixed"?(ie(),Jt(qe,{key:8,label:"透明度",min:0,max:1,step:.01,modelValue:C.alpha,"onUpdate:modelValue":Q=>C.alpha=Q},null,8,["modelValue","onUpdate:modelValue"])):Ve("",!0),C.alphaMode==="curve"?(ie(),Jt(xn,{key:9,modelValue:C.alphaCurve,"onUpdate:modelValue":Q=>C.alphaCurve=Q,"default-value":oe},null,8,["modelValue","onUpdate:modelValue"])):Ve("",!0)]),_:2},1032,["resource","resource-count"]))),128)),M("input",{ref_key:"trailTextureFileInput",ref:Vn,class:"file-input",type:"file",accept:"image/png,image/jpeg,image/webp",onChange:ne},null,544),M("div",D4,[Ue(qe,{label:"网格行数",min:2,max:16,step:1,"model-value":E.value.config.trailGridRows,"onUpdate:modelValue":S[165]||(S[165]=C=>H("trailGridRows",C))},null,8,["model-value"]),Ue(qe,{label:"网格列数",min:2,max:32,step:1,"model-value":E.value.config.trailGridCols,"onUpdate:modelValue":S[166]||(S[166]=C=>H("trailGridCols",C))},null,8,["model-value"])]),S[344]||(S[344]=M("div",{class:"modifier-hint"},"每个粒子按资源比例生成一组同级拖尾骨骼;随机长度与宽度在粒子出生时确定,相同种子可稳定复现",-1))])):Ve("",!0)]),M("div",N4,[M("label",U4,[ye(M("input",{type:"checkbox","onUpdate:modelValue":S[167]||(S[167]=C=>E.value.config.emitterFollow=C),disabled:E.value.config.streamBehavior==="loop"},null,8,X4),[[ei,E.value.config.emitterFollow]]),S[345]||(S[345]=M("span",{class:"switch-ui"},null,-1)),S[346]||(S[346]=M("span",null,"开启发射器跟随",-1))]),E.value.config.emitterFollow&&E.value.config.streamBehavior!=="loop"?(ie(),ae("div",V4,[M("label",Y4,[S[349]||(S[349]=M("span",null,"跟随模式",-1)),M("select",{value:E.value.config.emitterFollowMode,class:"inp",onChange:S[168]||(S[168]=C=>Kt(C,E.value.config))},[S[347]||(S[347]=M("option",{value:"none"},"无",-1)),S[348]||(S[348]=M("option",{value:"path"},"跟随路径",-1)),we.value||E.value.config.emitterFollowMode==="bone"?(ie(),ae("option",G4,"选中的骨骼")):Ve("",!0)],40,$4)]),E.value.config.emitterFollowMode==="path"?(ie(),ae(Ke,{key:0},[M("label",H4,[S[351]||(S[351]=M("span",null,"跟随路径",-1)),ye(M("select",{"onUpdate:modelValue":S[169]||(S[169]=C=>E.value.config.emitterFollowPathId=C),class:"inp"},[S[350]||(S[350]=M("option",{value:0},"无",-1)),(ie(!0),ae(Ke,null,ci(ke(e).paths,C=>(ie(),ae("option",{key:C.id,value:C.id},Xe(C.name),9,j4))),128))],512),[[Ht,E.value.config.emitterFollowPathId,void 0,{number:!0}]])]),M("label",W4,[S[353]||(S[353]=M("span",null,"发射器角度模式",-1)),ye(M("select",{"onUpdate:modelValue":S[170]||(S[170]=C=>E.value.config.emitterAngleMode=C),class:"inp"},[...S[352]||(S[352]=[M("option",{value:"fixed"},"固定角度",-1),M("option",{value:"direction"},"跟随移动方向",-1)])],512),[[Ht,E.value.config.emitterAngleMode]])]),S[359]||(S[359]=M("div",{class:"gravity-curve-title"},[M("span",null,"移动进度曲线 (0→1)")],-1)),Ue(xn,{modelValue:E.value.config.emitterFollowCurve,"onUpdate:modelValue":S[171]||(S[171]=C=>E.value.config.emitterFollowCurve=C),"default-value":j},null,8,["modelValue"]),M("div",z4,[M("label",q4,[S[354]||(S[354]=M("span",null,"移动时长 (s)",-1)),ye(M("input",{"onUpdate:modelValue":S[172]||(S[172]=C=>E.value.config.emitterFollowDuration=C),type:"number",min:"0.05",step:"0.05",class:"inp"},null,512),[[ht,E.value.config.emitterFollowDuration,void 0,{number:!0}]])]),M("label",K4,[S[356]||(S[356]=M("span",null,"跟随空间",-1)),ye(M("select",{"onUpdate:modelValue":S[173]||(S[173]=C=>E.value.config.emitterFollowSpace=C),class:"inp"},[...S[355]||(S[355]=[M("option",{value:"local"},"局部空间(GEN 移动)",-1),M("option",{value:"world"},"世界空间(粒子生成点移动)",-1)])],512),[[Ht,E.value.config.emitterFollowSpace]])])]),M("label",Z4,[S[358]||(S[358]=M("span",null,"移动方向",-1)),ye(M("select",{"onUpdate:modelValue":S[174]||(S[174]=C=>E.value.config.emitterFollowDirection=C),class:"inp"},[...S[357]||(S[357]=[M("option",{value:"forward"},"正向(起点 → 终点)",-1),M("option",{value:"reverse"},"反向(终点 → 起点)",-1)])],512),[[Ht,E.value.config.emitterFollowDirection]])]),Ue(qe,{label:"偏移起始点 (0-1)",min:0,max:1,step:.01,modelValue:E.value.config.emitterFollowOffset,"onUpdate:modelValue":S[175]||(S[175]=C=>E.value.config.emitterFollowOffset=C)},null,8,["modelValue"]),S[360]||(S[360]=M("div",{class:"modifier-hint"},"局部空间会移动整个发射器;世界空间只移动新粒子的生成点,已出生粒子留在世界位置。",-1))],64)):E.value.config.emitterFollowMode==="bone"?(ie(),ae(Ke,{key:1},[Ee.value?(ie(),ae("div",J4,[S[361]||(S[361]=Qt("跟随目标:",-1)),M("strong",null,Xe(Ee.value.spine.name)+" / "+Xe(Ee.value.boneName),1)])):(ie(),ae("div",Q4,"尚未绑定有效骨骼,请先在 Spine 层级树中选择骨骼。")),we.value&&(!Ee.value||we.value.spine.id!==Ee.value.spine.id||we.value.boneName!==Ee.value.boneName)?(ie(),ae("button",{key:2,class:"bone-follow-rebind",onClick:S[176]||(S[176]=C=>Ti(E.value.config))},Xe(Ee.value?"重新绑定":"绑定")+"当前选中骨骼:"+Xe(we.value.spine.name)+" / "+Xe(we.value.boneName),1)):Ve("",!0),Ee.value?(ie(),ae(Ke,{key:3},[M("label",e5,[S[363]||(S[363]=M("span",null,"跟随空间",-1)),ye(M("select",{"onUpdate:modelValue":S[177]||(S[177]=C=>E.value.config.emitterFollowSpace=C),class:"inp"},[...S[362]||(S[362]=[M("option",{value:"local"},"本地空间(随骨骼移动)",-1),M("option",{value:"world"},"世界空间(粒子生成后保持位置)",-1)])],512),[[Ht,E.value.config.emitterFollowSpace]])]),M("div",t5,[M("label",i5,[S[364]||(S[364]=M("span",null,"位移偏移 X",-1)),ye(M("input",{"onUpdate:modelValue":S[178]||(S[178]=C=>E.value.config.emitterFollowBoneOffsetX=C),type:"number",step:"1",class:"inp"},null,512),[[ht,E.value.config.emitterFollowBoneOffsetX,void 0,{number:!0}]])]),M("label",s5,[S[365]||(S[365]=M("span",null,"位移偏移 Y",-1)),ye(M("input",{"onUpdate:modelValue":S[179]||(S[179]=C=>E.value.config.emitterFollowBoneOffsetY=C),type:"number",step:"1",class:"inp"},null,512),[[ht,E.value.config.emitterFollowBoneOffsetY,void 0,{number:!0}]])])]),M("div",n5,[M("label",r5,[S[366]||(S[366]=M("span",null,"旋转偏移",-1)),ye(M("input",{"onUpdate:modelValue":S[180]||(S[180]=C=>E.value.config.emitterFollowBoneRotation=C),type:"number",step:"1",class:"inp"},null,512),[[ht,E.value.config.emitterFollowBoneRotation,void 0,{number:!0}]])]),M("label",a5,[S[367]||(S[367]=M("span",null,"缩放偏移 X",-1)),ye(M("input",{"onUpdate:modelValue":S[181]||(S[181]=C=>E.value.config.emitterFollowBoneScaleX=C),type:"number",step:"0.05",class:"inp"},null,512),[[ht,E.value.config.emitterFollowBoneScaleX,void 0,{number:!0}]])]),M("label",o5,[S[368]||(S[368]=M("span",null,"缩放偏移 Y",-1)),ye(M("input",{"onUpdate:modelValue":S[182]||(S[182]=C=>E.value.config.emitterFollowBoneScaleY=C),type:"number",step:"0.05",class:"inp"},null,512),[[ht,E.value.config.emitterFollowBoneScaleY,void 0,{number:!0}]])])]),S[369]||(S[369]=M("div",{class:"modifier-hint"},"发射器只跟随所选 Spine 骨骼的位置,不继承 Spine 的旋转或缩放;粒子变换使用粒子系统自身参数和上方偏移。",-1))],64)):Ve("",!0)],64)):Ve("",!0)])):Ve("",!0)]),M("div",l5,[M("label",c5,[ye(M("input",{type:"checkbox","onUpdate:modelValue":S[183]||(S[183]=C=>E.value.config.collision=C)},null,512),[[ei,E.value.config.collision]]),S[370]||(S[370]=M("span",{class:"switch-ui"},null,-1)),S[371]||(S[371]=M("span",null,"开启碰撞",-1))]),E.value.config.collision?(ie(),ae("div",h5,[S[372]||(S[372]=M("div",{class:"collision-filter-title"},"参与的碰撞对象",-1)),M("div",u5,[(ie(!0),ae(Ke,null,ci(Ae.value,C=>(ie(),ae("span",{key:C.id,class:Ze(["collision-filter-tag",{disabled:!C.enabled}]),title:C.enabled?C.name:`${C.name}(碰撞体已禁用)`},[M("span",null,Xe(C.name),1),M("button",{type:"button","aria-label":`清除碰撞对象 ${C.name}`,onClick:Q=>z(C.id)},"×",8,f5)],10,d5))),128)),M("button",{type:"button",class:Ze(["collision-filter-add",{active:pe.value}]),disabled:G.value.length===0,title:G.value.length?"加入场景碰撞对象":"没有可加入的碰撞对象",onClick:S[184]||(S[184]=C=>pe.value=!pe.value)},"+",10,m5)]),Ae.value.length===0?(ie(),ae("div",p5,"未选择碰撞对象,当前粒子不会发生碰撞")):Ve("",!0),pe.value&&G.value.length?(ie(),ae("div",g5,[(ie(!0),ae(Ke,null,ci(G.value,C=>(ie(),ae("button",{key:C.id,type:"button",onClick:Q=>Z(C.id)},[M("span",null,Xe(C.name),1),M("small",null,Xe(C.enabled?"可用":"已禁用"),1)],8,v5))),128))])):Ve("",!0),S[373]||(S[373]=M("div",{class:"modifier-hint"},"只有已加入且启用的场景碰撞对象会参与当前粒子系统的碰撞",-1))])):Ve("",!0)]),Ue(qe,{label:"阻尼",min:0,max:2,step:.05,modelValue:E.value.config.damping,"onUpdate:modelValue":S[185]||(S[185]=C=>E.value.config.damping=C)},null,8,["modelValue"])],512),[[Yi,!le.mods]])]),M("div",y5,[M("div",{class:"group-head",onClick:S[187]||(S[187]=C=>Oe("export"))},[M("span",x5,Xe(le.export?"▸":"▾"),1),S[374]||(S[374]=M("span",null,"导出设置",-1)),M("button",{class:"group-reset",title:"重置导出设置",onClick:S[186]||(S[186]=bt(C=>zi("export"),["stop"]))},"重置")]),ye(M("div",b5,[M("label",w5,[S[375]||(S[375]=M("span",null,"图片路径 (Spine Images Path)",-1)),ye(M("input",{"onUpdate:modelValue":S[188]||(S[188]=C=>t.value.imagesPath=C),class:"inp export-input",type:"text",placeholder:"./images/"},null,512),[[ht,t.value.imagesPath,void 0,{trim:!0}]])]),M("label",S5,[S[377]||(S[377]=M("span",null,"Spine 版本",-1)),ye(M("select",{"onUpdate:modelValue":S[189]||(S[189]=C=>t.value.spineVersion=C),class:"inp export-input"},[...S[376]||(S[376]=[Ts('',5)])],512),[[Ht,t.value.spineVersion]])]),M("label",M5,[S[379]||(S[379]=M("span",null,"关键帧插值曲线",-1)),ye(M("select",{"onUpdate:modelValue":S[190]||(S[190]=C=>t.value.keyframeCurve=C),class:"inp export-input"},[...S[378]||(S[378]=[M("option",{value:"linear"},"线性 (Linear)",-1),M("option",{value:"bezier"},"平滑贝塞尔 (Smooth Bézier)",-1)])],512),[[Ht,t.value.keyframeCurve]])]),S[388]||(S[388]=M("div",{class:"export-help"},"平滑贝塞尔会在误差允许范围内拟合连续运动;出生、死亡、附件切换和突变仍使用阶跃关键帧。",-1)),t.value.spineVersion==="3.8"?(ie(),ae("div",_5,"Spine 3.8 不支持 4.x 的逐通道数组贝塞尔,导出时会转换为经过容差精简的分段线性关键帧。")):Ve("",!0),M("div",T5,[M("label",A5,[S[380]||(S[380]=M("span",null,"导出 FPS",-1)),ye(M("input",{"onUpdate:modelValue":S[191]||(S[191]=C=>t.value.fps=C),class:"inp export-input",type:"number",min:"1",max:"240",step:"1",onChange:dn},null,544),[[ht,t.value.fps,void 0,{number:!0}]])]),M("label",E5,[ye(M("input",{"onUpdate:modelValue":S[192]||(S[192]=C=>t.value.omitFps=C),type:"checkbox"},null,512),[[ei,t.value.omitFps]]),S[381]||(S[381]=Qt("不写 fps",-1))])]),S[389]||(S[389]=M("div",{class:"export-help"},"修改 FPS 时保持动画实际秒数不变;“不写 fps”只省略 Spine 的 fps 元数据。",-1)),M("div",C5,[M("label",I5,[ye(M("input",{"onUpdate:modelValue":S[193]||(S[193]=C=>t.value.integerFrameAlignment=C),type:"checkbox"},null,512),[[ei,t.value.integerFrameAlignment]]),S[382]||(S[382]=M("span",{class:"switch-ui"},null,-1)),S[383]||(S[383]=M("span",null,"整数帧对齐",-1))]),M("label",R5,[ye(M("input",{"onUpdate:modelValue":S[194]||(S[194]=C=>t.value.bonePool=C),type:"checkbox"},null,512),[[ei,t.value.bonePool]]),S[384]||(S[384]=M("span",{class:"switch-ui"},null,-1)),S[385]||(S[385]=M("span",null,"骨骼对象池",-1))]),M("label",P5,[ye(M("input",{"onUpdate:modelValue":S[195]||(S[195]=C=>t.value.excludeEmptyAnimations=C),type:"checkbox"},null,512),[[ei,t.value.excludeEmptyAnimations]]),S[386]||(S[386]=M("span",{class:"switch-ui"},null,-1)),S[387]||(S[387]=M("span",null,"排除无内容动画",-1))])])],512),[[Yi,!le.export]])])],64)):Ve("",!0)]),M("div",k5,[M("button",{type:"button",class:"export-spine-json",disabled:l.value,title:l.value?"正在重新计算并烘焙动画":`导出 Spine ${t.value.spineVersion} JSON`,onClick:L},Xe(l.value&&c.value==="json"?"正在准备导出…":"导出Spine Json"),9,F5),M("button",{type:"button",class:"export-spine-images",disabled:l.value,title:"单独下载当前粒子系统使用的图片 ZIP",onClick:O},Xe(l.value&&c.value==="images"?"正在整理图片…":"导出 images 包"),9,O5),M("button",{type:"button",class:"export-spine-project",disabled:l.value||!b.value,title:A.value,onClick:N},[M("span",null,Xe(l.value&&c.value==="spine"?"正在生成工程…":"导出 .spine 包"),1),!l.value&&w.value?(ie(),ae("small",L5,Xe(w.value),1)):Ve("",!0)],8,B5)]),M("div",{class:Ze(["connector-status",v.value])},[S[390]||(S[390]=M("span",{class:"connector-dot"},null,-1)),Qt(Xe(g.value)+" ",1),y.value?(ie(),ae("a",{key:0,href:y.value,target:"_blank",rel:"noopener",title:"在本机连接器中授权当前网站"},"授权当前网站",8,D5)):Ve("",!0),M("button",{type:"button",title:"重新检测连接器",onClick:B},"刷新")],2),u.value?(ie(),ae("div",{key:0,class:Ze(["export-message",{error:d.value}])},[Qt(Xe(u.value)+" ",1),p.value?(ie(),ae("a",{key:0,href:p.value,target:"_blank",rel:"noopener",onClick:S[196]||(S[196]=C=>p.value="")},"授权当前网站",8,N5)):Ve("",!0)],2)):Ve("",!0)]))}}),X5=Gs(U5,[["__scopeId","data-v-a377e4d4"]]),V5={class:"timeline"},Y5={class:"tl-controls"},$5=["title"],G5={class:"tl-range",title:"自定义播放起始帧"},H5=["max","onKeydown"],j5={class:"tl-range",title:"自定义播放结束帧"},W5=["min","max","onKeydown"],z5=["title"],q5={class:"tl-frame"},K5=["disabled"],Z5=["onClick"],J5={key:0},Q5={class:"tl-animation-editor"},eU={key:0,class:"tl-animation-error"},tU={class:"tl-animation-actions"},iU=["disabled"],sU={key:1,class:"tl-animation-hint"},nU={class:"tl-anim tl-spine-preview"},rU=["value","disabled"],aU={value:""},oU=["value"],lU={class:"tl-zoom"},cU={class:"tl-ticks"},hU={class:"tl-ticklabel"},uU={class:"tl-lanes"},dU=["onPointerdown"],fU={class:"lane-name"},mU=["onPointerdown"],pU=["onPointerdown"],gU=["onPointerdown"],vU={class:"lane-name"},yU={key:0,class:"tl-empty"},xU=$s({__name:"Timeline",setup(s){const e=Kl(),t=lt(null),i=lt(null),n=lt(!1),r=lt("animation"),a=lt("");Jo(()=>{(!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 z of e.systems)(!z.animation||!e.timeline.animations.includes(z.animation))&&(z.animation=e.timeline.animations[0])});const o=vt(()=>e.systems.find(z=>z.id===e.activeId)||null),h=vt(()=>{const z=o.value;return!z||!W(z)?null:g1(z.config,m.value)});function l(){o.value&&(n.value=!n.value,r.value=o.value.animation,a.value="")}function c(z){const j=o.value;j&&(e.setSystemAnimation(j.id,z),r.value=z,a.value="")}function u(){const z=e.addAnimation();r.value=z,a.value=""}function d(){var te;const z=((te=o.value)==null?void 0:te.animation)||e.timeline.animation,j=r.value.trim();if(!j){a.value="动画名称不能为空";return}if(j!==z&&e.timeline.animations.includes(j)){a.value="动画名称不能重复";return}if(!e.renameAnimation(z,j)){a.value="无法修改动画名称";return}r.value=j,a.value=""}function f(){var te,he;const z=((te=o.value)==null?void 0:te.animation)||e.timeline.animation;if(!e.removeAnimation(z)){a.value="至少需要保留一个动画";return}const j=((he=o.value)==null?void 0:he.animation)||e.timeline.animation;r.value=j,a.value=""}function p(z){var j;(j=i.value)!=null&&j.contains(z.target)||(n.value=!1)}Kr(()=>document.addEventListener("pointerdown",p)),$l(()=>document.removeEventListener("pointerdown",p));const m=vt(()=>Math.max(1,e.timeline.fps||30)),g=lt(120),v=lt({}),b=lt({}),y=lt({}),w=lt({}),A=lt(String(e.timeline.playbackStart)),T=lt(String(e.timeline.playbackEnd));fs(()=>e.timeline.playbackStart,z=>{A.value=String(z)}),fs(()=>e.timeline.playbackEnd,z=>{T.value=String(z)});const _=vt(()=>e.timeline.totalFrames),R=vt(()=>g.value<=30?"放大":g.value>=300?"缩小":"适中"),P=vt(()=>e.spines.filter(z=>z.selectedAnimation&&z.animations.some(j=>j.name===z.selectedAnimation&&j.duration>0))),F=vt(()=>(e.activeObjectType==="spine"?e.spines.find(j=>j.id===e.activeObjectId&&j.animations.length):null)||e.spines.find(j=>j.animations.length)||null);function I(z){const j=F.value;j&&(j.selectedAnimation=z.target.value,e.recalcTotalFrames(),e.timeline.frame=0)}function k(){e.setPlaybackStart(Number(A.value)),A.value=String(e.timeline.playbackStart)}function B(){e.setPlaybackEnd(Number(T.value)),T.value=String(e.timeline.playbackEnd)}function D(){const z=h.value;z&&(e.setPlaybackEnd(z.end),e.setPlaybackStart(z.start))}function U(){var j;const z=((j=t.value)==null?void 0:j.clientWidth)||600;return g.value/z}const L=vt(()=>{const z=[],j=g.value;let te=1;g.value<=10?te=1:g.value<=50?te=5:g.value<=200?te=10:g.value<=500?te=50:te=100;for(let he=0;he<=j;he+=te)z.push({f:he,px:he/U()});return z}),N=vt(()=>e.timeline.frame/U());function O(z){const j=z.config;return(v.value[z.id]??Math.max(0,Number(j.delay)||0))*m.value/U()}function X(z){const j=z.config,te=Math.max(0,Number(j.lifeMin)||0),he=Math.max(0,Number(j.lifeMax)||0);return j.lifeMode==="fixed"?te:Math.max(te,he)}function E(z){return q(z)}function V(z){if(z.config.mode!=="stream")return 0;if(z.config.streamBehavior==="loop"){const te=z.config;return(y.value[z.id]??Xr(te,m.value).loop)/U()}return(b.value[z.id]??Math.max(1/m.value,Number(z.config.duration)||1))*m.value/U()}function q(z){const j=z.config;return j.mode==="stream"&&j.streamBehavior==="loop"?J(z)+V(z)+K(z):V(z)+X(z)*m.value/U()}function W(z){const j=z.config;return j.mode==="stream"&&j.streamBehavior==="loop"}function J(z){return W(z)?Xr(z.config,m.value).start/U():0}function K(z){return W(z)?Xr(z.config,m.value).end/U():0}function fe(z){var j;return((j=z.animations.find(te=>te.name===z.selectedAnimation))==null?void 0:j.duration)||0}function me(z){return(w.value[z.id]??Math.max(0,Number(z.timeOffset)||0))*m.value/U()}function we(z){return fe(z)*m.value/U()}function Ee(z){const j=z.deltaY<0?.8:1.25;let te=g.value*j;te=Math.min(2e3,Math.max(10,te)),g.value=Math.round(te)}function pe(z){const j=t.value,te=xe=>{const oe=j.getBoundingClientRect(),ge=Math.floor((xe.clientX-oe.left)/oe.width*g.value);e.timeline.frame=Math.max(0,Math.min(ge,_.value-1))};te(z);const he=()=>{window.removeEventListener("pointermove",te),window.removeEventListener("pointerup",he)};window.addEventListener("pointermove",te),window.addEventListener("pointerup",he)}function Ae(z,j){z.stopPropagation();const te=z.clientX,he=Math.max(0,Number(j.config.delay)||0),xe=U()/m.value,oe=Fe=>{const Be=(Fe.clientX-te)*xe,st=Math.max(0,Math.min(he+Be,600));v.value[j.id]=Math.round(st*m.value)/m.value},ge=Fe=>{window.removeEventListener("pointermove",oe),window.removeEventListener("pointerup",le),window.removeEventListener("pointercancel",Oe);const Be=v.value[j.id];delete v.value[j.id],Fe&&Be!=null&&Be!==he&&(j.config.delay=Be)},le=()=>ge(!0),Oe=()=>ge(!1);window.addEventListener("pointermove",oe),window.addEventListener("pointerup",le),window.addEventListener("pointercancel",Oe)}function G(z,j){var At;z.stopPropagation();const te=W(j),he=Math.max(0,Number(j.config.duration)||0),xe=Xr(j.config,m.value).loop,oe=U()/m.value,ge=((At=z.currentTarget.closest(".lane-bar"))==null?void 0:At.getBoundingClientRect().left)??z.clientX,le=J(j);let Oe=!1;const Fe=Et=>{if(Oe=!0,te){const It=Math.min(1800,Math.max(1,Math.round((Et.clientX-ge-le)/U())));y.value[j.id]=It}else{const It=Math.max(1/m.value,Math.min((Et.clientX-ge)*oe,600));b.value[j.id]=Math.round(It*m.value)/m.value}},Be=Et=>{window.removeEventListener("pointermove",Fe),window.removeEventListener("pointerup",st),window.removeEventListener("pointercancel",St);const It=b.value[j.id],Kt=y.value[j.id];delete b.value[j.id],delete y.value[j.id],Et&&Oe&&te&&Kt!=null&&Kt!==xe?j.config.loopDurationFrames=Kt:Et&&Oe&&!te&&It!=null&&It!==he&&(j.config.duration=It)},st=()=>Be(!0),St=()=>Be(!1);window.addEventListener("pointermove",Fe),window.addEventListener("pointerup",st),window.addEventListener("pointercancel",St)}function Z(z,j){z.stopPropagation();const te=z.clientX,he=Math.max(0,Number(j.timeOffset)||0),xe=U()/m.value,oe=Fe=>{const Be=Math.max(0,Math.min(he+(Fe.clientX-te)*xe,600));w.value[j.id]=Math.round(Be*m.value)/m.value},ge=Fe=>{window.removeEventListener("pointermove",oe),window.removeEventListener("pointerup",le),window.removeEventListener("pointercancel",Oe);const Be=w.value[j.id];delete w.value[j.id],Fe&&Be!=null&&Be!==he&&(j.timeOffset=Be,e.recalcTotalFrames())},le=()=>ge(!0),Oe=()=>ge(!1);window.addEventListener("pointermove",oe),window.addEventListener("pointerup",le),window.addEventListener("pointercancel",Oe)}return(z,j)=>{var te,he,xe;return ie(),ae("div",V5,[M("div",Y5,[M("button",{class:Ze(["tl-btn",{on:ke(e).timeline.playing}]),onClick:j[0]||(j[0]=oe=>ke(e).togglePlay()),title:ke(e).timeline.playing?"暂停 (D)":"播放 (D)"},Xe(ke(e).timeline.playing?"❚❚":"▶"),11,$5),M("button",{class:"tl-btn",onClick:j[1]||(j[1]=oe=>ke(e).toStart()),title:"回到第一帧 (S)"},"⏮"),M("button",{class:"tl-btn",onClick:j[2]||(j[2]=oe=>ke(e).previousFrame()),title:"前一帧"},"◀"),M("button",{class:"tl-btn",onClick:j[3]||(j[3]=oe=>ke(e).nextFrame()),title:"后一帧"},"▶"),M("button",{class:"tl-btn",onClick:j[4]||(j[4]=oe=>ke(e).toEnd()),title:"移动到最后一帧"},"⏭"),M("button",{class:Ze(["tl-btn",{on:ke(e).timeline.loop}]),onClick:j[5]||(j[5]=oe=>ke(e).toggleLoop()),title:"循环"},"⟳",2),M("label",G5,[j[10]||(j[10]=M("span",null,"A",-1)),ye(M("input",{"onUpdate:modelValue":j[6]||(j[6]=oe=>A.value=oe),type:"number",min:"0",max:Math.max(0,ke(e).timeline.playbackEnd-1),"aria-label":"播放起始帧",onChange:k,onKeydown:Ea(bt(k,["prevent"]),["enter"])},null,40,H5),[[ht,A.value]])]),M("label",j5,[j[11]||(j[11]=M("span",null,"B",-1)),ye(M("input",{"onUpdate:modelValue":j[7]||(j[7]=oe=>T.value=oe),type:"number",min:ke(e).timeline.playbackStart+1,max:Math.max(1,ke(e).timeline.totalFrames-1),"aria-label":"播放结束帧",onChange:B,onKeydown:Ea(bt(B,["prevent"]),["enter"])},null,40,W5),[[ht,T.value]])]),h.value?(ie(),ae("button",{key:0,class:"tl-loop-range",title:`设为闭合自循环范围 ${h.value.start}–${h.value.end}f`,onClick:D},"循环段",8,z5)):Ve("",!0),M("span",q5,[j[12]||(j[12]=Qt("帧 ",-1)),M("b",null,Xe(ke(e).timeline.frame),1),j[13]||(j[13]=Qt(" / ",-1)),M("b",null,Xe(Math.max(0,ke(e).timeline.totalFrames-1)),1)]),j[18]||(j[18]=M("span",{class:"tl-legend"},[M("i",{class:"legend-emission"}),Qt("持续发射 "),M("i",{class:"legend-life"}),Qt("粒子存在 "),M("i",{class:"legend-spine"}),Qt("Spine 动画")],-1)),M("div",{ref_key:"animationMenuRef",ref:i,class:"tl-anim tl-owner-animation"},[j[16]||(j[16]=M("span",null,"所属动画",-1)),M("button",{class:"tl-animation-trigger",disabled:!o.value,title:"设置当前粒子系统所属的动画",onClick:bt(l,["stop"])},[M("span",null,Xe(((te=o.value)==null?void 0:te.animation)||ke(e).timeline.animation),1),j[14]||(j[14]=M("i",null,"⌄",-1))],8,K5),n.value?(ie(),ae("div",{key:0,class:"tl-animation-menu",onPointerdown:j[9]||(j[9]=bt(()=>{},["stop"]))},[j[15]||(j[15]=M("div",{class:"tl-animation-menu-title"},"选择所属动画",-1)),(ie(!0),ae(Ke,null,ci(ke(e).timeline.animations,oe=>{var ge,le;return ie(),ae("button",{key:oe,class:Ze(["tl-animation-option",{on:((ge=o.value)==null?void 0:ge.animation)===oe}]),onClick:Oe=>c(oe)},[M("span",null,Xe(oe),1),((le=o.value)==null?void 0:le.animation)===oe?(ie(),ae("i",J5,"✓")):Ve("",!0)],10,Z5)}),128)),M("div",Q5,[ye(M("input",{"onUpdate:modelValue":j[8]||(j[8]=oe=>r.value=oe),class:"tl-animation-name",maxlength:"64","aria-label":"动画名称",onKeydown:Ea(d,["enter"])},null,544),[[ht,r.value]]),M("button",{title:"重命名当前动画",onClick:d},"重命名")]),a.value?(ie(),ae("div",eU,Xe(a.value),1)):Ve("",!0),M("div",tU,[M("button",{onClick:u},"+ 新增"),M("button",{disabled:ke(e).timeline.animations.length<=1,onClick:f},"删除",8,iU)]),ke(e).timeline.animations.length<=1?(ie(),ae("div",sU,"至少需要保留一个动画")):Ve("",!0)],32)):Ve("",!0)],512),M("label",nU,[j[17]||(j[17]=Qt("Spine 预览动画 ",-1)),M("select",{class:"tl-sel",value:((he=F.value)==null?void 0:he.selectedAnimation)||"",disabled:!F.value,onChange:I},[M("option",aU,Xe(F.value?"无":"无可用 Spine 动画"),1),(ie(!0),ae(Ke,null,ci(((xe=F.value)==null?void 0:xe.animations)||[],oe=>(ie(),ae("option",{key:oe.name,value:oe.name},Xe(oe.name)+"("+Xe(oe.duration.toFixed(2))+"s) ",9,oU))),128))],40,rU)]),M("span",lU,Xe(R.value),1)]),M("div",{class:"tl-viewport",ref_key:"vpRef",ref:t,onWheel:bt(Ee,["prevent"]),onPointerdown:pe},[M("div",cU,[(ie(!0),ae(Ke,null,ci(L.value,oe=>(ie(),ae("div",{key:oe.f,class:"tl-tickline",style:Li({left:oe.px+"px"})},[M("span",hU,Xe(oe.f)+"f",1)],4))),128))]),M("div",{class:"tl-playhead",style:Li({left:N.value+"px"})},null,4),M("div",uU,[(ie(!0),ae(Ke,null,ci(ke(e).systems,(oe,ge)=>(ie(),ae("div",{key:oe.id,class:"tl-lane"},[j[19]||(j[19]=M("span",{class:"lane-ico"},"●",-1)),M("div",{class:"lane-bar",style:Li({left:O(oe)+"px",width:E(oe)+"px"}),onPointerdown:bt(le=>Ae(le,oe),["stop"])},[M("span",fU,Xe(oe.config.name||"系统 "+(ge+1)),1),M("span",{class:Ze(["bar-life",{"loop-life":W(oe)}]),style:Li({width:q(oe)+"px"})},null,6),W(oe)?(ie(),ae(Ke,{key:0},[J(oe)?(ie(),ae("span",{key:0,class:"bar-loop-transition bar-loop-start",style:Li({width:J(oe)+"px"})},null,4)):Ve("",!0),M("span",{class:"bar-emission bar-loop",style:Li({left:J(oe)+"px",width:V(oe)+"px"})},[M("span",{class:"bar-handle",title:"拖动循环段时长",onPointerdown:bt(le=>G(le,oe),["stop"])},null,40,mU)],4),K(oe)?(ie(),ae("span",{key:1,class:"bar-loop-transition bar-loop-end",style:Li({left:J(oe)+V(oe)+"px",width:K(oe)+"px"})},null,4)):Ve("",!0)],64)):oe.config.mode==="stream"?(ie(),ae("span",{key:1,class:"bar-emission",style:Li({width:V(oe)+"px"})},[M("span",{class:"bar-handle",title:"拖动持续发射时长",onPointerdown:bt(le=>G(le,oe),["stop"])},null,40,pU)],4)):Ve("",!0)],44,dU)]))),128)),(ie(!0),ae(Ke,null,ci(P.value,oe=>(ie(),ae("div",{key:`spine-${oe.id}`,class:"tl-lane spine-lane"},[j[20]||(j[20]=M("span",{class:"lane-ico spine-ico"},"◆",-1)),M("div",{class:"spine-bar",style:Li({left:me(oe)+"px",width:we(oe)+"px"}),title:"拖动调整动画开始时间",onPointerdown:bt(ge=>Z(ge,oe),["stop"])},[M("span",vU,Xe(oe.name)+" · "+Xe(oe.selectedAnimation),1)],44,gU)]))),128)),!ke(e).systems.length&&!P.value.length?(ie(),ae("div",yU,"暂无可显示的动画数据")):Ve("",!0)])],544)])}}}),bU=Gs(xU,[["__scopeId","data-v-e305dee7"]]),wU={class:"transfer-heading"},SU={key:0},MU={class:"transfer-detail"},_U=$s({__name:"TransferProgressOverlay",setup(s){const e=lt(null);return fs(()=>xi.visible,async t=>{var i;t&&(await lu(),(i=e.value)==null||i.focus({preventScroll:!0}))},{flush:"post"}),(t,i)=>(ie(),Jt(P_,{name:"transfer-fade"},{default:ah(()=>[ke(xi).visible?(ie(),ae("div",{key:0,ref_key:"overlayElement",ref:e,class:"transfer-overlay",role:"dialog","aria-modal":"true","aria-live":"polite",tabindex:"-1",onPointerdown:i[0]||(i[0]=bt(()=>{},["stop","prevent"])),onPointerup:i[1]||(i[1]=bt(()=>{},["stop","prevent"])),onClick:i[2]||(i[2]=bt(()=>{},["stop","prevent"])),onDblclick:i[3]||(i[3]=bt(()=>{},["stop","prevent"])),onContextmenu:i[4]||(i[4]=bt(()=>{},["stop","prevent"])),onWheel:i[5]||(i[5]=bt(()=>{},["stop","prevent"])),onKeydown:i[6]||(i[6]=bt(()=>{},["stop","prevent"]))},[M("div",{class:Ze(["transfer-dialog",{failed:ke(xi).failed}])},[M("div",wU,[M("span",null,Xe(ke(xi).title),1),ke(xi).indeterminate?Ve("",!0):(ie(),ae("strong",SU,Xe(Math.round(ke(xi).progress))+"%",1))]),M("div",{class:Ze(["transfer-track",{indeterminate:ke(xi).indeterminate}])},[M("div",{class:"transfer-bar",style:Li(ke(xi).indeterminate?void 0:{width:`${ke(xi).progress}%`})},null,4)],2),M("div",MU,Xe(ke(xi).detail),1)],2)],544)):Ve("",!0)]),_:1}))}}),TU=Gs(_U,[["__scopeId","data-v-016b4c9d"]]),AU=["inert","aria-hidden"],EU={class:"right"},CU={class:"stage-area"},IU=$s({__name:"App",setup(s){const e=Kl();JI(e);const t=lt(360),i=lt(180);function n(a){a.preventDefault();const o=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",o),window.removeEventListener("pointerup",h)};window.addEventListener("pointermove",o),window.addEventListener("pointerup",h)}function r(a){a.preventDefault();const o=a.clientY,h=i.value,l=u=>{const d=Math.max(80,Math.min(h+(o-u.clientY),window.innerHeight-200));i.value=d},c=()=>{window.removeEventListener("pointermove",l),window.removeEventListener("pointerup",c)};window.addEventListener("pointermove",l),window.addEventListener("pointerup",c)}return(a,o)=>(ie(),ae(Ke,null,[M("div",{class:Ze(["layout",{"panel-right":ke(e).settings.parameterPanelOnRight}]),inert:ke(xi).visible?!0:void 0,"aria-hidden":ke(xi).visible?"true":void 0},[M("div",{class:"parameter-panel",style:Li({width:t.value+"px"})},[Ue(X5)],4),M("div",{class:"resizer-col",onPointerdown:n},null,32),M("div",EU,[M("div",CU,[Ue(sF)]),M("div",{class:"resizer-row",onPointerdown:r,title:"拖动调整时间轴高度"},null,32),M("div",{class:"timeline-area",style:Li({height:i.value+"px"})},[Ue(bU)],4)])],10,AU),Ue(TU)],64))}}),RU=Gs(IU,[["__scopeId","data-v-d7e0e59a"]]);rT(RU).use(lT()).mount("#app");export{dy as $,Fn as A,Wh as B,jt as C,ji as D,He as E,ds as F,Nn as G,wt as H,Ut as I,gS as J,ys as K,Is as L,Ys as M,zr as N,Pu as O,kn as P,Bl as Q,Po as R,sn as S,EO as T,ct as U,ay as V,an as W,r8 as X,_B as Y,Xl as Z,Mp as _,gt as a,Bm as a$,uy as a0,qw as a1,Fp as a2,s8 as a3,$h as a4,xl as a5,DO as a6,bl as a7,ku as a8,Pm as a9,$m as aA,Gm as aB,Nc as aC,Pr as aD,Qc as aE,km as aF,Qw as aG,pi as aH,jw as aI,q6 as aJ,To as aK,hy as aL,Ye as aM,it as aN,Om as aO,eh as aP,sS as aQ,Fm as aR,tS as aS,iS as aT,Fu as aU,aS as aV,th as aW,cS as aX,nS as aY,oS as aZ,hS as a_,Ya as aa,Op as ab,Bp as ac,ly as ad,Ql as ae,ec as af,Jl as ag,Va as ah,ar as ai,Z6 as aj,Jw as ak,LO as al,Fo as am,Gr as an,Np as ao,pS as ap,OO as aq,Ul as ar,vs as as,cy as at,e8 as au,No as av,Ym as aw,Hm as ax,jm as ay,Wm as az,Io as b,yr as b$,jh as b0,rS as b1,Jr as b2,lS as b3,Lp as b4,AO as b5,fS as b6,mS as b7,Dp as b8,Dn as b9,uS as bA,Up as bB,Ru as bC,vS as bD,Lm as bE,Fi as bF,_O as bG,IO as bH,Bw as bI,Ow as bJ,J6 as bK,ii as bL,Uo as bM,yS as bN,wS as bO,SS as bP,MS as bQ,xS as bR,bS,FO as bT,Xp as bU,Gt as bV,Vm as bW,eS as bX,Dw as bY,Nw as bZ,Uw as b_,TO as ba,K6 as bb,xt as bc,Zw as bd,Kw as be,Ww as bf,zw as bg,ka as bh,Gh as bi,BO as bj,Xw as bk,Vw as bl,hs as bm,Yw as bn,ko as bo,Gi as bp,Lw as bq,Hh as br,$w as bs,Gw as bt,Hw as bu,fy as bv,Um as bw,ba as bx,dS as by,Nm as bz,Ro as c,Q6 as c0,PO as c1,kO as c2,RO as c3,dt as d,tt as e,t8 as f,yt as g,Ni as h,Mh as i,bs as j,oi as k,et as l,cn as m,li as n,gp as o,wi as p,Ll as q,Cr as r,We as s,ab as t,Sp as u,Ch as v,Dm as w,ya as x,oy as y,Xm as z};