1240 lines
1.1 MiB
Plaintext
1240 lines
1.1 MiB
Plaintext
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-C_0QkTeX.js","assets/index-BrVMjrya.js"])))=>i.map(i=>d[i]);
|
||
var CS=Object.defineProperty;var IS=(s,e,t)=>e in s?CS(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var x=(s,e,t)=>IS(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 Km(s){const e=Object.create(null);for(const t of s.split(","))e[t]=1;return t=>t in e}const ii={},fo=[],Pn=()=>{},by=()=>!1,Jh=s=>s.charCodeAt(0)===111&&s.charCodeAt(1)===110&&(s.charCodeAt(2)>122||s.charCodeAt(2)<97),Qh=s=>s.startsWith("onUpdate:"),Oi=Object.assign,Zm=(s,e)=>{const t=s.indexOf(e);t>-1&&s.splice(t,1)},RS=Object.prototype.hasOwnProperty,zt=(s,e)=>RS.call(s,e),dt=Array.isArray,mo=s=>Yl(s)==="[object Map]",Oo=s=>Yl(s)==="[object Set]",$p=s=>Yl(s)==="[object Date]",_t=s=>typeof s=="function",gi=s=>typeof s=="string",Ss=s=>typeof s=="symbol",qt=s=>s!==null&&typeof s=="object",wy=s=>(qt(s)||_t(s))&&_t(s.then)&&_t(s.catch),Sy=Object.prototype.toString,Yl=s=>Sy.call(s),PS=s=>Yl(s).slice(8,-1),_y=s=>Yl(s)==="[object Object]",eu=s=>gi(s)&&s!=="NaN"&&s[0]!=="-"&&""+parseInt(s,10)===s,hl=Km(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),tu=s=>{const e=Object.create(null);return(t=>e[t]||(e[t]=s(t)))},kS=/-\w/g,qs=tu(s=>s.replace(kS,e=>e.slice(1).toUpperCase())),FS=/\B([A-Z])/g,jr=tu(s=>s.replace(FS,"-$1").toLowerCase()),My=tu(s=>s.charAt(0).toUpperCase()+s.slice(1)),Ou=tu(s=>s?`on${My(s)}`:""),An=(s,e)=>!Object.is(s,e),Uc=(s,...e)=>{for(let t=0;t<s.length;t++)s[t](...e)},Ty=(s,e,t,i=!1)=>{Object.defineProperty(s,e,{configurable:!0,enumerable:!1,writable:i,value:t})},iu=s=>{const e=parseFloat(s);return isNaN(e)?s:e},OS=s=>{const e=gi(s)?Number(s):NaN;return isNaN(e)?s:e};let Gp;const su=()=>Gp||(Gp=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function Ni(s){if(dt(s)){const e={};for(let t=0;t<s.length;t++){const i=s[t],n=gi(i)?NS(i):Ni(i);if(n)for(const r in n)e[r]=n[r]}return e}else if(gi(s)||qt(s))return s}const BS=/;(?![^(]*\))/g,LS=/:([^]+)/,DS=/\/\*[^]*?\*\//g;function NS(s){const e={};return s.replace(DS,"").split(BS).forEach(t=>{if(t){const i=t.split(LS);i.length>1&&(e[i[0].trim()]=i[1].trim())}}),e}function ot(s){let e="";if(gi(s))e=s;else if(dt(s))for(let t=0;t<s.length;t++){const i=ot(s[t]);i&&(e+=i+" ")}else if(qt(s))for(const t in s)s[t]&&(e+=t+" ");return e.trim()}const US="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",XS=Km(US);function Ay(s){return!!s||s===""}function VS(s,e){if(s.length!==e.length)return!1;let t=!0;for(let i=0;t&&i<s.length;i++)t=Bo(s[i],e[i]);return t}function Bo(s,e){if(s===e)return!0;let t=$p(s),i=$p(e);if(t||i)return t&&i?s.getTime()===e.getTime():!1;if(t=Ss(s),i=Ss(e),t||i)return s===e;if(t=dt(s),i=dt(e),t||i)return t&&i?VS(s,e):!1;if(t=qt(s),i=qt(e),t||i){if(!t||!i)return!1;const n=Object.keys(s).length,r=Object.keys(e).length;if(n!==r)return!1;for(const a in s){const o=s.hasOwnProperty(a),h=e.hasOwnProperty(a);if(o&&!h||!o&&h||!Bo(s[a],e[a]))return!1}}return String(s)===String(e)}function Jm(s,e){return s.findIndex(t=>Bo(t,e))}const Ey=s=>!!(s&&s.__v_isRef===!0),je=s=>gi(s)?s:s==null?"":dt(s)||qt(s)&&(s.toString===Sy||!_t(s.toString))?Ey(s)?je(s.value):JSON.stringify(s,Cy,2):String(s),Cy=(s,e)=>Ey(e)?Cy(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))}:Ss(e)?Bu(e):qt(e)&&!dt(e)&&!_y(e)?String(e):e,Bu=(s,e="")=>{var t;return Ss(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 Iy{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;e<t;e++)i[e].pause()}for(e=0,t=this.effects.length;e<t;e++)this.effects[e].pause()}}resume(){if(this._active&&this._isPaused){this._isPaused=!1;let e,t;if(this.scopes){const n=this.scopes.slice();for(e=0,t=n.length;e<t;e++)n[e].resume()}const i=this.effects.slice();for(e=0,t=i.length;e<t;e++)i[e].resume()}}run(e){if(this._active){const t=Pi;try{return Pi=this,e()}finally{Pi=t}}}on(){++this._on===1&&(this.prevScope=Pi,Pi=this)}off(){if(this._on>0&&--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;t<i;t++)this.effects[t].stop();for(this.effects.length=0,t=0,i=this.cleanups.length;t<i;t++)this.cleanups[t]();if(this.cleanups.length=0,this.scopes){const n=this.scopes.slice();for(t=0,i=n.length;t<i;t++)n[t].stop(!0);this.scopes.length=0}if(!this.detached&&this.parent&&!e){const n=this.parent.scopes.pop();n&&n!==this&&(this.parent.scopes[this.index]=n,n.index=this.index)}this.parent=void 0}}}function Ry(s){return new Iy(s)}function Py(){return Pi}function YS(s,e=!1){Pi&&Pi.cleanups.push(s)}let ri;const Lu=new WeakSet;class ky{constructor(e){this.fn=e,this.deps=void 0,this.depsTail=void 0,this.flags=5,this.next=void 0,this.cleanup=void 0,this.scheduler=void 0,Pi&&(Pi.active?Pi.effects.push(this):this.flags&=-2)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,Lu.has(this)&&(Lu.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||Oy(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,Hp(this),By(this);const e=ri,t=Ks;ri=this,Ks=!0;try{return this.fn()}finally{Ly(this),ri=e,Ks=t,this.flags&=-3}}stop(){if(this.flags&1){for(let e=this.deps;e;e=e.nextDep)tp(e);this.deps=this.depsTail=void 0,Hp(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?Lu.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){If(this)&&this.run()}get dirty(){return If(this)}}let Fy=0,ul,dl;function Oy(s,e=!1){if(s.flags|=8,e){s.next=dl,dl=s;return}s.next=ul,ul=s}function Qm(){Fy++}function ep(){if(--Fy>0)return;if(dl){let e=dl;for(dl=void 0;e;){const t=e.next;e.next=void 0,e.flags&=-9,e=t}}let s;for(;ul;){let e=ul;for(ul=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 By(s){for(let e=s.deps;e;e=e.nextDep)e.version=-1,e.prevActiveLink=e.dep.activeLink,e.dep.activeLink=e}function Ly(s){let e,t=s.depsTail,i=t;for(;i;){const n=i.prevDep;i.version===-1?(i===t&&(t=n),tp(i),$S(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&&(Dy(e.dep.computed)||e.dep.version!==e.version))return!0;return!!s._dirty}function Dy(s){if(s.flags&4&&!(s.flags&16)||(s.flags&=-17,s.globalVersion===Tl)||(s.globalVersion=Tl,!s.isSSR&&s.flags&128&&(!s.deps&&!s._dirty||!If(s))))return;s.flags|=2;const e=s.dep,t=ri,i=Ks;ri=s,Ks=!0;try{By(s);const n=s.fn(s._value);(e.version===0||An(n,s._value))&&(s.flags|=128,s._value=n,e.version++)}catch(n){throw e.version++,n}finally{ri=t,Ks=i,Ly(s),s.flags&=-3}}function tp(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)tp(r,!0)}!e&&!--t.sc&&t.map&&t.map.delete(t.key)}function $S(s){const{prevDep:e,nextDep:t}=s;e&&(e.nextDep=t,s.prevDep=void 0),t&&(t.prevDep=e,s.nextDep=void 0)}let Ks=!0;const Ny=[];function cr(){Ny.push(Ks),Ks=!1}function hr(){const s=Ny.pop();Ks=s===void 0?!0:s}function Hp(s){const{cleanup:e}=s;if(s.cleanup=void 0,e){const t=ri;ri=void 0;try{e()}finally{ri=t}}}let Tl=0;class GS{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 ip{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(!ri||!Ks||ri===this.computed)return;let t=this.activeLink;if(t===void 0||t.sub!==ri)t=this.activeLink=new GS(ri,this),ri.deps?(t.prevDep=ri.depsTail,ri.depsTail.nextDep=t,ri.depsTail=t):ri.deps=ri.depsTail=t,Uy(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=ri.depsTail,t.nextDep=void 0,ri.depsTail.nextDep=t,ri.depsTail=t,ri.deps===t&&(ri.deps=i)}return t}trigger(e){this.version++,Tl++,this.notify(e)}notify(e){Qm();try{for(let t=this.subs;t;t=t.prevSub)t.sub.notify()&&t.sub.dep.notify()}finally{ep()}}}function Uy(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)Uy(i)}const t=s.dep.subs;t!==s&&(s.prevSub=t,t&&(t.nextSub=s)),s.dep.subs=s}}const ih=new WeakMap,Ma=Symbol(""),Rf=Symbol(""),Al=Symbol("");function Ji(s,e,t){if(Ks&&ri){let i=ih.get(s);i||ih.set(s,i=new Map);let n=i.get(t);n||(i.set(t,n=new ip),n.map=i,n.key=t),n.track()}}function Kn(s,e,t,i,n,r){const a=ih.get(s);if(!a){Tl++;return}const o=h=>{h&&h.trigger()};if(Qm(),e==="clear")a.forEach(o);else{const h=dt(s),l=h&&eu(t);if(h&&t==="length"){const c=Number(i);a.forEach((u,d)=>{(d==="length"||d===Al||!Ss(d)&&d>=c)&&o(u)})}else switch((t!==void 0||a.has(void 0))&&o(a.get(t)),l&&o(a.get(Al)),e){case"add":h?l&&o(a.get("length")):(o(a.get(Ma)),mo(s)&&o(a.get(Rf)));break;case"delete":h||(o(a.get(Ma)),mo(s)&&o(a.get(Rf)));break;case"set":mo(s)&&o(a.get(Ma));break}}ep()}function HS(s,e){const t=ih.get(s);return t&&t.get(e)}function Ha(s){const e=Yt(s);return e===s?e:(Ji(e,"iterate",Al),ws(s)?e:e.map(tn))}function nu(s){return Ji(s=Yt(s),"iterate",Al),s}function _n(s,e){return ur(s)?Ao(ar(s)?tn(e):e):tn(e)}const jS={__proto__:null,[Symbol.iterator](){return Du(this,Symbol.iterator,s=>_n(this,s))},concat(...s){return Ha(this).concat(...s.map(e=>dt(e)?Ha(e):e))},entries(){return Du(this,"entries",s=>(s[1]=_n(this,s[1]),s))},every(s,e){return Un(this,"every",s,e,void 0,arguments)},filter(s,e){return Un(this,"filter",s,e,t=>t.map(i=>_n(this,i)),arguments)},find(s,e){return Un(this,"find",s,e,t=>_n(this,t),arguments)},findIndex(s,e){return Un(this,"findIndex",s,e,void 0,arguments)},findLast(s,e){return Un(this,"findLast",s,e,t=>_n(this,t),arguments)},findLastIndex(s,e){return Un(this,"findLastIndex",s,e,void 0,arguments)},forEach(s,e){return Un(this,"forEach",s,e,void 0,arguments)},includes(...s){return Nu(this,"includes",s)},indexOf(...s){return Nu(this,"indexOf",s)},join(s){return Ha(this).join(s)},lastIndexOf(...s){return Nu(this,"lastIndexOf",s)},map(s,e){return Un(this,"map",s,e,void 0,arguments)},pop(){return $o(this,"pop")},push(...s){return $o(this,"push",s)},reduce(s,...e){return jp(this,"reduce",s,e)},reduceRight(s,...e){return jp(this,"reduceRight",s,e)},shift(){return $o(this,"shift")},some(s,e){return Un(this,"some",s,e,void 0,arguments)},splice(...s){return $o(this,"splice",s)},toReversed(){return Ha(this).toReversed()},toSorted(s){return Ha(this).toSorted(s)},toSpliced(...s){return Ha(this).toSpliced(...s)},unshift(...s){return $o(this,"unshift",s)},values(){return Du(this,"values",s=>_n(this,s))}};function Du(s,e,t){const i=nu(s),n=i[e]();return i!==s&&!ws(s)&&(n._next=n.next,n.next=()=>{const r=n._next();return r.done||(r.value=t(r.value)),r}),n}const WS=Array.prototype;function Un(s,e,t,i,n,r){const a=nu(s),o=a!==s&&!ws(s),h=a[e];if(h!==WS[e]){const u=h.apply(s,r);return o?tn(u):u}let l=t;a!==s&&(o?l=function(u,d){return t.call(this,_n(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 jp(s,e,t,i){const n=nu(s),r=n!==s&&!ws(s);let a=t,o=!1;n!==s&&(r?(o=i.length===0,a=function(l,c,u){return o&&(o=!1,l=_n(s,l)),t.call(this,l,_n(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?_n(s,h):h}function Nu(s,e,t){const i=Yt(s);Ji(i,"iterate",Al);const n=i[e](...t);return(n===-1||n===!1)&&ru(t[0])?(t[0]=Yt(t[0]),i[e](...t)):n}function $o(s,e,t=[]){cr(),Qm();const i=Yt(s)[e].apply(s,t);return ep(),hr(),i}const zS=Km("__proto__,__v_isRef,__isVue"),Xy=new Set(Object.getOwnPropertyNames(Symbol).filter(s=>s!=="arguments"&&s!=="caller").map(s=>Symbol[s]).filter(Ss));function qS(s){Ss(s)||(s=String(s));const e=Yt(this);return Ji(e,"has",s),e.hasOwnProperty(s)}class Vy{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?r_:Hy:r?Gy:$y).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(i)?e:void 0;const a=dt(e);if(!n){let h;if(a&&(h=jS[t]))return h;if(t==="hasOwnProperty")return qS}const o=Reflect.get(e,t,_i(e)?e:i);if((Ss(t)?Xy.has(t):zS(t))||(n||Ji(e,"get",t),r))return o;if(_i(o)){const h=a&&eu(t)?o:o.value;return n&&qt(h)?kf(h):h}return qt(o)?n?kf(o):La(o):o}}class Yy extends Vy{constructor(e=!1){super(!1,e)}set(e,t,i,n){let r=e[t];const a=dt(e)&&eu(t);if(!this._isShallow){const l=ur(r);if(!ws(i)&&!ur(i)&&(r=Yt(r),i=Yt(i)),!a&&_i(r)&&!_i(i))return l||(r.value=i),!0}const o=a?Number(t)<e.length:zt(e,t),h=Reflect.set(e,t,i,_i(e)?e:n);return e===Yt(n)&&h&&(o?An(i,r)&&Kn(e,"set",t,i):Kn(e,"add",t,i)),h}deleteProperty(e,t){const i=zt(e,t);e[t];const n=Reflect.deleteProperty(e,t);return n&&i&&Kn(e,"delete",t,void 0),n}has(e,t){const i=Reflect.has(e,t);return(!Ss(t)||!Xy.has(t))&&Ji(e,"has",t),i}ownKeys(e){return Ji(e,"iterate",dt(e)?"length":Ma),Reflect.ownKeys(e)}}class KS extends Vy{constructor(e=!1){super(!0,e)}set(e,t){return!0}deleteProperty(e,t){return!0}}const ZS=new Yy,JS=new KS,QS=new Yy(!0);const Pf=s=>s,ic=s=>Reflect.getPrototypeOf(s);function e_(s,e,t){return function(...i){const n=this.__v_raw,r=Yt(n),a=mo(r),o=s==="entries"||s===Symbol.iterator&&a,h=s==="keys"&&a,l=n[s](...i),c=t?Pf:e?Ao:tn;return!e&&Ji(r,"iterate",h?Rf:Ma),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 t_(s,e){const t={get(n){const r=this.__v_raw,a=Yt(r),o=Yt(n);s||(An(n,o)&&Ji(a,"get",n),Ji(a,"get",o));const{has:h}=ic(a),l=e?Pf:s?Ao:tn;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&&Ji(Yt(n),"iterate",Ma),n.size},has(n){const r=this.__v_raw,a=Yt(r),o=Yt(n);return s||(An(n,o)&&Ji(a,"has",n),Ji(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=Yt(o),l=e?Pf:s?Ao:tn;return!s&&Ji(h,"iterate",Ma),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=Yt(this),a=ic(r),o=Yt(n),h=!e&&!ws(n)&&!ur(n)?o:n;return a.has.call(r,h)||An(n,h)&&a.has.call(r,n)||An(o,h)&&a.has.call(r,o)||(r.add(h),Kn(r,"add",h,h)),this},set(n,r){!e&&!ws(r)&&!ur(r)&&(r=Yt(r));const a=Yt(this),{has:o,get:h}=ic(a);let l=o.call(a,n);l||(n=Yt(n),l=o.call(a,n));const c=h.call(a,n);return a.set(n,r),l?An(r,c)&&Kn(a,"set",n,r):Kn(a,"add",n,r),this},delete(n){const r=Yt(this),{has:a,get:o}=ic(r);let h=a.call(r,n);h||(n=Yt(n),h=a.call(r,n)),o&&o.call(r,n);const l=r.delete(n);return h&&Kn(r,"delete",n,void 0),l},clear(){const n=Yt(this),r=n.size!==0,a=n.clear();return r&&Kn(n,"clear",void 0,void 0),a}}),["keys","values","entries",Symbol.iterator].forEach(n=>{t[n]=e_(n,s,e)}),t}function sp(s,e){const t=t_(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 i_={get:sp(!1,!1)},s_={get:sp(!1,!0)},n_={get:sp(!0,!1)};const $y=new WeakMap,Gy=new WeakMap,Hy=new WeakMap,r_=new WeakMap;function a_(s){switch(s){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function La(s){return ur(s)?s:np(s,!1,ZS,i_,$y)}function o_(s){return np(s,!1,QS,s_,Gy)}function kf(s){return np(s,!0,JS,n_,Hy)}function np(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=a_(PS(s));if(a===0)return s;const o=new Proxy(s,a===2?i:t);return n.set(s,o),o}function ar(s){return ur(s)?ar(s.__v_raw):!!(s&&s.__v_isReactive)}function ur(s){return!!(s&&s.__v_isReadonly)}function ws(s){return!!(s&&s.__v_isShallow)}function ru(s){return s?!!s.__v_raw:!1}function Yt(s){const e=s&&s.__v_raw;return e?Yt(e):s}function Or(s){return!zt(s,"__v_skip")&&Object.isExtensible(s)&&Ty(s,"__v_skip",!0),s}const tn=s=>qt(s)?La(s):s,Ao=s=>qt(s)?kf(s):s;function _i(s){return s?s.__v_isRef===!0:!1}function ht(s){return l_(s,!1)}function l_(s,e){return _i(s)?s:new c_(s,e)}class c_{constructor(e,t){this.dep=new ip,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=t?e:Yt(e),this._value=t?e:tn(e),this.__v_isShallow=t}get value(){return this.dep.track(),this._value}set value(e){const t=this._rawValue,i=this.__v_isShallow||ws(e)||ur(e);e=i?e:Yt(e),An(e,t)&&(this._rawValue=e,this._value=i?e:tn(e),this.dep.trigger())}}function ke(s){return _i(s)?s.value:s}const h_={get:(s,e,t)=>e==="__v_raw"?s:ke(Reflect.get(s,e,t)),set:(s,e,t,i)=>{const n=s[e];return _i(n)&&!_i(t)?(n.value=t,!0):Reflect.set(s,e,t,i)}};function jy(s){return ar(s)?s:new Proxy(s,h_)}function u_(s){const e=dt(s)?new Array(s.length):{};for(const t in s)e[t]=f_(s,t);return e}class d_{constructor(e,t,i){this._object=e,this._defaultValue=i,this.__v_isRef=!0,this._value=void 0,this._key=Ss(t)?t:String(t),this._raw=Yt(e);let n=!0,r=e;if(!dt(e)||Ss(this._key)||!eu(this._key))do n=!ru(r)||ws(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&&_i(this._raw[this._key])){const t=this._object[this._key];if(_i(t)){t.value=e;return}}this._object[this._key]=e}get dep(){return HS(this._raw,this._key)}}function f_(s,e,t){return new d_(s,e,t)}class m_{constructor(e,t,i){this.fn=e,this.setter=t,this._value=void 0,this.dep=new ip(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=Tl-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!t,this.isSSR=i}notify(){if(this.flags|=16,!(this.flags&8)&&ri!==this)return Oy(this,!0),!0}get value(){const e=this.dep.track();return Dy(this),e&&(e.version=this.dep.version),this._value}set value(e){this.setter&&this.setter(e)}}function p_(s,e,t=!1){let i,n;return _t(s)?i=s:(i=s.get,n=s.set),new m_(i,n,t)}const nc={},sh=new WeakMap;let ca;function g_(s,e=!1,t=ca){if(t){let i=sh.get(t);i||sh.set(t,i=[]),i.push(s)}}function v_(s,e,t=ii){const{immediate:i,deep:n,once:r,scheduler:a,augmentJob:o,call:h}=t,l=w=>n?w:ws(w)||n===!1||n===0?Zn(w,1):Zn(w);let c,u,d,f,p=!1,m=!1;if(_i(s)?(u=()=>s.value,p=ws(s)):ar(s)?(u=()=>l(s),p=!0):dt(s)?(m=!0,p=s.some(w=>ar(w)||ws(w)),u=()=>s.map(w=>{if(_i(w))return w.value;if(ar(w))return l(w);if(_t(w))return h?h(w,2):w()})):_t(s)?e?u=h?()=>h(s,2):s:u=()=>{if(d){cr();try{d()}finally{hr()}}const w=ca;ca=c;try{return h?h(s,3,[f]):s(f)}finally{ca=w}}:u=Pn,e&&n){const w=u,A=n===!0?1/0:n;u=()=>Zn(w(),A)}const g=Py(),v=()=>{c.stop(),g&&g.active&&Zm(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,M)=>An(T,b[M])):An(A,b))){d&&d();const T=ca;ca=c;try{const M=[A,b===nc?void 0:m&&b[0]===nc?[]:b,f];b=A,h?h(e,3,M):e(...M)}finally{ca=T}}}else c.run()};return o&&o(y),c=new ky(u),c.scheduler=a?()=>a(y,!1):y,f=w=>g_(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 Zn(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--,_i(s))Zn(s.value,e,t);else if(dt(s))for(let i=0;i<s.length;i++)Zn(s[i],e,t);else if(Oo(s)||mo(s))s.forEach(i=>{Zn(i,e,t)});else if(_y(s)){for(const i in s)Zn(s[i],e,t);for(const i of Object.getOwnPropertySymbols(s))Object.prototype.propertyIsEnumerable.call(s,i)&&Zn(s[i],e,t)}return s}/**
|
||
* @vue/runtime-core v3.5.41
|
||
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
||
* @license MIT
|
||
**/function $l(s,e,t,i){try{return i?s(...i):s()}catch(n){au(n,e,t)}}function Os(s,e,t,i){if(_t(s)){const n=$l(s,e,t,i);return n&&wy(n)&&n.catch(r=>{au(r,e,t)}),n}if(dt(s)){const n=[];for(let r=0;r<s.length;r++)n.push(Os(s[r],e,t,i));return n}}function au(s,e,t,i=!0){const n=e?e.vnode:null,{errorHandler:r,throwUnhandledErrorInProduction:a}=e&&e.appContext.config||ii;if(e){let o=e.parent;const h=e.proxy,l=`https://vuejs.org/error-reference/#runtime-${t}`;for(;o;){const c=o.ec;if(c){for(let u=0;u<c.length;u++)if(c[u](s,h,l)===!1)return}o=o.parent}if(r){cr(),$l(r,null,10,[s,h,l]),hr();return}}y_(s,t,n,i,a)}function y_(s,e,t,i=!0,n=!1){if(n)throw s;console.error(s)}const ns=[];let vn=-1;const po=[];let Mr=null,eo=0;const Wy=Promise.resolve();let nh=null;function ou(s){const e=nh||Wy;return s?e.then(this?s.bind(this):s):e}function x_(s){let e=vn+1,t=ns.length;for(;e<t;){const i=e+t>>>1,n=ns[i],r=El(n);r<s||r===s&&n.flags&2?e=i+1:t=i}return e}function rp(s){if(!(s.flags&1)){const e=El(s),t=ns[ns.length-1];!t||!(s.flags&2)&&e>=El(t)?ns.push(s):ns.splice(x_(e),0,s),s.flags|=1,zy()}}function zy(){nh||(nh=Wy.then(Ky))}function b_(s){if(!dt(s))Mr&&s.id===-1?Mr.splice(eo+1,0,s):s.flags&1||(po.push(s),s.flags|=1);else for(let e=0;e<s.length;e++)po.push(s[e]);zy()}function Wp(s,e,t=vn+1){for(;t<ns.length;t++){const i=ns[t];if(i&&i.flags&2){if(s&&i.id!==s.uid)continue;ns.splice(t,1),t--,i.flags&4&&(i.flags&=-2),i(),i.flags&4||(i.flags&=-2)}}}function qy(s){if(po.length){const e=[...new Set(po)].sort((t,i)=>El(t)-El(i));if(po.length=0,Mr){for(let t=0;t<e.length;t++)Mr.push(e[t]);return}for(Mr=e,eo=0;eo<Mr.length;eo++){const t=Mr[eo];t.flags&4&&(t.flags&=-2),t.flags&8||t(),t.flags&=-2}Mr=null,eo=0}}const El=s=>s.id==null?s.flags&2?-1:1/0:s.id;function Ky(s){try{for(vn=0;vn<ns.length;vn++){const e=ns[vn];e&&!(e.flags&8)&&(e.flags&4&&(e.flags&=-2),$l(e,e.i,e.i?15:14),e.flags&4||(e.flags&=-2))}}finally{for(;vn<ns.length;vn++){const e=ns[vn];e&&(e.flags&=-2)}vn=-1,ns.length=0,qy(),nh=null,(ns.length||po.length)&&Ky()}}let ts=null,Zy=null;function rh(s){const e=ts;return ts=s,Zy=s&&s.type.__scopeId||null,e}function ah(s,e=ts,t){if(!e||s._n)return s;const i=(...n)=>{i._d&&hh(-1);const r=rh(e),a=or.length;let o;try{o=s(...n)}finally{for(let h=or.length;h>a;h--)cp();rh(r),i._d&&hh(1)}return o};return i._n=!0,i._c=!0,i._d=!0,i}function xe(s,e){if(ts===null)return s;const t=mu(ts),i=s.dirs||(s.dirs=[]);for(let n=0;n<e.length;n++){let[r,a,o,h=ii]=e[n];r&&(_t(r)&&(r={mounted:r,updated:r}),r.deep&&Zn(a),i.push({dir:r,instance:t,value:a,oldValue:void 0,arg:o,modifiers:h}))}return s}function ta(s,e,t,i){const n=s.dirs,r=e&&e.dirs;for(let a=0;a<n.length;a++){const o=n[a];r&&(o.oldValue=r[a].value);let h=o.dir[i];h&&(cr(),Os(h,t,8,[s.el,o,s,e]),hr())}}function w_(s,e){if(rs){let t=rs.provides;const i=rs.parent&&rs.parent.provides;i===t&&(t=rs.provides=Object.create(i)),t[s]=e}}function fl(s,e,t=!1){const i=hp();if(i||Ta){let n=Ta?Ta._context.provides:i?i.parent==null||i.ce?i.vnode.appContext&&i.vnode.appContext.provides:i.parent.provides:void 0;if(n&&s in n)return n[s];if(arguments.length>1)return t&&_t(e)?e.call(i&&i.proxy):e}}function S_(){return!!(hp()||Ta)}const __=Symbol.for("v-scx"),M_=()=>fl(__);function Qo(s,e){return ap(s,null,e)}function cs(s,e,t){return ap(s,e,t)}function ap(s,e,t=ii){const{immediate:i,deep:n,flush:r,once:a}=t,o=Oi({},t),h=e&&i||!e&&r!=="post";let l;if(kl){if(r==="sync"){const f=M_();l=f.__watcherHandles||(f.__watcherHandles=[])}else if(!h){const f=()=>{};return f.stop=Pn,f.resume=Pn,f.pause=Pn,f}}const c=rs;o.call=(f,p,m)=>Os(f,c,p,m);let u=!1;r==="post"?o.scheduler=f=>{hs(f,c&&c.suspense)}:r!=="sync"&&(u=!0,o.scheduler=(f,p)=>{p?f():rp(f)}),o.augmentJob=f=>{e&&(f.flags|=4),u&&(f.flags|=2,c&&(f.id=c.uid,f.i=c))};const d=v_(s,e,o);return kl&&(l?l.push(d):h&&d()),d}function T_(s,e,t){const i=this.proxy,n=gi(s)?s.includes(".")?Jy(i,s):()=>i[s]:s.bind(i,i);let r;_t(e)?r=e:(r=e.handler,t=e);const a=Hl(this),o=ap(n,r.bind(i),t);return a(),o}function Jy(s,e){const t=e.split(".");return()=>{let i=s;for(let n=0;n<t.length&&i;n++)i=i[t[n]];return i}}const A_=Symbol("_vte"),lu=s=>s.__isTeleport,Rs=Symbol("_leaveCb"),Go=Symbol("_enterCb");function E_(){const s={isMounted:!1,isLeaving:!1,isUnmounting:!1,leavingVNodes:new Map};return Da(()=>{s.isMounted=!0}),uu(()=>{s.isUnmounting=!0}),s}const As=[Function,Array],Qy={mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:As,onEnter:As,onAfterEnter:As,onEnterCancelled:As,onBeforeLeave:As,onLeave:As,onAfterLeave:As,onLeaveCancelled:As,onBeforeAppear:As,onAppear:As,onAfterAppear:As,onAppearCancelled:As},ex=s=>{const e=s.subTree;return e.component?ex(e.component):e},C_={name:"BaseTransition",props:Qy,setup(s,{slots:e}){const t=hp(),i=E_();return()=>{const n=e.default&&sx(e.default(),!0),r=n&&n.length?tx(n):t.subTree?Ue():void 0;if(!r)return;const a=Yt(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!==es&&Cl(h,l);let c=t.subTree&&oh(t.subTree);if(c&&c.type!==es&&!pa(c,h)&&ex(t).type!==es){let u=Ff(c,a,i,t);if(Cl(c,u),o==="out-in"&&h.type!==es)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!==es?u.delayLeave=(d,f,p)=>{const m=ix(i,c);m[String(c.key)]=c,d[Rs]=()=>{f(),d[Rs]=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 tx(s){let e=s[0];if(s.length>1){for(const t of s)if(t.type!==es){e=t;break}}return e}const I_=C_;function ix(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=ix(t,s),T=(P,F)=>{P&&Os(P,i,9,F)},M=(P,F)=>{const I=F[1];T(P,F),dt(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[Rs]&&P[Rs](!0);const I=A[w];I&&pa(s,I)&&I.el[Rs]&&I.el[Rs](),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 O=!1;P[Go]=U=>{O||(O=!0,U?T(k,[P]):T(I,[P]),R.delayedLeave&&R.delayedLeave(),P[Go]=void 0)};const L=P[Go].bind(null,!1);F?M(F,[P,L]):L()},leave(P,F){const I=String(s.key);if(P[Go]&&P[Go](!0),t.isUnmounting)return F();T(d,[P]);let k=!1;P[Rs]=L=>{k||(k=!0,F(),L?T(m,[P]):T(p,[P]),P[Rs]=void 0,A[I]===s&&delete A[I])};const O=P[Rs].bind(null,!1);A[I]=s,f?M(f,[P,O]):O()},clone(P){const F=Ff(P,e,t,i,n);return n&&n(F),F}};return R}function Uu(s){if(cu(s))return s=Yr(s),s.children=null,s}function oh(s){if(!cu(s))return lu(s.type)&&s.children?tx(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&&_t(t.default))return t.default()}}function Cl(s,e){if(s.shapeFlag&6&&s.component){s.transition=e;const t=s.component.subTree;Cl(lu(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 sx(s,e=!1,t){let i=[],n=0;for(let r=0;r<s.length;r++){let a=s[r];const o=t==null?a.key:String(t)+String(a.key!=null?a.key:r);a.type===Ke?(a.patchFlag&128&&n++,i=i.concat(sx(a.children,e,o))):(e||a.type!==es)&&i.push(o!=null?Yr(a,{key:o}):a)}if(n>1)for(let r=0;r<i.length;r++)i[r].patchFlag=-2;return i}function sn(s,e){return _t(s)?Oi({name:s.name},e,{setup:s}):s}function nx(s){s.ids=[s.ids[0]+s.ids[2]+++"-",0,0]}function zp(s,e){let t;return!!((t=Object.getOwnPropertyDescriptor(s,e))&&!t.configurable)}const lh=new WeakMap;function ml(s,e,t,i,n=!1){if(dt(s)){s.forEach((m,g)=>ml(m,e&&(dt(e)?e[g]:e),t,i,n));return}if(go(i)&&!n){i.shapeFlag&512&&i.type.__asyncResolved&&i.component.subTree.component&&ml(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===ii?o.refs={}:o.refs,u=o.setupState,d=Yt(u),f=u===ii?by:m=>zp(c,m)?!1:zt(d,m),p=(m,g)=>!(g&&zp(c,g));if(l!=null&&l!==h){if(qp(e),gi(l))c[l]=null,f(l)&&(u[l]=null);else if(_i(l)){const m=e;p(l,m.k)&&(l.value=null),m.k&&(c[m.k]=null)}}if(_t(h))$l(h,o,12,[a,c]);else{const m=gi(h),g=_i(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)dt(b)&&Zm(b,r);else if(dt(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),hs(b,t)}else qp(s),v()}}}function qp(s){const e=lh.get(s);e&&(e.flags|=8,lh.delete(s))}su().requestIdleCallback;su().cancelIdleCallback;const go=s=>!!s.type.__asyncLoader,cu=s=>s.type.__isKeepAlive;function R_(s,e){rx(s,"a",e)}function P_(s,e){rx(s,"da",e)}function rx(s,e,t=rs){const i=s.__wdc||(s.__wdc=()=>{let n=t;for(;n;){if(n.isDeactivated)return;n=n.parent}return s()});if(hu(e,i,t),t){let n=t.parent;for(;n&&n.parent;)cu(n.parent.vnode)&&k_(i,e,t,n),n=n.parent}}function k_(s,e,t,i){const n=hu(e,s,i,!0);Gl(()=>{Zm(i[e],n)},t)}function hu(s,e,t=rs,i=!1){if(t){const n=t[s]||(t[s]=[]),r=e.__weh||(e.__weh=(...a)=>{cr();const o=Hl(t),h=Os(e,t,s,a);return o(),hr(),h});return i?n.unshift(r):n.push(r),r}}const gr=s=>(e,t=rs)=>{(!kl||s==="sp")&&hu(s,(...i)=>e(...i),t)},F_=gr("bm"),Da=gr("m"),O_=gr("bu"),B_=gr("u"),uu=gr("bum"),Gl=gr("um"),L_=gr("sp"),D_=gr("rtg"),N_=gr("rtc");function U_(s,e=rs){hu("ec",s,e)}const X_=Symbol.for("v-ndc");function ci(s,e,t,i){let n;const r=t,a=dt(s);if(a||gi(s)){const o=a&&ar(s);let h=!1,l=!1;o&&(h=!ws(s),l=ur(s),s=nu(s)),n=new Array(s.length);for(let c=0,u=s.length;c<u;c++)n[c]=e(h?l?Ao(tn(s[c])):tn(s[c]):s[c],c,void 0,r)}else if(typeof s=="number"){n=new Array(s);for(let o=0;o<s;o++)n[o]=e(o+1,o,void 0,r)}else if(qt(s))if(s[Symbol.iterator])n=Array.from(s,(o,h)=>e(o,h,void 0,r));else{const o=Object.keys(s);n=new Array(o.length);for(let h=0,l=o.length;h<l;h++){const c=o[h];n[h]=e(s[c],c,h,r)}}else n=[];return n}function V_(s,e,t,i,n,r){if(t==null&&(t={}),ts.ce||ts.parent&&go(ts.parent)&&ts.parent.ce){const l=t,c=Object.keys(l).length>0;return te(),Qt(Ke,null,[Ne("slot",l,i)],c?-2:64)}let a=s[e];a&&a._c&&(a._d=!1);const o=or.length;te();let h;try{const l=a&&ax(a(t)),c=t.key||r||l&&l.key;h=Qt(Ke,{key:(c&&!Ss(c)?c:`_${e}`)+(!l&&i?"_fb":"")},l||(i?i():[]),l&&s._===1?64:-2)}catch(l){for(let c=or.length;c>o;c--)cp();throw l}finally{a&&a._c&&(a._d=!0)}return h}function ax(s){return s.some(e=>Rl(e)?!(e.type===es||e.type===Ke&&!ax(e.children)):!0)?s:null}const Of=s=>s?Ax(s)?mu(s):Of(s.parent):null,pl=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=>lx(s),$forceUpdate:s=>s.f||(s.f=()=>{rp(s.update)}),$nextTick:s=>s.n||(s.n=ou.bind(s.proxy)),$watch:s=>T_.bind(s)}),Xu=(s,e)=>s!==ii&&!s.__isScriptSetup&&zt(s,e),Y_={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!==ii&&zt(n,e))return a[e]=2,n[e];if(zt(r,e))return a[e]=3,r[e];if(t!==ii&&zt(t,e))return a[e]=4,t[e];Bf&&(a[e]=0)}}const l=pl[e];let c,u;if(l)return e==="$attrs"&&Ji(s.attrs,"get",""),l(s);if((c=o.__cssModules)&&(c=c[e]))return c;if(t!==ii&&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!==ii&&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!==ii&&o[0]!=="$"&&zt(s,o)||Xu(e,o)||zt(r,o)||zt(i,o)||zt(pl,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 Kp(s){return dt(s)?s.reduce((e,t)=>(e[t]=null,e),{}):s}let Bf=!0;function $_(s){const e=lx(s),t=s.proxy,i=s.ctx;Bf=!1,e.beforeCreate&&Zp(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:M,errorCaptured:R,serverPrefetch:P,expose:F,inheritAttrs:I,components:k,directives:O,filters:L}=e;if(l&&G_(l,i,null),a)for(const D in a){const _=a[D];_t(_)&&(i[D]=_.bind(t))}if(n){const D=n.call(t,t);qt(D)&&(s.data=La(D))}if(Bf=!0,r)for(const D in r){const _=r[D],X=_t(_)?_.bind(t,t):_t(_.get)?_.get.bind(t,t):Pn,N=!_t(_)&&_t(_.set)?_.set.bind(t):Pn,V=pt({get:X,set:N});Object.defineProperty(i,D,{enumerable:!0,configurable:!0,get:()=>V.value,set:G=>V.value=G})}if(o)for(const D in o)ox(o[D],i,t,D);if(h){const D=_t(h)?h.call(t):h;Reflect.ownKeys(D).forEach(_=>{w_(_,D[_])})}c&&Zp(c,s,"c");function B(D,_){dt(_)?_.forEach(X=>D(X.bind(t))):_&&D(_.bind(t))}if(B(F_,u),B(Da,d),B(O_,f),B(B_,p),B(R_,m),B(P_,g),B(U_,R),B(N_,T),B(D_,M),B(uu,b),B(Gl,w),B(L_,P),dt(F))if(F.length){const D=s.exposed||(s.exposed={});F.forEach(_=>{Object.defineProperty(D,_,{get:()=>t[_],set:X=>t[_]=X,enumerable:!0})})}else s.exposed||(s.exposed={});A&&s.render===Pn&&(s.render=A),I!=null&&(s.inheritAttrs=I),k&&(s.components=k),O&&(s.directives=O),P&&nx(s)}function G_(s,e,t=Pn){dt(s)&&(s=Lf(s));for(const i in s){const n=s[i];let r;qt(n)?"default"in n?r=fl(n.from||i,n.default,!0):r=fl(n.from||i):r=fl(n),_i(r)?Object.defineProperty(e,i,{enumerable:!0,configurable:!0,get:()=>r.value,set:a=>r.value=a}):e[i]=r}}function Zp(s,e,t){Os(dt(s)?s.map(i=>i.bind(e.proxy)):s.bind(e.proxy),e,t)}function ox(s,e,t,i){let n=i.includes(".")?Jy(t,i):()=>t[i];if(gi(s)){const r=e[s];_t(r)&&cs(n,r)}else if(_t(s))cs(n,s.bind(t));else if(qt(s))if(dt(s))s.forEach(r=>ox(r,e,t,i));else{const r=_t(s.handler)?s.handler.bind(t):e[s.handler];_t(r)&&cs(n,r,s)}}function lx(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=H_[a]||t&&t[a];s[a]=o?o(s[a],e[a]):e[a]}return s}const H_={data:Jp,props:Qp,emits:Qp,methods:el,computed:el,beforeCreate:is,created:is,beforeMount:is,mounted:is,beforeUpdate:is,updated:is,beforeDestroy:is,beforeUnmount:is,destroyed:is,unmounted:is,activated:is,deactivated:is,errorCaptured:is,serverPrefetch:is,components:el,directives:el,watch:W_,provide:Jp,inject:j_};function Jp(s,e){return e?s?function(){return Oi(_t(s)?s.call(this,this):s,_t(e)?e.call(this,this):e)}:e:s}function j_(s,e){return el(Lf(s),Lf(e))}function Lf(s){if(dt(s)){const e={};for(let t=0;t<s.length;t++)e[s[t]]=s[t];return e}return s}function is(s,e){return s?[...new Set([].concat(s,e))]:e}function el(s,e){return s?Oi(Object.create(null),s,e):e}function Qp(s,e){return s?dt(s)&&dt(e)?[...new Set([...s,...e])]:Oi(Object.create(null),Kp(s),Kp(e??{})):e}function W_(s,e){if(!s)return e;if(!e)return s;const t=Oi(Object.create(null),s);for(const i in e)t[i]=is(s[i],e[i]);return t}function cx(){return{app:null,config:{isNativeTag:by,performance:!1,globalProperties:{},optionMergeStrategies:{},errorHandler:void 0,warnHandler:void 0,compilerOptions:{}},mixins:[],components:{},directives:{},provides:Object.create(null),optionsCache:new WeakMap,propsCache:new WeakMap,emitsCache:new WeakMap}}let z_=0;function q_(s,e){return function(i,n=null){_t(i)||(i=Oi({},i)),n!=null&&!qt(n)&&(n=null);const r=cx(),a=new WeakSet,o=[];let h=!1;const l=r.app={_uid:z_++,_component:i,_props:n,_container:null,_context:r,_instance:null,version:AM,get config(){return r.config},set config(c){},use(c,...u){return a.has(c)||(c&&_t(c.install)?(a.add(c),c.install(l,...u)):_t(c)&&(a.add(c),c(l,...u))),l},mixin(c){return r.mixins.includes(c)||r.mixins.push(c),l},component(c,u){return u?(r.components[c]=u,l):r.components[c]},directive(c,u){return u?(r.directives[c]=u,l):r.directives[c]},mount(c,u,d){if(!h){const f=l._ceVNode||Ne(i,n);return f.appContext=r,d===!0?d="svg":d===!1&&(d=void 0),s(f,c,d),h=!0,l._container=c,c.__vue_app__=l,mu(f.component)}},onUnmount(c){o.push(c)},unmount(){h&&(Os(o,l._instance,16),s(null,l._container),delete l._container.__vue_app__)},provide(c,u){return r.provides[c]=u,l},runWithContext(c){const u=Ta;Ta=l;try{return c()}finally{Ta=u}}};return l}}let Ta=null;const K_=(s,e)=>e==="modelValue"||e==="model-value"?s.modelModifiers:s[`${e}Modifiers`]||s[`${qs(e)}Modifiers`]||s[`${jr(e)}Modifiers`];function Z_(s,e,...t){if(s.isUnmounted)return;const i=s.vnode.props||ii;let n=t;const r=e.startsWith("update:"),a=r&&K_(i,e.slice(7));a&&(a.trim&&(n=t.map(c=>gi(c)?c.trim():c)),a.number&&(n=t.map(iu)));let o,h=i[o=Ou(e)]||i[o=Ou(qs(e))];!h&&r&&(h=i[o=Ou(jr(e))]),h&&Os(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,Os(l,s,6,n)}}const J_=new WeakMap;function hx(s,e,t=!1){const i=t?J_:e.emitsCache,n=i.get(s);if(n!==void 0)return n;const r=s.emits;let a={},o=!1;if(!_t(s)){const h=l=>{const c=hx(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):(dt(r)?r.forEach(h=>a[h]=null):Oi(a,r),qt(s)&&i.set(s,a),a)}function du(s,e){return!s||!Jh(e)?!1:(e=e.slice(2),e=e==="Once"?e:e.replace(/Once$/,""),zt(s,e[0].toLowerCase()+e.slice(1))||zt(s,jr(e))||zt(s,e))}function eg(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=Mn(l.call(A,w,c,u,f,d,p)),b=o}else{const w=e;v=Mn(w.length>1?w(u,{attrs:o,slots:a,emit:h}):w(u,null)),b=e.props?o:Q_(o)}}catch(w){or.length=0,au(w,s,1),v=Ne(es)}let y=v;if(b&&m!==!1){const w=Object.keys(b),{shapeFlag:A}=y;w.length&&A&7&&(r&&w.some(Qh)&&(b=eM(b,r)),y=Yr(y,b,!1,!0))}if(t.dirs&&(y=Yr(y,null,!1,!0),y.dirs=y.dirs?y.dirs.concat(t.dirs):t.dirs),t.transition){const w=lu(y.type)&&oh(y)||y;Cl(w,t.transition)}return v=y,rh(g),v}const Q_=s=>{let e;for(const t in s)(t==="class"||t==="style"||Jh(t))&&((e||(e={}))[t]=s[t]);return e},eM=(s,e)=>{const t={};for(const i in s)(!Qh(i)||!(i.slice(9)in e))&&(t[i]=s[i]);return t};function tM(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?tg(i,a,l):!!a;if(h&8){const c=e.dynamicProps;for(let u=0;u<c.length;u++){const d=c[u];if(ux(a,i,d)&&!du(l,d))return!0}}}else return(n||o)&&(!o||!o.$stable)?!0:i===a?!1:i?a?tg(i,a,l):!0:!!a;return!1}function tg(s,e,t){const i=Object.keys(e);if(i.length!==Object.keys(s).length)return!0;for(let n=0;n<i.length;n++){const r=i[n];if(ux(e,s,r)&&!du(t,r))return!0}return!1}function ux(s,e,t){const i=s[t],n=e[t];return t==="style"&&qt(i)&&qt(n)?!Bo(i,n):i!==n}function iM({vnode:s,parent:e,suspense:t},i){for(;e;){const n=e.subTree;if(n.suspense&&n.suspense.activeBranch===s&&(n.suspense.vnode.el=n.el=i,s=n),n===s)(s=e.vnode).el=i,e=e.parent;else break}t&&t.activeBranch===s&&(t.vnode.el=i)}const dx={},fx=()=>Object.create(dx),mx=s=>Object.getPrototypeOf(s)===dx;function sM(s,e,t,i=!1){const n={},r=fx();s.propsDefaults=Object.create(null),px(s,e,n,r);for(const a in s.propsOptions[0])a in n||(n[a]=void 0);t?s.props=i?n:o_(n):s.type.props?s.props=n:s.props=r,s.attrs=r}function nM(s,e,t,i){const{props:n,attrs:r,vnode:{patchFlag:a}}=s,o=Yt(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<c.length;u++){let d=c[u];if(du(s.emitsOptions,d))continue;const f=e[d];if(h)if(zt(r,d))f!==r[d]&&(r[d]=f,l=!0);else{const p=qs(d);n[p]=Df(h,o,p,f,s,!1)}else f!==r[d]&&(r[d]=f,l=!0)}}}else{px(s,e,n,r)&&(l=!0);let c;for(const u in o)(!e||!zt(e,u)&&((c=jr(u))===u||!zt(e,c)))&&(h?t&&(t[u]!==void 0||t[c]!==void 0)&&(n[u]=Df(h,o,u,void 0,s,!0)):delete n[u]);if(r!==o)for(const u in r)(!e||!zt(e,u))&&(delete r[u],l=!0)}l&&Kn(s.attrs,"set","")}function px(s,e,t,i){const[n,r]=s.propsOptions;let a=!1,o;if(e)for(let h in e){if(hl(h))continue;const l=e[h];let c;n&&zt(n,c=qs(h))?!r||!r.includes(c)?t[c]=l:(o||(o={}))[c]=l:du(s.emitsOptions,h)||(!(h in i)||l!==i[h])&&(i[h]=l,a=!0)}if(r){const h=Yt(t),l=o||ii;for(let c=0;c<r.length;c++){const u=r[c];t[u]=Df(n,h,u,l[u],s,!zt(l,u))}}return a}function Df(s,e,t,i,n,r){const a=s[t];if(a!=null){const o=zt(a,"default");if(o&&i===void 0){const h=a.default;if(a.type!==Function&&!a.skipFactory&&_t(h)){const{propsDefaults:l}=n;if(t in l)i=l[t];else{const c=Hl(n);i=l[t]=h.call(null,e),c()}}else i=h;n.ce&&n.ce._setProp(t,i)}a[0]&&(r&&!o?i=!1:a[1]&&(i===""||i===jr(t))&&(i=!0))}return i}const rM=new WeakMap;function gx(s,e,t=!1){const i=t?rM:e.propsCache,n=i.get(s);if(n)return n;const r=s.props,a={},o=[];let h=!1;if(!_t(s)){const c=u=>{h=!0;const[d,f]=gx(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(dt(r))for(let c=0;c<r.length;c++){const u=qs(r[c]);ig(u)&&(a[u]=ii)}else if(r)for(const c in r){const u=qs(c);if(ig(u)){const d=r[c],f=a[u]=dt(d)||_t(d)?{type:d}:Oi({},d),p=f.type;let m=!1,g=!0;if(dt(p))for(let v=0;v<p.length;++v){const b=p[v],y=_t(b)&&b.name;if(y==="Boolean"){m=!0;break}else y==="String"&&(g=!1)}else m=_t(p)&&p.name==="Boolean";f[0]=m,f[1]=g,(m||zt(f,"default"))&&o.push(u)}}const l=[a,o];return qt(s)&&i.set(s,l),l}function ig(s){return s[0]!=="$"&&!hl(s)}const op=s=>s==="_"||s==="_ctx"||s==="$stable",lp=s=>dt(s)?s.map(Mn):[Mn(s)],aM=(s,e,t)=>{if(e._n)return e;const i=ah((...n)=>lp(e(...n)),t);return i._c=!1,i},vx=(s,e,t)=>{const i=s._ctx;for(const n in s){if(op(n))continue;const r=s[n];if(_t(r))e[n]=aM(n,r,i);else if(r!=null){const a=lp(r);e[n]=()=>a}}},yx=(s,e)=>{const t=lp(e);s.slots.default=()=>t},xx=(s,e,t)=>{for(const i in e)(t||!op(i))&&(s[i]=e[i])},oM=(s,e,t)=>{const i=s.slots=fx();if(s.vnode.shapeFlag&32){const n=e._;n?(xx(i,e,t),t&&Ty(i,"_",n,!0)):vx(e,i)}else e&&yx(s,e)},lM=(s,e,t)=>{const{vnode:i,slots:n}=s;let r=!0,a=ii;if(i.shapeFlag&32){const o=e._;o?t&&o===1?r=!1:xx(n,e,t):(r=!e.$stable,vx(e,n)),a=e}else e&&(yx(s,e),a={default:1});if(r)for(const o in n)!op(o)&&a[o]==null&&delete n[o]},hs=fM;function cM(s){return hM(s)}function hM(s,e){const t=su();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=Pn,insertStaticContent:p}=s,m=(H,K,q,z=null,ee=null,le=null,ve=void 0,re=null,ye=!!K.dynamicChildren)=>{if(H===K)return;H&&!pa(H,K)&&(z=me(H),G(H,ee,le,!0),H=null),K.patchFlag===-2&&(ye=!1,K.dynamicChildren=null);const{type:he,ref:Xe,shapeFlag:Pe}=K;switch(he){case fu:g(H,K,q,z);break;case es:v(H,K,q,z);break;case Xc:H==null&&b(K,q,z,ve);break;case Ke:k(H,K,q,z,ee,le,ve,re,ye);break;default:Pe&1?A(H,K,q,z,ee,le,ve,re,ye):Pe&6?O(H,K,q,z,ee,le,ve,re,ye):(Pe&64||Pe&128)&&he.process(H,K,q,z,ee,le,ve,re,ye,ge)}Xe!=null&&ee?ml(Xe,H&&H.ref,le,K||H,!K):Xe==null&&H&&H.ref!=null&&ml(H.ref,null,le,H,!0)},g=(H,K,q,z)=>{if(H==null)i(K.el=o(K.children),q,z);else{const ee=K.el=H.el;K.children!==H.children&&l(ee,K.children)}},v=(H,K,q,z)=>{H==null?i(K.el=h(K.children||""),q,z):K.el=H.el},b=(H,K,q,z)=>{[H.el,H.anchor]=p(H.children,K,q,z,H.el,H.anchor)},y=({el:H,anchor:K},q,z)=>{let ee;for(;H&&H!==K;)ee=d(H),i(H,q,z),H=ee;i(K,q,z)},w=({el:H,anchor:K})=>{let q;for(;H&&H!==K;)q=d(H),n(H),H=q;n(K)},A=(H,K,q,z,ee,le,ve,re,ye)=>{if(K.type==="svg"?ve="svg":K.type==="math"&&(ve="mathml"),H==null)T(K,q,z,ee,le,ve,re,ye);else{const he=H.el&&H.el._isVueCE?H.el:null;try{he&&he._beginPatch(),P(H,K,ee,le,ve,re,ye)}finally{he&&he._endPatch()}}},T=(H,K,q,z,ee,le,ve,re)=>{let ye,he;const{props:Xe,shapeFlag:Pe,transition:Oe,dirs:it}=H;if(ye=H.el=a(H.type,le,Xe&&Xe.is,Xe),Pe&8?c(ye,H.children):Pe&16&&R(H.children,ye,null,z,ee,Vu(H,le),ve,re),it&&ta(H,null,z,"created"),M(ye,H,H.scopeId,ve,z),Xe){for(const Ct in Xe)Ct!=="value"&&!hl(Ct)&&r(ye,Ct,null,Xe[Ct],le,z);"value"in Xe&&r(ye,"value",null,Xe.value,le),(he=Xe.onVnodeBeforeMount)&&hn(he,z,H)}it&&ta(H,null,z,"beforeMount");const bt=uM(ee,Oe);bt&&Oe.beforeEnter(ye),i(ye,K,q),((he=Xe&&Xe.onVnodeMounted)||bt||it)&&hs(()=>{try{he&&hn(he,z,H),bt&&Oe.enter(ye),it&&ta(H,null,z,"mounted")}finally{}},ee)},M=(H,K,q,z,ee)=>{if(q&&f(H,q),z)for(let le=0;le<z.length;le++)f(H,z[le]);if(ee){let le=ee.subTree;if(K===le||_x(le.type)&&(le.ssContent===K||le.ssFallback===K)){const ve=ee.vnode;M(H,ve,ve.scopeId,ve.slotScopeIds,ee.parent)}}},R=(H,K,q,z,ee,le,ve,re,ye=0)=>{for(let he=ye;he<H.length;he++){const Xe=H[he]=re?qn(H[he]):Mn(H[he]);m(null,Xe,K,q,z,ee,le,ve,re)}},P=(H,K,q,z,ee,le,ve)=>{const re=K.el=H.el;let{patchFlag:ye,dynamicChildren:he,dirs:Xe}=K;ye|=H.patchFlag&16;const Pe=H.props||ii,Oe=K.props||ii;let it;if(q&&ia(q,!1),(it=Oe.onVnodeBeforeUpdate)&&hn(it,q,K,H),Xe&&ta(K,H,q,"beforeUpdate"),q&&ia(q,!0),he&&(!H.dynamicChildren||H.dynamicChildren.length!==he.length)&&(ye=0,ve=!1,he=null),(Pe.innerHTML&&Oe.innerHTML==null||Pe.textContent&&Oe.textContent==null)&&c(re,""),he?F(H.dynamicChildren,he,re,q,z,Vu(K,ee),le):ve||_(H,K,re,null,q,z,Vu(K,ee),le,!1),ye>0){if(ye&16)I(re,Pe,Oe,q,ee);else if(ye&2&&Pe.class!==Oe.class&&r(re,"class",null,Oe.class,ee),ye&4&&r(re,"style",Pe.style,Oe.style,ee),ye&8){const bt=K.dynamicProps;for(let Ct=0;Ct<bt.length;Ct++){const wt=bt[Ct],Et=Pe[wt],Kt=Oe[wt];(Kt!==Et||wt==="value")&&r(re,wt,Et,Kt,ee,q)}}ye&1&&H.children!==K.children&&c(re,K.children)}else!ve&&he==null&&I(re,Pe,Oe,q,ee);((it=Oe.onVnodeUpdated)||Xe)&&hs(()=>{it&&hn(it,q,K,H),Xe&&ta(K,H,q,"updated")},z)},F=(H,K,q,z,ee,le,ve)=>{for(let re=0;re<K.length;re++){const ye=H[re],he=K[re],Xe=ye.el&&(ye.type===Ke||!pa(ye,he)||ye.shapeFlag&198)?u(ye.el):q;m(ye,he,Xe,null,z,ee,le,ve,!0)}},I=(H,K,q,z,ee)=>{if(K!==q){if(K!==ii)for(const le in K)!hl(le)&&!(le in q)&&r(H,le,K[le],null,ee,z);for(const le in q){if(hl(le))continue;const ve=q[le],re=K[le];ve!==re&&le!=="value"&&r(H,le,re,ve,ee,z)}"value"in q&&r(H,"value",K.value,q.value,ee)}},k=(H,K,q,z,ee,le,ve,re,ye)=>{const he=K.el=H?H.el:o(""),Xe=K.anchor=H?H.anchor:o("");let{patchFlag:Pe,dynamicChildren:Oe,slotScopeIds:it}=K;it&&(re=re?re.concat(it):it),H==null?(i(he,q,z),i(Xe,q,z),R(K.children||[],q,Xe,ee,le,ve,re,ye)):Pe>0&&Pe&64&&Oe&&H.dynamicChildren&&H.dynamicChildren.length===Oe.length?(F(H.dynamicChildren,Oe,q,ee,le,ve,re),(K.key!=null||ee&&K===ee.subTree)&&bx(H,K,!0)):_(H,K,q,Xe,ee,le,ve,re,ye)},O=(H,K,q,z,ee,le,ve,re,ye)=>{K.slotScopeIds=re,H==null?K.shapeFlag&512?ee.ctx.activate(K,q,z,ve,ye):L(K,q,z,ee,le,ve,ye):U(H,K,ye)},L=(H,K,q,z,ee,le,ve)=>{const re=H.component=xM(H,z,ee);if(cu(H)&&(re.ctx.renderer=ge),bM(re,!1,ve),re.asyncDep){if(ee&&ee.registerDep(re,B,ve),!H.el){const ye=re.subTree=Ne(es);v(null,ye,K,q),H.placeholder=ye.el}}else B(re,H,K,q,ee,le,ve)},U=(H,K,q)=>{const z=K.component=H.component;if(tM(H,K,q))if(z.asyncDep&&!z.asyncResolved){D(z,K,q);return}else z.next=K,z.update();else K.el=H.el,z.vnode=K},B=(H,K,q,z,ee,le,ve)=>{const re=()=>{if(H.isMounted){let{next:Pe,bu:Oe,u:it,parent:bt,vnode:Ct}=H;{const Bi=wx(H);if(Bi){Pe&&(Pe.el=Ct.el,D(H,Pe,ve)),Bi.asyncDep.then(()=>{hs(()=>{H.isUnmounted||he()},ee)});return}}let wt=Pe,Et;ia(H,!1),Pe?(Pe.el=Ct.el,D(H,Pe,ve)):Pe=Ct,Oe&&Uc(Oe),(Et=Pe.props&&Pe.props.onVnodeBeforeUpdate)&&hn(Et,bt,Pe,Ct),ia(H,!0);const Kt=eg(H),yi=H.subTree;H.subTree=Kt,m(yi,Kt,u(yi.el),me(yi),H,ee,le),Pe.el=Kt.el,wt===null&&iM(H,Kt.el),it&&hs(it,ee),(Et=Pe.props&&Pe.props.onVnodeUpdated)&&hs(()=>hn(Et,bt,Pe,Ct),ee)}else{let Pe;const{el:Oe,props:it}=K,{bm:bt,m:Ct,parent:wt,root:Et,type:Kt}=H,yi=go(K);ia(H,!1),bt&&Uc(bt),!yi&&(Pe=it&&it.onVnodeBeforeMount)&&hn(Pe,wt,K),ia(H,!0);{Et.ce&&Et.ce._hasShadowRoot()&&Et.ce._injectChildStyle(Kt,H.parent?H.parent.type:void 0);const Bi=H.subTree=eg(H);m(null,Bi,q,z,H,ee,le),K.el=Bi.el}if(Ct&&hs(Ct,ee),!yi&&(Pe=it&&it.onVnodeMounted)){const Bi=K;hs(()=>hn(Pe,wt,Bi),ee)}(K.shapeFlag&256||wt&&go(wt.vnode)&&wt.vnode.shapeFlag&256)&&H.a&&hs(H.a,ee),H.isMounted=!0,K=q=z=null}};H.scope.on();const ye=H.effect=new ky(re);H.scope.off();const he=H.update=ye.run.bind(ye),Xe=H.job=ye.runIfDirty.bind(ye);Xe.i=H,Xe.id=H.uid,ye.scheduler=()=>rp(Xe),ia(H,!0),he()},D=(H,K,q)=>{K.component=H;const z=H.vnode.props;H.vnode=K,H.next=null,nM(H,K.props,z,q),lM(H,K.children,q),cr(),Wp(H),hr()},_=(H,K,q,z,ee,le,ve,re,ye=!1)=>{const he=H&&H.children,Xe=H?H.shapeFlag:0,Pe=K.children,{patchFlag:Oe,shapeFlag:it}=K;if(Oe>0){if(Oe&128){N(he,Pe,q,z,ee,le,ve,re,ye);return}else if(Oe&256){X(he,Pe,q,z,ee,le,ve,re,ye);return}}it&8?(Xe&16&&de(he,ee,le),Pe!==he&&c(q,Pe)):Xe&16?it&16?N(he,Pe,q,z,ee,le,ve,re,ye):de(he,ee,le,!0):(Xe&8&&c(q,""),it&16&&R(Pe,q,z,ee,le,ve,re,ye))},X=(H,K,q,z,ee,le,ve,re,ye)=>{H=H||fo,K=K||fo;const he=H.length,Xe=K.length,Pe=Math.min(he,Xe);let Oe;for(Oe=0;Oe<Pe;Oe++){const it=K[Oe]=ye?qn(K[Oe]):Mn(K[Oe]);m(H[Oe],it,q,null,ee,le,ve,re,ye)}he>Xe?de(H,ee,le,!0,!1,Pe):R(K,q,z,ee,le,ve,re,ye,Pe)},N=(H,K,q,z,ee,le,ve,re,ye)=>{let he=0;const Xe=K.length;let Pe=H.length-1,Oe=Xe-1;for(;he<=Pe&&he<=Oe;){const it=H[he],bt=K[he]=ye?qn(K[he]):Mn(K[he]);if(pa(it,bt))m(it,bt,q,null,ee,le,ve,re,ye);else break;he++}for(;he<=Pe&&he<=Oe;){const it=H[Pe],bt=K[Oe]=ye?qn(K[Oe]):Mn(K[Oe]);if(pa(it,bt))m(it,bt,q,null,ee,le,ve,re,ye);else break;Pe--,Oe--}if(he>Pe){if(he<=Oe){const it=Oe+1,bt=it<Xe?K[it].el:z;for(;he<=Oe;)m(null,K[he]=ye?qn(K[he]):Mn(K[he]),q,bt,ee,le,ve,re,ye),he++}}else if(he>Oe)for(;he<=Pe;)G(H[he],ee,le,!0),he++;else{const it=he,bt=he,Ct=new Map;for(he=bt;he<=Oe;he++){const xi=K[he]=ye?qn(K[he]):Mn(K[he]);xi.key!=null&&Ct.set(xi.key,he)}let wt,Et=0;const Kt=Oe-bt+1;let yi=!1,Bi=0;const Ls=new Array(Kt);for(he=0;he<Kt;he++)Ls[he]=0;for(he=it;he<=Pe;he++){const xi=H[he];if(Et>=Kt){G(xi,ee,le,!0);continue}let ce;if(xi.key!=null)ce=Ct.get(xi.key);else for(wt=bt;wt<=Oe;wt++)if(Ls[wt-bt]===0&&pa(xi,K[wt])){ce=wt;break}ce===void 0?G(xi,ee,le,!0):(Ls[ce-bt]=he+1,ce>=Bi?Bi=ce:yi=!0,m(xi,K[ce],q,null,ee,le,ve,re,ye),Et++)}const an=yi?dM(Ls):fo;for(wt=an.length-1,he=Kt-1;he>=0;he--){const xi=bt+he,ce=K[xi],fe=K[xi+1],It=xi+1<Xe?fe.el||Sx(fe):z;Ls[he]===0?m(null,ce,q,It,ee,le,ve,re,ye):yi&&(wt<0||he!==an[wt]?V(ce,q,It,2):wt--)}}},V=(H,K,q,z,ee=null)=>{const{el:le,type:ve,transition:re,children:ye,shapeFlag:he}=H;if(he&6){V(H.component.subTree,K,q,z);return}if(he&128){H.suspense.move(K,q,z);return}if(he&64){ve.move(H,K,q,ge);return}if(ve===Ke){i(le,K,q);for(let Pe=0;Pe<ye.length;Pe++)V(ye[Pe],K,q,z);i(H.anchor,K,q);return}if(ve===Xc){y(H,K,q);return}if(z!==2&&he&1&&re)if(z===0)re.persisted&&!le[Rs]?i(le,K,q):(re.beforeEnter(le),i(le,K,q),hs(()=>re.enter(le),ee));else{const{leave:Pe,delayLeave:Oe,afterLeave:it}=re,bt=()=>{H.ctx.isUnmounted?n(le):i(le,K,q)},Ct=()=>{const wt=le._isLeaving||!!le[Rs];le._isLeaving&&le[Rs](!0),re.persisted&&!wt?bt():Pe(le,()=>{bt(),it&&it()})};Oe?Oe(le,bt,Ct):Ct()}else i(le,K,q)},G=(H,K,q,z=!1,ee=!1)=>{const{type:le,props:ve,ref:re,children:ye,dynamicChildren:he,shapeFlag:Xe,patchFlag:Pe,dirs:Oe,cacheIndex:it,memo:bt}=H;if(Pe===-2&&(ee=!1),re!=null&&(cr(),ml(re,null,q,H,!0),hr()),it!=null&&(K.renderCache[it]=void 0),Xe&256){K.ctx.deactivate(H);return}const Ct=Xe&1&&Oe,wt=!go(H);let Et;if(wt&&(Et=ve&&ve.onVnodeBeforeUnmount)&&hn(Et,K,H),Xe&6)Q(H.component,q,z);else{if(Xe&128){H.suspense.unmount(q,z);return}Ct&&ta(H,null,K,"beforeUnmount"),Xe&64?H.type.remove(H,K,q,ge,z):he&&!he.hasOnce&&(le!==Ke||Pe>0&&Pe&64)?de(he,K,q,!1,!0):(le===Ke&&Pe&384||!ee&&Xe&16)&&de(ye,K,q),z&&j(H)}const Kt=bt!=null&&it==null;(wt&&(Et=ve&&ve.onVnodeUnmounted)||Ct||Kt)&&hs(()=>{Et&&hn(Et,K,H),Ct&&ta(H,null,K,"unmounted"),Kt&&(H.el=null)},q)},j=H=>{const{type:K,el:q,anchor:z,transition:ee}=H;if(K===Ke){ne(q,z);return}if(K===Xc){w(H);return}const le=()=>{n(q),ee&&!ee.persisted&&ee.afterLeave&&ee.afterLeave()};if(H.shapeFlag&1&&ee&&!ee.persisted){const{leave:ve,delayLeave:re}=ee,ye=()=>ve(q,le);re?re(H.el,le,ye):ye()}else le()},ne=(H,K)=>{let q;for(;H!==K;)q=d(H),n(H),H=q;n(K)},Q=(H,K,q)=>{const{bum:z,scope:ee,job:le,subTree:ve,um:re,m:ye,a:he}=H;sg(ye),sg(he),z&&Uc(z),ee.stop(),le&&(le.flags|=8,G(ve,H,K,q)),re&&hs(re,K),hs(()=>{H.isUnmounted=!0},K)},de=(H,K,q,z=!1,ee=!1,le=0)=>{for(let ve=le;ve<H.length;ve++)G(H[ve],K,q,z,ee)},me=H=>{if(H.shapeFlag&6)return me(H.component.subTree);if(H.shapeFlag&128)return H.suspense.next();const K=d(H.anchor||H.el),q=K&&K[A_];return q?d(q):K};let we=!1;const Re=(H,K,q)=>{let z;H==null?K._vnode&&(G(K._vnode,null,null,!0),z=K._vnode.component):m(K._vnode||null,H,K,null,null,null,q),K._vnode=H,we||(we=!0,Wp(z),qy(),we=!1)},ge={p:m,um:G,m:V,r:j,mt:L,mc:R,pc:_,pbc:F,n:me,o:s};return{render:Re,hydrate:void 0,createApp:q_(Re)}}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 ia({effect:s,job:e},t){t?(s.flags|=32,e.flags|=4):(s.flags&=-33,e.flags&=-5)}function uM(s,e){return(!s||s&&!s.pendingBranch)&&e&&!e.persisted}function bx(s,e,t=!1){const i=s.children,n=e.children;if(dt(i)&&dt(n))for(let r=0;r<i.length;r++){const a=i[r];let o=n[r];o.shapeFlag&1&&!o.dynamicChildren&&((o.patchFlag<=0||o.patchFlag===32)&&(o=n[r]=qn(n[r]),o.el=a.el),!t&&o.patchFlag!==-2&&bx(a,o)),o.type===fu&&(o.patchFlag===-1&&(o=n[r]=qn(o)),o.el=a.el),o.type===es&&!o.el&&(o.el=a.el)}}function dM(s){const e=s.slice(),t=[0];let i,n,r,a,o;const h=s.length;for(i=0;i<h;i++){const l=s[i];if(l!==0){if(n=t[t.length-1],s[n]<l){e[i]=n,t.push(i);continue}for(r=0,a=t.length-1;r<a;)o=r+a>>1,s[t[o]]<l?r=o+1:a=o;l<s[t[r]]&&(r>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 wx(s){const e=s.subTree.component;if(e)return e.asyncDep&&!e.asyncResolved?e:wx(e)}function sg(s){if(s)for(let e=0;e<s.length;e++)s[e].flags|=8}function Sx(s){if(s.placeholder)return s.placeholder;const e=s.component;return e?Sx(e.subTree):null}const _x=s=>s.__isSuspense;function fM(s,e){e&&e.pendingBranch?dt(s)?e.effects.push(...s):e.effects.push(s):b_(s)}const Ke=Symbol.for("v-fgt"),fu=Symbol.for("v-txt"),es=Symbol.for("v-cmt"),Xc=Symbol.for("v-stc"),or=[];let bs=null;function te(s=!1){or.push(bs=s?null:[])}function cp(){or.pop(),bs=or[or.length-1]||null}let Il=1;function hh(s,e=!1){Il+=s,s<0&&bs&&e&&(bs.hasOnce=!0)}function Mx(s){return s.dynamicChildren=Il>0?bs||fo:null,cp(),Il>0&&bs&&bs.push(s),s}function oe(s,e,t,i,n,r){return Mx(E(s,e,t,i,n,r,!0))}function Qt(s,e,t,i,n){return Mx(Ne(s,e,t,i,n,!0))}function Rl(s){return s?s.__v_isVNode===!0:!1}function pa(s,e){return s.type===e.type&&s.key===e.key}const Tx=({key:s})=>s??null,Vc=({ref:s,ref_key:e,ref_for:t})=>(typeof s=="number"&&(s=""+s),s!=null?gi(s)||_i(s)||_t(s)?{i:ts,r:s,k:e,f:!!t}:s:null);function E(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&&Tx(e),ref:e&&Vc(e),scopeId:Zy,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:ts};return o?(uh(h,t),r&128&&s.normalize(h)):t&&(h.shapeFlag|=gi(t)?8:16),Il>0&&!a&&bs&&(h.patchFlag>0||r&6)&&h.patchFlag!==32&&bs.push(h),h}const Ne=mM;function mM(s,e=null,t=null,i=0,n=null,r=!1){if((!s||s===X_)&&(s=es),Rl(s)){const o=Yr(s,e,!0);return t&&uh(o,t),Il>0&&!r&&bs&&(o.shapeFlag&6?bs[bs.indexOf(s)]=o:bs.push(o)),o.patchFlag=-2,o}if(MM(s)&&(s=s.__vccOpts),e){e=pM(e);let{class:o,style:h}=e;o&&!gi(o)&&(e.class=ot(o)),qt(h)&&(ru(h)&&!dt(h)&&(h=Oi({},h)),e.style=Ni(h))}const a=gi(s)?1:_x(s)?128:lu(s)?64:qt(s)?4:_t(s)?2:0;return E(s,e,t,i,n,a,r,!0)}function pM(s){return s?ru(s)||mx(s)?Oi({},s):s:null}function Yr(s,e,t=!1,i=!1){const{props:n,ref:r,patchFlag:a,children:o,transition:h}=s,l=e?gM(n||{},e):n,c={__v_isVNode:!0,__v_skip:!0,type:s.type,props:l,key:l&&Tx(l),ref:e&&e.ref?t&&r?dt(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&&Yr(s.ssContent),ssFallback:s.ssFallback&&Yr(s.ssFallback),placeholder:s.placeholder,el:s.el,anchor:s.anchor,ctx:s.ctx,ce:s.ce};return h&&i&&Cl(c,h.clone(c)),c}function ai(s=" ",e=0){return Ne(fu,null,s,e)}function to(s,e){const t=Ne(Xc,null,s);return t.staticCount=e,t}function Ue(s="",e=!1){return e?(te(),Qt(es,null,s)):Ne(es,null,s)}function Mn(s){return s==null||typeof s=="boolean"?Ne(es):dt(s)?Ne(Ke,null,s.slice()):Rl(s)?qn(s):Ne(fu,null,String(s))}function qn(s){return s.el===null&&s.patchFlag!==-1||s.memo?s:Yr(s)}function uh(s,e){let t=0;const{shapeFlag:i}=s;if(e==null)e=null;else if(dt(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&&!mx(e)?e._ctx=ts:n===3&&ts&&(ts.slots._===1?e._=1:(e._=2,s.patchFlag|=1024))}else if(_t(e)){if(i&65){uh(s,{default:e});return}e={default:e,_ctx:ts},t=32}else e=String(e),i&64?(t=16,e=[ai(e)]):t=8;s.children=e,s.shapeFlag|=t}function gM(...s){const e={};for(let t=0;t<s.length;t++){const i=s[t];for(const n in i)if(n==="class")e.class!==i.class&&(e.class=ot([e.class,i.class]));else if(n==="style")e.style=Ni([e.style,i.style]);else if(Jh(n)){const r=e[n],a=i[n];a&&r!==a&&!(dt(r)&&r.includes(a))?e[n]=r?[].concat(r,a):a:a==null&&r==null&&!Qh(n)&&(e[n]=a)}else n!==""&&(e[n]=i[n])}return e}function hn(s,e,t,i=null){Os(s,e,7,[t,i])}const vM=cx();let yM=0;function xM(s,e,t){const i=s.type,n=(e?e.appContext:s.appContext)||vM,r={uid:yM++,vnode:s,type:i,parent:e,appContext:n,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new Iy(!0),render:null,proxy:null,exposed:null,exposeProxy:null,withProxy:null,provides:e?e.provides:Object.create(n.provides),ids:e?e.ids:["",0,0],accessCache:null,renderCache:[],components:null,directives:null,propsOptions:gx(i,n),emitsOptions:hx(i,n),emit:null,emitted:null,propsDefaults:ii,inheritAttrs:i.inheritAttrs,ctx:ii,data:ii,props:ii,attrs:ii,slots:ii,refs:ii,setupState:ii,setupContext:null,suspense:t,suspenseId:t?t.pendingId:0,asyncDep:null,asyncResolved:!1,isMounted:!1,isUnmounted:!1,isDeactivated:!1,bc:null,c:null,bm:null,m:null,bu:null,u:null,um:null,bum:null,da:null,a:null,rtg:null,rtc:null,ec:null,sp:null};return r.ctx={_:r},r.root=e?e.root:r,r.emit=Z_.bind(null,r),s.ce&&s.ce(r),r}let rs=null;const hp=()=>rs||ts;let dh,Pl;{const s=su(),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=>rs=t),Pl=e("__VUE_SSR_SETTERS__",t=>kl=t)}const Hl=s=>{const e=rs;return dh(s),s.scope.on(),()=>{s.scope.off(),dh(e)}},ng=()=>{rs&&rs.scope.off(),dh(null)};function Ax(s){return s.vnode.shapeFlag&4}let kl=!1;function bM(s,e=!1,t=!1){e&&Pl(e);const{props:i,children:n}=s.vnode,r=Ax(s);sM(s,i,r,e),oM(s,n,t||e);const a=r?wM(s,e):void 0;return e&&Pl(!1),a}function wM(s,e){const t=s.type;s.accessCache=Object.create(null),s.proxy=new Proxy(s.ctx,Y_);const{setup:i}=t;if(i){cr();const n=s.setupContext=i.length>1?_M(s):null,r=Hl(s),a=$l(i,s,0,[s.props,n]),o=wy(a);if(hr(),r(),(o||s.sp)&&!go(s)&&nx(s),o){if(a.then(ng,ng),e)return a.then(h=>{Pl(!0);try{rg(s,h,e)}finally{Pl(!1)}}).catch(h=>{au(h,s,0)});s.asyncDep=a}else rg(s,a)}else Ex(s)}function rg(s,e,t){_t(e)?s.type.__ssrInlineRender?s.ssrRender=e:s.render=e:qt(e)&&(s.setupState=jy(e)),Ex(s)}function Ex(s,e,t){const i=s.type;s.render||(s.render=i.render||Pn);{const n=Hl(s);cr();try{$_(s)}finally{hr(),n()}}}const SM={get(s,e){return Ji(s,"get",""),s[e]}};function _M(s){const e=t=>{s.exposed=t||{}};return{attrs:new Proxy(s.attrs,SM),slots:s.slots,emit:s.emit,expose:e}}function mu(s){return s.exposed?s.exposeProxy||(s.exposeProxy=new Proxy(jy(Or(s.exposed)),{get(e,t){if(t in e)return e[t];if(t in pl)return pl[t](s)},has(e,t){return t in e||t in pl}})):s.proxy}function MM(s){return _t(s)&&"__vccOpts"in s}const pt=(s,e)=>p_(s,e,kl);function TM(s,e,t){try{hh(-1);const i=arguments.length;return i===2?qt(e)&&!dt(e)?Rl(e)?Ne(s,null,[e]):Ne(s,e):Ne(s,null,e):(i>3?t=Array.prototype.slice.call(arguments,2):i===3&&Rl(t)&&(t=[t]),Ne(s,e,t))}finally{hh(1)}}const AM="3.5.41";/**
|
||
* @vue/runtime-dom v3.5.41
|
||
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
||
* @license MIT
|
||
**/let Nf;const ag=typeof window<"u"&&window.trustedTypes;if(ag)try{Nf=ag.createPolicy("vue",{createHTML:s=>s})}catch{}const Cx=Nf?s=>Nf.createHTML(s):s=>s,EM="http://www.w3.org/2000/svg",CM="http://www.w3.org/1998/Math/MathML",Gn=typeof document<"u"?document:null,og=Gn&&Gn.createElement("template"),IM={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"?Gn.createElementNS(EM,s):e==="mathml"?Gn.createElementNS(CM,s):t?Gn.createElement(s,{is:t}):Gn.createElement(s);return s==="select"&&i&&i.multiple!=null&&n.setAttribute("multiple",i.multiple),n},createText:s=>Gn.createTextNode(s),createComment:s=>Gn.createComment(s),setText:(s,e)=>{s.nodeValue=e},setElementText:(s,e)=>{s.textContent=e},parentNode:s=>s.parentNode,nextSibling:s=>s.nextSibling,querySelector:s=>Gn.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{og.innerHTML=Cx(i==="svg"?`<svg>${s}</svg>`:i==="mathml"?`<math>${s}</math>`:s);const o=og.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]}},vr="transition",Ho="animation",Fl=Symbol("_vtc"),Ix={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},RM=Oi({},Qy,Ix),PM=s=>(s.displayName="Transition",s.props=RM,s),kM=PM((s,{slots:e})=>TM(I_,FM(s),e)),sa=(s,e=[])=>{dt(s)?s.forEach(t=>t(...e)):s&&s(...e)},lg=s=>s?dt(s)?s.some(e=>e.length>1):s.length>1:!1;function FM(s){const e={};for(const k in s)k in Ix||(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=OM(n),m=p&&p[0],g=p&&p[1],{onBeforeEnter:v,onEnter:b,onEnterCancelled:y,onLeave:w,onLeaveCancelled:A,onBeforeAppear:T=v,onAppear:M=b,onAppearCancelled:R=y}=e,P=(k,O,L,U)=>{k._enterCancelled=U,na(k,O?c:o),na(k,O?l:a),L&&L()},F=(k,O)=>{k._isLeaving=!1,na(k,u),na(k,f),na(k,d),O&&O()},I=k=>(O,L)=>{const U=k?M:b,B=()=>P(O,k,L);sa(U,[O,B]),cg(()=>{na(O,k?h:r),Xn(O,k?c:o),lg(U)||hg(O,i,m,B)})};return Oi(e,{onBeforeEnter(k){sa(v,[k]),Xn(k,r),Xn(k,a)},onBeforeAppear(k){sa(T,[k]),Xn(k,h),Xn(k,l)},onEnter:I(!1),onAppear:I(!0),onLeave(k,O){k._isLeaving=!0;const L=()=>F(k,O);Xn(k,u),k._enterCancelled?(Xn(k,d),fg(k)):(fg(k),Xn(k,d)),cg(()=>{k._isLeaving&&(na(k,u),Xn(k,f),lg(w)||hg(k,i,g,L))}),sa(w,[k,L])},onEnterCancelled(k){P(k,!1,void 0,!0),sa(y,[k])},onAppearCancelled(k){P(k,!0,void 0,!0),sa(R,[k])},onLeaveCancelled(k){F(k),sa(A,[k])}})}function OM(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 OS(s)}function Xn(s,e){e.split(/\s+/).forEach(t=>t&&s.classList.add(t)),(s[Fl]||(s[Fl]=new Set)).add(e)}function na(s,e){e.split(/\s+/).forEach(i=>i&&s.classList.remove(i));const t=s[Fl];t&&(t.delete(e),t.size||(s[Fl]=void 0))}function cg(s){requestAnimationFrame(()=>{requestAnimationFrame(s)})}let BM=0;function hg(s,e,t,i){const n=s._endId=++BM,r=()=>{n===s._endId&&i()};if(t!=null)return setTimeout(r,t);const{type:a,timeout:o,propCount:h}=LM(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<h&&u()},o+1),s.addEventListener(l,d)}function LM(s,e){const t=window.getComputedStyle(s),i=p=>(t[p]||"").split(", "),n=i(`${vr}Delay`),r=i(`${vr}Duration`),a=ug(n,r),o=i(`${Ho}Delay`),h=i(`${Ho}Duration`),l=ug(o,h);let c=null,u=0,d=0;e===vr?a>0&&(c=vr,u=a,d=r.length):e===Ho?l>0&&(c=Ho,u=l,d=h.length):(u=Math.max(a,l),c=u>0?a>l?vr:Ho:null,d=c?c===vr?r.length:h.length:0);const f=c===vr&&/\b(?:transform|all)(?:,|$)/.test(i(`${vr}Property`).toString());return{type:c,timeout:u,propCount:d,hasTransform:f}}function ug(s,e){for(;s.length<e.length;)s=s.concat(s);return Math.max(...e.map((t,i)=>dg(t)+dg(s[i])))}function dg(s){return s==="auto"?0:Number(s.slice(0,-1).replace(",","."))*1e3}function fg(s){return(s?s.ownerDocument:document).body.offsetHeight}function DM(s,e,t){const i=s[Fl];i&&(e=(e?[e,...i]:[...i]).join(" ")),e==null?s.removeAttribute("class"):t?s.setAttribute("class",e):s.className=e}const fh=Symbol("_vod"),Rx=Symbol("_vsh"),yr={name:"show",beforeMount(s,{value:e},{transition:t}){s[fh]=s.style.display==="none"?"":s.style.display,t&&e?t.beforeEnter(s):jo(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),jo(s,!0),i.enter(s)):i.leave(s,()=>{jo(s,!1)}):jo(s,e))},beforeUnmount(s,{value:e}){jo(s,e)}};function jo(s,e){s.style.display=e?s[fh]:"none",s[Rx]=!e}const NM=Symbol(""),UM=/(?:^|;)\s*display\s*:/;function XM(s,e,t){const i=s.style,n=gi(t);let r=!1;if(t&&!n){if(e)if(gi(e))for(const a of e.split(";")){const o=a.slice(0,a.indexOf(":")).trim();t[o]==null&&tl(i,o,"")}else for(const a in e)t[a]==null&&tl(i,a,"");for(const a in t){a==="display"&&(r=!0);const o=t[a];o!=null?YM(s,a,!gi(e)&&e?e[a]:void 0,o)||tl(i,a,o):tl(i,a,"")}}else if(n){if(e!==t){const a=i[NM];a&&(t+=";"+a),i.cssText=t,r=UM.test(t)}}else e&&s.removeAttribute("style");fh in s&&(s[fh]=r?i.display:"",s[Rx]&&(i.display="none"))}const mg=/\s*!important$/;function tl(s,e,t){if(dt(t))t.forEach(i=>tl(s,e,i));else if(t==null&&(t=""),e.startsWith("--"))s.setProperty(e,t);else{const i=VM(s,e);mg.test(t)?s.setProperty(jr(i),t.replace(mg,""),"important"):s[i]=t}}const pg=["Webkit","Moz","ms"],$u={};function VM(s,e){const t=$u[e];if(t)return t;let i=qs(e);if(i!=="filter"&&i in s)return $u[e]=i;i=My(i);for(let n=0;n<pg.length;n++){const r=pg[n]+i;if(r in s)return $u[e]=r}return e}function YM(s,e,t,i){return s.tagName==="TEXTAREA"&&(e==="width"||e==="height")&&gi(i)&&t===i}const gg="http://www.w3.org/1999/xlink";function vg(s,e,t,i,n,r=XS(e)){i&&e.startsWith("xlink:")?t==null?s.removeAttributeNS(gg,e.slice(6,e.length)):s.setAttributeNS(gg,e,t):t==null||r&&!Ay(t)?s.removeAttribute(e):s.setAttribute(e,r?"":Ss(t)?String(t):t)}function yg(s,e,t,i,n){if(e==="innerHTML"||e==="textContent"){t!=null&&(s[e]=e==="innerHTML"?Cx(t):t);return}const r=s.tagName;if(e==="value"&&r!=="PROGRESS"&&!r.includes("-")){const o=r==="OPTION"?s.getAttribute("value")||"":s.value,h=t==null?s.type==="checkbox"?"on":"":String(t);(o!==h||!("_value"in s))&&(s.value=h),t==null&&s.removeAttribute(e),s._value=t;return}let a=!1;if(t===""||t==null){const o=typeof s[e];o==="boolean"?t=Ay(t):t==null&&o==="string"?(t="",a=!0):o==="number"&&(t=0,a=!0)}try{s[e]=t}catch{}a&&s.removeAttribute(n||e)}function Rr(s,e,t,i){s.addEventListener(e,t,i)}function $M(s,e,t,i){s.removeEventListener(e,t,i)}const xg=Symbol("_vei");function GM(s,e,t,i,n=null){const r=s[xg]||(s[xg]={}),a=r[e];if(i&&a)a.value=i;else{const[o,h]=WM(e);if(i){const l=r[e]=KM(i,n);Rr(s,o,l,h)}else a&&($M(s,o,a,h),r[e]=void 0)}}const HM=/(Once|Passive|Capture)$/,jM=/^on:?(?:Once|Passive|Capture)$/;function WM(s){let e,t;for(;(t=s.match(HM))&&!jM.test(s);)e||(e={}),s=s.slice(0,s.length-t[1].length),e[t[1].toLowerCase()]=!0;return[s[2]===":"?s.slice(3):jr(s.slice(2)),e]}let Gu=0;const zM=Promise.resolve(),qM=()=>Gu||(zM.then(()=>Gu=0),Gu=Date.now());function KM(s,e){const t=i=>{if(!i._vts)i._vts=Date.now();else if(i._vts<=t.attached)return;const n=t.value;if(dt(n)){const r=i.stopImmediatePropagation;i.stopImmediatePropagation=()=>{r.call(i),i._stopped=!0};const a=n.slice(),o=[i];for(let h=0;h<a.length&&!i._stopped;h++){const l=a[h];l&&Os(l,e,5,o)}}else Os(n,e,5,[i])};return t.value=s,t.attached=qM(),t}const bg=s=>s.charCodeAt(0)===111&&s.charCodeAt(1)===110&&s.charCodeAt(2)>96&&s.charCodeAt(2)<123,ZM=(s,e,t,i,n,r)=>{const a=n==="svg";e==="class"?DM(s,i,a):e==="style"?XM(s,t,i):Jh(e)?Qh(e)||GM(s,e,t,i,r):(e[0]==="."?(e=e.slice(1),!0):e[0]==="^"?(e=e.slice(1),!1):JM(s,e,i,a))?(yg(s,e,i),!s.tagName.includes("-")&&(e==="value"||e==="checked"||e==="selected")&&vg(s,e,i,a,r,e!=="value")):s._isVueCE&&(QM(s,e)||s._def.__asyncLoader&&(/[A-Z]/.test(e)||!gi(i)))?yg(s,qs(e),i,r,e):(e==="true-value"?s._trueValue=i:e==="false-value"&&(s._falseValue=i),vg(s,e,i,a))};function JM(s,e,t,i){if(i)return!!(e==="innerHTML"||e==="textContent"||e in s&&bg(e)&&_t(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 bg(e)&&gi(t)?!1:e in s}function QM(s,e){const t=s._def.props;if(!t)return!1;const i=qs(e);return Array.isArray(t)?t.some(n=>qs(n)===i):Object.keys(t).some(n=>qs(n)===i)}const Eo=s=>{const e=s.props["onUpdate:modelValue"]||!1;return dt(e)?t=>Uc(e,t):e};function eT(s){s.target.composing=!0}function wg(s){const e=s.target;e.composing&&(e.composing=!1,e.dispatchEvent(new Event("input")))}const En=Symbol("_assign"),rc=Symbol("_initialValue");function Hu(s,e,t){return e&&(s=s.trim()),t&&(s=iu(s)),s}const ct={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[En]=Eo(n);const r=i||n.props&&n.props.type==="number";Rr(s,e?"change":"input",a=>{a.target.composing||s[En](Hu(s.value,t,r))}),(t||r)&&Rr(s,"change",()=>{s.value=Hu(s.value,t,r)}),e||(Rr(s,"compositionstart",eT),Rr(s,"compositionend",wg),Rr(s,"change",wg))},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[En](Hu(s.value,t,i)):s.value=n},beforeUpdate(s,{value:e,oldValue:t,modifiers:{lazy:i,trim:n,number:r}},a){if(s[En]=Eo(a),s.composing)return;const o=(r||s.type==="number")&&!/^0\d/.test(s.value)?iu(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)}},ti={deep:!0,created(s,e,t){s[En]=Eo(t),Rr(s,"change",()=>{const i=s._modelValue,n=Ol(s),r=s.checked,a=s[En];if(dt(i)){const o=Jm(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(Px(s,r))})},mounted:Sg,beforeUpdate(s,e,t){s[En]=Eo(t),Sg(s,e,t)}};function Sg(s,{value:e,oldValue:t},i){s._modelValue=e;let n;if(dt(e))n=Jm(e,i.props.value)>-1;else if(Oo(e))n=e.has(i.props.value);else{if(e===t)return;n=Bo(e,Px(s,!0))}s.checked!==n&&(s.checked=n)}const jt={deep:!0,created(s,{value:e,modifiers:{number:t}},i){s._modelValue=e,Rr(s,"change",()=>{const n=Array.prototype.filter.call(s.options,r=>r.selected).map(r=>t?iu(Ol(r)):Ol(r));s[En](s.multiple?Oo(s._modelValue)?new Set(n):n:n[0]),s._assigning=!0,ou(()=>{s._assigning=!1})}),s[En]=Eo(i)},mounted(s,{value:e}){_g(s,e)},beforeUpdate(s,{value:e},t){s._modelValue=e,s[En]=Eo(t)},updated(s,{value:e}){s._assigning||_g(s,e)}};function _g(s,e){const t=s.multiple,i=dt(e);if(!(t&&!i&&!Oo(e))){for(let n=0,r=s.options.length;n<r;n++){const a=s.options[n],o=Ol(a);if(t)if(i){const h=typeof o;h==="string"||h==="number"?a.selected=e.some(l=>String(l)===String(o)):a.selected=Jm(e,o)>-1}else a.selected=e.has(o);else if(Bo(Ol(a),e)){s.selectedIndex!==n&&(s.selectedIndex=n);return}}!t&&s.selectedIndex!==-1&&(s.selectedIndex=-1)}}function Ol(s){return"_value"in s?s._value:s.value}function Px(s,e){const t=e?"_trueValue":"_falseValue";return t in s?s[t]:e}const tT=["ctrl","shift","alt","meta"],iT={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)=>tT.some(t=>s[`${t}Key`]&&!e.includes(t))},yt=(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<e.length;a++){const o=iT[e[a]];if(o&&o(n,e))return}return s(n,...r)}))},sT={esc:"escape",space:" ",up:"arrow-up",left:"arrow-left",right:"arrow-right",down:"arrow-down",delete:"backspace"},Aa=(s,e)=>{const t=s._withKeys||(s._withKeys={}),i=e.join(".");return t[i]||(t[i]=(n=>{if(!("key"in n))return;const r=jr(n.key);if(e.some(a=>a===r||sT[a]===r))return s(n)}))},nT=Oi({patchProp:ZM},IM);let Mg;function rT(){return Mg||(Mg=cM(nT))}const aT=((...s)=>{const e=rT().createApp(...s),{mount:t}=e;return e.mount=i=>{const n=lT(i);if(!n)return;const r=e._component;!_t(r)&&!r.render&&!r.template&&(r.template=n.innerHTML),n.nodeType===1&&(n.textContent="");const a=t(n,!1,oT(n));return n instanceof Element&&(n.removeAttribute("v-cloak"),n.setAttribute("data-v-app","")),a},e});function oT(s){if(s instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&s instanceof MathMLElement)return"mathml"}function lT(s){return gi(s)?document.querySelector(s):s}/*!
|
||
* pinia v4.0.3
|
||
* (c) 2026 Eduardo San Martin Morote
|
||
* @license MIT
|
||
*/let kx;const pu=s=>kx=s,Fx=Symbol();function Tg(s){return s&&typeof s=="object"&&Object.prototype.toString.call(s)==="[object Object]"&&typeof s.toJSON!="function"}function cT(){const s=Ry(!0),e=s.run(()=>ht({}));let t=[],i=[];const n=Or({install(r){pu(n),n._a=r,r.provide(Fx,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 Ag(s,e,t,i=Uf){s.add(e);const n=()=>{s.delete(e)&&i()};return!t&&Py()&&YS(n),n}function ja(s,...e){s.forEach(t=>{t(...e)})}const hT=s=>s(),Eg=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];Tg(n)&&Tg(i)&&Object.hasOwn(s,t)&&!_i(i)&&!ar(i)?s[t]=Xf(n,i):s[t]=i}return s}const uT=Symbol();function dT(s){return!s||typeof s!="object"||!Object.hasOwn(s,uT)}const{assign:wr}=Object;function fT(s){return!!(_i(s)&&s.effect)}function mT(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=u_(t.state.value[s]);return wr(c,r,Object.keys(a||{}).reduce((u,d)=>(u[d]=Or(pt(()=>{pu(t);const f=t._s.get(s);return a[d].call(f,f)})),u),{}))}return h=Ox(s,l,e,t,i,!0),h}function Ox(s,e,t={},i,n,r){let a;const o=wr({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(M){let R;l=c=!1,typeof M=="function"?(M(i.state.value[s]),R={type:"patch function",storeId:s,events:f}):(Xf(i.state.value[s],M),R={type:"patch object",payload:M,storeId:s,events:f});const P=m=Symbol();ou().then(()=>{m===P&&(l=!0)}),c=!0,ja(u,R,i.state.value[s])}const v=r?function(){const{state:R}=t,P=R?R():{};this.$patch(F=>{wr(F,P)})}:Uf;function b(){a.stop(),u.clear(),d.clear(),i._s.delete(s)}const y=(M,R="")=>{if(Eg in M)return M[ju]=R,M;const P=function(){pu(i);const F=Array.from(arguments),I=new Set,k=new Set;function O(B){I.add(B)}function L(B){k.add(B)}ja(d,{args:F,name:P[ju],store:A,after:O,onError:L});let U;try{U=M.apply(this&&this.$id===s?this:A,F)}catch(B){throw ja(k,B),B}return U instanceof Promise?U.then(B=>(ja(I,B),B)).catch(B=>(ja(k,B),Promise.reject(B))):(ja(I,U),U)};return P[Eg]=!0,P[ju]=R,P},w={_p:i,$id:s,$onAction:Ag.bind(null,d),$patch:g,$reset:v,$subscribe(M,R={}){if(u.has(M))return Uf;const P=Ag(u,M,R.detached,()=>F()),F=a.run(()=>cs(()=>i.state.value[s],I=>{(R.flush==="sync"?c:l)&&M({storeId:s,type:"direct",events:f},I)},wr({},h,R)));return P},$dispose:b},A=La(w);i._s.set(s,A);const T=(i._a&&i._a.runWithContext||hT)(()=>i._e.run(()=>(a=Ry()).run(()=>e({action:y}))));for(const M in T){const R=T[M];_i(R)&&!fT(R)||ar(R)?r||(p&&dT(R)&&(_i(R)?R.value=p[M]:((R instanceof Set||R instanceof Map)&&R.clear(),Xf(R,p[M]))),i.state.value[s][M]=R):typeof R=="function"&&(T[M]=y(R,M),o.actions[M]=R)}return wr(A,T),wr(Yt(A),T),Object.defineProperty(A,"$state",{get:()=>i.state.value[s],set:M=>{g(R=>{wr(R,M)})}}),i._p.forEach(M=>{const R=a.run(()=>M({store:A,app:i._a,pinia:i,options:o}));wr(A,R)}),p&&r&&t.hydrate&&t.hydrate(A.$state,p),l=!0,c=!0,A}/*! #__NO_SIDE_EFFECTS__ */function pT(s,e,t){let i;const n=typeof e=="function";i=n?t:e;function r(a,o){const h=S_();return a=a||(h?fl(Fx,null):null),a&&pu(a),a=kx,a._s.has(s)||(n?Ox(s,e,i,a):mT(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||{}),Bx=(s=>(s[s.UNKNOWN=0]="UNKNOWN",s[s.WEBGL=1]="WEBGL",s[s.CANVAS=2]="CANVAS",s))(Bx||{}),Vf=(s=>(s[s.COLOR=16384]="COLOR",s[s.DEPTH=256]="DEPTH",s[s.STENCIL=1024]="STENCIL",s))(Vf||{}),ut=(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))(ut||{}),Cn=(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))(Cn||{}),De=(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))(De||{}),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||{}),zs=(s=>(s[s.NEAREST=0]="NEAREST",s[s.LINEAR=1]="LINEAR",s))(zs||{}),Zs=(s=>(s[s.CLAMP=33071]="CLAMP",s[s.REPEAT=10497]="REPEAT",s[s.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",s))(Zs||{}),Bs=(s=>(s[s.OFF=0]="OFF",s[s.POW2=1]="POW2",s[s.ON=2]="ON",s[s.ON_MANUAL=3]="ON_MANUAL",s))(Bs||{}),Xi=(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))(Xi||{}),Tn=(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))(Tn||{}),up=(s=>(s[s.AUTO=0]="AUTO",s[s.MANUAL=1]="MANUAL",s))(up||{}),ks=(s=>(s.LOW="lowp",s.MEDIUM="mediump",s.HIGH="highp",s))(ks||{}),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||{}),Ci=(s=>(s[s.NONE=0]="NONE",s[s.LOW=2]="LOW",s[s.MEDIUM=4]="MEDIUM",s[s.HIGH=8]="HIGH",s))(Ci||{}),kn=(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))(kn||{});const gT={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:gT,RESOLUTION:1,CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1};var Wu=/iPhone/i,Cg=/iPod/i,Ig=/iPad/i,Rg=/\biOS-universal(?:.+)Mac\b/i,zu=/\bAndroid(?:.+)Mobile\b/i,Pg=/Android/i,Wa=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,ac=/Silk/i,Vn=/Windows Phone/i,kg=/\bWindows(?:.+)ARM\b/i,Fg=/BlackBerry/i,Og=/BB10/i,Bg=/Opera Mini/i,Lg=/\b(CriOS|Chrome)(?:.+)Mobile/i,Dg=/Mobile(?:.+)Firefox\b/i,Ng=function(s){return typeof s<"u"&&s.platform==="MacIntel"&&typeof s.maxTouchPoints=="number"&&s.maxTouchPoints>1&&typeof MSStream>"u"};function vT(s){return function(e){return e.test(s)}}function Ug(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=vT(t),r={apple:{phone:n(Wu)&&!n(Vn),ipod:n(Cg),tablet:!n(Wu)&&(n(Ig)||Ng(e))&&!n(Vn),universal:n(Rg),device:(n(Wu)||n(Cg)||n(Ig)||n(Rg)||Ng(e))&&!n(Vn)},amazon:{phone:n(Wa),tablet:!n(Wa)&&n(ac),device:n(Wa)||n(ac)},android:{phone:!n(Vn)&&n(Wa)||!n(Vn)&&n(zu),tablet:!n(Vn)&&!n(Wa)&&!n(zu)&&(n(ac)||n(Pg)),device:!n(Vn)&&(n(Wa)||n(ac)||n(zu)||n(Pg))||n(/\bokhttp\b/i)},windows:{phone:n(Vn),tablet:n(kg),device:n(Vn)||n(kg)},other:{blackberry:n(Fg),blackberry10:n(Og),opera:n(Bg),firefox:n(Dg),chrome:n(Lg),device:n(Fg)||n(Og)||n(Bg)||n(Dg)||n(Lg)},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 yT=Ug.default??Ug,Qn=yT(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 Lx(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}function xT(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:{}},Xg;function bT(){return Xg||(Xg=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);d<f;d++)p[d]=u[d].fn;return p},o.prototype.listenerCount=function(l){var c=t?t+l:l,u=this._events[c];return u?u.fn?1:u.length:0},o.prototype.emit=function(l,c,u,d,f,p){var m=t?t+l:l;if(!this._events[m])return!1;var g=this._events[m],v=arguments.length,b,y;if(g.fn){switch(g.once&&this.removeListener(l,g.fn,void 0,!0),v){case 1:return g.fn.call(g.context),!0;case 2:return g.fn.call(g.context,c),!0;case 3:return g.fn.call(g.context,c,u),!0;case 4:return g.fn.call(g.context,c,u,d),!0;case 5:return g.fn.call(g.context,c,u,d,f),!0;case 6:return g.fn.call(g.context,c,u,d,f,p),!0}for(y=1,b=new Array(v-1);y<v;y++)b[y-1]=arguments[y];g.fn.apply(g.context,b)}else{var w=g.length,A;for(y=0;y<w;y++)switch(g[y].once&&this.removeListener(l,g[y].fn,void 0,!0),v){case 1:g[y].fn.call(g[y].context);break;case 2:g[y].fn.call(g[y].context,c);break;case 3:g[y].fn.call(g[y].context,c,u);break;case 4:g[y].fn.call(g[y].context,c,u,d);break;default:if(!b)for(A=1,b=new Array(v-1);A<v;A++)b[A-1]=arguments[A];g[y].fn.apply(g[y].context,b)}}return!0},o.prototype.on=function(l,c,u){return r(this,l,c,u,!1)},o.prototype.once=function(l,c,u){return r(this,l,c,u,!0)},o.prototype.removeListener=function(l,c,u,d){var f=t?t+l:l;if(!this._events[f])return this;if(!c)return a(this,f),this;var p=this._events[f];if(p.fn)p.fn===c&&(!d||p.once)&&(!u||p.context===u)&&a(this,f);else{for(var m=0,g=[],v=p.length;m<v;m++)(p[m].fn!==c||d&&!p[m].once||u&&p[m].context!==u)&&g.push(p[m]);g.length?this._events[f]=g.length===1?g[0]:g:a(this,f)}return this},o.prototype.removeAllListeners=function(l){var c;return l?(c=t?t+l:l,this._events[c]&&a(this,c)):(this._events=new i,this._eventsCount=0),this},o.prototype.off=o.prototype.removeListener,o.prototype.addListener=o.prototype.on,o.prefixed=t,o.EventEmitter=o,s.exports=o})(qu)),qu.exports}var wT=bT();const jl=Lx(wT);var oc={exports:{}},Vg;function ST(){if(Vg)return oc.exports;Vg=1,oc.exports=s,oc.exports.default=s;function s(B,D,_){_=_||2;var X=D&&D.length,N=X?D[0]*_:B.length,V=e(B,0,N,_,!0),G=[];if(!V||V.next===V.prev)return G;var j,ne,Q,de,me,we,Re;if(X&&(V=h(B,D,V,_)),B.length>80*_){j=Q=B[0],ne=de=B[1];for(var ge=_;ge<N;ge+=_)me=B[ge],we=B[ge+1],me<j&&(j=me),we<ne&&(ne=we),me>Q&&(Q=me),we>de&&(de=we);Re=Math.max(Q-j,de-ne),Re=Re!==0?32767/Re:0}return i(V,G,_,j,ne,Re,0),G}function e(B,D,_,X,N){var V,G;if(N===U(B,D,_,X)>0)for(V=D;V<_;V+=X)G=k(V,B[V],B[V+1],G);else for(V=_-X;V>=D;V-=X)G=k(V,B[V],B[V+1],G);return G&&w(G,G.next)&&(O(G),G=G.next),G}function t(B,D){if(!B)return B;D||(D=B);var _=B,X;do if(X=!1,!_.steiner&&(w(_,_.next)||y(_.prev,_,_.next)===0)){if(O(_),_=D=_.prev,_===_.next)break;X=!0}else _=_.next;while(X||_!==D);return D}function i(B,D,_,X,N,V,G){if(B){!G&&V&&f(B,X,N,V);for(var j=B,ne,Q;B.prev!==B.next;){if(ne=B.prev,Q=B.next,V?r(B,X,N,V):n(B)){D.push(ne.i/_|0),D.push(B.i/_|0),D.push(Q.i/_|0),O(B),B=Q.next,j=Q.next;continue}if(B=Q,B===j){G?G===1?(B=a(t(B),D,_),i(B,D,_,X,N,V,2)):G===2&&o(B,D,_,X,N,V):i(t(B),D,_,X,N,V,1);break}}}}function n(B){var D=B.prev,_=B,X=B.next;if(y(D,_,X)>=0)return!1;for(var N=D.x,V=_.x,G=X.x,j=D.y,ne=_.y,Q=X.y,de=N<V?N<G?N:G:V<G?V:G,me=j<ne?j<Q?j:Q:ne<Q?ne:Q,we=N>V?N>G?N:G:V>G?V:G,Re=j>ne?j>Q?j:Q:ne>Q?ne:Q,ge=X.next;ge!==D;){if(ge.x>=de&&ge.x<=we&&ge.y>=me&&ge.y<=Re&&v(N,j,V,ne,G,Q,ge.x,ge.y)&&y(ge.prev,ge,ge.next)>=0)return!1;ge=ge.next}return!0}function r(B,D,_,X){var N=B.prev,V=B,G=B.next;if(y(N,V,G)>=0)return!1;for(var j=N.x,ne=V.x,Q=G.x,de=N.y,me=V.y,we=G.y,Re=j<ne?j<Q?j:Q:ne<Q?ne:Q,ge=de<me?de<we?de:we:me<we?me:we,Ae=j>ne?j>Q?j:Q:ne>Q?ne:Q,H=de>me?de>we?de:we:me>we?me:we,K=m(Re,ge,D,_,X),q=m(Ae,H,D,_,X),z=B.prevZ,ee=B.nextZ;z&&z.z>=K&&ee&&ee.z<=q;){if(z.x>=Re&&z.x<=Ae&&z.y>=ge&&z.y<=H&&z!==N&&z!==G&&v(j,de,ne,me,Q,we,z.x,z.y)&&y(z.prev,z,z.next)>=0||(z=z.prevZ,ee.x>=Re&&ee.x<=Ae&&ee.y>=ge&&ee.y<=H&&ee!==N&&ee!==G&&v(j,de,ne,me,Q,we,ee.x,ee.y)&&y(ee.prev,ee,ee.next)>=0))return!1;ee=ee.nextZ}for(;z&&z.z>=K;){if(z.x>=Re&&z.x<=Ae&&z.y>=ge&&z.y<=H&&z!==N&&z!==G&&v(j,de,ne,me,Q,we,z.x,z.y)&&y(z.prev,z,z.next)>=0)return!1;z=z.prevZ}for(;ee&&ee.z<=q;){if(ee.x>=Re&&ee.x<=Ae&&ee.y>=ge&&ee.y<=H&&ee!==N&&ee!==G&&v(j,de,ne,me,Q,we,ee.x,ee.y)&&y(ee.prev,ee,ee.next)>=0)return!1;ee=ee.nextZ}return!0}function a(B,D,_){var X=B;do{var N=X.prev,V=X.next.next;!w(N,V)&&A(N,X,X.next,V)&&P(N,V)&&P(V,N)&&(D.push(N.i/_|0),D.push(X.i/_|0),D.push(V.i/_|0),O(X),O(X.next),X=B=V),X=X.next}while(X!==B);return t(X)}function o(B,D,_,X,N,V){var G=B;do{for(var j=G.next.next;j!==G.prev;){if(G.i!==j.i&&b(G,j)){var ne=I(G,j);G=t(G,G.next),ne=t(ne,ne.next),i(G,D,_,X,N,V,0),i(ne,D,_,X,N,V,0);return}j=j.next}G=G.next}while(G!==B)}function h(B,D,_,X){var N=[],V,G,j,ne,Q;for(V=0,G=D.length;V<G;V++)j=D[V]*X,ne=V<G-1?D[V+1]*X:B.length,Q=e(B,j,ne,X,!1),Q===Q.next&&(Q.steiner=!0),N.push(g(Q));for(N.sort(l),V=0;V<N.length;V++)_=c(N[V],_);return _}function l(B,D){return B.x-D.x}function c(B,D){var _=u(B,D);if(!_)return D;var X=I(_,B);return t(X,X.next),t(_,_.next)}function u(B,D){var _=D,X=B.x,N=B.y,V=-1/0,G;do{if(N<=_.y&&N>=_.next.y&&_.next.y!==_.y){var j=_.x+(N-_.y)*(_.next.x-_.x)/(_.next.y-_.y);if(j<=X&&j>V&&(V=j,G=_.x<_.next.x?_:_.next,j===X))return G}_=_.next}while(_!==D);if(!G)return null;var ne=G,Q=G.x,de=G.y,me=1/0,we;_=G;do X>=_.x&&_.x>=Q&&X!==_.x&&v(N<de?X:V,N,Q,de,N<de?V:X,N,_.x,_.y)&&(we=Math.abs(N-_.y)/(X-_.x),P(_,B)&&(we<me||we===me&&(_.x>G.x||_.x===G.x&&d(G,_)))&&(G=_,me=we)),_=_.next;while(_!==ne);return G}function d(B,D){return y(B.prev,B,D.prev)<0&&y(D.next,B,B.next)<0}function f(B,D,_,X){var N=B;do N.z===0&&(N.z=m(N.x,N.y,D,_,X)),N.prevZ=N.prev,N.nextZ=N.next,N=N.next;while(N!==B);N.prevZ.nextZ=null,N.prevZ=null,p(N)}function p(B){var D,_,X,N,V,G,j,ne,Q=1;do{for(_=B,B=null,V=null,G=0;_;){for(G++,X=_,j=0,D=0;D<Q&&(j++,X=X.nextZ,!!X);D++);for(ne=Q;j>0||ne>0&&X;)j!==0&&(ne===0||!X||_.z<=X.z)?(N=_,_=_.nextZ,j--):(N=X,X=X.nextZ,ne--),V?V.nextZ=N:B=N,N.prevZ=V,V=N;_=X}V.nextZ=null,Q*=2}while(G>1);return B}function m(B,D,_,X,N){return B=(B-_)*N|0,D=(D-X)*N|0,B=(B|B<<8)&16711935,B=(B|B<<4)&252645135,B=(B|B<<2)&858993459,B=(B|B<<1)&1431655765,D=(D|D<<8)&16711935,D=(D|D<<4)&252645135,D=(D|D<<2)&858993459,D=(D|D<<1)&1431655765,B|D<<1}function g(B){var D=B,_=B;do(D.x<_.x||D.x===_.x&&D.y<_.y)&&(_=D),D=D.next;while(D!==B);return _}function v(B,D,_,X,N,V,G,j){return(N-G)*(D-j)>=(B-G)*(V-j)&&(B-G)*(X-j)>=(_-G)*(D-j)&&(_-G)*(V-j)>=(N-G)*(X-j)}function b(B,D){return B.next.i!==D.i&&B.prev.i!==D.i&&!R(B,D)&&(P(B,D)&&P(D,B)&&F(B,D)&&(y(B.prev,B,D.prev)||y(B,D.prev,D))||w(B,D)&&y(B.prev,B,B.next)>0&&y(D.prev,D,D.next)>0)}function y(B,D,_){return(D.y-B.y)*(_.x-D.x)-(D.x-B.x)*(_.y-D.y)}function w(B,D){return B.x===D.x&&B.y===D.y}function A(B,D,_,X){var N=M(y(B,D,_)),V=M(y(B,D,X)),G=M(y(_,X,B)),j=M(y(_,X,D));return!!(N!==V&&G!==j||N===0&&T(B,_,D)||V===0&&T(B,X,D)||G===0&&T(_,B,X)||j===0&&T(_,D,X))}function T(B,D,_){return D.x<=Math.max(B.x,_.x)&&D.x>=Math.min(B.x,_.x)&&D.y<=Math.max(B.y,_.y)&&D.y>=Math.min(B.y,_.y)}function M(B){return B>0?1:B<0?-1:0}function R(B,D){var _=B;do{if(_.i!==B.i&&_.next.i!==B.i&&_.i!==D.i&&_.next.i!==D.i&&A(_,_.next,B,D))return!0;_=_.next}while(_!==B);return!1}function P(B,D){return y(B.prev,B,B.next)<0?y(B,D,B.next)>=0&&y(B,B.prev,D)>=0:y(B,D,B.prev)<0||y(B,B.next,D)<0}function F(B,D){var _=B,X=!1,N=(B.x+D.x)/2,V=(B.y+D.y)/2;do _.y>V!=_.next.y>V&&_.next.y!==_.y&&N<(_.next.x-_.x)*(V-_.y)/(_.next.y-_.y)+_.x&&(X=!X),_=_.next;while(_!==B);return X}function I(B,D){var _=new L(B.i,B.x,B.y),X=new L(D.i,D.x,D.y),N=B.next,V=D.prev;return B.next=D,D.prev=B,_.next=N,N.prev=_,X.next=_,_.prev=X,V.next=X,X.prev=V,X}function k(B,D,_,X){var N=new L(B,D,_);return X?(N.next=X.next,N.prev=X,X.next.prev=N,X.next=N):(N.prev=N,N.next=N),N}function O(B){B.next.prev=B.prev,B.prev.next=B.next,B.prevZ&&(B.prevZ.nextZ=B.nextZ),B.nextZ&&(B.nextZ.prevZ=B.prevZ)}function L(B,D,_){this.i=B,this.x=D,this.y=_,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}s.deviation=function(B,D,_,X){var N=D&&D.length,V=N?D[0]*_:B.length,G=Math.abs(U(B,0,V,_));if(N)for(var j=0,ne=D.length;j<ne;j++){var Q=D[j]*_,de=j<ne-1?D[j+1]*_:B.length;G-=Math.abs(U(B,Q,de,_))}var me=0;for(j=0;j<X.length;j+=3){var we=X[j]*_,Re=X[j+1]*_,ge=X[j+2]*_;me+=Math.abs((B[we]-B[ge])*(B[Re+1]-B[we+1])-(B[we]-B[Re])*(B[ge+1]-B[we+1]))}return G===0&&me===0?0:Math.abs((me-G)/G)};function U(B,D,_,X){for(var N=0,V=D,G=_-X;V<_;V+=X)N+=(B[G]-B[V])*(B[V+1]+B[G+1]),G=V;return N}return s.flatten=function(B){for(var D=B[0][0].length,_={vertices:[],holes:[],dimensions:D},X=0,N=0;N<B.length;N++){for(var V=0;V<B[N].length;V++)for(var G=0;G<D;G++)_.vertices.push(B[N][V][G]);N>0&&(X+=B[N-1].length,_.holes.push(X))}return _},oc.exports}var _T=ST();const MT=Lx(_T);var ra={},il={exports:{}};/*! https://mths.be/punycode v1.4.1 by @mathias */var TT=il.exports,Yg;function AT(){return Yg||(Yg=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,M;function R(N){throw new RangeError(y[N])}function P(N,V){for(var G=N.length,j=[];G--;)j[G]=V(N[G]);return j}function F(N,V){var G=N.split("@"),j="";G.length>1&&(j=G[0]+"@",N=G[1]),N=N.replace(b,".");var ne=N.split("."),Q=P(ne,V).join(".");return j+Q}function I(N){for(var V=[],G=0,j=N.length,ne,Q;G<j;)ne=N.charCodeAt(G++),ne>=55296&&ne<=56319&&G<j?(Q=N.charCodeAt(G++),(Q&64512)==56320?V.push(((ne&1023)<<10)+(Q&1023)+65536):(V.push(ne),G--)):V.push(ne);return V}function k(N){return P(N,function(V){var G="";return V>65535&&(V-=65536,G+=T(V>>>10&1023|55296),V=56320|V&1023),G+=T(V),G}).join("")}function O(N){return N-48<10?N-22:N-65<26?N-65:N-97<26?N-97:h}function L(N,V){return N+22+75*(N<26)-((V!=0)<<5)}function U(N,V,G){var j=0;for(N=G?A(N/d):N>>1,N+=A(N/V);N>w*c>>1;j+=h)N=A(N/w);return A(j+(w+1)*N/(N+u))}function B(N){var V=[],G=N.length,j,ne=0,Q=p,de=f,me,we,Re,ge,Ae,H,K,q,z;for(me=N.lastIndexOf(m),me<0&&(me=0),we=0;we<me;++we)N.charCodeAt(we)>=128&&R("not-basic"),V.push(N.charCodeAt(we));for(Re=me>0?me+1:0;Re<G;){for(ge=ne,Ae=1,H=h;Re>=G&&R("invalid-input"),K=O(N.charCodeAt(Re++)),(K>=h||K>A((o-ne)/Ae))&&R("overflow"),ne+=K*Ae,q=H<=de?l:H>=de+c?c:H-de,!(K<q);H+=h)z=h-q,Ae>A(o/z)&&R("overflow"),Ae*=z;j=V.length+1,de=U(ne-ge,j,ge==0),A(ne/j)>o-Q&&R("overflow"),Q+=A(ne/j),ne%=j,V.splice(ne++,0,Q)}return k(V)}function D(N){var V,G,j,ne,Q,de,me,we,Re,ge,Ae,H=[],K,q,z,ee;for(N=I(N),K=N.length,V=p,G=0,Q=f,de=0;de<K;++de)Ae=N[de],Ae<128&&H.push(T(Ae));for(j=ne=H.length,ne&&H.push(m);j<K;){for(me=o,de=0;de<K;++de)Ae=N[de],Ae>=V&&Ae<me&&(me=Ae);for(q=j+1,me-V>A((o-G)/q)&&R("overflow"),G+=(me-V)*q,V=me,de=0;de<K;++de)if(Ae=N[de],Ae<V&&++G>o&&R("overflow"),Ae==V){for(we=G,Re=h;ge=Re<=Q?l:Re>=Q+c?c:Re-Q,!(we<ge);Re+=h)ee=we-ge,z=h-ge,H.push(T(L(ge+ee%z,0))),we=A(ee/z);H.push(T(L(we,0))),Q=U(G,q,j==ne),G=0,++j}++G,++V}return H.join("")}function _(N){return F(N,function(V){return g.test(V)?B(V.slice(4).toLowerCase()):V})}function X(N){return F(N,function(V){return v.test(V)?"xn--"+D(V):V})}if(a={version:"1.4.1",ucs2:{decode:I,encode:k},decode:B,encode:D,toASCII:X,toUnicode:_},i&&n)if(s.exports==i)n.exports=a;else for(M in a)a.hasOwnProperty(M)&&(i[M]=a[M]);else t.punycode=a})(TT)})(il,il.exports)),il.exports}var Ku,$g;function Lo(){return $g||($g=1,Ku=TypeError),Ku}const ET={},CT=Object.freeze(Object.defineProperty({__proto__:null,default:ET},Symbol.toStringTag,{value:"Module"})),IT=xT(CT);var Zu,Gg;function gu(){if(Gg)return Zu;Gg=1;var s=typeof Map=="function"&&Map.prototype,e=Object.getOwnPropertyDescriptor&&s?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,t=s&&e&&typeof e.get=="function"?e.get:null,i=s&&Map.prototype.forEach,n=typeof Set=="function"&&Set.prototype,r=Object.getOwnPropertyDescriptor&&n?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,a=n&&r&&typeof r.get=="function"?r.get:null,o=n&&Set.prototype.forEach,h=typeof WeakMap=="function"&&WeakMap.prototype,l=h?WeakMap.prototype.has:null,c=typeof WeakSet=="function"&&WeakSet.prototype,u=c?WeakSet.prototype.has:null,d=typeof WeakRef=="function"&&WeakRef.prototype,f=d?WeakRef.prototype.deref:null,p=Boolean.prototype.valueOf,m=Object.prototype.toString,g=Function.prototype.toString,v=String.prototype.match,b=String.prototype.slice,y=String.prototype.replace,w=String.prototype.toUpperCase,A=String.prototype.toLowerCase,T=RegExp.prototype.test,M=Array.prototype.concat,R=Array.prototype.join,P=Array.prototype.slice,F=Math.floor,I=typeof BigInt=="function"?BigInt.prototype.valueOf:null,k=Object.getOwnPropertySymbols,O=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,L=typeof Symbol=="function"&&typeof Symbol.iterator=="object",U=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===L||!0)?Symbol.toStringTag:null,B=Object.prototype.propertyIsEnumerable,D=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(ce){return ce.__proto__}:null);function _(ce,fe){if(ce===1/0||ce===-1/0||ce!==ce||ce&&ce>-1e3&&ce<1e3||T.call(/e/,fe))return fe;var It=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof ce=="number"){var Rt=ce<0?-F(-ce):F(ce);if(Rt!==ce){var Zt=String(Rt),St=b.call(fe,Zt.length+1);return y.call(Zt,It,"$&_")+"."+y.call(y.call(St,/([0-9]{3})/g,"$&_"),/_$/,"")}}return y.call(fe,It,"$&_")}var X=IT,N=X.custom,V=q(N)?N:null,G={__proto__:null,double:'"',single:"'"},j={__proto__:null,double:/(["\\])/g,single:/(['\\])/g};Zu=function ce(fe,It,Rt,Zt){var St=It||{};if(le(St,"quoteStyle")&&!le(G,St.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(le(St,"maxStringLength")&&(typeof St.maxStringLength=="number"?St.maxStringLength<0&&St.maxStringLength!==1/0:St.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var Ms=le(St,"customInspect")?St.customInspect:!0;if(typeof Ms!="boolean"&&Ms!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(le(St,"indent")&&St.indent!==null&&St.indent!==" "&&!(parseInt(St.indent,10)===St.indent&&St.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(le(St,"numericSeparator")&&typeof St.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var Ds=St.numericSeparator;if(typeof fe>"u")return"undefined";if(fe===null)return"null";if(typeof fe=="boolean")return fe?"true":"false";if(typeof fe=="string")return Ct(fe,St);if(typeof fe=="number"){if(fe===0)return 1/0/fe>0?"0":"-0";var Li=String(fe);return Ds?_(fe,Li):Li}if(typeof fe=="bigint"){var Ts=String(fe)+"n";return Ds?_(fe,Ts):Ts}var qr=typeof St.depth>"u"?5:St.depth;if(typeof Rt>"u"&&(Rt=0),Rt>=qr&&qr>0&&typeof fe=="object")return me(fe)?"[Array]":"[Object]";var on=Ls(St,Rt);if(typeof Zt>"u")Zt=[];else if(ye(Zt,fe)>=0)return"[Circular]";function Wi(_e,Me,be){if(Me&&(Zt=P.call(Zt),Zt.push(Me)),be){var Le={depth:St.depth};return le(St,"quoteStyle")&&(Le.quoteStyle=St.quoteStyle),ce(_e,Le,Rt+1,Zt)}return ce(_e,St,Rt+1,Zt)}if(typeof fe=="function"&&!Re(fe)){var Kr=re(fe),Zr=xi(fe,Wi);return"[Function"+(Kr?": "+Kr:" (anonymous)")+"]"+(Zr.length>0?" { "+R.call(Zr,", ")+" }":"")}if(q(fe)){var Ns=L?y.call(String(fe),/^(Symbol\(.*\))_[^)]*$/,"$1"):O.call(fe);return typeof fe=="object"&&!L?Et(Ns):Ns}if(bt(fe)){for(var ln="<"+A.call(String(fe.nodeName)),cn=fe.attributes||[],Nn=0;Nn<cn.length;Nn++)ln+=" "+cn[Nn].name+"="+ne(Q(cn[Nn].value),"double",St);return ln+=">",fe.childNodes&&fe.childNodes.length&&(ln+="..."),ln+="</"+A.call(String(fe.nodeName))+">",ln}if(me(fe)){if(fe.length===0)return"[]";var Jr=xi(fe,Wi);return on&&!Bi(Jr)?"["+an(Jr,on)+"]":"[ "+R.call(Jr,", ")+" ]"}if(ge(fe)){var Us=xi(fe,Wi);return!("cause"in Error.prototype)&&"cause"in fe&&!B.call(fe,"cause")?"{ ["+String(fe)+"] "+R.call(M.call("[cause]: "+Wi(fe.cause),Us),", ")+" }":Us.length===0?"["+String(fe)+"]":"{ ["+String(fe)+"] "+R.call(Us,", ")+" }"}if(typeof fe=="object"&&Ms){if(V&&typeof fe[V]=="function"&&X)return X(fe,{depth:qr-Rt});if(Ms!=="symbol"&&typeof fe.inspect=="function")return fe.inspect()}if(he(fe)){var $a=[];return i&&i.call(fe,function(_e,Me){$a.push(Wi(Me,fe,!0)+" => "+Wi(_e,fe))}),yi("Map",t.call(fe),$a,on)}if(Oe(fe)){var Qr=[];return o&&o.call(fe,function(_e){Qr.push(Wi(_e,fe))}),yi("Set",a.call(fe),Qr,on)}if(Xe(fe))return Kt("WeakMap");if(it(fe))return Kt("WeakSet");if(Pe(fe))return Kt("WeakRef");if(H(fe))return Et(Wi(Number(fe)));if(z(fe))return Et(Wi(I.call(fe)));if(K(fe))return Et(p.call(fe));if(Ae(fe))return Et(Wi(String(fe)));if(typeof window<"u"&&fe===window)return"{ [object Window] }";if(typeof globalThis<"u"&&fe===globalThis||typeof mh<"u"&&fe===mh)return"{ [object globalThis] }";if(!we(fe)&&!Re(fe)){var W=xi(fe,Wi),Y=D?D(fe)===Object.prototype:fe instanceof Object||fe.constructor===Object,J=fe instanceof Object?"":"null prototype",ie=!Y&&U&&Object(fe)===fe&&U in fe?b.call(ve(fe),8,-1):J?"Object":"",ue=Y||typeof fe.constructor!="function"?"":fe.constructor.name?fe.constructor.name+" ":"",pe=ue+(ie||J?"["+R.call(M.call([],ie||[],J||[]),": ")+"] ":"");return W.length===0?pe+"{}":on?pe+"{"+an(W,on)+"}":pe+"{ "+R.call(W,", ")+" }"}return String(fe)};function ne(ce,fe,It){var Rt=It.quoteStyle||fe,Zt=G[Rt];return Zt+ce+Zt}function Q(ce){return y.call(String(ce),/"/g,""")}function de(ce){return!U||!(typeof ce=="object"&&(U in ce||typeof ce[U]<"u"))}function me(ce){return ve(ce)==="[object Array]"&&de(ce)}function we(ce){return ve(ce)==="[object Date]"&&de(ce)}function Re(ce){return ve(ce)==="[object RegExp]"&&de(ce)}function ge(ce){return ve(ce)==="[object Error]"&&de(ce)}function Ae(ce){return ve(ce)==="[object String]"&&de(ce)}function H(ce){return ve(ce)==="[object Number]"&&de(ce)}function K(ce){return ve(ce)==="[object Boolean]"&&de(ce)}function q(ce){if(L)return ce&&typeof ce=="object"&&ce instanceof Symbol;if(typeof ce=="symbol")return!0;if(!ce||typeof ce!="object"||!O)return!1;try{return O.call(ce),!0}catch{}return!1}function z(ce){if(!ce||typeof ce!="object"||!I)return!1;try{return I.call(ce),!0}catch{}return!1}var ee=Object.prototype.hasOwnProperty||function(ce){return ce in this};function le(ce,fe){return ee.call(ce,fe)}function ve(ce){return m.call(ce)}function re(ce){if(ce.name)return ce.name;var fe=v.call(g.call(ce),/^function\s*([\w$]+)/);return fe?fe[1]:null}function ye(ce,fe){if(ce.indexOf)return ce.indexOf(fe);for(var It=0,Rt=ce.length;It<Rt;It++)if(ce[It]===fe)return It;return-1}function he(ce){if(!t||!ce||typeof ce!="object")return!1;try{t.call(ce);try{a.call(ce)}catch{return!0}return ce instanceof Map}catch{}return!1}function Xe(ce){if(!l||!ce||typeof ce!="object")return!1;try{l.call(ce,l);try{u.call(ce,u)}catch{return!0}return ce instanceof WeakMap}catch{}return!1}function Pe(ce){if(!f||!ce||typeof ce!="object")return!1;try{return f.call(ce),!0}catch{}return!1}function Oe(ce){if(!a||!ce||typeof ce!="object")return!1;try{a.call(ce);try{t.call(ce)}catch{return!0}return ce instanceof Set}catch{}return!1}function it(ce){if(!u||!ce||typeof ce!="object")return!1;try{u.call(ce,u);try{l.call(ce,l)}catch{return!0}return ce instanceof WeakSet}catch{}return!1}function bt(ce){return!ce||typeof ce!="object"?!1:typeof HTMLElement<"u"&&ce instanceof HTMLElement?!0:typeof ce.nodeName=="string"&&typeof ce.getAttribute=="function"}function Ct(ce,fe){if(ce.length>fe.maxStringLength){var It=ce.length-fe.maxStringLength,Rt="... "+It+" more character"+(It>1?"s":"");return Ct(b.call(ce,0,fe.maxStringLength),fe)+Rt}var Zt=j[fe.quoteStyle||"single"];Zt.lastIndex=0;var St=y.call(y.call(ce,Zt,"\\$1"),/[\x00-\x1f]/g,wt);return ne(St,"single",fe)}function wt(ce){var fe=ce.charCodeAt(0),It={8:"b",9:"t",10:"n",12:"f",13:"r"}[fe];return It?"\\"+It:"\\x"+(fe<16?"0":"")+w.call(fe.toString(16))}function Et(ce){return"Object("+ce+")"}function Kt(ce){return ce+" { ? }"}function yi(ce,fe,It,Rt){var Zt=Rt?an(It,Rt):R.call(It,", ");return ce+" ("+fe+") {"+Zt+"}"}function Bi(ce){for(var fe=0;fe<ce.length;fe++)if(ye(ce[fe],`
|
||
`)>=0)return!1;return!0}function Ls(ce,fe){var It;if(ce.indent===" ")It=" ";else if(typeof ce.indent=="number"&&ce.indent>0)It=R.call(Array(ce.indent+1)," ");else return null;return{base:It,prev:R.call(Array(fe+1),It)}}function an(ce,fe){if(ce.length===0)return"";var It=`
|
||
`+fe.prev+fe.base;return It+R.call(ce,","+It)+`
|
||
`+fe.prev}function xi(ce,fe){var It=me(ce),Rt=[];if(It){Rt.length=ce.length;for(var Zt=0;Zt<ce.length;Zt++)Rt[Zt]=le(ce,Zt)?fe(ce[Zt],ce):""}var St=typeof k=="function"?k(ce):[],Ms;if(L){Ms={};for(var Ds=0;Ds<St.length;Ds++)Ms["$"+St[Ds]]=St[Ds]}for(var Li in ce)le(ce,Li)&&(It&&String(Number(Li))===Li&&Li<ce.length||L&&Ms["$"+Li]instanceof Symbol||(T.call(/[^\w$]/,Li)?Rt.push(fe(Li,ce)+": "+fe(ce[Li],ce)):Rt.push(Li+": "+fe(ce[Li],ce))));if(typeof k=="function")for(var Ts=0;Ts<St.length;Ts++)B.call(ce,St[Ts])&&Rt.push("["+fe(St[Ts])+"]: "+fe(ce[St[Ts]],ce));return Rt}return Zu}var Ju,Hg;function RT(){if(Hg)return Ju;Hg=1;var s=gu(),e=Lo(),t=function(o,h,l){for(var c=o,u;(u=c.next)!=null;c=u)if(u.key===h)return c.next=u.next,l||(u.next=o.next,o.next=u),u},i=function(o,h){if(o){var l=t(o,h);return l&&l.value}},n=function(o,h,l){var c=t(o,h);c?c.value=l:o.next={key:h,next:o.next,value:l}},r=function(o,h){return o?!!t(o,h):!1},a=function(o,h){if(o)return t(o,h,!0)};return Ju=function(){var h,l={assert:function(c){if(!l.has(c))throw new e("Side channel does not contain "+s(c))},delete:function(c){var u=a(h,c);return u&&h&&!h.next&&(h=void 0),!!u},get:function(c){return i(h,c)},has:function(c){return r(h,c)},set:function(c,u){h||(h={next:void 0}),n(h,c,u)}};return l},Ju}var Qu,jg;function Dx(){return jg||(jg=1,Qu=Object),Qu}var ed,Wg;function PT(){return Wg||(Wg=1,ed=Error),ed}var td,zg;function kT(){return zg||(zg=1,td=EvalError),td}var id,qg;function FT(){return qg||(qg=1,id=RangeError),id}var sd,Kg;function OT(){return Kg||(Kg=1,sd=ReferenceError),sd}var nd,Zg;function BT(){return Zg||(Zg=1,nd=SyntaxError),nd}var rd,Jg;function LT(){return Jg||(Jg=1,rd=URIError),rd}var ad,Qg;function DT(){return Qg||(Qg=1,ad=Math.abs),ad}var od,e0;function NT(){return e0||(e0=1,od=Math.floor),od}var ld,t0;function UT(){return t0||(t0=1,ld=Math.max),ld}var cd,i0;function XT(){return i0||(i0=1,cd=Math.min),cd}var hd,s0;function VT(){return s0||(s0=1,hd=Math.pow),hd}var ud,n0;function YT(){return n0||(n0=1,ud=Math.round),ud}var dd,r0;function $T(){return r0||(r0=1,dd=Number.isNaN||function(e){return e!==e}),dd}var fd,a0;function GT(){if(a0)return fd;a0=1;var s=$T();return fd=function(t){return s(t)||t===0?t:t<0?-1:1},fd}var md,o0;function HT(){return o0||(o0=1,md=Object.getOwnPropertyDescriptor),md}var pd,l0;function Nx(){if(l0)return pd;l0=1;var s=HT();if(s)try{s([],"length")}catch{s=null}return pd=s,pd}var gd,c0;function Ux(){if(c0)return gd;c0=1;var s=Object.defineProperty||!1;if(s)try{s({},"a",{value:1})}catch{s=!1}return gd=s,gd}var vd,h0;function jT(){return h0||(h0=1,vd=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},t=Symbol("test"),i=Object(t);if(typeof t=="string"||Object.prototype.toString.call(t)!=="[object Symbol]"||Object.prototype.toString.call(i)!=="[object Symbol]")return!1;var n=42;e[t]=n;for(var r in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var a=Object.getOwnPropertySymbols(e);if(a.length!==1||a[0]!==t||!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var o=Object.getOwnPropertyDescriptor(e,t);if(o.value!==n||o.enumerable!==!0)return!1}return!0}),vd}var yd,u0;function WT(){if(u0)return yd;u0=1;var s=typeof Symbol<"u"&&Symbol,e=jT();return yd=function(){return typeof s!="function"||typeof Symbol!="function"||typeof s("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:e()},yd}var xd,d0;function Xx(){return d0||(d0=1,xd=typeof Reflect<"u"&&Reflect.getPrototypeOf||null),xd}var bd,f0;function Vx(){if(f0)return bd;f0=1;var s=Dx();return bd=s.getPrototypeOf||null,bd}var wd,m0;function zT(){if(m0)return wd;m0=1;var s="Function.prototype.bind called on incompatible ",e=Object.prototype.toString,t=Math.max,i="[object Function]",n=function(h,l){for(var c=[],u=0;u<h.length;u+=1)c[u]=h[u];for(var d=0;d<l.length;d+=1)c[d+h.length]=l[d];return c},r=function(h,l){for(var c=[],u=l,d=0;u<h.length;u+=1,d+=1)c[d]=h[u];return c},a=function(o,h){for(var l="",c=0;c<o.length;c+=1)l+=o[c],c+1<o.length&&(l+=h);return l};return wd=function(h){var l=this;if(typeof l!="function"||e.apply(l)!==i)throw new TypeError(s+l);for(var c=r(arguments,1),u,d=function(){if(this instanceof u){var v=l.apply(this,n(c,arguments));return Object(v)===v?v:this}return l.apply(h,n(c,arguments))},f=t(0,l.length-c.length),p=[],m=0;m<f;m++)p[m]="$"+m;if(u=Function("binder","return function ("+a(p,",")+"){ return binder.apply(this,arguments); }")(d),l.prototype){var g=function(){};g.prototype=l.prototype,u.prototype=new g,g.prototype=null}return u},wd}var Sd,p0;function vu(){if(p0)return Sd;p0=1;var s=zT();return Sd=Function.prototype.bind||s,Sd}var _d,g0;function dp(){return g0||(g0=1,_d=Function.prototype.call),_d}var Md,v0;function Yx(){return v0||(v0=1,Md=Function.prototype.apply),Md}var Td,y0;function qT(){return y0||(y0=1,Td=typeof Reflect<"u"&&Reflect&&Reflect.apply),Td}var Ad,x0;function KT(){if(x0)return Ad;x0=1;var s=vu(),e=Yx(),t=dp(),i=qT();return Ad=i||s.call(t,e),Ad}var Ed,b0;function $x(){if(b0)return Ed;b0=1;var s=vu(),e=Lo(),t=dp(),i=KT();return Ed=function(r){if(r.length<1||typeof r[0]!="function")throw new e("a function is required");return i(s,t,r)},Ed}var Cd,w0;function ZT(){if(w0)return Cd;w0=1;var s=$x(),e=Nx(),t;try{t=[].__proto__===Array.prototype}catch(a){if(!a||typeof a!="object"||!("code"in a)||a.code!=="ERR_PROTO_ACCESS")throw a}var i=!!t&&e&&e(Object.prototype,"__proto__"),n=Object,r=n.getPrototypeOf;return Cd=i&&typeof i.get=="function"?s([i.get]):typeof r=="function"?function(o){return r(o==null?o:n(o))}:!1,Cd}var Id,S0;function JT(){if(S0)return Id;S0=1;var s=Xx(),e=Vx(),t=ZT();return Id=s?function(n){return s(n)}:e?function(n){if(!n||typeof n!="object"&&typeof n!="function")throw new TypeError("getProto: not an object");return e(n)}:t?function(n){return t(n)}:null,Id}var Rd,_0;function QT(){if(_0)return Rd;_0=1;var s=Function.prototype.call,e=Object.prototype.hasOwnProperty,t=vu();return Rd=t.call(s,e),Rd}var Pd,M0;function fp(){if(M0)return Pd;M0=1;var s,e=Dx(),t=PT(),i=kT(),n=FT(),r=OT(),a=BT(),o=Lo(),h=LT(),l=DT(),c=NT(),u=UT(),d=XT(),f=VT(),p=YT(),m=GT(),g=Function,v=function(Re){try{return g('"use strict"; return ('+Re+").constructor;")()}catch{}},b=Nx(),y=Ux(),w=function(){throw new o},A=b?(function(){try{return arguments.callee,w}catch{try{return b(arguments,"callee").get}catch{return w}}})():w,T=WT()(),M=JT(),R=Vx(),P=Xx(),F=Yx(),I=dp(),k={},O=typeof Uint8Array>"u"||!M?s:M(Uint8Array),L={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?s:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?s:ArrayBuffer,"%ArrayIteratorPrototype%":T&&M?M([][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&&M?M(M([][Symbol.iterator]())):s,"%JSON%":typeof JSON=="object"?JSON:s,"%Map%":typeof Map>"u"?s:Map,"%MapIteratorPrototype%":typeof Map>"u"||!T||!M?s:M(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||!M?s:M(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?s:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":T&&M?M(""[Symbol.iterator]()):s,"%Symbol%":T?Symbol:s,"%SyntaxError%":a,"%ThrowTypeError%":A,"%TypedArray%":O,"%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(M)try{null.error}catch(Re){var U=M(M(Re));L["%Error.prototype%"]=U}var B=function Re(ge){var Ae;if(ge==="%AsyncFunction%")Ae=v("async function () {}");else if(ge==="%GeneratorFunction%")Ae=v("function* () {}");else if(ge==="%AsyncGeneratorFunction%")Ae=v("async function* () {}");else if(ge==="%AsyncGenerator%"){var H=Re("%AsyncGeneratorFunction%");H&&(Ae=H.prototype)}else if(ge==="%AsyncIteratorPrototype%"){var K=Re("%AsyncGenerator%");K&&M&&(Ae=M(K.prototype))}return L[ge]=Ae,Ae},D={__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"]},_=vu(),X=QT(),N=_.call(I,Array.prototype.concat),V=_.call(F,Array.prototype.splice),G=_.call(I,String.prototype.replace),j=_.call(I,String.prototype.slice),ne=_.call(I,RegExp.prototype.exec),Q=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,de=/\\(\\)?/g,me=function(ge){var Ae=j(ge,0,1),H=j(ge,-1);if(Ae==="%"&&H!=="%")throw new a("invalid intrinsic syntax, expected closing `%`");if(H==="%"&&Ae!=="%")throw new a("invalid intrinsic syntax, expected opening `%`");var K=[];return G(ge,Q,function(q,z,ee,le){K[K.length]=ee?G(le,de,"$1"):z||q}),K},we=function(ge,Ae){var H=ge,K;if(X(D,H)&&(K=D[H],H="%"+K[0]+"%"),X(L,H)){var q=L[H];if(q===k&&(q=B(H)),typeof q>"u"&&!Ae)throw new o("intrinsic "+ge+" exists, but is not available. Please file an issue!");return{alias:K,name:H,value:q}}throw new a("intrinsic "+ge+" does not exist!")};return Pd=function(ge,Ae){if(typeof ge!="string"||ge.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(ne(/^%?[^%]*%?$/,ge)===null)throw new a("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var H=me(ge),K=H.length>0?H[0]:"",q=we("%"+K+"%",Ae),z=q.name,ee=q.value,le=!1,ve=q.alias;ve&&(K=ve[0],V(H,N([0,1],ve)));for(var re=1,ye=!0;re<H.length;re+=1){var he=H[re],Xe=j(he,0,1),Pe=j(he,-1);if((Xe==='"'||Xe==="'"||Xe==="`"||Pe==='"'||Pe==="'"||Pe==="`")&&Xe!==Pe)throw new a("property names with quotes must have matching quotes");if((he==="constructor"||!ye)&&(le=!0),K+="."+he,z="%"+K+"%",X(L,z))ee=L[z];else if(ee!=null){if(!(he in ee)){if(!Ae)throw new o("base intrinsic for "+ge+" exists, but the property is not available.");return}if(b&&re+1>=H.length){var Oe=b(ee,he);ye=!!Oe,ye&&"get"in Oe&&!("originalValue"in Oe.get)?ee=Oe.get:ee=ee[he]}else ye=X(ee,he),ee=ee[he];ye&&!le&&(L[z]=ee)}}return ee},Pd}var kd,T0;function Gx(){if(T0)return kd;T0=1;var s=fp(),e=$x(),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,A0;function Hx(){if(A0)return Fd;A0=1;var s=fp(),e=Gx(),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,E0;function e2(){if(E0)return Od;E0=1;var s=fp(),e=Gx(),t=gu(),i=Hx(),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,C0;function jx(){if(C0)return Bd;C0=1;var s=Lo(),e=gu(),t=RT(),i=Hx(),n=e2(),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,I0;function mp(){if(I0)return Ld;I0=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,R0;function Wx(){if(R0)return Dd;R0=1;var s=mp(),e=jx(),t=Ux(),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=[],O=0;O<I.length;++O)typeof I[O]<"u"&&(k[k.length]=I[O]);F.obj[F.prop]=k}}},d=function(P,F){for(var I=F&&F.plainObjects?{__proto__:null}:{},k=0;k<P.length;++k)typeof P[k]<"u"&&(I[k]=P[k]);return I},f=function(P,F,I){F==="__proto__"&&t?t(P,F,{configurable:!0,enumerable:!0,value:I,writable:!0}):P[F]=I},p=function R(P,F,I){if(!F)return P;if(typeof F!="object"&&typeof F!="function"){if(n(P)){var k=P.length;if(I&&typeof I.arrayLimit=="number"&&k>=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 O=h(P)+1;P[O]=F,l(P,O)}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 L=Object.keys(F),U=I&&I.plainObjects?{__proto__:null,0:P}:{0:P},B=0;B<L.length;B++){var D=parseInt(L[B],10);U[D+1]=F[L[B]]}return a(U,h(F)+1)}var _=[P].concat(F);if(I&&typeof I.arrayLimit=="number"&&_.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(_,I),_.length-1)}return _}var X=P;if(n(P)&&!n(F)&&(X=d(P,I)),n(P)&&n(F)){if(F.forEach(function(N,V){if(i.call(P,V)){var G=P[V];G&&typeof G=="object"&&N&&typeof N=="object"?P[V]=R(G,N,I):P[P.length]=N}else P[V]=N}),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(N,V){var G=F[V];if(i.call(N,V)?f(N,V,R(N[V],G,I)):f(N,V,G),o(F)&&!o(N)&&a(N,h(F)),o(N)){var j=parseInt(V,10);String(j)===V&&j>=0&&j>h(N)&&l(N,j)}return N},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,O){if(P.length===0)return P;var L=P;if(typeof P=="symbol"?L=Symbol.prototype.toString.call(P):typeof P!="string"&&(L=String(P)),I==="iso-8859-1")return escape(L).replace(/%u[0-9a-f]{4}/gi,function(G){return"%26%23"+parseInt(G.slice(2),16)+"%3B"});for(var U="",B=0;B<L.length;B+=v){var D=L.length>=v?L.slice(B,B+v):L;if(B+v<L.length){var _=D.charCodeAt(D.length-1);_>=55296&&_<=56319&&(D=D.slice(0,-1),B-=1)}for(var X=[],N=0;N<D.length;++N){var V=D.charCodeAt(N);if(V===45||V===46||V===95||V===126||V>=48&&V<=57||V>=65&&V<=90||V>=97&&V<=122||O===s.RFC1738&&(V===40||V===41)){X[X.length]=D.charAt(N);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}N+=1,V=65536+((V&1023)<<10|D.charCodeAt(N)&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;k<F.length;++k)for(var O=F[k],L=O.obj[O.prop],U=Object.keys(L),B=0;B<U.length;++B){var D=U[B],_=L[D];typeof _=="object"&&_!==null&&!I.has(_)&&(F[F.length]={obj:L,prop:D},I.set(_,!0))}return u(F),P},w=function(P){return Object.prototype.toString.call(P)==="[object RegExp]"},A=function(P){return!P||typeof P!="object"?!1:!!(P.constructor&&P.constructor.isBuffer&&P.constructor.isBuffer(P))},T=function(P,F,I,k,O){if(o(P)){if(O)throw new RangeError("Array limit exceeded. Only "+I+" element"+(I===1?"":"s")+" allowed in an array.");var L=h(P)+1;return P[L]=F,l(P,L),P}var U=[].concat(P,F);if(U.length>I){if(O)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},M=function(P,F){if(n(P)){for(var I=[],k=0;k<P.length;k+=1)I[I.length]=F(P[k]);return I}return F(P)};return Dd={arrayToObject:d,assign:m,combine:T,compact:y,decode:g,encode:b,isBuffer:A,isOverflow:o,isRegExp:w,markOverflow:a,maybeMap:M,merge:p},Dd}var Nd,P0;function t2(){if(P0)return Nd;P0=1;var s=jx(),e=Wx(),t=mp(),i=Object.prototype.hasOwnProperty,n={brackets:function(g){return g+"[]"},comma:"comma",indices:function(g,v){return g+"["+v+"]"},repeat:function(g){return g}},r=Array.isArray,a=Array.prototype.push,o=function(m,g){a.apply(m,r(g)?g:[g])},h=Date.prototype.toISOString,l=t.default,c={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,commaRoundTrip:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:e.encode,encodeValuesOnly:!1,filter:void 0,format:l,formatter:t.formatters[l],indices:!1,serializeDate:function(g){return h.call(g)},skipNulls:!1,strictNullHandling:!1},u=function(g){return typeof g=="string"||typeof g=="number"||typeof g=="boolean"||typeof g=="symbol"||typeof g=="bigint"},d={},f=function m(g,v,b,y,w,A,T,M,R,P,F,I,k,O,L,U,B,D){for(var _=g,X=D,N=0,V=!1;(X=X.get(d))!==void 0&&!V;){var G=X.get(g);if(N+=1,typeof G<"u"){if(G===N)throw new RangeError("Cyclic object value");V=!0}typeof X.get(d)>"u"&&(N=0)}if(typeof P=="function"?_=P(v,_):_ instanceof Date?_=k(_):b==="comma"&&r(_)&&(_=e.maybeMap(_,function(z){return z instanceof Date?k(z):z})),_===null){if(A)return L(R&&!U?R(v,c.encoder,B,"key",O):v);_=""}if(u(_)||e.isBuffer(_)){if(R){var j=U?v:R(v,c.encoder,B,"key",O);return[L(j)+"="+L(R(_,c.encoder,B,"value",O))]}return[L(v)+"="+L(String(_))]}var ne=[];if(typeof _>"u")return ne;var Q;if(b==="comma"&&r(_))U&&R&&(_=e.maybeMap(_,function(z){return z==null?z:R(z)})),Q=[{value:_.length>0?_.join(",")||null:void 0}];else if(r(P))Q=P;else{var de=Object.keys(_);Q=F?de.sort(F):de}var me=M?String(v).replace(/\./g,"%2E"):String(v),we=y&&r(_)&&_.length===1?me+"[]":me;if(w&&r(_)&&_.length===0)return we+"[]";for(var Re=0;Re<Q.length;++Re){var ge=Q[Re],Ae=typeof ge=="object"&&ge&&typeof ge.value<"u"?ge.value:_[ge];if(!(T&&Ae===null)){var H=I&&M?String(ge).replace(/\./g,"%2E"):String(ge),K=r(_)?typeof b=="function"?b(we,H):we:we+(I?"."+H:"["+H+"]");D.set(g,N);var q=s();q.set(d,D),o(ne,m(Ae,K,b,y,w,A,T,M,b==="comma"&&U&&r(_)?null:R,P,F,I,k,O,L,U,B,q))}}return ne},p=function(g){if(!g)return c;if(typeof g.allowEmptyArrays<"u"&&typeof g.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof g.encodeDotInKeys<"u"&&typeof g.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(g.encoder!==null&&typeof g.encoder<"u"&&typeof g.encoder!="function")throw new TypeError("Encoder has to be a function.");var v=g.charset||c.charset;if(typeof g.charset<"u"&&g.charset!=="utf-8"&&g.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var b=t.default;if(typeof g.format<"u"){if(!i.call(t.formatters,g.format))throw new TypeError("Unknown format option provided.");b=g.format}var y=t.formatters[b],w=c.filter;(typeof g.filter=="function"||r(g.filter))&&(w=g.filter);var A;if(g.arrayFormat in n?A=g.arrayFormat:"indices"in g?A=g.indices?"indices":"repeat":A=c.arrayFormat,"commaRoundTrip"in g&&typeof g.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var T=typeof g.allowDots>"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],M=T==="comma"&&b.commaRoundTrip;y||(y=Object.keys(v)),b.sort&&y.sort(b.sort);for(var R=s(),P=0;P<y.length;++P){var F=y[P];if(!(typeof F>"u"||F===null)){var I=v[F];b.skipNulls&&I===null||o(A,f(I,F,T,M,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),O=b.addQueryPrefix===!0?"?":"";return b.charsetSentinel&&(b.charset==="iso-8859-1"?O+="utf8=%26%2310003%3B"+b.delimiter:O+="utf8=%E2%9C%93"+b.delimiter),k.length>0?O+k:""},Nd}var Ud,k0;function i2(){if(k0)return Ud;k0=1;var s=Wx(),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<y.length;++A)y[A].indexOf("utf8=")===0&&(y[A]===o?T="utf-8":y[A]===a&&(T="iso-8859-1"),w=A,A=y.length);for(A=0;A<y.length;++A)if(A!==w){var M=y[A],R=M.indexOf("]="),P=R===-1?M.indexOf("="):R+1,F,I;if(P===-1?(F=m.decoder(M,i.decoder,T,"key"),I=m.strictNullHandling?null:""):(F=m.decoder(M.slice(0,P),i.decoder,T,"key"),F!==null&&(I=s.maybeMap(r(M.slice(P+1),m,t(g[F])?g[F].length:0,M.indexOf("[]=")===-1),function(O){return m.decoder(O,i.decoder,T,"value")}))),I&&m.interpretNumericEntities&&T==="iso-8859-1"&&(I=n(String(I))),M.indexOf("[]=")>-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"||M.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 M=T.charAt(0)==="["&&T.charAt(T.length-1)==="]"?T.slice(1,-1):T,R=m.decodeDotInKeys?M.replace(/%2E/g,"."):M,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<m.arrayLimit)A=[],A[P]=y;else{if(F&&m.throwOnLimitExceeded)throw new RangeError("Array limit exceeded. Only "+m.arrayLimit+" element"+(m.arrayLimit===1?"":"s")+" allowed in an array.");F?(A[P]=y,s.markOverflow(A,P)):R!=="__proto__"&&(A[R]=y)}}y=A}return y},c=function(p,m){var g=m.allowDots?p.replace(/\.([^.[]+)/g,"[$1]"):p;if(m.depth<=0)return!m.plainObjects&&e.call(Object.prototype,g)&&!m.allowPrototypes?void 0:[g];var v=[],b=g.indexOf("["),y=b>=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<m.depth;){for(var M=1,R=A+1,P=-1;R<w&&P<0;){var F=g.charCodeAt(R);F===91?M+=1:F===93&&(M-=1,M===0&&(P=R)),R+=1}if(P<0)return v[v.length]="["+g.slice(A)+"]",v;var I=g.slice(A,P+1),k=I.slice(1,-1);if(!m.plainObjects&&e.call(Object.prototype,k)&&!m.allowPrototypes)return;v[v.length]=I,T+=1,A=g.indexOf("[",P+1)}if(A>=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<b.length;++y){var w=b[y],A=u(w,g[w],m,typeof f=="string");v=s.merge(v,A,m)}return m.allowSparse===!0?v:s.compact(v)},Ud}var Xd,F0;function s2(){if(F0)return Xd;F0=1;var s=t2(),e=i2(),t=mp();return Xd={formats:t,parse:e,stringify:s},Xd}var O0;function n2(){if(O0)return ra;O0=1;var s=AT();function e(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}var t=/^([a-z0-9.+-]+:)/i,i=/:[0-9]*$/,n=/^(\/\/?(?!\/)[^?\s]*)(\?[^\s]*)?$/,r=["<",">",'"',"`"," ","\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=s2();function v(A,T,M){if(A&&typeof A=="object"&&A instanceof e)return A;var R=new e;return R.parse(A,T,M),R}e.prototype.parse=function(A,T,M){if(typeof A!="string")throw new TypeError("Parameter 'url' must be a string, not "+typeof A);var R=A.indexOf("?"),P=R!==-1&&R<A.indexOf("#")?"?":"#",F=A.split(P),I=/\\/g;F[0]=F[0].replace(I,"/"),A=F.join(P);var k=A;if(k=k.trim(),!M&&A.split("#").length===1){var O=n.exec(k);if(O)return this.path=k,this.href=k,this.pathname=O[1],O[2]?(this.search=O[2],T?this.query=g.parse(this.search.substr(1)):this.query=this.search.substr(1)):T&&(this.search="",this.query={}),this}var L=t.exec(k);if(L){L=L[0];var U=L.toLowerCase();this.protocol=U,k=k.substr(L.length)}if(M||L||k.match(/^\/\/[^@/]+@[^@/]+/)){var B=k.substr(0,2)==="//";B&&!(L&&p[L])&&(k=k.substr(2),this.slashes=!0)}if(!p[L]&&(B||L&&!m[L])){for(var D=-1,_=0;_<l.length;_++){var X=k.indexOf(l[_]);X!==-1&&(D===-1||X<D)&&(D=X)}var N,V;D===-1?V=k.lastIndexOf("@"):V=k.lastIndexOf("@",D),V!==-1&&(N=k.slice(0,V),k=k.slice(V+1),this.auth=decodeURIComponent(N)),D=-1;for(var _=0;_<h.length;_++){var X=k.indexOf(h[_]);X!==-1&&(D===-1||X<D)&&(D=X)}D===-1&&(D=k.length),this.host=k.slice(0,D),k=k.slice(D),this.parseHost(),this.hostname=this.hostname||"";var G=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!G)for(var j=this.hostname.split(/\./),_=0,ne=j.length;_<ne;_++){var Q=j[_];if(Q&&!Q.match(u)){for(var de="",me=0,we=Q.length;me<we;me++)Q.charCodeAt(me)>127?de+="x":de+=Q[me];if(!de.match(u)){var Re=j.slice(0,_),ge=j.slice(_+1),Ae=Q.match(d);Ae&&(Re.push(Ae[1]),ge.unshift(Ae[2])),ge.length&&(k="/"+ge.join(".")+k),this.hostname=Re.join(".");break}}}this.hostname.length>c?this.hostname="":this.hostname=this.hostname.toLowerCase(),G||(this.hostname=s.toASCII(this.hostname));var H=this.port?":"+this.port:"",K=this.hostname||"";this.host=K+H,this.href+=this.host,G&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),k[0]!=="/"&&(k="/"+k))}if(!f[U])for(var _=0,ne=o.length;_<ne;_++){var q=o[_];if(k.indexOf(q)!==-1){var z=encodeURIComponent(q);z===q&&(z=escape(q)),k=k.split(q).join(z)}}var ee=k.indexOf("#");ee!==-1&&(this.hash=k.substr(ee),k=k.slice(0,ee));var le=k.indexOf("?");if(le!==-1?(this.search=k.substr(le),this.query=k.substr(le+1),T&&(this.query=g.parse(this.query)),k=k.slice(0,le)):T&&(this.search="",this.query={}),k&&(this.pathname=k),m[U]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var H=this.pathname||"",ve=this.search||"";this.path=H+ve}return this.href=this.format(),this};function b(A){return typeof A=="string"&&(A=v(A)),A instanceof e?A.format():e.prototype.format.call(A)}e.prototype.format=function(){var A=this.auth||"";A&&(A=encodeURIComponent(A),A=A.replace(/%3A/i,":"),A+="@");var T=this.protocol||"",M=this.pathname||"",R=this.hash||"",P=!1,F="";this.host?P=A+this.host:this.hostname&&(P=A+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&(P+=":"+this.port)),this.query&&typeof this.query=="object"&&Object.keys(this.query).length&&(F=g.stringify(this.query,{arrayFormat:"repeat",addQueryPrefix:!1}));var I=this.search||F&&"?"+F||"";return T&&T.substr(-1)!==":"&&(T+=":"),this.slashes||(!T||m[T])&&P!==!1?(P="//"+(P||""),M&&M.charAt(0)!=="/"&&(M="/"+M)):P||(P=""),R&&R.charAt(0)!=="#"&&(R="#"+R),I&&I.charAt(0)!=="?"&&(I="?"+I),M=M.replace(/[?#]/g,function(k){return encodeURIComponent(k)}),I=I.replace("#","%23"),T+P+M+I+R};function y(A,T){return v(A,!1,!0).resolve(T)}e.prototype.resolve=function(A){return this.resolveObject(v(A,!1,!0)).format()};function w(A,T){return A?v(A,!1,!0).resolveObject(T):T}return e.prototype.resolveObject=function(A){if(typeof A=="string"){var T=new e;T.parse(A,!1,!0),A=T}for(var M=new e,R=Object.keys(this),P=0;P<R.length;P++){var F=R[P];M[F]=this[F]}if(M.hash=A.hash,A.href==="")return M.href=M.format(),M;if(A.slashes&&!A.protocol){for(var I=Object.keys(A),k=0;k<I.length;k++){var O=I[k];O!=="protocol"&&(M[O]=A[O])}return m[M.protocol]&&M.hostname&&!M.pathname&&(M.pathname="/",M.path=M.pathname),M.href=M.format(),M}if(A.protocol&&A.protocol!==M.protocol){if(!m[A.protocol]){for(var L=Object.keys(A),U=0;U<L.length;U++){var B=L[U];M[B]=A[B]}return M.href=M.format(),M}if(M.protocol=A.protocol,!A.host&&!p[A.protocol]){for(var ne=(A.pathname||"").split("/");ne.length&&!(A.host=ne.shift()););A.host||(A.host=""),A.hostname||(A.hostname=""),ne[0]!==""&&ne.unshift(""),ne.length<2&&ne.unshift(""),M.pathname=ne.join("/")}else M.pathname=A.pathname;if(M.search=A.search,M.query=A.query,M.host=A.host||"",M.auth=A.auth,M.hostname=A.hostname||A.host,M.port=A.port,M.pathname||M.search){var D=M.pathname||"",_=M.search||"";M.path=D+_}return M.slashes=M.slashes||A.slashes,M.href=M.format(),M}var X=M.pathname&&M.pathname.charAt(0)==="/",N=A.host||A.pathname&&A.pathname.charAt(0)==="/",V=N||X||M.host&&A.pathname,G=V,j=M.pathname&&M.pathname.split("/")||[],ne=A.pathname&&A.pathname.split("/")||[],Q=M.protocol&&!m[M.protocol];if(Q&&(M.hostname="",M.port=null,M.host&&(j[0]===""?j[0]=M.host:j.unshift(M.host)),M.host="",A.protocol&&(A.hostname=null,A.port=null,A.host&&(ne[0]===""?ne[0]=A.host:ne.unshift(A.host)),A.host=null),V=V&&(ne[0]===""||j[0]==="")),N)M.host=A.host||A.host===""?A.host:M.host,M.hostname=A.hostname||A.hostname===""?A.hostname:M.hostname,M.search=A.search,M.query=A.query,j=ne;else if(ne.length)j||(j=[]),j.pop(),j=j.concat(ne),M.search=A.search,M.query=A.query;else if(A.search!=null){if(Q){M.host=j.shift(),M.hostname=M.host;var de=M.host&&M.host.indexOf("@")>0?M.host.split("@"):!1;de&&(M.auth=de.shift(),M.hostname=de.shift(),M.host=M.hostname)}return M.search=A.search,M.query=A.query,(M.pathname!==null||M.search!==null)&&(M.path=(M.pathname?M.pathname:"")+(M.search?M.search:"")),M.href=M.format(),M}if(!j.length)return M.pathname=null,M.search?M.path="/"+M.search:M.path=null,M.href=M.format(),M;for(var me=j.slice(-1)[0],we=(M.host||A.host||j.length>1)&&(me==="."||me==="..")||me==="",Re=0,ge=j.length;ge>=0;ge--)me=j[ge],me==="."?j.splice(ge,1):me===".."?(j.splice(ge,1),Re++):Re&&(j.splice(ge,1),Re--);if(!V&&!G)for(;Re--;Re)j.unshift("..");V&&j[0]!==""&&(!j[0]||j[0].charAt(0)!=="/")&&j.unshift(""),we&&j.join("/").substr(-1)!=="/"&&j.push("");var Ae=j[0]===""||j[0]&&j[0].charAt(0)==="/";if(Q){M.hostname=Ae?"":j.length?j.shift():"",M.host=M.hostname;var de=M.host&&M.host.indexOf("@")>0?M.host.split("@"):!1;de&&(M.auth=de.shift(),M.hostname=de.shift(),M.host=M.hostname)}return V=V||M.host&&j.length,V&&!Ae&&j.unshift(""),j.length>0?M.pathname=j.join("/"):(M.pathname=null,M.path=null),(M.pathname!==null||M.search!==null)&&(M.path=(M.pathname?M.pathname:"")+(M.search?M.search:"")),M.auth=A.auth||M.auth,M.slashes=M.slashes||A.slashes,M.href=M.format(),M},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)},ra.parse=v,ra.resolve=y,ra.resolveObject=w,ra.format=b,ra.Url=e,ra}n2();const B0={};function kt(s,e,t=3){if(B0[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))),B0[e]=!0}function Xs(s){if(typeof s!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(s)}`)}function Wo(s){return s.split("?")[0].split("#")[0]}function r2(s){return s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function a2(s,e,t){return s.replace(new RegExp(r2(e),"g"),t)}function o2(s,e){let t="",i=0,n=-1,r=0,a=-1;for(let o=0;o<=s.length;++o){if(o<s.length)a=s.charCodeAt(o);else{if(a===47)break;a=47}if(a===47){if(!(n===o-1||r===1))if(n!==o-1&&r===2){if(t.length<2||i!==2||t.charCodeAt(t.length-1)!==46||t.charCodeAt(t.length-2)!==46){if(t.length>2){const h=t.lastIndexOf("/");if(h!==t.length-1){h===-1?(t="",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 Si={toPosix(s){return a2(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){Xs(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(Xs(s),this.isDataUrl(s)||this.isBlobUrl(s))return s;const i=Wo(this.toPosix(e??We.ADAPTER.getBaseUrl())),n=Wo(this.toPosix(t??this.rootname(i)));return s=this.toPosix(s),s.startsWith("/")?Si.join(n,s.slice(1)):this.isAbsolute(s)?s:this.join(i,s)},normalize(s){if(Xs(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=o2(s),s.length>0&&i&&(s+="/"),t?`/${s}`:e+s},isAbsolute(s){return Xs(s),s=this.toPosix(s),this.hasProtocol(s)?!0:s.startsWith("/")},join(...s){if(s.length===0)return".";let e;for(let t=0;t<s.length;++t){const i=s[t];if(Xs(i),i.length>0)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(Xs(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){Xs(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){Xs(s),e&&Xs(e),s=Wo(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){Xs(s),s=Wo(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){Xs(s);const e={root:"",dir:"",base:"",ext:"",name:""};if(s.length===0)return e;s=Wo(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 l2(){return Vd??(Vd=(async()=>{var r;const s=document.createElement("canvas").getContext("webgl");if(!s)return Xi.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 Xi.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]?Xi.PMA:Xi.UNPACK})()),Vd}let Yd;function c2(){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 h2={grad:.9,turn:360,rad:360/(2*Math.PI)},Yn=function(s){return typeof s=="string"?s.length>0:typeof s=="number"},Ui=function(s,e,t){return e===void 0&&(e=0),t===void 0&&(t=Math.pow(10,e)),Math.round(t*s)/t+0},Fs=function(s,e,t){return e===void 0&&(e=0),t===void 0&&(t=1),s>t?t:s>e?s:e},zx=function(s){return(s=isFinite(s)?s%360:0)>0?s:s+360},L0=function(s){return{r:Fs(s.r,0,255),g:Fs(s.g,0,255),b:Fs(s.b,0,255),a:Fs(s.a)}},$d=function(s){return{r:Ui(s.r),g:Ui(s.g),b:Ui(s.b),a:Ui(s.a,3)}},u2=/^#([0-9a-f]{3,8})$/i,lc=function(s){var e=s.toString(16);return e.length<2?"0"+e:e},qx=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}},Kx=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}},D0=function(s){return{h:zx(s.h),s:Fs(s.s,0,100),l:Fs(s.l,0,100),a:Fs(s.a)}},N0=function(s){return{h:Ui(s.h),s:Ui(s.s),l:Ui(s.l),a:Ui(s.a,3)}},U0=function(s){return Kx((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},gl=function(s){return{h:(e=qx(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},d2=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,f2=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,m2=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,p2=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Yf={string:[[function(s){var e=u2.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?Ui(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?Ui(parseInt(s.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(s){var e=m2.exec(s)||p2.exec(s);return e?e[2]!==e[4]||e[4]!==e[6]?null:L0({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=d2.exec(s)||f2.exec(s);if(!e)return null;var t,i,n=D0({h:(t=e[1],i=e[2],i===void 0&&(i="deg"),Number(t)*(h2[i]||1)),s:Number(e[3]),l:Number(e[4]),a:e[5]===void 0?1:Number(e[5])/(e[6]?100:1)});return U0(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 Yn(e)&&Yn(t)&&Yn(i)?L0({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(!Yn(e)||!Yn(t)||!Yn(i))return null;var a=D0({h:Number(e),s:Number(t),l:Number(i),a:Number(r)});return U0(a)},"hsl"],[function(s){var e=s.h,t=s.s,i=s.v,n=s.a,r=n===void 0?1:n;if(!Yn(e)||!Yn(t)||!Yn(i))return null;var a=(function(o){return{h:zx(o.h),s:Fs(o.s,0,100),v:Fs(o.v,0,100),a:Fs(o.a)}})({h:Number(e),s:Number(t),v:Number(i),a:Number(r)});return Kx(a)},"hsv"]]},X0=function(s,e){for(var t=0;t<e.length;t++){var i=e[t][0](s);if(i)return[i,e[t][1]]}return[null,void 0]},g2=function(s){return typeof s=="string"?X0(s.trim(),Yf.string):typeof s=="object"&&s!==null?X0(s,Yf.object):[null,void 0]},Gd=function(s,e){var t=gl(s);return{h:t.h,s:Fs(t.s+100*e,0,100),l:t.l,a:t.a}},Hd=function(s){return(299*s.r+587*s.g+114*s.b)/1e3/255},V0=function(s,e){var t=gl(s);return{h:t.h,s:t.s,l:Fs(t.l+100*e,0,100),a:t.a}},$f=(function(){function s(e){this.parsed=g2(e)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return s.prototype.isValid=function(){return this.parsed!==null},s.prototype.brightness=function(){return Ui(Hd(this.rgba),2)},s.prototype.isDark=function(){return Hd(this.rgba)<.5},s.prototype.isLight=function(){return Hd(this.rgba)>=.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(Ui(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 N0(gl(this.rgba))},s.prototype.toHslString=function(){return e=N0(gl(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=qx(this.rgba),{h:Ui(e.h),s:Ui(e.s),v:Ui(e.v),a:Ui(e.a,3)};var e},s.prototype.invert=function(){return un({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),un(Gd(this.rgba,e))},s.prototype.desaturate=function(e){return e===void 0&&(e=.1),un(Gd(this.rgba,-e))},s.prototype.grayscale=function(){return un(Gd(this.rgba,-1))},s.prototype.lighten=function(e){return e===void 0&&(e=.1),un(V0(this.rgba,e))},s.prototype.darken=function(e){return e===void 0&&(e=.1),un(V0(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"?un({r:(t=this.rgba).r,g:t.g,b:t.b,a:e}):Ui(this.rgba.a,3);var t},s.prototype.hue=function(e){var t=gl(this.rgba);return typeof e=="number"?un({h:e,s:t.s,l:t.l,a:t.a}):Ui(t.h)},s.prototype.isEqual=function(e){return this.toHex()===un(e).toHex()},s})(),un=function(s){return s instanceof $f?s:new $f(s)},Y0=[],v2=function(s){s.forEach(function(e){Y0.indexOf(e)<0&&(e($f,Yf),Y0.push(e))})};function y2(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));m<u&&(u=m,d=p)}return d}},e.string.push([function(a){var o=a.toLowerCase(),h=o==="transparent"?"#0000":t[o];return h?new s(h).toRgb():null},"name"])}v2([y2]);const io=class Yc{constructor(e=16777215){this._value=null,this._components=new Float32Array(4),this._components.fill(1),this._int=16777215,this.value=e}get red(){return this._components[0]}get green(){return this._components[1]}get blue(){return this._components[2]}get alpha(){return this._components[3]}setValue(e){return this.value=e,this}set value(e){if(e instanceof Yc)this._value=this.cloneSource(e._value),this._int=e._int,this._components.set(e._components);else{if(e===null)throw new Error("Cannot set PIXI.Color#value to null");(this._value===null||!this.isSourceEqual(this._value,e))&&(this.normalize(e),this._value=this.cloneSource(e))}}get value(){return this._value}cloneSource(e){return typeof e=="string"||typeof e=="number"||e instanceof Number||e===null?e:Array.isArray(e)||ArrayBuffer.isView(e)?e.slice(0):typeof e=="object"&&e!==null?{...e}:e}isSourceEqual(e,t){const i=typeof e;if(i!==typeof t)return!1;if(i==="number"||i==="string"||e instanceof Number)return e===t;if(Array.isArray(e)&&Array.isArray(t)||ArrayBuffer.isView(e)&&ArrayBuffer.isView(t))return e.length!==t.length?!1:e.every((n,r)=>n===t[r]);if(e!==null&&t!==null){const n=Object.keys(e),r=Object.keys(t);return n.length!==r.length?!1:n.every(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=un(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 Wt=io;function x2(s){return kt("7.2.0","utils.hex2string is deprecated, use Color#toHex instead"),Wt.shared.setValue(s).toHex()}function b2(s){return kt("7.2.0","utils.rgb2hex is deprecated, use Color#toNumber instead"),Wt.shared.setValue(s).toNumber()}function w2(){const s=[],e=[];for(let i=0;i<32;i++)s[i]=i,e[i]=i;s[ut.NORMAL_NPM]=ut.NORMAL,s[ut.ADD_NPM]=ut.ADD,s[ut.SCREEN_NPM]=ut.SCREEN,e[ut.NORMAL]=ut.NORMAL_NPM,e[ut.ADD]=ut.ADD_NPM,e[ut.SCREEN]=ut.SCREEN_NPM;const t=[];return t.push(e),t.push(s),t}const Zx=w2();function Jx(s,e){return Zx[e?1:0][s]}function S2(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<t;i+=6,n+=4)e[i+0]=n+0,e[i+1]=n+1,e[i+2]=n+2,e[i+3]=n+0,e[i+4]=n+2,e[i+5]=n+3;return e}function Qx(s){if(s.BYTES_PER_ELEMENT===4)return s instanceof Float32Array?"Float32Array":s instanceof Uint32Array?"Uint32Array":"Int32Array";if(s.BYTES_PER_ELEMENT===2){if(s instanceof Uint16Array)return"Uint16Array"}else if(s.BYTES_PER_ELEMENT===1&&s instanceof Uint8Array)return"Uint8Array";return null}function ph(s){return s+=s===0?1:0,--s,s|=s>>>1,s|=s>>>2,s|=s>>>4,s|=s>>>8,s|=s>>>16,s+1}function $0(s){return!(s&s-1)&&!!s}function G0(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<r;++n)s[n]=s[n+t];s.length=r}function Br(s){return s===0?0:s<0?-1:1}let _2=0;function ka(){return++_2}const Gf=class{constructor(s,e,t,i){this.left=s,this.top=e,this.right=t,this.bottom=i}get width(){return this.right-this.left}get height(){return this.bottom-this.top}isEmpty(){return this.left===this.right||this.top===this.bottom}};Gf.EMPTY=new Gf(0,0,0,0);let H0=Gf;const j0={},dn=Object.create(null),xr=Object.create(null);class M2{constructor(e,t,i){this._canvas=We.ADAPTER.createCanvas(),this._context=this._canvas.getContext("2d"),this.resolution=i||We.RESOLUTION,this.resize(e,t)}clear(){this._checkDestroyed(),this._context.setTransform(1,0,0,1,0,0),this._context.clearRect(0,0,this._canvas.width,this._canvas.height)}resize(e,t){this._checkDestroyed(),this._canvas.width=Math.round(e*this.resolution),this._canvas.height=Math.round(t*this.resolution)}destroy(){this._context=null,this._canvas=null}get width(){return this._checkDestroyed(),this._canvas.width}set width(e){this._checkDestroyed(),this._canvas.width=Math.round(e)}get height(){return this._checkDestroyed(),this._canvas.height}set height(e){this._checkDestroyed(),this._canvas.height=Math.round(e)}get canvas(){return this._checkDestroyed(),this._canvas}get context(){return this._checkDestroyed(),this._context}_checkDestroyed(){if(this._canvas===null)throw new TypeError("The CanvasRenderTarget has already been destroyed")}}function W0(s,e,t){for(let i=0,n=4*t*e;i<e;++i,n+=4)if(s[n+3]!==0)return!1;return!0}function z0(s,e,t,i,n){const r=4*e;for(let a=i,o=i*r+4*t;a<=n;++a,o+=r)if(s[o+3]!==0)return!1;return!0}function T2(s){const{width:e,height:t}=s,i=s.getContext("2d",{willReadFrequently:!0});if(i===null)throw new TypeError("Failed to get canvas 2D context");const n=i.getImageData(0,0,e,t).data;let r=0,a=0,o=e-1,h=t-1;for(;a<t&&W0(n,e,a);)++a;if(a===t)return H0.EMPTY;for(;W0(n,e,h);)--h;for(;z0(n,e,r,a,h);)++r;for(;z0(n,e,o,a,h);)--o;return++o,++h,new H0(r,a,o,h)}function A2(s){const e=T2(s),{width:t,height:i}=e;let n=null;if(!e.isEmpty()){const r=s.getContext("2d");if(r===null)throw new TypeError("Failed to get canvas 2D context");n=r.getImageData(e.left,e.top,t,i)}return{width:t,height:i,data:n}}function E2(s,e=globalThis.location){if(s.startsWith("data:"))return"";e=e||globalThis.location;const t=new URL(s,document.baseURI);return t.hostname!==e.hostname||t.port!==e.port||t.protocol!==e.protocol?"anonymous":""}function dr(s,e=1){var i;const t=(i=We.RETINA_PREFIX)==null?void 0:i.exec(s);return t?parseFloat(t[1]):e}var He=(s=>(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},q0=(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)=>q0(r,t)-q0(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 C2=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(`
|
||
`);function I2(s){let e="";for(let t=0;t<s;++t)t>0&&(e+=`
|
||
else `),t<s-1&&(e+=`if(test == ${t}.0){}`);return e}function R2(s,e){if(s===0)throw new Error("Invalid value of `0` passed to `checkMaxIfStatementsInShader`");const t=e.createShader(e.FRAGMENT_SHADER);for(;;){const i=C2.replace(/%forloop%/gi,I2(s));if(e.shaderSource(t,i),e.compileShader(t),!e.getShaderParameter(t,e.COMPILE_STATUS))s=s/2|0;else break}return s}const jd=0,Wd=1,zd=2,qd=3,Kd=4,Zd=5;class Ln{constructor(){this.data=0,this.blendMode=ut.NORMAL,this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<<jd)}set blend(e){!!(this.data&1<<jd)!==e&&(this.data^=1<<jd)}get offsets(){return!!(this.data&1<<Wd)}set offsets(e){!!(this.data&1<<Wd)!==e&&(this.data^=1<<Wd)}get culling(){return!!(this.data&1<<zd)}set culling(e){!!(this.data&1<<zd)!==e&&(this.data^=1<<zd)}get depthTest(){return!!(this.data&1<<qd)}set depthTest(e){!!(this.data&1<<qd)!==e&&(this.data^=1<<qd)}get depthMask(){return!!(this.data&1<<Zd)}set depthMask(e){!!(this.data&1<<Zd)!==e&&(this.data^=1<<Zd)}get clockwiseFrontFace(){return!!(this.data&1<<Kd)}set clockwiseFrontFace(e){!!(this.data&1<<Kd)!==e&&(this.data^=1<<Kd)}get blendMode(){return this._blendMode}set blendMode(e){this.blend=e!==ut.NONE,this._blendMode=e}get polygonOffset(){return this._polygonOffset}set polygonOffset(e){this.offsets=!!e,this._polygonOffset=e}static for2d(){const e=new Ln;return e.depthTest=!1,e.blend=!0,e}}Ln.prototype.toString=function(){return`[@pixi/core:State blendMode=${this.blendMode} clockwiseFrontFace=${this.clockwiseFrontFace} culling=${this.culling} depthMask=${this.depthMask} polygonOffset=${this.polygonOffset}]`};const Wf=[];function eb(s,e){if(!s)return null;let t="";if(typeof s=="string"){const i=/\.(\w{3,4})(?:$|\?|#)/i.exec(s);i&&(t=i[1].toLowerCase())}for(let i=Wf.length-1;i>=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 Js{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;u<d;u++)c[u][l](e,t,i,n,r,a,o,h);return c===this.items&&this._aliasCount--,this}ensureNonAliasedItems(){this._aliasCount>0&&this.items.length>1&&(this._aliasCount=0,this.items=this.items.slice(0))}add(e){return e[this._name]&&(this.ensureNonAliasedItems(),this.remove(e),this.items.push(e)),this}remove(e){const t=this.items.indexOf(e);return t!==-1&&(this.ensureNonAliasedItems(),this.items.splice(t,1)),this}contains(e){return this.items.includes(e)}removeAll(){return this.ensureNonAliasedItems(),this.items.length=0,this}destroy(){this.removeAll(),this.items.length=0,this._name=""}get empty(){return this.items.length===0}get name(){return this._name}}Object.defineProperties(Js.prototype,{dispatch:{value:Js.prototype.emit},run:{value:Js.prototype.emit}});class Bl{constructor(e=0,t=0){this._width=e,this._height=t,this.destroyed=!1,this.internal=!1,this.onResize=new Js("setRealSize"),this.onUpdate=new Js("update"),this.onError=new Js("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 Bl{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===Xi.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 P2={scaleMode:zs.NEAREST,alphaMode:Xi.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 Bl)&&(e=eb(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=ka(),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=$0(this.realWidth)&&$0(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 xr[this.cacheId],delete dn[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}_${ka()}`}r=e._pixiId}let a=xr[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=De.RGBA,o=et.FLOAT):e instanceof Int32Array?(a=De.RGBA_INTEGER,o=et.INT):e instanceof Uint32Array?(a=De.RGBA_INTEGER,o=et.UNSIGNED_INT):e instanceof Int16Array?(a=De.RGBA_INTEGER,o=et.SHORT):e instanceof Uint16Array?(a=De.RGBA_INTEGER,o=et.UNSIGNED_SHORT):e instanceof Int8Array?(a=De.RGBA,o=et.BYTE):(a=De.RGBA,o=et.UNSIGNED_BYTE),r.internal=!0,new so(r,Object.assign({},P2,{type:o,format:a},n))}static addToCache(e,t){t&&(e.textureCacheIds.includes(t)||e.textureCacheIds.push(t),xr[t]&&xr[t]!==e&&console.warn(`BaseTexture added to the cache with an id [${t}] that already had an entry`),xr[t]=e)}static removeFromCache(e){if(typeof e=="string"){const t=xr[e];if(t){const i=t.textureCacheIds.indexOf(e);return i>-1&&t.textureCacheIds.splice(i,1),delete xr[e],t}}else if(e!=null&&e.textureCacheIds){for(let t=0;t<e.textureCacheIds.length;++t)delete xr[e.textureCacheIds[t]];return e.textureCacheIds.length=0,e}return null}};zf.defaultOptions={mipmap:Bs.POW2,anisotropicLevel:0,scaleMode:zs.LINEAR,wrapMode:Zs.CLAMP,alphaMode:Xi.UNPACK,target:vo.TEXTURE_2D,format:De.RGBA,type:et.UNSIGNED_BYTE},zf._globalBatch=0;let gt=zf;class qf{constructor(){this.texArray=null,this.blend=0,this.type=Cn.TRIANGLES,this.start=0,this.size=0,this.data=null}}let k2=0;class oi{constructor(e,t=!0,i=!1){this.data=e||new Float32Array(1),this._glBuffers={},this._updateID=0,this.index=i,this.static=t,this.id=k2++,this.disposeRunner=new Js("disposeBuffer")}update(e){e instanceof Array&&(e=new Float32Array(e)),this.data=e||this.data,this._updateID++}dispose(){this.disposeRunner.emit(this,!1)}destroy(){this.dispose(),this.data=null}set index(e){this.type=e?kn.ELEMENT_ARRAY_BUFFER:kn.ARRAY_BUFFER}get index(){return this.type===kn.ELEMENT_ARRAY_BUFFER}static from(e){return e instanceof Array&&(e=new Float32Array(e)),new oi(e)}}class gh{constructor(e,t=0,i=!1,n=et.FLOAT,r,a,o,h=1){this.buffer=e,this.size=t,this.normalized=i,this.type=n,this.stride=r,this.start=a,this.instance=o,this.divisor=h}destroy(){this.buffer=null}static from(e,t,i,n,r){return new gh(e,t,i,n,r)}}const F2={Float32Array,Uint32Array,Int32Array,Uint8Array};function O2(s,e){let t=0,i=0;const n={};for(let h=0;h<s.length;h++)i+=e[h],t+=s[h].length;const r=new ArrayBuffer(t*4);let a=null,o=0;for(let h=0;h<s.length;h++){const l=e[h],c=s[h],u=Qx(c);n[u]||(n[u]=new F2[u](r)),a=n[u];for(let d=0;d<c.length;d++){const f=(d/l|0)*i+o,p=d%l;a[f+p]=c[d]}o+=l}return new Float32Array(r)}const K0={5126:4,5123:2,5121:1};let B2=0;const L2={Float32Array,Uint32Array,Int32Array,Uint8Array,Uint16Array};class Bn{constructor(e=[],t={}){this.buffers=e,this.indexBuffer=null,this.attributes=t,this.glVertexArrayObjects={},this.id=B2++,this.instanced=!1,this.instanceCount=1,this.disposeRunner=new Js("disposeGeometry"),this.refCount=0}addAttribute(e,t,i=0,n=!1,r,a,o,h=!1){if(!t)throw new Error("You must pass a buffer when creating an attribute");t instanceof oi||(t instanceof Array&&(t=new Float32Array(t)),t=new oi(t));const l=e.split("|");if(l.length>1){for(let u=0;u<l.length;u++)this.addAttribute(l[u],t,i,n,r);return this}let c=this.buffers.indexOf(t);return c===-1&&(this.buffers.push(t),c=this.buffers.length-1),this.attributes[e]=new gh(c,i,n,r,a,o,h),this.instanced=this.instanced||h,this}getAttribute(e){return this.attributes[e]}getBuffer(e){return this.buffers[this.getAttribute(e).buffer]}addIndex(e){return e instanceof oi||(e instanceof Array&&(e=new Uint16Array(e)),e=new oi(e)),e.type=kn.ELEMENT_ARRAY_BUFFER,this.indexBuffer=e,this.buffers.includes(e)||this.buffers.push(e),this}getIndex(){return this.indexBuffer}interleave(){if(this.buffers.length===1||this.buffers.length===2&&this.indexBuffer)return this;const e=[],t=[],i=new oi;let n;for(n in this.attributes){const r=this.attributes[n],a=this.buffers[r.buffer];e.push(a.data),t.push(r.size*K0[r.type]/4),r.buffer=0}for(i.data=O2(e,t),n=0;n<this.buffers.length;n++)this.buffers[n]!==this.indexBuffer&&this.buffers[n].destroy();return this.buffers=[i],this.indexBuffer&&this.buffers.push(this.indexBuffer),this}getSize(){for(const e in this.attributes){const t=this.attributes[e];return this.buffers[t.buffer].data.length/(t.stride/4||t.size)}return 0}dispose(){this.disposeRunner.emit(this,!1)}destroy(){this.dispose(),this.buffers=null,this.indexBuffer=null,this.attributes=null}clone(){const e=new Bn;for(let t=0;t<this.buffers.length;t++)e.buffers[t]=new oi(this.buffers[t].data.slice(0));for(const t in this.attributes){const i=this.attributes[t];e.attributes[t]=new gh(i.buffer,i.size,i.normalized,i.type,i.stride,i.start,i.instance)}return this.indexBuffer&&(e.indexBuffer=e.buffers[this.buffers.indexOf(this.indexBuffer)],e.indexBuffer.type=kn.ELEMENT_ARRAY_BUFFER),e}static merge(e){const t=new Bn,i=[],n=[],r=[];let a;for(let o=0;o<e.length;o++){a=e[o];for(let h=0;h<a.buffers.length;h++)n[h]=n[h]||0,n[h]+=a.buffers[h].data.length,r[h]=0}for(let o=0;o<a.buffers.length;o++)i[o]=new L2[Qx(a.buffers[o].data)](n[o]),t.buffers[o]=new oi(i[o]);for(let o=0;o<e.length;o++){a=e[o];for(let h=0;h<a.buffers.length;h++)i[h].set(a.buffers[h].data,r[h]),r[h]+=a.buffers[h].data.length}if(t.attributes=a.attributes,a.indexBuffer){t.indexBuffer=t.buffers[a.buffers.indexOf(a.indexBuffer)],t.indexBuffer.type=kn.ELEMENT_ARRAY_BUFFER;let o=0,h=0,l=0,c=0;for(let u=0;u<a.buffers.length;u++)if(a.buffers[u]!==a.indexBuffer){c=u;break}for(const u in a.attributes){const d=a.attributes[u];(d.buffer|0)===c&&(h+=d.size*K0[d.type]/4)}for(let u=0;u<e.length;u++){const d=e[u].indexBuffer.data;for(let f=0;f<d.length;f++)t.indexBuffer.data[f+l]+=o;o+=e[u].buffers[c].data.length/h,l+=d.length}}return t}}class tb extends Bn{constructor(e=!1){super(),this._buffer=new oi(null,e,!1),this._indexBuffer=new oi(null,e,!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("aTextureId",this._buffer,1,!0,et.FLOAT).addIndex(this._indexBuffer)}}const vh=Math.PI*2,D2=180/Math.PI,N2=Math.PI/180;var Hi=(s=>(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 Xt{constructor(e=0,t=0){this.x=0,this.y=0,this.x=e,this.y=t}clone(){return new Xt(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}}Xt.prototype.toString=function(){return`[@pixi/math:Point x=${this.x} y=${this.y}]`};const cc=[new Xt,new Xt,new Xt,new Xt];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.x+this.width&&t>=this.y&&t<this.y+this.height}intersects(e,t){if(!t){const R=this.x<e.x?e.x:this.x;if((this.right>e.right?e.right:this.right)<=R)return!1;const P=this.y<e.y?e.y:this.y;return(this.bottom>e.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,M=b*n+y*a;return!(Math.max(w,A,T,M)<=b*o.x+y*o.y||Math.min(w,A,T,M)>=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 Ea{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;n<r;n++)i.push(t[n].x,t[n].y);t=i}this.points=t,this.type=Hi.POLY,this.closeStroke=!0}clone(){const e=this.points.slice(),t=new Ea(e);return t.closeStroke=this.closeStroke,t}contains(e,t){let i=!1;const n=this.points.length/2;for(let r=0,a=n-1;r<n;a=r++){const o=this.points[r*2],h=this.points[r*2+1],l=this.points[a*2],c=this.points[a*2+1];h>t!=c>t&&e<(l-o)*((t-h)/(c-h))+o&&(i=!i)}return i}}Ea.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 Xt;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 Xt;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 ha=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],ua=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],da=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],fa=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],Kf=[],ib=[],hc=Math.sign;function U2(){for(let s=0;s<16;s++){const e=[];Kf.push(e);for(let t=0;t<16;t++){const i=hc(ha[s]*ha[t]+da[s]*ua[t]),n=hc(ua[s]*ha[t]+fa[s]*ua[t]),r=hc(ha[s]*da[t]+da[s]*fa[t]),a=hc(ua[s]*da[t]+fa[s]*fa[t]);for(let o=0;o<16;o++)if(ha[o]===i&&ua[o]===n&&da[o]===r&&fa[o]===a){e.push(o);break}}}for(let s=0;s<16;s++){const e=new li;e.set(ha[s],ua[s],da[s],fa[s],0,0),ib.push(e)}}U2();const fi={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=>ha[s],uY:s=>ua[s],vX:s=>da[s],vY:s=>fa[s],inv:s=>s&8?s&15:-s&7,add:(s,e)=>Kf[s][e],sub:(s,e)=>Kf[s][fi.inv(e)],rotate180:s=>s^4,isVertical:s=>(s&3)===2,byDirection:(s,e)=>Math.abs(s)*2<=Math.abs(e)?e>=0?fi.S:fi.N:Math.abs(e)*2<=Math.abs(s)?s>0?fi.E:fi.W:e>0?s>0?fi.SE:fi.SW:s>0?fi.NE:fi.NW,matrixAppendRotationInv:(s,e,t=0,i=0)=>{const n=ib[fi.inv(e)];n.tx=t,n.ty=i,s.append(n)}};class er{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 er(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))}}er.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 er(this.onChange,this,0,0),this.scale=new er(this.onChange,this,1,1),this.pivot=new er(this.onChange,this,0,0),this.skew=new er(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 pp=Zf;pp.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 X2=`varying vec2 vTextureCoord;
|
||
|
||
uniform sampler2D uSampler;
|
||
|
||
void main(void){
|
||
gl_FragColor *= texture2D(uSampler, vTextureCoord);
|
||
}`,V2=`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 Z0(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;t<e.length;t++)e[t]=!1;return e}function sb(s,e){switch(s){case"float":return 0;case"vec2":return new Float32Array(2*e);case"vec3":return new Float32Array(3*e);case"vec4":return new Float32Array(4*e);case"int":case"uint":case"sampler2D":case"sampler2DArray":return 0;case"ivec2":return new Int32Array(2*e);case"ivec3":return new Int32Array(3*e);case"ivec4":return new Int32Array(4*e);case"uvec2":return new Uint32Array(2*e);case"uvec3":return new Uint32Array(3*e);case"uvec4":return new Uint32Array(4*e);case"bool":return!1;case"bvec2":return Jd(2*e);case"bvec3":return Jd(3*e);case"bvec4":return Jd(4*e);case"mat2":return new Float32Array([1,0,0,1]);case"mat3":return new Float32Array([1,0,0,0,1,0,0,0,1]);case"mat4":return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}return null}const xo=[{test:s=>s.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])
|
||
}`}],Y2={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);
|
||
}`},$2={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 G2(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<xo.length;h++)if(xo[h].test(r,a)){t.push(xo[h].code(n,a)),o=!0;break}if(!o){const h=(r.size===1&&!r.isArray?Y2:$2)[r.type].replace("location",`ud["${n}"].location`);t.push(`
|
||
cu = ud["${n}"];
|
||
cv = cu.value;
|
||
v = uv["${n}"];
|
||
${h};`)}}return new Function("ud","uv","renderer","syncData",t.join(`
|
||
`))}const nb={};let za=nb;function H2(){if(za===nb||za!=null&&za.isContextLost()){const s=We.ADAPTER.createCanvas();let e;We.PREFER_ENV>=Na.WEBGL2&&(e=s.getContext("webgl2",{})),e||(e=s.getContext("webgl",{})||s.getContext("experimental-webgl",{}),e?e.getExtension("WEBGL_draw_buffers"):e=null),za=e}return za}let uc;function j2(){if(!uc){uc=ks.MEDIUM;const s=H2();if(s&&s.getShaderPrecisionFormat){const e=s.getShaderPrecisionFormat(s.FRAGMENT_SHADER,s.HIGH_FLOAT);e&&(uc=e.precision?ks.HIGH:ks.MEDIUM)}}return uc}function J0(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 W2(s,e,t,i){s.getProgramParameter(e,s.LINK_STATUS)||(s.getShaderParameter(t,s.COMPILE_STATUS)||J0(s,t),s.getShaderParameter(i,s.COMPILE_STATUS)||J0(s,i),console.error("PixiJS Error: Could not initialize shader."),s.getProgramInfoLog(e)!==""&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",s.getProgramInfoLog(e)))}const z2={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 rb(s){return z2[s]}let dc=null;const Q0={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 ab(s,e){if(!dc){const t=Object.keys(Q0);dc={};for(let i=0;i<t.length;++i){const n=t[i];dc[s[n]]=Q0[n]}}return dc[e]}function ev(s,e,t){if(s.substring(0,9)!=="precision"){let i=e;return e===ks.HIGH&&t!==ks.HIGH&&(i=ks.MEDIUM),`precision ${i} float;
|
||
${s}`}else if(t!==ks.HIGH&&s.substring(0,15)==="precision highp")return s.replace("precision highp","precision mediump");return s}let zo;function q2(){if(typeof zo=="boolean")return zo;try{zo=new Function("param1","param2","param3","return param1[param2] === param3;")({a:"b"},"a","b")===!0}catch{zo=!1}return zo}let K2=0;const fc={},Jf=class no{constructor(e,t,i="pixi-shader",n={}){this.extra={},this.id=K2++,this.vertexSrc=e||no.defaultVertexSrc,this.fragmentSrc=t||no.defaultFragmentSrc,this.vertexSrc=this.vertexSrc.trim(),this.fragmentSrc=this.fragmentSrc.trim(),this.extra=n,this.vertexSrc.substring(0,8)!=="#version"&&(i=i.replace(/\s+/g,"-"),fc[i]?(fc[i]++,i+=`-${fc[i]}`):fc[i]=1,this.vertexSrc=`#define SHADER_NAME ${i}
|
||
${this.vertexSrc}`,this.fragmentSrc=`#define SHADER_NAME ${i}
|
||
${this.fragmentSrc}`,this.vertexSrc=ev(this.vertexSrc,no.defaultVertexPrecision,ks.HIGH),this.fragmentSrc=ev(this.fragmentSrc,no.defaultFragmentPrecision,j2())),this.glPrograms={},this.syncUniforms=null}static get defaultVertexSrc(){return V2}static get defaultFragmentSrc(){return X2}static from(e,t,i){const n=e+t;let r=j0[n];return r||(j0[n]=r=new no(e,t,i)),r}};Jf.defaultVertexPrecision=ks.HIGH,Jf.defaultFragmentPrecision=Qn.apple.device?ks.HIGH:ks.MEDIUM;let In=Jf,Z2=0;class Qs{constructor(e,t,i){this.group=!0,this.syncUniforms={},this.dirtyId=0,this.id=Z2++,this.static=!!t,this.ubo=!!i,e instanceof oi?(this.buffer=e,this.buffer.type=kn.UNIFORM_BUFFER,this.autoManage=!1,this.ubo=!0):(this.uniforms=e,this.ubo&&(this.buffer=new oi(new Float32Array(1)),this.buffer.type=kn.UNIFORM_BUFFER,this.autoManage=!0))}update(){this.dirtyId++,!this.autoManage&&this.buffer&&this.buffer.update()}add(e,t,i){if(!this.ubo)this.uniforms[e]=new Qs(t,i);else throw new Error("[UniformGroup] uniform groups in ubo mode cannot be modified, or have uniform groups nested in them")}static from(e,t,i){return new Qs(e,t,i)}static uboFrom(e,t){return new Qs(e,t??!0,!0)}}class en{constructor(e,t){this.uniformBindCount=0,this.program=e,t?t instanceof Qs?this.uniformGroup=t:this.uniformGroup=new Qs(t):this.uniformGroup=new Qs({}),this.disposeRunner=new Js("disposeShader")}checkUniformExists(e,t){if(t.uniforms[e])return!0;for(const i in t.uniforms){const n=t.uniforms[i];if(n.group===!0&&this.checkUniformExists(e,n))return!0}return!1}destroy(){this.uniformGroup=null,this.disposeRunner.emit(this),this.disposeRunner.destroy()}get uniforms(){return this.uniformGroup.uniforms}static from(e,t,i){const n=In.from(e,t);return new en(n,i)}}class ob{constructor(e,t){if(this.vertexSrc=e,this.fragTemplate=t,this.programCache={},this.defaultGroupCache={},!t.includes("%count%"))throw new Error('Fragment template must contain "%count%".');if(!t.includes("%forloop%"))throw new Error('Fragment template must contain "%forloop%".')}generateShader(e){if(!this.programCache[e]){const i=new Int32Array(e);for(let r=0;r<e;r++)i[r]=r;this.defaultGroupCache[e]=Qs.from({uSamplers:i},!0);let n=this.fragTemplate;n=n.replace(/%count%/gi,`${e}`),n=n.replace(/%forloop%/gi,this.generateSampleSrc(e)),this.programCache[e]=new In(this.vertexSrc,n)}const t={tint:new Float32Array([1,1,1,1]),translationMatrix:new li,default:this.defaultGroupCache[e]};return new en(this.programCache[e],t)}generateSampleSrc(e){let t="";t+=`
|
||
`,t+=`
|
||
`;for(let i=0;i<e;i++)i>0&&(t+=`
|
||
else `),i<e-1&&(t+=`if(vTextureId < ${i}.5)`),t+=`
|
||
{`,t+=`
|
||
color = texture2D(uSamplers[${i}], vTextureCoord);`,t+=`
|
||
}`;return t+=`
|
||
`,t+=`
|
||
`,t}}class Qf{constructor(){this.elements=[],this.ids=[],this.count=0}clear(){for(let e=0;e<this.count;e++)this.elements[e]=null;this.count=0}}function J2(){return!Qn.apple.device}function Q2(s){let e=!0;const t=We.ADAPTER.getNavigator();if(Qn.tablet||Qn.phone){if(Qn.apple.device){const i=t.userAgent.match(/OS (\d+)_(\d+)?/);i&&parseInt(i[1],10)<11&&(e=!1)}if(Qn.android.device){const i=t.userAgent.match(/Android\s([0-9.]*)/);i&&parseInt(i[1],10)<7&&(e=!1)}}return e?s:4}class Su{constructor(e){this.renderer=e}flush(){}destroy(){this.renderer=null}start(){}stop(){this.flush()}render(e){}}var eA=`varying vec2 vTextureCoord;
|
||
varying vec4 vColor;
|
||
varying float vTextureId;
|
||
uniform sampler2D uSamplers[%count%];
|
||
|
||
void main(void){
|
||
vec4 color;
|
||
%forloop%
|
||
gl_FragColor = color * vColor;
|
||
}
|
||
`,tA=`precision highp float;
|
||
attribute vec2 aVertexPosition;
|
||
attribute vec2 aTextureCoord;
|
||
attribute vec4 aColor;
|
||
attribute float aTextureId;
|
||
|
||
uniform mat3 projectionMatrix;
|
||
uniform mat3 translationMatrix;
|
||
uniform vec4 tint;
|
||
|
||
varying vec2 vTextureCoord;
|
||
varying vec4 vColor;
|
||
varying float vTextureId;
|
||
|
||
void main(void){
|
||
gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
|
||
|
||
vTextureCoord = aTextureCoord;
|
||
vTextureId = aTextureId;
|
||
vColor = aColor * tint;
|
||
}
|
||
`;const sl=class $s extends Su{constructor(e){super(e),this.setShaderGenerator(),this.geometryClass=tb,this.vertexSize=6,this.state=Ln.for2d(),this.size=$s.defaultBatchSize*4,this._vertexCount=0,this._indexCount=0,this._bufferedElements=[],this._bufferedTextures=[],this._bufferSize=0,this._shader=null,this._packedGeometries=[],this._packedGeometryPoolSize=2,this._flushId=0,this._aBuffers={},this._iBuffers={},this.maxTextures=1,this.renderer.on("prerender",this.onPrerender,this),e.runners.contextChange.add(this),this._dcIndex=0,this._aIndex=0,this._iIndex=0,this._attributeBuffer=null,this._indexBuffer=null,this._tempBoundTextures=[]}static get defaultMaxTextures(){return this._defaultMaxTextures=this._defaultMaxTextures??Q2(32),this._defaultMaxTextures}static set defaultMaxTextures(e){this._defaultMaxTextures=e}static get canUploadSameBuffer(){return this._canUploadSameBuffer=this._canUploadSameBuffer??J2(),this._canUploadSameBuffer}static set canUploadSameBuffer(e){this._canUploadSameBuffer=e}get MAX_TEXTURES(){return kt("7.1.0","BatchRenderer#MAX_TEXTURES renamed to BatchRenderer#maxTextures"),this.maxTextures}static get defaultVertexSrc(){return tA}static get defaultFragmentTemplate(){return eA}setShaderGenerator({vertex:e=$s.defaultVertexSrc,fragment:t=$s.defaultFragmentTemplate}={}){this.shaderGenerator=new ob(e,t)}contextChange(){const e=this.renderer.gl;We.PREFER_ENV===Na.WEBGL_LEGACY?this.maxTextures=1:(this.maxTextures=Math.min(e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),$s.defaultMaxTextures),this.maxTextures=R2(this.maxTextures,e)),this._shader=this.shaderGenerator.generateShader(this.maxTextures);for(let t=0;t<this._packedGeometryPoolSize;t++)this._packedGeometries[t]=new this.geometryClass;this.initFlushBuffers()}initFlushBuffers(){const{_drawCallPool:e,_textureArrayPool:t}=$s,i=this.size/4,n=Math.floor(i/this.maxTextures)+1;for(;e.length<i;)e.push(new qf);for(;t.length<n;)t.push(new Qf);for(let r=0;r<this.maxTextures;r++)this._tempBoundTextures[r]=null}onPrerender(){this._flushId=0}render(e){e._texture.valid&&(this._vertexCount+e.vertexData.length/2>this.size&&this.flush(),this._vertexCount+=e.vertexData.length/2,this._indexCount+=e.indices.length,this._bufferedTextures[this._bufferSize]=e._texture.baseTexture,this._bufferedElements[this._bufferSize++]=e)}buildTexturesAndDrawCalls(){const{_bufferedTextures:e,maxTextures:t}=this,i=$s._textureArrayPool,n=this.renderer.batch,r=this._tempBoundTextures,a=this.renderer.textureGC.count;let o=++gt._globalBatch,h=0,l=i[0],c=0;n.copyBoundTextures(r,t);for(let u=0;u<this._bufferSize;++u){const d=e[u];e[u]=null,d._batchEnabled!==o&&(l.count>=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;u<r.length;u++)r[u]=null;gt._globalBatch=o}buildDrawCalls(e,t,i){const{_bufferedElements:n,_attributeBuffer:r,_indexBuffer:a,vertexSize:o}=this,h=$s._drawCallPool;let l=this._dcIndex,c=this._aIndex,u=this._iIndex,d=h[l];d.start=this._iIndex,d.texArray=e;for(let f=t;f<i;++f){const p=n[f],m=p._texture.baseTexture,g=Zx[m.alphaMode?1:0][p.blendMode];n[f]=null,t<f&&d.blend!==g&&(d.size=u-d.start,t=f,d=h[++l],d.texArray=e,d.start=u),this.packInterleavedGeometry(p,r,a,c,u),c+=p.vertexData.length/2*o,u+=p.indices.length,d.blend=g}t<i&&(d.size=u-d.start,++l),this._dcIndex=l,this._aIndex=c,this._iIndex=u}bindAndClearTexArray(e){const t=this.renderer.texture;for(let i=0;i<e.count;i++)t.bind(e.elements[i],e.ids[i]),e.elements[i]=null;e.count=0}updateGeometry(){const{_packedGeometries:e,_attributeBuffer:t,_indexBuffer:i}=this;$s.canUploadSameBuffer?(e[this._flushId]._buffer.update(t.rawBinaryData),e[this._flushId]._indexBuffer.update(i),this.renderer.geometry.updateBuffers()):(this._packedGeometryPoolSize<=this._flushId&&(this._packedGeometryPoolSize++,e[this._flushId]=new this.geometryClass),e[this._flushId]._buffer.update(t.rawBinaryData),e[this._flushId]._indexBuffer.update(i),this.renderer.geometry.bind(e[this._flushId]),this.renderer.geometry.updateBuffers(),this._flushId++)}drawBatches(){const e=this._dcIndex,{gl:t,state:i}=this.renderer,n=$s._drawCallPool;let r=null;for(let a=0;a<e;a++){const{texArray:o,type:h,size:l,start:c,blend:u}=n[a];r!==o&&(r=o,this.bindAndClearTexArray(o)),this.state.blendMode=u,i.set(this.state),t.drawElements(h,l,t.UNSIGNED_SHORT,c*2)}}flush(){this._vertexCount!==0&&(this._attributeBuffer=this.getAttributeBuffer(this._vertexCount),this._indexBuffer=this.getIndexBuffer(this._indexCount),this._aIndex=0,this._iIndex=0,this._dcIndex=0,this.buildTexturesAndDrawCalls(),this.updateGeometry(),this.drawBatches(),this._bufferSize=0,this._vertexCount=0,this._indexCount=0)}start(){this.renderer.state.set(this.state),this.renderer.texture.ensureSamplerType(this.maxTextures),this.renderer.shader.bind(this._shader),$s.canUploadSameBuffer&&this.renderer.geometry.bind(this._packedGeometries[this._flushId])}stop(){this.flush()}destroy(){for(let e=0;e<this._packedGeometryPoolSize;e++)this._packedGeometries[e]&&this._packedGeometries[e].destroy();this.renderer.off("prerender",this.onPrerender,this),this._aBuffers=null,this._iBuffers=null,this._packedGeometries=null,this._attributeBuffer=null,this._indexBuffer=null,this._shader&&(this._shader.destroy(),this._shader=null),super.destroy()}getAttributeBuffer(e){const t=ph(Math.ceil(e/8)),i=G0(t),n=t*8;this._aBuffers.length<=i&&(this._iBuffers.length=i+1);let r=this._aBuffers[n];return r||(this._aBuffers[n]=r=new jf(n*this.vertexSize*4)),r}getIndexBuffer(e){const t=ph(Math.ceil(e/12)),i=G0(t),n=t*12;this._iBuffers.length<=i&&(this._iBuffers.length=i+1);let r=this._iBuffers[i];return r||(this._iBuffers[i]=r=new Uint16Array(n)),r}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=Wt.shared.setValue(e._tintRGB).toPremultiplied(f,e._texture.baseTexture.alphaMode>0);for(let m=0;m<u.length;m+=2)o[n++]=u[m],o[n++]=u[m+1],o[n++]=l[m],o[n++]=l[m+1],a[n++]=p,o[n++]=d;for(let m=0;m<c.length;m++)i[r++]=h+c[m]}};sl.defaultBatchSize=4096,sl.extension={name:"batch",type:He.RendererPlugin},sl._drawCallPool=[],sl._textureArrayPool=[];let Tr=sl;tt.add(Tr);var iA=`varying vec2 vTextureCoord;
|
||
|
||
uniform sampler2D uSampler;
|
||
|
||
void main(void){
|
||
gl_FragColor = texture2D(uSampler, vTextureCoord);
|
||
}
|
||
`,sA=`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 em=class nl extends en{constructor(e,t,i){const n=In.from(e||nl.defaultVertexSrc,t||nl.defaultFragmentSrc);super(n,i),this.padding=0,this.resolution=nl.defaultResolution,this.multisample=nl.defaultMultisample,this.enabled=!0,this.autoFit=!0,this.state=new Ln}apply(e,t,i,n,r){e.applyFilter(this,t,i,n)}get blendMode(){return this.state.blendMode}set blendMode(e){this.state.blendMode=e}get resolution(){return this._resolution}set resolution(e){this._resolution=e}static get defaultVertexSrc(){return sA}static get defaultFragmentSrc(){return iA}};em.defaultResolution=1,em.defaultMultisample=Ci.NONE;let os=em;class yh{constructor(){this.clearBeforeRender=!0,this._backgroundColor=new Wt(0),this.alpha=1}init(e){this.clearBeforeRender=e.clearBeforeRender;const{backgroundColor:t,background:i,backgroundAlpha:n}=e,r=i??t;r!==void 0&&(this.color=r),this.alpha=n}get color(){return this._backgroundColor.value}set color(e){this._backgroundColor.setValue(e)}get alpha(){return this._backgroundColor.alpha}set alpha(e){this._backgroundColor.setAlpha(e)}get backgroundColor(){return this._backgroundColor}destroy(){}}yh.defaultOptions={backgroundAlpha:1,backgroundColor:0,clearBeforeRender:!0},yh.extension={type:[He.RendererSystem,He.CanvasRendererSystem],name:"background"};tt.add(yh);class lb{constructor(e){this.renderer=e,this.emptyRenderer=new Su(e),this.currentRenderer=this.emptyRenderer}setObjectRenderer(e){this.currentRenderer!==e&&(this.currentRenderer.stop(),this.currentRenderer=e,this.currentRenderer.start())}flush(){this.setObjectRenderer(this.emptyRenderer)}reset(){this.setObjectRenderer(this.emptyRenderer)}copyBoundTextures(e,t){const{boundTextures:i}=this.renderer.texture;for(let n=t-1;n>=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<o;l++){const c=r[l],u=c._batchLocation;if(u>=0&&u<n&&t[u]===c){a[l]=u;continue}for(;h<n;){const d=t[h];if(d&&d._batchEnabled===i&&d._batchLocation===h){h++;continue}a[l]=h,c._batchLocation=h,t[h]=c;break}}}destroy(){this.renderer=null}}lb.extension={type:He.RendererSystem,name:"batch"};tt.add(lb);let tv=0;class xh{constructor(e){this.renderer=e,this.webGLVersion=1,this.extensions={},this.supports={uint32Indices:!1},this.handleContextLost=this.handleContextLost.bind(this),this.handleContextRestored=this.handleContextRestored.bind(this)}get isLost(){return!this.gl||this.gl.isContextLost()}contextChange(e){this.gl=e,this.renderer.gl=e,this.renderer.CONTEXT_UID=tv++}init(e){if(e.context)this.initFromContext(e.context);else{const t=this.renderer.background.alpha<1,i=e.premultipliedAlpha;this.preserveDrawingBuffer=e.preserveDrawingBuffer,this.useContextAlpha=e.useContextAlpha,this.powerPreference=e.powerPreference,this.initFromOptions({alpha:t,premultipliedAlpha:i,antialias:e.antialias,stencil:!0,preserveDrawingBuffer:e.preserveDrawingBuffer,powerPreference:e.powerPreference})}}initFromContext(e){this.gl=e,this.validateContext(e),this.renderer.gl=e,this.renderer.CONTEXT_UID=tv++,this.renderer.runners.contextChange.emit(e);const t=this.renderer.view;t.addEventListener!==void 0&&(t.addEventListener("webglcontextlost",this.handleContextLost,!1),t.addEventListener("webglcontextrestored",this.handleContextRestored,!1))}initFromOptions(e){const t=this.createContext(this.renderer.view,e);this.initFromContext(t)}createContext(e,t){let i;if(We.PREFER_ENV>=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 Js("disposeFramebuffer"),this.multisample=Ci.NONE}get colorTexture(){return this.colorTextures[0]}addColorTexture(e=0,t){return this.colorTextures[e]=t||new gt(null,{scaleMode:zs.NEAREST,resolution:1,mipmap:Bs.OFF,width:this.width,height:this.height}),this.dirtyId++,this.dirtyFormat++,this}addDepthTexture(e){return this.depthTexture=e||new gt(null,{scaleMode:zs.NEAREST,resolution:1,width:this.width,height:this.height,mipmap:Bs.OFF,format:De.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<this.colorTextures.length;i++){const n=this.colorTextures[i],r=n.resolution;n.setSize(e/r,t/r)}if(this.depthTexture){const i=this.depthTexture.resolution;this.depthTexture.setSize(e/i,t/i)}}}dispose(){this.disposeRunner.emit(this,!1)}destroyDepthTexture(){this.depthTexture&&(this.depthTexture.destroy(),this.depthTexture=null,++this.dirtyId,++this.dirtyFormat)}}class cb extends gt{constructor(e={}){if(typeof e=="number"){const t=arguments[0],i=arguments[1],n=arguments[2],r=arguments[3];e={width:t,height:i,scaleMode:n,resolution:r}}e.width=e.width??100,e.height=e.height??100,e.multisample??(e.multisample=Ci.NONE),super(null,e),this.mipmap=Bs.OFF,this.valid=!0,this._clear=new Wt([0,0,0,0]),this.framebuffer=new tm(this.realWidth,this.realHeight).addColorTexture(0,this),this.framebuffer.multisample=e.multisample,this.maskStack=[],this.filterStack=[{}]}set clearColor(e){this._clear.setValue(e)}get clearColor(){return this._clear.value}get clear(){return this._clear}get multisample(){return this.framebuffer.multisample}set multisample(e){this.framebuffer.multisample=e}resize(e,t){this.framebuffer.resize(e*this.resolution,t*this.resolution),this.setRealSize(this.framebuffer.width,this.framebuffer.height)}dispose(){this.framebuffer.dispose(),super.dispose()}destroy(){super.destroy(),this.framebuffer.destroyDepthTexture(),this.framebuffer=null}}class fr extends Bl{constructor(e){const t=e,i=t.naturalWidth||t.videoWidth||t.displayWidth||t.width,n=t.naturalHeight||t.videoHeight||t.displayHeight||t.height;super(i,n),this.source=e,this.noSubImage=!1}static crossOrigin(e,t,i){i===void 0&&!t.startsWith("data:")?e.crossOrigin=E2(t):i!==!1&&(e.crossOrigin=typeof i=="string"?i:"anonymous")}upload(e,t,i,n){const r=e.gl,a=t.realWidth,o=t.realHeight;if(n=n||this.source,typeof HTMLImageElement<"u"&&n instanceof HTMLImageElement){if(!n.complete||n.naturalWidth===0)return!1}else if(typeof HTMLVideoElement<"u"&&n instanceof HTMLVideoElement&&n.readyState<=1)return!1;return r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.alphaMode===Xi.UNPACK),!this.noSubImage&&t.target===r.TEXTURE_2D&&i.width===a&&i.height===o?r.texSubImage2D(r.TEXTURE_2D,0,0,0,t.format,i.type,n):(i.width=a,i.height=o,r.texImage2D(t.target,0,i.internalFormat,t.format,i.type,n)),!0}update(){if(this.destroyed)return;const e=this.source,t=e.naturalWidth||e.videoWidth||e.width,i=e.naturalHeight||e.videoHeight||e.height;this.resize(t,i),super.update()}dispose(){this.source=null}}class hb extends fr{constructor(e,t){if(t=t||{},typeof e=="string"){const i=new Image;fr.crossOrigin(i,e,t.crossorigin),i.src=e,e=i}super(e),!e.complete&&this._width&&this._height&&(this._width=0,this._height=0),this.url=e.src,this._process=null,this.preserveBitmap=!1,this.createBitmap=(t.createBitmap??We.CREATE_IMAGE_BITMAP)&&!!globalThis.createImageBitmap,this.alphaMode=typeof t.alphaMode=="number"?t.alphaMode:null,this.bitmap=null,this._load=null,t.autoLoad!==!1&&this.load()}load(e){return this._load?this._load:(e!==void 0&&(this.createBitmap=e),this._load=new Promise((t,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===Xi.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 gp{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=fi.add(i,fi.NW),this.x0=h+a*fi.uX(i),this.y0=l+o*fi.uY(i),i=fi.add(i,2),this.x1=h+a*fi.uX(i),this.y1=l+o*fi.uY(i),i=fi.add(i,2),this.x2=h+a*fi.uX(i),this.y2=l+o*fi.uY(i),i=fi.add(i,2),this.x3=h+a*fi.uX(i),this.y3=l+o*fi.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}}gp.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 iv=new gp;function mc(s){s.destroy=function(){},s.on=function(){},s.once=function(){},s.emit=function(){}}let mt=class ni 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 ni&&(e=e.baseTexture),this.baseTexture=e,this._frame=t,this.trim=n,this.valid=!1,this.destroyed=!1,this._uvs=iv,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 Xt(a.x,a.y):new Xt(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&&dn[t.url]&&ni.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,ni.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 ni(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===iv&&(this._uvs=new gp),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 gt){if(!e.cacheId){const o=(t==null?void 0:t.pixiIdPrefix)||"pixiid";e.cacheId=`${o}-${ka()}`,gt.addToCache(e,e.cacheId)}r=e.cacheId}else{if(!e._pixiId){const o=(t==null?void 0:t.pixiIdPrefix)||"pixiid";e._pixiId=`${o}_${ka()}`}r=e._pixiId}let a=dn[r];if(n&&i&&!a)throw new Error(`The cacheId "${r}" does not exist in TextureCache.`);return!a&&!(e instanceof gt)?(t.resolution||(t.resolution=dr(e)),a=new ni(new gt(e,t)),a.baseTexture.cacheId=r,gt.addToCache(a.baseTexture,r),ni.addToCache(a,r)):!a&&e instanceof gt&&(a=new ni(e),ni.addToCache(a,r)),a}static fromURL(e,t){const i=Object.assign({autoLoad:!1},t==null?void 0:t.resourceOptions),n=ni.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 ni(gt.fromBuffer(e,t,i,n))}static fromLoader(e,t,i,n){const r=new gt(e,Object.assign({scaleMode:gt.defaultOptions.scaleMode,resolution:dr(t)},n)),{resource:a}=r;a instanceof hb&&(a.url=t);const o=new ni(r);return i||(i=t),gt.addToCache(o.baseTexture,i),ni.addToCache(o,i),i!==t&&(gt.addToCache(o.baseTexture,t),ni.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),dn[t]&&dn[t]!==e&&console.warn(`Texture added to the cache with an id [${t}] that already had an entry`),dn[t]=e)}static removeFromCache(e){if(typeof e=="string"){const t=dn[e];if(t){const i=t.textureCacheIds.indexOf(e);return i>-1&&t.textureCacheIds.splice(i,1),delete dn[e],t}}else if(e!=null&&e.textureCacheIds){for(let t=0;t<e.textureCacheIds.length;++t)dn[e.textureCacheIds[t]]===e&&delete dn[e.textureCacheIds[t]];return e.textureCacheIds.length=0,e}return null}get resolution(){return this.baseTexture.resolution}get frame(){return this._frame}set frame(e){this._frame=e,this.noFrame=!1;const{x:t,y:i,width:n,height:r}=e,a=t+n>this.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 ni._EMPTY||(ni._EMPTY=new ni(new gt),mc(ni._EMPTY),mc(ni._EMPTY.baseTexture)),ni._EMPTY}static get WHITE(){if(!ni._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),ni._WHITE=new ni(gt.from(e)),mc(ni._WHITE),mc(ni._WHITE.baseTexture)}return ni._WHITE}};class Ua extends mt{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 cb(e))}}class ub{constructor(e){this.texturePool={},this.textureOptions=e||{},this.enableFullScreen=!1,this._pixelsWidth=0,this._pixelsHeight=0}createTexture(e,t,i=Ci.NONE){const n=new cb(Object.assign({width:e,height:t,resolution:1,multisample:i},this.textureOptions));return new Ua(n)}getOptimalTexture(e,t,i=1,n=Ci.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||Ci.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;n<i.length;n++)i[n].destroy(!0)}this.texturePool={}}setScreenSize(e){if(!(e.width===this._pixelsWidth&&e.height===this._pixelsHeight)){this.enableFullScreen=e.width>0&&e.height>0;for(const t in this.texturePool){if(!(Number(t)<0))continue;const i=this.texturePool[t];if(i)for(let n=0;n<i.length;n++)i[n].destroy(!0);this.texturePool[t]=[]}this._pixelsWidth=e.width,this._pixelsHeight=e.height}}}ub.SCREEN_KEY=-1;class nA extends Bn{constructor(){super(),this.addAttribute("aVertexPosition",new Float32Array([0,0,1,0,1,1,0,1])).addIndex([0,1,3,2])}}class db extends Bn{constructor(){super(),this.vertices=new Float32Array([-1,-1,1,-1,1,1,-1,1]),this.uvs=new Float32Array([0,0,1,0,1,1,0,1]),this.vertexBuffer=new oi(this.vertices),this.uvBuffer=new oi(this.uvs),this.addAttribute("aVertexPosition",this.vertexBuffer).addAttribute("aTextureCoord",this.uvBuffer).addIndex([0,1,2,0,2,3])}map(e,t){let i=0,n=0;return this.uvs[0]=i,this.uvs[1]=n,this.uvs[2]=i+t.width/e.width,this.uvs[3]=n,this.uvs[4]=i+t.width/e.width,this.uvs[5]=n+t.height/e.height,this.uvs[6]=i,this.uvs[7]=n+t.height/e.height,i=t.x,n=t.y,this.vertices[0]=i,this.vertices[1]=n,this.vertices[2]=i+t.width,this.vertices[3]=n,this.vertices[4]=i+t.width,this.vertices[5]=n+t.height,this.vertices[6]=i,this.vertices[7]=n+t.height,this.invalidate(),this}invalidate(){return this.vertexBuffer._updateID++,this.uvBuffer._updateID++,this}}class rA{constructor(){this.renderTexture=null,this.target=null,this.legacy=!1,this.resolution=1,this.multisample=Ci.NONE,this.sourceFrame=new Tt,this.destinationFrame=new Tt,this.bindingSourceFrame=new Tt,this.bindingDestinationFrame=new Tt,this.filters=[],this.transform=null}clear(){this.target=null,this.filters=null,this.renderTexture=null}}const pc=[new Xt,new Xt,new Xt,new Xt],Qd=new li;class fb{constructor(e){this.renderer=e,this.defaultFilterStack=[{}],this.texturePool=new ub,this.statePool=[],this.quad=new nA,this.quadUv=new db,this.tempRect=new Tt,this.activeState={},this.globalUniforms=new Qs({outputFrame:new Tt,inputSize:new Float32Array(4),inputPixel:new Float32Array(4),inputClamp:new Float32Array(4),resolution:1,filterArea:new Float32Array(4),filterClamp:new Float32Array(4)},!0),this.forceClear=!1,this.useMaxPadding=!1}init(){this.texturePool.setScreenSize(this.renderer.view)}push(e,t){const i=this.renderer,n=this.defaultFilterStack,r=this.statePool.pop()||new rA,a=i.renderTexture;let o,h;if(a.current){const g=a.current;o=g.resolution,h=g.multisample}else o=i.resolution,h=i.multisample;let l=t[0].resolution||o,c=t[0].multisample??h,u=t[0].padding,d=t[0].autoFit,f=t[0].legacy??!0;for(let g=1;g<t.length;g++){const v=t[g];l=Math.min(l,v.resolution||o),c=Math.min(c,v.multisample??h),u=this.useMaxPadding?Math.max(u,v.padding):u+v.padding,d=d&&v.autoFit,f=f||(v.legacy??!0)}n.length===1&&(this.defaultFilterStack[0].renderTexture=a.current),n.push(r),r.resolution=l,r.multisample=c,r.legacy=f,r.target=e,r.sourceFrame.copyFrom(e.filterArea||e.getBounds(!0)),r.sourceFrame.pad(u);const p=this.tempRect.copyFrom(a.sourceFrame);i.projection.transform&&this.transformAABB(Qd.copyFrom(i.projection.transform).invert(),p),d?(r.sourceFrame.fit(p),(r.sourceFrame.width<=0||r.sourceFrame.height<=0)&&(r.sourceFrame.width=0,r.sourceFrame.height=0)):r.sourceFrame.intersects(p)||(r.sourceFrame.width=0,r.sourceFrame.height=0),this.roundFrame(r.sourceFrame,a.current?a.current.resolution:i.resolution,a.sourceFrame,a.destinationFrame,i.projection.transform),r.renderTexture=this.getOptimalFilterTexture(r.sourceFrame.width,r.sourceFrame.height,l,c),r.filters=t,r.destinationFrame.width=r.renderTexture.width,r.destinationFrame.height=r.renderTexture.height;const m=this.tempRect;m.x=0,m.y=0,m.width=r.sourceFrame.width,m.height=r.sourceFrame.height,r.renderTexture.filterFrame=r.sourceFrame,r.bindingSourceFrame.copyFrom(a.sourceFrame),r.bindingDestinationFrame.copyFrom(a.destinationFrame),r.transform=i.projection.transform,i.projection.transform=null,a.bind(r.renderTexture,r.sourceFrame,m),i.framebuffer.clear(0,0,0,0)}pop(){const e=this.defaultFilterStack,t=e.pop(),i=t.filters;this.activeState=t;const n=this.globalUniforms.uniforms;n.outputFrame=t.sourceFrame,n.resolution=t.resolution;const r=n.inputSize,a=n.inputPixel,o=n.inputClamp;if(r[0]=t.destinationFrame.width,r[1]=t.destinationFrame.height,r[2]=1/r[0],r[3]=1/r[1],a[0]=Math.round(r[0]*t.resolution),a[1]=Math.round(r[1]*t.resolution),a[2]=1/a[0],a[3]=1/a[1],o[0]=.5*a[2],o[1]=.5*a[3],o[2]=t.sourceFrame.width*r[2]-.5*a[2],o[3]=t.sourceFrame.height*r[3]-.5*a[3],t.legacy){const l=n.filterArea;l[0]=t.destinationFrame.width,l[1]=t.destinationFrame.height,l[2]=t.sourceFrame.x,l[3]=t.sourceFrame.y,n.filterClamp=n.inputClamp}this.globalUniforms.update();const h=e[e.length-1];if(this.renderer.framebuffer.blit(),i.length===1)i[0].apply(this,t.renderTexture,h.renderTexture,Tn.BLEND,t),this.returnFilterTexture(t.renderTexture);else{let l=t.renderTexture,c=this.getOptimalFilterTexture(l.width,l.height,t.resolution);c.filterFrame=l.filterFrame;let u=0;for(u=0;u<i.length-1;++u){u===1&&t.multisample>1&&(c=this.getOptimalFilterTexture(l.width,l.height,t.resolution),c.filterFrame=l.filterFrame),i[u].apply(this,l,c,Tn.CLEAR,t);const d=l;l=c,c=d}i[u].apply(this,l,h.renderTexture,Tn.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=Tn.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===Tn.CLEAR||t===Tn.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(Cn.TRIANGLES)):(r.geometry.bind(this.quad),r.geometry.draw(Cn.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=Ci.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||Ci.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)}}}fb.extension={type:He.RendererSystem,name:"filter"};tt.add(fb);class aA{constructor(e){this.framebuffer=e,this.stencil=null,this.dirtyId=-1,this.dirtyFormat=-1,this.dirtySize=-1,this.multisample=Ci.NONE,this.msaaBuffer=null,this.blitFramebuffer=null,this.mipLevel=0}}const oA=new Tt;class mb{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<e.colorTextures.length;a++){const o=e.colorTextures[a];this.renderer.texture.unbind(o.parentTextureArray||o)}if(e.depthTexture&&this.renderer.texture.unbind(e.depthTexture),t){const a=t.width>>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 aA(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;a<r;a++){const o=n[a],h=o.parentTextureArray||o;this.renderer.texture.bind(h,0),a===0&&i.msaaBuffer&&(t.bindRenderbuffer(t.RENDERBUFFER,i.msaaBuffer),t.renderbufferStorageMultisample(t.RENDERBUFFER,i.multisample,h._glTextures[this.CONTEXT_UID].internalFormat,e.width,e.height))}e.depthTexture&&this.writeDepthTexture&&this.renderer.texture.bind(e.depthTexture,0)}updateFramebuffer(e,t){const{gl:i}=this,n=e.glFramebuffers[this.CONTEXT_UID],r=e.colorTextures;let a=r.length;i.drawBuffers||(a=Math.min(a,1)),n.multisample>1&&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;h<a;h++){const l=r[h],c=l.parentTextureArray||l;this.renderer.texture.bind(c,0),h===0&&n.msaaBuffer?(i.bindRenderbuffer(i.RENDERBUFFER,n.msaaBuffer),i.renderbufferStorageMultisample(i.RENDERBUFFER,n.multisample,c._glTextures[this.CONTEXT_UID].internalFormat,e.width,e.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.RENDERBUFFER,n.msaaBuffer)):(i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+h,l.target,c._glTextures[this.CONTEXT_UID].texture,t),o.push(i.COLOR_ATTACHMENT0+h))}if(o.length>1&&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=Ci.NONE;if(e<=1||t===null)return i;for(let n=0;n<t.length;n++)if(t[n]<=e){i=t[n];break}return i===1&&(i=Ci.NONE),i}blit(e,t,i){const{current:n,renderer:r,gl:a,CONTEXT_UID:o}=this;if(r.context.webGLVersion!==2||!n)return;const h=n.glFramebuffers[o];if(!h)return;if(!e){if(!h.msaaBuffer)return;const c=n.colorTextures[0];if(!c)return;h.blitFramebuffer||(h.blitFramebuffer=new tm(n.width,n.height),h.blitFramebuffer.addColorTexture(0,c)),e=h.blitFramebuffer,e.colorTextures[0]!==c&&(e.colorTextures[0]=c,e.dirtyId++,e.dirtyFormat++),(e.width!==n.width||e.height!==n.height)&&(e.width=n.width,e.height=n.height,e.dirtyId++,e.dirtySize++)}t||(t=oA,t.width=n.width,t.height=n.height),i||(i=t);const l=t.width===i.width&&t.height===i.height;this.bind(e),a.bindFramebuffer(a.READ_FRAMEBUFFER,h.framebuffer),a.blitFramebuffer(t.left,t.top,t.right,t.bottom,i.left,i.top,i.right,i.bottom,a.COLOR_BUFFER_BIT,l?a.NEAREST:a.LINEAR),a.bindFramebuffer(a.READ_FRAMEBUFFER,e.glFramebuffers[this.CONTEXT_UID].framebuffer)}disposeFramebuffer(e,t){const i=e.glFramebuffers[this.CONTEXT_UID],n=this.gl;if(!i)return;delete e.glFramebuffers[this.CONTEXT_UID];const r=this.managedFramebuffers.indexOf(e);r>=0&&this.managedFramebuffers.splice(r,1),e.disposeRunner.remove(this),t||(n.deleteFramebuffer(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;i<t.length;i++)this.disposeFramebuffer(t[i],e)}forceStencil(){const e=this.current;if(!e)return;const t=e.glFramebuffers[this.CONTEXT_UID];if(!t||t.stencil&&e.stencil)return;e.stencil=!0;const i=e.width,n=e.height,r=this.gl,a=t.stencil=r.createRenderbuffer();r.bindRenderbuffer(r.RENDERBUFFER,a);let o,h;this.renderer.context.webGLVersion===1?(o=r.DEPTH_STENCIL_ATTACHMENT,h=r.DEPTH_STENCIL):e.depth?(o=r.DEPTH_STENCIL_ATTACHMENT,h=r.DEPTH24_STENCIL8):(o=r.STENCIL_ATTACHMENT,h=r.STENCIL_INDEX8),t.msaaBuffer?r.renderbufferStorageMultisample(r.RENDERBUFFER,t.multisample,h,i,n):r.renderbufferStorage(r.RENDERBUFFER,h,i,n),r.framebufferRenderbuffer(r.FRAMEBUFFER,o,r.RENDERBUFFER,a)}reset(){this.current=this.unknownFramebuffer,this.viewport=new Tt}destroy(){this.renderer=null}}mb.extension={type:He.RendererSystem,name:"framebuffer"};tt.add(mb);const ef={5126:4,5123:2,5121:1};class pb{constructor(e){this.renderer=e,this._activeGeometry=null,this._activeVao=null,this.hasVao=!0,this.hasInstance=!0,this.canUseUInt32ElementIndex=!1,this.managedGeometries={}}contextChange(){this.disposeAll(!0);const e=this.gl=this.renderer.gl,t=this.renderer.context;if(this.CONTEXT_UID=this.renderer.CONTEXT_UID,t.webGLVersion!==2){let i=this.renderer.context.extensions.vertexArrayObject;We.PREFER_ENV===Na.WEBGL_LEGACY&&(i=null),i?(e.createVertexArray=()=>i.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<e.buffers.length;i++){const n=e.buffers[i];t.update(n)}}checkCompatibility(e,t){const i=e.attributes,n=t.attributeData;for(const r in n)if(!i[r])throw new Error(`shader and geometry incompatible, geometry missing the "${r}" attribute`)}getSignature(e,t){const i=e.attributes,n=t.attributeData,r=["g",e.id];for(const a in i)n[a]&&r.push(a,n[a].location);return r.join("-")}initGeometryVao(e,t,i=!0){const n=this.gl,r=this.CONTEXT_UID,a=this.renderer.buffer,o=t.program;o.glPrograms[r]||this.renderer.shader.generateProgram(t),this.checkCompatibility(e,o);const h=this.getSignature(e,o),l=e.glVertexArrayObjects[this.CONTEXT_UID];let c=l[h];if(c)return l[o.id]=c,c;const u=e.buffers,d=e.attributes,f={},p={};for(const m in u)f[m]=0,p[m]=0;for(const m in d)!d[m].size&&o.attributeData[m]?d[m].size=o.attributeData[m].size:d[m].size||console.warn(`PIXI Geometry attribute '${m}' size cannot be determined (likely the bound shader does not have the attribute)`),f[d[m].buffer]+=d[m].size*ef[d[m].type];for(const m in d){const g=d[m],v=g.size;g.stride===void 0&&(f[g.buffer]===v*ef[g.type]?g.stride=0:g.stride=f[g.buffer]),g.start===void 0&&(g.start=p[g.buffer],p[g.buffer]+=v*ef[g.type])}c=n.createVertexArray(),n.bindVertexArray(c);for(let m=0;m<u.length;m++){const g=u[m];a.bind(g),i&&g._glBuffers[r].refCount++}return this.activateVao(e,o),l[o.id]=c,l[h]=c,n.bindVertexArray(null),a.unbind(kn.ARRAY_BUFFER),c}disposeGeometry(e,t){var o;if(!this.managedGeometries[e.id])return;delete this.managedGeometries[e.id];const i=e.glVertexArrayObjects[this.CONTEXT_UID],n=this.gl,r=e.buffers,a=(o=this.renderer)==null?void 0:o.buffer;if(e.disposeRunner.remove(this),!!i){if(a)for(let h=0;h<r.length;h++){const l=r[h]._glBuffers[this.CONTEXT_UID];l&&(l.refCount--,l.refCount===0&&!t&&a.dispose(r[h],t))}if(!t){for(const h in i)if(h[0]==="g"){const l=i[h];this._activeVao===l&&this.unbind(),n.deleteVertexArray(l)}}delete e.glVertexArrayObjects[this.CONTEXT_UID]}}disposeAll(e){const t=Object.keys(this.managedGeometries);for(let i=0;i<t.length;i++)this.disposeGeometry(this.managedGeometries[t[i]],e)}activateVao(e,t){const i=this.gl,n=this.CONTEXT_UID,r=this.renderer.buffer,a=e.buffers,o=e.attributes;e.indexBuffer&&r.bind(e.indexBuffer);let h=null;for(const l in o){const c=o[l],u=a[c.buffer],d=u._glBuffers[n];if(t.attributeData[l]){h!==d&&(r.bind(u),h=d);const f=t.attributeData[l].location;if(i.enableVertexAttribArray(f),i.vertexAttribPointer(f,c.size,c.type||i.FLOAT,c.normalized,c.stride,c.start),c.instance)if(this.hasInstance)i.vertexAttribDivisor(f,c.divisor);else throw new Error("geometry error, GPU Instancing is not supported on this device")}}}draw(e,t,i,n){const{gl:r}=this,a=this._activeGeometry;if(a.indexBuffer){const o=a.indexBuffer.data.BYTES_PER_ELEMENT,h=o===2?r.UNSIGNED_SHORT:r.UNSIGNED_INT;o===2||o===4&&this.canUseUInt32ElementIndex?a.instanced?r.drawElementsInstanced(e,t||a.indexBuffer.data.length,h,(i||0)*o,n||1):r.drawElements(e,t||a.indexBuffer.data.length,h,(i||0)*o):console.warn("unsupported index buffer type: uint32")}else a.instanced?r.drawArraysInstanced(e,i,t||a.getSize(),n||1):r.drawArrays(e,i,t||a.getSize());return this}unbind(){this.gl.bindVertexArray(null),this._activeVao=null,this._activeGeometry=null}destroy(){this.renderer=null}}pb.extension={type:He.RendererSystem,name:"geometry"};tt.add(pb);const sv=new li;class vp{constructor(e,t){this._texture=e,this.mapCoord=new li,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._textureID=-1,this._updateID=0,this.clampOffset=0,this.clampMargin=typeof t>"u"?.5:t,this.isSimple=!1}get texture(){return this._texture}set texture(e){this._texture=e,this._textureID=-1}multiplyUvs(e,t){t===void 0&&(t=e);const i=this.mapCoord;for(let n=0;n<e.length;n+=2){const r=e[n],a=e[n+1];t[n]=r*i.a+a*i.c+i.tx,t[n+1]=r*i.b+a*i.d+i.ty}return t}update(e){const t=this._texture;if(!t||!t.valid||!e&&this._textureID===t._updateID)return!1;this._textureID=t._updateID,this._updateID++;const i=t._uvs;this.mapCoord.set(i.x1-i.x0,i.y1-i.y0,i.x3-i.x0,i.y3-i.y0,i.x0,i.y0);const n=t.orig,r=t.trim;r&&(sv.set(n.width/r.width,0,0,n.height/r.height,-r.x/r.width,-r.y/r.height),this.mapCoord.append(sv));const a=t.baseTexture,o=this.uClampFrame,h=this.clampMargin/a.resolution,l=this.clampOffset;return o[0]=(t._frame.x+h+l)/a.width,o[1]=(t._frame.y+h+l)/a.height,o[2]=(t._frame.x+t._frame.width-h+l)/a.width,o[3]=(t._frame.y+t._frame.height-h+l)/a.height,this.uClampOffset[0]=l/a.realWidth,this.uClampOffset[1]=l/a.realHeight,this.isSimple=t._frame.width===a.width&&t._frame.height===a.height&&t.rotate===0,!0}}var lA=`varying vec2 vMaskCoord;
|
||
varying vec2 vTextureCoord;
|
||
|
||
uniform sampler2D uSampler;
|
||
uniform sampler2D mask;
|
||
uniform float alpha;
|
||
uniform float npmAlpha;
|
||
uniform vec4 maskClamp;
|
||
|
||
void main(void)
|
||
{
|
||
float clip = step(3.5,
|
||
step(maskClamp.x, vMaskCoord.x) +
|
||
step(maskClamp.y, vMaskCoord.y) +
|
||
step(vMaskCoord.x, maskClamp.z) +
|
||
step(vMaskCoord.y, maskClamp.w));
|
||
|
||
vec4 original = texture2D(uSampler, vTextureCoord);
|
||
vec4 masky = texture2D(mask, vMaskCoord);
|
||
float alphaMul = 1.0 - npmAlpha * (1.0 - masky.a);
|
||
|
||
original *= (alphaMul * masky.r * alpha * clip);
|
||
|
||
gl_FragColor = original;
|
||
}
|
||
`,cA=`attribute vec2 aVertexPosition;
|
||
attribute vec2 aTextureCoord;
|
||
|
||
uniform mat3 projectionMatrix;
|
||
uniform mat3 otherMatrix;
|
||
|
||
varying vec2 vMaskCoord;
|
||
varying vec2 vTextureCoord;
|
||
|
||
void main(void)
|
||
{
|
||
gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
|
||
|
||
vTextureCoord = aTextureCoord;
|
||
vMaskCoord = ( otherMatrix * vec3( aTextureCoord, 1.0) ).xy;
|
||
}
|
||
`;class hA extends os{constructor(e,t,i){let n=null;typeof e!="string"&&t===void 0&&i===void 0&&(n=e,e=void 0,t=void 0,i=void 0),super(e||cA,t||lA,i),this.maskSprite=n,this.maskMatrix=new li}get maskSprite(){return this._maskSprite}set maskSprite(e){this._maskSprite=e,this._maskSprite&&(this._maskSprite.renderable=!1)}apply(e,t,i,n){const r=this._maskSprite,a=r._texture;a.valid&&(a.uvMatrix||(a.uvMatrix=new vp(a,0)),a.uvMatrix.update(),this.uniforms.npmAlpha=a.baseTexture.alphaMode?0:1,this.uniforms.mask=a,this.uniforms.otherMatrix=e.calculateSpriteMatrix(this.maskMatrix,r).prepend(a.uvMatrix.mapCoord),this.uniforms.alpha=r.worldAlpha,this.uniforms.maskClamp=a.uvMatrix.uClampFrame,e.applyFilter(this,t,i,n))}}class uA{constructor(e=null){this.type=Ri.NONE,this.autoDetect=!0,this.maskObject=e||null,this.pooled=!1,this.isMaskData=!0,this.resolution=null,this.multisample=os.defaultMultisample,this.enabled=!0,this.colorMask=15,this._filters=null,this._stencilCounter=0,this._scissorCounter=0,this._scissorRect=null,this._scissorRectLocal=null,this._colorMask=15,this._target=null}get filter(){return this._filters?this._filters[0]:null}set filter(e){e?this._filters?this._filters[0]=e:this._filters=[e]:this._filters=null}reset(){this.pooled&&(this.maskObject=null,this.type=Ri.NONE,this.autoDetect=!0),this._target=null,this._scissorRectLocal=null}copyCountersOrReset(e){e?(this._stencilCounter=e._stencilCounter,this._scissorCounter=e._scissorCounter,this._scissorRect=e._scissorRect):(this._stencilCounter=0,this._scissorCounter=0,this._scissorRect=null)}}class gb{constructor(e){this.renderer=e,this.enableScissor=!0,this.alphaMaskPool=[],this.maskDataPool=[],this.maskStack=[],this.alphaMaskIndex=0}setMaskStack(e){this.maskStack=e,this.renderer.scissor.setMaskStack(e),this.renderer.stencil.setMaskStack(e)}push(e,t){let i=t;if(!i.isMaskData){const r=this.maskDataPool.pop()||new uA;r.pooled=!0,r.maskObject=t,i=r}const n=this.maskStack.length!==0?this.maskStack[this.maskStack.length-1]:null;if(i.copyCountersOrReset(n),i._colorMask=n?n._colorMask:15,i.autoDetect&&this.detect(i),i._target=e,i.type!==Ri.SPRITE&&this.maskStack.push(i),i.enabled)switch(i.type){case Ri.SCISSOR:this.renderer.scissor.push(i);break;case Ri.STENCIL:this.renderer.stencil.push(i);break;case Ri.SPRITE:i.copyCountersOrReset(null),this.pushSpriteMask(i);break;case Ri.COLOR:this.pushColorMask(i);break}i.type===Ri.SPRITE&&this.maskStack.push(i)}pop(e){const t=this.maskStack.pop();if(!(!t||t._target!==e)){if(t.enabled)switch(t.type){case Ri.SCISSOR:this.renderer.scissor.pop(t);break;case Ri.STENCIL:this.renderer.stencil.pop(t.maskObject);break;case Ri.SPRITE:this.popSpriteMask(t);break;case Ri.COLOR:this.popColorMask(t);break}if(t.reset(),t.pooled&&this.maskDataPool.push(t),this.maskStack.length!==0){const i=this.maskStack[this.maskStack.length-1];i.type===Ri.SPRITE&&i._filters&&(i._filters[0].maskSprite=i.maskObject)}}}detect(e){const t=e.maskObject;t?t.isSprite?e.type=Ri.SPRITE:this.enableScissor&&this.renderer.scissor.testScissor(e)?e.type=Ri.SCISSOR:e.type=Ri.STENCIL:e.type=Ri.COLOR}pushSpriteMask(e){const{maskObject:t}=e,i=e._target;let n=e._filters;n||(n=this.alphaMaskPool[this.alphaMaskIndex],n||(n=this.alphaMaskPool[this.alphaMaskIndex]=[new hA])),n[0].resolution=e.resolution,n[0].multisample=e.multisample,n[0].maskSprite=t;const r=i.filterArea;i.filterArea=t.getBounds(!0),this.renderer.filter.push(i,n),i.filterArea=r,e._filters||this.alphaMaskIndex++}popSpriteMask(e){this.renderer.filter.pop(),e._filters?e._filters[0].maskSprite=null:(this.alphaMaskIndex--,this.alphaMaskPool[this.alphaMaskIndex][0].maskSprite=null)}pushColorMask(e){const t=e._colorMask,i=e._colorMask=t&e.colorMask;i!==t&&this.renderer.gl.colorMask((i&1)!==0,(i&2)!==0,(i&4)!==0,(i&8)!==0)}popColorMask(e){const t=e._colorMask,i=this.maskStack.length>0?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}}gb.extension={type:He.RendererSystem,name:"mask"};tt.add(gb);class vb{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 nv=new li,rv=[],yb=class $c extends vb{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,rv.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?nv.copyFrom(r):nv.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&&rv.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)}};yb.extension={type:He.RendererSystem,name:"scissor"};let dA=yb;tt.add(dA);class xb extends vb{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)}}xb.extension={type:He.RendererSystem,name:"stencil"};tt.add(xb);class bb{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}}bb.extension={type:[He.RendererSystem,He.CanvasRendererSystem],name:"_plugin"};tt.add(bb);class wb{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}}wb.extension={type:He.RendererSystem,name:"projection"};tt.add(wb);const fA=new pp,av=new Tt;class Sb{constructor(e){this.renderer=e,this._tempMatrix=new li}generateTexture(e,t){const{region:i,...n}=t||{},r=(i==null?void 0:i.copyTo(av))||e.getLocalBounds(av,!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=fA,this.renderer.render(e,{renderTexture:o,transform:this._tempMatrix,skipUpdateTransform:!!e.parent,blit:!0}),e.transform=h,o}destroy(){}}Sb.extension={type:[He.RendererSystem,He.CanvasRendererSystem],name:"textureGenerator"};tt.add(Sb);const aa=new Tt,qo=new Tt;class _b{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||(aa.width=e.frame.width,aa.height=e.frame.height,t=aa),i||(qo.x=e.frame.x,qo.y=e.frame.y,qo.width=t.width,qo.height=t.height,i=qo),a=r.framebuffer):(o=n.resolution,t||(aa.width=n._view.screen.width,aa.height=n._view.screen.height,t=aa),i||(i=aa,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=Wt.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}}_b.extension={type:He.RendererSystem,name:"renderTexture"};tt.add(_b);class mA{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 pA(s,e){const t={},i=e.getProgramParameter(s,e.ACTIVE_ATTRIBUTES);for(let n=0;n<i;n++){const r=e.getActiveAttrib(s,n);if(r.name.startsWith("gl_"))continue;const a=ab(e,r.type),o={type:a,name:r.name,size:rb(a),location:e.getAttribLocation(s,r.name)};t[r.name]=o}return t}function gA(s,e){const t={},i=e.getProgramParameter(s,e.ACTIVE_UNIFORMS);for(let n=0;n<i;n++){const r=e.getActiveUniform(s,n),a=r.name.replace(/\[.*?\]$/,""),o=!!r.name.match(/\[.*?\]$/),h=ab(e,r.type);t[a]={name:a,index:n,type:h,size:r.size,isArray:o,value:sb(h,r.size)}}return t}function vA(s,e){var o;const t=Z0(s,s.VERTEX_SHADER,e.vertexSrc),i=Z0(s,s.FRAGMENT_SHADER,e.fragmentSrc),n=s.createProgram();s.attachShader(n,t),s.attachShader(n,i);const r=(o=e.extra)==null?void 0:o.transformFeedbackVaryings;if(r&&(typeof s.transformFeedbackVaryings!="function"?console.warn("TransformFeedback is not supported but TransformFeedbackVaryings are given."):s.transformFeedbackVaryings(n,r.names,r.bufferMode==="separate"?s.SEPARATE_ATTRIBS:s.INTERLEAVED_ATTRIBS)),s.linkProgram(n),s.getProgramParameter(n,s.LINK_STATUS)||W2(s,n,t,i),e.attributeData=pA(n,s),e.uniformData=gA(n,s),!/^[ \t]*#[ \t]*version[ \t]+300[ \t]+es[ \t]*$/m.test(e.vertexSrc)){const h=Object.keys(e.attributeData);h.sort((l,c)=>l>c?1:-1);for(let l=0;l<h.length;l++)e.attributeData[h[l]].location=l,s.bindAttribLocation(n,l,h[l]);s.linkProgram(n)}s.deleteShader(t),s.deleteShader(i);const a={};for(const h in e.uniformData){const l=e.uniformData[h];a[h]={location:s.getUniformLocation(n,h),value:sb(l.type,l.size)}}return new mA(n,a)}function yA(s,e,t,i,n){t.buffer.update(n)}const xA={float:`
|
||
data[offset] = v;
|
||
`,vec2:`
|
||
data[offset] = v[0];
|
||
data[offset+1] = v[1];
|
||
`,vec3:`
|
||
data[offset] = v[0];
|
||
data[offset+1] = v[1];
|
||
data[offset+2] = v[2];
|
||
|
||
`,vec4:`
|
||
data[offset] = v[0];
|
||
data[offset+1] = v[1];
|
||
data[offset+2] = v[2];
|
||
data[offset+3] = v[3];
|
||
`,mat2:`
|
||
data[offset] = v[0];
|
||
data[offset+1] = v[1];
|
||
|
||
data[offset+4] = v[2];
|
||
data[offset+5] = v[3];
|
||
`,mat3:`
|
||
data[offset] = v[0];
|
||
data[offset+1] = v[1];
|
||
data[offset+2] = v[2];
|
||
|
||
data[offset + 4] = v[3];
|
||
data[offset + 5] = v[4];
|
||
data[offset + 6] = v[5];
|
||
|
||
data[offset + 8] = v[6];
|
||
data[offset + 9] = v[7];
|
||
data[offset + 10] = v[8];
|
||
`,mat4:`
|
||
for(var i = 0; i < 16; i++)
|
||
{
|
||
data[offset + i] = v[i];
|
||
}
|
||
`},Mb={float:4,vec2:8,vec3:12,vec4:16,int:4,ivec2:8,ivec3:12,ivec4:16,uint:4,uvec2:8,uvec3:12,uvec4:16,bool:4,bvec2:8,bvec3:12,bvec4:16,mat2:32,mat3:48,mat4:64};function bA(s){const e=s.map(r=>({data:r,offset:0,dataLen:0,dirty:0}));let t=0,i=0,n=0;for(let r=0;r<e.length;r++){const a=e[r];if(t=Mb[a.data.type],a.data.size>1&&(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 wA(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 SA(s,e){if(!s.autoManage)return{size:0,syncFunc:yA};const t=wA(s.uniforms,e),{uboElements:i,size:n}=bA(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;a<i.length;a++){const o=i[a],h=s.uniforms[o.data.name],l=o.data.name;let c=!1;for(let u=0;u<xo.length;u++){const d=xo[u];if(d.codeUbo&&d.test(o.data,h)){r.push(`offset = ${o.offset/4};`,xo[u].codeUbo(o.data.name,h)),c=!0;break}}if(!c)if(o.data.size>1){const u=rb(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=xA[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 _A=0;const gc={textureCount:0,uboCount:0};class Tb{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=_A++}systemCheck(){if(!q2())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]=G2(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]=SA(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=vA(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}}Tb.extension={type:He.RendererSystem,name:"shader"};tt.add(Tb);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 MA(s,e=[]){return e[ut.NORMAL]=[s.ONE,s.ONE_MINUS_SRC_ALPHA],e[ut.ADD]=[s.ONE,s.ONE],e[ut.MULTIPLY]=[s.DST_COLOR,s.ONE_MINUS_SRC_ALPHA,s.ONE,s.ONE_MINUS_SRC_ALPHA],e[ut.SCREEN]=[s.ONE,s.ONE_MINUS_SRC_COLOR,s.ONE,s.ONE_MINUS_SRC_ALPHA],e[ut.OVERLAY]=[s.ONE,s.ONE_MINUS_SRC_ALPHA],e[ut.DARKEN]=[s.ONE,s.ONE_MINUS_SRC_ALPHA],e[ut.LIGHTEN]=[s.ONE,s.ONE_MINUS_SRC_ALPHA],e[ut.COLOR_DODGE]=[s.ONE,s.ONE_MINUS_SRC_ALPHA],e[ut.COLOR_BURN]=[s.ONE,s.ONE_MINUS_SRC_ALPHA],e[ut.HARD_LIGHT]=[s.ONE,s.ONE_MINUS_SRC_ALPHA],e[ut.SOFT_LIGHT]=[s.ONE,s.ONE_MINUS_SRC_ALPHA],e[ut.DIFFERENCE]=[s.ONE,s.ONE_MINUS_SRC_ALPHA],e[ut.EXCLUSION]=[s.ONE,s.ONE_MINUS_SRC_ALPHA],e[ut.HUE]=[s.ONE,s.ONE_MINUS_SRC_ALPHA],e[ut.SATURATION]=[s.ONE,s.ONE_MINUS_SRC_ALPHA],e[ut.COLOR]=[s.ONE,s.ONE_MINUS_SRC_ALPHA],e[ut.LUMINOSITY]=[s.ONE,s.ONE_MINUS_SRC_ALPHA],e[ut.NONE]=[0,0],e[ut.NORMAL_NPM]=[s.SRC_ALPHA,s.ONE_MINUS_SRC_ALPHA,s.ONE,s.ONE_MINUS_SRC_ALPHA],e[ut.ADD_NPM]=[s.SRC_ALPHA,s.ONE,s.ONE,s.ONE],e[ut.SCREEN_NPM]=[s.SRC_ALPHA,s.ONE_MINUS_SRC_COLOR,s.ONE,s.ONE_MINUS_SRC_ALPHA],e[ut.SRC_IN]=[s.DST_ALPHA,s.ZERO],e[ut.SRC_OUT]=[s.ONE_MINUS_DST_ALPHA,s.ZERO],e[ut.SRC_ATOP]=[s.DST_ALPHA,s.ONE_MINUS_SRC_ALPHA],e[ut.DST_OVER]=[s.ONE_MINUS_DST_ALPHA,s.ONE],e[ut.DST_IN]=[s.ZERO,s.SRC_ALPHA],e[ut.DST_OUT]=[s.ZERO,s.ONE_MINUS_SRC_ALPHA],e[ut.DST_ATOP]=[s.ONE_MINUS_DST_ALPHA,s.SRC_ALPHA],e[ut.XOR]=[s.ONE_MINUS_DST_ALPHA,s.ONE_MINUS_SRC_ALPHA],e[ut.SUBTRACT]=[s.ONE,s.ONE,s.ONE,s.ONE,s.FUNC_REVERSE_SUBTRACT,s.FUNC_ADD],e}const TA=0,AA=1,EA=2,CA=3,IA=4,RA=5,Ab=class im{constructor(){this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode=ut.NONE,this._blendEq=!1,this.map=[],this.map[TA]=this.setBlend,this.map[AA]=this.setOffset,this.map[EA]=this.setCullFace,this.map[CA]=this.setDepthTest,this.map[IA]=this.setFrontFace,this.map[RA]=this.setDepthMask,this.checks=[],this.defaultState=new Ln,this.defaultState.blend=!0}contextChange(e){this.gl=e,this.blendModes=MA(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<<i)),t=t>>1,i++;this.stateId=e.data}for(let t=0;t<this.checks.length;t++)this.checks[t](this,e)}forceState(e){e=e||this.defaultState;for(let t=0;t<this.map.length;t++)this.map[t].call(this,!!(e.data&1<<t));for(let t=0;t<this.checks.length;t++)this.checks[t](this,e);this.stateId=e.data}setBlend(e){this.updateCheck(im.checkBlendMode,e),this.gl[e?"enable":"disable"](this.gl.BLEND)}setOffset(e){this.updateCheck(im.checkPolygonOffset,e),this.gl[e?"enable":"disable"](this.gl.POLYGON_OFFSET_FILL)}setDepthTest(e){this.gl[e?"enable":"disable"](this.gl.DEPTH_TEST)}setDepthMask(e){this.gl.depthMask(e)}setCullFace(e){this.gl[e?"enable":"disable"](this.gl.CULL_FACE)}setFrontFace(e){this.gl.frontFace(this.gl[e?"CW":"CCW"])}setBlendMode(e){if(e===this.blendMode)return;this.blendMode=e;const t=this.blendModes[e],i=this.gl;t.length===2?i.blendFunc(t[0],t[1]):i.blendFuncSeparate(t[0],t[1],t[2],t[3]),t.length===6?(this._blendEq=!0,i.blendEquationSeparate(t[4],t[5])):this._blendEq&&(this._blendEq=!1,i.blendEquationSeparate(i.FUNC_ADD,i.FUNC_ADD))}setPolygonOffset(e,t){this.gl.polygonOffset(e,t)}reset(){this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,!1),this.forceState(this.defaultState),this._blendEq=!0,this.blendMode=-1,this.setBlendMode(0)}updateCheck(e,t){const i=this.checks.indexOf(e);t&&i===-1?this.checks.push(e):!t&&i!==-1&&this.checks.splice(i,1)}static checkBlendMode(e,t){e.setBlendMode(t.blendMode)}static checkPolygonOffset(e,t){e.setPolygonOffset(1,t.polygonOffset)}destroy(){this.gl=null}};Ab.extension={type:He.RendererSystem,name:"state"};let PA=Ab;tt.add(PA);class kA extends jl{constructor(){super(...arguments),this.runners={},this._systemsHash={}}setup(e){this.addRunners(...e.runners);const t=(e.priority??[]).filter(n=>e.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 Js(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 rl=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!==up.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;n<t.length;n++){const r=t[n];r.resource&&this.count-r.touched>this.maxIdle&&(e.destroyTexture(r,!0),t[n]=null,i=!0)}if(i){let n=0;for(let r=0;r<t.length;r++)t[r]!==null&&(t[n++]=t[r]);t.length=n}}unload(e){const t=this.renderer.texture,i=e._texture;i&&!i.framebuffer&&t.destroyTexture(i);for(let n=e.children.length-1;n>=0;n--)this.unload(e.children[n])}destroy(){this.renderer=null}};rl.defaultMode=up.AUTO,rl.defaultMaxIdle=3600,rl.defaultCheckCountMax=600,rl.extension={type:He.RendererSystem,name:"textureGC"};let ma=rl;tt.add(ma);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=De.RGBA,this.samplerType=0}}function FA(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 OA(s){let e;return"WebGL2RenderingContext"in globalThis&&s instanceof globalThis.WebGL2RenderingContext?e={[et.UNSIGNED_BYTE]:{[De.RGBA]:s.RGBA8,[De.RGB]:s.RGB8,[De.RG]:s.RG8,[De.RED]:s.R8,[De.RGBA_INTEGER]:s.RGBA8UI,[De.RGB_INTEGER]:s.RGB8UI,[De.RG_INTEGER]:s.RG8UI,[De.RED_INTEGER]:s.R8UI,[De.ALPHA]:s.ALPHA,[De.LUMINANCE]:s.LUMINANCE,[De.LUMINANCE_ALPHA]:s.LUMINANCE_ALPHA},[et.BYTE]:{[De.RGBA]:s.RGBA8_SNORM,[De.RGB]:s.RGB8_SNORM,[De.RG]:s.RG8_SNORM,[De.RED]:s.R8_SNORM,[De.RGBA_INTEGER]:s.RGBA8I,[De.RGB_INTEGER]:s.RGB8I,[De.RG_INTEGER]:s.RG8I,[De.RED_INTEGER]:s.R8I},[et.UNSIGNED_SHORT]:{[De.RGBA_INTEGER]:s.RGBA16UI,[De.RGB_INTEGER]:s.RGB16UI,[De.RG_INTEGER]:s.RG16UI,[De.RED_INTEGER]:s.R16UI,[De.DEPTH_COMPONENT]:s.DEPTH_COMPONENT16},[et.SHORT]:{[De.RGBA_INTEGER]:s.RGBA16I,[De.RGB_INTEGER]:s.RGB16I,[De.RG_INTEGER]:s.RG16I,[De.RED_INTEGER]:s.R16I},[et.UNSIGNED_INT]:{[De.RGBA_INTEGER]:s.RGBA32UI,[De.RGB_INTEGER]:s.RGB32UI,[De.RG_INTEGER]:s.RG32UI,[De.RED_INTEGER]:s.R32UI,[De.DEPTH_COMPONENT]:s.DEPTH_COMPONENT24},[et.INT]:{[De.RGBA_INTEGER]:s.RGBA32I,[De.RGB_INTEGER]:s.RGB32I,[De.RG_INTEGER]:s.RG32I,[De.RED_INTEGER]:s.R32I},[et.FLOAT]:{[De.RGBA]:s.RGBA32F,[De.RGB]:s.RGB32F,[De.RG]:s.RG32F,[De.RED]:s.R32F,[De.DEPTH_COMPONENT]:s.DEPTH_COMPONENT32F},[et.HALF_FLOAT]:{[De.RGBA]:s.RGBA16F,[De.RGB]:s.RGB16F,[De.RG]:s.RG16F,[De.RED]:s.R16F},[et.UNSIGNED_SHORT_5_6_5]:{[De.RGB]:s.RGB565},[et.UNSIGNED_SHORT_4_4_4_4]:{[De.RGBA]:s.RGBA4},[et.UNSIGNED_SHORT_5_5_5_1]:{[De.RGBA]:s.RGB5_A1},[et.UNSIGNED_INT_2_10_10_10_REV]:{[De.RGBA]:s.RGB10_A2,[De.RGBA_INTEGER]:s.RGB10_A2UI},[et.UNSIGNED_INT_10F_11F_11F_REV]:{[De.RGB]:s.R11F_G11F_B10F},[et.UNSIGNED_INT_5_9_9_9_REV]:{[De.RGB]:s.RGB9_E5},[et.UNSIGNED_INT_24_8]:{[De.DEPTH_STENCIL]:s.DEPTH24_STENCIL8},[et.FLOAT_32_UNSIGNED_INT_24_8_REV]:{[De.DEPTH_STENCIL]:s.DEPTH32F_STENCIL8}}:e={[et.UNSIGNED_BYTE]:{[De.RGBA]:s.RGBA,[De.RGB]:s.RGB,[De.ALPHA]:s.ALPHA,[De.LUMINANCE]:s.LUMINANCE,[De.LUMINANCE_ALPHA]:s.LUMINANCE_ALPHA},[et.UNSIGNED_SHORT_5_6_5]:{[De.RGB]:s.RGB},[et.UNSIGNED_SHORT_4_4_4_4]:{[De.RGBA]:s.RGBA},[et.UNSIGNED_SHORT_5_5_5_1]:{[De.RGBA]:s.RGBA}},e}class Eb{constructor(e){this.renderer=e,this.boundTextures=[],this.currentLocation=-1,this.managedTextures=[],this._unknownBoundTextures=!1,this.unknownTexture=new gt,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=OA(e),this.samplerTypes=FA(e);const t=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS);this.boundTextures.length=t;for(let n=0;n<t;n++)this.boundTextures[n]=null;this.emptyTextures={};const i=new tf(e.createTexture());e.bindTexture(e.TEXTURE_2D,i.texture),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,1,1,0,e.RGBA,e.UNSIGNED_BYTE,new Uint8Array(4)),this.emptyTextures[e.TEXTURE_2D]=i,this.emptyTextures[e.TEXTURE_CUBE_MAP]=new tf(e.createTexture()),e.bindTexture(e.TEXTURE_CUBE_MAP,this.emptyTextures[e.TEXTURE_CUBE_MAP].texture);for(let n=0;n<6;n++)e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+n,0,e.RGBA,1,1,0,e.RGBA,e.UNSIGNED_BYTE,null);e.texParameteri(e.TEXTURE_CUBE_MAP,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_CUBE_MAP,e.TEXTURE_MIN_FILTER,e.LINEAR);for(let n=0;n<this.boundTextures.length;n++)this.bind(null,n)}bind(e,t=0){const{gl:i}=this;if(e=e==null?void 0:e.castToBaseTexture(),(e==null?void 0:e.valid)&&!e.parentTextureArray){e.touched=this.renderer.textureGC.count;const n=e._glTextures[this.CONTEXT_UID]||this.initTexture(e);this.boundTextures[t]!==e&&(this.currentLocation!==t&&(this.currentLocation=t,i.activeTexture(i.TEXTURE0+t)),i.bindTexture(e.target,n.texture)),n.dirtyId!==e.dirtyId?(this.currentLocation!==t&&(this.currentLocation=t,i.activeTexture(i.TEXTURE0+t)),this.updateTexture(e)):n.dirtyStyleId!==e.dirtyStyleId&&this.updateTextureStyle(e),this.boundTextures[t]=e}else this.currentLocation!==t&&(this.currentLocation=t,i.activeTexture(i.TEXTURE0+t)),i.bindTexture(i.TEXTURE_2D,this.emptyTextures[i.TEXTURE_2D].texture),this.boundTextures[t]=null}reset(){this._unknownBoundTextures=!0,this.hasIntegerTextures=!1,this.currentLocation=-1;for(let e=0;e<this.boundTextures.length;e++)this.boundTextures[e]=this.unknownTexture}unbind(e){const{gl:t,boundTextures:i}=this;if(this._unknownBoundTextures){this._unknownBoundTextures=!1;for(let n=0;n<i.length;n++)i[n]===this.unknownTexture&&this.bind(null,n)}for(let n=0;n<i.length;n++)i[n]===e&&(this.currentLocation!==n&&(t.activeTexture(t.TEXTURE0+n),this.currentLocation=n),t.bindTexture(e.target,this.emptyTextures[e.target].texture),i[n]=null)}ensureSamplerType(e){const{boundTextures:t,hasIntegerTextures:i,CONTEXT_UID:n}=this;if(i)for(let r=e-1;r>=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===Bs.POW2||this.webGLVersion!==2)&&!e.isPowerOfTwo?t.mipmap=!1:t.mipmap=e.mipmap>=1,this.webGLVersion!==2&&!e.isPowerOfTwo?t.wrapMode=Zs.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!==Bs.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===zs.LINEAR?i.LINEAR_MIPMAP_LINEAR:i.NEAREST_MIPMAP_NEAREST);const n=this.renderer.context.extensions.anisotropicFiltering;if(n&&e.anisotropicLevel>0&&e.scaleMode===zs.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===zs.LINEAR?i.LINEAR:i.NEAREST);i.texParameteri(e.target,i.TEXTURE_MAG_FILTER,e.scaleMode===zs.LINEAR?i.LINEAR:i.NEAREST)}destroy(){this.renderer=null}}Eb.extension={type:He.RendererSystem,name:"texture"};tt.add(Eb);class Cb{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<e.buffers.length;a++){const o=e.buffers[a];o&&(i.buffer.update(o),o._glBuffers[n].refCount++,t.bindBufferBase(t.TRANSFORM_FEEDBACK_BUFFER,a,o._glBuffers[n].buffer||null))}return t.bindTransformFeedback(t.TRANSFORM_FEEDBACK,null),e.disposeRunner.add(this),r}disposeTransformFeedback(e,t){const i=e._glTransformFeedbacks[this.CONTEXT_UID],n=this.gl;e.disposeRunner.remove(this);const r=this.renderer.buffer;if(r)for(let a=0;a<e.buffers.length;a++){const o=e.buffers[a];if(!o)continue;const h=o._glBuffers[this.CONTEXT_UID];h&&(h.refCount--,h.refCount===0&&!t&&r.dispose(o,t))}i&&(t||n.deleteTransformFeedback(i),delete e._glTransformFeedbacks[this.CONTEXT_UID])}destroy(){this.renderer=null}}Cb.extension={type:He.RendererSystem,name:"transformFeedback"};tt.add(Cb);class wh{constructor(e){this.renderer=e}init(e){this.screen=new Tt(0,0,e.width,e.height),this.element=e.view||We.ADAPTER.createCanvas(),this.resolution=e.resolution||We.RESOLUTION,this.autoDensity=!!e.autoDensity}resizeView(e,t){this.element.width=Math.round(e*this.resolution),this.element.height=Math.round(t*this.resolution);const i=this.element.width/this.resolution,n=this.element.height/this.resolution;this.screen.width=i,this.screen.height=n,this.autoDensity&&(this.element.style.width=`${i}px`,this.element.style.height=`${n}px`),this.renderer.emit("resize",i,n),this.renderer.runners.resize.emit(this.screen.width,this.screen.height)}destroy(e){var t;e&&((t=this.element.parentNode)==null||t.removeChild(this.element)),this.renderer=null,this.element=null,this.screen=null}}wh.defaultOptions={width:800,height:600,resolution:void 0,autoDensity:!1},wh.extension={type:[He.RendererSystem,He.CanvasRendererSystem],name:"_view"};tt.add(wh);We.PREFER_ENV=Na.WEBGL2;We.STRICT_TEXTURE_CACHE=!1;We.RENDER_OPTIONS={...xh.defaultOptions,...yh.defaultOptions,...wh.defaultOptions,...bh.defaultOptions};Object.defineProperties(We,{WRAP_MODE:{get(){return gt.defaultOptions.wrapMode},set(s){kt("7.1.0","settings.WRAP_MODE is deprecated, use BaseTexture.defaultOptions.wrapMode"),gt.defaultOptions.wrapMode=s}},SCALE_MODE:{get(){return gt.defaultOptions.scaleMode},set(s){kt("7.1.0","settings.SCALE_MODE is deprecated, use BaseTexture.defaultOptions.scaleMode"),gt.defaultOptions.scaleMode=s}},MIPMAP_TEXTURES:{get(){return gt.defaultOptions.mipmap},set(s){kt("7.1.0","settings.MIPMAP_TEXTURES is deprecated, use BaseTexture.defaultOptions.mipmap"),gt.defaultOptions.mipmap=s}},ANISOTROPIC_LEVEL:{get(){return gt.defaultOptions.anisotropicLevel},set(s){kt("7.1.0","settings.ANISOTROPIC_LEVEL is deprecated, use BaseTexture.defaultOptions.anisotropicLevel"),gt.defaultOptions.anisotropicLevel=s}},FILTER_RESOLUTION:{get(){return kt("7.1.0","settings.FILTER_RESOLUTION is deprecated, use Filter.defaultResolution"),os.defaultResolution},set(s){os.defaultResolution=s}},FILTER_MULTISAMPLE:{get(){return kt("7.1.0","settings.FILTER_MULTISAMPLE is deprecated, use Filter.defaultMultisample"),os.defaultMultisample},set(s){os.defaultMultisample=s}},SPRITE_MAX_TEXTURES:{get(){return Tr.defaultMaxTextures},set(s){kt("7.1.0","settings.SPRITE_MAX_TEXTURES is deprecated, use BatchRenderer.defaultMaxTextures"),Tr.defaultMaxTextures=s}},SPRITE_BATCH_SIZE:{get(){return Tr.defaultBatchSize},set(s){kt("7.1.0","settings.SPRITE_BATCH_SIZE is deprecated, use BatchRenderer.defaultBatchSize"),Tr.defaultBatchSize=s}},CAN_UPLOAD_SAME_BUFFER:{get(){return Tr.canUploadSameBuffer},set(s){kt("7.1.0","settings.CAN_UPLOAD_SAME_BUFFER is deprecated, use BatchRenderer.canUploadSameBuffer"),Tr.canUploadSameBuffer=s}},GC_MODE:{get(){return ma.defaultMode},set(s){kt("7.1.0","settings.GC_MODE is deprecated, use TextureGCSystem.defaultMode"),ma.defaultMode=s}},GC_MAX_IDLE:{get(){return ma.defaultMaxIdle},set(s){kt("7.1.0","settings.GC_MAX_IDLE is deprecated, use TextureGCSystem.defaultMaxIdle"),ma.defaultMaxIdle=s}},GC_MAX_CHECK_COUNT:{get(){return ma.defaultCheckCountMax},set(s){kt("7.1.0","settings.GC_MAX_CHECK_COUNT is deprecated, use TextureGCSystem.defaultCheckCountMax"),ma.defaultCheckCountMax=s}},PRECISION_VERTEX:{get(){return In.defaultVertexPrecision},set(s){kt("7.1.0","settings.PRECISION_VERTEX is deprecated, use Program.defaultVertexPrecision"),In.defaultVertexPrecision=s}},PRECISION_FRAGMENT:{get(){return In.defaultFragmentPrecision},set(s){kt("7.1.0","settings.PRECISION_FRAGMENT is deprecated, use Program.defaultFragmentPrecision"),In.defaultFragmentPrecision=s}}});var Fa=(s=>(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))(Fa||{});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 Ib=class ys{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/ys.targetFPMS,this.elapsedMS=1/ys.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=Fa.NORMAL){return this._addListener(new sf(e,t,i))}addOnce(e,t,i=Fa.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._minElapsedMS)return;this._lastFrame=e-r%this._minElapsedMS}this.deltaMS=t,this.deltaTime=this.deltaMS*ys.targetFPMS;const i=this._head;let n=i.next;for(;n;)n=n.emit(this.deltaTime);i.next||this._cancelIfNeeded()}else this.deltaTime=this.deltaMS=this.elapsedMS=0;this.lastTime=e}get FPS(){return 1e3/this.elapsedMS}get minFPS(){return 1e3/this._maxElapsedMS}set minFPS(e){const t=Math.min(this.maxFPS,e),i=Math.min(Math.max(0,t)/1e3,ys.targetFPMS);this._maxElapsedMS=1/i}get maxFPS(){return this._minElapsedMS?Math.round(1e3/this._minElapsedMS):0}set maxFPS(e){if(e===0)this._minElapsedMS=0;else{const t=Math.max(this.minFPS,e);this._minElapsedMS=1/(t/1e3)}}static get shared(){if(!ys._shared){const e=ys._shared=new ys;e.autoStart=!0,e._protected=!0}return ys._shared}static get system(){if(!ys._system){const e=ys._system=new ys;e.autoStart=!0,e._protected=!0}return ys._system}};Ib.targetFPMS=.06;let ls=Ib;Object.defineProperties(We,{TARGET_FPMS:{get(){return ls.targetFPMS},set(s){kt("7.1.0","settings.TARGET_FPMS is deprecated, use Ticker.targetFPMS"),ls.targetFPMS=s}}});class Rb{static init(e){e=Object.assign({autoStart:!0,sharedTicker:!1},e),Object.defineProperty(this,"ticker",{set(t){this._ticker&&this._ticker.remove(this.render,this),this._ticker=t,t&&t.add(this.render,this,Fa.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=e.sharedTicker?ls.shared:new ls,e.autoStart&&this.start()}static destroy(){if(this._ticker){const e=this._ticker;this.ticker=null,e.destroy()}}}Rb.extension=He.Application;tt.add(Rb);const Pb=[];tt.handleByList(He.Renderer,Pb);function BA(s){for(const e of Pb)if(e.test(s))return new e(s);throw new Error("Unable to auto-detect a suitable renderer.")}var LA=`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;
|
||
}`,DA=`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 NA=LA,kb=DA;class Fb{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>=Ci.HIGH?this.multisample=Ci.HIGH:t>=Ci.MEDIUM?this.multisample=Ci.MEDIUM:t>=Ci.LOW?this.multisample=Ci.LOW:this.multisample=Ci.NONE}destroy(){}}Fb.extension={type:He.RendererSystem,name:"_multisample"};tt.add(Fb);class UA{constructor(e){this.buffer=e||null,this.updateID=-1,this.byteLength=-1,this.refCount=0}}class Ob{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;i<t.length;i++)this.dispose(this.managedBuffers[t[i]],e)}createGLBuffer(e){const{CONTEXT_UID:t,gl:i}=this;return e._glBuffers[t]=new UA(i.createBuffer()),this.managedBuffers[e.id]=e,e.disposeRunner.add(this),e._glBuffers[t]}}Ob.extension={type:He.RendererSystem,name:"buffer"};tt.add(Ob);class Bb{constructor(e){this.renderer=e}render(e,t){const i=this.renderer;let n,r,a,o;if(t&&(n=t.renderTexture,r=t.clear,a=t.transform,o=t.skipUpdateTransform),this.renderingToScreen=!n,i.runners.prerender.emit(),i.emit("prerender"),i.projection.transform=a,!i.context.isLost){if(n||(this.lastObjectRendered=e),!o){const h=e.enableTempParent();e.updateTransform(),e.disableTempParent(h)}i.renderTexture.bind(n),i.batch.currentRenderer.start(),(r??i.background.clearBeforeRender)&&i.renderTexture.clear(),e.render(i),i.batch.currentRenderer.flush(),n&&(t.blit&&i.framebuffer.blit(),n.baseTexture.update()),i.runners.postrender.emit(),i.projection.transform=null,i.emit("postrender")}}destroy(){this.renderer=null,this.lastObjectRendered=null}}Bb.extension={type:He.RendererSystem,name:"objectRenderer"};tt.add(Bb);const Hc=class sm extends kA{constructor(e){super(),this.type=Bx.WEBGL,e=Object.assign({},We.RENDER_OPTIONS,e),this.gl=null,this.CONTEXT_UID=0,this.globalUniforms=new Qs({projectionMatrix:new li},!0);const t={runners:["init","destroy","contextChange","resolutionChange","reset","update","postrender","prerender","resize"],systems:sm.__systems,priority:["_view","textureGenerator","background","_plugin","startup","context","state","texture","buffer","geometry","framebuffer","transformFeedback","mask","scissor","stencil","projection","textureGC","filter","renderTexture","batch","objectRenderer","_multisample"]};this.setup(t),"useContextAlpha"in e&&(kt("7.0.0","options.useContextAlpha is deprecated, use options.premultipliedAlpha and options.backgroundAlpha instead"),e.premultipliedAlpha=e.useContextAlpha&&e.useContextAlpha!=="notMultiplied",e.backgroundAlpha=e.useContextAlpha===!1?1:e.backgroundAlpha),this._plugin.rendererPlugins=sm.__plugins,this.options=e,this.startup.run(this.options)}static test(e){return e!=null&&e.forceCanvas?!1:c2()}render(e,t){this.objectRenderer.render(e,t)}resize(e,t){this._view.resizeView(e,t)}reset(){return this.runners.reset.emit(),this}clear(){this.renderTexture.bind(),this.renderTexture.clear()}destroy(e=!1){this.runners.destroy.items.reverse(),this.emitWithCustomOptions(this.runners.destroy,{_view:e}),super.destroy()}get plugins(){return this._plugin.plugins}get multisample(){return this._multisample.multisample}get width(){return this._view.element.width}get height(){return this._view.element.height}get resolution(){return this._view.resolution}set resolution(e){this._view.resolution=e,this.runners.resolutionChange.emit(e)}get autoDensity(){return this._view.autoDensity}get view(){return this._view.element}get screen(){return this._view.screen}get lastObjectRendered(){return this.objectRenderer.lastObjectRendered}get renderingToScreen(){return this.objectRenderer.renderingToScreen}get rendererLogId(){return`WebGL ${this.context.webGLVersion}`}get clearBeforeRender(){return kt("7.0.0","renderer.clearBeforeRender has been deprecated, please use renderer.background.clearBeforeRender instead."),this.background.clearBeforeRender}get useContextAlpha(){return kt("7.0.0","renderer.useContextAlpha has been deprecated, please use renderer.context.premultipliedAlpha instead."),this.context.useContextAlpha}get preserveDrawingBuffer(){return kt("7.0.0","renderer.preserveDrawingBuffer has been deprecated, we cannot truly know this unless pixi created the context"),this.context.preserveDrawingBuffer}get backgroundColor(){return kt("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color}set backgroundColor(e){kt("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color=e}get backgroundAlpha(){return kt("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha}set backgroundAlpha(e){kt("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha=e}get powerPreference(){return kt("7.0.0","renderer.powerPreference has been deprecated, we can only know this if pixi creates the context"),this.context.powerPreference}generateTexture(e,t){return this.textureGenerator.generateTexture(e,t)}};Hc.extension={type:He.Renderer,priority:1},Hc.__plugins={},Hc.__systems={};let yp=Hc;tt.handleByMap(He.RendererPlugin,yp.__plugins);tt.handleByMap(He.RendererSystem,yp.__systems);tt.add(yp);class Lb extends Bl{constructor(e,t){const{width:i,height:n}=t||{};super(i,n),this.items=[],this.itemDirtyIds=[];for(let r=0;r<e;r++){const a=new gt;this.items.push(a),this.itemDirtyIds.push(-2)}this.length=e,this._load=null,this.baseTexture=null}initFromArray(e,t){for(let i=0;i<this.length;i++)e[i]&&(e[i].castToBaseTexture?this.addBaseTextureAt(e[i].castToBaseTexture(),i):e[i]instanceof Bl?this.addResourceAt(e[i],i):this.addResourceAt(eb(e[i],t),i))}dispose(){for(let e=0,t=this.length;e<t;e++)this.items[e].destroy();this.items=null,this.itemDirtyIds=null,this._load=null}addResourceAt(e,t){if(!this.items[t])throw new Error(`Index ${t} is out of bounds`);return e.valid&&!this.valid&&this.resize(e.width,e.height),this.items[t].setResource(e),this}bind(e){if(this.baseTexture!==null)throw new Error("Only one base texture per TextureArray is allowed");super.bind(e);for(let t=0;t<this.length;t++)this.items[t].parentTextureArray=e,this.items[t].on("update",e.update,e)}unbind(e){super.unbind(e);for(let t=0;t<this.length;t++)this.items[t].parentTextureArray=null,this.items[t].off("update",e.update,e)}load(){if(this._load)return this._load;const e=this.items.map(t=>t.resource).filter(t=>t).map(t=>t.load());return this._load=Promise.all(e).then(()=>{const{realWidth:t,realHeight:i}=this.items[0];return this.resize(t,i),this.update(),Promise.resolve(this)}),this._load}}class XA extends Lb{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;h<n;h++){const l=a[h];r[h]<l.dirtyId&&(r[h]=l.dirtyId,l.valid&&o.texSubImage3D(o.TEXTURE_2D_ARRAY,0,0,0,h,l.resource.width,l.resource.height,1,t.format,i.type,l.resource.source))}return!0}}class VA extends fr{constructor(e){super(e)}static test(e){const{OffscreenCanvas:t}=globalThis;return t&&e instanceof t?!0:globalThis.HTMLCanvasElement&&e instanceof HTMLCanvasElement}}const Db=class al extends Lb{constructor(e,t){const{width:i,height:n,autoLoad:r,linkBaseTexture:a}=t||{};if(e&&e.length!==al.SIDES)throw new Error(`Invalid length. Got ${e.length}, expected 6`);super(6,{width:i,height:n});for(let o=0;o<al.SIDES;o++)this.items[o].target=vo.TEXTURE_CUBE_MAP_POSITIVE_X+o;this.linkBaseTexture=a!==!1,e&&this.initFromArray(e,t),r!==!1&&this.load()}bind(e){super.bind(e),e.target=vo.TEXTURE_CUBE_MAP}addBaseTextureAt(e,t,i){if(i===void 0&&(i=this.linkBaseTexture),!this.items[t])throw new Error(`Index ${t} is out of bounds`);if(!this.linkBaseTexture||e.parentTextureArray||Object.keys(e._glTextures).length>0)if(e.resource)this.addResourceAt(e.resource,t);else throw new Error("CubeResource does not support copying of renderTexture.");else e.target=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<al.SIDES;r++){const a=this.items[r];(n[r]<a.dirtyId||i.dirtyId<t.dirtyId)&&(a.valid&&a.resource?(a.resource.upload(e,a,i),n[r]=a.dirtyId):n[r]<-1&&(e.gl.texImage2D(a.target,0,i.internalFormat,t.realWidth,t.realHeight,0,t.format,i.type,null),n[r]=-1))}return!0}static test(e){return Array.isArray(e)&&e.length===al.SIDES}};Db.SIDES=6;let YA=Db;class lo extends fr{constructor(e,t){t=t||{};let i,n,r;typeof e=="string"?(i=lo.EMPTY,n=e,r=!0):(i=e,n=null,r=!1),super(i),this.url=n,this.crossOrigin=t.crossOrigin??!0,this.alphaMode=typeof t.alphaMode=="number"?t.alphaMode:null,this.ownsImageBitmap=t.ownsImageBitmap??r,this._load=null,t.autoLoad!==!1&&this.load()}load(){return this._load?this._load:(this._load=new Promise(async(e,t)=>{if(this.url===null){e(this);return}try{const 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===Xi.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 fr{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;fr.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_${ka()}`,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*\<svg/m,nm.SVG_SIZE=/<svg[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i;let rm=nm;class $A extends fr{constructor(e){super(e)}static test(e){return!!globalThis.VideoFrame&&e instanceof globalThis.VideoFrame}}const am=class om extends fr{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];fr.crossOrigin(i,n,t.crossorigin);for(let r=0;r<e.length;++r){const a=document.createElement("source");let{src:o,mime:h}=e[r];if(o=o||e[r],o.startsWith("data:"))h=o.slice(5,o.indexOf(";"));else if(!o.startsWith("blob:")){const l=o.split("?").shift().toLowerCase(),c=l.slice(l.lastIndexOf(".")+1);h=h||om.MIME_TYPES[c]||`video/${c}`}a.src=o,h&&(a.type=h),i.appendChild(a)}e=i}super(e),this.noSubImage=!0,this._autoUpdate=!0,this._isConnectedToTicker=!1,this._updateFPS=t.updateFPS||0,this._msToNextUpdate=0,this.autoPlay=t.autoPlay!==!1,this._videoFrameRequestCallback=this._videoFrameRequestCallback.bind(this),this._videoFrameRequestCallbackHandle=null,this._load=null,this._resolve=null,this._reject=null,this._onCanPlay=this._onCanPlay.bind(this),this._onError=this._onError.bind(this),this._onPlayStart=this._onPlayStart.bind(this),this._onPlayStop=this._onPlayStop.bind(this),this._onSeeked=this._onSeeked.bind(this),t.autoLoad!==!1&&this.load()}update(e=0){if(!this.destroyed){if(this._updateFPS){const t=ls.shared.elapsedMS*this.source.playbackRate;this._msToNextUpdate=Math.floor(this._msToNextUpdate-t)}(!this._updateFPS||this._msToNextUpdate<=0)&&(super.update(),this._msToNextUpdate=this._updateFPS?Math.floor(1e3/this._updateFPS):0)}}_videoFrameRequestCallback(){this.update(),this.destroyed?this._videoFrameRequestCallbackHandle=null:this._videoFrameRequestCallbackHandle=this.source.requestVideoFrameCallback(this._videoFrameRequestCallback)}load(){if(this._load)return this._load;const e=this.source;return(e.readyState===e.HAVE_ENOUGH_DATA||e.readyState===e.HAVE_FUTURE_DATA)&&e.width&&e.height&&(e.complete=!0),e.addEventListener("play",this._onPlayStart),e.addEventListener("pause",this._onPlayStop),e.addEventListener("seeked",this._onSeeked),this._isSourceReady()?this._onCanPlay():(e.addEventListener("canplay",this._onCanPlay),e.addEventListener("canplaythrough",this._onCanPlay),e.addEventListener("error",this._onError,!0)),this._load=new Promise((t,i)=>{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&&(ls.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||(ls.shared.add(this.update,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.source.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(ls.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 Nb=am;Wf.push(lo,hb,VA,Nb,$A,rm,yu,YA,XA);class Ll{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=a<t?a:t,i=o<i?o:i,n=a>n?a:n,r=o>r?o:r,a=e[2],o=e[3],t=a<t?a:t,i=o<i?o:i,n=a>n?a:n,r=o>r?o:r,a=e[4],o=e[5],t=a<t?a:t,i=o<i?o:i,n=a>n?a:n,r=o>r?o:r,a=e[6],o=e[7],t=a<t?a:t,i=o<i?o:i,n=a>n?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=g<d?g:d,f=v<f?v:f,p=g>p?g:p,m=v>m?v:m,g=a*n+h*i+c,v=o*n+l*i+u,d=g<d?g:d,f=v<f?v:f,p=g>p?g:p,m=v>m?v:m,g=a*t+h*r+c,v=o*t+l*r+u,d=g<d?g:d,f=v<f?v:f,p=g>p?g:p,m=v>m?v:m,g=a*n+h*r+c,v=o*n+l*r+u,d=g<d?g:d,f=v<f?v:f,p=g>p?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;h<i;h+=2){const l=e[h],c=e[h+1];n=l<n?l:n,r=c<r?c:r,a=l>a?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;v<n;v+=2){const b=t[v],y=t[v+1],w=o*b+l*y+u,A=c*y+h*b+d;f=Math.min(f,w-r),m=Math.max(m,w+r),p=Math.min(p,A-a),g=Math.max(g,A+a)}this.minX=f,this.minY=p,this.maxX=m,this.maxY=g}addBounds(e){const t=this.minX,i=this.minY,n=this.maxX,r=this.maxY;this.minX=e.minX<t?e.minX:t,this.minY=e.minY<i?e.minY:i,this.maxX=e.maxX>n?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.maxX<t.maxX?e.maxX:t.maxX,a=e.maxY<t.maxY?e.maxY:t.maxY;if(i<=r&&n<=a){const o=this.minX,h=this.minY,l=this.maxX,c=this.maxY;this.minX=i<o?i:o,this.minY=n<h?n:h,this.maxX=r>l?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.maxX<t.x+t.width?e.maxX:t.x+t.width,a=e.maxY<t.y+t.height?e.maxY:t.y+t.height;if(i<=r&&n<=a){const o=this.minX,h=this.minY,l=this.maxX,c=this.maxY;this.minX=i<o?i:o,this.minY=n<h?n:h,this.maxX=r>l?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.minX<e?this.minX:e,this.maxX=this.maxX>i?this.maxX:i,this.minY=this.minY<t?this.minY:t,this.maxY=this.maxY>n?this.maxY:n}}class vi extends jl{constructor(){super(),this.tempDisplayObjectParent=null,this.transform=new pp,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 Ll,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;i<t.length;++i){const n=t[i];Object.defineProperty(vi.prototype,n,Object.getOwnPropertyDescriptor(e,n))}}get destroyed(){return this._destroyed}_recursivePostUpdateTransform(){this.parent?(this.parent._recursivePostUpdateTransform(),this.transform.updateTransform(this.parent.transform)):this.transform.updateTransform(this._tempDisplayObjectParent.transform)}updateTransform(){this._boundsID++,this.transform.updateTransform(this.parent.transform),this.worldAlpha=this.alpha*this.parent.worldAlpha}getBounds(e,t){return e||(this.parent?(this._recursivePostUpdateTransform(),this.updateTransform()):(this.parent=this._tempDisplayObjectParent,this.updateTransform(),this.parent=null)),this._bounds.updateID!==this._boundsID&&(this.calculateBounds(),this._bounds.updateID=this._boundsID),t||(this._boundsRect||(this._boundsRect=new Tt),t=this._boundsRect),this._bounds.getRectangle(t)}getLocalBounds(e){e||(this._localBoundsRect||(this._localBoundsRect=new Tt),e=this._localBoundsRect),this._localBounds||(this._localBounds=new Ll);const t=this.transform,i=this.parent;this.parent=null,this._tempDisplayObjectParent.worldAlpha=(i==null?void 0:i.worldAlpha)??1,this.transform=this._tempDisplayObjectParent.transform;const n=this._bounds,r=this._boundsID;this._bounds=this._localBounds;const a=this.getBounds(!1,e);return this.parent=i,this.transform=t,this._bounds=n,this._bounds.updateID+=this._boundsID-r,a}toGlobal(e,t,i=!1){return i||(this._recursivePostUpdateTransform(),this.parent?this.displayObjectUpdateTransform():(this.parent=this._tempDisplayObjectParent,this.displayObjectUpdateTransform(),this.parent=null)),this.worldTransform.apply(e,t)}toLocal(e,t,i,n){return t&&(e=t.toGlobal(e,i,n)),n||(this._recursivePostUpdateTransform(),this.parent?this.displayObjectUpdateTransform():(this.parent=this._tempDisplayObjectParent,this.displayObjectUpdateTransform(),this.parent=null)),this.worldTransform.applyInverse(e,i)}setParent(e){if(!e||!e.addChild)throw new Error("setParent: Argument must be a Container");return e.addChild(this),e}removeFromParent(){var e;(e=this.parent)==null||e.removeChild(this)}setTransform(e=0,t=0,i=1,n=1,r=0,a=0,o=0,h=0,l=0){return this.position.x=e,this.position.y=t,this.scale.x=i||1,this.scale.y=n||1,this.rotation=r,this.skew.x=a,this.skew.y=o,this.pivot.x=h,this.pivot.y=l,this}destroy(e){this.removeFromParent(),this._destroyed=!0,this.transform=null,this.parent=null,this._bounds=null,this.mask=null,this.cullArea=null,this.filters=null,this.filterArea=null,this.hitArea=null,this.eventMode="auto",this.interactiveChildren=!1,this.emit("destroyed"),this.removeAllListeners()}get _tempDisplayObjectParent(){return this.tempDisplayObjectParent===null&&(this.tempDisplayObjectParent=new GA),this.tempDisplayObjectParent}enableTempParent(){const e=this.parent;return this.parent=this._tempDisplayObjectParent,e}disableTempParent(e){this.parent=e}get x(){return this.position.x}set x(e){this.transform.position.x=e}get y(){return this.position.y}set y(e){this.transform.position.y=e}get worldTransform(){return this.transform.worldTransform}get localTransform(){return this.transform.localTransform}get position(){return this.transform.position}set position(e){this.transform.position.copyFrom(e)}get scale(){return this.transform.scale}set scale(e){this.transform.scale.copyFrom(e)}get pivot(){return this.transform.pivot}set pivot(e){this.transform.pivot.copyFrom(e)}get skew(){return this.transform.skew}set skew(e){this.transform.skew.copyFrom(e)}get rotation(){return this.transform.rotation}set rotation(e){this.transform.rotation=e}get angle(){return this.transform.rotation*D2}set angle(e){this.transform.rotation=e*N2}get zIndex(){return this._zIndex}set zIndex(e){this._zIndex!==e&&(this._zIndex=e,this.parent&&(this.parent.sortDirty=!0))}get worldVisible(){let e=this;do{if(!e.visible)return!1;e=e.parent}while(e);return!0}get mask(){return this._mask}set mask(e){if(this._mask!==e){if(this._mask){const t=this._mask.isMaskData?this._mask.maskObject:this._mask;t&&(t._maskRefCount--,t._maskRefCount===0&&(t.renderable=!0,t.isMask=!1))}if(this._mask=e,this._mask){const t=this._mask.isMaskData?this._mask.maskObject:this._mask;t&&(t._maskRefCount===0&&(t.renderable=!1,t.isMask=!0),t._maskRefCount++)}}}}class GA extends vi{constructor(){super(...arguments),this.sortDirty=null}}vi.prototype.displayObjectUpdateTransform=vi.prototype.updateTransform;const HA=new li;function jA(s,e){return s.zIndex===e.zIndex?s._lastSortedIndex-e._lastSortedIndex:s.zIndex-e.zIndex}const Ub=class lm extends vi{constructor(){super(),this.children=[],this.sortableChildren=lm.defaultSortableChildren,this.sortDirty=!1}onChildrenChange(e){}addChild(...e){if(e.length>1)for(let t=0;t<e.length;t++)this.addChild(e[t]);else{const t=e[0];t.parent&&t.parent.removeChild(t),t.parent=this,this.sortDirty=!0,t.transform._parentID=-1,this.children.push(t),this._boundsID++,this.onChildrenChange(this.children.length-1),this.emit("childAdded",t,this,this.children.length-1),t.emit("added",this)}return e[0]}addChildAt(e,t){if(t<0||t>this.children.length)throw new Error(`${e}addChildAt: The index ${t} supplied is out of bounds ${this.children.length}`);return e.parent&&e.parent.removeChild(e),e.parent=this,this.sortDirty=!0,e.transform._parentID=-1,this.children.splice(t,0,e),this._boundsID++,this.onChildrenChange(t),e.emit("added",this),this.emit("childAdded",e,this,t),e}swapChildren(e,t){if(e===t)return;const i=this.getChildIndex(e),n=this.getChildIndex(t);this.children[i]=t,this.children[n]=e,this.onChildrenChange(i<n?i:n)}getChildIndex(e){const t=this.children.indexOf(e);if(t===-1)throw new Error("The supplied DisplayObject must be a child of the caller");return t}setChildIndex(e,t){if(t<0||t>=this.children.length)throw new Error(`The index ${t} supplied is out of bounds ${this.children.length}`);const 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;t<e.length;t++)this.removeChild(e[t]);else{const t=e[0],i=this.children.indexOf(t);if(i===-1)return null;t.parent=null,t.transform._parentID=-1,yo(this.children,i,1),this._boundsID++,this.onChildrenChange(i),t.emit("removed",this),this.emit("childRemoved",t,this,i)}return e[0]}removeChildAt(e){const t=this.getChildAt(e);return t.parent=null,t.transform._parentID=-1,yo(this.children,e,1),this._boundsID++,this.onChildrenChange(e),t.emit("removed",this),this.emit("childRemoved",t,this,e),t}removeChildren(e=0,t=this.children.length){const i=e,n=t,r=n-i;let a;if(r>0&&r<=n){a=this.children.splice(i,r);for(let o=0;o<a.length;++o)a[o].parent=null,a[o].transform&&(a[o].transform._parentID=-1);this._boundsID++,this.onChildrenChange(e);for(let o=0;o<a.length;++o)a[o].emit("removed",this),this.emit("childRemoved",a[o],this,o);return a}else if(r===0&&this.children.length===0)return[];throw new RangeError("removeChildren: numeric values are outside the acceptable range.")}sortChildren(){let e=!1;for(let t=0,i=this.children.length;t<i;++t){const n=this.children[t];n._lastSortedIndex=t,!e&&n.zIndex!==0&&(e=!0)}e&&this.children.length>1&&this.children.sort(jA),this.sortDirty=!1}updateTransform(){this.sortableChildren&&this.sortDirty&&this.sortChildren(),this._boundsID++,this.transform.updateTransform(this.parent.transform),this.worldAlpha=this.alpha*this.parent.worldAlpha;for(let e=0,t=this.children.length;e<t;++e){const i=this.children[e];i.visible&&i.updateTransform()}}calculateBounds(){this._bounds.clear(),this._calculateBounds();for(let e=0;e<this.children.length;e++){const t=this.children[e];if(!(!t.visible||!t.renderable))if(t.calculateBounds(),t._mask){const i=t._mask.isMaskData?t._mask.maskObject:t._mask;i?(i.calculateBounds(),this._bounds.addBoundsMask(t._bounds,i._bounds)):this._bounds.addBounds(t._bounds)}else t.filterArea?this._bounds.addBoundsArea(t._bounds,t.filterArea):this._bounds.addBounds(t._bounds)}this._bounds.updateID=this._boundsID}getLocalBounds(e,t=!1){const i=super.getLocalBounds(e);if(!t)for(let n=0,r=this.children.length;n<r;++n){const a=this.children[n];a.visible&&a.updateTransform()}return i}_calculateBounds(){}_renderWithCulling(e){const t=e.renderTexture.sourceFrame;if(!(t.width>0&&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=HA.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<o;++a){const h=this.children[a],l=h.cullable;h.cullable=l||!this.cullArea,h.render(e),h.cullable=l}}render(e){var t;if(!(!this.visible||this.worldAlpha<=0||!this.renderable))if(this._mask||(t=this.filters)!=null&&t.length)this.renderAdvanced(e);else if(this.cullable)this._renderWithCulling(e);else{this._render(e);for(let i=0,n=this.children.length;i<n;++i)this.children[i].render(e)}}renderAdvanced(e){var r,a,o;const t=this.filters,i=this._mask;if(t){this._enabledFilters||(this._enabledFilters=[]),this._enabledFilters.length=0;for(let h=0;h<t.length;h++)t[h].enabled&&this._enabledFilters.push(t[h])}const n=t&&((r=this._enabledFilters)==null?void 0:r.length)||i&&(!i.isMaskData||i.enabled&&(i.autoDetect||i.type!==Ri.NONE));if(n&&e.batch.flush(),t&&((a=this._enabledFilters)!=null&&a.length)&&e.filter.push(this,this._enabledFilters),i&&e.mask.push(this,this._mask),this.cullable)this._renderWithCulling(e);else{this._render(e);for(let h=0,l=this.children.length;h<l;++h)this.children[h].render(e)}n&&e.batch.flush(),i&&e.mask.pop(this),t&&((o=this._enabledFilters)!=null&&o.length)&&e.filter.pop()}_render(e){}destroy(e){super.destroy(),this.sortDirty=!1;const t=typeof e=="boolean"?e:e==null?void 0:e.children,i=this.removeChildren(0,this.children.length);if(t)for(let n=0;n<i.length;++n)i[n].destroy(e)}get width(){return this.scale.x*this.getLocalBounds().width}set width(e){const t=this.getLocalBounds().width;t!==0?this.scale.x=e/t:this.scale.x=1,this._width=e}get height(){return this.scale.y*this.getLocalBounds().height}set height(e){const t=this.getLocalBounds().height;t!==0?this.scale.y=e/t:this.scale.y=1,this._height=e}};Ub.defaultSortableChildren=!1;let ji=Ub;ji.prototype.containerUpdateTransform=ji.prototype.updateTransform;Object.defineProperties(We,{SORTABLE_CHILDREN:{get(){return ji.defaultSortableChildren},set(s){kt("7.1.0","settings.SORTABLE_CHILDREN is deprecated, use Container.defaultSortableChildren"),ji.defaultSortableChildren=s}}});const Ko=new Xt,WA=new Uint16Array([0,1,2,0,2,3]);class Wr extends ji{constructor(e){super(),this._anchor=new er(this._onAnchorUpdate,this,e?e.defaultAnchor.x:0,e?e.defaultAnchor.y:0),this._texture=null,this._width=0,this._height=0,this._tintColor=new Wt(16777215),this._tintRGB=null,this.tint=16777215,this.blendMode=ut.NORMAL,this._cachedTint=16777215,this.uvs=null,this.texture=e||mt.EMPTY,this.vertexData=new Float32Array(8),this.vertexTrimmedData=null,this._transformID=-1,this._textureID=-1,this._transformTrimmedID=-1,this._textureTrimmedID=-1,this.indices=WA,this.pluginName="batch",this.isSprite=!0,this._roundPixels=We.ROUND_PIXELS}_onTextureUpdate(){this._textureID=-1,this._textureTrimmedID=-1,this._cachedTint=16777215,this._width&&(this.scale.x=Br(this.scale.x)*this._width/this._texture.orig.width),this._height&&(this.scale.y=Br(this.scale.y)*this._height/this._texture.orig.height)}_onAnchorUpdate(){this._transformID=-1,this._transformTrimmedID=-1}calculateVertices(){const e=this._texture;if(this._transformID===this.transform._worldID&&this._textureID===e._updateID)return;this._textureID!==e._updateID&&(this.uvs=this._texture._uvs.uvsFloat32),this._transformID=this.transform._worldID,this._textureID=e._updateID;const t=this.transform.worldTransform,i=t.a,n=t.b,r=t.c,a=t.d,o=t.tx,h=t.ty,l=this.vertexData,c=e.trim,u=e.orig,d=this._anchor;let f=0,p=0,m=0,g=0;if(c?(p=c.x-d._x*u.width,f=p+c.width,g=c.y-d._y*u.height,m=g+c.height):(p=-d._x*u.width,f=p+u.width,g=-d._y*u.height,m=g+u.height),l[0]=i*p+r*g+o,l[1]=a*g+n*p+h,l[2]=i*f+r*g+o,l[3]=a*g+n*f+h,l[4]=i*f+r*m+o,l[5]=a*m+n*f+h,l[6]=i*p+r*m+o,l[7]=a*m+n*p+h,this._roundPixels){const v=We.RESOLUTION;for(let b=0;b<l.length;++b)l[b]=Math.round(l[b]*v)/v}}calculateTrimmedVertices(){if(!this.vertexTrimmedData)this.vertexTrimmedData=new Float32Array(8);else if(this._transformTrimmedID===this.transform._worldID&&this._textureTrimmedID===this._texture._updateID)return;this._transformTrimmedID=this.transform._worldID,this._textureTrimmedID=this._texture._updateID;const e=this._texture,t=this.vertexTrimmedData,i=e.orig,n=this._anchor,r=this.transform.worldTransform,a=r.a,o=r.b,h=r.c,l=r.d,c=r.tx,u=r.ty,d=-n._x*i.width,f=d+i.width,p=-n._y*i.height,m=p+i.height;if(t[0]=a*d+h*p+c,t[1]=l*p+o*d+u,t[2]=a*f+h*p+c,t[3]=l*p+o*f+u,t[4]=a*f+h*m+c,t[5]=l*m+o*f+u,t[6]=a*d+h*m+c,t[7]=l*m+o*d+u,this._roundPixels){const g=We.RESOLUTION;for(let v=0;v<t.length;++v)t[v]=Math.round(t[v]*g)/g}}_render(e){this.calculateVertices(),e.batch.setObjectRenderer(e.plugins[this.pluginName]),e.plugins[this.pluginName].render(this)}_calculateBounds(){const e=this._texture.trim,t=this._texture.orig;!e||e.width===t.width&&e.height===t.height?(this.calculateVertices(),this._bounds.addQuad(this.vertexData)):(this.calculateTrimmedVertices(),this._bounds.addQuad(this.vertexTrimmedData))}getLocalBounds(e){return this.children.length===0?(this._localBounds||(this._localBounds=new Ll),this._localBounds.minX=this._texture.orig.width*-this._anchor._x,this._localBounds.minY=this._texture.orig.height*-this._anchor._y,this._localBounds.maxX=this._texture.orig.width*(1-this._anchor._x),this._localBounds.maxY=this._texture.orig.height*(1-this._anchor._y),e||(this._localBoundsRect||(this._localBoundsRect=new Tt),e=this._localBoundsRect),this._localBounds.getRectangle(e)):super.getLocalBounds.call(this,e)}containsPoint(e){this.worldTransform.applyInverse(e,Ko);const t=this._texture.orig.width,i=this._texture.orig.height,n=-t*this.anchor.x;let r=0;return Ko.x>=n&&Ko.x<n+t&&(r=-i*this.anchor.y,Ko.y>=r&&Ko.y<r+i)}destroy(e){if(super.destroy(e),this._texture.off("update",this._onTextureUpdate,this),this._anchor=null,typeof e=="boolean"?e:e==null?void 0:e.texture){const t=typeof e=="boolean"?e:e==null?void 0:e.baseTexture;this._texture.destroy(!!t)}this._texture=null}static from(e,t){const i=e instanceof mt?e:mt.from(e,t);return new Wr(i)}set roundPixels(e){this._roundPixels!==e&&(this._transformID=-1,this._transformTrimmedID=-1),this._roundPixels=e}get roundPixels(){return this._roundPixels}get width(){return Math.abs(this.scale.x)*this._texture.orig.width}set width(e){const t=Br(this.scale.x)||1;this.scale.x=t*e/this._texture.orig.width,this._width=e}get height(){return Math.abs(this.scale.y)*this._texture.orig.height}set height(e){const t=Br(this.scale.y)||1;this.scale.y=t*e/this._texture.orig.height,this._height=e}get anchor(){return this._anchor}set anchor(e){this._anchor.copyFrom(e)}get tint(){return this._tintColor.value}set tint(e){this._tintColor.setValue(e),this._tintRGB=this._tintColor.toLittleEndianNumber()}get tintValue(){return this._tintColor.toNumber()}get texture(){return this._texture}set texture(e){this._texture!==e&&(this._texture&&this._texture.off("update",this._onTextureUpdate,this),this._texture=e||mt.EMPTY,this._cachedTint=16777215,this._textureID=-1,this._textureTrimmedID=-1,e&&(e.baseTexture.valid?this._onTextureUpdate():e.once("update",this._onTextureUpdate,this)))}}const Xb=new li;vi.prototype._cacheAsBitmap=!1;vi.prototype._cacheData=null;vi.prototype._cacheAsBitmapResolution=null;vi.prototype._cacheAsBitmapMultisample=null;class zA{constructor(){this.textureCacheId=null,this.originalRender=null,this.originalRenderCanvas=null,this.originalCalculateBounds=null,this.originalGetLocalBounds=null,this.originalUpdateTransform=null,this.originalDestroy=null,this.originalMask=null,this.originalFilterArea=null,this.originalContainsPoint=null,this.sprite=null}}Object.defineProperties(vi.prototype,{cacheAsBitmapResolution:{get(){return this._cacheAsBitmapResolution},set(s){s!==this._cacheAsBitmapResolution&&(this._cacheAsBitmapResolution=s,this.cacheAsBitmap&&(this.cacheAsBitmap=!1,this.cacheAsBitmap=!0))}},cacheAsBitmapMultisample:{get(){return this._cacheAsBitmapMultisample},set(s){s!==this._cacheAsBitmapMultisample&&(this._cacheAsBitmapMultisample=s,this.cacheAsBitmap&&(this.cacheAsBitmap=!1,this.cacheAsBitmap=!0))}},cacheAsBitmap:{get(){return this._cacheAsBitmap},set(s){if(this._cacheAsBitmap===s)return;this._cacheAsBitmap=s;let e;s?(this._cacheData||(this._cacheData=new zA),e=this._cacheData,e.originalRender=this.render,e.originalRenderCanvas=this.renderCanvas,e.originalUpdateTransform=this.updateTransform,e.originalCalculateBounds=this.calculateBounds,e.originalGetLocalBounds=this.getLocalBounds,e.originalDestroy=this.destroy,e.originalContainsPoint=this.containsPoint,e.originalMask=this._mask,e.originalFilterArea=this.filterArea,this.render=this._renderCached,this.renderCanvas=this._renderCachedCanvas,this.destroy=this._cacheAsBitmapDestroy):(e=this._cacheData,e.sprite&&this._destroyCachedDisplayObject(),this.render=e.originalRender,this.renderCanvas=e.originalRenderCanvas,this.calculateBounds=e.originalCalculateBounds,this.getLocalBounds=e.originalGetLocalBounds,this.destroy=e.originalDestroy,this.updateTransform=e.originalUpdateTransform,this.containsPoint=e.originalContainsPoint,this._mask=e.originalMask,this.filterArea=e.originalFilterArea)}}});vi.prototype._renderCached=function(s){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObject(s),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._render(s))};vi.prototype._initCachedDisplayObject=function(s){var d,f;if((d=this._cacheData)!=null&&d.sprite)return;const e=this.alpha;this.alpha=1,s.batch.flush();const t=this.getLocalBounds(new Tt,!0);if((f=this.filters)!=null&&f.length){const p=this.filters[0].padding;t.pad(p)}const i=this.cacheAsBitmapResolution||s.resolution;t.ceil(i),t.width=Math.max(t.width,1/i),t.height=Math.max(t.height,1/i);const n=s.renderTexture.current,r=s.renderTexture.sourceFrame.clone(),a=s.renderTexture.destinationFrame.clone(),o=s.projection.transform,h=Ua.create({width:t.width,height:t.height,resolution:i,multisample:this.cacheAsBitmapMultisample??s.multisample}),l=`cacheAsBitmap_${ka()}`;this._cacheData.textureCacheId=l,gt.addToCache(h.baseTexture,l),mt.addToCache(h,l);const c=this.transform.localTransform.copyTo(Xb).invert().translate(-t.x,-t.y);this.render=this._cacheData.originalRender,s.render(this,{renderTexture:h,clear:!0,transform:c,skipUpdateTransform:!1}),s.framebuffer.blit(),s.projection.transform=o,s.renderTexture.bind(n,r,a),this.render=this._renderCached,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null,this.alpha=e;const u=new Wr(h);u.transform.worldTransform=this.transform.worldTransform,u.anchor.x=-(t.x/t.width),u.anchor.y=-(t.y/t.height),u.alpha=e,u._bounds=this._bounds,this._cacheData.sprite=u,this.transform._parentID=-1,this.parent?this.updateTransform():(this.enableTempParent(),this.updateTransform(),this.disableTempParent(null)),this.containsPoint=u.containsPoint.bind(u)};vi.prototype._renderCachedCanvas=function(s){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObjectCanvas(s),this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._renderCanvas(s))};vi.prototype._initCachedDisplayObjectCanvas=function(s){var c;if((c=this._cacheData)!=null&&c.sprite)return;const e=this.getLocalBounds(new Tt,!0),t=this.alpha;this.alpha=1;const i=s.canvasContext.activeContext,n=s._projTransform,r=this.cacheAsBitmapResolution||s.resolution;e.ceil(r),e.width=Math.max(e.width,1/r),e.height=Math.max(e.height,1/r);const a=Ua.create({width:e.width,height:e.height,resolution:r}),o=`cacheAsBitmap_${ka()}`;this._cacheData.textureCacheId=o,gt.addToCache(a.baseTexture,o),mt.addToCache(a,o);const h=Xb;this.transform.localTransform.copyTo(h),h.invert(),h.tx-=e.x,h.ty-=e.y,this.renderCanvas=this._cacheData.originalRenderCanvas,s.render(this,{renderTexture:a,clear:!0,transform:h,skipUpdateTransform:!1}),s.canvasContext.activeContext=i,s._projTransform=n,this.renderCanvas=this._renderCachedCanvas,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null,this.alpha=t;const l=new Wr(a);l.transform.worldTransform=this.transform.worldTransform,l.anchor.x=-(e.x/e.width),l.anchor.y=-(e.y/e.height),l.alpha=t,l._bounds=this._bounds,this._cacheData.sprite=l,this.transform._parentID=-1,this.parent?this.updateTransform():(this.parent=s._tempDisplayObjectParent,this.updateTransform(),this.parent=null),this.containsPoint=l.containsPoint.bind(l)};vi.prototype._calculateCachedBounds=function(){this._bounds.clear(),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite._calculateBounds(),this._bounds.updateID=this._boundsID};vi.prototype._getCachedLocalBounds=function(){return this._cacheData.sprite.getLocalBounds(null)};vi.prototype._destroyCachedDisplayObject=function(){this._cacheData.sprite._texture.destroy(!0),this._cacheData.sprite=null,gt.removeFromCache(this._cacheData.textureCacheId),mt.removeFromCache(this._cacheData.textureCacheId),this._cacheData.textureCacheId=null};vi.prototype._cacheAsBitmapDestroy=function(s){this.cacheAsBitmap=!1,this.destroy(s)};vi.prototype.name=null;ji.prototype.getChildByName=function(s,e){for(let t=0,i=this.children.length;t<i;t++)if(this.children[t].name===s)return this.children[t];if(e)for(let t=0,i=this.children.length;t<i;t++){const n=this.children[t];if(!n.getChildByName)continue;const r=n.getChildByName(s,!0);if(r)return r}return null};vi.prototype.getGlobalPosition=function(s=new Xt,e=!1){return this.parent?this.parent.toGlobal(this.position,s,e):(s.x=this.position.x,s.y=this.position.y),s};var qA=`varying vec2 vTextureCoord;
|
||
|
||
uniform sampler2D uSampler;
|
||
uniform float uAlpha;
|
||
|
||
void main(void)
|
||
{
|
||
gl_FragColor = texture2D(uSampler, vTextureCoord) * uAlpha;
|
||
}
|
||
`;class KA extends os{constructor(e=1){super(NA,qA,{uAlpha:1}),this.alpha=e}get alpha(){return this.uniforms.uAlpha}set alpha(e){this.uniforms.uAlpha=e}}const ZA={5:[.153388,.221461,.250301],7:[.071303,.131514,.189879,.214607],9:[.028532,.067234,.124009,.179044,.20236],11:[.0093,.028002,.065984,.121703,.175713,.198596],13:[.002406,.009255,.027867,.065666,.121117,.174868,.197641],15:[489e-6,.002403,.009246,.02784,.065602,.120999,.174697,.197448]},JA=["varying vec2 vBlurTexCoords[%size%];","uniform sampler2D uSampler;","void main(void)","{"," gl_FragColor = vec4(0.0);"," %blur%","}"].join(`
|
||
`);function QA(s){const e=ZA[s],t=e.length;let i=JA,n="";const r="gl_FragColor += texture2D(uSampler, vBlurTexCoords[%index%]) * %value%;";let a;for(let o=0;o<s;o++){let h=r.replace("%index%",o.toString());a=o,o>=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 eE=`
|
||
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 tE(s,e){const t=Math.ceil(s/2);let i=eE,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<s;a++){let o=r.replace("%index%",a.toString());o=o.replace("%sampleIndex%",`${a-(t-1)}.0`),n+=o,n+=`
|
||
`}return i=i.replace("%blur%",n),i=i.replace("%size%",s.toString()),i}class cm extends os{constructor(e,t=8,i=4,n=os.defaultResolution,r=5){const a=tE(r,e),o=QA(r);super(a,o),this.horizontal=e,this.resolution=n,this._quality=0,this.quality=i,this.blur=t}apply(e,t,i,n){if(i?this.horizontal?this.uniforms.strength=1/i.width*(i.width/t.width):this.uniforms.strength=1/i.height*(i.height/t.height):this.horizontal?this.uniforms.strength=1/e.renderer.width*(e.renderer.width/t.width):this.uniforms.strength=1/e.renderer.height*(e.renderer.height/t.height),this.uniforms.strength*=this.strength,this.uniforms.strength/=this.passes,this.passes===1)e.applyFilter(this,t,i,n);else{const r=e.getFilterTexture(),a=e.renderer;let o=t,h=r;this.state.blend=!1,e.applyFilter(this,o,h,Tn.CLEAR);for(let l=1;l<this.passes-1;l++){e.bindAndClear(o,Tn.BLIT),this.uniforms.uSampler=h;const c=h;h=o,o=c,a.shader.bind(this),a.geometry.draw(5)}this.state.blend=!0,e.applyFilter(this,h,i,n),e.returnFilterTexture(r)}}get blur(){return this.strength}set blur(e){this.padding=1+Math.abs(e)*2,this.strength=e}get quality(){return this._quality}set quality(e){this._quality=e,this.passes=e}}class iE extends os{constructor(e=8,t=4,i=os.defaultResolution,n=5){super(),this._repeatEdgePixels=!1,this.blurXFilter=new cm(!0,e,t,i,n),this.blurYFilter=new cm(!1,e,t,i,n),this.resolution=i,this.quality=t,this.blur=e,this.repeatEdgePixels=!1}apply(e,t,i,n){const r=Math.abs(this.blurXFilter.strength),a=Math.abs(this.blurYFilter.strength);if(r&&a){const o=e.getFilterTexture();this.blurXFilter.apply(e,t,o,Tn.CLEAR),this.blurYFilter.apply(e,o,i,n),e.returnFilterTexture(o)}else a?this.blurYFilter.apply(e,t,i,n):this.blurXFilter.apply(e,t,i,n)}updatePadding(){this._repeatEdgePixels?this.padding=0:this.padding=Math.max(Math.abs(this.blurXFilter.strength),Math.abs(this.blurYFilter.strength))*2}get blur(){return this.blurXFilter.blur}set blur(e){this.blurXFilter.blur=this.blurYFilter.blur=e,this.updatePadding()}get quality(){return this.blurXFilter.quality}set quality(e){this.blurXFilter.quality=this.blurYFilter.quality=e}get blurX(){return this.blurXFilter.blur}set blurX(e){this.blurXFilter.blur=e,this.updatePadding()}get blurY(){return this.blurYFilter.blur}set blurY(e){this.blurYFilter.blur=e,this.updatePadding()}get blendMode(){return this.blurYFilter.blendMode}set blendMode(e){this.blurYFilter.blendMode=e}get repeatEdgePixels(){return this._repeatEdgePixels}set repeatEdgePixels(e){this._repeatEdgePixels=e,this.updatePadding()}}var sE=`varying vec2 vTextureCoord;
|
||
uniform sampler2D uSampler;
|
||
uniform float m[20];
|
||
uniform float uAlpha;
|
||
|
||
void main(void)
|
||
{
|
||
vec4 c = texture2D(uSampler, vTextureCoord);
|
||
|
||
if (uAlpha == 0.0) {
|
||
gl_FragColor = c;
|
||
return;
|
||
}
|
||
|
||
// Un-premultiply alpha before applying the color matrix. See issue #3539.
|
||
if (c.a > 0.0) {
|
||
c.rgb /= c.a;
|
||
}
|
||
|
||
vec4 result;
|
||
|
||
result.r = (m[0] * c.r);
|
||
result.r += (m[1] * c.g);
|
||
result.r += (m[2] * c.b);
|
||
result.r += (m[3] * c.a);
|
||
result.r += m[4];
|
||
|
||
result.g = (m[5] * c.r);
|
||
result.g += (m[6] * c.g);
|
||
result.g += (m[7] * c.b);
|
||
result.g += (m[8] * c.a);
|
||
result.g += m[9];
|
||
|
||
result.b = (m[10] * c.r);
|
||
result.b += (m[11] * c.g);
|
||
result.b += (m[12] * c.b);
|
||
result.b += (m[13] * c.a);
|
||
result.b += m[14];
|
||
|
||
result.a = (m[15] * c.r);
|
||
result.a += (m[16] * c.g);
|
||
result.a += (m[17] * c.b);
|
||
result.a += (m[18] * c.a);
|
||
result.a += m[19];
|
||
|
||
vec3 rgb = mix(c.rgb, result.rgb, uAlpha);
|
||
|
||
// Premultiply alpha again.
|
||
rgb *= result.a;
|
||
|
||
gl_FragColor = vec4(rgb, result.a);
|
||
}
|
||
`;class hm extends os{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(kb,sE,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]=Wt.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=Wt.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 nE=`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));
|
||
}
|
||
`,rE=`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 aE extends os{constructor(e,t){const i=new li;e.renderable=!1,super(rE,nE,{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 Xt(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 oE=`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;
|
||
}
|
||
`,lE=`
|
||
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 cE extends os{constructor(){super(lE,oE)}}var hE=`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 uE extends os{constructor(e=.5,t=Math.random()){super(kb,hE,{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 ov={AlphaFilter:KA,BlurFilter:iE,BlurFilterPass:cm,ColorMatrixFilter:hm,DisplacementFilter:aE,FXAAFilter:cE,NoiseFilter:uE};Object.entries(ov).forEach(([s,e])=>{Object.defineProperty(ov,s,{get(){return kt("7.1.0",`filters.${s} has moved to ${s}`),e}})});class dE{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||(ls.system.add(this.tickerUpdate,this,Fa.INTERACTION),this.tickerAdded=!0)}removeTickerListener(){this.tickerAdded&&(ls.system.remove(this.tickerUpdate,this),this.tickerAdded=!1)}pointerMoved(){this._didMove=!0}update(){if(!this.domElement||this._pauseUpdate)return;if(this._didMove){this._didMove=!1;return}const e=this.events.rootPointerEvent;this.events.supportsTouchEvents&&e.pointerType==="touch"||globalThis.document.dispatchEvent(new PointerEvent("pointermove",{clientX:e.clientX,clientY:e.clientY}))}tickerUpdate(e){this._deltaTime+=e,!(this._deltaTime<this.interactionFrequency)&&(this._deltaTime=0,this.update())}}const Pr=new dE;class Wl{constructor(e){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=Wl.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new Xt,this.page=new Xt,this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,this.manager=e}get layerX(){return this.layer.x}get layerY(){return this.layer.y}get pageX(){return this.page.x}get pageY(){return this.page.y}get data(){return this}composedPath(){return this.manager&&(!this.path||this.path[this.path.length-1]!==this.target)&&(this.path=this.target?this.manager.propagationPath(this.target):[]),this.path}initEvent(e,t,i){throw new Error("initEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}initUIEvent(e,t,i,n,r){throw new Error("initUIEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}preventDefault(){this.nativeEvent instanceof Event&&this.nativeEvent.cancelable&&this.nativeEvent.preventDefault(),this.defaultPrevented=!0}stopImmediatePropagation(){this.propagationImmediatelyStopped=!0}stopPropagation(){this.propagationStopped=!0}}class Sh extends Wl{constructor(){super(...arguments),this.client=new Xt,this.movement=new Xt,this.offset=new Xt,this.global=new Xt,this.screen=new Xt}get clientX(){return this.client.x}get clientY(){return this.client.y}get x(){return this.clientX}get y(){return this.clientY}get movementX(){return this.movement.x}get movementY(){return this.movement.y}get offsetX(){return this.offset.x}get offsetY(){return this.offset.y}get globalX(){return this.global.x}get globalY(){return this.global.y}get screenX(){return this.screen.x}get screenY(){return this.screen.y}getLocalPosition(e,t,i){return e.worldTransform.applyInverse(i||this.global,t)}getModifierState(e){return"getModifierState"in this.nativeEvent&&this.nativeEvent.getModifierState(e)}initMouseEvent(e,t,i,n,r,a,o,h,l,c,u,d,f,p,m){throw new Error("Method not implemented.")}}class Gs extends Sh{constructor(){super(...arguments),this.width=0,this.height=0,this.isPrimary=!1}getCoalescedEvents(){return this.type==="pointermove"||this.type==="mousemove"||this.type==="touchmove"?[this]:[]}getPredictedEvents(){throw new Error("getPredictedEvents is not supported!")}}class bo extends Sh{constructor(){super(...arguments),this.DOM_DELTA_PIXEL=0,this.DOM_DELTA_LINE=1,this.DOM_DELTA_PAGE=2}}bo.DOM_DELTA_PIXEL=0,bo.DOM_DELTA_LINE=1,bo.DOM_DELTA_PAGE=2;const fE=2048,mE=new Xt,nf=new Xt;class pE{constructor(e){this.dispatch=new jl,this.moveOnAll=!1,this.enableGlobalMoveEvents=!0,this.mappingState={trackingData:{}},this.eventPool=new Map,this._allInteractiveElements=[],this._hitElements=[],this._isPointerMoveEvent=!1,this.rootTarget=e,this.hitPruneFn=this.hitPruneFn.bind(this),this.hitTestFn=this.hitTestFn.bind(this),this.mapPointerDown=this.mapPointerDown.bind(this),this.mapPointerMove=this.mapPointerMove.bind(this),this.mapPointerOut=this.mapPointerOut.bind(this),this.mapPointerOver=this.mapPointerOver.bind(this),this.mapPointerUp=this.mapPointerUp.bind(this),this.mapPointerUpOutside=this.mapPointerUpOutside.bind(this),this.mapWheel=this.mapWheel.bind(this),this.mappingTable={},this.addEventMapping("pointerdown",this.mapPointerDown),this.addEventMapping("pointermove",this.mapPointerMove),this.addEventMapping("pointerout",this.mapPointerOut),this.addEventMapping("pointerleave",this.mapPointerOut),this.addEventMapping("pointerover",this.mapPointerOver),this.addEventMapping("pointerup",this.mapPointerUp),this.addEventMapping("pointerupoutside",this.mapPointerUpOutside),this.addEventMapping("wheel",this.mapWheel)}addEventMapping(e,t){this.mappingTable[e]||(this.mappingTable[e]=[]),this.mappingTable[e].push({fn:t,priority:0}),this.mappingTable[e].sort((i,n)=>i.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<n;i++)t[i].fn(e);else console.warn(`[EventBoundary]: Event mapping not defined for ${e.type}`)}hitTest(e,t){Pr.pauseUpdate=!0;const i=this._isPointerMoveEvent&&this.enableGlobalMoveEvents?"hitTestMoveRecursive":"hitTestRecursive",n=this[i](this.rootTarget,this.rootTarget.eventMode,mE.set(e,t),this.hitTestFn,this.hitPruneFn);return n&&n[0]}propagate(e,t){if(!e.target)return;const i=e.composedPath();e.eventPhase=e.CAPTURING_PHASE;for(let n=0,r=i.length-1;n<r;n++)if(e.currentTarget=i[n],this.notifyTarget(e,t),e.propagationStopped||e.propagationImmediatelyStopped)return;if(e.eventPhase=e.AT_TARGET,e.currentTarget=e.target,this.notifyTarget(e,t),!(e.propagationStopped||e.propagationImmediatelyStopped)){e.eventPhase=e.BUBBLING_PHASE;for(let n=i.length-2;n>=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<fE&&e!==this.rootTarget;i++){if(!e.parent)throw new Error("Cannot find propagation path to disconnected target");t.push(e.parent),e=e.parent}return t.reverse(),t}hitTestMoveRecursive(e,t,i,n,r,a=!1){let o=!1;if(this._interactivePrune(e))return null;if((e.eventMode==="dynamic"||t==="dynamic")&&(Pr.pauseUpdate=!1),e.interactiveChildren&&e.children){const c=e.children;for(let u=c.length-1;u>=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")&&(Pr.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 Gs)){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 Gs)){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 Gs)){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 Gs)){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 Gs)){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 Gs)){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<e.length&&e[i].parent===t;i++)t=e[i];return t}createPointerEvent(e,t,i){const n=this.allocateEvent(Gs);return this.copyPointerData(e,n),this.copyMouseData(e,n),this.copyData(e,n),n.nativeEvent=e.nativeEvent,n.originalEvent=e,n.target=i??this.hitTest(n.global.x,n.global.y)??this._hitElements[0],typeof t=="string"&&(n.type=t),n}createWheelEvent(e){const t=this.allocateEvent(bo);return this.copyWheelData(e,t),this.copyMouseData(e,t),this.copyData(e,t),t.nativeEvent=e.nativeEvent,t.originalEvent=e,t.target=this.hitTest(t.global.x,t.global.y),t}clonePointerEvent(e,t){const i=this.allocateEvent(Gs);return i.nativeEvent=e.nativeEvent,i.originalEvent=e.originalEvent,this.copyPointerData(e,i),this.copyMouseData(e,i),this.copyData(e,i),i.target=e.target,i.path=e.composedPath().slice(),i.type=t??i.type,i}copyWheelData(e,t){t.deltaMode=e.deltaMode,t.deltaX=e.deltaX,t.deltaY=e.deltaY,t.deltaZ=e.deltaZ}copyPointerData(e,t){e instanceof Gs&&t instanceof Gs&&(t.pointerId=e.pointerId,t.width=e.width,t.height=e.height,t.isPrimary=e.isPrimary,t.pointerType=e.pointerType,t.pressure=e.pressure,t.tangentialPressure=e.tangentialPressure,t.tiltX=e.tiltX,t.tiltY=e.tiltY,t.twist=e.twist)}copyMouseData(e,t){e instanceof Sh&&t instanceof Sh&&(t.altKey=e.altKey,t.button=e.button,t.buttons=e.buttons,t.client.copyFrom(e.client),t.ctrlKey=e.ctrlKey,t.metaKey=e.metaKey,t.movement.copyFrom(e.movement),t.screen.copyFrom(e.screen),t.shiftKey=e.shiftKey,t.global.copyFrom(e.global))}copyData(e,t){t.isTrusted=e.isTrusted,t.srcElement=e.srcElement,t.timeStamp=performance.now(),t.type=e.type,t.detail=e.detail,t.view=e.view,t.which=e.which,t.layer.copyFrom(e.layer),t.page.copyFrom(e.page)}trackingData(e){return this.mappingState.trackingData[e]||(this.mappingState.trackingData[e]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[e]}allocateEvent(e){this.eventPool.has(e)||this.eventPool.set(e,[]);const t=this.eventPool.get(e).pop()||new e(this);return t.eventPhase=t.NONE,t.currentTarget=null,t.path=null,t.target=null,t}freeEvent(e){if(e.manager!==this)throw new Error("It is illegal to free an event not managed by this EventBoundary!");const t=e.constructor;this.eventPool.has(t)||this.eventPool.set(t,[]),this.eventPool.get(t).push(e)}notifyListeners(e,t){const i=e.currentTarget._events[t];if(i&&e.currentTarget.isInteractive())if("fn"in i)i.once&&e.currentTarget.removeListener(t,i.fn,void 0,!0),i.fn.call(i.context,e);else for(let n=0,r=i.length;n<r&&!e.propagationImmediatelyStopped;n++)i[n].once&&e.currentTarget.removeListener(t,i[n].fn,void 0,!0),i[n].fn.call(i[n].context,e)}}const gE=1,vE={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},um=class dm{constructor(e){this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.domElement=null,this.resolution=1,this.renderer=e,this.rootBoundary=new pE(null),Pr.init(this),this.autoPreventDefault=!0,this.eventsAdded=!1,this.rootPointerEvent=new Gs(null),this.rootWheelEvent=new bo(null),this.cursorStyles={default:"inherit",pointer:"pointer"},this.features=new Proxy({...dm.defaultEventFeatures},{set:(t,i,n)=>(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;i<n;i++){const r=t[i],a=this.bootstrapEvent(this.rootPointerEvent,r);this.rootBoundary.mapEvent(a)}this.setCursor(this.rootBoundary.cursor)}onPointerMove(e){if(!this.features.move)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,Pr.pointerMoved();const t=this.normalizeToPointerData(e);for(let i=0,n=t.length;i<n;i++){const r=this.bootstrapEvent(this.rootPointerEvent,t[i]);this.rootBoundary.mapEvent(r)}this.setCursor(this.rootBoundary.cursor)}onPointerUp(e){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let t=e.target;e.composedPath&&e.composedPath().length>0&&(t=e.composedPath()[0]);const i=t!==this.domElement?"outside":"",n=this.normalizeToPointerData(e);for(let r=0,a=n.length;r<a;r++){const o=this.bootstrapEvent(this.rootPointerEvent,n[r]);o.type+=i,this.rootBoundary.mapEvent(o)}this.setCursor(this.rootBoundary.cursor)}onPointerOverOut(e){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;const t=this.normalizeToPointerData(e);for(let i=0,n=t.length;i<n;i++){const r=this.bootstrapEvent(this.rootPointerEvent,t[i]);this.rootBoundary.mapEvent(r)}this.setCursor(this.rootBoundary.cursor)}onWheel(e){if(!this.features.wheel)return;const t=this.normalizeWheelEvent(e);this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,this.rootBoundary.mapEvent(t)}setTargetElement(e){this.removeEvents(),this.domElement=e,Pr.domElement=e,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;Pr.addTickerListener();const e=this.domElement.style;e&&(globalThis.navigator.msPointerEnabled?(e.msContentZooming="none",e.msTouchAction="none"):this.supportsPointerEvents&&(e.touchAction="none")),this.supportsPointerEvents?(globalThis.document.addEventListener("pointermove",this.onPointerMove,!0),this.domElement.addEventListener("pointerdown",this.onPointerDown,!0),this.domElement.addEventListener("pointerleave",this.onPointerOverOut,!0),this.domElement.addEventListener("pointerover",this.onPointerOverOut,!0),globalThis.addEventListener("pointerup",this.onPointerUp,!0)):(globalThis.document.addEventListener("mousemove",this.onPointerMove,!0),this.domElement.addEventListener("mousedown",this.onPointerDown,!0),this.domElement.addEventListener("mouseout",this.onPointerOverOut,!0),this.domElement.addEventListener("mouseover",this.onPointerOverOut,!0),globalThis.addEventListener("mouseup",this.onPointerUp,!0),this.supportsTouchEvents&&(this.domElement.addEventListener("touchstart",this.onPointerDown,!0),this.domElement.addEventListener("touchend",this.onPointerUp,!0),this.domElement.addEventListener("touchmove",this.onPointerMove,!0))),this.domElement.addEventListener("wheel",this.onWheel,{passive:!0,capture:!0}),this.eventsAdded=!0}removeEvents(){if(!this.eventsAdded||!this.domElement)return;Pr.removeTickerListener();const e=this.domElement.style;globalThis.navigator.msPointerEnabled?(e.msContentZooming="",e.msTouchAction=""):this.supportsPointerEvents&&(e.touchAction=""),this.supportsPointerEvents?(globalThis.document.removeEventListener("pointermove",this.onPointerMove,!0),this.domElement.removeEventListener("pointerdown",this.onPointerDown,!0),this.domElement.removeEventListener("pointerleave",this.onPointerOverOut,!0),this.domElement.removeEventListener("pointerover",this.onPointerOverOut,!0),globalThis.removeEventListener("pointerup",this.onPointerUp,!0)):(globalThis.document.removeEventListener("mousemove",this.onPointerMove,!0),this.domElement.removeEventListener("mousedown",this.onPointerDown,!0),this.domElement.removeEventListener("mouseout",this.onPointerOverOut,!0),this.domElement.removeEventListener("mouseover",this.onPointerOverOut,!0),globalThis.removeEventListener("mouseup",this.onPointerUp,!0),this.supportsTouchEvents&&(this.domElement.removeEventListener("touchstart",this.onPointerDown,!0),this.domElement.removeEventListener("touchend",this.onPointerUp,!0),this.domElement.removeEventListener("touchmove",this.onPointerMove,!0))),this.domElement.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this.eventsAdded=!1}mapPositionToPoint(e,t,i){const n=this.domElement.isConnected?this.domElement.getBoundingClientRect():{width:this.domElement.width,height:this.domElement.height,left:0,top:0},r=1/this.resolution;e.x=(t-n.left)*(this.domElement.width/n.width)*r,e.y=(i-n.top)*(this.domElement.height/n.height)*r}normalizeToPointerData(e){const t=[];if(this.supportsTouchEvents&&e instanceof TouchEvent)for(let i=0,n=e.changedTouches.length;i<n;i++){const r=e.changedTouches[i];typeof r.button>"u"&&(r.button=0),typeof r.buttons>"u"&&(r.buttons=1),typeof r.isPrimary>"u"&&(r.isPrimary=e.touches.length===1&&e.type==="touchstart"),typeof r.width>"u"&&(r.width=r.radiusX||1),typeof r.height>"u"&&(r.height=r.radiusY||1),typeof r.tiltX>"u"&&(r.tiltX=0),typeof r.tiltY>"u"&&(r.tiltY=0),typeof r.pointerType>"u"&&(r.pointerType="touch"),typeof r.pointerId>"u"&&(r.pointerId=r.identifier||0),typeof r.pressure>"u"&&(r.pressure=r.force||.5),typeof r.twist>"u"&&(r.twist=0),typeof r.tangentialPressure>"u"&&(r.tangentialPressure=0),typeof r.layerX>"u"&&(r.layerX=r.offsetX=r.clientX),typeof r.layerY>"u"&&(r.layerY=r.offsetY=r.clientY),r.isNormalized=!0,r.type=e.type,t.push(r)}else if(!globalThis.MouseEvent||e instanceof MouseEvent&&(!this.supportsPointerEvents||!(e instanceof globalThis.PointerEvent))){const 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=gE),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=vE[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 lv(s){return s==="dynamic"||s==="static"}const yE={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??lv(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=lv(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}};vi.mixin(yE);const xE={accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:!1,_accessibleDiv:null,accessibleType:"button",accessiblePointerEvents:"auto",accessibleChildren:!0,renderId:-1};vi.mixin(xE);const bE=9,vc=100,wE=0,SE=0,cv=2,hv=1,_E=-1e3,ME=-1e3,TE=2;class Vb{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,(Qn.tablet||Qn.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=`${wE}px`,t.style.left=`${SE}px`,t.style.zIndex=cv.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=`${hv}px`,e.style.height=`${hv}px`,e.style.position="absolute",e.style.top=`${_E}px`,e.style.left=`${ME}px`,e.style.zIndex=TE.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<t.length;i++)this.updateAccessibleObjects(t[i])}update(){const e=performance.now();if(Qn.android.device&&e<this.androidUpdateCount||(this.androidUpdateCount=e+this.androidUpdateFrequency,!this.renderer.renderingToScreen))return;this.renderer.lastObjectRendered&&this.updateAccessibleObjects(this.renderer.lastObjectRendered);const{x:t,y:i,width:n,height:r}=this.renderer.view.getBoundingClientRect(),{width:a,height:o,resolution:h}=this.renderer,l=n/a*h,c=r/o*h;let u=this.div;u.style.left=`${t}px`,u.style.top=`${i}px`,u.style.width=`${a}px`,u.style.height=`${o}px`;for(let d=0;d<this.children.length;d++){const f=this.children[d];if(f.renderId!==this.renderId)f._accessibleActive=!1,yo(this.children,d,1),this.div.removeChild(f._accessibleDiv),this.pool.push(f._accessibleDiv),f._accessibleDiv=null,d--;else{u=f._accessibleDiv;let p=f.hitArea;const m=f.worldTransform;f.hitArea?(u.style.left=`${(m.tx+p.x*m.a)*l}px`,u.style.top=`${(m.ty+p.y*m.d)*c}px`,u.style.width=`${p.width*m.a*l}px`,u.style.height=`${p.height*m.d*c}px`):(p=f.getBounds(),this.capHitArea(p),u.style.left=`${p.x*l}px`,u.style.top=`${p.y*c}px`,u.style.width=`${p.width*l}px`,u.style.height=`${p.height*c}px`,u.title!==f.accessibleTitle&&f.accessibleTitle!==null&&(u.title=f.accessibleTitle),u.getAttribute("aria-label")!==f.accessibleHint&&f.accessibleHint!==null&&u.setAttribute("aria-label",f.accessibleHint)),(f.accessibleTitle!==u.title||f.tabIndex!==u.tabIndex)&&(u.title=f.accessibleTitle,u.tabIndex=f.tabIndex,this.debug&&this.updateDebugHTML(u))}}this.renderId++}updateDebugHTML(e){e.innerHTML=`type: ${e.type}</br> title : ${e.title}</br> tabIndex: ${e.tabIndex}`}capHitArea(e){e.x<0&&(e.width+=e.x,e.x=0),e.y<0&&(e.height+=e.y,e.y=0);const{width:t,height: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=cv.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===bE&&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}}Vb.extension={name:"accessibility",type:[He.RendererPlugin,He.CanvasRendererPlugin]};tt.add(Vb);const Yb=class mm{constructor(e){this.stage=new ji,e=Object.assign({forceCanvas:!1},e),this.renderer=BA(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}};Yb._plugins=[];let $b=Yb;tt.handleByList(He.Application,$b._plugins);class Gb{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}}Gb.extension=He.Application;tt.add(Gb);const uv={loader:He.LoadParser,resolver:He.ResolveParser,cache:He.CacheParser,detection:He.DetectionParser};tt.handle(He.Asset,s=>{const e=s.ref;Object.entries(uv).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(uv).filter(t=>!!e[t]).forEach(t=>tt.remove(e[t]))});class AE{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<t;i++)e.push(this._assetList.pop());await this._loader.load(e),this._isLoading=!1,this._next()}}get active(){return this._isActive}set active(e){this._isActive!==e&&(this._isActive=e,e&&!this._isLoading&&this._next())}}function Do(s,e){if(Array.isArray(e)){for(const t of e)if(s.startsWith(`data:${t}`))return!0;return!1}return s.startsWith(`data:${e}`)}function gs(s,e){const t=s.split("?")[0],i=Si.extname(t).toLowerCase();return Array.isArray(e)?e.includes(i):i===e}const js=(s,e,t=!1)=>(Array.isArray(s)||(s=[s]),e?s.map(i=>typeof i=="string"||t?e(i):i):s),_h=(s,e)=>{const t=e.split("?")[1];return t&&(s+=`?${t}`),s};function Hb(s,e,t,i,n){const r=e[t];for(let a=0;a<r.length;a++){const o=r[a];t<e.length-1?Hb(s.replace(i[t],o),e,t+1,i,n):n.push(s.replace(i[t],o))}}function EE(s){const e=/\{(.*?)\}/g,t=s.match(e),i=[];if(t){const n=[];t.forEach(r=>{const a=r.substring(1,r.length-1).split(",");n.push(a)}),Hb(s,n,0,t,i)}else i.push(s);return i}const Mh=s=>!Array.isArray(s);class CE{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=js(e);let n;for(let o=0;o<this.parsers.length;o++){const h=this.parsers[o];if(h.test(t)){n=h.getCacheableAssets(i,t);break}}n||(n={},i.forEach(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 mt){const o=t;i.forEach(h=>{o.baseTexture!==mt.EMPTY.baseTexture&>.addToCache(o.baseTexture,h),mt.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 ga=new CE;class IE{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<this.parsers.length;h++){const l=this.parsers[h];if(l.load&&((a=l.test)!=null&&a.call(l,e,t,this))){r=l;break}}if(!r)return console.warn(`[Assets] ${e} could not be loaded as we don't know how to parse it, ensure the correct parser has been added`),null}n=await r.load(e,t,this),i.parser=r;for(let h=0;h<this.parsers.length;h++){const l=this.parsers[h];l.parse&&l.parse&&await((o=l.testParse)==null?void 0:o.call(l,n,t,this))&&(n=await l.parse(n,t,this)||n,i.parser=l)}return n})(),i}async load(e,t){this._parsersValidated||this._validateParsers();let i=0;const n={},r=Mh(e),a=js(e,l=>({alias:[l],src:l})),o=a.length,h=a.map(async l=>{const c=Si.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=js(e,i=>({alias:[i],src:i})).map(async i=>{var a,o;const n=Si.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 _s=(s=>(s[s.Low=0]="Low",s[s.Normal=1]="Normal",s[s.High=2]="High",s))(_s||{});const RE=".json",PE="application/json",kE={extension:{type:He.LoadParser,priority:_s.Low},name:"loadJson",test(s){return Do(s,PE)||gs(s,RE)},async load(s){return await(await We.ADAPTER.fetch(s)).json()}};tt.add(kE);const FE=".txt",OE="text/plain",BE={name:"loadTxt",extension:{type:He.LoadParser,priority:_s.Low},test(s){return Do(s,OE)||gs(s,FE)},async load(s){return await(await We.ADAPTER.fetch(s)).text()}};tt.add(BE);const LE=["normal","bold","100","200","300","400","500","600","700","800","900"],DE=[".ttf",".otf",".woff",".woff2"],NE=["font/ttf","font/otf","font/woff","font/woff2"],UE=/^(--|-?[A-Z_])[0-9A-Z_-]*$/i;function XE(s){const e=Si.extname(s),t=Si.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(UE)){i=!1;break}let n=t.join(" ");return i||(n=`"${n.replace(/[\\"]/g,"\\$&")}"`),n}const VE=/^[0-9A-Za-z%:/?#\[\]@!\$&'()\*\+,;=\-._~]*$/;function YE(s){return VE.test(s)?s:encodeURI(s)}const $E={extension:{type:He.LoadParser,priority:_s.Low},name:"loadWebFont",test(s){return Do(s,NE)||gs(s,DE)},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)??XE(s),h=((r=(n=e.data)==null?void 0:n.weights)==null?void 0:r.filter(c=>LE.includes(c)))??["normal"],l=e.data??{};for(let c=0;c<h.length;c++){const u=h[c],d=new FontFace(o,`url(${YE(s)})`,{...l,weight:u});await d.load(),t.add(d),a.push(d)}return a.length===1?a[0]:a}return console.warn("[loadWebFont] FontFace API is not supported. Skipping loading font"),null},unload(s){(Array.isArray(s)?s:[s]).forEach(e=>We.ADAPTER.getFontFaceSet().delete(e))}};tt.add($E);const GE=`(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([GE],{type:"application/javascript"}))),this.worker=new Worker(wo)}};pm.revokeObjectURL=function(){wo&&(URL.revokeObjectURL(wo),wo=null)};const HE=`(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 jb{constructor(){So||(So=URL.createObjectURL(new Blob([HE],{type:"application/javascript"}))),this.worker=new Worker(So)}}jb.revokeObjectURL=function(){So&&(URL.revokeObjectURL(So),So=null)};let dv=0,rf;class jE{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<rf&&(this._createdWorkers++,e=new jb().worker,e.addEventListener("message",t=>{this.complete(t.data),this.returnWorker(t.target),this.next()})),e}returnWorker(e){this.workerPool.push(e)}complete(e){e.error!==void 0?this.resolveHash[e.uuid].reject(e.error):this.resolveHash[e.uuid].resolve(e.data),this.resolveHash[e.uuid]=null}async _run(e,t){await this._initWorkers();const 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[dv]={resolve:t.resolve,reject:t.reject},e.postMessage({data:t.arguments,uuid:dv++,id:i})}}const fv=new jE;function zl(s,e,t){s.resource.internal=!0;const i=new mt(s),n=()=>{delete e.promiseCache[t],ga.has(t)&&ga.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 WE=[".jpeg",".jpg",".png",".webp",".avif"],zE=["image/jpeg","image/png","image/webp","image/avif"];async function qE(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 _u={name:"loadTextures",extension:{type:He.LoadParser,priority:_s.High},config:{preferWorkers:!0,preferCreateImageBitmap:!0,crossOrigin:"anonymous"},test(s){return Do(s,zE)||gs(s,WE)},async load(s,e,t){var o;const i=globalThis.createImageBitmap&&this.config.preferCreateImageBitmap;let n;i?this.config.preferWorkers&&await fv.isImageBitmapSupported()?n=await fv.loadImageBitmap(s):n=await qE(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=dr(s)),i&&((o=r.resourceOptions)==null?void 0:o.ownsImageBitmap)===void 0&&(r.resourceOptions={...r.resourceOptions},r.resourceOptions.ownsImageBitmap=!0);const a=new gt(n,r);return a.resource.src=s,zl(a,t,s)},unload(s){s.destroy(!0)}};tt.add(_u);const KE=".svg",ZE="image/svg+xml",JE={extension:{type:He.LoadParser,priority:_s.High},name:"loadSVG",test(s){return Do(s,ZE)||gs(s,KE)},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 gt(i,{resolution:dr(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:_u.unload};tt.add(JE);const QE=[".mp4",".m4v",".webm",".ogv"],eC=["video/mp4","video/webm","video/ogg"],tC={name:"loadVideo",extension:{type:He.LoadParser,priority:_s.High},config:{defaultAutoPlay:!0,defaultUpdateFPS:0,defaultLoop:!1,defaultMuted:!1,defaultPlaysinline:!0},test(s){return Do(s,eC)||gs(s,QE)},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 Nb(r,o);await h.load();const l=new gt(h,{alphaMode:await l2(),resolution:dr(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(tC);class iC{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 js(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`)},js(a).forEach(h=>{const{src:l,srcs:c}=h;let{data:u,format:d,loadParser:f}=h;const p=js(l||c).map(v=>typeof v=="string"?EE(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._parsers.length;w++){const A=this._parsers[w];if(A.test(b)){y=A.parse(b);break}}}else u=b.data??u,d=b.format??d,f=b.loadParser??f,y={...y,...b};if(!m)throw new Error(`[Resolver] alias is undefined for this asset: ${y.src}`);y=this.buildResolvedAsset(y,{aliases:m,data:u,format:d,loadParser:f}),g.push(y)})}),m.forEach(v=>{this._assetMap[v]=g})})}resolveBundle(e){const t=Mh(e);e=js(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=Mh(e);e=js(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;t<e.length;t++){const i=e[0],n=this._preferredOrder.find(r=>r.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=Si.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??Si.extname(e.src).slice(1),e.srcs=e.src,e.name=e.alias,e}}class sC{constructor(){this._detections=[],this._initialized=!1,this.resolver=new iC,this.loader=new IE,this.cache=ga,this._backgroundLoader=new AE(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=Mh(e),n=js(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 ga.get(e);const t={};for(let i=0;i<e.length;i++)t[i]=ga.get(e[i]);return t}async _mapLoadToResolve(e,t){const i=Object.values(e),n=Object.keys(e);this._backgroundLoader.active=!1;const r=await this.loader.load(i,t);this._backgroundLoader.active=!0;const a={};return i.forEach((o,h)=>{const l=r[o.src],c=[o.src];o.alias&&c.push(...o.alias),a[n[h]]=l,ga.set(c,l)}),a}async unload(e){this._initialized||await this.init();const t=js(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=js(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=>{ga.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 _u.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 Rn=new sC;tt.handleByList(He.LoadParser,Rn.loader.parsers).handleByList(He.ResolveParser,Rn.resolver.parsers).handleByList(He.CacheParser,Rn.cache.parsers).handleByList(He.DetectionParser,Rn.detections);const nC={extension:He.CacheParser,test:s=>Array.isArray(s)&&s.every(e=>e instanceof mt),getCacheableAssets:(s,e)=>{const t={};return s.forEach(i=>{e.forEach((n,r)=>{t[i+(r===0?"":r+1)]=n})}),t}};tt.add(nC);async function Wb(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 rC={extension:{type:He.DetectionParser,priority:1},test:async()=>Wb("data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A="),add:async s=>[...s,"avif"],remove:async s=>s.filter(e=>e!=="avif")};tt.add(rC);const aC={extension:{type:He.DetectionParser,priority:0},test:async()=>Wb("data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA="),add:async s=>[...s,"webp"],remove:async s=>s.filter(e=>e!=="webp")};tt.add(aC);const mv=["png","jpg","jpeg"],oC={extension:{type:He.DetectionParser,priority:-1},test:()=>Promise.resolve(!0),add:async s=>[...s,...mv],remove:async s=>s.filter(e=>!mv.includes(e))};tt.add(oC);const lC="WorkerGlobalScope"in globalThis&&globalThis instanceof globalThis.WorkerGlobalScope;function xp(s){return lC?!1:document.createElement("video").canPlayType(s)!==""}const cC={extension:{type:He.DetectionParser,priority:0},test:async()=>xp("video/webm"),add:async s=>[...s,"webm"],remove:async s=>s.filter(e=>e!=="webm")};tt.add(cC);const hC={extension:{type:He.DetectionParser,priority:0},test:async()=>xp("video/mp4"),add:async s=>[...s,"mp4","m4v"],remove:async s=>s.filter(e=>e!=="mp4"&&e!=="m4v")};tt.add(hC);const uC={extension:{type:He.DetectionParser,priority:0},test:async()=>xp("video/ogg"),add:async s=>[...s,"ogv"],remove:async s=>s.filter(e=>e!=="ogv")};tt.add(uC);const dC={extension:He.ResolveParser,test:_u.test,parse:s=>{var e;return{resolution:parseFloat(((e=We.RETINA_PREFIX.exec(s))==null?void 0:e[1])??"1"),format:Si.extname(s).slice(1),src:s}}};tt.add(dC);var Vi=(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))(Vi||{});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 fn,ro;function pv(){ro={bptc:fn.getExtension("EXT_texture_compression_bptc"),astc:fn.getExtension("WEBGL_compressed_texture_astc"),etc:fn.getExtension("WEBGL_compressed_texture_etc"),s3tc:fn.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:fn.getExtension("WEBGL_compressed_texture_s3tc_srgb"),pvrtc:fn.getExtension("WEBGL_compressed_texture_pvrtc")||fn.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),etc1:fn.getExtension("WEBGL_compressed_texture_etc1"),atc:fn.getExtension("WEBGL_compressed_texture_atc")}}const fC={extension:{type:He.DetectionParser,priority:2},test:async()=>{const s=We.ADAPTER.createCanvas().getContext("webgl");return s?(fn=s,!0):(console.warn("WebGL not available for compressed textures."),!1)},add:async s=>{ro||pv();const e=[];for(const t in ro)ro[t]&&e.push(t);return[...e,...s]},remove:async s=>(ro||pv(),s.filter(e=>!(e in ro)))};tt.add(fC);class mC 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 Ca extends mC{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=Ca._formatToExtension(this.format),(t.levelBuffers||this.buffer)&&(this._levelBuffers=t.levelBuffers||Ca._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<a;r++){const{levelID:o,levelWidth:h,levelHeight:l,levelBuffer:c}=this._levelBuffers[r];n.compressedTexImage2D(n.TEXTURE_2D,o,this.format,h,l,0,c)}return!0}onBlobLoaded(){this._levelBuffers=Ca._createLevelBuffers(this.buffer.uint8View,this.format,this.levels,4,4,this.width,this.height)}static _formatToExtension(e){if(e>=33776&&e<=33779)return"s3tc";if(e>=35916&&e<=35919)return"s3tc_sRGB";if(e>=37488&&e<=37497)return"etc";if(e>=35840&&e<=35843)return"pvrtc";if(e===36196)return"etc1";if(e===35986||e===35987||e===34798)return"atc";if(e>=36492&&e<=36495)return"bptc";if(e===37808)return"astc";throw new Error(`Invalid (compressed) texture format given: ${e}`)}static _createLevelBuffers(e,t,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;m<i;m++)h[m]={levelID:m,levelWidth:i>1?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,pC=32,gv=20,gC=542327876,xc={HEIGHT:3,WIDTH:4,MIPMAP_COUNT:7,PIXEL_FORMAT:19},vC={FOURCC:2},bc={DXGI_FORMAT:0,RESOURCE_DIMENSION:1,MISC_FLAG:2,ARRAY_SIZE:3},yC=1,xC=2,bC=4,wC=64,SC=512,_C=131072,MC=827611204,TC=861165636,AC=894720068,EC=808540228,CC=4,IC={[MC]:Vi.COMPRESSED_RGBA_S3TC_DXT1_EXT,[TC]:Vi.COMPRESSED_RGBA_S3TC_DXT3_EXT,[AC]:Vi.COMPRESSED_RGBA_S3TC_DXT5_EXT},RC={70:Vi.COMPRESSED_RGBA_S3TC_DXT1_EXT,71:Vi.COMPRESSED_RGBA_S3TC_DXT1_EXT,73:Vi.COMPRESSED_RGBA_S3TC_DXT3_EXT,74:Vi.COMPRESSED_RGBA_S3TC_DXT3_EXT,76:Vi.COMPRESSED_RGBA_S3TC_DXT5_EXT,77:Vi.COMPRESSED_RGBA_S3TC_DXT5_EXT,72:Vi.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,75:Vi.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,78:Vi.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT,96:Vi.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT,95:Vi.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT,98:Vi.COMPRESSED_RGBA_BPTC_UNORM_EXT,99:Vi.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT};function PC(s){const e=new Uint32Array(s);if(e[0]!==gC)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,pC/Uint32Array.BYTES_PER_ELEMENT),o=a[yC];if(o&bC){const h=a[vC.FOURCC];if(h!==EC){const b=IC[h],y=af+yc,w=new Uint8Array(s,y);return[new Ca(w,{format:b,width:n,height:i,levels:r})]}const l=af+yc,c=new Uint32Array(e.buffer,l,gv/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=RC[u];if(m===void 0)throw new Error(`DDSParser cannot parse texture data with DXGI format ${u}`);if(f===CC)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+gv;if(p===1)g.push(new Uint8Array(s,v));else{const b=Th[m];let y=0,w=n,A=i;for(let M=0;M<r;M++){const R=Math.max(1,w+3&-4),P=Math.max(1,A+3&-4),F=R*P*b;y+=F,w=w>>>1,A=A>>>1}let T=v;for(let M=0;M<p;M++)g.push(new Uint8Array(s,T,y)),T+=y}return g.map(b=>new Ca(b,{format:m,width:n,height:i,levels:r}))}throw o&wC?new Error("DDSParser does not support uncompressed texture data."):o&SC?new Error("DDSParser does not supported YUV uncompressed texture data."):o&_C?new Error("DDSParser does not support single-channel (lumninance) texture data!"):o&xC?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 vv=[171,75,84,88,32,49,49,187,13,10,26,10],kC=67305985,Vs={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,yv={[et.UNSIGNED_BYTE]:1,[et.UNSIGNED_SHORT]:2,[et.INT]:4,[et.UNSIGNED_INT]:4,[et.FLOAT]:4,[et.HALF_FLOAT]:8},FC={[De.RGBA]:4,[De.RGB]:3,[De.RG]:2,[De.RED]:1,[De.LUMINANCE]:1,[De.LUMINANCE_ALPHA]:2,[De.ALPHA]:1},OC={[et.UNSIGNED_SHORT_4_4_4_4]:2,[et.UNSIGNED_SHORT_5_5_5_1]:2,[et.UNSIGNED_SHORT_5_6_5]:2};function BC(s,e,t=!1){const i=new DataView(e);if(!LC(s,i))return null;const n=i.getUint32(Vs.ENDIANNESS,!0)===kC,r=i.getUint32(Vs.GL_TYPE,n),a=i.getUint32(Vs.GL_FORMAT,n),o=i.getUint32(Vs.GL_INTERNAL_FORMAT,n),h=i.getUint32(Vs.PIXEL_WIDTH,n),l=i.getUint32(Vs.PIXEL_HEIGHT,n)||1,c=i.getUint32(Vs.PIXEL_DEPTH,n)||1,u=i.getUint32(Vs.NUMBER_OF_ARRAY_ELEMENTS,n)||1,d=i.getUint32(Vs.NUMBER_OF_FACES,n),f=i.getUint32(Vs.NUMBER_OF_MIPMAP_LEVELS,n),p=i.getUint32(Vs.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?yv[r]?A=yv[r]*FC[a]:A=OC[r]:A=Th[o],A===void 0)throw new Error("Unable to resolve the pixel format stored in the *.ktx file!");const T=t?NC(i,p,n):null;let M=w*A,R=h,P=l,F=v,I=b,k=gm+p;for(let O=0;O<f;O++){const L=i.getUint32(k,n);let U=k+4;for(let B=0;B<u;B++){let D=y[B];D||(D=y[B]=new Array(f)),D[O]={levelID:O,levelWidth:f>1||r!==0?R:F,levelHeight:f>1||r!==0?P:I,levelBuffer:new Uint8Array(e,U,M)},U+=M}k+=L+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,M=F*I*A}return r!==0?{uncompressed:y.map(O=>{let L=O[0].levelBuffer,U=!1;return r===et.FLOAT?L=new Float32Array(O[0].levelBuffer.buffer,O[0].levelBuffer.byteOffset,O[0].levelBuffer.byteLength/4):r===et.UNSIGNED_INT?(U=!0,L=new Uint32Array(O[0].levelBuffer.buffer,O[0].levelBuffer.byteOffset,O[0].levelBuffer.byteLength/4)):r===et.INT&&(U=!0,L=new Int32Array(O[0].levelBuffer.buffer,O[0].levelBuffer.byteOffset,O[0].levelBuffer.byteLength/4)),{resource:new yu(L,{width:O[0].levelWidth,height:O[0].levelHeight}),type:r,format:U?DC(a):a}}),kvData:T}:{compressed:y.map(O=>new Ca(null,{format:o,width:h,height:l,levels:f,levelBuffers:O})),kvData:T}}function LC(s,e){for(let t=0;t<vv.length;t++)if(e.getUint8(t)!==vv[t])return console.error(`${s} is not a valid *.ktx file!`),!1;return!0}function DC(s){switch(s){case De.RGBA:return De.RGBA_INTEGER;case De.RGB:return De.RGB_INTEGER;case De.RG:return De.RG_INTEGER;case De.RED:return De.RED_INTEGER;default:return s}}function NC(s,e,t){const i=new Map;let n=0;for(;n<e;){const r=s.getUint32(gm+n,t),a=gm+n+4,o=3-(r+3)%4;if(r===0||r>e-n){console.error("KTXLoader: keyAndValueByteSize out of bounds");break}let h=0;for(;h<r&&s.getUint8(a+h)!==0;h++);if(h===-1){console.error("KTXLoader: Failed to find null byte terminating kvData key");break}const l=new TextDecoder().decode(new Uint8Array(s.buffer,a,h)),c=new DataView(s.buffer,a+h+1,r-h-1);i.set(l,c),n+=4+r+o}return i}const UC={extension:{type:He.LoadParser,priority:_s.High},name:"loadDDS",test(s){return gs(s,".dds")},async load(s,e,t){const i=await(await We.ADAPTER.fetch(s)).arrayBuffer(),n=PC(i).map(r=>{const a=new gt(r,{mipmap:Bs.OFF,alphaMode:Xi.NO_PREMULTIPLIED_ALPHA,resolution:dr(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(UC);const XC={extension:{type:He.LoadParser,priority:_s.High},name:"loadKTX",test(s){return gs(s,".ktx")},async load(s,e,t){const i=await(await We.ADAPTER.fetch(s)).arrayBuffer(),{compressed:n,uncompressed:r,kvData:a}=BC(s,i),o=n??r,h={mipmap:Bs.OFF,alphaMode:Xi.NO_PREMULTIPLIED_ALPHA,resolution:dr(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 gt(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(XC);const VC=["s3tc","s3tc_sRGB","etc","etc1","pvrtc","atc","astc","bptc"],YC={extension:He.ResolveParser,test:s=>{const e=Si.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(VC.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(YC);const wc=new Tt,$C=4,zb=class ol{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&&ol._flipY(i,n,r),o&&ol._unpremultiplyAlpha(i);const h=new M2(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&&ol._flipY(i,n,r),o&&ol._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===De.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($C*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<r;o++){const h=o*n,l=(i-o-1)*n;a.set(e.subarray(h,h+n)),e.copyWithin(h,l,l+n),e.set(a,l)}}static _unpremultiplyAlpha(e){e instanceof Uint8ClampedArray&&(e=new Uint8Array(e.buffer));const t=e.length;for(let i=0;i<t;i+=4){const n=e[i+3];if(n!==0){const r=255.001/n;e[i]=e[i]*r+.5,e[i+1]=e[i+1]*r+.5,e[i+2]=e[i+2]*r+.5}}}};zb.extension={name:"extract",type:He.RendererSystem};let GC=zb;tt.add(GC);const Ah={build(s){const e=s.points;let t,i,n,r,a,o;if(s.type===Hi.CIRC){const p=s.shape;t=p.x,i=p.y,a=o=p.radius,n=r=0}else if(s.type===Hi.ELIP){const p=s.shape;t=p.x,i=p.y,a=p.width,o=p.height,n=r=0}else{const p=s.shape,m=p.width/2,g=p.height/2;t=p.x+m,i=p.y+g,a=o=Math.max(0,Math.min(p.radius,Math.min(m,g))),n=m-a,r=g-o}if(!(a>=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;p<h;p++){const m=Math.PI/2*(p/h),g=n+Math.cos(m)*a,v=r+Math.sin(m)*o,b=t+g,y=t-g,w=i+v,A=i-v;e[c++]=b,e[c++]=w,e[--u]=w,e[--u]=y,e[d++]=y,e[d++]=A,e[--f]=A,e[--f]=b}{const p=n,m=r+o,g=t+p,v=t-p,b=i+m,y=i-m;e[c++]=g,e[c++]=b,e[--f]=y,e[--f]=g,n&&(e[c++]=v,e[c++]=b,e[--f]=y,e[--f]=v)}},triangulate(s,e){const t=s.points,i=e.points,n=e.indices;if(t.length===0)return;let r=i.length/2;const a=r;let o,h;if(s.type!==Hi.RREC){const c=s.shape;o=c.x,h=c.y}else{const c=s.shape;o=c.x+c.width/2,h=c.y+c.height/2}const l=s.matrix;i.push(s.matrix?l.a*o+l.c*h+l.tx:o,s.matrix?l.b*o+l.d*h+l.ty:h),r++,i.push(t[0],t[1]);for(let c=2;c<t.length;c+=2)i.push(t[c],t[c+1]),n.push(r++,a,r);n.push(a+1,a,r)}};function xv(s,e=!1){const t=s.length;if(t<6)return;let i=0;for(let n=0,r=s[t-2],a=s[t-1];n<t;n+=2){const o=s[n],h=s[n+1];i+=(o-r)*(h+a),r=o,a=h}if(!e&&i>0||e&&i<=0){const n=t/2;for(let r=n+n%2;r<t;r+=2){const a=t-r-2,o=t-r-1,h=r,l=r+1;[s[a],s[h]]=[s[h],s[a]],[s[o],s[l]]=[s[l],s[o]]}}}const qb={build(s){s.points=s.shape.points.slice()},triangulate(s,e){let t=s.points;const i=s.holes,n=e.points,r=e.indices;if(t.length>=6){xv(t,!1);const a=[];for(let l=0;l<i.length;l++){const c=i[l];xv(c.points,!0),a.push(t.length/2),t=t.concat(c.points)}const o=MT(t,a,2);if(!o)return;const h=n.length/2;for(let l=0;l<o.length;l+=3)r.push(o[l]+h),r.push(o[l+1]+h),r.push(o[l+2]+h);for(let l=0;l<t.length;l++)n.push(t[l])}}},HC={build(s){const e=s.shape,t=e.x,i=e.y,n=e.width,r=e.height,a=s.points;a.length=0,n>=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)}},jC={build(s){Ah.build(s)},triangulate(s,e){Ah.triangulate(s,e)}};var Is=(s=>(s.MITER="miter",s.BEVEL="bevel",s.ROUND="round",s))(Is||{}),Lr=(s=>(s.BUTT="butt",s.ROUND="round",s.SQUARE="square",s))(Lr||{});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 t<this.minSegments?t=this.minSegments:t>this.maxSegments&&(t=this.maxSegments),t}};class bv{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),M=h*(v+b),R=u*(g+y),P=c*(g+y),F=Math.atan2(M-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 WC{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 bp{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(bp.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 wv(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 oa(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&&c<u?c+=Math.PI*2:!o&&c>u&&(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<g;b++,y+=v)a.push(s,e,s+Math.sin(y)*m,e+Math.cos(y)*m);a.push(s,e,n,r)}else{a.push(t,i,s,e);for(let b=1,y=d;b<g;b++,y+=v)a.push(s+Math.sin(y)*m,e+Math.cos(y)*m,s,e);a.push(n,r,s,e)}return g*2}function zC(s,e){const t=s.shape;let i=s.points||t.points.slice();const n=e.closePointEps;if(i.length===0)return;const r=s.lineStyle,a=new Xt(i[0],i[1]),o=new Xt(i[i.length-2],i[i.length-1]),h=t.type!==Hi.POLY||t.closeStroke,l=Math.abs(a.x-o.x)<n&&Math.abs(a.y-o.y)<n;if(h){i=i.slice(),l&&(i.pop(),i.pop(),o.set(i[i.length-2],i[i.length-1]));const D=(a.x+o.x)*.5,_=(o.y+a.y)*.5;i.unshift(D,_),i.push(D,_)}const c=e.points,u=i.length/2;let d=i.length;const f=c.length/2,p=r.width/2,m=p*p,g=r.miterLimit*r.miterLimit;let v=i[0],b=i[1],y=i[2],w=i[3],A=0,T=0,M=-(b-w),R=v-y,P=0,F=0,I=Math.sqrt(M*M+R*R);M/=I,R/=I,M*=p,R*=p;const k=r.alignment,O=(1-k)*2,L=k*2;h||(r.cap===Lr.ROUND?d+=oa(v-M*(O-L)*.5,b-R*(O-L)*.5,v-M*O,b-R*O,v+M*L,b+R*L,c,!0)+2:r.cap===Lr.SQUARE&&(d+=wv(v,b,M,R,O,L,!0,c))),c.push(v-M*O,b-R*O,v+M*L,b+R*L);for(let D=1;D<u-1;++D){v=i[(D-1)*2],b=i[(D-1)*2+1],y=i[D*2],w=i[D*2+1],A=i[(D+1)*2],T=i[(D+1)*2+1],M=-(b-w),R=v-y,I=Math.sqrt(M*M+R*R),M/=I,R/=I,M*=p,R*=p,P=-(w-T),F=y-A,I=Math.sqrt(P*P+F*F),P/=I,F/=I,P*=p,F*=p;const _=y-v,X=b-w,N=y-A,V=T-w,G=_*N+X*V,j=X*N-V*_,ne=j<0;if(Math.abs(j)<.001*Math.abs(G)){c.push(y-M*O,w-R*O,y+M*L,w+R*L),G>=0&&(r.join===Is.ROUND?d+=oa(y,w,y-M*O,w-R*O,y-P*O,w-F*O,c,!1)+4:d+=2,c.push(y-P*L,w-F*L,y+P*O,w+F*O));continue}const Q=(-M+v)*(-R+w)-(-M+y)*(-R+b),de=(-P+A)*(-F+w)-(-P+y)*(-F+T),me=(_*de-N*Q)/j,we=(V*Q-X*de)/j,Re=(me-y)*(me-y)+(we-w)*(we-w),ge=y+(me-y)*O,Ae=w+(we-w)*O,H=y-(me-y)*L,K=w-(we-w)*L,q=Math.min(_*_+X*X,N*N+V*V),z=ne?O:L,ee=q+z*z*m,le=Re<=ee;let ve=r.join;if(ve===Is.MITER&&Re/m>g&&(ve=Is.BEVEL),le)switch(ve){case Is.MITER:{c.push(ge,Ae,H,K);break}case Is.BEVEL:{ne?c.push(ge,Ae,y+M*L,w+R*L,ge,Ae,y+P*L,w+F*L):c.push(y-M*O,w-R*O,H,K,y-P*O,w-F*O,H,K),d+=2;break}case Is.ROUND:{ne?(c.push(ge,Ae,y+M*L,w+R*L),d+=oa(y,w,y+M*L,w+R*L,y+P*L,w+F*L,c,!0)+4,c.push(ge,Ae,y+P*L,w+F*L)):(c.push(y-M*O,w-R*O,H,K),d+=oa(y,w,y-M*O,w-R*O,y-P*O,w-F*O,c,!1)+4,c.push(y-P*O,w-F*O,H,K));break}}else{switch(c.push(y-M*O,w-R*O,y+M*L,w+R*L),ve){case Is.MITER:{ne?c.push(H,K,H,K):c.push(ge,Ae,ge,Ae),d+=2;break}case Is.ROUND:{ne?d+=oa(y,w,y+M*L,w+R*L,y+P*L,w+F*L,c,!0)+2:d+=oa(y,w,y-M*O,w-R*O,y-P*O,w-F*O,c,!1)+2;break}}c.push(y-P*O,w-F*O,y+P*L,w+F*L),d+=2}}v=i[(u-2)*2],b=i[(u-2)*2+1],y=i[(u-1)*2],w=i[(u-1)*2+1],M=-(b-w),R=v-y,I=Math.sqrt(M*M+R*R),M/=I,R/=I,M*=p,R*=p,c.push(y-M*O,w-R*O,y+M*L,w+R*L),h||(r.cap===Lr.ROUND?d+=oa(y-M*(O-L)*.5,w-R*(O-L)*.5,y-M*O,w-R*O,y+M*L,w+R*L,c,!1)+2:r.cap===Lr.SQUARE&&(d+=wv(y,w,M,R,O,L,!1,c)));const U=e.indices,B=Co.epsilon*Co.epsilon;for(let D=f;D<d+f-2;++D)v=c[D*2],b=c[D*2+1],y=c[(D+1)*2],w=c[(D+1)*2+1],A=c[(D+2)*2],T=c[(D+2)*2+1],!(Math.abs(v*(w-T)+y*(T-b)+A*(b-w))<B)&&U.push(D,D+1,D+2)}function qC(s,e){let t=0;const i=s.shape,n=s.points||i.points,r=i.type!==Hi.POLY||i.closeStroke;if(n.length===0)return;const a=e.points,o=e.indices,h=n.length/2,l=a.length/2;let c=l;for(a.push(n[0],n[1]),t=1;t<h;t++)a.push(n[t*2],n[t*2+1]),o.push(c,c+1),c++;r&&o.push(c,l)}function Sv(s,e){s.lineStyle.native?qC(s,e):zC(s,e)}class wp{static curveLength(e,t,i,n,r,a){const o=e-2*i+r,h=t-2*n+a,l=2*i-2*e,c=2*n-2*t,u=4*(o*o+h*h),d=4*(o*l+h*c),f=l*l+c*c,p=2*Math.sqrt(u+d+f),m=Math.sqrt(u),g=2*u*m,v=2*Math.sqrt(f),b=d/m;return(g*p+m*d*(p-v)+(4*f*u-d*d)*Math.log((2*m+b+p)/(b+v)))/(4*g)}static curveTo(e,t,i,n,r){const a=r[r.length-2],o=r[r.length-1],h=Co._segmentsCount(wp.curveLength(a,o,e,t,i,n));let l=0,c=0;for(let u=1;u<=h;++u){const d=u/h;l=a+(e-a)*d,c=o+(t-o)*d,r.push(l+(e+(i-e)*d-l)*d,c+(t+(n-t)*d-c)*d)}}}const of={[Hi.POLY]:qb,[Hi.CIRC]:Ah,[Hi.ELIP]:Ah,[Hi.RECT]:HC,[Hi.RREC]:jC},_v=[],Sc=[];class Eh{constructor(e,t=null,i=null,n=null){this.points=[],this.holes=[],this.shape=e,this.lineStyle=i,this.fillStyle=t,this.matrix=n,this.type=e.type}clone(){return new Eh(this.shape,this.fillStyle,this.lineStyle,this.matrix)}destroy(){this.shape=null,this.holes.length=0,this.holes=null,this.points.length=0,this.points=null,this.lineStyle=null,this.fillStyle=null}}const qa=new Xt,Kb=class Zb extends tb{constructor(){super(),this.closePointEps=1e-4,this.boundsPadding=0,this.uvsFloat32=null,this.indicesUint16=null,this.batchable=!1,this.points=[],this.colors=[],this.uvs=[],this.indices=[],this.textureIds=[],this.graphicsData=[],this.drawCalls=[],this.batchDirty=-1,this.batches=[],this.dirty=0,this.cacheDirty=-1,this.clearDirty=0,this.shapeIndex=0,this._bounds=new Ll,this.boundsDirty=-1}get bounds(){return this.updateBatches(),this.boundsDirty!==this.dirty&&(this.boundsDirty=this.dirty,this.calculateBounds()),this._bounds}invalidate(){this.boundsDirty=-1,this.dirty++,this.batchDirty++,this.shapeIndex=0,this.points.length=0,this.colors.length=0,this.uvs.length=0,this.indices.length=0,this.textureIds.length=0;for(let e=0;e<this.drawCalls.length;e++)this.drawCalls[e].texArray.clear(),Sc.push(this.drawCalls[e]);this.drawCalls.length=0;for(let e=0;e<this.batches.length;e++){const t=this.batches[e];t.reset(),_v.push(t)}this.batches.length=0}clear(){return this.graphicsData.length>0&&(this.invalidate(),this.clearDirty++,this.graphicsData.length=0),this}drawShape(e,t=null,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;e<this.graphicsData.length;++e)this.graphicsData[e].destroy();this.points.length=0,this.points=null,this.colors.length=0,this.colors=null,this.uvs.length=0,this.uvs=null,this.indices.length=0,this.indices=null,this.indexBuffer.destroy(),this.indexBuffer=null,this.graphicsData.length=0,this.graphicsData=null,this.drawCalls.length=0,this.drawCalls=null,this.batches.length=0,this.batches=null,this._bounds=null}containsPoint(e){const t=this.graphicsData;for(let i=0;i<t.length;++i){const n=t[i];if(n.fillStyle.visible&&n.shape&&(n.matrix?n.matrix.applyInverse(e,qa):qa.copyFrom(e),n.shape.contains(qa.x,qa.y))){let r=!1;if(n.holes){for(let a=0;a<n.holes.length;a++)if(n.holes[a].shape.contains(qa.x,qa.y)){r=!0;break}}if(!r)return!0}}return!1}updateBatches(){if(!this.graphicsData.length){this.batchable=!0;return}if(!this.validateBatching())return;this.cacheDirty=this.dirty;const e=this.uvs,t=this.graphicsData;let i=null,n=null;this.batches.length>0&&(i=this.batches[this.batches.length-1],n=i.style);for(let h=this.shapeIndex;h<t.length;h++){this.shapeIndex++;const l=t[h],c=l.fillStyle,u=l.lineStyle;of[l.type].build(l),l.matrix&&this.transformPoints(l.points,l.matrix),(c.visible||u.visible)&&this.processHoles(l.holes);for(let d=0;d<2;d++){const f=d===0?c:u;if(!f.visible)continue;const p=f.texture.baseTexture,m=this.indices.length,g=this.points.length/2;p.wrapMode=Zs.REPEAT,d===0?this.processFill(l):this.processLine(l);const v=this.points.length/2-g;v!==0&&(i&&!this._compareStyles(n,f)&&(i.end(m,g),i=null),i||(i=_v.pop()||new WC,i.begin(f,m,g),this.batches.push(i),n=f),this.addUvs(this.points,e,f.texture,g,v,f.matrix))}}const r=this.indices.length,a=this.points.length/2;if(i&&i.end(r,a),this.batches.length===0){this.batchable=!0;return}const o=a>65535;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;e<t;e++){const i=this.graphicsData[e],n=i.fillStyle,r=i.lineStyle;if(n&&!n.texture.baseTexture.valid||r&&!r.texture.baseTexture.valid)return!1}return!0}packBatches(){this.batchDirty++,this.uvsFloat32=new Float32Array(this.uvs);const e=this.batches;for(let t=0,i=e.length;t<i;t++){const n=e[t];for(let r=0;r<n.size;r++){const a=n.start+r;this.indicesUint16[a]=this.indicesUint16[a]-n.attribStart}}}isBatchable(){if(this.points.length>65535*2)return!1;const e=this.batches;for(let t=0;t<e.length;t++)if(e[t].style.native)return!1;return this.points.length<Zb.BATCHABLE_SIZE*2}buildDrawCalls(){let e=++gt._globalBatch;for(let u=0;u<this.drawCalls.length;u++)this.drawCalls[u].texArray.clear(),Sc.push(this.drawCalls[u]);this.drawCalls.length=0;const t=this.colors,i=this.textureIds;let n=Sc.pop();n||(n=new qf,n.texArray=new Qf),n.texArray.count=0,n.start=0,n.size=0,n.type=Cn.TRIANGLES;let r=0,a=null,o=0,h=!1,l=Cn.TRIANGLES,c=0;this.drawCalls.push(n);for(let u=0;u<this.batches.length;u++){const d=this.batches[u],f=8,p=d.style,m=p.texture.baseTexture;h!==!!p.native&&(h=!!p.native,l=h?Cn.LINES:Cn.TRIANGLES,a=null,r=f,e++),a!==m&&(a=m,m._batchEnabled!==e&&(r===f&&(e++,r=0,n.size>0&&(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=Zs.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)}gt._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;l<e.length/2;l++)a[h++]=e[l*2],a[h++]=e[l*2+1],a[h++]=t[l*2],a[h++]=t[l*2+1],o[h++]=i[l],a[h++]=n[l];this._buffer.update(r),this._indexBuffer.update(this.indicesUint16)}processFill(e){e.holes.length?qb.triangulate(e,this):of[e.type].triangulate(e,this)}processLine(e){Sv(e,this);for(let t=0;t<e.holes.length;t++)Sv(e.holes[t],this)}processHoles(e){for(let t=0;t<e.length;t++){const i=e[t];of[i.type].build(i),i.matrix&&this.transformPoints(i.points,i.matrix)}}calculateBounds(){const e=this._bounds;e.clear(),e.addVertexData(this.points,0,this.points.length),e.pad(this.boundsPadding,this.boundsPadding)}transformPoints(e,t){for(let i=0;i<e.length/2;i++){const n=e[i*2],r=e[i*2+1];e[i*2]=t.a*n+t.c*r+t.tx,e[i*2+1]=t.b*n+t.d*r+t.ty}}addColors(e,t,i,n,r=0){const a=Wt.shared.setValue(t).toLittleEndianNumber(),o=Wt.shared.setValue(a).toPremultiplied(i);e.length=Math.max(e.length,r+n);for(let h=0;h<n;h++)e[r+h]=o}addTextureIds(e,t,i,n=0){e.length=Math.max(e.length,n+i);for(let r=0;r<i;r++)e[n+r]=t}addUvs(e,t,i,n,r,a=null){let o=0;const h=t.length,l=i.frame;for(;o<r;){let u=e[(n+o)*2],d=e[(n+o)*2+1];if(a){const f=a.a*u+a.c*d+a.tx;d=a.b*u+a.d*d+a.ty,u=f}o++,t.push(u/l.width,d/l.height)}const c=i.baseTexture;(l.width<c.width||l.height<c.height)&&this.adjustUvs(t,i,h,r)}adjustUvs(e,t,i,n){const r=t.baseTexture,a=1e-6,o=i+n*2,h=t.frame,l=h.width/r.width,c=h.height/r.height;let u=h.x/h.width,d=h.y/h.height,f=Math.floor(e[i]+a),p=Math.floor(e[i+1]+a);for(let m=i+2;m<o;m+=2)f=Math.min(f,Math.floor(e[m]+a)),p=Math.min(p,Math.floor(e[m+1]+a));u-=f,d-=p;for(let m=i;m<o;m+=2)e[m]=(e[m]+u)*l,e[m+1]=(e[m+1]+d)*c}};Kb.BATCHABLE_SIZE=100;let KC=Kb;class Mu{constructor(){this.color=16777215,this.alpha=1,this.texture=mt.WHITE,this.matrix=null,this.visible=!1,this.reset()}clone(){const e=new Mu;return e.color=this.color,e.alpha=this.alpha,e.texture=this.texture,e.matrix=this.matrix,e.visible=this.visible,e}reset(){this.color=16777215,this.alpha=1,this.texture=mt.WHITE,this.matrix=null,this.visible=!1}destroy(){this.texture=null,this.matrix=null}}class Sp extends Mu{constructor(){super(...arguments),this.width=0,this.alignment=.5,this.native=!1,this.cap=Lr.BUTT,this.join=Is.MITER,this.miterLimit=10}clone(){const e=new Sp;return e.color=this.color,e.alpha=this.alpha,e.texture=this.texture,e.matrix=this.matrix,e.visible=this.visible,e.width=this.width,e.alignment=this.alignment,e.native=this.native,e.cap=this.cap,e.join=this.join,e.miterLimit=this.miterLimit,e}reset(){super.reset(),this.color=0,this.alignment=.5,this.width=0,this.native=!1,this.cap=Lr.BUTT,this.join=Is.MITER,this.miterLimit=10}}const lf={},vm=class Wc extends ji{constructor(e=null){super(),this.shader=null,this.pluginName="batch",this.currentPath=null,this.batches=[],this.batchTint=-1,this.batchDirty=-1,this.vertexData=null,this._fillStyle=new Mu,this._lineStyle=new Sp,this._matrix=null,this._holeMode=!1,this.state=Ln.for2d(),this._geometry=e||new KC,this._geometry.refCount++,this._transformID=-1,this._tintColor=new Wt(16777215),this.blendMode=ut.NORMAL}get geometry(){return this._geometry}clone(){return this.finishPoly(),new Wc(this._geometry)}set blendMode(e){this.state.blendMode=e}get blendMode(){return this.state.blendMode}get tint(){return this._tintColor.value}set tint(e){this._tintColor.setValue(e)}get fill(){return this._fillStyle}get line(){return this._lineStyle}lineStyle(e=null,t=0,i,n=.5,r=!1){return typeof e=="number"&&(e={width:e,color:t,alpha:i,alignment:n,native:r}),this.lineTextureStyle(e)}lineTextureStyle(e){const t={width:0,texture:mt.WHITE,color:e!=null&&e.texture?16777215:0,matrix:null,alignment:.5,native:!1,cap:Lr.BUTT,join:Is.MITER,miterLimit:10};e=Object.assign(t,e),this.normalizeColor(e),this.currentPath&&this.startPoly();const i=e.width>0&&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 Ea,this.currentPath.closeStroke=!1,this.currentPath.points.push(e[t-2],e[t-1]))}else this.currentPath=new Ea,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),wp.curveTo(e,t,i,n,r),this}bezierCurveTo(e,t,i,n,r,a){return this._initCurve(),bp.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=bv.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);u<l&&d<l||c.push(o,h)}else this.moveTo(o,h),c=this.currentPath.points;return bv.arc(o,h,e,t,i,n,r,a,c),this}beginFill(e=0,t){return this.beginTextureFill({texture:mt.WHITE,color:e,alpha:t})}normalizeColor(e){const t=Wt.shared.setValue(e.color??0);e.color=t.toNumber(),e.alpha??(e.alpha=t.alpha)}beginTextureFill(e){const t={texture:mt.WHITE,color:16777215,matrix:null};e=Object.assign(t,e),this.normalizeColor(e),this.currentPath&&this.startPoly();const i=e.alpha>0;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 Ea(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;n<i;n++){const r=e.batches[n],a=r.style.color,o=new Float32Array(this.vertexData.buffer,r.attribStart*4*2,r.attribSize*2),h=new Float32Array(e.uvsFloat32.buffer,r.attribStart*4*2,r.attribSize*2),l=new Uint16Array(e.indicesUint16.buffer,r.start*2,r.size),c={vertexData:o,blendMode:t,indices:l,uvs:h,_batchRGB:Wt.shared.setValue(a).toRgbArray(),_tintRGB:a,_texture:r.style.texture,alpha:r.style.alpha,worldAlpha:1};this.batches[n]=c}}_renderBatched(e){if(this.batches.length){e.batch.setObjectRenderer(e.plugins[this.pluginName]),this.calculateVertices(),this.calculateTints();for(let t=0,i=this.batches.length;t<i;t++){const n=this.batches[t];n.worldAlpha=this.worldAlpha*n.alpha,e.plugins[this.pluginName].render(n)}}}_renderDirect(e){const t=this._resolveDirectShader(e),i=this._geometry,n=this.worldAlpha,r=t.uniforms,a=i.drawCalls;r.translationMatrix=this.transform.worldTransform,Wt.shared.setValue(this._tintColor).premultiply(n).toArray(r.tint),e.shader.bind(t),e.geometry.bind(i,t),e.state.set(this.state);for(let o=0,h=a.length;o<h;o++)this._renderDrawCallDirect(e,i.drawCalls[o])}_renderDrawCallDirect(e,t){const{texArray:i,type:n,size:r,start:a}=t,o=i.count;for(let h=0;h<o;h++)e.texture.bind(i.elements[h],h);e.geometry.draw(n,r,a)}_resolveDirectShader(e){let t=this.shader;const i=this.pluginName;if(!t){if(!lf[i]){const{maxTextures:n}=e.plugins[i],r=new Int32Array(n);for(let h=0;h<n;h++)r[h]=h;const a={tint:new Float32Array([1,1,1,1]),translationMatrix:new li,default:Qs.from({uSamplers:r},!0)},o=e.plugins[i]._shader.program;lf[i]=new en(o,a)}t=lf[i]}return t}_calculateBounds(){this.finishPoly();const e=this._geometry;if(!e.graphicsData.length)return;const{minX:t,minY:i,maxX:n,maxY:r}=e.bounds;this._bounds.addFrame(this.transform,t,i,n,r)}containsPoint(e){return this.worldTransform.applyInverse(e,Wc._TEMP_POINT),this._geometry.containsPoint(Wc._TEMP_POINT)}calculateTints(){if(this.batchTint!==this.tint){this.batchTint=this._tintColor.toNumber();for(let e=0;e<this.batches.length;e++){const t=this.batches[e];t._tintRGB=Wt.shared.setValue(this._tintColor).multiply(t._batchRGB).toLittleEndianNumber()}}}calculateVertices(){const e=this.transform._worldID;if(this._transformID===e)return;this._transformID=e;const t=this.transform.worldTransform,i=t.a,n=t.b,r=t.c,a=t.d,o=t.tx,h=t.ty,l=this._geometry.points,c=this.vertexData;let u=0;for(let d=0;d<l.length;d+=2){const f=l[d],p=l[d+1];c[u++]=i*f+r*p+o,c[u++]=a*p+n*f+h}}closePath(){const e=this.currentPath;return e&&(e.closeStroke=!0,this.finishPoly()),this}setMatrix(e){return this._matrix=e,this}beginHole(){return this.finishPoly(),this._holeMode=!0,this}endHole(){return this.finishPoly(),this._holeMode=!1,this}destroy(e){this._geometry.refCount--,this._geometry.refCount===0&&this._geometry.dispose(),this._matrix=null,this.currentPath=null,this._lineStyle.destroy(),this._lineStyle=null,this._fillStyle.destroy(),this._fillStyle=null,this._geometry=null,this.shader=null,this.vertexData=null,this.batches.length=0,this.batches=null,super.destroy(e)}};vm.curves=Co,vm._TEMP_POINT=new Xt;let ms=vm;class ZC{constructor(e,t){this.uvBuffer=e,this.uvMatrix=t,this.data=null,this._bufferUpdateId=-1,this._textureUpdateId=-1,this._updateID=0}update(e){if(!e&&this._bufferUpdateId===this.uvBuffer._updateID&&this._textureUpdateId===this.uvMatrix._updateID)return;this._bufferUpdateId=this.uvBuffer._updateID,this._textureUpdateId=this.uvMatrix._updateID;const t=this.uvBuffer.data;(!this.data||this.data.length!==t.length)&&(this.data=new Float32Array(t.length)),this.uvMatrix.multiplyUvs(t,this.data),this._updateID++}}const cf=new Xt,Mv=new Ea,Jb=class Qb extends ji{constructor(e,t,i,n=Cn.TRIANGLES){super(),this.geometry=e,this.shader=t,this.state=i||Ln.for2d(),this.drawMode=n,this.start=0,this.size=0,this.uvs=null,this.indices=null,this.vertexData=new Float32Array(1),this.vertexDirty=-1,this._transformID=-1,this._roundPixels=We.ROUND_PIXELS,this.batchUvs=null}get geometry(){return this._geometry}set geometry(e){this._geometry!==e&&(this._geometry&&(this._geometry.refCount--,this._geometry.refCount===0&&this._geometry.dispose()),this._geometry=e,this._geometry&&this._geometry.refCount++,this.vertexDirty=-1)}get uvBuffer(){return this.geometry.buffers[1]}get verticesBuffer(){return this.geometry.buffers[0]}set material(e){this.shader=e}get material(){return this.shader}set blendMode(e){this.state.blendMode=e}get blendMode(){return this.state.blendMode}set roundPixels(e){this._roundPixels!==e&&(this._transformID=-1),this._roundPixels=e}get roundPixels(){return this._roundPixels}get tint(){return"tint"in this.shader?this.shader.tint:null}set tint(e){this.shader.tint=e}get tintValue(){return this.shader.tintValue}get texture(){return"texture"in this.shader?this.shader.texture:null}set texture(e){this.shader.texture=e}_render(e){const t=this.geometry.buffers[0].data;this.shader.batchable&&this.drawMode===Cn.TRIANGLES&&t.length<Qb.BATCHABLE_SIZE*2?this._renderToBatch(e):this._renderDefault(e)}_renderDefault(e){const t=this.shader;t.alpha=this.worldAlpha,t.update&&t.update(),e.batch.flush(),t.uniforms.translationMatrix=this.transform.worldTransform.toArray(!0),e.shader.bind(t),e.state.set(this.state),e.geometry.bind(this.geometry,t),e.geometry.draw(this.drawMode,this.size,this.start,this.geometry.instanceCount)}_renderToBatch(e){const t=this.geometry,i=this.shader;i.uvMatrix&&(i.uvMatrix.update(),this.calculateUvs()),this.calculateVertices(),this.indices=t.indexBuffer.data,this._tintRGB=i._tintRGB,this._texture=i.texture;const n=this.material.pluginName;e.batch.setObjectRenderer(e.plugins[n]),e.plugins[n].render(this)}calculateVertices(){const e=this.geometry.buffers[0],t=e.data,i=e._updateID;if(i===this.vertexDirty&&this._transformID===this.transform._worldID)return;this._transformID=this.transform._worldID,this.vertexData.length!==t.length&&(this.vertexData=new Float32Array(t.length));const n=this.transform.worldTransform,r=n.a,a=n.b,o=n.c,h=n.d,l=n.tx,c=n.ty,u=this.vertexData;for(let d=0;d<u.length/2;d++){const f=t[d*2],p=t[d*2+1];u[d*2]=r*f+o*p+l,u[d*2+1]=a*f+h*p+c}if(this._roundPixels){const d=We.RESOLUTION;for(let f=0;f<u.length;++f)u[f]=Math.round(u[f]*d)/d}this.vertexDirty=i}calculateUvs(){const e=this.geometry.buffers[1],t=this.shader;t.uvMatrix.isSimple?this.uvs=e.data:(this.batchUvs||(this.batchUvs=new ZC(e,t.uvMatrix)),this.batchUvs.update(),this.uvs=this.batchUvs.data)}_calculateBounds(){this.calculateVertices(),this._bounds.addVertexData(this.vertexData,0,this.vertexData.length)}containsPoint(e){if(!this.getBounds().contains(e.x,e.y))return!1;this.worldTransform.applyInverse(e,cf);const t=this.geometry.getBuffer("aVertexPosition").data,i=Mv.points,n=this.geometry.getIndex().data,r=n.length,a=this.drawMode===4?3:1;for(let o=0;o+2<r;o+=a){const h=n[o]*2,l=n[o+1]*2,c=n[o+2]*2;if(i[0]=t[h],i[1]=t[h+1],i[2]=t[l],i[3]=t[l+1],i[4]=t[c],i[5]=t[c+1],Mv.contains(cf.x,cf.y))return!0}return!1}destroy(e){super.destroy(e),this._cachedTexture&&(this._cachedTexture.destroy(),this._cachedTexture=null),this.geometry=null,this.shader=null,this.state=null,this.uvs=null,this.indices=null,this.vertexData=null}};Jb.BATCHABLE_SIZE=100;let Dl=Jb;class _p extends Bn{constructor(e,t,i){super();const n=new oi(e),r=new oi(t,!0),a=new oi(i,!0,!0);this.addAttribute("aVertexPosition",n,2,!1,et.FLOAT).addAttribute("aTextureCoord",r,2,!1,et.FLOAT).addIndex(a),this._updateId=-1}get vertexDirtyId(){return this.buffers[0]._updateID}}var JC=`varying vec2 vTextureCoord;
|
||
uniform vec4 uColor;
|
||
|
||
uniform sampler2D uSampler;
|
||
|
||
void main(void)
|
||
{
|
||
gl_FragColor = texture2D(uSampler, vTextureCoord) * uColor;
|
||
}
|
||
`,QC=`attribute vec2 aVertexPosition;
|
||
attribute vec2 aTextureCoord;
|
||
|
||
uniform mat3 projectionMatrix;
|
||
uniform mat3 translationMatrix;
|
||
uniform mat3 uTextureMatrix;
|
||
|
||
varying vec2 vTextureCoord;
|
||
|
||
void main(void)
|
||
{
|
||
gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
|
||
|
||
vTextureCoord = (uTextureMatrix * vec3(aTextureCoord, 1.0)).xy;
|
||
}
|
||
`;class Ch extends en{constructor(e,t){const i={uSampler:e,alpha:1,uTextureMatrix:li.IDENTITY,uColor:new Float32Array([1,1,1,1])};t=Object.assign({tint:16777215,alpha:1,pluginName:"batch"},t),t.uniforms&&Object.assign(i,t.uniforms),super(t.program||In.from(QC,JC),i),this._colorDirty=!1,this.uvMatrix=new vp(e),this.batchable=t.program===void 0,this.pluginName=t.pluginName,this._tintColor=new Wt(t.tint),this._tintRGB=this._tintColor.toLittleEndianNumber(),this._colorDirty=!0,this.alpha=t.alpha}get texture(){return this.uniforms.uSampler}set texture(e){this.uniforms.uSampler!==e&&(!this.uniforms.uSampler.baseTexture.alphaMode!=!e.baseTexture.alphaMode&&(this._colorDirty=!0),this.uniforms.uSampler=e,this.uvMatrix.texture=e)}set alpha(e){e!==this._alpha&&(this._alpha=e,this._colorDirty=!0)}get alpha(){return this._alpha}set tint(e){e!==this.tint&&(this._tintColor.setValue(e),this._tintRGB=this._tintColor.toLittleEndianNumber(),this._colorDirty=!0)}get tint(){return this._tintColor.value}get tintValue(){return this._tintColor.toNumber()}update(){if(this._colorDirty){this._colorDirty=!1;const e=this.texture.baseTexture.alphaMode;Wt.shared.setValue(this._tintColor).premultiply(this._alpha,e).toArray(this.uniforms.uColor)}this.uvMatrix.update()&&(this.uniforms.uTextureMatrix=this.uvMatrix.mapCoord)}}class eI extends Dl{constructor(e=mt.EMPTY,t,i,n,r){const a=new _p(t,i,n);a.getBuffer("aVertexPosition").static=!1;const o=new Ch(e);super(a,o,null,r),this.autoUpdate=!0}get vertices(){return this.geometry.getBuffer("aVertexPosition").data}set vertices(e){this.geometry.getBuffer("aVertexPosition").data=e}_render(e){this.autoUpdate&&this.geometry.getBuffer("aVertexPosition").update(),super._render(e)}}class Tv{constructor(e,t,i){this.geometry=new Bn,this.indexBuffer=null,this.size=i,this.dynamicProperties=[],this.staticProperties=[];for(let n=0;n<e.length;++n){let r=e[n];r={attributeName:r.attributeName,size:r.size,uploadFunction:r.uploadFunction,type:r.type||et.FLOAT,offset:r.offset},t[n]?this.dynamicProperties.push(r):this.staticProperties.push(r)}this.staticStride=0,this.staticBuffer=null,this.staticData=null,this.staticDataUint32=null,this.dynamicStride=0,this.dynamicBuffer=null,this.dynamicData=null,this.dynamicDataUint32=null,this._updateID=0,this.initBuffers()}initBuffers(){const e=this.geometry;let t=0;this.indexBuffer=new oi(S2(this.size),!0,!0),e.addIndex(this.indexBuffer),this.dynamicStride=0;for(let a=0;a<this.dynamicProperties.length;++a){const o=this.dynamicProperties[a];o.offset=t,t+=o.size,this.dynamicStride+=o.size}const i=new ArrayBuffer(this.size*this.dynamicStride*4*4);this.dynamicData=new Float32Array(i),this.dynamicDataUint32=new Uint32Array(i),this.dynamicBuffer=new oi(this.dynamicData,!1,!1);let n=0;this.staticStride=0;for(let a=0;a<this.staticProperties.length;++a){const o=this.staticProperties[a];o.offset=n,n+=o.size,this.staticStride+=o.size}const r=new ArrayBuffer(this.size*this.staticStride*4*4);this.staticData=new Float32Array(r),this.staticDataUint32=new Uint32Array(r),this.staticBuffer=new oi(this.staticData,!0,!1);for(let a=0;a<this.dynamicProperties.length;++a){const o=this.dynamicProperties[a];e.addAttribute(o.attributeName,this.dynamicBuffer,0,o.type===et.UNSIGNED_BYTE,o.type,this.dynamicStride*4,o.offset*4)}for(let a=0;a<this.staticProperties.length;++a){const o=this.staticProperties[a];e.addAttribute(o.attributeName,this.staticBuffer,0,o.type===et.UNSIGNED_BYTE,o.type,this.staticStride*4,o.offset*4)}}uploadDynamic(e,t,i){for(let n=0;n<this.dynamicProperties.length;n++){const r=this.dynamicProperties[n];r.uploadFunction(e,t,i,r.type===et.UNSIGNED_BYTE?this.dynamicDataUint32:this.dynamicData,this.dynamicStride,r.offset)}this.dynamicBuffer._updateID++}uploadStatic(e,t,i){for(let n=0;n<this.staticProperties.length;n++){const r=this.staticProperties[n];r.uploadFunction(e,t,i,r.type===et.UNSIGNED_BYTE?this.staticDataUint32:this.staticData,this.staticStride,r.offset)}this.staticBuffer._updateID++}destroy(){this.indexBuffer=null,this.dynamicProperties=null,this.dynamicBuffer=null,this.dynamicData=null,this.dynamicDataUint32=null,this.staticProperties=null,this.staticBuffer=null,this.staticData=null,this.staticDataUint32=null,this.geometry.destroy()}}var tI=`varying vec2 vTextureCoord;
|
||
varying vec4 vColor;
|
||
|
||
uniform sampler2D uSampler;
|
||
|
||
void main(void){
|
||
vec4 color = texture2D(uSampler, vTextureCoord) * vColor;
|
||
gl_FragColor = color;
|
||
}`,iI=`attribute vec2 aVertexPosition;
|
||
attribute vec2 aTextureCoord;
|
||
attribute vec4 aColor;
|
||
|
||
attribute vec2 aPositionCoord;
|
||
attribute float aRotation;
|
||
|
||
uniform mat3 translationMatrix;
|
||
uniform vec4 uColor;
|
||
|
||
varying vec2 vTextureCoord;
|
||
varying vec4 vColor;
|
||
|
||
void main(void){
|
||
float x = (aVertexPosition.x) * cos(aRotation) - (aVertexPosition.y) * sin(aRotation);
|
||
float y = (aVertexPosition.x) * sin(aRotation) + (aVertexPosition.y) * cos(aRotation);
|
||
|
||
vec2 v = vec2(x, y);
|
||
v = v + aPositionCoord;
|
||
|
||
gl_Position = vec4((translationMatrix * vec3(v, 1.0)).xy, 0.0, 1.0);
|
||
|
||
vTextureCoord = aTextureCoord;
|
||
vColor = aColor * uColor;
|
||
}
|
||
`;class e1 extends Su{constructor(e){super(e),this.shader=null,this.properties=null,this.tempMatrix=new li,this.properties=[{attributeName:"aVertexPosition",size:2,uploadFunction:this.uploadVertices,offset:0},{attributeName:"aPositionCoord",size:2,uploadFunction:this.uploadPosition,offset:0},{attributeName:"aRotation",size:1,uploadFunction:this.uploadRotation,offset:0},{attributeName:"aTextureCoord",size:2,uploadFunction:this.uploadUvs,offset:0},{attributeName:"aColor",size:1,type:et.UNSIGNED_BYTE,uploadFunction:this.uploadTint,offset:0}],this.shader=en.from(iI,tI,{}),this.state=Ln.for2d()}render(e){const t=e.children,i=e._maxSize,n=e._batchSize,r=this.renderer;let a=t.length;if(a===0)return;a>i&&!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=Jx(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=Wt.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;f<a;f+=n,p+=1){let m=a-f;m>n&&(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._updateID<v,d&&(g._updateID=e._updateID,g.uploadStatic(t,f,m)),r.geometry.bind(g.geometry),c.drawElements(c.TRIANGLES,m*6,c.UNSIGNED_SHORT,0)}}generateBuffers(e){const t=[],i=e._maxSize,n=e._batchSize,r=e._properties;for(let a=0;a<i;a+=n)t.push(new Tv(this.properties,r,n));return t}_generateOneMoreBuffer(e){const t=e._batchSize,i=e._properties;return new Tv(this.properties,i,t)}uploadVertices(e,t,i,n,r,a){let o=0,h=0,l=0,c=0;for(let u=0;u<i;++u){const d=e[t+u],f=d._texture,p=d.scale.x,m=d.scale.y,g=f.trim,v=f.orig;g?(h=g.x-d.anchor.x*v.width,o=h+g.width,c=g.y-d.anchor.y*v.height,l=c+g.height):(o=v.width*(1-d.anchor.x),h=v.width*-d.anchor.x,l=v.height*(1-d.anchor.y),c=v.height*-d.anchor.y),n[a]=h*p,n[a+1]=c*m,n[a+r]=o*p,n[a+r+1]=c*m,n[a+r*2]=o*p,n[a+r*2+1]=l*m,n[a+r*3]=h*p,n[a+r*3+1]=l*m,a+=r*4}}uploadPosition(e,t,i,n,r,a){for(let o=0;o<i;o++){const h=e[t+o].position;n[a]=h.x,n[a+1]=h.y,n[a+r]=h.x,n[a+r+1]=h.y,n[a+r*2]=h.x,n[a+r*2+1]=h.y,n[a+r*3]=h.x,n[a+r*3+1]=h.y,a+=r*4}}uploadRotation(e,t,i,n,r,a){for(let o=0;o<i;o++){const h=e[t+o].rotation;n[a]=h,n[a+r]=h,n[a+r*2]=h,n[a+r*3]=h,a+=r*4}}uploadUvs(e,t,i,n,r,a){for(let o=0;o<i;++o){const h=e[t+o]._texture._uvs;h?(n[a]=h.x0,n[a+1]=h.y0,n[a+r]=h.x1,n[a+r+1]=h.y1,n[a+r*2]=h.x2,n[a+r*2+1]=h.y2,n[a+r*3]=h.x3,n[a+r*3+1]=h.y3,a+=r*4):(n[a]=0,n[a+1]=0,n[a+r]=0,n[a+r+1]=0,n[a+r*2]=0,n[a+r*2+1]=0,n[a+r*3]=0,n[a+r*3+1]=0,a+=r*4)}}uploadTint(e,t,i,n,r,a){for(let o=0;o<i;++o){const h=e[t+o],l=Wt.shared.setValue(h._tintRGB).toPremultiplied(h.alpha,h.texture.baseTexture.alphaMode>0);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}}e1.extension={name:"particle",type:He.RendererPlugin};tt.add(e1);var Tu=(s=>(s[s.LINEAR_VERTICAL=0]="LINEAR_VERTICAL",s[s.LINEAR_HORIZONTAL=1]="LINEAR_HORIZONTAL",s))(Tu||{});const _c={willReadFrequently:!0},mn=class at{static get experimentalLetterSpacingSupported(){let e=at._experimentalLetterSpacingSupported;if(e!==void 0){const t=We.ADAPTER.getCanvasRenderingContext2D().prototype;e=at._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=at._canvas){i=i??t.wordWrap;const r=t.toFontString(),a=at.measureFont(r);a.fontSize===0&&(a.fontSize=t.fontSize,a.ascent=t.fontSize);const o=n.getContext("2d",_c);o.font=r;const h=(i?at.wordWrap(e,t,n):e).split(/(?:\r\n|\r|\n)/),l=new Array(h.length);let c=0;for(let p=0;p<h.length;p++){const m=at._measureText(h[p],t.letterSpacing,o);l[p]=m,c=Math.max(c,m)}let u=c+t.strokeThickness;t.dropShadow&&(u+=t.dropShadowDistance);const d=t.lineHeight||a.fontSize+t.strokeThickness;let f=Math.max(d,a.fontSize+t.strokeThickness*2)+t.leading+(h.length-1)*(d+t.leading);return t.dropShadow&&(f+=t.dropShadowDistance),new at(e,t,u,f,h,l,d+t.leading,c,a)}static _measureText(e,t,i){let n=!1;at.experimentalLetterSpacingSupported&&(at.experimentalLetterSpacing?(i.letterSpacing=`${t}px`,i.textLetterSpacing=`${t}px`,n=!0):(i.letterSpacing="0px",i.textLetterSpacing="0px"));let r=i.measureText(e).width;return r>0&&(n?r-=t:r+=(at.graphemeSegmenter(e).length-1)*t),r}static wordWrap(e,t,i=at._canvas){const n=i.getContext("2d",_c);let r=0,a="",o="";const h=Object.create(null),{letterSpacing:l,whiteSpace:c}=t,u=at.collapseSpaces(c),d=at.collapseNewlines(c);let f=!u;const p=t.wordWrapWidth+l,m=at.tokenize(e);for(let g=0;g<m.length;g++){let v=m[g];if(at.isNewline(v)){if(!d){o+=at.addLine(a),f=!u,a="",r=0;continue}v=" "}if(u){const y=at.isBreakingSpace(v),w=at.isBreakingSpace(a[a.length-1]);if(y&&w)continue}const b=at.getFromCache(v,l,h,n);if(b>p)if(a!==""&&(o+=at.addLine(a),a="",r=0),at.canBreakWords(v,t.breakWords)){const y=at.wordWrapSplit(v);for(let w=0;w<y.length;w++){let A=y[w],T=A,M=1;for(;y[w+M];){const P=y[w+M];if(!at.canBreakChars(T,P,v,w,t.breakWords))A+=P;else break;T=P,M++}w+=M-1;const R=at.getFromCache(A,l,h,n);R+r>p&&(o+=at.addLine(a),f=!1,a="",r=0),a+=A,r+=R}}else{a.length>0&&(o+=at.addLine(a),a="",r=0);const y=g===m.length-1;o+=at.addLine(v,!y),f=!1,a="",r=0}else b+r>p&&(f=!1,o+=at.addLine(a),a="",r=0),(a.length>0||!at.isBreakingSpace(v)||f)&&(a+=v,r+=b)}return o+=at.addLine(a,!1),o}static addLine(e,t=!0){return e=at.trimRight(e),e=t?`${e}
|
||
`:e,e}static getFromCache(e,t,i,n){let r=i[e];return typeof r!="number"&&(r=at._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(!at.isBreakingSpace(i))break;e=e.slice(0,-1)}return e}static isNewline(e){return typeof e!="string"?!1:at._newlines.includes(e.charCodeAt(0))}static isBreakingSpace(e,t){return typeof e!="string"?!1:at._breakingSpaces.includes(e.charCodeAt(0))}static tokenize(e){const t=[];let i="";if(typeof e!="string")return t;for(let n=0;n<e.length;n++){const r=e[n],a=e[n+1];if(at.isBreakingSpace(r,a)||at.isNewline(r)){i!==""&&(t.push(i),i=""),t.push(r);continue}i+=r}return i!==""&&t.push(i),t}static canBreakWords(e,t){return t}static canBreakChars(e,t,i,n,r){return!0}static wordWrapSplit(e){return at.graphemeSegmenter(e)}static measureFont(e){if(at._fonts[e])return at._fonts[e];const t={ascent:0,descent:0,fontSize:0},i=at._canvas,n=at._context;n.font=e;const r=at.METRICS_STRING+at.BASELINE_SYMBOL,a=Math.ceil(n.measureText(r).width);let o=Math.ceil(n.measureText(at.BASELINE_SYMBOL).width);const h=Math.ceil(at.HEIGHT_MULTIPLIER*o);if(o=o*at.BASELINE_MULTIPLIER|0,a===0||h===0)return at._fonts[e]=t,t;i.width=a,i.height=h,n.fillStyle="#f00",n.fillRect(0,0,a,h),n.font=e,n.textBaseline="alphabetic",n.fillStyle="#000",n.fillText(r,0,o);const l=n.getImageData(0,0,a,h).data,c=l.length,u=a*4;let d=0,f=0,p=!1;for(d=0;d<o;++d){for(let m=0;m<u;m+=4)if(l[f+m]!==255){p=!0;break}if(!p)f+=u;else break}for(t.ascent=o-d,f=c-u,p=!1,d=h;d>o;--d){for(let m=0;m<u;m+=4)if(l[f+m]!==255){p=!0;break}if(!p)f-=u;else break}return t.descent=d-o,t.fontSize=t.ascent+t.descent,at._fonts[e]=t,t}static clearMetrics(e=""){e?delete at._fonts[e]:at._fonts={}}static get _canvas(){var e;if(!at.__canvas){let t;try{const i=new OffscreenCanvas(0,0);if((e=i.getContext("2d",_c))!=null&&e.measureText)return at.__canvas=i,i;t=We.ADAPTER.createCanvas()}catch{t=We.ADAPTER.createCanvas()}t.width=t.height=10,at.__canvas=t}return at.__canvas}static get _context(){return at.__context||(at.__context=at._canvas.getContext("2d",_c)),at.__context}};mn.METRICS_STRING="|ÉqÅ",mn.BASELINE_SYMBOL="M",mn.BASELINE_MULTIPLIER=1.4,mn.HEIGHT_MULTIPLIER=2,mn.graphemeSegmenter=(()=>{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]})(),mn.experimentalLetterSpacing=!1,mn._fonts={},mn._newlines=[10,13],mn._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288];let Ar=mn;const sI=["serif","sans-serif","monospace","cursive","fantasy","system-ui"],t1=class ll{constructor(e){this.styleID=0,this.reset(),uf(this,e,e)}clone(){const e={};return uf(e,this,ll.defaultStyle),new ll(e)}reset(){uf(this,ll.defaultStyle,ll.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){nI(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)&&!sI.includes(n)&&(n=`"${n}"`),t[i]=n}return`${this.fontStyle} ${this.fontVariant} ${this.fontWeight} ${e} ${t.join(",")}`}};t1.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 $r=t1;function hf(s){const e=Wt.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 nI(s,e){if(!Array.isArray(s)||!Array.isArray(e)||s.length!==e.length)return!1;for(let t=0;t<s.length;++t)if(s[t]!==e[t])return!1;return!0}function uf(s,e,t){for(const i in t)Array.isArray(e[i])?s[i]=e[i].slice():s[i]=e[i]}const rI={texture:!0,children:!1,baseTexture:!0},i1=class ym extends Wr{constructor(e,t,i){let n=!1;i||(i=We.ADAPTER.createCanvas(),n=!0),i.width=3,i.height=3;const r=mt.from(i);r.orig=new Tt,r.trim=new Tt,super(r),this._ownCanvas=n,this.canvas=i,this.context=i.getContext("2d",{willReadFrequently:!0}),this._resolution=ym.defaultResolution??We.RESOLUTION,this._autoResolution=ym.defaultAutoResolution,this._text=null,this._style=null,this._styleListener=null,this._font="",this.text=e,this.style=t,this.localStyleID=-1}static get experimentalLetterSpacing(){return Ar.experimentalLetterSpacing}static set experimentalLetterSpacing(e){kt("7.1.0","Text.experimentalLetterSpacing is deprecated, use TextMetrics.experimentalLetterSpacing"),Ar.experimentalLetterSpacing=e}updateText(e){const t=this._style;if(this.localStyleID!==t.styleID&&(this.dirty=!0,this.localStyleID=t.styleID),!this.dirty&&e)return;this._font=this._style.toFontString();const i=this.context,n=Ar.measureText(this._text||" ",this._style,this._style.wordWrap,this.canvas),r=n.width,a=n.height,o=n.lines,h=n.lineHeight,l=n.lineWidths,c=n.maxLineWidth,u=n.fontProperties;this.canvas.width=Math.ceil(Math.ceil(Math.max(1,r)+t.padding*2)*this._resolution),this.canvas.height=Math.ceil(Math.ceil(Math.max(1,a)+t.padding*2)*this._resolution),i.scale(this._resolution,this._resolution),i.clearRect(0,0,this.canvas.width,this.canvas.height),i.font=this._font,i.lineWidth=t.strokeThickness,i.textBaseline=t.textBaseline,i.lineJoin=t.lineJoin,i.miterLimit=t.miterLimit;let d,f;const p=t.dropShadow?2:1;for(let m=0;m<p;++m){const g=t.dropShadow&&m===0,v=g?Math.ceil(Math.max(1,a)+t.padding*2):0,b=v*this._resolution;if(g){i.fillStyle="black",i.strokeStyle="black";const w=t.dropShadowColor,A=t.dropShadowBlur*this._resolution,T=t.dropShadowDistance*this._resolution;i.shadowColor=Wt.shared.setValue(w).setAlpha(t.dropShadowAlpha).toRgbaString(),i.shadowBlur=A,i.shadowOffsetX=Math.cos(t.dropShadowAngle)*T,i.shadowOffsetY=Math.sin(t.dropShadowAngle)*T+b}else i.fillStyle=this._generateFillStyle(t,o,n),i.strokeStyle=t.stroke,i.shadowColor="black",i.shadowBlur=0,i.shadowOffsetX=0,i.shadowOffsetY=0;let y=(h-u.fontSize)/2;h-u.fontSize<0&&(y=0);for(let w=0;w<o.length;w++)d=t.strokeThickness/2,f=t.strokeThickness/2+w*h+u.ascent+y,t.align==="right"?d+=c-l[w]:t.align==="center"&&(d+=(c-l[w])/2),t.stroke&&t.strokeThickness&&this.drawLetterSpacing(o[w],d+t.padding,f+t.padding-v,!0),t.fill&&this.drawLetterSpacing(o[w],d+t.padding,f+t.padding-v)}this.updateTexture()}drawLetterSpacing(e,t,i,n=!1){const r=this._style.letterSpacing;let a=!1;if(Ar.experimentalLetterSpacingSupported&&(Ar.experimentalLetterSpacing?(this.context.letterSpacing=`${r}px`,this.context.textLetterSpacing=`${r}px`,a=!0):(this.context.letterSpacing="0px",this.context.textLetterSpacing="0px")),r===0||a){n?this.context.strokeText(e,t,i):this.context.fillText(e,t,i);return}let o=t;const h=Ar.graphemeSegmenter(e);let l=this.context.measureText(e).width,c=0;for(let u=0;u<h.length;++u){const d=h[u];n?this.context.strokeText(d,o,i):this.context.fillText(d,o,i);let f="";for(let p=u+1;p<h.length;++p)f+=h[p];c=this.context.measureText(f).width,o+=l-c+r,l=c}}updateTexture(){const e=this.canvas;if(this._style.trim){const a=A2(e);a.data&&(e.width=a.width,e.height=a.height,this.context.putImageData(a.data,0,0))}const t=this._texture,i=this._style,n=i.trim?0:i.padding,r=t.baseTexture;t.trim.width=t._frame.width=e.width/this._resolution,t.trim.height=t._frame.height=e.height/this._resolution,t.trim.x=-n,t.trim.y=-n,t.orig.width=t._frame.width-n*2,t.orig.height=t._frame.height-n*2,this._onTextureUpdate(),r.setRealSize(e.width,e.height,this._resolution),t.updateUvs(),this.dirty=!1}_render(e){this._autoResolution&&this._resolution!==e.resolution&&(this._resolution=e.resolution,this.dirty=!0),this.updateText(!0),super._render(e)}updateTransform(){this.updateText(!0),super.updateTransform()}getBounds(e,t){return this.updateText(!0),this._textureID===-1&&(e=!1),super.getBounds(e,t)}getLocalBounds(e){return this.updateText(!0),super.getLocalBounds.call(this,e)}_calculateBounds(){this.calculateVertices(),this._bounds.addQuad(this.vertexData)}_generateFillStyle(e,t,i){const n=e.fill;if(Array.isArray(n)){if(n.length===1)return n[0]}else return n;let r;const a=e.dropShadow?e.dropShadowDistance:0,o=e.padding||0,h=this.canvas.width/this._resolution-a-o*2,l=this.canvas.height/this._resolution-a-o*2,c=n.slice(),u=e.fillGradientStops.slice();if(!u.length){const d=c.length+1;for(let f=1;f<d;++f)u.push(f/d)}if(c.unshift(n[0]),u.unshift(0),c.push(n[n.length-1]),u.push(1),e.fillGradientType===Tu.LINEAR_VERTICAL){r=this.context.createLinearGradient(h/2,o,h/2,l+o);const d=i.fontProperties.fontSize+e.strokeThickness;for(let f=0;f<t.length;f++){const p=i.lineHeight*(f-1)+d,m=i.lineHeight*f;let g=m;f>0&&p>m&&(g=(m+p)/2);const v=m+d,b=i.lineHeight*(f+1);let y=v;f+1<t.length&&b<v&&(y=(v+b)/2);const w=(y-g)/l;for(let A=0;A<c.length;A++){let T=0;typeof u[A]=="number"?T=u[A]:T=A/c.length;let M=Math.min(1,Math.max(0,g/l+T*w));M=Number(M.toFixed(5)),r.addColorStop(M,c[A])}}}else{r=this.context.createLinearGradient(o,l/2,h+o,l/2);const d=c.length+1;let f=1;for(let p=0;p<c.length;p++){let m;typeof u[p]=="number"?m=u[p]:m=f/d,r.addColorStop(m,c[p]),f++}}return r}destroy(e){typeof e=="boolean"&&(e={children:e}),e=Object.assign({},rI,e),super.destroy(e),this._ownCanvas&&(this.canvas.height=this.canvas.width=0),this.context=null,this.canvas=null,this._style=null}get width(){return this.updateText(!0),Math.abs(this.scale.x)*this._texture.orig.width}set width(e){this.updateText(!0);const t=Br(this.scale.x)||1;this.scale.x=t*e/this._texture.orig.width,this._width=e}get height(){return this.updateText(!0),Math.abs(this.scale.y)*this._texture.orig.height}set height(e){this.updateText(!0);const t=Br(this.scale.y)||1;this.scale.y=t*e/this._texture.orig.height,this._height=e}get style(){return this._style}set style(e){e=e||{},e instanceof $r?this._style=e:this._style=new $r(e),this.localStyleID=-1,this.dirty=!0}get text(){return this._text}set text(e){e=String(e??""),this._text!==e&&(this._text=e,this.dirty=!0)}get resolution(){return this._resolution}set resolution(e){this._autoResolution=!1,this._resolution!==e&&(this._resolution=e,this.dirty=!0)}};i1.defaultAutoResolution=!0;let Mp=i1;class aI{constructor(e){this.maxItemsPerFrame=e,this.itemsLeft=0}beginFrame(){this.itemsLeft=this.maxItemsPerFrame}allowedToUpload(){return this.itemsLeft-- >0}}function oI(s,e){var i;let t=!1;if((i=s==null?void 0:s._textures)!=null&&i.length){for(let n=0;n<s._textures.length;n++)if(s._textures[n]instanceof mt){const r=s._textures[n].baseTexture;e.includes(r)||(e.push(r),t=!0)}}return t}function lI(s,e){if(s.baseTexture instanceof gt){const t=s.baseTexture;return e.includes(t)||e.push(t),!0}return!1}function cI(s,e){if(s._texture&&s._texture instanceof mt){const t=s._texture.baseTexture;return e.includes(t)||e.push(t),!0}return!1}function hI(s,e){return e instanceof Mp?(e.updateText(!0),!0):!1}function uI(s,e){if(e instanceof $r){const t=e.toFontString();return Ar.measureFont(t),!0}return!1}function dI(s,e){if(s instanceof Mp){e.includes(s.style)||e.push(s.style),e.includes(s)||e.push(s);const t=s._texture.baseTexture;return e.includes(t)||e.push(t),!0}return!1}function fI(s,e){return s instanceof $r?(e.includes(s)||e.push(s),!0):!1}const s1=class n1{constructor(e){this.limiter=new aI(n1.uploadsPerFrame),this.renderer=e,this.uploadHookHelper=null,this.queue=[],this.addHooks=[],this.uploadHooks=[],this.completes=[],this.ticking=!1,this.delayedTick=()=>{this.queue&&this.prepareItems()},this.registerFindHook(dI),this.registerFindHook(fI),this.registerFindHook(oI),this.registerFindHook(lI),this.registerFindHook(cI),this.registerUploadHook(hI),this.registerUploadHook(uI)}upload(e){return new Promise(t=>{e&&this.add(e),this.queue.length?(this.completes.push(t),this.ticking||(this.ticking=!0,ls.system.addOnce(this.tick,this,Fa.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<n;i++)if(this.uploadHooks[i](this.uploadHookHelper,e)){this.queue.shift(),t=!0;break}}t||this.queue.shift()}if(this.queue.length)ls.system.addOnce(this.tick,this,Fa.UTILITY);else{this.ticking=!1;const e=this.completes.slice(0);this.completes.length=0;for(let t=0,i=e.length;t<i;t++)e[t]()}}registerFindHook(e){return e&&this.addHooks.push(e),this}registerUploadHook(e){return e&&this.uploadHooks.push(e),this}add(e){for(let t=0,i=this.addHooks.length;t<i&&!this.addHooks[t](e,this.queue);t++);if(e instanceof ji)for(let t=e.children.length-1;t>=0;t--)this.add(e.children[t]);return this}destroy(){this.ticking&&ls.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}};s1.uploadsPerFrame=4;let xm=s1;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 r1(s,e){return e instanceof gt?(e._glTextures[s.CONTEXT_UID]||s.texture.bind(e),!0):!1}function mI(s,e){if(!(e instanceof ms))return!1;const{geometry:t}=e;e.finishPoly(),t.updateBatches();const{batches:i}=t;for(let n=0;n<i.length;n++){const{texture:r}=i[n].style;r&&r1(s,r.baseTexture)}return t.batchable||s.geometry.bind(t,e._resolveDirectShader(s)),!0}function pI(s,e){return s instanceof ms?(e.push(s),!0):!1}class a1 extends xm{constructor(e){super(e),this.uploadHookHelper=this.renderer,this.registerFindHook(pI),this.registerUploadHook(r1),this.registerUploadHook(mI)}}a1.extension={name:"prepare",type:He.RendererSystem};tt.add(a1);var gI=`#version 300 es
|
||
#define SHADER_NAME Tiling-Sprite-100
|
||
|
||
precision lowp float;
|
||
|
||
in vec2 vTextureCoord;
|
||
|
||
out vec4 fragmentColor;
|
||
|
||
uniform sampler2D uSampler;
|
||
uniform vec4 uColor;
|
||
uniform mat3 uMapCoord;
|
||
uniform vec4 uClampFrame;
|
||
uniform vec2 uClampOffset;
|
||
|
||
void main(void)
|
||
{
|
||
vec2 coord = vTextureCoord + ceil(uClampOffset - vTextureCoord);
|
||
coord = (uMapCoord * vec3(coord, 1.0)).xy;
|
||
vec2 unclamped = coord;
|
||
coord = clamp(coord, uClampFrame.xy, uClampFrame.zw);
|
||
|
||
vec4 texSample = texture(uSampler, coord, unclamped == coord ? 0.0f : -32.0f);// lod-bias very negative to force lod 0
|
||
|
||
fragmentColor = texSample * uColor;
|
||
}
|
||
`,vI=`#version 300 es
|
||
#define SHADER_NAME Tiling-Sprite-300
|
||
|
||
precision lowp float;
|
||
|
||
in vec2 aVertexPosition;
|
||
in vec2 aTextureCoord;
|
||
|
||
uniform mat3 projectionMatrix;
|
||
uniform mat3 translationMatrix;
|
||
uniform mat3 uTransform;
|
||
|
||
out vec2 vTextureCoord;
|
||
|
||
void main(void)
|
||
{
|
||
gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
|
||
|
||
vTextureCoord = (uTransform * vec3(aTextureCoord, 1.0)).xy;
|
||
}
|
||
`,yI=`#version 100
|
||
#ifdef GL_EXT_shader_texture_lod
|
||
#extension GL_EXT_shader_texture_lod : enable
|
||
#endif
|
||
#define SHADER_NAME Tiling-Sprite-100
|
||
|
||
precision lowp float;
|
||
|
||
varying vec2 vTextureCoord;
|
||
|
||
uniform sampler2D uSampler;
|
||
uniform vec4 uColor;
|
||
uniform mat3 uMapCoord;
|
||
uniform vec4 uClampFrame;
|
||
uniform vec2 uClampOffset;
|
||
|
||
void main(void)
|
||
{
|
||
vec2 coord = vTextureCoord + ceil(uClampOffset - vTextureCoord);
|
||
coord = (uMapCoord * vec3(coord, 1.0)).xy;
|
||
vec2 unclamped = coord;
|
||
coord = clamp(coord, uClampFrame.xy, uClampFrame.zw);
|
||
|
||
#ifdef GL_EXT_shader_texture_lod
|
||
vec4 texSample = unclamped == coord
|
||
? texture2D(uSampler, coord)
|
||
: texture2DLodEXT(uSampler, coord, 0);
|
||
#else
|
||
vec4 texSample = texture2D(uSampler, coord);
|
||
#endif
|
||
|
||
gl_FragColor = texSample * uColor;
|
||
}
|
||
`,Av=`#version 100
|
||
#define SHADER_NAME Tiling-Sprite-100
|
||
|
||
precision lowp float;
|
||
|
||
attribute vec2 aVertexPosition;
|
||
attribute vec2 aTextureCoord;
|
||
|
||
uniform mat3 projectionMatrix;
|
||
uniform mat3 translationMatrix;
|
||
uniform mat3 uTransform;
|
||
|
||
varying vec2 vTextureCoord;
|
||
|
||
void main(void)
|
||
{
|
||
gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
|
||
|
||
vTextureCoord = (uTransform * vec3(aTextureCoord, 1.0)).xy;
|
||
}
|
||
`,xI=`#version 100
|
||
#define SHADER_NAME Tiling-Sprite-Simple-100
|
||
|
||
precision lowp float;
|
||
|
||
varying vec2 vTextureCoord;
|
||
|
||
uniform sampler2D uSampler;
|
||
uniform vec4 uColor;
|
||
|
||
void main(void)
|
||
{
|
||
vec4 texSample = texture2D(uSampler, vTextureCoord);
|
||
gl_FragColor = texSample * uColor;
|
||
}
|
||
`;const Mc=new li;class o1 extends Su{constructor(e){super(e),e.runners.contextChange.add(this),this.quad=new db,this.state=Ln.for2d()}contextChange(){const e=this.renderer,t={globals:e.globalUniforms};this.simpleShader=en.from(Av,xI,t),this.shader=e.context.webGLVersion>1?en.from(vI,gI,t):en.from(Av,yI,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!==Zs.CLAMP:h.wrapMode===Zs.CLAMP&&(h.wrapMode=Zs.REPEAT));const f=d?this.simpleShader:this.shader,p=o.width,m=o.height,g=e._width,v=e._height;Mc.set(c.a*p/g,c.b*p/v,c.c*m/g,c.d*m/v,c.tx/g,c.ty/v),Mc.invert(),d?Mc.prepend(u.mapCoord):(f.uniforms.uMapCoord=u.mapCoord.toArray(!0),f.uniforms.uClampFrame=u.uClampFrame,f.uniforms.uClampOffset=u.uClampOffset),f.uniforms.uTransform=Mc.toArray(!0),f.uniforms.uColor=Wt.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=Jx(e.blendMode,l),t.state.set(this.state),t.geometry.draw(this.renderer.gl.TRIANGLES,6,0)}}o1.extension={name:"tilingSprite",type:He.RendererPlugin};tt.add(o1);const l1=class cl{constructor(e,t,i){this.linkedSheets=[],(e instanceof gt||e instanceof mt)&&(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 mt?n:null,this.baseTexture=n instanceof gt?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=dr(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<=cl.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()})}_processFrames(e){let t=e;const i=cl.BATCH_SIZE;for(;t-e<i&&t<this._frameKeys.length;){const n=this._frameKeys[t],r=this._frames[n],a=r.frame;if(a){let o=null,h=null;const l=r.trimmed!==!1&&r.sourceSize?r.sourceSize:r.frame,c=new Tt(0,0,Math.floor(l.w)/this.resolution,Math.floor(l.h)/this.resolution);r.rotated?o=new Tt(Math.floor(a.x)/this.resolution,Math.floor(a.y)/this.resolution,Math.floor(a.h)/this.resolution,Math.floor(a.w)/this.resolution):o=new Tt(Math.floor(a.x)/this.resolution,Math.floor(a.y)/this.resolution,Math.floor(a.w)/this.resolution,Math.floor(a.h)/this.resolution),r.trimmed!==!1&&r.spriteSourceSize&&(h=new Tt(Math.floor(r.spriteSourceSize.x)/this.resolution,Math.floor(r.spriteSourceSize.y)/this.resolution,Math.floor(a.w)/this.resolution,Math.floor(a.h)/this.resolution)),this.textures[n]=new mt(this.baseTexture,o,c,h,r.rotated?2:0,r.anchor,r.borders),mt.addToCache(this.textures[n],this.cachePrefix+n.toString())}t++}}_processAnimations(){const e=this.data.animations||{};for(const t in e){this.animations[t]=[];for(let i=0;i<e[t].length;i++){const n=e[t][i];this.animations[t].push(this.textures[n])}}}_parseComplete(){const e=this._callback;this._callback=null,this._batchIndex=0,e.call(this,this.textures)}_nextBatch(){this._processFrames(this._batchIndex*cl.BATCH_SIZE),this._batchIndex++,setTimeout(()=>{this._batchIndex*cl.BATCH_SIZE<this._frameKeys.length?this._nextBatch():(this._processAnimations(),this._parseComplete())},0)}destroy(e=!1){var t;for(const i in this.textures)this.textures[i].destroy();this._frames=null,this._frameKeys=null,this.data=null,this.textures=null,e&&((t=this._texture)==null||t.destroy(),this.baseTexture.destroy()),this._texture=null,this.baseTexture=null,this.linkedSheets=[]}};l1.BATCH_SIZE=1e3;let Ev=l1;const bI=["jpg","png","jpeg","avif","webp","s3tc","s3tc_sRGB","etc","etc1","pvrtc","atc","astc","bptc"];function c1(s,e,t){const i={};if(s.forEach(n=>{i[n]=e}),Object.keys(e.textures).forEach(n=>{i[`${e.cachePrefix}${n}`]=e.textures[n]}),!t){const n=Si.dirname(s[0]);e.linkedSheets.forEach((r,a)=>{Object.assign(i,c1([`${n}/${e.data.meta.related_multi_packs[a]}`],r,!0))})}return i}const wI={extension:He.Asset,cache:{test:s=>s instanceof Ev,getCacheableAssets:(s,e)=>c1(s,e,!1)},resolver:{test:s=>{const e=s.split("?")[0].split("."),t=e.pop(),i=e.pop();return t==="json"&&bI.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:_s.Normal},async testParse(s,e){return Si.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=Si.dirname(e.src);a&&a.lastIndexOf("/")!==a.length-1&&(a+="/");let o;if(i&&i.baseTexture)o=i;else{const d=_h(a+(n??s.meta.image),e.src);o=(await t.load([d]))[d]}const h=new Ev({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=_h(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(wI);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<i.length;l++)t.info.push({face:i[l].getAttribute("face"),size:parseInt(i[l].getAttribute("size"),10)});for(let l=0;l<n.length;l++)t.common.push({lineHeight:parseInt(n[l].getAttribute("lineHeight"),10)});for(let l=0;l<r.length;l++)t.page.push({id:parseInt(r[l].getAttribute("id"),10)||0,file:r[l].getAttribute("file")});for(let l=0;l<a.length;l++){const c=a[l];t.char.push({id:parseInt(c.getAttribute("id"),10),page:parseInt(c.getAttribute("page"),10)||0,x:parseInt(c.getAttribute("x"),10),y:parseInt(c.getAttribute("y"),10),width:parseInt(c.getAttribute("width"),10),height:parseInt(c.getAttribute("height"),10),xoffset:parseInt(c.getAttribute("xoffset"),10),yoffset:parseInt(c.getAttribute("yoffset"),10),xadvance:parseInt(c.getAttribute("xadvance"),10)})}for(let l=0;l<o.length;l++)t.kerning.push({first:parseInt(o[l].getAttribute("first"),10),second:parseInt(o[l].getAttribute("second"),10),amount:parseInt(o[l].getAttribute("amount"),10)});for(let l=0;l<h.length;l++)t.distanceField.push({fieldType:h[l].getAttribute("fieldType"),distanceRange:parseInt(h[l].getAttribute("distanceRange"),10)});return t}}class wm{static test(e){return typeof e=="string"&&e.includes("<font>")?bm.test(We.ADAPTER.parseXML(e)):!1}static parse(e){return bm.parse(We.ADAPTER.parseXML(e))}}const df=[zc,bm,wm];function SI(s){for(let e=0;e<df.length;e++)if(df[e].test(s))return df[e];return null}function _I(s,e,t,i,n,r){const a=t.fill;if(Array.isArray(a)){if(a.length===1)return a[0]}else return a;let o;const h=t.dropShadow?t.dropShadowDistance:0,l=t.padding||0,c=s.width/i-h-l*2,u=s.height/i-h-l*2,d=a.slice(),f=t.fillGradientStops.slice();if(!f.length){const p=d.length+1;for(let m=1;m<p;++m)f.push(m/p)}if(d.unshift(a[0]),f.unshift(0),d.push(a[a.length-1]),f.push(1),t.fillGradientType===Tu.LINEAR_VERTICAL){o=e.createLinearGradient(c/2,l,c/2,u+l);let p=0;const m=(r.fontProperties.fontSize+t.strokeThickness)/u;for(let g=0;g<n.length;g++){const v=r.lineHeight*g;for(let b=0;b<d.length;b++){let y=0;typeof f[b]=="number"?y=f[b]:y=b/d.length;const w=v/u+y*m;let A=Math.max(p,w);A=Math.min(A,1),o.addColorStop(A,d[b]),p=A}}}else{o=e.createLinearGradient(l,u/2,c+l,u/2);const p=d.length+1;let m=1;for(let g=0;g<d.length;g++){let v;typeof f[g]=="number"?v=f[g]:v=m/p,o.addColorStop(v,d[g]),m++}}return o}function MI(s,e,t,i,n,r,a){const o=t.text,h=t.fontProperties;e.translate(i,n),e.scale(r,r);const l=a.strokeThickness/2,c=-(a.strokeThickness/2);if(e.font=a.toFontString(),e.lineWidth=a.strokeThickness,e.textBaseline=a.textBaseline,e.lineJoin=a.lineJoin,e.miterLimit=a.miterLimit,e.fillStyle=_I(s,e,a,r,[o],t),e.strokeStyle=a.stroke,a.dropShadow){const u=a.dropShadowColor,d=a.dropShadowBlur*r,f=a.dropShadowDistance*r;e.shadowColor=Wt.shared.setValue(u).setAlpha(a.dropShadowAlpha).toRgbaString(),e.shadowBlur=d,e.shadowOffsetX=Math.cos(a.dropShadowAngle)*f,e.shadowOffsetY=Math.sin(a.dropShadowAngle)*f}else e.shadowColor="black",e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0;a.stroke&&a.strokeThickness&&e.strokeText(o,l,c+t.lineHeight-h.descent),a.fill&&e.fillText(o,l,c+t.lineHeight-h.descent),e.setTransform(1,0,0,1,0,0),e.fillStyle="rgba(0, 0, 0, 0)"}function qc(s){return s.codePointAt?s.codePointAt(0):s.charCodeAt(0)}function h1(s){return Array.from?Array.from(s):s.split("")}function TI(s){typeof s=="string"&&(s=[s]);const e=[];for(let t=0,i=s.length;t<i;t++){const n=s[t];if(Array.isArray(n)){if(n.length!==2)throw new Error(`[BitmapFont]: Invalid character range length, expecting 2 got ${n.length}.`);const r=n[0].charCodeAt(0),a=n[1].charCodeAt(0);if(a<r)throw new Error("[BitmapFont]: Invalid character range.");for(let o=r,h=a;o<=h;o++)e.push(String.fromCharCode(o))}else e.push(...h1(n))}if(e.length===0)throw new Error("[BitmapFont]: Empty set when resolving characters.");return e}const Sr=class pn{constructor(e,t,i){var c;const[n]=e.info,[r]=e.common,[a]=e.page,[o]=e.distanceField,h=dr(a.file),l={};this._ownsTextures=i,this.font=n.face,this.size=n.size,this.lineHeight=r.lineHeight/h,this.chars={},this.pageTextures=l;for(let u=0;u<e.page.length;u++){const{id:d,file:f}=e.page[u];l[d]=t instanceof Array?t[u]:t[f],o!=null&&o.fieldType&&o.fieldType!=="none"&&(l[d].baseTexture.alphaMode=Xi.NO_PREMULTIPLIED_ALPHA,l[d].baseTexture.mipmap=Bs.OFF)}for(let u=0;u<e.char.length;u++){const{id:d,page:f}=e.char[u];let{x:p,y:m,width:g,height:v,xoffset:b,yoffset:y,xadvance:w}=e.char[u];p/=h,m/=h,g/=h,v/=h,b/=h,y/=h,w/=h;const A=new Tt(p+l[f].frame.x/h,m+l[f].frame.y/h,g,v);this.chars[d]={xOffset:b,yOffset:y,xAdvance:w,kerning:{},texture:new mt(l[f].baseTexture,A),page:f}}for(let u=0;u<e.kerning.length;u++){let{first:d,second:f,amount:p}=e.kerning[u];d/=h,f/=h,p/=h,this.chars[f]&&(this.chars[f].kerning[d]=p)}this.distanceFieldRange=o==null?void 0:o.distanceRange,this.distanceFieldType=((c=o==null?void 0:o.fieldType)==null?void 0:c.toLowerCase())??"none"}destroy(){for(const e in this.chars)this.chars[e].texture.destroy(),this.chars[e].texture=null;for(const e in this.pageTextures)this._ownsTextures&&this.pageTextures[e].destroy(!0),this.pageTextures[e]=null;this.chars=null,this.pageTextures=null}static install(e,t,i){let n;if(e instanceof Ih)n=e;else{const a=SI(e);if(!a)throw new Error("Unrecognized data format for font.");n=a.parse(e)}t instanceof mt&&(t=[t]);const r=new pn(n,t,i);return pn.available[r.font]=r,r}static uninstall(e){const t=pn.available[e];if(!t)throw new Error(`No font found named '${e}'`);t.destroy(),delete pn.available[e]}static from(e,t,i){if(!e)throw new Error("[BitmapFont] Property `name` is required.");const{chars:n,padding:r,resolution:a,textureWidth:o,textureHeight:h,...l}=Object.assign({},pn.defaultOptions,i),c=TI(n),u=t instanceof $r?t:new $r(t),d=o,f=new Ih;f.info[0]={face:u.fontFamily,size:u.fontSize},f.common[0]={lineHeight:u.fontSize};let p=0,m=0,g,v,b,y=0;const w=[];for(let T=0;T<c.length;T++){g||(g=We.ADAPTER.createCanvas(),g.width=o,g.height=h,v=g.getContext("2d"),b=new gt(g,{resolution:a,...l}),w.push(new mt(b)),f.page.push({id:w.length-1,file:""}));const M=c[T],R=Ar.measureText(M,u,!1,g),P=R.width,F=Math.ceil(R.height),I=Math.ceil((u.fontStyle==="italic"?2:1)*P);if(m>=h-F*a){if(m===0)throw new Error(`[BitmapFont] textureHeight ${h}px is too small (fontFamily: '${u.fontFamily}', fontSize: ${u.fontSize}px, char: '${M}')`);--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: '${M}')`);--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,M=c.length;T<M;T++){const R=c[T];for(let P=0;P<M;P++){const F=c[P],I=v.measureText(R).width,k=v.measureText(F).width,O=v.measureText(R+F).width-(I+k);O&&f.kerning.push({first:qc(R),second:qc(F),amount:O})}}const A=new pn(f,w,!0);return pn.available[e]!==void 0&&pn.uninstall(e),pn.available[e]=A,A}};Sr.ALPHA=[["a","z"],["A","Z"]," "],Sr.NUMERIC=[["0","9"]],Sr.ALPHANUMERIC=[["a","z"],["A","Z"],["0","9"]," "],Sr.ASCII=[[" ","~"]],Sr.defaultOptions={resolution:1,textureWidth:512,textureHeight:512,padding:4,chars:Sr.ALPHANUMERIC},Sr.available={};let _r=Sr;var AI=`// 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
|
||
`,EI=`// 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 Cv=[],Iv=[],Rv=[],CI=class u1 extends ji{constructor(e,t={}){super();const{align:i,tint:n,maxWidth:r,letterSpacing:a,fontName:o,fontSize:h}=Object.assign({},u1.styleDefaults,t);if(!_r.available[o])throw new Error(`Missing BitmapFont "${o}"`);this._activePagesMeshData=[],this._textWidth=0,this._textHeight=0,this._align=i,this._tintColor=new Wt(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 er(()=>{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=_r.available[this._fontName],t=this.fontSize,i=t/e.size,n=new Xt,r=[],a=[],o=[],h=this._text.replace(/(?:\r\n|\r)/g,`
|
||
`)||" ",l=h1(h),c=this._maxWidth*e.size/t,u=e.distanceFieldType==="none"?Cv:Iv;let d=null,f=0,p=0,m=0,g=-1,v=0,b=0,y=0,w=0;for(let k=0;k<l.length;k++){const O=l[k],L=qc(O);if(/(?:\s)/.test(O)&&(g=k,v=f,w++),O==="\r"||O===`
|
||
`){a.push(f),o.push(-1),p=Math.max(p,f),++m,++b,n.x=0,n.y+=e.lineHeight,d=null,w=0;continue}const U=e.chars[L];if(!U)continue;d&&U.kerning[d]&&(n.x+=U.kerning[d]);const B=Rv.pop()||{texture:mt.EMPTY,line:0,charCode:0,prevSpaces:0,position:new Xt};B.texture=U.texture,B.line=m,B.charCode=L,B.position.x=Math.round(n.x+U.xOffset+this._letterSpacing/2),B.position.y=Math.round(n.y+U.yOffset),B.prevSpaces=w,r.push(B),f=B.position.x+Math.max(U.xAdvance-U.xOffset,U.texture.orig.width),n.x+=U.xAdvance+this._letterSpacing,y=Math.max(y,U.yOffset+U.texture.height),d=L,g!==-1&&c>0&&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 O=0;this._align==="right"?O=p-a[k]:this._align==="center"?O=(p-a[k])/2:this._align==="justify"&&(O=o[k]<0?0:(p-a[k])/o[k]),T.push(O)}const M=r.length,R={},P=[],F=this._activePagesMeshData;u.push(...F);for(let k=0;k<M;k++){const O=r[k].texture,L=O.baseTexture.uid;if(!R[L]){let U=u.pop();if(!U){const D=new _p;let _,X;e.distanceFieldType==="none"?(_=new Ch(mt.EMPTY),X=ut.NORMAL):(_=new Ch(mt.EMPTY,{program:In.from(EI,AI),uniforms:{uFWidth:0}}),X=ut.NORMAL_NPM);const N=new Dl(D,_);N.blendMode=X,U={index:0,indexCount:0,vertexCount:0,uvsCount:0,total:0,mesh:N,vertices:null,uvs:null,indices:null}}U.index=0,U.indexCount=0,U.vertexCount=0,U.uvsCount=0,U.total=0;const{_textureCache:B}=this;B[L]=B[L]||new mt(O.baseTexture),U.mesh.texture=B[L],U.mesh.tint=this._tintColor.value,P.push(U),R[L]=U}R[L].total++}for(let k=0;k<F.length;k++)P.includes(F[k])||this.removeChild(F[k].mesh);for(let k=0;k<P.length;k++)P[k].mesh.parent!==this&&this.addChild(P[k].mesh);this._activePagesMeshData=P;for(const k in R){const O=R[k],L=O.total;if(!(((I=O.indices)==null?void 0:I.length)>6*L)||O.vertices.length<Dl.BATCHABLE_SIZE*2)O.vertices=new Float32Array(8*L),O.uvs=new Float32Array(8*L),O.indices=new Uint16Array(6*L);else{const U=O.total,B=O.vertices;for(let D=U*4*2;D<B.length;D++)B[D]=0}O.mesh.size=6*L}for(let k=0;k<M;k++){const O=r[k];let L=O.position.x+T[O.line]*(this._align==="justify"?O.prevSpaces:1);this._roundPixels&&(L=Math.round(L));const U=L*i,B=O.position.y*i,D=O.texture,_=R[D.baseTexture.uid],X=D.frame,N=D._uvs,V=_.index++;_.indices[V*6+0]=0+V*4,_.indices[V*6+1]=1+V*4,_.indices[V*6+2]=2+V*4,_.indices[V*6+3]=0+V*4,_.indices[V*6+4]=2+V*4,_.indices[V*6+5]=3+V*4,_.vertices[V*8+0]=U,_.vertices[V*8+1]=B,_.vertices[V*8+2]=U+X.width*i,_.vertices[V*8+3]=B,_.vertices[V*8+4]=U+X.width*i,_.vertices[V*8+5]=B+X.height*i,_.vertices[V*8+6]=U,_.vertices[V*8+7]=B+X.height*i,_.uvs[V*8+0]=N.x0,_.uvs[V*8+1]=N.y0,_.uvs[V*8+2]=N.x1,_.uvs[V*8+3]=N.y1,_.uvs[V*8+4]=N.x2,_.uvs[V*8+5]=N.y2,_.uvs[V*8+6]=N.x3,_.uvs[V*8+7]=N.y3}this._textWidth=p*i,this._textHeight=(n.y+e.lineHeight)*i;for(const k in R){const O=R[k];if(this.anchor.x!==0||this.anchor.y!==0){let D=0;const _=this._textWidth*this.anchor.x,X=this._textHeight*this.anchor.y;for(let N=0;N<O.total;N++)O.vertices[D++]-=_,O.vertices[D++]-=X,O.vertices[D++]-=_,O.vertices[D++]-=X,O.vertices[D++]-=_,O.vertices[D++]-=X,O.vertices[D++]-=_,O.vertices[D++]-=X}this._maxLineHeight=y*i;const L=O.mesh.geometry.getBuffer("aVertexPosition"),U=O.mesh.geometry.getBuffer("aTextureCoord"),B=O.mesh.geometry.getIndex();L.data=O.vertices,U.data=O.uvs,B.data=O.indices,L.update(),U.update(),B.update()}for(let k=0;k<r.length;k++)Rv.push(r[k]);this._font=e,this.dirty=!1}updateTransform(){this.validate(),this.containerUpdateTransform()}_render(e){this._autoResolution&&this._resolution!==e.resolution&&(this._resolution=e.resolution,this.dirty=!0);const{distanceFieldRange:t,distanceFieldType:i,size:n}=_r.available[this._fontName];if(i!=="none"){const{a:r,b:a,c:o,d:h}=this.worldTransform,l=Math.sqrt(r*r+a*a),c=Math.sqrt(o*o+h*h),u=(Math.abs(l)+Math.abs(c))/2,d=this.fontSize/n,f=e._view.resolution;for(const p of this._activePagesMeshData)p.mesh.shader.uniforms.uFWidth=u*t*d*f}super._render(e)}getLocalBounds(){return this.validate(),super.getLocalBounds()}validate(){const e=_r.available[this._fontName];if(!e)throw new Error(`Missing BitmapFont "${this._fontName}"`);this._font!==e&&(this.dirty=!0),this.dirty&&this.updateText()}get tint(){return this._tintColor.value}set tint(e){if(this.tint!==e){this._tintColor.setValue(e);for(let t=0;t<this._activePagesMeshData.length;t++)this._activePagesMeshData[t].mesh.tint=e}}get align(){return this._align}set align(e){this._align!==e&&(this._align=e,this.dirty=!0)}get fontName(){return this._fontName}set fontName(e){if(!_r.available[e])throw new Error(`Missing BitmapFont "${e}"`);this._fontName!==e&&(this._fontName=e,this.dirty=!0)}get fontSize(){return this._fontSize??_r.available[this._fontName].size}set fontSize(e){this._fontSize!==e&&(this._fontSize=e,this.dirty=!0)}get anchor(){return this._anchor}set anchor(e){typeof e=="number"?this._anchor.set(e):this._anchor.copyFrom(e)}get text(){return this._text}set text(e){e=String(e??""),this._text!==e&&(this._text=e,this.dirty=!0)}get maxWidth(){return this._maxWidth}set maxWidth(e){this._maxWidth!==e&&(this._maxWidth=e,this.dirty=!0)}get maxLineHeight(){return this.validate(),this._maxLineHeight}get textWidth(){return this.validate(),this._textWidth}get letterSpacing(){return this._letterSpacing}set letterSpacing(e){this._letterSpacing!==e&&(this._letterSpacing=e,this.dirty=!0)}get roundPixels(){return this._roundPixels}set roundPixels(e){e!==this._roundPixels&&(this._roundPixels=e,this.dirty=!0)}get textHeight(){return this.validate(),this._textHeight}get resolution(){return this._resolution}set resolution(e){this._autoResolution=!1,this._resolution!==e&&(this._resolution=e,this.dirty=!0)}destroy(e){const{_textureCache:t}=this,i=_r.available[this._fontName].distanceFieldType==="none"?Cv:Iv;i.push(...this._activePagesMeshData);for(const n of this._activePagesMeshData)this.removeChild(n.mesh);this._activePagesMeshData=[],i.filter(n=>t[n.mesh.texture.baseTexture.uid]).forEach(n=>{n.mesh.texture=mt.EMPTY});for(const n in t)t[n].destroy(),delete t[n];this._font=null,this._tintColor=null,this._textureCache=null,super.destroy(e)}};CI.styleDefaults={align:"left",tint:16777215,maxWidth:0,letterSpacing:0};const II=[".xml",".fnt"],RI={extension:{type:He.LoadParser,priority:_s.Normal},name:"loadBitmapFont",test(s){return II.includes(Si.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;l<r.length;++l){const c=r[l].file;let u=Si.join(Si.dirname(n),c);u=_h(u,n),a.push(u)}const o=await t.load(a),h=a.map(l=>o[l]);return _r.install(i,h,!0)},async load(s,e){return(await We.ADAPTER.fetch(s)).text()},unload(s){s.destroy()}};tt.add(RI);const Sm=class ao extends $r{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:Si.basename(e,Si.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=b2(e)),typeof e=="number"?x2(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 Wr{constructor(e="",t={}){super(mt.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=mt.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<this._updateID){h();return}await t.onBeforeDraw(),i.src=n.src,n.onload=null,n.src="",this.updateTexture(),h()};const l=new XMLSerializer().serializeToString(this._svgRoot);n.src=`data:image/svg+xml;charset=utf8,${encodeURIComponent(l)}`})}get source(){return this._image}updateTexture(){const{style:e,texture:t,_image:i,resolution:n}=this,{padding:r}=e,{baseTexture:a}=t;t.trim.width=t._frame.width=i.width/n,t.trim.height=t._frame.height=i.height/n,t.trim.x=-r,t.trim.y=-r,t.orig.width=t._frame.width-r*2,t.orig.height=t._frame.height-r*2,this._onTextureUpdate(),a.setRealSize(i.width,i.height,n),this.dirty=!1}_render(e){this._autoResolution&&this._resolution!==e.resolution&&(this._resolution=e.resolution,this.dirty=!0),this.updateText(!0),super._render(e)}_renderCanvas(e){this._autoResolution&&this._resolution!==e.resolution&&(this._resolution=e.resolution,this.dirty=!0),this.updateText(!0),super._renderCanvas(e)}getLocalBounds(e){return this.updateText(!0),super.getLocalBounds(e)}_calculateBounds(){this.updateText(!0),this.calculateVertices(),this._bounds.addQuad(this.vertexData)}_onStyleChange(){this.dirty=!0}destroy(e){var i,n,r,a,o;typeof e=="boolean"&&(e={children:e}),e=Object.assign({},oo.defaultDestroyOptions,e),super.destroy(e);const t=null;this.ownsStyle&&((i=this._style)==null||i.cleanFonts()),this._style=t,(n=this._svgRoot)==null||n.remove(),this._svgRoot=t,(r=this._domElement)==null||r.remove(),this._domElement=t,(a=this._foreignObject)==null||a.remove(),this._foreignObject=t,(o=this._styleElement)==null||o.remove(),this._styleElement=t,this._loadImage.src="",this._loadImage.onload=null,this._loadImage=t,this._image.src="",this._image=t}get width(){return this.updateText(!0),Math.abs(this.scale.x)*this._image.width/this.resolution}set width(e){this.updateText(!0);const t=Br(this.scale.x)||1;this.scale.x=t*e/this._image.width/this.resolution,this._width=e}get height(){return this.updateText(!0),Math.abs(this.scale.y)*this._image.height/this.resolution}set height(e){this.updateText(!0);const t=Br(this.scale.y)||1;this.scale.y=t*e/this._image.height/this.resolution,this._height=e}get style(){return this._style}set style(e){this._style!==e&&(e=e||{},e instanceof ff?(this.ownsStyle=!1,this._style=e):e instanceof $r?(console.warn("[HTMLText] Cloning TextStyle, if this is not what you want, use HTMLTextStyle"),this.ownsStyle=!0,this._style=ff.from(e)):(this.ownsStyle=!0,this._style=new ff(e)),this.localStyleID=-1,this.dirty=!0)}get text(){return this._text}set text(e){e=String(e===""||e===null||e===void 0?" ":e),e=this.sanitiseText(e),this._text!==e&&(this._text=e,this.dirty=!0)}get resolution(){return this._resolution}set resolution(e){this._autoResolution=!1,this._resolution!==e&&(this._resolution=e,this.dirty=!0)}sanitiseText(e){return e.replace(/<br>/gi,"<br/>").replace(/<hr>/gi,"<hr/>").replace(/ /gi," ")}};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 d1(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 PI(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 Pv(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 kI(s,e){const{innerW:t,innerH:i,outerW:n,outerH:r}=d1(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 m<n?(g=-n/2+m,v=-r/2):(m-=n)<r?(g=n/2,v=-r/2+m):(m-=r)<n?(g=n/2-m,v=r/2):(m-=n,g=-n/2,v=r/2-m),{x:g,y:v,radialAngle:Math.atan2(v,g)*180/Math.PI}}let u=e()*c,d=0,f=0;return u<h?(d=-n/2+e()*a,f=(e()-.5)*r):(u-=h)<h?(d=t/2+e()*a,f=(e()-.5)*r):(u-=h)<l?(d=(e()-.5)*t,f=-r/2+e()*o):(d=(e()-.5)*t,f=i/2+e()*o),{x:d,y:f,radialAngle:Math.atan2(f,d)*180/Math.PI}}function FI(s,e){if(s.shape==="circle"){const{inner:t,outer:i}=Rh(s.innerRadius,s.outerRadius);return Pv(t,i,e()*Math.PI*2,e)}if(s.shape==="rect")return kI(s,e);if(s.shape==="cone"){const{inner:t,outer:i}=Rh(s.innerRadius,s.outerRadius),n=Math.max(0,Math.min(360,Number(s.coneAngle)||0))/2,r=(Number(s.coneDirection)||0)+(e()-.5)*n*2;return Pv(t,i,r*Math.PI/180,e)}return{x:0,y:0,radialAngle:0}}function OI(s,e,t,i){if(s.shape==="path"||s.shape==="orbit"){if(s.emissionAngleMode==="path-tangent"&&Number.isFinite(e.pathAngle))return(e.pathAngle+t)*Math.PI/180;if(s.emissionAngleMode==="path-normal"&&Number.isFinite(e.pathAngle))return(e.pathAngle-90+t)*Math.PI/180}if(s.emissionAngleMode==="radial"&&s.shape!=="point"&&s.shape!=="orbit")return(e.radialAngle+t)*Math.PI/180;const n=s.emissionAngleMode==="random"?(i()-.5)*Math.max(0,Number(s.spread)||0):0,r=((Number(s.direction)||0)+t+n)*Math.PI/180;return s.shape==="cone"?-r:r}function Nl(){return{texture:null,imageResources:[{id:1,texture:null,textureName:"star",textureFolder:"",previewUrl:"/images/star.png",imageMode:"fixed",sequencePlayback:"loop-forward",sequenceFps:30,sequenceFrames:[],weight:100,locked:!1,scale:1,anchorX:.5,anchorY:.5,colorMode:"fixed",colorStart:"#ffffff",colorEnd:"#ff4d4d",colorGradient:[{position:0,color:"#ffffff"},{position:1,color:"#ff4d4d"}],blend:"normal",independentAlpha:"off",alpha:1,alphaCurveMode:"跟随导出",alphaCurve:[{x:0,y:0},{x:.1,y:1},{x:.9,y:1},{x:1,y:0}]}],imageWeightVersion:1,name:"ParticleSystem1",mode:"stream",rate:20,streamBehavior:"normal",loopDurationFrames:30,generateLoopStartAnimation:!1,loopStartUseCustomDuration:!1,loopStartDurationFrames:30,generateLoopEndAnimation:!1,loopEndUseCustomDuration:!1,loopEndDurationFrames:30,burstCount:50,burstLoop:!1,delay:0,duration:1,shape:"point",shapeRangeVersion:1,innerRadius:0,outerRadius:30,innerRectW:0,innerRectH:0,outerRectW:60,outerRectH:40,spawnPathId:0,spawnPathDistribution:"fixed",radius:30,rectW:60,rectH:40,centerX:0,centerY:0,rootRotation:0,rootScaleX:1,rootScaleY:1,emissionAngleMode:"random",direction:0,spread:360,coneDirection:90,coneAngle:60,lifeMin:.6,lifeMax:1.8,lifeMode:"random",lifeCurve:[{x:0,y:0},{x:1,y:1}],speedMin:30,speedMax:140,speedMode:"random",speedCurve:[{x:0,y:0},{x:1,y:1}],scaleMin:.3,scaleMax:.8,scaleMode:"random",scaleAxisMode:"uniform",scaleYMin:.3,scaleYMax:.8,scaleCurve:[{x:0,y:0},{x:1,y:1}],scaleYCurve:[{x:0,y:0},{x:1,y:1}],scaleEndRatio:.3,initialRotationMode:"random",initialRotationMin:0,initialRotationMax:360,initialRotationCurve:[{x:0,y:0},{x:1,y:1}],alpha:.9,alphaEnd:0,rotationSpeedMin:-180,rotationSpeedMax:180,speedOverLifeEnabled:!1,speedOverLifeMode:"fixed",speedOverLifeMin:1,speedOverLifeMax:1,speedOverLifeCurve:[{x:0,y:1},{x:1,y:1}],scaleOverLifeEnabled:!1,scaleOverLifeMode:"curve",scaleOverLifeAxisMode:"uniform",scaleOverLifeMin:0,scaleOverLifeMax:1,scaleYOverLifeMin:0,scaleYOverLifeMax:1,scaleOverLifeCurve:[{x:0,y:1},{x:1,y:1}],scaleYOverLifeCurve:[{x:0,y:1},{x:1,y:1}],rotationOverLifeEnabled:!1,rotationOverLifeMode:"random",rotationOverLifeCurve:[{x:0,y:0},{x:1,y:1}],gravity:980,gravityMode:"fixed",gravityMin:980,gravityMax:980,gravityDirection:-90,gravityCurve:[{x:0,y:1},{x:1,y:1}],damping:0,seed:0,colorStart:"#ffffff",colorEnd:"#ff4d4d",colorOverLife:!1,blend:"add",alphaMode:"curve",curveMode:"线性",alphaCurve:[{x:0,y:0},{x:.2,y:1},{x:.8,y:1},{x:1,y:0}],textureName:"star",textureFolder:"",alphaScale:1,anchorX:.5,anchorY:.5,independentAlpha:"off",offsetX:0,offsetY:0,noise:!1,noiseAmt:30,noiseRange:100,noiseSpeed:1,useGravity:!1,wind:!1,windX:0,windY:0,windMode:"fixed",windMin:100,windMax:100,windDirection:0,windCurve:[{x:0,y:1},{x:1,y:1}],forceField:!1,forceStrength:10,forceRadius:100,forceCenterX:0,forceCenterY:0,forceFalloff:"linear",attraction:!1,attractionCenterX:200,attractionCenterY:0,attractionRadius:20,attractionDuration:.5,attractionDelay:.1,attractionDelayMode:"particle",attractionPath:"curve",trail:!1,trailConfigVersion:3,trailResources:[{id:1,texture:null,textureName:"trail",previewUrl:"/images/trail.png",weight:100,locked:!1,rotation:0,colorMode:"particle",color:"#ffffff",colorGradient:[{position:0,color:"#ffffff"},{position:1,color:"#ffffff"}],blend:"normal",alphaMode:"particle",alpha:1,alphaCurve:[{x:0,y:1},{x:1,y:1}],boneCount:3,trailRatio:100,lengthMode:"fixed",length:100,lengthMin:100,lengthMax:100,widthSizeMode:"fixed",width:100,widthMin:100,widthMax:100,widthMode:"particle",lifeLengthEnabled:!1,lifeLengthCurve:[{x:0,y:1},{x:1,y:1}],shapeEnabled:!1,shapeCurve:[{x:0,y:1},{x:1,y:1}]}],trailResourceVersion:6,trailTexture:null,trailTextureName:"trail",trailPreviewUrl:"/images/trail.png",trailColorMode:"particle",trailColor:"#ffffff",trailColorGradient:[{position:0,color:"#ffffff"},{position:1,color:"#ffffff"}],trailAlphaMode:"particle",trailAlpha:1,trailAlphaCurve:[{x:0,y:1},{x:1,y:1}],trailBoneCount:3,trailLength:100,trailWidth:100,trailWidthMode:"particle",trailLifeLengthEnabled:!1,trailLifeLengthCurve:[{x:0,y:1},{x:1,y:1}],trailShapeEnabled:!1,trailShapeCurve:[{x:0,y:1},{x:1,y:1}],trailGridRows:4,trailGridCols:4,collision:!1,collisionColliderIds:[],pathFollow:!1,emitterFollow:!1,emitterFollowMode:"none",emitterFollowPathId:0,emitterFollowSpineId:0,emitterFollowBoneName:"",emitterFollowBoneOffsetX:0,emitterFollowBoneOffsetY:0,emitterFollowBoneRotation:0,emitterFollowBoneScaleX:1,emitterFollowBoneScaleY:1,emitterAngleMode:"fixed",emitterFollowCurve:[{x:0,y:0},{x:1,y:1}],emitterFollowDuration:2,emitterFollowSpace:"world",emitterFollowDirection:"forward",emitterFollowOffset:0}}function Gr(s){var F;const e=Nl(),t=s,i=t.shapeRangeVersion!==1,n=Number(t.radius),r=Number(t.rectW),a=Number(t.rectH),o=Number(t.direction),h=Number(t.spread),l=t.shape,c=t.imageWeightVersion!==1,u=t.loopDurationFrames==null,d=t.gravityMode==null,f=Number(t.gravity),p=t.windMode==null,m=Number(t.windX),g=Number(t.windY),v=t.forceFalloff==null,b=Number(t.forceStrength),y=t.trailConfigVersion!==3,w=!Array.isArray(t.trailResources),A=t.trailResourceVersion!==6,T=t.trailTexture,M=String(t.trailTextureName||"trail"),R=String(t.trailPreviewUrl||"/images/trail.png").replace("/trails/trail.png","/images/trail.png");for(const[I,k]of Object.entries(e))t[I]!==void 0&&t[I]!==null||(t[I]=Array.isArray(k)?k.map(O=>typeof O=="object"&&O!==null?{...O}:O):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=Nl().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(Er,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,O)=>{k.weight=O===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:M,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(Er,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 Er={normal:0,add:1,multiply:2,screen:3},BI=400;class LI extends ji{constructor(t,i=BI){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 ms);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=Gr(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<t;){const i=this.pool.length,n=new Wr(this.cfg.texture);n.blendMode=Er[this.cfg.blend],n.anchor.set(.5),n.visible=!1,this.addChild(n),this.pool.push({sprite:n,active:!1,boneName:"p_"+i,spawnId:-1,life:0,maxLife:1,x:0,y:0,vx:0,vy:0,scaleStartX:1,scaleStartY:1,alphaStart:1,alphaEnd:1,rotation:0,rotationSpeed:0,speedScale:1,speedScaleTarget:1,scaleOverLifeX:1,scaleOverLifeY:1,noisePhaseX:0,noisePhaseY:0,gravityStrength:980,windStrength:100,attractionActive:!1,attractionElapsed:0,attractionStartWorldX:0,attractionStartWorldY:0,attractionCurveSide:1,trailMesh:null,trailMeshSignature:"",trailHistory:[],trailBones:[],trailSkinWeights:[],trailCurrentWidth:0,trailCurrentAlpha:0,trailCurrentColor:16777215,trailResourceId:1,trailEnabled:!1,trailSampledLength:100,trailSampledWidth:100,resourceId:1,colorSample:16777215,imageFrameIndex:0,collisionPaused:!1})}}setEmitterPos(t){this._emitterPos=t}setSpawnPathSampler(t,i=!1){this.spawnPathSampler=t,this.spawnPathClosed=i}setColliders(t){this.colliders=t}setEmitterFollowSpawn(t,i,n){this.followSpawnX=t,this.followSpawnY=i,this.followSpawnAngle=n}setSimulationTransform(t,i,n,r,a){this.simulationTransform={centerX:t,centerY:i,rotation:n,scaleX:r,scaleY:a}}applyColliders(t,i){if(!this.cfg.collision||!this.colliders.length)return!1;const n=this.cfg;let r=Ka(n,t.x,t.y,this.simulationTransform),a=DI(n,t.vx,t.vy,this.simulationTransform);for(const o of this.colliders){if(!o.enabled)continue;const h=UI(o,r.x,r.y);if(!h)continue;if(o.response==="destroy")return this.kill(i),!0;if(r={x:h.x,y:h.y},o.response==="pause")t.collisionPaused=!0,a={x:0,y:0};else{const u=a.x*h.nx+a.y*h.ny,d=a.x-u*h.nx,f=a.y-u*h.ny,p=Math.min(1,Math.max(0,o.elasticity)),m=1-Math.min(1,Math.max(0,o.friction)),g=u<0?-u*p:u;a.x=d*m+g*h.nx,a.y=f*m+g*h.ny}const l=kv(n,r.x,r.y,this.simulationTransform),c=NI(n,a.x,a.y,this.simulationTransform);t.x=l.x,t.y=l.y,t.vx=c.x,t.vy=c.y}return!1}update(t,i="normal"){var h,l,c,u,d,f;const n=this.cfg;if((n.lifeMode==null||n.speedMode==null||n.scaleMode==null||n.shapeRangeVersion!==1||n.initialRotationMode==null||n.speedOverLifeEnabled==null||n.scaleOverLifeEnabled==null||n.rotationOverLifeEnabled==null||!Array.isArray(n.scaleOverLifeCurve)||n.attraction==null||n.trailBoneCount==null)&&Gr(n),this.reseed(),this._elapsed+=t,n.attraction&&!this._attractionWasEnabled){this._attractionEnabledAt=this._elapsed;for(const p of this.pool)p.attractionActive=!1,p.attractionElapsed=0}else if(!n.attraction&&this._attractionWasEnabled)for(const p of this.pool)p.attractionActive=!1;this._attractionWasEnabled=n.attraction;const r=i==="force"||i==="normal"&&(n.delay<=0||this._elapsed>=n.delay),a=i==="force"||i==="normal"&&(n.mode==="burst"||this._elapsed<n.delay+Math.max(1/30,n.duration));if(r&&a)if(n.mode==="stream")for(this.accumulator+=t*n.rate;this.accumulator>=1;)this.accumulator-=1,this.spawnOne();else this.burstTimer+=t,n.burstLoop?this.burstTimer>=1&&(this.burstTimer=0,this.emitBurst()):t>0&&this.burstTimer<=t&&this.emitBurst();const o=[];for(let p=0;p<this.pool.length;p++){const m=this.pool[p];if(!m.active)continue;if(m.life-=t,m.life<=0){this.kill(p);continue}const g=XI(m);if(!m.collisionPaused&&n.useGravity){const _=Math.min(1,Math.max(0,yn(n.gravityCurve,g))),X=(n.gravityMode==="random"?m.gravityStrength:n.gravityMin)*_,N=n.gravityDirection*Math.PI/180;m.vx+=Math.cos(N)*X*t,m.vy+=-Math.sin(N)*X*t}if(!m.collisionPaused&&n.wind){const _=Math.min(1,Math.max(0,yn(n.windCurve,g))),X=(n.windMode==="random"?m.windStrength:n.windMin)*_,N=n.windDirection*Math.PI/180;m.vx+=Math.cos(N)*X*t,m.vy+=-Math.sin(N)*X*t}if(!m.collisionPaused&&n.forceField&&n.forceStrength!==0&&n.forceRadius>0){const _=Math.max(1e-4,Math.abs(n.rootScaleX)),X=Math.max(1e-4,Math.abs(n.rootScaleY)),N=-(((h=this.simulationTransform)==null?void 0:h.rotation)??n.rootRotation)*Math.PI/180,V=Math.cos(N),G=Math.sin(N),j=((l=this.simulationTransform)==null?void 0:l.centerX)??n.centerX,ne=((c=this.simulationTransform)==null?void 0:c.centerY)??n.centerY,Q=j+V*_*m.x-G*X*m.y,de=-ne+G*_*m.x+V*X*m.y,me=Q,we=-de,Re=n.forceCenterX-me,ge=n.forceCenterY-we,Ae=Math.hypot(Re,ge);if(Ae>1e-4&&Ae<=n.forceRadius){let H=1;n.forceFalloff==="linear"?H=1-Ae/n.forceRadius:n.forceFalloff==="inverse"&&(H=Math.min(10,n.forceRadius/Math.max(Ae,n.forceRadius*.1)));const K=n.forceStrength*H*10,q=Re/Ae*K,z=ge/Ae*K,ee=q,le=-z;m.vx+=(V*ee+G*le)/_*t,m.vy+=(-G*ee+V*le)/X*t}}if(!m.collisionPaused&&n.damping>0){const _=Math.max(0,1-n.damping*t);m.vx*=_,m.vy*=_}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 _=m.maxLife-m.life;if(n.attractionDelayMode==="particle"?_>=Math.max(0,n.attractionDelay):this._elapsed-this._attractionEnabledAt>=Math.max(0,n.attractionDelay)){const N=Ka(n,m.x,m.y,this.simulationTransform),V=n.attractionCenterX,G=n.attractionCenterY,j=Math.max(0,n.attractionRadius);if(!m.attractionActive){if(Math.hypot(V-N.x,G-N.y)<=j){this.kill(p);continue}m.attractionActive=!0,m.attractionElapsed=0,m.attractionStartWorldX=N.x,m.attractionStartWorldY=N.y}m.attractionElapsed+=t;const ne=Math.max(1e-4,n.attractionDuration),Q=Math.min(1,m.attractionElapsed/ne);let de=Yi(m.attractionStartWorldX,V,Q),me=Yi(m.attractionStartWorldY,G,Q);if(n.attractionPath==="curve"){const ge=V-m.attractionStartWorldX,Ae=G-m.attractionStartWorldY,H=Math.hypot(ge,Ae);if(H>1e-4){const K=H*.25*m.attractionCurveSide,q=(m.attractionStartWorldX+V)*.5-Ae/H*K,z=(m.attractionStartWorldY+G)*.5+ge/H*K,ee=1-Q;de=ee*ee*m.attractionStartWorldX+2*ee*Q*q+Q*Q*V,me=ee*ee*m.attractionStartWorldY+2*ee*Q*z+Q*Q*G}}const we=Math.hypot(V-de,G-me);if(Q>=1||we<=j){this.kill(p);continue}const Re=kv(n,de,me,this.simulationTransform);m.x=Re.x,m.y=Re.y,m.vx=0,m.vy=0}}const v=g,b=m.sprite,y=n.imageResources.find(_=>_.id===m.resourceId);if(y){const _=this.imageFrameState(y,m.maxLife-m.life);m.imageFrameIndex=_.index,b.texture=this.imageFrameTexture(y,m.imageFrameIndex),b.visible=_.visible}if(n.speedOverLifeEnabled){const _=Ac(mf(n.speedOverLifeMode,n.speedOverLifeMin,n.speedOverLifeMax,n.speedOverLifeCurve,v,m.speedScaleTarget),1),X=m.speedScale===0?_:_/m.speedScale;m.vx*=X,m.vy*=X,m.speedScale=_}let w=m.rotationSpeed;n.rotationOverLifeEnabled&&n.rotationOverLifeMode==="curve"&&(w=Yi(n.rotationSpeedMin,n.rotationSpeedMax,yn(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 _=m.maxLife-m.life,X=Math.max(0,n.noiseRange)*Math.min(1,Math.max(0,n.noiseAmt)/100)*.5,N=_*Math.max(0,n.noiseSpeed)*Math.PI*2;A+=(Math.sin(m.noisePhaseX+N)-Math.sin(m.noisePhaseX))*X,T+=(Math.sin(m.noisePhaseY+N*.83)-Math.sin(m.noisePhaseY))*X}b.x=A,b.y=T,b.rotation=-m.rotation*Math.PI/180;let M=1,R=1;n.scaleOverLifeEnabled&&(M=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):M),b.scale.set(Ac(m.scaleStartX*M,1),Ac(m.scaleStartY*R,1));const P=n.alphaMode==="curve"?yn(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"?yn(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:_o(F);b.tint=I,b.blendMode=Er[(y==null?void 0:y.blend)||"normal"];const k=this.updateTrail(m,A,T,v,b),O=Ka(n,A,T,this.simulationTransform),L=((u=this.simulationTransform)==null?void 0:u.rotation)??n.rootRotation,U=Math.abs(((d=this.simulationTransform)==null?void 0:d.scaleX)??n.rootScaleX),B=Math.abs(((f=this.simulationTransform)==null?void 0:f.scaleY)??n.rootScaleY),D=k?{...k,bones:k.bones.map(_=>{const X=Ka(n,_.x,_.y,this.simulationTransform);return{..._,worldX:X.x,worldY:X.y,worldRotation:L-_.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:O.x,worldY:O.y,worldRotation:L+m.rotation,worldScaleX:b.scale.x*U,worldScaleY:b.scale.y*B,alpha:b.alpha,colorHex:I,resourceId:m.resourceId,imageFrameIndex:m.imageFrameIndex,imageVisible:b.visible,trailState:D,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)||mt.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<h;g++){const v=g/(h-1),b=v*(l-1),y=Math.min(l-1,Math.floor(b)),w=Math.min(l-1,y+1),A=b-y;for(let T=0;T<o;T++){const M=g*o+T,R=v,P=T/(o-1),F=a*Math.PI/180,I=Math.cos(F),k=Math.sin(F);d[M*2]=.5+I*(R-.5)-k*(P-.5),d[M*2+1]=.5+k*(R-.5)+I*(P-.5),p.push({boneA:y,boneB:w,weight:A})}}for(let g=0;g<h-1;g++)for(let v=0;v<o-1;v++){const b=g*o+v,y=(g+1)*o+v,w=b+1,A=y+1;f.push(b,y,w,y,A,w)}const m=new eI(r,u,d,new Uint16Array(f));return m.visible=!1,m.blendMode=Er.normal,this.addChildAt(m,Math.max(0,this.getChildIndex(t.sprite))),t.trailMesh=m,t.trailMeshSignature=c,t.trailSkinWeights=p,m}appendTrailPoint(t,i,n,r){const a=t.trailHistory[0];!a||Math.hypot(a.x-i,a.y-n)>.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<t.trailHistory.length;c++)if(h+=Math.hypot(t.trailHistory[c].x-t.trailHistory[c-1].x,t.trailHistory[c].y-t.trailHistory[c-1].y),h>=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<a.length;c++)h+=Math.hypot(a[c].x-a[c-1].x,a[c].y-a[c-1].y);const l=Math.min(Math.max(0,i),h);for(let c=0;c<r;c++){const u=l*c/(r-1);let d=0,f=a[a.length-1];for(let p=1;p<a.length;p++){const m=a[p-1],g=a[p],v=Math.hypot(g.x-m.x,g.y-m.y);if(d+v>=u&&v>1e-4){const b=(u-d)/v;f={x:Yi(m.x,g.x,b),y:Yi(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;c<o.length;c++){const u=o[Math.min(o.length-1,c+1)],d=o[Math.max(0,c-1)],f=c<o.length-1?u.x-o[c].x:o[c].x-d.x,p=c<o.length-1?u.y-o[c].y:o[c].y-d.y;o[c].rotation=Math.atan2(p,f)*180/Math.PI}if(l+1e-4<Math.max(0,i)&&o.length>1){const c=o[0].rotation,d=(o[o.length-1].rotation-c+540)%360-180;for(let f=0;f<o.length;f++)o[f].rotation=c+d*f/(o.length-1)}return o}skinTrailMesh(t,i){const n=this.ensureTrailMesh(t),r=this.cfg,a=r.trailResources.find(u=>u.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<h;u++){const d=t.trailSkinWeights[u*o],f=i.bones[Math.min(i.bones.length-1,d.boneA)],p=i.bones[Math.min(i.bones.length-1,d.boneB)];c.push({x:Yi(f.x,p.x,d.weight),y:Yi(f.y,p.y,d.weight)})}for(let u=0;u<h;u++){const d=c[Math.max(0,u-1)],f=c[Math.min(h-1,u+1)],p=f.x-d.x,m=f.y-d.y,g=Math.max(1e-4,Math.hypot(p,m)),v=-m/g,b=p/g,y=u/(h-1),w=a.shapeEnabled?Math.max(0,yn(a.shapeCurve,y)):1;for(let A=0;A<o;A++){const M=(A/(o-1)-.5)*i.width*w,R=(u*o+A)*2;l[R]=c[u].x+v*M,l[R+1]=c[u].y+b*M}}n.tint=i.colorHex,n.alpha=i.alpha,n.blendMode=Er[a.blend],n.visible=Math.hypot(c[0].x-c[h-1].x,c[0].y-c[h-1].y)>.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,yn(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"?yn(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):_o((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;c<n;c++)for(let u=0;u<r;u++){const d=l(u,c);u===0?i.moveTo(d.x,d.y):i.lineTo(d.x,d.y)}for(let c=0;c<r;c++)for(let u=0;u<n;u++){const d=l(c,u);u===0?i.moveTo(d.x,d.y):i.lineTo(d.x,d.y)}i.beginFill(9235711,.9);for(let c=0;c<r;c++)for(let u=0;u<n;u++){const d=l(c,u);i.drawCircle(d.x,d.y,1.6)}i.endFill()}}emitBurst(){for(let t=0;t<this.cfg.burstCount;t++)this.spawnOne()}spawnOrigin(){const t=this.cfg;let i=t.offsetX,n=t.offsetY;if(n=-n,t.shape==="path"&&t.spawnPathId>0&&this.spawnPathSampler){const o=this.estimatedEmissionCount(),h=PI(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=FI(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=Za(t.lifeMode,t.lifeMin,t.lifeMax,t.lifeCurve,this.rng()),h=Za(t.speedMode,t.speedMin,t.speedMax,t.speedCurve,this.rng()),l=OI(t,n,this.followSpawnAngle,this.rng),c=this.pool[i],u=this.pickImageResource(),d=this._spawnSerial++;c.spawnId=d;const f=this.pickTrailResource(la(t.seed,d,1540483477));c.noisePhaseX=la(t.seed,d,1757159915)*Math.PI*2,c.noisePhaseY=la(t.seed,d,48610963)*Math.PI*2,c.gravityStrength=t.useGravity&&t.gravityMode==="random"?Yi(t.gravityMin,t.gravityMax,this.rng()):t.gravityMin,c.windStrength=t.wind&&t.windMode==="random"?Yi(t.windMin,t.windMax,this.rng()):t.windMin,c.attractionActive=!1,c.attractionElapsed=0,c.collisionPaused=!1,c.attractionCurveSide=la(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=la(t.seed,d,668265261)*100,b=(w,A,T,M,R)=>{if(w!=="random")return Math.max(0,Number(A)||0);const P=Math.max(0,Math.min(Number(T)||0,Number(M)||0)),F=Math.max(0,Math.max(Number(T)||0,Number(M)||0));return Yi(P,F,la(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||v<p)&&c.trailSampledLength>0&&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=Za(t.scaleMode,t.scaleMin,t.scaleMax,t.scaleCurve,this.rng())*u.scale,c.scaleStartY=t.scaleAxisMode==="separate"?Za(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:Za(t.initialRotationMode,t.initialRotationMin,t.initialRotationMax,t.initialRotationCurve,this.rng()),c.rotationSpeed=t.rotationOverLifeEnabled?Za(t.rotationOverLifeMode,t.rotationSpeedMin,t.rotationSpeedMax,t.rotationOverLifeCurve,this.rng()):0,c.speedScale=1,c.speedScaleTarget=t.speedOverLifeMode==="random"?Yi(t.speedOverLifeMin,t.speedOverLifeMax,this.rng()):t.speedOverLifeMin,c.scaleOverLifeX=t.scaleOverLifeMode==="random"?Yi(t.scaleOverLifeMin,t.scaleOverLifeMax,this.rng()):t.scaleOverLifeMin,c.scaleOverLifeY=t.scaleOverLifeMode==="random"?Yi(t.scaleYOverLifeMin,t.scaleYOverLifeMax,this.rng()):t.scaleYOverLifeMin,c.resourceId=u.id,c.colorSample=u.colorMode==="random"?gf(u.colorGradient,la(t.seed,d,2654435769)):_o(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=Er[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=Ka(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=Ka(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=Er[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 Yi(s,e,t){return s+(e-s)*t}function Ac(s,e){return Number.isFinite(s)?s:e}function Ka(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 kv(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 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=o*n*e-h*r*t,c=h*n*e+o*r*t;return{x:l,y:-c}}function NI(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 UI(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,M,R,P)=>{const F=R/a,I=P/o,k=Math.max(1e-4,Math.hypot(F,I)),O=F/k,L=I/k,U=n*O-r*L,B=r*O+n*L;return{x:s.x+n*T*a-r*M*o+U*.05,y:s.y+r*T*a+n*M*o+B*.05,nx:U,ny:B}};if(s.shape==="circle"){const T=Math.max(.001,s.radius),M=Math.hypot(c,u);if(M>=T)return null;const R=M>1e-4?c/M:1,P=M>1e-4?u/M:0;return d(R*T,P*T,R,P)}if(s.shape==="ellipse"){const T=Math.max(.001,s.radiusX),M=Math.max(.001,s.radiusY),R=Math.hypot(c/T,u/M);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/(M*M)));return d(F,I,F/(T*T)/k,I/(M*M)/k)}if(s.shape==="rect"){const T=Math.max(.001,s.width*.5),M=Math.max(.001,s.height*.5);if(Math.abs(c)>=T||Math.abs(u)>=M)return null;const R=T-Math.abs(c),P=M-Math.abs(u);if(R<P){const I=c>=0?1:-1;return d(I*T,u,I,0)}const F=u>=0?1:-1;return d(c,F*M,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,M)=>{const R=Math.PI*.5+M/f*Math.PI*2;return{x:Math.cos(R)*p,y:Math.sin(R)*m}});let v=!1;for(let T=0,M=g.length-1;T<g.length;M=T++){const R=g[T],P=g[M];R.y>u!=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<g.length;T++){const M=g[T],R=g[(T+1)%g.length],P=R.x-M.x,F=R.y-M.y,I=Math.max(1e-4,P*P+F*F),k=Math.min(1,Math.max(0,((c-M.x)*P+(u-M.y)*F)/I)),O=M.x+P*k,L=M.y+F*k,U=Math.hypot(O-c,L-u);U<w&&(w=U,b=O,y=L)}const A=Math.max(1e-4,Math.hypot(b-c,y-u));return d(b,y,(b-c)/A,(y-u)/A)}function XI(s){return Math.min(1,Math.max(0,1-s.life/Math.max(1e-4,s.maxLife)))}function la(s,e,t){let i=(s>>>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 Za(s,e,t,i,n){return s==="fixed"?e:s==="curve"?Yi(e,t,yn(i,n)):Yi(e,t,n)}function mf(s,e,t,i,n,r){return s==="curve"?Yi(e,t,yn(i,n)):s==="random"?r:e}function Fv(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 yn(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.length-1;n++)if(e>=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 Yi(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;Fv(r.x,h,c,a.x,m)<e?d=m:f=m}return Fv(r.y,l,u,a.y,(d+f)/2)}return i[i.length-1].y}function pf(s){let e=s>>>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 _o(s){let e=s.replace("#","");return e.length===3&&(e=e.split("").map(t=>t+t).join("")),parseInt(e,16)}function VI(s,e,t){const i=Ov(s),n=Ov(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 _o(t[0].color);if(e>=t[t.length-1].position)return _o(t[t.length-1].color);for(let i=0;i<t.length-1;i++){const n=t[i],r=t[i+1];if(e<n.position||e>r.position)continue;const a=(e-n.position)/Math.max(1e-4,r.position-n.position);return VI(n.color,r.color,a)}return _o(t[t.length-1].color)}function Ov(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 Oa=new Map,Ia=new Map;function YI(s){return[...Oa.values()].some(e=>e===s)}function f1(s){if(!(YI(s)||(Ia.get(s)||0)>0)){Ia.delete(s);for(const e of s.textures)e.destroy(!0)}}function $I(s){const e=Ia.get(s)||0;e>1?Ia.set(s,e-1):Ia.delete(s),f1(s)}function GI(s){return Oa.get(s)||null}function Au(s,e){ql(s),Oa.set(s,e)}function HI(s){const e=Oa.get(s);return e?(Ia.set(e,(Ia.get(e)||0)+1),e):null}function jI(s,e){const t=Oa.get(s);return t?(Au(e,t),!0):!1}function ql(s){const e=Oa.get(s);e&&(Oa.delete(s),f1(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 m1=["3.8","4.0","4.1","4.2","4.3"];function Ph(s){const e=String(s||"").trim();return m1.find(t=>e===t||e.startsWith(`${t}.`))||null}function _m(){return m1.join(" / ")}function WI(s){return s==="4.3"?"4.3":"4.2"}function Tp(){return{imagesPath:"./images/",spineVersion:"4.2",keyframeCurve:"linear",fps:30,omitFps:!1,integerFrameAlignment:!0,bonePool:!0,excludeEmptyAnimations:!1,fileName:"SpineParticle.json"}}function p1(s){const e=Object.assign(Tp(),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 Mm=30;function Kc(s,e=1){return Math.min(1800,Math.max(1,Math.ceil(Number(s)||e)))}function g1(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)),Mm)}function Dr(s,e=30){const t=Kc(s.loopDurationFrames),i=g1(s,e),n=s.generateLoopStartAnimation?s.loopStartUseCustomDuration?Kc(s.loopStartDurationFrames,Mm):i:0,r=s.generateLoopEndAnimation?s.loopEndUseCustomDuration?Kc(s.loopEndDurationFrames,Mm):i:0;return{start:n,loop:t,end:r,total:n+t+r}}function v1(s,e){const t=Dr(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 zI(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=pT("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:Tp()}}),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=Nl();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="",jI(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=Gr(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.start||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.frame<e.start&&(this.timeline.frame=e.start)},setPlaybackEnd(s){const e=Zc(this.timeline.playbackStart,s,this.timeline.totalFrames);this.timeline.playbackStart=e.start,this.timeline.playbackEnd=e.end,this.timeline.frame>e.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)+Dr(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=zI({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}}}),y1="SpineParticle.SystemSettings",x1=1,vf="SpineParticle.SystemSettings.v1";function Zo(s,e,t,i){const n=Number(s);return Math.min(t,Math.max(e,Number.isFinite(n)?n:i))}function qI(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 KI(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(Zo(s.undoLimit,1,200,e.undoLimit)),showEmitter:t("showEmitter"),showBones:t("showBones"),bonePointDrawSize:Zo(s.bonePointDrawSize,.1,10,e.bonePointDrawSize),boneAxisDrawSize:Zo(s.boneAxisDrawSize,.1,10,e.boneAxisDrawSize),showSkinMesh:t("showSkinMesh"),tickEnabled:t("tickEnabled"),axisFontSize:Math.round(Zo(s.axisFontSize,8,40,e.axisFontSize)),tickWidth:Zo(s.tickWidth,1,5,e.tickWidth),showAxisLabels:t("showAxisLabels"),axisColor:i}}function ZI(s){let e;try{e=JSON.parse(s)}catch{throw new Error("系统设置缓存不是有效的 JSON")}const t=e;if(t.format!==y1)throw new Error("不是 Spine粒子编辑器系统设置缓存");if(t.version!==x1)throw new Error(`暂不支持系统配置版本:${t.version??"未知"}`);if(!t.settings||typeof t.settings!="object")throw new Error("系统设置缓存缺少 settings");return t}function JI(s,e){Object.assign(s.settings,KI(e,s.settings))}let kc=null;function QI(s){kc==null||kc();try{const e=localStorage.getItem(vf);e&&JI(s,ZI(e).settings)}catch{try{localStorage.removeItem(vf)}catch{}}kc=cs(()=>qI(s.settings),e=>{const t={format:y1,version:x1,savedAt:new Date().toISOString(),settings:e};try{localStorage.setItem(vf,JSON.stringify(t))}catch{}},{deep:!0})}function Bv(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 Lv(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{...Lv(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;p<t;p++){const m=s.points[p],g=s.points[(p+1)%s.points.length];for(let v=0;v<=20;v++){if(p>0&&v===0)continue;const b=v/20,y=Bv(m.x,m.x+m.outX,g.x+g.inX,g.x,b),w=Bv(m.y,m.y+m.outY,g.y+g.inY,g.y,b),A=Lv(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 Ki(s){return s.map(e=>({...e,trailState:e.trailState?{...e.trailState,bones:e.trailState.bones.map(t=>({...t}))}:void 0}))}function eR(s){const e=new Map;for(const i of s)for(const n of i)e.has(n.boneName)||e.set(n.boneName,Ki([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<s.length;i++){const n=new Map(s[i].map(r=>[r.boneName,r]));s[i]=t.map(r=>{const a=n.get(r);return a||{...Ki([e.get(r)])[0],alpha:0,imageVisible:!1,trailState:void 0,active:!0}})}}function tR(s){s.length<2||(s[s.length-1]=Ki(s[0]))}function iR(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(Ki(s[r]||[]))}return i}function xf(s){return`${s.boneName}:${s.spawnId??"legacy"}`}function Dv(s){return{...Ki([s])[0],alpha:0,imageVisible:!1,trailState:void 0,active:!0}}function sR(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 Ki([u])[0];const d=(f=a.get(xf(u)))==null?void 0:f.get(c);return d?Ki([d])[0]:Dv(u)}))}return h[0]=h[0].map(Dv),h[h.length-1]=Ki(e),h}function Nv(s,e){const t=s.length?1:0;for(let i=t;i<e.length;i++)s.push(Ki(e[i]))}function nR(s,e,t,i){var v;const n=s.config,r=1/Math.max(1,t),a=n.lifeMode==="fixed"?Math.max(0,Number(n.lifeMin)||0):Math.max(0,Number(n.lifeMin)||0,Number(n.lifeMax)||0),o=Dr(n,t),h=Math.max(1,Math.ceil(a*t)),l=Math.max(1,Math.ceil(h/o.loop)),c=Math.max(0,Math.ceil(Math.max(0,Number(n.delay)||0)*t)),u=[],d=b=>{const y=b?[[]]:[];e.reset();for(let w=0;w<l;w++){w>0&&e.restartEmissionCycle();for(let A=0;A<o.loop;A++)e.update(r,"force"),b&&y.push(e.capture())}return{seam:e.capture(),warmup:y}},f=d(n.generateLoopStartAnimation),p=Ki(f.seam),m=[Ki(p)];e.restartEmissionCycle();for(let b=0;b<o.loop;b++)e.update(r,"force"),m.push(e.capture());eR(m),tR(m);for(let b=0;b<c;b++)u.push([]);if(n.generateLoopStartAnimation){const b=sR(f.warmup,m[0],o.start,h);for(const y of b)u.push(Ki(y))}else u.push(Ki(m[0]));if(Nv(u,m),n.generateLoopEndAnimation){d(!1);const b=[Ki(m[0])],y=Math.max(1,h+2);for(let w=0;w<y&&e.activeCount>0;w++)e.update(r,"off"),b.push(e.capture());(v=b[b.length-1])!=null&&v.length&&b.push([]),Nv(u,iR(b,o.end))}const g=Ki(u[u.length-1]||[]);for(u.length>i&&(u.length=i);u.length<i;)u.push(Ki(g));s.frames=u,e.apply(u[0]||[])}class rR{constructor(){x(this,"container",new ji);x(this,"entries",new Map)}sync(e,t,i){var n;for(const[r,a]of this.entries)e.some(o=>o.id===r)||(this.container.removeChild(a.root),a.root.destroy({children:!0}),this.entries.delete(r));for(const r of e){const a=GI(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 b1=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;i<n;i++)this.add(e[i]);return t!=this.size}contains(e){return this.entries[e]}clear(){this.entries={},this.size=0}};var qi;let Mt=(qi=class{constructor(e=0,t=0,i=0,n=0){x(this,"r");x(this,"g");x(this,"b");x(this,"a");this.r=e,this.g=t,this.b=i,this.a=n}set(e,t,i,n){return this.r=e,this.g=t,this.b=i,this.a=n,this.clamp()}setFromColor(e){return this.r=e.r,this.g=e.g,this.b=e.b,this.a=e.a,this}setFromString(e){return e=e.charAt(0)=="#"?e.substr(1):e,this.r=parseInt(e.substr(0,2),16)/255,this.g=parseInt(e.substr(2,2),16)/255,this.b=parseInt(e.substr(4,2),16)/255,this.a=e.length!=8?1:parseInt(e.substr(6,2),16)/255,this}add(e,t,i,n){return this.r+=e,this.g+=t,this.b+=i,this.a+=n,this.clamp()}clamp(){return this.r<0?this.r=0:this.r>1&&(this.r=1),this.g<0?this.g=0:this.g>1&&(this.g=1),this.b<0?this.b=0:this.b>1&&(this.b=1),this.a<0?this.a=0:this.a>1&&(this.a=1),this}static rgba8888ToColor(e,t){e.r=((t&4278190080)>>>24)/255,e.g=((t&16711680)>>>16)/255,e.b=((t&65280)>>>8)/255,e.a=(t&255)/255}static rgb888ToColor(e,t){e.r=((t&16711680)>>>16)/255,e.g=((t&65280)>>>8)/255,e.b=(t&255)/255}toRgb888(){const e=t=>("0"+(t*255).toString(16)).slice(-2);return+("0x"+e(this.r)+e(this.g)+e(this.b))}static fromString(e,t=new qi){return t.setFromString(e)}},x(qi,"WHITE",new qi(1,1,1,1)),x(qi,"RED",new qi(1,0,0,1)),x(qi,"GREEN",new qi(0,1,0,1)),x(qi,"BLUE",new qi(0,0,1,1)),x(qi,"MAGENTA",new qi(1,0,1,1)),qi);var wi;let $e=(wi=class{static clamp(e,t,i){return e<t?t:e>i?i:e}static cosDeg(e){return Math.cos(e*wi.degRad)}static sinDeg(e){return Math.sin(e*wi.degRad)}static atan2Deg(e,t){return Math.atan2(e,t)*wi.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 wi.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(wi,"PI",3.1415927),x(wi,"PI2",wi.PI*2),x(wi,"invPI2",1/wi.PI2),x(wi,"radiansToDegrees",180/wi.PI),x(wi,"radDeg",wi.radiansToDegrees),x(wi,"degreesToRadians",wi.PI/180),x(wi,"degRad",wi.degreesToRadians),wi);var Ws;let Ge=(Ws=class{static arrayCopy(e,t,i,n,r){for(let a=t,o=n;a<t+r;a++,o++)i[o]=e[a]}static arrayFill(e,t,i,n){for(let r=t;r<i;r++)e[r]=n}static setArraySize(e,t,i=0){let n=e.length;if(n==t)return e;if(e.length=t,n<t)for(let r=n;r<t;r++)e[r]=i;return e}static ensureArrayCapacity(e,t,i=0){return e.length>=t?e:Ws.setArraySize(e,t,i)}static newArray(e,t){let i=new Array(e);for(let n=0;n<e;n++)i[n]=t;return i}static newFloatArray(e){if(Ws.SUPPORTS_TYPED_ARRAYS)return new Float32Array(e);{let t=new Array(e);for(let i=0;i<t.length;i++)t[i]=0;return t}}static newShortArray(e){if(Ws.SUPPORTS_TYPED_ARRAYS)return new Int16Array(e);{let t=new Array(e);for(let i=0;i<t.length;i++)t[i]=0;return t}}static toFloatArray(e){return Ws.SUPPORTS_TYPED_ARRAYS?new Float32Array(e):e}static toSinglePrecision(e){return Ws.SUPPORTS_TYPED_ARRAYS?Math.fround(e):e}static webkit602BugfixHelper(e,t){}static contains(e,t,i=!0){for(var n=0;n<e.length;n++)if(e[n]==t)return!0;return!1}static enumValue(e,t){return e[t[0].toUpperCase()+t.slice(1)]}},x(Ws,"SUPPORTS_TYPED_ARRAYS",typeof Float32Array<"u"),Ws),kh=class{constructor(e){x(this,"items",new Array);x(this,"instantiator");this.instantiator=e}obtain(){return this.items.length>0?this.items.pop():this.instantiator()}free(e){e.reset&&e.reset(),this.items.push(e)}freeAll(e){for(let t=0;t<e.length;t++)this.free(e[t])}clear(){this.items.length=0}},Fh=class{constructor(e=0,t=0){x(this,"x");x(this,"y");this.x=e,this.y=t}set(e,t){return this.x=e,this.y=t,this}length(){let e=this.x,t=this.y;return Math.sqrt(e*e+t*t)}normalize(){let e=this.length();return e!=0&&(this.x/=e,this.y/=e),this}},w1=class{constructor(e){x(this,"name");if(!e)throw new Error("name cannot be null.");this.name=e}};var ba;let mr=(ba=class extends w1{constructor(t){super(t);x(this,"id",ba.nextID++);x(this,"bones",null);x(this,"vertices",[]);x(this,"worldVerticesLength",0);x(this,"timelineAttachment",this)}computeWorldVertices(t,i,n,r,a,o){n=a+(n>>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,M=a;M<n;T+=2,M+=o){let R=c[T],P=c[T+1];r[M]=R*b+P*y+g,r[M+1]=R*w+P*A+v}return}let d=0,f=0;for(let m=0;m<i;m+=2){let g=u[d];d+=g+1,f+=g}let p=h.bones;if(l.length==0)for(let m=a,g=f*3;m<n;m+=o){let v=0,b=0,y=u[d++];for(y+=d;d<y;d++,g+=3){let w=p[u[d]],A=c[g],T=c[g+1],M=c[g+2];v+=(A*w.a+T*w.b+w.worldX)*M,b+=(A*w.c+T*w.d+w.worldY)*M}r[m]=v,r[m+1]=b}else{let m=l;for(let g=a,v=f*3,b=f<<1;g<n;g+=o){let y=0,w=0,A=u[d++];for(A+=d;d<A;d++,v+=3,b+=2){let T=p[u[d]],M=c[v]+m[b],R=c[v+1]+m[b+1],P=c[v+2];y+=(M*T.a+R*T.b+T.worldX)*P,w+=(M*T.c+R*T.d+T.worldY)*P}r[g]=y,r[g+1]=w}}}copyTo(t){this.bones?(t.bones=new Array(this.bones.length),Ge.arrayCopy(this.bones,0,t.bones,0,this.bones.length)):t.bones=null,this.vertices&&(t.vertices=Ge.newFloatArray(this.vertices.length),Ge.arrayCopy(this.vertices,0,t.vertices,0,this.vertices.length)),t.worldVerticesLength=this.worldVerticesLength,t.timelineAttachment=this.timelineAttachment}},x(ba,"nextID",0),ba);var nr;let S1=(nr=class{constructor(e){x(this,"id",nr.nextID());x(this,"regions");x(this,"start",0);x(this,"digits",0);x(this,"setupIndex",0);this.regions=new Array(e)}copy(){let e=new nr(this.regions.length);return Ge.arrayCopy(this.regions,0,e.regions,0,this.regions.length),e.start=this.start,e.digits=this.digits,e.setupIndex=this.setupIndex,e}apply(e,t){let i=e.sequenceIndex;i==-1&&(i=this.setupIndex),i>=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 nr._nextID++}},x(nr,"_nextID",0),nr);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 _1=[$i.hold,$i.once,$i.loop,$i.pingpong,$i.onceReverse,$i.loopReverse,$i.pingpongReverse];let Ap=class{constructor(e,t,i){x(this,"name");x(this,"timelines",[]);x(this,"timelineIds",new b1);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;t<e.length;t++)this.timelineIds.addAll(e[t].getPropertyIds())}hasTimeline(e){for(let t=0;t<e.length;t++)if(this.timelineIds.contains(e[t]))return!0;return!1}apply(e,t,i,n,r,a,o,h){if(!e)throw new Error("skeleton cannot be null.");n&&this.duration!=0&&(i%=this.duration,t>0&&(t%=this.duration));let l=this.timelines;for(let c=0,u=l.length;c<u;c++)l[c].apply(e,t,i,r,a,o,h)}};var Ee;(function(s){s[s.setup=0]="setup",s[s.first=1]="first",s[s.replace=2]="replace",s[s.add=3]="add"})(Ee||(Ee={}));var Qi;(function(s){s[s.mixIn=0]="mixIn",s[s.mixOut=1]="mixOut"})(Qi||(Qi={}));const At={rotate:0,x:1,y:2,scaleX:3,scaleY:4,shearX:5,shearY:6,inherit:7,rgb:8,alpha:9,rgb2:10,attachment:11,deform:12,event:13,drawOrder:14,ikConstraint:15,transformConstraint:16,pathConstraintPosition:17,pathConstraintSpacing:18,pathConstraintMix:19,physicsConstraintInertia:20,physicsConstraintStrength:21,physicsConstraintDamping:22,physicsConstraintMass:23,physicsConstraintWind:24,physicsConstraintGravity:25,physicsConstraintMix:26,physicsConstraintReset:27,sequence:28};let ui=class{constructor(e,t){x(this,"propertyIds");x(this,"frames");this.propertyIds=t,this.frames=Ge.newFloatArray(e*this.getFrameEntries())}getPropertyIds(){return this.propertyIds}getFrameEntries(){return 1}getFrameCount(){return this.frames.length/this.getFrameEntries()}getDuration(){return this.frames[this.frames.length-this.getFrameEntries()]}static search1(e,t){let i=e.length;for(let n=1;n<i;n++)if(e[n]>t)return n-1;return i-1}static search(e,t,i){let n=e.length;for(let r=i;r<n;r+=i)if(e[r]>t)return r-i;return n-i}},Dn=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,M=r+A,R=a+T;for(let P=p+18;p<P;p+=2)f[p]=M,f[p+1]=R,A+=y,T+=w,y+=v,w+=b,M+=A,R+=T}getBezierValue(t,i,n,r){let a=this.curves;if(a[r]>t){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<o;r+=2)if(a[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)}},nn=class extends Dn{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<this.frames[0]){switch(i){case Ee.setup:return r;case Ee.first:return n+(r-n)*t}return n}let a=this.getCurveValue(e);switch(i){case Ee.setup:return r+a*t;case Ee.first:case Ee.replace:a+=r-n}return n+a*t}getAbsoluteValue(e,t,i,n,r){if(e<this.frames[0]){switch(i){case Ee.setup:return r;case Ee.first:return n+(r-n)*t}return n}let a=this.getCurveValue(e);return i==Ee.setup?r+(a-r)*t:n+(a-n)*t}getAbsoluteValue2(e,t,i,n,r,a){if(e<this.frames[0]){switch(i){case Ee.setup:return r;case Ee.first:return n+(r-n)*t}return n}return i==Ee.setup?r+(a-r)*t:n+(a-n)*t}getScaleValue(e,t,i,n,r,a){const o=this.frames;if(e<o[0]){switch(i){case Ee.setup:return a;case Ee.first:return r+(a-r)*t}return r}let h=this.getCurveValue(e)*a;if(t==1)return i==Ee.add?r+h-a:h;if(n==Qi.mixOut)switch(i){case Ee.setup:return a+(Math.abs(h)*$e.signum(a)-a)*t;case Ee.first:case Ee.replace:return r+(Math.abs(h)*$e.signum(r)-r)*t}else{let l=0;switch(i){case Ee.setup:return l=Math.abs(a)*$e.signum(h),l+(h-l)*t;case Ee.first:case Ee.replace:return l=Math.abs(r)*$e.signum(h),l+(h-l)*t}}return r+(h-a)*t}};class Ep extends Dn{constructor(e,t,i,n){super(e,t,[i,n])}getFrameEntries(){return 3}setFrame(e,t,i,n){e*=3,this.frames[e]=t,this.frames[e+1]=i,this.frames[e+2]=n}}let Oh=class extends nn{constructor(t,i,n){super(t,i,At.rotate+"|"+n);x(this,"boneIndex",0);this.boneIndex=n}apply(t,i,n,r,a,o,h){let l=t.bones[this.boneIndex];l.active&&(l.rotation=this.getRelativeValue(n,a,o,l.rotation,l.data.rotation))}},M1=class extends Ep{constructor(t,i,n){super(t,i,At.x+"|"+n,At.y+"|"+n);x(this,"boneIndex",0);this.boneIndex=n}apply(t,i,n,r,a,o,h){let l=t.bones[this.boneIndex];if(!l.active)return;let c=this.frames;if(n<c[0]){switch(o){case Ee.setup:l.x=l.data.x,l.y=l.data.y;return;case Ee.first:l.x+=(l.data.x-l.x)*a,l.y+=(l.data.y-l.y)*a}return}let u=0,d=0,f=ui.search(c,n,3),p=this.curves[f/3];switch(p){case 0:let m=c[f];u=c[f+1],d=c[f+2];let g=(n-m)/(c[f+3]-m);u+=(c[f+3+1]-u)*g,d+=(c[f+3+2]-d)*g;break;case 1:u=c[f+1],d=c[f+2];break;default:u=this.getBezierValue(n,f,1,p-2),d=this.getBezierValue(n,f,2,p+18-2)}switch(o){case Ee.setup:l.x=l.data.x+u*a,l.y=l.data.y+d*a;break;case Ee.first:case Ee.replace:l.x+=(l.data.x+u-l.x)*a,l.y+=(l.data.y+d-l.y)*a;break;case Ee.add:l.x+=u*a,l.y+=d*a}}},T1=class extends nn{constructor(t,i,n){super(t,i,At.x+"|"+n);x(this,"boneIndex",0);this.boneIndex=n}apply(t,i,n,r,a,o,h){let l=t.bones[this.boneIndex];l.active&&(l.x=this.getRelativeValue(n,a,o,l.x,l.data.x))}},A1=class extends nn{constructor(t,i,n){super(t,i,At.y+"|"+n);x(this,"boneIndex",0);this.boneIndex=n}apply(t,i,n,r,a,o,h){let l=t.bones[this.boneIndex];l.active&&(l.y=this.getRelativeValue(n,a,o,l.y,l.data.y))}},E1=class extends Ep{constructor(t,i,n){super(t,i,At.scaleX+"|"+n,At.scaleY+"|"+n);x(this,"boneIndex",0);this.boneIndex=n}apply(t,i,n,r,a,o,h){let l=t.bones[this.boneIndex];if(!l.active)return;let c=this.frames;if(n<c[0]){switch(o){case Ee.setup:l.scaleX=l.data.scaleX,l.scaleY=l.data.scaleY;return;case Ee.first:l.scaleX+=(l.data.scaleX-l.scaleX)*a,l.scaleY+=(l.data.scaleY-l.scaleY)*a}return}let u,d,f=ui.search(c,n,3),p=this.curves[f/3];switch(p){case 0:let m=c[f];u=c[f+1],d=c[f+2];let g=(n-m)/(c[f+3]-m);u+=(c[f+3+1]-u)*g,d+=(c[f+3+2]-d)*g;break;case 1:u=c[f+1],d=c[f+2];break;default:u=this.getBezierValue(n,f,1,p-2),d=this.getBezierValue(n,f,2,p+18-2)}if(u*=l.data.scaleX,d*=l.data.scaleY,a==1)o==Ee.add?(l.scaleX+=u-l.data.scaleX,l.scaleY+=d-l.data.scaleY):(l.scaleX=u,l.scaleY=d);else{let m=0,g=0;if(h==Qi.mixOut)switch(o){case Ee.setup:m=l.data.scaleX,g=l.data.scaleY,l.scaleX=m+(Math.abs(u)*$e.signum(m)-m)*a,l.scaleY=g+(Math.abs(d)*$e.signum(g)-g)*a;break;case Ee.first:case Ee.replace:m=l.scaleX,g=l.scaleY,l.scaleX=m+(Math.abs(u)*$e.signum(m)-m)*a,l.scaleY=g+(Math.abs(d)*$e.signum(g)-g)*a;break;case Ee.add:l.scaleX+=(u-l.data.scaleX)*a,l.scaleY+=(d-l.data.scaleY)*a}else switch(o){case Ee.setup:m=Math.abs(l.data.scaleX)*$e.signum(u),g=Math.abs(l.data.scaleY)*$e.signum(d),l.scaleX=m+(u-m)*a,l.scaleY=g+(d-g)*a;break;case Ee.first:case Ee.replace:m=Math.abs(l.scaleX)*$e.signum(u),g=Math.abs(l.scaleY)*$e.signum(d),l.scaleX=m+(u-m)*a,l.scaleY=g+(d-g)*a;break;case Ee.add:l.scaleX+=(u-l.data.scaleX)*a,l.scaleY+=(d-l.data.scaleY)*a}}}},C1=class extends nn{constructor(t,i,n){super(t,i,At.scaleX+"|"+n);x(this,"boneIndex",0);this.boneIndex=n}apply(t,i,n,r,a,o,h){let l=t.bones[this.boneIndex];l.active&&(l.scaleX=this.getScaleValue(n,a,o,h,l.scaleX,l.data.scaleX))}},I1=class extends nn{constructor(t,i,n){super(t,i,At.scaleY+"|"+n);x(this,"boneIndex",0);this.boneIndex=n}apply(t,i,n,r,a,o,h){let l=t.bones[this.boneIndex];l.active&&(l.scaleY=this.getScaleValue(n,a,o,h,l.scaleY,l.data.scaleY))}},R1=class extends Ep{constructor(t,i,n){super(t,i,At.shearX+"|"+n,At.shearY+"|"+n);x(this,"boneIndex",0);this.boneIndex=n}apply(t,i,n,r,a,o,h){let l=t.bones[this.boneIndex];if(!l.active)return;let c=this.frames;if(n<c[0]){switch(o){case Ee.setup:l.shearX=l.data.shearX,l.shearY=l.data.shearY;return;case Ee.first:l.shearX+=(l.data.shearX-l.shearX)*a,l.shearY+=(l.data.shearY-l.shearY)*a}return}let u=0,d=0,f=ui.search(c,n,3),p=this.curves[f/3];switch(p){case 0:let m=c[f];u=c[f+1],d=c[f+2];let g=(n-m)/(c[f+3]-m);u+=(c[f+3+1]-u)*g,d+=(c[f+3+2]-d)*g;break;case 1:u=c[f+1],d=c[f+2];break;default:u=this.getBezierValue(n,f,1,p-2),d=this.getBezierValue(n,f,2,p+18-2)}switch(o){case Ee.setup:l.shearX=l.data.shearX+u*a,l.shearY=l.data.shearY+d*a;break;case Ee.first:case Ee.replace:l.shearX+=(l.data.shearX+u-l.shearX)*a,l.shearY+=(l.data.shearY+d-l.shearY)*a;break;case Ee.add:l.shearX+=u*a,l.shearY+=d*a}}},P1=class extends nn{constructor(t,i,n){super(t,i,At.shearX+"|"+n);x(this,"boneIndex",0);this.boneIndex=n}apply(t,i,n,r,a,o,h){let l=t.bones[this.boneIndex];l.active&&(l.shearX=this.getRelativeValue(n,a,o,l.shearX,l.data.shearX))}},k1=class extends nn{constructor(t,i,n){super(t,i,At.shearY+"|"+n);x(this,"boneIndex",0);this.boneIndex=n}apply(t,i,n,r,a,o,h){let l=t.bones[this.boneIndex];l.active&&(l.shearY=this.getRelativeValue(n,a,o,l.shearY,l.data.shearY))}},F1=class extends ui{constructor(t,i){super(t,[At.inherit+"|"+i]);x(this,"boneIndex",0);this.boneIndex=i}getFrameEntries(){return 2}setFrame(t,i,n){t*=2,this.frames[t]=i,this.frames[t+1]=n}apply(t,i,n,r,a,o,h){let l=t.bones[this.boneIndex];if(!l.active)return;if(h==Qi.mixOut){o==Ee.setup&&(l.inherit=l.data.inherit);return}let c=this.frames;if(n<c[0]){(o==Ee.setup||o==Ee.first)&&(l.inherit=l.data.inherit);return}l.inherit=this.frames[ui.search(c,n,2)+1]}},O1=class extends Dn{constructor(t,i,n){super(t,i,[At.rgb+"|"+n,At.alpha+"|"+n]);x(this,"slotIndex",0);this.slotIndex=n}getFrameEntries(){return 5}setFrame(t,i,n,r,a,o){t*=5,this.frames[t]=i,this.frames[t+1]=n,this.frames[t+2]=r,this.frames[t+3]=a,this.frames[t+4]=o}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;if(n<c[0]){let b=l.data.color;switch(o){case Ee.setup:u.setFromColor(b);return;case Ee.first:u.add((b.r-u.r)*a,(b.g-u.g)*a,(b.b-u.b)*a,(b.a-u.a)*a)}return}let d=0,f=0,p=0,m=0,g=ui.search(c,n,5),v=this.curves[g/5];switch(v){case 0:let b=c[g];d=c[g+1],f=c[g+2],p=c[g+3],m=c[g+4];let y=(n-b)/(c[g+5]-b);d+=(c[g+5+1]-d)*y,f+=(c[g+5+2]-f)*y,p+=(c[g+5+3]-p)*y,m+=(c[g+5+4]-m)*y;break;case 1:d=c[g+1],f=c[g+2],p=c[g+3],m=c[g+4];break;default:d=this.getBezierValue(n,g,1,v-2),f=this.getBezierValue(n,g,2,v+18-2),p=this.getBezierValue(n,g,3,v+36-2),m=this.getBezierValue(n,g,4,v+54-2)}a==1?u.set(d,f,p,m):(o==Ee.setup&&u.setFromColor(l.data.color),u.add((d-u.r)*a,(f-u.g)*a,(p-u.b)*a,(m-u.a)*a))}},B1=class extends Dn{constructor(t,i,n){super(t,i,[At.rgb+"|"+n]);x(this,"slotIndex",0);this.slotIndex=n}getFrameEntries(){return 4}setFrame(t,i,n,r,a){t<<=2,this.frames[t]=i,this.frames[t+1]=n,this.frames[t+2]=r,this.frames[t+3]=a}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;if(n<c[0]){let v=l.data.color;switch(o){case Ee.setup:u.r=v.r,u.g=v.g,u.b=v.b;return;case Ee.first:u.r+=(v.r-u.r)*a,u.g+=(v.g-u.g)*a,u.b+=(v.b-u.b)*a}return}let d=0,f=0,p=0,m=ui.search(c,n,4),g=this.curves[m>>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==Ee.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}}},L1=class extends nn{constructor(t,i,n){super(t,i,At.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<this.frames[0]){let d=l.data.color;switch(o){case Ee.setup:c.a=d.a;return;case Ee.first:c.a+=(d.a-c.a)*a}return}let u=this.getCurveValue(n);a==1?c.a=u:(o==Ee.setup&&(c.a=l.data.color.a),c.a+=(u-c.a)*a)}},D1=class extends Dn{constructor(t,i,n){super(t,i,[At.rgb+"|"+n,At.alpha+"|"+n,At.rgb2+"|"+n]);x(this,"slotIndex",0);this.slotIndex=n}getFrameEntries(){return 8}setFrame(t,i,n,r,a,o,h,l,c){t<<=3,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,this.frames[t+7]=c}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(n<c[0]){let T=l.data.color,M=l.data.darkColor;switch(o){case Ee.setup:u.setFromColor(T),d.r=M.r,d.g=M.g,d.b=M.b;return;case Ee.first:u.add((T.r-u.r)*a,(T.g-u.g)*a,(T.b-u.b)*a,(T.a-u.a)*a),d.r+=(M.r-d.r)*a,d.g+=(M.g-d.g)*a,d.b+=(M.b-d.b)*a}return}let f=0,p=0,m=0,g=0,v=0,b=0,y=0,w=ui.search(c,n,8),A=this.curves[w>>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 M=(n-T)/(c[w+8]-T);f+=(c[w+8+1]-f)*M,p+=(c[w+8+2]-p)*M,m+=(c[w+8+3]-m)*M,g+=(c[w+8+4]-g)*M,v+=(c[w+8+5]-v)*M,b+=(c[w+8+6]-b)*M,y+=(c[w+8+7]-y)*M;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==Ee.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}}},N1=class extends Dn{constructor(t,i,n){super(t,i,[At.rgb+"|"+n,At.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(n<c[0]){let A=l.data.color,T=l.data.darkColor;switch(o){case Ee.setup:u.r=A.r,u.g=A.g,u.b=A.b,d.r=T.r,d.g=T.g,d.b=T.b;return;case Ee.first:u.r+=(A.r-u.r)*a,u.g+=(A.g-u.g)*a,u.b+=(A.b-u.b)*a,d.r+=(T.r-d.r)*a,d.g+=(T.g-d.g)*a,d.b+=(T.b-d.b)*a}return}let f=0,p=0,m=0,g=0,v=0,b=0,y=ui.search(c,n,7),w=this.curves[y/7];switch(w){case 0:let A=c[y];f=c[y+1],p=c[y+2],m=c[y+3],g=c[y+4],v=c[y+5],b=c[y+6];let T=(n-A)/(c[y+7]-A);f+=(c[y+7+1]-f)*T,p+=(c[y+7+2]-p)*T,m+=(c[y+7+3]-m)*T,g+=(c[y+7+4]-g)*T,v+=(c[y+7+5]-v)*T,b+=(c[y+7+6]-b)*T;break;case 1:f=c[y+1],p=c[y+2],m=c[y+3],g=c[y+4],v=c[y+5],b=c[y+6];break;default:f=this.getBezierValue(n,y,1,w-2),p=this.getBezierValue(n,y,2,w+18-2),m=this.getBezierValue(n,y,3,w+36-2),g=this.getBezierValue(n,y,4,w+54-2),v=this.getBezierValue(n,y,5,w+72-2),b=this.getBezierValue(n,y,6,w+90-2)}if(a==1)u.r=f,u.g=p,u.b=m,d.r=g,d.g=v,d.b=b;else{if(o==Ee.setup){let A=l.data.color,T=l.data.darkColor;u.r=A.r,u.g=A.g,u.b=A.b,d.r=T.r,d.g=T.g,d.b=T.b}u.r+=(f-u.r)*a,u.g+=(p-u.g)*a,u.b+=(m-u.b)*a,d.r+=(g-d.r)*a,d.g+=(v-d.g)*a,d.b+=(b-d.b)*a}}},co=class extends ui{constructor(t,i){super(t,[At.attachment+"|"+i]);x(this,"slotIndex",0);x(this,"attachmentNames");this.slotIndex=i,this.attachmentNames=new Array(t)}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){let l=t.slots[this.slotIndex];if(l.bone.active){if(h==Qi.mixOut){o==Ee.setup&&this.setAttachment(t,l,l.data.attachmentName);return}if(n<this.frames[0]){(o==Ee.setup||o==Ee.first)&&this.setAttachment(t,l,l.data.attachmentName);return}this.setAttachment(t,l,this.attachmentNames[ui.search1(this.frames,n)])}}setAttachment(t,i,n){i.setAttachment(n?t.getAttachment(this.slotIndex,n):null)}},U1=class extends Dn{constructor(t,i,n,r){super(t,i,[At.deform+"|"+n+"|"+r.id]);x(this,"slotIndex",0);x(this,"attachment");x(this,"vertices");this.slotIndex=n,this.attachment=r,this.vertices=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,i,n){this.frames[t]=i,this.vertices[t]=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=c*.03-h*.06,v=((o-l)*3-r+u)*.006,b=(h-c+.33333333)*.018,y=m*2+v,w=g*2+b,A=(o-r)*.3+m+v*.16666667,T=h*.3+g+b*.16666667,M=r+A,R=T;for(let P=p+18;p<P;p+=2)f[p]=M,f[p+1]=R,A+=y,T+=w,y+=v,w+=b,M+=A,R+=T}getCurvePercent(t,i){let n=this.curves,r=n[i];switch(r){case 0:let l=this.frames[i];return(t-l)/(this.frames[i+this.getFrameEntries()]-l);case 1:return 0}if(r-=2,n[r]>t){let l=this.frames[i];return n[r+1]*(t-l)/(n[r]-l)}let a=r+18;for(r+=2;r<a;r+=2)if(n[r]>=t){let l=n[r-2],c=n[r-1];return c+(t-l)/(n[r]-l)*(n[r+1]-c)}let 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 mr)||c.timelineAttachment!=this.attachment)return;let u=l.deform;u.length==0&&(o=Ee.setup);let d=this.vertices,f=d[0].length,p=this.frames;if(n<p[0]){switch(o){case Ee.setup:u.length=0;return;case Ee.first:if(a==1){u.length=0;return}u.length=f;let w=c;if(w.bones){a=1-a;for(var m=0;m<f;m++)u[m]*=a}else{let A=w.vertices;for(var m=0;m<f;m++)u[m]+=(A[m]-u[m])*a}}return}if(u.length=f,n>=p[p.length-1]){let w=d[p.length-1];if(a==1)if(o==Ee.add){let A=c;if(A.bones)for(let T=0;T<f;T++)u[T]+=w[T];else{let T=A.vertices;for(let M=0;M<f;M++)u[M]+=w[M]-T[M]}}else Ge.arrayCopy(w,0,u,0,f);else switch(o){case Ee.setup:{let T=c;if(T.bones)for(let M=0;M<f;M++)u[M]=w[M]*a;else{let M=T.vertices;for(let R=0;R<f;R++){let P=M[R];u[R]=P+(w[R]-P)*a}}break}case Ee.first:case Ee.replace:for(let T=0;T<f;T++)u[T]+=(w[T]-u[T])*a;break;case Ee.add:let A=c;if(A.bones)for(let T=0;T<f;T++)u[T]+=w[T]*a;else{let T=A.vertices;for(let M=0;M<f;M++)u[M]+=(w[M]-T[M])*a}}return}let g=ui.search1(p,n),v=this.getCurvePercent(n,g),b=d[g],y=d[g+1];if(a==1)if(o==Ee.add){let w=c;if(w.bones)for(let A=0;A<f;A++){let T=b[A];u[A]+=T+(y[A]-T)*v}else{let A=w.vertices;for(let T=0;T<f;T++){let M=b[T];u[T]+=M+(y[T]-M)*v-A[T]}}}else for(let w=0;w<f;w++){let A=b[w];u[w]=A+(y[w]-A)*v}else switch(o){case Ee.setup:{let A=c;if(A.bones)for(let T=0;T<f;T++){let M=b[T];u[T]=(M+(y[T]-M)*v)*a}else{let T=A.vertices;for(let M=0;M<f;M++){let R=b[M],P=T[M];u[M]=P+(R+(y[M]-R)*v-P)*a}}break}case Ee.first:case Ee.replace:for(let A=0;A<f;A++){let T=b[A];u[A]+=(T+(y[A]-T)*v-u[A])*a}break;case Ee.add:let w=c;if(w.bones)for(let A=0;A<f;A++){let T=b[A];u[A]+=(T+(y[A]-T)*v)*a}else{let A=w.vertices;for(let T=0;T<f;T++){let M=b[T];u[T]+=(M+(y[T]-M)*v-A[T])*a}}}}};var wa;let Cp=(wa=class extends ui{constructor(t){super(t,wa.propertyIds);x(this,"events");this.events=new Array(t)}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){if(!r)return;let l=this.frames,c=this.frames.length;if(i>n)this.apply(t,i,Number.MAX_VALUE,r,a,o,h),i=-1;else if(i>=l[c-1])return;if(n<l[0])return;let u=0;if(i<l[0])u=0;else{u=ui.search1(l,i)+1;let d=l[u];for(;u>0&&l[u-1]==d;)u--}for(;u<c&&n>=l[u];u++)r.push(this.events[u])}},x(wa,"propertyIds",[""+At.event]),wa);var Sa;let vl=(Sa=class extends ui{constructor(t){super(t,Sa.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==Qi.mixOut){o==Ee.setup&&Ge.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);return}if(n<this.frames[0]){(o==Ee.setup||o==Ee.first)&&Ge.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);return}let l=ui.search1(this.frames,n),c=this.drawOrders[l];if(!c)Ge.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);else{let u=t.drawOrder,d=t.slots;for(let f=0,p=c.length;f<p;f++)u[f]=d[c[f]]}}},x(Sa,"propertyIds",[""+At.drawOrder]),Sa),X1=class extends Dn{constructor(t,i,n){super(t,i,[At.ikConstraint+"|"+n]);x(this,"constraintIndex",0);this.constraintIndex=n}getFrameEntries(){return 6}setFrame(t,i,n,r,a,o,h){t*=6,this.frames[t]=i,this.frames[t+1]=n,this.frames[t+2]=r,this.frames[t+3]=a,this.frames[t+4]=o?1:0,this.frames[t+5]=h?1:0}apply(t,i,n,r,a,o,h){let l=t.ikConstraints[this.constraintIndex];if(!l.active)return;let c=this.frames;if(n<c[0]){switch(o){case Ee.setup:l.mix=l.data.mix,l.softness=l.data.softness,l.bendDirection=l.data.bendDirection,l.compress=l.data.compress,l.stretch=l.data.stretch;return;case Ee.first:l.mix+=(l.data.mix-l.mix)*a,l.softness+=(l.data.softness-l.softness)*a,l.bendDirection=l.data.bendDirection,l.compress=l.data.compress,l.stretch=l.data.stretch}return}let u=0,d=0,f=ui.search(c,n,6),p=this.curves[f/6];switch(p){case 0:let m=c[f];u=c[f+1],d=c[f+2];let g=(n-m)/(c[f+6]-m);u+=(c[f+6+1]-u)*g,d+=(c[f+6+2]-d)*g;break;case 1:u=c[f+1],d=c[f+2];break;default:u=this.getBezierValue(n,f,1,p-2),d=this.getBezierValue(n,f,2,p+18-2)}o==Ee.setup?(l.mix=l.data.mix+(u-l.data.mix)*a,l.softness=l.data.softness+(d-l.data.softness)*a,h==Qi.mixOut?(l.bendDirection=l.data.bendDirection,l.compress=l.data.compress,l.stretch=l.data.stretch):(l.bendDirection=c[f+3],l.compress=c[f+4]!=0,l.stretch=c[f+5]!=0)):(l.mix+=(u-l.mix)*a,l.softness+=(d-l.softness)*a,h==Qi.mixIn&&(l.bendDirection=c[f+3],l.compress=c[f+4]!=0,l.stretch=c[f+5]!=0))}},V1=class extends Dn{constructor(t,i,n){super(t,i,[At.transformConstraint+"|"+n]);x(this,"constraintIndex",0);this.constraintIndex=n}getFrameEntries(){return 7}setFrame(t,i,n,r,a,o,h,l){let c=this.frames;t*=7,c[t]=i,c[t+1]=n,c[t+2]=r,c[t+3]=a,c[t+4]=o,c[t+5]=h,c[t+6]=l}apply(t,i,n,r,a,o,h){let l=t.transformConstraints[this.constraintIndex];if(!l.active)return;let c=this.frames;if(n<c[0]){let y=l.data;switch(o){case Ee.setup:l.mixRotate=y.mixRotate,l.mixX=y.mixX,l.mixY=y.mixY,l.mixScaleX=y.mixScaleX,l.mixScaleY=y.mixScaleY,l.mixShearY=y.mixShearY;return;case Ee.first:l.mixRotate+=(y.mixRotate-l.mixRotate)*a,l.mixX+=(y.mixX-l.mixX)*a,l.mixY+=(y.mixY-l.mixY)*a,l.mixScaleX+=(y.mixScaleX-l.mixScaleX)*a,l.mixScaleY+=(y.mixScaleY-l.mixScaleY)*a,l.mixShearY+=(y.mixShearY-l.mixShearY)*a}return}let u,d,f,p,m,g,v=ui.search(c,n,7),b=this.curves[v/7];switch(b){case 0:let y=c[v];u=c[v+1],d=c[v+2],f=c[v+3],p=c[v+4],m=c[v+5],g=c[v+6];let w=(n-y)/(c[v+7]-y);u+=(c[v+7+1]-u)*w,d+=(c[v+7+2]-d)*w,f+=(c[v+7+3]-f)*w,p+=(c[v+7+4]-p)*w,m+=(c[v+7+5]-m)*w,g+=(c[v+7+6]-g)*w;break;case 1:u=c[v+1],d=c[v+2],f=c[v+3],p=c[v+4],m=c[v+5],g=c[v+6];break;default:u=this.getBezierValue(n,v,1,b-2),d=this.getBezierValue(n,v,2,b+18-2),f=this.getBezierValue(n,v,3,b+36-2),p=this.getBezierValue(n,v,4,b+54-2),m=this.getBezierValue(n,v,5,b+72-2),g=this.getBezierValue(n,v,6,b+90-2)}if(o==Ee.setup){let y=l.data;l.mixRotate=y.mixRotate+(u-y.mixRotate)*a,l.mixX=y.mixX+(d-y.mixX)*a,l.mixY=y.mixY+(f-y.mixY)*a,l.mixScaleX=y.mixScaleX+(p-y.mixScaleX)*a,l.mixScaleY=y.mixScaleY+(m-y.mixScaleY)*a,l.mixShearY=y.mixShearY+(g-y.mixShearY)*a}else l.mixRotate+=(u-l.mixRotate)*a,l.mixX+=(d-l.mixX)*a,l.mixY+=(f-l.mixY)*a,l.mixScaleX+=(p-l.mixScaleX)*a,l.mixScaleY+=(m-l.mixScaleY)*a,l.mixShearY+=(g-l.mixShearY)*a}},Y1=class extends nn{constructor(t,i,n){super(t,i,At.pathConstraintPosition+"|"+n);x(this,"constraintIndex",0);this.constraintIndex=n}apply(t,i,n,r,a,o,h){let l=t.pathConstraints[this.constraintIndex];l.active&&(l.position=this.getAbsoluteValue(n,a,o,l.position,l.data.position))}},$1=class extends nn{constructor(t,i,n){super(t,i,At.pathConstraintSpacing+"|"+n);x(this,"constraintIndex",0);this.constraintIndex=n}apply(t,i,n,r,a,o,h){let l=t.pathConstraints[this.constraintIndex];l.active&&(l.spacing=this.getAbsoluteValue(n,a,o,l.spacing,l.data.spacing))}},G1=class extends Dn{constructor(t,i,n){super(t,i,[At.pathConstraintMix+"|"+n]);x(this,"constraintIndex",0);this.constraintIndex=n}getFrameEntries(){return 4}setFrame(t,i,n,r,a){let o=this.frames;t<<=2,o[t]=i,o[t+1]=n,o[t+2]=r,o[t+3]=a}apply(t,i,n,r,a,o,h){let l=t.pathConstraints[this.constraintIndex];if(!l.active)return;let c=this.frames;if(n<c[0]){switch(o){case Ee.setup:l.mixRotate=l.data.mixRotate,l.mixX=l.data.mixX,l.mixY=l.data.mixY;return;case Ee.first:l.mixRotate+=(l.data.mixRotate-l.mixRotate)*a,l.mixX+=(l.data.mixX-l.mixX)*a,l.mixY+=(l.data.mixY-l.mixY)*a}return}let u,d,f,p=ui.search(c,n,4),m=this.curves[p>>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==Ee.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 nn{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)))}},H1=class extends Xa{constructor(e,t,i){super(e,t,i,At.physicsConstraintInertia)}setup(e){return e.data.inertia}get(e){return e.inertia}set(e,t){e.inertia=t}global(e){return e.inertiaGlobal}},j1=class extends Xa{constructor(e,t,i){super(e,t,i,At.physicsConstraintStrength)}setup(e){return e.data.strength}get(e){return e.strength}set(e,t){e.strength=t}global(e){return e.strengthGlobal}},W1=class extends Xa{constructor(e,t,i){super(e,t,i,At.physicsConstraintDamping)}setup(e){return e.data.damping}get(e){return e.damping}set(e,t){e.damping=t}global(e){return e.dampingGlobal}},z1=class extends Xa{constructor(e,t,i){super(e,t,i,At.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}},q1=class extends Xa{constructor(e,t,i){super(e,t,i,At.physicsConstraintWind)}setup(e){return e.data.wind}get(e){return e.wind}set(e,t){e.wind=t}global(e){return e.windGlobal}},K1=class extends Xa{constructor(e,t,i){super(e,t,i,At.physicsConstraintGravity)}setup(e){return e.data.gravity}get(e){return e.gravity}set(e,t){e.gravity=t}global(e){return e.gravityGlobal}},Z1=class extends Xa{constructor(e,t,i){super(e,t,i,At.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 J1=(_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[0])&&(i<c[0]||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",[At.physicsConstraintReset.toString()]),_a);var ss;let Q1=(ss=class extends ui{constructor(t,i,n){super(t,[At.sequence+"|"+i+"|"+n.sequence.id]);x(this,"slotIndex");x(this,"attachment");this.slotIndex=i,this.attachment=n}getFrameEntries(){return ss.ENTRIES}getSlotIndex(){return this.slotIndex}getAttachment(){return this.attachment}setFrame(t,i,n,r,a){let o=this.frames;t*=ss.ENTRIES,o[t]=i,o[t+ss.MODE]=n|r<<4,o[t+ss.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 mr)||c.timelineAttachment!=u))return;if(h==Qi.mixOut){o==Ee.setup&&(l.sequenceIndex=-1);return}let d=this.frames;if(n<d[0]){(o==Ee.setup||o==Ee.first)&&(l.sequenceIndex=-1);return}let f=ui.search(d,n,ss.ENTRIES),p=d[f],m=d[f+ss.MODE],g=d[f+ss.DELAY];if(!this.attachment.sequence)return;let v=m>>4,b=this.attachment.sequence.regions.length,y=_1[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(ss,"ENTRIES",3),x(ss,"MODE",1),x(ss,"DELAY",2),ss);var rr;let aR=(rr=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 lR(this));x(this,"propertyIDs",new b1);x(this,"animationsChanged",!1);x(this,"trackEntryPool",new kh(()=>new oR));this.data=e}static emptyAnimation(){return rr._emptyAnimation}update(e){e*=this.timeScale;let t=this.tracks;for(let i=0,n=t.length;i<n;i++){let r=t[i];if(!r)continue;r.animationLast=r.nextAnimationLast,r.trackLast=r.nextTrackLast;let a=e*r.timeScale;if(r.delay>0){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;d<f;d++){let p=i[d];if(!p||p.delay>0)continue;n=!0;let m=d==0?Ee.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,M=T.length;if(d==0&&g==1||m==Ee.add){d==0&&(v=!0);for(let R=0;R<M;R++){var r=T[R];r instanceof co?this.applyAttachmentTimeline(r,e,w,m,v):r.apply(e,b,w,A,g,m,Qi.mixIn)}}else{let R=p.timelineMode,P=p.shortestRotation,F=!P&&p.timelinesRotation.length!=M<<1;F&&(p.timelinesRotation.length=M<<1);for(let I=0;I<M;I++){let k=T[I],O=R[I]==bf?m:Ee.setup;!P&&k instanceof Oh?this.applyRotateTimeline(k,e,w,g,O,p.timelinesRotation,I<<1,F):k instanceof co?this.applyAttachmentTimeline(k,e,w,m,v):k.apply(e,b,w,A,g,O,Qi.mixIn)}}this.queueEvents(p,y),t.length=0,p.nextAnimationLast=y,p.nextTrackLast=p.trackTime}for(var a=this.unkeyedState+Vv,o=e.slots,h=0,l=e.slots.length;h<l;h++){var c=o[h];if(c.attachmentState==a){var u=c.data.attachmentName;c.setAttachment(u?e.getAttachment(c.data.index,u):null)}}return this.unkeyedState+=2,this.queue.drain(),n}applyMixingFrom(e,t,i){let n=e.mixingFrom;n.mixingFrom&&this.applyMixingFrom(n,t,i);let r=0;e.mixDuration==0?(r=1,i==Ee.first&&(i=Ee.setup)):(r=e.mixTime/e.mixDuration,r>1&&(r=1),i!=Ee.first&&(i=n.mixBlend));let a=r<n.mixAttachmentThreshold,o=r<n.mixDrawOrderThreshold,h=n.animation.timelines,l=h.length,c=n.alpha*e.interruptAlpha,u=c*(1-r),d=n.animationLast,f=n.getAnimationTime(),p=f,m=null;if(n.reverse?p=n.animation.duration-p:r<n.eventThreshold&&(m=this.events),i==Ee.add)for(let g=0;g<l;g++)h[g].apply(t,d,p,m,u,i,Qi.mixOut);else{let g=n.timelineMode,v=n.timelineHoldMix,b=n.shortestRotation,y=!b&&n.timelinesRotation.length!=l<<1;y&&(n.timelinesRotation.length=l<<1),n.totalAlpha=0;for(let w=0;w<l;w++){let A=h[w],T=Qi.mixOut,M,R=0;switch(g[w]){case bf:if(!o&&A instanceof vl)continue;M=i,R=u;break;case Uv:M=Ee.setup,R=u;break;case Xv:M=i,R=c;break;case wf:M=Ee.setup,R=c;break;default:M=Ee.setup;let P=v[w];R=c*Math.max(0,1-P.mixTime/P.mixDuration);break}n.totalAlpha+=R,!b&&A instanceof Oh?this.applyRotateTimeline(A,t,p,R,M,n.timelinesRotation,w<<1,y):A instanceof co?this.applyAttachmentTimeline(A,t,p,M,a&&R>=n.alphaAttachmentThreshold):(o&&A instanceof vl&&M==Ee.setup&&(T=Qi.mixIn),A.apply(t,d,p,m,R,M,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<e.frames[0]?(n==Ee.setup||n==Ee.first)&&this.setAttachment(t,a,a.data.attachmentName,r):this.setAttachment(t,a,e.attachmentNames[ui.search1(e.frames,i)],r),a.attachmentState<=this.unkeyedState&&(a.attachmentState=this.unkeyedState+Vv))}setAttachment(e,t,i,n){t.setAttachment(i?e.getAttachment(t.data.index,i):null),n&&(t.attachmentState=this.unkeyedState+hR)}applyRotateTimeline(e,t,i,n,r,a,o,h){if(h&&(a[o]=0),n==1){e.apply(t,0,i,null,1,r,Qi.mixIn);return}let l=t.bones[e.boneIndex];if(!l.active)return;let c=e.frames,u=0,d=0;if(i<c[0])switch(r){case Ee.setup:l.rotation=l.data.rotation;default:return;case Ee.first:u=l.rotation,d=l.data.rotation}else u=r==Ee.setup?l.data.rotation:l.rotation,d=l.data.rotation+e.getCurveValue(i);let f=0,p=d-u;if(p-=Math.ceil(p/360-.5)*360,p==0)f=a[o];else{let m=0,g=0;h?(m=0,g=p):(m=a[o],g=a[o+1]);let v=m-m%360;f=p+v;let b=p>=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(;h<l;h++){let u=o[h];if(u.time<a)break;u.time>n||this.queue.event(e,u)}let c=!1;if(e.loop)if(r==0)c=!0;else{const u=Math.floor(e.trackTime/r);c=u>0&&u>Math.floor(e.trackLast/r)}else c=t>=n&&e.animationLast<n;for(c&&this.queue.complete(e);h<l;h++){let u=o[h];u.time<i||this.queue.event(e,u)}}clearTracks(){let e=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let t=0,i=this.tracks.length;t<i;t++)this.clearTrack(t);this.tracks.length=0,this.queue.drainDisabled=e,this.queue.drain()}clearTrack(e){if(e>=this.tracks.length)return;let t=this.tracks[e];if(!t)return;this.queue.end(t),this.clearNext(t);let 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,rr.emptyAnimation(),!1);return i.mixDuration=t,i.trackEnd=t,i}addEmptyAnimation(e,t=0,i=0){let n=this.addAnimationWith(e,rr.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;i<n;i++){let r=this.tracks[i];r&&this.setEmptyAnimation(r.trackIndex,e)}this.queue.drainDisabled=t,this.queue.drain()}expandToIndex(e){return e<this.tracks.length?this.tracks[e]:(Ge.ensureArrayCapacity(this.tracks,e+1,null),this.tracks.length=e+1,null)}trackEntry(e,t,i,n){let r=this.trackEntryPool.obtain();return r.reset(),r.trackIndex=e,r.animation=t,r.loop=i,r.holdPrevious=!1,r.reverse=!1,r.shortestRotation=!1,r.eventThreshold=0,r.alphaAttachmentThreshold=0,r.mixAttachmentThreshold=0,r.mixDrawOrderThreshold=0,r.animationStart=0,r.animationEnd=t.duration,r.animationLast=-1,r.nextAnimationLast=-1,r.delay=0,r.trackTime=0,r.trackLast=-1,r.nextTrackLast=-1,r.trackEnd=Number.MAX_VALUE,r.timeScale=1,r.alpha=1,r.mixTime=0,r.mixDuration=n?this.data.getMix(n.animation,t):0,r.interruptAlpha=1,r.totalAlpha=0,r.mixBlend=Ee.replace,r}clearNext(e){let t=e.next;for(;t;)this.queue.dispose(t),t=t.next;e.next=null}_animationsChanged(){this.animationsChanged=!1,this.propertyIDs.clear();let e=this.tracks;for(let t=0,i=e.length;t<i;t++){let n=e[t];if(n){for(;n.mixingFrom;)n=n.mixingFrom;do(!n.mixingTo||n.mixBlend!=Ee.add)&&this.computeHold(n),n=n.mixingTo;while(n)}}}computeHold(e){let t=e.mixingTo,i=e.animation.timelines,n=e.animation.timelines.length,r=e.timelineMode;r.length=n;let a=e.timelineHoldMix;a.length=0;let o=this.propertyIDs;if(t&&t.holdPrevious){for(let h=0;h<n;h++)r[h]=o.addAll(i[h].getPropertyIds())?wf:Xv;return}e:for(let h=0;h<n;h++){let l=i[h],c=l.getPropertyIds();if(!o.addAll(c))r[h]=bf;else if(!t||l instanceof co||l instanceof vl||l instanceof Cp||!t.animation.hasTimeline(c))r[h]=Uv;else{for(let u=t.mixingTo;u;u=u.mixingTo)if(!u.animation.hasTimeline(c)){if(e.mixDuration>0){r[h]=cR,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(rr,"_emptyAnimation",new Ap("<empty>",[],0)),rr),oR=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",Ee.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<e)return e}return this.trackTime}wasApplied(){return this.nextTrackLast!=-1}isNextReady(){return this.next!=null&&this.nextTrackLast-this.next.delay>=0}},lR=class{constructor(e){x(this,"objects",[]);x(this,"drainDisabled",!1);x(this,"animState");this.animState=e}start(e){this.objects.push(us.start),this.objects.push(e),this.animState.animationsChanged=!0}interrupt(e){this.objects.push(us.interrupt),this.objects.push(e)}end(e){this.objects.push(us.end),this.objects.push(e),this.animState.animationsChanged=!0}dispose(e){this.objects.push(us.dispose),this.objects.push(e)}complete(e){this.objects.push(us.complete),this.objects.push(e)}event(e,t){this.objects.push(us.event),this.objects.push(e),this.objects.push(t)}drain(){if(this.drainDisabled)return;this.drainDisabled=!0;let e=this.objects;for(let t=0;t<e.length;t+=2){let i=e[t],n=e[t+1],r=this.animState.listeners.slice();switch(i){case us.start:n.listener&&n.listener.start&&n.listener.start(n);for(let o=0;o<r.length;o++){let h=r[o];h.start&&h.start(n)}break;case us.interrupt:n.listener&&n.listener.interrupt&&n.listener.interrupt(n);for(let o=0;o<r.length;o++){let h=r[o];h.interrupt&&h.interrupt(n)}break;case us.end:n.listener&&n.listener.end&&n.listener.end(n);for(let o=0;o<r.length;o++){let h=r[o];h.end&&h.end(n)}case us.dispose:n.listener&&n.listener.dispose&&n.listener.dispose(n);for(let o=0;o<r.length;o++){let h=r[o];h.dispose&&h.dispose(n)}this.animState.trackEntryPool.free(n);break;case us.complete:n.listener&&n.listener.complete&&n.listener.complete(n);for(let o=0;o<r.length;o++){let h=r[o];h.complete&&h.complete(n)}break;case us.event:let a=e[t+++2];n.listener&&n.listener.event&&n.listener.event(n,a);for(let o=0;o<r.length;o++){let h=r[o];h.event&&h.event(n,a)}break}}this.clear(),this.drainDisabled=!1}clear(){this.objects.length=0}};var us;(function(s){s[s.start=0]="start",s[s.interrupt=1]="interrupt",s[s.end=2]="end",s[s.dispose=3]="dispose",s[s.complete=4]="complete",s[s.event=5]="event"})(us||(us={}));const bf=0,Uv=1,Xv=2,wf=3,cR=4,Vv=1,hR=2;class uR{constructor(e){x(this,"skeletonData");x(this,"animationToMixTime",{});x(this,"defaultMix",0);if(!e)throw new Error("skeletonData cannot be null.");this.skeletonData=e}setMix(e,t,i){let n=this.skeletonData.findAnimation(e);if(!n)throw new Error("Animation not found: "+e);let r=this.skeletonData.findAnimation(t);if(!r)throw new Error("Animation not found: "+t);this.setMixWith(n,r,i)}setMixWith(e,t,i){if(!e)throw new Error("from cannot be null.");if(!t)throw new Error("to cannot be null.");let n=e.name+"."+t.name;this.animationToMixTime[n]=i}getMix(e,t){let i=e.name+"."+t.name,n=this.animationToMixTime[i];return n===void 0?this.defaultMix:n}}let ew=class tw extends mr{constructor(t){super(t);x(this,"color",new Mt(1,1,1,1))}copy(){let t=new tw(this.name);return this.copyTo(t),t.color.setFromColor(this.color),t}},Mo=class iw extends mr{constructor(t){super(t);x(this,"endSlot",null);x(this,"color",new Mt(.2275,.2275,.8078,1))}copy(){let t=new iw(this.name);return this.copyTo(t),t.endSlot=this.endSlot,t.color.setFromColor(this.color),t}},dR=class{constructor(e){x(this,"_image");this._image=e}getImage(){return this._image}};var Di;(function(s){s[s.Nearest=9728]="Nearest",s[s.Linear=9729]="Linear",s[s.MipMap=9987]="MipMap",s[s.MipMapNearestNearest=9984]="MipMapNearestNearest",s[s.MipMapLinearNearest=9985]="MipMapLinearNearest",s[s.MipMapNearestLinear=9986]="MipMapNearestLinear",s[s.MipMapLinearLinear=9987]="MipMapLinearLinear"})(Di||(Di={}));var lr;(function(s){s[s.MirroredRepeat=33648]="MirroredRepeat",s[s.ClampToEdge=33071]="ClampToEdge",s[s.Repeat=10497]="Repeat"})(lr||(lr={}));let fR=class{constructor(){x(this,"texture");x(this,"u",0);x(this,"v",0);x(this,"u2",0);x(this,"v2",0);x(this,"width",0);x(this,"height",0);x(this,"degrees",0);x(this,"offsetX",0);x(this,"offsetY",0);x(this,"originalWidth",0);x(this,"originalHeight",0)}},sw=class{constructor(e){x(this,"pages",new Array);x(this,"regions",new Array);let t=new mR(e),i=new Array(4),n={};n.size=c=>{c.width=parseInt(i[1]),c.height=parseInt(i[2])},n.format=()=>{},n.filter=c=>{c.minFilter=Ge.enumValue(Di,i[1]),c.magFilter=Ge.enumValue(Di,i[2])},n.repeat=c=>{i[1].indexOf("x")!=-1&&(c.uWrap=lr.Repeat),i[1].indexOf("y")!=-1&&(c.vWrap=lr.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 nw(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;p<u;p++)f.push(parseInt(i[p+1]));l.push(f)}}c.originalWidth==0&&c.originalHeight==0&&(c.originalWidth=c.width,c.originalHeight=c.height),h&&h.length>0&&l&&l.length>0&&(c.names=h,c.values=l,h=null,l=null),c.u=c.x/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 pR(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.regions.length;t++)if(this.regions[t].name==e)return this.regions[t];return null}setTextures(e,t=""){for(let i of this.pages)i.setTexture(e.get(t+i.name))}dispose(){var e;for(let t=0;t<this.pages.length;t++)(e=this.pages[t].texture)==null||e.dispose()}},mR=class{constructor(e){x(this,"lines");x(this,"index",0);this.lines=e.split(/\r\n|\r|\n/)}readLine(){return this.index>=this.lines.length?null:this.lines[this.index++]}readEntry(e,t){if(!t||(t=t.trim(),t.length==0))return 0;let 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}}},pR=class{constructor(e){x(this,"name");x(this,"minFilter",Di.Nearest);x(this,"magFilter",Di.Nearest);x(this,"uWrap",lr.ClampToEdge);x(this,"vWrap",lr.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}},nw=class extends fR{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 mr{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 Mt(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 Mt(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 nw){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<n;f+=2)i[f]=r+t[f+1]*o,i[f+1]=a+(1-t[f])*h;return;case 180:r-=(l.originalWidth-l.offsetX-l.width)/u,a-=l.offsetY/d,o=l.originalWidth/u,h=l.originalHeight/d;for(let f=0;f<n;f+=2)i[f]=r+(1-t[f])*o,i[f+1]=a+(1-t[f+1])*h;return;case 270:r-=l.offsetY/u,a-=l.offsetX/d,o=l.originalHeight/u,h=l.originalWidth/d;for(let f=0;f<n;f+=2)i[f]=r+(1-t[f+1])*o,i[f+1]=a+t[f]*h;return}r-=l.offsetX/u,a-=(l.originalHeight-l.offsetY-l.height)/d,o=l.originalWidth/u,h=l.originalHeight/d}else this.region?(o=this.region.u2-r,h=this.region.v2-a):(r=a=0,o=h=1);for(let l=0;l<n;l+=2)i[l]=r+t[l]*o,i[l+1]=a+t[l+1]*h}getParentMesh(){return this.parentMesh}setParentMesh(t){this.parentMesh=t,t&&(this.bones=t.bones,this.vertices=t.vertices,this.worldVerticesLength=t.worldVerticesLength,this.regionUVs=t.regionUVs,this.triangles=t.triangles,this.hullLength=t.hullLength,this.worldVerticesLength=t.worldVerticesLength)}copy(){if(this.parentMesh)return this.newLinkedMesh();let t=new Tm(this.name,this.path);return t.region=this.region,t.color.setFromColor(this.color),this.copyTo(t),t.regionUVs=new Array(this.regionUVs.length),Ge.arrayCopy(this.regionUVs,0,t.regionUVs,0,this.regionUVs.length),t.uvs=this.uvs instanceof Float32Array?Ge.newFloatArray(this.uvs.length):new Array(this.uvs.length),Ge.arrayCopy(this.uvs,0,t.uvs,0,this.uvs.length),t.triangles=new Array(this.triangles.length),Ge.arrayCopy(this.triangles,0,t.triangles,0,this.triangles.length),t.hullLength=this.hullLength,t.sequence=this.sequence!=null?this.sequence.copy():null,this.edges&&(t.edges=new Array(this.edges.length),Ge.arrayCopy(this.edges,0,t.edges,0,this.edges.length)),t.width=this.width,t.height=this.height,t}computeWorldVertices(t,i,n,r,a,o){this.sequence!=null&&this.sequence.apply(t,this),super.computeWorldVertices(t,i,n,r,a,o)}newLinkedMesh(){let t=new Tm(this.name,this.path);return t.region=this.region,t.color.setFromColor(this.color),t.timelineAttachment=this.timelineAttachment,t.setParentMesh(this.parentMesh?this.parentMesh:this),t.region!=null&&t.updateRegion(),t}},Ul=class rw extends mr{constructor(t){super(t);x(this,"lengths",[]);x(this,"closed",!1);x(this,"constantSpeed",!1);x(this,"color",new Mt(1,1,1,1))}copy(){let t=new rw(this.name);return this.copyTo(t),t.lengths=new Array(this.lengths.length),Ge.arrayCopy(this.lengths,0,t.lengths,0,this.lengths.length),t.closed=closed,t.constantSpeed=this.constantSpeed,t.color.setFromColor(this.color),t}},aw=class ow extends mr{constructor(t){super(t);x(this,"x",0);x(this,"y",0);x(this,"rotation",0);x(this,"color",new Mt(.38,.94,0,1))}computeWorldPosition(t,i){return i.x=this.x*t.a+this.y*t.b+t.worldX,i.y=this.x*t.c+this.y*t.d+t.worldY,i}computeWorldRotation(t){const i=this.rotation*$e.degRad,n=Math.cos(i),r=Math.sin(i),a=n*t.a+r*t.b,o=n*t.c+r*t.d;return $e.atan2Deg(o,a)}copy(){let t=new ow(this.name);return t.x=this.x,t.y=this.y,t.rotation=this.rotation,t.color.setFromColor(this.color),t}};var Pt;let Eu=(Pt=class extends w1{constructor(t,i){super(t);x(this,"x",0);x(this,"y",0);x(this,"scaleX",1);x(this,"scaleY",1);x(this,"rotation",0);x(this,"width",0);x(this,"height",0);x(this,"color",new Mt(1,1,1,1));x(this,"path");x(this,"region",null);x(this,"sequence",null);x(this,"offset",Ge.newFloatArray(8));x(this,"uvs",Ge.newFloatArray(8));x(this,"tempColor",new Mt(1,1,1,1));this.path=i}updateRegion(){if(!this.region)throw new Error("Region not set.");let t=this.region,i=this.uvs;if(t==null){i[0]=0,i[1]=0,i[2]=0,i[3]=1,i[4]=1,i[5]=1,i[6]=1,i[7]=0;return}let n=this.width/this.region.originalWidth*this.scaleX,r=this.height/this.region.originalHeight*this.scaleY,a=-this.width/2*this.scaleX+this.region.offsetX*n,o=-this.height/2*this.scaleY+this.region.offsetY*r,h=a+this.region.width*n,l=o+this.region.height*r,c=this.rotation*$e.degRad,u=Math.cos(c),d=Math.sin(c),f=this.x,p=this.y,m=a*u+f,g=a*d,v=o*u+p,b=o*d,y=h*u+f,w=h*d,A=l*u+p,T=l*d,M=this.offset;M[0]=m-b,M[1]=v+g,M[2]=m-T,M[3]=A+g,M[4]=y-T,M[5]=A+w,M[6]=y-b,M[7]=v+w,t.degrees==90?(i[0]=t.u2,i[1]=t.v2,i[2]=t.u,i[3]=t.v2,i[4]=t.u,i[5]=t.v,i[6]=t.u2,i[7]=t.v):(i[0]=t.u,i[1]=t.v2,i[2]=t.u,i[3]=t.v,i[4]=t.u2,i[5]=t.v,i[6]=t.u2,i[7]=t.v2)}computeWorldVertices(t,i,n,r){this.sequence!=null&&this.sequence.apply(t,this);let a=t.bone,o=this.offset,h=a.worldX,l=a.worldY,c=a.a,u=a.b,d=a.c,f=a.d,p=0,m=0;p=o[0],m=o[1],i[n]=p*c+m*u+h,i[n+1]=p*d+m*f+l,n+=r,p=o[2],m=o[3],i[n]=p*c+m*u+h,i[n+1]=p*d+m*f+l,n+=r,p=o[4],m=o[5],i[n]=p*c+m*u+h,i[n+1]=p*d+m*f+l,n+=r,p=o[6],m=o[7],i[n]=p*c+m*u+h,i[n+1]=p*d+m*f+l}copy(){let t=new Pt(this.name,this.path);return t.region=this.region,t.x=this.x,t.y=this.y,t.scaleX=this.scaleX,t.scaleY=this.scaleY,t.rotation=this.rotation,t.width=this.width,t.height=this.height,Ge.arrayCopy(this.uvs,0,t.uvs,0,8),Ge.arrayCopy(this.offset,0,t.offset,0,8),t.color.setFromColor(this.color),t.sequence=this.sequence!=null?this.sequence.copy():null,t}},x(Pt,"X1",0),x(Pt,"Y1",1),x(Pt,"C1R",2),x(Pt,"C1G",3),x(Pt,"C1B",4),x(Pt,"C1A",5),x(Pt,"U1",6),x(Pt,"V1",7),x(Pt,"X2",8),x(Pt,"Y2",9),x(Pt,"C2R",10),x(Pt,"C2G",11),x(Pt,"C2B",12),x(Pt,"C2A",13),x(Pt,"U2",14),x(Pt,"V2",15),x(Pt,"X3",16),x(Pt,"Y3",17),x(Pt,"C3R",18),x(Pt,"C3G",19),x(Pt,"C3B",20),x(Pt,"C3A",21),x(Pt,"U3",22),x(Pt,"V3",23),x(Pt,"X4",24),x(Pt,"Y4",25),x(Pt,"C4R",26),x(Pt,"C4G",27),x(Pt,"C4B",28),x(Pt,"C4A",29),x(Pt,"U4",30),x(Pt,"V4",31),Pt);class Am{constructor(e){x(this,"atlas");this.atlas=e}loadSequence(e,t,i){let n=i.regions;for(let r=0,a=n.length;r<a;r++){let o=i.getPath(t,r),h=this.atlas.findRegion(o);if(h==null)throw new Error("Region not found in atlas: "+o+" (sequence: "+e+")");n[r]=h}}newRegionAttachment(e,t,i,n){let r=new Eu(t,i);if(n!=null)this.loadSequence(t,i,n);else{let a=this.atlas.findRegion(i);if(!a)throw new Error("Region not found in atlas: "+i+" (region attachment: "+t+")");r.region=a}return r}newMeshAttachment(e,t,i,n){let r=new Zl(t,i);if(n!=null)this.loadSequence(t,i,n);else{let a=this.atlas.findRegion(i);if(!a)throw new Error("Region not found in atlas: "+i+" (mesh attachment: "+t+")");r.region=a}return r}newBoundingBoxAttachment(e,t){return new ew(t)}newPathAttachment(e,t){return new Ul(t)}newPointAttachment(e,t){return new aw(t)}newClippingAttachment(e,t){return new Mo(t)}}let lw=class{constructor(e,t,i){x(this,"index",0);x(this,"name");x(this,"parent",null);x(this,"length",0);x(this,"x",0);x(this,"y",0);x(this,"rotation",0);x(this,"scaleX",1);x(this,"scaleY",1);x(this,"shearX",0);x(this,"shearY",0);x(this,"inherit",pi.Normal);x(this,"skinRequired",!1);x(this,"color",new Mt);x(this,"icon");x(this,"visible",!1);if(e<0)throw new Error("index must be >= 0.");if(!t)throw new Error("name cannot be null.");this.index=e,this.name=t,this.parent=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={}));let Yv=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",pi.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 pi.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 pi.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 pi.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 pi.NoScale:case pi.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==pi.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,M=Math.sin(o)*r;this.a=m*w+b*T,this.b=m*A+b*M,this.c=g*w+y*T,this.d=g*A+y*M;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==pi.OnlyTranslation)f=this.a,p=this.b,m=this.c,g=this.d;else{switch(this.inherit){case pi.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 pi.NoScale:case pi.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==pi.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}},cw=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}},hw=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}},gR=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;n<e.bones.length;n++){let r=t.findBone(e.bones[n].name);if(!r)throw new Error(`Couldn't find bone ${e.bones[n].name}`);this.bones.push(r)}let i=t.findBone(e.target.name);if(!i)throw new Error(`Couldn't find bone ${e.target.name}`);this.target=i,this.mix=e.mix,this.softness=e.softness,this.bendDirection=e.bendDirection,this.compress=e.compress,this.stretch=e.stretch}isActive(){return this.active}setToSetupPose(){const e=this.data;this.mix=e.mix,this.softness=e.softness,this.bendDirection=e.bendDirection,this.compress=e.compress,this.stretch=e.stretch}update(e){if(this.mix==0)return;let t=this.target,i=this.bones;switch(i.length){case 1:this.apply1(i[0],t.worldX,t.worldY,this.compress,this.stretch,this.data.uniform,this.mix);break;case 2:this.apply2(i[0],i[1],t.worldX,t.worldY,this.bendDirection,this.stretch,this.data.uniform,this.softness,this.mix);break}}apply1(e,t,i,n,r,a,o){let h=e.parent;if(!h)throw new Error("IK bone must have parent.");let l=h.a,c=h.b,u=h.c,d=h.d,f=-e.ashearX-e.arotation,p=0,m=0;switch(e.inherit){case pi.OnlyTranslation:p=(t-e.worldX)*$e.signum(e.skeleton.scaleX),m=(i-e.worldY)*$e.signum(e.skeleton.scaleY);break;case pi.NoRotationOrReflection:let b=Math.abs(l*d-c*u)/Math.max(1e-4,l*l+u*u),y=l/e.skeleton.scaleX,w=u/e.skeleton.scaleY;c=-w*b*e.skeleton.scaleX,d=y*b*e.skeleton.scaleY,f+=Math.atan2(w,y)*$e.radDeg;default:let A=t-h.worldX,T=i-h.worldY,M=l*d-c*u;Math.abs(M)<=1e-4?(p=0,m=0):(p=(A*d-T*c)/M-e.ax,m=(T*l-A*u)/M-e.ay)}f+=Math.atan2(m,p)*$e.radDeg,e.ascaleX<0&&(f+=180),f>180?f-=360:f<-180&&(f+=360);let g=e.ascaleX,v=e.ascaleY;if(n||r){switch(e.inherit){case pi.NoScale:case pi.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&&y<b*b||r&&y>b*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!=pi.Normal||t.inherit!=pi.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,M=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,M=F*w+e.worldY):(A=t.ay,T=R*w+P*A+e.worldX,M=F*w+I*A+e.worldY);let O=e.parent;if(!O)throw new Error("IK parent must itself have a parent.");R=O.a,P=O.b,F=O.c,I=O.d;let L=R*I-P*F,U=T-O.worldX,B=M-O.worldY;L=Math.abs(L)<=1e-4?0:1/L;let D=(U*I-B*P)*L-c,_=(B*R-U*F)*L-u,X=Math.sqrt(D*D+_*_),N=t.data.length*g,V,G;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-O.worldX,B=n-O.worldY;let j=(U*I-B*P)*L-c,ne=(B*R-U*F)*L-u,Q=j*j+ne*ne;if(h!=0){h*=d*(g+1)*.5;let we=Math.sqrt(Q),Re=we-X-N*d+h;if(Re>0){let ge=Math.min(1,Re/(h*2))-1;ge=(Re-h*(1-ge*ge))/we,j-=ge*j,ne-=ge*ne,Q=j*j+ne*ne}}e:if(k){N*=d;let we=(Q-X*X-N*N)/(2*X*N);we<-1?(we=-1,G=Math.PI*r):we>1?(we=1,G=0,a&&(R=(Math.sqrt(Q)/(X+N)-1)*l+1,p*=R,o&&(m*=R))):G=Math.acos(we)*r,R=X+N*we,P=N*Math.sin(G),V=Math.atan2(ne*R-j*P,j*R+ne*P)}else{R=d*N,P=f*N;let we=R*R,Re=P*P,ge=Math.atan2(ne,j);F=Re*X*X+we*Q-we*Re;let Ae=-2*Re*X,H=Re-we;if(I=Ae*Ae-4*H*F,I>=0){let he=Math.sqrt(I);Ae<0&&(he=-he),he=-(Ae+he)*.5;let Xe=he/H,Pe=F/he,Oe=Math.abs(Xe)<Math.abs(Pe)?Xe:Pe;if(Xe=Q-Oe*Oe,Xe>=0){B=Math.sqrt(Xe)*r,V=ge-Math.atan2(B,Oe),G=Math.atan2(B/f,(Oe-X)/d);break e}}let K=$e.PI,q=X-R,z=q*q,ee=0,le=0,ve=X+R,re=ve*ve,ye=0;F=-R*X/(we-Re),F>=-1&&F<=1&&(F=Math.acos(F),U=R*Math.cos(F)+X,B=P*Math.sin(F),I=U*U+B*B,I<z&&(K=F,z=I,q=U,ee=B),I>re&&(le=F,re=I,ve=U,ye=B)),Q<=(z+re)*.5?(V=ge-Math.atan2(ee*r,q),G=K*r):(V=ge-Math.atan2(ye*r,ve),G=le*r)}let de=Math.atan2(A,w)*y,me=e.arotation;V=(V-de)*$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,G=((G+de)*$e.radDeg-t.ashearX)*y+b-me,G>180?G-=360:G<-180&&(G+=360),t.updateWorldTransformWith(w,A,me+G*l,t.ascaleX,t.ascaleY,t.ashearX,t.ashearY)}},uw=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.")}},dw=class extends Cu{constructor(t){super(t,0,!1);x(this,"bones",new Array);x(this,"_target",null);x(this,"positionMode",Fn.Fixed);x(this,"spacingMode",ki.Fixed);x(this,"rotateMode",Ra.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 Fn;(function(s){s[s.Fixed=0]="Fixed",s[s.Percent=1]="Percent"})(Fn||(Fn={}));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 Ra;(function(s){s[s.Tangent=0]="Tangent",s[s.Chain=1]="Chain",s[s.ChainScale=2]="ChainScale"})(Ra||(Ra={}));var Zi;let vR=(Zi=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;n<r;n++){let a=t.findBone(e.bones[n].name);if(!a)throw new Error(`Couldn't find bone ${e.bones[n].name}.`);this.bones.push(a)}let i=t.findSlot(e.target.name);if(!i)throw new Error(`Couldn't find target bone ${e.target.name}`);this.target=i,this.position=e.position,this.spacing=e.spacing,this.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY}isActive(){return this.active}setToSetupPose(){const e=this.data;this.position=e.position,this.spacing=e.spacing,this.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY}update(e){let t=this.target.getAttachment();if(!(t instanceof Ul))return;let i=this.mixRotate,n=this.mixX,r=this.mixY;if(i==0&&n==0&&r==0)return;let a=this.data,o=a.rotateMode==Ra.Tangent,h=a.rotateMode==Ra.ChainScale,l=this.bones,c=l.length,u=o?c:c+1,d=Ge.setArraySize(this.spaces,u),f=h?this.lengths=Ge.setArraySize(this.lengths,c):[],p=this.spacing;switch(a.spacingMode){case ki.Percent:if(h)for(let T=0,M=u-1;T<M;T++){let R=l[T],P=R.data.length,F=P*R.a,I=P*R.c;f[T]=Math.sqrt(F*F+I*I)}Ge.arrayFill(d,1,u,p);break;case ki.Proportional:let w=0;for(let T=0,M=u-1;T<M;){let R=l[T],P=R.data.length;if(P<Zi.epsilon)h&&(f[T]=0),d[++T]=p;else{let F=P*R.a,I=P*R.c,k=Math.sqrt(F*F+I*I);h&&(f[T]=k),d[++T]=k,w+=k}}if(w>0){w=u/w*p;for(let T=1;T<u;T++)d[T]*=w}break;default:let A=a.spacingMode==ki.Length;for(let T=0,M=u-1;T<M;){let R=l[T],P=R.data.length;if(P<Zi.epsilon)h&&(f[T]=0),d[++T]=p;else{let F=P*R.a,I=P*R.c,k=Math.sqrt(F*F+I*I);h&&(f[T]=k),d[++T]=(A?P+p:p)*k/P}}}let m=this.computeWorldPositions(t,u,o),g=m[0],v=m[1],b=a.offsetRotation,y=!1;if(b==0)y=a.rotateMode==Ra.Chain;else{y=!1;let w=this.target.bone;b*=w.a*w.d-w.b*w.c>0?$e.degRad:-.01745329277777778}for(let w=0,A=3;w<c;w++,A+=3){let T=l[w];T.worldX+=(g-T.worldX)*n,T.worldY+=(v-T.worldY)*r;let M=m[A],R=m[A+1],P=M-g,F=R-v;if(h){let I=f[w];if(I!=0){let k=(Math.sqrt(P*P+F*F)/I-1)*i+1;T.a*=k,T.c*=k}}if(g=M,v=R,i>0){let I=T.a,k=T.b,O=T.c,L=T.d,U=0,B=0,D=0;if(o?U=m[A-1]:d[w+1]==0?U=m[A+2]:U=Math.atan2(F,P),U-=Math.atan2(O,I),y){B=Math.cos(U),D=Math.sin(U);let _=T.data.length;g+=(_*(B*I-D*O)-P)*i,v+=(_*(D*I+B*O)-F)*i}else U+=b;U>$e.PI?U-=$e.PI2:U<-3.1415927&&(U+=$e.PI2),U*=i,B=Math.cos(U),D=Math.sin(U),T.a=B*I-D*O,T.b=B*k-D*L,T.c=D*I+B*O,T.d=D*k+B*L}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=Zi.NONE;if(!e.constantSpeed){let _=e.lengths;u-=l?1:2;let X=_[u];this.data.positionMode==Fn.Percent&&(r*=X);let N;switch(this.data.spacingMode){case ki.Percent:N=X;break;case ki.Proportional:N=X/t;break;default:N=1}h=Ge.setArraySize(this.world,8);for(let V=0,G=0,j=0;V<t;V++,G+=3){let ne=a[V]*N;r+=ne;let Q=r;if(l)Q%=X,Q<0&&(Q+=X),j=0;else if(Q<0){d!=Zi.BEFORE&&(d=Zi.BEFORE,e.computeWorldVertices(n,2,4,h,0,2)),this.addBeforePosition(Q,h,0,o,G);continue}else if(Q>X){d!=Zi.AFTER&&(d=Zi.AFTER,e.computeWorldVertices(n,c-6,4,h,0,2)),this.addAfterPosition(Q-X,h,0,o,G);continue}for(;;j++){let de=_[j];if(!(Q>de)){if(j==0)Q/=de;else{let me=_[j-1];Q=(Q-me)/(de-me)}break}}j!=d&&(d=j,l&&j==u?(e.computeWorldVertices(n,c-4,4,h,0,2),e.computeWorldVertices(n,0,4,h,4,2)):e.computeWorldVertices(n,j*6+2,8,h,0,2)),this.addCurvePosition(Q,h[0],h[1],h[2],h[3],h[4],h[5],h[6],h[7],o,G,i||V>0&&ne==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,M=0,R=0,P=0,F=0,I=0,k=0,O=0,L=0;for(let _=0,X=2;_<u;_++,X+=6)v=h[X],b=h[X+1],y=h[X+2],w=h[X+3],A=h[X+4],T=h[X+5],M=(m-v*2+y)*.1875,R=(g-b*2+w)*.1875,P=((v-y)*3-m+A)*.09375,F=((b-w)*3-g+T)*.09375,I=M*2+P,k=R*2+F,O=(v-m)*.75+M+P*.16666667,L=(b-g)*.75+R+F*.16666667,p+=Math.sqrt(O*O+L*L),O+=I,L+=k,I+=P,k+=F,p+=Math.sqrt(O*O+L*L),O+=I,L+=k,p+=Math.sqrt(O*O+L*L),O+=I+P,L+=k+F,p+=Math.sqrt(O*O+L*L),f[_]=p,m=A,g=T;this.data.positionMode==Fn.Percent&&(r*=p);let U;switch(this.data.spacingMode){case ki.Percent:U=p;break;case ki.Proportional:U=p/t;break;default:U=1}let B=this.segments,D=0;for(let _=0,X=0,N=0,V=0;_<t;_++,X+=3){let G=a[_]*U;r+=G;let j=r;if(l)j%=p,j<0&&(j+=p),N=0;else if(j<0){this.addBeforePosition(j,h,0,o,X);continue}else if(j>p){this.addAfterPosition(j-p,h,c-4,o,X);continue}for(;;N++){let ne=f[N];if(!(j>ne)){if(N==0)j/=ne;else{let Q=f[N-1];j=(j-Q)/(ne-Q)}break}}if(N!=d){d=N;let ne=N*6;for(m=h[ne],g=h[ne+1],v=h[ne+2],b=h[ne+3],y=h[ne+4],w=h[ne+5],A=h[ne+6],T=h[ne+7],M=(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=M*2+P,k=R*2+F,O=(v-m)*.3+M+P*.16666667,L=(b-g)*.3+R+F*.16666667,D=Math.sqrt(O*O+L*L),B[0]=D,ne=1;ne<8;ne++)O+=I,L+=k,I+=P,k+=F,D+=Math.sqrt(O*O+L*L),B[ne]=D;O+=I,L+=k,D+=Math.sqrt(O*O+L*L),B[8]=D,O+=I+P,L+=k+F,D+=Math.sqrt(O*O+L*L),B[9]=D,V=0}for(j*=D;;V++){let ne=B[V];if(!(j>ne)){if(V==0)j/=ne;else{let Q=B[V-1];j=V+(j-Q)/(ne-Q)}break}}this.addCurvePosition(j*.1,m,g,v,b,y,w,A,T,o,X,i||_>0&&G==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,M=i*v+r*w+o*A+l*p;c[u]=T,c[u+1]=M,d&&(e<.001?c[u+2]=Math.atan2(r-i,n-t):c[u+2]=Math.atan2(M-(i*g+r*b*2+o*f),T-(t*g+n*b*2+a*f)))}},x(Zi,"NONE",-1),x(Zi,"BEFORE",-2),x(Zi,"AFTER",-3),x(Zi,"epsilon",1e-5),Zi),yR=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 kr.none:return;case kr.reset:this.reset();case kr.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,M=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-=(M+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,M=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){M=(this.data.rotate+this.data.shearX)*t;let F=Math.atan2(P+this.ty,R+this.tx)-w-this.rotateOffset*M;this.rotateOffset+=(F-Math.ceil(F*$e.invPI2-.5)*$e.PI2)*p,F=this.rotateOffset*M+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,O=Ip.yDown?-this.gravity:this.gravity,L=h/g;for(;;)if(f-=m,a&&(this.scaleVelocity+=(k*A-O*T-this.scaleOffset*I)*F,this.scaleOffset+=this.scaleVelocity*m,this.scaleVelocity*=v),r){if(this.rotateVelocity-=((k*T+O*A)*L+this.rotateOffset*I)*F,this.rotateOffset+=this.rotateVelocity*m,this.rotateVelocity*=v,f<m)break;const U=this.rotateOffset*M+w;A=Math.cos(U),T=Math.sin(U)}else if(f<m)break}}this.remaining=f}this.cx=o.worldX,this.cy=o.worldY;break;case kr.pose:i&&(o.worldX+=this.xOffset*t*this.data.x),n&&(o.worldY+=this.yOffset*t*this.data.y)}if(r){let l=this.rotateOffset*t,c=0,u=0,d=0;if(this.data.shearX>0){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!=kr.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)}},xR=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 Mt,this.darkColor=e.darkColor?new Mt:null,this.setToSetupPose()}getSkeleton(){return this.bone.skeleton}getAttachment(){return this.attachment}setAttachment(e){this.attachment!=e&&((!(e instanceof mr)||!(this.attachment instanceof mr)||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}},bR=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;n<e.bones.length;n++){let r=t.findBone(e.bones[n].name);if(!r)throw new Error(`Couldn't find bone ${e.bones[n].name}.`);this.bones.push(r)}let i=t.findBone(e.target.name);if(!i)throw new Error(`Couldn't find target bone ${e.target.name}.`);this.target=i,this.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY,this.mixScaleX=e.mixScaleX,this.mixScaleY=e.mixScaleY,this.mixShearY=e.mixShearY}isActive(){return this.active}setToSetupPose(){const e=this.data;this.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY,this.mixScaleX=e.mixScaleX,this.mixScaleY=e.mixScaleY,this.mixShearY=e.mixShearY}update(e){this.mixRotate==0&&this.mixX==0&&this.mixY==0&&this.mixScaleX==0&&this.mixScaleY==0&&this.mixShearY==0||(this.data.local?this.data.relative?this.applyRelativeLocal():this.applyAbsoluteLocal():this.data.relative?this.applyRelativeWorld():this.applyAbsoluteWorld())}applyAbsoluteWorld(){let e=this.mixRotate,t=this.mixX,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<b;v++){let y=g[v];if(e!=0){let w=y.a,A=y.b,T=y.c,M=y.d,R=Math.atan2(u,l)-Math.atan2(T,w)+p;R>$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*M,y.c=F*w+P*T,y.d=F*A+P*M}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),M=Math.atan2(d,c)-Math.atan2(u,l)-(T-Math.atan2(y.c,y.a));M>$e.PI?M-=$e.PI2:M<-3.1415927&&(M+=$e.PI2),M=T+(M+m)*a;let R=Math.sqrt(w*w+A*A);y.b=Math.cos(M)*R,y.d=Math.sin(M)*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<b;v++){let y=g[v];if(e!=0){let w=y.a,A=y.b,T=y.c,M=y.d,R=Math.atan2(u,l)+p;R>$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*M,y.c=F*w+P*T,y.d=F*A+P*M}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 M=Math.sqrt(A*A+T*T);y.b=Math.cos(w)*M,y.d=Math.sin(w)*M}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;l<c;l++){let u=h[l],d=u.arotation;e!=0&&(d+=(o.arotation-d+this.data.offsetRotation)*e);let f=u.ax,p=u.ay;f+=(o.ax-f+this.data.offsetX)*t,p+=(o.ay-p+this.data.offsetY)*i;let m=u.ascaleX,g=u.ascaleY;n!=0&&m!=0&&(m=(m+(o.ascaleX-m+this.data.offsetScaleX)*n)/m),r!=0&&g!=0&&(g=(g+(o.ascaleY-g+this.data.offsetScaleY)*r)/g);let v=u.ashearY;a!=0&&(v+=(o.ashearY-v+this.data.offsetShearY)*a),u.updateWorldTransformWith(f,p,d,m,g,u.ashearX,v)}}applyRelativeLocal(){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;l<c;l++){let u=h[l],d=u.arotation+(o.arotation+this.data.offsetRotation)*e,f=u.ax+(o.ax+this.data.offsetX)*t,p=u.ay+(o.ay+this.data.offsetY)*i,m=u.ascaleX*((o.ascaleX-1+this.data.offsetScaleX)*n+1),g=u.ascaleY*((o.ascaleY-1+this.data.offsetScaleY)*r+1),v=u.ashearY+(o.ashearY+this.data.offsetShearY)*a;u.updateWorldTransformWith(f,p,d,m,g,u.ashearX,v)}}};var Jn;let Ip=(Jn=class{constructor(e){x(this,"data");x(this,"bones");x(this,"slots");x(this,"drawOrder");x(this,"ikConstraints");x(this,"transformConstraints");x(this,"pathConstraints");x(this,"physicsConstraints");x(this,"_updateCache",new Array);x(this,"skin",null);x(this,"color");x(this,"scaleX",1);x(this,"_scaleY",1);x(this,"x",0);x(this,"y",0);x(this,"time",0);if(!e)throw new Error("data cannot be null.");this.data=e,this.bones=new Array;for(let t=0;t<e.bones.length;t++){let i=e.bones[t],n;if(!i.parent)n=new Yv(i,this,null);else{let r=this.bones[i.parent.index];n=new Yv(i,this,r),r.children.push(n)}this.bones.push(n)}this.slots=new Array,this.drawOrder=new Array;for(let t=0;t<e.slots.length;t++){let i=e.slots[t],n=this.bones[i.boneData.index],r=new xR(i,n);this.slots.push(r),this.drawOrder.push(r)}this.ikConstraints=new Array;for(let t=0;t<e.ikConstraints.length;t++){let i=e.ikConstraints[t];this.ikConstraints.push(new gR(i,this))}this.transformConstraints=new Array;for(let t=0;t<e.transformConstraints.length;t++){let i=e.transformConstraints[t];this.transformConstraints.push(new bR(i,this))}this.pathConstraints=new Array;for(let t=0;t<e.pathConstraints.length;t++){let i=e.pathConstraints[t];this.pathConstraints.push(new vR(i,this))}this.physicsConstraints=new Array;for(let t=0;t<e.physicsConstraints.length;t++){let i=e.physicsConstraints[t];this.physicsConstraints.push(new yR(i,this))}this.color=new Mt(1,1,1,1),this.updateCache()}get scaleY(){return Jn.yDown?-this._scaleY:this._scaleY}set scaleY(e){this._scaleY=e}updateCache(){let e=this._updateCache;e.length=0;let t=this.bones;for(let d=0,f=t.length;d<f;d++){let p=t[d];p.sorted=p.data.skinRequired,p.active=!p.sorted}if(this.skin){let d=this.skin.bones;for(let f=0,p=this.skin.bones.length;f<p;f++){let m=this.bones[d[f].index];do m.sorted=!1,m.active=!0,m=m.parent;while(m)}}let i=this.ikConstraints,n=this.transformConstraints,r=this.pathConstraints,a=this.physicsConstraints,o=i.length,h=n.length,l=r.length,c=this.physicsConstraints.length,u=o+h+l+c;e:for(let d=0;d<u;d++){for(let f=0;f<o;f++){let p=i[f];if(p.data.order==d){this.sortIkConstraint(p);continue e}}for(let f=0;f<h;f++){let p=n[f];if(p.data.order==d){this.sortTransformConstraint(p);continue e}}for(let f=0;f<l;f++){let p=r[f];if(p.data.order==d){this.sortPathConstraint(p);continue e}}for(let f=0;f<c;f++){const p=a[f];if(p.data.order==d){this.sortPhysicsConstraint(p);continue e}}}for(let d=0,f=t.length;d<f;d++)this.sortBone(t[d])}sortIkConstraint(e){if(e.active=e.target.isActive()&&(!e.data.skinRequired||this.skin&&Ge.contains(this.skin.constraints,e.data,!0)),!e.active)return;let t=e.target;this.sortBone(t);let i=e.bones,n=i[0];if(this.sortBone(n),i.length==1)this._updateCache.push(e),this.sortReset(n.children);else{let r=i[i.length-1];this.sortBone(r),this._updateCache.push(e),this.sortReset(n.children),r.sorted=!0}}sortPathConstraint(e){if(e.active=e.target.bone.isActive()&&(!e.data.skinRequired||this.skin&&Ge.contains(this.skin.constraints,e.data,!0)),!e.active)return;let t=e.target,i=t.data.index,n=t.bone;this.skin&&this.sortPathConstraintAttachment(this.skin,i,n),this.data.defaultSkin&&this.data.defaultSkin!=this.skin&&this.sortPathConstraintAttachment(this.data.defaultSkin,i,n);for(let h=0,l=this.data.skins.length;h<l;h++)this.sortPathConstraintAttachment(this.data.skins[h],i,n);let r=t.getAttachment();r instanceof Ul&&this.sortPathConstraintAttachmentWith(r,n);let a=e.bones,o=a.length;for(let h=0;h<o;h++)this.sortBone(a[h]);this._updateCache.push(e);for(let h=0;h<o;h++)this.sortReset(a[h].children);for(let h=0;h<o;h++)a[h].sorted=!0}sortTransformConstraint(e){if(e.active=e.target.isActive()&&(!e.data.skinRequired||this.skin&&Ge.contains(this.skin.constraints,e.data,!0)),!e.active)return;this.sortBone(e.target);let t=e.bones,i=t.length;if(e.data.local)for(let n=0;n<i;n++){let r=t[n];this.sortBone(r.parent),this.sortBone(r)}else for(let n=0;n<i;n++)this.sortBone(t[n]);this._updateCache.push(e);for(let n=0;n<i;n++)this.sortReset(t[n].children);for(let n=0;n<i;n++)t[n].sorted=!0}sortPathConstraintAttachment(e,t,i){let n=e.attachments[t];if(n)for(let r in n)this.sortPathConstraintAttachmentWith(n[r],i)}sortPathConstraintAttachmentWith(e,t){if(!(e instanceof Ul))return;let i=e.bones;if(!i)this.sortBone(t);else{let n=this.bones;for(let r=0,a=i.length;r<a;){let o=i[r++];for(o+=r;r<o;)this.sortBone(n[i[r++]])}}}sortPhysicsConstraint(e){const t=e.bone;e.active=t.active&&(!e.data.skinRequired||this.skin!=null&&Ge.contains(this.skin.constraints,e.data,!0)),e.active&&(this.sortBone(t),this._updateCache.push(e),this.sortReset(t.children),t.sorted=!0)}sortBone(e){if(!e||e.sorted)return;let t=e.parent;t&&this.sortBone(t),e.sorted=!0,this._updateCache.push(e)}sortReset(e){for(let t=0,i=e.length;t<i;t++){let n=e[t];n.active&&(n.sorted&&this.sortReset(n.children),n.sorted=!1)}}updateWorldTransform(e){if(e==null)throw new Error("physics is undefined");let t=this.bones;for(let n=0,r=t.length;n<r;n++){let a=t[n];a.ax=a.x,a.ay=a.y,a.arotation=a.rotation,a.ascaleX=a.scaleX,a.ascaleY=a.scaleY,a.ashearX=a.shearX,a.ashearY=a.shearY}let i=this._updateCache;for(let n=0,r=i.length;n<r;n++)i[n].update(e)}updateWorldTransformWith(e,t){if(!t)throw new Error("parent cannot be null.");let i=this.bones;for(let g=1,v=i.length;g<v;g++){let b=i[g];b.ax=b.x,b.ay=b.y,b.arotation=b.rotation,b.ascaleX=b.scaleX,b.ascaleY=b.scaleY,b.ashearX=b.shearX,b.ashearY=b.shearY}let n=this.getRootBone();if(!n)throw new Error("Root bone must not be null.");let r=t.a,a=t.b,o=t.c,h=t.d;n.worldX=r*this.x+a*this.y+t.worldX,n.worldY=o*this.x+h*this.y+t.worldY;const l=(n.rotation+n.shearX)*$e.degRad,c=(n.rotation+90+n.shearY)*$e.degRad,u=Math.cos(l)*n.scaleX,d=Math.cos(c)*n.scaleY,f=Math.sin(l)*n.scaleX,p=Math.sin(c)*n.scaleY;n.a=(r*u+a*f)*this.scaleX,n.b=(r*d+a*p)*this.scaleX,n.c=(o*u+h*f)*this.scaleY,n.d=(o*d+h*p)*this.scaleY;let m=this._updateCache;for(let g=0,v=m.length;g<v;g++){let b=m[g];b!=n&&b.update(e)}}setToSetupPose(){this.setBonesToSetupPose(),this.setSlotsToSetupPose()}setBonesToSetupPose(){for(const e of this.bones)e.setToSetupPose();for(const e of this.ikConstraints)e.setToSetupPose();for(const e of this.transformConstraints)e.setToSetupPose();for(const e of this.pathConstraints)e.setToSetupPose();for(const e of this.physicsConstraints)e.setToSetupPose()}setSlotsToSetupPose(){let e=this.slots;Ge.arrayCopy(e,0,this.drawOrder,0,e.length);for(let t=0,i=e.length;t<i;t++)e[t].setToSetupPose()}getRootBone(){return this.bones.length==0?null:this.bones[0]}findBone(e){if(!e)throw new Error("boneName cannot be null.");let t=this.bones;for(let i=0,n=t.length;i<n;i++){let r=t[i];if(r.data.name==e)return r}return null}findSlot(e){if(!e)throw new Error("slotName cannot be null.");let t=this.slots;for(let i=0,n=t.length;i<n;i++){let r=t[i];if(r.data.name==e)return r}return null}setSkinByName(e){let t=this.data.findSkin(e);if(!t)throw new Error("Skin not found: "+e);this.setSkin(t)}setSkin(e){if(e!=this.skin){if(e)if(this.skin)e.attachAll(this,this.skin);else{let t=this.slots;for(let i=0,n=t.length;i<n;i++){let r=t[i],a=r.data.attachmentName;if(a){let o=e.getAttachment(i,a);o&&r.setAttachment(o)}}}this.skin=e,this.updateCache()}}getAttachmentByName(e,t){let i=this.data.findSlot(e);if(!i)throw new Error(`Can't find slot with name ${e}`);return this.getAttachment(i.index,t)}getAttachment(e,t){if(!t)throw new Error("attachmentName cannot be null.");if(this.skin){let i=this.skin.getAttachment(e,t);if(i)return i}return this.data.defaultSkin?this.data.defaultSkin.getAttachment(e,t):null}setAttachment(e,t){if(!e)throw new Error("slotName cannot be null.");let i=this.slots;for(let n=0,r=i.length;n<r;n++){let a=i[n];if(a.data.name==e){let o=null;if(t&&(o=this.getAttachment(n,t),!o))throw new Error("Attachment not found: "+t+", for slot: "+e);a.setAttachment(o);return}}throw new Error("Slot not found: "+e)}findIkConstraint(e){if(!e)throw new Error("constraintName cannot be null.");return this.ikConstraints.find(t=>t.data.name==e)??null}findTransformConstraint(e){if(!e)throw new Error("constraintName cannot be null.");return this.transformConstraints.find(t=>t.data.name==e)??null}findPathConstraint(e){if(!e)throw new Error("constraintName cannot be null.");return this.pathConstraints.find(t=>t.data.name==e)??null}findPhysicsConstraint(e){if(e==null)throw new Error("constraintName cannot be null.");return this.physicsConstraints.find(t=>t.data.name==e)??null}getBoundsRect(e){let t=new 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<u;c++){let d=r[c];if(!d.bone.active)continue;let f=0,p=null,m=null,g=d.getAttachment();if(g instanceof Eu)f=8,p=Ge.setArraySize(i,f,0),g.computeWorldVertices(d,p,0,2),m=Jn.quadTriangles;else if(g instanceof Zl){let v=g;f=v.worldVerticesLength,p=Ge.setArraySize(i,f,0),v.computeWorldVertices(d,0,f,p,0,2),m=v.triangles}else if(g instanceof Mo&&n!=null){n.clipStart(d,g);continue}if(p&&m){n!=null&&n.isClipping()&&(n.clipTriangles(p,m,m.length),p=n.clippedVertices,f=n.clippedVertices.length);for(let v=0,b=p.length;v<b;v+=2){let y=p[v],w=p[v+1];a=Math.min(a,y),o=Math.min(o,w),h=Math.max(h,y),l=Math.max(l,w)}}n!=null&&n.clipEndWithSlot(d)}n!=null&&n.clipEnd(),e.set(a,o),t.set(h-a,l-o)}update(e){this.time+=e}physicsTranslate(e,t){const i=this.physicsConstraints;for(let n=0,r=i.length;n<r;n++)i[n].translate(e,t)}physicsRotate(e,t,i){const n=this.physicsConstraints;for(let r=0,a=n.length;r<a;r++)n[r].rotate(e,t,i)}},x(Jn,"quadTriangles",[0,1,2,2,3,0]),x(Jn,"yDown",!1),Jn);var kr;(function(s){s[s.none=0]="none",s[s.reset=1]="reset",s[s.update=2]="update",s[s.pose=3]="pose"})(kr||(kr={}));let fw=class extends Cu{constructor(t){super(t,0,!1);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,"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,"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)}set bone(t){this._bone=t}get bone(){if(this._bone)return this._bone;throw new Error("BoneData not set.")}},Bh=class{constructor(){x(this,"name",null);x(this,"bones",new Array);x(this,"slots",new Array);x(this,"skins",new Array);x(this,"defaultSkin",null);x(this,"events",new Array);x(this,"animations",new Array);x(this,"ikConstraints",new Array);x(this,"transformConstraints",new Array);x(this,"pathConstraints",new Array);x(this,"physicsConstraints",new Array);x(this,"x",0);x(this,"y",0);x(this,"width",0);x(this,"height",0);x(this,"referenceScale",100);x(this,"version",null);x(this,"hash",null);x(this,"fps",0);x(this,"imagesPath",null);x(this,"audioPath",null)}findBone(e){if(!e)throw new Error("boneName cannot be null.");let t=this.bones;for(let i=0,n=t.length;i<n;i++){let r=t[i];if(r.name==e)return r}return null}findSlot(e){if(!e)throw new Error("slotName cannot be null.");let t=this.slots;for(let i=0,n=t.length;i<n;i++){let r=t[i];if(r.name==e)return r}return null}findSkin(e){if(!e)throw new Error("skinName cannot be null.");let t=this.skins;for(let i=0,n=t.length;i<n;i++){let r=t[i];if(r.name==e)return r}return null}findEvent(e){if(!e)throw new Error("eventDataName cannot be null.");let t=this.events;for(let i=0,n=t.length;i<n;i++){let r=t[i];if(r.name==e)return r}return null}findAnimation(e){if(!e)throw new Error("animationName cannot be null.");let t=this.animations;for(let i=0,n=t.length;i<n;i++){let r=t[i];if(r.name==e)return r}return null}findIkConstraint(e){if(!e)throw new Error("constraintName cannot be null.");const t=this.ikConstraints;for(let i=0,n=t.length;i<n;i++){const r=t[i];if(r.name==e)return r}return null}findTransformConstraint(e){if(!e)throw new Error("constraintName cannot be null.");const t=this.transformConstraints;for(let i=0,n=t.length;i<n;i++){const r=t[i];if(r.name==e)return r}return null}findPathConstraint(e){if(!e)throw new Error("constraintName cannot be null.");const t=this.pathConstraints;for(let i=0,n=t.length;i<n;i++){const r=t[i];if(r.name==e)return r}return null}findPhysicsConstraint(e){if(!e)throw new Error("constraintName cannot be null.");const t=this.physicsConstraints;for(let i=0,n=t.length;i<n;i++){const r=t[i];if(r.name==e)return r}return null}},$v=class{constructor(e=0,t,i){x(this,"slotIndex");x(this,"name");x(this,"attachment");this.slotIndex=e,this.name=t,this.attachment=i}},Em=class{constructor(e){x(this,"name");x(this,"attachments",new Array);x(this,"bones",Array());x(this,"constraints",new Array);x(this,"color",new Mt(.99607843,.61960787,.30980393,1));if(!e)throw new Error("name cannot be null.");this.name=e}setAttachment(e,t,i){if(!i)throw new Error("attachment cannot be null.");let n=this.attachments;e>=n.length&&(n.length=e+1),n[e]||(n[e]={}),n[e][t]=i}addSkin(e){for(let n=0;n<e.bones.length;n++){let r=e.bones[n],a=!1;for(let o=0;o<this.bones.length;o++)if(this.bones[o]==r){a=!0;break}a||this.bones.push(r)}for(let n=0;n<e.constraints.length;n++){let r=e.constraints[n],a=!1;for(let o=0;o<this.constraints.length;o++)if(this.constraints[o]==r){a=!0;break}a||this.constraints.push(r)}let t=e.getAttachments();for(let n=0;n<t.length;n++){var i=t[n];this.setAttachment(i.slotIndex,i.name,i.attachment)}}copySkin(e){for(let n=0;n<e.bones.length;n++){let r=e.bones[n],a=!1;for(let o=0;o<this.bones.length;o++)if(this.bones[o]==r){a=!0;break}a||this.bones.push(r)}for(let n=0;n<e.constraints.length;n++){let r=e.constraints[n],a=!1;for(let o=0;o<this.constraints.length;o++)if(this.constraints[o]==r){a=!0;break}a||this.constraints.push(r)}let t=e.getAttachments();for(let n=0;n<t.length;n++){var i=t[n];i.attachment&&(i.attachment instanceof Zl?(i.attachment=i.attachment.newLinkedMesh(),this.setAttachment(i.slotIndex,i.name,i.attachment)):(i.attachment=i.attachment.copy(),this.setAttachment(i.slotIndex,i.name,i.attachment)))}}getAttachment(e,t){let i=this.attachments[e];return i?i[t]:null}removeAttachment(e,t){let i=this.attachments[e];i&&delete i[t]}getAttachments(){let e=new Array;for(var t=0;t<this.attachments.length;t++){let i=this.attachments[t];if(i)for(let n in i){let r=i[n];r&&e.push(new $v(t,n,r))}}return e}getAttachmentsForSlot(e,t){let i=this.attachments[e];if(i)for(let n in i){let r=i[n];r&&t.push(new $v(e,n,r))}}clear(){this.attachments.length=0,this.bones.length=0,this.constraints.length=0}attachAll(e,t){let i=0;for(let n=0;n<e.slots.length;n++){let r=e.slots[n],a=r.getAttachment();if(a&&i<t.attachments.length){let o=t.attachments[i];for(let h in o){let l=o[h];if(a==l){let c=this.getAttachment(i,h);c&&r.setAttachment(c);break}}}i++}}},mw=class{constructor(e,t,i){x(this,"index",0);x(this,"name");x(this,"boneData");x(this,"color",new Mt(1,1,1,1));x(this,"darkColor",null);x(this,"attachmentName",null);x(this,"blendMode",Nr.Normal);x(this,"visible",!0);if(e<0)throw new Error("index must be >= 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 Nr;(function(s){s[s.Normal=0]="Normal",s[s.Additive=1]="Additive",s[s.Multiply=2]="Multiply",s[s.Screen=3]="Screen"})(Nr||(Nr={}));let pw=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 wR(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<h;c++){let u=n.readString();if(!u)throw new Error("String in string table must not be null.");n.strings.push(u)}h=n.readInt(!0);for(let c=0;c<h;c++){let u=n.readString();if(!u)throw new Error("Bone name must not be null.");let d=c==0?null:i.bones[n.readInt(!0)],f=new lw(c,u,d);f.rotation=n.readFloat(),f.x=n.readFloat()*t,f.y=n.readFloat()*t,f.scaleX=n.readFloat(),f.scaleY=n.readFloat(),f.shearX=n.readFloat(),f.shearY=n.readFloat(),f.length=n.readFloat()*t,f.inherit=n.readByte(),f.skinRequired=n.readBoolean(),o&&(Mt.rgba8888ToColor(f.color,n.readInt32()),f.icon=n.readString()??void 0,f.visible=n.readBoolean()),i.bones.push(f)}h=n.readInt(!0);for(let c=0;c<h;c++){let u=n.readString();if(!u)throw new Error("Slot name must not be null.");let d=i.bones[n.readInt(!0)],f=new mw(c,u,d);Mt.rgba8888ToColor(f.color,n.readInt32());let p=n.readInt32();p!=-1&&Mt.rgb888ToColor(f.darkColor=new Mt,p),f.attachmentName=n.readStringRef(),f.blendMode=n.readInt(!0),o&&(f.visible=n.readBoolean()),i.slots.push(f)}h=n.readInt(!0);for(let c=0,u;c<h;c++){let d=n.readString();if(!d)throw new Error("IK constraint data name must not be null.");let f=new uw(d);f.order=n.readInt(!0),u=n.readInt(!0);for(let m=0;m<u;m++)f.bones.push(i.bones[n.readInt(!0)]);f.target=i.bones[n.readInt(!0)];let p=n.readByte();f.skinRequired=(p&1)!=0,f.bendDirection=(p&2)!=0?1:-1,f.compress=(p&4)!=0,f.stretch=(p&8)!=0,f.uniform=(p&16)!=0,(p&32)!=0&&(f.mix=(p&64)!=0?n.readFloat():1),(p&128)!=0&&(f.softness=n.readFloat()*t),i.ikConstraints.push(f)}h=n.readInt(!0);for(let c=0,u;c<h;c++){let d=n.readString();if(!d)throw new Error("Transform constraint data name must not be null.");let f=new pw(d);f.order=n.readInt(!0),u=n.readInt(!0);for(let m=0;m<u;m++)f.bones.push(i.bones[n.readInt(!0)]);f.target=i.bones[n.readInt(!0)];let p=n.readByte();f.skinRequired=(p&1)!=0,f.local=(p&2)!=0,f.relative=(p&4)!=0,(p&8)!=0&&(f.offsetRotation=n.readFloat()),(p&16)!=0&&(f.offsetX=n.readFloat()*t),(p&32)!=0&&(f.offsetY=n.readFloat()*t),(p&64)!=0&&(f.offsetScaleX=n.readFloat()),(p&128)!=0&&(f.offsetScaleY=n.readFloat()),p=n.readByte(),(p&1)!=0&&(f.offsetShearY=n.readFloat()),(p&2)!=0&&(f.mixRotate=n.readFloat()),(p&4)!=0&&(f.mixX=n.readFloat()),(p&8)!=0&&(f.mixY=n.readFloat()),(p&16)!=0&&(f.mixScaleX=n.readFloat()),(p&32)!=0&&(f.mixScaleY=n.readFloat()),(p&64)!=0&&(f.mixShearY=n.readFloat()),i.transformConstraints.push(f)}h=n.readInt(!0);for(let c=0,u;c<h;c++){let d=n.readString();if(!d)throw new Error("Path constraint data name must not be null.");let f=new dw(d);f.order=n.readInt(!0),f.skinRequired=n.readBoolean(),u=n.readInt(!0);for(let m=0;m<u;m++)f.bones.push(i.bones[n.readInt(!0)]);f.target=i.slots[n.readInt(!0)];const p=n.readByte();f.positionMode=p&1,f.spacingMode=p>>1&3,f.rotateMode=p>>3&3,(p&128)!=0&&(f.offsetRotation=n.readFloat()),f.position=n.readFloat(),f.positionMode==Fn.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<h;c++){const d=n.readString();if(!d)throw new Error("Physics constraint data name must not be null.");const f=new fw(d);f.order=n.readInt(!0),f.bone=i.bones[n.readInt(!0)];let p=n.readByte();f.skinRequired=(p&1)!=0,(p&2)!=0&&(f.x=n.readFloat()),(p&4)!=0&&(f.y=n.readFloat()),(p&8)!=0&&(f.rotate=n.readFloat()),(p&16)!=0&&(f.scaleX=n.readFloat()),(p&32)!=0&&(f.shearX=n.readFloat()),f.limit=((p&64)!=0?n.readFloat():5e3)*t,f.step=1/n.readUnsignedByte(),f.inertia=n.readFloat(),f.strength=n.readFloat(),f.damping=n.readFloat(),f.massInverse=(p&128)!=0?n.readFloat():1,f.wind=n.readFloat(),f.gravity=n.readFloat(),p=n.readByte(),(p&1)!=0&&(f.inertiaGlobal=!0),(p&2)!=0&&(f.strengthGlobal=!0),(p&4)!=0&&(f.dampingGlobal=!0),(p&8)!=0&&(f.massGlobal=!0),(p&16)!=0&&(f.windGlobal=!0),(p&32)!=0&&(f.gravityGlobal=!0),(p&64)!=0&&(f.mixGlobal=!0),f.mix=(p&128)!=0?n.readFloat():1,i.physicsConstraints.push(f)}let l=this.readSkin(n,i,!0,o);l&&(i.defaultSkin=l,i.skins.push(l));{let c=i.skins.length;for(Ge.setArraySize(i.skins,h=c+n.readInt(!0));c<h;c++){let u=this.readSkin(n,i,!1,o);if(!u)throw new Error("readSkin() should not have returned null.");i.skins[c]=u}}h=this.linkedMeshes.length;for(let c=0;c<h;c++){let u=this.linkedMeshes[c];const d=i.skins[u.skinIndex];if(!u.parent)throw new Error("Linked mesh parent must not be null");let f=d.getAttachment(u.slotIndex,u.parent);if(!f)throw new Error(`Parent mesh not found: ${u.parent}`);u.mesh.timelineAttachment=u.inheritTimeline?f:u.mesh,u.mesh.setParentMesh(f),u.mesh.region!=null&&u.mesh.updateRegion()}this.linkedMeshes.length=0,h=n.readInt(!0);for(let c=0;c<h;c++){let u=n.readString();if(!u)throw new Error("Event data name must not be null");let d=new hw(u);d.intValue=n.readInt(!1),d.floatValue=n.readFloat(),d.stringValue=n.readString(),d.audioPath=n.readString(),d.audioPath&&(d.volume=n.readFloat(),d.balance=n.readFloat()),i.events.push(d)}h=n.readInt(!0);for(let c=0;c<h;c++){let u=n.readString();if(!u)throw new Error("Animatio name must not be null.");i.animations.push(this.readAnimation(n,u,i))}return i}readSkin(e,t,i,n){let r=null,a=0;if(i){if(a=e.readInt(!0),a==0)return null;r=new Em("default")}else{let o=e.readString();if(!o)throw new Error("Skin name must not be null.");r=new Em(o),n&&Mt.rgba8888ToColor(r.color,e.readInt32()),r.bones.length=e.readInt(!0);for(let h=0,l=r.bones.length;h<l;h++)r.bones[h]=t.bones[e.readInt(!0)];for(let h=0,l=e.readInt(!0);h<l;h++)r.constraints.push(t.ikConstraints[e.readInt(!0)]);for(let h=0,l=e.readInt(!0);h<l;h++)r.constraints.push(t.transformConstraints[e.readInt(!0)]);for(let h=0,l=e.readInt(!0);h<l;h++)r.constraints.push(t.pathConstraints[e.readInt(!0)]);for(let h=0,l=e.readInt(!0);h<l;h++)r.constraints.push(t.physicsConstraints[e.readInt(!0)]);a=e.readInt(!0)}for(let o=0;o<a;o++){let h=e.readInt(!0);for(let l=0,c=e.readInt(!0);l<c;l++){let u=e.readStringRef();if(!u)throw new Error("Attachment name must not be null");let d=this.readAttachment(e,t,r,h,u,n);d&&r.setAttachment(h,u,d)}}return r}readAttachment(e,t,i,n,r,a){let o=this.scale,h=e.readByte();const l=(h&8)!=0?e.readStringRef():r;if(!l)throw new Error("Attachment name must not be null");switch(h&7){case Hn.Region:{let c=(h&16)!=0?e.readStringRef():null;const u=(h&32)!=0?e.readInt32():4294967295,d=(h&64)!=0?this.readSequence(e):null;let f=(h&128)!=0?e.readFloat():0,p=e.readFloat(),m=e.readFloat(),g=e.readFloat(),v=e.readFloat(),b=e.readFloat(),y=e.readFloat();c||(c=l);let w=this.attachmentLoader.newRegionAttachment(i,l,c,d);return w?(w.path=c,w.x=p*o,w.y=m*o,w.scaleX=g,w.scaleY=v,w.rotation=f,w.width=b*o,w.height=y*o,Mt.rgba8888ToColor(w.color,u),w.sequence=d,d==null&&w.updateRegion(),w):null}case Hn.BoundingBox:{let c=this.readVertices(e,(h&16)!=0),u=a?e.readInt32():0,d=this.attachmentLoader.newBoundingBoxAttachment(i,l);return d?(d.worldVerticesLength=c.length,d.vertices=c.vertices,d.bones=c.bones,a&&Mt.rgba8888ToColor(d.color,u),d):null}case Hn.Mesh:{let c=(h&16)!=0?e.readStringRef():l;const u=(h&32)!=0?e.readInt32():4294967295,d=(h&64)!=0?this.readSequence(e):null,f=e.readInt(!0),p=this.readVertices(e,(h&128)!=0),m=this.readFloatArray(e,p.length,1),g=this.readShortArray(e,(p.length-f-2)*3);let v=[],b=0,y=0;a&&(v=this.readShortArray(e,e.readInt(!0)),b=e.readFloat(),y=e.readFloat()),c||(c=l);let w=this.attachmentLoader.newMeshAttachment(i,l,c,d);return w?(w.path=c,Mt.rgba8888ToColor(w.color,u),w.bones=p.bones,w.vertices=p.vertices,w.worldVerticesLength=p.length,w.triangles=g,w.regionUVs=m,d==null&&w.updateRegion(),w.hullLength=f<<1,w.sequence=d,a&&(w.edges=v,w.width=b*o,w.height=y*o),w):null}case Hn.LinkedMesh:{const c=(h&16)!=0?e.readStringRef():l;if(c==null)throw new Error("Path of linked mesh must not be null");const u=(h&32)!=0?e.readInt32():4294967295,d=(h&64)!=0?this.readSequence(e):null,f=(h&128)!=0,p=e.readInt(!0),m=e.readStringRef();let g=0,v=0;a&&(g=e.readFloat(),v=e.readFloat());let b=this.attachmentLoader.newMeshAttachment(i,l,c,d);return b?(b.path=c,Mt.rgba8888ToColor(b.color,u),b.sequence=d,a&&(b.width=g*o,b.height=v*o),this.linkedMeshes.push(new SR(b,p,n,m,f)),b):null}case Hn.Path:{const c=(h&16)!=0,u=(h&32)!=0,d=this.readVertices(e,(h&64)!=0),f=Ge.newArray(d.length/6,0);for(let g=0,v=f.length;g<v;g++)f[g]=e.readFloat()*o;const p=a?e.readInt32():0,m=this.attachmentLoader.newPathAttachment(i,l);return m?(m.closed=c,m.constantSpeed=u,m.worldVerticesLength=d.length,m.vertices=d.vertices,m.bones=d.bones,m.lengths=f,a&&Mt.rgba8888ToColor(m.color,p),m):null}case Hn.Point:{const c=e.readFloat(),u=e.readFloat(),d=e.readFloat(),f=a?e.readInt32():0,p=this.attachmentLoader.newPointAttachment(i,l);return p?(p.x=u*o,p.y=d*o,p.rotation=c,a&&Mt.rgba8888ToColor(p.color,f),p):null}case Hn.Clipping:{const c=e.readInt(!0),u=this.readVertices(e,(h&16)!=0);let d=a?e.readInt32():0,f=this.attachmentLoader.newClippingAttachment(i,l);return f?(f.endSlot=t.slots[c],f.worldVerticesLength=u.length,f.vertices=u.vertices,f.bones=u.bones,a&&Mt.rgba8888ToColor(f.color,d),f):null}}return null}readSequence(e){let t=new S1(e.readInt(!0));return t.start=e.readInt(!0),t.digits=e.readInt(!0),t.setupIndex=e.readInt(!0),t}readVertices(e,t){const i=this.scale,n=e.readInt(!0),r=new _R;if(r.length=n<<1,!t)return r.vertices=this.readFloatArray(e,r.length,i),r;let a=new Array,o=new Array;for(let h=0;h<n;h++){let l=e.readInt(!0);o.push(l);for(let c=0;c<l;c++)o.push(e.readInt(!0)),a.push(e.readFloat()*i),a.push(e.readFloat()*i),a.push(e.readFloat())}return r.vertices=Ge.toFloatArray(a),r.bones=o,r}readFloatArray(e,t,i){let n=new Array(t);if(i==1)for(let r=0;r<t;r++)n[r]=e.readFloat();else for(let r=0;r<t;r++)n[r]=e.readFloat()*i;return n}readShortArray(e,t){let i=new Array(t);for(let n=0;n<t;n++)i[n]=e.readInt(!0);return i}readAnimation(e,t,i){e.readInt(!0);let n=new Array,r=this.scale;for(let l=0,c=e.readInt(!0);l<c;l++){let u=e.readInt(!0);for(let d=0,f=e.readInt(!0);d<f;d++){let p=e.readByte(),m=e.readInt(!0),g=m-1;switch(p){case BR:{let v=new co(m,u);for(let b=0;b<m;b++)v.setFrame(b,e.readFloat(),e.readStringRef());n.push(v);break}case LR:{let v=e.readInt(!0),b=new O1(m,v,u),y=e.readFloat(),w=e.readUnsignedByte()/255,A=e.readUnsignedByte()/255,T=e.readUnsignedByte()/255,M=e.readUnsignedByte()/255;for(let R=0,P=0;b.setFrame(R,y,w,A,T,M),R!=g;R++){let F=e.readFloat(),I=e.readUnsignedByte()/255,k=e.readUnsignedByte()/255,O=e.readUnsignedByte()/255,L=e.readUnsignedByte()/255;switch(e.readByte()){case xn:b.setStepped(R);break;case bn:Bt(e,b,P++,R,0,y,F,w,I,1),Bt(e,b,P++,R,1,y,F,A,k,1),Bt(e,b,P++,R,2,y,F,T,O,1),Bt(e,b,P++,R,3,y,F,M,L,1)}y=F,w=I,A=k,T=O,M=L}n.push(b);break}case DR:{let v=e.readInt(!0),b=new B1(m,v,u),y=e.readFloat(),w=e.readUnsignedByte()/255,A=e.readUnsignedByte()/255,T=e.readUnsignedByte()/255;for(let M=0,R=0;b.setFrame(M,y,w,A,T),M!=g;M++){let P=e.readFloat(),F=e.readUnsignedByte()/255,I=e.readUnsignedByte()/255,k=e.readUnsignedByte()/255;switch(e.readByte()){case xn:b.setStepped(M);break;case bn:Bt(e,b,R++,M,0,y,P,w,F,1),Bt(e,b,R++,M,1,y,P,A,I,1),Bt(e,b,R++,M,2,y,P,T,k,1)}y=P,w=F,A=I,T=k}n.push(b);break}case NR:{let v=e.readInt(!0),b=new D1(m,v,u),y=e.readFloat(),w=e.readUnsignedByte()/255,A=e.readUnsignedByte()/255,T=e.readUnsignedByte()/255,M=e.readUnsignedByte()/255,R=e.readUnsignedByte()/255,P=e.readUnsignedByte()/255,F=e.readUnsignedByte()/255;for(let I=0,k=0;b.setFrame(I,y,w,A,T,M,R,P,F),I!=g;I++){let O=e.readFloat(),L=e.readUnsignedByte()/255,U=e.readUnsignedByte()/255,B=e.readUnsignedByte()/255,D=e.readUnsignedByte()/255,_=e.readUnsignedByte()/255,X=e.readUnsignedByte()/255,N=e.readUnsignedByte()/255;switch(e.readByte()){case xn:b.setStepped(I);break;case bn:Bt(e,b,k++,I,0,y,O,w,L,1),Bt(e,b,k++,I,1,y,O,A,U,1),Bt(e,b,k++,I,2,y,O,T,B,1),Bt(e,b,k++,I,3,y,O,M,D,1),Bt(e,b,k++,I,4,y,O,R,_,1),Bt(e,b,k++,I,5,y,O,P,X,1),Bt(e,b,k++,I,6,y,O,F,N,1)}y=O,w=L,A=U,T=B,M=D,R=_,P=X,F=N}n.push(b);break}case UR:{let v=e.readInt(!0),b=new N1(m,v,u),y=e.readFloat(),w=e.readUnsignedByte()/255,A=e.readUnsignedByte()/255,T=e.readUnsignedByte()/255,M=e.readUnsignedByte()/255,R=e.readUnsignedByte()/255,P=e.readUnsignedByte()/255;for(let F=0,I=0;b.setFrame(F,y,w,A,T,M,R,P),F!=g;F++){let k=e.readFloat(),O=e.readUnsignedByte()/255,L=e.readUnsignedByte()/255,U=e.readUnsignedByte()/255,B=e.readUnsignedByte()/255,D=e.readUnsignedByte()/255,_=e.readUnsignedByte()/255;switch(e.readByte()){case xn:b.setStepped(F);break;case bn:Bt(e,b,I++,F,0,y,k,w,O,1),Bt(e,b,I++,F,1,y,k,A,L,1),Bt(e,b,I++,F,2,y,k,T,U,1),Bt(e,b,I++,F,3,y,k,M,B,1),Bt(e,b,I++,F,4,y,k,R,D,1),Bt(e,b,I++,F,5,y,k,P,_,1)}y=k,w=O,A=L,T=U,M=B,R=D,P=_}n.push(b);break}case XR:{let v=new L1(m,e.readInt(!0),u),b=e.readFloat(),y=e.readUnsignedByte()/255;for(let w=0,A=0;v.setFrame(w,b,y),w!=g;w++){let T=e.readFloat(),M=e.readUnsignedByte()/255;switch(e.readByte()){case xn:v.setStepped(w);break;case bn:Bt(e,v,A++,w,0,b,T,y,M,1)}b=T,y=M}n.push(v)}}}}for(let l=0,c=e.readInt(!0);l<c;l++){let u=e.readInt(!0);for(let d=0,f=e.readInt(!0);d<f;d++){let p=e.readByte(),m=e.readInt(!0);if(p==OR){let v=new F1(m,u);for(let b=0;b<m;b++)v.setFrame(b,e.readFloat(),e.readByte());n.push(v);continue}let g=e.readInt(!0);switch(p){case MR:n.push(zi(e,new Oh(m,g,u),1));break;case TR:n.push(Sf(e,new M1(m,g,u),r));break;case AR:n.push(zi(e,new T1(m,g,u),r));break;case ER:n.push(zi(e,new A1(m,g,u),r));break;case CR:n.push(Sf(e,new E1(m,g,u),1));break;case IR:n.push(zi(e,new C1(m,g,u),1));break;case RR:n.push(zi(e,new I1(m,g,u),1));break;case PR:n.push(Sf(e,new R1(m,g,u),1));break;case kR:n.push(zi(e,new P1(m,g,u),1));break;case FR:n.push(zi(e,new k1(m,g,u),1))}}}for(let l=0,c=e.readInt(!0);l<c;l++){let u=e.readInt(!0),d=e.readInt(!0),f=d-1,p=new X1(d,e.readInt(!0),u),m=e.readByte(),g=e.readFloat(),v=(m&1)!=0?(m&2)!=0?e.readFloat():1:0,b=(m&4)!=0?e.readFloat()*r:0;for(let y=0,w=0;p.setFrame(y,g,v,b,(m&8)!=0?1:-1,(m&16)!=0,(m&32)!=0),y!=f;y++){m=e.readByte();const A=e.readFloat(),T=(m&1)!=0?(m&2)!=0?e.readFloat():1:0,M=(m&4)!=0?e.readFloat()*r:0;(m&64)!=0?p.setStepped(y):(m&128)!=0&&(Bt(e,p,w++,y,0,g,A,v,T,1),Bt(e,p,w++,y,1,g,A,b,M,r)),g=A,v=T,b=M}n.push(p)}for(let l=0,c=e.readInt(!0);l<c;l++){let u=e.readInt(!0),d=e.readInt(!0),f=d-1,p=new V1(d,e.readInt(!0),u),m=e.readFloat(),g=e.readFloat(),v=e.readFloat(),b=e.readFloat(),y=e.readFloat(),w=e.readFloat(),A=e.readFloat();for(let T=0,M=0;p.setFrame(T,m,g,v,b,y,w,A),T!=f;T++){let R=e.readFloat(),P=e.readFloat(),F=e.readFloat(),I=e.readFloat(),k=e.readFloat(),O=e.readFloat(),L=e.readFloat();switch(e.readByte()){case xn:p.setStepped(T);break;case bn:Bt(e,p,M++,T,0,m,R,g,P,1),Bt(e,p,M++,T,1,m,R,v,F,1),Bt(e,p,M++,T,2,m,R,b,I,1),Bt(e,p,M++,T,3,m,R,y,k,1),Bt(e,p,M++,T,4,m,R,w,O,1),Bt(e,p,M++,T,5,m,R,A,L,1)}m=R,g=P,v=F,b=I,y=k,w=O,A=L}n.push(p)}for(let l=0,c=e.readInt(!0);l<c;l++){let u=e.readInt(!0),d=i.pathConstraints[u];for(let f=0,p=e.readInt(!0);f<p;f++){const m=e.readByte(),g=e.readInt(!0),v=e.readInt(!0);switch(m){case $R:n.push(zi(e,new Y1(g,v,u),d.positionMode==Fn.Fixed?r:1));break;case GR:n.push(zi(e,new $1(g,v,u),d.spacingMode==ki.Length||d.spacingMode==ki.Fixed?r:1));break;case HR:let b=new G1(g,v,u),y=e.readFloat(),w=e.readFloat(),A=e.readFloat(),T=e.readFloat();for(let M=0,R=0,P=b.getFrameCount()-1;b.setFrame(M,y,w,A,T),M!=P;M++){let F=e.readFloat(),I=e.readFloat(),k=e.readFloat(),O=e.readFloat();switch(e.readByte()){case xn:b.setStepped(M);break;case bn:Bt(e,b,R++,M,0,y,F,w,I,1),Bt(e,b,R++,M,1,y,F,A,k,1),Bt(e,b,R++,M,2,y,F,T,O,1)}y=F,w=I,A=k,T=O}n.push(b)}}}for(let l=0,c=e.readInt(!0);l<c;l++){const u=e.readInt(!0)-1;for(let d=0,f=e.readInt(!0);d<f;d++){const p=e.readByte(),m=e.readInt(!0);if(p==QR){const v=new J1(m,u);for(let b=0;b<m;b++)v.setFrame(b,e.readFloat());n.push(v);continue}const g=e.readInt(!0);switch(p){case jR:n.push(zi(e,new H1(m,g,u),1));break;case WR:n.push(zi(e,new j1(m,g,u),1));break;case zR:n.push(zi(e,new W1(m,g,u),1));break;case qR:n.push(zi(e,new z1(m,g,u),1));break;case KR:n.push(zi(e,new q1(m,g,u),1));break;case ZR:n.push(zi(e,new K1(m,g,u),1));break;case JR:n.push(zi(e,new Z1(m,g,u),1))}}}for(let l=0,c=e.readInt(!0);l<c;l++){let u=i.skins[e.readInt(!0)];for(let d=0,f=e.readInt(!0);d<f;d++){let p=e.readInt(!0);for(let m=0,g=e.readInt(!0);m<g;m++){let v=e.readStringRef();if(!v)throw new Error("attachmentName must not be null.");let b=u.getAttachment(p,v),y=e.readByte(),w=e.readInt(!0),A=w-1;switch(y){case VR:{let T=b,M=T.bones,R=T.vertices,P=M?R.length/3*2:R.length,F=e.readInt(!0),I=new U1(w,F,p,T),k=e.readFloat();for(let O=0,L=0;;O++){let U,B=e.readInt(!0);if(B==0)U=M?Ge.newFloatArray(P):R;else{U=Ge.newFloatArray(P);let _=e.readInt(!0);if(B+=_,r==1)for(let X=_;X<B;X++)U[X]=e.readFloat();else for(let X=_;X<B;X++)U[X]=e.readFloat()*r;if(!M)for(let X=0,N=U.length;X<N;X++)U[X]+=R[X]}if(I.setFrame(O,k,U),O==A)break;let D=e.readFloat();switch(e.readByte()){case xn:I.setStepped(O);break;case bn:Bt(e,I,L++,O,0,k,D,0,1,1)}k=D}n.push(I);break}case YR:{let T=new Q1(w,p,b);for(let M=0;M<w;M++){let R=e.readFloat(),P=e.readInt32();T.setFrame(M,R,_1[P&15],P>>4,e.readFloat())}n.push(T);break}}}}}let a=e.readInt(!0);if(a>0){let l=new vl(a),c=i.slots.length;for(let u=0;u<a;u++){let d=e.readFloat(),f=e.readInt(!0),p=Ge.newArray(c,0);for(let b=c-1;b>=0;b--)p[b]=-1;let m=Ge.newArray(c-f,0),g=0,v=0;for(let b=0;b<f;b++){let y=e.readInt(!0);for(;g!=y;)m[v++]=g++;p[g+e.readInt(!0)]=g++}for(;g<c;)m[v++]=g++;for(let b=c-1;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 Cp(o);for(let c=0;c<o;c++){let u=e.readFloat(),d=i.events[e.readInt(!0)],f=new cw(u,d);f.intValue=e.readInt(!1),f.floatValue=e.readFloat(),f.stringValue=e.readString(),f.stringValue==null&&(f.stringValue=d.stringValue),f.data.audioPath&&(f.volume=e.readFloat(),f.balance=e.readFloat()),l.setFrame(c,f)}n.push(l)}let h=0;for(let l=0,c=n.length;l<c;l++)h=Math.max(h,n[l].getDuration());return new Ap(t,n,h)}},wR=class{constructor(e,t=new Array,i=0,n=new DataView(e instanceof ArrayBuffer?e:e.buffer)){x(this,"strings");x(this,"index");x(this,"buffer");this.strings=t,this.index=i,this.buffer=n}readByte(){return this.buffer.getInt8(this.index++)}readUnsignedByte(){return this.buffer.getUint8(this.index++)}readShort(){let e=this.buffer.getInt16(this.index);return this.index+=2,e}readInt32(){let e=this.buffer.getInt32(this.index);return this.index+=4,e}readInt(e){let t=this.readByte(),i=t&127;return(t&128)!=0&&(t=this.readByte(),i|=(t&127)<<7,(t&128)!=0&&(t=this.readByte(),i|=(t&127)<<14,(t&128)!=0&&(t=this.readByte(),i|=(t&127)<<21,(t&128)!=0&&(t=this.readByte(),i|=(t&127)<<28)))),e?i:i>>>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<e;){let n=this.readUnsignedByte();switch(n>>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}},SR=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}},_R=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 Hn;(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"})(Hn||(Hn={}));function zi(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 xn:e.setStepped(r);break;case bn:Bt(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 xn:e.setStepped(a);break;case bn:Bt(s,e,o++,a,0,i,l,n,c,t),Bt(s,e,o++,a,1,i,l,r,u,t)}i=l,n=c,r=u}return e}function Bt(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,TR=1,AR=2,ER=3,CR=4,IR=5,RR=6,PR=7,kR=8,FR=9,OR=10,BR=0,LR=1,DR=2,NR=3,UR=4,XR=5,VR=0,YR=1,$R=0,GR=1,HR=2,jR=0,WR=1,zR=2,qR=4,KR=5,ZR=6,JR=7,QR=8,xn=1,bn=2;class ds{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;o<i;o++)n[o]=o;let r=this.isConcaveArray;r.length=0;for(let o=0,h=i;o<h;++o)r[o]=ds.isConcave(o,i,t,n);let a=this.triangles;for(a.length=0;i>3;){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,M=t[T],R=t[T+1];if(ds.positiveArea(y,w,m,g,M,R)&&ds.positiveArea(m,g,v,b,M,R)&&ds.positiveArea(v,b,y,w,M,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]=ds.isConcave(c,i,t,n),r[u]=ds.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;c<u;c+=3){let d=t[c]<<1,f=t[c+1]<<1,p=t[c+2]<<1,m=i[d],g=i[d+1],v=i[f],b=i[f+1],y=i[p],w=i[p+1],A=!1;if(h==d){let T=o.length-4,M=ds.winding(o[T],o[T+1],o[T+2],o[T+3],y,w),R=ds.winding(y,w,o[0],o[1],o[2],o[3]);M==l&&R==l&&(o.push(y),o.push(w),a.push(p),A=!0)}A||(o.length>0?(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=ds.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<u;c++){if(a=r[c],a.length==0)continue;let d=a[0],f=a[a.length-1];o=n[c];let p=o.length-4,m=o[p],g=o[p+1],v=o[p+2],b=o[p+3],y=o[0],w=o[1],A=o[2],T=o[3],M=ds.winding(m,g,v,b,y,w);for(let R=0;R<u;R++){if(R==c)continue;let P=r[R];if(P.length!=3)continue;let F=P[0],I=P[1],k=P[2],O=n[R],L=O[O.length-2],U=O[O.length-1];if(F!=d||I!=f)continue;let B=ds.winding(m,g,v,b,L,U),D=ds.winding(L,U,y,w,A,T);B==M&&D==M&&(O.length=0,P.length=0,o.push(L),o.push(U),a.push(k),m=v,g=b,v=L,b=U,R=0)}}for(let c=n.length-1;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 ds);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<h;o++){let l=a[o];Lh.makeClockwise(l),l.push(l[0]),l.push(l[1])}return a.length}clipEndWithSlot(e){this.clipAttachment&&this.clipAttachment.endSlot==e.data&&this.clipEnd()}clipEnd(){this.clipAttachment&&(this.clipAttachment=null,this.clippingPolygons=null,this.clippedVertices.length=0,this.clippedTriangles.length=0,this.clippingPolygon.length=0)}isClipping(){return this.clipAttachment!=null}clipTriangles(e,t,i,n,r,a,o,h){let l,c,u,d,f,p;typeof t=="number"?(l=i,c=n,u=r,d=a,f=o,p=h):(l=t,c=i,u=n,d=r,f=a,p=o),u&&d&&f&&typeof p=="boolean"?this.clipTrianglesRender(e,l,c,u,d,f,p):this.clipTrianglesNoRender(e,l,c)}clipTrianglesNoRender(e,t,i){let n=this.clipOutput,r=this.clippedVertices,a=this.clippedTriangles,o=this.clippingPolygons,h=o.length,l=0;r.length=0,a.length=0;for(let c=0;c<i;c+=3){let u=t[c]<<1,d=e[u],f=e[u+1];u=t[c+1]<<1;let p=e[u],m=e[u+1];u=t[c+2]<<1;let g=e[u],v=e[u+1];for(let b=0;b<h;b++){let y=r.length;if(this.clip(d,f,p,m,g,v,o[b],n)){let w=n.length;if(w==0)continue;let A=w>>1,T=this.clipOutput,M=Ge.setArraySize(r,y+A*2);for(let P=0;P<w;P+=2,y+=2){let F=T[P],I=T[P+1];M[y]=F,M[y+1]=I}y=a.length;let R=Ge.setArraySize(a,y+3*(A-2));A--;for(let P=1;P<A;P++,y+=3)R[y]=l,R[y+1]=l+P,R[y+2]=l+P+1;l+=A+1}else{let w=Ge.setArraySize(r,y+6);w[y]=d,w[y+1]=f,w[y+2]=p,w[y+3]=m,w[y+4]=g,w[y+5]=v,y=a.length;let A=Ge.setArraySize(a,y+3);A[y]=l,A[y+1]=l+1,A[y+2]=l+2,l+=3;break}}}}clipTrianglesRender(e,t,i,n,r,a,o){let h=this.clipOutput,l=this.clippedVertices,c=this.clippedTriangles,u=this.clippingPolygons,d=u.length,f=o?12:8,p=0;l.length=0,c.length=0;for(let m=0;m<i;m+=3){let g=t[m]<<1,v=e[g],b=e[g+1],y=n[g],w=n[g+1];g=t[m+1]<<1;let A=e[g],T=e[g+1],M=n[g],R=n[g+1];g=t[m+2]<<1;let P=e[g],F=e[g+1],I=n[g],k=n[g+1];for(let O=0;O<d;O++){let L=l.length;if(this.clip(v,b,A,T,P,F,u[O],h)){let U=h.length;if(U==0)continue;let B=T-F,D=P-A,_=v-P,X=F-b,N=1/(B*_+D*(b-F)),V=U>>1,G=this.clipOutput,j=Ge.setArraySize(l,L+V*f);for(let Q=0;Q<U;Q+=2,L+=f){let de=G[Q],me=G[Q+1];j[L]=de,j[L+1]=me,j[L+2]=r.r,j[L+3]=r.g,j[L+4]=r.b,j[L+5]=r.a;let we=de-P,Re=me-F,ge=(B*we+D*Re)*N,Ae=(X*we+_*Re)*N,H=1-ge-Ae;j[L+6]=y*ge+M*Ae+I*H,j[L+7]=w*ge+R*Ae+k*H,o&&(j[L+8]=a.r,j[L+9]=a.g,j[L+10]=a.b,j[L+11]=a.a)}L=c.length;let ne=Ge.setArraySize(c,L+3*(V-2));V--;for(let Q=1;Q<V;Q++,L+=3)ne[L]=p,ne[L+1]=p+Q,ne[L+2]=p+Q+1;p+=V+1}else{let U=Ge.setArraySize(l,L+3*f);U[L]=v,U[L+1]=b,U[L+2]=r.r,U[L+3]=r.g,U[L+4]=r.b,U[L+5]=r.a,o?(U[L+6]=y,U[L+7]=w,U[L+8]=a.r,U[L+9]=a.g,U[L+10]=a.b,U[L+11]=a.a,U[L+12]=A,U[L+13]=T,U[L+14]=r.r,U[L+15]=r.g,U[L+16]=r.b,U[L+17]=r.a,U[L+18]=M,U[L+19]=R,U[L+20]=a.r,U[L+21]=a.g,U[L+22]=a.b,U[L+23]=a.a,U[L+24]=P,U[L+25]=F,U[L+26]=r.r,U[L+27]=r.g,U[L+28]=r.b,U[L+29]=r.a,U[L+30]=I,U[L+31]=k,U[L+32]=a.r,U[L+33]=a.g,U[L+34]=a.b,U[L+35]=a.a):(U[L+6]=y,U[L+7]=w,U[L+8]=A,U[L+9]=T,U[L+10]=r.r,U[L+11]=r.g,U[L+12]=r.b,U[L+13]=r.a,U[L+14]=M,U[L+15]=R,U[L+16]=P,U[L+17]=F,U[L+18]=r.r,U[L+19]=r.g,U[L+20]=r.b,U[L+21]=r.a,U[L+22]=I,U[L+23]=k),L=c.length;let B=Ge.setArraySize(c,L+3);B[L]=p,B[L+1]=p+1,B[L+2]=p+2,p+=3;break}}}}clipTrianglesUnpacked(e,t,i,n){let r=this.clipOutput,a=this.clippedVertices,o=this.clippedUVs,h=this.clippedTriangles,l=this.clippingPolygons,c=l.length,u=0;a.length=0,o.length=0,h.length=0;for(let d=0;d<i;d+=3){let f=t[d]<<1,p=e[f],m=e[f+1],g=n[f],v=n[f+1];f=t[d+1]<<1;let b=e[f],y=e[f+1],w=n[f],A=n[f+1];f=t[d+2]<<1;let T=e[f],M=e[f+1],R=n[f],P=n[f+1];for(let F=0;F<c;F++){let I=a.length;if(this.clip(p,m,b,y,T,M,l[F],r)){let k=r.length;if(k==0)continue;let O=y-M,L=T-b,U=p-T,B=M-m,D=1/(O*U+L*(m-M)),_=k>>1,X=this.clipOutput,N=Ge.setArraySize(a,I+_*2),V=Ge.setArraySize(o,I+_*2);for(let j=0;j<k;j+=2,I+=2){let ne=X[j],Q=X[j+1];N[I]=ne,N[I+1]=Q;let de=ne-T,me=Q-M,we=(O*de+L*me)*D,Re=(B*de+U*me)*D,ge=1-we-Re;V[I]=g*we+w*Re+R*ge,V[I+1]=v*we+A*Re+P*ge}I=h.length;let G=Ge.setArraySize(h,I+3*(_-2));_--;for(let j=1;j<_;j++,I+=3)G[I]=u,G[I+1]=u+j,G[I+2]=u+j+1;u+=_+1}else{let k=Ge.setArraySize(a,I+6);k[I]=p,k[I+1]=m,k[I+2]=b,k[I+3]=y,k[I+4]=T,k[I+5]=M;let O=Ge.setArraySize(o,I+6);O[I]=g,O[I+1]=v,O[I+2]=w,O[I+3]=A,O[I+4]=R,O[I+5]=P,I=h.length;let L=Ge.setArraySize(h,I+3);L[I]=u,L[I+1]=u+1,L[I+2]=u+2,u+=3;break}}}}clip(e,t,i,n,r,a,o,h){let l=h,c=!1,u;o.length%4>=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,M=u.length-2;T<M;){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),O=b*(m-R)-v*(g-P);if(O>0){if(k){h.push(F),h.push(I);continue}let L=F-R,U=I-P,B=O/(L*b-U*v);if(B>=0&&B<=1)h.push(R+L*B),h.push(P+U*B);else{h.push(F),h.push(I);continue}}else if(k){let L=F-R,U=I-P,B=O/(L*b-U*v);if(B>=0&&B<=1)h.push(R+L*B),h.push(P+U*B),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<m;p++)l[p]=h[p]}else l.length=l.length-2;return c}static makeClockwise(e){let t=e,i=e.length,n=t[i-2]*t[1]-t[0]*t[i-1],r=0,a=0,o=0,h=0;for(let l=0,c=i-3;l<c;l+=2)r=t[l],a=t[l+1],o=t[l+2],h=t[l+3],n+=r*h-o*a;if(!(n<0))for(let l=0,c=i-2,u=i>>1;l<u;l+=2){let d=t[l],f=t[l+1],p=c-l;t[l]=t[p],t[l+1]=t[p+1],t[p]=d,t[p+1]=f}}}let Dh=class{constructor(e){x(this,"attachmentLoader");x(this,"scale",1);x(this,"linkedMeshes",new Array);this.attachmentLoader=e}readSkeletonData(e){let t=this.scale,i=new Bh,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=ae(r,"referenceScale",100)*t,i.fps=r.fps,i.imagesPath=r.images??null,i.audioPath=r.audio??null),n.bones)for(let a=0;a<n.bones.length;a++){let o=n.bones[a],h=null,l=ae(o,"parent",null);l&&(h=i.findBone(l));let c=new lw(i.bones.length,o.name,h);c.length=ae(o,"length",0)*t,c.x=ae(o,"x",0)*t,c.y=ae(o,"y",0)*t,c.rotation=ae(o,"rotation",0),c.scaleX=ae(o,"scaleX",1),c.scaleY=ae(o,"scaleY",1),c.shearX=ae(o,"shearX",0),c.shearY=ae(o,"shearY",0),c.inherit=Ge.enumValue(pi,ae(o,"inherit","Normal")),c.skinRequired=ae(o,"skin",!1);let u=ae(o,"color",null);u&&c.color.setFromString(u),i.bones.push(c)}if(n.slots)for(let a=0;a<n.slots.length;a++){let o=n.slots[a],h=o.name,l=i.findBone(o.bone);if(!l)throw new Error(`Couldn't find bone ${o.bone} for slot ${h}`);let c=new mw(i.slots.length,h,l),u=ae(o,"color",null);u&&c.color.setFromString(u);let d=ae(o,"dark",null);d&&(c.darkColor=Mt.fromString(d)),c.attachmentName=ae(o,"attachment",null),c.blendMode=Ge.enumValue(Nr,ae(o,"blend","normal")),c.visible=ae(o,"visible",!0),i.slots.push(c)}if(n.ik)for(let a=0;a<n.ik.length;a++){let o=n.ik[a],h=new uw(o.name);h.order=ae(o,"order",0),h.skinRequired=ae(o,"skin",!1);for(let c=0;c<o.bones.length;c++){let u=i.findBone(o.bones[c]);if(!u)throw new Error(`Couldn't find bone ${o.bones[c]} for IK constraint ${o.name}.`);h.bones.push(u)}let l=i.findBone(o.target);if(!l)throw new Error(`Couldn't find target bone ${o.target} for IK constraint ${o.name}.`);h.target=l,h.mix=ae(o,"mix",1),h.softness=ae(o,"softness",0)*t,h.bendDirection=ae(o,"bendPositive",!0)?1:-1,h.compress=ae(o,"compress",!1),h.stretch=ae(o,"stretch",!1),h.uniform=ae(o,"uniform",!1),i.ikConstraints.push(h)}if(n.transform)for(let a=0;a<n.transform.length;a++){let o=n.transform[a],h=new pw(o.name);h.order=ae(o,"order",0),h.skinRequired=ae(o,"skin",!1);for(let u=0;u<o.bones.length;u++){let d=o.bones[u],f=i.findBone(d);if(!f)throw new Error(`Couldn't find bone ${d} for transform constraint ${o.name}.`);h.bones.push(f)}let l=o.target,c=i.findBone(l);if(!c)throw new Error(`Couldn't find target bone ${l} for transform constraint ${o.name}.`);h.target=c,h.local=ae(o,"local",!1),h.relative=ae(o,"relative",!1),h.offsetRotation=ae(o,"rotation",0),h.offsetX=ae(o,"x",0)*t,h.offsetY=ae(o,"y",0)*t,h.offsetScaleX=ae(o,"scaleX",0),h.offsetScaleY=ae(o,"scaleY",0),h.offsetShearY=ae(o,"shearY",0),h.mixRotate=ae(o,"mixRotate",1),h.mixX=ae(o,"mixX",1),h.mixY=ae(o,"mixY",h.mixX),h.mixScaleX=ae(o,"mixScaleX",1),h.mixScaleY=ae(o,"mixScaleY",h.mixScaleX),h.mixShearY=ae(o,"mixShearY",1),i.transformConstraints.push(h)}if(n.path)for(let a=0;a<n.path.length;a++){let o=n.path[a],h=new dw(o.name);h.order=ae(o,"order",0),h.skinRequired=ae(o,"skin",!1);for(let u=0;u<o.bones.length;u++){let d=o.bones[u],f=i.findBone(d);if(!f)throw new Error(`Couldn't find bone ${d} for path constraint ${o.name}.`);h.bones.push(f)}let l=o.target,c=i.findSlot(l);if(!c)throw new Error(`Couldn't find target slot ${l} for path constraint ${o.name}.`);h.target=c,h.positionMode=Ge.enumValue(Fn,ae(o,"positionMode","Percent")),h.spacingMode=Ge.enumValue(ki,ae(o,"spacingMode","Length")),h.rotateMode=Ge.enumValue(Ra,ae(o,"rotateMode","Tangent")),h.offsetRotation=ae(o,"rotation",0),h.position=ae(o,"position",0),h.positionMode==Fn.Fixed&&(h.position*=t),h.spacing=ae(o,"spacing",0),(h.spacingMode==ki.Length||h.spacingMode==ki.Fixed)&&(h.spacing*=t),h.mixRotate=ae(o,"mixRotate",1),h.mixX=ae(o,"mixX",1),h.mixY=ae(o,"mixY",h.mixX),i.pathConstraints.push(h)}if(n.physics)for(let a=0;a<n.physics.length;a++){const o=n.physics[a],h=new fw(o.name);h.order=ae(o,"order",0),h.skinRequired=ae(o,"skin",!1);const l=o.bone,c=i.findBone(l);if(c==null)throw new Error("Physics bone not found: "+l);h.bone=c,h.x=ae(o,"x",0),h.y=ae(o,"y",0),h.rotate=ae(o,"rotate",0),h.scaleX=ae(o,"scaleX",0),h.shearX=ae(o,"shearX",0),h.limit=ae(o,"limit",5e3)*t,h.step=1/ae(o,"fps",60),h.inertia=ae(o,"inertia",1),h.strength=ae(o,"strength",100),h.damping=ae(o,"damping",1),h.massInverse=1/ae(o,"mass",1),h.wind=ae(o,"wind",0),h.gravity=ae(o,"gravity",0),h.mix=ae(o,"mix",1),h.inertiaGlobal=ae(o,"inertiaGlobal",!1),h.strengthGlobal=ae(o,"strengthGlobal",!1),h.dampingGlobal=ae(o,"dampingGlobal",!1),h.massGlobal=ae(o,"massGlobal",!1),h.windGlobal=ae(o,"windGlobal",!1),h.gravityGlobal=ae(o,"gravityGlobal",!1),h.mixGlobal=ae(o,"mixGlobal",!1),i.physicsConstraints.push(h)}if(n.skins)for(let a=0;a<n.skins.length;a++){let o=n.skins[a],h=new Em(o.name);if(o.bones)for(let l=0;l<o.bones.length;l++){let c=o.bones[l],u=i.findBone(c);if(!u)throw new Error(`Couldn't find bone ${c} for skin ${o.name}.`);h.bones.push(u)}if(o.ik)for(let l=0;l<o.ik.length;l++){let c=o.ik[l],u=i.findIkConstraint(c);if(!u)throw new Error(`Couldn't find IK constraint ${c} for skin ${o.name}.`);h.constraints.push(u)}if(o.transform)for(let l=0;l<o.transform.length;l++){let c=o.transform[l],u=i.findTransformConstraint(c);if(!u)throw new Error(`Couldn't find transform constraint ${c} for skin ${o.name}.`);h.constraints.push(u)}if(o.path)for(let l=0;l<o.path.length;l++){let c=o.path[l],u=i.findPathConstraint(c);if(!u)throw new Error(`Couldn't find path constraint ${c} for skin ${o.name}.`);h.constraints.push(u)}if(o.physics)for(let l=0;l<o.physics.length;l++){let c=o.physics[l],u=i.findPhysicsConstraint(c);if(!u)throw new Error(`Couldn't find physics constraint ${c} for skin ${o.name}.`);h.constraints.push(u)}for(let l in o.attachments){let c=i.findSlot(l);if(!c)throw new Error(`Couldn't find slot ${l} for skin ${o.name}.`);let u=o.attachments[l];for(let d in u){let f=this.readAttachment(u[d],h,c.index,d,i);f&&h.setAttachment(c.index,d,f)}}i.skins.push(h),h.name=="default"&&(i.defaultSkin=h)}for(let a=0,o=this.linkedMeshes.length;a<o;a++){let h=this.linkedMeshes[a],l=h.skin?i.findSkin(h.skin):i.defaultSkin;if(!l)throw new Error(`Skin not found: ${h.skin}`);let c=l.getAttachment(h.slotIndex,h.parent);if(!c)throw new Error(`Parent mesh not found: ${h.parent}`);h.mesh.timelineAttachment=h.inheritTimeline?c:h.mesh,h.mesh.setParentMesh(c),h.mesh.region!=null&&h.mesh.updateRegion()}if(this.linkedMeshes.length=0,n.events)for(let a in n.events){let o=n.events[a],h=new hw(a);h.intValue=ae(o,"int",0),h.floatValue=ae(o,"float",0),h.stringValue=ae(o,"string",""),h.audioPath=ae(o,"audio",null),h.audioPath&&(h.volume=ae(o,"volume",1),h.balance=ae(o,"balance",0)),i.events.push(h)}if(n.animations)for(let a in n.animations){let o=n.animations[a];this.readAnimation(o,a,i)}return i}readAttachment(e,t,i,n,r){let a=this.scale;switch(n=ae(e,"name",n),ae(e,"type","region")){case"region":{let o=ae(e,"path",n),h=this.readSequence(ae(e,"sequence",null)),l=this.attachmentLoader.newRegionAttachment(t,n,o,h);if(!l)return null;l.path=o,l.x=ae(e,"x",0)*a,l.y=ae(e,"y",0)*a,l.scaleX=ae(e,"scaleX",1),l.scaleY=ae(e,"scaleY",1),l.rotation=ae(e,"rotation",0),l.width=e.width*a,l.height=e.height*a,l.sequence=h;let c=ae(e,"color",null);return c&&l.color.setFromString(c),l.region!=null&&l.updateRegion(),l}case"boundingbox":{let o=this.attachmentLoader.newBoundingBoxAttachment(t,n);if(!o)return null;this.readVertices(e,o,e.vertexCount<<1);let h=ae(e,"color",null);return h&&o.color.setFromString(h),o}case"mesh":case"linkedmesh":{let o=ae(e,"path",n),h=this.readSequence(ae(e,"sequence",null)),l=this.attachmentLoader.newMeshAttachment(t,n,o,h);if(!l)return null;l.path=o;let c=ae(e,"color",null);c&&l.color.setFromString(c),l.width=ae(e,"width",0)*a,l.height=ae(e,"height",0)*a,l.sequence=h;let u=ae(e,"parent",null);if(u)return this.linkedMeshes.push(new eP(l,ae(e,"skin",null),i,u,ae(e,"timelines",!0))),l;let d=e.uvs;return this.readVertices(e,l,d.length),l.triangles=e.triangles,l.regionUVs=d,l.region!=null&&l.updateRegion(),l.edges=ae(e,"edges",null),l.hullLength=ae(e,"hull",0)*2,l}case"path":{let o=this.attachmentLoader.newPathAttachment(t,n);if(!o)return null;o.closed=ae(e,"closed",!1),o.constantSpeed=ae(e,"constantSpeed",!0);let h=e.vertexCount;this.readVertices(e,o,h<<1);let l=Ge.newArray(h/3,0);for(let u=0;u<e.lengths.length;u++)l[u]=e.lengths[u]*a;o.lengths=l;let c=ae(e,"color",null);return c&&o.color.setFromString(c),o}case"point":{let o=this.attachmentLoader.newPointAttachment(t,n);if(!o)return null;o.x=ae(e,"x",0)*a,o.y=ae(e,"y",0)*a,o.rotation=ae(e,"rotation",0);let h=ae(e,"color",null);return h&&o.color.setFromString(h),o}case"clipping":{let o=this.attachmentLoader.newClippingAttachment(t,n);if(!o)return null;let h=ae(e,"end",null);h&&(o.endSlot=r.findSlot(h));let l=e.vertexCount;this.readVertices(e,o,l<<1);let c=ae(e,"color",null);return c&&o.color.setFromString(c),o}}return null}readSequence(e){if(e==null)return null;let t=new S1(ae(e,"count",0));return t.start=ae(e,"start",1),t.digits=ae(e,"digits",0),t.setupIndex=ae(e,"setup",0),t}readVertices(e,t,i){let n=this.scale;t.worldVerticesLength=i;let r=e.vertices;if(i==r.length){let h=Ge.toFloatArray(r);if(n!=1)for(let l=0,c=r.length;l<c;l++)h[l]*=n;t.vertices=h;return}let a=new Array,o=new Array;for(let h=0,l=r.length;h<l;){let c=r[h++];o.push(c);for(let u=h+c*4;h<u;h+=4)o.push(r[h]),a.push(r[h+1]*n),a.push(r[h+2]*n),a.push(r[h+3])}t.bones=o,t.vertices=Ge.toFloatArray(a)}readAnimation(e,t,i){let n=this.scale,r=new Array;if(e.slots)for(let o in e.slots){let h=e.slots[o],l=i.findSlot(o);if(!l)throw new Error("Slot not found: "+o);let c=l.index;for(let u in h){let d=h[u];if(!d)continue;let f=d.length;if(u=="attachment"){let p=new co(f,c);for(let m=0;m<f;m++){let g=d[m];p.setFrame(m,ae(g,"time",0),ae(g,"name",null))}r.push(p)}else if(u=="rgba"){let p=new O1(f,f<<2,c),m=d[0],g=ae(m,"time",0),v=Mt.fromString(m.color);for(let b=0,y=0;;b++){p.setFrame(b,g,v.r,v.g,v.b,v.a);let w=d[b+1];if(!w){p.shrink(y);break}let A=ae(w,"time",0),T=Mt.fromString(w.color),M=m.curve;M&&(y=Nt(M,p,y,b,0,g,A,v.r,T.r,1),y=Nt(M,p,y,b,1,g,A,v.g,T.g,1),y=Nt(M,p,y,b,2,g,A,v.b,T.b,1),y=Nt(M,p,y,b,3,g,A,v.a,T.a,1)),g=A,v=T,m=w}r.push(p)}else if(u=="rgb"){let p=new B1(f,f*3,c),m=d[0],g=ae(m,"time",0),v=Mt.fromString(m.color);for(let b=0,y=0;;b++){p.setFrame(b,g,v.r,v.g,v.b);let w=d[b+1];if(!w){p.shrink(y);break}let A=ae(w,"time",0),T=Mt.fromString(w.color),M=m.curve;M&&(y=Nt(M,p,y,b,0,g,A,v.r,T.r,1),y=Nt(M,p,y,b,1,g,A,v.g,T.g,1),y=Nt(M,p,y,b,2,g,A,v.b,T.b,1)),g=A,v=T,m=w}r.push(p)}else if(u=="alpha")r.push(Ys(d,new L1(f,f,c),0,1));else if(u=="rgba2"){let p=new D1(f,f*7,c),m=d[0],g=ae(m,"time",0),v=Mt.fromString(m.light),b=Mt.fromString(m.dark);for(let y=0,w=0;;y++){p.setFrame(y,g,v.r,v.g,v.b,v.a,b.r,b.g,b.b);let A=d[y+1];if(!A){p.shrink(w);break}let T=ae(A,"time",0),M=Mt.fromString(A.light),R=Mt.fromString(A.dark),P=m.curve;P&&(w=Nt(P,p,w,y,0,g,T,v.r,M.r,1),w=Nt(P,p,w,y,1,g,T,v.g,M.g,1),w=Nt(P,p,w,y,2,g,T,v.b,M.b,1),w=Nt(P,p,w,y,3,g,T,v.a,M.a,1),w=Nt(P,p,w,y,4,g,T,b.r,R.r,1),w=Nt(P,p,w,y,5,g,T,b.g,R.g,1),w=Nt(P,p,w,y,6,g,T,b.b,R.b,1)),g=T,v=M,b=R,m=A}r.push(p)}else if(u=="rgb2"){let p=new N1(f,f*6,c),m=d[0],g=ae(m,"time",0),v=Mt.fromString(m.light),b=Mt.fromString(m.dark);for(let y=0,w=0;;y++){p.setFrame(y,g,v.r,v.g,v.b,b.r,b.g,b.b);let A=d[y+1];if(!A){p.shrink(w);break}let T=ae(A,"time",0),M=Mt.fromString(A.light),R=Mt.fromString(A.dark),P=m.curve;P&&(w=Nt(P,p,w,y,0,g,T,v.r,M.r,1),w=Nt(P,p,w,y,1,g,T,v.g,M.g,1),w=Nt(P,p,w,y,2,g,T,v.b,M.b,1),w=Nt(P,p,w,y,3,g,T,b.r,R.r,1),w=Nt(P,p,w,y,4,g,T,b.g,R.g,1),w=Nt(P,p,w,y,5,g,T,b.b,R.b,1)),g=T,v=M,b=R,m=A}r.push(p)}}}if(e.bones)for(let o in e.bones){let h=e.bones[o],l=i.findBone(o);if(!l)throw new Error("Bone not found: "+o);let c=l.index;for(let u in h){let d=h[u],f=d.length;if(f!=0){if(u==="rotate")r.push(Ys(d,new Oh(f,f,c),0,1));else if(u==="translate"){let p=new M1(f,f<<1,c);r.push(_f(d,p,"x","y",0,n))}else if(u==="translatex"){let p=new T1(f,f,c);r.push(Ys(d,p,0,n))}else if(u==="translatey"){let p=new A1(f,f,c);r.push(Ys(d,p,0,n))}else if(u==="scale"){let p=new E1(f,f<<1,c);r.push(_f(d,p,"x","y",1,1))}else if(u==="scalex"){let p=new C1(f,f,c);r.push(Ys(d,p,1,1))}else if(u==="scaley"){let p=new I1(f,f,c);r.push(Ys(d,p,1,1))}else if(u==="shear"){let p=new R1(f,f<<1,c);r.push(_f(d,p,"x","y",0,1))}else if(u==="shearx"){let p=new P1(f,f,c);r.push(Ys(d,p,0,1))}else if(u==="sheary"){let p=new k1(f,f,c);r.push(Ys(d,p,0,1))}else if(u==="inherit"){let p=new F1(f,l.index);for(let m=0;m<d.length;m++){let g=d[m];p.setFrame(m,ae(g,"time",0),Ge.enumValue(pi,ae(g,"inherit","Normal")))}r.push(p)}}}}if(e.ik)for(let o in e.ik){let h=e.ik[o],l=h[0];if(!l)continue;let c=i.findIkConstraint(o);if(!c)throw new Error("IK Constraint not found: "+o);let u=i.ikConstraints.indexOf(c),d=new X1(h.length,h.length<<1,u),f=ae(l,"time",0),p=ae(l,"mix",1),m=ae(l,"softness",0)*n;for(let g=0,v=0;;g++){d.setFrame(g,f,p,m,ae(l,"bendPositive",!0)?1:-1,ae(l,"compress",!1),ae(l,"stretch",!1));let b=h[g+1];if(!b){d.shrink(v);break}let y=ae(b,"time",0),w=ae(b,"mix",1),A=ae(b,"softness",0)*n,T=l.curve;T&&(v=Nt(T,d,v,g,0,f,y,p,w,1),v=Nt(T,d,v,g,1,f,y,m,A,n)),f=y,p=w,m=A,l=b}r.push(d)}if(e.transform)for(let o in e.transform){let h=e.transform[o],l=h[0];if(!l)continue;let c=i.findTransformConstraint(o);if(!c)throw new Error("Transform constraint not found: "+o);let u=i.transformConstraints.indexOf(c),d=new V1(h.length,h.length*6,u),f=ae(l,"time",0),p=ae(l,"mixRotate",1),m=ae(l,"mixX",1),g=ae(l,"mixY",m),v=ae(l,"mixScaleX",1),b=ae(l,"mixScaleY",v),y=ae(l,"mixShearY",1);for(let w=0,A=0;;w++){d.setFrame(w,f,p,m,g,v,b,y);let T=h[w+1];if(!T){d.shrink(A);break}let M=ae(T,"time",0),R=ae(T,"mixRotate",1),P=ae(T,"mixX",1),F=ae(T,"mixY",P),I=ae(T,"mixScaleX",1),k=ae(T,"mixScaleY",I),O=ae(T,"mixShearY",1),L=l.curve;L&&(A=Nt(L,d,A,w,0,f,M,p,R,1),A=Nt(L,d,A,w,1,f,M,m,P,1),A=Nt(L,d,A,w,2,f,M,g,F,1),A=Nt(L,d,A,w,3,f,M,v,I,1),A=Nt(L,d,A,w,4,f,M,b,k,1),A=Nt(L,d,A,w,5,f,M,y,O,1)),f=M,p=R,m=P,g=F,v=I,b=k,v=I,l=T}r.push(d)}if(e.path)for(let o in e.path){let h=e.path[o],l=i.findPathConstraint(o);if(!l)throw new Error("Path constraint not found: "+o);let c=i.pathConstraints.indexOf(l);for(let u in h){let d=h[u],f=d[0];if(!f)continue;let p=d.length;if(u==="position"){let m=new Y1(p,p,c);r.push(Ys(d,m,0,l.positionMode==Fn.Fixed?n:1))}else if(u==="spacing"){let m=new $1(p,p,c);r.push(Ys(d,m,0,l.spacingMode==ki.Length||l.spacingMode==ki.Fixed?n:1))}else if(u==="mix"){let m=new G1(p,p*3,c),g=ae(f,"time",0),v=ae(f,"mixRotate",1),b=ae(f,"mixX",1),y=ae(f,"mixY",b);for(let w=0,A=0;;w++){m.setFrame(w,g,v,b,y);let T=d[w+1];if(!T){m.shrink(A);break}let M=ae(T,"time",0),R=ae(T,"mixRotate",1),P=ae(T,"mixX",1),F=ae(T,"mixY",P),I=f.curve;I&&(A=Nt(I,m,A,w,0,g,M,v,R,1),A=Nt(I,m,A,w,1,g,M,b,P,1),A=Nt(I,m,A,w,2,g,M,y,F,1)),g=M,v=R,b=P,y=F,f=T}r.push(m)}}}if(e.physics)for(let o in e.physics){let h=e.physics[o],l=-1;if(o.length>0){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 J1(f,l);for(let g=0;d!=null;d=u[g+1],g++)m.setFrame(g,ae(d,"time",0));r.push(m);continue}let p;if(c=="inertia")p=new H1(f,f,l);else if(c=="strength")p=new j1(f,f,l);else if(c=="damping")p=new W1(f,f,l);else if(c=="mass")p=new z1(f,f,l);else if(c=="wind")p=new q1(f,f,l);else if(c=="gravity")p=new K1(f,f,l);else if(c=="mix")p=new Z1(f,f,l);else continue;r.push(Ys(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,M=new U1(b.length,b.length,f,g),R=ae(y,"time",0);for(let P=0,F=0;;P++){let I,k=ae(y,"vertices",null);if(!k)I=w?Ge.newFloatArray(T):A;else{I=Ge.newFloatArray(T);let B=ae(y,"offset",0);if(Ge.arrayCopy(k,0,I,B,k.length),n!=1)for(let D=B,_=D+k.length;D<_;D++)I[D]*=n;if(!w)for(let D=0;D<T;D++)I[D]+=A[D]}M.setFrame(P,R,I);let O=b[P+1];if(!O){M.shrink(F);break}let L=ae(O,"time",0),U=y.curve;U&&(F=Nt(U,M,F,P,0,R,L,0,1,1)),R=L,y=O}r.push(M)}else if(v=="sequence"){let w=new Q1(b.length,f,g),A=0;for(let T=0;T<b.length;T++){let M=ae(y,"delay",A),R=ae(y,"time",0),P=$i[ae(y,"mode","hold")],F=ae(y,"index",0);w.setFrame(T,R,P,F,M),A=M,y=b[T+1]}r.push(w)}}}}}}if(e.drawOrder){let o=new vl(e.drawOrder.length),h=i.slots.length,l=0;for(let c=0;c<e.drawOrder.length;c++,l++){let u=e.drawOrder[c],d=null,f=ae(u,"offsets",null);if(f){d=Ge.newArray(h,-1);let p=Ge.newArray(h-f.length,0),m=0,g=0;for(let v=0;v<f.length;v++){let b=f[v],y=i.findSlot(b.slot);if(!y)throw new Error("Slot not found: "+y);let w=y.index;for(;m!=w;)p[g++]=m++;d[m+b.offset]=m++}for(;m<h;)p[g++]=m++;for(let v=h-1;v>=0;v--)d[v]==-1&&(d[v]=p[--g])}o.setFrame(l,ae(u,"time",0),d)}r.push(o)}if(e.events){let o=new Cp(e.events.length),h=0;for(let l=0;l<e.events.length;l++,h++){let c=e.events[l],u=i.findEvent(c.name);if(!u)throw new Error("Event not found: "+c.name);let d=new cw(Ge.toSinglePrecision(ae(c,"time",0)),u);d.intValue=ae(c,"int",u.intValue),d.floatValue=ae(c,"float",u.floatValue),d.stringValue=ae(c,"string",u.stringValue),d.data.audioPath&&(d.volume=ae(c,"volume",1),d.balance=ae(c,"balance",0)),o.setFrame(h,d)}r.push(o)}let a=0;for(let o=0,h=r.length;o<h;o++)a=Math.max(a,r[o].getDuration());i.animations.push(new Ap(t,r,a))}},eP=class{constructor(e,t,i,n,r){x(this,"parent");x(this,"skin");x(this,"slotIndex");x(this,"mesh");x(this,"inheritTimeline");this.mesh=e,this.skin=t,this.slotIndex=i,this.parent=n,this.inheritTimeline=r}};function Ys(s,e,t,i){let n=s[0],r=ae(n,"time",0),a=ae(n,"value",t)*i,o=0;for(let h=0;;h++){e.setFrame(h,r,a);let l=s[h+1];if(!l)return e.shrink(o),e;let c=ae(l,"time",0),u=ae(l,"value",t)*i;n.curve&&(o=Nt(n.curve,e,o,h,0,r,c,a,u,i)),r=c,a=u,n=l}}function _f(s,e,t,i,n,r){let a=s[0],o=ae(a,"time",0),h=ae(a,t,n)*r,l=ae(a,i,n)*r,c=0;for(let u=0;;u++){e.setFrame(u,o,h,l);let d=s[u+1];if(!d)return e.shrink(c),e;let f=ae(d,"time",0),p=ae(d,t,n)*r,m=ae(d,i,n)*r,g=a.curve;g&&(c=Nt(g,e,c,u,0,o,f,h,p,r),c=Nt(g,e,c,u,1,o,f,l,m,r)),o=f,h=p,l=m,a=d}}function Nt(s,e,t,i,n,r,a,o,h,l){if(s=="stepped")return e.setStepped(i),t;let 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 ae(s,e,t){return s[e]!==void 0?s[e]:t}typeof Math.fround>"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 Wn=class Wn extends dR{constructor(t){super(t.resource.source);x(this,"texture");this.texture=mt.from(t)}static from(t){return Wn.textureMap.has(t)?Wn.textureMap.get(t):new Wn(t)}setFilters(t,i){this.texture.baseTexture.scaleMode=Wn.toPixiTextureFilter(t),this.texture.baseTexture.mipmap=Wn.toPixiMipMap(t)}setWraps(t,i){this.texture.baseTexture.wrapMode=Wn.toPixiTextureWrap(t)}dispose(){this.texture.destroy()}static toPixiTextureFilter(t){switch(t){case Di.Nearest:case Di.MipMapNearestLinear:case Di.MipMapNearestNearest:return zs.NEAREST;case Di.Linear:case Di.MipMapLinearLinear:case Di.MipMapLinearNearest:return zs.LINEAR;default:throw new Error(`Unknown texture filter: ${String(t)}`)}}static toPixiMipMap(t){switch(t){case Di.Nearest:case Di.Linear:return Bs.OFF;case Di.MipMapNearestLinear:case Di.MipMapNearestNearest:case Di.MipMapLinearLinear:case Di.MipMapLinearNearest:return Bs.ON;default:throw new Error(`Unknown texture filter: ${String(t)}`)}}static toPixiTextureWrap(t){switch(t){case lr.ClampToEdge:return Zs.CLAMP;case lr.MirroredRepeat:return Zs.MIRRORED_REPEAT;case lr.Repeat:return Zs.REPEAT;default:throw new Error(`Unknown texture wrap: ${String(t)}`)}}static toPixiBlending(t){switch(t){case Nr.Normal:return ut.NORMAL;case Nr.Additive:return ut.ADD;case Nr.Multiply:return ut.MULTIPLY;case Nr.Screen:return ut.SCREEN;default:throw new Error(`Unknown blendMode: ${String(t)}`)}}};x(Wn,"textureMap",new Map);let Ba=Wn;const zn=class zn extends Dl{constructor(){const t=new _p;t.getBuffer("aVertexPosition").static=!1,t.getBuffer("aTextureCoord").static=!1;const i=new Ch(mt.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;y<a;y+=l?12:8){let w=y;m[f]=r[w++],m[f+1]=r[w++],w+=4,p[f]=r[w++],p[f+1]=r[w++],f+=2}l&&!this.warnedTwoTint&&(console.warn("DarkTint is not enabled by default. To enable use a DarkSlotMesh factory while creating the Spine object."),this.warnedTwoTint=!0),zn.auxColor[0]=r[2],zn.auxColor[1]=r[3],zn.auxColor[2]=r[4],zn.auxColor[3]=r[5],this.tint=zn.auxColor,this.alpha=zn.auxColor[3],this.blendMode=Ba.toPixiBlending(i);const g=this.geometry.indexBuffer;if(g.data.length!==o.length)g.data=new Uint32Array(o);else{const y=g.data;for(let w=0;w<h;w++)y[w]=o[w]}this.name=n,u.update(),d.update(),g.update()}};x(zn,"auxColor",[0,0,0,0]);let Im=zn;class tP extends Bn{constructor(e=!1){super();const t=new oi(void 0),i=new oi(void 0,!0),n=new oi(void 0,!0,!0);this.addAttribute("aVertexPosition",t,2,!1,et.FLOAT),this.addAttribute("aTextureCoord",i,2,!1,et.FLOAT),this.addIndex(n)}}const iP=`
|
||
attribute vec2 aVertexPosition;
|
||
attribute vec2 aTextureCoord;
|
||
|
||
uniform mat3 projectionMatrix;
|
||
uniform mat3 translationMatrix;
|
||
uniform mat3 uTextureMatrix;
|
||
|
||
varying vec2 vTextureCoord;
|
||
|
||
void main(void)
|
||
{
|
||
gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
|
||
|
||
vTextureCoord = (uTextureMatrix * vec3(aTextureCoord, 1.0)).xy;
|
||
}
|
||
`,sP=`
|
||
varying vec2 vTextureCoord;
|
||
uniform vec4 uColor;
|
||
uniform vec4 uDarkColor;
|
||
|
||
uniform sampler2D uSampler;
|
||
|
||
void main(void)
|
||
{
|
||
vec4 texColor = texture2D(uSampler, vTextureCoord);
|
||
gl_FragColor.a = texColor.a * uColor.a;
|
||
gl_FragColor.rgb = ((texColor.a - 1.0) * uDarkColor.a + 1.0 - texColor.rgb) * uDarkColor.rgb + texColor.rgb * uColor.rgb;
|
||
}
|
||
`;class nP extends en{constructor(t){const i={uSampler:t??mt.EMPTY,alpha:1,uTextureMatrix:li.IDENTITY,uColor:new Float32Array([1,1,1,1]),uDarkColor:new Float32Array([0,0,0,0])},n={tint:16777215,darkTint:0,alpha:1,pluginName:"darkTintBatch"};super(In.from(iP,sP),i);x(this,"uvMatrix");x(this,"batchable");x(this,"pluginName");x(this,"_tintRGB");x(this,"_darkTintRGB");x(this,"_colorDirty");x(this,"_alpha");x(this,"_tintColor");x(this,"_darkTintColor");this._colorDirty=!1,this.uvMatrix=new vp(i.uSampler),this.batchable=!0,this.pluginName=n.pluginName,this._tintColor=new Wt(n.tint),this._darkTintColor=new Wt(n.darkTint),this._tintRGB=this._tintColor.toLittleEndianNumber(),this._darkTintRGB=this._darkTintColor.toLittleEndianNumber(),this._alpha=n.alpha,this._colorDirty=!0}get texture(){return this.uniforms.uSampler}set texture(t){this.uniforms.uSampler!==t&&(!this.uniforms.uSampler.baseTexture.alphaMode!=!t.baseTexture.alphaMode&&(this._colorDirty=!0),this.uniforms.uSampler=t,this.uvMatrix.texture=t)}set alpha(t){t!==this._alpha&&(this._alpha=t,this._colorDirty=!0)}get alpha(){return this._alpha}set tint(t){t!==this.tint&&(this._tintColor.setValue(t),this._tintRGB=this._tintColor.toLittleEndianNumber(),this._colorDirty=!0)}get tint(){return this._tintColor.value}set darkTint(t){t!==this.darkTint&&(this._darkTintColor.setValue(t),this._darkTintRGB=this._darkTintColor.toLittleEndianNumber(),this._colorDirty=!0)}get darkTint(){return this._darkTintColor.value}get tintValue(){return this._tintColor.toNumber()}get darkTintValue(){return this._darkTintColor.toNumber()}update(){this._colorDirty&&(this._colorDirty=!1,Wt.shared.setValue(this._tintColor).premultiply(this._alpha,!0).toArray(this.uniforms.uColor),Wt.shared.setValue(this._darkTintColor).premultiply(this._alpha,!0).premultiply(1,!1).toArray(this.uniforms.uDarkColor)),this.uvMatrix.update()&&(this.uniforms.uTextureMatrix=this.uvMatrix.mapCoord)}}class rP extends Dl{constructor(t){super(new tP,new nP(t),void 0,void 0);x(this,"_darkTintRGB",0)}get darkTint(){return"darkTint"in this.shader?this.shader.darkTint:null}set darkTint(t){this.shader.darkTint=t}get darkTintValue(){return this.shader.darkTintValue}_renderToBatch(t){const i=this.geometry,n=this.shader;n.uvMatrix&&(n.uvMatrix.update(),this.calculateUvs()),this.calculateVertices(),this.indices=i.indexBuffer.data,this._tintRGB=n._tintRGB,this._darkTintRGB=n._darkTintRGB,this._texture=n.texture;const r=this.material.pluginName;t.batch.setObjectRenderer(t.plugins[r]),t.plugins[r].render(this)}}const Ii=class Ii extends rP{constructor(){super();x(this,"name","")}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;y<a;y+=l?12:8){let w=y;m[f]=r[w++],m[f+1]=r[w++],w+=4,p[f]=r[w++],p[f+1]=r[w++],f+=2}l?(Ii.auxColor[0]=r[8],Ii.auxColor[1]=r[9],Ii.auxColor[2]=r[10],Ii.auxColor[3]=r[11],this.darkTint=Ii.auxColor,Ii.auxColor[0]=r[2],Ii.auxColor[1]=r[3],Ii.auxColor[2]=r[4],Ii.auxColor[3]=r[5],this.tint=Ii.auxColor):(Ii.auxColor[0]=r[2],Ii.auxColor[1]=r[3],Ii.auxColor[2]=r[4],Ii.auxColor[3]=r[5],this.tint=Ii.auxColor),this.blendMode=Ba.toPixiBlending(i),this.alpha=Ii.auxColor[3];const g=this.geometry.indexBuffer;if(g.data.length!==o.length)g.data=new Uint32Array(o);else{const y=g.data;for(let w=0;w<h;w++)y[w]=o[w]}this.name=n,u.update(),d.update(),g.update()}};x(Ii,"auxColor",[0,0,0,0]);let yl=Ii;const Vt=class Vt extends ji{constructor(t,i){if(t instanceof Bh)t={...i,skeletonData:t};else if(i)throw new Error("You cannot use options and oldOptions together.");super();x(this,"skeleton");x(this,"state");x(this,"darkTint",!1);x(this,"hasNeverUpdated",!0);x(this,"_debug");x(this,"slotMeshFactory",()=>new Im);x(this,"beforeUpdateWorldTransforms",()=>{});x(this,"afterUpdateWorldTransforms",()=>{});x(this,"_autoUpdate",!1);x(this,"_ticker",ls.shared);x(this,"meshesCache",new Map);x(this,"lightColor",new Mt);x(this,"darkColor",new Mt);x(this,"_boundsProvider");x(this,"_boundsPoint",new Xt);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 Ip(n);const r=new uR(n);this.state=new aR(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 yl)):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??ls.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 yl&&(this.darkTint=!0),i.destroy()}else for(let i=0;i<this.skeleton.slots.length;i++)if(this.skeleton.slots[i].data.darkColor){this.slotMeshFactory=()=>new yl,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(kr.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 Mo){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=Gv.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 Mo)||!c.maskComputed)&&c.mask&&(this.removeChild(c.mask),Gv.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<h;o++){const c=n[o];let u=this.slotsObject.get(c),d=o+l;u&&(this.updateSlotObject(u,c,d+1),l++),this.updateAndSetPixiMask(c,o===n.length-1);const f=c.darkColor!=null,p=Vt.clipper.isClipping()?2:f?Vt.DARK_VERTEX_SIZE:Vt.VERTEX_SIZE;if(!c.bone.active){Vt.clipper.clipEndWithSlot(c);continue}const m=c.getAttachment();let g,v,b=0;if(m instanceof Eu){const y=m;g=y.color,b=p*4,y.computeWorldVertices(c,this.verticesCache,0,p),t=Vt.QUAD_TRIANGLES,i=y.uvs,v=(r=y.region)==null?void 0:r.texture}else if(m instanceof Zl){const y=m;g=y.color,b=(y.worldVerticesLength>>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 Mo){Vt.clipper.clipStart(c,m);continue}else{this.hasMeshForSlot(c)&&(this.getMeshForSlot(c).visible=!1),Vt.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 M,R,P,F;if(Vt.clipper.isClipping())Vt.clipper.clipTriangles(this.verticesCache,t,t.length,i,this.lightColor,this.darkColor,f),M=Vt.clipper.clippedVertices,R=M.length,P=Vt.clipper.clippedTriangles,F=P.length;else{const k=this.verticesCache;for(let O=2,L=0,U=b;O<U;O+=p,L+=2){let B=O;k[B++]=this.lightColor.r,k[B++]=this.lightColor.g,k[B++]=this.lightColor.b,k[B++]=this.lightColor.a,k[B++]=i[L],k[B++]=i[L+1],f&&(k[B++]=this.darkColor.r,k[B++]=this.darkColor.g,k[B++]=this.darkColor.b,k[B++]=this.darkColor.a)}M=this.verticesCache,R=b,P=t,F=t.length}if(R==0||F==0){Vt.clipper.clipEndWithSlot(c);continue}const I=this.getMeshForSlot(c);I.renderable=!0,I.zIndex=d,I.updateFromSpineData(v,c.data.blendMode,c.data.name,M,R,P,F,f)}Vt.clipper.clipEndWithSlot(c)}Vt.clipper.clipEnd()}calculateBounds(){if(!this._boundsProvider){super.calculateBounds();return}const t=this.transform;if(this._boundsSpineID===t._worldID)return;this.updateBounds();const i=this._localBounds,n=this._boundsPoint;n.set(i.minX,i.minY),t.worldTransform.apply(n,n),this._bounds.minX=n.x,this._bounds.minY=n.y,n.set(i.maxX,i.maxY),t.worldTransform.apply(n,n),this._bounds.maxX=n.x,this._bounds.maxY=n.y}updateBounds(){if(!this._boundsProvider||!this._boundsSpineDirty)return;this._boundsSpineDirty=!1,this._localBounds||(this._localBounds=new Ll);const t=this._boundsProvider.calculateBounds(this),i=this._localBounds;i.clear(),i.minX=t.x,i.minY=t.y,i.maxX=t.x+t.width,i.maxY=t.y+t.height,this.hitArea=this._localBounds.getRectangle()}setBonePosition(t,i){const n=t;if(typeof t=="string"&&(t=this.skeleton.findBone(t)),!t)throw Error(`Cannot set bone position, bone ${String(n)} not found`);if(Vt.vectorAux.set(i.x,i.y),t.parent){const r=t.parent.worldToLocal(Vt.vectorAux);t.x=r.x,t.y=r.y}else t.x=Vt.vectorAux.x,t.y=Vt.vectorAux.y}getBonePosition(t,i){const n=t;return typeof t=="string"&&(t=this.skeleton.findBone(t)),t?(i||(i={x:0,y:0}),i.x=t.worldX,i.y=t.worldY,i):(console.error(`Cannot get bone position! Bone ${String(n)} not found`),i)}skeletonToPixiWorldCoordinates(t){this.worldTransform.apply(t,t)}pixiWorldCoordinatesToSkeleton(t){this.worldTransform.applyInverse(t,t)}pixiWorldCoordinatesToBone(t,i){this.pixiWorldCoordinatesToSkeleton(t),i.parent?i.parent.worldToLocal(t):i.worldToLocal(t)}static from(t,i,n){if(typeof t=="string")return Vt.oldFrom(t,i,n);const{skeleton:r,atlas:a,scale:o=1,darkTint:h,autoUpdate:l,boundsProvider:c,ticker:u}=t,d=`${r}-${a}-${o}`;let f=Vt.skeletonCache[d];if(!f){const p=Rn.get(r),m=Rn.get(a),g=new Am(m);let v=p instanceof Uint8Array?new Cm(g):new Dh(g);v.scale=o,f=v.readSkeletonData(p),Vt.skeletonCache[d]=f}return new Vt({skeletonData:f,darkTint:h,autoUpdate:l,boundsProvider:c,ticker:u})}static oldFrom(t,i,n){const r=`${t}-${i}-${(n==null?void 0:n.scale)??1}`;let a=Vt.skeletonCache[r];if(a)return new Vt(a,n);const o=Rn.get(t),h=Rn.get(i),l=new Am(h);let c=o instanceof Uint8Array?new Cm(l):new Dh(l);return c.scale=(n==null?void 0:n.scale)??1,a=c.readSkeletonData(o),Vt.skeletonCache[r]=a,new this(a,n)}get tint(){return this.skeleton.color.toRgb888()}set tint(t){Mt.rgb888ToColor(this.skeleton.color,t)}};x(Vt,"vectorAux",new Fh),x(Vt,"clipper",new Lh),x(Vt,"QUAD_TRIANGLES",[0,1,2,2,3,0]),x(Vt,"VERTEX_SIZE",8),x(Vt,"DARK_VERTEX_SIZE",12),x(Vt,"skeletonCache",Object.create(null));let Nh=Vt;const Gv=new kh(()=>new ms);Ip.yDown=!0;const Fc="spineTextureAtlasLoader",aP={extension:He.Asset,resolver:{test:s=>gs(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:_s.Normal,name:Fc},test(s){return gs(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=gs(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=Si.dirname(e.src);n&&n.lastIndexOf("/")!==n.length-1&&(n+="/");const r=new sw(s);if(i.images instanceof gt||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}Rn.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 gt)l.setTexture(Ba.from(u));else{const d=u??Si.normalize([...n.split(Si.sep),c].join(Si.sep)),f={src:_h(d,e.src),data:{...i.imageMetadata,alphaMode:l.pma?Xi.PMA:Xi.UNPACK}},p=t.load(f).then(m=>{l.setTexture(Ba.from(m.baseTexture))});a.push(p)}}return await Promise.all(a),Rn.setPreferences({preferCreateImageBitmap:o}),r}}};tt.add(aP);const Oc="spineSkeletonLoader";function oP(s){return s.hasOwnProperty("bones")}function lP(s){return s instanceof Uint8Array}const cP={extension:He.Asset,loader:{name:Oc,extension:{type:He.LoadParser,priority:_s.Normal,name:Oc},test(s){return gs(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=gs(e.src,".json")&&oP(s),i=gs(e.src,".skel")&&lP(s),n=e.loadParser===Oc;return Promise.resolve(t||i||n)}}};tt.add(cP);class hP extends Bn{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 uP=`
|
||
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;
|
||
|
||
}
|
||
`,dP=`
|
||
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 gw extends Tr{constructor(e){super(e),this.shaderGenerator=new ob(uP,dP),this.geometryClass=hP,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=Wt.shared.setValue(e._tintRGB).toPremultiplied(f,!0),m=Wt.shared.setValue(e._darkTintRGB).premultiply(f,!0).toPremultiplied(1,!1);for(let g=0;g<u.length;g+=2)o[n++]=u[g],o[n++]=u[g+1],o[n++]=l[g],o[n++]=l[g+1],a[n++]=p,a[n++]=m,o[n++]=d;for(let g=0;g<c.length;g++)i[r++]=h+c[g]}}x(gw,"extension",{name:"darkTintBatch",type:He.RendererPlugin});tt.add(gw);function fP(s){return s.replace(/\\/g,"/").split("/").pop()||s}function Rp(s,e,t){for(const i of s.pages){const n=e.get(fP(i.name).toLowerCase());if(!n)throw new Error(`Atlas 引用的纹理未选择:${i.name}`);n.baseTexture.alphaMode=i.pma?Xi.PMA:Xi.UNPACK,i.setTexture(t.from(n.baseTexture))}}function vw(s,e){const t=new sw(s);return Rp(t,e,Ba),new Am(t)}function mP(s,e,t){return{skeletonData:new Dh(vw(e,t)).readSkeletonData(s),SpineClass:Nh}}function pP(s,e,t){return{skeletonData:new Cm(vw(e,t)).readSkeletonData(s),SpineClass:Nh}}const gP="modulepreload",vP=function(s){return"/"+s},Hv={},jv=function(e,t,i){let n=Promise.resolve();if(t&&t.length>0){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=vP(l),l in Hv)return;Hv[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":gP,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 yw(){const[s,e]=await Promise.all([jv(()=>import("./index-BrVMjrya.js"),[]),jv(()=>import("./index-C_0QkTeX.js"),__vite__mapDeps([0,1]))]);return{core:s,pixi:e}}async function yP(s,e,t){const{core:i,pixi:n}=await yw(),r=new i.TextureAtlas(e);return Rp(r,t,n.SpineTexture),{skeletonData:new i.SkeletonJson(new i.AtlasAttachmentLoader(r)).readSkeletonData(s),SpineClass:n.Spine}}async function xP(s,e,t){const{core:i,pixi:n}=await yw(),r=new i.TextureAtlas(e);return Rp(r,t,n.SpineTexture),{skeletonData:new i.SkeletonBinary(new i.AtlasAttachmentLoader(r)).readSkeletonData(s),SpineClass:n.Spine}}function Fr(s,e,t){const i=Number(s[e]);return Number.isFinite(i)?i:t}function ps(s,e,t,i){s[e]==null&&(s[e]=Fr(s,t,i))}function Pp(s,e,t){if(typeof s.curve!="number")return;const i=Fr(s,"time",0),r=Fr(e,"time",0)-i,a=s.curve,o=Fr(s,"c2",0),h=Fr(s,"c3",1),l=Fr(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 Ur(s,e){if(Array.isArray(s))for(let t=0;t<s.length-1;t++){const i=s[t],n=s[t+1];Pp(i,n,e.map(({key:r,fallback:a})=>[Fr(i,r,a),Fr(n,r,a)]))}}function bP(s){if(Array.isArray(s))for(let e=0;e<s.length-1;e++)Pp(s[e],s[e+1],[[0,1]])}function Ja(s,e){const t=typeof s=="string"?s.replace(/^#/,""):"",i=t.length===6?`${t}ff`:t.padEnd(8,"f").slice(0,8),n=[0,2,4,6].map(r=>Number.parseInt(i.slice(r,r+2),16)/255);return e?n:n.slice(0,3)}function Wv(s,e){if(Array.isArray(s))for(let t=0;t<s.length-1;t++){const i=s[t],n=s[t+1],r=e?[...Ja(i.light,!0),...Ja(i.dark,!1)]:Ja(i.color,!0),a=e?[...Ja(n.light,!0),...Ja(n.dark,!1)]:Ja(n.color,!0);Pp(i,n,r.map((o,h)=>[o,a[h]]))}}function wP(s){for(const e of s.bones||[])e.inherit==null&&e.transform!=null&&(e.inherit=e.transform);for(const e of s.transform||[])ps(e,"mixRotate","rotateMix",1),ps(e,"mixX","translateMix",1),e.mixY==null&&(e.mixY=e.mixX),ps(e,"mixScaleX","scaleMix",1),e.mixScaleY==null&&(e.mixScaleY=e.mixScaleX),ps(e,"mixShearY","shearMix",1);for(const e of s.path||[])ps(e,"mixRotate","rotateMix",1),ps(e,"mixX","translateMix",1),e.mixY==null&&(e.mixY=e.mixX)}function SP(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 _P(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),Wv(e.rgba,!1),Wv(e.rgba2,!0)}function MP(s){for(const e of Object.values(s.bones||{})){for(const t of e.rotate||[])ps(t,"value","angle",0);Ur(e.rotate,[{key:"value",fallback:0}]),Ur(e.translate,[{key:"x",fallback:0},{key:"y",fallback:0}]),Ur(e.scale,[{key:"x",fallback:1},{key:"y",fallback:1}]),Ur(e.shear,[{key:"x",fallback:0},{key:"y",fallback:0}])}}function TP(s){for(const e of Object.values(s.ik||{}))Ur(e,[{key:"mix",fallback:1},{key:"softness",fallback:0}])}function AP(s){for(const e of Object.values(s.transform||{})){for(const t of e)ps(t,"mixRotate","rotateMix",1),ps(t,"mixX","translateMix",1),t.mixY==null&&(t.mixY=t.mixX),ps(t,"mixScaleX","scaleMix",1),t.mixScaleY==null&&(t.mixScaleY=t.mixScaleX),ps(t,"mixShearY","shearMix",1);Ur(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 EP(s){for(const e of Object.values(s.path||{})){for(const i of["position","spacing"]){const n=e[i];for(const r of n||[])ps(r,"value",i,0);Ur(n,[{key:"value",fallback:0}])}const t=e.mix;for(const i of t||[])ps(i,"mixRotate","rotateMix",1),ps(i,"mixX","translateMix",1),i.mixY==null&&(i.mixY=i.mixX);Ur(t,[{key:"mixRotate",fallback:1},{key:"mixX",fallback:1},{key:"mixY",fallback:1}])}}function CP(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,bP(l)}}}delete s.deform}function xw(s){wP(s),SP(s);for(const e of Object.values(s.animations||{}))_P(e),MP(e),TP(e),AP(e),EP(e),CP(e),!e.drawOrder&&e.draworder&&(e.drawOrder=e.draworder);return s}function IP(s){return s.replace(/\\/g,"/").split("/").pop()||s}async function RP(s){const e=await Promise.all(s.map(async t=>{const i=URL.createObjectURL(t);try{return[IP(t.name).toLowerCase(),await mt.fromURL(i)]}finally{URL.revokeObjectURL(i)}}));return new Map(e)}function PP(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 bw(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 RP(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 xP(u,i,n)),c="4.3"}catch(d){try{({skeletonData:o,SpineClass:h}=pP(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 版本不受支持,仅支持 ${_m()}`);c=WI(l),l==="3.8"&&xw(u);const d=c==="4.3"?await yP(u,i,n):mP(u,i,n);o=d.skeletonData,h=d.SpineClass}if(!l)throw new Error(`Spine 数据版本不受支持,仅支持 ${_m()}`);return{skeletonData:o,textures:r,runtimeVersion:c,SpineClass:h,dataVersion:l,animations:o.animations.map(u=>({name:u.name,duration:u.duration})),bones:PP(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 kP(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 Mf(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 FP(s){return{skeleton:await Mf(s.skeleton),atlas:await Mf(s.atlas),textures:await Promise.all(s.textures.map(Mf))}}const ww="SpineParticle.EditorConfig",Sw=1;function _w(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 OP(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 BP(s){const e=_w(s.settings);return OP({format:ww,version:Sw,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 LP(){return`SpineParticle-${new Date().toISOString().replace(/[-:]/g,"").replace(/\.\d{3}Z$/,"").replace("T","-")}.json`}function Tw(s){const e=BP(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=LP(),document.body.appendChild(n),n.click(),n.remove(),setTimeout(()=>URL.revokeObjectURL(i),0),e}function Aw(s){let e;try{e=JSON.parse(s)}catch{throw new Error("配置文件不是有效的 JSON")}const t=e;if(t.format!==ww)throw new Error("不是 SpineParticle 编辑器配置文件");if(t.version!==Sw)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 DP(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=mt.fromURL(r).then(o=>Or(o)),e.set(r,a)),a},i=await t("/images/star.png");await Promise.all(s.map(async n=>{var a;const r=Gr(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 NP(s){const e=new Map;try{for(const t of s){if(!t.sourceBundle)continue;const i=await FP(t.sourceBundle);e.set(t.id,await bw(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 UP(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 XP(s,e){var c,u,d,f,p,m,g;const t=Aw(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 DP(i);const o=await NP(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=p1((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(),UP(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 Ew(s,e){return XP(s,Aw(e))}async function VP(s,e){if(!/\.json$/i.test(e.name))throw new Error("请选择 .json 配置文件");return Ew(s,await e.text())}const Iu=La({undoCount:0});let Uh=null,tr=null,Xr=[],Jo=null,ir=null,Xh=!1;function kp(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:_w(s.settings)}}function Fp(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 Cw(s,e=kp(s),t=Fp(e)){const i=new Map;for(const n of e.spines){const r=HI(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())$I(e);s.spineAssets.clear()}}function Iw(s){for(;Xr.length>s;)Vh(Xr.shift()||null);Iu.undoCount=Xr.length}function Rw(){const s=Uh;if(!s||!tr||Xh)return;const e=kp(s),t=Fp(e);t!==tr.signature&&(Xr.push(tr),tr=Cw(s,e,t),Iw(s.settings.undoLimit))}function YP(){Xh||(ir&&clearTimeout(ir),ir=setTimeout(()=>{ir=null,Rw()},250))}function $P(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 GP(s){var t,i;if(!$P(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 HP(s,e){const t=tr;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,GP(s),s.recalcTotalFrames(),tr=e}finally{Xh=!1,Vh(t)}}function jP(s){if(!(Uh===s&&Jo)){Jo==null||Jo(),ir&&clearTimeout(ir),Vh(tr);for(const e of Xr)Vh(e);Xr=[],Uh=s,tr=Cw(s),Iu.undoCount=0,Jo=cs(()=>Fp(kp(s)),YP,{flush:"post"})}}function WP(s,e){const t=Math.min(200,Math.max(1,Math.round(Number(e)||20)));s.settings.undoLimit=t,Iw(t)}function Tf(){const s=Uh;if(!s||!tr)return!1;ir&&(clearTimeout(ir),ir=null),Rw();const e=Xr.pop();return e?(HP(s,e),Iu.undoCount=Xr.length,!0):!1}function zP(s){const e=s instanceof HTMLElement?s:null;return!!(e!=null&&e.closest('input, textarea, select, [contenteditable="true"]'))}function qP(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||zP(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]))}Da(()=>{document.addEventListener("pointerdown",e,!0),window.addEventListener("keydown",t,!0)}),Gl(()=>{document.removeEventListener("pointerdown",e,!0),window.removeEventListener("keydown",t,!0)})}const KP={class:"stage-wrap"},ZP={class:"topbar"},JP=["disabled"],QP={class:"tool-group"},ek={class:"tool-group"},tk={key:0,class:"background-panel"},ik=["disabled"],sk=["title"],nk={class:"background-position-row"},rk={class:"background-opacity-row"},ak={class:"zoom-pct"},ok={key:0,class:"settings-panel"},lk={class:"sp-head"},ck={class:"sp-switch-row"},hk={class:"sp-switch-control"},uk={class:"sp-row"},dk={class:"sp-chk"},fk={class:"sp-chk"},mk={class:"sp-row"},pk={class:"sp-row"},gk={class:"sp-chk"},vk={class:"sp-chk"},yk={class:"sp-row"},xk={class:"sp-row"},bk={class:"sp-row"},wk={class:"sp-hex"},Sk={class:"sp-chk"},_k={class:"help-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"help-title"},Mk={class:"help-head"},Tk={key:2,class:"hud"},Ak={class:"hud-number hud-system-count"},Ek={class:"hud-number hud-particle-count"},Ck=sn({__name:"Stage",setup(s){const e=Kl(),t=ht(null),i=ht(null),n=ht(!1),r=ht(!1),a=ht(!1),o=ht(null),h=pt(()=>e.settings.backgroundImageName),l=ht(""),c=ht(!1);function u(W){l.value=l.value===W?"":W}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))}qP({canvasElement:t,canvasFocused:c,undo:Tf,save:()=>Tw(e),togglePlay:()=>e.togglePlay(),toStart:()=>e.toStart(),setTool:W=>{l.value=W}});let f=null,p=null,m=null,g=null,v=0,b=null,y=null,w=null,A=null,T=null,M=null,R=null,P=null,F=null,I=null,k=null,O=null,L=[],U=0,B=0,D=0,_=0,X=null,N=null;const V=new Map,G=new Map;let j=[];const ne=new Map,Q=new Set;let de=!1;cs(()=>[e.activeObjectType,e.activeObjectId],()=>Q.clear());async function me(){if(X&&N)return X;const[W,Y]=await Promise.all([mt.fromURL("/images/star.png"),mt.fromURL("/images/trail.png")]);return X=W,N=Y,X}function we(){p=new ji,f.stage.addChild(p),k=new ji,f.stage.addChild(k),m=new Wr(mt.EMPTY),m.anchor.set(.5),m.visible=!1,p.addChild(m),I=new ms,p.addChild(I),O=new rR,p.addChild(O.container),y=new ms,p.addChild(y),b=new ms,p.addChild(b),A=new ms,p.addChild(A),T=new ms,p.addChild(T),M=new ms,p.addChild(M),R=new ms,p.addChild(R),P=new ms,p.addChild(P),F=new ms,p.addChild(F),w=new ms,p.addChild(w)}function Re(){r.value=!r.value,r.value&&(n.value=!1)}function ge(){a.value=!0,n.value=!1,r.value=!1}function Ae(W){W.key==="Escape"&&a.value&&(a.value=!1)}function H(){n.value=!n.value,n.value&&(r.value=!1)}function K(W){WP(e,Number(W.target.value))}async function q(W){var ie;const Y=W.target,J=(ie=Y.files)==null?void 0:ie[0];if(J)try{e.settings.backgroundImageData=await Jc(J),e.settings.backgroundImageName=J.name}catch(ue){console.error("背景图加载失败",ue)}finally{Y.value=""}}async function z(W){const Y=++v;if(!W){m&&(m.texture=mt.EMPTY,m.visible=!1),g&&g.destroy(!0),g=null;return}try{const J=await mt.fromURL(W);if(Y!==v||!m){J.destroy(!0);return}const ie=g;g=J,m.texture=J,m.visible=!0,ie&&ie.destroy(!0)}catch(J){console.error("背景图恢复失败",J)}}function ee(W=!0){e.settings.backgroundImageData="",e.settings.backgroundImageName="",o.value&&(o.value.value=""),W&&(e.settings.backgroundX=0,e.settings.backgroundY=0,e.settings.backgroundOpacity=1)}function le(W,Y=0){if(W<=0)return 1;const J=Math.pow(10,Math.floor(Math.log10(W))),ie=[1,2,5,10,20,50,100];let ue=1;for(const pe of ie)if(pe*J>=W){ue=pe*J;break}return Math.max(ue,Y)}function ve(){if(!I)return;const W=I;W.clear();const Y=e.settings;if(!Y.tickEnabled){for(const Se of L)Se.visible=!1;return}const J=0,ie=0,ue=f.screen.width/e.editor.viewScale,pe=f.screen.height/e.editor.viewScale,_e=+("0x"+Y.axisColor.replace("#",""));W.lineStyle(1.5,_e,.35),W.moveTo(-ue,ie),W.lineTo(ue,ie),W.moveTo(J,-pe),W.lineTo(J,pe);const Me=e.editor.viewScale,be=le(50/Me),Le=ue,Ce=pe,Be=Math.max(1,Y.tickWidth);if(Y.tickEnabled){for(let Se=0;Se<=ue;Se+=be){const Je=Math.round(Se/be)*be;Je!==0&&(W.lineStyle(Be,_e,.25),W.moveTo(Je,ie-4),W.lineTo(Je,ie+4),W.moveTo(-Je,ie-4),W.lineTo(-Je,ie+4))}for(let Se=0;Se<=pe;Se+=be)Math.round(Se/be)*be!==0&&(W.lineStyle(Be,_e,.25),W.moveTo(J-4,Se),W.lineTo(J+4,Se),W.moveTo(J-4,-Se),W.lineTo(J+4,-Se))}const Te=f.screen.width/2+e.editor.viewX,Ye=f.screen.height*.5+e.editor.viewY,nt=Y.axisFontSize,Ze=+("0x"+Y.axisColor.replace("#",""));for(;L.length<64;){const Se=new Mp("",{fontFamily:"monospace",fontSize:nt,fill:Ze});Se.anchor.set(.5,.5),k.addChild(Se),L.push(Se)}let rt=0;const Qe=Y.showAxisLabels&&Y.tickEnabled;for(let Se=0;Se<=ue;Se+=be){const Je=Math.round(Se/be)*be;if(Je===0||!Qe||Je>Le)continue;const Ie=L[rt++];if(!Ie)break;Ie.style.fontSize=nt,Ie.text=String(Je),Ie.position.set(Te+Je*Me,Ye+9),Ie.visible=!0;const Ft=L[rt++];if(!Ft)break;Ft.style.fontSize=nt,Ft.text=String(-Je),Ft.position.set(Te-Je*Me,Ye+9),Ft.visible=!0}for(let Se=0;Se<=pe;Se+=be){const Je=Math.round(Se/be)*be;if(Je===0||!Qe||Je>Ce)continue;const Ie=L[rt++];if(!Ie)break;Ie.style.fontSize=nt,Ie.text=String(Je),Ie.position.set(Te+8,Ye-Se*Me),Ie.visible=!0;const Ft=L[rt++];if(!Ft)break;Ft.style.fontSize=nt,Ft.text=String(-Je),Ft.position.set(Te+8,Ye+Se*Me),Ft.visible=!0}for(;rt<L.length;){const Se=L[rt++];Se&&(Se.visible=!1)}}function re(W){const Y=t.value.getBoundingClientRect(),J=W.clientX-Y.left,ie=W.clientY-Y.top,ue=W.deltaY<0?1.12:1/1.12,pe=e.editor.viewScale,_e=Math.max(.01,pe*ue),Me=f.screen.width/2,be=f.screen.height*.5,Le=e.editor.viewX,Ce=e.editor.viewY,Be=(J-Me-Le)/pe,Te=(ie-be-Ce)/pe;e.editor.viewX=J-Me-Be*_e,e.editor.viewY=ie-be-Te*_e,e.editor.viewScale=_e}function ye(W){if(W.button!==0)return;if(l.value&&Bi()){Ls(W);return}if(Ct(W)||Et(W)||yi(W)||Kt(W))return;const Y=W.clientX,J=W.clientY,ie=e.editor.viewX,ue=e.editor.viewY,pe=Me=>{e.editor.viewX=ie+(Me.clientX-Y),e.editor.viewY=ue+(Me.clientY-J)},_e=()=>{window.removeEventListener("pointermove",pe),window.removeEventListener("pointerup",_e),window.removeEventListener("pointercancel",_e)};window.addEventListener("pointermove",pe),window.addEventListener("pointerup",_e),window.addEventListener("pointercancel",_e)}function he(W,Y){const J=t.value.getBoundingClientRect(),ie=Math.max(1e-4,e.editor.viewScale),ue=W-J.left,pe=Y-J.top;return{x:(ue-f.screen.width/2-e.editor.viewX)/ie,y:-(pe-f.screen.height*.5-e.editor.viewY)/ie}}function Xe(W,Y,J){const ie=W.rotation*Math.PI/180,ue=Math.cos(ie),pe=Math.sin(ie),_e=Math.max(1e-4,Math.abs(W.scaleX??1)),Me=Math.max(1e-4,Math.abs(W.scaleY??1));return{x:W.x+ue*Y*_e-pe*J*Me,y:W.y+pe*Y*_e+ue*J*Me}}function Pe(W,Y,J){const ie=W.rotation*Math.PI/180,ue=Math.cos(ie),pe=Math.sin(ie),_e=Math.max(1e-4,Math.abs(W.scaleX??1)),Me=Math.max(1e-4,Math.abs(W.scaleY??1)),be=Y-W.x,Le=J-W.y;return{x:(ue*be+pe*Le)/_e,y:(-pe*be+ue*Le)/Me}}function Oe(){if(e.activeObjectType!=="path")return null;const W=e.paths.find(Y=>Y.id===e.activeObjectId)||null;return(W==null?void 0:W.visible)===!1?null:W}function it(W,Y,J){if(W.points.length<2)return W.points.length;const ie=W.closed?W.points.length:W.points.length-1;let ue=W.points.length,pe=1/0;for(let _e=0;_e<ie;_e++){const Me=W.points[_e],be=W.points[(_e+1)%W.points.length],Le=be.x-Me.x,Ce=be.y-Me.y,Be=Math.max(1e-4,Le*Le+Ce*Ce),Te=Math.min(1,Math.max(0,((Y-Me.x)*Le+(J-Me.y)*Ce)/Be)),Ye=Me.x+Le*Te,nt=Me.y+Ce*Te,Ze=Math.hypot(Y-Ye,J-nt);Ze<pe&&(pe=Ze,ue=_e+1)}return ue}function bt(W){const Y=Oe();if(!Y||!Y.enabled)return;if(de){de=!1;return}const J=he(W.clientX,W.clientY),ie=Pe(Y,J.x,J.y),ue=9/Math.max(.01,e.editor.viewScale),pe=Y.points.findIndex(Me=>Math.hypot(Me.x-ie.x,Me.y-ie.y)<=ue);if(pe>=0){Y.points.splice(pe,1),Q.clear();return}const _e=it(Y,ie.x,ie.y);Y.points.splice(_e,0,{x:ie.x,y:ie.y,inX:0,inY:0,outX:0,outY:0}),Q.clear(),Q.add(_e)}function Ct(W){const Y=Oe();if(!Y||!Y.enabled)return!1;const J=he(W.clientX,W.clientY),ie=Pe(Y,J.x,J.y),ue=9/Math.max(.01,e.editor.viewScale);if(W.detail>=2){if(Y.points.findIndex(Ce=>Math.hypot(Ce.x-ie.x,Ce.y-ie.y)<=ue)>=0)return!0;const be={x:ie.x,y:ie.y,inX:0,inY:0,outX:0,outY:0},Le=it(Y,ie.x,ie.y);return Y.points.splice(Le,0,be),Q.clear(),Q.add(Le),de=!0,wt(Ce=>{const Be=he(Ce.clientX,Ce.clientY),Te=Pe(Y,Be.x,Be.y);be.outX=Te.x-be.x,be.outY=Te.y-be.y,be.inX=-be.outX,be.inY=-be.outY}),!0}let pe=null;for(const Me of Q){const be=Y.points[Me];be&&(Math.hypot(be.x+be.inX-ie.x,be.y+be.inY-ie.y)<=ue&&(pe={index:Me,side:"in"}),Math.hypot(be.x+be.outX-ie.x,be.y+be.outY-ie.y)<=ue&&(pe={index:Me,side:"out"}))}if(pe){const Me=Y.points[pe.index],be=pe.side==="in"?Math.hypot(Me.outX,Me.outY):Math.hypot(Me.inX,Me.inY);return wt(Ce=>{const Be=he(Ce.clientX,Ce.clientY),Te=Pe(Y,Be.x,Be.y),Ye=Te.x-Me.x,nt=Te.y-Me.y;if(pe.side==="in"?(Me.inX=Ye,Me.inY=nt):(Me.outX=Ye,Me.outY=nt),!Ce.altKey){const Ze=Math.max(1e-4,Math.hypot(Ye,nt)),rt=Ce.shiftKey?Ze:be;pe.side==="in"?(Me.outX=-Ye/Ze*rt,Me.outY=-nt/Ze*rt):(Me.inX=-Ye/Ze*rt,Me.inY=-nt/Ze*rt)}}),!0}const _e=Y.points.findIndex(Me=>Math.hypot(Me.x-ie.x,Me.y-ie.y)<=ue);if(_e>=0){if(W.altKey)return Q.delete(_e),!0;W.ctrlKey||W.metaKey?Q.add(_e):Q.has(_e)||(Q.clear(),Q.add(_e));const Me=ie,be=[...Q].map(Ce=>({index:Ce,x:Y.points[Ce].x,y:Y.points[Ce].y}));return wt(Ce=>{const Be=he(Ce.clientX,Ce.clientY),Te=Pe(Y,Be.x,Be.y);for(const Ye of be)Y.points[Ye.index].x=Ye.x+Te.x-Me.x,Y.points[Ye.index].y=Ye.y+Te.y-Me.y}),!0}if(W.altKey&&!W.ctrlKey&&!W.metaKey)return Q.clear(),!0;if(W.ctrlKey||W.metaKey||W.altKey){const Me=ie,be=W.altKey,Le=Ce=>{const Be=he(Ce.clientX,Ce.clientY),Te=Pe(Y,Be.x,Be.y),Ye=Math.min(Me.x,Te.x),nt=Math.max(Me.x,Te.x),Ze=Math.min(Me.y,Te.y),rt=Math.max(Me.y,Te.y);Y.points.forEach((Qe,Se)=>{Qe.x>=Ye&&Qe.x<=nt&&Qe.y>=Ze&&Qe.y<=rt&&(be?Q.delete(Se):Q.add(Se))}),window.removeEventListener("pointerup",Le),window.removeEventListener("pointercancel",Le)};return window.addEventListener("pointerup",Le),window.addEventListener("pointercancel",Le),!0}return!1}function wt(W){const Y=()=>{window.removeEventListener("pointermove",W),window.removeEventListener("pointerup",Y),window.removeEventListener("pointercancel",Y)};window.addEventListener("pointermove",W),window.addEventListener("pointerup",Y),window.addEventListener("pointercancel",Y)}function Et(W){if(e.activeObjectType!=="collision")return!1;const Y=e.colliders.find(rt=>rt.id===e.activeObjectId);if(!(Y!=null&&Y.enabled)||Y.visible===!1)return!1;const J=he(W.clientX,W.clientY),ie=Y.rotation*Math.PI/180,ue=Math.cos(ie),pe=Math.sin(ie),_e=Math.max(1e-4,Math.abs(Y.scaleX??1)),Me=Math.max(1e-4,Math.abs(Y.scaleY??1)),be=J.x-Y.x,Le=J.y-Y.y,Ce=(ue*be+pe*Le)/_e,Be=(-pe*be+ue*Le)/Me;if(!(Y.shape==="circle"?Math.hypot(Ce,Be)<=Y.radius:Y.shape==="ellipse"?Math.hypot(Ce/Math.max(1,Y.radiusX),Be/Math.max(1,Y.radiusY))<=1:Math.abs(Ce)<=Y.width*.5&&Math.abs(Be)<=Y.height*.5))return!1;const Ye=Y.x,nt=Y.y,Ze=J;return wt(rt=>{const Qe=he(rt.clientX,rt.clientY);Y.x=Ye+Qe.x-Ze.x,Y.y=nt+Qe.y-Ze.y}),!0}function Kt(W){const Y=e.systems.find(Le=>Le.id===e.activeId);if((Y==null?void 0:Y.visible)===!1)return!1;const J=Y==null?void 0:Y.config;if(!(J!=null&&J.forceField)||J.forceRadius<=0)return!1;const ie=he(W.clientX,W.clientY);if(Math.hypot(ie.x-J.forceCenterX,ie.y-J.forceCenterY)>J.forceRadius)return!1;const pe=J.forceCenterX,_e=J.forceCenterY;t.value&&(t.value.style.cursor="grabbing");const Me=Le=>{const Ce=he(Le.clientX,Le.clientY);J.forceCenterX=pe+Ce.x-ie.x,J.forceCenterY=_e+Ce.y-ie.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),W.preventDefault(),!0}function yi(W){const Y=e.systems.find(Ce=>Ce.id===e.activeId);if((Y==null?void 0:Y.visible)===!1)return!1;const J=Y==null?void 0:Y.config;if(!(J!=null&&J.attraction))return!1;const ie=he(W.clientX,W.clientY),ue=Math.max(J.attractionRadius,12/Math.max(1e-4,e.editor.viewScale));if(Math.hypot(ie.x-J.attractionCenterX,ie.y-J.attractionCenterY)>ue)return!1;const _e=J.attractionCenterX,Me=J.attractionCenterY;t.value&&(t.value.style.cursor="grabbing");const be=Ce=>{const Be=he(Ce.clientX,Ce.clientY);J.attractionCenterX=_e+Be.x-ie.x,J.attractionCenterY=Me+Be.y-ie.y},Le=()=>{t.value&&(t.value.style.cursor=""),window.removeEventListener("pointermove",be),window.removeEventListener("pointerup",Le),window.removeEventListener("pointercancel",Le)};return window.addEventListener("pointermove",be),window.addEventListener("pointerup",Le),window.addEventListener("pointercancel",Le),W.preventDefault(),!0}function Bi(){const W=e.activeObjectId;if(e.activeObjectType==="particle"){const ie=e.systems.find(pe=>pe.id===W);if(!ie||ie.visible===!1)return null;const ue=ie.config;return{x:ue.centerX,y:ue.centerY,rotation:ue.rootRotation,scaleX:ue.rootScaleX??1,scaleY:ue.rootScaleY??1,setPosition:(pe,_e)=>{ue.centerX=pe,ue.centerY=_e},setRotation:pe=>{ue.rootRotation=pe},setScale:(pe,_e)=>{ue.rootScaleX=pe,ue.rootScaleY=_e}}}const J=(e.activeObjectType==="collision"?e.colliders:e.activeObjectType==="path"?e.paths:e.spines).find(ie=>ie.id===W);return!J||J.visible===!1?null:{x:Number(J.x)||0,y:Number(J.y)||0,rotation:Number(J.rotation)||0,scaleX:Math.max(.05,Number(J.scaleX)||1),scaleY:Math.max(.05,Number(J.scaleY)||1),setPosition:(ie,ue)=>{J.x=ie,J.y=ue},setRotation:ie=>{J.rotation=ie},setScale:(ie,ue)=>{J.scaleX=ie,J.scaleY=ue}}}function Ls(W){const Y=Bi();if(!Y)return;const J=e.editor.viewScale,ie=t.value.getBoundingClientRect(),ue=ie.left+f.screen.width/2+e.editor.viewX+Y.x*J,pe=ie.top+f.screen.height*.5+e.editor.viewY+-Y.y*J,_e=W.clientX,Me=W.clientY,be=l.value,Le=Y.x,Ce=Y.y,Be=Y.rotation,Te=Y.scaleX,Ye=Y.scaleY,nt=Math.hypot(_e-ue,Me-pe)||1,Ze=Math.atan2(Me-pe,_e-ue),rt=Se=>{const Je=(Se.clientX-_e)/J,Ie=(Se.clientY-Me)/J;if(be==="translate")Y.setPosition(Le+Je,Ce-Ie);else if(be==="rotate"){const Ft=Math.atan2(Se.clientY-pe,Se.clientX-ue);Y.setRotation(Be-(Ft-Ze)*180/Math.PI)}else if(be==="scale"){const Jt=Math.hypot(Se.clientX-ue,Se.clientY-pe)/nt;Y.setScale(Math.max(.05,Te*Jt),Math.max(.05,Ye*Jt))}},Qe=()=>{window.removeEventListener("pointermove",rt),window.removeEventListener("pointerup",Qe),window.removeEventListener("pointercancel",Qe)};window.addEventListener("pointermove",rt),window.addEventListener("pointerup",Qe),window.addEventListener("pointercancel",Qe)}function an(){ce(1.2)}function xi(){ce(1/1.2)}function ce(W){const Y=Math.max(.01,e.editor.viewScale*W);e.editor.viewScale=Y}function fe(){e.editor.viewScale=1,e.editor.viewX=0,e.editor.viewY=0}function It(){e.editor.viewScale=1,e.editor.viewX=0,e.editor.viewY=0}function Rt(){e.settings.showGrid=!e.settings.showGrid}function Zt(){if(p){for(const[W,Y]of V){const J=e.systems.find(ie=>ie.id===W);(!J||G.get(W)!==J.config)&&(p.removeChild(Y),Y.destroy({children:!0}),V.delete(W),G.delete(W))}for(const W of e.systems){X&&!W.config.texture&&(W.config.texture=X);const Y=Gr(W.config);if(N)for(const ie of Y.trailResources)!ie.texture&&(ie.previewUrl==="/images/trail.png"||ie.previewUrl==="/trails/trail.png")&&(ie.texture=N);if(X)for(const ie of Y.imageResources)!ie.texture&&ie.textureName==="star"&&(ie.texture=X);if(V.has(W.id))continue;const J=new LI(W.config);J.setEmitterPos(()=>({x:W.config.centerX,y:W.config.centerY})),p.addChild(J),V.set(W.id,J),G.set(W.id,W.config)}}}function St(){if(!b)return;const W=b;if(W.clear(),!!e.settings.showEmitter&&e.systems.length)for(const Y of e.systems){if(Y.visible===!1)continue;const J=ne.get(Y.id),ie=(J==null?void 0:J.x)??Y.config.centerX??0,ue=-((J==null?void 0:J.y)??Y.config.centerY??0),pe=e.activeObjectType==="particle"&&Y.id===e.activeId,_e=pe?16763955:9082040,Me=pe?.4:.2;W.lineStyle(1,_e,Me),W.drawCircle(ie,ue,10),W.beginFill(_e,pe?.8:.4),W.drawCircle(ie,ue,3),W.endFill(),W.lineStyle(1,_e,pe?.3:.15),W.moveTo(ie-16,ue),W.lineTo(ie+16,ue),W.moveTo(ie,ue-16),W.lineTo(ie,ue+16)}}function Ms(){var J;if(!y)return;const W=y;(J=W.parent)==null||J.addChild(W),W.clear();const Y=new Map;for(const ie of e.spines)ie.visible===!1||!ie.selectedBone||ie.status!=="ready"||Y.set(`${ie.id}:${ie.selectedBone}`,{spineId:ie.id,boneName:ie.selectedBone});for(const ie of e.systems){if(ie.visible===!1)continue;const ue=ie.config;if(!ue.emitterFollow||ue.emitterFollowMode!=="bone"||!ue.emitterFollowSpineId||!ue.emitterFollowBoneName)continue;const pe=e.spines.find(_e=>_e.id===ue.emitterFollowSpineId);!pe||pe.visible===!1||Y.set(`${ue.emitterFollowSpineId}:${ue.emitterFollowBoneName}`,{spineId:ue.emitterFollowSpineId,boneName:ue.emitterFollowBoneName})}for(const ie of Y.values()){const ue=O==null?void 0:O.getBoneWorldTransform(ie.spineId,ie.boneName);if(!ue)continue;const pe=ue.x,_e=-ue.y;W.lineStyle(2,12881151,.95),W.beginFill(12881151,.2),W.drawCircle(pe,_e,8),W.endFill(),W.beginFill(15919103,1),W.drawCircle(pe,_e,3.5),W.endFill()}}function Ds(){if(!A)return;const W=A;if(W.clear(),!e.settings.showEmitter)return;const Y=e.systems.find(Ze=>Ze.id===e.activeId);if(!Y||Y.visible===!1)return;const J=Y.config,ie=ne.get(Y.id),ue=(ie==null?void 0:ie.x)??J.centerX??0,pe=-((ie==null?void 0:ie.y)??J.centerY??0),_e=J.shape;if(_e==="point"||_e==="path")return;const Me=J.rootScaleX??1,be=J.rootScaleY??1,Le=-((ie==null?void 0:ie.rotation)??J.rootRotation??0)*Math.PI/180,Ce=Math.cos(Le),Be=Math.sin(Le),Te=J.offsetX??0,Ye=J.offsetY??0,nt=(Ze,rt)=>{const Qe=Ze+Te,Se=-rt-Ye,Je=Qe*Me,Ie=Se*be;return[ue+Je*Ce-Ie*Be,pe+(Je*Be+Ie*Ce)]};if(_e==="circle"){const Ze=Rh(J.innerRadius,J.outerRadius);W.lineStyle(2,3991658,.7);const rt=48;for(const Qe of[Ze.outer,Ze.inner])if(!(Qe<=0))for(let Se=0;Se<=rt;Se++){const Je=Se/rt*Math.PI*2,[Ie,Ft]=nt(Math.cos(Je)*Qe,Math.sin(Je)*Qe);Se===0?W.moveTo(Ie,Ft):W.lineTo(Ie,Ft)}}else if(_e==="rect"){const Ze=d1(J);W.lineStyle(2,4885759,.7);for(const[rt,Qe]of[[Ze.outerW,Ze.outerH],[Ze.innerW,Ze.innerH]]){if(rt<=0||Qe<=0)continue;const Se=rt/2,Je=Qe/2,Ie=nt(-Se,-Je),Ft=nt(Se,-Je),Jt=nt(Se,Je),Mi=nt(-Se,Je);W.moveTo(Ie[0],Ie[1]),W.lineTo(Ft[0],Ft[1]),W.lineTo(Jt[0],Jt[1]),W.lineTo(Mi[0],Mi[1]),W.lineTo(Ie[0],Ie[1])}}else if(_e==="cone"){const Ze=Rh(J.innerRadius,J.outerRadius),rt=J.coneAngle/2*Math.PI/180,Qe=J.coneDirection*Math.PI/180,Se=nt(Math.cos(Qe-rt)*Ze.inner,Math.sin(Qe-rt)*Ze.inner),Je=nt(Math.cos(Qe+rt)*Ze.inner,Math.sin(Qe+rt)*Ze.inner),Ie=nt(Math.cos(Qe-rt)*Ze.outer,Math.sin(Qe-rt)*Ze.outer),Ft=nt(Math.cos(Qe+rt)*Ze.outer,Math.sin(Qe+rt)*Ze.outer);W.lineStyle(2,3991658,.7),W.moveTo(Se[0],Se[1]),W.lineTo(Ie[0],Ie[1]),W.moveTo(Je[0],Je[1]),W.lineTo(Ft[0],Ft[1]),W.lineStyle(1,3991658,.5);const Jt=24;for(const Mi of[Ze.outer,Ze.inner])if(!(Mi<=0))for(let $=0;$<=Jt;$++){const S=Qe-rt+2*rt*$/Jt,[C,Z]=nt(Math.cos(S)*Mi,Math.sin(S)*Mi);$===0?W.moveTo(C,Z):W.lineTo(C,Z)}}}function Li(){if(!T)return;const W=T;W.clear();const Y=e.systems.find(_e=>_e.id===e.activeId);if((Y==null?void 0:Y.visible)===!1)return;const J=Y==null?void 0:Y.config;if(!(J!=null&&J.forceField)||J.forceRadius<=0)return;const ie=J.forceCenterX,ue=-J.forceCenterY,pe=J.forceStrength>=0?5818367:16739194;W.lineStyle(2,pe,.85),W.beginFill(pe,.08),W.drawCircle(ie,ue,J.forceRadius),W.endFill(),W.lineStyle(1,pe,.7),W.moveTo(ie-9,ue),W.lineTo(ie+9,ue),W.moveTo(ie,ue-9),W.lineTo(ie,ue+9),W.beginFill(pe,.95),W.drawCircle(ie,ue,4),W.endFill()}function Ts(){if(!M)return;const W=M;W.clear();const Y=e.systems.find(Me=>Me.id===e.activeId);if((Y==null?void 0:Y.visible)===!1)return;const J=Y==null?void 0:Y.config;if(!(J!=null&&J.attraction))return;const ie=J.attractionCenterX,ue=-J.attractionCenterY,pe=Math.max(0,J.attractionRadius),_e=16731487;pe>0&&(W.lineStyle(2,_e,.95),W.beginFill(_e,.09),W.drawCircle(ie,ue,pe),W.endFill()),W.lineStyle(1,_e,.85),W.moveTo(ie-10,ue),W.lineTo(ie+10,ue),W.moveTo(ie,ue-10),W.lineTo(ie,ue+10),W.beginFill(_e,1),W.drawCircle(ie,ue,pe>0?4:6),W.endFill()}function qr(){if(!F)return;const W=F;if(W.clear(),!l.value)return;const Y=Bi();if(!Y)return;const J=Y.x,ie=-Y.y,ue=Y.scaleX,pe=Y.scaleY,_e=-Y.rotation*Math.PI/180,Me=Math.cos(_e),be=Math.sin(_e),Le=(Te,Ye)=>{const nt=Te*ue,Ze=-Ye*pe;return[J+nt*Me-Ze*be,ie+(nt*be+Ze*Me)]},Ce=(Te,Ye,nt,Ze)=>{const rt=Le(Te,Ye),Qe=Le(nt,Ze);W.moveTo(rt[0],rt[1]),W.lineTo(Qe[0],Qe[1])},Be=26;if(W.lineStyle(2,3526911,.9),W.beginFill(3526911,.25),W.drawCircle(J,ie,6),W.endFill(),l.value==="translate")W.lineStyle(2,3526911,.9),Ce(-Be,0,Be,0),Ce(0,-Be,0,Be),Ce(Be-6,-4,Be,0),Ce(Be,0,Be-6,4),Ce(-20,-4,-Be,0),Ce(-Be,0,-20,4),Ce(-4,Be-6,0,Be),Ce(0,Be,4,Be-6),Ce(-4,-20,0,-Be),Ce(0,-Be,4,-20);else if(l.value==="rotate"){W.lineStyle(2,3526911,.8);const Te=48;for(let Ze=0;Ze<=Te;Ze++){const rt=Ze/Te*Math.PI*2,[Qe,Se]=Le(Math.cos(rt)*Be,Math.sin(rt)*Be);Ze===0?W.moveTo(Qe,Se):W.lineTo(Qe,Se)}const[Ye,nt]=Le(0,Be);W.beginFill(3526911,.95),W.drawCircle(Ye,nt,4),W.endFill()}else if(l.value==="scale"){W.lineStyle(2,3526911,.9);const Ye=[[-Be,-Be],[Be,-Be],[Be,Be],[-Be,Be]].map(([nt,Ze])=>Le(nt,Ze));W.moveTo(Ye[0][0],Ye[0][1]),W.lineTo(Ye[1][0],Ye[1][1]),W.lineTo(Ye[2][0],Ye[2][1]),W.lineTo(Ye[3][0],Ye[3][1]),W.lineTo(Ye[0][0],Ye[0][1]),W.beginFill(3526911,.9);for(const nt of Ye)W.drawRect(nt[0]-3,nt[1]-3,6,6);W.endFill()}}function on(W,Y,J,ie){var _e;const ue=Number.isFinite(Y.worldX)&&Number.isFinite(Y.worldY),pe=Number.isFinite(Y.worldRotation);W.push({boneName:Y.boneName,x:ue?Y.worldX:Y.x,y:ue?-Y.worldY:Y.y,rotation:pe?-Y.worldRotation:-Y.rotation,parentX:J,parentY:ie}),(_e=Y.trailState)!=null&&_e.bones.length&&Y.trailState.bones.forEach(Me=>{const be=Number.isFinite(Me.worldX)&&Number.isFinite(Me.worldY),Le=Number.isFinite(Me.worldRotation);W.push({boneName:Me.boneName,x:be?Me.worldX:Me.x,y:be?-Me.worldY:Me.y,rotation:Le?-Me.worldRotation:Me.rotation,parentX:J,parentY:ie,trail:!0})})}function Wi(W,Y,J,ie,ue,pe,_e,Me){const be=pe*.62,Le=Y+ie*pe,Ce=J+ue*pe,Be=Math.max(2.5,pe*.32),Te=Math.max(1.7,pe*.22),Ye=Le-ie*Be,nt=Ce-ue*Be,Ze=-ue,rt=ie;W.lineStyle(_e,Me,.95),W.moveTo(Y-ie*be,J-ue*be),W.lineTo(Ye,nt),W.lineStyle(0),W.beginFill(Me,.95),W.drawPolygon([Le,Ce,Ye+Ze*Te,nt+rt*Te,Ye-Ze*Te,nt-rt*Te]),W.endFill()}function Kr(W){if(!w)return;const Y=w;if(Y.clear(),!e.settings.showBones)return;const J=0,ie=0,ue=Math.max(.25,Math.abs(e.editor.viewScale)||1),pe=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*pe/ue,be=4.5*_e/ue,Le=Math.max(.65,_e*.625)/ue;for(const Ce of W){const Be=Ce.trail?16731533:16747610;Y.lineStyle(1,Be,Ce.trail?.65:.35),Y.moveTo(Ce.parentX??J,Ce.parentY??ie),Y.lineTo(Ce.x,Ce.y);const Te=Ce.rotation*Math.PI/180,Ye=Math.cos(Te),nt=Math.sin(Te);Wi(Y,Ce.x,Ce.y,Ye,nt,be,Le,15684432),Wi(Y,Ce.x,Ce.y,nt,-Ye,be,Le,5622123),Y.beginFill(Be,.9),Y.drawCircle(Ce.x,Ce.y,Me),Y.endFill()}}function Zr(W,Y=16777215){const J=Number.parseInt(W.replace("#",""),16);return Number.isFinite(J)?J:Y}function Ns(){if(!R)return;const W=R;W.clear();for(const Y of j){if(Y.visible===!1)continue;const J=e.activeObjectType==="collision"&&e.activeObjectId===Y.id,ie=Y.enabled?J?16735858:13911899:5792116,ue=Y.rotation*Math.PI/180,pe=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)),Le=(Te,Ye)=>({x:Y.x+pe*Te*Me-_e*Ye*be,y:-(Y.y+_e*Te*Me+pe*Ye*be)});let Ce=[];if(Y.shape==="circle"||Y.shape==="ellipse"){const Te=Y.shape==="circle"?Y.radius:Y.radiusX,Ye=Y.shape==="circle"?Y.radius:Y.radiusY;Ce=Array.from({length:49},(nt,Ze)=>{const rt=Ze/48*Math.PI*2;return Le(Math.cos(rt)*Te,Math.sin(rt)*Ye)})}else if(Y.shape==="rect"){const Te=Y.width*.5,Ye=Y.height*.5;Ce=[Le(-Te,-Ye),Le(Te,-Ye),Le(Te,Ye),Le(-Te,Ye),Le(-Te,-Ye)]}else{const Te=Math.max(3,Math.min(16,Math.round(Y.sides)));Ce=Array.from({length:Te+1},(Ye,nt)=>{const Ze=Math.PI*.5+nt%Te/Te*Math.PI*2;return Le(Math.cos(Ze)*Y.width*.5,Math.sin(Ze)*Y.height*.5)})}if(!Ce.length)continue;W.lineStyle(J?2.5:1.5,ie,Y.enabled?.95:.45),W.beginFill(ie,J?.12:.055),W.moveTo(Ce[0].x,Ce[0].y);for(let Te=1;Te<Ce.length;Te++)W.lineTo(Ce[Te].x,Ce[Te].y);W.endFill();const Be=Le(0,0);W.lineStyle(1,ie,.8),W.moveTo(Be.x-7,Be.y),W.lineTo(Be.x+7,Be.y),W.moveTo(Be.x,Be.y-7),W.lineTo(Be.x,Be.y+7)}}function ln(){if(!P)return;const W=P;W.clear();for(const Y of e.paths){if(Y.visible===!1||!Y.enabled||!Y.points.length)continue;const J=e.activeObjectType==="path"&&e.activeObjectId===Y.id,ie=Zr(Y.color,16749374),ue=(be,Le)=>{const Ce=Xe(Y,be,Le);return{x:Ce.x,y:-Ce.y}},pe=Y.points[0],_e=ue(pe.x,pe.y);W.lineStyle(J?2.5:1.8,ie,J?1:.75),W.moveTo(_e.x,_e.y);const Me=Y.closed?Y.points.length:Y.points.length-1;for(let be=0;be<Me;be++){const Le=Y.points[be],Ce=Y.points[(be+1)%Y.points.length],Be=ue(Le.x+Le.outX,Le.y+Le.outY),Te=ue(Ce.x+Ce.inX,Ce.y+Ce.inY),Ye=ue(Ce.x,Ce.y);W.bezierCurveTo(Be.x,Be.y,Te.x,Te.y,Ye.x,Ye.y)}J&&Y.points.forEach((be,Le)=>{const Ce=ue(be.x,be.y),Be=ue(be.x+be.inX,be.y+be.inY),Te=ue(be.x+be.outX,be.y+be.outY),Ye=Math.hypot(be.inX,be.inY)>.01,nt=Math.hypot(be.outX,be.outY)>.01;W.lineStyle(1,11121867,.65),Ye&&(W.moveTo(Ce.x,Ce.y),W.lineTo(Be.x,Be.y)),nt&&(W.moveTo(Ce.x,Ce.y),W.lineTo(Te.x,Te.y)),Ye&&(W.beginFill(14015724,.95),W.drawCircle(Be.x,Be.y,3),W.endFill()),nt&&(W.beginFill(14015724,.95),W.drawCircle(Te.x,Te.y,3),W.endFill()),W.beginFill(Q.has(Le)?16777215:ie,1),W.lineStyle(1.5,Q.has(Le)?6126847:16777215,.95),W.drawCircle(Ce.x,Ce.y,Q.has(Le)?5:4),W.endFill()})}}function cn(W,Y,J="linear"){if(!W.length)return Y;const ie=[...W].sort((ue,pe)=>ue.x-pe.x);if(Y<=ie[0].x)return ie[0].y;for(let ue=1;ue<ie.length;ue++){const pe=ie[ue-1],_e=ie[ue];if(Y<=_e.x){let Me=(Y-pe.x)/Math.max(1e-4,_e.x-pe.x);if(J==="bezier"){const be=pe.x+(pe.outX??(_e.x-pe.x)/3),Le=_e.x+(_e.inX??-(_e.x-pe.x)/3);let Ce=0,Be=1;for(let Te=0;Te<18;Te++){const Ye=(Ce+Be)/2;Nn(pe.x,be,Le,_e.x,Ye)<Y?Ce=Ye:Be=Ye}return Me=(Ce+Be)/2,Nn(pe.y,pe.y+(pe.outY??(_e.y-pe.y)/3),_e.y+(_e.inY??-(_e.y-pe.y)/3),_e.y,Me)}return pe.y+(_e.y-pe.y)*Me}}return ie[ie.length-1].y}function Nn(W,Y,J,ie,ue){const pe=1-ue;return pe*pe*pe*W+3*pe*pe*ue*Y+3*pe*ue*ue*J+ue*ue*ue*ie}function Jr(W){j=e.colliders.map(Y=>{if(!Y.followPath||!Y.followPathId)return Y;const J=e.paths.find(Le=>Le.id===Y.followPathId&&Le.enabled);if(!(J!=null&&J.points.length))return Y;const ie=Math.max(.05,Number(Y.followDuration)||2),ue=Math.min(1,Math.max(0,W/ie)),pe=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,cn(pe,ue,_e))),be=yf(J,Me);return be?{...Y,x:be.x,y:be.y,rotation:Y.rotation+(Y.followPathRotation?be.angle:0)}:Y})}function Us(W,Y,J,ie=Math.max(1e-4,Math.abs(W.rootScaleX)),ue=Math.max(1e-4,Math.abs(W.rootScaleY))){const pe=-W.rootRotation*Math.PI/180,_e=Math.cos(pe),Me=Math.sin(pe),be=Y-W.centerX,Le=-J+W.centerY;return{x:(_e*be+Me*Le)/ie,y:(-Me*be+_e*Le)/ue}}function $a(W,Y,J){const ie=yf(Y,J);if(!ie)return null;const ue=Us(W,ie.x,ie.y),pe=ie.angle*Math.PI/180,_e=Us(W,ie.x+Math.cos(pe),ie.y+Math.sin(pe)),Me=Math.atan2(_e.y-ue.y,_e.x-ue.x)*180/Math.PI;return{...ue,angle:Me}}function Qr(){var J,ie,ue;_=requestAnimationFrame(Qr);const W=performance.now()/1e3;let Y=W-U;if(U=W,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))),ve(),Zt();const pe=Math.max(1,e.timeline.fps),_e=e.timeline.frame,Me=_e/pe;O==null||O.sync(e.spines,_e,pe),Jr(Me);for(const Qe of e.systems){const Se=V.get(Qe.id);if(!Se)continue;Se.setFollowExportCurveMode(e.settings.exportSettings.keyframeCurve==="bezier"?"贝塞尔":"线性");const Je=Qe.visible!==!1;Se.visible=Je,Se.renderable=Je;const Ie=Qe.config;Se.scale.set(Ie.rootScaleX,Ie.rootScaleY);const Ft=new Set(Ie.collisionColliderIds);Se.setColliders(Ie.collision?j.filter(ei=>Ft.has(ei.id)):[]),Se.setEmitterFollowSpawn(0,0,0);let Jt={x:Ie.centerX,y:Ie.centerY,rotation:Ie.rootRotation};const Mi=Ie.emitterFollow&&Ie.emitterFollowMode==="bone"?e.spines.find(ei=>ei.id===Ie.emitterFollowSpineId&&ei.enabled&&ei.status==="ready"):null,$=Mi&&(O==null?void 0:O.getBoneWorldTransform(Mi.id,Ie.emitterFollowBoneName))||null,S=Ie.emitterFollow&&Ie.emitterFollowMode==="path"?e.paths.find(ei=>ei.id===Ie.emitterFollowPathId&&ei.enabled):null,C=Math.max(.05,Ie.emitterFollowDuration),Z=Math.min(1,Math.max(0,Me/C)),Fe=Math.min(1,Math.max(0,cn(Ie.emitterFollowCurve,Z))),ft=Math.min(1,Math.max(0,Ie.emitterFollowOffset)),Ot=Ie.emitterFollowDirection==="reverse"?(1-ft)*(1-Fe):ft+(1-ft)*Fe,Ht=S?yf(S,Ot):null;if($){const ei=Ie.emitterFollowBoneOffsetX,Xo=Ie.emitterFollowBoneOffsetY,ea=$.x+ei,Ga=$.y+Xo,tc=Ie.rootRotation+Ie.emitterFollowBoneRotation,Vo=Math.max(1e-4,Math.abs(Ie.rootScaleX*Ie.emitterFollowBoneScaleX)),Yo=Math.max(1e-4,Math.abs(Ie.rootScaleY*Ie.emitterFollowBoneScaleY));if(Jt={x:ea,y:Ga,rotation:tc},Ie.emitterFollowSpace==="local")Se.position.set(ea,-Ga),Se.rotation=-tc*Math.PI/180,Se.scale.set(Vo,Yo),Se.setSimulationTransform(ea,Ga,tc,Vo,Yo);else{Se.position.set(Ie.centerX,-Ie.centerY),Se.rotation=-Ie.rootRotation*Math.PI/180,Se.scale.set(Vo,Yo),Se.setSimulationTransform(Ie.centerX,Ie.centerY,Ie.rootRotation,Vo,Yo);const Yp=Us(Ie,ea,Ga,Vo,Yo),ES=-(tc-Ie.rootRotation);Se.setEmitterFollowSpawn(Yp.x,Yp.y,ES)}}else if(Ht){const ei=Ht.angle+(Ie.emitterFollowDirection==="reverse"?180:0),Xo=Ie.emitterAngleMode==="direction"?ei:Ie.rootRotation;if(Jt={x:Ht.x,y:Ht.y,rotation:Xo},Ie.emitterFollowSpace==="local")Se.position.set(Ht.x,-Ht.y),Se.rotation=-Xo*Math.PI/180,Se.setSimulationTransform(Ht.x,Ht.y,Xo);else{Se.position.set(Ie.centerX,-Ie.centerY),Se.rotation=-Ie.rootRotation*Math.PI/180,Se.setSimulationTransform(Ie.centerX,Ie.centerY,Ie.rootRotation);const ea=Us(Ie,Ht.x,Ht.y),Ga=Ie.emitterAngleMode==="direction"?-(ei-Ie.rootRotation):0;Se.setEmitterFollowSpawn(ea.x,ea.y,Ga)}}else Se.position.set(Ie.centerX,-Ie.centerY),Se.rotation=-Ie.rootRotation*Math.PI/180,Se.setSimulationTransform(Ie.centerX,Ie.centerY,Ie.rootRotation);const Gt=Ie.shape==="path"&&Ie.spawnPathId>0&&e.paths.find(ei=>ei.id===Ie.spawnPathId&&ei.enabled&&ei.points.length>0)||null;Se.setSpawnPathSampler(Gt?ei=>$a(Ie,Gt,ei):null,(Gt==null?void 0:Gt.closed)===!0),ne.set(Qe.id,Jt)}let be=0;const Le=[],Ce=e.settings.showBones&&e.activeObjectType==="particle"?e.activeObjectId:0,Be=(Qe,Se,Je)=>{!Qe||Qe.id!==Ce||Qe.visible===!1||on(Le,Je,Se.position.x,Se.position.y)},Te=e.timeline,Ye=Te.fps,nt=1/Math.max(1,Ye);let Ze=D,rt=0;if(Te.playing?(B+=Y,rt=Math.floor(B/nt),rt>0&&(B-=rt*nt)):B=0,Te.playing&&rt>0)for(let Qe=0;Qe<rt;Qe++)if(Ze=Te.frame,Le.length=0,be=0,Te.recorded){for(const Jt of e.systems){const Mi=V.get(Jt.id),$=(ie=Jt.frames)==null?void 0:ie[Te.frame];if(Mi&&$){Mi.apply($);for(const S of $)S.active&&(Be(Jt,Mi,S),be++)}}Te.frame++;const Se=e.systems.find(Jt=>Jt.id===e.activeId),Je=(Se==null?void 0:Se.config.mode)==="stream"&&Se.config.streamBehavior==="loop"?v1(Se.config,Ye):null,Ft=Te.loop&&(Je==null?void 0:Je.start)===Te.playbackStart&&Je.end===Te.playbackEnd?Te.playbackEnd-1:Te.playbackEnd;if(Te.frame>Ft)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 Je=V.get(Se.id);Je&&(Se.config.mode==="stream"&&Se.config.streamBehavior==="loop"?nR(Se,Je,Ye,Te.totalFrames):Je.reset())}for(const[Se,Je]of V){const Ie=e.systems.find(S=>S.id===Se),Ft=(Ie==null?void 0:Ie.config.mode)==="stream"&&Ie.config.streamBehavior==="loop",Jt=Ft?(J=Ie.frames)==null?void 0:J[Te.frame]:void 0,Mi=Te.frame===0&&!Ft,$=Mi?[]:Jt||Je.update(nt);if(Mi?Je.apply([]):Jt&&Je.apply(Jt),(Ie==null?void 0:Ie.visible)!==!1)for(const S of $)S.active&&Be(Ie,Je,S);be+=$.length}for(const Se of e.systems){if(!Se.config.texture)continue;Se.frames=Se.frames||[];const Je=V.get(Se.id);Je&&!(Se.config.mode==="stream"&&Se.config.streamBehavior==="loop")&&(Se.frames[Te.frame]=Je.capture())}Te.frame++,Te.frame>=Te.totalFrames&&(Te.frame=Te.playbackStart,Te.recorded=!0)}else{Te.playing||(Ze=Te.frame);for(const Qe of e.systems){const Se=V.get(Qe.id),Je=Te.playing?D:Te.frame,Ie=(ue=Qe.frames)==null?void 0:ue[Je],Ft=Qe.config.mode==="stream"&&Qe.config.streamBehavior==="loop"&&!!Ie;if((Te.recorded||Ft)&&Se&&Ie){Se.apply(Ie);for(const Jt of Ie)Jt.active&&(Be(Qe,Se,Jt),be++)}else if(Se){const Jt=Te.frame===0?[]:Se.update(0);if(Te.frame===0&&Se.apply([]),Qe.visible!==!1)for(const Mi of Jt)Mi.active&&Be(Qe,Se,Mi);be+=Se.activeCount}}}D=Ze,O==null||O.sync(e.spines,Ze,Ye);for(const[,Qe]of V)Qe.drawTrailMeshDebug(e.settings.showSkinMesh);Ns(),ln(),Ms(),St(),Ds(),Li(),Ts(),qr(),Kr(Le),i.value&&(i.value.systems=e.systems.length,i.value.particles=be)}}return Da(async()=>{window.addEventListener("keydown",Ae);const W=t.value;f=new $b({width:W.clientWidth||800,height:W.clientHeight||600,backgroundAlpha:0,antialias:!0}),W.appendChild(f.view),we(),cs(()=>e.settings.backgroundImageData,z,{immediate:!0}),await me();const Y=X;for(const J of e.systems){J.config.texture=Y;const ie=Gr(J.config);if(N)for(const ue of ie.trailResources)!ue.texture&&(ue.previewUrl==="/images/trail.png"||ue.previewUrl==="/trails/trail.png")&&(ue.texture=N);for(const ue of ie.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,B=0,D=0,e.timeline.playing=!0,e.timeline.loop=!0;for(const J of e.systems)J.frames=[];e.recalcTotalFrames(),U=performance.now()/1e3,Qr(),cs(()=>e.systems.map(J=>JSON.stringify(J.config,(ie,ue)=>ie==="texture"||ie==="trailTexture"||ie==="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 J of e.systems)J.frames=[];e.timeline.playing=!0,e.timeline.loop=!0}),jP(e)}),Gl(()=>{window.removeEventListener("keydown",Ae),cancelAnimationFrame(_),O==null||O.destroy(),O=null,v++,g&&g.destroy(!0),g=null,m=null,f&&(f.destroy(!0,{children:!0}),f=null)}),(W,Y)=>(te(),oe("div",KP,[E("div",{ref_key:"holder",ref:t,class:ot(["stage-holder",{grid:ke(e).settings.showGrid}]),tabindex:"0",onWheel:yt(re,["prevent"]),onPointerdown:ye,onDblclick:yt(bt,["prevent"])},null,34),E("div",ZP,[E("button",{class:"settings-btn",onClick:H,title:"系统设置"},"系统设置"),E("button",{class:"undo-btn",disabled:ke(Iu).undoCount===0,onClick:Y[0]||(Y[0]=(...J)=>ke(Tf)&&ke(Tf)(...J)),title:"撤回上一步 (Ctrl+Z)"},"↶",8,JP),E("div",QP,[E("button",{class:ot(["tool-btn",{on:l.value===""}]),onClick:Y[1]||(Y[1]=J=>u("")),title:"拖动画布 (Q)"},"✋",2),E("button",{class:ot(["tool-btn",{on:l.value==="translate"}]),onClick:Y[2]||(Y[2]=J=>u("translate")),title:"位移 (W)"},"✥",2),E("button",{class:ot(["tool-btn",{on:l.value==="rotate"}]),onClick:Y[3]||(Y[3]=J=>u("rotate")),title:"旋转 (E)"},"⟳",2),E("button",{class:ot(["tool-btn",{on:l.value==="scale"}]),onClick:Y[4]||(Y[4]=J=>u("scale")),title:"缩放 (R)"},"⤢",2)]),E("div",ek,[E("button",{class:"tool-btn",onClick:an,title:"放大"},"+"),E("button",{class:"tool-btn",onClick:xi,title:"缩小"},"-"),E("button",{class:"tool-btn",onClick:fe,title:"适配画布"},"⤢"),E("button",{class:ot(["tool-btn",{on:ke(e).settings.showGrid}]),onClick:Rt,title:"切换网格"},"▦",2),E("button",{class:"tool-btn",onClick:It,title:"重置视图"},"⟳")]),E("div",{class:"background-menu",onClick:Y[10]||(Y[10]=yt(()=>{},["stop"]))},[E("button",{class:ot(["background-btn",{on:r.value}]),title:"背景图显示设置",onClick:Re},"背景图",2),r.value?(te(),oe("div",tk,[E("button",{class:"background-upload",onClick:Y[5]||(Y[5]=J=>{var ie;return(ie=o.value)==null?void 0:ie.click()})},je(h.value?"更换图像":"上传图像"),1),E("button",{class:"background-clear",disabled:!h.value,onClick:Y[6]||(Y[6]=J=>ee())},"清除背景",8,ik),E("input",{ref_key:"backgroundFileInput",ref:o,class:"background-file-input",type:"file",accept:"image/png,image/jpeg,image/webp",onChange:q},null,544),E("div",{class:"background-file-name",title:h.value},je(h.value||"未上传图像"),9,sk),E("div",nk,[E("label",null,[Y[28]||(Y[28]=E("span",null,"X",-1)),xe(E("input",{"onUpdate:modelValue":Y[7]||(Y[7]=J=>ke(e).settings.backgroundX=J),type:"number",step:"1","aria-label":"背景图 X 偏移"},null,512),[[ct,ke(e).settings.backgroundX,void 0,{number:!0}]])]),E("label",null,[Y[29]||(Y[29]=E("span",null,"Y",-1)),xe(E("input",{"onUpdate:modelValue":Y[8]||(Y[8]=J=>ke(e).settings.backgroundY=J),type:"number",step:"1","aria-label":"背景图 Y 偏移"},null,512),[[ct,ke(e).settings.backgroundY,void 0,{number:!0}]])])]),E("label",rk,[Y[30]||(Y[30]=E("span",null,"透明度",-1)),xe(E("input",{"onUpdate:modelValue":Y[9]||(Y[9]=J=>ke(e).settings.backgroundOpacity=J),type:"range",min:"0",max:"1",step:"0.01","aria-label":"背景图透明度"},null,512),[[ct,ke(e).settings.backgroundOpacity,void 0,{number:!0}]]),E("b",null,je(Math.round(ke(e).settings.backgroundOpacity*100))+"%",1)])])):Ue("",!0)]),E("button",{class:ot(["help-btn",{on:a.value}]),title:"查看使用说明",onClick:ge},"使用说明",2),E("span",ak,je(Math.round(ke(e).editor.viewScale*100))+"%",1)]),n.value?(te(),oe("div",ok,[E("div",lk,[Y[31]||(Y[31]=ai("系统设置 ",-1)),E("button",{class:"sp-close",onClick:Y[11]||(Y[11]=J=>n.value=!1)},"✕")]),Y[45]||(Y[45]=E("div",{class:"sp-section-title"},"界面布局",-1)),E("label",ck,[Y[33]||(Y[33]=E("span",null,"参数面板位置",-1)),E("span",hk,[xe(E("input",{type:"checkbox","onUpdate:modelValue":Y[12]||(Y[12]=J=>ke(e).settings.parameterPanelOnRight=J),"aria-label":"参数面板显示在右侧"},null,512),[[ti,ke(e).settings.parameterPanelOnRight]]),Y[32]||(Y[32]=E("span",{class:"sp-switch-ui","aria-hidden":"true"},null,-1)),E("b",null,je(ke(e).settings.parameterPanelOnRight?"右侧":"左侧"),1)])]),Y[46]||(Y[46]=E("div",{class:"sp-divider"},null,-1)),Y[47]||(Y[47]=E("div",{class:"sp-section-title"},"操作历史",-1)),E("label",uk,[Y[34]||(Y[34]=E("span",null,"最大撤回步数",-1)),xe(E("input",{class:"sp-num sp-undo-limit",type:"number",min:"1",max:"200","onUpdate:modelValue":Y[13]||(Y[13]=J=>ke(e).settings.undoLimit=J),"aria-label":"最大撤回步数",onChange:K},null,544),[[ct,ke(e).settings.undoLimit,void 0,{number:!0}]])]),Y[48]||(Y[48]=E("div",{class:"sp-divider"},null,-1)),Y[49]||(Y[49]=E("div",{class:"sp-section-title"},"画布辅助显示",-1)),E("label",dk,[xe(E("input",{type:"checkbox","onUpdate:modelValue":Y[14]||(Y[14]=J=>ke(e).settings.showEmitter=J)},null,512),[[ti,ke(e).settings.showEmitter]]),Y[35]||(Y[35]=ai("发射点",-1))]),E("label",fk,[xe(E("input",{type:"checkbox","onUpdate:modelValue":Y[15]||(Y[15]=J=>ke(e).settings.showBones=J)},null,512),[[ti,ke(e).settings.showBones]]),Y[36]||(Y[36]=ai("骨骼连线",-1))]),ke(e).settings.showBones?(te(),oe(Ke,{key:0},[E("label",mk,[Y[37]||(Y[37]=E("span",null,"骨骼点绘制大小",-1)),xe(E("input",{class:"sp-num",type:"number",min:"0.1",max:"10",step:"0.1","onUpdate:modelValue":Y[16]||(Y[16]=J=>ke(e).settings.bonePointDrawSize=J),"aria-label":"骨骼点绘制大小",onChange:d},null,544),[[ct,ke(e).settings.bonePointDrawSize,void 0,{number:!0}]])]),E("label",pk,[Y[38]||(Y[38]=E("span",null,"坐标轴绘制大小",-1)),xe(E("input",{class:"sp-num",type:"number",min:"0.1",max:"10",step:"0.1","onUpdate:modelValue":Y[17]||(Y[17]=J=>ke(e).settings.boneAxisDrawSize=J),"aria-label":"坐标轴绘制大小",onChange:d},null,544),[[ct,ke(e).settings.boneAxisDrawSize,void 0,{number:!0}]])])],64)):Ue("",!0),E("label",gk,[xe(E("input",{type:"checkbox","onUpdate:modelValue":Y[18]||(Y[18]=J=>ke(e).settings.showSkinMesh=J)},null,512),[[ti,ke(e).settings.showSkinMesh]]),Y[39]||(Y[39]=ai("蒙皮网格",-1))]),Y[50]||(Y[50]=E("div",{class:"sp-divider"},null,-1)),E("label",vk,[xe(E("input",{type:"checkbox","onUpdate:modelValue":Y[19]||(Y[19]=J=>ke(e).settings.tickEnabled=J)},null,512),[[ti,ke(e).settings.tickEnabled]]),Y[40]||(Y[40]=ai("启用刻度",-1))]),ke(e).settings.tickEnabled?(te(),oe(Ke,{key:1},[E("label",yk,[Y[41]||(Y[41]=E("span",null,"刻度文字大小",-1)),xe(E("input",{type:"range",min:"8",max:"40",step:"1","onUpdate:modelValue":Y[20]||(Y[20]=J=>ke(e).settings.axisFontSize=J)},null,512),[[ct,ke(e).settings.axisFontSize,void 0,{number:!0}]]),xe(E("input",{type:"number",min:"8",max:"40","onUpdate:modelValue":Y[21]||(Y[21]=J=>ke(e).settings.axisFontSize=J),class:"sp-num"},null,512),[[ct,ke(e).settings.axisFontSize,void 0,{number:!0}]])]),E("label",xk,[Y[42]||(Y[42]=E("span",null,"刻度线粗细",-1)),xe(E("input",{type:"range",min:"1",max:"5",step:"0.5","onUpdate:modelValue":Y[22]||(Y[22]=J=>ke(e).settings.tickWidth=J)},null,512),[[ct,ke(e).settings.tickWidth,void 0,{number:!0}]]),xe(E("input",{type:"number",min:"1",max:"5","onUpdate:modelValue":Y[23]||(Y[23]=J=>ke(e).settings.tickWidth=J),class:"sp-num"},null,512),[[ct,ke(e).settings.tickWidth,void 0,{number:!0}]])]),E("label",bk,[Y[43]||(Y[43]=E("span",null,"坐标轴颜色",-1)),xe(E("input",{type:"color","onUpdate:modelValue":Y[24]||(Y[24]=J=>ke(e).settings.axisColor=J),class:"sp-colr"},null,512),[[ct,ke(e).settings.axisColor]]),E("span",wk,je(ke(e).settings.axisColor),1)]),E("label",Sk,[xe(E("input",{type:"checkbox","onUpdate:modelValue":Y[25]||(Y[25]=J=>ke(e).settings.showAxisLabels=J)},null,512),[[ti,ke(e).settings.showAxisLabels]]),Y[44]||(Y[44]=ai("显示刻度数值",-1))])],64)):Ue("",!0),Y[51]||(Y[51]=E("div",{class:"sp-cache-note"},"整个系统设置会自动保存到当前浏览器",-1))])):Ue("",!0),a.value?(te(),oe("div",{key:1,class:"help-overlay",role:"presentation",onClick:Y[27]||(Y[27]=yt(J=>a.value=!1,["self"]))},[E("section",_k,[E("header",Mk,[Y[52]||(Y[52]=E("div",null,[E("h2",{id:"help-title"},"使用说明"),E("p",null,"从创建粒子到保存、导出的快速入门")],-1)),E("button",{class:"help-close","aria-label":"关闭使用说明",title:"关闭 (Esc)",onClick:Y[26]||(Y[26]=J=>a.value=!1)},"✕")]),Y[53]||(Y[53]=to('<div class="help-body" data-v-94c32e62><section class="help-section help-start" data-v-94c32e62><h3 data-v-94c32e62>快速开始</h3><ol data-v-94c32e62><li data-v-94c32e62><b data-v-94c32e62>创建对象:</b>在左侧“场景对象”中添加粒子、碰撞、路径或 Spine。</li><li data-v-94c32e62><b data-v-94c32e62>编辑粒子:</b>选中粒子系统,依次调整发射、形状、属性、外观资源和修改器。</li><li data-v-94c32e62><b data-v-94c32e62>查看效果:</b>使用底部时间轴播放、暂停或拖动到指定帧;修改参数后会自动重新计算。</li><li data-v-94c32e62><b data-v-94c32e62>保存成果:</b>配置文件用于继续编辑;“导出 Spine Json”支持 Spine 3.8、4.0、4.1、4.2 和 4.3。</li></ol></section><div class="help-grid" data-v-94c32e62><section class="help-section" data-v-94c32e62><h3 data-v-94c32e62>常用功能</h3><dl class="help-list" data-v-94c32e62><div data-v-94c32e62><dt data-v-94c32e62>小眼睛</dt><dd data-v-94c32e62>单独显示或隐藏场景对象;隐藏的粒子系统不会导出。</dd></div><div data-v-94c32e62><dt data-v-94c32e62>+Copy</dt><dd data-v-94c32e62>完整复制当前选中对象,方便对比不同参数效果。</dd></div><div data-v-94c32e62><dt data-v-94c32e62>背景图</dt><dd data-v-94c32e62>上传参考图并调整位置和透明度,只用于画布预览。</dd></div><div data-v-94c32e62><dt data-v-94c32e62>系统设置</dt><dd data-v-94c32e62>管理界面与辅助显示,并自动保存在当前浏览器中。</dd></div><div data-v-94c32e62><dt data-v-94c32e62>配置管理</dt><dd data-v-94c32e62>保存当前项目数据、加载配置,或直接使用预设文件;不包含系统设置。</dd></div><div data-v-94c32e62><dt data-v-94c32e62>Spine 骨骼</dt><dd data-v-94c32e62>在层级树搜索并选择骨骼,可用于粒子发射器跟随。</dd></div></dl></section><section class="help-section" data-v-94c32e62><h3 data-v-94c32e62>快捷键</h3><div class="shortcut-list" data-v-94c32e62><div data-v-94c32e62><kbd data-v-94c32e62>Ctrl/⌘</kbd><span data-v-94c32e62>+</span><kbd data-v-94c32e62>Z</kbd><em data-v-94c32e62>撤回上一步</em></div><div data-v-94c32e62><kbd data-v-94c32e62>Ctrl/⌘</kbd><span data-v-94c32e62>+</span><kbd data-v-94c32e62>S</kbd><em data-v-94c32e62>保存配置</em></div><div data-v-94c32e62><kbd data-v-94c32e62>Q</kbd><em data-v-94c32e62>拖动画布</em></div><div data-v-94c32e62><kbd data-v-94c32e62>W</kbd><em data-v-94c32e62>位移工具</em></div><div data-v-94c32e62><kbd data-v-94c32e62>E</kbd><em data-v-94c32e62>旋转工具</em></div><div data-v-94c32e62><kbd data-v-94c32e62>R</kbd><em data-v-94c32e62>缩放工具</em></div><div data-v-94c32e62><kbd data-v-94c32e62>D</kbd><em data-v-94c32e62>播放 / 暂停</em></div><div data-v-94c32e62><kbd data-v-94c32e62>S</kbd><em data-v-94c32e62>回到第一帧</em></div></div><p class="help-note" data-v-94c32e62>Q / W / E / R 需要先点击画布。光标位于输入框时,单键快捷键不会触发。</p></section></div><section class="help-section help-export" data-v-94c32e62><h3 data-v-94c32e62>配置与导出有什么区别?</h3><p data-v-94c32e62><b data-v-94c32e62>保存配置</b>会保存编辑器中的全部对象和参数,之后可以继续修改;<b data-v-94c32e62>导出 Spine Json</b>只导出显示中的粒子系统,并把跟随、碰撞和拖尾结果烘焙为独立动画数据。</p></section></div>',1))])])):Ue("",!0),i.value?(te(),oe("div",Tk,[Y[54]||(Y[54]=ai(" 系统: ",-1)),E("b",Ak,je(i.value.systems),1),Y[55]||(Y[55]=ai(" · 粒子(骨骼): ",-1)),E("b",Ek,je(i.value.particles),1),Y[56]||(Y[56]=ai(" · 根骨骼: ",-1)),Y[57]||(Y[57]=E("b",null,"root",-1)),Y[58]||(Y[58]=E("span",{class:"hud-tip"},"滚轮缩放 · 左键拖动画布",-1))])):Ue("",!0)]))}}),rn=(s,e)=>{const t=s.__vccOpts||s;for(const[i,n]of e)t[i]=n;return t},Ik=rn(Ck,[["__scopeId","data-v-94c32e62"]]),Rk={class:"ns-label"},Pk=["min","max","step","value","disabled"],kk=["min","max","step","value","disabled"],Fk=sn({__name:"NumSlider",props:{label:{},modelValue:{},min:{},max:{},step:{},disabled:{type:Boolean}},emits:["update:modelValue"],setup(s,{emit:e}){const t=s,i=e,n=ht(String(t.modelValue));cs(()=>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)=>(te(),oe("div",{class:ot(["ns",{disabled:s.disabled}])},[E("span",Rk,je(s.label),1),E("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,Pk),E("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,kk)],2))}}),qe=rn(Fk,[["__scopeId","data-v-7c2fbed0"]]),Ok={class:"ce"},Bk={class:"ce-editor"},Lk={class:"ce-grid"},Dk=["x1","x2","y2"],Nk=["y1","x2","y2"],Uk=["x","y","width","height"],Xk=["d"],Vk={key:0,class:"ce-handles"},Yk=["x1","y1","x2","y2"],$k=["cx","cy","onPointerdown"],Gk=["x1","y1","x2","y2"],Hk=["cx","cy","onPointerdown"],jk=["cx","cy"],Wk=["cx","cy","onPointerdown","onDblclick"],zk={class:"ce-nav"},qk={class:"ce-tip"},br=8,Kk=sn({__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=ht(null),r=ht(300),a=ht(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 br+I*(r.value-br*2)}function c(I){return br+(1-I)*(a.value-br*2)}function u(){return[...t.modelValue].sort((I,k)=>I.x-k.x)}function d(I){i("update:modelValue",[...I].sort((k,O)=>k.x-O.x))}function f(){d(t.defaultValue.map(I=>({...I})))}const p=pt(()=>u());function m(I){const k=p.value[I],O=p.value[Math.max(0,I-1)];return{x:k.x-(k.x-O.x)/3,y:k.y-(k.y-O.y)/3}}function g(I){const k=p.value[I],O=p.value[Math.min(p.value.length-1,I+1)];return{x:k.x+(O.x-k.x)/3,y:k.y+(O.y-k.y)/3}}function v(I){const k=p.value[I],O=m(I);return{x:k.x+(k.inX??O.x-k.x),y:k.y+(k.inY??O.y-k.y)}}function b(I){const k=p.value[I],O=g(I);return{x:k.x+(k.outX??O.x-k.x),y:k.y+(k.outY??O.y-k.y)}}const y=pt(()=>{if(!p.value.length)return"";let I=`M ${l(p.value[0].x)} ${c(p.value[0].y)}`;for(let k=1;k<p.value.length;k++){const O=p.value[k];if(t.mode==="bezier"){const L=b(k-1),U=v(k);I+=` C ${l(L.x)} ${c(L.y)} ${l(U.x)} ${c(U.y)} ${l(O.x)} ${c(O.y)}`}else I+=` L ${l(O.x)} ${c(O.y)}`}return I});function w(I,k){const O=n.value.getBoundingClientRect(),L=(I-O.left-br)/(r.value-br*2),U=(k-O.top-br)/(a.value-br*2);return{x:Math.min(1,Math.max(0,Math.round(L*100)/100)),y:Math.min(1,Math.max(0,Math.round((1-U)*100)/100))}}let A=0;function T(I){if(I.target.classList.contains("ce-hit")||Date.now()-A<400)return;const{x:k,y:O}=w(I.clientX,I.clientY),L=u().filter(U=>Math.abs(U.x-k)>.02);L.push({x:k,y:O}),d(L)}let M={t:0,i:-1,x:0,y:0};function R(I,k){I.stopPropagation();const O=u().findIndex(D=>Math.abs(D.x-p.value[k].x)<1e-6&&Math.abs(D.y-p.value[k].y)<1e-6);if(O<0)return;const L=Date.now();if(L-M.t<300&&M.i===k&&Math.abs(I.clientX-M.x)<8&&Math.abs(I.clientY-M.y)<8){M={t:0,i:-1,x:0,y:0},F(k);return}M={t:L,i:k,x:I.clientX,y:I.clientY};const U=D=>{(Math.abs(D.clientX-I.clientX)>8||Math.abs(D.clientY-I.clientY)>8)&&(M={t:0,i:-1,x:0,y:0});const{x:_,y:X}=w(D.clientX,D.clientY),N=u();N[O]={x:_,y:X},d(N)},B=()=>{window.removeEventListener("pointermove",U),window.removeEventListener("pointerup",B)};window.addEventListener("pointermove",U),window.addEventListener("pointerup",B)}function P(I,k,O){I.stopPropagation();const L=B=>{const D=w(B.clientX,B.clientY),_=u(),X=_[k],N=O==="in"?_[Math.max(0,k-1)].x:X.x,V=O==="in"?X.x:_[Math.min(_.length-1,k+1)].x,G=Math.min(V,Math.max(N,D.x)),j=Math.round((G-X.x)*100)/100,ne=Math.round((D.y-X.y)*100)/100;_[k]=O==="in"?{...X,inX:j,inY:ne}:{...X,outX:j,outY:ne},d(_)},U=()=>{window.removeEventListener("pointermove",L),window.removeEventListener("pointerup",U)};window.addEventListener("pointermove",L),window.addEventListener("pointerup",U)}function F(I,k){k==null||k.stopPropagation();const O=u();O.length<=2||(A=Date.now(),d(O.filter((L,U)=>U!==I)))}return Da(()=>{h(),o=new ResizeObserver(h),n.value&&o.observe(n.value)}),Gl(()=>{o==null||o.disconnect()}),(I,k)=>(te(),oe("div",Ok,[E("div",Bk,[(te(),oe("svg",{ref_key:"svg",ref:n,class:"ce-svg",onDblclick:T},[E("g",Lk,[(te(),oe(Ke,null,ci([.25,.5,.75],O=>E("line",{key:"v"+O,x1:l(O),y1:"0",x2:l(O),y2:c(0)},null,8,Dk)),64)),(te(),oe(Ke,null,ci([.25,.5,.75],O=>E("line",{key:"h"+O,x1:"0",y1:c(O),x2:l(1),y2:c(O)},null,8,Nk)),64))]),E("rect",{x:l(0),y:c(1),width:l(1)-l(0),height:c(0)-c(1),class:"ce-frame",fill:"none"},null,8,Uk),E("path",{d:y.value,class:"ce-line",fill:"none"},null,8,Xk),s.mode==="bezier"?(te(),oe("g",Vk,[(te(!0),oe(Ke,null,ci(p.value,(O,L)=>(te(),oe(Ke,{key:"handles-"+L},[L>0?(te(),oe("line",{key:0,x1:l(O.x),y1:c(O.y),x2:l(v(L).x),y2:c(v(L).y)},null,8,Yk)):Ue("",!0),L>0?(te(),oe("circle",{key:1,cx:l(v(L).x),cy:c(v(L).y),r:"4",onPointerdown:U=>P(U,L,"in")},null,40,$k)):Ue("",!0),L<p.value.length-1?(te(),oe("line",{key:2,x1:l(O.x),y1:c(O.y),x2:l(b(L).x),y2:c(b(L).y)},null,8,Gk)):Ue("",!0),L<p.value.length-1?(te(),oe("circle",{key:3,cx:l(b(L).x),cy:c(b(L).y),r:"4",onPointerdown:U=>P(U,L,"out")},null,40,Hk)):Ue("",!0)],64))),128))])):Ue("",!0),(te(!0),oe(Ke,null,ci(p.value,(O,L)=>(te(),oe("g",{key:L},[E("circle",{cx:l(O.x),cy:c(O.y),r:"5",class:"ce-node"},null,8,jk),E("circle",{cx:l(O.x),cy:c(O.y),r:"9",class:"ce-hit",onPointerdown:U=>R(U,L),onDblclick:U=>F(L,U)},null,40,Wk)]))),128))],544)),E("div",zk,[E("span",qk,je(s.mode==="bezier"?"拖动方形手柄调整弧度·双击空白新建·双击节点删除":"双击空白新建·双击节点删除·拖动节点调整"),1)])]),E("button",{class:"ce-reset",type:"button",title:"恢复默认曲线",onClick:f},"重置")]))}}),gn=rn(Kk,[["__scopeId","data-v-9bfb7b31"]]),Zk={class:"pac"},Jk={class:"pac-head"},Qk={class:"pac-label"},eF={key:0,class:"pac-modes"},tF=["onClick"],iF={class:"pac-range"},sF={class:"pac-curve"},nF={class:"pac-axis"},rF=sn({__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=pt(()=>{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)=>(te(),oe("div",Zk,[E("div",Jk,[E("span",Qk,je(s.label),1),s.showModes?(te(),oe("div",eF,[(te(!0),oe(Ke,null,ci(t.value,r=>(te(),oe("button",{key:r.value,class:ot(["pac-mode",{on:s.mode===r.value}]),onClick:a=>i.$emit("update:mode",r.value)},je(r.label),11,tF))),128))])):Ue("",!0)]),s.mode==="fixed"||s.mode==="direction"?(te(),Qt(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"?(te(),oe(Ke,{key:1},[Ne(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"]),Ne(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)):(te(),oe(Ke,{key:2},[E("div",iF,[Ne(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"]),Ne(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"])]),E("div",sF,[Ne(gn,{"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"]),E("div",nF,[n[6]||(n[6]=E("span",null,"0",-1)),E("span",null,je(s.curveLabel),1),n[7]||(n[7]=E("span",null,"1",-1))])])],64))]))}}),$n=rn(rF,[["__scopeId","data-v-238f838c"]]),aF={class:"gradient-editor"},oF=["title","onClick","onDblclick","onPointerdown"],lF={key:0,class:"gradient-controls"},cF=["value"],hF=["value"],uF={class:"gradient-position"},dF=["value"],fF=["disabled"],mF=sn({__name:"ColorGradientEditor",props:{modelValue:{}},emits:["update:modelValue"],setup(s,{emit:e}){const t=s,i=e,n=ht(null),r=ht(0),a=pt(()=>t.modelValue[r.value]||null),o=pt(()=>[...t.modelValue].sort((R,P)=>R.position-P.position)),h=pt(()=>{const R=o.value;return R.length?`linear-gradient(90deg, ${R.map(P=>`${P.color} ${l(P.position)*100}%`).join(", ")})`:"#ffffff"});cs(()=>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=M(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;I<R.length-1;I++){const k=R[I+1].position-R[I].position;k>F&&(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 O=n.value.getBoundingClientRect();u(P,{position:l((k.clientX-O.left)/Math.max(1,O.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;I<F.length-1;I++){const k=F[I],O=F[I+1];if(P<k.position||P>O.position)continue;const L=(P-k.position)/Math.max(1e-4,O.position-k.position);return T(k.color,O.color,L)}return F[F.length-1].color}function T(R,P,F){const I=U=>{const B=parseInt(U.replace("#","").padEnd(6,"0").slice(0,6),16);return[B>>16&255,B>>8&255,B&255]},k=I(R),O=I(P),L=U=>Math.round(k[U]+(O[U]-k[U])*F);return`#${[L(0),L(1),L(2)].map(U=>U.toString(16).padStart(2,"0")).join("")}`}function M(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)=>(te(),oe("div",aF,[E("div",{ref_key:"bar",ref:n,class:"gradient-bar",style:Ni({background:h.value}),title:"双击色带添加色标",onDblclick:v},[(te(!0),oe(Ke,null,ci(s.modelValue,(F,I)=>(te(),oe("button",{key:I,type:"button",class:ot(["gradient-stop",{selected:I===r.value}]),style:Ni({left:`${l(F.position)*100}%`,"--stop-color":F.color}),title:`${Math.round(l(F.position)*100)}% · ${F.color}`,onClick:yt(k=>r.value=I,["stop"]),onDblclick:yt(k=>y(I),["stop"]),onPointerdown:yt(k=>w(k,I),["stop"])},null,46,oF))),128))],36),a.value?(te(),oe("div",lF,[E("input",{type:"color",class:"gradient-color",value:a.value.color,"aria-label":"色标颜色",onInput:d},null,40,cF),E("input",{type:"text",class:"gradient-hex-input",value:a.value.color,"aria-label":"色标颜色值",spellcheck:"false",onChange:f,onKeydown:Aa(p,["enter"])},null,40,hF),E("label",uF,[E("input",{type:"number",min:"0",max:"100",step:"1",value:Math.round(l(a.value.position)*100),"aria-label":"色标位置",onInput:m},null,40,dF),P[1]||(P[1]=E("span",null,"%",-1))]),E("button",{type:"button",class:"gradient-action",title:"在中间新增颜色",onClick:b},"+"),E("button",{type:"button",class:"gradient-action danger",title:"删除当前色标",disabled:s.modelValue.length<=2,onClick:P[0]||(P[0]=F=>y(r.value))},"×",8,fF)])):Ue("",!0),P[2]||(P[2]=E("div",{class:"gradient-hint"},"双击色带新增 · 拖动色标调整位置 · 双击色标删除",-1))]))}}),zv=rn(mF,[["__scopeId","data-v-f6ab10bf"]]),pF={class:"image-card"},gF={class:"imgrow"},vF=["title"],yF=["src","alt"],xF={key:1,viewBox:"0 0 24 24",width:"22",height:"22",fill:"none",stroke:"#8a93bb","stroke-width":"1.6"},bF={class:"img-fields"},wF={key:0,class:"row"},SF={class:"row"},_F=["placeholder"],MF={class:"img-actions"},TF=["title"],AF=["disabled"],EF={class:"thumb-note"},CF={key:0,class:"row"},IF={class:"row"},RF={class:"row"},PF={class:"sequence-note"},kF={class:"resource-weight-row"},FF=["disabled","title"],OF={key:0,viewBox:"0 0 24 24","aria-hidden":"true"},BF={key:1,viewBox:"0 0 24 24","aria-hidden":"true"},LF=sn({__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=pt(()=>{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=pt(()=>{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=pt(()=>{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)=>(te(),oe("div",pF,[E("div",gF,[E("button",{class:"img-thumb",title:s.supportsSequence&&s.resource.imageMode==="sequence"?"选择序列帧图片":"选择本地图片",onClick:o},[r.value?(te(),oe("img",{key:0,src:r.value,alt:s.resource.textureName},null,8,yF)):(te(),oe("svg",xF,[...l[10]||(l[10]=[E("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"},null,-1),E("circle",{cx:"8.5",cy:"8.5",r:"1.6"},null,-1),E("path",{d:"M21 15l-5-5-9 9"},null,-1)])]))],8,vF),E("div",bF,[s.showFolder?(te(),oe("label",wF,[l[11]||(l[11]=E("span",null,"子文件夹",-1)),xe(E("input",{"onUpdate:modelValue":l[0]||(l[0]=c=>s.resource.textureFolder=c),type:"text",class:"inp",placeholder:"subfolder/"},null,512),[[ct,s.resource.textureFolder]])])):Ue("",!0),E("label",SF,[l[12]||(l[12]=E("span",null,"名称",-1)),xe(E("input",{"onUpdate:modelValue":l[1]||(l[1]=c=>s.resource.textureName=c),type:"text",class:"inp",placeholder:s.namePlaceholder},null,8,_F),[[ct,s.resource.textureName]])])]),E("div",MF,[E("button",{class:"mini-btn2",title:`恢复 ${s.defaultFile}`,onClick:l[2]||(l[2]=c=>h.$emit("reset",s.resource.id))},"⟳",8,TF),E("button",{class:"mini-btn2",title:"删除图片资源",disabled:s.resourceCount===1,onClick:l[3]||(l[3]=c=>h.$emit("remove",s.resource.id))},"🗑",8,AF)])]),E("div",EF,je(n.value),1),s.supportsSequence?(te(),oe("label",CF,[l[14]||(l[14]=E("span",null,"图片模式",-1)),xe(E("select",{"onUpdate:modelValue":l[4]||(l[4]=c=>s.resource.imageMode=c),class:"inp"},[...l[13]||(l[13]=[E("option",{value:"fixed"},"固定",-1),E("option",{value:"sequence"},"序列帧",-1)])],512),[[jt,s.resource.imageMode]])])):Ue("",!0),s.supportsSequence&&s.resource.imageMode==="sequence"?(te(),oe(Ke,{key:1},[E("label",IF,[l[16]||(l[16]=E("span",null,"播放模式",-1)),xe(E("select",{"onUpdate:modelValue":l[5]||(l[5]=c=>s.resource.sequencePlayback=c),class:"inp"},[...l[15]||(l[15]=[E("option",{value:"once-hide"},"单次-尾帧消失",-1),E("option",{value:"once-hold"},"单次-尾帧固定",-1),E("option",{value:"loop-forward"},"正向循环",-1),E("option",{value:"loop-reverse"},"反向循环",-1)])],512),[[jt,s.resource.sequencePlayback]])]),E("label",RF,[l[17]||(l[17]=E("span",null,"播放帧率",-1)),xe(E("input",{"onUpdate:modelValue":l[6]||(l[6]=c=>s.resource.sequenceFps=c),type:"number",min:"1",max:"120",step:"1",class:"inp"},null,512),[[ct,s.resource.sequenceFps,void 0,{number:!0}]])]),E("button",{class:"sequence-pick",onClick:l[7]||(l[7]=c=>h.$emit("pickSequence",s.resource.id))},"选择序列帧(多选)"),E("div",PF,je(a.value),1)],64)):Ue("",!0),E("div",kF,[Ne(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"]),E("button",{class:ot(["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?(te(),oe("svg",OF,[...l[18]||(l[18]=[E("rect",{x:"5",y:"10",width:"14",height:"10",rx:"2"},null,-1),E("path",{d:"M8 10V7a4 4 0 0 1 8 0v3"},null,-1)])])):(te(),oe("svg",BF,[...l[19]||(l[19]=[E("rect",{x:"5",y:"10",width:"14",height:"10",rx:"2"},null,-1),E("path",{d:"M16 10V7a4 4 0 0 0-7.5-2"},null,-1)])]))],10,FF)]),V_(h.$slots,"default",{},void 0)]))}}),qv=rn(LF,[["__scopeId","data-v-68ff5314"]]),DF={class:"spine-editor"},NF={class:"field wide"},UF={class:"grid three"},XF={class:"field"},VF={class:"field"},YF={class:"field"},$F={class:"grid three"},GF={class:"field"},HF={class:"field"},jF={class:"field"},WF=["disabled"],zF={class:"asset-row"},qF=["title"],KF={class:"asset-row"},ZF=["title"],JF={class:"asset-row"},QF=["title"],e3={class:"asset-actions"},t3=["disabled"],i3={class:"runtime-note"},s3={key:0},n3={key:0,class:"error"},r3={class:"section-box"},a3={key:0,class:"empty"},o3={key:1,class:"field wide"},l3=["value"],c3={class:"section-box"},h3={class:"tree-title-row"},u3=["disabled","title"],d3={key:0,class:"empty"},f3={key:1,class:"bone-search"},m3={key:2,class:"empty"},p3={key:3,class:"bone-tree"},g3=["onClick","onKeydown"],v3=["title","onClick"],y3={key:1,class:"bone-leaf"},x3={class:"bone-name"},b3=sn({__name:"SpineObjectPanel",props:{spineObject:{}},setup(s){const e=s,t=Kl(),i=ht(null),n=ht(null),r=ht(null),a=ht(null),o=ht(new Set),h=ht(""),l=ht(null),c=ht(null),u=ht([]);e.spineObject.selectedBone==null&&(e.spineObject.selectedBone=""),e.spineObject.sourceBundle==null&&(e.spineObject.sourceBundle=null),e.spineObject.dataVersion==null&&(e.spineObject.dataVersion="");const d=pt(()=>{var D;return((D=l.value)==null?void 0:D.name)||e.spineObject.skeletonFileName}),f=pt(()=>{var D;return((D=c.value)==null?void 0:D.name)||e.spineObject.atlasFileName}),p=pt(()=>u.value.length?u.value.map(D=>D.name):e.spineObject.textureFileNames),m=pt(()=>p.value.length?`${p.value.length} 张:${p.value.join(", ")}`:"PNG / JPEG / WebP..."),g=pt(()=>new Set(e.spineObject.bones.map(D=>D.parent).filter(D=>!!D))),v=pt(()=>new Map(e.spineObject.bones.map(D=>[D.name,D]))),b=pt(()=>e.spineObject.bones.filter(D=>{var N;const _=h.value.trim().toLocaleLowerCase();if(_)return D.name.toLocaleLowerCase().includes(_);let X=D.parent;for(;X;){if(o.value.has(X))return!1;X=((N=v.value.get(X))==null?void 0:N.parent)||null}return!0})),y=pt(()=>g.value.size>0&&[...g.value].every(D=>o.value.has(D)));function w(D){const _=e.spineObject.selectedBone===D;for(const X of t.spines)X.selectedBone="";_||(e.spineObject.selectedBone=D)}function A(D){o.value.has(D)?o.value.delete(D):o.value.add(D)}function T(){o.value=y.value?new Set:new Set(g.value)}function M(D){var _;return((_=D.target.files)==null?void 0:_[0])||null}function R(D){l.value=M(D)}function P(D){c.value=M(D)}function F(D){u.value=Array.from(D.target.files||[])}function I(D){return D.name.replace(/\.[^.]+$/,"").toLocaleLowerCase()}async function k(D){const _=Array.from(D.target.files||[]);if(!_.length)return;const X=_.filter(Q=>/\.(json|skel)$/i.test(Q.name)),N=_.filter(Q=>/\.atlas$/i.test(Q.name)),V=_.filter(Q=>/\.(png|jpe?g|webp|wepb)$/i.test(Q.name)),G=N.map(Q=>({atlas:Q,skeleton:X.find(de=>I(de)===I(Q))})).find(Q=>Q.skeleton),j=(G==null?void 0:G.skeleton)||X[0]||null,ne=(G==null?void 0:G.atlas)||N[0]||null;if(l.value=j,c.value=ne,u.value=V,!j||!ne||!V.length){const Q=[!j&&"JSON / SKEL",!ne&&"Atlas",!V.length&&"纹理图片"].filter(Boolean).join("、");e.spineObject.status="error",e.spineObject.error=`所选文件夹缺少:${Q}`;return}await U()}function O(){t.recalcTotalFrames()}function L(){O(),t.timeline.frame=0}async function U(){var X;const D=l.value,_=c.value;if(!D||!_||!u.value.length){e.spineObject.status="error",e.spineObject.error="请依次选择 Spine 数据、Atlas 和全部纹理图片";return}e.spineObject.status="loading",e.spineObject.error="";try{const N=await bw(D,_,u.value);Au(e.spineObject.id,N),e.spineObject.skeletonFileName=D.name,e.spineObject.atlasFileName=_.name,e.spineObject.textureFileNames=u.value.map(V=>V.name),e.spineObject.dataVersion=N.dataVersion,e.spineObject.animations=N.animations,e.spineObject.bones=N.bones,e.spineObject.selectedBone="",h.value="",o.value=new Set,e.spineObject.selectedAnimation=((X=N.animations[0])==null?void 0:X.name)||"",e.spineObject.assetVersion++,e.spineObject.status="ready",O(),t.timeline.frame=0;try{e.spineObject.sourceBundle=await kP(D,_,u.value)}catch(V){e.spineObject.sourceBundle=null,console.warn("Spine 配置资源嵌入失败",V)}}catch(N){e.spineObject.status="error",e.spineObject.error=N instanceof Error?N.message:String(N)}}function B(){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="",O()}return(D,_)=>(te(),oe("div",DF,[_[30]||(_[30]=E("div",{class:"editor-title"},"Spine 属性",-1)),E("label",NF,[_[15]||(_[15]=E("span",null,"Spine 名称",-1)),xe(E("input",{"onUpdate:modelValue":_[0]||(_[0]=X=>s.spineObject.name=X)},null,512),[[ct,s.spineObject.name]])]),E("div",UF,[E("label",XF,[_[16]||(_[16]=E("span",null,"X 位置",-1)),xe(E("input",{"onUpdate:modelValue":_[1]||(_[1]=X=>s.spineObject.x=X),type:"number"},null,512),[[ct,s.spineObject.x,void 0,{number:!0}]])]),E("label",VF,[_[17]||(_[17]=E("span",null,"Y 位置",-1)),xe(E("input",{"onUpdate:modelValue":_[2]||(_[2]=X=>s.spineObject.y=X),type:"number"},null,512),[[ct,s.spineObject.y,void 0,{number:!0}]])]),E("label",YF,[_[18]||(_[18]=E("span",null,"旋转",-1)),xe(E("input",{"onUpdate:modelValue":_[3]||(_[3]=X=>s.spineObject.rotation=X),type:"number"},null,512),[[ct,s.spineObject.rotation,void 0,{number:!0}]])])]),E("div",$F,[E("label",GF,[_[19]||(_[19]=E("span",null,"Scale X",-1)),xe(E("input",{"onUpdate:modelValue":_[4]||(_[4]=X=>s.spineObject.scaleX=X),type:"number",step:"0.05"},null,512),[[ct,s.spineObject.scaleX,void 0,{number:!0}]])]),E("label",HF,[_[20]||(_[20]=E("span",null,"Scale Y",-1)),xe(E("input",{"onUpdate:modelValue":_[5]||(_[5]=X=>s.spineObject.scaleY=X),type:"number",step:"0.05"},null,512),[[ct,s.spineObject.scaleY,void 0,{number:!0}]])]),E("label",jF,[_[21]||(_[21]=E("span",null,"开始时间",-1)),xe(E("input",{"onUpdate:modelValue":_[6]||(_[6]=X=>s.spineObject.timeOffset=X),type:"number",min:"0",step:"0.033333",onChange:O},null,544),[[ct,s.spineObject.timeOffset,void 0,{number:!0}]])])]),_[31]||(_[31]=E("div",{class:"divider"},null,-1)),_[32]||(_[32]=E("div",{class:"section-title"},"Spine 资源",-1)),E("input",{ref_key:"skeletonInput",ref:i,hidden:"",type:"file",accept:".json,.skel,application/json,application/octet-stream",onChange:R},null,544),E("input",{ref_key:"atlasInput",ref:n,hidden:"",type:"file",accept:".atlas,text/plain",onChange:P},null,544),E("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),E("input",{ref_key:"folderInput",ref:a,hidden:"",type:"file",multiple:"",webkitdirectory:"",directory:"",onChange:k},null,544),E("button",{class:"folder-select",disabled:s.spineObject.status==="loading",onClick:_[7]||(_[7]=X=>{var N;return(N=a.value)==null?void 0:N.click()})},"选择文件夹并加载",8,WF),_[33]||(_[33]=E("div",{class:"folder-hint"},"一次读取文件夹中的 JSON / SKEL、Atlas 和全部纹理;仍可在下方单独替换资源。",-1)),E("div",zF,[E("div",{class:"asset-name",title:d.value},je(d.value||"JSON / SKEL..."),9,qF),E("button",{onClick:_[8]||(_[8]=X=>{var N;return(N=i.value)==null?void 0:N.click()})},"选择")]),E("div",KF,[E("div",{class:"asset-name",title:f.value},je(f.value||"Atlas..."),9,ZF),E("button",{onClick:_[9]||(_[9]=X=>{var N;return(N=n.value)==null?void 0:N.click()})},"选择")]),E("div",JF,[E("div",{class:"asset-name",title:p.value.join(", ")},je(m.value),9,QF),E("button",{onClick:_[10]||(_[10]=X=>{var N;return(N=r.value)==null?void 0:N.click()})},"选择(多选)")]),E("div",e3,[E("button",{class:"load",disabled:s.spineObject.status==="loading",onClick:U},je(s.spineObject.status==="loading"?"加载中…":"↧ 加载"),9,t3),E("button",{class:"clear",onClick:B},"清除")]),E("div",i3,[_[22]||(_[22]=ai(" 支持 Spine 3.8 / 4.0 / 4.1 / 4.2 / 4.3 JSON · 对应版本运行时按需加载 · 本地离线 ",-1)),s.spineObject.dataVersion?(te(),oe("span",s3," · 当前资源 "+je(s.spineObject.dataVersion),1)):Ue("",!0)]),s.spineObject.error?(te(),oe("div",n3,je(s.spineObject.error),1)):Ue("",!0),E("div",r3,[_[25]||(_[25]=E("div",{class:"section-title"},"Spine 动画",-1)),s.spineObject.animations.length?(te(),oe("label",o3,[_[24]||(_[24]=E("span",null,"时间轴播放动画",-1)),xe(E("select",{"onUpdate:modelValue":_[11]||(_[11]=X=>s.spineObject.selectedAnimation=X),onChange:L},[_[23]||(_[23]=E("option",{value:""},"无",-1)),(te(!0),oe(Ke,null,ci(s.spineObject.animations,X=>(te(),oe("option",{key:X.name,value:X.name},je(X.name)+"("+je(X.duration.toFixed(2))+"s) ",9,l3))),128))],544),[[jt,s.spineObject.selectedAnimation]])])):(te(),oe("div",a3,"无可用动画"))]),E("div",c3,[E("div",h3,[_[29]||(_[29]=E("div",{class:"section-title"},"层级树",-1)),E("button",{class:ot(["selected-bone",{active:s.spineObject.selectedBone}]),disabled:!s.spineObject.selectedBone,title:s.spineObject.selectedBone?"点击清除骨骼选择":"当前未选择骨骼",onClick:_[12]||(_[12]=X=>s.spineObject.selectedBone="")},[s.spineObject.selectedBone?(te(),oe(Ke,{key:0},[_[26]||(_[26]=ai("清除选中骨骼:",-1)),E("strong",null,je(s.spineObject.selectedBone),1)],64)):(te(),oe(Ke,{key:1},[_[27]||(_[27]=ai("当前骨骼:",-1)),_[28]||(_[28]=E("strong",null,"未选择",-1))],64))],10,u3),s.spineObject.bones.length?(te(),oe("button",{key:0,class:"tree-action",onClick:T},je(y.value?"全部展开":"全部折叠"),1)):Ue("",!0)]),s.spineObject.bones.length?(te(),oe("div",f3,[xe(E("input",{"onUpdate:modelValue":_[13]||(_[13]=X=>h.value=X),type:"search","aria-label":"搜索骨骼",placeholder:"搜索骨骼名称…"},null,512),[[ct,h.value,void 0,{trim:!0}]]),h.value?(te(),oe("button",{key:0,title:"清空搜索","aria-label":"清空骨骼搜索",onClick:_[14]||(_[14]=X=>h.value="")},"✕")):Ue("",!0)])):(te(),oe("div",d3,"未加载 Spine")),s.spineObject.bones.length&&!b.value.length?(te(),oe("div",m3,"未找到匹配的骨骼")):s.spineObject.bones.length?(te(),oe("div",p3,[(te(!0),oe(Ke,null,ci(b.value,X=>(te(),oe("div",{key:X.name,class:ot(["bone",{selected:s.spineObject.selectedBone===X.name}]),style:Ni({paddingLeft:`${6+X.depth*16}px`}),role:"button",tabindex:"0",onClick:N=>w(X.name),onKeydown:Aa(yt(N=>w(X.name),["prevent"]),["enter"])},[g.value.has(X.name)?(te(),oe("button",{key:0,class:"bone-toggle",title:o.value.has(X.name)?"展开子骨骼":"折叠子骨骼",onClick:yt(N=>A(X.name),["stop"])},je(o.value.has(X.name)?"▸":"▾"),9,v3)):(te(),oe("span",y3,"•")),E("span",x3,je(X.name),1)],46,g3))),128))])):Ue("",!0)])]))}}),w3=rn(b3,[["__scopeId","data-v-9257fb45"]]),bi=La({visible:!1,title:"",detail:"",progress:0,indeterminate:!1,failed:!1});let Bc=0;function S3(s){return new Promise(e=>window.setTimeout(e,s))}function Kv(s,e){const t=++Bc,i=performance.now();Object.assign(bi,{visible:!0,title:s,detail:e,progress:0,indeterminate:!1,failed:!1});const n=(a,o)=>{t===Bc&&(bi.indeterminate=a==null,a!=null&&(bi.progress=Math.min(100,Math.max(0,a))),o&&(bi.detail=o))},r=async(a,o)=>{if(t!==Bc)return;bi.failed=a,bi.indeterminate=!1,bi.progress=a?bi.progress:100,bi.detail=o,await S3(Math.max(180,(a?850:450)-(performance.now()-i))),t===Bc&&(bi.visible=!1)};return{update:n,paint:()=>new Promise(a=>requestAnimationFrame(()=>a())),finish:(a="已完成")=>r(!1,a),fail:(a="操作失败")=>r(!0,a)}}async function _3(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 M3="3.8";function Ps(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 T3(s){for(const e of s.bones)Ps(e,"transform","inherit");for(const e of s.transform||[])Ps(e,"rotateMix","mixRotate"),e.translateMix==null&&(e.translateMix=e.mixX??e.mixY),e.scaleMix==null&&(e.scaleMix=e.mixScaleX??e.mixScaleY),Ps(e,"shearMix","mixShearY"),delete e.mixX,delete e.mixY,delete e.mixScaleX,delete e.mixScaleY;for(const e of s.path||[])Ps(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&&Ps(i,"deform","timelines")}function A3(s){for(const e of Object.values(s.slots||{}))Ps(e,"color","rgba"),Ps(e,"twoColor","rgba2")}function E3(s){for(const e of Object.values(s.bones||{}))for(const t of e.rotate||[])Ps(t,"angle","value")}function C3(s){for(const e of Object.values(s.transform||{}))for(const t of e)Ps(t,"rotateMix","mixRotate"),t.translateMix==null&&(t.translateMix=t.mixX??t.mixY),t.scaleMix==null&&(t.scaleMix=t.mixScaleX??t.mixScaleY),Ps(t,"shearMix","mixShearY"),delete t.mixX,delete t.mixY,delete t.mixScaleX,delete t.mixScaleY}function I3(s){for(const e of Object.values(s.path||{})){for(const t of["position","spacing"])for(const i of e[t]||[])Ps(i,t,"value");for(const t of e.mix||[])Ps(t,"rotateMix","mixRotate"),t.translateMix==null&&(t.translateMix=t.mixX??t.mixY),delete t.mixX,delete t.mixY}}function R3(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 P3(s){s.skeleton.spine=M3,T3(s);for(const e of Object.values(s.animations))A3(e),E3(e),C3(e),I3(e),R3(e);return Rm(s.animations),s}function k3(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<s.values.length;o++){const h=e.values[o]+(t.values[o]-e.values[o])*r;a=Math.max(a,Math.abs(s.values[o]-h)/Math.max(1e-9,i[o]??i[0]??.001))}return a}function Pw(s,e,t=new Set){if(s.length<=2)return s.slice();const i=new Set([0,s.length-1]);for(let a=1;a<s.length-1;a++)t.has(s[a].frame)&&i.add(a);const n=()=>[...i].sort((a,o)=>a-o);let r=!0;for(;r;){r=!1;const a=n();for(let o=0;o<a.length-1;o++){const h=a[o],l=a[o+1];let c=-1,u=1;for(let d=h+1;d<l;d++){const f=k3(s[d],s[h],s[l],e);f>u&&(u=f,c=d)}c>=0&&(i.add(c),r=!0)}}return n().map(a=>s[a])}function Zv(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 Jv(s,e,t){const i=s[t].frame-s[e].frame,n=[];for(let r=0;r<s[e].values.length;r++){const a=s[e].values[r],o=s[t].values[r],h=Math.min(...s.slice(e,t+1).map(d=>d.values[r])),l=Math.max(...s.slice(e,t+1).map(d=>d.values[r])),c=a+Zv(s,e,t,r,!0)*i/3,u=o-Zv(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 F3(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 O3(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<s.values.length;h++){const l=i.values[h],c=F3(e.values[h],l[0],l[1],t.values[h],a);o=Math.max(o,Math.abs(s.values[h]-c)/Math.max(1e-9,n[h]??n[0]??.001))}return o}function kw(s,e,t=new Set){if(s.length<=1)return{samples:s.slice(),controls:[]};const i=new Set([0,s.length-1]);for(let o=1;o<s.length-1;o++)t.has(s[o].frame)&&i.add(o);const n=()=>[...i].sort((o,h)=>o-h);let r=!0;for(;r;){r=!1;const o=n();for(let h=0;h<o.length-1;h++){const l=o[h],c=o[h+1];if(c-l<=1)continue;const u=Jv(s,l,c);let d=-1,f=1;for(let p=l+1;p<c;p++){const m=O3(s[p],s[l],s[c],u,e);m>f&&(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)=>Jv(s,o,a[h+1]))}}function B3(s){if(!s.length)return[];const e=[s[0]];for(let t=1;t<s.length;t++){let i=s[t];for(;i-e[t-1]>180;)i-=360;for(;i-e[t-1]<-180;)i+=360;e.push(i)}return e}function Ai(s){if(!Number.isFinite(s))return 0;const e=Math.round(s*1e5)/1e5;return Object.is(e,-0)?0:e}function L3(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<r;y++)g.push({col:y,row:0});for(let y=1;y<n;y++)g.push({col:r-1,row:y});for(let y=r-2;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<r-1;y++)for(let w=1;w<n-1;w++)g.push({col:y,row:w});const b=new Map;for(let y=0;y<g.length;y++){const{col:w,row:A}=g[y];b.set(`${w}:${A}`,y);const T=w/(r-1),M=T*(a-1),R=Math.min(a-1,Math.floor(M)),P=Math.min(a-1,R+1),F=M-R,I=A/(n-1),k=.5+c*(T-.5)-u*(I-.5),O=.5+u*(T-.5)+c*(I-.5);d.push(Ai(k),Ai(O));const L=(.5-I)*h;R===P||F<1e-6?p.push(1,t[R],0,Ai(L),1):p.push(2,t[R],0,Ai(L),Ai(1-F),t[P],0,Ai(L),Ai(F))}for(let y=0;y<r-1;y++)for(let w=0;w<n-1;w++){const A=b.get(`${y}:${w}`),T=b.get(`${y+1}:${w}`),M=b.get(`${y}:${w+1}`),R=b.get(`${y+1}:${w+1}`);f.push(A,T,M,T,R,M)}for(let y=0;y<v;y++)m.push(y*2,(y+1)%v*2);return{type:"mesh",path:i,uvs:d,triangles:f,vertices:p,hull:v,edges:m,width:o,height:h}}const Qv={normal:"normal",add:"additive",multiply:"multiply",screen:"screen"},ey=.1,ty=.1,iy=.01,Lc=.01;function D3(s,e){return String(s||"").trim().replace(/[\\/:*?"<>|\s]+/g,"_").replace(/^_+|_+$/g,"")||e}function Fw(s,e){let t=s,i=2;for(;e.has(t);)t=`${s}_${i++}`;return e.add(t),t}function N3(s){return s.replace(/\.[^./\\]+$/,"")}function Ow(s,e){return N3([s,e].filter(Boolean).join("/").replace(/\\/g,"/").replace(/\/{2,}/g,"/").replace(/^\.\//,""))}function U3(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 sy(s,e){return[(s>>16&255)/255,(s>>8&255)/255,(s&255)/255,Math.max(0,Math.min(1,e))]}function xl(s,e){return Ai(s/e)}function X3(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+Dr(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 V3(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:Fw(`_particle_${String(r).padStart(3,"0")}`,t),states:s.map(a=>a.find(o=>Yh(o,e)===n)||null)}))}function Y3(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 ny(s,e){return!s||s==="跟随导出"?e.keyframeCurve:s==="贝塞尔"?"bezier":"linear"}function Qa(s,e,t,i,n,r=new Set,a=n.keyframeCurve){if(!s.length)return[];const o=a==="bezier"&&n.spineVersion!=="3.8"?kw(s,i,r):{samples:Pw(s,i,r),controls:[]},h=o.samples.map(l=>{const c={time:xl(l.frame,e)};return t.forEach((u,d)=>{c[u]=Ai(l.values[d])}),c});for(let l=0;l<o.controls.length;l++){const c=Number(h[l].time)||0,u=Number(h[l+1].time)||0,d=[];for(let f=0;f<t.length;f++){const p=o.controls[l].values[f];d.push(Ai(c+(u-c)/3),Ai(p[0]),Ai(c+(u-c)*2/3),Ai(p[1]))}h[l].curve=d}return h}function $3(s){const e=new Set;for(let t=0;t<s.length;t++){const i=s[t],n=t?s[t-1]:null,r=!!i&&!!n&&i.spawnId!==n.spawnId;(!!i!=!!n||r)&&(t>0&&n&&e.add(t-1),i&&e.add(t))}return e}function G3(s){const e=new Set;for(let t=0;t<s.length;t++){const i=s[t],n=t?s[t-1]:void 0;!!i!=!!n&&(t>0&&n&&e.add(t-1),i&&e.add(t))}return e}function H3(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<t.length;n++){const r=t[n-1],a=t[n];if(e<=a.x){const o=(e-r.x)/Math.max(1e-6,a.x-r.x);return Math.max(0,r.y+(a.y-r.y)*o)}}return Math.max(0,t[t.length-1].y)}function j3(s,e,t){const i=[];let n=Symbol();return s.forEach((r,a)=>{r!==n&&(i.push(t(r,a)),n=r)}),i}function W3(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=U3(r);(!a.width||!a.height)&&t.push({code:"missing-image",message:`图片“${n}”缺失或尺寸不可读,已保留路径。`});const o=a.width||1,h=a.height||1;return{path:Ow(s.textureFolder,n),x:Ai((.5-s.anchorX)*o),y:Ai((s.anchorY-.5)*h),width:Ai(o),height:Ai(h)}}function z3(s,e,t,i,n=i.keyframeCurve){if(!s.length)return[];const r=new Set;for(let c=1;c<e.length;c++){const u=e[c],d=e[c-1],f=(u==null?void 0:u.replace(/_\d+$/,""))??null,p=(d==null?void 0:d.replace(/_\d+$/,""))??null;f!==p&&(r.add(c),r.add(c-1))}const a=s.map((c,u)=>({frame:u,values:c})),o=1/255,h=n==="bezier"&&i.spineVersion!=="3.8"?kw(a,[o,o,o,.01],r):{samples:Pw(a,[o,o,o,.01],r),controls:[]},l=h.samples.map(c=>({time:xl(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<h.controls.length;c++){const u=xl(h.samples[c].frame,t),d=xl(h.samples[c+1].frame,t),f=[];for(let p=0;p<4;p++){const m=h.controls[c].values[p];f.push(Ai(u+(d-u)/3),Ai(m[0]),Ai(u+(d-u)*2/3),Ai(m[1]))}l[c].curve=f}return l}function ry(s,e,t,i,n,r,a=r.keyframeCurve){var c;const o=(c=s.slots)[e]||(c[e]={}),h=j3(t,n,(u,d)=>({time:xl(d,n),name:u??null}));h.length&&(o.attachment=h);const l=z3(i,t,n,r,a);l.length&&(o.rgba=l)}function ay(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,X3(m,t)),v=(m.frames||[]).slice(0,g);v.length||r.push({code:"empty-cache",message:`“${m.config.name}”没有可用帧缓存。`});const b=Fw(D3(m.config.name,`system_${m.id}`),l);o.bones.push({name:b,parent:"root"});const y=V3(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 M of y){o.bones.push({name:M.name,parent:b});const R=new Set(m.config.imageResources.map(k=>k.blend));for(const k of R){const O=`${M.name}_image_${k}`;o.slots.push({name:O,bone:M.name,color:"ffffff00",blend:Qv[k]});const L=h[O]||(h[O]={});for(const U of m.config.imageResources.filter(B=>B.blend===k)){const B=U.imageMode==="sequence"?Math.max(1,U.sequenceFrames.length):1;for(let D=0;D<B;D++)L[`image_${U.id}_${D}`]=W3(U,D,r)}}if(m.config.trail)for(const k of m.config.trailResources){if(!M.states.some(_=>{var X;return((X=_==null?void 0:_.trailState)==null?void 0:X.resourceId)===k.id}))continue;const O=Math.max(2,Math.min(16,Math.round(k.boneCount||3))),L=[];for(let _=0;_<O;_++){const X=`${M.name}_trail_${k.id}_${_}`;L.push(X),o.bones.push({name:X,parent:b})}const U=`${M.name}_trail_${k.id}`;o.slots.push({name:U,bone:L[0],color:"ffffff00",blend:Qv[k.blend]});const B=L.map(_=>o.bones.findIndex(X=>X.name===_)),D=Ow("",k.textureName||`trail_${k.id}`);(h[U]||(h[U]={}))[`trail_${k.id}`]=L3(m.config,k,B,D),k.texture||r.push({code:"missing-image",message:`拖尾图片“${k.textureName||k.id}”缺失,已保留路径。`})}const P=`${M.name}_image_`,F=`${M.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 M=Array.from({length:A},(N,V)=>Y3(T,V,t,n)),R=M.map(N=>!!(N!=null&&N.active)),P=[],F=[],I=[];M.forEach((N,V)=>{N!=null&&N.active&&(P.push({frame:V,values:[N.worldX??N.x,N.worldY??N.y]}),F.push(N.worldRotation??N.rotation),I.push({frame:V,values:[N.worldScaleX??N.scaleX,N.worldScaleY??N.scaleY]}))});const k=B3(F),O=P.map((N,V)=>({frame:N.frame,values:[k[V]??0]})),L=$3(M),U={},B=Qa(P,n,["x","y"],[ey,ey],e,L),D=Qa(O,n,["value"],[iy],e,L),_=Qa(I,n,["x","y"],[Lc,Lc],e,L);B.length&&(U.translate=B),D.length&&(U.rotate=D),_.length&&(U.scale=_),Object.keys(U).length&&(v.bones[T.name]=U,b=!0);const X=new Set(y.config.imageResources.map(N=>N.blend));for(const N of X){const V=[],G=[];let j=16777215;for(let me=0;me<A;me++){const we=M[me],Re=we?y.config.imageResources.find(Ae=>Ae.id===we.resourceId):void 0,ge=!!we&&R[me]&&we.imageVisible!==!1&&(Re==null?void 0:Re.blend)===N;we&&(Re==null?void 0:Re.blend)===N&&(j=we.colorHex),V.push(ge?`image_${Re.id}_${we.imageFrameIndex??0}`:null),G.push(sy(j,ge?we.alpha:0))}const Q=y.config.imageResources.filter(me=>me.blend===N).filter(me=>me.independentAlpha==="curve").map(me=>ny(me.alphaCurveMode,e)),de=Q.length?Q.includes("bezier")?"bezier":"linear":ny(y.config.alphaMode==="curve"?y.config.curveMode:void 0,e);ry(v,`${T.name}_image_${N}`,V,G,n,e,de),V.some(Boolean)&&(b=!0)}if(y.config.trail)for(const N of y.config.trailResources){const V=Math.max(2,Math.min(16,Math.round(N.boneCount||3))),G=M.map(Ae=>{var H;return((H=Ae==null?void 0:Ae.trailState)==null?void 0:H.resourceId)===N.id?Ae.trailState:void 0}),j=G.find(Ae=>!!Ae);if(!j)continue;const ne=G3(G),Q=N.widthSizeMode==="random"?Math.max(1,Number(N.widthMin)||0,Number(N.widthMax)||0):Math.max(.001,Number(N.width)||100);let de=j;const me=G.map(Ae=>(Ae&&(de=Ae),de));for(let Ae=0;Ae<V;Ae++){const H=[],K=[],q=[],z=new Set(ne),ee=H3(N,Ae/Math.max(1,V-1));me.forEach((Xe,Pe)=>{const Oe=Xe==null?void 0:Xe.bones[Math.min(Xe.bones.length-1,Ae)];if(!Oe)return;const it={x:Oe.worldX??Oe.x,y:Oe.worldY??Oe.y,rotation:Oe.worldRotation??-Oe.rotation};H.push({frame:Pe,values:[it.x,it.y]}),K.push({frame:Pe,values:[it.rotation]}),q.push({frame:Pe,values:[1,Math.max(0,Xe.width/Q)*ee]})});const le=`${T.name}_trail_${N.id}_${Ae}`,ve={},re=Qa(H,n,["x","y"],[ty,ty],e,z),ye=Qa(K,n,["value"],[iy],e,z),he=Qa(q,n,["x","y"],[Lc,Lc],e,z);re.length&&(ve.translate=re),ye.length&&(ve.rotate=ye),he.length&&(ve.scale=he),Object.keys(ve).length&&(v.bones[le]=ve)}const we=G.map(()=>`trail_${N.id}`);let Re=j.colorHex;const ge=G.map(Ae=>(Ae&&(Re=Ae.colorHex),sy(Re,Ae?Ae.alpha:0)));ry(v,`${T.name}_trail_${N.id}`,we,ge,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"?P3(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 q3(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 w8{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 K3{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;i<n;i++)this.add(e[i]);return t!==this.size}contains(e){return this.entries[e]}clear(){this.entries={},this.size=0}}const xs=class xs{constructor(e=0,t=0,i=0,n=0){x(this,"r");x(this,"g");x(this,"b");x(this,"a");this.r=e,this.g=t,this.b=i,this.a=n}set(e,t,i,n){return this.r=e,this.g=t,this.b=i,this.a=n,this.clamp()}setFromColor(e){return this.r=e.r,this.g=e.g,this.b=e.b,this.a=e.a,this}setFromString(e){return e=e.charAt(0)==="#"?e.substr(1):e,this.r=parseInt(e.substr(0,2),16)/255,this.g=parseInt(e.substr(2,2),16)/255,this.b=parseInt(e.substr(4,2),16)/255,this.a=e.length!==8?1:parseInt(e.substr(6,2),16)/255,this}add(e,t,i,n){return this.r+=e,this.g+=t,this.b+=i,this.a+=n,this.clamp()}clamp(){return this.r<0?this.r=0:this.r>1&&(this.r=1),this.g<0?this.g=0:this.g>1&&(this.g=1),this.b<0?this.b=0:this.b>1&&(this.b=1),this.a<0?this.a=0:this.a>1&&(this.a=1),this}static rgba8888ToColor(e,t){e.r=((t&4278190080)>>>24)/255,e.g=((t&16711680)>>>16)/255,e.b=((t&65280)>>>8)/255,e.a=(t&255)/255}static rgb888ToColor(e,t){e.r=((t&16711680)>>>16)/255,e.g=((t&65280)>>>8)/255,e.b=(t&255)/255}toRgb888(){const e=t=>`0${(t*255).toString(16)}`.slice(-2);return+`0x${e(this.r)}${e(this.g)}${e(this.b)}`}static fromString(e,t=new xs){return t.setFromString(e)}};x(xs,"WHITE",new xs(1,1,1,1)),x(xs,"RED",new xs(1,0,0,1)),x(xs,"GREEN",new xs(0,1,0,1)),x(xs,"BLUE",new xs(0,0,1,1)),x(xs,"MAGENTA",new xs(1,0,1,1));let xt=xs;const di=class di{static clamp(e,t,i){return e<t?t:e>i?i:e}static cosDeg(e){return Math.cos(e*di.degRad)}static sinDeg(e){return Math.sin(e*di.degRad)}static atan2Deg(e,t){return Math.atan2(e,t)*di.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 di.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(di,"epsilon",1e-5),x(di,"epsilon2",di.epsilon*di.epsilon),x(di,"PI",3.1415927),x(di,"PI2",di.PI*2),x(di,"invPI2",1/di.PI2),x(di,"radiansToDegrees",180/di.PI),x(di,"radDeg",di.radiansToDegrees),x(di,"degreesToRadians",di.PI/180),x(di,"degRad",di.degreesToRadians);let Ve=di;const Es=class Es{apply(e,t,i){return t===void 0||i===void 0?this.applyInternal(e):e+(t-e)*this.applyInternal(i)}};x(Es,"linear",new class extends Es{applyInternal(e){return e}}),x(Es,"smooth",new class extends Es{applyInternal(e){return e*e*(3-2*e)}}),x(Es,"slowFast",new class extends Es{applyInternal(e){return e*e}}),x(Es,"fastSlow",new class extends Es{applyInternal(e){return(e-1)*(e-1)*-1+1}}),x(Es,"circle",new class extends Es{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=Es;class Z3 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 S8 extends Z3{constructor(e){super(e)}applyInternal(e){return Math.pow(e-1,this.power)*(this.power%2===0?-1:1)+1}}const Ir=class Ir{static arrayCopy(e,t,i,n,r){for(let a=t,o=n;a<t+r;a++,o++)i[o]=e[a]}static arrayFill(e,t,i,n){for(let r=t;r<i;r++)e[r]=n}static setArraySize(e,t,i=0){const n=e.length;if(n===t)return e;if(e.length=t,n<t)for(let r=n;r<t;r++)e[r]=i;return e}static ensureArrayCapacity(e,t,i=0){return e.length>=t?e:Ir.setArraySize(e,t,i)}static newArray(e,t){const i=[];for(let n=0;n<e;n++)i[n]=t;return i}static newFloatArray(e){if(Ir.SUPPORTS_TYPED_ARRAYS)return new Float32Array(e);{const t=[];for(let i=0;i<t.length;i++)t[i]=0;return t}}static newShortArray(e){if(Ir.SUPPORTS_TYPED_ARRAYS)return new Int16Array(e);{const t=[];for(let i=0;i<t.length;i++)t[i]=0;return t}}static toFloatArray(e){return Ir.SUPPORTS_TYPED_ARRAYS?new Float32Array(e):e}static toSinglePrecision(e){return Ir.SUPPORTS_TYPED_ARRAYS?Math.fround(e):e}static webkit602BugfixHelper(e){}static contains(e,t,i=!0){for(let n=0;n<e.length;n++)if(e[n]===t)return!0;return!1}static enumValue(e,t){return e[t[0].toUpperCase()+t.slice(1)]}};x(Ir,"SUPPORTS_TYPED_ARRAYS",typeof Float32Array<"u");let lt=Ir;class _8{static logBones(e){for(let t=0;t<e.bones.length;t++){const i=e.bones[t].appliedPose;console.log(`${i.bone.data.name}, ${i.a}, ${i.b}, ${i.c}, ${i.d}, ${i.worldX}, ${i.worldY}`)}}}class J3{constructor(e){x(this,"items",[]);x(this,"instantiator");this.instantiator=e}obtain(){return this.items.length>0?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;t<e.length;t++)this.free(e[t])}clear(){this.items.length=0}}class oy{constructor(e=0,t=0){x(this,"x");x(this,"y");this.x=e,this.y=t}set(e,t){return this.x=e,this.y=t,this}length(){const e=this.x,t=this.y;return Math.sqrt(e*e+t*t)}normalize(){const e=this.length();return e!==0&&(this.x/=e,this.y/=e),this}}class M8{constructor(){x(this,"maxDelta",.064);x(this,"framesPerSecond",0);x(this,"delta",0);x(this,"totalTime",0);x(this,"lastTime",Date.now()/1e3);x(this,"frameCount",0);x(this,"frameTime",0)}update(){const e=Date.now()/1e3;this.delta=e-this.lastTime,this.frameTime+=this.delta,this.totalTime+=this.delta,this.delta>this.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 T8{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.addedValues<this.values.length&&this.addedValues++,this.values[this.lastValue++]=e,this.lastValue>this.values.length-1&&(this.lastValue=0),this.dirty=!0}getMean(){if(this.hasEnoughData()){if(this.dirty){let e=0;for(let t=0;t<this.values.length;t++)e+=this.values[t];this.mean=e/this.values.length,this.dirty=!1}return this.mean}return 0}}class Q3{constructor(e){x(this,"_image");this._image=e}getImage(){return this._image}}var Io;(function(s){s[s.Nearest=9728]="Nearest",s[s.Linear=9729]="Linear",s[s.MipMap=9987]="MipMap",s[s.MipMapNearestNearest=9984]="MipMapNearestNearest",s[s.MipMapLinearNearest=9985]="MipMapLinearNearest",s[s.MipMapNearestLinear=9986]="MipMapNearestLinear",s[s.MipMapLinearLinear=9987]="MipMapLinearLinear"})(Io||(Io={}));var Ro;(function(s){s[s.MirroredRepeat=33648]="MirroredRepeat",s[s.ClampToEdge=33071]="ClampToEdge",s[s.Repeat=10497]="Repeat"})(Ro||(Ro={}));class Bw{constructor(){x(this,"texture");x(this,"u",0);x(this,"v",0);x(this,"u2",0);x(this,"v2",0);x(this,"width",0);x(this,"height",0);x(this,"degrees",0);x(this,"offsetX",0);x(this,"offsetY",0);x(this,"originalWidth",0);x(this,"originalHeight",0)}}class A8 extends Q3{setFilters(e,t){}setWraps(e,t){}dispose(){}}class E8{constructor(e){x(this,"pages",[]);x(this,"regions",[]);const t=new eO(e),i=new Array(4),n={};n.size=c=>{c.width=parseInt(i[1]),c.height=parseInt(i[2])},n.format=()=>{},n.filter=c=>{c.minFilter=lt.enumValue(Io,i[1]),c.magFilter=lt.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 Lw(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;p<u;p++)f.push(parseInt(i[p+1]));l.push(f)}}c.originalWidth===0&&c.originalHeight===0&&(c.originalWidth=c.width,c.originalHeight=c.height),h&&h.length>0&&l&&l.length>0&&(c.names=h,c.values=l,h=null,l=null),c.u=c.x/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 tO(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.regions.length;t++)if(this.regions[t].name===e)return this.regions[t];return null}setTextures(e,t=""){for(const i of this.pages)i.setTexture(e.get(t+i.name))}dispose(){var e;for(let t=0;t<this.pages.length;t++)(e=this.pages[t].texture)==null||e.dispose()}}class eO{constructor(e){x(this,"lines");x(this,"index",0);this.lines=e.split(/\r\n|\r|\n/)}readLine(){return this.index>=this.lines.length?null:this.lines[this.index++]}readEntry(e,t){if(!t||(t=t.trim(),t.length===0))return 0;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 tO{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 Lw extends Bw{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 zh=class zh{constructor(e){x(this,"name");x(this,"timelineAttachment");x(this,"timelineSlots",zh.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<a;r++){if(n=e[this.timelineSlots[r]],!n.bone.isActive())continue;const o=(i?n.getAppliedPose():n.getPose()).getAttachment();if(o!=null&&o.timelineAttachment===this)return!0}return!1}};x(zh,"empty",[]);let $h=zh;const qh=class qh extends $h{constructor(t){super(t);x(this,"id",qh.nextID++);x(this,"bones",null);x(this,"vertices",[]);x(this,"worldVerticesLength",0)}computeWorldVertices(t,i,n,r,a,o,h){r=o+(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,M=o;M<r;T+=2,M+=h){const R=c[T],P=c[T+1];a[M]=R*b+P*y+g,a[M+1]=R*w+P*A+v}return}let d=0,f=0;for(let m=0;m<n;m+=2){const g=u[d];d+=g+1,f+=g}const p=t.bones;if(l.length===0)for(let m=o,g=f*3;m<r;m+=h){let v=0,b=0,y=u[d++];for(y+=d;d<y;d++,g+=3){const w=p[u[d]].appliedPose,A=c[g],T=c[g+1],M=c[g+2];v+=(A*w.a+T*w.b+w.worldX)*M,b+=(A*w.c+T*w.d+w.worldY)*M}a[m]=v,a[m+1]=b}else{const m=l;for(let g=o,v=f*3,b=f<<1;g<r;g+=h){let y=0,w=0,A=u[d++];for(A+=d;d<A;d++,v+=3,b+=2){const T=p[u[d]].appliedPose,M=c[v]+m[b],R=c[v+1]+m[b+1],P=c[v+2];y+=(M*T.a+R*T.b+T.worldX)*P,w+=(M*T.c+R*T.d+T.worldY)*P}a[g]=y,a[g+1]=w}}}copyTo(t){this.bones?(t.bones=[],lt.arrayCopy(this.bones,0,t.bones,0,this.bones.length)):t.bones=null,this.vertices&&(t.vertices=lt.newFloatArray(this.vertices.length),lt.arrayCopy(this.vertices,0,t.vertices,0,this.vertices.length)),t.worldVerticesLength=this.worldVerticesLength,t.timelineAttachment=this.timelineAttachment,t.timelineSlots=this.timelineSlots}};x(qh,"nextID",0);let pr=qh;class Hr extends pr{constructor(t,i){super(t);x(this,"sequence");x(this,"regionUVs",[]);x(this,"triangles",[]);x(this,"hullLength",0);x(this,"path");x(this,"color",new xt(1,1,1,1));x(this,"sourceMesh",null);x(this,"edges",[]);x(this,"width",0);x(this,"height",0);x(this,"tempColor",new xt(0,0,0,0));this.sequence=i}copy(){if(this.sourceMesh)return this.newLinkedMesh();const t=new Hr(this.name,this.sequence.copy());return t.path=this.path,t.color.setFromColor(this.color),this.copyTo(t),t.regionUVs=[],lt.arrayCopy(this.regionUVs,0,t.regionUVs,0,this.regionUVs.length),t.triangles=[],lt.arrayCopy(this.triangles,0,t.triangles,0,this.triangles.length),t.hullLength=this.hullLength,this.edges&&(t.edges=[],lt.arrayCopy(this.edges,0,t.edges,0,this.edges.length)),t.width=this.width,t.height=this.height,t}updateSequence(){this.sequence.update(this)}getSourceMesh(){return this.sourceMesh}setSourceMesh(t){this.sourceMesh=t,t&&(this.bones=t.bones,this.vertices=t.vertices,this.worldVerticesLength=t.worldVerticesLength,this.regionUVs=t.regionUVs,this.triangles=t.triangles,this.hullLength=t.hullLength,this.worldVerticesLength=t.worldVerticesLength,this.edges=t.edges,this.width=t.width,this.height=t.height)}newLinkedMesh(){const t=new Hr(this.name,this.sequence.copy());return t.timelineAttachment=this.timelineAttachment,t.path=this.path,t.color.setFromColor(this.color),t.setSourceMesh(this.sourceMesh?this.sourceMesh:this),t.updateSequence(),t}static computeUVs(t,i,n){if(!t)throw new Error("Region not set.");const r=n.length;let a=t.u,o=t.v,h=0,l=0;if(t instanceof Lw){const c=t.page,u=c.width,d=c.height;switch(t.degrees){case 90:a-=(t.originalHeight-t.offsetY-t.height)/u,o-=(t.originalWidth-t.offsetX-t.width)/d,h=t.originalHeight/u,l=t.originalWidth/d;for(let f=0;f<r;f+=2)n[f]=a+i[f+1]*h,n[f+1]=o+(1-i[f])*l;return;case 180:a-=(t.originalWidth-t.offsetX-t.width)/u,o-=t.offsetY/d,h=t.originalWidth/u,l=t.originalHeight/d;for(let f=0;f<r;f+=2)n[f]=a+(1-i[f])*h,n[f+1]=o+(1-i[f+1])*l;return;case 270:a-=t.offsetY/u,o-=t.offsetX/d,h=t.originalHeight/u,l=t.originalWidth/d;for(let f=0;f<r;f+=2)n[f]=a+(1-i[f+1])*h,n[f+1]=o+i[f]*l;return;default:a-=t.offsetX/u,o-=(t.originalHeight-t.offsetY-t.height)/d,h=t.originalWidth/u,l=t.originalHeight/d}}else t?(h=t.u2-a,l=t.v2-o):(a=o=0,h=l=1);for(let c=0;c<r;c+=2)n[c]=a+i[c]*h,n[c+1]=o+i[c+1]*l}}const Dt=class Dt extends $h{constructor(t,i){super(t);x(this,"sequence");x(this,"x",0);x(this,"y",0);x(this,"scaleX",1);x(this,"scaleY",1);x(this,"rotation",0);x(this,"width",0);x(this,"height",0);x(this,"path");x(this,"color",new xt(1,1,1,1));x(this,"tempColor",new xt(1,1,1,1));this.sequence=i}copy(){const t=new Dt(this.name,this.sequence.copy());return t.path=this.path,t.x=this.x,t.y=this.y,t.scaleX=this.scaleX,t.scaleY=this.scaleY,t.rotation=this.rotation,t.width=this.width,t.height=this.height,t.color.setFromColor(this.color),t}computeWorldVertices(t,i,n,r,a){const o=t.bone.appliedPose,h=o.worldX,l=o.worldY,c=o.a,u=o.b,d=o.c,f=o.d;let p=i[0],m=i[1];n[r]=p*c+m*u+h,n[r+1]=p*d+m*f+l,r+=a,p=i[2],m=i[3],n[r]=p*c+m*u+h,n[r+1]=p*d+m*f+l,r+=a,p=i[4],m=i[5],n[r]=p*c+m*u+h,n[r+1]=p*d+m*f+l,r+=a,p=i[6],m=i[7],n[r]=p*c+m*u+h,n[r+1]=p*d+m*f+l}getOffsets(t){return this.sequence.offsets[this.sequence.resolveIndex(t)]}updateSequence(){this.sequence.update(this)}static computeUVs(t,i,n,r,a,o,h,l,c,u){if(!t)throw new Error("Region not set.");const d=h/t.originalWidth*r,f=l/t.originalHeight*a,p=-h/2*r+t.offsetX*d,m=-l/2*a+t.offsetY*f,g=p+t.width*d,v=m+t.height*f,b=o*Ve.degRad,y=Math.cos(b),w=Math.sin(b),A=p*y+i,T=p*w,M=m*y+n,R=m*w,P=g*y+i,F=g*w,I=v*y+n,k=v*w;c[0]=A-R,c[1]=M+T,c[2]=A-k,c[3]=I+T,c[4]=P-k,c[5]=I+F,c[6]=P-R,c[7]=M+F,t==null?(u[0]=0,u[1]=0,u[2]=0,u[3]=1,u[4]=1,u[5]=1,u[6]=1,u[7]=0):(u[1]=t.v2,u[2]=t.u,u[5]=t.v,u[6]=t.u2,t.degrees===90?(u[0]=t.u2,u[3]=t.v2,u[4]=t.u,u[7]=t.v):(u[0]=t.u,u[3]=t.v,u[4]=t.u2,u[7]=t.v2))}};x(Dt,"X1",0),x(Dt,"Y1",1),x(Dt,"C1R",2),x(Dt,"C1G",3),x(Dt,"C1B",4),x(Dt,"C1A",5),x(Dt,"U1",6),x(Dt,"V1",7),x(Dt,"X2",8),x(Dt,"Y2",9),x(Dt,"C2R",10),x(Dt,"C2G",11),x(Dt,"C2B",12),x(Dt,"C2A",13),x(Dt,"U2",14),x(Dt,"V2",15),x(Dt,"X3",16),x(Dt,"Y3",17),x(Dt,"C3R",18),x(Dt,"C3G",19),x(Dt,"C3B",20),x(Dt,"C3A",21),x(Dt,"U3",22),x(Dt,"V3",23),x(Dt,"X4",24),x(Dt,"Y4",25),x(Dt,"C4R",26),x(Dt,"C4G",27),x(Dt,"C4B",28),x(Dt,"C4A",29),x(Dt,"U4",30),x(Dt,"V4",31);let Po=Dt;const ho=class ho{constructor(e,t){x(this,"id",ho.nextID());x(this,"regions");x(this,"pathSuffix");x(this,"uvs");x(this,"offsets");x(this,"start",0);x(this,"digits",0);x(this,"setupIndex",0);this.regions=new Array(e),this.pathSuffix=t}copy(){const e=this.regions.length,t=new ho(e,this.pathSuffix);if(lt.arrayCopy(this.regions,0,t.regions,0,e),t.start=this.start,t.digits=this.digits,t.setupIndex=this.setupIndex,this.uvs!=null){const i=this.uvs[0].length;t.uvs=[];for(let n=0;n<e;n++)t.uvs[n]=lt.newFloatArray(i),lt.arrayCopy(this.uvs[n],0,t.uvs[n],0,i)}if(this.offsets!=null){t.offsets=[];for(let i=0;i<e;i++)t.offsets[i]=[],lt.arrayCopy(this.offsets[i],0,t.offsets[i],0,8)}return t}update(e){const t=this.regions.length;if(e instanceof Po){this.uvs=[],this.offsets=[];for(let i=0;i<t;i++)this.uvs[i]=lt.newFloatArray(8),this.offsets[i]=[],Po.computeUVs(this.regions[i],e.x,e.y,e.scaleX,e.scaleY,e.rotation,e.width,e.height,this.offsets[i],this.uvs[i])}else if(e instanceof Hr){const i=e.regionUVs;this.uvs=[],this.offsets=void 0;for(let n=0;n<t;n++)this.uvs[n]=lt.newFloatArray(i.length),Hr.computeUVs(this.regions[n],i,this.uvs[n])}}resolveIndex(e){let t=e.sequenceIndex;return t===-1&&(t=this.setupIndex),t>=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 Dw=[Gi.hold,Gi.once,Gi.loop,Gi.pingpong,Gi.onceReverse,Gi.loopReverse,Gi.pingpongReverse];class Op{constructor(e,t,i){x(this,"name");x(this,"timelines",[]);x(this,"timelineIds");x(this,"bones");x(this,"color",new xt(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 K3,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;r<t;r++){const a=n[r];this.timelineIds.addAll(a.propertyIds),sO(a)&&i.add(a.boneIndex)&&this.bones.push(a.boneIndex)}}hasTimeline(e){for(let t=0;t<e.length;t++)if(this.timelineIds.contains(e[t]))return!0;return!1}apply(e,t,i,n,r,a,o,h,l,c){if(!e)throw new Error("skeleton cannot be null.");n&&this.duration!==0&&(i%=this.duration,t>0&&(t%=this.duration));const u=this.timelines;for(let d=0,f=u.length;d<f;d++)u[d].apply(e,t,i,r,a,o,h,l,c)}}var st;(function(s){s[s.current=0]="current",s[s.setup=1]="setup",s[s.first=2]="first"})(st||(st={}));var vt;(function(s){s[s.rotate=0]="rotate",s[s.x=1]="x",s[s.y=2]="y",s[s.scaleX=3]="scaleX",s[s.scaleY=4]="scaleY",s[s.shearX=5]="shearX",s[s.shearY=6]="shearY",s[s.inherit=7]="inherit",s[s.rgb=8]="rgb",s[s.alpha=9]="alpha",s[s.rgb2=10]="rgb2",s[s.attachment=11]="attachment",s[s.deform=12]="deform",s[s.event=13]="event",s[s.drawOrder=14]="drawOrder",s[s.drawOrderFolder=15]="drawOrderFolder",s[s.ikConstraint=16]="ikConstraint",s[s.transformConstraint=17]="transformConstraint",s[s.pathConstraintPosition=18]="pathConstraintPosition",s[s.pathConstraintSpacing=19]="pathConstraintSpacing",s[s.pathConstraintMix=20]="pathConstraintMix",s[s.physicsConstraintInertia=21]="physicsConstraintInertia",s[s.physicsConstraintStrength=22]="physicsConstraintStrength",s[s.physicsConstraintDamping=23]="physicsConstraintDamping",s[s.physicsConstraintMass=24]="physicsConstraintMass",s[s.physicsConstraintWind=25]="physicsConstraintWind",s[s.physicsConstraintGravity=26]="physicsConstraintGravity",s[s.physicsConstraintMix=27]="physicsConstraintMix",s[s.physicsConstraintReset=28]="physicsConstraintReset",s[s.sequence=29]="sequence",s[s.sliderTime=30]="sliderTime",s[s.sliderMix=31]="sliderMix"})(vt||(vt={}));let si=class{constructor(e,...t){x(this,"propertyIds");x(this,"frames");x(this,"additive",!1);x(this,"instant",!1);this.propertyIds=t,this.frames=lt.newFloatArray(e*this.getFrameEntries())}getPropertyIds(){return this.propertyIds}getFrameEntries(){return 1}getFrameCount(){return this.frames.length/this.getFrameEntries()}getDuration(){return this.frames[this.frames.length-this.getFrameEntries()]}static search(e,t,i=1){const n=e.length;for(let r=i;r<n;r+=i)if(e[r]>t)return r-i;return n-i}};function iO(s){return typeof s=="object"&&s!==null&&typeof s.slotIndex=="number"}class Va extends si{constructor(t,i,...n){super(t,...n);x(this,"curves");this.curves=lt.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=lt.newFloatArray(i);lt.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,M=r+A,R=a+T;for(let P=p+18;p<P;p+=2)f[p]=M,f[p+1]=R,A+=y,T+=w,y+=v,w+=b,M+=A,R+=T}getBezierValue(t,i,n,r){const a=this.curves;if(a[r]>t){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<o;r+=2)if(a[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 sr 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<this.frames[0])return sr.beforeFirstKey(i,t,r,a);const o=this.getCurveValue(e);return i===st.setup?a+o*t:r+(n?o:o+a-r)*t}getAbsoluteValue(e,t,i,n,r,a,o){return o===void 0?this.getAbsoluteValue1(e,t,i,n,r,a):this.getAbsoluteValue2(e,t,i,n,r,a,o)}getAbsoluteValue1(e,t,i,n,r,a){if(e<this.frames[0])return sr.beforeFirstKey(i,t,r,a);const o=this.getCurveValue(e);return i===st.setup?a+(n?o:o-a)*t:r+(n?o:o-r)*t}getAbsoluteValue2(e,t,i,n,r,a,o){return e<this.frames[0]?sr.beforeFirstKey(i,t,r,a):i===st.setup?a+(n?o:o-a)*t:r+(n?o:o-r)*t}getScaleValue(e,t,i,n,r,a,o){if(e<this.frames[0])return sr.beforeFirstKey(i,t,a,o);const h=this.getCurveValue(e)*o;if(t===1&&!n)return h;let l=i===st.setup?o:a;return n?l+(h-o)*t:r?l+(Math.abs(h)*Math.sign(l)-l)*t:(l=Math.abs(l)*Math.sign(h),l+(h-l)*t)}static beforeFirstKey(e,t,i,n){switch(e){case st.setup:return n;case st.first:return i+(n-i)*t;case st.current:return i}}}function sO(s){return typeof s=="object"&&s!==null&&typeof s.boneIndex=="number"}class Ya extends sr{constructor(t,i,n,r){super(t,i,`${r}|${n}`);x(this,"boneIndex");this.boneIndex=n,this.additive=!0}apply(t,i,n,r,a,o,h,l,c){const u=t.bones[this.boneIndex];u.active&&this.apply1(c?u.appliedPose:u.pose,u.data.setupPose,n,a,o,h,l)}}class Bp extends Va{constructor(t,i,n,r,a){super(t,i,`${r}|${n}`,`${a}|${n}`);x(this,"boneIndex");this.boneIndex=n,this.additive=!0}getFrameEntries(){return 3}setFrame(t,i,n,r){t*=3,this.frames[t]=i,this.frames[t+1]=n,this.frames[t+2]=r}apply(t,i,n,r,a,o,h,l,c){const u=t.bones[this.boneIndex];u.active&&this.apply1(c?u.appliedPose:u.pose,u.data.setupPose,n,a,o,h,l)}}class Gh extends Ya{constructor(e,t,i){super(e,t,i,vt.rotate)}apply1(e,t,i,n,r,a,o){e.rotation=this.getRelativeValue(i,n,r,a,e.rotation,t.rotation)}}class Nw extends Bp{constructor(e,t,i){super(e,t,i,vt.x,vt.y)}apply1(e,t,i,n,r,a,o){const h=this.frames;if(i<h[0]){switch(r){case st.setup:e.x=t.x,e.y=t.y;break;case st.first:e.x+=(t.x-e.x)*n,e.y+=(t.y-e.y)*n;break}return}let l=0,c=0;const u=si.search(h,i,3),d=this.curves[u/3];switch(d){case 0:{const f=h[u];l=h[u+1],c=h[u+2];const p=(i-f)/(h[u+3]-f);l+=(h[u+3+1]-l)*p,c+=(h[u+3+2]-c)*p;break}case 1:l=h[u+1],c=h[u+2];break;default:l=this.getBezierValue(i,u,1,d-2),c=this.getBezierValue(i,u,2,d+18-2)}r===st.setup?(e.x=t.x+l*n,e.y=t.y+c*n):a?(e.x+=l*n,e.y+=c*n):(e.x+=(t.x+l-e.x)*n,e.y+=(t.y+c-e.y)*n)}}class Uw extends Ya{constructor(e,t,i){super(e,t,i,vt.x)}apply1(e,t,i,n,r,a,o){e.x=this.getRelativeValue(i,n,r,a,e.x,t.x)}}class Xw extends Ya{constructor(e,t,i){super(e,t,i,vt.y)}apply1(e,t,i,n,r,a,o){e.y=this.getRelativeValue(i,n,r,a,e.y,t.y)}}class Vw extends Bp{constructor(e,t,i){super(e,t,i,vt.scaleX,vt.scaleY)}apply1(e,t,i,n,r,a,o){const h=this.frames;if(i<h[0]){switch(r){case st.setup:e.scaleX=t.scaleX,e.scaleY=t.scaleY;break;case st.first:e.scaleX+=(t.scaleX-e.scaleX)*n,e.scaleY+=(t.scaleY-e.scaleY)*n;break}return}let l,c;const u=si.search(h,i,3),d=this.curves[u/3];switch(d){case 0:{const f=h[u];l=h[u+1],c=h[u+2];const p=(i-f)/(h[u+3]-f);l+=(h[u+3+1]-l)*p,c+=(h[u+3+2]-c)*p;break}case 1:l=h[u+1],c=h[u+2];break;default:l=this.getBezierValue(i,u,1,d-2),c=this.getBezierValue(i,u,2,d+18-2)}if(l*=t.scaleX,c*=t.scaleY,n===1&&!a)e.scaleX=l,e.scaleY=c;else{let f=0,p=0;r===st.setup?(f=t.scaleX,p=t.scaleY):(f=e.scaleX,p=e.scaleY),a?(e.scaleX=f+(l-t.scaleX)*n,e.scaleY=p+(c-t.scaleY)*n):o?(e.scaleX=f+(Math.abs(l)*Math.sign(f)-f)*n,e.scaleY=p+(Math.abs(c)*Math.sign(p)-p)*n):(f=Math.abs(f)*Math.sign(l),p=Math.abs(p)*Math.sign(c),e.scaleX=f+(l-f)*n,e.scaleY=p+(c-p)*n)}}}class Yw extends Ya{constructor(e,t,i){super(e,t,i,vt.scaleX)}apply1(e,t,i,n,r,a,o){e.scaleX=this.getScaleValue(i,n,r,a,o,e.scaleX,t.scaleX)}}class $w extends Ya{constructor(e,t,i){super(e,t,i,vt.scaleY)}apply1(e,t,i,n,r,a,o){e.scaleY=this.getScaleValue(i,n,r,a,o,e.scaleY,t.scaleY)}}class Gw extends Bp{constructor(e,t,i){super(e,t,i,vt.shearX,vt.shearY)}apply1(e,t,i,n,r,a,o){const h=this.frames;if(i<h[0]){switch(r){case st.setup:e.shearX=t.shearX,e.shearY=t.shearY;break;case st.first:e.shearX+=(t.shearX-e.shearX)*n,e.shearY+=(t.shearY-e.shearY)*n;break}return}let l=0,c=0;const u=si.search(h,i,3),d=this.curves[u/3];switch(d){case 0:{const f=h[u];l=h[u+1],c=h[u+2];const p=(i-f)/(h[u+3]-f);l+=(h[u+3+1]-l)*p,c+=(h[u+3+2]-c)*p;break}case 1:l=h[u+1],c=h[u+2];break;default:l=this.getBezierValue(i,u,1,d-2),c=this.getBezierValue(i,u,2,d+18-2)}r===st.setup?(e.shearX=t.shearX+l*n,e.shearY=t.shearY+c*n):a?(e.shearX+=l*n,e.shearY+=c*n):(e.shearX+=(t.shearX+l-e.shearX)*n,e.shearY+=(t.shearY+c-e.shearY)*n)}}class Hw extends Ya{constructor(e,t,i){super(e,t,i,vt.shearX)}apply1(e,t,i,n,r,a,o){e.shearX=this.getRelativeValue(i,n,r,a,e.shearX,t.shearX)}}class jw extends Ya{constructor(e,t,i){super(e,t,i,vt.shearY)}apply1(e,t,i,n,r,a,o){e.shearY=this.getRelativeValue(i,n,r,a,e.shearY,t.shearY)}}class Ww extends si{constructor(t,i){super(t,`${vt.inherit}|${i}`);x(this,"boneIndex");this.boneIndex=i,this.instant=!0}getFrameEntries(){return 2}setFrame(t,i,n){t*=2,this.frames[t]=i,this.frames[t+1]=n}apply(t,i,n,r,a,o,h,l,c){const u=t.bones[this.boneIndex];if(!u.active)return;const d=c?u.appliedPose:u.pose;if(l)o!==st.current&&(d.inherit=u.data.setupPose.inherit);else{const f=this.frames;n<f[0]?o!==st.current&&(d.inherit=u.data.setupPose.inherit):d.inherit=this.frames[si.search(f,n,2)+1]}}}class Ru extends Va{constructor(t,i,n,...r){super(t,i,...r);x(this,"slotIndex");this.slotIndex=n}apply(t,i,n,r,a,o,h,l,c){const u=t.slots[this.slotIndex];u.bone.active&&this.apply1(u,c?u.appliedPose:u.pose,n,a,o,h)}}class zw extends Ru{constructor(e,t,i){super(e,t,i,`${vt.rgb}|${i}`,`${vt.alpha}|${i}`)}getFrameEntries(){return 5}setFrame(e,t,i,n,r,a){e*=5,this.frames[e]=t,this.frames[e+1]=i,this.frames[e+2]=n,this.frames[e+3]=r,this.frames[e+4]=a}apply1(e,t,i,n,r,a){const o=t.color,h=this.frames;if(i<h[0]){const m=e.data.setupPose.color;switch(r){case st.setup:o.setFromColor(m);break;case st.first:o.add((m.r-o.r)*n,(m.g-o.g)*n,(m.b-o.b)*n,(m.a-o.a)*n);break}return}let l=0,c=0,u=0,d=0;const f=si.search(h,i,5),p=this.curves[f/5];switch(p){case 0:{const m=h[f];l=h[f+1],c=h[f+2],u=h[f+3],d=h[f+4];const g=(i-m)/(h[f+5]-m);l+=(h[f+5+1]-l)*g,c+=(h[f+5+2]-c)*g,u+=(h[f+5+3]-u)*g,d+=(h[f+5+4]-d)*g;break}case 1:l=h[f+1],c=h[f+2],u=h[f+3],d=h[f+4];break;default:l=this.getBezierValue(i,f,1,p-2),c=this.getBezierValue(i,f,2,p+18-2),u=this.getBezierValue(i,f,3,p+36-2),d=this.getBezierValue(i,f,4,p+54-2)}if(n===1)o.set(l,c,u,d);else if(r===st.setup){const m=e.data.setupPose.color;o.set(m.r+(l-m.r)*n,m.g+(c-m.g)*n,m.b+(u-m.b)*n,m.a+(d-m.a)*n)}else o.add((l-o.r)*n,(c-o.g)*n,(u-o.b)*n,(d-o.a)*n)}}class qw extends Ru{constructor(e,t,i){super(e,t,i,`${vt.rgb}|${i}`)}getFrameEntries(){return 4}setFrame(e,t,i,n,r){e<<=2,this.frames[e]=t,this.frames[e+1]=i,this.frames[e+2]=n,this.frames[e+3]=r}apply1(e,t,i,n,r,a){const o=t.color;let h=0,l=0,c=0;const u=this.frames;if(i<u[0]){const p=e.data.setupPose.color;switch(r){case st.setup:{o.r=p.r,o.g=p.g,o.b=p.b;break}case st.first:{o.r+=(p.r-o.r)*n,o.g+=(p.g-o.g)*n,o.b+=(p.b-o.b)*n;break}}return}const d=si.search(u,i,4),f=this.curves[d>>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===st.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 Kw extends sr{constructor(t,i,n){super(t,i,`${vt.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(n<p[0]){const m=u.data.setupPose.color.a;switch(o){case st.setup:d.a=m;break;case st.first:d.a+=(m-d.a)*a;break}return}if(f=this.getCurveValue(n),a!==1)if(o===st.setup){const m=u.data.setupPose.color;f=m.a+(f-m.a)*a}else f=d.a+(f-d.a)*a;d.a=f<0?0:f>1?1:f}}class Zw extends Ru{constructor(e,t,i){super(e,t,i,`${vt.rgb}|${i}`,`${vt.alpha}|${i}`,`${vt.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<d[0]){const y=e.data.setupPose,w=y.color,A=y.darkColor;switch(r){case st.setup:{o.setFromColor(w),h.r=A.r,h.g=A.g,h.b=A.b;break}case st.first:{o.add((w.r-o.r)*n,(w.g-o.g)*n,(w.b-o.b)*n,(w.a-o.a)*n),h.r+=(A.r-h.r)*n,h.g+=(A.g-h.g)*n,h.b+=(A.b-h.b)*n;break}}return}let f=0,p=0,m=0,g=0;const v=si.search(d,i,8),b=this.curves[v>>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===st.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 Jw extends Ru{constructor(e,t,i){super(e,t,i,`${vt.rgb}|${i}`,`${vt.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(i<m[0]){const b=e.data.setupPose,y=b.color,w=b.darkColor;switch(r){case st.setup:o.r=y.r,o.g=y.g,o.b=y.b,h.r=w.r,h.g=w.g,h.b=w.b;break;case st.first:o.r+=(y.r-o.r)*n,o.g+=(y.g-o.g)*n,o.b+=(y.b-o.b)*n,h.r+=(w.r-h.r)*n,h.g+=(w.g-h.g)*n,h.b+=(w.b-h.b)*n;break}return}const g=si.search(m,i,7),v=this.curves[g/7];switch(v){case 0:{const b=m[g];l=m[g+1],c=m[g+2],u=m[g+3],d=m[g+4],f=m[g+5],p=m[g+6];const y=(i-b)/(m[g+7]-b);l+=(m[g+7+1]-l)*y,c+=(m[g+7+2]-c)*y,u+=(m[g+7+3]-u)*y,d+=(m[g+7+4]-d)*y,f+=(m[g+7+5]-f)*y,p+=(m[g+7+6]-p)*y;break}case 1:l=m[g+1],c=m[g+2],u=m[g+3],d=m[g+4],f=m[g+5],p=m[g+6];break;default:l=this.getBezierValue(i,g,1,v-2),c=this.getBezierValue(i,g,2,v+18-2),u=this.getBezierValue(i,g,3,v+36-2),d=this.getBezierValue(i,g,4,v+54-2),f=this.getBezierValue(i,g,5,v+72-2),p=this.getBezierValue(i,g,6,v+90-2)}if(n!==1)if(r===st.setup){const b=e.data.setupPose;let y=b.color;l=y.r+(l-y.r)*n,c=y.g+(c-y.g)*n,u=y.b+(u-y.b)*n,y=b.darkColor,d=y.r+(d-y.r)*n,f=y.g+(f-y.g)*n,p=y.b+(p-y.b)*n}else l=o.r+(l-o.r)*n,c=o.g+(c-o.g)*n,u=o.b+(u-o.b)*n,d=h.r+(d-h.r)*n,f=h.g+(f-h.g)*n,p=h.b+(p-h.b)*n;o.r=l<0?0:l>1?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 bl extends si{constructor(t,i){super(t,`${vt.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||n<this.frames[0]?o!==st.current&&this.setAttachment(t,d,u.data.attachmentName):this.setAttachment(t,d,this.attachmentNames[si.search(this.frames,n)])}setAttachment(t,i,n){i.setAttachment(n?t.getAttachment(this.slotIndex,n):null)}}class Qw extends Va{constructor(t,i,n,r){super(t,i,`${vt.deform}|${n}|${r.id}`);x(this,"slotIndex");x(this,"attachment");x(this,"vertices");this.slotIndex=n,this.attachment=r,this.vertices=new Array(t),this.additive=!0}getFrameCount(){return this.frames.length}setFrame(t,i,n){this.frames[t]=i,this.vertices[t]=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=c*.03-h*.06,v=((o-l)*3-r+u)*.006,b=(h-c+.33333333)*.018;let y=m*2+v,w=g*2+b,A=(o-r)*.3+m+v*.16666667,T=h*.3+g+b*.16666667,M=r+A,R=T;for(let P=p+18;p<P;p+=2)f[p]=M,f[p+1]=R,A+=y,T+=w,y+=v,w+=b,M+=A,R+=T}getCurvePercent(t,i){const n=this.curves;let r=n[i];switch(r){case 0:{const l=this.frames[i];return(t-l)/(this.frames[i+this.getFrameEntries()]-l)}case 1:return 0}if(r-=2,n[r]>t){const l=this.frames[i];return n[r+1]*(t-l)/(n[r]-l)}const a=r+18;for(r+=2;r<a;r+=2)if(n[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[0]){this.applyBeforeFirst(u[this.slotIndex],c,a,o);for(const b of d)this.applyBeforeFirst(u[b],c,a,o);return}let p,m,g;if(n>=f[f.length-1])g=0,p=this.vertices[f.length-1],m=null;else{const b=si.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=st.setup),r){case st.setup:o.length=0;break;case st.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<h;d++)l[d]+=(u[d]-l[d])*n}else{n=1-n;for(let u=0;u<h;u++)l[u]*=n}}}}applyToSlot(t,i,n,r,a,o,h,l,c){if(!t.bone.active)return;const u=i?t.appliedPose:t.pose;if(u.attachment===null||u.attachment.timelineAttachment!==this.attachment)return;const d=u.attachment,f=u.deform;f.length===0&&(l=st.setup);const p=l===st.setup;if(f.length=o,r===null)if(h===1)if(c&&!p)if(d.bones)for(let m=0;m<o;m++)f[m]+=n[m];else{const m=d.vertices;for(let g=0;g<o;g++)f[g]+=n[g]-m[g]}else lt.arrayCopy(n,0,f,0,o);else if(p)if(d.bones)for(let m=0;m<o;m++)f[m]=n[m]*h;else{const m=d.vertices;for(let g=0;g<o;g++){const v=m[g];f[g]=v+(n[g]-v)*h}}else if(c)if(d.bones)for(let m=0;m<o;m++)f[m]+=n[m]*h;else{const m=d.vertices;for(let g=0;g<o;g++)f[g]+=(n[g]-m[g])*h}else for(let m=0;m<o;m++)f[m]+=(n[m]-f[m])*h;else if(h===1)if(c&&!p)if(d.bones)for(let m=0;m<o;m++){const g=n[m];f[m]+=g+(r[m]-g)*a}else{const m=d.vertices;for(let g=0;g<o;g++){const v=n[g];f[g]+=v+(r[g]-v)*a-m[g]}}else if(a===0)lt.arrayCopy(n,0,f,0,o);else for(let m=0;m<o;m++){const g=n[m];f[m]=g+(r[m]-g)*a}else if(p)if(d.bones)for(let m=0;m<o;m++){const g=n[m];f[m]=(g+(r[m]-g)*a)*h}else{const m=d.vertices;for(let g=0;g<o;g++){const v=n[g],b=m[g];f[g]=b+(v+(r[g]-v)*a-b)*h}}else if(c)if(d.bones)for(let m=0;m<o;m++){const g=n[m];f[m]+=(g+(r[m]-g)*a)*h}else{const m=d.vertices;for(let g=0;g<o;g++){const v=n[g];f[g]+=(v+(r[g]-v)*a-m[g])*h}}else for(let m=0;m<o;m++){const g=n[m];f[m]+=(g+(r[m]-g)*a-f[m])*h}}}const Cs=class Cs extends si{constructor(t,i,n){super(t,`${vt.sequence}|${i}|${n.sequence.id}`);x(this,"slotIndex");x(this,"attachment");this.slotIndex=i,this.attachment=n,this.instant=!0}getFrameEntries(){return Cs.ENTRIES}getSlotIndex(){return this.slotIndex}getAttachment(){return this.attachment}setFrame(t,i,n,r,a){const o=this.frames;t*=Cs.ENTRIES,o[t]=i,o[t+Cs.MODE]=n|r<<4,o[t+Cs.DELAY]=a}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(l||n<f[0]){if(o!==st.current){this.setupPose(u[this.slotIndex],c);for(const b of d)this.setupPose(u[b],c)}return}const p=si.search(f,n,Cs.ENTRIES),m=f[p],g=f[p+Cs.MODE],v=f[p+Cs.DELAY];this.applyToSlot(u[this.slotIndex],c,n,m,g,v);for(const b of d)this.applyToSlot(u[b],c,n,m,g,v)}setupPose(t,i){if(!t.bone.active)return;const n=i?t.appliedPose:t.pose;n.attachment===null||n.attachment.timelineAttachment!==this.attachment||(n.sequenceIndex=-1)}applyToSlot(t,i,n,r,a,o){if(!t.bone.active)return;const h=i?t.appliedPose:t.pose;if(h.attachment===null||h.attachment.timelineAttachment!==this.attachment)return;let l=a>>4,c=h.attachment.sequence.regions.length;const u=Dw[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(Cs,"ENTRIES",3),x(Cs,"MODE",1),x(Cs,"DELAY",2);let Hh=Cs;const Kh=class Kh extends si{constructor(t){super(t,...Kh.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(n<u[0])return;let f=0;if(i<u[0])f=0;else{f=si.search(u,i)+1;const p=u[f];for(;f>0&&u[f-1]===p;)f--}for(;f<d&&n>=u[f];f++)r.push(this.events[f])}};x(Kh,"propertyIds",[`${vt.event}`]);let Xl=Kh;const uo=class uo extends si{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<this.frames[0]){o!==st.current&<.arrayCopy(d,0,u,0,t.slots.length);return}const f=this.drawOrders[si.search(this.frames,n)];if(!f)lt.arrayCopy(d,0,u,0,t.slots.length);else for(let p=0,m=f.length;p<m;p++)u[p]=d[f[p]]}};x(uo,"propertyID",`${vt.drawOrder}`),x(uo,"propertyIds",[uo.propertyID]);let Vr=uo;const Sl=class Sl extends si{constructor(t,i,n){super(t,...Sl.propertyIds(i));x(this,"slots");x(this,"inFolder");x(this,"drawOrders");this.slots=i,this.drawOrders=new Array(t),this.inFolder=new Array(n);for(const r of i)this.inFolder[r]=!0;this.instant=!0}static propertyIds(t){const i=t.length,n=new Array(i);for(let r=0;r<i;r++)n[r]=`${Sl.propertyID}|${t[r]}`;return n}getFrameCount(){return this.frames.length}getSlots(){return this.slots}getDrawOrders(){return this.drawOrders}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<this.frames[0])o!==st.current&&this.setup(u,d);else{const f=this.drawOrders[si.search(this.frames,n)];if(!f)this.setup(u,d);else{const p=this.inFolder,m=this.slots;for(let g=0,v=0,b=m.length;!(p[u[g].data.index]&&(u[g]=d[m[f[v]]],++v===b));g++);}}}setup(t,i){const{inFolder:n,slots:r}=this;for(let a=0,o=0,h=r.length;!(n[t[a].data.index]&&(t[a]=i[r[o]],++o===h));a++);}};x(Sl,"propertyID",`${vt.drawOrderFolder}`);let Fo=Sl;function nO(s){return typeof s=="object"&&s!==null&&typeof s.constraintIndex=="number"}class eS extends Va{constructor(t,i,n){super(t,i,`${vt.ikConstraint}|${n}`);x(this,"constraintIndex",0);this.constraintIndex=n}getFrameEntries(){return 6}setFrame(t,i,n,r,a,o,h){t*=6,this.frames[t]=i,this.frames[t+1]=n,this.frames[t+2]=r,this.frames[t+3]=a,this.frames[t+4]=o?1:0,this.frames[t+5]=h?1:0}apply(t,i,n,r,a,o,h,l,c){const u=t.constraints[this.constraintIndex];if(!u.active)return;const d=c?u.appliedPose:u.pose,f=this.frames;if(n<f[0]){const y=u.data.setupPose;switch(o){case st.setup:{d.mix=y.mix,d.softness=y.softness,d.bendDirection=y.bendDirection,d.compress=y.compress,d.stretch=y.stretch;break}case st.first:{d.mix+=(y.mix-d.mix)*a,d.softness+=(y.softness-d.softness)*a,d.bendDirection=y.bendDirection,d.compress=y.compress,d.stretch=y.stretch;break}}return}let p=0,m=0;const g=si.search(f,n,6),v=this.curves[g/6];switch(v){case 0:{const y=f[g];p=f[g+1],m=f[g+2];const w=(n-y)/(f[g+6]-y);p+=(f[g+6+1]-p)*w,m+=(f[g+6+2]-m)*w;break}case 1:p=f[g+1],m=f[g+2];break;default:p=this.getBezierValue(n,g,1,v-2),m=this.getBezierValue(n,g,2,v+18-2)}const b=o===st.setup?u.data.setupPose:d;d.mix=b.mix+(p-b.mix)*a,d.softness=b.softness+(m-b.softness)*a,l?o===st.setup&&(d.bendDirection=b.bendDirection,d.compress=b.compress,d.stretch=b.stretch):(d.bendDirection=f[g+3],d.compress=f[g+4]!==0,d.stretch=f[g+5]!==0)}}class tS extends Va{constructor(t,i,n){super(t,i,`${vt.transformConstraint}|${n}`);x(this,"constraintIndex",0);this.constraintIndex=n,this.additive=!0}getFrameEntries(){return 7}setFrame(t,i,n,r,a,o,h,l){const c=this.frames;t*=7,c[t]=i,c[t+1]=n,c[t+2]=r,c[t+3]=a,c[t+4]=o,c[t+5]=h,c[t+6]=l}apply(t,i,n,r,a,o,h,l,c){const u=t.constraints[this.constraintIndex];if(!u.active)return;const d=c?u.appliedPose:u.pose,f=this.frames;if(n<f[0]){const M=u.data.setupPose;switch(o){case st.setup:{d.mixRotate=M.mixRotate,d.mixX=M.mixX,d.mixY=M.mixY,d.mixScaleX=M.mixScaleX,d.mixScaleY=M.mixScaleY,d.mixShearY=M.mixShearY;break}case st.first:{d.mixRotate+=(M.mixRotate-d.mixRotate)*a,d.mixX+=(M.mixX-d.mixX)*a,d.mixY+=(M.mixY-d.mixY)*a,d.mixScaleX+=(M.mixScaleX-d.mixScaleX)*a,d.mixScaleY+=(M.mixScaleY-d.mixScaleY)*a,d.mixShearY+=(M.mixShearY-d.mixShearY)*a;break}}return}let p,m,g,v,b,y;const w=si.search(f,n,7),A=this.curves[w/7];switch(A){case 0:{const M=f[w];p=f[w+1],m=f[w+2],g=f[w+3],v=f[w+4],b=f[w+5],y=f[w+6];const R=(n-M)/(f[w+7]-M);p+=(f[w+7+1]-p)*R,m+=(f[w+7+2]-m)*R,g+=(f[w+7+3]-g)*R,v+=(f[w+7+4]-v)*R,b+=(f[w+7+5]-b)*R,y+=(f[w+7+6]-y)*R;break}case 1:p=f[w+1],m=f[w+2],g=f[w+3],v=f[w+4],b=f[w+5],y=f[w+6];break;default:p=this.getBezierValue(n,w,1,A-2),m=this.getBezierValue(n,w,2,A+18-2),g=this.getBezierValue(n,w,3,A+36-2),v=this.getBezierValue(n,w,4,A+54-2),b=this.getBezierValue(n,w,5,A+72-2),y=this.getBezierValue(n,w,6,A+90-2)}const T=o===st.setup?u.data.setupPose:d;h?(d.mixRotate=T.mixRotate+p*a,d.mixX=T.mixX+m*a,d.mixY=T.mixY+g*a,d.mixScaleX=T.mixScaleX+v*a,d.mixScaleY=T.mixScaleY+b*a,d.mixShearY=T.mixShearY+y*a):(d.mixRotate=T.mixRotate+(p-T.mixRotate)*a,d.mixX=T.mixX+(m-T.mixX)*a,d.mixY=T.mixY+(g-T.mixY)*a,d.mixScaleX=T.mixScaleX+(v-T.mixScaleX)*a,d.mixScaleY=T.mixScaleY+(b-T.mixScaleY)*a,d.mixShearY=T.mixShearY+(y-T.mixShearY)*a)}}class Jl extends sr{constructor(t,i,n,r){super(t,i,`${r}|${n}`);x(this,"constraintIndex");this.constraintIndex=n}}class iS extends Jl{constructor(e,t,i){super(e,t,i,vt.pathConstraintPosition),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.position=this.getAbsoluteValue(i,r,a,o,u.position,c.data.setupPose.position)}}}class sS extends Jl{constructor(e,t,i){super(e,t,i,vt.pathConstraintSpacing)}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.spacing=this.getAbsoluteValue(i,r,a,!1,u.spacing,c.data.setupPose.spacing)}}}class nS extends Va{constructor(t,i,n){super(t,i,`${vt.pathConstraintMix}|${n}`);x(this,"constraintIndex");this.constraintIndex=n}getFrameEntries(){return 4}setFrame(t,i,n,r,a){const o=this.frames;t<<=2,o[t]=i,o[t+1]=n,o[t+2]=r,o[t+3]=a}apply(t,i,n,r,a,o,h,l,c){const u=t.constraints[this.constraintIndex];if(!u.active)return;const d=c?u.appliedPose:u.pose,f=this.frames;if(n<f[0]){const w=u.data.setupPose;switch(o){case st.setup:{d.mixRotate=w.mixRotate,d.mixX=w.mixX,d.mixY=w.mixY;break}case st.first:{d.mixRotate+=(w.mixRotate-d.mixRotate)*a,d.mixX+=(w.mixX-d.mixX)*a,d.mixY+=(w.mixY-d.mixY)*a;break}}return}let p,m,g;const v=si.search(f,n,4),b=this.curves[v>>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===st.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 zr 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 rS extends zr{constructor(e,t,i){super(e,t,i,vt.physicsConstraintInertia)}get(e){return e.inertia}set(e,t){e.inertia=t}global(e){return e.inertiaGlobal}}class aS extends zr{constructor(e,t,i){super(e,t,i,vt.physicsConstraintStrength)}get(e){return e.strength}set(e,t){e.strength=t}global(e){return e.strengthGlobal}}class oS extends zr{constructor(e,t,i){super(e,t,i,vt.physicsConstraintDamping)}get(e){return e.damping}set(e,t){e.damping=t}global(e){return e.dampingGlobal}}class lS extends zr{constructor(e,t,i){super(e,t,i,vt.physicsConstraintMass)}get(e){return 1/e.massInverse}set(e,t){e.massInverse=1/t}global(e){return e.massGlobal}}class cS extends zr{constructor(e,t,i){super(e,t,i,vt.physicsConstraintWind),this.additive=!0}get(e){return e.wind}set(e,t){e.wind=t}global(e){return e.windGlobal}}class hS extends zr{constructor(e,t,i){super(e,t,i,vt.physicsConstraintGravity),this.additive=!0}get(e){return e.gravity}set(e,t){e.gravity=t}global(e){return e.gravityGlobal}}class uS extends zr{constructor(e,t,i){super(e,t,i,vt.physicsConstraintMix)}get(e){return e.mix}set(e,t){e.mix=t}global(e){return e.mixGlobal}}const Zh=class Zh extends si{constructor(t,i){super(t,...Zh.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[0])&&(i<d[0]||n>=d[si.search(d,i)+1]))if(u!=null)u.reset(t);else for(const f of t.physics)f.active&&f.reset(t)}};x(Zh,"propertyIds",[vt.physicsConstraintReset.toString()]);let jh=Zh;class dS extends Jl{constructor(e,t,i){super(e,t,i,vt.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 fS extends Jl{constructor(e,t,i){super(e,t,i,vt.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 _l=class _l{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 aO(this));x(this,"propertyIds",new Map);x(this,"animationsChanged",!1);x(this,"trackEntryPool",new J3(()=>new rO));this.data=e}update(e){e*=this.timeScale;const t=this.tracks;for(let i=0,n=t.length;i<n;i++){const r=t[i];if(!r)continue;r.animationLast=r.nextAnimationLast,r.trackLast=r.nextTrackLast;let a=e*r.timeScale;if(r.delay>0){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;o<h;o++){const l=i[o];if(!l||l.delay>0)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<g;v++){lt.webkit602BugfixHelper(c);const b=m[v];b instanceof bl?this.applyAttachmentTimeline(b,e,f,st.setup,!0):b.apply(e,u,f,p,c,st.setup,!1,!1,!1)}else{const v=l.timelineMode,b=c>=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;T<g;T++){const M=m[T],R=v[T]&uy;!w&&M instanceof Gh?this.applyRotateTimeline(M,e,f,c,R,l.timelinesRotation,T<<1,A):M instanceof bl?this.applyAttachmentTimeline(M,e,f,R,b):(lt.webkit602BugfixHelper(c),M.apply(e,u,f,p,c,R,y,!1,!1))}}l.reverse&&this.eventsReverse(l,u,d),this.queueEvents(l,d),t.length=0,l.nextAnimationLast=d,l.nextTrackLast=l.trackTime}const r=this.unkeyedState+dy,a=e.slots;for(let o=0,h=e.slots.length;o<h;o++){const l=a[o];if(l.attachmentState===r){const c=l.data.attachmentName;l.pose.setAttachment(c?e.getAttachment(l.data.index,c):null)}}return this.unkeyedState+=2,this.queue.drain(),n}applyMixingFrom(e,t){const i=e.mixingFrom,n=i.mixingFrom!==null?this.applyMixingFrom(i,t):1,r=e.mix(),a=i.alpha*n,o=1-r*e.alpha,h=a*(1-r),l=o>0?h/o:a,c=i.animation.timelines,u=c.length,d=i.timelineMode,f=i.timelineHoldMix,p=r<i.mixAttachmentThreshold,m=r<i.mixDrawOrderThreshold,g=i.additive,v=g||i.shortestRotation,b=!v&&i.timelinesRotation.length!==u<<1;b&&(i.timelinesRotation.length=u<<1);const y=i.timelinesRotation;let w=i.animationLast,A=i.getAnimationTime(),T=A,M=null;i.reverse?T=i.animation.duration-T:r<i.eventThreshold&&(M=this.events),i.totalAlpha=0;for(let R=0;R<u;R++){const P=c[R],F=d[R],I=F&uy;let k=0;if((F&Nc)!==0){const O=f[R];k=O==null?l:l*(1-O.mix())}else{if(!m&&P instanceof Vr&&I===st.current)continue;k=h}if(i.totalAlpha+=k,!v&&P instanceof Gh)this.applyRotateTimeline(P,t,T,k,I,y,R<<1,b);else if(P instanceof bl)this.applyAttachmentTimeline(P,t,T,I,p&&k>=i.alphaAttachmentThreshold);else{const O=!m||!(P instanceof Vr)||I===st.current;P.apply(t,w,T,M,k,I,g,O,!1)}}return i.reverse&&r<i.eventThreshold&&this.eventsReverse(i,w,A),e.mixDuration>0&&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+fy)return;let o=i<e.frames[0],h=null;if(o||(h=e.attachmentNames[si.search(e.frames,i)],o=!r&&h==null),o){if(n===st.current)return;h=a.data.attachmentName}a.pose.setAttachment(h==null?null:t.getAttachment(a.data.index,h)),r?a.attachmentState=this.unkeyedState+fy:o||(a.attachmentState=this.unkeyedState+dy)}applyRotateTimeline(e,t,i,n,r,a,o,h){if(h&&(a[o]=0),n===1){e.apply(t,0,i,null,1,r,!1,!1,!1);return}const l=t.bones[e.boneIndex];if(!l.active)return;const c=l.pose,u=l.data.setupPose,d=e.frames;let f,p;if(i<d[0]){switch(r){case st.setup:{c.rotation=u.rotation;return}case st.current:return}f=c.rotation,p=u.rotation}else f=r===st.setup?u.rotation:c.rotation,p=u.rotation+e.getCurveValue(i);let m=0,g=p-f;if(g-=Math.ceil(g/360-.5)*360,g===0)m=a[o];else{let v=0,b=0;h?(v=0,b=g):(v=a[o],b=a[o+1]);const y=v-v%360;m=g+y;let w=g>=0,A=v>=0;Math.abs(b)<=90&&Ve.signum(b)!==Ve.signum(g)&&(Math.abs(v-y)>180?(m+=360*Ve.signum(v),A=w):y!==0?m-=360*Ve.signum(v):A=w),A!==w&&(m+=360*Ve.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<c;l++){const d=h[l];if(d.time<o!==a)break;d.time>=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<n;for(u&&this.queue.complete(e);l<c;l++){const d=h[l];d.time>=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<l;h++){const c=o[h];if(!(c instanceof Xl))continue;const u=c.events,d=c.frames,f=d.length;if(r>=a){for(let p=0;p<f;p++)if(!(d[p]<a)){if(d[p]>=r)break;this.events.push(u[p])}}else{for(let m=0;m<f&&!(d[m]>=r);m++)this.events.push(u[m]);let p=0;for(;p<f&&!(d[p]>=a);p++);for(;p<f;p++)this.events.push(u[p])}}}clearTracks(){const e=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let t=0,i=this.tracks.length;t<i;t++)this.clearTrack(t);this.tracks.length=0,this.queue.drainDisabled=e,this.queue.drain()}clearTrack(e){if(e<0)throw new Error("trackIndex must be >= 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,_l.emptyAnimation,!1);return i.mixDuration=t,i.trackEnd=t,i}addEmptyAnimation(e,t=0,i=0){const n=this.addAnimation(e,_l.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;i<n;i++){const r=this.tracks[i];r&&this.setEmptyAnimation(r.trackIndex,e)}this.queue.drainDisabled=t,this.queue.drain()}expandToIndex(e){return e<this.tracks.length?this.tracks[e]:(lt.ensureArrayCapacity(this.tracks,e+1,null),this.tracks.length=e+1,null)}trackEntry(e,t,i,n){const r=this.trackEntryPool.obtain();return r.reset(),r.trackIndex=e,r.animation=t,r.loop=i,r.additive=!1,r.reverse=!1,r.shortestRotation=!1,r.eventThreshold=0,r.alphaAttachmentThreshold=0,r.mixAttachmentThreshold=0,r.mixDrawOrderThreshold=0,r.animationStart=0,r.animationEnd=t.duration,r.animationLast=-1,r.nextAnimationLast=-1,r.delay=0,r.trackTime=0,r.trackLast=-1,r.nextTrackLast=-1,r.trackEnd=Number.MAX_VALUE,r.timeScale=1,r.alpha=1,r.mixTime=0,r.mixDuration=n?this.data.getMix(n.animation,t):0,r.totalAlpha=0,r.keepHold=!1,r}clearNext(e){let t=e.next;for(;t;)this.queue.dispose(t),t=t.next;e.next=null}_animationsChanged(){this.animationsChanged=!1;const e=this.tracks;for(let t=0,i=e.length;t<i;t++){const n=e[t];if(!n)continue;let r=n;for(;r.mixingFrom;)r=r.mixingFrom;do this.computeHold(r,n),r=r.mixingTo;while(r)}this.propertyIds.clear()}computeHold(e,t){var c,u;const i=e.animation.timelines,n=e.animation.timelines.length,r=e.timelineMode;r.length=n;const a=e.timelineHoldMix;a.length=0;const o=e.additive,h=e.keepHold,l=e.mixingTo;for(let d=0;d<n;d++){const f=i[d],p=f.propertyIds,m=this.from(t,f,p);if(o&&f.additive){r[d]=m;continue}let g;if(l===null||f.instant||l.additive&&f.additive||!((c=l.animation)!=null&&c.hasTimeline(p)))g=m;else{g=m|Nc;for(let v=l.mixingTo;v!=null;v=v.mixingTo)if(v.additive&&f.additive||!((u=v.animation)!=null&&u.hasTimeline(p))){v.mixDuration>0&&(a[d]=v);break}}h&&(g=g&~Nc|r[d]&Nc),r[d]=g}}from(e,t,i){const n=this.propertyIds;let r=oO;for(let a=0,o=i.length;a<o;a++){const h=n.get(i[a]);if(h===void 0)n.set(i[a],e);else{if(h!==e){for(;++a<o;)n.has(i[a])||n.set(i[a],e);return cy}r=hy}}if(t instanceof Fo){const a=n.get(Vr.propertyID);if(a!=null)return a!==e?cy:hy}return r}getTrack(e){if(e<0)throw new Error("trackIndex must be >= 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(_l,"emptyAnimation",new Op("<empty>",[],0));let ly=_l;class rO{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<e)return e}return this.trackTime}wasApplied(){return this.nextTrackLast!==-1}isNextReady(){return this.next!=null&&this.nextTrackLast-this.next.delay>=0}}class aO{constructor(e){x(this,"objects",[]);x(this,"drainDisabled",!1);x(this,"animState");this.animState=e}start(e){this.objects.push(fs.start),this.objects.push(e),this.animState.animationsChanged=!0}interrupt(e){this.objects.push(fs.interrupt),this.objects.push(e)}end(e){this.objects.push(fs.end),this.objects.push(e),this.animState.animationsChanged=!0}dispose(e){this.objects.push(fs.dispose),this.objects.push(e)}complete(e){this.objects.push(fs.complete),this.objects.push(e)}event(e,t){this.objects.push(fs.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<this.objects.length;o+=2){const h=this.objects,l=h[o],c=h[o+1],u=this.animState.listeners.slice();switch(l){case fs.start:(e=c.listener)!=null&&e.start&&c.listener.start(c);for(let d=0;d<u.length;d++){const f=u[d];f.start&&f.start(c)}break;case fs.interrupt:(t=c.listener)!=null&&t.interrupt&&c.listener.interrupt(c);for(let d=0;d<u.length;d++){const f=u[d];f.interrupt&&f.interrupt(c)}break;case fs.end:(i=c.listener)!=null&&i.end&&c.listener.end(c);for(let d=0;d<u.length;d++){const f=u[d];f.end&&f.end(c)}case fs.dispose:(n=c.listener)!=null&&n.dispose&&c.listener.dispose(c);for(let d=0;d<u.length;d++){const f=u[d];f.dispose&&f.dispose(c)}this.animState.trackEntryPool.free(c);break;case fs.complete:(r=c.listener)!=null&&r.complete&&c.listener.complete(c);for(let d=0;d<u.length;d++){const f=u[d];f.complete&&f.complete(c)}break;case fs.event:{const d=h[o+++2];(a=c.listener)!=null&&a.event&&c.listener.event(c,d);for(let f=0;f<u.length;f++){const p=u[f];p.event&&p.event(c,d)}break}}}this.clear(),this.drainDisabled=!1}}clear(){this.objects.length=0}}var fs;(function(s){s[s.start=0]="start",s[s.interrupt=1]="interrupt",s[s.end=2]="end",s[s.dispose=3]="dispose",s[s.complete=4]="complete",s[s.event=5]="event"})(fs||(fs={}));class I8{start(e){}interrupt(e){}end(e){}dispose(e){}complete(e){}event(e,t){}}const cy=0,oO=1,hy=2,uy=3,Nc=4,dy=1,fy=2;class Lp extends pr{constructor(t){super(t);x(this,"color",new xt(1,1,1,1))}copy(){const t=new Lp(this.name);return this.copyTo(t),t.color.setFromColor(this.color),t}}class Pu extends pr{constructor(t){super(t);x(this,"endSlot",null);x(this,"convex",!1);x(this,"inverse",!1);x(this,"color",new xt(.2275,.2275,.8078,1))}copy(){const t=new Pu(this.name);return this.copyTo(t),t.endSlot=this.endSlot,t.convex=this.convex,t.inverse=this.inverse,t.color.setFromColor(this.color),t}}class Vl extends pr{constructor(t){super(t);x(this,"lengths",[]);x(this,"closed",!1);x(this,"constantSpeed",!1);x(this,"color",new xt(1,1,1,1))}copy(){const t=new Vl(this.name);return this.copyTo(t),t.lengths=[],lt.arrayCopy(this.lengths,0,t.lengths,0,this.lengths.length),t.closed=this.closed,t.constantSpeed=this.constantSpeed,t.color.setFromColor(this.color),t}}class Dp extends pr{constructor(t){super(t);x(this,"x",0);x(this,"y",0);x(this,"rotation",0);x(this,"color",new xt(.38,.94,0,1))}computeWorldPosition(t,i){return i.x=this.x*t.a+this.y*t.b+t.worldX,i.y=this.x*t.c+this.y*t.d+t.worldY,i}computeWorldRotation(t){const i=this.rotation*Ve.degRad,n=Math.cos(i),r=Math.sin(i),a=n*t.a+r*t.b,o=n*t.c+r*t.d;return Ve.atan2Deg(o,a)}copy(){const t=new Dp(this.name);return t.x=this.x,t.y=this.y,t.rotation=this.rotation,t.color.setFromColor(this.color),t}}class Np{constructor(e,t){x(this,"name");x(this,"setupPose");x(this,"skinRequired",!1);if(e==null)throw new Error("name cannot be null.");this.name=e,this.setupPose=t}}class ku extends Np{constructor(t,i,n){super(i,new Pm);x(this,"index",0);x(this,"parent",null);x(this,"length",0);x(this,"color",new xt);x(this,"icon");x(this,"iconSize",1);x(this,"iconRotation",0);x(this,"visible",!1);if(t<0)throw new Error("index must be >= 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 mi;(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"})(mi||(mi={}));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",mi.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)*Ve.degRad,m=(t+90+a)*Ve.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 mi.Normal:{const d=(t+r)*Ve.degRad,f=(t+90+a)*Ve.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 mi.OnlyTranslation:{const d=e.scaleX,f=e.scaleY,p=(t+r)*Ve.degRad,m=(t+90+a)*Ve.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 mi.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>Ve.epsilon2?(g=Math.abs(h*u*m-l*p*c)/g,l=c*g,u=h*g,v=t-Ve.atan2Deg(c,h)):(h=0,c=0,v=t-90+Ve.atan2Deg(u,l));const b=(v+r)*Ve.degRad,y=(v+a+90)*Ve.degRad,w=Math.cos(b)*i,A=Math.cos(y)*n,T=Math.sin(b)*i,M=Math.sin(y)*n;this.a=(h*w-l*T)*d,this.b=(h*A-l*M)*d,this.c=(c*w+u*T)*f,this.d=(c*A+u*M)*f;break}case mi.NoScale:case mi.NoScaleOrReflection:{const d=e.scaleX,f=e.scaleY,p=1/d,m=1/f,g=t*Ve.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,M=y;this.inherit===mi.NoScale&&h*u-l*c<0!=(d<0!=f<0)&&(T=-T,M=-M);const R=r*Ve.degRad,P=(90+a)*Ve.degRad,F=Math.cos(R)*i,I=Math.cos(P)*n,k=Math.sin(R)*i,O=Math.sin(P)*n;this.a=(y*F+T*k)*d,this.b=(y*I+T*O)*d,this.c=(w*F+M*k)*f,this.d=(w*I+M*O)*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 mi.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 mi.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 mi.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,M=1/(r*r+o*o),R=1/Math.abs(l*v*b);this.set5((r*y+o*A)*M,(r*w+o*T)*M,(r*A-o*y)*R,(r*T-o*w)*R,Ve.atan2Deg(o,r));break}case mi.NoScale:case mi.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 M=h*this.a-a*this.c,R=r*this.c-o*this.a;l<0&&(M=-M,R=-R);let P=Ve.atan2Deg(R,M);this.rotation=P,P*=Ve.degRad;const F=Math.cos(P),I=Math.sin(P);let k=(r*F+a*I)*v,O=(o*F+h*I)*b;const L=1/Math.sqrt(k*k+O*O);k*=L,O*=L;const U=this.inherit===mi.NoScale&&l<0!=(t<0!=i<0)?-1:1;this.set4(k*y+O*A,k*w+O*T,(k*A-O*y)*U,(k*T-O*w)*U)}}}set4(e,t,i,n){const r=e*e+i*i,a=t*t+n*n;r>Ve.epsilon2?(this.shearX=Ve.atan2Deg(i,e),this.scaleX=Math.sqrt(r)):(this.shearX=0,this.scaleX=0),this.scaleY=Math.sqrt(a),a>Ve.epsilon2?(this.shearY=Ve.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>Ve.epsilon2){const h=Ve.atan2Deg(i,e);this.rotation=h+r,this.scaleX=Math.sqrt(a),this.scaleY=Math.sqrt(o),o>Ve.epsilon2?(this.shearY=Ve.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>Ve.epsilon2?Ve.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;n<r;n++){const a=i[n].appliedPose;a.world===t&&(a.local===t&&a.updateLocalTransform(e),a.world=0,a.resetWorld(e,t))}}getWorldRotationX(){return Ve.atan2Deg(this.c,this.a)}getWorldRotationY(){return Ve.atan2Deg(this.d,this.b)}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){if(e==null)throw new Error("world cannot be null.");const t=this.a*this.d-this.b*this.c,i=e.x-this.worldX,n=e.y-this.worldY;return e.x=(i*this.d-n*this.b)/t,e.y=(n*this.a-i*this.c)/t,e}localToWorld(e){if(e==null)throw new Error("local cannot be null.");const 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.bone.parent==null?e:this.bone.parent.appliedPose.worldToLocal(e)}parentToWorld(e){if(e==null)throw new Error("world cannot be null.");return this.bone.parent==null?e:this.bone.parent.appliedPose.localToWorld(e)}worldToLocalRotation(e){e*=Ve.degRad;const t=Math.sin(e),i=Math.cos(e);return Ve.atan2Deg(this.a*t-this.c*i,this.d*i-this.b*t)+this.rotation-this.shearX}localToWorldRotation(e){e=(e-this.rotation-this.shearX)*Ve.degRad;const t=Math.sin(e),i=Math.cos(e);return Ve.atan2Deg(i*this.c+t*this.d,i*this.a+t*this.b)}rotateWorld(e){e*=Ve.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}}class mS{constructor(e,t,i){x(this,"data");x(this,"pose");x(this,"constrainedPose");x(this,"appliedPose");if(e==null)throw new Error("data cannot be null.");this.data=e,this.pose=t,this.constrainedPose=i,this.appliedPose=t}setupPose(){this.pose.set(this.data.setupPose)}getData(){return this.data}getPose(){return this.pose}getAppliedPose(){return this.appliedPose}unconstrained(){this.appliedPose=this.pose}constrained(){this.appliedPose=this.constrainedPose}resetConstrained(){this.constrainedPose.set(this.pose)}}class pS extends mS{constructor(t,i,n){super(t,i,n);x(this,"active",!1);this.setupPose()}isActive(){return this.active}}class wl extends pS{constructor(t,i){super(t,new Pm,new Pm);x(this,"parent",null);x(this,"children",[]);x(this,"sorted",!1);this.parent=i,this.appliedPose.bone=this,this.constrainedPose.bone=this}copy(t){const i=new wl(this.data,t);return i.pose.set(this.pose),i}}class Ql extends pS{constructor(e,t,i){super(e,t,i)}isSourceActive(){return!0}}class lO{constructor(e){x(this,"_setupPose");x(this,"pose");x(this,"constrainedPose");x(this,"appliedPose");this._setupPose=e,this.pose=[...e],this.constrainedPose=[],this.appliedPose=this.pose}setupPose(){this.pose.length=this._setupPose.length,lt.arrayCopy(this._setupPose,0,this.pose,0,this._setupPose.length)}unconstrained(){this.appliedPose=this.pose}constrained(){this.appliedPose=this.constrainedPose}resetConstrained(){this.constrainedPose.length=this.pose.length,lt.arrayCopy(this.pose,0,this.constrainedPose,0,this.pose.length)}}class ec extends Np{constructor(e,t){super(e,t)}}var as;(function(s){s[s.None=0]="None",s[s.Uniform=1]="Uniform",s[s.Volume=2]="Volume"})(as||(as={}));let Up=class{constructor(e,t){x(this,"time",0);x(this,"data");x(this,"intValue",0);x(this,"floatValue",0);x(this,"stringValue",null);x(this,"volume",0);x(this,"balance",0);if(!t)throw new Error("data cannot be null.");this.time=e,this.data=t}};class gS{constructor(e){x(this,"name");x(this,"_audioPath",null);x(this,"setupPose",new Up(-1,this));this.name=e}get audioPath(){return this._audioPath}set audioPath(e){if(e==null)throw new Error("audioPath cannot be null.");this._audioPath=e}}class km{constructor(){x(this,"bendDirection",0);x(this,"compress",!1);x(this,"stretch",!1);x(this,"mix",0);x(this,"softness",0)}set(e){this.mix=e.mix,this.softness=e.softness,this.bendDirection=e.bendDirection,this.compress=e.compress,this.stretch=e.stretch}}class Cr extends Ql{constructor(t,i){super(t,new km,new km);x(this,"bones");x(this,"target");if(!i)throw new Error("skeleton cannot be null.");this.bones=[];for(const n of t.bones)this.bones.push(i.bones[n.index].constrainedPose);this.target=i.bones[t.target.index]}copy(t){var i=new Cr(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.target.appliedPose,a=this.bones;switch(a.length){case 1:Cr.apply(t,a[0],r.worldX,r.worldY,n.compress,n.stretch,this.data.scaleYMode,n.mix);break;case 2:Cr.apply(t,a[0],a[1],r.worldX,r.worldY,n.bendDirection,n.stretch,this.data.scaleYMode,n.softness,n.mix);break}}sort(t){t.sortBone(this.target);const i=this.bones[0].bone;t.sortBone(i),t._updateCache.push(this),i.sorted=!1,t.sortReset(i.children),t.constrained(i),this.bones.length>1&&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"?Cr.apply1(t,i,n,r,a,o,h,l):Cr.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 mi.OnlyTranslation:g=(n-i.worldX)*Ve.signum(t.scaleX),v=(r-i.worldY)*Ve.signum(t.scaleY);break;case mi.NoRotationOrReflection:{const b=Math.abs(u*p-d*f)/Math.max(Ve.epsilon,u*u+f*f),y=u/t.scaleX,w=f/t.scaleY;d=-w*b*t.scaleX,p=y*b*t.scaleY,m+=Ve.atan2Deg(w,y)}default:{const b=n-c.worldX,y=r-c.worldY,w=u*p-d*f;Math.abs(w)<=Ve.epsilon?(g=0,v=0):(g=(b*p-y*d)/w-i.x,v=(y*u-b*f)/w-i.y)}}if(m+=Ve.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 mi.NoScale:case mi.NoScaleOrReflection:g=n-i.worldX,v=r-i.worldY}const b=i.bone.data.length*i.scaleX;if(b>Ve.epsilon){const y=g*g+v*v;if(a&&y<b*b||o&&y>b*b){const w=(Math.sqrt(y)/b-1)*l+1;switch(i.scaleX*=w,h){case as.Uniform:i.scaleY*=w;break;case as.Volume:i.scaleY/=w<.7?.25+.642857*w:w}}}}}static apply2(t,i,n,r,a,o,h,l,c,u){if(i.inherit!==mi.Normal||n.inherit!==mi.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,M=i.b,R=i.c,P=i.d;const F=Math.abs(p-m)<=Ve.epsilon;!F||h?(n.y=0,w=T*n.x+i.worldX,A=R*n.x+i.worldY):(w=T*n.x+M*n.y+i.worldX,A=R*n.x+P*n.y+i.worldY);const I=i.bone.parent.appliedPose;T=I.a,M=I.b,R=I.c,P=I.d;let k=T*P-M*R,O=w-I.worldX,L=A-I.worldY;k=Math.abs(k)<=Ve.epsilon?0:1/k;const U=(O*P-L*M)*k-d,B=(L*T-O*R)*k-f;let D=Math.sqrt(U*U+B*B),_=n.bone.data.length*g,X,N;if(D<Ve.epsilon){Cr.apply(t,i,r,a,!1,h,as.None,u),n.rotation=0;return}O=r-I.worldX,L=a-I.worldY;let V=(O*P-L*M)*k-d,G=(L*T-O*R)*k-f,j=V*V+G*G;if(c!==0){c*=p*(g+1)*.5;const Q=Math.sqrt(j),de=Q-D-_*p+c;if(de>0){let me=Math.min(1,de/(c*2))-1;me=(de-c*(1-me*me))/Q,V-=me*V,G-=me*G,j=V*V+G*G}}e:if(F){_*=p;let Q=(j-D*D-_*_)/(2*D*_);if(Q<-1)Q=-1,N=Math.PI*o;else if(Q>1){if(Q=1,N=0,h)switch(T=(Math.sqrt(j)/(D+_)-1)*u+1,i.scaleX*=T,l){case as.Uniform:i.scaleY*=T;break;case as.Volume:i.scaleY/=T<.7?.25+.642857*T:T}}else N=Math.acos(Q)*o;T=D+_*Q,M=_*Math.sin(N),X=Math.atan2(G*T-V*M,V*T+G*M)}else{T=p*_,M=m*_;const Q=T*T,de=M*M,me=Math.atan2(G,V);R=de*D*D+Q*j-Q*de;const we=-2*de*D,Re=de-Q;if(P=we*we-4*Re*R,P>=0){let ve=Math.sqrt(P);we<0&&(ve=-ve),ve=-(we+ve)*.5;let re=ve/Re,ye=R/ve;const he=Math.abs(re)<Math.abs(ye)?re:ye;if(re=j-he*he,re>=0){L=Math.sqrt(re)*o,X=me-Math.atan2(L,he),N=Math.atan2(L/m,(he-D)/p);break e}}let ge=Ve.PI,Ae=D-T,H=Ae*Ae,K=0,q=0,z=D+T,ee=z*z,le=0;R=-T*D/(Q-de),R>=-1&&R<=1&&(R=Math.acos(R),O=T*Math.cos(R)+D,L=M*Math.sin(R),P=O*O+L*L,P<H&&(ge=R,H=P,Ae=O,K=L),P>ee&&(q=R,ee=P,z=O,le=L)),j<=(H+ee)*.5?(X=me-Math.atan2(K*o,Ae),N=ge*o):(X=me-Math.atan2(le*o,z),N=q*o)}const ne=Math.atan2(n.y,n.x)*y;X=(X-ne)*Ve.radDeg+v-i.rotation,X>180?X-=360:X<=-180&&(X+=360),i.rotation+=X*u,N=((N+ne)*Ve.radDeg-n.shearX)*y+b-n.rotation,N>180?N-=360:N<=-180&&(N+=360),n.rotation+=N*u}}class Qc extends ec{constructor(t){super(t,new km);x(this,"bones",[]);x(this,"_target",null);x(this,"_scaleYMode",as.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 Cr(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",On.Fixed);x(this,"spacingMode",Fi.Fixed);x(this,"rotateMode",Pa.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 On;(function(s){s[s.Fixed=0]="Fixed",s[s.Percent=1]="Percent"})(On||(On={}));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 Pa;(function(s){s[s.Tangent=0]="Tangent",s[s.Chain=1]="Chain",s[s.ChainScale=2]="ChainScale"})(Pa||(Pa={}));const Hs=class Hs 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 Hs(this.data,t);return i.pose.set(this.pose),i}update(t,i){const n=this.slot.appliedPose.attachment;if(!(n instanceof Vl))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===Pa.Tangent,u=l.rotateMode===Pa.ChainScale,d=this.bones,f=d.length,p=c?f:f+1,m=lt.setArraySize(this.spaces,p),g=u?this.lengths=lt.setArraySize(this.lengths,f):[],v=r.spacing;switch(l.spacingMode){case Fi.Percent:if(u)for(let M=0,R=p-1;M<R;M++){const P=d[M],F=P.bone.data.length,I=F*P.a,k=F*P.c;g[M]=Math.sqrt(I*I+k*k)}lt.arrayFill(m,1,p,v);break;case Fi.Proportional:{let M=0;for(let R=0,P=p-1;R<P;){const F=d[R],I=F.bone.data.length;if(I<Ve.epsilon)u&&(g[R]=0),m[++R]=v;else{const k=I*F.a,O=I*F.c,L=Math.sqrt(k*k+O*O);u&&(g[R]=L),m[++R]=L,M+=L}}if(M>0){M=p/M*v;for(let R=1;R<p;R++)m[R]*=M}break}default:{const M=l.spacingMode===Fi.Length;for(let R=0,P=p-1;R<P;){const F=d[R],I=F.bone.data.length;if(I<Ve.epsilon)u&&(g[R]=0),m[++R]=v;else{const k=I*F.a,O=I*F.c,L=Math.sqrt(k*k+O*O);u&&(g[R]=L),m[++R]=(M?Math.max(0,I+v):v)*L/I}}}}const b=this.computeWorldPositions(t,n,p,c);let y=b[0],w=b[1],A=l.offsetRotation,T=!1;if(A===0)T=l.rotateMode===Pa.Chain;else{T=!1;const M=this.slot.bone.appliedPose;A*=M.a*M.d-M.b*M.c>0?Ve.degRad:-Ve.degRad}for(let M=0,R=3;M<f;M++,R+=3){const P=d[M];P.modifyWorld(t),P.worldX+=(y-P.worldX)*o,P.worldY+=(w-P.worldY)*h;const F=b[R],I=b[R+1],k=F-y,O=I-w;if(u){const L=g[M];if(L!==0){const U=(Math.sqrt(k*k+O*O)/L-1)*a+1;P.a*=U,P.c*=U}}if(y=F,w=I,a>0){let L=P.a,U=P.b,B=P.c,D=P.d,_=0,X=0,N=0;if(c?_=b[R-1]:m[M+1]===0?_=b[R+2]:_=Math.atan2(O,k),_-=Math.atan2(B,L),T){X=Math.cos(_),N=Math.sin(_);const V=P.bone.data.length;y+=(V*(X*L-N*B)-k)*a,w+=(V*(N*L+X*B)-O)*a}else _+=A;_>Ve.PI?_-=Ve.PI2:_<-Ve.PI&&(_+=Ve.PI2),_*=a,X=Math.cos(_),N=Math.sin(_),P.a=X*L-N*B,P.b=X*U-N*D,P.c=N*L+X*B,P.d=N*U+X*D}}}computeWorldPositions(t,i,n,r){const a=this.slot;let o=this.appliedPose.position,h=this.spaces,l=lt.setArraySize(this.positions,n*3+2),c=this.world;const u=i.closed;let d=i.worldVerticesLength,f=d/6,p=Hs.NONE;if(!i.constantSpeed){const N=i.lengths;f-=u?1:2;const V=N[f];this.data.positionMode===On.Percent&&(o*=V);let G;switch(this.data.spacingMode){case Fi.Percent:G=V;break;case Fi.Proportional:G=V/n;break;default:G=1}c=lt.setArraySize(this.world,8);for(let j=0,ne=0,Q=0;j<n;j++,ne+=3){const de=h[j]*G;o+=de;let me=o;if(u)me%=V,me<0&&(me+=V),Q=0;else if(me<0){p!==Hs.BEFORE&&(p=Hs.BEFORE,i.computeWorldVertices(t,a,2,4,c,0,2)),this.addBeforePosition(me,c,0,l,ne);continue}else if(me>V){p!==Hs.AFTER&&(p=Hs.AFTER,i.computeWorldVertices(t,a,d-6,4,c,0,2)),this.addAfterPosition(me-V,c,0,l,ne);continue}for(;;Q++){const we=N[Q];if(!(me>we)){if(Q===0)me/=we;else{const Re=N[Q-1];me=(me-Re)/(we-Re)}break}}Q!==p&&(p=Q,u&&Q===f?(i.computeWorldVertices(t,a,d-4,4,c,0,2),i.computeWorldVertices(t,a,0,4,c,4,2)):i.computeWorldVertices(t,a,Q*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,ne,r||j>0&&de===0)}return l}u?(d+=2,c=lt.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=lt.setArraySize(this.world,d),i.computeWorldVertices(t,a,2,d,c,0,2));const m=lt.setArraySize(this.curves,f);let g=0,v=c[0],b=c[1],y=0,w=0,A=0,T=0,M=0,R=0,P=0,F=0,I=0,k=0,O=0,L=0,U=0,B=0;for(let N=0,V=2;N<f;N++,V+=6)y=c[V],w=c[V+1],A=c[V+2],T=c[V+3],M=c[V+4],R=c[V+5],P=(v-y*2+A)*.1875,F=(b-w*2+T)*.1875,I=((y-A)*3-v+M)*.09375,k=((w-T)*3-b+R)*.09375,O=P*2+I,L=F*2+k,U=(y-v)*.75+P+I*.16666667,B=(w-b)*.75+F+k*.16666667,g+=Math.sqrt(U*U+B*B),U+=O,B+=L,O+=I,L+=k,g+=Math.sqrt(U*U+B*B),U+=O,B+=L,g+=Math.sqrt(U*U+B*B),U+=O+I,B+=L+k,g+=Math.sqrt(U*U+B*B),m[N]=g,v=M,b=R;this.data.positionMode===On.Percent&&(o*=g);let D;switch(this.data.spacingMode){case Fi.Percent:D=g;break;case Fi.Proportional:D=g/n;break;default:D=1}const _=this.segments;let X=0;for(let N=0,V=0,G=0,j=0;N<n;N++,V+=3){const ne=h[N]*D;o+=ne;let Q=o;if(u)Q%=g,Q<0&&(Q+=g),G=0,j=0;else if(Q<0){this.addBeforePosition(Q,c,0,l,V);continue}else if(Q>g){this.addAfterPosition(Q-g,c,d-4,l,V);continue}for(;;G++){const de=m[G];if(!(Q>de)){if(G===0)Q/=de;else{const me=m[G-1];Q=(Q-me)/(de-me)}break}}if(G!==p){p=G;let de=G*6;for(v=c[de],b=c[de+1],y=c[de+2],w=c[de+3],A=c[de+4],T=c[de+5],M=c[de+6],R=c[de+7],P=(v-y*2+A)*.03,F=(b-w*2+T)*.03,I=((y-A)*3-v+M)*.006,k=((w-T)*3-b+R)*.006,O=P*2+I,L=F*2+k,U=(y-v)*.3+P+I*.16666667,B=(w-b)*.3+F+k*.16666667,X=Math.sqrt(U*U+B*B),_[0]=X,de=1;de<8;de++)U+=O,B+=L,O+=I,L+=k,X+=Math.sqrt(U*U+B*B),_[de]=X;U+=O,B+=L,X+=Math.sqrt(U*U+B*B),_[8]=X,U+=O+I,B+=L+k,X+=Math.sqrt(U*U+B*B),_[9]=X,j=0}for(Q*=X;;j++){const de=_[j];if(!(Q>de)){if(j===0)Q/=de;else{const me=_[j-1];Q=j+(Q-me)/(de-me)}break}}this.addCurvePosition(Q*.1,v,b,y,w,A,T,M,R,l,V,r||N>0&&ne===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,M=i*b+r*A+o*T+l*m,R=n*b+a*A+h*T+c*m;u[d]=M,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),M-(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;o<a;o++){const h=r[o].bone;t.sortBone(h),t.constrained(h)}t._updateCache.push(this);for(let o=0;o<a;o++)t.sortReset(r[o].bone.children);for(let o=0;o<a;o++)r[o].bone.sorted=!0}sortPathSlot(t,i,n,r){const a=i.getAttachments();for(let o=0,h=a.length;o<h;o++){const l=a[o];l.slotIndex===n&&this.sortPath(t,l.attachment,r)}}sortPath(t,i,n){if(!(i instanceof Vl))return;const r=i.bones;if(r==null)t.sortBone(n);else{const a=t.bones;for(let o=0,h=r.length;o<h;){let l=r[o++];for(l+=o;o<l;)t.sortBone(a[r[o++]])}}}isSourceActive(){return this.slot.bone.active}};x(Hs,"NONE",-1),x(Hs,"BEFORE",-2),x(Hs,"AFTER",-3);let Om=Hs;var va;(function(s){s[s.none=0]="none",s[s.reset=1]="reset",s[s.update=2]="update",s[s.pose=3]="pose"})(va||(va={}));class Bm{constructor(){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)}set(e){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}}class Lm{constructor(){x(this,"color",new xt(1,1,1,1));x(this,"darkColor",null);x(this,"attachment",null);x(this,"sequenceIndex",0);x(this,"deform",[])}SlotPose(){}set(e){if(e==null)throw new Error("pose cannot be null.");this.color.setFromColor(e.color),this.darkColor!=null&&e.darkColor!=null&&this.darkColor.setFromColor(e.darkColor),this.attachment=e.attachment,this.sequenceIndex=e.sequenceIndex,this.deform.length=0,this.deform.push(...e.deform)}getAttachment(){return this.attachment}setAttachment(e){this.attachment!==e&&((!(e instanceof pr)||!(this.attachment instanceof pr)||e.timelineAttachment!==this.attachment.timelineAttachment)&&(this.deform.length=0),this.attachment=e,this.sequenceIndex=-1)}}class Xp extends mS{constructor(t,i){super(t,new Lm,new Lm);x(this,"skeleton");x(this,"bone");x(this,"attachmentState",0);if(!i)throw new Error("skeleton cannot be null.");this.skeleton=i,this.bone=i.bones[t.boneData.index],t.setupPose.darkColor!=null&&(this.pose.darkColor=new xt,this.constrainedPose.darkColor=new xt),this.setupPose()}copy(t,i,n){const r=new Xp(t.data,this.skeleton);return this.data.setupPose.darkColor!=null&&(r.pose.darkColor=new xt,r.constrainedPose.darkColor=new xt),r.pose.set(t.pose),r}setupPose(){this.pose.color.setFromColor(this.data.setupPose.color),this.pose.darkColor&&this.pose.darkColor.setFromColor(this.data.setupPose.darkColor),this.pose.sequenceIndex=this.data.setupPose.sequenceIndex,this.data.attachmentName?(this.pose.attachment=null,this.pose.setAttachment(this.skeleton.getAttachment(this.data.index,this.data.attachmentName))):this.pose.setAttachment(null)}}const ya=class ya{constructor(e){x(this,"data");x(this,"bones");x(this,"slots");x(this,"drawOrder");x(this,"constraints");x(this,"physics");x(this,"_updateCache",[]);x(this,"resetCache",[]);x(this,"skin",null);x(this,"color");x(this,"scaleX",1);x(this,"_scaleY",1);x(this,"x",0);x(this,"y",0);x(this,"time",0);x(this,"windX",1);x(this,"windY",0);x(this,"gravityX",0);x(this,"gravityY",1);x(this,"_update",0);if(!e)throw new Error("data cannot be null.");this.data=e,this.bones=[];for(let t=0;t<e.bones.length;t++){const i=e.bones[t];let n;if(!i.parent)n=new wl(i,null);else{const r=this.bones[i.parent.index];n=new wl(i,r),r.children.push(n)}this.bones.push(n)}this.slots=[];for(const t of this.data.slots)this.slots.push(new Xp(t,this));this.drawOrder=new lO(this.slots),this.physics=[],this.constraints=[];for(const t of this.data.constraints){const i=t.create(this);i instanceof Fu&&this.physics.push(i),this.constraints.push(i)}this.color=new xt(1,1,1,1),this.updateCache()}static get yDir(){return ya.yDown?-1:1}get scaleY(){return this._scaleY*ya.yDir}set scaleY(e){this._scaleY=e}updateCache(){this._updateCache.length=0,this.resetCache.length=0,this.drawOrder.unconstrained();const e=this.slots;for(let a=0,o=e.length;a<o;a++)e[a].unconstrained();const t=this.bones,i=t.length;for(let a=0,o=i;a<o;a++){const h=t[a];h.sorted=h.data.skinRequired,h.active=!h.sorted,h.unconstrained()}if(this.skin){const a=this.skin.bones;for(let o=0,h=this.skin.bones.length;o<h;o++){let l=this.bones[a[o].index];do l.sorted=!1,l.active=!0,l=l.parent;while(l)}}const n=this.constraints;let r=this.constraints.length;for(let a=0;a<r;a++)n[a].unconstrained();for(let a=0;a<r;a++){const o=n[a];o.active=o.isSourceActive()&&(!o.data.skinRequired||this.skin!=null&&this.skin.constraints.includes(o.data)),o.active&&o.sort(this)}for(let a=0;a<i;a++)this.sortBone(t[a]);r=this._updateCache.length;for(let a=0;a<r;a++){const o=this._updateCache[a];o instanceof wl&&(this._updateCache[a]=o.appliedPose)}}constrained(e){e.pose===e.appliedPose&&(e.constrained(),this.resetCache.push(e))}sortBone(e){if(e.sorted||!e.active)return;const t=e.parent;t&&this.sortBone(t),e.sorted=!0,this._updateCache.push(e)}sortReset(e){for(let t=0,i=e.length;t<i;t++){const n=e[t];n.active&&(n.sorted&&this.sortReset(n.children),n.sorted=!1)}}updateWorldTransform(e){this._update++,this.drawOrder.appliedPose===this.drawOrder.constrainedPose&&this.drawOrder.resetConstrained();const t=this.resetCache;for(let n=0,r=this.resetCache.length;n<r;n++)t[n].resetConstrained();const i=this._updateCache;for(let n=0,r=this._updateCache.length;n<r;n++)i[n].update(this,e)}setupPose(){this.setupPoseBones(),this.setupPoseSlots()}setupPoseBones(){const e=this.bones;for(let i=0,n=e.length;i<n;i++)e[i].setupPose();const t=this.constraints;for(let i=0,n=t.length;i<n;i++)t[i].setupPose()}setupPoseSlots(){this.drawOrder.setupPose();const e=this.slots;for(let t=0,i=e.length;t<i;t++)e[t].setupPose()}getRootBone(){return this.bones.length===0?null:this.bones[0]}findBone(e){if(!e)throw new Error("boneName cannot be null.");const t=this.bones;for(let i=0,n=t.length;i<n;i++)if(t[i].data.name===e)return t[i];return null}findSlot(e){if(!e)throw new Error("slotName cannot be null.");const t=this.slots;for(let i=0,n=t.length;i<n;i++)if(t[i].data.name===e)return t[i];return null}setSkin(e){typeof e=="string"?this.setSkinByName(e):this.setSkinBySkin(e)}setSkinByName(e){const t=this.data.findSkin(e);if(!t)throw new Error(`Skin not found: ${e}`);this.setSkin(t)}setSkinBySkin(e){if(e!==this.skin){if(e)if(this.skin)e.attachAll(this,this.skin);else{const t=this.slots;for(let i=0,n=t.length;i<n;i++){const r=t[i],a=r.data.attachmentName;if(a){const o=e.getAttachment(i,a);o&&r.pose.setAttachment(o)}}}this.skin=e,this.updateCache()}}getAttachment(e,t){return typeof e=="string"?this.getAttachmentByName(e,t):this.getAttachmentByIndex(e,t)}getAttachmentByName(e,t){const i=this.data.findSlot(e);if(!i)throw new Error(`Can't find slot with name ${e}`);return this.getAttachment(i.index,t)}getAttachmentByIndex(e,t){if(!t)throw new Error("placeholder cannot be null.");if(this.skin){const i=this.skin.getAttachment(e,t);if(i)return i}return this.data.defaultSkin?this.data.defaultSkin.getAttachment(e,t):null}setAttachment(e,t){if(!e)throw new Error("slotName cannot be null.");const i=this.findSlot(e);if(!i)throw new Error(`Slot not found: ${e}`);let n=null;if(t&&(n=this.getAttachment(i.data.index,t),!n))throw new Error(`Attachment not found: ${t}, for slot: ${e}`);i.pose.setAttachment(n)}findConstraint(e,t){if(e==null)throw new Error("constraintName cannot be null.");if(t==null)throw new Error("type cannot be null.");const i=this.constraints;for(let n=0,r=i.length;n<r;n++){const a=i[n];if(a instanceof t&&a.data.name===e)return a}return null}getBoundsRect(e){const t=new oy,i=new oy;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.");const r=this.drawOrder.appliedPose,a=r;let o=Number.POSITIVE_INFINITY,h=Number.POSITIVE_INFINITY,l=Number.NEGATIVE_INFINITY,c=Number.NEGATIVE_INFINITY;for(let u=0,d=r.length;u<d;u++){const f=a[u];if(!f.bone.active)continue;let p=0,m=null,g=null;const v=f.appliedPose.attachment;if(v){if(v instanceof Po)p=8,m=lt.setArraySize(i,p,0),v.computeWorldVertices(f,v.getOffsets(f.appliedPose),m,0,2),g=ya.quadTriangles;else if(v instanceof Hr)p=v.worldVerticesLength,m=lt.setArraySize(i,p,0),v.computeWorldVertices(this,f,0,p,m,0,2),g=v.triangles;else if(v instanceof Pu&&n){n.clipEnd(f),n.clipStart(this,f,v);continue}if(m&&g){n!=null&&n.isClipping()&&n.clipTriangles(m,g,g.length)&&(m=n.clippedVertices,p=n.clippedVertices.length);for(let b=0,y=m.length;b<y;b+=2){const w=m[b],A=m[b+1];o=Math.min(o,w),h=Math.min(h,A),l=Math.max(l,w),c=Math.max(c,A)}}}n&&n.clipEnd(f)}n&&n.clipEnd(),e.set(o,h),t.set(l-o,c-h)}setScale(e,t){this.scaleX=e,this.scaleY=t}setPosition(e,t){this.x=e,this.y=t}update(e){this.time+=e}physicsTranslate(e,t){const i=this.physics;for(let n=0,r=i.length;n<r;n++)i[n].translate(e,t)}physicsRotate(e,t,i){const n=this.physics;for(let r=0,a=n.length;r<a;r++)n[r].rotate(e,t,i)}};x(ya,"quadTriangles",[0,1,2,2,3,0]),x(ya,"yDown",!1);let Dm=ya;class Fu extends Ql{constructor(t,i){super(t,new Bm,new Bm);x(this,"bone");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,"xLag",0);x(this,"xVelocity",0);x(this,"yOffset",0);x(this,"yLag",0);x(this,"yVelocity",0);x(this,"rotateOffset",0);x(this,"rotateLag",0);x(this,"rotateVelocity",0);x(this,"scaleOffset",0);x(this,"scaleLag",0);x(this,"scaleVelocity",0);x(this,"remaining",0);x(this,"lastTime",0);if(i==null)throw new Error("skeleton cannot be null.");this.bone=i.bones[t.bone.index].constrainedPose}copy(t){var i=new Fu(this.data,t);return i.pose.set(this.pose),i}reset(t){this.remaining=0,this.lastTime=t.time,this._reset=!0,this.xOffset=0,this.xLag=0,this.xVelocity=0,this.yOffset=0,this.yLag=0,this.yVelocity=0,this.rotateOffset=0,this.rotateLag=0,this.rotateVelocity=0,this.scaleOffset=0,this.scaleLag=0,this.scaleVelocity=0}translate(t,i){this.ux-=t,this.uy-=i,this.cx-=t,this.cy-=i}rotate(t,i,n){const r=n*Ve.degRad,a=Math.cos(r),o=Math.sin(r),h=this.cx-t,l=this.cy-i;this.translate(h*a-l*o-h,h*o+l*a-l)}update(t,i){const n=this.appliedPose,r=n.mix;if(r===0)return;const a=this.data.x>0,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!==va.none){switch(c.modifyWorld(t),i){case va.reset:this.reset(t);case va.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,M=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,M=n.strength;const k=w*n.wind,O=w*n.gravity,L=(k*t.windX+O*t.gravityX)*t.scaleX,U=(k*t.windY+O*t.gravityY)*t.scaleY;do a&&(this.xVelocity+=(L-this.xOffset*M)*T,this.xOffset+=this.xVelocity*d,this.xVelocity*=A),o&&(this.yVelocity-=(U+this.yOffset*M)*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,O=0,L=this.cx-c.worldX,U=this.cy-c.worldY;if(L>R?L=R:L<-R&&(L=-R),U>P?U=P:U<-P&&(U=-P),b=this.remaining,h){O=(this.data.rotate+this.data.shearX)*r,f=this.rotateLag*Math.max(0,1-m/d);let B=Math.atan2(U+this.ty,L+this.tx)-F-(this.rotateOffset-f)*O;this.rotateOffset+=(B-Math.ceil(B*Ve.invPI2-.5)*Ve.PI2)*y,B=(this.rotateOffset-f)*O+F,I=Math.cos(B),k=Math.sin(B),l&&(B=u*c.getWorldScaleX(),B>0&&(this.scaleOffset+=(L*I+U*k)*y/B))}else{I=Math.cos(F),k=Math.sin(F);const B=u*c.getWorldScaleX()-this.scaleLag*Math.max(0,1-m/d);B>0&&(this.scaleOffset+=(L*I+U*k)*y/B)}if(b>=d){A===-1&&(A=n.damping**(60*d),T=d*n.massInverse,M=n.strength);const B=n.wind*t.windX+n.gravity*t.gravityX,D=(n.wind*t.windY+n.gravity*t.gravityY)*Dm.yDir,_=this.rotateOffset,X=this.scaleOffset,N=u/w;for(;;)if(b-=d,l&&(this.scaleVelocity+=(B*I-D*k-this.scaleOffset*M)*T,this.scaleOffset+=this.scaleVelocity*d,this.scaleVelocity*=A),h){if(this.rotateVelocity-=((B*k+D*I)*N+this.rotateOffset*M)*T,this.rotateOffset+=this.rotateVelocity*d,this.rotateVelocity*=A,b<d)break;const V=this.rotateOffset*O+F;I=Math.cos(V),k=Math.sin(V)}else if(b<d)break;this.rotateLag=this.rotateOffset-_,this.scaleLag=this.scaleOffset-X}f=Math.max(0,1-b/d)}this.remaining=b}this.cx=c.worldX,this.cy=c.worldY;break}case va.pose:f=Math.max(0,1-this.remaining/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){let p=(this.rotateOffset-this.rotateLag*f)*r,m=0,g=0,v=0;if(this.data.shearX>0){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 as.Uniform:c.b*=p,c.d*=p;break;case as.Volume:p=Math.abs(p),p=p>=.7?1/p:4-3.67347*p,c.b*=p,c.d*=p}}i!==va.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",as.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<u;c++)h[l[c]].appliedPose.modifyLocal(t);a.apply(t,n.time,n.time,r.loop,null,n.mix,st.current,r.additive,!1,!0)}sort(t){const i=this.bone,n=this.data;i&&!n.local&&t.sortBone(i),t._updateCache.push(this);const r=t.bones,a=n.animation.bones;for(let d=0,f=n.animation.bones.length;d<f;d++){const p=r[a[d]];p.sorted=!1,t.sortReset(p.children),t.constrained(p)}const o=n.animation.timelines,h=t.slots,l=t.constraints,c=t.physics,u=t.physics.length;for(let d=0,f=n.animation.timelines.length;d<f;d++){const p=o[d];if(iO(p))t.constrained(h[p.slotIndex]);else if(p instanceof Vr||p instanceof Fo)t.drawOrder.constrained();else if(p instanceof zr)if(p.constraintIndex===-1)for(let m=0;m<u;m++)t.constrained(c[m]);else t.constrained(l[p.constraintIndex]);else if(nO(p)){const m=p.constraintIndex;m!==-1&&t.constrained(l[m])}}}};x(Ml,"offsets",[0,0,0,0,0,0]);let Um=Ml;class xa extends ec{constructor(t){super(t,new Nm);x(this,"animation");x(this,"additive",!1);x(this,"loop",!1);x(this,"bone",null);x(this,"property");x(this,"scale",0);x(this,"offset",0);x(this,"local",!1);x(this,"max",0)}create(t){return new Um(this,t)}}class vS{constructor(){x(this,"name",null);x(this,"bones",[]);x(this,"slots",[]);x(this,"skins",[]);x(this,"defaultSkin",null);x(this,"events",[]);x(this,"animations",[]);x(this,"constraints",[]);x(this,"x",0);x(this,"y",0);x(this,"width",0);x(this,"height",0);x(this,"referenceScale",100);x(this,"version",null);x(this,"hash",null);x(this,"fps",30);x(this,"imagesPath",null);x(this,"audioPath",null)}findBone(e){if(!e)throw new Error("boneName cannot be null.");const t=this.bones;for(let i=0,n=t.length;i<n;i++)if(t[i].name===e)return t[i];return null}findSlot(e){if(!e)throw new Error("slotName cannot be null.");const t=this.slots;for(let i=0,n=t.length;i<n;i++)if(t[i].name===e)return t[i];return null}findSkin(e){if(!e)throw new Error("skinName cannot be null.");const t=this.skins;for(let i=0,n=t.length;i<n;i++)if(t[i].name===e)return t[i];return null}findEvent(e){if(!e)throw new Error("eventDataName cannot be null.");const t=this.events;for(let i=0,n=t.length;i<n;i++)if(t[i].name===e)return t[i];return null}findSliderAnimations(e){const t=this.constraints;for(let i=0,n=this.constraints.length;i<n;i++){const r=t[i];r instanceof xa&&r.animation!=null&&e.push(r.animation)}return e}findAnimation(e){if(!e)throw new Error("animationName cannot be null.");const t=this.animations;for(let i=0,n=t.length;i<n;i++)if(t[i].name===e)return t[i];return null}findConstraint(e,t){if(!e)throw new Error("constraintName cannot be null.");if(t==null)throw new Error("type cannot be null.");const i=this.constraints;for(let n=0,r=this.constraints.length;n<r;n++){const a=i[n];if(a instanceof t&&a.name===e)return a}return null}}class my{constructor(e=0,t,i){x(this,"slotIndex",0);x(this,"placeholder");x(this,"attachment");this.slotIndex=e,this.placeholder=t,this.attachment=i}}class Xm{constructor(e){x(this,"name");x(this,"attachments",[]);x(this,"bones",[]);x(this,"constraints",[]);x(this,"color",new xt(.99607843,.61960787,.30980393,1));if(!e)throw new Error("name cannot be null.");this.name=e}setAttachment(e,t,i){if(!i)throw new Error("attachment cannot be null.");const n=this.attachments;e>=n.length&&(n.length=e+1),n[e]||(n[e]={}),n[e][t]=i}addSkin(e){for(let i=0;i<e.bones.length;i++){const n=e.bones[i];let r=!1;for(let a=0;a<this.bones.length;a++)if(this.bones[a]===n){r=!0;break}r||this.bones.push(n)}for(let i=0;i<e.constraints.length;i++){const n=e.constraints[i];let r=!1;for(let a=0;a<this.constraints.length;a++)if(this.constraints[a]===n){r=!0;break}r||this.constraints.push(n)}const t=e.getAttachments();for(let i=0;i<t.length;i++){const n=t[i];this.setAttachment(n.slotIndex,n.placeholder,n.attachment)}}copySkin(e){for(let i=0;i<e.bones.length;i++){const n=e.bones[i];let r=!1;for(let a=0;a<this.bones.length;a++)if(this.bones[a]===n){r=!0;break}r||this.bones.push(n)}for(let i=0;i<e.constraints.length;i++){const n=e.constraints[i];let r=!1;for(let a=0;a<this.constraints.length;a++)if(this.constraints[a]===n){r=!0;break}r||this.constraints.push(n)}const t=e.getAttachments();for(let i=0;i<t.length;i++){const n=t[i];n.attachment&&(n.attachment instanceof Hr?(n.attachment=n.attachment.newLinkedMesh(),this.setAttachment(n.slotIndex,n.placeholder,n.attachment)):(n.attachment=n.attachment.copy(),this.setAttachment(n.slotIndex,n.placeholder,n.attachment)))}}getAttachment(e,t){const i=this.attachments[e];return i?i[t]:null}removeAttachment(e,t){const i=this.attachments[e];i&&delete i[t]}getAttachments(){const e=[];for(let t=0;t<this.attachments.length;t++){const i=this.attachments[t];if(i)for(const n in i){const r=i[n];r&&e.push(new my(t,n,r))}}return e}getAttachmentsForSlot(e,t){const i=this.attachments[e];if(i)for(const n in i){const r=i[n];r&&t.push(new my(e,n,r))}}clear(){this.attachments.length=0,this.bones.length=0,this.constraints.length=0}attachAll(e,t){let i=0;for(let n=0;n<e.slots.length;n++){const r=e.slots[n],a=r.pose.getAttachment();if(a&&i<t.attachments.length){const o=t.attachments[i];for(const h in o){const l=o[h];if(a===l){const c=this.getAttachment(i,h);c&&r.pose.setAttachment(c);break}}}i++}}}class yS extends Np{constructor(t,i,n){super(i,new Lm);x(this,"index",0);x(this,"boneData");x(this,"attachmentName",null);x(this,"blendMode",Wh.Normal);x(this,"visible",!0);if(t<0)throw new Error("index must be >= 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 Vp 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 Vp(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;m<g;m++){const v=p[m];o?v.modifyLocal(t):v.modifyWorld(t);for(let b=0;b<f;b++){const y=d[b],w=y.value(t,u,a,c)-y.offset,A=y.to;for(let T=0,M=y.to.length;T<M;T++){const R=A[T];if(R.mix(n)!==0){let P=R.offset+w*R.scale;l&&(R.offset<R.max?P=Ve.clamp(P,R.offset,R.max):P=Ve.clamp(P,R.max,R.offset)),R.apply(t,n,v,P,o,h)}}}}}sort(t){this.data.localSource||t.sortBone(this.source);const i=this.bones,n=this.bones.length,r=!this.data.localTarget;if(r)for(let a=0;a<n;a++)t.sortBone(i[a].bone);t._updateCache.push(this);for(let a=0;a<n;a++){const o=i[a].bone;t.sortReset(o.children),t.constrained(o)}for(let a=0;a<n;a++)i[a].bone.sorted=r}isSourceActive(){return this.source.active}}const Ei=class Ei extends ec{constructor(t){super(t,new Vm);x(this,"bones",[]);x(this,"_source",null);x(this,"offsets",[0,0,0,0,0,0]);x(this,"offsetX",0);x(this,"offsetY",0);x(this,"localSource",!1);x(this,"localTarget",!1);x(this,"additive",!1);x(this,"clamp",!1);x(this,"properties",[])}set source(t){this._source=t}get source(){if(this._source)return this._source;throw new Error("BoneData not set.")}create(t){return new Vp(this,t)}getOffsetRotation(){return this.offsets[Ei.ROTATION]}setOffsetRotation(t){this.offsets[Ei.ROTATION]=t}getOffsetX(){return this.offsets[Ei.X]}setOffsetX(t){this.offsets[Ei.X]=t}getOffsetY(){return this.offsets[Ei.Y]}setOffsetY(t){this.offsets[Ei.Y]=t}getOffsetScaleX(){return this.offsets[Ei.SCALEX]}setOffsetScaleX(t){this.offsets[Ei.SCALEX]=t}getOffsetScaleY(){return this.offsets[Ei.SCALEY]}setOffsetScaleY(t){this.offsets[Ei.SCALEY]=t}getOffsetShearY(){return this.offsets[Ei.SHEARY]}setOffsetShearY(t){this.offsets[Ei.SHEARY]=t}};x(Ei,"ROTATION",0),x(Ei,"X",1),x(Ei,"Y",2),x(Ei,"SCALEX",3),x(Ei,"SCALEY",4),x(Ei,"SHEARY",5);let $t=Ei;class No{constructor(){x(this,"offset",0);x(this,"to",[])}}class Uo{constructor(){x(this,"offset",0);x(this,"max",0);x(this,"scale",0)}}class Ym extends No{value(e,t,i,n){if(i)return t.rotation+n[$t.ROTATION];const r=e.scaleX,a=e.scaleY;let o=Math.atan2(t.c/a,t.a/r)*Ve.radDeg+((t.a*t.d-t.b*t.c)*r*a>0?n[$t.ROTATION]:-n[$t.ROTATION]);return o<0&&(o+=360),o}}class xS 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*=Ve.degRad,a||(n-=Math.atan2(f,u)),n>Ve.PI?n-=Ve.PI2:n<-Ve.PI&&(n+=Ve.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[$t.X]:(n[$t.X]*t.a+n[$t.Y]*t.b+t.worldX)/e.scaleX}}class bS 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[$t.Y]:(n[$t.X]*t.c+n[$t.Y]*t.d+t.worldY)/e.scaleY}}class wS 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[$t.SCALEX];const r=t.a/e.scaleX,a=t.c/e.scaleY;return Math.sqrt(r*r+a*a)+n[$t.SCALEX]}}class SS 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[$t.SCALEY];const r=t.b/e.scaleX,a=t.d/e.scaleY;return Math.sqrt(r*r+a*a)+n[$t.SCALEY]}}class _S 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[$t.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))*Ve.radDeg-90+n[$t.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)*Ve.degRad,a?n-=Ve.PI/2:(n-=u-Math.atan2(i.c/h,i.a/o),n>Ve.PI?n-=Ve.PI2:n<-Ve.PI&&(n+=Ve.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 P8{constructor(e){x(this,"scale",1);x(this,"attachmentLoader");x(this,"linkedMeshes",[]);this.attachmentLoader=e}readSkeletonData(e){const t=this.scale,i=new vS;i.name="";const n=new cO(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<h;p++){const m=n.readString();if(!m)throw new Error("String in string table must not be null.");n.strings.push(m)}const l=i.bones;h=n.readInt(!0);for(let p=0;p<h;p++){const m=n.readString();if(!m)throw new Error("Bone name must not be null.");const g=p===0?null:l[n.readInt(!0)],v=new ku(p,m,g),b=v.setupPose;b.rotation=n.readFloat(),b.x=n.readFloat()*t,b.y=n.readFloat()*t,b.scaleX=n.readFloat(),b.scaleY=n.readFloat(),b.shearX=n.readFloat(),b.shearY=n.readFloat(),b.inherit=n.readByte(),v.length=n.readFloat()*t,v.skinRequired=n.readBoolean(),o&&(xt.rgba8888ToColor(v.color,n.readInt32()),v.icon=n.readString()??void 0,v.iconSize=n.readFloat(),v.iconRotation=n.readFloat(),v.visible=n.readBoolean()),l.push(v)}h=n.readInt(!0);for(let p=0;p<h;p++){const m=n.readString();if(!m)throw new Error("Slot name must not be null.");const g=l[n.readInt(!0)],v=new yS(p,m,g);xt.rgba8888ToColor(v.setupPose.color,n.readInt32());const b=n.readInt32();b!==-1&&xt.rgb888ToColor(v.setupPose.darkColor=new xt,b),v.attachmentName=n.readStringRef(),v.blendMode=n.readInt(!0),o&&(v.visible=n.readBoolean()),i.slots.push(v)}const c=i.constraints,u=n.readInt(!0);for(let p=0;p<u;p++){const m=n.readString();if(!m)throw new Error("Constraint data name must not be null.");let g;switch(n.readByte()){case RO:{const v=new Qc(m);g=n.readInt(!0);for(let w=0;w<g;w++)v.bones.push(l[n.readInt(!0)]);v.target=l[n.readInt(!0)];const b=n.readByte();v.skinRequired=(b&1)!==0,(b&2)!==0&&(v.scaleYMode=n.readUnsignedByte());const y=v.setupPose;y.bendDirection=(b&4)!==0?-1:1,y.compress=(b&8)!==0,y.stretch=(b&16)!==0,(b&32)!==0&&(y.mix=(b&64)!==0?n.readFloat():1),(b&128)!==0&&(y.softness=n.readFloat()*t),c.push(v);break}case kO:{const v=new $t(m);g=n.readInt(!0);for(let w=0;w<g;w++)v.bones.push(l[n.readInt(!0)]);v.source=l[n.readInt(!0)];let b=n.readUnsignedByte();v.skinRequired=(b&1)!==0,v.localSource=(b&2)!==0,v.localTarget=(b&4)!==0,v.additive=(b&8)!==0,v.clamp=(b&16)!==0,g=b>>5;for(let w=0,A;w<g;w++){let T=1,M;switch(n.readByte()){case 0:M=new Ym;break;case 1:{T=t,M=new $m;break}case 2:{T=t,M=new Gm;break}case 3:M=new Hm;break;case 4:M=new jm;break;case 5:M=new Wm;break;default:M=null}if(M){M.offset=n.readFloat()*T,A=n.readByte();for(let R=0;R<A;R++){let P=1,F;switch(n.readByte()){case 0:F=new xS;break;case 1:{P=t,F=new bS;break}case 2:{P=t,F=new wS;break}case 3:F=new SS;break;case 4:F=new _S;break;case 5:F=new MS;break;default:F=null}F&&(F.offset=n.readFloat()*P,F.max=n.readFloat()*P,F.scale=n.readFloat()*P/T,M.to[R]=F)}v.properties[w]=M}}b=n.readByte(),(b&1)!==0&&(v.offsets[$t.ROTATION]=n.readFloat()),(b&2)!==0&&(v.offsets[$t.X]=n.readFloat()*t),(b&4)!==0&&(v.offsets[$t.Y]=n.readFloat()*t),(b&8)!==0&&(v.offsets[$t.SCALEX]=n.readFloat()),(b&16)!==0&&(v.offsets[$t.SCALEY]=n.readFloat()),(b&32)!==0&&(v.offsets[$t.SHEARY]=n.readFloat()),b=n.readByte();const y=v.setupPose;(b&1)!==0&&(y.mixRotate=n.readFloat()),(b&2)!==0&&(y.mixX=n.readFloat()),(b&4)!==0&&(y.mixY=n.readFloat()),(b&8)!==0&&(y.mixScaleX=n.readFloat()),(b&16)!==0&&(y.mixScaleY=n.readFloat()),(b&32)!==0&&(y.mixShearY=n.readFloat()),c.push(v);break}case PO:{const v=new eh(m);g=n.readInt(!0);for(let w=0;w<g;w++)v.bones.push(l[n.readInt(!0)]);v.slot=i.slots[n.readInt(!0)];const b=n.readByte();v.skinRequired=(b&1)!==0,v.positionMode=b>>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===On.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 FO:{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=as.Volume,w=-2-w):w<0&&(v.scaleYMode=as.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 OO:{const v=new xa(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(lt.setArraySize(i.skins,h=p+n.readInt(!0));p<h;p++){const m=this.readSkin(n,i,!1,o);if(!m)throw new Error("readSkin() should not have returned null.");i.skins[p]=m}}h=this.linkedMeshes.length;for(let p=0;p<h;p++){const m=this.linkedMeshes[p],g=i.skins[m.skinIndex];if(!m.source)throw new Error("Linked mesh parent must not be null");const v=g.getAttachment(m.sourceIndex,m.source);if(!v)throw new Error(`Source mesh not found: ${m.source}`);m.mesh.timelineAttachment=m.inheritTimelines?v:m.mesh,m.mesh.setSourceMesh(v),m.mesh.updateSequence()}this.linkedMeshes.length=0,h=n.readInt(!0);for(let p=0;p<h;p++){const m=n.readString();if(!m)throw new Error("Event data name must not be null");const g=new gS(m),v=g.setupPose;v.intValue=n.readInt(!1),v.floatValue=n.readFloat(),v.stringValue=n.readString(),g._audioPath=n.readString(),g.audioPath&&(v.volume=n.readFloat(),v.balance=n.readFloat()),i.events.push(g)}const f=i.animations;h=n.readInt(!0);for(let p=0;p<h;p++){const m=n.readString();if(!m)throw new Error("Animation name must not be null.");f.push(this.readAnimation(n,m,i,o))}for(let p=0;p<u;p++){const m=c[p];m instanceof xa&&(m.animation=f[n.readInt(!0)])}return i}readSkin(e,t,i,n){let r=null,a=0;if(i){if(a=e.readInt(!0),a===0)return null;r=new Xm("default")}else{const o=e.readString();if(!o)throw new Error("Skin name must not be null.");r=new Xm(o),n&&xt.rgba8888ToColor(r.color,e.readInt32());let h=e.readInt(!0),l=t.bones,c=r.bones;for(let u=0;u<h;u++)c[u]=l[e.readInt(!0)];h=e.readInt(!0),l=t.constraints,c=r.constraints;for(let u=0;u<h;u++)c[u]=l[e.readInt(!0)];a=e.readInt(!0)}for(let o=0;o<a;o++){const h=e.readInt(!0);for(let l=0,c=e.readInt(!0);l<c;l++){const u=e.readStringRef();if(!u)throw new Error("Attachment name must not be null");const d=this.readAttachment(e,t,r,h,u,n);d&&r.setAttachment(h,u,d)}}return r}readAttachment(e,t,i,n,r,a){const o=this.scale,h=e.readByte(),l=(h&8)!==0?e.readStringRef():r;if(!l)throw new Error("Attachment name must not be null");switch(h&7){case jn.Region:{let c=(h&16)!==0?e.readStringRef():null;const u=(h&32)!==0?e.readInt32():4294967295,d=this.readSequence(e,(h&64)!==0),f=(h&128)!==0?e.readFloat():0,p=e.readFloat(),m=e.readFloat(),g=e.readFloat(),v=e.readFloat(),b=e.readFloat(),y=e.readFloat();c||(c=l);const w=this.attachmentLoader.newRegionAttachment(i,r,l,c,d);return w?(w.path=c,w.x=p*o,w.y=m*o,w.scaleX=g,w.scaleY=v,w.rotation=f,w.width=b*o,w.height=y*o,xt.rgba8888ToColor(w.color,u),w.updateSequence(),w):null}case jn.BoundingBox:{const c=this.readVertices(e,(h&16)!==0),u=a?e.readInt32():0,d=this.attachmentLoader.newBoundingBoxAttachment(i,r,l);return d?(d.worldVerticesLength=c.length,d.vertices=c.vertices,d.bones=c.bones,a&&xt.rgba8888ToColor(d.color,u),d):null}case jn.Mesh:{let c=(h&16)!==0?e.readStringRef():l;const u=(h&32)!==0?e.readInt32():4294967295,d=this.readSequence(e,(h&64)!==0),f=e.readInt(!0),p=this.readVertices(e,(h&128)!==0),m=this.readFloatArray(e,p.length,1),g=this.readShortArray(e,(p.length-f-2)*3),v=e.readInt(!0);let b=null;if(v>0){b=[];for(let M=0;M<v;M++)b[M]=e.readInt(!0)}let y=[],w=0,A=0;a&&(y=this.readShortArray(e,e.readInt(!0)),w=e.readFloat(),A=e.readFloat()),c||(c=l);const T=this.attachmentLoader.newMeshAttachment(i,r,l,c,d);return T?(T.path=c,xt.rgba8888ToColor(T.color,u),T.hullLength=f<<1,T.bones=p.bones,T.vertices=p.vertices,T.worldVerticesLength=p.length,T.regionUVs=m,T.triangles=g,b&&(T.timelineSlots=b),a&&(T.edges=y,T.width=w*o,T.height=A*o),T.updateSequence(),T):null}case jn.LinkedMesh:{const c=(h&16)!==0?e.readStringRef():l;if(c==null)throw new Error("Path of linked mesh must not be null");const u=(h&32)!==0?e.readInt32():4294967295,d=this.readSequence(e,(h&64)!==0),f=(h&128)!==0,p=e.readInt(!0),m=e.readInt(!0),g=e.readStringRef();let v=0,b=0;a&&(v=e.readFloat(),b=e.readFloat());const y=this.attachmentLoader.newMeshAttachment(i,r,l,c,d);return y?(y.path=c,xt.rgba8888ToColor(y.color,u),a&&(y.width=v*o,y.height=b*o),this.linkedMeshes.push(new hO(y,m,n,p,g,f)),y):null}case jn.Path:{const c=(h&16)!==0,u=(h&32)!==0,d=this.readVertices(e,(h&64)!==0),f=this.readFloatArray(e,d.length/6,o),p=a?e.readInt32():0,m=this.attachmentLoader.newPathAttachment(i,r,l);return m?(m.closed=c,m.constantSpeed=u,m.worldVerticesLength=d.length,m.vertices=d.vertices,m.bones=d.bones,m.lengths=f,a&&xt.rgba8888ToColor(m.color,p),m):null}case jn.Point:{const c=e.readFloat(),u=e.readFloat(),d=e.readFloat(),f=a?e.readInt32():0,p=this.attachmentLoader.newPointAttachment(i,r,l);return p?(p.x=u*o,p.y=d*o,p.rotation=c,a&&xt.rgba8888ToColor(p.color,f),p):null}case jn.Clipping:{const c=e.readInt(!0),u=this.readVertices(e,(h&16)!==0),d=a?e.readInt32():0,f=this.attachmentLoader.newClippingAttachment(i,r,l);return f?(f.endSlot=t.slots[c],f.convex=(h&32)!==0,f.inverse=(h&64)!==0,f.worldVerticesLength=u.length,f.vertices=u.vertices,f.bones=u.bones,a&&xt.rgba8888ToColor(f.color,d),f):null}}}readSequence(e,t){if(!t)return new ko(1,!1);const i=new ko(e.readInt(!0),!0);return i.start=e.readInt(!0),i.digits=e.readInt(!0),i.setupIndex=e.readInt(!0),i}readVertices(e,t){const i=this.scale,r=e.readInt(!0)<<1;if(!t)return new py(null,this.readFloatArray(e,r,i),r);const a=e.readInt(!0),o=[],h=[];for(let l=0,c=0;l<a;){const u=e.readInt(!0);o[l++]=u;for(let d=0;d<u;d++,c+=3)o[l++]=e.readInt(!0),h[c]=e.readFloat()*i,h[c+1]=e.readFloat()*i,h[c+2]=e.readFloat()}return new py(o,lt.toFloatArray(h),r)}readFloatArray(e,t,i){const n=[];if(i===1)for(let r=0;r<t;r++)n[r]=e.readFloat();else for(let r=0;r<t;r++)n[r]=e.readFloat()*i;return n}readShortArray(e,t){const i=[];for(let n=0;n<t;n++)i[n]=e.readInt(!0);return i}readAnimation(e,t,i,n){e.readInt(!0);const r=[],a=this.scale;for(let f=0,p=e.readInt(!0);f<p;f++){const m=e.readInt(!0);for(let g=0,v=e.readInt(!0);g<v;g++){const b=e.readByte(),y=e.readInt(!0),w=y-1;switch(b){case MO:{const A=new bl(y,m);for(let T=0;T<y;T++)A.setFrame(T,e.readFloat(),e.readStringRef());r.push(A);break}case TO:{const A=e.readInt(!0),T=new zw(y,A,m);let M=e.readFloat(),R=e.readUnsignedByte()/255,P=e.readUnsignedByte()/255,F=e.readUnsignedByte()/255,I=e.readUnsignedByte()/255;for(let k=0,O=0;T.setFrame(k,M,R,P,F,I),k!==w;k++){const L=e.readFloat(),U=e.readUnsignedByte()/255,B=e.readUnsignedByte()/255,D=e.readUnsignedByte()/255,_=e.readUnsignedByte()/255;switch(e.readByte()){case wn:T.setStepped(k);break;case Sn:Lt(e,T,O++,k,0,M,L,R,U,1),Lt(e,T,O++,k,1,M,L,P,B,1),Lt(e,T,O++,k,2,M,L,F,D,1),Lt(e,T,O++,k,3,M,L,I,_,1)}M=L,R=U,P=B,F=D,I=_}r.push(T);break}case AO:{const A=e.readInt(!0),T=new qw(y,A,m);let M=e.readFloat(),R=e.readUnsignedByte()/255,P=e.readUnsignedByte()/255,F=e.readUnsignedByte()/255;for(let I=0,k=0;T.setFrame(I,M,R,P,F),I!==w;I++){const O=e.readFloat(),L=e.readUnsignedByte()/255,U=e.readUnsignedByte()/255,B=e.readUnsignedByte()/255;switch(e.readByte()){case wn:T.setStepped(I);break;case Sn:Lt(e,T,k++,I,0,M,O,R,L,1),Lt(e,T,k++,I,1,M,O,P,U,1),Lt(e,T,k++,I,2,M,O,F,B,1)}M=O,R=L,P=U,F=B}r.push(T);break}case EO:{const A=e.readInt(!0),T=new Zw(y,A,m);let M=e.readFloat(),R=e.readUnsignedByte()/255,P=e.readUnsignedByte()/255,F=e.readUnsignedByte()/255,I=e.readUnsignedByte()/255,k=e.readUnsignedByte()/255,O=e.readUnsignedByte()/255,L=e.readUnsignedByte()/255;for(let U=0,B=0;T.setFrame(U,M,R,P,F,I,k,O,L),U!==w;U++){const D=e.readFloat(),_=e.readUnsignedByte()/255,X=e.readUnsignedByte()/255,N=e.readUnsignedByte()/255,V=e.readUnsignedByte()/255,G=e.readUnsignedByte()/255,j=e.readUnsignedByte()/255,ne=e.readUnsignedByte()/255;switch(e.readByte()){case wn:T.setStepped(U);break;case Sn:Lt(e,T,B++,U,0,M,D,R,_,1),Lt(e,T,B++,U,1,M,D,P,X,1),Lt(e,T,B++,U,2,M,D,F,N,1),Lt(e,T,B++,U,3,M,D,I,V,1),Lt(e,T,B++,U,4,M,D,k,G,1),Lt(e,T,B++,U,5,M,D,O,j,1),Lt(e,T,B++,U,6,M,D,L,ne,1)}M=D,R=_,P=X,F=N,I=V,k=G,O=j,L=ne}r.push(T);break}case CO:{const A=e.readInt(!0),T=new Jw(y,A,m);let M=e.readFloat(),R=e.readUnsignedByte()/255,P=e.readUnsignedByte()/255,F=e.readUnsignedByte()/255,I=e.readUnsignedByte()/255,k=e.readUnsignedByte()/255,O=e.readUnsignedByte()/255;for(let L=0,U=0;T.setFrame(L,M,R,P,F,I,k,O),L!==w;L++){const B=e.readFloat(),D=e.readUnsignedByte()/255,_=e.readUnsignedByte()/255,X=e.readUnsignedByte()/255,N=e.readUnsignedByte()/255,V=e.readUnsignedByte()/255,G=e.readUnsignedByte()/255;switch(e.readByte()){case wn:T.setStepped(L);break;case Sn:Lt(e,T,U++,L,0,M,B,R,D,1),Lt(e,T,U++,L,1,M,B,P,_,1),Lt(e,T,U++,L,2,M,B,F,X,1),Lt(e,T,U++,L,3,M,B,I,N,1),Lt(e,T,U++,L,4,M,B,k,V,1),Lt(e,T,U++,L,5,M,B,O,G,1)}M=B,R=D,P=_,F=X,I=N,k=V,O=G}r.push(T);break}case IO:{const A=new Kw(y,e.readInt(!0),m);let T=e.readFloat(),M=e.readUnsignedByte()/255;for(let R=0,P=0;A.setFrame(R,T,M),R!==w;R++){const F=e.readFloat(),I=e.readUnsignedByte()/255;switch(e.readByte()){case wn:A.setStepped(R);break;case Sn:Lt(e,A,P++,R,0,T,F,M,I,1)}T=F,M=I}r.push(A)}}}}for(let f=0,p=e.readInt(!0);f<p;f++){const m=e.readInt(!0);for(let g=0,v=e.readInt(!0);g<v;g++){const b=e.readByte(),y=e.readInt(!0);if(b===_O){const A=new Ww(y,m);for(let T=0;T<y;T++)A.setFrame(T,e.readFloat(),e.readByte());r.push(A);continue}const w=e.readInt(!0);switch(b){case fO:Ti(e,r,new Gh(y,w,m),1);break;case mO:Ti(e,r,new Nw(y,w,m),a);break;case pO:Ti(e,r,new Uw(y,w,m),a);break;case gO:Ti(e,r,new Xw(y,w,m),a);break;case vO:Ti(e,r,new Vw(y,w,m),1);break;case yO:Ti(e,r,new Yw(y,w,m),1);break;case xO:Ti(e,r,new $w(y,w,m),1);break;case bO:Ti(e,r,new Gw(y,w,m),1);break;case wO:Ti(e,r,new Hw(y,w,m),1);break;case SO:Ti(e,r,new jw(y,w,m),1);break}}}for(let f=0,p=e.readInt(!0);f<p;f++){const m=e.readInt(!0),g=e.readInt(!0),v=g-1,b=new eS(g,e.readInt(!0),m);let y=e.readByte(),w=e.readFloat(),A=(y&1)!==0?(y&2)!==0?e.readFloat():1:0,T=(y&4)!==0?e.readFloat()*a:0;for(let M=0,R=0;b.setFrame(M,w,A,T,(y&8)!==0?1:-1,(y&16)!==0,(y&32)!==0),M!==v;M++){y=e.readByte();const P=e.readFloat(),F=(y&1)!==0?(y&2)!==0?e.readFloat():1:0,I=(y&4)!==0?e.readFloat()*a:0;(y&64)!==0?b.setStepped(M):(y&128)!==0&&(Lt(e,b,R++,M,0,w,P,A,F,1),Lt(e,b,R++,M,1,w,P,T,I,a)),w=P,A=F,T=I}r.push(b)}for(let f=0,p=e.readInt(!0);f<p;f++){const m=e.readInt(!0),g=e.readInt(!0),v=g-1,b=new tS(g,e.readInt(!0),m);let y=e.readFloat(),w=e.readFloat(),A=e.readFloat(),T=e.readFloat(),M=e.readFloat(),R=e.readFloat(),P=e.readFloat();for(let F=0,I=0;b.setFrame(F,y,w,A,T,M,R,P),F!==v;F++){const k=e.readFloat(),O=e.readFloat(),L=e.readFloat(),U=e.readFloat(),B=e.readFloat(),D=e.readFloat(),_=e.readFloat();switch(e.readByte()){case wn:b.setStepped(F);break;case Sn:Lt(e,b,I++,F,0,y,k,w,O,1),Lt(e,b,I++,F,1,y,k,A,L,1),Lt(e,b,I++,F,2,y,k,T,U,1),Lt(e,b,I++,F,3,y,k,M,B,1),Lt(e,b,I++,F,4,y,k,R,D,1),Lt(e,b,I++,F,5,y,k,P,_,1)}y=k,w=O,A=L,T=U,M=B,R=D,P=_}r.push(b)}for(let f=0,p=e.readInt(!0);f<p;f++){const m=e.readInt(!0),g=i.constraints[m];for(let v=0,b=e.readInt(!0);v<b;v++){const y=e.readByte(),w=e.readInt(!0),A=e.readInt(!0);switch(y){case DO:Ti(e,r,new iS(w,A,m),g.positionMode===On.Fixed?a:1);break;case NO:Ti(e,r,new sS(w,A,m),g.spacingMode===Fi.Length||g.spacingMode===Fi.Fixed?a:1);break;case UO:{const T=new nS(w,A,m);let M=e.readFloat(),R=e.readFloat(),P=e.readFloat(),F=e.readFloat();for(let I=0,k=0,O=T.getFrameCount()-1;T.setFrame(I,M,R,P,F),I!==O;I++){const L=e.readFloat(),U=e.readFloat(),B=e.readFloat(),D=e.readFloat();switch(e.readByte()){case wn:T.setStepped(I);break;case Sn:Lt(e,T,k++,I,0,M,L,R,U,1),Lt(e,T,k++,I,1,M,L,P,B,1),Lt(e,T,k++,I,2,M,L,F,D,1)}M=L,R=U,P=B,F=D}r.push(T)}}}}for(let f=0,p=e.readInt(!0);f<p;f++){const m=e.readInt(!0)-1;for(let g=0,v=e.readInt(!0);g<v;g++){const b=e.readByte(),y=e.readInt(!0);if(b===WO){const A=new jh(y,m);for(let T=0;T<y;T++)A.setFrame(T,e.readFloat());r.push(A);continue}const w=e.readInt(!0);switch(b){case XO:Ti(e,r,new rS(y,w,m),1);break;case VO:Ti(e,r,new aS(y,w,m),1);break;case YO:Ti(e,r,new oS(y,w,m),1);break;case $O:Ti(e,r,new lS(y,w,m),1);break;case GO:Ti(e,r,new cS(y,w,m),1);break;case HO:Ti(e,r,new hS(y,w,m),1);break;case jO:Ti(e,r,new uS(y,w,m),1);break;default:throw new Error("Unknown physics timeline type.")}}}for(let f=0,p=e.readInt(!0);f<p;f++){const m=e.readInt(!0);for(let g=0,v=e.readInt(!0);g<v;g++){const b=e.readByte(),y=e.readInt(!0),w=e.readInt(!0);switch(b){case zO:Ti(e,r,new dS(y,w,m),1);break;case qO:Ti(e,r,new fS(y,w,m),1);break;default:throw new Error(`Uknown slider type: ${b}`)}}}for(let f=0,p=e.readInt(!0);f<p;f++){const m=i.skins[e.readInt(!0)];for(let g=0,v=e.readInt(!0);g<v;g++){const b=e.readInt(!0);for(let y=0,w=e.readInt(!0);y<w;y++){const A=e.readStringRef();if(!A)throw new Error("attachmentName must not be null.");const T=m.getAttachment(b,A),M=e.readByte(),R=e.readInt(!0),P=R-1;switch(M){case BO:{const F=T,I=F.bones,k=F.vertices,O=I?k.length/3*2:k.length,L=e.readInt(!0),U=new Qw(R,L,b,F);let B=e.readFloat();for(let D=0,_=0;;D++){let X,N=e.readInt(!0);if(N===0)X=I?lt.newFloatArray(O):k;else{X=lt.newFloatArray(O);const G=e.readInt(!0);if(N+=G,a===1)for(let j=G;j<N;j++)X[j]=e.readFloat();else for(let j=G;j<N;j++)X[j]=e.readFloat()*a;if(!I)for(let j=0,ne=X.length;j<ne;j++)X[j]+=k[j]}if(U.setFrame(D,B,X),D===P)break;const V=e.readFloat();switch(e.readByte()){case wn:U.setStepped(D);break;case Sn:Lt(e,U,_++,D,0,B,V,0,1,1)}B=V}r.push(U);break}case LO:{const F=new Hh(R,b,T);for(let I=0;I<R;I++){const k=e.readFloat(),O=e.readInt32();F.setFrame(I,k,Dw[O&15],O>>4,e.readFloat())}r.push(F);break}}}}}const o=i.slots.length,h=e.readInt(!0);if(h>0){const f=new Vr(h);for(let p=0;p<h;p++)f.setFrame(p,e.readFloat(),gy(e,o));r.push(f)}const l=e.readInt(!0);for(let f=0;f<l;f++){const p=e.readInt(!0),m=new Array(p);for(let b=0;b<p;b++)m[b]=e.readInt(!0);const g=e.readInt(!0),v=new Fo(g,m,o);for(let b=0;b<g;b++)v.setFrame(b,e.readFloat(),gy(e,p));r.push(v)}const c=e.readInt(!0);if(c>0){const f=new Xl(c);for(let p=0;p<c;p++){const m=e.readFloat(),g=i.events[e.readInt(!0)],v=new Up(m,g);v.intValue=e.readInt(!1),v.floatValue=e.readFloat(),v.stringValue=e.readString(),v.stringValue==null&&(v.stringValue=g.setupPose.stringValue),v.data.audioPath&&(v.volume=e.readFloat(),v.balance=e.readFloat()),f.setFrame(p,v)}r.push(f)}let u=0;for(let f=0,p=r.length;f<p;f++)u=Math.max(u,r[f].getDuration());const d=new Op(t,r,u);return n&&xt.rgba8888ToColor(d.color,e.readInt32()),d}}class cO{constructor(e,t=[],i=0,n=new DataView(e instanceof ArrayBuffer?e:e.buffer)){x(this,"strings");x(this,"index");x(this,"buffer");this.strings=t,this.index=i,this.buffer=n}readByte(){return this.buffer.getInt8(this.index++)}readUnsignedByte(){return this.buffer.getUint8(this.index++)}readShort(){const e=this.buffer.getInt16(this.index);return this.index+=2,e}readInt32(){const e=this.buffer.getInt32(this.index);return this.index+=4,e}readInt(e){let t=this.readByte(),i=t&127;return(t&128)!==0&&(t=this.readByte(),i|=(t&127)<<7,(t&128)!==0&&(t=this.readByte(),i|=(t&127)<<14,(t&128)!==0&&(t=this.readByte(),i|=(t&127)<<21,(t&128)!==0&&(t=this.readByte(),i|=(t&127)<<28)))),e?i:i>>>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<e;){const n=this.readUnsignedByte();switch(n>>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 hO=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 py{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 jn;(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"})(jn||(jn={}));function Ti(s,e,t,i){t instanceof sr?uO(s,e,t,i):dO(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 wn:t.setStepped(a);break;case Sn:Lt(s,t,o++,a,0,n,l,r,c,i)}n=l,r=c}e.push(t)}function dO(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 wn:t.setStepped(o);break;case Sn:Lt(s,t,h++,o,0,n,c,r,u,i),Lt(s,t,h++,o,1,n,c,a,d,i)}n=c,r=u,a=d}e.push(t)}function gy(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<t;o++){const h=s.readInt(!0);for(;r!==h;)n[a++]=r++;i[r+s.readInt(!0)]=r++}for(;r<e;)n[a++]=r++;for(let o=e-1;o>=0;o--)i[o]===-1&&(i[o]=n[--a]);return i}function Lt(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 fO=0,mO=1,pO=2,gO=3,vO=4,yO=5,xO=6,bO=7,wO=8,SO=9,_O=10,MO=0,TO=1,AO=2,EO=3,CO=4,IO=5,RO=0,PO=1,kO=2,FO=3,OO=4,BO=0,LO=1,DO=0,NO=1,UO=2,XO=0,VO=1,YO=2,$O=4,GO=5,HO=6,jO=7,WO=8,zO=0,qO=1,wn=1,Sn=2;class KO{constructor(e){x(this,"attachmentLoader");x(this,"scale",1);x(this,"linkedMeshes",[]);this.attachmentLoader=e}readSkeletonData(e){const t=this.scale,i=new vS,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;a<n.bones.length;a++){const o=n.bones[a];let h=null;const l=se(o,"parent",null);l&&(h=i.findBone(l));const c=new ku(i.bones.length,o.name,h);c.length=se(o,"length",0)*t;const u=c.setupPose;u.x=se(o,"x",0)*t,u.y=se(o,"y",0)*t,u.rotation=se(o,"rotation",0),u.scaleX=se(o,"scaleX",1),u.scaleY=se(o,"scaleY",1),u.shearX=se(o,"shearX",0),u.shearY=se(o,"shearY",0),u.inherit=lt.enumValue(mi,se(o,"inherit","Normal")),c.skinRequired=se(o,"skin",!1);const d=se(o,"color",null);d&&c.color.setFromString(d),c.icon=se(o,"icon",void 0),c.iconSize=se(o,"iconSize",1),c.iconRotation=se(o,"iconRotation",0),i.bones.push(c)}if(n.slots)for(let a=0;a<n.slots.length;a++){const o=n.slots[a],h=o.name,l=i.findBone(o.bone);if(!l)throw new Error(`Couldn't find bone ${o.bone} for slot ${h}`);const c=new yS(i.slots.length,h,l),u=se(o,"color",null);u&&c.setupPose.color.setFromString(u);const d=se(o,"dark",null);d&&(c.setupPose.darkColor=xt.fromString(d)),c.attachmentName=se(o,"attachment",null),c.blendMode=lt.enumValue(Wh,se(o,"blend","normal")),c.visible=se(o,"visible",!0),i.slots.push(c)}if(n.constraints)for(const a of n.constraints){const o=a.name,h=se(a,"skin",!1);switch(se(a,"type",!1)){case"ik":{const l=new Qc(o);l.skinRequired=h;for(let p=0;p<a.bones.length;p++){const m=i.findBone(a.bones[p]);if(!m)throw new Error(`Couldn't find bone ${a.bones[p]} for IK constraint ${o}.`);l.bones.push(m)}const c=a.target,u=i.findBone(c);if(!u)throw new Error(`Couldn't find target bone ${c} for IK constraint ${o}.`);l.target=u;const d=se(a,"scaleY",null);d!=null&&(l.scaleYMode=lt.enumValue(as,d));const f=l.setupPose;f.mix=se(a,"mix",1),f.softness=se(a,"softness",0)*t,f.bendDirection=se(a,"bendPositive",!0)?1:-1,f.compress=se(a,"compress",!1),f.stretch=se(a,"stretch",!1),i.constraints.push(l);break}case"transform":{const l=new $t(o);l.skinRequired=h;for(let w=0;w<a.bones.length;w++){const A=a.bones[w],T=i.findBone(A);if(!T)throw new Error(`Couldn't find bone ${A} for transform constraint ${a.name}.`);l.bones.push(T)}const c=a.source,u=i.findBone(c);if(!u)throw new Error(`Couldn't find source bone ${c} for transform constraint ${a.name}.`);l.source=u,l.localSource=se(a,"localSource",!1),l.localTarget=se(a,"localTarget",!1),l.additive=se(a,"additive",!1),l.clamp=se(a,"clamp",!1);let d=!1,f=!1,p=!1,m=!1,g=!1,v=!1;const b=Object.entries(se(a,"properties",{}));for(const[w,A]of b){const T=this.fromProperty(w),M=this.propertyScale(w,t);T.offset=se(A,"offset",0)*M;const R=Object.entries(se(A,"to",{}));for(const[P,F]of R){let I=1,k;switch(P){case"rotate":{d=!0,k=new xS;break}case"x":{f=!0,k=new bS,I=t;break}case"y":{p=!0,k=new wS,I=t;break}case"scaleX":{m=!0,k=new SS;break}case"scaleY":{g=!0,k=new _S;break}case"shearY":{v=!0,k=new MS;break}default:throw new Error(`Invalid transform constraint to property: ${P}`)}k.offset=se(F,"offset",0)*I,k.max=se(F,"max",1)*I,k.scale=se(F,"scale",1)*I/M,T.to.push(k)}T.to.length>0&&l.properties.push(T)}l.offsets[$t.ROTATION]=se(a,"rotation",0),l.offsets[$t.X]=se(a,"x",0)*t,l.offsets[$t.Y]=se(a,"y",0)*t,l.offsets[$t.SCALEX]=se(a,"scaleX",0),l.offsets[$t.SCALEY]=se(a,"scaleY",0),l.offsets[$t.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;f<a.bones.length;f++){const p=a.bones[f],m=i.findBone(p);if(!m)throw new Error(`Couldn't find bone ${p} for path constraint ${a.name}.`);l.bones.push(m)}const c=a.slot,u=i.findSlot(c);if(!u)throw new Error(`Couldn't find slot ${c} for path constraint ${a.name}.`);l.slot=u,l.positionMode=lt.enumValue(On,se(a,"positionMode","Percent")),l.spacingMode=lt.enumValue(Fi,se(a,"spacingMode","Length")),l.rotateMode=lt.enumValue(Pa,se(a,"rotateMode","Tangent")),l.offsetRotation=se(a,"rotation",0);const d=l.setupPose;d.position=se(a,"position",0),l.positionMode===On.Fixed&&(d.position*=t),d.spacing=se(a,"spacing",0),(l.spacingMode===Fi.Length||l.spacingMode===Fi.Fixed)&&(d.spacing*=t),d.mixRotate=se(a,"mixRotate",1),d.mixX=se(a,"mixX",1),d.mixY=se(a,"mixY",d.mixX),i.constraints.push(l);break}case"physics":{const l=new th(o);l.skinRequired=h;const c=a.bone,u=i.findBone(c);if(u==null)throw new Error(`Physics bone not found: ${c}`);l.bone=u,l.x=se(a,"x",0),l.y=se(a,"y",0),l.rotate=se(a,"rotate",0),l.scaleX=se(a,"scaleX",0);const d=se(a,"scaleY",null);d!=null&&(l.scaleYMode=lt.enumValue(as,d)),l.shearX=se(a,"shearX",0),l.limit=se(a,"limit",5e3)*t,l.step=1/se(a,"fps",60);const f=l.setupPose;f.inertia=se(a,"inertia",.5),f.strength=se(a,"strength",100),f.damping=se(a,"damping",.85),f.massInverse=1/se(a,"mass",1),f.wind=se(a,"wind",0),f.gravity=se(a,"gravity",0),f.mix=se(a,"mix",1),l.inertiaGlobal=se(a,"inertiaGlobal",!1),l.strengthGlobal=se(a,"strengthGlobal",!1),l.dampingGlobal=se(a,"dampingGlobal",!1),l.massGlobal=se(a,"massGlobal",!1),l.windGlobal=se(a,"windGlobal",!1),l.gravityGlobal=se(a,"gravityGlobal",!1),l.mixGlobal=se(a,"mixGlobal",!1),i.constraints.push(l);break}case"slider":{const l=new xa(o);l.skinRequired=h,l.additive=se(a,"additive",!1),l.loop=se(a,"loop",!1),l.setupPose.mix=se(a,"mix",1);const c=a.bone;if(c){if(l.bone=i.findBone(c),!l.bone)throw new Error(`Slider bone not found: ${c}`);const u=a.property;l.property=this.fromProperty(u);const d=this.propertyScale(u,t);l.property.offset=se(a,"from",0)*d,l.offset=se(a,"to",0),l.scale=se(a,"scale",1)/d,l.max=se(a,"max",0),l.local=se(a,"local",!1)}else l.setupPose.time=se(a,"time",0);i.constraints.push(l);break}}}if(n.skins)for(let a=0;a<n.skins.length;a++){const o=n.skins[a],h=new Xm(o.name);if(o.bones)for(let l=0;l<o.bones.length;l++){const c=o.bones[l],u=i.findBone(c);if(!u)throw new Error(`Couldn't find bone ${c} for skin ${o.name}.`);h.bones.push(u)}if(o.ik)for(let l=0;l<o.ik.length;l++){const c=o.ik[l],u=i.findConstraint(c,Qc);if(!u)throw new Error(`Couldn't find IK constraint ${c} for skin ${o.name}.`);h.constraints.push(u)}if(o.transform)for(let l=0;l<o.transform.length;l++){const c=o.transform[l],u=i.findConstraint(c,$t);if(!u)throw new Error(`Couldn't find transform constraint ${c} for skin ${o.name}.`);h.constraints.push(u)}if(o.path)for(let l=0;l<o.path.length;l++){const c=o.path[l],u=i.findConstraint(c,eh);if(!u)throw new Error(`Couldn't find path constraint ${c} for skin ${o.name}.`);h.constraints.push(u)}if(o.physics)for(let l=0;l<o.physics.length;l++){const c=o.physics[l],u=i.findConstraint(c,th);if(!u)throw new Error(`Couldn't find physics constraint ${c} for skin ${o.name}.`);h.constraints.push(u)}if(o.slider)for(let l=0;l<o.slider.length;l++){const c=o.slider[l],u=i.findConstraint(c,xa);if(!u)throw new Error(`Couldn't find slider constraint ${c} for skin ${o.name}.`);h.constraints.push(u)}for(const l in o.attachments){const c=i.findSlot(l);if(!c)throw new Error(`Couldn't find skin slot ${l} for skin ${o.name}.`);const u=o.attachments[l];for(const d in u){const f=this.readAttachment(u[d],h,c.index,d,i);f&&h.setAttachment(c.index,d,f)}}i.skins.push(h),h.name==="default"&&(i.defaultSkin=h)}for(let a=0,o=this.linkedMeshes.length;a<o;a++){const h=this.linkedMeshes[a],l=h.skin?i.findSkin(h.skin):i.defaultSkin;if(!l)throw new Error(`Skin not found: ${h.skin}`);const c=l.getAttachment(h.sourceIndex,h.source);if(!c)throw new Error(`Source mesh not found: ${h.source}`);h.mesh.timelineAttachment=h.inheritTimelines?c:h.mesh,h.mesh.setSourceMesh(c),h.mesh.updateSequence();e:if(h.inheritTimelines&&h.slotIndex!==h.sourceIndex){const u=c.timelineSlots;for(const f of u)if(f===h.slotIndex)break e;const d=[...u];d[u.length]=h.slotIndex,c.timelineSlots=d}}if(this.linkedMeshes.length=0,n.events)for(const a in n.events){const o=n.events[a],h=new gS(a),l=h.setupPose;l.intValue=se(o,"int",0),l.floatValue=se(o,"float",0),l.stringValue=se(o,"string",""),h._audioPath=se(o,"audio",null),h.audioPath&&(l.volume=se(o,"volume",l.volume),l.balance=se(o,"balance",l.balance)),i.events.push(h)}if(n.animations)for(const a in n.animations){const o=n.animations[a];this.readAnimation(o,a,i)}if(n.constraints)for(const a in n.constraints){const o=n.constraints[a];if(o.type==="slider"){const h=i.findConstraint(o.name,xa),l=o.animation,c=i.findAnimation(l);if(!c)throw new Error(`Slider animation not found: ${l}`);h.animation=c}}return i}fromProperty(e){let t;switch(e){case"rotate":t=new Ym;break;case"x":t=new $m;break;case"y":t=new Gm;break;case"scaleX":t=new Hm;break;case"scaleY":t=new jm;break;case"shearY":t=new Wm;break;default:throw new Error(`Invalid transform constraint from property: ${e}`)}return t}propertyScale(e,t){switch(e){case"x":case"y":return t;default:return 1}}readAttachment(e,t,i,n,r){const a=this.scale,o=se(e,"name",n);switch(se(e,"type","region")){case"region":{const h=se(e,"path",o),l=this.readSequence(se(e,"sequence",null)),c=this.attachmentLoader.newRegionAttachment(t,n,o,h,l);if(!c)return null;c.path=h,c.x=se(e,"x",0)*a,c.y=se(e,"y",0)*a,c.scaleX=se(e,"scaleX",1),c.scaleY=se(e,"scaleY",1),c.rotation=se(e,"rotation",0),c.width=e.width*a,c.height=e.height*a;const u=se(e,"color",null);return u&&c.color.setFromString(u),c.updateSequence(),c}case"boundingbox":{const h=this.attachmentLoader.newBoundingBoxAttachment(t,n,o);if(!h)return null;this.readVertices(e,h,e.vertexCount<<1);const l=se(e,"color",null);return l&&h.color.setFromString(l),h}case"mesh":case"linkedmesh":{const h=se(e,"path",o),l=this.readSequence(se(e,"sequence",null)),c=this.attachmentLoader.newMeshAttachment(t,n,o,h,l);if(!c)return null;c.path=h;const u=se(e,"color",null);u&&c.color.setFromString(u),c.width=se(e,"width",0)*a,c.height=se(e,"height",0)*a;const d=se(e,"source",null);if(d){let p=i;const m=se(e,"slot",null);if(m){const g=r.findSlot(m);if(!g)throw new Error(`Source mesh slot not found: ${m}`);p=g.index}return this.linkedMeshes.push(new ZO(c,se(e,"skin",null),i,p,d,se(e,"timelines",!0))),c}const f=e.uvs;return this.readVertices(e,c,f.length),c.triangles=e.triangles,c.regionUVs=f,c.edges=se(e,"edges",null),c.hullLength=se(e,"hull",0)*2,c.updateSequence(),c}case"path":{const h=this.attachmentLoader.newPathAttachment(t,n,o);if(!h)return null;h.closed=se(e,"closed",!1),h.constantSpeed=se(e,"constantSpeed",!0);const l=e.vertexCount;this.readVertices(e,h,l<<1);const c=lt.newArray(l/3,0);for(let d=0;d<e.lengths.length;d++)c[d]=e.lengths[d]*a;h.lengths=c;const u=se(e,"color",null);return u&&h.color.setFromString(u),h}case"point":{const h=this.attachmentLoader.newPointAttachment(t,n,o);if(!h)return null;h.x=se(e,"x",0)*a,h.y=se(e,"y",0)*a,h.rotation=se(e,"rotation",0);const l=se(e,"color",null);return l&&h.color.setFromString(l),h}case"clipping":{const h=this.attachmentLoader.newClippingAttachment(t,n,o);if(!h)return null;const l=se(e,"end",null);l&&(h.endSlot=r.findSlot(l)),h.convex=se(e,"convex",!1),h.inverse=se(e,"inverse",!1);const c=e.vertexCount;this.readVertices(e,h,c<<1);const u=se(e,"color",null);return u&&h.color.setFromString(u),h}}return null}readSequence(e){if(e==null)return new ko(1,!1);const t=new ko(se(e,"count",0),!0);return t.start=se(e,"start",1),t.digits=se(e,"digits",0),t.setupIndex=se(e,"setup",0),t}readVertices(e,t,i){const n=this.scale;t.worldVerticesLength=i;const r=e.vertices;if(i===r.length){const h=lt.toFloatArray(r);if(n!==1)for(let l=0,c=r.length;l<c;l++)h[l]*=n;t.vertices=h;return}const a=[],o=[];for(let h=0,l=r.length;h<l;){const c=r[h++];o.push(c);for(let u=h+c*4;h<u;h+=4)o.push(r[h]),a.push(r[h+1]*n),a.push(r[h+2]*n),a.push(r[h+3])}t.bones=o,t.vertices=lt.toFloatArray(a)}readAnimation(e,t,i){const n=this.scale,r=[];if(e.slots)for(const l in e.slots){const c=e.slots[l],u=i.findSlot(l);if(!u)throw new Error(`Slot not found: ${l}`);const d=u.index;for(const f in c){const p=c[f];if(!p)continue;const m=p.length;switch(f){case"attachment":{const g=new bl(m,d);for(let v=0;v<m;v++){const b=p[v];g.setFrame(v,se(b,"time",0),se(b,"name",null))}r.push(g);break}case"rgba":{const g=new zw(m,m<<2,d);let v=p[0],b=se(v,"time",0),y=xt.fromString(v.color);for(let w=0,A=0;;w++){g.setFrame(w,b,y.r,y.g,y.b,y.a);const T=p[w+1];if(!T){g.shrink(A);break}const M=se(T,"time",0),R=xt.fromString(T.color),P=v.curve;P&&(A=Ut(P,g,A,w,0,b,M,y.r,R.r,1),A=Ut(P,g,A,w,1,b,M,y.g,R.g,1),A=Ut(P,g,A,w,2,b,M,y.b,R.b,1),A=Ut(P,g,A,w,3,b,M,y.a,R.a,1)),b=M,y=R,v=T}r.push(g);break}case"rgb":{const g=new qw(m,m*3,d);let v=p[0],b=se(v,"time",0),y=xt.fromString(v.color);for(let w=0,A=0;;w++){g.setFrame(w,b,y.r,y.g,y.b);const T=p[w+1];if(!T){g.shrink(A);break}const M=se(T,"time",0),R=xt.fromString(T.color),P=v.curve;P&&(A=Ut(P,g,A,w,0,b,M,y.r,R.r,1),A=Ut(P,g,A,w,1,b,M,y.g,R.g,1),A=Ut(P,g,A,w,2,b,M,y.b,R.b,1)),b=M,y=R,v=T}r.push(g);break}case"alpha":{vs(r,p,new Kw(m,m,d),0,1);break}case"rgba2":{const g=new Zw(m,m*7,d);let v=p[0],b=se(v,"time",0),y=xt.fromString(v.light),w=xt.fromString(v.dark);for(let A=0,T=0;;A++){g.setFrame(A,b,y.r,y.g,y.b,y.a,w.r,w.g,w.b);const M=p[A+1];if(!M){g.shrink(T);break}const R=se(M,"time",0),P=xt.fromString(M.light),F=xt.fromString(M.dark),I=v.curve;I&&(T=Ut(I,g,T,A,0,b,R,y.r,P.r,1),T=Ut(I,g,T,A,1,b,R,y.g,P.g,1),T=Ut(I,g,T,A,2,b,R,y.b,P.b,1),T=Ut(I,g,T,A,3,b,R,y.a,P.a,1),T=Ut(I,g,T,A,4,b,R,w.r,F.r,1),T=Ut(I,g,T,A,5,b,R,w.g,F.g,1),T=Ut(I,g,T,A,6,b,R,w.b,F.b,1)),b=R,y=P,w=F,v=M}r.push(g);break}case"rgb2":{const g=new Jw(m,m*6,d);let v=p[0],b=se(v,"time",0),y=xt.fromString(v.light),w=xt.fromString(v.dark);for(let A=0,T=0;;A++){g.setFrame(A,b,y.r,y.g,y.b,w.r,w.g,w.b);const M=p[A+1];if(!M){g.shrink(T);break}const R=se(M,"time",0),P=xt.fromString(M.light),F=xt.fromString(M.dark),I=v.curve;I&&(T=Ut(I,g,T,A,0,b,R,y.r,P.r,1),T=Ut(I,g,T,A,1,b,R,y.g,P.g,1),T=Ut(I,g,T,A,2,b,R,y.b,P.b,1),T=Ut(I,g,T,A,3,b,R,w.r,F.r,1),T=Ut(I,g,T,A,4,b,R,w.g,F.g,1),T=Ut(I,g,T,A,5,b,R,w.b,F.b,1)),b=R,y=P,w=F,v=M}r.push(g);break}default:throw new Error(`Invalid timeline type for a slot: ${p.name} (${c.name})`)}}}if(e.bones)for(const l in e.bones){const c=e.bones[l],u=i.findBone(l);if(!u)throw new Error(`Bone not found: ${l}`);const d=u.index;for(const f in c){const p=c[f],m=p.length;if(m!==0)switch(f){case"rotate":vs(r,p,new Gh(m,m,d),0,1);break;case"translate":Af(r,p,new Nw(m,m<<1,d),"x","y",0,n);break;case"translatex":vs(r,p,new Uw(m,m,d),0,n);break;case"translatey":vs(r,p,new Xw(m,m,d),0,n);break;case"scale":Af(r,p,new Vw(m,m<<1,d),"x","y",1,1);break;case"scalex":vs(r,p,new Yw(m,m,d),1,1);break;case"scaley":vs(r,p,new $w(m,m,d),1,1);break;case"shear":Af(r,p,new Gw(m,m<<1,d),"x","y",0,1);break;case"shearx":vs(r,p,new Hw(m,m,d),0,1);break;case"sheary":vs(r,p,new jw(m,m,d),0,1);break;case"inherit":{const g=new Ww(m,u.index);for(let v=0;v<p.length;v++){const b=p[v];g.setFrame(v,se(b,"time",0),lt.enumValue(mi,se(b,"inherit","Normal")))}r.push(g);break}default:throw new Error(`Invalid timeline type for a bone: ${p.name} (${c.name})`)}}}if(e.ik)for(const l in e.ik){const c=e.ik[l];let u=c[0];if(!u)continue;const d=i.findConstraint(l,Qc);if(!d)throw new Error(`IK Constraint not found: ${l}`);const f=new eS(c.length,c.length<<1,i.constraints.indexOf(d));let p=se(u,"time",0),m=se(u,"mix",1),g=se(u,"softness",0)*n;for(let v=0,b=0;;v++){f.setFrame(v,p,m,g,se(u,"bendPositive",!0)?1:-1,se(u,"compress",!1),se(u,"stretch",!1));const y=c[v+1];if(!y){f.shrink(b);break}const w=se(y,"time",0),A=se(y,"mix",1),T=se(y,"softness",0)*n,M=u.curve;M&&(b=Ut(M,f,b,v,0,p,w,m,A,1),b=Ut(M,f,b,v,1,p,w,g,T,n)),p=w,m=A,g=T,u=y}r.push(f)}if(e.transform)for(const l in e.transform){const c=e.transform[l];let u=c[0];if(!u)continue;const d=i.findConstraint(l,$t);if(!d)throw new Error(`Transform constraint not found: ${l}`);const f=new tS(c.length,c.length*6,i.constraints.indexOf(d));let p=se(u,"time",0),m=se(u,"mixRotate",1),g=se(u,"mixX",1),v=se(u,"mixY",g),b=se(u,"mixScaleX",1),y=se(u,"mixScaleY",1),w=se(u,"mixShearY",1);for(let A=0,T=0;;A++){f.setFrame(A,p,m,g,v,b,y,w);const M=c[A+1];if(!M){f.shrink(T);break}const R=se(M,"time",0),P=se(M,"mixRotate",1),F=se(M,"mixX",1),I=se(M,"mixY",F),k=se(M,"mixScaleX",1),O=se(M,"mixScaleY",1),L=se(M,"mixShearY",1),U=u.curve;U&&(T=Ut(U,f,T,A,0,p,R,m,P,1),T=Ut(U,f,T,A,1,p,R,g,F,1),T=Ut(U,f,T,A,2,p,R,v,I,1),T=Ut(U,f,T,A,3,p,R,b,k,1),T=Ut(U,f,T,A,4,p,R,y,O,1),T=Ut(U,f,T,A,5,p,R,w,L,1)),p=R,m=P,g=F,v=I,b=k,y=O,w=L,u=M}r.push(f)}if(e.path)for(const l in e.path){const c=e.path[l],u=i.findConstraint(l,eh);if(!u)throw new Error(`Path constraint not found: ${l}`);const d=i.constraints.indexOf(u);for(const f in c){const p=c[f];let m=p[0];if(!m)continue;const g=p.length;switch(f){case"position":{const v=new iS(g,g,d);vs(r,p,v,0,u.positionMode===On.Fixed?n:1);break}case"spacing":{const v=new sS(g,g,d);vs(r,p,v,0,u.spacingMode===Fi.Length||u.spacingMode===Fi.Fixed?n:1);break}case"mix":{const v=new nS(g,g*3,d);let b=se(m,"time",0),y=se(m,"mixRotate",1),w=se(m,"mixX",1),A=se(m,"mixY",w);for(let T=0,M=0;;T++){v.setFrame(T,b,y,w,A);const R=p[T+1];if(!R){v.shrink(M);break}const P=se(R,"time",0),F=se(R,"mixRotate",1),I=se(R,"mixX",1),k=se(R,"mixY",I),O=m.curve;O&&(M=Ut(O,v,M,T,0,b,P,y,F,1),M=Ut(O,v,M,T,1,b,P,w,I,1),M=Ut(O,v,M,T,2,b,P,A,k,1)),b=P,y=F,w=I,A=k,m=R}r.push(v);break}}}}if(e.physics)for(const l in e.physics){const c=e.physics[l];let u=-1;if(l.length>0){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 rS(m,m,u);break;case"strength":g=new aS(m,m,u);break;case"damping":g=new oS(m,m,u);break;case"mass":g=new lS(m,m,u);break;case"wind":g=new cS(m,m,u);break;case"gravity":g=new hS(m,m,u);break;case"mix":{v=1,g=new uS(m,m,u);break}default:continue}vs(r,f,g,v,1)}}if(e.slider)for(const l in e.slider){const c=e.slider[l],u=i.findConstraint(l,xa);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":vs(r,p,new dS(g,g,d),1,1);break;case"mix":vs(r,p,new fS(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,M=b.vertices,R=T?M.length/3*2:M.length,P=new Qw(w.length,w.length,m,b);let F=se(A,"time",0);for(let I=0,k=0;;I++){let O;const L=se(A,"vertices",null);if(!L)O=T?lt.newFloatArray(R):M;else{O=lt.newFloatArray(R);const _=se(A,"offset",0);if(lt.arrayCopy(L,0,O,_,L.length),n!==1)for(let X=_,N=X+L.length;X<N;X++)O[X]*=n;if(!T)for(let X=0;X<R;X++)O[X]+=M[X]}P.setFrame(I,F,O);const U=w[I+1];if(!U){P.shrink(k);break}const B=se(U,"time",0),D=A.curve;D&&(k=Ut(D,P,k,I,0,F,B,0,1,1)),F=B,A=U}r.push(P)}else if(y==="sequence"){const T=new Hh(w.length,m,b);let M=0;for(let R=0;R<w.length;R++){const P=se(A,"delay",M),F=se(A,"time",0),I=Gi[se(A,"mode","hold")],k=se(A,"index",0);T.setFrame(R,F,I,k,P),M=P,A=w[R+1]}r.push(T)}}}}}}if(e.drawOrder){const l=new Vr(e.drawOrder.length),c=i.slots.length;let u=0;for(const d of e.drawOrder)l.setFrame(u++,se(d,"time",0),vy(i,d,c,null));r.push(l)}if(e.drawOrderFolder)for(const l of e.drawOrderFolder){const c=se(l,"slots",[]),u=new Array(c.length);let d=0;for(const g of c){const v=i.findSlot(g);if(!v)throw new Error(`Draw order folder slot not found: ${g}`);u[d++]=v.index}const f=se(l,"keys",[]),p=new Fo(f.length,u,i.slots.length);let m=0;for(const g of f)p.setFrame(m++,se(g,"time",0),vy(i,g,u.length,u));r.push(p)}if(e.events){const l=new Xl(e.events.length);let c=0;for(let u=0;u<e.events.length;u++,c++){const d=e.events[u],f=i.findEvent(d.name);if(!f)throw new Error(`Event not found: ${d.name}`);const p=f.setupPose,m=new Up(lt.toSinglePrecision(se(d,"time",0)),f);m.intValue=se(d,"int",p.intValue),m.floatValue=se(d,"float",p.floatValue),m.stringValue=se(d,"string",p.stringValue),m.data.audioPath&&(m.volume=se(d,"volume",p.volume),m.balance=se(d,"balance",p.volume)),l.setFrame(c,m)}r.push(l)}let a=0;for(let l=0,c=r.length;l<c;l++)a=Math.max(a,r[l].getDuration());const o=new Op(t,r,a),h=se(e,"color",null);h!==null&&o.color.setFromString(h),i.animations.push(o)}}class ZO{constructor(e,t,i,n,r,a){x(this,"source");x(this,"skin");x(this,"slotIndex");x(this,"sourceIndex");x(this,"mesh");x(this,"inheritTimelines");this.mesh=e,this.skin=t,this.slotIndex=i,this.sourceIndex=n,this.source=r,this.inheritTimelines=a}}function vs(s,e,t,i,n){let r=e[0],a=r.time??0,o=(r.value??i)*n,h=0;for(let l=0;;l++){t.setFrame(l,a,o);const c=e[l+1];if(!c){t.shrink(h),s.push(t);return}const u=c.time??0,d=(c.value??i)*n;r.curve&&(h=Ut(r.curve,t,h,l,0,a,u,o,d,n)),a=u,o=d,r=c}}function Af(s,e,t,i,n,r,a){let o=e[0],h=o.time??0,l=(o[i]??r)*a,c=(o[n]??r)*a,u=0;for(let d=0;;d++){t.setFrame(d,h,l,c);const f=e[d+1];if(!f){t.shrink(u),s.push(t);return}const p=f.time??0,m=(f[i]??r)*a,g=(f[n]??r)*a,v=o.curve;v&&(u=Ut(v,t,u,d,0,h,p,l,m,a),u=Ut(v,t,u,d,1,h,p,c,g,a)),h=p,l=m,c=g,o=f}}function vy(s,e,t,i){const n=e.offsets;if(!n)return null;const r=new Array(t).fill(-1),a=new Array(t-n.length);let o=0,h=0;for(const l of n){const c=s.findSlot(l.slot);if(c==null)throw new Error(`Draw order slot not found: ${l.slot}`);let u=0;if(!i)u=c.index;else{u=-1;for(let d=0;d<t;d++)if(i[d]===c.index){u=d;break}if(u===-1)throw new Error(`Slot not in folder: ${l.slot}`)}for(;o!==u;)a[h++]=o++;r[o+l.offset]=o++}for(;o<t;)a[h++]=o++;for(let l=t-1;l>=0;l--)r[l]===-1&&(r[l]=a[--h]);return r}function Ut(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 JO{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 ew(t)}newPathAttachment(e,t){return new Ul(t)}newPointAttachment(e,t){return new aw(t)}newClippingAttachment(e,t){return new Mo(t)}}class QO{sequence(e){for(let t=0;t<e.regions.length;t++){if(e.regions[t])continue;const i=new Bw;i.u=0,i.v=0,i.u2=1,i.v2=1,i.width=1,i.height=1,i.originalWidth=1,i.originalHeight=1,i.offsetX=0,i.offsetY=0,i.degrees=0,e.regions[t]=i}return e}newRegionAttachment(e,t,i,n,r){return new Po(i,this.sequence(r))}newMeshAttachment(e,t,i,n,r){return new Hr(i,this.sequence(r))}newBoundingBoxAttachment(e,t,i){return new Lp(i)}newPathAttachment(e,t,i){return new Vl(i)}newPointAttachment(e,t,i){return new Dp(i)}newClippingAttachment(e,t,i){return new Pu(i)}}const eB=new Set(["normal","onlyTranslation","noRotationOrReflection","noScale","noScaleOrReflection"]);function tB(s,e,t){const i=s.uvs,n=s.vertices,r=s.triangles;if(!Array.isArray(i)||!i.length||i.length%2)throw new Error(`拖尾网格“${e}”的 UV 数据无效`);if(!Array.isArray(n)||!n.length)throw new Error(`拖尾网格“${e}”缺少顶点数据`);const a=i.length/2;if(!Array.isArray(r)||r.some(c=>!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<n.length;){const c=n[h++];if(!Number.isInteger(c)||c<1)throw new Error(`拖尾网格“${e}”包含无效骨骼权重数量`);let u=0;for(let d=0;d<c;d++){const f=n[h++],p=n[h++],m=n[h++],g=n[h++];if(!Number.isInteger(f)||f<0||f>=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 iB(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&&!eB.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"&&(tB(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 sB(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 yy(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 ${_m()}`);if(e&&i!==e)throw new Error(`导出版本不一致:设置为 Spine ${e},JSON 标记为 Spine ${i}`);iB(t,i),i==="3.8"&&sB(t);const n=i==="3.8"?xw(JSON.parse(JSON.stringify(t))):t,r=i==="4.3"?new KO(new QO).readSkeletonData(n):new Dh(new JO).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 TS="http://127.0.0.1:27843";class zm 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 qm(s,e){return String(s||"").trim().replace(/[\\/:*?"<>|]+/g,"_").replace(/^\.+/,"")||e}function nB(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 rB(s,e,t){const i=String(s||"").replace(/\\/g,"/").split("/").filter(Boolean).map(r=>qm(r,"images")),n=qm(e.replace(/\.[^./\\]+$/,""),"image");return[...i,`${n}${nB(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;h<r.length;h+=o)a+=String.fromCharCode(...r.subarray(h,h+o));return{path:rB(e,t,n.type),dataBase64:btoa(a)}}async function AS(s,e){const t=[];let i=0;const n=a=>a.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 aB(){try{const s=await fetch(`${TS}/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 oB(s,e){const t=await AS(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",`${TS}/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 zm("未检测到本地 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 zm(c.message||`Spine 连接器返回错误:HTTP ${a.status}`,c.code,c.pairUrl));return}const h=a.getResponseHeader("X-Spine-File-Name");let l=`${qm(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 cB=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 hB(s){let e=4294967295;for(const t of s)e=cB[(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 dB(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 xy(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 fB(s){const e=new TextEncoder,t=[],i=[],n=dB();let r=0;for(const h of s){const l=e.encode(uB(h.name)),c=hB(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=xy(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([xy([...t,a,o.bytes])],{type:"application/zip"})}function mB(s){const e=atob(s),t=new Uint8Array(e.length);for(let i=0;i<e.length;i++)t[i]=e.charCodeAt(i);return t}function pB(s){const t=String(s||"./images/").replace(/\\/g,"/").replace(/^\.\//,"").replace(/^\/+|\/+$/g,"").split("/").filter(Boolean);return!t.length||t.some(i=>i===".."||/^[a-z]+:/i.test(i))?"images":t.join("/")}function gB(s){return String(s||"SpineParticle").replace(/\.json$/i,"").replace(/[\\/:*?"<>|]+/g,"_").replace(/^\.+/,"")||"SpineParticle"}async function vB(s){const e=await AS(s.systems);if(!e.length)throw new Error("当前可见粒子系统没有可导出的图片");const t=pB(s.imagesPath);return{blob:fB(e.map(n=>({name:`${t}/${n.path}`,data:mB(n.dataBase64)}))),imageCount:e.length,folder:t}}function yB(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 xB={class:"panel"},bB={class:"panel-scroll"},wB={class:"group config-management"},SB={class:"caret"},_B={class:"group-body config-management-body"},MB={class:"config-toolbar"},TB=["disabled"],AB={value:""},EB=["value"],CB={class:"group"},IB={class:"caret"},RB={class:"scene-actions"},PB=["disabled"],kB={class:"group-body"},FB={class:"tree scene-tree"},OB=["onClick"],BB={class:"tlabel"},LB=["title","aria-label","onClick"],DB={viewBox:"0 0 24 24","aria-hidden":"true"},NB={key:0,class:"eye-slash",d:"M4 4l16 16"},UB=["onClick"],XB=["onClick"],VB={class:"tlabel"},YB=["title","aria-label","onClick"],$B={viewBox:"0 0 24 24","aria-hidden":"true"},GB={key:0,class:"eye-slash",d:"M4 4l16 16"},HB=["onClick"],jB=["onClick"],WB={class:"tlabel"},zB=["title","aria-label","onClick"],qB={viewBox:"0 0 24 24","aria-hidden":"true"},KB={key:0,class:"eye-slash",d:"M4 4l16 16"},ZB=["onClick"],JB=["onClick"],QB={class:"tlabel"},eL=["title","aria-label","onClick"],tL={viewBox:"0 0 24 24","aria-hidden":"true"},iL={key:0,class:"eye-slash",d:"M4 4l16 16"},sL=["onClick"],nL={key:0,class:"empty"},rL={class:"row"},aL={class:"seed-row scene-seed"},oL={class:"field-block"},lL={class:"field-grid"},cL={class:"field-block"},hL={class:"field-block check-field"},uL={class:"field-grid"},dL={class:"compact-field"},fL={class:"compact-field"},mL={class:"field-grid"},pL={class:"compact-field"},gL={class:"compact-field"},vL={key:1,class:"field-grid"},yL={class:"compact-field"},xL={class:"compact-field"},bL={key:2,class:"field-grid"},wL={class:"compact-field"},SL={class:"compact-field"},_L={class:"field-block"},ML={key:4,class:"field-grid"},TL={class:"compact-field"},AL={class:"compact-field"},EL={class:"collider-follow-section"},CL={class:"follow-path"},IL={class:"field-block"},RL=["value"],PL={class:"field-grid"},kL={class:"compact-field"},FL={class:"compact-field"},OL={class:"follow-path"},BL={class:"field-block"},LL={class:"field-grid"},DL={class:"compact-field"},NL={class:"compact-field"},UL={class:"field-grid"},XL={class:"compact-field"},VL={class:"compact-field"},YL={class:"setting-line"},$L={class:"setting-line"},GL={class:"field-block"},HL={key:4,class:"panel-hint"},jL={class:"group"},WL={class:"caret"},zL={class:"group-body"},qL={class:"segs"},KL={class:"segs stream-behavior-segs"},ZL={key:2,class:"stream-loop-options"},JL={class:"loop-section-row"},QL={class:"switch-row"},eD=["checked"],tD={key:0,class:"loop-duration-control"},iD={class:"switch-row loop-duration-toggle"},sD=["checked"],nD={class:"loop-section-duration"},rD=["value"],aD={key:1},oD={key:2,class:"loop-auto-duration"},lD={class:"loop-section-row"},cD={class:"switch-row"},hD=["checked"],uD={key:0,class:"loop-duration-control"},dD={class:"switch-row loop-duration-toggle"},fD=["checked"],mD={class:"loop-section-duration"},pD=["value"],gD={key:1},vD={key:2,class:"loop-auto-duration"},yD={key:3,class:"modifier-hint stream-loop-hint"},xD={class:"group"},bD={class:"caret"},wD={class:"group-body"},SD={class:"row"},_D={class:"row"},MD=["value","disabled"],TD={key:0,class:"row"},AD={class:"row"},ED={key:0,value:"radial"},CD={key:1,value:"path-normal"},ID={key:2,value:"path-tangent"},RD={class:"group"},PD={class:"caret"},kD={class:"group-body attr-body"},FD={class:"attr-axis-head"},OD={class:"axis-modes"},BD={class:"life-item"},LD={class:"switch-row"},DD={class:"life-item"},ND={class:"switch-row"},UD={class:"axis-modes life-axis"},XD={class:"life-item"},VD={class:"switch-row"},YD={class:"group"},$D={class:"caret"},GD={class:"group-body"},HD={class:"seg"},jD={class:"row"},WD={class:"curve-wrap"},zD={class:"row"},qD=["onUpdate:modelValue"],KD=["onUpdate:modelValue"],ZD={class:"row resource-color-row"},JD=["onUpdate:modelValue"],QD=["onUpdate:modelValue"],eN={key:0,class:"row resource-color-picker"},tN=["onUpdate:modelValue"],iN=["value","onChange","onKeydown"],sN={key:0,class:"random-color-hint"},nN={class:"resource-alpha-head"},rN={class:"alpha-modes"},aN=["onClick"],oN=["onClick"],lN=["onClick"],cN={class:"row"},hN=["onUpdate:modelValue"],uN={class:"resource-alpha-curve"},dN={class:"group"},fN={class:"caret"},mN={class:"group-body"},pN={class:"modifier-item"},gN={class:"switch-row modifier-switch"},vN={key:0,class:"modifier-params"},yN={class:"modifier-item"},xN={class:"switch-row modifier-switch"},bN={key:0,class:"modifier-params gravity-params"},wN={class:"modifier-mode-row"},SN={class:"modifier-item"},_N={class:"switch-row modifier-switch"},MN={key:0,class:"modifier-params gravity-params"},TN={class:"modifier-mode-row"},AN={class:"modifier-item"},EN={class:"switch-row modifier-switch"},CN={key:0,class:"modifier-params"},IN={class:"row"},RN={class:"modifier-item"},PN={class:"switch-row modifier-switch"},kN={key:0,class:"modifier-params"},FN={class:"row"},ON={class:"row"},BN={class:"modifier-item"},LN={class:"switch-row modifier-switch"},DN={key:0,class:"modifier-params trail-params"},NN={class:"row"},UN=["onUpdate:modelValue"],XN={class:"row"},VN=["onUpdate:modelValue"],YN={class:"row"},$N=["onUpdate:modelValue"],GN={class:"switch-row trail-sub-switch"},HN=["onUpdate:modelValue"],jN={class:"switch-row trail-sub-switch"},WN=["onUpdate:modelValue"],zN={class:"trail-mode-head"},qN={class:"alpha-modes"},KN=["onClick"],ZN=["onClick"],JN=["onClick"],QN={class:"row"},e4=["onUpdate:modelValue"],t4={key:6,class:"row trail-fixed-color"},i4=["onUpdate:modelValue"],s4=["value","onChange","onKeydown"],n4={class:"trail-mode-head"},r4={class:"alpha-modes"},a4=["onClick"],o4=["onClick"],l4=["onClick"],c4={class:"trail-grid-row"},h4={class:"modifier-item"},u4={class:"switch-row modifier-switch"},d4=["disabled"],f4={key:0,class:"modifier-params emitter-follow-params"},m4={class:"field-block"},p4=["value"],g4={key:0,value:"bone"},v4={class:"field-block"},y4=["value"],x4={class:"field-block"},b4={class:"field-grid follow-grid"},w4={class:"compact-field"},S4={class:"compact-field"},_4={class:"field-block"},M4={key:0,class:"bone-follow-target"},T4={key:1,class:"bone-follow-missing"},A4={class:"field-block"},E4={class:"field-grid follow-grid"},C4={class:"compact-field"},I4={class:"compact-field"},R4={class:"bone-follow-transform-grid"},P4={class:"compact-field"},k4={class:"compact-field"},F4={class:"compact-field"},O4={class:"modifier-item"},B4={class:"switch-row modifier-switch"},L4={key:0,class:"modifier-params collision-filter-params"},D4={class:"collision-filter-tags"},N4=["title"],U4=["aria-label","onClick"],X4=["disabled","title"],V4={key:0,class:"collision-filter-empty"},Y4={key:1,class:"collision-filter-picker"},$4=["onClick"],G4={class:"group"},H4={class:"caret"},j4={class:"group-body export-settings"},W4={class:"export-field"},z4={class:"export-field"},q4={class:"export-field"},K4={key:0,class:"export-help"},Z4={class:"export-fps-row"},J4={class:"export-field export-fps-field"},Q4={class:"export-checkbox"},e5={class:"export-switches"},t5={class:"switch-row export-switch"},i5={class:"switch-row export-switch"},s5={class:"switch-row export-switch export-switch-last"},n5={class:"spine-export-actions"},r5=["disabled","title"],a5=["disabled"],o5=["disabled","title"],l5={key:0},c5=["href"],h5=["href"],u5=sn({__name:"ParticlePanel",setup(s){const e=Kl();e.settings.exportSettings=p1(e.settings.exportSettings);const t=pt(()=>e.settings.exportSettings),i=ht(null),n=ht(""),r=ht([]),a=ht(!1),o=ht(""),h=ht(!1),l=ht(!1),c=ht(null),u=ht(""),d=ht(!1),f=ht(null),p=ht(""),m=pt(()=>{const $=f.value;return $?$.available?$.spineFound?$.authorized?"连接器可用 · Spine 已就绪":"连接器已启动,当前网站尚未授权":"连接器已启动,但未找到 Spine":"本地 Spine 连接器未启动":"正在检测本地 Spine 连接器…"}),g=pt(()=>{var $,S,C,Z,Fe,ft;return{ready:!!(($=f.value)!=null&&$.available)&&!!((S=f.value)!=null&&S.spineFound)&&!!((C=f.value)!=null&&C.authorized),warning:!!((Z=f.value)!=null&&Z.available)&&(!((Fe=f.value)!=null&&Fe.spineFound)||!((ft=f.value)!=null&&ft.authorized))}}),v=pt(()=>{var $,S,C;return!!(($=f.value)!=null&&$.available)&&!!((S=f.value)!=null&&S.spineFound)&&!!((C=f.value)!=null&&C.authorized)}),b=pt(()=>{const $=f.value;return!($!=null&&$.available)||!$.spineFound||$.authorized||typeof window>"u"?"":`http://127.0.0.1:27843/pair?origin=${encodeURIComponent(window.location.origin)}`}),y=pt(()=>{const $=f.value;return $?$.available?$.spineFound?$.authorized?"":"未授权":"未找到 Spine":"未启动":"检测中"}),w=pt(()=>l.value?"正在重新计算并生成 Spine 工程":y.value?`暂不可用:${y.value}`:`调用本机 Spine 自动生成 ${t.value.spineVersion} 工程`);function A($){return $==="跟随导出"?t.value.keyframeCurve==="bezier"?"bezier":"linear":$==="贝塞尔"?"bezier":"linear"}e.systems.length||e.addSystem();function T(){Tw(e),h.value=!1,o.value="配置已保存到本地"}async function M($){var Z;const S=$.target,C=(Z=S.files)==null?void 0:Z[0];if(C){o.value="正在加载配置…",h.value=!1;try{await VP(e,C),o.value=`已加载:${C.name}`}catch(Fe){h.value=!0,o.value=Fe instanceof Error?Fe.message:String(Fe)}finally{S.value=""}}}async function R(){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 P(){const $=n.value;if(!$)return;a.value=!0,h.value=!1,o.value="正在加载预设…";const S=Kv("加载预设",`正在下载 ${$}…`);try{await S.paint();const C=await fetch(`/Preset/${encodeURIComponent($)}`,{cache:"no-store"});if(!C.ok)throw new Error(`无法读取预设:${$}`);const Z=await _3(C,Fe=>{S.update(Fe==null?null:Fe*55,`正在下载 ${$}…`)});S.update(58,"正在解析预设配置…"),S.update(70,"正在解析并恢复预设资源…"),await Ew(e,Z),o.value=`已加载预设:${$.replace(/\.json$/i,"")}`,await S.finish("预设加载完成")}catch(C){h.value=!0;const Z=C instanceof Error?C.message:String(C);o.value=`${Z},请检查预设文件命名`,await S.fail(Z)}finally{a.value=!1,n.value=""}}Da(()=>{R(),I(),F=window.setInterval(I,3e3)});let F;uu(()=>{F!==void 0&&window.clearInterval(F)});async function I(){f.value=await aB()}function k(){return new Promise($=>requestAnimationFrame(()=>$()))}async function O($){e.timeline.playing=!1,e.timeline.frame=0,e.timeline.recorded=!1;for(const Z of e.systems)Z.frames=void 0;e.recalcTotalFrames(),await k(),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(Z=>setTimeout(Z,50))}$==null||$(1)}async function L(){if(!l.value){l.value=!0,c.value="json",d.value=!1,p.value="",u.value="正在重新计算粒子动画…";try{await O();const $=ay({systems:e.systems,timeline:e.timeline,settings:t.value});yy($.text,t.value.spineVersion),q3($,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 U(){if(l.value)return;l.value=!0,c.value="spine",d.value=!1,p.value="",u.value="正在重新计算粒子动画…";const $=Kv("导出 Spine 包","正在重新计算粒子动画…");try{await $.paint(),await O(Fe=>$.update(Fe*18,"正在重新计算粒子动画…")),$.update(20,"正在生成 Spine JSON…");const S=ay({systems:e.systems,timeline:e.timeline,settings:t.value});yy(S.text,t.value.spineVersion),u.value="正在整理图片并调用本机 Spine…";const C=t.value.fileName.replace(/\.json$/i,"")||"SpineParticle",Z=await oB({projectName:C,spineVersion:t.value.spineVersion,skeletonJson:S.text,systems:e.systems},({phase:Fe,progress:ft})=>{Fe==="images"?$.update(ft==null?null:22+ft*18,"正在整理工程图片…"):Fe==="upload"?$.update(ft==null?null:40+ft*30,"正在上传数据到 Spine 连接器…"):Fe==="processing"?$.update(null,"Spine 正在转换工程,请稍候…"):$.update(ft==null?null:82+ft*16,"正在下载生成的 Spine 工程包…")});$.update(99,"正在交给浏览器下载…"),lB(Z.blob,Z.fileName),u.value=`已生成 ${Z.fileName}:包含 .spine 工程和 ${Z.imageCount} 张图片,Spine ${Z.spineEditorVersion}`,await I(),await $.finish("Spine 工程包已开始下载")}catch(S){d.value=!0,S instanceof zm&&S.pairUrl&&(p.value=S.pairUrl),u.value=S instanceof Error?S.message:String(S),await I(),await $.fail(u.value)}finally{l.value=!1,c.value=null}}async function B(){if(!l.value){l.value=!0,c.value="images",d.value=!1,p.value="",u.value="正在整理当前粒子系统使用的图片…";try{const $=await vB({systems:e.systems,imagesPath:t.value.imagesPath}),S=yB($.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 D=pt(()=>{const $=e.systems.findIndex(S=>S.id===e.activeId);return $>=0?$:0}),_=pt(()=>e.systems[D.value]||null),X=pt(()=>_.value?g1(_.value.config,e.timeline.fps):30),N=pt(()=>{var S;const $=(S=_.value)==null?void 0:S.config;return $?Math.max(1,Math.ceil(Number($.loopDurationFrames)||1)):1}),V=pt(()=>e.activeObjectType),G=pt(()=>e.activeObjectType==="collision"&&e.colliders.find($=>$.id===e.activeObjectId)||null),j=pt(()=>e.activeObjectType==="path"&&e.paths.find($=>$.id===e.activeObjectId)||null),ne=pt(()=>e.activeObjectType==="spine"&&e.spines.find($=>$.id===e.activeObjectId)||null),Q=pt(()=>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)),de=pt(()=>{const $=e.spines.find(S=>S.selectedBone&&S.bones.some(C=>C.name===S.selectedBone));return $?{spine:$,boneName:$.selectedBone}:null}),me=pt(()=>{var C;const $=(C=_.value)==null?void 0:C.config;if(!$||$.emitterFollowMode!=="bone")return null;const S=e.spines.find(Z=>Z.id===$.emitterFollowSpineId);return!S||!S.bones.some(Z=>Z.name===$.emitterFollowBoneName)?null:{spine:S,boneName:$.emitterFollowBoneName}}),we=ht(!1),Re=pt(()=>{var S;const $=new Set(((S=_.value)==null?void 0:S.config.collisionColliderIds)||[]);return e.colliders.filter(C=>$.has(C.id))}),ge=pt(()=>{var S;const $=new Set(((S=_.value)==null?void 0:S.config.collisionColliderIds)||[]);return e.colliders.filter(C=>!$.has(C.id))});cs(()=>{var $,S;return[($=_.value)==null?void 0:$.id,(S=_.value)==null?void 0:S.config.collision]},()=>{we.value=!1});function Ae($){var C;const S=(C=_.value)==null?void 0:C.config;!S||S.collisionColliderIds.includes($)||(S.collisionColliderIds.push($),we.value=!1)}function H($){var C;const S=(C=_.value)==null?void 0:C.config;S&&(S.collisionColliderIds=S.collisionColliderIds.filter(Z=>Z!==$))}Qo(()=>{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)}),Qo(()=>{if(!_.value)return;const $=Gr(_.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")&&Pe($)}),Qo(()=>{const $=new Set(e.colliders.map(S=>S.id));for(const S of e.systems){const C=Gr(S.config),Z=C.collisionColliderIds.filter(Ot=>$.has(Ot));if(Z.length!==C.collisionColliderIds.length&&(C.collisionColliderIds=Z),C.spawnPathId>0&&!e.paths.some(Ot=>Ot.id===C.spawnPathId)&&(C.spawnPathId=0,(C.emissionAngleMode==="path-normal"||C.emissionAngleMode==="path-tangent")&&(C.emissionAngleMode="fixed")),C.emitterFollowMode!=="bone")continue;const Fe=e.spines.find(Ot=>Ot.id===C.emitterFollowSpineId);!!(Fe!=null&&Fe.bones.some(Ot=>Ot.name===C.emitterFollowBoneName))||(C.emitterFollowMode="none",C.emitterFollowSpineId=0,C.emitterFollowBoneName="")}}),Qo(()=>{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 K=[{x:0,y:0},{x:1,y:1}],q=[{x:0,y:1},{x:1,y:1}],z=[{x:0,y:0},{x:.2,y:1},{x:.8,y:1},{x:1,y:0}],ee=[{x:0,y:0},{x:.1,y:1},{x:.9,y:1},{x:1,y:0}],le=[{x:0,y:1},{x:1,y:1}],ve=[{x:0,y:1},{x:1,y:1}],re=La({config:!0,scene:!1,emitMode:!0,shape:!0,attr:!0,look:!0,mods:!0,export:!1});function ye($){re[$]=!re[$]}function he($){var C;const S=(C=_.value)==null?void 0:C.config;S&&(S.mode=$,$==="stream"&&!(S.duration>0)&&(S.duration=1))}function Xe($){var Z;const S=(Z=_.value)==null?void 0:Z.config;if(!S)return;const C=Math.min(1800,Math.max(1,Math.ceil(Number($)||1)));S.loopDurationFrames=C}function Pe($){const S=Nl();$.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 Oe($){var Fe;const S=(Fe=_.value)==null?void 0:Fe.config;if(!S||S.streamBehavior===$)return;const C=$==="loop",Z=C?"进入循环持续模式后,粒子跟随设置会失效并恢复默认值。是否继续?":"退出循环持续模式后,粒子跟随设置会失效并恢复默认值。是否继续?";window.confirm(Z)&&(Pe(S),S.streamBehavior=$,C||(S.generateLoopStartAnimation=!1,S.generateLoopEndAnimation=!1))}function it($,S){var Fe;const C=(Fe=_.value)==null?void 0:Fe.config;if(!C)return;const Z=S.target.checked;$==="start"?C.generateLoopStartAnimation=Z:C.generateLoopEndAnimation=Z}function bt($,S){var Fe;const C=(Fe=_.value)==null?void 0:Fe.config;if(!C)return;const Z=Math.min(1800,Math.max(1,Math.ceil(Number(S.target.value)||30)));$==="start"?C.loopStartDurationFrames=Z:C.loopEndDurationFrames=Z}function Ct($,S){var Fe;const C=(Fe=_.value)==null?void 0:Fe.config;if(!C)return;const Z=S.target.checked;$==="start"?C.loopStartUseCustomDuration=Z:C.loopEndUseCustomDuration=Z}function wt($,S){const C=$.target.value;if(S.emitterFollowMode=C,C!=="bone"){S.emitterFollowSpineId=0,S.emitterFollowBoneName="";return}Et(S)}function Et($){const S=de.value;if(!S){$.emitterFollowMode="none",$.emitterFollowSpineId=0,$.emitterFollowBoneName="";return}$.emitterFollowMode="bone",$.emitterFollowSpineId=S.spine.id,$.emitterFollowBoneName=S.boneName}const Kt={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 yi($){var Z;const S=(Z=_.value)==null?void 0:Z.config;if($==="export"){e.settings.exportSettings=Tp();return}if(!S)return;const C=Nl();for(const Fe of Kt[$])S[Fe]=C[Fe]}function Bi(){t.value.fps=Math.min(240,Math.max(1,Math.round(Number(t.value.fps)||30)))}function Ls($){var S;e.selectSystem(((S=e.systems[$])==null?void 0:S.id)??0)}function an(){e.addSystem()}function xi(){e.addCollider()}function ce(){e.addPath()}function fe(){e.addSpine()}function It(){e.duplicateSelectedObject()}function Rt($,S,C=0,Z=0,Fe=0,ft=0){return{x:$,y:S,inX:C,inY:Z,outX:Fe,outY:ft}}function Zt(){const $=j.value;if(!(!$||!$.preset))if($.preset==="circle"){const C=60.751328;$.points=[Rt(110,0,0,-C,0,C),Rt(0,110,C,0,-C,0),Rt(-110,0,0,C,0,-C),Rt(0,-110,-C,0,C,0)],$.closed=!0}else if($.preset==="square")$.points=[Rt(-100,-100),Rt(100,-100),Rt(100,100),Rt(-100,100)],$.closed=!0;else{const S=$.preset==="star"?10:6;$.points=Array.from({length:S},(C,Z)=>{const Fe=$.preset==="star"&&Z%2?50:110,ft=-Math.PI*.5+Z/S*Math.PI*2;return Rt(Math.cos(ft)*Fe,Math.sin(ft)*Fe)}),$.closed=!0}}function St(){j.value&&(j.value.points=[])}function Ms(){_.value&&(_.value.config.seed=Math.floor(Math.random()*999999)+1)}function Ds($){var C;const S=(C=_.value)==null?void 0:C.config;!S||$==="direction"||(S.speedOverLifeMode=$,$==="curve"&&S.speedOverLifeMin===S.speedOverLifeMax&&(S.speedOverLifeMin=0,S.speedOverLifeMax=1))}function Li(){var S;const $=(S=_.value)==null?void 0:S.config;!$||$.scaleOverLifeMode!=="curve"||($.scaleOverLifeMin===$.scaleOverLifeMax&&($.scaleOverLifeMin=0,$.scaleOverLifeMax=1),$.scaleYOverLifeMin===$.scaleYOverLifeMax&&($.scaleYOverLifeMin=0,$.scaleYOverLifeMax=1))}function Ts($){var C;const S=(C=_.value)==null?void 0:C.config;!S||$==="direction"||(S.scaleOverLifeMode=$,Li())}const qr={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 on(){var C;const $=(C=_.value)==null?void 0:C.config;if(!$)return;const S=qr[$.shape];S&&Object.assign($,S)}function Wi(){var S;const $=(S=_.value)==null?void 0:S.config;!$||$.spawnPathId>0||($.emissionAngleMode==="path-normal"||$.emissionAngleMode==="path-tangent")&&($.emissionAngleMode="fixed")}const Kr=ht(null),Zr=ht(null),Ns=ht(null),ln=ht(null),cn=ht(null);function Nn(){var C;const $=(C=_.value)==null?void 0:C.config;if(!$)return;const S=Math.max(0,...$.trailResources.map(Z=>Z.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:le.map(Z=>({...Z})),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:q.map(Z=>({...Z})),shapeEnabled:!1,shapeCurve:ve.map(Z=>({...Z}))}),ie()}function Jr($){var S;cn.value=$,(S=ln.value)==null||S.click()}function Us($,S){var Fe;const C=(Fe=_.value)==null?void 0:Fe.config;if(!C)return;const Z=$==="trailGridCols"?32:16;C[$]=Math.min(Z,Math.max(2,Math.round(Number(S)||2)))}function $a($,S){var Z;const C=(Z=_.value)==null?void 0:Z.config.trailResources.find(Fe=>Fe.id===$);C&&(C.boneCount=Math.min(16,Math.max(2,Math.round(Number(S)||2))))}function Qr($,S){var Z;const C=(Z=_.value)==null?void 0:Z.config.trailResources.find(Fe=>Fe.id===$);C&&(C.rotation=Math.max(-360,Math.min(360,Number(S)||0)))}async function W($){var Ot,Ht;const S=$.target,C=(Ot=S.files)==null?void 0:Ot[0],Z=(Ht=_.value)==null?void 0:Ht.config,Fe=Z==null?void 0:Z.trailResources.find(Gt=>Gt.id===cn.value);if(!C||!Fe){S.value="";return}const ft=await Ye(C);Fe.texture=Or(await mt.fromURL(ft)),Fe.previewUrl=ft,Fe.textureName=C.name.replace(/\.[^.]+$/,"")||"trail",S.value="",cn.value=null}async function Y($){var Z;const S=(Z=_.value)==null?void 0:Z.config,C=S==null?void 0:S.trailResources.find(Fe=>Fe.id===$);C&&(C.texture=Or(await mt.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=q.map(Fe=>({...Fe})),C.shapeEnabled=!1,C.shapeCurve=ve.map(Fe=>({...Fe})),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=le.map(Fe=>({...Fe})),ie())}function J($){var Z;const S=(Z=_.value)==null?void 0:Z.config.trailResources;if(!S||S.length<=1)return;const C=S.findIndex(Fe=>Fe.id===$);C>=0&&S.splice(C,1),ie()}function ie(){var Fe;const $=(Fe=_.value)==null?void 0:Fe.config.trailResources;if(!($!=null&&$.length))return;if($.length===1){$[0].weight=100,$[0].locked=!1;return}const S=$.filter(ft=>ft.locked),C=$.filter(ft=>!ft.locked);let Z=S.reduce((ft,Ot)=>ft+Math.max(0,Number(Ot.weight)||0),0);Z>100&&(Ie(S,100,!0),Z=100),Ie(C,100-Z)}function ue($,S){var Ht;const C=(Ht=_.value)==null?void 0:Ht.config.trailResources;if(!(C!=null&&C.length))return;if(C.length===1){C[0].weight=100,C[0].locked=!1;return}const Z=C.find(Gt=>Gt.id===$);if(!Z||Z.locked)return;const Fe=C.filter(Gt=>Gt.id!==$&&Gt.locked).reduce((Gt,ei)=>Gt+Math.max(0,Number(ei.weight)||0),0),ft=Math.max(0,100-Fe),Ot=C.filter(Gt=>Gt.id!==$&&!Gt.locked);Z.weight=Je(Math.min(ft,Math.max(0,Number(S)||0))),Ot.length?Ie(Ot,ft-Z.weight,!0):Z.weight=Je(ft)}function pe($){var Z;const S=(Z=_.value)==null?void 0:Z.config.trailResources;if(!S||S.length===1)return;const C=S.find(Fe=>Fe.id===$);C&&(C.locked=!C.locked)}function _e($,S){const C=S.target;$.color=Ze(C.value,$.color),C.value=$.color}function Me($,S){_e($,S),S.target.blur()}function be(){var C;const $=(C=_.value)==null?void 0:C.config;if(!$)return;const S=Math.max(0,...$.imageResources.map(Z=>Z.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:ee.map(Z=>({...Z}))}),Ft()}function Le($){var S;Ns.value=$,(S=Kr.value)==null||S.click()}function Ce($){var S;Ns.value=$,(S=Zr.value)==null||S.click()}async function Be($){var Ht,Gt;const S=$.target,C=(Ht=S.files)==null?void 0:Ht[0],Z=(Gt=_.value)==null?void 0:Gt.config,Fe=Z==null?void 0:Z.imageResources.find(ei=>ei.id===Ns.value);if(!C||!Fe){S.value="";return}const ft=await Ye(C),Ot=Or(await mt.fromURL(ft));Fe.texture=Ot,Fe.previewUrl=ft,Fe.textureFolder="",Fe.textureName=C.name.replace(/\.[^.]+$/,"")||"particle",S.value="",Ns.value=null}async function Te($){var ft;const S=$.target,C=Array.from(S.files||[]).sort((Ot,Ht)=>Ot.name.localeCompare(Ht.name,void 0,{numeric:!0,sensitivity:"base"})),Z=(ft=_.value)==null?void 0:ft.config,Fe=Z==null?void 0:Z.imageResources.find(Ot=>Ot.id===Ns.value);if(!C.length||!Fe){S.value="";return}Fe.sequenceFrames=await Promise.all(C.map(async Ot=>{const Ht=await Ye(Ot);return{name:Ot.name,previewUrl:Ht,texture:Or(await mt.fromURL(Ht))}})),Fe.imageMode="sequence",S.value="",Ns.value=null}function Ye($){return new Promise((S,C)=>{const Z=new FileReader;Z.onload=()=>S(String(Z.result||"")),Z.onerror=()=>C(Z.error),Z.readAsDataURL($)})}function nt($){var Z;const S=(Z=_.value)==null?void 0:Z.config,C=S==null?void 0:S.imageResources.find(Fe=>Fe.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=ee.map(Fe=>({...Fe})),C.locked=!1,Ft())}function Ze($,S){let C=$.trim().replace(/^#/,"");return/^[0-9a-f]{3}$/i.test(C)&&(C=C.split("").map(Z=>Z+Z).join("")),/^[0-9a-f]{6}$/i.test(C)?`#${C.toLowerCase()}`:S}function rt($,S){const C=S.target;$.colorStart=Ze(C.value,$.colorStart),C.value=$.colorStart}function Qe($,S){rt($,S),S.target.blur()}function Se($){var Z;const S=(Z=_.value)==null?void 0:Z.config.imageResources;if(!S||S.length<=1)return;const C=S.findIndex(Fe=>Fe.id===$);C>=0&&S.splice(C,1),Ft()}function Je($){return Math.round($)}function Ie($,S,C=!1){if(!$.length)return;const Z=Math.max(0,Je(S)),Fe=C?$.reduce((Ot,Ht)=>Ot+Math.max(0,Number(Ht.weight)||0),0):0;let ft=0;$.forEach((Ot,Ht)=>{const Gt=Ht===$.length-1,ei=Je(Gt?Z-ft:Fe>0?Z*Math.max(0,Number(Ot.weight)||0)/Fe:Z/$.length);Ot.weight=ei,ft+=ei})}function Ft(){var Fe;const $=(Fe=_.value)==null?void 0:Fe.config.imageResources;if(!($!=null&&$.length))return;if($.length===1){$[0].weight=100,$[0].locked=!1;return}const S=$.filter(ft=>ft.locked),C=$.filter(ft=>!ft.locked);let Z=S.reduce((ft,Ot)=>ft+Math.max(0,Number(Ot.weight)||0),0);Z>100&&(Ie(S,100,!0),Z=100),Ie(C,100-Z)}function Jt($,S){var Ht;const C=(Ht=_.value)==null?void 0:Ht.config.imageResources;if(!(C!=null&&C.length))return;if(C.length===1){C[0].weight=100,C[0].locked=!1;return}const Z=C.find(Gt=>Gt.id===$);if(!Z||Z.locked)return;const Fe=C.filter(Gt=>Gt.id!==$&&Gt.locked).reduce((Gt,ei)=>Gt+Math.max(0,Number(ei.weight)||0),0),ft=Math.max(0,100-Fe),Ot=C.filter(Gt=>Gt.id!==$&&!Gt.locked);if(Z.weight=Je(Math.min(ft,Math.max(0,Number(S)||0))),!Ot.length){Z.weight=Je(ft);return}Ie(Ot,ft-Z.weight,!0)}function Mi($){var Z;const S=(Z=_.value)==null?void 0:Z.config.imageResources;if(!S||S.length===1)return;const C=S.find(Fe=>Fe.id===$);C&&(C.locked=!C.locked)}return($,S)=>(te(),oe("div",xB,[S[391]||(S[391]=E("div",{class:"panel-header"},[E("span",null,"Spine粒子编辑器-Yeomai")],-1)),E("div",bB,[E("div",wB,[E("div",{class:"group-head",onClick:S[0]||(S[0]=C=>ye("config"))},[E("span",SB,je(re.config?"▸":"▾"),1),S[197]||(S[197]=E("span",null,"配置管理",-1))]),xe(E("div",_B,[E("div",MB,[E("button",{title:"保存全部编辑器配置 (Ctrl+S)",onClick:T},"保存配置"),E("button",{title:"加载本地编辑器配置",onClick:S[1]||(S[1]=C=>{var Z;return(Z=i.value)==null?void 0:Z.click()})},"加载配置"),xe(E("select",{"onUpdate:modelValue":S[2]||(S[2]=C=>n.value=C),"aria-label":"预设列表",disabled:!r.value.length||a.value,onPointerdown:R,onFocus:R,onChange:P},[E("option",AB,je(r.value.length?"选择预设":"无预设文件"),1),(te(!0),oe(Ke,null,ci(r.value,C=>(te(),oe("option",{key:C.file,value:C.file},je(C.name),9,EB))),128))],40,TB),[[jt,n.value]]),E("input",{ref_key:"configFileInput",ref:i,hidden:"",type:"file",accept:".json,application/json",onChange:M},null,544)]),o.value?(te(),oe("div",{key:0,class:ot(["config-message",{error:h.value}])},je(o.value),3)):Ue("",!0)],512),[[yr,!re.config]])]),E("div",CB,[E("div",{class:"group-head scene-head",onClick:S[3]||(S[3]=C=>ye("scene"))},[E("span",IB,je(re.scene?"▸":"▾"),1),S[198]||(S[198]=E("span",null,"场景对象",-1)),E("div",RB,[E("button",{class:"scene-add",title:"添加粒子系统",onClick:yt(an,["stop"])},"+粒子"),E("button",{class:"scene-add",title:"添加碰撞体",onClick:yt(xi,["stop"])},"+碰撞"),E("button",{class:"scene-add",title:"添加路径",onClick:yt(ce,["stop"])},"+路径"),E("button",{class:"scene-add",title:"添加 Spine",onClick:yt(fe,["stop"])},"+Spine"),E("button",{class:"scene-add",disabled:!Q.value,title:"复制当前选中的场景对象",onClick:yt(It,["stop"])},"+Copy",8,PB)])]),xe(E("div",kB,[E("div",FB,[(te(!0),oe(Ke,null,ci(ke(e).systems,(C,Z)=>(te(),oe("div",{key:`particle-${C.id}`,class:ot(["tree-item scene-object-item",{on:V.value==="particle"&&C.id===ke(e).activeObjectId}]),onClick:Fe=>Ls(Z)},[S[201]||(S[201]=E("span",{class:"tdot"},"●",-1)),E("span",BB,je(C.config.name||"ParticleSystem"+(Z+1)),1),E("button",{class:ot(["scene-object-eye",{off:C.visible===!1}]),title:C.visible===!1?"显示粒子系统":"隐藏粒子系统","aria-label":C.visible===!1?"显示粒子系统":"隐藏粒子系统",onClick:yt(Fe=>C.visible=C.visible===!1,["stop"])},[(te(),oe("svg",DB,[S[199]||(S[199]=E("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]=E("circle",{cx:"12",cy:"12",r:"2.8"},null,-1)),C.visible===!1?(te(),oe("path",NB)):Ue("",!0)]))],10,LB),S[202]||(S[202]=E("span",{class:"scene-object-kind"},"粒子",-1)),E("button",{class:"scene-object-delete",title:"删除粒子系统",onClick:yt(Fe=>ke(e).removeSystem(C.id),["stop"])},"✕",8,UB)],10,OB))),128)),(te(!0),oe(Ke,null,ci(ke(e).colliders,C=>(te(),oe("div",{key:`collision-${C.id}`,class:ot(["tree-item scene-object-item",{on:V.value==="collision"&&C.id===ke(e).activeObjectId}]),onClick:Z=>ke(e).selectSceneObject("collision",C.id)},[S[205]||(S[205]=E("span",{class:"tdot collision-dot"},"■",-1)),E("span",VB,je(C.name),1),E("button",{class:ot(["scene-object-eye",{off:C.visible===!1}]),title:C.visible===!1?"显示碰撞体":"隐藏碰撞体","aria-label":C.visible===!1?"显示碰撞体":"隐藏碰撞体",onClick:yt(Z=>C.visible=C.visible===!1,["stop"])},[(te(),oe("svg",$B,[S[203]||(S[203]=E("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]=E("circle",{cx:"12",cy:"12",r:"2.8"},null,-1)),C.visible===!1?(te(),oe("path",GB)):Ue("",!0)]))],10,YB),S[206]||(S[206]=E("span",{class:"scene-object-kind"},"碰撞",-1)),E("button",{class:"scene-object-delete",title:"删除碰撞体",onClick:yt(Z=>ke(e).removeCollider(C.id),["stop"])},"✕",8,HB)],10,XB))),128)),(te(!0),oe(Ke,null,ci(ke(e).paths,C=>(te(),oe("div",{key:`path-${C.id}`,class:ot(["tree-item scene-object-item",{on:V.value==="path"&&C.id===ke(e).activeObjectId}]),onClick:Z=>ke(e).selectSceneObject("path",C.id)},[S[209]||(S[209]=E("span",{class:"tdot path-dot"},"◇",-1)),E("span",WB,je(C.name),1),E("button",{class:ot(["scene-object-eye",{off:C.visible===!1}]),title:C.visible===!1?"显示路径":"隐藏路径","aria-label":C.visible===!1?"显示路径":"隐藏路径",onClick:yt(Z=>C.visible=C.visible===!1,["stop"])},[(te(),oe("svg",qB,[S[207]||(S[207]=E("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]=E("circle",{cx:"12",cy:"12",r:"2.8"},null,-1)),C.visible===!1?(te(),oe("path",KB)):Ue("",!0)]))],10,zB),S[210]||(S[210]=E("span",{class:"scene-object-kind"},"路径",-1)),E("button",{class:"scene-object-delete",title:"删除路径",onClick:yt(Z=>ke(e).removePath(C.id),["stop"])},"✕",8,ZB)],10,jB))),128)),(te(!0),oe(Ke,null,ci(ke(e).spines,C=>(te(),oe("div",{key:`spine-${C.id}`,class:ot(["tree-item scene-object-item",{on:V.value==="spine"&&C.id===ke(e).activeObjectId}]),onClick:Z=>ke(e).selectSceneObject("spine",C.id)},[S[213]||(S[213]=E("span",{class:"tdot spine-dot"},"◆",-1)),E("span",QB,je(C.name),1),E("button",{class:ot(["scene-object-eye",{off:C.visible===!1}]),title:C.visible===!1?"显示 Spine":"隐藏 Spine","aria-label":C.visible===!1?"显示 Spine":"隐藏 Spine",onClick:yt(Z=>C.visible=C.visible===!1,["stop"])},[(te(),oe("svg",tL,[S[211]||(S[211]=E("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]=E("circle",{cx:"12",cy:"12",r:"2.8"},null,-1)),C.visible===!1?(te(),oe("path",iL)):Ue("",!0)]))],10,eL),S[214]||(S[214]=E("span",{class:"scene-object-kind"},"Spine",-1)),E("button",{class:"scene-object-delete",title:"删除 Spine",onClick:yt(Z=>ke(e).removeSpine(C.id),["stop"])},"✕",8,sL)],10,JB))),128)),!ke(e).systems.length&&!ke(e).colliders.length&&!ke(e).paths.length&&!ke(e).spines.length?(te(),oe("div",nL,"场景中暂无对象")):Ue("",!0)]),V.value==="particle"&&_.value?(te(),oe(Ke,{key:0},[E("label",rL,[S[215]||(S[215]=E("span",null,"名称",-1)),xe(E("input",{"onUpdate:modelValue":S[4]||(S[4]=C=>_.value.config.name=C),class:"inp"},null,512),[[ct,_.value.config.name]])]),Ne(qe,{label:"位置X",min:-2e3,max:2e3,step:1,modelValue:_.value.config.centerX,"onUpdate:modelValue":S[5]||(S[5]=C=>_.value.config.centerX=C)},null,8,["modelValue"]),Ne(qe,{label:"位置Y",min:-2e3,max:2e3,step:1,modelValue:_.value.config.centerY,"onUpdate:modelValue":S[6]||(S[6]=C=>_.value.config.centerY=C)},null,8,["modelValue"]),Ne(qe,{label:"偏移X",min:-2e3,max:2e3,step:1,modelValue:_.value.config.offsetX,"onUpdate:modelValue":S[7]||(S[7]=C=>_.value.config.offsetX=C)},null,8,["modelValue"]),Ne(qe,{label:"偏移Y",min:-2e3,max:2e3,step:1,modelValue:_.value.config.offsetY,"onUpdate:modelValue":S[8]||(S[8]=C=>_.value.config.offsetY=C)},null,8,["modelValue"]),Ne(qe,{label:"旋转",min:-360,max:360,step:1,modelValue:_.value.config.rootRotation,"onUpdate:modelValue":S[9]||(S[9]=C=>_.value.config.rootRotation=C)},null,8,["modelValue"]),Ne(qe,{label:"缩放X",min:.05,max:10,step:.05,modelValue:_.value.config.rootScaleX,"onUpdate:modelValue":S[10]||(S[10]=C=>_.value.config.rootScaleX=C)},null,8,["modelValue"]),Ne(qe,{label:"缩放Y",min:.05,max:10,step:.05,modelValue:_.value.config.rootScaleY,"onUpdate:modelValue":S[11]||(S[11]=C=>_.value.config.rootScaleY=C)},null,8,["modelValue"]),E("div",aL,[S[216]||(S[216]=E("label",{for:"system-seed"},"随机种子",-1)),xe(E("input",{id:"system-seed",class:"seed-input",type:"number",min:"0",step:"1","onUpdate:modelValue":S[12]||(S[12]=C=>_.value.config.seed=C),title:"控制粒子系统内全部随机属性、资源选择与修改器随机采样"},null,512),[[ct,_.value.config.seed,void 0,{number:!0}]]),E("button",{class:"seed-random",title:"生成新的全局随机种子",onClick:Ms},"⚄")]),S[217]||(S[217]=E("div",{class:"seed-hint"},"控制初始随机参数、资源选择和修改器随机采样;相同种子可复现相同效果",-1))],64)):G.value?(te(),oe(Ke,{key:1},[S[242]||(S[242]=E("div",{class:"object-editor-title"},"碰撞体属性",-1)),E("label",oL,[S[218]||(S[218]=E("span",null,"碰撞体名称",-1)),xe(E("input",{"onUpdate:modelValue":S[13]||(S[13]=C=>G.value.name=C),class:"inp"},null,512),[[ct,G.value.name]])]),E("div",lL,[E("label",cL,[S[220]||(S[220]=E("span",null,"类型",-1)),xe(E("select",{"onUpdate:modelValue":S[14]||(S[14]=C=>G.value.shape=C),class:"inp"},[...S[219]||(S[219]=[to('<option value="circle" data-v-988d7abf>圆形</option><option value="ellipse" data-v-988d7abf>椭圆</option><option value="rect" data-v-988d7abf>矩形</option><option value="polygon" data-v-988d7abf>多边形</option><option value="custom" data-v-988d7abf>自定义</option>',5)])],512),[[jt,G.value.shape]])]),E("label",hL,[S[221]||(S[221]=E("span",null,"启用",-1)),xe(E("input",{"onUpdate:modelValue":S[15]||(S[15]=C=>G.value.enabled=C),type:"checkbox"},null,512),[[ti,G.value.enabled]])])]),E("div",uL,[E("label",dL,[S[222]||(S[222]=E("span",null,"X 位置",-1)),xe(E("input",{"onUpdate:modelValue":S[16]||(S[16]=C=>G.value.x=C),type:"number",class:"inp"},null,512),[[ct,G.value.x,void 0,{number:!0}]])]),E("label",fL,[S[223]||(S[223]=E("span",null,"Y 位置",-1)),xe(E("input",{"onUpdate:modelValue":S[17]||(S[17]=C=>G.value.y=C),type:"number",class:"inp"},null,512),[[ct,G.value.y,void 0,{number:!0}]])])]),Ne(qe,{label:"旋转",min:-360,max:360,step:1,modelValue:G.value.rotation,"onUpdate:modelValue":S[18]||(S[18]=C=>G.value.rotation=C)},null,8,["modelValue"]),E("div",mL,[E("label",pL,[S[224]||(S[224]=E("span",null,"缩放 X",-1)),xe(E("input",{"onUpdate:modelValue":S[19]||(S[19]=C=>G.value.scaleX=C),type:"number",min:"0.05",step:"0.05",class:"inp"},null,512),[[ct,G.value.scaleX,void 0,{number:!0}]])]),E("label",gL,[S[225]||(S[225]=E("span",null,"缩放 Y",-1)),xe(E("input",{"onUpdate:modelValue":S[20]||(S[20]=C=>G.value.scaleY=C),type:"number",min:"0.05",step:"0.05",class:"inp"},null,512),[[ct,G.value.scaleY,void 0,{number:!0}]])])]),G.value.shape==="circle"?(te(),Qt(qe,{key:0,label:"半径",min:1,max:1e3,step:1,modelValue:G.value.radius,"onUpdate:modelValue":S[21]||(S[21]=C=>G.value.radius=C)},null,8,["modelValue"])):G.value.shape==="ellipse"?(te(),oe("div",vL,[E("label",yL,[S[226]||(S[226]=E("span",null,"X 半径",-1)),xe(E("input",{"onUpdate:modelValue":S[22]||(S[22]=C=>G.value.radiusX=C),type:"number",min:"1",class:"inp"},null,512),[[ct,G.value.radiusX,void 0,{number:!0}]])]),E("label",xL,[S[227]||(S[227]=E("span",null,"Y 半径",-1)),xe(E("input",{"onUpdate:modelValue":S[23]||(S[23]=C=>G.value.radiusY=C),type:"number",min:"1",class:"inp"},null,512),[[ct,G.value.radiusY,void 0,{number:!0}]])])])):(te(),oe("div",bL,[E("label",wL,[S[228]||(S[228]=E("span",null,"宽度",-1)),xe(E("input",{"onUpdate:modelValue":S[24]||(S[24]=C=>G.value.width=C),type:"number",min:"1",class:"inp"},null,512),[[ct,G.value.width,void 0,{number:!0}]])]),E("label",SL,[S[229]||(S[229]=E("span",null,"高度",-1)),xe(E("input",{"onUpdate:modelValue":S[25]||(S[25]=C=>G.value.height=C),type:"number",min:"1",class:"inp"},null,512),[[ct,G.value.height,void 0,{number:!0}]])])])),G.value.shape==="polygon"||G.value.shape==="custom"?(te(),Qt(qe,{key:3,label:"边数",min:3,max:16,step:1,modelValue:G.value.sides,"onUpdate:modelValue":S[26]||(S[26]=C=>G.value.sides=C)},null,8,["modelValue"])):Ue("",!0),E("label",_L,[S[231]||(S[231]=E("span",null,"碰撞响应",-1)),xe(E("select",{"onUpdate:modelValue":S[27]||(S[27]=C=>G.value.response=C),class:"inp"},[...S[230]||(S[230]=[E("option",{value:"physics"},"物理(弹跳/摩擦)",-1),E("option",{value:"pause"},"暂停(停止不动)",-1),E("option",{value:"destroy"},"消失(立即销毁)",-1)])],512),[[jt,G.value.response]])]),G.value.response==="physics"?(te(),oe("div",ML,[E("label",TL,[S[232]||(S[232]=E("span",null,"弹性 (0-1)",-1)),xe(E("input",{"onUpdate:modelValue":S[28]||(S[28]=C=>G.value.elasticity=C),type:"number",min:"0",max:"1",step:"0.01",class:"inp"},null,512),[[ct,G.value.elasticity,void 0,{number:!0}]])]),E("label",AL,[S[233]||(S[233]=E("span",null,"摩擦 (0-1)",-1)),xe(E("input",{"onUpdate:modelValue":S[29]||(S[29]=C=>G.value.friction=C),type:"number",min:"0",max:"1",step:"0.01",class:"inp"},null,512),[[ct,G.value.friction,void 0,{number:!0}]])])])):Ue("",!0),E("div",EL,[E("label",CL,[xe(E("input",{"onUpdate:modelValue":S[30]||(S[30]=C=>G.value.followPath=C),type:"checkbox"},null,512),[[ti,G.value.followPath]]),S[234]||(S[234]=ai("跟随路径移动",-1))]),G.value.followPath?(te(),oe(Ke,{key:0},[E("label",IL,[S[236]||(S[236]=E("span",null,"目标路径",-1)),xe(E("select",{"onUpdate:modelValue":S[31]||(S[31]=C=>G.value.followPathId=C),class:"inp"},[S[235]||(S[235]=E("option",{value:0},"(未选择)",-1)),(te(!0),oe(Ke,null,ci(ke(e).paths,C=>(te(),oe("option",{key:C.id,value:C.id},je(C.name),9,RL))),128))],512),[[jt,G.value.followPathId,void 0,{number:!0}]])]),E("div",PL,[E("label",kL,[S[237]||(S[237]=E("span",null,"移动时长(秒)",-1)),xe(E("input",{"onUpdate:modelValue":S[32]||(S[32]=C=>G.value.followDuration=C),type:"number",min:"0.05",step:"0.05",class:"inp"},null,512),[[ct,G.value.followDuration,void 0,{number:!0}]])]),E("label",FL,[S[239]||(S[239]=E("span",null,"曲线模式",-1)),xe(E("select",{"onUpdate:modelValue":S[33]||(S[33]=C=>G.value.followCurveMode=C),class:"inp"},[...S[238]||(S[238]=[E("option",null,"跟随导出",-1),E("option",null,"线性",-1),E("option",null,"贝塞尔",-1)])],512),[[jt,G.value.followCurveMode]])])]),E("label",OL,[xe(E("input",{"onUpdate:modelValue":S[34]||(S[34]=C=>G.value.followPathRotation=C),type:"checkbox"},null,512),[[ti,G.value.followPathRotation]]),S[240]||(S[240]=ai("方向沿路径",-1))]),S[241]||(S[241]=E("div",{class:"collider-curve-title"},[ai("移动进度曲线 "),E("small",null,"横轴:实时/移动时长 纵轴:路径进度(0=起点 → 1=终点)")],-1)),Ne(gn,{"model-value":G.value.followCurve||K,"default-value":K,mode:A(G.value.followCurveMode),"onUpdate:modelValue":S[35]||(S[35]=C=>G.value.followCurve=C)},null,8,["model-value","mode"])],64)):Ue("",!0)])],64)):j.value?(te(),oe(Ke,{key:2},[S[252]||(S[252]=E("div",{class:"object-editor-title"},"路径属性",-1)),E("label",BL,[S[243]||(S[243]=E("span",null,"路径名称",-1)),xe(E("input",{"onUpdate:modelValue":S[36]||(S[36]=C=>j.value.name=C),class:"inp"},null,512),[[ct,j.value.name]])]),E("div",LL,[E("label",DL,[S[244]||(S[244]=E("span",null,"X 位置",-1)),xe(E("input",{"onUpdate:modelValue":S[37]||(S[37]=C=>j.value.x=C),type:"number",class:"inp"},null,512),[[ct,j.value.x,void 0,{number:!0}]])]),E("label",NL,[S[245]||(S[245]=E("span",null,"Y 位置",-1)),xe(E("input",{"onUpdate:modelValue":S[38]||(S[38]=C=>j.value.y=C),type:"number",class:"inp"},null,512),[[ct,j.value.y,void 0,{number:!0}]])])]),Ne(qe,{label:"旋转",min:-360,max:360,step:1,modelValue:j.value.rotation,"onUpdate:modelValue":S[39]||(S[39]=C=>j.value.rotation=C)},null,8,["modelValue"]),E("div",UL,[E("label",XL,[S[246]||(S[246]=E("span",null,"缩放 X",-1)),xe(E("input",{"onUpdate:modelValue":S[40]||(S[40]=C=>j.value.scaleX=C),type:"number",min:"0.05",step:"0.05",class:"inp"},null,512),[[ct,j.value.scaleX,void 0,{number:!0}]])]),E("label",VL,[S[247]||(S[247]=E("span",null,"缩放 Y",-1)),xe(E("input",{"onUpdate:modelValue":S[41]||(S[41]=C=>j.value.scaleY=C),type:"number",min:"0.05",step:"0.05",class:"inp"},null,512),[[ct,j.value.scaleY,void 0,{number:!0}]])])]),E("label",YL,[S[248]||(S[248]=E("span",null,"闭合路径",-1)),xe(E("input",{"onUpdate:modelValue":S[42]||(S[42]=C=>j.value.closed=C),type:"checkbox"},null,512),[[ti,j.value.closed]])]),E("label",$L,[S[249]||(S[249]=E("span",null,"路径颜色",-1)),xe(E("input",{"onUpdate:modelValue":S[43]||(S[43]=C=>j.value.color=C),type:"color",class:"path-color"},null,512),[[ct,j.value.color]])]),S[253]||(S[253]=to('<div class="path-help" data-v-988d7abf><span data-v-988d7abf>操作说明:</span><ul data-v-988d7abf><li data-v-988d7abf>双击空白处/曲线:新建锚点</li><li data-v-988d7abf>双击锚点:删除节点</li><li data-v-988d7abf>双击第二下按住拖动:新建并拉出手柄</li><li data-v-988d7abf>拖动锚点移动位置,拖动手柄调整曲线</li><li data-v-988d7abf>Shift+拖动手柄:两侧完全对称</li><li data-v-988d7abf>Alt+拖动手柄:独立控制单侧</li><li data-v-988d7abf>Ctrl+点击/框选:加选节点</li><li data-v-988d7abf>Alt+点击/框选:减选节点</li><li data-v-988d7abf>Alt+单击空白处:清除全部选中</li><li data-v-988d7abf>选中多个节点后可整体拖动</li></ul></div>',1)),E("label",GL,[S[251]||(S[251]=E("span",null,"应用预设形状",-1)),xe(E("select",{"onUpdate:modelValue":S[44]||(S[44]=C=>j.value.preset=C),class:"inp"},[...S[250]||(S[250]=[to('<option value="" data-v-988d7abf>选择预设...</option><option value="circle" data-v-988d7abf>圆形</option><option value="square" data-v-988d7abf>方形</option><option value="polygon" data-v-988d7abf>多边形</option><option value="star" data-v-988d7abf>星形</option>',5)])],512),[[jt,j.value.preset]])]),E("button",{class:"path-action primary",onClick:Zt},"应用预设"),E("button",{class:"path-action",onClick:St},"清空锚点")],64)):ne.value?(te(),Qt(w3,{key:3,"spine-object":ne.value},null,8,["spine-object"])):(te(),oe("div",HL,"使用右上角按钮创建场景对象"))],512),[[yr,!re.scene]])]),V.value==="particle"&&_.value?(te(),oe(Ke,{key:0},[E("div",jL,[E("div",{class:"group-head",onClick:S[46]||(S[46]=C=>ye("emitMode"))},[E("span",WL,je(re.emitMode?"▸":"▾"),1),S[254]||(S[254]=E("span",null,"发射模式",-1)),E("button",{class:"group-reset",title:"重置发射模式参数",onClick:S[45]||(S[45]=yt(C=>yi("emitMode"),["stop"]))},"重置")]),xe(E("div",zL,[E("div",qL,[E("button",{class:ot(["seg",{on:_.value.config.mode==="stream"}]),onClick:S[47]||(S[47]=C=>he("stream"))},"持续",2),E("button",{class:ot(["seg",{on:_.value.config.mode==="burst"}]),onClick:S[48]||(S[48]=C=>he("burst"))},"爆发",2)]),_.value.config.mode==="stream"?(te(),oe(Ke,{key:0},[E("div",KL,[E("button",{class:ot(["seg",{on:_.value.config.streamBehavior==="normal"}]),onClick:S[49]||(S[49]=C=>Oe("normal"))},"常规持续",2),E("button",{class:ot(["seg",{on:_.value.config.streamBehavior==="loop"}]),onClick:S[50]||(S[50]=C=>Oe("loop"))},"循环持续",2)]),Ne(qe,{label:"发射速率",min:1,max:300,step:1,modelValue:_.value.config.rate,"onUpdate:modelValue":S[51]||(S[51]=C=>_.value.config.rate=C)},null,8,["modelValue"]),_.value.config.streamBehavior==="normal"?(te(),Qt(qe,{key:0,label:"发射时长",min:1/30,max:60,step:1/30,modelValue:_.value.config.duration,"onUpdate:modelValue":S[52]||(S[52]=C=>_.value.config.duration=C)},null,8,["modelValue"])):(te(),Qt(qe,{key:1,label:"发射时长 (f)",min:1,max:1800,step:1,"model-value":N.value,"onUpdate:modelValue":Xe},null,8,["model-value"])),_.value.config.streamBehavior==="loop"?(te(),oe("div",ZL,[E("div",JL,[E("label",QL,[E("input",{type:"checkbox",checked:_.value.config.generateLoopStartAnimation,onChange:S[53]||(S[53]=C=>it("start",C))},null,40,eD),S[255]||(S[255]=E("span",{class:"switch-ui"},null,-1)),S[256]||(S[256]=E("span",null,"生成开始循环动画",-1))]),_.value.config.generateLoopStartAnimation?(te(),oe("div",tD,[E("label",iD,[E("input",{type:"checkbox",checked:_.value.config.loopStartUseCustomDuration,onChange:S[54]||(S[54]=C=>Ct("start",C))},null,40,sD),S[257]||(S[257]=E("span",{class:"switch-ui"},null,-1)),S[258]||(S[258]=E("span",null,"指定时长",-1))]),E("label",nD,[_.value.config.loopStartUseCustomDuration?(te(),oe("input",{key:0,value:_.value.config.loopStartDurationFrames,type:"number",min:"1",max:"1800",step:"1","aria-label":"开始循环段时长",onChange:S[55]||(S[55]=C=>bt("start",C))},null,40,rD)):Ue("",!0),_.value.config.loopStartUseCustomDuration?(te(),oe("span",aD,"f")):(te(),oe("span",oD,"自动 "+je(X.value)+"f",1))])])):Ue("",!0)]),E("div",lD,[E("label",cD,[E("input",{type:"checkbox",checked:_.value.config.generateLoopEndAnimation,onChange:S[56]||(S[56]=C=>it("end",C))},null,40,hD),S[259]||(S[259]=E("span",{class:"switch-ui"},null,-1)),S[260]||(S[260]=E("span",null,"生成结束循环动画",-1))]),_.value.config.generateLoopEndAnimation?(te(),oe("div",uD,[E("label",dD,[E("input",{type:"checkbox",checked:_.value.config.loopEndUseCustomDuration,onChange:S[57]||(S[57]=C=>Ct("end",C))},null,40,fD),S[261]||(S[261]=E("span",{class:"switch-ui"},null,-1)),S[262]||(S[262]=E("span",null,"指定时长",-1))]),E("label",mD,[_.value.config.loopEndUseCustomDuration?(te(),oe("input",{key:0,value:_.value.config.loopEndDurationFrames,type:"number",min:"1",max:"1800",step:"1","aria-label":"结束循环段时长",onChange:S[58]||(S[58]=C=>bt("end",C))},null,40,pD)):Ue("",!0),_.value.config.loopEndUseCustomDuration?(te(),oe("span",gD,"f")):(te(),oe("span",vD,"自动 "+je(X.value)+"f",1))])])):Ue("",!0)])])):Ue("",!0),_.value.config.streamBehavior==="loop"?(te(),oe("div",yD,"循环持续模式不支持骨骼跟随和路径跟随;进入或退出时会将粒子跟随设置恢复默认值。")):Ue("",!0)],64)):(te(),Qt(qe,{key:1,label:"单次数量",min:1,max:1e3,step:1,modelValue:_.value.config.burstCount,"onUpdate:modelValue":S[59]||(S[59]=C=>_.value.config.burstCount=C)},null,8,["modelValue"])),Ne(qe,{label:"延迟时间",min:0,max:5,step:.1,modelValue:_.value.config.delay,"onUpdate:modelValue":S[60]||(S[60]=C=>_.value.config.delay=C)},null,8,["modelValue"])],512),[[yr,!re.emitMode]])]),E("div",xD,[E("div",{class:"group-head",onClick:S[62]||(S[62]=C=>ye("shape"))},[E("span",bD,je(re.shape?"▸":"▾"),1),S[263]||(S[263]=E("span",null,"发射器形状",-1)),E("button",{class:"group-reset",title:"重置发射器形状参数",onClick:S[61]||(S[61]=yt(C=>yi("shape"),["stop"]))},"重置")]),xe(E("div",wD,[E("label",SD,[S[265]||(S[265]=E("span",null,"形状",-1)),xe(E("select",{"onUpdate:modelValue":S[63]||(S[63]=C=>_.value.config.shape=C),class:"inp",onChange:on},[...S[264]||(S[264]=[to('<option value="point" data-v-988d7abf>点</option><option value="circle" data-v-988d7abf>圆形</option><option value="rect" data-v-988d7abf>矩形</option><option value="cone" data-v-988d7abf>锥形</option><option value="path" data-v-988d7abf>路径</option>',5)])],544),[[jt,_.value.config.shape]])]),_.value.config.shape==="circle"||_.value.config.shape==="cone"?(te(),oe(Ke,{key:0},[Ne(qe,{label:_.value.config.shape==="cone"?"内径":"内半径",min:0,max:_.value.config.outerRadius,step:1,modelValue:_.value.config.innerRadius,"onUpdate:modelValue":S[64]||(S[64]=C=>_.value.config.innerRadius=C)},null,8,["label","max","modelValue"]),Ne(qe,{label:_.value.config.shape==="cone"?"外径":"外半径",min:_.value.config.innerRadius,max:300,step:1,modelValue:_.value.config.outerRadius,"onUpdate:modelValue":S[65]||(S[65]=C=>_.value.config.outerRadius=C)},null,8,["label","min","modelValue"])],64)):Ue("",!0),_.value.config.shape==="cone"?(te(),oe(Ke,{key:1},[Ne(qe,{label:"锥形朝向",min:-360,max:360,step:1,modelValue:_.value.config.coneDirection,"onUpdate:modelValue":S[66]||(S[66]=C=>_.value.config.coneDirection=C)},null,8,["modelValue"]),Ne(qe,{label:"锥形开口角度",min:1,max:360,step:1,modelValue:_.value.config.coneAngle,"onUpdate:modelValue":S[67]||(S[67]=C=>_.value.config.coneAngle=C)},null,8,["modelValue"])],64)):_.value.config.shape==="rect"?(te(),oe(Ke,{key:2},[Ne(qe,{label:"内宽",min:0,max:_.value.config.outerRectW,step:1,modelValue:_.value.config.innerRectW,"onUpdate:modelValue":S[68]||(S[68]=C=>_.value.config.innerRectW=C)},null,8,["max","modelValue"]),Ne(qe,{label:"内高",min:0,max:_.value.config.outerRectH,step:1,modelValue:_.value.config.innerRectH,"onUpdate:modelValue":S[69]||(S[69]=C=>_.value.config.innerRectH=C)},null,8,["max","modelValue"]),Ne(qe,{label:"外宽",min:_.value.config.innerRectW,max:400,step:1,modelValue:_.value.config.outerRectW,"onUpdate:modelValue":S[70]||(S[70]=C=>_.value.config.outerRectW=C)},null,8,["min","modelValue"]),Ne(qe,{label:"外高",min:_.value.config.innerRectH,max:400,step:1,modelValue:_.value.config.outerRectH,"onUpdate:modelValue":S[71]||(S[71]=C=>_.value.config.outerRectH=C)},null,8,["min","modelValue"])],64)):_.value.config.shape==="path"?(te(),oe(Ke,{key:3},[E("label",_D,[S[267]||(S[267]=E("span",null,"选择路径",-1)),xe(E("select",{"onUpdate:modelValue":S[72]||(S[72]=C=>_.value.config.spawnPathId=C),class:"inp",onChange:Wi},[S[266]||(S[266]=E("option",{value:0},"无路径(点发射)",-1)),(te(!0),oe(Ke,null,ci(ke(e).paths,C=>(te(),oe("option",{key:C.id,value:C.id,disabled:!C.enabled},je(C.name),9,MD))),128))],544),[[jt,_.value.config.spawnPathId,void 0,{number:!0}]])]),_.value.config.spawnPathId>0?(te(),oe("label",TD,[S[269]||(S[269]=E("span",null,"出生分布",-1)),xe(E("select",{"onUpdate:modelValue":S[73]||(S[73]=C=>_.value.config.spawnPathDistribution=C),class:"inp"},[...S[268]||(S[268]=[E("option",{value:"fixed"},"等间距固定分布",-1),E("option",{value:"random"},"随机分布",-1)])],512),[[jt,_.value.config.spawnPathDistribution]])])):Ue("",!0)],64)):Ue("",!0),S[273]||(S[273]=E("div",{class:"divider"},null,-1)),E("label",AD,[S[272]||(S[272]=E("span",null,"发射角度",-1)),xe(E("select",{"onUpdate:modelValue":S[74]||(S[74]=C=>_.value.config.emissionAngleMode=C),class:"inp"},[S[270]||(S[270]=E("option",{value:"fixed"},"固定",-1)),S[271]||(S[271]=E("option",{value:"random"},"随机",-1)),_.value.config.shape==="circle"||_.value.config.shape==="rect"||_.value.config.shape==="cone"?(te(),oe("option",ED,"径向(中心向外)")):Ue("",!0),_.value.config.shape==="path"&&_.value.config.spawnPathId>0?(te(),oe("option",CD,"垂直于路径")):Ue("",!0),_.value.config.shape==="path"&&_.value.config.spawnPathId>0?(te(),oe("option",ID,"沿路径方向")):Ue("",!0)],512),[[jt,_.value.config.emissionAngleMode]])]),_.value.config.emissionAngleMode==="fixed"?(te(),Qt(qe,{key:4,label:"固定角度",min:-360,max:360,step:1,modelValue:_.value.config.direction,"onUpdate:modelValue":S[75]||(S[75]=C=>_.value.config.direction=C)},null,8,["modelValue"])):_.value.config.emissionAngleMode==="random"?(te(),oe(Ke,{key:5},[Ne(qe,{label:"基准角度",min:-360,max:360,step:1,modelValue:_.value.config.direction,"onUpdate:modelValue":S[76]||(S[76]=C=>_.value.config.direction=C)},null,8,["modelValue"]),Ne(qe,{label:"随机范围",min:0,max:360,step:1,modelValue:_.value.config.spread,"onUpdate:modelValue":S[77]||(S[77]=C=>_.value.config.spread=C)},null,8,["modelValue"])],64)):Ue("",!0)],512),[[yr,!re.shape]])]),E("div",RD,[E("div",{class:"group-head",onClick:S[79]||(S[79]=C=>ye("attr"))},[E("span",PD,je(re.attr?"▸":"▾"),1),S[274]||(S[274]=E("span",null,"粒子属性",-1)),E("button",{class:"group-reset",title:"重置粒子属性参数",onClick:S[78]||(S[78]=yt(C=>yi("attr"),["stop"]))},"重置")]),xe(E("div",kD,[S[282]||(S[282]=E("div",{class:"attr-section-title"},"粒子初始参数",-1)),Ne($n,{label:"初始生命周期","allow-curve":!1,mode:_.value.config.lifeMode,"onUpdate:mode":S[80]||(S[80]=C=>_.value.config.lifeMode=C),"value-min":_.value.config.lifeMin,"onUpdate:valueMin":S[81]||(S[81]=C=>_.value.config.lifeMin=C),"value-max":_.value.config.lifeMax,"onUpdate:valueMax":S[82]||(S[82]=C=>_.value.config.lifeMax=C),curve:_.value.config.lifeCurve,"onUpdate:curve":S[83]||(S[83]=C=>_.value.config.lifeCurve=C),min:.1,max:10,step:.1,"curve-label":"随机采样 →"},null,8,["mode","value-min","value-max","curve"]),Ne($n,{label:"初始速度","allow-curve":!1,mode:_.value.config.speedMode,"onUpdate:mode":S[84]||(S[84]=C=>_.value.config.speedMode=C),"value-min":_.value.config.speedMin,"onUpdate:valueMin":S[85]||(S[85]=C=>_.value.config.speedMin=C),"value-max":_.value.config.speedMax,"onUpdate:valueMax":S[86]||(S[86]=C=>_.value.config.speedMax=C),curve:_.value.config.speedCurve,"onUpdate:curve":S[87]||(S[87]=C=>_.value.config.speedCurve=C),min:0,max:1e3,step:1,"curve-label":"随机采样 →"},null,8,["mode","value-min","value-max","curve"]),E("div",FD,[S[275]||(S[275]=E("span",null,"初始缩放",-1)),E("div",OD,[E("button",{class:ot(["axis-mode",{on:_.value.config.scaleAxisMode==="uniform"}]),onClick:S[88]||(S[88]=C=>_.value.config.scaleAxisMode="uniform")},"统一",2),E("button",{class:ot(["axis-mode",{on:_.value.config.scaleAxisMode==="separate"}]),onClick:S[89]||(S[89]=C=>_.value.config.scaleAxisMode="separate")},"XY分离",2)])]),Ne($n,{label:_.value.config.scaleAxisMode==="uniform"?"初始缩放":"缩放 X","allow-curve":!1,mode:_.value.config.scaleMode,"onUpdate:mode":S[90]||(S[90]=C=>_.value.config.scaleMode=C),"value-min":_.value.config.scaleMin,"onUpdate:valueMin":S[91]||(S[91]=C=>_.value.config.scaleMin=C),"value-max":_.value.config.scaleMax,"onUpdate:valueMax":S[92]||(S[92]=C=>_.value.config.scaleMax=C),curve:_.value.config.scaleCurve,"onUpdate:curve":S[93]||(S[93]=C=>_.value.config.scaleCurve=C),min:0,max:5,step:.05,"curve-label":"随机采样 →"},null,8,["label","mode","value-min","value-max","curve"]),_.value.config.scaleAxisMode==="separate"?(te(),Qt($n,{key:0,label:"缩放 Y","show-modes":!1,"allow-curve":!1,mode:_.value.config.scaleMode,"onUpdate:mode":S[94]||(S[94]=C=>_.value.config.scaleMode=C),"value-min":_.value.config.scaleYMin,"onUpdate:valueMin":S[95]||(S[95]=C=>_.value.config.scaleYMin=C),"value-max":_.value.config.scaleYMax,"onUpdate:valueMax":S[96]||(S[96]=C=>_.value.config.scaleYMax=C),curve:_.value.config.scaleYCurve,"onUpdate:curve":S[97]||(S[97]=C=>_.value.config.scaleYCurve=C),min:0,max:5,step:.05,"curve-label":"随机采样 →"},null,8,["mode","value-min","value-max","curve"])):Ue("",!0),Ne($n,{label:"初始旋转","allow-direction":"","allow-curve":!1,mode:_.value.config.initialRotationMode,"onUpdate:mode":S[98]||(S[98]=C=>_.value.config.initialRotationMode=C),"value-min":_.value.config.initialRotationMin,"onUpdate:valueMin":S[99]||(S[99]=C=>_.value.config.initialRotationMin=C),"value-max":_.value.config.initialRotationMax,"onUpdate:valueMax":S[100]||(S[100]=C=>_.value.config.initialRotationMax=C),curve:_.value.config.initialRotationCurve,"onUpdate:curve":S[101]||(S[101]=C=>_.value.config.initialRotationCurve=C),min:-360,max:360,step:1,"curve-label":"随机采样 →"},null,8,["mode","value-min","value-max","curve"]),S[283]||(S[283]=E("div",{class:"attr-section-title life-title"},"粒子生命周期变化参数",-1)),E("div",BD,[E("label",LD,[xe(E("input",{type:"checkbox","onUpdate:modelValue":S[102]||(S[102]=C=>_.value.config.speedOverLifeEnabled=C)},null,512),[[ti,_.value.config.speedOverLifeEnabled]]),S[276]||(S[276]=E("span",{class:"switch-ui"},null,-1)),S[277]||(S[277]=E("span",null,"生命周期内速度",-1))]),_.value.config.speedOverLifeEnabled?(te(),Qt($n,{key:0,label:"速度倍率",mode:_.value.config.speedOverLifeMode,"onUpdate:mode":Ds,"value-min":_.value.config.speedOverLifeMin,"onUpdate:valueMin":S[103]||(S[103]=C=>_.value.config.speedOverLifeMin=C),"value-max":_.value.config.speedOverLifeMax,"onUpdate:valueMax":S[104]||(S[104]=C=>_.value.config.speedOverLifeMax=C),curve:_.value.config.speedOverLifeCurve,"onUpdate:curve":S[105]||(S[105]=C=>_.value.config.speedOverLifeCurve=C),"default-curve":q,min:0,max:3,step:.05,"curve-label":"生命周期 →"},null,8,["mode","value-min","value-max","curve"])):Ue("",!0)]),E("div",DD,[E("label",ND,[xe(E("input",{type:"checkbox","onUpdate:modelValue":S[106]||(S[106]=C=>_.value.config.scaleOverLifeEnabled=C),onChange:Li},null,544),[[ti,_.value.config.scaleOverLifeEnabled]]),S[278]||(S[278]=E("span",{class:"switch-ui"},null,-1)),S[279]||(S[279]=E("span",null,"生命周期内缩放",-1))]),_.value.config.scaleOverLifeEnabled?(te(),oe(Ke,{key:0},[E("div",UD,[E("button",{class:ot(["axis-mode",{on:_.value.config.scaleOverLifeAxisMode==="uniform"}]),onClick:S[107]||(S[107]=C=>_.value.config.scaleOverLifeAxisMode="uniform")},"统一",2),E("button",{class:ot(["axis-mode",{on:_.value.config.scaleOverLifeAxisMode==="separate"}]),onClick:S[108]||(S[108]=C=>_.value.config.scaleOverLifeAxisMode="separate")},"XY分离",2)]),Ne($n,{label:_.value.config.scaleOverLifeAxisMode==="uniform"?"缩放倍率":"倍率 X",mode:_.value.config.scaleOverLifeMode,"onUpdate:mode":Ts,"value-min":_.value.config.scaleOverLifeMin,"onUpdate:valueMin":S[109]||(S[109]=C=>_.value.config.scaleOverLifeMin=C),"value-max":_.value.config.scaleOverLifeMax,"onUpdate:valueMax":S[110]||(S[110]=C=>_.value.config.scaleOverLifeMax=C),curve:_.value.config.scaleOverLifeCurve,"onUpdate:curve":S[111]||(S[111]=C=>_.value.config.scaleOverLifeCurve=C),"default-curve":q,min:0,max:3,step:.05,"curve-label":"生命周期 →"},null,8,["label","mode","value-min","value-max","curve"]),_.value.config.scaleOverLifeAxisMode==="separate"?(te(),Qt($n,{key:0,label:"倍率 Y","show-modes":!1,mode:_.value.config.scaleOverLifeMode,"onUpdate:mode":S[112]||(S[112]=C=>_.value.config.scaleOverLifeMode=C),"value-min":_.value.config.scaleYOverLifeMin,"onUpdate:valueMin":S[113]||(S[113]=C=>_.value.config.scaleYOverLifeMin=C),"value-max":_.value.config.scaleYOverLifeMax,"onUpdate:valueMax":S[114]||(S[114]=C=>_.value.config.scaleYOverLifeMax=C),curve:_.value.config.scaleYOverLifeCurve,"onUpdate:curve":S[115]||(S[115]=C=>_.value.config.scaleYOverLifeCurve=C),"default-curve":q,min:0,max:3,step:.05,"curve-label":"生命周期 →"},null,8,["mode","value-min","value-max","curve"])):Ue("",!0)],64)):Ue("",!0)]),E("div",XD,[E("label",VD,[xe(E("input",{type:"checkbox","onUpdate:modelValue":S[116]||(S[116]=C=>_.value.config.rotationOverLifeEnabled=C)},null,512),[[ti,_.value.config.rotationOverLifeEnabled]]),S[280]||(S[280]=E("span",{class:"switch-ui"},null,-1)),S[281]||(S[281]=E("span",null,"生命周期内旋转",-1))]),_.value.config.rotationOverLifeEnabled?(te(),Qt($n,{key:0,label:"旋转速度",mode:_.value.config.rotationOverLifeMode,"onUpdate:mode":S[117]||(S[117]=C=>_.value.config.rotationOverLifeMode=C),"value-min":_.value.config.rotationSpeedMin,"onUpdate:valueMin":S[118]||(S[118]=C=>_.value.config.rotationSpeedMin=C),"value-max":_.value.config.rotationSpeedMax,"onUpdate:valueMax":S[119]||(S[119]=C=>_.value.config.rotationSpeedMax=C),curve:_.value.config.rotationOverLifeCurve,"onUpdate:curve":S[120]||(S[120]=C=>_.value.config.rotationOverLifeCurve=C),"default-curve":K,min:-720,max:720,step:10,"curve-label":"生命周期 →"},null,8,["mode","value-min","value-max","curve"])):Ue("",!0)])],512),[[yr,!re.attr]])]),E("div",YD,[E("div",{class:"group-head",onClick:S[122]||(S[122]=C=>ye("look"))},[E("span",$D,je(re.look?"▸":"▾"),1),S[284]||(S[284]=E("span",null,"外观与资源",-1)),E("button",{class:"group-reset",title:"重置外观与资源参数",onClick:S[121]||(S[121]=yt(C=>yi("look"),["stop"]))},"重置")]),xe(E("div",GD,[S[298]||(S[298]=E("div",{class:"look-title"},"透明度",-1)),E("div",HD,[E("button",{class:ot(["seg-btn",{active:_.value.config.alphaMode==="curve"}]),onClick:S[123]||(S[123]=C=>_.value.config.alphaMode="curve")},"曲线",2),E("button",{class:ot(["seg-btn",{active:_.value.config.alphaMode==="fixed"}]),onClick:S[124]||(S[124]=C=>_.value.config.alphaMode="fixed")},"固定",2)]),_.value.config.alphaMode==="fixed"?(te(),Qt(qe,{key:0,label:"透明度",min:0,max:1,step:.01,modelValue:_.value.config.alpha,"onUpdate:modelValue":S[125]||(S[125]=C=>_.value.config.alpha=C)},null,8,["modelValue"])):(te(),oe(Ke,{key:1},[E("label",jD,[S[286]||(S[286]=E("span",null,"曲线模式",-1)),xe(E("select",{"onUpdate:modelValue":S[126]||(S[126]=C=>_.value.config.curveMode=C),class:"inp"},[...S[285]||(S[285]=[E("option",null,"跟随导出",-1),E("option",null,"线性",-1),E("option",null,"贝塞尔",-1)])],512),[[jt,_.value.config.curveMode]])]),E("div",WD,[Ne(gn,{modelValue:_.value.config.alphaCurve,"onUpdate:modelValue":S[127]||(S[127]=C=>_.value.config.alphaCurve=C),"default-value":z,mode:A(_.value.config.curveMode)},null,8,["modelValue","mode"]),S[287]||(S[287]=E("div",{class:"curve-labels"},[E("span",null,"0(透明)"),E("span",null,"生命周期 →"),E("span",null,"1(不透明)")],-1))])],64)),E("div",{class:"look-title image-title"},[S[288]||(S[288]=E("span",null,"图片资源",-1)),E("button",{class:"image-add",title:"新增图片资源",onClick:be},"+")]),(te(!0),oe(Ke,null,ci(_.value.config.imageResources,C=>(te(),Qt(qv,{key:C.id,resource:C,"resource-count":_.value.config.imageResources.length,"supports-sequence":"","default-file":"star.png",onPick:Le,onPickSequence:Ce,onReset:nt,onRemove:Se,onUpdateWeight:Jt,onToggleLock:Mi},{default:ah(()=>[Ne(qe,{label:"缩放",min:.1,max:3,step:.05,modelValue:C.scale,"onUpdate:modelValue":Z=>C.scale=Z},null,8,["modelValue","onUpdate:modelValue"]),E("label",zD,[S[289]||(S[289]=E("span",null,"轴心 x,y",-1)),xe(E("input",{type:"number",step:"0.05",class:"inp tiny","onUpdate:modelValue":Z=>C.anchorX=Z},null,8,qD),[[ct,C.anchorX,void 0,{number:!0}]]),xe(E("input",{type:"number",step:"0.05",class:"inp tiny","onUpdate:modelValue":Z=>C.anchorY=Z},null,8,KD),[[ct,C.anchorY,void 0,{number:!0}]])]),S[297]||(S[297]=E("div",{class:"resource-divider"},null,-1)),E("label",ZD,[S[292]||(S[292]=E("span",null,"颜色",-1)),xe(E("select",{"onUpdate:modelValue":Z=>C.colorMode=Z,class:"inp"},[...S[290]||(S[290]=[E("option",{value:"fixed"},"固定色",-1),E("option",{value:"random"},"随机颜色",-1),E("option",{value:"lifetime"},"生命周期",-1)])],8,JD),[[jt,C.colorMode]]),xe(E("select",{"onUpdate:modelValue":Z=>C.blend=Z,class:"inp blend-select"},[...S[291]||(S[291]=[E("option",{value:"normal"},"正常",-1),E("option",{value:"add"},"相加",-1),E("option",{value:"multiply"},"相乘",-1),E("option",{value:"screen"},"滤色",-1)])],8,QD),[[jt,C.blend]])]),C.colorMode==="fixed"?(te(),oe("label",eN,[S[293]||(S[293]=E("span",null,"固定色",-1)),xe(E("input",{type:"color","onUpdate:modelValue":Z=>C.colorStart=Z,class:"colr"},null,8,tN),[[ct,C.colorStart]]),E("input",{type:"text",class:"hex-input",value:C.colorStart,spellcheck:"false","aria-label":"固定颜色值",onChange:Z=>rt(C,Z),onKeydown:Aa(Z=>Qe(C,Z),["enter"])},null,40,iN)])):(te(),oe(Ke,{key:1},[Ne(zv,{modelValue:C.colorGradient,"onUpdate:modelValue":Z=>C.colorGradient=Z},null,8,["modelValue","onUpdate:modelValue"]),C.colorMode==="random"?(te(),oe("div",sN,"每个粒子出生时从色带随机取色,生命周期内保持不变")):Ue("",!0)],64)),E("div",nN,[S[294]||(S[294]=E("span",null,"独立透明度",-1)),E("div",rN,[E("button",{class:ot({on:C.independentAlpha==="off"}),onClick:Z=>C.independentAlpha="off"},"关闭",10,aN),E("button",{class:ot({on:C.independentAlpha==="fixed"}),onClick:Z=>C.independentAlpha="fixed"},"固定",10,oN),E("button",{class:ot({on:C.independentAlpha==="curve"}),onClick:Z=>C.independentAlpha="curve"},"曲线",10,lN)])]),C.independentAlpha==="fixed"?(te(),Qt(qe,{key:2,label:"透明度",min:0,max:1,step:.01,modelValue:C.alpha,"onUpdate:modelValue":Z=>C.alpha=Z},null,8,["modelValue","onUpdate:modelValue"])):C.independentAlpha==="curve"?(te(),oe(Ke,{key:3},[E("label",cN,[S[296]||(S[296]=E("span",null,"曲线模式",-1)),xe(E("select",{"onUpdate:modelValue":Z=>C.alphaCurveMode=Z,class:"inp"},[...S[295]||(S[295]=[E("option",null,"跟随导出",-1),E("option",null,"线性",-1),E("option",null,"贝塞尔",-1)])],8,hN),[[jt,C.alphaCurveMode]])]),E("div",uN,[Ne(gn,{modelValue:C.alphaCurve,"onUpdate:modelValue":Z=>C.alphaCurve=Z,"default-value":ee,mode:A(C.alphaCurveMode)},null,8,["modelValue","onUpdate:modelValue","mode"])])],64)):Ue("",!0)]),_:2},1032,["resource","resource-count"]))),128)),E("input",{ref_key:"textureFileInput",ref:Kr,class:"file-input",type:"file",accept:"image/png,image/jpeg,image/webp,image/gif",onChange:Be},null,544),E("input",{ref_key:"sequenceFileInput",ref:Zr,class:"file-input",type:"file",multiple:"",accept:"image/png,image/jpeg,image/webp,image/gif",onChange:Te},null,544)],512),[[yr,!re.look]])]),E("div",dN,[E("div",{class:"group-head",onClick:S[129]||(S[129]=C=>ye("mods"))},[E("span",fN,je(re.mods?"▸":"▾"),1),S[299]||(S[299]=E("span",null,"修改器",-1)),E("button",{class:"group-reset",title:"重置修改器参数",onClick:S[128]||(S[128]=yt(C=>yi("mods"),["stop"]))},"重置")]),xe(E("div",mN,[E("div",pN,[E("label",gN,[xe(E("input",{type:"checkbox","onUpdate:modelValue":S[130]||(S[130]=C=>_.value.config.noise=C)},null,512),[[ti,_.value.config.noise]]),S[300]||(S[300]=E("span",{class:"switch-ui"},null,-1)),S[301]||(S[301]=E("span",null,"开启移动噪声",-1))]),_.value.config.noise?(te(),oe("div",vN,[Ne(qe,{label:"强度",min:0,max:100,step:1,modelValue:_.value.config.noiseAmt,"onUpdate:modelValue":S[131]||(S[131]=C=>_.value.config.noiseAmt=C)},null,8,["modelValue"]),Ne(qe,{label:"波动范围",min:0,max:500,step:1,modelValue:_.value.config.noiseRange,"onUpdate:modelValue":S[132]||(S[132]=C=>_.value.config.noiseRange=C)},null,8,["modelValue"]),Ne(qe,{label:"时间流速",min:0,max:10,step:.1,modelValue:_.value.config.noiseSpeed,"onUpdate:modelValue":S[133]||(S[133]=C=>_.value.config.noiseSpeed=C)},null,8,["modelValue"]),S[302]||(S[302]=E("div",{class:"modifier-hint"},"强度控制影响比例 · 波动范围控制最大偏移 · 时间流速控制变化速度",-1))])):Ue("",!0)]),E("div",yN,[E("label",xN,[xe(E("input",{type:"checkbox","onUpdate:modelValue":S[134]||(S[134]=C=>_.value.config.useGravity=C)},null,512),[[ti,_.value.config.useGravity]]),S[303]||(S[303]=E("span",{class:"switch-ui"},null,-1)),S[304]||(S[304]=E("span",null,"开启重力",-1))]),_.value.config.useGravity?(te(),oe("div",bN,[E("div",wN,[E("button",{class:ot(["axis-mode",{on:_.value.config.gravityMode==="fixed"}]),onClick:S[135]||(S[135]=C=>_.value.config.gravityMode="fixed")},"固定",2),E("button",{class:ot(["axis-mode",{on:_.value.config.gravityMode==="random"}]),onClick:S[136]||(S[136]=C=>_.value.config.gravityMode="random")},"随机",2)]),_.value.config.gravityMode==="fixed"?(te(),Qt(qe,{key:0,label:"重力强度",min:-3e3,max:3e3,step:10,modelValue:_.value.config.gravityMin,"onUpdate:modelValue":S[137]||(S[137]=C=>_.value.config.gravityMin=C)},null,8,["modelValue"])):(te(),oe(Ke,{key:1},[Ne(qe,{label:"强度 min",min:-3e3,max:3e3,step:10,modelValue:_.value.config.gravityMin,"onUpdate:modelValue":S[138]||(S[138]=C=>_.value.config.gravityMin=C)},null,8,["modelValue"]),Ne(qe,{label:"强度 max",min:-3e3,max:3e3,step:10,modelValue:_.value.config.gravityMax,"onUpdate:modelValue":S[139]||(S[139]=C=>_.value.config.gravityMax=C)},null,8,["modelValue"])],64)),Ne(qe,{label:"方向",min:-360,max:360,step:1,modelValue:_.value.config.gravityDirection,"onUpdate:modelValue":S[140]||(S[140]=C=>_.value.config.gravityDirection=C)},null,8,["modelValue"]),S[305]||(S[305]=E("div",{class:"gravity-curve-title"},[E("span",null,"生命周期内重力"),E("span",null,"纵轴:强度 0~1")],-1)),Ne(gn,{modelValue:_.value.config.gravityCurve,"onUpdate:modelValue":S[141]||(S[141]=C=>_.value.config.gravityCurve=C),"default-value":q},null,8,["modelValue"]),S[306]||(S[306]=E("div",{class:"gravity-curve-axis"},[E("span",null,"0"),E("span",null,"生命周期 →"),E("span",null,"1")],-1)),S[307]||(S[307]=E("div",{class:"modifier-hint"},"0° 向右 · -90° 向下 · 负强度会反转方向",-1))])):Ue("",!0)]),E("div",SN,[E("label",_N,[xe(E("input",{type:"checkbox","onUpdate:modelValue":S[142]||(S[142]=C=>_.value.config.wind=C)},null,512),[[ti,_.value.config.wind]]),S[308]||(S[308]=E("span",{class:"switch-ui"},null,-1)),S[309]||(S[309]=E("span",null,"开启风力",-1))]),_.value.config.wind?(te(),oe("div",MN,[E("div",TN,[E("button",{class:ot(["axis-mode",{on:_.value.config.windMode==="fixed"}]),onClick:S[143]||(S[143]=C=>_.value.config.windMode="fixed")},"固定",2),E("button",{class:ot(["axis-mode",{on:_.value.config.windMode==="random"}]),onClick:S[144]||(S[144]=C=>_.value.config.windMode="random")},"随机",2)]),_.value.config.windMode==="fixed"?(te(),Qt(qe,{key:0,label:"风力强度",min:-3e3,max:3e3,step:10,modelValue:_.value.config.windMin,"onUpdate:modelValue":S[145]||(S[145]=C=>_.value.config.windMin=C)},null,8,["modelValue"])):(te(),oe(Ke,{key:1},[Ne(qe,{label:"强度 min",min:-3e3,max:3e3,step:10,modelValue:_.value.config.windMin,"onUpdate:modelValue":S[146]||(S[146]=C=>_.value.config.windMin=C)},null,8,["modelValue"]),Ne(qe,{label:"强度 max",min:-3e3,max:3e3,step:10,modelValue:_.value.config.windMax,"onUpdate:modelValue":S[147]||(S[147]=C=>_.value.config.windMax=C)},null,8,["modelValue"])],64)),Ne(qe,{label:"方向",min:-360,max:360,step:1,modelValue:_.value.config.windDirection,"onUpdate:modelValue":S[148]||(S[148]=C=>_.value.config.windDirection=C)},null,8,["modelValue"]),S[310]||(S[310]=E("div",{class:"gravity-curve-title"},[E("span",null,"生命周期内风力"),E("span",null,"纵轴:强度 0~1")],-1)),Ne(gn,{modelValue:_.value.config.windCurve,"onUpdate:modelValue":S[149]||(S[149]=C=>_.value.config.windCurve=C),"default-value":q},null,8,["modelValue"]),S[311]||(S[311]=E("div",{class:"gravity-curve-axis"},[E("span",null,"0"),E("span",null,"生命周期 →"),E("span",null,"1")],-1)),S[312]||(S[312]=E("div",{class:"modifier-hint"},"0° 向右 · -90° 向下 · 负强度会反转方向",-1))])):Ue("",!0)]),E("div",AN,[E("label",EN,[xe(E("input",{type:"checkbox","onUpdate:modelValue":S[150]||(S[150]=C=>_.value.config.forceField=C)},null,512),[[ti,_.value.config.forceField]]),S[313]||(S[313]=E("span",{class:"switch-ui"},null,-1)),S[314]||(S[314]=E("span",null,"开启力场",-1))]),_.value.config.forceField?(te(),oe("div",CN,[Ne(qe,{label:"中心 X",min:-5e3,max:5e3,step:1,modelValue:_.value.config.forceCenterX,"onUpdate:modelValue":S[151]||(S[151]=C=>_.value.config.forceCenterX=C)},null,8,["modelValue"]),Ne(qe,{label:"中心 Y",min:-5e3,max:5e3,step:1,modelValue:_.value.config.forceCenterY,"onUpdate:modelValue":S[152]||(S[152]=C=>_.value.config.forceCenterY=C)},null,8,["modelValue"]),Ne(qe,{label:"力场强度",min:-300,max:300,step:1,modelValue:_.value.config.forceStrength,"onUpdate:modelValue":S[153]||(S[153]=C=>_.value.config.forceStrength=C)},null,8,["modelValue"]),Ne(qe,{label:"力场半径",min:1,max:2e3,step:1,modelValue:_.value.config.forceRadius,"onUpdate:modelValue":S[154]||(S[154]=C=>_.value.config.forceRadius=C)},null,8,["modelValue"]),E("label",IN,[S[316]||(S[316]=E("span",null,"衰减模式",-1)),xe(E("select",{"onUpdate:modelValue":S[155]||(S[155]=C=>_.value.config.forceFalloff=C),class:"inp"},[...S[315]||(S[315]=[E("option",{value:"constant"},"恒定(范围内力度不变)",-1),E("option",{value:"linear"},"线性衰减(边缘为 0)",-1),E("option",{value:"inverse"},"距离反比(中心最强)",-1)])],512),[[jt,_.value.config.forceFalloff]])]),S[317]||(S[317]=E("div",{class:"modifier-hint"},"正数吸向中心 · 负数向外排斥 · 可在画布内拖动力场圆",-1))])):Ue("",!0)]),E("div",RN,[E("label",PN,[xe(E("input",{type:"checkbox","onUpdate:modelValue":S[156]||(S[156]=C=>_.value.config.attraction=C)},null,512),[[ti,_.value.config.attraction]]),S[318]||(S[318]=E("span",{class:"switch-ui"},null,-1)),S[319]||(S[319]=E("span",null,"开启吸附",-1))]),_.value.config.attraction?(te(),oe("div",kN,[Ne(qe,{label:"吸附点 X",min:-5e3,max:5e3,step:1,modelValue:_.value.config.attractionCenterX,"onUpdate:modelValue":S[157]||(S[157]=C=>_.value.config.attractionCenterX=C)},null,8,["modelValue"]),Ne(qe,{label:"吸附点 Y",min:-5e3,max:5e3,step:1,modelValue:_.value.config.attractionCenterY,"onUpdate:modelValue":S[158]||(S[158]=C=>_.value.config.attractionCenterY=C)},null,8,["modelValue"]),Ne(qe,{label:"吸附半径",min:0,max:2e3,step:1,modelValue:_.value.config.attractionRadius,"onUpdate:modelValue":S[159]||(S[159]=C=>_.value.config.attractionRadius=C)},null,8,["modelValue"]),Ne(qe,{label:"吸附时长",min:.05,max:30,step:.05,modelValue:_.value.config.attractionDuration,"onUpdate:modelValue":S[160]||(S[160]=C=>_.value.config.attractionDuration=C)},null,8,["modelValue"]),Ne(qe,{label:"延迟时间",min:0,max:30,step:.05,modelValue:_.value.config.attractionDelay,"onUpdate:modelValue":S[161]||(S[161]=C=>_.value.config.attractionDelay=C)},null,8,["modelValue"]),E("label",FN,[S[321]||(S[321]=E("span",null,"延迟方式",-1)),xe(E("select",{"onUpdate:modelValue":S[162]||(S[162]=C=>_.value.config.attractionDelayMode=C),class:"inp"},[...S[320]||(S[320]=[E("option",{value:"global"},"统一时间",-1),E("option",{value:"particle"},"单粒子生命",-1)])],512),[[jt,_.value.config.attractionDelayMode]])]),E("label",ON,[S[323]||(S[323]=E("span",null,"吸附方式",-1)),xe(E("select",{"onUpdate:modelValue":S[163]||(S[163]=C=>_.value.config.attractionPath=C),class:"inp"},[...S[322]||(S[322]=[E("option",{value:"linear"},"直线",-1),E("option",{value:"curve"},"曲线",-1)])],512),[[jt,_.value.config.attractionPath]])]),S[324]||(S[324]=E("div",{class:"modifier-hint"},"延迟后从当前位置开始吸附 · 到达红色范围即死亡 · 可在画布内拖动吸附圆",-1))])):Ue("",!0)]),E("div",BN,[E("label",LN,[xe(E("input",{type:"checkbox","onUpdate:modelValue":S[164]||(S[164]=C=>_.value.config.trail=C)},null,512),[[ti,_.value.config.trail]]),S[325]||(S[325]=E("span",{class:"switch-ui"},null,-1)),S[326]||(S[326]=E("span",null,"开启拖尾",-1))]),_.value.config.trail?(te(),oe("div",DN,[E("div",{class:"trail-section-head"},[S[327]||(S[327]=E("div",{class:"trail-section-title"},"拖尾独立图片",-1)),E("button",{class:"image-add",title:"增加拖尾图片资源",onClick:Nn},"+")]),(te(!0),oe(Ke,null,ci(_.value.config.trailResources,C=>(te(),Qt(qv,{key:C.id,resource:C,"resource-count":_.value.config.trailResources.length,"default-file":"trail.png","name-placeholder":"trail","show-folder":!1,onPick:Jr,onReset:Y,onRemove:J,onUpdateWeight:ue,onToggleLock:pe},{default:ah(()=>[S[343]||(S[343]=E("div",{class:"resource-divider"},null,-1)),Ne(qe,{label:"旋转",min:-360,max:360,step:1,"model-value":C.rotation,"onUpdate:modelValue":Z=>Qr(C.id,Z)},null,8,["model-value","onUpdate:modelValue"]),Ne(qe,{label:"拖尾骨骼数",min:2,max:16,step:1,"model-value":C.boneCount,"onUpdate:modelValue":Z=>$a(C.id,Z)},null,8,["model-value","onUpdate:modelValue"]),Ne(qe,{label:"拖尾比例 (%)",min:0,max:100,step:1,modelValue:C.trailRatio,"onUpdate:modelValue":Z=>C.trailRatio=Z},null,8,["modelValue","onUpdate:modelValue"]),E("label",NN,[S[329]||(S[329]=E("span",null,"拖尾长度",-1)),xe(E("select",{"onUpdate:modelValue":Z=>C.lengthMode=Z,class:"inp"},[...S[328]||(S[328]=[E("option",{value:"fixed"},"固定",-1),E("option",{value:"random"},"随机范围",-1)])],8,UN),[[jt,C.lengthMode]])]),C.lengthMode==="fixed"?(te(),Qt(qe,{key:0,label:"长度比例 (%)",min:0,max:500,step:1,modelValue:C.length,"onUpdate:modelValue":Z=>C.length=Z},null,8,["modelValue","onUpdate:modelValue"])):(te(),oe(Ke,{key:1},[Ne(qe,{label:"长度最小 (%)",min:0,max:500,step:1,modelValue:C.lengthMin,"onUpdate:modelValue":Z=>C.lengthMin=Z},null,8,["modelValue","onUpdate:modelValue"]),Ne(qe,{label:"长度最大 (%)",min:0,max:500,step:1,modelValue:C.lengthMax,"onUpdate:modelValue":Z=>C.lengthMax=Z},null,8,["modelValue","onUpdate:modelValue"])],64)),E("label",XN,[S[331]||(S[331]=E("span",null,"拖尾宽度",-1)),xe(E("select",{"onUpdate:modelValue":Z=>C.widthSizeMode=Z,class:"inp"},[...S[330]||(S[330]=[E("option",{value:"fixed"},"固定",-1),E("option",{value:"random"},"随机范围",-1)])],8,VN),[[jt,C.widthSizeMode]])]),C.widthSizeMode==="fixed"?(te(),Qt(qe,{key:2,label:"宽度比例 (%)",min:0,max:500,step:1,modelValue:C.width,"onUpdate:modelValue":Z=>C.width=Z},null,8,["modelValue","onUpdate:modelValue"])):(te(),oe(Ke,{key:3},[Ne(qe,{label:"宽度最小 (%)",min:0,max:500,step:1,modelValue:C.widthMin,"onUpdate:modelValue":Z=>C.widthMin=Z},null,8,["modelValue","onUpdate:modelValue"]),Ne(qe,{label:"宽度最大 (%)",min:0,max:500,step:1,modelValue:C.widthMax,"onUpdate:modelValue":Z=>C.widthMax=Z},null,8,["modelValue","onUpdate:modelValue"])],64)),E("label",YN,[S[333]||(S[333]=E("span",null,"宽度缩放",-1)),xe(E("select",{"onUpdate:modelValue":Z=>C.widthMode=Z,class:"inp"},[...S[332]||(S[332]=[E("option",{value:"particle"},"跟随粒子",-1),E("option",{value:"fixed"},"固定",-1)])],8,$N),[[jt,C.widthMode]])]),E("label",GN,[xe(E("input",{type:"checkbox","onUpdate:modelValue":Z=>C.lifeLengthEnabled=Z},null,8,HN),[[ti,C.lifeLengthEnabled]]),S[334]||(S[334]=E("span",{class:"switch-ui"},null,-1)),S[335]||(S[335]=E("span",null,"生命周期长度曲线",-1))]),C.lifeLengthEnabled?(te(),Qt(gn,{key:4,modelValue:C.lifeLengthCurve,"onUpdate:modelValue":Z=>C.lifeLengthCurve=Z,"default-value":q},null,8,["modelValue","onUpdate:modelValue"])):Ue("",!0),E("label",jN,[xe(E("input",{type:"checkbox","onUpdate:modelValue":Z=>C.shapeEnabled=Z},null,8,WN),[[ti,C.shapeEnabled]]),S[336]||(S[336]=E("span",{class:"switch-ui"},null,-1)),S[337]||(S[337]=E("span",null,"形状曲线(首端 → 尾端宽度)",-1))]),C.shapeEnabled?(te(),Qt(gn,{key:5,modelValue:C.shapeCurve,"onUpdate:modelValue":Z=>C.shapeCurve=Z,"default-value":ve},null,8,["modelValue","onUpdate:modelValue"])):Ue("",!0),E("div",zN,[S[338]||(S[338]=E("span",null,"颜色模式",-1)),E("div",qN,[E("button",{class:ot(["axis-mode",{on:C.colorMode==="particle"}]),onClick:Z=>C.colorMode="particle"},"跟随粒子",10,KN),E("button",{class:ot(["axis-mode",{on:C.colorMode==="fixed"}]),onClick:Z=>C.colorMode="fixed"},"固定",10,ZN),E("button",{class:ot(["axis-mode",{on:C.colorMode==="curve"}]),onClick:Z=>C.colorMode="curve"},"曲线",10,JN)])]),E("label",QN,[S[340]||(S[340]=E("span",null,"混合模式",-1)),xe(E("select",{"onUpdate:modelValue":Z=>C.blend=Z,class:"inp"},[...S[339]||(S[339]=[E("option",{value:"normal"},"正常",-1),E("option",{value:"add"},"相加",-1),E("option",{value:"multiply"},"相乘",-1),E("option",{value:"screen"},"滤色",-1)])],8,e4),[[jt,C.blend]])]),C.colorMode==="fixed"?(te(),oe("label",t4,[S[341]||(S[341]=E("span",null,"固定颜色",-1)),xe(E("input",{class:"colr",type:"color","onUpdate:modelValue":Z=>C.color=Z},null,8,i4),[[ct,C.color]]),E("input",{class:"hex-input",value:C.color,onChange:Z=>_e(C,Z),onKeydown:Aa(yt(Z=>Me(C,Z),["prevent"]),["enter"])},null,40,s4)])):C.colorMode==="curve"?(te(),Qt(zv,{key:7,modelValue:C.colorGradient,"onUpdate:modelValue":Z=>C.colorGradient=Z},null,8,["modelValue","onUpdate:modelValue"])):Ue("",!0),E("div",n4,[S[342]||(S[342]=E("span",null,"透明度模式",-1)),E("div",r4,[E("button",{class:ot(["axis-mode",{on:C.alphaMode==="particle"}]),onClick:Z=>C.alphaMode="particle"},"跟随粒子",10,a4),E("button",{class:ot(["axis-mode",{on:C.alphaMode==="fixed"}]),onClick:Z=>C.alphaMode="fixed"},"固定",10,o4),E("button",{class:ot(["axis-mode",{on:C.alphaMode==="curve"}]),onClick:Z=>C.alphaMode="curve"},"曲线",10,l4)])]),C.alphaMode==="fixed"?(te(),Qt(qe,{key:8,label:"透明度",min:0,max:1,step:.01,modelValue:C.alpha,"onUpdate:modelValue":Z=>C.alpha=Z},null,8,["modelValue","onUpdate:modelValue"])):Ue("",!0),C.alphaMode==="curve"?(te(),Qt(gn,{key:9,modelValue:C.alphaCurve,"onUpdate:modelValue":Z=>C.alphaCurve=Z,"default-value":le},null,8,["modelValue","onUpdate:modelValue"])):Ue("",!0)]),_:2},1032,["resource","resource-count"]))),128)),E("input",{ref_key:"trailTextureFileInput",ref:ln,class:"file-input",type:"file",accept:"image/png,image/jpeg,image/webp",onChange:W},null,544),E("div",c4,[Ne(qe,{label:"网格行数",min:2,max:16,step:1,"model-value":_.value.config.trailGridRows,"onUpdate:modelValue":S[165]||(S[165]=C=>Us("trailGridRows",C))},null,8,["model-value"]),Ne(qe,{label:"网格列数",min:2,max:32,step:1,"model-value":_.value.config.trailGridCols,"onUpdate:modelValue":S[166]||(S[166]=C=>Us("trailGridCols",C))},null,8,["model-value"])]),S[344]||(S[344]=E("div",{class:"modifier-hint"},"每个粒子按资源比例生成一组同级拖尾骨骼;随机长度与宽度在粒子出生时确定,相同种子可稳定复现",-1))])):Ue("",!0)]),E("div",h4,[E("label",u4,[xe(E("input",{type:"checkbox","onUpdate:modelValue":S[167]||(S[167]=C=>_.value.config.emitterFollow=C),disabled:_.value.config.streamBehavior==="loop"},null,8,d4),[[ti,_.value.config.emitterFollow]]),S[345]||(S[345]=E("span",{class:"switch-ui"},null,-1)),S[346]||(S[346]=E("span",null,"开启发射器跟随",-1))]),_.value.config.emitterFollow&&_.value.config.streamBehavior!=="loop"?(te(),oe("div",f4,[E("label",m4,[S[349]||(S[349]=E("span",null,"跟随模式",-1)),E("select",{value:_.value.config.emitterFollowMode,class:"inp",onChange:S[168]||(S[168]=C=>wt(C,_.value.config))},[S[347]||(S[347]=E("option",{value:"none"},"无",-1)),S[348]||(S[348]=E("option",{value:"path"},"跟随路径",-1)),de.value||_.value.config.emitterFollowMode==="bone"?(te(),oe("option",g4,"选中的骨骼")):Ue("",!0)],40,p4)]),_.value.config.emitterFollowMode==="path"?(te(),oe(Ke,{key:0},[E("label",v4,[S[351]||(S[351]=E("span",null,"跟随路径",-1)),xe(E("select",{"onUpdate:modelValue":S[169]||(S[169]=C=>_.value.config.emitterFollowPathId=C),class:"inp"},[S[350]||(S[350]=E("option",{value:0},"无",-1)),(te(!0),oe(Ke,null,ci(ke(e).paths,C=>(te(),oe("option",{key:C.id,value:C.id},je(C.name),9,y4))),128))],512),[[jt,_.value.config.emitterFollowPathId,void 0,{number:!0}]])]),E("label",x4,[S[353]||(S[353]=E("span",null,"发射器角度模式",-1)),xe(E("select",{"onUpdate:modelValue":S[170]||(S[170]=C=>_.value.config.emitterAngleMode=C),class:"inp"},[...S[352]||(S[352]=[E("option",{value:"fixed"},"固定角度",-1),E("option",{value:"direction"},"跟随移动方向",-1)])],512),[[jt,_.value.config.emitterAngleMode]])]),S[359]||(S[359]=E("div",{class:"gravity-curve-title"},[E("span",null,"移动进度曲线 (0→1)")],-1)),Ne(gn,{modelValue:_.value.config.emitterFollowCurve,"onUpdate:modelValue":S[171]||(S[171]=C=>_.value.config.emitterFollowCurve=C),"default-value":K},null,8,["modelValue"]),E("div",b4,[E("label",w4,[S[354]||(S[354]=E("span",null,"移动时长 (s)",-1)),xe(E("input",{"onUpdate:modelValue":S[172]||(S[172]=C=>_.value.config.emitterFollowDuration=C),type:"number",min:"0.05",step:"0.05",class:"inp"},null,512),[[ct,_.value.config.emitterFollowDuration,void 0,{number:!0}]])]),E("label",S4,[S[356]||(S[356]=E("span",null,"跟随空间",-1)),xe(E("select",{"onUpdate:modelValue":S[173]||(S[173]=C=>_.value.config.emitterFollowSpace=C),class:"inp"},[...S[355]||(S[355]=[E("option",{value:"local"},"局部空间(GEN 移动)",-1),E("option",{value:"world"},"世界空间(粒子生成点移动)",-1)])],512),[[jt,_.value.config.emitterFollowSpace]])])]),E("label",_4,[S[358]||(S[358]=E("span",null,"移动方向",-1)),xe(E("select",{"onUpdate:modelValue":S[174]||(S[174]=C=>_.value.config.emitterFollowDirection=C),class:"inp"},[...S[357]||(S[357]=[E("option",{value:"forward"},"正向(起点 → 终点)",-1),E("option",{value:"reverse"},"反向(终点 → 起点)",-1)])],512),[[jt,_.value.config.emitterFollowDirection]])]),Ne(qe,{label:"偏移起始点 (0-1)",min:0,max:1,step:.01,modelValue:_.value.config.emitterFollowOffset,"onUpdate:modelValue":S[175]||(S[175]=C=>_.value.config.emitterFollowOffset=C)},null,8,["modelValue"]),S[360]||(S[360]=E("div",{class:"modifier-hint"},"局部空间会移动整个发射器;世界空间只移动新粒子的生成点,已出生粒子留在世界位置。",-1))],64)):_.value.config.emitterFollowMode==="bone"?(te(),oe(Ke,{key:1},[me.value?(te(),oe("div",M4,[S[361]||(S[361]=ai("跟随目标:",-1)),E("strong",null,je(me.value.spine.name)+" / "+je(me.value.boneName),1)])):(te(),oe("div",T4,"尚未绑定有效骨骼,请先在 Spine 层级树中选择骨骼。")),de.value&&(!me.value||de.value.spine.id!==me.value.spine.id||de.value.boneName!==me.value.boneName)?(te(),oe("button",{key:2,class:"bone-follow-rebind",onClick:S[176]||(S[176]=C=>Et(_.value.config))},je(me.value?"重新绑定":"绑定")+"当前选中骨骼:"+je(de.value.spine.name)+" / "+je(de.value.boneName),1)):Ue("",!0),me.value?(te(),oe(Ke,{key:3},[E("label",A4,[S[363]||(S[363]=E("span",null,"跟随空间",-1)),xe(E("select",{"onUpdate:modelValue":S[177]||(S[177]=C=>_.value.config.emitterFollowSpace=C),class:"inp"},[...S[362]||(S[362]=[E("option",{value:"local"},"本地空间(随骨骼移动)",-1),E("option",{value:"world"},"世界空间(粒子生成后保持位置)",-1)])],512),[[jt,_.value.config.emitterFollowSpace]])]),E("div",E4,[E("label",C4,[S[364]||(S[364]=E("span",null,"位移偏移 X",-1)),xe(E("input",{"onUpdate:modelValue":S[178]||(S[178]=C=>_.value.config.emitterFollowBoneOffsetX=C),type:"number",step:"1",class:"inp"},null,512),[[ct,_.value.config.emitterFollowBoneOffsetX,void 0,{number:!0}]])]),E("label",I4,[S[365]||(S[365]=E("span",null,"位移偏移 Y",-1)),xe(E("input",{"onUpdate:modelValue":S[179]||(S[179]=C=>_.value.config.emitterFollowBoneOffsetY=C),type:"number",step:"1",class:"inp"},null,512),[[ct,_.value.config.emitterFollowBoneOffsetY,void 0,{number:!0}]])])]),E("div",R4,[E("label",P4,[S[366]||(S[366]=E("span",null,"旋转偏移",-1)),xe(E("input",{"onUpdate:modelValue":S[180]||(S[180]=C=>_.value.config.emitterFollowBoneRotation=C),type:"number",step:"1",class:"inp"},null,512),[[ct,_.value.config.emitterFollowBoneRotation,void 0,{number:!0}]])]),E("label",k4,[S[367]||(S[367]=E("span",null,"缩放偏移 X",-1)),xe(E("input",{"onUpdate:modelValue":S[181]||(S[181]=C=>_.value.config.emitterFollowBoneScaleX=C),type:"number",step:"0.05",class:"inp"},null,512),[[ct,_.value.config.emitterFollowBoneScaleX,void 0,{number:!0}]])]),E("label",F4,[S[368]||(S[368]=E("span",null,"缩放偏移 Y",-1)),xe(E("input",{"onUpdate:modelValue":S[182]||(S[182]=C=>_.value.config.emitterFollowBoneScaleY=C),type:"number",step:"0.05",class:"inp"},null,512),[[ct,_.value.config.emitterFollowBoneScaleY,void 0,{number:!0}]])])]),S[369]||(S[369]=E("div",{class:"modifier-hint"},"发射器只跟随所选 Spine 骨骼的位置,不继承 Spine 的旋转或缩放;粒子变换使用粒子系统自身参数和上方偏移。",-1))],64)):Ue("",!0)],64)):Ue("",!0)])):Ue("",!0)]),E("div",O4,[E("label",B4,[xe(E("input",{type:"checkbox","onUpdate:modelValue":S[183]||(S[183]=C=>_.value.config.collision=C)},null,512),[[ti,_.value.config.collision]]),S[370]||(S[370]=E("span",{class:"switch-ui"},null,-1)),S[371]||(S[371]=E("span",null,"开启碰撞",-1))]),_.value.config.collision?(te(),oe("div",L4,[S[372]||(S[372]=E("div",{class:"collision-filter-title"},"参与的碰撞对象",-1)),E("div",D4,[(te(!0),oe(Ke,null,ci(Re.value,C=>(te(),oe("span",{key:C.id,class:ot(["collision-filter-tag",{disabled:!C.enabled}]),title:C.enabled?C.name:`${C.name}(碰撞体已禁用)`},[E("span",null,je(C.name),1),E("button",{type:"button","aria-label":`清除碰撞对象 ${C.name}`,onClick:Z=>H(C.id)},"×",8,U4)],10,N4))),128)),E("button",{type:"button",class:ot(["collision-filter-add",{active:we.value}]),disabled:ge.value.length===0,title:ge.value.length?"加入场景碰撞对象":"没有可加入的碰撞对象",onClick:S[184]||(S[184]=C=>we.value=!we.value)},"+",10,X4)]),Re.value.length===0?(te(),oe("div",V4,"未选择碰撞对象,当前粒子不会发生碰撞")):Ue("",!0),we.value&&ge.value.length?(te(),oe("div",Y4,[(te(!0),oe(Ke,null,ci(ge.value,C=>(te(),oe("button",{key:C.id,type:"button",onClick:Z=>Ae(C.id)},[E("span",null,je(C.name),1),E("small",null,je(C.enabled?"可用":"已禁用"),1)],8,$4))),128))])):Ue("",!0),S[373]||(S[373]=E("div",{class:"modifier-hint"},"只有已加入且启用的场景碰撞对象会参与当前粒子系统的碰撞",-1))])):Ue("",!0)]),Ne(qe,{label:"阻尼",min:0,max:2,step:.05,modelValue:_.value.config.damping,"onUpdate:modelValue":S[185]||(S[185]=C=>_.value.config.damping=C)},null,8,["modelValue"])],512),[[yr,!re.mods]])]),E("div",G4,[E("div",{class:"group-head",onClick:S[187]||(S[187]=C=>ye("export"))},[E("span",H4,je(re.export?"▸":"▾"),1),S[374]||(S[374]=E("span",null,"导出设置",-1)),E("button",{class:"group-reset",title:"重置导出设置",onClick:S[186]||(S[186]=yt(C=>yi("export"),["stop"]))},"重置")]),xe(E("div",j4,[E("label",W4,[S[375]||(S[375]=E("span",null,"图片路径 (Spine Images Path)",-1)),xe(E("input",{"onUpdate:modelValue":S[188]||(S[188]=C=>t.value.imagesPath=C),class:"inp export-input",type:"text",placeholder:"./images/"},null,512),[[ct,t.value.imagesPath,void 0,{trim:!0}]])]),E("label",z4,[S[377]||(S[377]=E("span",null,"Spine 版本",-1)),xe(E("select",{"onUpdate:modelValue":S[189]||(S[189]=C=>t.value.spineVersion=C),class:"inp export-input"},[...S[376]||(S[376]=[to('<option value="3.8" data-v-988d7abf>Spine 3.8</option><option value="4.0" data-v-988d7abf>Spine 4.0</option><option value="4.1" data-v-988d7abf>Spine 4.1</option><option value="4.2" data-v-988d7abf>Spine 4.2</option><option value="4.3" data-v-988d7abf>Spine 4.3</option>',5)])],512),[[jt,t.value.spineVersion]])]),E("label",q4,[S[379]||(S[379]=E("span",null,"关键帧插值曲线",-1)),xe(E("select",{"onUpdate:modelValue":S[190]||(S[190]=C=>t.value.keyframeCurve=C),class:"inp export-input"},[...S[378]||(S[378]=[E("option",{value:"linear"},"线性 (Linear)",-1),E("option",{value:"bezier"},"平滑贝塞尔 (Smooth Bézier)",-1)])],512),[[jt,t.value.keyframeCurve]])]),S[388]||(S[388]=E("div",{class:"export-help"},"平滑贝塞尔会在误差允许范围内拟合连续运动;出生、死亡、附件切换和突变仍使用阶跃关键帧。",-1)),t.value.spineVersion==="3.8"?(te(),oe("div",K4,"Spine 3.8 不支持 4.x 的逐通道数组贝塞尔,导出时会转换为经过容差精简的分段线性关键帧。")):Ue("",!0),E("div",Z4,[E("label",J4,[S[380]||(S[380]=E("span",null,"导出 FPS",-1)),xe(E("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:Bi},null,544),[[ct,t.value.fps,void 0,{number:!0}]])]),E("label",Q4,[xe(E("input",{"onUpdate:modelValue":S[192]||(S[192]=C=>t.value.omitFps=C),type:"checkbox"},null,512),[[ti,t.value.omitFps]]),S[381]||(S[381]=ai("不写 fps",-1))])]),S[389]||(S[389]=E("div",{class:"export-help"},"修改 FPS 时保持动画实际秒数不变;“不写 fps”只省略 Spine 的 fps 元数据。",-1)),E("div",e5,[E("label",t5,[xe(E("input",{"onUpdate:modelValue":S[193]||(S[193]=C=>t.value.integerFrameAlignment=C),type:"checkbox"},null,512),[[ti,t.value.integerFrameAlignment]]),S[382]||(S[382]=E("span",{class:"switch-ui"},null,-1)),S[383]||(S[383]=E("span",null,"整数帧对齐",-1))]),E("label",i5,[xe(E("input",{"onUpdate:modelValue":S[194]||(S[194]=C=>t.value.bonePool=C),type:"checkbox"},null,512),[[ti,t.value.bonePool]]),S[384]||(S[384]=E("span",{class:"switch-ui"},null,-1)),S[385]||(S[385]=E("span",null,"骨骼对象池",-1))]),E("label",s5,[xe(E("input",{"onUpdate:modelValue":S[195]||(S[195]=C=>t.value.excludeEmptyAnimations=C),type:"checkbox"},null,512),[[ti,t.value.excludeEmptyAnimations]]),S[386]||(S[386]=E("span",{class:"switch-ui"},null,-1)),S[387]||(S[387]=E("span",null,"排除无内容动画",-1))])])],512),[[yr,!re.export]])])],64)):Ue("",!0)]),E("div",n5,[E("button",{type:"button",class:"export-spine-json",disabled:l.value,title:l.value?"正在重新计算并烘焙动画":`导出 Spine ${t.value.spineVersion} JSON`,onClick:L},je(l.value&&c.value==="json"?"正在准备导出…":"导出Spine Json"),9,r5),E("button",{type:"button",class:"export-spine-images",disabled:l.value,title:"单独下载当前粒子系统使用的图片 ZIP",onClick:B},je(l.value&&c.value==="images"?"正在整理图片…":"导出 images 包"),9,a5),E("button",{type:"button",class:"export-spine-project",disabled:l.value||!v.value,title:w.value,onClick:U},[E("span",null,je(l.value&&c.value==="spine"?"正在生成工程…":"导出 .spine 包"),1),!l.value&&y.value?(te(),oe("small",l5,je(y.value),1)):Ue("",!0)],8,o5)]),E("div",{class:ot(["connector-status",g.value])},[S[390]||(S[390]=E("span",{class:"connector-dot"},null,-1)),ai(je(m.value)+" ",1),b.value?(te(),oe("a",{key:0,href:b.value,target:"_blank",rel:"noopener",title:"在本机连接器中授权当前网站"},"授权当前网站",8,c5)):Ue("",!0),E("button",{type:"button",title:"重新检测连接器",onClick:I},"刷新")],2),u.value?(te(),oe("div",{key:0,class:ot(["export-message",{error:d.value}])},[ai(je(u.value)+" ",1),p.value?(te(),oe("a",{key:0,href:p.value,target:"_blank",rel:"noopener",onClick:S[196]||(S[196]=C=>p.value="")},"授权当前网站",8,h5)):Ue("",!0)],2)):Ue("",!0)]))}}),d5=rn(u5,[["__scopeId","data-v-988d7abf"]]),f5={class:"timeline"},m5={class:"tl-controls"},p5=["title"],g5={class:"tl-range",title:"自定义播放起始帧"},v5=["max","onKeydown"],y5={class:"tl-range",title:"自定义播放结束帧"},x5=["min","max","onKeydown"],b5=["title"],w5={class:"tl-frame"},S5=["disabled"],_5=["onClick"],M5={key:0},T5={class:"tl-animation-editor"},A5={key:0,class:"tl-animation-error"},E5={class:"tl-animation-actions"},C5=["disabled"],I5={key:1,class:"tl-animation-hint"},R5={class:"tl-anim tl-spine-preview"},P5=["value","disabled"],k5={value:""},F5=["value"],O5={class:"tl-zoom"},B5={class:"tl-ticks"},L5={class:"tl-ticklabel"},D5={class:"tl-lanes"},N5=["onPointerdown"],U5={class:"lane-name"},X5=["onPointerdown"],V5=["onPointerdown"],Y5=["onPointerdown"],$5={class:"lane-name"},G5={key:0,class:"tl-empty"},H5=sn({__name:"Timeline",setup(s){const e=Kl(),t=ht(null),i=ht(null),n=ht(!1),r=ht("animation"),a=ht("");Qo(()=>{(!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 q of e.systems)(!q.animation||!e.timeline.animations.includes(q.animation))&&(q.animation=e.timeline.animations[0])});const o=pt(()=>e.systems.find(q=>q.id===e.activeId)||null),h=pt(()=>{const q=o.value;return!q||!j(q)?null:v1(q.config,m.value)});function l(){o.value&&(n.value=!n.value,r.value=o.value.animation,a.value="")}function c(q){const z=o.value;z&&(e.setSystemAnimation(z.id,q),r.value=q,a.value="")}function u(){const q=e.addAnimation();r.value=q,a.value=""}function d(){var ee;const q=((ee=o.value)==null?void 0:ee.animation)||e.timeline.animation,z=r.value.trim();if(!z){a.value="动画名称不能为空";return}if(z!==q&&e.timeline.animations.includes(z)){a.value="动画名称不能重复";return}if(!e.renameAnimation(q,z)){a.value="无法修改动画名称";return}r.value=z,a.value=""}function f(){var ee,le;const q=((ee=o.value)==null?void 0:ee.animation)||e.timeline.animation;if(!e.removeAnimation(q)){a.value="至少需要保留一个动画";return}const z=((le=o.value)==null?void 0:le.animation)||e.timeline.animation;r.value=z,a.value=""}function p(q){var z;(z=i.value)!=null&&z.contains(q.target)||(n.value=!1)}Da(()=>document.addEventListener("pointerdown",p)),uu(()=>document.removeEventListener("pointerdown",p));const m=pt(()=>Math.max(1,e.timeline.fps||30)),g=ht(120),v=ht({}),b=ht({}),y=ht({}),w=ht({}),A=ht(String(e.timeline.playbackStart)),T=ht(String(e.timeline.playbackEnd));cs(()=>e.timeline.playbackStart,q=>{A.value=String(q)}),cs(()=>e.timeline.playbackEnd,q=>{T.value=String(q)});const M=pt(()=>e.timeline.totalFrames),R=pt(()=>g.value<=30?"放大":g.value>=300?"缩小":"适中"),P=pt(()=>e.spines.filter(q=>q.selectedAnimation&&q.animations.some(z=>z.name===q.selectedAnimation&&z.duration>0))),F=pt(()=>(e.activeObjectType==="spine"?e.spines.find(z=>z.id===e.activeObjectId&&z.animations.length):null)||e.spines.find(z=>z.animations.length)||null);function I(q){const z=F.value;z&&(z.selectedAnimation=q.target.value,e.recalcTotalFrames(),e.timeline.frame=0)}function k(){e.setPlaybackStart(Number(A.value)),A.value=String(e.timeline.playbackStart)}function O(){e.setPlaybackEnd(Number(T.value)),T.value=String(e.timeline.playbackEnd)}function L(){const q=h.value;q&&(e.setPlaybackEnd(q.end),e.setPlaybackStart(q.start))}function U(){var z;const q=((z=t.value)==null?void 0:z.clientWidth)||600;return g.value/q}const B=pt(()=>{const q=[],z=g.value;let ee=1;g.value<=10?ee=1:g.value<=50?ee=5:g.value<=200?ee=10:g.value<=500?ee=50:ee=100;for(let le=0;le<=z;le+=ee)q.push({f:le,px:le/U()});return q}),D=pt(()=>e.timeline.frame/U());function _(q){const z=q.config;return(v.value[q.id]??Math.max(0,Number(z.delay)||0))*m.value/U()}function X(q){const z=q.config,ee=Math.max(0,Number(z.lifeMin)||0),le=Math.max(0,Number(z.lifeMax)||0);return z.lifeMode==="fixed"?ee:Math.max(ee,le)}function N(q){return G(q)}function V(q){if(q.config.mode!=="stream")return 0;if(q.config.streamBehavior==="loop"){const ee=q.config;return(y.value[q.id]??Dr(ee,m.value).loop)/U()}return(b.value[q.id]??Math.max(1/m.value,Number(q.config.duration)||1))*m.value/U()}function G(q){const z=q.config;return z.mode==="stream"&&z.streamBehavior==="loop"?ne(q)+V(q)+Q(q):V(q)+X(q)*m.value/U()}function j(q){const z=q.config;return z.mode==="stream"&&z.streamBehavior==="loop"}function ne(q){return j(q)?Dr(q.config,m.value).start/U():0}function Q(q){return j(q)?Dr(q.config,m.value).end/U():0}function de(q){var z;return((z=q.animations.find(ee=>ee.name===q.selectedAnimation))==null?void 0:z.duration)||0}function me(q){return(w.value[q.id]??Math.max(0,Number(q.timeOffset)||0))*m.value/U()}function we(q){return de(q)*m.value/U()}function Re(q){const z=q.deltaY<0?.8:1.25;let ee=g.value*z;ee=Math.min(2e3,Math.max(10,ee)),g.value=Math.round(ee)}function ge(q){const z=t.value,ee=ve=>{const re=z.getBoundingClientRect(),ye=Math.floor((ve.clientX-re.left)/re.width*g.value);e.timeline.frame=Math.max(0,Math.min(ye,M.value-1))};ee(q);const le=()=>{window.removeEventListener("pointermove",ee),window.removeEventListener("pointerup",le)};window.addEventListener("pointermove",ee),window.addEventListener("pointerup",le)}function Ae(q,z){q.stopPropagation();const ee=q.clientX,le=Math.max(0,Number(z.config.delay)||0),ve=U()/m.value,re=Pe=>{const Oe=(Pe.clientX-ee)*ve,it=Math.max(0,Math.min(le+Oe,600));v.value[z.id]=Math.round(it*m.value)/m.value},ye=Pe=>{window.removeEventListener("pointermove",re),window.removeEventListener("pointerup",he),window.removeEventListener("pointercancel",Xe);const Oe=v.value[z.id];delete v.value[z.id],Pe&&Oe!=null&&Oe!==le&&(z.config.delay=Oe)},he=()=>ye(!0),Xe=()=>ye(!1);window.addEventListener("pointermove",re),window.addEventListener("pointerup",he),window.addEventListener("pointercancel",Xe)}function H(q,z){var Ct;q.stopPropagation();const ee=j(z),le=Math.max(0,Number(z.config.duration)||0),ve=Dr(z.config,m.value).loop,re=U()/m.value,ye=((Ct=q.currentTarget.closest(".lane-bar"))==null?void 0:Ct.getBoundingClientRect().left)??q.clientX,he=ne(z);let Xe=!1;const Pe=wt=>{if(Xe=!0,ee){const Et=Math.min(1800,Math.max(1,Math.round((wt.clientX-ye-he)/U())));y.value[z.id]=Et}else{const Et=Math.max(1/m.value,Math.min((wt.clientX-ye)*re,600));b.value[z.id]=Math.round(Et*m.value)/m.value}},Oe=wt=>{window.removeEventListener("pointermove",Pe),window.removeEventListener("pointerup",it),window.removeEventListener("pointercancel",bt);const Et=b.value[z.id],Kt=y.value[z.id];delete b.value[z.id],delete y.value[z.id],wt&&Xe&&ee&&Kt!=null&&Kt!==ve?z.config.loopDurationFrames=Kt:wt&&Xe&&!ee&&Et!=null&&Et!==le&&(z.config.duration=Et)},it=()=>Oe(!0),bt=()=>Oe(!1);window.addEventListener("pointermove",Pe),window.addEventListener("pointerup",it),window.addEventListener("pointercancel",bt)}function K(q,z){q.stopPropagation();const ee=q.clientX,le=Math.max(0,Number(z.timeOffset)||0),ve=U()/m.value,re=Pe=>{const Oe=Math.max(0,Math.min(le+(Pe.clientX-ee)*ve,600));w.value[z.id]=Math.round(Oe*m.value)/m.value},ye=Pe=>{window.removeEventListener("pointermove",re),window.removeEventListener("pointerup",he),window.removeEventListener("pointercancel",Xe);const Oe=w.value[z.id];delete w.value[z.id],Pe&&Oe!=null&&Oe!==le&&(z.timeOffset=Oe,e.recalcTotalFrames())},he=()=>ye(!0),Xe=()=>ye(!1);window.addEventListener("pointermove",re),window.addEventListener("pointerup",he),window.addEventListener("pointercancel",Xe)}return(q,z)=>{var ee,le,ve;return te(),oe("div",f5,[E("div",m5,[E("button",{class:ot(["tl-btn",{on:ke(e).timeline.playing}]),onClick:z[0]||(z[0]=re=>ke(e).togglePlay()),title:ke(e).timeline.playing?"暂停 (D)":"播放 (D)"},je(ke(e).timeline.playing?"❚❚":"▶"),11,p5),E("button",{class:"tl-btn",onClick:z[1]||(z[1]=re=>ke(e).toStart()),title:"回到第一帧 (S)"},"⏮"),E("button",{class:"tl-btn",onClick:z[2]||(z[2]=re=>ke(e).previousFrame()),title:"前一帧"},"◀"),E("button",{class:"tl-btn",onClick:z[3]||(z[3]=re=>ke(e).nextFrame()),title:"后一帧"},"▶"),E("button",{class:"tl-btn",onClick:z[4]||(z[4]=re=>ke(e).toEnd()),title:"移动到最后一帧"},"⏭"),E("button",{class:ot(["tl-btn",{on:ke(e).timeline.loop}]),onClick:z[5]||(z[5]=re=>ke(e).toggleLoop()),title:"循环"},"⟳",2),E("label",g5,[z[10]||(z[10]=E("span",null,"A",-1)),xe(E("input",{"onUpdate:modelValue":z[6]||(z[6]=re=>A.value=re),type:"number",min:"0",max:Math.max(0,ke(e).timeline.playbackEnd-1),"aria-label":"播放起始帧",onChange:k,onKeydown:Aa(yt(k,["prevent"]),["enter"])},null,40,v5),[[ct,A.value]])]),E("label",y5,[z[11]||(z[11]=E("span",null,"B",-1)),xe(E("input",{"onUpdate:modelValue":z[7]||(z[7]=re=>T.value=re),type:"number",min:ke(e).timeline.playbackStart+1,max:Math.max(1,ke(e).timeline.totalFrames-1),"aria-label":"播放结束帧",onChange:O,onKeydown:Aa(yt(O,["prevent"]),["enter"])},null,40,x5),[[ct,T.value]])]),h.value?(te(),oe("button",{key:0,class:"tl-loop-range",title:`设为闭合自循环范围 ${h.value.start}–${h.value.end}f`,onClick:L},"循环段",8,b5)):Ue("",!0),E("span",w5,[z[12]||(z[12]=ai("帧 ",-1)),E("b",null,je(ke(e).timeline.frame),1),z[13]||(z[13]=ai(" / ",-1)),E("b",null,je(Math.max(0,ke(e).timeline.totalFrames-1)),1)]),z[18]||(z[18]=E("span",{class:"tl-legend"},[E("i",{class:"legend-emission"}),ai("持续发射 "),E("i",{class:"legend-life"}),ai("粒子存在 "),E("i",{class:"legend-spine"}),ai("Spine 动画")],-1)),E("div",{ref_key:"animationMenuRef",ref:i,class:"tl-anim tl-owner-animation"},[z[16]||(z[16]=E("span",null,"所属动画",-1)),E("button",{class:"tl-animation-trigger",disabled:!o.value,title:"设置当前粒子系统所属的动画",onClick:yt(l,["stop"])},[E("span",null,je(((ee=o.value)==null?void 0:ee.animation)||ke(e).timeline.animation),1),z[14]||(z[14]=E("i",null,"⌄",-1))],8,S5),n.value?(te(),oe("div",{key:0,class:"tl-animation-menu",onPointerdown:z[9]||(z[9]=yt(()=>{},["stop"]))},[z[15]||(z[15]=E("div",{class:"tl-animation-menu-title"},"选择所属动画",-1)),(te(!0),oe(Ke,null,ci(ke(e).timeline.animations,re=>{var ye,he;return te(),oe("button",{key:re,class:ot(["tl-animation-option",{on:((ye=o.value)==null?void 0:ye.animation)===re}]),onClick:Xe=>c(re)},[E("span",null,je(re),1),((he=o.value)==null?void 0:he.animation)===re?(te(),oe("i",M5,"✓")):Ue("",!0)],10,_5)}),128)),E("div",T5,[xe(E("input",{"onUpdate:modelValue":z[8]||(z[8]=re=>r.value=re),class:"tl-animation-name",maxlength:"64","aria-label":"动画名称",onKeydown:Aa(d,["enter"])},null,544),[[ct,r.value]]),E("button",{title:"重命名当前动画",onClick:d},"重命名")]),a.value?(te(),oe("div",A5,je(a.value),1)):Ue("",!0),E("div",E5,[E("button",{onClick:u},"+ 新增"),E("button",{disabled:ke(e).timeline.animations.length<=1,onClick:f},"删除",8,C5)]),ke(e).timeline.animations.length<=1?(te(),oe("div",I5,"至少需要保留一个动画")):Ue("",!0)],32)):Ue("",!0)],512),E("label",R5,[z[17]||(z[17]=ai("Spine 预览动画 ",-1)),E("select",{class:"tl-sel",value:((le=F.value)==null?void 0:le.selectedAnimation)||"",disabled:!F.value,onChange:I},[E("option",k5,je(F.value?"无":"无可用 Spine 动画"),1),(te(!0),oe(Ke,null,ci(((ve=F.value)==null?void 0:ve.animations)||[],re=>(te(),oe("option",{key:re.name,value:re.name},je(re.name)+"("+je(re.duration.toFixed(2))+"s) ",9,F5))),128))],40,P5)]),E("span",O5,je(R.value),1)]),E("div",{class:"tl-viewport",ref_key:"vpRef",ref:t,onWheel:yt(Re,["prevent"]),onPointerdown:ge},[E("div",B5,[(te(!0),oe(Ke,null,ci(B.value,re=>(te(),oe("div",{key:re.f,class:"tl-tickline",style:Ni({left:re.px+"px"})},[E("span",L5,je(re.f)+"f",1)],4))),128))]),E("div",{class:"tl-playhead",style:Ni({left:D.value+"px"})},null,4),E("div",D5,[(te(!0),oe(Ke,null,ci(ke(e).systems,(re,ye)=>(te(),oe("div",{key:re.id,class:"tl-lane"},[z[19]||(z[19]=E("span",{class:"lane-ico"},"●",-1)),E("div",{class:"lane-bar",style:Ni({left:_(re)+"px",width:N(re)+"px"}),onPointerdown:yt(he=>Ae(he,re),["stop"])},[E("span",U5,je(re.config.name||"系统 "+(ye+1)),1),E("span",{class:ot(["bar-life",{"loop-life":j(re)}]),style:Ni({width:G(re)+"px"})},null,6),j(re)?(te(),oe(Ke,{key:0},[ne(re)?(te(),oe("span",{key:0,class:"bar-loop-transition bar-loop-start",style:Ni({width:ne(re)+"px"})},null,4)):Ue("",!0),E("span",{class:"bar-emission bar-loop",style:Ni({left:ne(re)+"px",width:V(re)+"px"})},[E("span",{class:"bar-handle",title:"拖动循环段时长",onPointerdown:yt(he=>H(he,re),["stop"])},null,40,X5)],4),Q(re)?(te(),oe("span",{key:1,class:"bar-loop-transition bar-loop-end",style:Ni({left:ne(re)+V(re)+"px",width:Q(re)+"px"})},null,4)):Ue("",!0)],64)):re.config.mode==="stream"?(te(),oe("span",{key:1,class:"bar-emission",style:Ni({width:V(re)+"px"})},[E("span",{class:"bar-handle",title:"拖动持续发射时长",onPointerdown:yt(he=>H(he,re),["stop"])},null,40,V5)],4)):Ue("",!0)],44,N5)]))),128)),(te(!0),oe(Ke,null,ci(P.value,re=>(te(),oe("div",{key:`spine-${re.id}`,class:"tl-lane spine-lane"},[z[20]||(z[20]=E("span",{class:"lane-ico spine-ico"},"◆",-1)),E("div",{class:"spine-bar",style:Ni({left:me(re)+"px",width:we(re)+"px"}),title:"拖动调整动画开始时间",onPointerdown:yt(ye=>K(ye,re),["stop"])},[E("span",$5,je(re.name)+" · "+je(re.selectedAnimation),1)],44,Y5)]))),128)),!ke(e).systems.length&&!P.value.length?(te(),oe("div",G5,"暂无可显示的动画数据")):Ue("",!0)])],544)])}}}),j5=rn(H5,[["__scopeId","data-v-8d9981a9"]]),W5={class:"transfer-heading"},z5={key:0},q5={class:"transfer-detail"},K5=sn({__name:"TransferProgressOverlay",setup(s){const e=ht(null);return cs(()=>bi.visible,async t=>{var i;t&&(await ou(),(i=e.value)==null||i.focus({preventScroll:!0}))},{flush:"post"}),(t,i)=>(te(),Qt(kM,{name:"transfer-fade"},{default:ah(()=>[ke(bi).visible?(te(),oe("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]=yt(()=>{},["stop","prevent"])),onPointerup:i[1]||(i[1]=yt(()=>{},["stop","prevent"])),onClick:i[2]||(i[2]=yt(()=>{},["stop","prevent"])),onDblclick:i[3]||(i[3]=yt(()=>{},["stop","prevent"])),onContextmenu:i[4]||(i[4]=yt(()=>{},["stop","prevent"])),onWheel:i[5]||(i[5]=yt(()=>{},["stop","prevent"])),onKeydown:i[6]||(i[6]=yt(()=>{},["stop","prevent"]))},[E("div",{class:ot(["transfer-dialog",{failed:ke(bi).failed}])},[E("div",W5,[E("span",null,je(ke(bi).title),1),ke(bi).indeterminate?Ue("",!0):(te(),oe("strong",z5,je(Math.round(ke(bi).progress))+"%",1))]),E("div",{class:ot(["transfer-track",{indeterminate:ke(bi).indeterminate}])},[E("div",{class:"transfer-bar",style:Ni(ke(bi).indeterminate?void 0:{width:`${ke(bi).progress}%`})},null,4)],2),E("div",q5,je(ke(bi).detail),1)],2)],544)):Ue("",!0)]),_:1}))}}),Z5=rn(K5,[["__scopeId","data-v-592b922e"]]),J5=["inert","aria-hidden"],Q5={class:"right"},eU={class:"stage-area"},tU=sn({__name:"App",setup(s){const e=Kl();QI(e);const t=ht(360),i=ht(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)=>(te(),oe(Ke,null,[E("div",{class:ot(["layout",{"panel-right":ke(e).settings.parameterPanelOnRight}]),inert:ke(bi).visible?!0:void 0,"aria-hidden":ke(bi).visible?"true":void 0},[E("div",{class:"parameter-panel",style:Ni({width:t.value+"px"})},[Ne(d5)],4),E("div",{class:"resizer-col",onPointerdown:n},null,32),E("div",Q5,[E("div",eU,[Ne(Ik)]),E("div",{class:"resizer-row",onPointerdown:r,title:"拖动调整时间轴高度"},null,32),E("div",{class:"timeline-area",style:Ni({height:i.value+"px"})},[Ne(j5)],4)])],10,J5),Ne(Z5)],64))}}),iU=rn(tU,[["__scopeId","data-v-42c4fa00"]]);aT(iU).use(cT()).mount("#app");export{fy as $,Rn as A,Wh as B,Wt as C,ji as D,He as E,ls as F,Bn as G,xt as H,Xt as I,vS as J,ms as K,_s as L,Bs as M,Hr as N,Pu as O,In as P,Ll as Q,Po as R,zs as S,Q3 as T,lt as U,oy as V,Zs as W,P8 as X,KO as Y,Vl as Z,Mp as _,mt as a,Bm as a$,dy as a0,Kw as a1,Op as a2,I8 as a3,$h as a4,bl as a5,cO as a6,wl as a7,ku as a8,Pm as a9,$m as aA,Gm as aB,Nc as aC,Cr as aD,Qc as aE,km as aF,eS as aG,mi as aH,Ww as aI,w8 as aJ,To as aK,uy as aL,Ve as aM,st as aN,Om as aO,eh as aP,nS as aQ,Fm as aR,iS as aS,sS as aT,Fu as aU,oS as aV,th as aW,hS as aX,rS as aY,lS as aZ,uS as a_,Ya as aa,Bp as ab,Lp as ac,cy as ad,Ql as ae,ec as af,Jl as ag,Va as ah,sr as ai,_8 as aj,Qw as ak,lO as al,Fo as am,Vr as an,Up as ao,gS as ap,aO as aq,Xl as ar,fs as as,hy as at,A8 as au,No as av,Ym as aw,Hm as ax,jm as ay,Wm as az,Io as b,pr as b$,jh as b0,aS as b1,zr as b2,cS as b3,Dp as b4,J3 as b5,mS as b6,pS as b7,Np as b8,On as b9,dS as bA,Xp as bB,Ru as bC,yS as bD,Lm as bE,Fi as bF,K3 as bG,tO as bH,Lw as bI,Bw as bJ,M8 as bK,si as bL,Uo as bM,xS as bN,SS as bO,_S as bP,MS as bQ,bS as bR,wS as bS,rO as bT,Vp as bU,$t as bV,Vm as bW,tS as bX,Nw as bY,Uw as bZ,Xw as b_,Z3 as ba,S8 as bb,vt as bc,Jw as bd,Zw as be,zw as bf,qw as bg,Pa as bh,Gh as bi,oO as bj,Vw as bk,Yw as bl,as as bm,$w as bn,ko as bo,Gi as bp,Dw as bq,Hh as br,Gw as bs,Hw as bt,jw as bu,my as bv,Um as bw,xa as bx,fS as by,Nm as bz,Ro as c,T8 as c0,sO as c1,nO as c2,iO as c3,ut as d,tt as e,E8 as f,gt as g,Xi as h,_h as i,gs as j,oi as k,et as l,en as m,li as n,vp as o,Si as p,Dl as q,Tr as r,We as s,ob as t,_p as u,Ch as v,Dm as w,va as x,ly as y,Xm as z};
|