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-dmMh3N7z.js","assets/index-DQa0oOKH.js"])))=>i.map(i=>d[i]);
|
||
var Gw=Object.defineProperty;var jw=(n,e,t)=>e in n?Gw(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var x=(n,e,t)=>jw(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 _m(n){const e=Object.create(null);for(const t of n.split(","))e[t]=1;return t=>t in e}const Zt={},Ka=[],bn=()=>{},Vv=()=>!1,Rh=n=>n.charCodeAt(0)===111&&n.charCodeAt(1)===110&&(n.charCodeAt(2)>122||n.charCodeAt(2)<97),Ph=n=>n.startsWith("onUpdate:"),Yi=Object.assign,Tm=(n,e)=>{const t=n.indexOf(e);t>-1&&n.splice(t,1)},Hw=Object.prototype.hasOwnProperty,Wt=(n,e)=>Hw.call(n,e),ut=Array.isArray,Za=n=>Ml(n)==="[object Map]",xo=n=>Ml(n)==="[object Set]",bp=n=>Ml(n)==="[object Date]",bt=n=>typeof n=="function",gi=n=>typeof n=="string",ys=n=>typeof n=="symbol",Kt=n=>n!==null&&typeof n=="object",$v=n=>(Kt(n)||bt(n))&&bt(n.then)&&bt(n.catch),Gv=Object.prototype.toString,Ml=n=>Gv.call(n),Ww=n=>Ml(n).slice(8,-1),jv=n=>Ml(n)==="[object Object]",kh=n=>gi(n)&&n!=="NaN"&&n[0]!=="-"&&""+parseInt(n,10)===n,Ko=_m(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),Fh=n=>{const e=Object.create(null);return(t=>e[t]||(e[t]=n(t)))},zw=/-\w/g,Xs=Fh(n=>n.replace(zw,e=>e.slice(1).toUpperCase())),qw=/\B([A-Z])/g,Lr=Fh(n=>n.replace(qw,"-$1").toLowerCase()),Hv=Fh(n=>n.charAt(0).toUpperCase()+n.slice(1)),cu=Fh(n=>n?`on${Hv(n)}`:""),pn=(n,e)=>!Object.is(n,e),wc=(n,...e)=>{for(let t=0;t<n.length;t++)n[t](...e)},Wv=(n,e,t,i=!1)=>{Object.defineProperty(n,e,{configurable:!0,enumerable:!1,writable:i,value:t})},Oh=n=>{const e=parseFloat(n);return isNaN(e)?n:e};let wp;const Bh=()=>wp||(wp=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function Di(n){if(ut(n)){const e={};for(let t=0;t<n.length;t++){const i=n[t],s=gi(i)?Qw(i):Di(i);if(s)for(const r in s)e[r]=s[r]}return e}else if(gi(n)||Kt(n))return n}const Kw=/;(?![^(]*\))/g,Zw=/:([^]+)/,Jw=/\/\*[^]*?\*\//g;function Qw(n){const e={};return n.replace(Jw,"").split(Kw).forEach(t=>{if(t){const i=t.split(Zw);i.length>1&&(e[i[0].trim()]=i[1].trim())}}),e}function at(n){let e="";if(gi(n))e=n;else if(ut(n))for(let t=0;t<n.length;t++){const i=at(n[t]);i&&(e+=i+" ")}else if(Kt(n))for(const t in n)n[t]&&(e+=t+" ");return e.trim()}const eS="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",tS=_m(eS);function zv(n){return!!n||n===""}function iS(n,e){if(n.length!==e.length)return!1;let t=!0;for(let i=0;t&&i<n.length;i++)t=bo(n[i],e[i]);return t}function bo(n,e){if(n===e)return!0;let t=bp(n),i=bp(e);if(t||i)return t&&i?n.getTime()===e.getTime():!1;if(t=ys(n),i=ys(e),t||i)return n===e;if(t=ut(n),i=ut(e),t||i)return t&&i?iS(n,e):!1;if(t=Kt(n),i=Kt(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||!bo(n[a],e[a]))return!1}}return String(n)===String(e)}function Mm(n,e){return n.findIndex(t=>bo(t,e))}const qv=n=>!!(n&&n.__v_isRef===!0),We=n=>gi(n)?n:n==null?"":ut(n)||Kt(n)&&(n.toString===Gv||!bt(n.toString))?qv(n)?We(n.value):JSON.stringify(n,Kv,2):String(n),Kv=(n,e)=>qv(e)?Kv(n,e.value):Za(e)?{[`Map(${e.size})`]:[...e.entries()].reduce((t,[i,s],r)=>(t[hu(i,r)+" =>"]=s,t),{})}:xo(e)?{[`Set(${e.size})`]:[...e.values()].map(t=>hu(t))}:ys(e)?hu(e):Kt(e)&&!ut(e)&&!jv(e)?String(e):e,hu=(n,e="")=>{var t;return ys(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 Ei;class Zv{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&&Ei&&(Ei.active?(this.parent=Ei,this.index=(Ei.scopes||(Ei.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=Ei;try{return Ei=this,e()}finally{Ei=t}}}on(){++this._on===1&&(this.prevScope=Ei,Ei=this)}off(){if(this._on>0&&--this._on===0){if(Ei===this)Ei=this.prevScope;else{let e=Ei;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 Jv(n){return new Zv(n)}function Qv(){return Ei}function sS(n,e=!1){Ei&&Ei.cleanups.push(n)}let ti;const uu=new WeakSet;class ey{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,Ei&&(Ei.active?Ei.effects.push(this):this.flags&=-2)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,uu.has(this)&&(uu.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||iy(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,Sp(this),sy(this);const e=ti,t=Ys;ti=this,Ys=!0;try{return this.fn()}finally{ny(this),ti=e,Ys=t,this.flags&=-3}}stop(){if(this.flags&1){for(let e=this.deps;e;e=e.nextDep)Cm(e);this.deps=this.depsTail=void 0,Sp(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?uu.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){tf(this)&&this.run()}get dirty(){return tf(this)}}let ty=0,Zo,Jo;function iy(n,e=!1){if(n.flags|=8,e){n.next=Jo,Jo=n;return}n.next=Zo,Zo=n}function Em(){ty++}function Am(){if(--ty>0)return;if(Jo){let e=Jo;for(Jo=void 0;e;){const t=e.next;e.next=void 0,e.flags&=-9,e=t}}let 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 sy(n){for(let e=n.deps;e;e=e.nextDep)e.version=-1,e.prevActiveLink=e.dep.activeLink,e.dep.activeLink=e}function ny(n){let e,t=n.depsTail,i=t;for(;i;){const s=i.prevDep;i.version===-1?(i===t&&(t=s),Cm(i),nS(i)):e=i,i.dep.activeLink=i.prevActiveLink,i.prevActiveLink=void 0,i=s}n.deps=e,n.depsTail=t}function tf(n){for(let e=n.deps;e;e=e.nextDep)if(e.dep.version!==e.version||e.dep.computed&&(ry(e.dep.computed)||e.dep.version!==e.version))return!0;return!!n._dirty}function ry(n){if(n.flags&4&&!(n.flags&16)||(n.flags&=-17,n.globalVersion===ul)||(n.globalVersion=ul,!n.isSSR&&n.flags&128&&(!n.deps&&!n._dirty||!tf(n))))return;n.flags|=2;const e=n.dep,t=ti,i=Ys;ti=n,Ys=!0;try{sy(n);const s=n.fn(n._value);(e.version===0||pn(s,n._value))&&(n.flags|=128,n._value=s,e.version++)}catch(s){throw e.version++,s}finally{ti=t,Ys=i,ny(n),n.flags&=-3}}function Cm(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)Cm(r,!0)}!e&&!--t.sc&&t.map&&t.map.delete(t.key)}function nS(n){const{prevDep:e,nextDep:t}=n;e&&(e.nextDep=t,n.prevDep=void 0),t&&(t.prevDep=e,n.nextDep=void 0)}let Ys=!0;const ay=[];function tr(){ay.push(Ys),Ys=!1}function ir(){const n=ay.pop();Ys=n===void 0?!0:n}function Sp(n){const{cleanup:e}=n;if(n.cleanup=void 0,e){const t=ti;ti=void 0;try{e()}finally{ti=t}}}let ul=0;class rS{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 Im{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(!ti||!Ys||ti===this.computed)return;let t=this.activeLink;if(t===void 0||t.sub!==ti)t=this.activeLink=new rS(ti,this),ti.deps?(t.prevDep=ti.depsTail,ti.depsTail.nextDep=t,ti.depsTail=t):ti.deps=ti.depsTail=t,oy(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=ti.depsTail,t.nextDep=void 0,ti.depsTail.nextDep=t,ti.depsTail=t,ti.deps===t&&(ti.deps=i)}return t}trigger(e){this.version++,ul++,this.notify(e)}notify(e){Em();try{for(let t=this.subs;t;t=t.prevSub)t.sub.notify()&&t.sub.dep.notify()}finally{Am()}}}function oy(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)oy(i)}const t=n.dep.subs;t!==n&&(n.prevSub=t,t&&(t.nextSub=n)),n.dep.subs=n}}const Nc=new WeakMap,la=Symbol(""),sf=Symbol(""),dl=Symbol("");function Wi(n,e,t){if(Ys&&ti){let i=Nc.get(n);i||Nc.set(n,i=new Map);let s=i.get(t);s||(i.set(t,s=new Im),s.map=i,s.key=t),s.track()}}function Vn(n,e,t,i,s,r){const a=Nc.get(n);if(!a){ul++;return}const o=h=>{h&&h.trigger()};if(Em(),e==="clear")a.forEach(o);else{const h=ut(n),l=h&&kh(t);if(h&&t==="length"){const c=Number(i);a.forEach((u,d)=>{(d==="length"||d===dl||!ys(d)&&d>=c)&&o(u)})}else switch((t!==void 0||a.has(void 0))&&o(a.get(t)),l&&o(a.get(dl)),e){case"add":h?l&&o(a.get("length")):(o(a.get(la)),Za(n)&&o(a.get(sf)));break;case"delete":h||(o(a.get(la)),Za(n)&&o(a.get(sf)));break;case"set":Za(n)&&o(a.get(la));break}}Am()}function aS(n,e){const t=Nc.get(n);return t&&t.get(e)}function Ia(n){const e=Xt(n);return e===n?e:(Wi(e,"iterate",dl),gs(n)?e:e.map(Hs))}function Lh(n){return Wi(n=Xt(n),"iterate",dl),n}function dn(n,e){return sr(n)?co(Jn(n)?Hs(e):e):Hs(e)}const oS={__proto__:null,[Symbol.iterator](){return du(this,Symbol.iterator,n=>dn(this,n))},concat(...n){return Ia(this).concat(...n.map(e=>ut(e)?Ia(e):e))},entries(){return du(this,"entries",n=>(n[1]=dn(this,n[1]),n))},every(n,e){return kn(this,"every",n,e,void 0,arguments)},filter(n,e){return kn(this,"filter",n,e,t=>t.map(i=>dn(this,i)),arguments)},find(n,e){return kn(this,"find",n,e,t=>dn(this,t),arguments)},findIndex(n,e){return kn(this,"findIndex",n,e,void 0,arguments)},findLast(n,e){return kn(this,"findLast",n,e,t=>dn(this,t),arguments)},findLastIndex(n,e){return kn(this,"findLastIndex",n,e,void 0,arguments)},forEach(n,e){return kn(this,"forEach",n,e,void 0,arguments)},includes(...n){return fu(this,"includes",n)},indexOf(...n){return fu(this,"indexOf",n)},join(n){return Ia(this).join(n)},lastIndexOf(...n){return fu(this,"lastIndexOf",n)},map(n,e){return kn(this,"map",n,e,void 0,arguments)},pop(){return Ro(this,"pop")},push(...n){return Ro(this,"push",n)},reduce(n,...e){return _p(this,"reduce",n,e)},reduceRight(n,...e){return _p(this,"reduceRight",n,e)},shift(){return Ro(this,"shift")},some(n,e){return kn(this,"some",n,e,void 0,arguments)},splice(...n){return Ro(this,"splice",n)},toReversed(){return Ia(this).toReversed()},toSorted(n){return Ia(this).toSorted(n)},toSpliced(...n){return Ia(this).toSpliced(...n)},unshift(...n){return Ro(this,"unshift",n)},values(){return du(this,"values",n=>dn(this,n))}};function du(n,e,t){const i=Lh(n),s=i[e]();return i!==n&&!gs(n)&&(s._next=s.next,s.next=()=>{const r=s._next();return r.done||(r.value=t(r.value)),r}),s}const lS=Array.prototype;function kn(n,e,t,i,s,r){const a=Lh(n),o=a!==n&&!gs(n),h=a[e];if(h!==lS[e]){const u=h.apply(n,r);return o?Hs(u):u}let l=t;a!==n&&(o?l=function(u,d){return t.call(this,dn(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 _p(n,e,t,i){const s=Lh(n),r=s!==n&&!gs(n);let a=t,o=!1;s!==n&&(r?(o=i.length===0,a=function(l,c,u){return o&&(o=!1,l=dn(n,l)),t.call(this,l,dn(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?dn(n,h):h}function fu(n,e,t){const i=Xt(n);Wi(i,"iterate",dl);const s=i[e](...t);return(s===-1||s===!1)&&Dh(t[0])?(t[0]=Xt(t[0]),i[e](...t)):s}function Ro(n,e,t=[]){tr(),Em();const i=Xt(n)[e].apply(n,t);return Am(),ir(),i}const cS=_m("__proto__,__v_isRef,__isVue"),ly=new Set(Object.getOwnPropertyNames(Symbol).filter(n=>n!=="arguments"&&n!=="caller").map(n=>Symbol[n]).filter(ys));function hS(n){ys(n)||(n=String(n));const e=Xt(this);return Wi(e,"has",n),e.hasOwnProperty(n)}class cy{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?bS:fy:r?dy:uy).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(i)?e:void 0;const a=ut(e);if(!s){let h;if(a&&(h=oS[t]))return h;if(t==="hasOwnProperty")return hS}const o=Reflect.get(e,t,vi(e)?e:i);if((ys(t)?ly.has(t):cS(t))||(s||Wi(e,"get",t),r))return o;if(vi(o)){const h=a&&kh(t)?o:o.value;return s&&Kt(h)?rf(h):h}return Kt(o)?s?rf(o):wo(o):o}}class hy extends cy{constructor(e=!1){super(!1,e)}set(e,t,i,s){let r=e[t];const a=ut(e)&&kh(t);if(!this._isShallow){const l=sr(r);if(!gs(i)&&!sr(i)&&(r=Xt(r),i=Xt(i)),!a&&vi(r)&&!vi(i))return l||(r.value=i),!0}const o=a?Number(t)<e.length:Wt(e,t),h=Reflect.set(e,t,i,vi(e)?e:s);return e===Xt(s)&&h&&(o?pn(i,r)&&Vn(e,"set",t,i):Vn(e,"add",t,i)),h}deleteProperty(e,t){const i=Wt(e,t);e[t];const s=Reflect.deleteProperty(e,t);return s&&i&&Vn(e,"delete",t,void 0),s}has(e,t){const i=Reflect.has(e,t);return(!ys(t)||!ly.has(t))&&Wi(e,"has",t),i}ownKeys(e){return Wi(e,"iterate",ut(e)?"length":la),Reflect.ownKeys(e)}}class uS extends cy{constructor(e=!1){super(!0,e)}set(e,t){return!0}deleteProperty(e,t){return!0}}const dS=new hy,fS=new uS,mS=new hy(!0);const nf=n=>n,Ul=n=>Reflect.getPrototypeOf(n);function pS(n,e,t){return function(...i){const s=this.__v_raw,r=Xt(s),a=Za(r),o=n==="entries"||n===Symbol.iterator&&a,h=n==="keys"&&a,l=s[n](...i),c=t?nf:e?co:Hs;return!e&&Wi(r,"iterate",h?sf:la),Yi(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 Xl(n){return function(...e){return n==="delete"?!1:n==="clear"?void 0:this}}function gS(n,e){const t={get(s){const r=this.__v_raw,a=Xt(r),o=Xt(s);n||(pn(s,o)&&Wi(a,"get",s),Wi(a,"get",o));const{has:h}=Ul(a),l=e?nf:n?co:Hs;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&&Wi(Xt(s),"iterate",la),s.size},has(s){const r=this.__v_raw,a=Xt(r),o=Xt(s);return n||(pn(s,o)&&Wi(a,"has",s),Wi(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=Xt(o),l=e?nf:n?co:Hs;return!n&&Wi(h,"iterate",la),o.forEach((c,u)=>s.call(r,l(c),l(u),a))}};return Yi(t,n?{add:Xl("add"),set:Xl("set"),delete:Xl("delete"),clear:Xl("clear")}:{add(s){const r=Xt(this),a=Ul(r),o=Xt(s),h=!e&&!gs(s)&&!sr(s)?o:s;return a.has.call(r,h)||pn(s,h)&&a.has.call(r,s)||pn(o,h)&&a.has.call(r,o)||(r.add(h),Vn(r,"add",h,h)),this},set(s,r){!e&&!gs(r)&&!sr(r)&&(r=Xt(r));const a=Xt(this),{has:o,get:h}=Ul(a);let l=o.call(a,s);l||(s=Xt(s),l=o.call(a,s));const c=h.call(a,s);return a.set(s,r),l?pn(r,c)&&Vn(a,"set",s,r):Vn(a,"add",s,r),this},delete(s){const r=Xt(this),{has:a,get:o}=Ul(r);let h=a.call(r,s);h||(s=Xt(s),h=a.call(r,s)),o&&o.call(r,s);const l=r.delete(s);return h&&Vn(r,"delete",s,void 0),l},clear(){const s=Xt(this),r=s.size!==0,a=s.clear();return r&&Vn(s,"clear",void 0,void 0),a}}),["keys","values","entries",Symbol.iterator].forEach(s=>{t[s]=pS(s,n,e)}),t}function Rm(n,e){const t=gS(n,e);return(i,s,r)=>s==="__v_isReactive"?!n:s==="__v_isReadonly"?n:s==="__v_raw"?i:Reflect.get(Wt(t,s)&&s in i?t:i,s,r)}const vS={get:Rm(!1,!1)},yS={get:Rm(!1,!0)},xS={get:Rm(!0,!1)};const uy=new WeakMap,dy=new WeakMap,fy=new WeakMap,bS=new WeakMap;function wS(n){switch(n){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function wo(n){return sr(n)?n:Pm(n,!1,dS,vS,uy)}function SS(n){return Pm(n,!1,mS,yS,dy)}function rf(n){return Pm(n,!0,fS,xS,fy)}function Pm(n,e,t,i,s){if(!Kt(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=wS(Ww(n));if(a===0)return n;const o=new Proxy(n,a===2?i:t);return s.set(n,o),o}function Jn(n){return sr(n)?Jn(n.__v_raw):!!(n&&n.__v_isReactive)}function sr(n){return!!(n&&n.__v_isReadonly)}function gs(n){return!!(n&&n.__v_isShallow)}function Dh(n){return n?!!n.__v_raw:!1}function Xt(n){const e=n&&n.__v_raw;return e?Xt(e):n}function Er(n){return!Wt(n,"__v_skip")&&Object.isExtensible(n)&&Wv(n,"__v_skip",!0),n}const Hs=n=>Kt(n)?wo(n):n,co=n=>Kt(n)?rf(n):n;function vi(n){return n?n.__v_isRef===!0:!1}function lt(n){return _S(n,!1)}function _S(n,e){return vi(n)?n:new TS(n,e)}class TS{constructor(e,t){this.dep=new Im,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=t?e:Xt(e),this._value=t?e:Hs(e),this.__v_isShallow=t}get value(){return this.dep.track(),this._value}set value(e){const t=this._rawValue,i=this.__v_isShallow||gs(e)||sr(e);e=i?e:Xt(e),pn(e,t)&&(this._rawValue=e,this._value=i?e:Hs(e),this.dep.trigger())}}function De(n){return vi(n)?n.value:n}const MS={get:(n,e,t)=>e==="__v_raw"?n:De(Reflect.get(n,e,t)),set:(n,e,t,i)=>{const s=n[e];return vi(s)&&!vi(t)?(s.value=t,!0):Reflect.set(n,e,t,i)}};function my(n){return Jn(n)?n:new Proxy(n,MS)}function ES(n){const e=ut(n)?new Array(n.length):{};for(const t in n)e[t]=CS(n,t);return e}class AS{constructor(e,t,i){this._object=e,this._defaultValue=i,this.__v_isRef=!0,this._value=void 0,this._key=ys(t)?t:String(t),this._raw=Xt(e);let s=!0,r=e;if(!ut(e)||ys(this._key)||!kh(this._key))do s=!Dh(r)||gs(r);while(s&&(r=r.__v_raw));this._shallow=s}get value(){let e=this._object[this._key];return this._shallow&&(e=De(e)),this._value=e===void 0?this._defaultValue:e}set value(e){if(this._shallow&&vi(this._raw[this._key])){const t=this._object[this._key];if(vi(t)){t.value=e;return}}this._object[this._key]=e}get dep(){return aS(this._raw,this._key)}}function CS(n,e,t){return new AS(n,e,t)}class IS{constructor(e,t,i){this.fn=e,this.setter=t,this._value=void 0,this.dep=new Im(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=ul-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!t,this.isSSR=i}notify(){if(this.flags|=16,!(this.flags&8)&&ti!==this)return iy(this,!0),!0}get value(){const e=this.dep.track();return ry(this),e&&(e.version=this.dep.version),this._value}set value(e){this.setter&&this.setter(e)}}function RS(n,e,t=!1){let i,s;return bt(n)?i=n:(i=n.get,s=n.set),new IS(i,s,t)}const Yl={},Uc=new WeakMap;let zr;function PS(n,e=!1,t=zr){if(t){let i=Uc.get(t);i||Uc.set(t,i=[]),i.push(n)}}function kS(n,e,t=Zt){const{immediate:i,deep:s,once:r,scheduler:a,augmentJob:o,call:h}=t,l=w=>s?w:gs(w)||s===!1||s===0?$n(w,1):$n(w);let c,u,d,f,p=!1,m=!1;if(vi(n)?(u=()=>n.value,p=gs(n)):Jn(n)?(u=()=>l(n),p=!0):ut(n)?(m=!0,p=n.some(w=>Jn(w)||gs(w)),u=()=>n.map(w=>{if(vi(w))return w.value;if(Jn(w))return l(w);if(bt(w))return h?h(w,2):w()})):bt(n)?e?u=h?()=>h(n,2):n:u=()=>{if(d){tr();try{d()}finally{ir()}}const w=zr;zr=c;try{return h?h(n,3,[f]):n(f)}finally{zr=w}}:u=bn,e&&s){const w=u,E=s===!0?1/0:s;u=()=>$n(w(),E)}const v=Qv(),y=()=>{c.stop(),v&&v.active&&Tm(v.effects,c)};if(r&&e){const w=e;e=(...E)=>{const M=w(...E);return y(),M}}let b=m?new Array(n.length).fill(Yl):Yl;const g=w=>{if(!(!(c.flags&1)||!c.dirty&&!w))if(e){const E=c.run();if(w||s||p||(m?E.some((M,_)=>pn(M,b[_])):pn(E,b))){d&&d();const M=zr;zr=c;try{const _=[E,b===Yl?void 0:m&&b[0]===Yl?[]:b,f];b=E,h?h(e,3,_):e(..._)}finally{zr=M}}}else c.run()};return o&&o(g),c=new ey(u),c.scheduler=a?()=>a(g,!1):g,f=w=>PS(w,!1,c),d=c.onStop=()=>{const w=Uc.get(c);if(w){if(h)h(w,4);else for(const E of w)E();Uc.delete(c)}},e?i?g(!0):b=c.run():a?a(g.bind(null,!0),!0):c.run(),y.pause=c.pause.bind(c),y.resume=c.resume.bind(c),y.stop=y,y}function $n(n,e=1/0,t){if(e<=0||!Kt(n)||n.__v_skip||(t=t||new Map,(t.get(n)||0)>=e))return n;if(t.set(n,e),e--,vi(n))$n(n.value,e,t);else if(ut(n))for(let i=0;i<n.length;i++)$n(n[i],e,t);else if(xo(n)||Za(n))n.forEach(i=>{$n(i,e,t)});else if(jv(n)){for(const i in n)$n(n[i],e,t);for(const i of Object.getOwnPropertySymbols(n))Object.prototype.propertyIsEnumerable.call(n,i)&&$n(n[i],e,t)}return n}/**
|
||
* @vue/runtime-core v3.5.41
|
||
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
||
* @license MIT
|
||
**/function El(n,e,t,i){try{return i?n(...i):n()}catch(s){Nh(s,e,t)}}function Ws(n,e,t,i){if(bt(n)){const s=El(n,e,t,i);return s&&$v(s)&&s.catch(r=>{Nh(r,e,t)}),s}if(ut(n)){const s=[];for(let r=0;r<n.length;r++)s.push(Ws(n[r],e,t,i));return s}}function Nh(n,e,t,i=!0){const s=e?e.vnode:null,{errorHandler:r,throwUnhandledErrorInProduction:a}=e&&e.appContext.config||Zt;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){tr(),El(r,null,10,[n,h,l]),ir();return}}FS(n,t,s,i,a)}function FS(n,e,t,i=!0,s=!1){if(s)throw n;console.error(n)}const Ji=[];let an=-1;const Ja=[];let gr=null,Na=0;const py=Promise.resolve();let Xc=null;function km(n){const e=Xc||py;return n?e.then(this?n.bind(this):n):e}function OS(n){let e=an+1,t=Ji.length;for(;e<t;){const i=e+t>>>1,s=Ji[i],r=fl(s);r<n||r===n&&s.flags&2?e=i+1:t=i}return e}function Fm(n){if(!(n.flags&1)){const e=fl(n),t=Ji[Ji.length-1];!t||!(n.flags&2)&&e>=fl(t)?Ji.push(n):Ji.splice(OS(e),0,n),n.flags|=1,gy()}}function gy(){Xc||(Xc=py.then(yy))}function BS(n){if(!ut(n))gr&&n.id===-1?gr.splice(Na+1,0,n):n.flags&1||(Ja.push(n),n.flags|=1);else for(let e=0;e<n.length;e++)Ja.push(n[e]);gy()}function Tp(n,e,t=an+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 vy(n){if(Ja.length){const e=[...new Set(Ja)].sort((t,i)=>fl(t)-fl(i));if(Ja.length=0,gr){for(let t=0;t<e.length;t++)gr.push(e[t]);return}for(gr=e,Na=0;Na<gr.length;Na++){const t=gr[Na];t.flags&4&&(t.flags&=-2),t.flags&8||t(),t.flags&=-2}gr=null,Na=0}}const fl=n=>n.id==null?n.flags&2?-1:1/0:n.id;function yy(n){try{for(an=0;an<Ji.length;an++){const e=Ji[an];e&&!(e.flags&8)&&(e.flags&4&&(e.flags&=-2),El(e,e.i,e.i?15:14),e.flags&4||(e.flags&=-2))}}finally{for(;an<Ji.length;an++){const e=Ji[an];e&&(e.flags&=-2)}an=-1,Ji.length=0,vy(),Xc=null,(Ji.length||Ja.length)&&yy()}}let qi=null,xy=null;function Yc(n){const e=qi;return qi=n,xy=n&&n.type.__scopeId||null,e}function af(n,e=qi,t){if(!e||n._n)return n;const i=(...s)=>{i._d&&Bp(-1);const r=Yc(e),a=Qn.length;let o;try{o=n(...s)}finally{for(let h=Qn.length;h>a;h--)Xm();Yc(r),i._d&&Bp(1)}return o};return i._n=!0,i._c=!0,i._d=!0,i}function Te(n,e){if(qi===null)return n;const t=$h(qi),i=n.dirs||(n.dirs=[]);for(let s=0;s<e.length;s++){let[r,a,o,h=Zt]=e[s];r&&(bt(r)&&(r={mounted:r,updated:r}),r.deep&&$n(a),i.push({dir:r,instance:t,value:a,oldValue:void 0,arg:o,modifiers:h}))}return n}function Vr(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&&(tr(),Ws(h,t,8,[n.el,o,n,e]),ir())}}function LS(n,e){if(Qi){let t=Qi.provides;const i=Qi.parent&&Qi.parent.provides;i===t&&(t=Qi.provides=Object.create(i)),t[n]=e}}function Qo(n,e,t=!1){const i=Gy();if(i||ca){let s=ca?ca._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&&bt(e)?e.call(i&&i.proxy):e}}function DS(){return!!(Gy()||ca)}const NS=Symbol.for("v-scx"),US=()=>Qo(NS);function Uo(n,e){return Om(n,null,e)}function vs(n,e,t){return Om(n,e,t)}function Om(n,e,t=Zt){const{immediate:i,deep:s,flush:r,once:a}=t,o=Yi({},t),h=e&&i||!e&&r!=="post";let l;if(gl){if(r==="sync"){const f=US();l=f.__watcherHandles||(f.__watcherHandles=[])}else if(!h){const f=()=>{};return f.stop=bn,f.resume=bn,f.pause=bn,f}}const c=Qi;o.call=(f,p,m)=>Ws(f,c,p,m);let u=!1;r==="post"?o.scheduler=f=>{ns(f,c&&c.suspense)}:r!=="sync"&&(u=!0,o.scheduler=(f,p)=>{p?f():Fm(f)}),o.augmentJob=f=>{e&&(f.flags|=4),u&&(f.flags|=2,c&&(f.id=c.uid,f.i=c))};const d=kS(n,e,o);return gl&&(l?l.push(d):h&&d()),d}function XS(n,e,t){const i=this.proxy,s=gi(n)?n.includes(".")?by(i,n):()=>i[n]:n.bind(i,i);let r;bt(e)?r=e:(r=e.handler,t=e);const a=Cl(this),o=Om(s,r.bind(i),t);return a(),o}function by(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 YS=Symbol("_vte"),Uh=n=>n.__isTeleport,mu=Symbol("_leaveCb");function VS(n){let e=n[0];if(n.length>1){for(const t of n)if(t.type!==Tn){e=t;break}}return e}function wy(n){if(!Lm(n))return Uh(n.type)&&n.children?VS(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&&bt(t.default))return t.default()}}function Bm(n,e){if(n.shapeFlag&6&&n.component){n.transition=e;const t=n.component.subTree;Bm(Uh(t.type)&&wy(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 En(n,e){return bt(n)?Yi({name:n.name},e,{setup:n}):n}function Sy(n){n.ids=[n.ids[0]+n.ids[2]+++"-",0,0]}function Mp(n,e){let t;return!!((t=Object.getOwnPropertyDescriptor(n,e))&&!t.configurable)}const Vc=new WeakMap;function el(n,e,t,i,s=!1){if(ut(n)){n.forEach((m,v)=>el(m,e&&(ut(e)?e[v]:e),t,i,s));return}if(Qa(i)&&!s){i.shapeFlag&512&&i.type.__asyncResolved&&i.component.subTree.component&&el(n,e,t,i.component.subTree);return}const r=i.shapeFlag&4?$h(i.component):i.el,a=s?null:r,{i:o,r:h}=n,l=e&&e.r,c=o.refs===Zt?o.refs={}:o.refs,u=o.setupState,d=Xt(u),f=u===Zt?Vv:m=>Mp(c,m)?!1:Wt(d,m),p=(m,v)=>!(v&&Mp(c,v));if(l!=null&&l!==h){if(Ep(e),gi(l))c[l]=null,f(l)&&(u[l]=null);else if(vi(l)){const m=e;p(l,m.k)&&(l.value=null),m.k&&(c[m.k]=null)}}if(bt(h))El(h,o,12,[a,c]);else{const m=gi(h),v=vi(h);if(m||v){const y=()=>{if(n.f){const b=m?f(h)?u[h]:c[h]:p()||!n.k?h.value:c[n.k];if(s)ut(b)&&Tm(b,r);else if(ut(b))b.includes(r)||b.push(r);else if(m)c[h]=[r],f(h)&&(u[h]=c[h]);else{const g=[r];p(h,n.k)&&(h.value=g),n.k&&(c[n.k]=g)}}else m?(c[h]=a,f(h)&&(u[h]=a)):v&&(p(h,n.k)&&(h.value=a),n.k&&(c[n.k]=a))};if(a){const b=()=>{y(),Vc.delete(n)};b.id=-1,Vc.set(n,b),ns(b,t)}else Ep(n),y()}}}function Ep(n){const e=Vc.get(n);e&&(e.flags|=8,Vc.delete(n))}Bh().requestIdleCallback;Bh().cancelIdleCallback;const Qa=n=>!!n.type.__asyncLoader,Lm=n=>n.type.__isKeepAlive;function $S(n,e){_y(n,"a",e)}function GS(n,e){_y(n,"da",e)}function _y(n,e,t=Qi){const i=n.__wdc||(n.__wdc=()=>{let s=t;for(;s;){if(s.isDeactivated)return;s=s.parent}return n()});if(Xh(e,i,t),t){let s=t.parent;for(;s&&s.parent;)Lm(s.parent.vnode)&&jS(i,e,t,s),s=s.parent}}function jS(n,e,t,i){const s=Xh(e,n,i,!0);Al(()=>{Tm(i[e],s)},t)}function Xh(n,e,t=Qi,i=!1){if(t){const s=t[n]||(t[n]=[]),r=e.__weh||(e.__weh=(...a)=>{tr();const o=Cl(t),h=Ws(e,t,n,a);return o(),ir(),h});return i?s.unshift(r):s.push(r),r}}const lr=n=>(e,t=Qi)=>{(!gl||n==="sp")&&Xh(n,(...i)=>e(...i),t)},HS=lr("bm"),So=lr("m"),WS=lr("bu"),zS=lr("u"),Dm=lr("bum"),Al=lr("um"),qS=lr("sp"),KS=lr("rtg"),ZS=lr("rtc");function JS(n,e=Qi){Xh("ec",n,e)}const QS=Symbol.for("v-ndc");function ui(n,e,t,i){let s;const r=t,a=ut(n);if(a||gi(n)){const o=a&&Jn(n);let h=!1,l=!1;o&&(h=!gs(n),l=sr(n),n=Lh(n)),s=new Array(n.length);for(let c=0,u=n.length;c<u;c++)s[c]=e(h?l?co(Hs(n[c])):Hs(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(Kt(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 e_(n,e,t,i,s,r){if(t==null&&(t={}),qi.ce||qi.parent&&Qa(qi.parent)&&qi.parent.ce){const l=t,c=Object.keys(l).length>0;return se(),Ht(st,null,[He("slot",l,i)],c?-2:64)}let a=n[e];a&&a._c&&(a._d=!1);const o=Qn.length;se();let h;try{const l=a&&Ty(a(t)),c=t.key||r||l&&l.key;h=Ht(st,{key:(c&&!ys(c)?c:`_${e}`)+(!l&&i?"_fb":"")},l||(i?i():[]),l&&n._===1?64:-2)}catch(l){for(let c=Qn.length;c>o;c--)Xm();throw l}finally{a&&a._c&&(a._d=!0)}return h}function Ty(n){return n.some(e=>Ym(e)?!(e.type===Tn||e.type===st&&!Ty(e.children)):!0)?n:null}const of=n=>n?jy(n)?$h(n):of(n.parent):null,tl=Yi(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=>of(n.parent),$root:n=>of(n.root),$host:n=>n.ce,$emit:n=>n.emit,$options:n=>Ey(n),$forceUpdate:n=>n.f||(n.f=()=>{Fm(n.update)}),$nextTick:n=>n.n||(n.n=km.bind(n.proxy)),$watch:n=>XS.bind(n)}),pu=(n,e)=>n!==Zt&&!n.__isScriptSetup&&Wt(n,e),t_={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(pu(i,e))return a[e]=1,i[e];if(s!==Zt&&Wt(s,e))return a[e]=2,s[e];if(Wt(r,e))return a[e]=3,r[e];if(t!==Zt&&Wt(t,e))return a[e]=4,t[e];lf&&(a[e]=0)}}const l=tl[e];let c,u;if(l)return e==="$attrs"&&Wi(n.attrs,"get",""),l(n);if((c=o.__cssModules)&&(c=c[e]))return c;if(t!==Zt&&Wt(t,e))return a[e]=4,t[e];if(u=h.config.globalProperties,Wt(u,e))return u[e]},set({_:n},e,t){const{data:i,setupState:s,ctx:r}=n;return pu(s,e)?(s[e]=t,!0):i!==Zt&&Wt(i,e)?(i[e]=t,!0):Wt(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!==Zt&&o[0]!=="$"&&Wt(n,o)||pu(e,o)||Wt(r,o)||Wt(i,o)||Wt(tl,o)||Wt(s.config.globalProperties,o)||(h=a.__cssModules)&&h[o])},defineProperty(n,e,t){return t.get!=null?n._.accessCache[e]=0:Wt(t,"value")&&this.set(n,e,t.value,null),Reflect.defineProperty(n,e,t)}};function Ap(n){return ut(n)?n.reduce((e,t)=>(e[t]=null,e),{}):n}let lf=!0;function i_(n){const e=Ey(n),t=n.proxy,i=n.ctx;lf=!1,e.beforeCreate&&Cp(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:v,beforeDestroy:y,beforeUnmount:b,destroyed:g,unmounted:w,render:E,renderTracked:M,renderTriggered:_,errorCaptured:I,serverPrefetch:R,expose:F,inheritAttrs:P,components:k,directives:B,filters:L}=e;if(l&&s_(l,i,null),a)for(const D in a){const T=a[D];bt(T)&&(i[D]=T.bind(t))}if(s){const D=s.call(t,t);Kt(D)&&(n.data=wo(D))}if(lf=!0,r)for(const D in r){const T=r[D],U=bt(T)?T.bind(t,t):bt(T.get)?T.get.bind(t,t):bn,N=!bt(T)&&bt(T.set)?T.set.bind(t):bn,Y=ft({get:U,set:N});Object.defineProperty(i,D,{enumerable:!0,configurable:!0,get:()=>Y.value,set:G=>Y.value=G})}if(o)for(const D in o)My(o[D],i,t,D);if(h){const D=bt(h)?h.call(t):h;Reflect.ownKeys(D).forEach(T=>{LS(T,D[T])})}c&&Cp(c,n,"c");function O(D,T){ut(T)?T.forEach(U=>D(U.bind(t))):T&&D(T.bind(t))}if(O(HS,u),O(So,d),O(WS,f),O(zS,p),O($S,m),O(GS,v),O(JS,I),O(ZS,M),O(KS,_),O(Dm,b),O(Al,w),O(qS,R),ut(F))if(F.length){const D=n.exposed||(n.exposed={});F.forEach(T=>{Object.defineProperty(D,T,{get:()=>t[T],set:U=>t[T]=U,enumerable:!0})})}else n.exposed||(n.exposed={});E&&n.render===bn&&(n.render=E),P!=null&&(n.inheritAttrs=P),k&&(n.components=k),B&&(n.directives=B),R&&Sy(n)}function s_(n,e,t=bn){ut(n)&&(n=cf(n));for(const i in n){const s=n[i];let r;Kt(s)?"default"in s?r=Qo(s.from||i,s.default,!0):r=Qo(s.from||i):r=Qo(s),vi(r)?Object.defineProperty(e,i,{enumerable:!0,configurable:!0,get:()=>r.value,set:a=>r.value=a}):e[i]=r}}function Cp(n,e,t){Ws(ut(n)?n.map(i=>i.bind(e.proxy)):n.bind(e.proxy),e,t)}function My(n,e,t,i){let s=i.includes(".")?by(t,i):()=>t[i];if(gi(n)){const r=e[n];bt(r)&&vs(s,r)}else if(bt(n))vs(s,n.bind(t));else if(Kt(n))if(ut(n))n.forEach(r=>My(r,e,t,i));else{const r=bt(n.handler)?n.handler.bind(t):e[n.handler];bt(r)&&vs(s,r,n)}}function Ey(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=>$c(h,l,a,!0)),$c(h,e,a)),Kt(e)&&r.set(e,h),h}function $c(n,e,t,i=!1){const{mixins:s,extends:r}=e;r&&$c(n,r,t,!0),s&&s.forEach(a=>$c(n,a,t,!0));for(const a in e)if(!(i&&a==="expose")){const o=n_[a]||t&&t[a];n[a]=o?o(n[a],e[a]):e[a]}return n}const n_={data:Ip,props:Rp,emits:Rp,methods:Xo,computed:Xo,beforeCreate:Ki,created:Ki,beforeMount:Ki,mounted:Ki,beforeUpdate:Ki,updated:Ki,beforeDestroy:Ki,beforeUnmount:Ki,destroyed:Ki,unmounted:Ki,activated:Ki,deactivated:Ki,errorCaptured:Ki,serverPrefetch:Ki,components:Xo,directives:Xo,watch:a_,provide:Ip,inject:r_};function Ip(n,e){return e?n?function(){return Yi(bt(n)?n.call(this,this):n,bt(e)?e.call(this,this):e)}:e:n}function r_(n,e){return Xo(cf(n),cf(e))}function cf(n){if(ut(n)){const e={};for(let t=0;t<n.length;t++)e[n[t]]=n[t];return e}return n}function Ki(n,e){return n?[...new Set([].concat(n,e))]:e}function Xo(n,e){return n?Yi(Object.create(null),n,e):e}function Rp(n,e){return n?ut(n)&&ut(e)?[...new Set([...n,...e])]:Yi(Object.create(null),Ap(n),Ap(e??{})):e}function a_(n,e){if(!n)return e;if(!e)return n;const t=Yi(Object.create(null),n);for(const i in e)t[i]=Ki(n[i],e[i]);return t}function Ay(){return{app:null,config:{isNativeTag:Vv,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 o_=0;function l_(n,e){return function(i,s=null){bt(i)||(i=Yi({},i)),s!=null&&!Kt(s)&&(s=null);const r=Ay(),a=new WeakSet,o=[];let h=!1;const l=r.app={_uid:o_++,_component:i,_props:s,_container:null,_context:r,_instance:null,version:N_,get config(){return r.config},set config(c){},use(c,...u){return a.has(c)||(c&&bt(c.install)?(a.add(c),c.install(l,...u)):bt(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||He(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,$h(f.component)}},onUnmount(c){o.push(c)},unmount(){h&&(Ws(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=ca;ca=l;try{return c()}finally{ca=u}}};return l}}let ca=null;const c_=(n,e)=>e==="modelValue"||e==="model-value"?n.modelModifiers:n[`${e}Modifiers`]||n[`${Xs(e)}Modifiers`]||n[`${Lr(e)}Modifiers`];function h_(n,e,...t){if(n.isUnmounted)return;const i=n.vnode.props||Zt;let s=t;const r=e.startsWith("update:"),a=r&&c_(i,e.slice(7));a&&(a.trim&&(s=t.map(c=>gi(c)?c.trim():c)),a.number&&(s=t.map(Oh)));let o,h=i[o=cu(e)]||i[o=cu(Xs(e))];!h&&r&&(h=i[o=cu(Lr(e))]),h&&Ws(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,Ws(l,n,6,s)}}const u_=new WeakMap;function Cy(n,e,t=!1){const i=t?u_:e.emitsCache,s=i.get(n);if(s!==void 0)return s;const r=n.emits;let a={},o=!1;if(!bt(n)){const h=l=>{const c=Cy(l,e,!0);c&&(o=!0,Yi(a,c))};!t&&e.mixins.length&&e.mixins.forEach(h),n.extends&&h(n.extends),n.mixins&&n.mixins.forEach(h)}return!r&&!o?(Kt(n)&&i.set(n,null),null):(ut(r)?r.forEach(h=>a[h]=null):Yi(a,r),Kt(n)&&i.set(n,a),a)}function Yh(n,e){return!n||!Rh(e)?!1:(e=e.slice(2),e=e==="Once"?e:e.replace(/Once$/,""),Wt(n,e[0].toLowerCase()+e.slice(1))||Wt(n,Lr(e))||Wt(n,e))}function Pp(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,v=Yc(n);let y,b;try{if(t.shapeFlag&4){const w=s||i,E=w;y=fn(l.call(E,w,c,u,f,d,p)),b=o}else{const w=e;y=fn(w.length>1?w(u,{attrs:o,slots:a,emit:h}):w(u,null)),b=e.props?o:d_(o)}}catch(w){Qn.length=0,Nh(w,n,1),y=He(Tn)}let g=y;if(b&&m!==!1){const w=Object.keys(b),{shapeFlag:E}=g;w.length&&E&7&&(r&&w.some(Ph)&&(b=f_(b,r)),g=ho(g,b,!1,!0))}if(t.dirs&&(g=ho(g,null,!1,!0),g.dirs=g.dirs?g.dirs.concat(t.dirs):t.dirs),t.transition){const w=Uh(g.type)&&wy(g)||g;Bm(w,t.transition)}return y=g,Yc(v),y}const d_=n=>{let e;for(const t in n)(t==="class"||t==="style"||Rh(t))&&((e||(e={}))[t]=n[t]);return e},f_=(n,e)=>{const t={};for(const i in n)(!Ph(i)||!(i.slice(9)in e))&&(t[i]=n[i]);return t};function m_(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?kp(i,a,l):!!a;if(h&8){const c=e.dynamicProps;for(let u=0;u<c.length;u++){const d=c[u];if(Iy(a,i,d)&&!Yh(l,d))return!0}}}else return(s||o)&&(!o||!o.$stable)?!0:i===a?!1:i?a?kp(i,a,l):!0:!!a;return!1}function kp(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(Iy(e,n,r)&&!Yh(t,r))return!0}return!1}function Iy(n,e,t){const i=n[t],s=e[t];return t==="style"&&Kt(i)&&Kt(s)?!bo(i,s):i!==s}function p_({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 Ry={},Py=()=>Object.create(Ry),ky=n=>Object.getPrototypeOf(n)===Ry;function g_(n,e,t,i=!1){const s={},r=Py();n.propsDefaults=Object.create(null),Fy(n,e,s,r);for(const a in n.propsOptions[0])a in s||(s[a]=void 0);t?n.props=i?s:SS(s):n.type.props?n.props=s:n.props=r,n.attrs=r}function v_(n,e,t,i){const{props:s,attrs:r,vnode:{patchFlag:a}}=n,o=Xt(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(Yh(n.emitsOptions,d))continue;const f=e[d];if(h)if(Wt(r,d))f!==r[d]&&(r[d]=f,l=!0);else{const p=Xs(d);s[p]=hf(h,o,p,f,n,!1)}else f!==r[d]&&(r[d]=f,l=!0)}}}else{Fy(n,e,s,r)&&(l=!0);let c;for(const u in o)(!e||!Wt(e,u)&&((c=Lr(u))===u||!Wt(e,c)))&&(h?t&&(t[u]!==void 0||t[c]!==void 0)&&(s[u]=hf(h,o,u,void 0,n,!0)):delete s[u]);if(r!==o)for(const u in r)(!e||!Wt(e,u))&&(delete r[u],l=!0)}l&&Vn(n.attrs,"set","")}function Fy(n,e,t,i){const[s,r]=n.propsOptions;let a=!1,o;if(e)for(let h in e){if(Ko(h))continue;const l=e[h];let c;s&&Wt(s,c=Xs(h))?!r||!r.includes(c)?t[c]=l:(o||(o={}))[c]=l:Yh(n.emitsOptions,h)||(!(h in i)||l!==i[h])&&(i[h]=l,a=!0)}if(r){const h=Xt(t),l=o||Zt;for(let c=0;c<r.length;c++){const u=r[c];t[u]=hf(s,h,u,l[u],n,!Wt(l,u))}}return a}function hf(n,e,t,i,s,r){const a=n[t];if(a!=null){const o=Wt(a,"default");if(o&&i===void 0){const h=a.default;if(a.type!==Function&&!a.skipFactory&&bt(h)){const{propsDefaults:l}=s;if(t in l)i=l[t];else{const c=Cl(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===Lr(t))&&(i=!0))}return i}const y_=new WeakMap;function Oy(n,e,t=!1){const i=t?y_:e.propsCache,s=i.get(n);if(s)return s;const r=n.props,a={},o=[];let h=!1;if(!bt(n)){const c=u=>{h=!0;const[d,f]=Oy(u,e,!0);Yi(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 Kt(n)&&i.set(n,Ka),Ka;if(ut(r))for(let c=0;c<r.length;c++){const u=Xs(r[c]);Fp(u)&&(a[u]=Zt)}else if(r)for(const c in r){const u=Xs(c);if(Fp(u)){const d=r[c],f=a[u]=ut(d)||bt(d)?{type:d}:Yi({},d),p=f.type;let m=!1,v=!0;if(ut(p))for(let y=0;y<p.length;++y){const b=p[y],g=bt(b)&&b.name;if(g==="Boolean"){m=!0;break}else g==="String"&&(v=!1)}else m=bt(p)&&p.name==="Boolean";f[0]=m,f[1]=v,(m||Wt(f,"default"))&&o.push(u)}}const l=[a,o];return Kt(n)&&i.set(n,l),l}function Fp(n){return n[0]!=="$"&&!Ko(n)}const Nm=n=>n==="_"||n==="_ctx"||n==="$stable",Um=n=>ut(n)?n.map(fn):[fn(n)],x_=(n,e,t)=>{if(e._n)return e;const i=af((...s)=>Um(e(...s)),t);return i._c=!1,i},By=(n,e,t)=>{const i=n._ctx;for(const s in n){if(Nm(s))continue;const r=n[s];if(bt(r))e[s]=x_(s,r,i);else if(r!=null){const a=Um(r);e[s]=()=>a}}},Ly=(n,e)=>{const t=Um(e);n.slots.default=()=>t},Dy=(n,e,t)=>{for(const i in e)(t||!Nm(i))&&(n[i]=e[i])},b_=(n,e,t)=>{const i=n.slots=Py();if(n.vnode.shapeFlag&32){const s=e._;s?(Dy(i,e,t),t&&Wv(i,"_",s,!0)):By(e,i)}else e&&Ly(n,e)},w_=(n,e,t)=>{const{vnode:i,slots:s}=n;let r=!0,a=Zt;if(i.shapeFlag&32){const o=e._;o?t&&o===1?r=!1:Dy(s,e,t):(r=!e.$stable,By(e,s)),a=e}else e&&(Ly(n,e),a={default:1});if(r)for(const o in s)!Nm(o)&&a[o]==null&&delete s[o]},ns=E_;function S_(n){return __(n)}function __(n,e){const t=Bh();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=bn,insertStaticContent:p}=n,m=(j,K,q,W=null,Q=null,le=null,xe=void 0,ae=null,we=!!K.dynamicChildren)=>{if(j===K)return;j&&!Po(j,K)&&(W=me(j),G(j,Q,le,!0),j=null),K.patchFlag===-2&&(we=!1,K.dynamicChildren=null);const{type:ce,ref:Ue,shapeFlag:Re}=K;switch(ce){case Vh:v(j,K,q,W);break;case Tn:y(j,K,q,W);break;case Sc:j==null&&b(K,q,W,xe);break;case st:k(j,K,q,W,Q,le,xe,ae,we);break;default:Re&1?E(j,K,q,W,Q,le,xe,ae,we):Re&6?B(j,K,q,W,Q,le,xe,ae,we):(Re&64||Re&128)&&ce.process(j,K,q,W,Q,le,xe,ae,we,ge)}Ue!=null&&Q?el(Ue,j&&j.ref,le,K||j,!K):Ue==null&&j&&j.ref!=null&&el(j.ref,null,le,j,!0)},v=(j,K,q,W)=>{if(j==null)i(K.el=o(K.children),q,W);else{const Q=K.el=j.el;K.children!==j.children&&l(Q,K.children)}},y=(j,K,q,W)=>{j==null?i(K.el=h(K.children||""),q,W):K.el=j.el},b=(j,K,q,W)=>{[j.el,j.anchor]=p(j.children,K,q,W,j.el,j.anchor)},g=({el:j,anchor:K},q,W)=>{let Q;for(;j&&j!==K;)Q=d(j),i(j,q,W),j=Q;i(K,q,W)},w=({el:j,anchor:K})=>{let q;for(;j&&j!==K;)q=d(j),s(j),j=q;s(K)},E=(j,K,q,W,Q,le,xe,ae,we)=>{if(K.type==="svg"?xe="svg":K.type==="math"&&(xe="mathml"),j==null)M(K,q,W,Q,le,xe,ae,we);else{const ce=j.el&&j.el._isVueCE?j.el:null;try{ce&&ce._beginPatch(),R(j,K,Q,le,xe,ae,we)}finally{ce&&ce._endPatch()}}},M=(j,K,q,W,Q,le,xe,ae)=>{let we,ce;const{props:Ue,shapeFlag:Re,transition:Fe,dirs:it}=j;if(we=j.el=a(j.type,le,Ue&&Ue.is,Ue),Re&8?c(we,j.children):Re&16&&I(j.children,we,null,W,Q,gu(j,le),xe,ae),it&&Vr(j,null,W,"created"),_(we,j,j.scopeId,xe,W),Ue){for(const It in Ue)It!=="value"&&!Ko(It)&&r(we,It,null,Ue[It],le,W);"value"in Ue&&r(we,"value",null,Ue.value,le),(ce=Ue.onVnodeBeforeMount)&&Js(ce,W,j)}it&&Vr(j,null,W,"beforeMount");const dt=T_(Q,Fe);dt&&Fe.beforeEnter(we),i(we,K,q),((ce=Ue&&Ue.onVnodeMounted)||dt||it)&&ns(()=>{try{ce&&Js(ce,W,j),dt&&Fe.enter(we),it&&Vr(j,null,W,"mounted")}finally{}},Q)},_=(j,K,q,W,Q)=>{if(q&&f(j,q),W)for(let le=0;le<W.length;le++)f(j,W[le]);if(Q){let le=Q.subTree;if(K===le||Yy(le.type)&&(le.ssContent===K||le.ssFallback===K)){const xe=Q.vnode;_(j,xe,xe.scopeId,xe.slotScopeIds,Q.parent)}}},I=(j,K,q,W,Q,le,xe,ae,we=0)=>{for(let ce=we;ce<j.length;ce++){const Ue=j[ce]=ae?Yn(j[ce]):fn(j[ce]);m(null,Ue,K,q,W,Q,le,xe,ae)}},R=(j,K,q,W,Q,le,xe)=>{const ae=K.el=j.el;let{patchFlag:we,dynamicChildren:ce,dirs:Ue}=K;we|=j.patchFlag&16;const Re=j.props||Zt,Fe=K.props||Zt;let it;if(q&&$r(q,!1),(it=Fe.onVnodeBeforeUpdate)&&Js(it,q,K,j),Ue&&Vr(K,j,q,"beforeUpdate"),q&&$r(q,!0),ce&&(!j.dynamicChildren||j.dynamicChildren.length!==ce.length)&&(we=0,xe=!1,ce=null),(Re.innerHTML&&Fe.innerHTML==null||Re.textContent&&Fe.textContent==null)&&c(ae,""),ce?F(j.dynamicChildren,ce,ae,q,W,gu(K,Q),le):xe||T(j,K,ae,null,q,W,gu(K,Q),le,!1),we>0){if(we&16)P(ae,Re,Fe,q,Q);else if(we&2&&Re.class!==Fe.class&&r(ae,"class",null,Fe.class,Q),we&4&&r(ae,"style",Re.style,Fe.style,Q),we&8){const dt=K.dynamicProps;for(let It=0;It<dt.length;It++){const yt=dt[It],Mt=Re[yt],zt=Fe[yt];(zt!==Mt||yt==="value")&&r(ae,yt,Mt,zt,Q,q)}}we&1&&j.children!==K.children&&c(ae,K.children)}else!xe&&ce==null&&P(ae,Re,Fe,q,Q);((it=Fe.onVnodeUpdated)||Ue)&&ns(()=>{it&&Js(it,q,K,j),Ue&&Vr(K,j,q,"updated")},W)},F=(j,K,q,W,Q,le,xe)=>{for(let ae=0;ae<K.length;ae++){const we=j[ae],ce=K[ae],Ue=we.el&&(we.type===st||!Po(we,ce)||we.shapeFlag&198)?u(we.el):q;m(we,ce,Ue,null,W,Q,le,xe,!0)}},P=(j,K,q,W,Q)=>{if(K!==q){if(K!==Zt)for(const le in K)!Ko(le)&&!(le in q)&&r(j,le,K[le],null,Q,W);for(const le in q){if(Ko(le))continue;const xe=q[le],ae=K[le];xe!==ae&&le!=="value"&&r(j,le,ae,xe,Q,W)}"value"in q&&r(j,"value",K.value,q.value,Q)}},k=(j,K,q,W,Q,le,xe,ae,we)=>{const ce=K.el=j?j.el:o(""),Ue=K.anchor=j?j.anchor:o("");let{patchFlag:Re,dynamicChildren:Fe,slotScopeIds:it}=K;it&&(ae=ae?ae.concat(it):it),j==null?(i(ce,q,W),i(Ue,q,W),I(K.children||[],q,Ue,Q,le,xe,ae,we)):Re>0&&Re&64&&Fe&&j.dynamicChildren&&j.dynamicChildren.length===Fe.length?(F(j.dynamicChildren,Fe,q,Q,le,xe,ae),(K.key!=null||Q&&K===Q.subTree)&&Ny(j,K,!0)):T(j,K,q,Ue,Q,le,xe,ae,we)},B=(j,K,q,W,Q,le,xe,ae,we)=>{K.slotScopeIds=ae,j==null?K.shapeFlag&512?Q.ctx.activate(K,q,W,xe,we):L(K,q,W,Q,le,xe,we):X(j,K,we)},L=(j,K,q,W,Q,le,xe)=>{const ae=j.component=k_(j,W,Q);if(Lm(j)&&(ae.ctx.renderer=ge),F_(ae,!1,xe),ae.asyncDep){if(Q&&Q.registerDep(ae,O,xe),!j.el){const we=ae.subTree=He(Tn);y(null,we,K,q),j.placeholder=we.el}}else O(ae,j,K,q,Q,le,xe)},X=(j,K,q)=>{const W=K.component=j.component;if(m_(j,K,q))if(W.asyncDep&&!W.asyncResolved){D(W,K,q);return}else W.next=K,W.update();else K.el=j.el,W.vnode=K},O=(j,K,q,W,Q,le,xe)=>{const ae=()=>{if(j.isMounted){let{next:Re,bu:Fe,u:it,parent:dt,vnode:It}=j;{const Ii=Uy(j);if(Ii){Re&&(Re.el=It.el,D(j,Re,xe)),Ii.asyncDep.then(()=>{ns(()=>{j.isUnmounted||ce()},Q)});return}}let yt=Re,Mt;$r(j,!1),Re?(Re.el=It.el,D(j,Re,xe)):Re=It,Fe&&wc(Fe),(Mt=Re.props&&Re.props.onVnodeBeforeUpdate)&&Js(Mt,dt,Re,It),$r(j,!0);const zt=Pp(j),Oi=j.subTree;j.subTree=zt,m(Oi,zt,u(Oi.el),me(Oi),j,Q,le),Re.el=zt.el,yt===null&&p_(j,zt.el),it&&ns(it,Q),(Mt=Re.props&&Re.props.onVnodeUpdated)&&ns(()=>Js(Mt,dt,Re,It),Q)}else{let Re;const{el:Fe,props:it}=K,{bm:dt,m:It,parent:yt,root:Mt,type:zt}=j,Oi=Qa(K);$r(j,!1),dt&&wc(dt),!Oi&&(Re=it&&it.onVnodeBeforeMount)&&Js(Re,yt,K),$r(j,!0);{Mt.ce&&Mt.ce._hasShadowRoot()&&Mt.ce._injectChildStyle(zt,j.parent?j.parent.type:void 0);const Ii=j.subTree=Pp(j);m(null,Ii,q,W,j,Q,le),K.el=Ii.el}if(It&&ns(It,Q),!Oi&&(Re=it&&it.onVnodeMounted)){const Ii=K;ns(()=>Js(Re,yt,Ii),Q)}(K.shapeFlag&256||yt&&Qa(yt.vnode)&&yt.vnode.shapeFlag&256)&&j.a&&ns(j.a,Q),j.isMounted=!0,K=q=W=null}};j.scope.on();const we=j.effect=new ey(ae);j.scope.off();const ce=j.update=we.run.bind(we),Ue=j.job=we.runIfDirty.bind(we);Ue.i=j,Ue.id=j.uid,we.scheduler=()=>Fm(Ue),$r(j,!0),ce()},D=(j,K,q)=>{K.component=j;const W=j.vnode.props;j.vnode=K,j.next=null,v_(j,K.props,W,q),w_(j,K.children,q),tr(),Tp(j),ir()},T=(j,K,q,W,Q,le,xe,ae,we=!1)=>{const ce=j&&j.children,Ue=j?j.shapeFlag:0,Re=K.children,{patchFlag:Fe,shapeFlag:it}=K;if(Fe>0){if(Fe&128){N(ce,Re,q,W,Q,le,xe,ae,we);return}else if(Fe&256){U(ce,Re,q,W,Q,le,xe,ae,we);return}}it&8?(Ue&16&&de(ce,Q,le),Re!==ce&&c(q,Re)):Ue&16?it&16?N(ce,Re,q,W,Q,le,xe,ae,we):de(ce,Q,le,!0):(Ue&8&&c(q,""),it&16&&I(Re,q,W,Q,le,xe,ae,we))},U=(j,K,q,W,Q,le,xe,ae,we)=>{j=j||Ka,K=K||Ka;const ce=j.length,Ue=K.length,Re=Math.min(ce,Ue);let Fe;for(Fe=0;Fe<Re;Fe++){const it=K[Fe]=we?Yn(K[Fe]):fn(K[Fe]);m(j[Fe],it,q,null,Q,le,xe,ae,we)}ce>Ue?de(j,Q,le,!0,!1,Re):I(K,q,W,Q,le,xe,ae,we,Re)},N=(j,K,q,W,Q,le,xe,ae,we)=>{let ce=0;const Ue=K.length;let Re=j.length-1,Fe=Ue-1;for(;ce<=Re&&ce<=Fe;){const it=j[ce],dt=K[ce]=we?Yn(K[ce]):fn(K[ce]);if(Po(it,dt))m(it,dt,q,null,Q,le,xe,ae,we);else break;ce++}for(;ce<=Re&&ce<=Fe;){const it=j[Re],dt=K[Fe]=we?Yn(K[Fe]):fn(K[Fe]);if(Po(it,dt))m(it,dt,q,null,Q,le,xe,ae,we);else break;Re--,Fe--}if(ce>Re){if(ce<=Fe){const it=Fe+1,dt=it<Ue?K[it].el:W;for(;ce<=Fe;)m(null,K[ce]=we?Yn(K[ce]):fn(K[ce]),q,dt,Q,le,xe,ae,we),ce++}}else if(ce>Fe)for(;ce<=Re;)G(j[ce],Q,le,!0),ce++;else{const it=ce,dt=ce,It=new Map;for(ce=dt;ce<=Fe;ce++){const Vt=K[ce]=we?Yn(K[ce]):fn(K[ce]);Vt.key!=null&&It.set(Vt.key,ce)}let yt,Mt=0;const zt=Fe-dt+1;let Oi=!1,Ii=0;const Is=new Array(zt);for(ce=0;ce<zt;ce++)Is[ce]=0;for(ce=it;ce<=Re;ce++){const Vt=j[ce];if(Mt>=zt){G(Vt,Q,le,!0);continue}let oe;if(Vt.key!=null)oe=It.get(Vt.key);else for(yt=dt;yt<=Fe;yt++)if(Is[yt-dt]===0&&Po(Vt,K[yt])){oe=yt;break}oe===void 0?G(Vt,Q,le,!0):(Is[oe-dt]=ce+1,oe>=Ii?Ii=oe:Oi=!0,m(Vt,K[oe],q,null,Q,le,xe,ae,we),Mt++)}const qs=Oi?M_(Is):Ka;for(yt=qs.length-1,ce=zt-1;ce>=0;ce--){const Vt=dt+ce,oe=K[Vt],fe=K[Vt+1],Et=Vt+1<Ue?fe.el||Xy(fe):W;Is[ce]===0?m(null,oe,q,Et,Q,le,xe,ae,we):Oi&&(yt<0||ce!==qs[yt]?Y(oe,q,Et,2):yt--)}}},Y=(j,K,q,W,Q=null)=>{const{el:le,type:xe,transition:ae,children:we,shapeFlag:ce}=j;if(ce&6){Y(j.component.subTree,K,q,W);return}if(ce&128){j.suspense.move(K,q,W);return}if(ce&64){xe.move(j,K,q,ge);return}if(xe===st){i(le,K,q);for(let Re=0;Re<we.length;Re++)Y(we[Re],K,q,W);i(j.anchor,K,q);return}if(xe===Sc){g(j,K,q);return}if(W!==2&&ce&1&&ae)if(W===0)ae.persisted&&!le[mu]?i(le,K,q):(ae.beforeEnter(le),i(le,K,q),ns(()=>ae.enter(le),Q));else{const{leave:Re,delayLeave:Fe,afterLeave:it}=ae,dt=()=>{j.ctx.isUnmounted?s(le):i(le,K,q)},It=()=>{const yt=le._isLeaving||!!le[mu];le._isLeaving&&le[mu](!0),ae.persisted&&!yt?dt():Re(le,()=>{dt(),it&&it()})};Fe?Fe(le,dt,It):It()}else i(le,K,q)},G=(j,K,q,W=!1,Q=!1)=>{const{type:le,props:xe,ref:ae,children:we,dynamicChildren:ce,shapeFlag:Ue,patchFlag:Re,dirs:Fe,cacheIndex:it,memo:dt}=j;if(Re===-2&&(Q=!1),ae!=null&&(tr(),el(ae,null,q,j,!0),ir()),it!=null&&(K.renderCache[it]=void 0),Ue&256){K.ctx.deactivate(j);return}const It=Ue&1&&Fe,yt=!Qa(j);let Mt;if(yt&&(Mt=xe&&xe.onVnodeBeforeUnmount)&&Js(Mt,K,j),Ue&6)Z(j.component,q,W);else{if(Ue&128){j.suspense.unmount(q,W);return}It&&Vr(j,null,K,"beforeUnmount"),Ue&64?j.type.remove(j,K,q,ge,W):ce&&!ce.hasOnce&&(le!==st||Re>0&&Re&64)?de(ce,K,q,!1,!0):(le===st&&Re&384||!Q&&Ue&16)&&de(we,K,q),W&&H(j)}const zt=dt!=null&&it==null;(yt&&(Mt=xe&&xe.onVnodeUnmounted)||It||zt)&&ns(()=>{Mt&&Js(Mt,K,j),It&&Vr(j,null,K,"unmounted"),zt&&(j.el=null)},q)},H=j=>{const{type:K,el:q,anchor:W,transition:Q}=j;if(K===st){ne(q,W);return}if(K===Sc){w(j);return}const le=()=>{s(q),Q&&!Q.persisted&&Q.afterLeave&&Q.afterLeave()};if(j.shapeFlag&1&&Q&&!Q.persisted){const{leave:xe,delayLeave:ae}=Q,we=()=>xe(q,le);ae?ae(j.el,le,we):we()}else le()},ne=(j,K)=>{let q;for(;j!==K;)q=d(j),s(j),j=q;s(K)},Z=(j,K,q)=>{const{bum:W,scope:Q,job:le,subTree:xe,um:ae,m:we,a:ce}=j;Op(we),Op(ce),W&&wc(W),Q.stop(),le&&(le.flags|=8,G(xe,j,K,q)),ae&&ns(ae,K),ns(()=>{j.isUnmounted=!0},K)},de=(j,K,q,W=!1,Q=!1,le=0)=>{for(let xe=le;xe<j.length;xe++)G(j[xe],K,q,W,Q)},me=j=>{if(j.shapeFlag&6)return me(j.component.subTree);if(j.shapeFlag&128)return j.suspense.next();const K=d(j.anchor||j.el),q=K&&K[YS];return q?d(q):K};let _e=!1;const Ae=(j,K,q)=>{let W;j==null?K._vnode&&(G(K._vnode,null,null,!0),W=K._vnode.component):m(K._vnode||null,j,K,null,null,null,q),K._vnode=j,_e||(_e=!0,Tp(W),vy(),_e=!1)},ge={p:m,um:G,m:Y,r:H,mt:L,mc:I,pc:T,pbc:F,n:me,o:n};return{render:Ae,hydrate:void 0,createApp:l_(Ae)}}function gu({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 $r({effect:n,job:e},t){t?(n.flags|=32,e.flags|=4):(n.flags&=-33,e.flags&=-5)}function T_(n,e){return(!n||n&&!n.pendingBranch)&&e&&!e.persisted}function Ny(n,e,t=!1){const i=n.children,s=e.children;if(ut(i)&&ut(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]=Yn(s[r]),o.el=a.el),!t&&o.patchFlag!==-2&&Ny(a,o)),o.type===Vh&&(o.patchFlag===-1&&(o=s[r]=Yn(o)),o.el=a.el),o.type===Tn&&!o.el&&(o.el=a.el)}}function M_(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 Uy(n){const e=n.subTree.component;if(e)return e.asyncDep&&!e.asyncResolved?e:Uy(e)}function Op(n){if(n)for(let e=0;e<n.length;e++)n[e].flags|=8}function Xy(n){if(n.placeholder)return n.placeholder;const e=n.component;return e?Xy(e.subTree):null}const Yy=n=>n.__isSuspense;function E_(n,e){e&&e.pendingBranch?ut(n)?e.effects.push(...n):e.effects.push(n):BS(n)}const st=Symbol.for("v-fgt"),Vh=Symbol.for("v-txt"),Tn=Symbol.for("v-cmt"),Sc=Symbol.for("v-stc"),Qn=[];let ps=null;function se(n=!1){Qn.push(ps=n?null:[])}function Xm(){Qn.pop(),ps=Qn[Qn.length-1]||null}let ml=1;function Bp(n,e=!1){ml+=n,n<0&&ps&&e&&(ps.hasOnce=!0)}function Vy(n){return n.dynamicChildren=ml>0?ps||Ka:null,Xm(),ml>0&&ps&&ps.push(n),n}function he(n,e,t,i,s,r){return Vy(A(n,e,t,i,s,r,!0))}function Ht(n,e,t,i,s){return Vy(He(n,e,t,i,s,!0))}function Ym(n){return n?n.__v_isVNode===!0:!1}function Po(n,e){return n.type===e.type&&n.key===e.key}const $y=({key:n})=>n??null,_c=({ref:n,ref_key:e,ref_for:t})=>(typeof n=="number"&&(n=""+n),n!=null?gi(n)||vi(n)||bt(n)?{i:qi,r:n,k:e,f:!!t}:n:null);function A(n,e=null,t=null,i=0,s=null,r=n===st?0:1,a=!1,o=!1){const h={__v_isVNode:!0,__v_skip:!0,type:n,props:e,key:e&&$y(e),ref:e&&_c(e),scopeId:xy,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:qi};return o?(Gc(h,t),r&128&&n.normalize(h)):t&&(h.shapeFlag|=gi(t)?8:16),ml>0&&!a&&ps&&(h.patchFlag>0||r&6)&&h.patchFlag!==32&&ps.push(h),h}const He=A_;function A_(n,e=null,t=null,i=0,s=null,r=!1){if((!n||n===QS)&&(n=Tn),Ym(n)){const o=ho(n,e,!0);return t&&Gc(o,t),ml>0&&!r&&ps&&(o.shapeFlag&6?ps[ps.indexOf(n)]=o:ps.push(o)),o.patchFlag=-2,o}if(D_(n)&&(n=n.__vccOpts),e){e=C_(e);let{class:o,style:h}=e;o&&!gi(o)&&(e.class=at(o)),Kt(h)&&(Dh(h)&&!ut(h)&&(h=Yi({},h)),e.style=Di(h))}const a=gi(n)?1:Yy(n)?128:Uh(n)?64:Kt(n)?4:bt(n)?2:0;return A(n,e,t,i,s,a,r,!0)}function C_(n){return n?Dh(n)||ky(n)?Yi({},n):n:null}function ho(n,e,t=!1,i=!1){const{props:s,ref:r,patchFlag:a,children:o,transition:h}=n,l=e?I_(s||{},e):s,c={__v_isVNode:!0,__v_skip:!0,type:n.type,props:l,key:l&&$y(l),ref:e&&e.ref?t&&r?ut(r)?r.concat(_c(e)):[r,_c(e)]:_c(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!==st?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&&ho(n.ssContent),ssFallback:n.ssFallback&&ho(n.ssFallback),placeholder:n.placeholder,el:n.el,anchor:n.anchor,ctx:n.ctx,ce:n.ce};return h&&i&&Bm(c,h.clone(c)),c}function ii(n=" ",e=0){return He(Vh,null,n,e)}function Ua(n,e){const t=He(Sc,null,n);return t.staticCount=e,t}function je(n="",e=!1){return e?(se(),Ht(Tn,null,n)):He(Tn,null,n)}function fn(n){return n==null||typeof n=="boolean"?He(Tn):ut(n)?He(st,null,n.slice()):Ym(n)?Yn(n):He(Vh,null,String(n))}function Yn(n){return n.el===null&&n.patchFlag!==-1||n.memo?n:ho(n)}function Gc(n,e){let t=0;const{shapeFlag:i}=n;if(e==null)e=null;else if(ut(e))t=16;else if(typeof e=="object")if(i&65){const s=e.default;s&&(s._c&&(s._d=!1),Gc(n,s()),s._c&&(s._d=!0));return}else{t=32;const s=e._;!s&&!ky(e)?e._ctx=qi:s===3&&qi&&(qi.slots._===1?e._=1:(e._=2,n.patchFlag|=1024))}else if(bt(e)){if(i&65){Gc(n,{default:e});return}e={default:e,_ctx:qi},t=32}else e=String(e),i&64?(t=16,e=[ii(e)]):t=8;n.children=e,n.shapeFlag|=t}function I_(...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=at([e.class,i.class]));else if(s==="style")e.style=Di([e.style,i.style]);else if(Rh(s)){const r=e[s],a=i[s];a&&r!==a&&!(ut(r)&&r.includes(a))?e[s]=r?[].concat(r,a):a:a==null&&r==null&&!Ph(s)&&(e[s]=a)}else s!==""&&(e[s]=i[s])}return e}function Js(n,e,t,i=null){Ws(n,e,7,[t,i])}const R_=Ay();let P_=0;function k_(n,e,t){const i=n.type,s=(e?e.appContext:n.appContext)||R_,r={uid:P_++,vnode:n,type:i,parent:e,appContext:s,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new Zv(!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:Oy(i,s),emitsOptions:Cy(i,s),emit:null,emitted:null,propsDefaults:Zt,inheritAttrs:i.inheritAttrs,ctx:Zt,data:Zt,props:Zt,attrs:Zt,slots:Zt,refs:Zt,setupState:Zt,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=h_.bind(null,r),n.ce&&n.ce(r),r}let Qi=null;const Gy=()=>Qi||qi;let jc,pl;{const n=Bh(),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)}};jc=e("__VUE_INSTANCE_SETTERS__",t=>Qi=t),pl=e("__VUE_SSR_SETTERS__",t=>gl=t)}const Cl=n=>{const e=Qi;return jc(n),n.scope.on(),()=>{n.scope.off(),jc(e)}},Lp=()=>{Qi&&Qi.scope.off(),jc(null)};function jy(n){return n.vnode.shapeFlag&4}let gl=!1;function F_(n,e=!1,t=!1){e&&pl(e);const{props:i,children:s}=n.vnode,r=jy(n);g_(n,i,r,e),b_(n,s,t||e);const a=r?O_(n,e):void 0;return e&&pl(!1),a}function O_(n,e){const t=n.type;n.accessCache=Object.create(null),n.proxy=new Proxy(n.ctx,t_);const{setup:i}=t;if(i){tr();const s=n.setupContext=i.length>1?L_(n):null,r=Cl(n),a=El(i,n,0,[n.props,s]),o=$v(a);if(ir(),r(),(o||n.sp)&&!Qa(n)&&Sy(n),o){if(a.then(Lp,Lp),e)return a.then(h=>{pl(!0);try{Dp(n,h,e)}finally{pl(!1)}}).catch(h=>{Nh(h,n,0)});n.asyncDep=a}else Dp(n,a)}else Hy(n)}function Dp(n,e,t){bt(e)?n.type.__ssrInlineRender?n.ssrRender=e:n.render=e:Kt(e)&&(n.setupState=my(e)),Hy(n)}function Hy(n,e,t){const i=n.type;n.render||(n.render=i.render||bn);{const s=Cl(n);tr();try{i_(n)}finally{ir(),s()}}}const B_={get(n,e){return Wi(n,"get",""),n[e]}};function L_(n){const e=t=>{n.exposed=t||{}};return{attrs:new Proxy(n.attrs,B_),slots:n.slots,emit:n.emit,expose:e}}function $h(n){return n.exposed?n.exposeProxy||(n.exposeProxy=new Proxy(my(Er(n.exposed)),{get(e,t){if(t in e)return e[t];if(t in tl)return tl[t](n)},has(e,t){return t in e||t in tl}})):n.proxy}function D_(n){return bt(n)&&"__vccOpts"in n}const ft=(n,e)=>RS(n,e,gl),N_="3.5.41";/**
|
||
* @vue/runtime-dom v3.5.41
|
||
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
||
* @license MIT
|
||
**/let uf;const Np=typeof window<"u"&&window.trustedTypes;if(Np)try{uf=Np.createPolicy("vue",{createHTML:n=>n})}catch{}const Wy=uf?n=>uf.createHTML(n):n=>n,U_="http://www.w3.org/2000/svg",X_="http://www.w3.org/1998/Math/MathML",Ln=typeof document<"u"?document:null,Up=Ln&&Ln.createElement("template"),Y_={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"?Ln.createElementNS(U_,n):e==="mathml"?Ln.createElementNS(X_,n):t?Ln.createElement(n,{is:t}):Ln.createElement(n);return n==="select"&&i&&i.multiple!=null&&s.setAttribute("multiple",i.multiple),s},createText:n=>Ln.createTextNode(n),createComment:n=>Ln.createComment(n),setText:(n,e)=>{n.nodeValue=e},setElementText:(n,e)=>{n.textContent=e},parentNode:n=>n.parentNode,nextSibling:n=>n.nextSibling,querySelector:n=>Ln.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{Up.innerHTML=Wy(i==="svg"?`<svg>${n}</svg>`:i==="mathml"?`<math>${n}</math>`:n);const o=Up.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]}},V_=Symbol("_vtc");function $_(n,e,t){const i=n[V_];i&&(e=(e?[e,...i]:[...i]).join(" ")),e==null?n.removeAttribute("class"):t?n.setAttribute("class",e):n.className=e}const Hc=Symbol("_vod"),zy=Symbol("_vsh"),hr={name:"show",beforeMount(n,{value:e},{transition:t}){n[Hc]=n.style.display==="none"?"":n.style.display,t&&e?t.beforeEnter(n):ko(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),ko(n,!0),i.enter(n)):i.leave(n,()=>{ko(n,!1)}):ko(n,e))},beforeUnmount(n,{value:e}){ko(n,e)}};function ko(n,e){n.style.display=e?n[Hc]:"none",n[zy]=!e}const G_=Symbol(""),j_=/(?:^|;)\s*display\s*:/;function H_(n,e,t){const i=n.style,s=gi(t);let r=!1;if(t&&!s){if(e)if(gi(e))for(const a of e.split(";")){const o=a.slice(0,a.indexOf(":")).trim();t[o]==null&&Yo(i,o,"")}else for(const a in e)t[a]==null&&Yo(i,a,"");for(const a in t){a==="display"&&(r=!0);const o=t[a];o!=null?z_(n,a,!gi(e)&&e?e[a]:void 0,o)||Yo(i,a,o):Yo(i,a,"")}}else if(s){if(e!==t){const a=i[G_];a&&(t+=";"+a),i.cssText=t,r=j_.test(t)}}else e&&n.removeAttribute("style");Hc in n&&(n[Hc]=r?i.display:"",n[zy]&&(i.display="none"))}const Xp=/\s*!important$/;function Yo(n,e,t){if(ut(t))t.forEach(i=>Yo(n,e,i));else if(t==null&&(t=""),e.startsWith("--"))n.setProperty(e,t);else{const i=W_(n,e);Xp.test(t)?n.setProperty(Lr(i),t.replace(Xp,""),"important"):n[i]=t}}const Yp=["Webkit","Moz","ms"],vu={};function W_(n,e){const t=vu[e];if(t)return t;let i=Xs(e);if(i!=="filter"&&i in n)return vu[e]=i;i=Hv(i);for(let s=0;s<Yp.length;s++){const r=Yp[s]+i;if(r in n)return vu[e]=r}return e}function z_(n,e,t,i){return n.tagName==="TEXTAREA"&&(e==="width"||e==="height")&&gi(i)&&t===i}const Vp="http://www.w3.org/1999/xlink";function $p(n,e,t,i,s,r=tS(e)){i&&e.startsWith("xlink:")?t==null?n.removeAttributeNS(Vp,e.slice(6,e.length)):n.setAttributeNS(Vp,e,t):t==null||r&&!zv(t)?n.removeAttribute(e):n.setAttribute(e,r?"":ys(t)?String(t):t)}function Gp(n,e,t,i,s){if(e==="innerHTML"||e==="textContent"){t!=null&&(n[e]=e==="innerHTML"?Wy(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=zv(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 Sr(n,e,t,i){n.addEventListener(e,t,i)}function q_(n,e,t,i){n.removeEventListener(e,t,i)}const jp=Symbol("_vei");function K_(n,e,t,i,s=null){const r=n[jp]||(n[jp]={}),a=r[e];if(i&&a)a.value=i;else{const[o,h]=Q_(e);if(i){const l=r[e]=iT(i,s);Sr(n,o,l,h)}else a&&(q_(n,o,a,h),r[e]=void 0)}}const Z_=/(Once|Passive|Capture)$/,J_=/^on:?(?:Once|Passive|Capture)$/;function Q_(n){let e,t;for(;(t=n.match(Z_))&&!J_.test(n);)e||(e={}),n=n.slice(0,n.length-t[1].length),e[t[1].toLowerCase()]=!0;return[n[2]===":"?n.slice(3):Lr(n.slice(2)),e]}let yu=0;const eT=Promise.resolve(),tT=()=>yu||(eT.then(()=>yu=0),yu=Date.now());function iT(n,e){const t=i=>{if(!i._vts)i._vts=Date.now();else if(i._vts<=t.attached)return;const s=t.value;if(ut(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&&Ws(l,e,5,o)}}else Ws(s,e,5,[i])};return t.value=n,t.attached=tT(),t}const Hp=n=>n.charCodeAt(0)===111&&n.charCodeAt(1)===110&&n.charCodeAt(2)>96&&n.charCodeAt(2)<123,sT=(n,e,t,i,s,r)=>{const a=s==="svg";e==="class"?$_(n,i,a):e==="style"?H_(n,t,i):Rh(e)?Ph(e)||K_(n,e,t,i,r):(e[0]==="."?(e=e.slice(1),!0):e[0]==="^"?(e=e.slice(1),!1):nT(n,e,i,a))?(Gp(n,e,i),!n.tagName.includes("-")&&(e==="value"||e==="checked"||e==="selected")&&$p(n,e,i,a,r,e!=="value")):n._isVueCE&&(rT(n,e)||n._def.__asyncLoader&&(/[A-Z]/.test(e)||!gi(i)))?Gp(n,Xs(e),i,r,e):(e==="true-value"?n._trueValue=i:e==="false-value"&&(n._falseValue=i),$p(n,e,i,a))};function nT(n,e,t,i){if(i)return!!(e==="innerHTML"||e==="textContent"||e in n&&Hp(e)&&bt(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 Hp(e)&&gi(t)?!1:e in n}function rT(n,e){const t=n._def.props;if(!t)return!1;const i=Xs(e);return Array.isArray(t)?t.some(s=>Xs(s)===i):Object.keys(t).some(s=>Xs(s)===i)}const uo=n=>{const e=n.props["onUpdate:modelValue"]||!1;return ut(e)?t=>wc(e,t):e};function aT(n){n.target.composing=!0}function Wp(n){const e=n.target;e.composing&&(e.composing=!1,e.dispatchEvent(new Event("input")))}const gn=Symbol("_assign"),Vl=Symbol("_initialValue");function xu(n,e,t){return e&&(n=n.trim()),t&&(n=Oh(n)),n}const ot={created(n,{modifiers:{lazy:e,trim:t,number:i}},s){n.parentNode&&(n.type==="text"?n[Vl]=n.defaultValue.replace(/[\r\n]/g,""):n.type==="textarea"&&(n[Vl]=n.defaultValue.replace(/\r\n?/g,`
|
||
`))),n[gn]=uo(s);const r=i||s.props&&s.props.type==="number";Sr(n,e?"change":"input",a=>{a.target.composing||n[gn](xu(n.value,t,r))}),(t||r)&&Sr(n,"change",()=>{n.value=xu(n.value,t,r)}),e||(Sr(n,"compositionstart",aT),Sr(n,"compositionend",Wp),Sr(n,"change",Wp))},mounted(n,{value:e,modifiers:{trim:t,number:i}}){const s=e??"",r=n[Vl];delete n[Vl],r!==void 0&&(n.type==="text"||n.type==="textarea")&&n.value!==r?n[gn](xu(n.value,t,i)):n.value=s},beforeUpdate(n,{value:e,oldValue:t,modifiers:{lazy:i,trim:s,number:r}},a){if(n[gn]=uo(a),n.composing)return;const o=(r||n.type==="number")&&!/^0\d/.test(n.value)?Oh(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)}},ei={deep:!0,created(n,e,t){n[gn]=uo(t),Sr(n,"change",()=>{const i=n._modelValue,s=vl(n),r=n.checked,a=n[gn];if(ut(i)){const o=Mm(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(xo(i)){const o=new Set(i);r?o.add(s):o.delete(s),a(o)}else a(qy(n,r))})},mounted:zp,beforeUpdate(n,e,t){n[gn]=uo(t),zp(n,e,t)}};function zp(n,{value:e,oldValue:t},i){n._modelValue=e;let s;if(ut(e))s=Mm(e,i.props.value)>-1;else if(xo(e))s=e.has(i.props.value);else{if(e===t)return;s=bo(e,qy(n,!0))}n.checked!==s&&(n.checked=s)}const qt={deep:!0,created(n,{value:e,modifiers:{number:t}},i){n._modelValue=e,Sr(n,"change",()=>{const s=Array.prototype.filter.call(n.options,r=>r.selected).map(r=>t?Oh(vl(r)):vl(r));n[gn](n.multiple?xo(n._modelValue)?new Set(s):s:s[0]),n._assigning=!0,km(()=>{n._assigning=!1})}),n[gn]=uo(i)},mounted(n,{value:e}){qp(n,e)},beforeUpdate(n,{value:e},t){n._modelValue=e,n[gn]=uo(t)},updated(n,{value:e}){n._assigning||qp(n,e)}};function qp(n,e){const t=n.multiple,i=ut(e);if(!(t&&!i&&!xo(e))){for(let s=0,r=n.options.length;s<r;s++){const a=n.options[s],o=vl(a);if(t)if(i){const h=typeof o;h==="string"||h==="number"?a.selected=e.some(l=>String(l)===String(o)):a.selected=Mm(e,o)>-1}else a.selected=e.has(o);else if(bo(vl(a),e)){n.selectedIndex!==s&&(n.selectedIndex=s);return}}!t&&n.selectedIndex!==-1&&(n.selectedIndex=-1)}}function vl(n){return"_value"in n?n._value:n.value}function qy(n,e){const t=e?"_trueValue":"_falseValue";return t in n?n[t]:e}const oT=["ctrl","shift","alt","meta"],lT={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)=>oT.some(t=>n[`${t}Key`]&&!e.includes(t))},Ct=(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=lT[e[a]];if(o&&o(s,e))return}return n(s,...r)}))},cT={esc:"escape",space:" ",up:"arrow-up",left:"arrow-left",right:"arrow-right",down:"arrow-down",delete:"backspace"},ha=(n,e)=>{const t=n._withKeys||(n._withKeys={}),i=e.join(".");return t[i]||(t[i]=(s=>{if(!("key"in s))return;const r=Lr(s.key);if(e.some(a=>a===r||cT[a]===r))return n(s)}))},hT=Yi({patchProp:sT},Y_);let Kp;function uT(){return Kp||(Kp=S_(hT))}const dT=((...n)=>{const e=uT().createApp(...n),{mount:t}=e;return e.mount=i=>{const s=mT(i);if(!s)return;const r=e._component;!bt(r)&&!r.render&&!r.template&&(r.template=s.innerHTML),s.nodeType===1&&(s.textContent="");const a=t(s,!1,fT(s));return s instanceof Element&&(s.removeAttribute("v-cloak"),s.setAttribute("data-v-app","")),a},e});function fT(n){if(n instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&n instanceof MathMLElement)return"mathml"}function mT(n){return gi(n)?document.querySelector(n):n}/*!
|
||
* pinia v4.0.3
|
||
* (c) 2026 Eduardo San Martin Morote
|
||
* @license MIT
|
||
*/let Ky;const Gh=n=>Ky=n,Zy=Symbol();function Zp(n){return n&&typeof n=="object"&&Object.prototype.toString.call(n)==="[object Object]"&&typeof n.toJSON!="function"}function pT(){const n=Jv(!0),e=n.run(()=>lt({}));let t=[],i=[];const s=Er({install(r){Gh(s),s._a=r,r.provide(Zy,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 df=()=>{};function Jp(n,e,t,i=df){n.add(e);const s=()=>{n.delete(e)&&i()};return!t&&Qv()&&sS(s),s}function Ra(n,...e){n.forEach(t=>{t(...e)})}const gT=n=>n(),Qp=Symbol(),bu=Symbol();function ff(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];Zp(s)&&Zp(i)&&Object.hasOwn(n,t)&&!vi(i)&&!Jn(i)?n[t]=ff(s,i):n[t]=i}return n}const vT=Symbol();function yT(n){return!n||typeof n!="object"||!Object.hasOwn(n,vT)}const{assign:fr}=Object;function xT(n){return!!(vi(n)&&n.effect)}function bT(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=ES(t.state.value[n]);return fr(c,r,Object.keys(a||{}).reduce((u,d)=>(u[d]=Er(ft(()=>{Gh(t);const f=t._s.get(n);return a[d].call(f,f)})),u),{}))}return h=Jy(n,l,e,t,i,!0),h}function Jy(n,e,t={},i,s,r){let a;const o=fr({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 v(_){let I;l=c=!1,typeof _=="function"?(_(i.state.value[n]),I={type:"patch function",storeId:n,events:f}):(ff(i.state.value[n],_),I={type:"patch object",payload:_,storeId:n,events:f});const R=m=Symbol();km().then(()=>{m===R&&(l=!0)}),c=!0,Ra(u,I,i.state.value[n])}const y=r?function(){const{state:I}=t,R=I?I():{};this.$patch(F=>{fr(F,R)})}:df;function b(){a.stop(),u.clear(),d.clear(),i._s.delete(n)}const g=(_,I="")=>{if(Qp in _)return _[bu]=I,_;const R=function(){Gh(i);const F=Array.from(arguments),P=new Set,k=new Set;function B(O){P.add(O)}function L(O){k.add(O)}Ra(d,{args:F,name:R[bu],store:E,after:B,onError:L});let X;try{X=_.apply(this&&this.$id===n?this:E,F)}catch(O){throw Ra(k,O),O}return X instanceof Promise?X.then(O=>(Ra(P,O),O)).catch(O=>(Ra(k,O),Promise.reject(O))):(Ra(P,X),X)};return R[Qp]=!0,R[bu]=I,R},w={_p:i,$id:n,$onAction:Jp.bind(null,d),$patch:v,$reset:y,$subscribe(_,I={}){if(u.has(_))return df;const R=Jp(u,_,I.detached,()=>F()),F=a.run(()=>vs(()=>i.state.value[n],P=>{(I.flush==="sync"?c:l)&&_({storeId:n,type:"direct",events:f},P)},fr({},h,I)));return R},$dispose:b},E=wo(w);i._s.set(n,E);const M=(i._a&&i._a.runWithContext||gT)(()=>i._e.run(()=>(a=Jv()).run(()=>e({action:g}))));for(const _ in M){const I=M[_];vi(I)&&!xT(I)||Jn(I)?r||(p&&yT(I)&&(vi(I)?I.value=p[_]:((I instanceof Set||I instanceof Map)&&I.clear(),ff(I,p[_]))),i.state.value[n][_]=I):typeof I=="function"&&(M[_]=g(I,_),o.actions[_]=I)}return fr(E,M),fr(Xt(E),M),Object.defineProperty(E,"$state",{get:()=>i.state.value[n],set:_=>{v(I=>{fr(I,_)})}}),i._p.forEach(_=>{const I=a.run(()=>_({store:E,app:i._a,pinia:i,options:o}));fr(E,I)}),p&&r&&t.hydrate&&t.hydrate(E.$state,p),l=!0,c=!0,E}/*! #__NO_SIDE_EFFECTS__ */function wT(n,e,t){let i;const s=typeof e=="function";i=s?t:e;function r(a,o){const h=DS();return a=a||(h?Qo(Zy,null):null),a&&Gh(a),a=Ky,a._s.has(n)||(s?Jy(n,e,i,a):bT(n,i,a)),a._s.get(n)}return r.$id=n,r}var wa=(n=>(n[n.WEBGL_LEGACY=0]="WEBGL_LEGACY",n[n.WEBGL=1]="WEBGL",n[n.WEBGL2=2]="WEBGL2",n))(wa||{}),Qy=(n=>(n[n.UNKNOWN=0]="UNKNOWN",n[n.WEBGL=1]="WEBGL",n[n.CANVAS=2]="CANVAS",n))(Qy||{}),mf=(n=>(n[n.COLOR=16384]="COLOR",n[n.DEPTH=256]="DEPTH",n[n.STENCIL=1024]="STENCIL",n))(mf||{}),ct=(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))(ct||{}),vn=(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))(vn||{}),Le=(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))(Le||{}),eo=(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))(eo||{}),Qe=(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))(Qe||{}),qe=(n=>(n[n.FLOAT=0]="FLOAT",n[n.INT=1]="INT",n[n.UINT=2]="UINT",n))(qe||{}),Us=(n=>(n[n.NEAREST=0]="NEAREST",n[n.LINEAR=1]="LINEAR",n))(Us||{}),Vs=(n=>(n[n.CLAMP=33071]="CLAMP",n[n.REPEAT=10497]="REPEAT",n[n.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",n))(Vs||{}),Cs=(n=>(n[n.OFF=0]="OFF",n[n.POW2=1]="POW2",n[n.ON=2]="ON",n[n.ON_MANUAL=3]="ON_MANUAL",n))(Cs||{}),Fi=(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))(Fi||{}),mn=(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))(mn||{}),Vm=(n=>(n[n.AUTO=0]="AUTO",n[n.MANUAL=1]="MANUAL",n))(Vm||{}),Es=(n=>(n.LOW="lowp",n.MEDIUM="mediump",n.HIGH="highp",n))(Es||{}),Ti=(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))(Ti||{}),Si=(n=>(n[n.NONE=0]="NONE",n[n.LOW=2]="LOW",n[n.MEDIUM=4]="MEDIUM",n[n.HIGH=8]="HIGH",n))(Si||{}),wn=(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))(wn||{});const ST={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")},ze={ADAPTER:ST,RESOLUTION:1,CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1};var wu=/iPhone/i,eg=/iPod/i,tg=/iPad/i,ig=/\biOS-universal(?:.+)Mac\b/i,Su=/\bAndroid(?:.+)Mobile\b/i,sg=/Android/i,Pa=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,$l=/Silk/i,Fn=/Windows Phone/i,ng=/\bWindows(?:.+)ARM\b/i,rg=/BlackBerry/i,ag=/BB10/i,og=/Opera Mini/i,lg=/\b(CriOS|Chrome)(?:.+)Mobile/i,cg=/Mobile(?:.+)Firefox\b/i,hg=function(n){return typeof n<"u"&&n.platform==="MacIntel"&&typeof n.maxTouchPoints=="number"&&n.maxTouchPoints>1&&typeof MSStream>"u"};function _T(n){return function(e){return e.test(n)}}function ug(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=_T(t),r={apple:{phone:s(wu)&&!s(Fn),ipod:s(eg),tablet:!s(wu)&&(s(tg)||hg(e))&&!s(Fn),universal:s(ig),device:(s(wu)||s(eg)||s(tg)||s(ig)||hg(e))&&!s(Fn)},amazon:{phone:s(Pa),tablet:!s(Pa)&&s($l),device:s(Pa)||s($l)},android:{phone:!s(Fn)&&s(Pa)||!s(Fn)&&s(Su),tablet:!s(Fn)&&!s(Pa)&&!s(Su)&&(s($l)||s(sg)),device:!s(Fn)&&(s(Pa)||s($l)||s(Su)||s(sg))||s(/\bokhttp\b/i)},windows:{phone:s(Fn),tablet:s(ng),device:s(Fn)||s(ng)},other:{blackberry:s(rg),blackberry10:s(ag),opera:s(og),firefox:s(cg),chrome:s(lg),device:s(rg)||s(ag)||s(og)||s(cg)||s(lg)},any:!1,phone:!1,tablet:!1};return r.any=r.apple.device||r.android.device||r.windows.device||r.other.device,r.phone=r.apple.phone||r.android.phone||r.windows.phone,r.tablet=r.apple.tablet||r.android.tablet||r.windows.tablet,r}const TT=ug.default??ug,jn=TT(globalThis.navigator);ze.RETINA_PREFIX=/@([0-9\.]+)x/;ze.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!1;var Wc=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ex(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}function MT(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 _u={exports:{}},dg;function ET(){return dg||(dg=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 v=this._events[m],y=arguments.length,b,g;if(v.fn){switch(v.once&&this.removeListener(l,v.fn,void 0,!0),y){case 1:return v.fn.call(v.context),!0;case 2:return v.fn.call(v.context,c),!0;case 3:return v.fn.call(v.context,c,u),!0;case 4:return v.fn.call(v.context,c,u,d),!0;case 5:return v.fn.call(v.context,c,u,d,f),!0;case 6:return v.fn.call(v.context,c,u,d,f,p),!0}for(g=1,b=new Array(y-1);g<y;g++)b[g-1]=arguments[g];v.fn.apply(v.context,b)}else{var w=v.length,E;for(g=0;g<w;g++)switch(v[g].once&&this.removeListener(l,v[g].fn,void 0,!0),y){case 1:v[g].fn.call(v[g].context);break;case 2:v[g].fn.call(v[g].context,c);break;case 3:v[g].fn.call(v[g].context,c,u);break;case 4:v[g].fn.call(v[g].context,c,u,d);break;default:if(!b)for(E=1,b=new Array(y-1);E<y;E++)b[E-1]=arguments[E];v[g].fn.apply(v[g].context,b)}}return!0},o.prototype.on=function(l,c,u){return r(this,l,c,u,!1)},o.prototype.once=function(l,c,u){return r(this,l,c,u,!0)},o.prototype.removeListener=function(l,c,u,d){var f=t?t+l:l;if(!this._events[f])return this;if(!c)return a(this,f),this;var p=this._events[f];if(p.fn)p.fn===c&&(!d||p.once)&&(!u||p.context===u)&&a(this,f);else{for(var m=0,v=[],y=p.length;m<y;m++)(p[m].fn!==c||d&&!p[m].once||u&&p[m].context!==u)&&v.push(p[m]);v.length?this._events[f]=v.length===1?v[0]:v: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})(_u)),_u.exports}var AT=ET();const Il=ex(AT);var Gl={exports:{}},fg;function CT(){if(fg)return Gl.exports;fg=1,Gl.exports=n,Gl.exports.default=n;function n(O,D,T){T=T||2;var U=D&&D.length,N=U?D[0]*T:O.length,Y=e(O,0,N,T,!0),G=[];if(!Y||Y.next===Y.prev)return G;var H,ne,Z,de,me,_e,Ae;if(U&&(Y=h(O,D,Y,T)),O.length>80*T){H=Z=O[0],ne=de=O[1];for(var ge=T;ge<N;ge+=T)me=O[ge],_e=O[ge+1],me<H&&(H=me),_e<ne&&(ne=_e),me>Z&&(Z=me),_e>de&&(de=_e);Ae=Math.max(Z-H,de-ne),Ae=Ae!==0?32767/Ae:0}return i(Y,G,T,H,ne,Ae,0),G}function e(O,D,T,U,N){var Y,G;if(N===X(O,D,T,U)>0)for(Y=D;Y<T;Y+=U)G=k(Y,O[Y],O[Y+1],G);else for(Y=T-U;Y>=D;Y-=U)G=k(Y,O[Y],O[Y+1],G);return G&&w(G,G.next)&&(B(G),G=G.next),G}function t(O,D){if(!O)return O;D||(D=O);var T=O,U;do if(U=!1,!T.steiner&&(w(T,T.next)||g(T.prev,T,T.next)===0)){if(B(T),T=D=T.prev,T===T.next)break;U=!0}else T=T.next;while(U||T!==D);return D}function i(O,D,T,U,N,Y,G){if(O){!G&&Y&&f(O,U,N,Y);for(var H=O,ne,Z;O.prev!==O.next;){if(ne=O.prev,Z=O.next,Y?r(O,U,N,Y):s(O)){D.push(ne.i/T|0),D.push(O.i/T|0),D.push(Z.i/T|0),B(O),O=Z.next,H=Z.next;continue}if(O=Z,O===H){G?G===1?(O=a(t(O),D,T),i(O,D,T,U,N,Y,2)):G===2&&o(O,D,T,U,N,Y):i(t(O),D,T,U,N,Y,1);break}}}}function s(O){var D=O.prev,T=O,U=O.next;if(g(D,T,U)>=0)return!1;for(var N=D.x,Y=T.x,G=U.x,H=D.y,ne=T.y,Z=U.y,de=N<Y?N<G?N:G:Y<G?Y:G,me=H<ne?H<Z?H:Z:ne<Z?ne:Z,_e=N>Y?N>G?N:G:Y>G?Y:G,Ae=H>ne?H>Z?H:Z:ne>Z?ne:Z,ge=U.next;ge!==D;){if(ge.x>=de&&ge.x<=_e&&ge.y>=me&&ge.y<=Ae&&y(N,H,Y,ne,G,Z,ge.x,ge.y)&&g(ge.prev,ge,ge.next)>=0)return!1;ge=ge.next}return!0}function r(O,D,T,U){var N=O.prev,Y=O,G=O.next;if(g(N,Y,G)>=0)return!1;for(var H=N.x,ne=Y.x,Z=G.x,de=N.y,me=Y.y,_e=G.y,Ae=H<ne?H<Z?H:Z:ne<Z?ne:Z,ge=de<me?de<_e?de:_e:me<_e?me:_e,Ee=H>ne?H>Z?H:Z:ne>Z?ne:Z,j=de>me?de>_e?de:_e:me>_e?me:_e,K=m(Ae,ge,D,T,U),q=m(Ee,j,D,T,U),W=O.prevZ,Q=O.nextZ;W&&W.z>=K&&Q&&Q.z<=q;){if(W.x>=Ae&&W.x<=Ee&&W.y>=ge&&W.y<=j&&W!==N&&W!==G&&y(H,de,ne,me,Z,_e,W.x,W.y)&&g(W.prev,W,W.next)>=0||(W=W.prevZ,Q.x>=Ae&&Q.x<=Ee&&Q.y>=ge&&Q.y<=j&&Q!==N&&Q!==G&&y(H,de,ne,me,Z,_e,Q.x,Q.y)&&g(Q.prev,Q,Q.next)>=0))return!1;Q=Q.nextZ}for(;W&&W.z>=K;){if(W.x>=Ae&&W.x<=Ee&&W.y>=ge&&W.y<=j&&W!==N&&W!==G&&y(H,de,ne,me,Z,_e,W.x,W.y)&&g(W.prev,W,W.next)>=0)return!1;W=W.prevZ}for(;Q&&Q.z<=q;){if(Q.x>=Ae&&Q.x<=Ee&&Q.y>=ge&&Q.y<=j&&Q!==N&&Q!==G&&y(H,de,ne,me,Z,_e,Q.x,Q.y)&&g(Q.prev,Q,Q.next)>=0)return!1;Q=Q.nextZ}return!0}function a(O,D,T){var U=O;do{var N=U.prev,Y=U.next.next;!w(N,Y)&&E(N,U,U.next,Y)&&R(N,Y)&&R(Y,N)&&(D.push(N.i/T|0),D.push(U.i/T|0),D.push(Y.i/T|0),B(U),B(U.next),U=O=Y),U=U.next}while(U!==O);return t(U)}function o(O,D,T,U,N,Y){var G=O;do{for(var H=G.next.next;H!==G.prev;){if(G.i!==H.i&&b(G,H)){var ne=P(G,H);G=t(G,G.next),ne=t(ne,ne.next),i(G,D,T,U,N,Y,0),i(ne,D,T,U,N,Y,0);return}H=H.next}G=G.next}while(G!==O)}function h(O,D,T,U){var N=[],Y,G,H,ne,Z;for(Y=0,G=D.length;Y<G;Y++)H=D[Y]*U,ne=Y<G-1?D[Y+1]*U:O.length,Z=e(O,H,ne,U,!1),Z===Z.next&&(Z.steiner=!0),N.push(v(Z));for(N.sort(l),Y=0;Y<N.length;Y++)T=c(N[Y],T);return T}function l(O,D){return O.x-D.x}function c(O,D){var T=u(O,D);if(!T)return D;var U=P(T,O);return t(U,U.next),t(T,T.next)}function u(O,D){var T=D,U=O.x,N=O.y,Y=-1/0,G;do{if(N<=T.y&&N>=T.next.y&&T.next.y!==T.y){var H=T.x+(N-T.y)*(T.next.x-T.x)/(T.next.y-T.y);if(H<=U&&H>Y&&(Y=H,G=T.x<T.next.x?T:T.next,H===U))return G}T=T.next}while(T!==D);if(!G)return null;var ne=G,Z=G.x,de=G.y,me=1/0,_e;T=G;do U>=T.x&&T.x>=Z&&U!==T.x&&y(N<de?U:Y,N,Z,de,N<de?Y:U,N,T.x,T.y)&&(_e=Math.abs(N-T.y)/(U-T.x),R(T,O)&&(_e<me||_e===me&&(T.x>G.x||T.x===G.x&&d(G,T)))&&(G=T,me=_e)),T=T.next;while(T!==ne);return G}function d(O,D){return g(O.prev,O,D.prev)<0&&g(D.next,O,O.next)<0}function f(O,D,T,U){var N=O;do N.z===0&&(N.z=m(N.x,N.y,D,T,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,T,U,N,Y,G,H,ne,Z=1;do{for(T=O,O=null,Y=null,G=0;T;){for(G++,U=T,H=0,D=0;D<Z&&(H++,U=U.nextZ,!!U);D++);for(ne=Z;H>0||ne>0&&U;)H!==0&&(ne===0||!U||T.z<=U.z)?(N=T,T=T.nextZ,H--):(N=U,U=U.nextZ,ne--),Y?Y.nextZ=N:O=N,N.prevZ=Y,Y=N;T=U}Y.nextZ=null,Z*=2}while(G>1);return O}function m(O,D,T,U,N){return O=(O-T)*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 v(O){var D=O,T=O;do(D.x<T.x||D.x===T.x&&D.y<T.y)&&(T=D),D=D.next;while(D!==O);return T}function y(O,D,T,U,N,Y,G,H){return(N-G)*(D-H)>=(O-G)*(Y-H)&&(O-G)*(U-H)>=(T-G)*(D-H)&&(T-G)*(Y-H)>=(N-G)*(U-H)}function b(O,D){return O.next.i!==D.i&&O.prev.i!==D.i&&!I(O,D)&&(R(O,D)&&R(D,O)&&F(O,D)&&(g(O.prev,O,D.prev)||g(O,D.prev,D))||w(O,D)&&g(O.prev,O,O.next)>0&&g(D.prev,D,D.next)>0)}function g(O,D,T){return(D.y-O.y)*(T.x-D.x)-(D.x-O.x)*(T.y-D.y)}function w(O,D){return O.x===D.x&&O.y===D.y}function E(O,D,T,U){var N=_(g(O,D,T)),Y=_(g(O,D,U)),G=_(g(T,U,O)),H=_(g(T,U,D));return!!(N!==Y&&G!==H||N===0&&M(O,T,D)||Y===0&&M(O,U,D)||G===0&&M(T,O,U)||H===0&&M(T,D,U))}function M(O,D,T){return D.x<=Math.max(O.x,T.x)&&D.x>=Math.min(O.x,T.x)&&D.y<=Math.max(O.y,T.y)&&D.y>=Math.min(O.y,T.y)}function _(O){return O>0?1:O<0?-1:0}function I(O,D){var T=O;do{if(T.i!==O.i&&T.next.i!==O.i&&T.i!==D.i&&T.next.i!==D.i&&E(T,T.next,O,D))return!0;T=T.next}while(T!==O);return!1}function R(O,D){return g(O.prev,O,O.next)<0?g(O,D,O.next)>=0&&g(O,O.prev,D)>=0:g(O,D,O.prev)<0||g(O,O.next,D)<0}function F(O,D){var T=O,U=!1,N=(O.x+D.x)/2,Y=(O.y+D.y)/2;do T.y>Y!=T.next.y>Y&&T.next.y!==T.y&&N<(T.next.x-T.x)*(Y-T.y)/(T.next.y-T.y)+T.x&&(U=!U),T=T.next;while(T!==O);return U}function P(O,D){var T=new L(O.i,O.x,O.y),U=new L(D.i,D.x,D.y),N=O.next,Y=D.prev;return O.next=D,D.prev=O,T.next=N,N.prev=T,U.next=T,T.prev=U,Y.next=U,U.prev=Y,U}function k(O,D,T,U){var N=new L(O,D,T);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,T){this.i=O,this.x=D,this.y=T,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}n.deviation=function(O,D,T,U){var N=D&&D.length,Y=N?D[0]*T:O.length,G=Math.abs(X(O,0,Y,T));if(N)for(var H=0,ne=D.length;H<ne;H++){var Z=D[H]*T,de=H<ne-1?D[H+1]*T:O.length;G-=Math.abs(X(O,Z,de,T))}var me=0;for(H=0;H<U.length;H+=3){var _e=U[H]*T,Ae=U[H+1]*T,ge=U[H+2]*T;me+=Math.abs((O[_e]-O[ge])*(O[Ae+1]-O[_e+1])-(O[_e]-O[Ae])*(O[ge+1]-O[_e+1]))}return G===0&&me===0?0:Math.abs((me-G)/G)};function X(O,D,T,U){for(var N=0,Y=D,G=T-U;Y<T;Y+=U)N+=(O[G]-O[Y])*(O[Y+1]+O[G+1]),G=Y;return N}return n.flatten=function(O){for(var D=O[0][0].length,T={vertices:[],holes:[],dimensions:D},U=0,N=0;N<O.length;N++){for(var Y=0;Y<O[N].length;Y++)for(var G=0;G<D;G++)T.vertices.push(O[N][Y][G]);N>0&&(U+=O[N-1].length,T.holes.push(U))}return T},Gl.exports}var IT=CT();const RT=ex(IT);var Gr={},Vo={exports:{}};/*! https://mths.be/punycode v1.4.1 by @mathias */var PT=Vo.exports,mg;function kT(){return mg||(mg=1,(function(n,e){(function(t){var i=e&&!e.nodeType&&e,s=n&&!n.nodeType&&n,r=typeof Wc=="object"&&Wc;(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="-",v=/^xn--/,y=/[^\x20-\x7E]/,b=/[\x2E\u3002\uFF0E\uFF61]/g,g={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},w=h-l,E=Math.floor,M=String.fromCharCode,_;function I(N){throw new RangeError(g[N])}function R(N,Y){for(var G=N.length,H=[];G--;)H[G]=Y(N[G]);return H}function F(N,Y){var G=N.split("@"),H="";G.length>1&&(H=G[0]+"@",N=G[1]),N=N.replace(b,".");var ne=N.split("."),Z=R(ne,Y).join(".");return H+Z}function P(N){for(var Y=[],G=0,H=N.length,ne,Z;G<H;)ne=N.charCodeAt(G++),ne>=55296&&ne<=56319&&G<H?(Z=N.charCodeAt(G++),(Z&64512)==56320?Y.push(((ne&1023)<<10)+(Z&1023)+65536):(Y.push(ne),G--)):Y.push(ne);return Y}function k(N){return R(N,function(Y){var G="";return Y>65535&&(Y-=65536,G+=M(Y>>>10&1023|55296),Y=56320|Y&1023),G+=M(Y),G}).join("")}function B(N){return N-48<10?N-22:N-65<26?N-65:N-97<26?N-97:h}function L(N,Y){return N+22+75*(N<26)-((Y!=0)<<5)}function X(N,Y,G){var H=0;for(N=G?E(N/d):N>>1,N+=E(N/Y);N>w*c>>1;H+=h)N=E(N/w);return E(H+(w+1)*N/(N+u))}function O(N){var Y=[],G=N.length,H,ne=0,Z=p,de=f,me,_e,Ae,ge,Ee,j,K,q,W;for(me=N.lastIndexOf(m),me<0&&(me=0),_e=0;_e<me;++_e)N.charCodeAt(_e)>=128&&I("not-basic"),Y.push(N.charCodeAt(_e));for(Ae=me>0?me+1:0;Ae<G;){for(ge=ne,Ee=1,j=h;Ae>=G&&I("invalid-input"),K=B(N.charCodeAt(Ae++)),(K>=h||K>E((o-ne)/Ee))&&I("overflow"),ne+=K*Ee,q=j<=de?l:j>=de+c?c:j-de,!(K<q);j+=h)W=h-q,Ee>E(o/W)&&I("overflow"),Ee*=W;H=Y.length+1,de=X(ne-ge,H,ge==0),E(ne/H)>o-Z&&I("overflow"),Z+=E(ne/H),ne%=H,Y.splice(ne++,0,Z)}return k(Y)}function D(N){var Y,G,H,ne,Z,de,me,_e,Ae,ge,Ee,j=[],K,q,W,Q;for(N=P(N),K=N.length,Y=p,G=0,Z=f,de=0;de<K;++de)Ee=N[de],Ee<128&&j.push(M(Ee));for(H=ne=j.length,ne&&j.push(m);H<K;){for(me=o,de=0;de<K;++de)Ee=N[de],Ee>=Y&&Ee<me&&(me=Ee);for(q=H+1,me-Y>E((o-G)/q)&&I("overflow"),G+=(me-Y)*q,Y=me,de=0;de<K;++de)if(Ee=N[de],Ee<Y&&++G>o&&I("overflow"),Ee==Y){for(_e=G,Ae=h;ge=Ae<=Z?l:Ae>=Z+c?c:Ae-Z,!(_e<ge);Ae+=h)Q=_e-ge,W=h-ge,j.push(M(L(ge+Q%W,0))),_e=E(Q/W);j.push(M(L(_e,0))),Z=X(G,q,H==ne),G=0,++H}++G,++Y}return j.join("")}function T(N){return F(N,function(Y){return v.test(Y)?O(Y.slice(4).toLowerCase()):Y})}function U(N){return F(N,function(Y){return y.test(Y)?"xn--"+D(Y):Y})}if(a={version:"1.4.1",ucs2:{decode:P,encode:k},decode:O,encode:D,toASCII:U,toUnicode:T},i&&s)if(n.exports==i)s.exports=a;else for(_ in a)a.hasOwnProperty(_)&&(i[_]=a[_]);else t.punycode=a})(PT)})(Vo,Vo.exports)),Vo.exports}var Tu,pg;function _o(){return pg||(pg=1,Tu=TypeError),Tu}const FT={},OT=Object.freeze(Object.defineProperty({__proto__:null,default:FT},Symbol.toStringTag,{value:"Module"})),BT=MT(OT);var Mu,gg;function jh(){if(gg)return Mu;gg=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,v=Function.prototype.toString,y=String.prototype.match,b=String.prototype.slice,g=String.prototype.replace,w=String.prototype.toUpperCase,E=String.prototype.toLowerCase,M=RegExp.prototype.test,_=Array.prototype.concat,I=Array.prototype.join,R=Array.prototype.slice,F=Math.floor,P=typeof BigInt=="function"?BigInt.prototype.valueOf:null,k=Object.getOwnPropertySymbols,B=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,L=typeof Symbol=="function"&&typeof Symbol.iterator=="object",X=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(oe){return oe.__proto__}:null);function T(oe,fe){if(oe===1/0||oe===-1/0||oe!==oe||oe&&oe>-1e3&&oe<1e3||M.call(/e/,fe))return fe;var Et=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof oe=="number"){var $t=oe<0?-F(-oe):F(oe);if($t!==oe){var Gt=String($t),xt=b.call(fe,Gt.length+1);return g.call(Gt,Et,"$&_")+"."+g.call(g.call(xt,/([0-9]{3})/g,"$&_"),/_$/,"")}}return g.call(fe,Et,"$&_")}var U=BT,N=U.custom,Y=q(N)?N:null,G={__proto__:null,double:'"',single:"'"},H={__proto__:null,double:/(["\\])/g,single:/(['\\])/g};Mu=function oe(fe,Et,$t,Gt){var xt=Et||{};if(le(xt,"quoteStyle")&&!le(G,xt.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(le(xt,"maxStringLength")&&(typeof xt.maxStringLength=="number"?xt.maxStringLength<0&&xt.maxStringLength!==1/0:xt.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var bs=le(xt,"customInspect")?xt.customInspect:!0;if(typeof bs!="boolean"&&bs!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(le(xt,"indent")&&xt.indent!==null&&xt.indent!==" "&&!(parseInt(xt.indent,10)===xt.indent&&xt.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(le(xt,"numericSeparator")&&typeof xt.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var Rs=xt.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 It(fe,xt);if(typeof fe=="number"){if(fe===0)return 1/0/fe>0?"0":"-0";var Ri=String(fe);return Rs?T(fe,Ri):Ri}if(typeof fe=="bigint"){var us=String(fe)+"n";return Rs?T(fe,us):us}var ws=typeof xt.depth>"u"?5:xt.depth;if(typeof $t>"u"&&($t=0),$t>=ws&&ws>0&&typeof fe=="object")return me(fe)?"[Array]":"[Object]";var ss=Is(xt,$t);if(typeof Gt>"u")Gt=[];else if(we(Gt,fe)>=0)return"[Circular]";function Bi(Ie,ye,Oe){if(ye&&(Gt=R.call(Gt),Gt.push(ye)),Oe){var pe={depth:xt.depth};return le(xt,"quoteStyle")&&(pe.quoteStyle=xt.quoteStyle),oe(Ie,pe,$t+1,Gt)}return oe(Ie,xt,$t+1,Gt)}if(typeof fe=="function"&&!Ae(fe)){var Ea=ae(fe),Aa=Vt(fe,Bi);return"[Function"+(Ea?": "+Ea:" (anonymous)")+"]"+(Aa.length>0?" { "+I.call(Aa,", ")+" }":"")}if(q(fe)){var Ur=L?g.call(String(fe),/^(Symbol\(.*\))_[^)]*$/,"$1"):B.call(fe);return typeof fe=="object"&&!L?Mt(Ur):Ur}if(dt(fe)){for(var Ks="<"+E.call(String(fe.nodeName)),Zs=fe.attributes||[],Rn=0;Rn<Zs.length;Rn++)Ks+=" "+Zs[Rn].name+"="+ne(Z(Zs[Rn].value),"double",xt);return Ks+=">",fe.childNodes&&fe.childNodes.length&&(Ks+="..."),Ks+="</"+E.call(String(fe.nodeName))+">",Ks}if(me(fe)){if(fe.length===0)return"[]";var Xr=Vt(fe,Bi);return ss&&!Ii(Xr)?"["+qs(Xr,ss)+"]":"[ "+I.call(Xr,", ")+" ]"}if(ge(fe)){var cr=Vt(fe,Bi);return!("cause"in Error.prototype)&&"cause"in fe&&!O.call(fe,"cause")?"{ ["+String(fe)+"] "+I.call(_.call("[cause]: "+Bi(fe.cause),cr),", ")+" }":cr.length===0?"["+String(fe)+"]":"{ ["+String(fe)+"] "+I.call(cr,", ")+" }"}if(typeof fe=="object"&&bs){if(Y&&typeof fe[Y]=="function"&&U)return U(fe,{depth:ws-$t});if(bs!=="symbol"&&typeof fe.inspect=="function")return fe.inspect()}if(ce(fe)){var Pn=[];return i&&i.call(fe,function(Ie,ye){Pn.push(Bi(ye,fe,!0)+" => "+Bi(Ie,fe))}),Oi("Map",t.call(fe),Pn,ss)}if(Fe(fe)){var z=[];return o&&o.call(fe,function(Ie){z.push(Bi(Ie,fe))}),Oi("Set",a.call(fe),z,ss)}if(Ue(fe))return zt("WeakMap");if(it(fe))return zt("WeakSet");if(Re(fe))return zt("WeakRef");if(j(fe))return Mt(Bi(Number(fe)));if(W(fe))return Mt(Bi(P.call(fe)));if(K(fe))return Mt(p.call(fe));if(Ee(fe))return Mt(Bi(String(fe)));if(typeof window<"u"&&fe===window)return"{ [object Window] }";if(typeof globalThis<"u"&&fe===globalThis||typeof Wc<"u"&&fe===Wc)return"{ [object globalThis] }";if(!_e(fe)&&!Ae(fe)){var V=Vt(fe,Bi),J=D?D(fe)===Object.prototype:fe instanceof Object||fe.constructor===Object,ie=fe instanceof Object?"":"null prototype",ue=!J&&X&&Object(fe)===fe&&X in fe?b.call(xe(fe),8,-1):ie?"Object":"",ve=J||typeof fe.constructor!="function"?"":fe.constructor.name?fe.constructor.name+" ":"",Me=ve+(ue||ie?"["+I.call(_.call([],ue||[],ie||[]),": ")+"] ":"");return V.length===0?Me+"{}":ss?Me+"{"+qs(V,ss)+"}":Me+"{ "+I.call(V,", ")+" }"}return String(fe)};function ne(oe,fe,Et){var $t=Et.quoteStyle||fe,Gt=G[$t];return Gt+oe+Gt}function Z(oe){return g.call(String(oe),/"/g,""")}function de(oe){return!X||!(typeof oe=="object"&&(X in oe||typeof oe[X]<"u"))}function me(oe){return xe(oe)==="[object Array]"&&de(oe)}function _e(oe){return xe(oe)==="[object Date]"&&de(oe)}function Ae(oe){return xe(oe)==="[object RegExp]"&&de(oe)}function ge(oe){return xe(oe)==="[object Error]"&&de(oe)}function Ee(oe){return xe(oe)==="[object String]"&&de(oe)}function j(oe){return xe(oe)==="[object Number]"&&de(oe)}function K(oe){return xe(oe)==="[object Boolean]"&&de(oe)}function q(oe){if(L)return oe&&typeof oe=="object"&&oe instanceof Symbol;if(typeof oe=="symbol")return!0;if(!oe||typeof oe!="object"||!B)return!1;try{return B.call(oe),!0}catch{}return!1}function W(oe){if(!oe||typeof oe!="object"||!P)return!1;try{return P.call(oe),!0}catch{}return!1}var Q=Object.prototype.hasOwnProperty||function(oe){return oe in this};function le(oe,fe){return Q.call(oe,fe)}function xe(oe){return m.call(oe)}function ae(oe){if(oe.name)return oe.name;var fe=y.call(v.call(oe),/^function\s*([\w$]+)/);return fe?fe[1]:null}function we(oe,fe){if(oe.indexOf)return oe.indexOf(fe);for(var Et=0,$t=oe.length;Et<$t;Et++)if(oe[Et]===fe)return Et;return-1}function ce(oe){if(!t||!oe||typeof oe!="object")return!1;try{t.call(oe);try{a.call(oe)}catch{return!0}return oe instanceof Map}catch{}return!1}function Ue(oe){if(!l||!oe||typeof oe!="object")return!1;try{l.call(oe,l);try{u.call(oe,u)}catch{return!0}return oe instanceof WeakMap}catch{}return!1}function Re(oe){if(!f||!oe||typeof oe!="object")return!1;try{return f.call(oe),!0}catch{}return!1}function Fe(oe){if(!a||!oe||typeof oe!="object")return!1;try{a.call(oe);try{t.call(oe)}catch{return!0}return oe instanceof Set}catch{}return!1}function it(oe){if(!u||!oe||typeof oe!="object")return!1;try{u.call(oe,u);try{l.call(oe,l)}catch{return!0}return oe instanceof WeakSet}catch{}return!1}function dt(oe){return!oe||typeof oe!="object"?!1:typeof HTMLElement<"u"&&oe instanceof HTMLElement?!0:typeof oe.nodeName=="string"&&typeof oe.getAttribute=="function"}function It(oe,fe){if(oe.length>fe.maxStringLength){var Et=oe.length-fe.maxStringLength,$t="... "+Et+" more character"+(Et>1?"s":"");return It(b.call(oe,0,fe.maxStringLength),fe)+$t}var Gt=H[fe.quoteStyle||"single"];Gt.lastIndex=0;var xt=g.call(g.call(oe,Gt,"\\$1"),/[\x00-\x1f]/g,yt);return ne(xt,"single",fe)}function yt(oe){var fe=oe.charCodeAt(0),Et={8:"b",9:"t",10:"n",12:"f",13:"r"}[fe];return Et?"\\"+Et:"\\x"+(fe<16?"0":"")+w.call(fe.toString(16))}function Mt(oe){return"Object("+oe+")"}function zt(oe){return oe+" { ? }"}function Oi(oe,fe,Et,$t){var Gt=$t?qs(Et,$t):I.call(Et,", ");return oe+" ("+fe+") {"+Gt+"}"}function Ii(oe){for(var fe=0;fe<oe.length;fe++)if(we(oe[fe],`
|
||
`)>=0)return!1;return!0}function Is(oe,fe){var Et;if(oe.indent===" ")Et=" ";else if(typeof oe.indent=="number"&&oe.indent>0)Et=I.call(Array(oe.indent+1)," ");else return null;return{base:Et,prev:I.call(Array(fe+1),Et)}}function qs(oe,fe){if(oe.length===0)return"";var Et=`
|
||
`+fe.prev+fe.base;return Et+I.call(oe,","+Et)+`
|
||
`+fe.prev}function Vt(oe,fe){var Et=me(oe),$t=[];if(Et){$t.length=oe.length;for(var Gt=0;Gt<oe.length;Gt++)$t[Gt]=le(oe,Gt)?fe(oe[Gt],oe):""}var xt=typeof k=="function"?k(oe):[],bs;if(L){bs={};for(var Rs=0;Rs<xt.length;Rs++)bs["$"+xt[Rs]]=xt[Rs]}for(var Ri in oe)le(oe,Ri)&&(Et&&String(Number(Ri))===Ri&&Ri<oe.length||L&&bs["$"+Ri]instanceof Symbol||(M.call(/[^\w$]/,Ri)?$t.push(fe(Ri,oe)+": "+fe(oe[Ri],oe)):$t.push(Ri+": "+fe(oe[Ri],oe))));if(typeof k=="function")for(var us=0;us<xt.length;us++)O.call(oe,xt[us])&&$t.push("["+fe(xt[us])+"]: "+fe(oe[xt[us]],oe));return $t}return Mu}var Eu,vg;function LT(){if(vg)return Eu;vg=1;var n=jh(),e=_o(),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 Eu=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},Eu}var Au,yg;function tx(){return yg||(yg=1,Au=Object),Au}var Cu,xg;function DT(){return xg||(xg=1,Cu=Error),Cu}var Iu,bg;function NT(){return bg||(bg=1,Iu=EvalError),Iu}var Ru,wg;function UT(){return wg||(wg=1,Ru=RangeError),Ru}var Pu,Sg;function XT(){return Sg||(Sg=1,Pu=ReferenceError),Pu}var ku,_g;function YT(){return _g||(_g=1,ku=SyntaxError),ku}var Fu,Tg;function VT(){return Tg||(Tg=1,Fu=URIError),Fu}var Ou,Mg;function $T(){return Mg||(Mg=1,Ou=Math.abs),Ou}var Bu,Eg;function GT(){return Eg||(Eg=1,Bu=Math.floor),Bu}var Lu,Ag;function jT(){return Ag||(Ag=1,Lu=Math.max),Lu}var Du,Cg;function HT(){return Cg||(Cg=1,Du=Math.min),Du}var Nu,Ig;function WT(){return Ig||(Ig=1,Nu=Math.pow),Nu}var Uu,Rg;function zT(){return Rg||(Rg=1,Uu=Math.round),Uu}var Xu,Pg;function qT(){return Pg||(Pg=1,Xu=Number.isNaN||function(e){return e!==e}),Xu}var Yu,kg;function KT(){if(kg)return Yu;kg=1;var n=qT();return Yu=function(t){return n(t)||t===0?t:t<0?-1:1},Yu}var Vu,Fg;function ZT(){return Fg||(Fg=1,Vu=Object.getOwnPropertyDescriptor),Vu}var $u,Og;function ix(){if(Og)return $u;Og=1;var n=ZT();if(n)try{n([],"length")}catch{n=null}return $u=n,$u}var Gu,Bg;function sx(){if(Bg)return Gu;Bg=1;var n=Object.defineProperty||!1;if(n)try{n({},"a",{value:1})}catch{n=!1}return Gu=n,Gu}var ju,Lg;function JT(){return Lg||(Lg=1,ju=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}),ju}var Hu,Dg;function QT(){if(Dg)return Hu;Dg=1;var n=typeof Symbol<"u"&&Symbol,e=JT();return Hu=function(){return typeof n!="function"||typeof Symbol!="function"||typeof n("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:e()},Hu}var Wu,Ng;function nx(){return Ng||(Ng=1,Wu=typeof Reflect<"u"&&Reflect.getPrototypeOf||null),Wu}var zu,Ug;function rx(){if(Ug)return zu;Ug=1;var n=tx();return zu=n.getPrototypeOf||null,zu}var qu,Xg;function eM(){if(Xg)return qu;Xg=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 qu=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 v=function(){};v.prototype=l.prototype,u.prototype=new v,v.prototype=null}return u},qu}var Ku,Yg;function Hh(){if(Yg)return Ku;Yg=1;var n=eM();return Ku=Function.prototype.bind||n,Ku}var Zu,Vg;function $m(){return Vg||(Vg=1,Zu=Function.prototype.call),Zu}var Ju,$g;function ax(){return $g||($g=1,Ju=Function.prototype.apply),Ju}var Qu,Gg;function tM(){return Gg||(Gg=1,Qu=typeof Reflect<"u"&&Reflect&&Reflect.apply),Qu}var ed,jg;function iM(){if(jg)return ed;jg=1;var n=Hh(),e=ax(),t=$m(),i=tM();return ed=i||n.call(t,e),ed}var td,Hg;function ox(){if(Hg)return td;Hg=1;var n=Hh(),e=_o(),t=$m(),i=iM();return td=function(r){if(r.length<1||typeof r[0]!="function")throw new e("a function is required");return i(n,t,r)},td}var id,Wg;function sM(){if(Wg)return id;Wg=1;var n=ox(),e=ix(),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 id=i&&typeof i.get=="function"?n([i.get]):typeof r=="function"?function(o){return r(o==null?o:s(o))}:!1,id}var sd,zg;function nM(){if(zg)return sd;zg=1;var n=nx(),e=rx(),t=sM();return sd=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,sd}var nd,qg;function rM(){if(qg)return nd;qg=1;var n=Function.prototype.call,e=Object.prototype.hasOwnProperty,t=Hh();return nd=t.call(n,e),nd}var rd,Kg;function Gm(){if(Kg)return rd;Kg=1;var n,e=tx(),t=DT(),i=NT(),s=UT(),r=XT(),a=YT(),o=_o(),h=VT(),l=$T(),c=GT(),u=jT(),d=HT(),f=WT(),p=zT(),m=KT(),v=Function,y=function(Ae){try{return v('"use strict"; return ('+Ae+").constructor;")()}catch{}},b=ix(),g=sx(),w=function(){throw new o},E=b?(function(){try{return arguments.callee,w}catch{try{return b(arguments,"callee").get}catch{return w}}})():w,M=QT()(),_=nM(),I=rx(),R=nx(),F=ax(),P=$m(),k={},B=typeof Uint8Array>"u"||!_?n:_(Uint8Array),L={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?n:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?n:ArrayBuffer,"%ArrayIteratorPrototype%":M&&_?_([][Symbol.iterator]()):n,"%AsyncFromSyncIteratorPrototype%":n,"%AsyncFunction%":k,"%AsyncGenerator%":k,"%AsyncGeneratorFunction%":k,"%AsyncIteratorPrototype%":k,"%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%":v,"%GeneratorFunction%":k,"%Int8Array%":typeof Int8Array>"u"?n:Int8Array,"%Int16Array%":typeof Int16Array>"u"?n:Int16Array,"%Int32Array%":typeof Int32Array>"u"?n:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":M&&_?_(_([][Symbol.iterator]())):n,"%JSON%":typeof JSON=="object"?JSON:n,"%Map%":typeof Map>"u"?n:Map,"%MapIteratorPrototype%":typeof Map>"u"||!M||!_?n:_(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":e,"%Object.getOwnPropertyDescriptor%":b,"%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||!_?n:_(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?n:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":M&&_?_(""[Symbol.iterator]()):n,"%Symbol%":M?Symbol:n,"%SyntaxError%":a,"%ThrowTypeError%":E,"%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%":P,"%Function.prototype.apply%":F,"%Object.defineProperty%":g,"%Object.getPrototypeOf%":I,"%Math.abs%":l,"%Math.floor%":c,"%Math.max%":u,"%Math.min%":d,"%Math.pow%":f,"%Math.round%":p,"%Math.sign%":m,"%Reflect.getPrototypeOf%":R};if(_)try{null.error}catch(Ae){var X=_(_(Ae));L["%Error.prototype%"]=X}var O=function Ae(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 j=Ae("%AsyncGeneratorFunction%");j&&(Ee=j.prototype)}else if(ge==="%AsyncIteratorPrototype%"){var K=Ae("%AsyncGenerator%");K&&_&&(Ee=_(K.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"]},T=Hh(),U=rM(),N=T.call(P,Array.prototype.concat),Y=T.call(F,Array.prototype.splice),G=T.call(P,String.prototype.replace),H=T.call(P,String.prototype.slice),ne=T.call(P,RegExp.prototype.exec),Z=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,de=/\\(\\)?/g,me=function(ge){var Ee=H(ge,0,1),j=H(ge,-1);if(Ee==="%"&&j!=="%")throw new a("invalid intrinsic syntax, expected closing `%`");if(j==="%"&&Ee!=="%")throw new a("invalid intrinsic syntax, expected opening `%`");var K=[];return G(ge,Z,function(q,W,Q,le){K[K.length]=Q?G(le,de,"$1"):W||q}),K},_e=function(ge,Ee){var j=ge,K;if(U(D,j)&&(K=D[j],j="%"+K[0]+"%"),U(L,j)){var q=L[j];if(q===k&&(q=O(j)),typeof q>"u"&&!Ee)throw new o("intrinsic "+ge+" exists, but is not available. Please file an issue!");return{alias:K,name:j,value:q}}throw new a("intrinsic "+ge+" does not exist!")};return rd=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(ne(/^%?[^%]*%?$/,ge)===null)throw new a("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var j=me(ge),K=j.length>0?j[0]:"",q=_e("%"+K+"%",Ee),W=q.name,Q=q.value,le=!1,xe=q.alias;xe&&(K=xe[0],Y(j,N([0,1],xe)));for(var ae=1,we=!0;ae<j.length;ae+=1){var ce=j[ae],Ue=H(ce,0,1),Re=H(ce,-1);if((Ue==='"'||Ue==="'"||Ue==="`"||Re==='"'||Re==="'"||Re==="`")&&Ue!==Re)throw new a("property names with quotes must have matching quotes");if((ce==="constructor"||!we)&&(le=!0),K+="."+ce,W="%"+K+"%",U(L,W))Q=L[W];else if(Q!=null){if(!(ce in Q)){if(!Ee)throw new o("base intrinsic for "+ge+" exists, but the property is not available.");return}if(b&&ae+1>=j.length){var Fe=b(Q,ce);we=!!Fe,we&&"get"in Fe&&!("originalValue"in Fe.get)?Q=Fe.get:Q=Q[ce]}else we=U(Q,ce),Q=Q[ce];we&&!le&&(L[W]=Q)}}return Q},rd}var ad,Zg;function lx(){if(Zg)return ad;Zg=1;var n=Gm(),e=ox(),t=e([n("%String.prototype.indexOf%")]);return ad=function(s,r){var a=n(s,!!r);return typeof a=="function"&&t(s,".prototype.")>-1?e([a]):a},ad}var od,Jg;function cx(){if(Jg)return od;Jg=1;var n=Gm(),e=lx(),t=jh(),i=_o(),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 od=!!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},od}var ld,Qg;function aM(){if(Qg)return ld;Qg=1;var n=Gm(),e=lx(),t=jh(),i=cx(),s=_o(),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 ld=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,ld}var cd,e0;function hx(){if(e0)return cd;e0=1;var n=_o(),e=jh(),t=LT(),i=cx(),s=aM(),r=s||i||t;return cd=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},cd}var hd,t0;function jm(){if(t0)return hd;t0=1;var n=String.prototype.replace,e=/%20/g,t={RFC1738:"RFC1738",RFC3986:"RFC3986"};return hd={default:t.RFC3986,formatters:{RFC1738:function(i){return n.call(i,e,"+")},RFC3986:function(i){return String(i)}},RFC1738:t.RFC1738,RFC3986:t.RFC3986},hd}var ud,i0;function ux(){if(i0)return ud;i0=1;var n=jm(),e=hx(),t=sx(),i=Object.prototype.hasOwnProperty,s=Array.isArray,r=e(),a=function(R,F){return r.set(R,F),R},o=function(R){return r.has(R)},h=function(R){return r.get(R)},l=function(R,F){r.set(R,F)},c=(function(){for(var I=[],R=0;R<256;++R)I[I.length]="%"+((R<16?"0":"")+R.toString(16)).toUpperCase();return I})(),u=function(R){for(;R.length>1;){var F=R.pop(),P=F.obj[F.prop];if(s(P)){for(var k=[],B=0;B<P.length;++B)typeof P[B]<"u"&&(k[k.length]=P[B]);F.obj[F.prop]=k}}},d=function(R,F){for(var P=F&&F.plainObjects?{__proto__:null}:{},k=0;k<R.length;++k)typeof R[k]<"u"&&(P[k]=R[k]);return P},f=function(R,F,P){F==="__proto__"&&t?t(R,F,{configurable:!0,enumerable:!0,value:P,writable:!0}):R[F]=P},p=function I(R,F,P){if(!F)return R;if(typeof F!="object"&&typeof F!="function"){if(s(R)){var k=R.length;if(P&&typeof P.arrayLimit=="number"&&k>=P.arrayLimit){if(P.throwOnLimitExceeded)throw new RangeError("Array limit exceeded. Only "+P.arrayLimit+" element"+(P.arrayLimit===1?"":"s")+" allowed in an array.");return a(d(R.concat(F),P),k)}R[k]=F}else if(R&&typeof R=="object")if(o(R)){var B=h(R)+1;R[B]=F,l(R,B)}else{if(P&&P.strictMerge)return[R,F];(P&&(P.plainObjects||P.allowPrototypes)||!i.call(Object.prototype,F))&&(R[F]=!0)}else return[R,F];return R}if(!R||typeof R!="object"){if(o(F)){for(var L=Object.keys(F),X=P&&P.plainObjects?{__proto__:null,0:R}:{0:R},O=0;O<L.length;O++){var D=parseInt(L[O],10);X[D+1]=F[L[O]]}return a(X,h(F)+1)}var T=[R].concat(F);if(P&&typeof P.arrayLimit=="number"&&T.length>P.arrayLimit){if(P.throwOnLimitExceeded)throw new RangeError("Array limit exceeded. Only "+P.arrayLimit+" element"+(P.arrayLimit===1?"":"s")+" allowed in an array.");return a(d(T,P),T.length-1)}return T}var U=R;if(s(R)&&!s(F)&&(U=d(R,P)),s(R)&&s(F)){if(F.forEach(function(N,Y){if(i.call(R,Y)){var G=R[Y];G&&typeof G=="object"&&N&&typeof N=="object"?R[Y]=I(G,N,P):R[R.length]=N}else R[Y]=N}),P&&typeof P.arrayLimit=="number"&&R.length>P.arrayLimit){if(P.throwOnLimitExceeded)throw new RangeError("Array limit exceeded. Only "+P.arrayLimit+" element"+(P.arrayLimit===1?"":"s")+" allowed in an array.");return a(d(R,P),R.length-1)}return R}return Object.keys(F).reduce(function(N,Y){var G=F[Y];if(i.call(N,Y)?f(N,Y,I(N[Y],G,P)):f(N,Y,G),o(F)&&!o(N)&&a(N,h(F)),o(N)){var H=parseInt(Y,10);String(H)===Y&&H>=0&&H>h(N)&&l(N,H)}return N},U)},m=function(R,F){return Object.keys(F).reduce(function(P,k){return f(P,k,F[k]),P},R)},v=function(I,R,F){var P=I.replace(/\+/g," ");if(F==="iso-8859-1")return P.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(P)}catch{return P}},y=1024,b=function(R,F,P,k,B){if(R.length===0)return R;var L=R;if(typeof R=="symbol"?L=Symbol.prototype.toString.call(R):typeof R!="string"&&(L=String(R)),P==="iso-8859-1")return escape(L).replace(/%u[0-9a-f]{4}/gi,function(G){return"%26%23"+parseInt(G.slice(2),16)+"%3B"});for(var X="",O=0;O<L.length;O+=y){var D=L.length>=y?L.slice(O,O+y):L;if(O+y<L.length){var T=D.charCodeAt(D.length-1);T>=55296&&T<=56319&&(D=D.slice(0,-1),O-=1)}for(var U=[],N=0;N<D.length;++N){var Y=D.charCodeAt(N);if(Y===45||Y===46||Y===95||Y===126||Y>=48&&Y<=57||Y>=65&&Y<=90||Y>=97&&Y<=122||B===n.RFC1738&&(Y===40||Y===41)){U[U.length]=D.charAt(N);continue}if(Y<128){U[U.length]=c[Y];continue}if(Y<2048){U[U.length]=c[192|Y>>6]+c[128|Y&63];continue}if(Y<55296||Y>=57344){U[U.length]=c[224|Y>>12]+c[128|Y>>6&63]+c[128|Y&63];continue}N+=1,Y=65536+((Y&1023)<<10|D.charCodeAt(N)&1023),U[U.length]=c[240|Y>>18]+c[128|Y>>12&63]+c[128|Y>>6&63]+c[128|Y&63]}X+=U.join("")}return X},g=function(R){for(var F=[{obj:{o:R},prop:"o"}],P=e(),k=0;k<F.length;++k)for(var B=F[k],L=B.obj[B.prop],X=Object.keys(L),O=0;O<X.length;++O){var D=X[O],T=L[D];typeof T=="object"&&T!==null&&!P.has(T)&&(F[F.length]={obj:L,prop:D},P.set(T,!0))}return u(F),R},w=function(R){return Object.prototype.toString.call(R)==="[object RegExp]"},E=function(R){return!R||typeof R!="object"?!1:!!(R.constructor&&R.constructor.isBuffer&&R.constructor.isBuffer(R))},M=function(R,F,P,k,B){if(o(R)){if(B)throw new RangeError("Array limit exceeded. Only "+P+" element"+(P===1?"":"s")+" allowed in an array.");var L=h(R)+1;return R[L]=F,l(R,L),R}var X=[].concat(R,F);if(X.length>P){if(B)throw new RangeError("Array limit exceeded. Only "+P+" element"+(P===1?"":"s")+" allowed in an array.");return a(d(X,{plainObjects:k}),X.length-1)}return X},_=function(R,F){if(s(R)){for(var P=[],k=0;k<R.length;k+=1)P[P.length]=F(R[k]);return P}return F(R)};return ud={arrayToObject:d,assign:m,combine:M,compact:g,decode:v,encode:b,isBuffer:E,isOverflow:o,isRegExp:w,markOverflow:a,maybeMap:_,merge:p},ud}var dd,s0;function oM(){if(s0)return dd;s0=1;var n=hx(),e=ux(),t=jm(),i=Object.prototype.hasOwnProperty,s={brackets:function(v){return v+"[]"},comma:"comma",indices:function(v,y){return v+"["+y+"]"},repeat:function(v){return v}},r=Array.isArray,a=Array.prototype.push,o=function(m,v){a.apply(m,r(v)?v:[v])},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(v){return h.call(v)},skipNulls:!1,strictNullHandling:!1},u=function(v){return typeof v=="string"||typeof v=="number"||typeof v=="boolean"||typeof v=="symbol"||typeof v=="bigint"},d={},f=function m(v,y,b,g,w,E,M,_,I,R,F,P,k,B,L,X,O,D){for(var T=v,U=D,N=0,Y=!1;(U=U.get(d))!==void 0&&!Y;){var G=U.get(v);if(N+=1,typeof G<"u"){if(G===N)throw new RangeError("Cyclic object value");Y=!0}typeof U.get(d)>"u"&&(N=0)}if(typeof R=="function"?T=R(y,T):T instanceof Date?T=k(T):b==="comma"&&r(T)&&(T=e.maybeMap(T,function(W){return W instanceof Date?k(W):W})),T===null){if(E)return L(I&&!X?I(y,c.encoder,O,"key",B):y);T=""}if(u(T)||e.isBuffer(T)){if(I){var H=X?y:I(y,c.encoder,O,"key",B);return[L(H)+"="+L(I(T,c.encoder,O,"value",B))]}return[L(y)+"="+L(String(T))]}var ne=[];if(typeof T>"u")return ne;var Z;if(b==="comma"&&r(T))X&&I&&(T=e.maybeMap(T,function(W){return W==null?W:I(W)})),Z=[{value:T.length>0?T.join(",")||null:void 0}];else if(r(R))Z=R;else{var de=Object.keys(T);Z=F?de.sort(F):de}var me=_?String(y).replace(/\./g,"%2E"):String(y),_e=g&&r(T)&&T.length===1?me+"[]":me;if(w&&r(T)&&T.length===0)return _e+"[]";for(var Ae=0;Ae<Z.length;++Ae){var ge=Z[Ae],Ee=typeof ge=="object"&&ge&&typeof ge.value<"u"?ge.value:T[ge];if(!(M&&Ee===null)){var j=P&&_?String(ge).replace(/\./g,"%2E"):String(ge),K=r(T)?typeof b=="function"?b(_e,j):_e:_e+(P?"."+j:"["+j+"]");D.set(v,N);var q=n();q.set(d,D),o(ne,m(Ee,K,b,g,w,E,M,_,b==="comma"&&X&&r(T)?null:I,R,F,P,k,B,L,X,O,q))}}return ne},p=function(v){if(!v)return c;if(typeof v.allowEmptyArrays<"u"&&typeof v.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof v.encodeDotInKeys<"u"&&typeof v.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(v.encoder!==null&&typeof v.encoder<"u"&&typeof v.encoder!="function")throw new TypeError("Encoder has to be a function.");var y=v.charset||c.charset;if(typeof v.charset<"u"&&v.charset!=="utf-8"&&v.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var b=t.default;if(typeof v.format<"u"){if(!i.call(t.formatters,v.format))throw new TypeError("Unknown format option provided.");b=v.format}var g=t.formatters[b],w=c.filter;(typeof v.filter=="function"||r(v.filter))&&(w=v.filter);var E;if(v.arrayFormat in s?E=v.arrayFormat:"indices"in v?E=v.indices?"indices":"repeat":E=c.arrayFormat,"commaRoundTrip"in v&&typeof v.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var M=typeof v.allowDots>"u"?v.encodeDotInKeys===!0?!0:c.allowDots:!!v.allowDots;return{addQueryPrefix:typeof v.addQueryPrefix=="boolean"?v.addQueryPrefix:c.addQueryPrefix,allowDots:M,allowEmptyArrays:typeof v.allowEmptyArrays=="boolean"?!!v.allowEmptyArrays:c.allowEmptyArrays,arrayFormat:E,charset:y,charsetSentinel:typeof v.charsetSentinel=="boolean"?v.charsetSentinel:c.charsetSentinel,commaRoundTrip:!!v.commaRoundTrip,delimiter:typeof v.delimiter>"u"?c.delimiter:v.delimiter,encode:typeof v.encode=="boolean"?v.encode:c.encode,encodeDotInKeys:typeof v.encodeDotInKeys=="boolean"?v.encodeDotInKeys:c.encodeDotInKeys,encoder:typeof v.encoder=="function"?v.encoder:c.encoder,encodeValuesOnly:typeof v.encodeValuesOnly=="boolean"?v.encodeValuesOnly:c.encodeValuesOnly,filter:w,format:b,formatter:g,serializeDate:typeof v.serializeDate=="function"?v.serializeDate:c.serializeDate,skipNulls:typeof v.skipNulls=="boolean"?v.skipNulls:c.skipNulls,sort:typeof v.sort=="function"?v.sort:null,strictNullHandling:typeof v.strictNullHandling=="boolean"?v.strictNullHandling:c.strictNullHandling}};return dd=function(m,v){var y=m,b=p(v),g,w;typeof b.filter=="function"?(w=b.filter,y=w("",y)):r(b.filter)&&(w=b.filter,g=w);var E=[];if(typeof y!="object"||y===null)return"";var M=s[b.arrayFormat],_=M==="comma"&&b.commaRoundTrip;g||(g=Object.keys(y)),b.sort&&g.sort(b.sort);for(var I=n(),R=0;R<g.length;++R){var F=g[R];if(!(typeof F>"u"||F===null)){var P=y[F];b.skipNulls&&P===null||o(E,f(P,F,M,_,b.allowEmptyArrays,b.strictNullHandling,b.skipNulls,b.encodeDotInKeys,b.encode?b.encoder:null,b.filter,b.sort,b.allowDots,b.serializeDate,b.format,b.formatter,b.encodeValuesOnly,b.charset,I))}}var k=E.join(b.delimiter),B=b.addQueryPrefix===!0?"?":"";return b.charsetSentinel&&(b.charset==="iso-8859-1"?B+="utf8=%26%2310003%3B"+b.delimiter:B+="utf8=%E2%9C%93"+b.delimiter),k.length>0?B+k:""},dd}var fd,n0;function lM(){if(n0)return fd;n0=1;var n=ux(),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,v){if(f&&typeof f=="string"&&p.comma&&f.indexOf(",")>-1){if(v&&p.throwOnLimitExceeded)for(var y=0,b=f.indexOf(",");b>-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.");b=f.indexOf(",",b+1)}return f.split(",")}if(p.throwOnLimitExceeded&&m>=p.arrayLimit)throw new RangeError("Array limit exceeded. Only "+p.arrayLimit+" element"+(p.arrayLimit===1?"":"s")+" allowed in an array.");return f},a="utf8=%26%2310003%3B",o="utf8=%E2%9C%93",h=function(p,m){var v={__proto__:null},y=m.ignoreQueryPrefix?p.replace(/^\?/,""):p;y=y.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var b=m.parameterLimit===1/0?void 0:m.parameterLimit,g=y.split(m.delimiter,m.throwOnLimitExceeded&&typeof b<"u"?b+1:b);if(m.throwOnLimitExceeded&&typeof b<"u"&&g.length>b)throw new RangeError("Parameter limit exceeded. Only "+b+" parameter"+(b===1?"":"s")+" allowed.");var w=-1,E,M=m.charset;if(m.charsetSentinel)for(E=0;E<g.length;++E)g[E].indexOf("utf8=")===0&&(g[E]===o?M="utf-8":g[E]===a&&(M="iso-8859-1"),w=E,E=g.length);for(E=0;E<g.length;++E)if(E!==w){var _=g[E],I=_.indexOf("]="),R=I===-1?_.indexOf("="):I+1,F,P;if(R===-1?(F=m.decoder(_,i.decoder,M,"key"),P=m.strictNullHandling?null:""):(F=m.decoder(_.slice(0,R),i.decoder,M,"key"),F!==null&&(P=n.maybeMap(r(_.slice(R+1),m,t(v[F])?v[F].length:0,_.indexOf("[]=")===-1),function(B){return m.decoder(B,i.decoder,M,"value")}))),P&&m.interpretNumericEntities&&M==="iso-8859-1"&&(P=s(String(P))),_.indexOf("[]=")>-1&&(P=t(P)?[P]:P),m.comma&&t(P)&&P.length>m.arrayLimit&&(P=n.combine([],P,m.arrayLimit,m.plainObjects,m.throwOnLimitExceeded)),F!==null){var k=e.call(v,F);k&&(m.duplicates==="combine"||_.indexOf("[]=")>-1)?v[F]=n.combine(v[F],P,m.arrayLimit,m.plainObjects,m.throwOnLimitExceeded):(!k||m.duplicates==="last")&&(v[F]=P)}}return v},l=function(f,p,m,v){var y=0;if(f.length>0&&f[f.length-1]==="[]"){var b=f.slice(0,-1).join("");y=Array.isArray(p)&&p[b]?p[b].length:0}for(var g=v?p:r(p,m,y),w=f.length-1;w>=0;--w){var E,M=f[w];if(M==="[]"&&m.parseArrays)n.isOverflow(g)?E=g:E=m.allowEmptyArrays&&(g===""||m.strictNullHandling&&g===null)?[]:n.combine([],g,m.arrayLimit,m.plainObjects,m.throwOnLimitExceeded);else{E=m.plainObjects?{__proto__:null}:{};var _=M.charAt(0)==="["&&M.charAt(M.length-1)==="]"?M.slice(1,-1):M,I=m.decodeDotInKeys?_.replace(/%2E/g,"."):_,R=parseInt(I,10),F=!isNaN(R)&&M!==I&&String(R)===I&&R>=0&&m.parseArrays;if(!m.parseArrays&&I==="")E={0:g};else if(F&&R<m.arrayLimit)E=[],E[R]=g;else{if(F&&m.throwOnLimitExceeded)throw new RangeError("Array limit exceeded. Only "+m.arrayLimit+" element"+(m.arrayLimit===1?"":"s")+" allowed in an array.");F?(E[R]=g,n.markOverflow(E,R)):I!=="__proto__"&&(E[I]=g)}}g=E}return g},c=function(p,m){var v=m.allowDots?p.replace(/\.([^.[]+)/g,"[$1]"):p;if(m.depth<=0)return!m.plainObjects&&e.call(Object.prototype,v)&&!m.allowPrototypes?void 0:[v];var y=[],b=v.indexOf("["),g=b>=0?v.slice(0,b):v;if(g){if(!m.plainObjects&&e.call(Object.prototype,g)&&!m.allowPrototypes)return;y[y.length]=g}for(var w=v.length,E=b,M=0;E>=0&&M<m.depth;){for(var _=1,I=E+1,R=-1;I<w&&R<0;){var F=v.charCodeAt(I);F===91?_+=1:F===93&&(_-=1,_===0&&(R=I)),I+=1}if(R<0)return y[y.length]="["+v.slice(E)+"]",y;var P=v.slice(E,R+1),k=P.slice(1,-1);if(!m.plainObjects&&e.call(Object.prototype,k)&&!m.allowPrototypes)return;y[y.length]=P,M+=1,E=v.indexOf("[",R+1)}if(E>=0){if(m.strictDepth===!0)throw new RangeError("Input depth exceeded depth option of "+m.depth+" and strictDepth is true");y[y.length]="["+v.slice(E)+"]"}return y},u=function(p,m,v,y){if(p){var b=c(p,v);if(b)return l(b,m,v,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,v=typeof p.duplicates>"u"?i.duplicates:p.duplicates;if(v!=="combine"&&v!=="first"&&v!=="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:v,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 fd=function(f,p){var m=d(p);if(f===""||f===null||typeof f>"u")return m.plainObjects?{__proto__:null}:{};for(var v=typeof f=="string"?h(f,m):f,y=m.plainObjects?{__proto__:null}:{},b=Object.keys(v),g=0;g<b.length;++g){var w=b[g],E=u(w,v[w],m,typeof f=="string");y=n.merge(y,E,m)}return m.allowSparse===!0?y:n.compact(y)},fd}var md,r0;function cM(){if(r0)return md;r0=1;var n=oM(),e=lM(),t=jm();return md={formats:t,parse:e,stringify:n},md}var a0;function hM(){if(a0)return Gr;a0=1;var n=kT();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},v=cM();function y(E,M,_){if(E&&typeof E=="object"&&E instanceof e)return E;var I=new e;return I.parse(E,M,_),I}e.prototype.parse=function(E,M,_){if(typeof E!="string")throw new TypeError("Parameter 'url' must be a string, not "+typeof E);var I=E.indexOf("?"),R=I!==-1&&I<E.indexOf("#")?"?":"#",F=E.split(R),P=/\\/g;F[0]=F[0].replace(P,"/"),E=F.join(R);var k=E;if(k=k.trim(),!_&&E.split("#").length===1){var B=s.exec(k);if(B)return this.path=k,this.href=k,this.pathname=B[1],B[2]?(this.search=B[2],M?this.query=v.parse(this.search.substr(1)):this.query=this.search.substr(1)):M&&(this.search="",this.query={}),this}var L=t.exec(k);if(L){L=L[0];var X=L.toLowerCase();this.protocol=X,k=k.substr(L.length)}if(_||L||k.match(/^\/\/[^@/]+@[^@/]+/)){var O=k.substr(0,2)==="//";O&&!(L&&p[L])&&(k=k.substr(2),this.slashes=!0)}if(!p[L]&&(O||L&&!m[L])){for(var D=-1,T=0;T<l.length;T++){var U=k.indexOf(l[T]);U!==-1&&(D===-1||U<D)&&(D=U)}var N,Y;D===-1?Y=k.lastIndexOf("@"):Y=k.lastIndexOf("@",D),Y!==-1&&(N=k.slice(0,Y),k=k.slice(Y+1),this.auth=decodeURIComponent(N)),D=-1;for(var T=0;T<h.length;T++){var U=k.indexOf(h[T]);U!==-1&&(D===-1||U<D)&&(D=U)}D===-1&&(D=k.length),this.host=k.slice(0,D),k=k.slice(D),this.parseHost(),this.hostname=this.hostname||"";var G=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!G)for(var H=this.hostname.split(/\./),T=0,ne=H.length;T<ne;T++){var Z=H[T];if(Z&&!Z.match(u)){for(var de="",me=0,_e=Z.length;me<_e;me++)Z.charCodeAt(me)>127?de+="x":de+=Z[me];if(!de.match(u)){var Ae=H.slice(0,T),ge=H.slice(T+1),Ee=Z.match(d);Ee&&(Ae.push(Ee[1]),ge.unshift(Ee[2])),ge.length&&(k="/"+ge.join(".")+k),this.hostname=Ae.join(".");break}}}this.hostname.length>c?this.hostname="":this.hostname=this.hostname.toLowerCase(),G||(this.hostname=n.toASCII(this.hostname));var j=this.port?":"+this.port:"",K=this.hostname||"";this.host=K+j,this.href+=this.host,G&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),k[0]!=="/"&&(k="/"+k))}if(!f[X])for(var T=0,ne=o.length;T<ne;T++){var q=o[T];if(k.indexOf(q)!==-1){var W=encodeURIComponent(q);W===q&&(W=escape(q)),k=k.split(q).join(W)}}var Q=k.indexOf("#");Q!==-1&&(this.hash=k.substr(Q),k=k.slice(0,Q));var le=k.indexOf("?");if(le!==-1?(this.search=k.substr(le),this.query=k.substr(le+1),M&&(this.query=v.parse(this.query)),k=k.slice(0,le)):M&&(this.search="",this.query={}),k&&(this.pathname=k),m[X]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var j=this.pathname||"",xe=this.search||"";this.path=j+xe}return this.href=this.format(),this};function b(E){return typeof E=="string"&&(E=y(E)),E instanceof e?E.format():e.prototype.format.call(E)}e.prototype.format=function(){var E=this.auth||"";E&&(E=encodeURIComponent(E),E=E.replace(/%3A/i,":"),E+="@");var M=this.protocol||"",_=this.pathname||"",I=this.hash||"",R=!1,F="";this.host?R=E+this.host:this.hostname&&(R=E+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&(R+=":"+this.port)),this.query&&typeof this.query=="object"&&Object.keys(this.query).length&&(F=v.stringify(this.query,{arrayFormat:"repeat",addQueryPrefix:!1}));var P=this.search||F&&"?"+F||"";return M&&M.substr(-1)!==":"&&(M+=":"),this.slashes||(!M||m[M])&&R!==!1?(R="//"+(R||""),_&&_.charAt(0)!=="/"&&(_="/"+_)):R||(R=""),I&&I.charAt(0)!=="#"&&(I="#"+I),P&&P.charAt(0)!=="?"&&(P="?"+P),_=_.replace(/[?#]/g,function(k){return encodeURIComponent(k)}),P=P.replace("#","%23"),M+R+_+P+I};function g(E,M){return y(E,!1,!0).resolve(M)}e.prototype.resolve=function(E){return this.resolveObject(y(E,!1,!0)).format()};function w(E,M){return E?y(E,!1,!0).resolveObject(M):M}return e.prototype.resolveObject=function(E){if(typeof E=="string"){var M=new e;M.parse(E,!1,!0),E=M}for(var _=new e,I=Object.keys(this),R=0;R<I.length;R++){var F=I[R];_[F]=this[F]}if(_.hash=E.hash,E.href==="")return _.href=_.format(),_;if(E.slashes&&!E.protocol){for(var P=Object.keys(E),k=0;k<P.length;k++){var B=P[k];B!=="protocol"&&(_[B]=E[B])}return m[_.protocol]&&_.hostname&&!_.pathname&&(_.pathname="/",_.path=_.pathname),_.href=_.format(),_}if(E.protocol&&E.protocol!==_.protocol){if(!m[E.protocol]){for(var L=Object.keys(E),X=0;X<L.length;X++){var O=L[X];_[O]=E[O]}return _.href=_.format(),_}if(_.protocol=E.protocol,!E.host&&!p[E.protocol]){for(var ne=(E.pathname||"").split("/");ne.length&&!(E.host=ne.shift()););E.host||(E.host=""),E.hostname||(E.hostname=""),ne[0]!==""&&ne.unshift(""),ne.length<2&&ne.unshift(""),_.pathname=ne.join("/")}else _.pathname=E.pathname;if(_.search=E.search,_.query=E.query,_.host=E.host||"",_.auth=E.auth,_.hostname=E.hostname||E.host,_.port=E.port,_.pathname||_.search){var D=_.pathname||"",T=_.search||"";_.path=D+T}return _.slashes=_.slashes||E.slashes,_.href=_.format(),_}var U=_.pathname&&_.pathname.charAt(0)==="/",N=E.host||E.pathname&&E.pathname.charAt(0)==="/",Y=N||U||_.host&&E.pathname,G=Y,H=_.pathname&&_.pathname.split("/")||[],ne=E.pathname&&E.pathname.split("/")||[],Z=_.protocol&&!m[_.protocol];if(Z&&(_.hostname="",_.port=null,_.host&&(H[0]===""?H[0]=_.host:H.unshift(_.host)),_.host="",E.protocol&&(E.hostname=null,E.port=null,E.host&&(ne[0]===""?ne[0]=E.host:ne.unshift(E.host)),E.host=null),Y=Y&&(ne[0]===""||H[0]==="")),N)_.host=E.host||E.host===""?E.host:_.host,_.hostname=E.hostname||E.hostname===""?E.hostname:_.hostname,_.search=E.search,_.query=E.query,H=ne;else if(ne.length)H||(H=[]),H.pop(),H=H.concat(ne),_.search=E.search,_.query=E.query;else if(E.search!=null){if(Z){_.host=H.shift(),_.hostname=_.host;var de=_.host&&_.host.indexOf("@")>0?_.host.split("@"):!1;de&&(_.auth=de.shift(),_.hostname=de.shift(),_.host=_.hostname)}return _.search=E.search,_.query=E.query,(_.pathname!==null||_.search!==null)&&(_.path=(_.pathname?_.pathname:"")+(_.search?_.search:"")),_.href=_.format(),_}if(!H.length)return _.pathname=null,_.search?_.path="/"+_.search:_.path=null,_.href=_.format(),_;for(var me=H.slice(-1)[0],_e=(_.host||E.host||H.length>1)&&(me==="."||me==="..")||me==="",Ae=0,ge=H.length;ge>=0;ge--)me=H[ge],me==="."?H.splice(ge,1):me===".."?(H.splice(ge,1),Ae++):Ae&&(H.splice(ge,1),Ae--);if(!Y&&!G)for(;Ae--;Ae)H.unshift("..");Y&&H[0]!==""&&(!H[0]||H[0].charAt(0)!=="/")&&H.unshift(""),_e&&H.join("/").substr(-1)!=="/"&&H.push("");var Ee=H[0]===""||H[0]&&H[0].charAt(0)==="/";if(Z){_.hostname=Ee?"":H.length?H.shift():"",_.host=_.hostname;var de=_.host&&_.host.indexOf("@")>0?_.host.split("@"):!1;de&&(_.auth=de.shift(),_.hostname=de.shift(),_.host=_.hostname)}return Y=Y||_.host&&H.length,Y&&!Ee&&H.unshift(""),H.length>0?_.pathname=H.join("/"):(_.pathname=null,_.path=null),(_.pathname!==null||_.search!==null)&&(_.path=(_.pathname?_.pathname:"")+(_.search?_.search:"")),_.auth=E.auth||_.auth,_.slashes=_.slashes||E.slashes,_.href=_.format(),_},e.prototype.parseHost=function(){var E=this.host,M=i.exec(E);M&&(M=M[0],M!==":"&&(this.port=M.substr(1)),E=E.substr(0,E.length-M.length)),E&&(this.hostname=E)},Gr.parse=y,Gr.resolve=g,Gr.resolveObject=w,Gr.format=b,Gr.Url=e,Gr}hM();const o0={};function Pt(n,e,t=3){if(o0[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))),o0[e]=!0}function Ps(n){if(typeof n!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(n)}`)}function Fo(n){return n.split("?")[0].split("#")[0]}function uM(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function dM(n,e,t){return n.replace(new RegExp(uM(e),"g"),t)}function fM(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 pi={toPosix(n){return dM(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){Ps(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(Ps(n),this.isDataUrl(n)||this.isBlobUrl(n))return n;const i=Fo(this.toPosix(e??ze.ADAPTER.getBaseUrl())),s=Fo(this.toPosix(t??this.rootname(i)));return n=this.toPosix(n),n.startsWith("/")?pi.join(s,n.slice(1)):this.isAbsolute(n)?n:this.join(i,n)},normalize(n){if(Ps(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=fM(n),n.length>0&&i&&(n+="/"),t?`/${n}`:e+n},isAbsolute(n){return Ps(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(Ps(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(Ps(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){Ps(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){Ps(n),e&&Ps(e),n=Fo(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){Ps(n),n=Fo(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){Ps(n);const e={root:"",dir:"",base:"",ext:"",name:""};if(n.length===0)return e;n=Fo(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 pd;async function mM(){return pd??(pd=(async()=>{var r;const n=document.createElement("canvas").getContext("webgl");if(!n)return Fi.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 Fi.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]?Fi.PMA:Fi.UNPACK})()),pd}let gd;function pM(){return typeof gd>"u"&&(gd=(function(){var e;const n={stencil:!0,failIfMajorPerformanceCaveat:ze.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT};try{if(!ze.ADAPTER.getWebGLRenderingContext())return!1;const t=ze.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}})()),gd}var gM={grad:.9,turn:360,rad:360/(2*Math.PI)},On=function(n){return typeof n=="string"?n.length>0:typeof n=="number"},ki=function(n,e,t){return e===void 0&&(e=0),t===void 0&&(t=Math.pow(10,e)),Math.round(t*n)/t+0},As=function(n,e,t){return e===void 0&&(e=0),t===void 0&&(t=1),n>t?t:n>e?n:e},dx=function(n){return(n=isFinite(n)?n%360:0)>0?n:n+360},l0=function(n){return{r:As(n.r,0,255),g:As(n.g,0,255),b:As(n.b,0,255),a:As(n.a)}},vd=function(n){return{r:ki(n.r),g:ki(n.g),b:ki(n.b),a:ki(n.a,3)}},vM=/^#([0-9a-f]{3,8})$/i,jl=function(n){var e=n.toString(16);return e.length<2?"0"+e:e},fx=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}},mx=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}},c0=function(n){return{h:dx(n.h),s:As(n.s,0,100),l:As(n.l,0,100),a:As(n.a)}},h0=function(n){return{h:ki(n.h),s:ki(n.s),l:ki(n.l),a:ki(n.a,3)}},u0=function(n){return mx((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},il=function(n){return{h:(e=fx(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},yM=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,xM=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,bM=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,wM=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,pf={string:[[function(n){var e=vM.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?ki(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?ki(parseInt(n.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(n){var e=bM.exec(n)||wM.exec(n);return e?e[2]!==e[4]||e[4]!==e[6]?null:l0({r:Number(e[1])/(e[2]?100/255:1),g:Number(e[3])/(e[4]?100/255:1),b:Number(e[5])/(e[6]?100/255:1),a:e[7]===void 0?1:Number(e[7])/(e[8]?100:1)}):null},"rgb"],[function(n){var e=yM.exec(n)||xM.exec(n);if(!e)return null;var t,i,s=c0({h:(t=e[1],i=e[2],i===void 0&&(i="deg"),Number(t)*(gM[i]||1)),s:Number(e[3]),l:Number(e[4]),a:e[5]===void 0?1:Number(e[5])/(e[6]?100:1)});return u0(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 On(e)&&On(t)&&On(i)?l0({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(!On(e)||!On(t)||!On(i))return null;var a=c0({h:Number(e),s:Number(t),l:Number(i),a:Number(r)});return u0(a)},"hsl"],[function(n){var e=n.h,t=n.s,i=n.v,s=n.a,r=s===void 0?1:s;if(!On(e)||!On(t)||!On(i))return null;var a=(function(o){return{h:dx(o.h),s:As(o.s,0,100),v:As(o.v,0,100),a:As(o.a)}})({h:Number(e),s:Number(t),v:Number(i),a:Number(r)});return mx(a)},"hsv"]]},d0=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]},SM=function(n){return typeof n=="string"?d0(n.trim(),pf.string):typeof n=="object"&&n!==null?d0(n,pf.object):[null,void 0]},yd=function(n,e){var t=il(n);return{h:t.h,s:As(t.s+100*e,0,100),l:t.l,a:t.a}},xd=function(n){return(299*n.r+587*n.g+114*n.b)/1e3/255},f0=function(n,e){var t=il(n);return{h:t.h,s:t.s,l:As(t.l+100*e,0,100),a:t.a}},gf=(function(){function n(e){this.parsed=SM(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 ki(xd(this.rgba),2)},n.prototype.isDark=function(){return xd(this.rgba)<.5},n.prototype.isLight=function(){return xd(this.rgba)>=.5},n.prototype.toHex=function(){return e=vd(this.rgba),t=e.r,i=e.g,s=e.b,a=(r=e.a)<1?jl(ki(255*r)):"","#"+jl(t)+jl(i)+jl(s)+a;var e,t,i,s,r,a},n.prototype.toRgb=function(){return vd(this.rgba)},n.prototype.toRgbString=function(){return e=vd(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 h0(il(this.rgba))},n.prototype.toHslString=function(){return e=h0(il(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=fx(this.rgba),{h:ki(e.h),s:ki(e.s),v:ki(e.v),a:ki(e.a,3)};var e},n.prototype.invert=function(){return Qs({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),Qs(yd(this.rgba,e))},n.prototype.desaturate=function(e){return e===void 0&&(e=.1),Qs(yd(this.rgba,-e))},n.prototype.grayscale=function(){return Qs(yd(this.rgba,-1))},n.prototype.lighten=function(e){return e===void 0&&(e=.1),Qs(f0(this.rgba,e))},n.prototype.darken=function(e){return e===void 0&&(e=.1),Qs(f0(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"?Qs({r:(t=this.rgba).r,g:t.g,b:t.b,a:e}):ki(this.rgba.a,3);var t},n.prototype.hue=function(e){var t=il(this.rgba);return typeof e=="number"?Qs({h:e,s:t.s,l:t.l,a:t.a}):ki(t.h)},n.prototype.isEqual=function(e){return this.toHex()===Qs(e).toHex()},n})(),Qs=function(n){return n instanceof gf?n:new gf(n)},m0=[],_M=function(n){n.forEach(function(e){m0.indexOf(e)<0&&(e(gf,pf),m0.push(e))})};function TM(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"])}_M([TM]);const Xa=class Tc{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 Tc)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]=Tc.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=Tc.HEX_PATTERN.exec(e);o&&(e=`#${o[2]}`)}const a=Qs(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)}};Xa.shared=new Xa,Xa.temp=new Xa,Xa.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;let Yt=Xa;function MM(n){return Pt("7.2.0","utils.hex2string is deprecated, use Color#toHex instead"),Yt.shared.setValue(n).toHex()}function EM(n){return Pt("7.2.0","utils.rgb2hex is deprecated, use Color#toNumber instead"),Yt.shared.setValue(n).toNumber()}function AM(){const n=[],e=[];for(let i=0;i<32;i++)n[i]=i,e[i]=i;n[ct.NORMAL_NPM]=ct.NORMAL,n[ct.ADD_NPM]=ct.ADD,n[ct.SCREEN_NPM]=ct.SCREEN,e[ct.NORMAL]=ct.NORMAL_NPM,e[ct.ADD]=ct.ADD_NPM,e[ct.SCREEN]=ct.SCREEN_NPM;const t=[];return t.push(e),t.push(n),t}const px=AM();function gx(n,e){return px[e?1:0][n]}function CM(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 vx(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 zc(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 p0(n){return!(n&n-1)&&!!n}function g0(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 to(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 Ar(n){return n===0?0:n<0?-1:1}let IM=0;function ga(){return++IM}const vf=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}};vf.EMPTY=new vf(0,0,0,0);let v0=vf;const y0={},en=Object.create(null),ur=Object.create(null);class RM{constructor(e,t,i){this._canvas=ze.ADAPTER.createCanvas(),this._context=this._canvas.getContext("2d"),this.resolution=i||ze.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 x0(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 b0(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 PM(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&&x0(s,e,a);)++a;if(a===t)return v0.EMPTY;for(;x0(s,e,h);)--h;for(;b0(s,e,r,a,h);)++r;for(;b0(s,e,o,a,h);)--o;return++o,++h,new v0(r,a,o,h)}function kM(n){const e=PM(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 FM(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 nr(n,e=1){var i;const t=(i=ze.RETINA_PREFIX)==null?void 0:i.exec(n);return t?parseFloat(t[1]):e}var $e=(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))($e||{});const yf=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},w0=(n,e)=>yf(n).priority??e,et={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...n){return n.map(yf).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(yf).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)=>w0(r,t)-w0(s,t)))},i=>{const s=e.indexOf(i.ref);s!==-1&&e.splice(s,1)})}};class xf{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 OM=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(`
|
||
`);function BM(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 LM(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=OM.replace(/%forloop%/gi,BM(n));if(e.shaderSource(t,i),e.compileShader(t),!e.getShaderParameter(t,e.COMPILE_STATUS))n=n/2|0;else break}return n}const bd=0,wd=1,Sd=2,_d=3,Td=4,Md=5;class An{constructor(){this.data=0,this.blendMode=ct.NORMAL,this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<<bd)}set blend(e){!!(this.data&1<<bd)!==e&&(this.data^=1<<bd)}get offsets(){return!!(this.data&1<<wd)}set offsets(e){!!(this.data&1<<wd)!==e&&(this.data^=1<<wd)}get culling(){return!!(this.data&1<<Sd)}set culling(e){!!(this.data&1<<Sd)!==e&&(this.data^=1<<Sd)}get depthTest(){return!!(this.data&1<<_d)}set depthTest(e){!!(this.data&1<<_d)!==e&&(this.data^=1<<_d)}get depthMask(){return!!(this.data&1<<Md)}set depthMask(e){!!(this.data&1<<Md)!==e&&(this.data^=1<<Md)}get clockwiseFrontFace(){return!!(this.data&1<<Td)}set clockwiseFrontFace(e){!!(this.data&1<<Td)!==e&&(this.data^=1<<Td)}get blendMode(){return this._blendMode}set blendMode(e){this.blend=e!==ct.NONE,this._blendMode=e}get polygonOffset(){return this._polygonOffset}set polygonOffset(e){this.offsets=!!e,this._polygonOffset=e}static for2d(){const e=new An;return e.depthTest=!1,e.blend=!0,e}}An.prototype.toString=function(){return`[@pixi/core:State blendMode=${this.blendMode} clockwiseFrontFace=${this.clockwiseFrontFace} culling=${this.culling} depthMask=${this.depthMask} polygonOffset=${this.polygonOffset}]`};const bf=[];function yx(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=bf.length-1;i>=0;--i){const s=bf[i];if(s.test&&s.test(n,t))return new s(n,e)}throw new Error("Unrecognized source type to auto-detect Resource")}class $s{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($s.prototype,{dispatch:{value:$s.prototype.emit},run:{value:$s.prototype.emit}});class yl{constructor(e=0,t=0){this._width=e,this._height=t,this.destroyed=!1,this.internal=!1,this.onResize=new $s("setRealSize"),this.onUpdate=new $s("update"),this.onError=new $s("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 Wh extends yl{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===Fi.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 DM={scaleMode:Us.NEAREST,alphaMode:Fi.NPM},wf=class Ya extends Il{constructor(e=null,t=null){super(),t=Object.assign({},Ya.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 yl)&&(e=yx(e,p),e.internal=!0),this.resolution=f||ze.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=ga(),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=p0(this.realWidth)&&p0(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 ur[this.cacheId],delete en[this.cacheId],this.cacheId=null),this.valid=!1,this.dispose(),Ya.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=ze.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}_${ga()}`}r=e._pixiId}let a=ur[r];if(s&&i&&!a)throw new Error(`The cacheId "${r}" does not exist in BaseTextureCache.`);return a||(a=new Ya(e,t),a.cacheId=r,Ya.addToCache(a,r)),a}static fromBuffer(e,t,i,s){e=e||new Float32Array(t*i*4);const r=new Wh(e,{width:t,height:i,...s==null?void 0:s.resourceOptions});let a,o;return e instanceof Float32Array?(a=Le.RGBA,o=Qe.FLOAT):e instanceof Int32Array?(a=Le.RGBA_INTEGER,o=Qe.INT):e instanceof Uint32Array?(a=Le.RGBA_INTEGER,o=Qe.UNSIGNED_INT):e instanceof Int16Array?(a=Le.RGBA_INTEGER,o=Qe.SHORT):e instanceof Uint16Array?(a=Le.RGBA_INTEGER,o=Qe.UNSIGNED_SHORT):e instanceof Int8Array?(a=Le.RGBA,o=Qe.BYTE):(a=Le.RGBA,o=Qe.UNSIGNED_BYTE),r.internal=!0,new Ya(r,Object.assign({},DM,{type:o,format:a},s))}static addToCache(e,t){t&&(e.textureCacheIds.includes(t)||e.textureCacheIds.push(t),ur[t]&&ur[t]!==e&&console.warn(`BaseTexture added to the cache with an id [${t}] that already had an entry`),ur[t]=e)}static removeFromCache(e){if(typeof e=="string"){const t=ur[e];if(t){const i=t.textureCacheIds.indexOf(e);return i>-1&&t.textureCacheIds.splice(i,1),delete ur[e],t}}else if(e!=null&&e.textureCacheIds){for(let t=0;t<e.textureCacheIds.length;++t)delete ur[e.textureCacheIds[t]];return e.textureCacheIds.length=0,e}return null}};wf.defaultOptions={mipmap:Cs.POW2,anisotropicLevel:0,scaleMode:Us.LINEAR,wrapMode:Vs.CLAMP,alphaMode:Fi.UNPACK,target:eo.TEXTURE_2D,format:Le.RGBA,type:Qe.UNSIGNED_BYTE},wf._globalBatch=0;let mt=wf;class Sf{constructor(){this.texArray=null,this.blend=0,this.type=vn.TRIANGLES,this.start=0,this.size=0,this.data=null}}let NM=0;class si{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=NM++,this.disposeRunner=new $s("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?wn.ELEMENT_ARRAY_BUFFER:wn.ARRAY_BUFFER}get index(){return this.type===wn.ELEMENT_ARRAY_BUFFER}static from(e){return e instanceof Array&&(e=new Float32Array(e)),new si(e)}}class qc{constructor(e,t=0,i=!1,s=Qe.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 qc(e,t,i,s,r)}}const UM={Float32Array,Uint32Array,Int32Array,Uint8Array};function XM(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=vx(c);s[u]||(s[u]=new UM[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 S0={5126:4,5123:2,5121:1};let YM=0;const VM={Float32Array,Uint32Array,Int32Array,Uint8Array,Uint16Array};class Mn{constructor(e=[],t={}){this.buffers=e,this.indexBuffer=null,this.attributes=t,this.glVertexArrayObjects={},this.id=YM++,this.instanced=!1,this.instanceCount=1,this.disposeRunner=new $s("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 si||(t instanceof Array&&(t=new Float32Array(t)),t=new si(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 qc(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 si||(e instanceof Array&&(e=new Uint16Array(e)),e=new si(e)),e.type=wn.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 si;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*S0[r.type]/4),r.buffer=0}for(i.data=XM(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 Mn;for(let t=0;t<this.buffers.length;t++)e.buffers[t]=new si(this.buffers[t].data.slice(0));for(const t in this.attributes){const i=this.attributes[t];e.attributes[t]=new qc(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=wn.ELEMENT_ARRAY_BUFFER),e}static merge(e){const t=new Mn,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 VM[vx(a.buffers[o].data)](s[o]),t.buffers[o]=new si(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=wn.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*S0[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 xx extends Mn{constructor(e=!1){super(),this._buffer=new si(null,e,!1),this._indexBuffer=new si(null,e,!0),this.addAttribute("aVertexPosition",this._buffer,2,!1,Qe.FLOAT).addAttribute("aTextureCoord",this._buffer,2,!1,Qe.FLOAT).addAttribute("aColor",this._buffer,4,!0,Qe.UNSIGNED_BYTE).addAttribute("aTextureId",this._buffer,1,!0,Qe.FLOAT).addIndex(this._indexBuffer)}}const Kc=Math.PI*2,$M=180/Math.PI,GM=Math.PI/180;var Xi=(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))(Xi||{});class Dt{constructor(e=0,t=0){this.x=0,this.y=0,this.x=e,this.y=t}clone(){return new Dt(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}}Dt.prototype.toString=function(){return`[@pixi/math:Point x=${this.x} y=${this.y}]`};const Hl=[new Dt,new Dt,new Dt,new Dt];class _t{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=Xi.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 _t(0,0,0,0)}clone(){return new _t(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 I=this.x<e.x?e.x:this.x;if((this.right>e.right?e.right:this.right)<=I)return!1;const R=this.y<e.y?e.y:this.y;return(this.bottom>e.bottom?e.bottom:this.bottom)>R}const i=this.left,s=this.right,r=this.top,a=this.bottom;if(s<=i||a<=r)return!1;const o=Hl[0].set(e.left,e.top),h=Hl[1].set(e.left,e.bottom),l=Hl[2].set(e.right,e.top),c=Hl[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,v=d*i+f*a,y=d*s+f*a;if(Math.max(p,m,v,y)<=d*o.x+f*o.y||Math.min(p,m,v,y)>=d*c.x+f*c.y)return!1;const b=u*(o.y-l.y),g=u*(l.x-o.x),w=b*i+g*r,E=b*s+g*r,M=b*i+g*a,_=b*s+g*a;return!(Math.max(w,E,M,_)<=b*o.x+g*o.y||Math.min(w,E,M,_)>=b*c.x+g*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}}_t.prototype.toString=function(){return`[@pixi/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};class zh{constructor(e=0,t=0,i=0){this.x=e,this.y=t,this.radius=i,this.type=Xi.CIRC}clone(){return new zh(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 _t(this.x-this.radius,this.y-this.radius,this.radius*2,this.radius*2)}}zh.prototype.toString=function(){return`[@pixi/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`};class qh{constructor(e=0,t=0,i=0,s=0){this.x=e,this.y=t,this.width=i,this.height=s,this.type=Xi.ELIP}clone(){return new qh(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 _t(this.x-this.width,this.y-this.height,this.width,this.height)}}qh.prototype.toString=function(){return`[@pixi/math:Ellipse x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};class ua{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=Xi.POLY,this.closeStroke=!0}clone(){const e=this.points.slice(),t=new ua(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}}ua.prototype.toString=function(){return`[@pixi/math:PolygoncloseStroke=${this.closeStroke}points=${this.points.reduce((n,e)=>`${n}, ${e}`,"")}]`};class Kh{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=Xi.RREC}clone(){return new Kh(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}}Kh.prototype.toString=function(){return`[@pixi/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`};class ri{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 Dt;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 Dt;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(Kc-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 ri;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 ri}static get TEMP_MATRIX(){return new ri}}ri.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 qr=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],Kr=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],Zr=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],Jr=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],_f=[],bx=[],Wl=Math.sign;function jM(){for(let n=0;n<16;n++){const e=[];_f.push(e);for(let t=0;t<16;t++){const i=Wl(qr[n]*qr[t]+Zr[n]*Kr[t]),s=Wl(Kr[n]*qr[t]+Jr[n]*Kr[t]),r=Wl(qr[n]*Zr[t]+Zr[n]*Jr[t]),a=Wl(Kr[n]*Zr[t]+Jr[n]*Jr[t]);for(let o=0;o<16;o++)if(qr[o]===i&&Kr[o]===s&&Zr[o]===r&&Jr[o]===a){e.push(o);break}}}for(let n=0;n<16;n++){const e=new ri;e.set(qr[n],Kr[n],Zr[n],Jr[n],0,0),bx.push(e)}}jM();const li={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=>qr[n],uY:n=>Kr[n],vX:n=>Zr[n],vY:n=>Jr[n],inv:n=>n&8?n&15:-n&7,add:(n,e)=>_f[n][e],sub:(n,e)=>_f[n][li.inv(e)],rotate180:n=>n^4,isVertical:n=>(n&3)===2,byDirection:(n,e)=>Math.abs(n)*2<=Math.abs(e)?e>=0?li.S:li.N:Math.abs(e)*2<=Math.abs(n)?n>0?li.E:li.W:e>0?n>0?li.SE:li.SW:n>0?li.NE:li.NW,matrixAppendRotationInv:(n,e,t=0,i=0)=>{const s=bx[li.inv(e)];s.tx=t,s.ty=i,n.append(s)}};class Hn{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 Hn(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))}}Hn.prototype.toString=function(){return`[@pixi/math:ObservablePoint x=${this.x} y=${this.y} scope=${this.scope}]`};const Tf=class{constructor(){this.worldTransform=new ri,this.localTransform=new ri,this.position=new Hn(this.onChange,this,0,0),this.scale=new Hn(this.onChange,this,1,1),this.pivot=new Hn(this.onChange,this,0,0),this.skew=new Hn(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())}};Tf.IDENTITY=new Tf;let Hm=Tf;Hm.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 HM=`varying vec2 vTextureCoord;
|
||
|
||
uniform sampler2D uSampler;
|
||
|
||
void main(void){
|
||
gl_FragColor *= texture2D(uSampler, vTextureCoord);
|
||
}`,WM=`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 _0(n,e,t){const i=n.createShader(e);return n.shaderSource(i,t),n.compileShader(i),i}function Ed(n){const e=new Array(n);for(let t=0;t<e.length;t++)e[t]=!1;return e}function wx(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 Ed(2*e);case"bvec3":return Ed(3*e);case"bvec4":return Ed(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 io=[{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])
|
||
}`}],zM={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);
|
||
}`},qM={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 KM(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<io.length;h++)if(io[h].test(r,a)){t.push(io[h].code(s,a)),o=!0;break}if(!o){const h=(r.size===1&&!r.isArray?zM:qM)[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 Sx={};let ka=Sx;function ZM(){if(ka===Sx||ka!=null&&ka.isContextLost()){const n=ze.ADAPTER.createCanvas();let e;ze.PREFER_ENV>=wa.WEBGL2&&(e=n.getContext("webgl2",{})),e||(e=n.getContext("webgl",{})||n.getContext("experimental-webgl",{}),e?e.getExtension("WEBGL_draw_buffers"):e=null),ka=e}return ka}let zl;function JM(){if(!zl){zl=Es.MEDIUM;const n=ZM();if(n&&n.getShaderPrecisionFormat){const e=n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT);e&&(zl=e.precision?Es.HIGH:Es.MEDIUM)}}return zl}function T0(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 QM(n,e,t,i){n.getProgramParameter(e,n.LINK_STATUS)||(n.getShaderParameter(t,n.COMPILE_STATUS)||T0(n,t),n.getShaderParameter(i,n.COMPILE_STATUS)||T0(n,i),console.error("PixiJS Error: Could not initialize shader."),n.getProgramInfoLog(e)!==""&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",n.getProgramInfoLog(e)))}const eE={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 _x(n){return eE[n]}let ql=null;const M0={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 Tx(n,e){if(!ql){const t=Object.keys(M0);ql={};for(let i=0;i<t.length;++i){const s=t[i];ql[n[s]]=M0[s]}}return ql[e]}function E0(n,e,t){if(n.substring(0,9)!=="precision"){let i=e;return e===Es.HIGH&&t!==Es.HIGH&&(i=Es.MEDIUM),`precision ${i} float;
|
||
${n}`}else if(t!==Es.HIGH&&n.substring(0,15)==="precision highp")return n.replace("precision highp","precision mediump");return n}let Oo;function tE(){if(typeof Oo=="boolean")return Oo;try{Oo=new Function("param1","param2","param3","return param1[param2] === param3;")({a:"b"},"a","b")===!0}catch{Oo=!1}return Oo}let iE=0;const Kl={},Mf=class Va{constructor(e,t,i="pixi-shader",s={}){this.extra={},this.id=iE++,this.vertexSrc=e||Va.defaultVertexSrc,this.fragmentSrc=t||Va.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,"-"),Kl[i]?(Kl[i]++,i+=`-${Kl[i]}`):Kl[i]=1,this.vertexSrc=`#define SHADER_NAME ${i}
|
||
${this.vertexSrc}`,this.fragmentSrc=`#define SHADER_NAME ${i}
|
||
${this.fragmentSrc}`,this.vertexSrc=E0(this.vertexSrc,Va.defaultVertexPrecision,Es.HIGH),this.fragmentSrc=E0(this.fragmentSrc,Va.defaultFragmentPrecision,JM())),this.glPrograms={},this.syncUniforms=null}static get defaultVertexSrc(){return WM}static get defaultFragmentSrc(){return HM}static from(e,t,i){const s=e+t;let r=y0[s];return r||(y0[s]=r=new Va(e,t,i)),r}};Mf.defaultVertexPrecision=Es.HIGH,Mf.defaultFragmentPrecision=jn.apple.device?Es.HIGH:Es.MEDIUM;let yn=Mf,sE=0;class Gs{constructor(e,t,i){this.group=!0,this.syncUniforms={},this.dirtyId=0,this.id=sE++,this.static=!!t,this.ubo=!!i,e instanceof si?(this.buffer=e,this.buffer.type=wn.UNIFORM_BUFFER,this.autoManage=!1,this.ubo=!0):(this.uniforms=e,this.ubo&&(this.buffer=new si(new Float32Array(1)),this.buffer.type=wn.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 Gs(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 Gs(e,t,i)}static uboFrom(e,t){return new Gs(e,t??!0,!0)}}class js{constructor(e,t){this.uniformBindCount=0,this.program=e,t?t instanceof Gs?this.uniformGroup=t:this.uniformGroup=new Gs(t):this.uniformGroup=new Gs({}),this.disposeRunner=new $s("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=yn.from(e,t);return new js(s,i)}}class Mx{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]=Gs.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 yn(this.vertexSrc,s)}const t={tint:new Float32Array([1,1,1,1]),translationMatrix:new ri,default:this.defaultGroupCache[e]};return new js(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 Ef{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 nE(){return!jn.apple.device}function rE(n){let e=!0;const t=ze.ADAPTER.getNavigator();if(jn.tablet||jn.phone){if(jn.apple.device){const i=t.userAgent.match(/OS (\d+)_(\d+)?/);i&&parseInt(i[1],10)<11&&(e=!1)}if(jn.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 aE=`varying vec2 vTextureCoord;
|
||
varying vec4 vColor;
|
||
varying float vTextureId;
|
||
uniform sampler2D uSamplers[%count%];
|
||
|
||
void main(void){
|
||
vec4 color;
|
||
%forloop%
|
||
gl_FragColor = color * vColor;
|
||
}
|
||
`,oE=`precision highp float;
|
||
attribute vec2 aVertexPosition;
|
||
attribute vec2 aTextureCoord;
|
||
attribute vec4 aColor;
|
||
attribute float aTextureId;
|
||
|
||
uniform mat3 projectionMatrix;
|
||
uniform mat3 translationMatrix;
|
||
uniform vec4 tint;
|
||
|
||
varying vec2 vTextureCoord;
|
||
varying vec4 vColor;
|
||
varying float vTextureId;
|
||
|
||
void main(void){
|
||
gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
|
||
|
||
vTextureCoord = aTextureCoord;
|
||
vTextureId = aTextureId;
|
||
vColor = aColor * tint;
|
||
}
|
||
`;const $o=class Os extends Zh{constructor(e){super(e),this.setShaderGenerator(),this.geometryClass=xx,this.vertexSize=6,this.state=An.for2d(),this.size=Os.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??rE(32),this._defaultMaxTextures}static set defaultMaxTextures(e){this._defaultMaxTextures=e}static get canUploadSameBuffer(){return this._canUploadSameBuffer=this._canUploadSameBuffer??nE(),this._canUploadSameBuffer}static set canUploadSameBuffer(e){this._canUploadSameBuffer=e}get MAX_TEXTURES(){return Pt("7.1.0","BatchRenderer#MAX_TEXTURES renamed to BatchRenderer#maxTextures"),this.maxTextures}static get defaultVertexSrc(){return oE}static get defaultFragmentTemplate(){return aE}setShaderGenerator({vertex:e=Os.defaultVertexSrc,fragment:t=Os.defaultFragmentTemplate}={}){this.shaderGenerator=new Mx(e,t)}contextChange(){const e=this.renderer.gl;ze.PREFER_ENV===wa.WEBGL_LEGACY?this.maxTextures=1:(this.maxTextures=Math.min(e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),Os.defaultMaxTextures),this.maxTextures=LM(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}=Os,i=this.size/4,s=Math.floor(i/this.maxTextures)+1;for(;e.length<i;)e.push(new Sf);for(;t.length<s;)t.push(new Ef);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=Os._textureArrayPool,s=this.renderer.batch,r=this._tempBoundTextures,a=this.renderer.textureGC.count;let o=++mt._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;mt._globalBatch=o}buildDrawCalls(e,t,i){const{_bufferedElements:s,_attributeBuffer:r,_indexBuffer:a,vertexSize:o}=this,h=Os._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,v=px[m.alphaMode?1:0][p.blendMode];s[f]=null,t<f&&d.blend!==v&&(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=v}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;Os.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=Os._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),Os.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=zc(Math.ceil(e/8)),i=g0(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 xf(s*this.vertexSize*4)),r}getIndexBuffer(e){const t=zc(Math.ceil(e/12)),i=g0(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=Yt.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]}};$o.defaultBatchSize=4096,$o.extension={name:"batch",type:$e.RendererPlugin},$o._drawCallPool=[],$o._textureArrayPool=[];let vr=$o;et.add(vr);var lE=`varying vec2 vTextureCoord;
|
||
|
||
uniform sampler2D uSampler;
|
||
|
||
void main(void){
|
||
gl_FragColor = texture2D(uSampler, vTextureCoord);
|
||
}
|
||
`,cE=`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 Af=class Go extends js{constructor(e,t,i){const s=yn.from(e||Go.defaultVertexSrc,t||Go.defaultFragmentSrc);super(s,i),this.padding=0,this.resolution=Go.defaultResolution,this.multisample=Go.defaultMultisample,this.enabled=!0,this.autoFit=!0,this.state=new An}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 cE}static get defaultFragmentSrc(){return lE}};Af.defaultResolution=1,Af.defaultMultisample=Si.NONE;let ts=Af;class Zc{constructor(){this.clearBeforeRender=!0,this._backgroundColor=new Yt(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:[$e.RendererSystem,$e.CanvasRendererSystem],name:"background"};et.add(Zc);class Ex{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}}Ex.extension={type:$e.RendererSystem,name:"batch"};et.add(Ex);let A0=0;class Jc{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=A0++}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=A0++,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(ze.PREFER_ENV>=wa.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")}}Jc.defaultOptions={context:null,antialias:!1,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:"default"},Jc.extension={type:$e.RendererSystem,name:"context"};et.add(Jc);class Cf{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 $s("disposeFramebuffer"),this.multisample=Si.NONE}get colorTexture(){return this.colorTextures[0]}addColorTexture(e=0,t){return this.colorTextures[e]=t||new mt(null,{scaleMode:Us.NEAREST,resolution:1,mipmap:Cs.OFF,width:this.width,height:this.height}),this.dirtyId++,this.dirtyFormat++,this}addDepthTexture(e){return this.depthTexture=e||new mt(null,{scaleMode:Us.NEAREST,resolution:1,width:this.width,height:this.height,mipmap:Cs.OFF,format:Le.DEPTH_COMPONENT,type:Qe.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 Ax extends mt{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=Si.NONE),super(null,e),this.mipmap=Cs.OFF,this.valid=!0,this._clear=new Yt([0,0,0,0]),this.framebuffer=new Cf(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 rr extends yl{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=FM(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===Fi.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 Cx extends rr{constructor(e,t){if(t=t||{},typeof e=="string"){const i=new Image;rr.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??ze.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===Fi.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 Wm{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=li.add(i,li.NW),this.x0=h+a*li.uX(i),this.y0=l+o*li.uY(i),i=li.add(i,2),this.x1=h+a*li.uX(i),this.y1=l+o*li.uY(i),i=li.add(i,2),this.x2=h+a*li.uX(i),this.y2=l+o*li.uY(i),i=li.add(i,2),this.x3=h+a*li.uX(i),this.y3=l+o*li.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}}Wm.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 C0=new Wm;function Zl(n){n.destroy=function(){},n.on=function(){},n.once=function(){},n.emit=function(){}}let ht=class Qt extends Il{constructor(e,t,i,s,r,a,o){if(super(),this.noFrame=!1,t||(this.noFrame=!0,t=new _t(0,0,1,1)),e instanceof Qt&&(e=e.baseTexture),this.baseTexture=e,this._frame=t,this.trim=s,this.valid=!1,this.destroyed=!1,this._uvs=C0,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 Dt(a.x,a.y):new Dt(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&&en[t.url]&&Qt.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,Qt.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 Qt(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===C0&&(this._uvs=new Wm),this._uvs.set(this._frame,this.baseTexture,this.rotate),this._updateID++}static from(e,t={},i=ze.STRICT_TEXTURE_CACHE){const s=typeof e=="string";let r=null;if(s)r=e;else if(e instanceof mt){if(!e.cacheId){const o=(t==null?void 0:t.pixiIdPrefix)||"pixiid";e.cacheId=`${o}-${ga()}`,mt.addToCache(e,e.cacheId)}r=e.cacheId}else{if(!e._pixiId){const o=(t==null?void 0:t.pixiIdPrefix)||"pixiid";e._pixiId=`${o}_${ga()}`}r=e._pixiId}let a=en[r];if(s&&i&&!a)throw new Error(`The cacheId "${r}" does not exist in TextureCache.`);return!a&&!(e instanceof mt)?(t.resolution||(t.resolution=nr(e)),a=new Qt(new mt(e,t)),a.baseTexture.cacheId=r,mt.addToCache(a.baseTexture,r),Qt.addToCache(a,r)):!a&&e instanceof mt&&(a=new Qt(e),Qt.addToCache(a,r)),a}static fromURL(e,t){const i=Object.assign({autoLoad:!1},t==null?void 0:t.resourceOptions),s=Qt.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 Qt(mt.fromBuffer(e,t,i,s))}static fromLoader(e,t,i,s){const r=new mt(e,Object.assign({scaleMode:mt.defaultOptions.scaleMode,resolution:nr(t)},s)),{resource:a}=r;a instanceof Cx&&(a.url=t);const o=new Qt(r);return i||(i=t),mt.addToCache(o.baseTexture,i),Qt.addToCache(o,i),i!==t&&(mt.addToCache(o.baseTexture,t),Qt.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),en[t]&&en[t]!==e&&console.warn(`Texture added to the cache with an id [${t}] that already had an entry`),en[t]=e)}static removeFromCache(e){if(typeof e=="string"){const t=en[e];if(t){const i=t.textureCacheIds.indexOf(e);return i>-1&&t.textureCacheIds.splice(i,1),delete en[e],t}}else if(e!=null&&e.textureCacheIds){for(let t=0;t<e.textureCacheIds.length;++t)en[e.textureCacheIds[t]]===e&&delete en[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 Qt._EMPTY||(Qt._EMPTY=new Qt(new mt),Zl(Qt._EMPTY),Zl(Qt._EMPTY.baseTexture)),Qt._EMPTY}static get WHITE(){if(!Qt._WHITE){const e=ze.ADAPTER.createCanvas(16,16),t=e.getContext("2d");e.width=16,e.height=16,t.fillStyle="white",t.fillRect(0,0,16,16),Qt._WHITE=new Qt(mt.from(e)),Zl(Qt._WHITE),Zl(Qt._WHITE.baseTexture)}return Qt._WHITE}};class Sa extends ht{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 Sa(new Ax(e))}}class Ix{constructor(e){this.texturePool={},this.textureOptions=e||{},this.enableFullScreen=!1,this._pixelsWidth=0,this._pixelsHeight=0}createTexture(e,t,i=Si.NONE){const s=new Ax(Object.assign({width:e,height:t,resolution:1,multisample:i},this.textureOptions));return new Sa(s)}getOptimalTexture(e,t,i=1,s=Si.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=zc(e),t=zc(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||Si.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}}}Ix.SCREEN_KEY=-1;class hE extends Mn{constructor(){super(),this.addAttribute("aVertexPosition",new Float32Array([0,0,1,0,1,1,0,1])).addIndex([0,1,3,2])}}class Rx extends Mn{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 si(this.vertices),this.uvBuffer=new si(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 uE{constructor(){this.renderTexture=null,this.target=null,this.legacy=!1,this.resolution=1,this.multisample=Si.NONE,this.sourceFrame=new _t,this.destinationFrame=new _t,this.bindingSourceFrame=new _t,this.bindingDestinationFrame=new _t,this.filters=[],this.transform=null}clear(){this.target=null,this.filters=null,this.renderTexture=null}}const Jl=[new Dt,new Dt,new Dt,new Dt],Ad=new ri;class Px{constructor(e){this.renderer=e,this.defaultFilterStack=[{}],this.texturePool=new Ix,this.statePool=[],this.quad=new hE,this.quadUv=new Rx,this.tempRect=new _t,this.activeState={},this.globalUniforms=new Gs({outputFrame:new _t,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 uE,a=i.renderTexture;let o,h;if(a.current){const v=a.current;o=v.resolution,h=v.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 v=1;v<t.length;v++){const y=t[v];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(Ad.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,mn.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,mn.CLEAR,t);const d=l;l=c,c=d}i[u].apply(this,l,h.renderTexture,mn.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=mn.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===mn.CLEAR||t===mn.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(vn.TRIANGLES)):(r.geometry.bind(this.quad),r.geometry.draw(vn.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(ri.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=Si.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||Si.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=Jl[0],s=Jl[1],r=Jl[2],a=Jl[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?Ad.copyFrom(r):Ad.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)}}}Px.extension={type:$e.RendererSystem,name:"filter"};et.add(Px);class dE{constructor(e){this.framebuffer=e,this.stencil=null,this.dirtyId=-1,this.dirtyFormat=-1,this.dirtySize=-1,this.multisample=Si.NONE,this.msaaBuffer=null,this.blitFramebuffer=null,this.mipLevel=0}}const fE=new _t;class kx{constructor(e){this.renderer=e,this.managedFramebuffers=[],this.unknownFramebuffer=new Cf(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 _t,this.hasMRT=!0,this.writeDepthTexture=!0,this.renderer.context.webGLVersion===1){let t=this.renderer.context.extensions.drawBuffers,i=this.renderer.context.extensions.depthTexture;ze.PREFER_ENV===wa.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=mf.COLOR|mf.DEPTH){const{gl:a}=this;a.clearColor(e,t,i,s),a.clear(r)}initFramebuffer(e){const{gl:t}=this,i=new dE(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=Si.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=Si.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 Cf(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=fE,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 _t}destroy(){this.renderer=null}}kx.extension={type:$e.RendererSystem,name:"framebuffer"};et.add(kx);const Cd={5126:4,5123:2,5121:1};class Fx{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;ze.PREFER_ENV===wa.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*Cd[d[m].type];for(const m in d){const v=d[m],y=v.size;v.stride===void 0&&(f[v.buffer]===y*Cd[v.type]?v.stride=0:v.stride=f[v.buffer]),v.start===void 0&&(v.start=p[v.buffer],p[v.buffer]+=y*Cd[v.type])}c=s.createVertexArray(),s.bindVertexArray(c);for(let m=0;m<u.length;m++){const v=u[m];a.bind(v),i&&v._glBuffers[r].refCount++}return this.activateVao(e,o),l[o.id]=c,l[h]=c,s.bindVertexArray(null),a.unbind(wn.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}}Fx.extension={type:$e.RendererSystem,name:"geometry"};et.add(Fx);const I0=new ri;class zm{constructor(e,t){this._texture=e,this.mapCoord=new ri,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&&(I0.set(s.width/r.width,0,0,s.height/r.height,-r.x/r.width,-r.y/r.height),this.mapCoord.append(I0));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 mE=`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;
|
||
}
|
||
`,pE=`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 gE extends ts{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||pE,t||mE,i),this.maskSprite=s,this.maskMatrix=new ri}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 zm(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 vE{constructor(e=null){this.type=Ti.NONE,this.autoDetect=!0,this.maskObject=e||null,this.pooled=!1,this.isMaskData=!0,this.resolution=null,this.multisample=ts.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=Ti.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 Ox{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 vE;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!==Ti.SPRITE&&this.maskStack.push(i),i.enabled)switch(i.type){case Ti.SCISSOR:this.renderer.scissor.push(i);break;case Ti.STENCIL:this.renderer.stencil.push(i);break;case Ti.SPRITE:i.copyCountersOrReset(null),this.pushSpriteMask(i);break;case Ti.COLOR:this.pushColorMask(i);break}i.type===Ti.SPRITE&&this.maskStack.push(i)}pop(e){const t=this.maskStack.pop();if(!(!t||t._target!==e)){if(t.enabled)switch(t.type){case Ti.SCISSOR:this.renderer.scissor.pop(t);break;case Ti.STENCIL:this.renderer.stencil.pop(t.maskObject);break;case Ti.SPRITE:this.popSpriteMask(t);break;case Ti.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===Ti.SPRITE&&i._filters&&(i._filters[0].maskSprite=i.maskObject)}}}detect(e){const t=e.maskObject;t?t.isSprite?e.type=Ti.SPRITE:this.enableScissor&&this.renderer.scissor.testScissor(e)?e.type=Ti.SCISSOR:e.type=Ti.STENCIL:e.type=Ti.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 gE])),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}}Ox.extension={type:$e.RendererSystem,name:"mask"};et.add(Ox);class Bx{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 R0=new ri,P0=[],Lx=class Mc extends Bx{constructor(e){super(e),this.glConst=ze.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,P0.pop()??new _t);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()||Mc.isMatrixRotated(t.worldTransform)||Mc.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){Mc.isMatrixRotated(r)||(r=r?R0.copyFrom(r):R0.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&&P0.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)}};Lx.extension={type:$e.RendererSystem,name:"scissor"};let yE=Lx;et.add(yE);class Dx extends Bx{constructor(e){super(e),this.glConst=ze.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)}}Dx.extension={type:$e.RendererSystem,name:"stencil"};et.add(Dx);class Nx{constructor(e){this.renderer=e,this.plugins={},Object.defineProperties(this.plugins,{extract:{enumerable:!1,get(){return Pt("7.0.0","renderer.plugins.extract has moved to renderer.extract"),e.extract}},prepare:{enumerable:!1,get(){return Pt("7.0.0","renderer.plugins.prepare has moved to renderer.prepare"),e.prepare}},interaction:{enumerable:!1,get(){return Pt("7.0.0","renderer.plugins.interaction has been deprecated, use renderer.events"),e.events}}})}init(){const e=this.rendererPlugins;for(const t in e)this.plugins[t]=new e[t](this.renderer)}destroy(){for(const e in this.plugins)this.plugins[e].destroy(),this.plugins[e]=null}}Nx.extension={type:[$e.RendererSystem,$e.CanvasRendererSystem],name:"_plugin"};et.add(Nx);class Ux{constructor(e){this.renderer=e,this.destinationFrame=null,this.sourceFrame=null,this.defaultFrame=null,this.projectionMatrix=new ri,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}}Ux.extension={type:$e.RendererSystem,name:"projection"};et.add(Ux);const xE=new Hm,k0=new _t;class Xx{constructor(e){this.renderer=e,this._tempMatrix=new ri}generateTexture(e,t){const{region:i,...s}=t||{},r=(i==null?void 0:i.copyTo(k0))||e.getLocalBounds(k0,!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=Sa.create(s);this._tempMatrix.tx=-r.x,this._tempMatrix.ty=-r.y;const h=e.transform;return e.transform=xE,this.renderer.render(e,{renderTexture:o,transform:this._tempMatrix,skipUpdateTransform:!!e.parent,blit:!0}),e.transform=h,o}destroy(){}}Xx.extension={type:[$e.RendererSystem,$e.CanvasRendererSystem],name:"textureGenerator"};et.add(Xx);const jr=new _t,Bo=new _t;class Yx{constructor(e){this.renderer=e,this.defaultMaskStack=[],this.current=null,this.sourceFrame=new _t,this.destinationFrame=new _t,this.viewportFrame=new _t}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||(jr.width=e.frame.width,jr.height=e.frame.height,t=jr),i||(Bo.x=e.frame.x,Bo.y=e.frame.y,Bo.width=t.width,Bo.height=t.height,i=Bo),a=r.framebuffer):(o=s.resolution,t||(jr.width=s._view.screen.width,jr.height=s._view.screen.height,t=jr),i||(i=jr,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=Yt.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}}Yx.extension={type:$e.RendererSystem,name:"renderTexture"};et.add(Yx);class bE{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 wE(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=Tx(e,r.type),o={type:a,name:r.name,size:_x(a),location:e.getAttribLocation(n,r.name)};t[r.name]=o}return t}function SE(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=Tx(e,r.type);t[a]={name:a,index:s,type:h,size:r.size,isArray:o,value:wx(h,r.size)}}return t}function _E(n,e){var o;const t=_0(n,n.VERTEX_SHADER,e.vertexSrc),i=_0(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)||QM(n,s,t,i),e.attributeData=wE(s,n),e.uniformData=SE(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:wx(l.type,l.size)}}return new bE(s,a)}function TE(n,e,t,i,s){t.buffer.update(s)}const ME={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];
|
||
}
|
||
`},Vx={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 EE(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=Vx[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 AE(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 CE(n,e){if(!n.autoManage)return{size:0,syncFunc:TE};const t=AE(n.uniforms,e),{uboElements:i,size:s}=EE(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<io.length;u++){const d=io[u];if(d.codeUbo&&d.test(o.data,h)){r.push(`offset = ${o.offset/4};`,io[u].codeUbo(o.data.name,h)),c=!0;break}}if(!c)if(o.data.size>1){const u=_x(o.data.type),d=Math.max(Vx[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=ME[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 IE=0;const Ql={textureCount:0,uboCount:0};class $x{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=IE++}systemCheck(){if(!tE())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||(Ql.textureCount=0,Ql.uboCount=0,this.syncUniformGroup(e.uniformGroup,Ql)),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]=KM(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,Ql,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]=CE(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=_E(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}}$x.extension={type:$e.RendererSystem,name:"shader"};et.add($x);class Qc{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(){}}Qc.defaultOptions={hello:!1},Qc.extension={type:[$e.RendererSystem,$e.CanvasRendererSystem],name:"startup"};et.add(Qc);function RE(n,e=[]){return e[ct.NORMAL]=[n.ONE,n.ONE_MINUS_SRC_ALPHA],e[ct.ADD]=[n.ONE,n.ONE],e[ct.MULTIPLY]=[n.DST_COLOR,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA],e[ct.SCREEN]=[n.ONE,n.ONE_MINUS_SRC_COLOR,n.ONE,n.ONE_MINUS_SRC_ALPHA],e[ct.OVERLAY]=[n.ONE,n.ONE_MINUS_SRC_ALPHA],e[ct.DARKEN]=[n.ONE,n.ONE_MINUS_SRC_ALPHA],e[ct.LIGHTEN]=[n.ONE,n.ONE_MINUS_SRC_ALPHA],e[ct.COLOR_DODGE]=[n.ONE,n.ONE_MINUS_SRC_ALPHA],e[ct.COLOR_BURN]=[n.ONE,n.ONE_MINUS_SRC_ALPHA],e[ct.HARD_LIGHT]=[n.ONE,n.ONE_MINUS_SRC_ALPHA],e[ct.SOFT_LIGHT]=[n.ONE,n.ONE_MINUS_SRC_ALPHA],e[ct.DIFFERENCE]=[n.ONE,n.ONE_MINUS_SRC_ALPHA],e[ct.EXCLUSION]=[n.ONE,n.ONE_MINUS_SRC_ALPHA],e[ct.HUE]=[n.ONE,n.ONE_MINUS_SRC_ALPHA],e[ct.SATURATION]=[n.ONE,n.ONE_MINUS_SRC_ALPHA],e[ct.COLOR]=[n.ONE,n.ONE_MINUS_SRC_ALPHA],e[ct.LUMINOSITY]=[n.ONE,n.ONE_MINUS_SRC_ALPHA],e[ct.NONE]=[0,0],e[ct.NORMAL_NPM]=[n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA],e[ct.ADD_NPM]=[n.SRC_ALPHA,n.ONE,n.ONE,n.ONE],e[ct.SCREEN_NPM]=[n.SRC_ALPHA,n.ONE_MINUS_SRC_COLOR,n.ONE,n.ONE_MINUS_SRC_ALPHA],e[ct.SRC_IN]=[n.DST_ALPHA,n.ZERO],e[ct.SRC_OUT]=[n.ONE_MINUS_DST_ALPHA,n.ZERO],e[ct.SRC_ATOP]=[n.DST_ALPHA,n.ONE_MINUS_SRC_ALPHA],e[ct.DST_OVER]=[n.ONE_MINUS_DST_ALPHA,n.ONE],e[ct.DST_IN]=[n.ZERO,n.SRC_ALPHA],e[ct.DST_OUT]=[n.ZERO,n.ONE_MINUS_SRC_ALPHA],e[ct.DST_ATOP]=[n.ONE_MINUS_DST_ALPHA,n.SRC_ALPHA],e[ct.XOR]=[n.ONE_MINUS_DST_ALPHA,n.ONE_MINUS_SRC_ALPHA],e[ct.SUBTRACT]=[n.ONE,n.ONE,n.ONE,n.ONE,n.FUNC_REVERSE_SUBTRACT,n.FUNC_ADD],e}const PE=0,kE=1,FE=2,OE=3,BE=4,LE=5,Gx=class If{constructor(){this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode=ct.NONE,this._blendEq=!1,this.map=[],this.map[PE]=this.setBlend,this.map[kE]=this.setOffset,this.map[FE]=this.setCullFace,this.map[OE]=this.setDepthTest,this.map[BE]=this.setFrontFace,this.map[LE]=this.setDepthMask,this.checks=[],this.defaultState=new An,this.defaultState.blend=!0}contextChange(e){this.gl=e,this.blendModes=RE(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(If.checkBlendMode,e),this.gl[e?"enable":"disable"](this.gl.BLEND)}setOffset(e){this.updateCheck(If.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}};Gx.extension={type:$e.RendererSystem,name:"state"};let DE=Gx;et.add(DE);class NE extends Il{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 $s(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 jo=class Ec{constructor(e){this.renderer=e,this.count=0,this.checkCount=0,this.maxIdle=Ec.defaultMaxIdle,this.checkCountMax=Ec.defaultCheckCountMax,this.mode=Ec.defaultMode}postrender(){this.renderer.objectRenderer.renderingToScreen&&(this.count++,this.mode!==Vm.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}};jo.defaultMode=Vm.AUTO,jo.defaultMaxIdle=3600,jo.defaultCheckCountMax=600,jo.extension={type:$e.RendererSystem,name:"textureGC"};let Qr=jo;et.add(Qr);class Id{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=Qe.UNSIGNED_BYTE,this.internalFormat=Le.RGBA,this.samplerType=0}}function UE(n){let e;return"WebGL2RenderingContext"in globalThis&&n instanceof globalThis.WebGL2RenderingContext?e={[n.RGB]:qe.FLOAT,[n.RGBA]:qe.FLOAT,[n.ALPHA]:qe.FLOAT,[n.LUMINANCE]:qe.FLOAT,[n.LUMINANCE_ALPHA]:qe.FLOAT,[n.R8]:qe.FLOAT,[n.R8_SNORM]:qe.FLOAT,[n.RG8]:qe.FLOAT,[n.RG8_SNORM]:qe.FLOAT,[n.RGB8]:qe.FLOAT,[n.RGB8_SNORM]:qe.FLOAT,[n.RGB565]:qe.FLOAT,[n.RGBA4]:qe.FLOAT,[n.RGB5_A1]:qe.FLOAT,[n.RGBA8]:qe.FLOAT,[n.RGBA8_SNORM]:qe.FLOAT,[n.RGB10_A2]:qe.FLOAT,[n.RGB10_A2UI]:qe.FLOAT,[n.SRGB8]:qe.FLOAT,[n.SRGB8_ALPHA8]:qe.FLOAT,[n.R16F]:qe.FLOAT,[n.RG16F]:qe.FLOAT,[n.RGB16F]:qe.FLOAT,[n.RGBA16F]:qe.FLOAT,[n.R32F]:qe.FLOAT,[n.RG32F]:qe.FLOAT,[n.RGB32F]:qe.FLOAT,[n.RGBA32F]:qe.FLOAT,[n.R11F_G11F_B10F]:qe.FLOAT,[n.RGB9_E5]:qe.FLOAT,[n.R8I]:qe.INT,[n.R8UI]:qe.UINT,[n.R16I]:qe.INT,[n.R16UI]:qe.UINT,[n.R32I]:qe.INT,[n.R32UI]:qe.UINT,[n.RG8I]:qe.INT,[n.RG8UI]:qe.UINT,[n.RG16I]:qe.INT,[n.RG16UI]:qe.UINT,[n.RG32I]:qe.INT,[n.RG32UI]:qe.UINT,[n.RGB8I]:qe.INT,[n.RGB8UI]:qe.UINT,[n.RGB16I]:qe.INT,[n.RGB16UI]:qe.UINT,[n.RGB32I]:qe.INT,[n.RGB32UI]:qe.UINT,[n.RGBA8I]:qe.INT,[n.RGBA8UI]:qe.UINT,[n.RGBA16I]:qe.INT,[n.RGBA16UI]:qe.UINT,[n.RGBA32I]:qe.INT,[n.RGBA32UI]:qe.UINT,[n.DEPTH_COMPONENT16]:qe.FLOAT,[n.DEPTH_COMPONENT24]:qe.FLOAT,[n.DEPTH_COMPONENT32F]:qe.FLOAT,[n.DEPTH_STENCIL]:qe.FLOAT,[n.DEPTH24_STENCIL8]:qe.FLOAT,[n.DEPTH32F_STENCIL8]:qe.FLOAT}:e={[n.RGB]:qe.FLOAT,[n.RGBA]:qe.FLOAT,[n.ALPHA]:qe.FLOAT,[n.LUMINANCE]:qe.FLOAT,[n.LUMINANCE_ALPHA]:qe.FLOAT,[n.DEPTH_STENCIL]:qe.FLOAT},e}function XE(n){let e;return"WebGL2RenderingContext"in globalThis&&n instanceof globalThis.WebGL2RenderingContext?e={[Qe.UNSIGNED_BYTE]:{[Le.RGBA]:n.RGBA8,[Le.RGB]:n.RGB8,[Le.RG]:n.RG8,[Le.RED]:n.R8,[Le.RGBA_INTEGER]:n.RGBA8UI,[Le.RGB_INTEGER]:n.RGB8UI,[Le.RG_INTEGER]:n.RG8UI,[Le.RED_INTEGER]:n.R8UI,[Le.ALPHA]:n.ALPHA,[Le.LUMINANCE]:n.LUMINANCE,[Le.LUMINANCE_ALPHA]:n.LUMINANCE_ALPHA},[Qe.BYTE]:{[Le.RGBA]:n.RGBA8_SNORM,[Le.RGB]:n.RGB8_SNORM,[Le.RG]:n.RG8_SNORM,[Le.RED]:n.R8_SNORM,[Le.RGBA_INTEGER]:n.RGBA8I,[Le.RGB_INTEGER]:n.RGB8I,[Le.RG_INTEGER]:n.RG8I,[Le.RED_INTEGER]:n.R8I},[Qe.UNSIGNED_SHORT]:{[Le.RGBA_INTEGER]:n.RGBA16UI,[Le.RGB_INTEGER]:n.RGB16UI,[Le.RG_INTEGER]:n.RG16UI,[Le.RED_INTEGER]:n.R16UI,[Le.DEPTH_COMPONENT]:n.DEPTH_COMPONENT16},[Qe.SHORT]:{[Le.RGBA_INTEGER]:n.RGBA16I,[Le.RGB_INTEGER]:n.RGB16I,[Le.RG_INTEGER]:n.RG16I,[Le.RED_INTEGER]:n.R16I},[Qe.UNSIGNED_INT]:{[Le.RGBA_INTEGER]:n.RGBA32UI,[Le.RGB_INTEGER]:n.RGB32UI,[Le.RG_INTEGER]:n.RG32UI,[Le.RED_INTEGER]:n.R32UI,[Le.DEPTH_COMPONENT]:n.DEPTH_COMPONENT24},[Qe.INT]:{[Le.RGBA_INTEGER]:n.RGBA32I,[Le.RGB_INTEGER]:n.RGB32I,[Le.RG_INTEGER]:n.RG32I,[Le.RED_INTEGER]:n.R32I},[Qe.FLOAT]:{[Le.RGBA]:n.RGBA32F,[Le.RGB]:n.RGB32F,[Le.RG]:n.RG32F,[Le.RED]:n.R32F,[Le.DEPTH_COMPONENT]:n.DEPTH_COMPONENT32F},[Qe.HALF_FLOAT]:{[Le.RGBA]:n.RGBA16F,[Le.RGB]:n.RGB16F,[Le.RG]:n.RG16F,[Le.RED]:n.R16F},[Qe.UNSIGNED_SHORT_5_6_5]:{[Le.RGB]:n.RGB565},[Qe.UNSIGNED_SHORT_4_4_4_4]:{[Le.RGBA]:n.RGBA4},[Qe.UNSIGNED_SHORT_5_5_5_1]:{[Le.RGBA]:n.RGB5_A1},[Qe.UNSIGNED_INT_2_10_10_10_REV]:{[Le.RGBA]:n.RGB10_A2,[Le.RGBA_INTEGER]:n.RGB10_A2UI},[Qe.UNSIGNED_INT_10F_11F_11F_REV]:{[Le.RGB]:n.R11F_G11F_B10F},[Qe.UNSIGNED_INT_5_9_9_9_REV]:{[Le.RGB]:n.RGB9_E5},[Qe.UNSIGNED_INT_24_8]:{[Le.DEPTH_STENCIL]:n.DEPTH24_STENCIL8},[Qe.FLOAT_32_UNSIGNED_INT_24_8_REV]:{[Le.DEPTH_STENCIL]:n.DEPTH32F_STENCIL8}}:e={[Qe.UNSIGNED_BYTE]:{[Le.RGBA]:n.RGBA,[Le.RGB]:n.RGB,[Le.ALPHA]:n.ALPHA,[Le.LUMINANCE]:n.LUMINANCE,[Le.LUMINANCE_ALPHA]:n.LUMINANCE_ALPHA},[Qe.UNSIGNED_SHORT_5_6_5]:{[Le.RGB]:n.RGB},[Qe.UNSIGNED_SHORT_4_4_4_4]:{[Le.RGBA]:n.RGBA},[Qe.UNSIGNED_SHORT_5_5_5_1]:{[Le.RGBA]:n.RGBA}},e}class jx{constructor(e){this.renderer=e,this.boundTextures=[],this.currentLocation=-1,this.managedTextures=[],this._unknownBoundTextures=!1,this.unknownTexture=new mt,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=XE(e),this.samplerTypes=UE(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 Id(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 Id(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!==qe.FLOAT&&this.renderer.texture.unbind(a)}}initTexture(e){const t=new Id(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]??qe.FLOAT,this.webGLVersion===2&&e.type===Qe.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!==qe.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&&to(this.managedTextures,s,1)}}updateTextureStyle(e){var i;const t=e._glTextures[this.CONTEXT_UID];t&&((e.mipmap===Cs.POW2||this.webGLVersion!==2)&&!e.isPowerOfTwo?t.mipmap=!1:t.mipmap=e.mipmap>=1,this.webGLVersion!==2&&!e.isPowerOfTwo?t.wrapMode=Vs.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!==Cs.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===Us.LINEAR?i.LINEAR_MIPMAP_LINEAR:i.NEAREST_MIPMAP_NEAREST);const s=this.renderer.context.extensions.anisotropicFiltering;if(s&&e.anisotropicLevel>0&&e.scaleMode===Us.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===Us.LINEAR?i.LINEAR:i.NEAREST);i.texParameteri(e.target,i.TEXTURE_MAG_FILTER,e.scaleMode===Us.LINEAR?i.LINEAR:i.NEAREST)}destroy(){this.renderer=null}}jx.extension={type:$e.RendererSystem,name:"texture"};et.add(jx);class Hx{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}}Hx.extension={type:$e.RendererSystem,name:"transformFeedback"};et.add(Hx);class eh{constructor(e){this.renderer=e}init(e){this.screen=new _t(0,0,e.width,e.height),this.element=e.view||ze.ADAPTER.createCanvas(),this.resolution=e.resolution||ze.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}}eh.defaultOptions={width:800,height:600,resolution:void 0,autoDensity:!1},eh.extension={type:[$e.RendererSystem,$e.CanvasRendererSystem],name:"_view"};et.add(eh);ze.PREFER_ENV=wa.WEBGL2;ze.STRICT_TEXTURE_CACHE=!1;ze.RENDER_OPTIONS={...Jc.defaultOptions,...Zc.defaultOptions,...eh.defaultOptions,...Qc.defaultOptions};Object.defineProperties(ze,{WRAP_MODE:{get(){return mt.defaultOptions.wrapMode},set(n){Pt("7.1.0","settings.WRAP_MODE is deprecated, use BaseTexture.defaultOptions.wrapMode"),mt.defaultOptions.wrapMode=n}},SCALE_MODE:{get(){return mt.defaultOptions.scaleMode},set(n){Pt("7.1.0","settings.SCALE_MODE is deprecated, use BaseTexture.defaultOptions.scaleMode"),mt.defaultOptions.scaleMode=n}},MIPMAP_TEXTURES:{get(){return mt.defaultOptions.mipmap},set(n){Pt("7.1.0","settings.MIPMAP_TEXTURES is deprecated, use BaseTexture.defaultOptions.mipmap"),mt.defaultOptions.mipmap=n}},ANISOTROPIC_LEVEL:{get(){return mt.defaultOptions.anisotropicLevel},set(n){Pt("7.1.0","settings.ANISOTROPIC_LEVEL is deprecated, use BaseTexture.defaultOptions.anisotropicLevel"),mt.defaultOptions.anisotropicLevel=n}},FILTER_RESOLUTION:{get(){return Pt("7.1.0","settings.FILTER_RESOLUTION is deprecated, use Filter.defaultResolution"),ts.defaultResolution},set(n){ts.defaultResolution=n}},FILTER_MULTISAMPLE:{get(){return Pt("7.1.0","settings.FILTER_MULTISAMPLE is deprecated, use Filter.defaultMultisample"),ts.defaultMultisample},set(n){ts.defaultMultisample=n}},SPRITE_MAX_TEXTURES:{get(){return vr.defaultMaxTextures},set(n){Pt("7.1.0","settings.SPRITE_MAX_TEXTURES is deprecated, use BatchRenderer.defaultMaxTextures"),vr.defaultMaxTextures=n}},SPRITE_BATCH_SIZE:{get(){return vr.defaultBatchSize},set(n){Pt("7.1.0","settings.SPRITE_BATCH_SIZE is deprecated, use BatchRenderer.defaultBatchSize"),vr.defaultBatchSize=n}},CAN_UPLOAD_SAME_BUFFER:{get(){return vr.canUploadSameBuffer},set(n){Pt("7.1.0","settings.CAN_UPLOAD_SAME_BUFFER is deprecated, use BatchRenderer.canUploadSameBuffer"),vr.canUploadSameBuffer=n}},GC_MODE:{get(){return Qr.defaultMode},set(n){Pt("7.1.0","settings.GC_MODE is deprecated, use TextureGCSystem.defaultMode"),Qr.defaultMode=n}},GC_MAX_IDLE:{get(){return Qr.defaultMaxIdle},set(n){Pt("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){Pt("7.1.0","settings.GC_MAX_CHECK_COUNT is deprecated, use TextureGCSystem.defaultCheckCountMax"),Qr.defaultCheckCountMax=n}},PRECISION_VERTEX:{get(){return yn.defaultVertexPrecision},set(n){Pt("7.1.0","settings.PRECISION_VERTEX is deprecated, use Program.defaultVertexPrecision"),yn.defaultVertexPrecision=n}},PRECISION_FRAGMENT:{get(){return yn.defaultFragmentPrecision},set(n){Pt("7.1.0","settings.PRECISION_FRAGMENT is deprecated, use Program.defaultFragmentPrecision"),yn.defaultFragmentPrecision=n}}});var va=(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))(va||{});class Rd{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 Wx=class fs{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 Rd(null,null,1/0),this.deltaMS=1/fs.targetFPMS,this.elapsedMS=1/fs.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=va.NORMAL){return this._addListener(new Rd(e,t,i))}addOnce(e,t,i=va.NORMAL){return this._addListener(new Rd(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*fs.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,fs.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(!fs._shared){const e=fs._shared=new fs;e.autoStart=!0,e._protected=!0}return fs._shared}static get system(){if(!fs._system){const e=fs._system=new fs;e.autoStart=!0,e._protected=!0}return fs._system}};Wx.targetFPMS=.06;let is=Wx;Object.defineProperties(ze,{TARGET_FPMS:{get(){return is.targetFPMS},set(n){Pt("7.1.0","settings.TARGET_FPMS is deprecated, use Ticker.targetFPMS"),is.targetFPMS=n}}});class zx{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,va.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=e.sharedTicker?is.shared:new is,e.autoStart&&this.start()}static destroy(){if(this._ticker){const e=this._ticker;this.ticker=null,e.destroy()}}}zx.extension=$e.Application;et.add(zx);const qx=[];et.handleByList($e.Renderer,qx);function YE(n){for(const e of qx)if(e.test(n))return new e(n);throw new Error("Unable to auto-detect a suitable renderer.")}var VE=`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;
|
||
}`,$E=`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 GE=VE,Kx=$E;class Zx{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>=Si.HIGH?this.multisample=Si.HIGH:t>=Si.MEDIUM?this.multisample=Si.MEDIUM:t>=Si.LOW?this.multisample=Si.LOW:this.multisample=Si.NONE}destroy(){}}Zx.extension={type:$e.RendererSystem,name:"_multisample"};et.add(Zx);class jE{constructor(e){this.buffer=e||null,this.updateID=-1,this.byteLength=-1,this.refCount=0}}class Jx{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 jE(i.createBuffer()),this.managedBuffers[e.id]=e,e.disposeRunner.add(this),e._glBuffers[t]}}Jx.extension={type:$e.RendererSystem,name:"buffer"};et.add(Jx);class Qx{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}}Qx.extension={type:$e.RendererSystem,name:"objectRenderer"};et.add(Qx);const Ac=class Rf extends NE{constructor(e){super(),this.type=Qy.WEBGL,e=Object.assign({},ze.RENDER_OPTIONS,e),this.gl=null,this.CONTEXT_UID=0,this.globalUniforms=new Gs({projectionMatrix:new ri},!0);const t={runners:["init","destroy","contextChange","resolutionChange","reset","update","postrender","prerender","resize"],systems:Rf.__systems,priority:["_view","textureGenerator","background","_plugin","startup","context","state","texture","buffer","geometry","framebuffer","transformFeedback","mask","scissor","stencil","projection","textureGC","filter","renderTexture","batch","objectRenderer","_multisample"]};this.setup(t),"useContextAlpha"in e&&(Pt("7.0.0","options.useContextAlpha is deprecated, use options.premultipliedAlpha and options.backgroundAlpha instead"),e.premultipliedAlpha=e.useContextAlpha&&e.useContextAlpha!=="notMultiplied",e.backgroundAlpha=e.useContextAlpha===!1?1:e.backgroundAlpha),this._plugin.rendererPlugins=Rf.__plugins,this.options=e,this.startup.run(this.options)}static test(e){return e!=null&&e.forceCanvas?!1:pM()}render(e,t){this.objectRenderer.render(e,t)}resize(e,t){this._view.resizeView(e,t)}reset(){return this.runners.reset.emit(),this}clear(){this.renderTexture.bind(),this.renderTexture.clear()}destroy(e=!1){this.runners.destroy.items.reverse(),this.emitWithCustomOptions(this.runners.destroy,{_view:e}),super.destroy()}get plugins(){return this._plugin.plugins}get multisample(){return this._multisample.multisample}get width(){return this._view.element.width}get height(){return this._view.element.height}get resolution(){return this._view.resolution}set resolution(e){this._view.resolution=e,this.runners.resolutionChange.emit(e)}get autoDensity(){return this._view.autoDensity}get view(){return this._view.element}get screen(){return this._view.screen}get lastObjectRendered(){return this.objectRenderer.lastObjectRendered}get renderingToScreen(){return this.objectRenderer.renderingToScreen}get rendererLogId(){return`WebGL ${this.context.webGLVersion}`}get clearBeforeRender(){return Pt("7.0.0","renderer.clearBeforeRender has been deprecated, please use renderer.background.clearBeforeRender instead."),this.background.clearBeforeRender}get useContextAlpha(){return Pt("7.0.0","renderer.useContextAlpha has been deprecated, please use renderer.context.premultipliedAlpha instead."),this.context.useContextAlpha}get preserveDrawingBuffer(){return Pt("7.0.0","renderer.preserveDrawingBuffer has been deprecated, we cannot truly know this unless pixi created the context"),this.context.preserveDrawingBuffer}get backgroundColor(){return Pt("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color}set backgroundColor(e){Pt("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color=e}get backgroundAlpha(){return Pt("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha}set backgroundAlpha(e){Pt("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha=e}get powerPreference(){return Pt("7.0.0","renderer.powerPreference has been deprecated, we can only know this if pixi creates the context"),this.context.powerPreference}generateTexture(e,t){return this.textureGenerator.generateTexture(e,t)}};Ac.extension={type:$e.Renderer,priority:1},Ac.__plugins={},Ac.__systems={};let qm=Ac;et.handleByMap($e.RendererPlugin,qm.__plugins);et.handleByMap($e.RendererSystem,qm.__systems);et.add(qm);class e1 extends yl{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 mt;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 yl?this.addResourceAt(e[i],i):this.addResourceAt(yx(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 HE extends e1{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=eo.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 WE extends rr{constructor(e){super(e)}static test(e){const{OffscreenCanvas:t}=globalThis;return t&&e instanceof t?!0:globalThis.HTMLCanvasElement&&e instanceof HTMLCanvasElement}}const t1=class Ho extends e1{constructor(e,t){const{width:i,height:s,autoLoad:r,linkBaseTexture:a}=t||{};if(e&&e.length!==Ho.SIDES)throw new Error(`Invalid length. Got ${e.length}, expected 6`);super(6,{width:i,height:s});for(let o=0;o<Ho.SIDES;o++)this.items[o].target=eo.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=eo.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=eo.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<Ho.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===Ho.SIDES}};t1.SIDES=6;let zE=t1;class Ha extends rr{constructor(e,t){t=t||{};let i,s,r;typeof e=="string"?(i=Ha.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 ze.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===Fi.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 Ha._EMPTY=Ha._EMPTY??ze.ADAPTER.createCanvas(0,0),Ha._EMPTY}}const Pf=class Cc extends rr{constructor(e,t){t=t||{},super(ze.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)},Cc.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;rr.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_${ga()}`,a.getContext("2d").drawImage(e,0,0,t,i,0,0,s,r),this._resolve(),this._resolve=null}}static getSize(e){const t=Cc.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"&&Cc.SVG_XML.test(e)}};Pf.SVG_XML=/^(<\?xml[^?]+\?>)?\s*(<!--[^(-->)]*-->)?\s*\<svg/m,Pf.SVG_SIZE=/<svg[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i;let kf=Pf;class qE extends rr{constructor(e){super(e)}static test(e){return!!globalThis.VideoFrame&&e instanceof globalThis.VideoFrame}}const Ff=class Of extends rr{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];rr.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||Of.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=is.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&&(is.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||(is.shared.add(this.update,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.source.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(is.shared.remove(this.update,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(e,t){return globalThis.HTMLVideoElement&&e instanceof HTMLVideoElement||Of.TYPES.includes(t)}};Ff.TYPES=["mp4","m4v","webm","ogg","ogv","h264","avi","mov"],Ff.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};let i1=Ff;bf.push(Ha,Cx,WE,i1,qE,kf,Wh,zE,HE);class xl{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?_t.EMPTY:(e=e||new _t(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,v=a*t+h*i+c,y=o*t+l*i+u;d=v<d?v:d,f=y<f?y:f,p=v>p?v:p,m=y>m?y:m,v=a*s+h*i+c,y=o*s+l*i+u,d=v<d?v:d,f=y<f?y:f,p=v>p?v:p,m=y>m?y:m,v=a*t+h*r+c,y=o*t+l*r+u,d=v<d?v:d,f=y<f?y:f,p=v>p?v:p,m=y>m?y:m,v=a*s+h*r+c,y=o*s+l*r+u,d=v<d?v:d,f=y<f?y:f,p=v>p?v: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,v=this.maxY;for(let y=i;y<s;y+=2){const b=t[y],g=t[y+1],w=o*b+l*g+u,E=c*g+h*b+d;f=Math.min(f,w-r),m=Math.max(m,w+r),p=Math.min(p,E-a),v=Math.max(v,E+a)}this.minX=f,this.minY=p,this.maxX=m,this.maxY=v}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 di extends Il{constructor(){super(),this.tempDisplayObjectParent=null,this.transform=new Hm,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 xl,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(di.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 _t),t=this._boundsRect),this._bounds.getRectangle(t)}getLocalBounds(e){e||(this._localBoundsRect||(this._localBoundsRect=new _t),e=this._localBoundsRect),this._localBounds||(this._localBounds=new xl);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 KE),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*$M}set angle(e){this.transform.rotation=e*GM}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 KE extends di{constructor(){super(...arguments),this.sortDirty=null}}di.prototype.displayObjectUpdateTransform=di.prototype.updateTransform;const ZE=new ri;function JE(n,e){return n.zIndex===e.zIndex?n._lastSortedIndex-e._lastSortedIndex:n.zIndex-e.zIndex}const s1=class Bf extends di{constructor(){super(),this.children=[],this.sortableChildren=Bf.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);to(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,to(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,to(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(JE),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!==Bf.prototype._render&&(i=this.getBounds(!0));const r=e.projection.transform;if(r&&(s?(s=ZE.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!==Ti.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}};s1.defaultSortableChildren=!1;let Vi=s1;Vi.prototype.containerUpdateTransform=Vi.prototype.updateTransform;Object.defineProperties(ze,{SORTABLE_CHILDREN:{get(){return Vi.defaultSortableChildren},set(n){Pt("7.1.0","settings.SORTABLE_CHILDREN is deprecated, use Container.defaultSortableChildren"),Vi.defaultSortableChildren=n}}});const Lo=new Dt,QE=new Uint16Array([0,1,2,0,2,3]);class Dr extends Vi{constructor(e){super(),this._anchor=new Hn(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 Yt(16777215),this._tintRGB=null,this.tint=16777215,this.blendMode=ct.NORMAL,this._cachedTint=16777215,this.uvs=null,this.texture=e||ht.EMPTY,this.vertexData=new Float32Array(8),this.vertexTrimmedData=null,this._transformID=-1,this._textureID=-1,this._transformTrimmedID=-1,this._textureTrimmedID=-1,this.indices=QE,this.pluginName="batch",this.isSprite=!0,this._roundPixels=ze.ROUND_PIXELS}_onTextureUpdate(){this._textureID=-1,this._textureTrimmedID=-1,this._cachedTint=16777215,this._width&&(this.scale.x=Ar(this.scale.x)*this._width/this._texture.orig.width),this._height&&(this.scale.y=Ar(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,v=0;if(c?(p=c.x-d._x*u.width,f=p+c.width,v=c.y-d._y*u.height,m=v+c.height):(p=-d._x*u.width,f=p+u.width,v=-d._y*u.height,m=v+u.height),l[0]=i*p+r*v+o,l[1]=a*v+s*p+h,l[2]=i*f+r*v+o,l[3]=a*v+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=ze.RESOLUTION;for(let b=0;b<l.length;++b)l[b]=Math.round(l[b]*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 v=ze.RESOLUTION;for(let y=0;y<t.length;++y)t[y]=Math.round(t[y]*v)/v}}_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 xl),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 _t),e=this._localBoundsRect),this._localBounds.getRectangle(e)):super.getLocalBounds.call(this,e)}containsPoint(e){this.worldTransform.applyInverse(e,Lo);const t=this._texture.orig.width,i=this._texture.orig.height,s=-t*this.anchor.x;let r=0;return Lo.x>=s&&Lo.x<s+t&&(r=-i*this.anchor.y,Lo.y>=r&&Lo.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 ht?e:ht.from(e,t);return new Dr(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=Ar(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=Ar(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||ht.EMPTY,this._cachedTint=16777215,this._textureID=-1,this._textureTrimmedID=-1,e&&(e.baseTexture.valid?this._onTextureUpdate():e.once("update",this._onTextureUpdate,this)))}}const n1=new ri;di.prototype._cacheAsBitmap=!1;di.prototype._cacheData=null;di.prototype._cacheAsBitmapResolution=null;di.prototype._cacheAsBitmapMultisample=null;class eA{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(di.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 eA),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)}}});di.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))};di.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 _t,!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=Sa.create({width:t.width,height:t.height,resolution:i,multisample:this.cacheAsBitmapMultisample??n.multisample}),l=`cacheAsBitmap_${ga()}`;this._cacheData.textureCacheId=l,mt.addToCache(h.baseTexture,l),ht.addToCache(h,l);const c=this.transform.localTransform.copyTo(n1).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 Dr(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)};di.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))};di.prototype._initCachedDisplayObjectCanvas=function(n){var c;if((c=this._cacheData)!=null&&c.sprite)return;const e=this.getLocalBounds(new _t,!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=Sa.create({width:e.width,height:e.height,resolution:r}),o=`cacheAsBitmap_${ga()}`;this._cacheData.textureCacheId=o,mt.addToCache(a.baseTexture,o),ht.addToCache(a,o);const h=n1;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 Dr(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)};di.prototype._calculateCachedBounds=function(){this._bounds.clear(),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite._calculateBounds(),this._bounds.updateID=this._boundsID};di.prototype._getCachedLocalBounds=function(){return this._cacheData.sprite.getLocalBounds(null)};di.prototype._destroyCachedDisplayObject=function(){this._cacheData.sprite._texture.destroy(!0),this._cacheData.sprite=null,mt.removeFromCache(this._cacheData.textureCacheId),ht.removeFromCache(this._cacheData.textureCacheId),this._cacheData.textureCacheId=null};di.prototype._cacheAsBitmapDestroy=function(n){this.cacheAsBitmap=!1,this.destroy(n)};di.prototype.name=null;Vi.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};di.prototype.getGlobalPosition=function(n=new Dt,e=!1){return this.parent?this.parent.toGlobal(this.position,n,e):(n.x=this.position.x,n.y=this.position.y),n};var tA=`varying vec2 vTextureCoord;
|
||
|
||
uniform sampler2D uSampler;
|
||
uniform float uAlpha;
|
||
|
||
void main(void)
|
||
{
|
||
gl_FragColor = texture2D(uSampler, vTextureCoord) * uAlpha;
|
||
}
|
||
`;class iA extends ts{constructor(e=1){super(GE,tA,{uAlpha:1}),this.alpha=e}get alpha(){return this.uniforms.uAlpha}set alpha(e){this.uniforms.uAlpha=e}}const sA={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]},nA=["varying vec2 vBlurTexCoords[%size%];","uniform sampler2D uSampler;","void main(void)","{"," gl_FragColor = vec4(0.0);"," %blur%","}"].join(`
|
||
`);function rA(n){const e=sA[n],t=e.length;let i=nA,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 aA=`
|
||
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 oA(n,e){const t=Math.ceil(n/2);let i=aA,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 Lf extends ts{constructor(e,t=8,i=4,s=ts.defaultResolution,r=5){const a=oA(r,e),o=rA(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,mn.CLEAR);for(let l=1;l<this.passes-1;l++){e.bindAndClear(o,mn.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 lA extends ts{constructor(e=8,t=4,i=ts.defaultResolution,s=5){super(),this._repeatEdgePixels=!1,this.blurXFilter=new Lf(!0,e,t,i,s),this.blurYFilter=new Lf(!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,mn.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 cA=`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 Df extends ts{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(Kx,cA,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]=Yt.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,v=i+a*(1-i),y=[h,l,c,0,0,u,d,f,0,0,p,m,v,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=Yt.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}}Df.prototype.grayscale=Df.prototype.greyscale;var hA=`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));
|
||
}
|
||
`,uA=`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 dA extends ts{constructor(e,t){const i=new ri;e.renderable=!1,super(uA,hA,{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 Dt(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 fA=`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;
|
||
}
|
||
`,mA=`
|
||
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 pA extends ts{constructor(){super(mA,fA)}}var gA=`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 vA extends ts{constructor(e=.5,t=Math.random()){super(Kx,gA,{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 F0={AlphaFilter:iA,BlurFilter:lA,BlurFilterPass:Lf,ColorMatrixFilter:Df,DisplacementFilter:dA,FXAAFilter:pA,NoiseFilter:vA};Object.entries(F0).forEach(([n,e])=>{Object.defineProperty(F0,n,{get(){return Pt("7.1.0",`filters.${n} has moved to ${n}`),e}})});class yA{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||(is.system.add(this.tickerUpdate,this,va.INTERACTION),this.tickerAdded=!0)}removeTickerListener(){this.tickerAdded&&(is.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 _r=new yA;class Rl{constructor(e){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=Rl.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new Dt,this.page=new Dt,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 th extends Rl{constructor(){super(...arguments),this.client=new Dt,this.movement=new Dt,this.offset=new Dt,this.global=new Dt,this.screen=new Dt}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 Bs extends th{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 so extends th{constructor(){super(...arguments),this.DOM_DELTA_PIXEL=0,this.DOM_DELTA_LINE=1,this.DOM_DELTA_PAGE=2}}so.DOM_DELTA_PIXEL=0,so.DOM_DELTA_LINE=1,so.DOM_DELTA_PAGE=2;const xA=2048,bA=new Dt,Pd=new Dt;class wA{constructor(e){this.dispatch=new Il,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){_r.pauseUpdate=!0;const i=this._isPointerMoveEvent&&this.enableGlobalMoveEvents?"hitTestMoveRecursive":"hitTestRecursive",s=this[i](this.rootTarget,this.rootTarget.eventMode,bA.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<xA&&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")&&(_r.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")&&(_r.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,Pd),!e.hitArea.contains(Pd.x,Pd.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 Bs)){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 Bs)){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 Bs)){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 Bs)){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 Bs)){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 Bs)){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 so)){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(Bs);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(so);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(Bs);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 Bs&&t instanceof Bs&&(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 th&&t instanceof th&&(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 SA=1,_A={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},Nf=class Uf{constructor(e){this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.domElement=null,this.resolution=1,this.renderer=e,this.rootBoundary=new wA(null),_r.init(this),this.autoPreventDefault=!0,this.eventsAdded=!1,this.rootPointerEvent=new Bs(null),this.rootWheelEvent=new so(null),this.cursorStyles={default:"inherit",pointer:"pointer"},this.features=new Proxy({...Uf.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,Uf._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,_r.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,_r.domElement=e,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;_r.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;_r.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=SA),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=_A[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}};Nf.extension={name:"events",type:[$e.RendererSystem,$e.CanvasRendererSystem]},Nf.defaultEventFeatures={move:!0,globalMove:!0,click:!0,wheel:!0};let Xf=Nf;et.add(Xf);function O0(n){return n==="dynamic"||n==="static"}const TA={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??O0(Xf.defaultEventMode)},set interactive(n){Pt("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??Xf.defaultEventMode},set eventMode(n){this._internalInteractive=O0(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 Rl))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}};di.mixin(TA);const MA={accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:!1,_accessibleDiv:null,accessibleType:"button",accessiblePointerEvents:"auto",accessibleChildren:!0,renderId:-1};di.mixin(MA);const EA=9,ec=100,AA=0,CA=0,B0=2,L0=1,IA=-1e3,RA=-1e3,PA=2;class r1{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,(jn.tablet||jn.phone)&&this.createTouchHook();const t=document.createElement("div");t.style.width=`${ec}px`,t.style.height=`${ec}px`,t.style.position="absolute",t.style.top=`${AA}px`,t.style.left=`${CA}px`,t.style.zIndex=B0.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=`${L0}px`,e.style.height=`${L0}px`,e.style.position="absolute",e.style.top=`${IA}px`,e.style.left=`${RA}px`,e.style.zIndex=PA.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(jn.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,to(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=`${ec}px`,t.style.height=`${ec}px`,t.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",t.style.position="absolute",t.style.zIndex=B0.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 Rl(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===EA&&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}}r1.extension={name:"accessibility",type:[$e.RendererPlugin,$e.CanvasRendererPlugin]};et.add(r1);const a1=class Yf{constructor(e){this.stage=new Vi,e=Object.assign({forceCanvas:!1},e),this.renderer=YE(e),Yf._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=Yf._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}};a1._plugins=[];let o1=a1;et.handleByList($e.Application,o1._plugins);class l1{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}}l1.extension=$e.Application;et.add(l1);const D0={loader:$e.LoadParser,resolver:$e.ResolveParser,cache:$e.CacheParser,detection:$e.DetectionParser};et.handle($e.Asset,n=>{const e=n.ref;Object.entries(D0).filter(([t])=>!!e[t]).forEach(([t,i])=>et.add(Object.assign(e[t],{extension:e[t].extension??i})))},n=>{const e=n.ref;Object.keys(D0).filter(t=>!!e[t]).forEach(t=>et.remove(e[t]))});class kA{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 To(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 hs(n,e){const t=n.split("?")[0],i=pi.extname(t).toLowerCase();return Array.isArray(e)?e.includes(i):i===e}const Ds=(n,e,t=!1)=>(Array.isArray(n)||(n=[n]),e?n.map(i=>typeof i=="string"||t?e(i):i):n),ih=(n,e)=>{const t=e.split("?")[1];return t&&(n+=`?${t}`),n};function c1(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?c1(n.replace(i[t],o),e,t+1,i,s):s.push(n.replace(i[t],o))}}function FA(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)}),c1(n,s,0,t,i)}else i.push(n);return i}const sh=n=>!Array.isArray(n);class OA{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=Ds(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 ht){const o=t;i.forEach(h=>{o.baseTexture!==ht.EMPTY.baseTexture&&mt.addToCache(o.baseTexture,h),ht.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 ea=new OA;class BA{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=sh(e),a=Ds(e,l=>({alias:[l],src:l})),o=a.length,h=a.map(async l=>{const c=pi.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=Ds(e,i=>({alias:[i],src:i})).map(async i=>{var a,o;const s=pi.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 xs=(n=>(n[n.Low=0]="Low",n[n.Normal=1]="Normal",n[n.High=2]="High",n))(xs||{});const LA=".json",DA="application/json",NA={extension:{type:$e.LoadParser,priority:xs.Low},name:"loadJson",test(n){return To(n,DA)||hs(n,LA)},async load(n){return await(await ze.ADAPTER.fetch(n)).json()}};et.add(NA);const UA=".txt",XA="text/plain",YA={name:"loadTxt",extension:{type:$e.LoadParser,priority:xs.Low},test(n){return To(n,XA)||hs(n,UA)},async load(n){return await(await ze.ADAPTER.fetch(n)).text()}};et.add(YA);const VA=["normal","bold","100","200","300","400","500","600","700","800","900"],$A=[".ttf",".otf",".woff",".woff2"],GA=["font/ttf","font/otf","font/woff","font/woff2"],jA=/^(--|-?[A-Z_])[0-9A-Z_-]*$/i;function HA(n){const e=pi.extname(n),t=pi.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(jA)){i=!1;break}let s=t.join(" ");return i||(s=`"${s.replace(/[\\"]/g,"\\$&")}"`),s}const WA=/^[0-9A-Za-z%:/?#\[\]@!\$&'()\*\+,;=\-._~]*$/;function zA(n){return WA.test(n)?n:encodeURI(n)}const qA={extension:{type:$e.LoadParser,priority:xs.Low},name:"loadWebFont",test(n){return To(n,GA)||hs(n,$A)},async load(n,e){var i,s,r;const t=ze.ADAPTER.getFontFaceSet();if(t){const a=[],o=((i=e.data)==null?void 0:i.family)??HA(n),h=((r=(s=e.data)==null?void 0:s.weights)==null?void 0:r.filter(c=>VA.includes(c)))??["normal"],l=e.data??{};for(let c=0;c<h.length;c++){const u=h[c],d=new FontFace(o,`url(${zA(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=>ze.ADAPTER.getFontFaceSet().delete(e))}};et.add(qA);const KA=`(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 no=null,Vf=class{constructor(){no||(no=URL.createObjectURL(new Blob([KA],{type:"application/javascript"}))),this.worker=new Worker(no)}};Vf.revokeObjectURL=function(){no&&(URL.revokeObjectURL(no),no=null)};const ZA=`(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 ro=null;class h1{constructor(){ro||(ro=URL.createObjectURL(new Blob([ZA],{type:"application/javascript"}))),this.worker=new Worker(ro)}}h1.revokeObjectURL=function(){ro&&(URL.revokeObjectURL(ro),ro=null)};let N0=0,kd;class JA{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 Vf;t.addEventListener("message",i=>{t.terminate(),Vf.revokeObjectURL(),e(i.data)})}),this._isImageBitmapSupported)}loadImageBitmap(e){return this._run("loadImageBitmap",[e])}async _initWorkers(){this._initialized||(this._initialized=!0)}getWorker(){kd===void 0&&(kd=navigator.hardwareConcurrency||4);let e=this.workerPool.pop();return!e&&this._createdWorkers<kd&&(this._createdWorkers++,e=new h1().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[N0]={resolve:t.resolve,reject:t.reject},e.postMessage({data:t.arguments,uuid:N0++,id:i})}}const U0=new JA;function Pl(n,e,t){n.resource.internal=!0;const i=new ht(n),s=()=>{delete e.promiseCache[t],ea.has(t)&&ea.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 QA=[".jpeg",".jpg",".png",".webp",".avif"],eC=["image/jpeg","image/png","image/webp","image/avif"];async function tC(n){const e=await ze.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 Jh={name:"loadTextures",extension:{type:$e.LoadParser,priority:xs.High},config:{preferWorkers:!0,preferCreateImageBitmap:!0,crossOrigin:"anonymous"},test(n){return To(n,eC)||hs(n,QA)},async load(n,e,t){var o;const i=globalThis.createImageBitmap&&this.config.preferCreateImageBitmap;let s;i?this.config.preferWorkers&&await U0.isImageBitmapSupported()?s=await U0.loadImageBitmap(n):s=await tC(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=nr(n)),i&&((o=r.resourceOptions)==null?void 0:o.ownsImageBitmap)===void 0&&(r.resourceOptions={...r.resourceOptions},r.resourceOptions.ownsImageBitmap=!0);const a=new mt(s,r);return a.resource.src=n,Pl(a,t,n)},unload(n){n.destroy(!0)}};et.add(Jh);const iC=".svg",sC="image/svg+xml",nC={extension:{type:$e.LoadParser,priority:xs.High},name:"loadSVG",test(n){return To(n,sC)||hs(n,iC)},async testParse(n){return kf.test(n)},async parse(n,e,t){var r;const i=new kf(n,(r=e==null?void 0:e.data)==null?void 0:r.resourceOptions);await i.load();const s=new mt(i,{resolution:nr(n),...e==null?void 0:e.data});return s.resource.src=e.src,Pl(s,t,e.src)},async load(n,e){return(await ze.ADAPTER.fetch(n)).text()},unload:Jh.unload};et.add(nC);const rC=[".mp4",".m4v",".webm",".ogv"],aC=["video/mp4","video/webm","video/ogg"],oC={name:"loadVideo",extension:{type:$e.LoadParser,priority:xs.High},config:{defaultAutoPlay:!0,defaultUpdateFPS:0,defaultLoop:!1,defaultMuted:!1,defaultPlaysinline:!0},test(n){return To(n,aC)||hs(n,rC)},async load(n,e,t){var a;let i;const s=await(await ze.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 i1(r,o);await h.load();const l=new mt(h,{alphaMode:await mM(),resolution:nr(n),...e==null?void 0:e.data});l.resource.src=n,i=Pl(l,t,n),i.baseTexture.once("destroyed",()=>{URL.revokeObjectURL(r)})}catch(o){throw URL.revokeObjectURL(r),o}return i},unload(n){n.destroy(!0)}};et.add(oC);class lC{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 Ds(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"?(Pt("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`)},Ds(a).forEach(h=>{const{src:l,srcs:c}=h;let{data:u,format:d,loadParser:f}=h;const p=Ds(l||c).map(y=>typeof y=="string"?FA(y):Array.isArray(y)?y:[y]),m=this.getAlias(h);Array.isArray(m)?m.forEach(o):o(m);const v=[];p.forEach(y=>{y.forEach(b=>{let g={};if(typeof b!="object"){g.src=b;for(let w=0;w<this._parsers.length;w++){const E=this._parsers[w];if(E.test(b)){g=E.parse(b);break}}}else u=b.data??u,d=b.format??d,f=b.loadParser??f,g={...g,...b};if(!m)throw new Error(`[Resolver] alias is undefined for this asset: ${g.src}`);g=this.buildResolvedAsset(g,{aliases:m,data:u,format:d,loadParser:f}),v.push(g)})}),m.forEach(y=>{this._assetMap[y]=v})})}resolveBundle(e){const t=sh(e);e=Ds(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=sh(e);e=Ds(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=pi.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??pi.extname(e.src).slice(1),e.srcs=e.src,e.name=e.alias,e}}class cC{constructor(){this._detections=[],this._initialized=!1,this.resolver=new lC,this.loader=new BA,this.cache=ea,this._backgroundLoader=new kA(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=sh(e),s=Ds(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 ea.get(e);const t={};for(let i=0;i<e.length;i++)t[i]=ea.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,ea.set(c,l)}),a}async unload(e){this._initialized||await this.init();const t=Ds(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=Ds(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=>{ea.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 Jh.config.preferWorkers}set preferWorkers(e){Pt("7.2.0","Assets.prefersWorkers is deprecated, use Assets.setPreferences({ preferWorkers: true }) instead."),this.setPreferences({preferWorkers:e})}setPreferences(e){this.loader.parsers.forEach(t=>{t.config&&Object.keys(t.config).filter(i=>i in e).forEach(i=>{t.config[i]=e[i]})})}}const xn=new cC;et.handleByList($e.LoadParser,xn.loader.parsers).handleByList($e.ResolveParser,xn.resolver.parsers).handleByList($e.CacheParser,xn.cache.parsers).handleByList($e.DetectionParser,xn.detections);const hC={extension:$e.CacheParser,test:n=>Array.isArray(n)&&n.every(e=>e instanceof ht),getCacheableAssets:(n,e)=>{const t={};return n.forEach(i=>{e.forEach((s,r)=>{t[i+(r===0?"":r+1)]=s})}),t}};et.add(hC);async function u1(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 uC={extension:{type:$e.DetectionParser,priority:1},test:async()=>u1("data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A="),add:async n=>[...n,"avif"],remove:async n=>n.filter(e=>e!=="avif")};et.add(uC);const dC={extension:{type:$e.DetectionParser,priority:0},test:async()=>u1("data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA="),add:async n=>[...n,"webp"],remove:async n=>n.filter(e=>e!=="webp")};et.add(dC);const X0=["png","jpg","jpeg"],fC={extension:{type:$e.DetectionParser,priority:-1},test:()=>Promise.resolve(!0),add:async n=>[...n,...X0],remove:async n=>n.filter(e=>!X0.includes(e))};et.add(fC);const mC="WorkerGlobalScope"in globalThis&&globalThis instanceof globalThis.WorkerGlobalScope;function Km(n){return mC?!1:document.createElement("video").canPlayType(n)!==""}const pC={extension:{type:$e.DetectionParser,priority:0},test:async()=>Km("video/webm"),add:async n=>[...n,"webm"],remove:async n=>n.filter(e=>e!=="webm")};et.add(pC);const gC={extension:{type:$e.DetectionParser,priority:0},test:async()=>Km("video/mp4"),add:async n=>[...n,"mp4","m4v"],remove:async n=>n.filter(e=>e!=="mp4"&&e!=="m4v")};et.add(gC);const vC={extension:{type:$e.DetectionParser,priority:0},test:async()=>Km("video/ogg"),add:async n=>[...n,"ogv"],remove:async n=>n.filter(e=>e!=="ogv")};et.add(vC);const yC={extension:$e.ResolveParser,test:Jh.test,parse:n=>{var e;return{resolution:parseFloat(((e=ze.RETINA_PREFIX.exec(n))==null?void 0:e[1])??"1"),format:pi.extname(n).slice(1),src:n}}};et.add(yC);var Li=(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))(Li||{});const nh={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 tn,$a;function Y0(){$a={bptc:tn.getExtension("EXT_texture_compression_bptc"),astc:tn.getExtension("WEBGL_compressed_texture_astc"),etc:tn.getExtension("WEBGL_compressed_texture_etc"),s3tc:tn.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:tn.getExtension("WEBGL_compressed_texture_s3tc_srgb"),pvrtc:tn.getExtension("WEBGL_compressed_texture_pvrtc")||tn.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),etc1:tn.getExtension("WEBGL_compressed_texture_etc1"),atc:tn.getExtension("WEBGL_compressed_texture_atc")}}const xC={extension:{type:$e.DetectionParser,priority:2},test:async()=>{const n=ze.ADAPTER.createCanvas().getContext("webgl");return n?(tn=n,!0):(console.warn("WebGL not available for compressed textures."),!1)},add:async n=>{$a||Y0();const e=[];for(const t in $a)$a[t]&&e.push(t);return[...e,...n]},remove:async n=>($a||Y0(),n.filter(e=>!(e in $a)))};et.add(xC);class bC extends Wh{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 xf(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 xf(e),this.loaded=!0,this.onBlobLoaded(e),this.update(),this)),this._load)}}class da extends bC{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=da._formatToExtension(this.format),(t.levelBuffers||this.buffer)&&(this._levelBuffers=t.levelBuffers||da._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=da._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*nh[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*nh[t];return h}}const Fd=4,tc=124,wC=32,V0=20,SC=542327876,ic={HEIGHT:3,WIDTH:4,MIPMAP_COUNT:7,PIXEL_FORMAT:19},_C={FOURCC:2},sc={DXGI_FORMAT:0,RESOURCE_DIMENSION:1,MISC_FLAG:2,ARRAY_SIZE:3},TC=1,MC=2,EC=4,AC=64,CC=512,IC=131072,RC=827611204,PC=861165636,kC=894720068,FC=808540228,OC=4,BC={[RC]:Li.COMPRESSED_RGBA_S3TC_DXT1_EXT,[PC]:Li.COMPRESSED_RGBA_S3TC_DXT3_EXT,[kC]:Li.COMPRESSED_RGBA_S3TC_DXT5_EXT},LC={70:Li.COMPRESSED_RGBA_S3TC_DXT1_EXT,71:Li.COMPRESSED_RGBA_S3TC_DXT1_EXT,73:Li.COMPRESSED_RGBA_S3TC_DXT3_EXT,74:Li.COMPRESSED_RGBA_S3TC_DXT3_EXT,76:Li.COMPRESSED_RGBA_S3TC_DXT5_EXT,77:Li.COMPRESSED_RGBA_S3TC_DXT5_EXT,72:Li.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,75:Li.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,78:Li.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT,96:Li.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT,95:Li.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT,98:Li.COMPRESSED_RGBA_BPTC_UNORM_EXT,99:Li.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT};function DC(n){const e=new Uint32Array(n);if(e[0]!==SC)throw new Error("Invalid DDS file magic word");const t=new Uint32Array(n,0,tc/Uint32Array.BYTES_PER_ELEMENT),i=t[ic.HEIGHT],s=t[ic.WIDTH],r=t[ic.MIPMAP_COUNT],a=new Uint32Array(n,ic.PIXEL_FORMAT*Uint32Array.BYTES_PER_ELEMENT,wC/Uint32Array.BYTES_PER_ELEMENT),o=a[TC];if(o&EC){const h=a[_C.FOURCC];if(h!==FC){const b=BC[h],g=Fd+tc,w=new Uint8Array(n,g);return[new da(w,{format:b,width:s,height:i,levels:r})]}const l=Fd+tc,c=new Uint32Array(e.buffer,l,V0/Uint32Array.BYTES_PER_ELEMENT),u=c[sc.DXGI_FORMAT],d=c[sc.RESOURCE_DIMENSION],f=c[sc.MISC_FLAG],p=c[sc.ARRAY_SIZE],m=LC[u];if(m===void 0)throw new Error(`DDSParser cannot parse texture data with DXGI format ${u}`);if(f===OC)throw new Error("DDSParser does not support cubemap textures");if(d===6)throw new Error("DDSParser does not supported 3D texture data");const v=new Array,y=Fd+tc+V0;if(p===1)v.push(new Uint8Array(n,y));else{const b=nh[m];let g=0,w=s,E=i;for(let _=0;_<r;_++){const I=Math.max(1,w+3&-4),R=Math.max(1,E+3&-4),F=I*R*b;g+=F,w=w>>>1,E=E>>>1}let M=y;for(let _=0;_<p;_++)v.push(new Uint8Array(n,M,g)),M+=g}return v.map(b=>new da(b,{format:m,width:s,height:i,levels:r}))}throw o&AC?new Error("DDSParser does not support uncompressed texture data."):o&CC?new Error("DDSParser does not supported YUV uncompressed texture data."):o&IC?new Error("DDSParser does not support single-channel (lumninance) texture data!"):o&MC?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 $0=[171,75,84,88,32,49,49,187,13,10,26,10],NC=67305985,ks={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},$f=64,G0={[Qe.UNSIGNED_BYTE]:1,[Qe.UNSIGNED_SHORT]:2,[Qe.INT]:4,[Qe.UNSIGNED_INT]:4,[Qe.FLOAT]:4,[Qe.HALF_FLOAT]:8},UC={[Le.RGBA]:4,[Le.RGB]:3,[Le.RG]:2,[Le.RED]:1,[Le.LUMINANCE]:1,[Le.LUMINANCE_ALPHA]:2,[Le.ALPHA]:1},XC={[Qe.UNSIGNED_SHORT_4_4_4_4]:2,[Qe.UNSIGNED_SHORT_5_5_5_1]:2,[Qe.UNSIGNED_SHORT_5_6_5]:2};function YC(n,e,t=!1){const i=new DataView(e);if(!VC(n,i))return null;const s=i.getUint32(ks.ENDIANNESS,!0)===NC,r=i.getUint32(ks.GL_TYPE,s),a=i.getUint32(ks.GL_FORMAT,s),o=i.getUint32(ks.GL_INTERNAL_FORMAT,s),h=i.getUint32(ks.PIXEL_WIDTH,s),l=i.getUint32(ks.PIXEL_HEIGHT,s)||1,c=i.getUint32(ks.PIXEL_DEPTH,s)||1,u=i.getUint32(ks.NUMBER_OF_ARRAY_ELEMENTS,s)||1,d=i.getUint32(ks.NUMBER_OF_FACES,s),f=i.getUint32(ks.NUMBER_OF_MIPMAP_LEVELS,s),p=i.getUint32(ks.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,v=4,y=h+3&-4,b=l+3&-4,g=new Array(u);let w=h*l;r===0&&(w=y*b);let E;if(r!==0?G0[r]?E=G0[r]*UC[a]:E=XC[r]:E=nh[o],E===void 0)throw new Error("Unable to resolve the pixel format stored in the *.ktx file!");const M=t?GC(i,p,s):null;let _=w*E,I=h,R=l,F=y,P=b,k=$f+p;for(let B=0;B<f;B++){const L=i.getUint32(k,s);let X=k+4;for(let O=0;O<u;O++){let D=g[O];D||(D=g[O]=new Array(f)),D[B]={levelID:B,levelWidth:f>1||r!==0?I:F,levelHeight:f>1||r!==0?R:P,levelBuffer:new Uint8Array(e,X,_)},X+=_}k+=L+4,k=k%4!==0?k+4-k%4:k,I=I>>1||1,R=R>>1||1,F=I+m-1&-4,P=R+v-1&-4,_=F*P*E}return r!==0?{uncompressed:g.map(B=>{let L=B[0].levelBuffer,X=!1;return r===Qe.FLOAT?L=new Float32Array(B[0].levelBuffer.buffer,B[0].levelBuffer.byteOffset,B[0].levelBuffer.byteLength/4):r===Qe.UNSIGNED_INT?(X=!0,L=new Uint32Array(B[0].levelBuffer.buffer,B[0].levelBuffer.byteOffset,B[0].levelBuffer.byteLength/4)):r===Qe.INT&&(X=!0,L=new Int32Array(B[0].levelBuffer.buffer,B[0].levelBuffer.byteOffset,B[0].levelBuffer.byteLength/4)),{resource:new Wh(L,{width:B[0].levelWidth,height:B[0].levelHeight}),type:r,format:X?$C(a):a}}),kvData:M}:{compressed:g.map(B=>new da(null,{format:o,width:h,height:l,levels:f,levelBuffers:B})),kvData:M}}function VC(n,e){for(let t=0;t<$0.length;t++)if(e.getUint8(t)!==$0[t])return console.error(`${n} is not a valid *.ktx file!`),!1;return!0}function $C(n){switch(n){case Le.RGBA:return Le.RGBA_INTEGER;case Le.RGB:return Le.RGB_INTEGER;case Le.RG:return Le.RG_INTEGER;case Le.RED:return Le.RED_INTEGER;default:return n}}function GC(n,e,t){const i=new Map;let s=0;for(;s<e;){const r=n.getUint32($f+s,t),a=$f+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 jC={extension:{type:$e.LoadParser,priority:xs.High},name:"loadDDS",test(n){return hs(n,".dds")},async load(n,e,t){const i=await(await ze.ADAPTER.fetch(n)).arrayBuffer(),s=DC(i).map(r=>{const a=new mt(r,{mipmap:Cs.OFF,alphaMode:Fi.NO_PREMULTIPLIED_ALPHA,resolution:nr(n),...e.data});return Pl(a,t,n)});return s.length===1?s[0]:s},unload(n){Array.isArray(n)?n.forEach(e=>e.destroy(!0)):n.destroy(!0)}};et.add(jC);const HC={extension:{type:$e.LoadParser,priority:xs.High},name:"loadKTX",test(n){return hs(n,".ktx")},async load(n,e,t){const i=await(await ze.ADAPTER.fetch(n)).arrayBuffer(),{compressed:s,uncompressed:r,kvData:a}=YC(n,i),o=s??r,h={mipmap:Cs.OFF,alphaMode:Fi.NO_PREMULTIPLIED_ALPHA,resolution:nr(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 mt(u,h);return d.ktxKeyValueData=a,Pl(d,t,n)});return l.length===1?l[0]:l},unload(n){Array.isArray(n)?n.forEach(e=>e.destroy(!0)):n.destroy(!0)}};et.add(HC);const WC=["s3tc","s3tc_sRGB","etc","etc1","pvrtc","atc","astc","bptc"],zC={extension:$e.ResolveParser,test:n=>{const e=pi.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(WC.includes(r))return{resolution:parseFloat(((i=ze.RETINA_PREFIX.exec(n))==null?void 0:i[1])??"1"),format:r,src:n}}return{resolution:parseFloat(((s=ze.RETINA_PREFIX.exec(n))==null?void 0:s[1])??"1"),format:t,src:n}}};et.add(zC);const nc=new _t,qC=4,d1=class Wo{constructor(e){this.renderer=e,this._rendererPremultipliedAlpha=!1}contextChange(){var t;const e=(t=this.renderer)==null?void 0:t.gl.getContextAttributes();this._rendererPremultipliedAlpha=!!(e&&e.alpha&&e.premultipliedAlpha)}async image(e,t,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&&Wo._flipY(i,s,r),o&&Wo._unpremultiplyAlpha(i);const h=new RM(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&&Wo._flipY(i,s,r),o&&Wo._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 Sa?o=e:(o=i.generateTexture(e,{region:t,resolution:i.resolution,multisample:i.multisample}),h=!0,t&&(nc.width=t.width,nc.height=t.height,t=nc)));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===Le.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=nc,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(qC*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}}}};d1.extension={name:"extract",type:$e.RendererSystem};let KC=d1;et.add(KC);const rh={build(n){const e=n.points;let t,i,s,r,a,o;if(n.type===Xi.CIRC){const p=n.shape;t=p.x,i=p.y,a=o=p.radius,s=r=0}else if(n.type===Xi.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,v=p.height/2;t=p.x+m,i=p.y+v,a=o=Math.max(0,Math.min(p.radius,Math.min(m,v))),s=m-a,r=v-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,v=t+p,y=t-p,b=i+m;if(e[c++]=v,e[c++]=b,e[--u]=b,e[--u]=y,r){const g=i-m;e[d++]=y,e[d++]=g,e[--f]=g,e[--f]=v}}for(let p=1;p<h;p++){const m=Math.PI/2*(p/h),v=s+Math.cos(m)*a,y=r+Math.sin(m)*o,b=t+v,g=t-v,w=i+y,E=i-y;e[c++]=b,e[c++]=w,e[--u]=w,e[--u]=g,e[d++]=g,e[d++]=E,e[--f]=E,e[--f]=b}{const p=s,m=r+o,v=t+p,y=t-p,b=i+m,g=i-m;e[c++]=v,e[c++]=b,e[--f]=g,e[--f]=v,s&&(e[c++]=y,e[c++]=b,e[--f]=g,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!==Xi.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 j0(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 f1={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){j0(t,!1);const a=[];for(let l=0;l<i.length;l++){const c=i[l];j0(c.points,!0),a.push(t.length/2),t=t.concat(c.points)}const o=RT(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])}}},ZC={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)}},JC={build(n){rh.build(n)},triangulate(n,e){rh.triangulate(n,e)}};var Ts=(n=>(n.MITER="miter",n.BEVEL="bevel",n.ROUND="round",n))(Ts||{}),Cr=(n=>(n.BUTT="butt",n.ROUND="round",n.SQUARE="square",n))(Cr||{});const fo={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 H0{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,v=r*Math.sqrt(f)/d,y=r*Math.sqrt(p)/d,b=v*m/f,g=y*m/p,w=v*u+y*l,E=v*c+y*h,M=l*(y+b),_=h*(y+b),I=u*(v+g),R=c*(v+g),F=Math.atan2(_-E,M-w),P=Math.atan2(R-E,I-w);return{cx:w+e,cy:E+t,radius:r,startAngle:F,endAngle:P,anticlockwise:l*c>u*h}}static arc(e,t,i,s,r,a,o,h,l){const c=o-a,u=fo._segmentsCount(Math.abs(c)*r,Math.ceil(Math.abs(c)/Kc)*40),d=c/(u*2),f=d*2,p=Math.cos(d),m=Math.sin(d),v=u-1,y=v%1/v;for(let b=0;b<=v;++b){const g=b+y*b,w=d+a+f*g,E=Math.cos(w),M=-Math.sin(w);l.push((p*E+m*M)*r+i,(p*-M+m*E)*r+s)}}}class QC{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 Zm{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,v=0,y=0,b=0,g=0,w=e,E=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,v=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,b=w-v,g=E-y,w=v,E=y,l+=Math.sqrt(b*b+g*g);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=fo._segmentsCount(Zm.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 v=1,y=0;v<=c;++v)y=v/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 W0(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,v=c+d,y=u+f;return o.push(p,m,v,y),2}function Hr(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),v=(15*p*Math.sqrt(m)/Math.PI>>0)+1,y=f/v;if(d+=y,o){a.push(n,e,t,i);for(let b=1,g=d;b<v;b++,g+=y)a.push(n,e,n+Math.sin(g)*m,e+Math.cos(g)*m);a.push(n,e,s,r)}else{a.push(t,i,n,e);for(let b=1,g=d;b<v;b++,g+=y)a.push(n+Math.sin(g)*m,e+Math.cos(g)*m,n,e);a.push(s,r,n,e)}return v*2}function e2(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 Dt(i[0],i[1]),o=new Dt(i[i.length-2],i[i.length-1]),h=t.type!==Xi.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,T=(o.y+a.y)*.5;i.unshift(D,T),i.push(D,T)}const c=e.points,u=i.length/2;let d=i.length;const f=c.length/2,p=r.width/2,m=p*p,v=r.miterLimit*r.miterLimit;let y=i[0],b=i[1],g=i[2],w=i[3],E=0,M=0,_=-(b-w),I=y-g,R=0,F=0,P=Math.sqrt(_*_+I*I);_/=P,I/=P,_*=p,I*=p;const k=r.alignment,B=(1-k)*2,L=k*2;h||(r.cap===Cr.ROUND?d+=Hr(y-_*(B-L)*.5,b-I*(B-L)*.5,y-_*B,b-I*B,y+_*L,b+I*L,c,!0)+2:r.cap===Cr.SQUARE&&(d+=W0(y,b,_,I,B,L,!0,c))),c.push(y-_*B,b-I*B,y+_*L,b+I*L);for(let D=1;D<u-1;++D){y=i[(D-1)*2],b=i[(D-1)*2+1],g=i[D*2],w=i[D*2+1],E=i[(D+1)*2],M=i[(D+1)*2+1],_=-(b-w),I=y-g,P=Math.sqrt(_*_+I*I),_/=P,I/=P,_*=p,I*=p,R=-(w-M),F=g-E,P=Math.sqrt(R*R+F*F),R/=P,F/=P,R*=p,F*=p;const T=g-y,U=b-w,N=g-E,Y=M-w,G=T*N+U*Y,H=U*N-Y*T,ne=H<0;if(Math.abs(H)<.001*Math.abs(G)){c.push(g-_*B,w-I*B,g+_*L,w+I*L),G>=0&&(r.join===Ts.ROUND?d+=Hr(g,w,g-_*B,w-I*B,g-R*B,w-F*B,c,!1)+4:d+=2,c.push(g-R*L,w-F*L,g+R*B,w+F*B));continue}const Z=(-_+y)*(-I+w)-(-_+g)*(-I+b),de=(-R+E)*(-F+w)-(-R+g)*(-F+M),me=(T*de-N*Z)/H,_e=(Y*Z-U*de)/H,Ae=(me-g)*(me-g)+(_e-w)*(_e-w),ge=g+(me-g)*B,Ee=w+(_e-w)*B,j=g-(me-g)*L,K=w-(_e-w)*L,q=Math.min(T*T+U*U,N*N+Y*Y),W=ne?B:L,Q=q+W*W*m,le=Ae<=Q;let xe=r.join;if(xe===Ts.MITER&&Ae/m>v&&(xe=Ts.BEVEL),le)switch(xe){case Ts.MITER:{c.push(ge,Ee,j,K);break}case Ts.BEVEL:{ne?c.push(ge,Ee,g+_*L,w+I*L,ge,Ee,g+R*L,w+F*L):c.push(g-_*B,w-I*B,j,K,g-R*B,w-F*B,j,K),d+=2;break}case Ts.ROUND:{ne?(c.push(ge,Ee,g+_*L,w+I*L),d+=Hr(g,w,g+_*L,w+I*L,g+R*L,w+F*L,c,!0)+4,c.push(ge,Ee,g+R*L,w+F*L)):(c.push(g-_*B,w-I*B,j,K),d+=Hr(g,w,g-_*B,w-I*B,g-R*B,w-F*B,c,!1)+4,c.push(g-R*B,w-F*B,j,K));break}}else{switch(c.push(g-_*B,w-I*B,g+_*L,w+I*L),xe){case Ts.MITER:{ne?c.push(j,K,j,K):c.push(ge,Ee,ge,Ee),d+=2;break}case Ts.ROUND:{ne?d+=Hr(g,w,g+_*L,w+I*L,g+R*L,w+F*L,c,!0)+2:d+=Hr(g,w,g-_*B,w-I*B,g-R*B,w-F*B,c,!1)+2;break}}c.push(g-R*B,w-F*B,g+R*L,w+F*L),d+=2}}y=i[(u-2)*2],b=i[(u-2)*2+1],g=i[(u-1)*2],w=i[(u-1)*2+1],_=-(b-w),I=y-g,P=Math.sqrt(_*_+I*I),_/=P,I/=P,_*=p,I*=p,c.push(g-_*B,w-I*B,g+_*L,w+I*L),h||(r.cap===Cr.ROUND?d+=Hr(g-_*(B-L)*.5,w-I*(B-L)*.5,g-_*B,w-I*B,g+_*L,w+I*L,c,!1)+2:r.cap===Cr.SQUARE&&(d+=W0(g,w,_,I,B,L,!1,c)));const X=e.indices,O=fo.epsilon*fo.epsilon;for(let D=f;D<d+f-2;++D)y=c[D*2],b=c[D*2+1],g=c[(D+1)*2],w=c[(D+1)*2+1],E=c[(D+2)*2],M=c[(D+2)*2+1],!(Math.abs(y*(w-M)+g*(M-b)+E*(b-w))<O)&&X.push(D,D+1,D+2)}function t2(n,e){let t=0;const i=n.shape,s=n.points||i.points,r=i.type!==Xi.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 z0(n,e){n.lineStyle.native?t2(n,e):e2(n,e)}class Jm{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),v=2*u*m,y=2*Math.sqrt(f),b=d/m;return(v*p+m*d*(p-y)+(4*f*u-d*d)*Math.log((2*m+b+p)/(b+y)))/(4*v)}static curveTo(e,t,i,s,r){const a=r[r.length-2],o=r[r.length-1],h=fo._segmentsCount(Jm.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 Od={[Xi.POLY]:f1,[Xi.CIRC]:rh,[Xi.ELIP]:rh,[Xi.RECT]:ZC,[Xi.RREC]:JC},q0=[],rc=[];class ah{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 ah(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 Fa=new Dt,m1=class p1 extends xx{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 xl,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(),rc.push(this.drawCalls[e]);this.drawCalls.length=0;for(let e=0;e<this.batches.length;e++){const t=this.batches[e];t.reset(),q0.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 ah(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 ah(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,Fa):Fa.copyFrom(e),s.shape.contains(Fa.x,Fa.y))){let r=!1;if(s.holes){for(let a=0;a<s.holes.length;a++)if(s.holes[a].shape.contains(Fa.x,Fa.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;Od[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,v=this.points.length/2;p.wrapMode=Vs.REPEAT,d===0?this.processFill(l):this.processLine(l);const y=this.points.length/2-v;y!==0&&(i&&!this._compareStyles(s,f)&&(i.end(m,v),i=null),i||(i=q0.pop()||new QC,i.begin(f,m,v),this.batches.push(i),s=f),this.addUvs(this.points,e,f.texture,v,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<p1.BATCHABLE_SIZE*2}buildDrawCalls(){let e=++mt._globalBatch;for(let u=0;u<this.drawCalls.length;u++)this.drawCalls[u].texArray.clear(),rc.push(this.drawCalls[u]);this.drawCalls.length=0;const t=this.colors,i=this.textureIds;let s=rc.pop();s||(s=new Sf,s.texArray=new Ef),s.texArray.count=0,s.start=0,s.size=0,s.type=vn.TRIANGLES;let r=0,a=null,o=0,h=!1,l=vn.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?vn.LINES:vn.TRIANGLES,a=null,r=f,e++),a!==m&&(a=m,m._batchEnabled!==e&&(r===f&&(e++,r=0,s.size>0&&(s=rc.pop(),s||(s=new Sf,s.texArray=new Ef),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=Vs.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)}mt._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?f1.triangulate(e,this):Od[e.type].triangulate(e,this)}processLine(e){z0(e,this);for(let t=0;t<e.holes.length;t++)z0(e.holes[t],this)}processHoles(e){for(let t=0;t<e.length;t++){const i=e[t];Od[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=Yt.shared.setValue(t).toLittleEndianNumber(),o=Yt.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}};m1.BATCHABLE_SIZE=100;let i2=m1;class Qh{constructor(){this.color=16777215,this.alpha=1,this.texture=ht.WHITE,this.matrix=null,this.visible=!1,this.reset()}clone(){const e=new Qh;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=ht.WHITE,this.matrix=null,this.visible=!1}destroy(){this.texture=null,this.matrix=null}}class Qm extends Qh{constructor(){super(...arguments),this.width=0,this.alignment=.5,this.native=!1,this.cap=Cr.BUTT,this.join=Ts.MITER,this.miterLimit=10}clone(){const e=new Qm;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=Cr.BUTT,this.join=Ts.MITER,this.miterLimit=10}}const Bd={},Gf=class Ic extends Vi{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 Qh,this._lineStyle=new Qm,this._matrix=null,this._holeMode=!1,this.state=An.for2d(),this._geometry=e||new i2,this._geometry.refCount++,this._transformID=-1,this._tintColor=new Yt(16777215),this.blendMode=ct.NORMAL}get geometry(){return this._geometry}clone(){return this.finishPoly(),new Ic(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:ht.WHITE,color:e!=null&&e.texture?16777215:0,matrix:null,alignment:.5,native:!1,cap:Cr.BUTT,join:Ts.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 ua,this.currentPath.closeStroke=!1,this.currentPath.points.push(e[t-2],e[t-1]))}else this.currentPath=new ua,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),Jm.curveTo(e,t,i,s,r),this}bezierCurveTo(e,t,i,s,r,a){return this._initCurve(),Zm.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=H0.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+=Kc:a&&s<=r&&(s+=Kc),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 H0.arc(o,h,e,t,i,s,r,a,c),this}beginFill(e=0,t){return this.beginTextureFill({texture:ht.WHITE,color:e,alpha:t})}normalizeColor(e){const t=Yt.shared.setValue(e.color??0);e.color=t.toNumber(),e.alpha??(e.alpha=t.alpha)}beginTextureFill(e){const t={texture:ht.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 _t(e,t,i,s))}drawRoundedRect(e,t,i,s,r){return this.drawShape(new Kh(e,t,i,s,r))}drawCircle(e,t,i){return this.drawShape(new zh(e,t,i))}drawEllipse(e,t,i,s){return this.drawShape(new qh(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 ua(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===Xi.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:Yt.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,Yt.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(!Bd[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 ri,default:Gs.from({uSamplers:r},!0)},o=e.plugins[i]._shader.program;Bd[i]=new js(o,a)}t=Bd[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,Ic._TEMP_POINT),this._geometry.containsPoint(Ic._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=Yt.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)}};Gf.curves=fo,Gf._TEMP_POINT=new Dt;let ls=Gf;class s2{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 Ld=new Dt,K0=new ua,g1=class v1 extends Vi{constructor(e,t,i,s=vn.TRIANGLES){super(),this.geometry=e,this.shader=t,this.state=i||An.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=ze.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===vn.TRIANGLES&&t.length<v1.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=ze.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 s2(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,Ld);const t=this.geometry.getBuffer("aVertexPosition").data,i=K0.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],K0.contains(Ld.x,Ld.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}};g1.BATCHABLE_SIZE=100;let bl=g1;class ep extends Mn{constructor(e,t,i){super();const s=new si(e),r=new si(t,!0),a=new si(i,!0,!0);this.addAttribute("aVertexPosition",s,2,!1,Qe.FLOAT).addAttribute("aTextureCoord",r,2,!1,Qe.FLOAT).addIndex(a),this._updateId=-1}get vertexDirtyId(){return this.buffers[0]._updateID}}var n2=`varying vec2 vTextureCoord;
|
||
uniform vec4 uColor;
|
||
|
||
uniform sampler2D uSampler;
|
||
|
||
void main(void)
|
||
{
|
||
gl_FragColor = texture2D(uSampler, vTextureCoord) * uColor;
|
||
}
|
||
`,r2=`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 oh extends js{constructor(e,t){const i={uSampler:e,alpha:1,uTextureMatrix:ri.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||yn.from(r2,n2),i),this._colorDirty=!1,this.uvMatrix=new zm(e),this.batchable=t.program===void 0,this.pluginName=t.pluginName,this._tintColor=new Yt(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;Yt.shared.setValue(this._tintColor).premultiply(this._alpha,e).toArray(this.uniforms.uColor)}this.uvMatrix.update()&&(this.uniforms.uTextureMatrix=this.uvMatrix.mapCoord)}}class a2 extends bl{constructor(e=ht.EMPTY,t,i,s,r){const a=new ep(t,i,s);a.getBuffer("aVertexPosition").static=!1;const o=new oh(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 Z0{constructor(e,t,i){this.geometry=new Mn,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||Qe.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 si(CM(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 si(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 si(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===Qe.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===Qe.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===Qe.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===Qe.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 o2=`varying vec2 vTextureCoord;
|
||
varying vec4 vColor;
|
||
|
||
uniform sampler2D uSampler;
|
||
|
||
void main(void){
|
||
vec4 color = texture2D(uSampler, vTextureCoord) * vColor;
|
||
gl_FragColor = color;
|
||
}`,l2=`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 y1 extends Zh{constructor(e){super(e),this.shader=null,this.properties=null,this.tempMatrix=new ri,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:Qe.UNSIGNED_BYTE,uploadFunction:this.uploadTint,offset:0}],this.shader=js.from(l2,o2,{}),this.state=An.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=gx(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=Yt.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 v=o[p];v.uploadDynamic(t,f,m);const y=e._bufferUpdateIDs[p]||0;d=d||v._updateID<y,d&&(v._updateID=e._updateID,v.uploadStatic(t,f,m)),r.geometry.bind(v.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 Z0(this.properties,r,s));return t}_generateOneMoreBuffer(e){const t=e._batchSize,i=e._properties;return new Z0(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,v=f.trim,y=f.orig;v?(h=v.x-d.anchor.x*y.width,o=h+v.width,c=v.y-d.anchor.y*y.height,l=c+v.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=Yt.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}}y1.extension={name:"particle",type:$e.RendererPlugin};et.add(y1);var eu=(n=>(n[n.LINEAR_VERTICAL=0]="LINEAR_VERTICAL",n[n.LINEAR_HORIZONTAL=1]="LINEAR_HORIZONTAL",n))(eu||{});const ac={willReadFrequently:!0},sn=class nt{static get experimentalLetterSpacingSupported(){let e=nt._experimentalLetterSpacingSupported;if(e!==void 0){const t=ze.ADAPTER.getCanvasRenderingContext2D().prototype;e=nt._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=nt._canvas){i=i??t.wordWrap;const r=t.toFontString(),a=nt.measureFont(r);a.fontSize===0&&(a.fontSize=t.fontSize,a.ascent=t.fontSize);const o=s.getContext("2d",ac);o.font=r;const h=(i?nt.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=nt._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 nt(e,t,u,f,h,l,d+t.leading,c,a)}static _measureText(e,t,i){let s=!1;nt.experimentalLetterSpacingSupported&&(nt.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+=(nt.graphemeSegmenter(e).length-1)*t),r}static wordWrap(e,t,i=nt._canvas){const s=i.getContext("2d",ac);let r=0,a="",o="";const h=Object.create(null),{letterSpacing:l,whiteSpace:c}=t,u=nt.collapseSpaces(c),d=nt.collapseNewlines(c);let f=!u;const p=t.wordWrapWidth+l,m=nt.tokenize(e);for(let v=0;v<m.length;v++){let y=m[v];if(nt.isNewline(y)){if(!d){o+=nt.addLine(a),f=!u,a="",r=0;continue}y=" "}if(u){const g=nt.isBreakingSpace(y),w=nt.isBreakingSpace(a[a.length-1]);if(g&&w)continue}const b=nt.getFromCache(y,l,h,s);if(b>p)if(a!==""&&(o+=nt.addLine(a),a="",r=0),nt.canBreakWords(y,t.breakWords)){const g=nt.wordWrapSplit(y);for(let w=0;w<g.length;w++){let E=g[w],M=E,_=1;for(;g[w+_];){const R=g[w+_];if(!nt.canBreakChars(M,R,y,w,t.breakWords))E+=R;else break;M=R,_++}w+=_-1;const I=nt.getFromCache(E,l,h,s);I+r>p&&(o+=nt.addLine(a),f=!1,a="",r=0),a+=E,r+=I}}else{a.length>0&&(o+=nt.addLine(a),a="",r=0);const g=v===m.length-1;o+=nt.addLine(y,!g),f=!1,a="",r=0}else b+r>p&&(f=!1,o+=nt.addLine(a),a="",r=0),(a.length>0||!nt.isBreakingSpace(y)||f)&&(a+=y,r+=b)}return o+=nt.addLine(a,!1),o}static addLine(e,t=!0){return e=nt.trimRight(e),e=t?`${e}
|
||
`:e,e}static getFromCache(e,t,i,s){let r=i[e];return typeof r!="number"&&(r=nt._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(!nt.isBreakingSpace(i))break;e=e.slice(0,-1)}return e}static isNewline(e){return typeof e!="string"?!1:nt._newlines.includes(e.charCodeAt(0))}static isBreakingSpace(e,t){return typeof e!="string"?!1:nt._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(nt.isBreakingSpace(r,a)||nt.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 nt.graphemeSegmenter(e)}static measureFont(e){if(nt._fonts[e])return nt._fonts[e];const t={ascent:0,descent:0,fontSize:0},i=nt._canvas,s=nt._context;s.font=e;const r=nt.METRICS_STRING+nt.BASELINE_SYMBOL,a=Math.ceil(s.measureText(r).width);let o=Math.ceil(s.measureText(nt.BASELINE_SYMBOL).width);const h=Math.ceil(nt.HEIGHT_MULTIPLIER*o);if(o=o*nt.BASELINE_MULTIPLIER|0,a===0||h===0)return nt._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,nt._fonts[e]=t,t}static clearMetrics(e=""){e?delete nt._fonts[e]:nt._fonts={}}static get _canvas(){var e;if(!nt.__canvas){let t;try{const i=new OffscreenCanvas(0,0);if((e=i.getContext("2d",ac))!=null&&e.measureText)return nt.__canvas=i,i;t=ze.ADAPTER.createCanvas()}catch{t=ze.ADAPTER.createCanvas()}t.width=t.height=10,nt.__canvas=t}return nt.__canvas}static get _context(){return nt.__context||(nt.__context=nt._canvas.getContext("2d",ac)),nt.__context}};sn.METRICS_STRING="|ÉqÅ",sn.BASELINE_SYMBOL="M",sn.BASELINE_MULTIPLIER=1.4,sn.HEIGHT_MULTIPLIER=2,sn.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]})(),sn.experimentalLetterSpacing=!1,sn._fonts={},sn._newlines=[10,13],sn._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288];let yr=sn;const c2=["serif","sans-serif","monospace","cursive","fantasy","system-ui"],x1=class zo{constructor(e){this.styleID=0,this.reset(),Nd(this,e,e)}clone(){const e={};return Nd(e,this,zo.defaultStyle),new zo(e)}reset(){Nd(this,zo.defaultStyle,zo.defaultStyle)}get align(){return this._align}set align(e){this._align!==e&&(this._align=e,this.styleID++)}get breakWords(){return this._breakWords}set breakWords(e){this._breakWords!==e&&(this._breakWords=e,this.styleID++)}get dropShadow(){return this._dropShadow}set dropShadow(e){this._dropShadow!==e&&(this._dropShadow=e,this.styleID++)}get dropShadowAlpha(){return this._dropShadowAlpha}set dropShadowAlpha(e){this._dropShadowAlpha!==e&&(this._dropShadowAlpha=e,this.styleID++)}get dropShadowAngle(){return this._dropShadowAngle}set dropShadowAngle(e){this._dropShadowAngle!==e&&(this._dropShadowAngle=e,this.styleID++)}get dropShadowBlur(){return this._dropShadowBlur}set dropShadowBlur(e){this._dropShadowBlur!==e&&(this._dropShadowBlur=e,this.styleID++)}get dropShadowColor(){return this._dropShadowColor}set dropShadowColor(e){const t=Dd(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=Dd(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){h2(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=Dd(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)&&!c2.includes(s)&&(s=`"${s}"`),t[i]=s}return`${this.fontStyle} ${this.fontVariant} ${this.fontWeight} ${e} ${t.join(",")}`}};x1.defaultStyle={align:"left",breakWords:!1,dropShadow:!1,dropShadowAlpha:1,dropShadowAngle:Math.PI/6,dropShadowBlur:0,dropShadowColor:"black",dropShadowDistance:5,fill:"black",fillGradientType:eu.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 Or=x1;function Dd(n){const e=Yt.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 h2(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 Nd(n,e,t){for(const i in t)Array.isArray(e[i])?n[i]=e[i].slice():n[i]=e[i]}const u2={texture:!0,children:!1,baseTexture:!0},b1=class jf extends Dr{constructor(e,t,i){let s=!1;i||(i=ze.ADAPTER.createCanvas(),s=!0),i.width=3,i.height=3;const r=ht.from(i);r.orig=new _t,r.trim=new _t,super(r),this._ownCanvas=s,this.canvas=i,this.context=i.getContext("2d",{willReadFrequently:!0}),this._resolution=jf.defaultResolution??ze.RESOLUTION,this._autoResolution=jf.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 yr.experimentalLetterSpacing}static set experimentalLetterSpacing(e){Pt("7.1.0","Text.experimentalLetterSpacing is deprecated, use TextMetrics.experimentalLetterSpacing"),yr.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=yr.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 v=t.dropShadow&&m===0,y=v?Math.ceil(Math.max(1,a)+t.padding*2):0,b=y*this._resolution;if(v){i.fillStyle="black",i.strokeStyle="black";const w=t.dropShadowColor,E=t.dropShadowBlur*this._resolution,M=t.dropShadowDistance*this._resolution;i.shadowColor=Yt.shared.setValue(w).setAlpha(t.dropShadowAlpha).toRgbaString(),i.shadowBlur=E,i.shadowOffsetX=Math.cos(t.dropShadowAngle)*M,i.shadowOffsetY=Math.sin(t.dropShadowAngle)*M+b}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 g=(h-u.fontSize)/2;h-u.fontSize<0&&(g=0);for(let w=0;w<o.length;w++)d=t.strokeThickness/2,f=t.strokeThickness/2+w*h+u.ascent+g,t.align==="right"?d+=c-l[w]:t.align==="center"&&(d+=(c-l[w])/2),t.stroke&&t.strokeThickness&&this.drawLetterSpacing(o[w],d+t.padding,f+t.padding-y,!0),t.fill&&this.drawLetterSpacing(o[w],d+t.padding,f+t.padding-y)}this.updateTexture()}drawLetterSpacing(e,t,i,s=!1){const r=this._style.letterSpacing;let a=!1;if(yr.experimentalLetterSpacingSupported&&(yr.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=yr.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=kM(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===eu.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 v=m;f>0&&p>m&&(v=(m+p)/2);const y=m+d,b=i.lineHeight*(f+1);let g=y;f+1<t.length&&b<y&&(g=(y+b)/2);const w=(g-v)/l;for(let E=0;E<c.length;E++){let M=0;typeof u[E]=="number"?M=u[E]:M=E/c.length;let _=Math.min(1,Math.max(0,v/l+M*w));_=Number(_.toFixed(5)),r.addColorStop(_,c[E])}}}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({},u2,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=Ar(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=Ar(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 Or?this._style=e:this._style=new Or(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)}};b1.defaultAutoResolution=!0;let tp=b1;class d2{constructor(e){this.maxItemsPerFrame=e,this.itemsLeft=0}beginFrame(){this.itemsLeft=this.maxItemsPerFrame}allowedToUpload(){return this.itemsLeft-- >0}}function f2(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 ht){const r=n._textures[s].baseTexture;e.includes(r)||(e.push(r),t=!0)}}return t}function m2(n,e){if(n.baseTexture instanceof mt){const t=n.baseTexture;return e.includes(t)||e.push(t),!0}return!1}function p2(n,e){if(n._texture&&n._texture instanceof ht){const t=n._texture.baseTexture;return e.includes(t)||e.push(t),!0}return!1}function g2(n,e){return e instanceof tp?(e.updateText(!0),!0):!1}function v2(n,e){if(e instanceof Or){const t=e.toFontString();return yr.measureFont(t),!0}return!1}function y2(n,e){if(n instanceof tp){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 x2(n,e){return n instanceof Or?(e.includes(n)||e.push(n),!0):!1}const w1=class S1{constructor(e){this.limiter=new d2(S1.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(y2),this.registerFindHook(x2),this.registerFindHook(f2),this.registerFindHook(m2),this.registerFindHook(p2),this.registerUploadHook(g2),this.registerUploadHook(v2)}upload(e){return new Promise(t=>{e&&this.add(e),this.queue.length?(this.completes.push(t),this.ticking||(this.ticking=!0,is.system.addOnce(this.tick,this,va.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)is.system.addOnce(this.tick,this,va.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 Vi)for(let t=e.children.length-1;t>=0;t--)this.add(e.children[t]);return this}destroy(){this.ticking&&is.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}};w1.uploadsPerFrame=4;let Hf=w1;Object.defineProperties(ze,{UPLOADS_PER_FRAME:{get(){return Hf.uploadsPerFrame},set(n){Pt("7.1.0","settings.UPLOADS_PER_FRAME is deprecated, use prepare.BasePrepare.uploadsPerFrame"),Hf.uploadsPerFrame=n}}});function _1(n,e){return e instanceof mt?(e._glTextures[n.CONTEXT_UID]||n.texture.bind(e),!0):!1}function b2(n,e){if(!(e instanceof ls))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&&_1(n,r.baseTexture)}return t.batchable||n.geometry.bind(t,e._resolveDirectShader(n)),!0}function w2(n,e){return n instanceof ls?(e.push(n),!0):!1}class T1 extends Hf{constructor(e){super(e),this.uploadHookHelper=this.renderer,this.registerFindHook(w2),this.registerUploadHook(_1),this.registerUploadHook(b2)}}T1.extension={name:"prepare",type:$e.RendererSystem};et.add(T1);var S2=`#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;
|
||
}
|
||
`,_2=`#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;
|
||
}
|
||
`,T2=`#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;
|
||
}
|
||
`,M2=`#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 oc=new ri;class M1 extends Zh{constructor(e){super(e),e.runners.contextChange.add(this),this.quad=new Rx,this.state=An.for2d()}contextChange(){const e=this.renderer,t={globals:e.globalUniforms};this.simpleShader=js.from(J0,M2,t),this.shader=e.context.webGLVersion>1?js.from(_2,S2,t):js.from(J0,T2,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!==Vs.CLAMP:h.wrapMode===Vs.CLAMP&&(h.wrapMode=Vs.REPEAT));const f=d?this.simpleShader:this.shader,p=o.width,m=o.height,v=e._width,y=e._height;oc.set(c.a*p/v,c.b*p/y,c.c*m/v,c.d*m/y,c.tx/v,c.ty/y),oc.invert(),d?oc.prepend(u.mapCoord):(f.uniforms.uMapCoord=u.mapCoord.toArray(!0),f.uniforms.uClampFrame=u.uClampFrame,f.uniforms.uClampOffset=u.uClampOffset),f.uniforms.uTransform=oc.toArray(!0),f.uniforms.uColor=Yt.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=gx(e.blendMode,l),t.state.set(this.state),t.geometry.draw(this.renderer.gl.TRIANGLES,6,0)}}M1.extension={name:"tilingSprite",type:$e.RendererPlugin};et.add(M1);const E1=class qo{constructor(e,t,i){this.linkedSheets=[],(e instanceof mt||e instanceof ht)&&(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 ht?s:null,this.baseTexture=s instanceof mt?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=nr(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<=qo.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()})}_processFrames(e){let t=e;const i=qo.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 _t(0,0,Math.floor(l.w)/this.resolution,Math.floor(l.h)/this.resolution);r.rotated?o=new _t(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 _t(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 _t(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 ht(this.baseTexture,o,c,h,r.rotated?2:0,r.anchor,r.borders),ht.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*qo.BATCH_SIZE),this._batchIndex++,setTimeout(()=>{this._batchIndex*qo.BATCH_SIZE<this._frameKeys.length?this._nextBatch():(this._processAnimations(),this._parseComplete())},0)}destroy(e=!1){var t;for(const 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=[]}};E1.BATCH_SIZE=1e3;let Q0=E1;const E2=["jpg","png","jpeg","avif","webp","s3tc","s3tc_sRGB","etc","etc1","pvrtc","atc","astc","bptc"];function A1(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=pi.dirname(n[0]);e.linkedSheets.forEach((r,a)=>{Object.assign(i,A1([`${s}/${e.data.meta.related_multi_packs[a]}`],r,!0))})}return i}const A2={extension:$e.Asset,cache:{test:n=>n instanceof Q0,getCacheableAssets:(n,e)=>A1(n,e,!1)},resolver:{test:n=>{const e=n.split("?")[0].split("."),t=e.pop(),i=e.pop();return t==="json"&&E2.includes(i)},parse:n=>{var t;const e=n.split(".");return{resolution:parseFloat(((t=ze.RETINA_PREFIX.exec(n))==null?void 0:t[1])??"1"),format:e[e.length-2],src:n}}},loader:{name:"spritesheetLoader",extension:{type:$e.LoadParser,priority:xs.Normal},async testParse(n,e){return pi.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=pi.dirname(e.src);a&&a.lastIndexOf("/")!==a.length-1&&(a+="/");let o;if(i&&i.baseTexture)o=i;else{const d=ih(a+(s??n.meta.image),e.src);o=(await t.load([d]))[d]}const h=new Q0({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=ih(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)}}};et.add(A2);class lh{constructor(){this.info=[],this.common=[],this.page=[],this.char=[],this.kerning=[],this.distanceField=[]}}class Rc{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 lh;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 Wf{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 lh,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 zf{static test(e){return typeof e=="string"&&e.includes("<font>")?Wf.test(ze.ADAPTER.parseXML(e)):!1}static parse(e){return Wf.parse(ze.ADAPTER.parseXML(e))}}const Ud=[Rc,Wf,zf];function C2(n){for(let e=0;e<Ud.length;e++)if(Ud[e].test(n))return Ud[e];return null}function I2(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===eu.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 v=0;v<s.length;v++){const y=r.lineHeight*v;for(let b=0;b<d.length;b++){let g=0;typeof f[b]=="number"?g=f[b]:g=b/d.length;const w=y/u+g*m;let E=Math.max(p,w);E=Math.min(E,1),o.addColorStop(E,d[b]),p=E}}}else{o=e.createLinearGradient(l,u/2,c+l,u/2);const p=d.length+1;let m=1;for(let v=0;v<d.length;v++){let y;typeof f[v]=="number"?y=f[v]:y=m/p,o.addColorStop(y,d[v]),m++}}return o}function R2(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=I2(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=Yt.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 Pc(n){return n.codePointAt?n.codePointAt(0):n.charCodeAt(0)}function C1(n){return Array.from?Array.from(n):n.split("")}function P2(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(...C1(s))}if(e.length===0)throw new Error("[BitmapFont]: Empty set when resolving characters.");return e}const mr=class nn{constructor(e,t,i){var c;const[s]=e.info,[r]=e.common,[a]=e.page,[o]=e.distanceField,h=nr(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=Fi.NO_PREMULTIPLIED_ALPHA,l[d].baseTexture.mipmap=Cs.OFF)}for(let u=0;u<e.char.length;u++){const{id:d,page:f}=e.char[u];let{x:p,y:m,width:v,height:y,xoffset:b,yoffset:g,xadvance:w}=e.char[u];p/=h,m/=h,v/=h,y/=h,b/=h,g/=h,w/=h;const E=new _t(p+l[f].frame.x/h,m+l[f].frame.y/h,v,y);this.chars[d]={xOffset:b,yOffset:g,xAdvance:w,kerning:{},texture:new ht(l[f].baseTexture,E),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 lh)s=e;else{const a=C2(e);if(!a)throw new Error("Unrecognized data format for font.");s=a.parse(e)}t instanceof ht&&(t=[t]);const r=new nn(s,t,i);return nn.available[r.font]=r,r}static uninstall(e){const t=nn.available[e];if(!t)throw new Error(`No font found named '${e}'`);t.destroy(),delete nn.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({},nn.defaultOptions,i),c=P2(s),u=t instanceof Or?t:new Or(t),d=o,f=new lh;f.info[0]={face:u.fontFamily,size:u.fontSize},f.common[0]={lineHeight:u.fontSize};let p=0,m=0,v,y,b,g=0;const w=[];for(let M=0;M<c.length;M++){v||(v=ze.ADAPTER.createCanvas(),v.width=o,v.height=h,y=v.getContext("2d"),b=new mt(v,{resolution:a,...l}),w.push(new ht(b)),f.page.push({id:w.length-1,file:""}));const _=c[M],I=yr.measureText(_,u,!1,v),R=I.width,F=Math.ceil(I.height),P=Math.ceil((u.fontStyle==="italic"?2:1)*R);if(m>=h-F*a){if(m===0)throw new Error(`[BitmapFont] textureHeight ${h}px is too small (fontFamily: '${u.fontFamily}', fontSize: ${u.fontSize}px, char: '${_}')`);--M,v=null,y=null,b=null,m=0,p=0,g=0;continue}if(g=Math.max(F+I.fontProperties.descent,g),P*a+p>=d){if(p===0)throw new Error(`[BitmapFont] textureWidth ${o}px is too small (fontFamily: '${u.fontFamily}', fontSize: ${u.fontSize}px, char: '${_}')`);--M,m+=g*a,m=Math.ceil(m),p=0,g=0;continue}R2(v,y,I,p,m,a,u);const k=Pc(I.text);f.char.push({id:k,page:w.length-1,x:p/a,y:m/a,width:P,height:F,xoffset:0,yoffset:0,xadvance:R-(u.dropShadow?u.dropShadowDistance:0)-(u.stroke?u.strokeThickness:0)}),p+=(P+2*r)*a,p=Math.ceil(p)}if(!(i!=null&&i.skipKerning))for(let M=0,_=c.length;M<_;M++){const I=c[M];for(let R=0;R<_;R++){const F=c[R],P=y.measureText(I).width,k=y.measureText(F).width,B=y.measureText(I+F).width-(P+k);B&&f.kerning.push({first:Pc(I),second:Pc(F),amount:B})}}const E=new nn(f,w,!0);return nn.available[e]!==void 0&&nn.uninstall(e),nn.available[e]=E,E}};mr.ALPHA=[["a","z"],["A","Z"]," "],mr.NUMERIC=[["0","9"]],mr.ALPHANUMERIC=[["a","z"],["A","Z"],["0","9"]," "],mr.ASCII=[[" ","~"]],mr.defaultOptions={resolution:1,textureWidth:512,textureHeight:512,padding:4,chars:mr.ALPHANUMERIC},mr.available={};let pr=mr;var k2=`// 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
|
||
`,F2=`// Mesh material default fragment\r
|
||
attribute vec2 aVertexPosition;\r
|
||
attribute vec2 aTextureCoord;\r
|
||
\r
|
||
uniform mat3 projectionMatrix;\r
|
||
uniform mat3 translationMatrix;\r
|
||
uniform mat3 uTextureMatrix;\r
|
||
\r
|
||
varying vec2 vTextureCoord;\r
|
||
\r
|
||
void main(void)\r
|
||
{\r
|
||
gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\r
|
||
\r
|
||
vTextureCoord = (uTextureMatrix * vec3(aTextureCoord, 1.0)).xy;\r
|
||
}\r
|
||
`;const ev=[],tv=[],iv=[],O2=class I1 extends Vi{constructor(e,t={}){super();const{align:i,tint:s,maxWidth:r,letterSpacing:a,fontName:o,fontSize:h}=Object.assign({},I1.styleDefaults,t);if(!pr.available[o])throw new Error(`Missing BitmapFont "${o}"`);this._activePagesMeshData=[],this._textWidth=0,this._textHeight=0,this._align=i,this._tintColor=new Yt(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 Hn(()=>{this.dirty=!0},this,0,0),this._roundPixels=ze.ROUND_PIXELS,this.dirty=!0,this._resolution=ze.RESOLUTION,this._autoResolution=!0,this._textureCache={}}updateText(){var P;const e=pr.available[this._fontName],t=this.fontSize,i=t/e.size,s=new Dt,r=[],a=[],o=[],h=this._text.replace(/(?:\r\n|\r)/g,`
|
||
`)||" ",l=C1(h),c=this._maxWidth*e.size/t,u=e.distanceFieldType==="none"?ev:tv;let d=null,f=0,p=0,m=0,v=-1,y=0,b=0,g=0,w=0;for(let k=0;k<l.length;k++){const B=l[k],L=Pc(B);if(/(?:\s)/.test(B)&&(v=k,y=f,w++),B==="\r"||B===`
|
||
`){a.push(f),o.push(-1),p=Math.max(p,f),++m,++b,s.x=0,s.y+=e.lineHeight,d=null,w=0;continue}const X=e.chars[L];if(!X)continue;d&&X.kerning[d]&&(s.x+=X.kerning[d]);const O=iv.pop()||{texture:ht.EMPTY,line:0,charCode:0,prevSpaces:0,position:new Dt};O.texture=X.texture,O.line=m,O.charCode=L,O.position.x=Math.round(s.x+X.xOffset+this._letterSpacing/2),O.position.y=Math.round(s.y+X.yOffset),O.prevSpaces=w,r.push(O),f=O.position.x+Math.max(X.xAdvance-X.xOffset,X.texture.orig.width),s.x+=X.xAdvance+this._letterSpacing,g=Math.max(g,X.yOffset+X.texture.height),d=L,v!==-1&&c>0&&s.x>c&&(++b,to(r,1+v-b,1+k-v),k=v,v=-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,w=0)}const E=l[l.length-1];E!=="\r"&&E!==`
|
||
`&&(/(?:\s)/.test(E)&&(f=y),a.push(f),p=Math.max(p,f),o.push(-1));const M=[];for(let k=0;k<=m;k++){let B=0;this._align==="right"?B=p-a[k]:this._align==="center"?B=(p-a[k])/2:this._align==="justify"&&(B=o[k]<0?0:(p-a[k])/o[k]),M.push(B)}const _=r.length,I={},R=[],F=this._activePagesMeshData;u.push(...F);for(let k=0;k<_;k++){const B=r[k].texture,L=B.baseTexture.uid;if(!I[L]){let X=u.pop();if(!X){const D=new ep;let T,U;e.distanceFieldType==="none"?(T=new oh(ht.EMPTY),U=ct.NORMAL):(T=new oh(ht.EMPTY,{program:yn.from(F2,k2),uniforms:{uFWidth:0}}),U=ct.NORMAL_NPM);const N=new bl(D,T);N.blendMode=U,X={index:0,indexCount:0,vertexCount:0,uvsCount:0,total:0,mesh:N,vertices:null,uvs:null,indices:null}}X.index=0,X.indexCount=0,X.vertexCount=0,X.uvsCount=0,X.total=0;const{_textureCache:O}=this;O[L]=O[L]||new ht(B.baseTexture),X.mesh.texture=O[L],X.mesh.tint=this._tintColor.value,R.push(X),I[L]=X}I[L].total++}for(let k=0;k<F.length;k++)R.includes(F[k])||this.removeChild(F[k].mesh);for(let k=0;k<R.length;k++)R[k].mesh.parent!==this&&this.addChild(R[k].mesh);this._activePagesMeshData=R;for(const k in I){const B=I[k],L=B.total;if(!(((P=B.indices)==null?void 0:P.length)>6*L)||B.vertices.length<bl.BATCHABLE_SIZE*2)B.vertices=new Float32Array(8*L),B.uvs=new Float32Array(8*L),B.indices=new Uint16Array(6*L);else{const X=B.total,O=B.vertices;for(let D=X*4*2;D<O.length;D++)O[D]=0}B.mesh.size=6*L}for(let k=0;k<_;k++){const B=r[k];let L=B.position.x+M[B.line]*(this._align==="justify"?B.prevSpaces:1);this._roundPixels&&(L=Math.round(L));const X=L*i,O=B.position.y*i,D=B.texture,T=I[D.baseTexture.uid],U=D.frame,N=D._uvs,Y=T.index++;T.indices[Y*6+0]=0+Y*4,T.indices[Y*6+1]=1+Y*4,T.indices[Y*6+2]=2+Y*4,T.indices[Y*6+3]=0+Y*4,T.indices[Y*6+4]=2+Y*4,T.indices[Y*6+5]=3+Y*4,T.vertices[Y*8+0]=X,T.vertices[Y*8+1]=O,T.vertices[Y*8+2]=X+U.width*i,T.vertices[Y*8+3]=O,T.vertices[Y*8+4]=X+U.width*i,T.vertices[Y*8+5]=O+U.height*i,T.vertices[Y*8+6]=X,T.vertices[Y*8+7]=O+U.height*i,T.uvs[Y*8+0]=N.x0,T.uvs[Y*8+1]=N.y0,T.uvs[Y*8+2]=N.x1,T.uvs[Y*8+3]=N.y1,T.uvs[Y*8+4]=N.x2,T.uvs[Y*8+5]=N.y2,T.uvs[Y*8+6]=N.x3,T.uvs[Y*8+7]=N.y3}this._textWidth=p*i,this._textHeight=(s.y+e.lineHeight)*i;for(const k in I){const B=I[k];if(this.anchor.x!==0||this.anchor.y!==0){let D=0;const T=this._textWidth*this.anchor.x,U=this._textHeight*this.anchor.y;for(let N=0;N<B.total;N++)B.vertices[D++]-=T,B.vertices[D++]-=U,B.vertices[D++]-=T,B.vertices[D++]-=U,B.vertices[D++]-=T,B.vertices[D++]-=U,B.vertices[D++]-=T,B.vertices[D++]-=U}this._maxLineHeight=g*i;const L=B.mesh.geometry.getBuffer("aVertexPosition"),X=B.mesh.geometry.getBuffer("aTextureCoord"),O=B.mesh.geometry.getIndex();L.data=B.vertices,X.data=B.uvs,O.data=B.indices,L.update(),X.update(),O.update()}for(let k=0;k<r.length;k++)iv.push(r[k]);this._font=e,this.dirty=!1}updateTransform(){this.validate(),this.containerUpdateTransform()}_render(e){this._autoResolution&&this._resolution!==e.resolution&&(this._resolution=e.resolution,this.dirty=!0);const{distanceFieldRange:t,distanceFieldType:i,size:s}=pr.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=pr.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(!pr.available[e])throw new Error(`Missing BitmapFont "${e}"`);this._fontName!==e&&(this._fontName=e,this.dirty=!0)}get fontSize(){return this._fontSize??pr.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=pr.available[this._fontName].distanceFieldType==="none"?ev:tv;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=ht.EMPTY});for(const s in t)t[s].destroy(),delete t[s];this._font=null,this._tintColor=null,this._textureCache=null,super.destroy(e)}};O2.styleDefaults={align:"left",tint:16777215,maxWidth:0,letterSpacing:0};const B2=[".xml",".fnt"],L2={extension:{type:$e.LoadParser,priority:xs.Normal},name:"loadBitmapFont",test(n){return B2.includes(pi.extname(n).toLowerCase())},async testParse(n){return Rc.test(n)||zf.test(n)},async parse(n,e,t){const i=Rc.test(n)?Rc.parse(n):zf.parse(n),{src:s}=e,{page:r}=i,a=[];for(let l=0;l<r.length;++l){const c=r[l].file;let u=pi.join(pi.dirname(s),c);u=ih(u,s),a.push(u)}const o=await t.load(a),h=a.map(l=>o[l]);return pr.install(i,h,!0)},async load(n,e){return(await ze.ADAPTER.fetch(n)).text()},unload(n){n.destroy()}};et.add(L2);const qf=class Ga extends Or{constructor(){super(...arguments),this._fonts=[],this._overrides=[],this._stylesheet="",this.fontsDirty=!1}static from(e){return new Ga(Object.keys(Ga.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 Ga.availableFonts[e.originalUrl])}),this.fontFamily="Arial",this._fonts.length=0,this.styleID++,this.fontsDirty=!0)}loadFont(e,t={}){const{availableFonts:i}=Ga;if(i[e]){const s=i[e];return this._fonts.push(s),s.refs++,this.styleID++,this.fontsDirty=!0,Promise.resolve()}return ze.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:pi.basename(e,pi.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=EM(e)),typeof e=="number"?MM(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,Ga.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}=ze.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}};qf.availableFonts={},qf.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 Xd=qf;const lc=class ja extends Dr{constructor(e="",t={}){super(ht.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=ht.from(i,{scaleMode:ze.SCALE_MODE,resourceOptions:{autoLoad:!1}});s.orig=new _t,s.trim=new _t,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=ja.defaultMaxWidth,this.maxHeight=ja.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=ja.defaultAutoResolution,this._resolution=ja.defaultResolution??ze.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({},ja.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=Ar(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=Ar(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 Xd?(this.ownsStyle=!1,this._style=e):e instanceof Or?(console.warn("[HTMLText] Cloning TextStyle, if this is not what you want, use HTMLTextStyle"),this.ownsStyle=!0,this._style=Xd.from(e)):(this.ownsStyle=!0,this._style=new Xd(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," ")}};lc.defaultDestroyOptions={texture:!0,children:!1,baseTexture:!0},lc.defaultMaxWidth=2024,lc.defaultMaxHeight=2024,lc.defaultAutoResolution=!0;function wl(){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 ya(n){var b;const e=wl(),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,v=String(t.trailTextureName||"trail"),y=String(t.trailPreviewUrl||"/images/trail.png").replace("/trails/trail.png","/images/trail.png");for(const[g,w]of Object.entries(e))t[g]!==void 0&&t[g]!==null||(t[g]=Array.isArray(w)?w.map(E=>typeof E=="object"&&E!==null?{...E}:E):w);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=wl().imageResources);for(const g of n.imageResources){!g.texture&&n.texture&&(g.texture=n.texture),g.textureName||(g.textureName="star"),g.previewUrl==="/particles/star.png"&&(g.previewUrl="/images/star.png"),g.previewUrl||(g.previewUrl=g.textureName==="star"?"/images/star.png":""),g.imageMode!=="fixed"&&g.imageMode!=="sequence"&&(g.imageMode="fixed"),g.sequencePlayback==="once"?g.sequencePlayback="once-hold":g.sequencePlayback==="loop"?g.sequencePlayback="loop-forward":["once-hide","once-hold","loop-forward","loop-reverse"].includes(g.sequencePlayback)||(g.sequencePlayback="loop-forward"),Number.isFinite(g.sequenceFps)||(g.sequenceFps=30),g.sequenceFps=Math.min(120,Math.max(1,Number(g.sequenceFps)||30)),Array.isArray(g.sequenceFrames)||(g.sequenceFrames=[]);for(const w of g.sequenceFrames)typeof w.name!="string"&&(w.name=""),typeof w.previewUrl!="string"&&(w.previewUrl=""),w.texture===void 0&&(w.texture=null);Number.isFinite(g.weight)||(g.weight=100),typeof g.locked!="boolean"&&(g.locked=!1),Number.isFinite(g.scale)||(g.scale=1),Number.isFinite(g.anchorX)||(g.anchorX=.5),Number.isFinite(g.anchorY)||(g.anchorY=.5),g.colorMode!=="fixed"&&g.colorMode!=="random"&&g.colorMode!=="lifetime"&&(g.colorMode=n.colorOverLife?"lifetime":"fixed"),g.colorStart||(g.colorStart=n.colorStart||"#ffffff"),g.colorEnd||(g.colorEnd=n.colorEnd||g.colorStart),(!Array.isArray(g.colorGradient)||g.colorGradient.length<2)&&(g.colorGradient=[{position:0,color:g.colorStart},{position:1,color:g.colorEnd}]),Object.prototype.hasOwnProperty.call(xr,g.blend)||(g.blend=n.blend||"normal"),["off","fixed","curve"].includes(g.independentAlpha)||(g.independentAlpha=n.independentAlpha||"off"),Number.isFinite(g.alpha)||(g.alpha=Number.isFinite(n.alphaScale)?n.alphaScale:1),["跟随导出","线性","贝塞尔"].includes(g.alphaCurveMode)||(g.alphaCurveMode=n.curveMode||"跟随导出"),(!Array.isArray(g.alphaCurve)||g.alphaCurve.length<2)&&(g.alphaCurve=(n.alphaCurve||[{x:0,y:1},{x:1,y:1}]).map(w=>({...w})))}if(n.imageResources.length===1)n.imageResources[0].weight=100,n.imageResources[0].locked=!1;else if(i){const g=100/n.imageResources.length;n.imageResources.forEach((w,E)=>{w.weight=E===n.imageResources.length-1?100-g*(n.imageResources.length-1):g,w.locked=!1})}if(n.imageWeightVersion=1,r){const g=Number.isFinite(a)&&a!==0?a:980;n.gravity=g,n.gravityMin=g,n.gravityMax=g}if(o){const g=Number.isFinite(h)&&Number.isFinite(l)&&(h!==0||l!==0);n.windMin=g?Math.hypot(h,l):100,n.windMax=n.windMin,n.windDirection=g?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:v,previewUrl:y,weight:100,locked:!1,rotation:0,colorMode:n.trailColorMode,color:n.trailColor,colorGradient:n.trailColorGradient.map(g=>({...g})),blend:"normal",alphaMode:n.trailAlphaMode,alpha:n.trailAlpha,alphaCurve:n.trailAlphaCurve.map(g=>({...g})),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(g=>({...g})),shapeEnabled:n.trailShapeEnabled,shapeCurve:n.trailShapeCurve.map(g=>({...g}))}]);for(const g of n.trailResources)g.textureName||(g.textureName="trail"),g.previewUrl==="/trails/trail.png"&&(g.previewUrl="/images/trail.png"),g.previewUrl||(g.previewUrl="/images/trail.png"),Number.isFinite(g.weight)||(g.weight=100),typeof g.locked!="boolean"&&(g.locked=!1),Number.isFinite(g.rotation)||(g.rotation=0),["particle","fixed","curve"].includes(g.colorMode)||(g.colorMode=n.trailColorMode||"particle"),g.color||(g.color=n.trailColor||"#ffffff"),(!Array.isArray(g.colorGradient)||g.colorGradient.length<2)&&(g.colorGradient=(n.trailColorGradient||[{position:0,color:"#ffffff"},{position:1,color:"#ffffff"}]).map(w=>({...w}))),Object.prototype.hasOwnProperty.call(xr,g.blend)||(g.blend="normal"),["particle","fixed","curve"].includes(g.alphaMode)||(g.alphaMode=n.trailAlphaMode||"particle"),Number.isFinite(g.alpha)||(g.alpha=Number.isFinite(n.trailAlpha)?n.trailAlpha:1),(!Array.isArray(g.alphaCurve)||g.alphaCurve.length<2)&&(g.alphaCurve=(n.trailAlphaCurve||[{x:0,y:1},{x:1,y:1}]).map(w=>({...w}))),Number.isFinite(g.boneCount)||(g.boneCount=Number.isFinite(n.trailBoneCount)?n.trailBoneCount:3),Number.isFinite(g.trailRatio)||(g.trailRatio=100),g.trailRatio=Math.min(100,Math.max(0,g.trailRatio)),["fixed","random"].includes(g.lengthMode)||(g.lengthMode="fixed"),Number.isFinite(g.length)||(g.length=Number.isFinite(n.trailLength)?n.trailLength:100),Number.isFinite(g.lengthMin)||(g.lengthMin=g.length),Number.isFinite(g.lengthMax)||(g.lengthMax=g.length),["fixed","random"].includes(g.widthSizeMode)||(g.widthSizeMode="fixed"),Number.isFinite(g.width)||(g.width=Number.isFinite(n.trailWidth)?n.trailWidth:100),Number.isFinite(g.widthMin)||(g.widthMin=g.width),Number.isFinite(g.widthMax)||(g.widthMax=g.width),["particle","fixed"].includes(g.widthMode)||(g.widthMode=n.trailWidthMode||"particle"),typeof g.lifeLengthEnabled!="boolean"&&(g.lifeLengthEnabled=!!n.trailLifeLengthEnabled),(!Array.isArray(g.lifeLengthCurve)||g.lifeLengthCurve.length<2)&&(g.lifeLengthCurve=(n.trailLifeLengthCurve||[{x:0,y:1},{x:1,y:1}]).map(w=>({...w}))),typeof g.shapeEnabled!="boolean"&&(g.shapeEnabled=!!n.trailShapeEnabled),(!Array.isArray(g.shapeCurve)||g.shapeCurve.length<2)&&(g.shapeCurve=(n.trailShapeCurve||[{x:0,y:1},{x:1,y:1}]).map(w=>({...w})));if(n.trailResources.length===1&&(n.trailResources[0].weight=100,n.trailResources[0].locked=!1),p)for(const g of n.trailResources)g.alphaCurve=((b=g.alphaCurve)==null?void 0:b.length)>=2?g.alphaCurve:[{x:0,y:1},{x:1,y:1}];return n.trailResourceVersion=6,n}const xr={normal:0,add:1,multiply:2,screen:3},D2=400;class N2 extends Vi{constructor(t,i=D2){super();x(this,"pool",[]);x(this,"cfg");x(this,"accumulator",0);x(this,"burstTimer",0);x(this,"_spawnSerial",0);x(this,"_elapsed",0);x(this,"_attractionEnabledAt",0);x(this,"_attractionWasEnabled",!1);x(this,"_emitterPos",null);x(this,"states",[]);x(this,"rng",Math.random);x(this,"_lastSeed",-1);x(this,"trailDebugGfx",new ls);x(this,"colliders",[]);x(this,"followSpawnX",0);x(this,"followSpawnY",0);x(this,"followSpawnAngle",0);x(this,"followExportCurveMode","线性");x(this,"simulationTransform",null);this.cfg=ya(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=Vd(t>>>0))}_ensurePool(t){for(;this.pool.length<t;){const i=this.pool.length,s=new Dr(this.cfg.texture);s.blendMode=xr[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=Oa(s,t.x,t.y,this.simulationTransform),a=U2(s,t.vx,t.vy,this.simulationTransform);for(const o of this.colliders){if(!o.enabled)continue;const h=Y2(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)),v=u<0?-u*p:u;a.x=d*m+v*h.nx,a.y=f*m+v*h.ny}const l=sv(s,r.x,r.y,this.simulationTransform),c=X2(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)&&ya(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 v=V2(m);if(!m.collisionPaused&&s.useGravity){const T=Math.min(1,Math.max(0,on(s.gravityCurve,v))),U=(s.gravityMode==="random"?m.gravityStrength:s.gravityMin)*T,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 T=Math.min(1,Math.max(0,on(s.windCurve,v))),U=(s.windMode==="random"?m.windStrength:s.windMin)*T,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 T=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,Y=Math.cos(N),G=Math.sin(N),H=((l=this.simulationTransform)==null?void 0:l.centerX)??s.centerX,ne=((c=this.simulationTransform)==null?void 0:c.centerY)??s.centerY,Z=H+Y*T*m.x-G*U*m.y,de=-ne+G*T*m.x+Y*U*m.y,me=Z,_e=-de,Ae=s.forceCenterX-me,ge=s.forceCenterY-_e,Ee=Math.hypot(Ae,ge);if(Ee>1e-4&&Ee<=s.forceRadius){let j=1;s.forceFalloff==="linear"?j=1-Ee/s.forceRadius:s.forceFalloff==="inverse"&&(j=Math.min(10,s.forceRadius/Math.max(Ee,s.forceRadius*.1)));const K=s.forceStrength*j*10,q=Ae/Ee*K,W=ge/Ee*K,Q=q,le=-W;m.vx+=(Y*Q+G*le)/T*t,m.vy+=(-G*Q+Y*le)/U*t}}if(!m.collisionPaused&&s.damping>0){const T=Math.max(0,1-s.damping*t);m.vx*=T,m.vy*=T}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 T=m.maxLife-m.life;if(s.attractionDelayMode==="particle"?T>=Math.max(0,s.attractionDelay):this._elapsed-this._attractionEnabledAt>=Math.max(0,s.attractionDelay)){const N=Oa(s,m.x,m.y,this.simulationTransform),Y=s.attractionCenterX,G=s.attractionCenterY,H=Math.max(0,s.attractionRadius);if(!m.attractionActive){if(Math.hypot(Y-N.x,G-N.y)<=H){this.kill(p);continue}m.attractionActive=!0,m.attractionElapsed=0,m.attractionStartWorldX=N.x,m.attractionStartWorldY=N.y}m.attractionElapsed+=t;const ne=Math.max(1e-4,s.attractionDuration),Z=Math.min(1,m.attractionElapsed/ne);let de=Mi(m.attractionStartWorldX,Y,Z),me=Mi(m.attractionStartWorldY,G,Z);if(s.attractionPath==="curve"){const ge=Y-m.attractionStartWorldX,Ee=G-m.attractionStartWorldY,j=Math.hypot(ge,Ee);if(j>1e-4){const K=j*.25*m.attractionCurveSide,q=(m.attractionStartWorldX+Y)*.5-Ee/j*K,W=(m.attractionStartWorldY+G)*.5+ge/j*K,Q=1-Z;de=Q*Q*m.attractionStartWorldX+2*Q*Z*q+Z*Z*Y,me=Q*Q*m.attractionStartWorldY+2*Q*Z*W+Z*Z*G}}const _e=Math.hypot(Y-de,G-me);if(Z>=1||_e<=H){this.kill(p);continue}const Ae=sv(s,de,me,this.simulationTransform);m.x=Ae.x,m.y=Ae.y,m.vx=0,m.vy=0}}const y=v,b=m.sprite,g=s.imageResources.find(T=>T.id===m.resourceId);if(g){const T=this.imageFrameState(g,m.maxLife-m.life);m.imageFrameIndex=T.index,b.texture=this.imageFrameTexture(g,m.imageFrameIndex),b.visible=T.visible}if(s.speedOverLifeEnabled){const T=cc(Yd(s.speedOverLifeMode,s.speedOverLifeMin,s.speedOverLifeMax,s.speedOverLifeCurve,y,m.speedScaleTarget),1),U=m.speedScale===0?T:T/m.speedScale;m.vx*=U,m.vy*=U,m.speedScale=T}let w=m.rotationSpeed;s.rotationOverLifeEnabled&&s.rotationOverLifeMode==="curve"&&(w=Mi(s.rotationSpeedMin,s.rotationSpeedMax,on(s.rotationOverLifeCurve,y))),m.rotation+=w*t;let E=m.x,M=m.y;if(s.noise&&s.noiseAmt>0&&s.noiseRange>0&&s.noiseSpeed>0){const T=m.maxLife-m.life,U=Math.max(0,s.noiseRange)*Math.min(1,Math.max(0,s.noiseAmt)/100)*.5,N=T*Math.max(0,s.noiseSpeed)*Math.PI*2;E+=(Math.sin(m.noisePhaseX+N)-Math.sin(m.noisePhaseX))*U,M+=(Math.sin(m.noisePhaseY+N*.83)-Math.sin(m.noisePhaseY))*U}b.x=E,b.y=M,b.rotation=-m.rotation*Math.PI/180;let _=1,I=1;s.scaleOverLifeEnabled&&(_=Yd(s.scaleOverLifeMode,s.scaleOverLifeMin,s.scaleOverLifeMax,s.scaleOverLifeCurve,y,m.scaleOverLifeX),I=s.scaleOverLifeAxisMode==="separate"?Yd(s.scaleOverLifeMode,s.scaleYOverLifeMin,s.scaleYOverLifeMax,s.scaleYOverLifeCurve,y,m.scaleOverLifeY):_),b.scale.set(cc(m.scaleStartX*_,1),cc(m.scaleStartY*I,1));const R=s.alphaMode==="curve"?on(s.alphaCurve,y,this.resolveCurveMode(s.curveMode))*s.alphaScale:s.alpha*s.alphaScale;b.alpha=cc((g==null?void 0:g.independentAlpha)==="fixed"?g.alpha:(g==null?void 0:g.independentAlpha)==="curve"?on(g.alphaCurve,y,this.resolveCurveMode(g.alphaCurveMode)):R,1);const F=(g==null?void 0:g.colorStart)||"#ffffff",P=(g==null?void 0:g.colorMode)==="lifetime"?$d(g.colorGradient,y):(g==null?void 0:g.colorMode)==="random"?m.colorSample:ao(F);b.tint=P,b.blendMode=xr[(g==null?void 0:g.blend)||"normal"];const k=this.updateTrail(m,E,M,y,b),B=Oa(s,E,M,this.simulationTransform),L=((u=this.simulationTransform)==null?void 0:u.rotation)??s.rootRotation,X=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=k?{...k,bones:k.bones.map(T=>{const U=Oa(s,T.x,T.y,this.simulationTransform);return{...T,worldX:U.x,worldY:U.y,worldRotation:L-T.rotation}})}:void 0;o.push({boneName:m.boneName,spawnId:m.spawnId,x:E,y:M,rotation:m.rotation,scaleX:b.scale.x,scaleY:b.scale.y,worldX:B.x,worldY:B.y,worldRotation:L+m.rotation,worldScaleX:b.scale.x*X,worldScaleY:b.scale.y*O,alpha:b.alpha,colorHex:P,resourceId:m.resourceId,imageFrameIndex:m.imageFrameIndex,imageVisible:b.visible,trailState:D,active:!0})}return this.states=o,o}ensureTrailMesh(t){const i=this.cfg,s=i.trailResources.find(v=>v.id===t.trailResourceId)||i.trailResources[0],r=(s==null?void 0:s.texture)||ht.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 v=0;v<h;v++){const y=v/(h-1),b=y*(l-1),g=Math.min(l-1,Math.floor(b)),w=Math.min(l-1,g+1),E=b-g;for(let M=0;M<o;M++){const _=v*o+M,I=y,R=M/(o-1),F=a*Math.PI/180,P=Math.cos(F),k=Math.sin(F);d[_*2]=.5+P*(I-.5)-k*(R-.5),d[_*2+1]=.5+k*(I-.5)+P*(R-.5),p.push({boneA:g,boneB:w,weight:E})}}for(let v=0;v<h-1;v++)for(let y=0;y<o-1;y++){const b=v*o+y,g=(v+1)*o+y,w=b+1,E=g+1;f.push(b,g,w,g,E,w)}const m=new a2(r,u,d,new Uint16Array(f));return m.visible=!1,m.blendMode=xr.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],v=a[p],y=Math.hypot(v.x-m.x,v.y-m.y);if(d+y>=u&&y>1e-4){const b=(u-d)/y;f={x:Mi(m.x,v.x,b),y:Mi(m.y,v.y,b)};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:Mi(f.x,p.x,d.weight),y:Mi(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,v=Math.max(1e-4,Math.hypot(p,m)),y=-m/v,b=p/v,g=u/(h-1),w=a.shapeEnabled?Math.max(0,on(a.shapeCurve,g)):1;for(let E=0;E<o;E++){const _=(E/(o-1)-.5)*i.width*w,I=(u*o+E)*2;l[I]=c[u].x+y*_,l[I+1]=c[u].y+b*_}}s.tint=i.colorHex,s.alpha=i.alpha,s.blendMode=xr[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,on(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"?on(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"?$d(h.colorGradient,r):ao((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(g=>!g.active);if(i===-1)return;const{x:s,y:r}=this.spawnOrigin(),a=Ba(t.lifeMode,t.lifeMin,t.lifeMax,t.lifeCurve,this.rng()),o=Ba(t.speedMode,t.speedMin,t.speedMax,t.speedCurve,this.rng());let h;t.shape==="cone"?h=(t.direction+this.followSpawnAngle+Mi(-t.coneAngle/2,t.coneAngle/2,this.rng()))*Math.PI/180:h=(t.direction+this.followSpawnAngle+Mi(-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(Wr(t.seed,u,1540483477));l.noisePhaseX=Wr(t.seed,u,1757159915)*Math.PI*2,l.noisePhaseY=Wr(t.seed,u,48610963)*Math.PI*2,l.gravityStrength=t.useGravity&&t.gravityMode==="random"?Mi(t.gravityMin,t.gravityMax,this.rng()):t.gravityMin,l.windStrength=t.wind&&t.windMode==="random"?Mi(t.windMin,t.windMax,this.rng()):t.windMin,l.attractionActive=!1,l.attractionElapsed=0,l.collisionPaused=!1,l.attractionCurveSide=Wr(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,v=Wr(t.seed,u,668265261)*100,y=(g,w,E,M,_)=>{if(g!=="random")return Math.max(0,Number(w)||0);const I=Math.max(0,Math.min(Number(E)||0,Number(M)||0)),R=Math.max(0,Math.max(Number(E)||0,Number(M)||0));return Mi(I,R,Wr(t.seed,u,_))};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||v<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=Ba(t.scaleMode,t.scaleMin,t.scaleMax,t.scaleCurve,this.rng())*c.scale,l.scaleStartY=t.scaleAxisMode==="separate"?Ba(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:Ba(t.initialRotationMode,t.initialRotationMin,t.initialRotationMax,t.initialRotationCurve,this.rng()),l.rotationSpeed=t.rotationOverLifeEnabled?Ba(t.rotationOverLifeMode,t.rotationSpeedMin,t.rotationSpeedMax,t.rotationOverLifeCurve,this.rng()):0,l.speedScale=1,l.speedScaleTarget=t.speedOverLifeMode==="random"?Mi(t.speedOverLifeMin,t.speedOverLifeMax,this.rng()):t.speedOverLifeMin,l.scaleOverLifeX=t.scaleOverLifeMode==="random"?Mi(t.scaleOverLifeMin,t.scaleOverLifeMax,this.rng()):t.scaleOverLifeMin,l.scaleOverLifeY=t.scaleOverLifeMode==="random"?Mi(t.scaleYOverLifeMin,t.scaleYOverLifeMax,this.rng()):t.scaleYOverLifeMin,l.resourceId=c.id,l.colorSample=c.colorMode==="random"?$d(c.colorGradient,Wr(t.seed,u,2654435769)):ao(c.colorStart);const b=this.imageFrameState(c,0);l.imageFrameIndex=b.index,l.sprite.texture=this.imageFrameTexture(c,b.index),l.sprite.anchor.set(c.anchorX,c.anchorY),l.sprite.blendMode=xr[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=Oa(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=Oa(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=xr[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=Vd(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=Vd(this.cfg.seed>>>0)}}function Mi(n,e,t){return n+(e-n)*t}function cc(n,e){return Number.isFinite(n)?n:e}function Oa(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 sv(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 U2(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 X2(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 Y2(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,_,I,R)=>{const F=I/a,P=R/o,k=Math.max(1e-4,Math.hypot(F,P)),B=F/k,L=P/k,X=s*B-r*L,O=r*B+s*L;return{x:n.x+s*M*a-r*_*o+X*.05,y:n.y+r*M*a+s*_*o+O*.05,nx:X,ny:O}};if(n.shape==="circle"){const M=Math.max(.001,n.radius),_=Math.hypot(c,u);if(_>=M)return null;const I=_>1e-4?c/_:1,R=_>1e-4?u/_:0;return d(I*M,R*M,I,R)}if(n.shape==="ellipse"){const M=Math.max(.001,n.radiusX),_=Math.max(.001,n.radiusY),I=Math.hypot(c/M,u/_);if(I>=1)return null;const R=I>1e-4?1/I:1,F=I>1e-4?c*R:M,P=I>1e-4?u*R:0,k=Math.max(1e-4,Math.hypot(F/(M*M),P/(_*_)));return d(F,P,F/(M*M)/k,P/(_*_)/k)}if(n.shape==="rect"){const M=Math.max(.001,n.width*.5),_=Math.max(.001,n.height*.5);if(Math.abs(c)>=M||Math.abs(u)>=_)return null;const I=M-Math.abs(c),R=_-Math.abs(u);if(I<R){const P=c>=0?1:-1;return d(P*M,u,P,0)}const F=u>=0?1:-1;return d(c,F*_,0,F)}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),v=Array.from({length:f},(M,_)=>{const I=Math.PI*.5+_/f*Math.PI*2;return{x:Math.cos(I)*p,y:Math.sin(I)*m}});let y=!1;for(let M=0,_=v.length-1;M<v.length;_=M++){const I=v[M],R=v[_];I.y>u!=R.y>u&&c<(R.x-I.x)*(u-I.y)/(R.y-I.y)+I.x&&(y=!y)}if(!y)return null;let b=v[0].x,g=v[0].y,w=1/0;for(let M=0;M<v.length;M++){const _=v[M],I=v[(M+1)%v.length],R=I.x-_.x,F=I.y-_.y,P=Math.max(1e-4,R*R+F*F),k=Math.min(1,Math.max(0,((c-_.x)*R+(u-_.y)*F)/P)),B=_.x+R*k,L=_.y+F*k,X=Math.hypot(B-c,L-u);X<w&&(w=X,b=B,g=L)}const E=Math.max(1e-4,Math.hypot(b-c,g-u));return d(b,g,(b-c)/E,(g-u)/E)}function V2(n){return Math.min(1,Math.max(0,1-n.life/Math.max(1e-4,n.maxLife)))}function Wr(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 Ba(n,e,t,i,s){return n==="fixed"?e:n==="curve"?Mi(e,t,on(i,s)):Mi(e,t,s)}function Yd(n,e,t,i,s,r){return n==="curve"?Mi(e,t,on(i,s)):n==="random"?r:e}function nv(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 on(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 Mi(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;nv(r.x,h,c,a.x,m)<e?d=m:f=m}return nv(r.y,l,u,a.y,(d+f)/2)}return i[i.length-1].y}function Vd(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 ao(n){let e=n.replace("#","");return e.length===3&&(e=e.split("").map(t=>t+t).join("")),parseInt(e,16)}function $2(n,e,t){const i=rv(n),s=rv(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 $d(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 ao(t[0].color);if(e>=t[t.length-1].position)return ao(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 $2(s.color,r.color,a)}return ao(t[t.length-1].color)}function rv(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 xa=new Map,fa=new Map;function G2(n){return[...xa.values()].some(e=>e===n)}function R1(n){if(!(G2(n)||(fa.get(n)||0)>0)){fa.delete(n);for(const e of n.textures)e.destroy(!0)}}function j2(n){const e=fa.get(n)||0;e>1?fa.set(n,e-1):fa.delete(n),R1(n)}function H2(n){return xa.get(n)||null}function tu(n,e){kl(n),xa.set(n,e)}function W2(n){const e=xa.get(n);return e?(fa.set(e,(fa.get(e)||0)+1),e):null}function z2(n,e){const t=xa.get(n);return t?(tu(e,t),!0):!1}function kl(n){const e=xa.get(n);e&&(xa.delete(n),R1(e))}function ni(n){if(Array.isArray(n))return n.map(e=>ni(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]=ni(s);return t}}return n}const P1=["3.8","4.0","4.1","4.2","4.3"];function ch(n){const e=String(n||"").trim();return P1.find(t=>e===t||e.startsWith(`${t}.`))||null}function Kf(){return P1.join(" / ")}function q2(n){return n==="4.3"?"4.3":"4.2"}function ip(){return{imagesPath:"./images/",spineVersion:"4.2",keyframeCurve:"linear",fps:30,omitFps:!1,integerFrameAlignment:!0,bonePool:!0,excludeEmptyAnimations:!1,fileName:"SpineParticle.json"}}function k1(n){const e=Object.assign(ip(),n||{});return e.imagesPath=String(e.imagesPath||"./images/"),e.spineVersion=ch(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 Zf=30;function kc(n,e=1){return Math.min(1800,Math.max(1,Math.ceil(Number(n)||e)))}function F1(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 kc(Math.ceil(s*Math.max(1,e)),Zf)}function Ir(n,e=30){const t=kc(n.loopDurationFrames),i=F1(n,e),s=n.generateLoopStartAnimation?n.loopStartUseCustomDuration?kc(n.loopStartDurationFrames,Zf):i:0,r=n.generateLoopEndAnimation?n.loopEndUseCustomDuration?kc(n.loopEndDurationFrames,Zf):i:0;return{start:s,loop:t,end:r,total:s+t+r}}function O1(n,e){const t=Ir(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 Fc(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 K2(n,e,t){const i=Math.max(1,e-1),s=Math.max(1,t-1),r=n.end>=i?s:n.end;return Fc(n.start,r,t)}let hc=1,uc=1,dc=1,fc=1;function mc(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 Fl=wT("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:ip()}}),getters:{activeSystemCount:n=>n.systems.length},actions:{syncSceneSequences(){hc=Math.max(hc,...this.systems.map(n=>n.id+1),1),uc=Math.max(uc,...this.colliders.map(n=>n.id+1),1),dc=Math.max(dc,...this.paths.map(n=>n.id+1),1),fc=Math.max(fc,...this.spines.map(n=>n.id+1),1)},addSystem(n){const e=wl();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:hc++,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=uc++,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=dc++,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=fc++,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=ni(i);return s.id=hc++,s.config.name=mc(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=ni(i);return s.id=uc++,s.name=mc(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=ni(i);return s.id=dc++,s.name=mc(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=ni(e);return t.id=fc++,t.name=mc(e.name,this.spines.map(i=>i.name)),t.selectedBone="",z2(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){kl(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=Fc(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=Fc(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=Fc(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)+Ir(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=K2({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}}}),B1="SpineParticle.SystemSettings",L1=1,Gd="SpineParticle.SystemSettings.v1";function Do(n,e,t,i){const s=Number(n);return Math.min(t,Math.max(e,Number.isFinite(s)?s:i))}function Z2(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 J2(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(Do(n.undoLimit,1,200,e.undoLimit)),showEmitter:t("showEmitter"),showBones:t("showBones"),bonePointDrawSize:Do(n.bonePointDrawSize,.1,10,e.bonePointDrawSize),boneAxisDrawSize:Do(n.boneAxisDrawSize,.1,10,e.boneAxisDrawSize),showSkinMesh:t("showSkinMesh"),tickEnabled:t("tickEnabled"),axisFontSize:Math.round(Do(n.axisFontSize,8,40,e.axisFontSize)),tickWidth:Do(n.tickWidth,1,5,e.tickWidth),showAxisLabels:t("showAxisLabels"),axisColor:i}}function Q2(n){let e;try{e=JSON.parse(n)}catch{throw new Error("系统设置缓存不是有效的 JSON")}const t=e;if(t.format!==B1)throw new Error("不是 Spine粒子编辑器系统设置缓存");if(t.version!==L1)throw new Error(`暂不支持系统配置版本:${t.version??"未知"}`);if(!t.settings||typeof t.settings!="object")throw new Error("系统设置缓存缺少 settings");return t}function eI(n,e){Object.assign(n.settings,J2(e,n.settings))}let pc=null;function tI(n){pc==null||pc();try{const e=localStorage.getItem(Gd);e&&eI(n,Q2(e).settings)}catch{try{localStorage.removeItem(Gd)}catch{}}pc=vs(()=>Z2(n.settings),e=>{const t={format:B1,version:L1,savedAt:new Date().toISOString(),settings:e};try{localStorage.setItem(Gd,JSON.stringify(t))}catch{}},{deep:!0})}function ji(n){return n.map(e=>({...e,trailState:e.trailState?{...e.trailState,bones:e.trailState.bones.map(t=>({...t}))}:void 0}))}function iI(n){const e=new Map;for(const i of n)for(const s of i)e.has(s.boneName)||e.set(s.boneName,ji([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||{...ji([e.get(r)])[0],alpha:0,imageVisible:!1,trailState:void 0,active:!0}})}}function sI(n){n.length<2||(n[n.length-1]=ji(n[0]))}function nI(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(ji(n[r]||[]))}return i}function jd(n){return`${n.boneName}:${n.spawnId??"legacy"}`}function av(n){return{...ji([n])[0],alpha:0,imageVisible:!1,trailState:void 0,active:!0}}function rI(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=jd(l),u=new Map;let d=!1;for(let f=r.length-1;f>=0;f--){const p=r[f].find(m=>jd(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 ji([u])[0];const d=(f=a.get(jd(u)))==null?void 0:f.get(c);return d?ji([d])[0]:av(u)}))}return h[0]=h[0].map(av),h[h.length-1]=ji(e),h}function ov(n,e){const t=n.length?1:0;for(let i=t;i<e.length;i++)n.push(ji(e[i]))}function aI(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=Ir(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=b=>{const g=b?[[]]:[];e.reset();for(let w=0;w<l;w++){w>0&&e.restartEmissionCycle();for(let E=0;E<o.loop;E++)e.update(r,"force"),b&&g.push(e.capture())}return{seam:e.capture(),warmup:g}},f=d(s.generateLoopStartAnimation),p=ji(f.seam),m=[ji(p)];e.restartEmissionCycle();for(let b=0;b<o.loop;b++)e.update(r,"force"),m.push(e.capture());iI(m),sI(m);for(let b=0;b<c;b++)u.push([]);if(s.generateLoopStartAnimation){const b=rI(f.warmup,m[0],o.start,h);for(const g of b)u.push(ji(g))}else u.push(ji(m[0]));if(ov(u,m),s.generateLoopEndAnimation){d(!1);const b=[ji(m[0])],g=Math.max(1,h+2);for(let w=0;w<g&&e.activeCount>0;w++)e.update(r,"off"),b.push(e.capture());(y=b[b.length-1])!=null&&y.length&&b.push([]),ov(u,nI(b,o.end))}const v=ji(u[u.length-1]||[]);for(u.length>i&&(u.length=i);u.length<i;)u.push(ji(v));n.frames=u,e.apply(u[0]||[])}class oI{constructor(){x(this,"container",new Vi);x(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=H2(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 Vi,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,v=u*r.b+d*r.d,y=a.position.x+l*r.worldX+c*r.worldY,b=a.position.y+u*r.worldX+d*r.worldY;return{x:y,y:-b,rotation:-Math.atan2(m,f)*180/Math.PI,scaleX:Math.max(1e-4,Math.hypot(f,m)),scaleY:Math.max(1e-4,Math.hypot(p,v))}}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 D1=class{constructor(){x(this,"entries",{});x(this,"size",0)}add(e){let t=this.entries[e];return this.entries[e]=!0,t?!1:(this.size++,!0)}addAll(e){let t=this.size;for(var i=0,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 Gi;let St=(Gi=class{constructor(e=0,t=0,i=0,s=0){x(this,"r");x(this,"g");x(this,"b");x(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 Gi){return t.setFromString(e)}},x(Gi,"WHITE",new Gi(1,1,1,1)),x(Gi,"RED",new Gi(1,0,0,1)),x(Gi,"GREEN",new Gi(0,1,0,1)),x(Gi,"BLUE",new Gi(0,0,1,1)),x(Gi,"MAGENTA",new Gi(1,0,1,1)),Gi);var mi;let Ye=(mi=class{static clamp(e,t,i){return e<t?t:e>i?i:e}static cosDeg(e){return Math.cos(e*mi.degRad)}static sinDeg(e){return Math.sin(e*mi.degRad)}static atan2Deg(e,t){return Math.atan2(e,t)*mi.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 mi.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}},x(mi,"PI",3.1415927),x(mi,"PI2",mi.PI*2),x(mi,"invPI2",1/mi.PI2),x(mi,"radiansToDegrees",180/mi.PI),x(mi,"radDeg",mi.radiansToDegrees),x(mi,"degreesToRadians",mi.PI/180),x(mi,"degRad",mi.degreesToRadians),mi);var Ns;let Ve=(Ns=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:Ns.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(Ns.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(Ns.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 Ns.SUPPORTS_TYPED_ARRAYS?new Float32Array(e):e}static toSinglePrecision(e){return Ns.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)]}},x(Ns,"SUPPORTS_TYPED_ARRAYS",typeof Float32Array<"u"),Ns),hh=class{constructor(e){x(this,"items",new Array);x(this,"instantiator");this.instantiator=e}obtain(){return this.items.length>0?this.items.pop():this.instantiator()}free(e){e.reset&&e.reset(),this.items.push(e)}freeAll(e){for(let t=0;t<e.length;t++)this.free(e[t])}clear(){this.items.length=0}},uh=class{constructor(e=0,t=0){x(this,"x");x(this,"y");this.x=e,this.y=t}set(e,t){return this.x=e,this.y=t,this}length(){let e=this.x,t=this.y;return Math.sqrt(e*e+t*t)}normalize(){let e=this.length();return e!=0&&(this.x/=e,this.y/=e),this}},N1=class{constructor(e){x(this,"name");if(!e)throw new Error("name cannot be null.");this.name=e}};var na;let ar=(na=class extends N1{constructor(t){super(t);x(this,"id",na.nextID++);x(this,"bones",null);x(this,"vertices",[]);x(this,"worldVerticesLength",0);x(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,v=m.worldX,y=m.worldY,b=m.a,g=m.b,w=m.c,E=m.d;for(let M=i,_=a;_<s;M+=2,_+=o){let I=c[M],R=c[M+1];r[_]=I*b+R*g+v,r[_+1]=I*w+R*E+y}return}let d=0,f=0;for(let m=0;m<i;m+=2){let v=u[d];d+=v+1,f+=v}let p=h.bones;if(l.length==0)for(let m=a,v=f*3;m<s;m+=o){let y=0,b=0,g=u[d++];for(g+=d;d<g;d++,v+=3){let w=p[u[d]],E=c[v],M=c[v+1],_=c[v+2];y+=(E*w.a+M*w.b+w.worldX)*_,b+=(E*w.c+M*w.d+w.worldY)*_}r[m]=y,r[m+1]=b}else{let m=l;for(let v=a,y=f*3,b=f<<1;v<s;v+=o){let g=0,w=0,E=u[d++];for(E+=d;d<E;d++,y+=3,b+=2){let M=p[u[d]],_=c[y]+m[b],I=c[y+1]+m[b+1],R=c[y+2];g+=(_*M.a+I*M.b+M.worldX)*R,w+=(_*M.c+I*M.d+M.worldY)*R}r[v]=g,r[v+1]=w}}}copyTo(t){this.bones?(t.bones=new Array(this.bones.length),Ve.arrayCopy(this.bones,0,t.bones,0,this.bones.length)):t.bones=null,this.vertices&&(t.vertices=Ve.newFloatArray(this.vertices.length),Ve.arrayCopy(this.vertices,0,t.vertices,0,this.vertices.length)),t.worldVerticesLength=this.worldVerticesLength,t.timelineAttachment=this.timelineAttachment}},x(na,"nextID",0),na);var Kn;let U1=(Kn=class{constructor(e){x(this,"id",Kn.nextID());x(this,"regions");x(this,"start",0);x(this,"digits",0);x(this,"setupIndex",0);this.regions=new Array(e)}copy(){let e=new Kn(this.regions.length);return Ve.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 Kn._nextID++}},x(Kn,"_nextID",0),Kn);var Ni;(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"})(Ni||(Ni={}));const X1=[Ni.hold,Ni.once,Ni.loop,Ni.pingpong,Ni.onceReverse,Ni.loopReverse,Ni.pingpongReverse];let sp=class{constructor(e,t,i){x(this,"name");x(this,"timelines",[]);x(this,"timelineIds",new D1);x(this,"duration");if(!e)throw new Error("name cannot be null.");this.name=e,this.setTimelines(t),this.duration=i}setTimelines(e){if(!e)throw new Error("timelines cannot be null.");this.timelines=e,this.timelineIds.clear();for(var t=0;t<e.length;t++)this.timelineIds.addAll(e[t].getPropertyIds())}hasTimeline(e){for(let t=0;t<e.length;t++)if(this.timelineIds.contains(e[t]))return!0;return!1}apply(e,t,i,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 Ce;(function(n){n[n.setup=0]="setup",n[n.first=1]="first",n[n.replace=2]="replace",n[n.add=3]="add"})(Ce||(Ce={}));var zi;(function(n){n[n.mixIn=0]="mixIn",n[n.mixOut=1]="mixOut"})(zi||(zi={}));const Tt={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 ai=class{constructor(e,t){x(this,"propertyIds");x(this,"frames");this.propertyIds=t,this.frames=Ve.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}},Cn=class extends ai{constructor(t,i,s){super(t,s);x(this,"curves");this.curves=Ve.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=Ve.newFloatArray(i);Ve.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,v=(a-h*2+c)*.03,y=((o-l)*3-r+u)*.006,b=((h-c)*3-a+d)*.006,g=m*2+y,w=v*2+b,E=(o-r)*.3+m+y*.16666667,M=(h-a)*.3+v+b*.16666667,_=r+E,I=a+M;for(let R=p+18;p<R;p+=2)f[p]=_,f[p+1]=I,E+=g,M+=w,g+=y,w+=b,_+=E,I+=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)}},zs=class extends Cn{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 Ce.setup:return r;case Ce.first:return s+(r-s)*t}return s}let a=this.getCurveValue(e);switch(i){case Ce.setup:return r+a*t;case Ce.first:case Ce.replace:a+=r-s}return s+a*t}getAbsoluteValue(e,t,i,s,r){if(e<this.frames[0]){switch(i){case Ce.setup:return r;case Ce.first:return s+(r-s)*t}return s}let a=this.getCurveValue(e);return i==Ce.setup?r+(a-r)*t:s+(a-s)*t}getAbsoluteValue2(e,t,i,s,r,a){if(e<this.frames[0]){switch(i){case Ce.setup:return r;case Ce.first:return s+(r-s)*t}return s}return i==Ce.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 Ce.setup:return a;case Ce.first:return r+(a-r)*t}return r}let h=this.getCurveValue(e)*a;if(t==1)return i==Ce.add?r+h-a:h;if(s==zi.mixOut)switch(i){case Ce.setup:return a+(Math.abs(h)*Ye.signum(a)-a)*t;case Ce.first:case Ce.replace:return r+(Math.abs(h)*Ye.signum(r)-r)*t}else{let l=0;switch(i){case Ce.setup:return l=Math.abs(a)*Ye.signum(h),l+(h-l)*t;case Ce.first:case Ce.replace:return l=Math.abs(r)*Ye.signum(h),l+(h-l)*t}}return r+(h-a)*t}};class np extends Cn{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 dh=class extends zs{constructor(t,i,s){super(t,i,Tt.rotate+"|"+s);x(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))}},Y1=class extends np{constructor(t,i,s){super(t,i,Tt.x+"|"+s,Tt.y+"|"+s);x(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 Ce.setup:l.x=l.data.x,l.y=l.data.y;return;case Ce.first:l.x+=(l.data.x-l.x)*a,l.y+=(l.data.y-l.y)*a}return}let u=0,d=0,f=ai.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 v=(s-m)/(c[f+3]-m);u+=(c[f+3+1]-u)*v,d+=(c[f+3+2]-d)*v;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 Ce.setup:l.x=l.data.x+u*a,l.y=l.data.y+d*a;break;case Ce.first:case Ce.replace:l.x+=(l.data.x+u-l.x)*a,l.y+=(l.data.y+d-l.y)*a;break;case Ce.add:l.x+=u*a,l.y+=d*a}}},V1=class extends zs{constructor(t,i,s){super(t,i,Tt.x+"|"+s);x(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))}},$1=class extends zs{constructor(t,i,s){super(t,i,Tt.y+"|"+s);x(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))}},G1=class extends np{constructor(t,i,s){super(t,i,Tt.scaleX+"|"+s,Tt.scaleY+"|"+s);x(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 Ce.setup:l.scaleX=l.data.scaleX,l.scaleY=l.data.scaleY;return;case Ce.first:l.scaleX+=(l.data.scaleX-l.scaleX)*a,l.scaleY+=(l.data.scaleY-l.scaleY)*a}return}let u,d,f=ai.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 v=(s-m)/(c[f+3]-m);u+=(c[f+3+1]-u)*v,d+=(c[f+3+2]-d)*v;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==Ce.add?(l.scaleX+=u-l.data.scaleX,l.scaleY+=d-l.data.scaleY):(l.scaleX=u,l.scaleY=d);else{let m=0,v=0;if(h==zi.mixOut)switch(o){case Ce.setup:m=l.data.scaleX,v=l.data.scaleY,l.scaleX=m+(Math.abs(u)*Ye.signum(m)-m)*a,l.scaleY=v+(Math.abs(d)*Ye.signum(v)-v)*a;break;case Ce.first:case Ce.replace:m=l.scaleX,v=l.scaleY,l.scaleX=m+(Math.abs(u)*Ye.signum(m)-m)*a,l.scaleY=v+(Math.abs(d)*Ye.signum(v)-v)*a;break;case Ce.add:l.scaleX+=(u-l.data.scaleX)*a,l.scaleY+=(d-l.data.scaleY)*a}else switch(o){case Ce.setup:m=Math.abs(l.data.scaleX)*Ye.signum(u),v=Math.abs(l.data.scaleY)*Ye.signum(d),l.scaleX=m+(u-m)*a,l.scaleY=v+(d-v)*a;break;case Ce.first:case Ce.replace:m=Math.abs(l.scaleX)*Ye.signum(u),v=Math.abs(l.scaleY)*Ye.signum(d),l.scaleX=m+(u-m)*a,l.scaleY=v+(d-v)*a;break;case Ce.add:l.scaleX+=(u-l.data.scaleX)*a,l.scaleY+=(d-l.data.scaleY)*a}}}},j1=class extends zs{constructor(t,i,s){super(t,i,Tt.scaleX+"|"+s);x(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))}},H1=class extends zs{constructor(t,i,s){super(t,i,Tt.scaleY+"|"+s);x(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))}},W1=class extends np{constructor(t,i,s){super(t,i,Tt.shearX+"|"+s,Tt.shearY+"|"+s);x(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 Ce.setup:l.shearX=l.data.shearX,l.shearY=l.data.shearY;return;case Ce.first:l.shearX+=(l.data.shearX-l.shearX)*a,l.shearY+=(l.data.shearY-l.shearY)*a}return}let u=0,d=0,f=ai.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 v=(s-m)/(c[f+3]-m);u+=(c[f+3+1]-u)*v,d+=(c[f+3+2]-d)*v;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 Ce.setup:l.shearX=l.data.shearX+u*a,l.shearY=l.data.shearY+d*a;break;case Ce.first:case Ce.replace:l.shearX+=(l.data.shearX+u-l.shearX)*a,l.shearY+=(l.data.shearY+d-l.shearY)*a;break;case Ce.add:l.shearX+=u*a,l.shearY+=d*a}}},z1=class extends zs{constructor(t,i,s){super(t,i,Tt.shearX+"|"+s);x(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))}},q1=class extends zs{constructor(t,i,s){super(t,i,Tt.shearY+"|"+s);x(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))}},K1=class extends ai{constructor(t,i){super(t,[Tt.inherit+"|"+i]);x(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==zi.mixOut){o==Ce.setup&&(l.inherit=l.data.inherit);return}let c=this.frames;if(s<c[0]){(o==Ce.setup||o==Ce.first)&&(l.inherit=l.data.inherit);return}l.inherit=this.frames[ai.search(c,s,2)+1]}},Z1=class extends Cn{constructor(t,i,s){super(t,i,[Tt.rgb+"|"+s,Tt.alpha+"|"+s]);x(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 b=l.data.color;switch(o){case Ce.setup:u.setFromColor(b);return;case Ce.first:u.add((b.r-u.r)*a,(b.g-u.g)*a,(b.b-u.b)*a,(b.a-u.a)*a)}return}let d=0,f=0,p=0,m=0,v=ai.search(c,s,5),y=this.curves[v/5];switch(y){case 0:let b=c[v];d=c[v+1],f=c[v+2],p=c[v+3],m=c[v+4];let g=(s-b)/(c[v+5]-b);d+=(c[v+5+1]-d)*g,f+=(c[v+5+2]-f)*g,p+=(c[v+5+3]-p)*g,m+=(c[v+5+4]-m)*g;break;case 1:d=c[v+1],f=c[v+2],p=c[v+3],m=c[v+4];break;default:d=this.getBezierValue(s,v,1,y-2),f=this.getBezierValue(s,v,2,y+18-2),p=this.getBezierValue(s,v,3,y+36-2),m=this.getBezierValue(s,v,4,y+54-2)}a==1?u.set(d,f,p,m):(o==Ce.setup&&u.setFromColor(l.data.color),u.add((d-u.r)*a,(f-u.g)*a,(p-u.b)*a,(m-u.a)*a))}},J1=class extends Cn{constructor(t,i,s){super(t,i,[Tt.rgb+"|"+s]);x(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 Ce.setup:u.r=y.r,u.g=y.g,u.b=y.b;return;case Ce.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=ai.search(c,s,4),v=this.curves[m>>2];switch(v){case 0:let y=c[m];d=c[m+1],f=c[m+2],p=c[m+3];let b=(s-y)/(c[m+4]-y);d+=(c[m+4+1]-d)*b,f+=(c[m+4+2]-f)*b,p+=(c[m+4+3]-p)*b;break;case 1:d=c[m+1],f=c[m+2],p=c[m+3];break;default:d=this.getBezierValue(s,m,1,v-2),f=this.getBezierValue(s,m,2,v+18-2),p=this.getBezierValue(s,m,3,v+36-2)}if(a==1)u.r=d,u.g=f,u.b=p;else{if(o==Ce.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}}},Q1=class extends zs{constructor(t,i,s){super(t,i,Tt.alpha+"|"+s);x(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 Ce.setup:c.a=d.a;return;case Ce.first:c.a+=(d.a-c.a)*a}return}let u=this.getCurveValue(s);a==1?c.a=u:(o==Ce.setup&&(c.a=l.data.color.a),c.a+=(u-c.a)*a)}},eb=class extends Cn{constructor(t,i,s){super(t,i,[Tt.rgb+"|"+s,Tt.alpha+"|"+s,Tt.rgb2+"|"+s]);x(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,_=l.data.darkColor;switch(o){case Ce.setup:u.setFromColor(M),d.r=_.r,d.g=_.g,d.b=_.b;return;case Ce.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+=(_.r-d.r)*a,d.g+=(_.g-d.g)*a,d.b+=(_.b-d.b)*a}return}let f=0,p=0,m=0,v=0,y=0,b=0,g=0,w=ai.search(c,s,8),E=this.curves[w>>3];switch(E){case 0:let M=c[w];f=c[w+1],p=c[w+2],m=c[w+3],v=c[w+4],y=c[w+5],b=c[w+6],g=c[w+7];let _=(s-M)/(c[w+8]-M);f+=(c[w+8+1]-f)*_,p+=(c[w+8+2]-p)*_,m+=(c[w+8+3]-m)*_,v+=(c[w+8+4]-v)*_,y+=(c[w+8+5]-y)*_,b+=(c[w+8+6]-b)*_,g+=(c[w+8+7]-g)*_;break;case 1:f=c[w+1],p=c[w+2],m=c[w+3],v=c[w+4],y=c[w+5],b=c[w+6],g=c[w+7];break;default:f=this.getBezierValue(s,w,1,E-2),p=this.getBezierValue(s,w,2,E+18-2),m=this.getBezierValue(s,w,3,E+36-2),v=this.getBezierValue(s,w,4,E+54-2),y=this.getBezierValue(s,w,5,E+72-2),b=this.getBezierValue(s,w,6,E+90-2),g=this.getBezierValue(s,w,7,E+108-2)}if(a==1)u.set(f,p,m,v),d.r=y,d.g=b,d.b=g;else{if(o==Ce.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,(v-u.a)*a),d.r+=(y-d.r)*a,d.g+=(b-d.g)*a,d.b+=(g-d.b)*a}}},tb=class extends Cn{constructor(t,i,s){super(t,i,[Tt.rgb+"|"+s,Tt.rgb2+"|"+s]);x(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 E=l.data.color,M=l.data.darkColor;switch(o){case Ce.setup:u.r=E.r,u.g=E.g,u.b=E.b,d.r=M.r,d.g=M.g,d.b=M.b;return;case Ce.first:u.r+=(E.r-u.r)*a,u.g+=(E.g-u.g)*a,u.b+=(E.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,v=0,y=0,b=0,g=ai.search(c,s,7),w=this.curves[g/7];switch(w){case 0:let E=c[g];f=c[g+1],p=c[g+2],m=c[g+3],v=c[g+4],y=c[g+5],b=c[g+6];let M=(s-E)/(c[g+7]-E);f+=(c[g+7+1]-f)*M,p+=(c[g+7+2]-p)*M,m+=(c[g+7+3]-m)*M,v+=(c[g+7+4]-v)*M,y+=(c[g+7+5]-y)*M,b+=(c[g+7+6]-b)*M;break;case 1:f=c[g+1],p=c[g+2],m=c[g+3],v=c[g+4],y=c[g+5],b=c[g+6];break;default:f=this.getBezierValue(s,g,1,w-2),p=this.getBezierValue(s,g,2,w+18-2),m=this.getBezierValue(s,g,3,w+36-2),v=this.getBezierValue(s,g,4,w+54-2),y=this.getBezierValue(s,g,5,w+72-2),b=this.getBezierValue(s,g,6,w+90-2)}if(a==1)u.r=f,u.g=p,u.b=m,d.r=v,d.g=y,d.b=b;else{if(o==Ce.setup){let E=l.data.color,M=l.data.darkColor;u.r=E.r,u.g=E.g,u.b=E.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+=(v-d.r)*a,d.g+=(y-d.g)*a,d.b+=(b-d.b)*a}}},Wa=class extends ai{constructor(t,i){super(t,[Tt.attachment+"|"+i]);x(this,"slotIndex",0);x(this,"attachmentNames");this.slotIndex=i,this.attachmentNames=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,i,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==zi.mixOut){o==Ce.setup&&this.setAttachment(t,l,l.data.attachmentName);return}if(s<this.frames[0]){(o==Ce.setup||o==Ce.first)&&this.setAttachment(t,l,l.data.attachmentName);return}this.setAttachment(t,l,this.attachmentNames[ai.search1(this.frames,s)])}}setAttachment(t,i,s){i.setAttachment(s?t.getAttachment(this.slotIndex,s):null)}},ib=class extends Cn{constructor(t,i,s,r){super(t,i,[Tt.deform+"|"+s+"|"+r.id]);x(this,"slotIndex",0);x(this,"attachment");x(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,v=c*.03-h*.06,y=((o-l)*3-r+u)*.006,b=(h-c+.33333333)*.018,g=m*2+y,w=v*2+b,E=(o-r)*.3+m+y*.16666667,M=h*.3+v+b*.16666667,_=r+E,I=M;for(let R=p+18;p<R;p+=2)f[p]=_,f[p+1]=I,E+=g,M+=w,g+=y,w+=b,_+=E,I+=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 ar)||c.timelineAttachment!=this.attachment)return;let u=l.deform;u.length==0&&(o=Ce.setup);let d=this.vertices,f=d[0].length,p=this.frames;if(s<p[0]){switch(o){case Ce.setup:u.length=0;return;case Ce.first:if(a==1){u.length=0;return}u.length=f;let w=c;if(w.bones){a=1-a;for(var m=0;m<f;m++)u[m]*=a}else{let E=w.vertices;for(var m=0;m<f;m++)u[m]+=(E[m]-u[m])*a}}return}if(u.length=f,s>=p[p.length-1]){let w=d[p.length-1];if(a==1)if(o==Ce.add){let E=c;if(E.bones)for(let M=0;M<f;M++)u[M]+=w[M];else{let M=E.vertices;for(let _=0;_<f;_++)u[_]+=w[_]-M[_]}}else Ve.arrayCopy(w,0,u,0,f);else switch(o){case Ce.setup:{let M=c;if(M.bones)for(let _=0;_<f;_++)u[_]=w[_]*a;else{let _=M.vertices;for(let I=0;I<f;I++){let R=_[I];u[I]=R+(w[I]-R)*a}}break}case Ce.first:case Ce.replace:for(let M=0;M<f;M++)u[M]+=(w[M]-u[M])*a;break;case Ce.add:let E=c;if(E.bones)for(let M=0;M<f;M++)u[M]+=w[M]*a;else{let M=E.vertices;for(let _=0;_<f;_++)u[_]+=(w[_]-M[_])*a}}return}let v=ai.search1(p,s),y=this.getCurvePercent(s,v),b=d[v],g=d[v+1];if(a==1)if(o==Ce.add){let w=c;if(w.bones)for(let E=0;E<f;E++){let M=b[E];u[E]+=M+(g[E]-M)*y}else{let E=w.vertices;for(let M=0;M<f;M++){let _=b[M];u[M]+=_+(g[M]-_)*y-E[M]}}}else for(let w=0;w<f;w++){let E=b[w];u[w]=E+(g[w]-E)*y}else switch(o){case Ce.setup:{let E=c;if(E.bones)for(let M=0;M<f;M++){let _=b[M];u[M]=(_+(g[M]-_)*y)*a}else{let M=E.vertices;for(let _=0;_<f;_++){let I=b[_],R=M[_];u[_]=R+(I+(g[_]-I)*y-R)*a}}break}case Ce.first:case Ce.replace:for(let E=0;E<f;E++){let M=b[E];u[E]+=(M+(g[E]-M)*y-u[E])*a}break;case Ce.add:let w=c;if(w.bones)for(let E=0;E<f;E++){let M=b[E];u[E]+=(M+(g[E]-M)*y)*a}else{let E=w.vertices;for(let M=0;M<f;M++){let _=b[M];u[M]+=(_+(g[M]-_)*y-E[M])*a}}}}};var ra;let rp=(ra=class extends ai{constructor(t){super(t,ra.propertyIds);x(this,"events");this.events=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,i){this.frames[t]=i.time,this.events[t]=i}apply(t,i,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=ai.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])}},x(ra,"propertyIds",[""+Tt.event]),ra);var aa;let sl=(aa=class extends ai{constructor(t){super(t,aa.propertyIds);x(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==zi.mixOut){o==Ce.setup&&Ve.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);return}if(s<this.frames[0]){(o==Ce.setup||o==Ce.first)&&Ve.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);return}let l=ai.search1(this.frames,s),c=this.drawOrders[l];if(!c)Ve.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);else{let u=t.drawOrder,d=t.slots;for(let f=0,p=c.length;f<p;f++)u[f]=d[c[f]]}}},x(aa,"propertyIds",[""+Tt.drawOrder]),aa),sb=class extends Cn{constructor(t,i,s){super(t,i,[Tt.ikConstraint+"|"+s]);x(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 Ce.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 Ce.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=ai.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 v=(s-m)/(c[f+6]-m);u+=(c[f+6+1]-u)*v,d+=(c[f+6+2]-d)*v;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==Ce.setup?(l.mix=l.data.mix+(u-l.data.mix)*a,l.softness=l.data.softness+(d-l.data.softness)*a,h==zi.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==zi.mixIn&&(l.bendDirection=c[f+3],l.compress=c[f+4]!=0,l.stretch=c[f+5]!=0))}},nb=class extends Cn{constructor(t,i,s){super(t,i,[Tt.transformConstraint+"|"+s]);x(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 g=l.data;switch(o){case Ce.setup:l.mixRotate=g.mixRotate,l.mixX=g.mixX,l.mixY=g.mixY,l.mixScaleX=g.mixScaleX,l.mixScaleY=g.mixScaleY,l.mixShearY=g.mixShearY;return;case Ce.first:l.mixRotate+=(g.mixRotate-l.mixRotate)*a,l.mixX+=(g.mixX-l.mixX)*a,l.mixY+=(g.mixY-l.mixY)*a,l.mixScaleX+=(g.mixScaleX-l.mixScaleX)*a,l.mixScaleY+=(g.mixScaleY-l.mixScaleY)*a,l.mixShearY+=(g.mixShearY-l.mixShearY)*a}return}let u,d,f,p,m,v,y=ai.search(c,s,7),b=this.curves[y/7];switch(b){case 0:let g=c[y];u=c[y+1],d=c[y+2],f=c[y+3],p=c[y+4],m=c[y+5],v=c[y+6];let w=(s-g)/(c[y+7]-g);u+=(c[y+7+1]-u)*w,d+=(c[y+7+2]-d)*w,f+=(c[y+7+3]-f)*w,p+=(c[y+7+4]-p)*w,m+=(c[y+7+5]-m)*w,v+=(c[y+7+6]-v)*w;break;case 1:u=c[y+1],d=c[y+2],f=c[y+3],p=c[y+4],m=c[y+5],v=c[y+6];break;default:u=this.getBezierValue(s,y,1,b-2),d=this.getBezierValue(s,y,2,b+18-2),f=this.getBezierValue(s,y,3,b+36-2),p=this.getBezierValue(s,y,4,b+54-2),m=this.getBezierValue(s,y,5,b+72-2),v=this.getBezierValue(s,y,6,b+90-2)}if(o==Ce.setup){let g=l.data;l.mixRotate=g.mixRotate+(u-g.mixRotate)*a,l.mixX=g.mixX+(d-g.mixX)*a,l.mixY=g.mixY+(f-g.mixY)*a,l.mixScaleX=g.mixScaleX+(p-g.mixScaleX)*a,l.mixScaleY=g.mixScaleY+(m-g.mixScaleY)*a,l.mixShearY=g.mixShearY+(v-g.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+=(v-l.mixShearY)*a}},rb=class extends zs{constructor(t,i,s){super(t,i,Tt.pathConstraintPosition+"|"+s);x(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))}},ab=class extends zs{constructor(t,i,s){super(t,i,Tt.pathConstraintSpacing+"|"+s);x(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))}},ob=class extends Cn{constructor(t,i,s){super(t,i,[Tt.pathConstraintMix+"|"+s]);x(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 Ce.setup:l.mixRotate=l.data.mixRotate,l.mixX=l.data.mixX,l.mixY=l.data.mixY;return;case Ce.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=ai.search(c,s,4),m=this.curves[p>>2];switch(m){case 0:let v=c[p];u=c[p+1],d=c[p+2],f=c[p+3];let y=(s-v)/(c[p+4]-v);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==Ce.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}else l.mixRotate+=(u-l.mixRotate)*a,l.mixX+=(d-l.mixX)*a,l.mixY+=(f-l.mixY)*a}},_a=class extends zs{constructor(t,i,s,r){super(t,i,r+"|"+s);x(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)))}},lb=class extends _a{constructor(e,t,i){super(e,t,i,Tt.physicsConstraintInertia)}setup(e){return e.data.inertia}get(e){return e.inertia}set(e,t){e.inertia=t}global(e){return e.inertiaGlobal}},cb=class extends _a{constructor(e,t,i){super(e,t,i,Tt.physicsConstraintStrength)}setup(e){return e.data.strength}get(e){return e.strength}set(e,t){e.strength=t}global(e){return e.strengthGlobal}},hb=class extends _a{constructor(e,t,i){super(e,t,i,Tt.physicsConstraintDamping)}setup(e){return e.data.damping}get(e){return e.damping}set(e,t){e.damping=t}global(e){return e.dampingGlobal}},ub=class extends _a{constructor(e,t,i){super(e,t,i,Tt.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}},db=class extends _a{constructor(e,t,i){super(e,t,i,Tt.physicsConstraintWind)}setup(e){return e.data.wind}get(e){return e.wind}set(e,t){e.wind=t}global(e){return e.windGlobal}},fb=class extends _a{constructor(e,t,i){super(e,t,i,Tt.physicsConstraintGravity)}setup(e){return e.data.gravity}get(e){return e.gravity}set(e,t){e.gravity=t}global(e){return e.gravityGlobal}},mb=class extends _a{constructor(e,t,i){super(e,t,i,Tt.physicsConstraintMix)}setup(e){return e.data.mix}get(e){return e.mix}set(e,t){e.mix=t}global(e){return e.mixGlobal}};var oa;let pb=(oa=class extends ai{constructor(t,i){super(t,oa.propertyIds);x(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[ai.search1(c,i)+1]))if(l!=null)l.reset();else for(const u of t.physicsConstraints)u.active&&u.reset()}},x(oa,"propertyIds",[Tt.physicsConstraintReset.toString()]),oa);var Zi;let gb=(Zi=class extends ai{constructor(t,i,s){super(t,[Tt.sequence+"|"+i+"|"+s.sequence.id]);x(this,"slotIndex");x(this,"attachment");this.slotIndex=i,this.attachment=s}getFrameEntries(){return Zi.ENTRIES}getSlotIndex(){return this.slotIndex}getAttachment(){return this.attachment}setFrame(t,i,s,r,a){let o=this.frames;t*=Zi.ENTRIES,o[t]=i,o[t+Zi.MODE]=s|r<<4,o[t+Zi.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 ar)||c.timelineAttachment!=u))return;if(h==zi.mixOut){o==Ce.setup&&(l.sequenceIndex=-1);return}let d=this.frames;if(s<d[0]){(o==Ce.setup||o==Ce.first)&&(l.sequenceIndex=-1);return}let f=ai.search(d,s,Zi.ENTRIES),p=d[f],m=d[f+Zi.MODE],v=d[f+Zi.DELAY];if(!this.attachment.sequence)return;let y=m>>4,b=this.attachment.sequence.regions.length,g=X1[m&15];if(g!=Ni.hold)switch(y+=(s-p)/v+1e-5|0,g){case Ni.once:y=Math.min(b-1,y);break;case Ni.loop:y%=b;break;case Ni.pingpong:{let w=(b<<1)-2;y=w==0?0:y%w,y>=b&&(y=w-y);break}case Ni.onceReverse:y=Math.max(b-1-y,0);break;case Ni.loopReverse:y=b-1-y%b;break;case Ni.pingpongReverse:{let w=(b<<1)-2;y=w==0?0:(y+b-1)%w,y>=b&&(y=w-y)}}l.sequenceIndex=y}},x(Zi,"ENTRIES",3),x(Zi,"MODE",1),x(Zi,"DELAY",2),Zi);var Zn;let lI=(Zn=class{constructor(e){x(this,"data");x(this,"tracks",new Array);x(this,"timeScale",1);x(this,"unkeyedState",0);x(this,"events",new Array);x(this,"listeners",new Array);x(this,"queue",new hI(this));x(this,"propertyIDs",new D1);x(this,"animationsChanged",!1);x(this,"trackEntryPool",new hh(()=>new cI));this.data=e}static emptyAnimation(){return Zn._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?Ce.first:p.mixBlend,v=p.alpha;p.mixingFrom?v*=this.applyMixingFrom(p,e,m):p.trackTime>=p.trackEnd&&!p.next&&(v=0);let y=v>=p.alphaAttachmentThreshold,b=p.animationLast,g=p.getAnimationTime(),w=g,E=t;p.reverse&&(w=p.animation.duration-w,E=null);let M=p.animation.timelines,_=M.length;if(d==0&&v==1||m==Ce.add){d==0&&(y=!0);for(let I=0;I<_;I++){var r=M[I];r instanceof Wa?this.applyAttachmentTimeline(r,e,w,m,y):r.apply(e,b,w,E,v,m,zi.mixIn)}}else{let I=p.timelineMode,R=p.shortestRotation,F=!R&&p.timelinesRotation.length!=_<<1;F&&(p.timelinesRotation.length=_<<1);for(let P=0;P<_;P++){let k=M[P],B=I[P]==Hd?m:Ce.setup;!R&&k instanceof dh?this.applyRotateTimeline(k,e,w,v,B,p.timelinesRotation,P<<1,F):k instanceof Wa?this.applyAttachmentTimeline(k,e,w,m,y):k.apply(e,b,w,E,v,B,zi.mixIn)}}this.queueEvents(p,g),t.length=0,p.nextAnimationLast=g,p.nextTrackLast=p.trackTime}for(var a=this.unkeyedState+hv,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==Ce.first&&(i=Ce.setup)):(r=e.mixTime/e.mixDuration,r>1&&(r=1),i!=Ce.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==Ce.add)for(let v=0;v<l;v++)h[v].apply(t,d,p,m,u,i,zi.mixOut);else{let v=s.timelineMode,y=s.timelineHoldMix,b=s.shortestRotation,g=!b&&s.timelinesRotation.length!=l<<1;g&&(s.timelinesRotation.length=l<<1),s.totalAlpha=0;for(let w=0;w<l;w++){let E=h[w],M=zi.mixOut,_,I=0;switch(v[w]){case Hd:if(!o&&E instanceof sl)continue;_=i,I=u;break;case lv:_=Ce.setup,I=u;break;case cv:_=i,I=c;break;case Wd:_=Ce.setup,I=c;break;default:_=Ce.setup;let R=y[w];I=c*Math.max(0,1-R.mixTime/R.mixDuration);break}s.totalAlpha+=I,!b&&E instanceof dh?this.applyRotateTimeline(E,t,p,I,_,s.timelinesRotation,w<<1,g):E instanceof Wa?this.applyAttachmentTimeline(E,t,p,_,a&&I>=s.alphaAttachmentThreshold):(o&&E instanceof sl&&_==Ce.setup&&(M=zi.mixIn),E.apply(t,d,p,m,I,_,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==Ce.setup||s==Ce.first)&&this.setAttachment(t,a,a.data.attachmentName,r):this.setAttachment(t,a,e.attachmentNames[ai.search1(e.frames,i)],r),a.attachmentState<=this.unkeyedState&&(a.attachmentState=this.unkeyedState+hv))}setAttachment(e,t,i,s){t.setAttachment(i?e.getAttachment(t.data.index,i):null),s&&(t.attachmentState=this.unkeyedState+dI)}applyRotateTimeline(e,t,i,s,r,a,o,h){if(h&&(a[o]=0),s==1){e.apply(t,0,i,null,1,r,zi.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 Ce.setup:l.rotation=l.data.rotation;default:return;case Ce.first:u=l.rotation,d=l.data.rotation}else u=r==Ce.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,v=0;h?(m=0,v=p):(m=a[o],v=a[o+1]);let y=m-m%360;f=p+y;let b=p>=0,g=m>=0;Math.abs(v)<=90&&Ye.signum(v)!=Ye.signum(p)&&(Math.abs(m-y)>180?(f+=360*Ye.signum(m),g=b):y!=0?f-=360*Ye.signum(m):g=b),g!=b&&(f+=360*Ye.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,Zn.emptyAnimation(),!1);return i.mixDuration=t,i.trackEnd=t,i}addEmptyAnimation(e,t=0,i=0){let s=this.addAnimationWith(e,Zn.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]:(Ve.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=Ce.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!=Ce.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())?Wd:cv;return}e:for(let h=0;h<s;h++){let l=i[h],c=l.getPropertyIds();if(!o.addAll(c))r[h]=Hd;else if(!t||l instanceof Wa||l instanceof sl||l instanceof rp||!t.animation.hasTimeline(c))r[h]=lv;else{for(let u=t.mixingTo;u;u=u.mixingTo)if(!u.animation.hasTimeline(c)){if(e.mixDuration>0){r[h]=uI,a[h]=u;continue e}break}r[h]=Wd}}}getCurrent(e){return e>=this.tracks.length?null:this.tracks[e]}addListener(e){if(!e)throw new Error("listener cannot be null.");this.listeners.push(e)}removeListener(e){let t=this.listeners.indexOf(e);t>=0&&this.listeners.splice(t,1)}clearListeners(){this.listeners.length=0}clearListenerNotifications(){this.queue.clear()}},x(Zn,"_emptyAnimation",new sp("<empty>",[],0)),Zn),cI=class{constructor(){x(this,"animation",null);x(this,"previous",null);x(this,"next",null);x(this,"mixingFrom",null);x(this,"mixingTo",null);x(this,"listener",null);x(this,"trackIndex",0);x(this,"loop",!1);x(this,"holdPrevious",!1);x(this,"reverse",!1);x(this,"shortestRotation",!1);x(this,"eventThreshold",0);x(this,"mixAttachmentThreshold",0);x(this,"alphaAttachmentThreshold",0);x(this,"mixDrawOrderThreshold",0);x(this,"animationStart",0);x(this,"animationEnd",0);x(this,"animationLast",0);x(this,"nextAnimationLast",0);x(this,"delay",0);x(this,"trackTime",0);x(this,"trackLast",0);x(this,"nextTrackLast",0);x(this,"trackEnd",0);x(this,"timeScale",0);x(this,"alpha",0);x(this,"mixTime",0);x(this,"_mixDuration",0);x(this,"interruptAlpha",0);x(this,"totalAlpha",0);x(this,"mixBlend",Ce.replace);x(this,"timelineMode",new Array);x(this,"timelineHoldMix",new Array);x(this,"timelinesRotation",new Array)}get mixDuration(){return this._mixDuration}set mixDuration(e){this._mixDuration=e}setMixDurationWithDelay(e,t){this._mixDuration=e,t<=0&&(this.previous!=null?t=Math.max(t+this.previous.getTrackComplete()-e,0):t=0),this.delay=t}reset(){this.next=null,this.previous=null,this.mixingFrom=null,this.mixingTo=null,this.animation=null,this.listener=null,this.timelineMode.length=0,this.timelineHoldMix.length=0,this.timelinesRotation.length=0}getAnimationTime(){if(this.loop){let e=this.animationEnd-this.animationStart;return e==0?this.animationStart:this.trackTime%e+this.animationStart}return Math.min(this.trackTime+this.animationStart,this.animationEnd)}setAnimationLast(e){this.animationLast=e,this.nextAnimationLast=e}isComplete(){return this.trackTime>=this.animationEnd-this.animationStart}resetRotationDirections(){this.timelinesRotation.length=0}getTrackComplete(){let e=this.animationEnd-this.animationStart;if(e!=0){if(this.loop)return e*(1+(this.trackTime/e|0));if(this.trackTime<e)return e}return this.trackTime}wasApplied(){return this.nextTrackLast!=-1}isNextReady(){return this.next!=null&&this.nextTrackLast-this.next.delay>=0}},hI=class{constructor(e){x(this,"objects",[]);x(this,"drainDisabled",!1);x(this,"animState");this.animState=e}start(e){this.objects.push(rs.start),this.objects.push(e),this.animState.animationsChanged=!0}interrupt(e){this.objects.push(rs.interrupt),this.objects.push(e)}end(e){this.objects.push(rs.end),this.objects.push(e),this.animState.animationsChanged=!0}dispose(e){this.objects.push(rs.dispose),this.objects.push(e)}complete(e){this.objects.push(rs.complete),this.objects.push(e)}event(e,t){this.objects.push(rs.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 rs.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 rs.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 rs.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 rs.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 rs.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 rs.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 rs;(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"})(rs||(rs={}));const Hd=0,lv=1,cv=2,Wd=3,uI=4,hv=1,dI=2;class fI{constructor(e){x(this,"skeletonData");x(this,"animationToMixTime",{});x(this,"defaultMix",0);if(!e)throw new Error("skeletonData cannot be null.");this.skeletonData=e}setMix(e,t,i){let 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 vb=class yb extends ar{constructor(t){super(t);x(this,"color",new St(1,1,1,1))}copy(){let t=new yb(this.name);return this.copyTo(t),t.color.setFromColor(this.color),t}},oo=class xb extends ar{constructor(t){super(t);x(this,"endSlot",null);x(this,"color",new St(.2275,.2275,.8078,1))}copy(){let t=new xb(this.name);return this.copyTo(t),t.endSlot=this.endSlot,t.color.setFromColor(this.color),t}},mI=class{constructor(e){x(this,"_image");this._image=e}getImage(){return this._image}};var Pi;(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"})(Pi||(Pi={}));var er;(function(n){n[n.MirroredRepeat=33648]="MirroredRepeat",n[n.ClampToEdge=33071]="ClampToEdge",n[n.Repeat=10497]="Repeat"})(er||(er={}));let pI=class{constructor(){x(this,"texture");x(this,"u",0);x(this,"v",0);x(this,"u2",0);x(this,"v2",0);x(this,"width",0);x(this,"height",0);x(this,"degrees",0);x(this,"offsetX",0);x(this,"offsetY",0);x(this,"originalWidth",0);x(this,"originalHeight",0)}},bb=class{constructor(e){x(this,"pages",new Array);x(this,"regions",new Array);let t=new gI(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=Ve.enumValue(Pi,i[1]),c.magFilter=Ve.enumValue(Pi,i[2])},s.repeat=c=>{i[1].indexOf("x")!=-1&&(c.uWrap=er.Repeat),i[1].indexOf("y")!=-1&&(c.vWrap=er.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 wb(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 vI(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()}},gI=class{constructor(e){x(this,"lines");x(this,"index",0);this.lines=e.split(/\r\n|\r|\n/)}readLine(){return this.index>=this.lines.length?null:this.lines[this.index++]}readEntry(e,t){if(!t||(t=t.trim(),t.length==0))return 0;let i=t.indexOf(":");if(i==-1)return 0;e[0]=t.substr(0,i).trim();for(let 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}}},vI=class{constructor(e){x(this,"name");x(this,"minFilter",Pi.Nearest);x(this,"magFilter",Pi.Nearest);x(this,"uWrap",er.ClampToEdge);x(this,"vWrap",er.ClampToEdge);x(this,"texture",null);x(this,"width",0);x(this,"height",0);x(this,"pma",!1);x(this,"regions",new Array);this.name=e}setTexture(e){this.texture=e,e.setFilters(this.minFilter,this.magFilter),e.setWraps(this.uWrap,this.vWrap);for(let t of this.regions)t.texture=e}},wb=class extends pI{constructor(t,i){super();x(this,"page");x(this,"name");x(this,"x",0);x(this,"y",0);x(this,"offsetX",0);x(this,"offsetY",0);x(this,"originalWidth",0);x(this,"originalHeight",0);x(this,"index",0);x(this,"degrees",0);x(this,"names",null);x(this,"values",null);this.page=t,this.name=i,t.regions.push(this)}},Ol=class Jf extends ar{constructor(t,i){super(t);x(this,"region",null);x(this,"path");x(this,"regionUVs",[]);x(this,"uvs",[]);x(this,"triangles",[]);x(this,"color",new St(1,1,1,1));x(this,"width",0);x(this,"height",0);x(this,"hullLength",0);x(this,"edges",[]);x(this,"parentMesh",null);x(this,"sequence",null);x(this,"tempColor",new St(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=Ve.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 wb){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 Jf(this.name,this.path);return t.region=this.region,t.color.setFromColor(this.color),this.copyTo(t),t.regionUVs=new Array(this.regionUVs.length),Ve.arrayCopy(this.regionUVs,0,t.regionUVs,0,this.regionUVs.length),t.uvs=this.uvs instanceof Float32Array?Ve.newFloatArray(this.uvs.length):new Array(this.uvs.length),Ve.arrayCopy(this.uvs,0,t.uvs,0,this.uvs.length),t.triangles=new Array(this.triangles.length),Ve.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),Ve.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 Jf(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}},Sl=class Sb extends ar{constructor(t){super(t);x(this,"lengths",[]);x(this,"closed",!1);x(this,"constantSpeed",!1);x(this,"color",new St(1,1,1,1))}copy(){let t=new Sb(this.name);return this.copyTo(t),t.lengths=new Array(this.lengths.length),Ve.arrayCopy(this.lengths,0,t.lengths,0,this.lengths.length),t.closed=closed,t.constantSpeed=this.constantSpeed,t.color.setFromColor(this.color),t}},_b=class Tb extends ar{constructor(t){super(t);x(this,"x",0);x(this,"y",0);x(this,"rotation",0);x(this,"color",new St(.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*Ye.degRad,s=Math.cos(i),r=Math.sin(i),a=s*t.a+r*t.b,o=s*t.c+r*t.d;return Ye.atan2Deg(o,a)}copy(){let t=new Tb(this.name);return t.x=this.x,t.y=this.y,t.rotation=this.rotation,t.color.setFromColor(this.color),t}};var At;let iu=(At=class extends N1{constructor(t,i){super(t);x(this,"x",0);x(this,"y",0);x(this,"scaleX",1);x(this,"scaleY",1);x(this,"rotation",0);x(this,"width",0);x(this,"height",0);x(this,"color",new St(1,1,1,1));x(this,"path");x(this,"region",null);x(this,"sequence",null);x(this,"offset",Ve.newFloatArray(8));x(this,"uvs",Ve.newFloatArray(8));x(this,"tempColor",new St(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*Ye.degRad,u=Math.cos(c),d=Math.sin(c),f=this.x,p=this.y,m=a*u+f,v=a*d,y=o*u+p,b=o*d,g=h*u+f,w=h*d,E=l*u+p,M=l*d,_=this.offset;_[0]=m-b,_[1]=y+v,_[2]=m-M,_[3]=E+v,_[4]=g-M,_[5]=E+w,_[6]=g-b,_[7]=y+w,t.degrees==90?(i[0]=t.u2,i[1]=t.v2,i[2]=t.u,i[3]=t.v2,i[4]=t.u,i[5]=t.v,i[6]=t.u2,i[7]=t.v):(i[0]=t.u,i[1]=t.v2,i[2]=t.u,i[3]=t.v,i[4]=t.u2,i[5]=t.v,i[6]=t.u2,i[7]=t.v2)}computeWorldVertices(t,i,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 At(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,Ve.arrayCopy(this.uvs,0,t.uvs,0,8),Ve.arrayCopy(this.offset,0,t.offset,0,8),t.color.setFromColor(this.color),t.sequence=this.sequence!=null?this.sequence.copy():null,t}},x(At,"X1",0),x(At,"Y1",1),x(At,"C1R",2),x(At,"C1G",3),x(At,"C1B",4),x(At,"C1A",5),x(At,"U1",6),x(At,"V1",7),x(At,"X2",8),x(At,"Y2",9),x(At,"C2R",10),x(At,"C2G",11),x(At,"C2B",12),x(At,"C2A",13),x(At,"U2",14),x(At,"V2",15),x(At,"X3",16),x(At,"Y3",17),x(At,"C3R",18),x(At,"C3G",19),x(At,"C3B",20),x(At,"C3A",21),x(At,"U3",22),x(At,"V3",23),x(At,"X4",24),x(At,"Y4",25),x(At,"C4R",26),x(At,"C4G",27),x(At,"C4B",28),x(At,"C4A",29),x(At,"U4",30),x(At,"V4",31),At);class Qf{constructor(e){x(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 iu(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 Ol(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 vb(t)}newPathAttachment(e,t){return new Sl(t)}newPointAttachment(e,t){return new _b(t)}newClippingAttachment(e,t){return new oo(t)}}let Mb=class{constructor(e,t,i){x(this,"index",0);x(this,"name");x(this,"parent",null);x(this,"length",0);x(this,"x",0);x(this,"y",0);x(this,"rotation",0);x(this,"scaleX",1);x(this,"scaleY",1);x(this,"shearX",0);x(this,"shearY",0);x(this,"inherit",hi.Normal);x(this,"skinRequired",!1);x(this,"color",new St);x(this,"icon");x(this,"visible",!1);if(e<0)throw new Error("index must be >= 0.");if(!t)throw new Error("name cannot be null.");this.index=e,this.name=t,this.parent=i}};var hi;(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"})(hi||(hi={}));let uv=class{constructor(e,t,i){x(this,"data");x(this,"skeleton");x(this,"parent",null);x(this,"children",new Array);x(this,"x",0);x(this,"y",0);x(this,"rotation",0);x(this,"scaleX",0);x(this,"scaleY",0);x(this,"shearX",0);x(this,"shearY",0);x(this,"ax",0);x(this,"ay",0);x(this,"arotation",0);x(this,"ascaleX",0);x(this,"ascaleY",0);x(this,"ashearX",0);x(this,"ashearY",0);x(this,"a",0);x(this,"b",0);x(this,"c",0);x(this,"d",0);x(this,"worldY",0);x(this,"worldX",0);x(this,"inherit",hi.Normal);x(this,"sorted",!1);x(this,"active",!1);if(!e)throw new Error("data cannot be null.");if(!t)throw new Error("skeleton cannot be null.");this.data=e,this.skeleton=t,this.parent=i,this.setToSetupPose()}isActive(){return this.active}update(e){this.updateWorldTransformWith(this.ax,this.ay,this.arotation,this.ascaleX,this.ascaleY,this.ashearX,this.ashearY)}updateWorldTransform(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)}updateWorldTransformWith(e,t,i,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,v=(i+a)*Ye.degRad,y=(i+90+o)*Ye.degRad;this.a=Math.cos(v)*s*p,this.b=Math.cos(y)*r*p,this.c=Math.sin(v)*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 hi.Normal:{const f=(i+a)*Ye.degRad,p=(i+90+o)*Ye.degRad,m=Math.cos(f)*s,v=Math.cos(p)*r,y=Math.sin(f)*s,b=Math.sin(p)*r;this.a=l*m+c*y,this.b=l*v+c*b,this.c=u*m+d*y,this.d=u*v+d*b;return}case hi.OnlyTranslation:{const f=(i+a)*Ye.degRad,p=(i+90+o)*Ye.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 hi.NoRotationOrReflection:{let f=1/this.skeleton.scaleX,p=1/this.skeleton.scaleY;l*=f,u*=p;let m=l*l+u*u,v=0;m>1e-4?(m=Math.abs(l*d*p-c*f*u)/m,c=u*m,d=l*m,v=Math.atan2(u,l)*Ye.radDeg):(l=0,u=0,v=90-Math.atan2(d,c)*Ye.radDeg);const y=(i+a-v)*Ye.degRad,b=(i+o-v+90)*Ye.degRad,g=Math.cos(y)*s,w=Math.cos(b)*r,E=Math.sin(y)*s,M=Math.sin(b)*r;this.a=l*g-c*E,this.b=l*w-c*M,this.c=u*g+d*E,this.d=u*w+d*M;break}case hi.NoScale:case hi.NoScaleOrReflection:{i*=Ye.degRad;const f=Math.cos(i),p=Math.sin(i);let m=(l*f+c*p)/this.skeleton.scaleX,v=(u*f+d*p)/this.skeleton.scaleY,y=Math.sqrt(m*m+v*v);y>1e-5&&(y=1/y),m*=y,v*=y,y=Math.sqrt(m*m+v*v),this.inherit==hi.NoScale&&l*d-c*u<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(y=-y),i=Math.PI/2+Math.atan2(v,m);const b=Math.cos(i)*y,g=Math.sin(i)*y;a*=Ye.degRad,o=(90+o)*Ye.degRad;const w=Math.cos(a)*s,E=Math.cos(o)*r,M=Math.sin(a)*s,_=Math.sin(o)*r;this.a=m*w+b*M,this.b=m*E+b*_,this.c=v*w+g*M,this.d=v*E+g*_;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)*Ye.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)*Ye.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,v;if(this.inherit==hi.OnlyTranslation)f=this.a,p=this.b,m=this.c,v=this.d;else{switch(this.inherit){case hi.NoRotationOrReflection:{let E=Math.abs(t*r-i*s)/(t*t+s*s);i=-s*this.skeleton.scaleX*E/this.skeleton.scaleY,r=t*this.skeleton.scaleY*E/this.skeleton.scaleX,a=1/(t*r-i*s),o=r*a,h=i*a;break}case hi.NoScale:case hi.NoScaleOrReflection:let y=Ye.cosDeg(this.rotation),b=Ye.sinDeg(this.rotation);t=(t*y+i*b)/this.skeleton.scaleX,s=(s*y+r*b)/this.skeleton.scaleY;let g=Math.sqrt(t*t+s*s);g>1e-5&&(g=1/g),t*=g,s*=g,g=Math.sqrt(t*t+s*s),this.inherit==hi.NoScale&&a<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(g=-g);let w=Ye.PI/2+Math.atan2(s,t);i=Math.cos(w)*g,r=Math.sin(w)*g,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,v=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*v-p*m;this.ascaleY=y/this.ascaleX,this.ashearY=-Math.atan2(f*p+m*v,y)*Ye.radDeg,this.arotation=Math.atan2(m,f)*Ye.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(p*p+v*v),this.ashearY=0,this.arotation=90-Math.atan2(v,p)*Ye.radDeg}getWorldRotationX(){return Math.atan2(this.c,this.a)*Ye.radDeg}getWorldRotationY(){return Math.atan2(this.d,this.b)*Ye.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=Ye.sinDeg(e),i=Ye.cosDeg(e);return Math.atan2(this.a*t-this.c*i,this.d*i-this.b*t)*Ye.radDeg+this.rotation-this.shearX}localToWorldRotation(e){e-=this.rotation-this.shearX;let t=Ye.sinDeg(e),i=Ye.cosDeg(e);return Math.atan2(i*this.c+t*this.d,i*this.a+t*this.b)*Ye.radDeg}rotateWorld(e){e*=Ye.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}},su=class{constructor(e,t,i){x(this,"name");x(this,"order");x(this,"skinRequired");this.name=e,this.order=t,this.skinRequired=i}},Eb=class{constructor(e,t){x(this,"data");x(this,"intValue",0);x(this,"floatValue",0);x(this,"stringValue",null);x(this,"time",0);x(this,"volume",0);x(this,"balance",0);if(!t)throw new Error("data cannot be null.");this.time=e,this.data=t}},Ab=class{constructor(e){x(this,"name");x(this,"intValue",0);x(this,"floatValue",0);x(this,"stringValue",null);x(this,"audioPath",null);x(this,"volume",0);x(this,"balance",0);this.name=e}},yI=class{constructor(e,t){x(this,"data");x(this,"bones");x(this,"target");x(this,"bendDirection",0);x(this,"compress",!1);x(this,"stretch",!1);x(this,"mix",1);x(this,"softness",0);x(this,"active",!1);if(!e)throw new Error("data cannot be null.");if(!t)throw new Error("skeleton cannot be null.");this.data=e,this.bones=new Array;for(let 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 hi.OnlyTranslation:p=(t-e.worldX)*Ye.signum(e.skeleton.scaleX),m=(i-e.worldY)*Ye.signum(e.skeleton.scaleY);break;case hi.NoRotationOrReflection:let b=Math.abs(l*d-c*u)/Math.max(1e-4,l*l+u*u),g=l/e.skeleton.scaleX,w=u/e.skeleton.scaleY;c=-w*b*e.skeleton.scaleX,d=g*b*e.skeleton.scaleY,f+=Math.atan2(w,g)*Ye.radDeg;default:let E=t-h.worldX,M=i-h.worldY,_=l*d-c*u;Math.abs(_)<=1e-4?(p=0,m=0):(p=(E*d-M*c)/_-e.ax,m=(M*l-E*u)/_-e.ay)}f+=Math.atan2(m,p)*Ye.radDeg,e.ascaleX<0&&(f+=180),f>180?f-=360:f<-180&&(f+=360);let v=e.ascaleX,y=e.ascaleY;if(s||r){switch(e.inherit){case hi.NoScale:case hi.NoScaleOrReflection:p=t-e.worldX,m=i-e.worldY}const b=e.data.length*v;if(b>1e-4){const g=p*p+m*m;if(s&&g<b*b||r&&g>b*b){const w=(Math.sqrt(g)/b-1)*o+1;v*=w,a&&(y*=w)}}}e.updateWorldTransformWith(e.ax,e.ay,e.arotation+f*o,v,y,e.ashearX,e.ashearY)}apply2(e,t,i,s,r,a,o,h,l){if(e.inherit!=hi.Normal||t.inherit!=hi.Normal)return;let c=e.ax,u=e.ay,d=e.ascaleX,f=e.ascaleY,p=d,m=f,v=t.ascaleX,y=0,b=0,g=0;d<0?(d=-d,y=180,g=-1):(y=0,g=1),f<0&&(f=-f,g=-g),v<0?(v=-v,b=180):b=0;let w=t.ax,E=0,M=0,_=0,I=e.a,R=e.b,F=e.c,P=e.d,k=Math.abs(d-f)<=1e-4;!k||a?(E=0,M=I*w+e.worldX,_=F*w+e.worldY):(E=t.ay,M=I*w+R*E+e.worldX,_=F*w+P*E+e.worldY);let B=e.parent;if(!B)throw new Error("IK parent must itself have a parent.");I=B.a,R=B.b,F=B.c,P=B.d;let L=I*P-R*F,X=M-B.worldX,O=_-B.worldY;L=Math.abs(L)<=1e-4?0:1/L;let D=(X*P-O*R)*L-c,T=(O*I-X*F)*L-u,U=Math.sqrt(D*D+T*T),N=t.data.length*v,Y,G;if(U<1e-4){this.apply1(e,i,s,!1,a,!1,l),t.updateWorldTransformWith(w,E,0,t.ascaleX,t.ascaleY,t.ashearX,t.ashearY);return}X=i-B.worldX,O=s-B.worldY;let H=(X*P-O*R)*L-c,ne=(O*I-X*F)*L-u,Z=H*H+ne*ne;if(h!=0){h*=d*(v+1)*.5;let _e=Math.sqrt(Z),Ae=_e-U-N*d+h;if(Ae>0){let ge=Math.min(1,Ae/(h*2))-1;ge=(Ae-h*(1-ge*ge))/_e,H-=ge*H,ne-=ge*ne,Z=H*H+ne*ne}}e:if(k){N*=d;let _e=(Z-U*U-N*N)/(2*U*N);_e<-1?(_e=-1,G=Math.PI*r):_e>1?(_e=1,G=0,a&&(I=(Math.sqrt(Z)/(U+N)-1)*l+1,p*=I,o&&(m*=I))):G=Math.acos(_e)*r,I=U+N*_e,R=N*Math.sin(G),Y=Math.atan2(ne*I-H*R,H*I+ne*R)}else{I=d*N,R=f*N;let _e=I*I,Ae=R*R,ge=Math.atan2(ne,H);F=Ae*U*U+_e*Z-_e*Ae;let Ee=-2*Ae*U,j=Ae-_e;if(P=Ee*Ee-4*j*F,P>=0){let ce=Math.sqrt(P);Ee<0&&(ce=-ce),ce=-(Ee+ce)*.5;let Ue=ce/j,Re=F/ce,Fe=Math.abs(Ue)<Math.abs(Re)?Ue:Re;if(Ue=Z-Fe*Fe,Ue>=0){O=Math.sqrt(Ue)*r,Y=ge-Math.atan2(O,Fe),G=Math.atan2(O/f,(Fe-U)/d);break e}}let K=Ye.PI,q=U-I,W=q*q,Q=0,le=0,xe=U+I,ae=xe*xe,we=0;F=-I*U/(_e-Ae),F>=-1&&F<=1&&(F=Math.acos(F),X=I*Math.cos(F)+U,O=R*Math.sin(F),P=X*X+O*O,P<W&&(K=F,W=P,q=X,Q=O),P>ae&&(le=F,ae=P,xe=X,we=O)),Z<=(W+ae)*.5?(Y=ge-Math.atan2(Q*r,q),G=K*r):(Y=ge-Math.atan2(we*r,xe),G=le*r)}let de=Math.atan2(E,w)*g,me=e.arotation;Y=(Y-de)*Ye.radDeg+y-me,Y>180?Y-=360:Y<-180&&(Y+=360),e.updateWorldTransformWith(c,u,me+Y*l,p,m,0,0),me=t.arotation,G=((G+de)*Ye.radDeg-t.ashearX)*g+b-me,G>180?G-=360:G<-180&&(G+=360),t.updateWorldTransformWith(w,E,me+G*l,t.ascaleX,t.ascaleY,t.ashearX,t.ashearY)}},Cb=class extends su{constructor(t){super(t,0,!1);x(this,"bones",new Array);x(this,"_target",null);x(this,"bendDirection",0);x(this,"compress",!1);x(this,"stretch",!1);x(this,"uniform",!1);x(this,"mix",0);x(this,"softness",0)}set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("BoneData not set.")}},Ib=class extends su{constructor(t){super(t,0,!1);x(this,"bones",new Array);x(this,"_target",null);x(this,"positionMode",Sn.Fixed);x(this,"spacingMode",Ai.Fixed);x(this,"rotateMode",ma.Chain);x(this,"offsetRotation",0);x(this,"position",0);x(this,"spacing",0);x(this,"mixRotate",0);x(this,"mixX",0);x(this,"mixY",0)}set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("SlotData not set.")}};var Sn;(function(n){n[n.Fixed=0]="Fixed",n[n.Percent=1]="Percent"})(Sn||(Sn={}));var Ai;(function(n){n[n.Length=0]="Length",n[n.Fixed=1]="Fixed",n[n.Percent=2]="Percent",n[n.Proportional=3]="Proportional"})(Ai||(Ai={}));var ma;(function(n){n[n.Tangent=0]="Tangent",n[n.Chain=1]="Chain",n[n.ChainScale=2]="ChainScale"})(ma||(ma={}));var Hi;let xI=(Hi=class{constructor(e,t){x(this,"data");x(this,"bones");x(this,"target");x(this,"position",0);x(this,"spacing",0);x(this,"mixRotate",0);x(this,"mixX",0);x(this,"mixY",0);x(this,"spaces",new Array);x(this,"positions",new Array);x(this,"world",new Array);x(this,"curves",new Array);x(this,"lengths",new Array);x(this,"segments",new Array);x(this,"active",!1);if(!e)throw new Error("data cannot be null.");if(!t)throw new Error("skeleton cannot be null.");this.data=e,this.bones=new Array;for(let 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 Sl))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==ma.Tangent,h=a.rotateMode==ma.ChainScale,l=this.bones,c=l.length,u=o?c:c+1,d=Ve.setArraySize(this.spaces,u),f=h?this.lengths=Ve.setArraySize(this.lengths,c):[],p=this.spacing;switch(a.spacingMode){case Ai.Percent:if(h)for(let M=0,_=u-1;M<_;M++){let I=l[M],R=I.data.length,F=R*I.a,P=R*I.c;f[M]=Math.sqrt(F*F+P*P)}Ve.arrayFill(d,1,u,p);break;case Ai.Proportional:let w=0;for(let M=0,_=u-1;M<_;){let I=l[M],R=I.data.length;if(R<Hi.epsilon)h&&(f[M]=0),d[++M]=p;else{let F=R*I.a,P=R*I.c,k=Math.sqrt(F*F+P*P);h&&(f[M]=k),d[++M]=k,w+=k}}if(w>0){w=u/w*p;for(let M=1;M<u;M++)d[M]*=w}break;default:let E=a.spacingMode==Ai.Length;for(let M=0,_=u-1;M<_;){let I=l[M],R=I.data.length;if(R<Hi.epsilon)h&&(f[M]=0),d[++M]=p;else{let F=R*I.a,P=R*I.c,k=Math.sqrt(F*F+P*P);h&&(f[M]=k),d[++M]=(E?R+p:p)*k/R}}}let m=this.computeWorldPositions(t,u,o),v=m[0],y=m[1],b=a.offsetRotation,g=!1;if(b==0)g=a.rotateMode==ma.Chain;else{g=!1;let w=this.target.bone;b*=w.a*w.d-w.b*w.c>0?Ye.degRad:-.01745329277777778}for(let w=0,E=3;w<c;w++,E+=3){let M=l[w];M.worldX+=(v-M.worldX)*s,M.worldY+=(y-M.worldY)*r;let _=m[E],I=m[E+1],R=_-v,F=I-y;if(h){let P=f[w];if(P!=0){let k=(Math.sqrt(R*R+F*F)/P-1)*i+1;M.a*=k,M.c*=k}}if(v=_,y=I,i>0){let P=M.a,k=M.b,B=M.c,L=M.d,X=0,O=0,D=0;if(o?X=m[E-1]:d[w+1]==0?X=m[E+2]:X=Math.atan2(F,R),X-=Math.atan2(B,P),g){O=Math.cos(X),D=Math.sin(X);let T=M.data.length;v+=(T*(O*P-D*B)-R)*i,y+=(T*(D*P+O*B)-F)*i}else X+=b;X>Ye.PI?X-=Ye.PI2:X<-3.1415927&&(X+=Ye.PI2),X*=i,O=Math.cos(X),D=Math.sin(X),M.a=O*P-D*B,M.b=O*k-D*L,M.c=D*P+O*B,M.d=D*k+O*L}M.updateAppliedTransform()}}computeWorldPositions(e,t,i){let s=this.target,r=this.position,a=this.spaces,o=Ve.setArraySize(this.positions,t*3+2),h=this.world,l=e.closed,c=e.worldVerticesLength,u=c/6,d=Hi.NONE;if(!e.constantSpeed){let T=e.lengths;u-=l?1:2;let U=T[u];this.data.positionMode==Sn.Percent&&(r*=U);let N;switch(this.data.spacingMode){case Ai.Percent:N=U;break;case Ai.Proportional:N=U/t;break;default:N=1}h=Ve.setArraySize(this.world,8);for(let Y=0,G=0,H=0;Y<t;Y++,G+=3){let ne=a[Y]*N;r+=ne;let Z=r;if(l)Z%=U,Z<0&&(Z+=U),H=0;else if(Z<0){d!=Hi.BEFORE&&(d=Hi.BEFORE,e.computeWorldVertices(s,2,4,h,0,2)),this.addBeforePosition(Z,h,0,o,G);continue}else if(Z>U){d!=Hi.AFTER&&(d=Hi.AFTER,e.computeWorldVertices(s,c-6,4,h,0,2)),this.addAfterPosition(Z-U,h,0,o,G);continue}for(;;H++){let de=T[H];if(!(Z>de)){if(H==0)Z/=de;else{let me=T[H-1];Z=(Z-me)/(de-me)}break}}H!=d&&(d=H,l&&H==u?(e.computeWorldVertices(s,c-4,4,h,0,2),e.computeWorldVertices(s,0,4,h,4,2)):e.computeWorldVertices(s,H*6+2,8,h,0,2)),this.addCurvePosition(Z,h[0],h[1],h[2],h[3],h[4],h[5],h[6],h[7],o,G,i||Y>0&&ne==0)}return o}l?(c+=2,h=Ve.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=Ve.setArraySize(this.world,c),e.computeWorldVertices(s,2,c,h,0,2));let f=Ve.setArraySize(this.curves,u),p=0,m=h[0],v=h[1],y=0,b=0,g=0,w=0,E=0,M=0,_=0,I=0,R=0,F=0,P=0,k=0,B=0,L=0;for(let T=0,U=2;T<u;T++,U+=6)y=h[U],b=h[U+1],g=h[U+2],w=h[U+3],E=h[U+4],M=h[U+5],_=(m-y*2+g)*.1875,I=(v-b*2+w)*.1875,R=((y-g)*3-m+E)*.09375,F=((b-w)*3-v+M)*.09375,P=_*2+R,k=I*2+F,B=(y-m)*.75+_+R*.16666667,L=(b-v)*.75+I+F*.16666667,p+=Math.sqrt(B*B+L*L),B+=P,L+=k,P+=R,k+=F,p+=Math.sqrt(B*B+L*L),B+=P,L+=k,p+=Math.sqrt(B*B+L*L),B+=P+R,L+=k+F,p+=Math.sqrt(B*B+L*L),f[T]=p,m=E,v=M;this.data.positionMode==Sn.Percent&&(r*=p);let X;switch(this.data.spacingMode){case Ai.Percent:X=p;break;case Ai.Proportional:X=p/t;break;default:X=1}let O=this.segments,D=0;for(let T=0,U=0,N=0,Y=0;T<t;T++,U+=3){let G=a[T]*X;r+=G;let H=r;if(l)H%=p,H<0&&(H+=p),N=0;else if(H<0){this.addBeforePosition(H,h,0,o,U);continue}else if(H>p){this.addAfterPosition(H-p,h,c-4,o,U);continue}for(;;N++){let ne=f[N];if(!(H>ne)){if(N==0)H/=ne;else{let Z=f[N-1];H=(H-Z)/(ne-Z)}break}}if(N!=d){d=N;let ne=N*6;for(m=h[ne],v=h[ne+1],y=h[ne+2],b=h[ne+3],g=h[ne+4],w=h[ne+5],E=h[ne+6],M=h[ne+7],_=(m-y*2+g)*.03,I=(v-b*2+w)*.03,R=((y-g)*3-m+E)*.006,F=((b-w)*3-v+M)*.006,P=_*2+R,k=I*2+F,B=(y-m)*.3+_+R*.16666667,L=(b-v)*.3+I+F*.16666667,D=Math.sqrt(B*B+L*L),O[0]=D,ne=1;ne<8;ne++)B+=P,L+=k,P+=R,k+=F,D+=Math.sqrt(B*B+L*L),O[ne]=D;B+=P,L+=k,D+=Math.sqrt(B*B+L*L),O[8]=D,B+=P+R,L+=k+F,D+=Math.sqrt(B*B+L*L),O[9]=D,Y=0}for(H*=D;;Y++){let ne=O[Y];if(!(H>ne)){if(Y==0)H/=ne;else{let Z=O[Y-1];H=Y+(H-Z)/(ne-Z)}break}}this.addCurvePosition(H*.1,m,v,y,b,g,w,E,M,o,U,i||T>0&&G==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,v=m*m,y=v*m,b=m*e,g=b*3,w=m*g,E=g*e,M=t*y+s*w+a*E+h*p,_=i*y+r*w+o*E+l*p;c[u]=M,c[u+1]=_,d&&(e<.001?c[u+2]=Math.atan2(r-i,s-t):c[u+2]=Math.atan2(_-(i*v+r*b*2+o*f),M-(t*v+s*b*2+a*f)))}},x(Hi,"NONE",-1),x(Hi,"BEFORE",-2),x(Hi,"AFTER",-3),x(Hi,"epsilon",1e-5),Hi),bI=class{constructor(e,t){x(this,"data");x(this,"_bone",null);x(this,"inertia",0);x(this,"strength",0);x(this,"damping",0);x(this,"massInverse",0);x(this,"wind",0);x(this,"gravity",0);x(this,"mix",0);x(this,"_reset",!0);x(this,"ux",0);x(this,"uy",0);x(this,"cx",0);x(this,"cy",0);x(this,"tx",0);x(this,"ty",0);x(this,"xOffset",0);x(this,"xVelocity",0);x(this,"yOffset",0);x(this,"yVelocity",0);x(this,"rotateOffset",0);x(this,"rotateVelocity",0);x(this,"scaleOffset",0);x(this,"scaleVelocity",0);x(this,"active",!1);x(this,"skeleton");x(this,"remaining",0);x(this,"lastTime",0);this.data=e,this.skeleton=t,this.bone=t.bones[e.bone.index],this.inertia=e.inertia,this.strength=e.strength,this.damping=e.damping,this.massInverse=e.massInverse,this.wind=e.wind,this.gravity=e.gravity,this.mix=e.mix}set bone(e){this._bone=e}get bone(){if(this._bone)return this._bone;throw new Error("Bone not set.")}reset(){this.remaining=0,this.lastTime=this.skeleton.time,this._reset=!0,this.xOffset=0,this.xVelocity=0,this.yOffset=0,this.yVelocity=0,this.rotateOffset=0,this.rotateVelocity=0,this.scaleOffset=0,this.scaleVelocity=0}setToSetupPose(){const e=this.data;this.inertia=e.inertia,this.strength=e.strength,this.damping=e.damping,this.massInverse=e.massInverse,this.wind=e.wind,this.gravity=e.gravity,this.mix=e.mix}isActive(){return this.active}update(e){const t=this.mix;if(t==0)return;const i=this.data.x>0,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 Tr.none:return;case Tr.reset:this.reset();case Tr.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,v=this.skeleton.data.referenceScale,y=-1,b=this.data.limit*c,g=b*Math.abs(l.scaleY);if(b*=Math.abs(l.scaleX),i||s){if(i){const w=(this.ux-u)*p;this.xOffset+=w>b?b:w<-b?-b:w,this.ux=u}if(s){const w=(this.uy-d)*p;this.yOffset+=w>g?g:w<-g?-g:w,this.uy=d}if(f>=m){y=Math.pow(this.damping,60*m);const w=this.massInverse*m,E=this.strength,M=this.wind*v*l.scaleX,_=this.gravity*v*l.scaleY;do i&&(this.xVelocity+=(M-this.xOffset*E)*w,this.xOffset+=this.xVelocity*m,this.xVelocity*=y),s&&(this.yVelocity-=(_+this.yOffset*E)*w,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 w=Math.atan2(o.c,o.a),E=0,M=0,_=0,I=this.cx-o.worldX,R=this.cy-o.worldY;if(I>b?I=b:I<-b&&(I=-b),R>g?R=g:R<-g&&(R=-g),r){_=(this.data.rotate+this.data.shearX)*t;let F=Math.atan2(R+this.ty,I+this.tx)-w-this.rotateOffset*_;this.rotateOffset+=(F-Math.ceil(F*Ye.invPI2-.5)*Ye.PI2)*p,F=this.rotateOffset*_+w,E=Math.cos(F),M=Math.sin(F),a&&(F=h*o.getWorldScaleX(),F>0&&(this.scaleOffset+=(I*E+R*M)*p/F))}else{E=Math.cos(w),M=Math.sin(w);const F=h*o.getWorldScaleX();F>0&&(this.scaleOffset+=(I*E+R*M)*p/F)}if(f=this.remaining,f>=m){y==-1&&(y=Math.pow(this.damping,60*m));const F=this.massInverse*m,P=this.strength,k=this.wind,B=ap.yDown?-this.gravity:this.gravity,L=h/v;for(;;)if(f-=m,a&&(this.scaleVelocity+=(k*E-B*M-this.scaleOffset*P)*F,this.scaleOffset+=this.scaleVelocity*m,this.scaleVelocity*=y),r){if(this.rotateVelocity-=((k*M+B*E)*L+this.rotateOffset*P)*F,this.rotateOffset+=this.rotateVelocity*m,this.rotateVelocity*=y,f<m)break;const X=this.rotateOffset*_+w;E=Math.cos(X),M=Math.sin(X)}else if(f<m)break}}this.remaining=f}this.cx=o.worldX,this.cy=o.worldY;break;case Tr.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!=Tr.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*Ye.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)}},wI=class{constructor(e,t){x(this,"data");x(this,"bone");x(this,"color");x(this,"darkColor",null);x(this,"attachment",null);x(this,"attachmentState",0);x(this,"sequenceIndex",-1);x(this,"deform",new Array);if(!e)throw new Error("data cannot be null.");if(!t)throw new Error("bone cannot be null.");this.data=e,this.bone=t,this.color=new St,this.darkColor=e.darkColor?new St:null,this.setToSetupPose()}getSkeleton(){return this.bone.skeleton}getAttachment(){return this.attachment}setAttachment(e){this.attachment!=e&&((!(e instanceof ar)||!(this.attachment instanceof ar)||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}},SI=class{constructor(e,t){x(this,"data");x(this,"bones");x(this,"target");x(this,"mixRotate",0);x(this,"mixX",0);x(this,"mixY",0);x(this,"mixScaleX",0);x(this,"mixScaleY",0);x(this,"mixShearY",0);x(this,"temp",new uh);x(this,"active",!1);if(!e)throw new Error("data cannot be null.");if(!t)throw new Error("skeleton cannot be null.");this.data=e,this.bones=new Array;for(let 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?Ye.degRad:-.01745329277777778,p=this.data.offsetRotation*f,m=this.data.offsetShearY*f,v=this.bones;for(let y=0,b=v.length;y<b;y++){let g=v[y];if(e!=0){let w=g.a,E=g.b,M=g.c,_=g.d,I=Math.atan2(u,l)-Math.atan2(M,w)+p;I>Ye.PI?I-=Ye.PI2:I<-3.1415927&&(I+=Ye.PI2),I*=e;let R=Math.cos(I),F=Math.sin(I);g.a=R*w-F*M,g.b=R*E-F*_,g.c=F*w+R*M,g.d=F*E+R*_}if(o){let w=this.temp;h.localToWorld(w.set(this.data.offsetX,this.data.offsetY)),g.worldX+=(w.x-g.worldX)*t,g.worldY+=(w.y-g.worldY)*i}if(s!=0){let w=Math.sqrt(g.a*g.a+g.c*g.c);w!=0&&(w=(w+(Math.sqrt(l*l+u*u)-w+this.data.offsetScaleX)*s)/w),g.a*=w,g.c*=w}if(r!=0){let w=Math.sqrt(g.b*g.b+g.d*g.d);w!=0&&(w=(w+(Math.sqrt(c*c+d*d)-w+this.data.offsetScaleY)*r)/w),g.b*=w,g.d*=w}if(a>0){let w=g.b,E=g.d,M=Math.atan2(E,w),_=Math.atan2(d,c)-Math.atan2(u,l)-(M-Math.atan2(g.c,g.a));_>Ye.PI?_-=Ye.PI2:_<-3.1415927&&(_+=Ye.PI2),_=M+(_+m)*a;let I=Math.sqrt(w*w+E*E);g.b=Math.cos(_)*I,g.d=Math.sin(_)*I}g.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?Ye.degRad:-.01745329277777778,p=this.data.offsetRotation*f,m=this.data.offsetShearY*f,v=this.bones;for(let y=0,b=v.length;y<b;y++){let g=v[y];if(e!=0){let w=g.a,E=g.b,M=g.c,_=g.d,I=Math.atan2(u,l)+p;I>Ye.PI?I-=Ye.PI2:I<-3.1415927&&(I+=Ye.PI2),I*=e;let R=Math.cos(I),F=Math.sin(I);g.a=R*w-F*M,g.b=R*E-F*_,g.c=F*w+R*M,g.d=F*E+R*_}if(o){let w=this.temp;h.localToWorld(w.set(this.data.offsetX,this.data.offsetY)),g.worldX+=w.x*t,g.worldY+=w.y*i}if(s!=0){let w=(Math.sqrt(l*l+u*u)-1+this.data.offsetScaleX)*s+1;g.a*=w,g.c*=w}if(r!=0){let w=(Math.sqrt(c*c+d*d)-1+this.data.offsetScaleY)*r+1;g.b*=w,g.d*=w}if(a>0){let w=Math.atan2(d,c)-Math.atan2(u,l);w>Ye.PI?w-=Ye.PI2:w<-3.1415927&&(w+=Ye.PI2);let E=g.b,M=g.d;w=Math.atan2(M,E)+(w-Ye.PI/2+m)*a;let _=Math.sqrt(E*E+M*M);g.b=Math.cos(w)*_,g.d=Math.sin(w)*_}g.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,v=u.ascaleY;s!=0&&m!=0&&(m=(m+(o.ascaleX-m+this.data.offsetScaleX)*s)/m),r!=0&&v!=0&&(v=(v+(o.ascaleY-v+this.data.offsetScaleY)*r)/v);let y=u.ashearY;a!=0&&(y+=(o.ashearY-y+this.data.offsetShearY)*a),u.updateWorldTransformWith(f,p,d,m,v,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),v=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,v,u.ashearX,y)}}};var Gn;let ap=(Gn=class{constructor(e){x(this,"data");x(this,"bones");x(this,"slots");x(this,"drawOrder");x(this,"ikConstraints");x(this,"transformConstraints");x(this,"pathConstraints");x(this,"physicsConstraints");x(this,"_updateCache",new Array);x(this,"skin",null);x(this,"color");x(this,"scaleX",1);x(this,"_scaleY",1);x(this,"x",0);x(this,"y",0);x(this,"time",0);if(!e)throw new Error("data cannot be null.");this.data=e,this.bones=new Array;for(let t=0;t<e.bones.length;t++){let i=e.bones[t],s;if(!i.parent)s=new uv(i,this,null);else{let r=this.bones[i.parent.index];s=new uv(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 wI(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 yI(i,this))}this.transformConstraints=new Array;for(let t=0;t<e.transformConstraints.length;t++){let i=e.transformConstraints[t];this.transformConstraints.push(new SI(i,this))}this.pathConstraints=new Array;for(let t=0;t<e.pathConstraints.length;t++){let i=e.pathConstraints[t];this.pathConstraints.push(new xI(i,this))}this.physicsConstraints=new Array;for(let t=0;t<e.physicsConstraints.length;t++){let i=e.physicsConstraints[t];this.physicsConstraints.push(new bI(i,this))}this.color=new St(1,1,1,1),this.updateCache()}get scaleY(){return Gn.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&&Ve.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&&Ve.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 Sl&&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&&Ve.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 Sl))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&&Ve.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 v=1,y=i.length;v<y;v++){let b=i[v];b.ax=b.x,b.ay=b.y,b.arotation=b.rotation,b.ascaleX=b.scaleX,b.ascaleY=b.scaleY,b.ashearX=b.shearX,b.ashearY=b.shearY}let 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)*Ye.degRad,c=(s.rotation+90+s.shearY)*Ye.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 v=0,y=m.length;v<y;v++){let b=m[v];b!=s&&b.update(e)}}setToSetupPose(){this.setBonesToSetupPose(),this.setSlotsToSetupPose()}setBonesToSetupPose(){for(const e of this.bones)e.setToSetupPose();for(const e of this.ikConstraints)e.setToSetupPose();for(const e of this.transformConstraints)e.setToSetupPose();for(const e of this.pathConstraints)e.setToSetupPose();for(const e of this.physicsConstraints)e.setToSetupPose()}setSlotsToSetupPose(){let e=this.slots;Ve.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 uh,i=new uh;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,v=d.getAttachment();if(v instanceof iu)f=8,p=Ve.setArraySize(i,f,0),v.computeWorldVertices(d,p,0,2),m=Gn.quadTriangles;else if(v instanceof Ol){let y=v;f=y.worldVerticesLength,p=Ve.setArraySize(i,f,0),y.computeWorldVertices(d,0,f,p,0,2),m=y.triangles}else if(v instanceof oo&&s!=null){s.clipStart(d,v);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,b=p.length;y<b;y+=2){let g=p[y],w=p[y+1];a=Math.min(a,g),o=Math.min(o,w),h=Math.max(h,g),l=Math.max(l,w)}}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)}},x(Gn,"quadTriangles",[0,1,2,2,3,0]),x(Gn,"yDown",!1),Gn);var Tr;(function(n){n[n.none=0]="none",n[n.reset=1]="reset",n[n.update=2]="update",n[n.pose=3]="pose"})(Tr||(Tr={}));let Rb=class extends su{constructor(t){super(t,0,!1);x(this,"_bone",null);x(this,"x",0);x(this,"y",0);x(this,"rotate",0);x(this,"scaleX",0);x(this,"shearX",0);x(this,"limit",0);x(this,"step",0);x(this,"inertia",0);x(this,"strength",0);x(this,"damping",0);x(this,"massInverse",0);x(this,"wind",0);x(this,"gravity",0);x(this,"mix",0);x(this,"inertiaGlobal",!1);x(this,"strengthGlobal",!1);x(this,"dampingGlobal",!1);x(this,"massGlobal",!1);x(this,"windGlobal",!1);x(this,"gravityGlobal",!1);x(this,"mixGlobal",!1)}set bone(t){this._bone=t}get bone(){if(this._bone)return this._bone;throw new Error("BoneData not set.")}},fh=class{constructor(){x(this,"name",null);x(this,"bones",new Array);x(this,"slots",new Array);x(this,"skins",new Array);x(this,"defaultSkin",null);x(this,"events",new Array);x(this,"animations",new Array);x(this,"ikConstraints",new Array);x(this,"transformConstraints",new Array);x(this,"pathConstraints",new Array);x(this,"physicsConstraints",new Array);x(this,"x",0);x(this,"y",0);x(this,"width",0);x(this,"height",0);x(this,"referenceScale",100);x(this,"version",null);x(this,"hash",null);x(this,"fps",0);x(this,"imagesPath",null);x(this,"audioPath",null)}findBone(e){if(!e)throw new Error("boneName cannot be null.");let t=this.bones;for(let i=0,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}},dv=class{constructor(e=0,t,i){x(this,"slotIndex");x(this,"name");x(this,"attachment");this.slotIndex=e,this.name=t,this.attachment=i}},em=class{constructor(e){x(this,"name");x(this,"attachments",new Array);x(this,"bones",Array());x(this,"constraints",new Array);x(this,"color",new St(.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 Ol?(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 dv(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 dv(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++}}},Pb=class{constructor(e,t,i){x(this,"index",0);x(this,"name");x(this,"boneData");x(this,"color",new St(1,1,1,1));x(this,"darkColor",null);x(this,"attachmentName",null);x(this,"blendMode",Rr.Normal);x(this,"visible",!0);if(e<0)throw new Error("index must be >= 0.");if(!t)throw new Error("name cannot be null.");if(!i)throw new Error("boneData cannot be null.");this.index=e,this.name=t,this.boneData=i}};var Rr;(function(n){n[n.Normal=0]="Normal",n[n.Additive=1]="Additive",n[n.Multiply=2]="Multiply",n[n.Screen=3]="Screen"})(Rr||(Rr={}));let kb=class extends su{constructor(t){super(t,0,!1);x(this,"bones",new Array);x(this,"_target",null);x(this,"mixRotate",0);x(this,"mixX",0);x(this,"mixY",0);x(this,"mixScaleX",0);x(this,"mixScaleY",0);x(this,"mixShearY",0);x(this,"offsetRotation",0);x(this,"offsetX",0);x(this,"offsetY",0);x(this,"offsetScaleX",0);x(this,"offsetScaleY",0);x(this,"offsetShearY",0);x(this,"relative",!1);x(this,"local",!1)}set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("BoneData not set.")}},tm=class{constructor(e){x(this,"scale",1);x(this,"attachmentLoader");x(this,"linkedMeshes",new Array);this.attachmentLoader=e}readSkeletonData(e){let t=this.scale,i=new fh;i.name="";let s=new _I(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 Mb(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&&(St.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 Pb(c,u,d);St.rgba8888ToColor(f.color,s.readInt32());let p=s.readInt32();p!=-1&&St.rgb888ToColor(f.darkColor=new St,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 Cb(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 kb(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 Ib(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==Sn.Fixed&&(f.position*=t),f.spacing=s.readFloat(),(f.spacingMode==Ai.Length||f.spacingMode==Ai.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 Rb(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(Ve.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 Ab(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 em("default")}else{let o=e.readString();if(!o)throw new Error("Skin name must not be null.");r=new em(o),s&&St.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 Dn.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(),v=e.readFloat(),y=e.readFloat(),b=e.readFloat(),g=e.readFloat();c||(c=l);let w=this.attachmentLoader.newRegionAttachment(i,l,c,d);return w?(w.path=c,w.x=p*o,w.y=m*o,w.scaleX=v,w.scaleY=y,w.rotation=f,w.width=b*o,w.height=g*o,St.rgba8888ToColor(w.color,u),w.sequence=d,d==null&&w.updateRegion(),w):null}case Dn.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&&St.rgba8888ToColor(d.color,u),d):null}case Dn.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),v=this.readShortArray(e,(p.length-f-2)*3);let y=[],b=0,g=0;a&&(y=this.readShortArray(e,e.readInt(!0)),b=e.readFloat(),g=e.readFloat()),c||(c=l);let w=this.attachmentLoader.newMeshAttachment(i,l,c,d);return w?(w.path=c,St.rgba8888ToColor(w.color,u),w.bones=p.bones,w.vertices=p.vertices,w.worldVerticesLength=p.length,w.triangles=v,w.regionUVs=m,d==null&&w.updateRegion(),w.hullLength=f<<1,w.sequence=d,a&&(w.edges=y,w.width=b*o,w.height=g*o),w):null}case Dn.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 v=0,y=0;a&&(v=e.readFloat(),y=e.readFloat());let b=this.attachmentLoader.newMeshAttachment(i,l,c,d);return b?(b.path=c,St.rgba8888ToColor(b.color,u),b.sequence=d,a&&(b.width=v*o,b.height=y*o),this.linkedMeshes.push(new TI(b,p,s,m,f)),b):null}case Dn.Path:{const c=(h&16)!=0,u=(h&32)!=0,d=this.readVertices(e,(h&64)!=0),f=Ve.newArray(d.length/6,0);for(let v=0,y=f.length;v<y;v++)f[v]=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&&St.rgba8888ToColor(m.color,p),m):null}case Dn.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&&St.rgba8888ToColor(p.color,f),p):null}case Dn.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&&St.rgba8888ToColor(f.color,d),f):null}}return null}readSequence(e){let t=new U1(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 MI;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=Ve.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),v=m-1;switch(p){case DI:{let y=new Wa(m,u);for(let b=0;b<m;b++)y.setFrame(b,e.readFloat(),e.readStringRef());s.push(y);break}case NI:{let y=e.readInt(!0),b=new Z1(m,y,u),g=e.readFloat(),w=e.readUnsignedByte()/255,E=e.readUnsignedByte()/255,M=e.readUnsignedByte()/255,_=e.readUnsignedByte()/255;for(let I=0,R=0;b.setFrame(I,g,w,E,M,_),I!=v;I++){let F=e.readFloat(),P=e.readUnsignedByte()/255,k=e.readUnsignedByte()/255,B=e.readUnsignedByte()/255,L=e.readUnsignedByte()/255;switch(e.readByte()){case ln:b.setStepped(I);break;case cn:kt(e,b,R++,I,0,g,F,w,P,1),kt(e,b,R++,I,1,g,F,E,k,1),kt(e,b,R++,I,2,g,F,M,B,1),kt(e,b,R++,I,3,g,F,_,L,1)}g=F,w=P,E=k,M=B,_=L}s.push(b);break}case UI:{let y=e.readInt(!0),b=new J1(m,y,u),g=e.readFloat(),w=e.readUnsignedByte()/255,E=e.readUnsignedByte()/255,M=e.readUnsignedByte()/255;for(let _=0,I=0;b.setFrame(_,g,w,E,M),_!=v;_++){let R=e.readFloat(),F=e.readUnsignedByte()/255,P=e.readUnsignedByte()/255,k=e.readUnsignedByte()/255;switch(e.readByte()){case ln:b.setStepped(_);break;case cn:kt(e,b,I++,_,0,g,R,w,F,1),kt(e,b,I++,_,1,g,R,E,P,1),kt(e,b,I++,_,2,g,R,M,k,1)}g=R,w=F,E=P,M=k}s.push(b);break}case XI:{let y=e.readInt(!0),b=new eb(m,y,u),g=e.readFloat(),w=e.readUnsignedByte()/255,E=e.readUnsignedByte()/255,M=e.readUnsignedByte()/255,_=e.readUnsignedByte()/255,I=e.readUnsignedByte()/255,R=e.readUnsignedByte()/255,F=e.readUnsignedByte()/255;for(let P=0,k=0;b.setFrame(P,g,w,E,M,_,I,R,F),P!=v;P++){let B=e.readFloat(),L=e.readUnsignedByte()/255,X=e.readUnsignedByte()/255,O=e.readUnsignedByte()/255,D=e.readUnsignedByte()/255,T=e.readUnsignedByte()/255,U=e.readUnsignedByte()/255,N=e.readUnsignedByte()/255;switch(e.readByte()){case ln:b.setStepped(P);break;case cn:kt(e,b,k++,P,0,g,B,w,L,1),kt(e,b,k++,P,1,g,B,E,X,1),kt(e,b,k++,P,2,g,B,M,O,1),kt(e,b,k++,P,3,g,B,_,D,1),kt(e,b,k++,P,4,g,B,I,T,1),kt(e,b,k++,P,5,g,B,R,U,1),kt(e,b,k++,P,6,g,B,F,N,1)}g=B,w=L,E=X,M=O,_=D,I=T,R=U,F=N}s.push(b);break}case YI:{let y=e.readInt(!0),b=new tb(m,y,u),g=e.readFloat(),w=e.readUnsignedByte()/255,E=e.readUnsignedByte()/255,M=e.readUnsignedByte()/255,_=e.readUnsignedByte()/255,I=e.readUnsignedByte()/255,R=e.readUnsignedByte()/255;for(let F=0,P=0;b.setFrame(F,g,w,E,M,_,I,R),F!=v;F++){let k=e.readFloat(),B=e.readUnsignedByte()/255,L=e.readUnsignedByte()/255,X=e.readUnsignedByte()/255,O=e.readUnsignedByte()/255,D=e.readUnsignedByte()/255,T=e.readUnsignedByte()/255;switch(e.readByte()){case ln:b.setStepped(F);break;case cn:kt(e,b,P++,F,0,g,k,w,B,1),kt(e,b,P++,F,1,g,k,E,L,1),kt(e,b,P++,F,2,g,k,M,X,1),kt(e,b,P++,F,3,g,k,_,O,1),kt(e,b,P++,F,4,g,k,I,D,1),kt(e,b,P++,F,5,g,k,R,T,1)}g=k,w=B,E=L,M=X,_=O,I=D,R=T}s.push(b);break}case VI:{let y=new Q1(m,e.readInt(!0),u),b=e.readFloat(),g=e.readUnsignedByte()/255;for(let w=0,E=0;y.setFrame(w,b,g),w!=v;w++){let M=e.readFloat(),_=e.readUnsignedByte()/255;switch(e.readByte()){case ln:y.setStepped(w);break;case cn:kt(e,y,E++,w,0,b,M,g,_,1)}b=M,g=_}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==LI){let y=new K1(m,u);for(let b=0;b<m;b++)y.setFrame(b,e.readFloat(),e.readByte());s.push(y);continue}let v=e.readInt(!0);switch(p){case EI:s.push($i(e,new dh(m,v,u),1));break;case AI:s.push(zd(e,new Y1(m,v,u),r));break;case CI:s.push($i(e,new V1(m,v,u),r));break;case II:s.push($i(e,new $1(m,v,u),r));break;case RI:s.push(zd(e,new G1(m,v,u),1));break;case PI:s.push($i(e,new j1(m,v,u),1));break;case kI:s.push($i(e,new H1(m,v,u),1));break;case FI:s.push(zd(e,new W1(m,v,u),1));break;case OI:s.push($i(e,new z1(m,v,u),1));break;case BI:s.push($i(e,new q1(m,v,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 sb(d,e.readInt(!0),u),m=e.readByte(),v=e.readFloat(),y=(m&1)!=0?(m&2)!=0?e.readFloat():1:0,b=(m&4)!=0?e.readFloat()*r:0;for(let g=0,w=0;p.setFrame(g,v,y,b,(m&8)!=0?1:-1,(m&16)!=0,(m&32)!=0),g!=f;g++){m=e.readByte();const E=e.readFloat(),M=(m&1)!=0?(m&2)!=0?e.readFloat():1:0,_=(m&4)!=0?e.readFloat()*r:0;(m&64)!=0?p.setStepped(g):(m&128)!=0&&(kt(e,p,w++,g,0,v,E,y,M,1),kt(e,p,w++,g,1,v,E,b,_,r)),v=E,y=M,b=_}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 nb(d,e.readInt(!0),u),m=e.readFloat(),v=e.readFloat(),y=e.readFloat(),b=e.readFloat(),g=e.readFloat(),w=e.readFloat(),E=e.readFloat();for(let M=0,_=0;p.setFrame(M,m,v,y,b,g,w,E),M!=f;M++){let I=e.readFloat(),R=e.readFloat(),F=e.readFloat(),P=e.readFloat(),k=e.readFloat(),B=e.readFloat(),L=e.readFloat();switch(e.readByte()){case ln:p.setStepped(M);break;case cn:kt(e,p,_++,M,0,m,I,v,R,1),kt(e,p,_++,M,1,m,I,y,F,1),kt(e,p,_++,M,2,m,I,b,P,1),kt(e,p,_++,M,3,m,I,g,k,1),kt(e,p,_++,M,4,m,I,w,B,1),kt(e,p,_++,M,5,m,I,E,L,1)}m=I,v=R,y=F,b=P,g=k,w=B,E=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(),v=e.readInt(!0),y=e.readInt(!0);switch(m){case jI:s.push($i(e,new rb(v,y,u),d.positionMode==Sn.Fixed?r:1));break;case HI:s.push($i(e,new ab(v,y,u),d.spacingMode==Ai.Length||d.spacingMode==Ai.Fixed?r:1));break;case WI:let b=new ob(v,y,u),g=e.readFloat(),w=e.readFloat(),E=e.readFloat(),M=e.readFloat();for(let _=0,I=0,R=b.getFrameCount()-1;b.setFrame(_,g,w,E,M),_!=R;_++){let F=e.readFloat(),P=e.readFloat(),k=e.readFloat(),B=e.readFloat();switch(e.readByte()){case ln:b.setStepped(_);break;case cn:kt(e,b,I++,_,0,g,F,w,P,1),kt(e,b,I++,_,1,g,F,E,k,1),kt(e,b,I++,_,2,g,F,M,B,1)}g=F,w=P,E=k,M=B}s.push(b)}}}for(let l=0,c=e.readInt(!0);l<c;l++){const u=e.readInt(!0)-1;for(let d=0,f=e.readInt(!0);d<f;d++){const p=e.readByte(),m=e.readInt(!0);if(p==tR){const y=new pb(m,u);for(let b=0;b<m;b++)y.setFrame(b,e.readFloat());s.push(y);continue}const v=e.readInt(!0);switch(p){case zI:s.push($i(e,new lb(m,v,u),1));break;case qI:s.push($i(e,new cb(m,v,u),1));break;case KI:s.push($i(e,new hb(m,v,u),1));break;case ZI:s.push($i(e,new ub(m,v,u),1));break;case JI:s.push($i(e,new db(m,v,u),1));break;case QI:s.push($i(e,new fb(m,v,u),1));break;case eR:s.push($i(e,new mb(m,v,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,v=e.readInt(!0);m<v;m++){let y=e.readStringRef();if(!y)throw new Error("attachmentName must not be null.");let b=u.getAttachment(p,y),g=e.readByte(),w=e.readInt(!0),E=w-1;switch(g){case $I:{let M=b,_=M.bones,I=M.vertices,R=_?I.length/3*2:I.length,F=e.readInt(!0),P=new ib(w,F,p,M),k=e.readFloat();for(let B=0,L=0;;B++){let X,O=e.readInt(!0);if(O==0)X=_?Ve.newFloatArray(R):I;else{X=Ve.newFloatArray(R);let T=e.readInt(!0);if(O+=T,r==1)for(let U=T;U<O;U++)X[U]=e.readFloat();else for(let U=T;U<O;U++)X[U]=e.readFloat()*r;if(!_)for(let U=0,N=X.length;U<N;U++)X[U]+=I[U]}if(P.setFrame(B,k,X),B==E)break;let D=e.readFloat();switch(e.readByte()){case ln:P.setStepped(B);break;case cn:kt(e,P,L++,B,0,k,D,0,1,1)}k=D}s.push(P);break}case GI:{let M=new gb(w,p,b);for(let _=0;_<w;_++){let I=e.readFloat(),R=e.readInt32();M.setFrame(_,I,X1[R&15],R>>4,e.readFloat())}s.push(M);break}}}}}let a=e.readInt(!0);if(a>0){let l=new sl(a),c=i.slots.length;for(let u=0;u<a;u++){let d=e.readFloat(),f=e.readInt(!0),p=Ve.newArray(c,0);for(let b=c-1;b>=0;b--)p[b]=-1;let m=Ve.newArray(c-f,0),v=0,y=0;for(let b=0;b<f;b++){let g=e.readInt(!0);for(;v!=g;)m[y++]=v++;p[v+e.readInt(!0)]=v++}for(;v<c;)m[y++]=v++;for(let b=c-1;b>=0;b--)p[b]==-1&&(p[b]=m[--y]);l.setFrame(u,d,p)}s.push(l)}let o=e.readInt(!0);if(o>0){let l=new rp(o);for(let c=0;c<o;c++){let u=e.readFloat(),d=i.events[e.readInt(!0)],f=new Eb(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 sp(t,s,h)}},_I=class{constructor(e,t=new Array,i=0,s=new DataView(e instanceof ArrayBuffer?e:e.buffer)){x(this,"strings");x(this,"index");x(this,"buffer");this.strings=t,this.index=i,this.buffer=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}},TI=class{constructor(e,t,i,s,r){x(this,"parent");x(this,"skinIndex");x(this,"slotIndex");x(this,"mesh");x(this,"inheritTimeline");this.mesh=e,this.skinIndex=t,this.slotIndex=i,this.parent=s,this.inheritTimeline=r}},MI=class{constructor(e=null,t=null,i=0){x(this,"bones");x(this,"vertices");x(this,"length");this.bones=e,this.vertices=t,this.length=i}};var Dn;(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"})(Dn||(Dn={}));function $i(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 ln:e.setStepped(r);break;case cn:kt(n,e,a++,r,0,i,h,s,l,t)}i=h,s=l}return e}function zd(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 ln:e.setStepped(a);break;case cn:kt(n,e,o++,a,0,i,l,s,c,t),kt(n,e,o++,a,1,i,l,r,u,t)}i=l,s=c,r=u}return e}function kt(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 EI=0,AI=1,CI=2,II=3,RI=4,PI=5,kI=6,FI=7,OI=8,BI=9,LI=10,DI=0,NI=1,UI=2,XI=3,YI=4,VI=5,$I=0,GI=1,jI=0,HI=1,WI=2,zI=0,qI=1,KI=2,ZI=4,JI=5,QI=6,eR=7,tR=8,ln=1,cn=2;class as{constructor(){x(this,"convexPolygons",new Array);x(this,"convexPolygonsIndices",new Array);x(this,"indicesArray",new Array);x(this,"isConcaveArray",new Array);x(this,"triangles",new Array);x(this,"polygonPool",new hh(()=>new Array));x(this,"polygonIndicesPool",new hh(()=>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]=as.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],v=t[d+1],y=t[f],b=t[f+1],g=t[p],w=t[p+1];for(let E=(l+1)%i;E!=o;E=(E+1)%i){if(!r[E])continue;let M=s[E]<<1,_=t[M],I=t[M+1];if(as.positiveArea(g,w,m,v,_,I)&&as.positiveArea(m,v,y,b,_,I)&&as.positiveArea(y,b,g,w,_,I))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]=as.isConcave(c,i,t,s),r[u]=as.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],v=i[d+1],y=i[f],b=i[f+1],g=i[p],w=i[p+1],E=!1;if(h==d){let M=o.length-4,_=as.winding(o[M],o[M+1],o[M+2],o[M+3],g,w),I=as.winding(g,w,o[0],o[1],o[2],o[3]);_==l&&I==l&&(o.push(g),o.push(w),a.push(p),E=!0)}E||(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(v),o.push(y),o.push(b),o.push(g),o.push(w),a=this.polygonIndicesPool.obtain(),a.length=0,a.push(d),a.push(f),a.push(p),l=as.winding(m,v,y,b,g,w),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],v=o[p+1],y=o[p+2],b=o[p+3],g=o[0],w=o[1],E=o[2],M=o[3],_=as.winding(m,v,y,b,g,w);for(let I=0;I<u;I++){if(I==c)continue;let R=r[I];if(R.length!=3)continue;let F=R[0],P=R[1],k=R[2],B=s[I],L=B[B.length-2],X=B[B.length-1];if(F!=d||P!=f)continue;let O=as.winding(m,v,y,b,L,X),D=as.winding(L,X,g,w,E,M);O==_&&D==_&&(B.length=0,R.length=0,o.push(L),o.push(X),a.push(k),m=y,v=b,y=L,b=X,I=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 mh{constructor(){x(this,"triangulator",new as);x(this,"clippingPolygon",new Array);x(this,"clipOutput",new Array);x(this,"clippedVertices",new Array);x(this,"clippedUVs",new Array);x(this,"clippedTriangles",new Array);x(this,"scratch",new Array);x(this,"clipAttachment",null);x(this,"clippingPolygons",null)}clipStart(e,t){if(this.clipAttachment)return 0;this.clipAttachment=t;let i=t.worldVerticesLength,s=Ve.setArraySize(this.clippingPolygon,i);t.computeWorldVertices(e,0,i,s,0,2);let r=this.clippingPolygon;mh.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];mh.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 v=e[u],y=e[u+1];for(let b=0;b<h;b++){let g=r.length;if(this.clip(d,f,p,m,v,y,o[b],s)){let w=s.length;if(w==0)continue;let E=w>>1,M=this.clipOutput,_=Ve.setArraySize(r,g+E*2);for(let R=0;R<w;R+=2,g+=2){let F=M[R],P=M[R+1];_[g]=F,_[g+1]=P}g=a.length;let I=Ve.setArraySize(a,g+3*(E-2));E--;for(let R=1;R<E;R++,g+=3)I[g]=l,I[g+1]=l+R,I[g+2]=l+R+1;l+=E+1}else{let w=Ve.setArraySize(r,g+6);w[g]=d,w[g+1]=f,w[g+2]=p,w[g+3]=m,w[g+4]=v,w[g+5]=y,g=a.length;let E=Ve.setArraySize(a,g+3);E[g]=l,E[g+1]=l+1,E[g+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 v=t[m]<<1,y=e[v],b=e[v+1],g=s[v],w=s[v+1];v=t[m+1]<<1;let E=e[v],M=e[v+1],_=s[v],I=s[v+1];v=t[m+2]<<1;let R=e[v],F=e[v+1],P=s[v],k=s[v+1];for(let B=0;B<d;B++){let L=l.length;if(this.clip(y,b,E,M,R,F,u[B],h)){let X=h.length;if(X==0)continue;let O=M-F,D=R-E,T=y-R,U=F-b,N=1/(O*T+D*(b-F)),Y=X>>1,G=this.clipOutput,H=Ve.setArraySize(l,L+Y*f);for(let Z=0;Z<X;Z+=2,L+=f){let de=G[Z],me=G[Z+1];H[L]=de,H[L+1]=me,H[L+2]=r.r,H[L+3]=r.g,H[L+4]=r.b,H[L+5]=r.a;let _e=de-R,Ae=me-F,ge=(O*_e+D*Ae)*N,Ee=(U*_e+T*Ae)*N,j=1-ge-Ee;H[L+6]=g*ge+_*Ee+P*j,H[L+7]=w*ge+I*Ee+k*j,o&&(H[L+8]=a.r,H[L+9]=a.g,H[L+10]=a.b,H[L+11]=a.a)}L=c.length;let ne=Ve.setArraySize(c,L+3*(Y-2));Y--;for(let Z=1;Z<Y;Z++,L+=3)ne[L]=p,ne[L+1]=p+Z,ne[L+2]=p+Z+1;p+=Y+1}else{let X=Ve.setArraySize(l,L+3*f);X[L]=y,X[L+1]=b,X[L+2]=r.r,X[L+3]=r.g,X[L+4]=r.b,X[L+5]=r.a,o?(X[L+6]=g,X[L+7]=w,X[L+8]=a.r,X[L+9]=a.g,X[L+10]=a.b,X[L+11]=a.a,X[L+12]=E,X[L+13]=M,X[L+14]=r.r,X[L+15]=r.g,X[L+16]=r.b,X[L+17]=r.a,X[L+18]=_,X[L+19]=I,X[L+20]=a.r,X[L+21]=a.g,X[L+22]=a.b,X[L+23]=a.a,X[L+24]=R,X[L+25]=F,X[L+26]=r.r,X[L+27]=r.g,X[L+28]=r.b,X[L+29]=r.a,X[L+30]=P,X[L+31]=k,X[L+32]=a.r,X[L+33]=a.g,X[L+34]=a.b,X[L+35]=a.a):(X[L+6]=g,X[L+7]=w,X[L+8]=E,X[L+9]=M,X[L+10]=r.r,X[L+11]=r.g,X[L+12]=r.b,X[L+13]=r.a,X[L+14]=_,X[L+15]=I,X[L+16]=R,X[L+17]=F,X[L+18]=r.r,X[L+19]=r.g,X[L+20]=r.b,X[L+21]=r.a,X[L+22]=P,X[L+23]=k),L=c.length;let O=Ve.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],v=s[f],y=s[f+1];f=t[d+1]<<1;let b=e[f],g=e[f+1],w=s[f],E=s[f+1];f=t[d+2]<<1;let M=e[f],_=e[f+1],I=s[f],R=s[f+1];for(let F=0;F<c;F++){let P=a.length;if(this.clip(p,m,b,g,M,_,l[F],r)){let k=r.length;if(k==0)continue;let B=g-_,L=M-b,X=p-M,O=_-m,D=1/(B*X+L*(m-_)),T=k>>1,U=this.clipOutput,N=Ve.setArraySize(a,P+T*2),Y=Ve.setArraySize(o,P+T*2);for(let H=0;H<k;H+=2,P+=2){let ne=U[H],Z=U[H+1];N[P]=ne,N[P+1]=Z;let de=ne-M,me=Z-_,_e=(B*de+L*me)*D,Ae=(O*de+X*me)*D,ge=1-_e-Ae;Y[P]=v*_e+w*Ae+I*ge,Y[P+1]=y*_e+E*Ae+R*ge}P=h.length;let G=Ve.setArraySize(h,P+3*(T-2));T--;for(let H=1;H<T;H++,P+=3)G[P]=u,G[P+1]=u+H,G[P+2]=u+H+1;u+=T+1}else{let k=Ve.setArraySize(a,P+6);k[P]=p,k[P+1]=m,k[P+2]=b,k[P+3]=g,k[P+4]=M,k[P+5]=_;let B=Ve.setArraySize(o,P+6);B[P]=v,B[P+1]=y,B[P+2]=w,B[P+3]=E,B[P+4]=I,B[P+5]=R,P=h.length;let L=Ve.setArraySize(h,P+3);L[P]=u,L[P+1]=u+1,L[P+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],v=f[p+1],y=m-f[p+2],b=v-f[p+3],g=h.length,w=u;for(let M=0,_=u.length-2;M<_;){let I=w[M],R=w[M+1];M+=2;let F=w[M],P=w[M+1],k=b*(m-F)>y*(v-P),B=b*(m-I)-y*(v-R);if(B>0){if(k){h.push(F),h.push(P);continue}let L=F-I,X=P-R,O=B/(L*b-X*y);if(O>=0&&O<=1)h.push(I+L*O),h.push(R+X*O);else{h.push(F),h.push(P);continue}}else if(k){let L=F-I,X=P-R,O=B/(L*b-X*y);if(O>=0&&O<=1)h.push(I+L*O),h.push(R+X*O),h.push(F),h.push(P);else{h.push(F),h.push(P);continue}}c=!0}if(g==h.length)return l.length=0,!0;if(h.push(h[0]),h.push(h[1]),p==d)break;let E=h;h=u,h.length=0,u=E}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 ph=class{constructor(e){x(this,"attachmentLoader");x(this,"scale",1);x(this,"linkedMeshes",new Array);this.attachmentLoader=e}readSkeletonData(e){let t=this.scale,i=new fh,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 Mb(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=Ve.enumValue(hi,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 Pb(i.slots.length,h,l),u=re(o,"color",null);u&&c.color.setFromString(u);let d=re(o,"dark",null);d&&(c.darkColor=St.fromString(d)),c.attachmentName=re(o,"attachment",null),c.blendMode=Ve.enumValue(Rr,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 Cb(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 kb(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 Ib(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=Ve.enumValue(Sn,re(o,"positionMode","Percent")),h.spacingMode=Ve.enumValue(Ai,re(o,"spacingMode","Length")),h.rotateMode=Ve.enumValue(ma,re(o,"rotateMode","Tangent")),h.offsetRotation=re(o,"rotation",0),h.position=re(o,"position",0),h.positionMode==Sn.Fixed&&(h.position*=t),h.spacing=re(o,"spacing",0),(h.spacingMode==Ai.Length||h.spacingMode==Ai.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 Rb(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 em(o.name);if(o.bones)for(let l=0;l<o.bones.length;l++){let c=o.bones[l],u=i.findBone(c);if(!u)throw new Error(`Couldn't find bone ${c} for skin ${o.name}.`);h.bones.push(u)}if(o.ik)for(let l=0;l<o.ik.length;l++){let c=o.ik[l],u=i.findIkConstraint(c);if(!u)throw new Error(`Couldn't find IK constraint ${c} for skin ${o.name}.`);h.constraints.push(u)}if(o.transform)for(let l=0;l<o.transform.length;l++){let c=o.transform[l],u=i.findTransformConstraint(c);if(!u)throw new Error(`Couldn't find transform constraint ${c} for skin ${o.name}.`);h.constraints.push(u)}if(o.path)for(let l=0;l<o.path.length;l++){let c=o.path[l],u=i.findPathConstraint(c);if(!u)throw new Error(`Couldn't find path constraint ${c} for skin ${o.name}.`);h.constraints.push(u)}if(o.physics)for(let l=0;l<o.physics.length;l++){let c=o.physics[l],u=i.findPhysicsConstraint(c);if(!u)throw new Error(`Couldn't find physics constraint ${c} for skin ${o.name}.`);h.constraints.push(u)}for(let l in o.attachments){let c=i.findSlot(l);if(!c)throw new Error(`Couldn't find slot ${l} for skin ${o.name}.`);let u=o.attachments[l];for(let d in u){let f=this.readAttachment(u[d],h,c.index,d,i);f&&h.setAttachment(c.index,d,f)}}i.skins.push(h),h.name=="default"&&(i.defaultSkin=h)}for(let a=0,o=this.linkedMeshes.length;a<o;a++){let h=this.linkedMeshes[a],l=h.skin?i.findSkin(h.skin):i.defaultSkin;if(!l)throw new Error(`Skin not found: ${h.skin}`);let c=l.getAttachment(h.slotIndex,h.parent);if(!c)throw new Error(`Parent mesh not found: ${h.parent}`);h.mesh.timelineAttachment=h.inheritTimeline?c:h.mesh,h.mesh.setParentMesh(c),h.mesh.region!=null&&h.mesh.updateRegion()}if(this.linkedMeshes.length=0,s.events)for(let a in s.events){let o=s.events[a],h=new Ab(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 iR(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=Ve.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 U1(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=Ve.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=Ve.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 Wa(f,c);for(let m=0;m<f;m++){let v=d[m];p.setFrame(m,re(v,"time",0),re(v,"name",null))}r.push(p)}else if(u=="rgba"){let p=new Z1(f,f<<2,c),m=d[0],v=re(m,"time",0),y=St.fromString(m.color);for(let b=0,g=0;;b++){p.setFrame(b,v,y.r,y.g,y.b,y.a);let w=d[b+1];if(!w){p.shrink(g);break}let E=re(w,"time",0),M=St.fromString(w.color),_=m.curve;_&&(g=Bt(_,p,g,b,0,v,E,y.r,M.r,1),g=Bt(_,p,g,b,1,v,E,y.g,M.g,1),g=Bt(_,p,g,b,2,v,E,y.b,M.b,1),g=Bt(_,p,g,b,3,v,E,y.a,M.a,1)),v=E,y=M,m=w}r.push(p)}else if(u=="rgb"){let p=new J1(f,f*3,c),m=d[0],v=re(m,"time",0),y=St.fromString(m.color);for(let b=0,g=0;;b++){p.setFrame(b,v,y.r,y.g,y.b);let w=d[b+1];if(!w){p.shrink(g);break}let E=re(w,"time",0),M=St.fromString(w.color),_=m.curve;_&&(g=Bt(_,p,g,b,0,v,E,y.r,M.r,1),g=Bt(_,p,g,b,1,v,E,y.g,M.g,1),g=Bt(_,p,g,b,2,v,E,y.b,M.b,1)),v=E,y=M,m=w}r.push(p)}else if(u=="alpha")r.push(Fs(d,new Q1(f,f,c),0,1));else if(u=="rgba2"){let p=new eb(f,f*7,c),m=d[0],v=re(m,"time",0),y=St.fromString(m.light),b=St.fromString(m.dark);for(let g=0,w=0;;g++){p.setFrame(g,v,y.r,y.g,y.b,y.a,b.r,b.g,b.b);let E=d[g+1];if(!E){p.shrink(w);break}let M=re(E,"time",0),_=St.fromString(E.light),I=St.fromString(E.dark),R=m.curve;R&&(w=Bt(R,p,w,g,0,v,M,y.r,_.r,1),w=Bt(R,p,w,g,1,v,M,y.g,_.g,1),w=Bt(R,p,w,g,2,v,M,y.b,_.b,1),w=Bt(R,p,w,g,3,v,M,y.a,_.a,1),w=Bt(R,p,w,g,4,v,M,b.r,I.r,1),w=Bt(R,p,w,g,5,v,M,b.g,I.g,1),w=Bt(R,p,w,g,6,v,M,b.b,I.b,1)),v=M,y=_,b=I,m=E}r.push(p)}else if(u=="rgb2"){let p=new tb(f,f*6,c),m=d[0],v=re(m,"time",0),y=St.fromString(m.light),b=St.fromString(m.dark);for(let g=0,w=0;;g++){p.setFrame(g,v,y.r,y.g,y.b,b.r,b.g,b.b);let E=d[g+1];if(!E){p.shrink(w);break}let M=re(E,"time",0),_=St.fromString(E.light),I=St.fromString(E.dark),R=m.curve;R&&(w=Bt(R,p,w,g,0,v,M,y.r,_.r,1),w=Bt(R,p,w,g,1,v,M,y.g,_.g,1),w=Bt(R,p,w,g,2,v,M,y.b,_.b,1),w=Bt(R,p,w,g,3,v,M,b.r,I.r,1),w=Bt(R,p,w,g,4,v,M,b.g,I.g,1),w=Bt(R,p,w,g,5,v,M,b.b,I.b,1)),v=M,y=_,b=I,m=E}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(Fs(d,new dh(f,f,c),0,1));else if(u==="translate"){let p=new Y1(f,f<<1,c);r.push(qd(d,p,"x","y",0,s))}else if(u==="translatex"){let p=new V1(f,f,c);r.push(Fs(d,p,0,s))}else if(u==="translatey"){let p=new $1(f,f,c);r.push(Fs(d,p,0,s))}else if(u==="scale"){let p=new G1(f,f<<1,c);r.push(qd(d,p,"x","y",1,1))}else if(u==="scalex"){let p=new j1(f,f,c);r.push(Fs(d,p,1,1))}else if(u==="scaley"){let p=new H1(f,f,c);r.push(Fs(d,p,1,1))}else if(u==="shear"){let p=new W1(f,f<<1,c);r.push(qd(d,p,"x","y",0,1))}else if(u==="shearx"){let p=new z1(f,f,c);r.push(Fs(d,p,0,1))}else if(u==="sheary"){let p=new q1(f,f,c);r.push(Fs(d,p,0,1))}else if(u==="inherit"){let p=new K1(f,l.index);for(let m=0;m<d.length;m++){let v=d[m];p.setFrame(m,re(v,"time",0),Ve.enumValue(hi,re(v,"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 sb(h.length,h.length<<1,u),f=re(l,"time",0),p=re(l,"mix",1),m=re(l,"softness",0)*s;for(let v=0,y=0;;v++){d.setFrame(v,f,p,m,re(l,"bendPositive",!0)?1:-1,re(l,"compress",!1),re(l,"stretch",!1));let b=h[v+1];if(!b){d.shrink(y);break}let g=re(b,"time",0),w=re(b,"mix",1),E=re(b,"softness",0)*s,M=l.curve;M&&(y=Bt(M,d,y,v,0,f,g,p,w,1),y=Bt(M,d,y,v,1,f,g,m,E,s)),f=g,p=w,m=E,l=b}r.push(d)}if(e.transform)for(let o in e.transform){let h=e.transform[o],l=h[0];if(!l)continue;let c=i.findTransformConstraint(o);if(!c)throw new Error("Transform constraint not found: "+o);let u=i.transformConstraints.indexOf(c),d=new nb(h.length,h.length*6,u),f=re(l,"time",0),p=re(l,"mixRotate",1),m=re(l,"mixX",1),v=re(l,"mixY",m),y=re(l,"mixScaleX",1),b=re(l,"mixScaleY",y),g=re(l,"mixShearY",1);for(let w=0,E=0;;w++){d.setFrame(w,f,p,m,v,y,b,g);let M=h[w+1];if(!M){d.shrink(E);break}let _=re(M,"time",0),I=re(M,"mixRotate",1),R=re(M,"mixX",1),F=re(M,"mixY",R),P=re(M,"mixScaleX",1),k=re(M,"mixScaleY",P),B=re(M,"mixShearY",1),L=l.curve;L&&(E=Bt(L,d,E,w,0,f,_,p,I,1),E=Bt(L,d,E,w,1,f,_,m,R,1),E=Bt(L,d,E,w,2,f,_,v,F,1),E=Bt(L,d,E,w,3,f,_,y,P,1),E=Bt(L,d,E,w,4,f,_,b,k,1),E=Bt(L,d,E,w,5,f,_,g,B,1)),f=_,p=I,m=R,v=F,y=P,b=k,y=P,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 rb(p,p,c);r.push(Fs(d,m,0,l.positionMode==Sn.Fixed?s:1))}else if(u==="spacing"){let m=new ab(p,p,c);r.push(Fs(d,m,0,l.spacingMode==Ai.Length||l.spacingMode==Ai.Fixed?s:1))}else if(u==="mix"){let m=new ob(p,p*3,c),v=re(f,"time",0),y=re(f,"mixRotate",1),b=re(f,"mixX",1),g=re(f,"mixY",b);for(let w=0,E=0;;w++){m.setFrame(w,v,y,b,g);let M=d[w+1];if(!M){m.shrink(E);break}let _=re(M,"time",0),I=re(M,"mixRotate",1),R=re(M,"mixX",1),F=re(M,"mixY",R),P=f.curve;P&&(E=Bt(P,m,E,w,0,v,_,y,I,1),E=Bt(P,m,E,w,1,v,_,b,R,1),E=Bt(P,m,E,w,2,v,_,g,F,1)),v=_,y=I,b=R,g=F,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 pb(f,l);for(let v=0;d!=null;d=u[v+1],v++)m.setFrame(v,re(d,"time",0));r.push(m);continue}let p;if(c=="inertia")p=new lb(f,f,l);else if(c=="strength")p=new cb(f,f,l);else if(c=="damping")p=new hb(f,f,l);else if(c=="mass")p=new ub(f,f,l);else if(c=="wind")p=new db(f,f,l);else if(c=="gravity")p=new fb(f,f,l);else if(c=="mix")p=new mb(f,f,l);else continue;r.push(Fs(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],v=l.getAttachment(f,p);for(let y in m){let b=m[y],g=b[0];if(g){if(y=="deform"){let w=v.bones,E=v.vertices,M=w?E.length/3*2:E.length,_=new ib(b.length,b.length,f,v),I=re(g,"time",0);for(let R=0,F=0;;R++){let P,k=re(g,"vertices",null);if(!k)P=w?Ve.newFloatArray(M):E;else{P=Ve.newFloatArray(M);let O=re(g,"offset",0);if(Ve.arrayCopy(k,0,P,O,k.length),s!=1)for(let D=O,T=D+k.length;D<T;D++)P[D]*=s;if(!w)for(let D=0;D<M;D++)P[D]+=E[D]}_.setFrame(R,I,P);let B=b[R+1];if(!B){_.shrink(F);break}let L=re(B,"time",0),X=g.curve;X&&(F=Bt(X,_,F,R,0,I,L,0,1,1)),I=L,g=B}r.push(_)}else if(y=="sequence"){let w=new gb(b.length,f,v),E=0;for(let M=0;M<b.length;M++){let _=re(g,"delay",E),I=re(g,"time",0),R=Ni[re(g,"mode","hold")],F=re(g,"index",0);w.setFrame(M,I,R,F,_),E=_,g=b[M+1]}r.push(w)}}}}}}if(e.drawOrder){let o=new sl(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=Ve.newArray(h,-1);let p=Ve.newArray(h-f.length,0),m=0,v=0;for(let y=0;y<f.length;y++){let b=f[y],g=i.findSlot(b.slot);if(!g)throw new Error("Slot not found: "+g);let w=g.index;for(;m!=w;)p[v++]=m++;d[m+b.offset]=m++}for(;m<h;)p[v++]=m++;for(let y=h-1;y>=0;y--)d[y]==-1&&(d[y]=p[--v])}o.setFrame(l,re(u,"time",0),d)}r.push(o)}if(e.events){let o=new rp(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 Eb(Ve.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 sp(t,r,a))}},iR=class{constructor(e,t,i,s,r){x(this,"parent");x(this,"skin");x(this,"slotIndex");x(this,"mesh");x(this,"inheritTimeline");this.mesh=e,this.skin=t,this.slotIndex=i,this.parent=s,this.inheritTimeline=r}};function Fs(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=Bt(s.curve,e,o,h,0,r,c,a,u,i)),r=c,a=u,s=l}}function qd(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,v=a.curve;v&&(c=Bt(v,e,c,u,0,o,f,h,p,r),c=Bt(v,e,c,u,1,o,f,l,m,r)),o=f,h=p,l=m,a=d}}function Bt(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 Un=class Un extends mI{constructor(t){super(t.resource.source);x(this,"texture");this.texture=ht.from(t)}static from(t){return Un.textureMap.has(t)?Un.textureMap.get(t):new Un(t)}setFilters(t,i){this.texture.baseTexture.scaleMode=Un.toPixiTextureFilter(t),this.texture.baseTexture.mipmap=Un.toPixiMipMap(t)}setWraps(t,i){this.texture.baseTexture.wrapMode=Un.toPixiTextureWrap(t)}dispose(){this.texture.destroy()}static toPixiTextureFilter(t){switch(t){case Pi.Nearest:case Pi.MipMapNearestLinear:case Pi.MipMapNearestNearest:return Us.NEAREST;case Pi.Linear:case Pi.MipMapLinearLinear:case Pi.MipMapLinearNearest:return Us.LINEAR;default:throw new Error(`Unknown texture filter: ${String(t)}`)}}static toPixiMipMap(t){switch(t){case Pi.Nearest:case Pi.Linear:return Cs.OFF;case Pi.MipMapNearestLinear:case Pi.MipMapNearestNearest:case Pi.MipMapLinearLinear:case Pi.MipMapLinearNearest:return Cs.ON;default:throw new Error(`Unknown texture filter: ${String(t)}`)}}static toPixiTextureWrap(t){switch(t){case er.ClampToEdge:return Vs.CLAMP;case er.MirroredRepeat:return Vs.MIRRORED_REPEAT;case er.Repeat:return Vs.REPEAT;default:throw new Error(`Unknown texture wrap: ${String(t)}`)}}static toPixiBlending(t){switch(t){case Rr.Normal:return ct.NORMAL;case Rr.Additive:return ct.ADD;case Rr.Multiply:return ct.MULTIPLY;case Rr.Screen:return ct.SCREEN;default:throw new Error(`Unknown blendMode: ${String(t)}`)}}};x(Un,"textureMap",new Map);let ba=Un;const Xn=class Xn extends bl{constructor(){const t=new ep;t.getBuffer("aVertexPosition").static=!1,t.getBuffer("aTextureCoord").static=!1;const i=new oh(ht.EMPTY);super(t,i);x(this,"name","");x(this,"warnedTwoTint",!1)}updateFromSpineData(t,i,s,r,a,o,h,l){var y,b;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");((b=d.data)==null?void 0:b.length)!==c&&(d.data=new Float32Array(c));let f=0,p=u.data,m=d.data;for(let g=0;g<a;g+=l?12:8){let w=g;m[f]=r[w++],m[f+1]=r[w++],w+=4,p[f]=r[w++],p[f+1]=r[w++],f+=2}l&&!this.warnedTwoTint&&(console.warn("DarkTint is not enabled by default. To enable use a DarkSlotMesh factory while creating the Spine object."),this.warnedTwoTint=!0),Xn.auxColor[0]=r[2],Xn.auxColor[1]=r[3],Xn.auxColor[2]=r[4],Xn.auxColor[3]=r[5],this.tint=Xn.auxColor,this.alpha=Xn.auxColor[3],this.blendMode=ba.toPixiBlending(i);const v=this.geometry.indexBuffer;if(v.data.length!==o.length)v.data=new Uint32Array(o);else{const g=v.data;for(let w=0;w<h;w++)g[w]=o[w]}this.name=s,u.update(),d.update(),v.update()}};x(Xn,"auxColor",[0,0,0,0]);let im=Xn;class sR extends Mn{constructor(e=!1){super();const t=new si(void 0),i=new si(void 0,!0),s=new si(void 0,!0,!0);this.addAttribute("aVertexPosition",t,2,!1,Qe.FLOAT),this.addAttribute("aTextureCoord",i,2,!1,Qe.FLOAT),this.addIndex(s)}}const nR=`
|
||
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;
|
||
}
|
||
`,rR=`
|
||
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 aR extends js{constructor(t){const i={uSampler:t??ht.EMPTY,alpha:1,uTextureMatrix:ri.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(yn.from(nR,rR),i);x(this,"uvMatrix");x(this,"batchable");x(this,"pluginName");x(this,"_tintRGB");x(this,"_darkTintRGB");x(this,"_colorDirty");x(this,"_alpha");x(this,"_tintColor");x(this,"_darkTintColor");this._colorDirty=!1,this.uvMatrix=new zm(i.uSampler),this.batchable=!0,this.pluginName=s.pluginName,this._tintColor=new Yt(s.tint),this._darkTintColor=new Yt(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,Yt.shared.setValue(this._tintColor).premultiply(this._alpha,!0).toArray(this.uniforms.uColor),Yt.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 oR extends bl{constructor(t){super(new sR,new aR(t),void 0,void 0);x(this,"_darkTintRGB",0)}get darkTint(){return"darkTint"in this.shader?this.shader.darkTint:null}set darkTint(t){this.shader.darkTint=t}get darkTintValue(){return this.shader.darkTintValue}_renderToBatch(t){const i=this.geometry,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 _i=class _i extends oR{constructor(){super();x(this,"name","")}updateFromSpineData(t,i,s,r,a,o,h,l){var y,b;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");((b=d.data)==null?void 0:b.length)!==c&&(d.data=new Float32Array(c));let f=0,p=u.data,m=d.data;for(let g=0;g<a;g+=l?12:8){let w=g;m[f]=r[w++],m[f+1]=r[w++],w+=4,p[f]=r[w++],p[f+1]=r[w++],f+=2}l?(_i.auxColor[0]=r[8],_i.auxColor[1]=r[9],_i.auxColor[2]=r[10],_i.auxColor[3]=r[11],this.darkTint=_i.auxColor,_i.auxColor[0]=r[2],_i.auxColor[1]=r[3],_i.auxColor[2]=r[4],_i.auxColor[3]=r[5],this.tint=_i.auxColor):(_i.auxColor[0]=r[2],_i.auxColor[1]=r[3],_i.auxColor[2]=r[4],_i.auxColor[3]=r[5],this.tint=_i.auxColor),this.blendMode=ba.toPixiBlending(i),this.alpha=_i.auxColor[3];const v=this.geometry.indexBuffer;if(v.data.length!==o.length)v.data=new Uint32Array(o);else{const g=v.data;for(let w=0;w<h;w++)g[w]=o[w]}this.name=s,u.update(),d.update(),v.update()}};x(_i,"auxColor",[0,0,0,0]);let nl=_i;const Nt=class Nt extends Vi{constructor(t,i){if(t instanceof fh)t={...i,skeletonData:t};else if(i)throw new Error("You cannot use options and oldOptions together.");super();x(this,"skeleton");x(this,"state");x(this,"darkTint",!1);x(this,"hasNeverUpdated",!0);x(this,"_debug");x(this,"slotMeshFactory",()=>new im);x(this,"beforeUpdateWorldTransforms",()=>{});x(this,"afterUpdateWorldTransforms",()=>{});x(this,"_autoUpdate",!1);x(this,"_ticker",is.shared);x(this,"meshesCache",new Map);x(this,"lightColor",new St);x(this,"darkColor",new St);x(this,"_boundsProvider");x(this,"_boundsPoint",new Dt);x(this,"_boundsSpineID",-1);x(this,"_boundsSpineDirty",!0);x(this,"slotsObject",new Map);x(this,"verticesCache",Ve.newFloatArray(1024));x(this,"clippingSlotToPixiMasks",{});x(this,"currentClippingSlot");const s=t instanceof fh?t:t.skeletonData;this.skeleton=new ap(s);const r=new fI(s);this.state=new lI(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 nl)):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??is.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 nl&&(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 nl,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(Tr.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 oo){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=fv.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 oo)||!c.maskComputed)&&c.mask&&(this.removeChild(c.mask),fv.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=Nt.clipper.isClipping()?2:f?Nt.DARK_VERTEX_SIZE:Nt.VERTEX_SIZE;if(!c.bone.active){Nt.clipper.clipEndWithSlot(c);continue}const m=c.getAttachment();let v,y,b=0;if(m instanceof iu){const g=m;v=g.color,b=p*4,g.computeWorldVertices(c,this.verticesCache,0,p),t=Nt.QUAD_TRIANGLES,i=g.uvs,y=(r=g.region)==null?void 0:r.texture}else if(m instanceof Ol){const g=m;v=g.color,b=(g.worldVerticesLength>>1)*p,b>this.verticesCache.length&&(this.verticesCache=Ve.newFloatArray(b)),g.computeWorldVertices(c,0,g.worldVerticesLength,this.verticesCache,0,p),t=g.triangles,i=g.uvs,y=(a=g.region)==null?void 0:a.texture}else if(m instanceof oo){Nt.clipper.clipStart(c,m);continue}else{this.hasMeshForSlot(c)&&(this.getMeshForSlot(c).visible=!1),Nt.clipper.clipEndWithSlot(c);continue}if(y!=null){const w=c.bone.skeleton.color,E=c.color,M=w.a*E.a*v.a;this.lightColor.set(w.r*E.r*v.r,w.g*E.g*v.g,w.b*E.b*v.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 _,I,R,F;if(Nt.clipper.isClipping())Nt.clipper.clipTriangles(this.verticesCache,t,t.length,i,this.lightColor,this.darkColor,f),_=Nt.clipper.clippedVertices,I=_.length,R=Nt.clipper.clippedTriangles,F=R.length;else{const k=this.verticesCache;for(let B=2,L=0,X=b;B<X;B+=p,L+=2){let O=B;k[O++]=this.lightColor.r,k[O++]=this.lightColor.g,k[O++]=this.lightColor.b,k[O++]=this.lightColor.a,k[O++]=i[L],k[O++]=i[L+1],f&&(k[O++]=this.darkColor.r,k[O++]=this.darkColor.g,k[O++]=this.darkColor.b,k[O++]=this.darkColor.a)}_=this.verticesCache,I=b,R=t,F=t.length}if(I==0||F==0){Nt.clipper.clipEndWithSlot(c);continue}const P=this.getMeshForSlot(c);P.renderable=!0,P.zIndex=d,P.updateFromSpineData(y,c.data.blendMode,c.data.name,_,I,R,F,f)}Nt.clipper.clipEndWithSlot(c)}Nt.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 xl);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(Nt.vectorAux.set(i.x,i.y),t.parent){const r=t.parent.worldToLocal(Nt.vectorAux);t.x=r.x,t.y=r.y}else t.x=Nt.vectorAux.x,t.y=Nt.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 Nt.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=Nt.skeletonCache[d];if(!f){const p=xn.get(r),m=xn.get(a),v=new Qf(m);let y=p instanceof Uint8Array?new tm(v):new ph(v);y.scale=o,f=y.readSkeletonData(p),Nt.skeletonCache[d]=f}return new Nt({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=Nt.skeletonCache[r];if(a)return new Nt(a,s);const o=xn.get(t),h=xn.get(i),l=new Qf(h);let c=o instanceof Uint8Array?new tm(l):new ph(l);return c.scale=(s==null?void 0:s.scale)??1,a=c.readSkeletonData(o),Nt.skeletonCache[r]=a,new this(a,s)}get tint(){return this.skeleton.color.toRgb888()}set tint(t){St.rgb888ToColor(this.skeleton.color,t)}};x(Nt,"vectorAux",new uh),x(Nt,"clipper",new mh),x(Nt,"QUAD_TRIANGLES",[0,1,2,2,3,0]),x(Nt,"VERTEX_SIZE",8),x(Nt,"DARK_VERTEX_SIZE",12),x(Nt,"skeletonCache",Object.create(null));let gh=Nt;const fv=new hh(()=>new ls);ap.yDown=!0;const gc="spineTextureAtlasLoader",lR={extension:$e.Asset,resolver:{test:n=>hs(n,".atlas"),parse:n=>{var t,i;const e=n.split(".");return{resolution:parseFloat(((i=(t=ze.RETINA_PREFIX)==null?void 0:t.exec(n))==null?void 0:i[1])??"1"),format:e[e.length-2],src:n}}},loader:{name:gc,extension:{type:$e.LoadParser,priority:xs.Normal,name:gc},test(n){return hs(n,".atlas")},async load(n){const e=await ze.ADAPTER.fetch(n);if(!e.ok)throw new Error(`[${gc}] Failed to fetch ${n}: ${e.status} ${e.statusText}`);return await e.text()},testParse(n,e){const t=hs(e.src,".atlas"),i=typeof n=="string",s=e.loadParser===gc;return Promise.resolve((t||s)&&i)},unload(n){n.dispose()},async parse(n,e,t){var h;const i=e.data||{};let s=pi.dirname(e.src);s&&s.lastIndexOf("/")!==s.length-1&&(s+="/");const r=new bb(n);if(i.images instanceof mt||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}xn.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 mt)l.setTexture(ba.from(u));else{const d=u??pi.normalize([...s.split(pi.sep),c].join(pi.sep)),f={src:ih(d,e.src),data:{...i.imageMetadata,alphaMode:l.pma?Fi.PMA:Fi.UNPACK}},p=t.load(f).then(m=>{l.setTexture(ba.from(m.baseTexture))});a.push(p)}}return await Promise.all(a),xn.setPreferences({preferCreateImageBitmap:o}),r}}};et.add(lR);const vc="spineSkeletonLoader";function cR(n){return n.hasOwnProperty("bones")}function hR(n){return n instanceof Uint8Array}const uR={extension:$e.Asset,loader:{name:vc,extension:{type:$e.LoadParser,priority:xs.Normal,name:vc},test(n){return hs(n,".skel")},async load(n){const e=await ze.ADAPTER.fetch(n);if(!e.ok)throw new Error(`[${vc}] Failed to fetch ${n}: ${e.status} ${e.statusText}`);return new Uint8Array(await e.arrayBuffer())},testParse(n,e){const t=hs(e.src,".json")&&cR(n),i=hs(e.src,".skel")&&hR(n),s=e.loadParser===vc;return Promise.resolve(t||i||s)}}};et.add(uR);class dR extends Mn{constructor(t=!1){super();x(this,"_buffer");x(this,"_indexBuffer");this._buffer=new si(void 0,t,!1),this._indexBuffer=new si(void 0,t,!0),this.addAttribute("aVertexPosition",this._buffer,2,!1,Qe.FLOAT).addAttribute("aTextureCoord",this._buffer,2,!1,Qe.FLOAT).addAttribute("aColor",this._buffer,4,!0,Qe.UNSIGNED_BYTE).addAttribute("aDarkColor",this._buffer,4,!0,Qe.UNSIGNED_BYTE).addAttribute("aTextureId",this._buffer,1,!0,Qe.FLOAT).addIndex(this._indexBuffer)}}const fR=`
|
||
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;
|
||
|
||
}
|
||
`,mR=`
|
||
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 Fb extends vr{constructor(e){super(e),this.shaderGenerator=new Mx(fR,mR),this.geometryClass=dR,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=Yt.shared.setValue(e._tintRGB).toPremultiplied(f,!0),m=Yt.shared.setValue(e._darkTintRGB).premultiply(f,!0).toPremultiplied(1,!1);for(let v=0;v<u.length;v+=2)o[s++]=u[v],o[s++]=u[v+1],o[s++]=l[v],o[s++]=l[v+1],a[s++]=p,a[s++]=m,o[s++]=d;for(let v=0;v<c.length;v++)i[r++]=h+c[v]}}x(Fb,"extension",{name:"darkTintBatch",type:$e.RendererPlugin});et.add(Fb);function pR(n){return n.replace(/\\/g,"/").split("/").pop()||n}function op(n,e,t){for(const i of n.pages){const s=e.get(pR(i.name).toLowerCase());if(!s)throw new Error(`Atlas 引用的纹理未选择:${i.name}`);s.baseTexture.alphaMode=i.pma?Fi.PMA:Fi.UNPACK,i.setTexture(t.from(s.baseTexture))}}function Ob(n,e){const t=new bb(n);return op(t,e,ba),new Qf(t)}function gR(n,e,t){return{skeletonData:new ph(Ob(e,t)).readSkeletonData(n),SpineClass:gh}}function vR(n,e,t){return{skeletonData:new tm(Ob(e,t)).readSkeletonData(n),SpineClass:gh}}const yR="modulepreload",xR=function(n){return"/"+n},mv={},pv=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=xR(l),l in mv)return;mv[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":yR,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 Bb(){const[n,e]=await Promise.all([pv(()=>import("./index-DQa0oOKH.js"),[]),pv(()=>import("./index-dmMh3N7z.js"),__vite__mapDeps([0,1]))]);return{core:n,pixi:e}}async function bR(n,e,t){const{core:i,pixi:s}=await Bb(),r=new i.TextureAtlas(e);return op(r,t,s.SpineTexture),{skeletonData:new i.SkeletonJson(new i.AtlasAttachmentLoader(r)).readSkeletonData(n),SpineClass:s.Spine}}async function wR(n,e,t){const{core:i,pixi:s}=await Bb(),r=new i.TextureAtlas(e);return op(r,t,s.SpineTexture),{skeletonData:new i.SkeletonBinary(new i.AtlasAttachmentLoader(r)).readSkeletonData(n),SpineClass:s.Spine}}function Mr(n,e,t){const i=Number(n[e]);return Number.isFinite(i)?i:t}function cs(n,e,t,i){n[e]==null&&(n[e]=Mr(n,t,i))}function lp(n,e,t){if(typeof n.curve!="number")return;const i=Mr(n,"time",0),r=Mr(e,"time",0)-i,a=n.curve,o=Mr(n,"c2",0),h=Mr(n,"c3",1),l=Mr(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 Pr(n,e){if(Array.isArray(n))for(let t=0;t<n.length-1;t++){const i=n[t],s=n[t+1];lp(i,s,e.map(({key:r,fallback:a})=>[Mr(i,r,a),Mr(s,r,a)]))}}function SR(n){if(Array.isArray(n))for(let e=0;e<n.length-1;e++)lp(n[e],n[e+1],[[0,1]])}function La(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 gv(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?[...La(i.light,!0),...La(i.dark,!1)]:La(i.color,!0),a=e?[...La(s.light,!0),...La(s.dark,!1)]:La(s.color,!0);lp(i,s,r.map((o,h)=>[o,a[h]]))}}function _R(n){for(const e of n.bones||[])e.inherit==null&&e.transform!=null&&(e.inherit=e.transform);for(const e of n.transform||[])cs(e,"mixRotate","rotateMix",1),cs(e,"mixX","translateMix",1),e.mixY==null&&(e.mixY=e.mixX),cs(e,"mixScaleX","scaleMix",1),e.mixScaleY==null&&(e.mixScaleY=e.mixScaleX),cs(e,"mixShearY","shearMix",1);for(const e of n.path||[])cs(e,"mixRotate","rotateMix",1),cs(e,"mixX","translateMix",1),e.mixY==null&&(e.mixY=e.mixX)}function TR(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 MR(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),gv(e.rgba,!1),gv(e.rgba2,!0)}function ER(n){for(const e of Object.values(n.bones||{})){for(const t of e.rotate||[])cs(t,"value","angle",0);Pr(e.rotate,[{key:"value",fallback:0}]),Pr(e.translate,[{key:"x",fallback:0},{key:"y",fallback:0}]),Pr(e.scale,[{key:"x",fallback:1},{key:"y",fallback:1}]),Pr(e.shear,[{key:"x",fallback:0},{key:"y",fallback:0}])}}function AR(n){for(const e of Object.values(n.ik||{}))Pr(e,[{key:"mix",fallback:1},{key:"softness",fallback:0}])}function CR(n){for(const e of Object.values(n.transform||{})){for(const t of e)cs(t,"mixRotate","rotateMix",1),cs(t,"mixX","translateMix",1),t.mixY==null&&(t.mixY=t.mixX),cs(t,"mixScaleX","scaleMix",1),t.mixScaleY==null&&(t.mixScaleY=t.mixScaleX),cs(t,"mixShearY","shearMix",1);Pr(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 IR(n){for(const e of Object.values(n.path||{})){for(const i of["position","spacing"]){const s=e[i];for(const r of s||[])cs(r,"value",i,0);Pr(s,[{key:"value",fallback:0}])}const t=e.mix;for(const i of t||[])cs(i,"mixRotate","rotateMix",1),cs(i,"mixX","translateMix",1),i.mixY==null&&(i.mixY=i.mixX);Pr(t,[{key:"mixRotate",fallback:1},{key:"mixX",fallback:1},{key:"mixY",fallback:1}])}}function RR(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,SR(l)}}}delete n.deform}function Lb(n){_R(n),TR(n);for(const e of Object.values(n.animations||{}))MR(e),ER(e),AR(e),CR(e),IR(e),RR(e),!e.drawOrder&&e.draworder&&(e.drawOrder=e.draworder);return n}function PR(n){return n.replace(/\\/g,"/").split("/").pop()||n}async function kR(n){const e=await Promise.all(n.map(async t=>{const i=URL.createObjectURL(t);try{return[PR(t.name).toLowerCase(),await ht.fromURL(i)]}finally{URL.revokeObjectURL(i)}}));return new Map(e)}function FR(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 Db(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 kR(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 wR(u,i,s)),c="4.3"}catch(d){try{({skeletonData:o,SpineClass:h}=vR(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=ch(o.version)}else{let u;try{u=JSON.parse(await n.text())}catch{throw new Error("Spine JSON 文件格式无效")}if(l=ch((a=u==null?void 0:u.skeleton)==null?void 0:a.spine),!l)throw new Error(`Spine JSON 版本不受支持,仅支持 ${Kf()}`);c=q2(l),l==="3.8"&&Lb(u);const d=c==="4.3"?await bR(u,i,s):gR(u,i,s);o=d.skeletonData,h=d.SpineClass}if(!l)throw new Error(`Spine 数据版本不受支持,仅支持 ${Kf()}`);return{skeletonData:o,textures:r,runtimeVersion:c,SpineClass:h,dataVersion:l,animations:o.animations.map(u=>({name:u.name,duration:u.duration})),bones:FR(o)}}catch(o){for(const h of r)h.destroy(!0);throw o}}function Oc(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 OR(n,e,t){return{skeleton:{name:n.name,dataUrl:await Oc(n)},atlas:{name:e.name,dataUrl:await Oc(e)},textures:await Promise.all(t.map(async i=>({name:i.name,dataUrl:await Oc(i)})))}}async function Kd(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 BR(n){return{skeleton:await Kd(n.skeleton),atlas:await Kd(n.atlas),textures:await Promise.all(n.textures.map(Kd))}}const Nb="SpineParticle.EditorConfig",Ub=1;function Xb(n){return{backgroundX:n.backgroundX,backgroundY:n.backgroundY,backgroundOpacity:n.backgroundOpacity,backgroundImageName:n.backgroundImageName,backgroundImageData:n.backgroundImageData,showGrid:n.showGrid,exportSettings:ni(n.exportSettings)}}function LR(n){return JSON.parse(JSON.stringify(n,(e,t)=>{if(!(e==="texture"||e==="trailTexture"||e==="frames"))return t}))}function DR(n){const e=Xb(n.settings);return LR({format:Nb,version:Ub,savedAt:new Date().toISOString(),editor:ni(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=>({...ni(t),frames:void 0})),colliders:ni(n.colliders),paths:ni(n.paths),spines:ni(n.spines)}})}function NR(){return`SpineParticle-${new Date().toISOString().replace(/[-:]/g,"").replace(/\.\d{3}Z$/,"").replace("T","-")}.json`}function Yb(n){const e=DR(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=NR(),document.body.appendChild(s),s.click(),s.remove(),setTimeout(()=>URL.revokeObjectURL(i),0),e}function Vb(n){let e;try{e=JSON.parse(n)}catch{throw new Error("配置文件不是有效的 JSON")}const t=e;if(t.format!==Nb)throw new Error("不是 SpineParticle 编辑器配置文件");if(t.version!==Ub)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 UR(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=ht.fromURL(r).then(o=>Er(o)),e.set(r,a)),a},i=await t("/images/star.png");await Promise.all(n.map(async s=>{var a;const r=ya(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 XR(n){const e=new Map;try{for(const t of n){if(!t.sourceBundle)continue;const i=await BR(t.sourceBundle);e.set(t.id,await Db(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 YR(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 VR(n,e){var c,u,d,f,p,m,v;const t=Vb(JSON.stringify(e)),i=ni(t.scene.systems),s=ni(t.scene.colliders),r=ni(t.scene.paths),a=ni(t.scene.spines);for(const y of a)y.sourceBundle==null&&(y.sourceBundle=null),y.dataVersion==null&&(y.dataVersion="");await UR(i);const o=await XR(a),h=new Map(n.spines.map(y=>[y.id,y.assetVersion]));for(const y of n.spines)kl(y.id);n.systems=i,n.colliders=s,n.paths=r,n.spines=a,Object.assign(n.editor,ni(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=k1((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 b=o.get(y.id);if(y.assetVersion=Math.max(Number(y.assetVersion)||0,h.get(y.id)||0)+1,!b){y.status="empty",y.error=y.skeletonFileName?"配置未包含可复用的 Spine 原始资源":"",y.animations=[],y.bones=[],y.selectedAnimation="";continue}tu(y.id,b),y.dataVersion=b.dataVersion,y.animations=b.animations,y.bones=b.bones,b.animations.some(g=>g.name===y.selectedAnimation)||(y.selectedAnimation=((p=b.animations[0])==null?void 0:p.name)||""),y.status="ready",y.error=""}n.syncSceneSequences(),YR(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((v=t.timeline)==null?void 0:v.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 $b(n,e){return VR(n,Vb(e))}async function $R(n,e){if(!/\.json$/i.test(e.name))throw new Error("请选择 .json 配置文件");return $b(n,await e.text())}const nu=wo({undoCount:0});let vh=null,Wn=null,kr=[],No=null,zn=null,yh=!1;function cp(n){return{systems:n.systems.map(t=>{const i=ni(t);return i.frames=void 0,i}),colliders:ni(n.colliders),paths:ni(n.paths),spines:ni(n.spines),animations:[...n.timeline.animations],settings:Xb(n.settings)}}function hp(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 Gb(n,e=cp(n),t=hp(e)){const i=new Map;for(const s of e.spines){const r=W2(s.id);r&&i.set(s.id,r)}return{data:e,signature:t,spineAssets:i}}function xh(n){if(n){for(const e of n.spineAssets.values())j2(e);n.spineAssets.clear()}}function jb(n){for(;kr.length>n;)xh(kr.shift()||null);nu.undoCount=kr.length}function Hb(){const n=vh;if(!n||!Wn||yh)return;const e=cp(n),t=hp(e);t!==Wn.signature&&(kr.push(Wn),Wn=Gb(n,e,t),jb(n.settings.undoLimit))}function GR(){yh||(zn&&clearTimeout(zn),zn=setTimeout(()=>{zn=null,Hb()},250))}function jR(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 HR(n){var t,i;if(!jR(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 WR(n,e){const t=Wn;yh=!0;try{for(const i of n.spines)kl(i.id);n.systems=ni(e.data.systems),n.colliders=ni(e.data.colliders),n.paths=ni(e.data.paths),n.spines=ni(e.data.spines),n.timeline.animations=[...e.data.animations],Object.assign(n.settings,ni(e.data.settings));for(const[i,s]of e.spineAssets)tu(i,s);for(const i of n.systems)i.frames=[];n.timeline.recorded=!1,n.timeline.playing=!1,HR(n),n.recalcTotalFrames(),Wn=e}finally{yh=!1,xh(t)}}function zR(n){if(!(vh===n&&No)){No==null||No(),zn&&clearTimeout(zn),xh(Wn);for(const e of kr)xh(e);kr=[],vh=n,Wn=Gb(n),nu.undoCount=0,No=vs(()=>hp(cp(n)),GR,{flush:"post"})}}function qR(n,e){const t=Math.min(200,Math.max(1,Math.round(Number(e)||20)));n.settings.undoLimit=t,jb(t)}function Zd(){const n=vh;if(!n||!Wn)return!1;zn&&(clearTimeout(zn),zn=null),Hb();const e=kr.pop();return e?(WR(n,e),nu.undoCount=kr.length,!0):!1}function KR(n){const e=n instanceof HTMLElement?n:null;return!!(e!=null&&e.closest('input, textarea, select, [contenteditable="true"]'))}function ZR(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||KR(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]))}So(()=>{document.addEventListener("pointerdown",e,!0),window.addEventListener("keydown",t,!0)}),Al(()=>{document.removeEventListener("pointerdown",e,!0),window.removeEventListener("keydown",t,!0)})}const JR={class:"stage-wrap"},QR={class:"topbar"},eP=["disabled"],tP={class:"tool-group"},iP={class:"tool-group"},sP={key:0,class:"background-panel"},nP=["disabled"],rP=["title"],aP={class:"background-position-row"},oP={class:"background-opacity-row"},lP={class:"zoom-pct"},cP={key:0,class:"settings-panel"},hP={class:"sp-head"},uP={class:"sp-switch-row"},dP={class:"sp-switch-control"},fP={class:"sp-row"},mP={class:"sp-chk"},pP={class:"sp-chk"},gP={class:"sp-row"},vP={class:"sp-row"},yP={class:"sp-chk"},xP={class:"sp-chk"},bP={class:"sp-row"},wP={class:"sp-row"},SP={class:"sp-row"},_P={class:"sp-hex"},TP={class:"sp-chk"},MP={class:"help-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"help-title"},EP={class:"help-head"},AP={key:2,class:"hud"},CP={class:"hud-number hud-system-count"},IP={class:"hud-number hud-particle-count"},RP=En({__name:"Stage",setup(n){const e=Fl(),t=lt(null),i=lt(null),s=lt(!1),r=lt(!1),a=lt(!1),o=lt(null),h=ft(()=>e.settings.backgroundImageName),l=lt(""),c=lt(!1);function u(z){l.value=l.value===z?"":z}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))}ZR({canvasElement:t,canvasFocused:c,undo:Zd,save:()=>Yb(e),togglePlay:()=>e.togglePlay(),toStart:()=>e.toStart(),setTool:z=>{l.value=z}});let f=null,p=null,m=null,v=null,y=0,b=null,g=null,w=null,E=null,M=null,_=null,I=null,R=null,F=null,P=null,k=null,B=null,L=[],X=0,O=0,D=0,T=0,U=null,N=null;const Y=new Map,G=new Map;let H=[];const ne=new Map,Z=new Set;let de=!1;vs(()=>[e.activeObjectType,e.activeObjectId],()=>Z.clear());async function me(){if(U&&N)return U;const[z,V]=await Promise.all([ht.fromURL("/images/star.png"),ht.fromURL("/images/trail.png")]);return U=z,N=V,U}function _e(){p=new Vi,f.stage.addChild(p),k=new Vi,f.stage.addChild(k),m=new Dr(ht.EMPTY),m.anchor.set(.5),m.visible=!1,p.addChild(m),P=new ls,p.addChild(P),B=new oI,p.addChild(B.container),g=new ls,p.addChild(g),b=new ls,p.addChild(b),E=new ls,p.addChild(E),M=new ls,p.addChild(M),_=new ls,p.addChild(_),I=new ls,p.addChild(I),R=new ls,p.addChild(R),F=new ls,p.addChild(F),w=new ls,p.addChild(w)}function Ae(){r.value=!r.value,r.value&&(s.value=!1)}function ge(){a.value=!0,s.value=!1,r.value=!1}function Ee(z){z.key==="Escape"&&a.value&&(a.value=!1)}function j(){s.value=!s.value,s.value&&(r.value=!1)}function K(z){qR(e,Number(z.target.value))}async function q(z){var ie;const V=z.target,J=(ie=V.files)==null?void 0:ie[0];if(J)try{e.settings.backgroundImageData=await Oc(J),e.settings.backgroundImageName=J.name}catch(ue){console.error("背景图加载失败",ue)}finally{V.value=""}}async function W(z){const V=++y;if(!z){m&&(m.texture=ht.EMPTY,m.visible=!1),v&&v.destroy(!0),v=null;return}try{const J=await ht.fromURL(z);if(V!==y||!m){J.destroy(!0);return}const ie=v;v=J,m.texture=J,m.visible=!0,ie&&ie.destroy(!0)}catch(J){console.error("背景图恢复失败",J)}}function Q(z=!0){e.settings.backgroundImageData="",e.settings.backgroundImageName="",o.value&&(o.value.value=""),z&&(e.settings.backgroundX=0,e.settings.backgroundY=0,e.settings.backgroundOpacity=1)}function le(z,V=0){if(z<=0)return 1;const J=Math.pow(10,Math.floor(Math.log10(z))),ie=[1,2,5,10,20,50,100];let ue=1;for(const ve of ie)if(ve*J>=z){ue=ve*J;break}return Math.max(ue,V)}function xe(){if(!P)return;const z=P;z.clear();const V=e.settings;if(!V.tickEnabled){for(const be of L)be.visible=!1;return}const J=0,ie=0,ue=f.screen.width/e.editor.viewScale,ve=f.screen.height/e.editor.viewScale,Me=+("0x"+V.axisColor.replace("#",""));z.lineStyle(1.5,Me,.35),z.moveTo(-ue,ie),z.lineTo(ue,ie),z.moveTo(J,-ve),z.lineTo(J,ve);const Ie=e.editor.viewScale,ye=le(50/Ie),Oe=ue,pe=ve,Be=Math.max(1,V.tickWidth);if(V.tickEnabled){for(let be=0;be<=ue;be+=ye){const gt=Math.round(be/ye)*ye;gt!==0&&(z.lineStyle(Be,Me,.25),z.moveTo(gt,ie-4),z.lineTo(gt,ie+4))}for(let be=0;be<=ve;be+=ye)Math.round(be/ye)*ye!==0&&(z.lineStyle(Be,Me,.25),z.moveTo(J-4,be),z.lineTo(J+4,be))}const ke=f.screen.width/2+e.editor.viewX,Ge=f.screen.height*.5+e.editor.viewY,Ze=V.axisFontSize,Ne=+("0x"+V.axisColor.replace("#",""));for(;L.length<64;){const be=new tp("",{fontFamily:"monospace",fontSize:Ze,fill:Ne});be.anchor.set(.5,.5),k.addChild(be),L.push(be)}let Se=0;const Ke=V.showAxisLabels&&V.tickEnabled;for(let be=0;be<=ue;be+=ye){const gt=Math.round(be/ye)*ye;if(gt===0||!Ke||gt>Oe)continue;const $=L[Se++];if(!$)break;$.style.fontSize=Ze,$.text=String(gt),$.position.set(ke+gt*Ie,Ge+9),$.visible=!0;const S=L[Se++];if(!S)break;S.style.fontSize=Ze,S.text=String(-gt),S.position.set(ke-gt*Ie,Ge+9),S.visible=!0}for(let be=0;be<=ve;be+=ye){const gt=Math.round(be/ye)*ye;if(gt===0||!Ke||gt>pe)continue;const $=L[Se++];if(!$)break;$.style.fontSize=Ze,$.text=String(gt),$.position.set(ke+8,Ge-be*Ie),$.visible=!0;const S=L[Se++];if(!S)break;S.style.fontSize=Ze,S.text=String(-gt),S.position.set(ke+8,Ge+be*Ie),S.visible=!0}for(;Se<L.length;){const be=L[Se++];be&&(be.visible=!1)}}function ae(z){const V=t.value.getBoundingClientRect(),J=z.clientX-V.left,ie=z.clientY-V.top,ue=z.deltaY<0?1.12:1/1.12,ve=e.editor.viewScale,Me=Math.max(.01,ve*ue),Ie=f.screen.width/2,ye=f.screen.height*.5,Oe=e.editor.viewX,pe=e.editor.viewY,Be=(J-Ie-Oe)/ve,ke=(ie-ye-pe)/ve;e.editor.viewX=J-Ie-Be*Me,e.editor.viewY=ie-ye-ke*Me,e.editor.viewScale=Me}function we(z){if(z.button!==0)return;if(l.value&&Ii()){Is(z);return}if(It(z)||Mt(z)||Oi(z)||zt(z))return;const V=z.clientX,J=z.clientY,ie=e.editor.viewX,ue=e.editor.viewY,ve=Ie=>{e.editor.viewX=ie+(Ie.clientX-V),e.editor.viewY=ue+(Ie.clientY-J)},Me=()=>{window.removeEventListener("pointermove",ve),window.removeEventListener("pointerup",Me),window.removeEventListener("pointercancel",Me)};window.addEventListener("pointermove",ve),window.addEventListener("pointerup",Me),window.addEventListener("pointercancel",Me)}function ce(z,V){const J=t.value.getBoundingClientRect(),ie=Math.max(1e-4,e.editor.viewScale),ue=z-J.left,ve=V-J.top;return{x:(ue-f.screen.width/2-e.editor.viewX)/ie,y:-(ve-f.screen.height*.5-e.editor.viewY)/ie}}function Ue(z,V,J){const ie=z.rotation*Math.PI/180,ue=Math.cos(ie),ve=Math.sin(ie),Me=Math.max(1e-4,Math.abs(z.scaleX??1)),Ie=Math.max(1e-4,Math.abs(z.scaleY??1));return{x:z.x+ue*V*Me-ve*J*Ie,y:z.y+ve*V*Me+ue*J*Ie}}function Re(z,V,J){const ie=z.rotation*Math.PI/180,ue=Math.cos(ie),ve=Math.sin(ie),Me=Math.max(1e-4,Math.abs(z.scaleX??1)),Ie=Math.max(1e-4,Math.abs(z.scaleY??1)),ye=V-z.x,Oe=J-z.y;return{x:(ue*ye+ve*Oe)/Me,y:(-ve*ye+ue*Oe)/Ie}}function Fe(){if(e.activeObjectType!=="path")return null;const z=e.paths.find(V=>V.id===e.activeObjectId)||null;return(z==null?void 0:z.visible)===!1?null:z}function it(z,V,J){if(z.points.length<2)return z.points.length;const ie=z.closed?z.points.length:z.points.length-1;let ue=z.points.length,ve=1/0;for(let Me=0;Me<ie;Me++){const Ie=z.points[Me],ye=z.points[(Me+1)%z.points.length],Oe=ye.x-Ie.x,pe=ye.y-Ie.y,Be=Math.max(1e-4,Oe*Oe+pe*pe),ke=Math.min(1,Math.max(0,((V-Ie.x)*Oe+(J-Ie.y)*pe)/Be)),Ge=Ie.x+Oe*ke,Ze=Ie.y+pe*ke,Ne=Math.hypot(V-Ge,J-Ze);Ne<ve&&(ve=Ne,ue=Me+1)}return ue}function dt(z){const V=Fe();if(!V||!V.enabled)return;if(de){de=!1;return}const J=ce(z.clientX,z.clientY),ie=Re(V,J.x,J.y),ue=9/Math.max(.01,e.editor.viewScale),ve=V.points.findIndex(Ie=>Math.hypot(Ie.x-ie.x,Ie.y-ie.y)<=ue);if(ve>=0){V.points.splice(ve,1),Z.clear();return}const Me=it(V,ie.x,ie.y);V.points.splice(Me,0,{x:ie.x,y:ie.y,inX:0,inY:0,outX:0,outY:0}),Z.clear(),Z.add(Me)}function It(z){const V=Fe();if(!V||!V.enabled)return!1;const J=ce(z.clientX,z.clientY),ie=Re(V,J.x,J.y),ue=9/Math.max(.01,e.editor.viewScale);if(z.detail>=2){if(V.points.findIndex(pe=>Math.hypot(pe.x-ie.x,pe.y-ie.y)<=ue)>=0)return!0;const ye={x:ie.x,y:ie.y,inX:0,inY:0,outX:0,outY:0},Oe=it(V,ie.x,ie.y);return V.points.splice(Oe,0,ye),Z.clear(),Z.add(Oe),de=!0,yt(pe=>{const Be=ce(pe.clientX,pe.clientY),ke=Re(V,Be.x,Be.y);ye.outX=ke.x-ye.x,ye.outY=ke.y-ye.y,ye.inX=-ye.outX,ye.inY=-ye.outY}),!0}let ve=null;for(const Ie of Z){const ye=V.points[Ie];ye&&(Math.hypot(ye.x+ye.inX-ie.x,ye.y+ye.inY-ie.y)<=ue&&(ve={index:Ie,side:"in"}),Math.hypot(ye.x+ye.outX-ie.x,ye.y+ye.outY-ie.y)<=ue&&(ve={index:Ie,side:"out"}))}if(ve){const Ie=V.points[ve.index],ye=ve.side==="in"?Math.hypot(Ie.outX,Ie.outY):Math.hypot(Ie.inX,Ie.inY);return yt(pe=>{const Be=ce(pe.clientX,pe.clientY),ke=Re(V,Be.x,Be.y),Ge=ke.x-Ie.x,Ze=ke.y-Ie.y;if(ve.side==="in"?(Ie.inX=Ge,Ie.inY=Ze):(Ie.outX=Ge,Ie.outY=Ze),!pe.altKey){const Ne=Math.max(1e-4,Math.hypot(Ge,Ze)),Se=pe.shiftKey?Ne:ye;ve.side==="in"?(Ie.outX=-Ge/Ne*Se,Ie.outY=-Ze/Ne*Se):(Ie.inX=-Ge/Ne*Se,Ie.inY=-Ze/Ne*Se)}}),!0}const Me=V.points.findIndex(Ie=>Math.hypot(Ie.x-ie.x,Ie.y-ie.y)<=ue);if(Me>=0){if(z.altKey)return Z.delete(Me),!0;z.ctrlKey||z.metaKey?Z.add(Me):Z.has(Me)||(Z.clear(),Z.add(Me));const Ie=ie,ye=[...Z].map(pe=>({index:pe,x:V.points[pe].x,y:V.points[pe].y}));return yt(pe=>{const Be=ce(pe.clientX,pe.clientY),ke=Re(V,Be.x,Be.y);for(const Ge of ye)V.points[Ge.index].x=Ge.x+ke.x-Ie.x,V.points[Ge.index].y=Ge.y+ke.y-Ie.y}),!0}if(z.altKey&&!z.ctrlKey&&!z.metaKey)return Z.clear(),!0;if(z.ctrlKey||z.metaKey||z.altKey){const Ie=ie,ye=z.altKey,Oe=pe=>{const Be=ce(pe.clientX,pe.clientY),ke=Re(V,Be.x,Be.y),Ge=Math.min(Ie.x,ke.x),Ze=Math.max(Ie.x,ke.x),Ne=Math.min(Ie.y,ke.y),Se=Math.max(Ie.y,ke.y);V.points.forEach((Ke,be)=>{Ke.x>=Ge&&Ke.x<=Ze&&Ke.y>=Ne&&Ke.y<=Se&&(ye?Z.delete(be):Z.add(be))}),window.removeEventListener("pointerup",Oe),window.removeEventListener("pointercancel",Oe)};return window.addEventListener("pointerup",Oe),window.addEventListener("pointercancel",Oe),!0}return!1}function yt(z){const V=()=>{window.removeEventListener("pointermove",z),window.removeEventListener("pointerup",V),window.removeEventListener("pointercancel",V)};window.addEventListener("pointermove",z),window.addEventListener("pointerup",V),window.addEventListener("pointercancel",V)}function Mt(z){if(e.activeObjectType!=="collision")return!1;const V=e.colliders.find(Se=>Se.id===e.activeObjectId);if(!(V!=null&&V.enabled)||V.visible===!1)return!1;const J=ce(z.clientX,z.clientY),ie=V.rotation*Math.PI/180,ue=Math.cos(ie),ve=Math.sin(ie),Me=Math.max(1e-4,Math.abs(V.scaleX??1)),Ie=Math.max(1e-4,Math.abs(V.scaleY??1)),ye=J.x-V.x,Oe=J.y-V.y,pe=(ue*ye+ve*Oe)/Me,Be=(-ve*ye+ue*Oe)/Ie;if(!(V.shape==="circle"?Math.hypot(pe,Be)<=V.radius:V.shape==="ellipse"?Math.hypot(pe/Math.max(1,V.radiusX),Be/Math.max(1,V.radiusY))<=1:Math.abs(pe)<=V.width*.5&&Math.abs(Be)<=V.height*.5))return!1;const Ge=V.x,Ze=V.y,Ne=J;return yt(Se=>{const Ke=ce(Se.clientX,Se.clientY);V.x=Ge+Ke.x-Ne.x,V.y=Ze+Ke.y-Ne.y}),!0}function zt(z){const V=e.systems.find(Oe=>Oe.id===e.activeId);if((V==null?void 0:V.visible)===!1)return!1;const J=V==null?void 0:V.config;if(!(J!=null&&J.forceField)||J.forceRadius<=0)return!1;const ie=ce(z.clientX,z.clientY);if(Math.hypot(ie.x-J.forceCenterX,ie.y-J.forceCenterY)>J.forceRadius)return!1;const ve=J.forceCenterX,Me=J.forceCenterY;t.value&&(t.value.style.cursor="grabbing");const Ie=Oe=>{const pe=ce(Oe.clientX,Oe.clientY);J.forceCenterX=ve+pe.x-ie.x,J.forceCenterY=Me+pe.y-ie.y},ye=()=>{t.value&&(t.value.style.cursor=""),window.removeEventListener("pointermove",Ie),window.removeEventListener("pointerup",ye),window.removeEventListener("pointercancel",ye)};return window.addEventListener("pointermove",Ie),window.addEventListener("pointerup",ye),window.addEventListener("pointercancel",ye),z.preventDefault(),!0}function Oi(z){const V=e.systems.find(pe=>pe.id===e.activeId);if((V==null?void 0:V.visible)===!1)return!1;const J=V==null?void 0:V.config;if(!(J!=null&&J.attraction))return!1;const ie=ce(z.clientX,z.clientY),ue=Math.max(J.attractionRadius,12/Math.max(1e-4,e.editor.viewScale));if(Math.hypot(ie.x-J.attractionCenterX,ie.y-J.attractionCenterY)>ue)return!1;const Me=J.attractionCenterX,Ie=J.attractionCenterY;t.value&&(t.value.style.cursor="grabbing");const ye=pe=>{const Be=ce(pe.clientX,pe.clientY);J.attractionCenterX=Me+Be.x-ie.x,J.attractionCenterY=Ie+Be.y-ie.y},Oe=()=>{t.value&&(t.value.style.cursor=""),window.removeEventListener("pointermove",ye),window.removeEventListener("pointerup",Oe),window.removeEventListener("pointercancel",Oe)};return window.addEventListener("pointermove",ye),window.addEventListener("pointerup",Oe),window.addEventListener("pointercancel",Oe),z.preventDefault(),!0}function Ii(){const z=e.activeObjectId;if(e.activeObjectType==="particle"){const ie=e.systems.find(ve=>ve.id===z);if(!ie||ie.visible===!1)return null;const ue=ie.config;return{x:ue.centerX,y:ue.centerY,rotation:ue.rootRotation,scaleX:ue.rootScaleX??1,scaleY:ue.rootScaleY??1,setPosition:(ve,Me)=>{ue.centerX=ve,ue.centerY=Me},setRotation:ve=>{ue.rootRotation=ve},setScale:(ve,Me)=>{ue.rootScaleX=ve,ue.rootScaleY=Me}}}const J=(e.activeObjectType==="collision"?e.colliders:e.activeObjectType==="path"?e.paths:e.spines).find(ie=>ie.id===z);return!J||J.visible===!1?null:{x:Number(J.x)||0,y:Number(J.y)||0,rotation:Number(J.rotation)||0,scaleX:Math.max(.05,Number(J.scaleX)||1),scaleY:Math.max(.05,Number(J.scaleY)||1),setPosition:(ie,ue)=>{J.x=ie,J.y=ue},setRotation:ie=>{J.rotation=ie},setScale:(ie,ue)=>{J.scaleX=ie,J.scaleY=ue}}}function Is(z){const V=Ii();if(!V)return;const J=e.editor.viewScale,ie=t.value.getBoundingClientRect(),ue=ie.left+f.screen.width/2+e.editor.viewX+V.x*J,ve=ie.top+f.screen.height*.5+e.editor.viewY+-V.y*J,Me=z.clientX,Ie=z.clientY,ye=l.value,Oe=V.x,pe=V.y,Be=V.rotation,ke=V.scaleX,Ge=V.scaleY,Ze=Math.hypot(Me-ue,Ie-ve)||1,Ne=Math.atan2(Ie-ve,Me-ue),Se=be=>{const gt=(be.clientX-Me)/J,$=(be.clientY-Ie)/J;if(ye==="translate")V.setPosition(Oe+gt,pe-$);else if(ye==="rotate"){const S=Math.atan2(be.clientY-ve,be.clientX-ue);V.setRotation(Be-(S-Ne)*180/Math.PI)}else if(ye==="scale"){const C=Math.hypot(be.clientX-ue,be.clientY-ve)/Ze;V.setScale(Math.max(.05,ke*C),Math.max(.05,Ge*C))}},Ke=()=>{window.removeEventListener("pointermove",Se),window.removeEventListener("pointerup",Ke),window.removeEventListener("pointercancel",Ke)};window.addEventListener("pointermove",Se),window.addEventListener("pointerup",Ke),window.addEventListener("pointercancel",Ke)}function qs(){oe(1.2)}function Vt(){oe(1/1.2)}function oe(z){const V=Math.max(.01,e.editor.viewScale*z);e.editor.viewScale=V}function fe(){e.editor.viewScale=1,e.editor.viewX=0,e.editor.viewY=0}function Et(){e.editor.viewScale=1,e.editor.viewX=0,e.editor.viewY=0}function $t(){e.settings.showGrid=!e.settings.showGrid}function Gt(){if(p){for(const[z,V]of Y){const J=e.systems.find(ie=>ie.id===z);(!J||G.get(z)!==J.config)&&(p.removeChild(V),V.destroy({children:!0}),Y.delete(z),G.delete(z))}for(const z of e.systems){U&&!z.config.texture&&(z.config.texture=U);const V=ya(z.config);if(N)for(const ie of V.trailResources)!ie.texture&&(ie.previewUrl==="/images/trail.png"||ie.previewUrl==="/trails/trail.png")&&(ie.texture=N);if(U)for(const ie of V.imageResources)!ie.texture&&ie.textureName==="star"&&(ie.texture=U);if(Y.has(z.id))continue;const J=new N2(z.config);J.setEmitterPos(()=>({x:z.config.centerX,y:z.config.centerY})),p.addChild(J),Y.set(z.id,J),G.set(z.id,z.config)}}}function xt(){if(!b)return;const z=b;if(z.clear(),!!e.settings.showEmitter&&e.systems.length)for(const V of e.systems){if(V.visible===!1)continue;const J=ne.get(V.id),ie=(J==null?void 0:J.x)??V.config.centerX??0,ue=-((J==null?void 0:J.y)??V.config.centerY??0),ve=e.activeObjectType==="particle"&&V.id===e.activeId,Me=ve?16763955:9082040,Ie=ve?.4:.2;z.lineStyle(1,Me,Ie),z.drawCircle(ie,ue,10),z.beginFill(Me,ve?.8:.4),z.drawCircle(ie,ue,3),z.endFill(),z.lineStyle(1,Me,ve?.3:.15),z.moveTo(ie-16,ue),z.lineTo(ie+16,ue),z.moveTo(ie,ue-16),z.lineTo(ie,ue+16)}}function bs(){var J;if(!g)return;const z=g;(J=z.parent)==null||J.addChild(z),z.clear();const V=new Map;for(const ie of e.spines)ie.visible===!1||!ie.selectedBone||ie.status!=="ready"||V.set(`${ie.id}:${ie.selectedBone}`,{spineId:ie.id,boneName:ie.selectedBone});for(const ie of e.systems){if(ie.visible===!1)continue;const ue=ie.config;if(!ue.emitterFollow||ue.emitterFollowMode!=="bone"||!ue.emitterFollowSpineId||!ue.emitterFollowBoneName)continue;const ve=e.spines.find(Me=>Me.id===ue.emitterFollowSpineId);!ve||ve.visible===!1||V.set(`${ue.emitterFollowSpineId}:${ue.emitterFollowBoneName}`,{spineId:ue.emitterFollowSpineId,boneName:ue.emitterFollowBoneName})}for(const ie of V.values()){const ue=B==null?void 0:B.getBoneWorldTransform(ie.spineId,ie.boneName);if(!ue)continue;const ve=ue.x,Me=-ue.y;z.lineStyle(2,12881151,.95),z.beginFill(12881151,.2),z.drawCircle(ve,Me,8),z.endFill(),z.beginFill(15919103,1),z.drawCircle(ve,Me,3.5),z.endFill()}}function Rs(){if(!E)return;const z=E;if(z.clear(),!e.settings.showEmitter)return;const V=e.systems.find(Ne=>Ne.id===e.activeId);if(!V||V.visible===!1)return;const J=V.config,ie=ne.get(V.id),ue=(ie==null?void 0:ie.x)??J.centerX??0,ve=-((ie==null?void 0:ie.y)??J.centerY??0),Me=J.shape;if(Me==="point"||Me==="orbit")return;const Ie=J.rootScaleX??1,ye=J.rootScaleY??1,Oe=-((ie==null?void 0:ie.rotation)??J.rootRotation??0)*Math.PI/180,pe=Math.cos(Oe),Be=Math.sin(Oe),ke=J.offsetX??0,Ge=J.offsetY??0,Ze=(Ne,Se)=>{const Ke=Ne+ke,be=-Se-Ge,gt=Ke*Ie,$=be*ye;return[ue+gt*pe-$*Be,ve+(gt*Be+$*pe)]};if(Me==="circle"){z.lineStyle(2,3991658,.7);const Ne=48;for(let Se=0;Se<=Ne;Se++){const Ke=Se/Ne*Math.PI*2,[be,gt]=Ze(Math.cos(Ke)*J.radius,Math.sin(Ke)*J.radius);Se===0?z.moveTo(be,gt):z.lineTo(be,gt)}}else if(Me==="rect"){const Ne=J.rectW/2,Se=J.rectH/2,Ke=Ze(-Ne,-Se),be=Ze(Ne,-Se),gt=Ze(Ne,Se),$=Ze(-Ne,Se);z.lineStyle(2,4885759,.7),z.moveTo(Ke[0],Ke[1]),z.lineTo(be[0],be[1]),z.lineTo(gt[0],gt[1]),z.lineTo($[0],$[1]),z.lineTo(Ke[0],Ke[1])}else if(Me==="cone"){const Ne=J.radius,Se=J.coneAngle/2*Math.PI/180,Ke=J.direction*Math.PI/180,be=Ze(Math.cos(Ke-Se)*Ne,Math.sin(Ke-Se)*Ne),gt=Ze(Math.cos(Ke+Se)*Ne,Math.sin(Ke+Se)*Ne);z.lineStyle(2,3991658,.7),z.moveTo(ue,ve),z.lineTo(be[0],be[1]),z.moveTo(ue,ve),z.lineTo(gt[0],gt[1]),z.lineStyle(1,3991658,.5);const $=24;for(let S=0;S<=$;S++){const C=Ke-Se+2*Se*S/$,[ee,Pe]=Ze(Math.cos(C)*Ne,Math.sin(C)*Ne);S===0?z.moveTo(ee,Pe):z.lineTo(ee,Pe)}}}function Ri(){if(!M)return;const z=M;z.clear();const V=e.systems.find(Me=>Me.id===e.activeId);if((V==null?void 0:V.visible)===!1)return;const J=V==null?void 0:V.config;if(!(J!=null&&J.forceField)||J.forceRadius<=0)return;const ie=J.forceCenterX,ue=-J.forceCenterY,ve=J.forceStrength>=0?5818367:16739194;z.lineStyle(2,ve,.85),z.beginFill(ve,.08),z.drawCircle(ie,ue,J.forceRadius),z.endFill(),z.lineStyle(1,ve,.7),z.moveTo(ie-9,ue),z.lineTo(ie+9,ue),z.moveTo(ie,ue-9),z.lineTo(ie,ue+9),z.beginFill(ve,.95),z.drawCircle(ie,ue,4),z.endFill()}function us(){if(!_)return;const z=_;z.clear();const V=e.systems.find(Ie=>Ie.id===e.activeId);if((V==null?void 0:V.visible)===!1)return;const J=V==null?void 0:V.config;if(!(J!=null&&J.attraction))return;const ie=J.attractionCenterX,ue=-J.attractionCenterY,ve=Math.max(0,J.attractionRadius),Me=16731487;ve>0&&(z.lineStyle(2,Me,.95),z.beginFill(Me,.09),z.drawCircle(ie,ue,ve),z.endFill()),z.lineStyle(1,Me,.85),z.moveTo(ie-10,ue),z.lineTo(ie+10,ue),z.moveTo(ie,ue-10),z.lineTo(ie,ue+10),z.beginFill(Me,1),z.drawCircle(ie,ue,ve>0?4:6),z.endFill()}function ws(){if(!F)return;const z=F;if(z.clear(),!l.value)return;const V=Ii();if(!V)return;const J=V.x,ie=-V.y,ue=V.scaleX,ve=V.scaleY,Me=-V.rotation*Math.PI/180,Ie=Math.cos(Me),ye=Math.sin(Me),Oe=(ke,Ge)=>{const Ze=ke*ue,Ne=-Ge*ve;return[J+Ze*Ie-Ne*ye,ie+(Ze*ye+Ne*Ie)]},pe=(ke,Ge,Ze,Ne)=>{const Se=Oe(ke,Ge),Ke=Oe(Ze,Ne);z.moveTo(Se[0],Se[1]),z.lineTo(Ke[0],Ke[1])},Be=26;if(z.lineStyle(2,3526911,.9),z.beginFill(3526911,.25),z.drawCircle(J,ie,6),z.endFill(),l.value==="translate")z.lineStyle(2,3526911,.9),pe(-Be,0,Be,0),pe(0,-Be,0,Be),pe(Be-6,-4,Be,0),pe(Be,0,Be-6,4),pe(-20,-4,-Be,0),pe(-Be,0,-20,4),pe(-4,Be-6,0,Be),pe(0,Be,4,Be-6),pe(-4,-20,0,-Be),pe(0,-Be,4,-20);else if(l.value==="rotate"){z.lineStyle(2,3526911,.8);const ke=48;for(let Ne=0;Ne<=ke;Ne++){const Se=Ne/ke*Math.PI*2,[Ke,be]=Oe(Math.cos(Se)*Be,Math.sin(Se)*Be);Ne===0?z.moveTo(Ke,be):z.lineTo(Ke,be)}const[Ge,Ze]=Oe(0,Be);z.beginFill(3526911,.95),z.drawCircle(Ge,Ze,4),z.endFill()}else if(l.value==="scale"){z.lineStyle(2,3526911,.9);const Ge=[[-Be,-Be],[Be,-Be],[Be,Be],[-Be,Be]].map(([Ze,Ne])=>Oe(Ze,Ne));z.moveTo(Ge[0][0],Ge[0][1]),z.lineTo(Ge[1][0],Ge[1][1]),z.lineTo(Ge[2][0],Ge[2][1]),z.lineTo(Ge[3][0],Ge[3][1]),z.lineTo(Ge[0][0],Ge[0][1]),z.beginFill(3526911,.9);for(const Ze of Ge)z.drawRect(Ze[0]-3,Ze[1]-3,6,6);z.endFill()}}function ss(z,V){var J;z.push({boneName:V.boneName,x:V.x,y:V.y,rotation:-V.rotation}),(J=V.trailState)!=null&&J.bones.length&&V.trailState.bones.forEach(ie=>{z.push({boneName:ie.boneName,x:ie.x,y:ie.y,rotation:ie.rotation,parentX:0,parentY:0,trail:!0})})}function Bi(z){if(!w)return;const V=w;if(V.clear(),!e.settings.showBones)return;const J=0,ie=0,ue=Math.max(.25,Math.abs(e.editor.viewScale)||1),ve=Math.min(10,Math.max(.1,Number(e.settings.bonePointDrawSize)||1)),Me=Math.min(10,Math.max(.1,Number(e.settings.boneAxisDrawSize)||2)),Ie=2.5*ve/ue,ye=4.5*Me/ue,Oe=2.5*Me/ue,pe=Math.max(.65,Me*.625)/ue,Be=Math.max(.55,Me*.5)/ue;for(const ke of z){const Ge=ke.trail?16731533:16747610;V.lineStyle(1,Ge,ke.trail?.65:.35),V.moveTo(ke.parentX??J,ke.parentY??ie),V.lineTo(ke.x,ke.y);const Ze=ke.rotation*Math.PI/180,Ne=Math.cos(Ze),Se=Math.sin(Ze);V.lineStyle(pe,3725823,.95),V.moveTo(ke.x,ke.y),V.lineTo(ke.x+Ne*ye,ke.y+Se*ye),V.beginFill(3725823,.95),V.drawCircle(ke.x+Ne*ye,ke.y+Se*ye,Math.max(.8,Me*.625)/ue),V.endFill(),V.lineStyle(Be,16765286,.85),V.moveTo(ke.x,ke.y),V.lineTo(ke.x-Se*Oe,ke.y+Ne*Oe),V.beginFill(Ge,.9),V.drawCircle(ke.x,ke.y,Ie),V.endFill()}}function Ea(z,V=16777215){const J=Number.parseInt(z.replace("#",""),16);return Number.isFinite(J)?J:V}function Aa(){if(!I)return;const z=I;z.clear();for(const V of H){if(V.visible===!1)continue;const J=e.activeObjectType==="collision"&&e.activeObjectId===V.id,ie=V.enabled?J?16735858:13911899:5792116,ue=V.rotation*Math.PI/180,ve=Math.cos(ue),Me=Math.sin(ue),Ie=Math.max(1e-4,Math.abs(V.scaleX??1)),ye=Math.max(1e-4,Math.abs(V.scaleY??1)),Oe=(ke,Ge)=>({x:V.x+ve*ke*Ie-Me*Ge*ye,y:-(V.y+Me*ke*Ie+ve*Ge*ye)});let pe=[];if(V.shape==="circle"||V.shape==="ellipse"){const ke=V.shape==="circle"?V.radius:V.radiusX,Ge=V.shape==="circle"?V.radius:V.radiusY;pe=Array.from({length:49},(Ze,Ne)=>{const Se=Ne/48*Math.PI*2;return Oe(Math.cos(Se)*ke,Math.sin(Se)*Ge)})}else if(V.shape==="rect"){const ke=V.width*.5,Ge=V.height*.5;pe=[Oe(-ke,-Ge),Oe(ke,-Ge),Oe(ke,Ge),Oe(-ke,Ge),Oe(-ke,-Ge)]}else{const ke=Math.max(3,Math.min(16,Math.round(V.sides)));pe=Array.from({length:ke+1},(Ge,Ze)=>{const Ne=Math.PI*.5+Ze%ke/ke*Math.PI*2;return Oe(Math.cos(Ne)*V.width*.5,Math.sin(Ne)*V.height*.5)})}if(!pe.length)continue;z.lineStyle(J?2.5:1.5,ie,V.enabled?.95:.45),z.beginFill(ie,J?.12:.055),z.moveTo(pe[0].x,pe[0].y);for(let ke=1;ke<pe.length;ke++)z.lineTo(pe[ke].x,pe[ke].y);z.endFill();const Be=Oe(0,0);z.lineStyle(1,ie,.8),z.moveTo(Be.x-7,Be.y),z.lineTo(Be.x+7,Be.y),z.moveTo(Be.x,Be.y-7),z.lineTo(Be.x,Be.y+7)}}function Ur(){if(!R)return;const z=R;z.clear();for(const V of e.paths){if(V.visible===!1||!V.enabled||!V.points.length)continue;const J=e.activeObjectType==="path"&&e.activeObjectId===V.id,ie=Ea(V.color,16749374),ue=(ye,Oe)=>{const pe=Ue(V,ye,Oe);return{x:pe.x,y:-pe.y}},ve=V.points[0],Me=ue(ve.x,ve.y);z.lineStyle(J?2.5:1.8,ie,J?1:.75),z.moveTo(Me.x,Me.y);const Ie=V.closed?V.points.length:V.points.length-1;for(let ye=0;ye<Ie;ye++){const Oe=V.points[ye],pe=V.points[(ye+1)%V.points.length],Be=ue(Oe.x+Oe.outX,Oe.y+Oe.outY),ke=ue(pe.x+pe.inX,pe.y+pe.inY),Ge=ue(pe.x,pe.y);z.bezierCurveTo(Be.x,Be.y,ke.x,ke.y,Ge.x,Ge.y)}J&&V.points.forEach((ye,Oe)=>{const pe=ue(ye.x,ye.y),Be=ue(ye.x+ye.inX,ye.y+ye.inY),ke=ue(ye.x+ye.outX,ye.y+ye.outY),Ge=Math.hypot(ye.inX,ye.inY)>.01,Ze=Math.hypot(ye.outX,ye.outY)>.01;z.lineStyle(1,11121867,.65),Ge&&(z.moveTo(pe.x,pe.y),z.lineTo(Be.x,Be.y)),Ze&&(z.moveTo(pe.x,pe.y),z.lineTo(ke.x,ke.y)),Ge&&(z.beginFill(14015724,.95),z.drawCircle(Be.x,Be.y,3),z.endFill()),Ze&&(z.beginFill(14015724,.95),z.drawCircle(ke.x,ke.y,3),z.endFill()),z.beginFill(Z.has(Oe)?16777215:ie,1),z.lineStyle(1.5,Z.has(Oe)?6126847:16777215,.95),z.drawCircle(pe.x,pe.y,Z.has(Oe)?5:4),z.endFill()})}}function Ks(z,V,J="linear"){if(!z.length)return V;const ie=[...z].sort((ue,ve)=>ue.x-ve.x);if(V<=ie[0].x)return ie[0].y;for(let ue=1;ue<ie.length;ue++){const ve=ie[ue-1],Me=ie[ue];if(V<=Me.x){let Ie=(V-ve.x)/Math.max(1e-4,Me.x-ve.x);if(J==="bezier"){const ye=ve.x+(ve.outX??(Me.x-ve.x)/3),Oe=Me.x+(Me.inX??-(Me.x-ve.x)/3);let pe=0,Be=1;for(let ke=0;ke<18;ke++){const Ge=(pe+Be)/2;Zs(ve.x,ye,Oe,Me.x,Ge)<V?pe=Ge:Be=Ge}return Ie=(pe+Be)/2,Zs(ve.y,ve.y+(ve.outY??(Me.y-ve.y)/3),Me.y+(Me.inY??-(Me.y-ve.y)/3),Me.y,Ie)}return ve.y+(Me.y-ve.y)*Ie}}return ie[ie.length-1].y}function Zs(z,V,J,ie,ue){const ve=1-ue;return ve*ve*ve*z+3*ve*ve*ue*V+3*ve*ue*ue*J+ue*ue*ue*ie}function Rn(z,V){if(!z.points.length)return null;if(z.points.length===1)return{...Ue(z,z.points[0].x,z.points[0].y),angle:z.rotation};const J=z.closed?z.points.length:z.points.length-1,ie=[];let ue=0;for(let Ze=0;Ze<J;Ze++){const Ne=z.points[Ze],Se=z.points[(Ze+1)%z.points.length];for(let Ke=0;Ke<=20;Ke++){if(Ze>0&&Ke===0)continue;const be=Ke/20,gt=Zs(Ne.x,Ne.x+Ne.outX,Se.x+Se.inX,Se.x,be),$=Zs(Ne.y,Ne.y+Ne.outY,Se.y+Se.inY,Se.y,be),S=Ue(z,gt,$),C=ie[ie.length-1];C&&(ue+=Math.hypot(S.x-C.x,S.y-C.y)),ie.push({...S,distance:ue})}}const ve=Math.min(1,Math.max(0,V))*ue;let Me=ie.findIndex(Ze=>Ze.distance>=ve);Me<0&&(Me=ie.length-1);const Ie=ie[Me],ye=ie[Math.max(0,Me-1)],Oe=ie[Math.min(ie.length-1,Me+1)],pe=ye.distance,Be=Me>0?(ve-pe)/Math.max(1e-4,Ie.distance-pe):0,ke=ye.x+(Ie.x-ye.x)*Math.min(1,Math.max(0,Be)),Ge=ye.y+(Ie.y-ye.y)*Math.min(1,Math.max(0,Be));return{x:ke,y:Ge,angle:Math.atan2(Oe.y-ye.y,Oe.x-ye.x)*180/Math.PI}}function Xr(z){H=e.colliders.map(V=>{if(!V.followPath||!V.followPathId)return V;const J=e.paths.find(Oe=>Oe.id===V.followPathId&&Oe.enabled);if(!(J!=null&&J.points.length))return V;const ie=Math.max(.05,Number(V.followDuration)||2),ue=Math.min(1,Math.max(0,z/ie)),ve=Array.isArray(V.followCurve)?V.followCurve:[{x:0,y:0},{x:1,y:1}],Me=V.followCurveMode==="跟随导出"?e.settings.exportSettings.keyframeCurve==="bezier"?"bezier":"linear":V.followCurveMode==="贝塞尔"?"bezier":"linear",Ie=Math.min(1,Math.max(0,Ks(ve,ue,Me))),ye=Rn(J,Ie);return ye?{...V,x:ye.x,y:ye.y,rotation:V.rotation+(V.followPathRotation?ye.angle:0)}:V})}function cr(z,V,J,ie=Math.max(1e-4,Math.abs(z.rootScaleX)),ue=Math.max(1e-4,Math.abs(z.rootScaleY))){const ve=-z.rootRotation*Math.PI/180,Me=Math.cos(ve),Ie=Math.sin(ve),ye=V-z.centerX,Oe=-J+z.centerY;return{x:(Me*ye+Ie*Oe)/ie,y:(-Ie*ye+Me*Oe)/ue}}function Pn(){var J,ie,ue;T=requestAnimationFrame(Pn);const z=performance.now()/1e3;let V=z-X;if(X=z,V>.1&&(V=.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(),Gt();const ve=Math.max(1,e.timeline.fps),Me=e.timeline.frame,Ie=Me/ve;B==null||B.sync(e.spines,Me,ve),Xr(Ie);for(const Ne of e.systems){const Se=Y.get(Ne.id);if(!Se)continue;Se.setFollowExportCurveMode(e.settings.exportSettings.keyframeCurve==="bezier"?"贝塞尔":"线性");const Ke=Ne.visible!==!1;Se.visible=Ke,Se.renderable=Ke;const be=Ne.config;Se.scale.set(be.rootScaleX,be.rootScaleY),Se.setColliders(H),Se.setEmitterFollowSpawn(0,0,0);let gt={x:be.centerX,y:be.centerY,rotation:be.rootRotation};const $=be.emitterFollow&&be.emitterFollowMode==="bone"?e.spines.find(bi=>bi.id===be.emitterFollowSpineId&&bi.enabled&&bi.status==="ready"):null,S=$&&(B==null?void 0:B.getBoneWorldTransform($.id,be.emitterFollowBoneName))||null,C=be.emitterFollow&&be.emitterFollowMode==="path"?e.paths.find(bi=>bi.id===be.emitterFollowPathId&&bi.enabled):null,ee=Math.max(.05,be.emitterFollowDuration),Pe=Math.min(1,Math.max(0,Ie/ee)),wt=Math.min(1,Math.max(0,Ks(be.emitterFollowCurve,Pe))),jt=Math.min(1,Math.max(0,be.emitterFollowOffset)),fi=be.emitterFollowDirection==="reverse"?(1-jt)*(1-wt):jt+(1-jt)*wt,Rt=C?Rn(C,fi):null;if(S){const bi=be.emitterFollowBoneOffsetX,Ao=be.emitterFollowBoneOffsetY,Yr=S.x+bi,Ca=S.y+Ao,Nl=be.rootRotation+be.emitterFollowBoneRotation,Co=Math.max(1e-4,Math.abs(be.rootScaleX*be.emitterFollowBoneScaleX)),Io=Math.max(1e-4,Math.abs(be.rootScaleY*be.emitterFollowBoneScaleY));if(gt={x:Yr,y:Ca,rotation:Nl},be.emitterFollowSpace==="local")Se.position.set(Yr,-Ca),Se.rotation=-Nl*Math.PI/180,Se.scale.set(Co,Io),Se.setSimulationTransform(Yr,Ca,Nl,Co,Io);else{Se.position.set(be.centerX,-be.centerY),Se.rotation=-be.rootRotation*Math.PI/180,Se.scale.set(Co,Io),Se.setSimulationTransform(be.centerX,be.centerY,be.rootRotation,Co,Io);const xp=cr(be,Yr,Ca,Co,Io),$w=-(Nl-be.rootRotation);Se.setEmitterFollowSpawn(xp.x,xp.y,$w)}}else if(Rt){const bi=Rt.angle+(be.emitterFollowDirection==="reverse"?180:0),Ao=be.emitterAngleMode==="direction"?bi:be.rootRotation;if(gt={x:Rt.x,y:Rt.y,rotation:Ao},be.emitterFollowSpace==="local")Se.position.set(Rt.x,-Rt.y),Se.rotation=-Ao*Math.PI/180,Se.setSimulationTransform(Rt.x,Rt.y,Ao);else{Se.position.set(be.centerX,-be.centerY),Se.rotation=-be.rootRotation*Math.PI/180,Se.setSimulationTransform(be.centerX,be.centerY,be.rootRotation);const Yr=cr(be,Rt.x,Rt.y),Ca=be.emitterAngleMode==="direction"?-(bi-be.rootRotation):0;Se.setEmitterFollowSpawn(Yr.x,Yr.y,Ca)}}else Se.position.set(be.centerX,-be.centerY),Se.rotation=-be.rootRotation*Math.PI/180,Se.setSimulationTransform(be.centerX,be.centerY,be.rootRotation);ne.set(Ne.id,gt)}let ye=0;const Oe=[],pe=e.timeline,Be=pe.fps,ke=1/Math.max(1,Be);let Ge=D,Ze=0;if(pe.playing?(O+=V,Ze=Math.floor(O/ke),Ze>0&&(O-=Ze*ke)):O=0,pe.playing&&Ze>0)for(let Ne=0;Ne<Ze;Ne++)if(Ge=pe.frame,Oe.length=0,ye=0,pe.recorded){for(const $ of e.systems){const S=Y.get($.id),C=(ie=$.frames)==null?void 0:ie[pe.frame];if(S&&C){S.apply(C);for(const ee of C)ee.active&&($.visible!==!1&&ss(Oe,ee),ye++)}}pe.frame++;const Se=e.systems.find($=>$.id===e.activeId),Ke=(Se==null?void 0:Se.config.mode)==="stream"&&Se.config.streamBehavior==="loop"?O1(Se.config,Be):null,gt=pe.loop&&(Ke==null?void 0:Ke.start)===pe.playbackStart&&Ke.end===pe.playbackEnd?pe.playbackEnd-1:pe.playbackEnd;if(pe.frame>gt)if(pe.loop)pe.frame=pe.playbackStart;else{pe.frame=pe.playbackEnd,pe.playing=!1;break}}else{if(pe.frame===0)for(const Se of e.systems){const Ke=Y.get(Se.id);Ke&&(Se.config.mode==="stream"&&Se.config.streamBehavior==="loop"?aI(Se,Ke,Be,pe.totalFrames):Ke.reset())}for(const[Se,Ke]of Y){const be=e.systems.find(Pe=>Pe.id===Se),gt=(be==null?void 0:be.config.mode)==="stream"&&be.config.streamBehavior==="loop",$=gt?(J=be.frames)==null?void 0:J[pe.frame]:void 0,S=pe.frame===0&&!gt,C=S?[]:$||Ke.update(ke);if(S?Ke.apply([]):$&&Ke.apply($),(be==null?void 0:be.visible)!==!1)for(const Pe of C)Pe.active&&ss(Oe,Pe);ye+=C.length}for(const Se of e.systems){if(!Se.config.texture)continue;Se.frames=Se.frames||[];const Ke=Y.get(Se.id);Ke&&!(Se.config.mode==="stream"&&Se.config.streamBehavior==="loop")&&(Se.frames[pe.frame]=Ke.capture())}pe.frame++,pe.frame>=pe.totalFrames&&(pe.frame=pe.playbackStart,pe.recorded=!0)}else{pe.playing||(Ge=pe.frame);for(const Ne of e.systems){const Se=Y.get(Ne.id),Ke=pe.playing?D:pe.frame,be=(ue=Ne.frames)==null?void 0:ue[Ke],gt=Ne.config.mode==="stream"&&Ne.config.streamBehavior==="loop"&&!!be;if((pe.recorded||gt)&&Se&&be){Se.apply(be);for(const $ of be)$.active&&(Ne.visible!==!1&&ss(Oe,$),ye++)}else if(Se){const $=pe.frame===0?[]:Se.update(0);if(pe.frame===0&&Se.apply([]),Ne.visible!==!1)for(const S of $)S.active&&ss(Oe,S);ye+=Se.activeCount}}}D=Ge,B==null||B.sync(e.spines,Ge,Be);for(const[,Ne]of Y)Ne.drawTrailMeshDebug(e.settings.showSkinMesh);Aa(),Ur(),bs(),xt(),Rs(),Ri(),us(),ws(),Bi(Oe),i.value&&(i.value.systems=e.systems.length,i.value.particles=ye)}}return So(async()=>{window.addEventListener("keydown",Ee);const z=t.value;f=new o1({width:z.clientWidth||800,height:z.clientHeight||600,backgroundAlpha:0,antialias:!0}),z.appendChild(f.view),_e(),vs(()=>e.settings.backgroundImageData,W,{immediate:!0}),await me();const V=U;for(const J of e.systems){J.config.texture=V;const ie=ya(J.config);if(N)for(const ue of ie.trailResources)!ue.texture&&(ue.previewUrl==="/images/trail.png"||ue.previewUrl==="/trails/trail.png")&&(ue.texture=N);for(const ue of ie.imageResources)!ue.texture&&ue.textureName==="star"&&(ue.texture=V)}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(),X=performance.now()/1e3,Pn(),vs(()=>e.systems.map(J=>JSON.stringify(J.config,(ie,ue)=>ie==="texture"||ie==="trailTexture"||ie==="previewUrl"?void 0:ue)).join("|")+`|colliders:${JSON.stringify(e.colliders)}|paths:${JSON.stringify(e.paths)}`,()=>{e.recalcTotalFrames(),e.timeline.recorded=!1,e.timeline.frame=0;for(const J of e.systems)J.frames=[];e.timeline.playing=!0,e.timeline.loop=!0}),zR(e)}),Al(()=>{window.removeEventListener("keydown",Ee),cancelAnimationFrame(T),B==null||B.destroy(),B=null,y++,v&&v.destroy(!0),v=null,m=null,f&&(f.destroy(!0,{children:!0}),f=null)}),(z,V)=>(se(),he("div",JR,[A("div",{ref_key:"holder",ref:t,class:at(["stage-holder",{grid:De(e).settings.showGrid}]),tabindex:"0",onWheel:Ct(ae,["prevent"]),onPointerdown:we,onDblclick:Ct(dt,["prevent"])},null,34),A("div",QR,[A("button",{class:"settings-btn",onClick:j,title:"系统设置"},"系统设置"),A("button",{class:"undo-btn",disabled:De(nu).undoCount===0,onClick:V[0]||(V[0]=(...J)=>De(Zd)&&De(Zd)(...J)),title:"撤回上一步 (Ctrl+Z)"},"↶",8,eP),A("div",tP,[A("button",{class:at(["tool-btn",{on:l.value===""}]),onClick:V[1]||(V[1]=J=>u("")),title:"拖动画布 (Q)"},"✋",2),A("button",{class:at(["tool-btn",{on:l.value==="translate"}]),onClick:V[2]||(V[2]=J=>u("translate")),title:"位移 (W)"},"✥",2),A("button",{class:at(["tool-btn",{on:l.value==="rotate"}]),onClick:V[3]||(V[3]=J=>u("rotate")),title:"旋转 (E)"},"⟳",2),A("button",{class:at(["tool-btn",{on:l.value==="scale"}]),onClick:V[4]||(V[4]=J=>u("scale")),title:"缩放 (R)"},"⤢",2)]),A("div",iP,[A("button",{class:"tool-btn",onClick:qs,title:"放大"},"+"),A("button",{class:"tool-btn",onClick:Vt,title:"缩小"},"-"),A("button",{class:"tool-btn",onClick:fe,title:"适配画布"},"⤢"),A("button",{class:at(["tool-btn",{on:De(e).settings.showGrid}]),onClick:$t,title:"切换网格"},"▦",2),A("button",{class:"tool-btn",onClick:Et,title:"重置视图"},"⟳")]),A("div",{class:"background-menu",onClick:V[10]||(V[10]=Ct(()=>{},["stop"]))},[A("button",{class:at(["background-btn",{on:r.value}]),title:"背景图显示设置",onClick:Ae},"背景图",2),r.value?(se(),he("div",sP,[A("button",{class:"background-upload",onClick:V[5]||(V[5]=J=>{var ie;return(ie=o.value)==null?void 0:ie.click()})},We(h.value?"更换图像":"上传图像"),1),A("button",{class:"background-clear",disabled:!h.value,onClick:V[6]||(V[6]=J=>Q())},"清除背景",8,nP),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},We(h.value||"未上传图像"),9,rP),A("div",aP,[A("label",null,[V[28]||(V[28]=A("span",null,"X",-1)),Te(A("input",{"onUpdate:modelValue":V[7]||(V[7]=J=>De(e).settings.backgroundX=J),type:"number",step:"1","aria-label":"背景图 X 偏移"},null,512),[[ot,De(e).settings.backgroundX,void 0,{number:!0}]])]),A("label",null,[V[29]||(V[29]=A("span",null,"Y",-1)),Te(A("input",{"onUpdate:modelValue":V[8]||(V[8]=J=>De(e).settings.backgroundY=J),type:"number",step:"1","aria-label":"背景图 Y 偏移"},null,512),[[ot,De(e).settings.backgroundY,void 0,{number:!0}]])])]),A("label",oP,[V[30]||(V[30]=A("span",null,"透明度",-1)),Te(A("input",{"onUpdate:modelValue":V[9]||(V[9]=J=>De(e).settings.backgroundOpacity=J),type:"range",min:"0",max:"1",step:"0.01","aria-label":"背景图透明度"},null,512),[[ot,De(e).settings.backgroundOpacity,void 0,{number:!0}]]),A("b",null,We(Math.round(De(e).settings.backgroundOpacity*100))+"%",1)])])):je("",!0)]),A("button",{class:at(["help-btn",{on:a.value}]),title:"查看使用说明",onClick:ge},"使用说明",2),A("span",lP,We(Math.round(De(e).editor.viewScale*100))+"%",1)]),s.value?(se(),he("div",cP,[A("div",hP,[V[31]||(V[31]=ii("系统设置 ",-1)),A("button",{class:"sp-close",onClick:V[11]||(V[11]=J=>s.value=!1)},"✕")]),V[45]||(V[45]=A("div",{class:"sp-section-title"},"界面布局",-1)),A("label",uP,[V[33]||(V[33]=A("span",null,"参数面板位置",-1)),A("span",dP,[Te(A("input",{type:"checkbox","onUpdate:modelValue":V[12]||(V[12]=J=>De(e).settings.parameterPanelOnRight=J),"aria-label":"参数面板显示在右侧"},null,512),[[ei,De(e).settings.parameterPanelOnRight]]),V[32]||(V[32]=A("span",{class:"sp-switch-ui","aria-hidden":"true"},null,-1)),A("b",null,We(De(e).settings.parameterPanelOnRight?"右侧":"左侧"),1)])]),V[46]||(V[46]=A("div",{class:"sp-divider"},null,-1)),V[47]||(V[47]=A("div",{class:"sp-section-title"},"操作历史",-1)),A("label",fP,[V[34]||(V[34]=A("span",null,"最大撤回步数",-1)),Te(A("input",{class:"sp-num sp-undo-limit",type:"number",min:"1",max:"200","onUpdate:modelValue":V[13]||(V[13]=J=>De(e).settings.undoLimit=J),"aria-label":"最大撤回步数",onChange:K},null,544),[[ot,De(e).settings.undoLimit,void 0,{number:!0}]])]),V[48]||(V[48]=A("div",{class:"sp-divider"},null,-1)),V[49]||(V[49]=A("div",{class:"sp-section-title"},"画布辅助显示",-1)),A("label",mP,[Te(A("input",{type:"checkbox","onUpdate:modelValue":V[14]||(V[14]=J=>De(e).settings.showEmitter=J)},null,512),[[ei,De(e).settings.showEmitter]]),V[35]||(V[35]=ii("发射点",-1))]),A("label",pP,[Te(A("input",{type:"checkbox","onUpdate:modelValue":V[15]||(V[15]=J=>De(e).settings.showBones=J)},null,512),[[ei,De(e).settings.showBones]]),V[36]||(V[36]=ii("骨骼连线",-1))]),De(e).settings.showBones?(se(),he(st,{key:0},[A("label",gP,[V[37]||(V[37]=A("span",null,"骨骼点绘制大小",-1)),Te(A("input",{class:"sp-num",type:"number",min:"0.1",max:"10",step:"0.1","onUpdate:modelValue":V[16]||(V[16]=J=>De(e).settings.bonePointDrawSize=J),"aria-label":"骨骼点绘制大小",onChange:d},null,544),[[ot,De(e).settings.bonePointDrawSize,void 0,{number:!0}]])]),A("label",vP,[V[38]||(V[38]=A("span",null,"坐标轴绘制大小",-1)),Te(A("input",{class:"sp-num",type:"number",min:"0.1",max:"10",step:"0.1","onUpdate:modelValue":V[17]||(V[17]=J=>De(e).settings.boneAxisDrawSize=J),"aria-label":"坐标轴绘制大小",onChange:d},null,544),[[ot,De(e).settings.boneAxisDrawSize,void 0,{number:!0}]])])],64)):je("",!0),A("label",yP,[Te(A("input",{type:"checkbox","onUpdate:modelValue":V[18]||(V[18]=J=>De(e).settings.showSkinMesh=J)},null,512),[[ei,De(e).settings.showSkinMesh]]),V[39]||(V[39]=ii("蒙皮网格",-1))]),V[50]||(V[50]=A("div",{class:"sp-divider"},null,-1)),A("label",xP,[Te(A("input",{type:"checkbox","onUpdate:modelValue":V[19]||(V[19]=J=>De(e).settings.tickEnabled=J)},null,512),[[ei,De(e).settings.tickEnabled]]),V[40]||(V[40]=ii("启用刻度",-1))]),De(e).settings.tickEnabled?(se(),he(st,{key:1},[A("label",bP,[V[41]||(V[41]=A("span",null,"刻度文字大小",-1)),Te(A("input",{type:"range",min:"8",max:"40",step:"1","onUpdate:modelValue":V[20]||(V[20]=J=>De(e).settings.axisFontSize=J)},null,512),[[ot,De(e).settings.axisFontSize,void 0,{number:!0}]]),Te(A("input",{type:"number",min:"8",max:"40","onUpdate:modelValue":V[21]||(V[21]=J=>De(e).settings.axisFontSize=J),class:"sp-num"},null,512),[[ot,De(e).settings.axisFontSize,void 0,{number:!0}]])]),A("label",wP,[V[42]||(V[42]=A("span",null,"刻度线粗细",-1)),Te(A("input",{type:"range",min:"1",max:"5",step:"0.5","onUpdate:modelValue":V[22]||(V[22]=J=>De(e).settings.tickWidth=J)},null,512),[[ot,De(e).settings.tickWidth,void 0,{number:!0}]]),Te(A("input",{type:"number",min:"1",max:"5","onUpdate:modelValue":V[23]||(V[23]=J=>De(e).settings.tickWidth=J),class:"sp-num"},null,512),[[ot,De(e).settings.tickWidth,void 0,{number:!0}]])]),A("label",SP,[V[43]||(V[43]=A("span",null,"坐标轴颜色",-1)),Te(A("input",{type:"color","onUpdate:modelValue":V[24]||(V[24]=J=>De(e).settings.axisColor=J),class:"sp-colr"},null,512),[[ot,De(e).settings.axisColor]]),A("span",_P,We(De(e).settings.axisColor),1)]),A("label",TP,[Te(A("input",{type:"checkbox","onUpdate:modelValue":V[25]||(V[25]=J=>De(e).settings.showAxisLabels=J)},null,512),[[ei,De(e).settings.showAxisLabels]]),V[44]||(V[44]=ii("显示刻度数值",-1))])],64)):je("",!0),V[51]||(V[51]=A("div",{class:"sp-cache-note"},"整个系统设置会自动保存到当前浏览器",-1))])):je("",!0),a.value?(se(),he("div",{key:1,class:"help-overlay",role:"presentation",onClick:V[27]||(V[27]=Ct(J=>a.value=!1,["self"]))},[A("section",MP,[A("header",EP,[V[52]||(V[52]=A("div",null,[A("h2",{id:"help-title"},"使用说明"),A("p",null,"从创建粒子到保存、导出的快速入门")],-1)),A("button",{class:"help-close","aria-label":"关闭使用说明",title:"关闭 (Esc)",onClick:V[26]||(V[26]=J=>a.value=!1)},"✕")]),V[53]||(V[53]=Ua('<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))])])):je("",!0),i.value?(se(),he("div",AP,[V[54]||(V[54]=ii(" 系统: ",-1)),A("b",CP,We(i.value.systems),1),V[55]||(V[55]=ii(" · 粒子(骨骼): ",-1)),A("b",IP,We(i.value.particles),1),V[56]||(V[56]=ii(" · 根骨骼: ",-1)),V[57]||(V[57]=A("b",null,"root",-1)),V[58]||(V[58]=A("span",{class:"hud-tip"},"滚轮缩放 · 左键拖动画布",-1))])):je("",!0)]))}}),In=(n,e)=>{const t=n.__vccOpts||n;for(const[i,s]of e)t[i]=s;return t},PP=In(RP,[["__scopeId","data-v-6a919d1f"]]),kP={class:"ns-label"},FP=["min","max","step","value","disabled"],OP=["min","max","step","value","disabled"],BP=En({__name:"NumSlider",props:{label:{},modelValue:{},min:{},max:{},step:{},disabled:{type:Boolean}},emits:["update:modelValue"],setup(n,{emit:e}){const t=n,i=e,s=lt(String(t.modelValue));vs(()=>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)=>(se(),he("div",{class:at(["ns",{disabled:n.disabled}])},[A("span",kP,We(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,FP),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,OP)],2))}}),Je=In(BP,[["__scopeId","data-v-7c2fbed0"]]),LP={class:"ce"},DP={class:"ce-editor"},NP={class:"ce-grid"},UP=["x1","x2","y2"],XP=["y1","x2","y2"],YP=["x","y","width","height"],VP=["d"],$P={key:0,class:"ce-handles"},GP=["x1","y1","x2","y2"],jP=["cx","cy","onPointerdown"],HP=["x1","y1","x2","y2"],WP=["cx","cy","onPointerdown"],zP=["cx","cy"],qP=["cx","cy","onPointerdown","onDblclick"],KP={class:"ce-nav"},ZP={class:"ce-tip"},dr=8,JP=En({__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=lt(null),r=lt(300),a=lt(110);let o=null;function h(){if(!s.value)return;const P=s.value.getBoundingClientRect();r.value=P.width,a.value=P.height}function l(P){return dr+P*(r.value-dr*2)}function c(P){return dr+(1-P)*(a.value-dr*2)}function u(){return[...t.modelValue].sort((P,k)=>P.x-k.x)}function d(P){i("update:modelValue",[...P].sort((k,B)=>k.x-B.x))}function f(){d(t.defaultValue.map(P=>({...P})))}const p=ft(()=>u());function m(P){const k=p.value[P],B=p.value[Math.max(0,P-1)];return{x:k.x-(k.x-B.x)/3,y:k.y-(k.y-B.y)/3}}function v(P){const k=p.value[P],B=p.value[Math.min(p.value.length-1,P+1)];return{x:k.x+(B.x-k.x)/3,y:k.y+(B.y-k.y)/3}}function y(P){const k=p.value[P],B=m(P);return{x:k.x+(k.inX??B.x-k.x),y:k.y+(k.inY??B.y-k.y)}}function b(P){const k=p.value[P],B=v(P);return{x:k.x+(k.outX??B.x-k.x),y:k.y+(k.outY??B.y-k.y)}}const g=ft(()=>{if(!p.value.length)return"";let P=`M ${l(p.value[0].x)} ${c(p.value[0].y)}`;for(let k=1;k<p.value.length;k++){const B=p.value[k];if(t.mode==="bezier"){const L=b(k-1),X=y(k);P+=` C ${l(L.x)} ${c(L.y)} ${l(X.x)} ${c(X.y)} ${l(B.x)} ${c(B.y)}`}else P+=` L ${l(B.x)} ${c(B.y)}`}return P});function w(P,k){const B=s.value.getBoundingClientRect(),L=(P-B.left-dr)/(r.value-dr*2),X=(k-B.top-dr)/(a.value-dr*2);return{x:Math.min(1,Math.max(0,Math.round(L*100)/100)),y:Math.min(1,Math.max(0,Math.round((1-X)*100)/100))}}let E=0;function M(P){if(P.target.classList.contains("ce-hit")||Date.now()-E<400)return;const{x:k,y:B}=w(P.clientX,P.clientY),L=u().filter(X=>Math.abs(X.x-k)>.02);L.push({x:k,y:B}),d(L)}let _={t:0,i:-1,x:0,y:0};function I(P,k){P.stopPropagation();const B=u().findIndex(D=>Math.abs(D.x-p.value[k].x)<1e-6&&Math.abs(D.y-p.value[k].y)<1e-6);if(B<0)return;const L=Date.now();if(L-_.t<300&&_.i===k&&Math.abs(P.clientX-_.x)<8&&Math.abs(P.clientY-_.y)<8){_={t:0,i:-1,x:0,y:0},F(k);return}_={t:L,i:k,x:P.clientX,y:P.clientY};const X=D=>{(Math.abs(D.clientX-P.clientX)>8||Math.abs(D.clientY-P.clientY)>8)&&(_={t:0,i:-1,x:0,y:0});const{x:T,y:U}=w(D.clientX,D.clientY),N=u();N[B]={x:T,y:U},d(N)},O=()=>{window.removeEventListener("pointermove",X),window.removeEventListener("pointerup",O)};window.addEventListener("pointermove",X),window.addEventListener("pointerup",O)}function R(P,k,B){P.stopPropagation();const L=O=>{const D=w(O.clientX,O.clientY),T=u(),U=T[k],N=B==="in"?T[Math.max(0,k-1)].x:U.x,Y=B==="in"?U.x:T[Math.min(T.length-1,k+1)].x,G=Math.min(Y,Math.max(N,D.x)),H=Math.round((G-U.x)*100)/100,ne=Math.round((D.y-U.y)*100)/100;T[k]=B==="in"?{...U,inX:H,inY:ne}:{...U,outX:H,outY:ne},d(T)},X=()=>{window.removeEventListener("pointermove",L),window.removeEventListener("pointerup",X)};window.addEventListener("pointermove",L),window.addEventListener("pointerup",X)}function F(P,k){k==null||k.stopPropagation();const B=u();B.length<=2||(E=Date.now(),d(B.filter((L,X)=>X!==P)))}return So(()=>{h(),o=new ResizeObserver(h),s.value&&o.observe(s.value)}),Al(()=>{o==null||o.disconnect()}),(P,k)=>(se(),he("div",LP,[A("div",DP,[(se(),he("svg",{ref_key:"svg",ref:s,class:"ce-svg",onDblclick:M},[A("g",NP,[(se(),he(st,null,ui([.25,.5,.75],B=>A("line",{key:"v"+B,x1:l(B),y1:"0",x2:l(B),y2:c(0)},null,8,UP)),64)),(se(),he(st,null,ui([.25,.5,.75],B=>A("line",{key:"h"+B,x1:"0",y1:c(B),x2:l(1),y2:c(B)},null,8,XP)),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,YP),A("path",{d:g.value,class:"ce-line",fill:"none"},null,8,VP),n.mode==="bezier"?(se(),he("g",$P,[(se(!0),he(st,null,ui(p.value,(B,L)=>(se(),he(st,{key:"handles-"+L},[L>0?(se(),he("line",{key:0,x1:l(B.x),y1:c(B.y),x2:l(y(L).x),y2:c(y(L).y)},null,8,GP)):je("",!0),L>0?(se(),he("circle",{key:1,cx:l(y(L).x),cy:c(y(L).y),r:"4",onPointerdown:X=>R(X,L,"in")},null,40,jP)):je("",!0),L<p.value.length-1?(se(),he("line",{key:2,x1:l(B.x),y1:c(B.y),x2:l(b(L).x),y2:c(b(L).y)},null,8,HP)):je("",!0),L<p.value.length-1?(se(),he("circle",{key:3,cx:l(b(L).x),cy:c(b(L).y),r:"4",onPointerdown:X=>R(X,L,"out")},null,40,WP)):je("",!0)],64))),128))])):je("",!0),(se(!0),he(st,null,ui(p.value,(B,L)=>(se(),he("g",{key:L},[A("circle",{cx:l(B.x),cy:c(B.y),r:"5",class:"ce-node"},null,8,zP),A("circle",{cx:l(B.x),cy:c(B.y),r:"9",class:"ce-hit",onPointerdown:X=>I(X,L),onDblclick:X=>F(L,X)},null,40,qP)]))),128))],544)),A("div",KP,[A("span",ZP,We(n.mode==="bezier"?"拖动方形手柄调整弧度·双击空白新建·双击节点删除":"双击空白新建·双击节点删除·拖动节点调整"),1)])]),A("button",{class:"ce-reset",type:"button",title:"恢复默认曲线",onClick:f},"重置")]))}}),rn=In(JP,[["__scopeId","data-v-9bfb7b31"]]),QP={class:"pac"},ek={class:"pac-head"},tk={class:"pac-label"},ik={key:0,class:"pac-modes"},sk=["onClick"],nk={class:"pac-range"},rk={class:"pac-curve"},ak={class:"pac-axis"},ok=En({__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=ft(()=>{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)=>(se(),he("div",QP,[A("div",ek,[A("span",tk,We(n.label),1),n.showModes?(se(),he("div",ik,[(se(!0),he(st,null,ui(t.value,r=>(se(),he("button",{key:r.value,class:at(["pac-mode",{on:n.mode===r.value}]),onClick:a=>i.$emit("update:mode",r.value)},We(r.label),11,sk))),128))])):je("",!0)]),n.mode==="fixed"||n.mode==="direction"?(se(),Ht(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"?(se(),he(st,{key:1},[He(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"]),He(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)):(se(),he(st,{key:2},[A("div",nk,[He(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"]),He(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",rk,[He(rn,{"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",ak,[s[6]||(s[6]=A("span",null,"0",-1)),A("span",null,We(n.curveLabel),1),s[7]||(s[7]=A("span",null,"1",-1))])])],64))]))}}),Bn=In(ok,[["__scopeId","data-v-238f838c"]]),lk={class:"gradient-editor"},ck=["title","onClick","onDblclick","onPointerdown"],hk={key:0,class:"gradient-controls"},uk=["value"],dk=["value"],fk={class:"gradient-position"},mk=["value"],pk=["disabled"],gk=En({__name:"ColorGradientEditor",props:{modelValue:{}},emits:["update:modelValue"],setup(n,{emit:e}){const t=n,i=e,s=lt(null),r=lt(0),a=ft(()=>t.modelValue[r.value]||null),o=ft(()=>[...t.modelValue].sort((I,R)=>I.position-R.position)),h=ft(()=>{const I=o.value;return I.length?`linear-gradient(90deg, ${I.map(R=>`${R.color} ${l(R.position)*100}%`).join(", ")})`:"#ffffff"});vs(()=>t.modelValue.length,I=>{r.value>=I&&(r.value=Math.max(0,I-1))});function l(I){return Math.min(1,Math.max(0,Number(I)||0))}function c(){return t.modelValue.map(I=>({position:l(I.position),color:I.color}))}function u(I,R){const F=c();F[I]&&(F[I]={...F[I],...R},i("update:modelValue",F))}function d(I){u(r.value,{color:I.target.value})}function f(I){var P;const R=I.target,F=_(R.value,((P=a.value)==null?void 0:P.color)||"#ffffff");R.value=F,u(r.value,{color:F})}function p(I){const R=I.target;f(I),R.blur()}function m(I){const R=Number(I.target.value);Number.isFinite(R)&&u(r.value,{position:l(R/100)})}function v(I){const R=c();R.push({position:l(I),color:E(R,I)}),r.value=R.length-1,i("update:modelValue",R)}function y(I){if(!s.value)return;const R=s.value.getBoundingClientRect();v((I.clientX-R.left)/Math.max(1,R.width))}function b(){const I=o.value;let R=.5;if(I.length>1){let F=-1;for(let P=0;P<I.length-1;P++){const k=I[P+1].position-I[P].position;k>F&&(F=k,R=(I[P].position+I[P+1].position)/2)}}v(R)}function g(I){if(t.modelValue.length<=2||I<0)return;const R=c().filter((F,P)=>P!==I);r.value=Math.min(I,R.length-1),i("update:modelValue",R)}function w(I,R){if(!s.value)return;r.value=R;const F=k=>{const B=s.value.getBoundingClientRect();u(R,{position:l((k.clientX-B.left)/Math.max(1,B.width))})},P=()=>{window.removeEventListener("pointermove",F),window.removeEventListener("pointerup",P),window.removeEventListener("pointercancel",P)};window.addEventListener("pointermove",F),window.addEventListener("pointerup",P),window.addEventListener("pointercancel",P),I.preventDefault()}function E(I,R){const F=[...I].sort((P,k)=>P.position-k.position);if(!F.length)return"#ffffff";if(R<=F[0].position)return F[0].color;if(R>=F[F.length-1].position)return F[F.length-1].color;for(let P=0;P<F.length-1;P++){const k=F[P],B=F[P+1];if(R<k.position||R>B.position)continue;const L=(R-k.position)/Math.max(1e-4,B.position-k.position);return M(k.color,B.color,L)}return F[F.length-1].color}function M(I,R,F){const P=X=>{const O=parseInt(X.replace("#","").padEnd(6,"0").slice(0,6),16);return[O>>16&255,O>>8&255,O&255]},k=P(I),B=P(R),L=X=>Math.round(k[X]+(B[X]-k[X])*F);return`#${[L(0),L(1),L(2)].map(X=>X.toString(16).padStart(2,"0")).join("")}`}function _(I,R){let F=I.trim().replace(/^#/,"");return/^[0-9a-f]{3}$/i.test(F)&&(F=F.split("").map(P=>P+P).join("")),/^[0-9a-f]{6}$/i.test(F)?`#${F.toLowerCase()}`:R}return(I,R)=>(se(),he("div",lk,[A("div",{ref_key:"bar",ref:s,class:"gradient-bar",style:Di({background:h.value}),title:"双击色带添加色标",onDblclick:y},[(se(!0),he(st,null,ui(n.modelValue,(F,P)=>(se(),he("button",{key:P,type:"button",class:at(["gradient-stop",{selected:P===r.value}]),style:Di({left:`${l(F.position)*100}%`,"--stop-color":F.color}),title:`${Math.round(l(F.position)*100)}% · ${F.color}`,onClick:Ct(k=>r.value=P,["stop"]),onDblclick:Ct(k=>g(P),["stop"]),onPointerdown:Ct(k=>w(k,P),["stop"])},null,46,ck))),128))],36),a.value?(se(),he("div",hk,[A("input",{type:"color",class:"gradient-color",value:a.value.color,"aria-label":"色标颜色",onInput:d},null,40,uk),A("input",{type:"text",class:"gradient-hex-input",value:a.value.color,"aria-label":"色标颜色值",spellcheck:"false",onChange:f,onKeydown:ha(p,["enter"])},null,40,dk),A("label",fk,[A("input",{type:"number",min:"0",max:"100",step:"1",value:Math.round(l(a.value.position)*100),"aria-label":"色标位置",onInput:m},null,40,mk),R[1]||(R[1]=A("span",null,"%",-1))]),A("button",{type:"button",class:"gradient-action",title:"在中间新增颜色",onClick:b},"+"),A("button",{type:"button",class:"gradient-action danger",title:"删除当前色标",disabled:n.modelValue.length<=2,onClick:R[0]||(R[0]=F=>g(r.value))},"×",8,pk)])):je("",!0),R[2]||(R[2]=A("div",{class:"gradient-hint"},"双击色带新增 · 拖动色标调整位置 · 双击色标删除",-1))]))}}),vv=In(gk,[["__scopeId","data-v-f6ab10bf"]]),vk={class:"image-card"},yk={class:"imgrow"},xk=["title"],bk=["src","alt"],wk={key:1,viewBox:"0 0 24 24",width:"22",height:"22",fill:"none",stroke:"#8a93bb","stroke-width":"1.6"},Sk={class:"img-fields"},_k={key:0,class:"row"},Tk={class:"row"},Mk=["placeholder"],Ek={class:"img-actions"},Ak=["title"],Ck=["disabled"],Ik={class:"thumb-note"},Rk={key:0,class:"row"},Pk={class:"row"},kk={class:"row"},Fk={class:"sequence-note"},Ok={class:"resource-weight-row"},Bk=["disabled","title"],Lk={key:0,viewBox:"0 0 24 24","aria-hidden":"true"},Dk={key:1,viewBox:"0 0 24 24","aria-hidden":"true"},Nk=En({__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=ft(()=>{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=ft(()=>{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=ft(()=>{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)=>(se(),he("div",vk,[A("div",yk,[A("button",{class:"img-thumb",title:n.supportsSequence&&n.resource.imageMode==="sequence"?"选择序列帧图片":"选择本地图片",onClick:o},[r.value?(se(),he("img",{key:0,src:r.value,alt:n.resource.textureName},null,8,bk)):(se(),he("svg",wk,[...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,xk),A("div",Sk,[n.showFolder?(se(),he("label",_k,[l[11]||(l[11]=A("span",null,"子文件夹",-1)),Te(A("input",{"onUpdate:modelValue":l[0]||(l[0]=c=>n.resource.textureFolder=c),type:"text",class:"inp",placeholder:"subfolder/"},null,512),[[ot,n.resource.textureFolder]])])):je("",!0),A("label",Tk,[l[12]||(l[12]=A("span",null,"名称",-1)),Te(A("input",{"onUpdate:modelValue":l[1]||(l[1]=c=>n.resource.textureName=c),type:"text",class:"inp",placeholder:n.namePlaceholder},null,8,Mk),[[ot,n.resource.textureName]])])]),A("div",Ek,[A("button",{class:"mini-btn2",title:`恢复 ${n.defaultFile}`,onClick:l[2]||(l[2]=c=>h.$emit("reset",n.resource.id))},"⟳",8,Ak),A("button",{class:"mini-btn2",title:"删除图片资源",disabled:n.resourceCount===1,onClick:l[3]||(l[3]=c=>h.$emit("remove",n.resource.id))},"🗑",8,Ck)])]),A("div",Ik,We(s.value),1),n.supportsSequence?(se(),he("label",Rk,[l[14]||(l[14]=A("span",null,"图片模式",-1)),Te(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),[[qt,n.resource.imageMode]])])):je("",!0),n.supportsSequence&&n.resource.imageMode==="sequence"?(se(),he(st,{key:1},[A("label",Pk,[l[16]||(l[16]=A("span",null,"播放模式",-1)),Te(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),[[qt,n.resource.sequencePlayback]])]),A("label",kk,[l[17]||(l[17]=A("span",null,"播放帧率",-1)),Te(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),[[ot,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",Fk,We(a.value),1)],64)):je("",!0),A("div",Ok,[He(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:at(["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?(se(),he("svg",Lk,[...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)])])):(se(),he("svg",Dk,[...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,Bk)]),e_(h.$slots,"default",{},void 0)]))}}),yv=In(Nk,[["__scopeId","data-v-68ff5314"]]),Uk={class:"spine-editor"},Xk={class:"field wide"},Yk={class:"grid three"},Vk={class:"field"},$k={class:"field"},Gk={class:"field"},jk={class:"grid three"},Hk={class:"field"},Wk={class:"field"},zk={class:"field"},qk=["disabled"],Kk={class:"asset-row"},Zk=["title"],Jk={class:"asset-row"},Qk=["title"],eF={class:"asset-row"},tF=["title"],iF={class:"asset-actions"},sF=["disabled"],nF={class:"runtime-note"},rF={key:0},aF={key:0,class:"error"},oF={class:"section-box"},lF={key:0,class:"empty"},cF={key:1,class:"field wide"},hF=["value"],uF={class:"section-box"},dF={class:"tree-title-row"},fF=["disabled","title"],mF={key:0,class:"empty"},pF={key:1,class:"bone-search"},gF={key:2,class:"empty"},vF={key:3,class:"bone-tree"},yF=["onClick","onKeydown"],xF=["title","onClick"],bF={key:1,class:"bone-leaf"},wF={class:"bone-name"},SF=En({__name:"SpineObjectPanel",props:{spineObject:{}},setup(n){const e=n,t=Fl(),i=lt(null),s=lt(null),r=lt(null),a=lt(null),o=lt(new Set),h=lt(""),l=lt(null),c=lt(null),u=lt([]);e.spineObject.selectedBone==null&&(e.spineObject.selectedBone=""),e.spineObject.sourceBundle==null&&(e.spineObject.sourceBundle=null),e.spineObject.dataVersion==null&&(e.spineObject.dataVersion="");const d=ft(()=>{var D;return((D=l.value)==null?void 0:D.name)||e.spineObject.skeletonFileName}),f=ft(()=>{var D;return((D=c.value)==null?void 0:D.name)||e.spineObject.atlasFileName}),p=ft(()=>u.value.length?u.value.map(D=>D.name):e.spineObject.textureFileNames),m=ft(()=>p.value.length?`${p.value.length} 张:${p.value.join(", ")}`:"PNG / JPEG / WebP..."),v=ft(()=>new Set(e.spineObject.bones.map(D=>D.parent).filter(D=>!!D))),y=ft(()=>new Map(e.spineObject.bones.map(D=>[D.name,D]))),b=ft(()=>e.spineObject.bones.filter(D=>{var N;const T=h.value.trim().toLocaleLowerCase();if(T)return D.name.toLocaleLowerCase().includes(T);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})),g=ft(()=>v.value.size>0&&[...v.value].every(D=>o.value.has(D)));function w(D){const T=e.spineObject.selectedBone===D;for(const U of t.spines)U.selectedBone="";T||(e.spineObject.selectedBone=D)}function E(D){o.value.has(D)?o.value.delete(D):o.value.add(D)}function M(){o.value=g.value?new Set:new Set(v.value)}function _(D){var T;return((T=D.target.files)==null?void 0:T[0])||null}function I(D){l.value=_(D)}function R(D){c.value=_(D)}function F(D){u.value=Array.from(D.target.files||[])}function P(D){return D.name.replace(/\.[^.]+$/,"").toLocaleLowerCase()}async function k(D){const T=Array.from(D.target.files||[]);if(!T.length)return;const U=T.filter(Z=>/\.(json|skel)$/i.test(Z.name)),N=T.filter(Z=>/\.atlas$/i.test(Z.name)),Y=T.filter(Z=>/\.(png|jpe?g|webp|wepb)$/i.test(Z.name)),G=N.map(Z=>({atlas:Z,skeleton:U.find(de=>P(de)===P(Z))})).find(Z=>Z.skeleton),H=(G==null?void 0:G.skeleton)||U[0]||null,ne=(G==null?void 0:G.atlas)||N[0]||null;if(l.value=H,c.value=ne,u.value=Y,!H||!ne||!Y.length){const Z=[!H&&"JSON / SKEL",!ne&&"Atlas",!Y.length&&"纹理图片"].filter(Boolean).join("、");e.spineObject.status="error",e.spineObject.error=`所选文件夹缺少:${Z}`;return}await X()}function B(){t.recalcTotalFrames()}function L(){B(),t.timeline.frame=0}async function X(){var U;const D=l.value,T=c.value;if(!D||!T||!u.value.length){e.spineObject.status="error",e.spineObject.error="请依次选择 Spine 数据、Atlas 和全部纹理图片";return}e.spineObject.status="loading",e.spineObject.error="";try{const N=await Db(D,T,u.value);tu(e.spineObject.id,N),e.spineObject.skeletonFileName=D.name,e.spineObject.atlasFileName=T.name,e.spineObject.textureFileNames=u.value.map(Y=>Y.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 OR(D,T,u.value)}catch(Y){e.spineObject.sourceBundle=null,console.warn("Spine 配置资源嵌入失败",Y)}}catch(N){e.spineObject.status="error",e.spineObject.error=N instanceof Error?N.message:String(N)}}function O(){kl(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,T)=>(se(),he("div",Uk,[T[30]||(T[30]=A("div",{class:"editor-title"},"Spine 属性",-1)),A("label",Xk,[T[15]||(T[15]=A("span",null,"Spine 名称",-1)),Te(A("input",{"onUpdate:modelValue":T[0]||(T[0]=U=>n.spineObject.name=U)},null,512),[[ot,n.spineObject.name]])]),A("div",Yk,[A("label",Vk,[T[16]||(T[16]=A("span",null,"X 位置",-1)),Te(A("input",{"onUpdate:modelValue":T[1]||(T[1]=U=>n.spineObject.x=U),type:"number"},null,512),[[ot,n.spineObject.x,void 0,{number:!0}]])]),A("label",$k,[T[17]||(T[17]=A("span",null,"Y 位置",-1)),Te(A("input",{"onUpdate:modelValue":T[2]||(T[2]=U=>n.spineObject.y=U),type:"number"},null,512),[[ot,n.spineObject.y,void 0,{number:!0}]])]),A("label",Gk,[T[18]||(T[18]=A("span",null,"旋转",-1)),Te(A("input",{"onUpdate:modelValue":T[3]||(T[3]=U=>n.spineObject.rotation=U),type:"number"},null,512),[[ot,n.spineObject.rotation,void 0,{number:!0}]])])]),A("div",jk,[A("label",Hk,[T[19]||(T[19]=A("span",null,"Scale X",-1)),Te(A("input",{"onUpdate:modelValue":T[4]||(T[4]=U=>n.spineObject.scaleX=U),type:"number",step:"0.05"},null,512),[[ot,n.spineObject.scaleX,void 0,{number:!0}]])]),A("label",Wk,[T[20]||(T[20]=A("span",null,"Scale Y",-1)),Te(A("input",{"onUpdate:modelValue":T[5]||(T[5]=U=>n.spineObject.scaleY=U),type:"number",step:"0.05"},null,512),[[ot,n.spineObject.scaleY,void 0,{number:!0}]])]),A("label",zk,[T[21]||(T[21]=A("span",null,"开始时间",-1)),Te(A("input",{"onUpdate:modelValue":T[6]||(T[6]=U=>n.spineObject.timeOffset=U),type:"number",min:"0",step:"0.033333",onChange:B},null,544),[[ot,n.spineObject.timeOffset,void 0,{number:!0}]])])]),T[31]||(T[31]=A("div",{class:"divider"},null,-1)),T[32]||(T[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:I},null,544),A("input",{ref_key:"atlasInput",ref:s,hidden:"",type:"file",accept:".atlas,text/plain",onChange:R},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:F},null,544),A("input",{ref_key:"folderInput",ref:a,hidden:"",type:"file",multiple:"",webkitdirectory:"",directory:"",onChange:k},null,544),A("button",{class:"folder-select",disabled:n.spineObject.status==="loading",onClick:T[7]||(T[7]=U=>{var N;return(N=a.value)==null?void 0:N.click()})},"选择文件夹并加载",8,qk),T[33]||(T[33]=A("div",{class:"folder-hint"},"一次读取文件夹中的 JSON / SKEL、Atlas 和全部纹理;仍可在下方单独替换资源。",-1)),A("div",Kk,[A("div",{class:"asset-name",title:d.value},We(d.value||"JSON / SKEL..."),9,Zk),A("button",{onClick:T[8]||(T[8]=U=>{var N;return(N=i.value)==null?void 0:N.click()})},"选择")]),A("div",Jk,[A("div",{class:"asset-name",title:f.value},We(f.value||"Atlas..."),9,Qk),A("button",{onClick:T[9]||(T[9]=U=>{var N;return(N=s.value)==null?void 0:N.click()})},"选择")]),A("div",eF,[A("div",{class:"asset-name",title:p.value.join(", ")},We(m.value),9,tF),A("button",{onClick:T[10]||(T[10]=U=>{var N;return(N=r.value)==null?void 0:N.click()})},"选择(多选)")]),A("div",iF,[A("button",{class:"load",disabled:n.spineObject.status==="loading",onClick:X},We(n.spineObject.status==="loading"?"加载中…":"↧ 加载"),9,sF),A("button",{class:"clear",onClick:O},"清除")]),A("div",nF,[T[22]||(T[22]=ii(" 支持 Spine 3.8 / 4.0 / 4.1 / 4.2 / 4.3 JSON · 对应版本运行时按需加载 · 本地离线 ",-1)),n.spineObject.dataVersion?(se(),he("span",rF," · 当前资源 "+We(n.spineObject.dataVersion),1)):je("",!0)]),n.spineObject.error?(se(),he("div",aF,We(n.spineObject.error),1)):je("",!0),A("div",oF,[T[25]||(T[25]=A("div",{class:"section-title"},"Spine 动画",-1)),n.spineObject.animations.length?(se(),he("label",cF,[T[24]||(T[24]=A("span",null,"时间轴播放动画",-1)),Te(A("select",{"onUpdate:modelValue":T[11]||(T[11]=U=>n.spineObject.selectedAnimation=U),onChange:L},[T[23]||(T[23]=A("option",{value:""},"无",-1)),(se(!0),he(st,null,ui(n.spineObject.animations,U=>(se(),he("option",{key:U.name,value:U.name},We(U.name)+"("+We(U.duration.toFixed(2))+"s) ",9,hF))),128))],544),[[qt,n.spineObject.selectedAnimation]])])):(se(),he("div",lF,"无可用动画"))]),A("div",uF,[A("div",dF,[T[29]||(T[29]=A("div",{class:"section-title"},"层级树",-1)),A("button",{class:at(["selected-bone",{active:n.spineObject.selectedBone}]),disabled:!n.spineObject.selectedBone,title:n.spineObject.selectedBone?"点击清除骨骼选择":"当前未选择骨骼",onClick:T[12]||(T[12]=U=>n.spineObject.selectedBone="")},[n.spineObject.selectedBone?(se(),he(st,{key:0},[T[26]||(T[26]=ii("清除选中骨骼:",-1)),A("strong",null,We(n.spineObject.selectedBone),1)],64)):(se(),he(st,{key:1},[T[27]||(T[27]=ii("当前骨骼:",-1)),T[28]||(T[28]=A("strong",null,"未选择",-1))],64))],10,fF),n.spineObject.bones.length?(se(),he("button",{key:0,class:"tree-action",onClick:M},We(g.value?"全部展开":"全部折叠"),1)):je("",!0)]),n.spineObject.bones.length?(se(),he("div",pF,[Te(A("input",{"onUpdate:modelValue":T[13]||(T[13]=U=>h.value=U),type:"search","aria-label":"搜索骨骼",placeholder:"搜索骨骼名称…"},null,512),[[ot,h.value,void 0,{trim:!0}]]),h.value?(se(),he("button",{key:0,title:"清空搜索","aria-label":"清空骨骼搜索",onClick:T[14]||(T[14]=U=>h.value="")},"✕")):je("",!0)])):(se(),he("div",mF,"未加载 Spine")),n.spineObject.bones.length&&!b.value.length?(se(),he("div",gF,"未找到匹配的骨骼")):n.spineObject.bones.length?(se(),he("div",vF,[(se(!0),he(st,null,ui(b.value,U=>(se(),he("div",{key:U.name,class:at(["bone",{selected:n.spineObject.selectedBone===U.name}]),style:Di({paddingLeft:`${6+U.depth*16}px`}),role:"button",tabindex:"0",onClick:N=>w(U.name),onKeydown:ha(Ct(N=>w(U.name),["prevent"]),["enter"])},[v.value.has(U.name)?(se(),he("button",{key:0,class:"bone-toggle",title:o.value.has(U.name)?"展开子骨骼":"折叠子骨骼",onClick:Ct(N=>E(U.name),["stop"])},We(o.value.has(U.name)?"▸":"▾"),9,xF)):(se(),he("span",bF,"•")),A("span",wF,We(U.name),1)],46,yF))),128))])):je("",!0)])]))}}),_F=In(SF,[["__scopeId","data-v-9257fb45"]]),TF="3.8";function Ms(n,e,t){n[e]==null&&n[t]!=null&&(n[e]=n[t]),delete n[t]}function sm(n){if(!n||typeof n!="object")return;if(Array.isArray(n)){for(const t of n)sm(t);return}const e=n;Array.isArray(e.curve)&&delete e.curve;for(const t of Object.values(e))sm(t)}function MF(n){for(const e of n.bones)Ms(e,"transform","inherit");for(const e of n.transform||[])Ms(e,"rotateMix","mixRotate"),e.translateMix==null&&(e.translateMix=e.mixX??e.mixY),e.scaleMix==null&&(e.scaleMix=e.mixScaleX??e.mixScaleY),Ms(e,"shearMix","mixShearY"),delete e.mixX,delete e.mixY,delete e.mixScaleX,delete e.mixScaleY;for(const e of n.path||[])Ms(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&&Ms(i,"deform","timelines")}function EF(n){for(const e of Object.values(n.slots||{}))Ms(e,"color","rgba"),Ms(e,"twoColor","rgba2")}function AF(n){for(const e of Object.values(n.bones||{}))for(const t of e.rotate||[])Ms(t,"angle","value")}function CF(n){for(const e of Object.values(n.transform||{}))for(const t of e)Ms(t,"rotateMix","mixRotate"),t.translateMix==null&&(t.translateMix=t.mixX??t.mixY),t.scaleMix==null&&(t.scaleMix=t.mixScaleX??t.mixScaleY),Ms(t,"shearMix","mixShearY"),delete t.mixX,delete t.mixY,delete t.mixScaleX,delete t.mixScaleY}function IF(n){for(const e of Object.values(n.path||{})){for(const t of["position","spacing"])for(const i of e[t]||[])Ms(i,t,"value");for(const t of e.mix||[])Ms(t,"rotateMix","mixRotate"),t.translateMix==null&&(t.translateMix=t.mixX??t.mixY),delete t.mixX,delete t.mixY}}function RF(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 PF(n){n.skeleton.spine=TF,MF(n);for(const e of Object.values(n.animations))EF(e),AF(e),CF(e),IF(e),RF(e);return sm(n.animations),n}function kF(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 Wb(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=kF(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 xv(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 bv(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+xv(n,e,t,r,!0)*i/3,u=o-xv(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 FF(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 OF(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=FF(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 zb(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=bv(n,l,c);let d=-1,f=1;for(let p=l+1;p<c;p++){const m=OF(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)=>bv(n,o,a[h+1]))}}function BF(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 xi(n){if(!Number.isFinite(n))return 0;const e=Math.round(n*1e5)/1e5;return Object.is(e,-0)?0:e}function LF(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=[],v=[];for(let g=0;g<r;g++)v.push({col:g,row:0});for(let g=1;g<s;g++)v.push({col:r-1,row:g});for(let g=r-2;g>=0;g--)v.push({col:g,row:s-1});for(let g=s-2;g>=1;g--)v.push({col:0,row:g});const y=v.length;for(let g=1;g<r-1;g++)for(let w=1;w<s-1;w++)v.push({col:g,row:w});const b=new Map;for(let g=0;g<v.length;g++){const{col:w,row:E}=v[g];b.set(`${w}:${E}`,g);const M=w/(r-1),_=M*(a-1),I=Math.min(a-1,Math.floor(_)),R=Math.min(a-1,I+1),F=_-I,P=E/(s-1),k=.5+c*(M-.5)-u*(P-.5),B=.5+u*(M-.5)+c*(P-.5);d.push(xi(k),xi(B));const L=(.5-P)*h;I===R||F<1e-6?p.push(1,t[I],0,xi(L),1):p.push(2,t[I],0,xi(L),xi(1-F),t[R],0,xi(L),xi(F))}for(let g=0;g<r-1;g++)for(let w=0;w<s-1;w++){const E=b.get(`${g}:${w}`),M=b.get(`${g+1}:${w}`),_=b.get(`${g}:${w+1}`),I=b.get(`${g+1}:${w+1}`);f.push(E,M,_,M,I,_)}for(let g=0;g<y;g++)m.push(g*2,(g+1)%y*2);return{type:"mesh",path:i,uvs:d,triangles:f,vertices:p,hull:y,edges:m,width:o,height:h}}const wv={normal:"normal",add:"additive",multiply:"multiply",screen:"screen"},Sv=.1,_v=.1,Tv=.01,yc=.01;function DF(n,e){return String(n||"").trim().replace(/[\\/:*?"<>|\s]+/g,"_").replace(/^_+|_+$/g,"")||e}function qb(n,e){let t=n,i=2;for(;e.has(t);)t=`${n}_${i++}`;return e.add(t),t}function NF(n){return n.replace(/\.[^./\\]+$/,"")}function Kb(n,e){return NF([n,e].filter(Boolean).join("/").replace(/\\/g,"/").replace(/\/{2,}/g,"/").replace(/^\.\//,""))}function UF(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 xc(n){return Math.round(Math.max(0,Math.min(1,n))*255).toString(16).padStart(2,"0")}function Mv(n,e){return[(n>>16&255)/255,(n>>8&255)/255,(n&255)/255,Math.max(0,Math.min(1,e))]}function rl(n,e){return xi(n/e)}function XF(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+Ir(t,e).total/e,Math.max(1,Math.ceil(r*e)+1)}function bh(n,e){return e?n.boneName:`${n.spawnId??"legacy"}_${n.boneName}`}function YF(n,e,t){const i=new Set;for(const s of n)for(const r of s)i.add(bh(r,e));return[...i].sort().map((s,r)=>({key:s,name:qb(`_particle_${String(r).padStart(3,"0")}`,t),states:n.map(a=>a.find(o=>bh(o,e)===s)||null)}))}function VF(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||bh(o,!0)!==bh(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 Ev(n,e){return!n||n==="跟随导出"?e.keyframeCurve:n==="贝塞尔"?"bezier":"linear"}function Da(n,e,t,i,s,r=new Set,a=s.keyframeCurve){if(!n.length)return[];const o=a==="bezier"&&s.spineVersion!=="3.8"?zb(n,i,r):{samples:Wb(n,i,r),controls:[]},h=o.samples.map(l=>{const c={time:rl(l.frame,e)};return t.forEach((u,d)=>{c[u]=xi(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(xi(c+(u-c)/3),xi(p[0]),xi(c+(u-c)*2/3),xi(p[1]))}h[l].curve=d}return h}function $F(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 GF(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 jF(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 HF(n,e,t){const i=[];let s=Symbol();return n.forEach((r,a)=>{r!==s&&(i.push(t(r,a)),s=r)}),i}function WF(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=UF(r);(!a.width||!a.height)&&t.push({code:"missing-image",message:`图片“${s}”缺失或尺寸不可读,已保留路径。`});const o=a.width||1,h=a.height||1;return{path:Kb(n.textureFolder,s),x:xi((.5-n.anchorX)*o),y:xi((n.anchorY-.5)*h),width:xi(o),height:xi(h)}}function zF(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"?zb(a,[o,o,o,.01],r):{samples:Wb(a,[o,o,o,.01],r),controls:[]},l=h.samples.map(c=>({time:rl(c.frame,t),color:`${xc(c.values[0])}${xc(c.values[1])}${xc(c.values[2])}${xc(c.values[3])}`}));if(h.controls.length)for(let c=0;c<h.controls.length;c++){const u=rl(h.samples[c].frame,t),d=rl(h.samples[c+1].frame,t),f=[];for(let p=0;p<4;p++){const m=h.controls[c].values[p];f.push(xi(u+(d-u)/3),xi(m[0]),xi(u+(d-u)*2/3),xi(m[1]))}l[c].curve=f}return l}function Av(n,e,t,i,s,r,a=r.keyframeCurve){var c;const o=(c=n.slots)[e]||(c[e]={}),h=HF(t,s,(u,d)=>({time:rl(d,s),name:u??null}));h.length&&(o.attachment=h);const l=zF(i,t,s,r,a);l.length&&(o.rgba=l)}function Cv(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 v=Math.min(((p=m.frames)==null?void 0:p.length)||0,XF(m,t)),y=(m.frames||[]).slice(0,v);y.length||r.push({code:"empty-cache",message:`“${m.config.name}”没有可用帧缓存。`});const b=qb(DF(m.config.name,`system_${m.id}`),l);o.bones.push({name:b,parent:"root"});const g=YF(y,e.bonePool,l),w=Math.max(0,(v-1)/t),E=Math.max(1,Math.ceil(w*s)+1),M=u.get(m.animation)||[];M.push({system:m,tracks:g,targetFrames:E}),u.set(m.animation,M);for(const _ of g){o.bones.push({name:_.name,parent:b});const I=new Set(m.config.imageResources.map(k=>k.blend));for(const k of I){const B=`${_.name}_image_${k}`;o.slots.push({name:B,bone:_.name,color:"ffffff00",blend:wv[k]});const L=h[B]||(h[B]={});for(const X of m.config.imageResources.filter(O=>O.blend===k)){const O=X.imageMode==="sequence"?Math.max(1,X.sequenceFrames.length):1;for(let D=0;D<O;D++)L[`image_${X.id}_${D}`]=WF(X,D,r)}}if(m.config.trail)for(const k of m.config.trailResources){if(!_.states.some(T=>{var U;return((U=T==null?void 0:T.trailState)==null?void 0:U.resourceId)===k.id}))continue;const B=Math.max(2,Math.min(16,Math.round(k.boneCount||3))),L=[];for(let T=0;T<B;T++){const U=`${_.name}_trail_${k.id}_${T}`;L.push(U),o.bones.push({name:U,parent:b})}const X=`${_.name}_trail_${k.id}`;o.slots.push({name:X,bone:L[0],color:"ffffff00",blend:wv[k.blend]});const O=L.map(T=>o.bones.findIndex(U=>U.name===T)),D=Kb("",k.textureName||`trail_${k.id}`);(h[X]||(h[X]={}))[`trail_${k.id}`]=LF(m.config,k,O,D),k.texture||r.push({code:"missing-image",message:`拖尾图片“${k.textureName||k.id}”缺失,已保留路径。`})}const R=`${_.name}_image_`,F=`${_.name}_trail_`,P=o.slots.filter(k=>String(k.name).startsWith(R)||String(k.name).startsWith(F));P.length&&(o.slots=o.slots.filter(k=>!P.includes(k)),o.slots.push(...P.filter(k=>String(k.name).startsWith(F)),...P.filter(k=>String(k.name).startsWith(R))))}}for(const m of c){const v=u.get(m)||[],y={bones:{},slots:{}};let b=!1;for(const{system:g,tracks:w,targetFrames:E}of v)for(const M of w){const _=Array.from({length:E},(N,Y)=>VF(M,Y,t,s)),I=_.map(N=>!!(N!=null&&N.active)),R=[],F=[],P=[];_.forEach((N,Y)=>{N!=null&&N.active&&(R.push({frame:Y,values:[N.worldX??N.x,N.worldY??N.y]}),F.push(N.worldRotation??N.rotation),P.push({frame:Y,values:[N.worldScaleX??N.scaleX,N.worldScaleY??N.scaleY]}))});const k=BF(F),B=R.map((N,Y)=>({frame:N.frame,values:[k[Y]??0]})),L=$F(_),X={},O=Da(R,s,["x","y"],[Sv,Sv],e,L),D=Da(B,s,["value"],[Tv],e,L),T=Da(P,s,["x","y"],[yc,yc],e,L);O.length&&(X.translate=O),D.length&&(X.rotate=D),T.length&&(X.scale=T),Object.keys(X).length&&(y.bones[M.name]=X,b=!0);const U=new Set(g.config.imageResources.map(N=>N.blend));for(const N of U){const Y=[],G=[];let H=16777215;for(let me=0;me<E;me++){const _e=_[me],Ae=_e?g.config.imageResources.find(Ee=>Ee.id===_e.resourceId):void 0,ge=!!_e&&I[me]&&_e.imageVisible!==!1&&(Ae==null?void 0:Ae.blend)===N;_e&&(Ae==null?void 0:Ae.blend)===N&&(H=_e.colorHex),Y.push(ge?`image_${Ae.id}_${_e.imageFrameIndex??0}`:null),G.push(Mv(H,ge?_e.alpha:0))}const Z=g.config.imageResources.filter(me=>me.blend===N).filter(me=>me.independentAlpha==="curve").map(me=>Ev(me.alphaCurveMode,e)),de=Z.length?Z.includes("bezier")?"bezier":"linear":Ev(g.config.alphaMode==="curve"?g.config.curveMode:void 0,e);Av(y,`${M.name}_image_${N}`,Y,G,s,e,de),Y.some(Boolean)&&(b=!0)}if(g.config.trail)for(const N of g.config.trailResources){const Y=Math.max(2,Math.min(16,Math.round(N.boneCount||3))),G=_.map(Ee=>{var j;return((j=Ee==null?void 0:Ee.trailState)==null?void 0:j.resourceId)===N.id?Ee.trailState:void 0}),H=G.find(Ee=>!!Ee);if(!H)continue;const ne=GF(G),Z=N.widthSizeMode==="random"?Math.max(1,Number(N.widthMin)||0,Number(N.widthMax)||0):Math.max(.001,Number(N.width)||100);let de=H;const me=G.map(Ee=>(Ee&&(de=Ee),de));for(let Ee=0;Ee<Y;Ee++){const j=[],K=[],q=[],W=new Set(ne),Q=jF(N,Ee/Math.max(1,Y-1));me.forEach((Ue,Re)=>{const Fe=Ue==null?void 0:Ue.bones[Math.min(Ue.bones.length-1,Ee)];if(!Fe)return;const it={x:Fe.worldX??Fe.x,y:Fe.worldY??Fe.y,rotation:Fe.worldRotation??-Fe.rotation};j.push({frame:Re,values:[it.x,it.y]}),K.push({frame:Re,values:[it.rotation]}),q.push({frame:Re,values:[1,Math.max(0,Ue.width/Z)*Q]})});const le=`${M.name}_trail_${N.id}_${Ee}`,xe={},ae=Da(j,s,["x","y"],[_v,_v],e,W),we=Da(K,s,["value"],[Tv],e,W),ce=Da(q,s,["x","y"],[yc,yc],e,W);ae.length&&(xe.translate=ae),we.length&&(xe.rotate=we),ce.length&&(xe.scale=ce),Object.keys(xe).length&&(y.bones[le]=xe)}const _e=G.map(()=>`trail_${N.id}`);let Ae=H.colorHex;const ge=G.map(Ee=>(Ee&&(Ae=Ee.colorHex),Mv(Ae,Ee?Ee.alpha:0)));Av(y,`${M.name}_trail_${N.id}`,_e,ge,s,e),b=!0}}(b||!e.excludeEmptyAnimations)&&(o.animations[m]=y)}!Object.keys(o.animations).length&&!e.excludeEmptyAnimations&&(o.animations.animation={bones:{},slots:{}});const d=e.spineVersion==="3.8"?PF(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 qF(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 tU{constructor(){x(this,"array",[])}add(e){const t=this.contains(e);return this.array[e|0]=e|0,!t}contains(e){return this.array[e|0]!==void 0}remove(e){this.array[e|0]=void 0}clear(){this.array.length=0}}class KF{constructor(){x(this,"entries",{});x(this,"size",0)}add(e){const t=this.entries[e];return this.entries[e]=!0,t?!1:(this.size++,!0)}addAll(e){const t=this.size;for(let i=0,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 ms=class ms{constructor(e=0,t=0,i=0,s=0){x(this,"r");x(this,"g");x(this,"b");x(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 ms){return t.setFromString(e)}};x(ms,"WHITE",new ms(1,1,1,1)),x(ms,"RED",new ms(1,0,0,1)),x(ms,"GREEN",new ms(0,1,0,1)),x(ms,"BLUE",new ms(0,0,1,1)),x(ms,"MAGENTA",new ms(1,0,1,1));let vt=ms;const oi=class oi{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.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 oi.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}};x(oi,"epsilon",1e-5),x(oi,"epsilon2",oi.epsilon*oi.epsilon),x(oi,"PI",3.1415927),x(oi,"PI2",oi.PI*2),x(oi,"invPI2",1/oi.PI2),x(oi,"radiansToDegrees",180/oi.PI),x(oi,"radDeg",oi.radiansToDegrees),x(oi,"degreesToRadians",oi.PI/180),x(oi,"degRad",oi.degreesToRadians);let Xe=oi;const Ss=class Ss{apply(e,t,i){return t===void 0||i===void 0?this.applyInternal(e):e+(t-e)*this.applyInternal(i)}};x(Ss,"linear",new class extends Ss{applyInternal(e){return e}}),x(Ss,"smooth",new class extends Ss{applyInternal(e){return e*e*(3-2*e)}}),x(Ss,"slowFast",new class extends Ss{applyInternal(e){return e*e}}),x(Ss,"fastSlow",new class extends Ss{applyInternal(e){return(e-1)*(e-1)*-1+1}}),x(Ss,"circle",new class extends Ss{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 lo=Ss;class ZF extends lo{constructor(t){super();x(this,"power",2);this.power=t}applyInternal(t){return t<=.5?Math.pow(t*2,this.power)/2:Math.pow((t-1)*2,this.power)/(this.power%2===0?-2:2)+1}}class iU extends ZF{constructor(e){super(e)}applyInternal(e){return Math.pow(e-1,this.power)*(this.power%2===0?-1:1)+1}}const wr=class wr{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:wr.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(wr.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(wr.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 wr.SUPPORTS_TYPED_ARRAYS?new Float32Array(e):e}static toSinglePrecision(e){return wr.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)]}};x(wr,"SUPPORTS_TYPED_ARRAYS",typeof Float32Array<"u");let rt=wr;class sU{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 JF{constructor(e){x(this,"items",[]);x(this,"instantiator");this.instantiator=e}obtain(){return this.items.length>0?this.items.pop():this.instantiator()}free(e){var t;(t=e.reset)==null||t.call(e),this.items.push(e)}freeAll(e){for(let t=0;t<e.length;t++)this.free(e[t])}clear(){this.items.length=0}}class Iv{constructor(e=0,t=0){x(this,"x");x(this,"y");this.x=e,this.y=t}set(e,t){return this.x=e,this.y=t,this}length(){const e=this.x,t=this.y;return Math.sqrt(e*e+t*t)}normalize(){const e=this.length();return e!==0&&(this.x/=e,this.y/=e),this}}class nU{constructor(){x(this,"maxDelta",.064);x(this,"framesPerSecond",0);x(this,"delta",0);x(this,"totalTime",0);x(this,"lastTime",Date.now()/1e3);x(this,"frameCount",0);x(this,"frameTime",0)}update(){const e=Date.now()/1e3;this.delta=e-this.lastTime,this.frameTime+=this.delta,this.totalTime+=this.delta,this.delta>this.maxDelta&&(this.delta=this.maxDelta),this.lastTime=e,this.frameCount++,this.frameTime>1&&(this.framesPerSecond=this.frameCount/this.frameTime,this.frameTime=0,this.frameCount=0)}}class rU{constructor(e=32){x(this,"values");x(this,"addedValues",0);x(this,"lastValue",0);x(this,"mean",0);x(this,"dirty",!0);this.values=new Array(e)}hasEnoughData(){return this.addedValues>=this.values.length}addValue(e){this.addedValues<this.values.length&&this.addedValues++,this.values[this.lastValue++]=e,this.lastValue>this.values.length-1&&(this.lastValue=0),this.dirty=!0}getMean(){if(this.hasEnoughData()){if(this.dirty){let e=0;for(let t=0;t<this.values.length;t++)e+=this.values[t];this.mean=e/this.values.length,this.dirty=!1}return this.mean}return 0}}class QF{constructor(e){x(this,"_image");this._image=e}getImage(){return this._image}}var mo;(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"})(mo||(mo={}));var po;(function(n){n[n.MirroredRepeat=33648]="MirroredRepeat",n[n.ClampToEdge=33071]="ClampToEdge",n[n.Repeat=10497]="Repeat"})(po||(po={}));class Zb{constructor(){x(this,"texture");x(this,"u",0);x(this,"v",0);x(this,"u2",0);x(this,"v2",0);x(this,"width",0);x(this,"height",0);x(this,"degrees",0);x(this,"offsetX",0);x(this,"offsetY",0);x(this,"originalWidth",0);x(this,"originalHeight",0)}}class aU extends QF{setFilters(e,t){}setWraps(e,t){}dispose(){}}class oU{constructor(e){x(this,"pages",[]);x(this,"regions",[]);const t=new e3(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=rt.enumValue(mo,i[1]),c.magFilter=rt.enumValue(mo,i[2])},s.repeat=c=>{i[1].indexOf("x")!==-1&&(c.uWrap=po.Repeat),i[1].indexOf("y")!==-1&&(c.vWrap=po.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 Jb(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 t3(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 e3{constructor(e){x(this,"lines");x(this,"index",0);this.lines=e.split(/\r\n|\r|\n/)}readLine(){return this.index>=this.lines.length?null:this.lines[this.index++]}readEntry(e,t){if(!t||(t=t.trim(),t.length===0))return 0;const i=t.indexOf(":");if(i===-1)return 0;e[0]=t.substr(0,i).trim();for(let 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 t3{constructor(e){x(this,"name");x(this,"minFilter",mo.Nearest);x(this,"magFilter",mo.Nearest);x(this,"uWrap",po.ClampToEdge);x(this,"vWrap",po.ClampToEdge);x(this,"texture",null);x(this,"width",0);x(this,"height",0);x(this,"pma",!1);x(this,"regions",[]);this.name=e}setTexture(e){this.texture=e,e.setFilters(this.minFilter,this.magFilter),e.setWraps(this.uWrap,this.vWrap);for(const t of this.regions)t.texture=e}}class Jb extends Zb{constructor(t,i){super();x(this,"page");x(this,"name");x(this,"x",0);x(this,"y",0);x(this,"offsetX",0);x(this,"offsetY",0);x(this,"originalWidth",0);x(this,"originalHeight",0);x(this,"index",0);x(this,"degrees",0);x(this,"names",null);x(this,"values",null);this.page=t,this.name=i,t.regions.push(this)}}const Eh=class Eh{constructor(e){x(this,"name");x(this,"timelineAttachment");x(this,"timelineSlots",Eh.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}};x(Eh,"empty",[]);let wh=Eh;const Ah=class Ah extends wh{constructor(t){super(t);x(this,"id",Ah.nextID++);x(this,"bones",null);x(this,"vertices",[]);x(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,v=m.worldX,y=m.worldY,b=m.a,g=m.b,w=m.c,E=m.d;for(let M=s,_=o;_<r;M+=2,_+=h){const I=c[M],R=c[M+1];a[_]=I*b+R*g+v,a[_+1]=I*w+R*E+y}return}let d=0,f=0;for(let m=0;m<s;m+=2){const v=u[d];d+=v+1,f+=v}const p=t.bones;if(l.length===0)for(let m=o,v=f*3;m<r;m+=h){let y=0,b=0,g=u[d++];for(g+=d;d<g;d++,v+=3){const w=p[u[d]].appliedPose,E=c[v],M=c[v+1],_=c[v+2];y+=(E*w.a+M*w.b+w.worldX)*_,b+=(E*w.c+M*w.d+w.worldY)*_}a[m]=y,a[m+1]=b}else{const m=l;for(let v=o,y=f*3,b=f<<1;v<r;v+=h){let g=0,w=0,E=u[d++];for(E+=d;d<E;d++,y+=3,b+=2){const M=p[u[d]].appliedPose,_=c[y]+m[b],I=c[y+1]+m[b+1],R=c[y+2];g+=(_*M.a+I*M.b+M.worldX)*R,w+=(_*M.c+I*M.d+M.worldY)*R}a[v]=g,a[v+1]=w}}}copyTo(t){this.bones?(t.bones=[],rt.arrayCopy(this.bones,0,t.bones,0,this.bones.length)):t.bones=null,this.vertices&&(t.vertices=rt.newFloatArray(this.vertices.length),rt.arrayCopy(this.vertices,0,t.vertices,0,this.vertices.length)),t.worldVerticesLength=this.worldVerticesLength,t.timelineAttachment=this.timelineAttachment,t.timelineSlots=this.timelineSlots}};x(Ah,"nextID",0);let or=Ah;class Br extends or{constructor(t,i){super(t);x(this,"sequence");x(this,"regionUVs",[]);x(this,"triangles",[]);x(this,"hullLength",0);x(this,"path");x(this,"color",new vt(1,1,1,1));x(this,"sourceMesh",null);x(this,"edges",[]);x(this,"width",0);x(this,"height",0);x(this,"tempColor",new vt(0,0,0,0));this.sequence=i}copy(){if(this.sourceMesh)return this.newLinkedMesh();const t=new Br(this.name,this.sequence.copy());return t.path=this.path,t.color.setFromColor(this.color),this.copyTo(t),t.regionUVs=[],rt.arrayCopy(this.regionUVs,0,t.regionUVs,0,this.regionUVs.length),t.triangles=[],rt.arrayCopy(this.triangles,0,t.triangles,0,this.triangles.length),t.hullLength=this.hullLength,this.edges&&(t.edges=[],rt.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 Br(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 Jb){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 Ot=class Ot extends wh{constructor(t,i){super(t);x(this,"sequence");x(this,"x",0);x(this,"y",0);x(this,"scaleX",1);x(this,"scaleY",1);x(this,"rotation",0);x(this,"width",0);x(this,"height",0);x(this,"path");x(this,"color",new vt(1,1,1,1));x(this,"tempColor",new vt(1,1,1,1));this.sequence=i}copy(){const t=new Ot(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,v=p+t.width*d,y=m+t.height*f,b=o*Xe.degRad,g=Math.cos(b),w=Math.sin(b),E=p*g+i,M=p*w,_=m*g+s,I=m*w,R=v*g+i,F=v*w,P=y*g+s,k=y*w;c[0]=E-I,c[1]=_+M,c[2]=E-k,c[3]=P+M,c[4]=R-k,c[5]=P+F,c[6]=R-I,c[7]=_+F,t==null?(u[0]=0,u[1]=0,u[2]=0,u[3]=1,u[4]=1,u[5]=1,u[6]=1,u[7]=0):(u[1]=t.v2,u[2]=t.u,u[5]=t.v,u[6]=t.u2,t.degrees===90?(u[0]=t.u2,u[3]=t.v2,u[4]=t.u,u[7]=t.v):(u[0]=t.u,u[3]=t.v,u[4]=t.u2,u[7]=t.v2))}};x(Ot,"X1",0),x(Ot,"Y1",1),x(Ot,"C1R",2),x(Ot,"C1G",3),x(Ot,"C1B",4),x(Ot,"C1A",5),x(Ot,"U1",6),x(Ot,"V1",7),x(Ot,"X2",8),x(Ot,"Y2",9),x(Ot,"C2R",10),x(Ot,"C2G",11),x(Ot,"C2B",12),x(Ot,"C2A",13),x(Ot,"U2",14),x(Ot,"V2",15),x(Ot,"X3",16),x(Ot,"Y3",17),x(Ot,"C3R",18),x(Ot,"C3G",19),x(Ot,"C3B",20),x(Ot,"C3A",21),x(Ot,"U3",22),x(Ot,"V3",23),x(Ot,"X4",24),x(Ot,"Y4",25),x(Ot,"C4R",26),x(Ot,"C4G",27),x(Ot,"C4B",28),x(Ot,"C4A",29),x(Ot,"U4",30),x(Ot,"V4",31);let go=Ot;const za=class za{constructor(e,t){x(this,"id",za.nextID());x(this,"regions");x(this,"pathSuffix");x(this,"uvs");x(this,"offsets");x(this,"start",0);x(this,"digits",0);x(this,"setupIndex",0);this.regions=new Array(e),this.pathSuffix=t}copy(){const e=this.regions.length,t=new za(e,this.pathSuffix);if(rt.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]=rt.newFloatArray(i),rt.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]=[],rt.arrayCopy(this.offsets[i],0,t.offsets[i],0,8)}return t}update(e){const t=this.regions.length;if(e instanceof go){this.uvs=[],this.offsets=[];for(let i=0;i<t;i++)this.uvs[i]=rt.newFloatArray(8),this.offsets[i]=[],go.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 Br){const i=e.regionUVs;this.uvs=[],this.offsets=void 0;for(let s=0;s<t;s++)this.uvs[s]=rt.newFloatArray(i.length),Br.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 za._nextID++}};x(za,"_nextID",0);let vo=za;var Ui;(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"})(Ui||(Ui={}));const Qb=[Ui.hold,Ui.once,Ui.loop,Ui.pingpong,Ui.onceReverse,Ui.loopReverse,Ui.pingpongReverse];class up{constructor(e,t,i){x(this,"name");x(this,"timelines",[]);x(this,"timelineIds");x(this,"bones");x(this,"color",new vt(1,1,1,1));x(this,"duration");if(!e)throw new Error("name cannot be null.");this.name=e,this.duration=i,this.timelineIds=new KF,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),s3(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 tt;(function(n){n[n.current=0]="current",n[n.setup=1]="setup",n[n.first=2]="first"})(tt||(tt={}));var pt;(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"})(pt||(pt={}));let Jt=class{constructor(e,...t){x(this,"propertyIds");x(this,"frames");x(this,"additive",!1);x(this,"instant",!1);this.propertyIds=t,this.frames=rt.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 i3(n){return typeof n=="object"&&n!==null&&typeof n.slotIndex=="number"}class Ta extends Jt{constructor(t,i,...s){super(t,...s);x(this,"curves");this.curves=rt.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=rt.newFloatArray(i);rt.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,v=(a-h*2+c)*.03,y=((o-l)*3-r+u)*.006,b=((h-c)*3-a+d)*.006;let g=m*2+y,w=v*2+b,E=(o-r)*.3+m+y*.16666667,M=(h-a)*.3+v+b*.16666667,_=r+E,I=a+M;for(let R=p+18;p<R;p+=2)f[p]=_,f[p+1]=I,E+=g,M+=w,g+=y,w+=b,_+=E,I+=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 qn extends Ta{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 qn.beforeFirstKey(i,t,r,a);const o=this.getCurveValue(e);return i===tt.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 qn.beforeFirstKey(i,t,r,a);const o=this.getCurveValue(e);return i===tt.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]?qn.beforeFirstKey(i,t,r,a):i===tt.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 qn.beforeFirstKey(i,t,a,o);const h=this.getCurveValue(e)*o;if(t===1&&!s)return h;let l=i===tt.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 tt.setup:return s;case tt.first:return i+(s-i)*t;case tt.current:return i}}}function s3(n){return typeof n=="object"&&n!==null&&typeof n.boneIndex=="number"}class Ma extends qn{constructor(t,i,s,r){super(t,i,`${r}|${s}`);x(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 dp extends Ta{constructor(t,i,s,r,a){super(t,i,`${r}|${s}`,`${a}|${s}`);x(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 Sh extends Ma{constructor(e,t,i){super(e,t,i,pt.rotate)}apply1(e,t,i,s,r,a,o){e.rotation=this.getRelativeValue(i,s,r,a,e.rotation,t.rotation)}}class ew extends dp{constructor(e,t,i){super(e,t,i,pt.x,pt.y)}apply1(e,t,i,s,r,a,o){const h=this.frames;if(i<h[0]){switch(r){case tt.setup:e.x=t.x,e.y=t.y;break;case tt.first:e.x+=(t.x-e.x)*s,e.y+=(t.y-e.y)*s;break}return}let l=0,c=0;const u=Jt.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===tt.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 tw extends Ma{constructor(e,t,i){super(e,t,i,pt.x)}apply1(e,t,i,s,r,a,o){e.x=this.getRelativeValue(i,s,r,a,e.x,t.x)}}class iw extends Ma{constructor(e,t,i){super(e,t,i,pt.y)}apply1(e,t,i,s,r,a,o){e.y=this.getRelativeValue(i,s,r,a,e.y,t.y)}}class sw extends dp{constructor(e,t,i){super(e,t,i,pt.scaleX,pt.scaleY)}apply1(e,t,i,s,r,a,o){const h=this.frames;if(i<h[0]){switch(r){case tt.setup:e.scaleX=t.scaleX,e.scaleY=t.scaleY;break;case tt.first:e.scaleX+=(t.scaleX-e.scaleX)*s,e.scaleY+=(t.scaleY-e.scaleY)*s;break}return}let l,c;const u=Jt.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===tt.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 nw extends Ma{constructor(e,t,i){super(e,t,i,pt.scaleX)}apply1(e,t,i,s,r,a,o){e.scaleX=this.getScaleValue(i,s,r,a,o,e.scaleX,t.scaleX)}}class rw extends Ma{constructor(e,t,i){super(e,t,i,pt.scaleY)}apply1(e,t,i,s,r,a,o){e.scaleY=this.getScaleValue(i,s,r,a,o,e.scaleY,t.scaleY)}}class aw extends dp{constructor(e,t,i){super(e,t,i,pt.shearX,pt.shearY)}apply1(e,t,i,s,r,a,o){const h=this.frames;if(i<h[0]){switch(r){case tt.setup:e.shearX=t.shearX,e.shearY=t.shearY;break;case tt.first:e.shearX+=(t.shearX-e.shearX)*s,e.shearY+=(t.shearY-e.shearY)*s;break}return}let l=0,c=0;const u=Jt.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===tt.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 ow extends Ma{constructor(e,t,i){super(e,t,i,pt.shearX)}apply1(e,t,i,s,r,a,o){e.shearX=this.getRelativeValue(i,s,r,a,e.shearX,t.shearX)}}class lw extends Ma{constructor(e,t,i){super(e,t,i,pt.shearY)}apply1(e,t,i,s,r,a,o){e.shearY=this.getRelativeValue(i,s,r,a,e.shearY,t.shearY)}}class cw extends Jt{constructor(t,i){super(t,`${pt.inherit}|${i}`);x(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!==tt.current&&(d.inherit=u.data.setupPose.inherit);else{const f=this.frames;s<f[0]?o!==tt.current&&(d.inherit=u.data.setupPose.inherit):d.inherit=this.frames[Jt.search(f,s,2)+1]}}}class ru extends Ta{constructor(t,i,s,...r){super(t,i,...r);x(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 hw extends ru{constructor(e,t,i){super(e,t,i,`${pt.rgb}|${i}`,`${pt.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 tt.setup:o.setFromColor(m);break;case tt.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=Jt.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 v=(i-m)/(h[f+5]-m);l+=(h[f+5+1]-l)*v,c+=(h[f+5+2]-c)*v,u+=(h[f+5+3]-u)*v,d+=(h[f+5+4]-d)*v;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===tt.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 uw extends ru{constructor(e,t,i){super(e,t,i,`${pt.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 tt.setup:{o.r=p.r,o.g=p.g,o.b=p.b;break}case tt.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=Jt.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===tt.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 dw extends qn{constructor(t,i,s){super(t,i,`${pt.alpha}|${s}`);x(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 tt.setup:d.a=m;break;case tt.first:d.a+=(m-d.a)*a;break}return}if(f=this.getCurveValue(s),a!==1)if(o===tt.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 fw extends ru{constructor(e,t,i){super(e,t,i,`${pt.rgb}|${i}`,`${pt.alpha}|${i}`,`${pt.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 g=e.data.setupPose,w=g.color,E=g.darkColor;switch(r){case tt.setup:{o.setFromColor(w),h.r=E.r,h.g=E.g,h.b=E.b;break}case tt.first:{o.add((w.r-o.r)*s,(w.g-o.g)*s,(w.b-o.b)*s,(w.a-o.a)*s),h.r+=(E.r-h.r)*s,h.g+=(E.g-h.g)*s,h.b+=(E.b-h.b)*s;break}}return}let f=0,p=0,m=0,v=0;const y=Jt.search(d,i,8),b=this.curves[y>>3];switch(b){case 0:{const g=d[y];f=d[y+1],p=d[y+2],m=d[y+3],v=d[y+4],l=d[y+5],c=d[y+6],u=d[y+7];const w=(i-g)/(d[y+8]-g);f+=(d[y+8+1]-f)*w,p+=(d[y+8+2]-p)*w,m+=(d[y+8+3]-m)*w,v+=(d[y+8+4]-v)*w,l+=(d[y+8+5]-l)*w,c+=(d[y+8+6]-c)*w,u+=(d[y+8+7]-u)*w;break}case 1:f=d[y+1],p=d[y+2],m=d[y+3],v=d[y+4],l=d[y+5],c=d[y+6],u=d[y+7];break;default:f=this.getBezierValue(i,y,1,b-2),p=this.getBezierValue(i,y,2,b+18-2),m=this.getBezierValue(i,y,3,b+36-2),v=this.getBezierValue(i,y,4,b+54-2),l=this.getBezierValue(i,y,5,b+72-2),c=this.getBezierValue(i,y,6,b+90-2),u=this.getBezierValue(i,y,7,b+108-2)}if(s===1)o.set(f,p,m,v);else if(r===tt.setup){const g=e.data.setupPose;let w=g.color;o.set(w.r+(f-w.r)*s,w.g+(p-w.g)*s,w.b+(m-w.b)*s,w.a+(v-w.a)*s),w=g.darkColor,l=w.r+(l-w.r)*s,c=w.g+(c-w.g)*s,u=w.b+(u-w.b)*s}else o.add((f-o.r)*s,(p-o.g)*s,(m-o.b)*s,(v-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 mw extends ru{constructor(e,t,i){super(e,t,i,`${pt.rgb}|${i}`,`${pt.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 b=e.data.setupPose,g=b.color,w=b.darkColor;switch(r){case tt.setup:o.r=g.r,o.g=g.g,o.b=g.b,h.r=w.r,h.g=w.g,h.b=w.b;break;case tt.first:o.r+=(g.r-o.r)*s,o.g+=(g.g-o.g)*s,o.b+=(g.b-o.b)*s,h.r+=(w.r-h.r)*s,h.g+=(w.g-h.g)*s,h.b+=(w.b-h.b)*s;break}return}const v=Jt.search(m,i,7),y=this.curves[v/7];switch(y){case 0:{const b=m[v];l=m[v+1],c=m[v+2],u=m[v+3],d=m[v+4],f=m[v+5],p=m[v+6];const g=(i-b)/(m[v+7]-b);l+=(m[v+7+1]-l)*g,c+=(m[v+7+2]-c)*g,u+=(m[v+7+3]-u)*g,d+=(m[v+7+4]-d)*g,f+=(m[v+7+5]-f)*g,p+=(m[v+7+6]-p)*g;break}case 1:l=m[v+1],c=m[v+2],u=m[v+3],d=m[v+4],f=m[v+5],p=m[v+6];break;default:l=this.getBezierValue(i,v,1,y-2),c=this.getBezierValue(i,v,2,y+18-2),u=this.getBezierValue(i,v,3,y+36-2),d=this.getBezierValue(i,v,4,y+54-2),f=this.getBezierValue(i,v,5,y+72-2),p=this.getBezierValue(i,v,6,y+90-2)}if(s!==1)if(r===tt.setup){const b=e.data.setupPose;let g=b.color;l=g.r+(l-g.r)*s,c=g.g+(c-g.g)*s,u=g.b+(u-g.b)*s,g=b.darkColor,d=g.r+(d-g.r)*s,f=g.g+(f-g.g)*s,p=g.b+(p-g.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 al extends Jt{constructor(t,i){super(t,`${pt.attachment}|${i}`);x(this,"slotIndex",0);x(this,"attachmentNames");this.slotIndex=i,this.attachmentNames=new Array(t),this.instant=!0}getFrameCount(){return this.frames.length}setFrame(t,i,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!==tt.current&&this.setAttachment(t,d,u.data.attachmentName):this.setAttachment(t,d,this.attachmentNames[Jt.search(this.frames,s)])}setAttachment(t,i,s){i.setAttachment(s?t.getAttachment(this.slotIndex,s):null)}}class pw extends Ta{constructor(t,i,s,r){super(t,i,`${pt.deform}|${s}|${r.id}`);x(this,"slotIndex");x(this,"attachment");x(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,v=c*.03-h*.06,y=((o-l)*3-r+u)*.006,b=(h-c+.33333333)*.018;let g=m*2+y,w=v*2+b,E=(o-r)*.3+m+y*.16666667,M=h*.3+v+b*.16666667,_=r+E,I=M;for(let R=p+18;p<R;p+=2)f[p]=_,f[p+1]=I,E+=g,M+=w,g+=y,w+=b,_+=E,I+=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 b of d)this.applyBeforeFirst(u[b],c,a,o);return}let p,m,v;if(s>=f[f.length-1])v=0,p=this.vertices[f.length-1],m=null;else{const b=Jt.search(f,s);v=this.getCurvePercent(s,b),p=this.vertices[b],m=this.vertices[b+1]}const y=this.vertices[0].length;this.applyToSlot(u[this.slotIndex],c,p,m,v,y,a,o,h);for(const b of d)this.applyToSlot(u[b],c,p,m,v,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=tt.setup),r){case tt.setup:o.length=0;break;case tt.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=tt.setup);const p=l===tt.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 v=0;v<o;v++)f[v]+=s[v]-m[v]}else rt.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 v=0;v<o;v++){const y=m[v];f[v]=y+(s[v]-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 v=0;v<o;v++)f[v]+=(s[v]-m[v])*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 v=s[m];f[m]+=v+(r[m]-v)*a}else{const m=d.vertices;for(let v=0;v<o;v++){const y=s[v];f[v]+=y+(r[v]-y)*a-m[v]}}else if(a===0)rt.arrayCopy(s,0,f,0,o);else for(let m=0;m<o;m++){const v=s[m];f[m]=v+(r[m]-v)*a}else if(p)if(d.bones)for(let m=0;m<o;m++){const v=s[m];f[m]=(v+(r[m]-v)*a)*h}else{const m=d.vertices;for(let v=0;v<o;v++){const y=s[v],b=m[v];f[v]=b+(y+(r[v]-y)*a-b)*h}}else if(c)if(d.bones)for(let m=0;m<o;m++){const v=s[m];f[m]+=(v+(r[m]-v)*a)*h}else{const m=d.vertices;for(let v=0;v<o;v++){const y=s[v];f[v]+=(y+(r[v]-y)*a-m[v])*h}}else for(let m=0;m<o;m++){const v=s[m];f[m]+=(v+(r[m]-v)*a-f[m])*h}}}const _s=class _s extends Jt{constructor(t,i,s){super(t,`${pt.sequence}|${i}|${s.sequence.id}`);x(this,"slotIndex");x(this,"attachment");this.slotIndex=i,this.attachment=s,this.instant=!0}getFrameEntries(){return _s.ENTRIES}getSlotIndex(){return this.slotIndex}getAttachment(){return this.attachment}setFrame(t,i,s,r,a){const o=this.frames;t*=_s.ENTRIES,o[t]=i,o[t+_s.MODE]=s|r<<4,o[t+_s.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!==tt.current){this.setupPose(u[this.slotIndex],c);for(const b of d)this.setupPose(u[b],c)}return}const p=Jt.search(f,s,_s.ENTRIES),m=f[p],v=f[p+_s.MODE],y=f[p+_s.DELAY];this.applyToSlot(u[this.slotIndex],c,s,m,v,y);for(const b of d)this.applyToSlot(u[b],c,s,m,v,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=Qb[a&15];if(u!==Ui.hold)switch(l+=(s-r)/o+1e-5|0,u){case Ui.once:l=Math.min(c-1,l);break;case Ui.loop:l%=c;break;case Ui.pingpong:{const d=(c<<1)-2;l=d===0?0:l%d,l>=c&&(l=d-l);break}case Ui.onceReverse:l=Math.max(c-1-l,0);break;case Ui.loopReverse:l=c-1-l%c;break;case Ui.pingpongReverse:{const d=(c<<1)-2;l=d===0?0:(l+c-1)%d,l>=c&&(l=d-l)}}h.sequenceIndex=l}};x(_s,"ENTRIES",3),x(_s,"MODE",1),x(_s,"DELAY",2);let _h=_s;const Ch=class Ch extends Jt{constructor(t){super(t,...Ch.propertyIds);x(this,"events");this.events=new Array(t),this.instant=!0}getFrameCount(){return this.frames.length}setFrame(t,i){this.frames[t]=i.time,this.events[t]=i}apply(t,i,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=Jt.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])}};x(Ch,"propertyIds",[`${pt.event}`]);let _l=Ch;const qa=class qa extends Jt{constructor(t){super(t,...qa.propertyIds);x(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!==tt.current&&rt.arrayCopy(d,0,u,0,t.slots.length);return}const f=this.drawOrders[Jt.search(this.frames,s)];if(!f)rt.arrayCopy(d,0,u,0,t.slots.length);else for(let p=0,m=f.length;p<m;p++)u[p]=d[f[p]]}};x(qa,"propertyID",`${pt.drawOrder}`),x(qa,"propertyIds",[qa.propertyID]);let Fr=qa;const ll=class ll extends Jt{constructor(t,i,s){super(t,...ll.propertyIds(i));x(this,"slots");x(this,"inFolder");x(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]=`${ll.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!==tt.current&&this.setup(u,d);else{const f=this.drawOrders[Jt.search(this.frames,s)];if(!f)this.setup(u,d);else{const p=this.inFolder,m=this.slots;for(let v=0,y=0,b=m.length;!(p[u[v].data.index]&&(u[v]=d[m[f[y]]],++y===b));v++);}}}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++);}};x(ll,"propertyID",`${pt.drawOrderFolder}`);let yo=ll;function n3(n){return typeof n=="object"&&n!==null&&typeof n.constraintIndex=="number"}class gw extends Ta{constructor(t,i,s){super(t,i,`${pt.ikConstraint}|${s}`);x(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 g=u.data.setupPose;switch(o){case tt.setup:{d.mix=g.mix,d.softness=g.softness,d.bendDirection=g.bendDirection,d.compress=g.compress,d.stretch=g.stretch;break}case tt.first:{d.mix+=(g.mix-d.mix)*a,d.softness+=(g.softness-d.softness)*a,d.bendDirection=g.bendDirection,d.compress=g.compress,d.stretch=g.stretch;break}}return}let p=0,m=0;const v=Jt.search(f,s,6),y=this.curves[v/6];switch(y){case 0:{const g=f[v];p=f[v+1],m=f[v+2];const w=(s-g)/(f[v+6]-g);p+=(f[v+6+1]-p)*w,m+=(f[v+6+2]-m)*w;break}case 1:p=f[v+1],m=f[v+2];break;default:p=this.getBezierValue(s,v,1,y-2),m=this.getBezierValue(s,v,2,y+18-2)}const b=o===tt.setup?u.data.setupPose:d;d.mix=b.mix+(p-b.mix)*a,d.softness=b.softness+(m-b.softness)*a,l?o===tt.setup&&(d.bendDirection=b.bendDirection,d.compress=b.compress,d.stretch=b.stretch):(d.bendDirection=f[v+3],d.compress=f[v+4]!==0,d.stretch=f[v+5]!==0)}}class vw extends Ta{constructor(t,i,s){super(t,i,`${pt.transformConstraint}|${s}`);x(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 _=u.data.setupPose;switch(o){case tt.setup:{d.mixRotate=_.mixRotate,d.mixX=_.mixX,d.mixY=_.mixY,d.mixScaleX=_.mixScaleX,d.mixScaleY=_.mixScaleY,d.mixShearY=_.mixShearY;break}case tt.first:{d.mixRotate+=(_.mixRotate-d.mixRotate)*a,d.mixX+=(_.mixX-d.mixX)*a,d.mixY+=(_.mixY-d.mixY)*a,d.mixScaleX+=(_.mixScaleX-d.mixScaleX)*a,d.mixScaleY+=(_.mixScaleY-d.mixScaleY)*a,d.mixShearY+=(_.mixShearY-d.mixShearY)*a;break}}return}let p,m,v,y,b,g;const w=Jt.search(f,s,7),E=this.curves[w/7];switch(E){case 0:{const _=f[w];p=f[w+1],m=f[w+2],v=f[w+3],y=f[w+4],b=f[w+5],g=f[w+6];const I=(s-_)/(f[w+7]-_);p+=(f[w+7+1]-p)*I,m+=(f[w+7+2]-m)*I,v+=(f[w+7+3]-v)*I,y+=(f[w+7+4]-y)*I,b+=(f[w+7+5]-b)*I,g+=(f[w+7+6]-g)*I;break}case 1:p=f[w+1],m=f[w+2],v=f[w+3],y=f[w+4],b=f[w+5],g=f[w+6];break;default:p=this.getBezierValue(s,w,1,E-2),m=this.getBezierValue(s,w,2,E+18-2),v=this.getBezierValue(s,w,3,E+36-2),y=this.getBezierValue(s,w,4,E+54-2),b=this.getBezierValue(s,w,5,E+72-2),g=this.getBezierValue(s,w,6,E+90-2)}const M=o===tt.setup?u.data.setupPose:d;h?(d.mixRotate=M.mixRotate+p*a,d.mixX=M.mixX+m*a,d.mixY=M.mixY+v*a,d.mixScaleX=M.mixScaleX+y*a,d.mixScaleY=M.mixScaleY+b*a,d.mixShearY=M.mixShearY+g*a):(d.mixRotate=M.mixRotate+(p-M.mixRotate)*a,d.mixX=M.mixX+(m-M.mixX)*a,d.mixY=M.mixY+(v-M.mixY)*a,d.mixScaleX=M.mixScaleX+(y-M.mixScaleX)*a,d.mixScaleY=M.mixScaleY+(b-M.mixScaleY)*a,d.mixShearY=M.mixShearY+(g-M.mixShearY)*a)}}class Bl extends qn{constructor(t,i,s,r){super(t,i,`${r}|${s}`);x(this,"constraintIndex");this.constraintIndex=s}}class yw extends Bl{constructor(e,t,i){super(e,t,i,pt.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 xw extends Bl{constructor(e,t,i){super(e,t,i,pt.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 bw extends Ta{constructor(t,i,s){super(t,i,`${pt.pathConstraintMix}|${s}`);x(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 w=u.data.setupPose;switch(o){case tt.setup:{d.mixRotate=w.mixRotate,d.mixX=w.mixX,d.mixY=w.mixY;break}case tt.first:{d.mixRotate+=(w.mixRotate-d.mixRotate)*a,d.mixX+=(w.mixX-d.mixX)*a,d.mixY+=(w.mixY-d.mixY)*a;break}}return}let p,m,v;const y=Jt.search(f,s,4),b=this.curves[y>>2];switch(b){case 0:{const w=f[y];p=f[y+1],m=f[y+2],v=f[y+3];const E=(s-w)/(f[y+4]-w);p+=(f[y+4+1]-p)*E,m+=(f[y+4+2]-m)*E,v+=(f[y+4+3]-v)*E;break}case 1:p=f[y+1],m=f[y+2],v=f[y+3];break;default:p=this.getBezierValue(s,y,1,b-2),m=this.getBezierValue(s,y,2,b+18-2),v=this.getBezierValue(s,y,3,b+36-2)}const g=o===tt.setup?u.data.setupPose:d;h?(d.mixRotate=g.mixRotate+p*a,d.mixX=g.mixX+m*a,d.mixY=g.mixY+v*a):(d.mixRotate=g.mixRotate+(p-g.mixRotate)*a,d.mixX=g.mixX+(m-g.mixX)*a,d.mixY=g.mixY+(v-g.mixY)*a)}}class Nr extends Bl{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 ww extends Nr{constructor(e,t,i){super(e,t,i,pt.physicsConstraintInertia)}get(e){return e.inertia}set(e,t){e.inertia=t}global(e){return e.inertiaGlobal}}class Sw extends Nr{constructor(e,t,i){super(e,t,i,pt.physicsConstraintStrength)}get(e){return e.strength}set(e,t){e.strength=t}global(e){return e.strengthGlobal}}class _w extends Nr{constructor(e,t,i){super(e,t,i,pt.physicsConstraintDamping)}get(e){return e.damping}set(e,t){e.damping=t}global(e){return e.dampingGlobal}}class Tw extends Nr{constructor(e,t,i){super(e,t,i,pt.physicsConstraintMass)}get(e){return 1/e.massInverse}set(e,t){e.massInverse=1/t}global(e){return e.massGlobal}}class Mw extends Nr{constructor(e,t,i){super(e,t,i,pt.physicsConstraintWind),this.additive=!0}get(e){return e.wind}set(e,t){e.wind=t}global(e){return e.windGlobal}}class Ew extends Nr{constructor(e,t,i){super(e,t,i,pt.physicsConstraintGravity),this.additive=!0}get(e){return e.gravity}set(e,t){e.gravity=t}global(e){return e.gravityGlobal}}class Aw extends Nr{constructor(e,t,i){super(e,t,i,pt.physicsConstraintMix)}get(e){return e.mix}set(e,t){e.mix=t}global(e){return e.mixGlobal}}const Ih=class Ih extends Jt{constructor(t,i){super(t,...Ih.propertyIds);x(this,"constraintIndex");this.constraintIndex=i,this.instant=!0}getFrameCount(){return this.frames.length}setFrame(t,i){this.frames[t]=i}apply(t,i,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[Jt.search(d,i)+1]))if(u!=null)u.reset(t);else for(const f of t.physics)f.active&&f.reset(t)}};x(Ih,"propertyIds",[pt.physicsConstraintReset.toString()]);let Th=Ih;class Cw extends Bl{constructor(e,t,i){super(e,t,i,pt.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 Iw extends Bl{constructor(e,t,i){super(e,t,i,pt.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 cl=class cl{constructor(e){x(this,"data");x(this,"tracks",[]);x(this,"timeScale",1);x(this,"unkeyedState",0);x(this,"events",[]);x(this,"listeners",[]);x(this,"queue",new a3(this));x(this,"propertyIds",new Map);x(this,"animationsChanged",!1);x(this,"trackEntryPool",new JF(()=>new r3));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,v=m.length;if(o===0&&c===1)for(let y=0;y<v;y++){rt.webkit602BugfixHelper(c);const b=m[y];b instanceof al?this.applyAttachmentTimeline(b,e,f,tt.setup,!0):b.apply(e,u,f,p,c,tt.setup,!1,!1,!1)}else{const y=l.timelineMode,b=c>=l.alphaAttachmentThreshold,g=l.additive,w=g||l.shortestRotation,E=!w&&l.timelinesRotation.length!==v<<1;E&&(l.timelinesRotation.length=v<<1);for(let M=0;M<v;M++){const _=m[M],I=y[M]&Fv;!w&&_ instanceof Sh?this.applyRotateTimeline(_,e,f,c,I,l.timelinesRotation,M<<1,E):_ instanceof al?this.applyAttachmentTimeline(_,e,f,I,b):(rt.webkit602BugfixHelper(c),_.apply(e,u,f,p,c,I,g,!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+Ov,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,v=i.additive,y=v||i.shortestRotation,b=!y&&i.timelinesRotation.length!==u<<1;b&&(i.timelinesRotation.length=u<<1);const g=i.timelinesRotation;let w=i.animationLast,E=i.getAnimationTime(),M=E,_=null;i.reverse?M=i.animation.duration-M:r<i.eventThreshold&&(_=this.events),i.totalAlpha=0;for(let I=0;I<u;I++){const R=c[I],F=d[I],P=F&Fv;let k=0;if((F&bc)!==0){const B=f[I];k=B==null?l:l*(1-B.mix())}else{if(!m&&R instanceof Fr&&P===tt.current)continue;k=h}if(i.totalAlpha+=k,!y&&R instanceof Sh)this.applyRotateTimeline(R,t,M,k,P,g,I<<1,b);else if(R instanceof al)this.applyAttachmentTimeline(R,t,M,P,p&&k>=i.alphaAttachmentThreshold);else{const B=!m||!(R instanceof Fr)||P===tt.current;R.apply(t,w,M,_,k,P,v,B,!1)}}return i.reverse&&r<i.eventThreshold&&this.eventsReverse(i,w,E),e.mixDuration>0&&this.queueEvents(i,E),this.events.length=0,i.nextAnimationLast=E,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+Bv)return;let o=i<e.frames[0],h=null;if(o||(h=e.attachmentNames[Jt.search(e.frames,i)],o=!r&&h==null),o){if(s===tt.current)return;h=a.data.attachmentName}a.pose.setAttachment(h==null?null:t.getAttachment(a.data.index,h)),r?a.attachmentState=this.unkeyedState+Bv:o||(a.attachmentState=this.unkeyedState+Ov)}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 tt.setup:{c.rotation=u.rotation;return}case tt.current:return}f=c.rotation,p=u.rotation}else f=r===tt.setup?u.rotation:c.rotation,p=u.rotation+e.getCurveValue(i);let m=0,v=p-f;if(v-=Math.ceil(v/360-.5)*360,v===0)m=a[o];else{let y=0,b=0;h?(y=0,b=v):(y=a[o],b=a[o+1]);const g=y-y%360;m=v+g;let w=v>=0,E=y>=0;Math.abs(b)<=90&&Xe.signum(b)!==Xe.signum(v)&&(Math.abs(y-g)>180?(m+=360*Xe.signum(y),E=w):g!==0?m-=360*Xe.signum(y):E=w),E!==w&&(m+=360*Xe.signum(y)),a[o]=m}a[o+1]=v,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 _l))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,cl.emptyAnimation,!1);return i.mixDuration=t,i.trackEnd=t,i}addEmptyAnimation(e,t=0,i=0){const s=this.addAnimation(e,cl.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]:(rt.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 v;if(l===null||f.instant||l.additive&&f.additive||!((c=l.animation)!=null&&c.hasTimeline(p)))v=m;else{v=m|bc;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&&(v=v&~bc|r[d]&bc),r[d]=v}}from(e,t,i){const s=this.propertyIds;let r=o3;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 Pv}r=kv}}if(t instanceof yo){const a=s.get(Fr.propertyID);if(a!=null)return a!==e?Pv:kv}return r}getTrack(e){if(e<0)throw new Error("trackIndex must be >= 0.");return e>=this.tracks.length?null:this.tracks[e]}addListener(e){if(!e)throw new Error("listener cannot be null.");this.listeners.push(e)}removeListener(e){const t=this.listeners.indexOf(e);t>=0&&this.listeners.splice(t,1)}clearListeners(){this.listeners.length=0}clearListenerNotifications(){this.queue.clear()}};x(cl,"emptyAnimation",new up("<empty>",[],0));let Rv=cl;class r3{constructor(){x(this,"animation",null);x(this,"previous",null);x(this,"next",null);x(this,"mixingFrom",null);x(this,"mixingTo",null);x(this,"listener",null);x(this,"trackIndex",0);x(this,"loop",!1);x(this,"additive",!1);x(this,"reverse",!1);x(this,"shortestRotation",!1);x(this,"keepHold",!1);x(this,"eventThreshold",0);x(this,"mixAttachmentThreshold",0);x(this,"alphaAttachmentThreshold",0);x(this,"mixDrawOrderThreshold",0);x(this,"animationStart",0);x(this,"animationEnd",0);x(this,"animationLast",0);x(this,"nextAnimationLast",0);x(this,"delay",0);x(this,"trackTime",0);x(this,"trackLast",0);x(this,"nextTrackLast",0);x(this,"trackEnd",0);x(this,"timeScale",0);x(this,"alpha",0);x(this,"mixTime",0);x(this,"mixDuration",0);x(this,"totalAlpha",0);x(this,"mixInterpolation",lo.linear);x(this,"timelineMode",[]);x(this,"timelineHoldMix",[]);x(this,"timelinesRotation",[])}setMixDuration(e,t){this.mixDuration=e,t!==void 0&&(t<=0&&(t=this.previous==null?0:Math.max(t+this.previous.getTrackComplete()-e,0)),this.delay=t)}setMixInterpolation(e){if(!e)throw new Error("mixInterpolation cannot be null.");this.mixInterpolation=e}mix(){if(this.mixDuration===0)return 1;let e=this.mixTime/this.mixDuration;return e>=1?1:this.mixInterpolation===lo.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=lo.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 a3{constructor(e){x(this,"objects",[]);x(this,"drainDisabled",!1);x(this,"animState");this.animState=e}start(e){this.objects.push(os.start),this.objects.push(e),this.animState.animationsChanged=!0}interrupt(e){this.objects.push(os.interrupt),this.objects.push(e)}end(e){this.objects.push(os.end),this.objects.push(e),this.animState.animationsChanged=!0}dispose(e){this.objects.push(os.dispose),this.objects.push(e)}complete(e){this.objects.push(os.complete),this.objects.push(e)}event(e,t){this.objects.push(os.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 os.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 os.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 os.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 os.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 os.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 os.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 os;(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"})(os||(os={}));class cU{start(e){}interrupt(e){}end(e){}dispose(e){}complete(e){}event(e,t){}}const Pv=0,o3=1,kv=2,Fv=3,bc=4,Ov=1,Bv=2;class fp extends or{constructor(t){super(t);x(this,"color",new vt(1,1,1,1))}copy(){const t=new fp(this.name);return this.copyTo(t),t.color.setFromColor(this.color),t}}class au extends or{constructor(t){super(t);x(this,"endSlot",null);x(this,"convex",!1);x(this,"inverse",!1);x(this,"color",new vt(.2275,.2275,.8078,1))}copy(){const t=new au(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 Tl extends or{constructor(t){super(t);x(this,"lengths",[]);x(this,"closed",!1);x(this,"constantSpeed",!1);x(this,"color",new vt(1,1,1,1))}copy(){const t=new Tl(this.name);return this.copyTo(t),t.lengths=[],rt.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 mp extends or{constructor(t){super(t);x(this,"x",0);x(this,"y",0);x(this,"rotation",0);x(this,"color",new vt(.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*Xe.degRad,s=Math.cos(i),r=Math.sin(i),a=s*t.a+r*t.b,o=s*t.c+r*t.d;return Xe.atan2Deg(o,a)}copy(){const t=new mp(this.name);return t.x=this.x,t.y=this.y,t.rotation=this.rotation,t.color.setFromColor(this.color),t}}class pp{constructor(e,t){x(this,"name");x(this,"setupPose");x(this,"skinRequired",!1);if(e==null)throw new Error("name cannot be null.");this.name=e,this.setupPose=t}}class ou extends pp{constructor(t,i,s){super(i,new nm);x(this,"index",0);x(this,"parent",null);x(this,"length",0);x(this,"color",new vt);x(this,"icon");x(this,"iconSize",1);x(this,"iconRotation",0);x(this,"visible",!1);if(t<0)throw new Error("index must be >= 0.");if(!i)throw new Error("name cannot be null.");this.index=t,this.parent=s}copy(t){const i=new ou(this.index,this.name,t);return i.length=this.length,i.setupPose.set(this.setupPose),i}}var ci;(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"})(ci||(ci={}));class nm{constructor(){x(this,"bone");x(this,"x",0);x(this,"y",0);x(this,"rotation",0);x(this,"scaleX",0);x(this,"scaleY",0);x(this,"shearX",0);x(this,"shearY",0);x(this,"inherit",ci.Normal);x(this,"a",0);x(this,"b",0);x(this,"c",0);x(this,"d",0);x(this,"worldY",0);x(this,"worldX",0);x(this,"world",0);x(this,"local",0)}set(e){if(e==null)throw new Error("pose cannot be null.");this.x=e.x,this.y=e.y,this.rotation=e.rotation,this.scaleX=e.scaleX,this.scaleY=e.scaleY,this.shearX=e.shearX,this.shearY=e.shearY,this.inherit=e.inherit}setPosition(e,t){this.x=e,this.y=t}setScale(e,t){this.scaleX=e,this.scaleY=t===void 0?e:t}getInherit(){return this.inherit}setInherit(e){if(e==null)throw new Error("inherit cannot be null.");this.inherit=e}update(e,t){this.world!==e._update&&this.updateWorldTransform(e)}updateWorldTransform(e){this.local===e._update?this.updateLocalTransform(e):this.world=e._update;const t=this.rotation,i=this.scaleX,s=this.scaleY,r=this.shearX,a=this.shearY;if(!this.bone.parent){const d=e.scaleX,f=e.scaleY,p=(t+r)*Xe.degRad,m=(t+90+a)*Xe.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 ci.Normal:{const d=(t+r)*Xe.degRad,f=(t+90+a)*Xe.degRad,p=Math.cos(d)*i,m=Math.cos(f)*s,v=Math.sin(d)*i,y=Math.sin(f)*s;this.a=h*p+l*v,this.b=h*m+l*y,this.c=c*p+u*v,this.d=c*m+u*y;return}case ci.OnlyTranslation:{const d=e.scaleX,f=e.scaleY,p=(t+r)*Xe.degRad,m=(t+90+a)*Xe.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 ci.NoRotationOrReflection:{const d=e.scaleX,f=e.scaleY,p=1/d,m=1/f;h*=p,c*=m;let v=h*h+c*c,y=0;v>Xe.epsilon2?(v=Math.abs(h*u*m-l*p*c)/v,l=c*v,u=h*v,y=t-Xe.atan2Deg(c,h)):(h=0,c=0,y=t-90+Xe.atan2Deg(u,l));const b=(y+r)*Xe.degRad,g=(y+a+90)*Xe.degRad,w=Math.cos(b)*i,E=Math.cos(g)*s,M=Math.sin(b)*i,_=Math.sin(g)*s;this.a=(h*w-l*M)*d,this.b=(h*E-l*_)*d,this.c=(c*w+u*M)*f,this.d=(c*E+u*_)*f;break}case ci.NoScale:case ci.NoScaleOrReflection:{const d=e.scaleX,f=e.scaleY,p=1/d,m=1/f,v=t*Xe.degRad,y=Math.cos(v),b=Math.sin(v);let g=(h*y+l*b)*p,w=(c*y+u*b)*m;const E=1/Math.sqrt(g*g+w*w);g*=E,w*=E;let M=-w,_=g;this.inherit===ci.NoScale&&h*u-l*c<0!=(d<0!=f<0)&&(M=-M,_=-_);const I=r*Xe.degRad,R=(90+a)*Xe.degRad,F=Math.cos(I)*i,P=Math.cos(R)*s,k=Math.sin(I)*i,B=Math.sin(R)*s;this.a=(g*F+M*k)*d,this.b=(g*P+M*B)*d,this.c=(w*F+_*k)*f,this.d=(w*P+_*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,b=1/i;this.x=(this.worldX-e.x)*y,this.y=(this.worldY-e.y)*b,this.set5(this.a*y,this.b*y,this.c*b,this.d*b,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,v=this.worldY-s.worldY;switch(this.x=m*u-v*d,this.y=v*p-m*f,this.inherit){case ci.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 ci.OnlyTranslation:{const y=1/t,b=1/i;this.set5(this.a*y,this.b*y,this.c*b,this.d*b,0);break}case ci.NoRotationOrReflection:{const y=1/t,b=1/i;r*=y,o*=b;const g=this.a*y,w=this.b*y,E=this.c*b,M=this.d*b,_=1/(r*r+o*o),I=1/Math.abs(l*y*b);this.set5((r*g+o*E)*_,(r*w+o*M)*_,(r*E-o*g)*I,(r*M-o*w)*I,Xe.atan2Deg(o,r));break}case ci.NoScale:case ci.NoScaleOrReflection:{const y=1/t,b=1/i,g=this.a*y,w=this.b*y,E=this.c*b,M=this.d*b;let _=h*this.a-a*this.c,I=r*this.c-o*this.a;l<0&&(_=-_,I=-I);let R=Xe.atan2Deg(I,_);this.rotation=R,R*=Xe.degRad;const F=Math.cos(R),P=Math.sin(R);let k=(r*F+a*P)*y,B=(o*F+h*P)*b;const L=1/Math.sqrt(k*k+B*B);k*=L,B*=L;const X=this.inherit===ci.NoScale&&l<0!=(t<0!=i<0)?-1:1;this.set4(k*g+B*E,k*w+B*M,(k*E-B*g)*X,(k*M-B*w)*X)}}}set4(e,t,i,s){const r=e*e+i*i,a=t*t+s*s;r>Xe.epsilon2?(this.shearX=Xe.atan2Deg(i,e),this.scaleX=Math.sqrt(r)):(this.shearX=0,this.scaleX=0),this.scaleY=Math.sqrt(a),a>Xe.epsilon2?(this.shearY=Xe.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>Xe.epsilon2){const h=Xe.atan2Deg(i,e);this.rotation=h+r,this.scaleX=Math.sqrt(a),this.scaleY=Math.sqrt(o),o>Xe.epsilon2?(this.shearY=Xe.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>Xe.epsilon2?Xe.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 Xe.atan2Deg(this.c,this.a)}getWorldRotationY(){return Xe.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*=Xe.degRad;const t=Math.sin(e),i=Math.cos(e);return Xe.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)*Xe.degRad;const t=Math.sin(e),i=Math.cos(e);return Xe.atan2Deg(i*this.c+t*this.d,i*this.a+t*this.b)}rotateWorld(e){e*=Xe.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 Rw{constructor(e,t,i){x(this,"data");x(this,"pose");x(this,"constrainedPose");x(this,"appliedPose");if(e==null)throw new Error("data cannot be null.");this.data=e,this.pose=t,this.constrainedPose=i,this.appliedPose=t}setupPose(){this.pose.set(this.data.setupPose)}getData(){return this.data}getPose(){return this.pose}getAppliedPose(){return this.appliedPose}unconstrained(){this.appliedPose=this.pose}constrained(){this.appliedPose=this.constrainedPose}resetConstrained(){this.constrainedPose.set(this.pose)}}class Pw extends Rw{constructor(t,i,s){super(t,i,s);x(this,"active",!1);this.setupPose()}isActive(){return this.active}}class ol extends Pw{constructor(t,i){super(t,new nm,new nm);x(this,"parent",null);x(this,"children",[]);x(this,"sorted",!1);this.parent=i,this.appliedPose.bone=this,this.constrainedPose.bone=this}copy(t){const i=new ol(this.data,t);return i.pose.set(this.pose),i}}class Ll extends Pw{constructor(e,t,i){super(e,t,i)}isSourceActive(){return!0}}class l3{constructor(e){x(this,"_setupPose");x(this,"pose");x(this,"constrainedPose");x(this,"appliedPose");this._setupPose=e,this.pose=[...e],this.constrainedPose=[],this.appliedPose=this.pose}setupPose(){this.pose.length=this._setupPose.length,rt.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,rt.arrayCopy(this.pose,0,this.constrainedPose,0,this.pose.length)}}class Dl extends pp{constructor(e,t){super(e,t)}}var es;(function(n){n[n.None=0]="None",n[n.Uniform=1]="Uniform",n[n.Volume=2]="Volume"})(es||(es={}));let gp=class{constructor(e,t){x(this,"time",0);x(this,"data");x(this,"intValue",0);x(this,"floatValue",0);x(this,"stringValue",null);x(this,"volume",0);x(this,"balance",0);if(!t)throw new Error("data cannot be null.");this.time=e,this.data=t}};class kw{constructor(e){x(this,"name");x(this,"_audioPath",null);x(this,"setupPose",new gp(-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 rm{constructor(){x(this,"bendDirection",0);x(this,"compress",!1);x(this,"stretch",!1);x(this,"mix",0);x(this,"softness",0)}set(e){this.mix=e.mix,this.softness=e.softness,this.bendDirection=e.bendDirection,this.compress=e.compress,this.stretch=e.stretch}}class br extends Ll{constructor(t,i){super(t,new rm,new rm);x(this,"bones");x(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 br(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:br.apply(t,a[0],r.worldX,r.worldY,s.compress,s.stretch,this.data.scaleYMode,s.mix);break;case 2:br.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"?br.apply1(t,i,s,r,a,o,h,l):br.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,v=0,y=0;switch(i.inherit){case ci.OnlyTranslation:v=(s-i.worldX)*Xe.signum(t.scaleX),y=(r-i.worldY)*Xe.signum(t.scaleY);break;case ci.NoRotationOrReflection:{const b=Math.abs(u*p-d*f)/Math.max(Xe.epsilon,u*u+f*f),g=u/t.scaleX,w=f/t.scaleY;d=-w*b*t.scaleX,p=g*b*t.scaleY,m+=Xe.atan2Deg(w,g)}default:{const b=s-c.worldX,g=r-c.worldY,w=u*p-d*f;Math.abs(w)<=Xe.epsilon?(v=0,y=0):(v=(b*p-g*d)/w-i.x,y=(g*u-b*f)/w-i.y)}}if(m+=Xe.atan2Deg(y,v),i.scaleX<0&&(m+=180),m>180?m-=360:m<=-180&&(m+=360),i.rotation+=m*l,a||o){switch(i.inherit){case ci.NoScale:case ci.NoScaleOrReflection:v=s-i.worldX,y=r-i.worldY}const b=i.bone.data.length*i.scaleX;if(b>Xe.epsilon){const g=v*v+y*y;if(a&&g<b*b||o&&g>b*b){const w=(Math.sqrt(g)/b-1)*l+1;switch(i.scaleX*=w,h){case es.Uniform:i.scaleY*=w;break;case es.Volume:i.scaleY/=w<.7?.25+.642857*w:w}}}}}static apply2(t,i,s,r,a,o,h,l,c,u){if(i.inherit!==ci.Normal||s.inherit!==ci.Normal)return;i.modifyLocal(t),s.modifyLocal(t);let d=i.x,f=i.y,p=i.scaleX,m=i.scaleY,v=s.scaleX,y=0,b=0,g=0;p<0?(p=-p,y=180,g=-1):(y=0,g=1),m<0&&(m=-m,g=-g),v<0?(v=-v,b=180):b=0;let w=0,E=0,M=i.a,_=i.b,I=i.c,R=i.d;const F=Math.abs(p-m)<=Xe.epsilon;!F||h?(s.y=0,w=M*s.x+i.worldX,E=I*s.x+i.worldY):(w=M*s.x+_*s.y+i.worldX,E=I*s.x+R*s.y+i.worldY);const P=i.bone.parent.appliedPose;M=P.a,_=P.b,I=P.c,R=P.d;let k=M*R-_*I,B=w-P.worldX,L=E-P.worldY;k=Math.abs(k)<=Xe.epsilon?0:1/k;const X=(B*R-L*_)*k-d,O=(L*M-B*I)*k-f;let D=Math.sqrt(X*X+O*O),T=s.bone.data.length*v,U,N;if(D<Xe.epsilon){br.apply(t,i,r,a,!1,h,es.None,u),s.rotation=0;return}B=r-P.worldX,L=a-P.worldY;let Y=(B*R-L*_)*k-d,G=(L*M-B*I)*k-f,H=Y*Y+G*G;if(c!==0){c*=p*(v+1)*.5;const Z=Math.sqrt(H),de=Z-D-T*p+c;if(de>0){let me=Math.min(1,de/(c*2))-1;me=(de-c*(1-me*me))/Z,Y-=me*Y,G-=me*G,H=Y*Y+G*G}}e:if(F){T*=p;let Z=(H-D*D-T*T)/(2*D*T);if(Z<-1)Z=-1,N=Math.PI*o;else if(Z>1){if(Z=1,N=0,h)switch(M=(Math.sqrt(H)/(D+T)-1)*u+1,i.scaleX*=M,l){case es.Uniform:i.scaleY*=M;break;case es.Volume:i.scaleY/=M<.7?.25+.642857*M:M}}else N=Math.acos(Z)*o;M=D+T*Z,_=T*Math.sin(N),U=Math.atan2(G*M-Y*_,Y*M+G*_)}else{M=p*T,_=m*T;const Z=M*M,de=_*_,me=Math.atan2(G,Y);I=de*D*D+Z*H-Z*de;const _e=-2*de*D,Ae=de-Z;if(R=_e*_e-4*Ae*I,R>=0){let xe=Math.sqrt(R);_e<0&&(xe=-xe),xe=-(_e+xe)*.5;let ae=xe/Ae,we=I/xe;const ce=Math.abs(ae)<Math.abs(we)?ae:we;if(ae=H-ce*ce,ae>=0){L=Math.sqrt(ae)*o,U=me-Math.atan2(L,ce),N=Math.atan2(L/m,(ce-D)/p);break e}}let ge=Xe.PI,Ee=D-M,j=Ee*Ee,K=0,q=0,W=D+M,Q=W*W,le=0;I=-M*D/(Z-de),I>=-1&&I<=1&&(I=Math.acos(I),B=M*Math.cos(I)+D,L=_*Math.sin(I),R=B*B+L*L,R<j&&(ge=I,j=R,Ee=B,K=L),R>Q&&(q=I,Q=R,W=B,le=L)),H<=(j+Q)*.5?(U=me-Math.atan2(K*o,Ee),N=ge*o):(U=me-Math.atan2(le*o,W),N=q*o)}const ne=Math.atan2(s.y,s.x)*g;U=(U-ne)*Xe.radDeg+y-i.rotation,U>180?U-=360:U<=-180&&(U+=360),i.rotation+=U*u,N=((N+ne)*Xe.radDeg-s.shearX)*g+b-s.rotation,N>180?N-=360:N<=-180&&(N+=360),s.rotation+=N*u}}class Bc extends Dl{constructor(t){super(t,new rm);x(this,"bones",[]);x(this,"_target",null);x(this,"_scaleYMode",es.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 br(this,t)}}class am{constructor(){x(this,"position",0);x(this,"spacing",0);x(this,"mixRotate",0);x(this,"mixX",0);x(this,"mixY",0)}set(e){this.position=e.position,this.spacing=e.spacing,this.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY}}class Lc extends Dl{constructor(t){super(t,new am);x(this,"bones",[]);x(this,"_slot",null);x(this,"positionMode",_n.Fixed);x(this,"spacingMode",Ci.Fixed);x(this,"rotateMode",pa.Chain);x(this,"offsetRotation",0)}set slot(t){this._slot=t}get slot(){if(this._slot)return this._slot;throw new Error("SlotData not set.")}create(t){return new om(this,t)}}var _n;(function(n){n[n.Fixed=0]="Fixed",n[n.Percent=1]="Percent"})(_n||(_n={}));var Ci;(function(n){n[n.Length=0]="Length",n[n.Fixed=1]="Fixed",n[n.Percent=2]="Percent",n[n.Proportional=3]="Proportional"})(Ci||(Ci={}));var pa;(function(n){n[n.Tangent=0]="Tangent",n[n.Chain=1]="Chain",n[n.ChainScale=2]="ChainScale"})(pa||(pa={}));const Ls=class Ls extends Ll{constructor(t,i){super(t,new am,new am);x(this,"data");x(this,"bones");x(this,"slot");x(this,"spaces",[]);x(this,"positions",[]);x(this,"world",[]);x(this,"curves",[]);x(this,"lengths",[]);x(this,"segments",[]);if(!i)throw new Error("skeleton cannot be null.");this.data=t,this.bones=[];for(const 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 Ls(this.data,t);return i.pose.set(this.pose),i}update(t,i){const s=this.slot.appliedPose.attachment;if(!(s instanceof Tl))return;const r=this.appliedPose,a=r.mixRotate,o=r.mixX,h=r.mixY;if(a===0&&o===0&&h===0)return;const l=this.data,c=l.rotateMode===pa.Tangent,u=l.rotateMode===pa.ChainScale,d=this.bones,f=d.length,p=c?f:f+1,m=rt.setArraySize(this.spaces,p),v=u?this.lengths=rt.setArraySize(this.lengths,f):[],y=r.spacing;switch(l.spacingMode){case Ci.Percent:if(u)for(let _=0,I=p-1;_<I;_++){const R=d[_],F=R.bone.data.length,P=F*R.a,k=F*R.c;v[_]=Math.sqrt(P*P+k*k)}rt.arrayFill(m,1,p,y);break;case Ci.Proportional:{let _=0;for(let I=0,R=p-1;I<R;){const F=d[I],P=F.bone.data.length;if(P<Xe.epsilon)u&&(v[I]=0),m[++I]=y;else{const k=P*F.a,B=P*F.c,L=Math.sqrt(k*k+B*B);u&&(v[I]=L),m[++I]=L,_+=L}}if(_>0){_=p/_*y;for(let I=1;I<p;I++)m[I]*=_}break}default:{const _=l.spacingMode===Ci.Length;for(let I=0,R=p-1;I<R;){const F=d[I],P=F.bone.data.length;if(P<Xe.epsilon)u&&(v[I]=0),m[++I]=y;else{const k=P*F.a,B=P*F.c,L=Math.sqrt(k*k+B*B);u&&(v[I]=L),m[++I]=(_?Math.max(0,P+y):y)*L/P}}}}const b=this.computeWorldPositions(t,s,p,c);let g=b[0],w=b[1],E=l.offsetRotation,M=!1;if(E===0)M=l.rotateMode===pa.Chain;else{M=!1;const _=this.slot.bone.appliedPose;E*=_.a*_.d-_.b*_.c>0?Xe.degRad:-Xe.degRad}for(let _=0,I=3;_<f;_++,I+=3){const R=d[_];R.modifyWorld(t),R.worldX+=(g-R.worldX)*o,R.worldY+=(w-R.worldY)*h;const F=b[I],P=b[I+1],k=F-g,B=P-w;if(u){const L=v[_];if(L!==0){const X=(Math.sqrt(k*k+B*B)/L-1)*a+1;R.a*=X,R.c*=X}}if(g=F,w=P,a>0){let L=R.a,X=R.b,O=R.c,D=R.d,T=0,U=0,N=0;if(c?T=b[I-1]:m[_+1]===0?T=b[I+2]:T=Math.atan2(B,k),T-=Math.atan2(O,L),M){U=Math.cos(T),N=Math.sin(T);const Y=R.bone.data.length;g+=(Y*(U*L-N*O)-k)*a,w+=(Y*(N*L+U*O)-B)*a}else T+=E;T>Xe.PI?T-=Xe.PI2:T<-Xe.PI&&(T+=Xe.PI2),T*=a,U=Math.cos(T),N=Math.sin(T),R.a=U*L-N*O,R.b=U*X-N*D,R.c=N*L+U*O,R.d=N*X+U*D}}}computeWorldPositions(t,i,s,r){const a=this.slot;let o=this.appliedPose.position,h=this.spaces,l=rt.setArraySize(this.positions,s*3+2),c=this.world;const u=i.closed;let d=i.worldVerticesLength,f=d/6,p=Ls.NONE;if(!i.constantSpeed){const N=i.lengths;f-=u?1:2;const Y=N[f];this.data.positionMode===_n.Percent&&(o*=Y);let G;switch(this.data.spacingMode){case Ci.Percent:G=Y;break;case Ci.Proportional:G=Y/s;break;default:G=1}c=rt.setArraySize(this.world,8);for(let H=0,ne=0,Z=0;H<s;H++,ne+=3){const de=h[H]*G;o+=de;let me=o;if(u)me%=Y,me<0&&(me+=Y),Z=0;else if(me<0){p!==Ls.BEFORE&&(p=Ls.BEFORE,i.computeWorldVertices(t,a,2,4,c,0,2)),this.addBeforePosition(me,c,0,l,ne);continue}else if(me>Y){p!==Ls.AFTER&&(p=Ls.AFTER,i.computeWorldVertices(t,a,d-6,4,c,0,2)),this.addAfterPosition(me-Y,c,0,l,ne);continue}for(;;Z++){const _e=N[Z];if(!(me>_e)){if(Z===0)me/=_e;else{const Ae=N[Z-1];me=(me-Ae)/(_e-Ae)}break}}Z!==p&&(p=Z,u&&Z===f?(i.computeWorldVertices(t,a,d-4,4,c,0,2),i.computeWorldVertices(t,a,0,4,c,4,2)):i.computeWorldVertices(t,a,Z*6+2,8,c,0,2)),this.addCurvePosition(me,c[0],c[1],c[2],c[3],c[4],c[5],c[6],c[7],l,ne,r||H>0&&de===0)}return l}u?(d+=2,c=rt.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=rt.setArraySize(this.world,d),i.computeWorldVertices(t,a,2,d,c,0,2));const m=rt.setArraySize(this.curves,f);let v=0,y=c[0],b=c[1],g=0,w=0,E=0,M=0,_=0,I=0,R=0,F=0,P=0,k=0,B=0,L=0,X=0,O=0;for(let N=0,Y=2;N<f;N++,Y+=6)g=c[Y],w=c[Y+1],E=c[Y+2],M=c[Y+3],_=c[Y+4],I=c[Y+5],R=(y-g*2+E)*.1875,F=(b-w*2+M)*.1875,P=((g-E)*3-y+_)*.09375,k=((w-M)*3-b+I)*.09375,B=R*2+P,L=F*2+k,X=(g-y)*.75+R+P*.16666667,O=(w-b)*.75+F+k*.16666667,v+=Math.sqrt(X*X+O*O),X+=B,O+=L,B+=P,L+=k,v+=Math.sqrt(X*X+O*O),X+=B,O+=L,v+=Math.sqrt(X*X+O*O),X+=B+P,O+=L+k,v+=Math.sqrt(X*X+O*O),m[N]=v,y=_,b=I;this.data.positionMode===_n.Percent&&(o*=v);let D;switch(this.data.spacingMode){case Ci.Percent:D=v;break;case Ci.Proportional:D=v/s;break;default:D=1}const T=this.segments;let U=0;for(let N=0,Y=0,G=0,H=0;N<s;N++,Y+=3){const ne=h[N]*D;o+=ne;let Z=o;if(u)Z%=v,Z<0&&(Z+=v),G=0,H=0;else if(Z<0){this.addBeforePosition(Z,c,0,l,Y);continue}else if(Z>v){this.addAfterPosition(Z-v,c,d-4,l,Y);continue}for(;;G++){const de=m[G];if(!(Z>de)){if(G===0)Z/=de;else{const me=m[G-1];Z=(Z-me)/(de-me)}break}}if(G!==p){p=G;let de=G*6;for(y=c[de],b=c[de+1],g=c[de+2],w=c[de+3],E=c[de+4],M=c[de+5],_=c[de+6],I=c[de+7],R=(y-g*2+E)*.03,F=(b-w*2+M)*.03,P=((g-E)*3-y+_)*.006,k=((w-M)*3-b+I)*.006,B=R*2+P,L=F*2+k,X=(g-y)*.3+R+P*.16666667,O=(w-b)*.3+F+k*.16666667,U=Math.sqrt(X*X+O*O),T[0]=U,de=1;de<8;de++)X+=B,O+=L,B+=P,L+=k,U+=Math.sqrt(X*X+O*O),T[de]=U;X+=B,O+=L,U+=Math.sqrt(X*X+O*O),T[8]=U,X+=B+P,O+=L+k,U+=Math.sqrt(X*X+O*O),T[9]=U,H=0}for(Z*=U;;H++){const de=T[H];if(!(Z>de)){if(H===0)Z/=de;else{const me=T[H-1];Z=H+(Z-me)/(de-me)}break}}this.addCurvePosition(Z*.1,y,b,g,w,E,M,_,I,l,Y,r||N>0&&ne===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,v=1-t,y=v*v,b=y*v,g=v*t,w=g*3,E=v*w,M=w*t,_=i*b+r*E+o*M+l*m,I=s*b+a*E+h*M+c*m;u[d]=_,u[d+1]=I,f&&(t<.001?u[d+2]=Math.atan2(a-s,r-i):u[d+2]=Math.atan2(I-(s*y+a*g*2+h*p),_-(i*y+r*g*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 Tl))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}};x(Ls,"NONE",-1),x(Ls,"BEFORE",-2),x(Ls,"AFTER",-3);let om=Ls;var ta;(function(n){n[n.none=0]="none",n[n.reset=1]="reset",n[n.update=2]="update",n[n.pose=3]="pose"})(ta||(ta={}));class lm{constructor(){x(this,"inertia",0);x(this,"strength",0);x(this,"damping",0);x(this,"massInverse",0);x(this,"wind",0);x(this,"gravity",0);x(this,"mix",0)}set(e){this.inertia=e.inertia,this.strength=e.strength,this.damping=e.damping,this.massInverse=e.massInverse,this.wind=e.wind,this.gravity=e.gravity,this.mix=e.mix}}class cm{constructor(){x(this,"color",new vt(1,1,1,1));x(this,"darkColor",null);x(this,"attachment",null);x(this,"sequenceIndex",0);x(this,"deform",[])}SlotPose(){}set(e){if(e==null)throw new Error("pose cannot be null.");this.color.setFromColor(e.color),this.darkColor!=null&&e.darkColor!=null&&this.darkColor.setFromColor(e.darkColor),this.attachment=e.attachment,this.sequenceIndex=e.sequenceIndex,this.deform.length=0,this.deform.push(...e.deform)}getAttachment(){return this.attachment}setAttachment(e){this.attachment!==e&&((!(e instanceof or)||!(this.attachment instanceof or)||e.timelineAttachment!==this.attachment.timelineAttachment)&&(this.deform.length=0),this.attachment=e,this.sequenceIndex=-1)}}class vp extends Rw{constructor(t,i){super(t,new cm,new cm);x(this,"skeleton");x(this,"bone");x(this,"attachmentState",0);if(!i)throw new Error("skeleton cannot be null.");this.skeleton=i,this.bone=i.bones[t.boneData.index],t.setupPose.darkColor!=null&&(this.pose.darkColor=new vt,this.constrainedPose.darkColor=new vt),this.setupPose()}copy(t,i,s){const r=new vp(t.data,this.skeleton);return this.data.setupPose.darkColor!=null&&(r.pose.darkColor=new vt,r.constrainedPose.darkColor=new vt),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 ia=class ia{constructor(e){x(this,"data");x(this,"bones");x(this,"slots");x(this,"drawOrder");x(this,"constraints");x(this,"physics");x(this,"_updateCache",[]);x(this,"resetCache",[]);x(this,"skin",null);x(this,"color");x(this,"scaleX",1);x(this,"_scaleY",1);x(this,"x",0);x(this,"y",0);x(this,"time",0);x(this,"windX",1);x(this,"windY",0);x(this,"gravityX",0);x(this,"gravityY",1);x(this,"_update",0);if(!e)throw new Error("data cannot be null.");this.data=e,this.bones=[];for(let t=0;t<e.bones.length;t++){const i=e.bones[t];let s;if(!i.parent)s=new ol(i,null);else{const r=this.bones[i.parent.index];s=new ol(i,r),r.children.push(s)}this.bones.push(s)}this.slots=[];for(const t of this.data.slots)this.slots.push(new vp(t,this));this.drawOrder=new l3(this.slots),this.physics=[],this.constraints=[];for(const t of this.data.constraints){const i=t.create(this);i instanceof lu&&this.physics.push(i),this.constraints.push(i)}this.color=new vt(1,1,1,1),this.updateCache()}static get yDir(){return ia.yDown?-1:1}get scaleY(){return this._scaleY*ia.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 ol&&(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 Iv,i=new Iv;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,v=null;const y=f.appliedPose.attachment;if(y){if(y instanceof go)p=8,m=rt.setArraySize(i,p,0),y.computeWorldVertices(f,y.getOffsets(f.appliedPose),m,0,2),v=ia.quadTriangles;else if(y instanceof Br)p=y.worldVerticesLength,m=rt.setArraySize(i,p,0),y.computeWorldVertices(this,f,0,p,m,0,2),v=y.triangles;else if(y instanceof au&&s){s.clipEnd(f),s.clipStart(this,f,y);continue}if(m&&v){s!=null&&s.isClipping()&&s.clipTriangles(m,v,v.length)&&(m=s.clippedVertices,p=s.clippedVertices.length);for(let b=0,g=m.length;b<g;b+=2){const w=m[b],E=m[b+1];o=Math.min(o,w),h=Math.min(h,E),l=Math.max(l,w),c=Math.max(c,E)}}}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)}};x(ia,"quadTriangles",[0,1,2,2,3,0]),x(ia,"yDown",!1);let hm=ia;class lu extends Ll{constructor(t,i){super(t,new lm,new lm);x(this,"bone");x(this,"_reset",!0);x(this,"ux",0);x(this,"uy",0);x(this,"cx",0);x(this,"cy",0);x(this,"tx",0);x(this,"ty",0);x(this,"xOffset",0);x(this,"xLag",0);x(this,"xVelocity",0);x(this,"yOffset",0);x(this,"yLag",0);x(this,"yVelocity",0);x(this,"rotateOffset",0);x(this,"rotateLag",0);x(this,"rotateVelocity",0);x(this,"scaleOffset",0);x(this,"scaleLag",0);x(this,"scaleVelocity",0);x(this,"remaining",0);x(this,"lastTime",0);if(i==null)throw new Error("skeleton cannot be null.");this.bone=i.bones[t.bone.index].constrainedPose}copy(t){var i=new lu(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*Xe.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!==ta.none){switch(c.modifyWorld(t),i){case ta.reset:this.reset(t);case ta.update:{const p=Math.max(t.time-this.lastTime,0),m=this.remaining;this.remaining+=p,this.lastTime=t.time;const v=c.worldX,y=c.worldY;if(this._reset)this._reset=!1,this.ux=v,this.uy=y;else{let b=this.remaining,g=s.inertia,w=t.data.referenceScale,E=-1,M=0,_=0,I=this.data.limit*p,R=I*Math.abs(t.scaleY);if(I*=Math.abs(t.scaleX),a||o){if(a){const F=(this.ux-v)*g;this.xOffset+=F>I?I:F<-I?-I:F,this.ux=v}if(o){const F=(this.uy-y)*g;this.yOffset+=F>R?R:F<-R?-R:F,this.uy=y}if(b>=d){const F=this.xOffset,P=this.yOffset;E=s.damping**(60*d),M=d*s.massInverse,_=s.strength;const k=w*s.wind,B=w*s.gravity,L=(k*t.windX+B*t.gravityX)*t.scaleX,X=(k*t.windY+B*t.gravityY)*t.scaleY;do a&&(this.xVelocity+=(L-this.xOffset*_)*M,this.xOffset+=this.xVelocity*d,this.xVelocity*=E),o&&(this.yVelocity-=(X+this.yOffset*_)*M,this.yOffset+=this.yVelocity*d,this.yVelocity*=E),b-=d;while(b>=d);this.xLag=this.xOffset-F,this.yLag=this.yOffset-P}f=Math.max(0,1-b/d),a&&(c.worldX+=(this.xOffset-this.xLag*f)*r*this.data.x),o&&(c.worldY+=(this.yOffset-this.yLag*f)*r*this.data.y)}if(h||l){let F=Math.atan2(c.c,c.a),P=0,k=0,B=0,L=this.cx-c.worldX,X=this.cy-c.worldY;if(L>I?L=I:L<-I&&(L=-I),X>R?X=R:X<-R&&(X=-R),b=this.remaining,h){B=(this.data.rotate+this.data.shearX)*r,f=this.rotateLag*Math.max(0,1-m/d);let O=Math.atan2(X+this.ty,L+this.tx)-F-(this.rotateOffset-f)*B;this.rotateOffset+=(O-Math.ceil(O*Xe.invPI2-.5)*Xe.PI2)*g,O=(this.rotateOffset-f)*B+F,P=Math.cos(O),k=Math.sin(O),l&&(O=u*c.getWorldScaleX(),O>0&&(this.scaleOffset+=(L*P+X*k)*g/O))}else{P=Math.cos(F),k=Math.sin(F);const O=u*c.getWorldScaleX()-this.scaleLag*Math.max(0,1-m/d);O>0&&(this.scaleOffset+=(L*P+X*k)*g/O)}if(b>=d){E===-1&&(E=s.damping**(60*d),M=d*s.massInverse,_=s.strength);const O=s.wind*t.windX+s.gravity*t.gravityX,D=(s.wind*t.windY+s.gravity*t.gravityY)*hm.yDir,T=this.rotateOffset,U=this.scaleOffset,N=u/w;for(;;)if(b-=d,l&&(this.scaleVelocity+=(O*P-D*k-this.scaleOffset*_)*M,this.scaleOffset+=this.scaleVelocity*d,this.scaleVelocity*=E),h){if(this.rotateVelocity-=((O*k+D*P)*N+this.rotateOffset*_)*M,this.rotateOffset+=this.rotateVelocity*d,this.rotateVelocity*=E,b<d)break;const Y=this.rotateOffset*B+F;P=Math.cos(Y),k=Math.sin(Y)}else if(b<d)break;this.rotateLag=this.rotateOffset-T,this.scaleLag=this.scaleOffset-U}f=Math.max(0,1-b/d)}this.remaining=b}this.cx=c.worldX,this.cy=c.worldY;break}case ta.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,v=0,y=0;if(this.data.shearX>0){let b=0;this.data.rotate>0&&(b=p*this.data.rotate,m=Math.sin(b),v=Math.cos(b),y=c.b,c.b=v*y-m*c.d,c.d=m*y+v*c.d),b+=p*this.data.shearX,m=Math.sin(b),v=Math.cos(b),y=c.a,c.a=v*y-m*c.c,c.c=m*y+v*c.c}else p*=this.data.rotate,m=Math.sin(p),v=Math.cos(p),y=c.a,c.a=v*y-m*c.c,c.c=m*y+v*c.c,y=c.b,c.b=v*y-m*c.d,c.d=m*y+v*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 es.Uniform:c.b*=p,c.d*=p;break;case es.Volume:p=Math.abs(p),p=p>=.7?1/p:4-3.67347*p,c.b*=p,c.d*=p}}i!==ta.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 Dc extends Dl{constructor(t){super(t,new lm);x(this,"_bone",null);x(this,"x",0);x(this,"y",0);x(this,"rotate",0);x(this,"scaleX",0);x(this,"shearX",0);x(this,"limit",0);x(this,"step",0);x(this,"inertiaGlobal",!1);x(this,"strengthGlobal",!1);x(this,"dampingGlobal",!1);x(this,"massGlobal",!1);x(this,"windGlobal",!1);x(this,"gravityGlobal",!1);x(this,"mixGlobal",!1);x(this,"_scaleYMode",es.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 lu(this,t)}}typeof Math.fround>"u"&&(Math.fround=(n=>e=>(n[0]=e,n[0]))(new Float32Array(1)));class um{constructor(){x(this,"time",0);x(this,"mix",0)}set(e){this.time=e.time,this.mix=e.mix}}const hl=class hl extends Ll{constructor(t,i){super(t,new um,new um);x(this,"bone",null);if(!i)throw new Error("skeleton cannot be null.");t.bone!=null&&(this.bone=i.bones[t.bone.index])}copy(t){var i=new hl(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,hl.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,tt.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(i3(p))t.constrained(h[p.slotIndex]);else if(p instanceof Fr||p instanceof yo)t.drawOrder.constrained();else if(p instanceof Nr)if(p.constraintIndex===-1)for(let m=0;m<u;m++)t.constrained(c[m]);else t.constrained(l[p.constraintIndex]);else if(n3(p)){const m=p.constraintIndex;m!==-1&&t.constrained(l[m])}}}};x(hl,"offsets",[0,0,0,0,0,0]);let dm=hl;class sa extends Dl{constructor(t){super(t,new um);x(this,"animation");x(this,"additive",!1);x(this,"loop",!1);x(this,"bone",null);x(this,"property");x(this,"scale",0);x(this,"offset",0);x(this,"local",!1);x(this,"max",0)}create(t){return new dm(this,t)}}class Fw{constructor(){x(this,"name",null);x(this,"bones",[]);x(this,"slots",[]);x(this,"skins",[]);x(this,"defaultSkin",null);x(this,"events",[]);x(this,"animations",[]);x(this,"constraints",[]);x(this,"x",0);x(this,"y",0);x(this,"width",0);x(this,"height",0);x(this,"referenceScale",100);x(this,"version",null);x(this,"hash",null);x(this,"fps",30);x(this,"imagesPath",null);x(this,"audioPath",null)}findBone(e){if(!e)throw new Error("boneName cannot be null.");const t=this.bones;for(let i=0,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 sa&&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 Lv{constructor(e=0,t,i){x(this,"slotIndex",0);x(this,"placeholder");x(this,"attachment");this.slotIndex=e,this.placeholder=t,this.attachment=i}}class fm{constructor(e){x(this,"name");x(this,"attachments",[]);x(this,"bones",[]);x(this,"constraints",[]);x(this,"color",new vt(.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 Br?(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 Lv(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 Lv(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 Ow extends pp{constructor(t,i,s){super(i,new cm);x(this,"index",0);x(this,"boneData");x(this,"attachmentName",null);x(this,"blendMode",Mh.Normal);x(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 Mh;(function(n){n[n.Normal=0]="Normal",n[n.Additive=1]="Additive",n[n.Multiply=2]="Multiply",n[n.Screen=3]="Screen"})(Mh||(Mh={}));class mm{constructor(){x(this,"mixRotate",0);x(this,"mixX",0);x(this,"mixY",0);x(this,"mixScaleX",0);x(this,"mixScaleY",0);x(this,"mixShearY",0)}set(e){this.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY,this.mixScaleX=e.mixScaleX,this.mixScaleY=e.mixScaleY,this.mixShearY=e.mixShearY}}class yp extends Ll{constructor(t,i){super(t,new mm,new mm);x(this,"bones");x(this,"source");if(!i)throw new Error("skeleton cannot be null.");this.bones=[];for(const r of t.bones)this.bones.push(i.bones[r.index].constrainedPose);const s=i.bones[t.source.index];if(s==null)throw new Error("source cannot be null.");this.source=s}copy(t){var i=new yp(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,v=this.bones.length;m<v;m++){const y=p[m];o?y.modifyLocal(t):y.modifyWorld(t);for(let b=0;b<f;b++){const g=d[b],w=g.value(t,u,a,c)-g.offset,E=g.to;for(let M=0,_=g.to.length;M<_;M++){const I=E[M];if(I.mix(s)!==0){let R=I.offset+w*I.scale;l&&(I.offset<I.max?R=Xe.clamp(R,I.offset,I.max):R=Xe.clamp(R,I.max,I.offset)),I.apply(t,s,y,R,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 wi=class wi extends Dl{constructor(t){super(t,new mm);x(this,"bones",[]);x(this,"_source",null);x(this,"offsets",[0,0,0,0,0,0]);x(this,"offsetX",0);x(this,"offsetY",0);x(this,"localSource",!1);x(this,"localTarget",!1);x(this,"additive",!1);x(this,"clamp",!1);x(this,"properties",[])}set source(t){this._source=t}get source(){if(this._source)return this._source;throw new Error("BoneData not set.")}create(t){return new yp(this,t)}getOffsetRotation(){return this.offsets[wi.ROTATION]}setOffsetRotation(t){this.offsets[wi.ROTATION]=t}getOffsetX(){return this.offsets[wi.X]}setOffsetX(t){this.offsets[wi.X]=t}getOffsetY(){return this.offsets[wi.Y]}setOffsetY(t){this.offsets[wi.Y]=t}getOffsetScaleX(){return this.offsets[wi.SCALEX]}setOffsetScaleX(t){this.offsets[wi.SCALEX]=t}getOffsetScaleY(){return this.offsets[wi.SCALEY]}setOffsetScaleY(t){this.offsets[wi.SCALEY]=t}getOffsetShearY(){return this.offsets[wi.SHEARY]}setOffsetShearY(t){this.offsets[wi.SHEARY]=t}};x(wi,"ROTATION",0),x(wi,"X",1),x(wi,"Y",2),x(wi,"SCALEX",3),x(wi,"SCALEY",4),x(wi,"SHEARY",5);let Ut=wi;class Mo{constructor(){x(this,"offset",0);x(this,"to",[])}}class Eo{constructor(){x(this,"offset",0);x(this,"max",0);x(this,"scale",0)}}class pm extends Mo{value(e,t,i,s){if(i)return t.rotation+s[Ut.ROTATION];const r=e.scaleX,a=e.scaleY;let o=Math.atan2(t.c/a,t.a/r)*Xe.radDeg+((t.a*t.d-t.b*t.c)*r*a>0?s[Ut.ROTATION]:-s[Ut.ROTATION]);return o<0&&(o+=360),o}}class Bw extends Eo{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*=Xe.degRad,a||(s-=Math.atan2(f,u)),s>Xe.PI?s-=Xe.PI2:s<-Xe.PI&&(s+=Xe.PI2),s*=t.mixRotate;const m=Math.cos(s),v=Math.sin(s);i.a=(m*u-v*f)*o,i.b=(m*d-v*p)*o,i.c=(v*u+m*f)*h,i.d=(v*d+m*p)*h}}}class gm extends Mo{value(e,t,i,s){return i?t.x+s[Ut.X]:(s[Ut.X]*t.a+s[Ut.Y]*t.b+t.worldX)/e.scaleX}}class Lw extends Eo{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 vm extends Mo{value(e,t,i,s){return i?t.y+s[Ut.Y]:(s[Ut.X]*t.c+s[Ut.Y]*t.d+t.worldY)/e.scaleY}}class Dw extends Eo{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 ym extends Mo{value(e,t,i,s){if(i)return t.scaleX+s[Ut.SCALEX];const r=t.a/e.scaleX,a=t.c/e.scaleY;return Math.sqrt(r*r+a*a)+s[Ut.SCALEX]}}class Nw extends Eo{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 xm extends Mo{value(e,t,i,s){if(i)return t.scaleY+s[Ut.SCALEY];const r=t.b/e.scaleX,a=t.d/e.scaleY;return Math.sqrt(r*r+a*a)+s[Ut.SCALEY]}}class Uw extends Eo{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 bm extends Mo{value(e,t,i,s){if(i)return t.shearY+s[Ut.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))*Xe.radDeg-90+s[Ut.SHEARY]}}class Xw extends Eo{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)*Xe.degRad,a?s-=Xe.PI/2:(s-=u-Math.atan2(i.c/h,i.a/o),s>Xe.PI?s-=Xe.PI2:s<-Xe.PI&&(s+=Xe.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 uU{constructor(e){x(this,"scale",1);x(this,"attachmentLoader");x(this,"linkedMeshes",[]);this.attachmentLoader=e}readSkeletonData(e){const t=this.scale,i=new Fw;i.name="";const s=new c3(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 v=p===0?null:l[s.readInt(!0)],y=new ou(p,m,v),b=y.setupPose;b.rotation=s.readFloat(),b.x=s.readFloat()*t,b.y=s.readFloat()*t,b.scaleX=s.readFloat(),b.scaleY=s.readFloat(),b.shearX=s.readFloat(),b.shearY=s.readFloat(),b.inherit=s.readByte(),y.length=s.readFloat()*t,y.skinRequired=s.readBoolean(),o&&(vt.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 v=l[s.readInt(!0)],y=new Ow(p,m,v);vt.rgba8888ToColor(y.setupPose.color,s.readInt32());const b=s.readInt32();b!==-1&&vt.rgb888ToColor(y.setupPose.darkColor=new vt,b),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 v;switch(s.readByte()){case R3:{const y=new Bc(m);v=s.readInt(!0);for(let w=0;w<v;w++)y.bones.push(l[s.readInt(!0)]);y.target=l[s.readInt(!0)];const b=s.readByte();y.skinRequired=(b&1)!==0,(b&2)!==0&&(y.scaleYMode=s.readUnsignedByte());const g=y.setupPose;g.bendDirection=(b&4)!==0?-1:1,g.compress=(b&8)!==0,g.stretch=(b&16)!==0,(b&32)!==0&&(g.mix=(b&64)!==0?s.readFloat():1),(b&128)!==0&&(g.softness=s.readFloat()*t),c.push(y);break}case k3:{const y=new Ut(m);v=s.readInt(!0);for(let w=0;w<v;w++)y.bones.push(l[s.readInt(!0)]);y.source=l[s.readInt(!0)];let b=s.readUnsignedByte();y.skinRequired=(b&1)!==0,y.localSource=(b&2)!==0,y.localTarget=(b&4)!==0,y.additive=(b&8)!==0,y.clamp=(b&16)!==0,v=b>>5;for(let w=0,E;w<v;w++){let M=1,_;switch(s.readByte()){case 0:_=new pm;break;case 1:{M=t,_=new gm;break}case 2:{M=t,_=new vm;break}case 3:_=new ym;break;case 4:_=new xm;break;case 5:_=new bm;break;default:_=null}if(_){_.offset=s.readFloat()*M,E=s.readByte();for(let I=0;I<E;I++){let R=1,F;switch(s.readByte()){case 0:F=new Bw;break;case 1:{R=t,F=new Lw;break}case 2:{R=t,F=new Dw;break}case 3:F=new Nw;break;case 4:F=new Uw;break;case 5:F=new Xw;break;default:F=null}F&&(F.offset=s.readFloat()*R,F.max=s.readFloat()*R,F.scale=s.readFloat()*R/M,_.to[I]=F)}y.properties[w]=_}}b=s.readByte(),(b&1)!==0&&(y.offsets[Ut.ROTATION]=s.readFloat()),(b&2)!==0&&(y.offsets[Ut.X]=s.readFloat()*t),(b&4)!==0&&(y.offsets[Ut.Y]=s.readFloat()*t),(b&8)!==0&&(y.offsets[Ut.SCALEX]=s.readFloat()),(b&16)!==0&&(y.offsets[Ut.SCALEY]=s.readFloat()),(b&32)!==0&&(y.offsets[Ut.SHEARY]=s.readFloat()),b=s.readByte();const g=y.setupPose;(b&1)!==0&&(g.mixRotate=s.readFloat()),(b&2)!==0&&(g.mixX=s.readFloat()),(b&4)!==0&&(g.mixY=s.readFloat()),(b&8)!==0&&(g.mixScaleX=s.readFloat()),(b&16)!==0&&(g.mixScaleY=s.readFloat()),(b&32)!==0&&(g.mixShearY=s.readFloat()),c.push(y);break}case P3:{const y=new Lc(m);v=s.readInt(!0);for(let w=0;w<v;w++)y.bones.push(l[s.readInt(!0)]);y.slot=i.slots[s.readInt(!0)];const b=s.readByte();y.skinRequired=(b&1)!==0,y.positionMode=b>>1&1,y.spacingMode=b>>2&3,y.rotateMode=b>>4&3,(b&128)!==0&&(y.offsetRotation=s.readFloat());const g=y.setupPose;g.position=s.readFloat(),y.positionMode===_n.Fixed&&(g.position*=t),g.spacing=s.readFloat(),(y.spacingMode===Ci.Length||y.spacingMode===Ci.Fixed)&&(g.spacing*=t),g.mixRotate=s.readFloat(),g.mixX=s.readFloat(),g.mixY=s.readFloat(),c.push(y);break}case F3:{const y=new Dc(m);y.bone=l[s.readInt(!0)];let b=s.readByte();if(y.skinRequired=(b&1)!==0,(b&2)!==0&&(y.x=s.readFloat()),(b&4)!==0&&(y.y=s.readFloat()),(b&8)!==0&&(y.rotate=s.readFloat()),(b&16)!==0){let w=s.readFloat();w<-2?(y.scaleYMode=es.Volume,w=-2-w):w<0&&(y.scaleYMode=es.Uniform,w=-1-w),y.scaleX=w}(b&32)!==0&&(y.shearX=s.readFloat()),y.limit=((b&64)!==0?s.readFloat():5e3)*t,y.step=1/s.readUnsignedByte();const g=y.setupPose;g.inertia=s.readFloat(),g.strength=s.readFloat(),g.damping=s.readFloat(),g.massInverse=(b&128)!==0?s.readFloat():1,g.wind=s.readFloat(),g.gravity=s.readFloat(),b=s.readByte(),(b&1)!==0&&(y.inertiaGlobal=!0),(b&2)!==0&&(y.strengthGlobal=!0),(b&4)!==0&&(y.dampingGlobal=!0),(b&8)!==0&&(y.massGlobal=!0),(b&16)!==0&&(y.windGlobal=!0),(b&32)!==0&&(y.gravityGlobal=!0),(b&64)!==0&&(y.mixGlobal=!0),g.mix=(b&128)!==0?s.readFloat():1,c.push(y);break}case O3:{const y=new sa(m),b=s.readByte();if(y.skinRequired=(b&1)!==0,y.loop=(b&2)!==0,y.additive=(b&4)!==0,(b&8)!==0){const g=s.readFloat();o&&(b&64)!==0?y.max=g:y.setupPose.time=g}if((b&16)!==0&&(y.setupPose.mix=(b&32)!==0?s.readFloat():1),(b&64)!==0){y.local=(b&128)!==0,y.bone=l[s.readInt(!0)];const g=s.readFloat();let w=1;switch(s.readByte()){case 0:y.property=new pm;break;case 1:{w=t,y.property=new gm;break}case 2:{w=t,y.property=new vm;break}case 3:y.property=new ym;break;case 4:y.property=new xm;break;case 5:y.property=new bm;break;default:continue}y.property.offset=g*w,y.offset=s.readFloat(),y.scale=s.readFloat()/w}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(rt.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],v=i.skins[m.skinIndex];if(!m.source)throw new Error("Linked mesh parent must not be null");const y=v.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 v=new kw(m),y=v.setupPose;y.intValue=s.readInt(!1),y.floatValue=s.readFloat(),y.stringValue=s.readString(),v._audioPath=s.readString(),v.audioPath&&(y.volume=s.readFloat(),y.balance=s.readFloat()),i.events.push(v)}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 sa&&(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 fm("default")}else{const o=e.readString();if(!o)throw new Error("Skin name must not be null.");r=new fm(o),s&&vt.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 Nn.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(),v=e.readFloat(),y=e.readFloat(),b=e.readFloat(),g=e.readFloat();c||(c=l);const w=this.attachmentLoader.newRegionAttachment(i,r,l,c,d);return w?(w.path=c,w.x=p*o,w.y=m*o,w.scaleX=v,w.scaleY=y,w.rotation=f,w.width=b*o,w.height=g*o,vt.rgba8888ToColor(w.color,u),w.updateSequence(),w):null}case Nn.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&&vt.rgba8888ToColor(d.color,u),d):null}case Nn.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),v=this.readShortArray(e,(p.length-f-2)*3),y=e.readInt(!0);let b=null;if(y>0){b=[];for(let _=0;_<y;_++)b[_]=e.readInt(!0)}let g=[],w=0,E=0;a&&(g=this.readShortArray(e,e.readInt(!0)),w=e.readFloat(),E=e.readFloat()),c||(c=l);const M=this.attachmentLoader.newMeshAttachment(i,r,l,c,d);return M?(M.path=c,vt.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=v,b&&(M.timelineSlots=b),a&&(M.edges=g,M.width=w*o,M.height=E*o),M.updateSequence(),M):null}case Nn.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),v=e.readStringRef();let y=0,b=0;a&&(y=e.readFloat(),b=e.readFloat());const g=this.attachmentLoader.newMeshAttachment(i,r,l,c,d);return g?(g.path=c,vt.rgba8888ToColor(g.color,u),a&&(g.width=y*o,g.height=b*o),this.linkedMeshes.push(new h3(g,m,s,p,v,f)),g):null}case Nn.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&&vt.rgba8888ToColor(m.color,p),m):null}case Nn.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&&vt.rgba8888ToColor(p.color,f),p):null}case Nn.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&&vt.rgba8888ToColor(f.color,d),f):null}}}readSequence(e,t){if(!t)return new vo(1,!1);const i=new vo(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 Dv(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 Dv(o,rt.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 v=0,y=e.readInt(!0);v<y;v++){const b=e.readByte(),g=e.readInt(!0),w=g-1;switch(b){case T3:{const E=new al(g,m);for(let M=0;M<g;M++)E.setFrame(M,e.readFloat(),e.readStringRef());r.push(E);break}case M3:{const E=e.readInt(!0),M=new hw(g,E,m);let _=e.readFloat(),I=e.readUnsignedByte()/255,R=e.readUnsignedByte()/255,F=e.readUnsignedByte()/255,P=e.readUnsignedByte()/255;for(let k=0,B=0;M.setFrame(k,_,I,R,F,P),k!==w;k++){const L=e.readFloat(),X=e.readUnsignedByte()/255,O=e.readUnsignedByte()/255,D=e.readUnsignedByte()/255,T=e.readUnsignedByte()/255;switch(e.readByte()){case hn:M.setStepped(k);break;case un:Ft(e,M,B++,k,0,_,L,I,X,1),Ft(e,M,B++,k,1,_,L,R,O,1),Ft(e,M,B++,k,2,_,L,F,D,1),Ft(e,M,B++,k,3,_,L,P,T,1)}_=L,I=X,R=O,F=D,P=T}r.push(M);break}case E3:{const E=e.readInt(!0),M=new uw(g,E,m);let _=e.readFloat(),I=e.readUnsignedByte()/255,R=e.readUnsignedByte()/255,F=e.readUnsignedByte()/255;for(let P=0,k=0;M.setFrame(P,_,I,R,F),P!==w;P++){const B=e.readFloat(),L=e.readUnsignedByte()/255,X=e.readUnsignedByte()/255,O=e.readUnsignedByte()/255;switch(e.readByte()){case hn:M.setStepped(P);break;case un:Ft(e,M,k++,P,0,_,B,I,L,1),Ft(e,M,k++,P,1,_,B,R,X,1),Ft(e,M,k++,P,2,_,B,F,O,1)}_=B,I=L,R=X,F=O}r.push(M);break}case A3:{const E=e.readInt(!0),M=new fw(g,E,m);let _=e.readFloat(),I=e.readUnsignedByte()/255,R=e.readUnsignedByte()/255,F=e.readUnsignedByte()/255,P=e.readUnsignedByte()/255,k=e.readUnsignedByte()/255,B=e.readUnsignedByte()/255,L=e.readUnsignedByte()/255;for(let X=0,O=0;M.setFrame(X,_,I,R,F,P,k,B,L),X!==w;X++){const D=e.readFloat(),T=e.readUnsignedByte()/255,U=e.readUnsignedByte()/255,N=e.readUnsignedByte()/255,Y=e.readUnsignedByte()/255,G=e.readUnsignedByte()/255,H=e.readUnsignedByte()/255,ne=e.readUnsignedByte()/255;switch(e.readByte()){case hn:M.setStepped(X);break;case un:Ft(e,M,O++,X,0,_,D,I,T,1),Ft(e,M,O++,X,1,_,D,R,U,1),Ft(e,M,O++,X,2,_,D,F,N,1),Ft(e,M,O++,X,3,_,D,P,Y,1),Ft(e,M,O++,X,4,_,D,k,G,1),Ft(e,M,O++,X,5,_,D,B,H,1),Ft(e,M,O++,X,6,_,D,L,ne,1)}_=D,I=T,R=U,F=N,P=Y,k=G,B=H,L=ne}r.push(M);break}case C3:{const E=e.readInt(!0),M=new mw(g,E,m);let _=e.readFloat(),I=e.readUnsignedByte()/255,R=e.readUnsignedByte()/255,F=e.readUnsignedByte()/255,P=e.readUnsignedByte()/255,k=e.readUnsignedByte()/255,B=e.readUnsignedByte()/255;for(let L=0,X=0;M.setFrame(L,_,I,R,F,P,k,B),L!==w;L++){const O=e.readFloat(),D=e.readUnsignedByte()/255,T=e.readUnsignedByte()/255,U=e.readUnsignedByte()/255,N=e.readUnsignedByte()/255,Y=e.readUnsignedByte()/255,G=e.readUnsignedByte()/255;switch(e.readByte()){case hn:M.setStepped(L);break;case un:Ft(e,M,X++,L,0,_,O,I,D,1),Ft(e,M,X++,L,1,_,O,R,T,1),Ft(e,M,X++,L,2,_,O,F,U,1),Ft(e,M,X++,L,3,_,O,P,N,1),Ft(e,M,X++,L,4,_,O,k,Y,1),Ft(e,M,X++,L,5,_,O,B,G,1)}_=O,I=D,R=T,F=U,P=N,k=Y,B=G}r.push(M);break}case I3:{const E=new dw(g,e.readInt(!0),m);let M=e.readFloat(),_=e.readUnsignedByte()/255;for(let I=0,R=0;E.setFrame(I,M,_),I!==w;I++){const F=e.readFloat(),P=e.readUnsignedByte()/255;switch(e.readByte()){case hn:E.setStepped(I);break;case un:Ft(e,E,R++,I,0,M,F,_,P,1)}M=F,_=P}r.push(E)}}}}for(let f=0,p=e.readInt(!0);f<p;f++){const m=e.readInt(!0);for(let v=0,y=e.readInt(!0);v<y;v++){const b=e.readByte(),g=e.readInt(!0);if(b===_3){const E=new cw(g,m);for(let M=0;M<g;M++)E.setFrame(M,e.readFloat(),e.readByte());r.push(E);continue}const w=e.readInt(!0);switch(b){case f3:yi(e,r,new Sh(g,w,m),1);break;case m3:yi(e,r,new ew(g,w,m),a);break;case p3:yi(e,r,new tw(g,w,m),a);break;case g3:yi(e,r,new iw(g,w,m),a);break;case v3:yi(e,r,new sw(g,w,m),1);break;case y3:yi(e,r,new nw(g,w,m),1);break;case x3:yi(e,r,new rw(g,w,m),1);break;case b3:yi(e,r,new aw(g,w,m),1);break;case w3:yi(e,r,new ow(g,w,m),1);break;case S3:yi(e,r,new lw(g,w,m),1);break}}}for(let f=0,p=e.readInt(!0);f<p;f++){const m=e.readInt(!0),v=e.readInt(!0),y=v-1,b=new gw(v,e.readInt(!0),m);let g=e.readByte(),w=e.readFloat(),E=(g&1)!==0?(g&2)!==0?e.readFloat():1:0,M=(g&4)!==0?e.readFloat()*a:0;for(let _=0,I=0;b.setFrame(_,w,E,M,(g&8)!==0?1:-1,(g&16)!==0,(g&32)!==0),_!==y;_++){g=e.readByte();const R=e.readFloat(),F=(g&1)!==0?(g&2)!==0?e.readFloat():1:0,P=(g&4)!==0?e.readFloat()*a:0;(g&64)!==0?b.setStepped(_):(g&128)!==0&&(Ft(e,b,I++,_,0,w,R,E,F,1),Ft(e,b,I++,_,1,w,R,M,P,a)),w=R,E=F,M=P}r.push(b)}for(let f=0,p=e.readInt(!0);f<p;f++){const m=e.readInt(!0),v=e.readInt(!0),y=v-1,b=new vw(v,e.readInt(!0),m);let g=e.readFloat(),w=e.readFloat(),E=e.readFloat(),M=e.readFloat(),_=e.readFloat(),I=e.readFloat(),R=e.readFloat();for(let F=0,P=0;b.setFrame(F,g,w,E,M,_,I,R),F!==y;F++){const k=e.readFloat(),B=e.readFloat(),L=e.readFloat(),X=e.readFloat(),O=e.readFloat(),D=e.readFloat(),T=e.readFloat();switch(e.readByte()){case hn:b.setStepped(F);break;case un:Ft(e,b,P++,F,0,g,k,w,B,1),Ft(e,b,P++,F,1,g,k,E,L,1),Ft(e,b,P++,F,2,g,k,M,X,1),Ft(e,b,P++,F,3,g,k,_,O,1),Ft(e,b,P++,F,4,g,k,I,D,1),Ft(e,b,P++,F,5,g,k,R,T,1)}g=k,w=B,E=L,M=X,_=O,I=D,R=T}r.push(b)}for(let f=0,p=e.readInt(!0);f<p;f++){const m=e.readInt(!0),v=i.constraints[m];for(let y=0,b=e.readInt(!0);y<b;y++){const g=e.readByte(),w=e.readInt(!0),E=e.readInt(!0);switch(g){case D3:yi(e,r,new yw(w,E,m),v.positionMode===_n.Fixed?a:1);break;case N3:yi(e,r,new xw(w,E,m),v.spacingMode===Ci.Length||v.spacingMode===Ci.Fixed?a:1);break;case U3:{const M=new bw(w,E,m);let _=e.readFloat(),I=e.readFloat(),R=e.readFloat(),F=e.readFloat();for(let P=0,k=0,B=M.getFrameCount()-1;M.setFrame(P,_,I,R,F),P!==B;P++){const L=e.readFloat(),X=e.readFloat(),O=e.readFloat(),D=e.readFloat();switch(e.readByte()){case hn:M.setStepped(P);break;case un:Ft(e,M,k++,P,0,_,L,I,X,1),Ft(e,M,k++,P,1,_,L,R,O,1),Ft(e,M,k++,P,2,_,L,F,D,1)}_=L,I=X,R=O,F=D}r.push(M)}}}}for(let f=0,p=e.readInt(!0);f<p;f++){const m=e.readInt(!0)-1;for(let v=0,y=e.readInt(!0);v<y;v++){const b=e.readByte(),g=e.readInt(!0);if(b===W3){const E=new Th(g,m);for(let M=0;M<g;M++)E.setFrame(M,e.readFloat());r.push(E);continue}const w=e.readInt(!0);switch(b){case X3:yi(e,r,new ww(g,w,m),1);break;case Y3:yi(e,r,new Sw(g,w,m),1);break;case V3:yi(e,r,new _w(g,w,m),1);break;case $3:yi(e,r,new Tw(g,w,m),1);break;case G3:yi(e,r,new Mw(g,w,m),1);break;case j3:yi(e,r,new Ew(g,w,m),1);break;case H3:yi(e,r,new Aw(g,w,m),1);break;default:throw new Error("Unknown physics timeline type.")}}}for(let f=0,p=e.readInt(!0);f<p;f++){const m=e.readInt(!0);for(let v=0,y=e.readInt(!0);v<y;v++){const b=e.readByte(),g=e.readInt(!0),w=e.readInt(!0);switch(b){case z3:yi(e,r,new Cw(g,w,m),1);break;case q3:yi(e,r,new Iw(g,w,m),1);break;default:throw new Error(`Uknown slider type: ${b}`)}}}for(let f=0,p=e.readInt(!0);f<p;f++){const m=i.skins[e.readInt(!0)];for(let v=0,y=e.readInt(!0);v<y;v++){const b=e.readInt(!0);for(let g=0,w=e.readInt(!0);g<w;g++){const E=e.readStringRef();if(!E)throw new Error("attachmentName must not be null.");const M=m.getAttachment(b,E),_=e.readByte(),I=e.readInt(!0),R=I-1;switch(_){case B3:{const F=M,P=F.bones,k=F.vertices,B=P?k.length/3*2:k.length,L=e.readInt(!0),X=new pw(I,L,b,F);let O=e.readFloat();for(let D=0,T=0;;D++){let U,N=e.readInt(!0);if(N===0)U=P?rt.newFloatArray(B):k;else{U=rt.newFloatArray(B);const G=e.readInt(!0);if(N+=G,a===1)for(let H=G;H<N;H++)U[H]=e.readFloat();else for(let H=G;H<N;H++)U[H]=e.readFloat()*a;if(!P)for(let H=0,ne=U.length;H<ne;H++)U[H]+=k[H]}if(X.setFrame(D,O,U),D===R)break;const Y=e.readFloat();switch(e.readByte()){case hn:X.setStepped(D);break;case un:Ft(e,X,T++,D,0,O,Y,0,1,1)}O=Y}r.push(X);break}case L3:{const F=new _h(I,b,M);for(let P=0;P<I;P++){const k=e.readFloat(),B=e.readInt32();F.setFrame(P,k,Qb[B&15],B>>4,e.readFloat())}r.push(F);break}}}}}const o=i.slots.length,h=e.readInt(!0);if(h>0){const f=new Fr(h);for(let p=0;p<h;p++)f.setFrame(p,e.readFloat(),Nv(e,o));r.push(f)}const l=e.readInt(!0);for(let f=0;f<l;f++){const p=e.readInt(!0),m=new Array(p);for(let b=0;b<p;b++)m[b]=e.readInt(!0);const v=e.readInt(!0),y=new yo(v,m,o);for(let b=0;b<v;b++)y.setFrame(b,e.readFloat(),Nv(e,p));r.push(y)}const c=e.readInt(!0);if(c>0){const f=new _l(c);for(let p=0;p<c;p++){const m=e.readFloat(),v=i.events[e.readInt(!0)],y=new gp(m,v);y.intValue=e.readInt(!1),y.floatValue=e.readFloat(),y.stringValue=e.readString(),y.stringValue==null&&(y.stringValue=v.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 up(t,r,u);return s&&vt.rgba8888ToColor(d.color,e.readInt32()),d}}class c3{constructor(e,t=[],i=0,s=new DataView(e instanceof ArrayBuffer?e:e.buffer)){x(this,"strings");x(this,"index");x(this,"buffer");this.strings=t,this.index=i,this.buffer=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 h3=class{constructor(e,t,i,s,r,a){x(this,"source");x(this,"skinIndex");x(this,"slotIndex");x(this,"sourceIndex");x(this,"mesh");x(this,"inheritTimelines");this.mesh=e,this.skinIndex=t,this.slotIndex=i,this.sourceIndex=s,this.source=r,this.inheritTimelines=a}};class Dv{constructor(e=null,t,i=0){x(this,"bones");x(this,"vertices");x(this,"length");this.bones=e,this.vertices=t,this.length=i}}var Nn;(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"})(Nn||(Nn={}));function yi(n,e,t,i){t instanceof qn?u3(n,e,t,i):d3(n,e,t,i)}function u3(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 hn:t.setStepped(a);break;case un:Ft(n,t,o++,a,0,s,l,r,c,i)}s=l,r=c}e.push(t)}function d3(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 hn:t.setStepped(o);break;case un:Ft(n,t,h++,o,0,s,c,r,u,i),Ft(n,t,h++,o,1,s,c,a,d,i)}s=c,r=u,a=d}e.push(t)}function Nv(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 Ft(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 f3=0,m3=1,p3=2,g3=3,v3=4,y3=5,x3=6,b3=7,w3=8,S3=9,_3=10,T3=0,M3=1,E3=2,A3=3,C3=4,I3=5,R3=0,P3=1,k3=2,F3=3,O3=4,B3=0,L3=1,D3=0,N3=1,U3=2,X3=0,Y3=1,V3=2,$3=4,G3=5,j3=6,H3=7,W3=8,z3=0,q3=1,hn=1,un=2;class K3{constructor(e){x(this,"attachmentLoader");x(this,"scale",1);x(this,"linkedMeshes",[]);this.attachmentLoader=e}readSkeletonData(e){const t=this.scale,i=new Fw,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=te(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=te(o,"parent",null);l&&(h=i.findBone(l));const c=new ou(i.bones.length,o.name,h);c.length=te(o,"length",0)*t;const u=c.setupPose;u.x=te(o,"x",0)*t,u.y=te(o,"y",0)*t,u.rotation=te(o,"rotation",0),u.scaleX=te(o,"scaleX",1),u.scaleY=te(o,"scaleY",1),u.shearX=te(o,"shearX",0),u.shearY=te(o,"shearY",0),u.inherit=rt.enumValue(ci,te(o,"inherit","Normal")),c.skinRequired=te(o,"skin",!1);const d=te(o,"color",null);d&&c.color.setFromString(d),c.icon=te(o,"icon",void 0),c.iconSize=te(o,"iconSize",1),c.iconRotation=te(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 Ow(i.slots.length,h,l),u=te(o,"color",null);u&&c.setupPose.color.setFromString(u);const d=te(o,"dark",null);d&&(c.setupPose.darkColor=vt.fromString(d)),c.attachmentName=te(o,"attachment",null),c.blendMode=rt.enumValue(Mh,te(o,"blend","normal")),c.visible=te(o,"visible",!0),i.slots.push(c)}if(s.constraints)for(const a of s.constraints){const o=a.name,h=te(a,"skin",!1);switch(te(a,"type",!1)){case"ik":{const l=new Bc(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=te(a,"scaleY",null);d!=null&&(l.scaleYMode=rt.enumValue(es,d));const f=l.setupPose;f.mix=te(a,"mix",1),f.softness=te(a,"softness",0)*t,f.bendDirection=te(a,"bendPositive",!0)?1:-1,f.compress=te(a,"compress",!1),f.stretch=te(a,"stretch",!1),i.constraints.push(l);break}case"transform":{const l=new Ut(o);l.skinRequired=h;for(let w=0;w<a.bones.length;w++){const E=a.bones[w],M=i.findBone(E);if(!M)throw new Error(`Couldn't find bone ${E} 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=te(a,"localSource",!1),l.localTarget=te(a,"localTarget",!1),l.additive=te(a,"additive",!1),l.clamp=te(a,"clamp",!1);let d=!1,f=!1,p=!1,m=!1,v=!1,y=!1;const b=Object.entries(te(a,"properties",{}));for(const[w,E]of b){const M=this.fromProperty(w),_=this.propertyScale(w,t);M.offset=te(E,"offset",0)*_;const I=Object.entries(te(E,"to",{}));for(const[R,F]of I){let P=1,k;switch(R){case"rotate":{d=!0,k=new Bw;break}case"x":{f=!0,k=new Lw,P=t;break}case"y":{p=!0,k=new Dw,P=t;break}case"scaleX":{m=!0,k=new Nw;break}case"scaleY":{v=!0,k=new Uw;break}case"shearY":{y=!0,k=new Xw;break}default:throw new Error(`Invalid transform constraint to property: ${R}`)}k.offset=te(F,"offset",0)*P,k.max=te(F,"max",1)*P,k.scale=te(F,"scale",1)*P/_,M.to.push(k)}M.to.length>0&&l.properties.push(M)}l.offsets[Ut.ROTATION]=te(a,"rotation",0),l.offsets[Ut.X]=te(a,"x",0)*t,l.offsets[Ut.Y]=te(a,"y",0)*t,l.offsets[Ut.SCALEX]=te(a,"scaleX",0),l.offsets[Ut.SCALEY]=te(a,"scaleY",0),l.offsets[Ut.SHEARY]=te(a,"shearY",0);const g=l.setupPose;d&&(g.mixRotate=te(a,"mixRotate",1)),f&&(g.mixX=te(a,"mixX",1)),p&&(g.mixY=te(a,"mixY",g.mixX)),m&&(g.mixScaleX=te(a,"mixScaleX",1)),v&&(g.mixScaleY=te(a,"mixScaleY",g.mixScaleX)),y&&(g.mixShearY=te(a,"mixShearY",1)),i.constraints.push(l);break}case"path":{const l=new Lc(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=rt.enumValue(_n,te(a,"positionMode","Percent")),l.spacingMode=rt.enumValue(Ci,te(a,"spacingMode","Length")),l.rotateMode=rt.enumValue(pa,te(a,"rotateMode","Tangent")),l.offsetRotation=te(a,"rotation",0);const d=l.setupPose;d.position=te(a,"position",0),l.positionMode===_n.Fixed&&(d.position*=t),d.spacing=te(a,"spacing",0),(l.spacingMode===Ci.Length||l.spacingMode===Ci.Fixed)&&(d.spacing*=t),d.mixRotate=te(a,"mixRotate",1),d.mixX=te(a,"mixX",1),d.mixY=te(a,"mixY",d.mixX),i.constraints.push(l);break}case"physics":{const l=new Dc(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=te(a,"x",0),l.y=te(a,"y",0),l.rotate=te(a,"rotate",0),l.scaleX=te(a,"scaleX",0);const d=te(a,"scaleY",null);d!=null&&(l.scaleYMode=rt.enumValue(es,d)),l.shearX=te(a,"shearX",0),l.limit=te(a,"limit",5e3)*t,l.step=1/te(a,"fps",60);const f=l.setupPose;f.inertia=te(a,"inertia",.5),f.strength=te(a,"strength",100),f.damping=te(a,"damping",.85),f.massInverse=1/te(a,"mass",1),f.wind=te(a,"wind",0),f.gravity=te(a,"gravity",0),f.mix=te(a,"mix",1),l.inertiaGlobal=te(a,"inertiaGlobal",!1),l.strengthGlobal=te(a,"strengthGlobal",!1),l.dampingGlobal=te(a,"dampingGlobal",!1),l.massGlobal=te(a,"massGlobal",!1),l.windGlobal=te(a,"windGlobal",!1),l.gravityGlobal=te(a,"gravityGlobal",!1),l.mixGlobal=te(a,"mixGlobal",!1),i.constraints.push(l);break}case"slider":{const l=new sa(o);l.skinRequired=h,l.additive=te(a,"additive",!1),l.loop=te(a,"loop",!1),l.setupPose.mix=te(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=te(a,"from",0)*d,l.offset=te(a,"to",0),l.scale=te(a,"scale",1)/d,l.max=te(a,"max",0),l.local=te(a,"local",!1)}else l.setupPose.time=te(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 fm(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,Bc);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,Ut);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,Lc);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,Dc);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,sa);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 kw(a),l=h.setupPose;l.intValue=te(o,"int",0),l.floatValue=te(o,"float",0),l.stringValue=te(o,"string",""),h._audioPath=te(o,"audio",null),h.audioPath&&(l.volume=te(o,"volume",l.volume),l.balance=te(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,sa),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 pm;break;case"x":t=new gm;break;case"y":t=new vm;break;case"scaleX":t=new ym;break;case"scaleY":t=new xm;break;case"shearY":t=new bm;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=te(e,"name",s);switch(te(e,"type","region")){case"region":{const h=te(e,"path",o),l=this.readSequence(te(e,"sequence",null)),c=this.attachmentLoader.newRegionAttachment(t,s,o,h,l);if(!c)return null;c.path=h,c.x=te(e,"x",0)*a,c.y=te(e,"y",0)*a,c.scaleX=te(e,"scaleX",1),c.scaleY=te(e,"scaleY",1),c.rotation=te(e,"rotation",0),c.width=e.width*a,c.height=e.height*a;const u=te(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=te(e,"color",null);return l&&h.color.setFromString(l),h}case"mesh":case"linkedmesh":{const h=te(e,"path",o),l=this.readSequence(te(e,"sequence",null)),c=this.attachmentLoader.newMeshAttachment(t,s,o,h,l);if(!c)return null;c.path=h;const u=te(e,"color",null);u&&c.color.setFromString(u),c.width=te(e,"width",0)*a,c.height=te(e,"height",0)*a;const d=te(e,"source",null);if(d){let p=i;const m=te(e,"slot",null);if(m){const v=r.findSlot(m);if(!v)throw new Error(`Source mesh slot not found: ${m}`);p=v.index}return this.linkedMeshes.push(new Z3(c,te(e,"skin",null),i,p,d,te(e,"timelines",!0))),c}const f=e.uvs;return this.readVertices(e,c,f.length),c.triangles=e.triangles,c.regionUVs=f,c.edges=te(e,"edges",null),c.hullLength=te(e,"hull",0)*2,c.updateSequence(),c}case"path":{const h=this.attachmentLoader.newPathAttachment(t,s,o);if(!h)return null;h.closed=te(e,"closed",!1),h.constantSpeed=te(e,"constantSpeed",!0);const l=e.vertexCount;this.readVertices(e,h,l<<1);const c=rt.newArray(l/3,0);for(let d=0;d<e.lengths.length;d++)c[d]=e.lengths[d]*a;h.lengths=c;const u=te(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=te(e,"x",0)*a,h.y=te(e,"y",0)*a,h.rotation=te(e,"rotation",0);const l=te(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=te(e,"end",null);l&&(h.endSlot=r.findSlot(l)),h.convex=te(e,"convex",!1),h.inverse=te(e,"inverse",!1);const c=e.vertexCount;this.readVertices(e,h,c<<1);const u=te(e,"color",null);return u&&h.color.setFromString(u),h}}return null}readSequence(e){if(e==null)return new vo(1,!1);const t=new vo(te(e,"count",0),!0);return t.start=te(e,"start",1),t.digits=te(e,"digits",0),t.setupIndex=te(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=rt.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=rt.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 v=new al(m,d);for(let y=0;y<m;y++){const b=p[y];v.setFrame(y,te(b,"time",0),te(b,"name",null))}r.push(v);break}case"rgba":{const v=new hw(m,m<<2,d);let y=p[0],b=te(y,"time",0),g=vt.fromString(y.color);for(let w=0,E=0;;w++){v.setFrame(w,b,g.r,g.g,g.b,g.a);const M=p[w+1];if(!M){v.shrink(E);break}const _=te(M,"time",0),I=vt.fromString(M.color),R=y.curve;R&&(E=Lt(R,v,E,w,0,b,_,g.r,I.r,1),E=Lt(R,v,E,w,1,b,_,g.g,I.g,1),E=Lt(R,v,E,w,2,b,_,g.b,I.b,1),E=Lt(R,v,E,w,3,b,_,g.a,I.a,1)),b=_,g=I,y=M}r.push(v);break}case"rgb":{const v=new uw(m,m*3,d);let y=p[0],b=te(y,"time",0),g=vt.fromString(y.color);for(let w=0,E=0;;w++){v.setFrame(w,b,g.r,g.g,g.b);const M=p[w+1];if(!M){v.shrink(E);break}const _=te(M,"time",0),I=vt.fromString(M.color),R=y.curve;R&&(E=Lt(R,v,E,w,0,b,_,g.r,I.r,1),E=Lt(R,v,E,w,1,b,_,g.g,I.g,1),E=Lt(R,v,E,w,2,b,_,g.b,I.b,1)),b=_,g=I,y=M}r.push(v);break}case"alpha":{ds(r,p,new dw(m,m,d),0,1);break}case"rgba2":{const v=new fw(m,m*7,d);let y=p[0],b=te(y,"time",0),g=vt.fromString(y.light),w=vt.fromString(y.dark);for(let E=0,M=0;;E++){v.setFrame(E,b,g.r,g.g,g.b,g.a,w.r,w.g,w.b);const _=p[E+1];if(!_){v.shrink(M);break}const I=te(_,"time",0),R=vt.fromString(_.light),F=vt.fromString(_.dark),P=y.curve;P&&(M=Lt(P,v,M,E,0,b,I,g.r,R.r,1),M=Lt(P,v,M,E,1,b,I,g.g,R.g,1),M=Lt(P,v,M,E,2,b,I,g.b,R.b,1),M=Lt(P,v,M,E,3,b,I,g.a,R.a,1),M=Lt(P,v,M,E,4,b,I,w.r,F.r,1),M=Lt(P,v,M,E,5,b,I,w.g,F.g,1),M=Lt(P,v,M,E,6,b,I,w.b,F.b,1)),b=I,g=R,w=F,y=_}r.push(v);break}case"rgb2":{const v=new mw(m,m*6,d);let y=p[0],b=te(y,"time",0),g=vt.fromString(y.light),w=vt.fromString(y.dark);for(let E=0,M=0;;E++){v.setFrame(E,b,g.r,g.g,g.b,w.r,w.g,w.b);const _=p[E+1];if(!_){v.shrink(M);break}const I=te(_,"time",0),R=vt.fromString(_.light),F=vt.fromString(_.dark),P=y.curve;P&&(M=Lt(P,v,M,E,0,b,I,g.r,R.r,1),M=Lt(P,v,M,E,1,b,I,g.g,R.g,1),M=Lt(P,v,M,E,2,b,I,g.b,R.b,1),M=Lt(P,v,M,E,3,b,I,w.r,F.r,1),M=Lt(P,v,M,E,4,b,I,w.g,F.g,1),M=Lt(P,v,M,E,5,b,I,w.b,F.b,1)),b=I,g=R,w=F,y=_}r.push(v);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":ds(r,p,new Sh(m,m,d),0,1);break;case"translate":Jd(r,p,new ew(m,m<<1,d),"x","y",0,s);break;case"translatex":ds(r,p,new tw(m,m,d),0,s);break;case"translatey":ds(r,p,new iw(m,m,d),0,s);break;case"scale":Jd(r,p,new sw(m,m<<1,d),"x","y",1,1);break;case"scalex":ds(r,p,new nw(m,m,d),1,1);break;case"scaley":ds(r,p,new rw(m,m,d),1,1);break;case"shear":Jd(r,p,new aw(m,m<<1,d),"x","y",0,1);break;case"shearx":ds(r,p,new ow(m,m,d),0,1);break;case"sheary":ds(r,p,new lw(m,m,d),0,1);break;case"inherit":{const v=new cw(m,u.index);for(let y=0;y<p.length;y++){const b=p[y];v.setFrame(y,te(b,"time",0),rt.enumValue(ci,te(b,"inherit","Normal")))}r.push(v);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,Bc);if(!d)throw new Error(`IK Constraint not found: ${l}`);const f=new gw(c.length,c.length<<1,i.constraints.indexOf(d));let p=te(u,"time",0),m=te(u,"mix",1),v=te(u,"softness",0)*s;for(let y=0,b=0;;y++){f.setFrame(y,p,m,v,te(u,"bendPositive",!0)?1:-1,te(u,"compress",!1),te(u,"stretch",!1));const g=c[y+1];if(!g){f.shrink(b);break}const w=te(g,"time",0),E=te(g,"mix",1),M=te(g,"softness",0)*s,_=u.curve;_&&(b=Lt(_,f,b,y,0,p,w,m,E,1),b=Lt(_,f,b,y,1,p,w,v,M,s)),p=w,m=E,v=M,u=g}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,Ut);if(!d)throw new Error(`Transform constraint not found: ${l}`);const f=new vw(c.length,c.length*6,i.constraints.indexOf(d));let p=te(u,"time",0),m=te(u,"mixRotate",1),v=te(u,"mixX",1),y=te(u,"mixY",v),b=te(u,"mixScaleX",1),g=te(u,"mixScaleY",1),w=te(u,"mixShearY",1);for(let E=0,M=0;;E++){f.setFrame(E,p,m,v,y,b,g,w);const _=c[E+1];if(!_){f.shrink(M);break}const I=te(_,"time",0),R=te(_,"mixRotate",1),F=te(_,"mixX",1),P=te(_,"mixY",F),k=te(_,"mixScaleX",1),B=te(_,"mixScaleY",1),L=te(_,"mixShearY",1),X=u.curve;X&&(M=Lt(X,f,M,E,0,p,I,m,R,1),M=Lt(X,f,M,E,1,p,I,v,F,1),M=Lt(X,f,M,E,2,p,I,y,P,1),M=Lt(X,f,M,E,3,p,I,b,k,1),M=Lt(X,f,M,E,4,p,I,g,B,1),M=Lt(X,f,M,E,5,p,I,w,L,1)),p=I,m=R,v=F,y=P,b=k,g=B,w=L,u=_}r.push(f)}if(e.path)for(const l in e.path){const c=e.path[l],u=i.findConstraint(l,Lc);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 v=p.length;switch(f){case"position":{const y=new yw(v,v,d);ds(r,p,y,0,u.positionMode===_n.Fixed?s:1);break}case"spacing":{const y=new xw(v,v,d);ds(r,p,y,0,u.spacingMode===Ci.Length||u.spacingMode===Ci.Fixed?s:1);break}case"mix":{const y=new bw(v,v*3,d);let b=te(m,"time",0),g=te(m,"mixRotate",1),w=te(m,"mixX",1),E=te(m,"mixY",w);for(let M=0,_=0;;M++){y.setFrame(M,b,g,w,E);const I=p[M+1];if(!I){y.shrink(_);break}const R=te(I,"time",0),F=te(I,"mixRotate",1),P=te(I,"mixX",1),k=te(I,"mixY",P),B=m.curve;B&&(_=Lt(B,y,_,M,0,b,R,g,F,1),_=Lt(B,y,_,M,1,b,R,w,P,1),_=Lt(B,y,_,M,2,b,R,E,k,1)),b=R,g=F,w=P,E=k,m=I}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,Dc);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 v,y=0;if(d==="reset"){const b=new Th(m,u);for(let g=0;p!=null;p=f[g+1],g++)b.setFrame(g,te(p,"time",0));r.push(b);continue}switch(d){case"inertia":v=new ww(m,m,u);break;case"strength":v=new Sw(m,m,u);break;case"damping":v=new _w(m,m,u);break;case"mass":v=new Tw(m,m,u);break;case"wind":v=new Mw(m,m,u);break;case"gravity":v=new Ew(m,m,u);break;case"mix":{y=1,v=new Aw(m,m,u);break}default:continue}ds(r,f,v,y,1)}}if(e.slider)for(const l in e.slider){const c=e.slider[l],u=i.findConstraint(l,sa);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 v=p.length;switch(f){case"time":ds(r,p,new Cw(v,v,d),1,1);break;case"mix":ds(r,p,new Iw(v,v,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 v in f){const y=f[v],b=u.getAttachment(m,v);if(!b)throw new Error(`Timeline attachment not found: ${v}`);for(const g in y){const w=y[g];let E=w[0];if(E){if(g==="deform"){const M=b.bones,_=b.vertices,I=M?_.length/3*2:_.length,R=new pw(w.length,w.length,m,b);let F=te(E,"time",0);for(let P=0,k=0;;P++){let B;const L=te(E,"vertices",null);if(!L)B=M?rt.newFloatArray(I):_;else{B=rt.newFloatArray(I);const T=te(E,"offset",0);if(rt.arrayCopy(L,0,B,T,L.length),s!==1)for(let U=T,N=U+L.length;U<N;U++)B[U]*=s;if(!M)for(let U=0;U<I;U++)B[U]+=_[U]}R.setFrame(P,F,B);const X=w[P+1];if(!X){R.shrink(k);break}const O=te(X,"time",0),D=E.curve;D&&(k=Lt(D,R,k,P,0,F,O,0,1,1)),F=O,E=X}r.push(R)}else if(g==="sequence"){const M=new _h(w.length,m,b);let _=0;for(let I=0;I<w.length;I++){const R=te(E,"delay",_),F=te(E,"time",0),P=Ui[te(E,"mode","hold")],k=te(E,"index",0);M.setFrame(I,F,P,k,R),_=R,E=w[I+1]}r.push(M)}}}}}}if(e.drawOrder){const l=new Fr(e.drawOrder.length),c=i.slots.length;let u=0;for(const d of e.drawOrder)l.setFrame(u++,te(d,"time",0),Uv(i,d,c,null));r.push(l)}if(e.drawOrderFolder)for(const l of e.drawOrderFolder){const c=te(l,"slots",[]),u=new Array(c.length);let d=0;for(const v of c){const y=i.findSlot(v);if(!y)throw new Error(`Draw order folder slot not found: ${v}`);u[d++]=y.index}const f=te(l,"keys",[]),p=new yo(f.length,u,i.slots.length);let m=0;for(const v of f)p.setFrame(m++,te(v,"time",0),Uv(i,v,u.length,u));r.push(p)}if(e.events){const l=new _l(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 gp(rt.toSinglePrecision(te(d,"time",0)),f);m.intValue=te(d,"int",p.intValue),m.floatValue=te(d,"float",p.floatValue),m.stringValue=te(d,"string",p.stringValue),m.data.audioPath&&(m.volume=te(d,"volume",p.volume),m.balance=te(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 up(t,r,a),h=te(e,"color",null);h!==null&&o.color.setFromString(h),i.animations.push(o)}}class Z3{constructor(e,t,i,s,r,a){x(this,"source");x(this,"skin");x(this,"slotIndex");x(this,"sourceIndex");x(this,"mesh");x(this,"inheritTimelines");this.mesh=e,this.skin=t,this.slotIndex=i,this.sourceIndex=s,this.source=r,this.inheritTimelines=a}}function ds(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=Lt(r.curve,t,h,l,0,a,u,o,d,s)),a=u,o=d,r=c}}function Jd(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,v=(f[s]??r)*a,y=o.curve;y&&(u=Lt(y,t,u,d,0,h,p,l,m,a),u=Lt(y,t,u,d,1,h,p,c,v,a)),h=p,l=m,c=v,o=f}}function Uv(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 Lt(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 te(n,e,t){return n[e]!==void 0?n[e]:t}class J3{newRegionAttachment(e,t,i,s){return new iu(t,i)}newMeshAttachment(e,t,i,s){return new Ol(t,i)}newBoundingBoxAttachment(e,t){return new vb(t)}newPathAttachment(e,t){return new Sl(t)}newPointAttachment(e,t){return new _b(t)}newClippingAttachment(e,t){return new oo(t)}}class Q3{sequence(e){for(let t=0;t<e.regions.length;t++){if(e.regions[t])continue;const i=new Zb;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 go(i,this.sequence(r))}newMeshAttachment(e,t,i,s,r){return new Br(i,this.sequence(r))}newBoundingBoxAttachment(e,t,i){return new fp(i)}newPathAttachment(e,t,i){return new Tl(i)}newPointAttachment(e,t,i){return new mp(i)}newClippingAttachment(e,t,i){return new au(i)}}const eO=new Set(["normal","onlyTranslation","noRotationOrReflection","noScale","noScaleOrReflection"]);function tO(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++],v=s[h++];if(!Number.isInteger(f)||f<0||f>=t)throw new Error(`拖尾网格“${e}”引用了不存在的骨骼`);if(![p,m,v].every(Number.isFinite)||v<0)throw new Error(`拖尾网格“${e}”包含无效权重数据`);u+=v}if(Math.abs(u-1)>.001)throw new Error(`拖尾网格“${e}”的顶点权重之和不为 1`);l++}if(h!==s.length||l!==a)throw new Error(`拖尾网格“${e}”的顶点数量与 UV 不一致`)}function iO(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&&!eO.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"&&(tO(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 sO(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 Xv(n,e){var a;const t=JSON.parse(n),i=ch((a=t==null?void 0:t.skeleton)==null?void 0:a.spine);if(!i)throw new Error(`导出版本不受支持,仅支持 Spine ${Kf()}`);if(e&&i!==e)throw new Error(`导出版本不一致:设置为 Spine ${e},JSON 标记为 Spine ${i}`);iO(t,i),i==="3.8"&&sO(t);const s=i==="3.8"?Lb(JSON.parse(JSON.stringify(t))):t,r=i==="4.3"?new K3(new Q3).readSkeletonData(s):new ph(new J3).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 Yw="http://127.0.0.1:27843";class wm extends Error{constructor(t,i="CONNECTOR_ERROR",s){super(t);x(this,"code");x(this,"pairUrl");this.name="SpineConnectorError",this.code=i,this.pairUrl=s}}function Sm(n,e){return String(n||"").trim().replace(/[\\/:*?"<>|]+/g,"_").replace(/^\.+/,"")||e}function nO(n,e){const t=/\.([a-z0-9]{2,5})$/i.exec(n);return t?`.${t[1].toLowerCase()}`:e.includes("jpeg")?".jpg":e.includes("webp")?".webp":e.includes("gif")?".gif":".png"}function rO(n,e,t){const i=String(n||"").replace(/\\/g,"/").split("/").filter(Boolean).map(r=>Sm(r,"images")),s=Sm(e.replace(/\.[^./\\]+$/,""),"image");return[...i,`${s}${nO(e,t)}`].join("/")}async function Qd(n,e,t){if(!n)return null;const i=await fetch(n);if(!i.ok)throw new Error(`无法读取导出图片:${t}`);const s=await i.blob(),r=new Uint8Array(await s.arrayBuffer());let a="";const o=32768;for(let h=0;h<r.length;h+=o)a+=String.fromCharCode(...r.subarray(h,h+o));return{path:rO(e,t,s.type),dataBase64:btoa(a)}}async function Vw(n){const e=[];for(const i of n.filter(s=>s.visible!==!1)){for(const s of i.config.imageResources)if(s.imageMode==="sequence"&&s.sequenceFrames.length)for(const r of s.sequenceFrames)e.push(Qd(r.previewUrl,s.textureFolder,r.name||s.textureName));else e.push(Qd(s.previewUrl,s.textureFolder,s.textureName));if(i.config.trail)for(const s of i.config.trailResources)e.push(Qd(s.previewUrl,"",s.textureName))}const t=new Map;for(const i of await Promise.all(e))i&&!t.has(i.path)&&t.set(i.path,i);return[...t.values()]}async function aO(){try{const n=await fetch(`${Yw}/v1/health`,{cache:"no-store"});if(!n.ok)throw new Error(`HTTP ${n.status}`);return{available:!0,...await n.json()}}catch(n){return{available:!1,authorized:!1,error:n instanceof Error?n.message:String(n)}}}async function oO(n){const e=await Vw(n.systems);let t;try{t=await fetch(`${Yw}/v1/convert`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({schemaVersion:1,projectName:n.projectName,spineVersion:n.spineVersion,skeletonJson:n.skeletonJson,images:e})})}catch{throw new wm("未检测到本地 Spine 连接器,请先启动连接器","CONNECTOR_OFFLINE")}if(!t.ok){const r=await t.json().catch(()=>({}));throw new wm(r.message||`Spine 连接器返回错误:HTTP ${t.status}`,r.code,r.pairUrl)}const i=t.headers.get("X-Spine-File-Name");let s=`${Sm(n.projectName,"SpineParticle")}.zip`;if(i)try{s=decodeURIComponent(i)}catch{}return{blob:await t.blob(),fileName:s,spineEditorVersion:t.headers.get("X-Spine-Editor-Version")||n.spineVersion,imageCount:e.length}}function lO(n,e){const t=URL.createObjectURL(n),i=document.createElement("a");i.href=t,i.download=/\.zip$/i.test(e)?e:`${e}.zip`,i.style.display="none",document.body.appendChild(i),i.click(),i.remove(),setTimeout(()=>URL.revokeObjectURL(t),1e3)}const cO=Array.from({length:256},(n,e)=>{let t=e;for(let i=0;i<8;i++)t=t&1?3988292384^t>>>1:t>>>1;return t>>>0});function hO(n){let e=4294967295;for(const t of n)e=cO[(e^t)&255]^e>>>8;return(e^4294967295)>>>0}function uO(n){const e=String(n||"").replace(/\\/g,"/").split("/").filter(t=>t&&t!==".");if(!e.length||e.some(t=>t===".."))throw new Error("ZIP 文件路径无效");return e.join("/")}function dO(n=new Date){const e=Math.max(1980,n.getFullYear());return{time:n.getHours()<<11|n.getMinutes()<<5|Math.floor(n.getSeconds()/2),date:e-1980<<9|n.getMonth()+1<<5|n.getDate()}}function ef(n){const e=new Uint8Array(n);return{bytes:e,view:new DataView(e.buffer)}}function Yv(n){const e=new Uint8Array(n.reduce((i,s)=>i+s.length,0));let t=0;for(const i of n)e.set(i,t),t+=i.length;return e}function fO(n){const e=new TextEncoder,t=[],i=[],s=dO();let r=0;for(const h of n){const l=e.encode(uO(h.name)),c=hO(h.data),u=ef(30);u.view.setUint32(0,67324752,!0),u.view.setUint16(4,20,!0),u.view.setUint16(6,2048,!0),u.view.setUint16(10,s.time,!0),u.view.setUint16(12,s.date,!0),u.view.setUint32(14,c,!0),u.view.setUint32(18,h.data.length,!0),u.view.setUint32(22,h.data.length,!0),u.view.setUint16(26,l.length,!0),t.push(u.bytes,l,h.data);const d=ef(46);d.view.setUint32(0,33639248,!0),d.view.setUint16(4,20,!0),d.view.setUint16(6,20,!0),d.view.setUint16(8,2048,!0),d.view.setUint16(12,s.time,!0),d.view.setUint16(14,s.date,!0),d.view.setUint32(16,c,!0),d.view.setUint32(20,h.data.length,!0),d.view.setUint32(24,h.data.length,!0),d.view.setUint16(28,l.length,!0),d.view.setUint32(42,r,!0),i.push(d.bytes,l),r+=u.bytes.length+l.length+h.data.length}const a=Yv(i),o=ef(22);return o.view.setUint32(0,101010256,!0),o.view.setUint16(8,n.length,!0),o.view.setUint16(10,n.length,!0),o.view.setUint32(12,a.length,!0),o.view.setUint32(16,r,!0),new Blob([Yv([...t,a,o.bytes])],{type:"application/zip"})}function mO(n){const e=atob(n),t=new Uint8Array(e.length);for(let i=0;i<e.length;i++)t[i]=e.charCodeAt(i);return t}function pO(n){const t=String(n||"./images/").replace(/\\/g,"/").replace(/^\.\//,"").replace(/^\/+|\/+$/g,"").split("/").filter(Boolean);return!t.length||t.some(i=>i===".."||/^[a-z]+:/i.test(i))?"images":t.join("/")}function gO(n){return String(n||"SpineParticle").replace(/\.json$/i,"").replace(/[\\/:*?"<>|]+/g,"_").replace(/^\.+/,"")||"SpineParticle"}async function vO(n){const e=await Vw(n.systems);if(!e.length)throw new Error("当前可见粒子系统没有可导出的图片");const t=pO(n.imagesPath);return{blob:fO(e.map(s=>({name:`${t}/${s.path}`,data:mO(s.dataBase64)}))),imageCount:e.length,folder:t}}function yO(n,e){const t=`${gO(e)}-images.zip`,i=URL.createObjectURL(n),s=document.createElement("a");return s.href=i,s.download=t,s.style.display="none",document.body.appendChild(s),s.click(),s.remove(),setTimeout(()=>URL.revokeObjectURL(i),1e3),t}const xO={class:"panel"},bO={class:"panel-scroll"},wO={class:"group config-management"},SO={class:"caret"},_O={class:"group-body config-management-body"},TO={class:"config-toolbar"},MO=["disabled"],EO={value:""},AO=["value"],CO={class:"group"},IO={class:"caret"},RO={class:"scene-actions"},PO=["disabled"],kO={class:"group-body"},FO={class:"tree scene-tree"},OO=["onClick"],BO={class:"tlabel"},LO=["title","aria-label","onClick"],DO={viewBox:"0 0 24 24","aria-hidden":"true"},NO={key:0,class:"eye-slash",d:"M4 4l16 16"},UO=["onClick"],XO=["onClick"],YO={class:"tlabel"},VO=["title","aria-label","onClick"],$O={viewBox:"0 0 24 24","aria-hidden":"true"},GO={key:0,class:"eye-slash",d:"M4 4l16 16"},jO=["onClick"],HO=["onClick"],WO={class:"tlabel"},zO=["title","aria-label","onClick"],qO={viewBox:"0 0 24 24","aria-hidden":"true"},KO={key:0,class:"eye-slash",d:"M4 4l16 16"},ZO=["onClick"],JO=["onClick"],QO={class:"tlabel"},eB=["title","aria-label","onClick"],tB={viewBox:"0 0 24 24","aria-hidden":"true"},iB={key:0,class:"eye-slash",d:"M4 4l16 16"},sB=["onClick"],nB={key:0,class:"empty"},rB={class:"row"},aB={class:"seed-row scene-seed"},oB={class:"field-block"},lB={class:"field-block"},cB={class:"tag-editor"},hB=["onClick"],uB={class:"field-grid"},dB={class:"field-block"},fB={class:"field-block check-field"},mB={class:"field-grid"},pB={class:"compact-field"},gB={class:"compact-field"},vB={class:"field-grid"},yB={class:"compact-field"},xB={class:"compact-field"},bB={key:1,class:"field-grid"},wB={class:"compact-field"},SB={class:"compact-field"},_B={key:2,class:"field-grid"},TB={class:"compact-field"},MB={class:"compact-field"},EB={class:"field-block"},AB={key:4,class:"field-grid"},CB={class:"compact-field"},IB={class:"compact-field"},RB={class:"collider-follow-section"},PB={class:"follow-path"},kB={class:"field-block"},FB=["value"],OB={class:"field-grid"},BB={class:"compact-field"},LB={class:"compact-field"},DB={class:"follow-path"},NB={class:"field-block"},UB={class:"field-grid"},XB={class:"compact-field"},YB={class:"compact-field"},VB={class:"field-grid"},$B={class:"compact-field"},GB={class:"compact-field"},jB={class:"setting-line"},HB={class:"setting-line"},WB={class:"field-block"},zB={key:4,class:"panel-hint"},qB={class:"group"},KB={class:"caret"},ZB={class:"group-body"},JB={class:"segs"},QB={class:"segs stream-behavior-segs"},eL={key:2,class:"stream-loop-options"},tL={class:"loop-section-row"},iL={class:"switch-row"},sL=["checked"],nL={key:0,class:"loop-duration-control"},rL={class:"switch-row loop-duration-toggle"},aL=["checked"],oL={class:"loop-section-duration"},lL=["value"],cL={key:1},hL={key:2,class:"loop-auto-duration"},uL={class:"loop-section-row"},dL={class:"switch-row"},fL=["checked"],mL={key:0,class:"loop-duration-control"},pL={class:"switch-row loop-duration-toggle"},gL=["checked"],vL={class:"loop-section-duration"},yL=["value"],xL={key:1},bL={key:2,class:"loop-auto-duration"},wL={key:3,class:"modifier-hint stream-loop-hint"},SL={class:"group"},_L={class:"caret"},TL={class:"group-body"},ML={class:"row"},EL={class:"group"},AL={class:"caret"},CL={class:"group-body attr-body"},IL={class:"attr-axis-head"},RL={class:"axis-modes"},PL={class:"life-item"},kL={class:"switch-row"},FL={class:"life-item"},OL={class:"switch-row"},BL={class:"axis-modes life-axis"},LL={class:"life-item"},DL={class:"switch-row"},NL={class:"group"},UL={class:"caret"},XL={class:"group-body"},YL={class:"seg"},VL={class:"row"},$L={class:"curve-wrap"},GL={class:"row"},jL=["onUpdate:modelValue"],HL=["onUpdate:modelValue"],WL={class:"row resource-color-row"},zL=["onUpdate:modelValue"],qL=["onUpdate:modelValue"],KL={key:0,class:"row resource-color-picker"},ZL=["onUpdate:modelValue"],JL=["value","onChange","onKeydown"],QL={key:0,class:"random-color-hint"},eD={class:"resource-alpha-head"},tD={class:"alpha-modes"},iD=["onClick"],sD=["onClick"],nD=["onClick"],rD={class:"row"},aD=["onUpdate:modelValue"],oD={class:"resource-alpha-curve"},lD={class:"group"},cD={class:"caret"},hD={class:"group-body"},uD={class:"modifier-item"},dD={class:"switch-row modifier-switch"},fD={key:0,class:"modifier-params"},mD={class:"modifier-item"},pD={class:"switch-row modifier-switch"},gD={key:0,class:"modifier-params gravity-params"},vD={class:"modifier-mode-row"},yD={class:"modifier-item"},xD={class:"switch-row modifier-switch"},bD={key:0,class:"modifier-params gravity-params"},wD={class:"modifier-mode-row"},SD={class:"modifier-item"},_D={class:"switch-row modifier-switch"},TD={key:0,class:"modifier-params"},MD={class:"row"},ED={class:"modifier-item"},AD={class:"switch-row modifier-switch"},CD={key:0,class:"modifier-params"},ID={class:"row"},RD={class:"row"},PD={class:"modifier-item"},kD={class:"switch-row modifier-switch"},FD={key:0,class:"modifier-params trail-params"},OD={class:"row"},BD=["onUpdate:modelValue"],LD={class:"row"},DD=["onUpdate:modelValue"],ND={class:"row"},UD=["onUpdate:modelValue"],XD={class:"switch-row trail-sub-switch"},YD=["onUpdate:modelValue"],VD={class:"switch-row trail-sub-switch"},$D=["onUpdate:modelValue"],GD={class:"trail-mode-head"},jD={class:"alpha-modes"},HD=["onClick"],WD=["onClick"],zD=["onClick"],qD={class:"row"},KD=["onUpdate:modelValue"],ZD={key:6,class:"row trail-fixed-color"},JD=["onUpdate:modelValue"],QD=["value","onChange","onKeydown"],eN={class:"trail-mode-head"},tN={class:"alpha-modes"},iN=["onClick"],sN=["onClick"],nN=["onClick"],rN={class:"trail-grid-row"},aN={class:"modifier-item"},oN={class:"switch-row modifier-switch"},lN=["disabled"],cN={key:0,class:"modifier-params emitter-follow-params"},hN={class:"field-block"},uN=["value"],dN={key:0,value:"bone"},fN={class:"field-block"},mN=["value"],pN={class:"field-block"},gN={class:"field-grid follow-grid"},vN={class:"compact-field"},yN={class:"compact-field"},xN={class:"field-block"},bN={key:0,class:"bone-follow-target"},wN={key:1,class:"bone-follow-missing"},SN={class:"field-block"},_N={class:"field-grid follow-grid"},TN={class:"compact-field"},MN={class:"compact-field"},EN={class:"bone-follow-transform-grid"},AN={class:"compact-field"},CN={class:"compact-field"},IN={class:"compact-field"},RN={class:"group"},PN={class:"caret"},kN={class:"group-body export-settings"},FN={class:"export-field"},ON={class:"export-field"},BN={class:"export-field"},LN={key:0,class:"export-help"},DN={class:"export-fps-row"},NN={class:"export-field export-fps-field"},UN={class:"export-checkbox"},XN={class:"export-switches"},YN={class:"switch-row export-switch"},VN={class:"switch-row export-switch"},$N={class:"switch-row export-switch export-switch-last"},GN={class:"spine-export-actions"},jN=["disabled","title"],HN=["disabled"],WN=["disabled","title"],zN={key:0},qN=["href"],KN=["href"],ZN=En({__name:"ParticlePanel",setup(n){const e=Fl();e.settings.exportSettings=k1(e.settings.exportSettings);const t=ft(()=>e.settings.exportSettings),i=lt(null),s=lt(""),r=lt([]),a=lt(!1),o=lt(""),h=lt(!1),l=lt(!1),c=lt(null),u=lt(""),d=lt(!1),f=lt(null),p=lt(""),m=ft(()=>{const $=f.value;return $?$.available?$.spineFound?$.authorized?"连接器可用 · Spine 已就绪":"连接器已启动,当前网站尚未授权":"连接器已启动,但未找到 Spine":"本地 Spine 连接器未启动":"正在检测本地 Spine 连接器…"}),v=ft(()=>{var $,S,C,ee,Pe,wt;return{ready:!!(($=f.value)!=null&&$.available)&&!!((S=f.value)!=null&&S.spineFound)&&!!((C=f.value)!=null&&C.authorized),warning:!!((ee=f.value)!=null&&ee.available)&&(!((Pe=f.value)!=null&&Pe.spineFound)||!((wt=f.value)!=null&&wt.authorized))}}),y=ft(()=>{var $,S,C;return!!(($=f.value)!=null&&$.available)&&!!((S=f.value)!=null&&S.spineFound)&&!!((C=f.value)!=null&&C.authorized)}),b=ft(()=>{const $=f.value;return!($!=null&&$.available)||!$.spineFound||$.authorized||typeof window>"u"?"":`http://127.0.0.1:27843/pair?origin=${encodeURIComponent(window.location.origin)}`}),g=ft(()=>{const $=f.value;return $?$.available?$.spineFound?$.authorized?"":"未授权":"未找到 Spine":"未启动":"检测中"}),w=ft(()=>l.value?"正在重新计算并生成 Spine 工程":g.value?`暂不可用:${g.value}`:`调用本机 Spine 自动生成 ${t.value.spineVersion} 工程`);function E($){return $==="跟随导出"?t.value.keyframeCurve==="bezier"?"bezier":"linear":$==="贝塞尔"?"bezier":"linear"}e.systems.length||e.addSystem();function M(){Yb(e),h.value=!1,o.value="配置已保存到本地"}async function _($){var ee;const S=$.target,C=(ee=S.files)==null?void 0:ee[0];if(C){o.value="正在加载配置…",h.value=!1;try{await $R(e,C),o.value=`已加载:${C.name}`}catch(Pe){h.value=!0,o.value=Pe instanceof Error?Pe.message:String(Pe)}finally{S.value=""}}}async function I(){try{const $=await fetch(`/Preset/index.json?t=${Date.now()}`,{cache:"no-store"});if(!$.ok)throw new Error("无法读取预设列表");const S=await $.json();r.value=Array.isArray(S)?S.filter(C=>!!C&&typeof C.name=="string"&&typeof C.file=="string"):[]}catch{r.value=[]}}async function R(){const $=s.value;if($){a.value=!0,h.value=!1,o.value="正在加载预设…";try{const S=await fetch(`/Preset/${encodeURIComponent($)}`,{cache:"no-store"});if(!S.ok)throw new Error(`无法读取预设:${$}`);await $b(e,await S.text()),o.value=`已加载预设:${$.replace(/\.json$/i,"")}`}catch(S){h.value=!0;const C=S instanceof Error?S.message:String(S);o.value=`${C},请检查预设文件命名`}finally{a.value=!1,s.value=""}}}So(()=>{I(),P(),F=window.setInterval(P,3e3)});let F;Dm(()=>{F!==void 0&&window.clearInterval(F)});async function P(){f.value=await aO()}function k(){return new Promise($=>requestAnimationFrame(()=>$()))}async function B(){e.timeline.playing=!1,e.timeline.frame=0,e.timeline.recorded=!1;for(const C of e.systems)C.frames=void 0;e.recalcTotalFrames(),await k(),e.timeline.playing=!0;const $=e.timeline.totalFrames/Math.max(1,e.timeline.fps)*1e3,S=performance.now()+Math.max(8e3,$*2.5+3e3);for(;!e.timeline.recorded;){if(performance.now()>S)throw new Error("重新计算动画超时,请确认页面仍在运行后重试");await new Promise(C=>setTimeout(C,50))}}async function L(){if(!l.value){l.value=!0,c.value="json",d.value=!1,p.value="",u.value="正在重新计算粒子动画…";try{await B();const $=Cv({systems:e.systems,timeline:e.timeline,settings:t.value});Xv($.text,t.value.spineVersion),qF($,t.value.fileName);const S=$.warnings.length?`;${$.warnings.length} 条资源提示(缺图仍已导出)`:"";u.value=`已导出 Spine ${t.value.spineVersion}:${$.particleSystemCount} 个粒子系统、${$.animationCount} 个动画、${$.boneCount} 根骨骼${S}`}catch($){d.value=!0,u.value=$ instanceof Error?$.message:String($)}finally{l.value=!1,c.value=null}}}async function X(){if(!l.value){l.value=!0,c.value="spine",d.value=!1,p.value="",u.value="正在重新计算粒子动画…";try{await B();const $=Cv({systems:e.systems,timeline:e.timeline,settings:t.value});Xv($.text,t.value.spineVersion),u.value="正在整理图片并调用本机 Spine…";const S=t.value.fileName.replace(/\.json$/i,"")||"SpineParticle",C=await oO({projectName:S,spineVersion:t.value.spineVersion,skeletonJson:$.text,systems:e.systems});lO(C.blob,C.fileName),u.value=`已生成 ${C.fileName}:包含 .spine 工程和 ${C.imageCount} 张图片,Spine ${C.spineEditorVersion}`,await P()}catch($){d.value=!0,$ instanceof wm&&$.pairUrl&&(p.value=$.pairUrl),u.value=$ instanceof Error?$.message:String($),await P()}finally{l.value=!1,c.value=null}}}async function O(){if(!l.value){l.value=!0,c.value="images",d.value=!1,p.value="",u.value="正在整理当前粒子系统使用的图片…";try{const $=await vO({systems:e.systems,imagesPath:t.value.imagesPath}),S=yO($.blob,t.value.fileName);u.value=`已生成 ${S}:${$.folder}/ 内包含 ${$.imageCount} 张图片`}catch($){d.value=!0,u.value=$ instanceof Error?$.message:String($)}finally{l.value=!1,c.value=null}}}const D=ft(()=>{const $=e.systems.findIndex(S=>S.id===e.activeId);return $>=0?$:0}),T=ft(()=>e.systems[D.value]||null),U=ft(()=>T.value?F1(T.value.config,e.timeline.fps):30),N=ft(()=>{var S;const $=(S=T.value)==null?void 0:S.config;return $?Math.max(1,Math.ceil(Number($.loopDurationFrames)||1)):1}),Y=ft(()=>e.activeObjectType),G=ft(()=>e.activeObjectType==="collision"&&e.colliders.find($=>$.id===e.activeObjectId)||null),H=ft(()=>e.activeObjectType==="path"&&e.paths.find($=>$.id===e.activeObjectId)||null),ne=ft(()=>e.activeObjectType==="spine"&&e.spines.find($=>$.id===e.activeObjectId)||null),Z=ft(()=>e.activeObjectType==="particle"?e.systems.some($=>$.id===e.activeObjectId):e.activeObjectType==="collision"?e.colliders.some($=>$.id===e.activeObjectId):e.activeObjectType==="path"?e.paths.some($=>$.id===e.activeObjectId):e.spines.some($=>$.id===e.activeObjectId)),de=ft(()=>{const $=e.spines.find(S=>S.selectedBone&&S.bones.some(C=>C.name===S.selectedBone));return $?{spine:$,boneName:$.selectedBone}:null}),me=ft(()=>{var C;const $=(C=T.value)==null?void 0:C.config;if(!$||$.emitterFollowMode!=="bone")return null;const S=e.spines.find(ee=>ee.id===$.emitterFollowSpineId);return!S||!S.bones.some(ee=>ee.name===$.emitterFollowBoneName)?null:{spine:S,boneName:$.emitterFollowBoneName}});Uo(()=>{for(const $ of e.systems)$.visible==null&&($.visible=!0);for(const $ of e.colliders)$.visible==null&&($.visible=!0);for(const $ of e.paths)$.visible==null&&($.visible=!0);for(const $ of e.spines)$.visible==null&&($.visible=!0)}),Uo(()=>{if(!T.value)return;const $=ya(T.value.config);$.lifeMode==="curve"&&($.lifeMode="random"),$.speedMode==="curve"&&($.speedMode="random"),$.scaleMode==="curve"&&($.scaleMode="random"),$.initialRotationMode==="curve"&&($.initialRotationMode="random"),$.mode==="stream"&&!($.duration>0)&&($.duration=1),$.streamBehavior==="loop"&&($.emitterFollow||$.emitterFollowMode!=="none")&&xe($)}),Uo(()=>{for(const $ of e.systems){const S=ya($.config);if(S.emitterFollowMode!=="bone")continue;const C=e.spines.find(Pe=>Pe.id===S.emitterFollowSpineId);!!(C!=null&&C.bones.some(Pe=>Pe.name===S.emitterFollowBoneName))||(S.emitterFollowMode="none",S.emitterFollowSpineId=0,S.emitterFollowBoneName="")}}),Uo(()=>{for(const $ of e.colliders)$.followPathId==null&&($.followPathId=0),$.followDuration>0||($.followDuration=2),$.followPathRotation==null&&($.followPathRotation=!1),["跟随导出","线性","贝塞尔"].includes($.followCurveMode)||($.followCurveMode="跟随导出"),(!Array.isArray($.followCurve)||$.followCurve.length<2)&&($.followCurve=[{x:0,y:0},{x:1,y:1}])});const _e=[{x:0,y:0},{x:1,y:1}],Ae=[{x:0,y:1},{x:1,y:1}],ge=[{x:0,y:0},{x:.2,y:1},{x:.8,y:1},{x:1,y:0}],Ee=[{x:0,y:0},{x:.1,y:1},{x:.9,y:1},{x:1,y:0}],j=[{x:0,y:1},{x:1,y:1}],K=[{x:0,y:1},{x:1,y:1}],q=wo({config:!0,scene:!1,emitMode:!0,shape:!0,attr:!0,look:!0,mods:!0,export:!1});function W($){q[$]=!q[$]}function Q($){var C;const S=(C=T.value)==null?void 0:C.config;S&&(S.mode=$,$==="stream"&&!(S.duration>0)&&(S.duration=1))}function le($){var ee;const S=(ee=T.value)==null?void 0:ee.config;if(!S)return;const C=Math.min(1800,Math.max(1,Math.ceil(Number($)||1)));S.loopDurationFrames=C}function xe($){const S=wl();$.emitterFollow=!1,$.emitterFollowMode="none",$.emitterFollowPathId=S.emitterFollowPathId,$.emitterFollowSpineId=S.emitterFollowSpineId,$.emitterFollowBoneName=S.emitterFollowBoneName,$.emitterFollowBoneOffsetX=S.emitterFollowBoneOffsetX,$.emitterFollowBoneOffsetY=S.emitterFollowBoneOffsetY,$.emitterFollowBoneRotation=S.emitterFollowBoneRotation,$.emitterFollowBoneScaleX=S.emitterFollowBoneScaleX,$.emitterFollowBoneScaleY=S.emitterFollowBoneScaleY,$.emitterAngleMode=S.emitterAngleMode,$.emitterFollowCurve=S.emitterFollowCurve.map(C=>({...C})),$.emitterFollowDuration=S.emitterFollowDuration,$.emitterFollowSpace=S.emitterFollowSpace,$.emitterFollowDirection=S.emitterFollowDirection,$.emitterFollowOffset=S.emitterFollowOffset}function ae($){var Pe;const S=(Pe=T.value)==null?void 0:Pe.config;if(!S||S.streamBehavior===$)return;const C=$==="loop",ee=C?"进入循环持续模式后,粒子跟随设置会失效并恢复默认值。是否继续?":"退出循环持续模式后,粒子跟随设置会失效并恢复默认值。是否继续?";window.confirm(ee)&&(xe(S),S.streamBehavior=$,C||(S.generateLoopStartAnimation=!1,S.generateLoopEndAnimation=!1))}function we($,S){var Pe;const C=(Pe=T.value)==null?void 0:Pe.config;if(!C)return;const ee=S.target.checked;$==="start"?C.generateLoopStartAnimation=ee:C.generateLoopEndAnimation=ee}function ce($,S){var Pe;const C=(Pe=T.value)==null?void 0:Pe.config;if(!C)return;const ee=Math.min(1800,Math.max(1,Math.ceil(Number(S.target.value)||30)));$==="start"?C.loopStartDurationFrames=ee:C.loopEndDurationFrames=ee}function Ue($,S){var Pe;const C=(Pe=T.value)==null?void 0:Pe.config;if(!C)return;const ee=S.target.checked;$==="start"?C.loopStartUseCustomDuration=ee:C.loopEndUseCustomDuration=ee}function Re($,S){const C=$.target.value;if(S.emitterFollowMode=C,C!=="bone"){S.emitterFollowSpineId=0,S.emitterFollowBoneName="";return}Fe(S)}function Fe($){const S=de.value;if(!S){$.emitterFollowMode="none",$.emitterFollowSpineId=0,$.emitterFollowBoneName="";return}$.emitterFollowMode="bone",$.emitterFollowSpineId=S.spine.id,$.emitterFollowBoneName=S.boneName}const it={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 dt($){var ee;const S=(ee=T.value)==null?void 0:ee.config;if($==="export"){e.settings.exportSettings=ip();return}if(!S)return;const C=wl();for(const Pe of it[$])S[Pe]=C[Pe]}function It(){t.value.fps=Math.min(240,Math.max(1,Math.round(Number(t.value.fps)||30)))}function yt($){var S;e.selectSystem(((S=e.systems[$])==null?void 0:S.id)??0)}function Mt(){e.addSystem()}function zt(){e.addCollider()}function Oi(){e.addPath()}function Ii(){e.addSpine()}function Is(){e.duplicateSelectedObject()}function qs(){const $=G.value;if(!$)return;let S=$.tags.length+1,C=`Tag ${S}`;for(;$.tags.includes(C);)C=`Tag ${++S}`;$.tags.push(C),$.selectedTag=C}function Vt($,S,C=0,ee=0,Pe=0,wt=0){return{x:$,y:S,inX:C,inY:ee,outX:Pe,outY:wt}}function oe(){const $=H.value;if(!(!$||!$.preset))if($.preset==="circle"){const C=60.751328;$.points=[Vt(110,0,0,-C,0,C),Vt(0,110,C,0,-C,0),Vt(-110,0,0,C,0,-C),Vt(0,-110,-C,0,C,0)],$.closed=!0}else if($.preset==="square")$.points=[Vt(-100,-100),Vt(100,-100),Vt(100,100),Vt(-100,100)],$.closed=!0;else{const S=$.preset==="star"?10:6;$.points=Array.from({length:S},(C,ee)=>{const Pe=$.preset==="star"&&ee%2?50:110,wt=-Math.PI*.5+ee/S*Math.PI*2;return Vt(Math.cos(wt)*Pe,Math.sin(wt)*Pe)}),$.closed=!0}}function fe(){H.value&&(H.value.points=[])}function Et(){T.value&&(T.value.config.seed=Math.floor(Math.random()*999999)+1)}function $t($){var C;const S=(C=T.value)==null?void 0:C.config;!S||$==="direction"||(S.speedOverLifeMode=$,$==="curve"&&S.speedOverLifeMin===S.speedOverLifeMax&&(S.speedOverLifeMin=0,S.speedOverLifeMax=1))}function Gt(){var S;const $=(S=T.value)==null?void 0:S.config;!$||$.scaleOverLifeMode!=="curve"||($.scaleOverLifeMin===$.scaleOverLifeMax&&($.scaleOverLifeMin=0,$.scaleOverLifeMax=1),$.scaleYOverLifeMin===$.scaleYOverLifeMax&&($.scaleYOverLifeMin=0,$.scaleYOverLifeMax=1))}function xt($){var C;const S=(C=T.value)==null?void 0:C.config;!S||$==="direction"||(S.scaleOverLifeMode=$,Gt())}const bs={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 Rs(){var C;const $=(C=T.value)==null?void 0:C.config;if(!$)return;const S=bs[$.shape];S&&Object.assign($,S)}const Ri=lt(null),us=lt(null),ws=lt(null),ss=lt(null),Bi=lt(null);function Ea(){var C;const $=(C=T.value)==null?void 0:C.config;if(!$)return;const S=Math.max(0,...$.trailResources.map(ee=>ee.id))+1;$.trailResources.push({id:S,texture:null,textureName:"trail",previewUrl:"/images/trail.png",weight:100,locked:!1,rotation:0,colorMode:"particle",color:"#ffffff",colorGradient:[{position:0,color:"#ffffff"},{position:1,color:"#ffffff"}],blend:"normal",alphaMode:"particle",alpha:1,alphaCurve:j.map(ee=>({...ee})),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:Ae.map(ee=>({...ee})),shapeEnabled:!1,shapeCurve:K.map(ee=>({...ee}))}),Pn()}function Aa($){var S;Bi.value=$,(S=ss.value)==null||S.click()}function Ur($,S){var Pe;const C=(Pe=T.value)==null?void 0:Pe.config;if(!C)return;const ee=$==="trailGridCols"?32:16;C[$]=Math.min(ee,Math.max(2,Math.round(Number(S)||2)))}function Ks($,S){var ee;const C=(ee=T.value)==null?void 0:ee.config.trailResources.find(Pe=>Pe.id===$);C&&(C.boneCount=Math.min(16,Math.max(2,Math.round(Number(S)||2))))}function Zs($,S){var ee;const C=(ee=T.value)==null?void 0:ee.config.trailResources.find(Pe=>Pe.id===$);C&&(C.rotation=Math.max(-360,Math.min(360,Number(S)||0)))}async function Rn($){var jt,fi;const S=$.target,C=(jt=S.files)==null?void 0:jt[0],ee=(fi=T.value)==null?void 0:fi.config,Pe=ee==null?void 0:ee.trailResources.find(Rt=>Rt.id===Bi.value);if(!C||!Pe){S.value="";return}const wt=await Oe(C);Pe.texture=Er(await ht.fromURL(wt)),Pe.previewUrl=wt,Pe.textureName=C.name.replace(/\.[^.]+$/,"")||"trail",S.value="",Bi.value=null}async function Xr($){var ee;const S=(ee=T.value)==null?void 0:ee.config,C=S==null?void 0:S.trailResources.find(Pe=>Pe.id===$);C&&(C.texture=Er(await ht.fromURL("/images/trail.png")),C.previewUrl="/images/trail.png",C.textureName="trail",C.weight=100,C.locked=!1,C.rotation=0,C.boneCount=3,C.trailRatio=100,C.lengthMode="fixed",C.length=100,C.lengthMin=100,C.lengthMax=100,C.widthSizeMode="fixed",C.width=100,C.widthMin=100,C.widthMax=100,C.widthMode="particle",C.lifeLengthEnabled=!1,C.lifeLengthCurve=Ae.map(Pe=>({...Pe})),C.shapeEnabled=!1,C.shapeCurve=K.map(Pe=>({...Pe})),C.colorMode="particle",C.color="#ffffff",C.colorGradient=[{position:0,color:"#ffffff"},{position:1,color:"#ffffff"}],C.blend="normal",C.alphaMode="particle",C.alpha=1,C.alphaCurve=j.map(Pe=>({...Pe})),Pn())}function cr($){var ee;const S=(ee=T.value)==null?void 0:ee.config.trailResources;if(!S||S.length<=1)return;const C=S.findIndex(Pe=>Pe.id===$);C>=0&&S.splice(C,1),Pn()}function Pn(){var Pe;const $=(Pe=T.value)==null?void 0:Pe.config.trailResources;if(!($!=null&&$.length))return;if($.length===1){$[0].weight=100,$[0].locked=!1;return}const S=$.filter(wt=>wt.locked),C=$.filter(wt=>!wt.locked);let ee=S.reduce((wt,jt)=>wt+Math.max(0,Number(jt.weight)||0),0);ee>100&&(Se(S,100,!0),ee=100),Se(C,100-ee)}function z($,S){var fi;const C=(fi=T.value)==null?void 0:fi.config.trailResources;if(!(C!=null&&C.length))return;if(C.length===1){C[0].weight=100,C[0].locked=!1;return}const ee=C.find(Rt=>Rt.id===$);if(!ee||ee.locked)return;const Pe=C.filter(Rt=>Rt.id!==$&&Rt.locked).reduce((Rt,bi)=>Rt+Math.max(0,Number(bi.weight)||0),0),wt=Math.max(0,100-Pe),jt=C.filter(Rt=>Rt.id!==$&&!Rt.locked);ee.weight=Ne(Math.min(wt,Math.max(0,Number(S)||0))),jt.length?Se(jt,wt-ee.weight,!0):ee.weight=Ne(wt)}function V($){var ee;const S=(ee=T.value)==null?void 0:ee.config.trailResources;if(!S||S.length===1)return;const C=S.find(Pe=>Pe.id===$);C&&(C.locked=!C.locked)}function J($,S){const C=S.target;$.color=Be(C.value,$.color),C.value=$.color}function ie($,S){J($,S),S.target.blur()}function ue(){var C;const $=(C=T.value)==null?void 0:C.config;if(!$)return;const S=Math.max(0,...$.imageResources.map(ee=>ee.id))+1;$.imageResources.push({id:S,texture:$.texture,textureName:"star",textureFolder:"",previewUrl:"/images/star.png",imageMode:"fixed",sequencePlayback:"loop-forward",sequenceFps:30,sequenceFrames:[],weight:100,locked:!1,scale:1,anchorX:.5,anchorY:.5,colorMode:"fixed",colorStart:"#ffffff",colorEnd:"#ff4d4d",colorGradient:[{position:0,color:"#ffffff"},{position:1,color:"#ff4d4d"}],blend:"normal",independentAlpha:"off",alpha:1,alphaCurveMode:"跟随导出",alphaCurve:Ee.map(ee=>({...ee}))}),Ke()}function ve($){var S;ws.value=$,(S=Ri.value)==null||S.click()}function Me($){var S;ws.value=$,(S=us.value)==null||S.click()}async function Ie($){var fi,Rt;const S=$.target,C=(fi=S.files)==null?void 0:fi[0],ee=(Rt=T.value)==null?void 0:Rt.config,Pe=ee==null?void 0:ee.imageResources.find(bi=>bi.id===ws.value);if(!C||!Pe){S.value="";return}const wt=await Oe(C),jt=Er(await ht.fromURL(wt));Pe.texture=jt,Pe.previewUrl=wt,Pe.textureFolder="",Pe.textureName=C.name.replace(/\.[^.]+$/,"")||"particle",S.value="",ws.value=null}async function ye($){var wt;const S=$.target,C=Array.from(S.files||[]).sort((jt,fi)=>jt.name.localeCompare(fi.name,void 0,{numeric:!0,sensitivity:"base"})),ee=(wt=T.value)==null?void 0:wt.config,Pe=ee==null?void 0:ee.imageResources.find(jt=>jt.id===ws.value);if(!C.length||!Pe){S.value="";return}Pe.sequenceFrames=await Promise.all(C.map(async jt=>{const fi=await Oe(jt);return{name:jt.name,previewUrl:fi,texture:Er(await ht.fromURL(fi))}})),Pe.imageMode="sequence",S.value="",ws.value=null}function Oe($){return new Promise((S,C)=>{const ee=new FileReader;ee.onload=()=>S(String(ee.result||"")),ee.onerror=()=>C(ee.error),ee.readAsDataURL($)})}function pe($){var ee;const S=(ee=T.value)==null?void 0:ee.config,C=S==null?void 0:S.imageResources.find(Pe=>Pe.id===$);!S||!C||(C.texture=S.texture,C.textureName="star",C.textureFolder="",C.previewUrl="/images/star.png",C.imageMode="fixed",C.sequencePlayback="loop-forward",C.sequenceFps=30,C.sequenceFrames=[],C.scale=1,C.anchorX=.5,C.anchorY=.5,C.colorMode="fixed",C.colorStart="#ffffff",C.colorEnd="#ff4d4d",C.colorGradient=[{position:0,color:"#ffffff"},{position:1,color:"#ff4d4d"}],C.blend="normal",C.independentAlpha="off",C.alpha=1,C.alphaCurveMode="跟随导出",C.alphaCurve=Ee.map(Pe=>({...Pe})),C.locked=!1,Ke())}function Be($,S){let C=$.trim().replace(/^#/,"");return/^[0-9a-f]{3}$/i.test(C)&&(C=C.split("").map(ee=>ee+ee).join("")),/^[0-9a-f]{6}$/i.test(C)?`#${C.toLowerCase()}`:S}function ke($,S){const C=S.target;$.colorStart=Be(C.value,$.colorStart),C.value=$.colorStart}function Ge($,S){ke($,S),S.target.blur()}function Ze($){var ee;const S=(ee=T.value)==null?void 0:ee.config.imageResources;if(!S||S.length<=1)return;const C=S.findIndex(Pe=>Pe.id===$);C>=0&&S.splice(C,1),Ke()}function Ne($){return Math.round($)}function Se($,S,C=!1){if(!$.length)return;const ee=Math.max(0,Ne(S)),Pe=C?$.reduce((jt,fi)=>jt+Math.max(0,Number(fi.weight)||0),0):0;let wt=0;$.forEach((jt,fi)=>{const Rt=fi===$.length-1,bi=Ne(Rt?ee-wt:Pe>0?ee*Math.max(0,Number(jt.weight)||0)/Pe:ee/$.length);jt.weight=bi,wt+=bi})}function Ke(){var Pe;const $=(Pe=T.value)==null?void 0:Pe.config.imageResources;if(!($!=null&&$.length))return;if($.length===1){$[0].weight=100,$[0].locked=!1;return}const S=$.filter(wt=>wt.locked),C=$.filter(wt=>!wt.locked);let ee=S.reduce((wt,jt)=>wt+Math.max(0,Number(jt.weight)||0),0);ee>100&&(Se(S,100,!0),ee=100),Se(C,100-ee)}function be($,S){var fi;const C=(fi=T.value)==null?void 0:fi.config.imageResources;if(!(C!=null&&C.length))return;if(C.length===1){C[0].weight=100,C[0].locked=!1;return}const ee=C.find(Rt=>Rt.id===$);if(!ee||ee.locked)return;const Pe=C.filter(Rt=>Rt.id!==$&&Rt.locked).reduce((Rt,bi)=>Rt+Math.max(0,Number(bi.weight)||0),0),wt=Math.max(0,100-Pe),jt=C.filter(Rt=>Rt.id!==$&&!Rt.locked);if(ee.weight=Ne(Math.min(wt,Math.max(0,Number(S)||0))),!jt.length){ee.weight=Ne(wt);return}Se(jt,wt-ee.weight,!0)}function gt($){var ee;const S=(ee=T.value)==null?void 0:ee.config.imageResources;if(!S||S.length===1)return;const C=S.find(Pe=>Pe.id===$);C&&(C.locked=!C.locked)}return($,S)=>(se(),he("div",xO,[S[372]||(S[372]=A("div",{class:"panel-header"},[A("span",null,"Spine粒子编辑器-Yeomai")],-1)),A("div",bO,[A("div",wO,[A("div",{class:"group-head",onClick:S[0]||(S[0]=C=>W("config"))},[A("span",SO,We(q.config?"▸":"▾"),1),S[187]||(S[187]=A("span",null,"配置管理",-1))]),Te(A("div",_O,[A("div",TO,[A("button",{title:"保存全部编辑器配置 (Ctrl+S)",onClick:M},"保存配置"),A("button",{title:"加载本地编辑器配置",onClick:S[1]||(S[1]=C=>{var ee;return(ee=i.value)==null?void 0:ee.click()})},"加载配置"),Te(A("select",{"onUpdate:modelValue":S[2]||(S[2]=C=>s.value=C),"aria-label":"预设列表",disabled:!r.value.length||a.value,onPointerdown:I,onFocus:I,onChange:R},[A("option",EO,We(r.value.length?"选择预设":"无预设文件"),1),(se(!0),he(st,null,ui(r.value,C=>(se(),he("option",{key:C.file,value:C.file},We(C.name),9,AO))),128))],40,MO),[[qt,s.value]]),A("input",{ref_key:"configFileInput",ref:i,hidden:"",type:"file",accept:".json,application/json",onChange:_},null,544)]),o.value?(se(),he("div",{key:0,class:at(["config-message",{error:h.value}])},We(o.value),3)):je("",!0)],512),[[hr,!q.config]])]),A("div",CO,[A("div",{class:"group-head scene-head",onClick:S[3]||(S[3]=C=>W("scene"))},[A("span",IO,We(q.scene?"▸":"▾"),1),S[188]||(S[188]=A("span",null,"场景对象",-1)),A("div",RO,[A("button",{class:"scene-add",title:"添加粒子系统",onClick:Ct(Mt,["stop"])},"+粒子"),A("button",{class:"scene-add",title:"添加碰撞体",onClick:Ct(zt,["stop"])},"+碰撞"),A("button",{class:"scene-add",title:"添加路径",onClick:Ct(Oi,["stop"])},"+路径"),A("button",{class:"scene-add",title:"添加 Spine",onClick:Ct(Ii,["stop"])},"+Spine"),A("button",{class:"scene-add",disabled:!Z.value,title:"复制当前选中的场景对象",onClick:Ct(Is,["stop"])},"+Copy",8,PO)])]),Te(A("div",kO,[A("div",FO,[(se(!0),he(st,null,ui(De(e).systems,(C,ee)=>(se(),he("div",{key:`particle-${C.id}`,class:at(["tree-item scene-object-item",{on:Y.value==="particle"&&C.id===De(e).activeObjectId}]),onClick:Pe=>yt(ee)},[S[191]||(S[191]=A("span",{class:"tdot"},"●",-1)),A("span",BO,We(C.config.name||"ParticleSystem"+(ee+1)),1),A("button",{class:at(["scene-object-eye",{off:C.visible===!1}]),title:C.visible===!1?"显示粒子系统":"隐藏粒子系统","aria-label":C.visible===!1?"显示粒子系统":"隐藏粒子系统",onClick:Ct(Pe=>C.visible=C.visible===!1,["stop"])},[(se(),he("svg",DO,[S[189]||(S[189]=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[190]||(S[190]=A("circle",{cx:"12",cy:"12",r:"2.8"},null,-1)),C.visible===!1?(se(),he("path",NO)):je("",!0)]))],10,LO),S[192]||(S[192]=A("span",{class:"scene-object-kind"},"粒子",-1)),A("button",{class:"scene-object-delete",title:"删除粒子系统",onClick:Ct(Pe=>De(e).removeSystem(C.id),["stop"])},"✕",8,UO)],10,OO))),128)),(se(!0),he(st,null,ui(De(e).colliders,C=>(se(),he("div",{key:`collision-${C.id}`,class:at(["tree-item scene-object-item",{on:Y.value==="collision"&&C.id===De(e).activeObjectId}]),onClick:ee=>De(e).selectSceneObject("collision",C.id)},[S[195]||(S[195]=A("span",{class:"tdot collision-dot"},"■",-1)),A("span",YO,We(C.name),1),A("button",{class:at(["scene-object-eye",{off:C.visible===!1}]),title:C.visible===!1?"显示碰撞体":"隐藏碰撞体","aria-label":C.visible===!1?"显示碰撞体":"隐藏碰撞体",onClick:Ct(ee=>C.visible=C.visible===!1,["stop"])},[(se(),he("svg",$O,[S[193]||(S[193]=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[194]||(S[194]=A("circle",{cx:"12",cy:"12",r:"2.8"},null,-1)),C.visible===!1?(se(),he("path",GO)):je("",!0)]))],10,VO),S[196]||(S[196]=A("span",{class:"scene-object-kind"},"碰撞",-1)),A("button",{class:"scene-object-delete",title:"删除碰撞体",onClick:Ct(ee=>De(e).removeCollider(C.id),["stop"])},"✕",8,jO)],10,XO))),128)),(se(!0),he(st,null,ui(De(e).paths,C=>(se(),he("div",{key:`path-${C.id}`,class:at(["tree-item scene-object-item",{on:Y.value==="path"&&C.id===De(e).activeObjectId}]),onClick:ee=>De(e).selectSceneObject("path",C.id)},[S[199]||(S[199]=A("span",{class:"tdot path-dot"},"◇",-1)),A("span",WO,We(C.name),1),A("button",{class:at(["scene-object-eye",{off:C.visible===!1}]),title:C.visible===!1?"显示路径":"隐藏路径","aria-label":C.visible===!1?"显示路径":"隐藏路径",onClick:Ct(ee=>C.visible=C.visible===!1,["stop"])},[(se(),he("svg",qO,[S[197]||(S[197]=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[198]||(S[198]=A("circle",{cx:"12",cy:"12",r:"2.8"},null,-1)),C.visible===!1?(se(),he("path",KO)):je("",!0)]))],10,zO),S[200]||(S[200]=A("span",{class:"scene-object-kind"},"路径",-1)),A("button",{class:"scene-object-delete",title:"删除路径",onClick:Ct(ee=>De(e).removePath(C.id),["stop"])},"✕",8,ZO)],10,HO))),128)),(se(!0),he(st,null,ui(De(e).spines,C=>(se(),he("div",{key:`spine-${C.id}`,class:at(["tree-item scene-object-item",{on:Y.value==="spine"&&C.id===De(e).activeObjectId}]),onClick:ee=>De(e).selectSceneObject("spine",C.id)},[S[203]||(S[203]=A("span",{class:"tdot spine-dot"},"◆",-1)),A("span",QO,We(C.name),1),A("button",{class:at(["scene-object-eye",{off:C.visible===!1}]),title:C.visible===!1?"显示 Spine":"隐藏 Spine","aria-label":C.visible===!1?"显示 Spine":"隐藏 Spine",onClick:Ct(ee=>C.visible=C.visible===!1,["stop"])},[(se(),he("svg",tB,[S[201]||(S[201]=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[202]||(S[202]=A("circle",{cx:"12",cy:"12",r:"2.8"},null,-1)),C.visible===!1?(se(),he("path",iB)):je("",!0)]))],10,eB),S[204]||(S[204]=A("span",{class:"scene-object-kind"},"Spine",-1)),A("button",{class:"scene-object-delete",title:"删除 Spine",onClick:Ct(ee=>De(e).removeSpine(C.id),["stop"])},"✕",8,sB)],10,JO))),128)),!De(e).systems.length&&!De(e).colliders.length&&!De(e).paths.length&&!De(e).spines.length?(se(),he("div",nB,"场景中暂无对象")):je("",!0)]),Y.value==="particle"&&T.value?(se(),he(st,{key:0},[A("label",rB,[S[205]||(S[205]=A("span",null,"名称",-1)),Te(A("input",{"onUpdate:modelValue":S[4]||(S[4]=C=>T.value.config.name=C),class:"inp"},null,512),[[ot,T.value.config.name]])]),He(Je,{label:"位置X",min:-2e3,max:2e3,step:1,modelValue:T.value.config.centerX,"onUpdate:modelValue":S[5]||(S[5]=C=>T.value.config.centerX=C)},null,8,["modelValue"]),He(Je,{label:"位置Y",min:-2e3,max:2e3,step:1,modelValue:T.value.config.centerY,"onUpdate:modelValue":S[6]||(S[6]=C=>T.value.config.centerY=C)},null,8,["modelValue"]),He(Je,{label:"偏移X",min:-2e3,max:2e3,step:1,modelValue:T.value.config.offsetX,"onUpdate:modelValue":S[7]||(S[7]=C=>T.value.config.offsetX=C)},null,8,["modelValue"]),He(Je,{label:"偏移Y",min:-2e3,max:2e3,step:1,modelValue:T.value.config.offsetY,"onUpdate:modelValue":S[8]||(S[8]=C=>T.value.config.offsetY=C)},null,8,["modelValue"]),He(Je,{label:"旋转",min:-360,max:360,step:1,modelValue:T.value.config.rootRotation,"onUpdate:modelValue":S[9]||(S[9]=C=>T.value.config.rootRotation=C)},null,8,["modelValue"]),He(Je,{label:"缩放X",min:.05,max:10,step:.05,modelValue:T.value.config.rootScaleX,"onUpdate:modelValue":S[10]||(S[10]=C=>T.value.config.rootScaleX=C)},null,8,["modelValue"]),He(Je,{label:"缩放Y",min:.05,max:10,step:.05,modelValue:T.value.config.rootScaleY,"onUpdate:modelValue":S[11]||(S[11]=C=>T.value.config.rootScaleY=C)},null,8,["modelValue"]),A("div",aB,[S[206]||(S[206]=A("label",{for:"system-seed"},"随机种子",-1)),Te(A("input",{id:"system-seed",class:"seed-input",type:"number",min:"0",step:"1","onUpdate:modelValue":S[12]||(S[12]=C=>T.value.config.seed=C),title:"控制粒子系统内全部随机属性、资源选择与修改器随机采样"},null,512),[[ot,T.value.config.seed,void 0,{number:!0}]]),A("button",{class:"seed-random",title:"生成新的全局随机种子",onClick:Et},"⚄")]),S[207]||(S[207]=A("div",{class:"seed-hint"},"控制初始随机参数、资源选择和修改器随机采样;相同种子可复现相同效果",-1))],64)):G.value?(se(),he(st,{key:1},[S[234]||(S[234]=A("div",{class:"object-editor-title"},"碰撞体属性",-1)),A("label",oB,[S[208]||(S[208]=A("span",null,"碰撞体名称",-1)),Te(A("input",{"onUpdate:modelValue":S[13]||(S[13]=C=>G.value.name=C),class:"inp"},null,512),[[ot,G.value.name]])]),A("div",lB,[S[209]||(S[209]=A("span",null,"碰撞体标签",-1)),A("div",cB,[(se(!0),he(st,null,ui(G.value.tags,C=>(se(),he("button",{key:C,class:at(["object-tag",{on:G.value.selectedTag===C}]),onClick:ee=>G.value.selectedTag=C},We(C),11,hB))),128)),A("button",{class:"tag-add",title:"新增标签",onClick:qs},"+")]),S[210]||(S[210]=A("small",null,"点击标签为当前碰撞体选择标签;点击+新增标签。",-1))]),A("div",uB,[A("label",dB,[S[212]||(S[212]=A("span",null,"类型",-1)),Te(A("select",{"onUpdate:modelValue":S[14]||(S[14]=C=>G.value.shape=C),class:"inp"},[...S[211]||(S[211]=[Ua('<option value="circle" data-v-cd7486c0>圆形</option><option value="ellipse" data-v-cd7486c0>椭圆</option><option value="rect" data-v-cd7486c0>矩形</option><option value="polygon" data-v-cd7486c0>多边形</option><option value="custom" data-v-cd7486c0>自定义</option>',5)])],512),[[qt,G.value.shape]])]),A("label",fB,[S[213]||(S[213]=A("span",null,"启用",-1)),Te(A("input",{"onUpdate:modelValue":S[15]||(S[15]=C=>G.value.enabled=C),type:"checkbox"},null,512),[[ei,G.value.enabled]])])]),A("div",mB,[A("label",pB,[S[214]||(S[214]=A("span",null,"X 位置",-1)),Te(A("input",{"onUpdate:modelValue":S[16]||(S[16]=C=>G.value.x=C),type:"number",class:"inp"},null,512),[[ot,G.value.x,void 0,{number:!0}]])]),A("label",gB,[S[215]||(S[215]=A("span",null,"Y 位置",-1)),Te(A("input",{"onUpdate:modelValue":S[17]||(S[17]=C=>G.value.y=C),type:"number",class:"inp"},null,512),[[ot,G.value.y,void 0,{number:!0}]])])]),He(Je,{label:"旋转",min:-360,max:360,step:1,modelValue:G.value.rotation,"onUpdate:modelValue":S[18]||(S[18]=C=>G.value.rotation=C)},null,8,["modelValue"]),A("div",vB,[A("label",yB,[S[216]||(S[216]=A("span",null,"缩放 X",-1)),Te(A("input",{"onUpdate:modelValue":S[19]||(S[19]=C=>G.value.scaleX=C),type:"number",min:"0.05",step:"0.05",class:"inp"},null,512),[[ot,G.value.scaleX,void 0,{number:!0}]])]),A("label",xB,[S[217]||(S[217]=A("span",null,"缩放 Y",-1)),Te(A("input",{"onUpdate:modelValue":S[20]||(S[20]=C=>G.value.scaleY=C),type:"number",min:"0.05",step:"0.05",class:"inp"},null,512),[[ot,G.value.scaleY,void 0,{number:!0}]])])]),G.value.shape==="circle"?(se(),Ht(Je,{key:0,label:"半径",min:1,max:1e3,step:1,modelValue:G.value.radius,"onUpdate:modelValue":S[21]||(S[21]=C=>G.value.radius=C)},null,8,["modelValue"])):G.value.shape==="ellipse"?(se(),he("div",bB,[A("label",wB,[S[218]||(S[218]=A("span",null,"X 半径",-1)),Te(A("input",{"onUpdate:modelValue":S[22]||(S[22]=C=>G.value.radiusX=C),type:"number",min:"1",class:"inp"},null,512),[[ot,G.value.radiusX,void 0,{number:!0}]])]),A("label",SB,[S[219]||(S[219]=A("span",null,"Y 半径",-1)),Te(A("input",{"onUpdate:modelValue":S[23]||(S[23]=C=>G.value.radiusY=C),type:"number",min:"1",class:"inp"},null,512),[[ot,G.value.radiusY,void 0,{number:!0}]])])])):(se(),he("div",_B,[A("label",TB,[S[220]||(S[220]=A("span",null,"宽度",-1)),Te(A("input",{"onUpdate:modelValue":S[24]||(S[24]=C=>G.value.width=C),type:"number",min:"1",class:"inp"},null,512),[[ot,G.value.width,void 0,{number:!0}]])]),A("label",MB,[S[221]||(S[221]=A("span",null,"高度",-1)),Te(A("input",{"onUpdate:modelValue":S[25]||(S[25]=C=>G.value.height=C),type:"number",min:"1",class:"inp"},null,512),[[ot,G.value.height,void 0,{number:!0}]])])])),G.value.shape==="polygon"||G.value.shape==="custom"?(se(),Ht(Je,{key:3,label:"边数",min:3,max:16,step:1,modelValue:G.value.sides,"onUpdate:modelValue":S[26]||(S[26]=C=>G.value.sides=C)},null,8,["modelValue"])):je("",!0),A("label",EB,[S[223]||(S[223]=A("span",null,"碰撞响应",-1)),Te(A("select",{"onUpdate:modelValue":S[27]||(S[27]=C=>G.value.response=C),class:"inp"},[...S[222]||(S[222]=[A("option",{value:"physics"},"物理(弹跳/摩擦)",-1),A("option",{value:"pause"},"暂停(停止不动)",-1),A("option",{value:"destroy"},"消失(立即销毁)",-1)])],512),[[qt,G.value.response]])]),G.value.response==="physics"?(se(),he("div",AB,[A("label",CB,[S[224]||(S[224]=A("span",null,"弹性 (0-1)",-1)),Te(A("input",{"onUpdate:modelValue":S[28]||(S[28]=C=>G.value.elasticity=C),type:"number",min:"0",max:"1",step:"0.01",class:"inp"},null,512),[[ot,G.value.elasticity,void 0,{number:!0}]])]),A("label",IB,[S[225]||(S[225]=A("span",null,"摩擦 (0-1)",-1)),Te(A("input",{"onUpdate:modelValue":S[29]||(S[29]=C=>G.value.friction=C),type:"number",min:"0",max:"1",step:"0.01",class:"inp"},null,512),[[ot,G.value.friction,void 0,{number:!0}]])])])):je("",!0),A("div",RB,[A("label",PB,[Te(A("input",{"onUpdate:modelValue":S[30]||(S[30]=C=>G.value.followPath=C),type:"checkbox"},null,512),[[ei,G.value.followPath]]),S[226]||(S[226]=ii("跟随路径移动",-1))]),G.value.followPath?(se(),he(st,{key:0},[A("label",kB,[S[228]||(S[228]=A("span",null,"目标路径",-1)),Te(A("select",{"onUpdate:modelValue":S[31]||(S[31]=C=>G.value.followPathId=C),class:"inp"},[S[227]||(S[227]=A("option",{value:0},"(未选择)",-1)),(se(!0),he(st,null,ui(De(e).paths,C=>(se(),he("option",{key:C.id,value:C.id},We(C.name),9,FB))),128))],512),[[qt,G.value.followPathId,void 0,{number:!0}]])]),A("div",OB,[A("label",BB,[S[229]||(S[229]=A("span",null,"移动时长(秒)",-1)),Te(A("input",{"onUpdate:modelValue":S[32]||(S[32]=C=>G.value.followDuration=C),type:"number",min:"0.05",step:"0.05",class:"inp"},null,512),[[ot,G.value.followDuration,void 0,{number:!0}]])]),A("label",LB,[S[231]||(S[231]=A("span",null,"曲线模式",-1)),Te(A("select",{"onUpdate:modelValue":S[33]||(S[33]=C=>G.value.followCurveMode=C),class:"inp"},[...S[230]||(S[230]=[A("option",null,"跟随导出",-1),A("option",null,"线性",-1),A("option",null,"贝塞尔",-1)])],512),[[qt,G.value.followCurveMode]])])]),A("label",DB,[Te(A("input",{"onUpdate:modelValue":S[34]||(S[34]=C=>G.value.followPathRotation=C),type:"checkbox"},null,512),[[ei,G.value.followPathRotation]]),S[232]||(S[232]=ii("方向沿路径",-1))]),S[233]||(S[233]=A("div",{class:"collider-curve-title"},[ii("移动进度曲线 "),A("small",null,"横轴:实时/移动时长 纵轴:路径进度(0=起点 → 1=终点)")],-1)),He(rn,{"model-value":G.value.followCurve||_e,"default-value":_e,mode:E(G.value.followCurveMode),"onUpdate:modelValue":S[35]||(S[35]=C=>G.value.followCurve=C)},null,8,["model-value","mode"])],64)):je("",!0)])],64)):H.value?(se(),he(st,{key:2},[S[244]||(S[244]=A("div",{class:"object-editor-title"},"路径属性",-1)),A("label",NB,[S[235]||(S[235]=A("span",null,"路径名称",-1)),Te(A("input",{"onUpdate:modelValue":S[36]||(S[36]=C=>H.value.name=C),class:"inp"},null,512),[[ot,H.value.name]])]),A("div",UB,[A("label",XB,[S[236]||(S[236]=A("span",null,"X 位置",-1)),Te(A("input",{"onUpdate:modelValue":S[37]||(S[37]=C=>H.value.x=C),type:"number",class:"inp"},null,512),[[ot,H.value.x,void 0,{number:!0}]])]),A("label",YB,[S[237]||(S[237]=A("span",null,"Y 位置",-1)),Te(A("input",{"onUpdate:modelValue":S[38]||(S[38]=C=>H.value.y=C),type:"number",class:"inp"},null,512),[[ot,H.value.y,void 0,{number:!0}]])])]),He(Je,{label:"旋转",min:-360,max:360,step:1,modelValue:H.value.rotation,"onUpdate:modelValue":S[39]||(S[39]=C=>H.value.rotation=C)},null,8,["modelValue"]),A("div",VB,[A("label",$B,[S[238]||(S[238]=A("span",null,"缩放 X",-1)),Te(A("input",{"onUpdate:modelValue":S[40]||(S[40]=C=>H.value.scaleX=C),type:"number",min:"0.05",step:"0.05",class:"inp"},null,512),[[ot,H.value.scaleX,void 0,{number:!0}]])]),A("label",GB,[S[239]||(S[239]=A("span",null,"缩放 Y",-1)),Te(A("input",{"onUpdate:modelValue":S[41]||(S[41]=C=>H.value.scaleY=C),type:"number",min:"0.05",step:"0.05",class:"inp"},null,512),[[ot,H.value.scaleY,void 0,{number:!0}]])])]),A("label",jB,[S[240]||(S[240]=A("span",null,"闭合路径",-1)),Te(A("input",{"onUpdate:modelValue":S[42]||(S[42]=C=>H.value.closed=C),type:"checkbox"},null,512),[[ei,H.value.closed]])]),A("label",HB,[S[241]||(S[241]=A("span",null,"路径颜色",-1)),Te(A("input",{"onUpdate:modelValue":S[43]||(S[43]=C=>H.value.color=C),type:"color",class:"path-color"},null,512),[[ot,H.value.color]])]),S[245]||(S[245]=Ua('<div class="path-help" data-v-cd7486c0><span data-v-cd7486c0>操作说明:</span><ul data-v-cd7486c0><li data-v-cd7486c0>双击空白处/曲线:新建锚点</li><li data-v-cd7486c0>双击锚点:删除节点</li><li data-v-cd7486c0>双击第二下按住拖动:新建并拉出手柄</li><li data-v-cd7486c0>拖动锚点移动位置,拖动手柄调整曲线</li><li data-v-cd7486c0>Shift+拖动手柄:两侧完全对称</li><li data-v-cd7486c0>Alt+拖动手柄:独立控制单侧</li><li data-v-cd7486c0>Ctrl+点击/框选:加选节点</li><li data-v-cd7486c0>Alt+点击/框选:减选节点</li><li data-v-cd7486c0>Alt+单击空白处:清除全部选中</li><li data-v-cd7486c0>选中多个节点后可整体拖动</li></ul></div>',1)),A("label",WB,[S[243]||(S[243]=A("span",null,"应用预设形状",-1)),Te(A("select",{"onUpdate:modelValue":S[44]||(S[44]=C=>H.value.preset=C),class:"inp"},[...S[242]||(S[242]=[Ua('<option value="" data-v-cd7486c0>选择预设...</option><option value="circle" data-v-cd7486c0>圆形</option><option value="square" data-v-cd7486c0>方形</option><option value="polygon" data-v-cd7486c0>多边形</option><option value="star" data-v-cd7486c0>星形</option>',5)])],512),[[qt,H.value.preset]])]),A("button",{class:"path-action primary",onClick:oe},"应用预设"),A("button",{class:"path-action",onClick:fe},"清空锚点")],64)):ne.value?(se(),Ht(_F,{key:3,"spine-object":ne.value},null,8,["spine-object"])):(se(),he("div",zB,"使用右上角按钮创建场景对象"))],512),[[hr,!q.scene]])]),Y.value==="particle"&&T.value?(se(),he(st,{key:0},[A("div",qB,[A("div",{class:"group-head",onClick:S[46]||(S[46]=C=>W("emitMode"))},[A("span",KB,We(q.emitMode?"▸":"▾"),1),S[246]||(S[246]=A("span",null,"发射模式",-1)),A("button",{class:"group-reset",title:"重置发射模式参数",onClick:S[45]||(S[45]=Ct(C=>dt("emitMode"),["stop"]))},"重置")]),Te(A("div",ZB,[A("div",JB,[A("button",{class:at(["seg",{on:T.value.config.mode==="stream"}]),onClick:S[47]||(S[47]=C=>Q("stream"))},"持续",2),A("button",{class:at(["seg",{on:T.value.config.mode==="burst"}]),onClick:S[48]||(S[48]=C=>Q("burst"))},"爆发",2)]),T.value.config.mode==="stream"?(se(),he(st,{key:0},[A("div",QB,[A("button",{class:at(["seg",{on:T.value.config.streamBehavior==="normal"}]),onClick:S[49]||(S[49]=C=>ae("normal"))},"常规持续",2),A("button",{class:at(["seg",{on:T.value.config.streamBehavior==="loop"}]),onClick:S[50]||(S[50]=C=>ae("loop"))},"循环持续",2)]),He(Je,{label:"发射速率",min:1,max:300,step:1,modelValue:T.value.config.rate,"onUpdate:modelValue":S[51]||(S[51]=C=>T.value.config.rate=C)},null,8,["modelValue"]),T.value.config.streamBehavior==="normal"?(se(),Ht(Je,{key:0,label:"发射时长",min:1/30,max:60,step:1/30,modelValue:T.value.config.duration,"onUpdate:modelValue":S[52]||(S[52]=C=>T.value.config.duration=C)},null,8,["modelValue"])):(se(),Ht(Je,{key:1,label:"发射时长 (f)",min:1,max:1800,step:1,"model-value":N.value,"onUpdate:modelValue":le},null,8,["model-value"])),T.value.config.streamBehavior==="loop"?(se(),he("div",eL,[A("div",tL,[A("label",iL,[A("input",{type:"checkbox",checked:T.value.config.generateLoopStartAnimation,onChange:S[53]||(S[53]=C=>we("start",C))},null,40,sL),S[247]||(S[247]=A("span",{class:"switch-ui"},null,-1)),S[248]||(S[248]=A("span",null,"生成开始循环动画",-1))]),T.value.config.generateLoopStartAnimation?(se(),he("div",nL,[A("label",rL,[A("input",{type:"checkbox",checked:T.value.config.loopStartUseCustomDuration,onChange:S[54]||(S[54]=C=>Ue("start",C))},null,40,aL),S[249]||(S[249]=A("span",{class:"switch-ui"},null,-1)),S[250]||(S[250]=A("span",null,"指定时长",-1))]),A("label",oL,[T.value.config.loopStartUseCustomDuration?(se(),he("input",{key:0,value:T.value.config.loopStartDurationFrames,type:"number",min:"1",max:"1800",step:"1","aria-label":"开始循环段时长",onChange:S[55]||(S[55]=C=>ce("start",C))},null,40,lL)):je("",!0),T.value.config.loopStartUseCustomDuration?(se(),he("span",cL,"f")):(se(),he("span",hL,"自动 "+We(U.value)+"f",1))])])):je("",!0)]),A("div",uL,[A("label",dL,[A("input",{type:"checkbox",checked:T.value.config.generateLoopEndAnimation,onChange:S[56]||(S[56]=C=>we("end",C))},null,40,fL),S[251]||(S[251]=A("span",{class:"switch-ui"},null,-1)),S[252]||(S[252]=A("span",null,"生成结束循环动画",-1))]),T.value.config.generateLoopEndAnimation?(se(),he("div",mL,[A("label",pL,[A("input",{type:"checkbox",checked:T.value.config.loopEndUseCustomDuration,onChange:S[57]||(S[57]=C=>Ue("end",C))},null,40,gL),S[253]||(S[253]=A("span",{class:"switch-ui"},null,-1)),S[254]||(S[254]=A("span",null,"指定时长",-1))]),A("label",vL,[T.value.config.loopEndUseCustomDuration?(se(),he("input",{key:0,value:T.value.config.loopEndDurationFrames,type:"number",min:"1",max:"1800",step:"1","aria-label":"结束循环段时长",onChange:S[58]||(S[58]=C=>ce("end",C))},null,40,yL)):je("",!0),T.value.config.loopEndUseCustomDuration?(se(),he("span",xL,"f")):(se(),he("span",bL,"自动 "+We(U.value)+"f",1))])])):je("",!0)])])):je("",!0),T.value.config.streamBehavior==="loop"?(se(),he("div",wL,"循环持续模式不支持骨骼跟随和路径跟随;进入或退出时会将粒子跟随设置恢复默认值。")):je("",!0)],64)):(se(),Ht(Je,{key:1,label:"单次数量",min:1,max:1e3,step:1,modelValue:T.value.config.burstCount,"onUpdate:modelValue":S[59]||(S[59]=C=>T.value.config.burstCount=C)},null,8,["modelValue"])),He(Je,{label:"延迟时间",min:0,max:5,step:.1,modelValue:T.value.config.delay,"onUpdate:modelValue":S[60]||(S[60]=C=>T.value.config.delay=C)},null,8,["modelValue"])],512),[[hr,!q.emitMode]])]),A("div",SL,[A("div",{class:"group-head",onClick:S[62]||(S[62]=C=>W("shape"))},[A("span",_L,We(q.shape?"▸":"▾"),1),S[255]||(S[255]=A("span",null,"发射器形状",-1)),A("button",{class:"group-reset",title:"重置发射器形状参数",onClick:S[61]||(S[61]=Ct(C=>dt("shape"),["stop"]))},"重置")]),Te(A("div",TL,[A("label",ML,[S[257]||(S[257]=A("span",null,"形状",-1)),Te(A("select",{"onUpdate:modelValue":S[63]||(S[63]=C=>T.value.config.shape=C),class:"inp",onChange:Rs},[...S[256]||(S[256]=[Ua('<option value="point" data-v-cd7486c0>点</option><option value="circle" data-v-cd7486c0>圆形</option><option value="rect" data-v-cd7486c0>矩形</option><option value="cone" data-v-cd7486c0>锥体</option><option value="orbit" data-v-cd7486c0>轨道</option>',5)])],544),[[qt,T.value.config.shape]])]),T.value.config.shape==="circle"||T.value.config.shape==="cone"?(se(),Ht(Je,{key:0,label:"半径",min:0,max:300,step:1,modelValue:T.value.config.radius,"onUpdate:modelValue":S[64]||(S[64]=C=>T.value.config.radius=C)},null,8,["modelValue"])):je("",!0),T.value.config.shape==="cone"?(se(),Ht(Je,{key:1,label:"锥形开口角度",min:1,max:360,step:1,modelValue:T.value.config.coneAngle,"onUpdate:modelValue":S[65]||(S[65]=C=>T.value.config.coneAngle=C)},null,8,["modelValue"])):T.value.config.shape==="rect"?(se(),he(st,{key:2},[He(Je,{label:"宽",min:1,max:400,step:1,modelValue:T.value.config.rectW,"onUpdate:modelValue":S[66]||(S[66]=C=>T.value.config.rectW=C)},null,8,["modelValue"]),He(Je,{label:"高",min:1,max:400,step:1,modelValue:T.value.config.rectH,"onUpdate:modelValue":S[67]||(S[67]=C=>T.value.config.rectH=C)},null,8,["modelValue"])],64)):je("",!0),S[258]||(S[258]=A("div",{class:"divider"},null,-1)),He(Je,{label:T.value.config.shape==="cone"?"锥形朝向":"发射角度",min:-360,max:360,step:1,modelValue:T.value.config.direction,"onUpdate:modelValue":S[68]||(S[68]=C=>T.value.config.direction=C)},null,8,["label","modelValue"]),T.value.config.shape!=="cone"?(se(),Ht(Je,{key:3,label:"扩散角度",min:0,max:360,step:1,modelValue:T.value.config.spread,"onUpdate:modelValue":S[69]||(S[69]=C=>T.value.config.spread=C)},null,8,["modelValue"])):je("",!0)],512),[[hr,!q.shape]])]),A("div",EL,[A("div",{class:"group-head",onClick:S[71]||(S[71]=C=>W("attr"))},[A("span",AL,We(q.attr?"▸":"▾"),1),S[259]||(S[259]=A("span",null,"粒子属性",-1)),A("button",{class:"group-reset",title:"重置粒子属性参数",onClick:S[70]||(S[70]=Ct(C=>dt("attr"),["stop"]))},"重置")]),Te(A("div",CL,[S[267]||(S[267]=A("div",{class:"attr-section-title"},"粒子初始参数",-1)),He(Bn,{label:"初始生命周期","allow-curve":!1,mode:T.value.config.lifeMode,"onUpdate:mode":S[72]||(S[72]=C=>T.value.config.lifeMode=C),"value-min":T.value.config.lifeMin,"onUpdate:valueMin":S[73]||(S[73]=C=>T.value.config.lifeMin=C),"value-max":T.value.config.lifeMax,"onUpdate:valueMax":S[74]||(S[74]=C=>T.value.config.lifeMax=C),curve:T.value.config.lifeCurve,"onUpdate:curve":S[75]||(S[75]=C=>T.value.config.lifeCurve=C),min:.1,max:10,step:.1,"curve-label":"随机采样 →"},null,8,["mode","value-min","value-max","curve"]),He(Bn,{label:"初始速度","allow-curve":!1,mode:T.value.config.speedMode,"onUpdate:mode":S[76]||(S[76]=C=>T.value.config.speedMode=C),"value-min":T.value.config.speedMin,"onUpdate:valueMin":S[77]||(S[77]=C=>T.value.config.speedMin=C),"value-max":T.value.config.speedMax,"onUpdate:valueMax":S[78]||(S[78]=C=>T.value.config.speedMax=C),curve:T.value.config.speedCurve,"onUpdate:curve":S[79]||(S[79]=C=>T.value.config.speedCurve=C),min:0,max:1e3,step:1,"curve-label":"随机采样 →"},null,8,["mode","value-min","value-max","curve"]),A("div",IL,[S[260]||(S[260]=A("span",null,"初始缩放",-1)),A("div",RL,[A("button",{class:at(["axis-mode",{on:T.value.config.scaleAxisMode==="uniform"}]),onClick:S[80]||(S[80]=C=>T.value.config.scaleAxisMode="uniform")},"统一",2),A("button",{class:at(["axis-mode",{on:T.value.config.scaleAxisMode==="separate"}]),onClick:S[81]||(S[81]=C=>T.value.config.scaleAxisMode="separate")},"XY分离",2)])]),He(Bn,{label:T.value.config.scaleAxisMode==="uniform"?"初始缩放":"缩放 X","allow-curve":!1,mode:T.value.config.scaleMode,"onUpdate:mode":S[82]||(S[82]=C=>T.value.config.scaleMode=C),"value-min":T.value.config.scaleMin,"onUpdate:valueMin":S[83]||(S[83]=C=>T.value.config.scaleMin=C),"value-max":T.value.config.scaleMax,"onUpdate:valueMax":S[84]||(S[84]=C=>T.value.config.scaleMax=C),curve:T.value.config.scaleCurve,"onUpdate:curve":S[85]||(S[85]=C=>T.value.config.scaleCurve=C),min:0,max:5,step:.05,"curve-label":"随机采样 →"},null,8,["label","mode","value-min","value-max","curve"]),T.value.config.scaleAxisMode==="separate"?(se(),Ht(Bn,{key:0,label:"缩放 Y","show-modes":!1,"allow-curve":!1,mode:T.value.config.scaleMode,"onUpdate:mode":S[86]||(S[86]=C=>T.value.config.scaleMode=C),"value-min":T.value.config.scaleYMin,"onUpdate:valueMin":S[87]||(S[87]=C=>T.value.config.scaleYMin=C),"value-max":T.value.config.scaleYMax,"onUpdate:valueMax":S[88]||(S[88]=C=>T.value.config.scaleYMax=C),curve:T.value.config.scaleYCurve,"onUpdate:curve":S[89]||(S[89]=C=>T.value.config.scaleYCurve=C),min:0,max:5,step:.05,"curve-label":"随机采样 →"},null,8,["mode","value-min","value-max","curve"])):je("",!0),He(Bn,{label:"初始旋转","allow-direction":"","allow-curve":!1,mode:T.value.config.initialRotationMode,"onUpdate:mode":S[90]||(S[90]=C=>T.value.config.initialRotationMode=C),"value-min":T.value.config.initialRotationMin,"onUpdate:valueMin":S[91]||(S[91]=C=>T.value.config.initialRotationMin=C),"value-max":T.value.config.initialRotationMax,"onUpdate:valueMax":S[92]||(S[92]=C=>T.value.config.initialRotationMax=C),curve:T.value.config.initialRotationCurve,"onUpdate:curve":S[93]||(S[93]=C=>T.value.config.initialRotationCurve=C),min:-360,max:360,step:1,"curve-label":"随机采样 →"},null,8,["mode","value-min","value-max","curve"]),S[268]||(S[268]=A("div",{class:"attr-section-title life-title"},"粒子生命周期变化参数",-1)),A("div",PL,[A("label",kL,[Te(A("input",{type:"checkbox","onUpdate:modelValue":S[94]||(S[94]=C=>T.value.config.speedOverLifeEnabled=C)},null,512),[[ei,T.value.config.speedOverLifeEnabled]]),S[261]||(S[261]=A("span",{class:"switch-ui"},null,-1)),S[262]||(S[262]=A("span",null,"生命周期内速度",-1))]),T.value.config.speedOverLifeEnabled?(se(),Ht(Bn,{key:0,label:"速度倍率",mode:T.value.config.speedOverLifeMode,"onUpdate:mode":$t,"value-min":T.value.config.speedOverLifeMin,"onUpdate:valueMin":S[95]||(S[95]=C=>T.value.config.speedOverLifeMin=C),"value-max":T.value.config.speedOverLifeMax,"onUpdate:valueMax":S[96]||(S[96]=C=>T.value.config.speedOverLifeMax=C),curve:T.value.config.speedOverLifeCurve,"onUpdate:curve":S[97]||(S[97]=C=>T.value.config.speedOverLifeCurve=C),"default-curve":Ae,min:0,max:3,step:.05,"curve-label":"生命周期 →"},null,8,["mode","value-min","value-max","curve"])):je("",!0)]),A("div",FL,[A("label",OL,[Te(A("input",{type:"checkbox","onUpdate:modelValue":S[98]||(S[98]=C=>T.value.config.scaleOverLifeEnabled=C),onChange:Gt},null,544),[[ei,T.value.config.scaleOverLifeEnabled]]),S[263]||(S[263]=A("span",{class:"switch-ui"},null,-1)),S[264]||(S[264]=A("span",null,"生命周期内缩放",-1))]),T.value.config.scaleOverLifeEnabled?(se(),he(st,{key:0},[A("div",BL,[A("button",{class:at(["axis-mode",{on:T.value.config.scaleOverLifeAxisMode==="uniform"}]),onClick:S[99]||(S[99]=C=>T.value.config.scaleOverLifeAxisMode="uniform")},"统一",2),A("button",{class:at(["axis-mode",{on:T.value.config.scaleOverLifeAxisMode==="separate"}]),onClick:S[100]||(S[100]=C=>T.value.config.scaleOverLifeAxisMode="separate")},"XY分离",2)]),He(Bn,{label:T.value.config.scaleOverLifeAxisMode==="uniform"?"缩放倍率":"倍率 X",mode:T.value.config.scaleOverLifeMode,"onUpdate:mode":xt,"value-min":T.value.config.scaleOverLifeMin,"onUpdate:valueMin":S[101]||(S[101]=C=>T.value.config.scaleOverLifeMin=C),"value-max":T.value.config.scaleOverLifeMax,"onUpdate:valueMax":S[102]||(S[102]=C=>T.value.config.scaleOverLifeMax=C),curve:T.value.config.scaleOverLifeCurve,"onUpdate:curve":S[103]||(S[103]=C=>T.value.config.scaleOverLifeCurve=C),"default-curve":Ae,min:0,max:3,step:.05,"curve-label":"生命周期 →"},null,8,["label","mode","value-min","value-max","curve"]),T.value.config.scaleOverLifeAxisMode==="separate"?(se(),Ht(Bn,{key:0,label:"倍率 Y","show-modes":!1,mode:T.value.config.scaleOverLifeMode,"onUpdate:mode":S[104]||(S[104]=C=>T.value.config.scaleOverLifeMode=C),"value-min":T.value.config.scaleYOverLifeMin,"onUpdate:valueMin":S[105]||(S[105]=C=>T.value.config.scaleYOverLifeMin=C),"value-max":T.value.config.scaleYOverLifeMax,"onUpdate:valueMax":S[106]||(S[106]=C=>T.value.config.scaleYOverLifeMax=C),curve:T.value.config.scaleYOverLifeCurve,"onUpdate:curve":S[107]||(S[107]=C=>T.value.config.scaleYOverLifeCurve=C),"default-curve":Ae,min:0,max:3,step:.05,"curve-label":"生命周期 →"},null,8,["mode","value-min","value-max","curve"])):je("",!0)],64)):je("",!0)]),A("div",LL,[A("label",DL,[Te(A("input",{type:"checkbox","onUpdate:modelValue":S[108]||(S[108]=C=>T.value.config.rotationOverLifeEnabled=C)},null,512),[[ei,T.value.config.rotationOverLifeEnabled]]),S[265]||(S[265]=A("span",{class:"switch-ui"},null,-1)),S[266]||(S[266]=A("span",null,"生命周期内旋转",-1))]),T.value.config.rotationOverLifeEnabled?(se(),Ht(Bn,{key:0,label:"旋转速度",mode:T.value.config.rotationOverLifeMode,"onUpdate:mode":S[109]||(S[109]=C=>T.value.config.rotationOverLifeMode=C),"value-min":T.value.config.rotationSpeedMin,"onUpdate:valueMin":S[110]||(S[110]=C=>T.value.config.rotationSpeedMin=C),"value-max":T.value.config.rotationSpeedMax,"onUpdate:valueMax":S[111]||(S[111]=C=>T.value.config.rotationSpeedMax=C),curve:T.value.config.rotationOverLifeCurve,"onUpdate:curve":S[112]||(S[112]=C=>T.value.config.rotationOverLifeCurve=C),"default-curve":_e,min:-720,max:720,step:10,"curve-label":"生命周期 →"},null,8,["mode","value-min","value-max","curve"])):je("",!0)])],512),[[hr,!q.attr]])]),A("div",NL,[A("div",{class:"group-head",onClick:S[114]||(S[114]=C=>W("look"))},[A("span",UL,We(q.look?"▸":"▾"),1),S[269]||(S[269]=A("span",null,"外观与资源",-1)),A("button",{class:"group-reset",title:"重置外观与资源参数",onClick:S[113]||(S[113]=Ct(C=>dt("look"),["stop"]))},"重置")]),Te(A("div",XL,[S[283]||(S[283]=A("div",{class:"look-title"},"透明度",-1)),A("div",YL,[A("button",{class:at(["seg-btn",{active:T.value.config.alphaMode==="curve"}]),onClick:S[115]||(S[115]=C=>T.value.config.alphaMode="curve")},"曲线",2),A("button",{class:at(["seg-btn",{active:T.value.config.alphaMode==="fixed"}]),onClick:S[116]||(S[116]=C=>T.value.config.alphaMode="fixed")},"固定",2)]),T.value.config.alphaMode==="fixed"?(se(),Ht(Je,{key:0,label:"透明度",min:0,max:1,step:.01,modelValue:T.value.config.alpha,"onUpdate:modelValue":S[117]||(S[117]=C=>T.value.config.alpha=C)},null,8,["modelValue"])):(se(),he(st,{key:1},[A("label",VL,[S[271]||(S[271]=A("span",null,"曲线模式",-1)),Te(A("select",{"onUpdate:modelValue":S[118]||(S[118]=C=>T.value.config.curveMode=C),class:"inp"},[...S[270]||(S[270]=[A("option",null,"跟随导出",-1),A("option",null,"线性",-1),A("option",null,"贝塞尔",-1)])],512),[[qt,T.value.config.curveMode]])]),A("div",$L,[He(rn,{modelValue:T.value.config.alphaCurve,"onUpdate:modelValue":S[119]||(S[119]=C=>T.value.config.alphaCurve=C),"default-value":ge,mode:E(T.value.config.curveMode)},null,8,["modelValue","mode"]),S[272]||(S[272]=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[273]||(S[273]=A("span",null,"图片资源",-1)),A("button",{class:"image-add",title:"新增图片资源",onClick:ue},"+")]),(se(!0),he(st,null,ui(T.value.config.imageResources,C=>(se(),Ht(yv,{key:C.id,resource:C,"resource-count":T.value.config.imageResources.length,"supports-sequence":"","default-file":"star.png",onPick:ve,onPickSequence:Me,onReset:pe,onRemove:Ze,onUpdateWeight:be,onToggleLock:gt},{default:af(()=>[He(Je,{label:"缩放",min:.1,max:3,step:.05,modelValue:C.scale,"onUpdate:modelValue":ee=>C.scale=ee},null,8,["modelValue","onUpdate:modelValue"]),A("label",GL,[S[274]||(S[274]=A("span",null,"轴心 x,y",-1)),Te(A("input",{type:"number",step:"0.05",class:"inp tiny","onUpdate:modelValue":ee=>C.anchorX=ee},null,8,jL),[[ot,C.anchorX,void 0,{number:!0}]]),Te(A("input",{type:"number",step:"0.05",class:"inp tiny","onUpdate:modelValue":ee=>C.anchorY=ee},null,8,HL),[[ot,C.anchorY,void 0,{number:!0}]])]),S[282]||(S[282]=A("div",{class:"resource-divider"},null,-1)),A("label",WL,[S[277]||(S[277]=A("span",null,"颜色",-1)),Te(A("select",{"onUpdate:modelValue":ee=>C.colorMode=ee,class:"inp"},[...S[275]||(S[275]=[A("option",{value:"fixed"},"固定色",-1),A("option",{value:"random"},"随机颜色",-1),A("option",{value:"lifetime"},"生命周期",-1)])],8,zL),[[qt,C.colorMode]]),Te(A("select",{"onUpdate:modelValue":ee=>C.blend=ee,class:"inp blend-select"},[...S[276]||(S[276]=[A("option",{value:"normal"},"正常",-1),A("option",{value:"add"},"相加",-1),A("option",{value:"multiply"},"相乘",-1),A("option",{value:"screen"},"滤色",-1)])],8,qL),[[qt,C.blend]])]),C.colorMode==="fixed"?(se(),he("label",KL,[S[278]||(S[278]=A("span",null,"固定色",-1)),Te(A("input",{type:"color","onUpdate:modelValue":ee=>C.colorStart=ee,class:"colr"},null,8,ZL),[[ot,C.colorStart]]),A("input",{type:"text",class:"hex-input",value:C.colorStart,spellcheck:"false","aria-label":"固定颜色值",onChange:ee=>ke(C,ee),onKeydown:ha(ee=>Ge(C,ee),["enter"])},null,40,JL)])):(se(),he(st,{key:1},[He(vv,{modelValue:C.colorGradient,"onUpdate:modelValue":ee=>C.colorGradient=ee},null,8,["modelValue","onUpdate:modelValue"]),C.colorMode==="random"?(se(),he("div",QL,"每个粒子出生时从色带随机取色,生命周期内保持不变")):je("",!0)],64)),A("div",eD,[S[279]||(S[279]=A("span",null,"独立透明度",-1)),A("div",tD,[A("button",{class:at({on:C.independentAlpha==="off"}),onClick:ee=>C.independentAlpha="off"},"关闭",10,iD),A("button",{class:at({on:C.independentAlpha==="fixed"}),onClick:ee=>C.independentAlpha="fixed"},"固定",10,sD),A("button",{class:at({on:C.independentAlpha==="curve"}),onClick:ee=>C.independentAlpha="curve"},"曲线",10,nD)])]),C.independentAlpha==="fixed"?(se(),Ht(Je,{key:2,label:"透明度",min:0,max:1,step:.01,modelValue:C.alpha,"onUpdate:modelValue":ee=>C.alpha=ee},null,8,["modelValue","onUpdate:modelValue"])):C.independentAlpha==="curve"?(se(),he(st,{key:3},[A("label",rD,[S[281]||(S[281]=A("span",null,"曲线模式",-1)),Te(A("select",{"onUpdate:modelValue":ee=>C.alphaCurveMode=ee,class:"inp"},[...S[280]||(S[280]=[A("option",null,"跟随导出",-1),A("option",null,"线性",-1),A("option",null,"贝塞尔",-1)])],8,aD),[[qt,C.alphaCurveMode]])]),A("div",oD,[He(rn,{modelValue:C.alphaCurve,"onUpdate:modelValue":ee=>C.alphaCurve=ee,"default-value":Ee,mode:E(C.alphaCurveMode)},null,8,["modelValue","onUpdate:modelValue","mode"])])],64)):je("",!0)]),_:2},1032,["resource","resource-count"]))),128)),A("input",{ref_key:"textureFileInput",ref:Ri,class:"file-input",type:"file",accept:"image/png,image/jpeg,image/webp,image/gif",onChange:Ie},null,544),A("input",{ref_key:"sequenceFileInput",ref:us,class:"file-input",type:"file",multiple:"",accept:"image/png,image/jpeg,image/webp,image/gif",onChange:ye},null,544)],512),[[hr,!q.look]])]),A("div",lD,[A("div",{class:"group-head",onClick:S[121]||(S[121]=C=>W("mods"))},[A("span",cD,We(q.mods?"▸":"▾"),1),S[284]||(S[284]=A("span",null,"修改器",-1)),A("button",{class:"group-reset",title:"重置修改器参数",onClick:S[120]||(S[120]=Ct(C=>dt("mods"),["stop"]))},"重置")]),Te(A("div",hD,[A("div",uD,[A("label",dD,[Te(A("input",{type:"checkbox","onUpdate:modelValue":S[122]||(S[122]=C=>T.value.config.noise=C)},null,512),[[ei,T.value.config.noise]]),S[285]||(S[285]=A("span",{class:"switch-ui"},null,-1)),S[286]||(S[286]=A("span",null,"开启移动噪声",-1))]),T.value.config.noise?(se(),he("div",fD,[He(Je,{label:"强度",min:0,max:100,step:1,modelValue:T.value.config.noiseAmt,"onUpdate:modelValue":S[123]||(S[123]=C=>T.value.config.noiseAmt=C)},null,8,["modelValue"]),He(Je,{label:"波动范围",min:0,max:500,step:1,modelValue:T.value.config.noiseRange,"onUpdate:modelValue":S[124]||(S[124]=C=>T.value.config.noiseRange=C)},null,8,["modelValue"]),He(Je,{label:"时间流速",min:0,max:10,step:.1,modelValue:T.value.config.noiseSpeed,"onUpdate:modelValue":S[125]||(S[125]=C=>T.value.config.noiseSpeed=C)},null,8,["modelValue"]),S[287]||(S[287]=A("div",{class:"modifier-hint"},"强度控制影响比例 · 波动范围控制最大偏移 · 时间流速控制变化速度",-1))])):je("",!0)]),A("div",mD,[A("label",pD,[Te(A("input",{type:"checkbox","onUpdate:modelValue":S[126]||(S[126]=C=>T.value.config.useGravity=C)},null,512),[[ei,T.value.config.useGravity]]),S[288]||(S[288]=A("span",{class:"switch-ui"},null,-1)),S[289]||(S[289]=A("span",null,"开启重力",-1))]),T.value.config.useGravity?(se(),he("div",gD,[A("div",vD,[A("button",{class:at(["axis-mode",{on:T.value.config.gravityMode==="fixed"}]),onClick:S[127]||(S[127]=C=>T.value.config.gravityMode="fixed")},"固定",2),A("button",{class:at(["axis-mode",{on:T.value.config.gravityMode==="random"}]),onClick:S[128]||(S[128]=C=>T.value.config.gravityMode="random")},"随机",2)]),T.value.config.gravityMode==="fixed"?(se(),Ht(Je,{key:0,label:"重力强度",min:-3e3,max:3e3,step:10,modelValue:T.value.config.gravityMin,"onUpdate:modelValue":S[129]||(S[129]=C=>T.value.config.gravityMin=C)},null,8,["modelValue"])):(se(),he(st,{key:1},[He(Je,{label:"强度 min",min:-3e3,max:3e3,step:10,modelValue:T.value.config.gravityMin,"onUpdate:modelValue":S[130]||(S[130]=C=>T.value.config.gravityMin=C)},null,8,["modelValue"]),He(Je,{label:"强度 max",min:-3e3,max:3e3,step:10,modelValue:T.value.config.gravityMax,"onUpdate:modelValue":S[131]||(S[131]=C=>T.value.config.gravityMax=C)},null,8,["modelValue"])],64)),He(Je,{label:"方向",min:-360,max:360,step:1,modelValue:T.value.config.gravityDirection,"onUpdate:modelValue":S[132]||(S[132]=C=>T.value.config.gravityDirection=C)},null,8,["modelValue"]),S[290]||(S[290]=A("div",{class:"gravity-curve-title"},[A("span",null,"生命周期内重力"),A("span",null,"纵轴:强度 0~1")],-1)),He(rn,{modelValue:T.value.config.gravityCurve,"onUpdate:modelValue":S[133]||(S[133]=C=>T.value.config.gravityCurve=C),"default-value":Ae},null,8,["modelValue"]),S[291]||(S[291]=A("div",{class:"gravity-curve-axis"},[A("span",null,"0"),A("span",null,"生命周期 →"),A("span",null,"1")],-1)),S[292]||(S[292]=A("div",{class:"modifier-hint"},"0° 向右 · -90° 向下 · 负强度会反转方向",-1))])):je("",!0)]),A("div",yD,[A("label",xD,[Te(A("input",{type:"checkbox","onUpdate:modelValue":S[134]||(S[134]=C=>T.value.config.wind=C)},null,512),[[ei,T.value.config.wind]]),S[293]||(S[293]=A("span",{class:"switch-ui"},null,-1)),S[294]||(S[294]=A("span",null,"开启风力",-1))]),T.value.config.wind?(se(),he("div",bD,[A("div",wD,[A("button",{class:at(["axis-mode",{on:T.value.config.windMode==="fixed"}]),onClick:S[135]||(S[135]=C=>T.value.config.windMode="fixed")},"固定",2),A("button",{class:at(["axis-mode",{on:T.value.config.windMode==="random"}]),onClick:S[136]||(S[136]=C=>T.value.config.windMode="random")},"随机",2)]),T.value.config.windMode==="fixed"?(se(),Ht(Je,{key:0,label:"风力强度",min:-3e3,max:3e3,step:10,modelValue:T.value.config.windMin,"onUpdate:modelValue":S[137]||(S[137]=C=>T.value.config.windMin=C)},null,8,["modelValue"])):(se(),he(st,{key:1},[He(Je,{label:"强度 min",min:-3e3,max:3e3,step:10,modelValue:T.value.config.windMin,"onUpdate:modelValue":S[138]||(S[138]=C=>T.value.config.windMin=C)},null,8,["modelValue"]),He(Je,{label:"强度 max",min:-3e3,max:3e3,step:10,modelValue:T.value.config.windMax,"onUpdate:modelValue":S[139]||(S[139]=C=>T.value.config.windMax=C)},null,8,["modelValue"])],64)),He(Je,{label:"方向",min:-360,max:360,step:1,modelValue:T.value.config.windDirection,"onUpdate:modelValue":S[140]||(S[140]=C=>T.value.config.windDirection=C)},null,8,["modelValue"]),S[295]||(S[295]=A("div",{class:"gravity-curve-title"},[A("span",null,"生命周期内风力"),A("span",null,"纵轴:强度 0~1")],-1)),He(rn,{modelValue:T.value.config.windCurve,"onUpdate:modelValue":S[141]||(S[141]=C=>T.value.config.windCurve=C),"default-value":Ae},null,8,["modelValue"]),S[296]||(S[296]=A("div",{class:"gravity-curve-axis"},[A("span",null,"0"),A("span",null,"生命周期 →"),A("span",null,"1")],-1)),S[297]||(S[297]=A("div",{class:"modifier-hint"},"0° 向右 · -90° 向下 · 负强度会反转方向",-1))])):je("",!0)]),A("div",SD,[A("label",_D,[Te(A("input",{type:"checkbox","onUpdate:modelValue":S[142]||(S[142]=C=>T.value.config.forceField=C)},null,512),[[ei,T.value.config.forceField]]),S[298]||(S[298]=A("span",{class:"switch-ui"},null,-1)),S[299]||(S[299]=A("span",null,"开启力场",-1))]),T.value.config.forceField?(se(),he("div",TD,[He(Je,{label:"中心 X",min:-5e3,max:5e3,step:1,modelValue:T.value.config.forceCenterX,"onUpdate:modelValue":S[143]||(S[143]=C=>T.value.config.forceCenterX=C)},null,8,["modelValue"]),He(Je,{label:"中心 Y",min:-5e3,max:5e3,step:1,modelValue:T.value.config.forceCenterY,"onUpdate:modelValue":S[144]||(S[144]=C=>T.value.config.forceCenterY=C)},null,8,["modelValue"]),He(Je,{label:"力场强度",min:-300,max:300,step:1,modelValue:T.value.config.forceStrength,"onUpdate:modelValue":S[145]||(S[145]=C=>T.value.config.forceStrength=C)},null,8,["modelValue"]),He(Je,{label:"力场半径",min:1,max:2e3,step:1,modelValue:T.value.config.forceRadius,"onUpdate:modelValue":S[146]||(S[146]=C=>T.value.config.forceRadius=C)},null,8,["modelValue"]),A("label",MD,[S[301]||(S[301]=A("span",null,"衰减模式",-1)),Te(A("select",{"onUpdate:modelValue":S[147]||(S[147]=C=>T.value.config.forceFalloff=C),class:"inp"},[...S[300]||(S[300]=[A("option",{value:"constant"},"恒定(范围内力度不变)",-1),A("option",{value:"linear"},"线性衰减(边缘为 0)",-1),A("option",{value:"inverse"},"距离反比(中心最强)",-1)])],512),[[qt,T.value.config.forceFalloff]])]),S[302]||(S[302]=A("div",{class:"modifier-hint"},"正数吸向中心 · 负数向外排斥 · 可在画布内拖动力场圆",-1))])):je("",!0)]),A("div",ED,[A("label",AD,[Te(A("input",{type:"checkbox","onUpdate:modelValue":S[148]||(S[148]=C=>T.value.config.attraction=C)},null,512),[[ei,T.value.config.attraction]]),S[303]||(S[303]=A("span",{class:"switch-ui"},null,-1)),S[304]||(S[304]=A("span",null,"开启吸附",-1))]),T.value.config.attraction?(se(),he("div",CD,[He(Je,{label:"吸附点 X",min:-5e3,max:5e3,step:1,modelValue:T.value.config.attractionCenterX,"onUpdate:modelValue":S[149]||(S[149]=C=>T.value.config.attractionCenterX=C)},null,8,["modelValue"]),He(Je,{label:"吸附点 Y",min:-5e3,max:5e3,step:1,modelValue:T.value.config.attractionCenterY,"onUpdate:modelValue":S[150]||(S[150]=C=>T.value.config.attractionCenterY=C)},null,8,["modelValue"]),He(Je,{label:"吸附半径",min:0,max:2e3,step:1,modelValue:T.value.config.attractionRadius,"onUpdate:modelValue":S[151]||(S[151]=C=>T.value.config.attractionRadius=C)},null,8,["modelValue"]),He(Je,{label:"吸附时长",min:.05,max:30,step:.05,modelValue:T.value.config.attractionDuration,"onUpdate:modelValue":S[152]||(S[152]=C=>T.value.config.attractionDuration=C)},null,8,["modelValue"]),He(Je,{label:"延迟时间",min:0,max:30,step:.05,modelValue:T.value.config.attractionDelay,"onUpdate:modelValue":S[153]||(S[153]=C=>T.value.config.attractionDelay=C)},null,8,["modelValue"]),A("label",ID,[S[306]||(S[306]=A("span",null,"延迟方式",-1)),Te(A("select",{"onUpdate:modelValue":S[154]||(S[154]=C=>T.value.config.attractionDelayMode=C),class:"inp"},[...S[305]||(S[305]=[A("option",{value:"global"},"统一时间",-1),A("option",{value:"particle"},"单粒子生命",-1)])],512),[[qt,T.value.config.attractionDelayMode]])]),A("label",RD,[S[308]||(S[308]=A("span",null,"吸附方式",-1)),Te(A("select",{"onUpdate:modelValue":S[155]||(S[155]=C=>T.value.config.attractionPath=C),class:"inp"},[...S[307]||(S[307]=[A("option",{value:"linear"},"直线",-1),A("option",{value:"curve"},"曲线",-1)])],512),[[qt,T.value.config.attractionPath]])]),S[309]||(S[309]=A("div",{class:"modifier-hint"},"延迟后从当前位置开始吸附 · 到达红色范围即死亡 · 可在画布内拖动吸附圆",-1))])):je("",!0)]),A("div",PD,[A("label",kD,[Te(A("input",{type:"checkbox","onUpdate:modelValue":S[156]||(S[156]=C=>T.value.config.trail=C)},null,512),[[ei,T.value.config.trail]]),S[310]||(S[310]=A("span",{class:"switch-ui"},null,-1)),S[311]||(S[311]=A("span",null,"开启拖尾",-1))]),T.value.config.trail?(se(),he("div",FD,[A("div",{class:"trail-section-head"},[S[312]||(S[312]=A("div",{class:"trail-section-title"},"拖尾独立图片",-1)),A("button",{class:"image-add",title:"增加拖尾图片资源",onClick:Ea},"+")]),(se(!0),he(st,null,ui(T.value.config.trailResources,C=>(se(),Ht(yv,{key:C.id,resource:C,"resource-count":T.value.config.trailResources.length,"default-file":"trail.png","name-placeholder":"trail","show-folder":!1,onPick:Aa,onReset:Xr,onRemove:cr,onUpdateWeight:z,onToggleLock:V},{default:af(()=>[S[328]||(S[328]=A("div",{class:"resource-divider"},null,-1)),He(Je,{label:"旋转",min:-360,max:360,step:1,"model-value":C.rotation,"onUpdate:modelValue":ee=>Zs(C.id,ee)},null,8,["model-value","onUpdate:modelValue"]),He(Je,{label:"拖尾骨骼数",min:2,max:16,step:1,"model-value":C.boneCount,"onUpdate:modelValue":ee=>Ks(C.id,ee)},null,8,["model-value","onUpdate:modelValue"]),He(Je,{label:"拖尾比例 (%)",min:0,max:100,step:1,modelValue:C.trailRatio,"onUpdate:modelValue":ee=>C.trailRatio=ee},null,8,["modelValue","onUpdate:modelValue"]),A("label",OD,[S[314]||(S[314]=A("span",null,"拖尾长度",-1)),Te(A("select",{"onUpdate:modelValue":ee=>C.lengthMode=ee,class:"inp"},[...S[313]||(S[313]=[A("option",{value:"fixed"},"固定",-1),A("option",{value:"random"},"随机范围",-1)])],8,BD),[[qt,C.lengthMode]])]),C.lengthMode==="fixed"?(se(),Ht(Je,{key:0,label:"长度比例 (%)",min:0,max:500,step:1,modelValue:C.length,"onUpdate:modelValue":ee=>C.length=ee},null,8,["modelValue","onUpdate:modelValue"])):(se(),he(st,{key:1},[He(Je,{label:"长度最小 (%)",min:0,max:500,step:1,modelValue:C.lengthMin,"onUpdate:modelValue":ee=>C.lengthMin=ee},null,8,["modelValue","onUpdate:modelValue"]),He(Je,{label:"长度最大 (%)",min:0,max:500,step:1,modelValue:C.lengthMax,"onUpdate:modelValue":ee=>C.lengthMax=ee},null,8,["modelValue","onUpdate:modelValue"])],64)),A("label",LD,[S[316]||(S[316]=A("span",null,"拖尾宽度",-1)),Te(A("select",{"onUpdate:modelValue":ee=>C.widthSizeMode=ee,class:"inp"},[...S[315]||(S[315]=[A("option",{value:"fixed"},"固定",-1),A("option",{value:"random"},"随机范围",-1)])],8,DD),[[qt,C.widthSizeMode]])]),C.widthSizeMode==="fixed"?(se(),Ht(Je,{key:2,label:"宽度比例 (%)",min:0,max:500,step:1,modelValue:C.width,"onUpdate:modelValue":ee=>C.width=ee},null,8,["modelValue","onUpdate:modelValue"])):(se(),he(st,{key:3},[He(Je,{label:"宽度最小 (%)",min:0,max:500,step:1,modelValue:C.widthMin,"onUpdate:modelValue":ee=>C.widthMin=ee},null,8,["modelValue","onUpdate:modelValue"]),He(Je,{label:"宽度最大 (%)",min:0,max:500,step:1,modelValue:C.widthMax,"onUpdate:modelValue":ee=>C.widthMax=ee},null,8,["modelValue","onUpdate:modelValue"])],64)),A("label",ND,[S[318]||(S[318]=A("span",null,"宽度缩放",-1)),Te(A("select",{"onUpdate:modelValue":ee=>C.widthMode=ee,class:"inp"},[...S[317]||(S[317]=[A("option",{value:"particle"},"跟随粒子",-1),A("option",{value:"fixed"},"固定",-1)])],8,UD),[[qt,C.widthMode]])]),A("label",XD,[Te(A("input",{type:"checkbox","onUpdate:modelValue":ee=>C.lifeLengthEnabled=ee},null,8,YD),[[ei,C.lifeLengthEnabled]]),S[319]||(S[319]=A("span",{class:"switch-ui"},null,-1)),S[320]||(S[320]=A("span",null,"生命周期长度曲线",-1))]),C.lifeLengthEnabled?(se(),Ht(rn,{key:4,modelValue:C.lifeLengthCurve,"onUpdate:modelValue":ee=>C.lifeLengthCurve=ee,"default-value":Ae},null,8,["modelValue","onUpdate:modelValue"])):je("",!0),A("label",VD,[Te(A("input",{type:"checkbox","onUpdate:modelValue":ee=>C.shapeEnabled=ee},null,8,$D),[[ei,C.shapeEnabled]]),S[321]||(S[321]=A("span",{class:"switch-ui"},null,-1)),S[322]||(S[322]=A("span",null,"形状曲线(首端 → 尾端宽度)",-1))]),C.shapeEnabled?(se(),Ht(rn,{key:5,modelValue:C.shapeCurve,"onUpdate:modelValue":ee=>C.shapeCurve=ee,"default-value":K},null,8,["modelValue","onUpdate:modelValue"])):je("",!0),A("div",GD,[S[323]||(S[323]=A("span",null,"颜色模式",-1)),A("div",jD,[A("button",{class:at(["axis-mode",{on:C.colorMode==="particle"}]),onClick:ee=>C.colorMode="particle"},"跟随粒子",10,HD),A("button",{class:at(["axis-mode",{on:C.colorMode==="fixed"}]),onClick:ee=>C.colorMode="fixed"},"固定",10,WD),A("button",{class:at(["axis-mode",{on:C.colorMode==="curve"}]),onClick:ee=>C.colorMode="curve"},"曲线",10,zD)])]),A("label",qD,[S[325]||(S[325]=A("span",null,"混合模式",-1)),Te(A("select",{"onUpdate:modelValue":ee=>C.blend=ee,class:"inp"},[...S[324]||(S[324]=[A("option",{value:"normal"},"正常",-1),A("option",{value:"add"},"相加",-1),A("option",{value:"multiply"},"相乘",-1),A("option",{value:"screen"},"滤色",-1)])],8,KD),[[qt,C.blend]])]),C.colorMode==="fixed"?(se(),he("label",ZD,[S[326]||(S[326]=A("span",null,"固定颜色",-1)),Te(A("input",{class:"colr",type:"color","onUpdate:modelValue":ee=>C.color=ee},null,8,JD),[[ot,C.color]]),A("input",{class:"hex-input",value:C.color,onChange:ee=>J(C,ee),onKeydown:ha(Ct(ee=>ie(C,ee),["prevent"]),["enter"])},null,40,QD)])):C.colorMode==="curve"?(se(),Ht(vv,{key:7,modelValue:C.colorGradient,"onUpdate:modelValue":ee=>C.colorGradient=ee},null,8,["modelValue","onUpdate:modelValue"])):je("",!0),A("div",eN,[S[327]||(S[327]=A("span",null,"透明度模式",-1)),A("div",tN,[A("button",{class:at(["axis-mode",{on:C.alphaMode==="particle"}]),onClick:ee=>C.alphaMode="particle"},"跟随粒子",10,iN),A("button",{class:at(["axis-mode",{on:C.alphaMode==="fixed"}]),onClick:ee=>C.alphaMode="fixed"},"固定",10,sN),A("button",{class:at(["axis-mode",{on:C.alphaMode==="curve"}]),onClick:ee=>C.alphaMode="curve"},"曲线",10,nN)])]),C.alphaMode==="fixed"?(se(),Ht(Je,{key:8,label:"透明度",min:0,max:1,step:.01,modelValue:C.alpha,"onUpdate:modelValue":ee=>C.alpha=ee},null,8,["modelValue","onUpdate:modelValue"])):je("",!0),C.alphaMode==="curve"?(se(),Ht(rn,{key:9,modelValue:C.alphaCurve,"onUpdate:modelValue":ee=>C.alphaCurve=ee,"default-value":j},null,8,["modelValue","onUpdate:modelValue"])):je("",!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:Rn},null,544),A("div",rN,[He(Je,{label:"网格行数",min:2,max:16,step:1,"model-value":T.value.config.trailGridRows,"onUpdate:modelValue":S[157]||(S[157]=C=>Ur("trailGridRows",C))},null,8,["model-value"]),He(Je,{label:"网格列数",min:2,max:32,step:1,"model-value":T.value.config.trailGridCols,"onUpdate:modelValue":S[158]||(S[158]=C=>Ur("trailGridCols",C))},null,8,["model-value"])]),S[329]||(S[329]=A("div",{class:"modifier-hint"},"每个粒子按资源比例生成一组同级拖尾骨骼;随机长度与宽度在粒子出生时确定,相同种子可稳定复现",-1))])):je("",!0)]),A("div",aN,[A("label",oN,[Te(A("input",{type:"checkbox","onUpdate:modelValue":S[159]||(S[159]=C=>T.value.config.emitterFollow=C),disabled:T.value.config.streamBehavior==="loop"},null,8,lN),[[ei,T.value.config.emitterFollow]]),S[330]||(S[330]=A("span",{class:"switch-ui"},null,-1)),S[331]||(S[331]=A("span",null,"开启发射器跟随",-1))]),T.value.config.emitterFollow&&T.value.config.streamBehavior!=="loop"?(se(),he("div",cN,[A("label",hN,[S[334]||(S[334]=A("span",null,"跟随模式",-1)),A("select",{value:T.value.config.emitterFollowMode,class:"inp",onChange:S[160]||(S[160]=C=>Re(C,T.value.config))},[S[332]||(S[332]=A("option",{value:"none"},"无",-1)),S[333]||(S[333]=A("option",{value:"path"},"跟随路径",-1)),de.value||T.value.config.emitterFollowMode==="bone"?(se(),he("option",dN,"选中的骨骼")):je("",!0)],40,uN)]),T.value.config.emitterFollowMode==="path"?(se(),he(st,{key:0},[A("label",fN,[S[336]||(S[336]=A("span",null,"跟随路径",-1)),Te(A("select",{"onUpdate:modelValue":S[161]||(S[161]=C=>T.value.config.emitterFollowPathId=C),class:"inp"},[S[335]||(S[335]=A("option",{value:0},"无",-1)),(se(!0),he(st,null,ui(De(e).paths,C=>(se(),he("option",{key:C.id,value:C.id},We(C.name),9,mN))),128))],512),[[qt,T.value.config.emitterFollowPathId,void 0,{number:!0}]])]),A("label",pN,[S[338]||(S[338]=A("span",null,"发射器角度模式",-1)),Te(A("select",{"onUpdate:modelValue":S[162]||(S[162]=C=>T.value.config.emitterAngleMode=C),class:"inp"},[...S[337]||(S[337]=[A("option",{value:"fixed"},"固定角度",-1),A("option",{value:"direction"},"跟随移动方向",-1)])],512),[[qt,T.value.config.emitterAngleMode]])]),S[344]||(S[344]=A("div",{class:"gravity-curve-title"},[A("span",null,"移动进度曲线 (0→1)")],-1)),He(rn,{modelValue:T.value.config.emitterFollowCurve,"onUpdate:modelValue":S[163]||(S[163]=C=>T.value.config.emitterFollowCurve=C),"default-value":_e},null,8,["modelValue"]),A("div",gN,[A("label",vN,[S[339]||(S[339]=A("span",null,"移动时长 (s)",-1)),Te(A("input",{"onUpdate:modelValue":S[164]||(S[164]=C=>T.value.config.emitterFollowDuration=C),type:"number",min:"0.05",step:"0.05",class:"inp"},null,512),[[ot,T.value.config.emitterFollowDuration,void 0,{number:!0}]])]),A("label",yN,[S[341]||(S[341]=A("span",null,"跟随空间",-1)),Te(A("select",{"onUpdate:modelValue":S[165]||(S[165]=C=>T.value.config.emitterFollowSpace=C),class:"inp"},[...S[340]||(S[340]=[A("option",{value:"local"},"局部空间(GEN 移动)",-1),A("option",{value:"world"},"世界空间(粒子生成点移动)",-1)])],512),[[qt,T.value.config.emitterFollowSpace]])])]),A("label",xN,[S[343]||(S[343]=A("span",null,"移动方向",-1)),Te(A("select",{"onUpdate:modelValue":S[166]||(S[166]=C=>T.value.config.emitterFollowDirection=C),class:"inp"},[...S[342]||(S[342]=[A("option",{value:"forward"},"正向(起点 → 终点)",-1),A("option",{value:"reverse"},"反向(终点 → 起点)",-1)])],512),[[qt,T.value.config.emitterFollowDirection]])]),He(Je,{label:"偏移起始点 (0-1)",min:0,max:1,step:.01,modelValue:T.value.config.emitterFollowOffset,"onUpdate:modelValue":S[167]||(S[167]=C=>T.value.config.emitterFollowOffset=C)},null,8,["modelValue"]),S[345]||(S[345]=A("div",{class:"modifier-hint"},"局部空间会移动整个发射器;世界空间只移动新粒子的生成点,已出生粒子留在世界位置。",-1))],64)):T.value.config.emitterFollowMode==="bone"?(se(),he(st,{key:1},[me.value?(se(),he("div",bN,[S[346]||(S[346]=ii("跟随目标:",-1)),A("strong",null,We(me.value.spine.name)+" / "+We(me.value.boneName),1)])):(se(),he("div",wN,"尚未绑定有效骨骼,请先在 Spine 层级树中选择骨骼。")),de.value&&(!me.value||de.value.spine.id!==me.value.spine.id||de.value.boneName!==me.value.boneName)?(se(),he("button",{key:2,class:"bone-follow-rebind",onClick:S[168]||(S[168]=C=>Fe(T.value.config))},We(me.value?"重新绑定":"绑定")+"当前选中骨骼:"+We(de.value.spine.name)+" / "+We(de.value.boneName),1)):je("",!0),me.value?(se(),he(st,{key:3},[A("label",SN,[S[348]||(S[348]=A("span",null,"跟随空间",-1)),Te(A("select",{"onUpdate:modelValue":S[169]||(S[169]=C=>T.value.config.emitterFollowSpace=C),class:"inp"},[...S[347]||(S[347]=[A("option",{value:"local"},"本地空间(随骨骼移动)",-1),A("option",{value:"world"},"世界空间(粒子生成后保持位置)",-1)])],512),[[qt,T.value.config.emitterFollowSpace]])]),A("div",_N,[A("label",TN,[S[349]||(S[349]=A("span",null,"位移偏移 X",-1)),Te(A("input",{"onUpdate:modelValue":S[170]||(S[170]=C=>T.value.config.emitterFollowBoneOffsetX=C),type:"number",step:"1",class:"inp"},null,512),[[ot,T.value.config.emitterFollowBoneOffsetX,void 0,{number:!0}]])]),A("label",MN,[S[350]||(S[350]=A("span",null,"位移偏移 Y",-1)),Te(A("input",{"onUpdate:modelValue":S[171]||(S[171]=C=>T.value.config.emitterFollowBoneOffsetY=C),type:"number",step:"1",class:"inp"},null,512),[[ot,T.value.config.emitterFollowBoneOffsetY,void 0,{number:!0}]])])]),A("div",EN,[A("label",AN,[S[351]||(S[351]=A("span",null,"旋转偏移",-1)),Te(A("input",{"onUpdate:modelValue":S[172]||(S[172]=C=>T.value.config.emitterFollowBoneRotation=C),type:"number",step:"1",class:"inp"},null,512),[[ot,T.value.config.emitterFollowBoneRotation,void 0,{number:!0}]])]),A("label",CN,[S[352]||(S[352]=A("span",null,"缩放偏移 X",-1)),Te(A("input",{"onUpdate:modelValue":S[173]||(S[173]=C=>T.value.config.emitterFollowBoneScaleX=C),type:"number",step:"0.05",class:"inp"},null,512),[[ot,T.value.config.emitterFollowBoneScaleX,void 0,{number:!0}]])]),A("label",IN,[S[353]||(S[353]=A("span",null,"缩放偏移 Y",-1)),Te(A("input",{"onUpdate:modelValue":S[174]||(S[174]=C=>T.value.config.emitterFollowBoneScaleY=C),type:"number",step:"0.05",class:"inp"},null,512),[[ot,T.value.config.emitterFollowBoneScaleY,void 0,{number:!0}]])])]),S[354]||(S[354]=A("div",{class:"modifier-hint"},"发射器只跟随所选 Spine 骨骼的位置,不继承 Spine 的旋转或缩放;粒子变换使用粒子系统自身参数和上方偏移。",-1))],64)):je("",!0)],64)):je("",!0)])):je("",!0)]),He(Je,{label:"阻尼",min:0,max:2,step:.05,modelValue:T.value.config.damping,"onUpdate:modelValue":S[175]||(S[175]=C=>T.value.config.damping=C)},null,8,["modelValue"])],512),[[hr,!q.mods]])]),A("div",RN,[A("div",{class:"group-head",onClick:S[177]||(S[177]=C=>W("export"))},[A("span",PN,We(q.export?"▸":"▾"),1),S[355]||(S[355]=A("span",null,"导出设置",-1)),A("button",{class:"group-reset",title:"重置导出设置",onClick:S[176]||(S[176]=Ct(C=>dt("export"),["stop"]))},"重置")]),Te(A("div",kN,[A("label",FN,[S[356]||(S[356]=A("span",null,"图片路径 (Spine Images Path)",-1)),Te(A("input",{"onUpdate:modelValue":S[178]||(S[178]=C=>t.value.imagesPath=C),class:"inp export-input",type:"text",placeholder:"./images/"},null,512),[[ot,t.value.imagesPath,void 0,{trim:!0}]])]),A("label",ON,[S[358]||(S[358]=A("span",null,"Spine 版本",-1)),Te(A("select",{"onUpdate:modelValue":S[179]||(S[179]=C=>t.value.spineVersion=C),class:"inp export-input"},[...S[357]||(S[357]=[Ua('<option value="3.8" data-v-cd7486c0>Spine 3.8</option><option value="4.0" data-v-cd7486c0>Spine 4.0</option><option value="4.1" data-v-cd7486c0>Spine 4.1</option><option value="4.2" data-v-cd7486c0>Spine 4.2</option><option value="4.3" data-v-cd7486c0>Spine 4.3</option>',5)])],512),[[qt,t.value.spineVersion]])]),A("label",BN,[S[360]||(S[360]=A("span",null,"关键帧插值曲线",-1)),Te(A("select",{"onUpdate:modelValue":S[180]||(S[180]=C=>t.value.keyframeCurve=C),class:"inp export-input"},[...S[359]||(S[359]=[A("option",{value:"linear"},"线性 (Linear)",-1),A("option",{value:"bezier"},"平滑贝塞尔 (Smooth Bézier)",-1)])],512),[[qt,t.value.keyframeCurve]])]),S[369]||(S[369]=A("div",{class:"export-help"},"平滑贝塞尔会在误差允许范围内拟合连续运动;出生、死亡、附件切换和突变仍使用阶跃关键帧。",-1)),t.value.spineVersion==="3.8"?(se(),he("div",LN,"Spine 3.8 不支持 4.x 的逐通道数组贝塞尔,导出时会转换为经过容差精简的分段线性关键帧。")):je("",!0),A("div",DN,[A("label",NN,[S[361]||(S[361]=A("span",null,"导出 FPS",-1)),Te(A("input",{"onUpdate:modelValue":S[181]||(S[181]=C=>t.value.fps=C),class:"inp export-input",type:"number",min:"1",max:"240",step:"1",onChange:It},null,544),[[ot,t.value.fps,void 0,{number:!0}]])]),A("label",UN,[Te(A("input",{"onUpdate:modelValue":S[182]||(S[182]=C=>t.value.omitFps=C),type:"checkbox"},null,512),[[ei,t.value.omitFps]]),S[362]||(S[362]=ii("不写 fps",-1))])]),S[370]||(S[370]=A("div",{class:"export-help"},"修改 FPS 时保持动画实际秒数不变;“不写 fps”只省略 Spine 的 fps 元数据。",-1)),A("div",XN,[A("label",YN,[Te(A("input",{"onUpdate:modelValue":S[183]||(S[183]=C=>t.value.integerFrameAlignment=C),type:"checkbox"},null,512),[[ei,t.value.integerFrameAlignment]]),S[363]||(S[363]=A("span",{class:"switch-ui"},null,-1)),S[364]||(S[364]=A("span",null,"整数帧对齐",-1))]),A("label",VN,[Te(A("input",{"onUpdate:modelValue":S[184]||(S[184]=C=>t.value.bonePool=C),type:"checkbox"},null,512),[[ei,t.value.bonePool]]),S[365]||(S[365]=A("span",{class:"switch-ui"},null,-1)),S[366]||(S[366]=A("span",null,"骨骼对象池",-1))]),A("label",$N,[Te(A("input",{"onUpdate:modelValue":S[185]||(S[185]=C=>t.value.excludeEmptyAnimations=C),type:"checkbox"},null,512),[[ei,t.value.excludeEmptyAnimations]]),S[367]||(S[367]=A("span",{class:"switch-ui"},null,-1)),S[368]||(S[368]=A("span",null,"排除无内容动画",-1))])])],512),[[hr,!q.export]])])],64)):je("",!0)]),A("div",GN,[A("button",{type:"button",class:"export-spine-json",disabled:l.value,title:l.value?"正在重新计算并烘焙动画":`导出 Spine ${t.value.spineVersion} JSON`,onClick:L},We(l.value&&c.value==="json"?"正在准备导出…":"导出Spine Json"),9,jN),A("button",{type:"button",class:"export-spine-images",disabled:l.value,title:"单独下载当前粒子系统使用的图片 ZIP",onClick:O},We(l.value&&c.value==="images"?"正在整理图片…":"导出 images 包"),9,HN),A("button",{type:"button",class:"export-spine-project",disabled:l.value||!y.value,title:w.value,onClick:X},[A("span",null,We(l.value&&c.value==="spine"?"正在生成工程…":"导出 .spine 包"),1),!l.value&&g.value?(se(),he("small",zN,We(g.value),1)):je("",!0)],8,WN)]),A("div",{class:at(["connector-status",v.value])},[S[371]||(S[371]=A("span",{class:"connector-dot"},null,-1)),ii(We(m.value)+" ",1),b.value?(se(),he("a",{key:0,href:b.value,target:"_blank",rel:"noopener",title:"在本机连接器中授权当前网站"},"授权当前网站",8,qN)):je("",!0),A("button",{type:"button",title:"重新检测连接器",onClick:P},"刷新")],2),u.value?(se(),he("div",{key:0,class:at(["export-message",{error:d.value}])},[ii(We(u.value)+" ",1),p.value?(se(),he("a",{key:0,href:p.value,target:"_blank",rel:"noopener",onClick:S[186]||(S[186]=C=>p.value="")},"授权当前网站",8,KN)):je("",!0)],2)):je("",!0)]))}}),JN=In(ZN,[["__scopeId","data-v-cd7486c0"]]),QN={class:"timeline"},e4={class:"tl-controls"},t4=["title"],i4={class:"tl-range",title:"自定义播放起始帧"},s4=["max","onKeydown"],n4={class:"tl-range",title:"自定义播放结束帧"},r4=["min","max","onKeydown"],a4=["title"],o4={class:"tl-frame"},l4=["disabled"],c4=["onClick"],h4={key:0},u4={class:"tl-animation-editor"},d4={key:0,class:"tl-animation-error"},f4={class:"tl-animation-actions"},m4=["disabled"],p4={key:1,class:"tl-animation-hint"},g4={class:"tl-anim tl-spine-preview"},v4=["value","disabled"],y4={value:""},x4=["value"],b4={class:"tl-zoom"},w4={class:"tl-ticks"},S4={class:"tl-ticklabel"},_4={class:"tl-lanes"},T4=["onPointerdown"],M4={class:"lane-name"},E4=["onPointerdown"],A4=["onPointerdown"],C4=["onPointerdown"],I4={class:"lane-name"},R4={key:0,class:"tl-empty"},P4=En({__name:"Timeline",setup(n){const e=Fl(),t=lt(null),i=lt(null),s=lt(!1),r=lt("animation"),a=lt("");Uo(()=>{(!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=ft(()=>e.systems.find(q=>q.id===e.activeId)||null),h=ft(()=>{const q=o.value;return!q||!H(q)?null:O1(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 Q;const q=((Q=o.value)==null?void 0:Q.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 Q,le;const q=((Q=o.value)==null?void 0:Q.animation)||e.timeline.animation;if(!e.removeAnimation(q)){a.value="至少需要保留一个动画";return}const W=((le=o.value)==null?void 0:le.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)}So(()=>document.addEventListener("pointerdown",p)),Dm(()=>document.removeEventListener("pointerdown",p));const m=ft(()=>Math.max(1,e.timeline.fps||30)),v=lt(120),y=lt({}),b=lt({}),g=lt({}),w=lt({}),E=lt(String(e.timeline.playbackStart)),M=lt(String(e.timeline.playbackEnd));vs(()=>e.timeline.playbackStart,q=>{E.value=String(q)}),vs(()=>e.timeline.playbackEnd,q=>{M.value=String(q)});const _=ft(()=>e.timeline.totalFrames),I=ft(()=>v.value<=30?"放大":v.value>=300?"缩小":"适中"),R=ft(()=>e.spines.filter(q=>q.selectedAnimation&&q.animations.some(W=>W.name===q.selectedAnimation&&W.duration>0))),F=ft(()=>(e.activeObjectType==="spine"?e.spines.find(W=>W.id===e.activeObjectId&&W.animations.length):null)||e.spines.find(W=>W.animations.length)||null);function P(q){const W=F.value;W&&(W.selectedAnimation=q.target.value,e.recalcTotalFrames(),e.timeline.frame=0)}function k(){e.setPlaybackStart(Number(E.value)),E.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 X(){var W;const q=((W=t.value)==null?void 0:W.clientWidth)||600;return v.value/q}const O=ft(()=>{const q=[],W=v.value;let Q=1;v.value<=10?Q=1:v.value<=50?Q=5:v.value<=200?Q=10:v.value<=500?Q=50:Q=100;for(let le=0;le<=W;le+=Q)q.push({f:le,px:le/X()});return q}),D=ft(()=>e.timeline.frame/X());function T(q){const W=q.config;return(y.value[q.id]??Math.max(0,Number(W.delay)||0))*m.value/X()}function U(q){const W=q.config,Q=Math.max(0,Number(W.lifeMin)||0),le=Math.max(0,Number(W.lifeMax)||0);return W.lifeMode==="fixed"?Q:Math.max(Q,le)}function N(q){return G(q)}function Y(q){if(q.config.mode!=="stream")return 0;if(q.config.streamBehavior==="loop"){const Q=q.config;return(g.value[q.id]??Ir(Q,m.value).loop)/X()}return(b.value[q.id]??Math.max(1/m.value,Number(q.config.duration)||1))*m.value/X()}function G(q){const W=q.config;return W.mode==="stream"&&W.streamBehavior==="loop"?ne(q)+Y(q)+Z(q):Y(q)+U(q)*m.value/X()}function H(q){const W=q.config;return W.mode==="stream"&&W.streamBehavior==="loop"}function ne(q){return H(q)?Ir(q.config,m.value).start/X():0}function Z(q){return H(q)?Ir(q.config,m.value).end/X():0}function de(q){var W;return((W=q.animations.find(Q=>Q.name===q.selectedAnimation))==null?void 0:W.duration)||0}function me(q){return(w.value[q.id]??Math.max(0,Number(q.timeOffset)||0))*m.value/X()}function _e(q){return de(q)*m.value/X()}function Ae(q){const W=q.deltaY<0?.8:1.25;let Q=v.value*W;Q=Math.min(2e3,Math.max(10,Q)),v.value=Math.round(Q)}function ge(q){const W=t.value,Q=xe=>{const ae=W.getBoundingClientRect(),we=Math.floor((xe.clientX-ae.left)/ae.width*v.value);e.timeline.frame=Math.max(0,Math.min(we,_.value-1))};Q(q);const le=()=>{window.removeEventListener("pointermove",Q),window.removeEventListener("pointerup",le)};window.addEventListener("pointermove",Q),window.addEventListener("pointerup",le)}function Ee(q,W){q.stopPropagation();const Q=q.clientX,le=Math.max(0,Number(W.config.delay)||0),xe=X()/m.value,ae=Re=>{const Fe=(Re.clientX-Q)*xe,it=Math.max(0,Math.min(le+Fe,600));y.value[W.id]=Math.round(it*m.value)/m.value},we=Re=>{window.removeEventListener("pointermove",ae),window.removeEventListener("pointerup",ce),window.removeEventListener("pointercancel",Ue);const Fe=y.value[W.id];delete y.value[W.id],Re&&Fe!=null&&Fe!==le&&(W.config.delay=Fe)},ce=()=>we(!0),Ue=()=>we(!1);window.addEventListener("pointermove",ae),window.addEventListener("pointerup",ce),window.addEventListener("pointercancel",Ue)}function j(q,W){var It;q.stopPropagation();const Q=H(W),le=Math.max(0,Number(W.config.duration)||0),xe=Ir(W.config,m.value).loop,ae=X()/m.value,we=((It=q.currentTarget.closest(".lane-bar"))==null?void 0:It.getBoundingClientRect().left)??q.clientX,ce=ne(W);let Ue=!1;const Re=yt=>{if(Ue=!0,Q){const Mt=Math.min(1800,Math.max(1,Math.round((yt.clientX-we-ce)/X())));g.value[W.id]=Mt}else{const Mt=Math.max(1/m.value,Math.min((yt.clientX-we)*ae,600));b.value[W.id]=Math.round(Mt*m.value)/m.value}},Fe=yt=>{window.removeEventListener("pointermove",Re),window.removeEventListener("pointerup",it),window.removeEventListener("pointercancel",dt);const Mt=b.value[W.id],zt=g.value[W.id];delete b.value[W.id],delete g.value[W.id],yt&&Ue&&Q&&zt!=null&&zt!==xe?W.config.loopDurationFrames=zt:yt&&Ue&&!Q&&Mt!=null&&Mt!==le&&(W.config.duration=Mt)},it=()=>Fe(!0),dt=()=>Fe(!1);window.addEventListener("pointermove",Re),window.addEventListener("pointerup",it),window.addEventListener("pointercancel",dt)}function K(q,W){q.stopPropagation();const Q=q.clientX,le=Math.max(0,Number(W.timeOffset)||0),xe=X()/m.value,ae=Re=>{const Fe=Math.max(0,Math.min(le+(Re.clientX-Q)*xe,600));w.value[W.id]=Math.round(Fe*m.value)/m.value},we=Re=>{window.removeEventListener("pointermove",ae),window.removeEventListener("pointerup",ce),window.removeEventListener("pointercancel",Ue);const Fe=w.value[W.id];delete w.value[W.id],Re&&Fe!=null&&Fe!==le&&(W.timeOffset=Fe,e.recalcTotalFrames())},ce=()=>we(!0),Ue=()=>we(!1);window.addEventListener("pointermove",ae),window.addEventListener("pointerup",ce),window.addEventListener("pointercancel",Ue)}return(q,W)=>{var Q,le,xe;return se(),he("div",QN,[A("div",e4,[A("button",{class:at(["tl-btn",{on:De(e).timeline.playing}]),onClick:W[0]||(W[0]=ae=>De(e).togglePlay()),title:De(e).timeline.playing?"暂停 (D)":"播放 (D)"},We(De(e).timeline.playing?"❚❚":"▶"),11,t4),A("button",{class:"tl-btn",onClick:W[1]||(W[1]=ae=>De(e).toStart()),title:"回到第一帧 (S)"},"⏮"),A("button",{class:"tl-btn",onClick:W[2]||(W[2]=ae=>De(e).previousFrame()),title:"前一帧"},"◀"),A("button",{class:"tl-btn",onClick:W[3]||(W[3]=ae=>De(e).nextFrame()),title:"后一帧"},"▶"),A("button",{class:"tl-btn",onClick:W[4]||(W[4]=ae=>De(e).toEnd()),title:"移动到最后一帧"},"⏭"),A("button",{class:at(["tl-btn",{on:De(e).timeline.loop}]),onClick:W[5]||(W[5]=ae=>De(e).toggleLoop()),title:"循环"},"⟳",2),A("label",i4,[W[10]||(W[10]=A("span",null,"A",-1)),Te(A("input",{"onUpdate:modelValue":W[6]||(W[6]=ae=>E.value=ae),type:"number",min:"0",max:Math.max(0,De(e).timeline.playbackEnd-1),"aria-label":"播放起始帧",onChange:k,onKeydown:ha(Ct(k,["prevent"]),["enter"])},null,40,s4),[[ot,E.value]])]),A("label",n4,[W[11]||(W[11]=A("span",null,"B",-1)),Te(A("input",{"onUpdate:modelValue":W[7]||(W[7]=ae=>M.value=ae),type:"number",min:De(e).timeline.playbackStart+1,max:Math.max(1,De(e).timeline.totalFrames-1),"aria-label":"播放结束帧",onChange:B,onKeydown:ha(Ct(B,["prevent"]),["enter"])},null,40,r4),[[ot,M.value]])]),h.value?(se(),he("button",{key:0,class:"tl-loop-range",title:`设为闭合自循环范围 ${h.value.start}–${h.value.end}f`,onClick:L},"循环段",8,a4)):je("",!0),A("span",o4,[W[12]||(W[12]=ii("帧 ",-1)),A("b",null,We(De(e).timeline.frame),1),W[13]||(W[13]=ii(" / ",-1)),A("b",null,We(Math.max(0,De(e).timeline.totalFrames-1)),1)]),W[18]||(W[18]=A("span",{class:"tl-legend"},[A("i",{class:"legend-emission"}),ii("持续发射 "),A("i",{class:"legend-life"}),ii("粒子存在 "),A("i",{class:"legend-spine"}),ii("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:Ct(l,["stop"])},[A("span",null,We(((Q=o.value)==null?void 0:Q.animation)||De(e).timeline.animation),1),W[14]||(W[14]=A("i",null,"⌄",-1))],8,l4),s.value?(se(),he("div",{key:0,class:"tl-animation-menu",onPointerdown:W[9]||(W[9]=Ct(()=>{},["stop"]))},[W[15]||(W[15]=A("div",{class:"tl-animation-menu-title"},"选择所属动画",-1)),(se(!0),he(st,null,ui(De(e).timeline.animations,ae=>{var we,ce;return se(),he("button",{key:ae,class:at(["tl-animation-option",{on:((we=o.value)==null?void 0:we.animation)===ae}]),onClick:Ue=>c(ae)},[A("span",null,We(ae),1),((ce=o.value)==null?void 0:ce.animation)===ae?(se(),he("i",h4,"✓")):je("",!0)],10,c4)}),128)),A("div",u4,[Te(A("input",{"onUpdate:modelValue":W[8]||(W[8]=ae=>r.value=ae),class:"tl-animation-name",maxlength:"64","aria-label":"动画名称",onKeydown:ha(d,["enter"])},null,544),[[ot,r.value]]),A("button",{title:"重命名当前动画",onClick:d},"重命名")]),a.value?(se(),he("div",d4,We(a.value),1)):je("",!0),A("div",f4,[A("button",{onClick:u},"+ 新增"),A("button",{disabled:De(e).timeline.animations.length<=1,onClick:f},"删除",8,m4)]),De(e).timeline.animations.length<=1?(se(),he("div",p4,"至少需要保留一个动画")):je("",!0)],32)):je("",!0)],512),A("label",g4,[W[17]||(W[17]=ii("Spine 预览动画 ",-1)),A("select",{class:"tl-sel",value:((le=F.value)==null?void 0:le.selectedAnimation)||"",disabled:!F.value,onChange:P},[A("option",y4,We(F.value?"无":"无可用 Spine 动画"),1),(se(!0),he(st,null,ui(((xe=F.value)==null?void 0:xe.animations)||[],ae=>(se(),he("option",{key:ae.name,value:ae.name},We(ae.name)+"("+We(ae.duration.toFixed(2))+"s) ",9,x4))),128))],40,v4)]),A("span",b4,We(I.value),1)]),A("div",{class:"tl-viewport",ref_key:"vpRef",ref:t,onWheel:Ct(Ae,["prevent"]),onPointerdown:ge},[A("div",w4,[(se(!0),he(st,null,ui(O.value,ae=>(se(),he("div",{key:ae.f,class:"tl-tickline",style:Di({left:ae.px+"px"})},[A("span",S4,We(ae.f)+"f",1)],4))),128))]),A("div",{class:"tl-playhead",style:Di({left:D.value+"px"})},null,4),A("div",_4,[(se(!0),he(st,null,ui(De(e).systems,(ae,we)=>(se(),he("div",{key:ae.id,class:"tl-lane"},[W[19]||(W[19]=A("span",{class:"lane-ico"},"●",-1)),A("div",{class:"lane-bar",style:Di({left:T(ae)+"px",width:N(ae)+"px"}),onPointerdown:Ct(ce=>Ee(ce,ae),["stop"])},[A("span",M4,We(ae.config.name||"系统 "+(we+1)),1),A("span",{class:at(["bar-life",{"loop-life":H(ae)}]),style:Di({width:G(ae)+"px"})},null,6),H(ae)?(se(),he(st,{key:0},[ne(ae)?(se(),he("span",{key:0,class:"bar-loop-transition bar-loop-start",style:Di({width:ne(ae)+"px"})},null,4)):je("",!0),A("span",{class:"bar-emission bar-loop",style:Di({left:ne(ae)+"px",width:Y(ae)+"px"})},[A("span",{class:"bar-handle",title:"拖动循环段时长",onPointerdown:Ct(ce=>j(ce,ae),["stop"])},null,40,E4)],4),Z(ae)?(se(),he("span",{key:1,class:"bar-loop-transition bar-loop-end",style:Di({left:ne(ae)+Y(ae)+"px",width:Z(ae)+"px"})},null,4)):je("",!0)],64)):ae.config.mode==="stream"?(se(),he("span",{key:1,class:"bar-emission",style:Di({width:Y(ae)+"px"})},[A("span",{class:"bar-handle",title:"拖动持续发射时长",onPointerdown:Ct(ce=>j(ce,ae),["stop"])},null,40,A4)],4)):je("",!0)],44,T4)]))),128)),(se(!0),he(st,null,ui(R.value,ae=>(se(),he("div",{key:`spine-${ae.id}`,class:"tl-lane spine-lane"},[W[20]||(W[20]=A("span",{class:"lane-ico spine-ico"},"◆",-1)),A("div",{class:"spine-bar",style:Di({left:me(ae)+"px",width:_e(ae)+"px"}),title:"拖动调整动画开始时间",onPointerdown:Ct(we=>K(we,ae),["stop"])},[A("span",I4,We(ae.name)+" · "+We(ae.selectedAnimation),1)],44,C4)]))),128)),!De(e).systems.length&&!R.value.length?(se(),he("div",R4,"暂无可显示的动画数据")):je("",!0)])],544)])}}}),k4=In(P4,[["__scopeId","data-v-8d9981a9"]]),F4={class:"right"},O4={class:"stage-area"},B4=En({__name:"App",setup(n){const e=Fl();tI(e);const t=lt(360),i=lt(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)=>(se(),he("div",{class:at(["layout",{"panel-right":De(e).settings.parameterPanelOnRight}])},[A("div",{class:"parameter-panel",style:Di({width:t.value+"px"})},[He(JN)],4),A("div",{class:"resizer-col",onPointerdown:s},null,32),A("div",F4,[A("div",O4,[He(PP)]),A("div",{class:"resizer-row",onPointerdown:r,title:"拖动调整时间轴高度"},null,32),A("div",{class:"timeline-area",style:Di({height:i.value+"px"})},[He(k4)],4)])],2))}}),L4=In(B4,[["__scopeId","data-v-8eacccdc"]]);dT(L4).use(pT()).mount("#app");export{Bv as $,xn as A,Mh as B,Yt as C,Vi as D,$e as E,is as F,Mn as G,vt as H,Dt as I,Fw as J,ls as K,xs as L,Cs as M,Br as N,au as O,yn as P,xl as Q,go as R,Us as S,QF as T,rt as U,Iv as V,Vs as W,uU as X,K3 as Y,Tl as Z,tp as _,ht as a,lm as a$,Ov as a0,dw as a1,up as a2,cU as a3,wh as a4,al as a5,c3 as a6,ol as a7,ou as a8,nm as a9,gm as aA,vm as aB,bc as aC,br as aD,Bc as aE,rm as aF,gw as aG,ci as aH,cw as aI,tU as aJ,lo as aK,Fv as aL,Xe as aM,tt as aN,om as aO,Lc as aP,bw as aQ,am as aR,yw as aS,xw as aT,lu as aU,_w as aV,Dc as aW,Ew as aX,ww as aY,Tw as aZ,Aw as a_,Ma as aa,dp as ab,fp as ac,Pv as ad,Ll as ae,Dl as af,Bl as ag,Ta as ah,qn as ai,sU as aj,pw as ak,l3 as al,yo as am,Fr as an,gp as ao,kw as ap,a3 as aq,_l as ar,os as as,kv as at,aU as au,Mo as av,pm as aw,ym as ax,xm as ay,bm as az,mo as b,or as b$,Th as b0,Sw as b1,Nr as b2,Mw as b3,mp as b4,JF as b5,Rw as b6,Pw as b7,pp as b8,_n as b9,Cw as bA,vp as bB,ru as bC,Ow as bD,cm as bE,Ci as bF,KF as bG,t3 as bH,Jb as bI,Zb as bJ,nU as bK,Jt as bL,Eo as bM,Bw as bN,Nw as bO,Uw as bP,Xw as bQ,Lw as bR,Dw as bS,r3 as bT,yp as bU,Ut as bV,mm as bW,vw as bX,ew as bY,tw as bZ,iw as b_,ZF as ba,iU as bb,pt as bc,mw as bd,fw as be,hw as bf,uw as bg,pa as bh,Sh as bi,o3 as bj,sw as bk,nw as bl,es as bm,rw as bn,vo as bo,Ui as bp,Qb as bq,_h as br,aw as bs,ow as bt,lw as bu,Lv as bv,dm as bw,sa as bx,Iw as by,um as bz,po as c,rU as c0,s3 as c1,n3 as c2,i3 as c3,ct as d,et as e,oU as f,mt as g,Fi as h,ih as i,hs as j,si as k,Qe as l,js as m,ri as n,zm as o,pi as p,bl as q,vr as r,ze as s,Mx as t,ep as u,oh as v,hm as w,ta as x,Rv as y,fm as z};
|