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-CTL5QUHS.js","assets/index-CX6BjU37.js"])))=>i.map(i=>d[i]);
|
||
var Bw=Object.defineProperty;var Lw=(n,e,t)=>e in n?Bw(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var b=(n,e,t)=>Lw(n,typeof e!="symbol"?e+"":e,t);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))i(s);new MutationObserver(s=>{for(const r of s)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(s){const r={};return s.integrity&&(r.integrity=s.integrity),s.referrerPolicy&&(r.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?r.credentials="include":s.crossOrigin==="anonymous"?r.credentials="omit":r.credentials="same-origin",r}function i(s){if(s.ep)return;s.ep=!0;const r=t(s);fetch(s.href,r)}})();/**
|
||
* @vue/shared v3.5.41
|
||
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
||
* @license MIT
|
||
**/function vm(n){const e=Object.create(null);for(const t of n.split(","))e[t]=1;return t=>t in e}const Gt={},Wa=[],pn=()=>{},Fv=()=>!1,Ah=n=>n.charCodeAt(0)===111&&n.charCodeAt(1)===110&&(n.charCodeAt(2)>122||n.charCodeAt(2)<97),Ch=n=>n.startsWith("onUpdate:"),Fi=Object.assign,ym=(n,e)=>{const t=n.indexOf(e);t>-1&&n.splice(t,1)},Dw=Object.prototype.hasOwnProperty,Ut=(n,e)=>Dw.call(n,e),at=Array.isArray,za=n=>Sl(n)==="[object Map]",go=n=>Sl(n)==="[object Set]",mp=n=>Sl(n)==="[object Date]",ft=n=>typeof n=="function",ci=n=>typeof n=="string",us=n=>typeof n=="symbol",$t=n=>n!==null&&typeof n=="object",Ov=n=>($t(n)||ft(n))&&ft(n.then)&&ft(n.catch),Bv=Object.prototype.toString,Sl=n=>Bv.call(n),Nw=n=>Sl(n).slice(8,-1),Lv=n=>Sl(n)==="[object Object]",Ih=n=>ci(n)&&n!=="NaN"&&n[0]!=="-"&&""+parseInt(n,10)===n,Wo=vm(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),Rh=n=>{const e=Object.create(null);return(t=>e[t]||(e[t]=n(t)))},Uw=/-\w/g,Bs=Rh(n=>n.replace(Uw,e=>e.slice(1).toUpperCase())),Xw=/\B([A-Z])/g,kr=Rh(n=>n.replace(Xw,"-$1").toLowerCase()),Dv=Rh(n=>n.charAt(0).toUpperCase()+n.slice(1)),ou=Rh(n=>n?`on${Dv(n)}`:""),hn=(n,e)=>!Object.is(n,e),yc=(n,...e)=>{for(let t=0;t<n.length;t++)n[t](...e)},Nv=(n,e,t,i=!1)=>{Object.defineProperty(n,e,{configurable:!0,enumerable:!1,writable:i,value:t})},Ph=n=>{const e=parseFloat(n);return isNaN(e)?n:e};let pp;const kh=()=>pp||(pp=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function Ii(n){if(at(n)){const e={};for(let t=0;t<n.length;t++){const i=n[t],s=ci(i)?Gw(i):Ii(i);if(s)for(const r in s)e[r]=s[r]}return e}else if(ci(n)||$t(n))return n}const Yw=/;(?![^(]*\))/g,Vw=/:([^]+)/,$w=/\/\*[^]*?\*\//g;function Gw(n){const e={};return n.replace($w,"").split(Yw).forEach(t=>{if(t){const i=t.split(Vw);i.length>1&&(e[i[0].trim()]=i[1].trim())}}),e}function it(n){let e="";if(ci(n))e=n;else if(at(n))for(let t=0;t<n.length;t++){const i=it(n[t]);i&&(e+=i+" ")}else if($t(n))for(const t in n)n[t]&&(e+=t+" ");return e.trim()}const Hw="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",jw=vm(Hw);function Uv(n){return!!n||n===""}function Ww(n,e){if(n.length!==e.length)return!1;let t=!0;for(let i=0;t&&i<n.length;i++)t=vo(n[i],e[i]);return t}function vo(n,e){if(n===e)return!0;let t=mp(n),i=mp(e);if(t||i)return t&&i?n.getTime()===e.getTime():!1;if(t=us(n),i=us(e),t||i)return n===e;if(t=at(n),i=at(e),t||i)return t&&i?Ww(n,e):!1;if(t=$t(n),i=$t(e),t||i){if(!t||!i)return!1;const s=Object.keys(n).length,r=Object.keys(e).length;if(s!==r)return!1;for(const a in n){const o=n.hasOwnProperty(a),h=e.hasOwnProperty(a);if(o&&!h||!o&&h||!vo(n[a],e[a]))return!1}}return String(n)===String(e)}function xm(n,e){return n.findIndex(t=>vo(t,e))}const Xv=n=>!!(n&&n.__v_isRef===!0),He=n=>ci(n)?n:n==null?"":at(n)||$t(n)&&(n.toString===Bv||!ft(n.toString))?Xv(n)?He(n.value):JSON.stringify(n,Yv,2):String(n),Yv=(n,e)=>Xv(e)?Yv(n,e.value):za(e)?{[`Map(${e.size})`]:[...e.entries()].reduce((t,[i,s],r)=>(t[lu(i,r)+" =>"]=s,t),{})}:go(e)?{[`Set(${e.size})`]:[...e.values()].map(t=>lu(t))}:us(e)?lu(e):$t(e)&&!at(e)&&!Lv(e)?String(e):e,lu=(n,e="")=>{var t;return us(n)?`Symbol(${(t=n.description)!=null?t:e})`:n};/**
|
||
* @vue/reactivity v3.5.41
|
||
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
||
* @license MIT
|
||
**/let wi;class Vv{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&&wi&&(wi.active?(this.parent=wi,this.index=(wi.scopes||(wi.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 s=this.scopes.slice();for(e=0,t=s.length;e<t;e++)s[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=wi;try{return wi=this,e()}finally{wi=t}}}on(){++this._on===1&&(this.prevScope=wi,wi=this)}off(){if(this._on>0&&--this._on===0){if(wi===this)wi=this.prevScope;else{let e=wi;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 s=this.scopes.slice();for(t=0,i=s.length;t<i;t++)s[t].stop(!0);this.scopes.length=0}if(!this.detached&&this.parent&&!e){const s=this.parent.scopes.pop();s&&s!==this&&(this.parent.scopes[this.index]=s,s.index=this.index)}this.parent=void 0}}}function $v(n){return new Vv(n)}function Gv(){return wi}function zw(n,e=!1){wi&&wi.cleanups.push(n)}let zt;const cu=new WeakSet;class Hv{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,wi&&(wi.active?wi.effects.push(this):this.flags&=-2)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,cu.has(this)&&(cu.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||Wv(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,gp(this),zv(this);const e=zt,t=Ls;zt=this,Ls=!0;try{return this.fn()}finally{qv(this),zt=e,Ls=t,this.flags&=-3}}stop(){if(this.flags&1){for(let e=this.deps;e;e=e.nextDep)Sm(e);this.deps=this.depsTail=void 0,gp(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?cu.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){Zd(this)&&this.run()}get dirty(){return Zd(this)}}let jv=0,zo,qo;function Wv(n,e=!1){if(n.flags|=8,e){n.next=qo,qo=n;return}n.next=zo,zo=n}function bm(){jv++}function wm(){if(--jv>0)return;if(qo){let e=qo;for(qo=void 0;e;){const t=e.next;e.next=void 0,e.flags&=-9,e=t}}let n;for(;zo;){let e=zo;for(zo=void 0;e;){const t=e.next;if(e.next=void 0,e.flags&=-9,e.flags&1)try{e.trigger()}catch(i){n||(n=i)}e=t}}if(n)throw n}function zv(n){for(let e=n.deps;e;e=e.nextDep)e.version=-1,e.prevActiveLink=e.dep.activeLink,e.dep.activeLink=e}function qv(n){let e,t=n.depsTail,i=t;for(;i;){const s=i.prevDep;i.version===-1?(i===t&&(t=s),Sm(i),qw(i)):e=i,i.dep.activeLink=i.prevActiveLink,i.prevActiveLink=void 0,i=s}n.deps=e,n.depsTail=t}function Zd(n){for(let e=n.deps;e;e=e.nextDep)if(e.dep.version!==e.version||e.dep.computed&&(Kv(e.dep.computed)||e.dep.version!==e.version))return!0;return!!n._dirty}function Kv(n){if(n.flags&4&&!(n.flags&16)||(n.flags&=-17,n.globalVersion===ll)||(n.globalVersion=ll,!n.isSSR&&n.flags&128&&(!n.deps&&!n._dirty||!Zd(n))))return;n.flags|=2;const e=n.dep,t=zt,i=Ls;zt=n,Ls=!0;try{zv(n);const s=n.fn(n._value);(e.version===0||hn(s,n._value))&&(n.flags|=128,n._value=s,e.version++)}catch(s){throw e.version++,s}finally{zt=t,Ls=i,qv(n),n.flags&=-3}}function Sm(n,e=!1){const{dep:t,prevSub:i,nextSub:s}=n;if(i&&(i.nextSub=s,n.prevSub=void 0),s&&(s.prevSub=i,n.nextSub=void 0),t.subs===n&&(t.subs=i,!i&&t.computed)){t.computed.flags&=-5;for(let r=t.computed.deps;r;r=r.nextDep)Sm(r,!0)}!e&&!--t.sc&&t.map&&t.map.delete(t.key)}function qw(n){const{prevDep:e,nextDep:t}=n;e&&(e.nextDep=t,n.prevDep=void 0),t&&(t.prevDep=e,n.nextDep=void 0)}let Ls=!0;const Zv=[];function Kn(){Zv.push(Ls),Ls=!1}function Zn(){const n=Zv.pop();Ls=n===void 0?!0:n}function gp(n){const{cleanup:e}=n;if(n.cleanup=void 0,e){const t=zt;zt=void 0;try{e()}finally{zt=t}}}let ll=0;class Kw{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 _m{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(!zt||!Ls||zt===this.computed)return;let t=this.activeLink;if(t===void 0||t.sub!==zt)t=this.activeLink=new Kw(zt,this),zt.deps?(t.prevDep=zt.depsTail,zt.depsTail.nextDep=t,zt.depsTail=t):zt.deps=zt.depsTail=t,Jv(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=zt.depsTail,t.nextDep=void 0,zt.depsTail.nextDep=t,zt.depsTail=t,zt.deps===t&&(zt.deps=i)}return t}trigger(e){this.version++,ll++,this.notify(e)}notify(e){bm();try{for(let t=this.subs;t;t=t.prevSub)t.sub.notify()&&t.sub.dep.notify()}finally{wm()}}}function Jv(n){if(n.dep.sc++,n.sub.flags&4){const e=n.dep.computed;if(e&&!n.dep.subs){e.flags|=20;for(let i=e.deps;i;i=i.nextDep)Jv(i)}const t=n.dep.subs;t!==n&&(n.prevSub=t,t&&(t.nextSub=n)),n.dep.subs=n}}const Bc=new WeakMap,na=Symbol(""),Jd=Symbol(""),cl=Symbol("");function Xi(n,e,t){if(Ls&&zt){let i=Bc.get(n);i||Bc.set(n,i=new Map);let s=i.get(t);s||(i.set(t,s=new _m),s.map=i,s.key=t),s.track()}}function Dn(n,e,t,i,s,r){const a=Bc.get(n);if(!a){ll++;return}const o=h=>{h&&h.trigger()};if(bm(),e==="clear")a.forEach(o);else{const h=at(n),l=h&&Ih(t);if(h&&t==="length"){const c=Number(i);a.forEach((u,d)=>{(d==="length"||d===cl||!us(d)&&d>=c)&&o(u)})}else switch((t!==void 0||a.has(void 0))&&o(a.get(t)),l&&o(a.get(cl)),e){case"add":h?l&&o(a.get("length")):(o(a.get(na)),za(n)&&o(a.get(Jd)));break;case"delete":h||(o(a.get(na)),za(n)&&o(a.get(Jd)));break;case"set":za(n)&&o(a.get(na));break}}wm()}function Zw(n,e){const t=Bc.get(n);return t&&t.get(e)}function Ea(n){const e=Bt(n);return e===n?e:(Xi(e,"iterate",cl),cs(n)?e:e.map(Ys))}function Fh(n){return Xi(n=Bt(n),"iterate",cl),n}function on(n,e){return Jn(n)?ao(Wn(n)?Ys(e):e):Ys(e)}const Jw={__proto__:null,[Symbol.iterator](){return hu(this,Symbol.iterator,n=>on(this,n))},concat(...n){return Ea(this).concat(...n.map(e=>at(e)?Ea(e):e))},entries(){return hu(this,"entries",n=>(n[1]=on(this,n[1]),n))},every(n,e){return An(this,"every",n,e,void 0,arguments)},filter(n,e){return An(this,"filter",n,e,t=>t.map(i=>on(this,i)),arguments)},find(n,e){return An(this,"find",n,e,t=>on(this,t),arguments)},findIndex(n,e){return An(this,"findIndex",n,e,void 0,arguments)},findLast(n,e){return An(this,"findLast",n,e,t=>on(this,t),arguments)},findLastIndex(n,e){return An(this,"findLastIndex",n,e,void 0,arguments)},forEach(n,e){return An(this,"forEach",n,e,void 0,arguments)},includes(...n){return uu(this,"includes",n)},indexOf(...n){return uu(this,"indexOf",n)},join(n){return Ea(this).join(n)},lastIndexOf(...n){return uu(this,"lastIndexOf",n)},map(n,e){return An(this,"map",n,e,void 0,arguments)},pop(){return Ao(this,"pop")},push(...n){return Ao(this,"push",n)},reduce(n,...e){return vp(this,"reduce",n,e)},reduceRight(n,...e){return vp(this,"reduceRight",n,e)},shift(){return Ao(this,"shift")},some(n,e){return An(this,"some",n,e,void 0,arguments)},splice(...n){return Ao(this,"splice",n)},toReversed(){return Ea(this).toReversed()},toSorted(n){return Ea(this).toSorted(n)},toSpliced(...n){return Ea(this).toSpliced(...n)},unshift(...n){return Ao(this,"unshift",n)},values(){return hu(this,"values",n=>on(this,n))}};function hu(n,e,t){const i=Fh(n),s=i[e]();return i!==n&&!cs(n)&&(s._next=s.next,s.next=()=>{const r=s._next();return r.done||(r.value=t(r.value)),r}),s}const Qw=Array.prototype;function An(n,e,t,i,s,r){const a=Fh(n),o=a!==n&&!cs(n),h=a[e];if(h!==Qw[e]){const u=h.apply(n,r);return o?Ys(u):u}let l=t;a!==n&&(o?l=function(u,d){return t.call(this,on(n,u),d,n)}:t.length>2&&(l=function(u,d){return t.call(this,u,d,n)}));const c=h.call(a,l,i);return o&&s?s(c):c}function vp(n,e,t,i){const s=Fh(n),r=s!==n&&!cs(n);let a=t,o=!1;s!==n&&(r?(o=i.length===0,a=function(l,c,u){return o&&(o=!1,l=on(n,l)),t.call(this,l,on(n,c),u,n)}):t.length>3&&(a=function(l,c,u){return t.call(this,l,c,u,n)}));const h=s[e](a,...i);return o?on(n,h):h}function uu(n,e,t){const i=Bt(n);Xi(i,"iterate",cl);const s=i[e](...t);return(s===-1||s===!1)&&Oh(t[0])?(t[0]=Bt(t[0]),i[e](...t)):s}function Ao(n,e,t=[]){Kn(),bm();const i=Bt(n)[e].apply(n,t);return wm(),Zn(),i}const eS=vm("__proto__,__v_isRef,__isVue"),Qv=new Set(Object.getOwnPropertyNames(Symbol).filter(n=>n!=="arguments"&&n!=="caller").map(n=>Symbol[n]).filter(us));function tS(n){us(n)||(n=String(n));const e=Bt(this);return Xi(e,"has",n),e.hasOwnProperty(n)}class ey{constructor(e=!1,t=!1){this._isReadonly=e,this._isShallow=t}get(e,t,i){if(t==="__v_skip")return e.__v_skip;const s=this._isReadonly,r=this._isShallow;if(t==="__v_isReactive")return!s;if(t==="__v_isReadonly")return s;if(t==="__v_isShallow")return r;if(t==="__v_raw")return i===(s?r?uS:ny:r?sy:iy).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(i)?e:void 0;const a=at(e);if(!s){let h;if(a&&(h=Jw[t]))return h;if(t==="hasOwnProperty")return tS}const o=Reflect.get(e,t,hi(e)?e:i);if((us(t)?Qv.has(t):eS(t))||(s||Xi(e,"get",t),r))return o;if(hi(o)){const h=a&&Ih(t)?o:o.value;return s&&$t(h)?ef(h):h}return $t(o)?s?ef(o):yo(o):o}}class ty extends ey{constructor(e=!1){super(!1,e)}set(e,t,i,s){let r=e[t];const a=at(e)&&Ih(t);if(!this._isShallow){const l=Jn(r);if(!cs(i)&&!Jn(i)&&(r=Bt(r),i=Bt(i)),!a&&hi(r)&&!hi(i))return l||(r.value=i),!0}const o=a?Number(t)<e.length:Ut(e,t),h=Reflect.set(e,t,i,hi(e)?e:s);return e===Bt(s)&&h&&(o?hn(i,r)&&Dn(e,"set",t,i):Dn(e,"add",t,i)),h}deleteProperty(e,t){const i=Ut(e,t);e[t];const s=Reflect.deleteProperty(e,t);return s&&i&&Dn(e,"delete",t,void 0),s}has(e,t){const i=Reflect.has(e,t);return(!us(t)||!Qv.has(t))&&Xi(e,"has",t),i}ownKeys(e){return Xi(e,"iterate",at(e)?"length":na),Reflect.ownKeys(e)}}class iS extends ey{constructor(e=!1){super(!0,e)}set(e,t){return!0}deleteProperty(e,t){return!0}}const sS=new ty,nS=new iS,rS=new ty(!0);const Qd=n=>n,Ll=n=>Reflect.getPrototypeOf(n);function aS(n,e,t){return function(...i){const s=this.__v_raw,r=Bt(s),a=za(r),o=n==="entries"||n===Symbol.iterator&&a,h=n==="keys"&&a,l=s[n](...i),c=t?Qd:e?ao:Ys;return!e&&Xi(r,"iterate",h?Jd:na),Fi(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 Dl(n){return function(...e){return n==="delete"?!1:n==="clear"?void 0:this}}function oS(n,e){const t={get(s){const r=this.__v_raw,a=Bt(r),o=Bt(s);n||(hn(s,o)&&Xi(a,"get",s),Xi(a,"get",o));const{has:h}=Ll(a),l=e?Qd:n?ao:Ys;if(h.call(a,s))return l(r.get(s));if(h.call(a,o))return l(r.get(o));r!==a&&r.get(s)},get size(){const s=this.__v_raw;return!n&&Xi(Bt(s),"iterate",na),s.size},has(s){const r=this.__v_raw,a=Bt(r),o=Bt(s);return n||(hn(s,o)&&Xi(a,"has",s),Xi(a,"has",o)),s===o?r.has(s):r.has(s)||r.has(o)},forEach(s,r){const a=this,o=a.__v_raw,h=Bt(o),l=e?Qd:n?ao:Ys;return!n&&Xi(h,"iterate",na),o.forEach((c,u)=>s.call(r,l(c),l(u),a))}};return Fi(t,n?{add:Dl("add"),set:Dl("set"),delete:Dl("delete"),clear:Dl("clear")}:{add(s){const r=Bt(this),a=Ll(r),o=Bt(s),h=!e&&!cs(s)&&!Jn(s)?o:s;return a.has.call(r,h)||hn(s,h)&&a.has.call(r,s)||hn(o,h)&&a.has.call(r,o)||(r.add(h),Dn(r,"add",h,h)),this},set(s,r){!e&&!cs(r)&&!Jn(r)&&(r=Bt(r));const a=Bt(this),{has:o,get:h}=Ll(a);let l=o.call(a,s);l||(s=Bt(s),l=o.call(a,s));const c=h.call(a,s);return a.set(s,r),l?hn(r,c)&&Dn(a,"set",s,r):Dn(a,"add",s,r),this},delete(s){const r=Bt(this),{has:a,get:o}=Ll(r);let h=a.call(r,s);h||(s=Bt(s),h=a.call(r,s)),o&&o.call(r,s);const l=r.delete(s);return h&&Dn(r,"delete",s,void 0),l},clear(){const s=Bt(this),r=s.size!==0,a=s.clear();return r&&Dn(s,"clear",void 0,void 0),a}}),["keys","values","entries",Symbol.iterator].forEach(s=>{t[s]=aS(s,n,e)}),t}function Tm(n,e){const t=oS(n,e);return(i,s,r)=>s==="__v_isReactive"?!n:s==="__v_isReadonly"?n:s==="__v_raw"?i:Reflect.get(Ut(t,s)&&s in i?t:i,s,r)}const lS={get:Tm(!1,!1)},cS={get:Tm(!1,!0)},hS={get:Tm(!0,!1)};const iy=new WeakMap,sy=new WeakMap,ny=new WeakMap,uS=new WeakMap;function dS(n){switch(n){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function yo(n){return Jn(n)?n:Mm(n,!1,sS,lS,iy)}function fS(n){return Mm(n,!1,rS,cS,sy)}function ef(n){return Mm(n,!0,nS,hS,ny)}function Mm(n,e,t,i,s){if(!$t(n)||n.__v_raw&&!(e&&n.__v_isReactive)||n.__v_skip||!Object.isExtensible(n))return n;const r=s.get(n);if(r)return r;const a=dS(Nw(n));if(a===0)return n;const o=new Proxy(n,a===2?i:t);return s.set(n,o),o}function Wn(n){return Jn(n)?Wn(n.__v_raw):!!(n&&n.__v_isReactive)}function Jn(n){return!!(n&&n.__v_isReadonly)}function cs(n){return!!(n&&n.__v_isShallow)}function Oh(n){return n?!!n.__v_raw:!1}function Bt(n){const e=n&&n.__v_raw;return e?Bt(e):n}function Sr(n){return!Ut(n,"__v_skip")&&Object.isExtensible(n)&&Nv(n,"__v_skip",!0),n}const Ys=n=>$t(n)?yo(n):n,ao=n=>$t(n)?ef(n):n;function hi(n){return n?n.__v_isRef===!0:!1}function nt(n){return mS(n,!1)}function mS(n,e){return hi(n)?n:new pS(n,e)}class pS{constructor(e,t){this.dep=new _m,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=t?e:Bt(e),this._value=t?e:Ys(e),this.__v_isShallow=t}get value(){return this.dep.track(),this._value}set value(e){const t=this._rawValue,i=this.__v_isShallow||cs(e)||Jn(e);e=i?e:Bt(e),hn(e,t)&&(this._rawValue=e,this._value=i?e:Ys(e),this.dep.trigger())}}function Be(n){return hi(n)?n.value:n}const gS={get:(n,e,t)=>e==="__v_raw"?n:Be(Reflect.get(n,e,t)),set:(n,e,t,i)=>{const s=n[e];return hi(s)&&!hi(t)?(s.value=t,!0):Reflect.set(n,e,t,i)}};function ry(n){return Wn(n)?n:new Proxy(n,gS)}function vS(n){const e=at(n)?new Array(n.length):{};for(const t in n)e[t]=xS(n,t);return e}class yS{constructor(e,t,i){this._object=e,this._defaultValue=i,this.__v_isRef=!0,this._value=void 0,this._key=us(t)?t:String(t),this._raw=Bt(e);let s=!0,r=e;if(!at(e)||us(this._key)||!Ih(this._key))do s=!Oh(r)||cs(r);while(s&&(r=r.__v_raw));this._shallow=s}get value(){let e=this._object[this._key];return this._shallow&&(e=Be(e)),this._value=e===void 0?this._defaultValue:e}set value(e){if(this._shallow&&hi(this._raw[this._key])){const t=this._object[this._key];if(hi(t)){t.value=e;return}}this._object[this._key]=e}get dep(){return Zw(this._raw,this._key)}}function xS(n,e,t){return new yS(n,e,t)}class bS{constructor(e,t,i){this.fn=e,this.setter=t,this._value=void 0,this.dep=new _m(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=ll-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!t,this.isSSR=i}notify(){if(this.flags|=16,!(this.flags&8)&&zt!==this)return Wv(this,!0),!0}get value(){const e=this.dep.track();return Kv(this),e&&(e.version=this.dep.version),this._value}set value(e){this.setter&&this.setter(e)}}function wS(n,e,t=!1){let i,s;return ft(n)?i=n:(i=n.get,s=n.set),new bS(i,s,t)}const Nl={},Lc=new WeakMap;let Gr;function SS(n,e=!1,t=Gr){if(t){let i=Lc.get(t);i||Lc.set(t,i=[]),i.push(n)}}function _S(n,e,t=Gt){const{immediate:i,deep:s,once:r,scheduler:a,augmentJob:o,call:h}=t,l=_=>s?_:cs(_)||s===!1||s===0?Nn(_,1):Nn(_);let c,u,d,f,p=!1,m=!1;if(hi(n)?(u=()=>n.value,p=cs(n)):Wn(n)?(u=()=>l(n),p=!0):at(n)?(m=!0,p=n.some(_=>Wn(_)||cs(_)),u=()=>n.map(_=>{if(hi(_))return _.value;if(Wn(_))return l(_);if(ft(_))return h?h(_,2):_()})):ft(n)?e?u=h?()=>h(n,2):n:u=()=>{if(d){Kn();try{d()}finally{Zn()}}const _=Gr;Gr=c;try{return h?h(n,3,[f]):n(f)}finally{Gr=_}}:u=pn,e&&s){const _=u,x=s===!0?1/0:s;u=()=>Nn(_(),x)}const g=Gv(),y=()=>{c.stop(),g&&g.active&&ym(g.effects,c)};if(r&&e){const _=e;e=(...x)=>{const M=_(...x);return y(),M}}let w=m?new Array(n.length).fill(Nl):Nl;const v=_=>{if(!(!(c.flags&1)||!c.dirty&&!_))if(e){const x=c.run();if(_||s||p||(m?x.some((M,T)=>hn(M,w[T])):hn(x,w))){d&&d();const M=Gr;Gr=c;try{const T=[x,w===Nl?void 0:m&&w[0]===Nl?[]:w,f];w=x,h?h(e,3,T):e(...T)}finally{Gr=M}}}else c.run()};return o&&o(v),c=new Hv(u),c.scheduler=a?()=>a(v,!1):v,f=_=>SS(_,!1,c),d=c.onStop=()=>{const _=Lc.get(c);if(_){if(h)h(_,4);else for(const x of _)x();Lc.delete(c)}},e?i?v(!0):w=c.run():a?a(v.bind(null,!0),!0):c.run(),y.pause=c.pause.bind(c),y.resume=c.resume.bind(c),y.stop=y,y}function Nn(n,e=1/0,t){if(e<=0||!$t(n)||n.__v_skip||(t=t||new Map,(t.get(n)||0)>=e))return n;if(t.set(n,e),e--,hi(n))Nn(n.value,e,t);else if(at(n))for(let i=0;i<n.length;i++)Nn(n[i],e,t);else if(go(n)||za(n))n.forEach(i=>{Nn(i,e,t)});else if(Lv(n)){for(const i in n)Nn(n[i],e,t);for(const i of Object.getOwnPropertySymbols(n))Object.prototype.propertyIsEnumerable.call(n,i)&&Nn(n[i],e,t)}return n}/**
|
||
* @vue/runtime-core v3.5.41
|
||
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
||
* @license MIT
|
||
**/function _l(n,e,t,i){try{return i?n(...i):n()}catch(s){Bh(s,e,t)}}function Vs(n,e,t,i){if(ft(n)){const s=_l(n,e,t,i);return s&&Ov(s)&&s.catch(r=>{Bh(r,e,t)}),s}if(at(n)){const s=[];for(let r=0;r<n.length;r++)s.push(Vs(n[r],e,t,i));return s}}function Bh(n,e,t,i=!0){const s=e?e.vnode:null,{errorHandler:r,throwUnhandledErrorInProduction:a}=e&&e.appContext.config||Gt;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](n,h,l)===!1)return}o=o.parent}if(r){Kn(),_l(r,null,10,[n,h,l]),Zn();return}}TS(n,t,s,i,a)}function TS(n,e,t,i=!0,s=!1){if(s)throw n;console.error(n)}const ji=[];let en=-1;const qa=[];let dr=null,Ba=0;const ay=Promise.resolve();let Dc=null;function Em(n){const e=Dc||ay;return n?e.then(this?n.bind(this):n):e}function MS(n){let e=en+1,t=ji.length;for(;e<t;){const i=e+t>>>1,s=ji[i],r=hl(s);r<n||r===n&&s.flags&2?e=i+1:t=i}return e}function Am(n){if(!(n.flags&1)){const e=hl(n),t=ji[ji.length-1];!t||!(n.flags&2)&&e>=hl(t)?ji.push(n):ji.splice(MS(e),0,n),n.flags|=1,oy()}}function oy(){Dc||(Dc=ay.then(cy))}function ES(n){if(!at(n))dr&&n.id===-1?dr.splice(Ba+1,0,n):n.flags&1||(qa.push(n),n.flags|=1);else for(let e=0;e<n.length;e++)qa.push(n[e]);oy()}function yp(n,e,t=en+1){for(;t<ji.length;t++){const i=ji[t];if(i&&i.flags&2){if(n&&i.id!==n.uid)continue;ji.splice(t,1),t--,i.flags&4&&(i.flags&=-2),i(),i.flags&4||(i.flags&=-2)}}}function ly(n){if(qa.length){const e=[...new Set(qa)].sort((t,i)=>hl(t)-hl(i));if(qa.length=0,dr){for(let t=0;t<e.length;t++)dr.push(e[t]);return}for(dr=e,Ba=0;Ba<dr.length;Ba++){const t=dr[Ba];t.flags&4&&(t.flags&=-2),t.flags&8||t(),t.flags&=-2}dr=null,Ba=0}}const hl=n=>n.id==null?n.flags&2?-1:1/0:n.id;function cy(n){try{for(en=0;en<ji.length;en++){const e=ji[en];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(;en<ji.length;en++){const e=ji[en];e&&(e.flags&=-2)}en=-1,ji.length=0,ly(),Dc=null,(ji.length||qa.length)&&cy()}}let Vi=null,hy=null;function Nc(n){const e=Vi;return Vi=n,hy=n&&n.type.__scopeId||null,e}function tf(n,e=Vi,t){if(!e||n._n)return n;const i=(...s)=>{i._d&&Ip(-1);const r=Nc(e),a=zn.length;let o;try{o=n(...s)}finally{for(let h=zn.length;h>a;h--)Fm();Nc(r),i._d&&Ip(1)}return o};return i._n=!0,i._c=!0,i._d=!0,i}function _e(n,e){if(Vi===null)return n;const t=Xh(Vi),i=n.dirs||(n.dirs=[]);for(let s=0;s<e.length;s++){let[r,a,o,h=Gt]=e[s];r&&(ft(r)&&(r={mounted:r,updated:r}),r.deep&&Nn(a),i.push({dir:r,instance:t,value:a,oldValue:void 0,arg:o,modifiers:h}))}return n}function Nr(n,e,t,i){const s=n.dirs,r=e&&e.dirs;for(let a=0;a<s.length;a++){const o=s[a];r&&(o.oldValue=r[a].value);let h=o.dir[i];h&&(Kn(),Vs(h,t,8,[n.el,o,n,e]),Zn())}}function AS(n,e){if(Wi){let t=Wi.provides;const i=Wi.parent&&Wi.parent.provides;i===t&&(t=Wi.provides=Object.create(i)),t[n]=e}}function Ko(n,e,t=!1){const i=Ly();if(i||ra){let s=ra?ra._context.provides:i?i.parent==null||i.ce?i.vnode.appContext&&i.vnode.appContext.provides:i.parent.provides:void 0;if(s&&n in s)return s[n];if(arguments.length>1)return t&&ft(e)?e.call(i&&i.proxy):e}}function CS(){return!!(Ly()||ra)}const IS=Symbol.for("v-scx"),RS=()=>Ko(IS);function Lo(n,e){return Cm(n,null,e)}function hs(n,e,t){return Cm(n,e,t)}function Cm(n,e,t=Gt){const{immediate:i,deep:s,flush:r,once:a}=t,o=Fi({},t),h=e&&i||!e&&r!=="post";let l;if(fl){if(r==="sync"){const f=RS();l=f.__watcherHandles||(f.__watcherHandles=[])}else if(!h){const f=()=>{};return f.stop=pn,f.resume=pn,f.pause=pn,f}}const c=Wi;o.call=(f,p,m)=>Vs(f,c,p,m);let u=!1;r==="post"?o.scheduler=f=>{Ji(f,c&&c.suspense)}:r!=="sync"&&(u=!0,o.scheduler=(f,p)=>{p?f():Am(f)}),o.augmentJob=f=>{e&&(f.flags|=4),u&&(f.flags|=2,c&&(f.id=c.uid,f.i=c))};const d=_S(n,e,o);return fl&&(l?l.push(d):h&&d()),d}function PS(n,e,t){const i=this.proxy,s=ci(n)?n.includes(".")?uy(i,n):()=>i[n]:n.bind(i,i);let r;ft(e)?r=e:(r=e.handler,t=e);const a=Ml(this),o=Cm(s,r.bind(i),t);return a(),o}function uy(n,e){const t=e.split(".");return()=>{let i=n;for(let s=0;s<t.length&&i;s++)i=i[t[s]];return i}}const kS=Symbol("_vte"),Lh=n=>n.__isTeleport,du=Symbol("_leaveCb");function FS(n){let e=n[0];if(n.length>1){for(const t of n)if(t.type!==xn){e=t;break}}return e}function dy(n){if(!Rm(n))return Lh(n.type)&&n.children?FS(n.children):n;if(n.component)return n.component.subTree;const{shapeFlag:e,children:t}=n;if(t){if(e&16)return t[0];if(e&32&&ft(t.default))return t.default()}}function Im(n,e){if(n.shapeFlag&6&&n.component){n.transition=e;const t=n.component.subTree;Im(Lh(t.type)&&dy(t)||t,e)}else n.shapeFlag&128?(n.ssContent.transition=e.clone(n.ssContent),n.ssFallback.transition=e.clone(n.ssFallback)):n.transition=e}function wn(n,e){return ft(n)?Fi({name:n.name},e,{setup:n}):n}function fy(n){n.ids=[n.ids[0]+n.ids[2]+++"-",0,0]}function xp(n,e){let t;return!!((t=Object.getOwnPropertyDescriptor(n,e))&&!t.configurable)}const Uc=new WeakMap;function Zo(n,e,t,i,s=!1){if(at(n)){n.forEach((m,g)=>Zo(m,e&&(at(e)?e[g]:e),t,i,s));return}if(Ka(i)&&!s){i.shapeFlag&512&&i.type.__asyncResolved&&i.component.subTree.component&&Zo(n,e,t,i.component.subTree);return}const r=i.shapeFlag&4?Xh(i.component):i.el,a=s?null:r,{i:o,r:h}=n,l=e&&e.r,c=o.refs===Gt?o.refs={}:o.refs,u=o.setupState,d=Bt(u),f=u===Gt?Fv:m=>xp(c,m)?!1:Ut(d,m),p=(m,g)=>!(g&&xp(c,g));if(l!=null&&l!==h){if(bp(e),ci(l))c[l]=null,f(l)&&(u[l]=null);else if(hi(l)){const m=e;p(l,m.k)&&(l.value=null),m.k&&(c[m.k]=null)}}if(ft(h))_l(h,o,12,[a,c]);else{const m=ci(h),g=hi(h);if(m||g){const y=()=>{if(n.f){const w=m?f(h)?u[h]:c[h]:p()||!n.k?h.value:c[n.k];if(s)at(w)&&ym(w,r);else if(at(w))w.includes(r)||w.push(r);else if(m)c[h]=[r],f(h)&&(u[h]=c[h]);else{const v=[r];p(h,n.k)&&(h.value=v),n.k&&(c[n.k]=v)}}else m?(c[h]=a,f(h)&&(u[h]=a)):g&&(p(h,n.k)&&(h.value=a),n.k&&(c[n.k]=a))};if(a){const w=()=>{y(),Uc.delete(n)};w.id=-1,Uc.set(n,w),Ji(w,t)}else bp(n),y()}}}function bp(n){const e=Uc.get(n);e&&(e.flags|=8,Uc.delete(n))}kh().requestIdleCallback;kh().cancelIdleCallback;const Ka=n=>!!n.type.__asyncLoader,Rm=n=>n.type.__isKeepAlive;function OS(n,e){my(n,"a",e)}function BS(n,e){my(n,"da",e)}function my(n,e,t=Wi){const i=n.__wdc||(n.__wdc=()=>{let s=t;for(;s;){if(s.isDeactivated)return;s=s.parent}return n()});if(Dh(e,i,t),t){let s=t.parent;for(;s&&s.parent;)Rm(s.parent.vnode)&&LS(i,e,t,s),s=s.parent}}function LS(n,e,t,i){const s=Dh(e,n,i,!0);Tl(()=>{ym(i[e],s)},t)}function Dh(n,e,t=Wi,i=!1){if(t){const s=t[n]||(t[n]=[]),r=e.__weh||(e.__weh=(...a)=>{Kn();const o=Ml(t),h=Vs(e,t,n,a);return o(),Zn(),h});return i?s.unshift(r):s.push(r),r}}const sr=n=>(e,t=Wi)=>{(!fl||n==="sp")&&Dh(n,(...i)=>e(...i),t)},DS=sr("bm"),xo=sr("m"),NS=sr("bu"),US=sr("u"),py=sr("bum"),Tl=sr("um"),XS=sr("sp"),YS=sr("rtg"),VS=sr("rtc");function $S(n,e=Wi){Dh("ec",n,e)}const GS=Symbol.for("v-ndc");function ri(n,e,t,i){let s;const r=t,a=at(n);if(a||ci(n)){const o=a&&Wn(n);let h=!1,l=!1;o&&(h=!cs(n),l=Jn(n),n=Fh(n)),s=new Array(n.length);for(let c=0,u=n.length;c<u;c++)s[c]=e(h?l?ao(Ys(n[c])):Ys(n[c]):n[c],c,void 0,r)}else if(typeof n=="number"){s=new Array(n);for(let o=0;o<n;o++)s[o]=e(o+1,o,void 0,r)}else if($t(n))if(n[Symbol.iterator])s=Array.from(n,(o,h)=>e(o,h,void 0,r));else{const o=Object.keys(n);s=new Array(o.length);for(let h=0,l=o.length;h<l;h++){const c=o[h];s[h]=e(n[c],c,h,r)}}else s=[];return s}function HS(n,e,t,i,s,r){if(t==null&&(t={}),Vi.ce||Vi.parent&&Ka(Vi.parent)&&Vi.parent.ce){const l=t,c=Object.keys(l).length>0;return ne(),Nt(Je,null,[Ye("slot",l,i)],c?-2:64)}let a=n[e];a&&a._c&&(a._d=!1);const o=zn.length;ne();let h;try{const l=a&&gy(a(t)),c=t.key||r||l&&l.key;h=Nt(Je,{key:(c&&!us(c)?c:`_${e}`)+(!l&&i?"_fb":"")},l||(i?i():[]),l&&n._===1?64:-2)}catch(l){for(let c=zn.length;c>o;c--)Fm();throw l}finally{a&&a._c&&(a._d=!0)}return h}function gy(n){return n.some(e=>Om(e)?!(e.type===xn||e.type===Je&&!gy(e.children)):!0)?n:null}const sf=n=>n?Dy(n)?Xh(n):sf(n.parent):null,Jo=Fi(Object.create(null),{$:n=>n,$el:n=>n.vnode.el,$data:n=>n.data,$props:n=>n.props,$attrs:n=>n.attrs,$slots:n=>n.slots,$refs:n=>n.refs,$parent:n=>sf(n.parent),$root:n=>sf(n.root),$host:n=>n.ce,$emit:n=>n.emit,$options:n=>yy(n),$forceUpdate:n=>n.f||(n.f=()=>{Am(n.update)}),$nextTick:n=>n.n||(n.n=Em.bind(n.proxy)),$watch:n=>PS.bind(n)}),fu=(n,e)=>n!==Gt&&!n.__isScriptSetup&&Ut(n,e),jS={get({_:n},e){if(e==="__v_skip")return!0;const{ctx:t,setupState:i,data:s,props:r,accessCache:a,type:o,appContext:h}=n;if(e[0]!=="$"){const d=a[e];if(d!==void 0)switch(d){case 1:return i[e];case 2:return s[e];case 4:return t[e];case 3:return r[e]}else{if(fu(i,e))return a[e]=1,i[e];if(s!==Gt&&Ut(s,e))return a[e]=2,s[e];if(Ut(r,e))return a[e]=3,r[e];if(t!==Gt&&Ut(t,e))return a[e]=4,t[e];nf&&(a[e]=0)}}const l=Jo[e];let c,u;if(l)return e==="$attrs"&&Xi(n.attrs,"get",""),l(n);if((c=o.__cssModules)&&(c=c[e]))return c;if(t!==Gt&&Ut(t,e))return a[e]=4,t[e];if(u=h.config.globalProperties,Ut(u,e))return u[e]},set({_:n},e,t){const{data:i,setupState:s,ctx:r}=n;return fu(s,e)?(s[e]=t,!0):i!==Gt&&Ut(i,e)?(i[e]=t,!0):Ut(n.props,e)||e[0]==="$"&&e.slice(1)in n?!1:(r[e]=t,!0)},has({_:{data:n,setupState:e,accessCache:t,ctx:i,appContext:s,props:r,type:a}},o){let h;return!!(t[o]||n!==Gt&&o[0]!=="$"&&Ut(n,o)||fu(e,o)||Ut(r,o)||Ut(i,o)||Ut(Jo,o)||Ut(s.config.globalProperties,o)||(h=a.__cssModules)&&h[o])},defineProperty(n,e,t){return t.get!=null?n._.accessCache[e]=0:Ut(t,"value")&&this.set(n,e,t.value,null),Reflect.defineProperty(n,e,t)}};function wp(n){return at(n)?n.reduce((e,t)=>(e[t]=null,e),{}):n}let nf=!0;function WS(n){const e=yy(n),t=n.proxy,i=n.ctx;nf=!1,e.beforeCreate&&Sp(e.beforeCreate,n,"bc");const{data:s,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:y,beforeUnmount:w,destroyed:v,unmounted:_,render:x,renderTracked:M,renderTriggered:T,errorCaptured:C,serverPrefetch:I,expose:k,inheritAttrs:R,components:F,directives:B,filters:L}=e;if(l&&zS(l,i,null),a)for(const D in a){const P=a[D];ft(P)&&(i[D]=P.bind(t))}if(s){const D=s.call(t,t);$t(D)&&(n.data=yo(D))}if(nf=!0,r)for(const D in r){const P=r[D],U=ft(P)?P.bind(t,t):ft(P.get)?P.get.bind(t,t):pn,N=!ft(P)&&ft(P.set)?P.set.bind(t):pn,X=yt({get:U,set:N});Object.defineProperty(i,D,{enumerable:!0,configurable:!0,get:()=>X.value,set:K=>X.value=K})}if(o)for(const D in o)vy(o[D],i,t,D);if(h){const D=ft(h)?h.call(t):h;Reflect.ownKeys(D).forEach(P=>{AS(P,D[P])})}c&&Sp(c,n,"c");function O(D,P){at(P)?P.forEach(U=>D(U.bind(t))):P&&D(P.bind(t))}if(O(DS,u),O(xo,d),O(NS,f),O(US,p),O(OS,m),O(BS,g),O($S,C),O(VS,M),O(YS,T),O(py,w),O(Tl,_),O(XS,I),at(k))if(k.length){const D=n.exposed||(n.exposed={});k.forEach(P=>{Object.defineProperty(D,P,{get:()=>t[P],set:U=>t[P]=U,enumerable:!0})})}else n.exposed||(n.exposed={});x&&n.render===pn&&(n.render=x),R!=null&&(n.inheritAttrs=R),F&&(n.components=F),B&&(n.directives=B),I&&fy(n)}function zS(n,e,t=pn){at(n)&&(n=rf(n));for(const i in n){const s=n[i];let r;$t(s)?"default"in s?r=Ko(s.from||i,s.default,!0):r=Ko(s.from||i):r=Ko(s),hi(r)?Object.defineProperty(e,i,{enumerable:!0,configurable:!0,get:()=>r.value,set:a=>r.value=a}):e[i]=r}}function Sp(n,e,t){Vs(at(n)?n.map(i=>i.bind(e.proxy)):n.bind(e.proxy),e,t)}function vy(n,e,t,i){let s=i.includes(".")?uy(t,i):()=>t[i];if(ci(n)){const r=e[n];ft(r)&&hs(s,r)}else if(ft(n))hs(s,n.bind(t));else if($t(n))if(at(n))n.forEach(r=>vy(r,e,t,i));else{const r=ft(n.handler)?n.handler.bind(t):e[n.handler];ft(r)&&hs(s,r,n)}}function yy(n){const e=n.type,{mixins:t,extends:i}=e,{mixins:s,optionsCache:r,config:{optionMergeStrategies:a}}=n.appContext,o=r.get(e);let h;return o?h=o:!s.length&&!t&&!i?h=e:(h={},s.length&&s.forEach(l=>Xc(h,l,a,!0)),Xc(h,e,a)),$t(e)&&r.set(e,h),h}function Xc(n,e,t,i=!1){const{mixins:s,extends:r}=e;r&&Xc(n,r,t,!0),s&&s.forEach(a=>Xc(n,a,t,!0));for(const a in e)if(!(i&&a==="expose")){const o=qS[a]||t&&t[a];n[a]=o?o(n[a],e[a]):e[a]}return n}const qS={data:_p,props:Tp,emits:Tp,methods:Do,computed:Do,beforeCreate:Gi,created:Gi,beforeMount:Gi,mounted:Gi,beforeUpdate:Gi,updated:Gi,beforeDestroy:Gi,beforeUnmount:Gi,destroyed:Gi,unmounted:Gi,activated:Gi,deactivated:Gi,errorCaptured:Gi,serverPrefetch:Gi,components:Do,directives:Do,watch:ZS,provide:_p,inject:KS};function _p(n,e){return e?n?function(){return Fi(ft(n)?n.call(this,this):n,ft(e)?e.call(this,this):e)}:e:n}function KS(n,e){return Do(rf(n),rf(e))}function rf(n){if(at(n)){const e={};for(let t=0;t<n.length;t++)e[n[t]]=n[t];return e}return n}function Gi(n,e){return n?[...new Set([].concat(n,e))]:e}function Do(n,e){return n?Fi(Object.create(null),n,e):e}function Tp(n,e){return n?at(n)&&at(e)?[...new Set([...n,...e])]:Fi(Object.create(null),wp(n),wp(e??{})):e}function ZS(n,e){if(!n)return e;if(!e)return n;const t=Fi(Object.create(null),n);for(const i in e)t[i]=Gi(n[i],e[i]);return t}function xy(){return{app:null,config:{isNativeTag:Fv,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 JS=0;function QS(n,e){return function(i,s=null){ft(i)||(i=Fi({},i)),s!=null&&!$t(s)&&(s=null);const r=xy(),a=new WeakSet,o=[];let h=!1;const l=r.app={_uid:JS++,_component:i,_props:s,_container:null,_context:r,_instance:null,version:I_,get config(){return r.config},set config(c){},use(c,...u){return a.has(c)||(c&&ft(c.install)?(a.add(c),c.install(l,...u)):ft(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||Ye(i,s);return f.appContext=r,d===!0?d="svg":d===!1&&(d=void 0),n(f,c,d),h=!0,l._container=c,c.__vue_app__=l,Xh(f.component)}},onUnmount(c){o.push(c)},unmount(){h&&(Vs(o,l._instance,16),n(null,l._container),delete l._container.__vue_app__)},provide(c,u){return r.provides[c]=u,l},runWithContext(c){const u=ra;ra=l;try{return c()}finally{ra=u}}};return l}}let ra=null;const e_=(n,e)=>e==="modelValue"||e==="model-value"?n.modelModifiers:n[`${e}Modifiers`]||n[`${Bs(e)}Modifiers`]||n[`${kr(e)}Modifiers`];function t_(n,e,...t){if(n.isUnmounted)return;const i=n.vnode.props||Gt;let s=t;const r=e.startsWith("update:"),a=r&&e_(i,e.slice(7));a&&(a.trim&&(s=t.map(c=>ci(c)?c.trim():c)),a.number&&(s=t.map(Ph)));let o,h=i[o=ou(e)]||i[o=ou(Bs(e))];!h&&r&&(h=i[o=ou(kr(e))]),h&&Vs(h,n,6,s);const l=i[o+"Once"];if(l){if(!n.emitted)n.emitted={};else if(n.emitted[o])return;n.emitted[o]=!0,Vs(l,n,6,s)}}const i_=new WeakMap;function by(n,e,t=!1){const i=t?i_:e.emitsCache,s=i.get(n);if(s!==void 0)return s;const r=n.emits;let a={},o=!1;if(!ft(n)){const h=l=>{const c=by(l,e,!0);c&&(o=!0,Fi(a,c))};!t&&e.mixins.length&&e.mixins.forEach(h),n.extends&&h(n.extends),n.mixins&&n.mixins.forEach(h)}return!r&&!o?($t(n)&&i.set(n,null),null):(at(r)?r.forEach(h=>a[h]=null):Fi(a,r),$t(n)&&i.set(n,a),a)}function Nh(n,e){return!n||!Ah(e)?!1:(e=e.slice(2),e=e==="Once"?e:e.replace(/Once$/,""),Ut(n,e[0].toLowerCase()+e.slice(1))||Ut(n,kr(e))||Ut(n,e))}function Mp(n){const{type:e,vnode:t,proxy:i,withProxy:s,propsOptions:[r],slots:a,attrs:o,emit:h,render:l,renderCache:c,props:u,data:d,setupState:f,ctx:p,inheritAttrs:m}=n,g=Nc(n);let y,w;try{if(t.shapeFlag&4){const _=s||i,x=_;y=ln(l.call(x,_,c,u,f,d,p)),w=o}else{const _=e;y=ln(_.length>1?_(u,{attrs:o,slots:a,emit:h}):_(u,null)),w=e.props?o:s_(o)}}catch(_){zn.length=0,Bh(_,n,1),y=Ye(xn)}let v=y;if(w&&m!==!1){const _=Object.keys(w),{shapeFlag:x}=v;_.length&&x&7&&(r&&_.some(Ch)&&(w=n_(w,r)),v=oo(v,w,!1,!0))}if(t.dirs&&(v=oo(v,null,!1,!0),v.dirs=v.dirs?v.dirs.concat(t.dirs):t.dirs),t.transition){const _=Lh(v.type)&&dy(v)||v;Im(_,t.transition)}return y=v,Nc(g),y}const s_=n=>{let e;for(const t in n)(t==="class"||t==="style"||Ah(t))&&((e||(e={}))[t]=n[t]);return e},n_=(n,e)=>{const t={};for(const i in n)(!Ch(i)||!(i.slice(9)in e))&&(t[i]=n[i]);return t};function r_(n,e,t){const{props:i,children:s,component:r}=n,{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?Ep(i,a,l):!!a;if(h&8){const c=e.dynamicProps;for(let u=0;u<c.length;u++){const d=c[u];if(wy(a,i,d)&&!Nh(l,d))return!0}}}else return(s||o)&&(!o||!o.$stable)?!0:i===a?!1:i?a?Ep(i,a,l):!0:!!a;return!1}function Ep(n,e,t){const i=Object.keys(e);if(i.length!==Object.keys(n).length)return!0;for(let s=0;s<i.length;s++){const r=i[s];if(wy(e,n,r)&&!Nh(t,r))return!0}return!1}function wy(n,e,t){const i=n[t],s=e[t];return t==="style"&&$t(i)&&$t(s)?!vo(i,s):i!==s}function a_({vnode:n,parent:e,suspense:t},i){for(;e;){const s=e.subTree;if(s.suspense&&s.suspense.activeBranch===n&&(s.suspense.vnode.el=s.el=i,n=s),s===n)(n=e.vnode).el=i,e=e.parent;else break}t&&t.activeBranch===n&&(t.vnode.el=i)}const Sy={},_y=()=>Object.create(Sy),Ty=n=>Object.getPrototypeOf(n)===Sy;function o_(n,e,t,i=!1){const s={},r=_y();n.propsDefaults=Object.create(null),My(n,e,s,r);for(const a in n.propsOptions[0])a in s||(s[a]=void 0);t?n.props=i?s:fS(s):n.type.props?n.props=s:n.props=r,n.attrs=r}function l_(n,e,t,i){const{props:s,attrs:r,vnode:{patchFlag:a}}=n,o=Bt(s),[h]=n.propsOptions;let l=!1;if((i||a>0)&&!(a&16)){if(a&8){const c=n.vnode.dynamicProps;for(let u=0;u<c.length;u++){let d=c[u];if(Nh(n.emitsOptions,d))continue;const f=e[d];if(h)if(Ut(r,d))f!==r[d]&&(r[d]=f,l=!0);else{const p=Bs(d);s[p]=af(h,o,p,f,n,!1)}else f!==r[d]&&(r[d]=f,l=!0)}}}else{My(n,e,s,r)&&(l=!0);let c;for(const u in o)(!e||!Ut(e,u)&&((c=kr(u))===u||!Ut(e,c)))&&(h?t&&(t[u]!==void 0||t[c]!==void 0)&&(s[u]=af(h,o,u,void 0,n,!0)):delete s[u]);if(r!==o)for(const u in r)(!e||!Ut(e,u))&&(delete r[u],l=!0)}l&&Dn(n.attrs,"set","")}function My(n,e,t,i){const[s,r]=n.propsOptions;let a=!1,o;if(e)for(let h in e){if(Wo(h))continue;const l=e[h];let c;s&&Ut(s,c=Bs(h))?!r||!r.includes(c)?t[c]=l:(o||(o={}))[c]=l:Nh(n.emitsOptions,h)||(!(h in i)||l!==i[h])&&(i[h]=l,a=!0)}if(r){const h=Bt(t),l=o||Gt;for(let c=0;c<r.length;c++){const u=r[c];t[u]=af(s,h,u,l[u],n,!Ut(l,u))}}return a}function af(n,e,t,i,s,r){const a=n[t];if(a!=null){const o=Ut(a,"default");if(o&&i===void 0){const h=a.default;if(a.type!==Function&&!a.skipFactory&&ft(h)){const{propsDefaults:l}=s;if(t in l)i=l[t];else{const c=Ml(s);i=l[t]=h.call(null,e),c()}}else i=h;s.ce&&s.ce._setProp(t,i)}a[0]&&(r&&!o?i=!1:a[1]&&(i===""||i===kr(t))&&(i=!0))}return i}const c_=new WeakMap;function Ey(n,e,t=!1){const i=t?c_:e.propsCache,s=i.get(n);if(s)return s;const r=n.props,a={},o=[];let h=!1;if(!ft(n)){const c=u=>{h=!0;const[d,f]=Ey(u,e,!0);Fi(a,d),f&&o.push(...f)};!t&&e.mixins.length&&e.mixins.forEach(c),n.extends&&c(n.extends),n.mixins&&n.mixins.forEach(c)}if(!r&&!h)return $t(n)&&i.set(n,Wa),Wa;if(at(r))for(let c=0;c<r.length;c++){const u=Bs(r[c]);Ap(u)&&(a[u]=Gt)}else if(r)for(const c in r){const u=Bs(c);if(Ap(u)){const d=r[c],f=a[u]=at(d)||ft(d)?{type:d}:Fi({},d),p=f.type;let m=!1,g=!0;if(at(p))for(let y=0;y<p.length;++y){const w=p[y],v=ft(w)&&w.name;if(v==="Boolean"){m=!0;break}else v==="String"&&(g=!1)}else m=ft(p)&&p.name==="Boolean";f[0]=m,f[1]=g,(m||Ut(f,"default"))&&o.push(u)}}const l=[a,o];return $t(n)&&i.set(n,l),l}function Ap(n){return n[0]!=="$"&&!Wo(n)}const Pm=n=>n==="_"||n==="_ctx"||n==="$stable",km=n=>at(n)?n.map(ln):[ln(n)],h_=(n,e,t)=>{if(e._n)return e;const i=tf((...s)=>km(e(...s)),t);return i._c=!1,i},Ay=(n,e,t)=>{const i=n._ctx;for(const s in n){if(Pm(s))continue;const r=n[s];if(ft(r))e[s]=h_(s,r,i);else if(r!=null){const a=km(r);e[s]=()=>a}}},Cy=(n,e)=>{const t=km(e);n.slots.default=()=>t},Iy=(n,e,t)=>{for(const i in e)(t||!Pm(i))&&(n[i]=e[i])},u_=(n,e,t)=>{const i=n.slots=_y();if(n.vnode.shapeFlag&32){const s=e._;s?(Iy(i,e,t),t&&Nv(i,"_",s,!0)):Ay(e,i)}else e&&Cy(n,e)},d_=(n,e,t)=>{const{vnode:i,slots:s}=n;let r=!0,a=Gt;if(i.shapeFlag&32){const o=e._;o?t&&o===1?r=!1:Iy(s,e,t):(r=!e.$stable,Ay(e,s)),a=e}else e&&(Cy(n,e),a={default:1});if(r)for(const o in s)!Pm(o)&&a[o]==null&&delete s[o]},Ji=v_;function f_(n){return m_(n)}function m_(n,e){const t=kh();t.__VUE__=!0;const{insert:i,remove:s,patchProp:r,createElement:a,createText:o,createComment:h,setText:l,setElementText:c,parentNode:u,nextSibling:d,setScopeId:f=pn,insertStaticContent:p}=n,m=(H,Z,q,W=null,ee=null,ce=null,xe=void 0,oe=null,Se=!!Z.dynamicChildren)=>{if(H===Z)return;H&&!Co(H,Z)&&(W=pe(H),K(H,ee,ce,!0),H=null),Z.patchFlag===-2&&(Se=!1,Z.dynamicChildren=null);const{type:ue,ref:ke,shapeFlag:Re}=Z;switch(ue){case Uh:g(H,Z,q,W);break;case xn:y(H,Z,q,W);break;case xc:H==null&&w(Z,q,W,xe);break;case Je:F(H,Z,q,W,ee,ce,xe,oe,Se);break;default:Re&1?x(H,Z,q,W,ee,ce,xe,oe,Se):Re&6?B(H,Z,q,W,ee,ce,xe,oe,Se):(Re&64||Re&128)&&ue.process(H,Z,q,W,ee,ce,xe,oe,Se,ge)}ke!=null&&ee?Zo(ke,H&&H.ref,ce,Z||H,!Z):ke==null&&H&&H.ref!=null&&Zo(H.ref,null,ce,H,!0)},g=(H,Z,q,W)=>{if(H==null)i(Z.el=o(Z.children),q,W);else{const ee=Z.el=H.el;Z.children!==H.children&&l(ee,Z.children)}},y=(H,Z,q,W)=>{H==null?i(Z.el=h(Z.children||""),q,W):Z.el=H.el},w=(H,Z,q,W)=>{[H.el,H.anchor]=p(H.children,Z,q,W,H.el,H.anchor)},v=({el:H,anchor:Z},q,W)=>{let ee;for(;H&&H!==Z;)ee=d(H),i(H,q,W),H=ee;i(Z,q,W)},_=({el:H,anchor:Z})=>{let q;for(;H&&H!==Z;)q=d(H),s(H),H=q;s(Z)},x=(H,Z,q,W,ee,ce,xe,oe,Se)=>{if(Z.type==="svg"?xe="svg":Z.type==="math"&&(xe="mathml"),H==null)M(Z,q,W,ee,ce,xe,oe,Se);else{const ue=H.el&&H.el._isVueCE?H.el:null;try{ue&&ue._beginPatch(),I(H,Z,ee,ce,xe,oe,Se)}finally{ue&&ue._endPatch()}}},M=(H,Z,q,W,ee,ce,xe,oe)=>{let Se,ue;const{props:ke,shapeFlag:Re,transition:Fe,dirs:Ze}=H;if(Se=H.el=a(H.type,ce,ke&&ke.is,ke),Re&8?c(Se,H.children):Re&16&&C(H.children,Se,null,W,ee,mu(H,ce),xe,oe),Ze&&Nr(H,null,W,"created"),T(Se,H,H.scopeId,xe,W),ke){for(const wt in ke)wt!=="value"&&!Wo(wt)&&r(Se,wt,null,ke[wt],ce,W);"value"in ke&&r(Se,"value",null,ke.value,ce),(ue=ke.onVnodeBeforeMount)&&Ws(ue,W,H)}Ze&&Nr(H,null,W,"beforeMount");const mt=p_(ee,Fe);mt&&Fe.beforeEnter(Se),i(Se,Z,q),((ue=ke&&ke.onVnodeMounted)||mt||Ze)&&Ji(()=>{try{ue&&Ws(ue,W,H),mt&&Fe.enter(Se),Ze&&Nr(H,null,W,"mounted")}finally{}},ee)},T=(H,Z,q,W,ee)=>{if(q&&f(H,q),W)for(let ce=0;ce<W.length;ce++)f(H,W[ce]);if(ee){let ce=ee.subTree;if(Z===ce||Fy(ce.type)&&(ce.ssContent===Z||ce.ssFallback===Z)){const xe=ee.vnode;T(H,xe,xe.scopeId,xe.slotScopeIds,ee.parent)}}},C=(H,Z,q,W,ee,ce,xe,oe,Se=0)=>{for(let ue=Se;ue<H.length;ue++){const ke=H[ue]=oe?Ln(H[ue]):ln(H[ue]);m(null,ke,Z,q,W,ee,ce,xe,oe)}},I=(H,Z,q,W,ee,ce,xe)=>{const oe=Z.el=H.el;let{patchFlag:Se,dynamicChildren:ue,dirs:ke}=Z;Se|=H.patchFlag&16;const Re=H.props||Gt,Fe=Z.props||Gt;let Ze;if(q&&Ur(q,!1),(Ze=Fe.onVnodeBeforeUpdate)&&Ws(Ze,q,Z,H),ke&&Nr(Z,H,q,"beforeUpdate"),q&&Ur(q,!0),ue&&(!H.dynamicChildren||H.dynamicChildren.length!==ue.length)&&(Se=0,xe=!1,ue=null),(Re.innerHTML&&Fe.innerHTML==null||Re.textContent&&Fe.textContent==null)&&c(oe,""),ue?k(H.dynamicChildren,ue,oe,q,W,mu(Z,ee),ce):xe||P(H,Z,oe,null,q,W,mu(Z,ee),ce,!1),Se>0){if(Se&16)R(oe,Re,Fe,q,ee);else if(Se&2&&Re.class!==Fe.class&&r(oe,"class",null,Fe.class,ee),Se&4&&r(oe,"style",Re.style,Fe.style,ee),Se&8){const mt=Z.dynamicProps;for(let wt=0;wt<mt.length;wt++){const ht=mt[wt],St=Re[ht],Xt=Fe[ht];(Xt!==St||ht==="value")&&r(oe,ht,St,Xt,ee,q)}}Se&1&&H.children!==Z.children&&c(oe,Z.children)}else!xe&&ue==null&&R(oe,Re,Fe,q,ee);((Ze=Fe.onVnodeUpdated)||ke)&&Ji(()=>{Ze&&Ws(Ze,q,Z,H),ke&&Nr(Z,H,q,"updated")},W)},k=(H,Z,q,W,ee,ce,xe)=>{for(let oe=0;oe<Z.length;oe++){const Se=H[oe],ue=Z[oe],ke=Se.el&&(Se.type===Je||!Co(Se,ue)||Se.shapeFlag&198)?u(Se.el):q;m(Se,ue,ke,null,W,ee,ce,xe,!0)}},R=(H,Z,q,W,ee)=>{if(Z!==q){if(Z!==Gt)for(const ce in Z)!Wo(ce)&&!(ce in q)&&r(H,ce,Z[ce],null,ee,W);for(const ce in q){if(Wo(ce))continue;const xe=q[ce],oe=Z[ce];xe!==oe&&ce!=="value"&&r(H,ce,oe,xe,ee,W)}"value"in q&&r(H,"value",Z.value,q.value,ee)}},F=(H,Z,q,W,ee,ce,xe,oe,Se)=>{const ue=Z.el=H?H.el:o(""),ke=Z.anchor=H?H.anchor:o("");let{patchFlag:Re,dynamicChildren:Fe,slotScopeIds:Ze}=Z;Ze&&(oe=oe?oe.concat(Ze):Ze),H==null?(i(ue,q,W),i(ke,q,W),C(Z.children||[],q,ke,ee,ce,xe,oe,Se)):Re>0&&Re&64&&Fe&&H.dynamicChildren&&H.dynamicChildren.length===Fe.length?(k(H.dynamicChildren,Fe,q,ee,ce,xe,oe),(Z.key!=null||ee&&Z===ee.subTree)&&Ry(H,Z,!0)):P(H,Z,q,ke,ee,ce,xe,oe,Se)},B=(H,Z,q,W,ee,ce,xe,oe,Se)=>{Z.slotScopeIds=oe,H==null?Z.shapeFlag&512?ee.ctx.activate(Z,q,W,xe,Se):L(Z,q,W,ee,ce,xe,Se):Y(H,Z,Se)},L=(H,Z,q,W,ee,ce,xe)=>{const oe=H.component=__(H,W,ee);if(Rm(H)&&(oe.ctx.renderer=ge),T_(oe,!1,xe),oe.asyncDep){if(ee&&ee.registerDep(oe,O,xe),!H.el){const Se=oe.subTree=Ye(xn);y(null,Se,Z,q),H.placeholder=Se.el}}else O(oe,H,Z,q,ee,ce,xe)},Y=(H,Z,q)=>{const W=Z.component=H.component;if(r_(H,Z,q))if(W.asyncDep&&!W.asyncResolved){D(W,Z,q);return}else W.next=Z,W.update();else Z.el=H.el,W.vnode=Z},O=(H,Z,q,W,ee,ce,xe)=>{const oe=()=>{if(H.isMounted){let{next:Re,bu:Fe,u:Ze,parent:mt,vnode:wt}=H;{const pi=Py(H);if(pi){Re&&(Re.el=wt.el,D(H,Re,xe)),pi.asyncDep.then(()=>{Ji(()=>{H.isUnmounted||ue()},ee)});return}}let ht=Re,St;Ur(H,!1),Re?(Re.el=wt.el,D(H,Re,xe)):Re=wt,Fe&&yc(Fe),(St=Re.props&&Re.props.onVnodeBeforeUpdate)&&Ws(St,mt,Re,wt),Ur(H,!0);const Xt=Mp(H),Ti=H.subTree;H.subTree=Xt,m(Ti,Xt,u(Ti.el),pe(Ti),H,ee,ce),Re.el=Xt.el,ht===null&&a_(H,Xt.el),Ze&&Ji(Ze,ee),(St=Re.props&&Re.props.onVnodeUpdated)&&Ji(()=>Ws(St,mt,Re,wt),ee)}else{let Re;const{el:Fe,props:Ze}=Z,{bm:mt,m:wt,parent:ht,root:St,type:Xt}=H,Ti=Ka(Z);Ur(H,!1),mt&&yc(mt),!Ti&&(Re=Ze&&Ze.onVnodeBeforeMount)&&Ws(Re,ht,Z),Ur(H,!0);{St.ce&&St.ce._hasShadowRoot()&&St.ce._injectChildStyle(Xt,H.parent?H.parent.type:void 0);const pi=H.subTree=Mp(H);m(null,pi,q,W,H,ee,ce),Z.el=pi.el}if(wt&&Ji(wt,ee),!Ti&&(Re=Ze&&Ze.onVnodeMounted)){const pi=Z;Ji(()=>Ws(Re,ht,pi),ee)}(Z.shapeFlag&256||ht&&Ka(ht.vnode)&&ht.vnode.shapeFlag&256)&&H.a&&Ji(H.a,ee),H.isMounted=!0,Z=q=W=null}};H.scope.on();const Se=H.effect=new Hv(oe);H.scope.off();const ue=H.update=Se.run.bind(Se),ke=H.job=Se.runIfDirty.bind(Se);ke.i=H,ke.id=H.uid,Se.scheduler=()=>Am(ke),Ur(H,!0),ue()},D=(H,Z,q)=>{Z.component=H;const W=H.vnode.props;H.vnode=Z,H.next=null,l_(H,Z.props,W,q),d_(H,Z.children,q),Kn(),yp(H),Zn()},P=(H,Z,q,W,ee,ce,xe,oe,Se=!1)=>{const ue=H&&H.children,ke=H?H.shapeFlag:0,Re=Z.children,{patchFlag:Fe,shapeFlag:Ze}=Z;if(Fe>0){if(Fe&128){N(ue,Re,q,W,ee,ce,xe,oe,Se);return}else if(Fe&256){U(ue,Re,q,W,ee,ce,xe,oe,Se);return}}Ze&8?(ke&16&&me(ue,ee,ce),Re!==ue&&c(q,Re)):ke&16?Ze&16?N(ue,Re,q,W,ee,ce,xe,oe,Se):me(ue,ee,ce,!0):(ke&8&&c(q,""),Ze&16&&C(Re,q,W,ee,ce,xe,oe,Se))},U=(H,Z,q,W,ee,ce,xe,oe,Se)=>{H=H||Wa,Z=Z||Wa;const ue=H.length,ke=Z.length,Re=Math.min(ue,ke);let Fe;for(Fe=0;Fe<Re;Fe++){const Ze=Z[Fe]=Se?Ln(Z[Fe]):ln(Z[Fe]);m(H[Fe],Ze,q,null,ee,ce,xe,oe,Se)}ue>ke?me(H,ee,ce,!0,!1,Re):C(Z,q,W,ee,ce,xe,oe,Se,Re)},N=(H,Z,q,W,ee,ce,xe,oe,Se)=>{let ue=0;const ke=Z.length;let Re=H.length-1,Fe=ke-1;for(;ue<=Re&&ue<=Fe;){const Ze=H[ue],mt=Z[ue]=Se?Ln(Z[ue]):ln(Z[ue]);if(Co(Ze,mt))m(Ze,mt,q,null,ee,ce,xe,oe,Se);else break;ue++}for(;ue<=Re&&ue<=Fe;){const Ze=H[Re],mt=Z[Fe]=Se?Ln(Z[Fe]):ln(Z[Fe]);if(Co(Ze,mt))m(Ze,mt,q,null,ee,ce,xe,oe,Se);else break;Re--,Fe--}if(ue>Re){if(ue<=Fe){const Ze=Fe+1,mt=Ze<ke?Z[Ze].el:W;for(;ue<=Fe;)m(null,Z[ue]=Se?Ln(Z[ue]):ln(Z[ue]),q,mt,ee,ce,xe,oe,Se),ue++}}else if(ue>Fe)for(;ue<=Re;)K(H[ue],ee,ce,!0),ue++;else{const Ze=ue,mt=ue,wt=new Map;for(ue=mt;ue<=Fe;ue++){const Qt=Z[ue]=Se?Ln(Z[ue]):ln(Z[ue]);Qt.key!=null&&wt.set(Qt.key,ue)}let ht,St=0;const Xt=Fe-mt+1;let Ti=!1,pi=0;const Bi=new Array(Xt);for(ue=0;ue<Xt;ue++)Bi[ue]=0;for(ue=Ze;ue<=Re;ue++){const Qt=H[ue];if(St>=Xt){K(Qt,ee,ce,!0);continue}let le;if(Qt.key!=null)le=wt.get(Qt.key);else for(ht=mt;ht<=Fe;ht++)if(Bi[ht-mt]===0&&Co(Qt,Z[ht])){le=ht;break}le===void 0?K(Qt,ee,ce,!0):(Bi[le-mt]=ue+1,le>=pi?pi=le:Ti=!0,m(Qt,Z[le],q,null,ee,ce,xe,oe,Se),St++)}const Ss=Ti?g_(Bi):Wa;for(ht=Ss.length-1,ue=Xt-1;ue>=0;ue--){const Qt=mt+ue,le=Z[Qt],fe=Z[Qt+1],bt=Qt+1<ke?fe.el||ky(fe):W;Bi[ue]===0?m(null,le,q,bt,ee,ce,xe,oe,Se):Ti&&(ht<0||ue!==Ss[ht]?X(le,q,bt,2):ht--)}}},X=(H,Z,q,W,ee=null)=>{const{el:ce,type:xe,transition:oe,children:Se,shapeFlag:ue}=H;if(ue&6){X(H.component.subTree,Z,q,W);return}if(ue&128){H.suspense.move(Z,q,W);return}if(ue&64){xe.move(H,Z,q,ge);return}if(xe===Je){i(ce,Z,q);for(let Re=0;Re<Se.length;Re++)X(Se[Re],Z,q,W);i(H.anchor,Z,q);return}if(xe===xc){v(H,Z,q);return}if(W!==2&&ue&1&&oe)if(W===0)oe.persisted&&!ce[du]?i(ce,Z,q):(oe.beforeEnter(ce),i(ce,Z,q),Ji(()=>oe.enter(ce),ee));else{const{leave:Re,delayLeave:Fe,afterLeave:Ze}=oe,mt=()=>{H.ctx.isUnmounted?s(ce):i(ce,Z,q)},wt=()=>{const ht=ce._isLeaving||!!ce[du];ce._isLeaving&&ce[du](!0),oe.persisted&&!ht?mt():Re(ce,()=>{mt(),Ze&&Ze()})};Fe?Fe(ce,mt,wt):wt()}else i(ce,Z,q)},K=(H,Z,q,W=!1,ee=!1)=>{const{type:ce,props:xe,ref:oe,children:Se,dynamicChildren:ue,shapeFlag:ke,patchFlag:Re,dirs:Fe,cacheIndex:Ze,memo:mt}=H;if(Re===-2&&(ee=!1),oe!=null&&(Kn(),Zo(oe,null,q,H,!0),Zn()),Ze!=null&&(Z.renderCache[Ze]=void 0),ke&256){Z.ctx.deactivate(H);return}const wt=ke&1&&Fe,ht=!Ka(H);let St;if(ht&&(St=xe&&xe.onVnodeBeforeUnmount)&&Ws(St,Z,H),ke&6)Q(H.component,q,W);else{if(ke&128){H.suspense.unmount(q,W);return}wt&&Nr(H,null,Z,"beforeUnmount"),ke&64?H.type.remove(H,Z,q,ge,W):ue&&!ue.hasOnce&&(ce!==Je||Re>0&&Re&64)?me(ue,Z,q,!1,!0):(ce===Je&&Re&384||!ee&&ke&16)&&me(Se,Z,q),W&&z(H)}const Xt=mt!=null&&Ze==null;(ht&&(St=xe&&xe.onVnodeUnmounted)||wt||Xt)&&Ji(()=>{St&&Ws(St,Z,H),wt&&Nr(H,null,Z,"unmounted"),Xt&&(H.el=null)},q)},z=H=>{const{type:Z,el:q,anchor:W,transition:ee}=H;if(Z===Je){se(q,W);return}if(Z===xc){_(H);return}const ce=()=>{s(q),ee&&!ee.persisted&&ee.afterLeave&&ee.afterLeave()};if(H.shapeFlag&1&&ee&&!ee.persisted){const{leave:xe,delayLeave:oe}=ee,Se=()=>xe(q,ce);oe?oe(H.el,ce,Se):Se()}else ce()},se=(H,Z)=>{let q;for(;H!==Z;)q=d(H),s(H),H=q;s(Z)},Q=(H,Z,q)=>{const{bum:W,scope:ee,job:ce,subTree:xe,um:oe,m:Se,a:ue}=H;Cp(Se),Cp(ue),W&&yc(W),ee.stop(),ce&&(ce.flags|=8,K(xe,H,Z,q)),oe&&Ji(oe,Z),Ji(()=>{H.isUnmounted=!0},Z)},me=(H,Z,q,W=!1,ee=!1,ce=0)=>{for(let xe=ce;xe<H.length;xe++)K(H[xe],Z,q,W,ee)},pe=H=>{if(H.shapeFlag&6)return pe(H.component.subTree);if(H.shapeFlag&128)return H.suspense.next();const Z=d(H.anchor||H.el),q=Z&&Z[kS];return q?d(q):Z};let Me=!1;const Ie=(H,Z,q)=>{let W;H==null?Z._vnode&&(K(Z._vnode,null,null,!0),W=Z._vnode.component):m(Z._vnode||null,H,Z,null,null,null,q),Z._vnode=H,Me||(Me=!0,yp(W),ly(),Me=!1)},ge={p:m,um:K,m:X,r:z,mt:L,mc:C,pc:P,pbc:k,n:pe,o:n};return{render:Ie,hydrate:void 0,createApp:QS(Ie)}}function mu({type:n,props:e},t){return t==="svg"&&n==="foreignObject"||t==="mathml"&&n==="annotation-xml"&&e&&e.encoding&&e.encoding.includes("html")?void 0:t}function Ur({effect:n,job:e},t){t?(n.flags|=32,e.flags|=4):(n.flags&=-33,e.flags&=-5)}function p_(n,e){return(!n||n&&!n.pendingBranch)&&e&&!e.persisted}function Ry(n,e,t=!1){const i=n.children,s=e.children;if(at(i)&&at(s))for(let r=0;r<i.length;r++){const a=i[r];let o=s[r];o.shapeFlag&1&&!o.dynamicChildren&&((o.patchFlag<=0||o.patchFlag===32)&&(o=s[r]=Ln(s[r]),o.el=a.el),!t&&o.patchFlag!==-2&&Ry(a,o)),o.type===Uh&&(o.patchFlag===-1&&(o=s[r]=Ln(o)),o.el=a.el),o.type===xn&&!o.el&&(o.el=a.el)}}function g_(n){const e=n.slice(),t=[0];let i,s,r,a,o;const h=n.length;for(i=0;i<h;i++){const l=n[i];if(l!==0){if(s=t[t.length-1],n[s]<l){e[i]=s,t.push(i);continue}for(r=0,a=t.length-1;r<a;)o=r+a>>1,n[t[o]]<l?r=o+1:a=o;l<n[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 Py(n){const e=n.subTree.component;if(e)return e.asyncDep&&!e.asyncResolved?e:Py(e)}function Cp(n){if(n)for(let e=0;e<n.length;e++)n[e].flags|=8}function ky(n){if(n.placeholder)return n.placeholder;const e=n.component;return e?ky(e.subTree):null}const Fy=n=>n.__isSuspense;function v_(n,e){e&&e.pendingBranch?at(n)?e.effects.push(...n):e.effects.push(n):ES(n)}const Je=Symbol.for("v-fgt"),Uh=Symbol.for("v-txt"),xn=Symbol.for("v-cmt"),xc=Symbol.for("v-stc"),zn=[];let ls=null;function ne(n=!1){zn.push(ls=n?null:[])}function Fm(){zn.pop(),ls=zn[zn.length-1]||null}let ul=1;function Ip(n,e=!1){ul+=n,n<0&&ls&&e&&(ls.hasOnce=!0)}function Oy(n){return n.dynamicChildren=ul>0?ls||Wa:null,Fm(),ul>0&&ls&&ls.push(n),n}function de(n,e,t,i,s,r){return Oy(A(n,e,t,i,s,r,!0))}function Nt(n,e,t,i,s){return Oy(Ye(n,e,t,i,s,!0))}function Om(n){return n?n.__v_isVNode===!0:!1}function Co(n,e){return n.type===e.type&&n.key===e.key}const By=({key:n})=>n??null,bc=({ref:n,ref_key:e,ref_for:t})=>(typeof n=="number"&&(n=""+n),n!=null?ci(n)||hi(n)||ft(n)?{i:Vi,r:n,k:e,f:!!t}:n:null);function A(n,e=null,t=null,i=0,s=null,r=n===Je?0:1,a=!1,o=!1){const h={__v_isVNode:!0,__v_skip:!0,type:n,props:e,key:e&&By(e),ref:e&&bc(e),scopeId:hy,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:s,dynamicChildren:null,appContext:null,ctx:Vi};return o?(Yc(h,t),r&128&&n.normalize(h)):t&&(h.shapeFlag|=ci(t)?8:16),ul>0&&!a&&ls&&(h.patchFlag>0||r&6)&&h.patchFlag!==32&&ls.push(h),h}const Ye=y_;function y_(n,e=null,t=null,i=0,s=null,r=!1){if((!n||n===GS)&&(n=xn),Om(n)){const o=oo(n,e,!0);return t&&Yc(o,t),ul>0&&!r&&ls&&(o.shapeFlag&6?ls[ls.indexOf(n)]=o:ls.push(o)),o.patchFlag=-2,o}if(C_(n)&&(n=n.__vccOpts),e){e=x_(e);let{class:o,style:h}=e;o&&!ci(o)&&(e.class=it(o)),$t(h)&&(Oh(h)&&!at(h)&&(h=Fi({},h)),e.style=Ii(h))}const a=ci(n)?1:Fy(n)?128:Lh(n)?64:$t(n)?4:ft(n)?2:0;return A(n,e,t,i,s,a,r,!0)}function x_(n){return n?Oh(n)||Ty(n)?Fi({},n):n:null}function oo(n,e,t=!1,i=!1){const{props:s,ref:r,patchFlag:a,children:o,transition:h}=n,l=e?b_(s||{},e):s,c={__v_isVNode:!0,__v_skip:!0,type:n.type,props:l,key:l&&By(l),ref:e&&e.ref?t&&r?at(r)?r.concat(bc(e)):[r,bc(e)]:bc(e):r,scopeId:n.scopeId,slotScopeIds:n.slotScopeIds,children:o,target:n.target,targetStart:n.targetStart,targetAnchor:n.targetAnchor,staticCount:n.staticCount,shapeFlag:n.shapeFlag,patchFlag:e&&n.type!==Je?a===-1?16:a|16:a,dynamicProps:n.dynamicProps,dynamicChildren:n.dynamicChildren,appContext:n.appContext,dirs:n.dirs,transition:h,component:n.component,suspense:n.suspense,ssContent:n.ssContent&&oo(n.ssContent),ssFallback:n.ssFallback&&oo(n.ssFallback),placeholder:n.placeholder,el:n.el,anchor:n.anchor,ctx:n.ctx,ce:n.ce};return h&&i&&Im(c,h.clone(c)),c}function ei(n=" ",e=0){return Ye(Uh,null,n,e)}function La(n,e){const t=Ye(xc,null,n);return t.staticCount=e,t}function Ve(n="",e=!1){return e?(ne(),Nt(xn,null,n)):Ye(xn,null,n)}function ln(n){return n==null||typeof n=="boolean"?Ye(xn):at(n)?Ye(Je,null,n.slice()):Om(n)?Ln(n):Ye(Uh,null,String(n))}function Ln(n){return n.el===null&&n.patchFlag!==-1||n.memo?n:oo(n)}function Yc(n,e){let t=0;const{shapeFlag:i}=n;if(e==null)e=null;else if(at(e))t=16;else if(typeof e=="object")if(i&65){const s=e.default;s&&(s._c&&(s._d=!1),Yc(n,s()),s._c&&(s._d=!0));return}else{t=32;const s=e._;!s&&!Ty(e)?e._ctx=Vi:s===3&&Vi&&(Vi.slots._===1?e._=1:(e._=2,n.patchFlag|=1024))}else if(ft(e)){if(i&65){Yc(n,{default:e});return}e={default:e,_ctx:Vi},t=32}else e=String(e),i&64?(t=16,e=[ei(e)]):t=8;n.children=e,n.shapeFlag|=t}function b_(...n){const e={};for(let t=0;t<n.length;t++){const i=n[t];for(const s in i)if(s==="class")e.class!==i.class&&(e.class=it([e.class,i.class]));else if(s==="style")e.style=Ii([e.style,i.style]);else if(Ah(s)){const r=e[s],a=i[s];a&&r!==a&&!(at(r)&&r.includes(a))?e[s]=r?[].concat(r,a):a:a==null&&r==null&&!Ch(s)&&(e[s]=a)}else s!==""&&(e[s]=i[s])}return e}function Ws(n,e,t,i=null){Vs(n,e,7,[t,i])}const w_=xy();let S_=0;function __(n,e,t){const i=n.type,s=(e?e.appContext:n.appContext)||w_,r={uid:S_++,vnode:n,type:i,parent:e,appContext:s,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new Vv(!0),render:null,proxy:null,exposed:null,exposeProxy:null,withProxy:null,provides:e?e.provides:Object.create(s.provides),ids:e?e.ids:["",0,0],accessCache:null,renderCache:[],components:null,directives:null,propsOptions:Ey(i,s),emitsOptions:by(i,s),emit:null,emitted:null,propsDefaults:Gt,inheritAttrs:i.inheritAttrs,ctx:Gt,data:Gt,props:Gt,attrs:Gt,slots:Gt,refs:Gt,setupState:Gt,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=t_.bind(null,r),n.ce&&n.ce(r),r}let Wi=null;const Ly=()=>Wi||Vi;let Vc,dl;{const n=kh(),e=(t,i)=>{let s;return(s=n[t])||(s=n[t]=[]),s.push(i),r=>{s.length>1?s.forEach(a=>a(r)):s[0](r)}};Vc=e("__VUE_INSTANCE_SETTERS__",t=>Wi=t),dl=e("__VUE_SSR_SETTERS__",t=>fl=t)}const Ml=n=>{const e=Wi;return Vc(n),n.scope.on(),()=>{n.scope.off(),Vc(e)}},Rp=()=>{Wi&&Wi.scope.off(),Vc(null)};function Dy(n){return n.vnode.shapeFlag&4}let fl=!1;function T_(n,e=!1,t=!1){e&&dl(e);const{props:i,children:s}=n.vnode,r=Dy(n);o_(n,i,r,e),u_(n,s,t||e);const a=r?M_(n,e):void 0;return e&&dl(!1),a}function M_(n,e){const t=n.type;n.accessCache=Object.create(null),n.proxy=new Proxy(n.ctx,jS);const{setup:i}=t;if(i){Kn();const s=n.setupContext=i.length>1?A_(n):null,r=Ml(n),a=_l(i,n,0,[n.props,s]),o=Ov(a);if(Zn(),r(),(o||n.sp)&&!Ka(n)&&fy(n),o){if(a.then(Rp,Rp),e)return a.then(h=>{dl(!0);try{Pp(n,h,e)}finally{dl(!1)}}).catch(h=>{Bh(h,n,0)});n.asyncDep=a}else Pp(n,a)}else Ny(n)}function Pp(n,e,t){ft(e)?n.type.__ssrInlineRender?n.ssrRender=e:n.render=e:$t(e)&&(n.setupState=ry(e)),Ny(n)}function Ny(n,e,t){const i=n.type;n.render||(n.render=i.render||pn);{const s=Ml(n);Kn();try{WS(n)}finally{Zn(),s()}}}const E_={get(n,e){return Xi(n,"get",""),n[e]}};function A_(n){const e=t=>{n.exposed=t||{}};return{attrs:new Proxy(n.attrs,E_),slots:n.slots,emit:n.emit,expose:e}}function Xh(n){return n.exposed?n.exposeProxy||(n.exposeProxy=new Proxy(ry(Sr(n.exposed)),{get(e,t){if(t in e)return e[t];if(t in Jo)return Jo[t](n)},has(e,t){return t in e||t in Jo}})):n.proxy}function C_(n){return ft(n)&&"__vccOpts"in n}const yt=(n,e)=>wS(n,e,fl),I_="3.5.41";/**
|
||
* @vue/runtime-dom v3.5.41
|
||
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
||
* @license MIT
|
||
**/let of;const kp=typeof window<"u"&&window.trustedTypes;if(kp)try{of=kp.createPolicy("vue",{createHTML:n=>n})}catch{}const Uy=of?n=>of.createHTML(n):n=>n,R_="http://www.w3.org/2000/svg",P_="http://www.w3.org/1998/Math/MathML",Pn=typeof document<"u"?document:null,Fp=Pn&&Pn.createElement("template"),k_={insert:(n,e,t)=>{e.insertBefore(n,t||null)},remove:n=>{const e=n.parentNode;e&&e.removeChild(n)},createElement:(n,e,t,i)=>{const s=e==="svg"?Pn.createElementNS(R_,n):e==="mathml"?Pn.createElementNS(P_,n):t?Pn.createElement(n,{is:t}):Pn.createElement(n);return n==="select"&&i&&i.multiple!=null&&s.setAttribute("multiple",i.multiple),s},createText:n=>Pn.createTextNode(n),createComment:n=>Pn.createComment(n),setText:(n,e)=>{n.nodeValue=e},setElementText:(n,e)=>{n.textContent=e},parentNode:n=>n.parentNode,nextSibling:n=>n.nextSibling,querySelector:n=>Pn.querySelector(n),setScopeId(n,e){n.setAttribute(e,"")},insertStaticContent(n,e,t,i,s,r){const a=t?t.previousSibling:e.lastChild;if(s&&(s===r||s.nextSibling))for(;e.insertBefore(s.cloneNode(!0),t),!(s===r||!(s=s.nextSibling)););else{Fp.innerHTML=Uy(i==="svg"?`<svg>${n}</svg>`:i==="mathml"?`<math>${n}</math>`:n);const o=Fp.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]}},F_=Symbol("_vtc");function O_(n,e,t){const i=n[F_];i&&(e=(e?[e,...i]:[...i]).join(" ")),e==null?n.removeAttribute("class"):t?n.setAttribute("class",e):n.className=e}const $c=Symbol("_vod"),Xy=Symbol("_vsh"),ar={name:"show",beforeMount(n,{value:e},{transition:t}){n[$c]=n.style.display==="none"?"":n.style.display,t&&e?t.beforeEnter(n):Io(n,e)},mounted(n,{value:e},{transition:t}){t&&e&&t.enter(n)},updated(n,{value:e,oldValue:t},{transition:i}){!e!=!t&&(i?e?(i.beforeEnter(n),Io(n,!0),i.enter(n)):i.leave(n,()=>{Io(n,!1)}):Io(n,e))},beforeUnmount(n,{value:e}){Io(n,e)}};function Io(n,e){n.style.display=e?n[$c]:"none",n[Xy]=!e}const B_=Symbol(""),L_=/(?:^|;)\s*display\s*:/;function D_(n,e,t){const i=n.style,s=ci(t);let r=!1;if(t&&!s){if(e)if(ci(e))for(const a of e.split(";")){const o=a.slice(0,a.indexOf(":")).trim();t[o]==null&&No(i,o,"")}else for(const a in e)t[a]==null&&No(i,a,"");for(const a in t){a==="display"&&(r=!0);const o=t[a];o!=null?U_(n,a,!ci(e)&&e?e[a]:void 0,o)||No(i,a,o):No(i,a,"")}}else if(s){if(e!==t){const a=i[B_];a&&(t+=";"+a),i.cssText=t,r=L_.test(t)}}else e&&n.removeAttribute("style");$c in n&&(n[$c]=r?i.display:"",n[Xy]&&(i.display="none"))}const Op=/\s*!important$/;function No(n,e,t){if(at(t))t.forEach(i=>No(n,e,i));else if(t==null&&(t=""),e.startsWith("--"))n.setProperty(e,t);else{const i=N_(n,e);Op.test(t)?n.setProperty(kr(i),t.replace(Op,""),"important"):n[i]=t}}const Bp=["Webkit","Moz","ms"],pu={};function N_(n,e){const t=pu[e];if(t)return t;let i=Bs(e);if(i!=="filter"&&i in n)return pu[e]=i;i=Dv(i);for(let s=0;s<Bp.length;s++){const r=Bp[s]+i;if(r in n)return pu[e]=r}return e}function U_(n,e,t,i){return n.tagName==="TEXTAREA"&&(e==="width"||e==="height")&&ci(i)&&t===i}const Lp="http://www.w3.org/1999/xlink";function Dp(n,e,t,i,s,r=jw(e)){i&&e.startsWith("xlink:")?t==null?n.removeAttributeNS(Lp,e.slice(6,e.length)):n.setAttributeNS(Lp,e,t):t==null||r&&!Uv(t)?n.removeAttribute(e):n.setAttribute(e,r?"":us(t)?String(t):t)}function Np(n,e,t,i,s){if(e==="innerHTML"||e==="textContent"){t!=null&&(n[e]=e==="innerHTML"?Uy(t):t);return}const r=n.tagName;if(e==="value"&&r!=="PROGRESS"&&!r.includes("-")){const o=r==="OPTION"?n.getAttribute("value")||"":n.value,h=t==null?n.type==="checkbox"?"on":"":String(t);(o!==h||!("_value"in n))&&(n.value=h),t==null&&n.removeAttribute(e),n._value=t;return}let a=!1;if(t===""||t==null){const o=typeof n[e];o==="boolean"?t=Uv(t):t==null&&o==="string"?(t="",a=!0):o==="number"&&(t=0,a=!0)}try{n[e]=t}catch{}a&&n.removeAttribute(s||e)}function yr(n,e,t,i){n.addEventListener(e,t,i)}function X_(n,e,t,i){n.removeEventListener(e,t,i)}const Up=Symbol("_vei");function Y_(n,e,t,i,s=null){const r=n[Up]||(n[Up]={}),a=r[e];if(i&&a)a.value=i;else{const[o,h]=G_(e);if(i){const l=r[e]=W_(i,s);yr(n,o,l,h)}else a&&(X_(n,o,a,h),r[e]=void 0)}}const V_=/(Once|Passive|Capture)$/,$_=/^on:?(?:Once|Passive|Capture)$/;function G_(n){let e,t;for(;(t=n.match(V_))&&!$_.test(n);)e||(e={}),n=n.slice(0,n.length-t[1].length),e[t[1].toLowerCase()]=!0;return[n[2]===":"?n.slice(3):kr(n.slice(2)),e]}let gu=0;const H_=Promise.resolve(),j_=()=>gu||(H_.then(()=>gu=0),gu=Date.now());function W_(n,e){const t=i=>{if(!i._vts)i._vts=Date.now();else if(i._vts<=t.attached)return;const s=t.value;if(at(s)){const r=i.stopImmediatePropagation;i.stopImmediatePropagation=()=>{r.call(i),i._stopped=!0};const a=s.slice(),o=[i];for(let h=0;h<a.length&&!i._stopped;h++){const l=a[h];l&&Vs(l,e,5,o)}}else Vs(s,e,5,[i])};return t.value=n,t.attached=j_(),t}const Xp=n=>n.charCodeAt(0)===111&&n.charCodeAt(1)===110&&n.charCodeAt(2)>96&&n.charCodeAt(2)<123,z_=(n,e,t,i,s,r)=>{const a=s==="svg";e==="class"?O_(n,i,a):e==="style"?D_(n,t,i):Ah(e)?Ch(e)||Y_(n,e,t,i,r):(e[0]==="."?(e=e.slice(1),!0):e[0]==="^"?(e=e.slice(1),!1):q_(n,e,i,a))?(Np(n,e,i),!n.tagName.includes("-")&&(e==="value"||e==="checked"||e==="selected")&&Dp(n,e,i,a,r,e!=="value")):n._isVueCE&&(K_(n,e)||n._def.__asyncLoader&&(/[A-Z]/.test(e)||!ci(i)))?Np(n,Bs(e),i,r,e):(e==="true-value"?n._trueValue=i:e==="false-value"&&(n._falseValue=i),Dp(n,e,i,a))};function q_(n,e,t,i){if(i)return!!(e==="innerHTML"||e==="textContent"||e in n&&Xp(e)&&ft(t));if(e==="spellcheck"||e==="draggable"||e==="translate"||e==="autocorrect"||e==="sandbox"&&n.tagName==="IFRAME"||e==="form"||e==="list"&&n.tagName==="INPUT"||e==="type"&&n.tagName==="TEXTAREA")return!1;if(e==="width"||e==="height"){const s=n.tagName;if(s==="IMG"||s==="VIDEO"||s==="CANVAS"||s==="SOURCE")return!1}return Xp(e)&&ci(t)?!1:e in n}function K_(n,e){const t=n._def.props;if(!t)return!1;const i=Bs(e);return Array.isArray(t)?t.some(s=>Bs(s)===i):Object.keys(t).some(s=>Bs(s)===i)}const lo=n=>{const e=n.props["onUpdate:modelValue"]||!1;return at(e)?t=>yc(e,t):e};function Z_(n){n.target.composing=!0}function Yp(n){const e=n.target;e.composing&&(e.composing=!1,e.dispatchEvent(new Event("input")))}const un=Symbol("_assign"),Ul=Symbol("_initialValue");function vu(n,e,t){return e&&(n=n.trim()),t&&(n=Ph(n)),n}const tt={created(n,{modifiers:{lazy:e,trim:t,number:i}},s){n.parentNode&&(n.type==="text"?n[Ul]=n.defaultValue.replace(/[\r\n]/g,""):n.type==="textarea"&&(n[Ul]=n.defaultValue.replace(/\r\n?/g,`
|
||
`))),n[un]=lo(s);const r=i||s.props&&s.props.type==="number";yr(n,e?"change":"input",a=>{a.target.composing||n[un](vu(n.value,t,r))}),(t||r)&&yr(n,"change",()=>{n.value=vu(n.value,t,r)}),e||(yr(n,"compositionstart",Z_),yr(n,"compositionend",Yp),yr(n,"change",Yp))},mounted(n,{value:e,modifiers:{trim:t,number:i}}){const s=e??"",r=n[Ul];delete n[Ul],r!==void 0&&(n.type==="text"||n.type==="textarea")&&n.value!==r?n[un](vu(n.value,t,i)):n.value=s},beforeUpdate(n,{value:e,oldValue:t,modifiers:{lazy:i,trim:s,number:r}},a){if(n[un]=lo(a),n.composing)return;const o=(r||n.type==="number")&&!/^0\d/.test(n.value)?Ph(n.value):n.value,h=e??"";if(o===h)return;const l=n.getRootNode();(l instanceof Document||l instanceof ShadowRoot)&&l.activeElement===n&&n.type!=="range"&&(i&&e===t||s&&n.value.trim()===h)||(n.value=h)}},Wt={deep:!0,created(n,e,t){n[un]=lo(t),yr(n,"change",()=>{const i=n._modelValue,s=ml(n),r=n.checked,a=n[un];if(at(i)){const o=xm(i,s),h=o!==-1;if(r&&!h)a(i.concat(s));else if(!r&&h){const l=[...i];l.splice(o,1),a(l)}}else if(go(i)){const o=new Set(i);r?o.add(s):o.delete(s),a(o)}else a(Yy(n,r))})},mounted:Vp,beforeUpdate(n,e,t){n[un]=lo(t),Vp(n,e,t)}};function Vp(n,{value:e,oldValue:t},i){n._modelValue=e;let s;if(at(e))s=xm(e,i.props.value)>-1;else if(go(e))s=e.has(i.props.value);else{if(e===t)return;s=vo(e,Yy(n,!0))}n.checked!==s&&(n.checked=s)}const Vt={deep:!0,created(n,{value:e,modifiers:{number:t}},i){n._modelValue=e,yr(n,"change",()=>{const s=Array.prototype.filter.call(n.options,r=>r.selected).map(r=>t?Ph(ml(r)):ml(r));n[un](n.multiple?go(n._modelValue)?new Set(s):s:s[0]),n._assigning=!0,Em(()=>{n._assigning=!1})}),n[un]=lo(i)},mounted(n,{value:e}){$p(n,e)},beforeUpdate(n,{value:e},t){n._modelValue=e,n[un]=lo(t)},updated(n,{value:e}){n._assigning||$p(n,e)}};function $p(n,e){const t=n.multiple,i=at(e);if(!(t&&!i&&!go(e))){for(let s=0,r=n.options.length;s<r;s++){const a=n.options[s],o=ml(a);if(t)if(i){const h=typeof o;h==="string"||h==="number"?a.selected=e.some(l=>String(l)===String(o)):a.selected=xm(e,o)>-1}else a.selected=e.has(o);else if(vo(ml(a),e)){n.selectedIndex!==s&&(n.selectedIndex=s);return}}!t&&n.selectedIndex!==-1&&(n.selectedIndex=-1)}}function ml(n){return"_value"in n?n._value:n.value}function Yy(n,e){const t=e?"_trueValue":"_falseValue";return t in n?n[t]:e}const J_=["ctrl","shift","alt","meta"],Q_={stop:n=>n.stopPropagation(),prevent:n=>n.preventDefault(),self:n=>n.target!==n.currentTarget,ctrl:n=>!n.ctrlKey,shift:n=>!n.shiftKey,alt:n=>!n.altKey,meta:n=>!n.metaKey,left:n=>"button"in n&&n.button!==0,middle:n=>"button"in n&&n.button!==1,right:n=>"button"in n&&n.button!==2,exact:(n,e)=>J_.some(t=>n[`${t}Key`]&&!e.includes(t))},Tt=(n,e)=>{if(!n)return n;const t=n._withMods||(n._withMods={}),i=e.join(".");return t[i]||(t[i]=((s,...r)=>{for(let a=0;a<e.length;a++){const o=Q_[e[a]];if(o&&o(s,e))return}return n(s,...r)}))},eT={esc:"escape",space:" ",up:"arrow-up",left:"arrow-left",right:"arrow-right",down:"arrow-down",delete:"backspace"},aa=(n,e)=>{const t=n._withKeys||(n._withKeys={}),i=e.join(".");return t[i]||(t[i]=(s=>{if(!("key"in s))return;const r=kr(s.key);if(e.some(a=>a===r||eT[a]===r))return n(s)}))},tT=Fi({patchProp:z_},k_);let Gp;function iT(){return Gp||(Gp=f_(tT))}const sT=((...n)=>{const e=iT().createApp(...n),{mount:t}=e;return e.mount=i=>{const s=rT(i);if(!s)return;const r=e._component;!ft(r)&&!r.render&&!r.template&&(r.template=s.innerHTML),s.nodeType===1&&(s.textContent="");const a=t(s,!1,nT(s));return s instanceof Element&&(s.removeAttribute("v-cloak"),s.setAttribute("data-v-app","")),a},e});function nT(n){if(n instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&n instanceof MathMLElement)return"mathml"}function rT(n){return ci(n)?document.querySelector(n):n}/*!
|
||
* pinia v4.0.3
|
||
* (c) 2026 Eduardo San Martin Morote
|
||
* @license MIT
|
||
*/let Vy;const Yh=n=>Vy=n,$y=Symbol();function Hp(n){return n&&typeof n=="object"&&Object.prototype.toString.call(n)==="[object Object]"&&typeof n.toJSON!="function"}function aT(){const n=$v(!0),e=n.run(()=>nt({}));let t=[],i=[];const s=Sr({install(r){Yh(s),s._a=r,r.provide($y,s),r.config.globalProperties.$pinia=s,i.forEach(a=>t.push(a)),i=[]},use(r){return this._a?t.push(r):i.push(r),this},_p:t,_a:null,_e:n,_s:new Map,state:e});return s}const lf=()=>{};function jp(n,e,t,i=lf){n.add(e);const s=()=>{n.delete(e)&&i()};return!t&&Gv()&&zw(s),s}function Aa(n,...e){n.forEach(t=>{t(...e)})}const oT=n=>n(),Wp=Symbol(),yu=Symbol();function cf(n,e){n instanceof Map&&e instanceof Map?e.forEach((t,i)=>n.set(i,t)):n instanceof Set&&e instanceof Set&&e.forEach(n.add,n);for(const t in e){if(!Object.hasOwn(e,t))continue;const i=e[t],s=n[t];Hp(s)&&Hp(i)&&Object.hasOwn(n,t)&&!hi(i)&&!Wn(i)?n[t]=cf(s,i):n[t]=i}return n}const lT=Symbol();function cT(n){return!n||typeof n!="object"||!Object.hasOwn(n,lT)}const{assign:cr}=Object;function hT(n){return!!(hi(n)&&n.effect)}function uT(n,e,t,i){const{state:s,actions:r,getters:a}=e,o=t.state.value[n];let h;function l(){o||(t.state.value[n]=s?s():{});const c=vS(t.state.value[n]);return cr(c,r,Object.keys(a||{}).reduce((u,d)=>(u[d]=Sr(yt(()=>{Yh(t);const f=t._s.get(n);return a[d].call(f,f)})),u),{}))}return h=Gy(n,l,e,t,i,!0),h}function Gy(n,e,t={},i,s,r){let a;const o=cr({actions:{}},t),h={deep:!0};let l,c,u=new Set,d=new Set,f;const p=i.state.value[n];!r&&!p&&(i.state.value[n]={});let m;function g(T){let C;l=c=!1,typeof T=="function"?(T(i.state.value[n]),C={type:"patch function",storeId:n,events:f}):(cf(i.state.value[n],T),C={type:"patch object",payload:T,storeId:n,events:f});const I=m=Symbol();Em().then(()=>{m===I&&(l=!0)}),c=!0,Aa(u,C,i.state.value[n])}const y=r?function(){const{state:C}=t,I=C?C():{};this.$patch(k=>{cr(k,I)})}:lf;function w(){a.stop(),u.clear(),d.clear(),i._s.delete(n)}const v=(T,C="")=>{if(Wp in T)return T[yu]=C,T;const I=function(){Yh(i);const k=Array.from(arguments),R=new Set,F=new Set;function B(O){R.add(O)}function L(O){F.add(O)}Aa(d,{args:k,name:I[yu],store:x,after:B,onError:L});let Y;try{Y=T.apply(this&&this.$id===n?this:x,k)}catch(O){throw Aa(F,O),O}return Y instanceof Promise?Y.then(O=>(Aa(R,O),O)).catch(O=>(Aa(F,O),Promise.reject(O))):(Aa(R,Y),Y)};return I[Wp]=!0,I[yu]=C,I},_={_p:i,$id:n,$onAction:jp.bind(null,d),$patch:g,$reset:y,$subscribe(T,C={}){if(u.has(T))return lf;const I=jp(u,T,C.detached,()=>k()),k=a.run(()=>hs(()=>i.state.value[n],R=>{(C.flush==="sync"?c:l)&&T({storeId:n,type:"direct",events:f},R)},cr({},h,C)));return I},$dispose:w},x=yo(_);i._s.set(n,x);const M=(i._a&&i._a.runWithContext||oT)(()=>i._e.run(()=>(a=$v()).run(()=>e({action:v}))));for(const T in M){const C=M[T];hi(C)&&!hT(C)||Wn(C)?r||(p&&cT(C)&&(hi(C)?C.value=p[T]:((C instanceof Set||C instanceof Map)&&C.clear(),cf(C,p[T]))),i.state.value[n][T]=C):typeof C=="function"&&(M[T]=v(C,T),o.actions[T]=C)}return cr(x,M),cr(Bt(x),M),Object.defineProperty(x,"$state",{get:()=>i.state.value[n],set:T=>{g(C=>{cr(C,T)})}}),i._p.forEach(T=>{const C=a.run(()=>T({store:x,app:i._a,pinia:i,options:o}));cr(x,C)}),p&&r&&t.hydrate&&t.hydrate(x.$state,p),l=!0,c=!0,x}/*! #__NO_SIDE_EFFECTS__ */function dT(n,e,t){let i;const s=typeof e=="function";i=s?t:e;function r(a,o){const h=CS();return a=a||(h?Ko($y,null):null),a&&Yh(a),a=Vy,a._s.has(n)||(s?Gy(n,e,i,a):uT(n,i,a)),a._s.get(n)}return r.$id=n,r}var va=(n=>(n[n.WEBGL_LEGACY=0]="WEBGL_LEGACY",n[n.WEBGL=1]="WEBGL",n[n.WEBGL2=2]="WEBGL2",n))(va||{}),Hy=(n=>(n[n.UNKNOWN=0]="UNKNOWN",n[n.WEBGL=1]="WEBGL",n[n.CANVAS=2]="CANVAS",n))(Hy||{}),hf=(n=>(n[n.COLOR=16384]="COLOR",n[n.DEPTH=256]="DEPTH",n[n.STENCIL=1024]="STENCIL",n))(hf||{}),st=(n=>(n[n.NORMAL=0]="NORMAL",n[n.ADD=1]="ADD",n[n.MULTIPLY=2]="MULTIPLY",n[n.SCREEN=3]="SCREEN",n[n.OVERLAY=4]="OVERLAY",n[n.DARKEN=5]="DARKEN",n[n.LIGHTEN=6]="LIGHTEN",n[n.COLOR_DODGE=7]="COLOR_DODGE",n[n.COLOR_BURN=8]="COLOR_BURN",n[n.HARD_LIGHT=9]="HARD_LIGHT",n[n.SOFT_LIGHT=10]="SOFT_LIGHT",n[n.DIFFERENCE=11]="DIFFERENCE",n[n.EXCLUSION=12]="EXCLUSION",n[n.HUE=13]="HUE",n[n.SATURATION=14]="SATURATION",n[n.COLOR=15]="COLOR",n[n.LUMINOSITY=16]="LUMINOSITY",n[n.NORMAL_NPM=17]="NORMAL_NPM",n[n.ADD_NPM=18]="ADD_NPM",n[n.SCREEN_NPM=19]="SCREEN_NPM",n[n.NONE=20]="NONE",n[n.SRC_OVER=0]="SRC_OVER",n[n.SRC_IN=21]="SRC_IN",n[n.SRC_OUT=22]="SRC_OUT",n[n.SRC_ATOP=23]="SRC_ATOP",n[n.DST_OVER=24]="DST_OVER",n[n.DST_IN=25]="DST_IN",n[n.DST_OUT=26]="DST_OUT",n[n.DST_ATOP=27]="DST_ATOP",n[n.ERASE=26]="ERASE",n[n.SUBTRACT=28]="SUBTRACT",n[n.XOR=29]="XOR",n))(st||{}),dn=(n=>(n[n.POINTS=0]="POINTS",n[n.LINES=1]="LINES",n[n.LINE_LOOP=2]="LINE_LOOP",n[n.LINE_STRIP=3]="LINE_STRIP",n[n.TRIANGLES=4]="TRIANGLES",n[n.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",n[n.TRIANGLE_FAN=6]="TRIANGLE_FAN",n))(dn||{}),Oe=(n=>(n[n.RGBA=6408]="RGBA",n[n.RGB=6407]="RGB",n[n.RG=33319]="RG",n[n.RED=6403]="RED",n[n.RGBA_INTEGER=36249]="RGBA_INTEGER",n[n.RGB_INTEGER=36248]="RGB_INTEGER",n[n.RG_INTEGER=33320]="RG_INTEGER",n[n.RED_INTEGER=36244]="RED_INTEGER",n[n.ALPHA=6406]="ALPHA",n[n.LUMINANCE=6409]="LUMINANCE",n[n.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",n[n.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",n[n.DEPTH_STENCIL=34041]="DEPTH_STENCIL",n))(Oe||{}),Za=(n=>(n[n.TEXTURE_2D=3553]="TEXTURE_2D",n[n.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",n[n.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",n[n.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",n[n.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",n[n.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",n[n.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",n[n.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",n[n.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",n))(Za||{}),We=(n=>(n[n.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",n[n.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",n[n.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",n[n.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",n[n.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",n[n.UNSIGNED_INT=5125]="UNSIGNED_INT",n[n.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",n[n.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",n[n.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",n[n.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",n[n.BYTE=5120]="BYTE",n[n.SHORT=5122]="SHORT",n[n.INT=5124]="INT",n[n.FLOAT=5126]="FLOAT",n[n.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",n[n.HALF_FLOAT=36193]="HALF_FLOAT",n))(We||{}),Ge=(n=>(n[n.FLOAT=0]="FLOAT",n[n.INT=1]="INT",n[n.UINT=2]="UINT",n))(Ge||{}),Os=(n=>(n[n.NEAREST=0]="NEAREST",n[n.LINEAR=1]="LINEAR",n))(Os||{}),Ds=(n=>(n[n.CLAMP=33071]="CLAMP",n[n.REPEAT=10497]="REPEAT",n[n.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",n))(Ds||{}),ws=(n=>(n[n.OFF=0]="OFF",n[n.POW2=1]="POW2",n[n.ON=2]="ON",n[n.ON_MANUAL=3]="ON_MANUAL",n))(ws||{}),Ai=(n=>(n[n.NPM=0]="NPM",n[n.UNPACK=1]="UNPACK",n[n.PMA=2]="PMA",n[n.NO_PREMULTIPLIED_ALPHA=0]="NO_PREMULTIPLIED_ALPHA",n[n.PREMULTIPLY_ON_UPLOAD=1]="PREMULTIPLY_ON_UPLOAD",n[n.PREMULTIPLIED_ALPHA=2]="PREMULTIPLIED_ALPHA",n))(Ai||{}),cn=(n=>(n[n.NO=0]="NO",n[n.YES=1]="YES",n[n.AUTO=2]="AUTO",n[n.BLEND=0]="BLEND",n[n.CLEAR=1]="CLEAR",n[n.BLIT=2]="BLIT",n))(cn||{}),Bm=(n=>(n[n.AUTO=0]="AUTO",n[n.MANUAL=1]="MANUAL",n))(Bm||{}),xs=(n=>(n.LOW="lowp",n.MEDIUM="mediump",n.HIGH="highp",n))(xs||{}),xi=(n=>(n[n.NONE=0]="NONE",n[n.SCISSOR=1]="SCISSOR",n[n.STENCIL=2]="STENCIL",n[n.SPRITE=3]="SPRITE",n[n.COLOR=4]="COLOR",n))(xi||{}),mi=(n=>(n[n.NONE=0]="NONE",n[n.LOW=2]="LOW",n[n.MEDIUM=4]="MEDIUM",n[n.HIGH=8]="HIGH",n))(mi||{}),gn=(n=>(n[n.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",n[n.ARRAY_BUFFER=34962]="ARRAY_BUFFER",n[n.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",n))(gn||{});const fT={createCanvas:(n,e)=>{const t=document.createElement("canvas");return t.width=n,t.height=e,t},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(n,e)=>fetch(n,e),parseXML:n=>new DOMParser().parseFromString(n,"text/xml")},$e={ADAPTER:fT,RESOLUTION:1,CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1};var xu=/iPhone/i,zp=/iPod/i,qp=/iPad/i,Kp=/\biOS-universal(?:.+)Mac\b/i,bu=/\bAndroid(?:.+)Mobile\b/i,Zp=/Android/i,Ca=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,Xl=/Silk/i,Cn=/Windows Phone/i,Jp=/\bWindows(?:.+)ARM\b/i,Qp=/BlackBerry/i,eg=/BB10/i,tg=/Opera Mini/i,ig=/\b(CriOS|Chrome)(?:.+)Mobile/i,sg=/Mobile(?:.+)Firefox\b/i,ng=function(n){return typeof n<"u"&&n.platform==="MacIntel"&&typeof n.maxTouchPoints=="number"&&n.maxTouchPoints>1&&typeof MSStream>"u"};function mT(n){return function(e){return e.test(n)}}function rg(n){var e={userAgent:"",platform:"",maxTouchPoints:0};!n&&typeof navigator<"u"?e={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0}:typeof n=="string"?e.userAgent=n:n&&n.userAgent&&(e={userAgent:n.userAgent,platform:n.platform,maxTouchPoints:n.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 s=mT(t),r={apple:{phone:s(xu)&&!s(Cn),ipod:s(zp),tablet:!s(xu)&&(s(qp)||ng(e))&&!s(Cn),universal:s(Kp),device:(s(xu)||s(zp)||s(qp)||s(Kp)||ng(e))&&!s(Cn)},amazon:{phone:s(Ca),tablet:!s(Ca)&&s(Xl),device:s(Ca)||s(Xl)},android:{phone:!s(Cn)&&s(Ca)||!s(Cn)&&s(bu),tablet:!s(Cn)&&!s(Ca)&&!s(bu)&&(s(Xl)||s(Zp)),device:!s(Cn)&&(s(Ca)||s(Xl)||s(bu)||s(Zp))||s(/\bokhttp\b/i)},windows:{phone:s(Cn),tablet:s(Jp),device:s(Cn)||s(Jp)},other:{blackberry:s(Qp),blackberry10:s(eg),opera:s(tg),firefox:s(sg),chrome:s(ig),device:s(Qp)||s(eg)||s(tg)||s(sg)||s(ig)},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 pT=rg.default??rg,Xn=pT(globalThis.navigator);$e.RETINA_PREFIX=/@([0-9\.]+)x/;$e.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!1;var Gc=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function jy(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}function gT(n){if(Object.prototype.hasOwnProperty.call(n,"__esModule"))return n;var e=n.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(n).forEach(function(i){var s=Object.getOwnPropertyDescriptor(n,i);Object.defineProperty(t,i,s.get?s:{enumerable:!0,get:function(){return n[i]}})}),t}var wu={exports:{}},ag;function vT(){return ag||(ag=1,(function(n){var e=Object.prototype.hasOwnProperty,t="~";function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(t=!1));function s(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 s(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],y=arguments.length,w,v;if(g.fn){switch(g.once&&this.removeListener(l,g.fn,void 0,!0),y){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(v=1,w=new Array(y-1);v<y;v++)w[v-1]=arguments[v];g.fn.apply(g.context,w)}else{var _=g.length,x;for(v=0;v<_;v++)switch(g[v].once&&this.removeListener(l,g[v].fn,void 0,!0),y){case 1:g[v].fn.call(g[v].context);break;case 2:g[v].fn.call(g[v].context,c);break;case 3:g[v].fn.call(g[v].context,c,u);break;case 4:g[v].fn.call(g[v].context,c,u,d);break;default:if(!w)for(x=1,w=new Array(y-1);x<y;x++)w[x-1]=arguments[x];g[v].fn.apply(g[v].context,w)}}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=[],y=p.length;m<y;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,n.exports=o})(wu)),wu.exports}var yT=vT();const El=jy(yT);var Yl={exports:{}},og;function xT(){if(og)return Yl.exports;og=1,Yl.exports=n,Yl.exports.default=n;function n(O,D,P){P=P||2;var U=D&&D.length,N=U?D[0]*P:O.length,X=e(O,0,N,P,!0),K=[];if(!X||X.next===X.prev)return K;var z,se,Q,me,pe,Me,Ie;if(U&&(X=h(O,D,X,P)),O.length>80*P){z=Q=O[0],se=me=O[1];for(var ge=P;ge<N;ge+=P)pe=O[ge],Me=O[ge+1],pe<z&&(z=pe),Me<se&&(se=Me),pe>Q&&(Q=pe),Me>me&&(me=Me);Ie=Math.max(Q-z,me-se),Ie=Ie!==0?32767/Ie:0}return i(X,K,P,z,se,Ie,0),K}function e(O,D,P,U,N){var X,K;if(N===Y(O,D,P,U)>0)for(X=D;X<P;X+=U)K=F(X,O[X],O[X+1],K);else for(X=P-U;X>=D;X-=U)K=F(X,O[X],O[X+1],K);return K&&_(K,K.next)&&(B(K),K=K.next),K}function t(O,D){if(!O)return O;D||(D=O);var P=O,U;do if(U=!1,!P.steiner&&(_(P,P.next)||v(P.prev,P,P.next)===0)){if(B(P),P=D=P.prev,P===P.next)break;U=!0}else P=P.next;while(U||P!==D);return D}function i(O,D,P,U,N,X,K){if(O){!K&&X&&f(O,U,N,X);for(var z=O,se,Q;O.prev!==O.next;){if(se=O.prev,Q=O.next,X?r(O,U,N,X):s(O)){D.push(se.i/P|0),D.push(O.i/P|0),D.push(Q.i/P|0),B(O),O=Q.next,z=Q.next;continue}if(O=Q,O===z){K?K===1?(O=a(t(O),D,P),i(O,D,P,U,N,X,2)):K===2&&o(O,D,P,U,N,X):i(t(O),D,P,U,N,X,1);break}}}}function s(O){var D=O.prev,P=O,U=O.next;if(v(D,P,U)>=0)return!1;for(var N=D.x,X=P.x,K=U.x,z=D.y,se=P.y,Q=U.y,me=N<X?N<K?N:K:X<K?X:K,pe=z<se?z<Q?z:Q:se<Q?se:Q,Me=N>X?N>K?N:K:X>K?X:K,Ie=z>se?z>Q?z:Q:se>Q?se:Q,ge=U.next;ge!==D;){if(ge.x>=me&&ge.x<=Me&&ge.y>=pe&&ge.y<=Ie&&y(N,z,X,se,K,Q,ge.x,ge.y)&&v(ge.prev,ge,ge.next)>=0)return!1;ge=ge.next}return!0}function r(O,D,P,U){var N=O.prev,X=O,K=O.next;if(v(N,X,K)>=0)return!1;for(var z=N.x,se=X.x,Q=K.x,me=N.y,pe=X.y,Me=K.y,Ie=z<se?z<Q?z:Q:se<Q?se:Q,ge=me<pe?me<Me?me:Me:pe<Me?pe:Me,Ee=z>se?z>Q?z:Q:se>Q?se:Q,H=me>pe?me>Me?me:Me:pe>Me?pe:Me,Z=m(Ie,ge,D,P,U),q=m(Ee,H,D,P,U),W=O.prevZ,ee=O.nextZ;W&&W.z>=Z&&ee&&ee.z<=q;){if(W.x>=Ie&&W.x<=Ee&&W.y>=ge&&W.y<=H&&W!==N&&W!==K&&y(z,me,se,pe,Q,Me,W.x,W.y)&&v(W.prev,W,W.next)>=0||(W=W.prevZ,ee.x>=Ie&&ee.x<=Ee&&ee.y>=ge&&ee.y<=H&&ee!==N&&ee!==K&&y(z,me,se,pe,Q,Me,ee.x,ee.y)&&v(ee.prev,ee,ee.next)>=0))return!1;ee=ee.nextZ}for(;W&&W.z>=Z;){if(W.x>=Ie&&W.x<=Ee&&W.y>=ge&&W.y<=H&&W!==N&&W!==K&&y(z,me,se,pe,Q,Me,W.x,W.y)&&v(W.prev,W,W.next)>=0)return!1;W=W.prevZ}for(;ee&&ee.z<=q;){if(ee.x>=Ie&&ee.x<=Ee&&ee.y>=ge&&ee.y<=H&&ee!==N&&ee!==K&&y(z,me,se,pe,Q,Me,ee.x,ee.y)&&v(ee.prev,ee,ee.next)>=0)return!1;ee=ee.nextZ}return!0}function a(O,D,P){var U=O;do{var N=U.prev,X=U.next.next;!_(N,X)&&x(N,U,U.next,X)&&I(N,X)&&I(X,N)&&(D.push(N.i/P|0),D.push(U.i/P|0),D.push(X.i/P|0),B(U),B(U.next),U=O=X),U=U.next}while(U!==O);return t(U)}function o(O,D,P,U,N,X){var K=O;do{for(var z=K.next.next;z!==K.prev;){if(K.i!==z.i&&w(K,z)){var se=R(K,z);K=t(K,K.next),se=t(se,se.next),i(K,D,P,U,N,X,0),i(se,D,P,U,N,X,0);return}z=z.next}K=K.next}while(K!==O)}function h(O,D,P,U){var N=[],X,K,z,se,Q;for(X=0,K=D.length;X<K;X++)z=D[X]*U,se=X<K-1?D[X+1]*U:O.length,Q=e(O,z,se,U,!1),Q===Q.next&&(Q.steiner=!0),N.push(g(Q));for(N.sort(l),X=0;X<N.length;X++)P=c(N[X],P);return P}function l(O,D){return O.x-D.x}function c(O,D){var P=u(O,D);if(!P)return D;var U=R(P,O);return t(U,U.next),t(P,P.next)}function u(O,D){var P=D,U=O.x,N=O.y,X=-1/0,K;do{if(N<=P.y&&N>=P.next.y&&P.next.y!==P.y){var z=P.x+(N-P.y)*(P.next.x-P.x)/(P.next.y-P.y);if(z<=U&&z>X&&(X=z,K=P.x<P.next.x?P:P.next,z===U))return K}P=P.next}while(P!==D);if(!K)return null;var se=K,Q=K.x,me=K.y,pe=1/0,Me;P=K;do U>=P.x&&P.x>=Q&&U!==P.x&&y(N<me?U:X,N,Q,me,N<me?X:U,N,P.x,P.y)&&(Me=Math.abs(N-P.y)/(U-P.x),I(P,O)&&(Me<pe||Me===pe&&(P.x>K.x||P.x===K.x&&d(K,P)))&&(K=P,pe=Me)),P=P.next;while(P!==se);return K}function d(O,D){return v(O.prev,O,D.prev)<0&&v(D.next,O,O.next)<0}function f(O,D,P,U){var N=O;do N.z===0&&(N.z=m(N.x,N.y,D,P,U)),N.prevZ=N.prev,N.nextZ=N.next,N=N.next;while(N!==O);N.prevZ.nextZ=null,N.prevZ=null,p(N)}function p(O){var D,P,U,N,X,K,z,se,Q=1;do{for(P=O,O=null,X=null,K=0;P;){for(K++,U=P,z=0,D=0;D<Q&&(z++,U=U.nextZ,!!U);D++);for(se=Q;z>0||se>0&&U;)z!==0&&(se===0||!U||P.z<=U.z)?(N=P,P=P.nextZ,z--):(N=U,U=U.nextZ,se--),X?X.nextZ=N:O=N,N.prevZ=X,X=N;P=U}X.nextZ=null,Q*=2}while(K>1);return O}function m(O,D,P,U,N){return O=(O-P)*N|0,D=(D-U)*N|0,O=(O|O<<8)&16711935,O=(O|O<<4)&252645135,O=(O|O<<2)&858993459,O=(O|O<<1)&1431655765,D=(D|D<<8)&16711935,D=(D|D<<4)&252645135,D=(D|D<<2)&858993459,D=(D|D<<1)&1431655765,O|D<<1}function g(O){var D=O,P=O;do(D.x<P.x||D.x===P.x&&D.y<P.y)&&(P=D),D=D.next;while(D!==O);return P}function y(O,D,P,U,N,X,K,z){return(N-K)*(D-z)>=(O-K)*(X-z)&&(O-K)*(U-z)>=(P-K)*(D-z)&&(P-K)*(X-z)>=(N-K)*(U-z)}function w(O,D){return O.next.i!==D.i&&O.prev.i!==D.i&&!C(O,D)&&(I(O,D)&&I(D,O)&&k(O,D)&&(v(O.prev,O,D.prev)||v(O,D.prev,D))||_(O,D)&&v(O.prev,O,O.next)>0&&v(D.prev,D,D.next)>0)}function v(O,D,P){return(D.y-O.y)*(P.x-D.x)-(D.x-O.x)*(P.y-D.y)}function _(O,D){return O.x===D.x&&O.y===D.y}function x(O,D,P,U){var N=T(v(O,D,P)),X=T(v(O,D,U)),K=T(v(P,U,O)),z=T(v(P,U,D));return!!(N!==X&&K!==z||N===0&&M(O,P,D)||X===0&&M(O,U,D)||K===0&&M(P,O,U)||z===0&&M(P,D,U))}function M(O,D,P){return D.x<=Math.max(O.x,P.x)&&D.x>=Math.min(O.x,P.x)&&D.y<=Math.max(O.y,P.y)&&D.y>=Math.min(O.y,P.y)}function T(O){return O>0?1:O<0?-1:0}function C(O,D){var P=O;do{if(P.i!==O.i&&P.next.i!==O.i&&P.i!==D.i&&P.next.i!==D.i&&x(P,P.next,O,D))return!0;P=P.next}while(P!==O);return!1}function I(O,D){return v(O.prev,O,O.next)<0?v(O,D,O.next)>=0&&v(O,O.prev,D)>=0:v(O,D,O.prev)<0||v(O,O.next,D)<0}function k(O,D){var P=O,U=!1,N=(O.x+D.x)/2,X=(O.y+D.y)/2;do P.y>X!=P.next.y>X&&P.next.y!==P.y&&N<(P.next.x-P.x)*(X-P.y)/(P.next.y-P.y)+P.x&&(U=!U),P=P.next;while(P!==O);return U}function R(O,D){var P=new L(O.i,O.x,O.y),U=new L(D.i,D.x,D.y),N=O.next,X=D.prev;return O.next=D,D.prev=O,P.next=N,N.prev=P,U.next=P,P.prev=U,X.next=U,U.prev=X,U}function F(O,D,P,U){var N=new L(O,D,P);return U?(N.next=U.next,N.prev=U,U.next.prev=N,U.next=N):(N.prev=N,N.next=N),N}function B(O){O.next.prev=O.prev,O.prev.next=O.next,O.prevZ&&(O.prevZ.nextZ=O.nextZ),O.nextZ&&(O.nextZ.prevZ=O.prevZ)}function L(O,D,P){this.i=O,this.x=D,this.y=P,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}n.deviation=function(O,D,P,U){var N=D&&D.length,X=N?D[0]*P:O.length,K=Math.abs(Y(O,0,X,P));if(N)for(var z=0,se=D.length;z<se;z++){var Q=D[z]*P,me=z<se-1?D[z+1]*P:O.length;K-=Math.abs(Y(O,Q,me,P))}var pe=0;for(z=0;z<U.length;z+=3){var Me=U[z]*P,Ie=U[z+1]*P,ge=U[z+2]*P;pe+=Math.abs((O[Me]-O[ge])*(O[Ie+1]-O[Me+1])-(O[Me]-O[Ie])*(O[ge+1]-O[Me+1]))}return K===0&&pe===0?0:Math.abs((pe-K)/K)};function Y(O,D,P,U){for(var N=0,X=D,K=P-U;X<P;X+=U)N+=(O[K]-O[X])*(O[X+1]+O[K+1]),K=X;return N}return n.flatten=function(O){for(var D=O[0][0].length,P={vertices:[],holes:[],dimensions:D},U=0,N=0;N<O.length;N++){for(var X=0;X<O[N].length;X++)for(var K=0;K<D;K++)P.vertices.push(O[N][X][K]);N>0&&(U+=O[N-1].length,P.holes.push(U))}return P},Yl.exports}var bT=xT();const wT=jy(bT);var Xr={},Uo={exports:{}};/*! https://mths.be/punycode v1.4.1 by @mathias */var ST=Uo.exports,lg;function _T(){return lg||(lg=1,(function(n,e){(function(t){var i=e&&!e.nodeType&&e,s=n&&!n.nodeType&&n,r=typeof Gc=="object"&&Gc;(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--/,y=/[^\x20-\x7E]/,w=/[\x2E\u3002\uFF0E\uFF61]/g,v={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},_=h-l,x=Math.floor,M=String.fromCharCode,T;function C(N){throw new RangeError(v[N])}function I(N,X){for(var K=N.length,z=[];K--;)z[K]=X(N[K]);return z}function k(N,X){var K=N.split("@"),z="";K.length>1&&(z=K[0]+"@",N=K[1]),N=N.replace(w,".");var se=N.split("."),Q=I(se,X).join(".");return z+Q}function R(N){for(var X=[],K=0,z=N.length,se,Q;K<z;)se=N.charCodeAt(K++),se>=55296&&se<=56319&&K<z?(Q=N.charCodeAt(K++),(Q&64512)==56320?X.push(((se&1023)<<10)+(Q&1023)+65536):(X.push(se),K--)):X.push(se);return X}function F(N){return I(N,function(X){var K="";return X>65535&&(X-=65536,K+=M(X>>>10&1023|55296),X=56320|X&1023),K+=M(X),K}).join("")}function B(N){return N-48<10?N-22:N-65<26?N-65:N-97<26?N-97:h}function L(N,X){return N+22+75*(N<26)-((X!=0)<<5)}function Y(N,X,K){var z=0;for(N=K?x(N/d):N>>1,N+=x(N/X);N>_*c>>1;z+=h)N=x(N/_);return x(z+(_+1)*N/(N+u))}function O(N){var X=[],K=N.length,z,se=0,Q=p,me=f,pe,Me,Ie,ge,Ee,H,Z,q,W;for(pe=N.lastIndexOf(m),pe<0&&(pe=0),Me=0;Me<pe;++Me)N.charCodeAt(Me)>=128&&C("not-basic"),X.push(N.charCodeAt(Me));for(Ie=pe>0?pe+1:0;Ie<K;){for(ge=se,Ee=1,H=h;Ie>=K&&C("invalid-input"),Z=B(N.charCodeAt(Ie++)),(Z>=h||Z>x((o-se)/Ee))&&C("overflow"),se+=Z*Ee,q=H<=me?l:H>=me+c?c:H-me,!(Z<q);H+=h)W=h-q,Ee>x(o/W)&&C("overflow"),Ee*=W;z=X.length+1,me=Y(se-ge,z,ge==0),x(se/z)>o-Q&&C("overflow"),Q+=x(se/z),se%=z,X.splice(se++,0,Q)}return F(X)}function D(N){var X,K,z,se,Q,me,pe,Me,Ie,ge,Ee,H=[],Z,q,W,ee;for(N=R(N),Z=N.length,X=p,K=0,Q=f,me=0;me<Z;++me)Ee=N[me],Ee<128&&H.push(M(Ee));for(z=se=H.length,se&&H.push(m);z<Z;){for(pe=o,me=0;me<Z;++me)Ee=N[me],Ee>=X&&Ee<pe&&(pe=Ee);for(q=z+1,pe-X>x((o-K)/q)&&C("overflow"),K+=(pe-X)*q,X=pe,me=0;me<Z;++me)if(Ee=N[me],Ee<X&&++K>o&&C("overflow"),Ee==X){for(Me=K,Ie=h;ge=Ie<=Q?l:Ie>=Q+c?c:Ie-Q,!(Me<ge);Ie+=h)ee=Me-ge,W=h-ge,H.push(M(L(ge+ee%W,0))),Me=x(ee/W);H.push(M(L(Me,0))),Q=Y(K,q,z==se),K=0,++z}++K,++X}return H.join("")}function P(N){return k(N,function(X){return g.test(X)?O(X.slice(4).toLowerCase()):X})}function U(N){return k(N,function(X){return y.test(X)?"xn--"+D(X):X})}if(a={version:"1.4.1",ucs2:{decode:R,encode:F},decode:O,encode:D,toASCII:U,toUnicode:P},i&&s)if(n.exports==i)s.exports=a;else for(T in a)a.hasOwnProperty(T)&&(i[T]=a[T]);else t.punycode=a})(ST)})(Uo,Uo.exports)),Uo.exports}var Su,cg;function bo(){return cg||(cg=1,Su=TypeError),Su}const TT={},MT=Object.freeze(Object.defineProperty({__proto__:null,default:TT},Symbol.toStringTag,{value:"Module"})),ET=gT(MT);var _u,hg;function Vh(){if(hg)return _u;hg=1;var n=typeof Map=="function"&&Map.prototype,e=Object.getOwnPropertyDescriptor&&n?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,t=n&&e&&typeof e.get=="function"?e.get:null,i=n&&Map.prototype.forEach,s=typeof Set=="function"&&Set.prototype,r=Object.getOwnPropertyDescriptor&&s?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,a=s&&r&&typeof r.get=="function"?r.get:null,o=s&&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,y=String.prototype.match,w=String.prototype.slice,v=String.prototype.replace,_=String.prototype.toUpperCase,x=String.prototype.toLowerCase,M=RegExp.prototype.test,T=Array.prototype.concat,C=Array.prototype.join,I=Array.prototype.slice,k=Math.floor,R=typeof BigInt=="function"?BigInt.prototype.valueOf:null,F=Object.getOwnPropertySymbols,B=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,L=typeof Symbol=="function"&&typeof Symbol.iterator=="object",Y=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===L||!0)?Symbol.toStringTag:null,O=Object.prototype.propertyIsEnumerable,D=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(le){return le.__proto__}:null);function P(le,fe){if(le===1/0||le===-1/0||le!==le||le&&le>-1e3&&le<1e3||M.call(/e/,fe))return fe;var bt=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof le=="number"){var Dt=le<0?-k(-le):k(le);if(Dt!==le){var Yt=String(Dt),ut=w.call(fe,Yt.length+1);return v.call(Yt,bt,"$&_")+"."+v.call(v.call(ut,/([0-9]{3})/g,"$&_"),/_$/,"")}}return v.call(fe,bt,"$&_")}var U=ET,N=U.custom,X=q(N)?N:null,K={__proto__:null,double:'"',single:"'"},z={__proto__:null,double:/(["\\])/g,single:/(['\\])/g};_u=function le(fe,bt,Dt,Yt){var ut=bt||{};if(ce(ut,"quoteStyle")&&!ce(K,ut.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(ce(ut,"maxStringLength")&&(typeof ut.maxStringLength=="number"?ut.maxStringLength<0&&ut.maxStringLength!==1/0:ut.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var fs=ce(ut,"customInspect")?ut.customInspect:!0;if(typeof fs!="boolean"&&fs!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(ce(ut,"indent")&&ut.indent!==null&&ut.indent!==" "&&!(parseInt(ut.indent,10)===ut.indent&&ut.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(ce(ut,"numericSeparator")&&typeof ut.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var _s=ut.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 wt(fe,ut);if(typeof fe=="number"){if(fe===0)return 1/0/fe>0?"0":"-0";var gi=String(fe);return _s?P(fe,gi):gi}if(typeof fe=="bigint"){var ms=String(fe)+"n";return _s?P(fe,ms):ms}var Br=typeof ut.depth>"u"?5:ut.depth;if(typeof Dt>"u"&&(Dt=0),Dt>=Br&&Br>0&&typeof fe=="object")return pe(fe)?"[Array]":"[Object]";var Zi=Bi(ut,Dt);if(typeof Yt>"u")Yt=[];else if(Se(Yt,fe)>=0)return"[Circular]";function $i(V,S,E){if(S&&(Yt=I.call(Yt),Yt.push(S)),E){var G={depth:ut.depth};return ce(ut,"quoteStyle")&&(G.quoteStyle=ut.quoteStyle),le(V,G,Dt+1,Yt)}return le(V,ut,Dt+1,Yt)}if(typeof fe=="function"&&!Ie(fe)){var Sa=oe(fe),_a=Qt(fe,$i);return"[Function"+(Sa?": "+Sa:" (anonymous)")+"]"+(_a.length>0?" { "+C.call(_a,", ")+" }":"")}if(q(fe)){var Ta=L?v.call(String(fe),/^(Symbol\(.*\))_[^)]*$/,"$1"):B.call(fe);return typeof fe=="object"&&!L?St(Ta):Ta}if(mt(fe)){for(var Gs="<"+x.call(String(fe.nodeName)),Hs=fe.attributes||[],Ts=0;Ts<Hs.length;Ts++)Gs+=" "+Hs[Ts].name+"="+se(Q(Hs[Ts].value),"double",ut);return Gs+=">",fe.childNodes&&fe.childNodes.length&&(Gs+="..."),Gs+="</"+x.call(String(fe.nodeName))+">",Gs}if(pe(fe)){if(fe.length===0)return"[]";var Lr=Qt(fe,$i);return Zi&&!pi(Lr)?"["+Ss(Lr,Zi)+"]":"[ "+C.call(Lr,", ")+" ]"}if(ge(fe)){var Mn=Qt(fe,$i);return!("cause"in Error.prototype)&&"cause"in fe&&!O.call(fe,"cause")?"{ ["+String(fe)+"] "+C.call(T.call("[cause]: "+$i(fe.cause),Mn),", ")+" }":Mn.length===0?"["+String(fe)+"]":"{ ["+String(fe)+"] "+C.call(Mn,", ")+" }"}if(typeof fe=="object"&&fs){if(X&&typeof fe[X]=="function"&&U)return U(fe,{depth:Br-Dt});if(fs!=="symbol"&&typeof fe.inspect=="function")return fe.inspect()}if(ue(fe)){var nr=[];return i&&i.call(fe,function(V,S){nr.push($i(S,fe,!0)+" => "+$i(V,fe))}),Ti("Map",t.call(fe),nr,Zi)}if(Fe(fe)){var j=[];return o&&o.call(fe,function(V){j.push($i(V,fe))}),Ti("Set",a.call(fe),j,Zi)}if(ke(fe))return Xt("WeakMap");if(Ze(fe))return Xt("WeakSet");if(Re(fe))return Xt("WeakRef");if(H(fe))return St($i(Number(fe)));if(W(fe))return St($i(R.call(fe)));if(Z(fe))return St(p.call(fe));if(Ee(fe))return St($i(String(fe)));if(typeof window<"u"&&fe===window)return"{ [object Window] }";if(typeof globalThis<"u"&&fe===globalThis||typeof Gc<"u"&&fe===Gc)return"{ [object globalThis] }";if(!Me(fe)&&!Ie(fe)){var $=Qt(fe,$i),J=D?D(fe)===Object.prototype:fe instanceof Object||fe.constructor===Object,te=fe instanceof Object?"":"null prototype",he=!J&&Y&&Object(fe)===fe&&Y in fe?w.call(xe(fe),8,-1):te?"Object":"",ye=J||typeof fe.constructor!="function"?"":fe.constructor.name?fe.constructor.name+" ":"",Te=ye+(he||te?"["+C.call(T.call([],he||[],te||[]),": ")+"] ":"");return $.length===0?Te+"{}":Zi?Te+"{"+Ss($,Zi)+"}":Te+"{ "+C.call($,", ")+" }"}return String(fe)};function se(le,fe,bt){var Dt=bt.quoteStyle||fe,Yt=K[Dt];return Yt+le+Yt}function Q(le){return v.call(String(le),/"/g,""")}function me(le){return!Y||!(typeof le=="object"&&(Y in le||typeof le[Y]<"u"))}function pe(le){return xe(le)==="[object Array]"&&me(le)}function Me(le){return xe(le)==="[object Date]"&&me(le)}function Ie(le){return xe(le)==="[object RegExp]"&&me(le)}function ge(le){return xe(le)==="[object Error]"&&me(le)}function Ee(le){return xe(le)==="[object String]"&&me(le)}function H(le){return xe(le)==="[object Number]"&&me(le)}function Z(le){return xe(le)==="[object Boolean]"&&me(le)}function q(le){if(L)return le&&typeof le=="object"&&le instanceof Symbol;if(typeof le=="symbol")return!0;if(!le||typeof le!="object"||!B)return!1;try{return B.call(le),!0}catch{}return!1}function W(le){if(!le||typeof le!="object"||!R)return!1;try{return R.call(le),!0}catch{}return!1}var ee=Object.prototype.hasOwnProperty||function(le){return le in this};function ce(le,fe){return ee.call(le,fe)}function xe(le){return m.call(le)}function oe(le){if(le.name)return le.name;var fe=y.call(g.call(le),/^function\s*([\w$]+)/);return fe?fe[1]:null}function Se(le,fe){if(le.indexOf)return le.indexOf(fe);for(var bt=0,Dt=le.length;bt<Dt;bt++)if(le[bt]===fe)return bt;return-1}function ue(le){if(!t||!le||typeof le!="object")return!1;try{t.call(le);try{a.call(le)}catch{return!0}return le instanceof Map}catch{}return!1}function ke(le){if(!l||!le||typeof le!="object")return!1;try{l.call(le,l);try{u.call(le,u)}catch{return!0}return le instanceof WeakMap}catch{}return!1}function Re(le){if(!f||!le||typeof le!="object")return!1;try{return f.call(le),!0}catch{}return!1}function Fe(le){if(!a||!le||typeof le!="object")return!1;try{a.call(le);try{t.call(le)}catch{return!0}return le instanceof Set}catch{}return!1}function Ze(le){if(!u||!le||typeof le!="object")return!1;try{u.call(le,u);try{l.call(le,l)}catch{return!0}return le instanceof WeakSet}catch{}return!1}function mt(le){return!le||typeof le!="object"?!1:typeof HTMLElement<"u"&&le instanceof HTMLElement?!0:typeof le.nodeName=="string"&&typeof le.getAttribute=="function"}function wt(le,fe){if(le.length>fe.maxStringLength){var bt=le.length-fe.maxStringLength,Dt="... "+bt+" more character"+(bt>1?"s":"");return wt(w.call(le,0,fe.maxStringLength),fe)+Dt}var Yt=z[fe.quoteStyle||"single"];Yt.lastIndex=0;var ut=v.call(v.call(le,Yt,"\\$1"),/[\x00-\x1f]/g,ht);return se(ut,"single",fe)}function ht(le){var fe=le.charCodeAt(0),bt={8:"b",9:"t",10:"n",12:"f",13:"r"}[fe];return bt?"\\"+bt:"\\x"+(fe<16?"0":"")+_.call(fe.toString(16))}function St(le){return"Object("+le+")"}function Xt(le){return le+" { ? }"}function Ti(le,fe,bt,Dt){var Yt=Dt?Ss(bt,Dt):C.call(bt,", ");return le+" ("+fe+") {"+Yt+"}"}function pi(le){for(var fe=0;fe<le.length;fe++)if(Se(le[fe],`
|
||
`)>=0)return!1;return!0}function Bi(le,fe){var bt;if(le.indent===" ")bt=" ";else if(typeof le.indent=="number"&&le.indent>0)bt=C.call(Array(le.indent+1)," ");else return null;return{base:bt,prev:C.call(Array(fe+1),bt)}}function Ss(le,fe){if(le.length===0)return"";var bt=`
|
||
`+fe.prev+fe.base;return bt+C.call(le,","+bt)+`
|
||
`+fe.prev}function Qt(le,fe){var bt=pe(le),Dt=[];if(bt){Dt.length=le.length;for(var Yt=0;Yt<le.length;Yt++)Dt[Yt]=ce(le,Yt)?fe(le[Yt],le):""}var ut=typeof F=="function"?F(le):[],fs;if(L){fs={};for(var _s=0;_s<ut.length;_s++)fs["$"+ut[_s]]=ut[_s]}for(var gi in le)ce(le,gi)&&(bt&&String(Number(gi))===gi&&gi<le.length||L&&fs["$"+gi]instanceof Symbol||(M.call(/[^\w$]/,gi)?Dt.push(fe(gi,le)+": "+fe(le[gi],le)):Dt.push(gi+": "+fe(le[gi],le))));if(typeof F=="function")for(var ms=0;ms<ut.length;ms++)O.call(le,ut[ms])&&Dt.push("["+fe(ut[ms])+"]: "+fe(le[ut[ms]],le));return Dt}return _u}var Tu,ug;function AT(){if(ug)return Tu;ug=1;var n=Vh(),e=bo(),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}},s=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 Tu=function(){var h,l={assert:function(c){if(!l.has(c))throw new e("Side channel does not contain "+n(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}),s(h,c,u)}};return l},Tu}var Mu,dg;function Wy(){return dg||(dg=1,Mu=Object),Mu}var Eu,fg;function CT(){return fg||(fg=1,Eu=Error),Eu}var Au,mg;function IT(){return mg||(mg=1,Au=EvalError),Au}var Cu,pg;function RT(){return pg||(pg=1,Cu=RangeError),Cu}var Iu,gg;function PT(){return gg||(gg=1,Iu=ReferenceError),Iu}var Ru,vg;function kT(){return vg||(vg=1,Ru=SyntaxError),Ru}var Pu,yg;function FT(){return yg||(yg=1,Pu=URIError),Pu}var ku,xg;function OT(){return xg||(xg=1,ku=Math.abs),ku}var Fu,bg;function BT(){return bg||(bg=1,Fu=Math.floor),Fu}var Ou,wg;function LT(){return wg||(wg=1,Ou=Math.max),Ou}var Bu,Sg;function DT(){return Sg||(Sg=1,Bu=Math.min),Bu}var Lu,_g;function NT(){return _g||(_g=1,Lu=Math.pow),Lu}var Du,Tg;function UT(){return Tg||(Tg=1,Du=Math.round),Du}var Nu,Mg;function XT(){return Mg||(Mg=1,Nu=Number.isNaN||function(e){return e!==e}),Nu}var Uu,Eg;function YT(){if(Eg)return Uu;Eg=1;var n=XT();return Uu=function(t){return n(t)||t===0?t:t<0?-1:1},Uu}var Xu,Ag;function VT(){return Ag||(Ag=1,Xu=Object.getOwnPropertyDescriptor),Xu}var Yu,Cg;function zy(){if(Cg)return Yu;Cg=1;var n=VT();if(n)try{n([],"length")}catch{n=null}return Yu=n,Yu}var Vu,Ig;function qy(){if(Ig)return Vu;Ig=1;var n=Object.defineProperty||!1;if(n)try{n({},"a",{value:1})}catch{n=!1}return Vu=n,Vu}var $u,Rg;function $T(){return Rg||(Rg=1,$u=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 s=42;e[t]=s;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!==s||o.enumerable!==!0)return!1}return!0}),$u}var Gu,Pg;function GT(){if(Pg)return Gu;Pg=1;var n=typeof Symbol<"u"&&Symbol,e=$T();return Gu=function(){return typeof n!="function"||typeof Symbol!="function"||typeof n("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:e()},Gu}var Hu,kg;function Ky(){return kg||(kg=1,Hu=typeof Reflect<"u"&&Reflect.getPrototypeOf||null),Hu}var ju,Fg;function Zy(){if(Fg)return ju;Fg=1;var n=Wy();return ju=n.getPrototypeOf||null,ju}var Wu,Og;function HT(){if(Og)return Wu;Og=1;var n="Function.prototype.bind called on incompatible ",e=Object.prototype.toString,t=Math.max,i="[object Function]",s=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 Wu=function(h){var l=this;if(typeof l!="function"||e.apply(l)!==i)throw new TypeError(n+l);for(var c=r(arguments,1),u,d=function(){if(this instanceof u){var y=l.apply(this,s(c,arguments));return Object(y)===y?y:this}return l.apply(h,s(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},Wu}var zu,Bg;function $h(){if(Bg)return zu;Bg=1;var n=HT();return zu=Function.prototype.bind||n,zu}var qu,Lg;function Lm(){return Lg||(Lg=1,qu=Function.prototype.call),qu}var Ku,Dg;function Jy(){return Dg||(Dg=1,Ku=Function.prototype.apply),Ku}var Zu,Ng;function jT(){return Ng||(Ng=1,Zu=typeof Reflect<"u"&&Reflect&&Reflect.apply),Zu}var Ju,Ug;function WT(){if(Ug)return Ju;Ug=1;var n=$h(),e=Jy(),t=Lm(),i=jT();return Ju=i||n.call(t,e),Ju}var Qu,Xg;function Qy(){if(Xg)return Qu;Xg=1;var n=$h(),e=bo(),t=Lm(),i=WT();return Qu=function(r){if(r.length<1||typeof r[0]!="function")throw new e("a function is required");return i(n,t,r)},Qu}var ed,Yg;function zT(){if(Yg)return ed;Yg=1;var n=Qy(),e=zy(),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__"),s=Object,r=s.getPrototypeOf;return ed=i&&typeof i.get=="function"?n([i.get]):typeof r=="function"?function(o){return r(o==null?o:s(o))}:!1,ed}var td,Vg;function qT(){if(Vg)return td;Vg=1;var n=Ky(),e=Zy(),t=zT();return td=n?function(s){return n(s)}:e?function(s){if(!s||typeof s!="object"&&typeof s!="function")throw new TypeError("getProto: not an object");return e(s)}:t?function(s){return t(s)}:null,td}var id,$g;function KT(){if($g)return id;$g=1;var n=Function.prototype.call,e=Object.prototype.hasOwnProperty,t=$h();return id=t.call(n,e),id}var sd,Gg;function Dm(){if(Gg)return sd;Gg=1;var n,e=Wy(),t=CT(),i=IT(),s=RT(),r=PT(),a=kT(),o=bo(),h=FT(),l=OT(),c=BT(),u=LT(),d=DT(),f=NT(),p=UT(),m=YT(),g=Function,y=function(Ie){try{return g('"use strict"; return ('+Ie+").constructor;")()}catch{}},w=zy(),v=qy(),_=function(){throw new o},x=w?(function(){try{return arguments.callee,_}catch{try{return w(arguments,"callee").get}catch{return _}}})():_,M=GT()(),T=qT(),C=Zy(),I=Ky(),k=Jy(),R=Lm(),F={},B=typeof Uint8Array>"u"||!T?n:T(Uint8Array),L={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?n:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?n:ArrayBuffer,"%ArrayIteratorPrototype%":M&&T?T([][Symbol.iterator]()):n,"%AsyncFromSyncIteratorPrototype%":n,"%AsyncFunction%":F,"%AsyncGenerator%":F,"%AsyncGeneratorFunction%":F,"%AsyncIteratorPrototype%":F,"%Atomics%":typeof Atomics>"u"?n:Atomics,"%BigInt%":typeof BigInt>"u"?n:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?n:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?n:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?n:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":t,"%eval%":eval,"%EvalError%":i,"%Float16Array%":typeof Float16Array>"u"?n:Float16Array,"%Float32Array%":typeof Float32Array>"u"?n:Float32Array,"%Float64Array%":typeof Float64Array>"u"?n:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?n:FinalizationRegistry,"%Function%":g,"%GeneratorFunction%":F,"%Int8Array%":typeof Int8Array>"u"?n:Int8Array,"%Int16Array%":typeof Int16Array>"u"?n:Int16Array,"%Int32Array%":typeof Int32Array>"u"?n:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":M&&T?T(T([][Symbol.iterator]())):n,"%JSON%":typeof JSON=="object"?JSON:n,"%Map%":typeof Map>"u"?n:Map,"%MapIteratorPrototype%":typeof Map>"u"||!M||!T?n:T(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":e,"%Object.getOwnPropertyDescriptor%":w,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?n:Promise,"%Proxy%":typeof Proxy>"u"?n:Proxy,"%RangeError%":s,"%ReferenceError%":r,"%Reflect%":typeof Reflect>"u"?n:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?n:Set,"%SetIteratorPrototype%":typeof Set>"u"||!M||!T?n:T(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?n:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":M&&T?T(""[Symbol.iterator]()):n,"%Symbol%":M?Symbol:n,"%SyntaxError%":a,"%ThrowTypeError%":x,"%TypedArray%":B,"%TypeError%":o,"%Uint8Array%":typeof Uint8Array>"u"?n:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?n:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?n:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?n:Uint32Array,"%URIError%":h,"%WeakMap%":typeof WeakMap>"u"?n:WeakMap,"%WeakRef%":typeof WeakRef>"u"?n:WeakRef,"%WeakSet%":typeof WeakSet>"u"?n:WeakSet,"%Function.prototype.call%":R,"%Function.prototype.apply%":k,"%Object.defineProperty%":v,"%Object.getPrototypeOf%":C,"%Math.abs%":l,"%Math.floor%":c,"%Math.max%":u,"%Math.min%":d,"%Math.pow%":f,"%Math.round%":p,"%Math.sign%":m,"%Reflect.getPrototypeOf%":I};if(T)try{null.error}catch(Ie){var Y=T(T(Ie));L["%Error.prototype%"]=Y}var O=function Ie(ge){var Ee;if(ge==="%AsyncFunction%")Ee=y("async function () {}");else if(ge==="%GeneratorFunction%")Ee=y("function* () {}");else if(ge==="%AsyncGeneratorFunction%")Ee=y("async function* () {}");else if(ge==="%AsyncGenerator%"){var H=Ie("%AsyncGeneratorFunction%");H&&(Ee=H.prototype)}else if(ge==="%AsyncIteratorPrototype%"){var Z=Ie("%AsyncGenerator%");Z&&T&&(Ee=T(Z.prototype))}return L[ge]=Ee,Ee},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"]},P=$h(),U=KT(),N=P.call(R,Array.prototype.concat),X=P.call(k,Array.prototype.splice),K=P.call(R,String.prototype.replace),z=P.call(R,String.prototype.slice),se=P.call(R,RegExp.prototype.exec),Q=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,me=/\\(\\)?/g,pe=function(ge){var Ee=z(ge,0,1),H=z(ge,-1);if(Ee==="%"&&H!=="%")throw new a("invalid intrinsic syntax, expected closing `%`");if(H==="%"&&Ee!=="%")throw new a("invalid intrinsic syntax, expected opening `%`");var Z=[];return K(ge,Q,function(q,W,ee,ce){Z[Z.length]=ee?K(ce,me,"$1"):W||q}),Z},Me=function(ge,Ee){var H=ge,Z;if(U(D,H)&&(Z=D[H],H="%"+Z[0]+"%"),U(L,H)){var q=L[H];if(q===F&&(q=O(H)),typeof q>"u"&&!Ee)throw new o("intrinsic "+ge+" exists, but is not available. Please file an issue!");return{alias:Z,name:H,value:q}}throw new a("intrinsic "+ge+" does not exist!")};return sd=function(ge,Ee){if(typeof ge!="string"||ge.length===0)throw new o("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof Ee!="boolean")throw new o('"allowMissing" argument must be a boolean');if(se(/^%?[^%]*%?$/,ge)===null)throw new a("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var H=pe(ge),Z=H.length>0?H[0]:"",q=Me("%"+Z+"%",Ee),W=q.name,ee=q.value,ce=!1,xe=q.alias;xe&&(Z=xe[0],X(H,N([0,1],xe)));for(var oe=1,Se=!0;oe<H.length;oe+=1){var ue=H[oe],ke=z(ue,0,1),Re=z(ue,-1);if((ke==='"'||ke==="'"||ke==="`"||Re==='"'||Re==="'"||Re==="`")&&ke!==Re)throw new a("property names with quotes must have matching quotes");if((ue==="constructor"||!Se)&&(ce=!0),Z+="."+ue,W="%"+Z+"%",U(L,W))ee=L[W];else if(ee!=null){if(!(ue in ee)){if(!Ee)throw new o("base intrinsic for "+ge+" exists, but the property is not available.");return}if(w&&oe+1>=H.length){var Fe=w(ee,ue);Se=!!Fe,Se&&"get"in Fe&&!("originalValue"in Fe.get)?ee=Fe.get:ee=ee[ue]}else Se=U(ee,ue),ee=ee[ue];Se&&!ce&&(L[W]=ee)}}return ee},sd}var nd,Hg;function ex(){if(Hg)return nd;Hg=1;var n=Dm(),e=Qy(),t=e([n("%String.prototype.indexOf%")]);return nd=function(s,r){var a=n(s,!!r);return typeof a=="function"&&t(s,".prototype.")>-1?e([a]):a},nd}var rd,jg;function tx(){if(jg)return rd;jg=1;var n=Dm(),e=ex(),t=Vh(),i=bo(),s=n("%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 rd=!!s&&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 s),a(u,f,p)}};return d},rd}var ad,Wg;function ZT(){if(Wg)return ad;Wg=1;var n=Dm(),e=ex(),t=Vh(),i=tx(),s=bo(),r=n("%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 ad=r?function(){var u,d,f={assert:function(p){if(!f.has(p))throw new s("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,ad}var od,zg;function ix(){if(zg)return od;zg=1;var n=bo(),e=Vh(),t=AT(),i=tx(),s=ZT(),r=s||i||t;return od=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 n("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},od}var ld,qg;function Nm(){if(qg)return ld;qg=1;var n=String.prototype.replace,e=/%20/g,t={RFC1738:"RFC1738",RFC3986:"RFC3986"};return ld={default:t.RFC3986,formatters:{RFC1738:function(i){return n.call(i,e,"+")},RFC3986:function(i){return String(i)}},RFC1738:t.RFC1738,RFC3986:t.RFC3986},ld}var cd,Kg;function sx(){if(Kg)return cd;Kg=1;var n=Nm(),e=ix(),t=qy(),i=Object.prototype.hasOwnProperty,s=Array.isArray,r=e(),a=function(I,k){return r.set(I,k),I},o=function(I){return r.has(I)},h=function(I){return r.get(I)},l=function(I,k){r.set(I,k)},c=(function(){for(var C=[],I=0;I<256;++I)C[C.length]="%"+((I<16?"0":"")+I.toString(16)).toUpperCase();return C})(),u=function(I){for(;I.length>1;){var k=I.pop(),R=k.obj[k.prop];if(s(R)){for(var F=[],B=0;B<R.length;++B)typeof R[B]<"u"&&(F[F.length]=R[B]);k.obj[k.prop]=F}}},d=function(I,k){for(var R=k&&k.plainObjects?{__proto__:null}:{},F=0;F<I.length;++F)typeof I[F]<"u"&&(R[F]=I[F]);return R},f=function(I,k,R){k==="__proto__"&&t?t(I,k,{configurable:!0,enumerable:!0,value:R,writable:!0}):I[k]=R},p=function C(I,k,R){if(!k)return I;if(typeof k!="object"&&typeof k!="function"){if(s(I)){var F=I.length;if(R&&typeof R.arrayLimit=="number"&&F>=R.arrayLimit){if(R.throwOnLimitExceeded)throw new RangeError("Array limit exceeded. Only "+R.arrayLimit+" element"+(R.arrayLimit===1?"":"s")+" allowed in an array.");return a(d(I.concat(k),R),F)}I[F]=k}else if(I&&typeof I=="object")if(o(I)){var B=h(I)+1;I[B]=k,l(I,B)}else{if(R&&R.strictMerge)return[I,k];(R&&(R.plainObjects||R.allowPrototypes)||!i.call(Object.prototype,k))&&(I[k]=!0)}else return[I,k];return I}if(!I||typeof I!="object"){if(o(k)){for(var L=Object.keys(k),Y=R&&R.plainObjects?{__proto__:null,0:I}:{0:I},O=0;O<L.length;O++){var D=parseInt(L[O],10);Y[D+1]=k[L[O]]}return a(Y,h(k)+1)}var P=[I].concat(k);if(R&&typeof R.arrayLimit=="number"&&P.length>R.arrayLimit){if(R.throwOnLimitExceeded)throw new RangeError("Array limit exceeded. Only "+R.arrayLimit+" element"+(R.arrayLimit===1?"":"s")+" allowed in an array.");return a(d(P,R),P.length-1)}return P}var U=I;if(s(I)&&!s(k)&&(U=d(I,R)),s(I)&&s(k)){if(k.forEach(function(N,X){if(i.call(I,X)){var K=I[X];K&&typeof K=="object"&&N&&typeof N=="object"?I[X]=C(K,N,R):I[I.length]=N}else I[X]=N}),R&&typeof R.arrayLimit=="number"&&I.length>R.arrayLimit){if(R.throwOnLimitExceeded)throw new RangeError("Array limit exceeded. Only "+R.arrayLimit+" element"+(R.arrayLimit===1?"":"s")+" allowed in an array.");return a(d(I,R),I.length-1)}return I}return Object.keys(k).reduce(function(N,X){var K=k[X];if(i.call(N,X)?f(N,X,C(N[X],K,R)):f(N,X,K),o(k)&&!o(N)&&a(N,h(k)),o(N)){var z=parseInt(X,10);String(z)===X&&z>=0&&z>h(N)&&l(N,z)}return N},U)},m=function(I,k){return Object.keys(k).reduce(function(R,F){return f(R,F,k[F]),R},I)},g=function(C,I,k){var R=C.replace(/\+/g," ");if(k==="iso-8859-1")return R.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(R)}catch{return R}},y=1024,w=function(I,k,R,F,B){if(I.length===0)return I;var L=I;if(typeof I=="symbol"?L=Symbol.prototype.toString.call(I):typeof I!="string"&&(L=String(I)),R==="iso-8859-1")return escape(L).replace(/%u[0-9a-f]{4}/gi,function(K){return"%26%23"+parseInt(K.slice(2),16)+"%3B"});for(var Y="",O=0;O<L.length;O+=y){var D=L.length>=y?L.slice(O,O+y):L;if(O+y<L.length){var P=D.charCodeAt(D.length-1);P>=55296&&P<=56319&&(D=D.slice(0,-1),O-=1)}for(var U=[],N=0;N<D.length;++N){var X=D.charCodeAt(N);if(X===45||X===46||X===95||X===126||X>=48&&X<=57||X>=65&&X<=90||X>=97&&X<=122||B===n.RFC1738&&(X===40||X===41)){U[U.length]=D.charAt(N);continue}if(X<128){U[U.length]=c[X];continue}if(X<2048){U[U.length]=c[192|X>>6]+c[128|X&63];continue}if(X<55296||X>=57344){U[U.length]=c[224|X>>12]+c[128|X>>6&63]+c[128|X&63];continue}N+=1,X=65536+((X&1023)<<10|D.charCodeAt(N)&1023),U[U.length]=c[240|X>>18]+c[128|X>>12&63]+c[128|X>>6&63]+c[128|X&63]}Y+=U.join("")}return Y},v=function(I){for(var k=[{obj:{o:I},prop:"o"}],R=e(),F=0;F<k.length;++F)for(var B=k[F],L=B.obj[B.prop],Y=Object.keys(L),O=0;O<Y.length;++O){var D=Y[O],P=L[D];typeof P=="object"&&P!==null&&!R.has(P)&&(k[k.length]={obj:L,prop:D},R.set(P,!0))}return u(k),I},_=function(I){return Object.prototype.toString.call(I)==="[object RegExp]"},x=function(I){return!I||typeof I!="object"?!1:!!(I.constructor&&I.constructor.isBuffer&&I.constructor.isBuffer(I))},M=function(I,k,R,F,B){if(o(I)){if(B)throw new RangeError("Array limit exceeded. Only "+R+" element"+(R===1?"":"s")+" allowed in an array.");var L=h(I)+1;return I[L]=k,l(I,L),I}var Y=[].concat(I,k);if(Y.length>R){if(B)throw new RangeError("Array limit exceeded. Only "+R+" element"+(R===1?"":"s")+" allowed in an array.");return a(d(Y,{plainObjects:F}),Y.length-1)}return Y},T=function(I,k){if(s(I)){for(var R=[],F=0;F<I.length;F+=1)R[R.length]=k(I[F]);return R}return k(I)};return cd={arrayToObject:d,assign:m,combine:M,compact:v,decode:g,encode:w,isBuffer:x,isOverflow:o,isRegExp:_,markOverflow:a,maybeMap:T,merge:p},cd}var hd,Zg;function JT(){if(Zg)return hd;Zg=1;var n=ix(),e=sx(),t=Nm(),i=Object.prototype.hasOwnProperty,s={brackets:function(g){return g+"[]"},comma:"comma",indices:function(g,y){return g+"["+y+"]"},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,y,w,v,_,x,M,T,C,I,k,R,F,B,L,Y,O,D){for(var P=g,U=D,N=0,X=!1;(U=U.get(d))!==void 0&&!X;){var K=U.get(g);if(N+=1,typeof K<"u"){if(K===N)throw new RangeError("Cyclic object value");X=!0}typeof U.get(d)>"u"&&(N=0)}if(typeof I=="function"?P=I(y,P):P instanceof Date?P=F(P):w==="comma"&&r(P)&&(P=e.maybeMap(P,function(W){return W instanceof Date?F(W):W})),P===null){if(x)return L(C&&!Y?C(y,c.encoder,O,"key",B):y);P=""}if(u(P)||e.isBuffer(P)){if(C){var z=Y?y:C(y,c.encoder,O,"key",B);return[L(z)+"="+L(C(P,c.encoder,O,"value",B))]}return[L(y)+"="+L(String(P))]}var se=[];if(typeof P>"u")return se;var Q;if(w==="comma"&&r(P))Y&&C&&(P=e.maybeMap(P,function(W){return W==null?W:C(W)})),Q=[{value:P.length>0?P.join(",")||null:void 0}];else if(r(I))Q=I;else{var me=Object.keys(P);Q=k?me.sort(k):me}var pe=T?String(y).replace(/\./g,"%2E"):String(y),Me=v&&r(P)&&P.length===1?pe+"[]":pe;if(_&&r(P)&&P.length===0)return Me+"[]";for(var Ie=0;Ie<Q.length;++Ie){var ge=Q[Ie],Ee=typeof ge=="object"&&ge&&typeof ge.value<"u"?ge.value:P[ge];if(!(M&&Ee===null)){var H=R&&T?String(ge).replace(/\./g,"%2E"):String(ge),Z=r(P)?typeof w=="function"?w(Me,H):Me:Me+(R?"."+H:"["+H+"]");D.set(g,N);var q=n();q.set(d,D),o(se,m(Ee,Z,w,v,_,x,M,T,w==="comma"&&Y&&r(P)?null:C,I,k,R,F,B,L,Y,O,q))}}return se},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 y=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 w=t.default;if(typeof g.format<"u"){if(!i.call(t.formatters,g.format))throw new TypeError("Unknown format option provided.");w=g.format}var v=t.formatters[w],_=c.filter;(typeof g.filter=="function"||r(g.filter))&&(_=g.filter);var x;if(g.arrayFormat in s?x=g.arrayFormat:"indices"in g?x=g.indices?"indices":"repeat":x=c.arrayFormat,"commaRoundTrip"in g&&typeof g.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var M=typeof g.allowDots>"u"?g.encodeDotInKeys===!0?!0:c.allowDots:!!g.allowDots;return{addQueryPrefix:typeof g.addQueryPrefix=="boolean"?g.addQueryPrefix:c.addQueryPrefix,allowDots:M,allowEmptyArrays:typeof g.allowEmptyArrays=="boolean"?!!g.allowEmptyArrays:c.allowEmptyArrays,arrayFormat:x,charset:y,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:_,format:w,formatter:v,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 hd=function(m,g){var y=m,w=p(g),v,_;typeof w.filter=="function"?(_=w.filter,y=_("",y)):r(w.filter)&&(_=w.filter,v=_);var x=[];if(typeof y!="object"||y===null)return"";var M=s[w.arrayFormat],T=M==="comma"&&w.commaRoundTrip;v||(v=Object.keys(y)),w.sort&&v.sort(w.sort);for(var C=n(),I=0;I<v.length;++I){var k=v[I];if(!(typeof k>"u"||k===null)){var R=y[k];w.skipNulls&&R===null||o(x,f(R,k,M,T,w.allowEmptyArrays,w.strictNullHandling,w.skipNulls,w.encodeDotInKeys,w.encode?w.encoder:null,w.filter,w.sort,w.allowDots,w.serializeDate,w.format,w.formatter,w.encodeValuesOnly,w.charset,C))}}var F=x.join(w.delimiter),B=w.addQueryPrefix===!0?"?":"";return w.charsetSentinel&&(w.charset==="iso-8859-1"?B+="utf8=%26%2310003%3B"+w.delimiter:B+="utf8=%E2%9C%93"+w.delimiter),F.length>0?B+F:""},hd}var ud,Jg;function QT(){if(Jg)return ud;Jg=1;var n=sx(),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:n.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictDepth:!1,strictMerge:!0,strictNullHandling:!1,throwOnLimitExceeded:!1},s=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 y=0,w=f.indexOf(",");w>-1;){if(y+=1,y>=p.arrayLimit)throw new RangeError("Array limit exceeded. Only "+p.arrayLimit+" element"+(p.arrayLimit===1?"":"s")+" allowed in an array.");w=f.indexOf(",",w+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},y=m.ignoreQueryPrefix?p.replace(/^\?/,""):p;y=y.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var w=m.parameterLimit===1/0?void 0:m.parameterLimit,v=y.split(m.delimiter,m.throwOnLimitExceeded&&typeof w<"u"?w+1:w);if(m.throwOnLimitExceeded&&typeof w<"u"&&v.length>w)throw new RangeError("Parameter limit exceeded. Only "+w+" parameter"+(w===1?"":"s")+" allowed.");var _=-1,x,M=m.charset;if(m.charsetSentinel)for(x=0;x<v.length;++x)v[x].indexOf("utf8=")===0&&(v[x]===o?M="utf-8":v[x]===a&&(M="iso-8859-1"),_=x,x=v.length);for(x=0;x<v.length;++x)if(x!==_){var T=v[x],C=T.indexOf("]="),I=C===-1?T.indexOf("="):C+1,k,R;if(I===-1?(k=m.decoder(T,i.decoder,M,"key"),R=m.strictNullHandling?null:""):(k=m.decoder(T.slice(0,I),i.decoder,M,"key"),k!==null&&(R=n.maybeMap(r(T.slice(I+1),m,t(g[k])?g[k].length:0,T.indexOf("[]=")===-1),function(B){return m.decoder(B,i.decoder,M,"value")}))),R&&m.interpretNumericEntities&&M==="iso-8859-1"&&(R=s(String(R))),T.indexOf("[]=")>-1&&(R=t(R)?[R]:R),m.comma&&t(R)&&R.length>m.arrayLimit&&(R=n.combine([],R,m.arrayLimit,m.plainObjects,m.throwOnLimitExceeded)),k!==null){var F=e.call(g,k);F&&(m.duplicates==="combine"||T.indexOf("[]=")>-1)?g[k]=n.combine(g[k],R,m.arrayLimit,m.plainObjects,m.throwOnLimitExceeded):(!F||m.duplicates==="last")&&(g[k]=R)}}return g},l=function(f,p,m,g){var y=0;if(f.length>0&&f[f.length-1]==="[]"){var w=f.slice(0,-1).join("");y=Array.isArray(p)&&p[w]?p[w].length:0}for(var v=g?p:r(p,m,y),_=f.length-1;_>=0;--_){var x,M=f[_];if(M==="[]"&&m.parseArrays)n.isOverflow(v)?x=v:x=m.allowEmptyArrays&&(v===""||m.strictNullHandling&&v===null)?[]:n.combine([],v,m.arrayLimit,m.plainObjects,m.throwOnLimitExceeded);else{x=m.plainObjects?{__proto__:null}:{};var T=M.charAt(0)==="["&&M.charAt(M.length-1)==="]"?M.slice(1,-1):M,C=m.decodeDotInKeys?T.replace(/%2E/g,"."):T,I=parseInt(C,10),k=!isNaN(I)&&M!==C&&String(I)===C&&I>=0&&m.parseArrays;if(!m.parseArrays&&C==="")x={0:v};else if(k&&I<m.arrayLimit)x=[],x[I]=v;else{if(k&&m.throwOnLimitExceeded)throw new RangeError("Array limit exceeded. Only "+m.arrayLimit+" element"+(m.arrayLimit===1?"":"s")+" allowed in an array.");k?(x[I]=v,n.markOverflow(x,I)):C!=="__proto__"&&(x[C]=v)}}v=x}return v},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 y=[],w=g.indexOf("["),v=w>=0?g.slice(0,w):g;if(v){if(!m.plainObjects&&e.call(Object.prototype,v)&&!m.allowPrototypes)return;y[y.length]=v}for(var _=g.length,x=w,M=0;x>=0&&M<m.depth;){for(var T=1,C=x+1,I=-1;C<_&&I<0;){var k=g.charCodeAt(C);k===91?T+=1:k===93&&(T-=1,T===0&&(I=C)),C+=1}if(I<0)return y[y.length]="["+g.slice(x)+"]",y;var R=g.slice(x,I+1),F=R.slice(1,-1);if(!m.plainObjects&&e.call(Object.prototype,F)&&!m.allowPrototypes)return;y[y.length]=R,M+=1,x=g.indexOf("[",I+1)}if(x>=0){if(m.strictDepth===!0)throw new RangeError("Input depth exceeded depth option of "+m.depth+" and strictDepth is true");y[y.length]="["+g.slice(x)+"]"}return y},u=function(p,m,g,y){if(p){var w=c(p,g);if(w)return l(w,m,g,y)}},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 y=typeof p.allowDots>"u"?p.decodeDotInKeys===!0?!0:i.allowDots:!!p.allowDots;return{allowDots:y,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"||n.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,y=m.plainObjects?{__proto__:null}:{},w=Object.keys(g),v=0;v<w.length;++v){var _=w[v],x=u(_,g[_],m,typeof f=="string");y=n.merge(y,x,m)}return m.allowSparse===!0?y:n.compact(y)},ud}var dd,Qg;function eM(){if(Qg)return dd;Qg=1;var n=JT(),e=QT(),t=Nm();return dd={formats:t,parse:e,stringify:n},dd}var e0;function tM(){if(e0)return Xr;e0=1;var n=_T();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]*$/,s=/^(\/\/?(?!\/)[^?\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=eM();function y(x,M,T){if(x&&typeof x=="object"&&x instanceof e)return x;var C=new e;return C.parse(x,M,T),C}e.prototype.parse=function(x,M,T){if(typeof x!="string")throw new TypeError("Parameter 'url' must be a string, not "+typeof x);var C=x.indexOf("?"),I=C!==-1&&C<x.indexOf("#")?"?":"#",k=x.split(I),R=/\\/g;k[0]=k[0].replace(R,"/"),x=k.join(I);var F=x;if(F=F.trim(),!T&&x.split("#").length===1){var B=s.exec(F);if(B)return this.path=F,this.href=F,this.pathname=B[1],B[2]?(this.search=B[2],M?this.query=g.parse(this.search.substr(1)):this.query=this.search.substr(1)):M&&(this.search="",this.query={}),this}var L=t.exec(F);if(L){L=L[0];var Y=L.toLowerCase();this.protocol=Y,F=F.substr(L.length)}if(T||L||F.match(/^\/\/[^@/]+@[^@/]+/)){var O=F.substr(0,2)==="//";O&&!(L&&p[L])&&(F=F.substr(2),this.slashes=!0)}if(!p[L]&&(O||L&&!m[L])){for(var D=-1,P=0;P<l.length;P++){var U=F.indexOf(l[P]);U!==-1&&(D===-1||U<D)&&(D=U)}var N,X;D===-1?X=F.lastIndexOf("@"):X=F.lastIndexOf("@",D),X!==-1&&(N=F.slice(0,X),F=F.slice(X+1),this.auth=decodeURIComponent(N)),D=-1;for(var P=0;P<h.length;P++){var U=F.indexOf(h[P]);U!==-1&&(D===-1||U<D)&&(D=U)}D===-1&&(D=F.length),this.host=F.slice(0,D),F=F.slice(D),this.parseHost(),this.hostname=this.hostname||"";var K=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!K)for(var z=this.hostname.split(/\./),P=0,se=z.length;P<se;P++){var Q=z[P];if(Q&&!Q.match(u)){for(var me="",pe=0,Me=Q.length;pe<Me;pe++)Q.charCodeAt(pe)>127?me+="x":me+=Q[pe];if(!me.match(u)){var Ie=z.slice(0,P),ge=z.slice(P+1),Ee=Q.match(d);Ee&&(Ie.push(Ee[1]),ge.unshift(Ee[2])),ge.length&&(F="/"+ge.join(".")+F),this.hostname=Ie.join(".");break}}}this.hostname.length>c?this.hostname="":this.hostname=this.hostname.toLowerCase(),K||(this.hostname=n.toASCII(this.hostname));var H=this.port?":"+this.port:"",Z=this.hostname||"";this.host=Z+H,this.href+=this.host,K&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),F[0]!=="/"&&(F="/"+F))}if(!f[Y])for(var P=0,se=o.length;P<se;P++){var q=o[P];if(F.indexOf(q)!==-1){var W=encodeURIComponent(q);W===q&&(W=escape(q)),F=F.split(q).join(W)}}var ee=F.indexOf("#");ee!==-1&&(this.hash=F.substr(ee),F=F.slice(0,ee));var ce=F.indexOf("?");if(ce!==-1?(this.search=F.substr(ce),this.query=F.substr(ce+1),M&&(this.query=g.parse(this.query)),F=F.slice(0,ce)):M&&(this.search="",this.query={}),F&&(this.pathname=F),m[Y]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var H=this.pathname||"",xe=this.search||"";this.path=H+xe}return this.href=this.format(),this};function w(x){return typeof x=="string"&&(x=y(x)),x instanceof e?x.format():e.prototype.format.call(x)}e.prototype.format=function(){var x=this.auth||"";x&&(x=encodeURIComponent(x),x=x.replace(/%3A/i,":"),x+="@");var M=this.protocol||"",T=this.pathname||"",C=this.hash||"",I=!1,k="";this.host?I=x+this.host:this.hostname&&(I=x+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&(I+=":"+this.port)),this.query&&typeof this.query=="object"&&Object.keys(this.query).length&&(k=g.stringify(this.query,{arrayFormat:"repeat",addQueryPrefix:!1}));var R=this.search||k&&"?"+k||"";return M&&M.substr(-1)!==":"&&(M+=":"),this.slashes||(!M||m[M])&&I!==!1?(I="//"+(I||""),T&&T.charAt(0)!=="/"&&(T="/"+T)):I||(I=""),C&&C.charAt(0)!=="#"&&(C="#"+C),R&&R.charAt(0)!=="?"&&(R="?"+R),T=T.replace(/[?#]/g,function(F){return encodeURIComponent(F)}),R=R.replace("#","%23"),M+I+T+R+C};function v(x,M){return y(x,!1,!0).resolve(M)}e.prototype.resolve=function(x){return this.resolveObject(y(x,!1,!0)).format()};function _(x,M){return x?y(x,!1,!0).resolveObject(M):M}return e.prototype.resolveObject=function(x){if(typeof x=="string"){var M=new e;M.parse(x,!1,!0),x=M}for(var T=new e,C=Object.keys(this),I=0;I<C.length;I++){var k=C[I];T[k]=this[k]}if(T.hash=x.hash,x.href==="")return T.href=T.format(),T;if(x.slashes&&!x.protocol){for(var R=Object.keys(x),F=0;F<R.length;F++){var B=R[F];B!=="protocol"&&(T[B]=x[B])}return m[T.protocol]&&T.hostname&&!T.pathname&&(T.pathname="/",T.path=T.pathname),T.href=T.format(),T}if(x.protocol&&x.protocol!==T.protocol){if(!m[x.protocol]){for(var L=Object.keys(x),Y=0;Y<L.length;Y++){var O=L[Y];T[O]=x[O]}return T.href=T.format(),T}if(T.protocol=x.protocol,!x.host&&!p[x.protocol]){for(var se=(x.pathname||"").split("/");se.length&&!(x.host=se.shift()););x.host||(x.host=""),x.hostname||(x.hostname=""),se[0]!==""&&se.unshift(""),se.length<2&&se.unshift(""),T.pathname=se.join("/")}else T.pathname=x.pathname;if(T.search=x.search,T.query=x.query,T.host=x.host||"",T.auth=x.auth,T.hostname=x.hostname||x.host,T.port=x.port,T.pathname||T.search){var D=T.pathname||"",P=T.search||"";T.path=D+P}return T.slashes=T.slashes||x.slashes,T.href=T.format(),T}var U=T.pathname&&T.pathname.charAt(0)==="/",N=x.host||x.pathname&&x.pathname.charAt(0)==="/",X=N||U||T.host&&x.pathname,K=X,z=T.pathname&&T.pathname.split("/")||[],se=x.pathname&&x.pathname.split("/")||[],Q=T.protocol&&!m[T.protocol];if(Q&&(T.hostname="",T.port=null,T.host&&(z[0]===""?z[0]=T.host:z.unshift(T.host)),T.host="",x.protocol&&(x.hostname=null,x.port=null,x.host&&(se[0]===""?se[0]=x.host:se.unshift(x.host)),x.host=null),X=X&&(se[0]===""||z[0]==="")),N)T.host=x.host||x.host===""?x.host:T.host,T.hostname=x.hostname||x.hostname===""?x.hostname:T.hostname,T.search=x.search,T.query=x.query,z=se;else if(se.length)z||(z=[]),z.pop(),z=z.concat(se),T.search=x.search,T.query=x.query;else if(x.search!=null){if(Q){T.host=z.shift(),T.hostname=T.host;var me=T.host&&T.host.indexOf("@")>0?T.host.split("@"):!1;me&&(T.auth=me.shift(),T.hostname=me.shift(),T.host=T.hostname)}return T.search=x.search,T.query=x.query,(T.pathname!==null||T.search!==null)&&(T.path=(T.pathname?T.pathname:"")+(T.search?T.search:"")),T.href=T.format(),T}if(!z.length)return T.pathname=null,T.search?T.path="/"+T.search:T.path=null,T.href=T.format(),T;for(var pe=z.slice(-1)[0],Me=(T.host||x.host||z.length>1)&&(pe==="."||pe==="..")||pe==="",Ie=0,ge=z.length;ge>=0;ge--)pe=z[ge],pe==="."?z.splice(ge,1):pe===".."?(z.splice(ge,1),Ie++):Ie&&(z.splice(ge,1),Ie--);if(!X&&!K)for(;Ie--;Ie)z.unshift("..");X&&z[0]!==""&&(!z[0]||z[0].charAt(0)!=="/")&&z.unshift(""),Me&&z.join("/").substr(-1)!=="/"&&z.push("");var Ee=z[0]===""||z[0]&&z[0].charAt(0)==="/";if(Q){T.hostname=Ee?"":z.length?z.shift():"",T.host=T.hostname;var me=T.host&&T.host.indexOf("@")>0?T.host.split("@"):!1;me&&(T.auth=me.shift(),T.hostname=me.shift(),T.host=T.hostname)}return X=X||T.host&&z.length,X&&!Ee&&z.unshift(""),z.length>0?T.pathname=z.join("/"):(T.pathname=null,T.path=null),(T.pathname!==null||T.search!==null)&&(T.path=(T.pathname?T.pathname:"")+(T.search?T.search:"")),T.auth=x.auth||T.auth,T.slashes=T.slashes||x.slashes,T.href=T.format(),T},e.prototype.parseHost=function(){var x=this.host,M=i.exec(x);M&&(M=M[0],M!==":"&&(this.port=M.substr(1)),x=x.substr(0,x.length-M.length)),x&&(this.hostname=x)},Xr.parse=y,Xr.resolve=v,Xr.resolveObject=_,Xr.format=w,Xr.Url=e,Xr}tM();const t0={};function Mt(n,e,t=3){if(t0[e])return;let i=new Error().stack;typeof i>"u"?console.warn("PixiJS Deprecation Warning: ",`${e}
|
||
Deprecated since v${n}`):(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${n}`),console.warn(i),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",`${e}
|
||
Deprecated since v${n}`),console.warn(i))),t0[e]=!0}function Es(n){if(typeof n!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(n)}`)}function Ro(n){return n.split("?")[0].split("#")[0]}function iM(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function sM(n,e,t){return n.replace(new RegExp(iM(e),"g"),t)}function nM(n,e){let t="",i=0,s=-1,r=0,a=-1;for(let o=0;o<=n.length;++o){if(o<n.length)a=n.charCodeAt(o);else{if(a===47)break;a=47}if(a===47){if(!(s===o-1||r===1))if(s!==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("/")),s=o,r=0;continue}}else if(t.length===2||t.length===1){t="",i=0,s=o,r=0;continue}}}else t.length>0?t+=`/${n.slice(s+1,o)}`:t=n.slice(s+1,o),i=o-s-1;s=o,r=0}else a===46&&r!==-1?++r:r=-1}return t}const li={toPosix(n){return sM(n,"\\","/")},isUrl(n){return/^https?:/.test(this.toPosix(n))},isDataUrl(n){return/^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i.test(n)},isBlobUrl(n){return n.startsWith("blob:")},hasProtocol(n){return/^[^/:]+:/.test(this.toPosix(n))},getProtocol(n){Es(n),n=this.toPosix(n);const e=/^file:\/\/\//.exec(n);if(e)return e[0];const t=/^[^/:]+:\/{0,2}/.exec(n);return t?t[0]:""},toAbsolute(n,e,t){if(Es(n),this.isDataUrl(n)||this.isBlobUrl(n))return n;const i=Ro(this.toPosix(e??$e.ADAPTER.getBaseUrl())),s=Ro(this.toPosix(t??this.rootname(i)));return n=this.toPosix(n),n.startsWith("/")?li.join(s,n.slice(1)):this.isAbsolute(n)?n:this.join(i,n)},normalize(n){if(Es(n),n.length===0)return".";if(this.isDataUrl(n)||this.isBlobUrl(n))return n;n=this.toPosix(n);let e="";const t=n.startsWith("/");this.hasProtocol(n)&&(e=this.rootname(n),n=n.slice(e.length));const i=n.endsWith("/");return n=nM(n),n.length>0&&i&&(n+="/"),t?`/${n}`:e+n},isAbsolute(n){return Es(n),n=this.toPosix(n),this.hasProtocol(n)?!0:n.startsWith("/")},join(...n){if(n.length===0)return".";let e;for(let t=0;t<n.length;++t){const i=n[t];if(Es(i),i.length>0)if(e===void 0)e=i;else{const s=n[t-1]??"";this.joinExtensions.includes(this.extname(s).toLowerCase())?e+=`/../${i}`:e+=`/${i}`}}return e===void 0?".":this.normalize(e)},dirname(n){if(Es(n),n.length===0)return".";n=this.toPosix(n);let e=n.charCodeAt(0);const t=e===47;let i=-1,s=!0;const r=this.getProtocol(n),a=n;n=n.slice(r.length);for(let o=n.length-1;o>=1;--o)if(e=n.charCodeAt(o),e===47){if(!s){i=o;break}}else s=!1;return i===-1?t?"/":this.isUrl(a)?r+n:r:t&&i===1?"//":r+n.slice(0,i)},rootname(n){Es(n),n=this.toPosix(n);let e="";if(n.startsWith("/")?e="/":e=this.getProtocol(n),this.isUrl(n)){const t=n.indexOf("/",e.length);t!==-1?e=n.slice(0,t):e=n,e.endsWith("/")||(e+="/")}return e},basename(n,e){Es(n),e&&Es(e),n=Ro(this.toPosix(n));let t=0,i=-1,s=!0,r;if(e!==void 0&&e.length>0&&e.length<=n.length){if(e.length===n.length&&e===n)return"";let a=e.length-1,o=-1;for(r=n.length-1;r>=0;--r){const h=n.charCodeAt(r);if(h===47){if(!s){t=r+1;break}}else o===-1&&(s=!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=n.length),n.slice(t,i)}for(r=n.length-1;r>=0;--r)if(n.charCodeAt(r)===47){if(!s){t=r+1;break}}else i===-1&&(s=!1,i=r+1);return i===-1?"":n.slice(t,i)},extname(n){Es(n),n=Ro(this.toPosix(n));let e=-1,t=0,i=-1,s=!0,r=0;for(let a=n.length-1;a>=0;--a){const o=n.charCodeAt(a);if(o===47){if(!s){t=a+1;break}continue}i===-1&&(s=!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?"":n.slice(e,i)},parse(n){Es(n);const e={root:"",dir:"",base:"",ext:"",name:""};if(n.length===0)return e;n=Ro(this.toPosix(n));let t=n.charCodeAt(0);const i=this.isAbsolute(n);let s;e.root=this.rootname(n),i||this.hasProtocol(n)?s=1:s=0;let r=-1,a=0,o=-1,h=!0,l=n.length-1,c=0;for(;l>=s;--l){if(t=n.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=n.slice(1,o):e.base=e.name=n.slice(a,o)):(a===0&&i?(e.name=n.slice(1,r),e.base=n.slice(1,o)):(e.name=n.slice(a,r),e.base=n.slice(a,o)),e.ext=n.slice(r,o)),e.dir=this.dirname(n),e},sep:"/",delimiter:":",joinExtensions:[".html"]};let fd;async function rM(){return fd??(fd=(async()=>{var r;const n=document.createElement("canvas").getContext("webgl");if(!n)return Ai.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 Ai.UNPACK;const t=n.createTexture();n.bindTexture(n.TEXTURE_2D,t);const i=n.createFramebuffer();n.bindFramebuffer(n.FRAMEBUFFER,i),n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,t,0),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),n.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,n.NONE),n.texImage2D(n.TEXTURE_2D,0,n.RGBA,n.RGBA,n.UNSIGNED_BYTE,e);const s=new Uint8Array(4);return n.readPixels(0,0,1,1,n.RGBA,n.UNSIGNED_BYTE,s),n.deleteFramebuffer(i),n.deleteTexture(t),(r=n.getExtension("WEBGL_lose_context"))==null||r.loseContext(),s[0]<=s[3]?Ai.PMA:Ai.UNPACK})()),fd}let md;function aM(){return typeof md>"u"&&(md=(function(){var e;const n={stencil:!0,failIfMajorPerformanceCaveat:$e.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT};try{if(!$e.ADAPTER.getWebGLRenderingContext())return!1;const t=$e.ADAPTER.createCanvas();let i=t.getContext("webgl",n)||t.getContext("experimental-webgl",n);const s=!!((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,s}catch{return!1}})()),md}var oM={grad:.9,turn:360,rad:360/(2*Math.PI)},In=function(n){return typeof n=="string"?n.length>0:typeof n=="number"},Ei=function(n,e,t){return e===void 0&&(e=0),t===void 0&&(t=Math.pow(10,e)),Math.round(t*n)/t+0},bs=function(n,e,t){return e===void 0&&(e=0),t===void 0&&(t=1),n>t?t:n>e?n:e},nx=function(n){return(n=isFinite(n)?n%360:0)>0?n:n+360},i0=function(n){return{r:bs(n.r,0,255),g:bs(n.g,0,255),b:bs(n.b,0,255),a:bs(n.a)}},pd=function(n){return{r:Ei(n.r),g:Ei(n.g),b:Ei(n.b),a:Ei(n.a,3)}},lM=/^#([0-9a-f]{3,8})$/i,Vl=function(n){var e=n.toString(16);return e.length<2?"0"+e:e},rx=function(n){var e=n.r,t=n.g,i=n.b,s=n.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:s}},ax=function(n){var e=n.h,t=n.s,i=n.v,s=n.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:s}},s0=function(n){return{h:nx(n.h),s:bs(n.s,0,100),l:bs(n.l,0,100),a:bs(n.a)}},n0=function(n){return{h:Ei(n.h),s:Ei(n.s),l:Ei(n.l),a:Ei(n.a,3)}},r0=function(n){return ax((t=(e=n).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},Qo=function(n){return{h:(e=rx(n)).h,s:(s=(200-(t=e.s))*(i=e.v)/100)>0&&s<200?t*i/100/(s<=100?s:200-s)*100:0,l:s/2,a:e.a};var e,t,i,s},cM=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,hM=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,uM=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,dM=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,uf={string:[[function(n){var e=lM.exec(n);return e?(n=e[1]).length<=4?{r:parseInt(n[0]+n[0],16),g:parseInt(n[1]+n[1],16),b:parseInt(n[2]+n[2],16),a:n.length===4?Ei(parseInt(n[3]+n[3],16)/255,2):1}:n.length===6||n.length===8?{r:parseInt(n.substr(0,2),16),g:parseInt(n.substr(2,2),16),b:parseInt(n.substr(4,2),16),a:n.length===8?Ei(parseInt(n.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(n){var e=uM.exec(n)||dM.exec(n);return e?e[2]!==e[4]||e[4]!==e[6]?null:i0({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(n){var e=cM.exec(n)||hM.exec(n);if(!e)return null;var t,i,s=s0({h:(t=e[1],i=e[2],i===void 0&&(i="deg"),Number(t)*(oM[i]||1)),s:Number(e[3]),l:Number(e[4]),a:e[5]===void 0?1:Number(e[5])/(e[6]?100:1)});return r0(s)},"hsl"]],object:[[function(n){var e=n.r,t=n.g,i=n.b,s=n.a,r=s===void 0?1:s;return In(e)&&In(t)&&In(i)?i0({r:Number(e),g:Number(t),b:Number(i),a:Number(r)}):null},"rgb"],[function(n){var e=n.h,t=n.s,i=n.l,s=n.a,r=s===void 0?1:s;if(!In(e)||!In(t)||!In(i))return null;var a=s0({h:Number(e),s:Number(t),l:Number(i),a:Number(r)});return r0(a)},"hsl"],[function(n){var e=n.h,t=n.s,i=n.v,s=n.a,r=s===void 0?1:s;if(!In(e)||!In(t)||!In(i))return null;var a=(function(o){return{h:nx(o.h),s:bs(o.s,0,100),v:bs(o.v,0,100),a:bs(o.a)}})({h:Number(e),s:Number(t),v:Number(i),a:Number(r)});return ax(a)},"hsv"]]},a0=function(n,e){for(var t=0;t<e.length;t++){var i=e[t][0](n);if(i)return[i,e[t][1]]}return[null,void 0]},fM=function(n){return typeof n=="string"?a0(n.trim(),uf.string):typeof n=="object"&&n!==null?a0(n,uf.object):[null,void 0]},gd=function(n,e){var t=Qo(n);return{h:t.h,s:bs(t.s+100*e,0,100),l:t.l,a:t.a}},vd=function(n){return(299*n.r+587*n.g+114*n.b)/1e3/255},o0=function(n,e){var t=Qo(n);return{h:t.h,s:t.s,l:bs(t.l+100*e,0,100),a:t.a}},df=(function(){function n(e){this.parsed=fM(e)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return n.prototype.isValid=function(){return this.parsed!==null},n.prototype.brightness=function(){return Ei(vd(this.rgba),2)},n.prototype.isDark=function(){return vd(this.rgba)<.5},n.prototype.isLight=function(){return vd(this.rgba)>=.5},n.prototype.toHex=function(){return e=pd(this.rgba),t=e.r,i=e.g,s=e.b,a=(r=e.a)<1?Vl(Ei(255*r)):"","#"+Vl(t)+Vl(i)+Vl(s)+a;var e,t,i,s,r,a},n.prototype.toRgb=function(){return pd(this.rgba)},n.prototype.toRgbString=function(){return e=pd(this.rgba),t=e.r,i=e.g,s=e.b,(r=e.a)<1?"rgba("+t+", "+i+", "+s+", "+r+")":"rgb("+t+", "+i+", "+s+")";var e,t,i,s,r},n.prototype.toHsl=function(){return n0(Qo(this.rgba))},n.prototype.toHslString=function(){return e=n0(Qo(this.rgba)),t=e.h,i=e.s,s=e.l,(r=e.a)<1?"hsla("+t+", "+i+"%, "+s+"%, "+r+")":"hsl("+t+", "+i+"%, "+s+"%)";var e,t,i,s,r},n.prototype.toHsv=function(){return e=rx(this.rgba),{h:Ei(e.h),s:Ei(e.s),v:Ei(e.v),a:Ei(e.a,3)};var e},n.prototype.invert=function(){return zs({r:255-(e=this.rgba).r,g:255-e.g,b:255-e.b,a:e.a});var e},n.prototype.saturate=function(e){return e===void 0&&(e=.1),zs(gd(this.rgba,e))},n.prototype.desaturate=function(e){return e===void 0&&(e=.1),zs(gd(this.rgba,-e))},n.prototype.grayscale=function(){return zs(gd(this.rgba,-1))},n.prototype.lighten=function(e){return e===void 0&&(e=.1),zs(o0(this.rgba,e))},n.prototype.darken=function(e){return e===void 0&&(e=.1),zs(o0(this.rgba,-e))},n.prototype.rotate=function(e){return e===void 0&&(e=15),this.hue(this.hue()+e)},n.prototype.alpha=function(e){return typeof e=="number"?zs({r:(t=this.rgba).r,g:t.g,b:t.b,a:e}):Ei(this.rgba.a,3);var t},n.prototype.hue=function(e){var t=Qo(this.rgba);return typeof e=="number"?zs({h:e,s:t.s,l:t.l,a:t.a}):Ei(t.h)},n.prototype.isEqual=function(e){return this.toHex()===zs(e).toHex()},n})(),zs=function(n){return n instanceof df?n:new df(n)},l0=[],mM=function(n){n.forEach(function(e){l0.indexOf(e)<0&&(e(df,uf),l0.push(e))})};function pM(n,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 s in t)i[t[s]]=s;var r={};n.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 n(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 n(h).toRgb():null},"name"])}mM([pM]);const Da=class wc{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 wc)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((s,r)=>s===t[r]);if(e!==null&&t!==null){const s=Object.keys(e),r=Object.keys(t);return s.length!==r.length?!1:s.every(a=>e[a]===t[a])}return e===t}toRgba(){const[e,t,i,s]=this._components;return{r:e,g:t,b:i,a:s}}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,s]=this._components;return e=e??[],e[0]=Math.round(t*255),e[1]=Math.round(i*255),e[2]=Math.round(s*255),e}toRgbArray(e){e=e??[];const[t,i,s]=this._components;return e[0]=t,e[1]=i,e[2]=s,e}toNumber(){return this._int}toLittleEndianNumber(){const e=this._int;return(e>>16)+(e&65280)+((e&255)<<16)}multiply(e){const[t,i,s,r]=wc.temp.setValue(e)._components;return this._components[0]*=t,this._components[1]*=i,this._components[2]*=s,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,s=this._int>>8&255,r=this._int&255;return t&&(i=i*e+.5|0,s=s*e+.5|0,r=r*e+.5|0),(e*255<<24)+(i<<16)+(s<<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,s]=this._components;return this._components[0]=Math.round(t*e)/e,this._components[1]=Math.round(i*e)/e,this._components[2]=Math.round(s*e)/e,this.refreshInt(),this._value=null,this}toArray(e){e=e??[];const[t,i,s,r]=this._components;return e[0]=t,e[1]=i,e[2]=s,e[3]=r,e}normalize(e){let t,i,s,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,s=(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,s,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,s,r=255]=e,t/=255,i/=255,s/=255,r/=255;else if(typeof e=="string"||typeof e=="object"){if(typeof e=="string"){const o=wc.HEX_PATTERN.exec(e);o&&(e=`#${o[2]}`)}const a=zs(e);a.isValid()&&({r:t,g:i,b:s,a:r}=a.rgba,t/=255,i/=255,s/=255)}if(t!==void 0)this._components[0]=t,this._components[1]=i,this._components[2]=s,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((s,r)=>{e[r]=Math.min(Math.max(s,t),i)}),e)}};Da.shared=new Da,Da.temp=new Da,Da.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;let Lt=Da;function gM(n){return Mt("7.2.0","utils.hex2string is deprecated, use Color#toHex instead"),Lt.shared.setValue(n).toHex()}function vM(n){return Mt("7.2.0","utils.rgb2hex is deprecated, use Color#toNumber instead"),Lt.shared.setValue(n).toNumber()}function yM(){const n=[],e=[];for(let i=0;i<32;i++)n[i]=i,e[i]=i;n[st.NORMAL_NPM]=st.NORMAL,n[st.ADD_NPM]=st.ADD,n[st.SCREEN_NPM]=st.SCREEN,e[st.NORMAL]=st.NORMAL_NPM,e[st.ADD]=st.ADD_NPM,e[st.SCREEN]=st.SCREEN_NPM;const t=[];return t.push(e),t.push(n),t}const ox=yM();function lx(n,e){return ox[e?1:0][n]}function xM(n,e=null){const t=n*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,s=0;i<t;i+=6,s+=4)e[i+0]=s+0,e[i+1]=s+1,e[i+2]=s+2,e[i+3]=s+0,e[i+4]=s+2,e[i+5]=s+3;return e}function cx(n){if(n.BYTES_PER_ELEMENT===4)return n instanceof Float32Array?"Float32Array":n instanceof Uint32Array?"Uint32Array":"Int32Array";if(n.BYTES_PER_ELEMENT===2){if(n instanceof Uint16Array)return"Uint16Array"}else if(n.BYTES_PER_ELEMENT===1&&n instanceof Uint8Array)return"Uint8Array";return null}function Hc(n){return n+=n===0?1:0,--n,n|=n>>>1,n|=n>>>2,n|=n>>>4,n|=n>>>8,n|=n>>>16,n+1}function c0(n){return!(n&n-1)&&!!n}function h0(n){let e=(n>65535?1:0)<<4;n>>>=e;let t=(n>255?1:0)<<3;return n>>>=t,e|=t,t=(n>15?1:0)<<2,n>>>=t,e|=t,t=(n>3?1:0)<<1,n>>>=t,e|=t,e|n>>1}function Ja(n,e,t){const i=n.length;let s;if(e>=i||t===0)return;t=e+t>i?i-e:t;const r=i-t;for(s=e;s<r;++s)n[s]=n[s+t];n.length=r}function _r(n){return n===0?0:n<0?-1:1}let bM=0;function da(){return++bM}const ff=class{constructor(n,e,t,i){this.left=n,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}};ff.EMPTY=new ff(0,0,0,0);let u0=ff;const d0={},qs=Object.create(null),or=Object.create(null);class wM{constructor(e,t,i){this._canvas=$e.ADAPTER.createCanvas(),this._context=this._canvas.getContext("2d"),this.resolution=i||$e.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 f0(n,e,t){for(let i=0,s=4*t*e;i<e;++i,s+=4)if(n[s+3]!==0)return!1;return!0}function m0(n,e,t,i,s){const r=4*e;for(let a=i,o=i*r+4*t;a<=s;++a,o+=r)if(n[o+3]!==0)return!1;return!0}function SM(n){const{width:e,height:t}=n,i=n.getContext("2d",{willReadFrequently:!0});if(i===null)throw new TypeError("Failed to get canvas 2D context");const s=i.getImageData(0,0,e,t).data;let r=0,a=0,o=e-1,h=t-1;for(;a<t&&f0(s,e,a);)++a;if(a===t)return u0.EMPTY;for(;f0(s,e,h);)--h;for(;m0(s,e,r,a,h);)++r;for(;m0(s,e,o,a,h);)--o;return++o,++h,new u0(r,a,o,h)}function _M(n){const e=SM(n),{width:t,height:i}=e;let s=null;if(!e.isEmpty()){const r=n.getContext("2d");if(r===null)throw new TypeError("Failed to get canvas 2D context");s=r.getImageData(e.left,e.top,t,i)}return{width:t,height:i,data:s}}function TM(n,e=globalThis.location){if(n.startsWith("data:"))return"";e=e||globalThis.location;const t=new URL(n,document.baseURI);return t.hostname!==e.hostname||t.port!==e.port||t.protocol!==e.protocol?"anonymous":""}function Qn(n,e=1){var i;const t=(i=$e.RETINA_PREFIX)==null?void 0:i.exec(n);return t?parseFloat(t[1]):e}var Xe=(n=>(n.Renderer="renderer",n.Application="application",n.RendererSystem="renderer-webgl-system",n.RendererPlugin="renderer-webgl-plugin",n.CanvasRendererSystem="renderer-canvas-system",n.CanvasRendererPlugin="renderer-canvas-plugin",n.Asset="asset",n.LoadParser="load-parser",n.ResolveParser="resolve-parser",n.CacheParser="cache-parser",n.DetectionParser="detection-parser",n))(Xe||{});const mf=n=>{if(typeof n=="function"||typeof n=="object"&&n.extension){if(!n.extension)throw new Error("Extension class must have an extension object");n={...typeof n.extension!="object"?{type:n.extension}:n.extension,ref:n}}if(typeof n=="object")n={...n};else throw new Error("Invalid extension type");return typeof n.type=="string"&&(n.type=[n.type]),n},p0=(n,e)=>mf(n).priority??e,ze={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...n){return n.map(mf).forEach(e=>{e.type.forEach(t=>{var i,s;return(s=(i=this._removeHandlers)[t])==null?void 0:s.call(i,e)})}),this},add(...n){return n.map(mf).forEach(e=>{e.type.forEach(t=>{var r,a;const i=this._addHandlers,s=this._queue;i[t]?(r=i[t])==null||r.call(i,e):(s[t]=s[t]||[],(a=s[t])==null||a.push(e))})}),this},handle(n,e,t){var a;const i=this._addHandlers,s=this._removeHandlers;if(i[n]||s[n])throw new Error(`Extension type ${n} already has a handler`);i[n]=e,s[n]=t;const r=this._queue;return r[n]&&((a=r[n])==null||a.forEach(o=>e(o)),delete r[n]),this},handleByMap(n,e){return this.handle(n,t=>{t.name&&(e[t.name]=t.ref)},t=>{t.name&&delete e[t.name]})},handleByList(n,e,t=-1){return this.handle(n,i=>{e.includes(i.ref)||(e.push(i.ref),e.sort((s,r)=>p0(r,t)-p0(s,t)))},i=>{const s=e.indexOf(i.ref);s!==-1&&e.splice(s,1)})}};class pf{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 MM=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(`
|
||
`);function EM(n){let e="";for(let t=0;t<n;++t)t>0&&(e+=`
|
||
else `),t<n-1&&(e+=`if(test == ${t}.0){}`);return e}function AM(n,e){if(n===0)throw new Error("Invalid value of `0` passed to `checkMaxIfStatementsInShader`");const t=e.createShader(e.FRAGMENT_SHADER);for(;;){const i=MM.replace(/%forloop%/gi,EM(n));if(e.shaderSource(t,i),e.compileShader(t),!e.getShaderParameter(t,e.COMPILE_STATUS))n=n/2|0;else break}return n}const yd=0,xd=1,bd=2,wd=3,Sd=4,_d=5;class Sn{constructor(){this.data=0,this.blendMode=st.NORMAL,this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<<yd)}set blend(e){!!(this.data&1<<yd)!==e&&(this.data^=1<<yd)}get offsets(){return!!(this.data&1<<xd)}set offsets(e){!!(this.data&1<<xd)!==e&&(this.data^=1<<xd)}get culling(){return!!(this.data&1<<bd)}set culling(e){!!(this.data&1<<bd)!==e&&(this.data^=1<<bd)}get depthTest(){return!!(this.data&1<<wd)}set depthTest(e){!!(this.data&1<<wd)!==e&&(this.data^=1<<wd)}get depthMask(){return!!(this.data&1<<_d)}set depthMask(e){!!(this.data&1<<_d)!==e&&(this.data^=1<<_d)}get clockwiseFrontFace(){return!!(this.data&1<<Sd)}set clockwiseFrontFace(e){!!(this.data&1<<Sd)!==e&&(this.data^=1<<Sd)}get blendMode(){return this._blendMode}set blendMode(e){this.blend=e!==st.NONE,this._blendMode=e}get polygonOffset(){return this._polygonOffset}set polygonOffset(e){this.offsets=!!e,this._polygonOffset=e}static for2d(){const e=new Sn;return e.depthTest=!1,e.blend=!0,e}}Sn.prototype.toString=function(){return`[@pixi/core:State blendMode=${this.blendMode} clockwiseFrontFace=${this.clockwiseFrontFace} culling=${this.culling} depthMask=${this.depthMask} polygonOffset=${this.polygonOffset}]`};const gf=[];function hx(n,e){if(!n)return null;let t="";if(typeof n=="string"){const i=/\.(\w{3,4})(?:$|\?|#)/i.exec(n);i&&(t=i[1].toLowerCase())}for(let i=gf.length-1;i>=0;--i){const s=gf[i];if(s.test&&s.test(n,t))return new s(n,e)}throw new Error("Unrecognized source type to auto-detect Resource")}class Ns{constructor(e){this.items=[],this._name=e,this._aliasCount=0}emit(e,t,i,s,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,s,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(Ns.prototype,{dispatch:{value:Ns.prototype.emit},run:{value:Ns.prototype.emit}});class pl{constructor(e=0,t=0){this._width=e,this._height=t,this.destroyed=!1,this.internal=!1,this.onResize=new Ns("setRealSize"),this.onUpdate=new Ns("update"),this.onError=new Ns("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 Gh extends pl{constructor(e,t){const{width:i,height:s}=t||{};if(!i||!s)throw new Error("BufferResource width or height invalid");super(i,s),this.data=e,this.unpackAlignment=t.unpackAlignment??4}upload(e,t,i){const s=e.gl;s.pixelStorei(s.UNPACK_ALIGNMENT,this.unpackAlignment),s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.alphaMode===Ai.UNPACK);const r=t.realWidth,a=t.realHeight;return i.width===r&&i.height===a?s.texSubImage2D(t.target,0,0,0,r,a,t.format,i.type,this.data):(i.width=r,i.height=a,s.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 CM={scaleMode:Os.NEAREST,alphaMode:Ai.NPM},vf=class Na extends El{constructor(e=null,t=null){super(),t=Object.assign({},Na.defaultOptions,t);const{alphaMode:i,mipmap:s,anisotropicLevel:r,scaleMode:a,width:o,height:h,wrapMode:l,format:c,type:u,target:d,resolution:f,resourceOptions:p}=t;e&&!(e instanceof pl)&&(e=hx(e,p),e.internal=!0),this.resolution=f||$e.RESOLUTION,this.width=Math.round((o||0)*this.resolution)/this.resolution,this.height=Math.round((h||0)*this.resolution)/this.resolution,this._mipmap=s,this.anisotropicLevel=r,this._wrapMode=l,this._scaleMode=a,this.format=c,this.type=u,this.target=d,this.alphaMode=i,this.uid=da(),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=c0(this.realWidth)&&c0(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 or[this.cacheId],delete qs[this.cacheId],this.cacheId=null),this.valid=!1,this.dispose(),Na.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=$e.STRICT_TEXTURE_CACHE){const s=typeof e=="string";let r=null;if(s)r=e;else{if(!e._pixiId){const o=(t==null?void 0:t.pixiIdPrefix)||"pixiid";e._pixiId=`${o}_${da()}`}r=e._pixiId}let a=or[r];if(s&&i&&!a)throw new Error(`The cacheId "${r}" does not exist in BaseTextureCache.`);return a||(a=new Na(e,t),a.cacheId=r,Na.addToCache(a,r)),a}static fromBuffer(e,t,i,s){e=e||new Float32Array(t*i*4);const r=new Gh(e,{width:t,height:i,...s==null?void 0:s.resourceOptions});let a,o;return e instanceof Float32Array?(a=Oe.RGBA,o=We.FLOAT):e instanceof Int32Array?(a=Oe.RGBA_INTEGER,o=We.INT):e instanceof Uint32Array?(a=Oe.RGBA_INTEGER,o=We.UNSIGNED_INT):e instanceof Int16Array?(a=Oe.RGBA_INTEGER,o=We.SHORT):e instanceof Uint16Array?(a=Oe.RGBA_INTEGER,o=We.UNSIGNED_SHORT):e instanceof Int8Array?(a=Oe.RGBA,o=We.BYTE):(a=Oe.RGBA,o=We.UNSIGNED_BYTE),r.internal=!0,new Na(r,Object.assign({},CM,{type:o,format:a},s))}static addToCache(e,t){t&&(e.textureCacheIds.includes(t)||e.textureCacheIds.push(t),or[t]&&or[t]!==e&&console.warn(`BaseTexture added to the cache with an id [${t}] that already had an entry`),or[t]=e)}static removeFromCache(e){if(typeof e=="string"){const t=or[e];if(t){const i=t.textureCacheIds.indexOf(e);return i>-1&&t.textureCacheIds.splice(i,1),delete or[e],t}}else if(e!=null&&e.textureCacheIds){for(let t=0;t<e.textureCacheIds.length;++t)delete or[e.textureCacheIds[t]];return e.textureCacheIds.length=0,e}return null}};vf.defaultOptions={mipmap:ws.POW2,anisotropicLevel:0,scaleMode:Os.LINEAR,wrapMode:Ds.CLAMP,alphaMode:Ai.UNPACK,target:Za.TEXTURE_2D,format:Oe.RGBA,type:We.UNSIGNED_BYTE},vf._globalBatch=0;let ot=vf;class yf{constructor(){this.texArray=null,this.blend=0,this.type=dn.TRIANGLES,this.start=0,this.size=0,this.data=null}}let IM=0;class qt{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=IM++,this.disposeRunner=new Ns("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?gn.ELEMENT_ARRAY_BUFFER:gn.ARRAY_BUFFER}get index(){return this.type===gn.ELEMENT_ARRAY_BUFFER}static from(e){return e instanceof Array&&(e=new Float32Array(e)),new qt(e)}}class jc{constructor(e,t=0,i=!1,s=We.FLOAT,r,a,o,h=1){this.buffer=e,this.size=t,this.normalized=i,this.type=s,this.stride=r,this.start=a,this.instance=o,this.divisor=h}destroy(){this.buffer=null}static from(e,t,i,s,r){return new jc(e,t,i,s,r)}}const RM={Float32Array,Uint32Array,Int32Array,Uint8Array};function PM(n,e){let t=0,i=0;const s={};for(let h=0;h<n.length;h++)i+=e[h],t+=n[h].length;const r=new ArrayBuffer(t*4);let a=null,o=0;for(let h=0;h<n.length;h++){const l=e[h],c=n[h],u=cx(c);s[u]||(s[u]=new RM[u](r)),a=s[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 g0={5126:4,5123:2,5121:1};let kM=0;const FM={Float32Array,Uint32Array,Int32Array,Uint8Array,Uint16Array};class bn{constructor(e=[],t={}){this.buffers=e,this.indexBuffer=null,this.attributes=t,this.glVertexArrayObjects={},this.id=kM++,this.instanced=!1,this.instanceCount=1,this.disposeRunner=new Ns("disposeGeometry"),this.refCount=0}addAttribute(e,t,i=0,s=!1,r,a,o,h=!1){if(!t)throw new Error("You must pass a buffer when creating an attribute");t instanceof qt||(t instanceof Array&&(t=new Float32Array(t)),t=new qt(t));const l=e.split("|");if(l.length>1){for(let u=0;u<l.length;u++)this.addAttribute(l[u],t,i,s,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 jc(c,i,s,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 qt||(e instanceof Array&&(e=new Uint16Array(e)),e=new qt(e)),e.type=gn.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 qt;let s;for(s in this.attributes){const r=this.attributes[s],a=this.buffers[r.buffer];e.push(a.data),t.push(r.size*g0[r.type]/4),r.buffer=0}for(i.data=PM(e,t),s=0;s<this.buffers.length;s++)this.buffers[s]!==this.indexBuffer&&this.buffers[s].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 qt(this.buffers[t].data.slice(0));for(const t in this.attributes){const i=this.attributes[t];e.attributes[t]=new jc(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=gn.ELEMENT_ARRAY_BUFFER),e}static merge(e){const t=new bn,i=[],s=[],r=[];let a;for(let o=0;o<e.length;o++){a=e[o];for(let h=0;h<a.buffers.length;h++)s[h]=s[h]||0,s[h]+=a.buffers[h].data.length,r[h]=0}for(let o=0;o<a.buffers.length;o++)i[o]=new FM[cx(a.buffers[o].data)](s[o]),t.buffers[o]=new qt(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=gn.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*g0[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 ux extends bn{constructor(e=!1){super(),this._buffer=new qt(null,e,!1),this._indexBuffer=new qt(null,e,!0),this.addAttribute("aVertexPosition",this._buffer,2,!1,We.FLOAT).addAttribute("aTextureCoord",this._buffer,2,!1,We.FLOAT).addAttribute("aColor",this._buffer,4,!0,We.UNSIGNED_BYTE).addAttribute("aTextureId",this._buffer,1,!0,We.FLOAT).addIndex(this._indexBuffer)}}const Wc=Math.PI*2,OM=180/Math.PI,BM=Math.PI/180;var ki=(n=>(n[n.POLY=0]="POLY",n[n.RECT=1]="RECT",n[n.CIRC=2]="CIRC",n[n.ELIP=3]="ELIP",n[n.RREC=4]="RREC",n))(ki||{});class kt{constructor(e=0,t=0){this.x=0,this.y=0,this.x=e,this.y=t}clone(){return new kt(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}}kt.prototype.toString=function(){return`[@pixi/math:Point x=${this.x} y=${this.y}]`};const $l=[new kt,new kt,new kt,new kt];class vt{constructor(e=0,t=0,i=0,s=0){this.x=Number(e),this.y=Number(t),this.width=Number(i),this.height=Number(s),this.type=ki.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 vt(0,0,0,0)}clone(){return new vt(this.x,this.y,this.width,this.height)}copyFrom(e){return this.x=e.x,this.y=e.y,this.width=e.width,this.height=e.height,this}copyTo(e){return e.x=this.x,e.y=this.y,e.width=this.width,e.height=this.height,e}contains(e,t){return this.width<=0||this.height<=0?!1:e>=this.x&&e<this.x+this.width&&t>=this.y&&t<this.y+this.height}intersects(e,t){if(!t){const C=this.x<e.x?e.x:this.x;if((this.right>e.right?e.right:this.right)<=C)return!1;const I=this.y<e.y?e.y:this.y;return(this.bottom>e.bottom?e.bottom:this.bottom)>I}const i=this.left,s=this.right,r=this.top,a=this.bottom;if(s<=i||a<=r)return!1;const o=$l[0].set(e.left,e.top),h=$l[1].set(e.left,e.bottom),l=$l[2].set(e.right,e.top),c=$l[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)>=s||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*s+f*r,g=d*i+f*a,y=d*s+f*a;if(Math.max(p,m,g,y)<=d*o.x+f*o.y||Math.min(p,m,g,y)>=d*c.x+f*c.y)return!1;const w=u*(o.y-l.y),v=u*(l.x-o.x),_=w*i+v*r,x=w*s+v*r,M=w*i+v*a,T=w*s+v*a;return!(Math.max(_,x,M,T)<=w*o.x+v*o.y||Math.min(_,x,M,T)>=w*c.x+v*c.y)}pad(e=0,t=e){return this.x-=e,this.y-=t,this.width+=e*2,this.height+=t*2,this}fit(e){const t=Math.max(this.x,e.x),i=Math.min(this.x+this.width,e.x+e.width),s=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=s,this.height=Math.max(r-s,0),this}ceil(e=1,t=.001){const i=Math.ceil((this.x+this.width-t)*e)/e,s=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=s-this.y,this}enlarge(e){const t=Math.min(this.x,e.x),i=Math.max(this.x+this.width,e.x+e.width),s=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=s,this.height=r-s,this}}vt.prototype.toString=function(){return`[@pixi/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};class Hh{constructor(e=0,t=0,i=0){this.x=e,this.y=t,this.radius=i,this.type=ki.CIRC}clone(){return new Hh(this.x,this.y,this.radius)}contains(e,t){if(this.radius<=0)return!1;const i=this.radius*this.radius;let s=this.x-e,r=this.y-t;return s*=s,r*=r,s+r<=i}getBounds(){return new vt(this.x-this.radius,this.y-this.radius,this.radius*2,this.radius*2)}}Hh.prototype.toString=function(){return`[@pixi/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`};class jh{constructor(e=0,t=0,i=0,s=0){this.x=e,this.y=t,this.width=i,this.height=s,this.type=ki.ELIP}clone(){return new jh(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,s=(t-this.y)/this.height;return i*=i,s*=s,i+s<=1}getBounds(){return new vt(this.x-this.width,this.y-this.height,this.width,this.height)}}jh.prototype.toString=function(){return`[@pixi/math:Ellipse x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};class oa{constructor(...e){let t=Array.isArray(e[0])?e[0]:e;if(typeof t[0]!="number"){const i=[];for(let s=0,r=t.length;s<r;s++)i.push(t[s].x,t[s].y);t=i}this.points=t,this.type=ki.POLY,this.closeStroke=!0}clone(){const e=this.points.slice(),t=new oa(e);return t.closeStroke=this.closeStroke,t}contains(e,t){let i=!1;const s=this.points.length/2;for(let r=0,a=s-1;r<s;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}}oa.prototype.toString=function(){return`[@pixi/math:PolygoncloseStroke=${this.closeStroke}points=${this.points.reduce((n,e)=>`${n}, ${e}`,"")}]`};class Wh{constructor(e=0,t=0,i=0,s=0,r=20){this.x=e,this.y=t,this.width=i,this.height=s,this.radius=r,this.type=ki.RREC}clone(){return new Wh(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 s=e-(this.x+i),r=t-(this.y+i);const a=i*i;if(s*s+r*r<=a||(s=e-(this.x+this.width-i),s*s+r*r<=a)||(r=t-(this.y+this.height-i),s*s+r*r<=a)||(s=e-(this.x+i),s*s+r*r<=a))return!0}return!1}}Wh.prototype.toString=function(){return`[@pixi/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`};class Zt{constructor(e=1,t=0,i=0,s=1,r=0,a=0){this.array=null,this.a=e,this.b=t,this.c=i,this.d=s,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,s,r,a){return this.a=e,this.b=t,this.c=i,this.d=s,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 kt;const i=e.x,s=e.y;return t.x=this.a*i+this.c*s+this.tx,t.y=this.b*i+this.d*s+this.ty,t}applyInverse(e,t){t=t||new kt;const i=1/(this.a*this.d+this.c*-this.b),s=e.x,r=e.y;return t.x=this.d*i*s+-this.c*i*r+(this.ty*this.c-this.tx*this.d)*i,t.y=this.a*i*r+-this.b*i*s+(-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),s=this.a,r=this.c,a=this.tx;return this.a=s*t-this.b*i,this.b=s*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,s=this.c,r=this.d;return this.a=e.a*t+e.b*s,this.b=e.a*i+e.b*r,this.c=e.c*t+e.d*s,this.d=e.c*i+e.d*r,this.tx=e.tx*t+e.ty*s+this.tx,this.ty=e.tx*i+e.ty*r+this.ty,this}setTransform(e,t,i,s,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+s*this.c),this.ty=t-(i*this.b+s*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,s=this.c;this.a=i*e.a+this.b*e.c,this.b=i*e.b+this.b*e.d,this.c=s*e.a+this.d*e.c,this.d=s*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,s=this.c,r=this.d,a=e.pivot,o=-Math.atan2(-s,r),h=Math.atan2(i,t),l=Math.abs(o+h);return l<1e-5||Math.abs(Wc-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(s*s+r*r),e.position.x=this.tx+(a.x*t+a.y*s),e.position.y=this.ty+(a.x*i+a.y*r),e}invert(){const e=this.a,t=this.b,i=this.c,s=this.d,r=this.tx,a=e*s-t*i;return this.a=s/a,this.b=-t/a,this.c=-i/a,this.d=e/a,this.tx=(i*this.ty-s*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 Zt;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 Zt}static get TEMP_MATRIX(){return new Zt}}Zt.prototype.toString=function(){return`[@pixi/math:Matrix a=${this.a} b=${this.b} c=${this.c} d=${this.d} tx=${this.tx} ty=${this.ty}]`};const Hr=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],jr=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],Wr=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],zr=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],xf=[],dx=[],Gl=Math.sign;function LM(){for(let n=0;n<16;n++){const e=[];xf.push(e);for(let t=0;t<16;t++){const i=Gl(Hr[n]*Hr[t]+Wr[n]*jr[t]),s=Gl(jr[n]*Hr[t]+zr[n]*jr[t]),r=Gl(Hr[n]*Wr[t]+Wr[n]*zr[t]),a=Gl(jr[n]*Wr[t]+zr[n]*zr[t]);for(let o=0;o<16;o++)if(Hr[o]===i&&jr[o]===s&&Wr[o]===r&&zr[o]===a){e.push(o);break}}}for(let n=0;n<16;n++){const e=new Zt;e.set(Hr[n],jr[n],Wr[n],zr[n],0,0),dx.push(e)}}LM();const ii={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:n=>Hr[n],uY:n=>jr[n],vX:n=>Wr[n],vY:n=>zr[n],inv:n=>n&8?n&15:-n&7,add:(n,e)=>xf[n][e],sub:(n,e)=>xf[n][ii.inv(e)],rotate180:n=>n^4,isVertical:n=>(n&3)===2,byDirection:(n,e)=>Math.abs(n)*2<=Math.abs(e)?e>=0?ii.S:ii.N:Math.abs(e)*2<=Math.abs(n)?n>0?ii.E:ii.W:e>0?n>0?ii.SE:ii.SW:n>0?ii.NE:ii.NW,matrixAppendRotationInv:(n,e,t=0,i=0)=>{const s=dx[ii.inv(e)];s.tx=t,s.ty=i,n.append(s)}};class Yn{constructor(e,t,i=0,s=0){this._x=i,this._y=s,this.cb=e,this.scope=t}clone(e=this.cb,t=this.scope){return new Yn(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))}}Yn.prototype.toString=function(){return`[@pixi/math:ObservablePoint x=${this.x} y=${this.y} scope=${this.scope}]`};const bf=class{constructor(){this.worldTransform=new Zt,this.localTransform=new Zt,this.position=new Yn(this.onChange,this,0,0),this.scale=new Yn(this.onChange,this,1,1),this.pivot=new Yn(this.onChange,this,0,0),this.skew=new Yn(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 n=this.localTransform;this._localID!==this._currentLocalID&&(n.a=this._cx*this.scale.x,n.b=this._sx*this.scale.x,n.c=this._cy*this.scale.y,n.d=this._sy*this.scale.y,n.tx=this.position.x-(this.pivot.x*n.a+this.pivot.y*n.c),n.ty=this.position.y-(this.pivot.x*n.b+this.pivot.y*n.d),this._currentLocalID=this._localID,this._parentID=-1)}updateTransform(n){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!==n._worldID){const t=n.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=n._worldID,this._worldID++}}setFromMatrix(n){n.decompose(this),this._localID++}get rotation(){return this._rotation}set rotation(n){this._rotation!==n&&(this._rotation=n,this.updateSkew())}};bf.IDENTITY=new bf;let Um=bf;Um.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 DM=`varying vec2 vTextureCoord;
|
||
|
||
uniform sampler2D uSampler;
|
||
|
||
void main(void){
|
||
gl_FragColor *= texture2D(uSampler, vTextureCoord);
|
||
}`,NM=`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 v0(n,e,t){const i=n.createShader(e);return n.shaderSource(i,t),n.compileShader(i),i}function Td(n){const e=new Array(n);for(let t=0;t<e.length;t++)e[t]=!1;return e}function fx(n,e){switch(n){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 Td(2*e);case"bvec3":return Td(3*e);case"bvec4":return Td(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 Qa=[{test:n=>n.type==="float"&&n.size===1&&!n.isArray,code:n=>`
|
||
if(uv["${n}"] !== ud["${n}"].value)
|
||
{
|
||
ud["${n}"].value = uv["${n}"]
|
||
gl.uniform1f(ud["${n}"].location, uv["${n}"])
|
||
}
|
||
`},{test:(n,e)=>(n.type==="sampler2D"||n.type==="samplerCube"||n.type==="sampler2DArray")&&n.size===1&&!n.isArray&&(e==null||e.castToBaseTexture!==void 0),code:n=>`t = syncData.textureCount++;
|
||
|
||
renderer.texture.bind(uv["${n}"], t);
|
||
|
||
if(ud["${n}"].value !== t)
|
||
{
|
||
ud["${n}"].value = t;
|
||
gl.uniform1i(ud["${n}"].location, t);
|
||
; // eslint-disable-line max-len
|
||
}`},{test:(n,e)=>n.type==="mat3"&&n.size===1&&!n.isArray&&e.a!==void 0,code:n=>`
|
||
gl.uniformMatrix3fv(ud["${n}"].location, false, uv["${n}"].toArray(true));
|
||
`,codeUbo:n=>`
|
||
var ${n}_matrix = uv.${n}.toArray(true);
|
||
|
||
data[offset] = ${n}_matrix[0];
|
||
data[offset+1] = ${n}_matrix[1];
|
||
data[offset+2] = ${n}_matrix[2];
|
||
|
||
data[offset + 4] = ${n}_matrix[3];
|
||
data[offset + 5] = ${n}_matrix[4];
|
||
data[offset + 6] = ${n}_matrix[5];
|
||
|
||
data[offset + 8] = ${n}_matrix[6];
|
||
data[offset + 9] = ${n}_matrix[7];
|
||
data[offset + 10] = ${n}_matrix[8];
|
||
`},{test:(n,e)=>n.type==="vec2"&&n.size===1&&!n.isArray&&e.x!==void 0,code:n=>`
|
||
cv = ud["${n}"].value;
|
||
v = uv["${n}"];
|
||
|
||
if(cv[0] !== v.x || cv[1] !== v.y)
|
||
{
|
||
cv[0] = v.x;
|
||
cv[1] = v.y;
|
||
gl.uniform2f(ud["${n}"].location, v.x, v.y);
|
||
}`,codeUbo:n=>`
|
||
v = uv.${n};
|
||
|
||
data[offset] = v.x;
|
||
data[offset+1] = v.y;
|
||
`},{test:n=>n.type==="vec2"&&n.size===1&&!n.isArray,code:n=>`
|
||
cv = ud["${n}"].value;
|
||
v = uv["${n}"];
|
||
|
||
if(cv[0] !== v[0] || cv[1] !== v[1])
|
||
{
|
||
cv[0] = v[0];
|
||
cv[1] = v[1];
|
||
gl.uniform2f(ud["${n}"].location, v[0], v[1]);
|
||
}
|
||
`},{test:(n,e)=>n.type==="vec4"&&n.size===1&&!n.isArray&&e.width!==void 0,code:n=>`
|
||
cv = ud["${n}"].value;
|
||
v = uv["${n}"];
|
||
|
||
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["${n}"].location, v.x, v.y, v.width, v.height)
|
||
}`,codeUbo:n=>`
|
||
v = uv.${n};
|
||
|
||
data[offset] = v.x;
|
||
data[offset+1] = v.y;
|
||
data[offset+2] = v.width;
|
||
data[offset+3] = v.height;
|
||
`},{test:(n,e)=>n.type==="vec4"&&n.size===1&&!n.isArray&&e.red!==void 0,code:n=>`
|
||
cv = ud["${n}"].value;
|
||
v = uv["${n}"];
|
||
|
||
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["${n}"].location, v.red, v.green, v.blue, v.alpha)
|
||
}`,codeUbo:n=>`
|
||
v = uv.${n};
|
||
|
||
data[offset] = v.red;
|
||
data[offset+1] = v.green;
|
||
data[offset+2] = v.blue;
|
||
data[offset+3] = v.alpha;
|
||
`},{test:(n,e)=>n.type==="vec3"&&n.size===1&&!n.isArray&&e.red!==void 0,code:n=>`
|
||
cv = ud["${n}"].value;
|
||
v = uv["${n}"];
|
||
|
||
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["${n}"].location, v.red, v.green, v.blue)
|
||
}`,codeUbo:n=>`
|
||
v = uv.${n};
|
||
|
||
data[offset] = v.red;
|
||
data[offset+1] = v.green;
|
||
data[offset+2] = v.blue;
|
||
`},{test:n=>n.type==="vec4"&&n.size===1&&!n.isArray,code:n=>`
|
||
cv = ud["${n}"].value;
|
||
v = uv["${n}"];
|
||
|
||
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["${n}"].location, v[0], v[1], v[2], v[3])
|
||
}`}],UM={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);
|
||
}`},XM={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 YM(n,e){var i;const t=[`
|
||
var v = null;
|
||
var cv = null;
|
||
var cu = null;
|
||
var t = 0;
|
||
var gl = renderer.gl;
|
||
`];for(const s in n.uniforms){const r=e[s];if(!r){((i=n.uniforms[s])==null?void 0:i.group)===!0&&(n.uniforms[s].ubo?t.push(`
|
||
renderer.shader.syncUniformBufferGroup(uv.${s}, '${s}');
|
||
`):t.push(`
|
||
renderer.shader.syncUniformGroup(uv.${s}, syncData);
|
||
`));continue}const a=n.uniforms[s];let o=!1;for(let h=0;h<Qa.length;h++)if(Qa[h].test(r,a)){t.push(Qa[h].code(s,a)),o=!0;break}if(!o){const h=(r.size===1&&!r.isArray?UM:XM)[r.type].replace("location",`ud["${s}"].location`);t.push(`
|
||
cu = ud["${s}"];
|
||
cv = cu.value;
|
||
v = uv["${s}"];
|
||
${h};`)}}return new Function("ud","uv","renderer","syncData",t.join(`
|
||
`))}const mx={};let Ia=mx;function VM(){if(Ia===mx||Ia!=null&&Ia.isContextLost()){const n=$e.ADAPTER.createCanvas();let e;$e.PREFER_ENV>=va.WEBGL2&&(e=n.getContext("webgl2",{})),e||(e=n.getContext("webgl",{})||n.getContext("experimental-webgl",{}),e?e.getExtension("WEBGL_draw_buffers"):e=null),Ia=e}return Ia}let Hl;function $M(){if(!Hl){Hl=xs.MEDIUM;const n=VM();if(n&&n.getShaderPrecisionFormat){const e=n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT);e&&(Hl=e.precision?xs.HIGH:xs.MEDIUM)}}return Hl}function y0(n,e){const t=n.getShaderSource(e).split(`
|
||
`).map((l,c)=>`${c}: ${l}`),i=n.getShaderInfoLog(e),s=i.split(`
|
||
`),r={},a=s.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 GM(n,e,t,i){n.getProgramParameter(e,n.LINK_STATUS)||(n.getShaderParameter(t,n.COMPILE_STATUS)||y0(n,t),n.getShaderParameter(i,n.COMPILE_STATUS)||y0(n,i),console.error("PixiJS Error: Could not initialize shader."),n.getProgramInfoLog(e)!==""&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",n.getProgramInfoLog(e)))}const HM={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 px(n){return HM[n]}let jl=null;const x0={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 gx(n,e){if(!jl){const t=Object.keys(x0);jl={};for(let i=0;i<t.length;++i){const s=t[i];jl[n[s]]=x0[s]}}return jl[e]}function b0(n,e,t){if(n.substring(0,9)!=="precision"){let i=e;return e===xs.HIGH&&t!==xs.HIGH&&(i=xs.MEDIUM),`precision ${i} float;
|
||
${n}`}else if(t!==xs.HIGH&&n.substring(0,15)==="precision highp")return n.replace("precision highp","precision mediump");return n}let Po;function jM(){if(typeof Po=="boolean")return Po;try{Po=new Function("param1","param2","param3","return param1[param2] === param3;")({a:"b"},"a","b")===!0}catch{Po=!1}return Po}let WM=0;const Wl={},wf=class Ua{constructor(e,t,i="pixi-shader",s={}){this.extra={},this.id=WM++,this.vertexSrc=e||Ua.defaultVertexSrc,this.fragmentSrc=t||Ua.defaultFragmentSrc,this.vertexSrc=this.vertexSrc.trim(),this.fragmentSrc=this.fragmentSrc.trim(),this.extra=s,this.vertexSrc.substring(0,8)!=="#version"&&(i=i.replace(/\s+/g,"-"),Wl[i]?(Wl[i]++,i+=`-${Wl[i]}`):Wl[i]=1,this.vertexSrc=`#define SHADER_NAME ${i}
|
||
${this.vertexSrc}`,this.fragmentSrc=`#define SHADER_NAME ${i}
|
||
${this.fragmentSrc}`,this.vertexSrc=b0(this.vertexSrc,Ua.defaultVertexPrecision,xs.HIGH),this.fragmentSrc=b0(this.fragmentSrc,Ua.defaultFragmentPrecision,$M())),this.glPrograms={},this.syncUniforms=null}static get defaultVertexSrc(){return NM}static get defaultFragmentSrc(){return DM}static from(e,t,i){const s=e+t;let r=d0[s];return r||(d0[s]=r=new Ua(e,t,i)),r}};wf.defaultVertexPrecision=xs.HIGH,wf.defaultFragmentPrecision=Xn.apple.device?xs.HIGH:xs.MEDIUM;let fn=wf,zM=0;class Us{constructor(e,t,i){this.group=!0,this.syncUniforms={},this.dirtyId=0,this.id=zM++,this.static=!!t,this.ubo=!!i,e instanceof qt?(this.buffer=e,this.buffer.type=gn.UNIFORM_BUFFER,this.autoManage=!1,this.ubo=!0):(this.uniforms=e,this.ubo&&(this.buffer=new qt(new Float32Array(1)),this.buffer.type=gn.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 Us(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 Us(e,t,i)}static uboFrom(e,t){return new Us(e,t??!0,!0)}}class Xs{constructor(e,t){this.uniformBindCount=0,this.program=e,t?t instanceof Us?this.uniformGroup=t:this.uniformGroup=new Us(t):this.uniformGroup=new Us({}),this.disposeRunner=new Ns("disposeShader")}checkUniformExists(e,t){if(t.uniforms[e])return!0;for(const i in t.uniforms){const s=t.uniforms[i];if(s.group===!0&&this.checkUniformExists(e,s))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 s=fn.from(e,t);return new Xs(s,i)}}class vx{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]=Us.from({uSamplers:i},!0);let s=this.fragTemplate;s=s.replace(/%count%/gi,`${e}`),s=s.replace(/%forloop%/gi,this.generateSampleSrc(e)),this.programCache[e]=new fn(this.vertexSrc,s)}const t={tint:new Float32Array([1,1,1,1]),translationMatrix:new Zt,default:this.defaultGroupCache[e]};return new Xs(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 Sf{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 qM(){return!Xn.apple.device}function KM(n){let e=!0;const t=$e.ADAPTER.getNavigator();if(Xn.tablet||Xn.phone){if(Xn.apple.device){const i=t.userAgent.match(/OS (\d+)_(\d+)?/);i&&parseInt(i[1],10)<11&&(e=!1)}if(Xn.android.device){const i=t.userAgent.match(/Android\s([0-9.]*)/);i&&parseInt(i[1],10)<7&&(e=!1)}}return e?n:4}class zh{constructor(e){this.renderer=e}flush(){}destroy(){this.renderer=null}start(){}stop(){this.flush()}render(e){}}var ZM=`varying vec2 vTextureCoord;
|
||
varying vec4 vColor;
|
||
varying float vTextureId;
|
||
uniform sampler2D uSamplers[%count%];
|
||
|
||
void main(void){
|
||
vec4 color;
|
||
%forloop%
|
||
gl_FragColor = color * vColor;
|
||
}
|
||
`,JM=`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 Xo=class Is extends zh{constructor(e){super(e),this.setShaderGenerator(),this.geometryClass=ux,this.vertexSize=6,this.state=Sn.for2d(),this.size=Is.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??KM(32),this._defaultMaxTextures}static set defaultMaxTextures(e){this._defaultMaxTextures=e}static get canUploadSameBuffer(){return this._canUploadSameBuffer=this._canUploadSameBuffer??qM(),this._canUploadSameBuffer}static set canUploadSameBuffer(e){this._canUploadSameBuffer=e}get MAX_TEXTURES(){return Mt("7.1.0","BatchRenderer#MAX_TEXTURES renamed to BatchRenderer#maxTextures"),this.maxTextures}static get defaultVertexSrc(){return JM}static get defaultFragmentTemplate(){return ZM}setShaderGenerator({vertex:e=Is.defaultVertexSrc,fragment:t=Is.defaultFragmentTemplate}={}){this.shaderGenerator=new vx(e,t)}contextChange(){const e=this.renderer.gl;$e.PREFER_ENV===va.WEBGL_LEGACY?this.maxTextures=1:(this.maxTextures=Math.min(e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),Is.defaultMaxTextures),this.maxTextures=AM(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}=Is,i=this.size/4,s=Math.floor(i/this.maxTextures)+1;for(;e.length<i;)e.push(new yf);for(;t.length<s;)t.push(new Sf);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=Is._textureArrayPool,s=this.renderer.batch,r=this._tempBoundTextures,a=this.renderer.textureGC.count;let o=++ot._globalBatch,h=0,l=i[0],c=0;s.copyBoundTextures(r,t);for(let u=0;u<this._bufferSize;++u){const d=e[u];e[u]=null,d._batchEnabled!==o&&(l.count>=t&&(s.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&&(s.boundArray(l,r,o,t),this.buildDrawCalls(l,c,this._bufferSize),++h,++o);for(let u=0;u<r.length;u++)r[u]=null;ot._globalBatch=o}buildDrawCalls(e,t,i){const{_bufferedElements:s,_attributeBuffer:r,_indexBuffer:a,vertexSize:o}=this,h=Is._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=s[f],m=p._texture.baseTexture,g=ox[m.alphaMode?1:0][p.blendMode];s[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;Is.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,s=Is._drawCallPool;let r=null;for(let a=0;a<e;a++){const{texArray:o,type:h,size:l,start:c,blend:u}=s[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),Is.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=Hc(Math.ceil(e/8)),i=h0(t),s=t*8;this._aBuffers.length<=i&&(this._iBuffers.length=i+1);let r=this._aBuffers[s];return r||(this._aBuffers[s]=r=new pf(s*this.vertexSize*4)),r}getIndexBuffer(e){const t=Hc(Math.ceil(e/12)),i=h0(t),s=t*12;this._iBuffers.length<=i&&(this._iBuffers.length=i+1);let r=this._iBuffers[i];return r||(this._iBuffers[i]=r=new Uint16Array(s)),r}packInterleavedGeometry(e,t,i,s,r){const{uint32View:a,float32View:o}=t,h=s/this.vertexSize,l=e.uvs,c=e.indices,u=e.vertexData,d=e._texture.baseTexture._batchLocation,f=Math.min(e.worldAlpha,1),p=Lt.shared.setValue(e._tintRGB).toPremultiplied(f,e._texture.baseTexture.alphaMode>0);for(let m=0;m<u.length;m+=2)o[s++]=u[m],o[s++]=u[m+1],o[s++]=l[m],o[s++]=l[m+1],a[s++]=p,o[s++]=d;for(let m=0;m<c.length;m++)i[r++]=h+c[m]}};Xo.defaultBatchSize=4096,Xo.extension={name:"batch",type:Xe.RendererPlugin},Xo._drawCallPool=[],Xo._textureArrayPool=[];let fr=Xo;ze.add(fr);var QM=`varying vec2 vTextureCoord;
|
||
|
||
uniform sampler2D uSampler;
|
||
|
||
void main(void){
|
||
gl_FragColor = texture2D(uSampler, vTextureCoord);
|
||
}
|
||
`,eE=`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 _f=class Yo extends Xs{constructor(e,t,i){const s=fn.from(e||Yo.defaultVertexSrc,t||Yo.defaultFragmentSrc);super(s,i),this.padding=0,this.resolution=Yo.defaultResolution,this.multisample=Yo.defaultMultisample,this.enabled=!0,this.autoFit=!0,this.state=new Sn}apply(e,t,i,s,r){e.applyFilter(this,t,i,s)}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 eE}static get defaultFragmentSrc(){return QM}};_f.defaultResolution=1,_f.defaultMultisample=mi.NONE;let qi=_f;class zc{constructor(){this.clearBeforeRender=!0,this._backgroundColor=new Lt(0),this.alpha=1}init(e){this.clearBeforeRender=e.clearBeforeRender;const{backgroundColor:t,background:i,backgroundAlpha:s}=e,r=i??t;r!==void 0&&(this.color=r),this.alpha=s}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(){}}zc.defaultOptions={backgroundAlpha:1,backgroundColor:0,clearBeforeRender:!0},zc.extension={type:[Xe.RendererSystem,Xe.CanvasRendererSystem],name:"background"};ze.add(zc);class yx{constructor(e){this.renderer=e,this.emptyRenderer=new zh(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 s=t-1;s>=0;--s)e[s]=i[s]||null,e[s]&&(e[s]._batchLocation=s)}boundArray(e,t,i,s){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<s&&t[u]===c){a[l]=u;continue}for(;h<s;){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}}yx.extension={type:Xe.RendererSystem,name:"batch"};ze.add(yx);let w0=0;class qc{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=w0++}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=w0++,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($e.PREFER_ENV>=va.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 s=i||!!e.getExtension("OES_element_index_uint");this.supports.uint32Indices=s,s||console.warn("Provided WebGL context does not support 32 index buffer, complex graphics may not render correctly")}}qc.defaultOptions={context:null,antialias:!1,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:"default"},qc.extension={type:Xe.RendererSystem,name:"context"};ze.add(qc);class Tf{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 Ns("disposeFramebuffer"),this.multisample=mi.NONE}get colorTexture(){return this.colorTextures[0]}addColorTexture(e=0,t){return this.colorTextures[e]=t||new ot(null,{scaleMode:Os.NEAREST,resolution:1,mipmap:ws.OFF,width:this.width,height:this.height}),this.dirtyId++,this.dirtyFormat++,this}addDepthTexture(e){return this.depthTexture=e||new ot(null,{scaleMode:Os.NEAREST,resolution:1,width:this.width,height:this.height,mipmap:ws.OFF,format:Oe.DEPTH_COMPONENT,type:We.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 s=this.colorTextures[i],r=s.resolution;s.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 xx extends ot{constructor(e={}){if(typeof e=="number"){const t=arguments[0],i=arguments[1],s=arguments[2],r=arguments[3];e={width:t,height:i,scaleMode:s,resolution:r}}e.width=e.width??100,e.height=e.height??100,e.multisample??(e.multisample=mi.NONE),super(null,e),this.mipmap=ws.OFF,this.valid=!0,this._clear=new Lt([0,0,0,0]),this.framebuffer=new Tf(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 er extends pl{constructor(e){const t=e,i=t.naturalWidth||t.videoWidth||t.displayWidth||t.width,s=t.naturalHeight||t.videoHeight||t.displayHeight||t.height;super(i,s),this.source=e,this.noSubImage=!1}static crossOrigin(e,t,i){i===void 0&&!t.startsWith("data:")?e.crossOrigin=TM(t):i!==!1&&(e.crossOrigin=typeof i=="string"?i:"anonymous")}upload(e,t,i,s){const r=e.gl,a=t.realWidth,o=t.realHeight;if(s=s||this.source,typeof HTMLImageElement<"u"&&s instanceof HTMLImageElement){if(!s.complete||s.naturalWidth===0)return!1}else if(typeof HTMLVideoElement<"u"&&s instanceof HTMLVideoElement&&s.readyState<=1)return!1;return r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.alphaMode===Ai.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,s):(i.width=a,i.height=o,r.texImage2D(t.target,0,i.internalFormat,t.format,i.type,s)),!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 bx extends er{constructor(e,t){if(t=t||{},typeof e=="string"){const i=new Image;er.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??$e.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 s=this.source;this.url=s.src;const r=()=>{this.destroyed||(s.onload=null,s.onerror=null,this.update(),this._load=null,this.createBitmap?t(this.process()):t(this))};s.complete&&s.src?r():(s.onload=r,s.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(s=>s.blob()).then(s=>t(s,0,0,e.width,e.height,{premultiplyAlpha:this.alphaMode===null||this.alphaMode===Ai.UNPACK?"premultiply":"none"})).then(s=>this.destroyed?Promise.reject():(this.bitmap=s,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 s=!0;const r=t._glTextures;for(const a in r){const o=r[a];if(o!==i&&o.dirtyId!==t.dirtyId){s=!1;break}}s&&(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 Xm{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 s=t.width,r=t.height;if(i){const a=e.width/2/s,o=e.height/2/r,h=e.x/s+a,l=e.y/r+o;i=ii.add(i,ii.NW),this.x0=h+a*ii.uX(i),this.y0=l+o*ii.uY(i),i=ii.add(i,2),this.x1=h+a*ii.uX(i),this.y1=l+o*ii.uY(i),i=ii.add(i,2),this.x2=h+a*ii.uX(i),this.y2=l+o*ii.uY(i),i=ii.add(i,2),this.x3=h+a*ii.uX(i),this.y3=l+o*ii.uY(i)}else this.x0=e.x/s,this.y0=e.y/r,this.x1=(e.x+e.width)/s,this.y1=e.y/r,this.x2=(e.x+e.width)/s,this.y2=(e.y+e.height)/r,this.x3=e.x/s,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}}Xm.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 S0=new Xm;function zl(n){n.destroy=function(){},n.on=function(){},n.once=function(){},n.emit=function(){}}let rt=class jt extends El{constructor(e,t,i,s,r,a,o){if(super(),this.noFrame=!1,t||(this.noFrame=!0,t=new vt(0,0,1,1)),e instanceof jt&&(e=e.baseTexture),this.baseTexture=e,this._frame=t,this.trim=s,this.valid=!1,this.destroyed=!1,this._uvs=S0,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 kt(a.x,a.y):new kt(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&&qs[t.url]&&jt.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,jt.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0,this.emit("destroyed",this),this.removeAllListeners()}clone(){var s;const e=this._frame.clone(),t=this._frame===this.orig?e:this.orig.clone(),i=new jt(this.baseTexture,!this.noFrame&&e,t,(s=this.trim)==null?void 0:s.clone(),this.rotate,this.defaultAnchor,this.defaultBorders);return this.noFrame&&(i._frame=e),i}updateUvs(){this._uvs===S0&&(this._uvs=new Xm),this._uvs.set(this._frame,this.baseTexture,this.rotate),this._updateID++}static from(e,t={},i=$e.STRICT_TEXTURE_CACHE){const s=typeof e=="string";let r=null;if(s)r=e;else if(e instanceof ot){if(!e.cacheId){const o=(t==null?void 0:t.pixiIdPrefix)||"pixiid";e.cacheId=`${o}-${da()}`,ot.addToCache(e,e.cacheId)}r=e.cacheId}else{if(!e._pixiId){const o=(t==null?void 0:t.pixiIdPrefix)||"pixiid";e._pixiId=`${o}_${da()}`}r=e._pixiId}let a=qs[r];if(s&&i&&!a)throw new Error(`The cacheId "${r}" does not exist in TextureCache.`);return!a&&!(e instanceof ot)?(t.resolution||(t.resolution=Qn(e)),a=new jt(new ot(e,t)),a.baseTexture.cacheId=r,ot.addToCache(a.baseTexture,r),jt.addToCache(a,r)):!a&&e instanceof ot&&(a=new jt(e),jt.addToCache(a,r)),a}static fromURL(e,t){const i=Object.assign({autoLoad:!1},t==null?void 0:t.resourceOptions),s=jt.from(e,Object.assign({resourceOptions:i},t),!1),r=s.baseTexture.resource;return s.baseTexture.valid?Promise.resolve(s):r.load().then(()=>Promise.resolve(s))}static fromBuffer(e,t,i,s){return new jt(ot.fromBuffer(e,t,i,s))}static fromLoader(e,t,i,s){const r=new ot(e,Object.assign({scaleMode:ot.defaultOptions.scaleMode,resolution:Qn(t)},s)),{resource:a}=r;a instanceof bx&&(a.url=t);const o=new jt(r);return i||(i=t),ot.addToCache(o.baseTexture,i),jt.addToCache(o,i),i!==t&&(ot.addToCache(o.baseTexture,t),jt.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),qs[t]&&qs[t]!==e&&console.warn(`Texture added to the cache with an id [${t}] that already had an entry`),qs[t]=e)}static removeFromCache(e){if(typeof e=="string"){const t=qs[e];if(t){const i=t.textureCacheIds.indexOf(e);return i>-1&&t.textureCacheIds.splice(i,1),delete qs[e],t}}else if(e!=null&&e.textureCacheIds){for(let t=0;t<e.textureCacheIds.length;++t)qs[e.textureCacheIds[t]]===e&&delete qs[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:s,height:r}=e,a=t+s>this.baseTexture.width,o=i+r>this.baseTexture.height;if(a||o){const h=a&&o?"and":"or",l=`X: ${t} + ${s} = ${t+s} > ${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=s&&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 jt._EMPTY||(jt._EMPTY=new jt(new ot),zl(jt._EMPTY),zl(jt._EMPTY.baseTexture)),jt._EMPTY}static get WHITE(){if(!jt._WHITE){const e=$e.ADAPTER.createCanvas(16,16),t=e.getContext("2d");e.width=16,e.height=16,t.fillStyle="white",t.fillRect(0,0,16,16),jt._WHITE=new jt(ot.from(e)),zl(jt._WHITE),zl(jt._WHITE.baseTexture)}return jt._WHITE}};class ya extends rt{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 s=this.baseTexture.resolution,r=Math.round(e*s)/s,a=Math.round(t*s)/s;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 ya(new xx(e))}}class wx{constructor(e){this.texturePool={},this.textureOptions=e||{},this.enableFullScreen=!1,this._pixelsWidth=0,this._pixelsHeight=0}createTexture(e,t,i=mi.NONE){const s=new xx(Object.assign({width:e,height:t,resolution:1,multisample:i},this.textureOptions));return new ya(s)}getOptimalTexture(e,t,i=1,s=mi.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=Hc(e),t=Hc(t),r=((e&65535)<<16|t&65535)>>>0,s>1&&(r+=s*4294967296)):r=s>1?-s:-1,this.texturePool[r]||(this.texturePool[r]=[]);let a=this.texturePool[r].pop();return a||(a=this.createTexture(e,t,s)),a.filterPoolKey=r,a.setResolution(i),a}getFilterTexture(e,t,i){const s=this.getOptimalTexture(e.width,e.height,t||e.resolution,i||mi.NONE);return s.filterFrame=e.filterFrame,s}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 s=0;s<i.length;s++)i[s].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 s=0;s<i.length;s++)i[s].destroy(!0);this.texturePool[t]=[]}this._pixelsWidth=e.width,this._pixelsHeight=e.height}}}wx.SCREEN_KEY=-1;class tE extends bn{constructor(){super(),this.addAttribute("aVertexPosition",new Float32Array([0,0,1,0,1,1,0,1])).addIndex([0,1,3,2])}}class Sx 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 qt(this.vertices),this.uvBuffer=new qt(this.uvs),this.addAttribute("aVertexPosition",this.vertexBuffer).addAttribute("aTextureCoord",this.uvBuffer).addIndex([0,1,2,0,2,3])}map(e,t){let i=0,s=0;return this.uvs[0]=i,this.uvs[1]=s,this.uvs[2]=i+t.width/e.width,this.uvs[3]=s,this.uvs[4]=i+t.width/e.width,this.uvs[5]=s+t.height/e.height,this.uvs[6]=i,this.uvs[7]=s+t.height/e.height,i=t.x,s=t.y,this.vertices[0]=i,this.vertices[1]=s,this.vertices[2]=i+t.width,this.vertices[3]=s,this.vertices[4]=i+t.width,this.vertices[5]=s+t.height,this.vertices[6]=i,this.vertices[7]=s+t.height,this.invalidate(),this}invalidate(){return this.vertexBuffer._updateID++,this.uvBuffer._updateID++,this}}class iE{constructor(){this.renderTexture=null,this.target=null,this.legacy=!1,this.resolution=1,this.multisample=mi.NONE,this.sourceFrame=new vt,this.destinationFrame=new vt,this.bindingSourceFrame=new vt,this.bindingDestinationFrame=new vt,this.filters=[],this.transform=null}clear(){this.target=null,this.filters=null,this.renderTexture=null}}const ql=[new kt,new kt,new kt,new kt],Md=new Zt;class _x{constructor(e){this.renderer=e,this.defaultFilterStack=[{}],this.texturePool=new wx,this.statePool=[],this.quad=new tE,this.quadUv=new Sx,this.tempRect=new vt,this.activeState={},this.globalUniforms=new Us({outputFrame:new vt,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,s=this.defaultFilterStack,r=this.statePool.pop()||new iE,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 y=t[g];l=Math.min(l,y.resolution||o),c=Math.min(c,y.multisample??h),u=this.useMaxPadding?Math.max(u,y.padding):u+y.padding,d=d&&y.autoFit,f=f||(y.legacy??!0)}s.length===1&&(this.defaultFilterStack[0].renderTexture=a.current),s.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(Md.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 s=this.globalUniforms.uniforms;s.outputFrame=t.sourceFrame,s.resolution=t.resolution;const r=s.inputSize,a=s.inputPixel,o=s.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=s.filterArea;l[0]=t.destinationFrame.width,l[1]=t.destinationFrame.height,l[2]=t.sourceFrame.x,l[3]=t.sourceFrame.y,s.filterClamp=s.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,cn.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,cn.CLEAR,t);const d=l;l=c,c=d}i[u].apply(this,l,h.renderTexture,cn.BLEND,t),u>1&&t.multisample>1&&this.returnFilterTexture(t.renderTexture),this.returnFilterTexture(l),this.returnFilterTexture(c)}t.clear(),this.statePool.push(t)}bindAndClear(e,t=cn.CLEAR){const{renderTexture:i,state:s}=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=s.stateId&1||this.forceClear;(t===cn.CLEAR||t===cn.BLIT&&r)&&this.renderer.framebuffer.clear(0,0,0,0)}applyFilter(e,t,i,s){const r=this.renderer;r.state.set(e.state),this.bindAndClear(i,s),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(dn.TRIANGLES)):(r.geometry.bind(this.quad),r.geometry.draw(dn.TRIANGLE_STRIP))}calculateSpriteMatrix(e,t){const{sourceFrame:i,destinationFrame:s}=this.activeState,{orig:r}=t._texture,a=e.set(s.width,0,0,s.height,i.x,i.y),o=t.worldTransform.copyTo(Zt.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,s=mi.NONE){return this.texturePool.getOptimalTexture(e,t,i,s)}getFilterTexture(e,t,i){if(typeof e=="number"){const r=e;e=t,t=r}e=e||this.activeState.renderTexture;const s=this.texturePool.getOptimalTexture(e.width,e.height,t||e.resolution,i||mi.NONE);return s.filterFrame=e.filterFrame,s}returnFilterTexture(e){this.texturePool.returnTexture(e)}emptyPool(){this.texturePool.clear(!0)}resize(){this.texturePool.setScreenSize(this.renderer.view)}transformAABB(e,t){const i=ql[0],s=ql[1],r=ql[2],a=ql[3];i.set(t.left,t.top),s.set(t.left,t.bottom),r.set(t.right,t.top),a.set(t.right,t.bottom),e.apply(i,i),e.apply(s,s),e.apply(r,r),e.apply(a,a);const o=Math.min(i.x,s.x,r.x,a.x),h=Math.min(i.y,s.y,r.y,a.y),l=Math.max(i.x,s.x,r.x,a.x),c=Math.max(i.y,s.y,r.y,a.y);t.x=o,t.y=h,t.width=l-o,t.height=c-h}roundFrame(e,t,i,s,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?Md.copyFrom(r):Md.identity(),r.translate(-i.x,-i.y).scale(s.width/i.width,s.height/i.height).translate(s.x,s.y),this.transformAABB(r,e),e.ceil(t),this.transformAABB(r.invert(),e)}}}_x.extension={type:Xe.RendererSystem,name:"filter"};ze.add(_x);class sE{constructor(e){this.framebuffer=e,this.stencil=null,this.dirtyId=-1,this.dirtyFormat=-1,this.dirtySize=-1,this.multisample=mi.NONE,this.msaaBuffer=null,this.blitFramebuffer=null,this.mipLevel=0}}const nE=new vt;class Tx{constructor(e){this.renderer=e,this.managedFramebuffers=[],this.unknownFramebuffer=new Tf(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 vt,this.hasMRT=!0,this.writeDepthTexture=!0,this.renderer.context.webGLVersion===1){let t=this.renderer.context.extensions.drawBuffers,i=this.renderer.context.extensions.depthTexture;$e.PREFER_ENV===va.WEBGL_LEGACY&&(t=null,i=null),t?e.drawBuffers=s=>t.drawBuffersWEBGL(s):(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:s}=this;if(e){const r=e.glFramebuffers[this.CONTEXT_UID]||this.initFramebuffer(e);this.current!==e&&(this.current=e,s.bindFramebuffer(s.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,s.bindFramebuffer(s.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,s){const r=this.viewport;e=Math.round(e),t=Math.round(t),i=Math.round(i),s=Math.round(s),(r.width!==i||r.height!==s||r.x!==e||r.y!==t)&&(r.x=e,r.y=t,r.width=i,r.height=s,this.gl.viewport(e,t,i,s))}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,s,r=hf.COLOR|hf.DEPTH){const{gl:a}=this;a.clearColor(e,t,i,s),a.clear(r)}initFramebuffer(e){const{gl:t}=this,i=new sE(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 s=e.colorTextures;let r=s.length;t.drawBuffers||(r=Math.min(r,1));for(let a=0;a<r;a++){const o=s[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,s=e.glFramebuffers[this.CONTEXT_UID],r=e.colorTextures;let a=r.length;i.drawBuffers||(a=Math.min(a,1)),s.multisample>1&&this.canMultisampleFramebuffer(e)?s.msaaBuffer=s.msaaBuffer||i.createRenderbuffer():s.msaaBuffer&&(i.deleteRenderbuffer(s.msaaBuffer),s.msaaBuffer=null,s.blitFramebuffer&&(s.blitFramebuffer.dispose(),s.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&&s.msaaBuffer?(i.bindRenderbuffer(i.RENDERBUFFER,s.msaaBuffer),i.renderbufferStorageMultisample(i.RENDERBUFFER,s.multisample,c._glTextures[this.CONTEXT_UID].internalFormat,e.width,e.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.RENDERBUFFER,s.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)){s.stencil=s.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,s.stencil),s.msaaBuffer?i.renderbufferStorageMultisample(i.RENDERBUFFER,s.multisample,l,e.width,e.height):i.renderbufferStorage(i.RENDERBUFFER,l,e.width,e.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,h,i.RENDERBUFFER,s.stencil)}else s.stencil&&(i.deleteRenderbuffer(s.stencil),s.stencil=null)}canMultisampleFramebuffer(e){return this.renderer.context.webGLVersion!==1&&e.colorTextures.length<=1&&!e.depthTexture}detectSamples(e){const{msaaSamples:t}=this;let i=mi.NONE;if(e<=1||t===null)return i;for(let s=0;s<t.length;s++)if(t[s]<=e){i=t[s];break}return i===1&&(i=mi.NONE),i}blit(e,t,i){const{current:s,renderer:r,gl:a,CONTEXT_UID:o}=this;if(r.context.webGLVersion!==2||!s)return;const h=s.glFramebuffers[o];if(!h)return;if(!e){if(!h.msaaBuffer)return;const c=s.colorTextures[0];if(!c)return;h.blitFramebuffer||(h.blitFramebuffer=new Tf(s.width,s.height),h.blitFramebuffer.addColorTexture(0,c)),e=h.blitFramebuffer,e.colorTextures[0]!==c&&(e.colorTextures[0]=c,e.dirtyId++,e.dirtyFormat++),(e.width!==s.width||e.height!==s.height)&&(e.width=s.width,e.height=s.height,e.dirtyId++,e.dirtySize++)}t||(t=nE,t.width=s.width,t.height=s.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],s=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||(s.deleteFramebuffer(i.framebuffer),i.msaaBuffer&&s.deleteRenderbuffer(i.msaaBuffer),i.stencil&&s.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,s=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,s):r.renderbufferStorage(r.RENDERBUFFER,h,i,s),r.framebufferRenderbuffer(r.FRAMEBUFFER,o,r.RENDERBUFFER,a)}reset(){this.current=this.unknownFramebuffer,this.viewport=new vt}destroy(){this.renderer=null}}Tx.extension={type:Xe.RendererSystem,name:"framebuffer"};ze.add(Tx);const Ed={5126:4,5123:2,5121:1};class Mx{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;$e.PREFER_ENV===va.WEBGL_LEGACY&&(i=null),i?(e.createVertexArray=()=>i.createVertexArrayOES(),e.bindVertexArray=s=>i.bindVertexArrayOES(s),e.deleteVertexArray=s=>i.deleteVertexArrayOES(s)):(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=(s,r)=>i.vertexAttribDivisorANGLE(s,r),e.drawElementsInstanced=(s,r,a,o,h)=>i.drawElementsInstancedANGLE(s,r,a,o,h),e.drawArraysInstanced=(s,r,a,o)=>i.drawArraysInstancedANGLE(s,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 s=e.glVertexArrayObjects[this.CONTEXT_UID],r=!1;s||(this.managedGeometries[e.id]=e,e.disposeRunner.add(this),e.glVertexArrayObjects[this.CONTEXT_UID]=s={},r=!0);const a=s[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 s=e.buffers[i];t.update(s)}}checkCompatibility(e,t){const i=e.attributes,s=t.attributeData;for(const r in s)if(!i[r])throw new Error(`shader and geometry incompatible, geometry missing the "${r}" attribute`)}getSignature(e,t){const i=e.attributes,s=t.attributeData,r=["g",e.id];for(const a in i)s[a]&&r.push(a,s[a].location);return r.join("-")}initGeometryVao(e,t,i=!0){const s=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*Ed[d[m].type];for(const m in d){const g=d[m],y=g.size;g.stride===void 0&&(f[g.buffer]===y*Ed[g.type]?g.stride=0:g.stride=f[g.buffer]),g.start===void 0&&(g.start=p[g.buffer],p[g.buffer]+=y*Ed[g.type])}c=s.createVertexArray(),s.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,s.bindVertexArray(null),a.unbind(gn.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],s=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(),s.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,s=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[s];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,s){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,s||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(),s||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}}Mx.extension={type:Xe.RendererSystem,name:"geometry"};ze.add(Mx);const _0=new Zt;class Ym{constructor(e,t){this._texture=e,this.mapCoord=new Zt,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 s=0;s<e.length;s+=2){const r=e[s],a=e[s+1];t[s]=r*i.a+a*i.c+i.tx,t[s+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 s=t.orig,r=t.trim;r&&(_0.set(s.width/r.width,0,0,s.height/r.height,-r.x/r.width,-r.y/r.height),this.mapCoord.append(_0));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 rE=`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;
|
||
}
|
||
`,aE=`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 oE extends qi{constructor(e,t,i){let s=null;typeof e!="string"&&t===void 0&&i===void 0&&(s=e,e=void 0,t=void 0,i=void 0),super(e||aE,t||rE,i),this.maskSprite=s,this.maskMatrix=new Zt}get maskSprite(){return this._maskSprite}set maskSprite(e){this._maskSprite=e,this._maskSprite&&(this._maskSprite.renderable=!1)}apply(e,t,i,s){const r=this._maskSprite,a=r._texture;a.valid&&(a.uvMatrix||(a.uvMatrix=new Ym(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,s))}}class lE{constructor(e=null){this.type=xi.NONE,this.autoDetect=!0,this.maskObject=e||null,this.pooled=!1,this.isMaskData=!0,this.resolution=null,this.multisample=qi.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=xi.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 Ex{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 lE;r.pooled=!0,r.maskObject=t,i=r}const s=this.maskStack.length!==0?this.maskStack[this.maskStack.length-1]:null;if(i.copyCountersOrReset(s),i._colorMask=s?s._colorMask:15,i.autoDetect&&this.detect(i),i._target=e,i.type!==xi.SPRITE&&this.maskStack.push(i),i.enabled)switch(i.type){case xi.SCISSOR:this.renderer.scissor.push(i);break;case xi.STENCIL:this.renderer.stencil.push(i);break;case xi.SPRITE:i.copyCountersOrReset(null),this.pushSpriteMask(i);break;case xi.COLOR:this.pushColorMask(i);break}i.type===xi.SPRITE&&this.maskStack.push(i)}pop(e){const t=this.maskStack.pop();if(!(!t||t._target!==e)){if(t.enabled)switch(t.type){case xi.SCISSOR:this.renderer.scissor.pop(t);break;case xi.STENCIL:this.renderer.stencil.pop(t.maskObject);break;case xi.SPRITE:this.popSpriteMask(t);break;case xi.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===xi.SPRITE&&i._filters&&(i._filters[0].maskSprite=i.maskObject)}}}detect(e){const t=e.maskObject;t?t.isSprite?e.type=xi.SPRITE:this.enableScissor&&this.renderer.scissor.testScissor(e)?e.type=xi.SCISSOR:e.type=xi.STENCIL:e.type=xi.COLOR}pushSpriteMask(e){const{maskObject:t}=e,i=e._target;let s=e._filters;s||(s=this.alphaMaskPool[this.alphaMaskIndex],s||(s=this.alphaMaskPool[this.alphaMaskIndex]=[new oE])),s[0].resolution=e.resolution,s[0].multisample=e.multisample,s[0].maskSprite=t;const r=i.filterArea;i.filterArea=t.getBounds(!0),this.renderer.filter.push(i,s),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}}Ex.extension={type:Xe.RendererSystem,name:"mask"};ze.add(Ex);class Ax{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 s=this.getStackLength();s!==i&&(s===0?t.disable(this.glConst):(t.enable(this.glConst),this._useCurrent()))}_useCurrent(){}destroy(){this.renderer=null,this.maskStack=null}}const T0=new Zt,M0=[],Cx=class Sc extends Ax{constructor(e){super(e),this.glConst=$e.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:s}=this,r=s.renderTexture,a=i.getBounds(!0,M0.pop()??new vt);this.roundFrameToPixels(a,r.current?r.current.resolution:s.resolution,r.sourceFrame,r.destinationFrame,s.projection.transform),t&&a.fit(t),e._scissorRectLocal=a}static isMatrixRotated(e){if(!e)return!1;const{a:t,b:i,c:s,d:r}=e;return(Math.abs(i)>1e-4||Math.abs(s)>1e-4)&&(Math.abs(t)>1e-4||Math.abs(r)>1e-4)}testScissor(e){const{maskObject:t}=e;if(!t.isFastRect||!t.isFastRect()||Sc.isMatrixRotated(t.worldTransform)||Sc.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,s,r){Sc.isMatrixRotated(r)||(r=r?T0.copyFrom(r):T0.identity(),r.translate(-i.x,-i.y).scale(s.width/i.width,s.height/i.height).translate(s.x,s.y),this.renderer.filter.transformAABB(r,e),e.fit(s),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&&M0.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)}};Cx.extension={type:Xe.RendererSystem,name:"scissor"};let cE=Cx;ze.add(cE);class Ix extends Ax{constructor(e){super(e),this.glConst=$e.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,s=e._stencilCounter;s===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,s,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,s=i?i._colorMask:15;s!==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,s!==0&&(i._colorMask=s,t.colorMask((s&1)!==0,(s&2)!==0,(s&4)!==0,(s&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)}}Ix.extension={type:Xe.RendererSystem,name:"stencil"};ze.add(Ix);class Rx{constructor(e){this.renderer=e,this.plugins={},Object.defineProperties(this.plugins,{extract:{enumerable:!1,get(){return Mt("7.0.0","renderer.plugins.extract has moved to renderer.extract"),e.extract}},prepare:{enumerable:!1,get(){return Mt("7.0.0","renderer.plugins.prepare has moved to renderer.prepare"),e.prepare}},interaction:{enumerable:!1,get(){return Mt("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}}Rx.extension={type:[Xe.RendererSystem,Xe.CanvasRendererSystem],name:"_plugin"};ze.add(Rx);class Px{constructor(e){this.renderer=e,this.destinationFrame=null,this.sourceFrame=null,this.defaultFrame=null,this.projectionMatrix=new Zt,this.transform=null}update(e,t,i,s){this.destinationFrame=e||this.destinationFrame||this.defaultFrame,this.sourceFrame=t||this.sourceFrame||e,this.calculateProjection(this.destinationFrame,this.sourceFrame,i,s),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,s){const r=this.projectionMatrix,a=s?-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}}Px.extension={type:Xe.RendererSystem,name:"projection"};ze.add(Px);const hE=new Um,E0=new vt;class kx{constructor(e){this.renderer=e,this._tempMatrix=new Zt}generateTexture(e,t){const{region:i,...s}=t||{},r=(i==null?void 0:i.copyTo(E0))||e.getLocalBounds(E0,!0),a=s.resolution||this.renderer.resolution;r.width=Math.max(r.width,1/a),r.height=Math.max(r.height,1/a),s.width=r.width,s.height=r.height,s.resolution=a,s.multisample??(s.multisample=this.renderer.multisample);const o=ya.create(s);this._tempMatrix.tx=-r.x,this._tempMatrix.ty=-r.y;const h=e.transform;return e.transform=hE,this.renderer.render(e,{renderTexture:o,transform:this._tempMatrix,skipUpdateTransform:!!e.parent,blit:!0}),e.transform=h,o}destroy(){}}kx.extension={type:[Xe.RendererSystem,Xe.CanvasRendererSystem],name:"textureGenerator"};ze.add(kx);const Yr=new vt,ko=new vt;class Fx{constructor(e){this.renderer=e,this.defaultMaskStack=[],this.current=null,this.sourceFrame=new vt,this.destinationFrame=new vt,this.viewportFrame=new vt}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 s=this.renderer;this.current=e;let r,a,o;e?(r=e.baseTexture,o=r.resolution,t||(Yr.width=e.frame.width,Yr.height=e.frame.height,t=Yr),i||(ko.x=e.frame.x,ko.y=e.frame.y,ko.width=t.width,ko.height=t.height,i=ko),a=r.framebuffer):(o=s.resolution,t||(Yr.width=s._view.screen.width,Yr.height=s._view.screen.height,t=Yr),i||(i=Yr,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=s.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,s=Lt.shared.setValue(e||i);(this.current&&this.current.baseTexture.alphaMode>0||!this.current&&this._rendererPremultipliedAlpha)&&s.premultiply(s.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(s.red,s.green,s.blue,s.alpha,t),o&&this.renderer.scissor.pop()}resize(){this.bind(null)}reset(){this.bind(null)}destroy(){this.renderer=null}}Fx.extension={type:Xe.RendererSystem,name:"renderTexture"};ze.add(Fx);class uE{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 dE(n,e){const t={},i=e.getProgramParameter(n,e.ACTIVE_ATTRIBUTES);for(let s=0;s<i;s++){const r=e.getActiveAttrib(n,s);if(r.name.startsWith("gl_"))continue;const a=gx(e,r.type),o={type:a,name:r.name,size:px(a),location:e.getAttribLocation(n,r.name)};t[r.name]=o}return t}function fE(n,e){const t={},i=e.getProgramParameter(n,e.ACTIVE_UNIFORMS);for(let s=0;s<i;s++){const r=e.getActiveUniform(n,s),a=r.name.replace(/\[.*?\]$/,""),o=!!r.name.match(/\[.*?\]$/),h=gx(e,r.type);t[a]={name:a,index:s,type:h,size:r.size,isArray:o,value:fx(h,r.size)}}return t}function mE(n,e){var o;const t=v0(n,n.VERTEX_SHADER,e.vertexSrc),i=v0(n,n.FRAGMENT_SHADER,e.fragmentSrc),s=n.createProgram();n.attachShader(s,t),n.attachShader(s,i);const r=(o=e.extra)==null?void 0:o.transformFeedbackVaryings;if(r&&(typeof n.transformFeedbackVaryings!="function"?console.warn("TransformFeedback is not supported but TransformFeedbackVaryings are given."):n.transformFeedbackVaryings(s,r.names,r.bufferMode==="separate"?n.SEPARATE_ATTRIBS:n.INTERLEAVED_ATTRIBS)),n.linkProgram(s),n.getProgramParameter(s,n.LINK_STATUS)||GM(n,s,t,i),e.attributeData=dE(s,n),e.uniformData=fE(s,n),!/^[ \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,n.bindAttribLocation(s,l,h[l]);n.linkProgram(s)}n.deleteShader(t),n.deleteShader(i);const a={};for(const h in e.uniformData){const l=e.uniformData[h];a[h]={location:n.getUniformLocation(s,h),value:fx(l.type,l.size)}}return new uE(s,a)}function pE(n,e,t,i,s){t.buffer.update(s)}const gE={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];
|
||
}
|
||
`},Ox={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 vE(n){const e=n.map(r=>({data:r,offset:0,dataLen:0,dirty:0}));let t=0,i=0,s=0;for(let r=0;r<e.length;r++){const a=e[r];if(t=Ox[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,s+=o}i+t>16?(s=Math.ceil(s/16)*16,a.offset=s,s+=t,i=t):(a.offset=s,i+=t,s+=t)}return s=Math.ceil(s/16)*16,{uboElements:e,size:s}}function yE(n,e){const t=[];for(const i in n)e[i]&&t.push(e[i]);return t.sort((i,s)=>i.index-s.index),t}function xE(n,e){if(!n.autoManage)return{size:0,syncFunc:pE};const t=yE(n.uniforms,e),{uboElements:i,size:s}=vE(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=n.uniforms[o.data.name],l=o.data.name;let c=!1;for(let u=0;u<Qa.length;u++){const d=Qa[u];if(d.codeUbo&&d.test(o.data,h)){r.push(`offset = ${o.offset/4};`,Qa[u].codeUbo(o.data.name,h)),c=!0;break}}if(!c)if(o.data.size>1){const u=px(o.data.type),d=Math.max(Ox[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=gE[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:s,syncFunc:new Function("ud","uv","renderer","syncData","buffer",r.join(`
|
||
`))}}let bE=0;const Kl={textureCount:0,uboCount:0};class Bx{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=bE++}systemCheck(){if(!jM())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,s=i.glPrograms[this.renderer.CONTEXT_UID]||this.generateProgram(e);return this.shader=e,this.program!==i&&(this.program=i,this.gl.useProgram(s.program)),t||(Kl.textureCount=0,Kl.uboCount=0,this.syncUniformGroup(e.uniformGroup,Kl)),s}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]=YM(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 s=i.uniformGroups[e.id]||this.createSyncBufferGroup(e,i,t);e.buffer.update(),s(i.uniformData,e.uniforms,this.renderer,Kl,e.buffer)}this.renderer.buffer.bindBufferBase(e.buffer,i.uniformBufferBindings[t])}createSyncBufferGroup(e,t,i){const{gl:s}=this.renderer;this.renderer.buffer.bind(e.buffer);const r=this.gl.getUniformBlockIndex(t.program,i);t.uniformBufferBindings[i]=this.shader.uniformBindCount,s.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]=xE(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 s=e.uniforms,r=[`${i}-`];for(const a in s)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,s=mE(t,i);return i.glPrograms[this.renderer.CONTEXT_UID]=s,s}reset(){this.program=null,this.shader=null}disposeShader(e){this.shader===e&&(this.shader=null)}destroy(){this.renderer=null,this.destroyed=!0}}Bx.extension={type:Xe.RendererSystem,name:"shader"};ze.add(Bx);class Kc{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(){}}Kc.defaultOptions={hello:!1},Kc.extension={type:[Xe.RendererSystem,Xe.CanvasRendererSystem],name:"startup"};ze.add(Kc);function wE(n,e=[]){return e[st.NORMAL]=[n.ONE,n.ONE_MINUS_SRC_ALPHA],e[st.ADD]=[n.ONE,n.ONE],e[st.MULTIPLY]=[n.DST_COLOR,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA],e[st.SCREEN]=[n.ONE,n.ONE_MINUS_SRC_COLOR,n.ONE,n.ONE_MINUS_SRC_ALPHA],e[st.OVERLAY]=[n.ONE,n.ONE_MINUS_SRC_ALPHA],e[st.DARKEN]=[n.ONE,n.ONE_MINUS_SRC_ALPHA],e[st.LIGHTEN]=[n.ONE,n.ONE_MINUS_SRC_ALPHA],e[st.COLOR_DODGE]=[n.ONE,n.ONE_MINUS_SRC_ALPHA],e[st.COLOR_BURN]=[n.ONE,n.ONE_MINUS_SRC_ALPHA],e[st.HARD_LIGHT]=[n.ONE,n.ONE_MINUS_SRC_ALPHA],e[st.SOFT_LIGHT]=[n.ONE,n.ONE_MINUS_SRC_ALPHA],e[st.DIFFERENCE]=[n.ONE,n.ONE_MINUS_SRC_ALPHA],e[st.EXCLUSION]=[n.ONE,n.ONE_MINUS_SRC_ALPHA],e[st.HUE]=[n.ONE,n.ONE_MINUS_SRC_ALPHA],e[st.SATURATION]=[n.ONE,n.ONE_MINUS_SRC_ALPHA],e[st.COLOR]=[n.ONE,n.ONE_MINUS_SRC_ALPHA],e[st.LUMINOSITY]=[n.ONE,n.ONE_MINUS_SRC_ALPHA],e[st.NONE]=[0,0],e[st.NORMAL_NPM]=[n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA],e[st.ADD_NPM]=[n.SRC_ALPHA,n.ONE,n.ONE,n.ONE],e[st.SCREEN_NPM]=[n.SRC_ALPHA,n.ONE_MINUS_SRC_COLOR,n.ONE,n.ONE_MINUS_SRC_ALPHA],e[st.SRC_IN]=[n.DST_ALPHA,n.ZERO],e[st.SRC_OUT]=[n.ONE_MINUS_DST_ALPHA,n.ZERO],e[st.SRC_ATOP]=[n.DST_ALPHA,n.ONE_MINUS_SRC_ALPHA],e[st.DST_OVER]=[n.ONE_MINUS_DST_ALPHA,n.ONE],e[st.DST_IN]=[n.ZERO,n.SRC_ALPHA],e[st.DST_OUT]=[n.ZERO,n.ONE_MINUS_SRC_ALPHA],e[st.DST_ATOP]=[n.ONE_MINUS_DST_ALPHA,n.SRC_ALPHA],e[st.XOR]=[n.ONE_MINUS_DST_ALPHA,n.ONE_MINUS_SRC_ALPHA],e[st.SUBTRACT]=[n.ONE,n.ONE,n.ONE,n.ONE,n.FUNC_REVERSE_SUBTRACT,n.FUNC_ADD],e}const SE=0,_E=1,TE=2,ME=3,EE=4,AE=5,Lx=class Mf{constructor(){this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode=st.NONE,this._blendEq=!1,this.map=[],this.map[SE]=this.setBlend,this.map[_E]=this.setOffset,this.map[TE]=this.setCullFace,this.map[ME]=this.setDepthTest,this.map[EE]=this.setFrontFace,this.map[AE]=this.setDepthMask,this.checks=[],this.defaultState=new Sn,this.defaultState.blend=!0}contextChange(e){this.gl=e,this.blendModes=wE(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(Mf.checkBlendMode,e),this.gl[e?"enable":"disable"](this.gl.BLEND)}setOffset(e){this.updateCheck(Mf.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}};Lx.extension={type:Xe.RendererSystem,name:"state"};let CE=Lx;ze.add(CE);class IE extends El{constructor(){super(...arguments),this.runners={},this._systemsHash={}}setup(e){this.addRunners(...e.runners);const t=(e.priority??[]).filter(s=>e.systems[s]),i=[...t,...Object.keys(e.systems).filter(s=>!t.includes(s))];for(const s of i)this.addSystem(e.systems[s],s)}addRunners(...e){e.forEach(t=>{this.runners[t]=new Ns(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 s in this.runners)this.runners[s].add(i);return this}emitWithCustomOptions(e,t){const i=Object.keys(this._systemsHash);e.items.forEach(s=>{const r=i.find(a=>this._systemsHash[a]===s);s[e.name](t[r])})}destroy(){Object.values(this.runners).forEach(e=>{e.destroy()}),this._systemsHash={}}}const Vo=class _c{constructor(e){this.renderer=e,this.count=0,this.checkCount=0,this.maxIdle=_c.defaultMaxIdle,this.checkCountMax=_c.defaultCheckCountMax,this.mode=_c.defaultMode}postrender(){this.renderer.objectRenderer.renderingToScreen&&(this.count++,this.mode!==Bm.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 s=0;s<t.length;s++){const r=t[s];r.resource&&this.count-r.touched>this.maxIdle&&(e.destroyTexture(r,!0),t[s]=null,i=!0)}if(i){let s=0;for(let r=0;r<t.length;r++)t[r]!==null&&(t[s++]=t[r]);t.length=s}}unload(e){const t=this.renderer.texture,i=e._texture;i&&!i.framebuffer&&t.destroyTexture(i);for(let s=e.children.length-1;s>=0;s--)this.unload(e.children[s])}destroy(){this.renderer=null}};Vo.defaultMode=Bm.AUTO,Vo.defaultMaxIdle=3600,Vo.defaultCheckCountMax=600,Vo.extension={type:Xe.RendererSystem,name:"textureGC"};let qr=Vo;ze.add(qr);class Ad{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=We.UNSIGNED_BYTE,this.internalFormat=Oe.RGBA,this.samplerType=0}}function RE(n){let e;return"WebGL2RenderingContext"in globalThis&&n instanceof globalThis.WebGL2RenderingContext?e={[n.RGB]:Ge.FLOAT,[n.RGBA]:Ge.FLOAT,[n.ALPHA]:Ge.FLOAT,[n.LUMINANCE]:Ge.FLOAT,[n.LUMINANCE_ALPHA]:Ge.FLOAT,[n.R8]:Ge.FLOAT,[n.R8_SNORM]:Ge.FLOAT,[n.RG8]:Ge.FLOAT,[n.RG8_SNORM]:Ge.FLOAT,[n.RGB8]:Ge.FLOAT,[n.RGB8_SNORM]:Ge.FLOAT,[n.RGB565]:Ge.FLOAT,[n.RGBA4]:Ge.FLOAT,[n.RGB5_A1]:Ge.FLOAT,[n.RGBA8]:Ge.FLOAT,[n.RGBA8_SNORM]:Ge.FLOAT,[n.RGB10_A2]:Ge.FLOAT,[n.RGB10_A2UI]:Ge.FLOAT,[n.SRGB8]:Ge.FLOAT,[n.SRGB8_ALPHA8]:Ge.FLOAT,[n.R16F]:Ge.FLOAT,[n.RG16F]:Ge.FLOAT,[n.RGB16F]:Ge.FLOAT,[n.RGBA16F]:Ge.FLOAT,[n.R32F]:Ge.FLOAT,[n.RG32F]:Ge.FLOAT,[n.RGB32F]:Ge.FLOAT,[n.RGBA32F]:Ge.FLOAT,[n.R11F_G11F_B10F]:Ge.FLOAT,[n.RGB9_E5]:Ge.FLOAT,[n.R8I]:Ge.INT,[n.R8UI]:Ge.UINT,[n.R16I]:Ge.INT,[n.R16UI]:Ge.UINT,[n.R32I]:Ge.INT,[n.R32UI]:Ge.UINT,[n.RG8I]:Ge.INT,[n.RG8UI]:Ge.UINT,[n.RG16I]:Ge.INT,[n.RG16UI]:Ge.UINT,[n.RG32I]:Ge.INT,[n.RG32UI]:Ge.UINT,[n.RGB8I]:Ge.INT,[n.RGB8UI]:Ge.UINT,[n.RGB16I]:Ge.INT,[n.RGB16UI]:Ge.UINT,[n.RGB32I]:Ge.INT,[n.RGB32UI]:Ge.UINT,[n.RGBA8I]:Ge.INT,[n.RGBA8UI]:Ge.UINT,[n.RGBA16I]:Ge.INT,[n.RGBA16UI]:Ge.UINT,[n.RGBA32I]:Ge.INT,[n.RGBA32UI]:Ge.UINT,[n.DEPTH_COMPONENT16]:Ge.FLOAT,[n.DEPTH_COMPONENT24]:Ge.FLOAT,[n.DEPTH_COMPONENT32F]:Ge.FLOAT,[n.DEPTH_STENCIL]:Ge.FLOAT,[n.DEPTH24_STENCIL8]:Ge.FLOAT,[n.DEPTH32F_STENCIL8]:Ge.FLOAT}:e={[n.RGB]:Ge.FLOAT,[n.RGBA]:Ge.FLOAT,[n.ALPHA]:Ge.FLOAT,[n.LUMINANCE]:Ge.FLOAT,[n.LUMINANCE_ALPHA]:Ge.FLOAT,[n.DEPTH_STENCIL]:Ge.FLOAT},e}function PE(n){let e;return"WebGL2RenderingContext"in globalThis&&n instanceof globalThis.WebGL2RenderingContext?e={[We.UNSIGNED_BYTE]:{[Oe.RGBA]:n.RGBA8,[Oe.RGB]:n.RGB8,[Oe.RG]:n.RG8,[Oe.RED]:n.R8,[Oe.RGBA_INTEGER]:n.RGBA8UI,[Oe.RGB_INTEGER]:n.RGB8UI,[Oe.RG_INTEGER]:n.RG8UI,[Oe.RED_INTEGER]:n.R8UI,[Oe.ALPHA]:n.ALPHA,[Oe.LUMINANCE]:n.LUMINANCE,[Oe.LUMINANCE_ALPHA]:n.LUMINANCE_ALPHA},[We.BYTE]:{[Oe.RGBA]:n.RGBA8_SNORM,[Oe.RGB]:n.RGB8_SNORM,[Oe.RG]:n.RG8_SNORM,[Oe.RED]:n.R8_SNORM,[Oe.RGBA_INTEGER]:n.RGBA8I,[Oe.RGB_INTEGER]:n.RGB8I,[Oe.RG_INTEGER]:n.RG8I,[Oe.RED_INTEGER]:n.R8I},[We.UNSIGNED_SHORT]:{[Oe.RGBA_INTEGER]:n.RGBA16UI,[Oe.RGB_INTEGER]:n.RGB16UI,[Oe.RG_INTEGER]:n.RG16UI,[Oe.RED_INTEGER]:n.R16UI,[Oe.DEPTH_COMPONENT]:n.DEPTH_COMPONENT16},[We.SHORT]:{[Oe.RGBA_INTEGER]:n.RGBA16I,[Oe.RGB_INTEGER]:n.RGB16I,[Oe.RG_INTEGER]:n.RG16I,[Oe.RED_INTEGER]:n.R16I},[We.UNSIGNED_INT]:{[Oe.RGBA_INTEGER]:n.RGBA32UI,[Oe.RGB_INTEGER]:n.RGB32UI,[Oe.RG_INTEGER]:n.RG32UI,[Oe.RED_INTEGER]:n.R32UI,[Oe.DEPTH_COMPONENT]:n.DEPTH_COMPONENT24},[We.INT]:{[Oe.RGBA_INTEGER]:n.RGBA32I,[Oe.RGB_INTEGER]:n.RGB32I,[Oe.RG_INTEGER]:n.RG32I,[Oe.RED_INTEGER]:n.R32I},[We.FLOAT]:{[Oe.RGBA]:n.RGBA32F,[Oe.RGB]:n.RGB32F,[Oe.RG]:n.RG32F,[Oe.RED]:n.R32F,[Oe.DEPTH_COMPONENT]:n.DEPTH_COMPONENT32F},[We.HALF_FLOAT]:{[Oe.RGBA]:n.RGBA16F,[Oe.RGB]:n.RGB16F,[Oe.RG]:n.RG16F,[Oe.RED]:n.R16F},[We.UNSIGNED_SHORT_5_6_5]:{[Oe.RGB]:n.RGB565},[We.UNSIGNED_SHORT_4_4_4_4]:{[Oe.RGBA]:n.RGBA4},[We.UNSIGNED_SHORT_5_5_5_1]:{[Oe.RGBA]:n.RGB5_A1},[We.UNSIGNED_INT_2_10_10_10_REV]:{[Oe.RGBA]:n.RGB10_A2,[Oe.RGBA_INTEGER]:n.RGB10_A2UI},[We.UNSIGNED_INT_10F_11F_11F_REV]:{[Oe.RGB]:n.R11F_G11F_B10F},[We.UNSIGNED_INT_5_9_9_9_REV]:{[Oe.RGB]:n.RGB9_E5},[We.UNSIGNED_INT_24_8]:{[Oe.DEPTH_STENCIL]:n.DEPTH24_STENCIL8},[We.FLOAT_32_UNSIGNED_INT_24_8_REV]:{[Oe.DEPTH_STENCIL]:n.DEPTH32F_STENCIL8}}:e={[We.UNSIGNED_BYTE]:{[Oe.RGBA]:n.RGBA,[Oe.RGB]:n.RGB,[Oe.ALPHA]:n.ALPHA,[Oe.LUMINANCE]:n.LUMINANCE,[Oe.LUMINANCE_ALPHA]:n.LUMINANCE_ALPHA},[We.UNSIGNED_SHORT_5_6_5]:{[Oe.RGB]:n.RGB},[We.UNSIGNED_SHORT_4_4_4_4]:{[Oe.RGBA]:n.RGBA},[We.UNSIGNED_SHORT_5_5_5_1]:{[Oe.RGBA]:n.RGBA}},e}class Dx{constructor(e){this.renderer=e,this.boundTextures=[],this.currentLocation=-1,this.managedTextures=[],this._unknownBoundTextures=!1,this.unknownTexture=new ot,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=PE(e),this.samplerTypes=RE(e);const t=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS);this.boundTextures.length=t;for(let s=0;s<t;s++)this.boundTextures[s]=null;this.emptyTextures={};const i=new Ad(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 Ad(e.createTexture()),e.bindTexture(e.TEXTURE_CUBE_MAP,this.emptyTextures[e.TEXTURE_CUBE_MAP].texture);for(let s=0;s<6;s++)e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+s,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 s=0;s<this.boundTextures.length;s++)this.bind(null,s)}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 s=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,s.texture)),s.dirtyId!==e.dirtyId?(this.currentLocation!==t&&(this.currentLocation=t,i.activeTexture(i.TEXTURE0+t)),this.updateTexture(e)):s.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 s=0;s<i.length;s++)i[s]===this.unknownTexture&&this.bind(null,s)}for(let s=0;s<i.length;s++)i[s]===e&&(this.currentLocation!==s&&(t.activeTexture(t.TEXTURE0+s),this.currentLocation=s),t.bindTexture(e.target,this.emptyTextures[e.target].texture),i[s]=null)}ensureSamplerType(e){const{boundTextures:t,hasIntegerTextures:i,CONTEXT_UID:s}=this;if(i)for(let r=e-1;r>=0;--r){const a=t[r];a&&a._glTextures[s].samplerType!==Ge.FLOAT&&this.renderer.texture.unbind(a)}}initTexture(e){const t=new Ad(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]??Ge.FLOAT,this.webGLVersion===2&&e.type===We.HALF_FLOAT?t.type=this.gl.HALF_FLOAT:t.type=e.type}updateTexture(e){var s;const t=e._glTextures[this.CONTEXT_UID];if(!t)return;const i=this.renderer;if(this.initTextureType(e,t),(s=e.resource)==null?void 0:s.upload(i,e,t))t.samplerType!==Ge.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 s=this.managedTextures.indexOf(e);s!==-1&&Ja(this.managedTextures,s,1)}}updateTextureStyle(e){var i;const t=e._glTextures[this.CONTEXT_UID];t&&((e.mipmap===ws.POW2||this.webGLVersion!==2)&&!e.isPowerOfTwo?t.mipmap=!1:t.mipmap=e.mipmap>=1,this.webGLVersion!==2&&!e.isPowerOfTwo?t.wrapMode=Ds.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!==ws.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===Os.LINEAR?i.LINEAR_MIPMAP_LINEAR:i.NEAREST_MIPMAP_NEAREST);const s=this.renderer.context.extensions.anisotropicFiltering;if(s&&e.anisotropicLevel>0&&e.scaleMode===Os.LINEAR){const r=Math.min(e.anisotropicLevel,i.getParameter(s.MAX_TEXTURE_MAX_ANISOTROPY_EXT));i.texParameterf(e.target,s.TEXTURE_MAX_ANISOTROPY_EXT,r)}}else i.texParameteri(e.target,i.TEXTURE_MIN_FILTER,e.scaleMode===Os.LINEAR?i.LINEAR:i.NEAREST);i.texParameteri(e.target,i.TEXTURE_MAG_FILTER,e.scaleMode===Os.LINEAR?i.LINEAR:i.NEAREST)}destroy(){this.renderer=null}}Dx.extension={type:Xe.RendererSystem,name:"texture"};ze.add(Dx);class Nx{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,s=e._glTransformFeedbacks[i]||this.createGLTransformFeedback(e);t.bindTransformFeedback(t.TRANSFORM_FEEDBACK,s)}unbind(){const{gl:e}=this;e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,null)}beginTransformFeedback(e,t){const{gl:i,renderer:s}=this;t&&s.shader.bind(t),i.beginTransformFeedback(e)}endTransformFeedback(){const{gl:e}=this;e.endTransformFeedback()}createGLTransformFeedback(e){const{gl:t,renderer:i,CONTEXT_UID:s}=this,r=t.createTransformFeedback();e._glTransformFeedbacks[s]=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[s].refCount++,t.bindBufferBase(t.TRANSFORM_FEEDBACK_BUFFER,a,o._glBuffers[s].buffer||null))}return t.bindTransformFeedback(t.TRANSFORM_FEEDBACK,null),e.disposeRunner.add(this),r}disposeTransformFeedback(e,t){const i=e._glTransformFeedbacks[this.CONTEXT_UID],s=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||s.deleteTransformFeedback(i),delete e._glTransformFeedbacks[this.CONTEXT_UID])}destroy(){this.renderer=null}}Nx.extension={type:Xe.RendererSystem,name:"transformFeedback"};ze.add(Nx);class Zc{constructor(e){this.renderer=e}init(e){this.screen=new vt(0,0,e.width,e.height),this.element=e.view||$e.ADAPTER.createCanvas(),this.resolution=e.resolution||$e.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,s=this.element.height/this.resolution;this.screen.width=i,this.screen.height=s,this.autoDensity&&(this.element.style.width=`${i}px`,this.element.style.height=`${s}px`),this.renderer.emit("resize",i,s),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}}Zc.defaultOptions={width:800,height:600,resolution:void 0,autoDensity:!1},Zc.extension={type:[Xe.RendererSystem,Xe.CanvasRendererSystem],name:"_view"};ze.add(Zc);$e.PREFER_ENV=va.WEBGL2;$e.STRICT_TEXTURE_CACHE=!1;$e.RENDER_OPTIONS={...qc.defaultOptions,...zc.defaultOptions,...Zc.defaultOptions,...Kc.defaultOptions};Object.defineProperties($e,{WRAP_MODE:{get(){return ot.defaultOptions.wrapMode},set(n){Mt("7.1.0","settings.WRAP_MODE is deprecated, use BaseTexture.defaultOptions.wrapMode"),ot.defaultOptions.wrapMode=n}},SCALE_MODE:{get(){return ot.defaultOptions.scaleMode},set(n){Mt("7.1.0","settings.SCALE_MODE is deprecated, use BaseTexture.defaultOptions.scaleMode"),ot.defaultOptions.scaleMode=n}},MIPMAP_TEXTURES:{get(){return ot.defaultOptions.mipmap},set(n){Mt("7.1.0","settings.MIPMAP_TEXTURES is deprecated, use BaseTexture.defaultOptions.mipmap"),ot.defaultOptions.mipmap=n}},ANISOTROPIC_LEVEL:{get(){return ot.defaultOptions.anisotropicLevel},set(n){Mt("7.1.0","settings.ANISOTROPIC_LEVEL is deprecated, use BaseTexture.defaultOptions.anisotropicLevel"),ot.defaultOptions.anisotropicLevel=n}},FILTER_RESOLUTION:{get(){return Mt("7.1.0","settings.FILTER_RESOLUTION is deprecated, use Filter.defaultResolution"),qi.defaultResolution},set(n){qi.defaultResolution=n}},FILTER_MULTISAMPLE:{get(){return Mt("7.1.0","settings.FILTER_MULTISAMPLE is deprecated, use Filter.defaultMultisample"),qi.defaultMultisample},set(n){qi.defaultMultisample=n}},SPRITE_MAX_TEXTURES:{get(){return fr.defaultMaxTextures},set(n){Mt("7.1.0","settings.SPRITE_MAX_TEXTURES is deprecated, use BatchRenderer.defaultMaxTextures"),fr.defaultMaxTextures=n}},SPRITE_BATCH_SIZE:{get(){return fr.defaultBatchSize},set(n){Mt("7.1.0","settings.SPRITE_BATCH_SIZE is deprecated, use BatchRenderer.defaultBatchSize"),fr.defaultBatchSize=n}},CAN_UPLOAD_SAME_BUFFER:{get(){return fr.canUploadSameBuffer},set(n){Mt("7.1.0","settings.CAN_UPLOAD_SAME_BUFFER is deprecated, use BatchRenderer.canUploadSameBuffer"),fr.canUploadSameBuffer=n}},GC_MODE:{get(){return qr.defaultMode},set(n){Mt("7.1.0","settings.GC_MODE is deprecated, use TextureGCSystem.defaultMode"),qr.defaultMode=n}},GC_MAX_IDLE:{get(){return qr.defaultMaxIdle},set(n){Mt("7.1.0","settings.GC_MAX_IDLE is deprecated, use TextureGCSystem.defaultMaxIdle"),qr.defaultMaxIdle=n}},GC_MAX_CHECK_COUNT:{get(){return qr.defaultCheckCountMax},set(n){Mt("7.1.0","settings.GC_MAX_CHECK_COUNT is deprecated, use TextureGCSystem.defaultCheckCountMax"),qr.defaultCheckCountMax=n}},PRECISION_VERTEX:{get(){return fn.defaultVertexPrecision},set(n){Mt("7.1.0","settings.PRECISION_VERTEX is deprecated, use Program.defaultVertexPrecision"),fn.defaultVertexPrecision=n}},PRECISION_FRAGMENT:{get(){return fn.defaultFragmentPrecision},set(n){Mt("7.1.0","settings.PRECISION_FRAGMENT is deprecated, use Program.defaultFragmentPrecision"),fn.defaultFragmentPrecision=n}}});var fa=(n=>(n[n.INTERACTION=50]="INTERACTION",n[n.HIGH=25]="HIGH",n[n.NORMAL=0]="NORMAL",n[n.LOW=-25]="LOW",n[n.UTILITY=-50]="UTILITY",n))(fa||{});class Cd{constructor(e,t=null,i=0,s=!1){this.next=null,this.previous=null,this._destroyed=!1,this.fn=e,this.context=t,this.priority=i,this.once=s}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 Ux=class as{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 Cd(null,null,1/0),this.deltaMS=1/as.targetFPMS,this.elapsedMS=1/as.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 Cd(e,t,i))}addOnce(e,t,i=fa.NORMAL){return this._addListener(new Cd(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*as.targetFPMS;const i=this._head;let s=i.next;for(;s;)s=s.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,as.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(!as._shared){const e=as._shared=new as;e.autoStart=!0,e._protected=!0}return as._shared}static get system(){if(!as._system){const e=as._system=new as;e.autoStart=!0,e._protected=!0}return as._system}};Ux.targetFPMS=.06;let Ki=Ux;Object.defineProperties($e,{TARGET_FPMS:{get(){return Ki.targetFPMS},set(n){Mt("7.1.0","settings.TARGET_FPMS is deprecated, use Ticker.targetFPMS"),Ki.targetFPMS=n}}});class Xx{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?Ki.shared:new Ki,e.autoStart&&this.start()}static destroy(){if(this._ticker){const e=this._ticker;this.ticker=null,e.destroy()}}}Xx.extension=Xe.Application;ze.add(Xx);const Yx=[];ze.handleByList(Xe.Renderer,Yx);function kE(n){for(const e of Yx)if(e.test(n))return new e(n);throw new Error("Unable to auto-detect a suitable renderer.")}var FE=`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;
|
||
}`,OE=`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 BE=FE,Vx=OE;class $x{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>=mi.HIGH?this.multisample=mi.HIGH:t>=mi.MEDIUM?this.multisample=mi.MEDIUM:t>=mi.LOW?this.multisample=mi.LOW:this.multisample=mi.NONE}destroy(){}}$x.extension={type:Xe.RendererSystem,name:"_multisample"};ze.add($x);class LE{constructor(e){this.buffer=e||null,this.updateID=-1,this.byteLength=-1,this.refCount=0}}class Gx{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,s=e._glBuffers[i]||this.createGLBuffer(e);t.bindBuffer(e.type,s.buffer)}unbind(e){const{gl:t}=this;t.bindBuffer(e,null)}bindBufferBase(e,t){const{gl:i,CONTEXT_UID:s}=this;if(this.boundBufferBases[t]!==e){const r=e._glBuffers[s]||this.createGLBuffer(e);this.boundBufferBases[t]=e,i.bindBufferBase(i.UNIFORM_BUFFER,t,r.buffer)}}bindBufferRange(e,t,i){const{gl:s,CONTEXT_UID:r}=this;i=i||0;const a=e._glBuffers[r]||this.createGLBuffer(e);s.bindBufferRange(s.UNIFORM_BUFFER,t||0,a.buffer,i*256,256)}update(e){const{gl:t,CONTEXT_UID:i}=this,s=e._glBuffers[i]||this.createGLBuffer(e);if(e._updateID!==s.updateID)if(s.updateID=e._updateID,t.bindBuffer(e.type,s.buffer),s.byteLength>=e.data.byteLength)t.bufferSubData(e.type,0,e.data);else{const r=e.static?t.STATIC_DRAW:t.DYNAMIC_DRAW;s.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],s=this.gl;e.disposeRunner.remove(this),i&&(t||s.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 LE(i.createBuffer()),this.managedBuffers[e.id]=e,e.disposeRunner.add(this),e._glBuffers[t]}}Gx.extension={type:Xe.RendererSystem,name:"buffer"};ze.add(Gx);class Hx{constructor(e){this.renderer=e}render(e,t){const i=this.renderer;let s,r,a,o;if(t&&(s=t.renderTexture,r=t.clear,a=t.transform,o=t.skipUpdateTransform),this.renderingToScreen=!s,i.runners.prerender.emit(),i.emit("prerender"),i.projection.transform=a,!i.context.isLost){if(s||(this.lastObjectRendered=e),!o){const h=e.enableTempParent();e.updateTransform(),e.disableTempParent(h)}i.renderTexture.bind(s),i.batch.currentRenderer.start(),(r??i.background.clearBeforeRender)&&i.renderTexture.clear(),e.render(i),i.batch.currentRenderer.flush(),s&&(t.blit&&i.framebuffer.blit(),s.baseTexture.update()),i.runners.postrender.emit(),i.projection.transform=null,i.emit("postrender")}}destroy(){this.renderer=null,this.lastObjectRendered=null}}Hx.extension={type:Xe.RendererSystem,name:"objectRenderer"};ze.add(Hx);const Tc=class Ef extends IE{constructor(e){super(),this.type=Hy.WEBGL,e=Object.assign({},$e.RENDER_OPTIONS,e),this.gl=null,this.CONTEXT_UID=0,this.globalUniforms=new Us({projectionMatrix:new Zt},!0);const t={runners:["init","destroy","contextChange","resolutionChange","reset","update","postrender","prerender","resize"],systems:Ef.__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&&(Mt("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=Ef.__plugins,this.options=e,this.startup.run(this.options)}static test(e){return e!=null&&e.forceCanvas?!1:aM()}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 Mt("7.0.0","renderer.clearBeforeRender has been deprecated, please use renderer.background.clearBeforeRender instead."),this.background.clearBeforeRender}get useContextAlpha(){return Mt("7.0.0","renderer.useContextAlpha has been deprecated, please use renderer.context.premultipliedAlpha instead."),this.context.useContextAlpha}get preserveDrawingBuffer(){return Mt("7.0.0","renderer.preserveDrawingBuffer has been deprecated, we cannot truly know this unless pixi created the context"),this.context.preserveDrawingBuffer}get backgroundColor(){return Mt("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color}set backgroundColor(e){Mt("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color=e}get backgroundAlpha(){return Mt("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha}set backgroundAlpha(e){Mt("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha=e}get powerPreference(){return Mt("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)}};Tc.extension={type:Xe.Renderer,priority:1},Tc.__plugins={},Tc.__systems={};let Vm=Tc;ze.handleByMap(Xe.RendererPlugin,Vm.__plugins);ze.handleByMap(Xe.RendererSystem,Vm.__systems);ze.add(Vm);class jx extends pl{constructor(e,t){const{width:i,height:s}=t||{};super(i,s),this.items=[],this.itemDirtyIds=[];for(let r=0;r<e;r++){const a=new ot;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 pl?this.addResourceAt(e[i],i):this.addResourceAt(hx(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 DE extends jx{constructor(e,t){const{width:i,height:s}=t||{};let r,a;Array.isArray(e)?(r=e,a=e.length):a=e,super(a,{width:i,height:s}),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=Za.TEXTURE_2D_ARRAY}upload(e,t,i){const{length:s,itemDirtyIds:r,items:a}=this,{gl:o}=e;i.dirtyId<0&&o.texImage3D(o.TEXTURE_2D_ARRAY,0,i.internalFormat,this._width,this._height,s,0,t.format,i.type,null);for(let h=0;h<s;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 NE extends er{constructor(e){super(e)}static test(e){const{OffscreenCanvas:t}=globalThis;return t&&e instanceof t?!0:globalThis.HTMLCanvasElement&&e instanceof HTMLCanvasElement}}const Wx=class $o extends jx{constructor(e,t){const{width:i,height:s,autoLoad:r,linkBaseTexture:a}=t||{};if(e&&e.length!==$o.SIDES)throw new Error(`Invalid length. Got ${e.length}, expected 6`);super(6,{width:i,height:s});for(let o=0;o<$o.SIDES;o++)this.items[o].target=Za.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=Za.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=Za.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 s=this.itemDirtyIds;for(let r=0;r<$o.SIDES;r++){const a=this.items[r];(s[r]<a.dirtyId||i.dirtyId<t.dirtyId)&&(a.valid&&a.resource?(a.resource.upload(e,a,i),s[r]=a.dirtyId):s[r]<-1&&(e.gl.texImage2D(a.target,0,i.internalFormat,t.realWidth,t.realHeight,0,t.format,i.type,null),s[r]=-1))}return!0}static test(e){return Array.isArray(e)&&e.length===$o.SIDES}};Wx.SIDES=6;let UE=Wx;class $a extends er{constructor(e,t){t=t||{};let i,s,r;typeof e=="string"?(i=$a.EMPTY,s=e,r=!0):(i=e,s=null,r=!1),super(i),this.url=s,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 $e.ADAPTER.fetch(this.url,{mode:this.crossOrigin?"cors":"no-cors"});if(this.destroyed)return;const s=await i.blob();if(this.destroyed)return;const r=await createImageBitmap(s,{premultiplyAlpha:this.alphaMode===null||this.alphaMode===Ai.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 $a._EMPTY=$a._EMPTY??$e.ADAPTER.createCanvas(0,0),$a._EMPTY}}const Af=class Mc extends er{constructor(e,t){t=t||{},super($e.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)},Mc.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;er.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 s=t*this.scale,r=i*this.scale;(this._overrideWidth||this._overrideHeight)&&(s=this._overrideWidth||this._overrideHeight/i*t,r=this._overrideHeight||this._overrideWidth/t*i),s=Math.round(s),r=Math.round(r);const a=this.source;a.width=s,a.height=r,a._pixiId=`canvas_${da()}`,a.getContext("2d").drawImage(e,0,0,t,i,0,0,s,r),this._resolve(),this._resolve=null}}static getSize(e){const t=Mc.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"&&Mc.SVG_XML.test(e)}};Af.SVG_XML=/^(<\?xml[^?]+\?>)?\s*(<!--[^(-->)]*-->)?\s*\<svg/m,Af.SVG_SIZE=/<svg[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i;let Cf=Af;class XE extends er{constructor(e){super(e)}static test(e){return!!globalThis.VideoFrame&&e instanceof globalThis.VideoFrame}}const If=class Rf extends er{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 s=e[0].src||e[0];er.crossOrigin(i,s,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||Rf.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=Ki.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&&(Ki.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||(Ki.shared.add(this.update,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.source.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(Ki.shared.remove(this.update,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(e,t){return globalThis.HTMLVideoElement&&e instanceof HTMLVideoElement||Rf.TYPES.includes(t)}};If.TYPES=["mp4","m4v","webm","ogg","ogv","h264","avi","mov"],If.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};let zx=If;gf.push($a,bx,NE,zx,XE,Cf,Gh,UE,DE);class gl{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?vt.EMPTY:(e=e||new vt(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:s,c:r,d:a,tx:o,ty:h}=e,l=i*t.x+r*t.y+o,c=s*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,s=this.maxX,r=this.maxY,a=e[0],o=e[1];t=a<t?a:t,i=o<i?o:i,s=a>s?a:s,r=o>r?o:r,a=e[2],o=e[3],t=a<t?a:t,i=o<i?o:i,s=a>s?a:s,r=o>r?o:r,a=e[4],o=e[5],t=a<t?a:t,i=o<i?o:i,s=a>s?a:s,r=o>r?o:r,a=e[6],o=e[7],t=a<t?a:t,i=o<i?o:i,s=a>s?a:s,r=o>r?o:r,this.minX=t,this.minY=i,this.maxX=s,this.maxY=r}addFrame(e,t,i,s,r){this.addFrameMatrix(e.worldTransform,t,i,s,r)}addFrameMatrix(e,t,i,s,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,y=o*t+l*i+u;d=g<d?g:d,f=y<f?y:f,p=g>p?g:p,m=y>m?y:m,g=a*s+h*i+c,y=o*s+l*i+u,d=g<d?g:d,f=y<f?y:f,p=g>p?g:p,m=y>m?y:m,g=a*t+h*r+c,y=o*t+l*r+u,d=g<d?g:d,f=y<f?y:f,p=g>p?g:p,m=y>m?y:m,g=a*s+h*r+c,y=o*s+l*r+u,d=g<d?g:d,f=y<f?y:f,p=g>p?g:p,m=y>m?y:m,this.minX=d,this.minY=f,this.maxX=p,this.maxY=m}addVertexData(e,t,i){let s=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];s=l<s?l:s,r=c<r?c:r,a=l>a?l:a,o=c>o?c:o}this.minX=s,this.minY=r,this.maxX=a,this.maxY=o}addVertices(e,t,i,s){this.addVerticesMatrix(e.worldTransform,t,i,s)}addVerticesMatrix(e,t,i,s,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 y=i;y<s;y+=2){const w=t[y],v=t[y+1],_=o*w+l*v+u,x=c*v+h*w+d;f=Math.min(f,_-r),m=Math.max(m,_+r),p=Math.min(p,x-a),g=Math.max(g,x+a)}this.minX=f,this.minY=p,this.maxX=m,this.maxY=g}addBounds(e){const t=this.minX,i=this.minY,s=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>s?e.maxX:s,this.maxY=e.maxY>r?e.maxY:r}addBoundsMask(e,t){const i=e.minX>t.minX?e.minX:t.minX,s=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&&s<=a){const o=this.minX,h=this.minY,l=this.maxX,c=this.maxY;this.minX=i<o?i:o,this.minY=s<h?s: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,s=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&&s<=a){const o=this.minX,h=this.minY,l=this.maxX,c=this.maxY;this.minX=i<o?i:o,this.minY=s<h?s: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,s,r,a){e-=r,t-=a,i+=r,s+=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>s?this.maxY:s}}class ai extends El{constructor(){super(),this.tempDisplayObjectParent=null,this.transform=new Um,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 gl,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 s=t[i];Object.defineProperty(ai.prototype,s,Object.getOwnPropertyDescriptor(e,s))}}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 vt),t=this._boundsRect),this._bounds.getRectangle(t)}getLocalBounds(e){e||(this._localBoundsRect||(this._localBoundsRect=new vt),e=this._localBoundsRect),this._localBounds||(this._localBounds=new gl);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 s=this._bounds,r=this._boundsID;this._bounds=this._localBounds;const a=this.getBounds(!1,e);return this.parent=i,this.transform=t,this._bounds=s,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,s){return t&&(e=t.toGlobal(e,i,s)),s||(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,s=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=s||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 YE),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*OM}set angle(e){this.transform.rotation=e*BM}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 YE extends ai{constructor(){super(...arguments),this.sortDirty=null}}ai.prototype.displayObjectUpdateTransform=ai.prototype.updateTransform;const VE=new Zt;function $E(n,e){return n.zIndex===e.zIndex?n._lastSortedIndex-e._lastSortedIndex:n.zIndex-e.zIndex}const qx=class Pf extends ai{constructor(){super(),this.children=[],this.sortableChildren=Pf.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),s=this.getChildIndex(t);this.children[i]=t,this.children[s]=e,this.onChildrenChange(i<s?i:s)}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);Ja(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,Ja(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,Ja(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,s=t,r=s-i;let a;if(r>0&&r<=s){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 s=this.children[t];s._lastSortedIndex=t,!e&&s.zIndex!==0&&(e=!0)}e&&this.children.length>1&&this.children.sort($E),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 s=0,r=this.children.length;s<r;++s){const a=this.children[s];a.visible&&a.updateTransform()}return i}_calculateBounds(){}_renderWithCulling(e){const t=e.renderTexture.sourceFrame;if(!(t.width>0&&t.height>0))return;let i,s;this.cullArea?(i=this.cullArea,s=this.worldTransform):this._render!==Pf.prototype._render&&(i=this.getBounds(!0));const r=e.projection.transform;if(r&&(s?(s=VE.copyFrom(s),s.prepend(r)):s=r),i&&t.intersects(i,s))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,s=this.children.length;i<s;++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 s=t&&((r=this._enabledFilters)==null?void 0:r.length)||i&&(!i.isMaskData||i.enabled&&(i.autoDetect||i.type!==xi.NONE));if(s&&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)}s&&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 s=0;s<i.length;++s)i[s].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}};qx.defaultSortableChildren=!1;let Oi=qx;Oi.prototype.containerUpdateTransform=Oi.prototype.updateTransform;Object.defineProperties($e,{SORTABLE_CHILDREN:{get(){return Oi.defaultSortableChildren},set(n){Mt("7.1.0","settings.SORTABLE_CHILDREN is deprecated, use Container.defaultSortableChildren"),Oi.defaultSortableChildren=n}}});const Fo=new kt,GE=new Uint16Array([0,1,2,0,2,3]);class Fr extends Oi{constructor(e){super(),this._anchor=new Yn(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 Lt(16777215),this._tintRGB=null,this.tint=16777215,this.blendMode=st.NORMAL,this._cachedTint=16777215,this.uvs=null,this.texture=e||rt.EMPTY,this.vertexData=new Float32Array(8),this.vertexTrimmedData=null,this._transformID=-1,this._textureID=-1,this._transformTrimmedID=-1,this._textureTrimmedID=-1,this.indices=GE,this.pluginName="batch",this.isSprite=!0,this._roundPixels=$e.ROUND_PIXELS}_onTextureUpdate(){this._textureID=-1,this._textureTrimmedID=-1,this._cachedTint=16777215,this._width&&(this.scale.x=_r(this.scale.x)*this._width/this._texture.orig.width),this._height&&(this.scale.y=_r(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,s=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+s*p+h,l[2]=i*f+r*g+o,l[3]=a*g+s*f+h,l[4]=i*f+r*m+o,l[5]=a*m+s*f+h,l[6]=i*p+r*m+o,l[7]=a*m+s*p+h,this._roundPixels){const y=$e.RESOLUTION;for(let w=0;w<l.length;++w)l[w]=Math.round(l[w]*y)/y}}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,s=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=-s._x*i.width,f=d+i.width,p=-s._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=$e.RESOLUTION;for(let y=0;y<t.length;++y)t[y]=Math.round(t[y]*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 gl),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 vt),e=this._localBoundsRect),this._localBounds.getRectangle(e)):super.getLocalBounds.call(this,e)}containsPoint(e){this.worldTransform.applyInverse(e,Fo);const t=this._texture.orig.width,i=this._texture.orig.height,s=-t*this.anchor.x;let r=0;return Fo.x>=s&&Fo.x<s+t&&(r=-i*this.anchor.y,Fo.y>=r&&Fo.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 rt?e:rt.from(e,t);return new Fr(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=_r(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=_r(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||rt.EMPTY,this._cachedTint=16777215,this._textureID=-1,this._textureTrimmedID=-1,e&&(e.baseTexture.valid?this._onTextureUpdate():e.once("update",this._onTextureUpdate,this)))}}const Kx=new Zt;ai.prototype._cacheAsBitmap=!1;ai.prototype._cacheData=null;ai.prototype._cacheAsBitmapResolution=null;ai.prototype._cacheAsBitmapMultisample=null;class HE{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(ai.prototype,{cacheAsBitmapResolution:{get(){return this._cacheAsBitmapResolution},set(n){n!==this._cacheAsBitmapResolution&&(this._cacheAsBitmapResolution=n,this.cacheAsBitmap&&(this.cacheAsBitmap=!1,this.cacheAsBitmap=!0))}},cacheAsBitmapMultisample:{get(){return this._cacheAsBitmapMultisample},set(n){n!==this._cacheAsBitmapMultisample&&(this._cacheAsBitmapMultisample=n,this.cacheAsBitmap&&(this.cacheAsBitmap=!1,this.cacheAsBitmap=!0))}},cacheAsBitmap:{get(){return this._cacheAsBitmap},set(n){if(this._cacheAsBitmap===n)return;this._cacheAsBitmap=n;let e;n?(this._cacheData||(this._cacheData=new HE),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)}}});ai.prototype._renderCached=function(n){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObject(n),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._render(n))};ai.prototype._initCachedDisplayObject=function(n){var d,f;if((d=this._cacheData)!=null&&d.sprite)return;const e=this.alpha;this.alpha=1,n.batch.flush();const t=this.getLocalBounds(new vt,!0);if((f=this.filters)!=null&&f.length){const p=this.filters[0].padding;t.pad(p)}const i=this.cacheAsBitmapResolution||n.resolution;t.ceil(i),t.width=Math.max(t.width,1/i),t.height=Math.max(t.height,1/i);const s=n.renderTexture.current,r=n.renderTexture.sourceFrame.clone(),a=n.renderTexture.destinationFrame.clone(),o=n.projection.transform,h=ya.create({width:t.width,height:t.height,resolution:i,multisample:this.cacheAsBitmapMultisample??n.multisample}),l=`cacheAsBitmap_${da()}`;this._cacheData.textureCacheId=l,ot.addToCache(h.baseTexture,l),rt.addToCache(h,l);const c=this.transform.localTransform.copyTo(Kx).invert().translate(-t.x,-t.y);this.render=this._cacheData.originalRender,n.render(this,{renderTexture:h,clear:!0,transform:c,skipUpdateTransform:!1}),n.framebuffer.blit(),n.projection.transform=o,n.renderTexture.bind(s,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 Fr(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)};ai.prototype._renderCachedCanvas=function(n){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObjectCanvas(n),this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._renderCanvas(n))};ai.prototype._initCachedDisplayObjectCanvas=function(n){var c;if((c=this._cacheData)!=null&&c.sprite)return;const e=this.getLocalBounds(new vt,!0),t=this.alpha;this.alpha=1;const i=n.canvasContext.activeContext,s=n._projTransform,r=this.cacheAsBitmapResolution||n.resolution;e.ceil(r),e.width=Math.max(e.width,1/r),e.height=Math.max(e.height,1/r);const a=ya.create({width:e.width,height:e.height,resolution:r}),o=`cacheAsBitmap_${da()}`;this._cacheData.textureCacheId=o,ot.addToCache(a.baseTexture,o),rt.addToCache(a,o);const h=Kx;this.transform.localTransform.copyTo(h),h.invert(),h.tx-=e.x,h.ty-=e.y,this.renderCanvas=this._cacheData.originalRenderCanvas,n.render(this,{renderTexture:a,clear:!0,transform:h,skipUpdateTransform:!1}),n.canvasContext.activeContext=i,n._projTransform=s,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 Fr(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=n._tempDisplayObjectParent,this.updateTransform(),this.parent=null),this.containsPoint=l.containsPoint.bind(l)};ai.prototype._calculateCachedBounds=function(){this._bounds.clear(),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite._calculateBounds(),this._bounds.updateID=this._boundsID};ai.prototype._getCachedLocalBounds=function(){return this._cacheData.sprite.getLocalBounds(null)};ai.prototype._destroyCachedDisplayObject=function(){this._cacheData.sprite._texture.destroy(!0),this._cacheData.sprite=null,ot.removeFromCache(this._cacheData.textureCacheId),rt.removeFromCache(this._cacheData.textureCacheId),this._cacheData.textureCacheId=null};ai.prototype._cacheAsBitmapDestroy=function(n){this.cacheAsBitmap=!1,this.destroy(n)};ai.prototype.name=null;Oi.prototype.getChildByName=function(n,e){for(let t=0,i=this.children.length;t<i;t++)if(this.children[t].name===n)return this.children[t];if(e)for(let t=0,i=this.children.length;t<i;t++){const s=this.children[t];if(!s.getChildByName)continue;const r=s.getChildByName(n,!0);if(r)return r}return null};ai.prototype.getGlobalPosition=function(n=new kt,e=!1){return this.parent?this.parent.toGlobal(this.position,n,e):(n.x=this.position.x,n.y=this.position.y),n};var jE=`varying vec2 vTextureCoord;
|
||
|
||
uniform sampler2D uSampler;
|
||
uniform float uAlpha;
|
||
|
||
void main(void)
|
||
{
|
||
gl_FragColor = texture2D(uSampler, vTextureCoord) * uAlpha;
|
||
}
|
||
`;class WE extends qi{constructor(e=1){super(BE,jE,{uAlpha:1}),this.alpha=e}get alpha(){return this.uniforms.uAlpha}set alpha(e){this.uniforms.uAlpha=e}}const zE={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]},qE=["varying vec2 vBlurTexCoords[%size%];","uniform sampler2D uSampler;","void main(void)","{"," gl_FragColor = vec4(0.0);"," %blur%","}"].join(`
|
||
`);function KE(n){const e=zE[n],t=e.length;let i=qE,s="";const r="gl_FragColor += texture2D(uSampler, vBlurTexCoords[%index%]) * %value%;";let a;for(let o=0;o<n;o++){let h=r.replace("%index%",o.toString());a=o,o>=t&&(a=n-o-1),h=h.replace("%value%",e[a].toString()),s+=h,s+=`
|
||
`}return i=i.replace("%blur%",s),i=i.replace("%size%",n.toString()),i}const ZE=`
|
||
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 JE(n,e){const t=Math.ceil(n/2);let i=ZE,s="",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<n;a++){let o=r.replace("%index%",a.toString());o=o.replace("%sampleIndex%",`${a-(t-1)}.0`),s+=o,s+=`
|
||
`}return i=i.replace("%blur%",s),i=i.replace("%size%",n.toString()),i}class kf extends qi{constructor(e,t=8,i=4,s=qi.defaultResolution,r=5){const a=JE(r,e),o=KE(r);super(a,o),this.horizontal=e,this.resolution=s,this._quality=0,this.quality=i,this.blur=t}apply(e,t,i,s){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,s);else{const r=e.getFilterTexture(),a=e.renderer;let o=t,h=r;this.state.blend=!1,e.applyFilter(this,o,h,cn.CLEAR);for(let l=1;l<this.passes-1;l++){e.bindAndClear(o,cn.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,s),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 QE extends qi{constructor(e=8,t=4,i=qi.defaultResolution,s=5){super(),this._repeatEdgePixels=!1,this.blurXFilter=new kf(!0,e,t,i,s),this.blurYFilter=new kf(!1,e,t,i,s),this.resolution=i,this.quality=t,this.blur=e,this.repeatEdgePixels=!1}apply(e,t,i,s){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,cn.CLEAR),this.blurYFilter.apply(e,o,i,s),e.returnFilterTexture(o)}else a?this.blurYFilter.apply(e,t,i,s):this.blurXFilter.apply(e,t,i,s)}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 eA=`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 Ff extends qi{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(Vx,eA,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,s,r]=Lt.shared.setValue(e).toArray(),a=[i,0,0,0,0,0,s,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),s=Math.sin(e),r=Math.sqrt,a=1/3,o=r(a),h=i+(1-i)*a,l=a*(1-i)-o*s,c=a*(1-i)+o*s,u=a*(1-i)+o*s,d=i+a*(1-i),f=a*(1-i)-o*s,p=a*(1-i)-o*s,m=a*(1-i)+o*s,g=i+a*(1-i),y=[h,l,c,0,0,u,d,f,0,0,p,m,g,0,0,0,0,0,1,0];this._loadMatrix(y,t)}contrast(e,t){const i=(e||0)+1,s=-.5*(i-1),r=[i,0,0,0,s,0,i,0,0,s,0,0,i,0,s,0,0,0,1,0];this._loadMatrix(r,t)}saturate(e=0,t){const i=e*2/3+1,s=(i-1)*-.5,r=[i,s,s,0,0,s,i,s,0,0,s,s,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,s,r){e=e||.2,t=t||.15,i=i||16770432,s=s||3375104;const a=Lt.shared,[o,h,l]=a.setValue(i).toArray(),[c,u,d]=a.setValue(s).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}}Ff.prototype.grayscale=Ff.prototype.greyscale;var tA=`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));
|
||
}
|
||
`,iA=`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 sA extends qi{constructor(e,t){const i=new Zt;e.renderable=!1,super(iA,tA,{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 kt(t,t)}apply(e,t,i,s){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,s)}get map(){return this.uniforms.mapSampler}set map(e){this.uniforms.mapSampler=e}}var nA=`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;
|
||
}
|
||
`,rA=`
|
||
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 aA extends qi{constructor(){super(rA,nA)}}var oA=`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 lA extends qi{constructor(e=.5,t=Math.random()){super(Vx,oA,{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 A0={AlphaFilter:WE,BlurFilter:QE,BlurFilterPass:kf,ColorMatrixFilter:Ff,DisplacementFilter:sA,FXAAFilter:aA,NoiseFilter:lA};Object.entries(A0).forEach(([n,e])=>{Object.defineProperty(A0,n,{get(){return Mt("7.1.0",`filters.${n} has moved to ${n}`),e}})});class cA{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||(Ki.system.add(this.tickerUpdate,this,fa.INTERACTION),this.tickerAdded=!0)}removeTickerListener(){this.tickerAdded&&(Ki.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 xr=new cA;class Al{constructor(e){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=Al.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new kt,this.page=new kt,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,s,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 Jc extends Al{constructor(){super(...arguments),this.client=new kt,this.movement=new kt,this.offset=new kt,this.global=new kt,this.screen=new kt}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,s,r,a,o,h,l,c,u,d,f,p,m){throw new Error("Method not implemented.")}}class Rs extends Jc{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 eo extends Jc{constructor(){super(...arguments),this.DOM_DELTA_PIXEL=0,this.DOM_DELTA_LINE=1,this.DOM_DELTA_PAGE=2}}eo.DOM_DELTA_PIXEL=0,eo.DOM_DELTA_LINE=1,eo.DOM_DELTA_PAGE=2;const hA=2048,uA=new kt,Id=new kt;class dA{constructor(e){this.dispatch=new El,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,s)=>i.priority-s.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,s=t.length;i<s;i++)t[i].fn(e);else console.warn(`[EventBoundary]: Event mapping not defined for ${e.type}`)}hitTest(e,t){xr.pauseUpdate=!0;const i=this._isPointerMoveEvent&&this.enableGlobalMoveEvents?"hitTestMoveRecursive":"hitTestRecursive",s=this[i](this.rootTarget,this.rootTarget.eventMode,uA.set(e,t),this.hitTestFn,this.hitPruneFn);return s&&s[0]}propagate(e,t){if(!e.target)return;const i=e.composedPath();e.eventPhase=e.CAPTURING_PHASE;for(let s=0,r=i.length-1;s<r;s++)if(e.currentTarget=i[s],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 s=i.length-2;s>=0;s--)if(e.currentTarget=i[s],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 s=Array.isArray(t)?t:[t];for(let r=i.length-1;r>=0;r--)s.forEach(a=>{e.currentTarget=i[r],this.notifyTarget(e,a)})}propagationPath(e){const t=[e];for(let i=0;i<hA&&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,s,r,a=!1){let o=!1;if(this._interactivePrune(e))return null;if((e.eventMode==="dynamic"||t==="dynamic")&&(xr.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,s,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)&&s(e,i)?l?[e]:[]:null}hitTestRecursive(e,t,i,s,r){if(this._interactivePrune(e)||r(e,i))return null;if((e.eventMode==="dynamic"||t==="dynamic")&&(xr.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,s,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&&s(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,Id),!e.hitArea.contains(Id.x,Id.y)))return!0;if(e._mask){const s=e._mask.isMaskData?e._mask.maskObject:e._mask;if(s&&!((i=s.containsPoint)!=null&&i.call(s,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 s=e.eventPhase===e.CAPTURING_PHASE||e.eventPhase===e.AT_TARGET?`${t}capture`:t;this.notifyListeners(e,s),e.eventPhase===e.AT_TARGET&&this.notifyListeners(e,t)}mapPointerDown(e){if(!(e instanceof Rs)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const t=this.createPointerEvent(e);if(this.dispatchEvent(t,"pointerdown"),t.pointerType==="touch")this.dispatchEvent(t,"touchstart");else if(t.pointerType==="mouse"||t.pointerType==="pen"){const s=t.button===2;this.dispatchEvent(t,s?"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 Rs)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}this._allInteractiveElements.length=0,this._hitElements.length=0,this._isPointerMoveEvent=!0;const t=this.createPointerEvent(e);this._isPointerMoveEvent=!1;const i=t.pointerType==="mouse"||t.pointerType==="pen",s=this.trackingData(e.pointerId),r=this.findMountedTarget(s.overTargets);if(((h=s.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,s.overTargets=t.composedPath(),this.freeEvent(t)}mapPointerOver(e){var a;if(!(e instanceof Rs)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const t=this.trackingData(e.pointerId),i=this.createPointerEvent(e),s=i.pointerType==="mouse"||i.pointerType==="pen";this.dispatchEvent(i,"pointerover"),s&&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),s&&this.notifyTarget(r,"mouseenter"),r.target=r.target.parent;t.overTargets=i.composedPath(),this.freeEvent(i),this.freeEvent(r)}mapPointerOut(e){if(!(e instanceof Rs)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const t=this.trackingData(e.pointerId);if(t.overTargets){const i=e.pointerType==="mouse"||e.pointerType==="pen",s=this.findMountedTarget(t.overTargets),r=this.createPointerEvent(e,"pointerout",s);this.dispatchEvent(r),i&&this.dispatchEvent(r,"mouseout");const a=this.createPointerEvent(e,"pointerleave",s);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 Rs)){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 s=this.trackingData(e.pointerId),r=this.findMountedTarget(s.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 s.pressTargetsByButton[e.button],a=o}if(a){const o=this.clonePointerEvent(i,"click");o.target=a,o.path=null,s.clicksByButton[e.button]||(s.clicksByButton[e.button]={clickCount:0,target:o.target,timeStamp:t});const h=s.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 Rs)){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]),s=this.createPointerEvent(e);if(i){let r=i;for(;r;)s.currentTarget=r,this.notifyTarget(s,"pointerupoutside"),s.pointerType==="touch"?this.notifyTarget(s,"touchendoutside"):(s.pointerType==="mouse"||s.pointerType==="pen")&&this.notifyTarget(s,s.button===2?"rightupoutside":"mouseupoutside"),r=r.parent;delete t.pressTargetsByButton[e.button]}this.freeEvent(s)}mapWheel(e){if(!(e instanceof eo)){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 s=this.allocateEvent(Rs);return this.copyPointerData(e,s),this.copyMouseData(e,s),this.copyData(e,s),s.nativeEvent=e.nativeEvent,s.originalEvent=e,s.target=i??this.hitTest(s.global.x,s.global.y)??this._hitElements[0],typeof t=="string"&&(s.type=t),s}createWheelEvent(e){const t=this.allocateEvent(eo);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(Rs);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 Rs&&t instanceof Rs&&(t.pointerId=e.pointerId,t.width=e.width,t.height=e.height,t.isPrimary=e.isPrimary,t.pointerType=e.pointerType,t.pressure=e.pressure,t.tangentialPressure=e.tangentialPressure,t.tiltX=e.tiltX,t.tiltY=e.tiltY,t.twist=e.twist)}copyMouseData(e,t){e instanceof Jc&&t instanceof Jc&&(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 s=0,r=i.length;s<r&&!e.propagationImmediatelyStopped;s++)i[s].once&&e.currentTarget.removeListener(t,i[s].fn,void 0,!0),i[s].fn.call(i[s].context,e)}}const fA=1,mA={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},Of=class Bf{constructor(e){this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.domElement=null,this.resolution=1,this.renderer=e,this.rootBoundary=new dA(null),xr.init(this),this.autoPreventDefault=!0,this.eventsAdded=!1,this.rootPointerEvent=new Rs(null),this.rootWheelEvent=new eo(null),this.cursorStyles={default:"inherit",pointer:"pointer"},this.features=new Proxy({...Bf.defaultEventFeatures},{set:(t,i,s)=>(i==="globalMove"&&(this.rootBoundary.enableGlobalMoveEvents=s),t[i]=s,!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,Bf._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,s=t.length;i<s;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,xr.pointerMoved();const t=this.normalizeToPointerData(e);for(let i=0,s=t.length;i<s;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":"",s=this.normalizeToPointerData(e);for(let r=0,a=s.length;r<a;r++){const o=this.bootstrapEvent(this.rootPointerEvent,s[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,s=t.length;i<s;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,xr.domElement=e,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;xr.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;xr.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 s=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-s.left)*(this.domElement.width/s.width)*r,e.y=(i-s.top)*(this.domElement.height/s.height)*r}normalizeToPointerData(e){const t=[];if(this.supportsTouchEvents&&e instanceof TouchEvent)for(let i=0,s=e.changedTouches.length;i<s;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=fA),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=mA[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}};Of.extension={name:"events",type:[Xe.RendererSystem,Xe.CanvasRendererSystem]},Of.defaultEventFeatures={move:!0,globalMove:!0,click:!0,wheel:!0};let Lf=Of;ze.add(Lf);function C0(n){return n==="dynamic"||n==="static"}const pA={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??C0(Lf.defaultEventMode)},set interactive(n){Mt("7.2.0","Setting interactive is deprecated, use eventMode = 'none'/'passive'/'auto'/'static'/'dynamic' instead."),this._internalInteractive=n,this.eventMode=n?"static":"auto"},_internalEventMode:void 0,get eventMode(){return this._internalEventMode??Lf.defaultEventMode},set eventMode(n){this._internalInteractive=C0(n),this._internalEventMode=n},isInteractive(){return this.eventMode==="static"||this.eventMode==="dynamic"},interactiveChildren:!0,hitArea:null,addEventListener(n,e,t){const i=typeof t=="boolean"&&t||typeof t=="object"&&t.capture,s=typeof t=="object"?t.signal:void 0,r=typeof t=="object"?t.once===!0:!1,a=typeof e=="function"?void 0:e;n=i?`${n}capture`:n;const o=typeof e=="function"?e:e.handleEvent,h=this;s&&s.addEventListener("abort",()=>{h.off(n,o,a)}),r?h.once(n,o,a):h.on(n,o,a)},removeEventListener(n,e,t){const i=typeof t=="boolean"&&t||typeof t=="object"&&t.capture,s=typeof e=="function"?void 0:e;n=i?`${n}capture`:n,e=typeof e=="function"?e:e.handleEvent,this.off(n,e,s)},dispatchEvent(n){if(!(n instanceof Al))throw new Error("DisplayObject cannot propagate events outside of the Federated Events API");return n.defaultPrevented=!1,n.path=null,n.target=this,n.manager.dispatchEvent(n),!n.defaultPrevented}};ai.mixin(pA);const gA={accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:!1,_accessibleDiv:null,accessibleType:"button",accessiblePointerEvents:"auto",accessibleChildren:!0,renderId:-1};ai.mixin(gA);const vA=9,Zl=100,yA=0,xA=0,I0=2,R0=1,bA=-1e3,wA=-1e3,SA=2;class Zx{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,(Xn.tablet||Xn.phone)&&this.createTouchHook();const t=document.createElement("div");t.style.width=`${Zl}px`,t.style.height=`${Zl}px`,t.style.position="absolute",t.style.top=`${yA}px`,t.style.left=`${xA}px`,t.style.zIndex=I0.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=`${R0}px`,e.style.height=`${R0}px`,e.style.position="absolute",e.style.top=`${bA}px`,e.style.left=`${wA}px`,e.style.zIndex=SA.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(Xn.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:s,height:r}=this.renderer.view.getBoundingClientRect(),{width:a,height:o,resolution:h}=this.renderer,l=s/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,Ja(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=`${Zl}px`,t.style.height=`${Zl}px`,t.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",t.style.position="absolute",t.style.zIndex=I0.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,s=this.renderer.events.rootBoundary,r=Object.assign(new Al(s),{target:i});s.rootTarget=this.renderer.lastObjectRendered,t.forEach(a=>s.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===vA&&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}}Zx.extension={name:"accessibility",type:[Xe.RendererPlugin,Xe.CanvasRendererPlugin]};ze.add(Zx);const Jx=class Df{constructor(e){this.stage=new Oi,e=Object.assign({forceCanvas:!1},e),this.renderer=kE(e),Df._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=Df._plugins.slice(0);i.reverse(),i.forEach(s=>{s.destroy.call(this)}),this.stage.destroy(t),this.stage=null,this.renderer.destroy(e),this.renderer=null}};Jx._plugins=[];let Qx=Jx;ze.handleByList(Xe.Application,Qx._plugins);class e1{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:s,clientHeight:r}=this._resizeTo;t=s,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}}e1.extension=Xe.Application;ze.add(e1);const P0={loader:Xe.LoadParser,resolver:Xe.ResolveParser,cache:Xe.CacheParser,detection:Xe.DetectionParser};ze.handle(Xe.Asset,n=>{const e=n.ref;Object.entries(P0).filter(([t])=>!!e[t]).forEach(([t,i])=>ze.add(Object.assign(e[t],{extension:e[t].extension??i})))},n=>{const e=n.ref;Object.keys(P0).filter(t=>!!e[t]).forEach(t=>ze.remove(e[t]))});class _A{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 wo(n,e){if(Array.isArray(e)){for(const t of e)if(n.startsWith(`data:${t}`))return!0;return!1}return n.startsWith(`data:${e}`)}function ns(n,e){const t=n.split("?")[0],i=li.extname(t).toLowerCase();return Array.isArray(e)?e.includes(i):i===e}const ks=(n,e,t=!1)=>(Array.isArray(n)||(n=[n]),e?n.map(i=>typeof i=="string"||t?e(i):i):n),Qc=(n,e)=>{const t=e.split("?")[1];return t&&(n+=`?${t}`),n};function t1(n,e,t,i,s){const r=e[t];for(let a=0;a<r.length;a++){const o=r[a];t<e.length-1?t1(n.replace(i[t],o),e,t+1,i,s):s.push(n.replace(i[t],o))}}function TA(n){const e=/\{(.*?)\}/g,t=n.match(e),i=[];if(t){const s=[];t.forEach(r=>{const a=r.substring(1,r.length-1).split(",");s.push(a)}),t1(n,s,0,t,i)}else i.push(n);return i}const eh=n=>!Array.isArray(n);class MA{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=ks(e);let s;for(let o=0;o<this.parsers.length;o++){const h=this.parsers[o];if(h.test(t)){s=h.getCacheableAssets(i,t);break}}s||(s={},i.forEach(o=>{s[o]=t}));const r=Object.keys(s),a={cacheKeys:r,keys:i};if(i.forEach(o=>{this._cacheMap.set(o,a)}),r.forEach(o=>{const h=s?s[o]:t;this._cache.has(o)&&this._cache.get(o)!==h&&console.warn("[Cache] already has key:",o),this._cache.set(o,s[o])}),t instanceof rt){const o=t;i.forEach(h=>{o.baseTexture!==rt.EMPTY.baseTexture&&ot.addToCache(o.baseTexture,h),rt.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 Kr=new MA;class EA{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 s=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}s=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,s,t,this))&&(s=await l.parse(s,t,this)||s,i.parser=l)}return s})(),i}async load(e,t){this._parsersValidated||this._validateParsers();let i=0;const s={},r=eh(e),a=ks(e,l=>({alias:[l],src:l})),o=a.length,h=a.map(async l=>{const c=li.toAbsolute(l.src);if(!s[l.src])try{this.promiseCache[c]||(this.promiseCache[c]=this._getLoadPromiseAndParser(c,l)),s[l.src]=await this.promiseCache[c].promise,t&&t(++i/o)}catch(u){throw delete this.promiseCache[c],delete s[l.src],new Error(`[Loader.load] Failed to load ${c}.
|
||
${u}`)}});return await Promise.all(h),r?s[a[0].src]:s}async unload(e){const t=ks(e,i=>({alias:[i],src:i})).map(async i=>{var a,o;const s=li.toAbsolute(i.src),r=this.promiseCache[s];if(r){const h=await r.promise;delete this.promiseCache[s],(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 ds=(n=>(n[n.Low=0]="Low",n[n.Normal=1]="Normal",n[n.High=2]="High",n))(ds||{});const AA=".json",CA="application/json",IA={extension:{type:Xe.LoadParser,priority:ds.Low},name:"loadJson",test(n){return wo(n,CA)||ns(n,AA)},async load(n){return await(await $e.ADAPTER.fetch(n)).json()}};ze.add(IA);const RA=".txt",PA="text/plain",kA={name:"loadTxt",extension:{type:Xe.LoadParser,priority:ds.Low},test(n){return wo(n,PA)||ns(n,RA)},async load(n){return await(await $e.ADAPTER.fetch(n)).text()}};ze.add(kA);const FA=["normal","bold","100","200","300","400","500","600","700","800","900"],OA=[".ttf",".otf",".woff",".woff2"],BA=["font/ttf","font/otf","font/woff","font/woff2"],LA=/^(--|-?[A-Z_])[0-9A-Z_-]*$/i;function DA(n){const e=li.extname(n),t=li.basename(n,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(LA)){i=!1;break}let s=t.join(" ");return i||(s=`"${s.replace(/[\\"]/g,"\\$&")}"`),s}const NA=/^[0-9A-Za-z%:/?#\[\]@!\$&'()\*\+,;=\-._~]*$/;function UA(n){return NA.test(n)?n:encodeURI(n)}const XA={extension:{type:Xe.LoadParser,priority:ds.Low},name:"loadWebFont",test(n){return wo(n,BA)||ns(n,OA)},async load(n,e){var i,s,r;const t=$e.ADAPTER.getFontFaceSet();if(t){const a=[],o=((i=e.data)==null?void 0:i.family)??DA(n),h=((r=(s=e.data)==null?void 0:s.weights)==null?void 0:r.filter(c=>FA.includes(c)))??["normal"],l=e.data??{};for(let c=0;c<h.length;c++){const u=h[c],d=new FontFace(o,`url(${UA(n)})`,{...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(n){(Array.isArray(n)?n:[n]).forEach(e=>$e.ADAPTER.getFontFaceSet().delete(e))}};ze.add(XA);const YA=`(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 to=null,Nf=class{constructor(){to||(to=URL.createObjectURL(new Blob([YA],{type:"application/javascript"}))),this.worker=new Worker(to)}};Nf.revokeObjectURL=function(){to&&(URL.revokeObjectURL(to),to=null)};const VA=`(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 io=null;class i1{constructor(){io||(io=URL.createObjectURL(new Blob([VA],{type:"application/javascript"}))),this.worker=new Worker(io)}}i1.revokeObjectURL=function(){io&&(URL.revokeObjectURL(io),io=null)};let k0=0,Rd;class $A{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 Nf;t.addEventListener("message",i=>{t.terminate(),Nf.revokeObjectURL(),e(i.data)})}),this._isImageBitmapSupported)}loadImageBitmap(e){return this._run("loadImageBitmap",[e])}async _initWorkers(){this._initialized||(this._initialized=!0)}getWorker(){Rd===void 0&&(Rd=navigator.hardwareConcurrency||4);let e=this.workerPool.pop();return!e&&this._createdWorkers<Rd&&(this._createdWorkers++,e=new i1().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((s,r)=>{this.queue.push({id:e,arguments:t,resolve:s,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[k0]={resolve:t.resolve,reject:t.reject},e.postMessage({data:t.arguments,uuid:k0++,id:i})}}const F0=new $A;function Cl(n,e,t){n.resource.internal=!0;const i=new rt(n),s=()=>{delete e.promiseCache[t],Kr.has(t)&&Kr.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."),s())}),i.once("destroyed",()=>{n.destroyed||(console.warn("[Assets] A Texture managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the Texture."),s())}),i}const GA=[".jpeg",".jpg",".png",".webp",".avif"],HA=["image/jpeg","image/png","image/webp","image/avif"];async function jA(n){const e=await $e.ADAPTER.fetch(n);if(!e.ok)throw new Error(`[loadImageBitmap] Failed to fetch ${n}: ${e.status} ${e.statusText}`);const t=await e.blob();return await createImageBitmap(t)}const qh={name:"loadTextures",extension:{type:Xe.LoadParser,priority:ds.High},config:{preferWorkers:!0,preferCreateImageBitmap:!0,crossOrigin:"anonymous"},test(n){return wo(n,HA)||ns(n,GA)},async load(n,e,t){var o;const i=globalThis.createImageBitmap&&this.config.preferCreateImageBitmap;let s;i?this.config.preferWorkers&&await F0.isImageBitmapSupported()?s=await F0.loadImageBitmap(n):s=await jA(n):s=await new Promise((h,l)=>{const c=new Image;c.crossOrigin=this.config.crossOrigin,c.src=n,c.complete?h(c):(c.onload=()=>h(c),c.onerror=u=>l(u))});const r={...e.data};r.resolution??(r.resolution=Qn(n)),i&&((o=r.resourceOptions)==null?void 0:o.ownsImageBitmap)===void 0&&(r.resourceOptions={...r.resourceOptions},r.resourceOptions.ownsImageBitmap=!0);const a=new ot(s,r);return a.resource.src=n,Cl(a,t,n)},unload(n){n.destroy(!0)}};ze.add(qh);const WA=".svg",zA="image/svg+xml",qA={extension:{type:Xe.LoadParser,priority:ds.High},name:"loadSVG",test(n){return wo(n,zA)||ns(n,WA)},async testParse(n){return Cf.test(n)},async parse(n,e,t){var r;const i=new Cf(n,(r=e==null?void 0:e.data)==null?void 0:r.resourceOptions);await i.load();const s=new ot(i,{resolution:Qn(n),...e==null?void 0:e.data});return s.resource.src=e.src,Cl(s,t,e.src)},async load(n,e){return(await $e.ADAPTER.fetch(n)).text()},unload:qh.unload};ze.add(qA);const KA=[".mp4",".m4v",".webm",".ogv"],ZA=["video/mp4","video/webm","video/ogg"],JA={name:"loadVideo",extension:{type:Xe.LoadParser,priority:ds.High},config:{defaultAutoPlay:!0,defaultUpdateFPS:0,defaultLoop:!1,defaultMuted:!1,defaultPlaysinline:!0},test(n){return wo(n,ZA)||ns(n,KA)},async load(n,e,t){var a;let i;const s=await(await $e.ADAPTER.fetch(n)).blob(),r=URL.createObjectURL(s);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 zx(r,o);await h.load();const l=new ot(h,{alphaMode:await rM(),resolution:Qn(n),...e==null?void 0:e.data});l.resource.src=n,i=Cl(l,t,n),i.baseTexture.once("destroyed",()=>{URL.revokeObjectURL(r)})}catch(o){throw URL.revokeObjectURL(r),o}return i},unload(n){n.destroy(!0)}};ze.add(JA);class QA{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:s,srcs:r}=e;return ks(t||i||s||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(s=>{const r=s.src??s.srcs,a=s.alias??s.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({...s,alias:o,src:r})}):Object.keys(t).forEach(s=>{const r=[s,this._createBundleAssetId(e,s)];if(typeof t[s]=="string")this.add({alias:r,src:t[s]});else if(Array.isArray(t[s]))this.add({alias:r,src:t[s]});else{const a=t[s],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,s,r){const a=[];typeof e=="string"||Array.isArray(e)&&typeof e[0]=="string"?(Mt("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:s,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`)},ks(a).forEach(h=>{const{src:l,srcs:c}=h;let{data:u,format:d,loadParser:f}=h;const p=ks(l||c).map(y=>typeof y=="string"?TA(y):Array.isArray(y)?y:[y]),m=this.getAlias(h);Array.isArray(m)?m.forEach(o):o(m);const g=[];p.forEach(y=>{y.forEach(w=>{let v={};if(typeof w!="object"){v.src=w;for(let _=0;_<this._parsers.length;_++){const x=this._parsers[_];if(x.test(w)){v=x.parse(w);break}}}else u=w.data??u,d=w.format??d,f=w.loadParser??f,v={...v,...w};if(!m)throw new Error(`[Resolver] alias is undefined for this asset: ${v.src}`);v=this.buildResolvedAsset(v,{aliases:m,data:u,format:d,loadParser:f}),g.push(v)})}),m.forEach(y=>{this._assetMap[y]=g})})}resolveBundle(e){const t=eh(e);e=ks(e);const i={};return e.forEach(s=>{const r=this._bundles[s];if(r){const a=this.resolve(r),o={};for(const h in a){const l=a[h];o[this._extractAssetIdFromBundle(s,h)]=l}i[s]=o}}),t?i[e[0]]:i}resolveUrl(e){const t=this.resolve(e);if(typeof e!="string"){const i={};for(const s in t)i[s]=t[s].src;return i}return t.src}resolve(e){const t=eh(e);e=ks(e);const i={};return e.forEach(s=>{if(!this._resolverHash[s])if(this._assetMap[s]){let r=this._assetMap[s];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[s]=r[0]??a}else this._resolverHash[s]=this.buildResolvedAsset({alias:[s],src:s},{});i[s]=this._resolverHash[s]}),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],s=this._preferredOrder.find(r=>r.params.format.includes(i.format));if(s)return s}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:s,loadParser:r,format:a}=t;return(this._basePath||this._rootPath)&&(e.src=li.toAbsolute(e.src,this._basePath,this._rootPath)),e.alias=i??e.alias??[e.src],e.src=this._appendDefaultSearchParams(e.src),e.data={...s||{},...e.data},e.loadParser=r??e.loadParser,e.format=a??e.format??li.extname(e.src).slice(1),e.srcs=e.src,e.name=e.alias,e}}class eC{constructor(){this._detections=[],this._initialized=!1,this.resolver=new QA,this.loader=new EA,this.cache=Kr,this._backgroundLoader=new _A(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,s=await this._detectFormats({preferredFormats:(a=e.texturePreference)==null?void 0:a.format,skipDetections:e.skipDetections,detections:this._detections});this.resolver.prefer({params:{format:s,resolution:i}}),e.preferences&&this.setPreferences(e.preferences)}add(e,t,i,s,r){this.resolver.add(e,t,i,s,r)}async load(e,t){this._initialized||await this.init();const i=eh(e),s=ks(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(s),a=await this._mapLoadToResolve(r,t);return i?a[s[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 s=this.resolver.resolveBundle(e),r={},a=Object.keys(s);let o=0,h=0;const l=()=>{t==null||t(++o/h)},c=a.map(u=>{const d=s[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 Kr.get(e);const t={};for(let i=0;i<e.length;i++)t[i]=Kr.get(e[i]);return t}async _mapLoadToResolve(e,t){const i=Object.values(e),s=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[s[h]]=l,Kr.set(c,l)}),a}async unload(e){this._initialized||await this.init();const t=ks(e).map(s=>typeof s!="string"?s.src:s),i=this.resolver.resolve(t);await this._unloadFromResolved(i)}async unloadBundle(e){this._initialized||await this.init(),e=ks(e);const t=this.resolver.resolveBundle(e),i=Object.keys(t).map(s=>this._unloadFromResolved(t[s]));await Promise.all(i)}async _unloadFromResolved(e){const t=Object.values(e);t.forEach(i=>{Kr.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,s)=>t.indexOf(i)===s),t}get detections(){return this._detections}get preferWorkers(){return qh.config.preferWorkers}set preferWorkers(e){Mt("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 mn=new eC;ze.handleByList(Xe.LoadParser,mn.loader.parsers).handleByList(Xe.ResolveParser,mn.resolver.parsers).handleByList(Xe.CacheParser,mn.cache.parsers).handleByList(Xe.DetectionParser,mn.detections);const tC={extension:Xe.CacheParser,test:n=>Array.isArray(n)&&n.every(e=>e instanceof rt),getCacheableAssets:(n,e)=>{const t={};return n.forEach(i=>{e.forEach((s,r)=>{t[i+(r===0?"":r+1)]=s})}),t}};ze.add(tC);async function s1(n){if("Image"in globalThis)return new Promise(e=>{const t=new Image;t.onload=()=>{e(!0)},t.onerror=()=>{e(!1)},t.src=n});if("createImageBitmap"in globalThis&&"fetch"in globalThis){try{const e=await(await fetch(n)).blob();await createImageBitmap(e)}catch{return!1}return!0}return!1}const iC={extension:{type:Xe.DetectionParser,priority:1},test:async()=>s1("data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A="),add:async n=>[...n,"avif"],remove:async n=>n.filter(e=>e!=="avif")};ze.add(iC);const sC={extension:{type:Xe.DetectionParser,priority:0},test:async()=>s1("data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA="),add:async n=>[...n,"webp"],remove:async n=>n.filter(e=>e!=="webp")};ze.add(sC);const O0=["png","jpg","jpeg"],nC={extension:{type:Xe.DetectionParser,priority:-1},test:()=>Promise.resolve(!0),add:async n=>[...n,...O0],remove:async n=>n.filter(e=>!O0.includes(e))};ze.add(nC);const rC="WorkerGlobalScope"in globalThis&&globalThis instanceof globalThis.WorkerGlobalScope;function $m(n){return rC?!1:document.createElement("video").canPlayType(n)!==""}const aC={extension:{type:Xe.DetectionParser,priority:0},test:async()=>$m("video/webm"),add:async n=>[...n,"webm"],remove:async n=>n.filter(e=>e!=="webm")};ze.add(aC);const oC={extension:{type:Xe.DetectionParser,priority:0},test:async()=>$m("video/mp4"),add:async n=>[...n,"mp4","m4v"],remove:async n=>n.filter(e=>e!=="mp4"&&e!=="m4v")};ze.add(oC);const lC={extension:{type:Xe.DetectionParser,priority:0},test:async()=>$m("video/ogg"),add:async n=>[...n,"ogv"],remove:async n=>n.filter(e=>e!=="ogv")};ze.add(lC);const cC={extension:Xe.ResolveParser,test:qh.test,parse:n=>{var e;return{resolution:parseFloat(((e=$e.RETINA_PREFIX.exec(n))==null?void 0:e[1])??"1"),format:li.extname(n).slice(1),src:n}}};ze.add(cC);var Ci=(n=>(n[n.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",n[n.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",n[n.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",n[n.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",n[n.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT=35917]="COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT",n[n.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT=35918]="COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT",n[n.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT=35919]="COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT",n[n.COMPRESSED_SRGB_S3TC_DXT1_EXT=35916]="COMPRESSED_SRGB_S3TC_DXT1_EXT",n[n.COMPRESSED_R11_EAC=37488]="COMPRESSED_R11_EAC",n[n.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",n[n.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",n[n.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",n[n.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",n[n.COMPRESSED_RGBA8_ETC2_EAC=37496]="COMPRESSED_RGBA8_ETC2_EAC",n[n.COMPRESSED_SRGB8_ETC2=37493]="COMPRESSED_SRGB8_ETC2",n[n.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37497]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC",n[n.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37494]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",n[n.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37495]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",n[n.COMPRESSED_RGB_PVRTC_4BPPV1_IMG=35840]="COMPRESSED_RGB_PVRTC_4BPPV1_IMG",n[n.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG=35842]="COMPRESSED_RGBA_PVRTC_4BPPV1_IMG",n[n.COMPRESSED_RGB_PVRTC_2BPPV1_IMG=35841]="COMPRESSED_RGB_PVRTC_2BPPV1_IMG",n[n.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG=35843]="COMPRESSED_RGBA_PVRTC_2BPPV1_IMG",n[n.COMPRESSED_RGB_ETC1_WEBGL=36196]="COMPRESSED_RGB_ETC1_WEBGL",n[n.COMPRESSED_RGB_ATC_WEBGL=35986]="COMPRESSED_RGB_ATC_WEBGL",n[n.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL=35987]="COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL",n[n.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL=34798]="COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL",n[n.COMPRESSED_RGBA_ASTC_4x4_KHR=37808]="COMPRESSED_RGBA_ASTC_4x4_KHR",n[n.COMPRESSED_RGBA_BPTC_UNORM_EXT=36492]="COMPRESSED_RGBA_BPTC_UNORM_EXT",n[n.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT=36493]="COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT",n[n.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT=36494]="COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT",n[n.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT=36495]="COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT",n))(Ci||{});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 Ks,Xa;function B0(){Xa={bptc:Ks.getExtension("EXT_texture_compression_bptc"),astc:Ks.getExtension("WEBGL_compressed_texture_astc"),etc:Ks.getExtension("WEBGL_compressed_texture_etc"),s3tc:Ks.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:Ks.getExtension("WEBGL_compressed_texture_s3tc_srgb"),pvrtc:Ks.getExtension("WEBGL_compressed_texture_pvrtc")||Ks.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),etc1:Ks.getExtension("WEBGL_compressed_texture_etc1"),atc:Ks.getExtension("WEBGL_compressed_texture_atc")}}const hC={extension:{type:Xe.DetectionParser,priority:2},test:async()=>{const n=$e.ADAPTER.createCanvas().getContext("webgl");return n?(Ks=n,!0):(console.warn("WebGL not available for compressed textures."),!1)},add:async n=>{Xa||B0();const e=[];for(const t in Xa)Xa[t]&&e.push(t);return[...e,...n]},remove:async n=>(Xa||B0(),n.filter(e=>!(e in Xa)))};ze.add(hC);class uC extends Gh{constructor(e,t={width:1,height:1,autoLoad:!0}){let i,s;typeof e=="string"?(i=e,s=new Uint8Array):(i=null,s=e),super(s,t),this.origin=i,this.buffer=s?new pf(s):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 pf(e),this.loaded=!0,this.onBlobLoaded(e),this.update(),this)),this._load)}}class la extends uC{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=la._formatToExtension(this.format),(t.levelBuffers||this.buffer)&&(this._levelBuffers=t.levelBuffers||la._createLevelBuffers(e instanceof Uint8Array?e:this.buffer.uint8View,this.format,this.levels,4,4,this.width,this.height))}upload(e,t,i){const s=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;s.pixelStorei(s.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];s.compressedTexImage2D(s.TEXTURE_2D,o,this.format,h,l,0,c)}return!0}onBlobLoaded(){this._levelBuffers=la._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,s,r,a,o){const h=new Array(i);let l=e.byteOffset,c=a,u=o,d=c+s-1&~(s-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+s-1&~(s-1),f=u+r-1&~(r-1),p=d*f*th[t];return h}}const Pd=4,Jl=124,dC=32,L0=20,fC=542327876,Ql={HEIGHT:3,WIDTH:4,MIPMAP_COUNT:7,PIXEL_FORMAT:19},mC={FOURCC:2},ec={DXGI_FORMAT:0,RESOURCE_DIMENSION:1,MISC_FLAG:2,ARRAY_SIZE:3},pC=1,gC=2,vC=4,yC=64,xC=512,bC=131072,wC=827611204,SC=861165636,_C=894720068,TC=808540228,MC=4,EC={[wC]:Ci.COMPRESSED_RGBA_S3TC_DXT1_EXT,[SC]:Ci.COMPRESSED_RGBA_S3TC_DXT3_EXT,[_C]:Ci.COMPRESSED_RGBA_S3TC_DXT5_EXT},AC={70:Ci.COMPRESSED_RGBA_S3TC_DXT1_EXT,71:Ci.COMPRESSED_RGBA_S3TC_DXT1_EXT,73:Ci.COMPRESSED_RGBA_S3TC_DXT3_EXT,74:Ci.COMPRESSED_RGBA_S3TC_DXT3_EXT,76:Ci.COMPRESSED_RGBA_S3TC_DXT5_EXT,77:Ci.COMPRESSED_RGBA_S3TC_DXT5_EXT,72:Ci.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,75:Ci.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,78:Ci.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT,96:Ci.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT,95:Ci.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT,98:Ci.COMPRESSED_RGBA_BPTC_UNORM_EXT,99:Ci.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT};function CC(n){const e=new Uint32Array(n);if(e[0]!==fC)throw new Error("Invalid DDS file magic word");const t=new Uint32Array(n,0,Jl/Uint32Array.BYTES_PER_ELEMENT),i=t[Ql.HEIGHT],s=t[Ql.WIDTH],r=t[Ql.MIPMAP_COUNT],a=new Uint32Array(n,Ql.PIXEL_FORMAT*Uint32Array.BYTES_PER_ELEMENT,dC/Uint32Array.BYTES_PER_ELEMENT),o=a[pC];if(o&vC){const h=a[mC.FOURCC];if(h!==TC){const w=EC[h],v=Pd+Jl,_=new Uint8Array(n,v);return[new la(_,{format:w,width:s,height:i,levels:r})]}const l=Pd+Jl,c=new Uint32Array(e.buffer,l,L0/Uint32Array.BYTES_PER_ELEMENT),u=c[ec.DXGI_FORMAT],d=c[ec.RESOURCE_DIMENSION],f=c[ec.MISC_FLAG],p=c[ec.ARRAY_SIZE],m=AC[u];if(m===void 0)throw new Error(`DDSParser cannot parse texture data with DXGI format ${u}`);if(f===MC)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,y=Pd+Jl+L0;if(p===1)g.push(new Uint8Array(n,y));else{const w=th[m];let v=0,_=s,x=i;for(let T=0;T<r;T++){const C=Math.max(1,_+3&-4),I=Math.max(1,x+3&-4),k=C*I*w;v+=k,_=_>>>1,x=x>>>1}let M=y;for(let T=0;T<p;T++)g.push(new Uint8Array(n,M,v)),M+=v}return g.map(w=>new la(w,{format:m,width:s,height:i,levels:r}))}throw o&yC?new Error("DDSParser does not support uncompressed texture data."):o&xC?new Error("DDSParser does not supported YUV uncompressed texture data."):o&bC?new Error("DDSParser does not support single-channel (lumninance) texture data!"):o&gC?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 D0=[171,75,84,88,32,49,49,187,13,10,26,10],IC=67305985,As={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},Uf=64,N0={[We.UNSIGNED_BYTE]:1,[We.UNSIGNED_SHORT]:2,[We.INT]:4,[We.UNSIGNED_INT]:4,[We.FLOAT]:4,[We.HALF_FLOAT]:8},RC={[Oe.RGBA]:4,[Oe.RGB]:3,[Oe.RG]:2,[Oe.RED]:1,[Oe.LUMINANCE]:1,[Oe.LUMINANCE_ALPHA]:2,[Oe.ALPHA]:1},PC={[We.UNSIGNED_SHORT_4_4_4_4]:2,[We.UNSIGNED_SHORT_5_5_5_1]:2,[We.UNSIGNED_SHORT_5_6_5]:2};function kC(n,e,t=!1){const i=new DataView(e);if(!FC(n,i))return null;const s=i.getUint32(As.ENDIANNESS,!0)===IC,r=i.getUint32(As.GL_TYPE,s),a=i.getUint32(As.GL_FORMAT,s),o=i.getUint32(As.GL_INTERNAL_FORMAT,s),h=i.getUint32(As.PIXEL_WIDTH,s),l=i.getUint32(As.PIXEL_HEIGHT,s)||1,c=i.getUint32(As.PIXEL_DEPTH,s)||1,u=i.getUint32(As.NUMBER_OF_ARRAY_ELEMENTS,s)||1,d=i.getUint32(As.NUMBER_OF_FACES,s),f=i.getUint32(As.NUMBER_OF_MIPMAP_LEVELS,s),p=i.getUint32(As.BYTES_OF_KEY_VALUE_DATA,s);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,y=h+3&-4,w=l+3&-4,v=new Array(u);let _=h*l;r===0&&(_=y*w);let x;if(r!==0?N0[r]?x=N0[r]*RC[a]:x=PC[r]:x=th[o],x===void 0)throw new Error("Unable to resolve the pixel format stored in the *.ktx file!");const M=t?BC(i,p,s):null;let T=_*x,C=h,I=l,k=y,R=w,F=Uf+p;for(let B=0;B<f;B++){const L=i.getUint32(F,s);let Y=F+4;for(let O=0;O<u;O++){let D=v[O];D||(D=v[O]=new Array(f)),D[B]={levelID:B,levelWidth:f>1||r!==0?C:k,levelHeight:f>1||r!==0?I:R,levelBuffer:new Uint8Array(e,Y,T)},Y+=T}F+=L+4,F=F%4!==0?F+4-F%4:F,C=C>>1||1,I=I>>1||1,k=C+m-1&-4,R=I+g-1&-4,T=k*R*x}return r!==0?{uncompressed:v.map(B=>{let L=B[0].levelBuffer,Y=!1;return r===We.FLOAT?L=new Float32Array(B[0].levelBuffer.buffer,B[0].levelBuffer.byteOffset,B[0].levelBuffer.byteLength/4):r===We.UNSIGNED_INT?(Y=!0,L=new Uint32Array(B[0].levelBuffer.buffer,B[0].levelBuffer.byteOffset,B[0].levelBuffer.byteLength/4)):r===We.INT&&(Y=!0,L=new Int32Array(B[0].levelBuffer.buffer,B[0].levelBuffer.byteOffset,B[0].levelBuffer.byteLength/4)),{resource:new Gh(L,{width:B[0].levelWidth,height:B[0].levelHeight}),type:r,format:Y?OC(a):a}}),kvData:M}:{compressed:v.map(B=>new la(null,{format:o,width:h,height:l,levels:f,levelBuffers:B})),kvData:M}}function FC(n,e){for(let t=0;t<D0.length;t++)if(e.getUint8(t)!==D0[t])return console.error(`${n} is not a valid *.ktx file!`),!1;return!0}function OC(n){switch(n){case Oe.RGBA:return Oe.RGBA_INTEGER;case Oe.RGB:return Oe.RGB_INTEGER;case Oe.RG:return Oe.RG_INTEGER;case Oe.RED:return Oe.RED_INTEGER;default:return n}}function BC(n,e,t){const i=new Map;let s=0;for(;s<e;){const r=n.getUint32(Uf+s,t),a=Uf+s+4,o=3-(r+3)%4;if(r===0||r>e-s){console.error("KTXLoader: keyAndValueByteSize out of bounds");break}let h=0;for(;h<r&&n.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(n.buffer,a,h)),c=new DataView(n.buffer,a+h+1,r-h-1);i.set(l,c),s+=4+r+o}return i}const LC={extension:{type:Xe.LoadParser,priority:ds.High},name:"loadDDS",test(n){return ns(n,".dds")},async load(n,e,t){const i=await(await $e.ADAPTER.fetch(n)).arrayBuffer(),s=CC(i).map(r=>{const a=new ot(r,{mipmap:ws.OFF,alphaMode:Ai.NO_PREMULTIPLIED_ALPHA,resolution:Qn(n),...e.data});return Cl(a,t,n)});return s.length===1?s[0]:s},unload(n){Array.isArray(n)?n.forEach(e=>e.destroy(!0)):n.destroy(!0)}};ze.add(LC);const DC={extension:{type:Xe.LoadParser,priority:ds.High},name:"loadKTX",test(n){return ns(n,".ktx")},async load(n,e,t){const i=await(await $e.ADAPTER.fetch(n)).arrayBuffer(),{compressed:s,uncompressed:r,kvData:a}=kC(n,i),o=s??r,h={mipmap:ws.OFF,alphaMode:Ai.NO_PREMULTIPLIED_ALPHA,resolution:Qn(n),...e.data},l=o.map(c=>{o===r&&Object.assign(h,{type:c.type,format:c.format});const u=c.resource??c,d=new ot(u,h);return d.ktxKeyValueData=a,Cl(d,t,n)});return l.length===1?l[0]:l},unload(n){Array.isArray(n)?n.forEach(e=>e.destroy(!0)):n.destroy(!0)}};ze.add(DC);const NC=["s3tc","s3tc_sRGB","etc","etc1","pvrtc","atc","astc","bptc"],UC={extension:Xe.ResolveParser,test:n=>{const e=li.extname(n).slice(1);return["basis","ktx","dds"].includes(e)},parse:n=>{var i,s;const e=n.split("."),t=e.pop();if(["ktx","dds"].includes(t)){const r=e.pop();if(NC.includes(r))return{resolution:parseFloat(((i=$e.RETINA_PREFIX.exec(n))==null?void 0:i[1])??"1"),format:r,src:n}}return{resolution:parseFloat(((s=$e.RETINA_PREFIX.exec(n))==null?void 0:s[1])??"1"),format:t,src:n}}};ze.add(UC);const tc=new vt,XC=4,n1=class Go{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,s){const r=new Image;return r.src=await this.base64(e,t,i,s),r}async base64(e,t,i,s){const r=this.canvas(e,s);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:s,height:r,flipY:a,premultipliedAlpha:o}=this._rawPixels(e,t);a&&Go._flipY(i,s,r),o&&Go._unpremultiplyAlpha(i);const h=new wM(s,r,1),l=new ImageData(new Uint8ClampedArray(i.buffer),s,r);return h.context.putImageData(l,0,0),h.canvas}pixels(e,t){const{pixels:i,width:s,height:r,flipY:a,premultipliedAlpha:o}=this._rawPixels(e,t);return a&&Go._flipY(i,s,r),o&&Go._unpremultiplyAlpha(i),i}_rawPixels(e,t){const i=this.renderer;if(!i)throw new Error("The Extract has already been destroyed");let s,r=!1,a=!1,o,h=!1;e&&(e instanceof ya?o=e:(o=i.generateTexture(e,{region:t,resolution:i.resolution,multisample:i.multisample}),h=!0,t&&(tc.width=t.width,tc.height=t.height,t=tc)));const l=i.gl;if(o){if(s=o.baseTexture.resolution,t=t??o.frame,r=!1,a=o.baseTexture.alphaMode>0&&o.baseTexture.format===Oe.RGBA,!h){i.renderTexture.bind(o);const f=o.framebuffer.glFramebuffers[i.CONTEXT_UID];f.blitFramebuffer&&i.framebuffer.bind(f.blitFramebuffer)}}else s=i.resolution,t||(t=tc,t.width=i.width/s,t.height=i.height/s),r=!0,a=this._rendererPremultipliedAlpha,i.renderTexture.bind();const c=Math.max(Math.round(t.width*s),1),u=Math.max(Math.round(t.height*s),1),d=new Uint8Array(XC*c*u);return l.readPixels(Math.round(t.x*s),Math.round(t.y*s),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 s=t<<2,r=i>>1,a=new Uint8Array(s);for(let o=0;o<r;o++){const h=o*s,l=(i-o-1)*s;a.set(e.subarray(h,h+s)),e.copyWithin(h,l,l+s),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 s=e[i+3];if(s!==0){const r=255.001/s;e[i]=e[i]*r+.5,e[i+1]=e[i+1]*r+.5,e[i+2]=e[i+2]*r+.5}}}};n1.extension={name:"extract",type:Xe.RendererSystem};let YC=n1;ze.add(YC);const ih={build(n){const e=n.points;let t,i,s,r,a,o;if(n.type===ki.CIRC){const p=n.shape;t=p.x,i=p.y,a=o=p.radius,s=r=0}else if(n.type===ki.ELIP){const p=n.shape;t=p.x,i=p.y,a=p.width,o=p.height,s=r=0}else{const p=n.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))),s=m-a,r=g-o}if(!(a>=0&&o>=0&&s>=0&&r>=0)){e.length=0;return}const h=Math.ceil(2.3*Math.sqrt(a+o)),l=h*8+(s?4:0)+(r?4:0);if(e.length=l,l===0)return;if(h===0){e.length=8,e[0]=e[6]=t+s,e[1]=e[3]=i+r,e[2]=e[4]=t-s,e[5]=e[7]=i-r;return}let c=0,u=h*4+(s?2:0)+2,d=u,f=l;{const p=s+a,m=r,g=t+p,y=t-p,w=i+m;if(e[c++]=g,e[c++]=w,e[--u]=w,e[--u]=y,r){const v=i-m;e[d++]=y,e[d++]=v,e[--f]=v,e[--f]=g}}for(let p=1;p<h;p++){const m=Math.PI/2*(p/h),g=s+Math.cos(m)*a,y=r+Math.sin(m)*o,w=t+g,v=t-g,_=i+y,x=i-y;e[c++]=w,e[c++]=_,e[--u]=_,e[--u]=v,e[d++]=v,e[d++]=x,e[--f]=x,e[--f]=w}{const p=s,m=r+o,g=t+p,y=t-p,w=i+m,v=i-m;e[c++]=g,e[c++]=w,e[--f]=v,e[--f]=g,s&&(e[c++]=y,e[c++]=w,e[--f]=v,e[--f]=y)}},triangulate(n,e){const t=n.points,i=e.points,s=e.indices;if(t.length===0)return;let r=i.length/2;const a=r;let o,h;if(n.type!==ki.RREC){const c=n.shape;o=c.x,h=c.y}else{const c=n.shape;o=c.x+c.width/2,h=c.y+c.height/2}const l=n.matrix;i.push(n.matrix?l.a*o+l.c*h+l.tx:o,n.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]),s.push(r++,a,r);s.push(a+1,a,r)}};function U0(n,e=!1){const t=n.length;if(t<6)return;let i=0;for(let s=0,r=n[t-2],a=n[t-1];s<t;s+=2){const o=n[s],h=n[s+1];i+=(o-r)*(h+a),r=o,a=h}if(!e&&i>0||e&&i<=0){const s=t/2;for(let r=s+s%2;r<t;r+=2){const a=t-r-2,o=t-r-1,h=r,l=r+1;[n[a],n[h]]=[n[h],n[a]],[n[o],n[l]]=[n[l],n[o]]}}}const r1={build(n){n.points=n.shape.points.slice()},triangulate(n,e){let t=n.points;const i=n.holes,s=e.points,r=e.indices;if(t.length>=6){U0(t,!1);const a=[];for(let l=0;l<i.length;l++){const c=i[l];U0(c.points,!0),a.push(t.length/2),t=t.concat(c.points)}const o=wT(t,a,2);if(!o)return;const h=s.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++)s.push(t[l])}}},VC={build(n){const e=n.shape,t=e.x,i=e.y,s=e.width,r=e.height,a=n.points;a.length=0,s>=0&&r>=0&&a.push(t,i,t+s,i,t+s,i+r,t,i+r)},triangulate(n,e){const t=n.points,i=e.points;if(t.length===0)return;const s=i.length/2;i.push(t[0],t[1],t[2],t[3],t[6],t[7],t[4],t[5]),e.indices.push(s,s+1,s+2,s+1,s+2,s+3)}},$C={build(n){ih.build(n)},triangulate(n,e){ih.triangulate(n,e)}};var vs=(n=>(n.MITER="miter",n.BEVEL="bevel",n.ROUND="round",n))(vs||{}),Tr=(n=>(n.BUTT="butt",n.ROUND="round",n.SQUARE="square",n))(Tr||{});const co={adaptive:!0,maxLength:10,minSegments:8,maxSegments:2048,epsilon:1e-4,_segmentsCount(n,e=20){if(!this.adaptive||!n||isNaN(n))return e;let t=Math.ceil(n/this.maxLength);return t<this.minSegments?t=this.minSegments:t>this.maxSegments&&(t=this.maxSegments),t}};class X0{static curveTo(e,t,i,s,r,a){const o=a[a.length-2],h=a[a.length-1]-t,l=o-e,c=s-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,y=r*Math.sqrt(p)/d,w=g*m/f,v=y*m/p,_=g*u+y*l,x=g*c+y*h,M=l*(y+w),T=h*(y+w),C=u*(g+v),I=c*(g+v),k=Math.atan2(T-x,M-_),R=Math.atan2(I-x,C-_);return{cx:_+e,cy:x+t,radius:r,startAngle:k,endAngle:R,anticlockwise:l*c>u*h}}static arc(e,t,i,s,r,a,o,h,l){const c=o-a,u=co._segmentsCount(Math.abs(c)*r,Math.ceil(Math.abs(c)/Wc)*40),d=c/(u*2),f=d*2,p=Math.cos(d),m=Math.sin(d),g=u-1,y=g%1/g;for(let w=0;w<=g;++w){const v=w+y*w,_=d+a+f*v,x=Math.cos(_),M=-Math.sin(_);l.push((p*x+m*M)*r+i,(p*-M+m*x)*r+s)}}}class GC{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 Gm{static curveLength(e,t,i,s,r,a,o,h){let l=0,c=0,u=0,d=0,f=0,p=0,m=0,g=0,y=0,w=0,v=0,_=e,x=t;for(let M=1;M<=10;++M)c=M/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,y=m*t+3*p*c*s+3*f*u*a+d*h,w=_-g,v=x-y,_=g,x=y,l+=Math.sqrt(w*w+v*v);return l}static curveTo(e,t,i,s,r,a,o){const h=o[o.length-2],l=o[o.length-1];o.length-=2;const c=co._segmentsCount(Gm.curveLength(h,l,e,t,i,s,r,a));let u=0,d=0,f=0,p=0,m=0;o.push(h,l);for(let g=1,y=0;g<=c;++g)y=g/c,u=1-y,d=u*u,f=d*u,p=y*y,m=p*y,o.push(f*h+3*d*y*e+3*u*p*i+m*r,f*l+3*d*y*t+3*u*p*s+m*a)}}function Y0(n,e,t,i,s,r,a,o){const h=n-t*s,l=e-i*s,c=n+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,y=u+f;return o.push(p,m,g,y),2}function Vr(n,e,t,i,s,r,a,o){const h=t-n,l=i-e;let c=Math.atan2(h,l),u=Math.atan2(s-n,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,y=f/g;if(d+=y,o){a.push(n,e,t,i);for(let w=1,v=d;w<g;w++,v+=y)a.push(n,e,n+Math.sin(v)*m,e+Math.cos(v)*m);a.push(n,e,s,r)}else{a.push(t,i,n,e);for(let w=1,v=d;w<g;w++,v+=y)a.push(n+Math.sin(v)*m,e+Math.cos(v)*m,n,e);a.push(s,r,n,e)}return g*2}function HC(n,e){const t=n.shape;let i=n.points||t.points.slice();const s=e.closePointEps;if(i.length===0)return;const r=n.lineStyle,a=new kt(i[0],i[1]),o=new kt(i[i.length-2],i[i.length-1]),h=t.type!==ki.POLY||t.closeStroke,l=Math.abs(a.x-o.x)<s&&Math.abs(a.y-o.y)<s;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,P=(o.y+a.y)*.5;i.unshift(D,P),i.push(D,P)}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 y=i[0],w=i[1],v=i[2],_=i[3],x=0,M=0,T=-(w-_),C=y-v,I=0,k=0,R=Math.sqrt(T*T+C*C);T/=R,C/=R,T*=p,C*=p;const F=r.alignment,B=(1-F)*2,L=F*2;h||(r.cap===Tr.ROUND?d+=Vr(y-T*(B-L)*.5,w-C*(B-L)*.5,y-T*B,w-C*B,y+T*L,w+C*L,c,!0)+2:r.cap===Tr.SQUARE&&(d+=Y0(y,w,T,C,B,L,!0,c))),c.push(y-T*B,w-C*B,y+T*L,w+C*L);for(let D=1;D<u-1;++D){y=i[(D-1)*2],w=i[(D-1)*2+1],v=i[D*2],_=i[D*2+1],x=i[(D+1)*2],M=i[(D+1)*2+1],T=-(w-_),C=y-v,R=Math.sqrt(T*T+C*C),T/=R,C/=R,T*=p,C*=p,I=-(_-M),k=v-x,R=Math.sqrt(I*I+k*k),I/=R,k/=R,I*=p,k*=p;const P=v-y,U=w-_,N=v-x,X=M-_,K=P*N+U*X,z=U*N-X*P,se=z<0;if(Math.abs(z)<.001*Math.abs(K)){c.push(v-T*B,_-C*B,v+T*L,_+C*L),K>=0&&(r.join===vs.ROUND?d+=Vr(v,_,v-T*B,_-C*B,v-I*B,_-k*B,c,!1)+4:d+=2,c.push(v-I*L,_-k*L,v+I*B,_+k*B));continue}const Q=(-T+y)*(-C+_)-(-T+v)*(-C+w),me=(-I+x)*(-k+_)-(-I+v)*(-k+M),pe=(P*me-N*Q)/z,Me=(X*Q-U*me)/z,Ie=(pe-v)*(pe-v)+(Me-_)*(Me-_),ge=v+(pe-v)*B,Ee=_+(Me-_)*B,H=v-(pe-v)*L,Z=_-(Me-_)*L,q=Math.min(P*P+U*U,N*N+X*X),W=se?B:L,ee=q+W*W*m,ce=Ie<=ee;let xe=r.join;if(xe===vs.MITER&&Ie/m>g&&(xe=vs.BEVEL),ce)switch(xe){case vs.MITER:{c.push(ge,Ee,H,Z);break}case vs.BEVEL:{se?c.push(ge,Ee,v+T*L,_+C*L,ge,Ee,v+I*L,_+k*L):c.push(v-T*B,_-C*B,H,Z,v-I*B,_-k*B,H,Z),d+=2;break}case vs.ROUND:{se?(c.push(ge,Ee,v+T*L,_+C*L),d+=Vr(v,_,v+T*L,_+C*L,v+I*L,_+k*L,c,!0)+4,c.push(ge,Ee,v+I*L,_+k*L)):(c.push(v-T*B,_-C*B,H,Z),d+=Vr(v,_,v-T*B,_-C*B,v-I*B,_-k*B,c,!1)+4,c.push(v-I*B,_-k*B,H,Z));break}}else{switch(c.push(v-T*B,_-C*B,v+T*L,_+C*L),xe){case vs.MITER:{se?c.push(H,Z,H,Z):c.push(ge,Ee,ge,Ee),d+=2;break}case vs.ROUND:{se?d+=Vr(v,_,v+T*L,_+C*L,v+I*L,_+k*L,c,!0)+2:d+=Vr(v,_,v-T*B,_-C*B,v-I*B,_-k*B,c,!1)+2;break}}c.push(v-I*B,_-k*B,v+I*L,_+k*L),d+=2}}y=i[(u-2)*2],w=i[(u-2)*2+1],v=i[(u-1)*2],_=i[(u-1)*2+1],T=-(w-_),C=y-v,R=Math.sqrt(T*T+C*C),T/=R,C/=R,T*=p,C*=p,c.push(v-T*B,_-C*B,v+T*L,_+C*L),h||(r.cap===Tr.ROUND?d+=Vr(v-T*(B-L)*.5,_-C*(B-L)*.5,v-T*B,_-C*B,v+T*L,_+C*L,c,!1)+2:r.cap===Tr.SQUARE&&(d+=Y0(v,_,T,C,B,L,!1,c)));const Y=e.indices,O=co.epsilon*co.epsilon;for(let D=f;D<d+f-2;++D)y=c[D*2],w=c[D*2+1],v=c[(D+1)*2],_=c[(D+1)*2+1],x=c[(D+2)*2],M=c[(D+2)*2+1],!(Math.abs(y*(_-M)+v*(M-w)+x*(w-_))<O)&&Y.push(D,D+1,D+2)}function jC(n,e){let t=0;const i=n.shape,s=n.points||i.points,r=i.type!==ki.POLY||i.closeStroke;if(s.length===0)return;const a=e.points,o=e.indices,h=s.length/2,l=a.length/2;let c=l;for(a.push(s[0],s[1]),t=1;t<h;t++)a.push(s[t*2],s[t*2+1]),o.push(c,c+1),c++;r&&o.push(c,l)}function V0(n,e){n.lineStyle.native?jC(n,e):HC(n,e)}class Hm{static curveLength(e,t,i,s,r,a){const o=e-2*i+r,h=t-2*s+a,l=2*i-2*e,c=2*s-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,y=2*Math.sqrt(f),w=d/m;return(g*p+m*d*(p-y)+(4*f*u-d*d)*Math.log((2*m+w+p)/(w+y)))/(4*g)}static curveTo(e,t,i,s,r){const a=r[r.length-2],o=r[r.length-1],h=co._segmentsCount(Hm.curveLength(a,o,e,t,i,s));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+(s-t)*d-c)*d)}}}const kd={[ki.POLY]:r1,[ki.CIRC]:ih,[ki.ELIP]:ih,[ki.RECT]:VC,[ki.RREC]:$C},$0=[],ic=[];class sh{constructor(e,t=null,i=null,s=null){this.points=[],this.holes=[],this.shape=e,this.lineStyle=i,this.fillStyle=t,this.matrix=s,this.type=e.type}clone(){return new sh(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 Ra=new kt,a1=class o1 extends ux{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 gl,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(),ic.push(this.drawCalls[e]);this.drawCalls.length=0;for(let e=0;e<this.batches.length;e++){const t=this.batches[e];t.reset(),$0.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,s=null){const r=new sh(e,t,i,s);return this.graphicsData.push(r),this.dirty++,this}drawHole(e,t=null){if(!this.graphicsData.length)return null;const i=new sh(e,null,null,t),s=this.graphicsData[this.graphicsData.length-1];return i.lineStyle=s.lineStyle,s.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 s=t[i];if(s.fillStyle.visible&&s.shape&&(s.matrix?s.matrix.applyInverse(e,Ra):Ra.copyFrom(e),s.shape.contains(Ra.x,Ra.y))){let r=!1;if(s.holes){for(let a=0;a<s.holes.length;a++)if(s.holes[a].shape.contains(Ra.x,Ra.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,s=null;this.batches.length>0&&(i=this.batches[this.batches.length-1],s=i.style);for(let h=this.shapeIndex;h<t.length;h++){this.shapeIndex++;const l=t[h],c=l.fillStyle,u=l.lineStyle;kd[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=Ds.REPEAT,d===0?this.processFill(l):this.processLine(l);const y=this.points.length/2-g;y!==0&&(i&&!this._compareStyles(s,f)&&(i.end(m,g),i=null),i||(i=$0.pop()||new GC,i.begin(f,m,g),this.batches.push(i),s=f),this.addUvs(this.points,e,f.texture,g,y,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],s=i.fillStyle,r=i.lineStyle;if(s&&!s.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 s=e[t];for(let r=0;r<s.size;r++){const a=s.start+r;this.indicesUint16[a]=this.indicesUint16[a]-s.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<o1.BATCHABLE_SIZE*2}buildDrawCalls(){let e=++ot._globalBatch;for(let u=0;u<this.drawCalls.length;u++)this.drawCalls[u].texArray.clear(),ic.push(this.drawCalls[u]);this.drawCalls.length=0;const t=this.colors,i=this.textureIds;let s=ic.pop();s||(s=new yf,s.texArray=new Sf),s.texArray.count=0,s.start=0,s.size=0,s.type=dn.TRIANGLES;let r=0,a=null,o=0,h=!1,l=dn.TRIANGLES,c=0;this.drawCalls.push(s);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?dn.LINES:dn.TRIANGLES,a=null,r=f,e++),a!==m&&(a=m,m._batchEnabled!==e&&(r===f&&(e++,r=0,s.size>0&&(s=ic.pop(),s||(s=new yf,s.texArray=new Sf),this.drawCalls.push(s)),s.start=c,s.size=0,s.texArray.count=0,s.type=l),m.touched=1,m._batchEnabled=e,m._batchLocation=r,m.wrapMode=Ds.REPEAT,s.texArray.elements[s.texArray.count++]=m,r++)),s.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)}ot._globalBatch=e,this.packAttributes()}packAttributes(){const e=this.points,t=this.uvs,i=this.colors,s=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++]=s[l];this._buffer.update(r),this._indexBuffer.update(this.indicesUint16)}processFill(e){e.holes.length?r1.triangulate(e,this):kd[e.type].triangulate(e,this)}processLine(e){V0(e,this);for(let t=0;t<e.holes.length;t++)V0(e.holes[t],this)}processHoles(e){for(let t=0;t<e.length;t++){const i=e[t];kd[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 s=e[i*2],r=e[i*2+1];e[i*2]=t.a*s+t.c*r+t.tx,e[i*2+1]=t.b*s+t.d*r+t.ty}}addColors(e,t,i,s,r=0){const a=Lt.shared.setValue(t).toLittleEndianNumber(),o=Lt.shared.setValue(a).toPremultiplied(i);e.length=Math.max(e.length,r+s);for(let h=0;h<s;h++)e[r+h]=o}addTextureIds(e,t,i,s=0){e.length=Math.max(e.length,s+i);for(let r=0;r<i;r++)e[s+r]=t}addUvs(e,t,i,s,r,a=null){let o=0;const h=t.length,l=i.frame;for(;o<r;){let u=e[(s+o)*2],d=e[(s+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,s){const r=t.baseTexture,a=1e-6,o=i+s*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}};a1.BATCHABLE_SIZE=100;let WC=a1;class Kh{constructor(){this.color=16777215,this.alpha=1,this.texture=rt.WHITE,this.matrix=null,this.visible=!1,this.reset()}clone(){const e=new Kh;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=rt.WHITE,this.matrix=null,this.visible=!1}destroy(){this.texture=null,this.matrix=null}}class jm extends Kh{constructor(){super(...arguments),this.width=0,this.alignment=.5,this.native=!1,this.cap=Tr.BUTT,this.join=vs.MITER,this.miterLimit=10}clone(){const e=new jm;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=Tr.BUTT,this.join=vs.MITER,this.miterLimit=10}}const Fd={},Xf=class Ec extends Oi{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 Kh,this._lineStyle=new jm,this._matrix=null,this._holeMode=!1,this.state=Sn.for2d(),this._geometry=e||new WC,this._geometry.refCount++,this._transformID=-1,this._tintColor=new Lt(16777215),this.blendMode=st.NORMAL}get geometry(){return this._geometry}clone(){return this.finishPoly(),new Ec(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,s=.5,r=!1){return typeof e=="number"&&(e={width:e,color:t,alpha:i,alignment:s,native:r}),this.lineTextureStyle(e)}lineTextureStyle(e){const t={width:0,texture:rt.WHITE,color:e!=null&&e.texture?16777215:0,matrix:null,alignment:.5,native:!1,cap:Tr.BUTT,join:vs.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 oa,this.currentPath.closeStroke=!1,this.currentPath.points.push(e[t-2],e[t-1]))}else this.currentPath=new oa,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,s=i[i.length-2],r=i[i.length-1];return(s!==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,s){this._initCurve();const r=this.currentPath.points;return r.length===0&&this.moveTo(0,0),Hm.curveTo(e,t,i,s,r),this}bezierCurveTo(e,t,i,s,r,a){return this._initCurve(),Gm.curveTo(e,t,i,s,r,a,this.currentPath.points),this}arcTo(e,t,i,s,r){this._initCurve(e,t);const a=this.currentPath.points,o=X0.curveTo(e,t,i,s,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,s,r,a=!1){if(s===r)return this;if(!a&&r<=s?r+=Wc:a&&s<=r&&(s+=Wc),r-s===0)return this;const o=e+Math.cos(s)*i,h=t+Math.sin(s)*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 X0.arc(o,h,e,t,i,s,r,a,c),this}beginFill(e=0,t){return this.beginTextureFill({texture:rt.WHITE,color:e,alpha:t})}normalizeColor(e){const t=Lt.shared.setValue(e.color??0);e.color=t.toNumber(),e.alpha??(e.alpha=t.alpha)}beginTextureFill(e){const t={texture:rt.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,s){return this.drawShape(new vt(e,t,i,s))}drawRoundedRect(e,t,i,s,r){return this.drawShape(new Wh(e,t,i,s,r))}drawCircle(e,t,i){return this.drawShape(new Hh(e,t,i))}drawEllipse(e,t,i,s){return this.drawShape(new jh(e,t,i,s))}drawPolygon(...e){let t,i=!0;const s=e[0];s.points?(i=s.closeStroke,t=s.points):Array.isArray(e[0])?t=e[0]:t=e;const r=new oa(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===ki.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 s=0;s<i;s++){const r=e.batches[s],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:Lt.shared.setValue(a).toRgbArray(),_tintRGB:a,_texture:r.style.texture,alpha:r.style.alpha,worldAlpha:1};this.batches[s]=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 s=this.batches[t];s.worldAlpha=this.worldAlpha*s.alpha,e.plugins[this.pluginName].render(s)}}}_renderDirect(e){const t=this._resolveDirectShader(e),i=this._geometry,s=this.worldAlpha,r=t.uniforms,a=i.drawCalls;r.translationMatrix=this.transform.worldTransform,Lt.shared.setValue(this._tintColor).premultiply(s).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:s,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(s,r,a)}_resolveDirectShader(e){let t=this.shader;const i=this.pluginName;if(!t){if(!Fd[i]){const{maxTextures:s}=e.plugins[i],r=new Int32Array(s);for(let h=0;h<s;h++)r[h]=h;const a={tint:new Float32Array([1,1,1,1]),translationMatrix:new Zt,default:Us.from({uSamplers:r},!0)},o=e.plugins[i]._shader.program;Fd[i]=new Xs(o,a)}t=Fd[i]}return t}_calculateBounds(){this.finishPoly();const e=this._geometry;if(!e.graphicsData.length)return;const{minX:t,minY:i,maxX:s,maxY:r}=e.bounds;this._bounds.addFrame(this.transform,t,i,s,r)}containsPoint(e){return this.worldTransform.applyInverse(e,Ec._TEMP_POINT),this._geometry.containsPoint(Ec._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=Lt.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,s=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+s*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)}};Xf.curves=co,Xf._TEMP_POINT=new kt;let is=Xf;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 Od=new kt,G0=new oa,l1=class c1 extends Oi{constructor(e,t,i,s=dn.TRIANGLES){super(),this.geometry=e,this.shader=t,this.state=i||Sn.for2d(),this.drawMode=s,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=$e.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===dn.TRIANGLES&&t.length<c1.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 s=this.material.pluginName;e.batch.setObjectRenderer(e.plugins[s]),e.plugins[s].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 s=this.transform.worldTransform,r=s.a,a=s.b,o=s.c,h=s.d,l=s.tx,c=s.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=$e.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,Od);const t=this.geometry.getBuffer("aVertexPosition").data,i=G0.points,s=this.geometry.getIndex().data,r=s.length,a=this.drawMode===4?3:1;for(let o=0;o+2<r;o+=a){const h=s[o]*2,l=s[o+1]*2,c=s[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],G0.contains(Od.x,Od.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}};l1.BATCHABLE_SIZE=100;let vl=l1;class Wm extends bn{constructor(e,t,i){super();const s=new qt(e),r=new qt(t,!0),a=new qt(i,!0,!0);this.addAttribute("aVertexPosition",s,2,!1,We.FLOAT).addAttribute("aTextureCoord",r,2,!1,We.FLOAT).addIndex(a),this._updateId=-1}get vertexDirtyId(){return this.buffers[0]._updateID}}var qC=`varying vec2 vTextureCoord;
|
||
uniform vec4 uColor;
|
||
|
||
uniform sampler2D uSampler;
|
||
|
||
void main(void)
|
||
{
|
||
gl_FragColor = texture2D(uSampler, vTextureCoord) * uColor;
|
||
}
|
||
`,KC=`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 nh extends Xs{constructor(e,t){const i={uSampler:e,alpha:1,uTextureMatrix:Zt.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||fn.from(KC,qC),i),this._colorDirty=!1,this.uvMatrix=new Ym(e),this.batchable=t.program===void 0,this.pluginName=t.pluginName,this._tintColor=new Lt(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;Lt.shared.setValue(this._tintColor).premultiply(this._alpha,e).toArray(this.uniforms.uColor)}this.uvMatrix.update()&&(this.uniforms.uTextureMatrix=this.uvMatrix.mapCoord)}}class ZC extends vl{constructor(e=rt.EMPTY,t,i,s,r){const a=new Wm(t,i,s);a.getBuffer("aVertexPosition").static=!1;const o=new nh(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 H0{constructor(e,t,i){this.geometry=new bn,this.indexBuffer=null,this.size=i,this.dynamicProperties=[],this.staticProperties=[];for(let s=0;s<e.length;++s){let r=e[s];r={attributeName:r.attributeName,size:r.size,uploadFunction:r.uploadFunction,type:r.type||We.FLOAT,offset:r.offset},t[s]?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 qt(xM(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 qt(this.dynamicData,!1,!1);let s=0;this.staticStride=0;for(let a=0;a<this.staticProperties.length;++a){const o=this.staticProperties[a];o.offset=s,s+=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 qt(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===We.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===We.UNSIGNED_BYTE,o.type,this.staticStride*4,o.offset*4)}}uploadDynamic(e,t,i){for(let s=0;s<this.dynamicProperties.length;s++){const r=this.dynamicProperties[s];r.uploadFunction(e,t,i,r.type===We.UNSIGNED_BYTE?this.dynamicDataUint32:this.dynamicData,this.dynamicStride,r.offset)}this.dynamicBuffer._updateID++}uploadStatic(e,t,i){for(let s=0;s<this.staticProperties.length;s++){const r=this.staticProperties[s];r.uploadFunction(e,t,i,r.type===We.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 JC=`varying vec2 vTextureCoord;
|
||
varying vec4 vColor;
|
||
|
||
uniform sampler2D uSampler;
|
||
|
||
void main(void){
|
||
vec4 color = texture2D(uSampler, vTextureCoord) * vColor;
|
||
gl_FragColor = color;
|
||
}`,QC=`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 h1 extends zh{constructor(e){super(e),this.shader=null,this.properties=null,this.tempMatrix=new Zt,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:We.UNSIGNED_BYTE,uploadFunction:this.uploadTint,offset:0}],this.shader=Xs.from(QC,JC,{}),this.state=Sn.for2d()}render(e){const t=e.children,i=e._maxSize,s=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=lx(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=Lt.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+=s,p+=1){let m=a-f;m>s&&(m=s),p>=o.length&&o.push(this._generateOneMoreBuffer(e));const g=o[p];g.uploadDynamic(t,f,m);const y=e._bufferUpdateIDs[p]||0;d=d||g._updateID<y,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,s=e._batchSize,r=e._properties;for(let a=0;a<i;a+=s)t.push(new H0(this.properties,r,s));return t}_generateOneMoreBuffer(e){const t=e._batchSize,i=e._properties;return new H0(this.properties,i,t)}uploadVertices(e,t,i,s,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,y=f.orig;g?(h=g.x-d.anchor.x*y.width,o=h+g.width,c=g.y-d.anchor.y*y.height,l=c+g.height):(o=y.width*(1-d.anchor.x),h=y.width*-d.anchor.x,l=y.height*(1-d.anchor.y),c=y.height*-d.anchor.y),s[a]=h*p,s[a+1]=c*m,s[a+r]=o*p,s[a+r+1]=c*m,s[a+r*2]=o*p,s[a+r*2+1]=l*m,s[a+r*3]=h*p,s[a+r*3+1]=l*m,a+=r*4}}uploadPosition(e,t,i,s,r,a){for(let o=0;o<i;o++){const h=e[t+o].position;s[a]=h.x,s[a+1]=h.y,s[a+r]=h.x,s[a+r+1]=h.y,s[a+r*2]=h.x,s[a+r*2+1]=h.y,s[a+r*3]=h.x,s[a+r*3+1]=h.y,a+=r*4}}uploadRotation(e,t,i,s,r,a){for(let o=0;o<i;o++){const h=e[t+o].rotation;s[a]=h,s[a+r]=h,s[a+r*2]=h,s[a+r*3]=h,a+=r*4}}uploadUvs(e,t,i,s,r,a){for(let o=0;o<i;++o){const h=e[t+o]._texture._uvs;h?(s[a]=h.x0,s[a+1]=h.y0,s[a+r]=h.x1,s[a+r+1]=h.y1,s[a+r*2]=h.x2,s[a+r*2+1]=h.y2,s[a+r*3]=h.x3,s[a+r*3+1]=h.y3,a+=r*4):(s[a]=0,s[a+1]=0,s[a+r]=0,s[a+r+1]=0,s[a+r*2]=0,s[a+r*2+1]=0,s[a+r*3]=0,s[a+r*3+1]=0,a+=r*4)}}uploadTint(e,t,i,s,r,a){for(let o=0;o<i;++o){const h=e[t+o],l=Lt.shared.setValue(h._tintRGB).toPremultiplied(h.alpha,h.texture.baseTexture.alphaMode>0);s[a]=l,s[a+r]=l,s[a+r*2]=l,s[a+r*3]=l,a+=r*4}}destroy(){super.destroy(),this.shader&&(this.shader.destroy(),this.shader=null),this.tempMatrix=null}}h1.extension={name:"particle",type:Xe.RendererPlugin};ze.add(h1);var Zh=(n=>(n[n.LINEAR_VERTICAL=0]="LINEAR_VERTICAL",n[n.LINEAR_HORIZONTAL=1]="LINEAR_HORIZONTAL",n))(Zh||{});const sc={willReadFrequently:!0},Zs=class Qe{static get experimentalLetterSpacingSupported(){let e=Qe._experimentalLetterSpacingSupported;if(e!==void 0){const t=$e.ADAPTER.getCanvasRenderingContext2D().prototype;e=Qe._experimentalLetterSpacingSupported="letterSpacing"in t||"textLetterSpacing"in t}return e}constructor(e,t,i,s,r,a,o,h,l){this.text=e,this.style=t,this.width=i,this.height=s,this.lines=r,this.lineWidths=a,this.lineHeight=o,this.maxLineWidth=h,this.fontProperties=l}static measureText(e,t,i,s=Qe._canvas){i=i??t.wordWrap;const r=t.toFontString(),a=Qe.measureFont(r);a.fontSize===0&&(a.fontSize=t.fontSize,a.ascent=t.fontSize);const o=s.getContext("2d",sc);o.font=r;const h=(i?Qe.wordWrap(e,t,s):e).split(/(?:\r\n|\r|\n)/),l=new Array(h.length);let c=0;for(let p=0;p<h.length;p++){const m=Qe._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 Qe(e,t,u,f,h,l,d+t.leading,c,a)}static _measureText(e,t,i){let s=!1;Qe.experimentalLetterSpacingSupported&&(Qe.experimentalLetterSpacing?(i.letterSpacing=`${t}px`,i.textLetterSpacing=`${t}px`,s=!0):(i.letterSpacing="0px",i.textLetterSpacing="0px"));let r=i.measureText(e).width;return r>0&&(s?r-=t:r+=(Qe.graphemeSegmenter(e).length-1)*t),r}static wordWrap(e,t,i=Qe._canvas){const s=i.getContext("2d",sc);let r=0,a="",o="";const h=Object.create(null),{letterSpacing:l,whiteSpace:c}=t,u=Qe.collapseSpaces(c),d=Qe.collapseNewlines(c);let f=!u;const p=t.wordWrapWidth+l,m=Qe.tokenize(e);for(let g=0;g<m.length;g++){let y=m[g];if(Qe.isNewline(y)){if(!d){o+=Qe.addLine(a),f=!u,a="",r=0;continue}y=" "}if(u){const v=Qe.isBreakingSpace(y),_=Qe.isBreakingSpace(a[a.length-1]);if(v&&_)continue}const w=Qe.getFromCache(y,l,h,s);if(w>p)if(a!==""&&(o+=Qe.addLine(a),a="",r=0),Qe.canBreakWords(y,t.breakWords)){const v=Qe.wordWrapSplit(y);for(let _=0;_<v.length;_++){let x=v[_],M=x,T=1;for(;v[_+T];){const I=v[_+T];if(!Qe.canBreakChars(M,I,y,_,t.breakWords))x+=I;else break;M=I,T++}_+=T-1;const C=Qe.getFromCache(x,l,h,s);C+r>p&&(o+=Qe.addLine(a),f=!1,a="",r=0),a+=x,r+=C}}else{a.length>0&&(o+=Qe.addLine(a),a="",r=0);const v=g===m.length-1;o+=Qe.addLine(y,!v),f=!1,a="",r=0}else w+r>p&&(f=!1,o+=Qe.addLine(a),a="",r=0),(a.length>0||!Qe.isBreakingSpace(y)||f)&&(a+=y,r+=w)}return o+=Qe.addLine(a,!1),o}static addLine(e,t=!0){return e=Qe.trimRight(e),e=t?`${e}
|
||
`:e,e}static getFromCache(e,t,i,s){let r=i[e];return typeof r!="number"&&(r=Qe._measureText(e,t,s)+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(!Qe.isBreakingSpace(i))break;e=e.slice(0,-1)}return e}static isNewline(e){return typeof e!="string"?!1:Qe._newlines.includes(e.charCodeAt(0))}static isBreakingSpace(e,t){return typeof e!="string"?!1:Qe._breakingSpaces.includes(e.charCodeAt(0))}static tokenize(e){const t=[];let i="";if(typeof e!="string")return t;for(let s=0;s<e.length;s++){const r=e[s],a=e[s+1];if(Qe.isBreakingSpace(r,a)||Qe.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,s,r){return!0}static wordWrapSplit(e){return Qe.graphemeSegmenter(e)}static measureFont(e){if(Qe._fonts[e])return Qe._fonts[e];const t={ascent:0,descent:0,fontSize:0},i=Qe._canvas,s=Qe._context;s.font=e;const r=Qe.METRICS_STRING+Qe.BASELINE_SYMBOL,a=Math.ceil(s.measureText(r).width);let o=Math.ceil(s.measureText(Qe.BASELINE_SYMBOL).width);const h=Math.ceil(Qe.HEIGHT_MULTIPLIER*o);if(o=o*Qe.BASELINE_MULTIPLIER|0,a===0||h===0)return Qe._fonts[e]=t,t;i.width=a,i.height=h,s.fillStyle="#f00",s.fillRect(0,0,a,h),s.font=e,s.textBaseline="alphabetic",s.fillStyle="#000",s.fillText(r,0,o);const l=s.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,Qe._fonts[e]=t,t}static clearMetrics(e=""){e?delete Qe._fonts[e]:Qe._fonts={}}static get _canvas(){var e;if(!Qe.__canvas){let t;try{const i=new OffscreenCanvas(0,0);if((e=i.getContext("2d",sc))!=null&&e.measureText)return Qe.__canvas=i,i;t=$e.ADAPTER.createCanvas()}catch{t=$e.ADAPTER.createCanvas()}t.width=t.height=10,Qe.__canvas=t}return Qe.__canvas}static get _context(){return Qe.__context||(Qe.__context=Qe._canvas.getContext("2d",sc)),Qe.__context}};Zs.METRICS_STRING="|ÉqÅ",Zs.BASELINE_SYMBOL="M",Zs.BASELINE_MULTIPLIER=1.4,Zs.HEIGHT_MULTIPLIER=2,Zs.graphemeSegmenter=(()=>{if(typeof(Intl==null?void 0:Intl.Segmenter)=="function"){const n=new Intl.Segmenter;return e=>[...n.segment(e)].map(t=>t.segment)}return n=>[...n]})(),Zs.experimentalLetterSpacing=!1,Zs._fonts={},Zs._newlines=[10,13],Zs._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288];let mr=Zs;const e2=["serif","sans-serif","monospace","cursive","fantasy","system-ui"],u1=class Ho{constructor(e){this.styleID=0,this.reset(),Ld(this,e,e)}clone(){const e={};return Ld(e,this,Ho.defaultStyle),new Ho(e)}reset(){Ld(this,Ho.defaultStyle,Ho.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=Bd(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=Bd(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){t2(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=Bd(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 s=t[i].trim();!/([\"\'])[^\'\"]+\1/.test(s)&&!e2.includes(s)&&(s=`"${s}"`),t[i]=s}return`${this.fontStyle} ${this.fontVariant} ${this.fontWeight} ${e} ${t.join(",")}`}};u1.defaultStyle={align:"left",breakWords:!1,dropShadow:!1,dropShadowAlpha:1,dropShadowAngle:Math.PI/6,dropShadowBlur:0,dropShadowColor:"black",dropShadowDistance:5,fill:"black",fillGradientType:Zh.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 Rr=u1;function Bd(n){const e=Lt.shared,t=i=>{const s=e.setValue(i);return s.alpha===1?s.toHex():s.toRgbaString()};return Array.isArray(n)?n.map(t):t(n)}function t2(n,e){if(!Array.isArray(n)||!Array.isArray(e)||n.length!==e.length)return!1;for(let t=0;t<n.length;++t)if(n[t]!==e[t])return!1;return!0}function Ld(n,e,t){for(const i in t)Array.isArray(e[i])?n[i]=e[i].slice():n[i]=e[i]}const i2={texture:!0,children:!1,baseTexture:!0},d1=class Yf extends Fr{constructor(e,t,i){let s=!1;i||(i=$e.ADAPTER.createCanvas(),s=!0),i.width=3,i.height=3;const r=rt.from(i);r.orig=new vt,r.trim=new vt,super(r),this._ownCanvas=s,this.canvas=i,this.context=i.getContext("2d",{willReadFrequently:!0}),this._resolution=Yf.defaultResolution??$e.RESOLUTION,this._autoResolution=Yf.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 mr.experimentalLetterSpacing}static set experimentalLetterSpacing(e){Mt("7.1.0","Text.experimentalLetterSpacing is deprecated, use TextMetrics.experimentalLetterSpacing"),mr.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,s=mr.measureText(this._text||" ",this._style,this._style.wordWrap,this.canvas),r=s.width,a=s.height,o=s.lines,h=s.lineHeight,l=s.lineWidths,c=s.maxLineWidth,u=s.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,y=g?Math.ceil(Math.max(1,a)+t.padding*2):0,w=y*this._resolution;if(g){i.fillStyle="black",i.strokeStyle="black";const _=t.dropShadowColor,x=t.dropShadowBlur*this._resolution,M=t.dropShadowDistance*this._resolution;i.shadowColor=Lt.shared.setValue(_).setAlpha(t.dropShadowAlpha).toRgbaString(),i.shadowBlur=x,i.shadowOffsetX=Math.cos(t.dropShadowAngle)*M,i.shadowOffsetY=Math.sin(t.dropShadowAngle)*M+w}else i.fillStyle=this._generateFillStyle(t,o,s),i.strokeStyle=t.stroke,i.shadowColor="black",i.shadowBlur=0,i.shadowOffsetX=0,i.shadowOffsetY=0;let v=(h-u.fontSize)/2;h-u.fontSize<0&&(v=0);for(let _=0;_<o.length;_++)d=t.strokeThickness/2,f=t.strokeThickness/2+_*h+u.ascent+v,t.align==="right"?d+=c-l[_]:t.align==="center"&&(d+=(c-l[_])/2),t.stroke&&t.strokeThickness&&this.drawLetterSpacing(o[_],d+t.padding,f+t.padding-y,!0),t.fill&&this.drawLetterSpacing(o[_],d+t.padding,f+t.padding-y)}this.updateTexture()}drawLetterSpacing(e,t,i,s=!1){const r=this._style.letterSpacing;let a=!1;if(mr.experimentalLetterSpacingSupported&&(mr.experimentalLetterSpacing?(this.context.letterSpacing=`${r}px`,this.context.textLetterSpacing=`${r}px`,a=!0):(this.context.letterSpacing="0px",this.context.textLetterSpacing="0px")),r===0||a){s?this.context.strokeText(e,t,i):this.context.fillText(e,t,i);return}let o=t;const h=mr.graphemeSegmenter(e);let l=this.context.measureText(e).width,c=0;for(let u=0;u<h.length;++u){const d=h[u];s?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=_M(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,s=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=-s,t.trim.y=-s,t.orig.width=t._frame.width-s*2,t.orig.height=t._frame.height-s*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 s=e.fill;if(Array.isArray(s)){if(s.length===1)return s[0]}else return s;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=s.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(s[0]),u.unshift(0),c.push(s[s.length-1]),u.push(1),e.fillGradientType===Zh.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 y=m+d,w=i.lineHeight*(f+1);let v=y;f+1<t.length&&w<y&&(v=(y+w)/2);const _=(v-g)/l;for(let x=0;x<c.length;x++){let M=0;typeof u[x]=="number"?M=u[x]:M=x/c.length;let T=Math.min(1,Math.max(0,g/l+M*_));T=Number(T.toFixed(5)),r.addColorStop(T,c[x])}}}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({},i2,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=_r(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=_r(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 Rr?this._style=e:this._style=new Rr(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)}};d1.defaultAutoResolution=!0;let zm=d1;class s2{constructor(e){this.maxItemsPerFrame=e,this.itemsLeft=0}beginFrame(){this.itemsLeft=this.maxItemsPerFrame}allowedToUpload(){return this.itemsLeft-- >0}}function n2(n,e){var i;let t=!1;if((i=n==null?void 0:n._textures)!=null&&i.length){for(let s=0;s<n._textures.length;s++)if(n._textures[s]instanceof rt){const r=n._textures[s].baseTexture;e.includes(r)||(e.push(r),t=!0)}}return t}function r2(n,e){if(n.baseTexture instanceof ot){const t=n.baseTexture;return e.includes(t)||e.push(t),!0}return!1}function a2(n,e){if(n._texture&&n._texture instanceof rt){const t=n._texture.baseTexture;return e.includes(t)||e.push(t),!0}return!1}function o2(n,e){return e instanceof zm?(e.updateText(!0),!0):!1}function l2(n,e){if(e instanceof Rr){const t=e.toFontString();return mr.measureFont(t),!0}return!1}function c2(n,e){if(n instanceof zm){e.includes(n.style)||e.push(n.style),e.includes(n)||e.push(n);const t=n._texture.baseTexture;return e.includes(t)||e.push(t),!0}return!1}function h2(n,e){return n instanceof Rr?(e.includes(n)||e.push(n),!0):!1}const f1=class m1{constructor(e){this.limiter=new s2(m1.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(c2),this.registerFindHook(h2),this.registerFindHook(n2),this.registerFindHook(r2),this.registerFindHook(a2),this.registerUploadHook(o2),this.registerUploadHook(l2)}upload(e){return new Promise(t=>{e&&this.add(e),this.queue.length?(this.completes.push(t),this.ticking||(this.ticking=!0,Ki.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,s=this.uploadHooks.length;i<s;i++)if(this.uploadHooks[i](this.uploadHookHelper,e)){this.queue.shift(),t=!0;break}}t||this.queue.shift()}if(this.queue.length)Ki.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 Oi)for(let t=e.children.length-1;t>=0;t--)this.add(e.children[t]);return this}destroy(){this.ticking&&Ki.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}};f1.uploadsPerFrame=4;let Vf=f1;Object.defineProperties($e,{UPLOADS_PER_FRAME:{get(){return Vf.uploadsPerFrame},set(n){Mt("7.1.0","settings.UPLOADS_PER_FRAME is deprecated, use prepare.BasePrepare.uploadsPerFrame"),Vf.uploadsPerFrame=n}}});function p1(n,e){return e instanceof ot?(e._glTextures[n.CONTEXT_UID]||n.texture.bind(e),!0):!1}function u2(n,e){if(!(e instanceof is))return!1;const{geometry:t}=e;e.finishPoly(),t.updateBatches();const{batches:i}=t;for(let s=0;s<i.length;s++){const{texture:r}=i[s].style;r&&p1(n,r.baseTexture)}return t.batchable||n.geometry.bind(t,e._resolveDirectShader(n)),!0}function d2(n,e){return n instanceof is?(e.push(n),!0):!1}class g1 extends Vf{constructor(e){super(e),this.uploadHookHelper=this.renderer,this.registerFindHook(d2),this.registerUploadHook(p1),this.registerUploadHook(u2)}}g1.extension={name:"prepare",type:Xe.RendererSystem};ze.add(g1);var f2=`#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;
|
||
}
|
||
`,m2=`#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;
|
||
}
|
||
`,p2=`#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;
|
||
}
|
||
`,j0=`#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;
|
||
}
|
||
`,g2=`#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 nc=new Zt;class v1 extends zh{constructor(e){super(e),e.runners.contextChange.add(this),this.quad=new Sx,this.state=Sn.for2d()}contextChange(){const e=this.renderer,t={globals:e.globalUniforms};this.simpleShader=Xs.from(j0,g2,t),this.shader=e.context.webGLVersion>1?Xs.from(m2,f2,t):Xs.from(j0,p2,t)}render(e){const t=this.renderer,i=this.quad;let s=i.vertices;s[0]=s[6]=e._width*-e.anchor.x,s[1]=s[3]=e._height*-e.anchor.y,s[2]=s[4]=e._width*(1-e.anchor.x),s[5]=s[7]=e._height*(1-e.anchor.y);const r=e.uvRespectAnchor?e.anchor.x:0,a=e.uvRespectAnchor?e.anchor.y:0;s=i.uvs,s[0]=s[6]=-r,s[1]=s[3]=-a,s[2]=s[4]=1-r,s[5]=s[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!==Ds.CLAMP:h.wrapMode===Ds.CLAMP&&(h.wrapMode=Ds.REPEAT));const f=d?this.simpleShader:this.shader,p=o.width,m=o.height,g=e._width,y=e._height;nc.set(c.a*p/g,c.b*p/y,c.c*m/g,c.d*m/y,c.tx/g,c.ty/y),nc.invert(),d?nc.prepend(u.mapCoord):(f.uniforms.uMapCoord=u.mapCoord.toArray(!0),f.uniforms.uClampFrame=u.uClampFrame,f.uniforms.uClampOffset=u.uClampOffset),f.uniforms.uTransform=nc.toArray(!0),f.uniforms.uColor=Lt.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=lx(e.blendMode,l),t.state.set(this.state),t.geometry.draw(this.renderer.gl.TRIANGLES,6,0)}}v1.extension={name:"tilingSprite",type:Xe.RendererPlugin};ze.add(v1);const y1=class jo{constructor(e,t,i){this.linkedSheets=[],(e instanceof ot||e instanceof rt)&&(e={texture:e,data:t,resolutionFilename:i});const{texture:s,data:r,resolutionFilename:a=null,cachePrefix:o=""}=e;this.cachePrefix=o,this._texture=s instanceof rt?s:null,this.baseTexture=s instanceof ot?s: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=Qn(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<=jo.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()})}_processFrames(e){let t=e;const i=jo.BATCH_SIZE;for(;t-e<i&&t<this._frameKeys.length;){const s=this._frameKeys[t],r=this._frames[s],a=r.frame;if(a){let o=null,h=null;const l=r.trimmed!==!1&&r.sourceSize?r.sourceSize:r.frame,c=new vt(0,0,Math.floor(l.w)/this.resolution,Math.floor(l.h)/this.resolution);r.rotated?o=new vt(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 vt(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 vt(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[s]=new rt(this.baseTexture,o,c,h,r.rotated?2:0,r.anchor,r.borders),rt.addToCache(this.textures[s],this.cachePrefix+s.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 s=e[t][i];this.animations[t].push(this.textures[s])}}}_parseComplete(){const e=this._callback;this._callback=null,this._batchIndex=0,e.call(this,this.textures)}_nextBatch(){this._processFrames(this._batchIndex*jo.BATCH_SIZE),this._batchIndex++,setTimeout(()=>{this._batchIndex*jo.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=[]}};y1.BATCH_SIZE=1e3;let W0=y1;const v2=["jpg","png","jpeg","avif","webp","s3tc","s3tc_sRGB","etc","etc1","pvrtc","atc","astc","bptc"];function x1(n,e,t){const i={};if(n.forEach(s=>{i[s]=e}),Object.keys(e.textures).forEach(s=>{i[`${e.cachePrefix}${s}`]=e.textures[s]}),!t){const s=li.dirname(n[0]);e.linkedSheets.forEach((r,a)=>{Object.assign(i,x1([`${s}/${e.data.meta.related_multi_packs[a]}`],r,!0))})}return i}const y2={extension:Xe.Asset,cache:{test:n=>n instanceof W0,getCacheableAssets:(n,e)=>x1(n,e,!1)},resolver:{test:n=>{const e=n.split("?")[0].split("."),t=e.pop(),i=e.pop();return t==="json"&&v2.includes(i)},parse:n=>{var t;const e=n.split(".");return{resolution:parseFloat(((t=$e.RETINA_PREFIX.exec(n))==null?void 0:t[1])??"1"),format:e[e.length-2],src:n}}},loader:{name:"spritesheetLoader",extension:{type:Xe.LoadParser,priority:ds.Normal},async testParse(n,e){return li.extname(e.src).toLowerCase()===".json"&&!!n.frames},async parse(n,e,t){var c,u;const{texture:i,imageFilename:s,cachePrefix:r}=(e==null?void 0:e.data)??{};let a=li.dirname(e.src);a&&a.lastIndexOf("/")!==a.length-1&&(a+="/");let o;if(i&&i.baseTexture)o=i;else{const d=Qc(a+(s??n.meta.image),e.src);o=(await t.load([d]))[d]}const h=new W0({texture:o.baseTexture,data:n,resolutionFilename:e.src,cachePrefix:r});await h.parse();const l=(c=n==null?void 0:n.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=Qc(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(n){n.destroy(!0)}}};ze.add(y2);class rh{constructor(){this.info=[],this.common=[],this.page=[],this.char=[],this.kerning=[],this.distanceField=[]}}class Ac{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 s=new rh;return i.info.forEach(r=>s.info.push({face:r.face,size:parseInt(r.size,10)})),i.common.forEach(r=>s.common.push({lineHeight:parseInt(r.lineHeight,10)})),i.page.forEach(r=>s.page.push({id:parseInt(r.id,10),file:r.file})),i.char.forEach(r=>s.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=>s.kerning.push({first:parseInt(r.first,10),second:parseInt(r.second,10),amount:parseInt(r.amount,10)})),i.distanceField.forEach(r=>s.distanceField.push({distanceRange:parseInt(r.distanceRange,10),fieldType:r.fieldType})),s}}class $f{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 rh,i=e.getElementsByTagName("info"),s=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<s.length;l++)t.common.push({lineHeight:parseInt(s[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 Gf{static test(e){return typeof e=="string"&&e.includes("<font>")?$f.test($e.ADAPTER.parseXML(e)):!1}static parse(e){return $f.parse($e.ADAPTER.parseXML(e))}}const Dd=[Ac,$f,Gf];function x2(n){for(let e=0;e<Dd.length;e++)if(Dd[e].test(n))return Dd[e];return null}function b2(n,e,t,i,s,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=n.width/i-h-l*2,u=n.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===Zh.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<s.length;g++){const y=r.lineHeight*g;for(let w=0;w<d.length;w++){let v=0;typeof f[w]=="number"?v=f[w]:v=w/d.length;const _=y/u+v*m;let x=Math.max(p,_);x=Math.min(x,1),o.addColorStop(x,d[w]),p=x}}}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 y;typeof f[g]=="number"?y=f[g]:y=m/p,o.addColorStop(y,d[g]),m++}}return o}function w2(n,e,t,i,s,r,a){const o=t.text,h=t.fontProperties;e.translate(i,s),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=b2(n,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=Lt.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 Cc(n){return n.codePointAt?n.codePointAt(0):n.charCodeAt(0)}function b1(n){return Array.from?Array.from(n):n.split("")}function S2(n){typeof n=="string"&&(n=[n]);const e=[];for(let t=0,i=n.length;t<i;t++){const s=n[t];if(Array.isArray(s)){if(s.length!==2)throw new Error(`[BitmapFont]: Invalid character range length, expecting 2 got ${s.length}.`);const r=s[0].charCodeAt(0),a=s[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(...b1(s))}if(e.length===0)throw new Error("[BitmapFont]: Empty set when resolving characters.");return e}const hr=class Js{constructor(e,t,i){var c;const[s]=e.info,[r]=e.common,[a]=e.page,[o]=e.distanceField,h=Qn(a.file),l={};this._ownsTextures=i,this.font=s.face,this.size=s.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=Ai.NO_PREMULTIPLIED_ALPHA,l[d].baseTexture.mipmap=ws.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:y,xoffset:w,yoffset:v,xadvance:_}=e.char[u];p/=h,m/=h,g/=h,y/=h,w/=h,v/=h,_/=h;const x=new vt(p+l[f].frame.x/h,m+l[f].frame.y/h,g,y);this.chars[d]={xOffset:w,yOffset:v,xAdvance:_,kerning:{},texture:new rt(l[f].baseTexture,x),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 s;if(e instanceof rh)s=e;else{const a=x2(e);if(!a)throw new Error("Unrecognized data format for font.");s=a.parse(e)}t instanceof rt&&(t=[t]);const r=new Js(s,t,i);return Js.available[r.font]=r,r}static uninstall(e){const t=Js.available[e];if(!t)throw new Error(`No font found named '${e}'`);t.destroy(),delete Js.available[e]}static from(e,t,i){if(!e)throw new Error("[BitmapFont] Property `name` is required.");const{chars:s,padding:r,resolution:a,textureWidth:o,textureHeight:h,...l}=Object.assign({},Js.defaultOptions,i),c=S2(s),u=t instanceof Rr?t:new Rr(t),d=o,f=new rh;f.info[0]={face:u.fontFamily,size:u.fontSize},f.common[0]={lineHeight:u.fontSize};let p=0,m=0,g,y,w,v=0;const _=[];for(let M=0;M<c.length;M++){g||(g=$e.ADAPTER.createCanvas(),g.width=o,g.height=h,y=g.getContext("2d"),w=new ot(g,{resolution:a,...l}),_.push(new rt(w)),f.page.push({id:_.length-1,file:""}));const T=c[M],C=mr.measureText(T,u,!1,g),I=C.width,k=Math.ceil(C.height),R=Math.ceil((u.fontStyle==="italic"?2:1)*I);if(m>=h-k*a){if(m===0)throw new Error(`[BitmapFont] textureHeight ${h}px is too small (fontFamily: '${u.fontFamily}', fontSize: ${u.fontSize}px, char: '${T}')`);--M,g=null,y=null,w=null,m=0,p=0,v=0;continue}if(v=Math.max(k+C.fontProperties.descent,v),R*a+p>=d){if(p===0)throw new Error(`[BitmapFont] textureWidth ${o}px is too small (fontFamily: '${u.fontFamily}', fontSize: ${u.fontSize}px, char: '${T}')`);--M,m+=v*a,m=Math.ceil(m),p=0,v=0;continue}w2(g,y,C,p,m,a,u);const F=Cc(C.text);f.char.push({id:F,page:_.length-1,x:p/a,y:m/a,width:R,height:k,xoffset:0,yoffset:0,xadvance:I-(u.dropShadow?u.dropShadowDistance:0)-(u.stroke?u.strokeThickness:0)}),p+=(R+2*r)*a,p=Math.ceil(p)}if(!(i!=null&&i.skipKerning))for(let M=0,T=c.length;M<T;M++){const C=c[M];for(let I=0;I<T;I++){const k=c[I],R=y.measureText(C).width,F=y.measureText(k).width,B=y.measureText(C+k).width-(R+F);B&&f.kerning.push({first:Cc(C),second:Cc(k),amount:B})}}const x=new Js(f,_,!0);return Js.available[e]!==void 0&&Js.uninstall(e),Js.available[e]=x,x}};hr.ALPHA=[["a","z"],["A","Z"]," "],hr.NUMERIC=[["0","9"]],hr.ALPHANUMERIC=[["a","z"],["A","Z"],["0","9"]," "],hr.ASCII=[[" ","~"]],hr.defaultOptions={resolution:1,textureWidth:512,textureHeight:512,padding:4,chars:hr.ALPHANUMERIC},hr.available={};let ur=hr;var _2=`// 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
|
||
`,T2=`// 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 z0=[],q0=[],K0=[],M2=class w1 extends Oi{constructor(e,t={}){super();const{align:i,tint:s,maxWidth:r,letterSpacing:a,fontName:o,fontSize:h}=Object.assign({},w1.styleDefaults,t);if(!ur.available[o])throw new Error(`Missing BitmapFont "${o}"`);this._activePagesMeshData=[],this._textWidth=0,this._textHeight=0,this._align=i,this._tintColor=new Lt(s),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 Yn(()=>{this.dirty=!0},this,0,0),this._roundPixels=$e.ROUND_PIXELS,this.dirty=!0,this._resolution=$e.RESOLUTION,this._autoResolution=!0,this._textureCache={}}updateText(){var R;const e=ur.available[this._fontName],t=this.fontSize,i=t/e.size,s=new kt,r=[],a=[],o=[],h=this._text.replace(/(?:\r\n|\r)/g,`
|
||
`)||" ",l=b1(h),c=this._maxWidth*e.size/t,u=e.distanceFieldType==="none"?z0:q0;let d=null,f=0,p=0,m=0,g=-1,y=0,w=0,v=0,_=0;for(let F=0;F<l.length;F++){const B=l[F],L=Cc(B);if(/(?:\s)/.test(B)&&(g=F,y=f,_++),B==="\r"||B===`
|
||
`){a.push(f),o.push(-1),p=Math.max(p,f),++m,++w,s.x=0,s.y+=e.lineHeight,d=null,_=0;continue}const Y=e.chars[L];if(!Y)continue;d&&Y.kerning[d]&&(s.x+=Y.kerning[d]);const O=K0.pop()||{texture:rt.EMPTY,line:0,charCode:0,prevSpaces:0,position:new kt};O.texture=Y.texture,O.line=m,O.charCode=L,O.position.x=Math.round(s.x+Y.xOffset+this._letterSpacing/2),O.position.y=Math.round(s.y+Y.yOffset),O.prevSpaces=_,r.push(O),f=O.position.x+Math.max(Y.xAdvance-Y.xOffset,Y.texture.orig.width),s.x+=Y.xAdvance+this._letterSpacing,v=Math.max(v,Y.yOffset+Y.texture.height),d=L,g!==-1&&c>0&&s.x>c&&(++w,Ja(r,1+g-w,1+F-g),F=g,g=-1,a.push(y),o.push(r.length>0?r[r.length-1].prevSpaces:0),p=Math.max(p,y),m++,s.x=0,s.y+=e.lineHeight,d=null,_=0)}const x=l[l.length-1];x!=="\r"&&x!==`
|
||
`&&(/(?:\s)/.test(x)&&(f=y),a.push(f),p=Math.max(p,f),o.push(-1));const M=[];for(let F=0;F<=m;F++){let B=0;this._align==="right"?B=p-a[F]:this._align==="center"?B=(p-a[F])/2:this._align==="justify"&&(B=o[F]<0?0:(p-a[F])/o[F]),M.push(B)}const T=r.length,C={},I=[],k=this._activePagesMeshData;u.push(...k);for(let F=0;F<T;F++){const B=r[F].texture,L=B.baseTexture.uid;if(!C[L]){let Y=u.pop();if(!Y){const D=new Wm;let P,U;e.distanceFieldType==="none"?(P=new nh(rt.EMPTY),U=st.NORMAL):(P=new nh(rt.EMPTY,{program:fn.from(T2,_2),uniforms:{uFWidth:0}}),U=st.NORMAL_NPM);const N=new vl(D,P);N.blendMode=U,Y={index:0,indexCount:0,vertexCount:0,uvsCount:0,total:0,mesh:N,vertices:null,uvs:null,indices:null}}Y.index=0,Y.indexCount=0,Y.vertexCount=0,Y.uvsCount=0,Y.total=0;const{_textureCache:O}=this;O[L]=O[L]||new rt(B.baseTexture),Y.mesh.texture=O[L],Y.mesh.tint=this._tintColor.value,I.push(Y),C[L]=Y}C[L].total++}for(let F=0;F<k.length;F++)I.includes(k[F])||this.removeChild(k[F].mesh);for(let F=0;F<I.length;F++)I[F].mesh.parent!==this&&this.addChild(I[F].mesh);this._activePagesMeshData=I;for(const F in C){const B=C[F],L=B.total;if(!(((R=B.indices)==null?void 0:R.length)>6*L)||B.vertices.length<vl.BATCHABLE_SIZE*2)B.vertices=new Float32Array(8*L),B.uvs=new Float32Array(8*L),B.indices=new Uint16Array(6*L);else{const Y=B.total,O=B.vertices;for(let D=Y*4*2;D<O.length;D++)O[D]=0}B.mesh.size=6*L}for(let F=0;F<T;F++){const B=r[F];let L=B.position.x+M[B.line]*(this._align==="justify"?B.prevSpaces:1);this._roundPixels&&(L=Math.round(L));const Y=L*i,O=B.position.y*i,D=B.texture,P=C[D.baseTexture.uid],U=D.frame,N=D._uvs,X=P.index++;P.indices[X*6+0]=0+X*4,P.indices[X*6+1]=1+X*4,P.indices[X*6+2]=2+X*4,P.indices[X*6+3]=0+X*4,P.indices[X*6+4]=2+X*4,P.indices[X*6+5]=3+X*4,P.vertices[X*8+0]=Y,P.vertices[X*8+1]=O,P.vertices[X*8+2]=Y+U.width*i,P.vertices[X*8+3]=O,P.vertices[X*8+4]=Y+U.width*i,P.vertices[X*8+5]=O+U.height*i,P.vertices[X*8+6]=Y,P.vertices[X*8+7]=O+U.height*i,P.uvs[X*8+0]=N.x0,P.uvs[X*8+1]=N.y0,P.uvs[X*8+2]=N.x1,P.uvs[X*8+3]=N.y1,P.uvs[X*8+4]=N.x2,P.uvs[X*8+5]=N.y2,P.uvs[X*8+6]=N.x3,P.uvs[X*8+7]=N.y3}this._textWidth=p*i,this._textHeight=(s.y+e.lineHeight)*i;for(const F in C){const B=C[F];if(this.anchor.x!==0||this.anchor.y!==0){let D=0;const P=this._textWidth*this.anchor.x,U=this._textHeight*this.anchor.y;for(let N=0;N<B.total;N++)B.vertices[D++]-=P,B.vertices[D++]-=U,B.vertices[D++]-=P,B.vertices[D++]-=U,B.vertices[D++]-=P,B.vertices[D++]-=U,B.vertices[D++]-=P,B.vertices[D++]-=U}this._maxLineHeight=v*i;const L=B.mesh.geometry.getBuffer("aVertexPosition"),Y=B.mesh.geometry.getBuffer("aTextureCoord"),O=B.mesh.geometry.getIndex();L.data=B.vertices,Y.data=B.uvs,O.data=B.indices,L.update(),Y.update(),O.update()}for(let F=0;F<r.length;F++)K0.push(r[F]);this._font=e,this.dirty=!1}updateTransform(){this.validate(),this.containerUpdateTransform()}_render(e){this._autoResolution&&this._resolution!==e.resolution&&(this._resolution=e.resolution,this.dirty=!0);const{distanceFieldRange:t,distanceFieldType:i,size:s}=ur.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/s,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=ur.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(!ur.available[e])throw new Error(`Missing BitmapFont "${e}"`);this._fontName!==e&&(this._fontName=e,this.dirty=!0)}get fontSize(){return this._fontSize??ur.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=ur.available[this._fontName].distanceFieldType==="none"?z0:q0;i.push(...this._activePagesMeshData);for(const s of this._activePagesMeshData)this.removeChild(s.mesh);this._activePagesMeshData=[],i.filter(s=>t[s.mesh.texture.baseTexture.uid]).forEach(s=>{s.mesh.texture=rt.EMPTY});for(const s in t)t[s].destroy(),delete t[s];this._font=null,this._tintColor=null,this._textureCache=null,super.destroy(e)}};M2.styleDefaults={align:"left",tint:16777215,maxWidth:0,letterSpacing:0};const E2=[".xml",".fnt"],A2={extension:{type:Xe.LoadParser,priority:ds.Normal},name:"loadBitmapFont",test(n){return E2.includes(li.extname(n).toLowerCase())},async testParse(n){return Ac.test(n)||Gf.test(n)},async parse(n,e,t){const i=Ac.test(n)?Ac.parse(n):Gf.parse(n),{src:s}=e,{page:r}=i,a=[];for(let l=0;l<r.length;++l){const c=r[l].file;let u=li.join(li.dirname(s),c);u=Qc(u,s),a.push(u)}const o=await t.load(a),h=a.map(l=>o[l]);return ur.install(i,h,!0)},async load(n,e){return(await $e.ADAPTER.fetch(n)).text()},unload(n){n.destroy()}};ze.add(A2);const Hf=class Ya extends Rr{constructor(){super(...arguments),this._fonts=[],this._overrides=[],this._stylesheet="",this.fontsDirty=!1}static from(e){return new Ya(Object.keys(Ya.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 Ya.availableFonts[e.originalUrl])}),this.fontFamily="Arial",this._fonts.length=0,this.styleID++,this.fontsDirty=!0)}loadFont(e,t={}){const{availableFonts:i}=Ya;if(i[e]){const s=i[e];return this._fonts.push(s),s.refs++,this.styleID++,this.fontsDirty=!0,Promise.resolve()}return $e.ADAPTER.fetch(e).then(s=>s.blob()).then(async s=>new Promise((r,a)=>{const o=URL.createObjectURL(s),h=new FileReader;h.onload=()=>r([o,h.result]),h.onerror=a,h.readAsDataURL(s)})).then(async([s,r])=>{const a=Object.assign({family:li.basename(e,li.extname(e)),weight:"normal",style:"normal",display:"auto",src:s,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=vM(e)),typeof e=="number"?gM(e):e}dropShadowToCSS(){let e=this.normalizeColor(this.dropShadowColor);const t=this.dropShadowAlpha,i=Math.round(Math.cos(this.dropShadowAngle)*this.dropShadowDistance),s=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 ${s}px`;return this.dropShadowBlur>0?`text-shadow: ${r} ${this.dropShadowBlur}px ${e}`:`text-shadow: ${r} ${e}`}reset(){Object.assign(this,Ya.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}=$e.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}};Hf.availableFonts={},Hf.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 Nd=Hf;const rc=class Va extends Fr{constructor(e="",t={}){super(rt.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,s=rt.from(i,{scaleMode:$e.SCALE_MODE,resourceOptions:{autoLoad:!1}});s.orig=new vt,s.trim=new vt,this.texture=s;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=Va.defaultMaxWidth,this.maxHeight=Va.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=Va.defaultAutoResolution,this._resolution=Va.defaultResolution??$e.RESOLUTION,this.text=e,this.style=t}measureText(e){var c,u;const{text:t,style:i,resolution:s}=Object.assign({text:this._text,style:this._style,resolution:this._resolution},e);Object.assign(this._domElement,{innerHTML:t,style:i.toCSS(s)}),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(s)}),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:s}=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=s.width=Math.ceil(Math.max(1,r)),i.height=s.height=Math.ceil(Math.max(1,a)),this._updateID++;const o=this._updateID;await new Promise(h=>{s.onload=async()=>{if(o<this._updateID){h();return}await t.onBeforeDraw(),i.src=s.src,s.onload=null,s.src="",this.updateTexture(),h()};const l=new XMLSerializer().serializeToString(this._svgRoot);s.src=`data:image/svg+xml;charset=utf8,${encodeURIComponent(l)}`})}get source(){return this._image}updateTexture(){const{style:e,texture:t,_image:i,resolution:s}=this,{padding:r}=e,{baseTexture:a}=t;t.trim.width=t._frame.width=i.width/s,t.trim.height=t._frame.height=i.height/s,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,s),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,s,r,a,o;typeof e=="boolean"&&(e={children:e}),e=Object.assign({},Va.defaultDestroyOptions,e),super.destroy(e);const t=null;this.ownsStyle&&((i=this._style)==null||i.cleanFonts()),this._style=t,(s=this._svgRoot)==null||s.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=_r(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=_r(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 Nd?(this.ownsStyle=!1,this._style=e):e instanceof Rr?(console.warn("[HTMLText] Cloning TextStyle, if this is not what you want, use HTMLTextStyle"),this.ownsStyle=!0,this._style=Nd.from(e)):(this.ownsStyle=!0,this._style=new Nd(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," ")}};rc.defaultDestroyOptions={texture:!0,children:!1,baseTexture:!0},rc.defaultMaxWidth=2024,rc.defaultMaxHeight=2024,rc.defaultAutoResolution=!0;function yl(){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",radius:30,rectW:60,rectH:40,centerX:0,centerY:0,rootRotation:0,rootScaleX:1,rootScaleY:1,direction:0,spread:360,coneAngle:60,lifeMin:.6,lifeMax:1.8,lifeMode:"random",lifeCurve:[{x:0,y:0},{x:1,y:1}],speedMin:30,speedMax:140,speedMode:"random",speedCurve:[{x:0,y:0},{x:1,y:1}],scaleMin:.3,scaleMax:.8,scaleMode:"random",scaleAxisMode:"uniform",scaleYMin:.3,scaleYMax:.8,scaleCurve:[{x:0,y:0},{x:1,y:1}],scaleYCurve:[{x:0,y:0},{x:1,y:1}],scaleEndRatio:.3,initialRotationMode:"random",initialRotationMin:0,initialRotationMax:360,initialRotationCurve:[{x:0,y:0},{x:1,y:1}],alpha:.9,alphaEnd:0,rotationSpeedMin:-180,rotationSpeedMax:180,speedOverLifeEnabled:!1,speedOverLifeMode:"fixed",speedOverLifeMin:1,speedOverLifeMax:1,speedOverLifeCurve:[{x:0,y:1},{x:1,y:1}],scaleOverLifeEnabled:!1,scaleOverLifeMode:"curve",scaleOverLifeAxisMode:"uniform",scaleOverLifeMin:0,scaleOverLifeMax:1,scaleYOverLifeMin:0,scaleYOverLifeMax:1,scaleOverLifeCurve:[{x:0,y:1},{x:1,y:1}],scaleYOverLifeCurve:[{x:0,y:1},{x:1,y:1}],rotationOverLifeEnabled:!1,rotationOverLifeMode:"random",rotationOverLifeCurve:[{x:0,y:0},{x:1,y:1}],gravity:980,gravityMode:"fixed",gravityMin:980,gravityMax:980,gravityDirection:-90,gravityCurve:[{x:0,y:1},{x:1,y:1}],damping:0,seed:0,colorStart:"#ffffff",colorEnd:"#ff4d4d",colorOverLife:!1,blend:"add",alphaMode:"curve",curveMode:"线性",alphaCurve:[{x:0,y:0},{x:.2,y:1},{x:.8,y:1},{x:1,y:0}],textureName:"star",textureFolder:"",alphaScale:1,anchorX:.5,anchorY:.5,independentAlpha:"off",offsetX:0,offsetY:0,noise:!1,noiseAmt:30,noiseRange:100,noiseSpeed:1,useGravity:!1,wind:!1,windX:0,windY:0,windMode:"fixed",windMin:100,windMax:100,windDirection:0,windCurve:[{x:0,y:1},{x:1,y:1}],forceField:!1,forceStrength:10,forceRadius:100,forceCenterX:0,forceCenterY:0,forceFalloff:"linear",attraction:!1,attractionCenterX:200,attractionCenterY:0,attractionRadius:20,attractionDuration:.5,attractionDelay:.1,attractionDelayMode:"particle",attractionPath:"curve",trail:!1,trailConfigVersion:3,trailResources:[{id:1,texture:null,textureName:"trail",previewUrl:"/images/trail.png",weight:100,locked:!1,rotation:0,colorMode:"particle",color:"#ffffff",colorGradient:[{position:0,color:"#ffffff"},{position:1,color:"#ffffff"}],blend:"normal",alphaMode:"particle",alpha:1,alphaCurve:[{x:0,y:1},{x:1,y:1}],boneCount:3,trailRatio:100,lengthMode:"fixed",length:100,lengthMin:100,lengthMax:100,widthSizeMode:"fixed",width:100,widthMin:100,widthMax:100,widthMode:"particle",lifeLengthEnabled:!1,lifeLengthCurve:[{x:0,y:1},{x:1,y:1}],shapeEnabled:!1,shapeCurve:[{x:0,y:1},{x:1,y:1}]}],trailResourceVersion:6,trailTexture:null,trailTextureName:"trail",trailPreviewUrl:"/images/trail.png",trailColorMode:"particle",trailColor:"#ffffff",trailColorGradient:[{position:0,color:"#ffffff"},{position:1,color:"#ffffff"}],trailAlphaMode:"particle",trailAlpha:1,trailAlphaCurve:[{x:0,y:1},{x:1,y:1}],trailBoneCount:3,trailLength:100,trailWidth:100,trailWidthMode:"particle",trailLifeLengthEnabled:!1,trailLifeLengthCurve:[{x:0,y:1},{x:1,y:1}],trailShapeEnabled:!1,trailShapeCurve:[{x:0,y:1},{x:1,y:1}],trailGridRows:4,trailGridCols:4,collision:!1,pathFollow:!1,emitterFollow:!1,emitterFollowMode:"none",emitterFollowPathId:0,emitterFollowSpineId:0,emitterFollowBoneName:"",emitterFollowBoneOffsetX:0,emitterFollowBoneOffsetY:0,emitterFollowBoneRotation:0,emitterFollowBoneScaleX:1,emitterFollowBoneScaleY:1,emitterAngleMode:"fixed",emitterFollowCurve:[{x:0,y:0},{x:1,y:1}],emitterFollowDuration:2,emitterFollowSpace:"world",emitterFollowDirection:"forward",emitterFollowOffset:0}}function ma(n){var w;const e=yl(),t=n,i=t.imageWeightVersion!==1,s=t.loopDurationFrames==null,r=t.gravityMode==null,a=Number(t.gravity),o=t.windMode==null,h=Number(t.windX),l=Number(t.windY),c=t.forceFalloff==null,u=Number(t.forceStrength),d=t.trailConfigVersion!==3,f=!Array.isArray(t.trailResources),p=t.trailResourceVersion!==6,m=t.trailTexture,g=String(t.trailTextureName||"trail"),y=String(t.trailPreviewUrl||"/images/trail.png").replace("/trails/trail.png","/images/trail.png");for(const[v,_]of Object.entries(e))t[v]!==void 0&&t[v]!==null||(t[v]=Array.isArray(_)?_.map(x=>typeof x=="object"&&x!==null?{...x}:x):_);n.streamBehavior!=="normal"&&n.streamBehavior!=="loop"&&(n.streamBehavior="normal"),(s||!Number.isFinite(n.loopDurationFrames))&&(n.loopDurationFrames=Math.ceil(Math.max(1/30,Number(n.duration)||1)*30)),n.loopDurationFrames=Math.min(1800,Math.max(1,Math.ceil(n.loopDurationFrames))),typeof n.generateLoopStartAnimation!="boolean"&&(n.generateLoopStartAnimation=!1),typeof n.generateLoopEndAnimation!="boolean"&&(n.generateLoopEndAnimation=!1),typeof n.loopStartUseCustomDuration!="boolean"&&(n.loopStartUseCustomDuration=!1),typeof n.loopEndUseCustomDuration!="boolean"&&(n.loopEndUseCustomDuration=!1),n.loopStartDurationFrames=Math.min(1800,Math.max(1,Math.ceil(Number(n.loopStartDurationFrames)||30))),n.loopEndDurationFrames=Math.min(1800,Math.max(1,Math.ceil(Number(n.loopEndDurationFrames)||30))),(!Array.isArray(n.imageResources)||n.imageResources.length===0)&&(n.imageResources=yl().imageResources);for(const v of n.imageResources){!v.texture&&n.texture&&(v.texture=n.texture),v.textureName||(v.textureName="star"),v.previewUrl==="/particles/star.png"&&(v.previewUrl="/images/star.png"),v.previewUrl||(v.previewUrl=v.textureName==="star"?"/images/star.png":""),v.imageMode!=="fixed"&&v.imageMode!=="sequence"&&(v.imageMode="fixed"),v.sequencePlayback==="once"?v.sequencePlayback="once-hold":v.sequencePlayback==="loop"?v.sequencePlayback="loop-forward":["once-hide","once-hold","loop-forward","loop-reverse"].includes(v.sequencePlayback)||(v.sequencePlayback="loop-forward"),Number.isFinite(v.sequenceFps)||(v.sequenceFps=30),v.sequenceFps=Math.min(120,Math.max(1,Number(v.sequenceFps)||30)),Array.isArray(v.sequenceFrames)||(v.sequenceFrames=[]);for(const _ of v.sequenceFrames)typeof _.name!="string"&&(_.name=""),typeof _.previewUrl!="string"&&(_.previewUrl=""),_.texture===void 0&&(_.texture=null);Number.isFinite(v.weight)||(v.weight=100),typeof v.locked!="boolean"&&(v.locked=!1),Number.isFinite(v.scale)||(v.scale=1),Number.isFinite(v.anchorX)||(v.anchorX=.5),Number.isFinite(v.anchorY)||(v.anchorY=.5),v.colorMode!=="fixed"&&v.colorMode!=="random"&&v.colorMode!=="lifetime"&&(v.colorMode=n.colorOverLife?"lifetime":"fixed"),v.colorStart||(v.colorStart=n.colorStart||"#ffffff"),v.colorEnd||(v.colorEnd=n.colorEnd||v.colorStart),(!Array.isArray(v.colorGradient)||v.colorGradient.length<2)&&(v.colorGradient=[{position:0,color:v.colorStart},{position:1,color:v.colorEnd}]),Object.prototype.hasOwnProperty.call(pr,v.blend)||(v.blend=n.blend||"normal"),["off","fixed","curve"].includes(v.independentAlpha)||(v.independentAlpha=n.independentAlpha||"off"),Number.isFinite(v.alpha)||(v.alpha=Number.isFinite(n.alphaScale)?n.alphaScale:1),["跟随导出","线性","贝塞尔"].includes(v.alphaCurveMode)||(v.alphaCurveMode=n.curveMode||"跟随导出"),(!Array.isArray(v.alphaCurve)||v.alphaCurve.length<2)&&(v.alphaCurve=(n.alphaCurve||[{x:0,y:1},{x:1,y:1}]).map(_=>({..._})))}if(n.imageResources.length===1)n.imageResources[0].weight=100,n.imageResources[0].locked=!1;else if(i){const v=100/n.imageResources.length;n.imageResources.forEach((_,x)=>{_.weight=x===n.imageResources.length-1?100-v*(n.imageResources.length-1):v,_.locked=!1})}if(n.imageWeightVersion=1,r){const v=Number.isFinite(a)&&a!==0?a:980;n.gravity=v,n.gravityMin=v,n.gravityMax=v}if(o){const v=Number.isFinite(h)&&Number.isFinite(l)&&(h!==0||l!==0);n.windMin=v?Math.hypot(h,l):100,n.windMax=n.windMin,n.windDirection=v?Math.atan2(-l,h)*180/Math.PI:0}c&&(n.forceStrength=Number.isFinite(u)&&u!==0?u:10),d&&(n.trailConfigVersion=3,n.trailAlphaCurve=[{x:0,y:1},{x:1,y:1}],n.trailLifeLengthCurve=[{x:0,y:1},{x:1,y:1}],n.trailShapeCurve=[{x:0,y:1},{x:1,y:1}],n.trailGridRows=4,n.trailGridCols=4),(f||!n.trailResources.length)&&(n.trailResources=[{id:1,texture:m||null,textureName:g,previewUrl:y,weight:100,locked:!1,rotation:0,colorMode:n.trailColorMode,color:n.trailColor,colorGradient:n.trailColorGradient.map(v=>({...v})),blend:"normal",alphaMode:n.trailAlphaMode,alpha:n.trailAlpha,alphaCurve:n.trailAlphaCurve.map(v=>({...v})),boneCount:n.trailBoneCount,trailRatio:100,lengthMode:"fixed",length:n.trailLength,lengthMin:n.trailLength,lengthMax:n.trailLength,widthSizeMode:"fixed",width:n.trailWidth,widthMin:n.trailWidth,widthMax:n.trailWidth,widthMode:n.trailWidthMode,lifeLengthEnabled:n.trailLifeLengthEnabled,lifeLengthCurve:n.trailLifeLengthCurve.map(v=>({...v})),shapeEnabled:n.trailShapeEnabled,shapeCurve:n.trailShapeCurve.map(v=>({...v}))}]);for(const v of n.trailResources)v.textureName||(v.textureName="trail"),v.previewUrl==="/trails/trail.png"&&(v.previewUrl="/images/trail.png"),v.previewUrl||(v.previewUrl="/images/trail.png"),Number.isFinite(v.weight)||(v.weight=100),typeof v.locked!="boolean"&&(v.locked=!1),Number.isFinite(v.rotation)||(v.rotation=0),["particle","fixed","curve"].includes(v.colorMode)||(v.colorMode=n.trailColorMode||"particle"),v.color||(v.color=n.trailColor||"#ffffff"),(!Array.isArray(v.colorGradient)||v.colorGradient.length<2)&&(v.colorGradient=(n.trailColorGradient||[{position:0,color:"#ffffff"},{position:1,color:"#ffffff"}]).map(_=>({..._}))),Object.prototype.hasOwnProperty.call(pr,v.blend)||(v.blend="normal"),["particle","fixed","curve"].includes(v.alphaMode)||(v.alphaMode=n.trailAlphaMode||"particle"),Number.isFinite(v.alpha)||(v.alpha=Number.isFinite(n.trailAlpha)?n.trailAlpha:1),(!Array.isArray(v.alphaCurve)||v.alphaCurve.length<2)&&(v.alphaCurve=(n.trailAlphaCurve||[{x:0,y:1},{x:1,y:1}]).map(_=>({..._}))),Number.isFinite(v.boneCount)||(v.boneCount=Number.isFinite(n.trailBoneCount)?n.trailBoneCount:3),Number.isFinite(v.trailRatio)||(v.trailRatio=100),v.trailRatio=Math.min(100,Math.max(0,v.trailRatio)),["fixed","random"].includes(v.lengthMode)||(v.lengthMode="fixed"),Number.isFinite(v.length)||(v.length=Number.isFinite(n.trailLength)?n.trailLength:100),Number.isFinite(v.lengthMin)||(v.lengthMin=v.length),Number.isFinite(v.lengthMax)||(v.lengthMax=v.length),["fixed","random"].includes(v.widthSizeMode)||(v.widthSizeMode="fixed"),Number.isFinite(v.width)||(v.width=Number.isFinite(n.trailWidth)?n.trailWidth:100),Number.isFinite(v.widthMin)||(v.widthMin=v.width),Number.isFinite(v.widthMax)||(v.widthMax=v.width),["particle","fixed"].includes(v.widthMode)||(v.widthMode=n.trailWidthMode||"particle"),typeof v.lifeLengthEnabled!="boolean"&&(v.lifeLengthEnabled=!!n.trailLifeLengthEnabled),(!Array.isArray(v.lifeLengthCurve)||v.lifeLengthCurve.length<2)&&(v.lifeLengthCurve=(n.trailLifeLengthCurve||[{x:0,y:1},{x:1,y:1}]).map(_=>({..._}))),typeof v.shapeEnabled!="boolean"&&(v.shapeEnabled=!!n.trailShapeEnabled),(!Array.isArray(v.shapeCurve)||v.shapeCurve.length<2)&&(v.shapeCurve=(n.trailShapeCurve||[{x:0,y:1},{x:1,y:1}]).map(_=>({..._})));if(n.trailResources.length===1&&(n.trailResources[0].weight=100,n.trailResources[0].locked=!1),p)for(const v of n.trailResources)v.alphaCurve=((w=v.alphaCurve)==null?void 0:w.length)>=2?v.alphaCurve:[{x:0,y:1},{x:1,y:1}];return n.trailResourceVersion=6,n}const pr={normal:0,add:1,multiply:2,screen:3},C2=400;class I2 extends Oi{constructor(t,i=C2){super();b(this,"pool",[]);b(this,"cfg");b(this,"accumulator",0);b(this,"burstTimer",0);b(this,"_spawnSerial",0);b(this,"_elapsed",0);b(this,"_attractionEnabledAt",0);b(this,"_attractionWasEnabled",!1);b(this,"_emitterPos",null);b(this,"states",[]);b(this,"rng",Math.random);b(this,"_lastSeed",-1);b(this,"trailDebugGfx",new is);b(this,"colliders",[]);b(this,"followSpawnX",0);b(this,"followSpawnY",0);b(this,"followSpawnAngle",0);b(this,"followExportCurveMode","线性");b(this,"simulationTransform",null);this.cfg=ma(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=Xd(t>>>0))}_ensurePool(t){for(;this.pool.length<t;){const i=this.pool.length,s=new Fr(this.cfg.texture);s.blendMode=pr[this.cfg.blend],s.anchor.set(.5),s.visible=!1,this.addChild(s),this.pool.push({sprite:s,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}setColliders(t){this.colliders=t}setEmitterFollowSpawn(t,i,s){this.followSpawnX=t,this.followSpawnY=i,this.followSpawnAngle=s}setSimulationTransform(t,i,s,r,a){this.simulationTransform={centerX:t,centerY:i,rotation:s,scaleX:r,scaleY:a}}applyColliders(t,i){if(!this.colliders.length)return!1;const s=this.cfg;let r=Pa(s,t.x,t.y,this.simulationTransform),a=R2(s,t.vx,t.vy,this.simulationTransform);for(const o of this.colliders){if(!o.enabled)continue;const h=k2(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=Z0(s,r.x,r.y,this.simulationTransform),c=P2(s,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 s=this.cfg;if((s.lifeMode==null||s.speedMode==null||s.scaleMode==null||s.initialRotationMode==null||s.speedOverLifeEnabled==null||s.scaleOverLifeEnabled==null||s.rotationOverLifeEnabled==null||!Array.isArray(s.scaleOverLifeCurve)||s.attraction==null||s.trailBoneCount==null)&&ma(s),this.reseed(),this._elapsed+=t,s.attraction&&!this._attractionWasEnabled){this._attractionEnabledAt=this._elapsed;for(const p of this.pool)p.attractionActive=!1,p.attractionElapsed=0}else if(!s.attraction&&this._attractionWasEnabled)for(const p of this.pool)p.attractionActive=!1;this._attractionWasEnabled=s.attraction;const r=i==="force"||i==="normal"&&(s.delay<=0||this._elapsed>=s.delay),a=i==="force"||i==="normal"&&(s.mode==="burst"||this._elapsed<s.delay+Math.max(1/30,s.duration));if(r&&a)if(s.mode==="stream")for(this.accumulator+=t*s.rate;this.accumulator>=1;)this.accumulator-=1,this.spawnOne();else this.burstTimer+=t,s.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=F2(m);if(!m.collisionPaused&&s.useGravity){const P=Math.min(1,Math.max(0,tn(s.gravityCurve,g))),U=(s.gravityMode==="random"?m.gravityStrength:s.gravityMin)*P,N=s.gravityDirection*Math.PI/180;m.vx+=Math.cos(N)*U*t,m.vy+=-Math.sin(N)*U*t}if(!m.collisionPaused&&s.wind){const P=Math.min(1,Math.max(0,tn(s.windCurve,g))),U=(s.windMode==="random"?m.windStrength:s.windMin)*P,N=s.windDirection*Math.PI/180;m.vx+=Math.cos(N)*U*t,m.vy+=-Math.sin(N)*U*t}if(!m.collisionPaused&&s.forceField&&s.forceStrength!==0&&s.forceRadius>0){const P=Math.max(1e-4,Math.abs(s.rootScaleX)),U=Math.max(1e-4,Math.abs(s.rootScaleY)),N=-(((h=this.simulationTransform)==null?void 0:h.rotation)??s.rootRotation)*Math.PI/180,X=Math.cos(N),K=Math.sin(N),z=((l=this.simulationTransform)==null?void 0:l.centerX)??s.centerX,se=((c=this.simulationTransform)==null?void 0:c.centerY)??s.centerY,Q=z+X*P*m.x-K*U*m.y,me=-se+K*P*m.x+X*U*m.y,pe=Q,Me=-me,Ie=s.forceCenterX-pe,ge=s.forceCenterY-Me,Ee=Math.hypot(Ie,ge);if(Ee>1e-4&&Ee<=s.forceRadius){let H=1;s.forceFalloff==="linear"?H=1-Ee/s.forceRadius:s.forceFalloff==="inverse"&&(H=Math.min(10,s.forceRadius/Math.max(Ee,s.forceRadius*.1)));const Z=s.forceStrength*H*10,q=Ie/Ee*Z,W=ge/Ee*Z,ee=q,ce=-W;m.vx+=(X*ee+K*ce)/P*t,m.vy+=(-K*ee+X*ce)/U*t}}if(!m.collisionPaused&&s.damping>0){const P=Math.max(0,1-s.damping*t);m.vx*=P,m.vy*=P}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(s.attraction&&!m.collisionPaused){const P=m.maxLife-m.life;if(s.attractionDelayMode==="particle"?P>=Math.max(0,s.attractionDelay):this._elapsed-this._attractionEnabledAt>=Math.max(0,s.attractionDelay)){const N=Pa(s,m.x,m.y,this.simulationTransform),X=s.attractionCenterX,K=s.attractionCenterY,z=Math.max(0,s.attractionRadius);if(!m.attractionActive){if(Math.hypot(X-N.x,K-N.y)<=z){this.kill(p);continue}m.attractionActive=!0,m.attractionElapsed=0,m.attractionStartWorldX=N.x,m.attractionStartWorldY=N.y}m.attractionElapsed+=t;const se=Math.max(1e-4,s.attractionDuration),Q=Math.min(1,m.attractionElapsed/se);let me=bi(m.attractionStartWorldX,X,Q),pe=bi(m.attractionStartWorldY,K,Q);if(s.attractionPath==="curve"){const ge=X-m.attractionStartWorldX,Ee=K-m.attractionStartWorldY,H=Math.hypot(ge,Ee);if(H>1e-4){const Z=H*.25*m.attractionCurveSide,q=(m.attractionStartWorldX+X)*.5-Ee/H*Z,W=(m.attractionStartWorldY+K)*.5+ge/H*Z,ee=1-Q;me=ee*ee*m.attractionStartWorldX+2*ee*Q*q+Q*Q*X,pe=ee*ee*m.attractionStartWorldY+2*ee*Q*W+Q*Q*K}}const Me=Math.hypot(X-me,K-pe);if(Q>=1||Me<=z){this.kill(p);continue}const Ie=Z0(s,me,pe,this.simulationTransform);m.x=Ie.x,m.y=Ie.y,m.vx=0,m.vy=0}}const y=g,w=m.sprite,v=s.imageResources.find(P=>P.id===m.resourceId);if(v){const P=this.imageFrameState(v,m.maxLife-m.life);m.imageFrameIndex=P.index,w.texture=this.imageFrameTexture(v,m.imageFrameIndex),w.visible=P.visible}if(s.speedOverLifeEnabled){const P=ac(Ud(s.speedOverLifeMode,s.speedOverLifeMin,s.speedOverLifeMax,s.speedOverLifeCurve,y,m.speedScaleTarget),1),U=m.speedScale===0?P:P/m.speedScale;m.vx*=U,m.vy*=U,m.speedScale=P}let _=m.rotationSpeed;s.rotationOverLifeEnabled&&s.rotationOverLifeMode==="curve"&&(_=bi(s.rotationSpeedMin,s.rotationSpeedMax,tn(s.rotationOverLifeCurve,y))),m.rotation+=_*t;let x=m.x,M=m.y;if(s.noise&&s.noiseAmt>0&&s.noiseRange>0&&s.noiseSpeed>0){const P=m.maxLife-m.life,U=Math.max(0,s.noiseRange)*Math.min(1,Math.max(0,s.noiseAmt)/100)*.5,N=P*Math.max(0,s.noiseSpeed)*Math.PI*2;x+=(Math.sin(m.noisePhaseX+N)-Math.sin(m.noisePhaseX))*U,M+=(Math.sin(m.noisePhaseY+N*.83)-Math.sin(m.noisePhaseY))*U}w.x=x,w.y=M,w.rotation=-m.rotation*Math.PI/180;let T=1,C=1;s.scaleOverLifeEnabled&&(T=Ud(s.scaleOverLifeMode,s.scaleOverLifeMin,s.scaleOverLifeMax,s.scaleOverLifeCurve,y,m.scaleOverLifeX),C=s.scaleOverLifeAxisMode==="separate"?Ud(s.scaleOverLifeMode,s.scaleYOverLifeMin,s.scaleYOverLifeMax,s.scaleYOverLifeCurve,y,m.scaleOverLifeY):T),w.scale.set(ac(m.scaleStartX*T,1),ac(m.scaleStartY*C,1));const I=s.alphaMode==="curve"?tn(s.alphaCurve,y,this.resolveCurveMode(s.curveMode))*s.alphaScale:s.alpha*s.alphaScale;w.alpha=ac((v==null?void 0:v.independentAlpha)==="fixed"?v.alpha:(v==null?void 0:v.independentAlpha)==="curve"?tn(v.alphaCurve,y,this.resolveCurveMode(v.alphaCurveMode)):I,1);const k=(v==null?void 0:v.colorStart)||"#ffffff",R=(v==null?void 0:v.colorMode)==="lifetime"?Yd(v.colorGradient,y):(v==null?void 0:v.colorMode)==="random"?m.colorSample:so(k);w.tint=R,w.blendMode=pr[(v==null?void 0:v.blend)||"normal"];const F=this.updateTrail(m,x,M,y,w),B=Pa(s,x,M,this.simulationTransform),L=((u=this.simulationTransform)==null?void 0:u.rotation)??s.rootRotation,Y=Math.abs(((d=this.simulationTransform)==null?void 0:d.scaleX)??s.rootScaleX),O=Math.abs(((f=this.simulationTransform)==null?void 0:f.scaleY)??s.rootScaleY),D=F?{...F,bones:F.bones.map(P=>{const U=Pa(s,P.x,P.y,this.simulationTransform);return{...P,worldX:U.x,worldY:U.y,worldRotation:L-P.rotation}})}:void 0;o.push({boneName:m.boneName,spawnId:m.spawnId,x,y:M,rotation:m.rotation,scaleX:w.scale.x,scaleY:w.scale.y,worldX:B.x,worldY:B.y,worldRotation:L+m.rotation,worldScaleX:w.scale.x*Y,worldScaleY:w.scale.y*O,alpha:w.alpha,colorHex:R,resourceId:m.resourceId,imageFrameIndex:m.imageFrameIndex,imageVisible:w.visible,trailState:D,active:!0})}return this.states=o,o}ensureTrailMesh(t){const i=this.cfg,s=i.trailResources.find(g=>g.id===t.trailResourceId)||i.trailResources[0],r=(s==null?void 0:s.texture)||rt.EMPTY,a=Number(s==null?void 0:s.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((s==null?void 0:s.boneCount)??3))),c=`${o}:${h}:${l}:${(s==null?void 0:s.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 y=g/(h-1),w=y*(l-1),v=Math.min(l-1,Math.floor(w)),_=Math.min(l-1,v+1),x=w-v;for(let M=0;M<o;M++){const T=g*o+M,C=y,I=M/(o-1),k=a*Math.PI/180,R=Math.cos(k),F=Math.sin(k);d[T*2]=.5+R*(C-.5)-F*(I-.5),d[T*2+1]=.5+F*(C-.5)+R*(I-.5),p.push({boneA:v,boneB:_,weight:x})}}for(let g=0;g<h-1;g++)for(let y=0;y<o-1;y++){const w=g*o+y,v=(g+1)*o+y,_=w+1,x=v+1;f.push(w,v,_,v,x,_)}const m=new ZC(r,u,d,new Uint16Array(f));return m.visible=!1,m.blendMode=pr.normal,this.addChildAt(m,Math.max(0,this.getChildIndex(t.sprite))),t.trailMesh=m,t.trailMeshSignature=c,t.trailSkinWeights=p,m}appendTrailPoint(t,i,s,r){const a=t.trailHistory[0];!a||Math.hypot(a.x-i,a.y-s)>.05?t.trailHistory.unshift({x:i,y:s}):(a.x=i,a.y=s);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,s){const r=Math.max(2,Math.min(16,Math.round(s))),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],y=Math.hypot(g.x-m.x,g.y-m.y);if(d+y>=u&&y>1e-4){const w=(u-d)/y;f={x:bi(m.x,g.x,w),y:bi(m.y,g.y,w)};break}d+=y}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 s=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){s.visible=!1;return}t.trailResourceId=a.id,s.texture!==a.texture&&(s.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=s.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:bi(f.x,p.x,d.weight),y:bi(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)),y=-m/g,w=p/g,v=u/(h-1),_=a.shapeEnabled?Math.max(0,tn(a.shapeCurve,v)):1;for(let x=0;x<o;x++){const T=(x/(o-1)-.5)*i.width*_,C=(u*o+x)*2;l[C]=c[u].x+y*T,l[C+1]=c[u].y+w*T}}s.tint=i.colorHex,s.alpha=i.alpha,s.blendMode=pr[a.blend],s.visible=Math.hypot(c[0].x-c[h-1].x,c[0].y-c[h-1].y)>.5&&i.alpha>0}updateTrail(t,i,s,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,s,t.trailSampledLength);const l=h!=null&&h.lifeLengthEnabled?Math.max(0,tn(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=s);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"?tn(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"?Yd(h.colorGradient,r):so((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 s=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*s+u)*2;return{x:h[d],y:h[d+1]}};for(let c=0;c<s;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<s;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<s;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,s=t.offsetY;s=-s;const r=t.shape;if(r==="circle"){const a=this.rng()*Math.PI*2,o=this.rng()*t.radius;return this.applyFollowToOrigin(i+Math.cos(a)*o,s+Math.sin(a)*o)}else{if(r==="rect")return this.applyFollowToOrigin(i+(this.rng()-.5)*t.rectW,s+(this.rng()-.5)*t.rectH);if(r==="cone")return this.applyFollowToOrigin(i,s)}return this.applyFollowToOrigin(i,s)}applyFollowToOrigin(t,i){const s=this.followSpawnAngle*Math.PI/180,r=Math.cos(s),a=Math.sin(s);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(v=>!v.active);if(i===-1)return;const{x:s,y:r}=this.spawnOrigin(),a=ka(t.lifeMode,t.lifeMin,t.lifeMax,t.lifeCurve,this.rng()),o=ka(t.speedMode,t.speedMin,t.speedMax,t.speedCurve,this.rng());let h;t.shape==="cone"?h=(t.direction+this.followSpawnAngle+bi(-t.coneAngle/2,t.coneAngle/2,this.rng()))*Math.PI/180:h=(t.direction+this.followSpawnAngle+bi(-t.spread/2,t.spread/2,this.rng()))*Math.PI/180;const l=this.pool[i],c=this.pickImageResource(),u=this._spawnSerial++;l.spawnId=u;const d=this.pickTrailResource($r(t.seed,u,1540483477));l.noisePhaseX=$r(t.seed,u,1757159915)*Math.PI*2,l.noisePhaseY=$r(t.seed,u,48610963)*Math.PI*2,l.gravityStrength=t.useGravity&&t.gravityMode==="random"?bi(t.gravityMin,t.gravityMax,this.rng()):t.gravityMin,l.windStrength=t.wind&&t.windMode==="random"?bi(t.windMin,t.windMax,this.rng()):t.windMin,l.attractionActive=!1,l.attractionElapsed=0,l.collisionPaused=!1,l.attractionCurveSide=$r(t.seed,u,2738958700)<.5?-1:1,l.trailHistory.length=0,l.trailBones.length=0,l.trailCurrentWidth=0,l.trailCurrentAlpha=0,l.trailCurrentColor=16777215,l.trailResourceId=d.id;const f=Math.min(100,Math.max(0,Number(d.trailRatio)||0)),p=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)))),m=f>0&&p===1&&u===0,g=$r(t.seed,u,668265261)*100,y=(v,_,x,M,T)=>{if(v!=="random")return Math.max(0,Number(_)||0);const C=Math.max(0,Math.min(Number(x)||0,Number(M)||0)),I=Math.max(0,Math.max(Number(x)||0,Number(M)||0));return bi(C,I,$r(t.seed,u,T))};l.trailSampledLength=y(d.lengthMode,d.length,d.lengthMin,d.lengthMax,374761393),l.trailSampledWidth=y(d.widthSizeMode,d.width,d.widthMin,d.widthMax,3550635116),l.trailEnabled=t.trail&&(m||g<f)&&l.trailSampledLength>0&&l.trailSampledWidth>0,l.trailMesh&&(l.trailMesh.visible=!1),l.active=!0,l.life=a,l.maxLife=a,l.x=s,l.y=r,l.trailEnabled&&l.trailHistory.push({x:s,y:r}),l.vx=Math.cos(h)*o,l.vy=(t.shape==="cone"?-Math.sin(h):Math.sin(h))*o,l.scaleStartX=ka(t.scaleMode,t.scaleMin,t.scaleMax,t.scaleCurve,this.rng())*c.scale,l.scaleStartY=t.scaleAxisMode==="separate"?ka(t.scaleMode,t.scaleYMin,t.scaleYMax,t.scaleYCurve,this.rng())*c.scale:l.scaleStartX,l.alphaStart=t.alpha,l.alphaEnd=t.alphaEnd,l.rotation=t.initialRotationMode==="direction"?-Math.atan2(l.vy,l.vx)*180/Math.PI+t.initialRotationMin:ka(t.initialRotationMode,t.initialRotationMin,t.initialRotationMax,t.initialRotationCurve,this.rng()),l.rotationSpeed=t.rotationOverLifeEnabled?ka(t.rotationOverLifeMode,t.rotationSpeedMin,t.rotationSpeedMax,t.rotationOverLifeCurve,this.rng()):0,l.speedScale=1,l.speedScaleTarget=t.speedOverLifeMode==="random"?bi(t.speedOverLifeMin,t.speedOverLifeMax,this.rng()):t.speedOverLifeMin,l.scaleOverLifeX=t.scaleOverLifeMode==="random"?bi(t.scaleOverLifeMin,t.scaleOverLifeMax,this.rng()):t.scaleOverLifeMin,l.scaleOverLifeY=t.scaleOverLifeMode==="random"?bi(t.scaleYOverLifeMin,t.scaleYOverLifeMax,this.rng()):t.scaleYOverLifeMin,l.resourceId=c.id,l.colorSample=c.colorMode==="random"?Yd(c.colorGradient,$r(t.seed,u,2654435769)):so(c.colorStart);const w=this.imageFrameState(c,0);l.imageFrameIndex=w.index,l.sprite.texture=this.imageFrameTexture(c,w.index),l.sprite.anchor.set(c.anchorX,c.anchorY),l.sprite.blendMode=pr[c.blend],l.sprite.tint=l.colorSample,l.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 s=this.rng()*i;for(const r of t)if(s-=Math.max(0,r.weight),s<=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 s=Math.min(120,Math.max(1,Number(t.sequenceFps)||30)),r=Math.max(0,Math.floor(Math.max(0,i)*s)),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 s;return t.imageMode==="sequence"&&t.sequenceFrames.length?((s=t.sequenceFrames[Math.max(0,Math.min(t.sequenceFrames.length-1,i))])==null?void 0:s.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 s=i.reduce((a,o)=>a+Math.max(0,o.weight),0);if(s<=0)return i[Math.min(i.length-1,Math.floor(t*i.length))];let r=t*s;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(s=>{var a;const r=Pa(this.cfg,s.x,s.y,this.simulationTransform);return{...s,worldX:r.x,worldY:r.y,worldRotation:(((a=this.simulationTransform)==null?void 0:a.rotation)??this.cfg.rootRotation)-s.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=Pa(this.cfg,t.sprite.x,t.sprite.y,this.simulationTransform),s=((r=this.simulationTransform)==null?void 0:r.rotation)??this.cfg.rootRotation;return{worldX:i.x,worldY:i.y,worldRotation:s+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 s;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=pr[h.blend])}this.cfg.trail&&a.trailState?(r.trailResourceId=a.trailState.resourceId??((s=this.cfg.trailResources[0])==null?void 0:s.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=Xd(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=Xd(this.cfg.seed>>>0)}}function bi(n,e,t){return n+(e-n)*t}function ac(n,e){return Number.isFinite(n)?n:e}function Pa(n,e,t,i=null){const s=Math.max(1e-4,Math.abs((i==null?void 0:i.scaleX)??n.rootScaleX)),r=Math.max(1e-4,Math.abs((i==null?void 0:i.scaleY)??n.rootScaleY)),a=-((i==null?void 0:i.rotation)??n.rootRotation)*Math.PI/180,o=Math.cos(a),h=Math.sin(a),l=(i==null?void 0:i.centerX)??n.centerX,c=(i==null?void 0:i.centerY)??n.centerY,u=l+o*s*e-h*r*t,d=-c+h*s*e+o*r*t;return{x:u,y:-d}}function Z0(n,e,t,i=null){const s=Math.max(1e-4,Math.abs((i==null?void 0:i.scaleX)??n.rootScaleX)),r=Math.max(1e-4,Math.abs((i==null?void 0:i.scaleY)??n.rootScaleY)),a=-((i==null?void 0:i.rotation)??n.rootRotation)*Math.PI/180,o=Math.cos(a),h=Math.sin(a),l=e-((i==null?void 0:i.centerX)??n.centerX),c=-t+((i==null?void 0:i.centerY)??n.centerY);return{x:(o*l+h*c)/s,y:(-h*l+o*c)/r}}function R2(n,e,t,i=null){const s=Math.max(1e-4,Math.abs((i==null?void 0:i.scaleX)??n.rootScaleX)),r=Math.max(1e-4,Math.abs((i==null?void 0:i.scaleY)??n.rootScaleY)),a=-((i==null?void 0:i.rotation)??n.rootRotation)*Math.PI/180,o=Math.cos(a),h=Math.sin(a),l=o*s*e-h*r*t,c=h*s*e+o*r*t;return{x:l,y:-c}}function P2(n,e,t,i=null){const s=Math.max(1e-4,Math.abs((i==null?void 0:i.scaleX)??n.rootScaleX)),r=Math.max(1e-4,Math.abs((i==null?void 0:i.scaleY)??n.rootScaleY)),a=-((i==null?void 0:i.rotation)??n.rootRotation)*Math.PI/180,o=Math.cos(a),h=Math.sin(a),l=-t;return{x:(o*e+h*l)/s,y:(-h*e+o*l)/r}}function k2(n,e,t){const i=n.rotation*Math.PI/180,s=Math.cos(i),r=Math.sin(i),a=Math.max(1e-4,Math.abs(n.scaleX??1)),o=Math.max(1e-4,Math.abs(n.scaleY??1)),h=e-n.x,l=t-n.y,c=(s*h+r*l)/a,u=(-r*h+s*l)/o,d=(M,T,C,I)=>{const k=C/a,R=I/o,F=Math.max(1e-4,Math.hypot(k,R)),B=k/F,L=R/F,Y=s*B-r*L,O=r*B+s*L;return{x:n.x+s*M*a-r*T*o+Y*.05,y:n.y+r*M*a+s*T*o+O*.05,nx:Y,ny:O}};if(n.shape==="circle"){const M=Math.max(.001,n.radius),T=Math.hypot(c,u);if(T>=M)return null;const C=T>1e-4?c/T:1,I=T>1e-4?u/T:0;return d(C*M,I*M,C,I)}if(n.shape==="ellipse"){const M=Math.max(.001,n.radiusX),T=Math.max(.001,n.radiusY),C=Math.hypot(c/M,u/T);if(C>=1)return null;const I=C>1e-4?1/C:1,k=C>1e-4?c*I:M,R=C>1e-4?u*I:0,F=Math.max(1e-4,Math.hypot(k/(M*M),R/(T*T)));return d(k,R,k/(M*M)/F,R/(T*T)/F)}if(n.shape==="rect"){const M=Math.max(.001,n.width*.5),T=Math.max(.001,n.height*.5);if(Math.abs(c)>=M||Math.abs(u)>=T)return null;const C=M-Math.abs(c),I=T-Math.abs(u);if(C<I){const R=c>=0?1:-1;return d(R*M,u,R,0)}const k=u>=0?1:-1;return d(c,k*T,0,k)}const f=Math.max(3,Math.min(16,Math.round(n.sides||(n.shape==="custom"?5:6)))),p=Math.max(.001,n.width*.5),m=Math.max(.001,n.height*.5),g=Array.from({length:f},(M,T)=>{const C=Math.PI*.5+T/f*Math.PI*2;return{x:Math.cos(C)*p,y:Math.sin(C)*m}});let y=!1;for(let M=0,T=g.length-1;M<g.length;T=M++){const C=g[M],I=g[T];C.y>u!=I.y>u&&c<(I.x-C.x)*(u-C.y)/(I.y-C.y)+C.x&&(y=!y)}if(!y)return null;let w=g[0].x,v=g[0].y,_=1/0;for(let M=0;M<g.length;M++){const T=g[M],C=g[(M+1)%g.length],I=C.x-T.x,k=C.y-T.y,R=Math.max(1e-4,I*I+k*k),F=Math.min(1,Math.max(0,((c-T.x)*I+(u-T.y)*k)/R)),B=T.x+I*F,L=T.y+k*F,Y=Math.hypot(B-c,L-u);Y<_&&(_=Y,w=B,v=L)}const x=Math.max(1e-4,Math.hypot(w-c,v-u));return d(w,v,(w-c)/x,(v-u)/x)}function F2(n){return Math.min(1,Math.max(0,1-n.life/Math.max(1e-4,n.maxLife)))}function $r(n,e,t){let i=(n>>>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 ka(n,e,t,i,s){return n==="fixed"?e:n==="curve"?bi(e,t,tn(i,s)):bi(e,t,s)}function Ud(n,e,t,i,s,r){return n==="curve"?bi(e,t,tn(i,s)):n==="random"?r:e}function J0(n,e,t,i,s){const r=1-s;return r*r*r*n+3*r*r*s*e+3*r*s*s*t+s*s*s*i}function tn(n,e,t="线性"){if(!Array.isArray(n)||n.length===0)return 1;const i=[...n].sort((s,r)=>s.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 s=0;s<i.length-1;s++)if(e>=i[s].x&&e<=i[s+1].x){const r=i[s],a=i[s+1],o=a.x-r.x||1;if(t!=="贝塞尔")return bi(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;J0(r.x,h,c,a.x,m)<e?d=m:f=m}return J0(r.y,l,u,a.y,(d+f)/2)}return i[i.length-1].y}function Xd(n){let e=n>>>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 so(n){let e=n.replace("#","");return e.length===3&&(e=e.split("").map(t=>t+t).join("")),parseInt(e,16)}function O2(n,e,t){const i=Q0(n),s=Q0(e),r=Math.round(i[0]+(s[0]-i[0])*t),a=Math.round(i[1]+(s[1]-i[1])*t),o=Math.round(i[2]+(s[2]-i[2])*t);return r<<16|a<<8|o}function Yd(n,e){if(!Array.isArray(n)||n.length===0)return 16777215;const t=[...n].sort((i,s)=>i.position-s.position);if(e<=t[0].position)return so(t[0].color);if(e>=t[t.length-1].position)return so(t[t.length-1].color);for(let i=0;i<t.length-1;i++){const s=t[i],r=t[i+1];if(e<s.position||e>r.position)continue;const a=(e-s.position)/Math.max(1e-4,r.position-s.position);return O2(s.color,r.color,a)}return so(t[t.length-1].color)}function Q0(n){let e=n.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 pa=new Map,ca=new Map;function B2(n){return[...pa.values()].some(e=>e===n)}function S1(n){if(!(B2(n)||(ca.get(n)||0)>0)){ca.delete(n);for(const e of n.textures)e.destroy(!0)}}function L2(n){const e=ca.get(n)||0;e>1?ca.set(n,e-1):ca.delete(n),S1(n)}function D2(n){return pa.get(n)||null}function Jh(n,e){Il(n),pa.set(n,e)}function N2(n){const e=pa.get(n);return e?(ca.set(e,(ca.get(e)||0)+1),e):null}function U2(n,e){const t=pa.get(n);return t?(Jh(e,t),!0):!1}function Il(n){const e=pa.get(n);e&&(pa.delete(n),S1(e))}function Kt(n){if(Array.isArray(n))return n.map(e=>Kt(e));if(n&&typeof n=="object"){const e=Object.getPrototypeOf(n);if(e===Object.prototype||e===null){const t={};for(const[i,s]of Object.entries(n))t[i]=Kt(s);return t}}return n}const _1=["3.8","4.0","4.1","4.2","4.3"];function ah(n){const e=String(n||"").trim();return _1.find(t=>e===t||e.startsWith(`${t}.`))||null}function jf(){return _1.join(" / ")}function X2(n){return n==="4.3"?"4.3":"4.2"}function qm(){return{imagesPath:"./images/",spineVersion:"4.2",keyframeCurve:"linear",fps:30,omitFps:!1,integerFrameAlignment:!0,bonePool:!0,excludeEmptyAnimations:!1,fileName:"SpineParticle.json"}}function T1(n){const e=Object.assign(qm(),n||{});return e.imagesPath=String(e.imagesPath||"./images/"),e.spineVersion=ah(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 Wf=30;function Ic(n,e=1){return Math.min(1800,Math.max(1,Math.ceil(Number(n)||e)))}function M1(n,e=30){const t=Math.max(0,Number(n.lifeMin)||0),i=Math.max(0,Number(n.lifeMax)||0),s=n.lifeMode==="fixed"?t:Math.max(t,i);return Ic(Math.ceil(s*Math.max(1,e)),Wf)}function Mr(n,e=30){const t=Ic(n.loopDurationFrames),i=M1(n,e),s=n.generateLoopStartAnimation?n.loopStartUseCustomDuration?Ic(n.loopStartDurationFrames,Wf):i:0,r=n.generateLoopEndAnimation?n.loopEndUseCustomDuration?Ic(n.loopEndDurationFrames,Wf):i:0;return{start:s,loop:t,end:r,total:s+t+r}}function E1(n,e){const t=Mr(n,e),s=Math.max(0,Math.ceil(Math.max(0,Number(n.delay)||0)*Math.max(1,e)))+t.start;return{start:s,end:s+t.loop}}function Rc(n,e,t){const i=Math.max(1,Math.floor(t)-1),s=Math.min(i-1,Math.max(0,Math.floor(Number(n)||0))),r=Math.min(i,Math.max(s+1,Math.floor(Number(e)||i)));return{start:s,end:r}}function Y2(n,e,t){const i=Math.max(1,e-1),s=Math.max(1,t-1),r=n.end>=i?s:n.end;return Rc(n.start,r,t)}let oc=1,lc=1,cc=1,hc=1;function uc(n,e){const t=new Set(e),i=`${n} Copy`;if(!t.has(i))return i;let s=2;for(;t.has(`${i} ${s}`);)s++;return`${i} ${s}`}const Rl=dT("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:qm()}}),getters:{activeSystemCount:n=>n.systems.length},actions:{syncSceneSequences(){oc=Math.max(oc,...this.systems.map(n=>n.id+1),1),lc=Math.max(lc,...this.colliders.map(n=>n.id+1),1),cc=Math.max(cc,...this.paths.map(n=>n.id+1),1),hc=Math.max(hc,...this.spines.map(n=>n.id+1),1)},addSystem(n){const e=yl();n!=null&&n.config&&Object.assign(e,n.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",s={id:oc++,visible:!0,animation:i,config:e};return this.systems.push(s),this.activeId=s.id,this.activeObjectType="particle",this.activeObjectId=s.id,s},removeSystem(n){var i;const e=this.systems.findIndex(s=>s.id===n);e>=0&&this.systems.splice(e,1),this.activeId===n&&(this.activeId=((i=this.systems[0])==null?void 0:i.id)??0);const t=this.systems.find(s=>s.id===this.activeId);if(t&&(this.timeline.animation=t.animation),this.activeObjectType==="particle"&&this.activeObjectId===n){const s=this.systems[0];this.activeObjectId=(s==null?void 0:s.id)??0}},selectSystem(n){this.activeId=n,this.activeObjectType="particle",this.activeObjectId=n;const e=this.systems.find(t=>t.id===n);e&&(this.timeline.animation=e.animation)},setSystemAnimation(n,e){if(!this.timeline.animations.includes(e))return;const t=this.systems.find(i=>i.id===n);t&&(t.animation=e,this.timeline.animation=e)},addAnimation(){const n=new Set(this.timeline.animations);let e=2,t=`animation${e}`;for(;n.has(t);)t=`animation${++e}`;this.timeline.animations.push(t),this.timeline.animation=t;const i=this.systems.find(s=>s.id===this.activeId);return i&&(i.animation=t),t},renameAnimation(n,e){const t=e.trim(),i=this.timeline.animations.indexOf(n);if(i<0||!t||t!==n&&this.timeline.animations.includes(t))return!1;this.timeline.animations[i]=t;for(const s of this.systems)s.animation===n&&(s.animation=t);return this.timeline.animation===n&&(this.timeline.animation=t),!0},removeAnimation(n){if(this.timeline.animations.length<=1)return!1;const e=this.timeline.animations.indexOf(n);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===n&&(i.animation=t);return this.timeline.animation===n&&(this.timeline.animation=t),!0},addCollider(){const n=lc++,e={id:n,name:`Collider${n}`,visible:!0,tags:["Default"],selectedTag:"Default",shape:"circle",enabled:!0,x:0,y:0,rotation:0,scaleX:1,scaleY:1,radius:50,radiusX:70,radiusY:45,width:120,height:80,sides:6,response:"physics",elasticity:.8,friction:.3,followPath:!1,followPathId:0,followDuration:2,followPathRotation:!1,followCurveMode:"跟随导出",followCurve:[{x:0,y:0},{x:1,y:1}]};return this.colliders.push(e),this.activeObjectType="collision",this.activeObjectId=e.id,e},addPath(){const n=cc++,e={id:n,name:`Path${n}`,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 n=hc++,e={id:n,name:`SpineSkeleton${n}`,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 n=this.activeObjectId;if(!n)return null;if(this.activeObjectType==="particle"){const i=this.systems.find(r=>r.id===n);if(!i)return null;const s=Kt(i);return s.id=oc++,s.config.name=uc(i.config.name,this.systems.map(r=>r.config.name)),s.frames=void 0,this.systems.push(s),this.activeId=s.id,this.activeObjectId=s.id,this.timeline.animation=s.animation,s}if(this.activeObjectType==="collision"){const i=this.colliders.find(r=>r.id===n);if(!i)return null;const s=Kt(i);return s.id=lc++,s.name=uc(i.name,this.colliders.map(r=>r.name)),this.colliders.push(s),this.activeObjectId=s.id,s}if(this.activeObjectType==="path"){const i=this.paths.find(r=>r.id===n);if(!i)return null;const s=Kt(i);return s.id=cc++,s.name=uc(i.name,this.paths.map(r=>r.name)),this.paths.push(s),this.activeObjectId=s.id,s}const e=this.spines.find(i=>i.id===n);if(!e)return null;const t=Kt(e);return t.id=hc++,t.name=uc(e.name,this.spines.map(i=>i.name)),t.selectedBone="",U2(e.id,t.id),this.spines.push(t),this.activeObjectId=t.id,t},selectSceneObject(n,e){if(this.activeObjectType=n,this.activeObjectId=e,n==="particle"){this.activeId=e;const t=this.systems.find(i=>i.id===e);t&&(this.timeline.animation=t.animation)}},removeCollider(n){var t;const e=this.colliders.findIndex(i=>i.id===n);if(e>=0&&this.colliders.splice(e,1),this.activeObjectType==="collision"&&this.activeObjectId===n){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(n){var t;const e=this.paths.findIndex(i=>i.id===n);if(e>=0&&this.paths.splice(e,1),this.activeObjectType==="path"&&this.activeObjectId===n){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(n){Il(n);const e=this.spines.findIndex(t=>t.id===n);if(e>=0&&this.spines.splice(e,1),this.activeObjectType==="spine"&&this.activeObjectId===n){const t=this.systems[0],i=this.colliders[0],s=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):s?(this.activeObjectType="path",this.activeObjectId=s.id):(this.activeObjectType="spine",this.activeObjectId=(r==null?void 0:r.id)??0)}this.recalcTotalFrames()},play(){const n=Rc(this.timeline.playbackStart,this.timeline.playbackEnd,this.timeline.totalFrames);(this.timeline.frame<n.start||this.timeline.frame>=n.end)&&(this.timeline.frame=n.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(n){this.timeline.frame=Math.max(0,Math.min(n,this.timeline.totalFrames-1))},setPlaybackStart(n){const e=Rc(n,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(n){const e=Rc(this.timeline.playbackStart,n,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 n=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/n,Math.ceil(Math.max(1,Number(a.loopDurationFrames)||1))/n):Math.max(1/n,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)+Mr(a,n).total/n),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*n)+1);this.timeline.totalFrames=i;const s=Y2({start:this.timeline.playbackStart,end:this.timeline.playbackEnd},t,i);return this.timeline.playbackStart=s.start,this.timeline.playbackEnd=s.end,this.timeline.frame>=i&&(this.timeline.frame=i-1),i}}}),A1="SpineParticle.SystemSettings",C1=1,Vd="SpineParticle.SystemSettings.v1";function Oo(n,e,t,i){const s=Number(n);return Math.min(t,Math.max(e,Number.isFinite(s)?s:i))}function V2(n){return{parameterPanelOnRight:n.parameterPanelOnRight,undoLimit:n.undoLimit,showEmitter:n.showEmitter,showBones:n.showBones,bonePointDrawSize:n.bonePointDrawSize,boneAxisDrawSize:n.boneAxisDrawSize,showSkinMesh:n.showSkinMesh,tickEnabled:n.tickEnabled,axisFontSize:n.axisFontSize,tickWidth:n.tickWidth,showAxisLabels:n.showAxisLabels,axisColor:n.axisColor}}function $2(n,e){const t=s=>n[s]==null?!!e[s]:n[s]===!0,i=typeof n.axisColor=="string"&&/^#[0-9a-f]{6}$/i.test(n.axisColor)?n.axisColor:e.axisColor;return{parameterPanelOnRight:t("parameterPanelOnRight"),undoLimit:Math.round(Oo(n.undoLimit,1,200,e.undoLimit)),showEmitter:t("showEmitter"),showBones:t("showBones"),bonePointDrawSize:Oo(n.bonePointDrawSize,.1,10,e.bonePointDrawSize),boneAxisDrawSize:Oo(n.boneAxisDrawSize,.1,10,e.boneAxisDrawSize),showSkinMesh:t("showSkinMesh"),tickEnabled:t("tickEnabled"),axisFontSize:Math.round(Oo(n.axisFontSize,8,40,e.axisFontSize)),tickWidth:Oo(n.tickWidth,1,5,e.tickWidth),showAxisLabels:t("showAxisLabels"),axisColor:i}}function G2(n){let e;try{e=JSON.parse(n)}catch{throw new Error("系统设置缓存不是有效的 JSON")}const t=e;if(t.format!==A1)throw new Error("不是 Spine粒子编辑器系统设置缓存");if(t.version!==C1)throw new Error(`暂不支持系统配置版本:${t.version??"未知"}`);if(!t.settings||typeof t.settings!="object")throw new Error("系统设置缓存缺少 settings");return t}function H2(n,e){Object.assign(n.settings,$2(e,n.settings))}let dc=null;function j2(n){dc==null||dc();try{const e=localStorage.getItem(Vd);e&&H2(n,G2(e).settings)}catch{try{localStorage.removeItem(Vd)}catch{}}dc=hs(()=>V2(n.settings),e=>{const t={format:A1,version:C1,savedAt:new Date().toISOString(),settings:e};try{localStorage.setItem(Vd,JSON.stringify(t))}catch{}},{deep:!0})}function Ni(n){return n.map(e=>({...e,trailState:e.trailState?{...e.trailState,bones:e.trailState.bones.map(t=>({...t}))}:void 0}))}function W2(n){const e=new Map;for(const i of n)for(const s of i)e.has(s.boneName)||e.set(s.boneName,Ni([s])[0]);const t=[...e.keys()].sort((i,s)=>{const r=Number(i.replace(/^p_/,"")),a=Number(s.replace(/^p_/,""));return Number.isFinite(r)&&Number.isFinite(a)?r-a:i.localeCompare(s)});for(let i=0;i<n.length;i++){const s=new Map(n[i].map(r=>[r.boneName,r]));n[i]=t.map(r=>{const a=s.get(r);return a||{...Ni([e.get(r)])[0],alpha:0,imageVisible:!1,trailState:void 0,active:!0}})}}function z2(n){n.length<2||(n[n.length-1]=Ni(n[0]))}function q2(n,e){const t=Math.max(0,n.length-1),i=[];for(let s=0;s<=e;s++){const r=Math.min(t,Math.round(s/e*t));i.push(Ni(n[r]||[]))}return i}function $d(n){return`${n.boneName}:${n.spawnId??"legacy"}`}function ev(n){return{...Ni([n])[0],alpha:0,imageVisible:!1,trailState:void 0,active:!0}}function K2(n,e,t,i){const s=Math.min(n.length,i+1),r=n.slice(Math.max(0,n.length-s)),a=new Map;for(const l of e){if(l.imageVisible===!1||l.alpha<=0)continue;const c=$d(l),u=new Map;let d=!1;for(let f=r.length-1;f>=0;f--){const p=r[f].find(m=>$d(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 Ni([u])[0];const d=(f=a.get($d(u)))==null?void 0:f.get(c);return d?Ni([d])[0]:ev(u)}))}return h[0]=h[0].map(ev),h[h.length-1]=Ni(e),h}function tv(n,e){const t=n.length?1:0;for(let i=t;i<e.length;i++)n.push(Ni(e[i]))}function Z2(n,e,t,i){var y;const s=n.config,r=1/Math.max(1,t),a=s.lifeMode==="fixed"?Math.max(0,Number(s.lifeMin)||0):Math.max(0,Number(s.lifeMin)||0,Number(s.lifeMax)||0),o=Mr(s,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(s.delay)||0)*t)),u=[],d=w=>{const v=w?[[]]:[];e.reset();for(let _=0;_<l;_++){_>0&&e.restartEmissionCycle();for(let x=0;x<o.loop;x++)e.update(r,"force"),w&&v.push(e.capture())}return{seam:e.capture(),warmup:v}},f=d(s.generateLoopStartAnimation),p=Ni(f.seam),m=[Ni(p)];e.restartEmissionCycle();for(let w=0;w<o.loop;w++)e.update(r,"force"),m.push(e.capture());W2(m),z2(m);for(let w=0;w<c;w++)u.push([]);if(s.generateLoopStartAnimation){const w=K2(f.warmup,m[0],o.start,h);for(const v of w)u.push(Ni(v))}else u.push(Ni(m[0]));if(tv(u,m),s.generateLoopEndAnimation){d(!1);const w=[Ni(m[0])],v=Math.max(1,h+2);for(let _=0;_<v&&e.activeCount>0;_++)e.update(r,"off"),w.push(e.capture());(y=w[w.length-1])!=null&&y.length&&w.push([]),tv(u,q2(w,o.end))}const g=Ni(u[u.length-1]||[]);for(u.length>i&&(u.length=i);u.length<i;)u.push(Ni(g));n.frames=u,e.apply(u[0]||[])}class J2{constructor(){b(this,"container",new Oi);b(this,"entries",new Map)}sync(e,t,i){var s;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=D2(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 Oi,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=((s=r.animations.find(p=>p.name===r.selectedAnimation))==null?void 0:s.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),s=i==null?void 0:i.spine.skeleton.findBone(t);if(!i||!s||!s.active)return null;const r=i.runtimeVersion==="4.3"?s.appliedPose:s,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,y=a.position.x+l*r.worldX+c*r.worldY,w=a.position.y+u*r.worldX+d*r.worldY;return{x:y,y:-w,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 I1=class{constructor(){b(this,"entries",{});b(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,s=e.length;i<s;i++)this.add(e[i]);return t!=this.size}contains(e){return this.entries[e]}clear(){this.entries={},this.size=0}};var Di;let gt=(Di=class{constructor(e=0,t=0,i=0,s=0){b(this,"r");b(this,"g");b(this,"b");b(this,"a");this.r=e,this.g=t,this.b=i,this.a=s}set(e,t,i,s){return this.r=e,this.g=t,this.b=i,this.a=s,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,s){return this.r+=e,this.g+=t,this.b+=i,this.a+=s,this.clamp()}clamp(){return this.r<0?this.r=0:this.r>1&&(this.r=1),this.g<0?this.g=0:this.g>1&&(this.g=1),this.b<0?this.b=0:this.b>1&&(this.b=1),this.a<0?this.a=0:this.a>1&&(this.a=1),this}static rgba8888ToColor(e,t){e.r=((t&4278190080)>>>24)/255,e.g=((t&16711680)>>>16)/255,e.b=((t&65280)>>>8)/255,e.a=(t&255)/255}static rgb888ToColor(e,t){e.r=((t&16711680)>>>16)/255,e.g=((t&65280)>>>8)/255,e.b=(t&255)/255}toRgb888(){const e=t=>("0"+(t*255).toString(16)).slice(-2);return+("0x"+e(this.r)+e(this.g)+e(this.b))}static fromString(e,t=new Di){return t.setFromString(e)}},b(Di,"WHITE",new Di(1,1,1,1)),b(Di,"RED",new Di(1,0,0,1)),b(Di,"GREEN",new Di(0,1,0,1)),b(Di,"BLUE",new Di(0,0,1,1)),b(Di,"MAGENTA",new Di(1,0,1,1)),Di);var oi;let Ne=(oi=class{static clamp(e,t,i){return e<t?t:e>i?i:e}static cosDeg(e){return Math.cos(e*oi.degRad)}static sinDeg(e){return Math.sin(e*oi.degRad)}static atan2Deg(e,t){return Math.atan2(e,t)*oi.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 oi.randomTriangularWith(e,t,(e+t)*.5)}static randomTriangularWith(e,t,i){let s=Math.random(),r=t-e;return s<=(i-e)/r?e+Math.sqrt(s*r*(i-e)):t-Math.sqrt((1-s)*r*(t-i))}static isPowerOfTwo(e){return e&&(e&e-1)===0}},b(oi,"PI",3.1415927),b(oi,"PI2",oi.PI*2),b(oi,"invPI2",1/oi.PI2),b(oi,"radiansToDegrees",180/oi.PI),b(oi,"radDeg",oi.radiansToDegrees),b(oi,"degreesToRadians",oi.PI/180),b(oi,"degRad",oi.degreesToRadians),oi);var Fs;let Ue=(Fs=class{static arrayCopy(e,t,i,s,r){for(let a=t,o=s;a<t+r;a++,o++)i[o]=e[a]}static arrayFill(e,t,i,s){for(let r=t;r<i;r++)e[r]=s}static setArraySize(e,t,i=0){let s=e.length;if(s==t)return e;if(e.length=t,s<t)for(let r=s;r<t;r++)e[r]=i;return e}static ensureArrayCapacity(e,t,i=0){return e.length>=t?e:Fs.setArraySize(e,t,i)}static newArray(e,t){let i=new Array(e);for(let s=0;s<e;s++)i[s]=t;return i}static newFloatArray(e){if(Fs.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(Fs.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 Fs.SUPPORTS_TYPED_ARRAYS?new Float32Array(e):e}static toSinglePrecision(e){return Fs.SUPPORTS_TYPED_ARRAYS?Math.fround(e):e}static webkit602BugfixHelper(e,t){}static contains(e,t,i=!0){for(var s=0;s<e.length;s++)if(e[s]==t)return!0;return!1}static enumValue(e,t){return e[t[0].toUpperCase()+t.slice(1)]}},b(Fs,"SUPPORTS_TYPED_ARRAYS",typeof Float32Array<"u"),Fs),oh=class{constructor(e){b(this,"items",new Array);b(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}},lh=class{constructor(e=0,t=0){b(this,"x");b(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}},R1=class{constructor(e){b(this,"name");if(!e)throw new Error("name cannot be null.");this.name=e}};var ea;let tr=(ea=class extends R1{constructor(t){super(t);b(this,"id",ea.nextID++);b(this,"bones",null);b(this,"vertices",[]);b(this,"worldVerticesLength",0);b(this,"timelineAttachment",this)}computeWorldVertices(t,i,s,r,a,o){s=a+(s>>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,y=m.worldY,w=m.a,v=m.b,_=m.c,x=m.d;for(let M=i,T=a;T<s;M+=2,T+=o){let C=c[M],I=c[M+1];r[T]=C*w+I*v+g,r[T+1]=C*_+I*x+y}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<s;m+=o){let y=0,w=0,v=u[d++];for(v+=d;d<v;d++,g+=3){let _=p[u[d]],x=c[g],M=c[g+1],T=c[g+2];y+=(x*_.a+M*_.b+_.worldX)*T,w+=(x*_.c+M*_.d+_.worldY)*T}r[m]=y,r[m+1]=w}else{let m=l;for(let g=a,y=f*3,w=f<<1;g<s;g+=o){let v=0,_=0,x=u[d++];for(x+=d;d<x;d++,y+=3,w+=2){let M=p[u[d]],T=c[y]+m[w],C=c[y+1]+m[w+1],I=c[y+2];v+=(T*M.a+C*M.b+M.worldX)*I,_+=(T*M.c+C*M.d+M.worldY)*I}r[g]=v,r[g+1]=_}}}copyTo(t){this.bones?(t.bones=new Array(this.bones.length),Ue.arrayCopy(this.bones,0,t.bones,0,this.bones.length)):t.bones=null,this.vertices&&(t.vertices=Ue.newFloatArray(this.vertices.length),Ue.arrayCopy(this.vertices,0,t.vertices,0,this.vertices.length)),t.worldVerticesLength=this.worldVerticesLength,t.timelineAttachment=this.timelineAttachment}},b(ea,"nextID",0),ea);var Hn;let P1=(Hn=class{constructor(e){b(this,"id",Hn.nextID());b(this,"regions");b(this,"start",0);b(this,"digits",0);b(this,"setupIndex",0);this.regions=new Array(e)}copy(){let e=new Hn(this.regions.length);return Ue.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 s=this.regions[i];t.region!=s&&(t.region=s,t.updateRegion())}getPath(e,t){let i=e,s=(this.start+t).toString();for(let r=this.digits-s.length;r>0;r--)i+="0";return i+=s,i}static nextID(){return Hn._nextID++}},b(Hn,"_nextID",0),Hn);var Ri;(function(n){n[n.hold=0]="hold",n[n.once=1]="once",n[n.loop=2]="loop",n[n.pingpong=3]="pingpong",n[n.onceReverse=4]="onceReverse",n[n.loopReverse=5]="loopReverse",n[n.pingpongReverse=6]="pingpongReverse"})(Ri||(Ri={}));const k1=[Ri.hold,Ri.once,Ri.loop,Ri.pingpong,Ri.onceReverse,Ri.loopReverse,Ri.pingpongReverse];let Km=class{constructor(e,t,i){b(this,"name");b(this,"timelines",[]);b(this,"timelineIds",new I1);b(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,s,r,a,o,h){if(!e)throw new Error("skeleton cannot be null.");s&&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 Ae;(function(n){n[n.setup=0]="setup",n[n.first=1]="first",n[n.replace=2]="replace",n[n.add=3]="add"})(Ae||(Ae={}));var Yi;(function(n){n[n.mixIn=0]="mixIn",n[n.mixOut=1]="mixOut"})(Yi||(Yi={}));const xt={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 Jt=class{constructor(e,t){b(this,"propertyIds");b(this,"frames");this.propertyIds=t,this.frames=Ue.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 s=1;s<i;s++)if(e[s]>t)return s-1;return i-1}static search(e,t,i){let s=e.length;for(let r=i;r<s;r+=i)if(e[r]>t)return r-i;return s-i}},_n=class extends Jt{constructor(t,i,s){super(t,s);b(this,"curves");this.curves=Ue.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 s=Ue.newFloatArray(i);Ue.arrayCopy(this.curves,0,s,0,i),this.curves=s}}setBezier(t,i,s,r,a,o,h,l,c,u,d){let f=this.curves,p=this.getFrameCount()+t*18;s==0&&(f[i]=2+p);let m=(r-o*2+l)*.03,g=(a-h*2+c)*.03,y=((o-l)*3-r+u)*.006,w=((h-c)*3-a+d)*.006,v=m*2+y,_=g*2+w,x=(o-r)*.3+m+y*.16666667,M=(h-a)*.3+g+w*.16666667,T=r+x,C=a+M;for(let I=p+18;p<I;p+=2)f[p]=T,f[p+1]=C,x+=v,M+=_,v+=y,_+=w,T+=x,C+=M}getBezierValue(t,i,s,r){let a=this.curves;if(a[r]>t){let c=this.frames[i],u=this.frames[i+s];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+s]-l)}},$s=class extends _n{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 s=this.curves[i>>1];switch(s){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,s-2)}getRelativeValue(e,t,i,s,r){if(e<this.frames[0]){switch(i){case Ae.setup:return r;case Ae.first:return s+(r-s)*t}return s}let a=this.getCurveValue(e);switch(i){case Ae.setup:return r+a*t;case Ae.first:case Ae.replace:a+=r-s}return s+a*t}getAbsoluteValue(e,t,i,s,r){if(e<this.frames[0]){switch(i){case Ae.setup:return r;case Ae.first:return s+(r-s)*t}return s}let a=this.getCurveValue(e);return i==Ae.setup?r+(a-r)*t:s+(a-s)*t}getAbsoluteValue2(e,t,i,s,r,a){if(e<this.frames[0]){switch(i){case Ae.setup:return r;case Ae.first:return s+(r-s)*t}return s}return i==Ae.setup?r+(a-r)*t:s+(a-s)*t}getScaleValue(e,t,i,s,r,a){const o=this.frames;if(e<o[0]){switch(i){case Ae.setup:return a;case Ae.first:return r+(a-r)*t}return r}let h=this.getCurveValue(e)*a;if(t==1)return i==Ae.add?r+h-a:h;if(s==Yi.mixOut)switch(i){case Ae.setup:return a+(Math.abs(h)*Ne.signum(a)-a)*t;case Ae.first:case Ae.replace:return r+(Math.abs(h)*Ne.signum(r)-r)*t}else{let l=0;switch(i){case Ae.setup:return l=Math.abs(a)*Ne.signum(h),l+(h-l)*t;case Ae.first:case Ae.replace:return l=Math.abs(r)*Ne.signum(h),l+(h-l)*t}}return r+(h-a)*t}};class Zm extends _n{constructor(e,t,i,s){super(e,t,[i,s])}getFrameEntries(){return 3}setFrame(e,t,i,s){e*=3,this.frames[e]=t,this.frames[e+1]=i,this.frames[e+2]=s}}let ch=class extends $s{constructor(t,i,s){super(t,i,xt.rotate+"|"+s);b(this,"boneIndex",0);this.boneIndex=s}apply(t,i,s,r,a,o,h){let l=t.bones[this.boneIndex];l.active&&(l.rotation=this.getRelativeValue(s,a,o,l.rotation,l.data.rotation))}},F1=class extends Zm{constructor(t,i,s){super(t,i,xt.x+"|"+s,xt.y+"|"+s);b(this,"boneIndex",0);this.boneIndex=s}apply(t,i,s,r,a,o,h){let l=t.bones[this.boneIndex];if(!l.active)return;let c=this.frames;if(s<c[0]){switch(o){case Ae.setup:l.x=l.data.x,l.y=l.data.y;return;case Ae.first:l.x+=(l.data.x-l.x)*a,l.y+=(l.data.y-l.y)*a}return}let u=0,d=0,f=Jt.search(c,s,3),p=this.curves[f/3];switch(p){case 0:let m=c[f];u=c[f+1],d=c[f+2];let g=(s-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(s,f,1,p-2),d=this.getBezierValue(s,f,2,p+18-2)}switch(o){case Ae.setup:l.x=l.data.x+u*a,l.y=l.data.y+d*a;break;case Ae.first:case Ae.replace:l.x+=(l.data.x+u-l.x)*a,l.y+=(l.data.y+d-l.y)*a;break;case Ae.add:l.x+=u*a,l.y+=d*a}}},O1=class extends $s{constructor(t,i,s){super(t,i,xt.x+"|"+s);b(this,"boneIndex",0);this.boneIndex=s}apply(t,i,s,r,a,o,h){let l=t.bones[this.boneIndex];l.active&&(l.x=this.getRelativeValue(s,a,o,l.x,l.data.x))}},B1=class extends $s{constructor(t,i,s){super(t,i,xt.y+"|"+s);b(this,"boneIndex",0);this.boneIndex=s}apply(t,i,s,r,a,o,h){let l=t.bones[this.boneIndex];l.active&&(l.y=this.getRelativeValue(s,a,o,l.y,l.data.y))}},L1=class extends Zm{constructor(t,i,s){super(t,i,xt.scaleX+"|"+s,xt.scaleY+"|"+s);b(this,"boneIndex",0);this.boneIndex=s}apply(t,i,s,r,a,o,h){let l=t.bones[this.boneIndex];if(!l.active)return;let c=this.frames;if(s<c[0]){switch(o){case Ae.setup:l.scaleX=l.data.scaleX,l.scaleY=l.data.scaleY;return;case Ae.first:l.scaleX+=(l.data.scaleX-l.scaleX)*a,l.scaleY+=(l.data.scaleY-l.scaleY)*a}return}let u,d,f=Jt.search(c,s,3),p=this.curves[f/3];switch(p){case 0:let m=c[f];u=c[f+1],d=c[f+2];let g=(s-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(s,f,1,p-2),d=this.getBezierValue(s,f,2,p+18-2)}if(u*=l.data.scaleX,d*=l.data.scaleY,a==1)o==Ae.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==Yi.mixOut)switch(o){case Ae.setup:m=l.data.scaleX,g=l.data.scaleY,l.scaleX=m+(Math.abs(u)*Ne.signum(m)-m)*a,l.scaleY=g+(Math.abs(d)*Ne.signum(g)-g)*a;break;case Ae.first:case Ae.replace:m=l.scaleX,g=l.scaleY,l.scaleX=m+(Math.abs(u)*Ne.signum(m)-m)*a,l.scaleY=g+(Math.abs(d)*Ne.signum(g)-g)*a;break;case Ae.add:l.scaleX+=(u-l.data.scaleX)*a,l.scaleY+=(d-l.data.scaleY)*a}else switch(o){case Ae.setup:m=Math.abs(l.data.scaleX)*Ne.signum(u),g=Math.abs(l.data.scaleY)*Ne.signum(d),l.scaleX=m+(u-m)*a,l.scaleY=g+(d-g)*a;break;case Ae.first:case Ae.replace:m=Math.abs(l.scaleX)*Ne.signum(u),g=Math.abs(l.scaleY)*Ne.signum(d),l.scaleX=m+(u-m)*a,l.scaleY=g+(d-g)*a;break;case Ae.add:l.scaleX+=(u-l.data.scaleX)*a,l.scaleY+=(d-l.data.scaleY)*a}}}},D1=class extends $s{constructor(t,i,s){super(t,i,xt.scaleX+"|"+s);b(this,"boneIndex",0);this.boneIndex=s}apply(t,i,s,r,a,o,h){let l=t.bones[this.boneIndex];l.active&&(l.scaleX=this.getScaleValue(s,a,o,h,l.scaleX,l.data.scaleX))}},N1=class extends $s{constructor(t,i,s){super(t,i,xt.scaleY+"|"+s);b(this,"boneIndex",0);this.boneIndex=s}apply(t,i,s,r,a,o,h){let l=t.bones[this.boneIndex];l.active&&(l.scaleY=this.getScaleValue(s,a,o,h,l.scaleY,l.data.scaleY))}},U1=class extends Zm{constructor(t,i,s){super(t,i,xt.shearX+"|"+s,xt.shearY+"|"+s);b(this,"boneIndex",0);this.boneIndex=s}apply(t,i,s,r,a,o,h){let l=t.bones[this.boneIndex];if(!l.active)return;let c=this.frames;if(s<c[0]){switch(o){case Ae.setup:l.shearX=l.data.shearX,l.shearY=l.data.shearY;return;case Ae.first:l.shearX+=(l.data.shearX-l.shearX)*a,l.shearY+=(l.data.shearY-l.shearY)*a}return}let u=0,d=0,f=Jt.search(c,s,3),p=this.curves[f/3];switch(p){case 0:let m=c[f];u=c[f+1],d=c[f+2];let g=(s-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(s,f,1,p-2),d=this.getBezierValue(s,f,2,p+18-2)}switch(o){case Ae.setup:l.shearX=l.data.shearX+u*a,l.shearY=l.data.shearY+d*a;break;case Ae.first:case Ae.replace:l.shearX+=(l.data.shearX+u-l.shearX)*a,l.shearY+=(l.data.shearY+d-l.shearY)*a;break;case Ae.add:l.shearX+=u*a,l.shearY+=d*a}}},X1=class extends $s{constructor(t,i,s){super(t,i,xt.shearX+"|"+s);b(this,"boneIndex",0);this.boneIndex=s}apply(t,i,s,r,a,o,h){let l=t.bones[this.boneIndex];l.active&&(l.shearX=this.getRelativeValue(s,a,o,l.shearX,l.data.shearX))}},Y1=class extends $s{constructor(t,i,s){super(t,i,xt.shearY+"|"+s);b(this,"boneIndex",0);this.boneIndex=s}apply(t,i,s,r,a,o,h){let l=t.bones[this.boneIndex];l.active&&(l.shearY=this.getRelativeValue(s,a,o,l.shearY,l.data.shearY))}},V1=class extends Jt{constructor(t,i){super(t,[xt.inherit+"|"+i]);b(this,"boneIndex",0);this.boneIndex=i}getFrameEntries(){return 2}setFrame(t,i,s){t*=2,this.frames[t]=i,this.frames[t+1]=s}apply(t,i,s,r,a,o,h){let l=t.bones[this.boneIndex];if(!l.active)return;if(h==Yi.mixOut){o==Ae.setup&&(l.inherit=l.data.inherit);return}let c=this.frames;if(s<c[0]){(o==Ae.setup||o==Ae.first)&&(l.inherit=l.data.inherit);return}l.inherit=this.frames[Jt.search(c,s,2)+1]}},$1=class extends _n{constructor(t,i,s){super(t,i,[xt.rgb+"|"+s,xt.alpha+"|"+s]);b(this,"slotIndex",0);this.slotIndex=s}getFrameEntries(){return 5}setFrame(t,i,s,r,a,o){t*=5,this.frames[t]=i,this.frames[t+1]=s,this.frames[t+2]=r,this.frames[t+3]=a,this.frames[t+4]=o}apply(t,i,s,r,a,o,h){let l=t.slots[this.slotIndex];if(!l.bone.active)return;let c=this.frames,u=l.color;if(s<c[0]){let w=l.data.color;switch(o){case Ae.setup:u.setFromColor(w);return;case Ae.first:u.add((w.r-u.r)*a,(w.g-u.g)*a,(w.b-u.b)*a,(w.a-u.a)*a)}return}let d=0,f=0,p=0,m=0,g=Jt.search(c,s,5),y=this.curves[g/5];switch(y){case 0:let w=c[g];d=c[g+1],f=c[g+2],p=c[g+3],m=c[g+4];let v=(s-w)/(c[g+5]-w);d+=(c[g+5+1]-d)*v,f+=(c[g+5+2]-f)*v,p+=(c[g+5+3]-p)*v,m+=(c[g+5+4]-m)*v;break;case 1:d=c[g+1],f=c[g+2],p=c[g+3],m=c[g+4];break;default:d=this.getBezierValue(s,g,1,y-2),f=this.getBezierValue(s,g,2,y+18-2),p=this.getBezierValue(s,g,3,y+36-2),m=this.getBezierValue(s,g,4,y+54-2)}a==1?u.set(d,f,p,m):(o==Ae.setup&&u.setFromColor(l.data.color),u.add((d-u.r)*a,(f-u.g)*a,(p-u.b)*a,(m-u.a)*a))}},G1=class extends _n{constructor(t,i,s){super(t,i,[xt.rgb+"|"+s]);b(this,"slotIndex",0);this.slotIndex=s}getFrameEntries(){return 4}setFrame(t,i,s,r,a){t<<=2,this.frames[t]=i,this.frames[t+1]=s,this.frames[t+2]=r,this.frames[t+3]=a}apply(t,i,s,r,a,o,h){let l=t.slots[this.slotIndex];if(!l.bone.active)return;let c=this.frames,u=l.color;if(s<c[0]){let y=l.data.color;switch(o){case Ae.setup:u.r=y.r,u.g=y.g,u.b=y.b;return;case Ae.first:u.r+=(y.r-u.r)*a,u.g+=(y.g-u.g)*a,u.b+=(y.b-u.b)*a}return}let d=0,f=0,p=0,m=Jt.search(c,s,4),g=this.curves[m>>2];switch(g){case 0:let y=c[m];d=c[m+1],f=c[m+2],p=c[m+3];let w=(s-y)/(c[m+4]-y);d+=(c[m+4+1]-d)*w,f+=(c[m+4+2]-f)*w,p+=(c[m+4+3]-p)*w;break;case 1:d=c[m+1],f=c[m+2],p=c[m+3];break;default:d=this.getBezierValue(s,m,1,g-2),f=this.getBezierValue(s,m,2,g+18-2),p=this.getBezierValue(s,m,3,g+36-2)}if(a==1)u.r=d,u.g=f,u.b=p;else{if(o==Ae.setup){let y=l.data.color;u.r=y.r,u.g=y.g,u.b=y.b}u.r+=(d-u.r)*a,u.g+=(f-u.g)*a,u.b+=(p-u.b)*a}}},H1=class extends $s{constructor(t,i,s){super(t,i,xt.alpha+"|"+s);b(this,"slotIndex",0);this.slotIndex=s}apply(t,i,s,r,a,o,h){let l=t.slots[this.slotIndex];if(!l.bone.active)return;let c=l.color;if(s<this.frames[0]){let d=l.data.color;switch(o){case Ae.setup:c.a=d.a;return;case Ae.first:c.a+=(d.a-c.a)*a}return}let u=this.getCurveValue(s);a==1?c.a=u:(o==Ae.setup&&(c.a=l.data.color.a),c.a+=(u-c.a)*a)}},j1=class extends _n{constructor(t,i,s){super(t,i,[xt.rgb+"|"+s,xt.alpha+"|"+s,xt.rgb2+"|"+s]);b(this,"slotIndex",0);this.slotIndex=s}getFrameEntries(){return 8}setFrame(t,i,s,r,a,o,h,l,c){t<<=3,this.frames[t]=i,this.frames[t+1]=s,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,s,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(s<c[0]){let M=l.data.color,T=l.data.darkColor;switch(o){case Ae.setup:u.setFromColor(M),d.r=T.r,d.g=T.g,d.b=T.b;return;case Ae.first:u.add((M.r-u.r)*a,(M.g-u.g)*a,(M.b-u.b)*a,(M.a-u.a)*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,y=0,w=0,v=0,_=Jt.search(c,s,8),x=this.curves[_>>3];switch(x){case 0:let M=c[_];f=c[_+1],p=c[_+2],m=c[_+3],g=c[_+4],y=c[_+5],w=c[_+6],v=c[_+7];let T=(s-M)/(c[_+8]-M);f+=(c[_+8+1]-f)*T,p+=(c[_+8+2]-p)*T,m+=(c[_+8+3]-m)*T,g+=(c[_+8+4]-g)*T,y+=(c[_+8+5]-y)*T,w+=(c[_+8+6]-w)*T,v+=(c[_+8+7]-v)*T;break;case 1:f=c[_+1],p=c[_+2],m=c[_+3],g=c[_+4],y=c[_+5],w=c[_+6],v=c[_+7];break;default:f=this.getBezierValue(s,_,1,x-2),p=this.getBezierValue(s,_,2,x+18-2),m=this.getBezierValue(s,_,3,x+36-2),g=this.getBezierValue(s,_,4,x+54-2),y=this.getBezierValue(s,_,5,x+72-2),w=this.getBezierValue(s,_,6,x+90-2),v=this.getBezierValue(s,_,7,x+108-2)}if(a==1)u.set(f,p,m,g),d.r=y,d.g=w,d.b=v;else{if(o==Ae.setup){u.setFromColor(l.data.color);let M=l.data.darkColor;d.r=M.r,d.g=M.g,d.b=M.b}u.add((f-u.r)*a,(p-u.g)*a,(m-u.b)*a,(g-u.a)*a),d.r+=(y-d.r)*a,d.g+=(w-d.g)*a,d.b+=(v-d.b)*a}}},W1=class extends _n{constructor(t,i,s){super(t,i,[xt.rgb+"|"+s,xt.rgb2+"|"+s]);b(this,"slotIndex",0);this.slotIndex=s}getFrameEntries(){return 7}setFrame(t,i,s,r,a,o,h,l){t*=7,this.frames[t]=i,this.frames[t+1]=s,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,s,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(s<c[0]){let x=l.data.color,M=l.data.darkColor;switch(o){case Ae.setup:u.r=x.r,u.g=x.g,u.b=x.b,d.r=M.r,d.g=M.g,d.b=M.b;return;case Ae.first:u.r+=(x.r-u.r)*a,u.g+=(x.g-u.g)*a,u.b+=(x.b-u.b)*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,y=0,w=0,v=Jt.search(c,s,7),_=this.curves[v/7];switch(_){case 0:let x=c[v];f=c[v+1],p=c[v+2],m=c[v+3],g=c[v+4],y=c[v+5],w=c[v+6];let M=(s-x)/(c[v+7]-x);f+=(c[v+7+1]-f)*M,p+=(c[v+7+2]-p)*M,m+=(c[v+7+3]-m)*M,g+=(c[v+7+4]-g)*M,y+=(c[v+7+5]-y)*M,w+=(c[v+7+6]-w)*M;break;case 1:f=c[v+1],p=c[v+2],m=c[v+3],g=c[v+4],y=c[v+5],w=c[v+6];break;default:f=this.getBezierValue(s,v,1,_-2),p=this.getBezierValue(s,v,2,_+18-2),m=this.getBezierValue(s,v,3,_+36-2),g=this.getBezierValue(s,v,4,_+54-2),y=this.getBezierValue(s,v,5,_+72-2),w=this.getBezierValue(s,v,6,_+90-2)}if(a==1)u.r=f,u.g=p,u.b=m,d.r=g,d.g=y,d.b=w;else{if(o==Ae.setup){let x=l.data.color,M=l.data.darkColor;u.r=x.r,u.g=x.g,u.b=x.b,d.r=M.r,d.g=M.g,d.b=M.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+=(y-d.g)*a,d.b+=(w-d.b)*a}}},Ga=class extends Jt{constructor(t,i){super(t,[xt.attachment+"|"+i]);b(this,"slotIndex",0);b(this,"attachmentNames");this.slotIndex=i,this.attachmentNames=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,i,s){this.frames[t]=i,this.attachmentNames[t]=s}apply(t,i,s,r,a,o,h){let l=t.slots[this.slotIndex];if(l.bone.active){if(h==Yi.mixOut){o==Ae.setup&&this.setAttachment(t,l,l.data.attachmentName);return}if(s<this.frames[0]){(o==Ae.setup||o==Ae.first)&&this.setAttachment(t,l,l.data.attachmentName);return}this.setAttachment(t,l,this.attachmentNames[Jt.search1(this.frames,s)])}}setAttachment(t,i,s){i.setAttachment(s?t.getAttachment(this.slotIndex,s):null)}},z1=class extends _n{constructor(t,i,s,r){super(t,i,[xt.deform+"|"+s+"|"+r.id]);b(this,"slotIndex",0);b(this,"attachment");b(this,"vertices");this.slotIndex=s,this.attachment=r,this.vertices=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,i,s){this.frames[t]=i,this.vertices[t]=s}setBezier(t,i,s,r,a,o,h,l,c,u,d){let f=this.curves,p=this.getFrameCount()+t*18;s==0&&(f[i]=2+p);let m=(r-o*2+l)*.03,g=c*.03-h*.06,y=((o-l)*3-r+u)*.006,w=(h-c+.33333333)*.018,v=m*2+y,_=g*2+w,x=(o-r)*.3+m+y*.16666667,M=h*.3+g+w*.16666667,T=r+x,C=M;for(let I=p+18;p<I;p+=2)f[p]=T,f[p+1]=C,x+=v,M+=_,v+=y,_+=w,T+=x,C+=M}getCurvePercent(t,i){let s=this.curves,r=s[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,s[r]>t){let l=this.frames[i];return s[r+1]*(t-l)/(s[r]-l)}let a=r+18;for(r+=2;r<a;r+=2)if(s[r]>=t){let l=s[r-2],c=s[r-1];return c+(t-l)/(s[r]-l)*(s[r+1]-c)}let o=s[a-2],h=s[a-1];return h+(1-h)*(t-o)/(this.frames[i+this.getFrameEntries()]-o)}apply(t,i,s,r,a,o,h){let l=t.slots[this.slotIndex];if(!l.bone.active)return;let c=l.getAttachment();if(!c||!(c instanceof tr)||c.timelineAttachment!=this.attachment)return;let u=l.deform;u.length==0&&(o=Ae.setup);let d=this.vertices,f=d[0].length,p=this.frames;if(s<p[0]){switch(o){case Ae.setup:u.length=0;return;case Ae.first:if(a==1){u.length=0;return}u.length=f;let _=c;if(_.bones){a=1-a;for(var m=0;m<f;m++)u[m]*=a}else{let x=_.vertices;for(var m=0;m<f;m++)u[m]+=(x[m]-u[m])*a}}return}if(u.length=f,s>=p[p.length-1]){let _=d[p.length-1];if(a==1)if(o==Ae.add){let x=c;if(x.bones)for(let M=0;M<f;M++)u[M]+=_[M];else{let M=x.vertices;for(let T=0;T<f;T++)u[T]+=_[T]-M[T]}}else Ue.arrayCopy(_,0,u,0,f);else switch(o){case Ae.setup:{let M=c;if(M.bones)for(let T=0;T<f;T++)u[T]=_[T]*a;else{let T=M.vertices;for(let C=0;C<f;C++){let I=T[C];u[C]=I+(_[C]-I)*a}}break}case Ae.first:case Ae.replace:for(let M=0;M<f;M++)u[M]+=(_[M]-u[M])*a;break;case Ae.add:let x=c;if(x.bones)for(let M=0;M<f;M++)u[M]+=_[M]*a;else{let M=x.vertices;for(let T=0;T<f;T++)u[T]+=(_[T]-M[T])*a}}return}let g=Jt.search1(p,s),y=this.getCurvePercent(s,g),w=d[g],v=d[g+1];if(a==1)if(o==Ae.add){let _=c;if(_.bones)for(let x=0;x<f;x++){let M=w[x];u[x]+=M+(v[x]-M)*y}else{let x=_.vertices;for(let M=0;M<f;M++){let T=w[M];u[M]+=T+(v[M]-T)*y-x[M]}}}else for(let _=0;_<f;_++){let x=w[_];u[_]=x+(v[_]-x)*y}else switch(o){case Ae.setup:{let x=c;if(x.bones)for(let M=0;M<f;M++){let T=w[M];u[M]=(T+(v[M]-T)*y)*a}else{let M=x.vertices;for(let T=0;T<f;T++){let C=w[T],I=M[T];u[T]=I+(C+(v[T]-C)*y-I)*a}}break}case Ae.first:case Ae.replace:for(let x=0;x<f;x++){let M=w[x];u[x]+=(M+(v[x]-M)*y-u[x])*a}break;case Ae.add:let _=c;if(_.bones)for(let x=0;x<f;x++){let M=w[x];u[x]+=(M+(v[x]-M)*y)*a}else{let x=_.vertices;for(let M=0;M<f;M++){let T=w[M];u[M]+=(T+(v[M]-T)*y-x[M])*a}}}}};var ta;let Jm=(ta=class extends Jt{constructor(t){super(t,ta.propertyIds);b(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,s,r,a,o,h){if(!r)return;let l=this.frames,c=this.frames.length;if(i>s)this.apply(t,i,Number.MAX_VALUE,r,a,o,h),i=-1;else if(i>=l[c-1])return;if(s<l[0])return;let u=0;if(i<l[0])u=0;else{u=Jt.search1(l,i)+1;let d=l[u];for(;u>0&&l[u-1]==d;)u--}for(;u<c&&s>=l[u];u++)r.push(this.events[u])}},b(ta,"propertyIds",[""+xt.event]),ta);var ia;let el=(ia=class extends Jt{constructor(t){super(t,ia.propertyIds);b(this,"drawOrders");this.drawOrders=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,i,s){this.frames[t]=i,this.drawOrders[t]=s}apply(t,i,s,r,a,o,h){if(h==Yi.mixOut){o==Ae.setup&&Ue.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);return}if(s<this.frames[0]){(o==Ae.setup||o==Ae.first)&&Ue.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);return}let l=Jt.search1(this.frames,s),c=this.drawOrders[l];if(!c)Ue.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]]}}},b(ia,"propertyIds",[""+xt.drawOrder]),ia),q1=class extends _n{constructor(t,i,s){super(t,i,[xt.ikConstraint+"|"+s]);b(this,"constraintIndex",0);this.constraintIndex=s}getFrameEntries(){return 6}setFrame(t,i,s,r,a,o,h){t*=6,this.frames[t]=i,this.frames[t+1]=s,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,s,r,a,o,h){let l=t.ikConstraints[this.constraintIndex];if(!l.active)return;let c=this.frames;if(s<c[0]){switch(o){case Ae.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 Ae.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=Jt.search(c,s,6),p=this.curves[f/6];switch(p){case 0:let m=c[f];u=c[f+1],d=c[f+2];let g=(s-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(s,f,1,p-2),d=this.getBezierValue(s,f,2,p+18-2)}o==Ae.setup?(l.mix=l.data.mix+(u-l.data.mix)*a,l.softness=l.data.softness+(d-l.data.softness)*a,h==Yi.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==Yi.mixIn&&(l.bendDirection=c[f+3],l.compress=c[f+4]!=0,l.stretch=c[f+5]!=0))}},K1=class extends _n{constructor(t,i,s){super(t,i,[xt.transformConstraint+"|"+s]);b(this,"constraintIndex",0);this.constraintIndex=s}getFrameEntries(){return 7}setFrame(t,i,s,r,a,o,h,l){let c=this.frames;t*=7,c[t]=i,c[t+1]=s,c[t+2]=r,c[t+3]=a,c[t+4]=o,c[t+5]=h,c[t+6]=l}apply(t,i,s,r,a,o,h){let l=t.transformConstraints[this.constraintIndex];if(!l.active)return;let c=this.frames;if(s<c[0]){let v=l.data;switch(o){case Ae.setup:l.mixRotate=v.mixRotate,l.mixX=v.mixX,l.mixY=v.mixY,l.mixScaleX=v.mixScaleX,l.mixScaleY=v.mixScaleY,l.mixShearY=v.mixShearY;return;case Ae.first:l.mixRotate+=(v.mixRotate-l.mixRotate)*a,l.mixX+=(v.mixX-l.mixX)*a,l.mixY+=(v.mixY-l.mixY)*a,l.mixScaleX+=(v.mixScaleX-l.mixScaleX)*a,l.mixScaleY+=(v.mixScaleY-l.mixScaleY)*a,l.mixShearY+=(v.mixShearY-l.mixShearY)*a}return}let u,d,f,p,m,g,y=Jt.search(c,s,7),w=this.curves[y/7];switch(w){case 0:let v=c[y];u=c[y+1],d=c[y+2],f=c[y+3],p=c[y+4],m=c[y+5],g=c[y+6];let _=(s-v)/(c[y+7]-v);u+=(c[y+7+1]-u)*_,d+=(c[y+7+2]-d)*_,f+=(c[y+7+3]-f)*_,p+=(c[y+7+4]-p)*_,m+=(c[y+7+5]-m)*_,g+=(c[y+7+6]-g)*_;break;case 1:u=c[y+1],d=c[y+2],f=c[y+3],p=c[y+4],m=c[y+5],g=c[y+6];break;default:u=this.getBezierValue(s,y,1,w-2),d=this.getBezierValue(s,y,2,w+18-2),f=this.getBezierValue(s,y,3,w+36-2),p=this.getBezierValue(s,y,4,w+54-2),m=this.getBezierValue(s,y,5,w+72-2),g=this.getBezierValue(s,y,6,w+90-2)}if(o==Ae.setup){let v=l.data;l.mixRotate=v.mixRotate+(u-v.mixRotate)*a,l.mixX=v.mixX+(d-v.mixX)*a,l.mixY=v.mixY+(f-v.mixY)*a,l.mixScaleX=v.mixScaleX+(p-v.mixScaleX)*a,l.mixScaleY=v.mixScaleY+(m-v.mixScaleY)*a,l.mixShearY=v.mixShearY+(g-v.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}},Z1=class extends $s{constructor(t,i,s){super(t,i,xt.pathConstraintPosition+"|"+s);b(this,"constraintIndex",0);this.constraintIndex=s}apply(t,i,s,r,a,o,h){let l=t.pathConstraints[this.constraintIndex];l.active&&(l.position=this.getAbsoluteValue(s,a,o,l.position,l.data.position))}},J1=class extends $s{constructor(t,i,s){super(t,i,xt.pathConstraintSpacing+"|"+s);b(this,"constraintIndex",0);this.constraintIndex=s}apply(t,i,s,r,a,o,h){let l=t.pathConstraints[this.constraintIndex];l.active&&(l.spacing=this.getAbsoluteValue(s,a,o,l.spacing,l.data.spacing))}},Q1=class extends _n{constructor(t,i,s){super(t,i,[xt.pathConstraintMix+"|"+s]);b(this,"constraintIndex",0);this.constraintIndex=s}getFrameEntries(){return 4}setFrame(t,i,s,r,a){let o=this.frames;t<<=2,o[t]=i,o[t+1]=s,o[t+2]=r,o[t+3]=a}apply(t,i,s,r,a,o,h){let l=t.pathConstraints[this.constraintIndex];if(!l.active)return;let c=this.frames;if(s<c[0]){switch(o){case Ae.setup:l.mixRotate=l.data.mixRotate,l.mixX=l.data.mixX,l.mixY=l.data.mixY;return;case Ae.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=Jt.search(c,s,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 y=(s-g)/(c[p+4]-g);u+=(c[p+4+1]-u)*y,d+=(c[p+4+2]-d)*y,f+=(c[p+4+3]-f)*y;break;case 1:u=c[p+1],d=c[p+2],f=c[p+3];break;default:u=this.getBezierValue(s,p,1,m-2),d=this.getBezierValue(s,p,2,m+18-2),f=this.getBezierValue(s,p,3,m+36-2)}if(o==Ae.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 $s{constructor(t,i,s,r){super(t,i,r+"|"+s);b(this,"constraintIndex",0);this.constraintIndex=s}apply(t,i,s,r,a,o,h){let l;if(this.constraintIndex==-1){const c=s>=this.frames[0]?this.getCurveValue(s):0;for(const u of t.physicsConstraints)u.active&&this.global(u.data)&&this.set(u,this.getAbsoluteValue2(s,a,o,this.get(u),this.setup(u),c))}else l=t.physicsConstraints[this.constraintIndex],l.active&&this.set(l,this.getAbsoluteValue(s,a,o,this.get(l),this.setup(l)))}},eb=class extends xa{constructor(e,t,i){super(e,t,i,xt.physicsConstraintInertia)}setup(e){return e.data.inertia}get(e){return e.inertia}set(e,t){e.inertia=t}global(e){return e.inertiaGlobal}},tb=class extends xa{constructor(e,t,i){super(e,t,i,xt.physicsConstraintStrength)}setup(e){return e.data.strength}get(e){return e.strength}set(e,t){e.strength=t}global(e){return e.strengthGlobal}},ib=class extends xa{constructor(e,t,i){super(e,t,i,xt.physicsConstraintDamping)}setup(e){return e.data.damping}get(e){return e.damping}set(e,t){e.damping=t}global(e){return e.dampingGlobal}},sb=class extends xa{constructor(e,t,i){super(e,t,i,xt.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}},nb=class extends xa{constructor(e,t,i){super(e,t,i,xt.physicsConstraintWind)}setup(e){return e.data.wind}get(e){return e.wind}set(e,t){e.wind=t}global(e){return e.windGlobal}},rb=class extends xa{constructor(e,t,i){super(e,t,i,xt.physicsConstraintGravity)}setup(e){return e.data.gravity}get(e){return e.gravity}set(e,t){e.gravity=t}global(e){return e.gravityGlobal}},ab=class extends xa{constructor(e,t,i){super(e,t,i,xt.physicsConstraintMix)}setup(e){return e.data.mix}get(e){return e.mix}set(e,t){e.mix=t}global(e){return e.mixGlobal}};var sa;let ob=(sa=class extends Jt{constructor(t,i){super(t,sa.propertyIds);b(this,"constraintIndex");this.constraintIndex=i}getFrameCount(){return this.frames.length}setFrame(t,i){this.frames[t]=i}apply(t,i,s,r,a,o,h){let l;if(this.constraintIndex!=-1&&(l=t.physicsConstraints[this.constraintIndex],!l.active))return;const c=this.frames;if(i>s)this.apply(t,i,Number.MAX_VALUE,[],a,o,h),i=-1;else if(i>=c[c.length-1])return;if(!(s<c[0])&&(i<c[0]||s>=c[Jt.search1(c,i)+1]))if(l!=null)l.reset();else for(const u of t.physicsConstraints)u.active&&u.reset()}},b(sa,"propertyIds",[xt.physicsConstraintReset.toString()]),sa);var Hi;let lb=(Hi=class extends Jt{constructor(t,i,s){super(t,[xt.sequence+"|"+i+"|"+s.sequence.id]);b(this,"slotIndex");b(this,"attachment");this.slotIndex=i,this.attachment=s}getFrameEntries(){return Hi.ENTRIES}getSlotIndex(){return this.slotIndex}getAttachment(){return this.attachment}setFrame(t,i,s,r,a){let o=this.frames;t*=Hi.ENTRIES,o[t]=i,o[t+Hi.MODE]=s|r<<4,o[t+Hi.DELAY]=a}apply(t,i,s,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 tr)||c.timelineAttachment!=u))return;if(h==Yi.mixOut){o==Ae.setup&&(l.sequenceIndex=-1);return}let d=this.frames;if(s<d[0]){(o==Ae.setup||o==Ae.first)&&(l.sequenceIndex=-1);return}let f=Jt.search(d,s,Hi.ENTRIES),p=d[f],m=d[f+Hi.MODE],g=d[f+Hi.DELAY];if(!this.attachment.sequence)return;let y=m>>4,w=this.attachment.sequence.regions.length,v=k1[m&15];if(v!=Ri.hold)switch(y+=(s-p)/g+1e-5|0,v){case Ri.once:y=Math.min(w-1,y);break;case Ri.loop:y%=w;break;case Ri.pingpong:{let _=(w<<1)-2;y=_==0?0:y%_,y>=w&&(y=_-y);break}case Ri.onceReverse:y=Math.max(w-1-y,0);break;case Ri.loopReverse:y=w-1-y%w;break;case Ri.pingpongReverse:{let _=(w<<1)-2;y=_==0?0:(y+w-1)%_,y>=w&&(y=_-y)}}l.sequenceIndex=y}},b(Hi,"ENTRIES",3),b(Hi,"MODE",1),b(Hi,"DELAY",2),Hi);var jn;let Q2=(jn=class{constructor(e){b(this,"data");b(this,"tracks",new Array);b(this,"timeScale",1);b(this,"unkeyedState",0);b(this,"events",new Array);b(this,"listeners",new Array);b(this,"queue",new tI(this));b(this,"propertyIDs",new I1);b(this,"animationsChanged",!1);b(this,"trackEntryPool",new oh(()=>new eI));this.data=e}static emptyAnimation(){return jn._emptyAnimation}update(e){e*=this.timeScale;let t=this.tracks;for(let i=0,s=t.length;i<s;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 s=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)),s):(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,s=!1;for(let d=0,f=i.length;d<f;d++){let p=i[d];if(!p||p.delay>0)continue;s=!0;let m=d==0?Ae.first:p.mixBlend,g=p.alpha;p.mixingFrom?g*=this.applyMixingFrom(p,e,m):p.trackTime>=p.trackEnd&&!p.next&&(g=0);let y=g>=p.alphaAttachmentThreshold,w=p.animationLast,v=p.getAnimationTime(),_=v,x=t;p.reverse&&(_=p.animation.duration-_,x=null);let M=p.animation.timelines,T=M.length;if(d==0&&g==1||m==Ae.add){d==0&&(y=!0);for(let C=0;C<T;C++){var r=M[C];r instanceof Ga?this.applyAttachmentTimeline(r,e,_,m,y):r.apply(e,w,_,x,g,m,Yi.mixIn)}}else{let C=p.timelineMode,I=p.shortestRotation,k=!I&&p.timelinesRotation.length!=T<<1;k&&(p.timelinesRotation.length=T<<1);for(let R=0;R<T;R++){let F=M[R],B=C[R]==Gd?m:Ae.setup;!I&&F instanceof ch?this.applyRotateTimeline(F,e,_,g,B,p.timelinesRotation,R<<1,k):F instanceof Ga?this.applyAttachmentTimeline(F,e,_,m,y):F.apply(e,w,_,x,g,B,Yi.mixIn)}}this.queueEvents(p,v),t.length=0,p.nextAnimationLast=v,p.nextTrackLast=p.trackTime}for(var a=this.unkeyedState+nv,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(),s}applyMixingFrom(e,t,i){let s=e.mixingFrom;s.mixingFrom&&this.applyMixingFrom(s,t,i);let r=0;e.mixDuration==0?(r=1,i==Ae.first&&(i=Ae.setup)):(r=e.mixTime/e.mixDuration,r>1&&(r=1),i!=Ae.first&&(i=s.mixBlend));let a=r<s.mixAttachmentThreshold,o=r<s.mixDrawOrderThreshold,h=s.animation.timelines,l=h.length,c=s.alpha*e.interruptAlpha,u=c*(1-r),d=s.animationLast,f=s.getAnimationTime(),p=f,m=null;if(s.reverse?p=s.animation.duration-p:r<s.eventThreshold&&(m=this.events),i==Ae.add)for(let g=0;g<l;g++)h[g].apply(t,d,p,m,u,i,Yi.mixOut);else{let g=s.timelineMode,y=s.timelineHoldMix,w=s.shortestRotation,v=!w&&s.timelinesRotation.length!=l<<1;v&&(s.timelinesRotation.length=l<<1),s.totalAlpha=0;for(let _=0;_<l;_++){let x=h[_],M=Yi.mixOut,T,C=0;switch(g[_]){case Gd:if(!o&&x instanceof el)continue;T=i,C=u;break;case iv:T=Ae.setup,C=u;break;case sv:T=i,C=c;break;case Hd:T=Ae.setup,C=c;break;default:T=Ae.setup;let I=y[_];C=c*Math.max(0,1-I.mixTime/I.mixDuration);break}s.totalAlpha+=C,!w&&x instanceof ch?this.applyRotateTimeline(x,t,p,C,T,s.timelinesRotation,_<<1,v):x instanceof Ga?this.applyAttachmentTimeline(x,t,p,T,a&&C>=s.alphaAttachmentThreshold):(o&&x instanceof el&&T==Ae.setup&&(M=Yi.mixIn),x.apply(t,d,p,m,C,T,M))}}return e.mixDuration>0&&this.queueEvents(s,f),this.events.length=0,s.nextAnimationLast=f,s.nextTrackLast=s.trackTime,r}applyAttachmentTimeline(e,t,i,s,r){var a=t.slots[e.slotIndex];a.bone.active&&(i<e.frames[0]?(s==Ae.setup||s==Ae.first)&&this.setAttachment(t,a,a.data.attachmentName,r):this.setAttachment(t,a,e.attachmentNames[Jt.search1(e.frames,i)],r),a.attachmentState<=this.unkeyedState&&(a.attachmentState=this.unkeyedState+nv))}setAttachment(e,t,i,s){t.setAttachment(i?e.getAttachment(t.data.index,i):null),s&&(t.attachmentState=this.unkeyedState+sI)}applyRotateTimeline(e,t,i,s,r,a,o,h){if(h&&(a[o]=0),s==1){e.apply(t,0,i,null,1,r,Yi.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 Ae.setup:l.rotation=l.data.rotation;default:return;case Ae.first:u=l.rotation,d=l.data.rotation}else u=r==Ae.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 y=m-m%360;f=p+y;let w=p>=0,v=m>=0;Math.abs(g)<=90&&Ne.signum(g)!=Ne.signum(p)&&(Math.abs(m-y)>180?(f+=360*Ne.signum(m),v=w):y!=0?f-=360*Ne.signum(m):v=w),v!=w&&(f+=360*Ne.signum(m)),a[o]=f}a[o+1]=p,l.rotation=u+f*s}queueEvents(e,t){let i=e.animationStart,s=e.animationEnd,r=s-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>s||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>=s&&e.animationLast<s;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 s=i.mixingFrom;if(!s)break;this.queue.end(s),i.mixingFrom=null,i.mixingTo=null,i=s}this.tracks[t.trackIndex]=null,this.queue.drain()}setCurrent(e,t,i){let s=this.expandToIndex(e);this.tracks[e]=t,t.previous=null,s&&(i&&this.queue.interrupt(s),t.mixingFrom=s,s.mixingTo=t,t.mixTime=0,s.mixingFrom&&s.mixDuration>0&&(t.interruptAlpha*=Math.min(1,s.mixTime/s.mixDuration)),s.timelinesRotation.length=0),this.queue.start(t)}setAnimation(e,t,i=!1){let s=this.data.skeletonData.findAnimation(t);if(!s)throw new Error("Animation not found: "+t);return this.setAnimationWith(e,s,i)}setAnimationWith(e,t,i=!1){if(!t)throw new Error("animation cannot be null.");let s=!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,s=!1):this.clearNext(r));let a=this.trackEntry(e,t,i,r);return this.setCurrent(e,a,s),this.queue.drain(),a}addAnimation(e,t,i=!1,s=0){let r=this.data.skeletonData.findAnimation(t);if(!r)throw new Error("Animation not found: "+t);return this.addAnimationWith(e,r,i,s)}addAnimationWith(e,t,i=!1,s=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,s<=0&&(s=Math.max(s+r.getTrackComplete()-a.mixDuration,0))):(this.setCurrent(e,a,!0),this.queue.drain(),s<0&&(s=0)),a.delay=s,a}setEmptyAnimation(e,t=0){let i=this.setAnimationWith(e,jn.emptyAnimation(),!1);return i.mixDuration=t,i.trackEnd=t,i}addEmptyAnimation(e,t=0,i=0){let s=this.addAnimationWith(e,jn.emptyAnimation(),!1,i);return i<=0&&(s.delay=Math.max(s.delay+s.mixDuration-t,0)),s.mixDuration=t,s.trackEnd=t,s}setEmptyAnimations(e=0){let t=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let i=0,s=this.tracks.length;i<s;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]:(Ue.ensureArrayCapacity(this.tracks,e+1,null),this.tracks.length=e+1,null)}trackEntry(e,t,i,s){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=s?this.data.getMix(s.animation,t):0,r.interruptAlpha=1,r.totalAlpha=0,r.mixBlend=Ae.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 s=e[t];if(s){for(;s.mixingFrom;)s=s.mixingFrom;do(!s.mixingTo||s.mixBlend!=Ae.add)&&this.computeHold(s),s=s.mixingTo;while(s)}}}computeHold(e){let t=e.mixingTo,i=e.animation.timelines,s=e.animation.timelines.length,r=e.timelineMode;r.length=s;let a=e.timelineHoldMix;a.length=0;let o=this.propertyIDs;if(t&&t.holdPrevious){for(let h=0;h<s;h++)r[h]=o.addAll(i[h].getPropertyIds())?Hd:sv;return}e:for(let h=0;h<s;h++){let l=i[h],c=l.getPropertyIds();if(!o.addAll(c))r[h]=Gd;else if(!t||l instanceof Ga||l instanceof el||l instanceof Jm||!t.animation.hasTimeline(c))r[h]=iv;else{for(let u=t.mixingTo;u;u=u.mixingTo)if(!u.animation.hasTimeline(c)){if(e.mixDuration>0){r[h]=iI,a[h]=u;continue e}break}r[h]=Hd}}}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()}},b(jn,"_emptyAnimation",new Km("<empty>",[],0)),jn),eI=class{constructor(){b(this,"animation",null);b(this,"previous",null);b(this,"next",null);b(this,"mixingFrom",null);b(this,"mixingTo",null);b(this,"listener",null);b(this,"trackIndex",0);b(this,"loop",!1);b(this,"holdPrevious",!1);b(this,"reverse",!1);b(this,"shortestRotation",!1);b(this,"eventThreshold",0);b(this,"mixAttachmentThreshold",0);b(this,"alphaAttachmentThreshold",0);b(this,"mixDrawOrderThreshold",0);b(this,"animationStart",0);b(this,"animationEnd",0);b(this,"animationLast",0);b(this,"nextAnimationLast",0);b(this,"delay",0);b(this,"trackTime",0);b(this,"trackLast",0);b(this,"nextTrackLast",0);b(this,"trackEnd",0);b(this,"timeScale",0);b(this,"alpha",0);b(this,"mixTime",0);b(this,"_mixDuration",0);b(this,"interruptAlpha",0);b(this,"totalAlpha",0);b(this,"mixBlend",Ae.replace);b(this,"timelineMode",new Array);b(this,"timelineHoldMix",new Array);b(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}},tI=class{constructor(e){b(this,"objects",[]);b(this,"drainDisabled",!1);b(this,"animState");this.animState=e}start(e){this.objects.push(Qi.start),this.objects.push(e),this.animState.animationsChanged=!0}interrupt(e){this.objects.push(Qi.interrupt),this.objects.push(e)}end(e){this.objects.push(Qi.end),this.objects.push(e),this.animState.animationsChanged=!0}dispose(e){this.objects.push(Qi.dispose),this.objects.push(e)}complete(e){this.objects.push(Qi.complete),this.objects.push(e)}event(e,t){this.objects.push(Qi.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],s=e[t+1],r=this.animState.listeners.slice();switch(i){case Qi.start:s.listener&&s.listener.start&&s.listener.start(s);for(let o=0;o<r.length;o++){let h=r[o];h.start&&h.start(s)}break;case Qi.interrupt:s.listener&&s.listener.interrupt&&s.listener.interrupt(s);for(let o=0;o<r.length;o++){let h=r[o];h.interrupt&&h.interrupt(s)}break;case Qi.end:s.listener&&s.listener.end&&s.listener.end(s);for(let o=0;o<r.length;o++){let h=r[o];h.end&&h.end(s)}case Qi.dispose:s.listener&&s.listener.dispose&&s.listener.dispose(s);for(let o=0;o<r.length;o++){let h=r[o];h.dispose&&h.dispose(s)}this.animState.trackEntryPool.free(s);break;case Qi.complete:s.listener&&s.listener.complete&&s.listener.complete(s);for(let o=0;o<r.length;o++){let h=r[o];h.complete&&h.complete(s)}break;case Qi.event:let a=e[t+++2];s.listener&&s.listener.event&&s.listener.event(s,a);for(let o=0;o<r.length;o++){let h=r[o];h.event&&h.event(s,a)}break}}this.clear(),this.drainDisabled=!1}clear(){this.objects.length=0}};var Qi;(function(n){n[n.start=0]="start",n[n.interrupt=1]="interrupt",n[n.end=2]="end",n[n.dispose=3]="dispose",n[n.complete=4]="complete",n[n.event=5]="event"})(Qi||(Qi={}));const Gd=0,iv=1,sv=2,Hd=3,iI=4,nv=1,sI=2;class nI{constructor(e){b(this,"skeletonData");b(this,"animationToMixTime",{});b(this,"defaultMix",0);if(!e)throw new Error("skeletonData cannot be null.");this.skeletonData=e}setMix(e,t,i){let s=this.skeletonData.findAnimation(e);if(!s)throw new Error("Animation not found: "+e);let r=this.skeletonData.findAnimation(t);if(!r)throw new Error("Animation not found: "+t);this.setMixWith(s,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 s=e.name+"."+t.name;this.animationToMixTime[s]=i}getMix(e,t){let i=e.name+"."+t.name,s=this.animationToMixTime[i];return s===void 0?this.defaultMix:s}}let cb=class hb extends tr{constructor(t){super(t);b(this,"color",new gt(1,1,1,1))}copy(){let t=new hb(this.name);return this.copyTo(t),t.color.setFromColor(this.color),t}},no=class ub extends tr{constructor(t){super(t);b(this,"endSlot",null);b(this,"color",new gt(.2275,.2275,.8078,1))}copy(){let t=new ub(this.name);return this.copyTo(t),t.endSlot=this.endSlot,t.color.setFromColor(this.color),t}},rI=class{constructor(e){b(this,"_image");this._image=e}getImage(){return this._image}};var Mi;(function(n){n[n.Nearest=9728]="Nearest",n[n.Linear=9729]="Linear",n[n.MipMap=9987]="MipMap",n[n.MipMapNearestNearest=9984]="MipMapNearestNearest",n[n.MipMapLinearNearest=9985]="MipMapLinearNearest",n[n.MipMapNearestLinear=9986]="MipMapNearestLinear",n[n.MipMapLinearLinear=9987]="MipMapLinearLinear"})(Mi||(Mi={}));var qn;(function(n){n[n.MirroredRepeat=33648]="MirroredRepeat",n[n.ClampToEdge=33071]="ClampToEdge",n[n.Repeat=10497]="Repeat"})(qn||(qn={}));let aI=class{constructor(){b(this,"texture");b(this,"u",0);b(this,"v",0);b(this,"u2",0);b(this,"v2",0);b(this,"width",0);b(this,"height",0);b(this,"degrees",0);b(this,"offsetX",0);b(this,"offsetY",0);b(this,"originalWidth",0);b(this,"originalHeight",0)}},db=class{constructor(e){b(this,"pages",new Array);b(this,"regions",new Array);let t=new oI(e),i=new Array(4),s={};s.size=c=>{c.width=parseInt(i[1]),c.height=parseInt(i[2])},s.format=()=>{},s.filter=c=>{c.minFilter=Ue.enumValue(Mi,i[1]),c.magFilter=Ue.enumValue(Mi,i[2])},s.repeat=c=>{i[1].indexOf("x")!=-1&&(c.uWrap=qn.Repeat),i[1].indexOf("y")!=-1&&(c.vWrap=qn.Repeat)},s.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 fb(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 lI(a.trim());t.readEntry(i,a=t.readLine())!=0;){let c=s[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()}},oI=class{constructor(e){b(this,"lines");b(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 s=1,r=i+1;;s++){let a=t.indexOf(",",r);if(a==-1)return e[s]=t.substr(r).trim(),s;if(e[s]=t.substr(r,a-r).trim(),r=a+1,s==4)return 4}}},lI=class{constructor(e){b(this,"name");b(this,"minFilter",Mi.Nearest);b(this,"magFilter",Mi.Nearest);b(this,"uWrap",qn.ClampToEdge);b(this,"vWrap",qn.ClampToEdge);b(this,"texture",null);b(this,"width",0);b(this,"height",0);b(this,"pma",!1);b(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}},fb=class extends aI{constructor(t,i){super();b(this,"page");b(this,"name");b(this,"x",0);b(this,"y",0);b(this,"offsetX",0);b(this,"offsetY",0);b(this,"originalWidth",0);b(this,"originalHeight",0);b(this,"index",0);b(this,"degrees",0);b(this,"names",null);b(this,"values",null);this.page=t,this.name=i,t.regions.push(this)}},Pl=class zf extends tr{constructor(t,i){super(t);b(this,"region",null);b(this,"path");b(this,"regionUVs",[]);b(this,"uvs",[]);b(this,"triangles",[]);b(this,"color",new gt(1,1,1,1));b(this,"width",0);b(this,"height",0);b(this,"hullLength",0);b(this,"edges",[]);b(this,"parentMesh",null);b(this,"sequence",null);b(this,"tempColor",new gt(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=Ue.newFloatArray(t.length));let i=this.uvs,s=this.uvs.length,r=this.region.u,a=this.region.v,o=0,h=0;if(this.region instanceof fb){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<s;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<s;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<s;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<s;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 zf(this.name,this.path);return t.region=this.region,t.color.setFromColor(this.color),this.copyTo(t),t.regionUVs=new Array(this.regionUVs.length),Ue.arrayCopy(this.regionUVs,0,t.regionUVs,0,this.regionUVs.length),t.uvs=this.uvs instanceof Float32Array?Ue.newFloatArray(this.uvs.length):new Array(this.uvs.length),Ue.arrayCopy(this.uvs,0,t.uvs,0,this.uvs.length),t.triangles=new Array(this.triangles.length),Ue.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),Ue.arrayCopy(this.edges,0,t.edges,0,this.edges.length)),t.width=this.width,t.height=this.height,t}computeWorldVertices(t,i,s,r,a,o){this.sequence!=null&&this.sequence.apply(t,this),super.computeWorldVertices(t,i,s,r,a,o)}newLinkedMesh(){let t=new zf(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}},xl=class mb extends tr{constructor(t){super(t);b(this,"lengths",[]);b(this,"closed",!1);b(this,"constantSpeed",!1);b(this,"color",new gt(1,1,1,1))}copy(){let t=new mb(this.name);return this.copyTo(t),t.lengths=new Array(this.lengths.length),Ue.arrayCopy(this.lengths,0,t.lengths,0,this.lengths.length),t.closed=closed,t.constantSpeed=this.constantSpeed,t.color.setFromColor(this.color),t}},pb=class gb extends tr{constructor(t){super(t);b(this,"x",0);b(this,"y",0);b(this,"rotation",0);b(this,"color",new gt(.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*Ne.degRad,s=Math.cos(i),r=Math.sin(i),a=s*t.a+r*t.b,o=s*t.c+r*t.d;return Ne.atan2Deg(o,a)}copy(){let t=new gb(this.name);return t.x=this.x,t.y=this.y,t.rotation=this.rotation,t.color.setFromColor(this.color),t}};var _t;let Qh=(_t=class extends R1{constructor(t,i){super(t);b(this,"x",0);b(this,"y",0);b(this,"scaleX",1);b(this,"scaleY",1);b(this,"rotation",0);b(this,"width",0);b(this,"height",0);b(this,"color",new gt(1,1,1,1));b(this,"path");b(this,"region",null);b(this,"sequence",null);b(this,"offset",Ue.newFloatArray(8));b(this,"uvs",Ue.newFloatArray(8));b(this,"tempColor",new gt(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 s=this.width/this.region.originalWidth*this.scaleX,r=this.height/this.region.originalHeight*this.scaleY,a=-this.width/2*this.scaleX+this.region.offsetX*s,o=-this.height/2*this.scaleY+this.region.offsetY*r,h=a+this.region.width*s,l=o+this.region.height*r,c=this.rotation*Ne.degRad,u=Math.cos(c),d=Math.sin(c),f=this.x,p=this.y,m=a*u+f,g=a*d,y=o*u+p,w=o*d,v=h*u+f,_=h*d,x=l*u+p,M=l*d,T=this.offset;T[0]=m-w,T[1]=y+g,T[2]=m-M,T[3]=x+g,T[4]=v-M,T[5]=x+_,T[6]=v-w,T[7]=y+_,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,s,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[s]=p*c+m*u+h,i[s+1]=p*d+m*f+l,s+=r,p=o[2],m=o[3],i[s]=p*c+m*u+h,i[s+1]=p*d+m*f+l,s+=r,p=o[4],m=o[5],i[s]=p*c+m*u+h,i[s+1]=p*d+m*f+l,s+=r,p=o[6],m=o[7],i[s]=p*c+m*u+h,i[s+1]=p*d+m*f+l}copy(){let t=new _t(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,Ue.arrayCopy(this.uvs,0,t.uvs,0,8),Ue.arrayCopy(this.offset,0,t.offset,0,8),t.color.setFromColor(this.color),t.sequence=this.sequence!=null?this.sequence.copy():null,t}},b(_t,"X1",0),b(_t,"Y1",1),b(_t,"C1R",2),b(_t,"C1G",3),b(_t,"C1B",4),b(_t,"C1A",5),b(_t,"U1",6),b(_t,"V1",7),b(_t,"X2",8),b(_t,"Y2",9),b(_t,"C2R",10),b(_t,"C2G",11),b(_t,"C2B",12),b(_t,"C2A",13),b(_t,"U2",14),b(_t,"V2",15),b(_t,"X3",16),b(_t,"Y3",17),b(_t,"C3R",18),b(_t,"C3G",19),b(_t,"C3B",20),b(_t,"C3A",21),b(_t,"U3",22),b(_t,"V3",23),b(_t,"X4",24),b(_t,"Y4",25),b(_t,"C4R",26),b(_t,"C4G",27),b(_t,"C4B",28),b(_t,"C4A",29),b(_t,"U4",30),b(_t,"V4",31),_t);class qf{constructor(e){b(this,"atlas");this.atlas=e}loadSequence(e,t,i){let s=i.regions;for(let r=0,a=s.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+")");s[r]=h}}newRegionAttachment(e,t,i,s){let r=new Qh(t,i);if(s!=null)this.loadSequence(t,i,s);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,s){let r=new Pl(t,i);if(s!=null)this.loadSequence(t,i,s);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 cb(t)}newPathAttachment(e,t){return new xl(t)}newPointAttachment(e,t){return new pb(t)}newClippingAttachment(e,t){return new no(t)}}let vb=class{constructor(e,t,i){b(this,"index",0);b(this,"name");b(this,"parent",null);b(this,"length",0);b(this,"x",0);b(this,"y",0);b(this,"rotation",0);b(this,"scaleX",1);b(this,"scaleY",1);b(this,"shearX",0);b(this,"shearY",0);b(this,"inherit",ni.Normal);b(this,"skinRequired",!1);b(this,"color",new gt);b(this,"icon");b(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 ni;(function(n){n[n.Normal=0]="Normal",n[n.OnlyTranslation=1]="OnlyTranslation",n[n.NoRotationOrReflection=2]="NoRotationOrReflection",n[n.NoScale=3]="NoScale",n[n.NoScaleOrReflection=4]="NoScaleOrReflection"})(ni||(ni={}));let rv=class{constructor(e,t,i){b(this,"data");b(this,"skeleton");b(this,"parent",null);b(this,"children",new Array);b(this,"x",0);b(this,"y",0);b(this,"rotation",0);b(this,"scaleX",0);b(this,"scaleY",0);b(this,"shearX",0);b(this,"shearY",0);b(this,"ax",0);b(this,"ay",0);b(this,"arotation",0);b(this,"ascaleX",0);b(this,"ascaleY",0);b(this,"ashearX",0);b(this,"ashearY",0);b(this,"a",0);b(this,"b",0);b(this,"c",0);b(this,"d",0);b(this,"worldY",0);b(this,"worldX",0);b(this,"inherit",ni.Normal);b(this,"sorted",!1);b(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,s,r,a,o){this.ax=e,this.ay=t,this.arotation=i,this.ascaleX=s,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)*Ne.degRad,y=(i+90+o)*Ne.degRad;this.a=Math.cos(g)*s*p,this.b=Math.cos(y)*r*p,this.c=Math.sin(g)*s*m,this.d=Math.sin(y)*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 ni.Normal:{const f=(i+a)*Ne.degRad,p=(i+90+o)*Ne.degRad,m=Math.cos(f)*s,g=Math.cos(p)*r,y=Math.sin(f)*s,w=Math.sin(p)*r;this.a=l*m+c*y,this.b=l*g+c*w,this.c=u*m+d*y,this.d=u*g+d*w;return}case ni.OnlyTranslation:{const f=(i+a)*Ne.degRad,p=(i+90+o)*Ne.degRad;this.a=Math.cos(f)*s,this.b=Math.cos(p)*r,this.c=Math.sin(f)*s,this.d=Math.sin(p)*r;break}case ni.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)*Ne.radDeg):(l=0,u=0,g=90-Math.atan2(d,c)*Ne.radDeg);const y=(i+a-g)*Ne.degRad,w=(i+o-g+90)*Ne.degRad,v=Math.cos(y)*s,_=Math.cos(w)*r,x=Math.sin(y)*s,M=Math.sin(w)*r;this.a=l*v-c*x,this.b=l*_-c*M,this.c=u*v+d*x,this.d=u*_+d*M;break}case ni.NoScale:case ni.NoScaleOrReflection:{i*=Ne.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,y=Math.sqrt(m*m+g*g);y>1e-5&&(y=1/y),m*=y,g*=y,y=Math.sqrt(m*m+g*g),this.inherit==ni.NoScale&&l*d-c*u<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(y=-y),i=Math.PI/2+Math.atan2(g,m);const w=Math.cos(i)*y,v=Math.sin(i)*y;a*=Ne.degRad,o=(90+o)*Ne.degRad;const _=Math.cos(a)*s,x=Math.cos(o)*r,M=Math.sin(a)*s,T=Math.sin(o)*r;this.a=m*_+w*M,this.b=m*x+w*T,this.c=g*_+v*M,this.d=g*x+v*T;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)*Ne.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)*Ne.radDeg;return}let t=e.a,i=e.b,s=e.c,r=e.d,a=1/(t*r-i*s),o=r*a,h=i*a,l=s*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==ni.OnlyTranslation)f=this.a,p=this.b,m=this.c,g=this.d;else{switch(this.inherit){case ni.NoRotationOrReflection:{let x=Math.abs(t*r-i*s)/(t*t+s*s);i=-s*this.skeleton.scaleX*x/this.skeleton.scaleY,r=t*this.skeleton.scaleY*x/this.skeleton.scaleX,a=1/(t*r-i*s),o=r*a,h=i*a;break}case ni.NoScale:case ni.NoScaleOrReflection:let y=Ne.cosDeg(this.rotation),w=Ne.sinDeg(this.rotation);t=(t*y+i*w)/this.skeleton.scaleX,s=(s*y+r*w)/this.skeleton.scaleY;let v=Math.sqrt(t*t+s*s);v>1e-5&&(v=1/v),t*=v,s*=v,v=Math.sqrt(t*t+s*s),this.inherit==ni.NoScale&&a<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(v=-v);let _=Ne.PI/2+Math.atan2(s,t);i=Math.cos(_)*v,r=Math.sin(_)*v,a=1/(t*r-i*s),o=r*a,h=i*a,l=s*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 y=f*g-p*m;this.ascaleY=y/this.ascaleX,this.ashearY=-Math.atan2(f*p+m*g,y)*Ne.radDeg,this.arotation=Math.atan2(m,f)*Ne.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(p*p+g*g),this.ashearY=0,this.arotation=90-Math.atan2(g,p)*Ne.radDeg}getWorldRotationX(){return Math.atan2(this.c,this.a)*Ne.radDeg}getWorldRotationY(){return Math.atan2(this.d,this.b)*Ne.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,s=e.y-this.worldY;return e.x=i*this.d*t-s*this.b*t,e.y=s*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=Ne.sinDeg(e),i=Ne.cosDeg(e);return Math.atan2(this.a*t-this.c*i,this.d*i-this.b*t)*Ne.radDeg+this.rotation-this.shearX}localToWorldRotation(e){e-=this.rotation-this.shearX;let t=Ne.sinDeg(e),i=Ne.cosDeg(e);return Math.atan2(i*this.c+t*this.d,i*this.a+t*this.b)*Ne.radDeg}rotateWorld(e){e*=Ne.degRad;const t=Math.sin(e),i=Math.cos(e),s=this.a,r=this.b;this.a=i*s-t*this.c,this.b=i*r-t*this.d,this.c=t*s+i*this.c,this.d=t*r+i*this.d}},eu=class{constructor(e,t,i){b(this,"name");b(this,"order");b(this,"skinRequired");this.name=e,this.order=t,this.skinRequired=i}},yb=class{constructor(e,t){b(this,"data");b(this,"intValue",0);b(this,"floatValue",0);b(this,"stringValue",null);b(this,"time",0);b(this,"volume",0);b(this,"balance",0);if(!t)throw new Error("data cannot be null.");this.time=e,this.data=t}},xb=class{constructor(e){b(this,"name");b(this,"intValue",0);b(this,"floatValue",0);b(this,"stringValue",null);b(this,"audioPath",null);b(this,"volume",0);b(this,"balance",0);this.name=e}},cI=class{constructor(e,t){b(this,"data");b(this,"bones");b(this,"target");b(this,"bendDirection",0);b(this,"compress",!1);b(this,"stretch",!1);b(this,"mix",1);b(this,"softness",0);b(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 s=0;s<e.bones.length;s++){let r=t.findBone(e.bones[s].name);if(!r)throw new Error(`Couldn't find bone ${e.bones[s].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,s,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 ni.OnlyTranslation:p=(t-e.worldX)*Ne.signum(e.skeleton.scaleX),m=(i-e.worldY)*Ne.signum(e.skeleton.scaleY);break;case ni.NoRotationOrReflection:let w=Math.abs(l*d-c*u)/Math.max(1e-4,l*l+u*u),v=l/e.skeleton.scaleX,_=u/e.skeleton.scaleY;c=-_*w*e.skeleton.scaleX,d=v*w*e.skeleton.scaleY,f+=Math.atan2(_,v)*Ne.radDeg;default:let x=t-h.worldX,M=i-h.worldY,T=l*d-c*u;Math.abs(T)<=1e-4?(p=0,m=0):(p=(x*d-M*c)/T-e.ax,m=(M*l-x*u)/T-e.ay)}f+=Math.atan2(m,p)*Ne.radDeg,e.ascaleX<0&&(f+=180),f>180?f-=360:f<-180&&(f+=360);let g=e.ascaleX,y=e.ascaleY;if(s||r){switch(e.inherit){case ni.NoScale:case ni.NoScaleOrReflection:p=t-e.worldX,m=i-e.worldY}const w=e.data.length*g;if(w>1e-4){const v=p*p+m*m;if(s&&v<w*w||r&&v>w*w){const _=(Math.sqrt(v)/w-1)*o+1;g*=_,a&&(y*=_)}}}e.updateWorldTransformWith(e.ax,e.ay,e.arotation+f*o,g,y,e.ashearX,e.ashearY)}apply2(e,t,i,s,r,a,o,h,l){if(e.inherit!=ni.Normal||t.inherit!=ni.Normal)return;let c=e.ax,u=e.ay,d=e.ascaleX,f=e.ascaleY,p=d,m=f,g=t.ascaleX,y=0,w=0,v=0;d<0?(d=-d,y=180,v=-1):(y=0,v=1),f<0&&(f=-f,v=-v),g<0?(g=-g,w=180):w=0;let _=t.ax,x=0,M=0,T=0,C=e.a,I=e.b,k=e.c,R=e.d,F=Math.abs(d-f)<=1e-4;!F||a?(x=0,M=C*_+e.worldX,T=k*_+e.worldY):(x=t.ay,M=C*_+I*x+e.worldX,T=k*_+R*x+e.worldY);let B=e.parent;if(!B)throw new Error("IK parent must itself have a parent.");C=B.a,I=B.b,k=B.c,R=B.d;let L=C*R-I*k,Y=M-B.worldX,O=T-B.worldY;L=Math.abs(L)<=1e-4?0:1/L;let D=(Y*R-O*I)*L-c,P=(O*C-Y*k)*L-u,U=Math.sqrt(D*D+P*P),N=t.data.length*g,X,K;if(U<1e-4){this.apply1(e,i,s,!1,a,!1,l),t.updateWorldTransformWith(_,x,0,t.ascaleX,t.ascaleY,t.ashearX,t.ashearY);return}Y=i-B.worldX,O=s-B.worldY;let z=(Y*R-O*I)*L-c,se=(O*C-Y*k)*L-u,Q=z*z+se*se;if(h!=0){h*=d*(g+1)*.5;let Me=Math.sqrt(Q),Ie=Me-U-N*d+h;if(Ie>0){let ge=Math.min(1,Ie/(h*2))-1;ge=(Ie-h*(1-ge*ge))/Me,z-=ge*z,se-=ge*se,Q=z*z+se*se}}e:if(F){N*=d;let Me=(Q-U*U-N*N)/(2*U*N);Me<-1?(Me=-1,K=Math.PI*r):Me>1?(Me=1,K=0,a&&(C=(Math.sqrt(Q)/(U+N)-1)*l+1,p*=C,o&&(m*=C))):K=Math.acos(Me)*r,C=U+N*Me,I=N*Math.sin(K),X=Math.atan2(se*C-z*I,z*C+se*I)}else{C=d*N,I=f*N;let Me=C*C,Ie=I*I,ge=Math.atan2(se,z);k=Ie*U*U+Me*Q-Me*Ie;let Ee=-2*Ie*U,H=Ie-Me;if(R=Ee*Ee-4*H*k,R>=0){let ue=Math.sqrt(R);Ee<0&&(ue=-ue),ue=-(Ee+ue)*.5;let ke=ue/H,Re=k/ue,Fe=Math.abs(ke)<Math.abs(Re)?ke:Re;if(ke=Q-Fe*Fe,ke>=0){O=Math.sqrt(ke)*r,X=ge-Math.atan2(O,Fe),K=Math.atan2(O/f,(Fe-U)/d);break e}}let Z=Ne.PI,q=U-C,W=q*q,ee=0,ce=0,xe=U+C,oe=xe*xe,Se=0;k=-C*U/(Me-Ie),k>=-1&&k<=1&&(k=Math.acos(k),Y=C*Math.cos(k)+U,O=I*Math.sin(k),R=Y*Y+O*O,R<W&&(Z=k,W=R,q=Y,ee=O),R>oe&&(ce=k,oe=R,xe=Y,Se=O)),Q<=(W+oe)*.5?(X=ge-Math.atan2(ee*r,q),K=Z*r):(X=ge-Math.atan2(Se*r,xe),K=ce*r)}let me=Math.atan2(x,_)*v,pe=e.arotation;X=(X-me)*Ne.radDeg+y-pe,X>180?X-=360:X<-180&&(X+=360),e.updateWorldTransformWith(c,u,pe+X*l,p,m,0,0),pe=t.arotation,K=((K+me)*Ne.radDeg-t.ashearX)*v+w-pe,K>180?K-=360:K<-180&&(K+=360),t.updateWorldTransformWith(_,x,pe+K*l,t.ascaleX,t.ascaleY,t.ashearX,t.ashearY)}},bb=class extends eu{constructor(t){super(t,0,!1);b(this,"bones",new Array);b(this,"_target",null);b(this,"bendDirection",0);b(this,"compress",!1);b(this,"stretch",!1);b(this,"uniform",!1);b(this,"mix",0);b(this,"softness",0)}set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("BoneData not set.")}},wb=class extends eu{constructor(t){super(t,0,!1);b(this,"bones",new Array);b(this,"_target",null);b(this,"positionMode",vn.Fixed);b(this,"spacingMode",Si.Fixed);b(this,"rotateMode",ha.Chain);b(this,"offsetRotation",0);b(this,"position",0);b(this,"spacing",0);b(this,"mixRotate",0);b(this,"mixX",0);b(this,"mixY",0)}set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("SlotData not set.")}};var vn;(function(n){n[n.Fixed=0]="Fixed",n[n.Percent=1]="Percent"})(vn||(vn={}));var Si;(function(n){n[n.Length=0]="Length",n[n.Fixed=1]="Fixed",n[n.Percent=2]="Percent",n[n.Proportional=3]="Proportional"})(Si||(Si={}));var ha;(function(n){n[n.Tangent=0]="Tangent",n[n.Chain=1]="Chain",n[n.ChainScale=2]="ChainScale"})(ha||(ha={}));var Ui;let hI=(Ui=class{constructor(e,t){b(this,"data");b(this,"bones");b(this,"target");b(this,"position",0);b(this,"spacing",0);b(this,"mixRotate",0);b(this,"mixX",0);b(this,"mixY",0);b(this,"spaces",new Array);b(this,"positions",new Array);b(this,"world",new Array);b(this,"curves",new Array);b(this,"lengths",new Array);b(this,"segments",new Array);b(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 s=0,r=e.bones.length;s<r;s++){let a=t.findBone(e.bones[s].name);if(!a)throw new Error(`Couldn't find bone ${e.bones[s].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 xl))return;let i=this.mixRotate,s=this.mixX,r=this.mixY;if(i==0&&s==0&&r==0)return;let a=this.data,o=a.rotateMode==ha.Tangent,h=a.rotateMode==ha.ChainScale,l=this.bones,c=l.length,u=o?c:c+1,d=Ue.setArraySize(this.spaces,u),f=h?this.lengths=Ue.setArraySize(this.lengths,c):[],p=this.spacing;switch(a.spacingMode){case Si.Percent:if(h)for(let M=0,T=u-1;M<T;M++){let C=l[M],I=C.data.length,k=I*C.a,R=I*C.c;f[M]=Math.sqrt(k*k+R*R)}Ue.arrayFill(d,1,u,p);break;case Si.Proportional:let _=0;for(let M=0,T=u-1;M<T;){let C=l[M],I=C.data.length;if(I<Ui.epsilon)h&&(f[M]=0),d[++M]=p;else{let k=I*C.a,R=I*C.c,F=Math.sqrt(k*k+R*R);h&&(f[M]=F),d[++M]=F,_+=F}}if(_>0){_=u/_*p;for(let M=1;M<u;M++)d[M]*=_}break;default:let x=a.spacingMode==Si.Length;for(let M=0,T=u-1;M<T;){let C=l[M],I=C.data.length;if(I<Ui.epsilon)h&&(f[M]=0),d[++M]=p;else{let k=I*C.a,R=I*C.c,F=Math.sqrt(k*k+R*R);h&&(f[M]=F),d[++M]=(x?I+p:p)*F/I}}}let m=this.computeWorldPositions(t,u,o),g=m[0],y=m[1],w=a.offsetRotation,v=!1;if(w==0)v=a.rotateMode==ha.Chain;else{v=!1;let _=this.target.bone;w*=_.a*_.d-_.b*_.c>0?Ne.degRad:-.01745329277777778}for(let _=0,x=3;_<c;_++,x+=3){let M=l[_];M.worldX+=(g-M.worldX)*s,M.worldY+=(y-M.worldY)*r;let T=m[x],C=m[x+1],I=T-g,k=C-y;if(h){let R=f[_];if(R!=0){let F=(Math.sqrt(I*I+k*k)/R-1)*i+1;M.a*=F,M.c*=F}}if(g=T,y=C,i>0){let R=M.a,F=M.b,B=M.c,L=M.d,Y=0,O=0,D=0;if(o?Y=m[x-1]:d[_+1]==0?Y=m[x+2]:Y=Math.atan2(k,I),Y-=Math.atan2(B,R),v){O=Math.cos(Y),D=Math.sin(Y);let P=M.data.length;g+=(P*(O*R-D*B)-I)*i,y+=(P*(D*R+O*B)-k)*i}else Y+=w;Y>Ne.PI?Y-=Ne.PI2:Y<-3.1415927&&(Y+=Ne.PI2),Y*=i,O=Math.cos(Y),D=Math.sin(Y),M.a=O*R-D*B,M.b=O*F-D*L,M.c=D*R+O*B,M.d=D*F+O*L}M.updateAppliedTransform()}}computeWorldPositions(e,t,i){let s=this.target,r=this.position,a=this.spaces,o=Ue.setArraySize(this.positions,t*3+2),h=this.world,l=e.closed,c=e.worldVerticesLength,u=c/6,d=Ui.NONE;if(!e.constantSpeed){let P=e.lengths;u-=l?1:2;let U=P[u];this.data.positionMode==vn.Percent&&(r*=U);let N;switch(this.data.spacingMode){case Si.Percent:N=U;break;case Si.Proportional:N=U/t;break;default:N=1}h=Ue.setArraySize(this.world,8);for(let X=0,K=0,z=0;X<t;X++,K+=3){let se=a[X]*N;r+=se;let Q=r;if(l)Q%=U,Q<0&&(Q+=U),z=0;else if(Q<0){d!=Ui.BEFORE&&(d=Ui.BEFORE,e.computeWorldVertices(s,2,4,h,0,2)),this.addBeforePosition(Q,h,0,o,K);continue}else if(Q>U){d!=Ui.AFTER&&(d=Ui.AFTER,e.computeWorldVertices(s,c-6,4,h,0,2)),this.addAfterPosition(Q-U,h,0,o,K);continue}for(;;z++){let me=P[z];if(!(Q>me)){if(z==0)Q/=me;else{let pe=P[z-1];Q=(Q-pe)/(me-pe)}break}}z!=d&&(d=z,l&&z==u?(e.computeWorldVertices(s,c-4,4,h,0,2),e.computeWorldVertices(s,0,4,h,4,2)):e.computeWorldVertices(s,z*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,K,i||X>0&&se==0)}return o}l?(c+=2,h=Ue.setArraySize(this.world,c),e.computeWorldVertices(s,2,c-4,h,0,2),e.computeWorldVertices(s,0,2,h,c-4,2),h[c-2]=h[0],h[c-1]=h[1]):(u--,c-=4,h=Ue.setArraySize(this.world,c),e.computeWorldVertices(s,2,c,h,0,2));let f=Ue.setArraySize(this.curves,u),p=0,m=h[0],g=h[1],y=0,w=0,v=0,_=0,x=0,M=0,T=0,C=0,I=0,k=0,R=0,F=0,B=0,L=0;for(let P=0,U=2;P<u;P++,U+=6)y=h[U],w=h[U+1],v=h[U+2],_=h[U+3],x=h[U+4],M=h[U+5],T=(m-y*2+v)*.1875,C=(g-w*2+_)*.1875,I=((y-v)*3-m+x)*.09375,k=((w-_)*3-g+M)*.09375,R=T*2+I,F=C*2+k,B=(y-m)*.75+T+I*.16666667,L=(w-g)*.75+C+k*.16666667,p+=Math.sqrt(B*B+L*L),B+=R,L+=F,R+=I,F+=k,p+=Math.sqrt(B*B+L*L),B+=R,L+=F,p+=Math.sqrt(B*B+L*L),B+=R+I,L+=F+k,p+=Math.sqrt(B*B+L*L),f[P]=p,m=x,g=M;this.data.positionMode==vn.Percent&&(r*=p);let Y;switch(this.data.spacingMode){case Si.Percent:Y=p;break;case Si.Proportional:Y=p/t;break;default:Y=1}let O=this.segments,D=0;for(let P=0,U=0,N=0,X=0;P<t;P++,U+=3){let K=a[P]*Y;r+=K;let z=r;if(l)z%=p,z<0&&(z+=p),N=0;else if(z<0){this.addBeforePosition(z,h,0,o,U);continue}else if(z>p){this.addAfterPosition(z-p,h,c-4,o,U);continue}for(;;N++){let se=f[N];if(!(z>se)){if(N==0)z/=se;else{let Q=f[N-1];z=(z-Q)/(se-Q)}break}}if(N!=d){d=N;let se=N*6;for(m=h[se],g=h[se+1],y=h[se+2],w=h[se+3],v=h[se+4],_=h[se+5],x=h[se+6],M=h[se+7],T=(m-y*2+v)*.03,C=(g-w*2+_)*.03,I=((y-v)*3-m+x)*.006,k=((w-_)*3-g+M)*.006,R=T*2+I,F=C*2+k,B=(y-m)*.3+T+I*.16666667,L=(w-g)*.3+C+k*.16666667,D=Math.sqrt(B*B+L*L),O[0]=D,se=1;se<8;se++)B+=R,L+=F,R+=I,F+=k,D+=Math.sqrt(B*B+L*L),O[se]=D;B+=R,L+=F,D+=Math.sqrt(B*B+L*L),O[8]=D,B+=R+I,L+=F+k,D+=Math.sqrt(B*B+L*L),O[9]=D,X=0}for(z*=D;;X++){let se=O[X];if(!(z>se)){if(X==0)z/=se;else{let Q=O[X-1];z=X+(z-Q)/(se-Q)}break}}this.addCurvePosition(z*.1,m,g,y,w,v,_,x,M,o,U,i||P>0&&K==0)}return o}addBeforePosition(e,t,i,s,r){let a=t[i],o=t[i+1],h=t[i+2]-a,l=t[i+3]-o,c=Math.atan2(l,h);s[r]=a+e*Math.cos(c),s[r+1]=o+e*Math.sin(c),s[r+2]=c}addAfterPosition(e,t,i,s,r){let a=t[i+2],o=t[i+3],h=a-t[i],l=o-t[i+1],c=Math.atan2(l,h);s[r]=a+e*Math.cos(c),s[r+1]=o+e*Math.sin(c),s[r+2]=c}addCurvePosition(e,t,i,s,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,s-t);return}let f=e*e,p=f*e,m=1-e,g=m*m,y=g*m,w=m*e,v=w*3,_=m*v,x=v*e,M=t*y+s*_+a*x+h*p,T=i*y+r*_+o*x+l*p;c[u]=M,c[u+1]=T,d&&(e<.001?c[u+2]=Math.atan2(r-i,s-t):c[u+2]=Math.atan2(T-(i*g+r*w*2+o*f),M-(t*g+s*w*2+a*f)))}},b(Ui,"NONE",-1),b(Ui,"BEFORE",-2),b(Ui,"AFTER",-3),b(Ui,"epsilon",1e-5),Ui),uI=class{constructor(e,t){b(this,"data");b(this,"_bone",null);b(this,"inertia",0);b(this,"strength",0);b(this,"damping",0);b(this,"massInverse",0);b(this,"wind",0);b(this,"gravity",0);b(this,"mix",0);b(this,"_reset",!0);b(this,"ux",0);b(this,"uy",0);b(this,"cx",0);b(this,"cy",0);b(this,"tx",0);b(this,"ty",0);b(this,"xOffset",0);b(this,"xVelocity",0);b(this,"yOffset",0);b(this,"yVelocity",0);b(this,"rotateOffset",0);b(this,"rotateVelocity",0);b(this,"scaleOffset",0);b(this,"scaleVelocity",0);b(this,"active",!1);b(this,"skeleton");b(this,"remaining",0);b(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,s=this.data.y>0,r=this.data.rotate>0||this.data.shearX>0,a=this.data.scaleX>0,o=this.bone,h=o.data.length;switch(e){case br.none:return;case br.reset:this.reset();case br.update:const l=this.skeleton,c=Math.max(this.skeleton.time-this.lastTime,0);this.remaining+=c,this.lastTime=l.time;const u=o.worldX,d=o.worldY;if(this._reset)this._reset=!1,this.ux=u,this.uy=d;else{let f=this.remaining,p=this.inertia,m=this.data.step,g=this.skeleton.data.referenceScale,y=-1,w=this.data.limit*c,v=w*Math.abs(l.scaleY);if(w*=Math.abs(l.scaleX),i||s){if(i){const _=(this.ux-u)*p;this.xOffset+=_>w?w:_<-w?-w:_,this.ux=u}if(s){const _=(this.uy-d)*p;this.yOffset+=_>v?v:_<-v?-v:_,this.uy=d}if(f>=m){y=Math.pow(this.damping,60*m);const _=this.massInverse*m,x=this.strength,M=this.wind*g*l.scaleX,T=this.gravity*g*l.scaleY;do i&&(this.xVelocity+=(M-this.xOffset*x)*_,this.xOffset+=this.xVelocity*m,this.xVelocity*=y),s&&(this.yVelocity-=(T+this.yOffset*x)*_,this.yOffset+=this.yVelocity*m,this.yVelocity*=y),f-=m;while(f>=m)}i&&(o.worldX+=this.xOffset*t*this.data.x),s&&(o.worldY+=this.yOffset*t*this.data.y)}if(r||a){let _=Math.atan2(o.c,o.a),x=0,M=0,T=0,C=this.cx-o.worldX,I=this.cy-o.worldY;if(C>w?C=w:C<-w&&(C=-w),I>v?I=v:I<-v&&(I=-v),r){T=(this.data.rotate+this.data.shearX)*t;let k=Math.atan2(I+this.ty,C+this.tx)-_-this.rotateOffset*T;this.rotateOffset+=(k-Math.ceil(k*Ne.invPI2-.5)*Ne.PI2)*p,k=this.rotateOffset*T+_,x=Math.cos(k),M=Math.sin(k),a&&(k=h*o.getWorldScaleX(),k>0&&(this.scaleOffset+=(C*x+I*M)*p/k))}else{x=Math.cos(_),M=Math.sin(_);const k=h*o.getWorldScaleX();k>0&&(this.scaleOffset+=(C*x+I*M)*p/k)}if(f=this.remaining,f>=m){y==-1&&(y=Math.pow(this.damping,60*m));const k=this.massInverse*m,R=this.strength,F=this.wind,B=Qm.yDown?-this.gravity:this.gravity,L=h/g;for(;;)if(f-=m,a&&(this.scaleVelocity+=(F*x-B*M-this.scaleOffset*R)*k,this.scaleOffset+=this.scaleVelocity*m,this.scaleVelocity*=y),r){if(this.rotateVelocity-=((F*M+B*x)*L+this.rotateOffset*R)*k,this.rotateOffset+=this.rotateVelocity*m,this.rotateVelocity*=y,f<m)break;const Y=this.rotateOffset*T+_;x=Math.cos(Y),M=Math.sin(Y)}else if(f<m)break}}this.remaining=f}this.cx=o.worldX,this.cy=o.worldY;break;case br.pose:i&&(o.worldX+=this.xOffset*t*this.data.x),s&&(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!=br.pose&&(this.tx=h*o.a,this.ty=h*o.c),o.updateAppliedTransform()}translate(e,t){this.ux-=e,this.uy-=t,this.cx-=e,this.cy-=t}rotate(e,t,i){const s=i*Ne.degRad,r=Math.cos(s),a=Math.sin(s),o=this.cx-e,h=this.cy-t;this.translate(o*r-h*a-o,o*a+h*r-h)}},dI=class{constructor(e,t){b(this,"data");b(this,"bone");b(this,"color");b(this,"darkColor",null);b(this,"attachment",null);b(this,"attachmentState",0);b(this,"sequenceIndex",-1);b(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 gt,this.darkColor=e.darkColor?new gt:null,this.setToSetupPose()}getSkeleton(){return this.bone.skeleton}getAttachment(){return this.attachment}setAttachment(e){this.attachment!=e&&((!(e instanceof tr)||!(this.attachment instanceof tr)||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}},fI=class{constructor(e,t){b(this,"data");b(this,"bones");b(this,"target");b(this,"mixRotate",0);b(this,"mixX",0);b(this,"mixY",0);b(this,"mixScaleX",0);b(this,"mixScaleY",0);b(this,"mixShearY",0);b(this,"temp",new lh);b(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 s=0;s<e.bones.length;s++){let r=t.findBone(e.bones[s].name);if(!r)throw new Error(`Couldn't find bone ${e.bones[s].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,s=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?Ne.degRad:-.01745329277777778,p=this.data.offsetRotation*f,m=this.data.offsetShearY*f,g=this.bones;for(let y=0,w=g.length;y<w;y++){let v=g[y];if(e!=0){let _=v.a,x=v.b,M=v.c,T=v.d,C=Math.atan2(u,l)-Math.atan2(M,_)+p;C>Ne.PI?C-=Ne.PI2:C<-3.1415927&&(C+=Ne.PI2),C*=e;let I=Math.cos(C),k=Math.sin(C);v.a=I*_-k*M,v.b=I*x-k*T,v.c=k*_+I*M,v.d=k*x+I*T}if(o){let _=this.temp;h.localToWorld(_.set(this.data.offsetX,this.data.offsetY)),v.worldX+=(_.x-v.worldX)*t,v.worldY+=(_.y-v.worldY)*i}if(s!=0){let _=Math.sqrt(v.a*v.a+v.c*v.c);_!=0&&(_=(_+(Math.sqrt(l*l+u*u)-_+this.data.offsetScaleX)*s)/_),v.a*=_,v.c*=_}if(r!=0){let _=Math.sqrt(v.b*v.b+v.d*v.d);_!=0&&(_=(_+(Math.sqrt(c*c+d*d)-_+this.data.offsetScaleY)*r)/_),v.b*=_,v.d*=_}if(a>0){let _=v.b,x=v.d,M=Math.atan2(x,_),T=Math.atan2(d,c)-Math.atan2(u,l)-(M-Math.atan2(v.c,v.a));T>Ne.PI?T-=Ne.PI2:T<-3.1415927&&(T+=Ne.PI2),T=M+(T+m)*a;let C=Math.sqrt(_*_+x*x);v.b=Math.cos(T)*C,v.d=Math.sin(T)*C}v.updateAppliedTransform()}}applyRelativeWorld(){let e=this.mixRotate,t=this.mixX,i=this.mixY,s=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?Ne.degRad:-.01745329277777778,p=this.data.offsetRotation*f,m=this.data.offsetShearY*f,g=this.bones;for(let y=0,w=g.length;y<w;y++){let v=g[y];if(e!=0){let _=v.a,x=v.b,M=v.c,T=v.d,C=Math.atan2(u,l)+p;C>Ne.PI?C-=Ne.PI2:C<-3.1415927&&(C+=Ne.PI2),C*=e;let I=Math.cos(C),k=Math.sin(C);v.a=I*_-k*M,v.b=I*x-k*T,v.c=k*_+I*M,v.d=k*x+I*T}if(o){let _=this.temp;h.localToWorld(_.set(this.data.offsetX,this.data.offsetY)),v.worldX+=_.x*t,v.worldY+=_.y*i}if(s!=0){let _=(Math.sqrt(l*l+u*u)-1+this.data.offsetScaleX)*s+1;v.a*=_,v.c*=_}if(r!=0){let _=(Math.sqrt(c*c+d*d)-1+this.data.offsetScaleY)*r+1;v.b*=_,v.d*=_}if(a>0){let _=Math.atan2(d,c)-Math.atan2(u,l);_>Ne.PI?_-=Ne.PI2:_<-3.1415927&&(_+=Ne.PI2);let x=v.b,M=v.d;_=Math.atan2(M,x)+(_-Ne.PI/2+m)*a;let T=Math.sqrt(x*x+M*M);v.b=Math.cos(_)*T,v.d=Math.sin(_)*T}v.updateAppliedTransform()}}applyAbsoluteLocal(){let e=this.mixRotate,t=this.mixX,i=this.mixY,s=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;s!=0&&m!=0&&(m=(m+(o.ascaleX-m+this.data.offsetScaleX)*s)/m),r!=0&&g!=0&&(g=(g+(o.ascaleY-g+this.data.offsetScaleY)*r)/g);let y=u.ashearY;a!=0&&(y+=(o.ashearY-y+this.data.offsetShearY)*a),u.updateWorldTransformWith(f,p,d,m,g,u.ashearX,y)}}applyRelativeLocal(){let e=this.mixRotate,t=this.mixX,i=this.mixY,s=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)*s+1),g=u.ascaleY*((o.ascaleY-1+this.data.offsetScaleY)*r+1),y=u.ashearY+(o.ashearY+this.data.offsetShearY)*a;u.updateWorldTransformWith(f,p,d,m,g,u.ashearX,y)}}};var Un;let Qm=(Un=class{constructor(e){b(this,"data");b(this,"bones");b(this,"slots");b(this,"drawOrder");b(this,"ikConstraints");b(this,"transformConstraints");b(this,"pathConstraints");b(this,"physicsConstraints");b(this,"_updateCache",new Array);b(this,"skin",null);b(this,"color");b(this,"scaleX",1);b(this,"_scaleY",1);b(this,"x",0);b(this,"y",0);b(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],s;if(!i.parent)s=new rv(i,this,null);else{let r=this.bones[i.parent.index];s=new rv(i,this,r),r.children.push(s)}this.bones.push(s)}this.slots=new Array,this.drawOrder=new Array;for(let t=0;t<e.slots.length;t++){let i=e.slots[t],s=this.bones[i.boneData.index],r=new dI(i,s);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 cI(i,this))}this.transformConstraints=new Array;for(let t=0;t<e.transformConstraints.length;t++){let i=e.transformConstraints[t];this.transformConstraints.push(new fI(i,this))}this.pathConstraints=new Array;for(let t=0;t<e.pathConstraints.length;t++){let i=e.pathConstraints[t];this.pathConstraints.push(new hI(i,this))}this.physicsConstraints=new Array;for(let t=0;t<e.physicsConstraints.length;t++){let i=e.physicsConstraints[t];this.physicsConstraints.push(new uI(i,this))}this.color=new gt(1,1,1,1),this.updateCache()}get scaleY(){return Un.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,s=this.transformConstraints,r=this.pathConstraints,a=this.physicsConstraints,o=i.length,h=s.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=s[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&&Ue.contains(this.skin.constraints,e.data,!0)),!e.active)return;let t=e.target;this.sortBone(t);let i=e.bones,s=i[0];if(this.sortBone(s),i.length==1)this._updateCache.push(e),this.sortReset(s.children);else{let r=i[i.length-1];this.sortBone(r),this._updateCache.push(e),this.sortReset(s.children),r.sorted=!0}}sortPathConstraint(e){if(e.active=e.target.bone.isActive()&&(!e.data.skinRequired||this.skin&&Ue.contains(this.skin.constraints,e.data,!0)),!e.active)return;let t=e.target,i=t.data.index,s=t.bone;this.skin&&this.sortPathConstraintAttachment(this.skin,i,s),this.data.defaultSkin&&this.data.defaultSkin!=this.skin&&this.sortPathConstraintAttachment(this.data.defaultSkin,i,s);for(let h=0,l=this.data.skins.length;h<l;h++)this.sortPathConstraintAttachment(this.data.skins[h],i,s);let r=t.getAttachment();r instanceof xl&&this.sortPathConstraintAttachmentWith(r,s);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&&Ue.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 s=0;s<i;s++){let r=t[s];this.sortBone(r.parent),this.sortBone(r)}else for(let s=0;s<i;s++)this.sortBone(t[s]);this._updateCache.push(e);for(let s=0;s<i;s++)this.sortReset(t[s].children);for(let s=0;s<i;s++)t[s].sorted=!0}sortPathConstraintAttachment(e,t,i){let s=e.attachments[t];if(s)for(let r in s)this.sortPathConstraintAttachmentWith(s[r],i)}sortPathConstraintAttachmentWith(e,t){if(!(e instanceof xl))return;let i=e.bones;if(!i)this.sortBone(t);else{let s=this.bones;for(let r=0,a=i.length;r<a;){let o=i[r++];for(o+=r;r<o;)this.sortBone(s[i[r++]])}}}sortPhysicsConstraint(e){const t=e.bone;e.active=t.active&&(!e.data.skinRequired||this.skin!=null&&Ue.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 s=e[t];s.active&&(s.sorted&&this.sortReset(s.children),s.sorted=!1)}}updateWorldTransform(e){if(e==null)throw new Error("physics is undefined");let t=this.bones;for(let s=0,r=t.length;s<r;s++){let a=t[s];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 s=0,r=i.length;s<r;s++)i[s].update(e)}updateWorldTransformWith(e,t){if(!t)throw new Error("parent cannot be null.");let i=this.bones;for(let g=1,y=i.length;g<y;g++){let w=i[g];w.ax=w.x,w.ay=w.y,w.arotation=w.rotation,w.ascaleX=w.scaleX,w.ascaleY=w.scaleY,w.ashearX=w.shearX,w.ashearY=w.shearY}let s=this.getRootBone();if(!s)throw new Error("Root bone must not be null.");let r=t.a,a=t.b,o=t.c,h=t.d;s.worldX=r*this.x+a*this.y+t.worldX,s.worldY=o*this.x+h*this.y+t.worldY;const l=(s.rotation+s.shearX)*Ne.degRad,c=(s.rotation+90+s.shearY)*Ne.degRad,u=Math.cos(l)*s.scaleX,d=Math.cos(c)*s.scaleY,f=Math.sin(l)*s.scaleX,p=Math.sin(c)*s.scaleY;s.a=(r*u+a*f)*this.scaleX,s.b=(r*d+a*p)*this.scaleX,s.c=(o*u+h*f)*this.scaleY,s.d=(o*d+h*p)*this.scaleY;let m=this._updateCache;for(let g=0,y=m.length;g<y;g++){let w=m[g];w!=s&&w.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;Ue.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,s=t.length;i<s;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,s=t.length;i<s;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,s=t.length;i<s;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 s=0,r=i.length;s<r;s++){let a=i[s];if(a.data.name==e){let o=null;if(t&&(o=this.getAttachment(s,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 lh,i=new lh;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),s=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 Qh)f=8,p=Ue.setArraySize(i,f,0),g.computeWorldVertices(d,p,0,2),m=Un.quadTriangles;else if(g instanceof Pl){let y=g;f=y.worldVerticesLength,p=Ue.setArraySize(i,f,0),y.computeWorldVertices(d,0,f,p,0,2),m=y.triangles}else if(g instanceof no&&s!=null){s.clipStart(d,g);continue}if(p&&m){s!=null&&s.isClipping()&&(s.clipTriangles(p,m,m.length),p=s.clippedVertices,f=s.clippedVertices.length);for(let y=0,w=p.length;y<w;y+=2){let v=p[y],_=p[y+1];a=Math.min(a,v),o=Math.min(o,_),h=Math.max(h,v),l=Math.max(l,_)}}s!=null&&s.clipEndWithSlot(d)}s!=null&&s.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 s=0,r=i.length;s<r;s++)i[s].translate(e,t)}physicsRotate(e,t,i){const s=this.physicsConstraints;for(let r=0,a=s.length;r<a;r++)s[r].rotate(e,t,i)}},b(Un,"quadTriangles",[0,1,2,2,3,0]),b(Un,"yDown",!1),Un);var br;(function(n){n[n.none=0]="none",n[n.reset=1]="reset",n[n.update=2]="update",n[n.pose=3]="pose"})(br||(br={}));let Sb=class extends eu{constructor(t){super(t,0,!1);b(this,"_bone",null);b(this,"x",0);b(this,"y",0);b(this,"rotate",0);b(this,"scaleX",0);b(this,"shearX",0);b(this,"limit",0);b(this,"step",0);b(this,"inertia",0);b(this,"strength",0);b(this,"damping",0);b(this,"massInverse",0);b(this,"wind",0);b(this,"gravity",0);b(this,"mix",0);b(this,"inertiaGlobal",!1);b(this,"strengthGlobal",!1);b(this,"dampingGlobal",!1);b(this,"massGlobal",!1);b(this,"windGlobal",!1);b(this,"gravityGlobal",!1);b(this,"mixGlobal",!1)}set bone(t){this._bone=t}get bone(){if(this._bone)return this._bone;throw new Error("BoneData not set.")}},hh=class{constructor(){b(this,"name",null);b(this,"bones",new Array);b(this,"slots",new Array);b(this,"skins",new Array);b(this,"defaultSkin",null);b(this,"events",new Array);b(this,"animations",new Array);b(this,"ikConstraints",new Array);b(this,"transformConstraints",new Array);b(this,"pathConstraints",new Array);b(this,"physicsConstraints",new Array);b(this,"x",0);b(this,"y",0);b(this,"width",0);b(this,"height",0);b(this,"referenceScale",100);b(this,"version",null);b(this,"hash",null);b(this,"fps",0);b(this,"imagesPath",null);b(this,"audioPath",null)}findBone(e){if(!e)throw new Error("boneName cannot be null.");let t=this.bones;for(let i=0,s=t.length;i<s;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,s=t.length;i<s;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,s=t.length;i<s;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,s=t.length;i<s;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,s=t.length;i<s;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,s=t.length;i<s;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,s=t.length;i<s;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,s=t.length;i<s;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,s=t.length;i<s;i++){const r=t[i];if(r.name==e)return r}return null}},av=class{constructor(e=0,t,i){b(this,"slotIndex");b(this,"name");b(this,"attachment");this.slotIndex=e,this.name=t,this.attachment=i}},Kf=class{constructor(e){b(this,"name");b(this,"attachments",new Array);b(this,"bones",Array());b(this,"constraints",new Array);b(this,"color",new gt(.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 s=this.attachments;e>=s.length&&(s.length=e+1),s[e]||(s[e]={}),s[e][t]=i}addSkin(e){for(let s=0;s<e.bones.length;s++){let r=e.bones[s],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 s=0;s<e.constraints.length;s++){let r=e.constraints[s],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 s=0;s<t.length;s++){var i=t[s];this.setAttachment(i.slotIndex,i.name,i.attachment)}}copySkin(e){for(let s=0;s<e.bones.length;s++){let r=e.bones[s],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 s=0;s<e.constraints.length;s++){let r=e.constraints[s],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 s=0;s<t.length;s++){var i=t[s];i.attachment&&(i.attachment instanceof Pl?(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 s in i){let r=i[s];r&&e.push(new av(t,s,r))}}return e}getAttachmentsForSlot(e,t){let i=this.attachments[e];if(i)for(let s in i){let r=i[s];r&&t.push(new av(e,s,r))}}clear(){this.attachments.length=0,this.bones.length=0,this.constraints.length=0}attachAll(e,t){let i=0;for(let s=0;s<e.slots.length;s++){let r=e.slots[s],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++}}},_b=class{constructor(e,t,i){b(this,"index",0);b(this,"name");b(this,"boneData");b(this,"color",new gt(1,1,1,1));b(this,"darkColor",null);b(this,"attachmentName",null);b(this,"blendMode",Er.Normal);b(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 Er;(function(n){n[n.Normal=0]="Normal",n[n.Additive=1]="Additive",n[n.Multiply=2]="Multiply",n[n.Screen=3]="Screen"})(Er||(Er={}));let Tb=class extends eu{constructor(t){super(t,0,!1);b(this,"bones",new Array);b(this,"_target",null);b(this,"mixRotate",0);b(this,"mixX",0);b(this,"mixY",0);b(this,"mixScaleX",0);b(this,"mixScaleY",0);b(this,"mixShearY",0);b(this,"offsetRotation",0);b(this,"offsetX",0);b(this,"offsetY",0);b(this,"offsetScaleX",0);b(this,"offsetScaleY",0);b(this,"offsetShearY",0);b(this,"relative",!1);b(this,"local",!1)}set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("BoneData not set.")}},Zf=class{constructor(e){b(this,"scale",1);b(this,"attachmentLoader");b(this,"linkedMeshes",new Array);this.attachmentLoader=e}readSkeletonData(e){let t=this.scale,i=new hh;i.name="";let s=new mI(e),r=s.readInt32(),a=s.readInt32();i.hash=a==0&&r==0?null:a.toString(16)+r.toString(16),i.version=s.readString(),i.x=s.readFloat(),i.y=s.readFloat(),i.width=s.readFloat(),i.height=s.readFloat(),i.referenceScale=s.readFloat()*t;let o=s.readBoolean();o&&(i.fps=s.readFloat(),i.imagesPath=s.readString(),i.audioPath=s.readString());let h=0;h=s.readInt(!0);for(let c=0;c<h;c++){let u=s.readString();if(!u)throw new Error("String in string table must not be null.");s.strings.push(u)}h=s.readInt(!0);for(let c=0;c<h;c++){let u=s.readString();if(!u)throw new Error("Bone name must not be null.");let d=c==0?null:i.bones[s.readInt(!0)],f=new vb(c,u,d);f.rotation=s.readFloat(),f.x=s.readFloat()*t,f.y=s.readFloat()*t,f.scaleX=s.readFloat(),f.scaleY=s.readFloat(),f.shearX=s.readFloat(),f.shearY=s.readFloat(),f.length=s.readFloat()*t,f.inherit=s.readByte(),f.skinRequired=s.readBoolean(),o&&(gt.rgba8888ToColor(f.color,s.readInt32()),f.icon=s.readString()??void 0,f.visible=s.readBoolean()),i.bones.push(f)}h=s.readInt(!0);for(let c=0;c<h;c++){let u=s.readString();if(!u)throw new Error("Slot name must not be null.");let d=i.bones[s.readInt(!0)],f=new _b(c,u,d);gt.rgba8888ToColor(f.color,s.readInt32());let p=s.readInt32();p!=-1&>.rgb888ToColor(f.darkColor=new gt,p),f.attachmentName=s.readStringRef(),f.blendMode=s.readInt(!0),o&&(f.visible=s.readBoolean()),i.slots.push(f)}h=s.readInt(!0);for(let c=0,u;c<h;c++){let d=s.readString();if(!d)throw new Error("IK constraint data name must not be null.");let f=new bb(d);f.order=s.readInt(!0),u=s.readInt(!0);for(let m=0;m<u;m++)f.bones.push(i.bones[s.readInt(!0)]);f.target=i.bones[s.readInt(!0)];let p=s.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?s.readFloat():1),(p&128)!=0&&(f.softness=s.readFloat()*t),i.ikConstraints.push(f)}h=s.readInt(!0);for(let c=0,u;c<h;c++){let d=s.readString();if(!d)throw new Error("Transform constraint data name must not be null.");let f=new Tb(d);f.order=s.readInt(!0),u=s.readInt(!0);for(let m=0;m<u;m++)f.bones.push(i.bones[s.readInt(!0)]);f.target=i.bones[s.readInt(!0)];let p=s.readByte();f.skinRequired=(p&1)!=0,f.local=(p&2)!=0,f.relative=(p&4)!=0,(p&8)!=0&&(f.offsetRotation=s.readFloat()),(p&16)!=0&&(f.offsetX=s.readFloat()*t),(p&32)!=0&&(f.offsetY=s.readFloat()*t),(p&64)!=0&&(f.offsetScaleX=s.readFloat()),(p&128)!=0&&(f.offsetScaleY=s.readFloat()),p=s.readByte(),(p&1)!=0&&(f.offsetShearY=s.readFloat()),(p&2)!=0&&(f.mixRotate=s.readFloat()),(p&4)!=0&&(f.mixX=s.readFloat()),(p&8)!=0&&(f.mixY=s.readFloat()),(p&16)!=0&&(f.mixScaleX=s.readFloat()),(p&32)!=0&&(f.mixScaleY=s.readFloat()),(p&64)!=0&&(f.mixShearY=s.readFloat()),i.transformConstraints.push(f)}h=s.readInt(!0);for(let c=0,u;c<h;c++){let d=s.readString();if(!d)throw new Error("Path constraint data name must not be null.");let f=new wb(d);f.order=s.readInt(!0),f.skinRequired=s.readBoolean(),u=s.readInt(!0);for(let m=0;m<u;m++)f.bones.push(i.bones[s.readInt(!0)]);f.target=i.slots[s.readInt(!0)];const p=s.readByte();f.positionMode=p&1,f.spacingMode=p>>1&3,f.rotateMode=p>>3&3,(p&128)!=0&&(f.offsetRotation=s.readFloat()),f.position=s.readFloat(),f.positionMode==vn.Fixed&&(f.position*=t),f.spacing=s.readFloat(),(f.spacingMode==Si.Length||f.spacingMode==Si.Fixed)&&(f.spacing*=t),f.mixRotate=s.readFloat(),f.mixX=s.readFloat(),f.mixY=s.readFloat(),i.pathConstraints.push(f)}h=s.readInt(!0);for(let c=0,u;c<h;c++){const d=s.readString();if(!d)throw new Error("Physics constraint data name must not be null.");const f=new Sb(d);f.order=s.readInt(!0),f.bone=i.bones[s.readInt(!0)];let p=s.readByte();f.skinRequired=(p&1)!=0,(p&2)!=0&&(f.x=s.readFloat()),(p&4)!=0&&(f.y=s.readFloat()),(p&8)!=0&&(f.rotate=s.readFloat()),(p&16)!=0&&(f.scaleX=s.readFloat()),(p&32)!=0&&(f.shearX=s.readFloat()),f.limit=((p&64)!=0?s.readFloat():5e3)*t,f.step=1/s.readUnsignedByte(),f.inertia=s.readFloat(),f.strength=s.readFloat(),f.damping=s.readFloat(),f.massInverse=(p&128)!=0?s.readFloat():1,f.wind=s.readFloat(),f.gravity=s.readFloat(),p=s.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?s.readFloat():1,i.physicsConstraints.push(f)}let l=this.readSkin(s,i,!0,o);l&&(i.defaultSkin=l,i.skins.push(l));{let c=i.skins.length;for(Ue.setArraySize(i.skins,h=c+s.readInt(!0));c<h;c++){let u=this.readSkin(s,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=s.readInt(!0);for(let c=0;c<h;c++){let u=s.readString();if(!u)throw new Error("Event data name must not be null");let d=new xb(u);d.intValue=s.readInt(!1),d.floatValue=s.readFloat(),d.stringValue=s.readString(),d.audioPath=s.readString(),d.audioPath&&(d.volume=s.readFloat(),d.balance=s.readFloat()),i.events.push(d)}h=s.readInt(!0);for(let c=0;c<h;c++){let u=s.readString();if(!u)throw new Error("Animatio name must not be null.");i.animations.push(this.readAnimation(s,u,i))}return i}readSkin(e,t,i,s){let r=null,a=0;if(i){if(a=e.readInt(!0),a==0)return null;r=new Kf("default")}else{let o=e.readString();if(!o)throw new Error("Skin name must not be null.");r=new Kf(o),s&>.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,s);d&&r.setAttachment(h,u,d)}}return r}readAttachment(e,t,i,s,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 kn.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(),y=e.readFloat(),w=e.readFloat(),v=e.readFloat();c||(c=l);let _=this.attachmentLoader.newRegionAttachment(i,l,c,d);return _?(_.path=c,_.x=p*o,_.y=m*o,_.scaleX=g,_.scaleY=y,_.rotation=f,_.width=w*o,_.height=v*o,gt.rgba8888ToColor(_.color,u),_.sequence=d,d==null&&_.updateRegion(),_):null}case kn.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&>.rgba8888ToColor(d.color,u),d):null}case kn.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 y=[],w=0,v=0;a&&(y=this.readShortArray(e,e.readInt(!0)),w=e.readFloat(),v=e.readFloat()),c||(c=l);let _=this.attachmentLoader.newMeshAttachment(i,l,c,d);return _?(_.path=c,gt.rgba8888ToColor(_.color,u),_.bones=p.bones,_.vertices=p.vertices,_.worldVerticesLength=p.length,_.triangles=g,_.regionUVs=m,d==null&&_.updateRegion(),_.hullLength=f<<1,_.sequence=d,a&&(_.edges=y,_.width=w*o,_.height=v*o),_):null}case kn.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,y=0;a&&(g=e.readFloat(),y=e.readFloat());let w=this.attachmentLoader.newMeshAttachment(i,l,c,d);return w?(w.path=c,gt.rgba8888ToColor(w.color,u),w.sequence=d,a&&(w.width=g*o,w.height=y*o),this.linkedMeshes.push(new pI(w,p,s,m,f)),w):null}case kn.Path:{const c=(h&16)!=0,u=(h&32)!=0,d=this.readVertices(e,(h&64)!=0),f=Ue.newArray(d.length/6,0);for(let g=0,y=f.length;g<y;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&>.rgba8888ToColor(m.color,p),m):null}case kn.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&>.rgba8888ToColor(p.color,f),p):null}case kn.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&>.rgba8888ToColor(f.color,d),f):null}}return null}readSequence(e){let t=new P1(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,s=e.readInt(!0),r=new gI;if(r.length=s<<1,!t)return r.vertices=this.readFloatArray(e,r.length,i),r;let a=new Array,o=new Array;for(let h=0;h<s;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=Ue.toFloatArray(a),r.bones=o,r}readFloatArray(e,t,i){let s=new Array(t);if(i==1)for(let r=0;r<t;r++)s[r]=e.readFloat();else for(let r=0;r<t;r++)s[r]=e.readFloat()*i;return s}readShortArray(e,t){let i=new Array(t);for(let s=0;s<t;s++)i[s]=e.readInt(!0);return i}readAnimation(e,t,i){e.readInt(!0);let s=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 CI:{let y=new Ga(m,u);for(let w=0;w<m;w++)y.setFrame(w,e.readFloat(),e.readStringRef());s.push(y);break}case II:{let y=e.readInt(!0),w=new $1(m,y,u),v=e.readFloat(),_=e.readUnsignedByte()/255,x=e.readUnsignedByte()/255,M=e.readUnsignedByte()/255,T=e.readUnsignedByte()/255;for(let C=0,I=0;w.setFrame(C,v,_,x,M,T),C!=g;C++){let k=e.readFloat(),R=e.readUnsignedByte()/255,F=e.readUnsignedByte()/255,B=e.readUnsignedByte()/255,L=e.readUnsignedByte()/255;switch(e.readByte()){case sn:w.setStepped(C);break;case nn:At(e,w,I++,C,0,v,k,_,R,1),At(e,w,I++,C,1,v,k,x,F,1),At(e,w,I++,C,2,v,k,M,B,1),At(e,w,I++,C,3,v,k,T,L,1)}v=k,_=R,x=F,M=B,T=L}s.push(w);break}case RI:{let y=e.readInt(!0),w=new G1(m,y,u),v=e.readFloat(),_=e.readUnsignedByte()/255,x=e.readUnsignedByte()/255,M=e.readUnsignedByte()/255;for(let T=0,C=0;w.setFrame(T,v,_,x,M),T!=g;T++){let I=e.readFloat(),k=e.readUnsignedByte()/255,R=e.readUnsignedByte()/255,F=e.readUnsignedByte()/255;switch(e.readByte()){case sn:w.setStepped(T);break;case nn:At(e,w,C++,T,0,v,I,_,k,1),At(e,w,C++,T,1,v,I,x,R,1),At(e,w,C++,T,2,v,I,M,F,1)}v=I,_=k,x=R,M=F}s.push(w);break}case PI:{let y=e.readInt(!0),w=new j1(m,y,u),v=e.readFloat(),_=e.readUnsignedByte()/255,x=e.readUnsignedByte()/255,M=e.readUnsignedByte()/255,T=e.readUnsignedByte()/255,C=e.readUnsignedByte()/255,I=e.readUnsignedByte()/255,k=e.readUnsignedByte()/255;for(let R=0,F=0;w.setFrame(R,v,_,x,M,T,C,I,k),R!=g;R++){let B=e.readFloat(),L=e.readUnsignedByte()/255,Y=e.readUnsignedByte()/255,O=e.readUnsignedByte()/255,D=e.readUnsignedByte()/255,P=e.readUnsignedByte()/255,U=e.readUnsignedByte()/255,N=e.readUnsignedByte()/255;switch(e.readByte()){case sn:w.setStepped(R);break;case nn:At(e,w,F++,R,0,v,B,_,L,1),At(e,w,F++,R,1,v,B,x,Y,1),At(e,w,F++,R,2,v,B,M,O,1),At(e,w,F++,R,3,v,B,T,D,1),At(e,w,F++,R,4,v,B,C,P,1),At(e,w,F++,R,5,v,B,I,U,1),At(e,w,F++,R,6,v,B,k,N,1)}v=B,_=L,x=Y,M=O,T=D,C=P,I=U,k=N}s.push(w);break}case kI:{let y=e.readInt(!0),w=new W1(m,y,u),v=e.readFloat(),_=e.readUnsignedByte()/255,x=e.readUnsignedByte()/255,M=e.readUnsignedByte()/255,T=e.readUnsignedByte()/255,C=e.readUnsignedByte()/255,I=e.readUnsignedByte()/255;for(let k=0,R=0;w.setFrame(k,v,_,x,M,T,C,I),k!=g;k++){let F=e.readFloat(),B=e.readUnsignedByte()/255,L=e.readUnsignedByte()/255,Y=e.readUnsignedByte()/255,O=e.readUnsignedByte()/255,D=e.readUnsignedByte()/255,P=e.readUnsignedByte()/255;switch(e.readByte()){case sn:w.setStepped(k);break;case nn:At(e,w,R++,k,0,v,F,_,B,1),At(e,w,R++,k,1,v,F,x,L,1),At(e,w,R++,k,2,v,F,M,Y,1),At(e,w,R++,k,3,v,F,T,O,1),At(e,w,R++,k,4,v,F,C,D,1),At(e,w,R++,k,5,v,F,I,P,1)}v=F,_=B,x=L,M=Y,T=O,C=D,I=P}s.push(w);break}case FI:{let y=new H1(m,e.readInt(!0),u),w=e.readFloat(),v=e.readUnsignedByte()/255;for(let _=0,x=0;y.setFrame(_,w,v),_!=g;_++){let M=e.readFloat(),T=e.readUnsignedByte()/255;switch(e.readByte()){case sn:y.setStepped(_);break;case nn:At(e,y,x++,_,0,w,M,v,T,1)}w=M,v=T}s.push(y)}}}}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==AI){let y=new V1(m,u);for(let w=0;w<m;w++)y.setFrame(w,e.readFloat(),e.readByte());s.push(y);continue}let g=e.readInt(!0);switch(p){case vI:s.push(Li(e,new ch(m,g,u),1));break;case yI:s.push(jd(e,new F1(m,g,u),r));break;case xI:s.push(Li(e,new O1(m,g,u),r));break;case bI:s.push(Li(e,new B1(m,g,u),r));break;case wI:s.push(jd(e,new L1(m,g,u),1));break;case SI:s.push(Li(e,new D1(m,g,u),1));break;case _I:s.push(Li(e,new N1(m,g,u),1));break;case TI:s.push(jd(e,new U1(m,g,u),1));break;case MI:s.push(Li(e,new X1(m,g,u),1));break;case EI:s.push(Li(e,new Y1(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 q1(d,e.readInt(!0),u),m=e.readByte(),g=e.readFloat(),y=(m&1)!=0?(m&2)!=0?e.readFloat():1:0,w=(m&4)!=0?e.readFloat()*r:0;for(let v=0,_=0;p.setFrame(v,g,y,w,(m&8)!=0?1:-1,(m&16)!=0,(m&32)!=0),v!=f;v++){m=e.readByte();const x=e.readFloat(),M=(m&1)!=0?(m&2)!=0?e.readFloat():1:0,T=(m&4)!=0?e.readFloat()*r:0;(m&64)!=0?p.setStepped(v):(m&128)!=0&&(At(e,p,_++,v,0,g,x,y,M,1),At(e,p,_++,v,1,g,x,w,T,r)),g=x,y=M,w=T}s.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 K1(d,e.readInt(!0),u),m=e.readFloat(),g=e.readFloat(),y=e.readFloat(),w=e.readFloat(),v=e.readFloat(),_=e.readFloat(),x=e.readFloat();for(let M=0,T=0;p.setFrame(M,m,g,y,w,v,_,x),M!=f;M++){let C=e.readFloat(),I=e.readFloat(),k=e.readFloat(),R=e.readFloat(),F=e.readFloat(),B=e.readFloat(),L=e.readFloat();switch(e.readByte()){case sn:p.setStepped(M);break;case nn:At(e,p,T++,M,0,m,C,g,I,1),At(e,p,T++,M,1,m,C,y,k,1),At(e,p,T++,M,2,m,C,w,R,1),At(e,p,T++,M,3,m,C,v,F,1),At(e,p,T++,M,4,m,C,_,B,1),At(e,p,T++,M,5,m,C,x,L,1)}m=C,g=I,y=k,w=R,v=F,_=B,x=L}s.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),y=e.readInt(!0);switch(m){case LI:s.push(Li(e,new Z1(g,y,u),d.positionMode==vn.Fixed?r:1));break;case DI:s.push(Li(e,new J1(g,y,u),d.spacingMode==Si.Length||d.spacingMode==Si.Fixed?r:1));break;case NI:let w=new Q1(g,y,u),v=e.readFloat(),_=e.readFloat(),x=e.readFloat(),M=e.readFloat();for(let T=0,C=0,I=w.getFrameCount()-1;w.setFrame(T,v,_,x,M),T!=I;T++){let k=e.readFloat(),R=e.readFloat(),F=e.readFloat(),B=e.readFloat();switch(e.readByte()){case sn:w.setStepped(T);break;case nn:At(e,w,C++,T,0,v,k,_,R,1),At(e,w,C++,T,1,v,k,x,F,1),At(e,w,C++,T,2,v,k,M,B,1)}v=k,_=R,x=F,M=B}s.push(w)}}}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==jI){const y=new ob(m,u);for(let w=0;w<m;w++)y.setFrame(w,e.readFloat());s.push(y);continue}const g=e.readInt(!0);switch(p){case UI:s.push(Li(e,new eb(m,g,u),1));break;case XI:s.push(Li(e,new tb(m,g,u),1));break;case YI:s.push(Li(e,new ib(m,g,u),1));break;case VI:s.push(Li(e,new sb(m,g,u),1));break;case $I:s.push(Li(e,new nb(m,g,u),1));break;case GI:s.push(Li(e,new rb(m,g,u),1));break;case HI:s.push(Li(e,new ab(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 y=e.readStringRef();if(!y)throw new Error("attachmentName must not be null.");let w=u.getAttachment(p,y),v=e.readByte(),_=e.readInt(!0),x=_-1;switch(v){case OI:{let M=w,T=M.bones,C=M.vertices,I=T?C.length/3*2:C.length,k=e.readInt(!0),R=new z1(_,k,p,M),F=e.readFloat();for(let B=0,L=0;;B++){let Y,O=e.readInt(!0);if(O==0)Y=T?Ue.newFloatArray(I):C;else{Y=Ue.newFloatArray(I);let P=e.readInt(!0);if(O+=P,r==1)for(let U=P;U<O;U++)Y[U]=e.readFloat();else for(let U=P;U<O;U++)Y[U]=e.readFloat()*r;if(!T)for(let U=0,N=Y.length;U<N;U++)Y[U]+=C[U]}if(R.setFrame(B,F,Y),B==x)break;let D=e.readFloat();switch(e.readByte()){case sn:R.setStepped(B);break;case nn:At(e,R,L++,B,0,F,D,0,1,1)}F=D}s.push(R);break}case BI:{let M=new lb(_,p,w);for(let T=0;T<_;T++){let C=e.readFloat(),I=e.readInt32();M.setFrame(T,C,k1[I&15],I>>4,e.readFloat())}s.push(M);break}}}}}let a=e.readInt(!0);if(a>0){let l=new el(a),c=i.slots.length;for(let u=0;u<a;u++){let d=e.readFloat(),f=e.readInt(!0),p=Ue.newArray(c,0);for(let w=c-1;w>=0;w--)p[w]=-1;let m=Ue.newArray(c-f,0),g=0,y=0;for(let w=0;w<f;w++){let v=e.readInt(!0);for(;g!=v;)m[y++]=g++;p[g+e.readInt(!0)]=g++}for(;g<c;)m[y++]=g++;for(let w=c-1;w>=0;w--)p[w]==-1&&(p[w]=m[--y]);l.setFrame(u,d,p)}s.push(l)}let o=e.readInt(!0);if(o>0){let l=new Jm(o);for(let c=0;c<o;c++){let u=e.readFloat(),d=i.events[e.readInt(!0)],f=new yb(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)}s.push(l)}let h=0;for(let l=0,c=s.length;l<c;l++)h=Math.max(h,s[l].getDuration());return new Km(t,s,h)}},mI=class{constructor(e,t=new Array,i=0,s=new DataView(e instanceof ArrayBuffer?e:e.buffer)){b(this,"strings");b(this,"index");b(this,"buffer");this.strings=t,this.index=i,this.buffer=s}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 s=this.readUnsignedByte();switch(s>>4){case 12:case 13:t+=String.fromCharCode((s&31)<<6|this.readByte()&63),i+=2;break;case 14:t+=String.fromCharCode((s&15)<<12|(this.readByte()&63)<<6|this.readByte()&63),i+=3;break;default:t+=String.fromCharCode(s),i++}}return t}readFloat(){let e=this.buffer.getFloat32(this.index);return this.index+=4,e}readBoolean(){return this.readByte()!=0}},pI=class{constructor(e,t,i,s,r){b(this,"parent");b(this,"skinIndex");b(this,"slotIndex");b(this,"mesh");b(this,"inheritTimeline");this.mesh=e,this.skinIndex=t,this.slotIndex=i,this.parent=s,this.inheritTimeline=r}},gI=class{constructor(e=null,t=null,i=0){b(this,"bones");b(this,"vertices");b(this,"length");this.bones=e,this.vertices=t,this.length=i}};var kn;(function(n){n[n.Region=0]="Region",n[n.BoundingBox=1]="BoundingBox",n[n.Mesh=2]="Mesh",n[n.LinkedMesh=3]="LinkedMesh",n[n.Path=4]="Path",n[n.Point=5]="Point",n[n.Clipping=6]="Clipping"})(kn||(kn={}));function Li(n,e,t){let i=n.readFloat(),s=n.readFloat()*t;for(let r=0,a=0,o=e.getFrameCount()-1;e.setFrame(r,i,s),r!=o;r++){let h=n.readFloat(),l=n.readFloat()*t;switch(n.readByte()){case sn:e.setStepped(r);break;case nn:At(n,e,a++,r,0,i,h,s,l,t)}i=h,s=l}return e}function jd(n,e,t){let i=n.readFloat(),s=n.readFloat()*t,r=n.readFloat()*t;for(let a=0,o=0,h=e.getFrameCount()-1;e.setFrame(a,i,s,r),a!=h;a++){let l=n.readFloat(),c=n.readFloat()*t,u=n.readFloat()*t;switch(n.readByte()){case sn:e.setStepped(a);break;case nn:At(n,e,o++,a,0,i,l,s,c,t),At(n,e,o++,a,1,i,l,r,u,t)}i=l,s=c,r=u}return e}function At(n,e,t,i,s,r,a,o,h,l){e.setBezier(t,i,s,r,o,n.readFloat(),n.readFloat()*l,n.readFloat(),n.readFloat()*l,a,h)}const vI=0,yI=1,xI=2,bI=3,wI=4,SI=5,_I=6,TI=7,MI=8,EI=9,AI=10,CI=0,II=1,RI=2,PI=3,kI=4,FI=5,OI=0,BI=1,LI=0,DI=1,NI=2,UI=0,XI=1,YI=2,VI=4,$I=5,GI=6,HI=7,jI=8,sn=1,nn=2;class es{constructor(){b(this,"convexPolygons",new Array);b(this,"convexPolygonsIndices",new Array);b(this,"indicesArray",new Array);b(this,"isConcaveArray",new Array);b(this,"triangles",new Array);b(this,"polygonPool",new oh(()=>new Array));b(this,"polygonIndicesPool",new oh(()=>new Array))}triangulate(e){let t=e,i=e.length>>1,s=this.indicesArray;s.length=0;for(let o=0;o<i;o++)s[o]=o;let r=this.isConcaveArray;r.length=0;for(let o=0,h=i;o<h;++o)r[o]=es.isConcave(o,i,t,s);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=s[o]<<1,f=s[h]<<1,p=s[l]<<1,m=t[d],g=t[d+1],y=t[f],w=t[f+1],v=t[p],_=t[p+1];for(let x=(l+1)%i;x!=o;x=(x+1)%i){if(!r[x])continue;let M=s[x]<<1,T=t[M],C=t[M+1];if(es.positiveArea(v,_,m,g,T,C)&&es.positiveArea(m,g,y,w,T,C)&&es.positiveArea(y,w,v,_,T,C))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(s[(i+h-1)%i]),a.push(s[h]),a.push(s[(h+1)%i]),s.splice(h,1),r.splice(h,1),i--;let c=(i+h-1)%i,u=h==i?0:h;r[c]=es.isConcave(c,i,t,s),r[u]=es.isConcave(u,i,t,s)}return i==3&&(a.push(s[2]),a.push(s[0]),a.push(s[1])),a}decompose(e,t){let i=e,s=this.convexPolygons;this.polygonPool.freeAll(s),s.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],y=i[f],w=i[f+1],v=i[p],_=i[p+1],x=!1;if(h==d){let M=o.length-4,T=es.winding(o[M],o[M+1],o[M+2],o[M+3],v,_),C=es.winding(v,_,o[0],o[1],o[2],o[3]);T==l&&C==l&&(o.push(v),o.push(_),a.push(p),x=!0)}x||(o.length>0?(s.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(y),o.push(w),o.push(v),o.push(_),a=this.polygonIndicesPool.obtain(),a.length=0,a.push(d),a.push(f),a.push(p),l=es.winding(m,g,y,w,v,_),h=d)}o.length>0&&(s.push(o),r.push(a));for(let c=0,u=s.length;c<u;c++){if(a=r[c],a.length==0)continue;let d=a[0],f=a[a.length-1];o=s[c];let p=o.length-4,m=o[p],g=o[p+1],y=o[p+2],w=o[p+3],v=o[0],_=o[1],x=o[2],M=o[3],T=es.winding(m,g,y,w,v,_);for(let C=0;C<u;C++){if(C==c)continue;let I=r[C];if(I.length!=3)continue;let k=I[0],R=I[1],F=I[2],B=s[C],L=B[B.length-2],Y=B[B.length-1];if(k!=d||R!=f)continue;let O=es.winding(m,g,y,w,L,Y),D=es.winding(L,Y,v,_,x,M);O==T&&D==T&&(B.length=0,I.length=0,o.push(L),o.push(Y),a.push(F),m=y,g=w,y=L,w=Y,C=0)}}for(let c=s.length-1;c>=0;c--)o=s[c],o.length==0&&(s.splice(c,1),this.polygonPool.free(o),a=r[c],r.splice(c,1),this.polygonIndicesPool.free(a));return s}static isConcave(e,t,i,s){let r=s[(t+e-1)%t]<<1,a=s[e]<<1,o=s[(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,s,r,a){return e*(a-s)+i*(t-a)+r*(s-t)>=0}static winding(e,t,i,s,r,a){let o=i-e,h=s-t;return r*h-a*o+o*t-e*h>=0?1:-1}}class uh{constructor(){b(this,"triangulator",new es);b(this,"clippingPolygon",new Array);b(this,"clipOutput",new Array);b(this,"clippedVertices",new Array);b(this,"clippedUVs",new Array);b(this,"clippedTriangles",new Array);b(this,"scratch",new Array);b(this,"clipAttachment",null);b(this,"clippingPolygons",null)}clipStart(e,t){if(this.clipAttachment)return 0;this.clipAttachment=t;let i=t.worldVerticesLength,s=Ue.setArraySize(this.clippingPolygon,i);t.computeWorldVertices(e,0,i,s,0,2);let r=this.clippingPolygon;uh.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];uh.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,s,r,a,o,h){let l,c,u,d,f,p;typeof t=="number"?(l=i,c=s,u=r,d=a,f=o,p=h):(l=t,c=i,u=s,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 s=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],y=e[u+1];for(let w=0;w<h;w++){let v=r.length;if(this.clip(d,f,p,m,g,y,o[w],s)){let _=s.length;if(_==0)continue;let x=_>>1,M=this.clipOutput,T=Ue.setArraySize(r,v+x*2);for(let I=0;I<_;I+=2,v+=2){let k=M[I],R=M[I+1];T[v]=k,T[v+1]=R}v=a.length;let C=Ue.setArraySize(a,v+3*(x-2));x--;for(let I=1;I<x;I++,v+=3)C[v]=l,C[v+1]=l+I,C[v+2]=l+I+1;l+=x+1}else{let _=Ue.setArraySize(r,v+6);_[v]=d,_[v+1]=f,_[v+2]=p,_[v+3]=m,_[v+4]=g,_[v+5]=y,v=a.length;let x=Ue.setArraySize(a,v+3);x[v]=l,x[v+1]=l+1,x[v+2]=l+2,l+=3;break}}}}clipTrianglesRender(e,t,i,s,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,y=e[g],w=e[g+1],v=s[g],_=s[g+1];g=t[m+1]<<1;let x=e[g],M=e[g+1],T=s[g],C=s[g+1];g=t[m+2]<<1;let I=e[g],k=e[g+1],R=s[g],F=s[g+1];for(let B=0;B<d;B++){let L=l.length;if(this.clip(y,w,x,M,I,k,u[B],h)){let Y=h.length;if(Y==0)continue;let O=M-k,D=I-x,P=y-I,U=k-w,N=1/(O*P+D*(w-k)),X=Y>>1,K=this.clipOutput,z=Ue.setArraySize(l,L+X*f);for(let Q=0;Q<Y;Q+=2,L+=f){let me=K[Q],pe=K[Q+1];z[L]=me,z[L+1]=pe,z[L+2]=r.r,z[L+3]=r.g,z[L+4]=r.b,z[L+5]=r.a;let Me=me-I,Ie=pe-k,ge=(O*Me+D*Ie)*N,Ee=(U*Me+P*Ie)*N,H=1-ge-Ee;z[L+6]=v*ge+T*Ee+R*H,z[L+7]=_*ge+C*Ee+F*H,o&&(z[L+8]=a.r,z[L+9]=a.g,z[L+10]=a.b,z[L+11]=a.a)}L=c.length;let se=Ue.setArraySize(c,L+3*(X-2));X--;for(let Q=1;Q<X;Q++,L+=3)se[L]=p,se[L+1]=p+Q,se[L+2]=p+Q+1;p+=X+1}else{let Y=Ue.setArraySize(l,L+3*f);Y[L]=y,Y[L+1]=w,Y[L+2]=r.r,Y[L+3]=r.g,Y[L+4]=r.b,Y[L+5]=r.a,o?(Y[L+6]=v,Y[L+7]=_,Y[L+8]=a.r,Y[L+9]=a.g,Y[L+10]=a.b,Y[L+11]=a.a,Y[L+12]=x,Y[L+13]=M,Y[L+14]=r.r,Y[L+15]=r.g,Y[L+16]=r.b,Y[L+17]=r.a,Y[L+18]=T,Y[L+19]=C,Y[L+20]=a.r,Y[L+21]=a.g,Y[L+22]=a.b,Y[L+23]=a.a,Y[L+24]=I,Y[L+25]=k,Y[L+26]=r.r,Y[L+27]=r.g,Y[L+28]=r.b,Y[L+29]=r.a,Y[L+30]=R,Y[L+31]=F,Y[L+32]=a.r,Y[L+33]=a.g,Y[L+34]=a.b,Y[L+35]=a.a):(Y[L+6]=v,Y[L+7]=_,Y[L+8]=x,Y[L+9]=M,Y[L+10]=r.r,Y[L+11]=r.g,Y[L+12]=r.b,Y[L+13]=r.a,Y[L+14]=T,Y[L+15]=C,Y[L+16]=I,Y[L+17]=k,Y[L+18]=r.r,Y[L+19]=r.g,Y[L+20]=r.b,Y[L+21]=r.a,Y[L+22]=R,Y[L+23]=F),L=c.length;let O=Ue.setArraySize(c,L+3);O[L]=p,O[L+1]=p+1,O[L+2]=p+2,p+=3;break}}}}clipTrianglesUnpacked(e,t,i,s){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=s[f],y=s[f+1];f=t[d+1]<<1;let w=e[f],v=e[f+1],_=s[f],x=s[f+1];f=t[d+2]<<1;let M=e[f],T=e[f+1],C=s[f],I=s[f+1];for(let k=0;k<c;k++){let R=a.length;if(this.clip(p,m,w,v,M,T,l[k],r)){let F=r.length;if(F==0)continue;let B=v-T,L=M-w,Y=p-M,O=T-m,D=1/(B*Y+L*(m-T)),P=F>>1,U=this.clipOutput,N=Ue.setArraySize(a,R+P*2),X=Ue.setArraySize(o,R+P*2);for(let z=0;z<F;z+=2,R+=2){let se=U[z],Q=U[z+1];N[R]=se,N[R+1]=Q;let me=se-M,pe=Q-T,Me=(B*me+L*pe)*D,Ie=(O*me+Y*pe)*D,ge=1-Me-Ie;X[R]=g*Me+_*Ie+C*ge,X[R+1]=y*Me+x*Ie+I*ge}R=h.length;let K=Ue.setArraySize(h,R+3*(P-2));P--;for(let z=1;z<P;z++,R+=3)K[R]=u,K[R+1]=u+z,K[R+2]=u+z+1;u+=P+1}else{let F=Ue.setArraySize(a,R+6);F[R]=p,F[R+1]=m,F[R+2]=w,F[R+3]=v,F[R+4]=M,F[R+5]=T;let B=Ue.setArraySize(o,R+6);B[R]=g,B[R+1]=y,B[R+2]=_,B[R+3]=x,B[R+4]=C,B[R+5]=I,R=h.length;let L=Ue.setArraySize(h,R+3);L[R]=u,L[R+1]=u+1,L[R+2]=u+2,u+=3;break}}}}clip(e,t,i,s,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(s),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],y=m-f[p+2],w=g-f[p+3],v=h.length,_=u;for(let M=0,T=u.length-2;M<T;){let C=_[M],I=_[M+1];M+=2;let k=_[M],R=_[M+1],F=w*(m-k)>y*(g-R),B=w*(m-C)-y*(g-I);if(B>0){if(F){h.push(k),h.push(R);continue}let L=k-C,Y=R-I,O=B/(L*w-Y*y);if(O>=0&&O<=1)h.push(C+L*O),h.push(I+Y*O);else{h.push(k),h.push(R);continue}}else if(F){let L=k-C,Y=R-I,O=B/(L*w-Y*y);if(O>=0&&O<=1)h.push(C+L*O),h.push(I+Y*O),h.push(k),h.push(R);else{h.push(k),h.push(R);continue}}c=!0}if(v==h.length)return l.length=0,!0;if(h.push(h[0]),h.push(h[1]),p==d)break;let x=h;h=u,h.length=0,u=x}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,s=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],s+=r*h-o*a;if(!(s<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){b(this,"attachmentLoader");b(this,"scale",1);b(this,"linkedMeshes",new Array);this.attachmentLoader=e}readSkeletonData(e){let t=this.scale,i=new hh,s=typeof e=="string"?JSON.parse(e):e,r=s.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=re(r,"referenceScale",100)*t,i.fps=r.fps,i.imagesPath=r.images??null,i.audioPath=r.audio??null),s.bones)for(let a=0;a<s.bones.length;a++){let o=s.bones[a],h=null,l=re(o,"parent",null);l&&(h=i.findBone(l));let c=new vb(i.bones.length,o.name,h);c.length=re(o,"length",0)*t,c.x=re(o,"x",0)*t,c.y=re(o,"y",0)*t,c.rotation=re(o,"rotation",0),c.scaleX=re(o,"scaleX",1),c.scaleY=re(o,"scaleY",1),c.shearX=re(o,"shearX",0),c.shearY=re(o,"shearY",0),c.inherit=Ue.enumValue(ni,re(o,"inherit","Normal")),c.skinRequired=re(o,"skin",!1);let u=re(o,"color",null);u&&c.color.setFromString(u),i.bones.push(c)}if(s.slots)for(let a=0;a<s.slots.length;a++){let o=s.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 _b(i.slots.length,h,l),u=re(o,"color",null);u&&c.color.setFromString(u);let d=re(o,"dark",null);d&&(c.darkColor=gt.fromString(d)),c.attachmentName=re(o,"attachment",null),c.blendMode=Ue.enumValue(Er,re(o,"blend","normal")),c.visible=re(o,"visible",!0),i.slots.push(c)}if(s.ik)for(let a=0;a<s.ik.length;a++){let o=s.ik[a],h=new bb(o.name);h.order=re(o,"order",0),h.skinRequired=re(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=re(o,"mix",1),h.softness=re(o,"softness",0)*t,h.bendDirection=re(o,"bendPositive",!0)?1:-1,h.compress=re(o,"compress",!1),h.stretch=re(o,"stretch",!1),h.uniform=re(o,"uniform",!1),i.ikConstraints.push(h)}if(s.transform)for(let a=0;a<s.transform.length;a++){let o=s.transform[a],h=new Tb(o.name);h.order=re(o,"order",0),h.skinRequired=re(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=re(o,"local",!1),h.relative=re(o,"relative",!1),h.offsetRotation=re(o,"rotation",0),h.offsetX=re(o,"x",0)*t,h.offsetY=re(o,"y",0)*t,h.offsetScaleX=re(o,"scaleX",0),h.offsetScaleY=re(o,"scaleY",0),h.offsetShearY=re(o,"shearY",0),h.mixRotate=re(o,"mixRotate",1),h.mixX=re(o,"mixX",1),h.mixY=re(o,"mixY",h.mixX),h.mixScaleX=re(o,"mixScaleX",1),h.mixScaleY=re(o,"mixScaleY",h.mixScaleX),h.mixShearY=re(o,"mixShearY",1),i.transformConstraints.push(h)}if(s.path)for(let a=0;a<s.path.length;a++){let o=s.path[a],h=new wb(o.name);h.order=re(o,"order",0),h.skinRequired=re(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=Ue.enumValue(vn,re(o,"positionMode","Percent")),h.spacingMode=Ue.enumValue(Si,re(o,"spacingMode","Length")),h.rotateMode=Ue.enumValue(ha,re(o,"rotateMode","Tangent")),h.offsetRotation=re(o,"rotation",0),h.position=re(o,"position",0),h.positionMode==vn.Fixed&&(h.position*=t),h.spacing=re(o,"spacing",0),(h.spacingMode==Si.Length||h.spacingMode==Si.Fixed)&&(h.spacing*=t),h.mixRotate=re(o,"mixRotate",1),h.mixX=re(o,"mixX",1),h.mixY=re(o,"mixY",h.mixX),i.pathConstraints.push(h)}if(s.physics)for(let a=0;a<s.physics.length;a++){const o=s.physics[a],h=new Sb(o.name);h.order=re(o,"order",0),h.skinRequired=re(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=re(o,"x",0),h.y=re(o,"y",0),h.rotate=re(o,"rotate",0),h.scaleX=re(o,"scaleX",0),h.shearX=re(o,"shearX",0),h.limit=re(o,"limit",5e3)*t,h.step=1/re(o,"fps",60),h.inertia=re(o,"inertia",1),h.strength=re(o,"strength",100),h.damping=re(o,"damping",1),h.massInverse=1/re(o,"mass",1),h.wind=re(o,"wind",0),h.gravity=re(o,"gravity",0),h.mix=re(o,"mix",1),h.inertiaGlobal=re(o,"inertiaGlobal",!1),h.strengthGlobal=re(o,"strengthGlobal",!1),h.dampingGlobal=re(o,"dampingGlobal",!1),h.massGlobal=re(o,"massGlobal",!1),h.windGlobal=re(o,"windGlobal",!1),h.gravityGlobal=re(o,"gravityGlobal",!1),h.mixGlobal=re(o,"mixGlobal",!1),i.physicsConstraints.push(h)}if(s.skins)for(let a=0;a<s.skins.length;a++){let o=s.skins[a],h=new Kf(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,s.events)for(let a in s.events){let o=s.events[a],h=new xb(a);h.intValue=re(o,"int",0),h.floatValue=re(o,"float",0),h.stringValue=re(o,"string",""),h.audioPath=re(o,"audio",null),h.audioPath&&(h.volume=re(o,"volume",1),h.balance=re(o,"balance",0)),i.events.push(h)}if(s.animations)for(let a in s.animations){let o=s.animations[a];this.readAnimation(o,a,i)}return i}readAttachment(e,t,i,s,r){let a=this.scale;switch(s=re(e,"name",s),re(e,"type","region")){case"region":{let o=re(e,"path",s),h=this.readSequence(re(e,"sequence",null)),l=this.attachmentLoader.newRegionAttachment(t,s,o,h);if(!l)return null;l.path=o,l.x=re(e,"x",0)*a,l.y=re(e,"y",0)*a,l.scaleX=re(e,"scaleX",1),l.scaleY=re(e,"scaleY",1),l.rotation=re(e,"rotation",0),l.width=e.width*a,l.height=e.height*a,l.sequence=h;let c=re(e,"color",null);return c&&l.color.setFromString(c),l.region!=null&&l.updateRegion(),l}case"boundingbox":{let o=this.attachmentLoader.newBoundingBoxAttachment(t,s);if(!o)return null;this.readVertices(e,o,e.vertexCount<<1);let h=re(e,"color",null);return h&&o.color.setFromString(h),o}case"mesh":case"linkedmesh":{let o=re(e,"path",s),h=this.readSequence(re(e,"sequence",null)),l=this.attachmentLoader.newMeshAttachment(t,s,o,h);if(!l)return null;l.path=o;let c=re(e,"color",null);c&&l.color.setFromString(c),l.width=re(e,"width",0)*a,l.height=re(e,"height",0)*a,l.sequence=h;let u=re(e,"parent",null);if(u)return this.linkedMeshes.push(new WI(l,re(e,"skin",null),i,u,re(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=re(e,"edges",null),l.hullLength=re(e,"hull",0)*2,l}case"path":{let o=this.attachmentLoader.newPathAttachment(t,s);if(!o)return null;o.closed=re(e,"closed",!1),o.constantSpeed=re(e,"constantSpeed",!0);let h=e.vertexCount;this.readVertices(e,o,h<<1);let l=Ue.newArray(h/3,0);for(let u=0;u<e.lengths.length;u++)l[u]=e.lengths[u]*a;o.lengths=l;let c=re(e,"color",null);return c&&o.color.setFromString(c),o}case"point":{let o=this.attachmentLoader.newPointAttachment(t,s);if(!o)return null;o.x=re(e,"x",0)*a,o.y=re(e,"y",0)*a,o.rotation=re(e,"rotation",0);let h=re(e,"color",null);return h&&o.color.setFromString(h),o}case"clipping":{let o=this.attachmentLoader.newClippingAttachment(t,s);if(!o)return null;let h=re(e,"end",null);h&&(o.endSlot=r.findSlot(h));let l=e.vertexCount;this.readVertices(e,o,l<<1);let c=re(e,"color",null);return c&&o.color.setFromString(c),o}}return null}readSequence(e){if(e==null)return null;let t=new P1(re(e,"count",0));return t.start=re(e,"start",1),t.digits=re(e,"digits",0),t.setupIndex=re(e,"setup",0),t}readVertices(e,t,i){let s=this.scale;t.worldVerticesLength=i;let r=e.vertices;if(i==r.length){let h=Ue.toFloatArray(r);if(s!=1)for(let l=0,c=r.length;l<c;l++)h[l]*=s;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]*s),a.push(r[h+2]*s),a.push(r[h+3])}t.bones=o,t.vertices=Ue.toFloatArray(a)}readAnimation(e,t,i){let s=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 Ga(f,c);for(let m=0;m<f;m++){let g=d[m];p.setFrame(m,re(g,"time",0),re(g,"name",null))}r.push(p)}else if(u=="rgba"){let p=new $1(f,f<<2,c),m=d[0],g=re(m,"time",0),y=gt.fromString(m.color);for(let w=0,v=0;;w++){p.setFrame(w,g,y.r,y.g,y.b,y.a);let _=d[w+1];if(!_){p.shrink(v);break}let x=re(_,"time",0),M=gt.fromString(_.color),T=m.curve;T&&(v=Rt(T,p,v,w,0,g,x,y.r,M.r,1),v=Rt(T,p,v,w,1,g,x,y.g,M.g,1),v=Rt(T,p,v,w,2,g,x,y.b,M.b,1),v=Rt(T,p,v,w,3,g,x,y.a,M.a,1)),g=x,y=M,m=_}r.push(p)}else if(u=="rgb"){let p=new G1(f,f*3,c),m=d[0],g=re(m,"time",0),y=gt.fromString(m.color);for(let w=0,v=0;;w++){p.setFrame(w,g,y.r,y.g,y.b);let _=d[w+1];if(!_){p.shrink(v);break}let x=re(_,"time",0),M=gt.fromString(_.color),T=m.curve;T&&(v=Rt(T,p,v,w,0,g,x,y.r,M.r,1),v=Rt(T,p,v,w,1,g,x,y.g,M.g,1),v=Rt(T,p,v,w,2,g,x,y.b,M.b,1)),g=x,y=M,m=_}r.push(p)}else if(u=="alpha")r.push(Cs(d,new H1(f,f,c),0,1));else if(u=="rgba2"){let p=new j1(f,f*7,c),m=d[0],g=re(m,"time",0),y=gt.fromString(m.light),w=gt.fromString(m.dark);for(let v=0,_=0;;v++){p.setFrame(v,g,y.r,y.g,y.b,y.a,w.r,w.g,w.b);let x=d[v+1];if(!x){p.shrink(_);break}let M=re(x,"time",0),T=gt.fromString(x.light),C=gt.fromString(x.dark),I=m.curve;I&&(_=Rt(I,p,_,v,0,g,M,y.r,T.r,1),_=Rt(I,p,_,v,1,g,M,y.g,T.g,1),_=Rt(I,p,_,v,2,g,M,y.b,T.b,1),_=Rt(I,p,_,v,3,g,M,y.a,T.a,1),_=Rt(I,p,_,v,4,g,M,w.r,C.r,1),_=Rt(I,p,_,v,5,g,M,w.g,C.g,1),_=Rt(I,p,_,v,6,g,M,w.b,C.b,1)),g=M,y=T,w=C,m=x}r.push(p)}else if(u=="rgb2"){let p=new W1(f,f*6,c),m=d[0],g=re(m,"time",0),y=gt.fromString(m.light),w=gt.fromString(m.dark);for(let v=0,_=0;;v++){p.setFrame(v,g,y.r,y.g,y.b,w.r,w.g,w.b);let x=d[v+1];if(!x){p.shrink(_);break}let M=re(x,"time",0),T=gt.fromString(x.light),C=gt.fromString(x.dark),I=m.curve;I&&(_=Rt(I,p,_,v,0,g,M,y.r,T.r,1),_=Rt(I,p,_,v,1,g,M,y.g,T.g,1),_=Rt(I,p,_,v,2,g,M,y.b,T.b,1),_=Rt(I,p,_,v,3,g,M,w.r,C.r,1),_=Rt(I,p,_,v,4,g,M,w.g,C.g,1),_=Rt(I,p,_,v,5,g,M,w.b,C.b,1)),g=M,y=T,w=C,m=x}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(Cs(d,new ch(f,f,c),0,1));else if(u==="translate"){let p=new F1(f,f<<1,c);r.push(Wd(d,p,"x","y",0,s))}else if(u==="translatex"){let p=new O1(f,f,c);r.push(Cs(d,p,0,s))}else if(u==="translatey"){let p=new B1(f,f,c);r.push(Cs(d,p,0,s))}else if(u==="scale"){let p=new L1(f,f<<1,c);r.push(Wd(d,p,"x","y",1,1))}else if(u==="scalex"){let p=new D1(f,f,c);r.push(Cs(d,p,1,1))}else if(u==="scaley"){let p=new N1(f,f,c);r.push(Cs(d,p,1,1))}else if(u==="shear"){let p=new U1(f,f<<1,c);r.push(Wd(d,p,"x","y",0,1))}else if(u==="shearx"){let p=new X1(f,f,c);r.push(Cs(d,p,0,1))}else if(u==="sheary"){let p=new Y1(f,f,c);r.push(Cs(d,p,0,1))}else if(u==="inherit"){let p=new V1(f,l.index);for(let m=0;m<d.length;m++){let g=d[m];p.setFrame(m,re(g,"time",0),Ue.enumValue(ni,re(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 q1(h.length,h.length<<1,u),f=re(l,"time",0),p=re(l,"mix",1),m=re(l,"softness",0)*s;for(let g=0,y=0;;g++){d.setFrame(g,f,p,m,re(l,"bendPositive",!0)?1:-1,re(l,"compress",!1),re(l,"stretch",!1));let w=h[g+1];if(!w){d.shrink(y);break}let v=re(w,"time",0),_=re(w,"mix",1),x=re(w,"softness",0)*s,M=l.curve;M&&(y=Rt(M,d,y,g,0,f,v,p,_,1),y=Rt(M,d,y,g,1,f,v,m,x,s)),f=v,p=_,m=x,l=w}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 K1(h.length,h.length*6,u),f=re(l,"time",0),p=re(l,"mixRotate",1),m=re(l,"mixX",1),g=re(l,"mixY",m),y=re(l,"mixScaleX",1),w=re(l,"mixScaleY",y),v=re(l,"mixShearY",1);for(let _=0,x=0;;_++){d.setFrame(_,f,p,m,g,y,w,v);let M=h[_+1];if(!M){d.shrink(x);break}let T=re(M,"time",0),C=re(M,"mixRotate",1),I=re(M,"mixX",1),k=re(M,"mixY",I),R=re(M,"mixScaleX",1),F=re(M,"mixScaleY",R),B=re(M,"mixShearY",1),L=l.curve;L&&(x=Rt(L,d,x,_,0,f,T,p,C,1),x=Rt(L,d,x,_,1,f,T,m,I,1),x=Rt(L,d,x,_,2,f,T,g,k,1),x=Rt(L,d,x,_,3,f,T,y,R,1),x=Rt(L,d,x,_,4,f,T,w,F,1),x=Rt(L,d,x,_,5,f,T,v,B,1)),f=T,p=C,m=I,g=k,y=R,w=F,y=R,l=M}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 Z1(p,p,c);r.push(Cs(d,m,0,l.positionMode==vn.Fixed?s:1))}else if(u==="spacing"){let m=new J1(p,p,c);r.push(Cs(d,m,0,l.spacingMode==Si.Length||l.spacingMode==Si.Fixed?s:1))}else if(u==="mix"){let m=new Q1(p,p*3,c),g=re(f,"time",0),y=re(f,"mixRotate",1),w=re(f,"mixX",1),v=re(f,"mixY",w);for(let _=0,x=0;;_++){m.setFrame(_,g,y,w,v);let M=d[_+1];if(!M){m.shrink(x);break}let T=re(M,"time",0),C=re(M,"mixRotate",1),I=re(M,"mixX",1),k=re(M,"mixY",I),R=f.curve;R&&(x=Rt(R,m,x,_,0,g,T,y,C,1),x=Rt(R,m,x,_,1,g,T,w,I,1),x=Rt(R,m,x,_,2,g,T,v,k,1)),g=T,y=C,w=I,v=k,f=M}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 ob(f,l);for(let g=0;d!=null;d=u[g+1],g++)m.setFrame(g,re(d,"time",0));r.push(m);continue}let p;if(c=="inertia")p=new eb(f,f,l);else if(c=="strength")p=new tb(f,f,l);else if(c=="damping")p=new ib(f,f,l);else if(c=="mass")p=new sb(f,f,l);else if(c=="wind")p=new nb(f,f,l);else if(c=="gravity")p=new rb(f,f,l);else if(c=="mix")p=new ab(f,f,l);else continue;r.push(Cs(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 y in m){let w=m[y],v=w[0];if(v){if(y=="deform"){let _=g.bones,x=g.vertices,M=_?x.length/3*2:x.length,T=new z1(w.length,w.length,f,g),C=re(v,"time",0);for(let I=0,k=0;;I++){let R,F=re(v,"vertices",null);if(!F)R=_?Ue.newFloatArray(M):x;else{R=Ue.newFloatArray(M);let O=re(v,"offset",0);if(Ue.arrayCopy(F,0,R,O,F.length),s!=1)for(let D=O,P=D+F.length;D<P;D++)R[D]*=s;if(!_)for(let D=0;D<M;D++)R[D]+=x[D]}T.setFrame(I,C,R);let B=w[I+1];if(!B){T.shrink(k);break}let L=re(B,"time",0),Y=v.curve;Y&&(k=Rt(Y,T,k,I,0,C,L,0,1,1)),C=L,v=B}r.push(T)}else if(y=="sequence"){let _=new lb(w.length,f,g),x=0;for(let M=0;M<w.length;M++){let T=re(v,"delay",x),C=re(v,"time",0),I=Ri[re(v,"mode","hold")],k=re(v,"index",0);_.setFrame(M,C,I,k,T),x=T,v=w[M+1]}r.push(_)}}}}}}if(e.drawOrder){let o=new el(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=re(u,"offsets",null);if(f){d=Ue.newArray(h,-1);let p=Ue.newArray(h-f.length,0),m=0,g=0;for(let y=0;y<f.length;y++){let w=f[y],v=i.findSlot(w.slot);if(!v)throw new Error("Slot not found: "+v);let _=v.index;for(;m!=_;)p[g++]=m++;d[m+w.offset]=m++}for(;m<h;)p[g++]=m++;for(let y=h-1;y>=0;y--)d[y]==-1&&(d[y]=p[--g])}o.setFrame(l,re(u,"time",0),d)}r.push(o)}if(e.events){let o=new Jm(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 yb(Ue.toSinglePrecision(re(c,"time",0)),u);d.intValue=re(c,"int",u.intValue),d.floatValue=re(c,"float",u.floatValue),d.stringValue=re(c,"string",u.stringValue),d.data.audioPath&&(d.volume=re(c,"volume",1),d.balance=re(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 Km(t,r,a))}},WI=class{constructor(e,t,i,s,r){b(this,"parent");b(this,"skin");b(this,"slotIndex");b(this,"mesh");b(this,"inheritTimeline");this.mesh=e,this.skin=t,this.slotIndex=i,this.parent=s,this.inheritTimeline=r}};function Cs(n,e,t,i){let s=n[0],r=re(s,"time",0),a=re(s,"value",t)*i,o=0;for(let h=0;;h++){e.setFrame(h,r,a);let l=n[h+1];if(!l)return e.shrink(o),e;let c=re(l,"time",0),u=re(l,"value",t)*i;s.curve&&(o=Rt(s.curve,e,o,h,0,r,c,a,u,i)),r=c,a=u,s=l}}function Wd(n,e,t,i,s,r){let a=n[0],o=re(a,"time",0),h=re(a,t,s)*r,l=re(a,i,s)*r,c=0;for(let u=0;;u++){e.setFrame(u,o,h,l);let d=n[u+1];if(!d)return e.shrink(c),e;let f=re(d,"time",0),p=re(d,t,s)*r,m=re(d,i,s)*r,g=a.curve;g&&(c=Rt(g,e,c,u,0,o,f,h,p,r),c=Rt(g,e,c,u,1,o,f,l,m,r)),o=f,h=p,l=m,a=d}}function Rt(n,e,t,i,s,r,a,o,h,l){if(n=="stepped")return e.setStepped(i),t;let c=s<<2,u=n[c],d=n[c+1]*l,f=n[c+2],p=n[c+3]*l;return e.setBezier(t,i,s,r,o,u,d,f,p,a,h),t+1}function re(n,e,t){return n[e]!==void 0?n[e]:t}typeof Math.fround>"u"&&(Math.fround=(function(n){return function(e){return n[0]=e,n[0]}})(new Float32Array(1)));if(typeof window<"u"&&window.PIXI){let n=window.require;window.require=e=>{if(n)return n(e);if(e.startsWith("@pixi/"))return window.PIXI}}const On=class On extends rI{constructor(t){super(t.resource.source);b(this,"texture");this.texture=rt.from(t)}static from(t){return On.textureMap.has(t)?On.textureMap.get(t):new On(t)}setFilters(t,i){this.texture.baseTexture.scaleMode=On.toPixiTextureFilter(t),this.texture.baseTexture.mipmap=On.toPixiMipMap(t)}setWraps(t,i){this.texture.baseTexture.wrapMode=On.toPixiTextureWrap(t)}dispose(){this.texture.destroy()}static toPixiTextureFilter(t){switch(t){case Mi.Nearest:case Mi.MipMapNearestLinear:case Mi.MipMapNearestNearest:return Os.NEAREST;case Mi.Linear:case Mi.MipMapLinearLinear:case Mi.MipMapLinearNearest:return Os.LINEAR;default:throw new Error(`Unknown texture filter: ${String(t)}`)}}static toPixiMipMap(t){switch(t){case Mi.Nearest:case Mi.Linear:return ws.OFF;case Mi.MipMapNearestLinear:case Mi.MipMapNearestNearest:case Mi.MipMapLinearLinear:case Mi.MipMapLinearNearest:return ws.ON;default:throw new Error(`Unknown texture filter: ${String(t)}`)}}static toPixiTextureWrap(t){switch(t){case qn.ClampToEdge:return Ds.CLAMP;case qn.MirroredRepeat:return Ds.MIRRORED_REPEAT;case qn.Repeat:return Ds.REPEAT;default:throw new Error(`Unknown texture wrap: ${String(t)}`)}}static toPixiBlending(t){switch(t){case Er.Normal:return st.NORMAL;case Er.Additive:return st.ADD;case Er.Multiply:return st.MULTIPLY;case Er.Screen:return st.SCREEN;default:throw new Error(`Unknown blendMode: ${String(t)}`)}}};b(On,"textureMap",new Map);let ga=On;const Bn=class Bn extends vl{constructor(){const t=new Wm;t.getBuffer("aVertexPosition").static=!1,t.getBuffer("aTextureCoord").static=!1;const i=new nh(rt.EMPTY);super(t,i);b(this,"name","");b(this,"warnedTwoTint",!1)}updateFromSpineData(t,i,s,r,a,o,h,l){var y,w;this.texture=t.texture;const c=a/(l?12:8)*2,u=this.geometry.getBuffer("aTextureCoord");((y=u.data)==null?void 0:y.length)!==c&&(u.data=new Float32Array(c));const d=this.geometry.getBuffer("aVertexPosition");((w=d.data)==null?void 0:w.length)!==c&&(d.data=new Float32Array(c));let f=0,p=u.data,m=d.data;for(let v=0;v<a;v+=l?12:8){let _=v;m[f]=r[_++],m[f+1]=r[_++],_+=4,p[f]=r[_++],p[f+1]=r[_++],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),Bn.auxColor[0]=r[2],Bn.auxColor[1]=r[3],Bn.auxColor[2]=r[4],Bn.auxColor[3]=r[5],this.tint=Bn.auxColor,this.alpha=Bn.auxColor[3],this.blendMode=ga.toPixiBlending(i);const g=this.geometry.indexBuffer;if(g.data.length!==o.length)g.data=new Uint32Array(o);else{const v=g.data;for(let _=0;_<h;_++)v[_]=o[_]}this.name=s,u.update(),d.update(),g.update()}};b(Bn,"auxColor",[0,0,0,0]);let Jf=Bn;class zI extends bn{constructor(e=!1){super();const t=new qt(void 0),i=new qt(void 0,!0),s=new qt(void 0,!0,!0);this.addAttribute("aVertexPosition",t,2,!1,We.FLOAT),this.addAttribute("aTextureCoord",i,2,!1,We.FLOAT),this.addIndex(s)}}const qI=`
|
||
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;
|
||
}
|
||
`,KI=`
|
||
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 ZI extends Xs{constructor(t){const i={uSampler:t??rt.EMPTY,alpha:1,uTextureMatrix:Zt.IDENTITY,uColor:new Float32Array([1,1,1,1]),uDarkColor:new Float32Array([0,0,0,0])},s={tint:16777215,darkTint:0,alpha:1,pluginName:"darkTintBatch"};super(fn.from(qI,KI),i);b(this,"uvMatrix");b(this,"batchable");b(this,"pluginName");b(this,"_tintRGB");b(this,"_darkTintRGB");b(this,"_colorDirty");b(this,"_alpha");b(this,"_tintColor");b(this,"_darkTintColor");this._colorDirty=!1,this.uvMatrix=new Ym(i.uSampler),this.batchable=!0,this.pluginName=s.pluginName,this._tintColor=new Lt(s.tint),this._darkTintColor=new Lt(s.darkTint),this._tintRGB=this._tintColor.toLittleEndianNumber(),this._darkTintRGB=this._darkTintColor.toLittleEndianNumber(),this._alpha=s.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,Lt.shared.setValue(this._tintColor).premultiply(this._alpha,!0).toArray(this.uniforms.uColor),Lt.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 JI extends vl{constructor(t){super(new zI,new ZI(t),void 0,void 0);b(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,s=this.shader;s.uvMatrix&&(s.uvMatrix.update(),this.calculateUvs()),this.calculateVertices(),this.indices=i.indexBuffer.data,this._tintRGB=s._tintRGB,this._darkTintRGB=s._darkTintRGB,this._texture=s.texture;const r=this.material.pluginName;t.batch.setObjectRenderer(t.plugins[r]),t.plugins[r].render(this)}}const yi=class yi extends JI{constructor(){super();b(this,"name","")}updateFromSpineData(t,i,s,r,a,o,h,l){var y,w;this.texture=t.texture;const c=a/(l?12:8)*2,u=this.geometry.getBuffer("aTextureCoord");((y=u.data)==null?void 0:y.length)!==c&&(u.data=new Float32Array(c));const d=this.geometry.getBuffer("aVertexPosition");((w=d.data)==null?void 0:w.length)!==c&&(d.data=new Float32Array(c));let f=0,p=u.data,m=d.data;for(let v=0;v<a;v+=l?12:8){let _=v;m[f]=r[_++],m[f+1]=r[_++],_+=4,p[f]=r[_++],p[f+1]=r[_++],f+=2}l?(yi.auxColor[0]=r[8],yi.auxColor[1]=r[9],yi.auxColor[2]=r[10],yi.auxColor[3]=r[11],this.darkTint=yi.auxColor,yi.auxColor[0]=r[2],yi.auxColor[1]=r[3],yi.auxColor[2]=r[4],yi.auxColor[3]=r[5],this.tint=yi.auxColor):(yi.auxColor[0]=r[2],yi.auxColor[1]=r[3],yi.auxColor[2]=r[4],yi.auxColor[3]=r[5],this.tint=yi.auxColor),this.blendMode=ga.toPixiBlending(i),this.alpha=yi.auxColor[3];const g=this.geometry.indexBuffer;if(g.data.length!==o.length)g.data=new Uint32Array(o);else{const v=g.data;for(let _=0;_<h;_++)v[_]=o[_]}this.name=s,u.update(),d.update(),g.update()}};b(yi,"auxColor",[0,0,0,0]);let tl=yi;const Ft=class Ft extends Oi{constructor(t,i){if(t instanceof hh)t={...i,skeletonData:t};else if(i)throw new Error("You cannot use options and oldOptions together.");super();b(this,"skeleton");b(this,"state");b(this,"darkTint",!1);b(this,"hasNeverUpdated",!0);b(this,"_debug");b(this,"slotMeshFactory",()=>new Jf);b(this,"beforeUpdateWorldTransforms",()=>{});b(this,"afterUpdateWorldTransforms",()=>{});b(this,"_autoUpdate",!1);b(this,"_ticker",Ki.shared);b(this,"meshesCache",new Map);b(this,"lightColor",new gt);b(this,"darkColor",new gt);b(this,"_boundsProvider");b(this,"_boundsPoint",new kt);b(this,"_boundsSpineID",-1);b(this,"_boundsSpineDirty",!0);b(this,"slotsObject",new Map);b(this,"verticesCache",Ue.newFloatArray(1024));b(this,"clippingSlotToPixiMasks",{});b(this,"currentClippingSlot");const s=t instanceof hh?t:t.skeletonData;this.skeleton=new Qm(s);const r=new nI(s);this.state=new Q2(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 tl)):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??Ki.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 tl&&(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 tl,this.darkTint=!0;break}}update(t){this.internalUpdate(0,t)}internalUpdate(t,i){this.hasNeverUpdated=!1;const s=i??this._ticker.deltaMS/1e3;this.state.update(s),this.state.apply(this.skeleton),this.beforeUpdateWorldTransforms(this),this.skeleton.update(s),this.skeleton.updateWorldTransform(br.update),this.afterUpdateWorldTransforms(this)}updateTransform(){var t;this.renderMeshes(),this.sortChildren(),(t=this.debug)==null||t.renderDebug(this),super.updateTransform()}destroy(t){var i;this.autoUpdate&&(this.autoUpdate=!1),this._ticker=null;for(const[,s]of this.meshesCache)s==null||s.destroy();this.state.clearListeners(),this.debug=void 0,this.meshesCache.clear(),this.slotsObject.clear();for(let s in this.clippingSlotToPixiMasks)(i=this.clippingSlotToPixiMasks[s].mask)==null||i.destroy(),delete this.clippingSlotToPixiMasks[s];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,s){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:(s==null?void 0:s.followAttachmentTimeline)||!1,followSlotColor:(s==null?void 0:s.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 s=this.getSlotFromRef(t),r=(a=this.slotsObject.get(s))==null?void 0:a.container;r&&(i&&i!==r||(this.removeChild(r),this.slotsObject.delete(s)))}removeSlotObjects(){for(const[,t]of this.slotsObject)t.container.removeFromParent();this.slotsObject.clear()}updateSlotObject(t,i,s){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=s,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 s=t;"tint"in s&&(s.tint=i);for(const r of s.children??[])this.setSlotObjectTint(r,i)}updateAndSetPixiMask(t,i){var o,h;const s=t.attachment;if(s&&s instanceof no){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=ov.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 no)||!c.maskComputed)&&c.mask&&(this.removeChild(c.mask),ov.free(c.mask),c.mask=void 0)}this.currentClippingSlot=void 0}}renderMeshes(){var r,a;this.resetMeshes();let t=null,i=null;const s=this.skeleton.drawOrder;for(let o=0,h=s.length,l=0;o<h;o++){const c=s[o];let u=this.slotsObject.get(c),d=o+l;u&&(this.updateSlotObject(u,c,d+1),l++),this.updateAndSetPixiMask(c,o===s.length-1);const f=c.darkColor!=null,p=Ft.clipper.isClipping()?2:f?Ft.DARK_VERTEX_SIZE:Ft.VERTEX_SIZE;if(!c.bone.active){Ft.clipper.clipEndWithSlot(c);continue}const m=c.getAttachment();let g,y,w=0;if(m instanceof Qh){const v=m;g=v.color,w=p*4,v.computeWorldVertices(c,this.verticesCache,0,p),t=Ft.QUAD_TRIANGLES,i=v.uvs,y=(r=v.region)==null?void 0:r.texture}else if(m instanceof Pl){const v=m;g=v.color,w=(v.worldVerticesLength>>1)*p,w>this.verticesCache.length&&(this.verticesCache=Ue.newFloatArray(w)),v.computeWorldVertices(c,0,v.worldVerticesLength,this.verticesCache,0,p),t=v.triangles,i=v.uvs,y=(a=v.region)==null?void 0:a.texture}else if(m instanceof no){Ft.clipper.clipStart(c,m);continue}else{this.hasMeshForSlot(c)&&(this.getMeshForSlot(c).visible=!1),Ft.clipper.clipEndWithSlot(c);continue}if(y!=null){const _=c.bone.skeleton.color,x=c.color,M=_.a*x.a*g.a;this.lightColor.set(_.r*x.r*g.r,_.g*x.g*g.g,_.b*x.b*g.b,M),c.darkColor!=null?this.darkColor.set(c.darkColor.r,c.darkColor.g,c.darkColor.b,1):this.darkColor.set(0,0,0,1);let T,C,I,k;if(Ft.clipper.isClipping())Ft.clipper.clipTriangles(this.verticesCache,t,t.length,i,this.lightColor,this.darkColor,f),T=Ft.clipper.clippedVertices,C=T.length,I=Ft.clipper.clippedTriangles,k=I.length;else{const F=this.verticesCache;for(let B=2,L=0,Y=w;B<Y;B+=p,L+=2){let O=B;F[O++]=this.lightColor.r,F[O++]=this.lightColor.g,F[O++]=this.lightColor.b,F[O++]=this.lightColor.a,F[O++]=i[L],F[O++]=i[L+1],f&&(F[O++]=this.darkColor.r,F[O++]=this.darkColor.g,F[O++]=this.darkColor.b,F[O++]=this.darkColor.a)}T=this.verticesCache,C=w,I=t,k=t.length}if(C==0||k==0){Ft.clipper.clipEndWithSlot(c);continue}const R=this.getMeshForSlot(c);R.renderable=!0,R.zIndex=d,R.updateFromSpineData(y,c.data.blendMode,c.data.name,T,C,I,k,f)}Ft.clipper.clipEndWithSlot(c)}Ft.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,s=this._boundsPoint;s.set(i.minX,i.minY),t.worldTransform.apply(s,s),this._bounds.minX=s.x,this._bounds.minY=s.y,s.set(i.maxX,i.maxY),t.worldTransform.apply(s,s),this._bounds.maxX=s.x,this._bounds.maxY=s.y}updateBounds(){if(!this._boundsProvider||!this._boundsSpineDirty)return;this._boundsSpineDirty=!1,this._localBounds||(this._localBounds=new gl);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 s=t;if(typeof t=="string"&&(t=this.skeleton.findBone(t)),!t)throw Error(`Cannot set bone position, bone ${String(s)} not found`);if(Ft.vectorAux.set(i.x,i.y),t.parent){const r=t.parent.worldToLocal(Ft.vectorAux);t.x=r.x,t.y=r.y}else t.x=Ft.vectorAux.x,t.y=Ft.vectorAux.y}getBonePosition(t,i){const s=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(s)} 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,s){if(typeof t=="string")return Ft.oldFrom(t,i,s);const{skeleton:r,atlas:a,scale:o=1,darkTint:h,autoUpdate:l,boundsProvider:c,ticker:u}=t,d=`${r}-${a}-${o}`;let f=Ft.skeletonCache[d];if(!f){const p=mn.get(r),m=mn.get(a),g=new qf(m);let y=p instanceof Uint8Array?new Zf(g):new dh(g);y.scale=o,f=y.readSkeletonData(p),Ft.skeletonCache[d]=f}return new Ft({skeletonData:f,darkTint:h,autoUpdate:l,boundsProvider:c,ticker:u})}static oldFrom(t,i,s){const r=`${t}-${i}-${(s==null?void 0:s.scale)??1}`;let a=Ft.skeletonCache[r];if(a)return new Ft(a,s);const o=mn.get(t),h=mn.get(i),l=new qf(h);let c=o instanceof Uint8Array?new Zf(l):new dh(l);return c.scale=(s==null?void 0:s.scale)??1,a=c.readSkeletonData(o),Ft.skeletonCache[r]=a,new this(a,s)}get tint(){return this.skeleton.color.toRgb888()}set tint(t){gt.rgb888ToColor(this.skeleton.color,t)}};b(Ft,"vectorAux",new lh),b(Ft,"clipper",new uh),b(Ft,"QUAD_TRIANGLES",[0,1,2,2,3,0]),b(Ft,"VERTEX_SIZE",8),b(Ft,"DARK_VERTEX_SIZE",12),b(Ft,"skeletonCache",Object.create(null));let fh=Ft;const ov=new oh(()=>new is);Qm.yDown=!0;const fc="spineTextureAtlasLoader",QI={extension:Xe.Asset,resolver:{test:n=>ns(n,".atlas"),parse:n=>{var t,i;const e=n.split(".");return{resolution:parseFloat(((i=(t=$e.RETINA_PREFIX)==null?void 0:t.exec(n))==null?void 0:i[1])??"1"),format:e[e.length-2],src:n}}},loader:{name:fc,extension:{type:Xe.LoadParser,priority:ds.Normal,name:fc},test(n){return ns(n,".atlas")},async load(n){const e=await $e.ADAPTER.fetch(n);if(!e.ok)throw new Error(`[${fc}] Failed to fetch ${n}: ${e.status} ${e.statusText}`);return await e.text()},testParse(n,e){const t=ns(e.src,".atlas"),i=typeof n=="string",s=e.loadParser===fc;return Promise.resolve((t||s)&&i)},unload(n){n.dispose()},async parse(n,e,t){var h;const i=e.data||{};let s=li.dirname(e.src);s&&s.lastIndexOf("/")!==s.length-1&&(s+="/");const r=new db(n);if(i.images instanceof ot||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}mn.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 ot)l.setTexture(ga.from(u));else{const d=u??li.normalize([...s.split(li.sep),c].join(li.sep)),f={src:Qc(d,e.src),data:{...i.imageMetadata,alphaMode:l.pma?Ai.PMA:Ai.UNPACK}},p=t.load(f).then(m=>{l.setTexture(ga.from(m.baseTexture))});a.push(p)}}return await Promise.all(a),mn.setPreferences({preferCreateImageBitmap:o}),r}}};ze.add(QI);const mc="spineSkeletonLoader";function eR(n){return n.hasOwnProperty("bones")}function tR(n){return n instanceof Uint8Array}const iR={extension:Xe.Asset,loader:{name:mc,extension:{type:Xe.LoadParser,priority:ds.Normal,name:mc},test(n){return ns(n,".skel")},async load(n){const e=await $e.ADAPTER.fetch(n);if(!e.ok)throw new Error(`[${mc}] Failed to fetch ${n}: ${e.status} ${e.statusText}`);return new Uint8Array(await e.arrayBuffer())},testParse(n,e){const t=ns(e.src,".json")&&eR(n),i=ns(e.src,".skel")&&tR(n),s=e.loadParser===mc;return Promise.resolve(t||i||s)}}};ze.add(iR);class sR extends bn{constructor(t=!1){super();b(this,"_buffer");b(this,"_indexBuffer");this._buffer=new qt(void 0,t,!1),this._indexBuffer=new qt(void 0,t,!0),this.addAttribute("aVertexPosition",this._buffer,2,!1,We.FLOAT).addAttribute("aTextureCoord",this._buffer,2,!1,We.FLOAT).addAttribute("aColor",this._buffer,4,!0,We.UNSIGNED_BYTE).addAttribute("aDarkColor",this._buffer,4,!0,We.UNSIGNED_BYTE).addAttribute("aTextureId",this._buffer,1,!0,We.FLOAT).addIndex(this._indexBuffer)}}const nR=`
|
||
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;
|
||
|
||
}
|
||
`,rR=`
|
||
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 Mb extends fr{constructor(e){super(e),this.shaderGenerator=new vx(nR,rR),this.geometryClass=sR,this.vertexSize=7}packInterleavedGeometry(e,t,i,s,r){const{uint32View:a,float32View:o}=t,h=s/this.vertexSize,l=e.uvs,c=e.indices,u=e.vertexData,d=e._texture.baseTexture._batchLocation,f=Math.min(e.worldAlpha,1),p=Lt.shared.setValue(e._tintRGB).toPremultiplied(f,!0),m=Lt.shared.setValue(e._darkTintRGB).premultiply(f,!0).toPremultiplied(1,!1);for(let g=0;g<u.length;g+=2)o[s++]=u[g],o[s++]=u[g+1],o[s++]=l[g],o[s++]=l[g+1],a[s++]=p,a[s++]=m,o[s++]=d;for(let g=0;g<c.length;g++)i[r++]=h+c[g]}}b(Mb,"extension",{name:"darkTintBatch",type:Xe.RendererPlugin});ze.add(Mb);function aR(n){return n.replace(/\\/g,"/").split("/").pop()||n}function ep(n,e,t){for(const i of n.pages){const s=e.get(aR(i.name).toLowerCase());if(!s)throw new Error(`Atlas 引用的纹理未选择:${i.name}`);s.baseTexture.alphaMode=i.pma?Ai.PMA:Ai.UNPACK,i.setTexture(t.from(s.baseTexture))}}function Eb(n,e){const t=new db(n);return ep(t,e,ga),new qf(t)}function oR(n,e,t){return{skeletonData:new dh(Eb(e,t)).readSkeletonData(n),SpineClass:fh}}function lR(n,e,t){return{skeletonData:new Zf(Eb(e,t)).readSkeletonData(n),SpineClass:fh}}const cR="modulepreload",hR=function(n){return"/"+n},lv={},cv=function(e,t,i){let s=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"));s=a(t.map(l=>{if(l=hR(l),l in lv)return;lv[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":cR,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 s.then(a=>{for(const o of a||[])o.status==="rejected"&&r(o.reason);return e().catch(r)})};async function Ab(){const[n,e]=await Promise.all([cv(()=>import("./index-CX6BjU37.js"),[]),cv(()=>import("./index-CTL5QUHS.js"),__vite__mapDeps([0,1]))]);return{core:n,pixi:e}}async function uR(n,e,t){const{core:i,pixi:s}=await Ab(),r=new i.TextureAtlas(e);return ep(r,t,s.SpineTexture),{skeletonData:new i.SkeletonJson(new i.AtlasAttachmentLoader(r)).readSkeletonData(n),SpineClass:s.Spine}}async function dR(n,e,t){const{core:i,pixi:s}=await Ab(),r=new i.TextureAtlas(e);return ep(r,t,s.SpineTexture),{skeletonData:new i.SkeletonBinary(new i.AtlasAttachmentLoader(r)).readSkeletonData(n),SpineClass:s.Spine}}function wr(n,e,t){const i=Number(n[e]);return Number.isFinite(i)?i:t}function ss(n,e,t,i){n[e]==null&&(n[e]=wr(n,t,i))}function tp(n,e,t){if(typeof n.curve!="number")return;const i=wr(n,"time",0),r=wr(e,"time",0)-i,a=n.curve,o=wr(n,"c2",0),h=wr(n,"c3",1),l=wr(n,"c4",1);n.curve=t.flatMap(([c,u])=>[i+r*a,c+(u-c)*o,i+r*h,c+(u-c)*l]),delete n.c2,delete n.c3,delete n.c4}function Ar(n,e){if(Array.isArray(n))for(let t=0;t<n.length-1;t++){const i=n[t],s=n[t+1];tp(i,s,e.map(({key:r,fallback:a})=>[wr(i,r,a),wr(s,r,a)]))}}function fR(n){if(Array.isArray(n))for(let e=0;e<n.length-1;e++)tp(n[e],n[e+1],[[0,1]])}function Fa(n,e){const t=typeof n=="string"?n.replace(/^#/,""):"",i=t.length===6?`${t}ff`:t.padEnd(8,"f").slice(0,8),s=[0,2,4,6].map(r=>Number.parseInt(i.slice(r,r+2),16)/255);return e?s:s.slice(0,3)}function hv(n,e){if(Array.isArray(n))for(let t=0;t<n.length-1;t++){const i=n[t],s=n[t+1],r=e?[...Fa(i.light,!0),...Fa(i.dark,!1)]:Fa(i.color,!0),a=e?[...Fa(s.light,!0),...Fa(s.dark,!1)]:Fa(s.color,!0);tp(i,s,r.map((o,h)=>[o,a[h]]))}}function mR(n){for(const e of n.bones||[])e.inherit==null&&e.transform!=null&&(e.inherit=e.transform);for(const e of n.transform||[])ss(e,"mixRotate","rotateMix",1),ss(e,"mixX","translateMix",1),e.mixY==null&&(e.mixY=e.mixX),ss(e,"mixScaleX","scaleMix",1),e.mixScaleY==null&&(e.mixScaleY=e.mixScaleX),ss(e,"mixShearY","shearMix",1);for(const e of n.path||[])ss(e,"mixRotate","rotateMix",1),ss(e,"mixX","translateMix",1),e.mixY==null&&(e.mixY=e.mixX)}function pR(n){for(const e of n.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 gR(n){for(const e of Object.values(n.slots||{}))e.color&&!e.rgba&&(e.rgba=e.color,delete e.color),e.twoColor&&!e.rgba2&&(e.rgba2=e.twoColor,delete e.twoColor),hv(e.rgba,!1),hv(e.rgba2,!0)}function vR(n){for(const e of Object.values(n.bones||{})){for(const t of e.rotate||[])ss(t,"value","angle",0);Ar(e.rotate,[{key:"value",fallback:0}]),Ar(e.translate,[{key:"x",fallback:0},{key:"y",fallback:0}]),Ar(e.scale,[{key:"x",fallback:1},{key:"y",fallback:1}]),Ar(e.shear,[{key:"x",fallback:0},{key:"y",fallback:0}])}}function yR(n){for(const e of Object.values(n.ik||{}))Ar(e,[{key:"mix",fallback:1},{key:"softness",fallback:0}])}function xR(n){for(const e of Object.values(n.transform||{})){for(const t of e)ss(t,"mixRotate","rotateMix",1),ss(t,"mixX","translateMix",1),t.mixY==null&&(t.mixY=t.mixX),ss(t,"mixScaleX","scaleMix",1),t.mixScaleY==null&&(t.mixScaleY=t.mixScaleX),ss(t,"mixShearY","shearMix",1);Ar(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 bR(n){for(const e of Object.values(n.path||{})){for(const i of["position","spacing"]){const s=e[i];for(const r of s||[])ss(r,"value",i,0);Ar(s,[{key:"value",fallback:0}])}const t=e.mix;for(const i of t||[])ss(i,"mixRotate","rotateMix",1),ss(i,"mixX","translateMix",1),i.mixY==null&&(i.mixY=i.mixX);Ar(t,[{key:"mixRotate",fallback:1},{key:"mixX",fallback:1},{key:"mixY",fallback:1}])}}function wR(n){if(!n.deform)return;const e=n.attachments||(n.attachments={});for(const[t,i]of Object.entries(n.deform)){const s=e[t]||(e[t]={});for(const[r,a]of Object.entries(i)){const o=s[r]||(s[r]={});for(const[h,l]of Object.entries(a)){const c=o[h]||(o[h]={});c.deform=l,fR(l)}}}delete n.deform}function Cb(n){mR(n),pR(n);for(const e of Object.values(n.animations||{}))gR(e),vR(e),yR(e),xR(e),bR(e),wR(e),!e.drawOrder&&e.draworder&&(e.drawOrder=e.draworder);return n}function SR(n){return n.replace(/\\/g,"/").split("/").pop()||n}async function _R(n){const e=await Promise.all(n.map(async t=>{const i=URL.createObjectURL(t);try{return[SR(t.name).toLowerCase(),await rt.fromURL(i)]}finally{URL.revokeObjectURL(i)}}));return new Map(e)}function TR(n){const e=new Map;return n.bones.map(t=>{var r;const i=((r=t.parent)==null?void 0:r.name)||null,s=i?(e.get(i)||0)+1:0;return e.set(t.name,s),{name:t.name,parent:i,depth:s}})}async function Ib(n,e,t){var a;if(!/\.(json|skel)$/i.test(n.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(),s=await _R(t),r=[...s.values()];try{let o,h,l=null,c;if(/\.skel$/i.test(n.name)){const u=await n.arrayBuffer();try{({skeletonData:o,SpineClass:h}=await dR(u,i,s)),c="4.3"}catch(d){try{({skeletonData:o,SpineClass:h}=lR(u,i,s)),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=ah(o.version)}else{let u;try{u=JSON.parse(await n.text())}catch{throw new Error("Spine JSON 文件格式无效")}if(l=ah((a=u==null?void 0:u.skeleton)==null?void 0:a.spine),!l)throw new Error(`Spine JSON 版本不受支持,仅支持 ${jf()}`);c=X2(l),l==="3.8"&&Cb(u);const d=c==="4.3"?await uR(u,i,s):oR(u,i,s);o=d.skeletonData,h=d.SpineClass}if(!l)throw new Error(`Spine 数据版本不受支持,仅支持 ${jf()}`);return{skeletonData:o,textures:r,runtimeVersion:c,SpineClass:h,dataVersion:l,animations:o.animations.map(u=>({name:u.name,duration:u.duration})),bones:TR(o)}}catch(o){for(const h of r)h.destroy(!0);throw o}}function Pc(n){return new Promise((e,t)=>{const i=new FileReader;i.onload=()=>e(String(i.result||"")),i.onerror=()=>t(i.error),i.readAsDataURL(n)})}async function MR(n,e,t){return{skeleton:{name:n.name,dataUrl:await Pc(n)},atlas:{name:e.name,dataUrl:await Pc(e)},textures:await Promise.all(t.map(async i=>({name:i.name,dataUrl:await Pc(i)})))}}async function zd(n){const e=await fetch(n.dataUrl);if(!e.ok)throw new Error(`无法读取内嵌 Spine 文件:${n.name}`);return new File([await e.blob()],n.name)}async function ER(n){return{skeleton:await zd(n.skeleton),atlas:await zd(n.atlas),textures:await Promise.all(n.textures.map(zd))}}const Rb="SpineParticle.EditorConfig",Pb=1;function kb(n){return{backgroundX:n.backgroundX,backgroundY:n.backgroundY,backgroundOpacity:n.backgroundOpacity,backgroundImageName:n.backgroundImageName,backgroundImageData:n.backgroundImageData,showGrid:n.showGrid,exportSettings:Kt(n.exportSettings)}}function AR(n){return JSON.parse(JSON.stringify(n,(e,t)=>{if(!(e==="texture"||e==="trailTexture"||e==="frames"))return t}))}function CR(n){const e=kb(n.settings);return AR({format:Rb,version:Pb,savedAt:new Date().toISOString(),editor:Kt(n.editor),settings:e,timeline:{fps:n.timeline.fps,loop:n.timeline.loop,playbackStart:n.timeline.playbackStart,playbackEnd:n.timeline.playbackEnd,animations:[...n.timeline.animations]},selection:{type:n.activeObjectType,id:n.activeObjectId},scene:{systems:n.systems.map(t=>({...Kt(t),frames:void 0})),colliders:Kt(n.colliders),paths:Kt(n.paths),spines:Kt(n.spines)}})}function IR(){return`SpineParticle-${new Date().toISOString().replace(/[-:]/g,"").replace(/\.\d{3}Z$/,"").replace("T","-")}.json`}function Fb(n){const e=CR(n),t=new Blob([JSON.stringify(e,null,2)],{type:"application/json;charset=utf-8"}),i=URL.createObjectURL(t),s=document.createElement("a");return s.href=i,s.download=IR(),document.body.appendChild(s),s.click(),s.remove(),setTimeout(()=>URL.revokeObjectURL(i),0),e}function Ob(n){let e;try{e=JSON.parse(n)}catch{throw new Error("配置文件不是有效的 JSON")}const t=e;if(t.format!==Rb)throw new Error("不是 SpineParticle 编辑器配置文件");if(t.version!==Pb)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 RR(n){const e=new Map,t=s=>{const r=s==="/particles/star.png"?"/images/star.png":s==="/trails/trail.png"?"/images/trail.png":s||"/images/star.png";let a=e.get(r);return a||(a=rt.fromURL(r).then(o=>Sr(o)),e.set(r,a)),a},i=await t("/images/star.png");await Promise.all(n.map(async s=>{var a;const r=ma(s.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,s.frames=[]}))}async function PR(n){const e=new Map;try{for(const t of n){if(!t.sourceBundle)continue;const i=await ER(t.sourceBundle);e.set(t.id,await Ib(i.skeleton,i.atlas,i.textures))}return e}catch(t){for(const i of e.values())for(const s of i.textures)s.destroy(!0);throw t}}function kR(n,e){const t=(e==null?void 0:e.type)||"particle",i=Number(e==null?void 0:e.id)||0;(t==="particle"?n.systems.some(r=>r.id===i):t==="collision"?n.colliders.some(r=>r.id===i):t==="path"?n.paths.some(r=>r.id===i):n.spines.some(r=>r.id===i))?n.selectSceneObject(t,i):n.systems[0]?n.selectSceneObject("particle",n.systems[0].id):n.colliders[0]?n.selectSceneObject("collision",n.colliders[0].id):n.paths[0]?n.selectSceneObject("path",n.paths[0].id):n.spines[0]?n.selectSceneObject("spine",n.spines[0].id):(n.activeObjectType="particle",n.activeObjectId=0,n.activeId=0)}async function FR(n,e){var c,u,d,f,p,m,g;const t=Ob(JSON.stringify(e)),i=Kt(t.scene.systems),s=Kt(t.scene.colliders),r=Kt(t.scene.paths),a=Kt(t.scene.spines);for(const y of a)y.sourceBundle==null&&(y.sourceBundle=null),y.dataVersion==null&&(y.dataVersion="");await RR(i);const o=await PR(a),h=new Map(n.spines.map(y=>[y.id,y.assetVersion]));for(const y of n.spines)Il(y.id);n.systems=i,n.colliders=s,n.paths=r,n.spines=a,Object.assign(n.editor,Kt(t.editor||{}));const l=t.settings;if(l)for(const y of["backgroundX","backgroundY","backgroundOpacity","backgroundImageName","backgroundImageData","showGrid"])Object.prototype.hasOwnProperty.call(l,y)&&(n.settings[y]=l[y]);n.settings.exportSettings=T1((c=t.settings)==null?void 0:c.exportSettings),n.settings.undoLimit=Math.min(200,Math.max(1,Math.round(Number(n.settings.undoLimit)||20))),n.timeline.fps=Math.max(1,Math.round(Number((u=t.timeline)==null?void 0:u.fps)||30)),n.timeline.loop=((d=t.timeline)==null?void 0:d.loop)!==!1,n.timeline.animations=Array.isArray((f=t.timeline)==null?void 0:f.animations)&&t.timeline.animations.length?[...new Set(t.timeline.animations.filter(y=>typeof y=="string"&&y.trim()).map(y=>y.trim()))]:["animation"];for(const y of n.spines){const w=o.get(y.id);if(y.assetVersion=Math.max(Number(y.assetVersion)||0,h.get(y.id)||0)+1,!w){y.status="empty",y.error=y.skeletonFileName?"配置未包含可复用的 Spine 原始资源":"",y.animations=[],y.bones=[],y.selectedAnimation="";continue}Jh(y.id,w),y.dataVersion=w.dataVersion,y.animations=w.animations,y.bones=w.bones,w.animations.some(v=>v.name===y.selectedAnimation)||(y.selectedAnimation=((p=w.animations[0])==null?void 0:p.name)||""),y.status="ready",y.error=""}n.syncSceneSequences(),kR(n,t.selection),n.timeline.playbackStart=Math.max(0,Math.floor(Number((m=t.timeline)==null?void 0:m.playbackStart)||0)),n.timeline.playbackEnd=Math.max(1,Math.floor(Number((g=t.timeline)==null?void 0:g.playbackEnd)||Number.MAX_SAFE_INTEGER)),n.timeline.frame=0,n.timeline.recorded=!1,n.timeline.playing=!0;for(const y of n.systems)n.timeline.animations.includes(y.animation)||(y.animation=n.timeline.animations[0]);return n.recalcTotalFrames(),n.timeline.frame=n.timeline.playbackStart,t}async function Bb(n,e){return FR(n,Ob(e))}async function OR(n,e){if(!/\.json$/i.test(e.name))throw new Error("请选择 .json 配置文件");return Bb(n,await e.text())}const tu=yo({undoCount:0});let mh=null,Vn=null,Cr=[],Bo=null,$n=null,ph=!1;function ip(n){return{systems:n.systems.map(t=>{const i=Kt(t);return i.frames=void 0,i}),colliders:Kt(n.colliders),paths:Kt(n.paths),spines:Kt(n.spines),animations:[...n.timeline.animations],settings:kb(n.settings)}}function sp(n){return JSON.stringify(n,(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 Lb(n,e=ip(n),t=sp(e)){const i=new Map;for(const s of e.spines){const r=N2(s.id);r&&i.set(s.id,r)}return{data:e,signature:t,spineAssets:i}}function gh(n){if(n){for(const e of n.spineAssets.values())L2(e);n.spineAssets.clear()}}function Db(n){for(;Cr.length>n;)gh(Cr.shift()||null);tu.undoCount=Cr.length}function Nb(){const n=mh;if(!n||!Vn||ph)return;const e=ip(n),t=sp(e);t!==Vn.signature&&(Cr.push(Vn),Vn=Lb(n,e,t),Db(n.settings.undoLimit))}function BR(){ph||($n&&clearTimeout($n),$n=setTimeout(()=>{$n=null,Nb()},250))}function LR(n){const e=n.activeObjectId;return n.activeObjectType==="particle"?n.systems.some(t=>t.id===e):n.activeObjectType==="collision"?n.colliders.some(t=>t.id===e):n.activeObjectType==="path"?n.paths.some(t=>t.id===e):n.spines.some(t=>t.id===e)}function DR(n){var t,i;if(!LR(n)){const s=n.systems[0],r=n.colliders[0],a=n.paths[0],o=n.spines[0];s?(n.activeObjectType="particle",n.activeObjectId=s.id):r?(n.activeObjectType="collision",n.activeObjectId=r.id):a?(n.activeObjectType="path",n.activeObjectId=a.id):(n.activeObjectType="spine",n.activeObjectId=(o==null?void 0:o.id)||0)}const e=n.activeObjectType==="particle"?n.systems.find(s=>s.id===n.activeObjectId):n.systems.find(s=>s.id===n.activeId);n.activeId=(e==null?void 0:e.id)||((t=n.systems[0])==null?void 0:t.id)||0,n.timeline.animation=(e==null?void 0:e.animation)||((i=n.systems[0])==null?void 0:i.animation)||n.timeline.animations[0]||"animation"}function NR(n,e){const t=Vn;ph=!0;try{for(const i of n.spines)Il(i.id);n.systems=Kt(e.data.systems),n.colliders=Kt(e.data.colliders),n.paths=Kt(e.data.paths),n.spines=Kt(e.data.spines),n.timeline.animations=[...e.data.animations],Object.assign(n.settings,Kt(e.data.settings));for(const[i,s]of e.spineAssets)Jh(i,s);for(const i of n.systems)i.frames=[];n.timeline.recorded=!1,n.timeline.playing=!1,DR(n),n.recalcTotalFrames(),Vn=e}finally{ph=!1,gh(t)}}function UR(n){if(!(mh===n&&Bo)){Bo==null||Bo(),$n&&clearTimeout($n),gh(Vn);for(const e of Cr)gh(e);Cr=[],mh=n,Vn=Lb(n),tu.undoCount=0,Bo=hs(()=>sp(ip(n)),BR,{flush:"post"})}}function XR(n,e){const t=Math.min(200,Math.max(1,Math.round(Number(e)||20)));n.settings.undoLimit=t,Db(t)}function qd(){const n=mh;if(!n||!Vn)return!1;$n&&(clearTimeout($n),$n=null),Nb();const e=Cr.pop();return e?(NR(n,e),tu.undoCount=Cr.length,!0):!1}function YR(n){const e=n instanceof HTMLElement?n:null;return!!(e!=null&&e.closest('input, textarea, select, [contenteditable="true"]'))}function VR(n){function e(i){var r;const s=i.target instanceof Node?i.target:null;n.canvasFocused.value=!!s&&!!((r=n.canvasElement.value)!=null&&r.contains(s))}function t(i){const s=i.key.toLowerCase();if((i.ctrlKey||i.metaKey)&&!i.altKey&&s==="s"){i.preventDefault(),i.stopPropagation(),n.save();return}if((i.ctrlKey||i.metaKey)&&!i.altKey&&s==="z"){i.preventDefault(),i.stopPropagation(),n.undo();return}if(i.ctrlKey||i.metaKey||i.altKey||YR(i.target))return;if(s==="d"){i.preventDefault(),n.togglePlay();return}if(s==="s"){i.preventDefault(),n.toStart();return}if(!n.canvasFocused.value)return;const r={q:"",w:"translate",e:"rotate",r:"scale"};s in r&&(i.preventDefault(),n.setTool(r[s]))}xo(()=>{document.addEventListener("pointerdown",e,!0),window.addEventListener("keydown",t,!0)}),Tl(()=>{document.removeEventListener("pointerdown",e,!0),window.removeEventListener("keydown",t,!0)})}const $R={class:"stage-wrap"},GR={class:"topbar"},HR=["disabled"],jR={class:"tool-group"},WR={class:"tool-group"},zR={key:0,class:"background-panel"},qR=["disabled"],KR=["title"],ZR={class:"background-position-row"},JR={class:"background-opacity-row"},QR={class:"zoom-pct"},eP={key:0,class:"settings-panel"},tP={class:"sp-head"},iP={class:"sp-switch-row"},sP={class:"sp-switch-control"},nP={class:"sp-row"},rP={class:"sp-chk"},aP={class:"sp-chk"},oP={class:"sp-row"},lP={class:"sp-row"},cP={class:"sp-chk"},hP={class:"sp-chk"},uP={class:"sp-row"},dP={class:"sp-row"},fP={class:"sp-row"},mP={class:"sp-hex"},pP={class:"sp-chk"},gP={class:"help-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"help-title"},vP={class:"help-head"},yP={key:2,class:"hud"},xP={class:"hud-number hud-system-count"},bP={class:"hud-number hud-particle-count"},wP=wn({__name:"Stage",setup(n){const e=Rl(),t=nt(null),i=nt(null),s=nt(!1),r=nt(!1),a=nt(!1),o=nt(null),h=yt(()=>e.settings.backgroundImageName),l=nt(""),c=nt(!1);function u(j){l.value=l.value===j?"":j}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))}VR({canvasElement:t,canvasFocused:c,undo:qd,save:()=>Fb(e),togglePlay:()=>e.togglePlay(),toStart:()=>e.toStart(),setTool:j=>{l.value=j}});let f=null,p=null,m=null,g=null,y=0,w=null,v=null,_=null,x=null,M=null,T=null,C=null,I=null,k=null,R=null,F=null,B=null,L=[],Y=0,O=0,D=0,P=0,U=null,N=null;const X=new Map,K=new Map;let z=[];const se=new Map,Q=new Set;let me=!1;hs(()=>[e.activeObjectType,e.activeObjectId],()=>Q.clear());async function pe(){if(U&&N)return U;const[j,$]=await Promise.all([rt.fromURL("/images/star.png"),rt.fromURL("/images/trail.png")]);return U=j,N=$,U}function Me(){p=new Oi,f.stage.addChild(p),F=new Oi,f.stage.addChild(F),m=new Fr(rt.EMPTY),m.anchor.set(.5),m.visible=!1,p.addChild(m),R=new is,p.addChild(R),B=new J2,p.addChild(B.container),v=new is,p.addChild(v),w=new is,p.addChild(w),x=new is,p.addChild(x),M=new is,p.addChild(M),T=new is,p.addChild(T),C=new is,p.addChild(C),I=new is,p.addChild(I),k=new is,p.addChild(k),_=new is,p.addChild(_)}function Ie(){r.value=!r.value,r.value&&(s.value=!1)}function ge(){a.value=!0,s.value=!1,r.value=!1}function Ee(j){j.key==="Escape"&&a.value&&(a.value=!1)}function H(){s.value=!s.value,s.value&&(r.value=!1)}function Z(j){XR(e,Number(j.target.value))}async function q(j){var te;const $=j.target,J=(te=$.files)==null?void 0:te[0];if(J)try{e.settings.backgroundImageData=await Pc(J),e.settings.backgroundImageName=J.name}catch(he){console.error("背景图加载失败",he)}finally{$.value=""}}async function W(j){const $=++y;if(!j){m&&(m.texture=rt.EMPTY,m.visible=!1),g&&g.destroy(!0),g=null;return}try{const J=await rt.fromURL(j);if($!==y||!m){J.destroy(!0);return}const te=g;g=J,m.texture=J,m.visible=!0,te&&te.destroy(!0)}catch(J){console.error("背景图恢复失败",J)}}function ee(j=!0){e.settings.backgroundImageData="",e.settings.backgroundImageName="",o.value&&(o.value.value=""),j&&(e.settings.backgroundX=0,e.settings.backgroundY=0,e.settings.backgroundOpacity=1)}function ce(j,$=0){if(j<=0)return 1;const J=Math.pow(10,Math.floor(Math.log10(j))),te=[1,2,5,10,20,50,100];let he=1;for(const ye of te)if(ye*J>=j){he=ye*J;break}return Math.max(he,$)}function xe(){if(!R)return;const j=R;j.clear();const $=e.settings;if(!$.tickEnabled){for(const we of L)we.visible=!1;return}const J=0,te=0,he=f.screen.width/e.editor.viewScale,ye=f.screen.height/e.editor.viewScale,Te=+("0x"+$.axisColor.replace("#",""));j.lineStyle(1.5,Te,.35),j.moveTo(-he,te),j.lineTo(he,te),j.moveTo(J,-ye),j.lineTo(J,ye);const V=e.editor.viewScale,S=ce(50/V),E=he,G=ye,ae=Math.max(1,$.tickWidth);if($.tickEnabled){for(let we=0;we<=he;we+=S){const dt=Math.round(we/S)*S;dt!==0&&(j.lineStyle(ae,Te,.25),j.moveTo(dt,te-4),j.lineTo(dt,te+4))}for(let we=0;we<=ye;we+=S)Math.round(we/S)*S!==0&&(j.lineStyle(ae,Te,.25),j.moveTo(J-4,we),j.lineTo(J+4,we))}const ve=f.screen.width/2+e.editor.viewX,Pe=f.screen.height*.5+e.editor.viewY,Le=$.axisFontSize,Ce=+("0x"+$.axisColor.replace("#",""));for(;L.length<64;){const we=new zm("",{fontFamily:"monospace",fontSize:Le,fill:Ce});we.anchor.set(.5,.5),F.addChild(we),L.push(we)}let be=0;const qe=$.showAxisLabels&&$.tickEnabled;for(let we=0;we<=he;we+=S){const dt=Math.round(we/S)*S;if(dt===0||!qe||dt>E)continue;const pt=L[be++];if(!pt)break;pt.style.fontSize=Le,pt.text=String(dt),pt.position.set(ve+dt*V,Pe+9),pt.visible=!0;const Et=L[be++];if(!Et)break;Et.style.fontSize=Le,Et.text=String(-dt),Et.position.set(ve-dt*V,Pe+9),Et.visible=!0}for(let we=0;we<=ye;we+=S){const dt=Math.round(we/S)*S;if(dt===0||!qe||dt>G)continue;const pt=L[be++];if(!pt)break;pt.style.fontSize=Le,pt.text=String(dt),pt.position.set(ve+8,Pe-we*V),pt.visible=!0;const Et=L[be++];if(!Et)break;Et.style.fontSize=Le,Et.text=String(-dt),Et.position.set(ve+8,Pe+we*V),Et.visible=!0}for(;be<L.length;){const we=L[be++];we&&(we.visible=!1)}}function oe(j){const $=t.value.getBoundingClientRect(),J=j.clientX-$.left,te=j.clientY-$.top,he=j.deltaY<0?1.12:1/1.12,ye=e.editor.viewScale,Te=Math.max(.01,ye*he),V=f.screen.width/2,S=f.screen.height*.5,E=e.editor.viewX,G=e.editor.viewY,ae=(J-V-E)/ye,ve=(te-S-G)/ye;e.editor.viewX=J-V-ae*Te,e.editor.viewY=te-S-ve*Te,e.editor.viewScale=Te}function Se(j){if(j.button!==0)return;if(l.value&&pi()){Bi(j);return}if(wt(j)||St(j)||Ti(j)||Xt(j))return;const $=j.clientX,J=j.clientY,te=e.editor.viewX,he=e.editor.viewY,ye=V=>{e.editor.viewX=te+(V.clientX-$),e.editor.viewY=he+(V.clientY-J)},Te=()=>{window.removeEventListener("pointermove",ye),window.removeEventListener("pointerup",Te),window.removeEventListener("pointercancel",Te)};window.addEventListener("pointermove",ye),window.addEventListener("pointerup",Te),window.addEventListener("pointercancel",Te)}function ue(j,$){const J=t.value.getBoundingClientRect(),te=Math.max(1e-4,e.editor.viewScale),he=j-J.left,ye=$-J.top;return{x:(he-f.screen.width/2-e.editor.viewX)/te,y:-(ye-f.screen.height*.5-e.editor.viewY)/te}}function ke(j,$,J){const te=j.rotation*Math.PI/180,he=Math.cos(te),ye=Math.sin(te),Te=Math.max(1e-4,Math.abs(j.scaleX??1)),V=Math.max(1e-4,Math.abs(j.scaleY??1));return{x:j.x+he*$*Te-ye*J*V,y:j.y+ye*$*Te+he*J*V}}function Re(j,$,J){const te=j.rotation*Math.PI/180,he=Math.cos(te),ye=Math.sin(te),Te=Math.max(1e-4,Math.abs(j.scaleX??1)),V=Math.max(1e-4,Math.abs(j.scaleY??1)),S=$-j.x,E=J-j.y;return{x:(he*S+ye*E)/Te,y:(-ye*S+he*E)/V}}function Fe(){if(e.activeObjectType!=="path")return null;const j=e.paths.find($=>$.id===e.activeObjectId)||null;return(j==null?void 0:j.visible)===!1?null:j}function Ze(j,$,J){if(j.points.length<2)return j.points.length;const te=j.closed?j.points.length:j.points.length-1;let he=j.points.length,ye=1/0;for(let Te=0;Te<te;Te++){const V=j.points[Te],S=j.points[(Te+1)%j.points.length],E=S.x-V.x,G=S.y-V.y,ae=Math.max(1e-4,E*E+G*G),ve=Math.min(1,Math.max(0,(($-V.x)*E+(J-V.y)*G)/ae)),Pe=V.x+E*ve,Le=V.y+G*ve,Ce=Math.hypot($-Pe,J-Le);Ce<ye&&(ye=Ce,he=Te+1)}return he}function mt(j){const $=Fe();if(!$||!$.enabled)return;if(me){me=!1;return}const J=ue(j.clientX,j.clientY),te=Re($,J.x,J.y),he=9/Math.max(.01,e.editor.viewScale),ye=$.points.findIndex(V=>Math.hypot(V.x-te.x,V.y-te.y)<=he);if(ye>=0){$.points.splice(ye,1),Q.clear();return}const Te=Ze($,te.x,te.y);$.points.splice(Te,0,{x:te.x,y:te.y,inX:0,inY:0,outX:0,outY:0}),Q.clear(),Q.add(Te)}function wt(j){const $=Fe();if(!$||!$.enabled)return!1;const J=ue(j.clientX,j.clientY),te=Re($,J.x,J.y),he=9/Math.max(.01,e.editor.viewScale);if(j.detail>=2){if($.points.findIndex(G=>Math.hypot(G.x-te.x,G.y-te.y)<=he)>=0)return!0;const S={x:te.x,y:te.y,inX:0,inY:0,outX:0,outY:0},E=Ze($,te.x,te.y);return $.points.splice(E,0,S),Q.clear(),Q.add(E),me=!0,ht(G=>{const ae=ue(G.clientX,G.clientY),ve=Re($,ae.x,ae.y);S.outX=ve.x-S.x,S.outY=ve.y-S.y,S.inX=-S.outX,S.inY=-S.outY}),!0}let ye=null;for(const V of Q){const S=$.points[V];S&&(Math.hypot(S.x+S.inX-te.x,S.y+S.inY-te.y)<=he&&(ye={index:V,side:"in"}),Math.hypot(S.x+S.outX-te.x,S.y+S.outY-te.y)<=he&&(ye={index:V,side:"out"}))}if(ye){const V=$.points[ye.index],S=ye.side==="in"?Math.hypot(V.outX,V.outY):Math.hypot(V.inX,V.inY);return ht(G=>{const ae=ue(G.clientX,G.clientY),ve=Re($,ae.x,ae.y),Pe=ve.x-V.x,Le=ve.y-V.y;if(ye.side==="in"?(V.inX=Pe,V.inY=Le):(V.outX=Pe,V.outY=Le),!G.altKey){const Ce=Math.max(1e-4,Math.hypot(Pe,Le)),be=G.shiftKey?Ce:S;ye.side==="in"?(V.outX=-Pe/Ce*be,V.outY=-Le/Ce*be):(V.inX=-Pe/Ce*be,V.inY=-Le/Ce*be)}}),!0}const Te=$.points.findIndex(V=>Math.hypot(V.x-te.x,V.y-te.y)<=he);if(Te>=0){if(j.altKey)return Q.delete(Te),!0;j.ctrlKey||j.metaKey?Q.add(Te):Q.has(Te)||(Q.clear(),Q.add(Te));const V=te,S=[...Q].map(G=>({index:G,x:$.points[G].x,y:$.points[G].y}));return ht(G=>{const ae=ue(G.clientX,G.clientY),ve=Re($,ae.x,ae.y);for(const Pe of S)$.points[Pe.index].x=Pe.x+ve.x-V.x,$.points[Pe.index].y=Pe.y+ve.y-V.y}),!0}if(j.altKey&&!j.ctrlKey&&!j.metaKey)return Q.clear(),!0;if(j.ctrlKey||j.metaKey||j.altKey){const V=te,S=j.altKey,E=G=>{const ae=ue(G.clientX,G.clientY),ve=Re($,ae.x,ae.y),Pe=Math.min(V.x,ve.x),Le=Math.max(V.x,ve.x),Ce=Math.min(V.y,ve.y),be=Math.max(V.y,ve.y);$.points.forEach((qe,we)=>{qe.x>=Pe&&qe.x<=Le&&qe.y>=Ce&&qe.y<=be&&(S?Q.delete(we):Q.add(we))}),window.removeEventListener("pointerup",E),window.removeEventListener("pointercancel",E)};return window.addEventListener("pointerup",E),window.addEventListener("pointercancel",E),!0}return!1}function ht(j){const $=()=>{window.removeEventListener("pointermove",j),window.removeEventListener("pointerup",$),window.removeEventListener("pointercancel",$)};window.addEventListener("pointermove",j),window.addEventListener("pointerup",$),window.addEventListener("pointercancel",$)}function St(j){if(e.activeObjectType!=="collision")return!1;const $=e.colliders.find(be=>be.id===e.activeObjectId);if(!($!=null&&$.enabled)||$.visible===!1)return!1;const J=ue(j.clientX,j.clientY),te=$.rotation*Math.PI/180,he=Math.cos(te),ye=Math.sin(te),Te=Math.max(1e-4,Math.abs($.scaleX??1)),V=Math.max(1e-4,Math.abs($.scaleY??1)),S=J.x-$.x,E=J.y-$.y,G=(he*S+ye*E)/Te,ae=(-ye*S+he*E)/V;if(!($.shape==="circle"?Math.hypot(G,ae)<=$.radius:$.shape==="ellipse"?Math.hypot(G/Math.max(1,$.radiusX),ae/Math.max(1,$.radiusY))<=1:Math.abs(G)<=$.width*.5&&Math.abs(ae)<=$.height*.5))return!1;const Pe=$.x,Le=$.y,Ce=J;return ht(be=>{const qe=ue(be.clientX,be.clientY);$.x=Pe+qe.x-Ce.x,$.y=Le+qe.y-Ce.y}),!0}function Xt(j){const $=e.systems.find(E=>E.id===e.activeId);if(($==null?void 0:$.visible)===!1)return!1;const J=$==null?void 0:$.config;if(!(J!=null&&J.forceField)||J.forceRadius<=0)return!1;const te=ue(j.clientX,j.clientY);if(Math.hypot(te.x-J.forceCenterX,te.y-J.forceCenterY)>J.forceRadius)return!1;const ye=J.forceCenterX,Te=J.forceCenterY;t.value&&(t.value.style.cursor="grabbing");const V=E=>{const G=ue(E.clientX,E.clientY);J.forceCenterX=ye+G.x-te.x,J.forceCenterY=Te+G.y-te.y},S=()=>{t.value&&(t.value.style.cursor=""),window.removeEventListener("pointermove",V),window.removeEventListener("pointerup",S),window.removeEventListener("pointercancel",S)};return window.addEventListener("pointermove",V),window.addEventListener("pointerup",S),window.addEventListener("pointercancel",S),j.preventDefault(),!0}function Ti(j){const $=e.systems.find(G=>G.id===e.activeId);if(($==null?void 0:$.visible)===!1)return!1;const J=$==null?void 0:$.config;if(!(J!=null&&J.attraction))return!1;const te=ue(j.clientX,j.clientY),he=Math.max(J.attractionRadius,12/Math.max(1e-4,e.editor.viewScale));if(Math.hypot(te.x-J.attractionCenterX,te.y-J.attractionCenterY)>he)return!1;const Te=J.attractionCenterX,V=J.attractionCenterY;t.value&&(t.value.style.cursor="grabbing");const S=G=>{const ae=ue(G.clientX,G.clientY);J.attractionCenterX=Te+ae.x-te.x,J.attractionCenterY=V+ae.y-te.y},E=()=>{t.value&&(t.value.style.cursor=""),window.removeEventListener("pointermove",S),window.removeEventListener("pointerup",E),window.removeEventListener("pointercancel",E)};return window.addEventListener("pointermove",S),window.addEventListener("pointerup",E),window.addEventListener("pointercancel",E),j.preventDefault(),!0}function pi(){const j=e.activeObjectId;if(e.activeObjectType==="particle"){const te=e.systems.find(ye=>ye.id===j);if(!te||te.visible===!1)return null;const he=te.config;return{x:he.centerX,y:he.centerY,rotation:he.rootRotation,scaleX:he.rootScaleX??1,scaleY:he.rootScaleY??1,setPosition:(ye,Te)=>{he.centerX=ye,he.centerY=Te},setRotation:ye=>{he.rootRotation=ye},setScale:(ye,Te)=>{he.rootScaleX=ye,he.rootScaleY=Te}}}const J=(e.activeObjectType==="collision"?e.colliders:e.activeObjectType==="path"?e.paths:e.spines).find(te=>te.id===j);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:(te,he)=>{J.x=te,J.y=he},setRotation:te=>{J.rotation=te},setScale:(te,he)=>{J.scaleX=te,J.scaleY=he}}}function Bi(j){const $=pi();if(!$)return;const J=e.editor.viewScale,te=t.value.getBoundingClientRect(),he=te.left+f.screen.width/2+e.editor.viewX+$.x*J,ye=te.top+f.screen.height*.5+e.editor.viewY+-$.y*J,Te=j.clientX,V=j.clientY,S=l.value,E=$.x,G=$.y,ae=$.rotation,ve=$.scaleX,Pe=$.scaleY,Le=Math.hypot(Te-he,V-ye)||1,Ce=Math.atan2(V-ye,Te-he),be=we=>{const dt=(we.clientX-Te)/J,pt=(we.clientY-V)/J;if(S==="translate")$.setPosition(E+dt,G-pt);else if(S==="rotate"){const Et=Math.atan2(we.clientY-ye,we.clientX-he);$.setRotation(ae-(Et-Ce)*180/Math.PI)}else if(S==="scale"){const vi=Math.hypot(we.clientX-he,we.clientY-ye)/Le;$.setScale(Math.max(.05,ve*vi),Math.max(.05,Pe*vi))}},qe=()=>{window.removeEventListener("pointermove",be),window.removeEventListener("pointerup",qe),window.removeEventListener("pointercancel",qe)};window.addEventListener("pointermove",be),window.addEventListener("pointerup",qe),window.addEventListener("pointercancel",qe)}function Ss(){le(1.2)}function Qt(){le(1/1.2)}function le(j){const $=Math.max(.01,e.editor.viewScale*j);e.editor.viewScale=$}function fe(){e.editor.viewScale=1,e.editor.viewX=0,e.editor.viewY=0}function bt(){e.editor.viewScale=1,e.editor.viewX=0,e.editor.viewY=0}function Dt(){e.settings.showGrid=!e.settings.showGrid}function Yt(){if(p){for(const[j,$]of X){const J=e.systems.find(te=>te.id===j);(!J||K.get(j)!==J.config)&&(p.removeChild($),$.destroy({children:!0}),X.delete(j),K.delete(j))}for(const j of e.systems){U&&!j.config.texture&&(j.config.texture=U);const $=ma(j.config);if(N)for(const te of $.trailResources)!te.texture&&(te.previewUrl==="/images/trail.png"||te.previewUrl==="/trails/trail.png")&&(te.texture=N);if(U)for(const te of $.imageResources)!te.texture&&te.textureName==="star"&&(te.texture=U);if(X.has(j.id))continue;const J=new I2(j.config);J.setEmitterPos(()=>({x:j.config.centerX,y:j.config.centerY})),p.addChild(J),X.set(j.id,J),K.set(j.id,j.config)}}}function ut(){if(!w)return;const j=w;if(j.clear(),!!e.settings.showEmitter&&e.systems.length)for(const $ of e.systems){if($.visible===!1)continue;const J=se.get($.id),te=(J==null?void 0:J.x)??$.config.centerX??0,he=-((J==null?void 0:J.y)??$.config.centerY??0),ye=e.activeObjectType==="particle"&&$.id===e.activeId,Te=ye?16763955:9082040,V=ye?.4:.2;j.lineStyle(1,Te,V),j.drawCircle(te,he,10),j.beginFill(Te,ye?.8:.4),j.drawCircle(te,he,3),j.endFill(),j.lineStyle(1,Te,ye?.3:.15),j.moveTo(te-16,he),j.lineTo(te+16,he),j.moveTo(te,he-16),j.lineTo(te,he+16)}}function fs(){var J;if(!v)return;const j=v;(J=j.parent)==null||J.addChild(j),j.clear();const $=new Map;for(const te of e.spines)te.visible===!1||!te.selectedBone||te.status!=="ready"||$.set(`${te.id}:${te.selectedBone}`,{spineId:te.id,boneName:te.selectedBone});for(const te of e.systems){if(te.visible===!1)continue;const he=te.config;if(!he.emitterFollow||he.emitterFollowMode!=="bone"||!he.emitterFollowSpineId||!he.emitterFollowBoneName)continue;const ye=e.spines.find(Te=>Te.id===he.emitterFollowSpineId);!ye||ye.visible===!1||$.set(`${he.emitterFollowSpineId}:${he.emitterFollowBoneName}`,{spineId:he.emitterFollowSpineId,boneName:he.emitterFollowBoneName})}for(const te of $.values()){const he=B==null?void 0:B.getBoneWorldTransform(te.spineId,te.boneName);if(!he)continue;const ye=he.x,Te=-he.y;j.lineStyle(2,12881151,.95),j.beginFill(12881151,.2),j.drawCircle(ye,Te,8),j.endFill(),j.beginFill(15919103,1),j.drawCircle(ye,Te,3.5),j.endFill()}}function _s(){if(!x)return;const j=x;if(j.clear(),!e.settings.showEmitter)return;const $=e.systems.find(Ce=>Ce.id===e.activeId);if(!$||$.visible===!1)return;const J=$.config,te=se.get($.id),he=(te==null?void 0:te.x)??J.centerX??0,ye=-((te==null?void 0:te.y)??J.centerY??0),Te=J.shape;if(Te==="point"||Te==="orbit")return;const V=J.rootScaleX??1,S=J.rootScaleY??1,E=-((te==null?void 0:te.rotation)??J.rootRotation??0)*Math.PI/180,G=Math.cos(E),ae=Math.sin(E),ve=J.offsetX??0,Pe=J.offsetY??0,Le=(Ce,be)=>{const qe=Ce+ve,we=-be-Pe,dt=qe*V,pt=we*S;return[he+dt*G-pt*ae,ye+(dt*ae+pt*G)]};if(Te==="circle"){j.lineStyle(2,3991658,.7);const Ce=48;for(let be=0;be<=Ce;be++){const qe=be/Ce*Math.PI*2,[we,dt]=Le(Math.cos(qe)*J.radius,Math.sin(qe)*J.radius);be===0?j.moveTo(we,dt):j.lineTo(we,dt)}}else if(Te==="rect"){const Ce=J.rectW/2,be=J.rectH/2,qe=Le(-Ce,-be),we=Le(Ce,-be),dt=Le(Ce,be),pt=Le(-Ce,be);j.lineStyle(2,4885759,.7),j.moveTo(qe[0],qe[1]),j.lineTo(we[0],we[1]),j.lineTo(dt[0],dt[1]),j.lineTo(pt[0],pt[1]),j.lineTo(qe[0],qe[1])}else if(Te==="cone"){const Ce=J.radius,be=J.coneAngle/2*Math.PI/180,qe=J.direction*Math.PI/180,we=Le(Math.cos(qe-be)*Ce,Math.sin(qe-be)*Ce),dt=Le(Math.cos(qe+be)*Ce,Math.sin(qe+be)*Ce);j.lineStyle(2,3991658,.7),j.moveTo(he,ye),j.lineTo(we[0],we[1]),j.moveTo(he,ye),j.lineTo(dt[0],dt[1]),j.lineStyle(1,3991658,.5);const pt=24;for(let Et=0;Et<=pt;Et++){const vi=qe-be+2*be*Et/pt,[rr,En]=Le(Math.cos(vi)*Ce,Math.sin(vi)*Ce);Et===0?j.moveTo(rr,En):j.lineTo(rr,En)}}}function gi(){if(!M)return;const j=M;j.clear();const $=e.systems.find(Te=>Te.id===e.activeId);if(($==null?void 0:$.visible)===!1)return;const J=$==null?void 0:$.config;if(!(J!=null&&J.forceField)||J.forceRadius<=0)return;const te=J.forceCenterX,he=-J.forceCenterY,ye=J.forceStrength>=0?5818367:16739194;j.lineStyle(2,ye,.85),j.beginFill(ye,.08),j.drawCircle(te,he,J.forceRadius),j.endFill(),j.lineStyle(1,ye,.7),j.moveTo(te-9,he),j.lineTo(te+9,he),j.moveTo(te,he-9),j.lineTo(te,he+9),j.beginFill(ye,.95),j.drawCircle(te,he,4),j.endFill()}function ms(){if(!T)return;const j=T;j.clear();const $=e.systems.find(V=>V.id===e.activeId);if(($==null?void 0:$.visible)===!1)return;const J=$==null?void 0:$.config;if(!(J!=null&&J.attraction))return;const te=J.attractionCenterX,he=-J.attractionCenterY,ye=Math.max(0,J.attractionRadius),Te=16731487;ye>0&&(j.lineStyle(2,Te,.95),j.beginFill(Te,.09),j.drawCircle(te,he,ye),j.endFill()),j.lineStyle(1,Te,.85),j.moveTo(te-10,he),j.lineTo(te+10,he),j.moveTo(te,he-10),j.lineTo(te,he+10),j.beginFill(Te,1),j.drawCircle(te,he,ye>0?4:6),j.endFill()}function Br(){if(!k)return;const j=k;if(j.clear(),!l.value)return;const $=pi();if(!$)return;const J=$.x,te=-$.y,he=$.scaleX,ye=$.scaleY,Te=-$.rotation*Math.PI/180,V=Math.cos(Te),S=Math.sin(Te),E=(ve,Pe)=>{const Le=ve*he,Ce=-Pe*ye;return[J+Le*V-Ce*S,te+(Le*S+Ce*V)]},G=(ve,Pe,Le,Ce)=>{const be=E(ve,Pe),qe=E(Le,Ce);j.moveTo(be[0],be[1]),j.lineTo(qe[0],qe[1])},ae=26;if(j.lineStyle(2,3526911,.9),j.beginFill(3526911,.25),j.drawCircle(J,te,6),j.endFill(),l.value==="translate")j.lineStyle(2,3526911,.9),G(-ae,0,ae,0),G(0,-ae,0,ae),G(ae-6,-4,ae,0),G(ae,0,ae-6,4),G(-20,-4,-ae,0),G(-ae,0,-20,4),G(-4,ae-6,0,ae),G(0,ae,4,ae-6),G(-4,-20,0,-ae),G(0,-ae,4,-20);else if(l.value==="rotate"){j.lineStyle(2,3526911,.8);const ve=48;for(let Ce=0;Ce<=ve;Ce++){const be=Ce/ve*Math.PI*2,[qe,we]=E(Math.cos(be)*ae,Math.sin(be)*ae);Ce===0?j.moveTo(qe,we):j.lineTo(qe,we)}const[Pe,Le]=E(0,ae);j.beginFill(3526911,.95),j.drawCircle(Pe,Le,4),j.endFill()}else if(l.value==="scale"){j.lineStyle(2,3526911,.9);const Pe=[[-ae,-ae],[ae,-ae],[ae,ae],[-ae,ae]].map(([Le,Ce])=>E(Le,Ce));j.moveTo(Pe[0][0],Pe[0][1]),j.lineTo(Pe[1][0],Pe[1][1]),j.lineTo(Pe[2][0],Pe[2][1]),j.lineTo(Pe[3][0],Pe[3][1]),j.lineTo(Pe[0][0],Pe[0][1]),j.beginFill(3526911,.9);for(const Le of Pe)j.drawRect(Le[0]-3,Le[1]-3,6,6);j.endFill()}}function Zi(j,$){var J;j.push({boneName:$.boneName,x:$.x,y:$.y,rotation:-$.rotation}),(J=$.trailState)!=null&&J.bones.length&&$.trailState.bones.forEach(te=>{j.push({boneName:te.boneName,x:te.x,y:te.y,rotation:te.rotation,parentX:0,parentY:0,trail:!0})})}function $i(j){if(!_)return;const $=_;if($.clear(),!e.settings.showBones)return;const J=0,te=0,he=Math.max(.25,Math.abs(e.editor.viewScale)||1),ye=Math.min(10,Math.max(.1,Number(e.settings.bonePointDrawSize)||1)),Te=Math.min(10,Math.max(.1,Number(e.settings.boneAxisDrawSize)||2)),V=2.5*ye/he,S=4.5*Te/he,E=2.5*Te/he,G=Math.max(.65,Te*.625)/he,ae=Math.max(.55,Te*.5)/he;for(const ve of j){const Pe=ve.trail?16731533:16747610;$.lineStyle(1,Pe,ve.trail?.65:.35),$.moveTo(ve.parentX??J,ve.parentY??te),$.lineTo(ve.x,ve.y);const Le=ve.rotation*Math.PI/180,Ce=Math.cos(Le),be=Math.sin(Le);$.lineStyle(G,3725823,.95),$.moveTo(ve.x,ve.y),$.lineTo(ve.x+Ce*S,ve.y+be*S),$.beginFill(3725823,.95),$.drawCircle(ve.x+Ce*S,ve.y+be*S,Math.max(.8,Te*.625)/he),$.endFill(),$.lineStyle(ae,16765286,.85),$.moveTo(ve.x,ve.y),$.lineTo(ve.x-be*E,ve.y+Ce*E),$.beginFill(Pe,.9),$.drawCircle(ve.x,ve.y,V),$.endFill()}}function Sa(j,$=16777215){const J=Number.parseInt(j.replace("#",""),16);return Number.isFinite(J)?J:$}function _a(){if(!C)return;const j=C;j.clear();for(const $ of z){if($.visible===!1)continue;const J=e.activeObjectType==="collision"&&e.activeObjectId===$.id,te=$.enabled?J?16735858:13911899:5792116,he=$.rotation*Math.PI/180,ye=Math.cos(he),Te=Math.sin(he),V=Math.max(1e-4,Math.abs($.scaleX??1)),S=Math.max(1e-4,Math.abs($.scaleY??1)),E=(ve,Pe)=>({x:$.x+ye*ve*V-Te*Pe*S,y:-($.y+Te*ve*V+ye*Pe*S)});let G=[];if($.shape==="circle"||$.shape==="ellipse"){const ve=$.shape==="circle"?$.radius:$.radiusX,Pe=$.shape==="circle"?$.radius:$.radiusY;G=Array.from({length:49},(Le,Ce)=>{const be=Ce/48*Math.PI*2;return E(Math.cos(be)*ve,Math.sin(be)*Pe)})}else if($.shape==="rect"){const ve=$.width*.5,Pe=$.height*.5;G=[E(-ve,-Pe),E(ve,-Pe),E(ve,Pe),E(-ve,Pe),E(-ve,-Pe)]}else{const ve=Math.max(3,Math.min(16,Math.round($.sides)));G=Array.from({length:ve+1},(Pe,Le)=>{const Ce=Math.PI*.5+Le%ve/ve*Math.PI*2;return E(Math.cos(Ce)*$.width*.5,Math.sin(Ce)*$.height*.5)})}if(!G.length)continue;j.lineStyle(J?2.5:1.5,te,$.enabled?.95:.45),j.beginFill(te,J?.12:.055),j.moveTo(G[0].x,G[0].y);for(let ve=1;ve<G.length;ve++)j.lineTo(G[ve].x,G[ve].y);j.endFill();const ae=E(0,0);j.lineStyle(1,te,.8),j.moveTo(ae.x-7,ae.y),j.lineTo(ae.x+7,ae.y),j.moveTo(ae.x,ae.y-7),j.lineTo(ae.x,ae.y+7)}}function Ta(){if(!I)return;const j=I;j.clear();for(const $ of e.paths){if($.visible===!1||!$.enabled||!$.points.length)continue;const J=e.activeObjectType==="path"&&e.activeObjectId===$.id,te=Sa($.color,16749374),he=(S,E)=>{const G=ke($,S,E);return{x:G.x,y:-G.y}},ye=$.points[0],Te=he(ye.x,ye.y);j.lineStyle(J?2.5:1.8,te,J?1:.75),j.moveTo(Te.x,Te.y);const V=$.closed?$.points.length:$.points.length-1;for(let S=0;S<V;S++){const E=$.points[S],G=$.points[(S+1)%$.points.length],ae=he(E.x+E.outX,E.y+E.outY),ve=he(G.x+G.inX,G.y+G.inY),Pe=he(G.x,G.y);j.bezierCurveTo(ae.x,ae.y,ve.x,ve.y,Pe.x,Pe.y)}J&&$.points.forEach((S,E)=>{const G=he(S.x,S.y),ae=he(S.x+S.inX,S.y+S.inY),ve=he(S.x+S.outX,S.y+S.outY),Pe=Math.hypot(S.inX,S.inY)>.01,Le=Math.hypot(S.outX,S.outY)>.01;j.lineStyle(1,11121867,.65),Pe&&(j.moveTo(G.x,G.y),j.lineTo(ae.x,ae.y)),Le&&(j.moveTo(G.x,G.y),j.lineTo(ve.x,ve.y)),Pe&&(j.beginFill(14015724,.95),j.drawCircle(ae.x,ae.y,3),j.endFill()),Le&&(j.beginFill(14015724,.95),j.drawCircle(ve.x,ve.y,3),j.endFill()),j.beginFill(Q.has(E)?16777215:te,1),j.lineStyle(1.5,Q.has(E)?6126847:16777215,.95),j.drawCircle(G.x,G.y,Q.has(E)?5:4),j.endFill()})}}function Gs(j,$,J="linear"){if(!j.length)return $;const te=[...j].sort((he,ye)=>he.x-ye.x);if($<=te[0].x)return te[0].y;for(let he=1;he<te.length;he++){const ye=te[he-1],Te=te[he];if($<=Te.x){let V=($-ye.x)/Math.max(1e-4,Te.x-ye.x);if(J==="bezier"){const S=ye.x+(ye.outX??(Te.x-ye.x)/3),E=Te.x+(Te.inX??-(Te.x-ye.x)/3);let G=0,ae=1;for(let ve=0;ve<18;ve++){const Pe=(G+ae)/2;Hs(ye.x,S,E,Te.x,Pe)<$?G=Pe:ae=Pe}return V=(G+ae)/2,Hs(ye.y,ye.y+(ye.outY??(Te.y-ye.y)/3),Te.y+(Te.inY??-(Te.y-ye.y)/3),Te.y,V)}return ye.y+(Te.y-ye.y)*V}}return te[te.length-1].y}function Hs(j,$,J,te,he){const ye=1-he;return ye*ye*ye*j+3*ye*ye*he*$+3*ye*he*he*J+he*he*he*te}function Ts(j,$){if(!j.points.length)return null;if(j.points.length===1)return{...ke(j,j.points[0].x,j.points[0].y),angle:j.rotation};const J=j.closed?j.points.length:j.points.length-1,te=[];let he=0;for(let Le=0;Le<J;Le++){const Ce=j.points[Le],be=j.points[(Le+1)%j.points.length];for(let qe=0;qe<=20;qe++){if(Le>0&&qe===0)continue;const we=qe/20,dt=Hs(Ce.x,Ce.x+Ce.outX,be.x+be.inX,be.x,we),pt=Hs(Ce.y,Ce.y+Ce.outY,be.y+be.inY,be.y,we),Et=ke(j,dt,pt),vi=te[te.length-1];vi&&(he+=Math.hypot(Et.x-vi.x,Et.y-vi.y)),te.push({...Et,distance:he})}}const ye=Math.min(1,Math.max(0,$))*he;let Te=te.findIndex(Le=>Le.distance>=ye);Te<0&&(Te=te.length-1);const V=te[Te],S=te[Math.max(0,Te-1)],E=te[Math.min(te.length-1,Te+1)],G=S.distance,ae=Te>0?(ye-G)/Math.max(1e-4,V.distance-G):0,ve=S.x+(V.x-S.x)*Math.min(1,Math.max(0,ae)),Pe=S.y+(V.y-S.y)*Math.min(1,Math.max(0,ae));return{x:ve,y:Pe,angle:Math.atan2(E.y-S.y,E.x-S.x)*180/Math.PI}}function Lr(j){z=e.colliders.map($=>{if(!$.followPath||!$.followPathId)return $;const J=e.paths.find(E=>E.id===$.followPathId&&E.enabled);if(!(J!=null&&J.points.length))return $;const te=Math.max(.05,Number($.followDuration)||2),he=Math.min(1,Math.max(0,j/te)),ye=Array.isArray($.followCurve)?$.followCurve:[{x:0,y:0},{x:1,y:1}],Te=$.followCurveMode==="跟随导出"?e.settings.exportSettings.keyframeCurve==="bezier"?"bezier":"linear":$.followCurveMode==="贝塞尔"?"bezier":"linear",V=Math.min(1,Math.max(0,Gs(ye,he,Te))),S=Ts(J,V);return S?{...$,x:S.x,y:S.y,rotation:$.rotation+($.followPathRotation?S.angle:0)}:$})}function Mn(j,$,J,te=Math.max(1e-4,Math.abs(j.rootScaleX)),he=Math.max(1e-4,Math.abs(j.rootScaleY))){const ye=-j.rootRotation*Math.PI/180,Te=Math.cos(ye),V=Math.sin(ye),S=$-j.centerX,E=-J+j.centerY;return{x:(Te*S+V*E)/te,y:(-V*S+Te*E)/he}}function nr(){var J,te,he;P=requestAnimationFrame(nr);const j=performance.now()/1e3;let $=j-Y;if(Y=j,$>.1&&($=.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))),xe(),Yt();const ye=Math.max(1,e.timeline.fps),Te=e.timeline.frame,V=Te/ye;B==null||B.sync(e.spines,Te,ye),Lr(V);for(const Ce of e.systems){const be=X.get(Ce.id);if(!be)continue;be.setFollowExportCurveMode(e.settings.exportSettings.keyframeCurve==="bezier"?"贝塞尔":"线性");const qe=Ce.visible!==!1;be.visible=qe,be.renderable=qe;const we=Ce.config;be.scale.set(we.rootScaleX,we.rootScaleY),be.setColliders(z),be.setEmitterFollowSpawn(0,0,0);let dt={x:we.centerX,y:we.centerY,rotation:we.rootRotation};const pt=we.emitterFollow&&we.emitterFollowMode==="bone"?e.spines.find(Ms=>Ms.id===we.emitterFollowSpineId&&Ms.enabled&&Ms.status==="ready"):null,Et=pt&&(B==null?void 0:B.getBoneWorldTransform(pt.id,we.emitterFollowBoneName))||null,vi=we.emitterFollow&&we.emitterFollowMode==="path"?e.paths.find(Ms=>Ms.id===we.emitterFollowPathId&&Ms.enabled):null,rr=Math.max(.05,we.emitterFollowDuration),En=Math.min(1,Math.max(0,V/rr)),dp=Math.min(1,Math.max(0,Gs(we.emitterFollowCurve,En))),au=Math.min(1,Math.max(0,we.emitterFollowOffset)),Fw=we.emitterFollowDirection==="reverse"?(1-au)*(1-dp):au+(1-au)*dp,js=vi?Ts(vi,Fw):null;if(Et){const Ms=we.emitterFollowBoneOffsetX,To=we.emitterFollowBoneOffsetY,Dr=Et.x+Ms,Ma=Et.y+To,Bl=we.rootRotation+we.emitterFollowBoneRotation,Mo=Math.max(1e-4,Math.abs(we.rootScaleX*we.emitterFollowBoneScaleX)),Eo=Math.max(1e-4,Math.abs(we.rootScaleY*we.emitterFollowBoneScaleY));if(dt={x:Dr,y:Ma,rotation:Bl},we.emitterFollowSpace==="local")be.position.set(Dr,-Ma),be.rotation=-Bl*Math.PI/180,be.scale.set(Mo,Eo),be.setSimulationTransform(Dr,Ma,Bl,Mo,Eo);else{be.position.set(we.centerX,-we.centerY),be.rotation=-we.rootRotation*Math.PI/180,be.scale.set(Mo,Eo),be.setSimulationTransform(we.centerX,we.centerY,we.rootRotation,Mo,Eo);const fp=Mn(we,Dr,Ma,Mo,Eo),Ow=-(Bl-we.rootRotation);be.setEmitterFollowSpawn(fp.x,fp.y,Ow)}}else if(js){const Ms=js.angle+(we.emitterFollowDirection==="reverse"?180:0),To=we.emitterAngleMode==="direction"?Ms:we.rootRotation;if(dt={x:js.x,y:js.y,rotation:To},we.emitterFollowSpace==="local")be.position.set(js.x,-js.y),be.rotation=-To*Math.PI/180,be.setSimulationTransform(js.x,js.y,To);else{be.position.set(we.centerX,-we.centerY),be.rotation=-we.rootRotation*Math.PI/180,be.setSimulationTransform(we.centerX,we.centerY,we.rootRotation);const Dr=Mn(we,js.x,js.y),Ma=we.emitterAngleMode==="direction"?-(Ms-we.rootRotation):0;be.setEmitterFollowSpawn(Dr.x,Dr.y,Ma)}}else be.position.set(we.centerX,-we.centerY),be.rotation=-we.rootRotation*Math.PI/180,be.setSimulationTransform(we.centerX,we.centerY,we.rootRotation);se.set(Ce.id,dt)}let S=0;const E=[],G=e.timeline,ae=G.fps,ve=1/Math.max(1,ae);let Pe=D,Le=0;if(G.playing?(O+=$,Le=Math.floor(O/ve),Le>0&&(O-=Le*ve)):O=0,G.playing&&Le>0)for(let Ce=0;Ce<Le;Ce++)if(Pe=G.frame,E.length=0,S=0,G.recorded){for(const pt of e.systems){const Et=X.get(pt.id),vi=(te=pt.frames)==null?void 0:te[G.frame];if(Et&&vi){Et.apply(vi);for(const rr of vi)rr.active&&(pt.visible!==!1&&Zi(E,rr),S++)}}G.frame++;const be=e.systems.find(pt=>pt.id===e.activeId),qe=(be==null?void 0:be.config.mode)==="stream"&&be.config.streamBehavior==="loop"?E1(be.config,ae):null,dt=G.loop&&(qe==null?void 0:qe.start)===G.playbackStart&&qe.end===G.playbackEnd?G.playbackEnd-1:G.playbackEnd;if(G.frame>dt)if(G.loop)G.frame=G.playbackStart;else{G.frame=G.playbackEnd,G.playing=!1;break}}else{if(G.frame===0)for(const be of e.systems){const qe=X.get(be.id);qe&&(be.config.mode==="stream"&&be.config.streamBehavior==="loop"?Z2(be,qe,ae,G.totalFrames):qe.reset())}for(const[be,qe]of X){const we=e.systems.find(En=>En.id===be),dt=(we==null?void 0:we.config.mode)==="stream"&&we.config.streamBehavior==="loop",pt=dt?(J=we.frames)==null?void 0:J[G.frame]:void 0,Et=G.frame===0&&!dt,vi=Et?[]:pt||qe.update(ve);if(Et?qe.apply([]):pt&&qe.apply(pt),(we==null?void 0:we.visible)!==!1)for(const En of vi)En.active&&Zi(E,En);S+=vi.length}for(const be of e.systems){if(!be.config.texture)continue;be.frames=be.frames||[];const qe=X.get(be.id);qe&&!(be.config.mode==="stream"&&be.config.streamBehavior==="loop")&&(be.frames[G.frame]=qe.capture())}G.frame++,G.frame>=G.totalFrames&&(G.frame=G.playbackStart,G.recorded=!0)}else{G.playing||(Pe=G.frame);for(const Ce of e.systems){const be=X.get(Ce.id),qe=G.playing?D:G.frame,we=(he=Ce.frames)==null?void 0:he[qe],dt=Ce.config.mode==="stream"&&Ce.config.streamBehavior==="loop"&&!!we;if((G.recorded||dt)&&be&&we){be.apply(we);for(const pt of we)pt.active&&(Ce.visible!==!1&&Zi(E,pt),S++)}else if(be){const pt=G.frame===0?[]:be.update(0);if(G.frame===0&&be.apply([]),Ce.visible!==!1)for(const Et of pt)Et.active&&Zi(E,Et);S+=be.activeCount}}}D=Pe,B==null||B.sync(e.spines,Pe,ae);for(const[,Ce]of X)Ce.drawTrailMeshDebug(e.settings.showSkinMesh);_a(),Ta(),fs(),ut(),_s(),gi(),ms(),Br(),$i(E),i.value&&(i.value.systems=e.systems.length,i.value.particles=S)}}return xo(async()=>{window.addEventListener("keydown",Ee);const j=t.value;f=new Qx({width:j.clientWidth||800,height:j.clientHeight||600,backgroundAlpha:0,antialias:!0}),j.appendChild(f.view),Me(),hs(()=>e.settings.backgroundImageData,W,{immediate:!0}),await pe();const $=U;for(const J of e.systems){J.config.texture=$;const te=ma(J.config);if(N)for(const he of te.trailResources)!he.texture&&(he.previewUrl==="/images/trail.png"||he.previewUrl==="/trails/trail.png")&&(he.texture=N);for(const he of te.imageResources)!he.texture&&he.textureName==="star"&&(he.texture=$)}i.value={systems:e.systems.length,particles:0},e.timeline.recorded=!1,e.timeline.frame=0,O=0,D=0,e.timeline.playing=!0,e.timeline.loop=!0;for(const J of e.systems)J.frames=[];e.recalcTotalFrames(),Y=performance.now()/1e3,nr(),hs(()=>e.systems.map(J=>JSON.stringify(J.config,(te,he)=>te==="texture"||te==="trailTexture"||te==="previewUrl"?void 0:he)).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}),UR(e)}),Tl(()=>{window.removeEventListener("keydown",Ee),cancelAnimationFrame(P),B==null||B.destroy(),B=null,y++,g&&g.destroy(!0),g=null,m=null,f&&(f.destroy(!0,{children:!0}),f=null)}),(j,$)=>(ne(),de("div",$R,[A("div",{ref_key:"holder",ref:t,class:it(["stage-holder",{grid:Be(e).settings.showGrid}]),tabindex:"0",onWheel:Tt(oe,["prevent"]),onPointerdown:Se,onDblclick:Tt(mt,["prevent"])},null,34),A("div",GR,[A("button",{class:"settings-btn",onClick:H,title:"系统设置"},"系统设置"),A("button",{class:"undo-btn",disabled:Be(tu).undoCount===0,onClick:$[0]||($[0]=(...J)=>Be(qd)&&Be(qd)(...J)),title:"撤回上一步 (Ctrl+Z)"},"↶",8,HR),A("div",jR,[A("button",{class:it(["tool-btn",{on:l.value===""}]),onClick:$[1]||($[1]=J=>u("")),title:"拖动画布 (Q)"},"✋",2),A("button",{class:it(["tool-btn",{on:l.value==="translate"}]),onClick:$[2]||($[2]=J=>u("translate")),title:"位移 (W)"},"✥",2),A("button",{class:it(["tool-btn",{on:l.value==="rotate"}]),onClick:$[3]||($[3]=J=>u("rotate")),title:"旋转 (E)"},"⟳",2),A("button",{class:it(["tool-btn",{on:l.value==="scale"}]),onClick:$[4]||($[4]=J=>u("scale")),title:"缩放 (R)"},"⤢",2)]),A("div",WR,[A("button",{class:"tool-btn",onClick:Ss,title:"放大"},"+"),A("button",{class:"tool-btn",onClick:Qt,title:"缩小"},"-"),A("button",{class:"tool-btn",onClick:fe,title:"适配画布"},"⤢"),A("button",{class:it(["tool-btn",{on:Be(e).settings.showGrid}]),onClick:Dt,title:"切换网格"},"▦",2),A("button",{class:"tool-btn",onClick:bt,title:"重置视图"},"⟳")]),A("div",{class:"background-menu",onClick:$[10]||($[10]=Tt(()=>{},["stop"]))},[A("button",{class:it(["background-btn",{on:r.value}]),title:"背景图显示设置",onClick:Ie},"背景图",2),r.value?(ne(),de("div",zR,[A("button",{class:"background-upload",onClick:$[5]||($[5]=J=>{var te;return(te=o.value)==null?void 0:te.click()})},He(h.value?"更换图像":"上传图像"),1),A("button",{class:"background-clear",disabled:!h.value,onClick:$[6]||($[6]=J=>ee())},"清除背景",8,qR),A("input",{ref_key:"backgroundFileInput",ref:o,class:"background-file-input",type:"file",accept:"image/png,image/jpeg,image/webp",onChange:q},null,544),A("div",{class:"background-file-name",title:h.value},He(h.value||"未上传图像"),9,KR),A("div",ZR,[A("label",null,[$[28]||($[28]=A("span",null,"X",-1)),_e(A("input",{"onUpdate:modelValue":$[7]||($[7]=J=>Be(e).settings.backgroundX=J),type:"number",step:"1","aria-label":"背景图 X 偏移"},null,512),[[tt,Be(e).settings.backgroundX,void 0,{number:!0}]])]),A("label",null,[$[29]||($[29]=A("span",null,"Y",-1)),_e(A("input",{"onUpdate:modelValue":$[8]||($[8]=J=>Be(e).settings.backgroundY=J),type:"number",step:"1","aria-label":"背景图 Y 偏移"},null,512),[[tt,Be(e).settings.backgroundY,void 0,{number:!0}]])])]),A("label",JR,[$[30]||($[30]=A("span",null,"透明度",-1)),_e(A("input",{"onUpdate:modelValue":$[9]||($[9]=J=>Be(e).settings.backgroundOpacity=J),type:"range",min:"0",max:"1",step:"0.01","aria-label":"背景图透明度"},null,512),[[tt,Be(e).settings.backgroundOpacity,void 0,{number:!0}]]),A("b",null,He(Math.round(Be(e).settings.backgroundOpacity*100))+"%",1)])])):Ve("",!0)]),A("button",{class:it(["help-btn",{on:a.value}]),title:"查看使用说明",onClick:ge},"使用说明",2),A("span",QR,He(Math.round(Be(e).editor.viewScale*100))+"%",1)]),s.value?(ne(),de("div",eP,[A("div",tP,[$[31]||($[31]=ei("系统设置 ",-1)),A("button",{class:"sp-close",onClick:$[11]||($[11]=J=>s.value=!1)},"✕")]),$[45]||($[45]=A("div",{class:"sp-section-title"},"界面布局",-1)),A("label",iP,[$[33]||($[33]=A("span",null,"参数面板位置",-1)),A("span",sP,[_e(A("input",{type:"checkbox","onUpdate:modelValue":$[12]||($[12]=J=>Be(e).settings.parameterPanelOnRight=J),"aria-label":"参数面板显示在右侧"},null,512),[[Wt,Be(e).settings.parameterPanelOnRight]]),$[32]||($[32]=A("span",{class:"sp-switch-ui","aria-hidden":"true"},null,-1)),A("b",null,He(Be(e).settings.parameterPanelOnRight?"右侧":"左侧"),1)])]),$[46]||($[46]=A("div",{class:"sp-divider"},null,-1)),$[47]||($[47]=A("div",{class:"sp-section-title"},"操作历史",-1)),A("label",nP,[$[34]||($[34]=A("span",null,"最大撤回步数",-1)),_e(A("input",{class:"sp-num sp-undo-limit",type:"number",min:"1",max:"200","onUpdate:modelValue":$[13]||($[13]=J=>Be(e).settings.undoLimit=J),"aria-label":"最大撤回步数",onChange:Z},null,544),[[tt,Be(e).settings.undoLimit,void 0,{number:!0}]])]),$[48]||($[48]=A("div",{class:"sp-divider"},null,-1)),$[49]||($[49]=A("div",{class:"sp-section-title"},"画布辅助显示",-1)),A("label",rP,[_e(A("input",{type:"checkbox","onUpdate:modelValue":$[14]||($[14]=J=>Be(e).settings.showEmitter=J)},null,512),[[Wt,Be(e).settings.showEmitter]]),$[35]||($[35]=ei("发射点",-1))]),A("label",aP,[_e(A("input",{type:"checkbox","onUpdate:modelValue":$[15]||($[15]=J=>Be(e).settings.showBones=J)},null,512),[[Wt,Be(e).settings.showBones]]),$[36]||($[36]=ei("骨骼连线",-1))]),Be(e).settings.showBones?(ne(),de(Je,{key:0},[A("label",oP,[$[37]||($[37]=A("span",null,"骨骼点绘制大小",-1)),_e(A("input",{class:"sp-num",type:"number",min:"0.1",max:"10",step:"0.1","onUpdate:modelValue":$[16]||($[16]=J=>Be(e).settings.bonePointDrawSize=J),"aria-label":"骨骼点绘制大小",onChange:d},null,544),[[tt,Be(e).settings.bonePointDrawSize,void 0,{number:!0}]])]),A("label",lP,[$[38]||($[38]=A("span",null,"坐标轴绘制大小",-1)),_e(A("input",{class:"sp-num",type:"number",min:"0.1",max:"10",step:"0.1","onUpdate:modelValue":$[17]||($[17]=J=>Be(e).settings.boneAxisDrawSize=J),"aria-label":"坐标轴绘制大小",onChange:d},null,544),[[tt,Be(e).settings.boneAxisDrawSize,void 0,{number:!0}]])])],64)):Ve("",!0),A("label",cP,[_e(A("input",{type:"checkbox","onUpdate:modelValue":$[18]||($[18]=J=>Be(e).settings.showSkinMesh=J)},null,512),[[Wt,Be(e).settings.showSkinMesh]]),$[39]||($[39]=ei("蒙皮网格",-1))]),$[50]||($[50]=A("div",{class:"sp-divider"},null,-1)),A("label",hP,[_e(A("input",{type:"checkbox","onUpdate:modelValue":$[19]||($[19]=J=>Be(e).settings.tickEnabled=J)},null,512),[[Wt,Be(e).settings.tickEnabled]]),$[40]||($[40]=ei("启用刻度",-1))]),Be(e).settings.tickEnabled?(ne(),de(Je,{key:1},[A("label",uP,[$[41]||($[41]=A("span",null,"刻度文字大小",-1)),_e(A("input",{type:"range",min:"8",max:"40",step:"1","onUpdate:modelValue":$[20]||($[20]=J=>Be(e).settings.axisFontSize=J)},null,512),[[tt,Be(e).settings.axisFontSize,void 0,{number:!0}]]),_e(A("input",{type:"number",min:"8",max:"40","onUpdate:modelValue":$[21]||($[21]=J=>Be(e).settings.axisFontSize=J),class:"sp-num"},null,512),[[tt,Be(e).settings.axisFontSize,void 0,{number:!0}]])]),A("label",dP,[$[42]||($[42]=A("span",null,"刻度线粗细",-1)),_e(A("input",{type:"range",min:"1",max:"5",step:"0.5","onUpdate:modelValue":$[22]||($[22]=J=>Be(e).settings.tickWidth=J)},null,512),[[tt,Be(e).settings.tickWidth,void 0,{number:!0}]]),_e(A("input",{type:"number",min:"1",max:"5","onUpdate:modelValue":$[23]||($[23]=J=>Be(e).settings.tickWidth=J),class:"sp-num"},null,512),[[tt,Be(e).settings.tickWidth,void 0,{number:!0}]])]),A("label",fP,[$[43]||($[43]=A("span",null,"坐标轴颜色",-1)),_e(A("input",{type:"color","onUpdate:modelValue":$[24]||($[24]=J=>Be(e).settings.axisColor=J),class:"sp-colr"},null,512),[[tt,Be(e).settings.axisColor]]),A("span",mP,He(Be(e).settings.axisColor),1)]),A("label",pP,[_e(A("input",{type:"checkbox","onUpdate:modelValue":$[25]||($[25]=J=>Be(e).settings.showAxisLabels=J)},null,512),[[Wt,Be(e).settings.showAxisLabels]]),$[44]||($[44]=ei("显示刻度数值",-1))])],64)):Ve("",!0),$[51]||($[51]=A("div",{class:"sp-cache-note"},"整个系统设置会自动保存到当前浏览器",-1))])):Ve("",!0),a.value?(ne(),de("div",{key:1,class:"help-overlay",role:"presentation",onClick:$[27]||($[27]=Tt(J=>a.value=!1,["self"]))},[A("section",gP,[A("header",vP,[$[52]||($[52]=A("div",null,[A("h2",{id:"help-title"},"使用说明"),A("p",null,"从创建粒子到保存、导出的快速入门")],-1)),A("button",{class:"help-close","aria-label":"关闭使用说明",title:"关闭 (Esc)",onClick:$[26]||($[26]=J=>a.value=!1)},"✕")]),$[53]||($[53]=La('<div class="help-body" data-v-6a919d1f><section class="help-section help-start" data-v-6a919d1f><h3 data-v-6a919d1f>快速开始</h3><ol data-v-6a919d1f><li data-v-6a919d1f><b data-v-6a919d1f>创建对象:</b>在左侧“场景对象”中添加粒子、碰撞、路径或 Spine。</li><li data-v-6a919d1f><b data-v-6a919d1f>编辑粒子:</b>选中粒子系统,依次调整发射、形状、属性、外观资源和修改器。</li><li data-v-6a919d1f><b data-v-6a919d1f>查看效果:</b>使用底部时间轴播放、暂停或拖动到指定帧;修改参数后会自动重新计算。</li><li data-v-6a919d1f><b data-v-6a919d1f>保存成果:</b>配置文件用于继续编辑;“导出 Spine Json”支持 Spine 3.8、4.0、4.1、4.2 和 4.3。</li></ol></section><div class="help-grid" data-v-6a919d1f><section class="help-section" data-v-6a919d1f><h3 data-v-6a919d1f>常用功能</h3><dl class="help-list" data-v-6a919d1f><div data-v-6a919d1f><dt data-v-6a919d1f>小眼睛</dt><dd data-v-6a919d1f>单独显示或隐藏场景对象;隐藏的粒子系统不会导出。</dd></div><div data-v-6a919d1f><dt data-v-6a919d1f>+Copy</dt><dd data-v-6a919d1f>完整复制当前选中对象,方便对比不同参数效果。</dd></div><div data-v-6a919d1f><dt data-v-6a919d1f>背景图</dt><dd data-v-6a919d1f>上传参考图并调整位置和透明度,只用于画布预览。</dd></div><div data-v-6a919d1f><dt data-v-6a919d1f>系统设置</dt><dd data-v-6a919d1f>管理界面与辅助显示,并自动保存在当前浏览器中。</dd></div><div data-v-6a919d1f><dt data-v-6a919d1f>配置管理</dt><dd data-v-6a919d1f>保存当前项目数据、加载配置,或直接使用预设文件;不包含系统设置。</dd></div><div data-v-6a919d1f><dt data-v-6a919d1f>Spine 骨骼</dt><dd data-v-6a919d1f>在层级树搜索并选择骨骼,可用于粒子发射器跟随。</dd></div></dl></section><section class="help-section" data-v-6a919d1f><h3 data-v-6a919d1f>快捷键</h3><div class="shortcut-list" data-v-6a919d1f><div data-v-6a919d1f><kbd data-v-6a919d1f>Ctrl/⌘</kbd><span data-v-6a919d1f>+</span><kbd data-v-6a919d1f>Z</kbd><em data-v-6a919d1f>撤回上一步</em></div><div data-v-6a919d1f><kbd data-v-6a919d1f>Ctrl/⌘</kbd><span data-v-6a919d1f>+</span><kbd data-v-6a919d1f>S</kbd><em data-v-6a919d1f>保存配置</em></div><div data-v-6a919d1f><kbd data-v-6a919d1f>Q</kbd><em data-v-6a919d1f>拖动画布</em></div><div data-v-6a919d1f><kbd data-v-6a919d1f>W</kbd><em data-v-6a919d1f>位移工具</em></div><div data-v-6a919d1f><kbd data-v-6a919d1f>E</kbd><em data-v-6a919d1f>旋转工具</em></div><div data-v-6a919d1f><kbd data-v-6a919d1f>R</kbd><em data-v-6a919d1f>缩放工具</em></div><div data-v-6a919d1f><kbd data-v-6a919d1f>D</kbd><em data-v-6a919d1f>播放 / 暂停</em></div><div data-v-6a919d1f><kbd data-v-6a919d1f>S</kbd><em data-v-6a919d1f>回到第一帧</em></div></div><p class="help-note" data-v-6a919d1f>Q / W / E / R 需要先点击画布。光标位于输入框时,单键快捷键不会触发。</p></section></div><section class="help-section help-export" data-v-6a919d1f><h3 data-v-6a919d1f>配置与导出有什么区别?</h3><p data-v-6a919d1f><b data-v-6a919d1f>保存配置</b>会保存编辑器中的全部对象和参数,之后可以继续修改;<b data-v-6a919d1f>导出 Spine Json</b>只导出显示中的粒子系统,并把跟随、碰撞和拖尾结果烘焙为独立动画数据。</p></section></div>',1))])])):Ve("",!0),i.value?(ne(),de("div",yP,[$[54]||($[54]=ei(" 系统: ",-1)),A("b",xP,He(i.value.systems),1),$[55]||($[55]=ei(" · 粒子(骨骼): ",-1)),A("b",bP,He(i.value.particles),1),$[56]||($[56]=ei(" · 根骨骼: ",-1)),$[57]||($[57]=A("b",null,"root",-1)),$[58]||($[58]=A("span",{class:"hud-tip"},"滚轮缩放 · 左键拖动画布",-1))])):Ve("",!0)]))}}),Tn=(n,e)=>{const t=n.__vccOpts||n;for(const[i,s]of e)t[i]=s;return t},SP=Tn(wP,[["__scopeId","data-v-6a919d1f"]]),_P={class:"ns-label"},TP=["min","max","step","value","disabled"],MP=["min","max","step","value","disabled"],EP=wn({__name:"NumSlider",props:{label:{},modelValue:{},min:{},max:{},step:{},disabled:{type:Boolean}},emits:["update:modelValue"],setup(n,{emit:e}){const t=n,i=e,s=nt(String(t.modelValue));hs(()=>t.modelValue,h=>{s.value=String(h)});function r(h){const l=parseFloat(h.target.value);Number.isNaN(l)||i("update:modelValue",l)}function a(h){s.value=h.target.value;const l=parseFloat(s.value);Number.isNaN(l)||i("update:modelValue",l)}function o(){const h=parseFloat(s.value);Number.isNaN(h)&&(s.value=String(t.modelValue))}return(h,l)=>(ne(),de("div",{class:it(["ns",{disabled:n.disabled}])},[A("span",_P,He(n.label),1),A("input",{type:"range",class:"ns-range",min:n.min,max:n.max,step:n.step,value:n.modelValue,disabled:n.disabled,onInput:r},null,40,TP),A("input",{type:"number",class:"ns-num",min:n.min,max:n.max,step:n.step,value:s.value,disabled:n.disabled,onInput:a,onBlur:o},null,40,MP)],2))}}),je=Tn(EP,[["__scopeId","data-v-7c2fbed0"]]),AP={class:"ce"},CP={class:"ce-editor"},IP={class:"ce-grid"},RP=["x1","x2","y2"],PP=["y1","x2","y2"],kP=["x","y","width","height"],FP=["d"],OP={key:0,class:"ce-handles"},BP=["x1","y1","x2","y2"],LP=["cx","cy","onPointerdown"],DP=["x1","y1","x2","y2"],NP=["cx","cy","onPointerdown"],UP=["cx","cy"],XP=["cx","cy","onPointerdown","onDblclick"],YP={class:"ce-nav"},VP={class:"ce-tip"},lr=8,$P=wn({__name:"CurveEditor",props:{modelValue:{},defaultValue:{default:()=>[{x:0,y:0},{x:1,y:1}]},mode:{default:"linear"}},emits:["update:modelValue"],setup(n,{emit:e}){const t=n,i=e,s=nt(null),r=nt(300),a=nt(110);let o=null;function h(){if(!s.value)return;const R=s.value.getBoundingClientRect();r.value=R.width,a.value=R.height}function l(R){return lr+R*(r.value-lr*2)}function c(R){return lr+(1-R)*(a.value-lr*2)}function u(){return[...t.modelValue].sort((R,F)=>R.x-F.x)}function d(R){i("update:modelValue",[...R].sort((F,B)=>F.x-B.x))}function f(){d(t.defaultValue.map(R=>({...R})))}const p=yt(()=>u());function m(R){const F=p.value[R],B=p.value[Math.max(0,R-1)];return{x:F.x-(F.x-B.x)/3,y:F.y-(F.y-B.y)/3}}function g(R){const F=p.value[R],B=p.value[Math.min(p.value.length-1,R+1)];return{x:F.x+(B.x-F.x)/3,y:F.y+(B.y-F.y)/3}}function y(R){const F=p.value[R],B=m(R);return{x:F.x+(F.inX??B.x-F.x),y:F.y+(F.inY??B.y-F.y)}}function w(R){const F=p.value[R],B=g(R);return{x:F.x+(F.outX??B.x-F.x),y:F.y+(F.outY??B.y-F.y)}}const v=yt(()=>{if(!p.value.length)return"";let R=`M ${l(p.value[0].x)} ${c(p.value[0].y)}`;for(let F=1;F<p.value.length;F++){const B=p.value[F];if(t.mode==="bezier"){const L=w(F-1),Y=y(F);R+=` C ${l(L.x)} ${c(L.y)} ${l(Y.x)} ${c(Y.y)} ${l(B.x)} ${c(B.y)}`}else R+=` L ${l(B.x)} ${c(B.y)}`}return R});function _(R,F){const B=s.value.getBoundingClientRect(),L=(R-B.left-lr)/(r.value-lr*2),Y=(F-B.top-lr)/(a.value-lr*2);return{x:Math.min(1,Math.max(0,Math.round(L*100)/100)),y:Math.min(1,Math.max(0,Math.round((1-Y)*100)/100))}}let x=0;function M(R){if(R.target.classList.contains("ce-hit")||Date.now()-x<400)return;const{x:F,y:B}=_(R.clientX,R.clientY),L=u().filter(Y=>Math.abs(Y.x-F)>.02);L.push({x:F,y:B}),d(L)}let T={t:0,i:-1,x:0,y:0};function C(R,F){R.stopPropagation();const B=u().findIndex(D=>Math.abs(D.x-p.value[F].x)<1e-6&&Math.abs(D.y-p.value[F].y)<1e-6);if(B<0)return;const L=Date.now();if(L-T.t<300&&T.i===F&&Math.abs(R.clientX-T.x)<8&&Math.abs(R.clientY-T.y)<8){T={t:0,i:-1,x:0,y:0},k(F);return}T={t:L,i:F,x:R.clientX,y:R.clientY};const Y=D=>{(Math.abs(D.clientX-R.clientX)>8||Math.abs(D.clientY-R.clientY)>8)&&(T={t:0,i:-1,x:0,y:0});const{x:P,y:U}=_(D.clientX,D.clientY),N=u();N[B]={x:P,y:U},d(N)},O=()=>{window.removeEventListener("pointermove",Y),window.removeEventListener("pointerup",O)};window.addEventListener("pointermove",Y),window.addEventListener("pointerup",O)}function I(R,F,B){R.stopPropagation();const L=O=>{const D=_(O.clientX,O.clientY),P=u(),U=P[F],N=B==="in"?P[Math.max(0,F-1)].x:U.x,X=B==="in"?U.x:P[Math.min(P.length-1,F+1)].x,K=Math.min(X,Math.max(N,D.x)),z=Math.round((K-U.x)*100)/100,se=Math.round((D.y-U.y)*100)/100;P[F]=B==="in"?{...U,inX:z,inY:se}:{...U,outX:z,outY:se},d(P)},Y=()=>{window.removeEventListener("pointermove",L),window.removeEventListener("pointerup",Y)};window.addEventListener("pointermove",L),window.addEventListener("pointerup",Y)}function k(R,F){F==null||F.stopPropagation();const B=u();B.length<=2||(x=Date.now(),d(B.filter((L,Y)=>Y!==R)))}return xo(()=>{h(),o=new ResizeObserver(h),s.value&&o.observe(s.value)}),Tl(()=>{o==null||o.disconnect()}),(R,F)=>(ne(),de("div",AP,[A("div",CP,[(ne(),de("svg",{ref_key:"svg",ref:s,class:"ce-svg",onDblclick:M},[A("g",IP,[(ne(),de(Je,null,ri([.25,.5,.75],B=>A("line",{key:"v"+B,x1:l(B),y1:"0",x2:l(B),y2:c(0)},null,8,RP)),64)),(ne(),de(Je,null,ri([.25,.5,.75],B=>A("line",{key:"h"+B,x1:"0",y1:c(B),x2:l(1),y2:c(B)},null,8,PP)),64))]),A("rect",{x:l(0),y:c(1),width:l(1)-l(0),height:c(0)-c(1),class:"ce-frame",fill:"none"},null,8,kP),A("path",{d:v.value,class:"ce-line",fill:"none"},null,8,FP),n.mode==="bezier"?(ne(),de("g",OP,[(ne(!0),de(Je,null,ri(p.value,(B,L)=>(ne(),de(Je,{key:"handles-"+L},[L>0?(ne(),de("line",{key:0,x1:l(B.x),y1:c(B.y),x2:l(y(L).x),y2:c(y(L).y)},null,8,BP)):Ve("",!0),L>0?(ne(),de("circle",{key:1,cx:l(y(L).x),cy:c(y(L).y),r:"4",onPointerdown:Y=>I(Y,L,"in")},null,40,LP)):Ve("",!0),L<p.value.length-1?(ne(),de("line",{key:2,x1:l(B.x),y1:c(B.y),x2:l(w(L).x),y2:c(w(L).y)},null,8,DP)):Ve("",!0),L<p.value.length-1?(ne(),de("circle",{key:3,cx:l(w(L).x),cy:c(w(L).y),r:"4",onPointerdown:Y=>I(Y,L,"out")},null,40,NP)):Ve("",!0)],64))),128))])):Ve("",!0),(ne(!0),de(Je,null,ri(p.value,(B,L)=>(ne(),de("g",{key:L},[A("circle",{cx:l(B.x),cy:c(B.y),r:"5",class:"ce-node"},null,8,UP),A("circle",{cx:l(B.x),cy:c(B.y),r:"9",class:"ce-hit",onPointerdown:Y=>C(Y,L),onDblclick:Y=>k(L,Y)},null,40,XP)]))),128))],544)),A("div",YP,[A("span",VP,He(n.mode==="bezier"?"拖动方形手柄调整弧度·双击空白新建·双击节点删除":"双击空白新建·双击节点删除·拖动节点调整"),1)])]),A("button",{class:"ce-reset",type:"button",title:"恢复默认曲线",onClick:f},"重置")]))}}),Qs=Tn($P,[["__scopeId","data-v-9bfb7b31"]]),GP={class:"pac"},HP={class:"pac-head"},jP={class:"pac-label"},WP={key:0,class:"pac-modes"},zP=["onClick"],qP={class:"pac-range"},KP={class:"pac-curve"},ZP={class:"pac-axis"},JP=wn({__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(n){const e=n,t=yt(()=>{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,s)=>(ne(),de("div",GP,[A("div",HP,[A("span",jP,He(n.label),1),n.showModes?(ne(),de("div",WP,[(ne(!0),de(Je,null,ri(t.value,r=>(ne(),de("button",{key:r.value,class:it(["pac-mode",{on:n.mode===r.value}]),onClick:a=>i.$emit("update:mode",r.value)},He(r.label),11,zP))),128))])):Ve("",!0)]),n.mode==="fixed"||n.mode==="direction"?(ne(),Nt(je,{key:0,label:n.mode==="direction"?"角度偏移":"数值",min:n.min,max:n.max,step:n.step,"model-value":n.valueMin,"onUpdate:modelValue":s[0]||(s[0]=r=>i.$emit("update:valueMin",r))},null,8,["label","min","max","step","model-value"])):n.mode==="random"?(ne(),de(Je,{key:1},[Ye(je,{label:"下限",min:n.min,max:n.max,step:n.step,"model-value":n.valueMin,"onUpdate:modelValue":s[1]||(s[1]=r=>i.$emit("update:valueMin",r))},null,8,["min","max","step","model-value"]),Ye(je,{label:"上限",min:n.min,max:n.max,step:n.step,"model-value":n.valueMax,"onUpdate:modelValue":s[2]||(s[2]=r=>i.$emit("update:valueMax",r))},null,8,["min","max","step","model-value"])],64)):(ne(),de(Je,{key:2},[A("div",qP,[Ye(je,{label:"范围下限",min:n.min,max:n.max,step:n.step,"model-value":n.valueMin,"onUpdate:modelValue":s[3]||(s[3]=r=>i.$emit("update:valueMin",r))},null,8,["min","max","step","model-value"]),Ye(je,{label:"范围上限",min:n.min,max:n.max,step:n.step,"model-value":n.valueMax,"onUpdate:modelValue":s[4]||(s[4]=r=>i.$emit("update:valueMax",r))},null,8,["min","max","step","model-value"])]),A("div",KP,[Ye(Qs,{"model-value":n.curve,"default-value":n.defaultCurve,"onUpdate:modelValue":s[5]||(s[5]=r=>i.$emit("update:curve",r))},null,8,["model-value","default-value"]),A("div",ZP,[s[6]||(s[6]=A("span",null,"0",-1)),A("span",null,He(n.curveLabel),1),s[7]||(s[7]=A("span",null,"1",-1))])])],64))]))}}),Rn=Tn(JP,[["__scopeId","data-v-238f838c"]]),QP={class:"gradient-editor"},ek=["title","onClick","onDblclick","onPointerdown"],tk={key:0,class:"gradient-controls"},ik=["value"],sk=["value"],nk={class:"gradient-position"},rk=["value"],ak=["disabled"],ok=wn({__name:"ColorGradientEditor",props:{modelValue:{}},emits:["update:modelValue"],setup(n,{emit:e}){const t=n,i=e,s=nt(null),r=nt(0),a=yt(()=>t.modelValue[r.value]||null),o=yt(()=>[...t.modelValue].sort((C,I)=>C.position-I.position)),h=yt(()=>{const C=o.value;return C.length?`linear-gradient(90deg, ${C.map(I=>`${I.color} ${l(I.position)*100}%`).join(", ")})`:"#ffffff"});hs(()=>t.modelValue.length,C=>{r.value>=C&&(r.value=Math.max(0,C-1))});function l(C){return Math.min(1,Math.max(0,Number(C)||0))}function c(){return t.modelValue.map(C=>({position:l(C.position),color:C.color}))}function u(C,I){const k=c();k[C]&&(k[C]={...k[C],...I},i("update:modelValue",k))}function d(C){u(r.value,{color:C.target.value})}function f(C){var R;const I=C.target,k=T(I.value,((R=a.value)==null?void 0:R.color)||"#ffffff");I.value=k,u(r.value,{color:k})}function p(C){const I=C.target;f(C),I.blur()}function m(C){const I=Number(C.target.value);Number.isFinite(I)&&u(r.value,{position:l(I/100)})}function g(C){const I=c();I.push({position:l(C),color:x(I,C)}),r.value=I.length-1,i("update:modelValue",I)}function y(C){if(!s.value)return;const I=s.value.getBoundingClientRect();g((C.clientX-I.left)/Math.max(1,I.width))}function w(){const C=o.value;let I=.5;if(C.length>1){let k=-1;for(let R=0;R<C.length-1;R++){const F=C[R+1].position-C[R].position;F>k&&(k=F,I=(C[R].position+C[R+1].position)/2)}}g(I)}function v(C){if(t.modelValue.length<=2||C<0)return;const I=c().filter((k,R)=>R!==C);r.value=Math.min(C,I.length-1),i("update:modelValue",I)}function _(C,I){if(!s.value)return;r.value=I;const k=F=>{const B=s.value.getBoundingClientRect();u(I,{position:l((F.clientX-B.left)/Math.max(1,B.width))})},R=()=>{window.removeEventListener("pointermove",k),window.removeEventListener("pointerup",R),window.removeEventListener("pointercancel",R)};window.addEventListener("pointermove",k),window.addEventListener("pointerup",R),window.addEventListener("pointercancel",R),C.preventDefault()}function x(C,I){const k=[...C].sort((R,F)=>R.position-F.position);if(!k.length)return"#ffffff";if(I<=k[0].position)return k[0].color;if(I>=k[k.length-1].position)return k[k.length-1].color;for(let R=0;R<k.length-1;R++){const F=k[R],B=k[R+1];if(I<F.position||I>B.position)continue;const L=(I-F.position)/Math.max(1e-4,B.position-F.position);return M(F.color,B.color,L)}return k[k.length-1].color}function M(C,I,k){const R=Y=>{const O=parseInt(Y.replace("#","").padEnd(6,"0").slice(0,6),16);return[O>>16&255,O>>8&255,O&255]},F=R(C),B=R(I),L=Y=>Math.round(F[Y]+(B[Y]-F[Y])*k);return`#${[L(0),L(1),L(2)].map(Y=>Y.toString(16).padStart(2,"0")).join("")}`}function T(C,I){let k=C.trim().replace(/^#/,"");return/^[0-9a-f]{3}$/i.test(k)&&(k=k.split("").map(R=>R+R).join("")),/^[0-9a-f]{6}$/i.test(k)?`#${k.toLowerCase()}`:I}return(C,I)=>(ne(),de("div",QP,[A("div",{ref_key:"bar",ref:s,class:"gradient-bar",style:Ii({background:h.value}),title:"双击色带添加色标",onDblclick:y},[(ne(!0),de(Je,null,ri(n.modelValue,(k,R)=>(ne(),de("button",{key:R,type:"button",class:it(["gradient-stop",{selected:R===r.value}]),style:Ii({left:`${l(k.position)*100}%`,"--stop-color":k.color}),title:`${Math.round(l(k.position)*100)}% · ${k.color}`,onClick:Tt(F=>r.value=R,["stop"]),onDblclick:Tt(F=>v(R),["stop"]),onPointerdown:Tt(F=>_(F,R),["stop"])},null,46,ek))),128))],36),a.value?(ne(),de("div",tk,[A("input",{type:"color",class:"gradient-color",value:a.value.color,"aria-label":"色标颜色",onInput:d},null,40,ik),A("input",{type:"text",class:"gradient-hex-input",value:a.value.color,"aria-label":"色标颜色值",spellcheck:"false",onChange:f,onKeydown:aa(p,["enter"])},null,40,sk),A("label",nk,[A("input",{type:"number",min:"0",max:"100",step:"1",value:Math.round(l(a.value.position)*100),"aria-label":"色标位置",onInput:m},null,40,rk),I[1]||(I[1]=A("span",null,"%",-1))]),A("button",{type:"button",class:"gradient-action",title:"在中间新增颜色",onClick:w},"+"),A("button",{type:"button",class:"gradient-action danger",title:"删除当前色标",disabled:n.modelValue.length<=2,onClick:I[0]||(I[0]=k=>v(r.value))},"×",8,ak)])):Ve("",!0),I[2]||(I[2]=A("div",{class:"gradient-hint"},"双击色带新增 · 拖动色标调整位置 · 双击色标删除",-1))]))}}),uv=Tn(ok,[["__scopeId","data-v-f6ab10bf"]]),lk={class:"image-card"},ck={class:"imgrow"},hk=["title"],uk=["src","alt"],dk={key:1,viewBox:"0 0 24 24",width:"22",height:"22",fill:"none",stroke:"#8a93bb","stroke-width":"1.6"},fk={class:"img-fields"},mk={key:0,class:"row"},pk={class:"row"},gk=["placeholder"],vk={class:"img-actions"},yk=["title"],xk=["disabled"],bk={class:"thumb-note"},wk={key:0,class:"row"},Sk={class:"row"},_k={class:"row"},Tk={class:"sequence-note"},Mk={class:"resource-weight-row"},Ek=["disabled","title"],Ak={key:0,viewBox:"0 0 24 24","aria-hidden":"true"},Ck={key:1,viewBox:"0 0 24 24","aria-hidden":"true"},Ik=wn({__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(n,{emit:e}){const t=n,i=e,s=yt(()=>{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=yt(()=>{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=yt(()=>{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)=>(ne(),de("div",lk,[A("div",ck,[A("button",{class:"img-thumb",title:n.supportsSequence&&n.resource.imageMode==="sequence"?"选择序列帧图片":"选择本地图片",onClick:o},[r.value?(ne(),de("img",{key:0,src:r.value,alt:n.resource.textureName},null,8,uk)):(ne(),de("svg",dk,[...l[10]||(l[10]=[A("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"},null,-1),A("circle",{cx:"8.5",cy:"8.5",r:"1.6"},null,-1),A("path",{d:"M21 15l-5-5-9 9"},null,-1)])]))],8,hk),A("div",fk,[n.showFolder?(ne(),de("label",mk,[l[11]||(l[11]=A("span",null,"子文件夹",-1)),_e(A("input",{"onUpdate:modelValue":l[0]||(l[0]=c=>n.resource.textureFolder=c),type:"text",class:"inp",placeholder:"subfolder/"},null,512),[[tt,n.resource.textureFolder]])])):Ve("",!0),A("label",pk,[l[12]||(l[12]=A("span",null,"名称",-1)),_e(A("input",{"onUpdate:modelValue":l[1]||(l[1]=c=>n.resource.textureName=c),type:"text",class:"inp",placeholder:n.namePlaceholder},null,8,gk),[[tt,n.resource.textureName]])])]),A("div",vk,[A("button",{class:"mini-btn2",title:`恢复 ${n.defaultFile}`,onClick:l[2]||(l[2]=c=>h.$emit("reset",n.resource.id))},"⟳",8,yk),A("button",{class:"mini-btn2",title:"删除图片资源",disabled:n.resourceCount===1,onClick:l[3]||(l[3]=c=>h.$emit("remove",n.resource.id))},"🗑",8,xk)])]),A("div",bk,He(s.value),1),n.supportsSequence?(ne(),de("label",wk,[l[14]||(l[14]=A("span",null,"图片模式",-1)),_e(A("select",{"onUpdate:modelValue":l[4]||(l[4]=c=>n.resource.imageMode=c),class:"inp"},[...l[13]||(l[13]=[A("option",{value:"fixed"},"固定",-1),A("option",{value:"sequence"},"序列帧",-1)])],512),[[Vt,n.resource.imageMode]])])):Ve("",!0),n.supportsSequence&&n.resource.imageMode==="sequence"?(ne(),de(Je,{key:1},[A("label",Sk,[l[16]||(l[16]=A("span",null,"播放模式",-1)),_e(A("select",{"onUpdate:modelValue":l[5]||(l[5]=c=>n.resource.sequencePlayback=c),class:"inp"},[...l[15]||(l[15]=[A("option",{value:"once-hide"},"单次-尾帧消失",-1),A("option",{value:"once-hold"},"单次-尾帧固定",-1),A("option",{value:"loop-forward"},"正向循环",-1),A("option",{value:"loop-reverse"},"反向循环",-1)])],512),[[Vt,n.resource.sequencePlayback]])]),A("label",_k,[l[17]||(l[17]=A("span",null,"播放帧率",-1)),_e(A("input",{"onUpdate:modelValue":l[6]||(l[6]=c=>n.resource.sequenceFps=c),type:"number",min:"1",max:"120",step:"1",class:"inp"},null,512),[[tt,n.resource.sequenceFps,void 0,{number:!0}]])]),A("button",{class:"sequence-pick",onClick:l[7]||(l[7]=c=>h.$emit("pickSequence",n.resource.id))},"选择序列帧(多选)"),A("div",Tk,He(a.value),1)],64)):Ve("",!0),A("div",Mk,[Ye(je,{class:"resource-weight-control",label:"占比%",min:0,max:100,step:1,"model-value":n.resource.weight,disabled:n.resource.locked||n.resourceCount===1,"onUpdate:modelValue":l[8]||(l[8]=c=>h.$emit("updateWeight",n.resource.id,c))},null,8,["model-value","disabled"]),A("button",{class:it(["weight-lock",{on:n.resource.locked}]),disabled:n.resourceCount===1,title:n.resource.locked?"解除占比锁定":"锁定当前占比",onClick:l[9]||(l[9]=c=>h.$emit("toggleLock",n.resource.id))},[n.resource.locked?(ne(),de("svg",Ak,[...l[18]||(l[18]=[A("rect",{x:"5",y:"10",width:"14",height:"10",rx:"2"},null,-1),A("path",{d:"M8 10V7a4 4 0 0 1 8 0v3"},null,-1)])])):(ne(),de("svg",Ck,[...l[19]||(l[19]=[A("rect",{x:"5",y:"10",width:"14",height:"10",rx:"2"},null,-1),A("path",{d:"M16 10V7a4 4 0 0 0-7.5-2"},null,-1)])]))],10,Ek)]),HS(h.$slots,"default",{},void 0)]))}}),dv=Tn(Ik,[["__scopeId","data-v-68ff5314"]]),Rk={class:"spine-editor"},Pk={class:"field wide"},kk={class:"grid three"},Fk={class:"field"},Ok={class:"field"},Bk={class:"field"},Lk={class:"grid three"},Dk={class:"field"},Nk={class:"field"},Uk={class:"field"},Xk=["disabled"],Yk={class:"asset-row"},Vk=["title"],$k={class:"asset-row"},Gk=["title"],Hk={class:"asset-row"},jk=["title"],Wk={class:"asset-actions"},zk=["disabled"],qk={class:"runtime-note"},Kk={key:0},Zk={key:0,class:"error"},Jk={class:"section-box"},Qk={key:0,class:"empty"},eF={key:1,class:"field wide"},tF=["value"],iF={class:"section-box"},sF={class:"tree-title-row"},nF=["disabled","title"],rF={key:0,class:"empty"},aF={key:1,class:"bone-search"},oF={key:2,class:"empty"},lF={key:3,class:"bone-tree"},cF=["onClick","onKeydown"],hF=["title","onClick"],uF={key:1,class:"bone-leaf"},dF={class:"bone-name"},fF=wn({__name:"SpineObjectPanel",props:{spineObject:{}},setup(n){const e=n,t=Rl(),i=nt(null),s=nt(null),r=nt(null),a=nt(null),o=nt(new Set),h=nt(""),l=nt(null),c=nt(null),u=nt([]);e.spineObject.selectedBone==null&&(e.spineObject.selectedBone=""),e.spineObject.sourceBundle==null&&(e.spineObject.sourceBundle=null),e.spineObject.dataVersion==null&&(e.spineObject.dataVersion="");const d=yt(()=>{var D;return((D=l.value)==null?void 0:D.name)||e.spineObject.skeletonFileName}),f=yt(()=>{var D;return((D=c.value)==null?void 0:D.name)||e.spineObject.atlasFileName}),p=yt(()=>u.value.length?u.value.map(D=>D.name):e.spineObject.textureFileNames),m=yt(()=>p.value.length?`${p.value.length} 张:${p.value.join(", ")}`:"PNG / JPEG / WebP..."),g=yt(()=>new Set(e.spineObject.bones.map(D=>D.parent).filter(D=>!!D))),y=yt(()=>new Map(e.spineObject.bones.map(D=>[D.name,D]))),w=yt(()=>e.spineObject.bones.filter(D=>{var N;const P=h.value.trim().toLocaleLowerCase();if(P)return D.name.toLocaleLowerCase().includes(P);let U=D.parent;for(;U;){if(o.value.has(U))return!1;U=((N=y.value.get(U))==null?void 0:N.parent)||null}return!0})),v=yt(()=>g.value.size>0&&[...g.value].every(D=>o.value.has(D)));function _(D){const P=e.spineObject.selectedBone===D;for(const U of t.spines)U.selectedBone="";P||(e.spineObject.selectedBone=D)}function x(D){o.value.has(D)?o.value.delete(D):o.value.add(D)}function M(){o.value=v.value?new Set:new Set(g.value)}function T(D){var P;return((P=D.target.files)==null?void 0:P[0])||null}function C(D){l.value=T(D)}function I(D){c.value=T(D)}function k(D){u.value=Array.from(D.target.files||[])}function R(D){return D.name.replace(/\.[^.]+$/,"").toLocaleLowerCase()}async function F(D){const P=Array.from(D.target.files||[]);if(!P.length)return;const U=P.filter(Q=>/\.(json|skel)$/i.test(Q.name)),N=P.filter(Q=>/\.atlas$/i.test(Q.name)),X=P.filter(Q=>/\.(png|jpe?g|webp|wepb)$/i.test(Q.name)),K=N.map(Q=>({atlas:Q,skeleton:U.find(me=>R(me)===R(Q))})).find(Q=>Q.skeleton),z=(K==null?void 0:K.skeleton)||U[0]||null,se=(K==null?void 0:K.atlas)||N[0]||null;if(l.value=z,c.value=se,u.value=X,!z||!se||!X.length){const Q=[!z&&"JSON / SKEL",!se&&"Atlas",!X.length&&"纹理图片"].filter(Boolean).join("、");e.spineObject.status="error",e.spineObject.error=`所选文件夹缺少:${Q}`;return}await Y()}function B(){t.recalcTotalFrames()}function L(){B(),t.timeline.frame=0}async function Y(){var U;const D=l.value,P=c.value;if(!D||!P||!u.value.length){e.spineObject.status="error",e.spineObject.error="请依次选择 Spine 数据、Atlas 和全部纹理图片";return}e.spineObject.status="loading",e.spineObject.error="";try{const N=await Ib(D,P,u.value);Jh(e.spineObject.id,N),e.spineObject.skeletonFileName=D.name,e.spineObject.atlasFileName=P.name,e.spineObject.textureFileNames=u.value.map(X=>X.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=((U=N.animations[0])==null?void 0:U.name)||"",e.spineObject.assetVersion++,e.spineObject.status="ready",B(),t.timeline.frame=0;try{e.spineObject.sourceBundle=await MR(D,P,u.value)}catch(X){e.spineObject.sourceBundle=null,console.warn("Spine 配置资源嵌入失败",X)}}catch(N){e.spineObject.status="error",e.spineObject.error=N instanceof Error?N.message:String(N)}}function O(){Il(e.spineObject.id),l.value=null,c.value=null,u.value=[],i.value&&(i.value.value=""),s.value&&(s.value.value=""),r.value&&(r.value.value=""),a.value&&(a.value.value=""),e.spineObject.skeletonFileName="",e.spineObject.atlasFileName="",e.spineObject.textureFileNames=[],e.spineObject.dataVersion="",e.spineObject.sourceBundle=null,e.spineObject.animations=[],e.spineObject.bones=[],e.spineObject.selectedBone="",h.value="",o.value=new Set,e.spineObject.selectedAnimation="",e.spineObject.assetVersion++,e.spineObject.status="empty",e.spineObject.error="",B()}return(D,P)=>(ne(),de("div",Rk,[P[30]||(P[30]=A("div",{class:"editor-title"},"Spine 属性",-1)),A("label",Pk,[P[15]||(P[15]=A("span",null,"Spine 名称",-1)),_e(A("input",{"onUpdate:modelValue":P[0]||(P[0]=U=>n.spineObject.name=U)},null,512),[[tt,n.spineObject.name]])]),A("div",kk,[A("label",Fk,[P[16]||(P[16]=A("span",null,"X 位置",-1)),_e(A("input",{"onUpdate:modelValue":P[1]||(P[1]=U=>n.spineObject.x=U),type:"number"},null,512),[[tt,n.spineObject.x,void 0,{number:!0}]])]),A("label",Ok,[P[17]||(P[17]=A("span",null,"Y 位置",-1)),_e(A("input",{"onUpdate:modelValue":P[2]||(P[2]=U=>n.spineObject.y=U),type:"number"},null,512),[[tt,n.spineObject.y,void 0,{number:!0}]])]),A("label",Bk,[P[18]||(P[18]=A("span",null,"旋转",-1)),_e(A("input",{"onUpdate:modelValue":P[3]||(P[3]=U=>n.spineObject.rotation=U),type:"number"},null,512),[[tt,n.spineObject.rotation,void 0,{number:!0}]])])]),A("div",Lk,[A("label",Dk,[P[19]||(P[19]=A("span",null,"Scale X",-1)),_e(A("input",{"onUpdate:modelValue":P[4]||(P[4]=U=>n.spineObject.scaleX=U),type:"number",step:"0.05"},null,512),[[tt,n.spineObject.scaleX,void 0,{number:!0}]])]),A("label",Nk,[P[20]||(P[20]=A("span",null,"Scale Y",-1)),_e(A("input",{"onUpdate:modelValue":P[5]||(P[5]=U=>n.spineObject.scaleY=U),type:"number",step:"0.05"},null,512),[[tt,n.spineObject.scaleY,void 0,{number:!0}]])]),A("label",Uk,[P[21]||(P[21]=A("span",null,"开始时间",-1)),_e(A("input",{"onUpdate:modelValue":P[6]||(P[6]=U=>n.spineObject.timeOffset=U),type:"number",min:"0",step:"0.033333",onChange:B},null,544),[[tt,n.spineObject.timeOffset,void 0,{number:!0}]])])]),P[31]||(P[31]=A("div",{class:"divider"},null,-1)),P[32]||(P[32]=A("div",{class:"section-title"},"Spine 资源",-1)),A("input",{ref_key:"skeletonInput",ref:i,hidden:"",type:"file",accept:".json,.skel,application/json,application/octet-stream",onChange:C},null,544),A("input",{ref_key:"atlasInput",ref:s,hidden:"",type:"file",accept:".atlas,text/plain",onChange:I},null,544),A("input",{ref_key:"textureInput",ref:r,hidden:"",type:"file",multiple:"",accept:".png,.jpg,.jpeg,.webp,.wepb,image/png,image/jpeg,image/webp",onChange:k},null,544),A("input",{ref_key:"folderInput",ref:a,hidden:"",type:"file",multiple:"",webkitdirectory:"",directory:"",onChange:F},null,544),A("button",{class:"folder-select",disabled:n.spineObject.status==="loading",onClick:P[7]||(P[7]=U=>{var N;return(N=a.value)==null?void 0:N.click()})},"选择文件夹并加载",8,Xk),P[33]||(P[33]=A("div",{class:"folder-hint"},"一次读取文件夹中的 JSON / SKEL、Atlas 和全部纹理;仍可在下方单独替换资源。",-1)),A("div",Yk,[A("div",{class:"asset-name",title:d.value},He(d.value||"JSON / SKEL..."),9,Vk),A("button",{onClick:P[8]||(P[8]=U=>{var N;return(N=i.value)==null?void 0:N.click()})},"选择")]),A("div",$k,[A("div",{class:"asset-name",title:f.value},He(f.value||"Atlas..."),9,Gk),A("button",{onClick:P[9]||(P[9]=U=>{var N;return(N=s.value)==null?void 0:N.click()})},"选择")]),A("div",Hk,[A("div",{class:"asset-name",title:p.value.join(", ")},He(m.value),9,jk),A("button",{onClick:P[10]||(P[10]=U=>{var N;return(N=r.value)==null?void 0:N.click()})},"选择(多选)")]),A("div",Wk,[A("button",{class:"load",disabled:n.spineObject.status==="loading",onClick:Y},He(n.spineObject.status==="loading"?"加载中…":"↧ 加载"),9,zk),A("button",{class:"clear",onClick:O},"清除")]),A("div",qk,[P[22]||(P[22]=ei(" 支持 Spine 3.8 / 4.0 / 4.1 / 4.2 / 4.3 JSON · 对应版本运行时按需加载 · 本地离线 ",-1)),n.spineObject.dataVersion?(ne(),de("span",Kk," · 当前资源 "+He(n.spineObject.dataVersion),1)):Ve("",!0)]),n.spineObject.error?(ne(),de("div",Zk,He(n.spineObject.error),1)):Ve("",!0),A("div",Jk,[P[25]||(P[25]=A("div",{class:"section-title"},"Spine 动画",-1)),n.spineObject.animations.length?(ne(),de("label",eF,[P[24]||(P[24]=A("span",null,"时间轴播放动画",-1)),_e(A("select",{"onUpdate:modelValue":P[11]||(P[11]=U=>n.spineObject.selectedAnimation=U),onChange:L},[P[23]||(P[23]=A("option",{value:""},"无",-1)),(ne(!0),de(Je,null,ri(n.spineObject.animations,U=>(ne(),de("option",{key:U.name,value:U.name},He(U.name)+"("+He(U.duration.toFixed(2))+"s) ",9,tF))),128))],544),[[Vt,n.spineObject.selectedAnimation]])])):(ne(),de("div",Qk,"无可用动画"))]),A("div",iF,[A("div",sF,[P[29]||(P[29]=A("div",{class:"section-title"},"层级树",-1)),A("button",{class:it(["selected-bone",{active:n.spineObject.selectedBone}]),disabled:!n.spineObject.selectedBone,title:n.spineObject.selectedBone?"点击清除骨骼选择":"当前未选择骨骼",onClick:P[12]||(P[12]=U=>n.spineObject.selectedBone="")},[n.spineObject.selectedBone?(ne(),de(Je,{key:0},[P[26]||(P[26]=ei("清除选中骨骼:",-1)),A("strong",null,He(n.spineObject.selectedBone),1)],64)):(ne(),de(Je,{key:1},[P[27]||(P[27]=ei("当前骨骼:",-1)),P[28]||(P[28]=A("strong",null,"未选择",-1))],64))],10,nF),n.spineObject.bones.length?(ne(),de("button",{key:0,class:"tree-action",onClick:M},He(v.value?"全部展开":"全部折叠"),1)):Ve("",!0)]),n.spineObject.bones.length?(ne(),de("div",aF,[_e(A("input",{"onUpdate:modelValue":P[13]||(P[13]=U=>h.value=U),type:"search","aria-label":"搜索骨骼",placeholder:"搜索骨骼名称…"},null,512),[[tt,h.value,void 0,{trim:!0}]]),h.value?(ne(),de("button",{key:0,title:"清空搜索","aria-label":"清空骨骼搜索",onClick:P[14]||(P[14]=U=>h.value="")},"✕")):Ve("",!0)])):(ne(),de("div",rF,"未加载 Spine")),n.spineObject.bones.length&&!w.value.length?(ne(),de("div",oF,"未找到匹配的骨骼")):n.spineObject.bones.length?(ne(),de("div",lF,[(ne(!0),de(Je,null,ri(w.value,U=>(ne(),de("div",{key:U.name,class:it(["bone",{selected:n.spineObject.selectedBone===U.name}]),style:Ii({paddingLeft:`${6+U.depth*16}px`}),role:"button",tabindex:"0",onClick:N=>_(U.name),onKeydown:aa(Tt(N=>_(U.name),["prevent"]),["enter"])},[g.value.has(U.name)?(ne(),de("button",{key:0,class:"bone-toggle",title:o.value.has(U.name)?"展开子骨骼":"折叠子骨骼",onClick:Tt(N=>x(U.name),["stop"])},He(o.value.has(U.name)?"▸":"▾"),9,hF)):(ne(),de("span",uF,"•")),A("span",dF,He(U.name),1)],46,cF))),128))])):Ve("",!0)])]))}}),mF=Tn(fF,[["__scopeId","data-v-9257fb45"]]),pF="3.8";function ys(n,e,t){n[e]==null&&n[t]!=null&&(n[e]=n[t]),delete n[t]}function Qf(n){if(!n||typeof n!="object")return;if(Array.isArray(n)){for(const t of n)Qf(t);return}const e=n;Array.isArray(e.curve)&&delete e.curve;for(const t of Object.values(e))Qf(t)}function gF(n){for(const e of n.bones)ys(e,"transform","inherit");for(const e of n.transform||[])ys(e,"rotateMix","mixRotate"),e.translateMix==null&&(e.translateMix=e.mixX??e.mixY),e.scaleMix==null&&(e.scaleMix=e.mixScaleX??e.mixScaleY),ys(e,"shearMix","mixShearY"),delete e.mixX,delete e.mixY,delete e.mixScaleX,delete e.mixScaleY;for(const e of n.path||[])ys(e,"rotateMix","mixRotate"),e.translateMix==null&&(e.translateMix=e.mixX??e.mixY),delete e.mixX,delete e.mixY;for(const e of n.skins)for(const t of Object.values(e.attachments||{}))for(const i of Object.values(t||{}))i.parent!=null&&ys(i,"deform","timelines")}function vF(n){for(const e of Object.values(n.slots||{}))ys(e,"color","rgba"),ys(e,"twoColor","rgba2")}function yF(n){for(const e of Object.values(n.bones||{}))for(const t of e.rotate||[])ys(t,"angle","value")}function xF(n){for(const e of Object.values(n.transform||{}))for(const t of e)ys(t,"rotateMix","mixRotate"),t.translateMix==null&&(t.translateMix=t.mixX??t.mixY),t.scaleMix==null&&(t.scaleMix=t.mixScaleX??t.mixScaleY),ys(t,"shearMix","mixShearY"),delete t.mixX,delete t.mixY,delete t.mixScaleX,delete t.mixScaleY}function bF(n){for(const e of Object.values(n.path||{})){for(const t of["position","spacing"])for(const i of e[t]||[])ys(i,t,"value");for(const t of e.mix||[])ys(t,"rotateMix","mixRotate"),t.translateMix==null&&(t.translateMix=t.mixX??t.mixY),delete t.mixX,delete t.mixY}}function wF(n){if(!n.attachments)return;const e=n.deform||(n.deform={});for(const[t,i]of Object.entries(n.attachments)){const s=e[t]||(e[t]={});for(const[r,a]of Object.entries(i)){const o=s[r]||(s[r]={});for(const[h,l]of Object.entries(a))l.deform&&(o[h]=l.deform)}}delete n.attachments}function SF(n){n.skeleton.spine=pF,gF(n);for(const e of Object.values(n.animations))vF(e),yF(e),xF(e),bF(e),wF(e);return Qf(n.animations),n}function _F(n,e,t,i){const s=t.frame-e.frame,r=s<=0?0:(n.frame-e.frame)/s;let a=0;for(let o=0;o<n.values.length;o++){const h=e.values[o]+(t.values[o]-e.values[o])*r;a=Math.max(a,Math.abs(n.values[o]-h)/Math.max(1e-9,i[o]??i[0]??.001))}return a}function Ub(n,e,t=new Set){if(n.length<=2)return n.slice();const i=new Set([0,n.length-1]);for(let a=1;a<n.length-1;a++)t.has(n[a].frame)&&i.add(a);const s=()=>[...i].sort((a,o)=>a-o);let r=!0;for(;r;){r=!1;const a=s();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=_F(n[d],n[h],n[l],e);f>u&&(u=f,c=d)}c>=0&&(i.add(c),r=!0)}}return s().map(a=>n[a])}function fv(n,e,t,i,s){const r=t-e+1;if(r<2)return 0;const a=s?e:t,o=s?e+1:t-1,h=s?e+2:t-2,l=Math.abs(n[o].frame-n[a].frame);if(r>=3&&l>0&&Math.abs(Math.abs(n[h].frame-n[o].frame)-l)<1e-6){const u=n[a].values[i],d=n[o].values[i],f=n[h].values[i];return s?(-3*u+4*d-f)/(2*l):(3*u-4*d+f)/(2*l)}const c=n[o].frame-n[a].frame;return c?(n[o].values[i]-n[a].values[i])/c:0}function mv(n,e,t){const i=n[t].frame-n[e].frame,s=[];for(let r=0;r<n[e].values.length;r++){const a=n[e].values[r],o=n[t].values[r],h=Math.min(...n.slice(e,t+1).map(d=>d.values[r])),l=Math.max(...n.slice(e,t+1).map(d=>d.values[r])),c=a+fv(n,e,t,r,!0)*i/3,u=o-fv(n,e,t,r,!1)*i/3;s.push([Math.max(h,Math.min(l,c)),Math.max(h,Math.min(l,u))])}return{values:s}}function TF(n,e,t,i,s){const r=1-s;return r*r*r*n+3*r*r*s*e+3*r*s*s*t+s*s*s*i}function MF(n,e,t,i,s){const r=t.frame-e.frame,a=r<=0?0:(n.frame-e.frame)/r;let o=0;for(let h=0;h<n.values.length;h++){const l=i.values[h],c=TF(e.values[h],l[0],l[1],t.values[h],a);o=Math.max(o,Math.abs(n.values[h]-c)/Math.max(1e-9,s[h]??s[0]??.001))}return o}function Xb(n,e,t=new Set){if(n.length<=1)return{samples:n.slice(),controls:[]};const i=new Set([0,n.length-1]);for(let o=1;o<n.length-1;o++)t.has(n[o].frame)&&i.add(o);const s=()=>[...i].sort((o,h)=>o-h);let r=!0;for(;r;){r=!1;const o=s();for(let h=0;h<o.length-1;h++){const l=o[h],c=o[h+1];if(c-l<=1)continue;const u=mv(n,l,c);let d=-1,f=1;for(let p=l+1;p<c;p++){const m=MF(n[p],n[l],n[c],u,e);m>f&&(f=m,d=p)}d>=0&&(i.add(d),r=!0)}}const a=s();return{samples:a.map(o=>n[o]),controls:a.slice(0,-1).map((o,h)=>mv(n,o,a[h+1]))}}function EF(n){if(!n.length)return[];const e=[n[0]];for(let t=1;t<n.length;t++){let i=n[t];for(;i-e[t-1]>180;)i-=360;for(;i-e[t-1]<-180;)i+=360;e.push(i)}return e}function di(n){if(!Number.isFinite(n))return 0;const e=Math.round(n*1e5)/1e5;return Object.is(e,-0)?0:e}function AF(n,e,t,i){const s=Math.max(2,Math.min(16,Math.round(Number(n.trailGridRows)||2))),r=Math.max(2,Math.min(32,Math.round(Number(n.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 v=0;v<r;v++)g.push({col:v,row:0});for(let v=1;v<s;v++)g.push({col:r-1,row:v});for(let v=r-2;v>=0;v--)g.push({col:v,row:s-1});for(let v=s-2;v>=1;v--)g.push({col:0,row:v});const y=g.length;for(let v=1;v<r-1;v++)for(let _=1;_<s-1;_++)g.push({col:v,row:_});const w=new Map;for(let v=0;v<g.length;v++){const{col:_,row:x}=g[v];w.set(`${_}:${x}`,v);const M=_/(r-1),T=M*(a-1),C=Math.min(a-1,Math.floor(T)),I=Math.min(a-1,C+1),k=T-C,R=x/(s-1),F=.5+c*(M-.5)-u*(R-.5),B=.5+u*(M-.5)+c*(R-.5);d.push(di(F),di(B));const L=(.5-R)*h;C===I||k<1e-6?p.push(1,t[C],0,di(L),1):p.push(2,t[C],0,di(L),di(1-k),t[I],0,di(L),di(k))}for(let v=0;v<r-1;v++)for(let _=0;_<s-1;_++){const x=w.get(`${v}:${_}`),M=w.get(`${v+1}:${_}`),T=w.get(`${v}:${_+1}`),C=w.get(`${v+1}:${_+1}`);f.push(x,M,T,M,C,T)}for(let v=0;v<y;v++)m.push(v*2,(v+1)%y*2);return{type:"mesh",path:i,uvs:d,triangles:f,vertices:p,hull:y,edges:m,width:o,height:h}}const pv={normal:"normal",add:"additive",multiply:"multiply",screen:"screen"},gv=.1,vv=.1,yv=.01,pc=.01;function CF(n,e){return String(n||"").trim().replace(/[\\/:*?"<>|\s]+/g,"_").replace(/^_+|_+$/g,"")||e}function Yb(n,e){let t=n,i=2;for(;e.has(t);)t=`${n}_${i++}`;return e.add(t),t}function IF(n){return n.replace(/\.[^./\\]+$/,"")}function Vb(n,e){return IF([n,e].filter(Boolean).join("/").replace(/\\/g,"/").replace(/\/{2,}/g,"/").replace(/^\.\//,""))}function RF(n){var i,s;const e=Number(((i=n==null?void 0:n.orig)==null?void 0:i.width)??(n==null?void 0:n.width))||0,t=Number(((s=n==null?void 0:n.orig)==null?void 0:s.height)??(n==null?void 0:n.height))||0;return{width:e,height:t}}function gc(n){return Math.round(Math.max(0,Math.min(1,n))*255).toString(16).padStart(2,"0")}function xv(n,e){return[(n>>16&255)/255,(n>>8&255)/255,(n&255)/255,Math.max(0,Math.min(1,e))]}function il(n,e){return di(n/e)}function PF(n,e){const t=n.config,i=t.lifeMode==="fixed"?Math.max(0,Number(t.lifeMin)||0):Math.max(0,Number(t.lifeMin)||0,Number(t.lifeMax)||0),s=Math.max(0,Number(t.delay)||0);let r;return t.mode!=="stream"?r=s+i:t.streamBehavior!=="loop"?r=s+Math.max(1/e,Number(t.duration)||0)+i:r=s+Mr(t,e).total/e,Math.max(1,Math.ceil(r*e)+1)}function vh(n,e){return e?n.boneName:`${n.spawnId??"legacy"}_${n.boneName}`}function kF(n,e,t){const i=new Set;for(const s of n)for(const r of s)i.add(vh(r,e));return[...i].sort().map((s,r)=>({key:s,name:Yb(`_particle_${String(r).padStart(3,"0")}`,t),states:n.map(a=>a.find(o=>vh(o,e)===s)||null)}))}function FF(n,e,t,i){const s=e*t/i,r=Math.min(n.states.length-1,Math.max(0,Math.floor(s))),a=Math.min(n.states.length-1,r+1),o=n.states[r],h=n.states[a];if(!o||!h||vh(o,!0)!==vh(h,!0)||o.spawnId!==h.spawnId)return o;const l=s-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 bv(n,e){return!n||n==="跟随导出"?e.keyframeCurve:n==="贝塞尔"?"bezier":"linear"}function Oa(n,e,t,i,s,r=new Set,a=s.keyframeCurve){if(!n.length)return[];const o=a==="bezier"&&s.spineVersion!=="3.8"?Xb(n,i,r):{samples:Ub(n,i,r),controls:[]},h=o.samples.map(l=>{const c={time:il(l.frame,e)};return t.forEach((u,d)=>{c[u]=di(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(di(c+(u-c)/3),di(p[0]),di(c+(u-c)*2/3),di(p[1]))}h[l].curve=d}return h}function OF(n){const e=new Set;for(let t=0;t<n.length;t++){const i=n[t],s=t?n[t-1]:null,r=!!i&&!!s&&i.spawnId!==s.spawnId;(!!i!=!!s||r)&&(t>0&&s&&e.add(t-1),i&&e.add(t))}return e}function BF(n){const e=new Set;for(let t=0;t<n.length;t++){const i=n[t],s=t?n[t-1]:void 0;!!i!=!!s&&(t>0&&s&&e.add(t-1),i&&e.add(t))}return e}function LF(n,e){var i;if(!n.shapeEnabled||!((i=n.shapeCurve)!=null&&i.length))return 1;const t=[...n.shapeCurve].sort((s,r)=>s.x-r.x);if(e<=t[0].x)return Math.max(0,t[0].y);for(let s=1;s<t.length;s++){const r=t[s-1],a=t[s];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 DF(n,e,t){const i=[];let s=Symbol();return n.forEach((r,a)=>{r!==s&&(i.push(t(r,a)),s=r)}),i}function NF(n,e,t){const i=n.imageMode==="sequence"?n.sequenceFrames[e]:void 0,s=(i==null?void 0:i.name)||n.textureName||`image_${n.id}`,r=(i==null?void 0:i.texture)||n.texture,a=RF(r);(!a.width||!a.height)&&t.push({code:"missing-image",message:`图片“${s}”缺失或尺寸不可读,已保留路径。`});const o=a.width||1,h=a.height||1;return{path:Vb(n.textureFolder,s),x:di((.5-n.anchorX)*o),y:di((n.anchorY-.5)*h),width:di(o),height:di(h)}}function UF(n,e,t,i,s=i.keyframeCurve){if(!n.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=n.map((c,u)=>({frame:u,values:c})),o=1/255,h=s==="bezier"&&i.spineVersion!=="3.8"?Xb(a,[o,o,o,.01],r):{samples:Ub(a,[o,o,o,.01],r),controls:[]},l=h.samples.map(c=>({time:il(c.frame,t),color:`${gc(c.values[0])}${gc(c.values[1])}${gc(c.values[2])}${gc(c.values[3])}`}));if(h.controls.length)for(let c=0;c<h.controls.length;c++){const u=il(h.samples[c].frame,t),d=il(h.samples[c+1].frame,t),f=[];for(let p=0;p<4;p++){const m=h.controls[c].values[p];f.push(di(u+(d-u)/3),di(m[0]),di(u+(d-u)*2/3),di(m[1]))}l[c].curve=f}return l}function wv(n,e,t,i,s,r,a=r.keyframeCurve){var c;const o=(c=n.slots)[e]||(c[e]={}),h=DF(t,s,(u,d)=>({time:il(d,s),name:u??null}));h.length&&(o.attachment=h);const l=UF(i,t,s,r,a);l.length&&(o.rgba=l)}function XF(n){var p;const e=n.settings,t=Math.max(1,Number(n.timeline.fps)||30),i=Math.max(1,Math.round(e.fps||30)),s=e.integerFrameAlignment?i:t,r=[],a=n.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([...n.timeline.animations.length?n.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,PF(m,t)),y=(m.frames||[]).slice(0,g);y.length||r.push({code:"empty-cache",message:`“${m.config.name}”没有可用帧缓存。`});const w=Yb(CF(m.config.name,`system_${m.id}`),l);o.bones.push({name:w,parent:"root"});const v=kF(y,e.bonePool,l),_=Math.max(0,(g-1)/t),x=Math.max(1,Math.ceil(_*s)+1),M=u.get(m.animation)||[];M.push({system:m,tracks:v,targetFrames:x}),u.set(m.animation,M);for(const T of v){o.bones.push({name:T.name,parent:w});const C=new Set(m.config.imageResources.map(F=>F.blend));for(const F of C){const B=`${T.name}_image_${F}`;o.slots.push({name:B,bone:T.name,color:"ffffff00",blend:pv[F]});const L=h[B]||(h[B]={});for(const Y of m.config.imageResources.filter(O=>O.blend===F)){const O=Y.imageMode==="sequence"?Math.max(1,Y.sequenceFrames.length):1;for(let D=0;D<O;D++)L[`image_${Y.id}_${D}`]=NF(Y,D,r)}}if(m.config.trail)for(const F of m.config.trailResources){if(!T.states.some(P=>{var U;return((U=P==null?void 0:P.trailState)==null?void 0:U.resourceId)===F.id}))continue;const B=Math.max(2,Math.min(16,Math.round(F.boneCount||3))),L=[];for(let P=0;P<B;P++){const U=`${T.name}_trail_${F.id}_${P}`;L.push(U),o.bones.push({name:U,parent:w})}const Y=`${T.name}_trail_${F.id}`;o.slots.push({name:Y,bone:L[0],color:"ffffff00",blend:pv[F.blend]});const O=L.map(P=>o.bones.findIndex(U=>U.name===P)),D=Vb("",F.textureName||`trail_${F.id}`);(h[Y]||(h[Y]={}))[`trail_${F.id}`]=AF(m.config,F,O,D),F.texture||r.push({code:"missing-image",message:`拖尾图片“${F.textureName||F.id}”缺失,已保留路径。`})}const I=`${T.name}_image_`,k=`${T.name}_trail_`,R=o.slots.filter(F=>String(F.name).startsWith(I)||String(F.name).startsWith(k));R.length&&(o.slots=o.slots.filter(F=>!R.includes(F)),o.slots.push(...R.filter(F=>String(F.name).startsWith(k)),...R.filter(F=>String(F.name).startsWith(I))))}}for(const m of c){const g=u.get(m)||[],y={bones:{},slots:{}};let w=!1;for(const{system:v,tracks:_,targetFrames:x}of g)for(const M of _){const T=Array.from({length:x},(N,X)=>FF(M,X,t,s)),C=T.map(N=>!!(N!=null&&N.active)),I=[],k=[],R=[];T.forEach((N,X)=>{N!=null&&N.active&&(I.push({frame:X,values:[N.worldX??N.x,N.worldY??N.y]}),k.push(N.worldRotation??N.rotation),R.push({frame:X,values:[N.worldScaleX??N.scaleX,N.worldScaleY??N.scaleY]}))});const F=EF(k),B=I.map((N,X)=>({frame:N.frame,values:[F[X]??0]})),L=OF(T),Y={},O=Oa(I,s,["x","y"],[gv,gv],e,L),D=Oa(B,s,["value"],[yv],e,L),P=Oa(R,s,["x","y"],[pc,pc],e,L);O.length&&(Y.translate=O),D.length&&(Y.rotate=D),P.length&&(Y.scale=P),Object.keys(Y).length&&(y.bones[M.name]=Y,w=!0);const U=new Set(v.config.imageResources.map(N=>N.blend));for(const N of U){const X=[],K=[];let z=16777215;for(let pe=0;pe<x;pe++){const Me=T[pe],Ie=Me?v.config.imageResources.find(Ee=>Ee.id===Me.resourceId):void 0,ge=!!Me&&C[pe]&&Me.imageVisible!==!1&&(Ie==null?void 0:Ie.blend)===N;Me&&(Ie==null?void 0:Ie.blend)===N&&(z=Me.colorHex),X.push(ge?`image_${Ie.id}_${Me.imageFrameIndex??0}`:null),K.push(xv(z,ge?Me.alpha:0))}const Q=v.config.imageResources.filter(pe=>pe.blend===N).filter(pe=>pe.independentAlpha==="curve").map(pe=>bv(pe.alphaCurveMode,e)),me=Q.length?Q.includes("bezier")?"bezier":"linear":bv(v.config.alphaMode==="curve"?v.config.curveMode:void 0,e);wv(y,`${M.name}_image_${N}`,X,K,s,e,me),X.some(Boolean)&&(w=!0)}if(v.config.trail)for(const N of v.config.trailResources){const X=Math.max(2,Math.min(16,Math.round(N.boneCount||3))),K=T.map(Ee=>{var H;return((H=Ee==null?void 0:Ee.trailState)==null?void 0:H.resourceId)===N.id?Ee.trailState:void 0}),z=K.find(Ee=>!!Ee);if(!z)continue;const se=BF(K),Q=N.widthSizeMode==="random"?Math.max(1,Number(N.widthMin)||0,Number(N.widthMax)||0):Math.max(.001,Number(N.width)||100);let me=z;const pe=K.map(Ee=>(Ee&&(me=Ee),me));for(let Ee=0;Ee<X;Ee++){const H=[],Z=[],q=[],W=new Set(se),ee=LF(N,Ee/Math.max(1,X-1));pe.forEach((ke,Re)=>{const Fe=ke==null?void 0:ke.bones[Math.min(ke.bones.length-1,Ee)];if(!Fe)return;const Ze={x:Fe.worldX??Fe.x,y:Fe.worldY??Fe.y,rotation:Fe.worldRotation??-Fe.rotation};H.push({frame:Re,values:[Ze.x,Ze.y]}),Z.push({frame:Re,values:[Ze.rotation]}),q.push({frame:Re,values:[1,Math.max(0,ke.width/Q)*ee]})});const ce=`${M.name}_trail_${N.id}_${Ee}`,xe={},oe=Oa(H,s,["x","y"],[vv,vv],e,W),Se=Oa(Z,s,["value"],[yv],e,W),ue=Oa(q,s,["x","y"],[pc,pc],e,W);oe.length&&(xe.translate=oe),Se.length&&(xe.rotate=Se),ue.length&&(xe.scale=ue),Object.keys(xe).length&&(y.bones[ce]=xe)}const Me=K.map(()=>`trail_${N.id}`);let Ie=z.colorHex;const ge=K.map(Ee=>(Ee&&(Ie=Ee.colorHex),xv(Ie,Ee?Ee.alpha:0)));wv(y,`${M.name}_trail_${N.id}`,Me,ge,s,e),w=!0}}(w||!e.excludeEmptyAnimations)&&(o.animations[m]=y)}!Object.keys(o.animations).length&&!e.excludeEmptyAnimations&&(o.animations.animation={bones:{},slots:{}});const d=e.spineVersion==="3.8"?SF(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 YF(n,e){const t=new Blob([n.text],{type:"application/json;charset=utf-8"}),i=URL.createObjectURL(t),s=document.createElement("a");s.href=i,s.download=/\.json$/i.test(e)?e:`${e||"SpineParticle"}.json`,s.style.display="none",document.body.appendChild(s),s.click(),s.remove(),setTimeout(()=>URL.revokeObjectURL(i),1e3)}class A4{constructor(){b(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 VF{constructor(){b(this,"entries",{});b(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,s=e.length;i<s;i++)this.add(e[i]);return t!==this.size}contains(e){return this.entries[e]}clear(){this.entries={},this.size=0}}const os=class os{constructor(e=0,t=0,i=0,s=0){b(this,"r");b(this,"g");b(this,"b");b(this,"a");this.r=e,this.g=t,this.b=i,this.a=s}set(e,t,i,s){return this.r=e,this.g=t,this.b=i,this.a=s,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,s){return this.r+=e,this.g+=t,this.b+=i,this.a+=s,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 os){return t.setFromString(e)}};b(os,"WHITE",new os(1,1,1,1)),b(os,"RED",new os(1,0,0,1)),b(os,"GREEN",new os(0,1,0,1)),b(os,"BLUE",new os(0,0,1,1)),b(os,"MAGENTA",new os(1,0,1,1));let ct=os;const ti=class ti{static clamp(e,t,i){return e<t?t:e>i?i:e}static cosDeg(e){return Math.cos(e*ti.degRad)}static sinDeg(e){return Math.sin(e*ti.degRad)}static atan2Deg(e,t){return Math.atan2(e,t)*ti.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 ti.randomTriangularWith(e,t,(e+t)*.5)}static randomTriangularWith(e,t,i){const s=Math.random(),r=t-e;return s<=(i-e)/r?e+Math.sqrt(s*r*(i-e)):t-Math.sqrt((1-s)*r*(t-i))}static isPowerOfTwo(e){return e&&(e&e-1)===0}};b(ti,"epsilon",1e-5),b(ti,"epsilon2",ti.epsilon*ti.epsilon),b(ti,"PI",3.1415927),b(ti,"PI2",ti.PI*2),b(ti,"invPI2",1/ti.PI2),b(ti,"radiansToDegrees",180/ti.PI),b(ti,"radDeg",ti.radiansToDegrees),b(ti,"degreesToRadians",ti.PI/180),b(ti,"degRad",ti.degreesToRadians);let De=ti;const ps=class ps{apply(e,t,i){return t===void 0||i===void 0?this.applyInternal(e):e+(t-e)*this.applyInternal(i)}};b(ps,"linear",new class extends ps{applyInternal(e){return e}}),b(ps,"smooth",new class extends ps{applyInternal(e){return e*e*(3-2*e)}}),b(ps,"slowFast",new class extends ps{applyInternal(e){return e*e}}),b(ps,"fastSlow",new class extends ps{applyInternal(e){return(e-1)*(e-1)*-1+1}}),b(ps,"circle",new class extends ps{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 ro=ps;class $F extends ro{constructor(t){super();b(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 C4 extends $F{constructor(e){super(e)}applyInternal(e){return Math.pow(e-1,this.power)*(this.power%2===0?-1:1)+1}}const vr=class vr{static arrayCopy(e,t,i,s,r){for(let a=t,o=s;a<t+r;a++,o++)i[o]=e[a]}static arrayFill(e,t,i,s){for(let r=t;r<i;r++)e[r]=s}static setArraySize(e,t,i=0){const s=e.length;if(s===t)return e;if(e.length=t,s<t)for(let r=s;r<t;r++)e[r]=i;return e}static ensureArrayCapacity(e,t,i=0){return e.length>=t?e:vr.setArraySize(e,t,i)}static newArray(e,t){const i=[];for(let s=0;s<e;s++)i[s]=t;return i}static newFloatArray(e){if(vr.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(vr.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 vr.SUPPORTS_TYPED_ARRAYS?new Float32Array(e):e}static toSinglePrecision(e){return vr.SUPPORTS_TYPED_ARRAYS?Math.fround(e):e}static webkit602BugfixHelper(e){}static contains(e,t,i=!0){for(let s=0;s<e.length;s++)if(e[s]===t)return!0;return!1}static enumValue(e,t){return e[t[0].toUpperCase()+t.slice(1)]}};b(vr,"SUPPORTS_TYPED_ARRAYS",typeof Float32Array<"u");let et=vr;class I4{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 GF{constructor(e){b(this,"items",[]);b(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 Sv{constructor(e=0,t=0){b(this,"x");b(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 R4{constructor(){b(this,"maxDelta",.064);b(this,"framesPerSecond",0);b(this,"delta",0);b(this,"totalTime",0);b(this,"lastTime",Date.now()/1e3);b(this,"frameCount",0);b(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 P4{constructor(e=32){b(this,"values");b(this,"addedValues",0);b(this,"lastValue",0);b(this,"mean",0);b(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 HF{constructor(e){b(this,"_image");this._image=e}getImage(){return this._image}}var ho;(function(n){n[n.Nearest=9728]="Nearest",n[n.Linear=9729]="Linear",n[n.MipMap=9987]="MipMap",n[n.MipMapNearestNearest=9984]="MipMapNearestNearest",n[n.MipMapLinearNearest=9985]="MipMapLinearNearest",n[n.MipMapNearestLinear=9986]="MipMapNearestLinear",n[n.MipMapLinearLinear=9987]="MipMapLinearLinear"})(ho||(ho={}));var uo;(function(n){n[n.MirroredRepeat=33648]="MirroredRepeat",n[n.ClampToEdge=33071]="ClampToEdge",n[n.Repeat=10497]="Repeat"})(uo||(uo={}));class $b{constructor(){b(this,"texture");b(this,"u",0);b(this,"v",0);b(this,"u2",0);b(this,"v2",0);b(this,"width",0);b(this,"height",0);b(this,"degrees",0);b(this,"offsetX",0);b(this,"offsetY",0);b(this,"originalWidth",0);b(this,"originalHeight",0)}}class k4 extends HF{setFilters(e,t){}setWraps(e,t){}dispose(){}}class F4{constructor(e){b(this,"pages",[]);b(this,"regions",[]);const t=new jF(e),i=new Array(4),s={};s.size=c=>{c.width=parseInt(i[1]),c.height=parseInt(i[2])},s.format=()=>{},s.filter=c=>{c.minFilter=et.enumValue(ho,i[1]),c.magFilter=et.enumValue(ho,i[2])},s.repeat=c=>{i[1].indexOf("x")!==-1&&(c.uWrap=uo.Repeat),i[1].indexOf("y")!==-1&&(c.vWrap=uo.Repeat)},s.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 Gb(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 WF(a.trim());t.readEntry(i,a=t.readLine())!==0;){const c=s[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 jF{constructor(e){b(this,"lines");b(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 s=1,r=i+1;;s++){const a=t.indexOf(",",r);if(a===-1)return e[s]=t.substr(r).trim(),s;if(e[s]=t.substr(r,a-r).trim(),r=a+1,s===4)return 4}}}class WF{constructor(e){b(this,"name");b(this,"minFilter",ho.Nearest);b(this,"magFilter",ho.Nearest);b(this,"uWrap",uo.ClampToEdge);b(this,"vWrap",uo.ClampToEdge);b(this,"texture",null);b(this,"width",0);b(this,"height",0);b(this,"pma",!1);b(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 Gb extends $b{constructor(t,i){super();b(this,"page");b(this,"name");b(this,"x",0);b(this,"y",0);b(this,"offsetX",0);b(this,"offsetY",0);b(this,"originalWidth",0);b(this,"originalHeight",0);b(this,"index",0);b(this,"degrees",0);b(this,"names",null);b(this,"values",null);this.page=t,this.name=i,t.regions.push(this)}}const _h=class _h{constructor(e){b(this,"name");b(this,"timelineAttachment");b(this,"timelineSlots",_h.empty);if(!e)throw new Error("name cannot be null.");this.name=e,this.timelineAttachment=this}isTimelineActive(e,t,i){let s=e[t];if(s.bone.isActive()){const r=(i?s.getAppliedPose():s.getPose()).getAttachment();if(r!=null&&r.timelineAttachment===this)return!0}for(let r=0,a=this.timelineSlots.length;r<a;r++){if(s=e[this.timelineSlots[r]],!s.bone.isActive())continue;const o=(i?s.getAppliedPose():s.getPose()).getAttachment();if(o!=null&&o.timelineAttachment===this)return!0}return!1}};b(_h,"empty",[]);let yh=_h;const Th=class Th extends yh{constructor(t){super(t);b(this,"id",Th.nextID++);b(this,"bones",null);b(this,"vertices",[]);b(this,"worldVerticesLength",0)}computeWorldVertices(t,i,s,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,y=m.worldY,w=m.a,v=m.b,_=m.c,x=m.d;for(let M=s,T=o;T<r;M+=2,T+=h){const C=c[M],I=c[M+1];a[T]=C*w+I*v+g,a[T+1]=C*_+I*x+y}return}let d=0,f=0;for(let m=0;m<s;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 y=0,w=0,v=u[d++];for(v+=d;d<v;d++,g+=3){const _=p[u[d]].appliedPose,x=c[g],M=c[g+1],T=c[g+2];y+=(x*_.a+M*_.b+_.worldX)*T,w+=(x*_.c+M*_.d+_.worldY)*T}a[m]=y,a[m+1]=w}else{const m=l;for(let g=o,y=f*3,w=f<<1;g<r;g+=h){let v=0,_=0,x=u[d++];for(x+=d;d<x;d++,y+=3,w+=2){const M=p[u[d]].appliedPose,T=c[y]+m[w],C=c[y+1]+m[w+1],I=c[y+2];v+=(T*M.a+C*M.b+M.worldX)*I,_+=(T*M.c+C*M.d+M.worldY)*I}a[g]=v,a[g+1]=_}}}copyTo(t){this.bones?(t.bones=[],et.arrayCopy(this.bones,0,t.bones,0,this.bones.length)):t.bones=null,this.vertices&&(t.vertices=et.newFloatArray(this.vertices.length),et.arrayCopy(this.vertices,0,t.vertices,0,this.vertices.length)),t.worldVerticesLength=this.worldVerticesLength,t.timelineAttachment=this.timelineAttachment,t.timelineSlots=this.timelineSlots}};b(Th,"nextID",0);let ir=Th;class Pr extends ir{constructor(t,i){super(t);b(this,"sequence");b(this,"regionUVs",[]);b(this,"triangles",[]);b(this,"hullLength",0);b(this,"path");b(this,"color",new ct(1,1,1,1));b(this,"sourceMesh",null);b(this,"edges",[]);b(this,"width",0);b(this,"height",0);b(this,"tempColor",new ct(0,0,0,0));this.sequence=i}copy(){if(this.sourceMesh)return this.newLinkedMesh();const t=new Pr(this.name,this.sequence.copy());return t.path=this.path,t.color.setFromColor(this.color),this.copyTo(t),t.regionUVs=[],et.arrayCopy(this.regionUVs,0,t.regionUVs,0,this.regionUVs.length),t.triangles=[],et.arrayCopy(this.triangles,0,t.triangles,0,this.triangles.length),t.hullLength=this.hullLength,this.edges&&(t.edges=[],et.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 Pr(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,s){if(!t)throw new Error("Region not set.");const r=s.length;let a=t.u,o=t.v,h=0,l=0;if(t instanceof Gb){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)s[f]=a+i[f+1]*h,s[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)s[f]=a+(1-i[f])*h,s[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)s[f]=a+(1-i[f+1])*h,s[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)s[c]=a+i[c]*h,s[c+1]=o+i[c+1]*l}}const It=class It extends yh{constructor(t,i){super(t);b(this,"sequence");b(this,"x",0);b(this,"y",0);b(this,"scaleX",1);b(this,"scaleY",1);b(this,"rotation",0);b(this,"width",0);b(this,"height",0);b(this,"path");b(this,"color",new ct(1,1,1,1));b(this,"tempColor",new ct(1,1,1,1));this.sequence=i}copy(){const t=new It(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,s,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];s[r]=p*c+m*u+h,s[r+1]=p*d+m*f+l,r+=a,p=i[2],m=i[3],s[r]=p*c+m*u+h,s[r+1]=p*d+m*f+l,r+=a,p=i[4],m=i[5],s[r]=p*c+m*u+h,s[r+1]=p*d+m*f+l,r+=a,p=i[6],m=i[7],s[r]=p*c+m*u+h,s[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,s,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,y=m+t.height*f,w=o*De.degRad,v=Math.cos(w),_=Math.sin(w),x=p*v+i,M=p*_,T=m*v+s,C=m*_,I=g*v+i,k=g*_,R=y*v+s,F=y*_;c[0]=x-C,c[1]=T+M,c[2]=x-F,c[3]=R+M,c[4]=I-F,c[5]=R+k,c[6]=I-C,c[7]=T+k,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))}};b(It,"X1",0),b(It,"Y1",1),b(It,"C1R",2),b(It,"C1G",3),b(It,"C1B",4),b(It,"C1A",5),b(It,"U1",6),b(It,"V1",7),b(It,"X2",8),b(It,"Y2",9),b(It,"C2R",10),b(It,"C2G",11),b(It,"C2B",12),b(It,"C2A",13),b(It,"U2",14),b(It,"V2",15),b(It,"X3",16),b(It,"Y3",17),b(It,"C3R",18),b(It,"C3G",19),b(It,"C3B",20),b(It,"C3A",21),b(It,"U3",22),b(It,"V3",23),b(It,"X4",24),b(It,"Y4",25),b(It,"C4R",26),b(It,"C4G",27),b(It,"C4B",28),b(It,"C4A",29),b(It,"U4",30),b(It,"V4",31);let fo=It;const Ha=class Ha{constructor(e,t){b(this,"id",Ha.nextID());b(this,"regions");b(this,"pathSuffix");b(this,"uvs");b(this,"offsets");b(this,"start",0);b(this,"digits",0);b(this,"setupIndex",0);this.regions=new Array(e),this.pathSuffix=t}copy(){const e=this.regions.length,t=new Ha(e,this.pathSuffix);if(et.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 s=0;s<e;s++)t.uvs[s]=et.newFloatArray(i),et.arrayCopy(this.uvs[s],0,t.uvs[s],0,i)}if(this.offsets!=null){t.offsets=[];for(let i=0;i<e;i++)t.offsets[i]=[],et.arrayCopy(this.offsets[i],0,t.offsets[i],0,8)}return t}update(e){const t=this.regions.length;if(e instanceof fo){this.uvs=[],this.offsets=[];for(let i=0;i<t;i++)this.uvs[i]=et.newFloatArray(8),this.offsets[i]=[],fo.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 Pr){const i=e.regionUVs;this.uvs=[],this.offsets=void 0;for(let s=0;s<t;s++)this.uvs[s]=et.newFloatArray(i.length),Pr.computeUVs(this.regions[s],i,this.uvs[s])}}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 s=(this.start+t).toString();for(let r=this.digits-s.length;r>0;r--)i+="0";return i+=s,i}static nextID(){return Ha._nextID++}};b(Ha,"_nextID",0);let mo=Ha;var Pi;(function(n){n[n.hold=0]="hold",n[n.once=1]="once",n[n.loop=2]="loop",n[n.pingpong=3]="pingpong",n[n.onceReverse=4]="onceReverse",n[n.loopReverse=5]="loopReverse",n[n.pingpongReverse=6]="pingpongReverse"})(Pi||(Pi={}));const Hb=[Pi.hold,Pi.once,Pi.loop,Pi.pingpong,Pi.onceReverse,Pi.loopReverse,Pi.pingpongReverse];class np{constructor(e,t,i){b(this,"name");b(this,"timelines",[]);b(this,"timelineIds");b(this,"bones");b(this,"color",new ct(1,1,1,1));b(this,"duration");if(!e)throw new Error("name cannot be null.");this.name=e,this.duration=i,this.timelineIds=new VF,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,s=e;for(let r=0;r<t;r++){const a=s[r];this.timelineIds.addAll(a.propertyIds),qF(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,s,r,a,o,h,l,c){if(!e)throw new Error("skeleton cannot be null.");s&&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 Ke;(function(n){n[n.current=0]="current",n[n.setup=1]="setup",n[n.first=2]="first"})(Ke||(Ke={}));var lt;(function(n){n[n.rotate=0]="rotate",n[n.x=1]="x",n[n.y=2]="y",n[n.scaleX=3]="scaleX",n[n.scaleY=4]="scaleY",n[n.shearX=5]="shearX",n[n.shearY=6]="shearY",n[n.inherit=7]="inherit",n[n.rgb=8]="rgb",n[n.alpha=9]="alpha",n[n.rgb2=10]="rgb2",n[n.attachment=11]="attachment",n[n.deform=12]="deform",n[n.event=13]="event",n[n.drawOrder=14]="drawOrder",n[n.drawOrderFolder=15]="drawOrderFolder",n[n.ikConstraint=16]="ikConstraint",n[n.transformConstraint=17]="transformConstraint",n[n.pathConstraintPosition=18]="pathConstraintPosition",n[n.pathConstraintSpacing=19]="pathConstraintSpacing",n[n.pathConstraintMix=20]="pathConstraintMix",n[n.physicsConstraintInertia=21]="physicsConstraintInertia",n[n.physicsConstraintStrength=22]="physicsConstraintStrength",n[n.physicsConstraintDamping=23]="physicsConstraintDamping",n[n.physicsConstraintMass=24]="physicsConstraintMass",n[n.physicsConstraintWind=25]="physicsConstraintWind",n[n.physicsConstraintGravity=26]="physicsConstraintGravity",n[n.physicsConstraintMix=27]="physicsConstraintMix",n[n.physicsConstraintReset=28]="physicsConstraintReset",n[n.sequence=29]="sequence",n[n.sliderTime=30]="sliderTime",n[n.sliderMix=31]="sliderMix"})(lt||(lt={}));let Ht=class{constructor(e,...t){b(this,"propertyIds");b(this,"frames");b(this,"additive",!1);b(this,"instant",!1);this.propertyIds=t,this.frames=et.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 s=e.length;for(let r=i;r<s;r+=i)if(e[r]>t)return r-i;return s-i}};function zF(n){return typeof n=="object"&&n!==null&&typeof n.slotIndex=="number"}class ba extends Ht{constructor(t,i,...s){super(t,...s);b(this,"curves");this.curves=et.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 s=et.newFloatArray(i);et.arrayCopy(this.curves,0,s,0,i),this.curves=s}}setBezier(t,i,s,r,a,o,h,l,c,u,d){const f=this.curves;let p=this.getFrameCount()+t*18;s===0&&(f[i]=2+p);const m=(r-o*2+l)*.03,g=(a-h*2+c)*.03,y=((o-l)*3-r+u)*.006,w=((h-c)*3-a+d)*.006;let v=m*2+y,_=g*2+w,x=(o-r)*.3+m+y*.16666667,M=(h-a)*.3+g+w*.16666667,T=r+x,C=a+M;for(let I=p+18;p<I;p+=2)f[p]=T,f[p+1]=C,x+=v,M+=_,v+=y,_+=w,T+=x,C+=M}getBezierValue(t,i,s,r){const a=this.curves;if(a[r]>t){const c=this.frames[i],u=this.frames[i+s];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+s]-l)}}class Gn extends ba{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 s=this.curves[i>>1];switch(s){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,s-2)}getRelativeValue(e,t,i,s,r,a){if(e<this.frames[0])return Gn.beforeFirstKey(i,t,r,a);const o=this.getCurveValue(e);return i===Ke.setup?a+o*t:r+(s?o:o+a-r)*t}getAbsoluteValue(e,t,i,s,r,a,o){return o===void 0?this.getAbsoluteValue1(e,t,i,s,r,a):this.getAbsoluteValue2(e,t,i,s,r,a,o)}getAbsoluteValue1(e,t,i,s,r,a){if(e<this.frames[0])return Gn.beforeFirstKey(i,t,r,a);const o=this.getCurveValue(e);return i===Ke.setup?a+(s?o:o-a)*t:r+(s?o:o-r)*t}getAbsoluteValue2(e,t,i,s,r,a,o){return e<this.frames[0]?Gn.beforeFirstKey(i,t,r,a):i===Ke.setup?a+(s?o:o-a)*t:r+(s?o:o-r)*t}getScaleValue(e,t,i,s,r,a,o){if(e<this.frames[0])return Gn.beforeFirstKey(i,t,a,o);const h=this.getCurveValue(e)*o;if(t===1&&!s)return h;let l=i===Ke.setup?o:a;return s?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,s){switch(e){case Ke.setup:return s;case Ke.first:return i+(s-i)*t;case Ke.current:return i}}}function qF(n){return typeof n=="object"&&n!==null&&typeof n.boneIndex=="number"}class wa extends Gn{constructor(t,i,s,r){super(t,i,`${r}|${s}`);b(this,"boneIndex");this.boneIndex=s,this.additive=!0}apply(t,i,s,r,a,o,h,l,c){const u=t.bones[this.boneIndex];u.active&&this.apply1(c?u.appliedPose:u.pose,u.data.setupPose,s,a,o,h,l)}}class rp extends ba{constructor(t,i,s,r,a){super(t,i,`${r}|${s}`,`${a}|${s}`);b(this,"boneIndex");this.boneIndex=s,this.additive=!0}getFrameEntries(){return 3}setFrame(t,i,s,r){t*=3,this.frames[t]=i,this.frames[t+1]=s,this.frames[t+2]=r}apply(t,i,s,r,a,o,h,l,c){const u=t.bones[this.boneIndex];u.active&&this.apply1(c?u.appliedPose:u.pose,u.data.setupPose,s,a,o,h,l)}}class xh extends wa{constructor(e,t,i){super(e,t,i,lt.rotate)}apply1(e,t,i,s,r,a,o){e.rotation=this.getRelativeValue(i,s,r,a,e.rotation,t.rotation)}}class jb extends rp{constructor(e,t,i){super(e,t,i,lt.x,lt.y)}apply1(e,t,i,s,r,a,o){const h=this.frames;if(i<h[0]){switch(r){case Ke.setup:e.x=t.x,e.y=t.y;break;case Ke.first:e.x+=(t.x-e.x)*s,e.y+=(t.y-e.y)*s;break}return}let l=0,c=0;const u=Ht.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===Ke.setup?(e.x=t.x+l*s,e.y=t.y+c*s):a?(e.x+=l*s,e.y+=c*s):(e.x+=(t.x+l-e.x)*s,e.y+=(t.y+c-e.y)*s)}}class Wb extends wa{constructor(e,t,i){super(e,t,i,lt.x)}apply1(e,t,i,s,r,a,o){e.x=this.getRelativeValue(i,s,r,a,e.x,t.x)}}class zb extends wa{constructor(e,t,i){super(e,t,i,lt.y)}apply1(e,t,i,s,r,a,o){e.y=this.getRelativeValue(i,s,r,a,e.y,t.y)}}class qb extends rp{constructor(e,t,i){super(e,t,i,lt.scaleX,lt.scaleY)}apply1(e,t,i,s,r,a,o){const h=this.frames;if(i<h[0]){switch(r){case Ke.setup:e.scaleX=t.scaleX,e.scaleY=t.scaleY;break;case Ke.first:e.scaleX+=(t.scaleX-e.scaleX)*s,e.scaleY+=(t.scaleY-e.scaleY)*s;break}return}let l,c;const u=Ht.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,s===1&&!a)e.scaleX=l,e.scaleY=c;else{let f=0,p=0;r===Ke.setup?(f=t.scaleX,p=t.scaleY):(f=e.scaleX,p=e.scaleY),a?(e.scaleX=f+(l-t.scaleX)*s,e.scaleY=p+(c-t.scaleY)*s):o?(e.scaleX=f+(Math.abs(l)*Math.sign(f)-f)*s,e.scaleY=p+(Math.abs(c)*Math.sign(p)-p)*s):(f=Math.abs(f)*Math.sign(l),p=Math.abs(p)*Math.sign(c),e.scaleX=f+(l-f)*s,e.scaleY=p+(c-p)*s)}}}class Kb extends wa{constructor(e,t,i){super(e,t,i,lt.scaleX)}apply1(e,t,i,s,r,a,o){e.scaleX=this.getScaleValue(i,s,r,a,o,e.scaleX,t.scaleX)}}class Zb extends wa{constructor(e,t,i){super(e,t,i,lt.scaleY)}apply1(e,t,i,s,r,a,o){e.scaleY=this.getScaleValue(i,s,r,a,o,e.scaleY,t.scaleY)}}class Jb extends rp{constructor(e,t,i){super(e,t,i,lt.shearX,lt.shearY)}apply1(e,t,i,s,r,a,o){const h=this.frames;if(i<h[0]){switch(r){case Ke.setup:e.shearX=t.shearX,e.shearY=t.shearY;break;case Ke.first:e.shearX+=(t.shearX-e.shearX)*s,e.shearY+=(t.shearY-e.shearY)*s;break}return}let l=0,c=0;const u=Ht.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===Ke.setup?(e.shearX=t.shearX+l*s,e.shearY=t.shearY+c*s):a?(e.shearX+=l*s,e.shearY+=c*s):(e.shearX+=(t.shearX+l-e.shearX)*s,e.shearY+=(t.shearY+c-e.shearY)*s)}}class Qb extends wa{constructor(e,t,i){super(e,t,i,lt.shearX)}apply1(e,t,i,s,r,a,o){e.shearX=this.getRelativeValue(i,s,r,a,e.shearX,t.shearX)}}class ew extends wa{constructor(e,t,i){super(e,t,i,lt.shearY)}apply1(e,t,i,s,r,a,o){e.shearY=this.getRelativeValue(i,s,r,a,e.shearY,t.shearY)}}class tw extends Ht{constructor(t,i){super(t,`${lt.inherit}|${i}`);b(this,"boneIndex");this.boneIndex=i,this.instant=!0}getFrameEntries(){return 2}setFrame(t,i,s){t*=2,this.frames[t]=i,this.frames[t+1]=s}apply(t,i,s,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!==Ke.current&&(d.inherit=u.data.setupPose.inherit);else{const f=this.frames;s<f[0]?o!==Ke.current&&(d.inherit=u.data.setupPose.inherit):d.inherit=this.frames[Ht.search(f,s,2)+1]}}}class iu extends ba{constructor(t,i,s,...r){super(t,i,...r);b(this,"slotIndex");this.slotIndex=s}apply(t,i,s,r,a,o,h,l,c){const u=t.slots[this.slotIndex];u.bone.active&&this.apply1(u,c?u.appliedPose:u.pose,s,a,o,h)}}class iw extends iu{constructor(e,t,i){super(e,t,i,`${lt.rgb}|${i}`,`${lt.alpha}|${i}`)}getFrameEntries(){return 5}setFrame(e,t,i,s,r,a){e*=5,this.frames[e]=t,this.frames[e+1]=i,this.frames[e+2]=s,this.frames[e+3]=r,this.frames[e+4]=a}apply1(e,t,i,s,r,a){const o=t.color,h=this.frames;if(i<h[0]){const m=e.data.setupPose.color;switch(r){case Ke.setup:o.setFromColor(m);break;case Ke.first:o.add((m.r-o.r)*s,(m.g-o.g)*s,(m.b-o.b)*s,(m.a-o.a)*s);break}return}let l=0,c=0,u=0,d=0;const f=Ht.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(s===1)o.set(l,c,u,d);else if(r===Ke.setup){const m=e.data.setupPose.color;o.set(m.r+(l-m.r)*s,m.g+(c-m.g)*s,m.b+(u-m.b)*s,m.a+(d-m.a)*s)}else o.add((l-o.r)*s,(c-o.g)*s,(u-o.b)*s,(d-o.a)*s)}}class sw extends iu{constructor(e,t,i){super(e,t,i,`${lt.rgb}|${i}`)}getFrameEntries(){return 4}setFrame(e,t,i,s,r){e<<=2,this.frames[e]=t,this.frames[e+1]=i,this.frames[e+2]=s,this.frames[e+3]=r}apply1(e,t,i,s,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 Ke.setup:{o.r=p.r,o.g=p.g,o.b=p.b;break}case Ke.first:{o.r+=(p.r-o.r)*s,o.g+=(p.g-o.g)*s,o.b+=(p.b-o.b)*s;break}}return}const d=Ht.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(s!==1)if(r===Ke.setup){const p=e.data.setupPose.color;h=p.r+(h-p.r)*s,l=p.g+(l-p.g)*s,c=p.b+(c-p.b)*s}else h=o.r+(h-o.r)*s,l=o.g+(l-o.g)*s,c=o.b+(c-o.b)*s;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 nw extends Gn{constructor(t,i,s){super(t,i,`${lt.alpha}|${s}`);b(this,"slotIndex",0);this.slotIndex=s}apply(t,i,s,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(s<p[0]){const m=u.data.setupPose.color.a;switch(o){case Ke.setup:d.a=m;break;case Ke.first:d.a+=(m-d.a)*a;break}return}if(f=this.getCurveValue(s),a!==1)if(o===Ke.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 rw extends iu{constructor(e,t,i){super(e,t,i,`${lt.rgb}|${i}`,`${lt.alpha}|${i}`,`${lt.rgb2}|${i}`)}getFrameEntries(){return 8}setFrame(e,t,i,s,r,a,o,h,l){e<<=3,this.frames[e]=t,this.frames[e+1]=i,this.frames[e+2]=s,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,s,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 v=e.data.setupPose,_=v.color,x=v.darkColor;switch(r){case Ke.setup:{o.setFromColor(_),h.r=x.r,h.g=x.g,h.b=x.b;break}case Ke.first:{o.add((_.r-o.r)*s,(_.g-o.g)*s,(_.b-o.b)*s,(_.a-o.a)*s),h.r+=(x.r-h.r)*s,h.g+=(x.g-h.g)*s,h.b+=(x.b-h.b)*s;break}}return}let f=0,p=0,m=0,g=0;const y=Ht.search(d,i,8),w=this.curves[y>>3];switch(w){case 0:{const v=d[y];f=d[y+1],p=d[y+2],m=d[y+3],g=d[y+4],l=d[y+5],c=d[y+6],u=d[y+7];const _=(i-v)/(d[y+8]-v);f+=(d[y+8+1]-f)*_,p+=(d[y+8+2]-p)*_,m+=(d[y+8+3]-m)*_,g+=(d[y+8+4]-g)*_,l+=(d[y+8+5]-l)*_,c+=(d[y+8+6]-c)*_,u+=(d[y+8+7]-u)*_;break}case 1:f=d[y+1],p=d[y+2],m=d[y+3],g=d[y+4],l=d[y+5],c=d[y+6],u=d[y+7];break;default:f=this.getBezierValue(i,y,1,w-2),p=this.getBezierValue(i,y,2,w+18-2),m=this.getBezierValue(i,y,3,w+36-2),g=this.getBezierValue(i,y,4,w+54-2),l=this.getBezierValue(i,y,5,w+72-2),c=this.getBezierValue(i,y,6,w+90-2),u=this.getBezierValue(i,y,7,w+108-2)}if(s===1)o.set(f,p,m,g);else if(r===Ke.setup){const v=e.data.setupPose;let _=v.color;o.set(_.r+(f-_.r)*s,_.g+(p-_.g)*s,_.b+(m-_.b)*s,_.a+(g-_.a)*s),_=v.darkColor,l=_.r+(l-_.r)*s,c=_.g+(c-_.g)*s,u=_.b+(u-_.b)*s}else o.add((f-o.r)*s,(p-o.g)*s,(m-o.b)*s,(g-o.a)*s),l=h.r+(l-h.r)*s,c=h.g+(c-h.g)*s,u=h.b+(u-h.b)*s;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 aw extends iu{constructor(e,t,i){super(e,t,i,`${lt.rgb}|${i}`,`${lt.rgb2}|${i}`)}getFrameEntries(){return 7}setFrame(e,t,i,s,r,a,o,h){e*=7,this.frames[e]=t,this.frames[e+1]=i,this.frames[e+2]=s,this.frames[e+3]=r,this.frames[e+4]=a,this.frames[e+5]=o,this.frames[e+6]=h}apply1(e,t,i,s,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 w=e.data.setupPose,v=w.color,_=w.darkColor;switch(r){case Ke.setup:o.r=v.r,o.g=v.g,o.b=v.b,h.r=_.r,h.g=_.g,h.b=_.b;break;case Ke.first:o.r+=(v.r-o.r)*s,o.g+=(v.g-o.g)*s,o.b+=(v.b-o.b)*s,h.r+=(_.r-h.r)*s,h.g+=(_.g-h.g)*s,h.b+=(_.b-h.b)*s;break}return}const g=Ht.search(m,i,7),y=this.curves[g/7];switch(y){case 0:{const w=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 v=(i-w)/(m[g+7]-w);l+=(m[g+7+1]-l)*v,c+=(m[g+7+2]-c)*v,u+=(m[g+7+3]-u)*v,d+=(m[g+7+4]-d)*v,f+=(m[g+7+5]-f)*v,p+=(m[g+7+6]-p)*v;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,y-2),c=this.getBezierValue(i,g,2,y+18-2),u=this.getBezierValue(i,g,3,y+36-2),d=this.getBezierValue(i,g,4,y+54-2),f=this.getBezierValue(i,g,5,y+72-2),p=this.getBezierValue(i,g,6,y+90-2)}if(s!==1)if(r===Ke.setup){const w=e.data.setupPose;let v=w.color;l=v.r+(l-v.r)*s,c=v.g+(c-v.g)*s,u=v.b+(u-v.b)*s,v=w.darkColor,d=v.r+(d-v.r)*s,f=v.g+(f-v.g)*s,p=v.b+(p-v.b)*s}else l=o.r+(l-o.r)*s,c=o.g+(c-o.g)*s,u=o.b+(u-o.b)*s,d=h.r+(d-h.r)*s,f=h.g+(f-h.g)*s,p=h.b+(p-h.b)*s;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 sl extends Ht{constructor(t,i){super(t,`${lt.attachment}|${i}`);b(this,"slotIndex",0);b(this,"attachmentNames");this.slotIndex=i,this.attachmentNames=new Array(t),this.instant=!0}getFrameCount(){return this.frames.length}setFrame(t,i,s){this.frames[t]=i,this.attachmentNames[t]=s}apply(t,i,s,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||s<this.frames[0]?o!==Ke.current&&this.setAttachment(t,d,u.data.attachmentName):this.setAttachment(t,d,this.attachmentNames[Ht.search(this.frames,s)])}setAttachment(t,i,s){i.setAttachment(s?t.getAttachment(this.slotIndex,s):null)}}class ow extends ba{constructor(t,i,s,r){super(t,i,`${lt.deform}|${s}|${r.id}`);b(this,"slotIndex");b(this,"attachment");b(this,"vertices");this.slotIndex=s,this.attachment=r,this.vertices=new Array(t),this.additive=!0}getFrameCount(){return this.frames.length}setFrame(t,i,s){this.frames[t]=i,this.vertices[t]=s}setBezier(t,i,s,r,a,o,h,l,c,u,d){const f=this.curves;let p=this.getFrameCount()+t*18;s===0&&(f[i]=2+p);const m=(r-o*2+l)*.03,g=c*.03-h*.06,y=((o-l)*3-r+u)*.006,w=(h-c+.33333333)*.018;let v=m*2+y,_=g*2+w,x=(o-r)*.3+m+y*.16666667,M=h*.3+g+w*.16666667,T=r+x,C=M;for(let I=p+18;p<I;p+=2)f[p]=T,f[p+1]=C,x+=v,M+=_,v+=y,_+=w,T+=x,C+=M}getCurvePercent(t,i){const s=this.curves;let r=s[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,s[r]>t){const l=this.frames[i];return s[r+1]*(t-l)/(s[r]-l)}const a=r+18;for(r+=2;r<a;r+=2)if(s[r]>=t){const l=s[r-2],c=s[r-1];return c+(t-l)/(s[r]-l)*(s[r+1]-c)}const o=s[a-2],h=s[a-1];return h+(1-h)*(t-o)/(this.frames[i+this.getFrameEntries()]-o)}apply(t,i,s,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(s<f[0]){this.applyBeforeFirst(u[this.slotIndex],c,a,o);for(const w of d)this.applyBeforeFirst(u[w],c,a,o);return}let p,m,g;if(s>=f[f.length-1])g=0,p=this.vertices[f.length-1],m=null;else{const w=Ht.search(f,s);g=this.getCurvePercent(s,w),p=this.vertices[w],m=this.vertices[w+1]}const y=this.vertices[0].length;this.applyToSlot(u[this.slotIndex],c,p,m,g,y,a,o,h);for(const w of d)this.applyToSlot(u[w],c,p,m,g,y,a,o,h)}applyBeforeFirst(t,i,s,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=Ke.setup),r){case Ke.setup:o.length=0;break;case Ke.first:{if(s===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])*s}else{s=1-s;for(let u=0;u<h;u++)l[u]*=s}}}}applyToSlot(t,i,s,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=Ke.setup);const p=l===Ke.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]+=s[m];else{const m=d.vertices;for(let g=0;g<o;g++)f[g]+=s[g]-m[g]}else et.arrayCopy(s,0,f,0,o);else if(p)if(d.bones)for(let m=0;m<o;m++)f[m]=s[m]*h;else{const m=d.vertices;for(let g=0;g<o;g++){const y=m[g];f[g]=y+(s[g]-y)*h}}else if(c)if(d.bones)for(let m=0;m<o;m++)f[m]+=s[m]*h;else{const m=d.vertices;for(let g=0;g<o;g++)f[g]+=(s[g]-m[g])*h}else for(let m=0;m<o;m++)f[m]+=(s[m]-f[m])*h;else if(h===1)if(c&&!p)if(d.bones)for(let m=0;m<o;m++){const g=s[m];f[m]+=g+(r[m]-g)*a}else{const m=d.vertices;for(let g=0;g<o;g++){const y=s[g];f[g]+=y+(r[g]-y)*a-m[g]}}else if(a===0)et.arrayCopy(s,0,f,0,o);else for(let m=0;m<o;m++){const g=s[m];f[m]=g+(r[m]-g)*a}else if(p)if(d.bones)for(let m=0;m<o;m++){const g=s[m];f[m]=(g+(r[m]-g)*a)*h}else{const m=d.vertices;for(let g=0;g<o;g++){const y=s[g],w=m[g];f[g]=w+(y+(r[g]-y)*a-w)*h}}else if(c)if(d.bones)for(let m=0;m<o;m++){const g=s[m];f[m]+=(g+(r[m]-g)*a)*h}else{const m=d.vertices;for(let g=0;g<o;g++){const y=s[g];f[g]+=(y+(r[g]-y)*a-m[g])*h}}else for(let m=0;m<o;m++){const g=s[m];f[m]+=(g+(r[m]-g)*a-f[m])*h}}}const gs=class gs extends Ht{constructor(t,i,s){super(t,`${lt.sequence}|${i}|${s.sequence.id}`);b(this,"slotIndex");b(this,"attachment");this.slotIndex=i,this.attachment=s,this.instant=!0}getFrameEntries(){return gs.ENTRIES}getSlotIndex(){return this.slotIndex}getAttachment(){return this.attachment}setFrame(t,i,s,r,a){const o=this.frames;t*=gs.ENTRIES,o[t]=i,o[t+gs.MODE]=s|r<<4,o[t+gs.DELAY]=a}apply(t,i,s,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||s<f[0]){if(o!==Ke.current){this.setupPose(u[this.slotIndex],c);for(const w of d)this.setupPose(u[w],c)}return}const p=Ht.search(f,s,gs.ENTRIES),m=f[p],g=f[p+gs.MODE],y=f[p+gs.DELAY];this.applyToSlot(u[this.slotIndex],c,s,m,g,y);for(const w of d)this.applyToSlot(u[w],c,s,m,g,y)}setupPose(t,i){if(!t.bone.active)return;const s=i?t.appliedPose:t.pose;s.attachment===null||s.attachment.timelineAttachment!==this.attachment||(s.sequenceIndex=-1)}applyToSlot(t,i,s,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=Hb[a&15];if(u!==Pi.hold)switch(l+=(s-r)/o+1e-5|0,u){case Pi.once:l=Math.min(c-1,l);break;case Pi.loop:l%=c;break;case Pi.pingpong:{const d=(c<<1)-2;l=d===0?0:l%d,l>=c&&(l=d-l);break}case Pi.onceReverse:l=Math.max(c-1-l,0);break;case Pi.loopReverse:l=c-1-l%c;break;case Pi.pingpongReverse:{const d=(c<<1)-2;l=d===0?0:(l+c-1)%d,l>=c&&(l=d-l)}}h.sequenceIndex=l}};b(gs,"ENTRIES",3),b(gs,"MODE",1),b(gs,"DELAY",2);let bh=gs;const Mh=class Mh extends Ht{constructor(t){super(t,...Mh.propertyIds);b(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,s,r,a,o,h,l,c){if(!r)return;const u=this.frames,d=this.frames.length;if(i>s)this.apply(null,i,Number.MAX_VALUE,r,0,o,!1,!1,!1),i=-1;else if(i>=u[d-1])return;if(s<u[0])return;let f=0;if(i<u[0])f=0;else{f=Ht.search(u,i)+1;const p=u[f];for(;f>0&&u[f-1]===p;)f--}for(;f<d&&s>=u[f];f++)r.push(this.events[f])}};b(Mh,"propertyIds",[`${lt.event}`]);let bl=Mh;const ja=class ja extends Ht{constructor(t){super(t,...ja.propertyIds);b(this,"drawOrders");this.drawOrders=new Array(t),this.instant=!0}getFrameCount(){return this.frames.length}setFrame(t,i,s){this.frames[t]=i,this.drawOrders[t]=s}apply(t,i,s,r,a,o,h,l,c){const u=c?t.drawOrder.appliedPose:t.drawOrder.pose,d=t.slots;if(l||s<this.frames[0]){o!==Ke.current&&et.arrayCopy(d,0,u,0,t.slots.length);return}const f=this.drawOrders[Ht.search(this.frames,s)];if(!f)et.arrayCopy(d,0,u,0,t.slots.length);else for(let p=0,m=f.length;p<m;p++)u[p]=d[f[p]]}};b(ja,"propertyID",`${lt.drawOrder}`),b(ja,"propertyIds",[ja.propertyID]);let Ir=ja;const rl=class rl extends Ht{constructor(t,i,s){super(t,...rl.propertyIds(i));b(this,"slots");b(this,"inFolder");b(this,"drawOrders");this.slots=i,this.drawOrders=new Array(t),this.inFolder=new Array(s);for(const r of i)this.inFolder[r]=!0;this.instant=!0}static propertyIds(t){const i=t.length,s=new Array(i);for(let r=0;r<i;r++)s[r]=`${rl.propertyID}|${t[r]}`;return s}getFrameCount(){return this.frames.length}getSlots(){return this.slots}getDrawOrders(){return this.drawOrders}setFrame(t,i,s){this.frames[t]=i,this.drawOrders[t]=s}apply(t,i,s,r,a,o,h,l,c){const u=c?t.drawOrder.appliedPose:t.drawOrder.pose,d=t.slots;if(l||s<this.frames[0])o!==Ke.current&&this.setup(u,d);else{const f=this.drawOrders[Ht.search(this.frames,s)];if(!f)this.setup(u,d);else{const p=this.inFolder,m=this.slots;for(let g=0,y=0,w=m.length;!(p[u[g].data.index]&&(u[g]=d[m[f[y]]],++y===w));g++);}}}setup(t,i){const{inFolder:s,slots:r}=this;for(let a=0,o=0,h=r.length;!(s[t[a].data.index]&&(t[a]=i[r[o]],++o===h));a++);}};b(rl,"propertyID",`${lt.drawOrderFolder}`);let po=rl;function KF(n){return typeof n=="object"&&n!==null&&typeof n.constraintIndex=="number"}class lw extends ba{constructor(t,i,s){super(t,i,`${lt.ikConstraint}|${s}`);b(this,"constraintIndex",0);this.constraintIndex=s}getFrameEntries(){return 6}setFrame(t,i,s,r,a,o,h){t*=6,this.frames[t]=i,this.frames[t+1]=s,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,s,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(s<f[0]){const v=u.data.setupPose;switch(o){case Ke.setup:{d.mix=v.mix,d.softness=v.softness,d.bendDirection=v.bendDirection,d.compress=v.compress,d.stretch=v.stretch;break}case Ke.first:{d.mix+=(v.mix-d.mix)*a,d.softness+=(v.softness-d.softness)*a,d.bendDirection=v.bendDirection,d.compress=v.compress,d.stretch=v.stretch;break}}return}let p=0,m=0;const g=Ht.search(f,s,6),y=this.curves[g/6];switch(y){case 0:{const v=f[g];p=f[g+1],m=f[g+2];const _=(s-v)/(f[g+6]-v);p+=(f[g+6+1]-p)*_,m+=(f[g+6+2]-m)*_;break}case 1:p=f[g+1],m=f[g+2];break;default:p=this.getBezierValue(s,g,1,y-2),m=this.getBezierValue(s,g,2,y+18-2)}const w=o===Ke.setup?u.data.setupPose:d;d.mix=w.mix+(p-w.mix)*a,d.softness=w.softness+(m-w.softness)*a,l?o===Ke.setup&&(d.bendDirection=w.bendDirection,d.compress=w.compress,d.stretch=w.stretch):(d.bendDirection=f[g+3],d.compress=f[g+4]!==0,d.stretch=f[g+5]!==0)}}class cw extends ba{constructor(t,i,s){super(t,i,`${lt.transformConstraint}|${s}`);b(this,"constraintIndex",0);this.constraintIndex=s,this.additive=!0}getFrameEntries(){return 7}setFrame(t,i,s,r,a,o,h,l){const c=this.frames;t*=7,c[t]=i,c[t+1]=s,c[t+2]=r,c[t+3]=a,c[t+4]=o,c[t+5]=h,c[t+6]=l}apply(t,i,s,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(s<f[0]){const T=u.data.setupPose;switch(o){case Ke.setup:{d.mixRotate=T.mixRotate,d.mixX=T.mixX,d.mixY=T.mixY,d.mixScaleX=T.mixScaleX,d.mixScaleY=T.mixScaleY,d.mixShearY=T.mixShearY;break}case Ke.first:{d.mixRotate+=(T.mixRotate-d.mixRotate)*a,d.mixX+=(T.mixX-d.mixX)*a,d.mixY+=(T.mixY-d.mixY)*a,d.mixScaleX+=(T.mixScaleX-d.mixScaleX)*a,d.mixScaleY+=(T.mixScaleY-d.mixScaleY)*a,d.mixShearY+=(T.mixShearY-d.mixShearY)*a;break}}return}let p,m,g,y,w,v;const _=Ht.search(f,s,7),x=this.curves[_/7];switch(x){case 0:{const T=f[_];p=f[_+1],m=f[_+2],g=f[_+3],y=f[_+4],w=f[_+5],v=f[_+6];const C=(s-T)/(f[_+7]-T);p+=(f[_+7+1]-p)*C,m+=(f[_+7+2]-m)*C,g+=(f[_+7+3]-g)*C,y+=(f[_+7+4]-y)*C,w+=(f[_+7+5]-w)*C,v+=(f[_+7+6]-v)*C;break}case 1:p=f[_+1],m=f[_+2],g=f[_+3],y=f[_+4],w=f[_+5],v=f[_+6];break;default:p=this.getBezierValue(s,_,1,x-2),m=this.getBezierValue(s,_,2,x+18-2),g=this.getBezierValue(s,_,3,x+36-2),y=this.getBezierValue(s,_,4,x+54-2),w=this.getBezierValue(s,_,5,x+72-2),v=this.getBezierValue(s,_,6,x+90-2)}const M=o===Ke.setup?u.data.setupPose:d;h?(d.mixRotate=M.mixRotate+p*a,d.mixX=M.mixX+m*a,d.mixY=M.mixY+g*a,d.mixScaleX=M.mixScaleX+y*a,d.mixScaleY=M.mixScaleY+w*a,d.mixShearY=M.mixShearY+v*a):(d.mixRotate=M.mixRotate+(p-M.mixRotate)*a,d.mixX=M.mixX+(m-M.mixX)*a,d.mixY=M.mixY+(g-M.mixY)*a,d.mixScaleX=M.mixScaleX+(y-M.mixScaleX)*a,d.mixScaleY=M.mixScaleY+(w-M.mixScaleY)*a,d.mixShearY=M.mixShearY+(v-M.mixShearY)*a)}}class kl extends Gn{constructor(t,i,s,r){super(t,i,`${r}|${s}`);b(this,"constraintIndex");this.constraintIndex=s}}class hw extends kl{constructor(e,t,i){super(e,t,i,lt.pathConstraintPosition),this.additive=!0}apply(e,t,i,s,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 uw extends kl{constructor(e,t,i){super(e,t,i,lt.pathConstraintSpacing)}apply(e,t,i,s,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 dw extends ba{constructor(t,i,s){super(t,i,`${lt.pathConstraintMix}|${s}`);b(this,"constraintIndex");this.constraintIndex=s}getFrameEntries(){return 4}setFrame(t,i,s,r,a){const o=this.frames;t<<=2,o[t]=i,o[t+1]=s,o[t+2]=r,o[t+3]=a}apply(t,i,s,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(s<f[0]){const _=u.data.setupPose;switch(o){case Ke.setup:{d.mixRotate=_.mixRotate,d.mixX=_.mixX,d.mixY=_.mixY;break}case Ke.first:{d.mixRotate+=(_.mixRotate-d.mixRotate)*a,d.mixX+=(_.mixX-d.mixX)*a,d.mixY+=(_.mixY-d.mixY)*a;break}}return}let p,m,g;const y=Ht.search(f,s,4),w=this.curves[y>>2];switch(w){case 0:{const _=f[y];p=f[y+1],m=f[y+2],g=f[y+3];const x=(s-_)/(f[y+4]-_);p+=(f[y+4+1]-p)*x,m+=(f[y+4+2]-m)*x,g+=(f[y+4+3]-g)*x;break}case 1:p=f[y+1],m=f[y+2],g=f[y+3];break;default:p=this.getBezierValue(s,y,1,w-2),m=this.getBezierValue(s,y,2,w+18-2),g=this.getBezierValue(s,y,3,w+36-2)}const v=o===Ke.setup?u.data.setupPose:d;h?(d.mixRotate=v.mixRotate+p*a,d.mixX=v.mixX+m*a,d.mixY=v.mixY+g*a):(d.mixRotate=v.mixRotate+(p-v.mixRotate)*a,d.mixX=v.mixX+(m-v.mixX)*a,d.mixY=v.mixY+(g-v.mixY)*a)}}class Or extends kl{constructor(e,t,i,s){super(e,t,i,s)}apply(e,t,i,s,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 fw extends Or{constructor(e,t,i){super(e,t,i,lt.physicsConstraintInertia)}get(e){return e.inertia}set(e,t){e.inertia=t}global(e){return e.inertiaGlobal}}class mw extends Or{constructor(e,t,i){super(e,t,i,lt.physicsConstraintStrength)}get(e){return e.strength}set(e,t){e.strength=t}global(e){return e.strengthGlobal}}class pw extends Or{constructor(e,t,i){super(e,t,i,lt.physicsConstraintDamping)}get(e){return e.damping}set(e,t){e.damping=t}global(e){return e.dampingGlobal}}class gw extends Or{constructor(e,t,i){super(e,t,i,lt.physicsConstraintMass)}get(e){return 1/e.massInverse}set(e,t){e.massInverse=1/t}global(e){return e.massGlobal}}class vw extends Or{constructor(e,t,i){super(e,t,i,lt.physicsConstraintWind),this.additive=!0}get(e){return e.wind}set(e,t){e.wind=t}global(e){return e.windGlobal}}class yw extends Or{constructor(e,t,i){super(e,t,i,lt.physicsConstraintGravity),this.additive=!0}get(e){return e.gravity}set(e,t){e.gravity=t}global(e){return e.gravityGlobal}}class xw extends Or{constructor(e,t,i){super(e,t,i,lt.physicsConstraintMix)}get(e){return e.mix}set(e,t){e.mix=t}global(e){return e.mixGlobal}}const Eh=class Eh extends Ht{constructor(t,i){super(t,...Eh.propertyIds);b(this,"constraintIndex");this.constraintIndex=i,this.instant=!0}getFrameCount(){return this.frames.length}setFrame(t,i){this.frames[t]=i}apply(t,i,s,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>s)this.apply(t,i,Number.MAX_VALUE,[],a,o,!1,!1,!1),i=-1;else if(i>=d[d.length-1])return;if(!(s<d[0])&&(i<d[0]||s>=d[Ht.search(d,i)+1]))if(u!=null)u.reset(t);else for(const f of t.physics)f.active&&f.reset(t)}};b(Eh,"propertyIds",[lt.physicsConstraintReset.toString()]);let wh=Eh;class bw extends kl{constructor(e,t,i){super(e,t,i,lt.sliderTime)}apply(e,t,i,s,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 ww extends kl{constructor(e,t,i){super(e,t,i,lt.sliderMix),this.additive=!0}apply(e,t,i,s,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 al=class al{constructor(e){b(this,"data");b(this,"tracks",[]);b(this,"timeScale",1);b(this,"unkeyedState",0);b(this,"events",[]);b(this,"listeners",[]);b(this,"queue",new JF(this));b(this,"propertyIds",new Map);b(this,"animationsChanged",!1);b(this,"trackEntryPool",new GF(()=>new ZF));this.data=e}update(e){e*=this.timeScale;const t=this.tracks;for(let i=0,s=t.length;i<s;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 s=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 s}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 s=!1;for(let o=0,h=i.length;o<h;o++){const l=i[o];if(!l||l.delay>0)continue;s=!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 y=0;y<g;y++){et.webkit602BugfixHelper(c);const w=m[y];w instanceof sl?this.applyAttachmentTimeline(w,e,f,Ke.setup,!0):w.apply(e,u,f,p,c,Ke.setup,!1,!1,!1)}else{const y=l.timelineMode,w=c>=l.alphaAttachmentThreshold,v=l.additive,_=v||l.shortestRotation,x=!_&&l.timelinesRotation.length!==g<<1;x&&(l.timelinesRotation.length=g<<1);for(let M=0;M<g;M++){const T=m[M],C=y[M]&Ev;!_&&T instanceof xh?this.applyRotateTimeline(T,e,f,c,C,l.timelinesRotation,M<<1,x):T instanceof sl?this.applyAttachmentTimeline(T,e,f,C,w):(et.webkit602BugfixHelper(c),T.apply(e,u,f,p,c,C,v,!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+Av,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(),s}applyMixingFrom(e,t){const i=e.mixingFrom,s=i.mixingFrom!==null?this.applyMixingFrom(i,t):1,r=e.mix(),a=i.alpha*s,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,y=g||i.shortestRotation,w=!y&&i.timelinesRotation.length!==u<<1;w&&(i.timelinesRotation.length=u<<1);const v=i.timelinesRotation;let _=i.animationLast,x=i.getAnimationTime(),M=x,T=null;i.reverse?M=i.animation.duration-M:r<i.eventThreshold&&(T=this.events),i.totalAlpha=0;for(let C=0;C<u;C++){const I=c[C],k=d[C],R=k&Ev;let F=0;if((k&vc)!==0){const B=f[C];F=B==null?l:l*(1-B.mix())}else{if(!m&&I instanceof Ir&&R===Ke.current)continue;F=h}if(i.totalAlpha+=F,!y&&I instanceof xh)this.applyRotateTimeline(I,t,M,F,R,v,C<<1,w);else if(I instanceof sl)this.applyAttachmentTimeline(I,t,M,R,p&&F>=i.alphaAttachmentThreshold);else{const B=!m||!(I instanceof Ir)||R===Ke.current;I.apply(t,_,M,T,F,R,g,B,!1)}}return i.reverse&&r<i.eventThreshold&&this.eventsReverse(i,_,x),e.mixDuration>0&&this.queueEvents(i,x),this.events.length=0,i.nextAnimationLast=x,i.nextTrackLast=i.trackTime,r}applyAttachmentTimeline(e,t,i,s,r){const a=t.slots[e.slotIndex];if(!a.bone.active||!r&&a.attachmentState===this.unkeyedState+Cv)return;let o=i<e.frames[0],h=null;if(o||(h=e.attachmentNames[Ht.search(e.frames,i)],o=!r&&h==null),o){if(s===Ke.current)return;h=a.data.attachmentName}a.pose.setAttachment(h==null?null:t.getAttachment(a.data.index,h)),r?a.attachmentState=this.unkeyedState+Cv:o||(a.attachmentState=this.unkeyedState+Av)}applyRotateTimeline(e,t,i,s,r,a,o,h){if(h&&(a[o]=0),s===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 Ke.setup:{c.rotation=u.rotation;return}case Ke.current:return}f=c.rotation,p=u.rotation}else f=r===Ke.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 y=0,w=0;h?(y=0,w=g):(y=a[o],w=a[o+1]);const v=y-y%360;m=g+v;let _=g>=0,x=y>=0;Math.abs(w)<=90&&De.signum(w)!==De.signum(g)&&(Math.abs(y-v)>180?(m+=360*De.signum(y),x=_):v!==0?m-=360*De.signum(y):x=_),x!==_&&(m+=360*De.signum(y)),a[o]=m}a[o+1]=g,c.rotation=f+m*s}queueEvents(e,t){const i=e.animationStart,s=e.animationEnd,r=s-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<=s&&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>=s&&e.animationLast<s;for(u&&this.queue.complete(e);l<c;l++){const d=h[l];d.time>=i&&d.time<=s&&this.queue.event(e,d)}}eventsReverse(e,t,i){const s=e.animation.duration,r=s-t,a=s-i,o=e.animation.timelines;for(let h=0,l=e.animation.timelines.length;h<l;h++){const c=o[h];if(!(c instanceof bl))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 s=i.mixingFrom;if(!s)break;this.queue.end(s),i.mixingFrom=null,i.mixingTo=null,i=s}this.tracks[t.trackIndex]=null,this.queue.drain()}setTrack(e,t,i){const s=this.expandToIndex(e);this.tracks[e]=t,t.previous=null,s&&(s.next=null,i&&this.queue.interrupt(s),t.mixingFrom=s,s.mixingTo=t,t.mixTime=0,s.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 s=this.data.skeletonData.findAnimation(t);if(!s)throw new Error(`Animation not found: ${t}`);return this.setAnimation2(e,s,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 s=!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,s=!1):this.clearNext(r));const a=this.trackEntry(e,t,i,r);return this.setTrack(e,a,s),this.queue.drain(),a}addAnimation(e,t,i=!1,s=0){return typeof t=="string"?this.addAnimation1(e,t,i,s):this.addAnimation2(e,t,i,s)}addAnimation1(e,t,i=!1,s=0){const r=this.data.skeletonData.findAnimation(t);if(!r)throw new Error(`Animation not found: ${t}`);return this.addAnimation2(e,r,i,s)}addAnimation2(e,t,i=!1,s=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,s<=0&&(s=Math.max(s+r.getTrackComplete()-a.mixDuration,0))):(this.setTrack(e,a,!0),this.queue.drain(),s<0&&(s=0)),a.delay=s,a}setEmptyAnimation(e,t=0){const i=this.setAnimation(e,al.emptyAnimation,!1);return i.mixDuration=t,i.trackEnd=t,i}addEmptyAnimation(e,t=0,i=0){const s=this.addAnimation(e,al.emptyAnimation,!1,i);return i<=0&&(s.delay=Math.max(s.delay+s.mixDuration-t,0)),s.mixDuration=t,s.trackEnd=t,s}setEmptyAnimations(e=0){const t=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let i=0,s=this.tracks.length;i<s;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]:(et.ensureArrayCapacity(this.tracks,e+1,null),this.tracks.length=e+1,null)}trackEntry(e,t,i,s){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=s?this.data.getMix(s.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 s=e[t];if(!s)continue;let r=s;for(;r.mixingFrom;)r=r.mixingFrom;do this.computeHold(r,s),r=r.mixingTo;while(r)}this.propertyIds.clear()}computeHold(e,t){var c,u;const i=e.animation.timelines,s=e.animation.timelines.length,r=e.timelineMode;r.length=s;const a=e.timelineHoldMix;a.length=0;const o=e.additive,h=e.keepHold,l=e.mixingTo;for(let d=0;d<s;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|vc;for(let y=l.mixingTo;y!=null;y=y.mixingTo)if(y.additive&&f.additive||!((u=y.animation)!=null&&u.hasTimeline(p))){y.mixDuration>0&&(a[d]=y);break}}h&&(g=g&~vc|r[d]&vc),r[d]=g}}from(e,t,i){const s=this.propertyIds;let r=QF;for(let a=0,o=i.length;a<o;a++){const h=s.get(i[a]);if(h===void 0)s.set(i[a],e);else{if(h!==e){for(;++a<o;)s.has(i[a])||s.set(i[a],e);return Tv}r=Mv}}if(t instanceof po){const a=s.get(Ir.propertyID);if(a!=null)return a!==e?Tv:Mv}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()}};b(al,"emptyAnimation",new np("<empty>",[],0));let _v=al;class ZF{constructor(){b(this,"animation",null);b(this,"previous",null);b(this,"next",null);b(this,"mixingFrom",null);b(this,"mixingTo",null);b(this,"listener",null);b(this,"trackIndex",0);b(this,"loop",!1);b(this,"additive",!1);b(this,"reverse",!1);b(this,"shortestRotation",!1);b(this,"keepHold",!1);b(this,"eventThreshold",0);b(this,"mixAttachmentThreshold",0);b(this,"alphaAttachmentThreshold",0);b(this,"mixDrawOrderThreshold",0);b(this,"animationStart",0);b(this,"animationEnd",0);b(this,"animationLast",0);b(this,"nextAnimationLast",0);b(this,"delay",0);b(this,"trackTime",0);b(this,"trackLast",0);b(this,"nextTrackLast",0);b(this,"trackEnd",0);b(this,"timeScale",0);b(this,"alpha",0);b(this,"mixTime",0);b(this,"mixDuration",0);b(this,"totalAlpha",0);b(this,"mixInterpolation",ro.linear);b(this,"timelineMode",[]);b(this,"timelineHoldMix",[]);b(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===ro.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=ro.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 JF{constructor(e){b(this,"objects",[]);b(this,"drainDisabled",!1);b(this,"animState");this.animState=e}start(e){this.objects.push(ts.start),this.objects.push(e),this.animState.animationsChanged=!0}interrupt(e){this.objects.push(ts.interrupt),this.objects.push(e)}end(e){this.objects.push(ts.end),this.objects.push(e),this.animState.animationsChanged=!0}dispose(e){this.objects.push(ts.dispose),this.objects.push(e)}complete(e){this.objects.push(ts.complete),this.objects.push(e)}event(e,t){this.objects.push(ts.event),this.objects.push(e),this.objects.push(t)}drain(){var e,t,i,s,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 ts.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 ts.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 ts.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 ts.dispose:(s=c.listener)!=null&&s.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 ts.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 ts.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 ts;(function(n){n[n.start=0]="start",n[n.interrupt=1]="interrupt",n[n.end=2]="end",n[n.dispose=3]="dispose",n[n.complete=4]="complete",n[n.event=5]="event"})(ts||(ts={}));class B4{start(e){}interrupt(e){}end(e){}dispose(e){}complete(e){}event(e,t){}}const Tv=0,QF=1,Mv=2,Ev=3,vc=4,Av=1,Cv=2;class ap extends ir{constructor(t){super(t);b(this,"color",new ct(1,1,1,1))}copy(){const t=new ap(this.name);return this.copyTo(t),t.color.setFromColor(this.color),t}}class su extends ir{constructor(t){super(t);b(this,"endSlot",null);b(this,"convex",!1);b(this,"inverse",!1);b(this,"color",new ct(.2275,.2275,.8078,1))}copy(){const t=new su(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 wl extends ir{constructor(t){super(t);b(this,"lengths",[]);b(this,"closed",!1);b(this,"constantSpeed",!1);b(this,"color",new ct(1,1,1,1))}copy(){const t=new wl(this.name);return this.copyTo(t),t.lengths=[],et.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 op extends ir{constructor(t){super(t);b(this,"x",0);b(this,"y",0);b(this,"rotation",0);b(this,"color",new ct(.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*De.degRad,s=Math.cos(i),r=Math.sin(i),a=s*t.a+r*t.b,o=s*t.c+r*t.d;return De.atan2Deg(o,a)}copy(){const t=new op(this.name);return t.x=this.x,t.y=this.y,t.rotation=this.rotation,t.color.setFromColor(this.color),t}}class lp{constructor(e,t){b(this,"name");b(this,"setupPose");b(this,"skinRequired",!1);if(e==null)throw new Error("name cannot be null.");this.name=e,this.setupPose=t}}class nu extends lp{constructor(t,i,s){super(i,new em);b(this,"index",0);b(this,"parent",null);b(this,"length",0);b(this,"color",new ct);b(this,"icon");b(this,"iconSize",1);b(this,"iconRotation",0);b(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=s}copy(t){const i=new nu(this.index,this.name,t);return i.length=this.length,i.setupPose.set(this.setupPose),i}}var si;(function(n){n[n.Normal=0]="Normal",n[n.OnlyTranslation=1]="OnlyTranslation",n[n.NoRotationOrReflection=2]="NoRotationOrReflection",n[n.NoScale=3]="NoScale",n[n.NoScaleOrReflection=4]="NoScaleOrReflection"})(si||(si={}));class em{constructor(){b(this,"bone");b(this,"x",0);b(this,"y",0);b(this,"rotation",0);b(this,"scaleX",0);b(this,"scaleY",0);b(this,"shearX",0);b(this,"shearY",0);b(this,"inherit",si.Normal);b(this,"a",0);b(this,"b",0);b(this,"c",0);b(this,"d",0);b(this,"worldY",0);b(this,"worldX",0);b(this,"world",0);b(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,s=this.scaleY,r=this.shearX,a=this.shearY;if(!this.bone.parent){const d=e.scaleX,f=e.scaleY,p=(t+r)*De.degRad,m=(t+90+a)*De.degRad;this.a=Math.cos(p)*i*d,this.b=Math.cos(m)*s*d,this.c=Math.sin(p)*i*f,this.d=Math.sin(m)*s*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 si.Normal:{const d=(t+r)*De.degRad,f=(t+90+a)*De.degRad,p=Math.cos(d)*i,m=Math.cos(f)*s,g=Math.sin(d)*i,y=Math.sin(f)*s;this.a=h*p+l*g,this.b=h*m+l*y,this.c=c*p+u*g,this.d=c*m+u*y;return}case si.OnlyTranslation:{const d=e.scaleX,f=e.scaleY,p=(t+r)*De.degRad,m=(t+90+a)*De.degRad;this.a=Math.cos(p)*i*d,this.b=Math.cos(m)*s*d,this.c=Math.sin(p)*i*f,this.d=Math.sin(m)*s*f;break}case si.NoRotationOrReflection:{const d=e.scaleX,f=e.scaleY,p=1/d,m=1/f;h*=p,c*=m;let g=h*h+c*c,y=0;g>De.epsilon2?(g=Math.abs(h*u*m-l*p*c)/g,l=c*g,u=h*g,y=t-De.atan2Deg(c,h)):(h=0,c=0,y=t-90+De.atan2Deg(u,l));const w=(y+r)*De.degRad,v=(y+a+90)*De.degRad,_=Math.cos(w)*i,x=Math.cos(v)*s,M=Math.sin(w)*i,T=Math.sin(v)*s;this.a=(h*_-l*M)*d,this.b=(h*x-l*T)*d,this.c=(c*_+u*M)*f,this.d=(c*x+u*T)*f;break}case si.NoScale:case si.NoScaleOrReflection:{const d=e.scaleX,f=e.scaleY,p=1/d,m=1/f,g=t*De.degRad,y=Math.cos(g),w=Math.sin(g);let v=(h*y+l*w)*p,_=(c*y+u*w)*m;const x=1/Math.sqrt(v*v+_*_);v*=x,_*=x;let M=-_,T=v;this.inherit===si.NoScale&&h*u-l*c<0!=(d<0!=f<0)&&(M=-M,T=-T);const C=r*De.degRad,I=(90+a)*De.degRad,k=Math.cos(C)*i,R=Math.cos(I)*s,F=Math.sin(C)*i,B=Math.sin(I)*s;this.a=(v*k+M*F)*d,this.b=(v*R+M*B)*d,this.c=(_*k+T*F)*f,this.d=(_*R+T*B)*f;break}}}updateLocalTransform(e){this.local=0,this.world=e._update;const t=e.scaleX,i=e.scaleY;if(!this.bone.parent){const y=1/t,w=1/i;this.x=(this.worldX-e.x)*y,this.y=(this.worldY-e.y)*w,this.set5(this.a*y,this.b*y,this.c*w,this.d*w,0);return}const s=this.bone.parent.appliedPose;let r=s.a,a=s.b,o=s.c,h=s.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-s.worldX,g=this.worldY-s.worldY;switch(this.x=m*u-g*d,this.y=g*p-m*f,this.inherit){case si.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 si.OnlyTranslation:{const y=1/t,w=1/i;this.set5(this.a*y,this.b*y,this.c*w,this.d*w,0);break}case si.NoRotationOrReflection:{const y=1/t,w=1/i;r*=y,o*=w;const v=this.a*y,_=this.b*y,x=this.c*w,M=this.d*w,T=1/(r*r+o*o),C=1/Math.abs(l*y*w);this.set5((r*v+o*x)*T,(r*_+o*M)*T,(r*x-o*v)*C,(r*M-o*_)*C,De.atan2Deg(o,r));break}case si.NoScale:case si.NoScaleOrReflection:{const y=1/t,w=1/i,v=this.a*y,_=this.b*y,x=this.c*w,M=this.d*w;let T=h*this.a-a*this.c,C=r*this.c-o*this.a;l<0&&(T=-T,C=-C);let I=De.atan2Deg(C,T);this.rotation=I,I*=De.degRad;const k=Math.cos(I),R=Math.sin(I);let F=(r*k+a*R)*y,B=(o*k+h*R)*w;const L=1/Math.sqrt(F*F+B*B);F*=L,B*=L;const Y=this.inherit===si.NoScale&&l<0!=(t<0!=i<0)?-1:1;this.set4(F*v+B*x,F*_+B*M,(F*x-B*v)*Y,(F*M-B*_)*Y)}}}set4(e,t,i,s){const r=e*e+i*i,a=t*t+s*s;r>De.epsilon2?(this.shearX=De.atan2Deg(i,e),this.scaleX=Math.sqrt(r)):(this.shearX=0,this.scaleX=0),this.scaleY=Math.sqrt(a),a>De.epsilon2?(this.shearY=De.atan2Deg(s,t),e*s-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,s,r){this.shearX=0;const a=e*e+i*i,o=t*t+s*s;if(a>De.epsilon2){const h=De.atan2Deg(i,e);this.rotation=h+r,this.scaleX=Math.sqrt(a),this.scaleY=Math.sqrt(o),o>De.epsilon2?(this.shearY=De.atan2Deg(s,t),e*s-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>De.epsilon2?De.atan2Deg(s,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 s=0,r=i.length;s<r;s++){const a=i[s].appliedPose;a.world===t&&(a.local===t&&a.updateLocalTransform(e),a.world=0,a.resetWorld(e,t))}}getWorldRotationX(){return De.atan2Deg(this.c,this.a)}getWorldRotationY(){return De.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,s=e.y-this.worldY;return e.x=(i*this.d-s*this.b)/t,e.y=(s*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*=De.degRad;const t=Math.sin(e),i=Math.cos(e);return De.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)*De.degRad;const t=Math.sin(e),i=Math.cos(e);return De.atan2Deg(i*this.c+t*this.d,i*this.a+t*this.b)}rotateWorld(e){e*=De.degRad;const t=Math.sin(e),i=Math.cos(e),s=this.a,r=this.b;this.a=i*s-t*this.c,this.b=i*r-t*this.d,this.c=t*s+i*this.c,this.d=t*r+i*this.d}}class Sw{constructor(e,t,i){b(this,"data");b(this,"pose");b(this,"constrainedPose");b(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 _w extends Sw{constructor(t,i,s){super(t,i,s);b(this,"active",!1);this.setupPose()}isActive(){return this.active}}class nl extends _w{constructor(t,i){super(t,new em,new em);b(this,"parent",null);b(this,"children",[]);b(this,"sorted",!1);this.parent=i,this.appliedPose.bone=this,this.constrainedPose.bone=this}copy(t){const i=new nl(this.data,t);return i.pose.set(this.pose),i}}class Fl extends _w{constructor(e,t,i){super(e,t,i)}isSourceActive(){return!0}}class e3{constructor(e){b(this,"_setupPose");b(this,"pose");b(this,"constrainedPose");b(this,"appliedPose");this._setupPose=e,this.pose=[...e],this.constrainedPose=[],this.appliedPose=this.pose}setupPose(){this.pose.length=this._setupPose.length,et.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,et.arrayCopy(this.pose,0,this.constrainedPose,0,this.pose.length)}}class Ol extends lp{constructor(e,t){super(e,t)}}var zi;(function(n){n[n.None=0]="None",n[n.Uniform=1]="Uniform",n[n.Volume=2]="Volume"})(zi||(zi={}));let cp=class{constructor(e,t){b(this,"time",0);b(this,"data");b(this,"intValue",0);b(this,"floatValue",0);b(this,"stringValue",null);b(this,"volume",0);b(this,"balance",0);if(!t)throw new Error("data cannot be null.");this.time=e,this.data=t}};class Tw{constructor(e){b(this,"name");b(this,"_audioPath",null);b(this,"setupPose",new cp(-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 tm{constructor(){b(this,"bendDirection",0);b(this,"compress",!1);b(this,"stretch",!1);b(this,"mix",0);b(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 gr extends Fl{constructor(t,i){super(t,new tm,new tm);b(this,"bones");b(this,"target");if(!i)throw new Error("skeleton cannot be null.");this.bones=[];for(const s of t.bones)this.bones.push(i.bones[s.index].constrainedPose);this.target=i.bones[t.target.index]}copy(t){var i=new gr(this.data,t);return i.pose.set(this.pose),i}update(t,i){const s=this.appliedPose;if(s.mix===0)return;const r=this.target.appliedPose,a=this.bones;switch(a.length){case 1:gr.apply(t,a[0],r.worldX,r.worldY,s.compress,s.stretch,this.data.scaleYMode,s.mix);break;case 2:gr.apply(t,a[0],a[1],r.worldX,r.worldY,s.bendDirection,s.stretch,this.data.scaleYMode,s.softness,s.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,s,r,a,o,h,l,c,u){typeof s=="number"?gr.apply1(t,i,s,r,a,o,h,l):gr.apply2(t,i,s,r,a,o,h,l,c,u)}static apply1(t,i,s,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,y=0;switch(i.inherit){case si.OnlyTranslation:g=(s-i.worldX)*De.signum(t.scaleX),y=(r-i.worldY)*De.signum(t.scaleY);break;case si.NoRotationOrReflection:{const w=Math.abs(u*p-d*f)/Math.max(De.epsilon,u*u+f*f),v=u/t.scaleX,_=f/t.scaleY;d=-_*w*t.scaleX,p=v*w*t.scaleY,m+=De.atan2Deg(_,v)}default:{const w=s-c.worldX,v=r-c.worldY,_=u*p-d*f;Math.abs(_)<=De.epsilon?(g=0,y=0):(g=(w*p-v*d)/_-i.x,y=(v*u-w*f)/_-i.y)}}if(m+=De.atan2Deg(y,g),i.scaleX<0&&(m+=180),m>180?m-=360:m<=-180&&(m+=360),i.rotation+=m*l,a||o){switch(i.inherit){case si.NoScale:case si.NoScaleOrReflection:g=s-i.worldX,y=r-i.worldY}const w=i.bone.data.length*i.scaleX;if(w>De.epsilon){const v=g*g+y*y;if(a&&v<w*w||o&&v>w*w){const _=(Math.sqrt(v)/w-1)*l+1;switch(i.scaleX*=_,h){case zi.Uniform:i.scaleY*=_;break;case zi.Volume:i.scaleY/=_<.7?.25+.642857*_:_}}}}}static apply2(t,i,s,r,a,o,h,l,c,u){if(i.inherit!==si.Normal||s.inherit!==si.Normal)return;i.modifyLocal(t),s.modifyLocal(t);let d=i.x,f=i.y,p=i.scaleX,m=i.scaleY,g=s.scaleX,y=0,w=0,v=0;p<0?(p=-p,y=180,v=-1):(y=0,v=1),m<0&&(m=-m,v=-v),g<0?(g=-g,w=180):w=0;let _=0,x=0,M=i.a,T=i.b,C=i.c,I=i.d;const k=Math.abs(p-m)<=De.epsilon;!k||h?(s.y=0,_=M*s.x+i.worldX,x=C*s.x+i.worldY):(_=M*s.x+T*s.y+i.worldX,x=C*s.x+I*s.y+i.worldY);const R=i.bone.parent.appliedPose;M=R.a,T=R.b,C=R.c,I=R.d;let F=M*I-T*C,B=_-R.worldX,L=x-R.worldY;F=Math.abs(F)<=De.epsilon?0:1/F;const Y=(B*I-L*T)*F-d,O=(L*M-B*C)*F-f;let D=Math.sqrt(Y*Y+O*O),P=s.bone.data.length*g,U,N;if(D<De.epsilon){gr.apply(t,i,r,a,!1,h,zi.None,u),s.rotation=0;return}B=r-R.worldX,L=a-R.worldY;let X=(B*I-L*T)*F-d,K=(L*M-B*C)*F-f,z=X*X+K*K;if(c!==0){c*=p*(g+1)*.5;const Q=Math.sqrt(z),me=Q-D-P*p+c;if(me>0){let pe=Math.min(1,me/(c*2))-1;pe=(me-c*(1-pe*pe))/Q,X-=pe*X,K-=pe*K,z=X*X+K*K}}e:if(k){P*=p;let Q=(z-D*D-P*P)/(2*D*P);if(Q<-1)Q=-1,N=Math.PI*o;else if(Q>1){if(Q=1,N=0,h)switch(M=(Math.sqrt(z)/(D+P)-1)*u+1,i.scaleX*=M,l){case zi.Uniform:i.scaleY*=M;break;case zi.Volume:i.scaleY/=M<.7?.25+.642857*M:M}}else N=Math.acos(Q)*o;M=D+P*Q,T=P*Math.sin(N),U=Math.atan2(K*M-X*T,X*M+K*T)}else{M=p*P,T=m*P;const Q=M*M,me=T*T,pe=Math.atan2(K,X);C=me*D*D+Q*z-Q*me;const Me=-2*me*D,Ie=me-Q;if(I=Me*Me-4*Ie*C,I>=0){let xe=Math.sqrt(I);Me<0&&(xe=-xe),xe=-(Me+xe)*.5;let oe=xe/Ie,Se=C/xe;const ue=Math.abs(oe)<Math.abs(Se)?oe:Se;if(oe=z-ue*ue,oe>=0){L=Math.sqrt(oe)*o,U=pe-Math.atan2(L,ue),N=Math.atan2(L/m,(ue-D)/p);break e}}let ge=De.PI,Ee=D-M,H=Ee*Ee,Z=0,q=0,W=D+M,ee=W*W,ce=0;C=-M*D/(Q-me),C>=-1&&C<=1&&(C=Math.acos(C),B=M*Math.cos(C)+D,L=T*Math.sin(C),I=B*B+L*L,I<H&&(ge=C,H=I,Ee=B,Z=L),I>ee&&(q=C,ee=I,W=B,ce=L)),z<=(H+ee)*.5?(U=pe-Math.atan2(Z*o,Ee),N=ge*o):(U=pe-Math.atan2(ce*o,W),N=q*o)}const se=Math.atan2(s.y,s.x)*v;U=(U-se)*De.radDeg+y-i.rotation,U>180?U-=360:U<=-180&&(U+=360),i.rotation+=U*u,N=((N+se)*De.radDeg-s.shearX)*v+w-s.rotation,N>180?N-=360:N<=-180&&(N+=360),s.rotation+=N*u}}class kc extends Ol{constructor(t){super(t,new tm);b(this,"bones",[]);b(this,"_target",null);b(this,"_scaleYMode",zi.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 gr(this,t)}}class im{constructor(){b(this,"position",0);b(this,"spacing",0);b(this,"mixRotate",0);b(this,"mixX",0);b(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 Fc extends Ol{constructor(t){super(t,new im);b(this,"bones",[]);b(this,"_slot",null);b(this,"positionMode",yn.Fixed);b(this,"spacingMode",_i.Fixed);b(this,"rotateMode",ua.Chain);b(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 sm(this,t)}}var yn;(function(n){n[n.Fixed=0]="Fixed",n[n.Percent=1]="Percent"})(yn||(yn={}));var _i;(function(n){n[n.Length=0]="Length",n[n.Fixed=1]="Fixed",n[n.Percent=2]="Percent",n[n.Proportional=3]="Proportional"})(_i||(_i={}));var ua;(function(n){n[n.Tangent=0]="Tangent",n[n.Chain=1]="Chain",n[n.ChainScale=2]="ChainScale"})(ua||(ua={}));const Ps=class Ps extends Fl{constructor(t,i){super(t,new im,new im);b(this,"data");b(this,"bones");b(this,"slot");b(this,"spaces",[]);b(this,"positions",[]);b(this,"world",[]);b(this,"curves",[]);b(this,"lengths",[]);b(this,"segments",[]);if(!i)throw new Error("skeleton cannot be null.");this.data=t,this.bones=[];for(const s of this.data.bones)this.bones.push(i.bones[s.index].constrainedPose);this.slot=i.slots[t.slot.index]}copy(t){var i=new Ps(this.data,t);return i.pose.set(this.pose),i}update(t,i){const s=this.slot.appliedPose.attachment;if(!(s instanceof wl))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===ua.Tangent,u=l.rotateMode===ua.ChainScale,d=this.bones,f=d.length,p=c?f:f+1,m=et.setArraySize(this.spaces,p),g=u?this.lengths=et.setArraySize(this.lengths,f):[],y=r.spacing;switch(l.spacingMode){case _i.Percent:if(u)for(let T=0,C=p-1;T<C;T++){const I=d[T],k=I.bone.data.length,R=k*I.a,F=k*I.c;g[T]=Math.sqrt(R*R+F*F)}et.arrayFill(m,1,p,y);break;case _i.Proportional:{let T=0;for(let C=0,I=p-1;C<I;){const k=d[C],R=k.bone.data.length;if(R<De.epsilon)u&&(g[C]=0),m[++C]=y;else{const F=R*k.a,B=R*k.c,L=Math.sqrt(F*F+B*B);u&&(g[C]=L),m[++C]=L,T+=L}}if(T>0){T=p/T*y;for(let C=1;C<p;C++)m[C]*=T}break}default:{const T=l.spacingMode===_i.Length;for(let C=0,I=p-1;C<I;){const k=d[C],R=k.bone.data.length;if(R<De.epsilon)u&&(g[C]=0),m[++C]=y;else{const F=R*k.a,B=R*k.c,L=Math.sqrt(F*F+B*B);u&&(g[C]=L),m[++C]=(T?Math.max(0,R+y):y)*L/R}}}}const w=this.computeWorldPositions(t,s,p,c);let v=w[0],_=w[1],x=l.offsetRotation,M=!1;if(x===0)M=l.rotateMode===ua.Chain;else{M=!1;const T=this.slot.bone.appliedPose;x*=T.a*T.d-T.b*T.c>0?De.degRad:-De.degRad}for(let T=0,C=3;T<f;T++,C+=3){const I=d[T];I.modifyWorld(t),I.worldX+=(v-I.worldX)*o,I.worldY+=(_-I.worldY)*h;const k=w[C],R=w[C+1],F=k-v,B=R-_;if(u){const L=g[T];if(L!==0){const Y=(Math.sqrt(F*F+B*B)/L-1)*a+1;I.a*=Y,I.c*=Y}}if(v=k,_=R,a>0){let L=I.a,Y=I.b,O=I.c,D=I.d,P=0,U=0,N=0;if(c?P=w[C-1]:m[T+1]===0?P=w[C+2]:P=Math.atan2(B,F),P-=Math.atan2(O,L),M){U=Math.cos(P),N=Math.sin(P);const X=I.bone.data.length;v+=(X*(U*L-N*O)-F)*a,_+=(X*(N*L+U*O)-B)*a}else P+=x;P>De.PI?P-=De.PI2:P<-De.PI&&(P+=De.PI2),P*=a,U=Math.cos(P),N=Math.sin(P),I.a=U*L-N*O,I.b=U*Y-N*D,I.c=N*L+U*O,I.d=N*Y+U*D}}}computeWorldPositions(t,i,s,r){const a=this.slot;let o=this.appliedPose.position,h=this.spaces,l=et.setArraySize(this.positions,s*3+2),c=this.world;const u=i.closed;let d=i.worldVerticesLength,f=d/6,p=Ps.NONE;if(!i.constantSpeed){const N=i.lengths;f-=u?1:2;const X=N[f];this.data.positionMode===yn.Percent&&(o*=X);let K;switch(this.data.spacingMode){case _i.Percent:K=X;break;case _i.Proportional:K=X/s;break;default:K=1}c=et.setArraySize(this.world,8);for(let z=0,se=0,Q=0;z<s;z++,se+=3){const me=h[z]*K;o+=me;let pe=o;if(u)pe%=X,pe<0&&(pe+=X),Q=0;else if(pe<0){p!==Ps.BEFORE&&(p=Ps.BEFORE,i.computeWorldVertices(t,a,2,4,c,0,2)),this.addBeforePosition(pe,c,0,l,se);continue}else if(pe>X){p!==Ps.AFTER&&(p=Ps.AFTER,i.computeWorldVertices(t,a,d-6,4,c,0,2)),this.addAfterPosition(pe-X,c,0,l,se);continue}for(;;Q++){const Me=N[Q];if(!(pe>Me)){if(Q===0)pe/=Me;else{const Ie=N[Q-1];pe=(pe-Ie)/(Me-Ie)}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(pe,c[0],c[1],c[2],c[3],c[4],c[5],c[6],c[7],l,se,r||z>0&&me===0)}return l}u?(d+=2,c=et.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=et.setArraySize(this.world,d),i.computeWorldVertices(t,a,2,d,c,0,2));const m=et.setArraySize(this.curves,f);let g=0,y=c[0],w=c[1],v=0,_=0,x=0,M=0,T=0,C=0,I=0,k=0,R=0,F=0,B=0,L=0,Y=0,O=0;for(let N=0,X=2;N<f;N++,X+=6)v=c[X],_=c[X+1],x=c[X+2],M=c[X+3],T=c[X+4],C=c[X+5],I=(y-v*2+x)*.1875,k=(w-_*2+M)*.1875,R=((v-x)*3-y+T)*.09375,F=((_-M)*3-w+C)*.09375,B=I*2+R,L=k*2+F,Y=(v-y)*.75+I+R*.16666667,O=(_-w)*.75+k+F*.16666667,g+=Math.sqrt(Y*Y+O*O),Y+=B,O+=L,B+=R,L+=F,g+=Math.sqrt(Y*Y+O*O),Y+=B,O+=L,g+=Math.sqrt(Y*Y+O*O),Y+=B+R,O+=L+F,g+=Math.sqrt(Y*Y+O*O),m[N]=g,y=T,w=C;this.data.positionMode===yn.Percent&&(o*=g);let D;switch(this.data.spacingMode){case _i.Percent:D=g;break;case _i.Proportional:D=g/s;break;default:D=1}const P=this.segments;let U=0;for(let N=0,X=0,K=0,z=0;N<s;N++,X+=3){const se=h[N]*D;o+=se;let Q=o;if(u)Q%=g,Q<0&&(Q+=g),K=0,z=0;else if(Q<0){this.addBeforePosition(Q,c,0,l,X);continue}else if(Q>g){this.addAfterPosition(Q-g,c,d-4,l,X);continue}for(;;K++){const me=m[K];if(!(Q>me)){if(K===0)Q/=me;else{const pe=m[K-1];Q=(Q-pe)/(me-pe)}break}}if(K!==p){p=K;let me=K*6;for(y=c[me],w=c[me+1],v=c[me+2],_=c[me+3],x=c[me+4],M=c[me+5],T=c[me+6],C=c[me+7],I=(y-v*2+x)*.03,k=(w-_*2+M)*.03,R=((v-x)*3-y+T)*.006,F=((_-M)*3-w+C)*.006,B=I*2+R,L=k*2+F,Y=(v-y)*.3+I+R*.16666667,O=(_-w)*.3+k+F*.16666667,U=Math.sqrt(Y*Y+O*O),P[0]=U,me=1;me<8;me++)Y+=B,O+=L,B+=R,L+=F,U+=Math.sqrt(Y*Y+O*O),P[me]=U;Y+=B,O+=L,U+=Math.sqrt(Y*Y+O*O),P[8]=U,Y+=B+R,O+=L+F,U+=Math.sqrt(Y*Y+O*O),P[9]=U,z=0}for(Q*=U;;z++){const me=P[z];if(!(Q>me)){if(z===0)Q/=me;else{const pe=P[z-1];Q=z+(Q-pe)/(me-pe)}break}}this.addCurvePosition(Q*.1,y,w,v,_,x,M,T,C,l,X,r||N>0&&se===0)}return l}addBeforePosition(t,i,s,r,a){const o=i[s],h=i[s+1],l=i[s+2]-o,c=i[s+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,s,r,a){const o=i[s+2],h=i[s+3],l=o-i[s],c=h-i[s+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,s,r,a,o,h,l,c,u,d,f){if(t===0||Number.isNaN(t)){u[d]=i,u[d+1]=s,u[d+2]=Math.atan2(a-s,r-i);return}const p=t*t,m=p*t,g=1-t,y=g*g,w=y*g,v=g*t,_=v*3,x=g*_,M=_*t,T=i*w+r*x+o*M+l*m,C=s*w+a*x+h*M+c*m;u[d]=T,u[d+1]=C,f&&(t<.001?u[d+2]=Math.atan2(a-s,r-i):u[d+2]=Math.atan2(C-(s*y+a*v*2+h*p),T-(i*y+r*v*2+o*p)))}sort(t){const i=this.slot.data.index,s=this.slot.bone;t.skin!=null&&this.sortPathSlot(t,t.skin,i,s),t.data.defaultSkin!=null&&t.data.defaultSkin!==t.skin&&this.sortPathSlot(t,t.data.defaultSkin,i,s),this.sortPath(t,this.slot.pose.attachment,s);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,s,r){const a=i.getAttachments();for(let o=0,h=a.length;o<h;o++){const l=a[o];l.slotIndex===s&&this.sortPath(t,l.attachment,r)}}sortPath(t,i,s){if(!(i instanceof wl))return;const r=i.bones;if(r==null)t.sortBone(s);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}};b(Ps,"NONE",-1),b(Ps,"BEFORE",-2),b(Ps,"AFTER",-3);let sm=Ps;var Zr;(function(n){n[n.none=0]="none",n[n.reset=1]="reset",n[n.update=2]="update",n[n.pose=3]="pose"})(Zr||(Zr={}));class nm{constructor(){b(this,"inertia",0);b(this,"strength",0);b(this,"damping",0);b(this,"massInverse",0);b(this,"wind",0);b(this,"gravity",0);b(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 rm{constructor(){b(this,"color",new ct(1,1,1,1));b(this,"darkColor",null);b(this,"attachment",null);b(this,"sequenceIndex",0);b(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 ir)||!(this.attachment instanceof ir)||e.timelineAttachment!==this.attachment.timelineAttachment)&&(this.deform.length=0),this.attachment=e,this.sequenceIndex=-1)}}class hp extends Sw{constructor(t,i){super(t,new rm,new rm);b(this,"skeleton");b(this,"bone");b(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 ct,this.constrainedPose.darkColor=new ct),this.setupPose()}copy(t,i,s){const r=new hp(t.data,this.skeleton);return this.data.setupPose.darkColor!=null&&(r.pose.darkColor=new ct,r.constrainedPose.darkColor=new ct),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 Jr=class Jr{constructor(e){b(this,"data");b(this,"bones");b(this,"slots");b(this,"drawOrder");b(this,"constraints");b(this,"physics");b(this,"_updateCache",[]);b(this,"resetCache",[]);b(this,"skin",null);b(this,"color");b(this,"scaleX",1);b(this,"_scaleY",1);b(this,"x",0);b(this,"y",0);b(this,"time",0);b(this,"windX",1);b(this,"windY",0);b(this,"gravityX",0);b(this,"gravityY",1);b(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 s;if(!i.parent)s=new nl(i,null);else{const r=this.bones[i.parent.index];s=new nl(i,r),r.children.push(s)}this.bones.push(s)}this.slots=[];for(const t of this.data.slots)this.slots.push(new hp(t,this));this.drawOrder=new e3(this.slots),this.physics=[],this.constraints=[];for(const t of this.data.constraints){const i=t.create(this);i instanceof ru&&this.physics.push(i),this.constraints.push(i)}this.color=new ct(1,1,1,1),this.updateCache()}static get yDir(){return Jr.yDown?-1:1}get scaleY(){return this._scaleY*Jr.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 s=this.constraints;let r=this.constraints.length;for(let a=0;a<r;a++)s[a].unconstrained();for(let a=0;a<r;a++){const o=s[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 nl&&(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 s=e[t];s.active&&(s.sorted&&this.sortReset(s.children),s.sorted=!1)}}updateWorldTransform(e){this._update++,this.drawOrder.appliedPose===this.drawOrder.constrainedPose&&this.drawOrder.resetConstrained();const t=this.resetCache;for(let s=0,r=this.resetCache.length;s<r;s++)t[s].resetConstrained();const i=this._updateCache;for(let s=0,r=this._updateCache.length;s<r;s++)i[s].update(this,e)}setupPose(){this.setupPoseBones(),this.setupPoseSlots()}setupPoseBones(){const e=this.bones;for(let i=0,s=e.length;i<s;i++)e[i].setupPose();const t=this.constraints;for(let i=0,s=t.length;i<s;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,s=t.length;i<s;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,s=t.length;i<s;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,s=t.length;i<s;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 s=null;if(t&&(s=this.getAttachment(i.data.index,t),!s))throw new Error(`Attachment not found: ${t}, for slot: ${e}`);i.pose.setAttachment(s)}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 s=0,r=i.length;s<r;s++){const a=i[s];if(a instanceof t&&a.data.name===e)return a}return null}getBoundsRect(e){const t=new Sv,i=new Sv;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),s=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 y=f.appliedPose.attachment;if(y){if(y instanceof fo)p=8,m=et.setArraySize(i,p,0),y.computeWorldVertices(f,y.getOffsets(f.appliedPose),m,0,2),g=Jr.quadTriangles;else if(y instanceof Pr)p=y.worldVerticesLength,m=et.setArraySize(i,p,0),y.computeWorldVertices(this,f,0,p,m,0,2),g=y.triangles;else if(y instanceof su&&s){s.clipEnd(f),s.clipStart(this,f,y);continue}if(m&&g){s!=null&&s.isClipping()&&s.clipTriangles(m,g,g.length)&&(m=s.clippedVertices,p=s.clippedVertices.length);for(let w=0,v=m.length;w<v;w+=2){const _=m[w],x=m[w+1];o=Math.min(o,_),h=Math.min(h,x),l=Math.max(l,_),c=Math.max(c,x)}}}s&&s.clipEnd(f)}s&&s.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 s=0,r=i.length;s<r;s++)i[s].translate(e,t)}physicsRotate(e,t,i){const s=this.physics;for(let r=0,a=s.length;r<a;r++)s[r].rotate(e,t,i)}};b(Jr,"quadTriangles",[0,1,2,2,3,0]),b(Jr,"yDown",!1);let am=Jr;class ru extends Fl{constructor(t,i){super(t,new nm,new nm);b(this,"bone");b(this,"_reset",!0);b(this,"ux",0);b(this,"uy",0);b(this,"cx",0);b(this,"cy",0);b(this,"tx",0);b(this,"ty",0);b(this,"xOffset",0);b(this,"xLag",0);b(this,"xVelocity",0);b(this,"yOffset",0);b(this,"yLag",0);b(this,"yVelocity",0);b(this,"rotateOffset",0);b(this,"rotateLag",0);b(this,"rotateVelocity",0);b(this,"scaleOffset",0);b(this,"scaleLag",0);b(this,"scaleVelocity",0);b(this,"remaining",0);b(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 ru(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,s){const r=s*De.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 s=this.appliedPose,r=s.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!==Zr.none){switch(c.modifyWorld(t),i){case Zr.reset:this.reset(t);case Zr.update:{const p=Math.max(t.time-this.lastTime,0),m=this.remaining;this.remaining+=p,this.lastTime=t.time;const g=c.worldX,y=c.worldY;if(this._reset)this._reset=!1,this.ux=g,this.uy=y;else{let w=this.remaining,v=s.inertia,_=t.data.referenceScale,x=-1,M=0,T=0,C=this.data.limit*p,I=C*Math.abs(t.scaleY);if(C*=Math.abs(t.scaleX),a||o){if(a){const k=(this.ux-g)*v;this.xOffset+=k>C?C:k<-C?-C:k,this.ux=g}if(o){const k=(this.uy-y)*v;this.yOffset+=k>I?I:k<-I?-I:k,this.uy=y}if(w>=d){const k=this.xOffset,R=this.yOffset;x=s.damping**(60*d),M=d*s.massInverse,T=s.strength;const F=_*s.wind,B=_*s.gravity,L=(F*t.windX+B*t.gravityX)*t.scaleX,Y=(F*t.windY+B*t.gravityY)*t.scaleY;do a&&(this.xVelocity+=(L-this.xOffset*T)*M,this.xOffset+=this.xVelocity*d,this.xVelocity*=x),o&&(this.yVelocity-=(Y+this.yOffset*T)*M,this.yOffset+=this.yVelocity*d,this.yVelocity*=x),w-=d;while(w>=d);this.xLag=this.xOffset-k,this.yLag=this.yOffset-R}f=Math.max(0,1-w/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 k=Math.atan2(c.c,c.a),R=0,F=0,B=0,L=this.cx-c.worldX,Y=this.cy-c.worldY;if(L>C?L=C:L<-C&&(L=-C),Y>I?Y=I:Y<-I&&(Y=-I),w=this.remaining,h){B=(this.data.rotate+this.data.shearX)*r,f=this.rotateLag*Math.max(0,1-m/d);let O=Math.atan2(Y+this.ty,L+this.tx)-k-(this.rotateOffset-f)*B;this.rotateOffset+=(O-Math.ceil(O*De.invPI2-.5)*De.PI2)*v,O=(this.rotateOffset-f)*B+k,R=Math.cos(O),F=Math.sin(O),l&&(O=u*c.getWorldScaleX(),O>0&&(this.scaleOffset+=(L*R+Y*F)*v/O))}else{R=Math.cos(k),F=Math.sin(k);const O=u*c.getWorldScaleX()-this.scaleLag*Math.max(0,1-m/d);O>0&&(this.scaleOffset+=(L*R+Y*F)*v/O)}if(w>=d){x===-1&&(x=s.damping**(60*d),M=d*s.massInverse,T=s.strength);const O=s.wind*t.windX+s.gravity*t.gravityX,D=(s.wind*t.windY+s.gravity*t.gravityY)*am.yDir,P=this.rotateOffset,U=this.scaleOffset,N=u/_;for(;;)if(w-=d,l&&(this.scaleVelocity+=(O*R-D*F-this.scaleOffset*T)*M,this.scaleOffset+=this.scaleVelocity*d,this.scaleVelocity*=x),h){if(this.rotateVelocity-=((O*F+D*R)*N+this.rotateOffset*T)*M,this.rotateOffset+=this.rotateVelocity*d,this.rotateVelocity*=x,w<d)break;const X=this.rotateOffset*B+k;R=Math.cos(X),F=Math.sin(X)}else if(w<d)break;this.rotateLag=this.rotateOffset-P,this.scaleLag=this.scaleOffset-U}f=Math.max(0,1-w/d)}this.remaining=w}this.cx=c.worldX,this.cy=c.worldY;break}case Zr.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,y=0;if(this.data.shearX>0){let w=0;this.data.rotate>0&&(w=p*this.data.rotate,m=Math.sin(w),g=Math.cos(w),y=c.b,c.b=g*y-m*c.d,c.d=m*y+g*c.d),w+=p*this.data.shearX,m=Math.sin(w),g=Math.cos(w),y=c.a,c.a=g*y-m*c.c,c.c=m*y+g*c.c}else p*=this.data.rotate,m=Math.sin(p),g=Math.cos(p),y=c.a,c.a=g*y-m*c.c,c.c=m*y+g*c.c,y=c.b,c.b=g*y-m*c.d,c.d=m*y+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 zi.Uniform:c.b*=p,c.d*=p;break;case zi.Volume:p=Math.abs(p),p=p>=.7?1/p:4-3.67347*p,c.b*=p,c.d*=p}}i!==Zr.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 Oc extends Ol{constructor(t){super(t,new nm);b(this,"_bone",null);b(this,"x",0);b(this,"y",0);b(this,"rotate",0);b(this,"scaleX",0);b(this,"shearX",0);b(this,"limit",0);b(this,"step",0);b(this,"inertiaGlobal",!1);b(this,"strengthGlobal",!1);b(this,"dampingGlobal",!1);b(this,"massGlobal",!1);b(this,"windGlobal",!1);b(this,"gravityGlobal",!1);b(this,"mixGlobal",!1);b(this,"_scaleYMode",zi.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 ru(this,t)}}typeof Math.fround>"u"&&(Math.fround=(n=>e=>(n[0]=e,n[0]))(new Float32Array(1)));class om{constructor(){b(this,"time",0);b(this,"mix",0)}set(e){this.time=e.time,this.mix=e.mix}}const ol=class ol extends Fl{constructor(t,i){super(t,new om,new om);b(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 ol(this.data,t);return i.pose.set(this.pose),i}update(t,i){const s=this.appliedPose;if(s.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),s.time=r.offset+(r.property.value(t,o.appliedPose,r.local,ol.offsets)-r.property.offset)*r.scale,r.loop?s.time=a.duration+s.time%a.duration:s.time=Math.max(0,s.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,s.time,s.time,r.loop,null,s.mix,Ke.current,r.additive,!1,!0)}sort(t){const i=this.bone,s=this.data;i&&!s.local&&t.sortBone(i),t._updateCache.push(this);const r=t.bones,a=s.animation.bones;for(let d=0,f=s.animation.bones.length;d<f;d++){const p=r[a[d]];p.sorted=!1,t.sortReset(p.children),t.constrained(p)}const o=s.animation.timelines,h=t.slots,l=t.constraints,c=t.physics,u=t.physics.length;for(let d=0,f=s.animation.timelines.length;d<f;d++){const p=o[d];if(zF(p))t.constrained(h[p.slotIndex]);else if(p instanceof Ir||p instanceof po)t.drawOrder.constrained();else if(p instanceof Or)if(p.constraintIndex===-1)for(let m=0;m<u;m++)t.constrained(c[m]);else t.constrained(l[p.constraintIndex]);else if(KF(p)){const m=p.constraintIndex;m!==-1&&t.constrained(l[m])}}}};b(ol,"offsets",[0,0,0,0,0,0]);let lm=ol;class Qr extends Ol{constructor(t){super(t,new om);b(this,"animation");b(this,"additive",!1);b(this,"loop",!1);b(this,"bone",null);b(this,"property");b(this,"scale",0);b(this,"offset",0);b(this,"local",!1);b(this,"max",0)}create(t){return new lm(this,t)}}class Mw{constructor(){b(this,"name",null);b(this,"bones",[]);b(this,"slots",[]);b(this,"skins",[]);b(this,"defaultSkin",null);b(this,"events",[]);b(this,"animations",[]);b(this,"constraints",[]);b(this,"x",0);b(this,"y",0);b(this,"width",0);b(this,"height",0);b(this,"referenceScale",100);b(this,"version",null);b(this,"hash",null);b(this,"fps",30);b(this,"imagesPath",null);b(this,"audioPath",null)}findBone(e){if(!e)throw new Error("boneName cannot be null.");const t=this.bones;for(let i=0,s=t.length;i<s;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,s=t.length;i<s;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,s=t.length;i<s;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,s=t.length;i<s;i++)if(t[i].name===e)return t[i];return null}findSliderAnimations(e){const t=this.constraints;for(let i=0,s=this.constraints.length;i<s;i++){const r=t[i];r instanceof Qr&&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,s=t.length;i<s;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 s=0,r=this.constraints.length;s<r;s++){const a=i[s];if(a instanceof t&&a.name===e)return a}return null}}class Iv{constructor(e=0,t,i){b(this,"slotIndex",0);b(this,"placeholder");b(this,"attachment");this.slotIndex=e,this.placeholder=t,this.attachment=i}}class cm{constructor(e){b(this,"name");b(this,"attachments",[]);b(this,"bones",[]);b(this,"constraints",[]);b(this,"color",new ct(.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 s=this.attachments;e>=s.length&&(s.length=e+1),s[e]||(s[e]={}),s[e][t]=i}addSkin(e){for(let i=0;i<e.bones.length;i++){const s=e.bones[i];let r=!1;for(let a=0;a<this.bones.length;a++)if(this.bones[a]===s){r=!0;break}r||this.bones.push(s)}for(let i=0;i<e.constraints.length;i++){const s=e.constraints[i];let r=!1;for(let a=0;a<this.constraints.length;a++)if(this.constraints[a]===s){r=!0;break}r||this.constraints.push(s)}const t=e.getAttachments();for(let i=0;i<t.length;i++){const s=t[i];this.setAttachment(s.slotIndex,s.placeholder,s.attachment)}}copySkin(e){for(let i=0;i<e.bones.length;i++){const s=e.bones[i];let r=!1;for(let a=0;a<this.bones.length;a++)if(this.bones[a]===s){r=!0;break}r||this.bones.push(s)}for(let i=0;i<e.constraints.length;i++){const s=e.constraints[i];let r=!1;for(let a=0;a<this.constraints.length;a++)if(this.constraints[a]===s){r=!0;break}r||this.constraints.push(s)}const t=e.getAttachments();for(let i=0;i<t.length;i++){const s=t[i];s.attachment&&(s.attachment instanceof Pr?(s.attachment=s.attachment.newLinkedMesh(),this.setAttachment(s.slotIndex,s.placeholder,s.attachment)):(s.attachment=s.attachment.copy(),this.setAttachment(s.slotIndex,s.placeholder,s.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 s in i){const r=i[s];r&&e.push(new Iv(t,s,r))}}return e}getAttachmentsForSlot(e,t){const i=this.attachments[e];if(i)for(const s in i){const r=i[s];r&&t.push(new Iv(e,s,r))}}clear(){this.attachments.length=0,this.bones.length=0,this.constraints.length=0}attachAll(e,t){let i=0;for(let s=0;s<e.slots.length;s++){const r=e.slots[s],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 Ew extends lp{constructor(t,i,s){super(i,new rm);b(this,"index",0);b(this,"boneData");b(this,"attachmentName",null);b(this,"blendMode",Sh.Normal);b(this,"visible",!0);if(t<0)throw new Error("index must be >= 0.");if(!s)throw new Error("boneData cannot be null.");this.index=t,this.boneData=s}}var Sh;(function(n){n[n.Normal=0]="Normal",n[n.Additive=1]="Additive",n[n.Multiply=2]="Multiply",n[n.Screen=3]="Screen"})(Sh||(Sh={}));class hm{constructor(){b(this,"mixRotate",0);b(this,"mixX",0);b(this,"mixY",0);b(this,"mixScaleX",0);b(this,"mixScaleY",0);b(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 up extends Fl{constructor(t,i){super(t,new hm,new hm);b(this,"bones");b(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 s=i.bones[t.source.index];if(s==null)throw new Error("source cannot be null.");this.source=s}copy(t){var i=new up(this.data,t);return i.pose.set(this.pose),i}update(t,i){const s=this.appliedPose;if(s.mixRotate===0&&s.mixX===0&&s.mixY===0&&s.mixScaleX===0&&s.mixScaleY===0&&s.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 y=p[m];o?y.modifyLocal(t):y.modifyWorld(t);for(let w=0;w<f;w++){const v=d[w],_=v.value(t,u,a,c)-v.offset,x=v.to;for(let M=0,T=v.to.length;M<T;M++){const C=x[M];if(C.mix(s)!==0){let I=C.offset+_*C.scale;l&&(C.offset<C.max?I=De.clamp(I,C.offset,C.max):I=De.clamp(I,C.max,C.offset)),C.apply(t,s,y,I,o,h)}}}}}sort(t){this.data.localSource||t.sortBone(this.source);const i=this.bones,s=this.bones.length,r=!this.data.localTarget;if(r)for(let a=0;a<s;a++)t.sortBone(i[a].bone);t._updateCache.push(this);for(let a=0;a<s;a++){const o=i[a].bone;t.sortReset(o.children),t.constrained(o)}for(let a=0;a<s;a++)i[a].bone.sorted=r}isSourceActive(){return this.source.active}}const fi=class fi extends Ol{constructor(t){super(t,new hm);b(this,"bones",[]);b(this,"_source",null);b(this,"offsets",[0,0,0,0,0,0]);b(this,"offsetX",0);b(this,"offsetY",0);b(this,"localSource",!1);b(this,"localTarget",!1);b(this,"additive",!1);b(this,"clamp",!1);b(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 up(this,t)}getOffsetRotation(){return this.offsets[fi.ROTATION]}setOffsetRotation(t){this.offsets[fi.ROTATION]=t}getOffsetX(){return this.offsets[fi.X]}setOffsetX(t){this.offsets[fi.X]=t}getOffsetY(){return this.offsets[fi.Y]}setOffsetY(t){this.offsets[fi.Y]=t}getOffsetScaleX(){return this.offsets[fi.SCALEX]}setOffsetScaleX(t){this.offsets[fi.SCALEX]=t}getOffsetScaleY(){return this.offsets[fi.SCALEY]}setOffsetScaleY(t){this.offsets[fi.SCALEY]=t}getOffsetShearY(){return this.offsets[fi.SHEARY]}setOffsetShearY(t){this.offsets[fi.SHEARY]=t}};b(fi,"ROTATION",0),b(fi,"X",1),b(fi,"Y",2),b(fi,"SCALEX",3),b(fi,"SCALEY",4),b(fi,"SHEARY",5);let Ot=fi;class So{constructor(){b(this,"offset",0);b(this,"to",[])}}class _o{constructor(){b(this,"offset",0);b(this,"max",0);b(this,"scale",0)}}class um extends So{value(e,t,i,s){if(i)return t.rotation+s[Ot.ROTATION];const r=e.scaleX,a=e.scaleY;let o=Math.atan2(t.c/a,t.a/r)*De.radDeg+((t.a*t.d-t.b*t.c)*r*a>0?s[Ot.ROTATION]:-s[Ot.ROTATION]);return o<0&&(o+=360),o}}class Aw extends _o{mix(e){return e.mixRotate}apply(e,t,i,s,r,a){if(r)i.rotation+=(a?s:s-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;s*=De.degRad,a||(s-=Math.atan2(f,u)),s>De.PI?s-=De.PI2:s<-De.PI&&(s+=De.PI2),s*=t.mixRotate;const m=Math.cos(s),g=Math.sin(s);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 dm extends So{value(e,t,i,s){return i?t.x+s[Ot.X]:(s[Ot.X]*t.a+s[Ot.Y]*t.b+t.worldX)/e.scaleX}}class Cw extends _o{mix(e){return e.mixX}apply(e,t,i,s,r,a){r?i.x+=(a?s:s-i.x)*t.mixX:(a||(s-=i.worldX/e.scaleX),i.worldX+=s*t.mixX*e.scaleX)}}class fm extends So{value(e,t,i,s){return i?t.y+s[Ot.Y]:(s[Ot.X]*t.c+s[Ot.Y]*t.d+t.worldY)/e.scaleY}}class Iw extends _o{mix(e){return e.mixY}apply(e,t,i,s,r,a){r?i.y+=(a?s:s-i.y)*t.mixY:(a||(s-=i.worldY/e.scaleY),i.worldY+=s*t.mixY*e.scaleY)}}class mm extends So{value(e,t,i,s){if(i)return t.scaleX+s[Ot.SCALEX];const r=t.a/e.scaleX,a=t.c/e.scaleY;return Math.sqrt(r*r+a*a)+s[Ot.SCALEX]}}class Rw extends _o{mix(e){return e.mixScaleX}apply(e,t,i,s,r,a){if(r)a?i.scaleX*=1+(s-1)*t.mixScaleX:i.scaleX!==0&&(i.scaleX+=(s-i.scaleX)*t.mixScaleX);else if(a){const o=1+(s-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+(s-l)*t.mixScaleX/l,i.a*=l,i.c*=l)}}}class pm extends So{value(e,t,i,s){if(i)return t.scaleY+s[Ot.SCALEY];const r=t.b/e.scaleX,a=t.d/e.scaleY;return Math.sqrt(r*r+a*a)+s[Ot.SCALEY]}}class Pw extends _o{mix(e){return e.mixScaleY}apply(e,t,i,s,r,a){if(r)a?i.scaleY*=1+(s-1)*t.mixScaleY:i.scaleY!==0&&(i.scaleY+=(s-i.scaleY)*t.mixScaleY);else if(a){const o=1+(s-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+(s-l)*t.mixScaleY/l,i.b*=l,i.d*=l)}}}class gm extends So{value(e,t,i,s){if(i)return t.shearY+s[Ot.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))*De.radDeg-90+s[Ot.SHEARY]}}class kw extends _o{mix(e){return e.mixShearY}apply(e,t,i,s,r,a){if(r)a||(s-=i.shearY),i.shearY+=s*t.mixShearY;else{const o=e.scaleX,h=e.scaleY,l=i.b/o,c=i.d/h,u=Math.atan2(c,l);s=(s+90)*De.degRad,a?s-=De.PI/2:(s-=u-Math.atan2(i.c/h,i.a/o),s>De.PI?s-=De.PI2:s<-De.PI&&(s+=De.PI2)),s=u+s*t.mixShearY;const d=Math.sqrt(l*l+c*c);i.b=Math.cos(s)*d*o,i.d=Math.sin(s)*d*h}}}class D4{constructor(e){b(this,"scale",1);b(this,"attachmentLoader");b(this,"linkedMeshes",[]);this.attachmentLoader=e}readSkeletonData(e){const t=this.scale,i=new Mw;i.name="";const s=new t3(e),r=s.readInt32(),a=s.readInt32();i.hash=a===0&&r===0?null:a.toString(16)+r.toString(16),i.version=s.readString(),i.x=s.readFloat(),i.y=s.readFloat(),i.width=s.readFloat(),i.height=s.readFloat(),i.referenceScale=s.readFloat()*t;const o=s.readBoolean();o&&(i.fps=s.readFloat(),i.imagesPath=s.readString(),i.audioPath=s.readString());let h=0;h=s.readInt(!0);for(let p=0;p<h;p++){const m=s.readString();if(!m)throw new Error("String in string table must not be null.");s.strings.push(m)}const l=i.bones;h=s.readInt(!0);for(let p=0;p<h;p++){const m=s.readString();if(!m)throw new Error("Bone name must not be null.");const g=p===0?null:l[s.readInt(!0)],y=new nu(p,m,g),w=y.setupPose;w.rotation=s.readFloat(),w.x=s.readFloat()*t,w.y=s.readFloat()*t,w.scaleX=s.readFloat(),w.scaleY=s.readFloat(),w.shearX=s.readFloat(),w.shearY=s.readFloat(),w.inherit=s.readByte(),y.length=s.readFloat()*t,y.skinRequired=s.readBoolean(),o&&(ct.rgba8888ToColor(y.color,s.readInt32()),y.icon=s.readString()??void 0,y.iconSize=s.readFloat(),y.iconRotation=s.readFloat(),y.visible=s.readBoolean()),l.push(y)}h=s.readInt(!0);for(let p=0;p<h;p++){const m=s.readString();if(!m)throw new Error("Slot name must not be null.");const g=l[s.readInt(!0)],y=new Ew(p,m,g);ct.rgba8888ToColor(y.setupPose.color,s.readInt32());const w=s.readInt32();w!==-1&&ct.rgb888ToColor(y.setupPose.darkColor=new ct,w),y.attachmentName=s.readStringRef(),y.blendMode=s.readInt(!0),o&&(y.visible=s.readBoolean()),i.slots.push(y)}const c=i.constraints,u=s.readInt(!0);for(let p=0;p<u;p++){const m=s.readString();if(!m)throw new Error("Constraint data name must not be null.");let g;switch(s.readByte()){case S3:{const y=new kc(m);g=s.readInt(!0);for(let _=0;_<g;_++)y.bones.push(l[s.readInt(!0)]);y.target=l[s.readInt(!0)];const w=s.readByte();y.skinRequired=(w&1)!==0,(w&2)!==0&&(y.scaleYMode=s.readUnsignedByte());const v=y.setupPose;v.bendDirection=(w&4)!==0?-1:1,v.compress=(w&8)!==0,v.stretch=(w&16)!==0,(w&32)!==0&&(v.mix=(w&64)!==0?s.readFloat():1),(w&128)!==0&&(v.softness=s.readFloat()*t),c.push(y);break}case T3:{const y=new Ot(m);g=s.readInt(!0);for(let _=0;_<g;_++)y.bones.push(l[s.readInt(!0)]);y.source=l[s.readInt(!0)];let w=s.readUnsignedByte();y.skinRequired=(w&1)!==0,y.localSource=(w&2)!==0,y.localTarget=(w&4)!==0,y.additive=(w&8)!==0,y.clamp=(w&16)!==0,g=w>>5;for(let _=0,x;_<g;_++){let M=1,T;switch(s.readByte()){case 0:T=new um;break;case 1:{M=t,T=new dm;break}case 2:{M=t,T=new fm;break}case 3:T=new mm;break;case 4:T=new pm;break;case 5:T=new gm;break;default:T=null}if(T){T.offset=s.readFloat()*M,x=s.readByte();for(let C=0;C<x;C++){let I=1,k;switch(s.readByte()){case 0:k=new Aw;break;case 1:{I=t,k=new Cw;break}case 2:{I=t,k=new Iw;break}case 3:k=new Rw;break;case 4:k=new Pw;break;case 5:k=new kw;break;default:k=null}k&&(k.offset=s.readFloat()*I,k.max=s.readFloat()*I,k.scale=s.readFloat()*I/M,T.to[C]=k)}y.properties[_]=T}}w=s.readByte(),(w&1)!==0&&(y.offsets[Ot.ROTATION]=s.readFloat()),(w&2)!==0&&(y.offsets[Ot.X]=s.readFloat()*t),(w&4)!==0&&(y.offsets[Ot.Y]=s.readFloat()*t),(w&8)!==0&&(y.offsets[Ot.SCALEX]=s.readFloat()),(w&16)!==0&&(y.offsets[Ot.SCALEY]=s.readFloat()),(w&32)!==0&&(y.offsets[Ot.SHEARY]=s.readFloat()),w=s.readByte();const v=y.setupPose;(w&1)!==0&&(v.mixRotate=s.readFloat()),(w&2)!==0&&(v.mixX=s.readFloat()),(w&4)!==0&&(v.mixY=s.readFloat()),(w&8)!==0&&(v.mixScaleX=s.readFloat()),(w&16)!==0&&(v.mixScaleY=s.readFloat()),(w&32)!==0&&(v.mixShearY=s.readFloat()),c.push(y);break}case _3:{const y=new Fc(m);g=s.readInt(!0);for(let _=0;_<g;_++)y.bones.push(l[s.readInt(!0)]);y.slot=i.slots[s.readInt(!0)];const w=s.readByte();y.skinRequired=(w&1)!==0,y.positionMode=w>>1&1,y.spacingMode=w>>2&3,y.rotateMode=w>>4&3,(w&128)!==0&&(y.offsetRotation=s.readFloat());const v=y.setupPose;v.position=s.readFloat(),y.positionMode===yn.Fixed&&(v.position*=t),v.spacing=s.readFloat(),(y.spacingMode===_i.Length||y.spacingMode===_i.Fixed)&&(v.spacing*=t),v.mixRotate=s.readFloat(),v.mixX=s.readFloat(),v.mixY=s.readFloat(),c.push(y);break}case M3:{const y=new Oc(m);y.bone=l[s.readInt(!0)];let w=s.readByte();if(y.skinRequired=(w&1)!==0,(w&2)!==0&&(y.x=s.readFloat()),(w&4)!==0&&(y.y=s.readFloat()),(w&8)!==0&&(y.rotate=s.readFloat()),(w&16)!==0){let _=s.readFloat();_<-2?(y.scaleYMode=zi.Volume,_=-2-_):_<0&&(y.scaleYMode=zi.Uniform,_=-1-_),y.scaleX=_}(w&32)!==0&&(y.shearX=s.readFloat()),y.limit=((w&64)!==0?s.readFloat():5e3)*t,y.step=1/s.readUnsignedByte();const v=y.setupPose;v.inertia=s.readFloat(),v.strength=s.readFloat(),v.damping=s.readFloat(),v.massInverse=(w&128)!==0?s.readFloat():1,v.wind=s.readFloat(),v.gravity=s.readFloat(),w=s.readByte(),(w&1)!==0&&(y.inertiaGlobal=!0),(w&2)!==0&&(y.strengthGlobal=!0),(w&4)!==0&&(y.dampingGlobal=!0),(w&8)!==0&&(y.massGlobal=!0),(w&16)!==0&&(y.windGlobal=!0),(w&32)!==0&&(y.gravityGlobal=!0),(w&64)!==0&&(y.mixGlobal=!0),v.mix=(w&128)!==0?s.readFloat():1,c.push(y);break}case E3:{const y=new Qr(m),w=s.readByte();if(y.skinRequired=(w&1)!==0,y.loop=(w&2)!==0,y.additive=(w&4)!==0,(w&8)!==0){const v=s.readFloat();o&&(w&64)!==0?y.max=v:y.setupPose.time=v}if((w&16)!==0&&(y.setupPose.mix=(w&32)!==0?s.readFloat():1),(w&64)!==0){y.local=(w&128)!==0,y.bone=l[s.readInt(!0)];const v=s.readFloat();let _=1;switch(s.readByte()){case 0:y.property=new um;break;case 1:{_=t,y.property=new dm;break}case 2:{_=t,y.property=new fm;break}case 3:y.property=new mm;break;case 4:y.property=new pm;break;case 5:y.property=new gm;break;default:continue}y.property.offset=v*_,y.offset=s.readFloat(),y.scale=s.readFloat()/_}c.push(y);break}}}const d=this.readSkin(s,i,!0,o);d&&(i.defaultSkin=d,i.skins.push(d));{let p=i.skins.length;for(et.setArraySize(i.skins,h=p+s.readInt(!0));p<h;p++){const m=this.readSkin(s,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 y=g.getAttachment(m.sourceIndex,m.source);if(!y)throw new Error(`Source mesh not found: ${m.source}`);m.mesh.timelineAttachment=m.inheritTimelines?y:m.mesh,m.mesh.setSourceMesh(y),m.mesh.updateSequence()}this.linkedMeshes.length=0,h=s.readInt(!0);for(let p=0;p<h;p++){const m=s.readString();if(!m)throw new Error("Event data name must not be null");const g=new Tw(m),y=g.setupPose;y.intValue=s.readInt(!1),y.floatValue=s.readFloat(),y.stringValue=s.readString(),g._audioPath=s.readString(),g.audioPath&&(y.volume=s.readFloat(),y.balance=s.readFloat()),i.events.push(g)}const f=i.animations;h=s.readInt(!0);for(let p=0;p<h;p++){const m=s.readString();if(!m)throw new Error("Animation name must not be null.");f.push(this.readAnimation(s,m,i,o))}for(let p=0;p<u;p++){const m=c[p];m instanceof Qr&&(m.animation=f[s.readInt(!0)])}return i}readSkin(e,t,i,s){let r=null,a=0;if(i){if(a=e.readInt(!0),a===0)return null;r=new cm("default")}else{const o=e.readString();if(!o)throw new Error("Skin name must not be null.");r=new cm(o),s&&ct.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,s);d&&r.setAttachment(h,u,d)}}return r}readAttachment(e,t,i,s,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 Fn.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(),y=e.readFloat(),w=e.readFloat(),v=e.readFloat();c||(c=l);const _=this.attachmentLoader.newRegionAttachment(i,r,l,c,d);return _?(_.path=c,_.x=p*o,_.y=m*o,_.scaleX=g,_.scaleY=y,_.rotation=f,_.width=w*o,_.height=v*o,ct.rgba8888ToColor(_.color,u),_.updateSequence(),_):null}case Fn.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&&ct.rgba8888ToColor(d.color,u),d):null}case Fn.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),y=e.readInt(!0);let w=null;if(y>0){w=[];for(let T=0;T<y;T++)w[T]=e.readInt(!0)}let v=[],_=0,x=0;a&&(v=this.readShortArray(e,e.readInt(!0)),_=e.readFloat(),x=e.readFloat()),c||(c=l);const M=this.attachmentLoader.newMeshAttachment(i,r,l,c,d);return M?(M.path=c,ct.rgba8888ToColor(M.color,u),M.hullLength=f<<1,M.bones=p.bones,M.vertices=p.vertices,M.worldVerticesLength=p.length,M.regionUVs=m,M.triangles=g,w&&(M.timelineSlots=w),a&&(M.edges=v,M.width=_*o,M.height=x*o),M.updateSequence(),M):null}case Fn.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 y=0,w=0;a&&(y=e.readFloat(),w=e.readFloat());const v=this.attachmentLoader.newMeshAttachment(i,r,l,c,d);return v?(v.path=c,ct.rgba8888ToColor(v.color,u),a&&(v.width=y*o,v.height=w*o),this.linkedMeshes.push(new i3(v,m,s,p,g,f)),v):null}case Fn.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&&ct.rgba8888ToColor(m.color,p),m):null}case Fn.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&&ct.rgba8888ToColor(p.color,f),p):null}case Fn.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&&ct.rgba8888ToColor(f.color,d),f):null}}}readSequence(e,t){if(!t)return new mo(1,!1);const i=new mo(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 Rv(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 Rv(o,et.toFloatArray(h),r)}readFloatArray(e,t,i){const s=[];if(i===1)for(let r=0;r<t;r++)s[r]=e.readFloat();else for(let r=0;r<t;r++)s[r]=e.readFloat()*i;return s}readShortArray(e,t){const i=[];for(let s=0;s<t;s++)i[s]=e.readInt(!0);return i}readAnimation(e,t,i,s){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,y=e.readInt(!0);g<y;g++){const w=e.readByte(),v=e.readInt(!0),_=v-1;switch(w){case g3:{const x=new sl(v,m);for(let M=0;M<v;M++)x.setFrame(M,e.readFloat(),e.readStringRef());r.push(x);break}case v3:{const x=e.readInt(!0),M=new iw(v,x,m);let T=e.readFloat(),C=e.readUnsignedByte()/255,I=e.readUnsignedByte()/255,k=e.readUnsignedByte()/255,R=e.readUnsignedByte()/255;for(let F=0,B=0;M.setFrame(F,T,C,I,k,R),F!==_;F++){const L=e.readFloat(),Y=e.readUnsignedByte()/255,O=e.readUnsignedByte()/255,D=e.readUnsignedByte()/255,P=e.readUnsignedByte()/255;switch(e.readByte()){case rn:M.setStepped(F);break;case an:Ct(e,M,B++,F,0,T,L,C,Y,1),Ct(e,M,B++,F,1,T,L,I,O,1),Ct(e,M,B++,F,2,T,L,k,D,1),Ct(e,M,B++,F,3,T,L,R,P,1)}T=L,C=Y,I=O,k=D,R=P}r.push(M);break}case y3:{const x=e.readInt(!0),M=new sw(v,x,m);let T=e.readFloat(),C=e.readUnsignedByte()/255,I=e.readUnsignedByte()/255,k=e.readUnsignedByte()/255;for(let R=0,F=0;M.setFrame(R,T,C,I,k),R!==_;R++){const B=e.readFloat(),L=e.readUnsignedByte()/255,Y=e.readUnsignedByte()/255,O=e.readUnsignedByte()/255;switch(e.readByte()){case rn:M.setStepped(R);break;case an:Ct(e,M,F++,R,0,T,B,C,L,1),Ct(e,M,F++,R,1,T,B,I,Y,1),Ct(e,M,F++,R,2,T,B,k,O,1)}T=B,C=L,I=Y,k=O}r.push(M);break}case x3:{const x=e.readInt(!0),M=new rw(v,x,m);let T=e.readFloat(),C=e.readUnsignedByte()/255,I=e.readUnsignedByte()/255,k=e.readUnsignedByte()/255,R=e.readUnsignedByte()/255,F=e.readUnsignedByte()/255,B=e.readUnsignedByte()/255,L=e.readUnsignedByte()/255;for(let Y=0,O=0;M.setFrame(Y,T,C,I,k,R,F,B,L),Y!==_;Y++){const D=e.readFloat(),P=e.readUnsignedByte()/255,U=e.readUnsignedByte()/255,N=e.readUnsignedByte()/255,X=e.readUnsignedByte()/255,K=e.readUnsignedByte()/255,z=e.readUnsignedByte()/255,se=e.readUnsignedByte()/255;switch(e.readByte()){case rn:M.setStepped(Y);break;case an:Ct(e,M,O++,Y,0,T,D,C,P,1),Ct(e,M,O++,Y,1,T,D,I,U,1),Ct(e,M,O++,Y,2,T,D,k,N,1),Ct(e,M,O++,Y,3,T,D,R,X,1),Ct(e,M,O++,Y,4,T,D,F,K,1),Ct(e,M,O++,Y,5,T,D,B,z,1),Ct(e,M,O++,Y,6,T,D,L,se,1)}T=D,C=P,I=U,k=N,R=X,F=K,B=z,L=se}r.push(M);break}case b3:{const x=e.readInt(!0),M=new aw(v,x,m);let T=e.readFloat(),C=e.readUnsignedByte()/255,I=e.readUnsignedByte()/255,k=e.readUnsignedByte()/255,R=e.readUnsignedByte()/255,F=e.readUnsignedByte()/255,B=e.readUnsignedByte()/255;for(let L=0,Y=0;M.setFrame(L,T,C,I,k,R,F,B),L!==_;L++){const O=e.readFloat(),D=e.readUnsignedByte()/255,P=e.readUnsignedByte()/255,U=e.readUnsignedByte()/255,N=e.readUnsignedByte()/255,X=e.readUnsignedByte()/255,K=e.readUnsignedByte()/255;switch(e.readByte()){case rn:M.setStepped(L);break;case an:Ct(e,M,Y++,L,0,T,O,C,D,1),Ct(e,M,Y++,L,1,T,O,I,P,1),Ct(e,M,Y++,L,2,T,O,k,U,1),Ct(e,M,Y++,L,3,T,O,R,N,1),Ct(e,M,Y++,L,4,T,O,F,X,1),Ct(e,M,Y++,L,5,T,O,B,K,1)}T=O,C=D,I=P,k=U,R=N,F=X,B=K}r.push(M);break}case w3:{const x=new nw(v,e.readInt(!0),m);let M=e.readFloat(),T=e.readUnsignedByte()/255;for(let C=0,I=0;x.setFrame(C,M,T),C!==_;C++){const k=e.readFloat(),R=e.readUnsignedByte()/255;switch(e.readByte()){case rn:x.setStepped(C);break;case an:Ct(e,x,I++,C,0,M,k,T,R,1)}M=k,T=R}r.push(x)}}}}for(let f=0,p=e.readInt(!0);f<p;f++){const m=e.readInt(!0);for(let g=0,y=e.readInt(!0);g<y;g++){const w=e.readByte(),v=e.readInt(!0);if(w===p3){const x=new tw(v,m);for(let M=0;M<v;M++)x.setFrame(M,e.readFloat(),e.readByte());r.push(x);continue}const _=e.readInt(!0);switch(w){case r3:ui(e,r,new xh(v,_,m),1);break;case a3:ui(e,r,new jb(v,_,m),a);break;case o3:ui(e,r,new Wb(v,_,m),a);break;case l3:ui(e,r,new zb(v,_,m),a);break;case c3:ui(e,r,new qb(v,_,m),1);break;case h3:ui(e,r,new Kb(v,_,m),1);break;case u3:ui(e,r,new Zb(v,_,m),1);break;case d3:ui(e,r,new Jb(v,_,m),1);break;case f3:ui(e,r,new Qb(v,_,m),1);break;case m3:ui(e,r,new ew(v,_,m),1);break}}}for(let f=0,p=e.readInt(!0);f<p;f++){const m=e.readInt(!0),g=e.readInt(!0),y=g-1,w=new lw(g,e.readInt(!0),m);let v=e.readByte(),_=e.readFloat(),x=(v&1)!==0?(v&2)!==0?e.readFloat():1:0,M=(v&4)!==0?e.readFloat()*a:0;for(let T=0,C=0;w.setFrame(T,_,x,M,(v&8)!==0?1:-1,(v&16)!==0,(v&32)!==0),T!==y;T++){v=e.readByte();const I=e.readFloat(),k=(v&1)!==0?(v&2)!==0?e.readFloat():1:0,R=(v&4)!==0?e.readFloat()*a:0;(v&64)!==0?w.setStepped(T):(v&128)!==0&&(Ct(e,w,C++,T,0,_,I,x,k,1),Ct(e,w,C++,T,1,_,I,M,R,a)),_=I,x=k,M=R}r.push(w)}for(let f=0,p=e.readInt(!0);f<p;f++){const m=e.readInt(!0),g=e.readInt(!0),y=g-1,w=new cw(g,e.readInt(!0),m);let v=e.readFloat(),_=e.readFloat(),x=e.readFloat(),M=e.readFloat(),T=e.readFloat(),C=e.readFloat(),I=e.readFloat();for(let k=0,R=0;w.setFrame(k,v,_,x,M,T,C,I),k!==y;k++){const F=e.readFloat(),B=e.readFloat(),L=e.readFloat(),Y=e.readFloat(),O=e.readFloat(),D=e.readFloat(),P=e.readFloat();switch(e.readByte()){case rn:w.setStepped(k);break;case an:Ct(e,w,R++,k,0,v,F,_,B,1),Ct(e,w,R++,k,1,v,F,x,L,1),Ct(e,w,R++,k,2,v,F,M,Y,1),Ct(e,w,R++,k,3,v,F,T,O,1),Ct(e,w,R++,k,4,v,F,C,D,1),Ct(e,w,R++,k,5,v,F,I,P,1)}v=F,_=B,x=L,M=Y,T=O,C=D,I=P}r.push(w)}for(let f=0,p=e.readInt(!0);f<p;f++){const m=e.readInt(!0),g=i.constraints[m];for(let y=0,w=e.readInt(!0);y<w;y++){const v=e.readByte(),_=e.readInt(!0),x=e.readInt(!0);switch(v){case I3:ui(e,r,new hw(_,x,m),g.positionMode===yn.Fixed?a:1);break;case R3:ui(e,r,new uw(_,x,m),g.spacingMode===_i.Length||g.spacingMode===_i.Fixed?a:1);break;case P3:{const M=new dw(_,x,m);let T=e.readFloat(),C=e.readFloat(),I=e.readFloat(),k=e.readFloat();for(let R=0,F=0,B=M.getFrameCount()-1;M.setFrame(R,T,C,I,k),R!==B;R++){const L=e.readFloat(),Y=e.readFloat(),O=e.readFloat(),D=e.readFloat();switch(e.readByte()){case rn:M.setStepped(R);break;case an:Ct(e,M,F++,R,0,T,L,C,Y,1),Ct(e,M,F++,R,1,T,L,I,O,1),Ct(e,M,F++,R,2,T,L,k,D,1)}T=L,C=Y,I=O,k=D}r.push(M)}}}}for(let f=0,p=e.readInt(!0);f<p;f++){const m=e.readInt(!0)-1;for(let g=0,y=e.readInt(!0);g<y;g++){const w=e.readByte(),v=e.readInt(!0);if(w===U3){const x=new wh(v,m);for(let M=0;M<v;M++)x.setFrame(M,e.readFloat());r.push(x);continue}const _=e.readInt(!0);switch(w){case k3:ui(e,r,new fw(v,_,m),1);break;case F3:ui(e,r,new mw(v,_,m),1);break;case O3:ui(e,r,new pw(v,_,m),1);break;case B3:ui(e,r,new gw(v,_,m),1);break;case L3:ui(e,r,new vw(v,_,m),1);break;case D3:ui(e,r,new yw(v,_,m),1);break;case N3:ui(e,r,new xw(v,_,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,y=e.readInt(!0);g<y;g++){const w=e.readByte(),v=e.readInt(!0),_=e.readInt(!0);switch(w){case X3:ui(e,r,new bw(v,_,m),1);break;case Y3:ui(e,r,new ww(v,_,m),1);break;default:throw new Error(`Uknown slider type: ${w}`)}}}for(let f=0,p=e.readInt(!0);f<p;f++){const m=i.skins[e.readInt(!0)];for(let g=0,y=e.readInt(!0);g<y;g++){const w=e.readInt(!0);for(let v=0,_=e.readInt(!0);v<_;v++){const x=e.readStringRef();if(!x)throw new Error("attachmentName must not be null.");const M=m.getAttachment(w,x),T=e.readByte(),C=e.readInt(!0),I=C-1;switch(T){case A3:{const k=M,R=k.bones,F=k.vertices,B=R?F.length/3*2:F.length,L=e.readInt(!0),Y=new ow(C,L,w,k);let O=e.readFloat();for(let D=0,P=0;;D++){let U,N=e.readInt(!0);if(N===0)U=R?et.newFloatArray(B):F;else{U=et.newFloatArray(B);const K=e.readInt(!0);if(N+=K,a===1)for(let z=K;z<N;z++)U[z]=e.readFloat();else for(let z=K;z<N;z++)U[z]=e.readFloat()*a;if(!R)for(let z=0,se=U.length;z<se;z++)U[z]+=F[z]}if(Y.setFrame(D,O,U),D===I)break;const X=e.readFloat();switch(e.readByte()){case rn:Y.setStepped(D);break;case an:Ct(e,Y,P++,D,0,O,X,0,1,1)}O=X}r.push(Y);break}case C3:{const k=new bh(C,w,M);for(let R=0;R<C;R++){const F=e.readFloat(),B=e.readInt32();k.setFrame(R,F,Hb[B&15],B>>4,e.readFloat())}r.push(k);break}}}}}const o=i.slots.length,h=e.readInt(!0);if(h>0){const f=new Ir(h);for(let p=0;p<h;p++)f.setFrame(p,e.readFloat(),Pv(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 w=0;w<p;w++)m[w]=e.readInt(!0);const g=e.readInt(!0),y=new po(g,m,o);for(let w=0;w<g;w++)y.setFrame(w,e.readFloat(),Pv(e,p));r.push(y)}const c=e.readInt(!0);if(c>0){const f=new bl(c);for(let p=0;p<c;p++){const m=e.readFloat(),g=i.events[e.readInt(!0)],y=new cp(m,g);y.intValue=e.readInt(!1),y.floatValue=e.readFloat(),y.stringValue=e.readString(),y.stringValue==null&&(y.stringValue=g.setupPose.stringValue),y.data.audioPath&&(y.volume=e.readFloat(),y.balance=e.readFloat()),f.setFrame(p,y)}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 np(t,r,u);return s&&ct.rgba8888ToColor(d.color,e.readInt32()),d}}class t3{constructor(e,t=[],i=0,s=new DataView(e instanceof ArrayBuffer?e:e.buffer)){b(this,"strings");b(this,"index");b(this,"buffer");this.strings=t,this.index=i,this.buffer=s}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 s=this.readUnsignedByte();switch(s>>4){case 12:case 13:t+=String.fromCharCode((s&31)<<6|this.readByte()&63),i+=2;break;case 14:t+=String.fromCharCode((s&15)<<12|(this.readByte()&63)<<6|this.readByte()&63),i+=3;break;default:t+=String.fromCharCode(s),i++}}return t}readFloat(){const e=this.buffer.getFloat32(this.index);return this.index+=4,e}readBoolean(){return this.readByte()!==0}}let i3=class{constructor(e,t,i,s,r,a){b(this,"source");b(this,"skinIndex");b(this,"slotIndex");b(this,"sourceIndex");b(this,"mesh");b(this,"inheritTimelines");this.mesh=e,this.skinIndex=t,this.slotIndex=i,this.sourceIndex=s,this.source=r,this.inheritTimelines=a}};class Rv{constructor(e=null,t,i=0){b(this,"bones");b(this,"vertices");b(this,"length");this.bones=e,this.vertices=t,this.length=i}}var Fn;(function(n){n[n.Region=0]="Region",n[n.BoundingBox=1]="BoundingBox",n[n.Mesh=2]="Mesh",n[n.LinkedMesh=3]="LinkedMesh",n[n.Path=4]="Path",n[n.Point=5]="Point",n[n.Clipping=6]="Clipping"})(Fn||(Fn={}));function ui(n,e,t,i){t instanceof Gn?s3(n,e,t,i):n3(n,e,t,i)}function s3(n,e,t,i){let s=n.readFloat(),r=n.readFloat()*i;for(let a=0,o=0,h=t.getFrameCount()-1;t.setFrame(a,s,r),a!==h;a++){const l=n.readFloat(),c=n.readFloat()*i;switch(n.readByte()){case rn:t.setStepped(a);break;case an:Ct(n,t,o++,a,0,s,l,r,c,i)}s=l,r=c}e.push(t)}function n3(n,e,t,i){let s=n.readFloat(),r=n.readFloat()*i,a=n.readFloat()*i;for(let o=0,h=0,l=t.getFrameCount()-1;t.setFrame(o,s,r,a),o!==l;o++){const c=n.readFloat(),u=n.readFloat()*i,d=n.readFloat()*i;switch(n.readByte()){case rn:t.setStepped(o);break;case an:Ct(n,t,h++,o,0,s,c,r,u,i),Ct(n,t,h++,o,1,s,c,a,d,i)}s=c,r=u,a=d}e.push(t)}function Pv(n,e){const t=n.readInt(!0);if(t===0)return null;const i=new Array(e).fill(-1),s=new Array(e-t);let r=0,a=0;for(let o=0;o<t;o++){const h=n.readInt(!0);for(;r!==h;)s[a++]=r++;i[r+n.readInt(!0)]=r++}for(;r<e;)s[a++]=r++;for(let o=e-1;o>=0;o--)i[o]===-1&&(i[o]=s[--a]);return i}function Ct(n,e,t,i,s,r,a,o,h,l){e.setBezier(t,i,s,r,o,n.readFloat(),n.readFloat()*l,n.readFloat(),n.readFloat()*l,a,h)}const r3=0,a3=1,o3=2,l3=3,c3=4,h3=5,u3=6,d3=7,f3=8,m3=9,p3=10,g3=0,v3=1,y3=2,x3=3,b3=4,w3=5,S3=0,_3=1,T3=2,M3=3,E3=4,A3=0,C3=1,I3=0,R3=1,P3=2,k3=0,F3=1,O3=2,B3=4,L3=5,D3=6,N3=7,U3=8,X3=0,Y3=1,rn=1,an=2;class V3{constructor(e){b(this,"attachmentLoader");b(this,"scale",1);b(this,"linkedMeshes",[]);this.attachmentLoader=e}readSkeletonData(e){const t=this.scale,i=new Mw,s=typeof e=="string"?JSON.parse(e):e,r=s.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=ie(r,"referenceScale",100)*t,i.fps=r.fps,i.imagesPath=r.images??null,i.audioPath=r.audio??null),s.bones)for(let a=0;a<s.bones.length;a++){const o=s.bones[a];let h=null;const l=ie(o,"parent",null);l&&(h=i.findBone(l));const c=new nu(i.bones.length,o.name,h);c.length=ie(o,"length",0)*t;const u=c.setupPose;u.x=ie(o,"x",0)*t,u.y=ie(o,"y",0)*t,u.rotation=ie(o,"rotation",0),u.scaleX=ie(o,"scaleX",1),u.scaleY=ie(o,"scaleY",1),u.shearX=ie(o,"shearX",0),u.shearY=ie(o,"shearY",0),u.inherit=et.enumValue(si,ie(o,"inherit","Normal")),c.skinRequired=ie(o,"skin",!1);const d=ie(o,"color",null);d&&c.color.setFromString(d),c.icon=ie(o,"icon",void 0),c.iconSize=ie(o,"iconSize",1),c.iconRotation=ie(o,"iconRotation",0),i.bones.push(c)}if(s.slots)for(let a=0;a<s.slots.length;a++){const o=s.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 Ew(i.slots.length,h,l),u=ie(o,"color",null);u&&c.setupPose.color.setFromString(u);const d=ie(o,"dark",null);d&&(c.setupPose.darkColor=ct.fromString(d)),c.attachmentName=ie(o,"attachment",null),c.blendMode=et.enumValue(Sh,ie(o,"blend","normal")),c.visible=ie(o,"visible",!0),i.slots.push(c)}if(s.constraints)for(const a of s.constraints){const o=a.name,h=ie(a,"skin",!1);switch(ie(a,"type",!1)){case"ik":{const l=new kc(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=ie(a,"scaleY",null);d!=null&&(l.scaleYMode=et.enumValue(zi,d));const f=l.setupPose;f.mix=ie(a,"mix",1),f.softness=ie(a,"softness",0)*t,f.bendDirection=ie(a,"bendPositive",!0)?1:-1,f.compress=ie(a,"compress",!1),f.stretch=ie(a,"stretch",!1),i.constraints.push(l);break}case"transform":{const l=new Ot(o);l.skinRequired=h;for(let _=0;_<a.bones.length;_++){const x=a.bones[_],M=i.findBone(x);if(!M)throw new Error(`Couldn't find bone ${x} for transform constraint ${a.name}.`);l.bones.push(M)}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=ie(a,"localSource",!1),l.localTarget=ie(a,"localTarget",!1),l.additive=ie(a,"additive",!1),l.clamp=ie(a,"clamp",!1);let d=!1,f=!1,p=!1,m=!1,g=!1,y=!1;const w=Object.entries(ie(a,"properties",{}));for(const[_,x]of w){const M=this.fromProperty(_),T=this.propertyScale(_,t);M.offset=ie(x,"offset",0)*T;const C=Object.entries(ie(x,"to",{}));for(const[I,k]of C){let R=1,F;switch(I){case"rotate":{d=!0,F=new Aw;break}case"x":{f=!0,F=new Cw,R=t;break}case"y":{p=!0,F=new Iw,R=t;break}case"scaleX":{m=!0,F=new Rw;break}case"scaleY":{g=!0,F=new Pw;break}case"shearY":{y=!0,F=new kw;break}default:throw new Error(`Invalid transform constraint to property: ${I}`)}F.offset=ie(k,"offset",0)*R,F.max=ie(k,"max",1)*R,F.scale=ie(k,"scale",1)*R/T,M.to.push(F)}M.to.length>0&&l.properties.push(M)}l.offsets[Ot.ROTATION]=ie(a,"rotation",0),l.offsets[Ot.X]=ie(a,"x",0)*t,l.offsets[Ot.Y]=ie(a,"y",0)*t,l.offsets[Ot.SCALEX]=ie(a,"scaleX",0),l.offsets[Ot.SCALEY]=ie(a,"scaleY",0),l.offsets[Ot.SHEARY]=ie(a,"shearY",0);const v=l.setupPose;d&&(v.mixRotate=ie(a,"mixRotate",1)),f&&(v.mixX=ie(a,"mixX",1)),p&&(v.mixY=ie(a,"mixY",v.mixX)),m&&(v.mixScaleX=ie(a,"mixScaleX",1)),g&&(v.mixScaleY=ie(a,"mixScaleY",v.mixScaleX)),y&&(v.mixShearY=ie(a,"mixShearY",1)),i.constraints.push(l);break}case"path":{const l=new Fc(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=et.enumValue(yn,ie(a,"positionMode","Percent")),l.spacingMode=et.enumValue(_i,ie(a,"spacingMode","Length")),l.rotateMode=et.enumValue(ua,ie(a,"rotateMode","Tangent")),l.offsetRotation=ie(a,"rotation",0);const d=l.setupPose;d.position=ie(a,"position",0),l.positionMode===yn.Fixed&&(d.position*=t),d.spacing=ie(a,"spacing",0),(l.spacingMode===_i.Length||l.spacingMode===_i.Fixed)&&(d.spacing*=t),d.mixRotate=ie(a,"mixRotate",1),d.mixX=ie(a,"mixX",1),d.mixY=ie(a,"mixY",d.mixX),i.constraints.push(l);break}case"physics":{const l=new Oc(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=ie(a,"x",0),l.y=ie(a,"y",0),l.rotate=ie(a,"rotate",0),l.scaleX=ie(a,"scaleX",0);const d=ie(a,"scaleY",null);d!=null&&(l.scaleYMode=et.enumValue(zi,d)),l.shearX=ie(a,"shearX",0),l.limit=ie(a,"limit",5e3)*t,l.step=1/ie(a,"fps",60);const f=l.setupPose;f.inertia=ie(a,"inertia",.5),f.strength=ie(a,"strength",100),f.damping=ie(a,"damping",.85),f.massInverse=1/ie(a,"mass",1),f.wind=ie(a,"wind",0),f.gravity=ie(a,"gravity",0),f.mix=ie(a,"mix",1),l.inertiaGlobal=ie(a,"inertiaGlobal",!1),l.strengthGlobal=ie(a,"strengthGlobal",!1),l.dampingGlobal=ie(a,"dampingGlobal",!1),l.massGlobal=ie(a,"massGlobal",!1),l.windGlobal=ie(a,"windGlobal",!1),l.gravityGlobal=ie(a,"gravityGlobal",!1),l.mixGlobal=ie(a,"mixGlobal",!1),i.constraints.push(l);break}case"slider":{const l=new Qr(o);l.skinRequired=h,l.additive=ie(a,"additive",!1),l.loop=ie(a,"loop",!1),l.setupPose.mix=ie(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=ie(a,"from",0)*d,l.offset=ie(a,"to",0),l.scale=ie(a,"scale",1)/d,l.max=ie(a,"max",0),l.local=ie(a,"local",!1)}else l.setupPose.time=ie(a,"time",0);i.constraints.push(l);break}}}if(s.skins)for(let a=0;a<s.skins.length;a++){const o=s.skins[a],h=new cm(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,kc);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,Ot);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,Fc);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,Oc);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,Qr);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,s.events)for(const a in s.events){const o=s.events[a],h=new Tw(a),l=h.setupPose;l.intValue=ie(o,"int",0),l.floatValue=ie(o,"float",0),l.stringValue=ie(o,"string",""),h._audioPath=ie(o,"audio",null),h.audioPath&&(l.volume=ie(o,"volume",l.volume),l.balance=ie(o,"balance",l.balance)),i.events.push(h)}if(s.animations)for(const a in s.animations){const o=s.animations[a];this.readAnimation(o,a,i)}if(s.constraints)for(const a in s.constraints){const o=s.constraints[a];if(o.type==="slider"){const h=i.findConstraint(o.name,Qr),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 um;break;case"x":t=new dm;break;case"y":t=new fm;break;case"scaleX":t=new mm;break;case"scaleY":t=new pm;break;case"shearY":t=new gm;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,s,r){const a=this.scale,o=ie(e,"name",s);switch(ie(e,"type","region")){case"region":{const h=ie(e,"path",o),l=this.readSequence(ie(e,"sequence",null)),c=this.attachmentLoader.newRegionAttachment(t,s,o,h,l);if(!c)return null;c.path=h,c.x=ie(e,"x",0)*a,c.y=ie(e,"y",0)*a,c.scaleX=ie(e,"scaleX",1),c.scaleY=ie(e,"scaleY",1),c.rotation=ie(e,"rotation",0),c.width=e.width*a,c.height=e.height*a;const u=ie(e,"color",null);return u&&c.color.setFromString(u),c.updateSequence(),c}case"boundingbox":{const h=this.attachmentLoader.newBoundingBoxAttachment(t,s,o);if(!h)return null;this.readVertices(e,h,e.vertexCount<<1);const l=ie(e,"color",null);return l&&h.color.setFromString(l),h}case"mesh":case"linkedmesh":{const h=ie(e,"path",o),l=this.readSequence(ie(e,"sequence",null)),c=this.attachmentLoader.newMeshAttachment(t,s,o,h,l);if(!c)return null;c.path=h;const u=ie(e,"color",null);u&&c.color.setFromString(u),c.width=ie(e,"width",0)*a,c.height=ie(e,"height",0)*a;const d=ie(e,"source",null);if(d){let p=i;const m=ie(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 $3(c,ie(e,"skin",null),i,p,d,ie(e,"timelines",!0))),c}const f=e.uvs;return this.readVertices(e,c,f.length),c.triangles=e.triangles,c.regionUVs=f,c.edges=ie(e,"edges",null),c.hullLength=ie(e,"hull",0)*2,c.updateSequence(),c}case"path":{const h=this.attachmentLoader.newPathAttachment(t,s,o);if(!h)return null;h.closed=ie(e,"closed",!1),h.constantSpeed=ie(e,"constantSpeed",!0);const l=e.vertexCount;this.readVertices(e,h,l<<1);const c=et.newArray(l/3,0);for(let d=0;d<e.lengths.length;d++)c[d]=e.lengths[d]*a;h.lengths=c;const u=ie(e,"color",null);return u&&h.color.setFromString(u),h}case"point":{const h=this.attachmentLoader.newPointAttachment(t,s,o);if(!h)return null;h.x=ie(e,"x",0)*a,h.y=ie(e,"y",0)*a,h.rotation=ie(e,"rotation",0);const l=ie(e,"color",null);return l&&h.color.setFromString(l),h}case"clipping":{const h=this.attachmentLoader.newClippingAttachment(t,s,o);if(!h)return null;const l=ie(e,"end",null);l&&(h.endSlot=r.findSlot(l)),h.convex=ie(e,"convex",!1),h.inverse=ie(e,"inverse",!1);const c=e.vertexCount;this.readVertices(e,h,c<<1);const u=ie(e,"color",null);return u&&h.color.setFromString(u),h}}return null}readSequence(e){if(e==null)return new mo(1,!1);const t=new mo(ie(e,"count",0),!0);return t.start=ie(e,"start",1),t.digits=ie(e,"digits",0),t.setupIndex=ie(e,"setup",0),t}readVertices(e,t,i){const s=this.scale;t.worldVerticesLength=i;const r=e.vertices;if(i===r.length){const h=et.toFloatArray(r);if(s!==1)for(let l=0,c=r.length;l<c;l++)h[l]*=s;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]*s),a.push(r[h+2]*s),a.push(r[h+3])}t.bones=o,t.vertices=et.toFloatArray(a)}readAnimation(e,t,i){const s=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 sl(m,d);for(let y=0;y<m;y++){const w=p[y];g.setFrame(y,ie(w,"time",0),ie(w,"name",null))}r.push(g);break}case"rgba":{const g=new iw(m,m<<2,d);let y=p[0],w=ie(y,"time",0),v=ct.fromString(y.color);for(let _=0,x=0;;_++){g.setFrame(_,w,v.r,v.g,v.b,v.a);const M=p[_+1];if(!M){g.shrink(x);break}const T=ie(M,"time",0),C=ct.fromString(M.color),I=y.curve;I&&(x=Pt(I,g,x,_,0,w,T,v.r,C.r,1),x=Pt(I,g,x,_,1,w,T,v.g,C.g,1),x=Pt(I,g,x,_,2,w,T,v.b,C.b,1),x=Pt(I,g,x,_,3,w,T,v.a,C.a,1)),w=T,v=C,y=M}r.push(g);break}case"rgb":{const g=new sw(m,m*3,d);let y=p[0],w=ie(y,"time",0),v=ct.fromString(y.color);for(let _=0,x=0;;_++){g.setFrame(_,w,v.r,v.g,v.b);const M=p[_+1];if(!M){g.shrink(x);break}const T=ie(M,"time",0),C=ct.fromString(M.color),I=y.curve;I&&(x=Pt(I,g,x,_,0,w,T,v.r,C.r,1),x=Pt(I,g,x,_,1,w,T,v.g,C.g,1),x=Pt(I,g,x,_,2,w,T,v.b,C.b,1)),w=T,v=C,y=M}r.push(g);break}case"alpha":{rs(r,p,new nw(m,m,d),0,1);break}case"rgba2":{const g=new rw(m,m*7,d);let y=p[0],w=ie(y,"time",0),v=ct.fromString(y.light),_=ct.fromString(y.dark);for(let x=0,M=0;;x++){g.setFrame(x,w,v.r,v.g,v.b,v.a,_.r,_.g,_.b);const T=p[x+1];if(!T){g.shrink(M);break}const C=ie(T,"time",0),I=ct.fromString(T.light),k=ct.fromString(T.dark),R=y.curve;R&&(M=Pt(R,g,M,x,0,w,C,v.r,I.r,1),M=Pt(R,g,M,x,1,w,C,v.g,I.g,1),M=Pt(R,g,M,x,2,w,C,v.b,I.b,1),M=Pt(R,g,M,x,3,w,C,v.a,I.a,1),M=Pt(R,g,M,x,4,w,C,_.r,k.r,1),M=Pt(R,g,M,x,5,w,C,_.g,k.g,1),M=Pt(R,g,M,x,6,w,C,_.b,k.b,1)),w=C,v=I,_=k,y=T}r.push(g);break}case"rgb2":{const g=new aw(m,m*6,d);let y=p[0],w=ie(y,"time",0),v=ct.fromString(y.light),_=ct.fromString(y.dark);for(let x=0,M=0;;x++){g.setFrame(x,w,v.r,v.g,v.b,_.r,_.g,_.b);const T=p[x+1];if(!T){g.shrink(M);break}const C=ie(T,"time",0),I=ct.fromString(T.light),k=ct.fromString(T.dark),R=y.curve;R&&(M=Pt(R,g,M,x,0,w,C,v.r,I.r,1),M=Pt(R,g,M,x,1,w,C,v.g,I.g,1),M=Pt(R,g,M,x,2,w,C,v.b,I.b,1),M=Pt(R,g,M,x,3,w,C,_.r,k.r,1),M=Pt(R,g,M,x,4,w,C,_.g,k.g,1),M=Pt(R,g,M,x,5,w,C,_.b,k.b,1)),w=C,v=I,_=k,y=T}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":rs(r,p,new xh(m,m,d),0,1);break;case"translate":Kd(r,p,new jb(m,m<<1,d),"x","y",0,s);break;case"translatex":rs(r,p,new Wb(m,m,d),0,s);break;case"translatey":rs(r,p,new zb(m,m,d),0,s);break;case"scale":Kd(r,p,new qb(m,m<<1,d),"x","y",1,1);break;case"scalex":rs(r,p,new Kb(m,m,d),1,1);break;case"scaley":rs(r,p,new Zb(m,m,d),1,1);break;case"shear":Kd(r,p,new Jb(m,m<<1,d),"x","y",0,1);break;case"shearx":rs(r,p,new Qb(m,m,d),0,1);break;case"sheary":rs(r,p,new ew(m,m,d),0,1);break;case"inherit":{const g=new tw(m,u.index);for(let y=0;y<p.length;y++){const w=p[y];g.setFrame(y,ie(w,"time",0),et.enumValue(si,ie(w,"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,kc);if(!d)throw new Error(`IK Constraint not found: ${l}`);const f=new lw(c.length,c.length<<1,i.constraints.indexOf(d));let p=ie(u,"time",0),m=ie(u,"mix",1),g=ie(u,"softness",0)*s;for(let y=0,w=0;;y++){f.setFrame(y,p,m,g,ie(u,"bendPositive",!0)?1:-1,ie(u,"compress",!1),ie(u,"stretch",!1));const v=c[y+1];if(!v){f.shrink(w);break}const _=ie(v,"time",0),x=ie(v,"mix",1),M=ie(v,"softness",0)*s,T=u.curve;T&&(w=Pt(T,f,w,y,0,p,_,m,x,1),w=Pt(T,f,w,y,1,p,_,g,M,s)),p=_,m=x,g=M,u=v}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,Ot);if(!d)throw new Error(`Transform constraint not found: ${l}`);const f=new cw(c.length,c.length*6,i.constraints.indexOf(d));let p=ie(u,"time",0),m=ie(u,"mixRotate",1),g=ie(u,"mixX",1),y=ie(u,"mixY",g),w=ie(u,"mixScaleX",1),v=ie(u,"mixScaleY",1),_=ie(u,"mixShearY",1);for(let x=0,M=0;;x++){f.setFrame(x,p,m,g,y,w,v,_);const T=c[x+1];if(!T){f.shrink(M);break}const C=ie(T,"time",0),I=ie(T,"mixRotate",1),k=ie(T,"mixX",1),R=ie(T,"mixY",k),F=ie(T,"mixScaleX",1),B=ie(T,"mixScaleY",1),L=ie(T,"mixShearY",1),Y=u.curve;Y&&(M=Pt(Y,f,M,x,0,p,C,m,I,1),M=Pt(Y,f,M,x,1,p,C,g,k,1),M=Pt(Y,f,M,x,2,p,C,y,R,1),M=Pt(Y,f,M,x,3,p,C,w,F,1),M=Pt(Y,f,M,x,4,p,C,v,B,1),M=Pt(Y,f,M,x,5,p,C,_,L,1)),p=C,m=I,g=k,y=R,w=F,v=B,_=L,u=T}r.push(f)}if(e.path)for(const l in e.path){const c=e.path[l],u=i.findConstraint(l,Fc);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 y=new hw(g,g,d);rs(r,p,y,0,u.positionMode===yn.Fixed?s:1);break}case"spacing":{const y=new uw(g,g,d);rs(r,p,y,0,u.spacingMode===_i.Length||u.spacingMode===_i.Fixed?s:1);break}case"mix":{const y=new dw(g,g*3,d);let w=ie(m,"time",0),v=ie(m,"mixRotate",1),_=ie(m,"mixX",1),x=ie(m,"mixY",_);for(let M=0,T=0;;M++){y.setFrame(M,w,v,_,x);const C=p[M+1];if(!C){y.shrink(T);break}const I=ie(C,"time",0),k=ie(C,"mixRotate",1),R=ie(C,"mixX",1),F=ie(C,"mixY",R),B=m.curve;B&&(T=Pt(B,y,T,M,0,w,I,v,k,1),T=Pt(B,y,T,M,1,w,I,_,R,1),T=Pt(B,y,T,M,2,w,I,x,F,1)),w=I,v=k,_=R,x=F,m=C}r.push(y);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,Oc);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,y=0;if(d==="reset"){const w=new wh(m,u);for(let v=0;p!=null;p=f[v+1],v++)w.setFrame(v,ie(p,"time",0));r.push(w);continue}switch(d){case"inertia":g=new fw(m,m,u);break;case"strength":g=new mw(m,m,u);break;case"damping":g=new pw(m,m,u);break;case"mass":g=new gw(m,m,u);break;case"wind":g=new vw(m,m,u);break;case"gravity":g=new yw(m,m,u);break;case"mix":{y=1,g=new xw(m,m,u);break}default:continue}rs(r,f,g,y,1)}}if(e.slider)for(const l in e.slider){const c=e.slider[l],u=i.findConstraint(l,Qr);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":rs(r,p,new bw(g,g,d),1,1);break;case"mix":rs(r,p,new ww(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 y=f[g],w=u.getAttachment(m,g);if(!w)throw new Error(`Timeline attachment not found: ${g}`);for(const v in y){const _=y[v];let x=_[0];if(x){if(v==="deform"){const M=w.bones,T=w.vertices,C=M?T.length/3*2:T.length,I=new ow(_.length,_.length,m,w);let k=ie(x,"time",0);for(let R=0,F=0;;R++){let B;const L=ie(x,"vertices",null);if(!L)B=M?et.newFloatArray(C):T;else{B=et.newFloatArray(C);const P=ie(x,"offset",0);if(et.arrayCopy(L,0,B,P,L.length),s!==1)for(let U=P,N=U+L.length;U<N;U++)B[U]*=s;if(!M)for(let U=0;U<C;U++)B[U]+=T[U]}I.setFrame(R,k,B);const Y=_[R+1];if(!Y){I.shrink(F);break}const O=ie(Y,"time",0),D=x.curve;D&&(F=Pt(D,I,F,R,0,k,O,0,1,1)),k=O,x=Y}r.push(I)}else if(v==="sequence"){const M=new bh(_.length,m,w);let T=0;for(let C=0;C<_.length;C++){const I=ie(x,"delay",T),k=ie(x,"time",0),R=Pi[ie(x,"mode","hold")],F=ie(x,"index",0);M.setFrame(C,k,R,F,I),T=I,x=_[C+1]}r.push(M)}}}}}}if(e.drawOrder){const l=new Ir(e.drawOrder.length),c=i.slots.length;let u=0;for(const d of e.drawOrder)l.setFrame(u++,ie(d,"time",0),kv(i,d,c,null));r.push(l)}if(e.drawOrderFolder)for(const l of e.drawOrderFolder){const c=ie(l,"slots",[]),u=new Array(c.length);let d=0;for(const g of c){const y=i.findSlot(g);if(!y)throw new Error(`Draw order folder slot not found: ${g}`);u[d++]=y.index}const f=ie(l,"keys",[]),p=new po(f.length,u,i.slots.length);let m=0;for(const g of f)p.setFrame(m++,ie(g,"time",0),kv(i,g,u.length,u));r.push(p)}if(e.events){const l=new bl(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 cp(et.toSinglePrecision(ie(d,"time",0)),f);m.intValue=ie(d,"int",p.intValue),m.floatValue=ie(d,"float",p.floatValue),m.stringValue=ie(d,"string",p.stringValue),m.data.audioPath&&(m.volume=ie(d,"volume",p.volume),m.balance=ie(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 np(t,r,a),h=ie(e,"color",null);h!==null&&o.color.setFromString(h),i.animations.push(o)}}class $3{constructor(e,t,i,s,r,a){b(this,"source");b(this,"skin");b(this,"slotIndex");b(this,"sourceIndex");b(this,"mesh");b(this,"inheritTimelines");this.mesh=e,this.skin=t,this.slotIndex=i,this.sourceIndex=s,this.source=r,this.inheritTimelines=a}}function rs(n,e,t,i,s){let r=e[0],a=r.time??0,o=(r.value??i)*s,h=0;for(let l=0;;l++){t.setFrame(l,a,o);const c=e[l+1];if(!c){t.shrink(h),n.push(t);return}const u=c.time??0,d=(c.value??i)*s;r.curve&&(h=Pt(r.curve,t,h,l,0,a,u,o,d,s)),a=u,o=d,r=c}}function Kd(n,e,t,i,s,r,a){let o=e[0],h=o.time??0,l=(o[i]??r)*a,c=(o[s]??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),n.push(t);return}const p=f.time??0,m=(f[i]??r)*a,g=(f[s]??r)*a,y=o.curve;y&&(u=Pt(y,t,u,d,0,h,p,l,m,a),u=Pt(y,t,u,d,1,h,p,c,g,a)),h=p,l=m,c=g,o=f}}function kv(n,e,t,i){const s=e.offsets;if(!s)return null;const r=new Array(t).fill(-1),a=new Array(t-s.length);let o=0,h=0;for(const l of s){const c=n.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 Pt(n,e,t,i,s,r,a,o,h,l){if(n==="stepped")return e.setStepped(i),t;const c=s<<2,u=n[c],d=n[c+1]*l,f=n[c+2],p=n[c+3]*l;return e.setBezier(t,i,s,r,o,u,d,f,p,a,h),t+1}function ie(n,e,t){return n[e]!==void 0?n[e]:t}class G3{newRegionAttachment(e,t,i,s){return new Qh(t,i)}newMeshAttachment(e,t,i,s){return new Pl(t,i)}newBoundingBoxAttachment(e,t){return new cb(t)}newPathAttachment(e,t){return new xl(t)}newPointAttachment(e,t){return new pb(t)}newClippingAttachment(e,t){return new no(t)}}class H3{sequence(e){for(let t=0;t<e.regions.length;t++){if(e.regions[t])continue;const i=new $b;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,s,r){return new fo(i,this.sequence(r))}newMeshAttachment(e,t,i,s,r){return new Pr(i,this.sequence(r))}newBoundingBoxAttachment(e,t,i){return new ap(i)}newPathAttachment(e,t,i){return new wl(i)}newPointAttachment(e,t,i){return new op(i)}newClippingAttachment(e,t,i){return new su(i)}}const j3=new Set(["normal","onlyTranslation","noRotationOrReflection","noScale","noScaleOrReflection"]);function W3(n,e,t){const i=n.uvs,s=n.vertices,r=n.triangles;if(!Array.isArray(i)||!i.length||i.length%2)throw new Error(`拖尾网格“${e}”的 UV 数据无效`);if(!Array.isArray(s)||!s.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(n.hull)||0;if(!Number.isInteger(o)||o<0||o>a)throw new Error(`拖尾网格“${e}”的外轮廓数量无效`);if(Array.isArray(n.edges)&&n.edges.some(c=>!Number.isInteger(c)||c<0||c>=a*2||c%2))throw new Error(`拖尾网格“${e}”的外轮廓边索引越界`);if(s.length===i.length)return;let h=0,l=0;for(;h<s.length;){const c=s[h++];if(!Number.isInteger(c)||c<1)throw new Error(`拖尾网格“${e}”包含无效骨骼权重数量`);let u=0;for(let d=0;d<c;d++){const f=s[h++],p=s[h++],m=s[h++],g=s[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!==s.length||l!==a)throw new Error(`拖尾网格“${e}”的顶点数量与 UV 不一致`)}function z3(n,e){var r,a,o,h;const t=Array.isArray(n.bones)?n.bones:[],i=new Map(t.map(l=>[String(l.name||""),l])),s=new Set;for(const l of t){if(l.inherit!=null&&!j3.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(n.skins)?n.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"&&(W3(f,d,t.length),((r=f.vertices)==null?void 0:r.length)!==((a=f.uvs)==null?void 0:a.length)&&s.add(u))}}for(const l of Object.values(n.animations||{}))for(const c of s){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 q3(n){var e;if(String(((e=n==null?void 0:n.skeleton)==null?void 0:e.spine)||"")!=="3.8")throw new Error("Spine 3.8 导出的版本标识必须为 3.8");for(const t of n.bones||[])if(t.inherit!=null)throw new Error(`Spine 3.8 骨骼“${t.name||""}”应使用 transform,不能使用 inherit`);for(const t of Object.values(n.animations||{})){for(const s of Object.values(t.slots||{})){if(s.rgba||s.rgba2)throw new Error("Spine 3.8 插槽颜色时间轴必须使用 color / twoColor");for(const r of s.attachment||[])if(!Object.prototype.hasOwnProperty.call(r,"name"))throw new Error("Spine 3.8 附件时间轴的隐藏帧必须显式写入 name: null")}for(const s of Object.values(t.bones||{}))for(const r of s.rotate||[])if(r.value!=null||r.angle==null)throw new Error("Spine 3.8 旋转时间轴必须使用 angle");const i=[t];for(;i.length;){const s=i.pop();if(!(!s||typeof s!="object")){if(!Array.isArray(s)&&Array.isArray(s.curve))throw new Error("Spine 3.8 不支持 4.x 数组曲线格式");i.push(...Object.values(s))}}}}function K3(n,e){var a;const t=JSON.parse(n),i=ah((a=t==null?void 0:t.skeleton)==null?void 0:a.spine);if(!i)throw new Error(`导出版本不受支持,仅支持 Spine ${jf()}`);if(e&&i!==e)throw new Error(`导出版本不一致:设置为 Spine ${e},JSON 标记为 Spine ${i}`);z3(t,i),i==="3.8"&&q3(t);const s=i==="3.8"?Cb(JSON.parse(JSON.stringify(t))):t,r=i==="4.3"?new V3(new H3).readSkeletonData(s):new dh(new G3).readSkeletonData(s);if(!r.bones.length)throw new Error("导出结果缺少骨骼");return{version:i,bones:r.bones.length,slots:r.slots.length,animations:r.animations.length}}const Z3={class:"panel"},J3={class:"panel-scroll"},Q3={class:"group config-management"},eO={class:"caret"},tO={class:"group-body config-management-body"},iO={class:"config-toolbar"},sO=["disabled"],nO={value:""},rO=["value"],aO={class:"group"},oO={class:"caret"},lO={class:"scene-actions"},cO=["disabled"],hO={class:"group-body"},uO={class:"tree scene-tree"},dO=["onClick"],fO={class:"tlabel"},mO=["title","aria-label","onClick"],pO={viewBox:"0 0 24 24","aria-hidden":"true"},gO={key:0,class:"eye-slash",d:"M4 4l16 16"},vO=["onClick"],yO=["onClick"],xO={class:"tlabel"},bO=["title","aria-label","onClick"],wO={viewBox:"0 0 24 24","aria-hidden":"true"},SO={key:0,class:"eye-slash",d:"M4 4l16 16"},_O=["onClick"],TO=["onClick"],MO={class:"tlabel"},EO=["title","aria-label","onClick"],AO={viewBox:"0 0 24 24","aria-hidden":"true"},CO={key:0,class:"eye-slash",d:"M4 4l16 16"},IO=["onClick"],RO=["onClick"],PO={class:"tlabel"},kO=["title","aria-label","onClick"],FO={viewBox:"0 0 24 24","aria-hidden":"true"},OO={key:0,class:"eye-slash",d:"M4 4l16 16"},BO=["onClick"],LO={key:0,class:"empty"},DO={class:"row"},NO={class:"seed-row scene-seed"},UO={class:"field-block"},XO={class:"field-block"},YO={class:"tag-editor"},VO=["onClick"],$O={class:"field-grid"},GO={class:"field-block"},HO={class:"field-block check-field"},jO={class:"field-grid"},WO={class:"compact-field"},zO={class:"compact-field"},qO={class:"field-grid"},KO={class:"compact-field"},ZO={class:"compact-field"},JO={key:1,class:"field-grid"},QO={class:"compact-field"},eB={class:"compact-field"},tB={key:2,class:"field-grid"},iB={class:"compact-field"},sB={class:"compact-field"},nB={class:"field-block"},rB={key:4,class:"field-grid"},aB={class:"compact-field"},oB={class:"compact-field"},lB={class:"collider-follow-section"},cB={class:"follow-path"},hB={class:"field-block"},uB=["value"],dB={class:"field-grid"},fB={class:"compact-field"},mB={class:"compact-field"},pB={class:"follow-path"},gB={class:"field-block"},vB={class:"field-grid"},yB={class:"compact-field"},xB={class:"compact-field"},bB={class:"field-grid"},wB={class:"compact-field"},SB={class:"compact-field"},_B={class:"setting-line"},TB={class:"setting-line"},MB={class:"field-block"},EB={key:4,class:"panel-hint"},AB={class:"group"},CB={class:"caret"},IB={class:"group-body"},RB={class:"segs"},PB={class:"segs stream-behavior-segs"},kB={key:2,class:"stream-loop-options"},FB={class:"loop-section-row"},OB={class:"switch-row"},BB=["checked"],LB={key:0,class:"loop-duration-control"},DB={class:"switch-row loop-duration-toggle"},NB=["checked"],UB={class:"loop-section-duration"},XB=["value"],YB={key:1},VB={key:2,class:"loop-auto-duration"},$B={class:"loop-section-row"},GB={class:"switch-row"},HB=["checked"],jB={key:0,class:"loop-duration-control"},WB={class:"switch-row loop-duration-toggle"},zB=["checked"],qB={class:"loop-section-duration"},KB=["value"],ZB={key:1},JB={key:2,class:"loop-auto-duration"},QB={key:3,class:"modifier-hint stream-loop-hint"},eL={class:"group"},tL={class:"caret"},iL={class:"group-body"},sL={class:"row"},nL={class:"group"},rL={class:"caret"},aL={class:"group-body attr-body"},oL={class:"attr-axis-head"},lL={class:"axis-modes"},cL={class:"life-item"},hL={class:"switch-row"},uL={class:"life-item"},dL={class:"switch-row"},fL={class:"axis-modes life-axis"},mL={class:"life-item"},pL={class:"switch-row"},gL={class:"group"},vL={class:"caret"},yL={class:"group-body"},xL={class:"seg"},bL={class:"row"},wL={class:"curve-wrap"},SL={class:"row"},_L=["onUpdate:modelValue"],TL=["onUpdate:modelValue"],ML={class:"row resource-color-row"},EL=["onUpdate:modelValue"],AL=["onUpdate:modelValue"],CL={key:0,class:"row resource-color-picker"},IL=["onUpdate:modelValue"],RL=["value","onChange","onKeydown"],PL={key:0,class:"random-color-hint"},kL={class:"resource-alpha-head"},FL={class:"alpha-modes"},OL=["onClick"],BL=["onClick"],LL=["onClick"],DL={class:"row"},NL=["onUpdate:modelValue"],UL={class:"resource-alpha-curve"},XL={class:"group"},YL={class:"caret"},VL={class:"group-body"},$L={class:"modifier-item"},GL={class:"switch-row modifier-switch"},HL={key:0,class:"modifier-params"},jL={class:"modifier-item"},WL={class:"switch-row modifier-switch"},zL={key:0,class:"modifier-params gravity-params"},qL={class:"modifier-mode-row"},KL={class:"modifier-item"},ZL={class:"switch-row modifier-switch"},JL={key:0,class:"modifier-params gravity-params"},QL={class:"modifier-mode-row"},eD={class:"modifier-item"},tD={class:"switch-row modifier-switch"},iD={key:0,class:"modifier-params"},sD={class:"row"},nD={class:"modifier-item"},rD={class:"switch-row modifier-switch"},aD={key:0,class:"modifier-params"},oD={class:"row"},lD={class:"row"},cD={class:"modifier-item"},hD={class:"switch-row modifier-switch"},uD={key:0,class:"modifier-params trail-params"},dD={class:"row"},fD=["onUpdate:modelValue"],mD={class:"row"},pD=["onUpdate:modelValue"],gD={class:"row"},vD=["onUpdate:modelValue"],yD={class:"switch-row trail-sub-switch"},xD=["onUpdate:modelValue"],bD={class:"switch-row trail-sub-switch"},wD=["onUpdate:modelValue"],SD={class:"trail-mode-head"},_D={class:"alpha-modes"},TD=["onClick"],MD=["onClick"],ED=["onClick"],AD={class:"row"},CD=["onUpdate:modelValue"],ID={key:6,class:"row trail-fixed-color"},RD=["onUpdate:modelValue"],PD=["value","onChange","onKeydown"],kD={class:"trail-mode-head"},FD={class:"alpha-modes"},OD=["onClick"],BD=["onClick"],LD=["onClick"],DD={class:"trail-grid-row"},ND={class:"modifier-item"},UD={class:"switch-row modifier-switch"},XD=["disabled"],YD={key:0,class:"modifier-params emitter-follow-params"},VD={class:"field-block"},$D=["value"],GD={key:0,value:"bone"},HD={class:"field-block"},jD=["value"],WD={class:"field-block"},zD={class:"field-grid follow-grid"},qD={class:"compact-field"},KD={class:"compact-field"},ZD={class:"field-block"},JD={key:0,class:"bone-follow-target"},QD={key:1,class:"bone-follow-missing"},eN={class:"field-block"},tN={class:"field-grid follow-grid"},iN={class:"compact-field"},sN={class:"compact-field"},nN={class:"bone-follow-transform-grid"},rN={class:"compact-field"},aN={class:"compact-field"},oN={class:"compact-field"},lN={class:"group"},cN={class:"caret"},hN={class:"group-body export-settings"},uN={class:"export-field"},dN={class:"export-field"},fN={class:"export-field"},mN={key:0,class:"export-help"},pN={class:"export-fps-row"},gN={class:"export-field export-fps-field"},vN={class:"export-checkbox"},yN={class:"export-switches"},xN={class:"switch-row export-switch"},bN={class:"switch-row export-switch"},wN={class:"switch-row export-switch export-switch-last"},SN=["disabled","title"],_N=wn({__name:"ParticlePanel",setup(n){const e=Rl();e.settings.exportSettings=T1(e.settings.exportSettings);const t=yt(()=>e.settings.exportSettings),i=nt(null),s=nt(""),r=nt([]),a=nt(!1),o=nt(""),h=nt(!1),l=nt(!1),c=nt(""),u=nt(!1);function d(V){return V==="跟随导出"?t.value.keyframeCurve==="bezier"?"bezier":"linear":V==="贝塞尔"?"bezier":"linear"}e.systems.length||e.addSystem();function f(){Fb(e),h.value=!1,o.value="配置已保存到本地"}async function p(V){var G;const S=V.target,E=(G=S.files)==null?void 0:G[0];if(E){o.value="正在加载配置…",h.value=!1;try{await OR(e,E),o.value=`已加载:${E.name}`}catch(ae){h.value=!0,o.value=ae instanceof Error?ae.message:String(ae)}finally{S.value=""}}}async function m(){try{const V=await fetch(`/Preset/index.json?t=${Date.now()}`,{cache:"no-store"});if(!V.ok)throw new Error("无法读取预设列表");const S=await V.json();r.value=Array.isArray(S)?S.filter(E=>!!E&&typeof E.name=="string"&&typeof E.file=="string"):[]}catch{r.value=[]}}async function g(){const V=s.value;if(V){a.value=!0,h.value=!1,o.value="正在加载预设…";try{const S=await fetch(`/Preset/${encodeURIComponent(V)}`,{cache:"no-store"});if(!S.ok)throw new Error(`无法读取预设:${V}`);await Bb(e,await S.text()),o.value=`已加载预设:${V.replace(/\.json$/i,"")}`}catch(S){h.value=!0;const E=S instanceof Error?S.message:String(S);o.value=`${E},请检查预设文件命名`}finally{a.value=!1,s.value=""}}}xo(m);function y(){return new Promise(V=>requestAnimationFrame(()=>V()))}async function w(){e.timeline.playing=!1,e.timeline.frame=0,e.timeline.recorded=!1;for(const E of e.systems)E.frames=void 0;e.recalcTotalFrames(),await y(),e.timeline.playing=!0;const V=e.timeline.totalFrames/Math.max(1,e.timeline.fps)*1e3,S=performance.now()+Math.max(8e3,V*2.5+3e3);for(;!e.timeline.recorded;){if(performance.now()>S)throw new Error("重新计算动画超时,请确认页面仍在运行后重试");await new Promise(E=>setTimeout(E,50))}}async function v(){if(!l.value){l.value=!0,u.value=!1,c.value="正在重新计算粒子动画…";try{await w();const V=XF({systems:e.systems,timeline:e.timeline,settings:t.value});K3(V.text,t.value.spineVersion),YF(V,t.value.fileName);const S=V.warnings.length?`;${V.warnings.length} 条资源提示(缺图仍已导出)`:"";c.value=`已导出 Spine ${t.value.spineVersion}:${V.particleSystemCount} 个粒子系统、${V.animationCount} 个动画、${V.boneCount} 根骨骼${S}`}catch(V){u.value=!0,c.value=V instanceof Error?V.message:String(V)}finally{l.value=!1}}}const _=yt(()=>{const V=e.systems.findIndex(S=>S.id===e.activeId);return V>=0?V:0}),x=yt(()=>e.systems[_.value]||null),M=yt(()=>x.value?M1(x.value.config,e.timeline.fps):30),T=yt(()=>{var S;const V=(S=x.value)==null?void 0:S.config;return V?Math.max(1,Math.ceil(Number(V.loopDurationFrames)||1)):1}),C=yt(()=>e.activeObjectType),I=yt(()=>e.activeObjectType==="collision"&&e.colliders.find(V=>V.id===e.activeObjectId)||null),k=yt(()=>e.activeObjectType==="path"&&e.paths.find(V=>V.id===e.activeObjectId)||null),R=yt(()=>e.activeObjectType==="spine"&&e.spines.find(V=>V.id===e.activeObjectId)||null),F=yt(()=>e.activeObjectType==="particle"?e.systems.some(V=>V.id===e.activeObjectId):e.activeObjectType==="collision"?e.colliders.some(V=>V.id===e.activeObjectId):e.activeObjectType==="path"?e.paths.some(V=>V.id===e.activeObjectId):e.spines.some(V=>V.id===e.activeObjectId)),B=yt(()=>{const V=e.spines.find(S=>S.selectedBone&&S.bones.some(E=>E.name===S.selectedBone));return V?{spine:V,boneName:V.selectedBone}:null}),L=yt(()=>{var E;const V=(E=x.value)==null?void 0:E.config;if(!V||V.emitterFollowMode!=="bone")return null;const S=e.spines.find(G=>G.id===V.emitterFollowSpineId);return!S||!S.bones.some(G=>G.name===V.emitterFollowBoneName)?null:{spine:S,boneName:V.emitterFollowBoneName}});Lo(()=>{for(const V of e.systems)V.visible==null&&(V.visible=!0);for(const V of e.colliders)V.visible==null&&(V.visible=!0);for(const V of e.paths)V.visible==null&&(V.visible=!0);for(const V of e.spines)V.visible==null&&(V.visible=!0)}),Lo(()=>{if(!x.value)return;const V=ma(x.value.config);V.lifeMode==="curve"&&(V.lifeMode="random"),V.speedMode==="curve"&&(V.speedMode="random"),V.scaleMode==="curve"&&(V.scaleMode="random"),V.initialRotationMode==="curve"&&(V.initialRotationMode="random"),V.mode==="stream"&&!(V.duration>0)&&(V.duration=1),V.streamBehavior==="loop"&&(V.emitterFollow||V.emitterFollowMode!=="none")&&Q(V)}),Lo(()=>{for(const V of e.systems){const S=ma(V.config);if(S.emitterFollowMode!=="bone")continue;const E=e.spines.find(ae=>ae.id===S.emitterFollowSpineId);!!(E!=null&&E.bones.some(ae=>ae.name===S.emitterFollowBoneName))||(S.emitterFollowMode="none",S.emitterFollowSpineId=0,S.emitterFollowBoneName="")}}),Lo(()=>{for(const V of e.colliders)V.followPathId==null&&(V.followPathId=0),V.followDuration>0||(V.followDuration=2),V.followPathRotation==null&&(V.followPathRotation=!1),["跟随导出","线性","贝塞尔"].includes(V.followCurveMode)||(V.followCurveMode="跟随导出"),(!Array.isArray(V.followCurve)||V.followCurve.length<2)&&(V.followCurve=[{x:0,y:0},{x:1,y:1}])});const Y=[{x:0,y:0},{x:1,y:1}],O=[{x:0,y:1},{x:1,y:1}],D=[{x:0,y:0},{x:.2,y:1},{x:.8,y:1},{x:1,y:0}],P=[{x:0,y:0},{x:.1,y:1},{x:.9,y:1},{x:1,y:0}],U=[{x:0,y:1},{x:1,y:1}],N=[{x:0,y:1},{x:1,y:1}],X=yo({config:!0,scene:!1,emitMode:!0,shape:!0,attr:!0,look:!0,mods:!0,export:!1});function K(V){X[V]=!X[V]}function z(V){var E;const S=(E=x.value)==null?void 0:E.config;S&&(S.mode=V,V==="stream"&&!(S.duration>0)&&(S.duration=1))}function se(V){var G;const S=(G=x.value)==null?void 0:G.config;if(!S)return;const E=Math.min(1800,Math.max(1,Math.ceil(Number(V)||1)));S.loopDurationFrames=E}function Q(V){const S=yl();V.emitterFollow=!1,V.emitterFollowMode="none",V.emitterFollowPathId=S.emitterFollowPathId,V.emitterFollowSpineId=S.emitterFollowSpineId,V.emitterFollowBoneName=S.emitterFollowBoneName,V.emitterFollowBoneOffsetX=S.emitterFollowBoneOffsetX,V.emitterFollowBoneOffsetY=S.emitterFollowBoneOffsetY,V.emitterFollowBoneRotation=S.emitterFollowBoneRotation,V.emitterFollowBoneScaleX=S.emitterFollowBoneScaleX,V.emitterFollowBoneScaleY=S.emitterFollowBoneScaleY,V.emitterAngleMode=S.emitterAngleMode,V.emitterFollowCurve=S.emitterFollowCurve.map(E=>({...E})),V.emitterFollowDuration=S.emitterFollowDuration,V.emitterFollowSpace=S.emitterFollowSpace,V.emitterFollowDirection=S.emitterFollowDirection,V.emitterFollowOffset=S.emitterFollowOffset}function me(V){var ae;const S=(ae=x.value)==null?void 0:ae.config;if(!S||S.streamBehavior===V)return;const E=V==="loop",G=E?"进入循环持续模式后,粒子跟随设置会失效并恢复默认值。是否继续?":"退出循环持续模式后,粒子跟随设置会失效并恢复默认值。是否继续?";window.confirm(G)&&(Q(S),S.streamBehavior=V,E||(S.generateLoopStartAnimation=!1,S.generateLoopEndAnimation=!1))}function pe(V,S){var ae;const E=(ae=x.value)==null?void 0:ae.config;if(!E)return;const G=S.target.checked;V==="start"?E.generateLoopStartAnimation=G:E.generateLoopEndAnimation=G}function Me(V,S){var ae;const E=(ae=x.value)==null?void 0:ae.config;if(!E)return;const G=Math.min(1800,Math.max(1,Math.ceil(Number(S.target.value)||30)));V==="start"?E.loopStartDurationFrames=G:E.loopEndDurationFrames=G}function Ie(V,S){var ae;const E=(ae=x.value)==null?void 0:ae.config;if(!E)return;const G=S.target.checked;V==="start"?E.loopStartUseCustomDuration=G:E.loopEndUseCustomDuration=G}function ge(V,S){const E=V.target.value;if(S.emitterFollowMode=E,E!=="bone"){S.emitterFollowSpineId=0,S.emitterFollowBoneName="";return}Ee(S)}function Ee(V){const S=B.value;if(!S){V.emitterFollowMode="none",V.emitterFollowSpineId=0,V.emitterFollowBoneName="";return}V.emitterFollowMode="bone",V.emitterFollowSpineId=S.spine.id,V.emitterFollowBoneName=S.boneName}const H={emitMode:["mode","rate","streamBehavior","loopDurationFrames","generateLoopStartAnimation","loopStartUseCustomDuration","loopStartDurationFrames","generateLoopEndAnimation","loopEndUseCustomDuration","loopEndDurationFrames","burstCount","burstLoop","delay","duration"],shape:["shape","radius","rectW","rectH","direction","spread","coneAngle"],attr:["lifeMin","lifeMax","lifeMode","lifeCurve","speedMin","speedMax","speedMode","speedCurve","scaleMin","scaleMax","scaleMode","scaleAxisMode","scaleYMin","scaleYMax","scaleCurve","scaleYCurve","scaleEndRatio","initialRotationMode","initialRotationMin","initialRotationMax","initialRotationCurve","rotationSpeedMin","rotationSpeedMax","speedOverLifeEnabled","speedOverLifeMode","speedOverLifeMin","speedOverLifeMax","speedOverLifeCurve","scaleOverLifeEnabled","scaleOverLifeMode","scaleOverLifeAxisMode","scaleOverLifeMin","scaleOverLifeMax","scaleYOverLifeMin","scaleYOverLifeMax","scaleOverLifeCurve","scaleYOverLifeCurve","rotationOverLifeEnabled","rotationOverLifeMode","rotationOverLifeCurve"],look:["texture","imageResources","imageWeightVersion","alpha","alphaEnd","colorStart","colorEnd","colorOverLife","blend","alphaMode","curveMode","alphaCurve","textureName","textureFolder","alphaScale","anchorX","anchorY","independentAlpha"],mods:["noise","noiseAmt","noiseRange","noiseSpeed","useGravity","gravity","gravityMode","gravityMin","gravityMax","gravityDirection","gravityCurve","wind","windX","windY","windMode","windMin","windMax","windDirection","windCurve","forceField","forceStrength","forceRadius","forceCenterX","forceCenterY","forceFalloff","attraction","attractionCenterX","attractionCenterY","attractionRadius","attractionDuration","attractionDelay","attractionDelayMode","attractionPath","trail","trailConfigVersion","trailResources","trailResourceVersion","trailTexture","trailTextureName","trailPreviewUrl","trailColorMode","trailColor","trailColorGradient","trailAlphaMode","trailAlpha","trailAlphaCurve","trailBoneCount","trailLength","trailWidth","trailWidthMode","trailLifeLengthEnabled","trailLifeLengthCurve","trailShapeEnabled","trailShapeCurve","trailGridRows","trailGridCols","collision","pathFollow","emitterFollow","emitterFollowMode","emitterFollowPathId","emitterFollowSpineId","emitterFollowBoneName","emitterFollowBoneOffsetX","emitterFollowBoneOffsetY","emitterFollowBoneRotation","emitterFollowBoneScaleX","emitterFollowBoneScaleY","emitterAngleMode","emitterFollowCurve","emitterFollowDuration","emitterFollowSpace","emitterFollowDirection","emitterFollowOffset","damping"]};function Z(V){var G;const S=(G=x.value)==null?void 0:G.config;if(V==="export"){e.settings.exportSettings=qm();return}if(!S)return;const E=yl();for(const ae of H[V])S[ae]=E[ae]}function q(){t.value.fps=Math.min(240,Math.max(1,Math.round(Number(t.value.fps)||30)))}function W(V){var S;e.selectSystem(((S=e.systems[V])==null?void 0:S.id)??0)}function ee(){e.addSystem()}function ce(){e.addCollider()}function xe(){e.addPath()}function oe(){e.addSpine()}function Se(){e.duplicateSelectedObject()}function ue(){const V=I.value;if(!V)return;let S=V.tags.length+1,E=`Tag ${S}`;for(;V.tags.includes(E);)E=`Tag ${++S}`;V.tags.push(E),V.selectedTag=E}function ke(V,S,E=0,G=0,ae=0,ve=0){return{x:V,y:S,inX:E,inY:G,outX:ae,outY:ve}}function Re(){const V=k.value;if(!(!V||!V.preset))if(V.preset==="circle"){const E=60.751328;V.points=[ke(110,0,0,-E,0,E),ke(0,110,E,0,-E,0),ke(-110,0,0,E,0,-E),ke(0,-110,-E,0,E,0)],V.closed=!0}else if(V.preset==="square")V.points=[ke(-100,-100),ke(100,-100),ke(100,100),ke(-100,100)],V.closed=!0;else{const S=V.preset==="star"?10:6;V.points=Array.from({length:S},(E,G)=>{const ae=V.preset==="star"&&G%2?50:110,ve=-Math.PI*.5+G/S*Math.PI*2;return ke(Math.cos(ve)*ae,Math.sin(ve)*ae)}),V.closed=!0}}function Fe(){k.value&&(k.value.points=[])}function Ze(){x.value&&(x.value.config.seed=Math.floor(Math.random()*999999)+1)}function mt(V){var E;const S=(E=x.value)==null?void 0:E.config;!S||V==="direction"||(S.speedOverLifeMode=V,V==="curve"&&S.speedOverLifeMin===S.speedOverLifeMax&&(S.speedOverLifeMin=0,S.speedOverLifeMax=1))}function wt(){var S;const V=(S=x.value)==null?void 0:S.config;!V||V.scaleOverLifeMode!=="curve"||(V.scaleOverLifeMin===V.scaleOverLifeMax&&(V.scaleOverLifeMin=0,V.scaleOverLifeMax=1),V.scaleYOverLifeMin===V.scaleYOverLifeMax&&(V.scaleYOverLifeMin=0,V.scaleYOverLifeMax=1))}function ht(V){var E;const S=(E=x.value)==null?void 0:E.config;!S||V==="direction"||(S.scaleOverLifeMode=V,wt())}const St={point:{direction:0,spread:360},circle:{radius:100,direction:-90,spread:0},rect:{rectW:200,rectH:100,direction:-90,spread:0},cone:{radius:100,coneAngle:90,direction:90},orbit:{}};function Xt(){var E;const V=(E=x.value)==null?void 0:E.config;if(!V)return;const S=St[V.shape];S&&Object.assign(V,S)}const Ti=nt(null),pi=nt(null),Bi=nt(null),Ss=nt(null),Qt=nt(null);function le(){var E;const V=(E=x.value)==null?void 0:E.config;if(!V)return;const S=Math.max(0,...V.trailResources.map(G=>G.id))+1;V.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:U.map(G=>({...G})),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:O.map(G=>({...G})),shapeEnabled:!1,shapeCurve:N.map(G=>({...G}))}),gi()}function fe(V){var S;Qt.value=V,(S=Ss.value)==null||S.click()}function bt(V,S){var ae;const E=(ae=x.value)==null?void 0:ae.config;if(!E)return;const G=V==="trailGridCols"?32:16;E[V]=Math.min(G,Math.max(2,Math.round(Number(S)||2)))}function Dt(V,S){var G;const E=(G=x.value)==null?void 0:G.config.trailResources.find(ae=>ae.id===V);E&&(E.boneCount=Math.min(16,Math.max(2,Math.round(Number(S)||2))))}function Yt(V,S){var G;const E=(G=x.value)==null?void 0:G.config.trailResources.find(ae=>ae.id===V);E&&(E.rotation=Math.max(-360,Math.min(360,Number(S)||0)))}async function ut(V){var Pe,Le;const S=V.target,E=(Pe=S.files)==null?void 0:Pe[0],G=(Le=x.value)==null?void 0:Le.config,ae=G==null?void 0:G.trailResources.find(Ce=>Ce.id===Qt.value);if(!E||!ae){S.value="";return}const ve=await Ts(E);ae.texture=Sr(await rt.fromURL(ve)),ae.previewUrl=ve,ae.textureName=E.name.replace(/\.[^.]+$/,"")||"trail",S.value="",Qt.value=null}async function fs(V){var G;const S=(G=x.value)==null?void 0:G.config,E=S==null?void 0:S.trailResources.find(ae=>ae.id===V);E&&(E.texture=Sr(await rt.fromURL("/images/trail.png")),E.previewUrl="/images/trail.png",E.textureName="trail",E.weight=100,E.locked=!1,E.rotation=0,E.boneCount=3,E.trailRatio=100,E.lengthMode="fixed",E.length=100,E.lengthMin=100,E.lengthMax=100,E.widthSizeMode="fixed",E.width=100,E.widthMin=100,E.widthMax=100,E.widthMode="particle",E.lifeLengthEnabled=!1,E.lifeLengthCurve=O.map(ae=>({...ae})),E.shapeEnabled=!1,E.shapeCurve=N.map(ae=>({...ae})),E.colorMode="particle",E.color="#ffffff",E.colorGradient=[{position:0,color:"#ffffff"},{position:1,color:"#ffffff"}],E.blend="normal",E.alphaMode="particle",E.alpha=1,E.alphaCurve=U.map(ae=>({...ae})),gi())}function _s(V){var G;const S=(G=x.value)==null?void 0:G.config.trailResources;if(!S||S.length<=1)return;const E=S.findIndex(ae=>ae.id===V);E>=0&&S.splice(E,1),gi()}function gi(){var ae;const V=(ae=x.value)==null?void 0:ae.config.trailResources;if(!(V!=null&&V.length))return;if(V.length===1){V[0].weight=100,V[0].locked=!1;return}const S=V.filter(ve=>ve.locked),E=V.filter(ve=>!ve.locked);let G=S.reduce((ve,Pe)=>ve+Math.max(0,Number(Pe.weight)||0),0);G>100&&(te(S,100,!0),G=100),te(E,100-G)}function ms(V,S){var Le;const E=(Le=x.value)==null?void 0:Le.config.trailResources;if(!(E!=null&&E.length))return;if(E.length===1){E[0].weight=100,E[0].locked=!1;return}const G=E.find(Ce=>Ce.id===V);if(!G||G.locked)return;const ae=E.filter(Ce=>Ce.id!==V&&Ce.locked).reduce((Ce,be)=>Ce+Math.max(0,Number(be.weight)||0),0),ve=Math.max(0,100-ae),Pe=E.filter(Ce=>Ce.id!==V&&!Ce.locked);G.weight=J(Math.min(ve,Math.max(0,Number(S)||0))),Pe.length?te(Pe,ve-G.weight,!0):G.weight=J(ve)}function Br(V){var G;const S=(G=x.value)==null?void 0:G.config.trailResources;if(!S||S.length===1)return;const E=S.find(ae=>ae.id===V);E&&(E.locked=!E.locked)}function Zi(V,S){const E=S.target;V.color=Mn(E.value,V.color),E.value=V.color}function $i(V,S){Zi(V,S),S.target.blur()}function Sa(){var E;const V=(E=x.value)==null?void 0:E.config;if(!V)return;const S=Math.max(0,...V.imageResources.map(G=>G.id))+1;V.imageResources.push({id:S,texture:V.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:P.map(G=>({...G}))}),he()}function _a(V){var S;Bi.value=V,(S=Ti.value)==null||S.click()}function Ta(V){var S;Bi.value=V,(S=pi.value)==null||S.click()}async function Gs(V){var Le,Ce;const S=V.target,E=(Le=S.files)==null?void 0:Le[0],G=(Ce=x.value)==null?void 0:Ce.config,ae=G==null?void 0:G.imageResources.find(be=>be.id===Bi.value);if(!E||!ae){S.value="";return}const ve=await Ts(E),Pe=Sr(await rt.fromURL(ve));ae.texture=Pe,ae.previewUrl=ve,ae.textureFolder="",ae.textureName=E.name.replace(/\.[^.]+$/,"")||"particle",S.value="",Bi.value=null}async function Hs(V){var ve;const S=V.target,E=Array.from(S.files||[]).sort((Pe,Le)=>Pe.name.localeCompare(Le.name,void 0,{numeric:!0,sensitivity:"base"})),G=(ve=x.value)==null?void 0:ve.config,ae=G==null?void 0:G.imageResources.find(Pe=>Pe.id===Bi.value);if(!E.length||!ae){S.value="";return}ae.sequenceFrames=await Promise.all(E.map(async Pe=>{const Le=await Ts(Pe);return{name:Pe.name,previewUrl:Le,texture:Sr(await rt.fromURL(Le))}})),ae.imageMode="sequence",S.value="",Bi.value=null}function Ts(V){return new Promise((S,E)=>{const G=new FileReader;G.onload=()=>S(String(G.result||"")),G.onerror=()=>E(G.error),G.readAsDataURL(V)})}function Lr(V){var G;const S=(G=x.value)==null?void 0:G.config,E=S==null?void 0:S.imageResources.find(ae=>ae.id===V);!S||!E||(E.texture=S.texture,E.textureName="star",E.textureFolder="",E.previewUrl="/images/star.png",E.imageMode="fixed",E.sequencePlayback="loop-forward",E.sequenceFps=30,E.sequenceFrames=[],E.scale=1,E.anchorX=.5,E.anchorY=.5,E.colorMode="fixed",E.colorStart="#ffffff",E.colorEnd="#ff4d4d",E.colorGradient=[{position:0,color:"#ffffff"},{position:1,color:"#ff4d4d"}],E.blend="normal",E.independentAlpha="off",E.alpha=1,E.alphaCurveMode="跟随导出",E.alphaCurve=P.map(ae=>({...ae})),E.locked=!1,he())}function Mn(V,S){let E=V.trim().replace(/^#/,"");return/^[0-9a-f]{3}$/i.test(E)&&(E=E.split("").map(G=>G+G).join("")),/^[0-9a-f]{6}$/i.test(E)?`#${E.toLowerCase()}`:S}function nr(V,S){const E=S.target;V.colorStart=Mn(E.value,V.colorStart),E.value=V.colorStart}function j(V,S){nr(V,S),S.target.blur()}function $(V){var G;const S=(G=x.value)==null?void 0:G.config.imageResources;if(!S||S.length<=1)return;const E=S.findIndex(ae=>ae.id===V);E>=0&&S.splice(E,1),he()}function J(V){return Math.round(V)}function te(V,S,E=!1){if(!V.length)return;const G=Math.max(0,J(S)),ae=E?V.reduce((Pe,Le)=>Pe+Math.max(0,Number(Le.weight)||0),0):0;let ve=0;V.forEach((Pe,Le)=>{const Ce=Le===V.length-1,be=J(Ce?G-ve:ae>0?G*Math.max(0,Number(Pe.weight)||0)/ae:G/V.length);Pe.weight=be,ve+=be})}function he(){var ae;const V=(ae=x.value)==null?void 0:ae.config.imageResources;if(!(V!=null&&V.length))return;if(V.length===1){V[0].weight=100,V[0].locked=!1;return}const S=V.filter(ve=>ve.locked),E=V.filter(ve=>!ve.locked);let G=S.reduce((ve,Pe)=>ve+Math.max(0,Number(Pe.weight)||0),0);G>100&&(te(S,100,!0),G=100),te(E,100-G)}function ye(V,S){var Le;const E=(Le=x.value)==null?void 0:Le.config.imageResources;if(!(E!=null&&E.length))return;if(E.length===1){E[0].weight=100,E[0].locked=!1;return}const G=E.find(Ce=>Ce.id===V);if(!G||G.locked)return;const ae=E.filter(Ce=>Ce.id!==V&&Ce.locked).reduce((Ce,be)=>Ce+Math.max(0,Number(be.weight)||0),0),ve=Math.max(0,100-ae),Pe=E.filter(Ce=>Ce.id!==V&&!Ce.locked);if(G.weight=J(Math.min(ve,Math.max(0,Number(S)||0))),!Pe.length){G.weight=J(ve);return}te(Pe,ve-G.weight,!0)}function Te(V){var G;const S=(G=x.value)==null?void 0:G.config.imageResources;if(!S||S.length===1)return;const E=S.find(ae=>ae.id===V);E&&(E.locked=!E.locked)}return(V,S)=>(ne(),de("div",Z3,[S[370]||(S[370]=A("div",{class:"panel-header"},[A("span",null,"Spine粒子编辑器-Yeomai")],-1)),A("div",J3,[A("div",Q3,[A("div",{class:"group-head",onClick:S[0]||(S[0]=E=>K("config"))},[A("span",eO,He(X.config?"▸":"▾"),1),S[186]||(S[186]=A("span",null,"配置管理",-1))]),_e(A("div",tO,[A("div",iO,[A("button",{title:"保存全部编辑器配置 (Ctrl+S)",onClick:f},"保存配置"),A("button",{title:"加载本地编辑器配置",onClick:S[1]||(S[1]=E=>{var G;return(G=i.value)==null?void 0:G.click()})},"加载配置"),_e(A("select",{"onUpdate:modelValue":S[2]||(S[2]=E=>s.value=E),"aria-label":"预设列表",disabled:!r.value.length||a.value,onPointerdown:m,onFocus:m,onChange:g},[A("option",nO,He(r.value.length?"选择预设":"无预设文件"),1),(ne(!0),de(Je,null,ri(r.value,E=>(ne(),de("option",{key:E.file,value:E.file},He(E.name),9,rO))),128))],40,sO),[[Vt,s.value]]),A("input",{ref_key:"configFileInput",ref:i,hidden:"",type:"file",accept:".json,application/json",onChange:p},null,544)]),o.value?(ne(),de("div",{key:0,class:it(["config-message",{error:h.value}])},He(o.value),3)):Ve("",!0)],512),[[ar,!X.config]])]),A("div",aO,[A("div",{class:"group-head scene-head",onClick:S[3]||(S[3]=E=>K("scene"))},[A("span",oO,He(X.scene?"▸":"▾"),1),S[187]||(S[187]=A("span",null,"场景对象",-1)),A("div",lO,[A("button",{class:"scene-add",title:"添加粒子系统",onClick:Tt(ee,["stop"])},"+粒子"),A("button",{class:"scene-add",title:"添加碰撞体",onClick:Tt(ce,["stop"])},"+碰撞"),A("button",{class:"scene-add",title:"添加路径",onClick:Tt(xe,["stop"])},"+路径"),A("button",{class:"scene-add",title:"添加 Spine",onClick:Tt(oe,["stop"])},"+Spine"),A("button",{class:"scene-add",disabled:!F.value,title:"复制当前选中的场景对象",onClick:Tt(Se,["stop"])},"+Copy",8,cO)])]),_e(A("div",hO,[A("div",uO,[(ne(!0),de(Je,null,ri(Be(e).systems,(E,G)=>(ne(),de("div",{key:`particle-${E.id}`,class:it(["tree-item scene-object-item",{on:C.value==="particle"&&E.id===Be(e).activeObjectId}]),onClick:ae=>W(G)},[S[190]||(S[190]=A("span",{class:"tdot"},"●",-1)),A("span",fO,He(E.config.name||"ParticleSystem"+(G+1)),1),A("button",{class:it(["scene-object-eye",{off:E.visible===!1}]),title:E.visible===!1?"显示粒子系统":"隐藏粒子系统","aria-label":E.visible===!1?"显示粒子系统":"隐藏粒子系统",onClick:Tt(ae=>E.visible=E.visible===!1,["stop"])},[(ne(),de("svg",pO,[S[188]||(S[188]=A("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[189]||(S[189]=A("circle",{cx:"12",cy:"12",r:"2.8"},null,-1)),E.visible===!1?(ne(),de("path",gO)):Ve("",!0)]))],10,mO),S[191]||(S[191]=A("span",{class:"scene-object-kind"},"粒子",-1)),A("button",{class:"scene-object-delete",title:"删除粒子系统",onClick:Tt(ae=>Be(e).removeSystem(E.id),["stop"])},"✕",8,vO)],10,dO))),128)),(ne(!0),de(Je,null,ri(Be(e).colliders,E=>(ne(),de("div",{key:`collision-${E.id}`,class:it(["tree-item scene-object-item",{on:C.value==="collision"&&E.id===Be(e).activeObjectId}]),onClick:G=>Be(e).selectSceneObject("collision",E.id)},[S[194]||(S[194]=A("span",{class:"tdot collision-dot"},"■",-1)),A("span",xO,He(E.name),1),A("button",{class:it(["scene-object-eye",{off:E.visible===!1}]),title:E.visible===!1?"显示碰撞体":"隐藏碰撞体","aria-label":E.visible===!1?"显示碰撞体":"隐藏碰撞体",onClick:Tt(G=>E.visible=E.visible===!1,["stop"])},[(ne(),de("svg",wO,[S[192]||(S[192]=A("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[193]||(S[193]=A("circle",{cx:"12",cy:"12",r:"2.8"},null,-1)),E.visible===!1?(ne(),de("path",SO)):Ve("",!0)]))],10,bO),S[195]||(S[195]=A("span",{class:"scene-object-kind"},"碰撞",-1)),A("button",{class:"scene-object-delete",title:"删除碰撞体",onClick:Tt(G=>Be(e).removeCollider(E.id),["stop"])},"✕",8,_O)],10,yO))),128)),(ne(!0),de(Je,null,ri(Be(e).paths,E=>(ne(),de("div",{key:`path-${E.id}`,class:it(["tree-item scene-object-item",{on:C.value==="path"&&E.id===Be(e).activeObjectId}]),onClick:G=>Be(e).selectSceneObject("path",E.id)},[S[198]||(S[198]=A("span",{class:"tdot path-dot"},"◇",-1)),A("span",MO,He(E.name),1),A("button",{class:it(["scene-object-eye",{off:E.visible===!1}]),title:E.visible===!1?"显示路径":"隐藏路径","aria-label":E.visible===!1?"显示路径":"隐藏路径",onClick:Tt(G=>E.visible=E.visible===!1,["stop"])},[(ne(),de("svg",AO,[S[196]||(S[196]=A("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[197]||(S[197]=A("circle",{cx:"12",cy:"12",r:"2.8"},null,-1)),E.visible===!1?(ne(),de("path",CO)):Ve("",!0)]))],10,EO),S[199]||(S[199]=A("span",{class:"scene-object-kind"},"路径",-1)),A("button",{class:"scene-object-delete",title:"删除路径",onClick:Tt(G=>Be(e).removePath(E.id),["stop"])},"✕",8,IO)],10,TO))),128)),(ne(!0),de(Je,null,ri(Be(e).spines,E=>(ne(),de("div",{key:`spine-${E.id}`,class:it(["tree-item scene-object-item",{on:C.value==="spine"&&E.id===Be(e).activeObjectId}]),onClick:G=>Be(e).selectSceneObject("spine",E.id)},[S[202]||(S[202]=A("span",{class:"tdot spine-dot"},"◆",-1)),A("span",PO,He(E.name),1),A("button",{class:it(["scene-object-eye",{off:E.visible===!1}]),title:E.visible===!1?"显示 Spine":"隐藏 Spine","aria-label":E.visible===!1?"显示 Spine":"隐藏 Spine",onClick:Tt(G=>E.visible=E.visible===!1,["stop"])},[(ne(),de("svg",FO,[S[200]||(S[200]=A("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[201]||(S[201]=A("circle",{cx:"12",cy:"12",r:"2.8"},null,-1)),E.visible===!1?(ne(),de("path",OO)):Ve("",!0)]))],10,kO),S[203]||(S[203]=A("span",{class:"scene-object-kind"},"Spine",-1)),A("button",{class:"scene-object-delete",title:"删除 Spine",onClick:Tt(G=>Be(e).removeSpine(E.id),["stop"])},"✕",8,BO)],10,RO))),128)),!Be(e).systems.length&&!Be(e).colliders.length&&!Be(e).paths.length&&!Be(e).spines.length?(ne(),de("div",LO,"场景中暂无对象")):Ve("",!0)]),C.value==="particle"&&x.value?(ne(),de(Je,{key:0},[A("label",DO,[S[204]||(S[204]=A("span",null,"名称",-1)),_e(A("input",{"onUpdate:modelValue":S[4]||(S[4]=E=>x.value.config.name=E),class:"inp"},null,512),[[tt,x.value.config.name]])]),Ye(je,{label:"位置X",min:-2e3,max:2e3,step:1,modelValue:x.value.config.centerX,"onUpdate:modelValue":S[5]||(S[5]=E=>x.value.config.centerX=E)},null,8,["modelValue"]),Ye(je,{label:"位置Y",min:-2e3,max:2e3,step:1,modelValue:x.value.config.centerY,"onUpdate:modelValue":S[6]||(S[6]=E=>x.value.config.centerY=E)},null,8,["modelValue"]),Ye(je,{label:"偏移X",min:-2e3,max:2e3,step:1,modelValue:x.value.config.offsetX,"onUpdate:modelValue":S[7]||(S[7]=E=>x.value.config.offsetX=E)},null,8,["modelValue"]),Ye(je,{label:"偏移Y",min:-2e3,max:2e3,step:1,modelValue:x.value.config.offsetY,"onUpdate:modelValue":S[8]||(S[8]=E=>x.value.config.offsetY=E)},null,8,["modelValue"]),Ye(je,{label:"旋转",min:-360,max:360,step:1,modelValue:x.value.config.rootRotation,"onUpdate:modelValue":S[9]||(S[9]=E=>x.value.config.rootRotation=E)},null,8,["modelValue"]),Ye(je,{label:"缩放X",min:.05,max:10,step:.05,modelValue:x.value.config.rootScaleX,"onUpdate:modelValue":S[10]||(S[10]=E=>x.value.config.rootScaleX=E)},null,8,["modelValue"]),Ye(je,{label:"缩放Y",min:.05,max:10,step:.05,modelValue:x.value.config.rootScaleY,"onUpdate:modelValue":S[11]||(S[11]=E=>x.value.config.rootScaleY=E)},null,8,["modelValue"]),A("div",NO,[S[205]||(S[205]=A("label",{for:"system-seed"},"随机种子",-1)),_e(A("input",{id:"system-seed",class:"seed-input",type:"number",min:"0",step:"1","onUpdate:modelValue":S[12]||(S[12]=E=>x.value.config.seed=E),title:"控制粒子系统内全部随机属性、资源选择与修改器随机采样"},null,512),[[tt,x.value.config.seed,void 0,{number:!0}]]),A("button",{class:"seed-random",title:"生成新的全局随机种子",onClick:Ze},"⚄")]),S[206]||(S[206]=A("div",{class:"seed-hint"},"控制初始随机参数、资源选择和修改器随机采样;相同种子可复现相同效果",-1))],64)):I.value?(ne(),de(Je,{key:1},[S[233]||(S[233]=A("div",{class:"object-editor-title"},"碰撞体属性",-1)),A("label",UO,[S[207]||(S[207]=A("span",null,"碰撞体名称",-1)),_e(A("input",{"onUpdate:modelValue":S[13]||(S[13]=E=>I.value.name=E),class:"inp"},null,512),[[tt,I.value.name]])]),A("div",XO,[S[208]||(S[208]=A("span",null,"碰撞体标签",-1)),A("div",YO,[(ne(!0),de(Je,null,ri(I.value.tags,E=>(ne(),de("button",{key:E,class:it(["object-tag",{on:I.value.selectedTag===E}]),onClick:G=>I.value.selectedTag=E},He(E),11,VO))),128)),A("button",{class:"tag-add",title:"新增标签",onClick:ue},"+")]),S[209]||(S[209]=A("small",null,"点击标签为当前碰撞体选择标签;点击+新增标签。",-1))]),A("div",$O,[A("label",GO,[S[211]||(S[211]=A("span",null,"类型",-1)),_e(A("select",{"onUpdate:modelValue":S[14]||(S[14]=E=>I.value.shape=E),class:"inp"},[...S[210]||(S[210]=[La('<option value="circle" data-v-d59d2731>圆形</option><option value="ellipse" data-v-d59d2731>椭圆</option><option value="rect" data-v-d59d2731>矩形</option><option value="polygon" data-v-d59d2731>多边形</option><option value="custom" data-v-d59d2731>自定义</option>',5)])],512),[[Vt,I.value.shape]])]),A("label",HO,[S[212]||(S[212]=A("span",null,"启用",-1)),_e(A("input",{"onUpdate:modelValue":S[15]||(S[15]=E=>I.value.enabled=E),type:"checkbox"},null,512),[[Wt,I.value.enabled]])])]),A("div",jO,[A("label",WO,[S[213]||(S[213]=A("span",null,"X 位置",-1)),_e(A("input",{"onUpdate:modelValue":S[16]||(S[16]=E=>I.value.x=E),type:"number",class:"inp"},null,512),[[tt,I.value.x,void 0,{number:!0}]])]),A("label",zO,[S[214]||(S[214]=A("span",null,"Y 位置",-1)),_e(A("input",{"onUpdate:modelValue":S[17]||(S[17]=E=>I.value.y=E),type:"number",class:"inp"},null,512),[[tt,I.value.y,void 0,{number:!0}]])])]),Ye(je,{label:"旋转",min:-360,max:360,step:1,modelValue:I.value.rotation,"onUpdate:modelValue":S[18]||(S[18]=E=>I.value.rotation=E)},null,8,["modelValue"]),A("div",qO,[A("label",KO,[S[215]||(S[215]=A("span",null,"缩放 X",-1)),_e(A("input",{"onUpdate:modelValue":S[19]||(S[19]=E=>I.value.scaleX=E),type:"number",min:"0.05",step:"0.05",class:"inp"},null,512),[[tt,I.value.scaleX,void 0,{number:!0}]])]),A("label",ZO,[S[216]||(S[216]=A("span",null,"缩放 Y",-1)),_e(A("input",{"onUpdate:modelValue":S[20]||(S[20]=E=>I.value.scaleY=E),type:"number",min:"0.05",step:"0.05",class:"inp"},null,512),[[tt,I.value.scaleY,void 0,{number:!0}]])])]),I.value.shape==="circle"?(ne(),Nt(je,{key:0,label:"半径",min:1,max:1e3,step:1,modelValue:I.value.radius,"onUpdate:modelValue":S[21]||(S[21]=E=>I.value.radius=E)},null,8,["modelValue"])):I.value.shape==="ellipse"?(ne(),de("div",JO,[A("label",QO,[S[217]||(S[217]=A("span",null,"X 半径",-1)),_e(A("input",{"onUpdate:modelValue":S[22]||(S[22]=E=>I.value.radiusX=E),type:"number",min:"1",class:"inp"},null,512),[[tt,I.value.radiusX,void 0,{number:!0}]])]),A("label",eB,[S[218]||(S[218]=A("span",null,"Y 半径",-1)),_e(A("input",{"onUpdate:modelValue":S[23]||(S[23]=E=>I.value.radiusY=E),type:"number",min:"1",class:"inp"},null,512),[[tt,I.value.radiusY,void 0,{number:!0}]])])])):(ne(),de("div",tB,[A("label",iB,[S[219]||(S[219]=A("span",null,"宽度",-1)),_e(A("input",{"onUpdate:modelValue":S[24]||(S[24]=E=>I.value.width=E),type:"number",min:"1",class:"inp"},null,512),[[tt,I.value.width,void 0,{number:!0}]])]),A("label",sB,[S[220]||(S[220]=A("span",null,"高度",-1)),_e(A("input",{"onUpdate:modelValue":S[25]||(S[25]=E=>I.value.height=E),type:"number",min:"1",class:"inp"},null,512),[[tt,I.value.height,void 0,{number:!0}]])])])),I.value.shape==="polygon"||I.value.shape==="custom"?(ne(),Nt(je,{key:3,label:"边数",min:3,max:16,step:1,modelValue:I.value.sides,"onUpdate:modelValue":S[26]||(S[26]=E=>I.value.sides=E)},null,8,["modelValue"])):Ve("",!0),A("label",nB,[S[222]||(S[222]=A("span",null,"碰撞响应",-1)),_e(A("select",{"onUpdate:modelValue":S[27]||(S[27]=E=>I.value.response=E),class:"inp"},[...S[221]||(S[221]=[A("option",{value:"physics"},"物理(弹跳/摩擦)",-1),A("option",{value:"pause"},"暂停(停止不动)",-1),A("option",{value:"destroy"},"消失(立即销毁)",-1)])],512),[[Vt,I.value.response]])]),I.value.response==="physics"?(ne(),de("div",rB,[A("label",aB,[S[223]||(S[223]=A("span",null,"弹性 (0-1)",-1)),_e(A("input",{"onUpdate:modelValue":S[28]||(S[28]=E=>I.value.elasticity=E),type:"number",min:"0",max:"1",step:"0.01",class:"inp"},null,512),[[tt,I.value.elasticity,void 0,{number:!0}]])]),A("label",oB,[S[224]||(S[224]=A("span",null,"摩擦 (0-1)",-1)),_e(A("input",{"onUpdate:modelValue":S[29]||(S[29]=E=>I.value.friction=E),type:"number",min:"0",max:"1",step:"0.01",class:"inp"},null,512),[[tt,I.value.friction,void 0,{number:!0}]])])])):Ve("",!0),A("div",lB,[A("label",cB,[_e(A("input",{"onUpdate:modelValue":S[30]||(S[30]=E=>I.value.followPath=E),type:"checkbox"},null,512),[[Wt,I.value.followPath]]),S[225]||(S[225]=ei("跟随路径移动",-1))]),I.value.followPath?(ne(),de(Je,{key:0},[A("label",hB,[S[227]||(S[227]=A("span",null,"目标路径",-1)),_e(A("select",{"onUpdate:modelValue":S[31]||(S[31]=E=>I.value.followPathId=E),class:"inp"},[S[226]||(S[226]=A("option",{value:0},"(未选择)",-1)),(ne(!0),de(Je,null,ri(Be(e).paths,E=>(ne(),de("option",{key:E.id,value:E.id},He(E.name),9,uB))),128))],512),[[Vt,I.value.followPathId,void 0,{number:!0}]])]),A("div",dB,[A("label",fB,[S[228]||(S[228]=A("span",null,"移动时长(秒)",-1)),_e(A("input",{"onUpdate:modelValue":S[32]||(S[32]=E=>I.value.followDuration=E),type:"number",min:"0.05",step:"0.05",class:"inp"},null,512),[[tt,I.value.followDuration,void 0,{number:!0}]])]),A("label",mB,[S[230]||(S[230]=A("span",null,"曲线模式",-1)),_e(A("select",{"onUpdate:modelValue":S[33]||(S[33]=E=>I.value.followCurveMode=E),class:"inp"},[...S[229]||(S[229]=[A("option",null,"跟随导出",-1),A("option",null,"线性",-1),A("option",null,"贝塞尔",-1)])],512),[[Vt,I.value.followCurveMode]])])]),A("label",pB,[_e(A("input",{"onUpdate:modelValue":S[34]||(S[34]=E=>I.value.followPathRotation=E),type:"checkbox"},null,512),[[Wt,I.value.followPathRotation]]),S[231]||(S[231]=ei("方向沿路径",-1))]),S[232]||(S[232]=A("div",{class:"collider-curve-title"},[ei("移动进度曲线 "),A("small",null,"横轴:实时/移动时长 纵轴:路径进度(0=起点 → 1=终点)")],-1)),Ye(Qs,{"model-value":I.value.followCurve||Y,"default-value":Y,mode:d(I.value.followCurveMode),"onUpdate:modelValue":S[35]||(S[35]=E=>I.value.followCurve=E)},null,8,["model-value","mode"])],64)):Ve("",!0)])],64)):k.value?(ne(),de(Je,{key:2},[S[243]||(S[243]=A("div",{class:"object-editor-title"},"路径属性",-1)),A("label",gB,[S[234]||(S[234]=A("span",null,"路径名称",-1)),_e(A("input",{"onUpdate:modelValue":S[36]||(S[36]=E=>k.value.name=E),class:"inp"},null,512),[[tt,k.value.name]])]),A("div",vB,[A("label",yB,[S[235]||(S[235]=A("span",null,"X 位置",-1)),_e(A("input",{"onUpdate:modelValue":S[37]||(S[37]=E=>k.value.x=E),type:"number",class:"inp"},null,512),[[tt,k.value.x,void 0,{number:!0}]])]),A("label",xB,[S[236]||(S[236]=A("span",null,"Y 位置",-1)),_e(A("input",{"onUpdate:modelValue":S[38]||(S[38]=E=>k.value.y=E),type:"number",class:"inp"},null,512),[[tt,k.value.y,void 0,{number:!0}]])])]),Ye(je,{label:"旋转",min:-360,max:360,step:1,modelValue:k.value.rotation,"onUpdate:modelValue":S[39]||(S[39]=E=>k.value.rotation=E)},null,8,["modelValue"]),A("div",bB,[A("label",wB,[S[237]||(S[237]=A("span",null,"缩放 X",-1)),_e(A("input",{"onUpdate:modelValue":S[40]||(S[40]=E=>k.value.scaleX=E),type:"number",min:"0.05",step:"0.05",class:"inp"},null,512),[[tt,k.value.scaleX,void 0,{number:!0}]])]),A("label",SB,[S[238]||(S[238]=A("span",null,"缩放 Y",-1)),_e(A("input",{"onUpdate:modelValue":S[41]||(S[41]=E=>k.value.scaleY=E),type:"number",min:"0.05",step:"0.05",class:"inp"},null,512),[[tt,k.value.scaleY,void 0,{number:!0}]])])]),A("label",_B,[S[239]||(S[239]=A("span",null,"闭合路径",-1)),_e(A("input",{"onUpdate:modelValue":S[42]||(S[42]=E=>k.value.closed=E),type:"checkbox"},null,512),[[Wt,k.value.closed]])]),A("label",TB,[S[240]||(S[240]=A("span",null,"路径颜色",-1)),_e(A("input",{"onUpdate:modelValue":S[43]||(S[43]=E=>k.value.color=E),type:"color",class:"path-color"},null,512),[[tt,k.value.color]])]),S[244]||(S[244]=La('<div class="path-help" data-v-d59d2731><span data-v-d59d2731>操作说明:</span><ul data-v-d59d2731><li data-v-d59d2731>双击空白处/曲线:新建锚点</li><li data-v-d59d2731>双击锚点:删除节点</li><li data-v-d59d2731>双击第二下按住拖动:新建并拉出手柄</li><li data-v-d59d2731>拖动锚点移动位置,拖动手柄调整曲线</li><li data-v-d59d2731>Shift+拖动手柄:两侧完全对称</li><li data-v-d59d2731>Alt+拖动手柄:独立控制单侧</li><li data-v-d59d2731>Ctrl+点击/框选:加选节点</li><li data-v-d59d2731>Alt+点击/框选:减选节点</li><li data-v-d59d2731>Alt+单击空白处:清除全部选中</li><li data-v-d59d2731>选中多个节点后可整体拖动</li></ul></div>',1)),A("label",MB,[S[242]||(S[242]=A("span",null,"应用预设形状",-1)),_e(A("select",{"onUpdate:modelValue":S[44]||(S[44]=E=>k.value.preset=E),class:"inp"},[...S[241]||(S[241]=[La('<option value="" data-v-d59d2731>选择预设...</option><option value="circle" data-v-d59d2731>圆形</option><option value="square" data-v-d59d2731>方形</option><option value="polygon" data-v-d59d2731>多边形</option><option value="star" data-v-d59d2731>星形</option>',5)])],512),[[Vt,k.value.preset]])]),A("button",{class:"path-action primary",onClick:Re},"应用预设"),A("button",{class:"path-action",onClick:Fe},"清空锚点")],64)):R.value?(ne(),Nt(mF,{key:3,"spine-object":R.value},null,8,["spine-object"])):(ne(),de("div",EB,"使用右上角按钮创建场景对象"))],512),[[ar,!X.scene]])]),C.value==="particle"&&x.value?(ne(),de(Je,{key:0},[A("div",AB,[A("div",{class:"group-head",onClick:S[46]||(S[46]=E=>K("emitMode"))},[A("span",CB,He(X.emitMode?"▸":"▾"),1),S[245]||(S[245]=A("span",null,"发射模式",-1)),A("button",{class:"group-reset",title:"重置发射模式参数",onClick:S[45]||(S[45]=Tt(E=>Z("emitMode"),["stop"]))},"重置")]),_e(A("div",IB,[A("div",RB,[A("button",{class:it(["seg",{on:x.value.config.mode==="stream"}]),onClick:S[47]||(S[47]=E=>z("stream"))},"持续",2),A("button",{class:it(["seg",{on:x.value.config.mode==="burst"}]),onClick:S[48]||(S[48]=E=>z("burst"))},"爆发",2)]),x.value.config.mode==="stream"?(ne(),de(Je,{key:0},[A("div",PB,[A("button",{class:it(["seg",{on:x.value.config.streamBehavior==="normal"}]),onClick:S[49]||(S[49]=E=>me("normal"))},"常规持续",2),A("button",{class:it(["seg",{on:x.value.config.streamBehavior==="loop"}]),onClick:S[50]||(S[50]=E=>me("loop"))},"循环持续",2)]),Ye(je,{label:"发射速率",min:1,max:300,step:1,modelValue:x.value.config.rate,"onUpdate:modelValue":S[51]||(S[51]=E=>x.value.config.rate=E)},null,8,["modelValue"]),x.value.config.streamBehavior==="normal"?(ne(),Nt(je,{key:0,label:"发射时长",min:1/30,max:60,step:1/30,modelValue:x.value.config.duration,"onUpdate:modelValue":S[52]||(S[52]=E=>x.value.config.duration=E)},null,8,["modelValue"])):(ne(),Nt(je,{key:1,label:"发射时长 (f)",min:1,max:1800,step:1,"model-value":T.value,"onUpdate:modelValue":se},null,8,["model-value"])),x.value.config.streamBehavior==="loop"?(ne(),de("div",kB,[A("div",FB,[A("label",OB,[A("input",{type:"checkbox",checked:x.value.config.generateLoopStartAnimation,onChange:S[53]||(S[53]=E=>pe("start",E))},null,40,BB),S[246]||(S[246]=A("span",{class:"switch-ui"},null,-1)),S[247]||(S[247]=A("span",null,"生成开始循环动画",-1))]),x.value.config.generateLoopStartAnimation?(ne(),de("div",LB,[A("label",DB,[A("input",{type:"checkbox",checked:x.value.config.loopStartUseCustomDuration,onChange:S[54]||(S[54]=E=>Ie("start",E))},null,40,NB),S[248]||(S[248]=A("span",{class:"switch-ui"},null,-1)),S[249]||(S[249]=A("span",null,"指定时长",-1))]),A("label",UB,[x.value.config.loopStartUseCustomDuration?(ne(),de("input",{key:0,value:x.value.config.loopStartDurationFrames,type:"number",min:"1",max:"1800",step:"1","aria-label":"开始循环段时长",onChange:S[55]||(S[55]=E=>Me("start",E))},null,40,XB)):Ve("",!0),x.value.config.loopStartUseCustomDuration?(ne(),de("span",YB,"f")):(ne(),de("span",VB,"自动 "+He(M.value)+"f",1))])])):Ve("",!0)]),A("div",$B,[A("label",GB,[A("input",{type:"checkbox",checked:x.value.config.generateLoopEndAnimation,onChange:S[56]||(S[56]=E=>pe("end",E))},null,40,HB),S[250]||(S[250]=A("span",{class:"switch-ui"},null,-1)),S[251]||(S[251]=A("span",null,"生成结束循环动画",-1))]),x.value.config.generateLoopEndAnimation?(ne(),de("div",jB,[A("label",WB,[A("input",{type:"checkbox",checked:x.value.config.loopEndUseCustomDuration,onChange:S[57]||(S[57]=E=>Ie("end",E))},null,40,zB),S[252]||(S[252]=A("span",{class:"switch-ui"},null,-1)),S[253]||(S[253]=A("span",null,"指定时长",-1))]),A("label",qB,[x.value.config.loopEndUseCustomDuration?(ne(),de("input",{key:0,value:x.value.config.loopEndDurationFrames,type:"number",min:"1",max:"1800",step:"1","aria-label":"结束循环段时长",onChange:S[58]||(S[58]=E=>Me("end",E))},null,40,KB)):Ve("",!0),x.value.config.loopEndUseCustomDuration?(ne(),de("span",ZB,"f")):(ne(),de("span",JB,"自动 "+He(M.value)+"f",1))])])):Ve("",!0)])])):Ve("",!0),x.value.config.streamBehavior==="loop"?(ne(),de("div",QB,"循环持续模式不支持骨骼跟随和路径跟随;进入或退出时会将粒子跟随设置恢复默认值。")):Ve("",!0)],64)):(ne(),Nt(je,{key:1,label:"单次数量",min:1,max:1e3,step:1,modelValue:x.value.config.burstCount,"onUpdate:modelValue":S[59]||(S[59]=E=>x.value.config.burstCount=E)},null,8,["modelValue"])),Ye(je,{label:"延迟时间",min:0,max:5,step:.1,modelValue:x.value.config.delay,"onUpdate:modelValue":S[60]||(S[60]=E=>x.value.config.delay=E)},null,8,["modelValue"])],512),[[ar,!X.emitMode]])]),A("div",eL,[A("div",{class:"group-head",onClick:S[62]||(S[62]=E=>K("shape"))},[A("span",tL,He(X.shape?"▸":"▾"),1),S[254]||(S[254]=A("span",null,"发射器形状",-1)),A("button",{class:"group-reset",title:"重置发射器形状参数",onClick:S[61]||(S[61]=Tt(E=>Z("shape"),["stop"]))},"重置")]),_e(A("div",iL,[A("label",sL,[S[256]||(S[256]=A("span",null,"形状",-1)),_e(A("select",{"onUpdate:modelValue":S[63]||(S[63]=E=>x.value.config.shape=E),class:"inp",onChange:Xt},[...S[255]||(S[255]=[La('<option value="point" data-v-d59d2731>点</option><option value="circle" data-v-d59d2731>圆形</option><option value="rect" data-v-d59d2731>矩形</option><option value="cone" data-v-d59d2731>锥体</option><option value="orbit" data-v-d59d2731>轨道</option>',5)])],544),[[Vt,x.value.config.shape]])]),x.value.config.shape==="circle"||x.value.config.shape==="cone"?(ne(),Nt(je,{key:0,label:"半径",min:0,max:300,step:1,modelValue:x.value.config.radius,"onUpdate:modelValue":S[64]||(S[64]=E=>x.value.config.radius=E)},null,8,["modelValue"])):Ve("",!0),x.value.config.shape==="cone"?(ne(),Nt(je,{key:1,label:"锥形开口角度",min:1,max:360,step:1,modelValue:x.value.config.coneAngle,"onUpdate:modelValue":S[65]||(S[65]=E=>x.value.config.coneAngle=E)},null,8,["modelValue"])):x.value.config.shape==="rect"?(ne(),de(Je,{key:2},[Ye(je,{label:"宽",min:1,max:400,step:1,modelValue:x.value.config.rectW,"onUpdate:modelValue":S[66]||(S[66]=E=>x.value.config.rectW=E)},null,8,["modelValue"]),Ye(je,{label:"高",min:1,max:400,step:1,modelValue:x.value.config.rectH,"onUpdate:modelValue":S[67]||(S[67]=E=>x.value.config.rectH=E)},null,8,["modelValue"])],64)):Ve("",!0),S[257]||(S[257]=A("div",{class:"divider"},null,-1)),Ye(je,{label:x.value.config.shape==="cone"?"锥形朝向":"发射角度",min:-360,max:360,step:1,modelValue:x.value.config.direction,"onUpdate:modelValue":S[68]||(S[68]=E=>x.value.config.direction=E)},null,8,["label","modelValue"]),x.value.config.shape!=="cone"?(ne(),Nt(je,{key:3,label:"扩散角度",min:0,max:360,step:1,modelValue:x.value.config.spread,"onUpdate:modelValue":S[69]||(S[69]=E=>x.value.config.spread=E)},null,8,["modelValue"])):Ve("",!0)],512),[[ar,!X.shape]])]),A("div",nL,[A("div",{class:"group-head",onClick:S[71]||(S[71]=E=>K("attr"))},[A("span",rL,He(X.attr?"▸":"▾"),1),S[258]||(S[258]=A("span",null,"粒子属性",-1)),A("button",{class:"group-reset",title:"重置粒子属性参数",onClick:S[70]||(S[70]=Tt(E=>Z("attr"),["stop"]))},"重置")]),_e(A("div",aL,[S[266]||(S[266]=A("div",{class:"attr-section-title"},"粒子初始参数",-1)),Ye(Rn,{label:"初始生命周期","allow-curve":!1,mode:x.value.config.lifeMode,"onUpdate:mode":S[72]||(S[72]=E=>x.value.config.lifeMode=E),"value-min":x.value.config.lifeMin,"onUpdate:valueMin":S[73]||(S[73]=E=>x.value.config.lifeMin=E),"value-max":x.value.config.lifeMax,"onUpdate:valueMax":S[74]||(S[74]=E=>x.value.config.lifeMax=E),curve:x.value.config.lifeCurve,"onUpdate:curve":S[75]||(S[75]=E=>x.value.config.lifeCurve=E),min:.1,max:10,step:.1,"curve-label":"随机采样 →"},null,8,["mode","value-min","value-max","curve"]),Ye(Rn,{label:"初始速度","allow-curve":!1,mode:x.value.config.speedMode,"onUpdate:mode":S[76]||(S[76]=E=>x.value.config.speedMode=E),"value-min":x.value.config.speedMin,"onUpdate:valueMin":S[77]||(S[77]=E=>x.value.config.speedMin=E),"value-max":x.value.config.speedMax,"onUpdate:valueMax":S[78]||(S[78]=E=>x.value.config.speedMax=E),curve:x.value.config.speedCurve,"onUpdate:curve":S[79]||(S[79]=E=>x.value.config.speedCurve=E),min:0,max:1e3,step:1,"curve-label":"随机采样 →"},null,8,["mode","value-min","value-max","curve"]),A("div",oL,[S[259]||(S[259]=A("span",null,"初始缩放",-1)),A("div",lL,[A("button",{class:it(["axis-mode",{on:x.value.config.scaleAxisMode==="uniform"}]),onClick:S[80]||(S[80]=E=>x.value.config.scaleAxisMode="uniform")},"统一",2),A("button",{class:it(["axis-mode",{on:x.value.config.scaleAxisMode==="separate"}]),onClick:S[81]||(S[81]=E=>x.value.config.scaleAxisMode="separate")},"XY分离",2)])]),Ye(Rn,{label:x.value.config.scaleAxisMode==="uniform"?"初始缩放":"缩放 X","allow-curve":!1,mode:x.value.config.scaleMode,"onUpdate:mode":S[82]||(S[82]=E=>x.value.config.scaleMode=E),"value-min":x.value.config.scaleMin,"onUpdate:valueMin":S[83]||(S[83]=E=>x.value.config.scaleMin=E),"value-max":x.value.config.scaleMax,"onUpdate:valueMax":S[84]||(S[84]=E=>x.value.config.scaleMax=E),curve:x.value.config.scaleCurve,"onUpdate:curve":S[85]||(S[85]=E=>x.value.config.scaleCurve=E),min:0,max:5,step:.05,"curve-label":"随机采样 →"},null,8,["label","mode","value-min","value-max","curve"]),x.value.config.scaleAxisMode==="separate"?(ne(),Nt(Rn,{key:0,label:"缩放 Y","show-modes":!1,"allow-curve":!1,mode:x.value.config.scaleMode,"onUpdate:mode":S[86]||(S[86]=E=>x.value.config.scaleMode=E),"value-min":x.value.config.scaleYMin,"onUpdate:valueMin":S[87]||(S[87]=E=>x.value.config.scaleYMin=E),"value-max":x.value.config.scaleYMax,"onUpdate:valueMax":S[88]||(S[88]=E=>x.value.config.scaleYMax=E),curve:x.value.config.scaleYCurve,"onUpdate:curve":S[89]||(S[89]=E=>x.value.config.scaleYCurve=E),min:0,max:5,step:.05,"curve-label":"随机采样 →"},null,8,["mode","value-min","value-max","curve"])):Ve("",!0),Ye(Rn,{label:"初始旋转","allow-direction":"","allow-curve":!1,mode:x.value.config.initialRotationMode,"onUpdate:mode":S[90]||(S[90]=E=>x.value.config.initialRotationMode=E),"value-min":x.value.config.initialRotationMin,"onUpdate:valueMin":S[91]||(S[91]=E=>x.value.config.initialRotationMin=E),"value-max":x.value.config.initialRotationMax,"onUpdate:valueMax":S[92]||(S[92]=E=>x.value.config.initialRotationMax=E),curve:x.value.config.initialRotationCurve,"onUpdate:curve":S[93]||(S[93]=E=>x.value.config.initialRotationCurve=E),min:-360,max:360,step:1,"curve-label":"随机采样 →"},null,8,["mode","value-min","value-max","curve"]),S[267]||(S[267]=A("div",{class:"attr-section-title life-title"},"粒子生命周期变化参数",-1)),A("div",cL,[A("label",hL,[_e(A("input",{type:"checkbox","onUpdate:modelValue":S[94]||(S[94]=E=>x.value.config.speedOverLifeEnabled=E)},null,512),[[Wt,x.value.config.speedOverLifeEnabled]]),S[260]||(S[260]=A("span",{class:"switch-ui"},null,-1)),S[261]||(S[261]=A("span",null,"生命周期内速度",-1))]),x.value.config.speedOverLifeEnabled?(ne(),Nt(Rn,{key:0,label:"速度倍率",mode:x.value.config.speedOverLifeMode,"onUpdate:mode":mt,"value-min":x.value.config.speedOverLifeMin,"onUpdate:valueMin":S[95]||(S[95]=E=>x.value.config.speedOverLifeMin=E),"value-max":x.value.config.speedOverLifeMax,"onUpdate:valueMax":S[96]||(S[96]=E=>x.value.config.speedOverLifeMax=E),curve:x.value.config.speedOverLifeCurve,"onUpdate:curve":S[97]||(S[97]=E=>x.value.config.speedOverLifeCurve=E),"default-curve":O,min:0,max:3,step:.05,"curve-label":"生命周期 →"},null,8,["mode","value-min","value-max","curve"])):Ve("",!0)]),A("div",uL,[A("label",dL,[_e(A("input",{type:"checkbox","onUpdate:modelValue":S[98]||(S[98]=E=>x.value.config.scaleOverLifeEnabled=E),onChange:wt},null,544),[[Wt,x.value.config.scaleOverLifeEnabled]]),S[262]||(S[262]=A("span",{class:"switch-ui"},null,-1)),S[263]||(S[263]=A("span",null,"生命周期内缩放",-1))]),x.value.config.scaleOverLifeEnabled?(ne(),de(Je,{key:0},[A("div",fL,[A("button",{class:it(["axis-mode",{on:x.value.config.scaleOverLifeAxisMode==="uniform"}]),onClick:S[99]||(S[99]=E=>x.value.config.scaleOverLifeAxisMode="uniform")},"统一",2),A("button",{class:it(["axis-mode",{on:x.value.config.scaleOverLifeAxisMode==="separate"}]),onClick:S[100]||(S[100]=E=>x.value.config.scaleOverLifeAxisMode="separate")},"XY分离",2)]),Ye(Rn,{label:x.value.config.scaleOverLifeAxisMode==="uniform"?"缩放倍率":"倍率 X",mode:x.value.config.scaleOverLifeMode,"onUpdate:mode":ht,"value-min":x.value.config.scaleOverLifeMin,"onUpdate:valueMin":S[101]||(S[101]=E=>x.value.config.scaleOverLifeMin=E),"value-max":x.value.config.scaleOverLifeMax,"onUpdate:valueMax":S[102]||(S[102]=E=>x.value.config.scaleOverLifeMax=E),curve:x.value.config.scaleOverLifeCurve,"onUpdate:curve":S[103]||(S[103]=E=>x.value.config.scaleOverLifeCurve=E),"default-curve":O,min:0,max:3,step:.05,"curve-label":"生命周期 →"},null,8,["label","mode","value-min","value-max","curve"]),x.value.config.scaleOverLifeAxisMode==="separate"?(ne(),Nt(Rn,{key:0,label:"倍率 Y","show-modes":!1,mode:x.value.config.scaleOverLifeMode,"onUpdate:mode":S[104]||(S[104]=E=>x.value.config.scaleOverLifeMode=E),"value-min":x.value.config.scaleYOverLifeMin,"onUpdate:valueMin":S[105]||(S[105]=E=>x.value.config.scaleYOverLifeMin=E),"value-max":x.value.config.scaleYOverLifeMax,"onUpdate:valueMax":S[106]||(S[106]=E=>x.value.config.scaleYOverLifeMax=E),curve:x.value.config.scaleYOverLifeCurve,"onUpdate:curve":S[107]||(S[107]=E=>x.value.config.scaleYOverLifeCurve=E),"default-curve":O,min:0,max:3,step:.05,"curve-label":"生命周期 →"},null,8,["mode","value-min","value-max","curve"])):Ve("",!0)],64)):Ve("",!0)]),A("div",mL,[A("label",pL,[_e(A("input",{type:"checkbox","onUpdate:modelValue":S[108]||(S[108]=E=>x.value.config.rotationOverLifeEnabled=E)},null,512),[[Wt,x.value.config.rotationOverLifeEnabled]]),S[264]||(S[264]=A("span",{class:"switch-ui"},null,-1)),S[265]||(S[265]=A("span",null,"生命周期内旋转",-1))]),x.value.config.rotationOverLifeEnabled?(ne(),Nt(Rn,{key:0,label:"旋转速度",mode:x.value.config.rotationOverLifeMode,"onUpdate:mode":S[109]||(S[109]=E=>x.value.config.rotationOverLifeMode=E),"value-min":x.value.config.rotationSpeedMin,"onUpdate:valueMin":S[110]||(S[110]=E=>x.value.config.rotationSpeedMin=E),"value-max":x.value.config.rotationSpeedMax,"onUpdate:valueMax":S[111]||(S[111]=E=>x.value.config.rotationSpeedMax=E),curve:x.value.config.rotationOverLifeCurve,"onUpdate:curve":S[112]||(S[112]=E=>x.value.config.rotationOverLifeCurve=E),"default-curve":Y,min:-720,max:720,step:10,"curve-label":"生命周期 →"},null,8,["mode","value-min","value-max","curve"])):Ve("",!0)])],512),[[ar,!X.attr]])]),A("div",gL,[A("div",{class:"group-head",onClick:S[114]||(S[114]=E=>K("look"))},[A("span",vL,He(X.look?"▸":"▾"),1),S[268]||(S[268]=A("span",null,"外观与资源",-1)),A("button",{class:"group-reset",title:"重置外观与资源参数",onClick:S[113]||(S[113]=Tt(E=>Z("look"),["stop"]))},"重置")]),_e(A("div",yL,[S[282]||(S[282]=A("div",{class:"look-title"},"透明度",-1)),A("div",xL,[A("button",{class:it(["seg-btn",{active:x.value.config.alphaMode==="curve"}]),onClick:S[115]||(S[115]=E=>x.value.config.alphaMode="curve")},"曲线",2),A("button",{class:it(["seg-btn",{active:x.value.config.alphaMode==="fixed"}]),onClick:S[116]||(S[116]=E=>x.value.config.alphaMode="fixed")},"固定",2)]),x.value.config.alphaMode==="fixed"?(ne(),Nt(je,{key:0,label:"透明度",min:0,max:1,step:.01,modelValue:x.value.config.alpha,"onUpdate:modelValue":S[117]||(S[117]=E=>x.value.config.alpha=E)},null,8,["modelValue"])):(ne(),de(Je,{key:1},[A("label",bL,[S[270]||(S[270]=A("span",null,"曲线模式",-1)),_e(A("select",{"onUpdate:modelValue":S[118]||(S[118]=E=>x.value.config.curveMode=E),class:"inp"},[...S[269]||(S[269]=[A("option",null,"跟随导出",-1),A("option",null,"线性",-1),A("option",null,"贝塞尔",-1)])],512),[[Vt,x.value.config.curveMode]])]),A("div",wL,[Ye(Qs,{modelValue:x.value.config.alphaCurve,"onUpdate:modelValue":S[119]||(S[119]=E=>x.value.config.alphaCurve=E),"default-value":D,mode:d(x.value.config.curveMode)},null,8,["modelValue","mode"]),S[271]||(S[271]=A("div",{class:"curve-labels"},[A("span",null,"0(透明)"),A("span",null,"生命周期 →"),A("span",null,"1(不透明)")],-1))])],64)),A("div",{class:"look-title image-title"},[S[272]||(S[272]=A("span",null,"图片资源",-1)),A("button",{class:"image-add",title:"新增图片资源",onClick:Sa},"+")]),(ne(!0),de(Je,null,ri(x.value.config.imageResources,E=>(ne(),Nt(dv,{key:E.id,resource:E,"resource-count":x.value.config.imageResources.length,"supports-sequence":"","default-file":"star.png",onPick:_a,onPickSequence:Ta,onReset:Lr,onRemove:$,onUpdateWeight:ye,onToggleLock:Te},{default:tf(()=>[Ye(je,{label:"缩放",min:.1,max:3,step:.05,modelValue:E.scale,"onUpdate:modelValue":G=>E.scale=G},null,8,["modelValue","onUpdate:modelValue"]),A("label",SL,[S[273]||(S[273]=A("span",null,"轴心 x,y",-1)),_e(A("input",{type:"number",step:"0.05",class:"inp tiny","onUpdate:modelValue":G=>E.anchorX=G},null,8,_L),[[tt,E.anchorX,void 0,{number:!0}]]),_e(A("input",{type:"number",step:"0.05",class:"inp tiny","onUpdate:modelValue":G=>E.anchorY=G},null,8,TL),[[tt,E.anchorY,void 0,{number:!0}]])]),S[281]||(S[281]=A("div",{class:"resource-divider"},null,-1)),A("label",ML,[S[276]||(S[276]=A("span",null,"颜色",-1)),_e(A("select",{"onUpdate:modelValue":G=>E.colorMode=G,class:"inp"},[...S[274]||(S[274]=[A("option",{value:"fixed"},"固定色",-1),A("option",{value:"random"},"随机颜色",-1),A("option",{value:"lifetime"},"生命周期",-1)])],8,EL),[[Vt,E.colorMode]]),_e(A("select",{"onUpdate:modelValue":G=>E.blend=G,class:"inp blend-select"},[...S[275]||(S[275]=[A("option",{value:"normal"},"正常",-1),A("option",{value:"add"},"相加",-1),A("option",{value:"multiply"},"相乘",-1),A("option",{value:"screen"},"滤色",-1)])],8,AL),[[Vt,E.blend]])]),E.colorMode==="fixed"?(ne(),de("label",CL,[S[277]||(S[277]=A("span",null,"固定色",-1)),_e(A("input",{type:"color","onUpdate:modelValue":G=>E.colorStart=G,class:"colr"},null,8,IL),[[tt,E.colorStart]]),A("input",{type:"text",class:"hex-input",value:E.colorStart,spellcheck:"false","aria-label":"固定颜色值",onChange:G=>nr(E,G),onKeydown:aa(G=>j(E,G),["enter"])},null,40,RL)])):(ne(),de(Je,{key:1},[Ye(uv,{modelValue:E.colorGradient,"onUpdate:modelValue":G=>E.colorGradient=G},null,8,["modelValue","onUpdate:modelValue"]),E.colorMode==="random"?(ne(),de("div",PL,"每个粒子出生时从色带随机取色,生命周期内保持不变")):Ve("",!0)],64)),A("div",kL,[S[278]||(S[278]=A("span",null,"独立透明度",-1)),A("div",FL,[A("button",{class:it({on:E.independentAlpha==="off"}),onClick:G=>E.independentAlpha="off"},"关闭",10,OL),A("button",{class:it({on:E.independentAlpha==="fixed"}),onClick:G=>E.independentAlpha="fixed"},"固定",10,BL),A("button",{class:it({on:E.independentAlpha==="curve"}),onClick:G=>E.independentAlpha="curve"},"曲线",10,LL)])]),E.independentAlpha==="fixed"?(ne(),Nt(je,{key:2,label:"透明度",min:0,max:1,step:.01,modelValue:E.alpha,"onUpdate:modelValue":G=>E.alpha=G},null,8,["modelValue","onUpdate:modelValue"])):E.independentAlpha==="curve"?(ne(),de(Je,{key:3},[A("label",DL,[S[280]||(S[280]=A("span",null,"曲线模式",-1)),_e(A("select",{"onUpdate:modelValue":G=>E.alphaCurveMode=G,class:"inp"},[...S[279]||(S[279]=[A("option",null,"跟随导出",-1),A("option",null,"线性",-1),A("option",null,"贝塞尔",-1)])],8,NL),[[Vt,E.alphaCurveMode]])]),A("div",UL,[Ye(Qs,{modelValue:E.alphaCurve,"onUpdate:modelValue":G=>E.alphaCurve=G,"default-value":P,mode:d(E.alphaCurveMode)},null,8,["modelValue","onUpdate:modelValue","mode"])])],64)):Ve("",!0)]),_:2},1032,["resource","resource-count"]))),128)),A("input",{ref_key:"textureFileInput",ref:Ti,class:"file-input",type:"file",accept:"image/png,image/jpeg,image/webp,image/gif",onChange:Gs},null,544),A("input",{ref_key:"sequenceFileInput",ref:pi,class:"file-input",type:"file",multiple:"",accept:"image/png,image/jpeg,image/webp,image/gif",onChange:Hs},null,544)],512),[[ar,!X.look]])]),A("div",XL,[A("div",{class:"group-head",onClick:S[121]||(S[121]=E=>K("mods"))},[A("span",YL,He(X.mods?"▸":"▾"),1),S[283]||(S[283]=A("span",null,"修改器",-1)),A("button",{class:"group-reset",title:"重置修改器参数",onClick:S[120]||(S[120]=Tt(E=>Z("mods"),["stop"]))},"重置")]),_e(A("div",VL,[A("div",$L,[A("label",GL,[_e(A("input",{type:"checkbox","onUpdate:modelValue":S[122]||(S[122]=E=>x.value.config.noise=E)},null,512),[[Wt,x.value.config.noise]]),S[284]||(S[284]=A("span",{class:"switch-ui"},null,-1)),S[285]||(S[285]=A("span",null,"开启移动噪声",-1))]),x.value.config.noise?(ne(),de("div",HL,[Ye(je,{label:"强度",min:0,max:100,step:1,modelValue:x.value.config.noiseAmt,"onUpdate:modelValue":S[123]||(S[123]=E=>x.value.config.noiseAmt=E)},null,8,["modelValue"]),Ye(je,{label:"波动范围",min:0,max:500,step:1,modelValue:x.value.config.noiseRange,"onUpdate:modelValue":S[124]||(S[124]=E=>x.value.config.noiseRange=E)},null,8,["modelValue"]),Ye(je,{label:"时间流速",min:0,max:10,step:.1,modelValue:x.value.config.noiseSpeed,"onUpdate:modelValue":S[125]||(S[125]=E=>x.value.config.noiseSpeed=E)},null,8,["modelValue"]),S[286]||(S[286]=A("div",{class:"modifier-hint"},"强度控制影响比例 · 波动范围控制最大偏移 · 时间流速控制变化速度",-1))])):Ve("",!0)]),A("div",jL,[A("label",WL,[_e(A("input",{type:"checkbox","onUpdate:modelValue":S[126]||(S[126]=E=>x.value.config.useGravity=E)},null,512),[[Wt,x.value.config.useGravity]]),S[287]||(S[287]=A("span",{class:"switch-ui"},null,-1)),S[288]||(S[288]=A("span",null,"开启重力",-1))]),x.value.config.useGravity?(ne(),de("div",zL,[A("div",qL,[A("button",{class:it(["axis-mode",{on:x.value.config.gravityMode==="fixed"}]),onClick:S[127]||(S[127]=E=>x.value.config.gravityMode="fixed")},"固定",2),A("button",{class:it(["axis-mode",{on:x.value.config.gravityMode==="random"}]),onClick:S[128]||(S[128]=E=>x.value.config.gravityMode="random")},"随机",2)]),x.value.config.gravityMode==="fixed"?(ne(),Nt(je,{key:0,label:"重力强度",min:-3e3,max:3e3,step:10,modelValue:x.value.config.gravityMin,"onUpdate:modelValue":S[129]||(S[129]=E=>x.value.config.gravityMin=E)},null,8,["modelValue"])):(ne(),de(Je,{key:1},[Ye(je,{label:"强度 min",min:-3e3,max:3e3,step:10,modelValue:x.value.config.gravityMin,"onUpdate:modelValue":S[130]||(S[130]=E=>x.value.config.gravityMin=E)},null,8,["modelValue"]),Ye(je,{label:"强度 max",min:-3e3,max:3e3,step:10,modelValue:x.value.config.gravityMax,"onUpdate:modelValue":S[131]||(S[131]=E=>x.value.config.gravityMax=E)},null,8,["modelValue"])],64)),Ye(je,{label:"方向",min:-360,max:360,step:1,modelValue:x.value.config.gravityDirection,"onUpdate:modelValue":S[132]||(S[132]=E=>x.value.config.gravityDirection=E)},null,8,["modelValue"]),S[289]||(S[289]=A("div",{class:"gravity-curve-title"},[A("span",null,"生命周期内重力"),A("span",null,"纵轴:强度 0~1")],-1)),Ye(Qs,{modelValue:x.value.config.gravityCurve,"onUpdate:modelValue":S[133]||(S[133]=E=>x.value.config.gravityCurve=E),"default-value":O},null,8,["modelValue"]),S[290]||(S[290]=A("div",{class:"gravity-curve-axis"},[A("span",null,"0"),A("span",null,"生命周期 →"),A("span",null,"1")],-1)),S[291]||(S[291]=A("div",{class:"modifier-hint"},"0° 向右 · -90° 向下 · 负强度会反转方向",-1))])):Ve("",!0)]),A("div",KL,[A("label",ZL,[_e(A("input",{type:"checkbox","onUpdate:modelValue":S[134]||(S[134]=E=>x.value.config.wind=E)},null,512),[[Wt,x.value.config.wind]]),S[292]||(S[292]=A("span",{class:"switch-ui"},null,-1)),S[293]||(S[293]=A("span",null,"开启风力",-1))]),x.value.config.wind?(ne(),de("div",JL,[A("div",QL,[A("button",{class:it(["axis-mode",{on:x.value.config.windMode==="fixed"}]),onClick:S[135]||(S[135]=E=>x.value.config.windMode="fixed")},"固定",2),A("button",{class:it(["axis-mode",{on:x.value.config.windMode==="random"}]),onClick:S[136]||(S[136]=E=>x.value.config.windMode="random")},"随机",2)]),x.value.config.windMode==="fixed"?(ne(),Nt(je,{key:0,label:"风力强度",min:-3e3,max:3e3,step:10,modelValue:x.value.config.windMin,"onUpdate:modelValue":S[137]||(S[137]=E=>x.value.config.windMin=E)},null,8,["modelValue"])):(ne(),de(Je,{key:1},[Ye(je,{label:"强度 min",min:-3e3,max:3e3,step:10,modelValue:x.value.config.windMin,"onUpdate:modelValue":S[138]||(S[138]=E=>x.value.config.windMin=E)},null,8,["modelValue"]),Ye(je,{label:"强度 max",min:-3e3,max:3e3,step:10,modelValue:x.value.config.windMax,"onUpdate:modelValue":S[139]||(S[139]=E=>x.value.config.windMax=E)},null,8,["modelValue"])],64)),Ye(je,{label:"方向",min:-360,max:360,step:1,modelValue:x.value.config.windDirection,"onUpdate:modelValue":S[140]||(S[140]=E=>x.value.config.windDirection=E)},null,8,["modelValue"]),S[294]||(S[294]=A("div",{class:"gravity-curve-title"},[A("span",null,"生命周期内风力"),A("span",null,"纵轴:强度 0~1")],-1)),Ye(Qs,{modelValue:x.value.config.windCurve,"onUpdate:modelValue":S[141]||(S[141]=E=>x.value.config.windCurve=E),"default-value":O},null,8,["modelValue"]),S[295]||(S[295]=A("div",{class:"gravity-curve-axis"},[A("span",null,"0"),A("span",null,"生命周期 →"),A("span",null,"1")],-1)),S[296]||(S[296]=A("div",{class:"modifier-hint"},"0° 向右 · -90° 向下 · 负强度会反转方向",-1))])):Ve("",!0)]),A("div",eD,[A("label",tD,[_e(A("input",{type:"checkbox","onUpdate:modelValue":S[142]||(S[142]=E=>x.value.config.forceField=E)},null,512),[[Wt,x.value.config.forceField]]),S[297]||(S[297]=A("span",{class:"switch-ui"},null,-1)),S[298]||(S[298]=A("span",null,"开启力场",-1))]),x.value.config.forceField?(ne(),de("div",iD,[Ye(je,{label:"中心 X",min:-5e3,max:5e3,step:1,modelValue:x.value.config.forceCenterX,"onUpdate:modelValue":S[143]||(S[143]=E=>x.value.config.forceCenterX=E)},null,8,["modelValue"]),Ye(je,{label:"中心 Y",min:-5e3,max:5e3,step:1,modelValue:x.value.config.forceCenterY,"onUpdate:modelValue":S[144]||(S[144]=E=>x.value.config.forceCenterY=E)},null,8,["modelValue"]),Ye(je,{label:"力场强度",min:-300,max:300,step:1,modelValue:x.value.config.forceStrength,"onUpdate:modelValue":S[145]||(S[145]=E=>x.value.config.forceStrength=E)},null,8,["modelValue"]),Ye(je,{label:"力场半径",min:1,max:2e3,step:1,modelValue:x.value.config.forceRadius,"onUpdate:modelValue":S[146]||(S[146]=E=>x.value.config.forceRadius=E)},null,8,["modelValue"]),A("label",sD,[S[300]||(S[300]=A("span",null,"衰减模式",-1)),_e(A("select",{"onUpdate:modelValue":S[147]||(S[147]=E=>x.value.config.forceFalloff=E),class:"inp"},[...S[299]||(S[299]=[A("option",{value:"constant"},"恒定(范围内力度不变)",-1),A("option",{value:"linear"},"线性衰减(边缘为 0)",-1),A("option",{value:"inverse"},"距离反比(中心最强)",-1)])],512),[[Vt,x.value.config.forceFalloff]])]),S[301]||(S[301]=A("div",{class:"modifier-hint"},"正数吸向中心 · 负数向外排斥 · 可在画布内拖动力场圆",-1))])):Ve("",!0)]),A("div",nD,[A("label",rD,[_e(A("input",{type:"checkbox","onUpdate:modelValue":S[148]||(S[148]=E=>x.value.config.attraction=E)},null,512),[[Wt,x.value.config.attraction]]),S[302]||(S[302]=A("span",{class:"switch-ui"},null,-1)),S[303]||(S[303]=A("span",null,"开启吸附",-1))]),x.value.config.attraction?(ne(),de("div",aD,[Ye(je,{label:"吸附点 X",min:-5e3,max:5e3,step:1,modelValue:x.value.config.attractionCenterX,"onUpdate:modelValue":S[149]||(S[149]=E=>x.value.config.attractionCenterX=E)},null,8,["modelValue"]),Ye(je,{label:"吸附点 Y",min:-5e3,max:5e3,step:1,modelValue:x.value.config.attractionCenterY,"onUpdate:modelValue":S[150]||(S[150]=E=>x.value.config.attractionCenterY=E)},null,8,["modelValue"]),Ye(je,{label:"吸附半径",min:0,max:2e3,step:1,modelValue:x.value.config.attractionRadius,"onUpdate:modelValue":S[151]||(S[151]=E=>x.value.config.attractionRadius=E)},null,8,["modelValue"]),Ye(je,{label:"吸附时长",min:.05,max:30,step:.05,modelValue:x.value.config.attractionDuration,"onUpdate:modelValue":S[152]||(S[152]=E=>x.value.config.attractionDuration=E)},null,8,["modelValue"]),Ye(je,{label:"延迟时间",min:0,max:30,step:.05,modelValue:x.value.config.attractionDelay,"onUpdate:modelValue":S[153]||(S[153]=E=>x.value.config.attractionDelay=E)},null,8,["modelValue"]),A("label",oD,[S[305]||(S[305]=A("span",null,"延迟方式",-1)),_e(A("select",{"onUpdate:modelValue":S[154]||(S[154]=E=>x.value.config.attractionDelayMode=E),class:"inp"},[...S[304]||(S[304]=[A("option",{value:"global"},"统一时间",-1),A("option",{value:"particle"},"单粒子生命",-1)])],512),[[Vt,x.value.config.attractionDelayMode]])]),A("label",lD,[S[307]||(S[307]=A("span",null,"吸附方式",-1)),_e(A("select",{"onUpdate:modelValue":S[155]||(S[155]=E=>x.value.config.attractionPath=E),class:"inp"},[...S[306]||(S[306]=[A("option",{value:"linear"},"直线",-1),A("option",{value:"curve"},"曲线",-1)])],512),[[Vt,x.value.config.attractionPath]])]),S[308]||(S[308]=A("div",{class:"modifier-hint"},"延迟后从当前位置开始吸附 · 到达红色范围即死亡 · 可在画布内拖动吸附圆",-1))])):Ve("",!0)]),A("div",cD,[A("label",hD,[_e(A("input",{type:"checkbox","onUpdate:modelValue":S[156]||(S[156]=E=>x.value.config.trail=E)},null,512),[[Wt,x.value.config.trail]]),S[309]||(S[309]=A("span",{class:"switch-ui"},null,-1)),S[310]||(S[310]=A("span",null,"开启拖尾",-1))]),x.value.config.trail?(ne(),de("div",uD,[A("div",{class:"trail-section-head"},[S[311]||(S[311]=A("div",{class:"trail-section-title"},"拖尾独立图片",-1)),A("button",{class:"image-add",title:"增加拖尾图片资源",onClick:le},"+")]),(ne(!0),de(Je,null,ri(x.value.config.trailResources,E=>(ne(),Nt(dv,{key:E.id,resource:E,"resource-count":x.value.config.trailResources.length,"default-file":"trail.png","name-placeholder":"trail","show-folder":!1,onPick:fe,onReset:fs,onRemove:_s,onUpdateWeight:ms,onToggleLock:Br},{default:tf(()=>[S[327]||(S[327]=A("div",{class:"resource-divider"},null,-1)),Ye(je,{label:"旋转",min:-360,max:360,step:1,"model-value":E.rotation,"onUpdate:modelValue":G=>Yt(E.id,G)},null,8,["model-value","onUpdate:modelValue"]),Ye(je,{label:"拖尾骨骼数",min:2,max:16,step:1,"model-value":E.boneCount,"onUpdate:modelValue":G=>Dt(E.id,G)},null,8,["model-value","onUpdate:modelValue"]),Ye(je,{label:"拖尾比例 (%)",min:0,max:100,step:1,modelValue:E.trailRatio,"onUpdate:modelValue":G=>E.trailRatio=G},null,8,["modelValue","onUpdate:modelValue"]),A("label",dD,[S[313]||(S[313]=A("span",null,"拖尾长度",-1)),_e(A("select",{"onUpdate:modelValue":G=>E.lengthMode=G,class:"inp"},[...S[312]||(S[312]=[A("option",{value:"fixed"},"固定",-1),A("option",{value:"random"},"随机范围",-1)])],8,fD),[[Vt,E.lengthMode]])]),E.lengthMode==="fixed"?(ne(),Nt(je,{key:0,label:"长度比例 (%)",min:0,max:500,step:1,modelValue:E.length,"onUpdate:modelValue":G=>E.length=G},null,8,["modelValue","onUpdate:modelValue"])):(ne(),de(Je,{key:1},[Ye(je,{label:"长度最小 (%)",min:0,max:500,step:1,modelValue:E.lengthMin,"onUpdate:modelValue":G=>E.lengthMin=G},null,8,["modelValue","onUpdate:modelValue"]),Ye(je,{label:"长度最大 (%)",min:0,max:500,step:1,modelValue:E.lengthMax,"onUpdate:modelValue":G=>E.lengthMax=G},null,8,["modelValue","onUpdate:modelValue"])],64)),A("label",mD,[S[315]||(S[315]=A("span",null,"拖尾宽度",-1)),_e(A("select",{"onUpdate:modelValue":G=>E.widthSizeMode=G,class:"inp"},[...S[314]||(S[314]=[A("option",{value:"fixed"},"固定",-1),A("option",{value:"random"},"随机范围",-1)])],8,pD),[[Vt,E.widthSizeMode]])]),E.widthSizeMode==="fixed"?(ne(),Nt(je,{key:2,label:"宽度比例 (%)",min:0,max:500,step:1,modelValue:E.width,"onUpdate:modelValue":G=>E.width=G},null,8,["modelValue","onUpdate:modelValue"])):(ne(),de(Je,{key:3},[Ye(je,{label:"宽度最小 (%)",min:0,max:500,step:1,modelValue:E.widthMin,"onUpdate:modelValue":G=>E.widthMin=G},null,8,["modelValue","onUpdate:modelValue"]),Ye(je,{label:"宽度最大 (%)",min:0,max:500,step:1,modelValue:E.widthMax,"onUpdate:modelValue":G=>E.widthMax=G},null,8,["modelValue","onUpdate:modelValue"])],64)),A("label",gD,[S[317]||(S[317]=A("span",null,"宽度缩放",-1)),_e(A("select",{"onUpdate:modelValue":G=>E.widthMode=G,class:"inp"},[...S[316]||(S[316]=[A("option",{value:"particle"},"跟随粒子",-1),A("option",{value:"fixed"},"固定",-1)])],8,vD),[[Vt,E.widthMode]])]),A("label",yD,[_e(A("input",{type:"checkbox","onUpdate:modelValue":G=>E.lifeLengthEnabled=G},null,8,xD),[[Wt,E.lifeLengthEnabled]]),S[318]||(S[318]=A("span",{class:"switch-ui"},null,-1)),S[319]||(S[319]=A("span",null,"生命周期长度曲线",-1))]),E.lifeLengthEnabled?(ne(),Nt(Qs,{key:4,modelValue:E.lifeLengthCurve,"onUpdate:modelValue":G=>E.lifeLengthCurve=G,"default-value":O},null,8,["modelValue","onUpdate:modelValue"])):Ve("",!0),A("label",bD,[_e(A("input",{type:"checkbox","onUpdate:modelValue":G=>E.shapeEnabled=G},null,8,wD),[[Wt,E.shapeEnabled]]),S[320]||(S[320]=A("span",{class:"switch-ui"},null,-1)),S[321]||(S[321]=A("span",null,"形状曲线(首端 → 尾端宽度)",-1))]),E.shapeEnabled?(ne(),Nt(Qs,{key:5,modelValue:E.shapeCurve,"onUpdate:modelValue":G=>E.shapeCurve=G,"default-value":N},null,8,["modelValue","onUpdate:modelValue"])):Ve("",!0),A("div",SD,[S[322]||(S[322]=A("span",null,"颜色模式",-1)),A("div",_D,[A("button",{class:it(["axis-mode",{on:E.colorMode==="particle"}]),onClick:G=>E.colorMode="particle"},"跟随粒子",10,TD),A("button",{class:it(["axis-mode",{on:E.colorMode==="fixed"}]),onClick:G=>E.colorMode="fixed"},"固定",10,MD),A("button",{class:it(["axis-mode",{on:E.colorMode==="curve"}]),onClick:G=>E.colorMode="curve"},"曲线",10,ED)])]),A("label",AD,[S[324]||(S[324]=A("span",null,"混合模式",-1)),_e(A("select",{"onUpdate:modelValue":G=>E.blend=G,class:"inp"},[...S[323]||(S[323]=[A("option",{value:"normal"},"正常",-1),A("option",{value:"add"},"相加",-1),A("option",{value:"multiply"},"相乘",-1),A("option",{value:"screen"},"滤色",-1)])],8,CD),[[Vt,E.blend]])]),E.colorMode==="fixed"?(ne(),de("label",ID,[S[325]||(S[325]=A("span",null,"固定颜色",-1)),_e(A("input",{class:"colr",type:"color","onUpdate:modelValue":G=>E.color=G},null,8,RD),[[tt,E.color]]),A("input",{class:"hex-input",value:E.color,onChange:G=>Zi(E,G),onKeydown:aa(Tt(G=>$i(E,G),["prevent"]),["enter"])},null,40,PD)])):E.colorMode==="curve"?(ne(),Nt(uv,{key:7,modelValue:E.colorGradient,"onUpdate:modelValue":G=>E.colorGradient=G},null,8,["modelValue","onUpdate:modelValue"])):Ve("",!0),A("div",kD,[S[326]||(S[326]=A("span",null,"透明度模式",-1)),A("div",FD,[A("button",{class:it(["axis-mode",{on:E.alphaMode==="particle"}]),onClick:G=>E.alphaMode="particle"},"跟随粒子",10,OD),A("button",{class:it(["axis-mode",{on:E.alphaMode==="fixed"}]),onClick:G=>E.alphaMode="fixed"},"固定",10,BD),A("button",{class:it(["axis-mode",{on:E.alphaMode==="curve"}]),onClick:G=>E.alphaMode="curve"},"曲线",10,LD)])]),E.alphaMode==="fixed"?(ne(),Nt(je,{key:8,label:"透明度",min:0,max:1,step:.01,modelValue:E.alpha,"onUpdate:modelValue":G=>E.alpha=G},null,8,["modelValue","onUpdate:modelValue"])):Ve("",!0),E.alphaMode==="curve"?(ne(),Nt(Qs,{key:9,modelValue:E.alphaCurve,"onUpdate:modelValue":G=>E.alphaCurve=G,"default-value":U},null,8,["modelValue","onUpdate:modelValue"])):Ve("",!0)]),_:2},1032,["resource","resource-count"]))),128)),A("input",{ref_key:"trailTextureFileInput",ref:Ss,class:"file-input",type:"file",accept:"image/png,image/jpeg,image/webp",onChange:ut},null,544),A("div",DD,[Ye(je,{label:"网格行数",min:2,max:16,step:1,"model-value":x.value.config.trailGridRows,"onUpdate:modelValue":S[157]||(S[157]=E=>bt("trailGridRows",E))},null,8,["model-value"]),Ye(je,{label:"网格列数",min:2,max:32,step:1,"model-value":x.value.config.trailGridCols,"onUpdate:modelValue":S[158]||(S[158]=E=>bt("trailGridCols",E))},null,8,["model-value"])]),S[328]||(S[328]=A("div",{class:"modifier-hint"},"每个粒子按资源比例生成一组同级拖尾骨骼;随机长度与宽度在粒子出生时确定,相同种子可稳定复现",-1))])):Ve("",!0)]),A("div",ND,[A("label",UD,[_e(A("input",{type:"checkbox","onUpdate:modelValue":S[159]||(S[159]=E=>x.value.config.emitterFollow=E),disabled:x.value.config.streamBehavior==="loop"},null,8,XD),[[Wt,x.value.config.emitterFollow]]),S[329]||(S[329]=A("span",{class:"switch-ui"},null,-1)),S[330]||(S[330]=A("span",null,"开启发射器跟随",-1))]),x.value.config.emitterFollow&&x.value.config.streamBehavior!=="loop"?(ne(),de("div",YD,[A("label",VD,[S[333]||(S[333]=A("span",null,"跟随模式",-1)),A("select",{value:x.value.config.emitterFollowMode,class:"inp",onChange:S[160]||(S[160]=E=>ge(E,x.value.config))},[S[331]||(S[331]=A("option",{value:"none"},"无",-1)),S[332]||(S[332]=A("option",{value:"path"},"跟随路径",-1)),B.value||x.value.config.emitterFollowMode==="bone"?(ne(),de("option",GD,"选中的骨骼")):Ve("",!0)],40,$D)]),x.value.config.emitterFollowMode==="path"?(ne(),de(Je,{key:0},[A("label",HD,[S[335]||(S[335]=A("span",null,"跟随路径",-1)),_e(A("select",{"onUpdate:modelValue":S[161]||(S[161]=E=>x.value.config.emitterFollowPathId=E),class:"inp"},[S[334]||(S[334]=A("option",{value:0},"无",-1)),(ne(!0),de(Je,null,ri(Be(e).paths,E=>(ne(),de("option",{key:E.id,value:E.id},He(E.name),9,jD))),128))],512),[[Vt,x.value.config.emitterFollowPathId,void 0,{number:!0}]])]),A("label",WD,[S[337]||(S[337]=A("span",null,"发射器角度模式",-1)),_e(A("select",{"onUpdate:modelValue":S[162]||(S[162]=E=>x.value.config.emitterAngleMode=E),class:"inp"},[...S[336]||(S[336]=[A("option",{value:"fixed"},"固定角度",-1),A("option",{value:"direction"},"跟随移动方向",-1)])],512),[[Vt,x.value.config.emitterAngleMode]])]),S[343]||(S[343]=A("div",{class:"gravity-curve-title"},[A("span",null,"移动进度曲线 (0→1)")],-1)),Ye(Qs,{modelValue:x.value.config.emitterFollowCurve,"onUpdate:modelValue":S[163]||(S[163]=E=>x.value.config.emitterFollowCurve=E),"default-value":Y},null,8,["modelValue"]),A("div",zD,[A("label",qD,[S[338]||(S[338]=A("span",null,"移动时长 (s)",-1)),_e(A("input",{"onUpdate:modelValue":S[164]||(S[164]=E=>x.value.config.emitterFollowDuration=E),type:"number",min:"0.05",step:"0.05",class:"inp"},null,512),[[tt,x.value.config.emitterFollowDuration,void 0,{number:!0}]])]),A("label",KD,[S[340]||(S[340]=A("span",null,"跟随空间",-1)),_e(A("select",{"onUpdate:modelValue":S[165]||(S[165]=E=>x.value.config.emitterFollowSpace=E),class:"inp"},[...S[339]||(S[339]=[A("option",{value:"local"},"局部空间(GEN 移动)",-1),A("option",{value:"world"},"世界空间(粒子生成点移动)",-1)])],512),[[Vt,x.value.config.emitterFollowSpace]])])]),A("label",ZD,[S[342]||(S[342]=A("span",null,"移动方向",-1)),_e(A("select",{"onUpdate:modelValue":S[166]||(S[166]=E=>x.value.config.emitterFollowDirection=E),class:"inp"},[...S[341]||(S[341]=[A("option",{value:"forward"},"正向(起点 → 终点)",-1),A("option",{value:"reverse"},"反向(终点 → 起点)",-1)])],512),[[Vt,x.value.config.emitterFollowDirection]])]),Ye(je,{label:"偏移起始点 (0-1)",min:0,max:1,step:.01,modelValue:x.value.config.emitterFollowOffset,"onUpdate:modelValue":S[167]||(S[167]=E=>x.value.config.emitterFollowOffset=E)},null,8,["modelValue"]),S[344]||(S[344]=A("div",{class:"modifier-hint"},"局部空间会移动整个发射器;世界空间只移动新粒子的生成点,已出生粒子留在世界位置。",-1))],64)):x.value.config.emitterFollowMode==="bone"?(ne(),de(Je,{key:1},[L.value?(ne(),de("div",JD,[S[345]||(S[345]=ei("跟随目标:",-1)),A("strong",null,He(L.value.spine.name)+" / "+He(L.value.boneName),1)])):(ne(),de("div",QD,"尚未绑定有效骨骼,请先在 Spine 层级树中选择骨骼。")),B.value&&(!L.value||B.value.spine.id!==L.value.spine.id||B.value.boneName!==L.value.boneName)?(ne(),de("button",{key:2,class:"bone-follow-rebind",onClick:S[168]||(S[168]=E=>Ee(x.value.config))},He(L.value?"重新绑定":"绑定")+"当前选中骨骼:"+He(B.value.spine.name)+" / "+He(B.value.boneName),1)):Ve("",!0),L.value?(ne(),de(Je,{key:3},[A("label",eN,[S[347]||(S[347]=A("span",null,"跟随空间",-1)),_e(A("select",{"onUpdate:modelValue":S[169]||(S[169]=E=>x.value.config.emitterFollowSpace=E),class:"inp"},[...S[346]||(S[346]=[A("option",{value:"local"},"本地空间(随骨骼移动)",-1),A("option",{value:"world"},"世界空间(粒子生成后保持位置)",-1)])],512),[[Vt,x.value.config.emitterFollowSpace]])]),A("div",tN,[A("label",iN,[S[348]||(S[348]=A("span",null,"位移偏移 X",-1)),_e(A("input",{"onUpdate:modelValue":S[170]||(S[170]=E=>x.value.config.emitterFollowBoneOffsetX=E),type:"number",step:"1",class:"inp"},null,512),[[tt,x.value.config.emitterFollowBoneOffsetX,void 0,{number:!0}]])]),A("label",sN,[S[349]||(S[349]=A("span",null,"位移偏移 Y",-1)),_e(A("input",{"onUpdate:modelValue":S[171]||(S[171]=E=>x.value.config.emitterFollowBoneOffsetY=E),type:"number",step:"1",class:"inp"},null,512),[[tt,x.value.config.emitterFollowBoneOffsetY,void 0,{number:!0}]])])]),A("div",nN,[A("label",rN,[S[350]||(S[350]=A("span",null,"旋转偏移",-1)),_e(A("input",{"onUpdate:modelValue":S[172]||(S[172]=E=>x.value.config.emitterFollowBoneRotation=E),type:"number",step:"1",class:"inp"},null,512),[[tt,x.value.config.emitterFollowBoneRotation,void 0,{number:!0}]])]),A("label",aN,[S[351]||(S[351]=A("span",null,"缩放偏移 X",-1)),_e(A("input",{"onUpdate:modelValue":S[173]||(S[173]=E=>x.value.config.emitterFollowBoneScaleX=E),type:"number",step:"0.05",class:"inp"},null,512),[[tt,x.value.config.emitterFollowBoneScaleX,void 0,{number:!0}]])]),A("label",oN,[S[352]||(S[352]=A("span",null,"缩放偏移 Y",-1)),_e(A("input",{"onUpdate:modelValue":S[174]||(S[174]=E=>x.value.config.emitterFollowBoneScaleY=E),type:"number",step:"0.05",class:"inp"},null,512),[[tt,x.value.config.emitterFollowBoneScaleY,void 0,{number:!0}]])])]),S[353]||(S[353]=A("div",{class:"modifier-hint"},"发射器只跟随所选 Spine 骨骼的位置,不继承 Spine 的旋转或缩放;粒子变换使用粒子系统自身参数和上方偏移。",-1))],64)):Ve("",!0)],64)):Ve("",!0)])):Ve("",!0)]),Ye(je,{label:"阻尼",min:0,max:2,step:.05,modelValue:x.value.config.damping,"onUpdate:modelValue":S[175]||(S[175]=E=>x.value.config.damping=E)},null,8,["modelValue"])],512),[[ar,!X.mods]])]),A("div",lN,[A("div",{class:"group-head",onClick:S[177]||(S[177]=E=>K("export"))},[A("span",cN,He(X.export?"▸":"▾"),1),S[354]||(S[354]=A("span",null,"导出设置",-1)),A("button",{class:"group-reset",title:"重置导出设置",onClick:S[176]||(S[176]=Tt(E=>Z("export"),["stop"]))},"重置")]),_e(A("div",hN,[A("label",uN,[S[355]||(S[355]=A("span",null,"图片路径 (Spine Images Path)",-1)),_e(A("input",{"onUpdate:modelValue":S[178]||(S[178]=E=>t.value.imagesPath=E),class:"inp export-input",type:"text",placeholder:"./images/"},null,512),[[tt,t.value.imagesPath,void 0,{trim:!0}]])]),A("label",dN,[S[357]||(S[357]=A("span",null,"Spine 版本",-1)),_e(A("select",{"onUpdate:modelValue":S[179]||(S[179]=E=>t.value.spineVersion=E),class:"inp export-input"},[...S[356]||(S[356]=[La('<option value="3.8" data-v-d59d2731>Spine 3.8</option><option value="4.0" data-v-d59d2731>Spine 4.0</option><option value="4.1" data-v-d59d2731>Spine 4.1</option><option value="4.2" data-v-d59d2731>Spine 4.2</option><option value="4.3" data-v-d59d2731>Spine 4.3</option>',5)])],512),[[Vt,t.value.spineVersion]])]),A("label",fN,[S[359]||(S[359]=A("span",null,"关键帧插值曲线",-1)),_e(A("select",{"onUpdate:modelValue":S[180]||(S[180]=E=>t.value.keyframeCurve=E),class:"inp export-input"},[...S[358]||(S[358]=[A("option",{value:"linear"},"线性 (Linear)",-1),A("option",{value:"bezier"},"平滑贝塞尔 (Smooth Bézier)",-1)])],512),[[Vt,t.value.keyframeCurve]])]),S[368]||(S[368]=A("div",{class:"export-help"},"平滑贝塞尔会在误差允许范围内拟合连续运动;出生、死亡、附件切换和突变仍使用阶跃关键帧。",-1)),t.value.spineVersion==="3.8"?(ne(),de("div",mN,"Spine 3.8 不支持 4.x 的逐通道数组贝塞尔,导出时会转换为经过容差精简的分段线性关键帧。")):Ve("",!0),A("div",pN,[A("label",gN,[S[360]||(S[360]=A("span",null,"导出 FPS",-1)),_e(A("input",{"onUpdate:modelValue":S[181]||(S[181]=E=>t.value.fps=E),class:"inp export-input",type:"number",min:"1",max:"240",step:"1",onChange:q},null,544),[[tt,t.value.fps,void 0,{number:!0}]])]),A("label",vN,[_e(A("input",{"onUpdate:modelValue":S[182]||(S[182]=E=>t.value.omitFps=E),type:"checkbox"},null,512),[[Wt,t.value.omitFps]]),S[361]||(S[361]=ei("不写 fps",-1))])]),S[369]||(S[369]=A("div",{class:"export-help"},"修改 FPS 时保持动画实际秒数不变;“不写 fps”只省略 Spine 的 fps 元数据。",-1)),A("div",yN,[A("label",xN,[_e(A("input",{"onUpdate:modelValue":S[183]||(S[183]=E=>t.value.integerFrameAlignment=E),type:"checkbox"},null,512),[[Wt,t.value.integerFrameAlignment]]),S[362]||(S[362]=A("span",{class:"switch-ui"},null,-1)),S[363]||(S[363]=A("span",null,"整数帧对齐",-1))]),A("label",bN,[_e(A("input",{"onUpdate:modelValue":S[184]||(S[184]=E=>t.value.bonePool=E),type:"checkbox"},null,512),[[Wt,t.value.bonePool]]),S[364]||(S[364]=A("span",{class:"switch-ui"},null,-1)),S[365]||(S[365]=A("span",null,"骨骼对象池",-1))]),A("label",wN,[_e(A("input",{"onUpdate:modelValue":S[185]||(S[185]=E=>t.value.excludeEmptyAnimations=E),type:"checkbox"},null,512),[[Wt,t.value.excludeEmptyAnimations]]),S[366]||(S[366]=A("span",{class:"switch-ui"},null,-1)),S[367]||(S[367]=A("span",null,"排除无内容动画",-1))])])],512),[[ar,!X.export]])])],64)):Ve("",!0)]),A("button",{type:"button",class:"export-spine-json",disabled:l.value,title:l.value?"正在重新计算并烘焙动画":`导出 Spine ${t.value.spineVersion} JSON`,onClick:v},He(l.value?"正在准备导出…":"导出Spine Json"),9,SN),c.value?(ne(),de("div",{key:0,class:it(["export-message",{error:u.value}])},He(c.value),3)):Ve("",!0)]))}}),TN=Tn(_N,[["__scopeId","data-v-d59d2731"]]),MN={class:"timeline"},EN={class:"tl-controls"},AN=["title"],CN={class:"tl-range",title:"自定义播放起始帧"},IN=["max","onKeydown"],RN={class:"tl-range",title:"自定义播放结束帧"},PN=["min","max","onKeydown"],kN=["title"],FN={class:"tl-frame"},ON=["disabled"],BN=["onClick"],LN={key:0},DN={class:"tl-animation-editor"},NN={key:0,class:"tl-animation-error"},UN={class:"tl-animation-actions"},XN=["disabled"],YN={key:1,class:"tl-animation-hint"},VN={class:"tl-anim tl-spine-preview"},$N=["value","disabled"],GN={value:""},HN=["value"],jN={class:"tl-zoom"},WN={class:"tl-ticks"},zN={class:"tl-ticklabel"},qN={class:"tl-lanes"},KN=["onPointerdown"],ZN={class:"lane-name"},JN=["onPointerdown"],QN=["onPointerdown"],e5=["onPointerdown"],t5={class:"lane-name"},i5={key:0,class:"tl-empty"},s5=wn({__name:"Timeline",setup(n){const e=Rl(),t=nt(null),i=nt(null),s=nt(!1),r=nt("animation"),a=nt("");Lo(()=>{(!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=yt(()=>e.systems.find(q=>q.id===e.activeId)||null),h=yt(()=>{const q=o.value;return!q||!z(q)?null:E1(q.config,m.value)});function l(){o.value&&(s.value=!s.value,r.value=o.value.animation,a.value="")}function c(q){const W=o.value;W&&(e.setSystemAnimation(W.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,W=r.value.trim();if(!W){a.value="动画名称不能为空";return}if(W!==q&&e.timeline.animations.includes(W)){a.value="动画名称不能重复";return}if(!e.renameAnimation(q,W)){a.value="无法修改动画名称";return}r.value=W,a.value=""}function f(){var ee,ce;const q=((ee=o.value)==null?void 0:ee.animation)||e.timeline.animation;if(!e.removeAnimation(q)){a.value="至少需要保留一个动画";return}const W=((ce=o.value)==null?void 0:ce.animation)||e.timeline.animation;r.value=W,a.value=""}function p(q){var W;(W=i.value)!=null&&W.contains(q.target)||(s.value=!1)}xo(()=>document.addEventListener("pointerdown",p)),py(()=>document.removeEventListener("pointerdown",p));const m=yt(()=>Math.max(1,e.timeline.fps||30)),g=nt(120),y=nt({}),w=nt({}),v=nt({}),_=nt({}),x=nt(String(e.timeline.playbackStart)),M=nt(String(e.timeline.playbackEnd));hs(()=>e.timeline.playbackStart,q=>{x.value=String(q)}),hs(()=>e.timeline.playbackEnd,q=>{M.value=String(q)});const T=yt(()=>e.timeline.totalFrames),C=yt(()=>g.value<=30?"放大":g.value>=300?"缩小":"适中"),I=yt(()=>e.spines.filter(q=>q.selectedAnimation&&q.animations.some(W=>W.name===q.selectedAnimation&&W.duration>0))),k=yt(()=>(e.activeObjectType==="spine"?e.spines.find(W=>W.id===e.activeObjectId&&W.animations.length):null)||e.spines.find(W=>W.animations.length)||null);function R(q){const W=k.value;W&&(W.selectedAnimation=q.target.value,e.recalcTotalFrames(),e.timeline.frame=0)}function F(){e.setPlaybackStart(Number(x.value)),x.value=String(e.timeline.playbackStart)}function B(){e.setPlaybackEnd(Number(M.value)),M.value=String(e.timeline.playbackEnd)}function L(){const q=h.value;q&&(e.setPlaybackEnd(q.end),e.setPlaybackStart(q.start))}function Y(){var W;const q=((W=t.value)==null?void 0:W.clientWidth)||600;return g.value/q}const O=yt(()=>{const q=[],W=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 ce=0;ce<=W;ce+=ee)q.push({f:ce,px:ce/Y()});return q}),D=yt(()=>e.timeline.frame/Y());function P(q){const W=q.config;return(y.value[q.id]??Math.max(0,Number(W.delay)||0))*m.value/Y()}function U(q){const W=q.config,ee=Math.max(0,Number(W.lifeMin)||0),ce=Math.max(0,Number(W.lifeMax)||0);return W.lifeMode==="fixed"?ee:Math.max(ee,ce)}function N(q){return K(q)}function X(q){if(q.config.mode!=="stream")return 0;if(q.config.streamBehavior==="loop"){const ee=q.config;return(v.value[q.id]??Mr(ee,m.value).loop)/Y()}return(w.value[q.id]??Math.max(1/m.value,Number(q.config.duration)||1))*m.value/Y()}function K(q){const W=q.config;return W.mode==="stream"&&W.streamBehavior==="loop"?se(q)+X(q)+Q(q):X(q)+U(q)*m.value/Y()}function z(q){const W=q.config;return W.mode==="stream"&&W.streamBehavior==="loop"}function se(q){return z(q)?Mr(q.config,m.value).start/Y():0}function Q(q){return z(q)?Mr(q.config,m.value).end/Y():0}function me(q){var W;return((W=q.animations.find(ee=>ee.name===q.selectedAnimation))==null?void 0:W.duration)||0}function pe(q){return(_.value[q.id]??Math.max(0,Number(q.timeOffset)||0))*m.value/Y()}function Me(q){return me(q)*m.value/Y()}function Ie(q){const W=q.deltaY<0?.8:1.25;let ee=g.value*W;ee=Math.min(2e3,Math.max(10,ee)),g.value=Math.round(ee)}function ge(q){const W=t.value,ee=xe=>{const oe=W.getBoundingClientRect(),Se=Math.floor((xe.clientX-oe.left)/oe.width*g.value);e.timeline.frame=Math.max(0,Math.min(Se,T.value-1))};ee(q);const ce=()=>{window.removeEventListener("pointermove",ee),window.removeEventListener("pointerup",ce)};window.addEventListener("pointermove",ee),window.addEventListener("pointerup",ce)}function Ee(q,W){q.stopPropagation();const ee=q.clientX,ce=Math.max(0,Number(W.config.delay)||0),xe=Y()/m.value,oe=Re=>{const Fe=(Re.clientX-ee)*xe,Ze=Math.max(0,Math.min(ce+Fe,600));y.value[W.id]=Math.round(Ze*m.value)/m.value},Se=Re=>{window.removeEventListener("pointermove",oe),window.removeEventListener("pointerup",ue),window.removeEventListener("pointercancel",ke);const Fe=y.value[W.id];delete y.value[W.id],Re&&Fe!=null&&Fe!==ce&&(W.config.delay=Fe)},ue=()=>Se(!0),ke=()=>Se(!1);window.addEventListener("pointermove",oe),window.addEventListener("pointerup",ue),window.addEventListener("pointercancel",ke)}function H(q,W){var wt;q.stopPropagation();const ee=z(W),ce=Math.max(0,Number(W.config.duration)||0),xe=Mr(W.config,m.value).loop,oe=Y()/m.value,Se=((wt=q.currentTarget.closest(".lane-bar"))==null?void 0:wt.getBoundingClientRect().left)??q.clientX,ue=se(W);let ke=!1;const Re=ht=>{if(ke=!0,ee){const St=Math.min(1800,Math.max(1,Math.round((ht.clientX-Se-ue)/Y())));v.value[W.id]=St}else{const St=Math.max(1/m.value,Math.min((ht.clientX-Se)*oe,600));w.value[W.id]=Math.round(St*m.value)/m.value}},Fe=ht=>{window.removeEventListener("pointermove",Re),window.removeEventListener("pointerup",Ze),window.removeEventListener("pointercancel",mt);const St=w.value[W.id],Xt=v.value[W.id];delete w.value[W.id],delete v.value[W.id],ht&&ke&&ee&&Xt!=null&&Xt!==xe?W.config.loopDurationFrames=Xt:ht&&ke&&!ee&&St!=null&&St!==ce&&(W.config.duration=St)},Ze=()=>Fe(!0),mt=()=>Fe(!1);window.addEventListener("pointermove",Re),window.addEventListener("pointerup",Ze),window.addEventListener("pointercancel",mt)}function Z(q,W){q.stopPropagation();const ee=q.clientX,ce=Math.max(0,Number(W.timeOffset)||0),xe=Y()/m.value,oe=Re=>{const Fe=Math.max(0,Math.min(ce+(Re.clientX-ee)*xe,600));_.value[W.id]=Math.round(Fe*m.value)/m.value},Se=Re=>{window.removeEventListener("pointermove",oe),window.removeEventListener("pointerup",ue),window.removeEventListener("pointercancel",ke);const Fe=_.value[W.id];delete _.value[W.id],Re&&Fe!=null&&Fe!==ce&&(W.timeOffset=Fe,e.recalcTotalFrames())},ue=()=>Se(!0),ke=()=>Se(!1);window.addEventListener("pointermove",oe),window.addEventListener("pointerup",ue),window.addEventListener("pointercancel",ke)}return(q,W)=>{var ee,ce,xe;return ne(),de("div",MN,[A("div",EN,[A("button",{class:it(["tl-btn",{on:Be(e).timeline.playing}]),onClick:W[0]||(W[0]=oe=>Be(e).togglePlay()),title:Be(e).timeline.playing?"暂停 (D)":"播放 (D)"},He(Be(e).timeline.playing?"❚❚":"▶"),11,AN),A("button",{class:"tl-btn",onClick:W[1]||(W[1]=oe=>Be(e).toStart()),title:"回到第一帧 (S)"},"⏮"),A("button",{class:"tl-btn",onClick:W[2]||(W[2]=oe=>Be(e).previousFrame()),title:"前一帧"},"◀"),A("button",{class:"tl-btn",onClick:W[3]||(W[3]=oe=>Be(e).nextFrame()),title:"后一帧"},"▶"),A("button",{class:"tl-btn",onClick:W[4]||(W[4]=oe=>Be(e).toEnd()),title:"移动到最后一帧"},"⏭"),A("button",{class:it(["tl-btn",{on:Be(e).timeline.loop}]),onClick:W[5]||(W[5]=oe=>Be(e).toggleLoop()),title:"循环"},"⟳",2),A("label",CN,[W[10]||(W[10]=A("span",null,"A",-1)),_e(A("input",{"onUpdate:modelValue":W[6]||(W[6]=oe=>x.value=oe),type:"number",min:"0",max:Math.max(0,Be(e).timeline.playbackEnd-1),"aria-label":"播放起始帧",onChange:F,onKeydown:aa(Tt(F,["prevent"]),["enter"])},null,40,IN),[[tt,x.value]])]),A("label",RN,[W[11]||(W[11]=A("span",null,"B",-1)),_e(A("input",{"onUpdate:modelValue":W[7]||(W[7]=oe=>M.value=oe),type:"number",min:Be(e).timeline.playbackStart+1,max:Math.max(1,Be(e).timeline.totalFrames-1),"aria-label":"播放结束帧",onChange:B,onKeydown:aa(Tt(B,["prevent"]),["enter"])},null,40,PN),[[tt,M.value]])]),h.value?(ne(),de("button",{key:0,class:"tl-loop-range",title:`设为闭合自循环范围 ${h.value.start}–${h.value.end}f`,onClick:L},"循环段",8,kN)):Ve("",!0),A("span",FN,[W[12]||(W[12]=ei("帧 ",-1)),A("b",null,He(Be(e).timeline.frame),1),W[13]||(W[13]=ei(" / ",-1)),A("b",null,He(Math.max(0,Be(e).timeline.totalFrames-1)),1)]),W[18]||(W[18]=A("span",{class:"tl-legend"},[A("i",{class:"legend-emission"}),ei("持续发射 "),A("i",{class:"legend-life"}),ei("粒子存在 "),A("i",{class:"legend-spine"}),ei("Spine 动画")],-1)),A("div",{ref_key:"animationMenuRef",ref:i,class:"tl-anim tl-owner-animation"},[W[16]||(W[16]=A("span",null,"所属动画",-1)),A("button",{class:"tl-animation-trigger",disabled:!o.value,title:"设置当前粒子系统所属的动画",onClick:Tt(l,["stop"])},[A("span",null,He(((ee=o.value)==null?void 0:ee.animation)||Be(e).timeline.animation),1),W[14]||(W[14]=A("i",null,"⌄",-1))],8,ON),s.value?(ne(),de("div",{key:0,class:"tl-animation-menu",onPointerdown:W[9]||(W[9]=Tt(()=>{},["stop"]))},[W[15]||(W[15]=A("div",{class:"tl-animation-menu-title"},"选择所属动画",-1)),(ne(!0),de(Je,null,ri(Be(e).timeline.animations,oe=>{var Se,ue;return ne(),de("button",{key:oe,class:it(["tl-animation-option",{on:((Se=o.value)==null?void 0:Se.animation)===oe}]),onClick:ke=>c(oe)},[A("span",null,He(oe),1),((ue=o.value)==null?void 0:ue.animation)===oe?(ne(),de("i",LN,"✓")):Ve("",!0)],10,BN)}),128)),A("div",DN,[_e(A("input",{"onUpdate:modelValue":W[8]||(W[8]=oe=>r.value=oe),class:"tl-animation-name",maxlength:"64","aria-label":"动画名称",onKeydown:aa(d,["enter"])},null,544),[[tt,r.value]]),A("button",{title:"重命名当前动画",onClick:d},"重命名")]),a.value?(ne(),de("div",NN,He(a.value),1)):Ve("",!0),A("div",UN,[A("button",{onClick:u},"+ 新增"),A("button",{disabled:Be(e).timeline.animations.length<=1,onClick:f},"删除",8,XN)]),Be(e).timeline.animations.length<=1?(ne(),de("div",YN,"至少需要保留一个动画")):Ve("",!0)],32)):Ve("",!0)],512),A("label",VN,[W[17]||(W[17]=ei("Spine 预览动画 ",-1)),A("select",{class:"tl-sel",value:((ce=k.value)==null?void 0:ce.selectedAnimation)||"",disabled:!k.value,onChange:R},[A("option",GN,He(k.value?"无":"无可用 Spine 动画"),1),(ne(!0),de(Je,null,ri(((xe=k.value)==null?void 0:xe.animations)||[],oe=>(ne(),de("option",{key:oe.name,value:oe.name},He(oe.name)+"("+He(oe.duration.toFixed(2))+"s) ",9,HN))),128))],40,$N)]),A("span",jN,He(C.value),1)]),A("div",{class:"tl-viewport",ref_key:"vpRef",ref:t,onWheel:Tt(Ie,["prevent"]),onPointerdown:ge},[A("div",WN,[(ne(!0),de(Je,null,ri(O.value,oe=>(ne(),de("div",{key:oe.f,class:"tl-tickline",style:Ii({left:oe.px+"px"})},[A("span",zN,He(oe.f)+"f",1)],4))),128))]),A("div",{class:"tl-playhead",style:Ii({left:D.value+"px"})},null,4),A("div",qN,[(ne(!0),de(Je,null,ri(Be(e).systems,(oe,Se)=>(ne(),de("div",{key:oe.id,class:"tl-lane"},[W[19]||(W[19]=A("span",{class:"lane-ico"},"●",-1)),A("div",{class:"lane-bar",style:Ii({left:P(oe)+"px",width:N(oe)+"px"}),onPointerdown:Tt(ue=>Ee(ue,oe),["stop"])},[A("span",ZN,He(oe.config.name||"系统 "+(Se+1)),1),A("span",{class:it(["bar-life",{"loop-life":z(oe)}]),style:Ii({width:K(oe)+"px"})},null,6),z(oe)?(ne(),de(Je,{key:0},[se(oe)?(ne(),de("span",{key:0,class:"bar-loop-transition bar-loop-start",style:Ii({width:se(oe)+"px"})},null,4)):Ve("",!0),A("span",{class:"bar-emission bar-loop",style:Ii({left:se(oe)+"px",width:X(oe)+"px"})},[A("span",{class:"bar-handle",title:"拖动循环段时长",onPointerdown:Tt(ue=>H(ue,oe),["stop"])},null,40,JN)],4),Q(oe)?(ne(),de("span",{key:1,class:"bar-loop-transition bar-loop-end",style:Ii({left:se(oe)+X(oe)+"px",width:Q(oe)+"px"})},null,4)):Ve("",!0)],64)):oe.config.mode==="stream"?(ne(),de("span",{key:1,class:"bar-emission",style:Ii({width:X(oe)+"px"})},[A("span",{class:"bar-handle",title:"拖动持续发射时长",onPointerdown:Tt(ue=>H(ue,oe),["stop"])},null,40,QN)],4)):Ve("",!0)],44,KN)]))),128)),(ne(!0),de(Je,null,ri(I.value,oe=>(ne(),de("div",{key:`spine-${oe.id}`,class:"tl-lane spine-lane"},[W[20]||(W[20]=A("span",{class:"lane-ico spine-ico"},"◆",-1)),A("div",{class:"spine-bar",style:Ii({left:pe(oe)+"px",width:Me(oe)+"px"}),title:"拖动调整动画开始时间",onPointerdown:Tt(Se=>Z(Se,oe),["stop"])},[A("span",t5,He(oe.name)+" · "+He(oe.selectedAnimation),1)],44,e5)]))),128)),!Be(e).systems.length&&!I.value.length?(ne(),de("div",i5,"暂无可显示的动画数据")):Ve("",!0)])],544)])}}}),n5=Tn(s5,[["__scopeId","data-v-8d9981a9"]]),r5={class:"right"},a5={class:"stage-area"},o5=wn({__name:"App",setup(n){const e=Rl();j2(e);const t=nt(360),i=nt(180);function s(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)=>(ne(),de("div",{class:it(["layout",{"panel-right":Be(e).settings.parameterPanelOnRight}])},[A("div",{class:"parameter-panel",style:Ii({width:t.value+"px"})},[Ye(TN)],4),A("div",{class:"resizer-col",onPointerdown:s},null,32),A("div",r5,[A("div",a5,[Ye(SP)]),A("div",{class:"resizer-row",onPointerdown:r,title:"拖动调整时间轴高度"},null,32),A("div",{class:"timeline-area",style:Ii({height:i.value+"px"})},[Ye(n5)],4)])],2))}}),l5=Tn(o5,[["__scopeId","data-v-8eacccdc"]]);sT(l5).use(aT()).mount("#app");export{Cv as $,mn as A,Sh as B,Lt as C,Oi as D,Xe as E,Ki as F,bn as G,ct as H,kt as I,Mw as J,is as K,ds as L,ws as M,Pr as N,su as O,fn as P,gl as Q,fo as R,Os as S,HF as T,et as U,Sv as V,Ds as W,D4 as X,V3 as Y,wl as Z,zm as _,rt as a,nm as a$,Av as a0,nw as a1,np as a2,B4 as a3,yh as a4,sl as a5,t3 as a6,nl as a7,nu as a8,em as a9,dm as aA,fm as aB,vc as aC,gr as aD,kc as aE,tm as aF,lw as aG,si as aH,tw as aI,A4 as aJ,ro as aK,Ev as aL,De as aM,Ke as aN,sm as aO,Fc as aP,dw as aQ,im as aR,hw as aS,uw as aT,ru as aU,pw as aV,Oc as aW,yw as aX,fw as aY,gw as aZ,xw as a_,wa as aa,rp as ab,ap as ac,Tv as ad,Fl as ae,Ol as af,kl as ag,ba as ah,Gn as ai,I4 as aj,ow as ak,e3 as al,po as am,Ir as an,cp as ao,Tw as ap,JF as aq,bl as ar,ts as as,Mv as at,k4 as au,So as av,um as aw,mm as ax,pm as ay,gm as az,ho as b,ir as b$,wh as b0,mw as b1,Or as b2,vw as b3,op as b4,GF as b5,Sw as b6,_w as b7,lp as b8,yn as b9,bw as bA,hp as bB,iu as bC,Ew as bD,rm as bE,_i as bF,VF as bG,WF as bH,Gb as bI,$b as bJ,R4 as bK,Ht as bL,_o as bM,Aw as bN,Rw as bO,Pw as bP,kw as bQ,Cw as bR,Iw as bS,ZF as bT,up as bU,Ot as bV,hm as bW,cw as bX,jb as bY,Wb as bZ,zb as b_,$F as ba,C4 as bb,lt as bc,aw as bd,rw as be,iw as bf,sw as bg,ua as bh,xh as bi,QF as bj,qb as bk,Kb as bl,zi as bm,Zb as bn,mo as bo,Pi as bp,Hb as bq,bh as br,Jb as bs,Qb as bt,ew as bu,Iv as bv,lm as bw,Qr as bx,ww as by,om as bz,uo as c,P4 as c0,qF as c1,KF as c2,zF as c3,st as d,ze as e,F4 as f,ot as g,Ai as h,Qc as i,ns as j,qt as k,We as l,Xs as m,Zt as n,Ym as o,li as p,vl as q,fr as r,$e as s,vx as t,Wm as u,nh as v,am as w,Zr as x,_v as y,cm as z};
|