1240 lines
1.2 MiB
Plaintext
1240 lines
1.2 MiB
Plaintext
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-8-FN8Glu.js","assets/index-CT90mgj8.js"])))=>i.map(i=>d[i]);
|
||
var oM=Object.defineProperty;var aM=(s,e,t)=>e in s?oM(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var M=(s,e,t)=>aM(s,typeof e!="symbol"?e+"":e,t);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const n of document.querySelectorAll('link[rel="modulepreload"]'))i(n);new MutationObserver(n=>{for(const r of n)if(r.type==="childList")for(const o of r.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&i(o)}).observe(document,{childList:!0,subtree:!0});function t(n){const r={};return n.integrity&&(r.integrity=n.integrity),n.referrerPolicy&&(r.referrerPolicy=n.referrerPolicy),n.crossOrigin==="use-credentials"?r.credentials="include":n.crossOrigin==="anonymous"?r.credentials="omit":r.credentials="same-origin",r}function i(n){if(n.ep)return;n.ep=!0;const r=t(n);fetch(n.href,r)}})();/**
|
||
* @vue/shared v3.5.41
|
||
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
||
* @license MIT
|
||
**/function qm(s){const e=Object.create(null);for(const t of s.split(","))e[t]=1;return t=>t in e}const Lt={},Ho=[],cn=()=>{},Py=()=>!1,Xh=s=>s.charCodeAt(0)===111&&s.charCodeAt(1)===110&&(s.charCodeAt(2)>122||s.charCodeAt(2)<97),Vh=s=>s.startsWith("onUpdate:"),pi=Object.assign,Km=(s,e)=>{const t=s.indexOf(e);t>-1&&s.splice(t,1)},lM=Object.prototype.hasOwnProperty,Rt=(s,e)=>lM.call(s,e),ze=Array.isArray,Wo=s=>Cl(s)==="[object Map]",pa=s=>Cl(s)==="[object Set]",Gp=s=>Cl(s)==="[object Date]",at=s=>typeof s=="function",Gt=s=>typeof s=="string",rs=s=>typeof s=="symbol",Pt=s=>s!==null&&typeof s=="object",ky=s=>(Pt(s)||at(s))&&at(s.then)&&at(s.catch),Fy=Object.prototype.toString,Cl=s=>Fy.call(s),cM=s=>Cl(s).slice(8,-1),Oy=s=>Cl(s)==="[object Object]",Yh=s=>Gt(s)&&s!=="NaN"&&s[0]!=="-"&&""+parseInt(s,10)===s,za=qm(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),Gh=s=>{const e=Object.create(null);return(t=>e[t]||(e[t]=s(t)))},hM=/-\w/g,ks=Gh(s=>s.replace(hM,e=>e.slice(1).toUpperCase())),uM=/\B([A-Z])/g,Ir=Gh(s=>s.replace(uM,"-$1").toLowerCase()),Ly=Gh(s=>s.charAt(0).toUpperCase()+s.slice(1)),Cu=Gh(s=>s?`on${Ly(s)}`:""),sn=(s,e)=>!Object.is(s,e),Ec=(s,...e)=>{for(let t=0;t<s.length;t++)s[t](...e)},By=(s,e,t,i=!1)=>{Object.defineProperty(s,e,{configurable:!0,enumerable:!1,writable:i,value:t})},jh=s=>{const e=parseFloat(s);return isNaN(e)?s:e},dM=s=>{const e=Gt(s)?Number(s):NaN;return isNaN(e)?s:e};let jp;const Hh=()=>jp||(jp=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function Ot(s){if(ze(s)){const e={};for(let t=0;t<s.length;t++){const i=s[t],n=Gt(i)?gM(i):Ot(i);if(n)for(const r in n)e[r]=n[r]}return e}else if(Gt(s)||Pt(s))return s}const fM=/;(?![^(]*\))/g,mM=/:([^]+)/,pM=/\/\*[^]*?\*\//g;function gM(s){const e={};return s.replace(pM,"").split(fM).forEach(t=>{if(t){const i=t.split(mM);i.length>1&&(e[i[0].trim()]=i[1].trim())}}),e}function Ce(s){let e="";if(Gt(s))e=s;else if(ze(s))for(let t=0;t<s.length;t++){const i=Ce(s[t]);i&&(e+=i+" ")}else if(Pt(s))for(const t in s)s[t]&&(e+=t+" ");return e.trim()}const vM="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",yM=qm(vM);function Ny(s){return!!s||s===""}function xM(s,e){if(s.length!==e.length)return!1;let t=!0;for(let i=0;t&&i<s.length;i++)t=ga(s[i],e[i]);return t}function ga(s,e){if(s===e)return!0;let t=Gp(s),i=Gp(e);if(t||i)return t&&i?s.getTime()===e.getTime():!1;if(t=rs(s),i=rs(e),t||i)return s===e;if(t=ze(s),i=ze(e),t||i)return t&&i?xM(s,e):!1;if(t=Pt(s),i=Pt(e),t||i){if(!t||!i)return!1;const n=Object.keys(s).length,r=Object.keys(e).length;if(n!==r)return!1;for(const o in s){const a=s.hasOwnProperty(o),c=e.hasOwnProperty(o);if(a&&!c||!a&&c||!ga(s[o],e[o]))return!1}}return String(s)===String(e)}function Zm(s,e){return s.findIndex(t=>ga(t,e))}const Dy=s=>!!(s&&s.__v_isRef===!0),ve=s=>Gt(s)?s:s==null?"":ze(s)||Pt(s)&&(s.toString===Fy||!at(s.toString))?Dy(s)?ve(s.value):JSON.stringify(s,Uy,2):String(s),Uy=(s,e)=>Dy(e)?Uy(s,e.value):Wo(e)?{[`Map(${e.size})`]:[...e.entries()].reduce((t,[i,n],r)=>(t[Eu(i,r)+" =>"]=n,t),{})}:pa(e)?{[`Set(${e.size})`]:[...e.values()].map(t=>Eu(t))}:rs(e)?Eu(e):Pt(e)&&!ze(e)&&!Oy(e)?String(e):e,Eu=(s,e="")=>{var t;return rs(s)?`Symbol(${(t=s.description)!=null?t:e})`:s};/**
|
||
* @vue/reactivity v3.5.41
|
||
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
||
* @license MIT
|
||
**/let di;class $y{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&&di&&(di.active?(this.parent=di,this.index=(di.scopes||(di.scopes=[])).push(this)-1):(this._active=!1,this._warnOnRun=!1))}get active(){return this._active}pause(){if(this._active){this._isPaused=!0;let e,t;if(this.scopes){const i=this.scopes.slice();for(e=0,t=i.length;e<t;e++)i[e].pause()}for(e=0,t=this.effects.length;e<t;e++)this.effects[e].pause()}}resume(){if(this._active&&this._isPaused){this._isPaused=!1;let e,t;if(this.scopes){const n=this.scopes.slice();for(e=0,t=n.length;e<t;e++)n[e].resume()}const i=this.effects.slice();for(e=0,t=i.length;e<t;e++)i[e].resume()}}run(e){if(this._active){const t=di;try{return di=this,e()}finally{di=t}}}on(){++this._on===1&&(this.prevScope=di,di=this)}off(){if(this._on>0&&--this._on===0){if(di===this)di=this.prevScope;else{let e=di;for(;e;){if(e.prevScope===this){e.prevScope=this.prevScope;break}e=e.prevScope}}this.prevScope=void 0}}stop(e){if(this._active){this._active=!1;let t,i;for(t=0,i=this.effects.length;t<i;t++)this.effects[t].stop();for(this.effects.length=0,t=0,i=this.cleanups.length;t<i;t++)this.cleanups[t]();if(this.cleanups.length=0,this.scopes){const n=this.scopes.slice();for(t=0,i=n.length;t<i;t++)n[t].stop(!0);this.scopes.length=0}if(!this.detached&&this.parent&&!e){const n=this.parent.scopes.pop();n&&n!==this&&(this.parent.scopes[this.index]=n,n.index=this.index)}this.parent=void 0}}}function Xy(s){return new $y(s)}function Vy(){return di}function bM(s,e=!1){di&&di.cleanups.push(s)}let Ut;const Au=new WeakSet;class Yy{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,di&&(di.active?di.effects.push(this):this.flags&=-2)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,Au.has(this)&&(Au.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||jy(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,Hp(this),Hy(this);const e=Ut,t=Fs;Ut=this,Fs=!0;try{return this.fn()}finally{Wy(this),Ut=e,Fs=t,this.flags&=-3}}stop(){if(this.flags&1){for(let e=this.deps;e;e=e.nextDep)ep(e);this.deps=this.depsTail=void 0,Hp(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?Au.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){Sf(this)&&this.run()}get dirty(){return Sf(this)}}let Gy=0,qa,Ka;function jy(s,e=!1){if(s.flags|=8,e){s.next=Ka,Ka=s;return}s.next=qa,qa=s}function Jm(){Gy++}function Qm(){if(--Gy>0)return;if(Ka){let e=Ka;for(Ka=void 0;e;){const t=e.next;e.next=void 0,e.flags&=-9,e=t}}let s;for(;qa;){let e=qa;for(qa=void 0;e;){const t=e.next;if(e.next=void 0,e.flags&=-9,e.flags&1)try{e.trigger()}catch(i){s||(s=i)}e=t}}if(s)throw s}function Hy(s){for(let e=s.deps;e;e=e.nextDep)e.version=-1,e.prevActiveLink=e.dep.activeLink,e.dep.activeLink=e}function Wy(s){let e,t=s.depsTail,i=t;for(;i;){const n=i.prevDep;i.version===-1?(i===t&&(t=n),ep(i),wM(i)):e=i,i.dep.activeLink=i.prevActiveLink,i.prevActiveLink=void 0,i=n}s.deps=e,s.depsTail=t}function Sf(s){for(let e=s.deps;e;e=e.nextDep)if(e.dep.version!==e.version||e.dep.computed&&(zy(e.dep.computed)||e.dep.version!==e.version))return!0;return!!s._dirty}function zy(s){if(s.flags&4&&!(s.flags&16)||(s.flags&=-17,s.globalVersion===ll)||(s.globalVersion=ll,!s.isSSR&&s.flags&128&&(!s.deps&&!s._dirty||!Sf(s))))return;s.flags|=2;const e=s.dep,t=Ut,i=Fs;Ut=s,Fs=!0;try{Hy(s);const n=s.fn(s._value);(e.version===0||sn(n,s._value))&&(s.flags|=128,s._value=n,e.version++)}catch(n){throw e.version++,n}finally{Ut=t,Fs=i,Wy(s),s.flags&=-3}}function ep(s,e=!1){const{dep:t,prevSub:i,nextSub:n}=s;if(i&&(i.nextSub=n,s.prevSub=void 0),n&&(n.prevSub=i,s.nextSub=void 0),t.subs===s&&(t.subs=i,!i&&t.computed)){t.computed.flags&=-5;for(let r=t.computed.deps;r;r=r.nextDep)ep(r,!0)}!e&&!--t.sc&&t.map&&t.map.delete(t.key)}function wM(s){const{prevDep:e,nextDep:t}=s;e&&(e.nextDep=t,s.prevDep=void 0),t&&(t.prevDep=e,s.nextDep=void 0)}let Fs=!0;const qy=[];function Yn(){qy.push(Fs),Fs=!1}function Gn(){const s=qy.pop();Fs=s===void 0?!0:s}function Hp(s){const{cleanup:e}=s;if(s.cleanup=void 0,e){const t=Ut;Ut=void 0;try{e()}finally{Ut=t}}}let ll=0;class SM{constructor(e,t){this.sub=e,this.dep=t,this.version=t.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}}class tp{constructor(e){this.computed=e,this.version=0,this.activeLink=void 0,this.subs=void 0,this.map=void 0,this.key=void 0,this.sc=0,this.__v_skip=!0}track(e){if(!Ut||!Fs||Ut===this.computed)return;let t=this.activeLink;if(t===void 0||t.sub!==Ut)t=this.activeLink=new SM(Ut,this),Ut.deps?(t.prevDep=Ut.depsTail,Ut.depsTail.nextDep=t,Ut.depsTail=t):Ut.deps=Ut.depsTail=t,Ky(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=Ut.depsTail,t.nextDep=void 0,Ut.depsTail.nextDep=t,Ut.depsTail=t,Ut.deps===t&&(Ut.deps=i)}return t}trigger(e){this.version++,ll++,this.notify(e)}notify(e){Jm();try{for(let t=this.subs;t;t=t.prevSub)t.sub.notify()&&t.sub.dep.notify()}finally{Qm()}}}function Ky(s){if(s.dep.sc++,s.sub.flags&4){const e=s.dep.computed;if(e&&!s.dep.subs){e.flags|=20;for(let i=e.deps;i;i=i.nextDep)Ky(i)}const t=s.dep.subs;t!==s&&(s.prevSub=t,t&&(t.nextSub=s)),s.dep.subs=s}}const Gc=new WeakMap,so=Symbol(""),Mf=Symbol(""),cl=Symbol("");function Pi(s,e,t){if(Fs&&Ut){let i=Gc.get(s);i||Gc.set(s,i=new Map);let n=i.get(t);n||(i.set(t,n=new tp),n.map=i,n.key=t),n.track()}}function In(s,e,t,i,n,r){const o=Gc.get(s);if(!o){ll++;return}const a=c=>{c&&c.trigger()};if(Jm(),e==="clear")o.forEach(a);else{const c=ze(s),l=c&&Yh(t);if(c&&t==="length"){const h=Number(i);o.forEach((u,d)=>{(d==="length"||d===cl||!rs(d)&&d>=h)&&a(u)})}else switch((t!==void 0||o.has(void 0))&&a(o.get(t)),l&&a(o.get(cl)),e){case"add":c?l&&a(o.get("length")):(a(o.get(so)),Wo(s)&&a(o.get(Mf)));break;case"delete":c||(a(o.get(so)),Wo(s)&&a(o.get(Mf)));break;case"set":Wo(s)&&a(o.get(so));break}}Qm()}function MM(s,e){const t=Gc.get(s);return t&&t.get(e)}function To(s){const e=Tt(s);return e===s?e:(Pi(e,"iterate",cl),ns(s)?e:e.map(Ds))}function Wh(s){return Pi(s=Tt(s),"iterate",cl),s}function Js(s,e){return jn(s)?aa(Un(s)?Ds(e):e):Ds(e)}const TM={__proto__:null,[Symbol.iterator](){return Iu(this,Symbol.iterator,s=>Js(this,s))},concat(...s){return To(this).concat(...s.map(e=>ze(e)?To(e):e))},entries(){return Iu(this,"entries",s=>(s[1]=Js(this,s[1]),s))},every(s,e){return yn(this,"every",s,e,void 0,arguments)},filter(s,e){return yn(this,"filter",s,e,t=>t.map(i=>Js(this,i)),arguments)},find(s,e){return yn(this,"find",s,e,t=>Js(this,t),arguments)},findIndex(s,e){return yn(this,"findIndex",s,e,void 0,arguments)},findLast(s,e){return yn(this,"findLast",s,e,t=>Js(this,t),arguments)},findLastIndex(s,e){return yn(this,"findLastIndex",s,e,void 0,arguments)},forEach(s,e){return yn(this,"forEach",s,e,void 0,arguments)},includes(...s){return Ru(this,"includes",s)},indexOf(...s){return Ru(this,"indexOf",s)},join(s){return To(this).join(s)},lastIndexOf(...s){return Ru(this,"lastIndexOf",s)},map(s,e){return yn(this,"map",s,e,void 0,arguments)},pop(){return Ea(this,"pop")},push(...s){return Ea(this,"push",s)},reduce(s,...e){return Wp(this,"reduce",s,e)},reduceRight(s,...e){return Wp(this,"reduceRight",s,e)},shift(){return Ea(this,"shift")},some(s,e){return yn(this,"some",s,e,void 0,arguments)},splice(...s){return Ea(this,"splice",s)},toReversed(){return To(this).toReversed()},toSorted(s){return To(this).toSorted(s)},toSpliced(...s){return To(this).toSpliced(...s)},unshift(...s){return Ea(this,"unshift",s)},values(){return Iu(this,"values",s=>Js(this,s))}};function Iu(s,e,t){const i=Wh(s),n=i[e]();return i!==s&&!ns(s)&&(n._next=n.next,n.next=()=>{const r=n._next();return r.done||(r.value=t(r.value)),r}),n}const _M=Array.prototype;function yn(s,e,t,i,n,r){const o=Wh(s),a=o!==s&&!ns(s),c=o[e];if(c!==_M[e]){const u=c.apply(s,r);return a?Ds(u):u}let l=t;o!==s&&(a?l=function(u,d){return t.call(this,Js(s,u),d,s)}:t.length>2&&(l=function(u,d){return t.call(this,u,d,s)}));const h=c.call(o,l,i);return a&&n?n(h):h}function Wp(s,e,t,i){const n=Wh(s),r=n!==s&&!ns(s);let o=t,a=!1;n!==s&&(r?(a=i.length===0,o=function(l,h,u){return a&&(a=!1,l=Js(s,l)),t.call(this,l,Js(s,h),u,s)}):t.length>3&&(o=function(l,h,u){return t.call(this,l,h,u,s)}));const c=n[e](o,...i);return a?Js(s,c):c}function Ru(s,e,t){const i=Tt(s);Pi(i,"iterate",cl);const n=i[e](...t);return(n===-1||n===!1)&&zh(t[0])?(t[0]=Tt(t[0]),i[e](...t)):n}function Ea(s,e,t=[]){Yn(),Jm();const i=Tt(s)[e].apply(s,t);return Qm(),Gn(),i}const CM=qm("__proto__,__v_isRef,__isVue"),Zy=new Set(Object.getOwnPropertyNames(Symbol).filter(s=>s!=="arguments"&&s!=="caller").map(s=>Symbol[s]).filter(rs));function EM(s){rs(s)||(s=String(s));const e=Tt(this);return Pi(e,"has",s),e.hasOwnProperty(s)}class Jy{constructor(e=!1,t=!1){this._isReadonly=e,this._isShallow=t}get(e,t,i){if(t==="__v_skip")return e.__v_skip;const n=this._isReadonly,r=this._isShallow;if(t==="__v_isReactive")return!n;if(t==="__v_isReadonly")return n;if(t==="__v_isShallow")return r;if(t==="__v_raw")return i===(n?r?NM:ix:r?tx:ex).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(i)?e:void 0;const o=ze(e);if(!n){let c;if(o&&(c=TM[t]))return c;if(t==="hasOwnProperty")return EM}const a=Reflect.get(e,t,jt(e)?e:i);if((rs(t)?Zy.has(t):CM(t))||(n||Pi(e,"get",t),r))return a;if(jt(a)){const c=o&&Yh(t)?a:a.value;return n&&Pt(c)?_f(c):c}return Pt(a)?n?_f(a):po(a):a}}class Qy extends Jy{constructor(e=!1){super(!1,e)}set(e,t,i,n){let r=e[t];const o=ze(e)&&Yh(t);if(!this._isShallow){const l=jn(r);if(!ns(i)&&!jn(i)&&(r=Tt(r),i=Tt(i)),!o&&jt(r)&&!jt(i))return l||(r.value=i),!0}const a=o?Number(t)<e.length:Rt(e,t),c=Reflect.set(e,t,i,jt(e)?e:n);return e===Tt(n)&&c&&(a?sn(i,r)&&In(e,"set",t,i):In(e,"add",t,i)),c}deleteProperty(e,t){const i=Rt(e,t);e[t];const n=Reflect.deleteProperty(e,t);return n&&i&&In(e,"delete",t,void 0),n}has(e,t){const i=Reflect.has(e,t);return(!rs(t)||!Zy.has(t))&&Pi(e,"has",t),i}ownKeys(e){return Pi(e,"iterate",ze(e)?"length":so),Reflect.ownKeys(e)}}class AM extends Jy{constructor(e=!1){super(!0,e)}set(e,t){return!0}deleteProperty(e,t){return!0}}const IM=new Qy,RM=new AM,PM=new Qy(!0);const Tf=s=>s,Vl=s=>Reflect.getPrototypeOf(s);function kM(s,e,t){return function(...i){const n=this.__v_raw,r=Tt(n),o=Wo(r),a=s==="entries"||s===Symbol.iterator&&o,c=s==="keys"&&o,l=n[s](...i),h=t?Tf:e?aa:Ds;return!e&&Pi(r,"iterate",c?Mf:so),pi(Object.create(l),{next(){const{value:u,done:d}=l.next();return d?{value:u,done:d}:{value:a?[h(u[0]),h(u[1])]:h(u),done:d}}})}}function Yl(s){return function(...e){return s==="delete"?!1:s==="clear"?void 0:this}}function FM(s,e){const t={get(n){const r=this.__v_raw,o=Tt(r),a=Tt(n);s||(sn(n,a)&&Pi(o,"get",n),Pi(o,"get",a));const{has:c}=Vl(o),l=e?Tf:s?aa:Ds;if(c.call(o,n))return l(r.get(n));if(c.call(o,a))return l(r.get(a));r!==o&&r.get(n)},get size(){const n=this.__v_raw;return!s&&Pi(Tt(n),"iterate",so),n.size},has(n){const r=this.__v_raw,o=Tt(r),a=Tt(n);return s||(sn(n,a)&&Pi(o,"has",n),Pi(o,"has",a)),n===a?r.has(n):r.has(n)||r.has(a)},forEach(n,r){const o=this,a=o.__v_raw,c=Tt(a),l=e?Tf:s?aa:Ds;return!s&&Pi(c,"iterate",so),a.forEach((h,u)=>n.call(r,l(h),l(u),o))}};return pi(t,s?{add:Yl("add"),set:Yl("set"),delete:Yl("delete"),clear:Yl("clear")}:{add(n){const r=Tt(this),o=Vl(r),a=Tt(n),c=!e&&!ns(n)&&!jn(n)?a:n;return o.has.call(r,c)||sn(n,c)&&o.has.call(r,n)||sn(a,c)&&o.has.call(r,a)||(r.add(c),In(r,"add",c,c)),this},set(n,r){!e&&!ns(r)&&!jn(r)&&(r=Tt(r));const o=Tt(this),{has:a,get:c}=Vl(o);let l=a.call(o,n);l||(n=Tt(n),l=a.call(o,n));const h=c.call(o,n);return o.set(n,r),l?sn(r,h)&&In(o,"set",n,r):In(o,"add",n,r),this},delete(n){const r=Tt(this),{has:o,get:a}=Vl(r);let c=o.call(r,n);c||(n=Tt(n),c=o.call(r,n)),a&&a.call(r,n);const l=r.delete(n);return c&&In(r,"delete",n,void 0),l},clear(){const n=Tt(this),r=n.size!==0,o=n.clear();return r&&In(n,"clear",void 0,void 0),o}}),["keys","values","entries",Symbol.iterator].forEach(n=>{t[n]=kM(n,s,e)}),t}function ip(s,e){const t=FM(s,e);return(i,n,r)=>n==="__v_isReactive"?!s:n==="__v_isReadonly"?s:n==="__v_raw"?i:Reflect.get(Rt(t,n)&&n in i?t:i,n,r)}const OM={get:ip(!1,!1)},LM={get:ip(!1,!0)},BM={get:ip(!0,!1)};const ex=new WeakMap,tx=new WeakMap,ix=new WeakMap,NM=new WeakMap;function DM(s){switch(s){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function po(s){return jn(s)?s:sp(s,!1,IM,OM,ex)}function UM(s){return sp(s,!1,PM,LM,tx)}function _f(s){return sp(s,!0,RM,BM,ix)}function sp(s,e,t,i,n){if(!Pt(s)||s.__v_raw&&!(e&&s.__v_isReactive)||s.__v_skip||!Object.isExtensible(s))return s;const r=n.get(s);if(r)return r;const o=DM(cM(s));if(o===0)return s;const a=new Proxy(s,o===2?i:t);return n.set(s,a),a}function Un(s){return jn(s)?Un(s.__v_raw):!!(s&&s.__v_isReactive)}function jn(s){return!!(s&&s.__v_isReadonly)}function ns(s){return!!(s&&s.__v_isShallow)}function zh(s){return s?!!s.__v_raw:!1}function Tt(s){const e=s&&s.__v_raw;return e?Tt(e):s}function vr(s){return!Rt(s,"__v_skip")&&Object.isExtensible(s)&&By(s,"__v_skip",!0),s}const Ds=s=>Pt(s)?po(s):s,aa=s=>Pt(s)?_f(s):s;function jt(s){return s?s.__v_isRef===!0:!1}function Fe(s){return $M(s,!1)}function $M(s,e){return jt(s)?s:new XM(s,e)}class XM{constructor(e,t){this.dep=new tp,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=t?e:Tt(e),this._value=t?e:Ds(e),this.__v_isShallow=t}get value(){return this.dep.track(),this._value}set value(e){const t=this._rawValue,i=this.__v_isShallow||ns(e)||jn(e);e=i?e:Tt(e),sn(e,t)&&(this._rawValue=e,this._value=i?e:Ds(e),this.dep.trigger())}}function I(s){return jt(s)?s.value:s}const VM={get:(s,e,t)=>e==="__v_raw"?s:I(Reflect.get(s,e,t)),set:(s,e,t,i)=>{const n=s[e];return jt(n)&&!jt(t)?(n.value=t,!0):Reflect.set(s,e,t,i)}};function sx(s){return Un(s)?s:new Proxy(s,VM)}function YM(s){const e=ze(s)?new Array(s.length):{};for(const t in s)e[t]=jM(s,t);return e}class GM{constructor(e,t,i){this._object=e,this._defaultValue=i,this.__v_isRef=!0,this._value=void 0,this._key=rs(t)?t:String(t),this._raw=Tt(e);let n=!0,r=e;if(!ze(e)||rs(this._key)||!Yh(this._key))do n=!zh(r)||ns(r);while(n&&(r=r.__v_raw));this._shallow=n}get value(){let e=this._object[this._key];return this._shallow&&(e=I(e)),this._value=e===void 0?this._defaultValue:e}set value(e){if(this._shallow&&jt(this._raw[this._key])){const t=this._object[this._key];if(jt(t)){t.value=e;return}}this._object[this._key]=e}get dep(){return MM(this._raw,this._key)}}function jM(s,e,t){return new GM(s,e,t)}class HM{constructor(e,t,i){this.fn=e,this.setter=t,this._value=void 0,this.dep=new tp(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=ll-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!t,this.isSSR=i}notify(){if(this.flags|=16,!(this.flags&8)&&Ut!==this)return jy(this,!0),!0}get value(){const e=this.dep.track();return zy(this),e&&(e.version=this.dep.version),this._value}set value(e){this.setter&&this.setter(e)}}function WM(s,e,t=!1){let i,n;return at(s)?i=s:(i=s.get,n=s.set),new HM(i,n,t)}const Gl={},jc=new WeakMap;let Xr;function zM(s,e=!1,t=Xr){if(t){let i=jc.get(t);i||jc.set(t,i=[]),i.push(s)}}function qM(s,e,t=Lt){const{immediate:i,deep:n,once:r,scheduler:o,augmentJob:a,call:c}=t,l=S=>n?S:ns(S)||n===!1||n===0?Rn(S,1):Rn(S);let h,u,d,f,m=!1,p=!1;if(jt(s)?(u=()=>s.value,m=ns(s)):Un(s)?(u=()=>l(s),m=!0):ze(s)?(p=!0,m=s.some(S=>Un(S)||ns(S)),u=()=>s.map(S=>{if(jt(S))return S.value;if(Un(S))return l(S);if(at(S))return c?c(S,2):S()})):at(s)?e?u=c?()=>c(s,2):s:u=()=>{if(d){Yn();try{d()}finally{Gn()}}const S=Xr;Xr=h;try{return c?c(s,3,[f]):s(f)}finally{Xr=S}}:u=cn,e&&n){const S=u,C=n===!0?1/0:n;u=()=>Rn(S(),C)}const g=Vy(),x=()=>{h.stop(),g&&g.active&&Km(g.effects,h)};if(r&&e){const S=e;e=(...C)=>{const w=S(...C);return x(),w}}let v=p?new Array(s.length).fill(Gl):Gl;const y=S=>{if(!(!(h.flags&1)||!h.dirty&&!S))if(e){const C=h.run();if(S||n||m||(p?C.some((w,b)=>sn(w,v[b])):sn(C,v))){d&&d();const w=Xr;Xr=h;try{const b=[C,v===Gl?void 0:p&&v[0]===Gl?[]:v,f];v=C,c?c(e,3,b):e(...b)}finally{Xr=w}}}else h.run()};return a&&a(y),h=new Yy(u),h.scheduler=o?()=>o(y,!1):y,f=S=>zM(S,!1,h),d=h.onStop=()=>{const S=jc.get(h);if(S){if(c)c(S,4);else for(const C of S)C();jc.delete(h)}},e?i?y(!0):v=h.run():o?o(y.bind(null,!0),!0):h.run(),x.pause=h.pause.bind(h),x.resume=h.resume.bind(h),x.stop=x,x}function Rn(s,e=1/0,t){if(e<=0||!Pt(s)||s.__v_skip||(t=t||new Map,(t.get(s)||0)>=e))return s;if(t.set(s,e),e--,jt(s))Rn(s.value,e,t);else if(ze(s))for(let i=0;i<s.length;i++)Rn(s[i],e,t);else if(pa(s)||Wo(s))s.forEach(i=>{Rn(i,e,t)});else if(Oy(s)){for(const i in s)Rn(s[i],e,t);for(const i of Object.getOwnPropertySymbols(s))Object.prototype.propertyIsEnumerable.call(s,i)&&Rn(s[i],e,t)}return s}/**
|
||
* @vue/runtime-core v3.5.41
|
||
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
||
* @license MIT
|
||
**/function El(s,e,t,i){try{return i?s(...i):s()}catch(n){qh(n,e,t)}}function gs(s,e,t,i){if(at(s)){const n=El(s,e,t,i);return n&&ky(n)&&n.catch(r=>{qh(r,e,t)}),n}if(ze(s)){const n=[];for(let r=0;r<s.length;r++)n.push(gs(s[r],e,t,i));return n}}function qh(s,e,t,i=!0){const n=e?e.vnode:null,{errorHandler:r,throwUnhandledErrorInProduction:o}=e&&e.appContext.config||Lt;if(e){let a=e.parent;const c=e.proxy,l=`https://vuejs.org/error-reference/#runtime-${t}`;for(;a;){const h=a.ec;if(h){for(let u=0;u<h.length;u++)if(h[u](s,c,l)===!1)return}a=a.parent}if(r){Yn(),El(r,null,10,[s,c,l]),Gn();return}}KM(s,t,n,i,o)}function KM(s,e,t,i=!0,n=!1){if(n)throw s;console.error(s)}const Ui=[];let Ws=-1;const zo=[];let lr=null,Oo=0;const nx=Promise.resolve();let Hc=null;function Kh(s){const e=Hc||nx;return s?e.then(this?s.bind(this):s):e}function ZM(s){let e=Ws+1,t=Ui.length;for(;e<t;){const i=e+t>>>1,n=Ui[i],r=hl(n);r<s||r===s&&n.flags&2?e=i+1:t=i}return e}function np(s){if(!(s.flags&1)){const e=hl(s),t=Ui[Ui.length-1];!t||!(s.flags&2)&&e>=hl(t)?Ui.push(s):Ui.splice(ZM(e),0,s),s.flags|=1,rx()}}function rx(){Hc||(Hc=nx.then(ax))}function JM(s){if(!ze(s))lr&&s.id===-1?lr.splice(Oo+1,0,s):s.flags&1||(zo.push(s),s.flags|=1);else for(let e=0;e<s.length;e++)zo.push(s[e]);rx()}function zp(s,e,t=Ws+1){for(;t<Ui.length;t++){const i=Ui[t];if(i&&i.flags&2){if(s&&i.id!==s.uid)continue;Ui.splice(t,1),t--,i.flags&4&&(i.flags&=-2),i(),i.flags&4||(i.flags&=-2)}}}function ox(s){if(zo.length){const e=[...new Set(zo)].sort((t,i)=>hl(t)-hl(i));if(zo.length=0,lr){for(let t=0;t<e.length;t++)lr.push(e[t]);return}for(lr=e,Oo=0;Oo<lr.length;Oo++){const t=lr[Oo];t.flags&4&&(t.flags&=-2),t.flags&8||t(),t.flags&=-2}lr=null,Oo=0}}const hl=s=>s.id==null?s.flags&2?-1:1/0:s.id;function ax(s){try{for(Ws=0;Ws<Ui.length;Ws++){const e=Ui[Ws];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(;Ws<Ui.length;Ws++){const e=Ui[Ws];e&&(e.flags&=-2)}Ws=-1,Ui.length=0,ox(),Hc=null,(Ui.length||zo.length)&&ax()}}let Oi=null,lx=null;function Wc(s){const e=Oi;return Oi=s,lx=s&&s.type.__scopeId||null,e}function Zh(s,e=Oi,t){if(!e||s._n)return s;const i=(...n)=>{i._d&&Zc(-1);const r=Wc(e),o=$n.length;let a;try{a=s(...n)}finally{for(let c=$n.length;c>o;c--)cp();Wc(r),i._d&&Zc(1)}return a};return i._n=!0,i._c=!0,i._d=!0,i}function ce(s,e){if(Oi===null)return s;const t=su(Oi),i=s.dirs||(s.dirs=[]);for(let n=0;n<e.length;n++){let[r,o,a,c=Lt]=e[n];r&&(at(r)&&(r={mounted:r,updated:r}),r.deep&&Rn(o),i.push({dir:r,instance:t,value:o,oldValue:void 0,arg:a,modifiers:c}))}return s}function Or(s,e,t,i){const n=s.dirs,r=e&&e.dirs;for(let o=0;o<n.length;o++){const a=n[o];r&&(a.oldValue=r[o].value);let c=a.dir[i];c&&(Yn(),gs(c,t,8,[s.el,a,s,e]),Gn())}}function cx(s,e){if($i){let t=$i.provides;const i=$i.parent&&$i.parent.provides;i===t&&(t=$i.provides=Object.create(i)),t[s]=e}}function qo(s,e,t=!1){const i=hp();if(i||no){let n=no?no._context.provides:i?i.parent==null||i.ce?i.vnode.appContext&&i.vnode.appContext.provides:i.parent.provides:void 0;if(n&&s in n)return n[s];if(arguments.length>1)return t&&at(e)?e.call(i&&i.proxy):e}}function QM(){return!!(hp()||no)}const eT=Symbol.for("v-scx"),tT=()=>qo(eT);function Lo(s,e){return rp(s,null,e)}function ai(s,e,t){return rp(s,e,t)}function rp(s,e,t=Lt){const{immediate:i,deep:n,flush:r,once:o}=t,a=pi({},t),c=e&&i||!e&&r!=="post";let l;if(pl){if(r==="sync"){const f=tT();l=f.__watcherHandles||(f.__watcherHandles=[])}else if(!c){const f=()=>{};return f.stop=cn,f.resume=cn,f.pause=cn,f}}const h=$i;a.call=(f,m,p)=>gs(f,h,m,p);let u=!1;r==="post"?a.scheduler=f=>{Bi(f,h&&h.suspense)}:r!=="sync"&&(u=!0,a.scheduler=(f,m)=>{m?f():np(f)}),a.augmentJob=f=>{e&&(f.flags|=4),u&&(f.flags|=2,h&&(f.id=h.uid,f.i=h))};const d=qM(s,e,a);return pl&&(l?l.push(d):c&&d()),d}function iT(s,e,t){const i=this.proxy,n=Gt(s)?s.includes(".")?hx(i,s):()=>i[s]:s.bind(i,i);let r;at(e)?r=e:(r=e.handler,t=e);const o=Il(this),a=rp(n,r.bind(i),t);return o(),a}function hx(s,e){const t=e.split(".");return()=>{let i=s;for(let n=0;n<t.length&&i;n++)i=i[t[n]];return i}}const sr=new WeakMap,ux=Symbol("_vte"),Jh=s=>s.__isTeleport,Wr=s=>s&&(s.disabled||s.disabled===""),sT=s=>s&&(s.defer||s.defer===""),qp=s=>typeof SVGElement<"u"&&s instanceof SVGElement,Kp=s=>typeof MathMLElement=="function"&&s instanceof MathMLElement,Cf=(s,e)=>{const t=s&&s.to;return Gt(t)?e?e(t):null:t},nT={name:"Teleport",__isTeleport:!0,process(s,e,t,i,n,r,o,a,c,l){const{mc:h,pc:u,pbc:d,o:{insert:f,querySelector:m,createText:p,createComment:g,parentNode:x}}=l,v=Wr(e.props);let{dynamicChildren:y}=e;const S=(b,_,A)=>{b.shapeFlag&16&&h(b.children,_,A,n,r,o,a,c)},C=(b=e)=>{const _=Wr(b.props),A=b.target=Cf(b.props,m),P=Ef(A,b,p,f);A&&(o!=="svg"&&qp(A)?o="svg":o!=="mathml"&&Kp(A)&&(o="mathml"),n&&n.isCE&&(n.ce._teleportTargets||(n.ce._teleportTargets=new Set)).add(A),_||(S(b,A,P),Na(b,!1)))},w=b=>{const _=()=>{if(sr.get(b)===_){if(sr.delete(b),Wr(b.props)){const A=x(b.el)||t;S(b,A,b.anchor),Na(b,!0)}C(b)}};sr.set(b,_),Bi(_,r)};if(s==null){const b=e.el=p(""),_=e.anchor=p("");if(f(b,t,i),f(_,t,i),sT(e.props)||r&&r.pendingBranch){w(e);return}v&&(S(e,t,_),Na(e,!0)),C()}else{e.el=s.el;const b=e.anchor=s.anchor,_=sr.get(s);if(_){_.flags|=8,sr.delete(s),w(e);return}e.targetStart=s.targetStart;const A=e.target=s.target,P=e.targetAnchor=s.targetAnchor,E=Wr(s.props),R=E?t:A,O=E?b:P;if(o==="svg"||qp(A)?o="svg":(o==="mathml"||Kp(A))&&(o="mathml"),y?(d(s.dynamicChildren,y,R,n,r,o,a),lp(s,e,!0)):c||u(s,e,R,O,n,r,o,a,!1),v)E?e.props&&s.props&&e.props.to!==s.props.to&&(e.props.to=s.props.to):jl(e,t,b,l,1);else if((e.props&&e.props.to)!==(s.props&&s.props.to)){const U=Cf(e.props,m);U&&(e.target=U,jl(e,U,null,l,0))}else E&&jl(e,A,P,l,1);Na(e,v)}},remove(s,e,t,{um:i,o:{remove:n}},r){const{shapeFlag:o,children:a,anchor:c,targetStart:l,targetAnchor:h,target:u,props:d}=s,f=Wr(d),m=r||!f,p=sr.get(s);if(p&&(p.flags|=8,sr.delete(s)),u&&(n(l),n(h)),r&&n(c),!p&&(f||u)&&o&16)for(let g=0;g<a.length;g++){const x=a[g];i(x,e,t,m,!!x.dynamicChildren)}},move:jl,hydrate:rT};function jl(s,e,t,{o:{insert:i},m:n},r=2){r===0&&i(s.targetAnchor,e,t);const{el:o,anchor:a,shapeFlag:c,children:l,props:h}=s,u=r===2;if(u&&i(o,e,t),!sr.has(s)&&(!u||Wr(h))&&c&16)for(let d=0;d<l.length;d++)n(l[d],e,t,2);u&&i(a,e,t)}function rT(s,e,t,i,n,r,{o:{nextSibling:o,parentNode:a,querySelector:c,insert:l,createText:h}},u){function d(g,x){let v=x;for(;v;){if(v&&v.nodeType===8){if(v.data==="teleport start anchor")e.targetStart=v;else if(v.data==="teleport anchor"){e.targetAnchor=v,g._lpa=e.targetAnchor&&o(e.targetAnchor);break}}v=o(v)}}function f(g,x){x.anchor=u(o(g),x,a(g),t,i,n,r)}const m=e.target=Cf(e.props,c),p=Wr(e.props);if(m){const g=m._lpa||m.firstChild;e.shapeFlag&16&&(p?(f(s,e),d(m,g),e.targetAnchor||Ef(m,e,h,l,a(s)===m?s:null)):(e.anchor=o(s),d(m,g),e.targetAnchor||Ef(m,e,h,l),u(g&&o(g),e,m,t,i,n,r))),Na(e,p)}else p&&e.shapeFlag&16&&(f(s,e),e.targetStart=s,e.targetAnchor=o(s));return e.anchor&&o(e.anchor)}const dx=nT;function Na(s,e){const t=s.ctx;if(t&&t.ut){let i,n;for(e?(i=s.el,n=s.anchor):(i=s.targetStart,n=s.targetAnchor);i&&i!==n;)i.nodeType===1&&i.setAttribute("data-v-owner",t.uid),i=i.nextSibling;t.ut()}}function Ef(s,e,t,i,n=null){const r=e.targetStart=t(""),o=e.targetAnchor=t("");return r[ux]=o,s&&(i(r,s,n),i(o,s,n)),o}const us=Symbol("_leaveCb"),Aa=Symbol("_enterCb");function oT(){const s={isMounted:!1,isLeaving:!1,isUnmounting:!1,leavingVNodes:new Map};return ys(()=>{s.isMounted=!0}),Rr(()=>{s.isUnmounting=!0}),s}const as=[Function,Array],fx={mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:as,onEnter:as,onAfterEnter:as,onEnterCancelled:as,onBeforeLeave:as,onLeave:as,onAfterLeave:as,onLeaveCancelled:as,onBeforeAppear:as,onAppear:as,onAfterAppear:as,onAppearCancelled:as},mx=s=>{const e=s.subTree;return e.component?mx(e.component):e},aT={name:"BaseTransition",props:fx,setup(s,{slots:e}){const t=hp(),i=oT();return()=>{const n=e.default&&vx(e.default(),!0),r=n&&n.length?px(n):t.subTree?xe():void 0;if(!r)return;const o=Tt(s),{mode:a}=o;if(i.isLeaving)return Pu(r);const c=zc(r);if(!c)return Pu(r);let l=Af(c,o,i,t,u=>l=u);c.type!==Fi&&ul(c,l);let h=t.subTree&&zc(t.subTree);if(h&&h.type!==Fi&&!zr(h,c)&&mx(t).type!==Fi){let u=Af(h,o,i,t);if(ul(h,u),a==="out-in"&&c.type!==Fi)return i.isLeaving=!0,u.afterLeave=()=>{i.isLeaving=!1,t.job.flags&8||t.update(),delete u.afterLeave,h=void 0},Pu(r);a==="in-out"&&c.type!==Fi?u.delayLeave=(d,f,m)=>{const p=gx(i,h);p[String(h.key)]=h,d[us]=()=>{f(),d[us]=void 0,delete l.delayedLeave,h=void 0},l.delayedLeave=()=>{m(),delete l.delayedLeave,h=void 0}}:h=void 0}else h&&(h=void 0);return r}}};function px(s){let e=s[0];if(s.length>1){for(const t of s)if(t.type!==Fi){e=t;break}}return e}const lT=aT;function gx(s,e){const{leavingVNodes:t}=s;let i=t.get(e.type);return i||(i=Object.create(null),t.set(e.type,i)),i}function Af(s,e,t,i,n){const{appear:r,mode:o,persisted:a=!1,onBeforeEnter:c,onEnter:l,onAfterEnter:h,onEnterCancelled:u,onBeforeLeave:d,onLeave:f,onAfterLeave:m,onLeaveCancelled:p,onBeforeAppear:g,onAppear:x,onAfterAppear:v,onAppearCancelled:y}=e,S=String(s.key),C=gx(t,s),w=(A,P)=>{A&&gs(A,i,9,P)},b=(A,P)=>{const E=P[1];w(A,P),ze(A)?A.every(R=>R.length<=1)&&E():A.length<=1&&E()},_={mode:o,persisted:a,beforeEnter(A){let P=c;if(!t.isMounted)if(r)P=g||c;else return;A[us]&&A[us](!0);const E=C[S];E&&zr(s,E)&&E.el[us]&&E.el[us](),w(P,[A])},enter(A){if(C[S]===s)return;let P=l,E=h,R=u;if(!t.isMounted)if(r)P=x||l,E=v||h,R=y||u;else return;let O=!1;A[Aa]=Y=>{O||(O=!0,Y?w(R,[A]):w(E,[A]),_.delayedLeave&&_.delayedLeave(),A[Aa]=void 0)};const U=A[Aa].bind(null,!1);P?b(P,[A,U]):U()},leave(A,P){const E=String(s.key);if(A[Aa]&&A[Aa](!0),t.isUnmounting)return P();w(d,[A]);let R=!1;A[us]=U=>{R||(R=!0,P(),U?w(p,[A]):w(m,[A]),A[us]=void 0,C[E]===s&&delete C[E])};const O=A[us].bind(null,!1);C[E]=s,f?b(f,[A,O]):O()},clone(A){const P=Af(A,e,t,i,n);return n&&n(P),P}};return _}function Pu(s){if(Qh(s))return s=Cr(s),s.children=null,s}function zc(s){if(!Qh(s))return Jh(s.type)&&s.children?px(s.children):s;if(s.component)return s.component.subTree;const{shapeFlag:e,children:t}=s;if(t){if(e&16)return t[0];if(e&32&&at(t.default))return t.default()}}function ul(s,e){if(s.shapeFlag&6&&s.component){s.transition=e;const t=s.component.subTree;ul(Jh(t.type)&&zc(t)||t,e)}else s.shapeFlag&128?(s.ssContent.transition=e.clone(s.ssContent),s.ssFallback.transition=e.clone(s.ssFallback)):s.transition=e}function vx(s,e=!1,t){let i=[],n=0;for(let r=0;r<s.length;r++){let o=s[r];const a=t==null?o.key:String(t)+String(o.key!=null?o.key:r);o.type===_e?(o.patchFlag&128&&n++,i=i.concat(vx(o.children,e,a))):(e||o.type!==Fi)&&i.push(a!=null?Cr(o,{key:a}):o)}if(n>1)for(let r=0;r<i.length;r++)i[r].patchFlag=-2;return i}function Zt(s,e){return at(s)?pi({name:s.name},e,{setup:s}):s}function yx(s){s.ids=[s.ids[0]+s.ids[2]+++"-",0,0]}function Zp(s,e){let t;return!!((t=Object.getOwnPropertyDescriptor(s,e))&&!t.configurable)}const qc=new WeakMap;function Za(s,e,t,i,n=!1){if(ze(s)){s.forEach((p,g)=>Za(p,e&&(ze(e)?e[g]:e),t,i,n));return}if(Ko(i)&&!n){i.shapeFlag&512&&i.type.__asyncResolved&&i.component.subTree.component&&Za(s,e,t,i.component.subTree);return}const r=i.shapeFlag&4?su(i.component):i.el,o=n?null:r,{i:a,r:c}=s,l=e&&e.r,h=a.refs===Lt?a.refs={}:a.refs,u=a.setupState,d=Tt(u),f=u===Lt?Py:p=>Zp(h,p)?!1:Rt(d,p),m=(p,g)=>!(g&&Zp(h,g));if(l!=null&&l!==c){if(Jp(e),Gt(l))h[l]=null,f(l)&&(u[l]=null);else if(jt(l)){const p=e;m(l,p.k)&&(l.value=null),p.k&&(h[p.k]=null)}}if(at(c))El(c,a,12,[o,h]);else{const p=Gt(c),g=jt(c);if(p||g){const x=()=>{if(s.f){const v=p?f(c)?u[c]:h[c]:m()||!s.k?c.value:h[s.k];if(n)ze(v)&&Km(v,r);else if(ze(v))v.includes(r)||v.push(r);else if(p)h[c]=[r],f(c)&&(u[c]=h[c]);else{const y=[r];m(c,s.k)&&(c.value=y),s.k&&(h[s.k]=y)}}else p?(h[c]=o,f(c)&&(u[c]=o)):g&&(m(c,s.k)&&(c.value=o),s.k&&(h[s.k]=o))};if(o){const v=()=>{x(),qc.delete(s)};v.id=-1,qc.set(s,v),Bi(v,t)}else Jp(s),x()}}}function Jp(s){const e=qc.get(s);e&&(e.flags|=8,qc.delete(s))}Hh().requestIdleCallback;Hh().cancelIdleCallback;const Ko=s=>!!s.type.__asyncLoader,Qh=s=>s.type.__isKeepAlive;function cT(s,e){xx(s,"a",e)}function hT(s,e){xx(s,"da",e)}function xx(s,e,t=$i){const i=s.__wdc||(s.__wdc=()=>{let n=t;for(;n;){if(n.isDeactivated)return;n=n.parent}return s()});if(eu(e,i,t),t){let n=t.parent;for(;n&&n.parent;)Qh(n.parent.vnode)&&uT(i,e,t,n),n=n.parent}}function uT(s,e,t,i){const n=eu(e,s,i,!0);Al(()=>{Km(i[e],n)},t)}function eu(s,e,t=$i,i=!1){if(t){const n=t[s]||(t[s]=[]),r=e.__weh||(e.__weh=(...o)=>{Yn();const a=Il(t),c=gs(e,t,s,o);return a(),Gn(),c});return i?n.unshift(r):n.push(r),r}}const Kn=s=>(e,t=$i)=>{(!pl||s==="sp")&&eu(s,(...i)=>e(...i),t)},dT=Kn("bm"),ys=Kn("m"),fT=Kn("bu"),mT=Kn("u"),Rr=Kn("bum"),Al=Kn("um"),pT=Kn("sp"),gT=Kn("rtg"),vT=Kn("rtc");function yT(s,e=$i){eu("ec",s,e)}const xT=Symbol.for("v-ndc");function Et(s,e,t,i){let n;const r=t,o=ze(s);if(o||Gt(s)){const a=o&&Un(s);let c=!1,l=!1;a&&(c=!ns(s),l=jn(s),s=Wh(s)),n=new Array(s.length);for(let h=0,u=s.length;h<u;h++)n[h]=e(c?l?aa(Ds(s[h])):Ds(s[h]):s[h],h,void 0,r)}else if(typeof s=="number"){n=new Array(s);for(let a=0;a<s;a++)n[a]=e(a+1,a,void 0,r)}else if(Pt(s))if(s[Symbol.iterator])n=Array.from(s,(a,c)=>e(a,c,void 0,r));else{const a=Object.keys(s);n=new Array(a.length);for(let c=0,l=a.length;c<l;c++){const h=a[c];n[c]=e(s[h],h,c,r)}}else n=[];return n}function bT(s,e,t,i,n,r){if(t==null&&(t={}),Oi.ce||Oi.parent&&Ko(Oi.parent)&&Oi.parent.ce){const l=t,h=Object.keys(l).length>0;return q(),Ct(_e,null,[we("slot",l,i)],h?-2:64)}let o=s[e];o&&o._c&&(o._d=!1);const a=$n.length;q();let c;try{const l=o&&bx(o(t)),h=t.key||r||l&&l.key;c=Ct(_e,{key:(h&&!rs(h)?h:`_${e}`)+(!l&&i?"_fb":"")},l||(i?i():[]),l&&s._===1?64:-2)}catch(l){for(let h=$n.length;h>a;h--)cp();throw l}finally{o&&o._c&&(o._d=!0)}return c}function bx(s){return s.some(e=>fl(e)?!(e.type===Fi||e.type===_e&&!bx(e.children)):!0)?s:null}const If=s=>s?Ux(s)?su(s):If(s.parent):null,Ja=pi(Object.create(null),{$:s=>s,$el:s=>s.vnode.el,$data:s=>s.data,$props:s=>s.props,$attrs:s=>s.attrs,$slots:s=>s.slots,$refs:s=>s.refs,$parent:s=>If(s.parent),$root:s=>If(s.root),$host:s=>s.ce,$emit:s=>s.emit,$options:s=>Sx(s),$forceUpdate:s=>s.f||(s.f=()=>{np(s.update)}),$nextTick:s=>s.n||(s.n=Kh.bind(s.proxy)),$watch:s=>iT.bind(s)}),ku=(s,e)=>s!==Lt&&!s.__isScriptSetup&&Rt(s,e),wT={get({_:s},e){if(e==="__v_skip")return!0;const{ctx:t,setupState:i,data:n,props:r,accessCache:o,type:a,appContext:c}=s;if(e[0]!=="$"){const d=o[e];if(d!==void 0)switch(d){case 1:return i[e];case 2:return n[e];case 4:return t[e];case 3:return r[e]}else{if(ku(i,e))return o[e]=1,i[e];if(n!==Lt&&Rt(n,e))return o[e]=2,n[e];if(Rt(r,e))return o[e]=3,r[e];if(t!==Lt&&Rt(t,e))return o[e]=4,t[e];Rf&&(o[e]=0)}}const l=Ja[e];let h,u;if(l)return e==="$attrs"&&Pi(s.attrs,"get",""),l(s);if((h=a.__cssModules)&&(h=h[e]))return h;if(t!==Lt&&Rt(t,e))return o[e]=4,t[e];if(u=c.config.globalProperties,Rt(u,e))return u[e]},set({_:s},e,t){const{data:i,setupState:n,ctx:r}=s;return ku(n,e)?(n[e]=t,!0):i!==Lt&&Rt(i,e)?(i[e]=t,!0):Rt(s.props,e)||e[0]==="$"&&e.slice(1)in s?!1:(r[e]=t,!0)},has({_:{data:s,setupState:e,accessCache:t,ctx:i,appContext:n,props:r,type:o}},a){let c;return!!(t[a]||s!==Lt&&a[0]!=="$"&&Rt(s,a)||ku(e,a)||Rt(r,a)||Rt(i,a)||Rt(Ja,a)||Rt(n.config.globalProperties,a)||(c=o.__cssModules)&&c[a])},defineProperty(s,e,t){return t.get!=null?s._.accessCache[e]=0:Rt(t,"value")&&this.set(s,e,t.value,null),Reflect.defineProperty(s,e,t)}};function Qp(s){return ze(s)?s.reduce((e,t)=>(e[t]=null,e),{}):s}let Rf=!0;function ST(s){const e=Sx(s),t=s.proxy,i=s.ctx;Rf=!1,e.beforeCreate&&eg(e.beforeCreate,s,"bc");const{data:n,computed:r,methods:o,watch:a,provide:c,inject:l,created:h,beforeMount:u,mounted:d,beforeUpdate:f,updated:m,activated:p,deactivated:g,beforeDestroy:x,beforeUnmount:v,destroyed:y,unmounted:S,render:C,renderTracked:w,renderTriggered:b,errorCaptured:_,serverPrefetch:A,expose:P,inheritAttrs:E,components:R,directives:O,filters:U}=e;if(l&&MT(l,i,null),o)for(const X in o){const D=o[X];at(D)&&(i[X]=D.bind(t))}if(n){const X=n.call(t,t);Pt(X)&&(s.data=po(X))}if(Rf=!0,r)for(const X in r){const D=r[X],F=at(D)?D.bind(t,t):at(D.get)?D.get.bind(t,t):cn,N=!at(D)&&at(D.set)?D.set.bind(t):cn,k=Le({get:F,set:N});Object.defineProperty(i,X,{enumerable:!0,configurable:!0,get:()=>k.value,set:V=>k.value=V})}if(a)for(const X in a)wx(a[X],i,t,X);if(c){const X=at(c)?c.call(t):c;Reflect.ownKeys(X).forEach(D=>{cx(D,X[D])})}h&&eg(h,s,"c");function $(X,D){ze(D)?D.forEach(F=>X(F.bind(t))):D&&X(D.bind(t))}if($(dT,u),$(ys,d),$(fT,f),$(mT,m),$(cT,p),$(hT,g),$(yT,_),$(vT,w),$(gT,b),$(Rr,v),$(Al,S),$(pT,A),ze(P))if(P.length){const X=s.exposed||(s.exposed={});P.forEach(D=>{Object.defineProperty(X,D,{get:()=>t[D],set:F=>t[D]=F,enumerable:!0})})}else s.exposed||(s.exposed={});C&&s.render===cn&&(s.render=C),E!=null&&(s.inheritAttrs=E),R&&(s.components=R),O&&(s.directives=O),A&&yx(s)}function MT(s,e,t=cn){ze(s)&&(s=Pf(s));for(const i in s){const n=s[i];let r;Pt(n)?"default"in n?r=qo(n.from||i,n.default,!0):r=qo(n.from||i):r=qo(n),jt(r)?Object.defineProperty(e,i,{enumerable:!0,configurable:!0,get:()=>r.value,set:o=>r.value=o}):e[i]=r}}function eg(s,e,t){gs(ze(s)?s.map(i=>i.bind(e.proxy)):s.bind(e.proxy),e,t)}function wx(s,e,t,i){let n=i.includes(".")?hx(t,i):()=>t[i];if(Gt(s)){const r=e[s];at(r)&&ai(n,r)}else if(at(s))ai(n,s.bind(t));else if(Pt(s))if(ze(s))s.forEach(r=>wx(r,e,t,i));else{const r=at(s.handler)?s.handler.bind(t):e[s.handler];at(r)&&ai(n,r,s)}}function Sx(s){const e=s.type,{mixins:t,extends:i}=e,{mixins:n,optionsCache:r,config:{optionMergeStrategies:o}}=s.appContext,a=r.get(e);let c;return a?c=a:!n.length&&!t&&!i?c=e:(c={},n.length&&n.forEach(l=>Kc(c,l,o,!0)),Kc(c,e,o)),Pt(e)&&r.set(e,c),c}function Kc(s,e,t,i=!1){const{mixins:n,extends:r}=e;r&&Kc(s,r,t,!0),n&&n.forEach(o=>Kc(s,o,t,!0));for(const o in e)if(!(i&&o==="expose")){const a=TT[o]||t&&t[o];s[o]=a?a(s[o],e[o]):e[o]}return s}const TT={data:tg,props:ig,emits:ig,methods:Da,computed:Da,beforeCreate:Li,created:Li,beforeMount:Li,mounted:Li,beforeUpdate:Li,updated:Li,beforeDestroy:Li,beforeUnmount:Li,destroyed:Li,unmounted:Li,activated:Li,deactivated:Li,errorCaptured:Li,serverPrefetch:Li,components:Da,directives:Da,watch:CT,provide:tg,inject:_T};function tg(s,e){return e?s?function(){return pi(at(s)?s.call(this,this):s,at(e)?e.call(this,this):e)}:e:s}function _T(s,e){return Da(Pf(s),Pf(e))}function Pf(s){if(ze(s)){const e={};for(let t=0;t<s.length;t++)e[s[t]]=s[t];return e}return s}function Li(s,e){return s?[...new Set([].concat(s,e))]:e}function Da(s,e){return s?pi(Object.create(null),s,e):e}function ig(s,e){return s?ze(s)&&ze(e)?[...new Set([...s,...e])]:pi(Object.create(null),Qp(s),Qp(e??{})):e}function CT(s,e){if(!s)return e;if(!e)return s;const t=pi(Object.create(null),s);for(const i in e)t[i]=Li(s[i],e[i]);return t}function Mx(){return{app:null,config:{isNativeTag:Py,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 ET=0;function AT(s,e){return function(i,n=null){at(i)||(i=pi({},i)),n!=null&&!Pt(n)&&(n=null);const r=Mx(),o=new WeakSet,a=[];let c=!1;const l=r.app={_uid:ET++,_component:i,_props:n,_container:null,_context:r,_instance:null,version:r2,get config(){return r.config},set config(h){},use(h,...u){return o.has(h)||(h&&at(h.install)?(o.add(h),h.install(l,...u)):at(h)&&(o.add(h),h(l,...u))),l},mixin(h){return r.mixins.includes(h)||r.mixins.push(h),l},component(h,u){return u?(r.components[h]=u,l):r.components[h]},directive(h,u){return u?(r.directives[h]=u,l):r.directives[h]},mount(h,u,d){if(!c){const f=l._ceVNode||we(i,n);return f.appContext=r,d===!0?d="svg":d===!1&&(d=void 0),s(f,h,d),c=!0,l._container=h,h.__vue_app__=l,su(f.component)}},onUnmount(h){a.push(h)},unmount(){c&&(gs(a,l._instance,16),s(null,l._container),delete l._container.__vue_app__)},provide(h,u){return r.provides[h]=u,l},runWithContext(h){const u=no;no=l;try{return h()}finally{no=u}}};return l}}let no=null;const IT=(s,e)=>e==="modelValue"||e==="model-value"?s.modelModifiers:s[`${e}Modifiers`]||s[`${ks(e)}Modifiers`]||s[`${Ir(e)}Modifiers`];function RT(s,e,...t){if(s.isUnmounted)return;const i=s.vnode.props||Lt;let n=t;const r=e.startsWith("update:"),o=r&&IT(i,e.slice(7));o&&(o.trim&&(n=t.map(h=>Gt(h)?h.trim():h)),o.number&&(n=t.map(jh)));let a,c=i[a=Cu(e)]||i[a=Cu(ks(e))];!c&&r&&(c=i[a=Cu(Ir(e))]),c&&gs(c,s,6,n);const l=i[a+"Once"];if(l){if(!s.emitted)s.emitted={};else if(s.emitted[a])return;s.emitted[a]=!0,gs(l,s,6,n)}}const PT=new WeakMap;function Tx(s,e,t=!1){const i=t?PT:e.emitsCache,n=i.get(s);if(n!==void 0)return n;const r=s.emits;let o={},a=!1;if(!at(s)){const c=l=>{const h=Tx(l,e,!0);h&&(a=!0,pi(o,h))};!t&&e.mixins.length&&e.mixins.forEach(c),s.extends&&c(s.extends),s.mixins&&s.mixins.forEach(c)}return!r&&!a?(Pt(s)&&i.set(s,null),null):(ze(r)?r.forEach(c=>o[c]=null):pi(o,r),Pt(s)&&i.set(s,o),o)}function tu(s,e){return!s||!Xh(e)?!1:(e=e.slice(2),e=e==="Once"?e:e.replace(/Once$/,""),Rt(s,e[0].toLowerCase()+e.slice(1))||Rt(s,Ir(e))||Rt(s,e))}function sg(s){const{type:e,vnode:t,proxy:i,withProxy:n,propsOptions:[r],slots:o,attrs:a,emit:c,render:l,renderCache:h,props:u,data:d,setupState:f,ctx:m,inheritAttrs:p}=s,g=Wc(s);let x,v;try{if(t.shapeFlag&4){const S=n||i,C=S;x=Qs(l.call(C,S,h,u,f,d,m)),v=a}else{const S=e;x=Qs(S.length>1?S(u,{attrs:a,slots:o,emit:c}):S(u,null)),v=e.props?a:kT(a)}}catch(S){$n.length=0,qh(S,s,1),x=we(Fi)}let y=x;if(v&&p!==!1){const S=Object.keys(v),{shapeFlag:C}=y;S.length&&C&7&&(r&&S.some(Vh)&&(v=FT(v,r)),y=Cr(y,v,!1,!0))}if(t.dirs&&(y=Cr(y,null,!1,!0),y.dirs=y.dirs?y.dirs.concat(t.dirs):t.dirs),t.transition){const S=Jh(y.type)&&zc(y)||y;ul(S,t.transition)}return x=y,Wc(g),x}const kT=s=>{let e;for(const t in s)(t==="class"||t==="style"||Xh(t))&&((e||(e={}))[t]=s[t]);return e},FT=(s,e)=>{const t={};for(const i in s)(!Vh(i)||!(i.slice(9)in e))&&(t[i]=s[i]);return t};function OT(s,e,t){const{props:i,children:n,component:r}=s,{props:o,children:a,patchFlag:c}=e,l=r.emitsOptions;if(e.dirs||e.transition)return!0;if(t&&c>=0){if(c&1024)return!0;if(c&16)return i?ng(i,o,l):!!o;if(c&8){const h=e.dynamicProps;for(let u=0;u<h.length;u++){const d=h[u];if(_x(o,i,d)&&!tu(l,d))return!0}}}else return(n||a)&&(!a||!a.$stable)?!0:i===o?!1:i?o?ng(i,o,l):!0:!!o;return!1}function ng(s,e,t){const i=Object.keys(e);if(i.length!==Object.keys(s).length)return!0;for(let n=0;n<i.length;n++){const r=i[n];if(_x(e,s,r)&&!tu(t,r))return!0}return!1}function _x(s,e,t){const i=s[t],n=e[t];return t==="style"&&Pt(i)&&Pt(n)?!ga(i,n):i!==n}function LT({vnode:s,parent:e,suspense:t},i){for(;e;){const n=e.subTree;if(n.suspense&&n.suspense.activeBranch===s&&(n.suspense.vnode.el=n.el=i,s=n),n===s)(s=e.vnode).el=i,e=e.parent;else break}t&&t.activeBranch===s&&(t.vnode.el=i)}const Cx={},Ex=()=>Object.create(Cx),Ax=s=>Object.getPrototypeOf(s)===Cx;function BT(s,e,t,i=!1){const n={},r=Ex();s.propsDefaults=Object.create(null),Ix(s,e,n,r);for(const o in s.propsOptions[0])o in n||(n[o]=void 0);t?s.props=i?n:UM(n):s.type.props?s.props=n:s.props=r,s.attrs=r}function NT(s,e,t,i){const{props:n,attrs:r,vnode:{patchFlag:o}}=s,a=Tt(n),[c]=s.propsOptions;let l=!1;if((i||o>0)&&!(o&16)){if(o&8){const h=s.vnode.dynamicProps;for(let u=0;u<h.length;u++){let d=h[u];if(tu(s.emitsOptions,d))continue;const f=e[d];if(c)if(Rt(r,d))f!==r[d]&&(r[d]=f,l=!0);else{const m=ks(d);n[m]=kf(c,a,m,f,s,!1)}else f!==r[d]&&(r[d]=f,l=!0)}}}else{Ix(s,e,n,r)&&(l=!0);let h;for(const u in a)(!e||!Rt(e,u)&&((h=Ir(u))===u||!Rt(e,h)))&&(c?t&&(t[u]!==void 0||t[h]!==void 0)&&(n[u]=kf(c,a,u,void 0,s,!0)):delete n[u]);if(r!==a)for(const u in r)(!e||!Rt(e,u))&&(delete r[u],l=!0)}l&&In(s.attrs,"set","")}function Ix(s,e,t,i){const[n,r]=s.propsOptions;let o=!1,a;if(e)for(let c in e){if(za(c))continue;const l=e[c];let h;n&&Rt(n,h=ks(c))?!r||!r.includes(h)?t[h]=l:(a||(a={}))[h]=l:tu(s.emitsOptions,c)||(!(c in i)||l!==i[c])&&(i[c]=l,o=!0)}if(r){const c=Tt(t),l=a||Lt;for(let h=0;h<r.length;h++){const u=r[h];t[u]=kf(n,c,u,l[u],s,!Rt(l,u))}}return o}function kf(s,e,t,i,n,r){const o=s[t];if(o!=null){const a=Rt(o,"default");if(a&&i===void 0){const c=o.default;if(o.type!==Function&&!o.skipFactory&&at(c)){const{propsDefaults:l}=n;if(t in l)i=l[t];else{const h=Il(n);i=l[t]=c.call(null,e),h()}}else i=c;n.ce&&n.ce._setProp(t,i)}o[0]&&(r&&!a?i=!1:o[1]&&(i===""||i===Ir(t))&&(i=!0))}return i}const DT=new WeakMap;function Rx(s,e,t=!1){const i=t?DT:e.propsCache,n=i.get(s);if(n)return n;const r=s.props,o={},a=[];let c=!1;if(!at(s)){const h=u=>{c=!0;const[d,f]=Rx(u,e,!0);pi(o,d),f&&a.push(...f)};!t&&e.mixins.length&&e.mixins.forEach(h),s.extends&&h(s.extends),s.mixins&&s.mixins.forEach(h)}if(!r&&!c)return Pt(s)&&i.set(s,Ho),Ho;if(ze(r))for(let h=0;h<r.length;h++){const u=ks(r[h]);rg(u)&&(o[u]=Lt)}else if(r)for(const h in r){const u=ks(h);if(rg(u)){const d=r[h],f=o[u]=ze(d)||at(d)?{type:d}:pi({},d),m=f.type;let p=!1,g=!0;if(ze(m))for(let x=0;x<m.length;++x){const v=m[x],y=at(v)&&v.name;if(y==="Boolean"){p=!0;break}else y==="String"&&(g=!1)}else p=at(m)&&m.name==="Boolean";f[0]=p,f[1]=g,(p||Rt(f,"default"))&&a.push(u)}}const l=[o,a];return Pt(s)&&i.set(s,l),l}function rg(s){return s[0]!=="$"&&!za(s)}const op=s=>s==="_"||s==="_ctx"||s==="$stable",ap=s=>ze(s)?s.map(Qs):[Qs(s)],UT=(s,e,t)=>{if(e._n)return e;const i=Zh((...n)=>ap(e(...n)),t);return i._c=!1,i},Px=(s,e,t)=>{const i=s._ctx;for(const n in s){if(op(n))continue;const r=s[n];if(at(r))e[n]=UT(n,r,i);else if(r!=null){const o=ap(r);e[n]=()=>o}}},kx=(s,e)=>{const t=ap(e);s.slots.default=()=>t},Fx=(s,e,t)=>{for(const i in e)(t||!op(i))&&(s[i]=e[i])},$T=(s,e,t)=>{const i=s.slots=Ex();if(s.vnode.shapeFlag&32){const n=e._;n?(Fx(i,e,t),t&&By(i,"_",n,!0)):Px(e,i)}else e&&kx(s,e)},XT=(s,e,t)=>{const{vnode:i,slots:n}=s;let r=!0,o=Lt;if(i.shapeFlag&32){const a=e._;a?t&&a===1?r=!1:Fx(n,e,t):(r=!e.$stable,Px(e,n)),o=e}else e&&(kx(s,e),o={default:1});if(r)for(const a in n)!op(a)&&o[a]==null&&delete n[a]},Bi=HT;function VT(s){return YT(s)}function YT(s,e){const t=Hh();t.__VUE__=!0;const{insert:i,remove:n,patchProp:r,createElement:o,createText:a,createComment:c,setText:l,setElementText:h,parentNode:u,nextSibling:d,setScopeId:f=cn,insertStaticContent:m}=s,p=(H,z,K,B=null,L=null,j=null,ie=void 0,ue=null,fe=!!z.dynamicChildren)=>{if(H===z)return;H&&!zr(H,z)&&(B=oe(H),V(H,L,j,!0),H=null),z.patchFlag===-2&&(fe=!1,z.dynamicChildren=null);const{type:ee,ref:Me,shapeFlag:be}=z;switch(ee){case iu:g(H,z,K,B);break;case Fi:x(H,z,K,B);break;case Ac:H==null&&v(z,K,B,ie);break;case _e:R(H,z,K,B,L,j,ie,ue,fe);break;default:be&1?C(H,z,K,B,L,j,ie,ue,fe):be&6?O(H,z,K,B,L,j,ie,ue,fe):(be&64||be&128)&&ee.process(H,z,K,B,L,j,ie,ue,fe,he)}Me!=null&&L?Za(Me,H&&H.ref,j,z||H,!z):Me==null&&H&&H.ref!=null&&Za(H.ref,null,j,H,!0)},g=(H,z,K,B)=>{if(H==null)i(z.el=a(z.children),K,B);else{const L=z.el=H.el;z.children!==H.children&&l(L,z.children)}},x=(H,z,K,B)=>{H==null?i(z.el=c(z.children||""),K,B):z.el=H.el},v=(H,z,K,B)=>{[H.el,H.anchor]=m(H.children,z,K,B,H.el,H.anchor)},y=({el:H,anchor:z},K,B)=>{let L;for(;H&&H!==z;)L=d(H),i(H,K,B),H=L;i(z,K,B)},S=({el:H,anchor:z})=>{let K;for(;H&&H!==z;)K=d(H),n(H),H=K;n(z)},C=(H,z,K,B,L,j,ie,ue,fe)=>{if(z.type==="svg"?ie="svg":z.type==="math"&&(ie="mathml"),H==null)w(z,K,B,L,j,ie,ue,fe);else{const ee=H.el&&H.el._isVueCE?H.el:null;try{ee&&ee._beginPatch(),A(H,z,L,j,ie,ue,fe)}finally{ee&&ee._endPatch()}}},w=(H,z,K,B,L,j,ie,ue)=>{let fe,ee;const{props:Me,shapeFlag:be,transition:ge,dirs:Ne}=H;if(fe=H.el=o(H.type,j,Me&&Me.is,Me),be&8?h(fe,H.children):be&16&&_(H.children,fe,null,B,L,Fu(H,j),ie,ue),Ne&&Or(H,null,B,"created"),b(fe,H,H.scopeId,ie,B),Me){for(const Ze in Me)Ze!=="value"&&!za(Ze)&&r(fe,Ze,null,Me[Ze],j,B);"value"in Me&&r(fe,"value",null,Me.value,j),(ee=Me.onVnodeBeforeMount)&&Xs(ee,B,H)}Ne&&Or(H,null,B,"beforeMount");const Ve=GT(L,ge);Ve&&ge.beforeEnter(fe),i(fe,z,K),((ee=Me&&Me.onVnodeMounted)||Ve||Ne)&&Bi(()=>{try{ee&&Xs(ee,B,H),Ve&&ge.enter(fe),Ne&&Or(H,null,B,"mounted")}finally{}},L)},b=(H,z,K,B,L)=>{if(K&&f(H,K),B)for(let j=0;j<B.length;j++)f(H,B[j]);if(L){let j=L.subTree;if(z===j||Bx(j.type)&&(j.ssContent===z||j.ssFallback===z)){const ie=L.vnode;b(H,ie,ie.scopeId,ie.slotScopeIds,L.parent)}}},_=(H,z,K,B,L,j,ie,ue,fe=0)=>{for(let ee=fe;ee<H.length;ee++){const Me=H[ee]=ue?An(H[ee]):Qs(H[ee]);p(null,Me,z,K,B,L,j,ie,ue)}},A=(H,z,K,B,L,j,ie)=>{const ue=z.el=H.el;let{patchFlag:fe,dynamicChildren:ee,dirs:Me}=z;fe|=H.patchFlag&16;const be=H.props||Lt,ge=z.props||Lt;let Ne;if(K&&Lr(K,!1),(Ne=ge.onVnodeBeforeUpdate)&&Xs(Ne,K,z,H),Me&&Or(z,H,K,"beforeUpdate"),K&&Lr(K,!0),ee&&(!H.dynamicChildren||H.dynamicChildren.length!==ee.length)&&(fe=0,ie=!1,ee=null),(be.innerHTML&&ge.innerHTML==null||be.textContent&&ge.textContent==null)&&h(ue,""),ee?P(H.dynamicChildren,ee,ue,K,B,Fu(z,L),j):ie||D(H,z,ue,null,K,B,Fu(z,L),j,!1),fe>0){if(fe&16)E(ue,be,ge,K,L);else if(fe&2&&be.class!==ge.class&&r(ue,"class",null,ge.class,L),fe&4&&r(ue,"style",be.style,ge.style,L),fe&8){const Ve=z.dynamicProps;for(let Ze=0;Ze<Ve.length;Ze++){const rt=Ve[Ze],Je=be[rt],je=ge[rt];(je!==Je||rt==="value")&&r(ue,rt,Je,je,L,K)}}fe&1&&H.children!==z.children&&h(ue,z.children)}else!ie&&ee==null&&E(ue,be,ge,K,L);((Ne=ge.onVnodeUpdated)||Me)&&Bi(()=>{Ne&&Xs(Ne,K,z,H),Me&&Or(z,H,K,"updated")},B)},P=(H,z,K,B,L,j,ie)=>{for(let ue=0;ue<z.length;ue++){const fe=H[ue],ee=z[ue],Me=fe.el&&(fe.type===_e||!zr(fe,ee)||fe.shapeFlag&198)?u(fe.el):K;p(fe,ee,Me,null,B,L,j,ie,!0)}},E=(H,z,K,B,L)=>{if(z!==K){if(z!==Lt)for(const j in z)!za(j)&&!(j in K)&&r(H,j,z[j],null,L,B);for(const j in K){if(za(j))continue;const ie=K[j],ue=z[j];ie!==ue&&j!=="value"&&r(H,j,ue,ie,L,B)}"value"in K&&r(H,"value",z.value,K.value,L)}},R=(H,z,K,B,L,j,ie,ue,fe)=>{const ee=z.el=H?H.el:a(""),Me=z.anchor=H?H.anchor:a("");let{patchFlag:be,dynamicChildren:ge,slotScopeIds:Ne}=z;Ne&&(ue=ue?ue.concat(Ne):Ne),H==null?(i(ee,K,B),i(Me,K,B),_(z.children||[],K,Me,L,j,ie,ue,fe)):be>0&&be&64&&ge&&H.dynamicChildren&&H.dynamicChildren.length===ge.length?(P(H.dynamicChildren,ge,K,L,j,ie,ue),(z.key!=null||L&&z===L.subTree)&&lp(H,z,!0)):D(H,z,K,Me,L,j,ie,ue,fe)},O=(H,z,K,B,L,j,ie,ue,fe)=>{z.slotScopeIds=ue,H==null?z.shapeFlag&512?L.ctx.activate(z,K,B,ie,fe):U(z,K,B,L,j,ie,fe):Y(H,z,fe)},U=(H,z,K,B,L,j,ie)=>{const ue=H.component=JT(H,B,L);if(Qh(H)&&(ue.ctx.renderer=he),QT(ue,!1,ie),ue.asyncDep){if(L&&L.registerDep(ue,$,ie),!H.el){const fe=ue.subTree=we(Fi);x(null,fe,z,K),H.placeholder=fe.el}}else $(ue,H,z,K,L,j,ie)},Y=(H,z,K)=>{const B=z.component=H.component;if(OT(H,z,K))if(B.asyncDep&&!B.asyncResolved){X(B,z,K);return}else B.next=z,B.update();else z.el=H.el,B.vnode=z},$=(H,z,K,B,L,j,ie)=>{const ue=()=>{if(H.isMounted){let{next:be,bu:ge,u:Ne,parent:Ve,vnode:Ze}=H;{const Qe=Ox(H);if(Qe){be&&(be.el=Ze.el,X(H,be,ie)),Qe.asyncDep.then(()=>{Bi(()=>{H.isUnmounted||ee()},L)});return}}let rt=be,Je;Lr(H,!1),be?(be.el=Ze.el,X(H,be,ie)):be=Ze,ge&&Ec(ge),(Je=be.props&&be.props.onVnodeBeforeUpdate)&&Xs(Je,Ve,be,Ze),Lr(H,!0);const je=sg(H),Ae=H.subTree;H.subTree=je,p(Ae,je,u(Ae.el),oe(Ae),H,L,j),be.el=je.el,rt===null&<(H,je.el),Ne&&Bi(Ne,L),(Je=be.props&&be.props.onVnodeUpdated)&&Bi(()=>Xs(Je,Ve,be,Ze),L)}else{let be;const{el:ge,props:Ne}=z,{bm:Ve,m:Ze,parent:rt,root:Je,type:je}=H,Ae=Ko(z);Lr(H,!1),Ve&&Ec(Ve),!Ae&&(be=Ne&&Ne.onVnodeBeforeMount)&&Xs(be,rt,z),Lr(H,!0);{Je.ce&&Je.ce._hasShadowRoot()&&Je.ce._injectChildStyle(je,H.parent?H.parent.type:void 0);const Qe=H.subTree=sg(H);p(null,Qe,K,B,H,L,j),z.el=Qe.el}if(Ze&&Bi(Ze,L),!Ae&&(be=Ne&&Ne.onVnodeMounted)){const Qe=z;Bi(()=>Xs(be,rt,Qe),L)}(z.shapeFlag&256||rt&&Ko(rt.vnode)&&rt.vnode.shapeFlag&256)&&H.a&&Bi(H.a,L),H.isMounted=!0,z=K=B=null}};H.scope.on();const fe=H.effect=new Yy(ue);H.scope.off();const ee=H.update=fe.run.bind(fe),Me=H.job=fe.runIfDirty.bind(fe);Me.i=H,Me.id=H.uid,fe.scheduler=()=>np(Me),Lr(H,!0),ee()},X=(H,z,K)=>{z.component=H;const B=H.vnode.props;H.vnode=z,H.next=null,NT(H,z.props,B,K),XT(H,z.children,K),Yn(),zp(H),Gn()},D=(H,z,K,B,L,j,ie,ue,fe=!1)=>{const ee=H&&H.children,Me=H?H.shapeFlag:0,be=z.children,{patchFlag:ge,shapeFlag:Ne}=z;if(ge>0){if(ge&128){N(ee,be,K,B,L,j,ie,ue,fe);return}else if(ge&256){F(ee,be,K,B,L,j,ie,ue,fe);return}}Ne&8?(Me&16&&ne(ee,L,j),be!==ee&&h(K,be)):Me&16?Ne&16?N(ee,be,K,B,L,j,ie,ue,fe):ne(ee,L,j,!0):(Me&8&&h(K,""),Ne&16&&_(be,K,B,L,j,ie,ue,fe))},F=(H,z,K,B,L,j,ie,ue,fe)=>{H=H||Ho,z=z||Ho;const ee=H.length,Me=z.length,be=Math.min(ee,Me);let ge;for(ge=0;ge<be;ge++){const Ne=z[ge]=fe?An(z[ge]):Qs(z[ge]);p(H[ge],Ne,K,null,L,j,ie,ue,fe)}ee>Me?ne(H,L,j,!0,!1,be):_(z,K,B,L,j,ie,ue,fe,be)},N=(H,z,K,B,L,j,ie,ue,fe)=>{let ee=0;const Me=z.length;let be=H.length-1,ge=Me-1;for(;ee<=be&&ee<=ge;){const Ne=H[ee],Ve=z[ee]=fe?An(z[ee]):Qs(z[ee]);if(zr(Ne,Ve))p(Ne,Ve,K,null,L,j,ie,ue,fe);else break;ee++}for(;ee<=be&&ee<=ge;){const Ne=H[be],Ve=z[ge]=fe?An(z[ge]):Qs(z[ge]);if(zr(Ne,Ve))p(Ne,Ve,K,null,L,j,ie,ue,fe);else break;be--,ge--}if(ee>be){if(ee<=ge){const Ne=ge+1,Ve=Ne<Me?z[Ne].el:B;for(;ee<=ge;)p(null,z[ee]=fe?An(z[ee]):Qs(z[ee]),K,Ve,L,j,ie,ue,fe),ee++}}else if(ee>ge)for(;ee<=be;)V(H[ee],L,j,!0),ee++;else{const Ne=ee,Ve=ee,Ze=new Map;for(ee=Ve;ee<=ge;ee++){const ut=z[ee]=fe?An(z[ee]):Qs(z[ee]);ut.key!=null&&Ze.set(ut.key,ee)}let rt,Je=0;const je=ge-Ve+1;let Ae=!1,Qe=0;const Ee=new Array(je);for(ee=0;ee<je;ee++)Ee[ee]=0;for(ee=Ne;ee<=be;ee++){const ut=H[ee];if(Je>=je){V(ut,L,j,!0);continue}let re;if(ut.key!=null)re=Ze.get(ut.key);else for(rt=Ve;rt<=ge;rt++)if(Ee[rt-Ve]===0&&zr(ut,z[rt])){re=rt;break}re===void 0?V(ut,L,j,!0):(Ee[re-Ve]=ee+1,re>=Qe?Qe=re:Ae=!0,p(ut,z[re],K,null,L,j,ie,ue,fe),Je++)}const Qt=Ae?jT(Ee):Ho;for(rt=Qt.length-1,ee=je-1;ee>=0;ee--){const ut=Ve+ee,re=z[ut],ae=z[ut+1],et=ut+1<Me?ae.el||Lx(ae):B;Ee[ee]===0?p(null,re,K,et,L,j,ie,ue,fe):Ae&&(rt<0||ee!==Qt[rt]?k(re,K,et,2):rt--)}}},k=(H,z,K,B,L=null)=>{const{el:j,type:ie,transition:ue,children:fe,shapeFlag:ee}=H;if(ee&6){k(H.component.subTree,z,K,B);return}if(ee&128){H.suspense.move(z,K,B);return}if(ee&64){ie.move(H,z,K,he);return}if(ie===_e){i(j,z,K);for(let be=0;be<fe.length;be++)k(fe[be],z,K,B);i(H.anchor,z,K);return}if(ie===Ac){y(H,z,K);return}if(B!==2&&ee&1&&ue)if(B===0)ue.persisted&&!j[us]?i(j,z,K):(ue.beforeEnter(j),i(j,z,K),Bi(()=>ue.enter(j),L));else{const{leave:be,delayLeave:ge,afterLeave:Ne}=ue,Ve=()=>{H.ctx.isUnmounted?n(j):i(j,z,K)},Ze=()=>{const rt=j._isLeaving||!!j[us];j._isLeaving&&j[us](!0),ue.persisted&&!rt?Ve():be(j,()=>{Ve(),Ne&&Ne()})};ge?ge(j,Ve,Ze):Ze()}else i(j,z,K)},V=(H,z,K,B=!1,L=!1)=>{const{type:j,props:ie,ref:ue,children:fe,dynamicChildren:ee,shapeFlag:Me,patchFlag:be,dirs:ge,cacheIndex:Ne,memo:Ve}=H;if(be===-2&&(L=!1),ue!=null&&(Yn(),Za(ue,null,K,H,!0),Gn()),Ne!=null&&(z.renderCache[Ne]=void 0),Me&256){z.ctx.deactivate(H);return}const Ze=Me&1&&ge,rt=!Ko(H);let Je;if(rt&&(Je=ie&&ie.onVnodeBeforeUnmount)&&Xs(Je,z,H),Me&6)Z(H.component,K,B);else{if(Me&128){H.suspense.unmount(K,B);return}Ze&&Or(H,null,z,"beforeUnmount"),Me&64?H.type.remove(H,z,K,he,B):ee&&!ee.hasOnce&&(j!==_e||be>0&&be&64)?ne(ee,z,K,!1,!0):(j===_e&&be&384||!L&&Me&16)&&ne(fe,z,K),B&&G(H)}const je=Ve!=null&&Ne==null;(rt&&(Je=ie&&ie.onVnodeUnmounted)||Ze||je)&&Bi(()=>{Je&&Xs(Je,z,H),Ze&&Or(H,null,z,"unmounted"),je&&(H.el=null)},K)},G=H=>{const{type:z,el:K,anchor:B,transition:L}=H;if(z===_e){W(K,B);return}if(z===Ac){S(H);return}const j=()=>{n(K),L&&!L.persisted&&L.afterLeave&&L.afterLeave()};if(H.shapeFlag&1&&L&&!L.persisted){const{leave:ie,delayLeave:ue}=L,fe=()=>ie(K,j);ue?ue(H.el,j,fe):fe()}else j()},W=(H,z)=>{let K;for(;H!==z;)K=d(H),n(H),H=K;n(z)},Z=(H,z,K)=>{const{bum:B,scope:L,job:j,subTree:ie,um:ue,m:fe,a:ee}=H;og(fe),og(ee),B&&Ec(B),L.stop(),j&&(j.flags|=8,V(ie,H,z,K)),ue&&Bi(ue,z),Bi(()=>{H.isUnmounted=!0},z)},ne=(H,z,K,B=!1,L=!1,j=0)=>{for(let ie=j;ie<H.length;ie++)V(H[ie],z,K,B,L)},oe=H=>{if(H.shapeFlag&6)return oe(H.component.subTree);if(H.shapeFlag&128)return H.suspense.next();const z=d(H.anchor||H.el),K=z&&z[ux];return K?d(K):z};let de=!1;const pe=(H,z,K)=>{let B;H==null?z._vnode&&(V(z._vnode,null,null,!0),B=z._vnode.component):p(z._vnode||null,H,z,null,null,null,K),z._vnode=H,de||(de=!0,zp(B),ox(),de=!1)},he={p,um:V,m:k,r:G,mt:U,mc:_,pc:D,pbc:P,n:oe,o:s};return{render:pe,hydrate:void 0,createApp:AT(pe)}}function Fu({type:s,props:e},t){return t==="svg"&&s==="foreignObject"||t==="mathml"&&s==="annotation-xml"&&e&&e.encoding&&e.encoding.includes("html")?void 0:t}function Lr({effect:s,job:e},t){t?(s.flags|=32,e.flags|=4):(s.flags&=-33,e.flags&=-5)}function GT(s,e){return(!s||s&&!s.pendingBranch)&&e&&!e.persisted}function lp(s,e,t=!1){const i=s.children,n=e.children;if(ze(i)&&ze(n))for(let r=0;r<i.length;r++){const o=i[r];let a=n[r];a.shapeFlag&1&&!a.dynamicChildren&&((a.patchFlag<=0||a.patchFlag===32)&&(a=n[r]=An(n[r]),a.el=o.el),!t&&a.patchFlag!==-2&&lp(o,a)),a.type===iu&&(a.patchFlag===-1&&(a=n[r]=An(a)),a.el=o.el),a.type===Fi&&!a.el&&(a.el=o.el)}}function jT(s){const e=s.slice(),t=[0];let i,n,r,o,a;const c=s.length;for(i=0;i<c;i++){const l=s[i];if(l!==0){if(n=t[t.length-1],s[n]<l){e[i]=n,t.push(i);continue}for(r=0,o=t.length-1;r<o;)a=r+o>>1,s[t[a]]<l?r=a+1:o=a;l<s[t[r]]&&(r>0&&(e[i]=t[r-1]),t[r]=i)}}for(r=t.length,o=t[r-1];r-- >0;)t[r]=o,o=e[o];return t}function Ox(s){const e=s.subTree.component;if(e)return e.asyncDep&&!e.asyncResolved?e:Ox(e)}function og(s){if(s)for(let e=0;e<s.length;e++)s[e].flags|=8}function Lx(s){if(s.placeholder)return s.placeholder;const e=s.component;return e?Lx(e.subTree):null}const Bx=s=>s.__isSuspense;function HT(s,e){e&&e.pendingBranch?ze(s)?e.effects.push(...s):e.effects.push(s):JM(s)}const _e=Symbol.for("v-fgt"),iu=Symbol.for("v-txt"),Fi=Symbol.for("v-cmt"),Ac=Symbol.for("v-stc"),$n=[];let ss=null;function q(s=!1){$n.push(ss=s?null:[])}function cp(){$n.pop(),ss=$n[$n.length-1]||null}let dl=1;function Zc(s,e=!1){dl+=s,s<0&&ss&&e&&(ss.hasOnce=!0)}function Nx(s){return s.dynamicChildren=dl>0?ss||Ho:null,cp(),dl>0&&ss&&ss.push(s),s}function J(s,e,t,i,n,r){return Nx(T(s,e,t,i,n,r,!0))}function Ct(s,e,t,i,n){return Nx(we(s,e,t,i,n,!0))}function fl(s){return s?s.__v_isVNode===!0:!1}function zr(s,e){return s.type===e.type&&s.key===e.key}const Dx=({key:s})=>s??null,Ic=({ref:s,ref_key:e,ref_for:t})=>(typeof s=="number"&&(s=""+s),s!=null?Gt(s)||jt(s)||at(s)?{i:Oi,r:s,k:e,f:!!t}:s:null);function T(s,e=null,t=null,i=0,n=null,r=s===_e?0:1,o=!1,a=!1){const c={__v_isVNode:!0,__v_skip:!0,type:s,props:e,key:e&&Dx(e),ref:e&&Ic(e),scopeId:lx,slotScopeIds:null,children:t,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:r,patchFlag:i,dynamicProps:n,dynamicChildren:null,appContext:null,ctx:Oi};return a?(Jc(c,t),r&128&&s.normalize(c)):t&&(c.shapeFlag|=Gt(t)?8:16),dl>0&&!o&&ss&&(c.patchFlag>0||r&6)&&c.patchFlag!==32&&ss.push(c),c}const we=WT;function WT(s,e=null,t=null,i=0,n=null,r=!1){if((!s||s===xT)&&(s=Fi),fl(s)){const a=Cr(s,e,!0);return t&&Jc(a,t),dl>0&&!r&&ss&&(a.shapeFlag&6?ss[ss.indexOf(s)]=a:ss.push(a)),a.patchFlag=-2,a}if(s2(s)&&(s=s.__vccOpts),e){e=zT(e);let{class:a,style:c}=e;a&&!Gt(a)&&(e.class=Ce(a)),Pt(c)&&(zh(c)&&!ze(c)&&(c=pi({},c)),e.style=Ot(c))}const o=Gt(s)?1:Bx(s)?128:Jh(s)?64:Pt(s)?4:at(s)?2:0;return T(s,e,t,i,n,o,r,!0)}function zT(s){return s?zh(s)||Ax(s)?pi({},s):s:null}function Cr(s,e,t=!1,i=!1){const{props:n,ref:r,patchFlag:o,children:a,transition:c}=s,l=e?qT(n||{},e):n,h={__v_isVNode:!0,__v_skip:!0,type:s.type,props:l,key:l&&Dx(l),ref:e&&e.ref?t&&r?ze(r)?r.concat(Ic(e)):[r,Ic(e)]:Ic(e):r,scopeId:s.scopeId,slotScopeIds:s.slotScopeIds,children:a,target:s.target,targetStart:s.targetStart,targetAnchor:s.targetAnchor,staticCount:s.staticCount,shapeFlag:s.shapeFlag,patchFlag:e&&s.type!==_e?o===-1?16:o|16:o,dynamicProps:s.dynamicProps,dynamicChildren:s.dynamicChildren,appContext:s.appContext,dirs:s.dirs,transition:c,component:s.component,suspense:s.suspense,ssContent:s.ssContent&&Cr(s.ssContent),ssFallback:s.ssFallback&&Cr(s.ssFallback),placeholder:s.placeholder,el:s.el,anchor:s.anchor,ctx:s.ctx,ce:s.ce};return c&&i&&ul(h,c.clone(h)),h}function ft(s=" ",e=0){return we(iu,null,s,e)}function is(s,e){const t=we(Ac,null,s);return t.staticCount=e,t}function xe(s="",e=!1){return e?(q(),Ct(Fi,null,s)):we(Fi,null,s)}function Qs(s){return s==null||typeof s=="boolean"?we(Fi):ze(s)?we(_e,null,s.slice()):fl(s)?An(s):we(iu,null,String(s))}function An(s){return s.el===null&&s.patchFlag!==-1||s.memo?s:Cr(s)}function Jc(s,e){let t=0;const{shapeFlag:i}=s;if(e==null)e=null;else if(ze(e))t=16;else if(typeof e=="object")if(i&65){const n=e.default;n&&(n._c&&(n._d=!1),Jc(s,n()),n._c&&(n._d=!0));return}else{t=32;const n=e._;!n&&!Ax(e)?e._ctx=Oi:n===3&&Oi&&(Oi.slots._===1?e._=1:(e._=2,s.patchFlag|=1024))}else if(at(e)){if(i&65){Jc(s,{default:e});return}e={default:e,_ctx:Oi},t=32}else e=String(e),i&64?(t=16,e=[ft(e)]):t=8;s.children=e,s.shapeFlag|=t}function qT(...s){const e={};for(let t=0;t<s.length;t++){const i=s[t];for(const n in i)if(n==="class")e.class!==i.class&&(e.class=Ce([e.class,i.class]));else if(n==="style")e.style=Ot([e.style,i.style]);else if(Xh(n)){const r=e[n],o=i[n];o&&r!==o&&!(ze(r)&&r.includes(o))?e[n]=r?[].concat(r,o):o:o==null&&r==null&&!Vh(n)&&(e[n]=o)}else n!==""&&(e[n]=i[n])}return e}function Xs(s,e,t,i=null){gs(s,e,7,[t,i])}const KT=Mx();let ZT=0;function JT(s,e,t){const i=s.type,n=(e?e.appContext:s.appContext)||KT,r={uid:ZT++,vnode:s,type:i,parent:e,appContext:n,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new $y(!0),render:null,proxy:null,exposed:null,exposeProxy:null,withProxy:null,provides:e?e.provides:Object.create(n.provides),ids:e?e.ids:["",0,0],accessCache:null,renderCache:[],components:null,directives:null,propsOptions:Rx(i,n),emitsOptions:Tx(i,n),emit:null,emitted:null,propsDefaults:Lt,inheritAttrs:i.inheritAttrs,ctx:Lt,data:Lt,props:Lt,attrs:Lt,slots:Lt,refs:Lt,setupState:Lt,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=RT.bind(null,r),s.ce&&s.ce(r),r}let $i=null;const hp=()=>$i||Oi;let Qc,ml;{const s=Hh(),e=(t,i)=>{let n;return(n=s[t])||(n=s[t]=[]),n.push(i),r=>{n.length>1?n.forEach(o=>o(r)):n[0](r)}};Qc=e("__VUE_INSTANCE_SETTERS__",t=>$i=t),ml=e("__VUE_SSR_SETTERS__",t=>pl=t)}const Il=s=>{const e=$i;return Qc(s),s.scope.on(),()=>{s.scope.off(),Qc(e)}},ag=()=>{$i&&$i.scope.off(),Qc(null)};function Ux(s){return s.vnode.shapeFlag&4}let pl=!1;function QT(s,e=!1,t=!1){e&&ml(e);const{props:i,children:n}=s.vnode,r=Ux(s);BT(s,i,r,e),$T(s,n,t||e);const o=r?e2(s,e):void 0;return e&&ml(!1),o}function e2(s,e){const t=s.type;s.accessCache=Object.create(null),s.proxy=new Proxy(s.ctx,wT);const{setup:i}=t;if(i){Yn();const n=s.setupContext=i.length>1?i2(s):null,r=Il(s),o=El(i,s,0,[s.props,n]),a=ky(o);if(Gn(),r(),(a||s.sp)&&!Ko(s)&&yx(s),a){if(o.then(ag,ag),e)return o.then(c=>{ml(!0);try{lg(s,c,e)}finally{ml(!1)}}).catch(c=>{qh(c,s,0)});s.asyncDep=o}else lg(s,o)}else $x(s)}function lg(s,e,t){at(e)?s.type.__ssrInlineRender?s.ssrRender=e:s.render=e:Pt(e)&&(s.setupState=sx(e)),$x(s)}function $x(s,e,t){const i=s.type;s.render||(s.render=i.render||cn);{const n=Il(s);Yn();try{ST(s)}finally{Gn(),n()}}}const t2={get(s,e){return Pi(s,"get",""),s[e]}};function i2(s){const e=t=>{s.exposed=t||{}};return{attrs:new Proxy(s.attrs,t2),slots:s.slots,emit:s.emit,expose:e}}function su(s){return s.exposed?s.exposeProxy||(s.exposeProxy=new Proxy(sx(vr(s.exposed)),{get(e,t){if(t in e)return e[t];if(t in Ja)return Ja[t](s)},has(e,t){return t in e||t in Ja}})):s.proxy}function s2(s){return at(s)&&"__vccOpts"in s}const Le=(s,e)=>WM(s,e,pl);function n2(s,e,t){try{Zc(-1);const i=arguments.length;return i===2?Pt(e)&&!ze(e)?fl(e)?we(s,null,[e]):we(s,e):we(s,null,e):(i>3?t=Array.prototype.slice.call(arguments,2):i===3&&fl(t)&&(t=[t]),we(s,e,t))}finally{Zc(1)}}const r2="3.5.41";/**
|
||
* @vue/runtime-dom v3.5.41
|
||
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
||
* @license MIT
|
||
**/let Ff;const cg=typeof window<"u"&&window.trustedTypes;if(cg)try{Ff=cg.createPolicy("vue",{createHTML:s=>s})}catch{}const Xx=Ff?s=>Ff.createHTML(s):s=>s,o2="http://www.w3.org/2000/svg",a2="http://www.w3.org/1998/Math/MathML",Mn=typeof document<"u"?document:null,hg=Mn&&Mn.createElement("template"),l2={insert:(s,e,t)=>{e.insertBefore(s,t||null)},remove:s=>{const e=s.parentNode;e&&e.removeChild(s)},createElement:(s,e,t,i)=>{const n=e==="svg"?Mn.createElementNS(o2,s):e==="mathml"?Mn.createElementNS(a2,s):t?Mn.createElement(s,{is:t}):Mn.createElement(s);return s==="select"&&i&&i.multiple!=null&&n.setAttribute("multiple",i.multiple),n},createText:s=>Mn.createTextNode(s),createComment:s=>Mn.createComment(s),setText:(s,e)=>{s.nodeValue=e},setElementText:(s,e)=>{s.textContent=e},parentNode:s=>s.parentNode,nextSibling:s=>s.nextSibling,querySelector:s=>Mn.querySelector(s),setScopeId(s,e){s.setAttribute(e,"")},insertStaticContent(s,e,t,i,n,r){const o=t?t.previousSibling:e.lastChild;if(n&&(n===r||n.nextSibling))for(;e.insertBefore(n.cloneNode(!0),t),!(n===r||!(n=n.nextSibling)););else{hg.innerHTML=Xx(i==="svg"?`<svg>${s}</svg>`:i==="mathml"?`<math>${s}</math>`:s);const a=hg.content;if(i==="svg"||i==="mathml"){const c=a.firstChild;for(;c.firstChild;)a.appendChild(c.firstChild);a.removeChild(c)}e.insertBefore(a,t)}return[o?o.nextSibling:e.firstChild,t?t.previousSibling:e.lastChild]}},Qn="transition",Ia="animation",gl=Symbol("_vtc"),Vx={name:String,type:String,css:{type:Boolean,default:!0},duration:[String,Number,Object],enterFromClass:String,enterActiveClass:String,enterToClass:String,appearFromClass:String,appearActiveClass:String,appearToClass:String,leaveFromClass:String,leaveActiveClass:String,leaveToClass:String},c2=pi({},fx,Vx),h2=s=>(s.displayName="Transition",s.props=c2,s),u2=h2((s,{slots:e})=>n2(lT,d2(s),e)),Br=(s,e=[])=>{ze(s)?s.forEach(t=>t(...e)):s&&s(...e)},ug=s=>s?ze(s)?s.some(e=>e.length>1):s.length>1:!1;function d2(s){const e={};for(const R in s)R in Vx||(e[R]=s[R]);if(s.css===!1)return e;const{name:t="v",type:i,duration:n,enterFromClass:r=`${t}-enter-from`,enterActiveClass:o=`${t}-enter-active`,enterToClass:a=`${t}-enter-to`,appearFromClass:c=r,appearActiveClass:l=o,appearToClass:h=a,leaveFromClass:u=`${t}-leave-from`,leaveActiveClass:d=`${t}-leave-active`,leaveToClass:f=`${t}-leave-to`}=s,m=f2(n),p=m&&m[0],g=m&&m[1],{onBeforeEnter:x,onEnter:v,onEnterCancelled:y,onLeave:S,onLeaveCancelled:C,onBeforeAppear:w=x,onAppear:b=v,onAppearCancelled:_=y}=e,A=(R,O,U,Y)=>{R._enterCancelled=Y,Nr(R,O?h:a),Nr(R,O?l:o),U&&U()},P=(R,O)=>{R._isLeaving=!1,Nr(R,u),Nr(R,f),Nr(R,d),O&&O()},E=R=>(O,U)=>{const Y=R?b:v,$=()=>A(O,R,U);Br(Y,[O,$]),dg(()=>{Nr(O,R?c:r),xn(O,R?h:a),ug(Y)||fg(O,i,p,$)})};return pi(e,{onBeforeEnter(R){Br(x,[R]),xn(R,r),xn(R,o)},onBeforeAppear(R){Br(w,[R]),xn(R,c),xn(R,l)},onEnter:E(!1),onAppear:E(!0),onLeave(R,O){R._isLeaving=!0;const U=()=>P(R,O);xn(R,u),R._enterCancelled?(xn(R,d),gg(R)):(gg(R),xn(R,d)),dg(()=>{R._isLeaving&&(Nr(R,u),xn(R,f),ug(S)||fg(R,i,g,U))}),Br(S,[R,U])},onEnterCancelled(R){A(R,!1,void 0,!0),Br(y,[R])},onAppearCancelled(R){A(R,!0,void 0,!0),Br(_,[R])},onLeaveCancelled(R){P(R),Br(C,[R])}})}function f2(s){if(s==null)return null;if(Pt(s))return[Ou(s.enter),Ou(s.leave)];{const e=Ou(s);return[e,e]}}function Ou(s){return dM(s)}function xn(s,e){e.split(/\s+/).forEach(t=>t&&s.classList.add(t)),(s[gl]||(s[gl]=new Set)).add(e)}function Nr(s,e){e.split(/\s+/).forEach(i=>i&&s.classList.remove(i));const t=s[gl];t&&(t.delete(e),t.size||(s[gl]=void 0))}function dg(s){requestAnimationFrame(()=>{requestAnimationFrame(s)})}let m2=0;function fg(s,e,t,i){const n=s._endId=++m2,r=()=>{n===s._endId&&i()};if(t!=null)return setTimeout(r,t);const{type:o,timeout:a,propCount:c}=p2(s,e);if(!o)return i();const l=o+"end";let h=0;const u=()=>{s.removeEventListener(l,d),r()},d=f=>{f.target===s&&++h>=c&&u()};setTimeout(()=>{h<c&&u()},a+1),s.addEventListener(l,d)}function p2(s,e){const t=window.getComputedStyle(s),i=m=>(t[m]||"").split(", "),n=i(`${Qn}Delay`),r=i(`${Qn}Duration`),o=mg(n,r),a=i(`${Ia}Delay`),c=i(`${Ia}Duration`),l=mg(a,c);let h=null,u=0,d=0;e===Qn?o>0&&(h=Qn,u=o,d=r.length):e===Ia?l>0&&(h=Ia,u=l,d=c.length):(u=Math.max(o,l),h=u>0?o>l?Qn:Ia:null,d=h?h===Qn?r.length:c.length:0);const f=h===Qn&&/\b(?:transform|all)(?:,|$)/.test(i(`${Qn}Property`).toString());return{type:h,timeout:u,propCount:d,hasTransform:f}}function mg(s,e){for(;s.length<e.length;)s=s.concat(s);return Math.max(...e.map((t,i)=>pg(t)+pg(s[i])))}function pg(s){return s==="auto"?0:Number(s.slice(0,-1).replace(",","."))*1e3}function gg(s){return(s?s.ownerDocument:document).body.offsetHeight}function g2(s,e,t){const i=s[gl];i&&(e=(e?[e,...i]:[...i]).join(" ")),e==null?s.removeAttribute("class"):t?s.setAttribute("class",e):s.className=e}const eh=Symbol("_vod"),Yx=Symbol("_vsh"),Si={name:"show",beforeMount(s,{value:e},{transition:t}){s[eh]=s.style.display==="none"?"":s.style.display,t&&e?t.beforeEnter(s):Ra(s,e)},mounted(s,{value:e},{transition:t}){t&&e&&t.enter(s)},updated(s,{value:e,oldValue:t},{transition:i}){!e!=!t&&(i?e?(i.beforeEnter(s),Ra(s,!0),i.enter(s)):i.leave(s,()=>{Ra(s,!1)}):Ra(s,e))},beforeUnmount(s,{value:e}){Ra(s,e)}};function Ra(s,e){s.style.display=e?s[eh]:"none",s[Yx]=!e}const v2=Symbol(""),y2=/(?:^|;)\s*display\s*:/;function x2(s,e,t){const i=s.style,n=Gt(t);let r=!1;if(t&&!n){if(e)if(Gt(e))for(const o of e.split(";")){const a=o.slice(0,o.indexOf(":")).trim();t[a]==null&&Ua(i,a,"")}else for(const o in e)t[o]==null&&Ua(i,o,"");for(const o in t){o==="display"&&(r=!0);const a=t[o];a!=null?w2(s,o,!Gt(e)&&e?e[o]:void 0,a)||Ua(i,o,a):Ua(i,o,"")}}else if(n){if(e!==t){const o=i[v2];o&&(t+=";"+o),i.cssText=t,r=y2.test(t)}}else e&&s.removeAttribute("style");eh in s&&(s[eh]=r?i.display:"",s[Yx]&&(i.display="none"))}const vg=/\s*!important$/;function Ua(s,e,t){if(ze(t))t.forEach(i=>Ua(s,e,i));else if(t==null&&(t=""),e.startsWith("--"))s.setProperty(e,t);else{const i=b2(s,e);vg.test(t)?s.setProperty(Ir(i),t.replace(vg,""),"important"):s[i]=t}}const yg=["Webkit","Moz","ms"],Lu={};function b2(s,e){const t=Lu[e];if(t)return t;let i=ks(e);if(i!=="filter"&&i in s)return Lu[e]=i;i=Ly(i);for(let n=0;n<yg.length;n++){const r=yg[n]+i;if(r in s)return Lu[e]=r}return e}function w2(s,e,t,i){return s.tagName==="TEXTAREA"&&(e==="width"||e==="height")&&Gt(i)&&t===i}const xg="http://www.w3.org/1999/xlink";function bg(s,e,t,i,n,r=yM(e)){i&&e.startsWith("xlink:")?t==null?s.removeAttributeNS(xg,e.slice(6,e.length)):s.setAttributeNS(xg,e,t):t==null||r&&!Ny(t)?s.removeAttribute(e):s.setAttribute(e,r?"":rs(t)?String(t):t)}function wg(s,e,t,i,n){if(e==="innerHTML"||e==="textContent"){t!=null&&(s[e]=e==="innerHTML"?Xx(t):t);return}const r=s.tagName;if(e==="value"&&r!=="PROGRESS"&&!r.includes("-")){const a=r==="OPTION"?s.getAttribute("value")||"":s.value,c=t==null?s.type==="checkbox"?"on":"":String(t);(a!==c||!("_value"in s))&&(s.value=c),t==null&&s.removeAttribute(e),s._value=t;return}let o=!1;if(t===""||t==null){const a=typeof s[e];a==="boolean"?t=Ny(t):t==null&&a==="string"?(t="",o=!0):a==="number"&&(t=0,o=!0)}try{s[e]=t}catch{}o&&s.removeAttribute(n||e)}function fr(s,e,t,i){s.addEventListener(e,t,i)}function S2(s,e,t,i){s.removeEventListener(e,t,i)}const Sg=Symbol("_vei");function M2(s,e,t,i,n=null){const r=s[Sg]||(s[Sg]={}),o=r[e];if(i&&o)o.value=i;else{const[a,c]=C2(e);if(i){const l=r[e]=I2(i,n);fr(s,a,l,c)}else o&&(S2(s,a,o,c),r[e]=void 0)}}const T2=/(Once|Passive|Capture)$/,_2=/^on:?(?:Once|Passive|Capture)$/;function C2(s){let e,t;for(;(t=s.match(T2))&&!_2.test(s);)e||(e={}),s=s.slice(0,s.length-t[1].length),e[t[1].toLowerCase()]=!0;return[s[2]===":"?s.slice(3):Ir(s.slice(2)),e]}let Bu=0;const E2=Promise.resolve(),A2=()=>Bu||(E2.then(()=>Bu=0),Bu=Date.now());function I2(s,e){const t=i=>{if(!i._vts)i._vts=Date.now();else if(i._vts<=t.attached)return;const n=t.value;if(ze(n)){const r=i.stopImmediatePropagation;i.stopImmediatePropagation=()=>{r.call(i),i._stopped=!0};const o=n.slice(),a=[i];for(let c=0;c<o.length&&!i._stopped;c++){const l=o[c];l&&gs(l,e,5,a)}}else gs(n,e,5,[i])};return t.value=s,t.attached=A2(),t}const Mg=s=>s.charCodeAt(0)===111&&s.charCodeAt(1)===110&&s.charCodeAt(2)>96&&s.charCodeAt(2)<123,R2=(s,e,t,i,n,r)=>{const o=n==="svg";e==="class"?g2(s,i,o):e==="style"?x2(s,t,i):Xh(e)?Vh(e)||M2(s,e,t,i,r):(e[0]==="."?(e=e.slice(1),!0):e[0]==="^"?(e=e.slice(1),!1):P2(s,e,i,o))?(wg(s,e,i),!s.tagName.includes("-")&&(e==="value"||e==="checked"||e==="selected")&&bg(s,e,i,o,r,e!=="value")):s._isVueCE&&(k2(s,e)||s._def.__asyncLoader&&(/[A-Z]/.test(e)||!Gt(i)))?wg(s,ks(e),i,r,e):(e==="true-value"?s._trueValue=i:e==="false-value"&&(s._falseValue=i),bg(s,e,i,o))};function P2(s,e,t,i){if(i)return!!(e==="innerHTML"||e==="textContent"||e in s&&Mg(e)&&at(t));if(e==="spellcheck"||e==="draggable"||e==="translate"||e==="autocorrect"||e==="sandbox"&&s.tagName==="IFRAME"||e==="form"||e==="list"&&s.tagName==="INPUT"||e==="type"&&s.tagName==="TEXTAREA")return!1;if(e==="width"||e==="height"){const n=s.tagName;if(n==="IMG"||n==="VIDEO"||n==="CANVAS"||n==="SOURCE")return!1}return Mg(e)&&Gt(t)?!1:e in s}function k2(s,e){const t=s._def.props;if(!t)return!1;const i=ks(e);return Array.isArray(t)?t.some(n=>ks(n)===i):Object.keys(t).some(n=>ks(n)===i)}const la=s=>{const e=s.props["onUpdate:modelValue"]||!1;return ze(e)?t=>Ec(e,t):e};function F2(s){s.target.composing=!0}function Tg(s){const e=s.target;e.composing&&(e.composing=!1,e.dispatchEvent(new Event("input")))}const rn=Symbol("_assign"),Hl=Symbol("_initialValue");function Nu(s,e,t){return e&&(s=s.trim()),t&&(s=jh(s)),s}const He={created(s,{modifiers:{lazy:e,trim:t,number:i}},n){s.parentNode&&(s.type==="text"?s[Hl]=s.defaultValue.replace(/[\r\n]/g,""):s.type==="textarea"&&(s[Hl]=s.defaultValue.replace(/\r\n?/g,`
|
||
`))),s[rn]=la(n);const r=i||n.props&&n.props.type==="number";fr(s,e?"change":"input",o=>{o.target.composing||s[rn](Nu(s.value,t,r))}),(t||r)&&fr(s,"change",()=>{s.value=Nu(s.value,t,r)}),e||(fr(s,"compositionstart",F2),fr(s,"compositionend",Tg),fr(s,"change",Tg))},mounted(s,{value:e,modifiers:{trim:t,number:i}}){const n=e??"",r=s[Hl];delete s[Hl],r!==void 0&&(s.type==="text"||s.type==="textarea")&&s.value!==r?s[rn](Nu(s.value,t,i)):s.value=n},beforeUpdate(s,{value:e,oldValue:t,modifiers:{lazy:i,trim:n,number:r}},o){if(s[rn]=la(o),s.composing)return;const a=(r||s.type==="number")&&!/^0\d/.test(s.value)?jh(s.value):s.value,c=e??"";if(a===c)return;const l=s.getRootNode();(l instanceof Document||l instanceof ShadowRoot)&&l.activeElement===s&&s.type!=="range"&&(i&&e===t||n&&s.value.trim()===c)||(s.value=c)}},wt={deep:!0,created(s,e,t){s[rn]=la(t),fr(s,"change",()=>{const i=s._modelValue,n=vl(s),r=s.checked,o=s[rn];if(ze(i)){const a=Zm(i,n),c=a!==-1;if(r&&!c)o(i.concat(n));else if(!r&&c){const l=[...i];l.splice(a,1),o(l)}}else if(pa(i)){const a=new Set(i);r?a.add(n):a.delete(n),o(a)}else o(Gx(s,r))})},mounted:_g,beforeUpdate(s,e,t){s[rn]=la(t),_g(s,e,t)}};function _g(s,{value:e,oldValue:t},i){s._modelValue=e;let n;if(ze(e))n=Zm(e,i.props.value)>-1;else if(pa(e))n=e.has(i.props.value);else{if(e===t)return;n=ga(e,Gx(s,!0))}s.checked!==n&&(s.checked=n)}const bt={deep:!0,created(s,{value:e,modifiers:{number:t}},i){s._modelValue=e,fr(s,"change",()=>{const n=Array.prototype.filter.call(s.options,r=>r.selected).map(r=>t?jh(vl(r)):vl(r));s[rn](s.multiple?pa(s._modelValue)?new Set(n):n:n[0]),s._assigning=!0,Kh(()=>{s._assigning=!1})}),s[rn]=la(i)},mounted(s,{value:e}){Cg(s,e)},beforeUpdate(s,{value:e},t){s._modelValue=e,s[rn]=la(t)},updated(s,{value:e}){s._assigning||Cg(s,e)}};function Cg(s,e){const t=s.multiple,i=ze(e);if(!(t&&!i&&!pa(e))){for(let n=0,r=s.options.length;n<r;n++){const o=s.options[n],a=vl(o);if(t)if(i){const c=typeof a;c==="string"||c==="number"?o.selected=e.some(l=>String(l)===String(a)):o.selected=Zm(e,a)>-1}else o.selected=e.has(a);else if(ga(vl(o),e)){s.selectedIndex!==n&&(s.selectedIndex=n);return}}!t&&s.selectedIndex!==-1&&(s.selectedIndex=-1)}}function vl(s){return"_value"in s?s._value:s.value}function Gx(s,e){const t=e?"_trueValue":"_falseValue";return t in s?s[t]:e}const O2=["ctrl","shift","alt","meta"],L2={stop:s=>s.stopPropagation(),prevent:s=>s.preventDefault(),self:s=>s.target!==s.currentTarget,ctrl:s=>!s.ctrlKey,shift:s=>!s.shiftKey,alt:s=>!s.altKey,meta:s=>!s.metaKey,left:s=>"button"in s&&s.button!==0,middle:s=>"button"in s&&s.button!==1,right:s=>"button"in s&&s.button!==2,exact:(s,e)=>O2.some(t=>s[`${t}Key`]&&!e.includes(t))},qe=(s,e)=>{if(!s)return s;const t=s._withMods||(s._withMods={}),i=e.join(".");return t[i]||(t[i]=((n,...r)=>{for(let o=0;o<e.length;o++){const a=L2[e[o]];if(a&&a(n,e))return}return s(n,...r)}))},B2={esc:"escape",space:" ",up:"arrow-up",left:"arrow-left",right:"arrow-right",down:"arrow-down",delete:"backspace"},Mr=(s,e)=>{const t=s._withKeys||(s._withKeys={}),i=e.join(".");return t[i]||(t[i]=(n=>{if(!("key"in n))return;const r=Ir(n.key);if(e.some(o=>o===r||B2[o]===r))return s(n)}))},N2=pi({patchProp:R2},l2);let Eg;function D2(){return Eg||(Eg=VT(N2))}const U2=((...s)=>{const e=D2().createApp(...s),{mount:t}=e;return e.mount=i=>{const n=X2(i);if(!n)return;const r=e._component;!at(r)&&!r.render&&!r.template&&(r.template=n.innerHTML),n.nodeType===1&&(n.textContent="");const o=t(n,!1,$2(n));return n instanceof Element&&(n.removeAttribute("v-cloak"),n.setAttribute("data-v-app","")),o},e});function $2(s){if(s instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&s instanceof MathMLElement)return"mathml"}function X2(s){return Gt(s)?document.querySelector(s):s}/*!
|
||
* pinia v4.0.3
|
||
* (c) 2026 Eduardo San Martin Morote
|
||
* @license MIT
|
||
*/let jx;const nu=s=>jx=s,Hx=Symbol();function Ag(s){return s&&typeof s=="object"&&Object.prototype.toString.call(s)==="[object Object]"&&typeof s.toJSON!="function"}function V2(){const s=Xy(!0),e=s.run(()=>Fe({}));let t=[],i=[];const n=vr({install(r){nu(n),n._a=r,r.provide(Hx,n),r.config.globalProperties.$pinia=n,i.forEach(o=>t.push(o)),i=[]},use(r){return this._a?t.push(r):i.push(r),this},_p:t,_a:null,_e:s,_s:new Map,state:e});return n}const Of=()=>{};function Ig(s,e,t,i=Of){s.add(e);const n=()=>{s.delete(e)&&i()};return!t&&Vy()&&bM(n),n}function _o(s,...e){s.forEach(t=>{t(...e)})}const Y2=s=>s(),Rg=Symbol(),Du=Symbol();function Lf(s,e){s instanceof Map&&e instanceof Map?e.forEach((t,i)=>s.set(i,t)):s instanceof Set&&e instanceof Set&&e.forEach(s.add,s);for(const t in e){if(!Object.hasOwn(e,t))continue;const i=e[t],n=s[t];Ag(n)&&Ag(i)&&Object.hasOwn(s,t)&&!jt(i)&&!Un(i)?s[t]=Lf(n,i):s[t]=i}return s}const G2=Symbol();function j2(s){return!s||typeof s!="object"||!Object.hasOwn(s,G2)}const{assign:nr}=Object;function H2(s){return!!(jt(s)&&s.effect)}function W2(s,e,t,i){const{state:n,actions:r,getters:o}=e,a=t.state.value[s];let c;function l(){a||(t.state.value[s]=n?n():{});const h=YM(t.state.value[s]);return nr(h,r,Object.keys(o||{}).reduce((u,d)=>(u[d]=vr(Le(()=>{nu(t);const f=t._s.get(s);return o[d].call(f,f)})),u),{}))}return c=Wx(s,l,e,t,i,!0),c}function Wx(s,e,t={},i,n,r){let o;const a=nr({actions:{}},t),c={deep:!0};let l,h,u=new Set,d=new Set,f;const m=i.state.value[s];!r&&!m&&(i.state.value[s]={});let p;function g(b){let _;l=h=!1,typeof b=="function"?(b(i.state.value[s]),_={type:"patch function",storeId:s,events:f}):(Lf(i.state.value[s],b),_={type:"patch object",payload:b,storeId:s,events:f});const A=p=Symbol();Kh().then(()=>{p===A&&(l=!0)}),h=!0,_o(u,_,i.state.value[s])}const x=r?function(){const{state:_}=t,A=_?_():{};this.$patch(P=>{nr(P,A)})}:Of;function v(){o.stop(),u.clear(),d.clear(),i._s.delete(s)}const y=(b,_="")=>{if(Rg in b)return b[Du]=_,b;const A=function(){nu(i);const P=Array.from(arguments),E=new Set,R=new Set;function O($){E.add($)}function U($){R.add($)}_o(d,{args:P,name:A[Du],store:C,after:O,onError:U});let Y;try{Y=b.apply(this&&this.$id===s?this:C,P)}catch($){throw _o(R,$),$}return Y instanceof Promise?Y.then($=>(_o(E,$),$)).catch($=>(_o(R,$),Promise.reject($))):(_o(E,Y),Y)};return A[Rg]=!0,A[Du]=_,A},S={_p:i,$id:s,$onAction:Ig.bind(null,d),$patch:g,$reset:x,$subscribe(b,_={}){if(u.has(b))return Of;const A=Ig(u,b,_.detached,()=>P()),P=o.run(()=>ai(()=>i.state.value[s],E=>{(_.flush==="sync"?h:l)&&b({storeId:s,type:"direct",events:f},E)},nr({},c,_)));return A},$dispose:v},C=po(S);i._s.set(s,C);const w=(i._a&&i._a.runWithContext||Y2)(()=>i._e.run(()=>(o=Xy()).run(()=>e({action:y}))));for(const b in w){const _=w[b];jt(_)&&!H2(_)||Un(_)?r||(m&&j2(_)&&(jt(_)?_.value=m[b]:((_ instanceof Set||_ instanceof Map)&&_.clear(),Lf(_,m[b]))),i.state.value[s][b]=_):typeof _=="function"&&(w[b]=y(_,b),a.actions[b]=_)}return nr(C,w),nr(Tt(C),w),Object.defineProperty(C,"$state",{get:()=>i.state.value[s],set:b=>{g(_=>{nr(_,b)})}}),i._p.forEach(b=>{const _=o.run(()=>b({store:C,app:i._a,pinia:i,options:a}));nr(C,_)}),m&&r&&t.hydrate&&t.hydrate(C.$state,m),l=!0,h=!0,C}/*! #__NO_SIDE_EFFECTS__ */function z2(s,e,t){let i;const n=typeof e=="function";i=n?t:e;function r(o,a){const c=QM();return o=o||(c?qo(Hx,null):null),o&&nu(o),o=jx,o._s.has(s)||(n?Wx(s,e,i,o):W2(s,i,o)),o._s.get(s)}return r.$id=s,r}var go=(s=>(s[s.WEBGL_LEGACY=0]="WEBGL_LEGACY",s[s.WEBGL=1]="WEBGL",s[s.WEBGL2=2]="WEBGL2",s))(go||{}),zx=(s=>(s[s.UNKNOWN=0]="UNKNOWN",s[s.WEBGL=1]="WEBGL",s[s.CANVAS=2]="CANVAS",s))(zx||{}),Bf=(s=>(s[s.COLOR=16384]="COLOR",s[s.DEPTH=256]="DEPTH",s[s.STENCIL=1024]="STENCIL",s))(Bf||{}),We=(s=>(s[s.NORMAL=0]="NORMAL",s[s.ADD=1]="ADD",s[s.MULTIPLY=2]="MULTIPLY",s[s.SCREEN=3]="SCREEN",s[s.OVERLAY=4]="OVERLAY",s[s.DARKEN=5]="DARKEN",s[s.LIGHTEN=6]="LIGHTEN",s[s.COLOR_DODGE=7]="COLOR_DODGE",s[s.COLOR_BURN=8]="COLOR_BURN",s[s.HARD_LIGHT=9]="HARD_LIGHT",s[s.SOFT_LIGHT=10]="SOFT_LIGHT",s[s.DIFFERENCE=11]="DIFFERENCE",s[s.EXCLUSION=12]="EXCLUSION",s[s.HUE=13]="HUE",s[s.SATURATION=14]="SATURATION",s[s.COLOR=15]="COLOR",s[s.LUMINOSITY=16]="LUMINOSITY",s[s.NORMAL_NPM=17]="NORMAL_NPM",s[s.ADD_NPM=18]="ADD_NPM",s[s.SCREEN_NPM=19]="SCREEN_NPM",s[s.NONE=20]="NONE",s[s.SRC_OVER=0]="SRC_OVER",s[s.SRC_IN=21]="SRC_IN",s[s.SRC_OUT=22]="SRC_OUT",s[s.SRC_ATOP=23]="SRC_ATOP",s[s.DST_OVER=24]="DST_OVER",s[s.DST_IN=25]="DST_IN",s[s.DST_OUT=26]="DST_OUT",s[s.DST_ATOP=27]="DST_ATOP",s[s.ERASE=26]="ERASE",s[s.SUBTRACT=28]="SUBTRACT",s[s.XOR=29]="XOR",s))(We||{}),on=(s=>(s[s.POINTS=0]="POINTS",s[s.LINES=1]="LINES",s[s.LINE_LOOP=2]="LINE_LOOP",s[s.LINE_STRIP=3]="LINE_STRIP",s[s.TRIANGLES=4]="TRIANGLES",s[s.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",s[s.TRIANGLE_FAN=6]="TRIANGLE_FAN",s))(on||{}),Te=(s=>(s[s.RGBA=6408]="RGBA",s[s.RGB=6407]="RGB",s[s.RG=33319]="RG",s[s.RED=6403]="RED",s[s.RGBA_INTEGER=36249]="RGBA_INTEGER",s[s.RGB_INTEGER=36248]="RGB_INTEGER",s[s.RG_INTEGER=33320]="RG_INTEGER",s[s.RED_INTEGER=36244]="RED_INTEGER",s[s.ALPHA=6406]="ALPHA",s[s.LUMINANCE=6409]="LUMINANCE",s[s.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",s[s.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",s[s.DEPTH_STENCIL=34041]="DEPTH_STENCIL",s))(Te||{}),Zo=(s=>(s[s.TEXTURE_2D=3553]="TEXTURE_2D",s[s.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",s[s.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",s[s.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",s[s.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",s[s.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",s[s.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",s[s.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",s[s.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",s))(Zo||{}),Ue=(s=>(s[s.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",s[s.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",s[s.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",s[s.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",s[s.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",s[s.UNSIGNED_INT=5125]="UNSIGNED_INT",s[s.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",s[s.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",s[s.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",s[s.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",s[s.BYTE=5120]="BYTE",s[s.SHORT=5122]="SHORT",s[s.INT=5124]="INT",s[s.FLOAT=5126]="FLOAT",s[s.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",s[s.HALF_FLOAT=36193]="HALF_FLOAT",s))(Ue||{}),De=(s=>(s[s.FLOAT=0]="FLOAT",s[s.INT=1]="INT",s[s.UINT=2]="UINT",s))(De||{}),Rs=(s=>(s[s.NEAREST=0]="NEAREST",s[s.LINEAR=1]="LINEAR",s))(Rs||{}),Os=(s=>(s[s.CLAMP=33071]="CLAMP",s[s.REPEAT=10497]="REPEAT",s[s.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",s))(Os||{}),vs=(s=>(s[s.OFF=0]="OFF",s[s.POW2=1]="POW2",s[s.ON=2]="ON",s[s.ON_MANUAL=3]="ON_MANUAL",s))(vs||{}),bi=(s=>(s[s.NPM=0]="NPM",s[s.UNPACK=1]="UNPACK",s[s.PMA=2]="PMA",s[s.NO_PREMULTIPLIED_ALPHA=0]="NO_PREMULTIPLIED_ALPHA",s[s.PREMULTIPLY_ON_UPLOAD=1]="PREMULTIPLY_ON_UPLOAD",s[s.PREMULTIPLIED_ALPHA=2]="PREMULTIPLIED_ALPHA",s))(bi||{}),en=(s=>(s[s.NO=0]="NO",s[s.YES=1]="YES",s[s.AUTO=2]="AUTO",s[s.BLEND=0]="BLEND",s[s.CLEAR=1]="CLEAR",s[s.BLIT=2]="BLIT",s))(en||{}),up=(s=>(s[s.AUTO=0]="AUTO",s[s.MANUAL=1]="MANUAL",s))(up||{}),ms=(s=>(s.LOW="lowp",s.MEDIUM="mediump",s.HIGH="highp",s))(ms||{}),ui=(s=>(s[s.NONE=0]="NONE",s[s.SCISSOR=1]="SCISSOR",s[s.STENCIL=2]="STENCIL",s[s.SPRITE=3]="SPRITE",s[s.COLOR=4]="COLOR",s))(ui||{}),ci=(s=>(s[s.NONE=0]="NONE",s[s.LOW=2]="LOW",s[s.MEDIUM=4]="MEDIUM",s[s.HIGH=8]="HIGH",s))(ci||{}),hn=(s=>(s[s.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",s[s.ARRAY_BUFFER=34962]="ARRAY_BUFFER",s[s.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",s))(hn||{});const q2={createCanvas:(s,e)=>{const t=document.createElement("canvas");return t.width=s,t.height=e,t},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(s,e)=>fetch(s,e),parseXML:s=>new DOMParser().parseFromString(s,"text/xml")},Be={ADAPTER:q2,RESOLUTION:1,CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1};var Uu=/iPhone/i,Pg=/iPod/i,kg=/iPad/i,Fg=/\biOS-universal(?:.+)Mac\b/i,$u=/\bAndroid(?:.+)Mobile\b/i,Og=/Android/i,Co=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,Wl=/Silk/i,bn=/Windows Phone/i,Lg=/\bWindows(?:.+)ARM\b/i,Bg=/BlackBerry/i,Ng=/BB10/i,Dg=/Opera Mini/i,Ug=/\b(CriOS|Chrome)(?:.+)Mobile/i,$g=/Mobile(?:.+)Firefox\b/i,Xg=function(s){return typeof s<"u"&&s.platform==="MacIntel"&&typeof s.maxTouchPoints=="number"&&s.maxTouchPoints>1&&typeof MSStream>"u"};function K2(s){return function(e){return e.test(s)}}function Vg(s){var e={userAgent:"",platform:"",maxTouchPoints:0};!s&&typeof navigator<"u"?e={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0}:typeof s=="string"?e.userAgent=s:s&&s.userAgent&&(e={userAgent:s.userAgent,platform:s.platform,maxTouchPoints:s.maxTouchPoints||0});var t=e.userAgent,i=t.split("[FBAN");typeof i[1]<"u"&&(t=i[0]),i=t.split("Twitter"),typeof i[1]<"u"&&(t=i[0]);var n=K2(t),r={apple:{phone:n(Uu)&&!n(bn),ipod:n(Pg),tablet:!n(Uu)&&(n(kg)||Xg(e))&&!n(bn),universal:n(Fg),device:(n(Uu)||n(Pg)||n(kg)||n(Fg)||Xg(e))&&!n(bn)},amazon:{phone:n(Co),tablet:!n(Co)&&n(Wl),device:n(Co)||n(Wl)},android:{phone:!n(bn)&&n(Co)||!n(bn)&&n($u),tablet:!n(bn)&&!n(Co)&&!n($u)&&(n(Wl)||n(Og)),device:!n(bn)&&(n(Co)||n(Wl)||n($u)||n(Og))||n(/\bokhttp\b/i)},windows:{phone:n(bn),tablet:n(Lg),device:n(bn)||n(Lg)},other:{blackberry:n(Bg),blackberry10:n(Ng),opera:n(Dg),firefox:n($g),chrome:n(Ug),device:n(Bg)||n(Ng)||n(Dg)||n($g)||n(Ug)},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 Z2=Vg.default??Vg,kn=Z2(globalThis.navigator);Be.RETINA_PREFIX=/@([0-9\.]+)x/;Be.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!1;var th=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function qx(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}function J2(s){if(Object.prototype.hasOwnProperty.call(s,"__esModule"))return s;var e=s.default;if(typeof e=="function"){var t=function i(){return this instanceof i?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(s).forEach(function(i){var n=Object.getOwnPropertyDescriptor(s,i);Object.defineProperty(t,i,n.get?n:{enumerable:!0,get:function(){return s[i]}})}),t}var Xu={exports:{}},Yg;function Q2(){return Yg||(Yg=1,(function(s){var e=Object.prototype.hasOwnProperty,t="~";function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(t=!1));function n(c,l,h){this.fn=c,this.context=l,this.once=h||!1}function r(c,l,h,u,d){if(typeof h!="function")throw new TypeError("The listener must be a function");var f=new n(h,u||c,d),m=t?t+l:l;return c._events[m]?c._events[m].fn?c._events[m]=[c._events[m],f]:c._events[m].push(f):(c._events[m]=f,c._eventsCount++),c}function o(c,l){--c._eventsCount===0?c._events=new i:delete c._events[l]}function a(){this._events=new i,this._eventsCount=0}a.prototype.eventNames=function(){var l=[],h,u;if(this._eventsCount===0)return l;for(u in h=this._events)e.call(h,u)&&l.push(t?u.slice(1):u);return Object.getOwnPropertySymbols?l.concat(Object.getOwnPropertySymbols(h)):l},a.prototype.listeners=function(l){var h=t?t+l:l,u=this._events[h];if(!u)return[];if(u.fn)return[u.fn];for(var d=0,f=u.length,m=new Array(f);d<f;d++)m[d]=u[d].fn;return m},a.prototype.listenerCount=function(l){var h=t?t+l:l,u=this._events[h];return u?u.fn?1:u.length:0},a.prototype.emit=function(l,h,u,d,f,m){var p=t?t+l:l;if(!this._events[p])return!1;var g=this._events[p],x=arguments.length,v,y;if(g.fn){switch(g.once&&this.removeListener(l,g.fn,void 0,!0),x){case 1:return g.fn.call(g.context),!0;case 2:return g.fn.call(g.context,h),!0;case 3:return g.fn.call(g.context,h,u),!0;case 4:return g.fn.call(g.context,h,u,d),!0;case 5:return g.fn.call(g.context,h,u,d,f),!0;case 6:return g.fn.call(g.context,h,u,d,f,m),!0}for(y=1,v=new Array(x-1);y<x;y++)v[y-1]=arguments[y];g.fn.apply(g.context,v)}else{var S=g.length,C;for(y=0;y<S;y++)switch(g[y].once&&this.removeListener(l,g[y].fn,void 0,!0),x){case 1:g[y].fn.call(g[y].context);break;case 2:g[y].fn.call(g[y].context,h);break;case 3:g[y].fn.call(g[y].context,h,u);break;case 4:g[y].fn.call(g[y].context,h,u,d);break;default:if(!v)for(C=1,v=new Array(x-1);C<x;C++)v[C-1]=arguments[C];g[y].fn.apply(g[y].context,v)}}return!0},a.prototype.on=function(l,h,u){return r(this,l,h,u,!1)},a.prototype.once=function(l,h,u){return r(this,l,h,u,!0)},a.prototype.removeListener=function(l,h,u,d){var f=t?t+l:l;if(!this._events[f])return this;if(!h)return o(this,f),this;var m=this._events[f];if(m.fn)m.fn===h&&(!d||m.once)&&(!u||m.context===u)&&o(this,f);else{for(var p=0,g=[],x=m.length;p<x;p++)(m[p].fn!==h||d&&!m[p].once||u&&m[p].context!==u)&&g.push(m[p]);g.length?this._events[f]=g.length===1?g[0]:g:o(this,f)}return this},a.prototype.removeAllListeners=function(l){var h;return l?(h=t?t+l:l,this._events[h]&&o(this,h)):(this._events=new i,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=t,a.EventEmitter=a,s.exports=a})(Xu)),Xu.exports}var e_=Q2();const Rl=qx(e_);var zl={exports:{}},Gg;function t_(){if(Gg)return zl.exports;Gg=1,zl.exports=s,zl.exports.default=s;function s($,X,D){D=D||2;var F=X&&X.length,N=F?X[0]*D:$.length,k=e($,0,N,D,!0),V=[];if(!k||k.next===k.prev)return V;var G,W,Z,ne,oe,de,pe;if(F&&(k=c($,X,k,D)),$.length>80*D){G=Z=$[0],W=ne=$[1];for(var he=D;he<N;he+=D)oe=$[he],de=$[he+1],oe<G&&(G=oe),de<W&&(W=de),oe>Z&&(Z=oe),de>ne&&(ne=de);pe=Math.max(Z-G,ne-W),pe=pe!==0?32767/pe:0}return i(k,V,D,G,W,pe,0),V}function e($,X,D,F,N){var k,V;if(N===Y($,X,D,F)>0)for(k=X;k<D;k+=F)V=R(k,$[k],$[k+1],V);else for(k=D-F;k>=X;k-=F)V=R(k,$[k],$[k+1],V);return V&&S(V,V.next)&&(O(V),V=V.next),V}function t($,X){if(!$)return $;X||(X=$);var D=$,F;do if(F=!1,!D.steiner&&(S(D,D.next)||y(D.prev,D,D.next)===0)){if(O(D),D=X=D.prev,D===D.next)break;F=!0}else D=D.next;while(F||D!==X);return X}function i($,X,D,F,N,k,V){if($){!V&&k&&f($,F,N,k);for(var G=$,W,Z;$.prev!==$.next;){if(W=$.prev,Z=$.next,k?r($,F,N,k):n($)){X.push(W.i/D|0),X.push($.i/D|0),X.push(Z.i/D|0),O($),$=Z.next,G=Z.next;continue}if($=Z,$===G){V?V===1?($=o(t($),X,D),i($,X,D,F,N,k,2)):V===2&&a($,X,D,F,N,k):i(t($),X,D,F,N,k,1);break}}}}function n($){var X=$.prev,D=$,F=$.next;if(y(X,D,F)>=0)return!1;for(var N=X.x,k=D.x,V=F.x,G=X.y,W=D.y,Z=F.y,ne=N<k?N<V?N:V:k<V?k:V,oe=G<W?G<Z?G:Z:W<Z?W:Z,de=N>k?N>V?N:V:k>V?k:V,pe=G>W?G>Z?G:Z:W>Z?W:Z,he=F.next;he!==X;){if(he.x>=ne&&he.x<=de&&he.y>=oe&&he.y<=pe&&x(N,G,k,W,V,Z,he.x,he.y)&&y(he.prev,he,he.next)>=0)return!1;he=he.next}return!0}function r($,X,D,F){var N=$.prev,k=$,V=$.next;if(y(N,k,V)>=0)return!1;for(var G=N.x,W=k.x,Z=V.x,ne=N.y,oe=k.y,de=V.y,pe=G<W?G<Z?G:Z:W<Z?W:Z,he=ne<oe?ne<de?ne:de:oe<de?oe:de,me=G>W?G>Z?G:Z:W>Z?W:Z,H=ne>oe?ne>de?ne:de:oe>de?oe:de,z=p(pe,he,X,D,F),K=p(me,H,X,D,F),B=$.prevZ,L=$.nextZ;B&&B.z>=z&&L&&L.z<=K;){if(B.x>=pe&&B.x<=me&&B.y>=he&&B.y<=H&&B!==N&&B!==V&&x(G,ne,W,oe,Z,de,B.x,B.y)&&y(B.prev,B,B.next)>=0||(B=B.prevZ,L.x>=pe&&L.x<=me&&L.y>=he&&L.y<=H&&L!==N&&L!==V&&x(G,ne,W,oe,Z,de,L.x,L.y)&&y(L.prev,L,L.next)>=0))return!1;L=L.nextZ}for(;B&&B.z>=z;){if(B.x>=pe&&B.x<=me&&B.y>=he&&B.y<=H&&B!==N&&B!==V&&x(G,ne,W,oe,Z,de,B.x,B.y)&&y(B.prev,B,B.next)>=0)return!1;B=B.prevZ}for(;L&&L.z<=K;){if(L.x>=pe&&L.x<=me&&L.y>=he&&L.y<=H&&L!==N&&L!==V&&x(G,ne,W,oe,Z,de,L.x,L.y)&&y(L.prev,L,L.next)>=0)return!1;L=L.nextZ}return!0}function o($,X,D){var F=$;do{var N=F.prev,k=F.next.next;!S(N,k)&&C(N,F,F.next,k)&&A(N,k)&&A(k,N)&&(X.push(N.i/D|0),X.push(F.i/D|0),X.push(k.i/D|0),O(F),O(F.next),F=$=k),F=F.next}while(F!==$);return t(F)}function a($,X,D,F,N,k){var V=$;do{for(var G=V.next.next;G!==V.prev;){if(V.i!==G.i&&v(V,G)){var W=E(V,G);V=t(V,V.next),W=t(W,W.next),i(V,X,D,F,N,k,0),i(W,X,D,F,N,k,0);return}G=G.next}V=V.next}while(V!==$)}function c($,X,D,F){var N=[],k,V,G,W,Z;for(k=0,V=X.length;k<V;k++)G=X[k]*F,W=k<V-1?X[k+1]*F:$.length,Z=e($,G,W,F,!1),Z===Z.next&&(Z.steiner=!0),N.push(g(Z));for(N.sort(l),k=0;k<N.length;k++)D=h(N[k],D);return D}function l($,X){return $.x-X.x}function h($,X){var D=u($,X);if(!D)return X;var F=E(D,$);return t(F,F.next),t(D,D.next)}function u($,X){var D=X,F=$.x,N=$.y,k=-1/0,V;do{if(N<=D.y&&N>=D.next.y&&D.next.y!==D.y){var G=D.x+(N-D.y)*(D.next.x-D.x)/(D.next.y-D.y);if(G<=F&&G>k&&(k=G,V=D.x<D.next.x?D:D.next,G===F))return V}D=D.next}while(D!==X);if(!V)return null;var W=V,Z=V.x,ne=V.y,oe=1/0,de;D=V;do F>=D.x&&D.x>=Z&&F!==D.x&&x(N<ne?F:k,N,Z,ne,N<ne?k:F,N,D.x,D.y)&&(de=Math.abs(N-D.y)/(F-D.x),A(D,$)&&(de<oe||de===oe&&(D.x>V.x||D.x===V.x&&d(V,D)))&&(V=D,oe=de)),D=D.next;while(D!==W);return V}function d($,X){return y($.prev,$,X.prev)<0&&y(X.next,$,$.next)<0}function f($,X,D,F){var N=$;do N.z===0&&(N.z=p(N.x,N.y,X,D,F)),N.prevZ=N.prev,N.nextZ=N.next,N=N.next;while(N!==$);N.prevZ.nextZ=null,N.prevZ=null,m(N)}function m($){var X,D,F,N,k,V,G,W,Z=1;do{for(D=$,$=null,k=null,V=0;D;){for(V++,F=D,G=0,X=0;X<Z&&(G++,F=F.nextZ,!!F);X++);for(W=Z;G>0||W>0&&F;)G!==0&&(W===0||!F||D.z<=F.z)?(N=D,D=D.nextZ,G--):(N=F,F=F.nextZ,W--),k?k.nextZ=N:$=N,N.prevZ=k,k=N;D=F}k.nextZ=null,Z*=2}while(V>1);return $}function p($,X,D,F,N){return $=($-D)*N|0,X=(X-F)*N|0,$=($|$<<8)&16711935,$=($|$<<4)&252645135,$=($|$<<2)&858993459,$=($|$<<1)&1431655765,X=(X|X<<8)&16711935,X=(X|X<<4)&252645135,X=(X|X<<2)&858993459,X=(X|X<<1)&1431655765,$|X<<1}function g($){var X=$,D=$;do(X.x<D.x||X.x===D.x&&X.y<D.y)&&(D=X),X=X.next;while(X!==$);return D}function x($,X,D,F,N,k,V,G){return(N-V)*(X-G)>=($-V)*(k-G)&&($-V)*(F-G)>=(D-V)*(X-G)&&(D-V)*(k-G)>=(N-V)*(F-G)}function v($,X){return $.next.i!==X.i&&$.prev.i!==X.i&&!_($,X)&&(A($,X)&&A(X,$)&&P($,X)&&(y($.prev,$,X.prev)||y($,X.prev,X))||S($,X)&&y($.prev,$,$.next)>0&&y(X.prev,X,X.next)>0)}function y($,X,D){return(X.y-$.y)*(D.x-X.x)-(X.x-$.x)*(D.y-X.y)}function S($,X){return $.x===X.x&&$.y===X.y}function C($,X,D,F){var N=b(y($,X,D)),k=b(y($,X,F)),V=b(y(D,F,$)),G=b(y(D,F,X));return!!(N!==k&&V!==G||N===0&&w($,D,X)||k===0&&w($,F,X)||V===0&&w(D,$,F)||G===0&&w(D,X,F))}function w($,X,D){return X.x<=Math.max($.x,D.x)&&X.x>=Math.min($.x,D.x)&&X.y<=Math.max($.y,D.y)&&X.y>=Math.min($.y,D.y)}function b($){return $>0?1:$<0?-1:0}function _($,X){var D=$;do{if(D.i!==$.i&&D.next.i!==$.i&&D.i!==X.i&&D.next.i!==X.i&&C(D,D.next,$,X))return!0;D=D.next}while(D!==$);return!1}function A($,X){return y($.prev,$,$.next)<0?y($,X,$.next)>=0&&y($,$.prev,X)>=0:y($,X,$.prev)<0||y($,$.next,X)<0}function P($,X){var D=$,F=!1,N=($.x+X.x)/2,k=($.y+X.y)/2;do D.y>k!=D.next.y>k&&D.next.y!==D.y&&N<(D.next.x-D.x)*(k-D.y)/(D.next.y-D.y)+D.x&&(F=!F),D=D.next;while(D!==$);return F}function E($,X){var D=new U($.i,$.x,$.y),F=new U(X.i,X.x,X.y),N=$.next,k=X.prev;return $.next=X,X.prev=$,D.next=N,N.prev=D,F.next=D,D.prev=F,k.next=F,F.prev=k,F}function R($,X,D,F){var N=new U($,X,D);return F?(N.next=F.next,N.prev=F,F.next.prev=N,F.next=N):(N.prev=N,N.next=N),N}function O($){$.next.prev=$.prev,$.prev.next=$.next,$.prevZ&&($.prevZ.nextZ=$.nextZ),$.nextZ&&($.nextZ.prevZ=$.prevZ)}function U($,X,D){this.i=$,this.x=X,this.y=D,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}s.deviation=function($,X,D,F){var N=X&&X.length,k=N?X[0]*D:$.length,V=Math.abs(Y($,0,k,D));if(N)for(var G=0,W=X.length;G<W;G++){var Z=X[G]*D,ne=G<W-1?X[G+1]*D:$.length;V-=Math.abs(Y($,Z,ne,D))}var oe=0;for(G=0;G<F.length;G+=3){var de=F[G]*D,pe=F[G+1]*D,he=F[G+2]*D;oe+=Math.abs(($[de]-$[he])*($[pe+1]-$[de+1])-($[de]-$[pe])*($[he+1]-$[de+1]))}return V===0&&oe===0?0:Math.abs((oe-V)/V)};function Y($,X,D,F){for(var N=0,k=X,V=D-F;k<D;k+=F)N+=($[V]-$[k])*($[k+1]+$[V+1]),V=k;return N}return s.flatten=function($){for(var X=$[0][0].length,D={vertices:[],holes:[],dimensions:X},F=0,N=0;N<$.length;N++){for(var k=0;k<$[N].length;k++)for(var V=0;V<X;V++)D.vertices.push($[N][k][V]);N>0&&(F+=$[N-1].length,D.holes.push(F))}return D},zl.exports}var i_=t_();const s_=qx(i_);var Dr={},$a={exports:{}};/*! https://mths.be/punycode v1.4.1 by @mathias */var n_=$a.exports,jg;function r_(){return jg||(jg=1,(function(s,e){(function(t){var i=e&&!e.nodeType&&e,n=s&&!s.nodeType&&s,r=typeof th=="object"&&th;(r.global===r||r.window===r||r.self===r)&&(t=r);var o,a=2147483647,c=36,l=1,h=26,u=38,d=700,f=72,m=128,p="-",g=/^xn--/,x=/[^\x20-\x7E]/,v=/[\x2E\u3002\uFF0E\uFF61]/g,y={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},S=c-l,C=Math.floor,w=String.fromCharCode,b;function _(N){throw new RangeError(y[N])}function A(N,k){for(var V=N.length,G=[];V--;)G[V]=k(N[V]);return G}function P(N,k){var V=N.split("@"),G="";V.length>1&&(G=V[0]+"@",N=V[1]),N=N.replace(v,".");var W=N.split("."),Z=A(W,k).join(".");return G+Z}function E(N){for(var k=[],V=0,G=N.length,W,Z;V<G;)W=N.charCodeAt(V++),W>=55296&&W<=56319&&V<G?(Z=N.charCodeAt(V++),(Z&64512)==56320?k.push(((W&1023)<<10)+(Z&1023)+65536):(k.push(W),V--)):k.push(W);return k}function R(N){return A(N,function(k){var V="";return k>65535&&(k-=65536,V+=w(k>>>10&1023|55296),k=56320|k&1023),V+=w(k),V}).join("")}function O(N){return N-48<10?N-22:N-65<26?N-65:N-97<26?N-97:c}function U(N,k){return N+22+75*(N<26)-((k!=0)<<5)}function Y(N,k,V){var G=0;for(N=V?C(N/d):N>>1,N+=C(N/k);N>S*h>>1;G+=c)N=C(N/S);return C(G+(S+1)*N/(N+u))}function $(N){var k=[],V=N.length,G,W=0,Z=m,ne=f,oe,de,pe,he,me,H,z,K,B;for(oe=N.lastIndexOf(p),oe<0&&(oe=0),de=0;de<oe;++de)N.charCodeAt(de)>=128&&_("not-basic"),k.push(N.charCodeAt(de));for(pe=oe>0?oe+1:0;pe<V;){for(he=W,me=1,H=c;pe>=V&&_("invalid-input"),z=O(N.charCodeAt(pe++)),(z>=c||z>C((a-W)/me))&&_("overflow"),W+=z*me,K=H<=ne?l:H>=ne+h?h:H-ne,!(z<K);H+=c)B=c-K,me>C(a/B)&&_("overflow"),me*=B;G=k.length+1,ne=Y(W-he,G,he==0),C(W/G)>a-Z&&_("overflow"),Z+=C(W/G),W%=G,k.splice(W++,0,Z)}return R(k)}function X(N){var k,V,G,W,Z,ne,oe,de,pe,he,me,H=[],z,K,B,L;for(N=E(N),z=N.length,k=m,V=0,Z=f,ne=0;ne<z;++ne)me=N[ne],me<128&&H.push(w(me));for(G=W=H.length,W&&H.push(p);G<z;){for(oe=a,ne=0;ne<z;++ne)me=N[ne],me>=k&&me<oe&&(oe=me);for(K=G+1,oe-k>C((a-V)/K)&&_("overflow"),V+=(oe-k)*K,k=oe,ne=0;ne<z;++ne)if(me=N[ne],me<k&&++V>a&&_("overflow"),me==k){for(de=V,pe=c;he=pe<=Z?l:pe>=Z+h?h:pe-Z,!(de<he);pe+=c)L=de-he,B=c-he,H.push(w(U(he+L%B,0))),de=C(L/B);H.push(w(U(de,0))),Z=Y(V,K,G==W),V=0,++G}++V,++k}return H.join("")}function D(N){return P(N,function(k){return g.test(k)?$(k.slice(4).toLowerCase()):k})}function F(N){return P(N,function(k){return x.test(k)?"xn--"+X(k):k})}if(o={version:"1.4.1",ucs2:{decode:E,encode:R},decode:$,encode:X,toASCII:F,toUnicode:D},i&&n)if(s.exports==i)n.exports=o;else for(b in o)o.hasOwnProperty(b)&&(i[b]=o[b]);else t.punycode=o})(n_)})($a,$a.exports)),$a.exports}var Vu,Hg;function va(){return Hg||(Hg=1,Vu=TypeError),Vu}const o_={},a_=Object.freeze(Object.defineProperty({__proto__:null,default:o_},Symbol.toStringTag,{value:"Module"})),l_=J2(a_);var Yu,Wg;function ru(){if(Wg)return Yu;Wg=1;var s=typeof Map=="function"&&Map.prototype,e=Object.getOwnPropertyDescriptor&&s?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,t=s&&e&&typeof e.get=="function"?e.get:null,i=s&&Map.prototype.forEach,n=typeof Set=="function"&&Set.prototype,r=Object.getOwnPropertyDescriptor&&n?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,o=n&&r&&typeof r.get=="function"?r.get:null,a=n&&Set.prototype.forEach,c=typeof WeakMap=="function"&&WeakMap.prototype,l=c?WeakMap.prototype.has:null,h=typeof WeakSet=="function"&&WeakSet.prototype,u=h?WeakSet.prototype.has:null,d=typeof WeakRef=="function"&&WeakRef.prototype,f=d?WeakRef.prototype.deref:null,m=Boolean.prototype.valueOf,p=Object.prototype.toString,g=Function.prototype.toString,x=String.prototype.match,v=String.prototype.slice,y=String.prototype.replace,S=String.prototype.toUpperCase,C=String.prototype.toLowerCase,w=RegExp.prototype.test,b=Array.prototype.concat,_=Array.prototype.join,A=Array.prototype.slice,P=Math.floor,E=typeof BigInt=="function"?BigInt.prototype.valueOf:null,R=Object.getOwnPropertySymbols,O=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,U=typeof Symbol=="function"&&typeof Symbol.iterator=="object",Y=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===U||!0)?Symbol.toStringTag:null,$=Object.prototype.propertyIsEnumerable,X=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(re){return re.__proto__}:null);function D(re,ae){if(re===1/0||re===-1/0||re!==re||re&&re>-1e3&&re<1e3||w.call(/e/,ae))return ae;var et=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof re=="number"){var It=re<0?-P(-re):P(re);if(It!==re){var kt=String(It),ot=v.call(ae,kt.length+1);return y.call(kt,et,"$&_")+"."+y.call(y.call(ot,/([0-9]{3})/g,"$&_"),/_$/,"")}}return y.call(ae,et,"$&_")}var F=l_,N=F.custom,k=K(N)?N:null,V={__proto__:null,double:'"',single:"'"},G={__proto__:null,double:/(["\\])/g,single:/(['\\])/g};Yu=function re(ae,et,It,kt){var ot=et||{};if(j(ot,"quoteStyle")&&!j(V,ot.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(j(ot,"maxStringLength")&&(typeof ot.maxStringLength=="number"?ot.maxStringLength<0&&ot.maxStringLength!==1/0:ot.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var Gi=j(ot,"customInspect")?ot.customInspect:!0;if(typeof Gi!="boolean"&&Gi!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(j(ot,"indent")&&ot.indent!==null&&ot.indent!==" "&&!(parseInt(ot.indent,10)===ot.indent&&ot.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(j(ot,"numericSeparator")&&typeof ot.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var xs=ot.numericSeparator;if(typeof ae>"u")return"undefined";if(ae===null)return"null";if(typeof ae=="boolean")return ae?"true":"false";if(typeof ae=="string")return Ze(ae,ot);if(typeof ae=="number"){if(ae===0)return 1/0/ae>0?"0":"-0";var Nt=String(ae);return xs?D(ae,Nt):Nt}if(typeof ae=="bigint"){var vi=String(ae)+"n";return xs?D(ae,vi):vi}var Xt=typeof ot.depth>"u"?5:ot.depth;if(typeof It>"u"&&(It=0),It>=Xt&&Xt>0&&typeof ae=="object")return oe(ae)?"[Array]":"[Object]";var ji=Ee(ot,It);if(typeof kt>"u")kt=[];else if(fe(kt,ae)>=0)return"[Circular]";function ni(Jn,So,Tu){if(So&&(kt=A.call(kt),kt.push(So)),Tu){var Xl={depth:ot.depth};return j(ot,"quoteStyle")&&(Xl.quoteStyle=ot.quoteStyle),re(Jn,Xl,It+1,kt)}return re(Jn,ot,It+1,kt)}if(typeof ae=="function"&&!pe(ae)){var bs=ue(ae),ws=ut(ae,ni);return"[Function"+(bs?": "+bs:" (anonymous)")+"]"+(ws.length>0?" { "+_.call(ws,", ")+" }":"")}if(K(ae)){var $s=U?y.call(String(ae),/^(Symbol\(.*\))_[^)]*$/,"$1"):O.call(ae);return typeof ae=="object"&&!U?Je($s):$s}if(Ve(ae)){for(var Zi="<"+C.call(String(ae.nodeName)),Zn=ae.attributes||[],gn=0;gn<Zn.length;gn++)Zi+=" "+Zn[gn].name+"="+W(Z(Zn[gn].value),"double",ot);return Zi+=">",ae.childNodes&&ae.childNodes.length&&(Zi+="..."),Zi+="</"+C.call(String(ae.nodeName))+">",Zi}if(oe(ae)){if(ae.length===0)return"[]";var wa=ut(ae,ni);return ji&&!Qe(wa)?"["+Qt(wa,ji)+"]":"[ "+_.call(wa,", ")+" ]"}if(he(ae)){var Sa=ut(ae,ni);return!("cause"in Error.prototype)&&"cause"in ae&&!$.call(ae,"cause")?"{ ["+String(ae)+"] "+_.call(b.call("[cause]: "+ni(ae.cause),Sa),", ")+" }":Sa.length===0?"["+String(ae)+"]":"{ ["+String(ae)+"] "+_.call(Sa,", ")+" }"}if(typeof ae=="object"&&Gi){if(k&&typeof ae[k]=="function"&&F)return F(ae,{depth:Xt-It});if(Gi!=="symbol"&&typeof ae.inspect=="function")return ae.inspect()}if(ee(ae)){var Dl=[];return i&&i.call(ae,function(Jn,So){Dl.push(ni(So,ae,!0)+" => "+ni(Jn,ae))}),Ae("Map",t.call(ae),Dl,ji)}if(ge(ae)){var Ul=[];return a&&a.call(ae,function(Jn){Ul.push(ni(Jn,ae))}),Ae("Set",o.call(ae),Ul,ji)}if(Me(ae))return je("WeakMap");if(Ne(ae))return je("WeakSet");if(be(ae))return je("WeakRef");if(H(ae))return Je(ni(Number(ae)));if(B(ae))return Je(ni(E.call(ae)));if(z(ae))return Je(m.call(ae));if(me(ae))return Je(ni(String(ae)));if(typeof window<"u"&&ae===window)return"{ [object Window] }";if(typeof globalThis<"u"&&ae===globalThis||typeof th<"u"&&ae===th)return"{ [object globalThis] }";if(!de(ae)&&!pe(ae)){var Ma=ut(ae,ni),Ta=X?X(ae)===Object.prototype:ae instanceof Object||ae.constructor===Object,_a=ae instanceof Object?"":"null prototype",$l=!Ta&&Y&&Object(ae)===ae&&Y in ae?v.call(ie(ae),8,-1):_a?"Object":"",Mu=Ta||typeof ae.constructor!="function"?"":ae.constructor.name?ae.constructor.name+" ":"",Ca=Mu+($l||_a?"["+_.call(b.call([],$l||[],_a||[]),": ")+"] ":"");return Ma.length===0?Ca+"{}":ji?Ca+"{"+Qt(Ma,ji)+"}":Ca+"{ "+_.call(Ma,", ")+" }"}return String(ae)};function W(re,ae,et){var It=et.quoteStyle||ae,kt=V[It];return kt+re+kt}function Z(re){return y.call(String(re),/"/g,""")}function ne(re){return!Y||!(typeof re=="object"&&(Y in re||typeof re[Y]<"u"))}function oe(re){return ie(re)==="[object Array]"&&ne(re)}function de(re){return ie(re)==="[object Date]"&&ne(re)}function pe(re){return ie(re)==="[object RegExp]"&&ne(re)}function he(re){return ie(re)==="[object Error]"&&ne(re)}function me(re){return ie(re)==="[object String]"&&ne(re)}function H(re){return ie(re)==="[object Number]"&&ne(re)}function z(re){return ie(re)==="[object Boolean]"&&ne(re)}function K(re){if(U)return re&&typeof re=="object"&&re instanceof Symbol;if(typeof re=="symbol")return!0;if(!re||typeof re!="object"||!O)return!1;try{return O.call(re),!0}catch{}return!1}function B(re){if(!re||typeof re!="object"||!E)return!1;try{return E.call(re),!0}catch{}return!1}var L=Object.prototype.hasOwnProperty||function(re){return re in this};function j(re,ae){return L.call(re,ae)}function ie(re){return p.call(re)}function ue(re){if(re.name)return re.name;var ae=x.call(g.call(re),/^function\s*([\w$]+)/);return ae?ae[1]:null}function fe(re,ae){if(re.indexOf)return re.indexOf(ae);for(var et=0,It=re.length;et<It;et++)if(re[et]===ae)return et;return-1}function ee(re){if(!t||!re||typeof re!="object")return!1;try{t.call(re);try{o.call(re)}catch{return!0}return re instanceof Map}catch{}return!1}function Me(re){if(!l||!re||typeof re!="object")return!1;try{l.call(re,l);try{u.call(re,u)}catch{return!0}return re instanceof WeakMap}catch{}return!1}function be(re){if(!f||!re||typeof re!="object")return!1;try{return f.call(re),!0}catch{}return!1}function ge(re){if(!o||!re||typeof re!="object")return!1;try{o.call(re);try{t.call(re)}catch{return!0}return re instanceof Set}catch{}return!1}function Ne(re){if(!u||!re||typeof re!="object")return!1;try{u.call(re,u);try{l.call(re,l)}catch{return!0}return re instanceof WeakSet}catch{}return!1}function Ve(re){return!re||typeof re!="object"?!1:typeof HTMLElement<"u"&&re instanceof HTMLElement?!0:typeof re.nodeName=="string"&&typeof re.getAttribute=="function"}function Ze(re,ae){if(re.length>ae.maxStringLength){var et=re.length-ae.maxStringLength,It="... "+et+" more character"+(et>1?"s":"");return Ze(v.call(re,0,ae.maxStringLength),ae)+It}var kt=G[ae.quoteStyle||"single"];kt.lastIndex=0;var ot=y.call(y.call(re,kt,"\\$1"),/[\x00-\x1f]/g,rt);return W(ot,"single",ae)}function rt(re){var ae=re.charCodeAt(0),et={8:"b",9:"t",10:"n",12:"f",13:"r"}[ae];return et?"\\"+et:"\\x"+(ae<16?"0":"")+S.call(ae.toString(16))}function Je(re){return"Object("+re+")"}function je(re){return re+" { ? }"}function Ae(re,ae,et,It){var kt=It?Qt(et,It):_.call(et,", ");return re+" ("+ae+") {"+kt+"}"}function Qe(re){for(var ae=0;ae<re.length;ae++)if(fe(re[ae],`
|
||
`)>=0)return!1;return!0}function Ee(re,ae){var et;if(re.indent===" ")et=" ";else if(typeof re.indent=="number"&&re.indent>0)et=_.call(Array(re.indent+1)," ");else return null;return{base:et,prev:_.call(Array(ae+1),et)}}function Qt(re,ae){if(re.length===0)return"";var et=`
|
||
`+ae.prev+ae.base;return et+_.call(re,","+et)+`
|
||
`+ae.prev}function ut(re,ae){var et=oe(re),It=[];if(et){It.length=re.length;for(var kt=0;kt<re.length;kt++)It[kt]=j(re,kt)?ae(re[kt],re):""}var ot=typeof R=="function"?R(re):[],Gi;if(U){Gi={};for(var xs=0;xs<ot.length;xs++)Gi["$"+ot[xs]]=ot[xs]}for(var Nt in re)j(re,Nt)&&(et&&String(Number(Nt))===Nt&&Nt<re.length||U&&Gi["$"+Nt]instanceof Symbol||(w.call(/[^\w$]/,Nt)?It.push(ae(Nt,re)+": "+ae(re[Nt],re)):It.push(Nt+": "+ae(re[Nt],re))));if(typeof R=="function")for(var vi=0;vi<ot.length;vi++)$.call(re,ot[vi])&&It.push("["+ae(ot[vi])+"]: "+ae(re[ot[vi]],re));return It}return Yu}var Gu,zg;function c_(){if(zg)return Gu;zg=1;var s=ru(),e=va(),t=function(a,c,l){for(var h=a,u;(u=h.next)!=null;h=u)if(u.key===c)return h.next=u.next,l||(u.next=a.next,a.next=u),u},i=function(a,c){if(a){var l=t(a,c);return l&&l.value}},n=function(a,c,l){var h=t(a,c);h?h.value=l:a.next={key:c,next:a.next,value:l}},r=function(a,c){return a?!!t(a,c):!1},o=function(a,c){if(a)return t(a,c,!0)};return Gu=function(){var c,l={assert:function(h){if(!l.has(h))throw new e("Side channel does not contain "+s(h))},delete:function(h){var u=o(c,h);return u&&c&&!c.next&&(c=void 0),!!u},get:function(h){return i(c,h)},has:function(h){return r(c,h)},set:function(h,u){c||(c={next:void 0}),n(c,h,u)}};return l},Gu}var ju,qg;function Kx(){return qg||(qg=1,ju=Object),ju}var Hu,Kg;function h_(){return Kg||(Kg=1,Hu=Error),Hu}var Wu,Zg;function u_(){return Zg||(Zg=1,Wu=EvalError),Wu}var zu,Jg;function d_(){return Jg||(Jg=1,zu=RangeError),zu}var qu,Qg;function f_(){return Qg||(Qg=1,qu=ReferenceError),qu}var Ku,e0;function m_(){return e0||(e0=1,Ku=SyntaxError),Ku}var Zu,t0;function p_(){return t0||(t0=1,Zu=URIError),Zu}var Ju,i0;function g_(){return i0||(i0=1,Ju=Math.abs),Ju}var Qu,s0;function v_(){return s0||(s0=1,Qu=Math.floor),Qu}var ed,n0;function y_(){return n0||(n0=1,ed=Math.max),ed}var td,r0;function x_(){return r0||(r0=1,td=Math.min),td}var id,o0;function b_(){return o0||(o0=1,id=Math.pow),id}var sd,a0;function w_(){return a0||(a0=1,sd=Math.round),sd}var nd,l0;function S_(){return l0||(l0=1,nd=Number.isNaN||function(e){return e!==e}),nd}var rd,c0;function M_(){if(c0)return rd;c0=1;var s=S_();return rd=function(t){return s(t)||t===0?t:t<0?-1:1},rd}var od,h0;function T_(){return h0||(h0=1,od=Object.getOwnPropertyDescriptor),od}var ad,u0;function Zx(){if(u0)return ad;u0=1;var s=T_();if(s)try{s([],"length")}catch{s=null}return ad=s,ad}var ld,d0;function Jx(){if(d0)return ld;d0=1;var s=Object.defineProperty||!1;if(s)try{s({},"a",{value:1})}catch{s=!1}return ld=s,ld}var cd,f0;function __(){return f0||(f0=1,cd=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},t=Symbol("test"),i=Object(t);if(typeof t=="string"||Object.prototype.toString.call(t)!=="[object Symbol]"||Object.prototype.toString.call(i)!=="[object Symbol]")return!1;var n=42;e[t]=n;for(var r in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var o=Object.getOwnPropertySymbols(e);if(o.length!==1||o[0]!==t||!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var a=Object.getOwnPropertyDescriptor(e,t);if(a.value!==n||a.enumerable!==!0)return!1}return!0}),cd}var hd,m0;function C_(){if(m0)return hd;m0=1;var s=typeof Symbol<"u"&&Symbol,e=__();return hd=function(){return typeof s!="function"||typeof Symbol!="function"||typeof s("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:e()},hd}var ud,p0;function Qx(){return p0||(p0=1,ud=typeof Reflect<"u"&&Reflect.getPrototypeOf||null),ud}var dd,g0;function eb(){if(g0)return dd;g0=1;var s=Kx();return dd=s.getPrototypeOf||null,dd}var fd,v0;function E_(){if(v0)return fd;v0=1;var s="Function.prototype.bind called on incompatible ",e=Object.prototype.toString,t=Math.max,i="[object Function]",n=function(c,l){for(var h=[],u=0;u<c.length;u+=1)h[u]=c[u];for(var d=0;d<l.length;d+=1)h[d+c.length]=l[d];return h},r=function(c,l){for(var h=[],u=l,d=0;u<c.length;u+=1,d+=1)h[d]=c[u];return h},o=function(a,c){for(var l="",h=0;h<a.length;h+=1)l+=a[h],h+1<a.length&&(l+=c);return l};return fd=function(c){var l=this;if(typeof l!="function"||e.apply(l)!==i)throw new TypeError(s+l);for(var h=r(arguments,1),u,d=function(){if(this instanceof u){var x=l.apply(this,n(h,arguments));return Object(x)===x?x:this}return l.apply(c,n(h,arguments))},f=t(0,l.length-h.length),m=[],p=0;p<f;p++)m[p]="$"+p;if(u=Function("binder","return function ("+o(m,",")+"){ return binder.apply(this,arguments); }")(d),l.prototype){var g=function(){};g.prototype=l.prototype,u.prototype=new g,g.prototype=null}return u},fd}var md,y0;function ou(){if(y0)return md;y0=1;var s=E_();return md=Function.prototype.bind||s,md}var pd,x0;function dp(){return x0||(x0=1,pd=Function.prototype.call),pd}var gd,b0;function tb(){return b0||(b0=1,gd=Function.prototype.apply),gd}var vd,w0;function A_(){return w0||(w0=1,vd=typeof Reflect<"u"&&Reflect&&Reflect.apply),vd}var yd,S0;function I_(){if(S0)return yd;S0=1;var s=ou(),e=tb(),t=dp(),i=A_();return yd=i||s.call(t,e),yd}var xd,M0;function ib(){if(M0)return xd;M0=1;var s=ou(),e=va(),t=dp(),i=I_();return xd=function(r){if(r.length<1||typeof r[0]!="function")throw new e("a function is required");return i(s,t,r)},xd}var bd,T0;function R_(){if(T0)return bd;T0=1;var s=ib(),e=Zx(),t;try{t=[].__proto__===Array.prototype}catch(o){if(!o||typeof o!="object"||!("code"in o)||o.code!=="ERR_PROTO_ACCESS")throw o}var i=!!t&&e&&e(Object.prototype,"__proto__"),n=Object,r=n.getPrototypeOf;return bd=i&&typeof i.get=="function"?s([i.get]):typeof r=="function"?function(a){return r(a==null?a:n(a))}:!1,bd}var wd,_0;function P_(){if(_0)return wd;_0=1;var s=Qx(),e=eb(),t=R_();return wd=s?function(n){return s(n)}:e?function(n){if(!n||typeof n!="object"&&typeof n!="function")throw new TypeError("getProto: not an object");return e(n)}:t?function(n){return t(n)}:null,wd}var Sd,C0;function k_(){if(C0)return Sd;C0=1;var s=Function.prototype.call,e=Object.prototype.hasOwnProperty,t=ou();return Sd=t.call(s,e),Sd}var Md,E0;function fp(){if(E0)return Md;E0=1;var s,e=Kx(),t=h_(),i=u_(),n=d_(),r=f_(),o=m_(),a=va(),c=p_(),l=g_(),h=v_(),u=y_(),d=x_(),f=b_(),m=w_(),p=M_(),g=Function,x=function(pe){try{return g('"use strict"; return ('+pe+").constructor;")()}catch{}},v=Zx(),y=Jx(),S=function(){throw new a},C=v?(function(){try{return arguments.callee,S}catch{try{return v(arguments,"callee").get}catch{return S}}})():S,w=C_()(),b=P_(),_=eb(),A=Qx(),P=tb(),E=dp(),R={},O=typeof Uint8Array>"u"||!b?s:b(Uint8Array),U={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?s:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?s:ArrayBuffer,"%ArrayIteratorPrototype%":w&&b?b([][Symbol.iterator]()):s,"%AsyncFromSyncIteratorPrototype%":s,"%AsyncFunction%":R,"%AsyncGenerator%":R,"%AsyncGeneratorFunction%":R,"%AsyncIteratorPrototype%":R,"%Atomics%":typeof Atomics>"u"?s:Atomics,"%BigInt%":typeof BigInt>"u"?s:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?s:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?s:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?s:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":t,"%eval%":eval,"%EvalError%":i,"%Float16Array%":typeof Float16Array>"u"?s:Float16Array,"%Float32Array%":typeof Float32Array>"u"?s:Float32Array,"%Float64Array%":typeof Float64Array>"u"?s:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?s:FinalizationRegistry,"%Function%":g,"%GeneratorFunction%":R,"%Int8Array%":typeof Int8Array>"u"?s:Int8Array,"%Int16Array%":typeof Int16Array>"u"?s:Int16Array,"%Int32Array%":typeof Int32Array>"u"?s:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":w&&b?b(b([][Symbol.iterator]())):s,"%JSON%":typeof JSON=="object"?JSON:s,"%Map%":typeof Map>"u"?s:Map,"%MapIteratorPrototype%":typeof Map>"u"||!w||!b?s:b(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":e,"%Object.getOwnPropertyDescriptor%":v,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?s:Promise,"%Proxy%":typeof Proxy>"u"?s:Proxy,"%RangeError%":n,"%ReferenceError%":r,"%Reflect%":typeof Reflect>"u"?s:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?s:Set,"%SetIteratorPrototype%":typeof Set>"u"||!w||!b?s:b(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?s:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":w&&b?b(""[Symbol.iterator]()):s,"%Symbol%":w?Symbol:s,"%SyntaxError%":o,"%ThrowTypeError%":C,"%TypedArray%":O,"%TypeError%":a,"%Uint8Array%":typeof Uint8Array>"u"?s:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?s:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?s:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?s:Uint32Array,"%URIError%":c,"%WeakMap%":typeof WeakMap>"u"?s:WeakMap,"%WeakRef%":typeof WeakRef>"u"?s:WeakRef,"%WeakSet%":typeof WeakSet>"u"?s:WeakSet,"%Function.prototype.call%":E,"%Function.prototype.apply%":P,"%Object.defineProperty%":y,"%Object.getPrototypeOf%":_,"%Math.abs%":l,"%Math.floor%":h,"%Math.max%":u,"%Math.min%":d,"%Math.pow%":f,"%Math.round%":m,"%Math.sign%":p,"%Reflect.getPrototypeOf%":A};if(b)try{null.error}catch(pe){var Y=b(b(pe));U["%Error.prototype%"]=Y}var $=function pe(he){var me;if(he==="%AsyncFunction%")me=x("async function () {}");else if(he==="%GeneratorFunction%")me=x("function* () {}");else if(he==="%AsyncGeneratorFunction%")me=x("async function* () {}");else if(he==="%AsyncGenerator%"){var H=pe("%AsyncGeneratorFunction%");H&&(me=H.prototype)}else if(he==="%AsyncIteratorPrototype%"){var z=pe("%AsyncGenerator%");z&&b&&(me=b(z.prototype))}return U[he]=me,me},X={__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"]},D=ou(),F=k_(),N=D.call(E,Array.prototype.concat),k=D.call(P,Array.prototype.splice),V=D.call(E,String.prototype.replace),G=D.call(E,String.prototype.slice),W=D.call(E,RegExp.prototype.exec),Z=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,ne=/\\(\\)?/g,oe=function(he){var me=G(he,0,1),H=G(he,-1);if(me==="%"&&H!=="%")throw new o("invalid intrinsic syntax, expected closing `%`");if(H==="%"&&me!=="%")throw new o("invalid intrinsic syntax, expected opening `%`");var z=[];return V(he,Z,function(K,B,L,j){z[z.length]=L?V(j,ne,"$1"):B||K}),z},de=function(he,me){var H=he,z;if(F(X,H)&&(z=X[H],H="%"+z[0]+"%"),F(U,H)){var K=U[H];if(K===R&&(K=$(H)),typeof K>"u"&&!me)throw new a("intrinsic "+he+" exists, but is not available. Please file an issue!");return{alias:z,name:H,value:K}}throw new o("intrinsic "+he+" does not exist!")};return Md=function(he,me){if(typeof he!="string"||he.length===0)throw new a("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof me!="boolean")throw new a('"allowMissing" argument must be a boolean');if(W(/^%?[^%]*%?$/,he)===null)throw new o("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var H=oe(he),z=H.length>0?H[0]:"",K=de("%"+z+"%",me),B=K.name,L=K.value,j=!1,ie=K.alias;ie&&(z=ie[0],k(H,N([0,1],ie)));for(var ue=1,fe=!0;ue<H.length;ue+=1){var ee=H[ue],Me=G(ee,0,1),be=G(ee,-1);if((Me==='"'||Me==="'"||Me==="`"||be==='"'||be==="'"||be==="`")&&Me!==be)throw new o("property names with quotes must have matching quotes");if((ee==="constructor"||!fe)&&(j=!0),z+="."+ee,B="%"+z+"%",F(U,B))L=U[B];else if(L!=null){if(!(ee in L)){if(!me)throw new a("base intrinsic for "+he+" exists, but the property is not available.");return}if(v&&ue+1>=H.length){var ge=v(L,ee);fe=!!ge,fe&&"get"in ge&&!("originalValue"in ge.get)?L=ge.get:L=L[ee]}else fe=F(L,ee),L=L[ee];fe&&!j&&(U[B]=L)}}return L},Md}var Td,A0;function sb(){if(A0)return Td;A0=1;var s=fp(),e=ib(),t=e([s("%String.prototype.indexOf%")]);return Td=function(n,r){var o=s(n,!!r);return typeof o=="function"&&t(n,".prototype.")>-1?e([o]):o},Td}var _d,I0;function nb(){if(I0)return _d;I0=1;var s=fp(),e=sb(),t=ru(),i=va(),n=s("%Map%",!0),r=e("Map.prototype.get",!0),o=e("Map.prototype.set",!0),a=e("Map.prototype.has",!0),c=e("Map.prototype.delete",!0),l=e("Map.prototype.size",!0);return _d=!!n&&function(){var u,d={assert:function(f){if(!d.has(f))throw new i("Side channel does not contain "+t(f))},delete:function(f){if(u){var m=c(u,f);return l(u)===0&&(u=void 0),m}return!1},get:function(f){if(u)return r(u,f)},has:function(f){return u?a(u,f):!1},set:function(f,m){u||(u=new n),o(u,f,m)}};return d},_d}var Cd,R0;function F_(){if(R0)return Cd;R0=1;var s=fp(),e=sb(),t=ru(),i=nb(),n=va(),r=s("%WeakMap%",!0),o=e("WeakMap.prototype.get",!0),a=e("WeakMap.prototype.set",!0),c=e("WeakMap.prototype.has",!0),l=e("WeakMap.prototype.delete",!0);return Cd=r?function(){var u,d,f={assert:function(m){if(!f.has(m))throw new n("Side channel does not contain "+t(m))},delete:function(m){if(r&&m&&(typeof m=="object"||typeof m=="function")){if(u)return l(u,m)}else if(i&&d)return d.delete(m);return!1},get:function(m){return r&&m&&(typeof m=="object"||typeof m=="function")&&u?o(u,m):d&&d.get(m)},has:function(m){return r&&m&&(typeof m=="object"||typeof m=="function")&&u?c(u,m):!!d&&d.has(m)},set:function(m,p){r&&m&&(typeof m=="object"||typeof m=="function")?(u||(u=new r),a(u,m,p)):i&&(d||(d=i()),d.set(m,p))}};return f}:i,Cd}var Ed,P0;function rb(){if(P0)return Ed;P0=1;var s=va(),e=ru(),t=c_(),i=nb(),n=F_(),r=n||i||t;return Ed=function(){var a,c={assert:function(l){if(!c.has(l)){var h=l&&Object(l)===l?"the given object key":e(l);throw new s("Side channel does not contain "+h)}},delete:function(l){return!!a&&a.delete(l)},get:function(l){return a&&a.get(l)},has:function(l){return!!a&&a.has(l)},set:function(l,h){a||(a=r()),a.set(l,h)}};return c},Ed}var Ad,k0;function mp(){if(k0)return Ad;k0=1;var s=String.prototype.replace,e=/%20/g,t={RFC1738:"RFC1738",RFC3986:"RFC3986"};return Ad={default:t.RFC3986,formatters:{RFC1738:function(i){return s.call(i,e,"+")},RFC3986:function(i){return String(i)}},RFC1738:t.RFC1738,RFC3986:t.RFC3986},Ad}var Id,F0;function ob(){if(F0)return Id;F0=1;var s=mp(),e=rb(),t=Jx(),i=Object.prototype.hasOwnProperty,n=Array.isArray,r=e(),o=function(A,P){return r.set(A,P),A},a=function(A){return r.has(A)},c=function(A){return r.get(A)},l=function(A,P){r.set(A,P)},h=(function(){for(var _=[],A=0;A<256;++A)_[_.length]="%"+((A<16?"0":"")+A.toString(16)).toUpperCase();return _})(),u=function(A){for(;A.length>1;){var P=A.pop(),E=P.obj[P.prop];if(n(E)){for(var R=[],O=0;O<E.length;++O)typeof E[O]<"u"&&(R[R.length]=E[O]);P.obj[P.prop]=R}}},d=function(A,P){for(var E=P&&P.plainObjects?{__proto__:null}:{},R=0;R<A.length;++R)typeof A[R]<"u"&&(E[R]=A[R]);return E},f=function(A,P,E){P==="__proto__"&&t?t(A,P,{configurable:!0,enumerable:!0,value:E,writable:!0}):A[P]=E},m=function _(A,P,E){if(!P)return A;if(typeof P!="object"&&typeof P!="function"){if(n(A)){var R=A.length;if(E&&typeof E.arrayLimit=="number"&&R>=E.arrayLimit){if(E.throwOnLimitExceeded)throw new RangeError("Array limit exceeded. Only "+E.arrayLimit+" element"+(E.arrayLimit===1?"":"s")+" allowed in an array.");return o(d(A.concat(P),E),R)}A[R]=P}else if(A&&typeof A=="object")if(a(A)){var O=c(A)+1;A[O]=P,l(A,O)}else{if(E&&E.strictMerge)return[A,P];(E&&(E.plainObjects||E.allowPrototypes)||!i.call(Object.prototype,P))&&(A[P]=!0)}else return[A,P];return A}if(!A||typeof A!="object"){if(a(P)){for(var U=Object.keys(P),Y=E&&E.plainObjects?{__proto__:null,0:A}:{0:A},$=0;$<U.length;$++){var X=parseInt(U[$],10);Y[X+1]=P[U[$]]}return o(Y,c(P)+1)}var D=[A].concat(P);if(E&&typeof E.arrayLimit=="number"&&D.length>E.arrayLimit){if(E.throwOnLimitExceeded)throw new RangeError("Array limit exceeded. Only "+E.arrayLimit+" element"+(E.arrayLimit===1?"":"s")+" allowed in an array.");return o(d(D,E),D.length-1)}return D}var F=A;if(n(A)&&!n(P)&&(F=d(A,E)),n(A)&&n(P)){if(P.forEach(function(N,k){if(i.call(A,k)){var V=A[k];V&&typeof V=="object"&&N&&typeof N=="object"?A[k]=_(V,N,E):A[A.length]=N}else A[k]=N}),E&&typeof E.arrayLimit=="number"&&A.length>E.arrayLimit){if(E.throwOnLimitExceeded)throw new RangeError("Array limit exceeded. Only "+E.arrayLimit+" element"+(E.arrayLimit===1?"":"s")+" allowed in an array.");return o(d(A,E),A.length-1)}return A}return Object.keys(P).reduce(function(N,k){var V=P[k];if(i.call(N,k)?f(N,k,_(N[k],V,E)):f(N,k,V),a(P)&&!a(N)&&o(N,c(P)),a(N)){var G=parseInt(k,10);String(G)===k&&G>=0&&G>c(N)&&l(N,G)}return N},F)},p=function(A,P){return Object.keys(P).reduce(function(E,R){return f(E,R,P[R]),E},A)},g=function(_,A,P){var E=_.replace(/\+/g," ");if(P==="iso-8859-1")return E.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(E)}catch{return E}},x=1024,v=function(A,P,E,R,O){if(A.length===0)return A;var U=A;if(typeof A=="symbol"?U=Symbol.prototype.toString.call(A):typeof A!="string"&&(U=String(A)),E==="iso-8859-1")return escape(U).replace(/%u[0-9a-f]{4}/gi,function(V){return"%26%23"+parseInt(V.slice(2),16)+"%3B"});for(var Y="",$=0;$<U.length;$+=x){var X=U.length>=x?U.slice($,$+x):U;if($+x<U.length){var D=X.charCodeAt(X.length-1);D>=55296&&D<=56319&&(X=X.slice(0,-1),$-=1)}for(var F=[],N=0;N<X.length;++N){var k=X.charCodeAt(N);if(k===45||k===46||k===95||k===126||k>=48&&k<=57||k>=65&&k<=90||k>=97&&k<=122||O===s.RFC1738&&(k===40||k===41)){F[F.length]=X.charAt(N);continue}if(k<128){F[F.length]=h[k];continue}if(k<2048){F[F.length]=h[192|k>>6]+h[128|k&63];continue}if(k<55296||k>=57344){F[F.length]=h[224|k>>12]+h[128|k>>6&63]+h[128|k&63];continue}N+=1,k=65536+((k&1023)<<10|X.charCodeAt(N)&1023),F[F.length]=h[240|k>>18]+h[128|k>>12&63]+h[128|k>>6&63]+h[128|k&63]}Y+=F.join("")}return Y},y=function(A){for(var P=[{obj:{o:A},prop:"o"}],E=e(),R=0;R<P.length;++R)for(var O=P[R],U=O.obj[O.prop],Y=Object.keys(U),$=0;$<Y.length;++$){var X=Y[$],D=U[X];typeof D=="object"&&D!==null&&!E.has(D)&&(P[P.length]={obj:U,prop:X},E.set(D,!0))}return u(P),A},S=function(A){return Object.prototype.toString.call(A)==="[object RegExp]"},C=function(A){return!A||typeof A!="object"?!1:!!(A.constructor&&A.constructor.isBuffer&&A.constructor.isBuffer(A))},w=function(A,P,E,R,O){if(a(A)){if(O)throw new RangeError("Array limit exceeded. Only "+E+" element"+(E===1?"":"s")+" allowed in an array.");var U=c(A)+1;return A[U]=P,l(A,U),A}var Y=[].concat(A,P);if(Y.length>E){if(O)throw new RangeError("Array limit exceeded. Only "+E+" element"+(E===1?"":"s")+" allowed in an array.");return o(d(Y,{plainObjects:R}),Y.length-1)}return Y},b=function(A,P){if(n(A)){for(var E=[],R=0;R<A.length;R+=1)E[E.length]=P(A[R]);return E}return P(A)};return Id={arrayToObject:d,assign:p,combine:w,compact:y,decode:g,encode:v,isBuffer:C,isOverflow:a,isRegExp:S,markOverflow:o,maybeMap:b,merge:m},Id}var Rd,O0;function O_(){if(O0)return Rd;O0=1;var s=rb(),e=ob(),t=mp(),i=Object.prototype.hasOwnProperty,n={brackets:function(g){return g+"[]"},comma:"comma",indices:function(g,x){return g+"["+x+"]"},repeat:function(g){return g}},r=Array.isArray,o=Array.prototype.push,a=function(p,g){o.apply(p,r(g)?g:[g])},c=Date.prototype.toISOString,l=t.default,h={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,commaRoundTrip:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:e.encode,encodeValuesOnly:!1,filter:void 0,format:l,formatter:t.formatters[l],indices:!1,serializeDate:function(g){return c.call(g)},skipNulls:!1,strictNullHandling:!1},u=function(g){return typeof g=="string"||typeof g=="number"||typeof g=="boolean"||typeof g=="symbol"||typeof g=="bigint"},d={},f=function p(g,x,v,y,S,C,w,b,_,A,P,E,R,O,U,Y,$,X){for(var D=g,F=X,N=0,k=!1;(F=F.get(d))!==void 0&&!k;){var V=F.get(g);if(N+=1,typeof V<"u"){if(V===N)throw new RangeError("Cyclic object value");k=!0}typeof F.get(d)>"u"&&(N=0)}if(typeof A=="function"?D=A(x,D):D instanceof Date?D=R(D):v==="comma"&&r(D)&&(D=e.maybeMap(D,function(B){return B instanceof Date?R(B):B})),D===null){if(C)return U(_&&!Y?_(x,h.encoder,$,"key",O):x);D=""}if(u(D)||e.isBuffer(D)){if(_){var G=Y?x:_(x,h.encoder,$,"key",O);return[U(G)+"="+U(_(D,h.encoder,$,"value",O))]}return[U(x)+"="+U(String(D))]}var W=[];if(typeof D>"u")return W;var Z;if(v==="comma"&&r(D))Y&&_&&(D=e.maybeMap(D,function(B){return B==null?B:_(B)})),Z=[{value:D.length>0?D.join(",")||null:void 0}];else if(r(A))Z=A;else{var ne=Object.keys(D);Z=P?ne.sort(P):ne}var oe=b?String(x).replace(/\./g,"%2E"):String(x),de=y&&r(D)&&D.length===1?oe+"[]":oe;if(S&&r(D)&&D.length===0)return de+"[]";for(var pe=0;pe<Z.length;++pe){var he=Z[pe],me=typeof he=="object"&&he&&typeof he.value<"u"?he.value:D[he];if(!(w&&me===null)){var H=E&&b?String(he).replace(/\./g,"%2E"):String(he),z=r(D)?typeof v=="function"?v(de,H):de:de+(E?"."+H:"["+H+"]");X.set(g,N);var K=s();K.set(d,X),a(W,p(me,z,v,y,S,C,w,b,v==="comma"&&Y&&r(D)?null:_,A,P,E,R,O,U,Y,$,K))}}return W},m=function(g){if(!g)return h;if(typeof g.allowEmptyArrays<"u"&&typeof g.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof g.encodeDotInKeys<"u"&&typeof g.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(g.encoder!==null&&typeof g.encoder<"u"&&typeof g.encoder!="function")throw new TypeError("Encoder has to be a function.");var x=g.charset||h.charset;if(typeof g.charset<"u"&&g.charset!=="utf-8"&&g.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var v=t.default;if(typeof g.format<"u"){if(!i.call(t.formatters,g.format))throw new TypeError("Unknown format option provided.");v=g.format}var y=t.formatters[v],S=h.filter;(typeof g.filter=="function"||r(g.filter))&&(S=g.filter);var C;if(g.arrayFormat in n?C=g.arrayFormat:"indices"in g?C=g.indices?"indices":"repeat":C=h.arrayFormat,"commaRoundTrip"in g&&typeof g.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var w=typeof g.allowDots>"u"?g.encodeDotInKeys===!0?!0:h.allowDots:!!g.allowDots;return{addQueryPrefix:typeof g.addQueryPrefix=="boolean"?g.addQueryPrefix:h.addQueryPrefix,allowDots:w,allowEmptyArrays:typeof g.allowEmptyArrays=="boolean"?!!g.allowEmptyArrays:h.allowEmptyArrays,arrayFormat:C,charset:x,charsetSentinel:typeof g.charsetSentinel=="boolean"?g.charsetSentinel:h.charsetSentinel,commaRoundTrip:!!g.commaRoundTrip,delimiter:typeof g.delimiter>"u"?h.delimiter:g.delimiter,encode:typeof g.encode=="boolean"?g.encode:h.encode,encodeDotInKeys:typeof g.encodeDotInKeys=="boolean"?g.encodeDotInKeys:h.encodeDotInKeys,encoder:typeof g.encoder=="function"?g.encoder:h.encoder,encodeValuesOnly:typeof g.encodeValuesOnly=="boolean"?g.encodeValuesOnly:h.encodeValuesOnly,filter:S,format:v,formatter:y,serializeDate:typeof g.serializeDate=="function"?g.serializeDate:h.serializeDate,skipNulls:typeof g.skipNulls=="boolean"?g.skipNulls:h.skipNulls,sort:typeof g.sort=="function"?g.sort:null,strictNullHandling:typeof g.strictNullHandling=="boolean"?g.strictNullHandling:h.strictNullHandling}};return Rd=function(p,g){var x=p,v=m(g),y,S;typeof v.filter=="function"?(S=v.filter,x=S("",x)):r(v.filter)&&(S=v.filter,y=S);var C=[];if(typeof x!="object"||x===null)return"";var w=n[v.arrayFormat],b=w==="comma"&&v.commaRoundTrip;y||(y=Object.keys(x)),v.sort&&y.sort(v.sort);for(var _=s(),A=0;A<y.length;++A){var P=y[A];if(!(typeof P>"u"||P===null)){var E=x[P];v.skipNulls&&E===null||a(C,f(E,P,w,b,v.allowEmptyArrays,v.strictNullHandling,v.skipNulls,v.encodeDotInKeys,v.encode?v.encoder:null,v.filter,v.sort,v.allowDots,v.serializeDate,v.format,v.formatter,v.encodeValuesOnly,v.charset,_))}}var R=C.join(v.delimiter),O=v.addQueryPrefix===!0?"?":"";return v.charsetSentinel&&(v.charset==="iso-8859-1"?O+="utf8=%26%2310003%3B"+v.delimiter:O+="utf8=%E2%9C%93"+v.delimiter),R.length>0?O+R:""},Rd}var Pd,L0;function L_(){if(L0)return Pd;L0=1;var s=ob(),e=Object.prototype.hasOwnProperty,t=Array.isArray,i={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:s.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictDepth:!1,strictMerge:!0,strictNullHandling:!1,throwOnLimitExceeded:!1},n=function(f){return f.replace(/&#(\d+);/g,function(m,p){return String.fromCharCode(parseInt(p,10))})},r=function(f,m,p,g){if(f&&typeof f=="string"&&m.comma&&f.indexOf(",")>-1){if(g&&m.throwOnLimitExceeded)for(var x=0,v=f.indexOf(",");v>-1;){if(x+=1,x>=m.arrayLimit)throw new RangeError("Array limit exceeded. Only "+m.arrayLimit+" element"+(m.arrayLimit===1?"":"s")+" allowed in an array.");v=f.indexOf(",",v+1)}return f.split(",")}if(m.throwOnLimitExceeded&&p>=m.arrayLimit)throw new RangeError("Array limit exceeded. Only "+m.arrayLimit+" element"+(m.arrayLimit===1?"":"s")+" allowed in an array.");return f},o="utf8=%26%2310003%3B",a="utf8=%E2%9C%93",c=function(m,p){var g={__proto__:null},x=p.ignoreQueryPrefix?m.replace(/^\?/,""):m;x=x.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var v=p.parameterLimit===1/0?void 0:p.parameterLimit,y=x.split(p.delimiter,p.throwOnLimitExceeded&&typeof v<"u"?v+1:v);if(p.throwOnLimitExceeded&&typeof v<"u"&&y.length>v)throw new RangeError("Parameter limit exceeded. Only "+v+" parameter"+(v===1?"":"s")+" allowed.");var S=-1,C,w=p.charset;if(p.charsetSentinel)for(C=0;C<y.length;++C)y[C].indexOf("utf8=")===0&&(y[C]===a?w="utf-8":y[C]===o&&(w="iso-8859-1"),S=C,C=y.length);for(C=0;C<y.length;++C)if(C!==S){var b=y[C],_=b.indexOf("]="),A=_===-1?b.indexOf("="):_+1,P,E;if(A===-1?(P=p.decoder(b,i.decoder,w,"key"),E=p.strictNullHandling?null:""):(P=p.decoder(b.slice(0,A),i.decoder,w,"key"),P!==null&&(E=s.maybeMap(r(b.slice(A+1),p,t(g[P])?g[P].length:0,b.indexOf("[]=")===-1),function(O){return p.decoder(O,i.decoder,w,"value")}))),E&&p.interpretNumericEntities&&w==="iso-8859-1"&&(E=n(String(E))),b.indexOf("[]=")>-1&&(E=t(E)?[E]:E),p.comma&&t(E)&&E.length>p.arrayLimit&&(E=s.combine([],E,p.arrayLimit,p.plainObjects,p.throwOnLimitExceeded)),P!==null){var R=e.call(g,P);R&&(p.duplicates==="combine"||b.indexOf("[]=")>-1)?g[P]=s.combine(g[P],E,p.arrayLimit,p.plainObjects,p.throwOnLimitExceeded):(!R||p.duplicates==="last")&&(g[P]=E)}}return g},l=function(f,m,p,g){var x=0;if(f.length>0&&f[f.length-1]==="[]"){var v=f.slice(0,-1).join("");x=Array.isArray(m)&&m[v]?m[v].length:0}for(var y=g?m:r(m,p,x),S=f.length-1;S>=0;--S){var C,w=f[S];if(w==="[]"&&p.parseArrays)s.isOverflow(y)?C=y:C=p.allowEmptyArrays&&(y===""||p.strictNullHandling&&y===null)?[]:s.combine([],y,p.arrayLimit,p.plainObjects,p.throwOnLimitExceeded);else{C=p.plainObjects?{__proto__:null}:{};var b=w.charAt(0)==="["&&w.charAt(w.length-1)==="]"?w.slice(1,-1):w,_=p.decodeDotInKeys?b.replace(/%2E/g,"."):b,A=parseInt(_,10),P=!isNaN(A)&&w!==_&&String(A)===_&&A>=0&&p.parseArrays;if(!p.parseArrays&&_==="")C={0:y};else if(P&&A<p.arrayLimit)C=[],C[A]=y;else{if(P&&p.throwOnLimitExceeded)throw new RangeError("Array limit exceeded. Only "+p.arrayLimit+" element"+(p.arrayLimit===1?"":"s")+" allowed in an array.");P?(C[A]=y,s.markOverflow(C,A)):_!=="__proto__"&&(C[_]=y)}}y=C}return y},h=function(m,p){var g=p.allowDots?m.replace(/\.([^.[]+)/g,"[$1]"):m;if(p.depth<=0)return!p.plainObjects&&e.call(Object.prototype,g)&&!p.allowPrototypes?void 0:[g];var x=[],v=g.indexOf("["),y=v>=0?g.slice(0,v):g;if(y){if(!p.plainObjects&&e.call(Object.prototype,y)&&!p.allowPrototypes)return;x[x.length]=y}for(var S=g.length,C=v,w=0;C>=0&&w<p.depth;){for(var b=1,_=C+1,A=-1;_<S&&A<0;){var P=g.charCodeAt(_);P===91?b+=1:P===93&&(b-=1,b===0&&(A=_)),_+=1}if(A<0)return x[x.length]="["+g.slice(C)+"]",x;var E=g.slice(C,A+1),R=E.slice(1,-1);if(!p.plainObjects&&e.call(Object.prototype,R)&&!p.allowPrototypes)return;x[x.length]=E,w+=1,C=g.indexOf("[",A+1)}if(C>=0){if(p.strictDepth===!0)throw new RangeError("Input depth exceeded depth option of "+p.depth+" and strictDepth is true");x[x.length]="["+g.slice(C)+"]"}return x},u=function(m,p,g,x){if(m){var v=h(m,g);if(v)return l(v,p,g,x)}},d=function(m){if(!m)return i;if(typeof m.allowEmptyArrays<"u"&&typeof m.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof m.decodeDotInKeys<"u"&&typeof m.decodeDotInKeys!="boolean")throw new TypeError("`decodeDotInKeys` option can only be `true` or `false`, when provided");if(m.decoder!==null&&typeof m.decoder<"u"&&typeof m.decoder!="function")throw new TypeError("Decoder has to be a function.");if(typeof m.charset<"u"&&m.charset!=="utf-8"&&m.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");if(typeof m.throwOnLimitExceeded<"u"&&typeof m.throwOnLimitExceeded!="boolean")throw new TypeError("`throwOnLimitExceeded` option must be a boolean");var p=typeof m.charset>"u"?i.charset:m.charset,g=typeof m.duplicates>"u"?i.duplicates:m.duplicates;if(g!=="combine"&&g!=="first"&&g!=="last")throw new TypeError("The duplicates option must be either combine, first, or last");var x=typeof m.allowDots>"u"?m.decodeDotInKeys===!0?!0:i.allowDots:!!m.allowDots;return{allowDots:x,allowEmptyArrays:typeof m.allowEmptyArrays=="boolean"?!!m.allowEmptyArrays:i.allowEmptyArrays,allowPrototypes:typeof m.allowPrototypes=="boolean"?m.allowPrototypes:i.allowPrototypes,allowSparse:typeof m.allowSparse=="boolean"?m.allowSparse:i.allowSparse,arrayLimit:typeof m.arrayLimit=="number"?m.arrayLimit:i.arrayLimit,charset:p,charsetSentinel:typeof m.charsetSentinel=="boolean"?m.charsetSentinel:i.charsetSentinel,comma:typeof m.comma=="boolean"?m.comma:i.comma,decodeDotInKeys:typeof m.decodeDotInKeys=="boolean"?m.decodeDotInKeys:i.decodeDotInKeys,decoder:typeof m.decoder=="function"?m.decoder:i.decoder,delimiter:typeof m.delimiter=="string"||s.isRegExp(m.delimiter)?m.delimiter:i.delimiter,depth:typeof m.depth=="number"||m.depth===!1?+m.depth:i.depth,duplicates:g,ignoreQueryPrefix:m.ignoreQueryPrefix===!0,interpretNumericEntities:typeof m.interpretNumericEntities=="boolean"?m.interpretNumericEntities:i.interpretNumericEntities,parameterLimit:typeof m.parameterLimit=="number"?m.parameterLimit:i.parameterLimit,parseArrays:m.parseArrays!==!1,plainObjects:typeof m.plainObjects=="boolean"?m.plainObjects:i.plainObjects,strictDepth:typeof m.strictDepth=="boolean"?!!m.strictDepth:i.strictDepth,strictMerge:typeof m.strictMerge=="boolean"?!!m.strictMerge:i.strictMerge,strictNullHandling:typeof m.strictNullHandling=="boolean"?m.strictNullHandling:i.strictNullHandling,throwOnLimitExceeded:typeof m.throwOnLimitExceeded=="boolean"?m.throwOnLimitExceeded:!1}};return Pd=function(f,m){var p=d(m);if(f===""||f===null||typeof f>"u")return p.plainObjects?{__proto__:null}:{};for(var g=typeof f=="string"?c(f,p):f,x=p.plainObjects?{__proto__:null}:{},v=Object.keys(g),y=0;y<v.length;++y){var S=v[y],C=u(S,g[S],p,typeof f=="string");x=s.merge(x,C,p)}return p.allowSparse===!0?x:s.compact(x)},Pd}var kd,B0;function B_(){if(B0)return kd;B0=1;var s=O_(),e=L_(),t=mp();return kd={formats:t,parse:e,stringify:s},kd}var N0;function N_(){if(N0)return Dr;N0=1;var s=r_();function e(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}var t=/^([a-z0-9.+-]+:)/i,i=/:[0-9]*$/,n=/^(\/\/?(?!\/)[^?\s]*)(\?[^\s]*)?$/,r=["<",">",'"',"`"," ","\r",`
|
||
`," "],o=["{","}","|","\\","^","`"].concat(r),a=["'"].concat(o),c=["%","/","?",";","#"].concat(a),l=["/","?","#"],h=255,u=/^[+a-z0-9A-Z_-]{0,63}$/,d=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,f={javascript:!0,"javascript:":!0},m={javascript:!0,"javascript:":!0},p={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},g=B_();function x(C,w,b){if(C&&typeof C=="object"&&C instanceof e)return C;var _=new e;return _.parse(C,w,b),_}e.prototype.parse=function(C,w,b){if(typeof C!="string")throw new TypeError("Parameter 'url' must be a string, not "+typeof C);var _=C.indexOf("?"),A=_!==-1&&_<C.indexOf("#")?"?":"#",P=C.split(A),E=/\\/g;P[0]=P[0].replace(E,"/"),C=P.join(A);var R=C;if(R=R.trim(),!b&&C.split("#").length===1){var O=n.exec(R);if(O)return this.path=R,this.href=R,this.pathname=O[1],O[2]?(this.search=O[2],w?this.query=g.parse(this.search.substr(1)):this.query=this.search.substr(1)):w&&(this.search="",this.query={}),this}var U=t.exec(R);if(U){U=U[0];var Y=U.toLowerCase();this.protocol=Y,R=R.substr(U.length)}if(b||U||R.match(/^\/\/[^@/]+@[^@/]+/)){var $=R.substr(0,2)==="//";$&&!(U&&m[U])&&(R=R.substr(2),this.slashes=!0)}if(!m[U]&&($||U&&!p[U])){for(var X=-1,D=0;D<l.length;D++){var F=R.indexOf(l[D]);F!==-1&&(X===-1||F<X)&&(X=F)}var N,k;X===-1?k=R.lastIndexOf("@"):k=R.lastIndexOf("@",X),k!==-1&&(N=R.slice(0,k),R=R.slice(k+1),this.auth=decodeURIComponent(N)),X=-1;for(var D=0;D<c.length;D++){var F=R.indexOf(c[D]);F!==-1&&(X===-1||F<X)&&(X=F)}X===-1&&(X=R.length),this.host=R.slice(0,X),R=R.slice(X),this.parseHost(),this.hostname=this.hostname||"";var V=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!V)for(var G=this.hostname.split(/\./),D=0,W=G.length;D<W;D++){var Z=G[D];if(Z&&!Z.match(u)){for(var ne="",oe=0,de=Z.length;oe<de;oe++)Z.charCodeAt(oe)>127?ne+="x":ne+=Z[oe];if(!ne.match(u)){var pe=G.slice(0,D),he=G.slice(D+1),me=Z.match(d);me&&(pe.push(me[1]),he.unshift(me[2])),he.length&&(R="/"+he.join(".")+R),this.hostname=pe.join(".");break}}}this.hostname.length>h?this.hostname="":this.hostname=this.hostname.toLowerCase(),V||(this.hostname=s.toASCII(this.hostname));var H=this.port?":"+this.port:"",z=this.hostname||"";this.host=z+H,this.href+=this.host,V&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),R[0]!=="/"&&(R="/"+R))}if(!f[Y])for(var D=0,W=a.length;D<W;D++){var K=a[D];if(R.indexOf(K)!==-1){var B=encodeURIComponent(K);B===K&&(B=escape(K)),R=R.split(K).join(B)}}var L=R.indexOf("#");L!==-1&&(this.hash=R.substr(L),R=R.slice(0,L));var j=R.indexOf("?");if(j!==-1?(this.search=R.substr(j),this.query=R.substr(j+1),w&&(this.query=g.parse(this.query)),R=R.slice(0,j)):w&&(this.search="",this.query={}),R&&(this.pathname=R),p[Y]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var H=this.pathname||"",ie=this.search||"";this.path=H+ie}return this.href=this.format(),this};function v(C){return typeof C=="string"&&(C=x(C)),C instanceof e?C.format():e.prototype.format.call(C)}e.prototype.format=function(){var C=this.auth||"";C&&(C=encodeURIComponent(C),C=C.replace(/%3A/i,":"),C+="@");var w=this.protocol||"",b=this.pathname||"",_=this.hash||"",A=!1,P="";this.host?A=C+this.host:this.hostname&&(A=C+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&(A+=":"+this.port)),this.query&&typeof this.query=="object"&&Object.keys(this.query).length&&(P=g.stringify(this.query,{arrayFormat:"repeat",addQueryPrefix:!1}));var E=this.search||P&&"?"+P||"";return w&&w.substr(-1)!==":"&&(w+=":"),this.slashes||(!w||p[w])&&A!==!1?(A="//"+(A||""),b&&b.charAt(0)!=="/"&&(b="/"+b)):A||(A=""),_&&_.charAt(0)!=="#"&&(_="#"+_),E&&E.charAt(0)!=="?"&&(E="?"+E),b=b.replace(/[?#]/g,function(R){return encodeURIComponent(R)}),E=E.replace("#","%23"),w+A+b+E+_};function y(C,w){return x(C,!1,!0).resolve(w)}e.prototype.resolve=function(C){return this.resolveObject(x(C,!1,!0)).format()};function S(C,w){return C?x(C,!1,!0).resolveObject(w):w}return e.prototype.resolveObject=function(C){if(typeof C=="string"){var w=new e;w.parse(C,!1,!0),C=w}for(var b=new e,_=Object.keys(this),A=0;A<_.length;A++){var P=_[A];b[P]=this[P]}if(b.hash=C.hash,C.href==="")return b.href=b.format(),b;if(C.slashes&&!C.protocol){for(var E=Object.keys(C),R=0;R<E.length;R++){var O=E[R];O!=="protocol"&&(b[O]=C[O])}return p[b.protocol]&&b.hostname&&!b.pathname&&(b.pathname="/",b.path=b.pathname),b.href=b.format(),b}if(C.protocol&&C.protocol!==b.protocol){if(!p[C.protocol]){for(var U=Object.keys(C),Y=0;Y<U.length;Y++){var $=U[Y];b[$]=C[$]}return b.href=b.format(),b}if(b.protocol=C.protocol,!C.host&&!m[C.protocol]){for(var W=(C.pathname||"").split("/");W.length&&!(C.host=W.shift()););C.host||(C.host=""),C.hostname||(C.hostname=""),W[0]!==""&&W.unshift(""),W.length<2&&W.unshift(""),b.pathname=W.join("/")}else b.pathname=C.pathname;if(b.search=C.search,b.query=C.query,b.host=C.host||"",b.auth=C.auth,b.hostname=C.hostname||C.host,b.port=C.port,b.pathname||b.search){var X=b.pathname||"",D=b.search||"";b.path=X+D}return b.slashes=b.slashes||C.slashes,b.href=b.format(),b}var F=b.pathname&&b.pathname.charAt(0)==="/",N=C.host||C.pathname&&C.pathname.charAt(0)==="/",k=N||F||b.host&&C.pathname,V=k,G=b.pathname&&b.pathname.split("/")||[],W=C.pathname&&C.pathname.split("/")||[],Z=b.protocol&&!p[b.protocol];if(Z&&(b.hostname="",b.port=null,b.host&&(G[0]===""?G[0]=b.host:G.unshift(b.host)),b.host="",C.protocol&&(C.hostname=null,C.port=null,C.host&&(W[0]===""?W[0]=C.host:W.unshift(C.host)),C.host=null),k=k&&(W[0]===""||G[0]==="")),N)b.host=C.host||C.host===""?C.host:b.host,b.hostname=C.hostname||C.hostname===""?C.hostname:b.hostname,b.search=C.search,b.query=C.query,G=W;else if(W.length)G||(G=[]),G.pop(),G=G.concat(W),b.search=C.search,b.query=C.query;else if(C.search!=null){if(Z){b.host=G.shift(),b.hostname=b.host;var ne=b.host&&b.host.indexOf("@")>0?b.host.split("@"):!1;ne&&(b.auth=ne.shift(),b.hostname=ne.shift(),b.host=b.hostname)}return b.search=C.search,b.query=C.query,(b.pathname!==null||b.search!==null)&&(b.path=(b.pathname?b.pathname:"")+(b.search?b.search:"")),b.href=b.format(),b}if(!G.length)return b.pathname=null,b.search?b.path="/"+b.search:b.path=null,b.href=b.format(),b;for(var oe=G.slice(-1)[0],de=(b.host||C.host||G.length>1)&&(oe==="."||oe==="..")||oe==="",pe=0,he=G.length;he>=0;he--)oe=G[he],oe==="."?G.splice(he,1):oe===".."?(G.splice(he,1),pe++):pe&&(G.splice(he,1),pe--);if(!k&&!V)for(;pe--;pe)G.unshift("..");k&&G[0]!==""&&(!G[0]||G[0].charAt(0)!=="/")&&G.unshift(""),de&&G.join("/").substr(-1)!=="/"&&G.push("");var me=G[0]===""||G[0]&&G[0].charAt(0)==="/";if(Z){b.hostname=me?"":G.length?G.shift():"",b.host=b.hostname;var ne=b.host&&b.host.indexOf("@")>0?b.host.split("@"):!1;ne&&(b.auth=ne.shift(),b.hostname=ne.shift(),b.host=b.hostname)}return k=k||b.host&&G.length,k&&!me&&G.unshift(""),G.length>0?b.pathname=G.join("/"):(b.pathname=null,b.path=null),(b.pathname!==null||b.search!==null)&&(b.path=(b.pathname?b.pathname:"")+(b.search?b.search:"")),b.auth=C.auth||b.auth,b.slashes=b.slashes||C.slashes,b.href=b.format(),b},e.prototype.parseHost=function(){var C=this.host,w=i.exec(C);w&&(w=w[0],w!==":"&&(this.port=w.substr(1)),C=C.substr(0,C.length-w.length)),C&&(this.hostname=C)},Dr.parse=x,Dr.resolve=y,Dr.resolveObject=S,Dr.format=v,Dr.Url=e,Dr}N_();const D0={};function mt(s,e,t=3){if(D0[e])return;let i=new Error().stack;typeof i>"u"?console.warn("PixiJS Deprecation Warning: ",`${e}
|
||
Deprecated since v${s}`):(i=i.split(`
|
||
`).splice(t).join(`
|
||
`),console.groupCollapsed?(console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s","color:#614108;background:#fffbe6","font-weight:normal;color:#614108;background:#fffbe6",`${e}
|
||
Deprecated since v${s}`),console.warn(i),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",`${e}
|
||
Deprecated since v${s}`),console.warn(i))),D0[e]=!0}function Ss(s){if(typeof s!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(s)}`)}function Pa(s){return s.split("?")[0].split("#")[0]}function D_(s){return s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function U_(s,e,t){return s.replace(new RegExp(D_(e),"g"),t)}function $_(s,e){let t="",i=0,n=-1,r=0,o=-1;for(let a=0;a<=s.length;++a){if(a<s.length)o=s.charCodeAt(a);else{if(o===47)break;o=47}if(o===47){if(!(n===a-1||r===1))if(n!==a-1&&r===2){if(t.length<2||i!==2||t.charCodeAt(t.length-1)!==46||t.charCodeAt(t.length-2)!==46){if(t.length>2){const c=t.lastIndexOf("/");if(c!==t.length-1){c===-1?(t="",i=0):(t=t.slice(0,c),i=t.length-1-t.lastIndexOf("/")),n=a,r=0;continue}}else if(t.length===2||t.length===1){t="",i=0,n=a,r=0;continue}}}else t.length>0?t+=`/${s.slice(n+1,a)}`:t=s.slice(n+1,a),i=a-n-1;n=a,r=0}else o===46&&r!==-1?++r:r=-1}return t}const si={toPosix(s){return U_(s,"\\","/")},isUrl(s){return/^https?:/.test(this.toPosix(s))},isDataUrl(s){return/^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i.test(s)},isBlobUrl(s){return s.startsWith("blob:")},hasProtocol(s){return/^[^/:]+:/.test(this.toPosix(s))},getProtocol(s){Ss(s),s=this.toPosix(s);const e=/^file:\/\/\//.exec(s);if(e)return e[0];const t=/^[^/:]+:\/{0,2}/.exec(s);return t?t[0]:""},toAbsolute(s,e,t){if(Ss(s),this.isDataUrl(s)||this.isBlobUrl(s))return s;const i=Pa(this.toPosix(e??Be.ADAPTER.getBaseUrl())),n=Pa(this.toPosix(t??this.rootname(i)));return s=this.toPosix(s),s.startsWith("/")?si.join(n,s.slice(1)):this.isAbsolute(s)?s:this.join(i,s)},normalize(s){if(Ss(s),s.length===0)return".";if(this.isDataUrl(s)||this.isBlobUrl(s))return s;s=this.toPosix(s);let e="";const t=s.startsWith("/");this.hasProtocol(s)&&(e=this.rootname(s),s=s.slice(e.length));const i=s.endsWith("/");return s=$_(s),s.length>0&&i&&(s+="/"),t?`/${s}`:e+s},isAbsolute(s){return Ss(s),s=this.toPosix(s),this.hasProtocol(s)?!0:s.startsWith("/")},join(...s){if(s.length===0)return".";let e;for(let t=0;t<s.length;++t){const i=s[t];if(Ss(i),i.length>0)if(e===void 0)e=i;else{const n=s[t-1]??"";this.joinExtensions.includes(this.extname(n).toLowerCase())?e+=`/../${i}`:e+=`/${i}`}}return e===void 0?".":this.normalize(e)},dirname(s){if(Ss(s),s.length===0)return".";s=this.toPosix(s);let e=s.charCodeAt(0);const t=e===47;let i=-1,n=!0;const r=this.getProtocol(s),o=s;s=s.slice(r.length);for(let a=s.length-1;a>=1;--a)if(e=s.charCodeAt(a),e===47){if(!n){i=a;break}}else n=!1;return i===-1?t?"/":this.isUrl(o)?r+s:r:t&&i===1?"//":r+s.slice(0,i)},rootname(s){Ss(s),s=this.toPosix(s);let e="";if(s.startsWith("/")?e="/":e=this.getProtocol(s),this.isUrl(s)){const t=s.indexOf("/",e.length);t!==-1?e=s.slice(0,t):e=s,e.endsWith("/")||(e+="/")}return e},basename(s,e){Ss(s),e&&Ss(e),s=Pa(this.toPosix(s));let t=0,i=-1,n=!0,r;if(e!==void 0&&e.length>0&&e.length<=s.length){if(e.length===s.length&&e===s)return"";let o=e.length-1,a=-1;for(r=s.length-1;r>=0;--r){const c=s.charCodeAt(r);if(c===47){if(!n){t=r+1;break}}else a===-1&&(n=!1,a=r+1),o>=0&&(c===e.charCodeAt(o)?--o===-1&&(i=r):(o=-1,i=a))}return t===i?i=a:i===-1&&(i=s.length),s.slice(t,i)}for(r=s.length-1;r>=0;--r)if(s.charCodeAt(r)===47){if(!n){t=r+1;break}}else i===-1&&(n=!1,i=r+1);return i===-1?"":s.slice(t,i)},extname(s){Ss(s),s=Pa(this.toPosix(s));let e=-1,t=0,i=-1,n=!0,r=0;for(let o=s.length-1;o>=0;--o){const a=s.charCodeAt(o);if(a===47){if(!n){t=o+1;break}continue}i===-1&&(n=!1,i=o+1),a===46?e===-1?e=o:r!==1&&(r=1):e!==-1&&(r=-1)}return e===-1||i===-1||r===0||r===1&&e===i-1&&e===t+1?"":s.slice(e,i)},parse(s){Ss(s);const e={root:"",dir:"",base:"",ext:"",name:""};if(s.length===0)return e;s=Pa(this.toPosix(s));let t=s.charCodeAt(0);const i=this.isAbsolute(s);let n;e.root=this.rootname(s),i||this.hasProtocol(s)?n=1:n=0;let r=-1,o=0,a=-1,c=!0,l=s.length-1,h=0;for(;l>=n;--l){if(t=s.charCodeAt(l),t===47){if(!c){o=l+1;break}continue}a===-1&&(c=!1,a=l+1),t===46?r===-1?r=l:h!==1&&(h=1):r!==-1&&(h=-1)}return r===-1||a===-1||h===0||h===1&&r===a-1&&r===o+1?a!==-1&&(o===0&&i?e.base=e.name=s.slice(1,a):e.base=e.name=s.slice(o,a)):(o===0&&i?(e.name=s.slice(1,r),e.base=s.slice(1,a)):(e.name=s.slice(o,r),e.base=s.slice(o,a)),e.ext=s.slice(r,a)),e.dir=this.dirname(s),e},sep:"/",delimiter:":",joinExtensions:[".html"]};let Fd;async function X_(){return Fd??(Fd=(async()=>{var r;const s=document.createElement("canvas").getContext("webgl");if(!s)return bi.UNPACK;const e=await new Promise(o=>{const a=document.createElement("video");a.onloadeddata=()=>o(a),a.onerror=()=>o(null),a.autoplay=!1,a.crossOrigin="anonymous",a.preload="auto",a.src="data:video/webm;base64,GkXfo59ChoEBQveBAULygQRC84EIQoKEd2VibUKHgQJChYECGFOAZwEAAAAAAAHTEU2bdLpNu4tTq4QVSalmU6yBoU27i1OrhBZUrmtTrIHGTbuMU6uEElTDZ1OsggEXTbuMU6uEHFO7a1OsggG97AEAAAAAAABZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmoCrXsYMPQkBNgIRMYXZmV0GETGF2ZkSJiEBEAAAAAAAAFlSua8yuAQAAAAAAAEPXgQFzxYgAAAAAAAAAAZyBACK1nIN1bmSIgQCGhVZfVlA5g4EBI+ODhAJiWgDglLCBArqBApqBAlPAgQFVsIRVuYEBElTDZ9Vzc9JjwItjxYgAAAAAAAAAAWfInEWjh0VOQ09ERVJEh49MYXZjIGxpYnZweC12cDlnyKJFo4hEVVJBVElPTkSHlDAwOjAwOjAwLjA0MDAwMDAwMAAAH0O2dcfngQCgwqGggQAAAIJJg0IAABAAFgA4JBwYSgAAICAAEb///4r+AAB1oZ2mm+6BAaWWgkmDQgAAEAAWADgkHBhKAAAgIABIQBxTu2uRu4+zgQC3iveBAfGCAXHwgQM=",a.load()});if(!e)return bi.UNPACK;const t=s.createTexture();s.bindTexture(s.TEXTURE_2D,t);const i=s.createFramebuffer();s.bindFramebuffer(s.FRAMEBUFFER,i),s.framebufferTexture2D(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0,s.TEXTURE_2D,t,0),s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),s.pixelStorei(s.UNPACK_COLORSPACE_CONVERSION_WEBGL,s.NONE),s.texImage2D(s.TEXTURE_2D,0,s.RGBA,s.RGBA,s.UNSIGNED_BYTE,e);const n=new Uint8Array(4);return s.readPixels(0,0,1,1,s.RGBA,s.UNSIGNED_BYTE,n),s.deleteFramebuffer(i),s.deleteTexture(t),(r=s.getExtension("WEBGL_lose_context"))==null||r.loseContext(),n[0]<=n[3]?bi.PMA:bi.UNPACK})()),Fd}let Od;function V_(){return typeof Od>"u"&&(Od=(function(){var e;const s={stencil:!0,failIfMajorPerformanceCaveat:Be.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT};try{if(!Be.ADAPTER.getWebGLRenderingContext())return!1;const t=Be.ADAPTER.createCanvas();let i=t.getContext("webgl",s)||t.getContext("experimental-webgl",s);const n=!!((e=i==null?void 0:i.getContextAttributes())!=null&&e.stencil);if(i){const r=i.getExtension("WEBGL_lose_context");r&&r.loseContext()}return i=null,n}catch{return!1}})()),Od}var Y_={grad:.9,turn:360,rad:360/(2*Math.PI)},wn=function(s){return typeof s=="string"?s.length>0:typeof s=="number"},xi=function(s,e,t){return e===void 0&&(e=0),t===void 0&&(t=Math.pow(10,e)),Math.round(t*s)/t+0},ps=function(s,e,t){return e===void 0&&(e=0),t===void 0&&(t=1),s>t?t:s>e?s:e},ab=function(s){return(s=isFinite(s)?s%360:0)>0?s:s+360},U0=function(s){return{r:ps(s.r,0,255),g:ps(s.g,0,255),b:ps(s.b,0,255),a:ps(s.a)}},Ld=function(s){return{r:xi(s.r),g:xi(s.g),b:xi(s.b),a:xi(s.a,3)}},G_=/^#([0-9a-f]{3,8})$/i,ql=function(s){var e=s.toString(16);return e.length<2?"0"+e:e},lb=function(s){var e=s.r,t=s.g,i=s.b,n=s.a,r=Math.max(e,t,i),o=r-Math.min(e,t,i),a=o?r===e?(t-i)/o:r===t?2+(i-e)/o:4+(e-t)/o:0;return{h:60*(a<0?a+6:a),s:r?o/r*100:0,v:r/255*100,a:n}},cb=function(s){var e=s.h,t=s.s,i=s.v,n=s.a;e=e/360*6,t/=100,i/=100;var r=Math.floor(e),o=i*(1-t),a=i*(1-(e-r)*t),c=i*(1-(1-e+r)*t),l=r%6;return{r:255*[i,a,o,o,c,i][l],g:255*[c,i,i,a,o,o][l],b:255*[o,o,c,i,i,a][l],a:n}},$0=function(s){return{h:ab(s.h),s:ps(s.s,0,100),l:ps(s.l,0,100),a:ps(s.a)}},X0=function(s){return{h:xi(s.h),s:xi(s.s),l:xi(s.l),a:xi(s.a,3)}},V0=function(s){return cb((t=(e=s).s,{h:e.h,s:(t*=((i=e.l)<50?i:100-i)/100)>0?2*t/(i+t)*100:0,v:i+t,a:e.a}));var e,t,i},Qa=function(s){return{h:(e=lb(s)).h,s:(n=(200-(t=e.s))*(i=e.v)/100)>0&&n<200?t*i/100/(n<=100?n:200-n)*100:0,l:n/2,a:e.a};var e,t,i,n},j_=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,H_=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,W_=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,z_=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Nf={string:[[function(s){var e=G_.exec(s);return e?(s=e[1]).length<=4?{r:parseInt(s[0]+s[0],16),g:parseInt(s[1]+s[1],16),b:parseInt(s[2]+s[2],16),a:s.length===4?xi(parseInt(s[3]+s[3],16)/255,2):1}:s.length===6||s.length===8?{r:parseInt(s.substr(0,2),16),g:parseInt(s.substr(2,2),16),b:parseInt(s.substr(4,2),16),a:s.length===8?xi(parseInt(s.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(s){var e=W_.exec(s)||z_.exec(s);return e?e[2]!==e[4]||e[4]!==e[6]?null:U0({r:Number(e[1])/(e[2]?100/255:1),g:Number(e[3])/(e[4]?100/255:1),b:Number(e[5])/(e[6]?100/255:1),a:e[7]===void 0?1:Number(e[7])/(e[8]?100:1)}):null},"rgb"],[function(s){var e=j_.exec(s)||H_.exec(s);if(!e)return null;var t,i,n=$0({h:(t=e[1],i=e[2],i===void 0&&(i="deg"),Number(t)*(Y_[i]||1)),s:Number(e[3]),l:Number(e[4]),a:e[5]===void 0?1:Number(e[5])/(e[6]?100:1)});return V0(n)},"hsl"]],object:[[function(s){var e=s.r,t=s.g,i=s.b,n=s.a,r=n===void 0?1:n;return wn(e)&&wn(t)&&wn(i)?U0({r:Number(e),g:Number(t),b:Number(i),a:Number(r)}):null},"rgb"],[function(s){var e=s.h,t=s.s,i=s.l,n=s.a,r=n===void 0?1:n;if(!wn(e)||!wn(t)||!wn(i))return null;var o=$0({h:Number(e),s:Number(t),l:Number(i),a:Number(r)});return V0(o)},"hsl"],[function(s){var e=s.h,t=s.s,i=s.v,n=s.a,r=n===void 0?1:n;if(!wn(e)||!wn(t)||!wn(i))return null;var o=(function(a){return{h:ab(a.h),s:ps(a.s,0,100),v:ps(a.v,0,100),a:ps(a.a)}})({h:Number(e),s:Number(t),v:Number(i),a:Number(r)});return cb(o)},"hsv"]]},Y0=function(s,e){for(var t=0;t<e.length;t++){var i=e[t][0](s);if(i)return[i,e[t][1]]}return[null,void 0]},q_=function(s){return typeof s=="string"?Y0(s.trim(),Nf.string):typeof s=="object"&&s!==null?Y0(s,Nf.object):[null,void 0]},Bd=function(s,e){var t=Qa(s);return{h:t.h,s:ps(t.s+100*e,0,100),l:t.l,a:t.a}},Nd=function(s){return(299*s.r+587*s.g+114*s.b)/1e3/255},G0=function(s,e){var t=Qa(s);return{h:t.h,s:t.s,l:ps(t.l+100*e,0,100),a:t.a}},Df=(function(){function s(e){this.parsed=q_(e)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return s.prototype.isValid=function(){return this.parsed!==null},s.prototype.brightness=function(){return xi(Nd(this.rgba),2)},s.prototype.isDark=function(){return Nd(this.rgba)<.5},s.prototype.isLight=function(){return Nd(this.rgba)>=.5},s.prototype.toHex=function(){return e=Ld(this.rgba),t=e.r,i=e.g,n=e.b,o=(r=e.a)<1?ql(xi(255*r)):"","#"+ql(t)+ql(i)+ql(n)+o;var e,t,i,n,r,o},s.prototype.toRgb=function(){return Ld(this.rgba)},s.prototype.toRgbString=function(){return e=Ld(this.rgba),t=e.r,i=e.g,n=e.b,(r=e.a)<1?"rgba("+t+", "+i+", "+n+", "+r+")":"rgb("+t+", "+i+", "+n+")";var e,t,i,n,r},s.prototype.toHsl=function(){return X0(Qa(this.rgba))},s.prototype.toHslString=function(){return e=X0(Qa(this.rgba)),t=e.h,i=e.s,n=e.l,(r=e.a)<1?"hsla("+t+", "+i+"%, "+n+"%, "+r+")":"hsl("+t+", "+i+"%, "+n+"%)";var e,t,i,n,r},s.prototype.toHsv=function(){return e=lb(this.rgba),{h:xi(e.h),s:xi(e.s),v:xi(e.v),a:xi(e.a,3)};var e},s.prototype.invert=function(){return Vs({r:255-(e=this.rgba).r,g:255-e.g,b:255-e.b,a:e.a});var e},s.prototype.saturate=function(e){return e===void 0&&(e=.1),Vs(Bd(this.rgba,e))},s.prototype.desaturate=function(e){return e===void 0&&(e=.1),Vs(Bd(this.rgba,-e))},s.prototype.grayscale=function(){return Vs(Bd(this.rgba,-1))},s.prototype.lighten=function(e){return e===void 0&&(e=.1),Vs(G0(this.rgba,e))},s.prototype.darken=function(e){return e===void 0&&(e=.1),Vs(G0(this.rgba,-e))},s.prototype.rotate=function(e){return e===void 0&&(e=15),this.hue(this.hue()+e)},s.prototype.alpha=function(e){return typeof e=="number"?Vs({r:(t=this.rgba).r,g:t.g,b:t.b,a:e}):xi(this.rgba.a,3);var t},s.prototype.hue=function(e){var t=Qa(this.rgba);return typeof e=="number"?Vs({h:e,s:t.s,l:t.l,a:t.a}):xi(t.h)},s.prototype.isEqual=function(e){return this.toHex()===Vs(e).toHex()},s})(),Vs=function(s){return s instanceof Df?s:new Df(s)},j0=[],K_=function(s){s.forEach(function(e){j0.indexOf(e)<0&&(e(Df,Nf),j0.push(e))})};function Z_(s,e){var t={white:"#ffffff",bisque:"#ffe4c4",blue:"#0000ff",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",antiquewhite:"#faebd7",aqua:"#00ffff",azure:"#f0ffff",whitesmoke:"#f5f5f5",papayawhip:"#ffefd5",plum:"#dda0dd",blanchedalmond:"#ffebcd",black:"#000000",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",cornsilk:"#fff8dc",cornflowerblue:"#6495ed",burlywood:"#deb887",aquamarine:"#7fffd4",beige:"#f5f5dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkkhaki:"#bdb76b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",peachpuff:"#ffdab9",darkmagenta:"#8b008b",darkred:"#8b0000",darkorchid:"#9932cc",darkorange:"#ff8c00",darkslateblue:"#483d8b",gray:"#808080",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",deeppink:"#ff1493",deepskyblue:"#00bfff",wheat:"#f5deb3",firebrick:"#b22222",floralwhite:"#fffaf0",ghostwhite:"#f8f8ff",darkviolet:"#9400d3",magenta:"#ff00ff",green:"#008000",dodgerblue:"#1e90ff",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",blueviolet:"#8a2be2",forestgreen:"#228b22",lawngreen:"#7cfc00",indianred:"#cd5c5c",indigo:"#4b0082",fuchsia:"#ff00ff",brown:"#a52a2a",maroon:"#800000",mediumblue:"#0000cd",lightcoral:"#f08080",darkturquoise:"#00ced1",lightcyan:"#e0ffff",ivory:"#fffff0",lightyellow:"#ffffe0",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",linen:"#faf0e6",mediumaquamarine:"#66cdaa",lemonchiffon:"#fffacd",lime:"#00ff00",khaki:"#f0e68c",mediumseagreen:"#3cb371",limegreen:"#32cd32",mediumspringgreen:"#00fa9a",lightskyblue:"#87cefa",lightblue:"#add8e6",midnightblue:"#191970",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",mintcream:"#f5fffa",lightslategray:"#778899",lightslategrey:"#778899",navajowhite:"#ffdead",navy:"#000080",mediumvioletred:"#c71585",powderblue:"#b0e0e6",palegoldenrod:"#eee8aa",oldlace:"#fdf5e6",paleturquoise:"#afeeee",mediumturquoise:"#48d1cc",mediumorchid:"#ba55d3",rebeccapurple:"#663399",lightsteelblue:"#b0c4de",mediumslateblue:"#7b68ee",thistle:"#d8bfd8",tan:"#d2b48c",orchid:"#da70d6",mediumpurple:"#9370db",purple:"#800080",pink:"#ffc0cb",skyblue:"#87ceeb",springgreen:"#00ff7f",palegreen:"#98fb98",red:"#ff0000",yellow:"#ffff00",slateblue:"#6a5acd",lavenderblush:"#fff0f5",peru:"#cd853f",palevioletred:"#db7093",violet:"#ee82ee",teal:"#008080",slategray:"#708090",slategrey:"#708090",aliceblue:"#f0f8ff",darkseagreen:"#8fbc8f",darkolivegreen:"#556b2f",greenyellow:"#adff2f",seagreen:"#2e8b57",seashell:"#fff5ee",tomato:"#ff6347",silver:"#c0c0c0",sienna:"#a0522d",lavender:"#e6e6fa",lightgreen:"#90ee90",orange:"#ffa500",orangered:"#ff4500",steelblue:"#4682b4",royalblue:"#4169e1",turquoise:"#40e0d0",yellowgreen:"#9acd32",salmon:"#fa8072",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},i={};for(var n in t)i[t[n]]=n;var r={};s.prototype.toName=function(o){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var a,c,l=i[this.toHex()];if(l)return l;if(o!=null&&o.closest){var h=this.toRgb(),u=1/0,d="black";if(!r.length)for(var f in t)r[f]=new s(t[f]).toRgb();for(var m in t){var p=(a=h,c=r[m],Math.pow(a.r-c.r,2)+Math.pow(a.g-c.g,2)+Math.pow(a.b-c.b,2));p<u&&(u=p,d=m)}return d}},e.string.push([function(o){var a=o.toLowerCase(),c=a==="transparent"?"#0000":t[a];return c?new s(c).toRgb():null},"name"])}K_([Z_]);const Bo=class Rc{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 Rc)this._value=this.cloneSource(e._value),this._int=e._int,this._components.set(e._components);else{if(e===null)throw new Error("Cannot set PIXI.Color#value to null");(this._value===null||!this.isSourceEqual(this._value,e))&&(this.normalize(e),this._value=this.cloneSource(e))}}get value(){return this._value}cloneSource(e){return typeof e=="string"||typeof e=="number"||e instanceof Number||e===null?e:Array.isArray(e)||ArrayBuffer.isView(e)?e.slice(0):typeof e=="object"&&e!==null?{...e}:e}isSourceEqual(e,t){const i=typeof e;if(i!==typeof t)return!1;if(i==="number"||i==="string"||e instanceof Number)return e===t;if(Array.isArray(e)&&Array.isArray(t)||ArrayBuffer.isView(e)&&ArrayBuffer.isView(t))return e.length!==t.length?!1:e.every((n,r)=>n===t[r]);if(e!==null&&t!==null){const n=Object.keys(e),r=Object.keys(t);return n.length!==r.length?!1:n.every(o=>e[o]===t[o])}return e===t}toRgba(){const[e,t,i,n]=this._components;return{r:e,g:t,b:i,a:n}}toRgb(){const[e,t,i]=this._components;return{r:e,g:t,b:i}}toRgbaString(){const[e,t,i]=this.toUint8RgbArray();return`rgba(${e},${t},${i},${this.alpha})`}toUint8RgbArray(e){const[t,i,n]=this._components;return e=e??[],e[0]=Math.round(t*255),e[1]=Math.round(i*255),e[2]=Math.round(n*255),e}toRgbArray(e){e=e??[];const[t,i,n]=this._components;return e[0]=t,e[1]=i,e[2]=n,e}toNumber(){return this._int}toLittleEndianNumber(){const e=this._int;return(e>>16)+(e&65280)+((e&255)<<16)}multiply(e){const[t,i,n,r]=Rc.temp.setValue(e)._components;return this._components[0]*=t,this._components[1]*=i,this._components[2]*=n,this._components[3]*=r,this.refreshInt(),this._value=null,this}premultiply(e,t=!0){return t&&(this._components[0]*=e,this._components[1]*=e,this._components[2]*=e),this._components[3]=e,this.refreshInt(),this._value=null,this}toPremultiplied(e,t=!0){if(e===1)return(255<<24)+this._int;if(e===0)return t?0:this._int;let i=this._int>>16&255,n=this._int>>8&255,r=this._int&255;return t&&(i=i*e+.5|0,n=n*e+.5|0,r=r*e+.5|0),(e*255<<24)+(i<<16)+(n<<8)+r}toHex(){const e=this._int.toString(16);return`#${"000000".substring(0,6-e.length)+e}`}toHexa(){const e=Math.round(this._components[3]*255).toString(16);return this.toHex()+"00".substring(0,2-e.length)+e}setAlpha(e){return this._components[3]=this._clamp(e),this}round(e){const[t,i,n]=this._components;return this._components[0]=Math.round(t*e)/e,this._components[1]=Math.round(i*e)/e,this._components[2]=Math.round(n*e)/e,this.refreshInt(),this._value=null,this}toArray(e){e=e??[];const[t,i,n,r]=this._components;return e[0]=t,e[1]=i,e[2]=n,e[3]=r,e}normalize(e){let t,i,n,r;if((typeof e=="number"||e instanceof Number)&&e>=0&&e<=16777215){const o=e;t=(o>>16&255)/255,i=(o>>8&255)/255,n=(o&255)/255,r=1}else if((Array.isArray(e)||e instanceof Float32Array)&&e.length>=3&&e.length<=4)e=this._clamp(e),[t,i,n,r=1]=e;else if((e instanceof Uint8Array||e instanceof Uint8ClampedArray)&&e.length>=3&&e.length<=4)e=this._clamp(e,0,255),[t,i,n,r=255]=e,t/=255,i/=255,n/=255,r/=255;else if(typeof e=="string"||typeof e=="object"){if(typeof e=="string"){const a=Rc.HEX_PATTERN.exec(e);a&&(e=`#${a[2]}`)}const o=Vs(e);o.isValid()&&({r:t,g:i,b:n,a:r}=o.rgba,t/=255,i/=255,n/=255)}if(t!==void 0)this._components[0]=t,this._components[1]=i,this._components[2]=n,this._components[3]=r,this.refreshInt();else throw new Error(`Unable to convert color ${e}`)}refreshInt(){this._clamp(this._components);const[e,t,i]=this._components;this._int=(e*255<<16)+(t*255<<8)+(i*255|0)}_clamp(e,t=0,i=1){return typeof e=="number"?Math.min(Math.max(e,t),i):(e.forEach((n,r)=>{e[r]=Math.min(Math.max(n,t),i)}),e)}};Bo.shared=new Bo,Bo.temp=new Bo,Bo.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;let At=Bo;function J_(s){return mt("7.2.0","utils.hex2string is deprecated, use Color#toHex instead"),At.shared.setValue(s).toHex()}function Q_(s){return mt("7.2.0","utils.rgb2hex is deprecated, use Color#toNumber instead"),At.shared.setValue(s).toNumber()}function eC(){const s=[],e=[];for(let i=0;i<32;i++)s[i]=i,e[i]=i;s[We.NORMAL_NPM]=We.NORMAL,s[We.ADD_NPM]=We.ADD,s[We.SCREEN_NPM]=We.SCREEN,e[We.NORMAL]=We.NORMAL_NPM,e[We.ADD]=We.ADD_NPM,e[We.SCREEN]=We.SCREEN_NPM;const t=[];return t.push(e),t.push(s),t}const hb=eC();function ub(s,e){return hb[e?1:0][s]}function tC(s,e=null){const t=s*6;if(e=e||new Uint16Array(t),e.length!==t)throw new Error(`Out buffer length is incorrect, got ${e.length} and expected ${t}`);for(let i=0,n=0;i<t;i+=6,n+=4)e[i+0]=n+0,e[i+1]=n+1,e[i+2]=n+2,e[i+3]=n+0,e[i+4]=n+2,e[i+5]=n+3;return e}function db(s){if(s.BYTES_PER_ELEMENT===4)return s instanceof Float32Array?"Float32Array":s instanceof Uint32Array?"Uint32Array":"Int32Array";if(s.BYTES_PER_ELEMENT===2){if(s instanceof Uint16Array)return"Uint16Array"}else if(s.BYTES_PER_ELEMENT===1&&s instanceof Uint8Array)return"Uint8Array";return null}function ih(s){return s+=s===0?1:0,--s,s|=s>>>1,s|=s>>>2,s|=s>>>4,s|=s>>>8,s|=s>>>16,s+1}function H0(s){return!(s&s-1)&&!!s}function W0(s){let e=(s>65535?1:0)<<4;s>>>=e;let t=(s>255?1:0)<<3;return s>>>=t,e|=t,t=(s>15?1:0)<<2,s>>>=t,e|=t,t=(s>3?1:0)<<1,s>>>=t,e|=t,e|s>>1}function Jo(s,e,t){const i=s.length;let n;if(e>=i||t===0)return;t=e+t>i?i-e:t;const r=i-t;for(n=e;n<r;++n)s[n]=s[n+t];s.length=r}function yr(s){return s===0?0:s<0?-1:1}let iC=0;function ho(){return++iC}const Uf=class{constructor(s,e,t,i){this.left=s,this.top=e,this.right=t,this.bottom=i}get width(){return this.right-this.left}get height(){return this.bottom-this.top}isEmpty(){return this.left===this.right||this.top===this.bottom}};Uf.EMPTY=new Uf(0,0,0,0);let z0=Uf;const q0={},Ys=Object.create(null),er=Object.create(null);class sC{constructor(e,t,i){this._canvas=Be.ADAPTER.createCanvas(),this._context=this._canvas.getContext("2d"),this.resolution=i||Be.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 K0(s,e,t){for(let i=0,n=4*t*e;i<e;++i,n+=4)if(s[n+3]!==0)return!1;return!0}function Z0(s,e,t,i,n){const r=4*e;for(let o=i,a=i*r+4*t;o<=n;++o,a+=r)if(s[a+3]!==0)return!1;return!0}function nC(s){const{width:e,height:t}=s,i=s.getContext("2d",{willReadFrequently:!0});if(i===null)throw new TypeError("Failed to get canvas 2D context");const n=i.getImageData(0,0,e,t).data;let r=0,o=0,a=e-1,c=t-1;for(;o<t&&K0(n,e,o);)++o;if(o===t)return z0.EMPTY;for(;K0(n,e,c);)--c;for(;Z0(n,e,r,o,c);)++r;for(;Z0(n,e,a,o,c);)--a;return++a,++c,new z0(r,o,a,c)}function rC(s){const e=nC(s),{width:t,height:i}=e;let n=null;if(!e.isEmpty()){const r=s.getContext("2d");if(r===null)throw new TypeError("Failed to get canvas 2D context");n=r.getImageData(e.left,e.top,t,i)}return{width:t,height:i,data:n}}function oC(s,e=globalThis.location){if(s.startsWith("data:"))return"";e=e||globalThis.location;const t=new URL(s,document.baseURI);return t.hostname!==e.hostname||t.port!==e.port||t.protocol!==e.protocol?"anonymous":""}function Hn(s,e=1){var i;const t=(i=Be.RETINA_PREFIX)==null?void 0:i.exec(s);return t?parseFloat(t[1]):e}var ke=(s=>(s.Renderer="renderer",s.Application="application",s.RendererSystem="renderer-webgl-system",s.RendererPlugin="renderer-webgl-plugin",s.CanvasRendererSystem="renderer-canvas-system",s.CanvasRendererPlugin="renderer-canvas-plugin",s.Asset="asset",s.LoadParser="load-parser",s.ResolveParser="resolve-parser",s.CacheParser="cache-parser",s.DetectionParser="detection-parser",s))(ke||{});const $f=s=>{if(typeof s=="function"||typeof s=="object"&&s.extension){if(!s.extension)throw new Error("Extension class must have an extension object");s={...typeof s.extension!="object"?{type:s.extension}:s.extension,ref:s}}if(typeof s=="object")s={...s};else throw new Error("Invalid extension type");return typeof s.type=="string"&&(s.type=[s.type]),s},J0=(s,e)=>$f(s).priority??e,$e={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...s){return s.map($f).forEach(e=>{e.type.forEach(t=>{var i,n;return(n=(i=this._removeHandlers)[t])==null?void 0:n.call(i,e)})}),this},add(...s){return s.map($f).forEach(e=>{e.type.forEach(t=>{var r,o;const i=this._addHandlers,n=this._queue;i[t]?(r=i[t])==null||r.call(i,e):(n[t]=n[t]||[],(o=n[t])==null||o.push(e))})}),this},handle(s,e,t){var o;const i=this._addHandlers,n=this._removeHandlers;if(i[s]||n[s])throw new Error(`Extension type ${s} already has a handler`);i[s]=e,n[s]=t;const r=this._queue;return r[s]&&((o=r[s])==null||o.forEach(a=>e(a)),delete r[s]),this},handleByMap(s,e){return this.handle(s,t=>{t.name&&(e[t.name]=t.ref)},t=>{t.name&&delete e[t.name]})},handleByList(s,e,t=-1){return this.handle(s,i=>{e.includes(i.ref)||(e.push(i.ref),e.sort((n,r)=>J0(r,t)-J0(n,t)))},i=>{const n=e.indexOf(i.ref);n!==-1&&e.splice(n,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 aC=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(`
|
||
`);function lC(s){let e="";for(let t=0;t<s;++t)t>0&&(e+=`
|
||
else `),t<s-1&&(e+=`if(test == ${t}.0){}`);return e}function cC(s,e){if(s===0)throw new Error("Invalid value of `0` passed to `checkMaxIfStatementsInShader`");const t=e.createShader(e.FRAGMENT_SHADER);for(;;){const i=aC.replace(/%forloop%/gi,lC(s));if(e.shaderSource(t,i),e.compileShader(t),!e.getShaderParameter(t,e.COMPILE_STATUS))s=s/2|0;else break}return s}const Dd=0,Ud=1,$d=2,Xd=3,Vd=4,Yd=5;class mn{constructor(){this.data=0,this.blendMode=We.NORMAL,this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<<Dd)}set blend(e){!!(this.data&1<<Dd)!==e&&(this.data^=1<<Dd)}get offsets(){return!!(this.data&1<<Ud)}set offsets(e){!!(this.data&1<<Ud)!==e&&(this.data^=1<<Ud)}get culling(){return!!(this.data&1<<$d)}set culling(e){!!(this.data&1<<$d)!==e&&(this.data^=1<<$d)}get depthTest(){return!!(this.data&1<<Xd)}set depthTest(e){!!(this.data&1<<Xd)!==e&&(this.data^=1<<Xd)}get depthMask(){return!!(this.data&1<<Yd)}set depthMask(e){!!(this.data&1<<Yd)!==e&&(this.data^=1<<Yd)}get clockwiseFrontFace(){return!!(this.data&1<<Vd)}set clockwiseFrontFace(e){!!(this.data&1<<Vd)!==e&&(this.data^=1<<Vd)}get blendMode(){return this._blendMode}set blendMode(e){this.blend=e!==We.NONE,this._blendMode=e}get polygonOffset(){return this._polygonOffset}set polygonOffset(e){this.offsets=!!e,this._polygonOffset=e}static for2d(){const e=new mn;return e.depthTest=!1,e.blend=!0,e}}mn.prototype.toString=function(){return`[@pixi/core:State blendMode=${this.blendMode} clockwiseFrontFace=${this.clockwiseFrontFace} culling=${this.culling} depthMask=${this.depthMask} polygonOffset=${this.polygonOffset}]`};const Vf=[];function fb(s,e){if(!s)return null;let t="";if(typeof s=="string"){const i=/\.(\w{3,4})(?:$|\?|#)/i.exec(s);i&&(t=i[1].toLowerCase())}for(let i=Vf.length-1;i>=0;--i){const n=Vf[i];if(n.test&&n.test(s,t))return new n(s,e)}throw new Error("Unrecognized source type to auto-detect Resource")}class Ls{constructor(e){this.items=[],this._name=e,this._aliasCount=0}emit(e,t,i,n,r,o,a,c){if(arguments.length>8)throw new Error("max arguments reached");const{name:l,items:h}=this;this._aliasCount++;for(let u=0,d=h.length;u<d;u++)h[u][l](e,t,i,n,r,o,a,c);return h===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(Ls.prototype,{dispatch:{value:Ls.prototype.emit},run:{value:Ls.prototype.emit}});class yl{constructor(e=0,t=0){this._width=e,this._height=t,this.destroyed=!1,this.internal=!1,this.onResize=new Ls("setRealSize"),this.onUpdate=new Ls("update"),this.onError=new Ls("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 au extends yl{constructor(e,t){const{width:i,height:n}=t||{};if(!i||!n)throw new Error("BufferResource width or height invalid");super(i,n),this.data=e,this.unpackAlignment=t.unpackAlignment??4}upload(e,t,i){const n=e.gl;n.pixelStorei(n.UNPACK_ALIGNMENT,this.unpackAlignment),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.alphaMode===bi.UNPACK);const r=t.realWidth,o=t.realHeight;return i.width===r&&i.height===o?n.texSubImage2D(t.target,0,0,0,r,o,t.format,i.type,this.data):(i.width=r,i.height=o,n.texImage2D(t.target,0,i.internalFormat,r,o,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 hC={scaleMode:Rs.NEAREST,alphaMode:bi.NPM},Yf=class No extends Rl{constructor(e=null,t=null){super(),t=Object.assign({},No.defaultOptions,t);const{alphaMode:i,mipmap:n,anisotropicLevel:r,scaleMode:o,width:a,height:c,wrapMode:l,format:h,type:u,target:d,resolution:f,resourceOptions:m}=t;e&&!(e instanceof yl)&&(e=fb(e,m),e.internal=!0),this.resolution=f||Be.RESOLUTION,this.width=Math.round((a||0)*this.resolution)/this.resolution,this.height=Math.round((c||0)*this.resolution)/this.resolution,this._mipmap=n,this.anisotropicLevel=r,this._wrapMode=l,this._scaleMode=o,this.format=h,this.type=u,this.target=d,this.alphaMode=i,this.uid=ho(),this.touched=0,this.isPowerOfTwo=!1,this._refreshPOT(),this._glTextures={},this.dirtyId=0,this.dirtyStyleId=0,this.cacheId=null,this.valid=a>0&&c>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=H0(this.realWidth)&&H0(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 er[this.cacheId],delete Ys[this.cacheId],this.cacheId=null),this.valid=!1,this.dispose(),No.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=Be.STRICT_TEXTURE_CACHE){const n=typeof e=="string";let r=null;if(n)r=e;else{if(!e._pixiId){const a=(t==null?void 0:t.pixiIdPrefix)||"pixiid";e._pixiId=`${a}_${ho()}`}r=e._pixiId}let o=er[r];if(n&&i&&!o)throw new Error(`The cacheId "${r}" does not exist in BaseTextureCache.`);return o||(o=new No(e,t),o.cacheId=r,No.addToCache(o,r)),o}static fromBuffer(e,t,i,n){e=e||new Float32Array(t*i*4);const r=new au(e,{width:t,height:i,...n==null?void 0:n.resourceOptions});let o,a;return e instanceof Float32Array?(o=Te.RGBA,a=Ue.FLOAT):e instanceof Int32Array?(o=Te.RGBA_INTEGER,a=Ue.INT):e instanceof Uint32Array?(o=Te.RGBA_INTEGER,a=Ue.UNSIGNED_INT):e instanceof Int16Array?(o=Te.RGBA_INTEGER,a=Ue.SHORT):e instanceof Uint16Array?(o=Te.RGBA_INTEGER,a=Ue.UNSIGNED_SHORT):e instanceof Int8Array?(o=Te.RGBA,a=Ue.BYTE):(o=Te.RGBA,a=Ue.UNSIGNED_BYTE),r.internal=!0,new No(r,Object.assign({},hC,{type:a,format:o},n))}static addToCache(e,t){t&&(e.textureCacheIds.includes(t)||e.textureCacheIds.push(t),er[t]&&er[t]!==e&&console.warn(`BaseTexture added to the cache with an id [${t}] that already had an entry`),er[t]=e)}static removeFromCache(e){if(typeof e=="string"){const t=er[e];if(t){const i=t.textureCacheIds.indexOf(e);return i>-1&&t.textureCacheIds.splice(i,1),delete er[e],t}}else if(e!=null&&e.textureCacheIds){for(let t=0;t<e.textureCacheIds.length;++t)delete er[e.textureCacheIds[t]];return e.textureCacheIds.length=0,e}return null}};Yf.defaultOptions={mipmap:vs.POW2,anisotropicLevel:0,scaleMode:Rs.LINEAR,wrapMode:Os.CLAMP,alphaMode:bi.UNPACK,target:Zo.TEXTURE_2D,format:Te.RGBA,type:Ue.UNSIGNED_BYTE},Yf._globalBatch=0;let it=Yf;class Gf{constructor(){this.texArray=null,this.blend=0,this.type=on.TRIANGLES,this.start=0,this.size=0,this.data=null}}let uC=0;class $t{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=uC++,this.disposeRunner=new Ls("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?hn.ELEMENT_ARRAY_BUFFER:hn.ARRAY_BUFFER}get index(){return this.type===hn.ELEMENT_ARRAY_BUFFER}static from(e){return e instanceof Array&&(e=new Float32Array(e)),new $t(e)}}class sh{constructor(e,t=0,i=!1,n=Ue.FLOAT,r,o,a,c=1){this.buffer=e,this.size=t,this.normalized=i,this.type=n,this.stride=r,this.start=o,this.instance=a,this.divisor=c}destroy(){this.buffer=null}static from(e,t,i,n,r){return new sh(e,t,i,n,r)}}const dC={Float32Array,Uint32Array,Int32Array,Uint8Array};function fC(s,e){let t=0,i=0;const n={};for(let c=0;c<s.length;c++)i+=e[c],t+=s[c].length;const r=new ArrayBuffer(t*4);let o=null,a=0;for(let c=0;c<s.length;c++){const l=e[c],h=s[c],u=db(h);n[u]||(n[u]=new dC[u](r)),o=n[u];for(let d=0;d<h.length;d++){const f=(d/l|0)*i+a,m=d%l;o[f+m]=h[d]}a+=l}return new Float32Array(r)}const Q0={5126:4,5123:2,5121:1};let mC=0;const pC={Float32Array,Uint32Array,Int32Array,Uint8Array,Uint16Array};class fn{constructor(e=[],t={}){this.buffers=e,this.indexBuffer=null,this.attributes=t,this.glVertexArrayObjects={},this.id=mC++,this.instanced=!1,this.instanceCount=1,this.disposeRunner=new Ls("disposeGeometry"),this.refCount=0}addAttribute(e,t,i=0,n=!1,r,o,a,c=!1){if(!t)throw new Error("You must pass a buffer when creating an attribute");t instanceof $t||(t instanceof Array&&(t=new Float32Array(t)),t=new $t(t));const l=e.split("|");if(l.length>1){for(let u=0;u<l.length;u++)this.addAttribute(l[u],t,i,n,r);return this}let h=this.buffers.indexOf(t);return h===-1&&(this.buffers.push(t),h=this.buffers.length-1),this.attributes[e]=new sh(h,i,n,r,o,a,c),this.instanced=this.instanced||c,this}getAttribute(e){return this.attributes[e]}getBuffer(e){return this.buffers[this.getAttribute(e).buffer]}addIndex(e){return e instanceof $t||(e instanceof Array&&(e=new Uint16Array(e)),e=new $t(e)),e.type=hn.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 $t;let n;for(n in this.attributes){const r=this.attributes[n],o=this.buffers[r.buffer];e.push(o.data),t.push(r.size*Q0[r.type]/4),r.buffer=0}for(i.data=fC(e,t),n=0;n<this.buffers.length;n++)this.buffers[n]!==this.indexBuffer&&this.buffers[n].destroy();return this.buffers=[i],this.indexBuffer&&this.buffers.push(this.indexBuffer),this}getSize(){for(const e in this.attributes){const t=this.attributes[e];return this.buffers[t.buffer].data.length/(t.stride/4||t.size)}return 0}dispose(){this.disposeRunner.emit(this,!1)}destroy(){this.dispose(),this.buffers=null,this.indexBuffer=null,this.attributes=null}clone(){const e=new fn;for(let t=0;t<this.buffers.length;t++)e.buffers[t]=new $t(this.buffers[t].data.slice(0));for(const t in this.attributes){const i=this.attributes[t];e.attributes[t]=new sh(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=hn.ELEMENT_ARRAY_BUFFER),e}static merge(e){const t=new fn,i=[],n=[],r=[];let o;for(let a=0;a<e.length;a++){o=e[a];for(let c=0;c<o.buffers.length;c++)n[c]=n[c]||0,n[c]+=o.buffers[c].data.length,r[c]=0}for(let a=0;a<o.buffers.length;a++)i[a]=new pC[db(o.buffers[a].data)](n[a]),t.buffers[a]=new $t(i[a]);for(let a=0;a<e.length;a++){o=e[a];for(let c=0;c<o.buffers.length;c++)i[c].set(o.buffers[c].data,r[c]),r[c]+=o.buffers[c].data.length}if(t.attributes=o.attributes,o.indexBuffer){t.indexBuffer=t.buffers[o.buffers.indexOf(o.indexBuffer)],t.indexBuffer.type=hn.ELEMENT_ARRAY_BUFFER;let a=0,c=0,l=0,h=0;for(let u=0;u<o.buffers.length;u++)if(o.buffers[u]!==o.indexBuffer){h=u;break}for(const u in o.attributes){const d=o.attributes[u];(d.buffer|0)===h&&(c+=d.size*Q0[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]+=a;a+=e[u].buffers[h].data.length/c,l+=d.length}}return t}}class mb extends fn{constructor(e=!1){super(),this._buffer=new $t(null,e,!1),this._indexBuffer=new $t(null,e,!0),this.addAttribute("aVertexPosition",this._buffer,2,!1,Ue.FLOAT).addAttribute("aTextureCoord",this._buffer,2,!1,Ue.FLOAT).addAttribute("aColor",this._buffer,4,!0,Ue.UNSIGNED_BYTE).addAttribute("aTextureId",this._buffer,1,!0,Ue.FLOAT).addIndex(this._indexBuffer)}}const nh=Math.PI*2,gC=180/Math.PI,vC=Math.PI/180;var Ci=(s=>(s[s.POLY=0]="POLY",s[s.RECT=1]="RECT",s[s.CIRC=2]="CIRC",s[s.ELIP=3]="ELIP",s[s.RREC=4]="RREC",s))(Ci||{});class St{constructor(e=0,t=0){this.x=0,this.y=0,this.x=e,this.y=t}clone(){return new St(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}}St.prototype.toString=function(){return`[@pixi/math:Point x=${this.x} y=${this.y}]`};const Kl=[new St,new St,new St,new St];class ct{constructor(e=0,t=0,i=0,n=0){this.x=Number(e),this.y=Number(t),this.width=Number(i),this.height=Number(n),this.type=Ci.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 ct(0,0,0,0)}clone(){return new ct(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 _=this.x<e.x?e.x:this.x;if((this.right>e.right?e.right:this.right)<=_)return!1;const A=this.y<e.y?e.y:this.y;return(this.bottom>e.bottom?e.bottom:this.bottom)>A}const i=this.left,n=this.right,r=this.top,o=this.bottom;if(n<=i||o<=r)return!1;const a=Kl[0].set(e.left,e.top),c=Kl[1].set(e.left,e.bottom),l=Kl[2].set(e.right,e.top),h=Kl[3].set(e.right,e.bottom);if(l.x<=a.x||c.y<=a.y)return!1;const u=Math.sign(t.a*t.d-t.b*t.c);if(u===0||(t.apply(a,a),t.apply(c,c),t.apply(l,l),t.apply(h,h),Math.max(a.x,c.x,l.x,h.x)<=i||Math.min(a.x,c.x,l.x,h.x)>=n||Math.max(a.y,c.y,l.y,h.y)<=r||Math.min(a.y,c.y,l.y,h.y)>=o))return!1;const d=u*(c.y-a.y),f=u*(a.x-c.x),m=d*i+f*r,p=d*n+f*r,g=d*i+f*o,x=d*n+f*o;if(Math.max(m,p,g,x)<=d*a.x+f*a.y||Math.min(m,p,g,x)>=d*h.x+f*h.y)return!1;const v=u*(a.y-l.y),y=u*(l.x-a.x),S=v*i+y*r,C=v*n+y*r,w=v*i+y*o,b=v*n+y*o;return!(Math.max(S,C,w,b)<=v*a.x+y*a.y||Math.min(S,C,w,b)>=v*h.x+y*h.y)}pad(e=0,t=e){return this.x-=e,this.y-=t,this.width+=e*2,this.height+=t*2,this}fit(e){const t=Math.max(this.x,e.x),i=Math.min(this.x+this.width,e.x+e.width),n=Math.max(this.y,e.y),r=Math.min(this.y+this.height,e.y+e.height);return this.x=t,this.width=Math.max(i-t,0),this.y=n,this.height=Math.max(r-n,0),this}ceil(e=1,t=.001){const i=Math.ceil((this.x+this.width-t)*e)/e,n=Math.ceil((this.y+this.height-t)*e)/e;return this.x=Math.floor((this.x+t)*e)/e,this.y=Math.floor((this.y+t)*e)/e,this.width=i-this.x,this.height=n-this.y,this}enlarge(e){const t=Math.min(this.x,e.x),i=Math.max(this.x+this.width,e.x+e.width),n=Math.min(this.y,e.y),r=Math.max(this.y+this.height,e.y+e.height);return this.x=t,this.width=i-t,this.y=n,this.height=r-n,this}}ct.prototype.toString=function(){return`[@pixi/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};class lu{constructor(e=0,t=0,i=0){this.x=e,this.y=t,this.radius=i,this.type=Ci.CIRC}clone(){return new lu(this.x,this.y,this.radius)}contains(e,t){if(this.radius<=0)return!1;const i=this.radius*this.radius;let n=this.x-e,r=this.y-t;return n*=n,r*=r,n+r<=i}getBounds(){return new ct(this.x-this.radius,this.y-this.radius,this.radius*2,this.radius*2)}}lu.prototype.toString=function(){return`[@pixi/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`};class cu{constructor(e=0,t=0,i=0,n=0){this.x=e,this.y=t,this.width=i,this.height=n,this.type=Ci.ELIP}clone(){return new cu(this.x,this.y,this.width,this.height)}contains(e,t){if(this.width<=0||this.height<=0)return!1;let i=(e-this.x)/this.width,n=(t-this.y)/this.height;return i*=i,n*=n,i+n<=1}getBounds(){return new ct(this.x-this.width,this.y-this.height,this.width,this.height)}}cu.prototype.toString=function(){return`[@pixi/math:Ellipse x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};class ro{constructor(...e){let t=Array.isArray(e[0])?e[0]:e;if(typeof t[0]!="number"){const i=[];for(let n=0,r=t.length;n<r;n++)i.push(t[n].x,t[n].y);t=i}this.points=t,this.type=Ci.POLY,this.closeStroke=!0}clone(){const e=this.points.slice(),t=new ro(e);return t.closeStroke=this.closeStroke,t}contains(e,t){let i=!1;const n=this.points.length/2;for(let r=0,o=n-1;r<n;o=r++){const a=this.points[r*2],c=this.points[r*2+1],l=this.points[o*2],h=this.points[o*2+1];c>t!=h>t&&e<(l-a)*((t-c)/(h-c))+a&&(i=!i)}return i}}ro.prototype.toString=function(){return`[@pixi/math:PolygoncloseStroke=${this.closeStroke}points=${this.points.reduce((s,e)=>`${s}, ${e}`,"")}]`};class hu{constructor(e=0,t=0,i=0,n=0,r=20){this.x=e,this.y=t,this.width=i,this.height=n,this.radius=r,this.type=Ci.RREC}clone(){return new hu(this.x,this.y,this.width,this.height,this.radius)}contains(e,t){if(this.width<=0||this.height<=0)return!1;if(e>=this.x&&e<=this.x+this.width&&t>=this.y&&t<=this.y+this.height){const i=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(t>=this.y+i&&t<=this.y+this.height-i||e>=this.x+i&&e<=this.x+this.width-i)return!0;let n=e-(this.x+i),r=t-(this.y+i);const o=i*i;if(n*n+r*r<=o||(n=e-(this.x+this.width-i),n*n+r*r<=o)||(r=t-(this.y+this.height-i),n*n+r*r<=o)||(n=e-(this.x+i),n*n+r*r<=o))return!0}return!1}}hu.prototype.toString=function(){return`[@pixi/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`};class Ft{constructor(e=1,t=0,i=0,n=1,r=0,o=0){this.array=null,this.a=e,this.b=t,this.c=i,this.d=n,this.tx=r,this.ty=o}fromArray(e){this.a=e[0],this.b=e[1],this.c=e[3],this.d=e[4],this.tx=e[2],this.ty=e[5]}set(e,t,i,n,r,o){return this.a=e,this.b=t,this.c=i,this.d=n,this.tx=r,this.ty=o,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 St;const i=e.x,n=e.y;return t.x=this.a*i+this.c*n+this.tx,t.y=this.b*i+this.d*n+this.ty,t}applyInverse(e,t){t=t||new St;const i=1/(this.a*this.d+this.c*-this.b),n=e.x,r=e.y;return t.x=this.d*i*n+-this.c*i*r+(this.ty*this.c-this.tx*this.d)*i,t.y=this.a*i*r+-this.b*i*n+(-this.ty*this.a+this.tx*this.b)*i,t}translate(e,t){return this.tx+=e,this.ty+=t,this}scale(e,t){return this.a*=e,this.d*=t,this.c*=e,this.b*=t,this.tx*=e,this.ty*=t,this}rotate(e){const t=Math.cos(e),i=Math.sin(e),n=this.a,r=this.c,o=this.tx;return this.a=n*t-this.b*i,this.b=n*i+this.b*t,this.c=r*t-this.d*i,this.d=r*i+this.d*t,this.tx=o*t-this.ty*i,this.ty=o*i+this.ty*t,this}append(e){const t=this.a,i=this.b,n=this.c,r=this.d;return this.a=e.a*t+e.b*n,this.b=e.a*i+e.b*r,this.c=e.c*t+e.d*n,this.d=e.c*i+e.d*r,this.tx=e.tx*t+e.ty*n+this.tx,this.ty=e.tx*i+e.ty*r+this.ty,this}setTransform(e,t,i,n,r,o,a,c,l){return this.a=Math.cos(a+l)*r,this.b=Math.sin(a+l)*r,this.c=-Math.sin(a-c)*o,this.d=Math.cos(a-c)*o,this.tx=e-(i*this.a+n*this.c),this.ty=t-(i*this.b+n*this.d),this}prepend(e){const t=this.tx;if(e.a!==1||e.b!==0||e.c!==0||e.d!==1){const i=this.a,n=this.c;this.a=i*e.a+this.b*e.c,this.b=i*e.b+this.b*e.d,this.c=n*e.a+this.d*e.c,this.d=n*e.b+this.d*e.d}return this.tx=t*e.a+this.ty*e.c+e.tx,this.ty=t*e.b+this.ty*e.d+e.ty,this}decompose(e){const t=this.a,i=this.b,n=this.c,r=this.d,o=e.pivot,a=-Math.atan2(-n,r),c=Math.atan2(i,t),l=Math.abs(a+c);return l<1e-5||Math.abs(nh-l)<1e-5?(e.rotation=c,e.skew.x=e.skew.y=0):(e.rotation=0,e.skew.x=a,e.skew.y=c),e.scale.x=Math.sqrt(t*t+i*i),e.scale.y=Math.sqrt(n*n+r*r),e.position.x=this.tx+(o.x*t+o.y*n),e.position.y=this.ty+(o.x*i+o.y*r),e}invert(){const e=this.a,t=this.b,i=this.c,n=this.d,r=this.tx,o=e*n-t*i;return this.a=n/o,this.b=-t/o,this.c=-i/o,this.d=e/o,this.tx=(i*this.ty-n*r)/o,this.ty=-(e*this.ty-t*r)/o,this}identity(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this}clone(){const e=new Ft;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 Ft}static get TEMP_MATRIX(){return new Ft}}Ft.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 Vr=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],Yr=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],Gr=[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],jf=[],pb=[],Zl=Math.sign;function yC(){for(let s=0;s<16;s++){const e=[];jf.push(e);for(let t=0;t<16;t++){const i=Zl(Vr[s]*Vr[t]+Gr[s]*Yr[t]),n=Zl(Yr[s]*Vr[t]+jr[s]*Yr[t]),r=Zl(Vr[s]*Gr[t]+Gr[s]*jr[t]),o=Zl(Yr[s]*Gr[t]+jr[s]*jr[t]);for(let a=0;a<16;a++)if(Vr[a]===i&&Yr[a]===n&&Gr[a]===r&&jr[a]===o){e.push(a);break}}}for(let s=0;s<16;s++){const e=new Ft;e.set(Vr[s],Yr[s],Gr[s],jr[s],0,0),pb.push(e)}}yC();const Wt={E:0,SE:1,S:2,SW:3,W:4,NW:5,N:6,NE:7,MIRROR_VERTICAL:8,MAIN_DIAGONAL:10,MIRROR_HORIZONTAL:12,REVERSE_DIAGONAL:14,uX:s=>Vr[s],uY:s=>Yr[s],vX:s=>Gr[s],vY:s=>jr[s],inv:s=>s&8?s&15:-s&7,add:(s,e)=>jf[s][e],sub:(s,e)=>jf[s][Wt.inv(e)],rotate180:s=>s^4,isVertical:s=>(s&3)===2,byDirection:(s,e)=>Math.abs(s)*2<=Math.abs(e)?e>=0?Wt.S:Wt.N:Math.abs(e)*2<=Math.abs(s)?s>0?Wt.E:Wt.W:e>0?s>0?Wt.SE:Wt.SW:s>0?Wt.NE:Wt.NW,matrixAppendRotationInv:(s,e,t=0,i=0)=>{const n=pb[Wt.inv(e)];n.tx=t,n.ty=i,s.append(n)}};class Fn{constructor(e,t,i=0,n=0){this._x=i,this._y=n,this.cb=e,this.scope=t}clone(e=this.cb,t=this.scope){return new Fn(e,t,this._x,this._y)}set(e=0,t=e){return(this._x!==e||this._y!==t)&&(this._x=e,this._y=t,this.cb.call(this.scope)),this}copyFrom(e){return(this._x!==e.x||this._y!==e.y)&&(this._x=e.x,this._y=e.y,this.cb.call(this.scope)),this}copyTo(e){return e.set(this._x,this._y),e}equals(e){return e.x===this._x&&e.y===this._y}get x(){return this._x}set x(e){this._x!==e&&(this._x=e,this.cb.call(this.scope))}get y(){return this._y}set y(e){this._y!==e&&(this._y=e,this.cb.call(this.scope))}}Fn.prototype.toString=function(){return`[@pixi/math:ObservablePoint x=${this.x} y=${this.y} scope=${this.scope}]`};const Hf=class{constructor(){this.worldTransform=new Ft,this.localTransform=new Ft,this.position=new Fn(this.onChange,this,0,0),this.scale=new Fn(this.onChange,this,1,1),this.pivot=new Fn(this.onChange,this,0,0),this.skew=new Fn(this.updateSkew,this,0,0),this._rotation=0,this._cx=1,this._sx=0,this._cy=0,this._sy=1,this._localID=0,this._currentLocalID=0,this._worldID=0,this._parentID=0}onChange(){this._localID++}updateSkew(){this._cx=Math.cos(this._rotation+this.skew.y),this._sx=Math.sin(this._rotation+this.skew.y),this._cy=-Math.sin(this._rotation-this.skew.x),this._sy=Math.cos(this._rotation-this.skew.x),this._localID++}updateLocalTransform(){const s=this.localTransform;this._localID!==this._currentLocalID&&(s.a=this._cx*this.scale.x,s.b=this._sx*this.scale.x,s.c=this._cy*this.scale.y,s.d=this._sy*this.scale.y,s.tx=this.position.x-(this.pivot.x*s.a+this.pivot.y*s.c),s.ty=this.position.y-(this.pivot.x*s.b+this.pivot.y*s.d),this._currentLocalID=this._localID,this._parentID=-1)}updateTransform(s){const e=this.localTransform;if(this._localID!==this._currentLocalID&&(e.a=this._cx*this.scale.x,e.b=this._sx*this.scale.x,e.c=this._cy*this.scale.y,e.d=this._sy*this.scale.y,e.tx=this.position.x-(this.pivot.x*e.a+this.pivot.y*e.c),e.ty=this.position.y-(this.pivot.x*e.b+this.pivot.y*e.d),this._currentLocalID=this._localID,this._parentID=-1),this._parentID!==s._worldID){const t=s.worldTransform,i=this.worldTransform;i.a=e.a*t.a+e.b*t.c,i.b=e.a*t.b+e.b*t.d,i.c=e.c*t.a+e.d*t.c,i.d=e.c*t.b+e.d*t.d,i.tx=e.tx*t.a+e.ty*t.c+t.tx,i.ty=e.tx*t.b+e.ty*t.d+t.ty,this._parentID=s._worldID,this._worldID++}}setFromMatrix(s){s.decompose(this),this._localID++}get rotation(){return this._rotation}set rotation(s){this._rotation!==s&&(this._rotation=s,this.updateSkew())}};Hf.IDENTITY=new Hf;let pp=Hf;pp.prototype.toString=function(){return`[@pixi/math:Transform position=(${this.position.x}, ${this.position.y}) rotation=${this.rotation} scale=(${this.scale.x}, ${this.scale.y}) skew=(${this.skew.x}, ${this.skew.y}) ]`};var xC=`varying vec2 vTextureCoord;
|
||
|
||
uniform sampler2D uSampler;
|
||
|
||
void main(void){
|
||
gl_FragColor *= texture2D(uSampler, vTextureCoord);
|
||
}`,bC=`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 ev(s,e,t){const i=s.createShader(e);return s.shaderSource(i,t),s.compileShader(i),i}function Gd(s){const e=new Array(s);for(let t=0;t<e.length;t++)e[t]=!1;return e}function gb(s,e){switch(s){case"float":return 0;case"vec2":return new Float32Array(2*e);case"vec3":return new Float32Array(3*e);case"vec4":return new Float32Array(4*e);case"int":case"uint":case"sampler2D":case"sampler2DArray":return 0;case"ivec2":return new Int32Array(2*e);case"ivec3":return new Int32Array(3*e);case"ivec4":return new Int32Array(4*e);case"uvec2":return new Uint32Array(2*e);case"uvec3":return new Uint32Array(3*e);case"uvec4":return new Uint32Array(4*e);case"bool":return!1;case"bvec2":return Gd(2*e);case"bvec3":return Gd(3*e);case"bvec4":return Gd(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 Qo=[{test:s=>s.type==="float"&&s.size===1&&!s.isArray,code:s=>`
|
||
if(uv["${s}"] !== ud["${s}"].value)
|
||
{
|
||
ud["${s}"].value = uv["${s}"]
|
||
gl.uniform1f(ud["${s}"].location, uv["${s}"])
|
||
}
|
||
`},{test:(s,e)=>(s.type==="sampler2D"||s.type==="samplerCube"||s.type==="sampler2DArray")&&s.size===1&&!s.isArray&&(e==null||e.castToBaseTexture!==void 0),code:s=>`t = syncData.textureCount++;
|
||
|
||
renderer.texture.bind(uv["${s}"], t);
|
||
|
||
if(ud["${s}"].value !== t)
|
||
{
|
||
ud["${s}"].value = t;
|
||
gl.uniform1i(ud["${s}"].location, t);
|
||
; // eslint-disable-line max-len
|
||
}`},{test:(s,e)=>s.type==="mat3"&&s.size===1&&!s.isArray&&e.a!==void 0,code:s=>`
|
||
gl.uniformMatrix3fv(ud["${s}"].location, false, uv["${s}"].toArray(true));
|
||
`,codeUbo:s=>`
|
||
var ${s}_matrix = uv.${s}.toArray(true);
|
||
|
||
data[offset] = ${s}_matrix[0];
|
||
data[offset+1] = ${s}_matrix[1];
|
||
data[offset+2] = ${s}_matrix[2];
|
||
|
||
data[offset + 4] = ${s}_matrix[3];
|
||
data[offset + 5] = ${s}_matrix[4];
|
||
data[offset + 6] = ${s}_matrix[5];
|
||
|
||
data[offset + 8] = ${s}_matrix[6];
|
||
data[offset + 9] = ${s}_matrix[7];
|
||
data[offset + 10] = ${s}_matrix[8];
|
||
`},{test:(s,e)=>s.type==="vec2"&&s.size===1&&!s.isArray&&e.x!==void 0,code:s=>`
|
||
cv = ud["${s}"].value;
|
||
v = uv["${s}"];
|
||
|
||
if(cv[0] !== v.x || cv[1] !== v.y)
|
||
{
|
||
cv[0] = v.x;
|
||
cv[1] = v.y;
|
||
gl.uniform2f(ud["${s}"].location, v.x, v.y);
|
||
}`,codeUbo:s=>`
|
||
v = uv.${s};
|
||
|
||
data[offset] = v.x;
|
||
data[offset+1] = v.y;
|
||
`},{test:s=>s.type==="vec2"&&s.size===1&&!s.isArray,code:s=>`
|
||
cv = ud["${s}"].value;
|
||
v = uv["${s}"];
|
||
|
||
if(cv[0] !== v[0] || cv[1] !== v[1])
|
||
{
|
||
cv[0] = v[0];
|
||
cv[1] = v[1];
|
||
gl.uniform2f(ud["${s}"].location, v[0], v[1]);
|
||
}
|
||
`},{test:(s,e)=>s.type==="vec4"&&s.size===1&&!s.isArray&&e.width!==void 0,code:s=>`
|
||
cv = ud["${s}"].value;
|
||
v = uv["${s}"];
|
||
|
||
if(cv[0] !== v.x || cv[1] !== v.y || cv[2] !== v.width || cv[3] !== v.height)
|
||
{
|
||
cv[0] = v.x;
|
||
cv[1] = v.y;
|
||
cv[2] = v.width;
|
||
cv[3] = v.height;
|
||
gl.uniform4f(ud["${s}"].location, v.x, v.y, v.width, v.height)
|
||
}`,codeUbo:s=>`
|
||
v = uv.${s};
|
||
|
||
data[offset] = v.x;
|
||
data[offset+1] = v.y;
|
||
data[offset+2] = v.width;
|
||
data[offset+3] = v.height;
|
||
`},{test:(s,e)=>s.type==="vec4"&&s.size===1&&!s.isArray&&e.red!==void 0,code:s=>`
|
||
cv = ud["${s}"].value;
|
||
v = uv["${s}"];
|
||
|
||
if(cv[0] !== v.red || cv[1] !== v.green || cv[2] !== v.blue || cv[3] !== v.alpha)
|
||
{
|
||
cv[0] = v.red;
|
||
cv[1] = v.green;
|
||
cv[2] = v.blue;
|
||
cv[3] = v.alpha;
|
||
gl.uniform4f(ud["${s}"].location, v.red, v.green, v.blue, v.alpha)
|
||
}`,codeUbo:s=>`
|
||
v = uv.${s};
|
||
|
||
data[offset] = v.red;
|
||
data[offset+1] = v.green;
|
||
data[offset+2] = v.blue;
|
||
data[offset+3] = v.alpha;
|
||
`},{test:(s,e)=>s.type==="vec3"&&s.size===1&&!s.isArray&&e.red!==void 0,code:s=>`
|
||
cv = ud["${s}"].value;
|
||
v = uv["${s}"];
|
||
|
||
if(cv[0] !== v.red || cv[1] !== v.green || cv[2] !== v.blue || cv[3] !== v.a)
|
||
{
|
||
cv[0] = v.red;
|
||
cv[1] = v.green;
|
||
cv[2] = v.blue;
|
||
|
||
gl.uniform3f(ud["${s}"].location, v.red, v.green, v.blue)
|
||
}`,codeUbo:s=>`
|
||
v = uv.${s};
|
||
|
||
data[offset] = v.red;
|
||
data[offset+1] = v.green;
|
||
data[offset+2] = v.blue;
|
||
`},{test:s=>s.type==="vec4"&&s.size===1&&!s.isArray,code:s=>`
|
||
cv = ud["${s}"].value;
|
||
v = uv["${s}"];
|
||
|
||
if(cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])
|
||
{
|
||
cv[0] = v[0];
|
||
cv[1] = v[1];
|
||
cv[2] = v[2];
|
||
cv[3] = v[3];
|
||
|
||
gl.uniform4f(ud["${s}"].location, v[0], v[1], v[2], v[3])
|
||
}`}],wC={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);
|
||
}`},SC={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 MC(s,e){var i;const t=[`
|
||
var v = null;
|
||
var cv = null;
|
||
var cu = null;
|
||
var t = 0;
|
||
var gl = renderer.gl;
|
||
`];for(const n in s.uniforms){const r=e[n];if(!r){((i=s.uniforms[n])==null?void 0:i.group)===!0&&(s.uniforms[n].ubo?t.push(`
|
||
renderer.shader.syncUniformBufferGroup(uv.${n}, '${n}');
|
||
`):t.push(`
|
||
renderer.shader.syncUniformGroup(uv.${n}, syncData);
|
||
`));continue}const o=s.uniforms[n];let a=!1;for(let c=0;c<Qo.length;c++)if(Qo[c].test(r,o)){t.push(Qo[c].code(n,o)),a=!0;break}if(!a){const c=(r.size===1&&!r.isArray?wC:SC)[r.type].replace("location",`ud["${n}"].location`);t.push(`
|
||
cu = ud["${n}"];
|
||
cv = cu.value;
|
||
v = uv["${n}"];
|
||
${c};`)}}return new Function("ud","uv","renderer","syncData",t.join(`
|
||
`))}const vb={};let Eo=vb;function TC(){if(Eo===vb||Eo!=null&&Eo.isContextLost()){const s=Be.ADAPTER.createCanvas();let e;Be.PREFER_ENV>=go.WEBGL2&&(e=s.getContext("webgl2",{})),e||(e=s.getContext("webgl",{})||s.getContext("experimental-webgl",{}),e?e.getExtension("WEBGL_draw_buffers"):e=null),Eo=e}return Eo}let Jl;function _C(){if(!Jl){Jl=ms.MEDIUM;const s=TC();if(s&&s.getShaderPrecisionFormat){const e=s.getShaderPrecisionFormat(s.FRAGMENT_SHADER,s.HIGH_FLOAT);e&&(Jl=e.precision?ms.HIGH:ms.MEDIUM)}}return Jl}function tv(s,e){const t=s.getShaderSource(e).split(`
|
||
`).map((l,h)=>`${h}: ${l}`),i=s.getShaderInfoLog(e),n=i.split(`
|
||
`),r={},o=n.map(l=>parseFloat(l.replace(/^ERROR\: 0\:([\d]+)\:.*$/,"$1"))).filter(l=>l&&!r[l]?(r[l]=!0,!0):!1),a=[""];o.forEach(l=>{t[l-1]=`%c${t[l-1]}%c`,a.push("background: #FF0000; color:#FFFFFF; font-size: 10px","font-size: 10px")});const c=t.join(`
|
||
`);a[0]=c,console.error(i),console.groupCollapsed("click to view full shader code"),console.warn(...a),console.groupEnd()}function CC(s,e,t,i){s.getProgramParameter(e,s.LINK_STATUS)||(s.getShaderParameter(t,s.COMPILE_STATUS)||tv(s,t),s.getShaderParameter(i,s.COMPILE_STATUS)||tv(s,i),console.error("PixiJS Error: Could not initialize shader."),s.getProgramInfoLog(e)!==""&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",s.getProgramInfoLog(e)))}const EC={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 yb(s){return EC[s]}let Ql=null;const iv={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 xb(s,e){if(!Ql){const t=Object.keys(iv);Ql={};for(let i=0;i<t.length;++i){const n=t[i];Ql[s[n]]=iv[n]}}return Ql[e]}function sv(s,e,t){if(s.substring(0,9)!=="precision"){let i=e;return e===ms.HIGH&&t!==ms.HIGH&&(i=ms.MEDIUM),`precision ${i} float;
|
||
${s}`}else if(t!==ms.HIGH&&s.substring(0,15)==="precision highp")return s.replace("precision highp","precision mediump");return s}let ka;function AC(){if(typeof ka=="boolean")return ka;try{ka=new Function("param1","param2","param3","return param1[param2] === param3;")({a:"b"},"a","b")===!0}catch{ka=!1}return ka}let IC=0;const ec={},Wf=class Do{constructor(e,t,i="pixi-shader",n={}){this.extra={},this.id=IC++,this.vertexSrc=e||Do.defaultVertexSrc,this.fragmentSrc=t||Do.defaultFragmentSrc,this.vertexSrc=this.vertexSrc.trim(),this.fragmentSrc=this.fragmentSrc.trim(),this.extra=n,this.vertexSrc.substring(0,8)!=="#version"&&(i=i.replace(/\s+/g,"-"),ec[i]?(ec[i]++,i+=`-${ec[i]}`):ec[i]=1,this.vertexSrc=`#define SHADER_NAME ${i}
|
||
${this.vertexSrc}`,this.fragmentSrc=`#define SHADER_NAME ${i}
|
||
${this.fragmentSrc}`,this.vertexSrc=sv(this.vertexSrc,Do.defaultVertexPrecision,ms.HIGH),this.fragmentSrc=sv(this.fragmentSrc,Do.defaultFragmentPrecision,_C())),this.glPrograms={},this.syncUniforms=null}static get defaultVertexSrc(){return bC}static get defaultFragmentSrc(){return xC}static from(e,t,i){const n=e+t;let r=q0[n];return r||(q0[n]=r=new Do(e,t,i)),r}};Wf.defaultVertexPrecision=ms.HIGH,Wf.defaultFragmentPrecision=kn.apple.device?ms.HIGH:ms.MEDIUM;let an=Wf,RC=0;class Bs{constructor(e,t,i){this.group=!0,this.syncUniforms={},this.dirtyId=0,this.id=RC++,this.static=!!t,this.ubo=!!i,e instanceof $t?(this.buffer=e,this.buffer.type=hn.UNIFORM_BUFFER,this.autoManage=!1,this.ubo=!0):(this.uniforms=e,this.ubo&&(this.buffer=new $t(new Float32Array(1)),this.buffer.type=hn.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 Bs(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 Bs(e,t,i)}static uboFrom(e,t){return new Bs(e,t??!0,!0)}}class Ns{constructor(e,t){this.uniformBindCount=0,this.program=e,t?t instanceof Bs?this.uniformGroup=t:this.uniformGroup=new Bs(t):this.uniformGroup=new Bs({}),this.disposeRunner=new Ls("disposeShader")}checkUniformExists(e,t){if(t.uniforms[e])return!0;for(const i in t.uniforms){const n=t.uniforms[i];if(n.group===!0&&this.checkUniformExists(e,n))return!0}return!1}destroy(){this.uniformGroup=null,this.disposeRunner.emit(this),this.disposeRunner.destroy()}get uniforms(){return this.uniformGroup.uniforms}static from(e,t,i){const n=an.from(e,t);return new Ns(n,i)}}class bb{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]=Bs.from({uSamplers:i},!0);let n=this.fragTemplate;n=n.replace(/%count%/gi,`${e}`),n=n.replace(/%forloop%/gi,this.generateSampleSrc(e)),this.programCache[e]=new an(this.vertexSrc,n)}const t={tint:new Float32Array([1,1,1,1]),translationMatrix:new Ft,default:this.defaultGroupCache[e]};return new Ns(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 zf{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 PC(){return!kn.apple.device}function kC(s){let e=!0;const t=Be.ADAPTER.getNavigator();if(kn.tablet||kn.phone){if(kn.apple.device){const i=t.userAgent.match(/OS (\d+)_(\d+)?/);i&&parseInt(i[1],10)<11&&(e=!1)}if(kn.android.device){const i=t.userAgent.match(/Android\s([0-9.]*)/);i&&parseInt(i[1],10)<7&&(e=!1)}}return e?s:4}class uu{constructor(e){this.renderer=e}flush(){}destroy(){this.renderer=null}start(){}stop(){this.flush()}render(e){}}var FC=`varying vec2 vTextureCoord;
|
||
varying vec4 vColor;
|
||
varying float vTextureId;
|
||
uniform sampler2D uSamplers[%count%];
|
||
|
||
void main(void){
|
||
vec4 color;
|
||
%forloop%
|
||
gl_FragColor = color * vColor;
|
||
}
|
||
`,OC=`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 Xa=class _s extends uu{constructor(e){super(e),this.setShaderGenerator(),this.geometryClass=mb,this.vertexSize=6,this.state=mn.for2d(),this.size=_s.defaultBatchSize*4,this._vertexCount=0,this._indexCount=0,this._bufferedElements=[],this._bufferedTextures=[],this._bufferSize=0,this._shader=null,this._packedGeometries=[],this._packedGeometryPoolSize=2,this._flushId=0,this._aBuffers={},this._iBuffers={},this.maxTextures=1,this.renderer.on("prerender",this.onPrerender,this),e.runners.contextChange.add(this),this._dcIndex=0,this._aIndex=0,this._iIndex=0,this._attributeBuffer=null,this._indexBuffer=null,this._tempBoundTextures=[]}static get defaultMaxTextures(){return this._defaultMaxTextures=this._defaultMaxTextures??kC(32),this._defaultMaxTextures}static set defaultMaxTextures(e){this._defaultMaxTextures=e}static get canUploadSameBuffer(){return this._canUploadSameBuffer=this._canUploadSameBuffer??PC(),this._canUploadSameBuffer}static set canUploadSameBuffer(e){this._canUploadSameBuffer=e}get MAX_TEXTURES(){return mt("7.1.0","BatchRenderer#MAX_TEXTURES renamed to BatchRenderer#maxTextures"),this.maxTextures}static get defaultVertexSrc(){return OC}static get defaultFragmentTemplate(){return FC}setShaderGenerator({vertex:e=_s.defaultVertexSrc,fragment:t=_s.defaultFragmentTemplate}={}){this.shaderGenerator=new bb(e,t)}contextChange(){const e=this.renderer.gl;Be.PREFER_ENV===go.WEBGL_LEGACY?this.maxTextures=1:(this.maxTextures=Math.min(e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),_s.defaultMaxTextures),this.maxTextures=cC(this.maxTextures,e)),this._shader=this.shaderGenerator.generateShader(this.maxTextures);for(let t=0;t<this._packedGeometryPoolSize;t++)this._packedGeometries[t]=new this.geometryClass;this.initFlushBuffers()}initFlushBuffers(){const{_drawCallPool:e,_textureArrayPool:t}=_s,i=this.size/4,n=Math.floor(i/this.maxTextures)+1;for(;e.length<i;)e.push(new Gf);for(;t.length<n;)t.push(new zf);for(let r=0;r<this.maxTextures;r++)this._tempBoundTextures[r]=null}onPrerender(){this._flushId=0}render(e){e._texture.valid&&(this._vertexCount+e.vertexData.length/2>this.size&&this.flush(),this._vertexCount+=e.vertexData.length/2,this._indexCount+=e.indices.length,this._bufferedTextures[this._bufferSize]=e._texture.baseTexture,this._bufferedElements[this._bufferSize++]=e)}buildTexturesAndDrawCalls(){const{_bufferedTextures:e,maxTextures:t}=this,i=_s._textureArrayPool,n=this.renderer.batch,r=this._tempBoundTextures,o=this.renderer.textureGC.count;let a=++it._globalBatch,c=0,l=i[0],h=0;n.copyBoundTextures(r,t);for(let u=0;u<this._bufferSize;++u){const d=e[u];e[u]=null,d._batchEnabled!==a&&(l.count>=t&&(n.boundArray(l,r,a,t),this.buildDrawCalls(l,h,u),h=u,l=i[++c],++a),d._batchEnabled=a,d.touched=o,l.elements[l.count++]=d)}l.count>0&&(n.boundArray(l,r,a,t),this.buildDrawCalls(l,h,this._bufferSize),++c,++a);for(let u=0;u<r.length;u++)r[u]=null;it._globalBatch=a}buildDrawCalls(e,t,i){const{_bufferedElements:n,_attributeBuffer:r,_indexBuffer:o,vertexSize:a}=this,c=_s._drawCallPool;let l=this._dcIndex,h=this._aIndex,u=this._iIndex,d=c[l];d.start=this._iIndex,d.texArray=e;for(let f=t;f<i;++f){const m=n[f],p=m._texture.baseTexture,g=hb[p.alphaMode?1:0][m.blendMode];n[f]=null,t<f&&d.blend!==g&&(d.size=u-d.start,t=f,d=c[++l],d.texArray=e,d.start=u),this.packInterleavedGeometry(m,r,o,h,u),h+=m.vertexData.length/2*a,u+=m.indices.length,d.blend=g}t<i&&(d.size=u-d.start,++l),this._dcIndex=l,this._aIndex=h,this._iIndex=u}bindAndClearTexArray(e){const t=this.renderer.texture;for(let i=0;i<e.count;i++)t.bind(e.elements[i],e.ids[i]),e.elements[i]=null;e.count=0}updateGeometry(){const{_packedGeometries:e,_attributeBuffer:t,_indexBuffer:i}=this;_s.canUploadSameBuffer?(e[this._flushId]._buffer.update(t.rawBinaryData),e[this._flushId]._indexBuffer.update(i),this.renderer.geometry.updateBuffers()):(this._packedGeometryPoolSize<=this._flushId&&(this._packedGeometryPoolSize++,e[this._flushId]=new this.geometryClass),e[this._flushId]._buffer.update(t.rawBinaryData),e[this._flushId]._indexBuffer.update(i),this.renderer.geometry.bind(e[this._flushId]),this.renderer.geometry.updateBuffers(),this._flushId++)}drawBatches(){const e=this._dcIndex,{gl:t,state:i}=this.renderer,n=_s._drawCallPool;let r=null;for(let o=0;o<e;o++){const{texArray:a,type:c,size:l,start:h,blend:u}=n[o];r!==a&&(r=a,this.bindAndClearTexArray(a)),this.state.blendMode=u,i.set(this.state),t.drawElements(c,l,t.UNSIGNED_SHORT,h*2)}}flush(){this._vertexCount!==0&&(this._attributeBuffer=this.getAttributeBuffer(this._vertexCount),this._indexBuffer=this.getIndexBuffer(this._indexCount),this._aIndex=0,this._iIndex=0,this._dcIndex=0,this.buildTexturesAndDrawCalls(),this.updateGeometry(),this.drawBatches(),this._bufferSize=0,this._vertexCount=0,this._indexCount=0)}start(){this.renderer.state.set(this.state),this.renderer.texture.ensureSamplerType(this.maxTextures),this.renderer.shader.bind(this._shader),_s.canUploadSameBuffer&&this.renderer.geometry.bind(this._packedGeometries[this._flushId])}stop(){this.flush()}destroy(){for(let e=0;e<this._packedGeometryPoolSize;e++)this._packedGeometries[e]&&this._packedGeometries[e].destroy();this.renderer.off("prerender",this.onPrerender,this),this._aBuffers=null,this._iBuffers=null,this._packedGeometries=null,this._attributeBuffer=null,this._indexBuffer=null,this._shader&&(this._shader.destroy(),this._shader=null),super.destroy()}getAttributeBuffer(e){const t=ih(Math.ceil(e/8)),i=W0(t),n=t*8;this._aBuffers.length<=i&&(this._iBuffers.length=i+1);let r=this._aBuffers[n];return r||(this._aBuffers[n]=r=new Xf(n*this.vertexSize*4)),r}getIndexBuffer(e){const t=ih(Math.ceil(e/12)),i=W0(t),n=t*12;this._iBuffers.length<=i&&(this._iBuffers.length=i+1);let r=this._iBuffers[i];return r||(this._iBuffers[i]=r=new Uint16Array(n)),r}packInterleavedGeometry(e,t,i,n,r){const{uint32View:o,float32View:a}=t,c=n/this.vertexSize,l=e.uvs,h=e.indices,u=e.vertexData,d=e._texture.baseTexture._batchLocation,f=Math.min(e.worldAlpha,1),m=At.shared.setValue(e._tintRGB).toPremultiplied(f,e._texture.baseTexture.alphaMode>0);for(let p=0;p<u.length;p+=2)a[n++]=u[p],a[n++]=u[p+1],a[n++]=l[p],a[n++]=l[p+1],o[n++]=m,a[n++]=d;for(let p=0;p<h.length;p++)i[r++]=c+h[p]}};Xa.defaultBatchSize=4096,Xa.extension={name:"batch",type:ke.RendererPlugin},Xa._drawCallPool=[],Xa._textureArrayPool=[];let cr=Xa;$e.add(cr);var LC=`varying vec2 vTextureCoord;
|
||
|
||
uniform sampler2D uSampler;
|
||
|
||
void main(void){
|
||
gl_FragColor = texture2D(uSampler, vTextureCoord);
|
||
}
|
||
`,BC=`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 qf=class Va extends Ns{constructor(e,t,i){const n=an.from(e||Va.defaultVertexSrc,t||Va.defaultFragmentSrc);super(n,i),this.padding=0,this.resolution=Va.defaultResolution,this.multisample=Va.defaultMultisample,this.enabled=!0,this.autoFit=!0,this.state=new mn}apply(e,t,i,n,r){e.applyFilter(this,t,i,n)}get blendMode(){return this.state.blendMode}set blendMode(e){this.state.blendMode=e}get resolution(){return this._resolution}set resolution(e){this._resolution=e}static get defaultVertexSrc(){return BC}static get defaultFragmentSrc(){return LC}};qf.defaultResolution=1,qf.defaultMultisample=ci.NONE;let Vi=qf;class rh{constructor(){this.clearBeforeRender=!0,this._backgroundColor=new At(0),this.alpha=1}init(e){this.clearBeforeRender=e.clearBeforeRender;const{backgroundColor:t,background:i,backgroundAlpha:n}=e,r=i??t;r!==void 0&&(this.color=r),this.alpha=n}get color(){return this._backgroundColor.value}set color(e){this._backgroundColor.setValue(e)}get alpha(){return this._backgroundColor.alpha}set alpha(e){this._backgroundColor.setAlpha(e)}get backgroundColor(){return this._backgroundColor}destroy(){}}rh.defaultOptions={backgroundAlpha:1,backgroundColor:0,clearBeforeRender:!0},rh.extension={type:[ke.RendererSystem,ke.CanvasRendererSystem],name:"background"};$e.add(rh);class wb{constructor(e){this.renderer=e,this.emptyRenderer=new uu(e),this.currentRenderer=this.emptyRenderer}setObjectRenderer(e){this.currentRenderer!==e&&(this.currentRenderer.stop(),this.currentRenderer=e,this.currentRenderer.start())}flush(){this.setObjectRenderer(this.emptyRenderer)}reset(){this.setObjectRenderer(this.emptyRenderer)}copyBoundTextures(e,t){const{boundTextures:i}=this.renderer.texture;for(let n=t-1;n>=0;--n)e[n]=i[n]||null,e[n]&&(e[n]._batchLocation=n)}boundArray(e,t,i,n){const{elements:r,ids:o,count:a}=e;let c=0;for(let l=0;l<a;l++){const h=r[l],u=h._batchLocation;if(u>=0&&u<n&&t[u]===h){o[l]=u;continue}for(;c<n;){const d=t[c];if(d&&d._batchEnabled===i&&d._batchLocation===c){c++;continue}o[l]=c,h._batchLocation=c,t[c]=h;break}}}destroy(){this.renderer=null}}wb.extension={type:ke.RendererSystem,name:"batch"};$e.add(wb);let nv=0;class oh{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=nv++}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=nv++,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(Be.PREFER_ENV>=go.WEBGL2&&(i=e.getContext("webgl2",t)),i)this.webGLVersion=2;else if(this.webGLVersion=1,i=e.getContext("webgl",t)||e.getContext("experimental-webgl",t),!i)throw new Error("This browser does not support WebGL. Try using the canvas renderer");return this.gl=i,this.getExtensions(),this.gl}getExtensions(){const{gl:e}=this,t={loseContext:e.getExtension("WEBGL_lose_context"),anisotropicFiltering:e.getExtension("EXT_texture_filter_anisotropic"),floatTextureLinear:e.getExtension("OES_texture_float_linear"),s3tc:e.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:e.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:e.getExtension("WEBGL_compressed_texture_etc"),etc1:e.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:e.getExtension("WEBGL_compressed_texture_atc"),astc:e.getExtension("WEBGL_compressed_texture_astc"),bptc:e.getExtension("EXT_texture_compression_bptc")};this.webGLVersion===1?Object.assign(this.extensions,t,{drawBuffers:e.getExtension("WEBGL_draw_buffers"),depthTexture:e.getExtension("WEBGL_depth_texture"),vertexArrayObject:e.getExtension("OES_vertex_array_object")||e.getExtension("MOZ_OES_vertex_array_object")||e.getExtension("WEBKIT_OES_vertex_array_object"),uint32ElementIndex:e.getExtension("OES_element_index_uint"),floatTexture:e.getExtension("OES_texture_float"),floatTextureLinear:e.getExtension("OES_texture_float_linear"),textureHalfFloat:e.getExtension("OES_texture_half_float"),textureHalfFloatLinear:e.getExtension("OES_texture_half_float_linear")}):this.webGLVersion===2&&Object.assign(this.extensions,t,{colorBufferFloat:e.getExtension("EXT_color_buffer_float")})}handleContextLost(e){e.preventDefault(),setTimeout(()=>{this.gl.isContextLost()&&this.extensions.loseContext&&this.extensions.loseContext.restoreContext()},0)}handleContextRestored(){this.renderer.runners.contextChange.emit(this.gl)}destroy(){const e=this.renderer.view;this.renderer=null,e.removeEventListener!==void 0&&(e.removeEventListener("webglcontextlost",this.handleContextLost),e.removeEventListener("webglcontextrestored",this.handleContextRestored)),this.gl.useProgram(null),this.extensions.loseContext&&this.extensions.loseContext.loseContext()}postrender(){this.renderer.objectRenderer.renderingToScreen&&this.gl.flush()}validateContext(e){const t=e.getContextAttributes(),i="WebGL2RenderingContext"in globalThis&&e instanceof globalThis.WebGL2RenderingContext;i&&(this.webGLVersion=2),t&&!t.stencil&&console.warn("Provided WebGL context does not have a stencil buffer, masks may not render correctly");const n=i||!!e.getExtension("OES_element_index_uint");this.supports.uint32Indices=n,n||console.warn("Provided WebGL context does not support 32 index buffer, complex graphics may not render correctly")}}oh.defaultOptions={context:null,antialias:!1,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:"default"},oh.extension={type:ke.RendererSystem,name:"context"};$e.add(oh);class Kf{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 Ls("disposeFramebuffer"),this.multisample=ci.NONE}get colorTexture(){return this.colorTextures[0]}addColorTexture(e=0,t){return this.colorTextures[e]=t||new it(null,{scaleMode:Rs.NEAREST,resolution:1,mipmap:vs.OFF,width:this.width,height:this.height}),this.dirtyId++,this.dirtyFormat++,this}addDepthTexture(e){return this.depthTexture=e||new it(null,{scaleMode:Rs.NEAREST,resolution:1,width:this.width,height:this.height,mipmap:vs.OFF,format:Te.DEPTH_COMPONENT,type:Ue.UNSIGNED_SHORT}),this.dirtyId++,this.dirtyFormat++,this}enableDepth(){return this.depth=!0,this.dirtyId++,this.dirtyFormat++,this}enableStencil(){return this.stencil=!0,this.dirtyId++,this.dirtyFormat++,this}resize(e,t){if(e=Math.round(e),t=Math.round(t),!e||!t)throw new Error("Framebuffer width and height must not be zero");if(!(e===this.width&&t===this.height)){this.width=e,this.height=t,this.dirtyId++,this.dirtySize++;for(let i=0;i<this.colorTextures.length;i++){const n=this.colorTextures[i],r=n.resolution;n.setSize(e/r,t/r)}if(this.depthTexture){const i=this.depthTexture.resolution;this.depthTexture.setSize(e/i,t/i)}}}dispose(){this.disposeRunner.emit(this,!1)}destroyDepthTexture(){this.depthTexture&&(this.depthTexture.destroy(),this.depthTexture=null,++this.dirtyId,++this.dirtyFormat)}}class Sb extends it{constructor(e={}){if(typeof e=="number"){const t=arguments[0],i=arguments[1],n=arguments[2],r=arguments[3];e={width:t,height:i,scaleMode:n,resolution:r}}e.width=e.width??100,e.height=e.height??100,e.multisample??(e.multisample=ci.NONE),super(null,e),this.mipmap=vs.OFF,this.valid=!0,this._clear=new At([0,0,0,0]),this.framebuffer=new Kf(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 Wn extends yl{constructor(e){const t=e,i=t.naturalWidth||t.videoWidth||t.displayWidth||t.width,n=t.naturalHeight||t.videoHeight||t.displayHeight||t.height;super(i,n),this.source=e,this.noSubImage=!1}static crossOrigin(e,t,i){i===void 0&&!t.startsWith("data:")?e.crossOrigin=oC(t):i!==!1&&(e.crossOrigin=typeof i=="string"?i:"anonymous")}upload(e,t,i,n){const r=e.gl,o=t.realWidth,a=t.realHeight;if(n=n||this.source,typeof HTMLImageElement<"u"&&n instanceof HTMLImageElement){if(!n.complete||n.naturalWidth===0)return!1}else if(typeof HTMLVideoElement<"u"&&n instanceof HTMLVideoElement&&n.readyState<=1)return!1;return r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.alphaMode===bi.UNPACK),!this.noSubImage&&t.target===r.TEXTURE_2D&&i.width===o&&i.height===a?r.texSubImage2D(r.TEXTURE_2D,0,0,0,t.format,i.type,n):(i.width=o,i.height=a,r.texImage2D(t.target,0,i.internalFormat,t.format,i.type,n)),!0}update(){if(this.destroyed)return;const e=this.source,t=e.naturalWidth||e.videoWidth||e.width,i=e.naturalHeight||e.videoHeight||e.height;this.resize(t,i),super.update()}dispose(){this.source=null}}class Mb extends Wn{constructor(e,t){if(t=t||{},typeof e=="string"){const i=new Image;Wn.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??Be.CREATE_IMAGE_BITMAP)&&!!globalThis.createImageBitmap,this.alphaMode=typeof t.alphaMode=="number"?t.alphaMode:null,this.bitmap=null,this._load=null,t.autoLoad!==!1&&this.load()}load(e){return this._load?this._load:(e!==void 0&&(this.createBitmap=e),this._load=new Promise((t,i)=>{const n=this.source;this.url=n.src;const r=()=>{this.destroyed||(n.onload=null,n.onerror=null,this.update(),this._load=null,this.createBitmap?t(this.process()):t(this))};n.complete&&n.src?r():(n.onload=r,n.onerror=o=>{i(o),this.onError.emit(o)})}),this._load)}process(){const e=this.source;if(this._process!==null)return this._process;if(this.bitmap!==null||!globalThis.createImageBitmap)return Promise.resolve(this);const t=globalThis.createImageBitmap,i=!e.crossOrigin||e.crossOrigin==="anonymous";return this._process=fetch(e.src,{mode:i?"cors":"no-cors"}).then(n=>n.blob()).then(n=>t(n,0,0,e.width,e.height,{premultiplyAlpha:this.alphaMode===null||this.alphaMode===bi.UNPACK?"premultiply":"none"})).then(n=>this.destroyed?Promise.reject():(this.bitmap=n,this.update(),this._process=null,Promise.resolve(this))),this._process}upload(e,t,i){if(typeof this.alphaMode=="number"&&(t.alphaMode=this.alphaMode),!this.createBitmap)return super.upload(e,t,i);if(!this.bitmap&&(this.process(),!this.bitmap))return!1;if(super.upload(e,t,i,this.bitmap),!this.preserveBitmap){let n=!0;const r=t._glTextures;for(const o in r){const a=r[o];if(a!==i&&a.dirtyId!==t.dirtyId){n=!1;break}}n&&(this.bitmap.close&&this.bitmap.close(),this.bitmap=null)}return!0}dispose(){this.source.onload=null,this.source.onerror=null,super.dispose(),this.bitmap&&(this.bitmap.close(),this.bitmap=null),this._process=null,this._load=null}static test(e){return typeof HTMLImageElement<"u"&&(typeof e=="string"||e instanceof HTMLImageElement)}}class gp{constructor(){this.x0=0,this.y0=0,this.x1=1,this.y1=0,this.x2=1,this.y2=1,this.x3=0,this.y3=1,this.uvsFloat32=new Float32Array(8)}set(e,t,i){const n=t.width,r=t.height;if(i){const o=e.width/2/n,a=e.height/2/r,c=e.x/n+o,l=e.y/r+a;i=Wt.add(i,Wt.NW),this.x0=c+o*Wt.uX(i),this.y0=l+a*Wt.uY(i),i=Wt.add(i,2),this.x1=c+o*Wt.uX(i),this.y1=l+a*Wt.uY(i),i=Wt.add(i,2),this.x2=c+o*Wt.uX(i),this.y2=l+a*Wt.uY(i),i=Wt.add(i,2),this.x3=c+o*Wt.uX(i),this.y3=l+a*Wt.uY(i)}else this.x0=e.x/n,this.y0=e.y/r,this.x1=(e.x+e.width)/n,this.y1=e.y/r,this.x2=(e.x+e.width)/n,this.y2=(e.y+e.height)/r,this.x3=e.x/n,this.y3=(e.y+e.height)/r;this.uvsFloat32[0]=this.x0,this.uvsFloat32[1]=this.y0,this.uvsFloat32[2]=this.x1,this.uvsFloat32[3]=this.y1,this.uvsFloat32[4]=this.x2,this.uvsFloat32[5]=this.y2,this.uvsFloat32[6]=this.x3,this.uvsFloat32[7]=this.y3}}gp.prototype.toString=function(){return`[@pixi/core:TextureUvs x0=${this.x0} y0=${this.y0} x1=${this.x1} y1=${this.y1} x2=${this.x2} y2=${this.y2} x3=${this.x3} y3=${this.y3}]`};const rv=new gp;function tc(s){s.destroy=function(){},s.on=function(){},s.once=function(){},s.emit=function(){}}let Ke=class Dt extends Rl{constructor(e,t,i,n,r,o,a){if(super(),this.noFrame=!1,t||(this.noFrame=!0,t=new ct(0,0,1,1)),e instanceof Dt&&(e=e.baseTexture),this.baseTexture=e,this._frame=t,this.trim=n,this.valid=!1,this.destroyed=!1,this._uvs=rv,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=o?new St(o.x,o.y):new St(0,0),this.defaultBorders=a,this._updateID=0,this.textureCacheIds=[],e.valid?this.noFrame?e.valid&&this.onBaseTextureUpdated(e):this.frame=t:e.once("loaded",this.onBaseTextureUpdated,this),this.noFrame&&e.on("update",this.onBaseTextureUpdated,this)}update(){this.baseTexture.resource&&this.baseTexture.resource.update()}onBaseTextureUpdated(e){if(this.noFrame){if(!this.baseTexture.valid)return;this._frame.width=e.width,this._frame.height=e.height,this.valid=!0,this.updateUvs()}else this.frame=this._frame;this.emit("update",this)}destroy(e){if(this.baseTexture){if(e){const{resource:t}=this.baseTexture;t!=null&&t.url&&Ys[t.url]&&Dt.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,Dt.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0,this.emit("destroyed",this),this.removeAllListeners()}clone(){var n;const e=this._frame.clone(),t=this._frame===this.orig?e:this.orig.clone(),i=new Dt(this.baseTexture,!this.noFrame&&e,t,(n=this.trim)==null?void 0:n.clone(),this.rotate,this.defaultAnchor,this.defaultBorders);return this.noFrame&&(i._frame=e),i}updateUvs(){this._uvs===rv&&(this._uvs=new gp),this._uvs.set(this._frame,this.baseTexture,this.rotate),this._updateID++}static from(e,t={},i=Be.STRICT_TEXTURE_CACHE){const n=typeof e=="string";let r=null;if(n)r=e;else if(e instanceof it){if(!e.cacheId){const a=(t==null?void 0:t.pixiIdPrefix)||"pixiid";e.cacheId=`${a}-${ho()}`,it.addToCache(e,e.cacheId)}r=e.cacheId}else{if(!e._pixiId){const a=(t==null?void 0:t.pixiIdPrefix)||"pixiid";e._pixiId=`${a}_${ho()}`}r=e._pixiId}let o=Ys[r];if(n&&i&&!o)throw new Error(`The cacheId "${r}" does not exist in TextureCache.`);return!o&&!(e instanceof it)?(t.resolution||(t.resolution=Hn(e)),o=new Dt(new it(e,t)),o.baseTexture.cacheId=r,it.addToCache(o.baseTexture,r),Dt.addToCache(o,r)):!o&&e instanceof it&&(o=new Dt(e),Dt.addToCache(o,r)),o}static fromURL(e,t){const i=Object.assign({autoLoad:!1},t==null?void 0:t.resourceOptions),n=Dt.from(e,Object.assign({resourceOptions:i},t),!1),r=n.baseTexture.resource;return n.baseTexture.valid?Promise.resolve(n):r.load().then(()=>Promise.resolve(n))}static fromBuffer(e,t,i,n){return new Dt(it.fromBuffer(e,t,i,n))}static fromLoader(e,t,i,n){const r=new it(e,Object.assign({scaleMode:it.defaultOptions.scaleMode,resolution:Hn(t)},n)),{resource:o}=r;o instanceof Mb&&(o.url=t);const a=new Dt(r);return i||(i=t),it.addToCache(a.baseTexture,i),Dt.addToCache(a,i),i!==t&&(it.addToCache(a.baseTexture,t),Dt.addToCache(a,t)),a.baseTexture.valid?Promise.resolve(a):new Promise(c=>{a.baseTexture.once("loaded",()=>c(a))})}static addToCache(e,t){t&&(e.textureCacheIds.includes(t)||e.textureCacheIds.push(t),Ys[t]&&Ys[t]!==e&&console.warn(`Texture added to the cache with an id [${t}] that already had an entry`),Ys[t]=e)}static removeFromCache(e){if(typeof e=="string"){const t=Ys[e];if(t){const i=t.textureCacheIds.indexOf(e);return i>-1&&t.textureCacheIds.splice(i,1),delete Ys[e],t}}else if(e!=null&&e.textureCacheIds){for(let t=0;t<e.textureCacheIds.length;++t)Ys[e.textureCacheIds[t]]===e&&delete Ys[e.textureCacheIds[t]];return e.textureCacheIds.length=0,e}return null}get resolution(){return this.baseTexture.resolution}get frame(){return this._frame}set frame(e){this._frame=e,this.noFrame=!1;const{x:t,y:i,width:n,height:r}=e,o=t+n>this.baseTexture.width,a=i+r>this.baseTexture.height;if(o||a){const c=o&&a?"and":"or",l=`X: ${t} + ${n} = ${t+n} > ${this.baseTexture.width}`,h=`Y: ${i} + ${r} = ${i+r} > ${this.baseTexture.height}`;throw new Error(`Texture Error: frame does not fit inside the base Texture dimensions: ${l} ${c} ${h}`)}this.valid=n&&r&&this.baseTexture.valid,!this.trim&&!this.rotate&&(this.orig=e),this.valid&&this.updateUvs()}get rotate(){return this._rotate}set rotate(e){this._rotate=e,this.valid&&this.updateUvs()}get width(){return this.orig.width}get height(){return this.orig.height}castToBaseTexture(){return this.baseTexture}static get EMPTY(){return Dt._EMPTY||(Dt._EMPTY=new Dt(new it),tc(Dt._EMPTY),tc(Dt._EMPTY.baseTexture)),Dt._EMPTY}static get WHITE(){if(!Dt._WHITE){const e=Be.ADAPTER.createCanvas(16,16),t=e.getContext("2d");e.width=16,e.height=16,t.fillStyle="white",t.fillRect(0,0,16,16),Dt._WHITE=new Dt(it.from(e)),tc(Dt._WHITE),tc(Dt._WHITE.baseTexture)}return Dt._WHITE}};class vo extends Ke{constructor(e,t){super(e,t),this.valid=!0,this.filterFrame=null,this.filterPoolKey=null,this.updateUvs()}get framebuffer(){return this.baseTexture.framebuffer}get multisample(){return this.framebuffer.multisample}set multisample(e){this.framebuffer.multisample=e}resize(e,t,i=!0){const n=this.baseTexture.resolution,r=Math.round(e*n)/n,o=Math.round(t*n)/n;this.valid=r>0&&o>0,this._frame.width=this.orig.width=r,this._frame.height=this.orig.height=o,i&&this.baseTexture.resize(r,o),this.updateUvs()}setResolution(e){const{baseTexture:t}=this;t.resolution!==e&&(t.setResolution(e),this.resize(t.width,t.height,!1))}static create(e){return new vo(new Sb(e))}}class Tb{constructor(e){this.texturePool={},this.textureOptions=e||{},this.enableFullScreen=!1,this._pixelsWidth=0,this._pixelsHeight=0}createTexture(e,t,i=ci.NONE){const n=new Sb(Object.assign({width:e,height:t,resolution:1,multisample:i},this.textureOptions));return new vo(n)}getOptimalTexture(e,t,i=1,n=ci.NONE){let r;e=Math.max(Math.ceil(e*i-1e-6),1),t=Math.max(Math.ceil(t*i-1e-6),1),!this.enableFullScreen||e!==this._pixelsWidth||t!==this._pixelsHeight?(e=ih(e),t=ih(t),r=((e&65535)<<16|t&65535)>>>0,n>1&&(r+=n*4294967296)):r=n>1?-n:-1,this.texturePool[r]||(this.texturePool[r]=[]);let o=this.texturePool[r].pop();return o||(o=this.createTexture(e,t,n)),o.filterPoolKey=r,o.setResolution(i),o}getFilterTexture(e,t,i){const n=this.getOptimalTexture(e.width,e.height,t||e.resolution,i||ci.NONE);return n.filterFrame=e.filterFrame,n}returnTexture(e){const t=e.filterPoolKey;e.filterFrame=null,this.texturePool[t].push(e)}returnFilterTexture(e){this.returnTexture(e)}clear(e){if(e=e!==!1,e)for(const t in this.texturePool){const i=this.texturePool[t];if(i)for(let n=0;n<i.length;n++)i[n].destroy(!0)}this.texturePool={}}setScreenSize(e){if(!(e.width===this._pixelsWidth&&e.height===this._pixelsHeight)){this.enableFullScreen=e.width>0&&e.height>0;for(const t in this.texturePool){if(!(Number(t)<0))continue;const i=this.texturePool[t];if(i)for(let n=0;n<i.length;n++)i[n].destroy(!0);this.texturePool[t]=[]}this._pixelsWidth=e.width,this._pixelsHeight=e.height}}}Tb.SCREEN_KEY=-1;class NC extends fn{constructor(){super(),this.addAttribute("aVertexPosition",new Float32Array([0,0,1,0,1,1,0,1])).addIndex([0,1,3,2])}}class _b extends fn{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 $t(this.vertices),this.uvBuffer=new $t(this.uvs),this.addAttribute("aVertexPosition",this.vertexBuffer).addAttribute("aTextureCoord",this.uvBuffer).addIndex([0,1,2,0,2,3])}map(e,t){let i=0,n=0;return this.uvs[0]=i,this.uvs[1]=n,this.uvs[2]=i+t.width/e.width,this.uvs[3]=n,this.uvs[4]=i+t.width/e.width,this.uvs[5]=n+t.height/e.height,this.uvs[6]=i,this.uvs[7]=n+t.height/e.height,i=t.x,n=t.y,this.vertices[0]=i,this.vertices[1]=n,this.vertices[2]=i+t.width,this.vertices[3]=n,this.vertices[4]=i+t.width,this.vertices[5]=n+t.height,this.vertices[6]=i,this.vertices[7]=n+t.height,this.invalidate(),this}invalidate(){return this.vertexBuffer._updateID++,this.uvBuffer._updateID++,this}}class DC{constructor(){this.renderTexture=null,this.target=null,this.legacy=!1,this.resolution=1,this.multisample=ci.NONE,this.sourceFrame=new ct,this.destinationFrame=new ct,this.bindingSourceFrame=new ct,this.bindingDestinationFrame=new ct,this.filters=[],this.transform=null}clear(){this.target=null,this.filters=null,this.renderTexture=null}}const ic=[new St,new St,new St,new St],jd=new Ft;class Cb{constructor(e){this.renderer=e,this.defaultFilterStack=[{}],this.texturePool=new Tb,this.statePool=[],this.quad=new NC,this.quadUv=new _b,this.tempRect=new ct,this.activeState={},this.globalUniforms=new Bs({outputFrame:new ct,inputSize:new Float32Array(4),inputPixel:new Float32Array(4),inputClamp:new Float32Array(4),resolution:1,filterArea:new Float32Array(4),filterClamp:new Float32Array(4)},!0),this.forceClear=!1,this.useMaxPadding=!1}init(){this.texturePool.setScreenSize(this.renderer.view)}push(e,t){const i=this.renderer,n=this.defaultFilterStack,r=this.statePool.pop()||new DC,o=i.renderTexture;let a,c;if(o.current){const g=o.current;a=g.resolution,c=g.multisample}else a=i.resolution,c=i.multisample;let l=t[0].resolution||a,h=t[0].multisample??c,u=t[0].padding,d=t[0].autoFit,f=t[0].legacy??!0;for(let g=1;g<t.length;g++){const x=t[g];l=Math.min(l,x.resolution||a),h=Math.min(h,x.multisample??c),u=this.useMaxPadding?Math.max(u,x.padding):u+x.padding,d=d&&x.autoFit,f=f||(x.legacy??!0)}n.length===1&&(this.defaultFilterStack[0].renderTexture=o.current),n.push(r),r.resolution=l,r.multisample=h,r.legacy=f,r.target=e,r.sourceFrame.copyFrom(e.filterArea||e.getBounds(!0)),r.sourceFrame.pad(u);const m=this.tempRect.copyFrom(o.sourceFrame);i.projection.transform&&this.transformAABB(jd.copyFrom(i.projection.transform).invert(),m),d?(r.sourceFrame.fit(m),(r.sourceFrame.width<=0||r.sourceFrame.height<=0)&&(r.sourceFrame.width=0,r.sourceFrame.height=0)):r.sourceFrame.intersects(m)||(r.sourceFrame.width=0,r.sourceFrame.height=0),this.roundFrame(r.sourceFrame,o.current?o.current.resolution:i.resolution,o.sourceFrame,o.destinationFrame,i.projection.transform),r.renderTexture=this.getOptimalFilterTexture(r.sourceFrame.width,r.sourceFrame.height,l,h),r.filters=t,r.destinationFrame.width=r.renderTexture.width,r.destinationFrame.height=r.renderTexture.height;const p=this.tempRect;p.x=0,p.y=0,p.width=r.sourceFrame.width,p.height=r.sourceFrame.height,r.renderTexture.filterFrame=r.sourceFrame,r.bindingSourceFrame.copyFrom(o.sourceFrame),r.bindingDestinationFrame.copyFrom(o.destinationFrame),r.transform=i.projection.transform,i.projection.transform=null,o.bind(r.renderTexture,r.sourceFrame,p),i.framebuffer.clear(0,0,0,0)}pop(){const e=this.defaultFilterStack,t=e.pop(),i=t.filters;this.activeState=t;const n=this.globalUniforms.uniforms;n.outputFrame=t.sourceFrame,n.resolution=t.resolution;const r=n.inputSize,o=n.inputPixel,a=n.inputClamp;if(r[0]=t.destinationFrame.width,r[1]=t.destinationFrame.height,r[2]=1/r[0],r[3]=1/r[1],o[0]=Math.round(r[0]*t.resolution),o[1]=Math.round(r[1]*t.resolution),o[2]=1/o[0],o[3]=1/o[1],a[0]=.5*o[2],a[1]=.5*o[3],a[2]=t.sourceFrame.width*r[2]-.5*o[2],a[3]=t.sourceFrame.height*r[3]-.5*o[3],t.legacy){const l=n.filterArea;l[0]=t.destinationFrame.width,l[1]=t.destinationFrame.height,l[2]=t.sourceFrame.x,l[3]=t.sourceFrame.y,n.filterClamp=n.inputClamp}this.globalUniforms.update();const c=e[e.length-1];if(this.renderer.framebuffer.blit(),i.length===1)i[0].apply(this,t.renderTexture,c.renderTexture,en.BLEND,t),this.returnFilterTexture(t.renderTexture);else{let l=t.renderTexture,h=this.getOptimalFilterTexture(l.width,l.height,t.resolution);h.filterFrame=l.filterFrame;let u=0;for(u=0;u<i.length-1;++u){u===1&&t.multisample>1&&(h=this.getOptimalFilterTexture(l.width,l.height,t.resolution),h.filterFrame=l.filterFrame),i[u].apply(this,l,h,en.CLEAR,t);const d=l;l=h,h=d}i[u].apply(this,l,c.renderTexture,en.BLEND,t),u>1&&t.multisample>1&&this.returnFilterTexture(t.renderTexture),this.returnFilterTexture(l),this.returnFilterTexture(h)}t.clear(),this.statePool.push(t)}bindAndClear(e,t=en.CLEAR){const{renderTexture:i,state:n}=this.renderer;if(e===this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?this.renderer.projection.transform=this.activeState.transform:this.renderer.projection.transform=null,e==null?void 0:e.filterFrame){const o=this.tempRect;o.x=0,o.y=0,o.width=e.filterFrame.width,o.height=e.filterFrame.height,i.bind(e,e.filterFrame,o)}else e!==this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?i.bind(e):this.renderer.renderTexture.bind(e,this.activeState.bindingSourceFrame,this.activeState.bindingDestinationFrame);const r=n.stateId&1||this.forceClear;(t===en.CLEAR||t===en.BLIT&&r)&&this.renderer.framebuffer.clear(0,0,0,0)}applyFilter(e,t,i,n){const r=this.renderer;r.state.set(e.state),this.bindAndClear(i,n),e.uniforms.uSampler=t,e.uniforms.filterGlobals=this.globalUniforms,r.shader.bind(e),e.legacy=!!e.program.attributeData.aTextureCoord,e.legacy?(this.quadUv.map(t._frame,t.filterFrame),r.geometry.bind(this.quadUv),r.geometry.draw(on.TRIANGLES)):(r.geometry.bind(this.quad),r.geometry.draw(on.TRIANGLE_STRIP))}calculateSpriteMatrix(e,t){const{sourceFrame:i,destinationFrame:n}=this.activeState,{orig:r}=t._texture,o=e.set(n.width,0,0,n.height,i.x,i.y),a=t.worldTransform.copyTo(Ft.TEMP_MATRIX);return a.invert(),o.prepend(a),o.scale(1/r.width,1/r.height),o.translate(t.anchor.x,t.anchor.y),o}destroy(){this.renderer=null,this.texturePool.clear(!1)}getOptimalFilterTexture(e,t,i=1,n=ci.NONE){return this.texturePool.getOptimalTexture(e,t,i,n)}getFilterTexture(e,t,i){if(typeof e=="number"){const r=e;e=t,t=r}e=e||this.activeState.renderTexture;const n=this.texturePool.getOptimalTexture(e.width,e.height,t||e.resolution,i||ci.NONE);return n.filterFrame=e.filterFrame,n}returnFilterTexture(e){this.texturePool.returnTexture(e)}emptyPool(){this.texturePool.clear(!0)}resize(){this.texturePool.setScreenSize(this.renderer.view)}transformAABB(e,t){const i=ic[0],n=ic[1],r=ic[2],o=ic[3];i.set(t.left,t.top),n.set(t.left,t.bottom),r.set(t.right,t.top),o.set(t.right,t.bottom),e.apply(i,i),e.apply(n,n),e.apply(r,r),e.apply(o,o);const a=Math.min(i.x,n.x,r.x,o.x),c=Math.min(i.y,n.y,r.y,o.y),l=Math.max(i.x,n.x,r.x,o.x),h=Math.max(i.y,n.y,r.y,o.y);t.x=a,t.y=c,t.width=l-a,t.height=h-c}roundFrame(e,t,i,n,r){if(!(e.width<=0||e.height<=0||i.width<=0||i.height<=0)){if(r){const{a:o,b:a,c,d:l}=r;if((Math.abs(a)>1e-4||Math.abs(c)>1e-4)&&(Math.abs(o)>1e-4||Math.abs(l)>1e-4))return}r=r?jd.copyFrom(r):jd.identity(),r.translate(-i.x,-i.y).scale(n.width/i.width,n.height/i.height).translate(n.x,n.y),this.transformAABB(r,e),e.ceil(t),this.transformAABB(r.invert(),e)}}}Cb.extension={type:ke.RendererSystem,name:"filter"};$e.add(Cb);class UC{constructor(e){this.framebuffer=e,this.stencil=null,this.dirtyId=-1,this.dirtyFormat=-1,this.dirtySize=-1,this.multisample=ci.NONE,this.msaaBuffer=null,this.blitFramebuffer=null,this.mipLevel=0}}const $C=new ct;class Eb{constructor(e){this.renderer=e,this.managedFramebuffers=[],this.unknownFramebuffer=new Kf(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 ct,this.hasMRT=!0,this.writeDepthTexture=!0,this.renderer.context.webGLVersion===1){let t=this.renderer.context.extensions.drawBuffers,i=this.renderer.context.extensions.depthTexture;Be.PREFER_ENV===go.WEBGL_LEGACY&&(t=null,i=null),t?e.drawBuffers=n=>t.drawBuffersWEBGL(n):(this.hasMRT=!1,e.drawBuffers=()=>{}),i||(this.writeDepthTexture=!1)}else this.msaaSamples=e.getInternalformatParameter(e.RENDERBUFFER,e.RGBA8,e.SAMPLES)}bind(e,t,i=0){const{gl:n}=this;if(e){const r=e.glFramebuffers[this.CONTEXT_UID]||this.initFramebuffer(e);this.current!==e&&(this.current=e,n.bindFramebuffer(n.FRAMEBUFFER,r.framebuffer)),r.mipLevel!==i&&(e.dirtyId++,e.dirtyFormat++,r.mipLevel=i),r.dirtyId!==e.dirtyId&&(r.dirtyId=e.dirtyId,r.dirtyFormat!==e.dirtyFormat?(r.dirtyFormat=e.dirtyFormat,r.dirtySize=e.dirtySize,this.updateFramebuffer(e,i)):r.dirtySize!==e.dirtySize&&(r.dirtySize=e.dirtySize,this.resizeFramebuffer(e)));for(let o=0;o<e.colorTextures.length;o++){const a=e.colorTextures[o];this.renderer.texture.unbind(a.parentTextureArray||a)}if(e.depthTexture&&this.renderer.texture.unbind(e.depthTexture),t){const o=t.width>>i,a=t.height>>i,c=o/t.width;this.setViewport(t.x*c,t.y*c,o,a)}else{const o=e.width>>i,a=e.height>>i;this.setViewport(0,0,o,a)}}else this.current&&(this.current=null,n.bindFramebuffer(n.FRAMEBUFFER,null)),t?this.setViewport(t.x,t.y,t.width,t.height):this.setViewport(0,0,this.renderer.width,this.renderer.height)}setViewport(e,t,i,n){const r=this.viewport;e=Math.round(e),t=Math.round(t),i=Math.round(i),n=Math.round(n),(r.width!==i||r.height!==n||r.x!==e||r.y!==t)&&(r.x=e,r.y=t,r.width=i,r.height=n,this.gl.viewport(e,t,i,n))}get size(){return this.current?{x:0,y:0,width:this.current.width,height:this.current.height}:{x:0,y:0,width:this.renderer.width,height:this.renderer.height}}clear(e,t,i,n,r=Bf.COLOR|Bf.DEPTH){const{gl:o}=this;o.clearColor(e,t,i,n),o.clear(r)}initFramebuffer(e){const{gl:t}=this,i=new UC(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 o;this.renderer.context.webGLVersion===1?o=t.DEPTH_STENCIL:e.depth&&e.stencil?o=t.DEPTH24_STENCIL8:e.depth?o=t.DEPTH_COMPONENT24:o=t.STENCIL_INDEX8,i.msaaBuffer?t.renderbufferStorageMultisample(t.RENDERBUFFER,i.multisample,o,e.width,e.height):t.renderbufferStorage(t.RENDERBUFFER,o,e.width,e.height)}const n=e.colorTextures;let r=n.length;t.drawBuffers||(r=Math.min(r,1));for(let o=0;o<r;o++){const a=n[o],c=a.parentTextureArray||a;this.renderer.texture.bind(c,0),o===0&&i.msaaBuffer&&(t.bindRenderbuffer(t.RENDERBUFFER,i.msaaBuffer),t.renderbufferStorageMultisample(t.RENDERBUFFER,i.multisample,c._glTextures[this.CONTEXT_UID].internalFormat,e.width,e.height))}e.depthTexture&&this.writeDepthTexture&&this.renderer.texture.bind(e.depthTexture,0)}updateFramebuffer(e,t){const{gl:i}=this,n=e.glFramebuffers[this.CONTEXT_UID],r=e.colorTextures;let o=r.length;i.drawBuffers||(o=Math.min(o,1)),n.multisample>1&&this.canMultisampleFramebuffer(e)?n.msaaBuffer=n.msaaBuffer||i.createRenderbuffer():n.msaaBuffer&&(i.deleteRenderbuffer(n.msaaBuffer),n.msaaBuffer=null,n.blitFramebuffer&&(n.blitFramebuffer.dispose(),n.blitFramebuffer=null));const a=[];for(let c=0;c<o;c++){const l=r[c],h=l.parentTextureArray||l;this.renderer.texture.bind(h,0),c===0&&n.msaaBuffer?(i.bindRenderbuffer(i.RENDERBUFFER,n.msaaBuffer),i.renderbufferStorageMultisample(i.RENDERBUFFER,n.multisample,h._glTextures[this.CONTEXT_UID].internalFormat,e.width,e.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.RENDERBUFFER,n.msaaBuffer)):(i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+c,l.target,h._glTextures[this.CONTEXT_UID].texture,t),a.push(i.COLOR_ATTACHMENT0+c))}if(a.length>1&&i.drawBuffers(a),e.depthTexture&&this.writeDepthTexture){const c=e.depthTexture;this.renderer.texture.bind(c,0),i.framebufferTexture2D(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.TEXTURE_2D,c._glTextures[this.CONTEXT_UID].texture,t)}if((e.stencil||e.depth)&&!(e.depthTexture&&this.writeDepthTexture)){n.stencil=n.stencil||i.createRenderbuffer();let c,l;this.renderer.context.webGLVersion===1?(c=i.DEPTH_STENCIL_ATTACHMENT,l=i.DEPTH_STENCIL):e.depth&&e.stencil?(c=i.DEPTH_STENCIL_ATTACHMENT,l=i.DEPTH24_STENCIL8):e.depth?(c=i.DEPTH_ATTACHMENT,l=i.DEPTH_COMPONENT24):(c=i.STENCIL_ATTACHMENT,l=i.STENCIL_INDEX8),i.bindRenderbuffer(i.RENDERBUFFER,n.stencil),n.msaaBuffer?i.renderbufferStorageMultisample(i.RENDERBUFFER,n.multisample,l,e.width,e.height):i.renderbufferStorage(i.RENDERBUFFER,l,e.width,e.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,c,i.RENDERBUFFER,n.stencil)}else n.stencil&&(i.deleteRenderbuffer(n.stencil),n.stencil=null)}canMultisampleFramebuffer(e){return this.renderer.context.webGLVersion!==1&&e.colorTextures.length<=1&&!e.depthTexture}detectSamples(e){const{msaaSamples:t}=this;let i=ci.NONE;if(e<=1||t===null)return i;for(let n=0;n<t.length;n++)if(t[n]<=e){i=t[n];break}return i===1&&(i=ci.NONE),i}blit(e,t,i){const{current:n,renderer:r,gl:o,CONTEXT_UID:a}=this;if(r.context.webGLVersion!==2||!n)return;const c=n.glFramebuffers[a];if(!c)return;if(!e){if(!c.msaaBuffer)return;const h=n.colorTextures[0];if(!h)return;c.blitFramebuffer||(c.blitFramebuffer=new Kf(n.width,n.height),c.blitFramebuffer.addColorTexture(0,h)),e=c.blitFramebuffer,e.colorTextures[0]!==h&&(e.colorTextures[0]=h,e.dirtyId++,e.dirtyFormat++),(e.width!==n.width||e.height!==n.height)&&(e.width=n.width,e.height=n.height,e.dirtyId++,e.dirtySize++)}t||(t=$C,t.width=n.width,t.height=n.height),i||(i=t);const l=t.width===i.width&&t.height===i.height;this.bind(e),o.bindFramebuffer(o.READ_FRAMEBUFFER,c.framebuffer),o.blitFramebuffer(t.left,t.top,t.right,t.bottom,i.left,i.top,i.right,i.bottom,o.COLOR_BUFFER_BIT,l?o.NEAREST:o.LINEAR),o.bindFramebuffer(o.READ_FRAMEBUFFER,e.glFramebuffers[this.CONTEXT_UID].framebuffer)}disposeFramebuffer(e,t){const i=e.glFramebuffers[this.CONTEXT_UID],n=this.gl;if(!i)return;delete e.glFramebuffers[this.CONTEXT_UID];const r=this.managedFramebuffers.indexOf(e);r>=0&&this.managedFramebuffers.splice(r,1),e.disposeRunner.remove(this),t||(n.deleteFramebuffer(i.framebuffer),i.msaaBuffer&&n.deleteRenderbuffer(i.msaaBuffer),i.stencil&&n.deleteRenderbuffer(i.stencil)),i.blitFramebuffer&&this.disposeFramebuffer(i.blitFramebuffer,t)}disposeAll(e){const t=this.managedFramebuffers;this.managedFramebuffers=[];for(let i=0;i<t.length;i++)this.disposeFramebuffer(t[i],e)}forceStencil(){const e=this.current;if(!e)return;const t=e.glFramebuffers[this.CONTEXT_UID];if(!t||t.stencil&&e.stencil)return;e.stencil=!0;const i=e.width,n=e.height,r=this.gl,o=t.stencil=r.createRenderbuffer();r.bindRenderbuffer(r.RENDERBUFFER,o);let a,c;this.renderer.context.webGLVersion===1?(a=r.DEPTH_STENCIL_ATTACHMENT,c=r.DEPTH_STENCIL):e.depth?(a=r.DEPTH_STENCIL_ATTACHMENT,c=r.DEPTH24_STENCIL8):(a=r.STENCIL_ATTACHMENT,c=r.STENCIL_INDEX8),t.msaaBuffer?r.renderbufferStorageMultisample(r.RENDERBUFFER,t.multisample,c,i,n):r.renderbufferStorage(r.RENDERBUFFER,c,i,n),r.framebufferRenderbuffer(r.FRAMEBUFFER,a,r.RENDERBUFFER,o)}reset(){this.current=this.unknownFramebuffer,this.viewport=new ct}destroy(){this.renderer=null}}Eb.extension={type:ke.RendererSystem,name:"framebuffer"};$e.add(Eb);const Hd={5126:4,5123:2,5121:1};class Ab{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;Be.PREFER_ENV===go.WEBGL_LEGACY&&(i=null),i?(e.createVertexArray=()=>i.createVertexArrayOES(),e.bindVertexArray=n=>i.bindVertexArrayOES(n),e.deleteVertexArray=n=>i.deleteVertexArrayOES(n)):(this.hasVao=!1,e.createVertexArray=()=>null,e.bindVertexArray=()=>null,e.deleteVertexArray=()=>null)}if(t.webGLVersion!==2){const i=e.getExtension("ANGLE_instanced_arrays");i?(e.vertexAttribDivisor=(n,r)=>i.vertexAttribDivisorANGLE(n,r),e.drawElementsInstanced=(n,r,o,a,c)=>i.drawElementsInstancedANGLE(n,r,o,a,c),e.drawArraysInstanced=(n,r,o,a)=>i.drawArraysInstancedANGLE(n,r,o,a)):this.hasInstance=!1}this.canUseUInt32ElementIndex=t.webGLVersion===2||!!t.extensions.uint32ElementIndex}bind(e,t){t=t||this.renderer.shader.shader;const{gl:i}=this;let n=e.glVertexArrayObjects[this.CONTEXT_UID],r=!1;n||(this.managedGeometries[e.id]=e,e.disposeRunner.add(this),e.glVertexArrayObjects[this.CONTEXT_UID]=n={},r=!0);const o=n[t.program.id]||this.initGeometryVao(e,t,r);this._activeGeometry=e,this._activeVao!==o&&(this._activeVao=o,this.hasVao?i.bindVertexArray(o):this.activateVao(e,t.program)),this.updateBuffers()}reset(){this.unbind()}updateBuffers(){const e=this._activeGeometry,t=this.renderer.buffer;for(let i=0;i<e.buffers.length;i++){const n=e.buffers[i];t.update(n)}}checkCompatibility(e,t){const i=e.attributes,n=t.attributeData;for(const r in n)if(!i[r])throw new Error(`shader and geometry incompatible, geometry missing the "${r}" attribute`)}getSignature(e,t){const i=e.attributes,n=t.attributeData,r=["g",e.id];for(const o in i)n[o]&&r.push(o,n[o].location);return r.join("-")}initGeometryVao(e,t,i=!0){const n=this.gl,r=this.CONTEXT_UID,o=this.renderer.buffer,a=t.program;a.glPrograms[r]||this.renderer.shader.generateProgram(t),this.checkCompatibility(e,a);const c=this.getSignature(e,a),l=e.glVertexArrayObjects[this.CONTEXT_UID];let h=l[c];if(h)return l[a.id]=h,h;const u=e.buffers,d=e.attributes,f={},m={};for(const p in u)f[p]=0,m[p]=0;for(const p in d)!d[p].size&&a.attributeData[p]?d[p].size=a.attributeData[p].size:d[p].size||console.warn(`PIXI Geometry attribute '${p}' size cannot be determined (likely the bound shader does not have the attribute)`),f[d[p].buffer]+=d[p].size*Hd[d[p].type];for(const p in d){const g=d[p],x=g.size;g.stride===void 0&&(f[g.buffer]===x*Hd[g.type]?g.stride=0:g.stride=f[g.buffer]),g.start===void 0&&(g.start=m[g.buffer],m[g.buffer]+=x*Hd[g.type])}h=n.createVertexArray(),n.bindVertexArray(h);for(let p=0;p<u.length;p++){const g=u[p];o.bind(g),i&&g._glBuffers[r].refCount++}return this.activateVao(e,a),l[a.id]=h,l[c]=h,n.bindVertexArray(null),o.unbind(hn.ARRAY_BUFFER),h}disposeGeometry(e,t){var a;if(!this.managedGeometries[e.id])return;delete this.managedGeometries[e.id];const i=e.glVertexArrayObjects[this.CONTEXT_UID],n=this.gl,r=e.buffers,o=(a=this.renderer)==null?void 0:a.buffer;if(e.disposeRunner.remove(this),!!i){if(o)for(let c=0;c<r.length;c++){const l=r[c]._glBuffers[this.CONTEXT_UID];l&&(l.refCount--,l.refCount===0&&!t&&o.dispose(r[c],t))}if(!t){for(const c in i)if(c[0]==="g"){const l=i[c];this._activeVao===l&&this.unbind(),n.deleteVertexArray(l)}}delete e.glVertexArrayObjects[this.CONTEXT_UID]}}disposeAll(e){const t=Object.keys(this.managedGeometries);for(let i=0;i<t.length;i++)this.disposeGeometry(this.managedGeometries[t[i]],e)}activateVao(e,t){const i=this.gl,n=this.CONTEXT_UID,r=this.renderer.buffer,o=e.buffers,a=e.attributes;e.indexBuffer&&r.bind(e.indexBuffer);let c=null;for(const l in a){const h=a[l],u=o[h.buffer],d=u._glBuffers[n];if(t.attributeData[l]){c!==d&&(r.bind(u),c=d);const f=t.attributeData[l].location;if(i.enableVertexAttribArray(f),i.vertexAttribPointer(f,h.size,h.type||i.FLOAT,h.normalized,h.stride,h.start),h.instance)if(this.hasInstance)i.vertexAttribDivisor(f,h.divisor);else throw new Error("geometry error, GPU Instancing is not supported on this device")}}}draw(e,t,i,n){const{gl:r}=this,o=this._activeGeometry;if(o.indexBuffer){const a=o.indexBuffer.data.BYTES_PER_ELEMENT,c=a===2?r.UNSIGNED_SHORT:r.UNSIGNED_INT;a===2||a===4&&this.canUseUInt32ElementIndex?o.instanced?r.drawElementsInstanced(e,t||o.indexBuffer.data.length,c,(i||0)*a,n||1):r.drawElements(e,t||o.indexBuffer.data.length,c,(i||0)*a):console.warn("unsupported index buffer type: uint32")}else o.instanced?r.drawArraysInstanced(e,i,t||o.getSize(),n||1):r.drawArrays(e,i,t||o.getSize());return this}unbind(){this.gl.bindVertexArray(null),this._activeVao=null,this._activeGeometry=null}destroy(){this.renderer=null}}Ab.extension={type:ke.RendererSystem,name:"geometry"};$e.add(Ab);const ov=new Ft;class vp{constructor(e,t){this._texture=e,this.mapCoord=new Ft,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._textureID=-1,this._updateID=0,this.clampOffset=0,this.clampMargin=typeof t>"u"?.5:t,this.isSimple=!1}get texture(){return this._texture}set texture(e){this._texture=e,this._textureID=-1}multiplyUvs(e,t){t===void 0&&(t=e);const i=this.mapCoord;for(let n=0;n<e.length;n+=2){const r=e[n],o=e[n+1];t[n]=r*i.a+o*i.c+i.tx,t[n+1]=r*i.b+o*i.d+i.ty}return t}update(e){const t=this._texture;if(!t||!t.valid||!e&&this._textureID===t._updateID)return!1;this._textureID=t._updateID,this._updateID++;const i=t._uvs;this.mapCoord.set(i.x1-i.x0,i.y1-i.y0,i.x3-i.x0,i.y3-i.y0,i.x0,i.y0);const n=t.orig,r=t.trim;r&&(ov.set(n.width/r.width,0,0,n.height/r.height,-r.x/r.width,-r.y/r.height),this.mapCoord.append(ov));const o=t.baseTexture,a=this.uClampFrame,c=this.clampMargin/o.resolution,l=this.clampOffset;return a[0]=(t._frame.x+c+l)/o.width,a[1]=(t._frame.y+c+l)/o.height,a[2]=(t._frame.x+t._frame.width-c+l)/o.width,a[3]=(t._frame.y+t._frame.height-c+l)/o.height,this.uClampOffset[0]=l/o.realWidth,this.uClampOffset[1]=l/o.realHeight,this.isSimple=t._frame.width===o.width&&t._frame.height===o.height&&t.rotate===0,!0}}var XC=`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;
|
||
}
|
||
`,VC=`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 YC extends Vi{constructor(e,t,i){let n=null;typeof e!="string"&&t===void 0&&i===void 0&&(n=e,e=void 0,t=void 0,i=void 0),super(e||VC,t||XC,i),this.maskSprite=n,this.maskMatrix=new Ft}get maskSprite(){return this._maskSprite}set maskSprite(e){this._maskSprite=e,this._maskSprite&&(this._maskSprite.renderable=!1)}apply(e,t,i,n){const r=this._maskSprite,o=r._texture;o.valid&&(o.uvMatrix||(o.uvMatrix=new vp(o,0)),o.uvMatrix.update(),this.uniforms.npmAlpha=o.baseTexture.alphaMode?0:1,this.uniforms.mask=o,this.uniforms.otherMatrix=e.calculateSpriteMatrix(this.maskMatrix,r).prepend(o.uvMatrix.mapCoord),this.uniforms.alpha=r.worldAlpha,this.uniforms.maskClamp=o.uvMatrix.uClampFrame,e.applyFilter(this,t,i,n))}}class GC{constructor(e=null){this.type=ui.NONE,this.autoDetect=!0,this.maskObject=e||null,this.pooled=!1,this.isMaskData=!0,this.resolution=null,this.multisample=Vi.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=ui.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 Ib{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 GC;r.pooled=!0,r.maskObject=t,i=r}const n=this.maskStack.length!==0?this.maskStack[this.maskStack.length-1]:null;if(i.copyCountersOrReset(n),i._colorMask=n?n._colorMask:15,i.autoDetect&&this.detect(i),i._target=e,i.type!==ui.SPRITE&&this.maskStack.push(i),i.enabled)switch(i.type){case ui.SCISSOR:this.renderer.scissor.push(i);break;case ui.STENCIL:this.renderer.stencil.push(i);break;case ui.SPRITE:i.copyCountersOrReset(null),this.pushSpriteMask(i);break;case ui.COLOR:this.pushColorMask(i);break}i.type===ui.SPRITE&&this.maskStack.push(i)}pop(e){const t=this.maskStack.pop();if(!(!t||t._target!==e)){if(t.enabled)switch(t.type){case ui.SCISSOR:this.renderer.scissor.pop(t);break;case ui.STENCIL:this.renderer.stencil.pop(t.maskObject);break;case ui.SPRITE:this.popSpriteMask(t);break;case ui.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===ui.SPRITE&&i._filters&&(i._filters[0].maskSprite=i.maskObject)}}}detect(e){const t=e.maskObject;t?t.isSprite?e.type=ui.SPRITE:this.enableScissor&&this.renderer.scissor.testScissor(e)?e.type=ui.SCISSOR:e.type=ui.STENCIL:e.type=ui.COLOR}pushSpriteMask(e){const{maskObject:t}=e,i=e._target;let n=e._filters;n||(n=this.alphaMaskPool[this.alphaMaskIndex],n||(n=this.alphaMaskPool[this.alphaMaskIndex]=[new YC])),n[0].resolution=e.resolution,n[0].multisample=e.multisample,n[0].maskSprite=t;const r=i.filterArea;i.filterArea=t.getBounds(!0),this.renderer.filter.push(i,n),i.filterArea=r,e._filters||this.alphaMaskIndex++}popSpriteMask(e){this.renderer.filter.pop(),e._filters?e._filters[0].maskSprite=null:(this.alphaMaskIndex--,this.alphaMaskPool[this.alphaMaskIndex][0].maskSprite=null)}pushColorMask(e){const t=e._colorMask,i=e._colorMask=t&e.colorMask;i!==t&&this.renderer.gl.colorMask((i&1)!==0,(i&2)!==0,(i&4)!==0,(i&8)!==0)}popColorMask(e){const t=e._colorMask,i=this.maskStack.length>0?this.maskStack[this.maskStack.length-1]._colorMask:15;i!==t&&this.renderer.gl.colorMask((i&1)!==0,(i&2)!==0,(i&4)!==0,(i&8)!==0)}destroy(){this.renderer=null}}Ib.extension={type:ke.RendererSystem,name:"mask"};$e.add(Ib);class Rb{constructor(e){this.renderer=e,this.maskStack=[],this.glConst=0}getStackLength(){return this.maskStack.length}setMaskStack(e){const{gl:t}=this.renderer,i=this.getStackLength();this.maskStack=e;const n=this.getStackLength();n!==i&&(n===0?t.disable(this.glConst):(t.enable(this.glConst),this._useCurrent()))}_useCurrent(){}destroy(){this.renderer=null,this.maskStack=null}}const av=new Ft,lv=[],Pb=class Pc extends Rb{constructor(e){super(e),this.glConst=Be.ADAPTER.getWebGLRenderingContext().SCISSOR_TEST}getStackLength(){const e=this.maskStack[this.maskStack.length-1];return e?e._scissorCounter:0}calcScissorRect(e){if(e._scissorRectLocal)return;const t=e._scissorRect,{maskObject:i}=e,{renderer:n}=this,r=n.renderTexture,o=i.getBounds(!0,lv.pop()??new ct);this.roundFrameToPixels(o,r.current?r.current.resolution:n.resolution,r.sourceFrame,r.destinationFrame,n.projection.transform),t&&o.fit(t),e._scissorRectLocal=o}static isMatrixRotated(e){if(!e)return!1;const{a:t,b:i,c:n,d:r}=e;return(Math.abs(i)>1e-4||Math.abs(n)>1e-4)&&(Math.abs(t)>1e-4||Math.abs(r)>1e-4)}testScissor(e){const{maskObject:t}=e;if(!t.isFastRect||!t.isFastRect()||Pc.isMatrixRotated(t.worldTransform)||Pc.isMatrixRotated(this.renderer.projection.transform))return!1;this.calcScissorRect(e);const i=e._scissorRectLocal;return i.width>0&&i.height>0}roundFrameToPixels(e,t,i,n,r){Pc.isMatrixRotated(r)||(r=r?av.copyFrom(r):av.identity(),r.translate(-i.x,-i.y).scale(n.width/i.width,n.height/i.height).translate(n.x,n.y),this.renderer.filter.transformAABB(r,e),e.fit(n),e.x=Math.round(e.x*t),e.y=Math.round(e.y*t),e.width=Math.round(e.width*t),e.height=Math.round(e.height*t))}push(e){e._scissorRectLocal||this.calcScissorRect(e);const{gl:t}=this.renderer;e._scissorRect||t.enable(t.SCISSOR_TEST),e._scissorCounter++,e._scissorRect=e._scissorRectLocal,this._useCurrent()}pop(e){const{gl:t}=this.renderer;e&&lv.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)}};Pb.extension={type:ke.RendererSystem,name:"scissor"};let jC=Pb;$e.add(jC);class kb extends Rb{constructor(e){super(e),this.glConst=Be.ADAPTER.getWebGLRenderingContext().STENCIL_TEST}getStackLength(){const e=this.maskStack[this.maskStack.length-1];return e?e._stencilCounter:0}push(e){const t=e.maskObject,{gl:i}=this.renderer,n=e._stencilCounter;n===0&&(this.renderer.framebuffer.forceStencil(),i.clearStencil(0),i.clear(i.STENCIL_BUFFER_BIT),i.enable(i.STENCIL_TEST)),e._stencilCounter++;const r=e._colorMask;r!==0&&(e._colorMask=0,i.colorMask(!1,!1,!1,!1)),i.stencilFunc(i.EQUAL,n,4294967295),i.stencilOp(i.KEEP,i.KEEP,i.INCR),t.renderable=!0,t.render(this.renderer),this.renderer.batch.flush(),t.renderable=!1,r!==0&&(e._colorMask=r,i.colorMask((r&1)!==0,(r&2)!==0,(r&4)!==0,(r&8)!==0)),this._useCurrent()}pop(e){const t=this.renderer.gl;if(this.getStackLength()===0)t.disable(t.STENCIL_TEST);else{const i=this.maskStack.length!==0?this.maskStack[this.maskStack.length-1]:null,n=i?i._colorMask:15;n!==0&&(i._colorMask=0,t.colorMask(!1,!1,!1,!1)),t.stencilOp(t.KEEP,t.KEEP,t.DECR),e.renderable=!0,e.render(this.renderer),this.renderer.batch.flush(),e.renderable=!1,n!==0&&(i._colorMask=n,t.colorMask((n&1)!==0,(n&2)!==0,(n&4)!==0,(n&8)!==0)),this._useCurrent()}}_useCurrent(){const e=this.renderer.gl;e.stencilFunc(e.EQUAL,this.getStackLength(),4294967295),e.stencilOp(e.KEEP,e.KEEP,e.KEEP)}}kb.extension={type:ke.RendererSystem,name:"stencil"};$e.add(kb);class Fb{constructor(e){this.renderer=e,this.plugins={},Object.defineProperties(this.plugins,{extract:{enumerable:!1,get(){return mt("7.0.0","renderer.plugins.extract has moved to renderer.extract"),e.extract}},prepare:{enumerable:!1,get(){return mt("7.0.0","renderer.plugins.prepare has moved to renderer.prepare"),e.prepare}},interaction:{enumerable:!1,get(){return mt("7.0.0","renderer.plugins.interaction has been deprecated, use renderer.events"),e.events}}})}init(){const e=this.rendererPlugins;for(const t in e)this.plugins[t]=new e[t](this.renderer)}destroy(){for(const e in this.plugins)this.plugins[e].destroy(),this.plugins[e]=null}}Fb.extension={type:[ke.RendererSystem,ke.CanvasRendererSystem],name:"_plugin"};$e.add(Fb);class Ob{constructor(e){this.renderer=e,this.destinationFrame=null,this.sourceFrame=null,this.defaultFrame=null,this.projectionMatrix=new Ft,this.transform=null}update(e,t,i,n){this.destinationFrame=e||this.destinationFrame||this.defaultFrame,this.sourceFrame=t||this.sourceFrame||e,this.calculateProjection(this.destinationFrame,this.sourceFrame,i,n),this.transform&&this.projectionMatrix.append(this.transform);const r=this.renderer;r.globalUniforms.uniforms.projectionMatrix=this.projectionMatrix,r.globalUniforms.update(),r.shader.shader&&r.shader.syncUniformGroup(r.shader.shader.uniforms.globals)}calculateProjection(e,t,i,n){const r=this.projectionMatrix,o=n?-1:1;r.identity(),r.a=1/t.width*2,r.d=o*(1/t.height*2),r.tx=-1-t.x*r.a,r.ty=-o-t.y*r.d}setTransform(e){}destroy(){this.renderer=null}}Ob.extension={type:ke.RendererSystem,name:"projection"};$e.add(Ob);const HC=new pp,cv=new ct;class Lb{constructor(e){this.renderer=e,this._tempMatrix=new Ft}generateTexture(e,t){const{region:i,...n}=t||{},r=(i==null?void 0:i.copyTo(cv))||e.getLocalBounds(cv,!0),o=n.resolution||this.renderer.resolution;r.width=Math.max(r.width,1/o),r.height=Math.max(r.height,1/o),n.width=r.width,n.height=r.height,n.resolution=o,n.multisample??(n.multisample=this.renderer.multisample);const a=vo.create(n);this._tempMatrix.tx=-r.x,this._tempMatrix.ty=-r.y;const c=e.transform;return e.transform=HC,this.renderer.render(e,{renderTexture:a,transform:this._tempMatrix,skipUpdateTransform:!!e.parent,blit:!0}),e.transform=c,a}destroy(){}}Lb.extension={type:[ke.RendererSystem,ke.CanvasRendererSystem],name:"textureGenerator"};$e.add(Lb);const Ur=new ct,Fa=new ct;class Bb{constructor(e){this.renderer=e,this.defaultMaskStack=[],this.current=null,this.sourceFrame=new ct,this.destinationFrame=new ct,this.viewportFrame=new ct}contextChange(){var t;const e=(t=this.renderer)==null?void 0:t.gl.getContextAttributes();this._rendererPremultipliedAlpha=!!(e&&e.alpha&&e.premultipliedAlpha)}bind(e=null,t,i){const n=this.renderer;this.current=e;let r,o,a;e?(r=e.baseTexture,a=r.resolution,t||(Ur.width=e.frame.width,Ur.height=e.frame.height,t=Ur),i||(Fa.x=e.frame.x,Fa.y=e.frame.y,Fa.width=t.width,Fa.height=t.height,i=Fa),o=r.framebuffer):(a=n.resolution,t||(Ur.width=n._view.screen.width,Ur.height=n._view.screen.height,t=Ur),i||(i=Ur,i.width=t.width,i.height=t.height));const c=this.viewportFrame;c.x=i.x*a,c.y=i.y*a,c.width=i.width*a,c.height=i.height*a,e||(c.y=n.view.height-(c.y+c.height)),c.ceil(),this.renderer.framebuffer.bind(o,c),this.renderer.projection.update(i,t,a,!o),e?this.renderer.mask.setMaskStack(r.maskStack):this.renderer.mask.setMaskStack(this.defaultMaskStack),this.sourceFrame.copyFrom(t),this.destinationFrame.copyFrom(i)}clear(e,t){const i=this.current?this.current.baseTexture.clear:this.renderer.background.backgroundColor,n=At.shared.setValue(e||i);(this.current&&this.current.baseTexture.alphaMode>0||!this.current&&this._rendererPremultipliedAlpha)&&n.premultiply(n.alpha);const r=this.destinationFrame,o=this.current?this.current.baseTexture:this.renderer._view.screen,a=r.width!==o.width||r.height!==o.height;if(a){let{x:c,y:l,width:h,height:u}=this.viewportFrame;c=Math.round(c),l=Math.round(l),h=Math.round(h),u=Math.round(u),this.renderer.gl.enable(this.renderer.gl.SCISSOR_TEST),this.renderer.gl.scissor(c,l,h,u)}this.renderer.framebuffer.clear(n.red,n.green,n.blue,n.alpha,t),a&&this.renderer.scissor.pop()}resize(){this.bind(null)}reset(){this.bind(null)}destroy(){this.renderer=null}}Bb.extension={type:ke.RendererSystem,name:"renderTexture"};$e.add(Bb);class WC{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 zC(s,e){const t={},i=e.getProgramParameter(s,e.ACTIVE_ATTRIBUTES);for(let n=0;n<i;n++){const r=e.getActiveAttrib(s,n);if(r.name.startsWith("gl_"))continue;const o=xb(e,r.type),a={type:o,name:r.name,size:yb(o),location:e.getAttribLocation(s,r.name)};t[r.name]=a}return t}function qC(s,e){const t={},i=e.getProgramParameter(s,e.ACTIVE_UNIFORMS);for(let n=0;n<i;n++){const r=e.getActiveUniform(s,n),o=r.name.replace(/\[.*?\]$/,""),a=!!r.name.match(/\[.*?\]$/),c=xb(e,r.type);t[o]={name:o,index:n,type:c,size:r.size,isArray:a,value:gb(c,r.size)}}return t}function KC(s,e){var a;const t=ev(s,s.VERTEX_SHADER,e.vertexSrc),i=ev(s,s.FRAGMENT_SHADER,e.fragmentSrc),n=s.createProgram();s.attachShader(n,t),s.attachShader(n,i);const r=(a=e.extra)==null?void 0:a.transformFeedbackVaryings;if(r&&(typeof s.transformFeedbackVaryings!="function"?console.warn("TransformFeedback is not supported but TransformFeedbackVaryings are given."):s.transformFeedbackVaryings(n,r.names,r.bufferMode==="separate"?s.SEPARATE_ATTRIBS:s.INTERLEAVED_ATTRIBS)),s.linkProgram(n),s.getProgramParameter(n,s.LINK_STATUS)||CC(s,n,t,i),e.attributeData=zC(n,s),e.uniformData=qC(n,s),!/^[ \t]*#[ \t]*version[ \t]+300[ \t]+es[ \t]*$/m.test(e.vertexSrc)){const c=Object.keys(e.attributeData);c.sort((l,h)=>l>h?1:-1);for(let l=0;l<c.length;l++)e.attributeData[c[l]].location=l,s.bindAttribLocation(n,l,c[l]);s.linkProgram(n)}s.deleteShader(t),s.deleteShader(i);const o={};for(const c in e.uniformData){const l=e.uniformData[c];o[c]={location:s.getUniformLocation(n,c),value:gb(l.type,l.size)}}return new WC(n,o)}function ZC(s,e,t,i,n){t.buffer.update(n)}const JC={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];
|
||
}
|
||
`},Nb={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 QC(s){const e=s.map(r=>({data:r,offset:0,dataLen:0,dirty:0}));let t=0,i=0,n=0;for(let r=0;r<e.length;r++){const o=e[r];if(t=Nb[o.data.type],o.data.size>1&&(t=Math.max(t,16)*o.data.size),o.dataLen=t,i%t!==0&&i<16){const a=i%t%16;i+=a,n+=a}i+t>16?(n=Math.ceil(n/16)*16,o.offset=n,n+=t,i=t):(o.offset=n,i+=t,n+=t)}return n=Math.ceil(n/16)*16,{uboElements:e,size:n}}function eE(s,e){const t=[];for(const i in s)e[i]&&t.push(e[i]);return t.sort((i,n)=>i.index-n.index),t}function tE(s,e){if(!s.autoManage)return{size:0,syncFunc:ZC};const t=eE(s.uniforms,e),{uboElements:i,size:n}=QC(t),r=[`
|
||
var v = null;
|
||
var v2 = null;
|
||
var cv = null;
|
||
var t = 0;
|
||
var gl = renderer.gl
|
||
var index = 0;
|
||
var data = buffer.data;
|
||
`];for(let o=0;o<i.length;o++){const a=i[o],c=s.uniforms[a.data.name],l=a.data.name;let h=!1;for(let u=0;u<Qo.length;u++){const d=Qo[u];if(d.codeUbo&&d.test(a.data,c)){r.push(`offset = ${a.offset/4};`,Qo[u].codeUbo(a.data.name,c)),h=!0;break}}if(!h)if(a.data.size>1){const u=yb(a.data.type),d=Math.max(Nb[a.data.type]/16,1),f=u/d,m=(4-f%4)%4;r.push(`
|
||
cv = ud.${l}.value;
|
||
v = uv.${l};
|
||
offset = ${a.offset/4};
|
||
|
||
t = 0;
|
||
|
||
for(var i=0; i < ${a.data.size*d}; i++)
|
||
{
|
||
for(var j = 0; j < ${f}; j++)
|
||
{
|
||
data[offset++] = v[t++];
|
||
}
|
||
offset += ${m};
|
||
}
|
||
|
||
`)}else{const u=JC[a.data.type];r.push(`
|
||
cv = ud.${l}.value;
|
||
v = uv.${l};
|
||
offset = ${a.offset/4};
|
||
${u};
|
||
`)}}return r.push(`
|
||
renderer.buffer.update(buffer);
|
||
`),{size:n,syncFunc:new Function("ud","uv","renderer","syncData","buffer",r.join(`
|
||
`))}}let iE=0;const sc={textureCount:0,uboCount:0};class Db{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(!AC())throw new Error("Current environment does not allow unsafe-eval, please use @pixi/unsafe-eval module to enable support.")}contextChange(e){this.gl=e,this.reset()}bind(e,t){e.disposeRunner.add(this),e.uniforms.globals=this.renderer.globalUniforms;const i=e.program,n=i.glPrograms[this.renderer.CONTEXT_UID]||this.generateProgram(e);return this.shader=e,this.program!==i&&(this.program=i,this.gl.useProgram(n.program)),t||(sc.textureCount=0,sc.uboCount=0,this.syncUniformGroup(e.uniformGroup,sc)),n}setUniforms(e){const t=this.shader.program,i=t.glPrograms[this.renderer.CONTEXT_UID];t.syncUniforms(i.uniformData,e,this.renderer)}syncUniformGroup(e,t){const i=this.getGlProgram();(!e.static||e.dirtyId!==i.uniformDirtyGroups[e.id])&&(i.uniformDirtyGroups[e.id]=e.dirtyId,this.syncUniforms(e,i,t))}syncUniforms(e,t,i){(e.syncUniforms[this.shader.program.id]||this.createSyncGroups(e))(t.uniformData,e.uniforms,this.renderer,i)}createSyncGroups(e){const t=this.getSignature(e,this.shader.program.uniformData,"u");return this.cache[t]||(this.cache[t]=MC(e,this.shader.program.uniformData)),e.syncUniforms[this.shader.program.id]=this.cache[t],e.syncUniforms[this.shader.program.id]}syncUniformBufferGroup(e,t){const i=this.getGlProgram();if(!e.static||e.dirtyId!==0||!i.uniformGroups[e.id]){e.dirtyId=0;const n=i.uniformGroups[e.id]||this.createSyncBufferGroup(e,i,t);e.buffer.update(),n(i.uniformData,e.uniforms,this.renderer,sc,e.buffer)}this.renderer.buffer.bindBufferBase(e.buffer,i.uniformBufferBindings[t])}createSyncBufferGroup(e,t,i){const{gl:n}=this.renderer;this.renderer.buffer.bind(e.buffer);const r=this.gl.getUniformBlockIndex(t.program,i);t.uniformBufferBindings[i]=this.shader.uniformBindCount,n.uniformBlockBinding(t.program,r,this.shader.uniformBindCount),this.shader.uniformBindCount++;const o=this.getSignature(e,this.shader.program.uniformData,"ubo");let a=this._uboCache[o];if(a||(a=this._uboCache[o]=tE(e,this.shader.program.uniformData)),e.autoManage){const c=new Float32Array(a.size/4);e.buffer.update(c)}return t.uniformGroups[e.id]=a.syncFunc,t.uniformGroups[e.id]}getSignature(e,t,i){const n=e.uniforms,r=[`${i}-`];for(const o in n)r.push(o),t[o]&&r.push(t[o].type);return r.join("-")}getGlProgram(){return this.shader?this.shader.program.glPrograms[this.renderer.CONTEXT_UID]:null}generateProgram(e){const t=this.gl,i=e.program,n=KC(t,i);return i.glPrograms[this.renderer.CONTEXT_UID]=n,n}reset(){this.program=null,this.shader=null}disposeShader(e){this.shader===e&&(this.shader=null)}destroy(){this.renderer=null,this.destroyed=!0}}Db.extension={type:ke.RendererSystem,name:"shader"};$e.add(Db);class ah{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(){}}ah.defaultOptions={hello:!1},ah.extension={type:[ke.RendererSystem,ke.CanvasRendererSystem],name:"startup"};$e.add(ah);function sE(s,e=[]){return e[We.NORMAL]=[s.ONE,s.ONE_MINUS_SRC_ALPHA],e[We.ADD]=[s.ONE,s.ONE],e[We.MULTIPLY]=[s.DST_COLOR,s.ONE_MINUS_SRC_ALPHA,s.ONE,s.ONE_MINUS_SRC_ALPHA],e[We.SCREEN]=[s.ONE,s.ONE_MINUS_SRC_COLOR,s.ONE,s.ONE_MINUS_SRC_ALPHA],e[We.OVERLAY]=[s.ONE,s.ONE_MINUS_SRC_ALPHA],e[We.DARKEN]=[s.ONE,s.ONE_MINUS_SRC_ALPHA],e[We.LIGHTEN]=[s.ONE,s.ONE_MINUS_SRC_ALPHA],e[We.COLOR_DODGE]=[s.ONE,s.ONE_MINUS_SRC_ALPHA],e[We.COLOR_BURN]=[s.ONE,s.ONE_MINUS_SRC_ALPHA],e[We.HARD_LIGHT]=[s.ONE,s.ONE_MINUS_SRC_ALPHA],e[We.SOFT_LIGHT]=[s.ONE,s.ONE_MINUS_SRC_ALPHA],e[We.DIFFERENCE]=[s.ONE,s.ONE_MINUS_SRC_ALPHA],e[We.EXCLUSION]=[s.ONE,s.ONE_MINUS_SRC_ALPHA],e[We.HUE]=[s.ONE,s.ONE_MINUS_SRC_ALPHA],e[We.SATURATION]=[s.ONE,s.ONE_MINUS_SRC_ALPHA],e[We.COLOR]=[s.ONE,s.ONE_MINUS_SRC_ALPHA],e[We.LUMINOSITY]=[s.ONE,s.ONE_MINUS_SRC_ALPHA],e[We.NONE]=[0,0],e[We.NORMAL_NPM]=[s.SRC_ALPHA,s.ONE_MINUS_SRC_ALPHA,s.ONE,s.ONE_MINUS_SRC_ALPHA],e[We.ADD_NPM]=[s.SRC_ALPHA,s.ONE,s.ONE,s.ONE],e[We.SCREEN_NPM]=[s.SRC_ALPHA,s.ONE_MINUS_SRC_COLOR,s.ONE,s.ONE_MINUS_SRC_ALPHA],e[We.SRC_IN]=[s.DST_ALPHA,s.ZERO],e[We.SRC_OUT]=[s.ONE_MINUS_DST_ALPHA,s.ZERO],e[We.SRC_ATOP]=[s.DST_ALPHA,s.ONE_MINUS_SRC_ALPHA],e[We.DST_OVER]=[s.ONE_MINUS_DST_ALPHA,s.ONE],e[We.DST_IN]=[s.ZERO,s.SRC_ALPHA],e[We.DST_OUT]=[s.ZERO,s.ONE_MINUS_SRC_ALPHA],e[We.DST_ATOP]=[s.ONE_MINUS_DST_ALPHA,s.SRC_ALPHA],e[We.XOR]=[s.ONE_MINUS_DST_ALPHA,s.ONE_MINUS_SRC_ALPHA],e[We.SUBTRACT]=[s.ONE,s.ONE,s.ONE,s.ONE,s.FUNC_REVERSE_SUBTRACT,s.FUNC_ADD],e}const nE=0,rE=1,oE=2,aE=3,lE=4,cE=5,Ub=class Zf{constructor(){this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode=We.NONE,this._blendEq=!1,this.map=[],this.map[nE]=this.setBlend,this.map[rE]=this.setOffset,this.map[oE]=this.setCullFace,this.map[aE]=this.setDepthTest,this.map[lE]=this.setFrontFace,this.map[cE]=this.setDepthMask,this.checks=[],this.defaultState=new mn,this.defaultState.blend=!0}contextChange(e){this.gl=e,this.blendModes=sE(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(Zf.checkBlendMode,e),this.gl[e?"enable":"disable"](this.gl.BLEND)}setOffset(e){this.updateCheck(Zf.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}};Ub.extension={type:ke.RendererSystem,name:"state"};let hE=Ub;$e.add(hE);class uE extends Rl{constructor(){super(...arguments),this.runners={},this._systemsHash={}}setup(e){this.addRunners(...e.runners);const t=(e.priority??[]).filter(n=>e.systems[n]),i=[...t,...Object.keys(e.systems).filter(n=>!t.includes(n))];for(const n of i)this.addSystem(e.systems[n],n)}addRunners(...e){e.forEach(t=>{this.runners[t]=new Ls(t)})}addSystem(e,t){const i=new e(this);if(this[t])throw new Error(`Whoops! The name "${t}" is already in use`);this[t]=i,this._systemsHash[t]=i;for(const n in this.runners)this.runners[n].add(i);return this}emitWithCustomOptions(e,t){const i=Object.keys(this._systemsHash);e.items.forEach(n=>{const r=i.find(o=>this._systemsHash[o]===n);n[e.name](t[r])})}destroy(){Object.values(this.runners).forEach(e=>{e.destroy()}),this._systemsHash={}}}const Ya=class kc{constructor(e){this.renderer=e,this.count=0,this.checkCount=0,this.maxIdle=kc.defaultMaxIdle,this.checkCountMax=kc.defaultCheckCountMax,this.mode=kc.defaultMode}postrender(){this.renderer.objectRenderer.renderingToScreen&&(this.count++,this.mode!==up.MANUAL&&(this.checkCount++,this.checkCount>this.checkCountMax&&(this.checkCount=0,this.run())))}run(){const e=this.renderer.texture,t=e.managedTextures;let i=!1;for(let n=0;n<t.length;n++){const r=t[n];r.resource&&this.count-r.touched>this.maxIdle&&(e.destroyTexture(r,!0),t[n]=null,i=!0)}if(i){let n=0;for(let r=0;r<t.length;r++)t[r]!==null&&(t[n++]=t[r]);t.length=n}}unload(e){const t=this.renderer.texture,i=e._texture;i&&!i.framebuffer&&t.destroyTexture(i);for(let n=e.children.length-1;n>=0;n--)this.unload(e.children[n])}destroy(){this.renderer=null}};Ya.defaultMode=up.AUTO,Ya.defaultMaxIdle=3600,Ya.defaultCheckCountMax=600,Ya.extension={type:ke.RendererSystem,name:"textureGC"};let Hr=Ya;$e.add(Hr);class Wd{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=Ue.UNSIGNED_BYTE,this.internalFormat=Te.RGBA,this.samplerType=0}}function dE(s){let e;return"WebGL2RenderingContext"in globalThis&&s instanceof globalThis.WebGL2RenderingContext?e={[s.RGB]:De.FLOAT,[s.RGBA]:De.FLOAT,[s.ALPHA]:De.FLOAT,[s.LUMINANCE]:De.FLOAT,[s.LUMINANCE_ALPHA]:De.FLOAT,[s.R8]:De.FLOAT,[s.R8_SNORM]:De.FLOAT,[s.RG8]:De.FLOAT,[s.RG8_SNORM]:De.FLOAT,[s.RGB8]:De.FLOAT,[s.RGB8_SNORM]:De.FLOAT,[s.RGB565]:De.FLOAT,[s.RGBA4]:De.FLOAT,[s.RGB5_A1]:De.FLOAT,[s.RGBA8]:De.FLOAT,[s.RGBA8_SNORM]:De.FLOAT,[s.RGB10_A2]:De.FLOAT,[s.RGB10_A2UI]:De.FLOAT,[s.SRGB8]:De.FLOAT,[s.SRGB8_ALPHA8]:De.FLOAT,[s.R16F]:De.FLOAT,[s.RG16F]:De.FLOAT,[s.RGB16F]:De.FLOAT,[s.RGBA16F]:De.FLOAT,[s.R32F]:De.FLOAT,[s.RG32F]:De.FLOAT,[s.RGB32F]:De.FLOAT,[s.RGBA32F]:De.FLOAT,[s.R11F_G11F_B10F]:De.FLOAT,[s.RGB9_E5]:De.FLOAT,[s.R8I]:De.INT,[s.R8UI]:De.UINT,[s.R16I]:De.INT,[s.R16UI]:De.UINT,[s.R32I]:De.INT,[s.R32UI]:De.UINT,[s.RG8I]:De.INT,[s.RG8UI]:De.UINT,[s.RG16I]:De.INT,[s.RG16UI]:De.UINT,[s.RG32I]:De.INT,[s.RG32UI]:De.UINT,[s.RGB8I]:De.INT,[s.RGB8UI]:De.UINT,[s.RGB16I]:De.INT,[s.RGB16UI]:De.UINT,[s.RGB32I]:De.INT,[s.RGB32UI]:De.UINT,[s.RGBA8I]:De.INT,[s.RGBA8UI]:De.UINT,[s.RGBA16I]:De.INT,[s.RGBA16UI]:De.UINT,[s.RGBA32I]:De.INT,[s.RGBA32UI]:De.UINT,[s.DEPTH_COMPONENT16]:De.FLOAT,[s.DEPTH_COMPONENT24]:De.FLOAT,[s.DEPTH_COMPONENT32F]:De.FLOAT,[s.DEPTH_STENCIL]:De.FLOAT,[s.DEPTH24_STENCIL8]:De.FLOAT,[s.DEPTH32F_STENCIL8]:De.FLOAT}:e={[s.RGB]:De.FLOAT,[s.RGBA]:De.FLOAT,[s.ALPHA]:De.FLOAT,[s.LUMINANCE]:De.FLOAT,[s.LUMINANCE_ALPHA]:De.FLOAT,[s.DEPTH_STENCIL]:De.FLOAT},e}function fE(s){let e;return"WebGL2RenderingContext"in globalThis&&s instanceof globalThis.WebGL2RenderingContext?e={[Ue.UNSIGNED_BYTE]:{[Te.RGBA]:s.RGBA8,[Te.RGB]:s.RGB8,[Te.RG]:s.RG8,[Te.RED]:s.R8,[Te.RGBA_INTEGER]:s.RGBA8UI,[Te.RGB_INTEGER]:s.RGB8UI,[Te.RG_INTEGER]:s.RG8UI,[Te.RED_INTEGER]:s.R8UI,[Te.ALPHA]:s.ALPHA,[Te.LUMINANCE]:s.LUMINANCE,[Te.LUMINANCE_ALPHA]:s.LUMINANCE_ALPHA},[Ue.BYTE]:{[Te.RGBA]:s.RGBA8_SNORM,[Te.RGB]:s.RGB8_SNORM,[Te.RG]:s.RG8_SNORM,[Te.RED]:s.R8_SNORM,[Te.RGBA_INTEGER]:s.RGBA8I,[Te.RGB_INTEGER]:s.RGB8I,[Te.RG_INTEGER]:s.RG8I,[Te.RED_INTEGER]:s.R8I},[Ue.UNSIGNED_SHORT]:{[Te.RGBA_INTEGER]:s.RGBA16UI,[Te.RGB_INTEGER]:s.RGB16UI,[Te.RG_INTEGER]:s.RG16UI,[Te.RED_INTEGER]:s.R16UI,[Te.DEPTH_COMPONENT]:s.DEPTH_COMPONENT16},[Ue.SHORT]:{[Te.RGBA_INTEGER]:s.RGBA16I,[Te.RGB_INTEGER]:s.RGB16I,[Te.RG_INTEGER]:s.RG16I,[Te.RED_INTEGER]:s.R16I},[Ue.UNSIGNED_INT]:{[Te.RGBA_INTEGER]:s.RGBA32UI,[Te.RGB_INTEGER]:s.RGB32UI,[Te.RG_INTEGER]:s.RG32UI,[Te.RED_INTEGER]:s.R32UI,[Te.DEPTH_COMPONENT]:s.DEPTH_COMPONENT24},[Ue.INT]:{[Te.RGBA_INTEGER]:s.RGBA32I,[Te.RGB_INTEGER]:s.RGB32I,[Te.RG_INTEGER]:s.RG32I,[Te.RED_INTEGER]:s.R32I},[Ue.FLOAT]:{[Te.RGBA]:s.RGBA32F,[Te.RGB]:s.RGB32F,[Te.RG]:s.RG32F,[Te.RED]:s.R32F,[Te.DEPTH_COMPONENT]:s.DEPTH_COMPONENT32F},[Ue.HALF_FLOAT]:{[Te.RGBA]:s.RGBA16F,[Te.RGB]:s.RGB16F,[Te.RG]:s.RG16F,[Te.RED]:s.R16F},[Ue.UNSIGNED_SHORT_5_6_5]:{[Te.RGB]:s.RGB565},[Ue.UNSIGNED_SHORT_4_4_4_4]:{[Te.RGBA]:s.RGBA4},[Ue.UNSIGNED_SHORT_5_5_5_1]:{[Te.RGBA]:s.RGB5_A1},[Ue.UNSIGNED_INT_2_10_10_10_REV]:{[Te.RGBA]:s.RGB10_A2,[Te.RGBA_INTEGER]:s.RGB10_A2UI},[Ue.UNSIGNED_INT_10F_11F_11F_REV]:{[Te.RGB]:s.R11F_G11F_B10F},[Ue.UNSIGNED_INT_5_9_9_9_REV]:{[Te.RGB]:s.RGB9_E5},[Ue.UNSIGNED_INT_24_8]:{[Te.DEPTH_STENCIL]:s.DEPTH24_STENCIL8},[Ue.FLOAT_32_UNSIGNED_INT_24_8_REV]:{[Te.DEPTH_STENCIL]:s.DEPTH32F_STENCIL8}}:e={[Ue.UNSIGNED_BYTE]:{[Te.RGBA]:s.RGBA,[Te.RGB]:s.RGB,[Te.ALPHA]:s.ALPHA,[Te.LUMINANCE]:s.LUMINANCE,[Te.LUMINANCE_ALPHA]:s.LUMINANCE_ALPHA},[Ue.UNSIGNED_SHORT_5_6_5]:{[Te.RGB]:s.RGB},[Ue.UNSIGNED_SHORT_4_4_4_4]:{[Te.RGBA]:s.RGBA},[Ue.UNSIGNED_SHORT_5_5_5_1]:{[Te.RGBA]:s.RGBA}},e}class $b{constructor(e){this.renderer=e,this.boundTextures=[],this.currentLocation=-1,this.managedTextures=[],this._unknownBoundTextures=!1,this.unknownTexture=new it,this.hasIntegerTextures=!1}contextChange(){const e=this.gl=this.renderer.gl;this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.webGLVersion=this.renderer.context.webGLVersion,this.internalFormats=fE(e),this.samplerTypes=dE(e);const t=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS);this.boundTextures.length=t;for(let n=0;n<t;n++)this.boundTextures[n]=null;this.emptyTextures={};const i=new Wd(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 Wd(e.createTexture()),e.bindTexture(e.TEXTURE_CUBE_MAP,this.emptyTextures[e.TEXTURE_CUBE_MAP].texture);for(let n=0;n<6;n++)e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+n,0,e.RGBA,1,1,0,e.RGBA,e.UNSIGNED_BYTE,null);e.texParameteri(e.TEXTURE_CUBE_MAP,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_CUBE_MAP,e.TEXTURE_MIN_FILTER,e.LINEAR);for(let n=0;n<this.boundTextures.length;n++)this.bind(null,n)}bind(e,t=0){const{gl:i}=this;if(e=e==null?void 0:e.castToBaseTexture(),(e==null?void 0:e.valid)&&!e.parentTextureArray){e.touched=this.renderer.textureGC.count;const n=e._glTextures[this.CONTEXT_UID]||this.initTexture(e);this.boundTextures[t]!==e&&(this.currentLocation!==t&&(this.currentLocation=t,i.activeTexture(i.TEXTURE0+t)),i.bindTexture(e.target,n.texture)),n.dirtyId!==e.dirtyId?(this.currentLocation!==t&&(this.currentLocation=t,i.activeTexture(i.TEXTURE0+t)),this.updateTexture(e)):n.dirtyStyleId!==e.dirtyStyleId&&this.updateTextureStyle(e),this.boundTextures[t]=e}else this.currentLocation!==t&&(this.currentLocation=t,i.activeTexture(i.TEXTURE0+t)),i.bindTexture(i.TEXTURE_2D,this.emptyTextures[i.TEXTURE_2D].texture),this.boundTextures[t]=null}reset(){this._unknownBoundTextures=!0,this.hasIntegerTextures=!1,this.currentLocation=-1;for(let e=0;e<this.boundTextures.length;e++)this.boundTextures[e]=this.unknownTexture}unbind(e){const{gl:t,boundTextures:i}=this;if(this._unknownBoundTextures){this._unknownBoundTextures=!1;for(let n=0;n<i.length;n++)i[n]===this.unknownTexture&&this.bind(null,n)}for(let n=0;n<i.length;n++)i[n]===e&&(this.currentLocation!==n&&(t.activeTexture(t.TEXTURE0+n),this.currentLocation=n),t.bindTexture(e.target,this.emptyTextures[e.target].texture),i[n]=null)}ensureSamplerType(e){const{boundTextures:t,hasIntegerTextures:i,CONTEXT_UID:n}=this;if(i)for(let r=e-1;r>=0;--r){const o=t[r];o&&o._glTextures[n].samplerType!==De.FLOAT&&this.renderer.texture.unbind(o)}}initTexture(e){const t=new Wd(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]??De.FLOAT,this.webGLVersion===2&&e.type===Ue.HALF_FLOAT?t.type=this.gl.HALF_FLOAT:t.type=e.type}updateTexture(e){var n;const t=e._glTextures[this.CONTEXT_UID];if(!t)return;const i=this.renderer;if(this.initTextureType(e,t),(n=e.resource)==null?void 0:n.upload(i,e,t))t.samplerType!==De.FLOAT&&(this.hasIntegerTextures=!0);else{const r=e.realWidth,o=e.realHeight,a=i.gl;(t.width!==r||t.height!==o||t.dirtyId<0)&&(t.width=r,t.height=o,a.texImage2D(e.target,0,t.internalFormat,r,o,0,e.format,t.type,null))}e.dirtyStyleId!==t.dirtyStyleId&&this.updateTextureStyle(e),t.dirtyId=e.dirtyId}destroyTexture(e,t){const{gl:i}=this;if(e=e.castToBaseTexture(),e._glTextures[this.CONTEXT_UID]&&(this.unbind(e),i.deleteTexture(e._glTextures[this.CONTEXT_UID].texture),e.off("dispose",this.destroyTexture,this),delete e._glTextures[this.CONTEXT_UID],!t)){const n=this.managedTextures.indexOf(e);n!==-1&&Jo(this.managedTextures,n,1)}}updateTextureStyle(e){var i;const t=e._glTextures[this.CONTEXT_UID];t&&((e.mipmap===vs.POW2||this.webGLVersion!==2)&&!e.isPowerOfTwo?t.mipmap=!1:t.mipmap=e.mipmap>=1,this.webGLVersion!==2&&!e.isPowerOfTwo?t.wrapMode=Os.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!==vs.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===Rs.LINEAR?i.LINEAR_MIPMAP_LINEAR:i.NEAREST_MIPMAP_NEAREST);const n=this.renderer.context.extensions.anisotropicFiltering;if(n&&e.anisotropicLevel>0&&e.scaleMode===Rs.LINEAR){const r=Math.min(e.anisotropicLevel,i.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT));i.texParameterf(e.target,n.TEXTURE_MAX_ANISOTROPY_EXT,r)}}else i.texParameteri(e.target,i.TEXTURE_MIN_FILTER,e.scaleMode===Rs.LINEAR?i.LINEAR:i.NEAREST);i.texParameteri(e.target,i.TEXTURE_MAG_FILTER,e.scaleMode===Rs.LINEAR?i.LINEAR:i.NEAREST)}destroy(){this.renderer=null}}$b.extension={type:ke.RendererSystem,name:"texture"};$e.add($b);class Xb{constructor(e){this.renderer=e}contextChange(){this.gl=this.renderer.gl,this.CONTEXT_UID=this.renderer.CONTEXT_UID}bind(e){const{gl:t,CONTEXT_UID:i}=this,n=e._glTransformFeedbacks[i]||this.createGLTransformFeedback(e);t.bindTransformFeedback(t.TRANSFORM_FEEDBACK,n)}unbind(){const{gl:e}=this;e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,null)}beginTransformFeedback(e,t){const{gl:i,renderer:n}=this;t&&n.shader.bind(t),i.beginTransformFeedback(e)}endTransformFeedback(){const{gl:e}=this;e.endTransformFeedback()}createGLTransformFeedback(e){const{gl:t,renderer:i,CONTEXT_UID:n}=this,r=t.createTransformFeedback();e._glTransformFeedbacks[n]=r,t.bindTransformFeedback(t.TRANSFORM_FEEDBACK,r);for(let o=0;o<e.buffers.length;o++){const a=e.buffers[o];a&&(i.buffer.update(a),a._glBuffers[n].refCount++,t.bindBufferBase(t.TRANSFORM_FEEDBACK_BUFFER,o,a._glBuffers[n].buffer||null))}return t.bindTransformFeedback(t.TRANSFORM_FEEDBACK,null),e.disposeRunner.add(this),r}disposeTransformFeedback(e,t){const i=e._glTransformFeedbacks[this.CONTEXT_UID],n=this.gl;e.disposeRunner.remove(this);const r=this.renderer.buffer;if(r)for(let o=0;o<e.buffers.length;o++){const a=e.buffers[o];if(!a)continue;const c=a._glBuffers[this.CONTEXT_UID];c&&(c.refCount--,c.refCount===0&&!t&&r.dispose(a,t))}i&&(t||n.deleteTransformFeedback(i),delete e._glTransformFeedbacks[this.CONTEXT_UID])}destroy(){this.renderer=null}}Xb.extension={type:ke.RendererSystem,name:"transformFeedback"};$e.add(Xb);class lh{constructor(e){this.renderer=e}init(e){this.screen=new ct(0,0,e.width,e.height),this.element=e.view||Be.ADAPTER.createCanvas(),this.resolution=e.resolution||Be.RESOLUTION,this.autoDensity=!!e.autoDensity}resizeView(e,t){this.element.width=Math.round(e*this.resolution),this.element.height=Math.round(t*this.resolution);const i=this.element.width/this.resolution,n=this.element.height/this.resolution;this.screen.width=i,this.screen.height=n,this.autoDensity&&(this.element.style.width=`${i}px`,this.element.style.height=`${n}px`),this.renderer.emit("resize",i,n),this.renderer.runners.resize.emit(this.screen.width,this.screen.height)}destroy(e){var t;e&&((t=this.element.parentNode)==null||t.removeChild(this.element)),this.renderer=null,this.element=null,this.screen=null}}lh.defaultOptions={width:800,height:600,resolution:void 0,autoDensity:!1},lh.extension={type:[ke.RendererSystem,ke.CanvasRendererSystem],name:"_view"};$e.add(lh);Be.PREFER_ENV=go.WEBGL2;Be.STRICT_TEXTURE_CACHE=!1;Be.RENDER_OPTIONS={...oh.defaultOptions,...rh.defaultOptions,...lh.defaultOptions,...ah.defaultOptions};Object.defineProperties(Be,{WRAP_MODE:{get(){return it.defaultOptions.wrapMode},set(s){mt("7.1.0","settings.WRAP_MODE is deprecated, use BaseTexture.defaultOptions.wrapMode"),it.defaultOptions.wrapMode=s}},SCALE_MODE:{get(){return it.defaultOptions.scaleMode},set(s){mt("7.1.0","settings.SCALE_MODE is deprecated, use BaseTexture.defaultOptions.scaleMode"),it.defaultOptions.scaleMode=s}},MIPMAP_TEXTURES:{get(){return it.defaultOptions.mipmap},set(s){mt("7.1.0","settings.MIPMAP_TEXTURES is deprecated, use BaseTexture.defaultOptions.mipmap"),it.defaultOptions.mipmap=s}},ANISOTROPIC_LEVEL:{get(){return it.defaultOptions.anisotropicLevel},set(s){mt("7.1.0","settings.ANISOTROPIC_LEVEL is deprecated, use BaseTexture.defaultOptions.anisotropicLevel"),it.defaultOptions.anisotropicLevel=s}},FILTER_RESOLUTION:{get(){return mt("7.1.0","settings.FILTER_RESOLUTION is deprecated, use Filter.defaultResolution"),Vi.defaultResolution},set(s){Vi.defaultResolution=s}},FILTER_MULTISAMPLE:{get(){return mt("7.1.0","settings.FILTER_MULTISAMPLE is deprecated, use Filter.defaultMultisample"),Vi.defaultMultisample},set(s){Vi.defaultMultisample=s}},SPRITE_MAX_TEXTURES:{get(){return cr.defaultMaxTextures},set(s){mt("7.1.0","settings.SPRITE_MAX_TEXTURES is deprecated, use BatchRenderer.defaultMaxTextures"),cr.defaultMaxTextures=s}},SPRITE_BATCH_SIZE:{get(){return cr.defaultBatchSize},set(s){mt("7.1.0","settings.SPRITE_BATCH_SIZE is deprecated, use BatchRenderer.defaultBatchSize"),cr.defaultBatchSize=s}},CAN_UPLOAD_SAME_BUFFER:{get(){return cr.canUploadSameBuffer},set(s){mt("7.1.0","settings.CAN_UPLOAD_SAME_BUFFER is deprecated, use BatchRenderer.canUploadSameBuffer"),cr.canUploadSameBuffer=s}},GC_MODE:{get(){return Hr.defaultMode},set(s){mt("7.1.0","settings.GC_MODE is deprecated, use TextureGCSystem.defaultMode"),Hr.defaultMode=s}},GC_MAX_IDLE:{get(){return Hr.defaultMaxIdle},set(s){mt("7.1.0","settings.GC_MAX_IDLE is deprecated, use TextureGCSystem.defaultMaxIdle"),Hr.defaultMaxIdle=s}},GC_MAX_CHECK_COUNT:{get(){return Hr.defaultCheckCountMax},set(s){mt("7.1.0","settings.GC_MAX_CHECK_COUNT is deprecated, use TextureGCSystem.defaultCheckCountMax"),Hr.defaultCheckCountMax=s}},PRECISION_VERTEX:{get(){return an.defaultVertexPrecision},set(s){mt("7.1.0","settings.PRECISION_VERTEX is deprecated, use Program.defaultVertexPrecision"),an.defaultVertexPrecision=s}},PRECISION_FRAGMENT:{get(){return an.defaultFragmentPrecision},set(s){mt("7.1.0","settings.PRECISION_FRAGMENT is deprecated, use Program.defaultFragmentPrecision"),an.defaultFragmentPrecision=s}}});var uo=(s=>(s[s.INTERACTION=50]="INTERACTION",s[s.HIGH=25]="HIGH",s[s.NORMAL=0]="NORMAL",s[s.LOW=-25]="LOW",s[s.UTILITY=-50]="UTILITY",s))(uo||{});class zd{constructor(e,t=null,i=0,n=!1){this.next=null,this.previous=null,this._destroyed=!1,this.fn=e,this.context=t,this.priority=i,this.once=n}match(e,t=null){return this.fn===e&&this.context===t}emit(e){this.fn&&(this.context?this.fn.call(this.context,e):this.fn(e));const t=this.next;return this.once&&this.destroy(!0),this._destroyed&&(this.next=null),t}connect(e){this.previous=e,e.next&&(e.next.previous=this),this.next=e.next,e.next=this}destroy(e=!1){this._destroyed=!0,this.fn=null,this.context=null,this.previous&&(this.previous.next=this.next),this.next&&(this.next.previous=this.previous);const t=this.next;return this.next=e?null:t,this.previous=null,t}}const Vb=class es{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 zd(null,null,1/0),this.deltaMS=1/es.targetFPMS,this.elapsedMS=1/es.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=uo.NORMAL){return this._addListener(new zd(e,t,i))}addOnce(e,t,i=uo.NORMAL){return this._addListener(new zd(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*es.targetFPMS;const i=this._head;let n=i.next;for(;n;)n=n.emit(this.deltaTime);i.next||this._cancelIfNeeded()}else this.deltaTime=this.deltaMS=this.elapsedMS=0;this.lastTime=e}get FPS(){return 1e3/this.elapsedMS}get minFPS(){return 1e3/this._maxElapsedMS}set minFPS(e){const t=Math.min(this.maxFPS,e),i=Math.min(Math.max(0,t)/1e3,es.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(!es._shared){const e=es._shared=new es;e.autoStart=!0,e._protected=!0}return es._shared}static get system(){if(!es._system){const e=es._system=new es;e.autoStart=!0,e._protected=!0}return es._system}};Vb.targetFPMS=.06;let Yi=Vb;Object.defineProperties(Be,{TARGET_FPMS:{get(){return Yi.targetFPMS},set(s){mt("7.1.0","settings.TARGET_FPMS is deprecated, use Ticker.targetFPMS"),Yi.targetFPMS=s}}});class Yb{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,uo.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=e.sharedTicker?Yi.shared:new Yi,e.autoStart&&this.start()}static destroy(){if(this._ticker){const e=this._ticker;this.ticker=null,e.destroy()}}}Yb.extension=ke.Application;$e.add(Yb);const Gb=[];$e.handleByList(ke.Renderer,Gb);function mE(s){for(const e of Gb)if(e.test(s))return new e(s);throw new Error("Unable to auto-detect a suitable renderer.")}var pE=`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;
|
||
}`,gE=`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 vE=pE,jb=gE;class Hb{constructor(e){this.renderer=e}contextChange(e){let t;if(this.renderer.context.webGLVersion===1){const i=e.getParameter(e.FRAMEBUFFER_BINDING);e.bindFramebuffer(e.FRAMEBUFFER,null),t=e.getParameter(e.SAMPLES),e.bindFramebuffer(e.FRAMEBUFFER,i)}else{const i=e.getParameter(e.DRAW_FRAMEBUFFER_BINDING);e.bindFramebuffer(e.DRAW_FRAMEBUFFER,null),t=e.getParameter(e.SAMPLES),e.bindFramebuffer(e.DRAW_FRAMEBUFFER,i)}t>=ci.HIGH?this.multisample=ci.HIGH:t>=ci.MEDIUM?this.multisample=ci.MEDIUM:t>=ci.LOW?this.multisample=ci.LOW:this.multisample=ci.NONE}destroy(){}}Hb.extension={type:ke.RendererSystem,name:"_multisample"};$e.add(Hb);class yE{constructor(e){this.buffer=e||null,this.updateID=-1,this.byteLength=-1,this.refCount=0}}class Wb{constructor(e){this.renderer=e,this.managedBuffers={},this.boundBufferBases={}}destroy(){this.renderer=null}contextChange(){this.disposeAll(!0),this.gl=this.renderer.gl,this.CONTEXT_UID=this.renderer.CONTEXT_UID}bind(e){const{gl:t,CONTEXT_UID:i}=this,n=e._glBuffers[i]||this.createGLBuffer(e);t.bindBuffer(e.type,n.buffer)}unbind(e){const{gl:t}=this;t.bindBuffer(e,null)}bindBufferBase(e,t){const{gl:i,CONTEXT_UID:n}=this;if(this.boundBufferBases[t]!==e){const r=e._glBuffers[n]||this.createGLBuffer(e);this.boundBufferBases[t]=e,i.bindBufferBase(i.UNIFORM_BUFFER,t,r.buffer)}}bindBufferRange(e,t,i){const{gl:n,CONTEXT_UID:r}=this;i=i||0;const o=e._glBuffers[r]||this.createGLBuffer(e);n.bindBufferRange(n.UNIFORM_BUFFER,t||0,o.buffer,i*256,256)}update(e){const{gl:t,CONTEXT_UID:i}=this,n=e._glBuffers[i]||this.createGLBuffer(e);if(e._updateID!==n.updateID)if(n.updateID=e._updateID,t.bindBuffer(e.type,n.buffer),n.byteLength>=e.data.byteLength)t.bufferSubData(e.type,0,e.data);else{const r=e.static?t.STATIC_DRAW:t.DYNAMIC_DRAW;n.byteLength=e.data.byteLength,t.bufferData(e.type,e.data,r)}}dispose(e,t){if(!this.managedBuffers[e.id])return;delete this.managedBuffers[e.id];const i=e._glBuffers[this.CONTEXT_UID],n=this.gl;e.disposeRunner.remove(this),i&&(t||n.deleteBuffer(i.buffer),delete e._glBuffers[this.CONTEXT_UID])}disposeAll(e){const t=Object.keys(this.managedBuffers);for(let i=0;i<t.length;i++)this.dispose(this.managedBuffers[t[i]],e)}createGLBuffer(e){const{CONTEXT_UID:t,gl:i}=this;return e._glBuffers[t]=new yE(i.createBuffer()),this.managedBuffers[e.id]=e,e.disposeRunner.add(this),e._glBuffers[t]}}Wb.extension={type:ke.RendererSystem,name:"buffer"};$e.add(Wb);class zb{constructor(e){this.renderer=e}render(e,t){const i=this.renderer;let n,r,o,a;if(t&&(n=t.renderTexture,r=t.clear,o=t.transform,a=t.skipUpdateTransform),this.renderingToScreen=!n,i.runners.prerender.emit(),i.emit("prerender"),i.projection.transform=o,!i.context.isLost){if(n||(this.lastObjectRendered=e),!a){const c=e.enableTempParent();e.updateTransform(),e.disableTempParent(c)}i.renderTexture.bind(n),i.batch.currentRenderer.start(),(r??i.background.clearBeforeRender)&&i.renderTexture.clear(),e.render(i),i.batch.currentRenderer.flush(),n&&(t.blit&&i.framebuffer.blit(),n.baseTexture.update()),i.runners.postrender.emit(),i.projection.transform=null,i.emit("postrender")}}destroy(){this.renderer=null,this.lastObjectRendered=null}}zb.extension={type:ke.RendererSystem,name:"objectRenderer"};$e.add(zb);const Fc=class Jf extends uE{constructor(e){super(),this.type=zx.WEBGL,e=Object.assign({},Be.RENDER_OPTIONS,e),this.gl=null,this.CONTEXT_UID=0,this.globalUniforms=new Bs({projectionMatrix:new Ft},!0);const t={runners:["init","destroy","contextChange","resolutionChange","reset","update","postrender","prerender","resize"],systems:Jf.__systems,priority:["_view","textureGenerator","background","_plugin","startup","context","state","texture","buffer","geometry","framebuffer","transformFeedback","mask","scissor","stencil","projection","textureGC","filter","renderTexture","batch","objectRenderer","_multisample"]};this.setup(t),"useContextAlpha"in e&&(mt("7.0.0","options.useContextAlpha is deprecated, use options.premultipliedAlpha and options.backgroundAlpha instead"),e.premultipliedAlpha=e.useContextAlpha&&e.useContextAlpha!=="notMultiplied",e.backgroundAlpha=e.useContextAlpha===!1?1:e.backgroundAlpha),this._plugin.rendererPlugins=Jf.__plugins,this.options=e,this.startup.run(this.options)}static test(e){return e!=null&&e.forceCanvas?!1:V_()}render(e,t){this.objectRenderer.render(e,t)}resize(e,t){this._view.resizeView(e,t)}reset(){return this.runners.reset.emit(),this}clear(){this.renderTexture.bind(),this.renderTexture.clear()}destroy(e=!1){this.runners.destroy.items.reverse(),this.emitWithCustomOptions(this.runners.destroy,{_view:e}),super.destroy()}get plugins(){return this._plugin.plugins}get multisample(){return this._multisample.multisample}get width(){return this._view.element.width}get height(){return this._view.element.height}get resolution(){return this._view.resolution}set resolution(e){this._view.resolution=e,this.runners.resolutionChange.emit(e)}get autoDensity(){return this._view.autoDensity}get view(){return this._view.element}get screen(){return this._view.screen}get lastObjectRendered(){return this.objectRenderer.lastObjectRendered}get renderingToScreen(){return this.objectRenderer.renderingToScreen}get rendererLogId(){return`WebGL ${this.context.webGLVersion}`}get clearBeforeRender(){return mt("7.0.0","renderer.clearBeforeRender has been deprecated, please use renderer.background.clearBeforeRender instead."),this.background.clearBeforeRender}get useContextAlpha(){return mt("7.0.0","renderer.useContextAlpha has been deprecated, please use renderer.context.premultipliedAlpha instead."),this.context.useContextAlpha}get preserveDrawingBuffer(){return mt("7.0.0","renderer.preserveDrawingBuffer has been deprecated, we cannot truly know this unless pixi created the context"),this.context.preserveDrawingBuffer}get backgroundColor(){return mt("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color}set backgroundColor(e){mt("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color=e}get backgroundAlpha(){return mt("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha}set backgroundAlpha(e){mt("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha=e}get powerPreference(){return mt("7.0.0","renderer.powerPreference has been deprecated, we can only know this if pixi creates the context"),this.context.powerPreference}generateTexture(e,t){return this.textureGenerator.generateTexture(e,t)}};Fc.extension={type:ke.Renderer,priority:1},Fc.__plugins={},Fc.__systems={};let yp=Fc;$e.handleByMap(ke.RendererPlugin,yp.__plugins);$e.handleByMap(ke.RendererSystem,yp.__systems);$e.add(yp);class qb extends yl{constructor(e,t){const{width:i,height:n}=t||{};super(i,n),this.items=[],this.itemDirtyIds=[];for(let r=0;r<e;r++){const o=new it;this.items.push(o),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(fb(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 xE extends qb{constructor(e,t){const{width:i,height:n}=t||{};let r,o;Array.isArray(e)?(r=e,o=e.length):o=e,super(o,{width:i,height:n}),r&&this.initFromArray(r,t)}addBaseTextureAt(e,t){if(e.resource)this.addResourceAt(e.resource,t);else throw new Error("ArrayResource does not support RenderTexture");return this}bind(e){super.bind(e),e.target=Zo.TEXTURE_2D_ARRAY}upload(e,t,i){const{length:n,itemDirtyIds:r,items:o}=this,{gl:a}=e;i.dirtyId<0&&a.texImage3D(a.TEXTURE_2D_ARRAY,0,i.internalFormat,this._width,this._height,n,0,t.format,i.type,null);for(let c=0;c<n;c++){const l=o[c];r[c]<l.dirtyId&&(r[c]=l.dirtyId,l.valid&&a.texSubImage3D(a.TEXTURE_2D_ARRAY,0,0,0,c,l.resource.width,l.resource.height,1,t.format,i.type,l.resource.source))}return!0}}class bE extends Wn{constructor(e){super(e)}static test(e){const{OffscreenCanvas:t}=globalThis;return t&&e instanceof t?!0:globalThis.HTMLCanvasElement&&e instanceof HTMLCanvasElement}}const Kb=class Ga extends qb{constructor(e,t){const{width:i,height:n,autoLoad:r,linkBaseTexture:o}=t||{};if(e&&e.length!==Ga.SIDES)throw new Error(`Invalid length. Got ${e.length}, expected 6`);super(6,{width:i,height:n});for(let a=0;a<Ga.SIDES;a++)this.items[a].target=Zo.TEXTURE_CUBE_MAP_POSITIVE_X+a;this.linkBaseTexture=o!==!1,e&&this.initFromArray(e,t),r!==!1&&this.load()}bind(e){super.bind(e),e.target=Zo.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=Zo.TEXTURE_CUBE_MAP_POSITIVE_X+t,e.parentTextureArray=this.baseTexture,this.items[t]=e;return e.valid&&!this.valid&&this.resize(e.realWidth,e.realHeight),this.items[t]=e,this}upload(e,t,i){const n=this.itemDirtyIds;for(let r=0;r<Ga.SIDES;r++){const o=this.items[r];(n[r]<o.dirtyId||i.dirtyId<t.dirtyId)&&(o.valid&&o.resource?(o.resource.upload(e,o,i),n[r]=o.dirtyId):n[r]<-1&&(e.gl.texImage2D(o.target,0,i.internalFormat,t.realWidth,t.realHeight,0,t.format,i.type,null),n[r]=-1))}return!0}static test(e){return Array.isArray(e)&&e.length===Ga.SIDES}};Kb.SIDES=6;let wE=Kb;class Vo extends Wn{constructor(e,t){t=t||{};let i,n,r;typeof e=="string"?(i=Vo.EMPTY,n=e,r=!0):(i=e,n=null,r=!1),super(i),this.url=n,this.crossOrigin=t.crossOrigin??!0,this.alphaMode=typeof t.alphaMode=="number"?t.alphaMode:null,this.ownsImageBitmap=t.ownsImageBitmap??r,this._load=null,t.autoLoad!==!1&&this.load()}load(){return this._load?this._load:(this._load=new Promise(async(e,t)=>{if(this.url===null){e(this);return}try{const i=await Be.ADAPTER.fetch(this.url,{mode:this.crossOrigin?"cors":"no-cors"});if(this.destroyed)return;const n=await i.blob();if(this.destroyed)return;const r=await createImageBitmap(n,{premultiplyAlpha:this.alphaMode===null||this.alphaMode===bi.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 Vo._EMPTY=Vo._EMPTY??Be.ADAPTER.createCanvas(0,0),Vo._EMPTY}}const Qf=class Oc extends Wn{constructor(e,t){t=t||{},super(Be.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)},Oc.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;Wn.crossOrigin(e,this.svg,this._crossorigin),e.src=this.svg,e.onerror=t=>{this._resolve&&(e.onerror=null,this.onError.emit(t))},e.onload=()=>{if(!this._resolve)return;const t=e.width,i=e.height;if(!t||!i)throw new Error("The SVG image must have width and height defined (in pixels), canvas API needs them.");let n=t*this.scale,r=i*this.scale;(this._overrideWidth||this._overrideHeight)&&(n=this._overrideWidth||this._overrideHeight/i*t,r=this._overrideHeight||this._overrideWidth/t*i),n=Math.round(n),r=Math.round(r);const o=this.source;o.width=n,o.height=r,o._pixiId=`canvas_${ho()}`,o.getContext("2d").drawImage(e,0,0,t,i,0,0,n,r),this._resolve(),this._resolve=null}}static getSize(e){const t=Oc.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"&&Oc.SVG_XML.test(e)}};Qf.SVG_XML=/^(<\?xml[^?]+\?>)?\s*(<!--[^(-->)]*-->)?\s*\<svg/m,Qf.SVG_SIZE=/<svg[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i;let em=Qf;class SE extends Wn{constructor(e){super(e)}static test(e){return!!globalThis.VideoFrame&&e instanceof globalThis.VideoFrame}}const tm=class im extends Wn{constructor(e,t){if(t=t||{},!(e instanceof HTMLVideoElement)){const i=document.createElement("video");t.autoLoad!==!1&&i.setAttribute("preload","auto"),t.playsinline!==!1&&(i.setAttribute("webkit-playsinline",""),i.setAttribute("playsinline","")),t.muted===!0&&(i.setAttribute("muted",""),i.muted=!0),t.loop===!0&&i.setAttribute("loop",""),t.autoPlay!==!1&&i.setAttribute("autoplay",""),typeof e=="string"&&(e=[e]);const n=e[0].src||e[0];Wn.crossOrigin(i,n,t.crossorigin);for(let r=0;r<e.length;++r){const o=document.createElement("source");let{src:a,mime:c}=e[r];if(a=a||e[r],a.startsWith("data:"))c=a.slice(5,a.indexOf(";"));else if(!a.startsWith("blob:")){const l=a.split("?").shift().toLowerCase(),h=l.slice(l.lastIndexOf(".")+1);c=c||im.MIME_TYPES[h]||`video/${h}`}o.src=a,c&&(o.type=c),i.appendChild(o)}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=Yi.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&&(Yi.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||(Yi.shared.add(this.update,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.source.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(Yi.shared.remove(this.update,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(e,t){return globalThis.HTMLVideoElement&&e instanceof HTMLVideoElement||im.TYPES.includes(t)}};tm.TYPES=["mp4","m4v","webm","ogg","ogv","h264","avi","mov"],tm.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};let Zb=tm;Vf.push(Vo,Mb,bE,Zb,SE,em,au,wE,xE);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?ct.EMPTY:(e=e||new ct(0,0,1,1),e.x=this.minX,e.y=this.minY,e.width=this.maxX-this.minX,e.height=this.maxY-this.minY,e)}addPoint(e){this.minX=Math.min(this.minX,e.x),this.maxX=Math.max(this.maxX,e.x),this.minY=Math.min(this.minY,e.y),this.maxY=Math.max(this.maxY,e.y)}addPointMatrix(e,t){const{a:i,b:n,c:r,d:o,tx:a,ty:c}=e,l=i*t.x+r*t.y+a,h=n*t.x+o*t.y+c;this.minX=Math.min(this.minX,l),this.maxX=Math.max(this.maxX,l),this.minY=Math.min(this.minY,h),this.maxY=Math.max(this.maxY,h)}addQuad(e){let t=this.minX,i=this.minY,n=this.maxX,r=this.maxY,o=e[0],a=e[1];t=o<t?o:t,i=a<i?a:i,n=o>n?o:n,r=a>r?a:r,o=e[2],a=e[3],t=o<t?o:t,i=a<i?a:i,n=o>n?o:n,r=a>r?a:r,o=e[4],a=e[5],t=o<t?o:t,i=a<i?a:i,n=o>n?o:n,r=a>r?a:r,o=e[6],a=e[7],t=o<t?o:t,i=a<i?a:i,n=o>n?o:n,r=a>r?a:r,this.minX=t,this.minY=i,this.maxX=n,this.maxY=r}addFrame(e,t,i,n,r){this.addFrameMatrix(e.worldTransform,t,i,n,r)}addFrameMatrix(e,t,i,n,r){const o=e.a,a=e.b,c=e.c,l=e.d,h=e.tx,u=e.ty;let d=this.minX,f=this.minY,m=this.maxX,p=this.maxY,g=o*t+c*i+h,x=a*t+l*i+u;d=g<d?g:d,f=x<f?x:f,m=g>m?g:m,p=x>p?x:p,g=o*n+c*i+h,x=a*n+l*i+u,d=g<d?g:d,f=x<f?x:f,m=g>m?g:m,p=x>p?x:p,g=o*t+c*r+h,x=a*t+l*r+u,d=g<d?g:d,f=x<f?x:f,m=g>m?g:m,p=x>p?x:p,g=o*n+c*r+h,x=a*n+l*r+u,d=g<d?g:d,f=x<f?x:f,m=g>m?g:m,p=x>p?x:p,this.minX=d,this.minY=f,this.maxX=m,this.maxY=p}addVertexData(e,t,i){let n=this.minX,r=this.minY,o=this.maxX,a=this.maxY;for(let c=t;c<i;c+=2){const l=e[c],h=e[c+1];n=l<n?l:n,r=h<r?h:r,o=l>o?l:o,a=h>a?h:a}this.minX=n,this.minY=r,this.maxX=o,this.maxY=a}addVertices(e,t,i,n){this.addVerticesMatrix(e.worldTransform,t,i,n)}addVerticesMatrix(e,t,i,n,r=0,o=r){const a=e.a,c=e.b,l=e.c,h=e.d,u=e.tx,d=e.ty;let f=this.minX,m=this.minY,p=this.maxX,g=this.maxY;for(let x=i;x<n;x+=2){const v=t[x],y=t[x+1],S=a*v+l*y+u,C=h*y+c*v+d;f=Math.min(f,S-r),p=Math.max(p,S+r),m=Math.min(m,C-o),g=Math.max(g,C+o)}this.minX=f,this.minY=m,this.maxX=p,this.maxY=g}addBounds(e){const t=this.minX,i=this.minY,n=this.maxX,r=this.maxY;this.minX=e.minX<t?e.minX:t,this.minY=e.minY<i?e.minY:i,this.maxX=e.maxX>n?e.maxX:n,this.maxY=e.maxY>r?e.maxY:r}addBoundsMask(e,t){const i=e.minX>t.minX?e.minX:t.minX,n=e.minY>t.minY?e.minY:t.minY,r=e.maxX<t.maxX?e.maxX:t.maxX,o=e.maxY<t.maxY?e.maxY:t.maxY;if(i<=r&&n<=o){const a=this.minX,c=this.minY,l=this.maxX,h=this.maxY;this.minX=i<a?i:a,this.minY=n<c?n:c,this.maxX=r>l?r:l,this.maxY=o>h?o:h}}addBoundsMatrix(e,t){this.addFrameMatrix(t,e.minX,e.minY,e.maxX,e.maxY)}addBoundsArea(e,t){const i=e.minX>t.x?e.minX:t.x,n=e.minY>t.y?e.minY:t.y,r=e.maxX<t.x+t.width?e.maxX:t.x+t.width,o=e.maxY<t.y+t.height?e.maxY:t.y+t.height;if(i<=r&&n<=o){const a=this.minX,c=this.minY,l=this.maxX,h=this.maxY;this.minX=i<a?i:a,this.minY=n<c?n:c,this.maxX=r>l?r:l,this.maxY=o>h?o:h}}pad(e=0,t=e){this.isEmpty()||(this.minX-=e,this.maxX+=e,this.minY-=t,this.maxY+=t)}addFramePad(e,t,i,n,r,o){e-=r,t-=o,i+=r,n+=o,this.minX=this.minX<e?this.minX:e,this.maxX=this.maxX>i?this.maxX:i,this.minY=this.minY<t?this.minY:t,this.maxY=this.maxY>n?this.maxY:n}}class Kt extends Rl{constructor(){super(),this.tempDisplayObjectParent=null,this.transform=new pp,this.alpha=1,this.visible=!0,this.renderable=!0,this.cullable=!1,this.cullArea=null,this.parent=null,this.worldAlpha=1,this._lastSortedIndex=0,this._zIndex=0,this.filterArea=null,this.filters=null,this._enabledFilters=null,this._bounds=new 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 n=t[i];Object.defineProperty(Kt.prototype,n,Object.getOwnPropertyDescriptor(e,n))}}get destroyed(){return this._destroyed}_recursivePostUpdateTransform(){this.parent?(this.parent._recursivePostUpdateTransform(),this.transform.updateTransform(this.parent.transform)):this.transform.updateTransform(this._tempDisplayObjectParent.transform)}updateTransform(){this._boundsID++,this.transform.updateTransform(this.parent.transform),this.worldAlpha=this.alpha*this.parent.worldAlpha}getBounds(e,t){return e||(this.parent?(this._recursivePostUpdateTransform(),this.updateTransform()):(this.parent=this._tempDisplayObjectParent,this.updateTransform(),this.parent=null)),this._bounds.updateID!==this._boundsID&&(this.calculateBounds(),this._bounds.updateID=this._boundsID),t||(this._boundsRect||(this._boundsRect=new ct),t=this._boundsRect),this._bounds.getRectangle(t)}getLocalBounds(e){e||(this._localBoundsRect||(this._localBoundsRect=new ct),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 n=this._bounds,r=this._boundsID;this._bounds=this._localBounds;const o=this.getBounds(!1,e);return this.parent=i,this.transform=t,this._bounds=n,this._bounds.updateID+=this._boundsID-r,o}toGlobal(e,t,i=!1){return i||(this._recursivePostUpdateTransform(),this.parent?this.displayObjectUpdateTransform():(this.parent=this._tempDisplayObjectParent,this.displayObjectUpdateTransform(),this.parent=null)),this.worldTransform.apply(e,t)}toLocal(e,t,i,n){return t&&(e=t.toGlobal(e,i,n)),n||(this._recursivePostUpdateTransform(),this.parent?this.displayObjectUpdateTransform():(this.parent=this._tempDisplayObjectParent,this.displayObjectUpdateTransform(),this.parent=null)),this.worldTransform.applyInverse(e,i)}setParent(e){if(!e||!e.addChild)throw new Error("setParent: Argument must be a Container");return e.addChild(this),e}removeFromParent(){var e;(e=this.parent)==null||e.removeChild(this)}setTransform(e=0,t=0,i=1,n=1,r=0,o=0,a=0,c=0,l=0){return this.position.x=e,this.position.y=t,this.scale.x=i||1,this.scale.y=n||1,this.rotation=r,this.skew.x=o,this.skew.y=a,this.pivot.x=c,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 ME),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*gC}set angle(e){this.transform.rotation=e*vC}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 ME extends Kt{constructor(){super(...arguments),this.sortDirty=null}}Kt.prototype.displayObjectUpdateTransform=Kt.prototype.updateTransform;const TE=new Ft;function _E(s,e){return s.zIndex===e.zIndex?s._lastSortedIndex-e._lastSortedIndex:s.zIndex-e.zIndex}const Jb=class sm extends Kt{constructor(){super(),this.children=[],this.sortableChildren=sm.defaultSortableChildren,this.sortDirty=!1}onChildrenChange(e){}addChild(...e){if(e.length>1)for(let t=0;t<e.length;t++)this.addChild(e[t]);else{const t=e[0];t.parent&&t.parent.removeChild(t),t.parent=this,this.sortDirty=!0,t.transform._parentID=-1,this.children.push(t),this._boundsID++,this.onChildrenChange(this.children.length-1),this.emit("childAdded",t,this,this.children.length-1),t.emit("added",this)}return e[0]}addChildAt(e,t){if(t<0||t>this.children.length)throw new Error(`${e}addChildAt: The index ${t} supplied is out of bounds ${this.children.length}`);return e.parent&&e.parent.removeChild(e),e.parent=this,this.sortDirty=!0,e.transform._parentID=-1,this.children.splice(t,0,e),this._boundsID++,this.onChildrenChange(t),e.emit("added",this),this.emit("childAdded",e,this,t),e}swapChildren(e,t){if(e===t)return;const i=this.getChildIndex(e),n=this.getChildIndex(t);this.children[i]=t,this.children[n]=e,this.onChildrenChange(i<n?i:n)}getChildIndex(e){const t=this.children.indexOf(e);if(t===-1)throw new Error("The supplied DisplayObject must be a child of the caller");return t}setChildIndex(e,t){if(t<0||t>=this.children.length)throw new Error(`The index ${t} supplied is out of bounds ${this.children.length}`);const i=this.getChildIndex(e);Jo(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,Jo(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,Jo(this.children,e,1),this._boundsID++,this.onChildrenChange(e),t.emit("removed",this),this.emit("childRemoved",t,this,e),t}removeChildren(e=0,t=this.children.length){const i=e,n=t,r=n-i;let o;if(r>0&&r<=n){o=this.children.splice(i,r);for(let a=0;a<o.length;++a)o[a].parent=null,o[a].transform&&(o[a].transform._parentID=-1);this._boundsID++,this.onChildrenChange(e);for(let a=0;a<o.length;++a)o[a].emit("removed",this),this.emit("childRemoved",o[a],this,a);return o}else if(r===0&&this.children.length===0)return[];throw new RangeError("removeChildren: numeric values are outside the acceptable range.")}sortChildren(){let e=!1;for(let t=0,i=this.children.length;t<i;++t){const n=this.children[t];n._lastSortedIndex=t,!e&&n.zIndex!==0&&(e=!0)}e&&this.children.length>1&&this.children.sort(_E),this.sortDirty=!1}updateTransform(){this.sortableChildren&&this.sortDirty&&this.sortChildren(),this._boundsID++,this.transform.updateTransform(this.parent.transform),this.worldAlpha=this.alpha*this.parent.worldAlpha;for(let e=0,t=this.children.length;e<t;++e){const i=this.children[e];i.visible&&i.updateTransform()}}calculateBounds(){this._bounds.clear(),this._calculateBounds();for(let e=0;e<this.children.length;e++){const t=this.children[e];if(!(!t.visible||!t.renderable))if(t.calculateBounds(),t._mask){const i=t._mask.isMaskData?t._mask.maskObject:t._mask;i?(i.calculateBounds(),this._bounds.addBoundsMask(t._bounds,i._bounds)):this._bounds.addBounds(t._bounds)}else t.filterArea?this._bounds.addBoundsArea(t._bounds,t.filterArea):this._bounds.addBounds(t._bounds)}this._bounds.updateID=this._boundsID}getLocalBounds(e,t=!1){const i=super.getLocalBounds(e);if(!t)for(let n=0,r=this.children.length;n<r;++n){const o=this.children[n];o.visible&&o.updateTransform()}return i}_calculateBounds(){}_renderWithCulling(e){const t=e.renderTexture.sourceFrame;if(!(t.width>0&&t.height>0))return;let i,n;this.cullArea?(i=this.cullArea,n=this.worldTransform):this._render!==sm.prototype._render&&(i=this.getBounds(!0));const r=e.projection.transform;if(r&&(n?(n=TE.copyFrom(n),n.prepend(r)):n=r),i&&t.intersects(i,n))this._render(e);else if(this.cullArea)return;for(let o=0,a=this.children.length;o<a;++o){const c=this.children[o],l=c.cullable;c.cullable=l||!this.cullArea,c.render(e),c.cullable=l}}render(e){var t;if(!(!this.visible||this.worldAlpha<=0||!this.renderable))if(this._mask||(t=this.filters)!=null&&t.length)this.renderAdvanced(e);else if(this.cullable)this._renderWithCulling(e);else{this._render(e);for(let i=0,n=this.children.length;i<n;++i)this.children[i].render(e)}}renderAdvanced(e){var r,o,a;const t=this.filters,i=this._mask;if(t){this._enabledFilters||(this._enabledFilters=[]),this._enabledFilters.length=0;for(let c=0;c<t.length;c++)t[c].enabled&&this._enabledFilters.push(t[c])}const n=t&&((r=this._enabledFilters)==null?void 0:r.length)||i&&(!i.isMaskData||i.enabled&&(i.autoDetect||i.type!==ui.NONE));if(n&&e.batch.flush(),t&&((o=this._enabledFilters)!=null&&o.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 c=0,l=this.children.length;c<l;++c)this.children[c].render(e)}n&&e.batch.flush(),i&&e.mask.pop(this),t&&((a=this._enabledFilters)!=null&&a.length)&&e.filter.pop()}_render(e){}destroy(e){super.destroy(),this.sortDirty=!1;const t=typeof e=="boolean"?e:e==null?void 0:e.children,i=this.removeChildren(0,this.children.length);if(t)for(let n=0;n<i.length;++n)i[n].destroy(e)}get width(){return this.scale.x*this.getLocalBounds().width}set width(e){const t=this.getLocalBounds().width;t!==0?this.scale.x=e/t:this.scale.x=1,this._width=e}get height(){return this.scale.y*this.getLocalBounds().height}set height(e){const t=this.getLocalBounds().height;t!==0?this.scale.y=e/t:this.scale.y=1,this._height=e}};Jb.defaultSortableChildren=!1;let gi=Jb;gi.prototype.containerUpdateTransform=gi.prototype.updateTransform;Object.defineProperties(Be,{SORTABLE_CHILDREN:{get(){return gi.defaultSortableChildren},set(s){mt("7.1.0","settings.SORTABLE_CHILDREN is deprecated, use Container.defaultSortableChildren"),gi.defaultSortableChildren=s}}});const Oa=new St,CE=new Uint16Array([0,1,2,0,2,3]);class Pr extends gi{constructor(e){super(),this._anchor=new Fn(this._onAnchorUpdate,this,e?e.defaultAnchor.x:0,e?e.defaultAnchor.y:0),this._texture=null,this._width=0,this._height=0,this._tintColor=new At(16777215),this._tintRGB=null,this.tint=16777215,this.blendMode=We.NORMAL,this._cachedTint=16777215,this.uvs=null,this.texture=e||Ke.EMPTY,this.vertexData=new Float32Array(8),this.vertexTrimmedData=null,this._transformID=-1,this._textureID=-1,this._transformTrimmedID=-1,this._textureTrimmedID=-1,this.indices=CE,this.pluginName="batch",this.isSprite=!0,this._roundPixels=Be.ROUND_PIXELS}_onTextureUpdate(){this._textureID=-1,this._textureTrimmedID=-1,this._cachedTint=16777215,this._width&&(this.scale.x=yr(this.scale.x)*this._width/this._texture.orig.width),this._height&&(this.scale.y=yr(this.scale.y)*this._height/this._texture.orig.height)}_onAnchorUpdate(){this._transformID=-1,this._transformTrimmedID=-1}calculateVertices(){const e=this._texture;if(this._transformID===this.transform._worldID&&this._textureID===e._updateID)return;this._textureID!==e._updateID&&(this.uvs=this._texture._uvs.uvsFloat32),this._transformID=this.transform._worldID,this._textureID=e._updateID;const t=this.transform.worldTransform,i=t.a,n=t.b,r=t.c,o=t.d,a=t.tx,c=t.ty,l=this.vertexData,h=e.trim,u=e.orig,d=this._anchor;let f=0,m=0,p=0,g=0;if(h?(m=h.x-d._x*u.width,f=m+h.width,g=h.y-d._y*u.height,p=g+h.height):(m=-d._x*u.width,f=m+u.width,g=-d._y*u.height,p=g+u.height),l[0]=i*m+r*g+a,l[1]=o*g+n*m+c,l[2]=i*f+r*g+a,l[3]=o*g+n*f+c,l[4]=i*f+r*p+a,l[5]=o*p+n*f+c,l[6]=i*m+r*p+a,l[7]=o*p+n*m+c,this._roundPixels){const x=Be.RESOLUTION;for(let v=0;v<l.length;++v)l[v]=Math.round(l[v]*x)/x}}calculateTrimmedVertices(){if(!this.vertexTrimmedData)this.vertexTrimmedData=new Float32Array(8);else if(this._transformTrimmedID===this.transform._worldID&&this._textureTrimmedID===this._texture._updateID)return;this._transformTrimmedID=this.transform._worldID,this._textureTrimmedID=this._texture._updateID;const e=this._texture,t=this.vertexTrimmedData,i=e.orig,n=this._anchor,r=this.transform.worldTransform,o=r.a,a=r.b,c=r.c,l=r.d,h=r.tx,u=r.ty,d=-n._x*i.width,f=d+i.width,m=-n._y*i.height,p=m+i.height;if(t[0]=o*d+c*m+h,t[1]=l*m+a*d+u,t[2]=o*f+c*m+h,t[3]=l*m+a*f+u,t[4]=o*f+c*p+h,t[5]=l*p+a*f+u,t[6]=o*d+c*p+h,t[7]=l*p+a*d+u,this._roundPixels){const g=Be.RESOLUTION;for(let x=0;x<t.length;++x)t[x]=Math.round(t[x]*g)/g}}_render(e){this.calculateVertices(),e.batch.setObjectRenderer(e.plugins[this.pluginName]),e.plugins[this.pluginName].render(this)}_calculateBounds(){const e=this._texture.trim,t=this._texture.orig;!e||e.width===t.width&&e.height===t.height?(this.calculateVertices(),this._bounds.addQuad(this.vertexData)):(this.calculateTrimmedVertices(),this._bounds.addQuad(this.vertexTrimmedData))}getLocalBounds(e){return this.children.length===0?(this._localBounds||(this._localBounds=new 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 ct),e=this._localBoundsRect),this._localBounds.getRectangle(e)):super.getLocalBounds.call(this,e)}containsPoint(e){this.worldTransform.applyInverse(e,Oa);const t=this._texture.orig.width,i=this._texture.orig.height,n=-t*this.anchor.x;let r=0;return Oa.x>=n&&Oa.x<n+t&&(r=-i*this.anchor.y,Oa.y>=r&&Oa.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 Ke?e:Ke.from(e,t);return new Pr(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=yr(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=yr(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||Ke.EMPTY,this._cachedTint=16777215,this._textureID=-1,this._textureTrimmedID=-1,e&&(e.baseTexture.valid?this._onTextureUpdate():e.once("update",this._onTextureUpdate,this)))}}const Qb=new Ft;Kt.prototype._cacheAsBitmap=!1;Kt.prototype._cacheData=null;Kt.prototype._cacheAsBitmapResolution=null;Kt.prototype._cacheAsBitmapMultisample=null;class EE{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(Kt.prototype,{cacheAsBitmapResolution:{get(){return this._cacheAsBitmapResolution},set(s){s!==this._cacheAsBitmapResolution&&(this._cacheAsBitmapResolution=s,this.cacheAsBitmap&&(this.cacheAsBitmap=!1,this.cacheAsBitmap=!0))}},cacheAsBitmapMultisample:{get(){return this._cacheAsBitmapMultisample},set(s){s!==this._cacheAsBitmapMultisample&&(this._cacheAsBitmapMultisample=s,this.cacheAsBitmap&&(this.cacheAsBitmap=!1,this.cacheAsBitmap=!0))}},cacheAsBitmap:{get(){return this._cacheAsBitmap},set(s){if(this._cacheAsBitmap===s)return;this._cacheAsBitmap=s;let e;s?(this._cacheData||(this._cacheData=new EE),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)}}});Kt.prototype._renderCached=function(s){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObject(s),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._render(s))};Kt.prototype._initCachedDisplayObject=function(s){var d,f;if((d=this._cacheData)!=null&&d.sprite)return;const e=this.alpha;this.alpha=1,s.batch.flush();const t=this.getLocalBounds(new ct,!0);if((f=this.filters)!=null&&f.length){const m=this.filters[0].padding;t.pad(m)}const i=this.cacheAsBitmapResolution||s.resolution;t.ceil(i),t.width=Math.max(t.width,1/i),t.height=Math.max(t.height,1/i);const n=s.renderTexture.current,r=s.renderTexture.sourceFrame.clone(),o=s.renderTexture.destinationFrame.clone(),a=s.projection.transform,c=vo.create({width:t.width,height:t.height,resolution:i,multisample:this.cacheAsBitmapMultisample??s.multisample}),l=`cacheAsBitmap_${ho()}`;this._cacheData.textureCacheId=l,it.addToCache(c.baseTexture,l),Ke.addToCache(c,l);const h=this.transform.localTransform.copyTo(Qb).invert().translate(-t.x,-t.y);this.render=this._cacheData.originalRender,s.render(this,{renderTexture:c,clear:!0,transform:h,skipUpdateTransform:!1}),s.framebuffer.blit(),s.projection.transform=a,s.renderTexture.bind(n,r,o),this.render=this._renderCached,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null,this.alpha=e;const u=new Pr(c);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)};Kt.prototype._renderCachedCanvas=function(s){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObjectCanvas(s),this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._renderCanvas(s))};Kt.prototype._initCachedDisplayObjectCanvas=function(s){var h;if((h=this._cacheData)!=null&&h.sprite)return;const e=this.getLocalBounds(new ct,!0),t=this.alpha;this.alpha=1;const i=s.canvasContext.activeContext,n=s._projTransform,r=this.cacheAsBitmapResolution||s.resolution;e.ceil(r),e.width=Math.max(e.width,1/r),e.height=Math.max(e.height,1/r);const o=vo.create({width:e.width,height:e.height,resolution:r}),a=`cacheAsBitmap_${ho()}`;this._cacheData.textureCacheId=a,it.addToCache(o.baseTexture,a),Ke.addToCache(o,a);const c=Qb;this.transform.localTransform.copyTo(c),c.invert(),c.tx-=e.x,c.ty-=e.y,this.renderCanvas=this._cacheData.originalRenderCanvas,s.render(this,{renderTexture:o,clear:!0,transform:c,skipUpdateTransform:!1}),s.canvasContext.activeContext=i,s._projTransform=n,this.renderCanvas=this._renderCachedCanvas,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null,this.alpha=t;const l=new Pr(o);l.transform.worldTransform=this.transform.worldTransform,l.anchor.x=-(e.x/e.width),l.anchor.y=-(e.y/e.height),l.alpha=t,l._bounds=this._bounds,this._cacheData.sprite=l,this.transform._parentID=-1,this.parent?this.updateTransform():(this.parent=s._tempDisplayObjectParent,this.updateTransform(),this.parent=null),this.containsPoint=l.containsPoint.bind(l)};Kt.prototype._calculateCachedBounds=function(){this._bounds.clear(),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite._calculateBounds(),this._bounds.updateID=this._boundsID};Kt.prototype._getCachedLocalBounds=function(){return this._cacheData.sprite.getLocalBounds(null)};Kt.prototype._destroyCachedDisplayObject=function(){this._cacheData.sprite._texture.destroy(!0),this._cacheData.sprite=null,it.removeFromCache(this._cacheData.textureCacheId),Ke.removeFromCache(this._cacheData.textureCacheId),this._cacheData.textureCacheId=null};Kt.prototype._cacheAsBitmapDestroy=function(s){this.cacheAsBitmap=!1,this.destroy(s)};Kt.prototype.name=null;gi.prototype.getChildByName=function(s,e){for(let t=0,i=this.children.length;t<i;t++)if(this.children[t].name===s)return this.children[t];if(e)for(let t=0,i=this.children.length;t<i;t++){const n=this.children[t];if(!n.getChildByName)continue;const r=n.getChildByName(s,!0);if(r)return r}return null};Kt.prototype.getGlobalPosition=function(s=new St,e=!1){return this.parent?this.parent.toGlobal(this.position,s,e):(s.x=this.position.x,s.y=this.position.y),s};var AE=`varying vec2 vTextureCoord;
|
||
|
||
uniform sampler2D uSampler;
|
||
uniform float uAlpha;
|
||
|
||
void main(void)
|
||
{
|
||
gl_FragColor = texture2D(uSampler, vTextureCoord) * uAlpha;
|
||
}
|
||
`;class IE extends Vi{constructor(e=1){super(vE,AE,{uAlpha:1}),this.alpha=e}get alpha(){return this.uniforms.uAlpha}set alpha(e){this.uniforms.uAlpha=e}}const RE={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]},PE=["varying vec2 vBlurTexCoords[%size%];","uniform sampler2D uSampler;","void main(void)","{"," gl_FragColor = vec4(0.0);"," %blur%","}"].join(`
|
||
`);function kE(s){const e=RE[s],t=e.length;let i=PE,n="";const r="gl_FragColor += texture2D(uSampler, vBlurTexCoords[%index%]) * %value%;";let o;for(let a=0;a<s;a++){let c=r.replace("%index%",a.toString());o=a,a>=t&&(o=s-a-1),c=c.replace("%value%",e[o].toString()),n+=c,n+=`
|
||
`}return i=i.replace("%blur%",n),i=i.replace("%size%",s.toString()),i}const FE=`
|
||
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 OE(s,e){const t=Math.ceil(s/2);let i=FE,n="",r;e?r="vBlurTexCoords[%index%] = textureCoord + vec2(%sampleIndex% * strength, 0.0);":r="vBlurTexCoords[%index%] = textureCoord + vec2(0.0, %sampleIndex% * strength);";for(let o=0;o<s;o++){let a=r.replace("%index%",o.toString());a=a.replace("%sampleIndex%",`${o-(t-1)}.0`),n+=a,n+=`
|
||
`}return i=i.replace("%blur%",n),i=i.replace("%size%",s.toString()),i}class nm extends Vi{constructor(e,t=8,i=4,n=Vi.defaultResolution,r=5){const o=OE(r,e),a=kE(r);super(o,a),this.horizontal=e,this.resolution=n,this._quality=0,this.quality=i,this.blur=t}apply(e,t,i,n){if(i?this.horizontal?this.uniforms.strength=1/i.width*(i.width/t.width):this.uniforms.strength=1/i.height*(i.height/t.height):this.horizontal?this.uniforms.strength=1/e.renderer.width*(e.renderer.width/t.width):this.uniforms.strength=1/e.renderer.height*(e.renderer.height/t.height),this.uniforms.strength*=this.strength,this.uniforms.strength/=this.passes,this.passes===1)e.applyFilter(this,t,i,n);else{const r=e.getFilterTexture(),o=e.renderer;let a=t,c=r;this.state.blend=!1,e.applyFilter(this,a,c,en.CLEAR);for(let l=1;l<this.passes-1;l++){e.bindAndClear(a,en.BLIT),this.uniforms.uSampler=c;const h=c;c=a,a=h,o.shader.bind(this),o.geometry.draw(5)}this.state.blend=!0,e.applyFilter(this,c,i,n),e.returnFilterTexture(r)}}get blur(){return this.strength}set blur(e){this.padding=1+Math.abs(e)*2,this.strength=e}get quality(){return this._quality}set quality(e){this._quality=e,this.passes=e}}class LE extends Vi{constructor(e=8,t=4,i=Vi.defaultResolution,n=5){super(),this._repeatEdgePixels=!1,this.blurXFilter=new nm(!0,e,t,i,n),this.blurYFilter=new nm(!1,e,t,i,n),this.resolution=i,this.quality=t,this.blur=e,this.repeatEdgePixels=!1}apply(e,t,i,n){const r=Math.abs(this.blurXFilter.strength),o=Math.abs(this.blurYFilter.strength);if(r&&o){const a=e.getFilterTexture();this.blurXFilter.apply(e,t,a,en.CLEAR),this.blurYFilter.apply(e,a,i,n),e.returnFilterTexture(a)}else o?this.blurYFilter.apply(e,t,i,n):this.blurXFilter.apply(e,t,i,n)}updatePadding(){this._repeatEdgePixels?this.padding=0:this.padding=Math.max(Math.abs(this.blurXFilter.strength),Math.abs(this.blurYFilter.strength))*2}get blur(){return this.blurXFilter.blur}set blur(e){this.blurXFilter.blur=this.blurYFilter.blur=e,this.updatePadding()}get quality(){return this.blurXFilter.quality}set quality(e){this.blurXFilter.quality=this.blurYFilter.quality=e}get blurX(){return this.blurXFilter.blur}set blurX(e){this.blurXFilter.blur=e,this.updatePadding()}get blurY(){return this.blurYFilter.blur}set blurY(e){this.blurYFilter.blur=e,this.updatePadding()}get blendMode(){return this.blurYFilter.blendMode}set blendMode(e){this.blurYFilter.blendMode=e}get repeatEdgePixels(){return this._repeatEdgePixels}set repeatEdgePixels(e){this._repeatEdgePixels=e,this.updatePadding()}}var BE=`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 rm extends Vi{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(jb,BE,e),this.alpha=1}_loadMatrix(e,t=!1){let i=e;t&&(this._multiply(i,this.uniforms.m,e),i=this._colorMatrix(i)),this.uniforms.m=i}_multiply(e,t,i){return e[0]=t[0]*i[0]+t[1]*i[5]+t[2]*i[10]+t[3]*i[15],e[1]=t[0]*i[1]+t[1]*i[6]+t[2]*i[11]+t[3]*i[16],e[2]=t[0]*i[2]+t[1]*i[7]+t[2]*i[12]+t[3]*i[17],e[3]=t[0]*i[3]+t[1]*i[8]+t[2]*i[13]+t[3]*i[18],e[4]=t[0]*i[4]+t[1]*i[9]+t[2]*i[14]+t[3]*i[19]+t[4],e[5]=t[5]*i[0]+t[6]*i[5]+t[7]*i[10]+t[8]*i[15],e[6]=t[5]*i[1]+t[6]*i[6]+t[7]*i[11]+t[8]*i[16],e[7]=t[5]*i[2]+t[6]*i[7]+t[7]*i[12]+t[8]*i[17],e[8]=t[5]*i[3]+t[6]*i[8]+t[7]*i[13]+t[8]*i[18],e[9]=t[5]*i[4]+t[6]*i[9]+t[7]*i[14]+t[8]*i[19]+t[9],e[10]=t[10]*i[0]+t[11]*i[5]+t[12]*i[10]+t[13]*i[15],e[11]=t[10]*i[1]+t[11]*i[6]+t[12]*i[11]+t[13]*i[16],e[12]=t[10]*i[2]+t[11]*i[7]+t[12]*i[12]+t[13]*i[17],e[13]=t[10]*i[3]+t[11]*i[8]+t[12]*i[13]+t[13]*i[18],e[14]=t[10]*i[4]+t[11]*i[9]+t[12]*i[14]+t[13]*i[19]+t[14],e[15]=t[15]*i[0]+t[16]*i[5]+t[17]*i[10]+t[18]*i[15],e[16]=t[15]*i[1]+t[16]*i[6]+t[17]*i[11]+t[18]*i[16],e[17]=t[15]*i[2]+t[16]*i[7]+t[17]*i[12]+t[18]*i[17],e[18]=t[15]*i[3]+t[16]*i[8]+t[17]*i[13]+t[18]*i[18],e[19]=t[15]*i[4]+t[16]*i[9]+t[17]*i[14]+t[18]*i[19]+t[19],e}_colorMatrix(e){const t=new Float32Array(e);return t[4]/=255,t[9]/=255,t[14]/=255,t[19]/=255,t}brightness(e,t){const i=[e,0,0,0,0,0,e,0,0,0,0,0,e,0,0,0,0,0,1,0];this._loadMatrix(i,t)}tint(e,t){const[i,n,r]=At.shared.setValue(e).toArray(),o=[i,0,0,0,0,0,n,0,0,0,0,0,r,0,0,0,0,0,1,0];this._loadMatrix(o,t)}greyscale(e,t){const i=[e,e,e,0,0,e,e,e,0,0,e,e,e,0,0,0,0,0,1,0];this._loadMatrix(i,t)}blackAndWhite(e){const t=[.3,.6,.1,0,0,.3,.6,.1,0,0,.3,.6,.1,0,0,0,0,0,1,0];this._loadMatrix(t,e)}hue(e,t){e=(e||0)/180*Math.PI;const i=Math.cos(e),n=Math.sin(e),r=Math.sqrt,o=1/3,a=r(o),c=i+(1-i)*o,l=o*(1-i)-a*n,h=o*(1-i)+a*n,u=o*(1-i)+a*n,d=i+o*(1-i),f=o*(1-i)-a*n,m=o*(1-i)-a*n,p=o*(1-i)+a*n,g=i+o*(1-i),x=[c,l,h,0,0,u,d,f,0,0,m,p,g,0,0,0,0,0,1,0];this._loadMatrix(x,t)}contrast(e,t){const i=(e||0)+1,n=-.5*(i-1),r=[i,0,0,0,n,0,i,0,0,n,0,0,i,0,n,0,0,0,1,0];this._loadMatrix(r,t)}saturate(e=0,t){const i=e*2/3+1,n=(i-1)*-.5,r=[i,n,n,0,0,n,i,n,0,0,n,n,i,0,0,0,0,0,1,0];this._loadMatrix(r,t)}desaturate(){this.saturate(-1)}negative(e){const t=[-1,0,0,1,0,0,-1,0,1,0,0,0,-1,1,0,0,0,0,1,0];this._loadMatrix(t,e)}sepia(e){const t=[.393,.7689999,.18899999,0,0,.349,.6859999,.16799999,0,0,.272,.5339999,.13099999,0,0,0,0,0,1,0];this._loadMatrix(t,e)}technicolor(e){const t=[1.9125277891456083,-.8545344976951645,-.09155508482755585,0,11.793603434377337,-.3087833385928097,1.7658908555458428,-.10601743074722245,0,-70.35205161461398,-.231103377548616,-.7501899197440212,1.847597816108189,0,30.950940869491138,0,0,0,1,0];this._loadMatrix(t,e)}polaroid(e){const t=[1.438,-.062,-.062,0,0,-.122,1.378,-.122,0,0,-.016,-.016,1.483,0,0,0,0,0,1,0];this._loadMatrix(t,e)}toBGR(e){const t=[0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,1,0];this._loadMatrix(t,e)}kodachrome(e){const t=[1.1285582396593525,-.3967382283601348,-.03992559172921793,0,63.72958762196502,-.16404339962244616,1.0835251566291304,-.05498805115633132,0,24.732407896706203,-.16786010706155763,-.5603416277695248,1.6014850761964943,0,35.62982807460946,0,0,0,1,0];this._loadMatrix(t,e)}browni(e){const t=[.5997023498159715,.34553243048391263,-.2708298674538042,0,47.43192855600873,-.037703249837783157,.8609577587992641,.15059552388459913,0,-36.96841498319127,.24113635128153335,-.07441037908422492,.44972182064877153,0,-7.562075277591283,0,0,0,1,0];this._loadMatrix(t,e)}vintage(e){const t=[.6279345635605994,.3202183420819367,-.03965408211312453,0,9.651285835294123,.02578397704808868,.6441188644374771,.03259127616149294,0,7.462829176470591,.0466055556782719,-.0851232987247891,.5241648018700465,0,5.159190588235296,0,0,0,1,0];this._loadMatrix(t,e)}colorTone(e,t,i,n,r){e=e||.2,t=t||.15,i=i||16770432,n=n||3375104;const o=At.shared,[a,c,l]=o.setValue(i).toArray(),[h,u,d]=o.setValue(n).toArray(),f=[.3,.59,.11,0,0,a,c,l,e,0,h,u,d,t,0,a-h,c-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}}rm.prototype.grayscale=rm.prototype.greyscale;var NE=`varying vec2 vFilterCoord;
|
||
varying vec2 vTextureCoord;
|
||
|
||
uniform vec2 scale;
|
||
uniform mat2 rotation;
|
||
uniform sampler2D uSampler;
|
||
uniform sampler2D mapSampler;
|
||
|
||
uniform highp vec4 inputSize;
|
||
uniform vec4 inputClamp;
|
||
|
||
void main(void)
|
||
{
|
||
vec4 map = texture2D(mapSampler, vFilterCoord);
|
||
|
||
map -= 0.5;
|
||
map.xy = scale * inputSize.zw * (rotation * map.xy);
|
||
|
||
gl_FragColor = texture2D(uSampler, clamp(vec2(vTextureCoord.x + map.x, vTextureCoord.y + map.y), inputClamp.xy, inputClamp.zw));
|
||
}
|
||
`,DE=`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 UE extends Vi{constructor(e,t){const i=new Ft;e.renderable=!1,super(DE,NE,{mapSampler:e._texture,filterMatrix:i,scale:{x:1,y:1},rotation:new Float32Array([1,0,0,1])}),this.maskSprite=e,this.maskMatrix=i,t==null&&(t=20),this.scale=new St(t,t)}apply(e,t,i,n){this.uniforms.filterMatrix=e.calculateSpriteMatrix(this.maskMatrix,this.maskSprite),this.uniforms.scale.x=this.scale.x,this.uniforms.scale.y=this.scale.y;const r=this.maskSprite.worldTransform,o=Math.sqrt(r.a*r.a+r.b*r.b),a=Math.sqrt(r.c*r.c+r.d*r.d);o!==0&&a!==0&&(this.uniforms.rotation[0]=r.a/o,this.uniforms.rotation[1]=r.b/o,this.uniforms.rotation[2]=r.c/a,this.uniforms.rotation[3]=r.d/a),e.applyFilter(this,t,i,n)}get map(){return this.uniforms.mapSampler}set map(e){this.uniforms.mapSampler=e}}var $E=`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;
|
||
}
|
||
`,XE=`
|
||
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 VE extends Vi{constructor(){super(XE,$E)}}var YE=`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 GE extends Vi{constructor(e=.5,t=Math.random()){super(jb,YE,{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 hv={AlphaFilter:IE,BlurFilter:LE,BlurFilterPass:nm,ColorMatrixFilter:rm,DisplacementFilter:UE,FXAAFilter:VE,NoiseFilter:GE};Object.entries(hv).forEach(([s,e])=>{Object.defineProperty(hv,s,{get(){return mt("7.1.0",`filters.${s} has moved to ${s}`),e}})});class jE{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||(Yi.system.add(this.tickerUpdate,this,uo.INTERACTION),this.tickerAdded=!0)}removeTickerListener(){this.tickerAdded&&(Yi.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 mr=new jE;class Pl{constructor(e){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=Pl.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new St,this.page=new St,this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,this.manager=e}get layerX(){return this.layer.x}get layerY(){return this.layer.y}get pageX(){return this.page.x}get pageY(){return this.page.y}get data(){return this}composedPath(){return this.manager&&(!this.path||this.path[this.path.length-1]!==this.target)&&(this.path=this.target?this.manager.propagationPath(this.target):[]),this.path}initEvent(e,t,i){throw new Error("initEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}initUIEvent(e,t,i,n,r){throw new Error("initUIEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}preventDefault(){this.nativeEvent instanceof Event&&this.nativeEvent.cancelable&&this.nativeEvent.preventDefault(),this.defaultPrevented=!0}stopImmediatePropagation(){this.propagationImmediatelyStopped=!0}stopPropagation(){this.propagationStopped=!0}}class ch extends Pl{constructor(){super(...arguments),this.client=new St,this.movement=new St,this.offset=new St,this.global=new St,this.screen=new St}get clientX(){return this.client.x}get clientY(){return this.client.y}get x(){return this.clientX}get y(){return this.clientY}get movementX(){return this.movement.x}get movementY(){return this.movement.y}get offsetX(){return this.offset.x}get offsetY(){return this.offset.y}get globalX(){return this.global.x}get globalY(){return this.global.y}get screenX(){return this.screen.x}get screenY(){return this.screen.y}getLocalPosition(e,t,i){return e.worldTransform.applyInverse(i||this.global,t)}getModifierState(e){return"getModifierState"in this.nativeEvent&&this.nativeEvent.getModifierState(e)}initMouseEvent(e,t,i,n,r,o,a,c,l,h,u,d,f,m,p){throw new Error("Method not implemented.")}}class Cs extends ch{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 ea extends ch{constructor(){super(...arguments),this.DOM_DELTA_PIXEL=0,this.DOM_DELTA_LINE=1,this.DOM_DELTA_PAGE=2}}ea.DOM_DELTA_PIXEL=0,ea.DOM_DELTA_LINE=1,ea.DOM_DELTA_PAGE=2;const HE=2048,WE=new St,qd=new St;class zE{constructor(e){this.dispatch=new Rl,this.moveOnAll=!1,this.enableGlobalMoveEvents=!0,this.mappingState={trackingData:{}},this.eventPool=new Map,this._allInteractiveElements=[],this._hitElements=[],this._isPointerMoveEvent=!1,this.rootTarget=e,this.hitPruneFn=this.hitPruneFn.bind(this),this.hitTestFn=this.hitTestFn.bind(this),this.mapPointerDown=this.mapPointerDown.bind(this),this.mapPointerMove=this.mapPointerMove.bind(this),this.mapPointerOut=this.mapPointerOut.bind(this),this.mapPointerOver=this.mapPointerOver.bind(this),this.mapPointerUp=this.mapPointerUp.bind(this),this.mapPointerUpOutside=this.mapPointerUpOutside.bind(this),this.mapWheel=this.mapWheel.bind(this),this.mappingTable={},this.addEventMapping("pointerdown",this.mapPointerDown),this.addEventMapping("pointermove",this.mapPointerMove),this.addEventMapping("pointerout",this.mapPointerOut),this.addEventMapping("pointerleave",this.mapPointerOut),this.addEventMapping("pointerover",this.mapPointerOver),this.addEventMapping("pointerup",this.mapPointerUp),this.addEventMapping("pointerupoutside",this.mapPointerUpOutside),this.addEventMapping("wheel",this.mapWheel)}addEventMapping(e,t){this.mappingTable[e]||(this.mappingTable[e]=[]),this.mappingTable[e].push({fn:t,priority:0}),this.mappingTable[e].sort((i,n)=>i.priority-n.priority)}dispatchEvent(e,t){e.propagationStopped=!1,e.propagationImmediatelyStopped=!1,this.propagate(e,t),this.dispatch.emit(t||e.type,e)}mapEvent(e){if(!this.rootTarget)return;const t=this.mappingTable[e.type];if(t)for(let i=0,n=t.length;i<n;i++)t[i].fn(e);else console.warn(`[EventBoundary]: Event mapping not defined for ${e.type}`)}hitTest(e,t){mr.pauseUpdate=!0;const i=this._isPointerMoveEvent&&this.enableGlobalMoveEvents?"hitTestMoveRecursive":"hitTestRecursive",n=this[i](this.rootTarget,this.rootTarget.eventMode,WE.set(e,t),this.hitTestFn,this.hitPruneFn);return n&&n[0]}propagate(e,t){if(!e.target)return;const i=e.composedPath();e.eventPhase=e.CAPTURING_PHASE;for(let n=0,r=i.length-1;n<r;n++)if(e.currentTarget=i[n],this.notifyTarget(e,t),e.propagationStopped||e.propagationImmediatelyStopped)return;if(e.eventPhase=e.AT_TARGET,e.currentTarget=e.target,this.notifyTarget(e,t),!(e.propagationStopped||e.propagationImmediatelyStopped)){e.eventPhase=e.BUBBLING_PHASE;for(let n=i.length-2;n>=0;n--)if(e.currentTarget=i[n],this.notifyTarget(e,t),e.propagationStopped||e.propagationImmediatelyStopped)return}}all(e,t,i=this._allInteractiveElements){if(i.length===0)return;e.eventPhase=e.BUBBLING_PHASE;const n=Array.isArray(t)?t:[t];for(let r=i.length-1;r>=0;r--)n.forEach(o=>{e.currentTarget=i[r],this.notifyTarget(e,o)})}propagationPath(e){const t=[e];for(let i=0;i<HE&&e!==this.rootTarget;i++){if(!e.parent)throw new Error("Cannot find propagation path to disconnected target");t.push(e.parent),e=e.parent}return t.reverse(),t}hitTestMoveRecursive(e,t,i,n,r,o=!1){let a=!1;if(this._interactivePrune(e))return null;if((e.eventMode==="dynamic"||t==="dynamic")&&(mr.pauseUpdate=!1),e.interactiveChildren&&e.children){const h=e.children;for(let u=h.length-1;u>=0;u--){const d=h[u],f=this.hitTestMoveRecursive(d,this._isInteractive(t)?t:d.eventMode,i,n,r,o||r(e,i));if(f){if(f.length>0&&!f[f.length-1].parent)continue;const m=e.isInteractive();(f.length>0||m)&&(m&&this._allInteractiveElements.push(e),f.push(e)),this._hitElements.length===0&&(this._hitElements=f),a=!0}}}const c=this._isInteractive(t),l=e.isInteractive();return c&&l&&this._allInteractiveElements.push(e),o||this._hitElements.length>0?null:a?this._hitElements:c&&!r(e,i)&&n(e,i)?l?[e]:[]:null}hitTestRecursive(e,t,i,n,r){if(this._interactivePrune(e)||r(e,i))return null;if((e.eventMode==="dynamic"||t==="dynamic")&&(mr.pauseUpdate=!1),e.interactiveChildren&&e.children){const c=e.children;for(let l=c.length-1;l>=0;l--){const h=c[l],u=this.hitTestRecursive(h,this._isInteractive(t)?t:h.eventMode,i,n,r);if(u){if(u.length>0&&!u[u.length-1].parent)continue;const d=e.isInteractive();return(u.length>0||d)&&u.push(e),u}}}const o=this._isInteractive(t),a=e.isInteractive();return o&&n(e,i)?a?[e]:[]:null}_isInteractive(e){return e==="static"||e==="dynamic"}_interactivePrune(e){return!!(!e||e.isMask||!e.visible||!e.renderable||e.eventMode==="none"||e.eventMode==="passive"&&!e.interactiveChildren||e.isMask)}hitPruneFn(e,t){var i;if(e.hitArea&&(e.worldTransform.applyInverse(t,qd),!e.hitArea.contains(qd.x,qd.y)))return!0;if(e._mask){const n=e._mask.isMaskData?e._mask.maskObject:e._mask;if(n&&!((i=n.containsPoint)!=null&&i.call(n,t)))return!0}return!1}hitTestFn(e,t){return e.eventMode==="passive"?!1:e.hitArea?!0:e.containsPoint?e.containsPoint(t):!1}notifyTarget(e,t){var r,o;t=t??e.type;const i=`on${t}`;(o=(r=e.currentTarget)[i])==null||o.call(r,e);const n=e.eventPhase===e.CAPTURING_PHASE||e.eventPhase===e.AT_TARGET?`${t}capture`:t;this.notifyListeners(e,n),e.eventPhase===e.AT_TARGET&&this.notifyListeners(e,t)}mapPointerDown(e){if(!(e instanceof Cs)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const t=this.createPointerEvent(e);if(this.dispatchEvent(t,"pointerdown"),t.pointerType==="touch")this.dispatchEvent(t,"touchstart");else if(t.pointerType==="mouse"||t.pointerType==="pen"){const n=t.button===2;this.dispatchEvent(t,n?"rightdown":"mousedown")}const i=this.trackingData(e.pointerId);i.pressTargetsByButton[e.button]=t.composedPath(),this.freeEvent(t)}mapPointerMove(e){var c,l;if(!(e instanceof Cs)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}this._allInteractiveElements.length=0,this._hitElements.length=0,this._isPointerMoveEvent=!0;const t=this.createPointerEvent(e);this._isPointerMoveEvent=!1;const i=t.pointerType==="mouse"||t.pointerType==="pen",n=this.trackingData(e.pointerId),r=this.findMountedTarget(n.overTargets);if(((c=n.overTargets)==null?void 0:c.length)>0&&r!==t.target){const h=e.type==="mousemove"?"mouseout":"pointerout",u=this.createPointerEvent(e,h,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 h=e.type==="mousemove"?"mouseover":"pointerover",u=this.clonePointerEvent(t,h);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 o=[],a=this.enableGlobalMoveEvents??!0;this.moveOnAll?o.push("pointermove"):this.dispatchEvent(t,"pointermove"),a&&o.push("globalpointermove"),t.pointerType==="touch"&&(this.moveOnAll?o.splice(1,0,"touchmove"):this.dispatchEvent(t,"touchmove"),a&&o.push("globaltouchmove")),i&&(this.moveOnAll?o.splice(1,0,"mousemove"):this.dispatchEvent(t,"mousemove"),a&&o.push("globalmousemove"),this.cursor=(l=t.target)==null?void 0:l.cursor),o.length>0&&this.all(t,o),this._allInteractiveElements.length=0,this._hitElements.length=0,n.overTargets=t.composedPath(),this.freeEvent(t)}mapPointerOver(e){var o;if(!(e instanceof Cs)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const t=this.trackingData(e.pointerId),i=this.createPointerEvent(e),n=i.pointerType==="mouse"||i.pointerType==="pen";this.dispatchEvent(i,"pointerover"),n&&this.dispatchEvent(i,"mouseover"),i.pointerType==="mouse"&&(this.cursor=(o=i.target)==null?void 0:o.cursor);const r=this.clonePointerEvent(i,"pointerenter");for(r.eventPhase=r.AT_TARGET;r.target&&r.target!==this.rootTarget.parent;)r.currentTarget=r.target,this.notifyTarget(r),n&&this.notifyTarget(r,"mouseenter"),r.target=r.target.parent;t.overTargets=i.composedPath(),this.freeEvent(i),this.freeEvent(r)}mapPointerOut(e){if(!(e instanceof Cs)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const t=this.trackingData(e.pointerId);if(t.overTargets){const i=e.pointerType==="mouse"||e.pointerType==="pen",n=this.findMountedTarget(t.overTargets),r=this.createPointerEvent(e,"pointerout",n);this.dispatchEvent(r),i&&this.dispatchEvent(r,"mouseout");const o=this.createPointerEvent(e,"pointerleave",n);for(o.eventPhase=o.AT_TARGET;o.target&&o.target!==this.rootTarget.parent;)o.currentTarget=o.target,this.notifyTarget(o),i&&this.notifyTarget(o,"mouseleave"),o.target=o.target.parent;t.overTargets=null,this.freeEvent(r),this.freeEvent(o)}this.cursor=null}mapPointerUp(e){if(!(e instanceof Cs)){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 a=i.button===2;this.dispatchEvent(i,a?"rightup":"mouseup")}const n=this.trackingData(e.pointerId),r=this.findMountedTarget(n.pressTargetsByButton[e.button]);let o=r;if(r&&!i.composedPath().includes(r)){let a=r;for(;a&&!i.composedPath().includes(a);){if(i.currentTarget=a,this.notifyTarget(i,"pointerupoutside"),i.pointerType==="touch")this.notifyTarget(i,"touchendoutside");else if(i.pointerType==="mouse"||i.pointerType==="pen"){const c=i.button===2;this.notifyTarget(i,c?"rightupoutside":"mouseupoutside")}a=a.parent}delete n.pressTargetsByButton[e.button],o=a}if(o){const a=this.clonePointerEvent(i,"click");a.target=o,a.path=null,n.clicksByButton[e.button]||(n.clicksByButton[e.button]={clickCount:0,target:a.target,timeStamp:t});const c=n.clicksByButton[e.button];if(c.target===a.target&&t-c.timeStamp<200?++c.clickCount:c.clickCount=1,c.target=a.target,c.timeStamp=t,a.detail=c.clickCount,a.pointerType==="mouse"){const l=a.button===2;this.dispatchEvent(a,l?"rightclick":"click")}else a.pointerType==="touch"&&this.dispatchEvent(a,"tap");this.dispatchEvent(a,"pointertap"),this.freeEvent(a)}this.freeEvent(i)}mapPointerUpOutside(e){if(!(e instanceof Cs)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const t=this.trackingData(e.pointerId),i=this.findMountedTarget(t.pressTargetsByButton[e.button]),n=this.createPointerEvent(e);if(i){let r=i;for(;r;)n.currentTarget=r,this.notifyTarget(n,"pointerupoutside"),n.pointerType==="touch"?this.notifyTarget(n,"touchendoutside"):(n.pointerType==="mouse"||n.pointerType==="pen")&&this.notifyTarget(n,n.button===2?"rightupoutside":"mouseupoutside"),r=r.parent;delete t.pressTargetsByButton[e.button]}this.freeEvent(n)}mapWheel(e){if(!(e instanceof ea)){console.warn("EventBoundary cannot map a non-wheel event as a wheel event");return}const t=this.createWheelEvent(e);this.dispatchEvent(t),this.freeEvent(t)}findMountedTarget(e){if(!e)return null;let t=e[0];for(let i=1;i<e.length&&e[i].parent===t;i++)t=e[i];return t}createPointerEvent(e,t,i){const n=this.allocateEvent(Cs);return this.copyPointerData(e,n),this.copyMouseData(e,n),this.copyData(e,n),n.nativeEvent=e.nativeEvent,n.originalEvent=e,n.target=i??this.hitTest(n.global.x,n.global.y)??this._hitElements[0],typeof t=="string"&&(n.type=t),n}createWheelEvent(e){const t=this.allocateEvent(ea);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(Cs);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 Cs&&t instanceof Cs&&(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 ch&&t instanceof ch&&(t.altKey=e.altKey,t.button=e.button,t.buttons=e.buttons,t.client.copyFrom(e.client),t.ctrlKey=e.ctrlKey,t.metaKey=e.metaKey,t.movement.copyFrom(e.movement),t.screen.copyFrom(e.screen),t.shiftKey=e.shiftKey,t.global.copyFrom(e.global))}copyData(e,t){t.isTrusted=e.isTrusted,t.srcElement=e.srcElement,t.timeStamp=performance.now(),t.type=e.type,t.detail=e.detail,t.view=e.view,t.which=e.which,t.layer.copyFrom(e.layer),t.page.copyFrom(e.page)}trackingData(e){return this.mappingState.trackingData[e]||(this.mappingState.trackingData[e]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[e]}allocateEvent(e){this.eventPool.has(e)||this.eventPool.set(e,[]);const t=this.eventPool.get(e).pop()||new e(this);return t.eventPhase=t.NONE,t.currentTarget=null,t.path=null,t.target=null,t}freeEvent(e){if(e.manager!==this)throw new Error("It is illegal to free an event not managed by this EventBoundary!");const t=e.constructor;this.eventPool.has(t)||this.eventPool.set(t,[]),this.eventPool.get(t).push(e)}notifyListeners(e,t){const i=e.currentTarget._events[t];if(i&&e.currentTarget.isInteractive())if("fn"in i)i.once&&e.currentTarget.removeListener(t,i.fn,void 0,!0),i.fn.call(i.context,e);else for(let n=0,r=i.length;n<r&&!e.propagationImmediatelyStopped;n++)i[n].once&&e.currentTarget.removeListener(t,i[n].fn,void 0,!0),i[n].fn.call(i[n].context,e)}}const qE=1,KE={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},om=class am{constructor(e){this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.domElement=null,this.resolution=1,this.renderer=e,this.rootBoundary=new zE(null),mr.init(this),this.autoPreventDefault=!0,this.eventsAdded=!1,this.rootPointerEvent=new Cs(null),this.rootWheelEvent=new ea(null),this.cursorStyles={default:"inherit",pointer:"pointer"},this.features=new Proxy({...am.defaultEventFeatures},{set:(t,i,n)=>(i==="globalMove"&&(this.rootBoundary.enableGlobalMoveEvents=n),t[i]=n,!0)}),this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.onPointerOverOut=this.onPointerOverOut.bind(this),this.onWheel=this.onWheel.bind(this)}static get defaultEventMode(){return this._defaultEventMode}init(e){const{view:t,resolution:i}=this.renderer;this.setTargetElement(t),this.resolution=i,am._defaultEventMode=e.eventMode??"auto",Object.assign(this.features,e.eventFeatures??{}),this.rootBoundary.enableGlobalMoveEvents=this.features.globalMove}resolutionChange(e){this.resolution=e}destroy(){this.setTargetElement(null),this.renderer=null}setCursor(e){e=e||"default";let t=!0;if(globalThis.OffscreenCanvas&&this.domElement instanceof OffscreenCanvas&&(t=!1),this.currentCursor===e)return;this.currentCursor=e;const i=this.cursorStyles[e];if(i)switch(typeof i){case"string":t&&(this.domElement.style.cursor=i);break;case"function":i(e);break;case"object":t&&Object.assign(this.domElement.style,i);break}else t&&typeof e=="string"&&!Object.prototype.hasOwnProperty.call(this.cursorStyles,e)&&(this.domElement.style.cursor=e)}get pointer(){return this.rootPointerEvent}onPointerDown(e){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;const t=this.normalizeToPointerData(e);this.autoPreventDefault&&t[0].isNormalized&&(e.cancelable||!("cancelable"in e))&&e.preventDefault();for(let i=0,n=t.length;i<n;i++){const r=t[i],o=this.bootstrapEvent(this.rootPointerEvent,r);this.rootBoundary.mapEvent(o)}this.setCursor(this.rootBoundary.cursor)}onPointerMove(e){if(!this.features.move)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,mr.pointerMoved();const t=this.normalizeToPointerData(e);for(let i=0,n=t.length;i<n;i++){const r=this.bootstrapEvent(this.rootPointerEvent,t[i]);this.rootBoundary.mapEvent(r)}this.setCursor(this.rootBoundary.cursor)}onPointerUp(e){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let t=e.target;e.composedPath&&e.composedPath().length>0&&(t=e.composedPath()[0]);const i=t!==this.domElement?"outside":"",n=this.normalizeToPointerData(e);for(let r=0,o=n.length;r<o;r++){const a=this.bootstrapEvent(this.rootPointerEvent,n[r]);a.type+=i,this.rootBoundary.mapEvent(a)}this.setCursor(this.rootBoundary.cursor)}onPointerOverOut(e){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;const t=this.normalizeToPointerData(e);for(let i=0,n=t.length;i<n;i++){const r=this.bootstrapEvent(this.rootPointerEvent,t[i]);this.rootBoundary.mapEvent(r)}this.setCursor(this.rootBoundary.cursor)}onWheel(e){if(!this.features.wheel)return;const t=this.normalizeWheelEvent(e);this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,this.rootBoundary.mapEvent(t)}setTargetElement(e){this.removeEvents(),this.domElement=e,mr.domElement=e,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;mr.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;mr.removeTickerListener();const e=this.domElement.style;globalThis.navigator.msPointerEnabled?(e.msContentZooming="",e.msTouchAction=""):this.supportsPointerEvents&&(e.touchAction=""),this.supportsPointerEvents?(globalThis.document.removeEventListener("pointermove",this.onPointerMove,!0),this.domElement.removeEventListener("pointerdown",this.onPointerDown,!0),this.domElement.removeEventListener("pointerleave",this.onPointerOverOut,!0),this.domElement.removeEventListener("pointerover",this.onPointerOverOut,!0),globalThis.removeEventListener("pointerup",this.onPointerUp,!0)):(globalThis.document.removeEventListener("mousemove",this.onPointerMove,!0),this.domElement.removeEventListener("mousedown",this.onPointerDown,!0),this.domElement.removeEventListener("mouseout",this.onPointerOverOut,!0),this.domElement.removeEventListener("mouseover",this.onPointerOverOut,!0),globalThis.removeEventListener("mouseup",this.onPointerUp,!0),this.supportsTouchEvents&&(this.domElement.removeEventListener("touchstart",this.onPointerDown,!0),this.domElement.removeEventListener("touchend",this.onPointerUp,!0),this.domElement.removeEventListener("touchmove",this.onPointerMove,!0))),this.domElement.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this.eventsAdded=!1}mapPositionToPoint(e,t,i){const n=this.domElement.isConnected?this.domElement.getBoundingClientRect():{width:this.domElement.width,height:this.domElement.height,left:0,top:0},r=1/this.resolution;e.x=(t-n.left)*(this.domElement.width/n.width)*r,e.y=(i-n.top)*(this.domElement.height/n.height)*r}normalizeToPointerData(e){const t=[];if(this.supportsTouchEvents&&e instanceof TouchEvent)for(let i=0,n=e.changedTouches.length;i<n;i++){const r=e.changedTouches[i];typeof r.button>"u"&&(r.button=0),typeof r.buttons>"u"&&(r.buttons=1),typeof r.isPrimary>"u"&&(r.isPrimary=e.touches.length===1&&e.type==="touchstart"),typeof r.width>"u"&&(r.width=r.radiusX||1),typeof r.height>"u"&&(r.height=r.radiusY||1),typeof r.tiltX>"u"&&(r.tiltX=0),typeof r.tiltY>"u"&&(r.tiltY=0),typeof r.pointerType>"u"&&(r.pointerType="touch"),typeof r.pointerId>"u"&&(r.pointerId=r.identifier||0),typeof r.pressure>"u"&&(r.pressure=r.force||.5),typeof r.twist>"u"&&(r.twist=0),typeof r.tangentialPressure>"u"&&(r.tangentialPressure=0),typeof r.layerX>"u"&&(r.layerX=r.offsetX=r.clientX),typeof r.layerY>"u"&&(r.layerY=r.offsetY=r.clientY),r.isNormalized=!0,r.type=e.type,t.push(r)}else if(!globalThis.MouseEvent||e instanceof MouseEvent&&(!this.supportsPointerEvents||!(e instanceof globalThis.PointerEvent))){const i=e;typeof i.isPrimary>"u"&&(i.isPrimary=!0),typeof i.width>"u"&&(i.width=1),typeof i.height>"u"&&(i.height=1),typeof i.tiltX>"u"&&(i.tiltX=0),typeof i.tiltY>"u"&&(i.tiltY=0),typeof i.pointerType>"u"&&(i.pointerType="mouse"),typeof i.pointerId>"u"&&(i.pointerId=qE),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=KE[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}};om.extension={name:"events",type:[ke.RendererSystem,ke.CanvasRendererSystem]},om.defaultEventFeatures={move:!0,globalMove:!0,click:!0,wheel:!0};let lm=om;$e.add(lm);function uv(s){return s==="dynamic"||s==="static"}const ZE={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??uv(lm.defaultEventMode)},set interactive(s){mt("7.2.0","Setting interactive is deprecated, use eventMode = 'none'/'passive'/'auto'/'static'/'dynamic' instead."),this._internalInteractive=s,this.eventMode=s?"static":"auto"},_internalEventMode:void 0,get eventMode(){return this._internalEventMode??lm.defaultEventMode},set eventMode(s){this._internalInteractive=uv(s),this._internalEventMode=s},isInteractive(){return this.eventMode==="static"||this.eventMode==="dynamic"},interactiveChildren:!0,hitArea:null,addEventListener(s,e,t){const i=typeof t=="boolean"&&t||typeof t=="object"&&t.capture,n=typeof t=="object"?t.signal:void 0,r=typeof t=="object"?t.once===!0:!1,o=typeof e=="function"?void 0:e;s=i?`${s}capture`:s;const a=typeof e=="function"?e:e.handleEvent,c=this;n&&n.addEventListener("abort",()=>{c.off(s,a,o)}),r?c.once(s,a,o):c.on(s,a,o)},removeEventListener(s,e,t){const i=typeof t=="boolean"&&t||typeof t=="object"&&t.capture,n=typeof e=="function"?void 0:e;s=i?`${s}capture`:s,e=typeof e=="function"?e:e.handleEvent,this.off(s,e,n)},dispatchEvent(s){if(!(s instanceof Pl))throw new Error("DisplayObject cannot propagate events outside of the Federated Events API");return s.defaultPrevented=!1,s.path=null,s.target=this,s.manager.dispatchEvent(s),!s.defaultPrevented}};Kt.mixin(ZE);const JE={accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:!1,_accessibleDiv:null,accessibleType:"button",accessiblePointerEvents:"auto",accessibleChildren:!0,renderId:-1};Kt.mixin(JE);const QE=9,nc=100,eA=0,tA=0,dv=2,fv=1,iA=-1e3,sA=-1e3,nA=2;class e1{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,(kn.tablet||kn.phone)&&this.createTouchHook();const t=document.createElement("div");t.style.width=`${nc}px`,t.style.height=`${nc}px`,t.style.position="absolute",t.style.top=`${eA}px`,t.style.left=`${tA}px`,t.style.zIndex=dv.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=`${fv}px`,e.style.height=`${fv}px`,e.style.position="absolute",e.style.top=`${iA}px`,e.style.left=`${sA}px`,e.style.zIndex=nA.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(kn.android.device&&e<this.androidUpdateCount||(this.androidUpdateCount=e+this.androidUpdateFrequency,!this.renderer.renderingToScreen))return;this.renderer.lastObjectRendered&&this.updateAccessibleObjects(this.renderer.lastObjectRendered);const{x:t,y:i,width:n,height:r}=this.renderer.view.getBoundingClientRect(),{width:o,height:a,resolution:c}=this.renderer,l=n/o*c,h=r/a*c;let u=this.div;u.style.left=`${t}px`,u.style.top=`${i}px`,u.style.width=`${o}px`,u.style.height=`${a}px`;for(let d=0;d<this.children.length;d++){const f=this.children[d];if(f.renderId!==this.renderId)f._accessibleActive=!1,Jo(this.children,d,1),this.div.removeChild(f._accessibleDiv),this.pool.push(f._accessibleDiv),f._accessibleDiv=null,d--;else{u=f._accessibleDiv;let m=f.hitArea;const p=f.worldTransform;f.hitArea?(u.style.left=`${(p.tx+m.x*p.a)*l}px`,u.style.top=`${(p.ty+m.y*p.d)*h}px`,u.style.width=`${m.width*p.a*l}px`,u.style.height=`${m.height*p.d*h}px`):(m=f.getBounds(),this.capHitArea(m),u.style.left=`${m.x*l}px`,u.style.top=`${m.y*h}px`,u.style.width=`${m.width*l}px`,u.style.height=`${m.height*h}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=`${nc}px`,t.style.height=`${nc}px`,t.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",t.style.position="absolute",t.style.zIndex=dv.toString(),t.style.borderStyle="none",navigator.userAgent.toLowerCase().includes("chrome")?t.setAttribute("aria-live","off"):t.setAttribute("aria-live","polite"),navigator.userAgent.match(/rv:.*Gecko\//)?t.setAttribute("aria-relevant","additions"):t.setAttribute("aria-relevant","text"),t.addEventListener("click",this._onClick.bind(this)),t.addEventListener("focus",this._onFocus.bind(this)),t.addEventListener("focusout",this._onFocusOut.bind(this))),t.style.pointerEvents=e.accessiblePointerEvents,t.type=e.accessibleType,e.accessibleTitle&&e.accessibleTitle!==null?t.title=e.accessibleTitle:(!e.accessibleHint||e.accessibleHint===null)&&(t.title=`displayObject ${e.tabIndex}`),e.accessibleHint&&e.accessibleHint!==null&&t.setAttribute("aria-label",e.accessibleHint),this.debug&&this.updateDebugHTML(t),e._accessibleActive=!0,e._accessibleDiv=t,t.displayObject=e,this.children.push(e),this.div.appendChild(e._accessibleDiv),e._accessibleDiv.tabIndex=e.tabIndex}_dispatchEvent(e,t){const{displayObject:i}=e.target,n=this.renderer.events.rootBoundary,r=Object.assign(new Pl(n),{target:i});n.rootTarget=this.renderer.lastObjectRendered,t.forEach(o=>n.dispatchEvent(r,o))}_onClick(e){this._dispatchEvent(e,["click","pointertap","tap"])}_onFocus(e){e.target.getAttribute("aria-live")||e.target.setAttribute("aria-live","assertive"),this._dispatchEvent(e,["mouseover"])}_onFocusOut(e){e.target.getAttribute("aria-live")||e.target.setAttribute("aria-live","polite"),this._dispatchEvent(e,["mouseout"])}_onKeyDown(e){e.keyCode===QE&&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}}e1.extension={name:"accessibility",type:[ke.RendererPlugin,ke.CanvasRendererPlugin]};$e.add(e1);const t1=class cm{constructor(e){this.stage=new gi,e=Object.assign({forceCanvas:!1},e),this.renderer=mE(e),cm._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=cm._plugins.slice(0);i.reverse(),i.forEach(n=>{n.destroy.call(this)}),this.stage.destroy(t),this.stage=null,this.renderer.destroy(e),this.renderer=null}};t1._plugins=[];let i1=t1;$e.handleByList(ke.Application,i1._plugins);class s1{static init(e){Object.defineProperty(this,"resizeTo",{set(t){globalThis.removeEventListener("resize",this.queueResize),this._resizeTo=t,t&&(globalThis.addEventListener("resize",this.queueResize),this.resize())},get(){return this._resizeTo}}),this.queueResize=()=>{this._resizeTo&&(this.cancelResize(),this._resizeId=requestAnimationFrame(()=>this.resize()))},this.cancelResize=()=>{this._resizeId&&(cancelAnimationFrame(this._resizeId),this._resizeId=null)},this.resize=()=>{if(!this._resizeTo)return;this.cancelResize();let t,i;if(this._resizeTo===globalThis.window)t=globalThis.innerWidth,i=globalThis.innerHeight;else{const{clientWidth:n,clientHeight:r}=this._resizeTo;t=n,i=r}this.renderer.resize(t,i),this.render()},this._resizeId=null,this._resizeTo=null,this.resizeTo=e.resizeTo||null}static destroy(){globalThis.removeEventListener("resize",this.queueResize),this.cancelResize(),this.cancelResize=null,this.queueResize=null,this.resizeTo=null,this.resize=null}}s1.extension=ke.Application;$e.add(s1);const mv={loader:ke.LoadParser,resolver:ke.ResolveParser,cache:ke.CacheParser,detection:ke.DetectionParser};$e.handle(ke.Asset,s=>{const e=s.ref;Object.entries(mv).filter(([t])=>!!e[t]).forEach(([t,i])=>$e.add(Object.assign(e[t],{extension:e[t].extension??i})))},s=>{const e=s.ref;Object.keys(mv).filter(t=>!!e[t]).forEach(t=>$e.remove(e[t]))});class rA{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 ya(s,e){if(Array.isArray(e)){for(const t of e)if(s.startsWith(`data:${t}`))return!0;return!1}return s.startsWith(`data:${e}`)}function Ki(s,e){const t=s.split("?")[0],i=si.extname(t).toLowerCase();return Array.isArray(e)?e.includes(i):i===e}const As=(s,e,t=!1)=>(Array.isArray(s)||(s=[s]),e?s.map(i=>typeof i=="string"||t?e(i):i):s),hh=(s,e)=>{const t=e.split("?")[1];return t&&(s+=`?${t}`),s};function n1(s,e,t,i,n){const r=e[t];for(let o=0;o<r.length;o++){const a=r[o];t<e.length-1?n1(s.replace(i[t],a),e,t+1,i,n):n.push(s.replace(i[t],a))}}function oA(s){const e=/\{(.*?)\}/g,t=s.match(e),i=[];if(t){const n=[];t.forEach(r=>{const o=r.substring(1,r.length-1).split(",");n.push(o)}),n1(s,n,0,t,i)}else i.push(s);return i}const uh=s=>!Array.isArray(s);class aA{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=As(e);let n;for(let a=0;a<this.parsers.length;a++){const c=this.parsers[a];if(c.test(t)){n=c.getCacheableAssets(i,t);break}}n||(n={},i.forEach(a=>{n[a]=t}));const r=Object.keys(n),o={cacheKeys:r,keys:i};if(i.forEach(a=>{this._cacheMap.set(a,o)}),r.forEach(a=>{const c=n?n[a]:t;this._cache.has(a)&&this._cache.get(a)!==c&&console.warn("[Cache] already has key:",a),this._cache.set(a,n[a])}),t instanceof Ke){const a=t;i.forEach(c=>{a.baseTexture!==Ke.EMPTY.baseTexture&&it.addToCache(a.baseTexture,c),Ke.addToCache(a,c)})}}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 qr=new aA;class lA{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 o,a;let n=null,r=null;if(t.loadParser&&(r=this._parserHash[t.loadParser],r||console.warn(`[Assets] specified load parser "${t.loadParser}" not found while loading ${e}`)),!r){for(let c=0;c<this.parsers.length;c++){const l=this.parsers[c];if(l.load&&((o=l.test)!=null&&o.call(l,e,t,this))){r=l;break}}if(!r)return console.warn(`[Assets] ${e} could not be loaded as we don't know how to parse it, ensure the correct parser has been added`),null}n=await r.load(e,t,this),i.parser=r;for(let c=0;c<this.parsers.length;c++){const l=this.parsers[c];l.parse&&l.parse&&await((a=l.testParse)==null?void 0:a.call(l,n,t,this))&&(n=await l.parse(n,t,this)||n,i.parser=l)}return n})(),i}async load(e,t){this._parsersValidated||this._validateParsers();let i=0;const n={},r=uh(e),o=As(e,l=>({alias:[l],src:l})),a=o.length,c=o.map(async l=>{const h=si.toAbsolute(l.src);if(!n[l.src])try{this.promiseCache[h]||(this.promiseCache[h]=this._getLoadPromiseAndParser(h,l)),n[l.src]=await this.promiseCache[h].promise,t&&t(++i/a)}catch(u){throw delete this.promiseCache[h],delete n[l.src],new Error(`[Loader.load] Failed to load ${h}.
|
||
${u}`)}});return await Promise.all(c),r?n[o[0].src]:n}async unload(e){const t=As(e,i=>({alias:[i],src:i})).map(async i=>{var o,a;const n=si.toAbsolute(i.src),r=this.promiseCache[n];if(r){const c=await r.promise;delete this.promiseCache[n],(a=(o=r.parser)==null?void 0:o.unload)==null||a.call(o,c,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 os=(s=>(s[s.Low=0]="Low",s[s.Normal=1]="Normal",s[s.High=2]="High",s))(os||{});const cA=".json",hA="application/json",uA={extension:{type:ke.LoadParser,priority:os.Low},name:"loadJson",test(s){return ya(s,hA)||Ki(s,cA)},async load(s){return await(await Be.ADAPTER.fetch(s)).json()}};$e.add(uA);const dA=".txt",fA="text/plain",mA={name:"loadTxt",extension:{type:ke.LoadParser,priority:os.Low},test(s){return ya(s,fA)||Ki(s,dA)},async load(s){return await(await Be.ADAPTER.fetch(s)).text()}};$e.add(mA);const pA=["normal","bold","100","200","300","400","500","600","700","800","900"],gA=[".ttf",".otf",".woff",".woff2"],vA=["font/ttf","font/otf","font/woff","font/woff2"],yA=/^(--|-?[A-Z_])[0-9A-Z_-]*$/i;function xA(s){const e=si.extname(s),t=si.basename(s,e).replace(/(-|_)/g," ").toLowerCase().split(" ").map(r=>r.charAt(0).toUpperCase()+r.slice(1));let i=t.length>0;for(const r of t)if(!r.match(yA)){i=!1;break}let n=t.join(" ");return i||(n=`"${n.replace(/[\\"]/g,"\\$&")}"`),n}const bA=/^[0-9A-Za-z%:/?#\[\]@!\$&'()\*\+,;=\-._~]*$/;function wA(s){return bA.test(s)?s:encodeURI(s)}const SA={extension:{type:ke.LoadParser,priority:os.Low},name:"loadWebFont",test(s){return ya(s,vA)||Ki(s,gA)},async load(s,e){var i,n,r;const t=Be.ADAPTER.getFontFaceSet();if(t){const o=[],a=((i=e.data)==null?void 0:i.family)??xA(s),c=((r=(n=e.data)==null?void 0:n.weights)==null?void 0:r.filter(h=>pA.includes(h)))??["normal"],l=e.data??{};for(let h=0;h<c.length;h++){const u=c[h],d=new FontFace(a,`url(${wA(s)})`,{...l,weight:u});await d.load(),t.add(d),o.push(d)}return o.length===1?o[0]:o}return console.warn("[loadWebFont] FontFace API is not supported. Skipping loading font"),null},unload(s){(Array.isArray(s)?s:[s]).forEach(e=>Be.ADAPTER.getFontFaceSet().delete(e))}};$e.add(SA);const MA=`(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 ta=null,hm=class{constructor(){ta||(ta=URL.createObjectURL(new Blob([MA],{type:"application/javascript"}))),this.worker=new Worker(ta)}};hm.revokeObjectURL=function(){ta&&(URL.revokeObjectURL(ta),ta=null)};const TA=`(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 ia=null;class r1{constructor(){ia||(ia=URL.createObjectURL(new Blob([TA],{type:"application/javascript"}))),this.worker=new Worker(ia)}}r1.revokeObjectURL=function(){ia&&(URL.revokeObjectURL(ia),ia=null)};let pv=0,Kd;class _A{constructor(){this._initialized=!1,this._createdWorkers=0,this.workerPool=[],this.queue=[],this.resolveHash={}}isImageBitmapSupported(){return this._isImageBitmapSupported!==void 0?this._isImageBitmapSupported:(this._isImageBitmapSupported=new Promise(e=>{const{worker:t}=new hm;t.addEventListener("message",i=>{t.terminate(),hm.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 r1().worker,e.addEventListener("message",t=>{this.complete(t.data),this.returnWorker(t.target),this.next()})),e}returnWorker(e){this.workerPool.push(e)}complete(e){e.error!==void 0?this.resolveHash[e.uuid].reject(e.error):this.resolveHash[e.uuid].resolve(e.data),this.resolveHash[e.uuid]=null}async _run(e,t){await this._initWorkers();const i=new Promise((n,r)=>{this.queue.push({id:e,arguments:t,resolve:n,reject:r})});return this.next(),i}next(){if(!this.queue.length)return;const e=this.getWorker();if(!e)return;const t=this.queue.pop(),i=t.id;this.resolveHash[pv]={resolve:t.resolve,reject:t.reject},e.postMessage({data:t.arguments,uuid:pv++,id:i})}}const gv=new _A;function kl(s,e,t){s.resource.internal=!0;const i=new Ke(s),n=()=>{delete e.promiseCache[t],qr.has(t)&&qr.remove(t)};return i.baseTexture.once("destroyed",()=>{t in e.promiseCache&&(console.warn("[Assets] A BaseTexture managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the BaseTexture."),n())}),i.once("destroyed",()=>{s.destroyed||(console.warn("[Assets] A Texture managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the Texture."),n())}),i}const CA=[".jpeg",".jpg",".png",".webp",".avif"],EA=["image/jpeg","image/png","image/webp","image/avif"];async function AA(s){const e=await Be.ADAPTER.fetch(s);if(!e.ok)throw new Error(`[loadImageBitmap] Failed to fetch ${s}: ${e.status} ${e.statusText}`);const t=await e.blob();return await createImageBitmap(t)}const du={name:"loadTextures",extension:{type:ke.LoadParser,priority:os.High},config:{preferWorkers:!0,preferCreateImageBitmap:!0,crossOrigin:"anonymous"},test(s){return ya(s,EA)||Ki(s,CA)},async load(s,e,t){var a;const i=globalThis.createImageBitmap&&this.config.preferCreateImageBitmap;let n;i?this.config.preferWorkers&&await gv.isImageBitmapSupported()?n=await gv.loadImageBitmap(s):n=await AA(s):n=await new Promise((c,l)=>{const h=new Image;h.crossOrigin=this.config.crossOrigin,h.src=s,h.complete?c(h):(h.onload=()=>c(h),h.onerror=u=>l(u))});const r={...e.data};r.resolution??(r.resolution=Hn(s)),i&&((a=r.resourceOptions)==null?void 0:a.ownsImageBitmap)===void 0&&(r.resourceOptions={...r.resourceOptions},r.resourceOptions.ownsImageBitmap=!0);const o=new it(n,r);return o.resource.src=s,kl(o,t,s)},unload(s){s.destroy(!0)}};$e.add(du);const IA=".svg",RA="image/svg+xml",PA={extension:{type:ke.LoadParser,priority:os.High},name:"loadSVG",test(s){return ya(s,RA)||Ki(s,IA)},async testParse(s){return em.test(s)},async parse(s,e,t){var r;const i=new em(s,(r=e==null?void 0:e.data)==null?void 0:r.resourceOptions);await i.load();const n=new it(i,{resolution:Hn(s),...e==null?void 0:e.data});return n.resource.src=e.src,kl(n,t,e.src)},async load(s,e){return(await Be.ADAPTER.fetch(s)).text()},unload:du.unload};$e.add(PA);const kA=[".mp4",".m4v",".webm",".ogv"],FA=["video/mp4","video/webm","video/ogg"],OA={name:"loadVideo",extension:{type:ke.LoadParser,priority:os.High},config:{defaultAutoPlay:!0,defaultUpdateFPS:0,defaultLoop:!1,defaultMuted:!1,defaultPlaysinline:!0},test(s){return ya(s,FA)||Ki(s,kA)},async load(s,e,t){var o;let i;const n=await(await Be.ADAPTER.fetch(s)).blob(),r=URL.createObjectURL(n);try{const a={autoPlay:this.config.defaultAutoPlay,updateFPS:this.config.defaultUpdateFPS,loop:this.config.defaultLoop,muted:this.config.defaultMuted,playsinline:this.config.defaultPlaysinline,...(o=e==null?void 0:e.data)==null?void 0:o.resourceOptions,autoLoad:!0},c=new Zb(r,a);await c.load();const l=new it(c,{alphaMode:await X_(),resolution:Hn(s),...e==null?void 0:e.data});l.resource.src=s,i=kl(l,t,s),i.baseTexture.once("destroyed",()=>{URL.revokeObjectURL(r)})}catch(a){throw URL.revokeObjectURL(r),a}return i},unload(s){s.destroy(!0)}};$e.add(OA);class LA{constructor(){this._defaultBundleIdentifierOptions={connector:"-",createBundleAssetId:(e,t)=>`${e}${this._bundleIdConnector}${t}`,extractAssetIdFromBundle:(e,t)=>t.replace(`${e}${this._bundleIdConnector}`,"")},this._bundleIdConnector=this._defaultBundleIdentifierOptions.connector,this._createBundleAssetId=this._defaultBundleIdentifierOptions.createBundleAssetId,this._extractAssetIdFromBundle=this._defaultBundleIdentifierOptions.extractAssetIdFromBundle,this._assetMap={},this._preferredOrder=[],this._parsers=[],this._resolverHash={},this._bundles={}}setBundleIdentifier(e){if(this._bundleIdConnector=e.connector??this._bundleIdConnector,this._createBundleAssetId=e.createBundleAssetId??this._createBundleAssetId,this._extractAssetIdFromBundle=e.extractAssetIdFromBundle??this._extractAssetIdFromBundle,this._extractAssetIdFromBundle("foo",this._createBundleAssetId("foo","bar"))!=="bar")throw new Error("[Resolver] GenerateBundleAssetId are not working correctly")}prefer(...e){e.forEach(t=>{this._preferredOrder.push(t),t.priority||(t.priority=Object.keys(t.params))}),this._resolverHash={}}set basePath(e){this._basePath=e}get basePath(){return this._basePath}set rootPath(e){this._rootPath=e}get rootPath(){return this._rootPath}get parsers(){return this._parsers}reset(){this.setBundleIdentifier(this._defaultBundleIdentifierOptions),this._assetMap={},this._preferredOrder=[],this._resolverHash={},this._rootPath=null,this._basePath=null,this._manifest=null,this._bundles={},this._defaultSearchParams=null}setDefaultSearchParams(e){if(typeof e=="string")this._defaultSearchParams=e;else{const t=e;this._defaultSearchParams=Object.keys(t).map(i=>`${encodeURIComponent(i)}=${encodeURIComponent(t[i])}`).join("&")}}getAlias(e){const{alias:t,name:i,src:n,srcs:r}=e;return As(t||i||n||r,o=>typeof o=="string"?o:Array.isArray(o)?o.map(a=>(a==null?void 0:a.src)??(a==null?void 0:a.srcs)??a):o!=null&&o.src||o!=null&&o.srcs?o.src??o.srcs:o,!0)}addManifest(e){this._manifest&&console.warn("[Resolver] Manifest already exists, this will be overwritten"),this._manifest=e,e.bundles.forEach(t=>{this.addBundle(t.name,t.assets)})}addBundle(e,t){const i=[];Array.isArray(t)?t.forEach(n=>{const r=n.src??n.srcs,o=n.alias??n.name;let a;if(typeof o=="string"){const c=this._createBundleAssetId(e,o);i.push(c),a=[o,c]}else{const c=o.map(l=>this._createBundleAssetId(e,l));i.push(...c),a=[...o,...c]}this.add({...n,alias:a,src:r})}):Object.keys(t).forEach(n=>{const r=[n,this._createBundleAssetId(e,n)];if(typeof t[n]=="string")this.add({alias:r,src:t[n]});else if(Array.isArray(t[n]))this.add({alias:r,src:t[n]});else{const o=t[n],a=o.src??o.srcs;this.add({...o,alias:r,src:Array.isArray(a)?a:[a]})}i.push(...r)}),this._bundles[e]=i}add(e,t,i,n,r){const o=[];typeof e=="string"||Array.isArray(e)&&typeof e[0]=="string"?(mt("7.2.0",`Assets.add now uses an object instead of individual parameters.
|
||
Please use Assets.add({ alias, src, data, format, loadParser }) instead.`),o.push({alias:e,src:t,data:i,format:n,loadParser:r})):Array.isArray(e)?o.push(...e):o.push(e);let a;a=c=>{this.hasKey(c)&&console.warn(`[Resolver] already has key: ${c} overwriting`)},As(o).forEach(c=>{const{src:l,srcs:h}=c;let{data:u,format:d,loadParser:f}=c;const m=As(l||h).map(x=>typeof x=="string"?oA(x):Array.isArray(x)?x:[x]),p=this.getAlias(c);Array.isArray(p)?p.forEach(a):a(p);const g=[];m.forEach(x=>{x.forEach(v=>{let y={};if(typeof v!="object"){y.src=v;for(let S=0;S<this._parsers.length;S++){const C=this._parsers[S];if(C.test(v)){y=C.parse(v);break}}}else u=v.data??u,d=v.format??d,f=v.loadParser??f,y={...y,...v};if(!p)throw new Error(`[Resolver] alias is undefined for this asset: ${y.src}`);y=this.buildResolvedAsset(y,{aliases:p,data:u,format:d,loadParser:f}),g.push(y)})}),p.forEach(x=>{this._assetMap[x]=g})})}resolveBundle(e){const t=uh(e);e=As(e);const i={};return e.forEach(n=>{const r=this._bundles[n];if(r){const o=this.resolve(r),a={};for(const c in o){const l=o[c];a[this._extractAssetIdFromBundle(n,c)]=l}i[n]=a}}),t?i[e[0]]:i}resolveUrl(e){const t=this.resolve(e);if(typeof e!="string"){const i={};for(const n in t)i[n]=t[n].src;return i}return t.src}resolve(e){const t=uh(e);e=As(e);const i={};return e.forEach(n=>{if(!this._resolverHash[n])if(this._assetMap[n]){let r=this._assetMap[n];const o=r[0],a=this._getPreferredOrder(r);a==null||a.priority.forEach(c=>{a.params[c].forEach(l=>{const h=r.filter(u=>u[c]?u[c]===l:!1);h.length&&(r=h)})}),this._resolverHash[n]=r[0]??o}else this._resolverHash[n]=this.buildResolvedAsset({alias:[n],src:n},{});i[n]=this._resolverHash[n]}),t?i[e[0]]:i}hasKey(e){return!!this._assetMap[e]}hasBundle(e){return!!this._bundles[e]}_getPreferredOrder(e){for(let t=0;t<e.length;t++){const i=e[0],n=this._preferredOrder.find(r=>r.params.format.includes(i.format));if(n)return n}return this._preferredOrder[0]}_appendDefaultSearchParams(e){if(!this._defaultSearchParams)return e;const t=/\?/.test(e)?"&":"?";return`${e}${t}${this._defaultSearchParams}`}buildResolvedAsset(e,t){const{aliases:i,data:n,loadParser:r,format:o}=t;return(this._basePath||this._rootPath)&&(e.src=si.toAbsolute(e.src,this._basePath,this._rootPath)),e.alias=i??e.alias??[e.src],e.src=this._appendDefaultSearchParams(e.src),e.data={...n||{},...e.data},e.loadParser=r??e.loadParser,e.format=o??e.format??si.extname(e.src).slice(1),e.srcs=e.src,e.name=e.alias,e}}class BA{constructor(){this._detections=[],this._initialized=!1,this.resolver=new LA,this.loader=new lA,this.cache=qr,this._backgroundLoader=new rA(this.loader),this._backgroundLoader.active=!0,this.reset()}async init(e={}){var r,o;if(this._initialized){console.warn("[Assets]AssetManager already initialized, did you load before calling this Assets.init()?");return}if(this._initialized=!0,e.defaultSearchParams&&this.resolver.setDefaultSearchParams(e.defaultSearchParams),e.basePath&&(this.resolver.basePath=e.basePath),e.bundleIdentifier&&this.resolver.setBundleIdentifier(e.bundleIdentifier),e.manifest){let a=e.manifest;typeof a=="string"&&(a=await this.load(a)),this.resolver.addManifest(a)}const t=((r=e.texturePreference)==null?void 0:r.resolution)??1,i=typeof t=="number"?[t]:t,n=await this._detectFormats({preferredFormats:(o=e.texturePreference)==null?void 0:o.format,skipDetections:e.skipDetections,detections:this._detections});this.resolver.prefer({params:{format:n,resolution:i}}),e.preferences&&this.setPreferences(e.preferences)}add(e,t,i,n,r){this.resolver.add(e,t,i,n,r)}async load(e,t){this._initialized||await this.init();const i=uh(e),n=As(e).map(a=>{if(typeof a!="string"){const c=this.resolver.getAlias(a);return c.some(l=>!this.resolver.hasKey(l))&&this.add(a),Array.isArray(c)?c[0]:c}return this.resolver.hasKey(a)||this.add({alias:a,src:a}),a}),r=this.resolver.resolve(n),o=await this._mapLoadToResolve(r,t);return i?o[n[0]]:o}addBundle(e,t){this.resolver.addBundle(e,t)}async loadBundle(e,t){this._initialized||await this.init();let i=!1;typeof e=="string"&&(i=!0,e=[e]);const n=this.resolver.resolveBundle(e),r={},o=Object.keys(n);let a=0,c=0;const l=()=>{t==null||t(++a/c)},h=o.map(u=>{const d=n[u];return c+=Object.keys(d).length,this._mapLoadToResolve(d,l).then(f=>{r[u]=f})});return await Promise.all(h),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 qr.get(e);const t={};for(let i=0;i<e.length;i++)t[i]=qr.get(e[i]);return t}async _mapLoadToResolve(e,t){const i=Object.values(e),n=Object.keys(e);this._backgroundLoader.active=!1;const r=await this.loader.load(i,t);this._backgroundLoader.active=!0;const o={};return i.forEach((a,c)=>{const l=r[a.src],h=[a.src];a.alias&&h.push(...a.alias),o[n[c]]=l,qr.set(h,l)}),o}async unload(e){this._initialized||await this.init();const t=As(e).map(n=>typeof n!="string"?n.src:n),i=this.resolver.resolve(t);await this._unloadFromResolved(i)}async unloadBundle(e){this._initialized||await this.init(),e=As(e);const t=this.resolver.resolveBundle(e),i=Object.keys(t).map(n=>this._unloadFromResolved(t[n]));await Promise.all(i)}async _unloadFromResolved(e){const t=Object.values(e);t.forEach(i=>{qr.remove(i.src)}),await this.loader.unload(t)}async _detectFormats(e){let t=[];e.preferredFormats&&(t=Array.isArray(e.preferredFormats)?e.preferredFormats:[e.preferredFormats]);for(const i of e.detections)e.skipDetections||await i.test()?t=await i.add(t):e.skipDetections||(t=await i.remove(t));return t=t.filter((i,n)=>t.indexOf(i)===n),t}get detections(){return this._detections}get preferWorkers(){return du.config.preferWorkers}set preferWorkers(e){mt("7.2.0","Assets.prefersWorkers is deprecated, use Assets.setPreferences({ preferWorkers: true }) instead."),this.setPreferences({preferWorkers:e})}setPreferences(e){this.loader.parsers.forEach(t=>{t.config&&Object.keys(t.config).filter(i=>i in e).forEach(i=>{t.config[i]=e[i]})})}}const ln=new BA;$e.handleByList(ke.LoadParser,ln.loader.parsers).handleByList(ke.ResolveParser,ln.resolver.parsers).handleByList(ke.CacheParser,ln.cache.parsers).handleByList(ke.DetectionParser,ln.detections);const NA={extension:ke.CacheParser,test:s=>Array.isArray(s)&&s.every(e=>e instanceof Ke),getCacheableAssets:(s,e)=>{const t={};return s.forEach(i=>{e.forEach((n,r)=>{t[i+(r===0?"":r+1)]=n})}),t}};$e.add(NA);async function o1(s){if("Image"in globalThis)return new Promise(e=>{const t=new Image;t.onload=()=>{e(!0)},t.onerror=()=>{e(!1)},t.src=s});if("createImageBitmap"in globalThis&&"fetch"in globalThis){try{const e=await(await fetch(s)).blob();await createImageBitmap(e)}catch{return!1}return!0}return!1}const DA={extension:{type:ke.DetectionParser,priority:1},test:async()=>o1("data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A="),add:async s=>[...s,"avif"],remove:async s=>s.filter(e=>e!=="avif")};$e.add(DA);const UA={extension:{type:ke.DetectionParser,priority:0},test:async()=>o1("data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA="),add:async s=>[...s,"webp"],remove:async s=>s.filter(e=>e!=="webp")};$e.add(UA);const vv=["png","jpg","jpeg"],$A={extension:{type:ke.DetectionParser,priority:-1},test:()=>Promise.resolve(!0),add:async s=>[...s,...vv],remove:async s=>s.filter(e=>!vv.includes(e))};$e.add($A);const XA="WorkerGlobalScope"in globalThis&&globalThis instanceof globalThis.WorkerGlobalScope;function xp(s){return XA?!1:document.createElement("video").canPlayType(s)!==""}const VA={extension:{type:ke.DetectionParser,priority:0},test:async()=>xp("video/webm"),add:async s=>[...s,"webm"],remove:async s=>s.filter(e=>e!=="webm")};$e.add(VA);const YA={extension:{type:ke.DetectionParser,priority:0},test:async()=>xp("video/mp4"),add:async s=>[...s,"mp4","m4v"],remove:async s=>s.filter(e=>e!=="mp4"&&e!=="m4v")};$e.add(YA);const GA={extension:{type:ke.DetectionParser,priority:0},test:async()=>xp("video/ogg"),add:async s=>[...s,"ogv"],remove:async s=>s.filter(e=>e!=="ogv")};$e.add(GA);const jA={extension:ke.ResolveParser,test:du.test,parse:s=>{var e;return{resolution:parseFloat(((e=Be.RETINA_PREFIX.exec(s))==null?void 0:e[1])??"1"),format:si.extname(s).slice(1),src:s}}};$e.add(jA);var wi=(s=>(s[s.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",s[s.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",s[s.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",s[s.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",s[s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT=35917]="COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT",s[s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT=35918]="COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT",s[s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT=35919]="COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT",s[s.COMPRESSED_SRGB_S3TC_DXT1_EXT=35916]="COMPRESSED_SRGB_S3TC_DXT1_EXT",s[s.COMPRESSED_R11_EAC=37488]="COMPRESSED_R11_EAC",s[s.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",s[s.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",s[s.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",s[s.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",s[s.COMPRESSED_RGBA8_ETC2_EAC=37496]="COMPRESSED_RGBA8_ETC2_EAC",s[s.COMPRESSED_SRGB8_ETC2=37493]="COMPRESSED_SRGB8_ETC2",s[s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37497]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC",s[s.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37494]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",s[s.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37495]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",s[s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG=35840]="COMPRESSED_RGB_PVRTC_4BPPV1_IMG",s[s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG=35842]="COMPRESSED_RGBA_PVRTC_4BPPV1_IMG",s[s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG=35841]="COMPRESSED_RGB_PVRTC_2BPPV1_IMG",s[s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG=35843]="COMPRESSED_RGBA_PVRTC_2BPPV1_IMG",s[s.COMPRESSED_RGB_ETC1_WEBGL=36196]="COMPRESSED_RGB_ETC1_WEBGL",s[s.COMPRESSED_RGB_ATC_WEBGL=35986]="COMPRESSED_RGB_ATC_WEBGL",s[s.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL=35987]="COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL",s[s.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL=34798]="COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL",s[s.COMPRESSED_RGBA_ASTC_4x4_KHR=37808]="COMPRESSED_RGBA_ASTC_4x4_KHR",s[s.COMPRESSED_RGBA_BPTC_UNORM_EXT=36492]="COMPRESSED_RGBA_BPTC_UNORM_EXT",s[s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT=36493]="COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT",s[s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT=36494]="COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT",s[s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT=36495]="COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT",s))(wi||{});const dh={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 Gs,Uo;function yv(){Uo={bptc:Gs.getExtension("EXT_texture_compression_bptc"),astc:Gs.getExtension("WEBGL_compressed_texture_astc"),etc:Gs.getExtension("WEBGL_compressed_texture_etc"),s3tc:Gs.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:Gs.getExtension("WEBGL_compressed_texture_s3tc_srgb"),pvrtc:Gs.getExtension("WEBGL_compressed_texture_pvrtc")||Gs.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),etc1:Gs.getExtension("WEBGL_compressed_texture_etc1"),atc:Gs.getExtension("WEBGL_compressed_texture_atc")}}const HA={extension:{type:ke.DetectionParser,priority:2},test:async()=>{const s=Be.ADAPTER.createCanvas().getContext("webgl");return s?(Gs=s,!0):(console.warn("WebGL not available for compressed textures."),!1)},add:async s=>{Uo||yv();const e=[];for(const t in Uo)Uo[t]&&e.push(t);return[...e,...s]},remove:async s=>(Uo||yv(),s.filter(e=>!(e in Uo)))};$e.add(HA);class WA extends au{constructor(e,t={width:1,height:1,autoLoad:!0}){let i,n;typeof e=="string"?(i=e,n=new Uint8Array):(i=null,n=e),super(n,t),this.origin=i,this.buffer=n?new Xf(n):null,this._load=null,this.loaded=!1,this.origin!==null&&t.autoLoad!==!1&&this.load(),this.origin===null&&this.buffer&&(this._load=Promise.resolve(this),this.loaded=!0,this.onBlobLoaded(this.buffer.rawBinaryData))}onBlobLoaded(e){}load(){return this._load?this._load:(this._load=fetch(this.origin).then(e=>e.blob()).then(e=>e.arrayBuffer()).then(e=>(this.data=new Uint32Array(e),this.buffer=new Xf(e),this.loaded=!0,this.onBlobLoaded(e),this.update(),this)),this._load)}}class oo extends WA{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=oo._formatToExtension(this.format),(t.levelBuffers||this.buffer)&&(this._levelBuffers=t.levelBuffers||oo._createLevelBuffers(e instanceof Uint8Array?e:this.buffer.uint8View,this.format,this.levels,4,4,this.width,this.height))}upload(e,t,i){const n=e.gl;if(!e.context.extensions[this._extension])throw new Error(`${this._extension} textures are not supported on the current machine`);if(!this._levelBuffers)return!1;n.pixelStorei(n.UNPACK_ALIGNMENT,4);for(let r=0,o=this.levels;r<o;r++){const{levelID:a,levelWidth:c,levelHeight:l,levelBuffer:h}=this._levelBuffers[r];n.compressedTexImage2D(n.TEXTURE_2D,a,this.format,c,l,0,h)}return!0}onBlobLoaded(){this._levelBuffers=oo._createLevelBuffers(this.buffer.uint8View,this.format,this.levels,4,4,this.width,this.height)}static _formatToExtension(e){if(e>=33776&&e<=33779)return"s3tc";if(e>=35916&&e<=35919)return"s3tc_sRGB";if(e>=37488&&e<=37497)return"etc";if(e>=35840&&e<=35843)return"pvrtc";if(e===36196)return"etc1";if(e===35986||e===35987||e===34798)return"atc";if(e>=36492&&e<=36495)return"bptc";if(e===37808)return"astc";throw new Error(`Invalid (compressed) texture format given: ${e}`)}static _createLevelBuffers(e,t,i,n,r,o,a){const c=new Array(i);let l=e.byteOffset,h=o,u=a,d=h+n-1&~(n-1),f=u+r-1&~(r-1),m=d*f*dh[t];for(let p=0;p<i;p++)c[p]={levelID:p,levelWidth:i>1?h:d,levelHeight:i>1?u:f,levelBuffer:new Uint8Array(e.buffer,l,m)},l+=m,h=h>>1||1,u=u>>1||1,d=h+n-1&~(n-1),f=u+r-1&~(r-1),m=d*f*dh[t];return c}}const Zd=4,rc=124,zA=32,xv=20,qA=542327876,oc={HEIGHT:3,WIDTH:4,MIPMAP_COUNT:7,PIXEL_FORMAT:19},KA={FOURCC:2},ac={DXGI_FORMAT:0,RESOURCE_DIMENSION:1,MISC_FLAG:2,ARRAY_SIZE:3},ZA=1,JA=2,QA=4,eI=64,tI=512,iI=131072,sI=827611204,nI=861165636,rI=894720068,oI=808540228,aI=4,lI={[sI]:wi.COMPRESSED_RGBA_S3TC_DXT1_EXT,[nI]:wi.COMPRESSED_RGBA_S3TC_DXT3_EXT,[rI]:wi.COMPRESSED_RGBA_S3TC_DXT5_EXT},cI={70:wi.COMPRESSED_RGBA_S3TC_DXT1_EXT,71:wi.COMPRESSED_RGBA_S3TC_DXT1_EXT,73:wi.COMPRESSED_RGBA_S3TC_DXT3_EXT,74:wi.COMPRESSED_RGBA_S3TC_DXT3_EXT,76:wi.COMPRESSED_RGBA_S3TC_DXT5_EXT,77:wi.COMPRESSED_RGBA_S3TC_DXT5_EXT,72:wi.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,75:wi.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,78:wi.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT,96:wi.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT,95:wi.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT,98:wi.COMPRESSED_RGBA_BPTC_UNORM_EXT,99:wi.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT};function hI(s){const e=new Uint32Array(s);if(e[0]!==qA)throw new Error("Invalid DDS file magic word");const t=new Uint32Array(s,0,rc/Uint32Array.BYTES_PER_ELEMENT),i=t[oc.HEIGHT],n=t[oc.WIDTH],r=t[oc.MIPMAP_COUNT],o=new Uint32Array(s,oc.PIXEL_FORMAT*Uint32Array.BYTES_PER_ELEMENT,zA/Uint32Array.BYTES_PER_ELEMENT),a=o[ZA];if(a&QA){const c=o[KA.FOURCC];if(c!==oI){const v=lI[c],y=Zd+rc,S=new Uint8Array(s,y);return[new oo(S,{format:v,width:n,height:i,levels:r})]}const l=Zd+rc,h=new Uint32Array(e.buffer,l,xv/Uint32Array.BYTES_PER_ELEMENT),u=h[ac.DXGI_FORMAT],d=h[ac.RESOURCE_DIMENSION],f=h[ac.MISC_FLAG],m=h[ac.ARRAY_SIZE],p=cI[u];if(p===void 0)throw new Error(`DDSParser cannot parse texture data with DXGI format ${u}`);if(f===aI)throw new Error("DDSParser does not support cubemap textures");if(d===6)throw new Error("DDSParser does not supported 3D texture data");const g=new Array,x=Zd+rc+xv;if(m===1)g.push(new Uint8Array(s,x));else{const v=dh[p];let y=0,S=n,C=i;for(let b=0;b<r;b++){const _=Math.max(1,S+3&-4),A=Math.max(1,C+3&-4),P=_*A*v;y+=P,S=S>>>1,C=C>>>1}let w=x;for(let b=0;b<m;b++)g.push(new Uint8Array(s,w,y)),w+=y}return g.map(v=>new oo(v,{format:p,width:n,height:i,levels:r}))}throw a&eI?new Error("DDSParser does not support uncompressed texture data."):a&tI?new Error("DDSParser does not supported YUV uncompressed texture data."):a&iI?new Error("DDSParser does not support single-channel (lumninance) texture data!"):a&JA?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 bv=[171,75,84,88,32,49,49,187,13,10,26,10],uI=67305985,Ms={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},um=64,wv={[Ue.UNSIGNED_BYTE]:1,[Ue.UNSIGNED_SHORT]:2,[Ue.INT]:4,[Ue.UNSIGNED_INT]:4,[Ue.FLOAT]:4,[Ue.HALF_FLOAT]:8},dI={[Te.RGBA]:4,[Te.RGB]:3,[Te.RG]:2,[Te.RED]:1,[Te.LUMINANCE]:1,[Te.LUMINANCE_ALPHA]:2,[Te.ALPHA]:1},fI={[Ue.UNSIGNED_SHORT_4_4_4_4]:2,[Ue.UNSIGNED_SHORT_5_5_5_1]:2,[Ue.UNSIGNED_SHORT_5_6_5]:2};function mI(s,e,t=!1){const i=new DataView(e);if(!pI(s,i))return null;const n=i.getUint32(Ms.ENDIANNESS,!0)===uI,r=i.getUint32(Ms.GL_TYPE,n),o=i.getUint32(Ms.GL_FORMAT,n),a=i.getUint32(Ms.GL_INTERNAL_FORMAT,n),c=i.getUint32(Ms.PIXEL_WIDTH,n),l=i.getUint32(Ms.PIXEL_HEIGHT,n)||1,h=i.getUint32(Ms.PIXEL_DEPTH,n)||1,u=i.getUint32(Ms.NUMBER_OF_ARRAY_ELEMENTS,n)||1,d=i.getUint32(Ms.NUMBER_OF_FACES,n),f=i.getUint32(Ms.NUMBER_OF_MIPMAP_LEVELS,n),m=i.getUint32(Ms.BYTES_OF_KEY_VALUE_DATA,n);if(l===0||h!==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 p=4,g=4,x=c+3&-4,v=l+3&-4,y=new Array(u);let S=c*l;r===0&&(S=x*v);let C;if(r!==0?wv[r]?C=wv[r]*dI[o]:C=fI[r]:C=dh[a],C===void 0)throw new Error("Unable to resolve the pixel format stored in the *.ktx file!");const w=t?vI(i,m,n):null;let b=S*C,_=c,A=l,P=x,E=v,R=um+m;for(let O=0;O<f;O++){const U=i.getUint32(R,n);let Y=R+4;for(let $=0;$<u;$++){let X=y[$];X||(X=y[$]=new Array(f)),X[O]={levelID:O,levelWidth:f>1||r!==0?_:P,levelHeight:f>1||r!==0?A:E,levelBuffer:new Uint8Array(e,Y,b)},Y+=b}R+=U+4,R=R%4!==0?R+4-R%4:R,_=_>>1||1,A=A>>1||1,P=_+p-1&-4,E=A+g-1&-4,b=P*E*C}return r!==0?{uncompressed:y.map(O=>{let U=O[0].levelBuffer,Y=!1;return r===Ue.FLOAT?U=new Float32Array(O[0].levelBuffer.buffer,O[0].levelBuffer.byteOffset,O[0].levelBuffer.byteLength/4):r===Ue.UNSIGNED_INT?(Y=!0,U=new Uint32Array(O[0].levelBuffer.buffer,O[0].levelBuffer.byteOffset,O[0].levelBuffer.byteLength/4)):r===Ue.INT&&(Y=!0,U=new Int32Array(O[0].levelBuffer.buffer,O[0].levelBuffer.byteOffset,O[0].levelBuffer.byteLength/4)),{resource:new au(U,{width:O[0].levelWidth,height:O[0].levelHeight}),type:r,format:Y?gI(o):o}}),kvData:w}:{compressed:y.map(O=>new oo(null,{format:a,width:c,height:l,levels:f,levelBuffers:O})),kvData:w}}function pI(s,e){for(let t=0;t<bv.length;t++)if(e.getUint8(t)!==bv[t])return console.error(`${s} is not a valid *.ktx file!`),!1;return!0}function gI(s){switch(s){case Te.RGBA:return Te.RGBA_INTEGER;case Te.RGB:return Te.RGB_INTEGER;case Te.RG:return Te.RG_INTEGER;case Te.RED:return Te.RED_INTEGER;default:return s}}function vI(s,e,t){const i=new Map;let n=0;for(;n<e;){const r=s.getUint32(um+n,t),o=um+n+4,a=3-(r+3)%4;if(r===0||r>e-n){console.error("KTXLoader: keyAndValueByteSize out of bounds");break}let c=0;for(;c<r&&s.getUint8(o+c)!==0;c++);if(c===-1){console.error("KTXLoader: Failed to find null byte terminating kvData key");break}const l=new TextDecoder().decode(new Uint8Array(s.buffer,o,c)),h=new DataView(s.buffer,o+c+1,r-c-1);i.set(l,h),n+=4+r+a}return i}const yI={extension:{type:ke.LoadParser,priority:os.High},name:"loadDDS",test(s){return Ki(s,".dds")},async load(s,e,t){const i=await(await Be.ADAPTER.fetch(s)).arrayBuffer(),n=hI(i).map(r=>{const o=new it(r,{mipmap:vs.OFF,alphaMode:bi.NO_PREMULTIPLIED_ALPHA,resolution:Hn(s),...e.data});return kl(o,t,s)});return n.length===1?n[0]:n},unload(s){Array.isArray(s)?s.forEach(e=>e.destroy(!0)):s.destroy(!0)}};$e.add(yI);const xI={extension:{type:ke.LoadParser,priority:os.High},name:"loadKTX",test(s){return Ki(s,".ktx")},async load(s,e,t){const i=await(await Be.ADAPTER.fetch(s)).arrayBuffer(),{compressed:n,uncompressed:r,kvData:o}=mI(s,i),a=n??r,c={mipmap:vs.OFF,alphaMode:bi.NO_PREMULTIPLIED_ALPHA,resolution:Hn(s),...e.data},l=a.map(h=>{a===r&&Object.assign(c,{type:h.type,format:h.format});const u=h.resource??h,d=new it(u,c);return d.ktxKeyValueData=o,kl(d,t,s)});return l.length===1?l[0]:l},unload(s){Array.isArray(s)?s.forEach(e=>e.destroy(!0)):s.destroy(!0)}};$e.add(xI);const bI=["s3tc","s3tc_sRGB","etc","etc1","pvrtc","atc","astc","bptc"],wI={extension:ke.ResolveParser,test:s=>{const e=si.extname(s).slice(1);return["basis","ktx","dds"].includes(e)},parse:s=>{var i,n;const e=s.split("."),t=e.pop();if(["ktx","dds"].includes(t)){const r=e.pop();if(bI.includes(r))return{resolution:parseFloat(((i=Be.RETINA_PREFIX.exec(s))==null?void 0:i[1])??"1"),format:r,src:s}}return{resolution:parseFloat(((n=Be.RETINA_PREFIX.exec(s))==null?void 0:n[1])??"1"),format:t,src:s}}};$e.add(wI);const lc=new ct,SI=4,a1=class ja{constructor(e){this.renderer=e,this._rendererPremultipliedAlpha=!1}contextChange(){var t;const e=(t=this.renderer)==null?void 0:t.gl.getContextAttributes();this._rendererPremultipliedAlpha=!!(e&&e.alpha&&e.premultipliedAlpha)}async image(e,t,i,n){const r=new Image;return r.src=await this.base64(e,t,i,n),r}async base64(e,t,i,n){const r=this.canvas(e,n);if(r.toBlob!==void 0)return new Promise((o,a)=>{r.toBlob(c=>{if(!c){a(new Error("ICanvas.toBlob failed!"));return}const l=new FileReader;l.onload=()=>o(l.result),l.onerror=a,l.readAsDataURL(c)},t,i)});if(r.toDataURL!==void 0)return r.toDataURL(t,i);if(r.convertToBlob!==void 0){const o=await r.convertToBlob({type:t,quality:i});return new Promise((a,c)=>{const l=new FileReader;l.onload=()=>a(l.result),l.onerror=c,l.readAsDataURL(o)})}throw new Error("Extract.base64() requires ICanvas.toDataURL, ICanvas.toBlob, or ICanvas.convertToBlob to be implemented")}canvas(e,t){const{pixels:i,width:n,height:r,flipY:o,premultipliedAlpha:a}=this._rawPixels(e,t);o&&ja._flipY(i,n,r),a&&ja._unpremultiplyAlpha(i);const c=new sC(n,r,1),l=new ImageData(new Uint8ClampedArray(i.buffer),n,r);return c.context.putImageData(l,0,0),c.canvas}pixels(e,t){const{pixels:i,width:n,height:r,flipY:o,premultipliedAlpha:a}=this._rawPixels(e,t);return o&&ja._flipY(i,n,r),a&&ja._unpremultiplyAlpha(i),i}_rawPixels(e,t){const i=this.renderer;if(!i)throw new Error("The Extract has already been destroyed");let n,r=!1,o=!1,a,c=!1;e&&(e instanceof vo?a=e:(a=i.generateTexture(e,{region:t,resolution:i.resolution,multisample:i.multisample}),c=!0,t&&(lc.width=t.width,lc.height=t.height,t=lc)));const l=i.gl;if(a){if(n=a.baseTexture.resolution,t=t??a.frame,r=!1,o=a.baseTexture.alphaMode>0&&a.baseTexture.format===Te.RGBA,!c){i.renderTexture.bind(a);const f=a.framebuffer.glFramebuffers[i.CONTEXT_UID];f.blitFramebuffer&&i.framebuffer.bind(f.blitFramebuffer)}}else n=i.resolution,t||(t=lc,t.width=i.width/n,t.height=i.height/n),r=!0,o=this._rendererPremultipliedAlpha,i.renderTexture.bind();const h=Math.max(Math.round(t.width*n),1),u=Math.max(Math.round(t.height*n),1),d=new Uint8Array(SI*h*u);return l.readPixels(Math.round(t.x*n),Math.round(t.y*n),h,u,l.RGBA,l.UNSIGNED_BYTE,d),c&&(a==null||a.destroy(!0)),{pixels:d,width:h,height:u,flipY:r,premultipliedAlpha:o}}destroy(){this.renderer=null}static _flipY(e,t,i){const n=t<<2,r=i>>1,o=new Uint8Array(n);for(let a=0;a<r;a++){const c=a*n,l=(i-a-1)*n;o.set(e.subarray(c,c+n)),e.copyWithin(c,l,l+n),e.set(o,l)}}static _unpremultiplyAlpha(e){e instanceof Uint8ClampedArray&&(e=new Uint8Array(e.buffer));const t=e.length;for(let i=0;i<t;i+=4){const n=e[i+3];if(n!==0){const r=255.001/n;e[i]=e[i]*r+.5,e[i+1]=e[i+1]*r+.5,e[i+2]=e[i+2]*r+.5}}}};a1.extension={name:"extract",type:ke.RendererSystem};let MI=a1;$e.add(MI);const fh={build(s){const e=s.points;let t,i,n,r,o,a;if(s.type===Ci.CIRC){const m=s.shape;t=m.x,i=m.y,o=a=m.radius,n=r=0}else if(s.type===Ci.ELIP){const m=s.shape;t=m.x,i=m.y,o=m.width,a=m.height,n=r=0}else{const m=s.shape,p=m.width/2,g=m.height/2;t=m.x+p,i=m.y+g,o=a=Math.max(0,Math.min(m.radius,Math.min(p,g))),n=p-o,r=g-a}if(!(o>=0&&a>=0&&n>=0&&r>=0)){e.length=0;return}const c=Math.ceil(2.3*Math.sqrt(o+a)),l=c*8+(n?4:0)+(r?4:0);if(e.length=l,l===0)return;if(c===0){e.length=8,e[0]=e[6]=t+n,e[1]=e[3]=i+r,e[2]=e[4]=t-n,e[5]=e[7]=i-r;return}let h=0,u=c*4+(n?2:0)+2,d=u,f=l;{const m=n+o,p=r,g=t+m,x=t-m,v=i+p;if(e[h++]=g,e[h++]=v,e[--u]=v,e[--u]=x,r){const y=i-p;e[d++]=x,e[d++]=y,e[--f]=y,e[--f]=g}}for(let m=1;m<c;m++){const p=Math.PI/2*(m/c),g=n+Math.cos(p)*o,x=r+Math.sin(p)*a,v=t+g,y=t-g,S=i+x,C=i-x;e[h++]=v,e[h++]=S,e[--u]=S,e[--u]=y,e[d++]=y,e[d++]=C,e[--f]=C,e[--f]=v}{const m=n,p=r+a,g=t+m,x=t-m,v=i+p,y=i-p;e[h++]=g,e[h++]=v,e[--f]=y,e[--f]=g,n&&(e[h++]=x,e[h++]=v,e[--f]=y,e[--f]=x)}},triangulate(s,e){const t=s.points,i=e.points,n=e.indices;if(t.length===0)return;let r=i.length/2;const o=r;let a,c;if(s.type!==Ci.RREC){const h=s.shape;a=h.x,c=h.y}else{const h=s.shape;a=h.x+h.width/2,c=h.y+h.height/2}const l=s.matrix;i.push(s.matrix?l.a*a+l.c*c+l.tx:a,s.matrix?l.b*a+l.d*c+l.ty:c),r++,i.push(t[0],t[1]);for(let h=2;h<t.length;h+=2)i.push(t[h],t[h+1]),n.push(r++,o,r);n.push(o+1,o,r)}};function Sv(s,e=!1){const t=s.length;if(t<6)return;let i=0;for(let n=0,r=s[t-2],o=s[t-1];n<t;n+=2){const a=s[n],c=s[n+1];i+=(a-r)*(c+o),r=a,o=c}if(!e&&i>0||e&&i<=0){const n=t/2;for(let r=n+n%2;r<t;r+=2){const o=t-r-2,a=t-r-1,c=r,l=r+1;[s[o],s[c]]=[s[c],s[o]],[s[a],s[l]]=[s[l],s[a]]}}}const l1={build(s){s.points=s.shape.points.slice()},triangulate(s,e){let t=s.points;const i=s.holes,n=e.points,r=e.indices;if(t.length>=6){Sv(t,!1);const o=[];for(let l=0;l<i.length;l++){const h=i[l];Sv(h.points,!0),o.push(t.length/2),t=t.concat(h.points)}const a=s_(t,o,2);if(!a)return;const c=n.length/2;for(let l=0;l<a.length;l+=3)r.push(a[l]+c),r.push(a[l+1]+c),r.push(a[l+2]+c);for(let l=0;l<t.length;l++)n.push(t[l])}}},TI={build(s){const e=s.shape,t=e.x,i=e.y,n=e.width,r=e.height,o=s.points;o.length=0,n>=0&&r>=0&&o.push(t,i,t+n,i,t+n,i+r,t,i+r)},triangulate(s,e){const t=s.points,i=e.points;if(t.length===0)return;const n=i.length/2;i.push(t[0],t[1],t[2],t[3],t[6],t[7],t[4],t[5]),e.indices.push(n,n+1,n+2,n+1,n+2,n+3)}},_I={build(s){fh.build(s)},triangulate(s,e){fh.triangulate(s,e)}};var hs=(s=>(s.MITER="miter",s.BEVEL="bevel",s.ROUND="round",s))(hs||{}),xr=(s=>(s.BUTT="butt",s.ROUND="round",s.SQUARE="square",s))(xr||{});const ca={adaptive:!0,maxLength:10,minSegments:8,maxSegments:2048,epsilon:1e-4,_segmentsCount(s,e=20){if(!this.adaptive||!s||isNaN(s))return e;let t=Math.ceil(s/this.maxLength);return t<this.minSegments?t=this.minSegments:t>this.maxSegments&&(t=this.maxSegments),t}};class Mv{static curveTo(e,t,i,n,r,o){const a=o[o.length-2],c=o[o.length-1]-t,l=a-e,h=n-t,u=i-e,d=Math.abs(c*u-l*h);if(d<1e-8||r===0)return(o[o.length-2]!==e||o[o.length-1]!==t)&&o.push(e,t),null;const f=c*c+l*l,m=h*h+u*u,p=c*h+l*u,g=r*Math.sqrt(f)/d,x=r*Math.sqrt(m)/d,v=g*p/f,y=x*p/m,S=g*u+x*l,C=g*h+x*c,w=l*(x+v),b=c*(x+v),_=u*(g+y),A=h*(g+y),P=Math.atan2(b-C,w-S),E=Math.atan2(A-C,_-S);return{cx:S+e,cy:C+t,radius:r,startAngle:P,endAngle:E,anticlockwise:l*h>u*c}}static arc(e,t,i,n,r,o,a,c,l){const h=a-o,u=ca._segmentsCount(Math.abs(h)*r,Math.ceil(Math.abs(h)/nh)*40),d=h/(u*2),f=d*2,m=Math.cos(d),p=Math.sin(d),g=u-1,x=g%1/g;for(let v=0;v<=g;++v){const y=v+x*v,S=d+o+f*y,C=Math.cos(S),w=-Math.sin(S);l.push((m*C+p*w)*r+i,(m*-w+p*C)*r+n)}}}class CI{constructor(){this.reset()}begin(e,t,i){this.reset(),this.style=e,this.start=t,this.attribStart=i}end(e,t){this.attribSize=t-this.attribStart,this.size=e-this.start}reset(){this.style=null,this.size=0,this.start=0,this.attribStart=0,this.attribSize=0}}class bp{static curveLength(e,t,i,n,r,o,a,c){let l=0,h=0,u=0,d=0,f=0,m=0,p=0,g=0,x=0,v=0,y=0,S=e,C=t;for(let w=1;w<=10;++w)h=w/10,u=h*h,d=u*h,f=1-h,m=f*f,p=m*f,g=p*e+3*m*h*i+3*f*u*r+d*a,x=p*t+3*m*h*n+3*f*u*o+d*c,v=S-g,y=C-x,S=g,C=x,l+=Math.sqrt(v*v+y*y);return l}static curveTo(e,t,i,n,r,o,a){const c=a[a.length-2],l=a[a.length-1];a.length-=2;const h=ca._segmentsCount(bp.curveLength(c,l,e,t,i,n,r,o));let u=0,d=0,f=0,m=0,p=0;a.push(c,l);for(let g=1,x=0;g<=h;++g)x=g/h,u=1-x,d=u*u,f=d*u,m=x*x,p=m*x,a.push(f*c+3*d*x*e+3*u*m*i+p*r,f*l+3*d*x*t+3*u*m*n+p*o)}}function Tv(s,e,t,i,n,r,o,a){const c=s-t*n,l=e-i*n,h=s+t*r,u=e+i*r;let d,f;o?(d=i,f=-t):(d=-i,f=t);const m=c+d,p=l+f,g=h+d,x=u+f;return a.push(m,p,g,x),2}function $r(s,e,t,i,n,r,o,a){const c=t-s,l=i-e;let h=Math.atan2(c,l),u=Math.atan2(n-s,r-e);a&&h<u?h+=Math.PI*2:!a&&h>u&&(u+=Math.PI*2);let d=h;const f=u-h,m=Math.abs(f),p=Math.sqrt(c*c+l*l),g=(15*m*Math.sqrt(p)/Math.PI>>0)+1,x=f/g;if(d+=x,a){o.push(s,e,t,i);for(let v=1,y=d;v<g;v++,y+=x)o.push(s,e,s+Math.sin(y)*p,e+Math.cos(y)*p);o.push(s,e,n,r)}else{o.push(t,i,s,e);for(let v=1,y=d;v<g;v++,y+=x)o.push(s+Math.sin(y)*p,e+Math.cos(y)*p,s,e);o.push(n,r,s,e)}return g*2}function EI(s,e){const t=s.shape;let i=s.points||t.points.slice();const n=e.closePointEps;if(i.length===0)return;const r=s.lineStyle,o=new St(i[0],i[1]),a=new St(i[i.length-2],i[i.length-1]),c=t.type!==Ci.POLY||t.closeStroke,l=Math.abs(o.x-a.x)<n&&Math.abs(o.y-a.y)<n;if(c){i=i.slice(),l&&(i.pop(),i.pop(),a.set(i[i.length-2],i[i.length-1]));const X=(o.x+a.x)*.5,D=(a.y+o.y)*.5;i.unshift(X,D),i.push(X,D)}const h=e.points,u=i.length/2;let d=i.length;const f=h.length/2,m=r.width/2,p=m*m,g=r.miterLimit*r.miterLimit;let x=i[0],v=i[1],y=i[2],S=i[3],C=0,w=0,b=-(v-S),_=x-y,A=0,P=0,E=Math.sqrt(b*b+_*_);b/=E,_/=E,b*=m,_*=m;const R=r.alignment,O=(1-R)*2,U=R*2;c||(r.cap===xr.ROUND?d+=$r(x-b*(O-U)*.5,v-_*(O-U)*.5,x-b*O,v-_*O,x+b*U,v+_*U,h,!0)+2:r.cap===xr.SQUARE&&(d+=Tv(x,v,b,_,O,U,!0,h))),h.push(x-b*O,v-_*O,x+b*U,v+_*U);for(let X=1;X<u-1;++X){x=i[(X-1)*2],v=i[(X-1)*2+1],y=i[X*2],S=i[X*2+1],C=i[(X+1)*2],w=i[(X+1)*2+1],b=-(v-S),_=x-y,E=Math.sqrt(b*b+_*_),b/=E,_/=E,b*=m,_*=m,A=-(S-w),P=y-C,E=Math.sqrt(A*A+P*P),A/=E,P/=E,A*=m,P*=m;const D=y-x,F=v-S,N=y-C,k=w-S,V=D*N+F*k,G=F*N-k*D,W=G<0;if(Math.abs(G)<.001*Math.abs(V)){h.push(y-b*O,S-_*O,y+b*U,S+_*U),V>=0&&(r.join===hs.ROUND?d+=$r(y,S,y-b*O,S-_*O,y-A*O,S-P*O,h,!1)+4:d+=2,h.push(y-A*U,S-P*U,y+A*O,S+P*O));continue}const Z=(-b+x)*(-_+S)-(-b+y)*(-_+v),ne=(-A+C)*(-P+S)-(-A+y)*(-P+w),oe=(D*ne-N*Z)/G,de=(k*Z-F*ne)/G,pe=(oe-y)*(oe-y)+(de-S)*(de-S),he=y+(oe-y)*O,me=S+(de-S)*O,H=y-(oe-y)*U,z=S-(de-S)*U,K=Math.min(D*D+F*F,N*N+k*k),B=W?O:U,L=K+B*B*p,j=pe<=L;let ie=r.join;if(ie===hs.MITER&&pe/p>g&&(ie=hs.BEVEL),j)switch(ie){case hs.MITER:{h.push(he,me,H,z);break}case hs.BEVEL:{W?h.push(he,me,y+b*U,S+_*U,he,me,y+A*U,S+P*U):h.push(y-b*O,S-_*O,H,z,y-A*O,S-P*O,H,z),d+=2;break}case hs.ROUND:{W?(h.push(he,me,y+b*U,S+_*U),d+=$r(y,S,y+b*U,S+_*U,y+A*U,S+P*U,h,!0)+4,h.push(he,me,y+A*U,S+P*U)):(h.push(y-b*O,S-_*O,H,z),d+=$r(y,S,y-b*O,S-_*O,y-A*O,S-P*O,h,!1)+4,h.push(y-A*O,S-P*O,H,z));break}}else{switch(h.push(y-b*O,S-_*O,y+b*U,S+_*U),ie){case hs.MITER:{W?h.push(H,z,H,z):h.push(he,me,he,me),d+=2;break}case hs.ROUND:{W?d+=$r(y,S,y+b*U,S+_*U,y+A*U,S+P*U,h,!0)+2:d+=$r(y,S,y-b*O,S-_*O,y-A*O,S-P*O,h,!1)+2;break}}h.push(y-A*O,S-P*O,y+A*U,S+P*U),d+=2}}x=i[(u-2)*2],v=i[(u-2)*2+1],y=i[(u-1)*2],S=i[(u-1)*2+1],b=-(v-S),_=x-y,E=Math.sqrt(b*b+_*_),b/=E,_/=E,b*=m,_*=m,h.push(y-b*O,S-_*O,y+b*U,S+_*U),c||(r.cap===xr.ROUND?d+=$r(y-b*(O-U)*.5,S-_*(O-U)*.5,y-b*O,S-_*O,y+b*U,S+_*U,h,!1)+2:r.cap===xr.SQUARE&&(d+=Tv(y,S,b,_,O,U,!1,h)));const Y=e.indices,$=ca.epsilon*ca.epsilon;for(let X=f;X<d+f-2;++X)x=h[X*2],v=h[X*2+1],y=h[(X+1)*2],S=h[(X+1)*2+1],C=h[(X+2)*2],w=h[(X+2)*2+1],!(Math.abs(x*(S-w)+y*(w-v)+C*(v-S))<$)&&Y.push(X,X+1,X+2)}function AI(s,e){let t=0;const i=s.shape,n=s.points||i.points,r=i.type!==Ci.POLY||i.closeStroke;if(n.length===0)return;const o=e.points,a=e.indices,c=n.length/2,l=o.length/2;let h=l;for(o.push(n[0],n[1]),t=1;t<c;t++)o.push(n[t*2],n[t*2+1]),a.push(h,h+1),h++;r&&a.push(h,l)}function _v(s,e){s.lineStyle.native?AI(s,e):EI(s,e)}class wp{static curveLength(e,t,i,n,r,o){const a=e-2*i+r,c=t-2*n+o,l=2*i-2*e,h=2*n-2*t,u=4*(a*a+c*c),d=4*(a*l+c*h),f=l*l+h*h,m=2*Math.sqrt(u+d+f),p=Math.sqrt(u),g=2*u*p,x=2*Math.sqrt(f),v=d/p;return(g*m+p*d*(m-x)+(4*f*u-d*d)*Math.log((2*p+v+m)/(v+x)))/(4*g)}static curveTo(e,t,i,n,r){const o=r[r.length-2],a=r[r.length-1],c=ca._segmentsCount(wp.curveLength(o,a,e,t,i,n));let l=0,h=0;for(let u=1;u<=c;++u){const d=u/c;l=o+(e-o)*d,h=a+(t-a)*d,r.push(l+(e+(i-e)*d-l)*d,h+(t+(n-t)*d-h)*d)}}}const Jd={[Ci.POLY]:l1,[Ci.CIRC]:fh,[Ci.ELIP]:fh,[Ci.RECT]:TI,[Ci.RREC]:_I},Cv=[],cc=[];class mh{constructor(e,t=null,i=null,n=null){this.points=[],this.holes=[],this.shape=e,this.lineStyle=i,this.fillStyle=t,this.matrix=n,this.type=e.type}clone(){return new mh(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 Ao=new St,c1=class h1 extends mb{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(),cc.push(this.drawCalls[e]);this.drawCalls.length=0;for(let e=0;e<this.batches.length;e++){const t=this.batches[e];t.reset(),Cv.push(t)}this.batches.length=0}clear(){return this.graphicsData.length>0&&(this.invalidate(),this.clearDirty++,this.graphicsData.length=0),this}drawShape(e,t=null,i=null,n=null){const r=new mh(e,t,i,n);return this.graphicsData.push(r),this.dirty++,this}drawHole(e,t=null){if(!this.graphicsData.length)return null;const i=new mh(e,null,null,t),n=this.graphicsData[this.graphicsData.length-1];return i.lineStyle=n.lineStyle,n.holes.push(i),this.dirty++,this}destroy(){super.destroy();for(let e=0;e<this.graphicsData.length;++e)this.graphicsData[e].destroy();this.points.length=0,this.points=null,this.colors.length=0,this.colors=null,this.uvs.length=0,this.uvs=null,this.indices.length=0,this.indices=null,this.indexBuffer.destroy(),this.indexBuffer=null,this.graphicsData.length=0,this.graphicsData=null,this.drawCalls.length=0,this.drawCalls=null,this.batches.length=0,this.batches=null,this._bounds=null}containsPoint(e){const t=this.graphicsData;for(let i=0;i<t.length;++i){const n=t[i];if(n.fillStyle.visible&&n.shape&&(n.matrix?n.matrix.applyInverse(e,Ao):Ao.copyFrom(e),n.shape.contains(Ao.x,Ao.y))){let r=!1;if(n.holes){for(let o=0;o<n.holes.length;o++)if(n.holes[o].shape.contains(Ao.x,Ao.y)){r=!0;break}}if(!r)return!0}}return!1}updateBatches(){if(!this.graphicsData.length){this.batchable=!0;return}if(!this.validateBatching())return;this.cacheDirty=this.dirty;const e=this.uvs,t=this.graphicsData;let i=null,n=null;this.batches.length>0&&(i=this.batches[this.batches.length-1],n=i.style);for(let c=this.shapeIndex;c<t.length;c++){this.shapeIndex++;const l=t[c],h=l.fillStyle,u=l.lineStyle;Jd[l.type].build(l),l.matrix&&this.transformPoints(l.points,l.matrix),(h.visible||u.visible)&&this.processHoles(l.holes);for(let d=0;d<2;d++){const f=d===0?h:u;if(!f.visible)continue;const m=f.texture.baseTexture,p=this.indices.length,g=this.points.length/2;m.wrapMode=Os.REPEAT,d===0?this.processFill(l):this.processLine(l);const x=this.points.length/2-g;x!==0&&(i&&!this._compareStyles(n,f)&&(i.end(p,g),i=null),i||(i=Cv.pop()||new CI,i.begin(f,p,g),this.batches.push(i),n=f),this.addUvs(this.points,e,f.texture,g,x,f.matrix))}}const r=this.indices.length,o=this.points.length/2;if(i&&i.end(r,o),this.batches.length===0){this.batchable=!0;return}const a=o>65535;this.indicesUint16&&this.indices.length===this.indicesUint16.length&&a===this.indicesUint16.BYTES_PER_ELEMENT>2?this.indicesUint16.set(this.indices):this.indicesUint16=a?new Uint32Array(this.indices):new Uint16Array(this.indices),this.batchable=this.isBatchable(),this.batchable?this.packBatches():this.buildDrawCalls()}_compareStyles(e,t){return!(!e||!t||e.texture.baseTexture!==t.texture.baseTexture||e.color+e.alpha!==t.color+t.alpha||!!e.native!=!!t.native)}validateBatching(){if(this.dirty===this.cacheDirty||!this.graphicsData.length)return!1;for(let e=0,t=this.graphicsData.length;e<t;e++){const i=this.graphicsData[e],n=i.fillStyle,r=i.lineStyle;if(n&&!n.texture.baseTexture.valid||r&&!r.texture.baseTexture.valid)return!1}return!0}packBatches(){this.batchDirty++,this.uvsFloat32=new Float32Array(this.uvs);const e=this.batches;for(let t=0,i=e.length;t<i;t++){const n=e[t];for(let r=0;r<n.size;r++){const o=n.start+r;this.indicesUint16[o]=this.indicesUint16[o]-n.attribStart}}}isBatchable(){if(this.points.length>65535*2)return!1;const e=this.batches;for(let t=0;t<e.length;t++)if(e[t].style.native)return!1;return this.points.length<h1.BATCHABLE_SIZE*2}buildDrawCalls(){let e=++it._globalBatch;for(let u=0;u<this.drawCalls.length;u++)this.drawCalls[u].texArray.clear(),cc.push(this.drawCalls[u]);this.drawCalls.length=0;const t=this.colors,i=this.textureIds;let n=cc.pop();n||(n=new Gf,n.texArray=new zf),n.texArray.count=0,n.start=0,n.size=0,n.type=on.TRIANGLES;let r=0,o=null,a=0,c=!1,l=on.TRIANGLES,h=0;this.drawCalls.push(n);for(let u=0;u<this.batches.length;u++){const d=this.batches[u],f=8,m=d.style,p=m.texture.baseTexture;c!==!!m.native&&(c=!!m.native,l=c?on.LINES:on.TRIANGLES,o=null,r=f,e++),o!==p&&(o=p,p._batchEnabled!==e&&(r===f&&(e++,r=0,n.size>0&&(n=cc.pop(),n||(n=new Gf,n.texArray=new zf),this.drawCalls.push(n)),n.start=h,n.size=0,n.texArray.count=0,n.type=l),p.touched=1,p._batchEnabled=e,p._batchLocation=r,p.wrapMode=Os.REPEAT,n.texArray.elements[n.texArray.count++]=p,r++)),n.size+=d.size,h+=d.size,a=p._batchLocation,this.addColors(t,m.color,m.alpha,d.attribSize,d.attribStart),this.addTextureIds(i,a,d.attribSize,d.attribStart)}it._globalBatch=e,this.packAttributes()}packAttributes(){const e=this.points,t=this.uvs,i=this.colors,n=this.textureIds,r=new ArrayBuffer(e.length*3*4),o=new Float32Array(r),a=new Uint32Array(r);let c=0;for(let l=0;l<e.length/2;l++)o[c++]=e[l*2],o[c++]=e[l*2+1],o[c++]=t[l*2],o[c++]=t[l*2+1],a[c++]=i[l],o[c++]=n[l];this._buffer.update(r),this._indexBuffer.update(this.indicesUint16)}processFill(e){e.holes.length?l1.triangulate(e,this):Jd[e.type].triangulate(e,this)}processLine(e){_v(e,this);for(let t=0;t<e.holes.length;t++)_v(e.holes[t],this)}processHoles(e){for(let t=0;t<e.length;t++){const i=e[t];Jd[i.type].build(i),i.matrix&&this.transformPoints(i.points,i.matrix)}}calculateBounds(){const e=this._bounds;e.clear(),e.addVertexData(this.points,0,this.points.length),e.pad(this.boundsPadding,this.boundsPadding)}transformPoints(e,t){for(let i=0;i<e.length/2;i++){const n=e[i*2],r=e[i*2+1];e[i*2]=t.a*n+t.c*r+t.tx,e[i*2+1]=t.b*n+t.d*r+t.ty}}addColors(e,t,i,n,r=0){const o=At.shared.setValue(t).toLittleEndianNumber(),a=At.shared.setValue(o).toPremultiplied(i);e.length=Math.max(e.length,r+n);for(let c=0;c<n;c++)e[r+c]=a}addTextureIds(e,t,i,n=0){e.length=Math.max(e.length,n+i);for(let r=0;r<i;r++)e[n+r]=t}addUvs(e,t,i,n,r,o=null){let a=0;const c=t.length,l=i.frame;for(;a<r;){let u=e[(n+a)*2],d=e[(n+a)*2+1];if(o){const f=o.a*u+o.c*d+o.tx;d=o.b*u+o.d*d+o.ty,u=f}a++,t.push(u/l.width,d/l.height)}const h=i.baseTexture;(l.width<h.width||l.height<h.height)&&this.adjustUvs(t,i,c,r)}adjustUvs(e,t,i,n){const r=t.baseTexture,o=1e-6,a=i+n*2,c=t.frame,l=c.width/r.width,h=c.height/r.height;let u=c.x/c.width,d=c.y/c.height,f=Math.floor(e[i]+o),m=Math.floor(e[i+1]+o);for(let p=i+2;p<a;p+=2)f=Math.min(f,Math.floor(e[p]+o)),m=Math.min(m,Math.floor(e[p+1]+o));u-=f,d-=m;for(let p=i;p<a;p+=2)e[p]=(e[p]+u)*l,e[p+1]=(e[p+1]+d)*h}};c1.BATCHABLE_SIZE=100;let II=c1;class fu{constructor(){this.color=16777215,this.alpha=1,this.texture=Ke.WHITE,this.matrix=null,this.visible=!1,this.reset()}clone(){const e=new fu;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=Ke.WHITE,this.matrix=null,this.visible=!1}destroy(){this.texture=null,this.matrix=null}}class Sp extends fu{constructor(){super(...arguments),this.width=0,this.alignment=.5,this.native=!1,this.cap=xr.BUTT,this.join=hs.MITER,this.miterLimit=10}clone(){const e=new Sp;return e.color=this.color,e.alpha=this.alpha,e.texture=this.texture,e.matrix=this.matrix,e.visible=this.visible,e.width=this.width,e.alignment=this.alignment,e.native=this.native,e.cap=this.cap,e.join=this.join,e.miterLimit=this.miterLimit,e}reset(){super.reset(),this.color=0,this.alignment=.5,this.width=0,this.native=!1,this.cap=xr.BUTT,this.join=hs.MITER,this.miterLimit=10}}const Qd={},dm=class Lc extends gi{constructor(e=null){super(),this.shader=null,this.pluginName="batch",this.currentPath=null,this.batches=[],this.batchTint=-1,this.batchDirty=-1,this.vertexData=null,this._fillStyle=new fu,this._lineStyle=new Sp,this._matrix=null,this._holeMode=!1,this.state=mn.for2d(),this._geometry=e||new II,this._geometry.refCount++,this._transformID=-1,this._tintColor=new At(16777215),this.blendMode=We.NORMAL}get geometry(){return this._geometry}clone(){return this.finishPoly(),new Lc(this._geometry)}set blendMode(e){this.state.blendMode=e}get blendMode(){return this.state.blendMode}get tint(){return this._tintColor.value}set tint(e){this._tintColor.setValue(e)}get fill(){return this._fillStyle}get line(){return this._lineStyle}lineStyle(e=null,t=0,i,n=.5,r=!1){return typeof e=="number"&&(e={width:e,color:t,alpha:i,alignment:n,native:r}),this.lineTextureStyle(e)}lineTextureStyle(e){const t={width:0,texture:Ke.WHITE,color:e!=null&&e.texture?16777215:0,matrix:null,alignment:.5,native:!1,cap:xr.BUTT,join:hs.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 ro,this.currentPath.closeStroke=!1,this.currentPath.points.push(e[t-2],e[t-1]))}else this.currentPath=new ro,this.currentPath.closeStroke=!1}finishPoly(){this.currentPath&&(this.currentPath.points.length>2?(this.drawShape(this.currentPath),this.currentPath=null):this.currentPath.points.length=0)}moveTo(e,t){return this.startPoly(),this.currentPath.points[0]=e,this.currentPath.points[1]=t,this}lineTo(e,t){this.currentPath||this.moveTo(0,0);const i=this.currentPath.points,n=i[i.length-2],r=i[i.length-1];return(n!==e||r!==t)&&i.push(e,t),this}_initCurve(e=0,t=0){this.currentPath?this.currentPath.points.length===0&&(this.currentPath.points=[e,t]):this.moveTo(e,t)}quadraticCurveTo(e,t,i,n){this._initCurve();const r=this.currentPath.points;return r.length===0&&this.moveTo(0,0),wp.curveTo(e,t,i,n,r),this}bezierCurveTo(e,t,i,n,r,o){return this._initCurve(),bp.curveTo(e,t,i,n,r,o,this.currentPath.points),this}arcTo(e,t,i,n,r){this._initCurve(e,t);const o=this.currentPath.points,a=Mv.curveTo(e,t,i,n,r,o);if(a){const{cx:c,cy:l,radius:h,startAngle:u,endAngle:d,anticlockwise:f}=a;this.arc(c,l,h,u,d,f)}return this}arc(e,t,i,n,r,o=!1){if(n===r)return this;if(!o&&r<=n?r+=nh:o&&n<=r&&(n+=nh),r-n===0)return this;const a=e+Math.cos(n)*i,c=t+Math.sin(n)*i,l=this._geometry.closePointEps;let h=this.currentPath?this.currentPath.points:null;if(h){const u=Math.abs(h[h.length-2]-a),d=Math.abs(h[h.length-1]-c);u<l&&d<l||h.push(a,c)}else this.moveTo(a,c),h=this.currentPath.points;return Mv.arc(a,c,e,t,i,n,r,o,h),this}beginFill(e=0,t){return this.beginTextureFill({texture:Ke.WHITE,color:e,alpha:t})}normalizeColor(e){const t=At.shared.setValue(e.color??0);e.color=t.toNumber(),e.alpha??(e.alpha=t.alpha)}beginTextureFill(e){const t={texture:Ke.WHITE,color:16777215,matrix:null};e=Object.assign(t,e),this.normalizeColor(e),this.currentPath&&this.startPoly();const i=e.alpha>0;return i?(e.matrix&&(e.matrix=e.matrix.clone(),e.matrix.invert()),Object.assign(this._fillStyle,{visible:i},e)):this._fillStyle.reset(),this}endFill(){return this.finishPoly(),this._fillStyle.reset(),this}drawRect(e,t,i,n){return this.drawShape(new ct(e,t,i,n))}drawRoundedRect(e,t,i,n,r){return this.drawShape(new hu(e,t,i,n,r))}drawCircle(e,t,i){return this.drawShape(new lu(e,t,i))}drawEllipse(e,t,i,n){return this.drawShape(new cu(e,t,i,n))}drawPolygon(...e){let t,i=!0;const n=e[0];n.points?(i=n.closeStroke,t=n.points):Array.isArray(e[0])?t=e[0]:t=e;const r=new ro(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===Ci.RECT&&!e[0].matrix&&!e[0].holes.length&&!(e[0].lineStyle.visible&&e[0].lineStyle.width)}_render(e){this.finishPoly();const t=this._geometry;t.updateBatches(),t.batchable?(this.batchDirty!==t.batchDirty&&this._populateBatches(),this._renderBatched(e)):(e.batch.flush(),this._renderDirect(e))}_populateBatches(){const e=this._geometry,t=this.blendMode,i=e.batches.length;this.batchTint=-1,this._transformID=-1,this.batchDirty=e.batchDirty,this.batches.length=i,this.vertexData=new Float32Array(e.points);for(let n=0;n<i;n++){const r=e.batches[n],o=r.style.color,a=new Float32Array(this.vertexData.buffer,r.attribStart*4*2,r.attribSize*2),c=new Float32Array(e.uvsFloat32.buffer,r.attribStart*4*2,r.attribSize*2),l=new Uint16Array(e.indicesUint16.buffer,r.start*2,r.size),h={vertexData:a,blendMode:t,indices:l,uvs:c,_batchRGB:At.shared.setValue(o).toRgbArray(),_tintRGB:o,_texture:r.style.texture,alpha:r.style.alpha,worldAlpha:1};this.batches[n]=h}}_renderBatched(e){if(this.batches.length){e.batch.setObjectRenderer(e.plugins[this.pluginName]),this.calculateVertices(),this.calculateTints();for(let t=0,i=this.batches.length;t<i;t++){const n=this.batches[t];n.worldAlpha=this.worldAlpha*n.alpha,e.plugins[this.pluginName].render(n)}}}_renderDirect(e){const t=this._resolveDirectShader(e),i=this._geometry,n=this.worldAlpha,r=t.uniforms,o=i.drawCalls;r.translationMatrix=this.transform.worldTransform,At.shared.setValue(this._tintColor).premultiply(n).toArray(r.tint),e.shader.bind(t),e.geometry.bind(i,t),e.state.set(this.state);for(let a=0,c=o.length;a<c;a++)this._renderDrawCallDirect(e,i.drawCalls[a])}_renderDrawCallDirect(e,t){const{texArray:i,type:n,size:r,start:o}=t,a=i.count;for(let c=0;c<a;c++)e.texture.bind(i.elements[c],c);e.geometry.draw(n,r,o)}_resolveDirectShader(e){let t=this.shader;const i=this.pluginName;if(!t){if(!Qd[i]){const{maxTextures:n}=e.plugins[i],r=new Int32Array(n);for(let c=0;c<n;c++)r[c]=c;const o={tint:new Float32Array([1,1,1,1]),translationMatrix:new Ft,default:Bs.from({uSamplers:r},!0)},a=e.plugins[i]._shader.program;Qd[i]=new Ns(a,o)}t=Qd[i]}return t}_calculateBounds(){this.finishPoly();const e=this._geometry;if(!e.graphicsData.length)return;const{minX:t,minY:i,maxX:n,maxY:r}=e.bounds;this._bounds.addFrame(this.transform,t,i,n,r)}containsPoint(e){return this.worldTransform.applyInverse(e,Lc._TEMP_POINT),this._geometry.containsPoint(Lc._TEMP_POINT)}calculateTints(){if(this.batchTint!==this.tint){this.batchTint=this._tintColor.toNumber();for(let e=0;e<this.batches.length;e++){const t=this.batches[e];t._tintRGB=At.shared.setValue(this._tintColor).multiply(t._batchRGB).toLittleEndianNumber()}}}calculateVertices(){const e=this.transform._worldID;if(this._transformID===e)return;this._transformID=e;const t=this.transform.worldTransform,i=t.a,n=t.b,r=t.c,o=t.d,a=t.tx,c=t.ty,l=this._geometry.points,h=this.vertexData;let u=0;for(let d=0;d<l.length;d+=2){const f=l[d],m=l[d+1];h[u++]=i*f+r*m+a,h[u++]=o*m+n*f+c}}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)}};dm.curves=ca,dm._TEMP_POINT=new St;let Ni=dm;class RI{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 ef=new St,Ev=new ro,u1=class d1 extends gi{constructor(e,t,i,n=on.TRIANGLES){super(),this.geometry=e,this.shader=t,this.state=i||mn.for2d(),this.drawMode=n,this.start=0,this.size=0,this.uvs=null,this.indices=null,this.vertexData=new Float32Array(1),this.vertexDirty=-1,this._transformID=-1,this._roundPixels=Be.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===on.TRIANGLES&&t.length<d1.BATCHABLE_SIZE*2?this._renderToBatch(e):this._renderDefault(e)}_renderDefault(e){const t=this.shader;t.alpha=this.worldAlpha,t.update&&t.update(),e.batch.flush(),t.uniforms.translationMatrix=this.transform.worldTransform.toArray(!0),e.shader.bind(t),e.state.set(this.state),e.geometry.bind(this.geometry,t),e.geometry.draw(this.drawMode,this.size,this.start,this.geometry.instanceCount)}_renderToBatch(e){const t=this.geometry,i=this.shader;i.uvMatrix&&(i.uvMatrix.update(),this.calculateUvs()),this.calculateVertices(),this.indices=t.indexBuffer.data,this._tintRGB=i._tintRGB,this._texture=i.texture;const n=this.material.pluginName;e.batch.setObjectRenderer(e.plugins[n]),e.plugins[n].render(this)}calculateVertices(){const e=this.geometry.buffers[0],t=e.data,i=e._updateID;if(i===this.vertexDirty&&this._transformID===this.transform._worldID)return;this._transformID=this.transform._worldID,this.vertexData.length!==t.length&&(this.vertexData=new Float32Array(t.length));const n=this.transform.worldTransform,r=n.a,o=n.b,a=n.c,c=n.d,l=n.tx,h=n.ty,u=this.vertexData;for(let d=0;d<u.length/2;d++){const f=t[d*2],m=t[d*2+1];u[d*2]=r*f+a*m+l,u[d*2+1]=o*f+c*m+h}if(this._roundPixels){const d=Be.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 RI(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,ef);const t=this.geometry.getBuffer("aVertexPosition").data,i=Ev.points,n=this.geometry.getIndex().data,r=n.length,o=this.drawMode===4?3:1;for(let a=0;a+2<r;a+=o){const c=n[a]*2,l=n[a+1]*2,h=n[a+2]*2;if(i[0]=t[c],i[1]=t[c+1],i[2]=t[l],i[3]=t[l+1],i[4]=t[h],i[5]=t[h+1],Ev.contains(ef.x,ef.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}};u1.BATCHABLE_SIZE=100;let bl=u1;class Mp extends fn{constructor(e,t,i){super();const n=new $t(e),r=new $t(t,!0),o=new $t(i,!0,!0);this.addAttribute("aVertexPosition",n,2,!1,Ue.FLOAT).addAttribute("aTextureCoord",r,2,!1,Ue.FLOAT).addIndex(o),this._updateId=-1}get vertexDirtyId(){return this.buffers[0]._updateID}}var PI=`varying vec2 vTextureCoord;
|
||
uniform vec4 uColor;
|
||
|
||
uniform sampler2D uSampler;
|
||
|
||
void main(void)
|
||
{
|
||
gl_FragColor = texture2D(uSampler, vTextureCoord) * uColor;
|
||
}
|
||
`,kI=`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 ph extends Ns{constructor(e,t){const i={uSampler:e,alpha:1,uTextureMatrix:Ft.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||an.from(kI,PI),i),this._colorDirty=!1,this.uvMatrix=new vp(e),this.batchable=t.program===void 0,this.pluginName=t.pluginName,this._tintColor=new At(t.tint),this._tintRGB=this._tintColor.toLittleEndianNumber(),this._colorDirty=!0,this.alpha=t.alpha}get texture(){return this.uniforms.uSampler}set texture(e){this.uniforms.uSampler!==e&&(!this.uniforms.uSampler.baseTexture.alphaMode!=!e.baseTexture.alphaMode&&(this._colorDirty=!0),this.uniforms.uSampler=e,this.uvMatrix.texture=e)}set alpha(e){e!==this._alpha&&(this._alpha=e,this._colorDirty=!0)}get alpha(){return this._alpha}set tint(e){e!==this.tint&&(this._tintColor.setValue(e),this._tintRGB=this._tintColor.toLittleEndianNumber(),this._colorDirty=!0)}get tint(){return this._tintColor.value}get tintValue(){return this._tintColor.toNumber()}update(){if(this._colorDirty){this._colorDirty=!1;const e=this.texture.baseTexture.alphaMode;At.shared.setValue(this._tintColor).premultiply(this._alpha,e).toArray(this.uniforms.uColor)}this.uvMatrix.update()&&(this.uniforms.uTextureMatrix=this.uvMatrix.mapCoord)}}class FI extends bl{constructor(e=Ke.EMPTY,t,i,n,r){const o=new Mp(t,i,n);o.getBuffer("aVertexPosition").static=!1;const a=new ph(e);super(o,a,null,r),this.autoUpdate=!0}get vertices(){return this.geometry.getBuffer("aVertexPosition").data}set vertices(e){this.geometry.getBuffer("aVertexPosition").data=e}_render(e){this.autoUpdate&&this.geometry.getBuffer("aVertexPosition").update(),super._render(e)}}class Av{constructor(e,t,i){this.geometry=new fn,this.indexBuffer=null,this.size=i,this.dynamicProperties=[],this.staticProperties=[];for(let n=0;n<e.length;++n){let r=e[n];r={attributeName:r.attributeName,size:r.size,uploadFunction:r.uploadFunction,type:r.type||Ue.FLOAT,offset:r.offset},t[n]?this.dynamicProperties.push(r):this.staticProperties.push(r)}this.staticStride=0,this.staticBuffer=null,this.staticData=null,this.staticDataUint32=null,this.dynamicStride=0,this.dynamicBuffer=null,this.dynamicData=null,this.dynamicDataUint32=null,this._updateID=0,this.initBuffers()}initBuffers(){const e=this.geometry;let t=0;this.indexBuffer=new $t(tC(this.size),!0,!0),e.addIndex(this.indexBuffer),this.dynamicStride=0;for(let o=0;o<this.dynamicProperties.length;++o){const a=this.dynamicProperties[o];a.offset=t,t+=a.size,this.dynamicStride+=a.size}const i=new ArrayBuffer(this.size*this.dynamicStride*4*4);this.dynamicData=new Float32Array(i),this.dynamicDataUint32=new Uint32Array(i),this.dynamicBuffer=new $t(this.dynamicData,!1,!1);let n=0;this.staticStride=0;for(let o=0;o<this.staticProperties.length;++o){const a=this.staticProperties[o];a.offset=n,n+=a.size,this.staticStride+=a.size}const r=new ArrayBuffer(this.size*this.staticStride*4*4);this.staticData=new Float32Array(r),this.staticDataUint32=new Uint32Array(r),this.staticBuffer=new $t(this.staticData,!0,!1);for(let o=0;o<this.dynamicProperties.length;++o){const a=this.dynamicProperties[o];e.addAttribute(a.attributeName,this.dynamicBuffer,0,a.type===Ue.UNSIGNED_BYTE,a.type,this.dynamicStride*4,a.offset*4)}for(let o=0;o<this.staticProperties.length;++o){const a=this.staticProperties[o];e.addAttribute(a.attributeName,this.staticBuffer,0,a.type===Ue.UNSIGNED_BYTE,a.type,this.staticStride*4,a.offset*4)}}uploadDynamic(e,t,i){for(let n=0;n<this.dynamicProperties.length;n++){const r=this.dynamicProperties[n];r.uploadFunction(e,t,i,r.type===Ue.UNSIGNED_BYTE?this.dynamicDataUint32:this.dynamicData,this.dynamicStride,r.offset)}this.dynamicBuffer._updateID++}uploadStatic(e,t,i){for(let n=0;n<this.staticProperties.length;n++){const r=this.staticProperties[n];r.uploadFunction(e,t,i,r.type===Ue.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 OI=`varying vec2 vTextureCoord;
|
||
varying vec4 vColor;
|
||
|
||
uniform sampler2D uSampler;
|
||
|
||
void main(void){
|
||
vec4 color = texture2D(uSampler, vTextureCoord) * vColor;
|
||
gl_FragColor = color;
|
||
}`,LI=`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 f1 extends uu{constructor(e){super(e),this.shader=null,this.properties=null,this.tempMatrix=new Ft,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:Ue.UNSIGNED_BYTE,uploadFunction:this.uploadTint,offset:0}],this.shader=Ns.from(LI,OI,{}),this.state=mn.for2d()}render(e){const t=e.children,i=e._maxSize,n=e._batchSize,r=this.renderer;let o=t.length;if(o===0)return;o>i&&!e.autoResize&&(o=i);let a=e._buffers;a||(a=e._buffers=this.generateBuffers(e));const c=t[0]._texture.baseTexture,l=c.alphaMode>0;this.state.blendMode=ub(e.blendMode,l),r.state.set(this.state);const h=r.gl,u=e.worldTransform.copyTo(this.tempMatrix);u.prepend(r.globalUniforms.uniforms.projectionMatrix),this.shader.uniforms.translationMatrix=u.toArray(!0),this.shader.uniforms.uColor=At.shared.setValue(e.tintRgb).premultiply(e.worldAlpha,l).toArray(this.shader.uniforms.uColor),this.shader.uniforms.uSampler=c,this.renderer.shader.bind(this.shader);let d=!1;for(let f=0,m=0;f<o;f+=n,m+=1){let p=o-f;p>n&&(p=n),m>=a.length&&a.push(this._generateOneMoreBuffer(e));const g=a[m];g.uploadDynamic(t,f,p);const x=e._bufferUpdateIDs[m]||0;d=d||g._updateID<x,d&&(g._updateID=e._updateID,g.uploadStatic(t,f,p)),r.geometry.bind(g.geometry),h.drawElements(h.TRIANGLES,p*6,h.UNSIGNED_SHORT,0)}}generateBuffers(e){const t=[],i=e._maxSize,n=e._batchSize,r=e._properties;for(let o=0;o<i;o+=n)t.push(new Av(this.properties,r,n));return t}_generateOneMoreBuffer(e){const t=e._batchSize,i=e._properties;return new Av(this.properties,i,t)}uploadVertices(e,t,i,n,r,o){let a=0,c=0,l=0,h=0;for(let u=0;u<i;++u){const d=e[t+u],f=d._texture,m=d.scale.x,p=d.scale.y,g=f.trim,x=f.orig;g?(c=g.x-d.anchor.x*x.width,a=c+g.width,h=g.y-d.anchor.y*x.height,l=h+g.height):(a=x.width*(1-d.anchor.x),c=x.width*-d.anchor.x,l=x.height*(1-d.anchor.y),h=x.height*-d.anchor.y),n[o]=c*m,n[o+1]=h*p,n[o+r]=a*m,n[o+r+1]=h*p,n[o+r*2]=a*m,n[o+r*2+1]=l*p,n[o+r*3]=c*m,n[o+r*3+1]=l*p,o+=r*4}}uploadPosition(e,t,i,n,r,o){for(let a=0;a<i;a++){const c=e[t+a].position;n[o]=c.x,n[o+1]=c.y,n[o+r]=c.x,n[o+r+1]=c.y,n[o+r*2]=c.x,n[o+r*2+1]=c.y,n[o+r*3]=c.x,n[o+r*3+1]=c.y,o+=r*4}}uploadRotation(e,t,i,n,r,o){for(let a=0;a<i;a++){const c=e[t+a].rotation;n[o]=c,n[o+r]=c,n[o+r*2]=c,n[o+r*3]=c,o+=r*4}}uploadUvs(e,t,i,n,r,o){for(let a=0;a<i;++a){const c=e[t+a]._texture._uvs;c?(n[o]=c.x0,n[o+1]=c.y0,n[o+r]=c.x1,n[o+r+1]=c.y1,n[o+r*2]=c.x2,n[o+r*2+1]=c.y2,n[o+r*3]=c.x3,n[o+r*3+1]=c.y3,o+=r*4):(n[o]=0,n[o+1]=0,n[o+r]=0,n[o+r+1]=0,n[o+r*2]=0,n[o+r*2+1]=0,n[o+r*3]=0,n[o+r*3+1]=0,o+=r*4)}}uploadTint(e,t,i,n,r,o){for(let a=0;a<i;++a){const c=e[t+a],l=At.shared.setValue(c._tintRGB).toPremultiplied(c.alpha,c.texture.baseTexture.alphaMode>0);n[o]=l,n[o+r]=l,n[o+r*2]=l,n[o+r*3]=l,o+=r*4}}destroy(){super.destroy(),this.shader&&(this.shader.destroy(),this.shader=null),this.tempMatrix=null}}f1.extension={name:"particle",type:ke.RendererPlugin};$e.add(f1);var mu=(s=>(s[s.LINEAR_VERTICAL=0]="LINEAR_VERTICAL",s[s.LINEAR_HORIZONTAL=1]="LINEAR_HORIZONTAL",s))(mu||{});const hc={willReadFrequently:!0},js=class Ye{static get experimentalLetterSpacingSupported(){let e=Ye._experimentalLetterSpacingSupported;if(e!==void 0){const t=Be.ADAPTER.getCanvasRenderingContext2D().prototype;e=Ye._experimentalLetterSpacingSupported="letterSpacing"in t||"textLetterSpacing"in t}return e}constructor(e,t,i,n,r,o,a,c,l){this.text=e,this.style=t,this.width=i,this.height=n,this.lines=r,this.lineWidths=o,this.lineHeight=a,this.maxLineWidth=c,this.fontProperties=l}static measureText(e,t,i,n=Ye._canvas){i=i??t.wordWrap;const r=t.toFontString(),o=Ye.measureFont(r);o.fontSize===0&&(o.fontSize=t.fontSize,o.ascent=t.fontSize);const a=n.getContext("2d",hc);a.font=r;const c=(i?Ye.wordWrap(e,t,n):e).split(/(?:\r\n|\r|\n)/),l=new Array(c.length);let h=0;for(let m=0;m<c.length;m++){const p=Ye._measureText(c[m],t.letterSpacing,a);l[m]=p,h=Math.max(h,p)}let u=h+t.strokeThickness;t.dropShadow&&(u+=t.dropShadowDistance);const d=t.lineHeight||o.fontSize+t.strokeThickness;let f=Math.max(d,o.fontSize+t.strokeThickness*2)+t.leading+(c.length-1)*(d+t.leading);return t.dropShadow&&(f+=t.dropShadowDistance),new Ye(e,t,u,f,c,l,d+t.leading,h,o)}static _measureText(e,t,i){let n=!1;Ye.experimentalLetterSpacingSupported&&(Ye.experimentalLetterSpacing?(i.letterSpacing=`${t}px`,i.textLetterSpacing=`${t}px`,n=!0):(i.letterSpacing="0px",i.textLetterSpacing="0px"));let r=i.measureText(e).width;return r>0&&(n?r-=t:r+=(Ye.graphemeSegmenter(e).length-1)*t),r}static wordWrap(e,t,i=Ye._canvas){const n=i.getContext("2d",hc);let r=0,o="",a="";const c=Object.create(null),{letterSpacing:l,whiteSpace:h}=t,u=Ye.collapseSpaces(h),d=Ye.collapseNewlines(h);let f=!u;const m=t.wordWrapWidth+l,p=Ye.tokenize(e);for(let g=0;g<p.length;g++){let x=p[g];if(Ye.isNewline(x)){if(!d){a+=Ye.addLine(o),f=!u,o="",r=0;continue}x=" "}if(u){const y=Ye.isBreakingSpace(x),S=Ye.isBreakingSpace(o[o.length-1]);if(y&&S)continue}const v=Ye.getFromCache(x,l,c,n);if(v>m)if(o!==""&&(a+=Ye.addLine(o),o="",r=0),Ye.canBreakWords(x,t.breakWords)){const y=Ye.wordWrapSplit(x);for(let S=0;S<y.length;S++){let C=y[S],w=C,b=1;for(;y[S+b];){const A=y[S+b];if(!Ye.canBreakChars(w,A,x,S,t.breakWords))C+=A;else break;w=A,b++}S+=b-1;const _=Ye.getFromCache(C,l,c,n);_+r>m&&(a+=Ye.addLine(o),f=!1,o="",r=0),o+=C,r+=_}}else{o.length>0&&(a+=Ye.addLine(o),o="",r=0);const y=g===p.length-1;a+=Ye.addLine(x,!y),f=!1,o="",r=0}else v+r>m&&(f=!1,a+=Ye.addLine(o),o="",r=0),(o.length>0||!Ye.isBreakingSpace(x)||f)&&(o+=x,r+=v)}return a+=Ye.addLine(o,!1),a}static addLine(e,t=!0){return e=Ye.trimRight(e),e=t?`${e}
|
||
`:e,e}static getFromCache(e,t,i,n){let r=i[e];return typeof r!="number"&&(r=Ye._measureText(e,t,n)+t,i[e]=r),r}static collapseSpaces(e){return e==="normal"||e==="pre-line"}static collapseNewlines(e){return e==="normal"}static trimRight(e){if(typeof e!="string")return"";for(let t=e.length-1;t>=0;t--){const i=e[t];if(!Ye.isBreakingSpace(i))break;e=e.slice(0,-1)}return e}static isNewline(e){return typeof e!="string"?!1:Ye._newlines.includes(e.charCodeAt(0))}static isBreakingSpace(e,t){return typeof e!="string"?!1:Ye._breakingSpaces.includes(e.charCodeAt(0))}static tokenize(e){const t=[];let i="";if(typeof e!="string")return t;for(let n=0;n<e.length;n++){const r=e[n],o=e[n+1];if(Ye.isBreakingSpace(r,o)||Ye.isNewline(r)){i!==""&&(t.push(i),i=""),t.push(r);continue}i+=r}return i!==""&&t.push(i),t}static canBreakWords(e,t){return t}static canBreakChars(e,t,i,n,r){return!0}static wordWrapSplit(e){return Ye.graphemeSegmenter(e)}static measureFont(e){if(Ye._fonts[e])return Ye._fonts[e];const t={ascent:0,descent:0,fontSize:0},i=Ye._canvas,n=Ye._context;n.font=e;const r=Ye.METRICS_STRING+Ye.BASELINE_SYMBOL,o=Math.ceil(n.measureText(r).width);let a=Math.ceil(n.measureText(Ye.BASELINE_SYMBOL).width);const c=Math.ceil(Ye.HEIGHT_MULTIPLIER*a);if(a=a*Ye.BASELINE_MULTIPLIER|0,o===0||c===0)return Ye._fonts[e]=t,t;i.width=o,i.height=c,n.fillStyle="#f00",n.fillRect(0,0,o,c),n.font=e,n.textBaseline="alphabetic",n.fillStyle="#000",n.fillText(r,0,a);const l=n.getImageData(0,0,o,c).data,h=l.length,u=o*4;let d=0,f=0,m=!1;for(d=0;d<a;++d){for(let p=0;p<u;p+=4)if(l[f+p]!==255){m=!0;break}if(!m)f+=u;else break}for(t.ascent=a-d,f=h-u,m=!1,d=c;d>a;--d){for(let p=0;p<u;p+=4)if(l[f+p]!==255){m=!0;break}if(!m)f-=u;else break}return t.descent=d-a,t.fontSize=t.ascent+t.descent,Ye._fonts[e]=t,t}static clearMetrics(e=""){e?delete Ye._fonts[e]:Ye._fonts={}}static get _canvas(){var e;if(!Ye.__canvas){let t;try{const i=new OffscreenCanvas(0,0);if((e=i.getContext("2d",hc))!=null&&e.measureText)return Ye.__canvas=i,i;t=Be.ADAPTER.createCanvas()}catch{t=Be.ADAPTER.createCanvas()}t.width=t.height=10,Ye.__canvas=t}return Ye.__canvas}static get _context(){return Ye.__context||(Ye.__context=Ye._canvas.getContext("2d",hc)),Ye.__context}};js.METRICS_STRING="|ÉqÅ",js.BASELINE_SYMBOL="M",js.BASELINE_MULTIPLIER=1.4,js.HEIGHT_MULTIPLIER=2,js.graphemeSegmenter=(()=>{if(typeof(Intl==null?void 0:Intl.Segmenter)=="function"){const s=new Intl.Segmenter;return e=>[...s.segment(e)].map(t=>t.segment)}return s=>[...s]})(),js.experimentalLetterSpacing=!1,js._fonts={},js._newlines=[10,13],js._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288];let hr=js;const BI=["serif","sans-serif","monospace","cursive","fantasy","system-ui"],m1=class Ha{constructor(e){this.styleID=0,this.reset(),sf(this,e,e)}clone(){const e={};return sf(e,this,Ha.defaultStyle),new Ha(e)}reset(){sf(this,Ha.defaultStyle,Ha.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=tf(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=tf(e);this._fill!==t&&(this._fill=t,this.styleID++)}get fillGradientType(){return this._fillGradientType}set fillGradientType(e){this._fillGradientType!==e&&(this._fillGradientType=e,this.styleID++)}get fillGradientStops(){return this._fillGradientStops}set fillGradientStops(e){NI(this._fillGradientStops,e)||(this._fillGradientStops=e,this.styleID++)}get fontFamily(){return this._fontFamily}set fontFamily(e){this.fontFamily!==e&&(this._fontFamily=e,this.styleID++)}get fontSize(){return this._fontSize}set fontSize(e){this._fontSize!==e&&(this._fontSize=e,this.styleID++)}get fontStyle(){return this._fontStyle}set fontStyle(e){this._fontStyle!==e&&(this._fontStyle=e,this.styleID++)}get fontVariant(){return this._fontVariant}set fontVariant(e){this._fontVariant!==e&&(this._fontVariant=e,this.styleID++)}get fontWeight(){return this._fontWeight}set fontWeight(e){this._fontWeight!==e&&(this._fontWeight=e,this.styleID++)}get letterSpacing(){return this._letterSpacing}set letterSpacing(e){this._letterSpacing!==e&&(this._letterSpacing=e,this.styleID++)}get lineHeight(){return this._lineHeight}set lineHeight(e){this._lineHeight!==e&&(this._lineHeight=e,this.styleID++)}get leading(){return this._leading}set leading(e){this._leading!==e&&(this._leading=e,this.styleID++)}get lineJoin(){return this._lineJoin}set lineJoin(e){this._lineJoin!==e&&(this._lineJoin=e,this.styleID++)}get miterLimit(){return this._miterLimit}set miterLimit(e){this._miterLimit!==e&&(this._miterLimit=e,this.styleID++)}get padding(){return this._padding}set padding(e){this._padding!==e&&(this._padding=e,this.styleID++)}get stroke(){return this._stroke}set stroke(e){const t=tf(e);this._stroke!==t&&(this._stroke=t,this.styleID++)}get strokeThickness(){return this._strokeThickness}set strokeThickness(e){this._strokeThickness!==e&&(this._strokeThickness=e,this.styleID++)}get textBaseline(){return this._textBaseline}set textBaseline(e){this._textBaseline!==e&&(this._textBaseline=e,this.styleID++)}get trim(){return this._trim}set trim(e){this._trim!==e&&(this._trim=e,this.styleID++)}get whiteSpace(){return this._whiteSpace}set whiteSpace(e){this._whiteSpace!==e&&(this._whiteSpace=e,this.styleID++)}get wordWrap(){return this._wordWrap}set wordWrap(e){this._wordWrap!==e&&(this._wordWrap=e,this.styleID++)}get wordWrapWidth(){return this._wordWrapWidth}set wordWrapWidth(e){this._wordWrapWidth!==e&&(this._wordWrapWidth=e,this.styleID++)}toFontString(){const e=typeof this.fontSize=="number"?`${this.fontSize}px`:this.fontSize;let t=this.fontFamily;Array.isArray(this.fontFamily)||(t=this.fontFamily.split(","));for(let i=t.length-1;i>=0;i--){let n=t[i].trim();!/([\"\'])[^\'\"]+\1/.test(n)&&!BI.includes(n)&&(n=`"${n}"`),t[i]=n}return`${this.fontStyle} ${this.fontVariant} ${this.fontWeight} ${e} ${t.join(",")}`}};m1.defaultStyle={align:"left",breakWords:!1,dropShadow:!1,dropShadowAlpha:1,dropShadowAngle:Math.PI/6,dropShadowBlur:0,dropShadowColor:"black",dropShadowDistance:5,fill:"black",fillGradientType:mu.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 Er=m1;function tf(s){const e=At.shared,t=i=>{const n=e.setValue(i);return n.alpha===1?n.toHex():n.toRgbaString()};return Array.isArray(s)?s.map(t):t(s)}function NI(s,e){if(!Array.isArray(s)||!Array.isArray(e)||s.length!==e.length)return!1;for(let t=0;t<s.length;++t)if(s[t]!==e[t])return!1;return!0}function sf(s,e,t){for(const i in t)Array.isArray(e[i])?s[i]=e[i].slice():s[i]=e[i]}const DI={texture:!0,children:!1,baseTexture:!0},p1=class fm extends Pr{constructor(e,t,i){let n=!1;i||(i=Be.ADAPTER.createCanvas(),n=!0),i.width=3,i.height=3;const r=Ke.from(i);r.orig=new ct,r.trim=new ct,super(r),this._ownCanvas=n,this.canvas=i,this.context=i.getContext("2d",{willReadFrequently:!0}),this._resolution=fm.defaultResolution??Be.RESOLUTION,this._autoResolution=fm.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 hr.experimentalLetterSpacing}static set experimentalLetterSpacing(e){mt("7.1.0","Text.experimentalLetterSpacing is deprecated, use TextMetrics.experimentalLetterSpacing"),hr.experimentalLetterSpacing=e}updateText(e){const t=this._style;if(this.localStyleID!==t.styleID&&(this.dirty=!0,this.localStyleID=t.styleID),!this.dirty&&e)return;this._font=this._style.toFontString();const i=this.context,n=hr.measureText(this._text||" ",this._style,this._style.wordWrap,this.canvas),r=n.width,o=n.height,a=n.lines,c=n.lineHeight,l=n.lineWidths,h=n.maxLineWidth,u=n.fontProperties;this.canvas.width=Math.ceil(Math.ceil(Math.max(1,r)+t.padding*2)*this._resolution),this.canvas.height=Math.ceil(Math.ceil(Math.max(1,o)+t.padding*2)*this._resolution),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 m=t.dropShadow?2:1;for(let p=0;p<m;++p){const g=t.dropShadow&&p===0,x=g?Math.ceil(Math.max(1,o)+t.padding*2):0,v=x*this._resolution;if(g){i.fillStyle="black",i.strokeStyle="black";const S=t.dropShadowColor,C=t.dropShadowBlur*this._resolution,w=t.dropShadowDistance*this._resolution;i.shadowColor=At.shared.setValue(S).setAlpha(t.dropShadowAlpha).toRgbaString(),i.shadowBlur=C,i.shadowOffsetX=Math.cos(t.dropShadowAngle)*w,i.shadowOffsetY=Math.sin(t.dropShadowAngle)*w+v}else i.fillStyle=this._generateFillStyle(t,a,n),i.strokeStyle=t.stroke,i.shadowColor="black",i.shadowBlur=0,i.shadowOffsetX=0,i.shadowOffsetY=0;let y=(c-u.fontSize)/2;c-u.fontSize<0&&(y=0);for(let S=0;S<a.length;S++)d=t.strokeThickness/2,f=t.strokeThickness/2+S*c+u.ascent+y,t.align==="right"?d+=h-l[S]:t.align==="center"&&(d+=(h-l[S])/2),t.stroke&&t.strokeThickness&&this.drawLetterSpacing(a[S],d+t.padding,f+t.padding-x,!0),t.fill&&this.drawLetterSpacing(a[S],d+t.padding,f+t.padding-x)}this.updateTexture()}drawLetterSpacing(e,t,i,n=!1){const r=this._style.letterSpacing;let o=!1;if(hr.experimentalLetterSpacingSupported&&(hr.experimentalLetterSpacing?(this.context.letterSpacing=`${r}px`,this.context.textLetterSpacing=`${r}px`,o=!0):(this.context.letterSpacing="0px",this.context.textLetterSpacing="0px")),r===0||o){n?this.context.strokeText(e,t,i):this.context.fillText(e,t,i);return}let a=t;const c=hr.graphemeSegmenter(e);let l=this.context.measureText(e).width,h=0;for(let u=0;u<c.length;++u){const d=c[u];n?this.context.strokeText(d,a,i):this.context.fillText(d,a,i);let f="";for(let m=u+1;m<c.length;++m)f+=c[m];h=this.context.measureText(f).width,a+=l-h+r,l=h}}updateTexture(){const e=this.canvas;if(this._style.trim){const o=rC(e);o.data&&(e.width=o.width,e.height=o.height,this.context.putImageData(o.data,0,0))}const t=this._texture,i=this._style,n=i.trim?0:i.padding,r=t.baseTexture;t.trim.width=t._frame.width=e.width/this._resolution,t.trim.height=t._frame.height=e.height/this._resolution,t.trim.x=-n,t.trim.y=-n,t.orig.width=t._frame.width-n*2,t.orig.height=t._frame.height-n*2,this._onTextureUpdate(),r.setRealSize(e.width,e.height,this._resolution),t.updateUvs(),this.dirty=!1}_render(e){this._autoResolution&&this._resolution!==e.resolution&&(this._resolution=e.resolution,this.dirty=!0),this.updateText(!0),super._render(e)}updateTransform(){this.updateText(!0),super.updateTransform()}getBounds(e,t){return this.updateText(!0),this._textureID===-1&&(e=!1),super.getBounds(e,t)}getLocalBounds(e){return this.updateText(!0),super.getLocalBounds.call(this,e)}_calculateBounds(){this.calculateVertices(),this._bounds.addQuad(this.vertexData)}_generateFillStyle(e,t,i){const n=e.fill;if(Array.isArray(n)){if(n.length===1)return n[0]}else return n;let r;const o=e.dropShadow?e.dropShadowDistance:0,a=e.padding||0,c=this.canvas.width/this._resolution-o-a*2,l=this.canvas.height/this._resolution-o-a*2,h=n.slice(),u=e.fillGradientStops.slice();if(!u.length){const d=h.length+1;for(let f=1;f<d;++f)u.push(f/d)}if(h.unshift(n[0]),u.unshift(0),h.push(n[n.length-1]),u.push(1),e.fillGradientType===mu.LINEAR_VERTICAL){r=this.context.createLinearGradient(c/2,a,c/2,l+a);const d=i.fontProperties.fontSize+e.strokeThickness;for(let f=0;f<t.length;f++){const m=i.lineHeight*(f-1)+d,p=i.lineHeight*f;let g=p;f>0&&m>p&&(g=(p+m)/2);const x=p+d,v=i.lineHeight*(f+1);let y=x;f+1<t.length&&v<x&&(y=(x+v)/2);const S=(y-g)/l;for(let C=0;C<h.length;C++){let w=0;typeof u[C]=="number"?w=u[C]:w=C/h.length;let b=Math.min(1,Math.max(0,g/l+w*S));b=Number(b.toFixed(5)),r.addColorStop(b,h[C])}}}else{r=this.context.createLinearGradient(a,l/2,c+a,l/2);const d=h.length+1;let f=1;for(let m=0;m<h.length;m++){let p;typeof u[m]=="number"?p=u[m]:p=f/d,r.addColorStop(p,h[m]),f++}}return r}destroy(e){typeof e=="boolean"&&(e={children:e}),e=Object.assign({},DI,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=yr(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=yr(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 Er?this._style=e:this._style=new Er(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)}};p1.defaultAutoResolution=!0;let Tp=p1;class UI{constructor(e){this.maxItemsPerFrame=e,this.itemsLeft=0}beginFrame(){this.itemsLeft=this.maxItemsPerFrame}allowedToUpload(){return this.itemsLeft-- >0}}function $I(s,e){var i;let t=!1;if((i=s==null?void 0:s._textures)!=null&&i.length){for(let n=0;n<s._textures.length;n++)if(s._textures[n]instanceof Ke){const r=s._textures[n].baseTexture;e.includes(r)||(e.push(r),t=!0)}}return t}function XI(s,e){if(s.baseTexture instanceof it){const t=s.baseTexture;return e.includes(t)||e.push(t),!0}return!1}function VI(s,e){if(s._texture&&s._texture instanceof Ke){const t=s._texture.baseTexture;return e.includes(t)||e.push(t),!0}return!1}function YI(s,e){return e instanceof Tp?(e.updateText(!0),!0):!1}function GI(s,e){if(e instanceof Er){const t=e.toFontString();return hr.measureFont(t),!0}return!1}function jI(s,e){if(s instanceof Tp){e.includes(s.style)||e.push(s.style),e.includes(s)||e.push(s);const t=s._texture.baseTexture;return e.includes(t)||e.push(t),!0}return!1}function HI(s,e){return s instanceof Er?(e.includes(s)||e.push(s),!0):!1}const g1=class v1{constructor(e){this.limiter=new UI(v1.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(jI),this.registerFindHook(HI),this.registerFindHook($I),this.registerFindHook(XI),this.registerFindHook(VI),this.registerUploadHook(YI),this.registerUploadHook(GI)}upload(e){return new Promise(t=>{e&&this.add(e),this.queue.length?(this.completes.push(t),this.ticking||(this.ticking=!0,Yi.system.addOnce(this.tick,this,uo.UTILITY))):t()})}tick(){setTimeout(this.delayedTick,0)}prepareItems(){for(this.limiter.beginFrame();this.queue.length&&this.limiter.allowedToUpload();){const e=this.queue[0];let t=!1;if(e&&!e._destroyed){for(let i=0,n=this.uploadHooks.length;i<n;i++)if(this.uploadHooks[i](this.uploadHookHelper,e)){this.queue.shift(),t=!0;break}}t||this.queue.shift()}if(this.queue.length)Yi.system.addOnce(this.tick,this,uo.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 gi)for(let t=e.children.length-1;t>=0;t--)this.add(e.children[t]);return this}destroy(){this.ticking&&Yi.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}};g1.uploadsPerFrame=4;let mm=g1;Object.defineProperties(Be,{UPLOADS_PER_FRAME:{get(){return mm.uploadsPerFrame},set(s){mt("7.1.0","settings.UPLOADS_PER_FRAME is deprecated, use prepare.BasePrepare.uploadsPerFrame"),mm.uploadsPerFrame=s}}});function y1(s,e){return e instanceof it?(e._glTextures[s.CONTEXT_UID]||s.texture.bind(e),!0):!1}function WI(s,e){if(!(e instanceof Ni))return!1;const{geometry:t}=e;e.finishPoly(),t.updateBatches();const{batches:i}=t;for(let n=0;n<i.length;n++){const{texture:r}=i[n].style;r&&y1(s,r.baseTexture)}return t.batchable||s.geometry.bind(t,e._resolveDirectShader(s)),!0}function zI(s,e){return s instanceof Ni?(e.push(s),!0):!1}class x1 extends mm{constructor(e){super(e),this.uploadHookHelper=this.renderer,this.registerFindHook(zI),this.registerUploadHook(y1),this.registerUploadHook(WI)}}x1.extension={name:"prepare",type:ke.RendererSystem};$e.add(x1);var qI=`#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;
|
||
}
|
||
`,KI=`#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;
|
||
}
|
||
`,ZI=`#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;
|
||
}
|
||
`,Iv=`#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;
|
||
}
|
||
`,JI=`#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 uc=new Ft;class b1 extends uu{constructor(e){super(e),e.runners.contextChange.add(this),this.quad=new _b,this.state=mn.for2d()}contextChange(){const e=this.renderer,t={globals:e.globalUniforms};this.simpleShader=Ns.from(Iv,JI,t),this.shader=e.context.webGLVersion>1?Ns.from(KI,qI,t):Ns.from(Iv,ZI,t)}render(e){const t=this.renderer,i=this.quad;let n=i.vertices;n[0]=n[6]=e._width*-e.anchor.x,n[1]=n[3]=e._height*-e.anchor.y,n[2]=n[4]=e._width*(1-e.anchor.x),n[5]=n[7]=e._height*(1-e.anchor.y);const r=e.uvRespectAnchor?e.anchor.x:0,o=e.uvRespectAnchor?e.anchor.y:0;n=i.uvs,n[0]=n[6]=-r,n[1]=n[3]=-o,n[2]=n[4]=1-r,n[5]=n[7]=1-o,i.invalidate();const a=e._texture,c=a.baseTexture,l=c.alphaMode>0,h=e.tileTransform.localTransform,u=e.uvMatrix;let d=c.isPowerOfTwo&&a.frame.width===c.width&&a.frame.height===c.height;d&&(c._glTextures[t.CONTEXT_UID]?d=c.wrapMode!==Os.CLAMP:c.wrapMode===Os.CLAMP&&(c.wrapMode=Os.REPEAT));const f=d?this.simpleShader:this.shader,m=a.width,p=a.height,g=e._width,x=e._height;uc.set(h.a*m/g,h.b*m/x,h.c*p/g,h.d*p/x,h.tx/g,h.ty/x),uc.invert(),d?uc.prepend(u.mapCoord):(f.uniforms.uMapCoord=u.mapCoord.toArray(!0),f.uniforms.uClampFrame=u.uClampFrame,f.uniforms.uClampOffset=u.uClampOffset),f.uniforms.uTransform=uc.toArray(!0),f.uniforms.uColor=At.shared.setValue(e.tint).premultiply(e.worldAlpha,l).toArray(f.uniforms.uColor),f.uniforms.translationMatrix=e.transform.worldTransform.toArray(!0),f.uniforms.uSampler=a,t.shader.bind(f),t.geometry.bind(i),this.state.blendMode=ub(e.blendMode,l),t.state.set(this.state),t.geometry.draw(this.renderer.gl.TRIANGLES,6,0)}}b1.extension={name:"tilingSprite",type:ke.RendererPlugin};$e.add(b1);const w1=class Wa{constructor(e,t,i){this.linkedSheets=[],(e instanceof it||e instanceof Ke)&&(e={texture:e,data:t,resolutionFilename:i});const{texture:n,data:r,resolutionFilename:o=null,cachePrefix:a=""}=e;this.cachePrefix=a,this._texture=n instanceof Ke?n:null,this.baseTexture=n instanceof it?n:this._texture.baseTexture,this.textures={},this.animations={},this.data=r;const c=this.baseTexture.resource;this.resolution=this._updateResolution(o||(c?c.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=Hn(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<=Wa.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()})}_processFrames(e){let t=e;const i=Wa.BATCH_SIZE;for(;t-e<i&&t<this._frameKeys.length;){const n=this._frameKeys[t],r=this._frames[n],o=r.frame;if(o){let a=null,c=null;const l=r.trimmed!==!1&&r.sourceSize?r.sourceSize:r.frame,h=new ct(0,0,Math.floor(l.w)/this.resolution,Math.floor(l.h)/this.resolution);r.rotated?a=new ct(Math.floor(o.x)/this.resolution,Math.floor(o.y)/this.resolution,Math.floor(o.h)/this.resolution,Math.floor(o.w)/this.resolution):a=new ct(Math.floor(o.x)/this.resolution,Math.floor(o.y)/this.resolution,Math.floor(o.w)/this.resolution,Math.floor(o.h)/this.resolution),r.trimmed!==!1&&r.spriteSourceSize&&(c=new ct(Math.floor(r.spriteSourceSize.x)/this.resolution,Math.floor(r.spriteSourceSize.y)/this.resolution,Math.floor(o.w)/this.resolution,Math.floor(o.h)/this.resolution)),this.textures[n]=new Ke(this.baseTexture,a,h,c,r.rotated?2:0,r.anchor,r.borders),Ke.addToCache(this.textures[n],this.cachePrefix+n.toString())}t++}}_processAnimations(){const e=this.data.animations||{};for(const t in e){this.animations[t]=[];for(let i=0;i<e[t].length;i++){const n=e[t][i];this.animations[t].push(this.textures[n])}}}_parseComplete(){const e=this._callback;this._callback=null,this._batchIndex=0,e.call(this,this.textures)}_nextBatch(){this._processFrames(this._batchIndex*Wa.BATCH_SIZE),this._batchIndex++,setTimeout(()=>{this._batchIndex*Wa.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=[]}};w1.BATCH_SIZE=1e3;let Rv=w1;const QI=["jpg","png","jpeg","avif","webp","s3tc","s3tc_sRGB","etc","etc1","pvrtc","atc","astc","bptc"];function S1(s,e,t){const i={};if(s.forEach(n=>{i[n]=e}),Object.keys(e.textures).forEach(n=>{i[`${e.cachePrefix}${n}`]=e.textures[n]}),!t){const n=si.dirname(s[0]);e.linkedSheets.forEach((r,o)=>{Object.assign(i,S1([`${n}/${e.data.meta.related_multi_packs[o]}`],r,!0))})}return i}const eR={extension:ke.Asset,cache:{test:s=>s instanceof Rv,getCacheableAssets:(s,e)=>S1(s,e,!1)},resolver:{test:s=>{const e=s.split("?")[0].split("."),t=e.pop(),i=e.pop();return t==="json"&&QI.includes(i)},parse:s=>{var t;const e=s.split(".");return{resolution:parseFloat(((t=Be.RETINA_PREFIX.exec(s))==null?void 0:t[1])??"1"),format:e[e.length-2],src:s}}},loader:{name:"spritesheetLoader",extension:{type:ke.LoadParser,priority:os.Normal},async testParse(s,e){return si.extname(e.src).toLowerCase()===".json"&&!!s.frames},async parse(s,e,t){var h,u;const{texture:i,imageFilename:n,cachePrefix:r}=(e==null?void 0:e.data)??{};let o=si.dirname(e.src);o&&o.lastIndexOf("/")!==o.length-1&&(o+="/");let a;if(i&&i.baseTexture)a=i;else{const d=hh(o+(n??s.meta.image),e.src);a=(await t.load([d]))[d]}const c=new Rv({texture:a.baseTexture,data:s,resolutionFilename:e.src,cachePrefix:r});await c.parse();const l=(h=s==null?void 0:s.meta)==null?void 0:h.related_multi_packs;if(Array.isArray(l)){const d=[];for(const m of l){if(typeof m!="string")continue;let p=o+m;(u=e.data)!=null&&u.ignoreMultiPack||(p=hh(p,e.src),d.push(t.load({src:p,data:{ignoreMultiPack:!0}})))}const f=await Promise.all(d);c.linkedSheets=f,f.forEach(m=>{m.linkedSheets=[c].concat(c.linkedSheets.filter(p=>p!==m))})}return c},unload(s){s.destroy(!0)}}};$e.add(eR);class gh{constructor(){this.info=[],this.common=[],this.page=[],this.char=[],this.kerning=[],this.distanceField=[]}}class Bc{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 o=t[r].match(/^[a-z]+/gm)[0],a=t[r].match(/[a-zA-Z]+=([^\s"']+|"([^"]*)")/gm),c={};for(const l in a){const h=a[l].split("="),u=h[0],d=h[1].replace(/"/gm,""),f=parseFloat(d),m=isNaN(f)?d:f;c[u]=m}i[o].push(c)}const n=new gh;return i.info.forEach(r=>n.info.push({face:r.face,size:parseInt(r.size,10)})),i.common.forEach(r=>n.common.push({lineHeight:parseInt(r.lineHeight,10)})),i.page.forEach(r=>n.page.push({id:parseInt(r.id,10),file:r.file})),i.char.forEach(r=>n.char.push({id:parseInt(r.id,10),page:parseInt(r.page,10),x:parseInt(r.x,10),y:parseInt(r.y,10),width:parseInt(r.width,10),height:parseInt(r.height,10),xoffset:parseInt(r.xoffset,10),yoffset:parseInt(r.yoffset,10),xadvance:parseInt(r.xadvance,10)})),i.kerning.forEach(r=>n.kerning.push({first:parseInt(r.first,10),second:parseInt(r.second,10),amount:parseInt(r.amount,10)})),i.distanceField.forEach(r=>n.distanceField.push({distanceRange:parseInt(r.distanceRange,10),fieldType:r.fieldType})),n}}class pm{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 gh,i=e.getElementsByTagName("info"),n=e.getElementsByTagName("common"),r=e.getElementsByTagName("page"),o=e.getElementsByTagName("char"),a=e.getElementsByTagName("kerning"),c=e.getElementsByTagName("distanceField");for(let l=0;l<i.length;l++)t.info.push({face:i[l].getAttribute("face"),size:parseInt(i[l].getAttribute("size"),10)});for(let l=0;l<n.length;l++)t.common.push({lineHeight:parseInt(n[l].getAttribute("lineHeight"),10)});for(let l=0;l<r.length;l++)t.page.push({id:parseInt(r[l].getAttribute("id"),10)||0,file:r[l].getAttribute("file")});for(let l=0;l<o.length;l++){const h=o[l];t.char.push({id:parseInt(h.getAttribute("id"),10),page:parseInt(h.getAttribute("page"),10)||0,x:parseInt(h.getAttribute("x"),10),y:parseInt(h.getAttribute("y"),10),width:parseInt(h.getAttribute("width"),10),height:parseInt(h.getAttribute("height"),10),xoffset:parseInt(h.getAttribute("xoffset"),10),yoffset:parseInt(h.getAttribute("yoffset"),10),xadvance:parseInt(h.getAttribute("xadvance"),10)})}for(let l=0;l<a.length;l++)t.kerning.push({first:parseInt(a[l].getAttribute("first"),10),second:parseInt(a[l].getAttribute("second"),10),amount:parseInt(a[l].getAttribute("amount"),10)});for(let l=0;l<c.length;l++)t.distanceField.push({fieldType:c[l].getAttribute("fieldType"),distanceRange:parseInt(c[l].getAttribute("distanceRange"),10)});return t}}class gm{static test(e){return typeof e=="string"&&e.includes("<font>")?pm.test(Be.ADAPTER.parseXML(e)):!1}static parse(e){return pm.parse(Be.ADAPTER.parseXML(e))}}const nf=[Bc,pm,gm];function tR(s){for(let e=0;e<nf.length;e++)if(nf[e].test(s))return nf[e];return null}function iR(s,e,t,i,n,r){const o=t.fill;if(Array.isArray(o)){if(o.length===1)return o[0]}else return o;let a;const c=t.dropShadow?t.dropShadowDistance:0,l=t.padding||0,h=s.width/i-c-l*2,u=s.height/i-c-l*2,d=o.slice(),f=t.fillGradientStops.slice();if(!f.length){const m=d.length+1;for(let p=1;p<m;++p)f.push(p/m)}if(d.unshift(o[0]),f.unshift(0),d.push(o[o.length-1]),f.push(1),t.fillGradientType===mu.LINEAR_VERTICAL){a=e.createLinearGradient(h/2,l,h/2,u+l);let m=0;const p=(r.fontProperties.fontSize+t.strokeThickness)/u;for(let g=0;g<n.length;g++){const x=r.lineHeight*g;for(let v=0;v<d.length;v++){let y=0;typeof f[v]=="number"?y=f[v]:y=v/d.length;const S=x/u+y*p;let C=Math.max(m,S);C=Math.min(C,1),a.addColorStop(C,d[v]),m=C}}}else{a=e.createLinearGradient(l,u/2,h+l,u/2);const m=d.length+1;let p=1;for(let g=0;g<d.length;g++){let x;typeof f[g]=="number"?x=f[g]:x=p/m,a.addColorStop(x,d[g]),p++}}return a}function sR(s,e,t,i,n,r,o){const a=t.text,c=t.fontProperties;e.translate(i,n),e.scale(r,r);const l=o.strokeThickness/2,h=-(o.strokeThickness/2);if(e.font=o.toFontString(),e.lineWidth=o.strokeThickness,e.textBaseline=o.textBaseline,e.lineJoin=o.lineJoin,e.miterLimit=o.miterLimit,e.fillStyle=iR(s,e,o,r,[a],t),e.strokeStyle=o.stroke,o.dropShadow){const u=o.dropShadowColor,d=o.dropShadowBlur*r,f=o.dropShadowDistance*r;e.shadowColor=At.shared.setValue(u).setAlpha(o.dropShadowAlpha).toRgbaString(),e.shadowBlur=d,e.shadowOffsetX=Math.cos(o.dropShadowAngle)*f,e.shadowOffsetY=Math.sin(o.dropShadowAngle)*f}else e.shadowColor="black",e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0;o.stroke&&o.strokeThickness&&e.strokeText(a,l,h+t.lineHeight-c.descent),o.fill&&e.fillText(a,l,h+t.lineHeight-c.descent),e.setTransform(1,0,0,1,0,0),e.fillStyle="rgba(0, 0, 0, 0)"}function Nc(s){return s.codePointAt?s.codePointAt(0):s.charCodeAt(0)}function M1(s){return Array.from?Array.from(s):s.split("")}function nR(s){typeof s=="string"&&(s=[s]);const e=[];for(let t=0,i=s.length;t<i;t++){const n=s[t];if(Array.isArray(n)){if(n.length!==2)throw new Error(`[BitmapFont]: Invalid character range length, expecting 2 got ${n.length}.`);const r=n[0].charCodeAt(0),o=n[1].charCodeAt(0);if(o<r)throw new Error("[BitmapFont]: Invalid character range.");for(let a=r,c=o;a<=c;a++)e.push(String.fromCharCode(a))}else e.push(...M1(n))}if(e.length===0)throw new Error("[BitmapFont]: Empty set when resolving characters.");return e}const rr=class Hs{constructor(e,t,i){var h;const[n]=e.info,[r]=e.common,[o]=e.page,[a]=e.distanceField,c=Hn(o.file),l={};this._ownsTextures=i,this.font=n.face,this.size=n.size,this.lineHeight=r.lineHeight/c,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],a!=null&&a.fieldType&&a.fieldType!=="none"&&(l[d].baseTexture.alphaMode=bi.NO_PREMULTIPLIED_ALPHA,l[d].baseTexture.mipmap=vs.OFF)}for(let u=0;u<e.char.length;u++){const{id:d,page:f}=e.char[u];let{x:m,y:p,width:g,height:x,xoffset:v,yoffset:y,xadvance:S}=e.char[u];m/=c,p/=c,g/=c,x/=c,v/=c,y/=c,S/=c;const C=new ct(m+l[f].frame.x/c,p+l[f].frame.y/c,g,x);this.chars[d]={xOffset:v,yOffset:y,xAdvance:S,kerning:{},texture:new Ke(l[f].baseTexture,C),page:f}}for(let u=0;u<e.kerning.length;u++){let{first:d,second:f,amount:m}=e.kerning[u];d/=c,f/=c,m/=c,this.chars[f]&&(this.chars[f].kerning[d]=m)}this.distanceFieldRange=a==null?void 0:a.distanceRange,this.distanceFieldType=((h=a==null?void 0:a.fieldType)==null?void 0:h.toLowerCase())??"none"}destroy(){for(const e in this.chars)this.chars[e].texture.destroy(),this.chars[e].texture=null;for(const e in this.pageTextures)this._ownsTextures&&this.pageTextures[e].destroy(!0),this.pageTextures[e]=null;this.chars=null,this.pageTextures=null}static install(e,t,i){let n;if(e instanceof gh)n=e;else{const o=tR(e);if(!o)throw new Error("Unrecognized data format for font.");n=o.parse(e)}t instanceof Ke&&(t=[t]);const r=new Hs(n,t,i);return Hs.available[r.font]=r,r}static uninstall(e){const t=Hs.available[e];if(!t)throw new Error(`No font found named '${e}'`);t.destroy(),delete Hs.available[e]}static from(e,t,i){if(!e)throw new Error("[BitmapFont] Property `name` is required.");const{chars:n,padding:r,resolution:o,textureWidth:a,textureHeight:c,...l}=Object.assign({},Hs.defaultOptions,i),h=nR(n),u=t instanceof Er?t:new Er(t),d=a,f=new gh;f.info[0]={face:u.fontFamily,size:u.fontSize},f.common[0]={lineHeight:u.fontSize};let m=0,p=0,g,x,v,y=0;const S=[];for(let w=0;w<h.length;w++){g||(g=Be.ADAPTER.createCanvas(),g.width=a,g.height=c,x=g.getContext("2d"),v=new it(g,{resolution:o,...l}),S.push(new Ke(v)),f.page.push({id:S.length-1,file:""}));const b=h[w],_=hr.measureText(b,u,!1,g),A=_.width,P=Math.ceil(_.height),E=Math.ceil((u.fontStyle==="italic"?2:1)*A);if(p>=c-P*o){if(p===0)throw new Error(`[BitmapFont] textureHeight ${c}px is too small (fontFamily: '${u.fontFamily}', fontSize: ${u.fontSize}px, char: '${b}')`);--w,g=null,x=null,v=null,p=0,m=0,y=0;continue}if(y=Math.max(P+_.fontProperties.descent,y),E*o+m>=d){if(m===0)throw new Error(`[BitmapFont] textureWidth ${a}px is too small (fontFamily: '${u.fontFamily}', fontSize: ${u.fontSize}px, char: '${b}')`);--w,p+=y*o,p=Math.ceil(p),m=0,y=0;continue}sR(g,x,_,m,p,o,u);const R=Nc(_.text);f.char.push({id:R,page:S.length-1,x:m/o,y:p/o,width:E,height:P,xoffset:0,yoffset:0,xadvance:A-(u.dropShadow?u.dropShadowDistance:0)-(u.stroke?u.strokeThickness:0)}),m+=(E+2*r)*o,m=Math.ceil(m)}if(!(i!=null&&i.skipKerning))for(let w=0,b=h.length;w<b;w++){const _=h[w];for(let A=0;A<b;A++){const P=h[A],E=x.measureText(_).width,R=x.measureText(P).width,O=x.measureText(_+P).width-(E+R);O&&f.kerning.push({first:Nc(_),second:Nc(P),amount:O})}}const C=new Hs(f,S,!0);return Hs.available[e]!==void 0&&Hs.uninstall(e),Hs.available[e]=C,C}};rr.ALPHA=[["a","z"],["A","Z"]," "],rr.NUMERIC=[["0","9"]],rr.ALPHANUMERIC=[["a","z"],["A","Z"],["0","9"]," "],rr.ASCII=[[" ","~"]],rr.defaultOptions={resolution:1,textureWidth:512,textureHeight:512,padding:4,chars:rr.ALPHANUMERIC},rr.available={};let or=rr;var rR=`// 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
|
||
`,oR=`// 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 Pv=[],kv=[],Fv=[],aR=class T1 extends gi{constructor(e,t={}){super();const{align:i,tint:n,maxWidth:r,letterSpacing:o,fontName:a,fontSize:c}=Object.assign({},T1.styleDefaults,t);if(!or.available[a])throw new Error(`Missing BitmapFont "${a}"`);this._activePagesMeshData=[],this._textWidth=0,this._textHeight=0,this._align=i,this._tintColor=new At(n),this._font=void 0,this._fontName=a,this._fontSize=c,this.text=e,this._maxWidth=r,this._maxLineHeight=0,this._letterSpacing=o,this._anchor=new Fn(()=>{this.dirty=!0},this,0,0),this._roundPixels=Be.ROUND_PIXELS,this.dirty=!0,this._resolution=Be.RESOLUTION,this._autoResolution=!0,this._textureCache={}}updateText(){var E;const e=or.available[this._fontName],t=this.fontSize,i=t/e.size,n=new St,r=[],o=[],a=[],c=this._text.replace(/(?:\r\n|\r)/g,`
|
||
`)||" ",l=M1(c),h=this._maxWidth*e.size/t,u=e.distanceFieldType==="none"?Pv:kv;let d=null,f=0,m=0,p=0,g=-1,x=0,v=0,y=0,S=0;for(let R=0;R<l.length;R++){const O=l[R],U=Nc(O);if(/(?:\s)/.test(O)&&(g=R,x=f,S++),O==="\r"||O===`
|
||
`){o.push(f),a.push(-1),m=Math.max(m,f),++p,++v,n.x=0,n.y+=e.lineHeight,d=null,S=0;continue}const Y=e.chars[U];if(!Y)continue;d&&Y.kerning[d]&&(n.x+=Y.kerning[d]);const $=Fv.pop()||{texture:Ke.EMPTY,line:0,charCode:0,prevSpaces:0,position:new St};$.texture=Y.texture,$.line=p,$.charCode=U,$.position.x=Math.round(n.x+Y.xOffset+this._letterSpacing/2),$.position.y=Math.round(n.y+Y.yOffset),$.prevSpaces=S,r.push($),f=$.position.x+Math.max(Y.xAdvance-Y.xOffset,Y.texture.orig.width),n.x+=Y.xAdvance+this._letterSpacing,y=Math.max(y,Y.yOffset+Y.texture.height),d=U,g!==-1&&h>0&&n.x>h&&(++v,Jo(r,1+g-v,1+R-g),R=g,g=-1,o.push(x),a.push(r.length>0?r[r.length-1].prevSpaces:0),m=Math.max(m,x),p++,n.x=0,n.y+=e.lineHeight,d=null,S=0)}const C=l[l.length-1];C!=="\r"&&C!==`
|
||
`&&(/(?:\s)/.test(C)&&(f=x),o.push(f),m=Math.max(m,f),a.push(-1));const w=[];for(let R=0;R<=p;R++){let O=0;this._align==="right"?O=m-o[R]:this._align==="center"?O=(m-o[R])/2:this._align==="justify"&&(O=a[R]<0?0:(m-o[R])/a[R]),w.push(O)}const b=r.length,_={},A=[],P=this._activePagesMeshData;u.push(...P);for(let R=0;R<b;R++){const O=r[R].texture,U=O.baseTexture.uid;if(!_[U]){let Y=u.pop();if(!Y){const X=new Mp;let D,F;e.distanceFieldType==="none"?(D=new ph(Ke.EMPTY),F=We.NORMAL):(D=new ph(Ke.EMPTY,{program:an.from(oR,rR),uniforms:{uFWidth:0}}),F=We.NORMAL_NPM);const N=new bl(X,D);N.blendMode=F,Y={index:0,indexCount:0,vertexCount:0,uvsCount:0,total:0,mesh:N,vertices:null,uvs:null,indices:null}}Y.index=0,Y.indexCount=0,Y.vertexCount=0,Y.uvsCount=0,Y.total=0;const{_textureCache:$}=this;$[U]=$[U]||new Ke(O.baseTexture),Y.mesh.texture=$[U],Y.mesh.tint=this._tintColor.value,A.push(Y),_[U]=Y}_[U].total++}for(let R=0;R<P.length;R++)A.includes(P[R])||this.removeChild(P[R].mesh);for(let R=0;R<A.length;R++)A[R].mesh.parent!==this&&this.addChild(A[R].mesh);this._activePagesMeshData=A;for(const R in _){const O=_[R],U=O.total;if(!(((E=O.indices)==null?void 0:E.length)>6*U)||O.vertices.length<bl.BATCHABLE_SIZE*2)O.vertices=new Float32Array(8*U),O.uvs=new Float32Array(8*U),O.indices=new Uint16Array(6*U);else{const Y=O.total,$=O.vertices;for(let X=Y*4*2;X<$.length;X++)$[X]=0}O.mesh.size=6*U}for(let R=0;R<b;R++){const O=r[R];let U=O.position.x+w[O.line]*(this._align==="justify"?O.prevSpaces:1);this._roundPixels&&(U=Math.round(U));const Y=U*i,$=O.position.y*i,X=O.texture,D=_[X.baseTexture.uid],F=X.frame,N=X._uvs,k=D.index++;D.indices[k*6+0]=0+k*4,D.indices[k*6+1]=1+k*4,D.indices[k*6+2]=2+k*4,D.indices[k*6+3]=0+k*4,D.indices[k*6+4]=2+k*4,D.indices[k*6+5]=3+k*4,D.vertices[k*8+0]=Y,D.vertices[k*8+1]=$,D.vertices[k*8+2]=Y+F.width*i,D.vertices[k*8+3]=$,D.vertices[k*8+4]=Y+F.width*i,D.vertices[k*8+5]=$+F.height*i,D.vertices[k*8+6]=Y,D.vertices[k*8+7]=$+F.height*i,D.uvs[k*8+0]=N.x0,D.uvs[k*8+1]=N.y0,D.uvs[k*8+2]=N.x1,D.uvs[k*8+3]=N.y1,D.uvs[k*8+4]=N.x2,D.uvs[k*8+5]=N.y2,D.uvs[k*8+6]=N.x3,D.uvs[k*8+7]=N.y3}this._textWidth=m*i,this._textHeight=(n.y+e.lineHeight)*i;for(const R in _){const O=_[R];if(this.anchor.x!==0||this.anchor.y!==0){let X=0;const D=this._textWidth*this.anchor.x,F=this._textHeight*this.anchor.y;for(let N=0;N<O.total;N++)O.vertices[X++]-=D,O.vertices[X++]-=F,O.vertices[X++]-=D,O.vertices[X++]-=F,O.vertices[X++]-=D,O.vertices[X++]-=F,O.vertices[X++]-=D,O.vertices[X++]-=F}this._maxLineHeight=y*i;const U=O.mesh.geometry.getBuffer("aVertexPosition"),Y=O.mesh.geometry.getBuffer("aTextureCoord"),$=O.mesh.geometry.getIndex();U.data=O.vertices,Y.data=O.uvs,$.data=O.indices,U.update(),Y.update(),$.update()}for(let R=0;R<r.length;R++)Fv.push(r[R]);this._font=e,this.dirty=!1}updateTransform(){this.validate(),this.containerUpdateTransform()}_render(e){this._autoResolution&&this._resolution!==e.resolution&&(this._resolution=e.resolution,this.dirty=!0);const{distanceFieldRange:t,distanceFieldType:i,size:n}=or.available[this._fontName];if(i!=="none"){const{a:r,b:o,c:a,d:c}=this.worldTransform,l=Math.sqrt(r*r+o*o),h=Math.sqrt(a*a+c*c),u=(Math.abs(l)+Math.abs(h))/2,d=this.fontSize/n,f=e._view.resolution;for(const m of this._activePagesMeshData)m.mesh.shader.uniforms.uFWidth=u*t*d*f}super._render(e)}getLocalBounds(){return this.validate(),super.getLocalBounds()}validate(){const e=or.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(!or.available[e])throw new Error(`Missing BitmapFont "${e}"`);this._fontName!==e&&(this._fontName=e,this.dirty=!0)}get fontSize(){return this._fontSize??or.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=or.available[this._fontName].distanceFieldType==="none"?Pv:kv;i.push(...this._activePagesMeshData);for(const n of this._activePagesMeshData)this.removeChild(n.mesh);this._activePagesMeshData=[],i.filter(n=>t[n.mesh.texture.baseTexture.uid]).forEach(n=>{n.mesh.texture=Ke.EMPTY});for(const n in t)t[n].destroy(),delete t[n];this._font=null,this._tintColor=null,this._textureCache=null,super.destroy(e)}};aR.styleDefaults={align:"left",tint:16777215,maxWidth:0,letterSpacing:0};const lR=[".xml",".fnt"],cR={extension:{type:ke.LoadParser,priority:os.Normal},name:"loadBitmapFont",test(s){return lR.includes(si.extname(s).toLowerCase())},async testParse(s){return Bc.test(s)||gm.test(s)},async parse(s,e,t){const i=Bc.test(s)?Bc.parse(s):gm.parse(s),{src:n}=e,{page:r}=i,o=[];for(let l=0;l<r.length;++l){const h=r[l].file;let u=si.join(si.dirname(n),h);u=hh(u,n),o.push(u)}const a=await t.load(o),c=o.map(l=>a[l]);return or.install(i,c,!0)},async load(s,e){return(await Be.ADAPTER.fetch(s)).text()},unload(s){s.destroy()}};$e.add(cR);const vm=class $o extends Er{constructor(){super(...arguments),this._fonts=[],this._overrides=[],this._stylesheet="",this.fontsDirty=!1}static from(e){return new $o(Object.keys($o.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 $o.availableFonts[e.originalUrl])}),this.fontFamily="Arial",this._fonts.length=0,this.styleID++,this.fontsDirty=!0)}loadFont(e,t={}){const{availableFonts:i}=$o;if(i[e]){const n=i[e];return this._fonts.push(n),n.refs++,this.styleID++,this.fontsDirty=!0,Promise.resolve()}return Be.ADAPTER.fetch(e).then(n=>n.blob()).then(async n=>new Promise((r,o)=>{const a=URL.createObjectURL(n),c=new FileReader;c.onload=()=>r([a,c.result]),c.onerror=o,c.readAsDataURL(n)})).then(async([n,r])=>{const o=Object.assign({family:si.basename(e,si.extname(e)),weight:"normal",style:"normal",display:"auto",src:n,dataSrc:r,refs:1,originalUrl:e,fontFace:null},t);i[e]=o,this._fonts.push(o),this.styleID++;const a=new FontFace(o.family,`url(${o.src})`,{weight:o.weight,style:o.style,display:o.display});o.fontFace=a,await a.load(),document.fonts.add(a),await document.fonts.ready,this.styleID++,this.fontsDirty=!0})}addOverride(...e){const t=e.filter(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=Q_(e)),typeof e=="number"?J_(e):e}dropShadowToCSS(){let e=this.normalizeColor(this.dropShadowColor);const t=this.dropShadowAlpha,i=Math.round(Math.cos(this.dropShadowAngle)*this.dropShadowDistance),n=Math.round(Math.sin(this.dropShadowAngle)*this.dropShadowDistance);e.startsWith("#")&&t<1&&(e+=(t*255|0).toString(16).padStart(2,"0"));const r=`${i}px ${n}px`;return this.dropShadowBlur>0?`text-shadow: ${r} ${this.dropShadowBlur}px ${e}`:`text-shadow: ${r} ${e}`}reset(){Object.assign(this,$o.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}=Be.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}};vm.availableFonts={},vm.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 rf=vm;const dc=class Xo extends Pr{constructor(e="",t={}){super(Ke.EMPTY),this._text=null,this._style=null,this._autoResolution=!0,this.localStyleID=-1,this.dirty=!1,this._updateID=0,this.ownsStyle=!1;const i=new Image,n=Ke.from(i,{scaleMode:Be.SCALE_MODE,resourceOptions:{autoLoad:!1}});n.orig=new ct,n.trim=new ct,this.texture=n;const r="http://www.w3.org/2000/svg",o="http://www.w3.org/1999/xhtml",a=document.createElementNS(r,"svg"),c=document.createElementNS(r,"foreignObject"),l=document.createElementNS(o,"div"),h=document.createElementNS(o,"style");c.setAttribute("width","10000"),c.setAttribute("height","10000"),c.style.overflow="hidden",a.appendChild(c),this.maxWidth=Xo.defaultMaxWidth,this.maxHeight=Xo.defaultMaxHeight,this._domElement=l,this._styleElement=h,this._svgRoot=a,this._foreignObject=c,this._foreignObject.appendChild(h),this._foreignObject.appendChild(l),this._image=i,this._loadImage=new Image,this._autoResolution=Xo.defaultAutoResolution,this._resolution=Xo.defaultResolution??Be.RESOLUTION,this.text=e,this.style=t}measureText(e){var h,u;const{text:t,style:i,resolution:n}=Object.assign({text:this._text,style:this._style,resolution:this._resolution},e);Object.assign(this._domElement,{innerHTML:t,style:i.toCSS(n)}),this._styleElement.textContent=i.toGlobalCSS(),document.body.appendChild(this._svgRoot);const r=this._domElement.getBoundingClientRect();this._svgRoot.remove();const{width:o,height:a}=r;(o>this.maxWidth||a>this.maxHeight)&&console.warn("[HTMLText] Large expanse of text, increase HTMLText.maxWidth or HTMLText.maxHeight property.");const c=Math.min(this.maxWidth,Math.ceil(o)),l=Math.min(this.maxHeight,Math.ceil(a));return this._svgRoot.setAttribute("width",c.toString()),this._svgRoot.setAttribute("height",l.toString()),t!==this._text&&(this._domElement.innerHTML=this._text),i!==this._style&&(Object.assign(this._domElement,{style:(h=this._style)==null?void 0:h.toCSS(n)}),this._styleElement.textContent=(u=this._style)==null?void 0:u.toGlobalCSS()),{width:c+i.padding*2,height:l+i.padding*2}}async updateText(e=!0){const{style:t,_image:i,_loadImage:n}=this;if(this.localStyleID!==t.styleID&&(this.dirty=!0,this.localStyleID=t.styleID),!this.dirty&&e)return;const{width:r,height:o}=this.measureText();i.width=n.width=Math.ceil(Math.max(1,r)),i.height=n.height=Math.ceil(Math.max(1,o)),this._updateID++;const a=this._updateID;await new Promise(c=>{n.onload=async()=>{if(a<this._updateID){c();return}await t.onBeforeDraw(),i.src=n.src,n.onload=null,n.src="",this.updateTexture(),c()};const l=new XMLSerializer().serializeToString(this._svgRoot);n.src=`data:image/svg+xml;charset=utf8,${encodeURIComponent(l)}`})}get source(){return this._image}updateTexture(){const{style:e,texture:t,_image:i,resolution:n}=this,{padding:r}=e,{baseTexture:o}=t;t.trim.width=t._frame.width=i.width/n,t.trim.height=t._frame.height=i.height/n,t.trim.x=-r,t.trim.y=-r,t.orig.width=t._frame.width-r*2,t.orig.height=t._frame.height-r*2,this._onTextureUpdate(),o.setRealSize(i.width,i.height,n),this.dirty=!1}_render(e){this._autoResolution&&this._resolution!==e.resolution&&(this._resolution=e.resolution,this.dirty=!0),this.updateText(!0),super._render(e)}_renderCanvas(e){this._autoResolution&&this._resolution!==e.resolution&&(this._resolution=e.resolution,this.dirty=!0),this.updateText(!0),super._renderCanvas(e)}getLocalBounds(e){return this.updateText(!0),super.getLocalBounds(e)}_calculateBounds(){this.updateText(!0),this.calculateVertices(),this._bounds.addQuad(this.vertexData)}_onStyleChange(){this.dirty=!0}destroy(e){var i,n,r,o,a;typeof e=="boolean"&&(e={children:e}),e=Object.assign({},Xo.defaultDestroyOptions,e),super.destroy(e);const t=null;this.ownsStyle&&((i=this._style)==null||i.cleanFonts()),this._style=t,(n=this._svgRoot)==null||n.remove(),this._svgRoot=t,(r=this._domElement)==null||r.remove(),this._domElement=t,(o=this._foreignObject)==null||o.remove(),this._foreignObject=t,(a=this._styleElement)==null||a.remove(),this._styleElement=t,this._loadImage.src="",this._loadImage.onload=null,this._loadImage=t,this._image.src="",this._image=t}get width(){return this.updateText(!0),Math.abs(this.scale.x)*this._image.width/this.resolution}set width(e){this.updateText(!0);const t=yr(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=yr(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 rf?(this.ownsStyle=!1,this._style=e):e instanceof Er?(console.warn("[HTMLText] Cloning TextStyle, if this is not what you want, use HTMLTextStyle"),this.ownsStyle=!0,this._style=rf.from(e)):(this.ownsStyle=!0,this._style=new rf(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," ")}};dc.defaultDestroyOptions={texture:!0,children:!1,baseTexture:!0},dc.defaultMaxWidth=2024,dc.defaultMaxHeight=2024,dc.defaultAutoResolution=!0;function vh(s,e){const t=Math.max(0,Number(s)||0),i=Math.max(0,Number(e)||0);return{inner:Math.min(t,i),outer:Math.max(t,i)}}function _1(s){const e=Math.max(0,Number(s.outerRectW)||0),t=Math.max(0,Number(s.outerRectH)||0);return{innerW:Math.min(e,Math.max(0,Number(s.innerRectW)||0)),innerH:Math.min(t,Math.max(0,Number(s.innerRectH)||0)),outerW:e,outerH:t}}function hR(s,e,t,i,n){if(s==="random")return n();const r=Math.max(1,Math.round(t)),o=Math.max(0,Math.round(e))%r;return i?o/r:r<=1?.5:o/(r-1)}function Ov(s,e,t,i){const n=Math.sqrt(s*s+i()*(e*e-s*s));return{x:Math.cos(t)*n,y:-Math.sin(t)*n,radialAngle:-t*180/Math.PI}}function uR(s,e){const{innerW:t,innerH:i,outerW:n,outerH:r}=_1(s),o=Math.max(0,(n-t)/2),a=Math.max(0,(r-i)/2),c=o*r,l=t*a,h=c*2+l*2;if(h<=0){const m=n*2+r*2;if(m<=0)return{x:0,y:0,radialAngle:0};let p=e()*m,g,x;return p<n?(g=-n/2+p,x=-r/2):(p-=n)<r?(g=n/2,x=-r/2+p):(p-=r)<n?(g=n/2-p,x=r/2):(p-=n,g=-n/2,x=r/2-p),{x:g,y:x,radialAngle:Math.atan2(x,g)*180/Math.PI}}let u=e()*h,d=0,f=0;return u<c?(d=-n/2+e()*o,f=(e()-.5)*r):(u-=c)<c?(d=t/2+e()*o,f=(e()-.5)*r):(u-=c)<l?(d=(e()-.5)*t,f=-r/2+e()*a):(d=(e()-.5)*t,f=i/2+e()*a),{x:d,y:f,radialAngle:Math.atan2(f,d)*180/Math.PI}}function dR(s,e){if(s.shape==="circle"){const{inner:t,outer:i}=vh(s.innerRadius,s.outerRadius);return Ov(t,i,e()*Math.PI*2,e)}if(s.shape==="rect")return uR(s,e);if(s.shape==="cone"){const{inner:t,outer:i}=vh(s.innerRadius,s.outerRadius),n=Math.max(0,Math.min(360,Number(s.coneAngle)||0))/2,r=(Number(s.coneDirection)||0)+(e()-.5)*n*2;return Ov(t,i,r*Math.PI/180,e)}return{x:0,y:0,radialAngle:0}}function fR(s,e,t,i){if(s.shape==="path"||s.shape==="orbit"){if(s.emissionAngleMode==="path-tangent"&&Number.isFinite(e.pathAngle))return(e.pathAngle+t)*Math.PI/180;if(s.emissionAngleMode==="path-normal"&&Number.isFinite(e.pathAngle))return(e.pathAngle-90+t)*Math.PI/180}if(s.emissionAngleMode==="radial"&&s.shape!=="point"&&s.shape!=="orbit")return(e.radialAngle+t)*Math.PI/180;const n=s.emissionAngleMode==="random"?(i()-.5)*Math.max(0,Number(s.spread)||0):0,r=((Number(s.direction)||0)+t+n)*Math.PI/180;return s.shape==="cone"?-r:r}const br={normal:0,add:1,multiply:2,screen:3},Lv=400;function Mi(s,e,t){return s+(e-s)*t}function fc(s,e){return Number.isFinite(s)?s:e}function tr(s,e,t,i=null){const n=Math.max(1e-4,Math.abs((i==null?void 0:i.scaleX)??s.rootScaleX)),r=Math.max(1e-4,Math.abs((i==null?void 0:i.scaleY)??s.rootScaleY)),o=-((i==null?void 0:i.rotation)??s.rootRotation)*Math.PI/180,a=Math.cos(o),c=Math.sin(o),l=(i==null?void 0:i.centerX)??s.centerX,h=(i==null?void 0:i.centerY)??s.centerY,u=l+a*n*e-c*r*t,d=-h+c*n*e+a*r*t;return{x:u,y:-d}}function mc(s,e,t,i=null){const n=Math.max(1e-4,Math.abs((i==null?void 0:i.scaleX)??s.rootScaleX)),r=Math.max(1e-4,Math.abs((i==null?void 0:i.scaleY)??s.rootScaleY)),o=-((i==null?void 0:i.rotation)??s.rootRotation)*Math.PI/180,a=Math.cos(o),c=Math.sin(o),l=e-((i==null?void 0:i.centerX)??s.centerX),h=-t+((i==null?void 0:i.centerY)??s.centerY);return{x:(a*l+c*h)/n,y:(-c*l+a*h)/r}}function mR(s,e,t,i=null){const n=Math.max(1e-4,Math.abs((i==null?void 0:i.scaleX)??s.rootScaleX)),r=Math.max(1e-4,Math.abs((i==null?void 0:i.scaleY)??s.rootScaleY)),o=-((i==null?void 0:i.rotation)??s.rootRotation)*Math.PI/180,a=Math.cos(o),c=Math.sin(o),l=a*n*e-c*r*t,h=c*n*e+a*r*t;return{x:l,y:-h}}function Bv(s,e,t,i=null){const n=Math.max(1e-4,Math.abs((i==null?void 0:i.scaleX)??s.rootScaleX)),r=Math.max(1e-4,Math.abs((i==null?void 0:i.scaleY)??s.rootScaleY)),o=-((i==null?void 0:i.rotation)??s.rootRotation)*Math.PI/180,a=Math.cos(o),c=Math.sin(o),l=-t;return{x:(a*e+c*l)/n,y:(-c*e+a*l)/r}}function C1(s,e,t){return t<=0||e<0||e>t?0:s==="linear"?1-e/t:s==="inverse"?Math.min(10,t/Math.max(e,t*.1)):1}function pR(s,e,t,i,n,r,o){const a=s-t,c=e-i,l=Math.hypot(a,c);if(l<=1e-4||l>r)return{x:0,y:0};const h=n*C1(o,l,r)*10;return{x:-c/l*h,y:a/l*h}}function gR(s,e,t){const i=s.rotation*Math.PI/180,n=Math.cos(i),r=Math.sin(i),o=Math.max(1e-4,Math.abs(s.scaleX??1)),a=Math.max(1e-4,Math.abs(s.scaleY??1)),c=e-s.x,l=t-s.y,h=(n*c+r*l)/o,u=(-r*c+n*l)/a,d=(w,b,_,A)=>{const P=_/o,E=A/a,R=Math.max(1e-4,Math.hypot(P,E)),O=P/R,U=E/R,Y=n*O-r*U,$=r*O+n*U;return{x:s.x+n*w*o-r*b*a+Y*.05,y:s.y+r*w*o+n*b*a+$*.05,nx:Y,ny:$}};if(s.shape==="circle"){const w=Math.max(.001,s.radius),b=Math.hypot(h,u);if(b>=w)return null;const _=b>1e-4?h/b:1,A=b>1e-4?u/b:0;return d(_*w,A*w,_,A)}if(s.shape==="ellipse"){const w=Math.max(.001,s.radiusX),b=Math.max(.001,s.radiusY),_=Math.hypot(h/w,u/b);if(_>=1)return null;const A=_>1e-4?1/_:1,P=_>1e-4?h*A:w,E=_>1e-4?u*A:0,R=Math.max(1e-4,Math.hypot(P/(w*w),E/(b*b)));return d(P,E,P/(w*w)/R,E/(b*b)/R)}if(s.shape==="rect"){const w=Math.max(.001,s.width*.5),b=Math.max(.001,s.height*.5);if(Math.abs(h)>=w||Math.abs(u)>=b)return null;const _=w-Math.abs(h),A=b-Math.abs(u);if(_<A){const E=h>=0?1:-1;return d(E*w,u,E,0)}const P=u>=0?1:-1;return d(h,P*b,0,P)}const f=Math.max(3,Math.min(16,Math.round(s.sides||(s.shape==="custom"?5:6)))),m=Math.max(.001,s.width*.5),p=Math.max(.001,s.height*.5),g=Array.from({length:f},(w,b)=>{const _=Math.PI*.5+b/f*Math.PI*2;return{x:Math.cos(_)*m,y:Math.sin(_)*p}});let x=!1;for(let w=0,b=g.length-1;w<g.length;b=w++){const _=g[w],A=g[b];_.y>u!=A.y>u&&h<(A.x-_.x)*(u-_.y)/(A.y-_.y)+_.x&&(x=!x)}if(!x)return null;let v=g[0].x,y=g[0].y,S=1/0;for(let w=0;w<g.length;w++){const b=g[w],_=g[(w+1)%g.length],A=_.x-b.x,P=_.y-b.y,E=Math.max(1e-4,A*A+P*P),R=Math.min(1,Math.max(0,((h-b.x)*A+(u-b.y)*P)/E)),O=b.x+A*R,U=b.y+P*R,Y=Math.hypot(O-h,U-u);Y<S&&(S=Y,v=O,y=U)}const C=Math.max(1e-4,Math.hypot(v-h,y-u));return d(v,y,(v-h)/C,(y-u)/C)}function vR(s){return Math.min(1,Math.max(0,1-s.life/Math.max(1e-4,s.maxLife)))}function ar(s,e,t){let i=(s>>>0^Math.imul(e+1,2654435761)^t)>>>0;return i^=i>>>16,i=Math.imul(i,2146121005),i^=i>>>15,i=Math.imul(i,2221713035),i^=i>>>16,(i>>>0)/4294967296}function Io(s,e,t,i,n){return s==="fixed"?e:s==="curve"?Mi(e,t,nn(i,n)):Mi(e,t,n)}function of(s,e,t,i,n,r){return s==="curve"?Mi(e,t,nn(i,n)):s==="random"?r:e}function Nv(s,e,t,i,n){const r=1-n;return r*r*r*s+3*r*r*n*e+3*r*n*n*t+n*n*n*i}function nn(s,e,t="线性"){if(!Array.isArray(s)||s.length===0)return 1;const i=[...s].sort((n,r)=>n.x-r.x);if(e<=i[0].x)return i[0].y;if(e>=i[i.length-1].x)return i[i.length-1].y;for(let n=0;n<i.length-1;n++)if(e>=i[n].x&&e<=i[n+1].x){const r=i[n],o=i[n+1],a=o.x-r.x||1;if(t!=="贝塞尔")return Mi(r.y,o.y,(e-r.x)/a);const c=r.x+(r.outX??a/3),l=r.y+(r.outY??(o.y-r.y)/3),h=o.x+(o.inX??-a/3),u=o.y+(o.inY??-(o.y-r.y)/3);let d=0,f=1;for(let m=0;m<14;m++){const p=(d+f)/2;Nv(r.x,c,h,o.x,p)<e?d=p:f=p}return Nv(r.y,l,u,o.y,(d+f)/2)}return i[i.length-1].y}function af(s){let e=s>>>0;return function(){e|=0,e=e+1831565813|0;let t=Math.imul(e^e>>>15,1|e);return t=t+Math.imul(t^t>>>7,61|t)^t,((t^t>>>14)>>>0)/4294967296}}function sa(s){let e=s.replace("#","");return e.length===3&&(e=e.split("").map(t=>t+t).join("")),parseInt(e,16)}function yR(s,e,t){const i=Dv(s),n=Dv(e),r=Math.round(i[0]+(n[0]-i[0])*t),o=Math.round(i[1]+(n[1]-i[1])*t),a=Math.round(i[2]+(n[2]-i[2])*t);return r<<16|o<<8|a}function ym(s,e){if(!Array.isArray(s)||s.length===0)return 16777215;const t=[...s].sort((i,n)=>i.position-n.position);if(e<=t[0].position)return sa(t[0].color);if(e>=t[t.length-1].position)return sa(t[t.length-1].color);for(let i=0;i<t.length-1;i++){const n=t[i],r=t[i+1];if(e<n.position||e>r.position)continue;const o=(e-n.position)/Math.max(1e-4,r.position-n.position);return yR(n.color,r.color,o)}return sa(t[t.length-1].color)}function Dv(s){let e=s.replace("#","");e.length===3&&(e=e.split("").map(i=>i+i).join(""));const t=parseInt(e,16);return[t>>16&255,t>>8&255,t&255]}function Uv(s,e){const t=Math.min(255,(s>>16&255)+(e>>16&255)),i=Math.min(255,(s>>8&255)+(e>>8&255)),n=Math.min(255,(s&255)+(e&255));return t<<16|i<<8|n}function xR(){return{sprite:null,boneName:"",mesh:null,meshSignature:"",history:[],bones:[],skinWeights:[],currentWidth:0,currentAlpha:0,currentColor:16777215,resourceId:1,enabled:!1,sampledLength:100,sampledWidth:100}}function Dc(s){s.history.length=0,s.bones.length=0,s.mesh&&(s.mesh.visible=!1)}class bR{constructor(e){M(this,"container");this.container=e}ensureMesh(e,t,i){const n=t.trailResources.find(g=>g.id===e.resourceId)||t.trailResources[0],r=(n==null?void 0:n.texture)||Ke.EMPTY,o=Number(n==null?void 0:n.rotation)||0,a=Math.max(2,Math.min(16,Math.round(t.trailGridRows))),c=Math.max(2,Math.min(32,Math.round(t.trailGridCols))),l=Math.max(2,Math.min(16,Math.round((n==null?void 0:n.boneCount)??3))),h=`${a}:${c}:${l}:${(n==null?void 0:n.id)??0}:${o}`;if(e.mesh&&e.meshSignature===h)return e.mesh.texture!==r&&(e.mesh.texture=r),e.mesh;e.mesh&&(this.container.removeChild(e.mesh),e.mesh.destroy()),e.meshSignature&&e.meshSignature!==h&&(e.history.length=0,e.bones.length=0);const u=new Float32Array(a*c*2),d=new Float32Array(a*c*2),f=[],m=[];for(let g=0;g<c;g++){const x=g/(c-1),v=x*(l-1),y=Math.min(l-1,Math.floor(v)),S=Math.min(l-1,y+1),C=v-y;for(let w=0;w<a;w++){const b=g*a+w,_=x,A=w/(a-1),P=o*Math.PI/180,E=Math.cos(P),R=Math.sin(P);d[b*2]=.5+E*(_-.5)-R*(A-.5),d[b*2+1]=.5+R*(_-.5)+E*(A-.5),m.push({boneA:y,boneB:S,weight:C})}}for(let g=0;g<c-1;g++)for(let x=0;x<a-1;x++){const v=g*a+x,y=(g+1)*a+x,S=v+1,C=y+1;f.push(v,y,S,y,C,S)}const p=new FI(r,u,d,new Uint16Array(f));return p.visible=!1,p.blendMode=br.normal,this.container.addChildAt(p,Math.max(0,this.container.getChildIndex(i))),e.mesh=p,e.meshSignature=h,e.skinWeights=m,p}appendPoint(e,t,i,n){const r=e.history[0];!r||Math.hypot(r.x-t,r.y-i)>.05?e.history.unshift({x:t,y:i}):(r.x=t,r.y=i);const o=Math.max(1,n)*1.5;let a=0,c=e.history.length;for(let l=1;l<e.history.length;l++)if(a+=Math.hypot(e.history[l].x-e.history[l-1].x,e.history[l].y-e.history[l-1].y),a>=o||l>=239){c=l+1;break}e.history.length>c&&(e.history.length=c)}sampleBones(e,t,i){const n=Math.max(2,Math.min(16,Math.round(i))),r=e.history,o=[];if(!r.length)return o;let a=0;for(let l=1;l<r.length;l++)a+=Math.hypot(r[l].x-r[l-1].x,r[l].y-r[l-1].y);const c=Math.min(Math.max(0,t),a);for(let l=0;l<n;l++){const h=c*l/(n-1);let u=0,d=r[r.length-1];for(let f=1;f<r.length;f++){const m=r[f-1],p=r[f],g=Math.hypot(p.x-m.x,p.y-m.y);if(u+g>=h&&g>1e-4){const x=(h-u)/g;d={x:Mi(m.x,p.x,x),y:Mi(m.y,p.y,x)};break}u+=g}o.push({boneName:`${e.boneName}_trail_${l}`,x:d.x,y:d.y,rotation:0})}for(let l=0;l<o.length;l++){const h=o[Math.min(o.length-1,l+1)],u=o[Math.max(0,l-1)],d=l<o.length-1?h.x-o[l].x:o[l].x-u.x,f=l<o.length-1?h.y-o[l].y:o[l].y-u.y;o[l].rotation=Math.atan2(f,d)*180/Math.PI}if(c+1e-4<Math.max(0,t)&&o.length>1){const l=o[0].rotation,u=(o[o.length-1].rotation-l+540)%360-180;for(let d=0;d<o.length;d++)o[d].rotation=l+u*d/(o.length-1)}return o}skinMesh(e,t,i){if(!e.sprite)return;const n=this.ensureMesh(e,t,e.sprite),r=t.trailResources.find(h=>h.id===i.resourceId)||t.trailResources[0];if(!(r!=null&&r.texture)||i.bones.length<2){n.visible=!1;return}e.resourceId=r.id,n.texture!==r.texture&&(n.texture=r.texture);const o=Math.max(2,Math.min(16,Math.round(t.trailGridRows))),a=Math.max(2,Math.min(32,Math.round(t.trailGridCols))),c=n.vertices,l=[];for(let h=0;h<a;h++){const u=e.skinWeights[h*o],d=i.bones[Math.min(i.bones.length-1,u.boneA)],f=i.bones[Math.min(i.bones.length-1,u.boneB)];l.push({x:Mi(d.x,f.x,u.weight),y:Mi(d.y,f.y,u.weight)})}for(let h=0;h<a;h++){const u=l[Math.max(0,h-1)],d=l[Math.min(a-1,h+1)],f=d.x-u.x,m=d.y-u.y,p=Math.max(1e-4,Math.hypot(f,m)),g=-m/p,x=f/p,v=h/(a-1),y=r.shapeEnabled?Math.max(0,nn(r.shapeCurve,v)):1;for(let S=0;S<o;S++){const w=(S/(o-1)-.5)*i.width*y,b=(h*o+S)*2;c[b]=l[h].x+g*w,c[b+1]=l[h].y+x*w}}n.tint=i.colorHex,n.alpha=i.alpha,n.blendMode=br[r.blend],n.visible=Math.hypot(l[0].x-l[a-1].x,l[0].y-l[a-1].y)>.5&&i.alpha>0}update(e,t,i,n,r,o,a){if(e.sprite=a,e.boneName=i,!t.trail||!e.enabled||e.sampledLength<=0||e.sampledWidth<=0){Dc(e);return}this.ensureMesh(e,t,a);const c=t.trailResources.find(f=>f.id===e.resourceId)||t.trailResources[0];this.appendPoint(e,n,r,e.sampledLength);const l=c!=null&&c.lifeLengthEnabled?Math.max(0,nn(c.lifeLengthCurve,o)):1,h=Math.max(0,e.sampledLength)*l;e.bones=this.sampleBones(e,h,(c==null?void 0:c.boneCount)??3),e.bones[0]&&(e.bones[0].x=n,e.bones[0].y=r);const u=(c==null?void 0:c.widthMode)==="particle"?(Math.abs(a.scale.x)+Math.abs(a.scale.y))*.5:1;e.currentWidth=Math.max(0,e.sampledWidth)*u,e.currentAlpha=(c==null?void 0:c.alphaMode)==="particle"?a.alpha:(c==null?void 0:c.alphaMode)==="curve"?nn(c.alphaCurve,o):(c==null?void 0:c.alpha)??1,e.currentColor=(c==null?void 0:c.colorMode)==="particle"?a.tint:(c==null?void 0:c.colorMode)==="curve"?ym(c.colorGradient,o):sa((c==null?void 0:c.color)||"#ffffff");const d={bones:e.bones.map(f=>({...f})),activeBoneCount:e.bones.length,width:e.currentWidth,alpha:Math.min(1,Math.max(0,e.currentAlpha)),colorHex:e.currentColor,resourceId:e.resourceId};return this.skinMesh(e,t,d),d}applyState(e,t,i,n){var r;e.sprite=i,e.resourceId=n.resourceId??((r=t.trailResources[0])==null?void 0:r.id)??1,e.bones=n.bones.map(o=>({...o})),e.currentWidth=n.width,e.currentAlpha=n.alpha,this.skinMesh(e,t,n)}drawDebug(e,t,i,n){if(e.clear(),!t||!i.trail)return;const r=Math.max(2,Math.min(16,Math.round(i.trailGridRows))),o=Math.max(2,Math.min(32,Math.round(i.trailGridCols)));e.lineStyle(1,3790847,.72);for(const a of n){const c=a.mesh;if(!(c!=null&&c.visible))continue;const l=c.vertices,h=(u,d)=>{const f=(u*r+d)*2;return{x:l[f],y:l[f+1]}};for(let u=0;u<r;u++)for(let d=0;d<o;d++){const f=h(d,u);d===0?e.moveTo(f.x,f.y):e.lineTo(f.x,f.y)}for(let u=0;u<o;u++)for(let d=0;d<r;d++){const f=h(u,d);d===0?e.moveTo(f.x,f.y):e.lineTo(f.x,f.y)}e.beginFill(9235711,.9);for(let u=0;u<o;u++)for(let d=0;d<r;d++){const f=h(u,d);e.drawCircle(f.x,f.y,1.6)}e.endFill()}}}function wR(s){return{id:1,texture:s,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}]}}function SR(){return{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}]}}function MR(s,e){const t=s.imageResources.filter(r=>r.texture||r.sequenceFrames.some(o=>o.texture));if(!t.length)return wR(s.texture);const i=t.reduce((r,o)=>r+Math.max(0,o.weight),0);if(i<=0)return t[Math.floor(e()*t.length)];let n=e()*i;for(const r of t)if(n-=Math.max(0,r.weight),n<=0)return r;return t[t.length-1]}function TR(s,e){const t=s.trailResources.filter(r=>r.texture);if(!t.length)return s.trailResources[0]||SR();const i=t.reduce((r,o)=>r+Math.max(0,o.weight),0);if(i<=0)return t[Math.min(t.length-1,Math.floor(e*t.length))];let n=e*i;for(const r of t)if(n-=Math.max(0,r.weight),n<=0)return r;return t[t.length-1]}function $v(s,e){if(s.imageMode!=="sequence"||s.sequenceFrames.length<=1)return{index:0,visible:!0};const t=Math.min(120,Math.max(1,Number(s.sequenceFps)||30)),i=Math.max(0,Math.floor(Math.max(0,e)*t)),n=s.sequenceFrames.length-1;return s.sequencePlayback==="once-hide"?{index:Math.min(n,i),visible:i<=n}:s.sequencePlayback==="once-hold"?{index:Math.min(n,i),visible:!0}:s.sequencePlayback==="loop-reverse"?{index:n-i%s.sequenceFrames.length,visible:!0}:{index:i%s.sequenceFrames.length,visible:!0}}function lf(s,e,t){var i;return s.imageMode==="sequence"&&s.sequenceFrames.length?((i=s.sequenceFrames[Math.max(0,Math.min(s.sequenceFrames.length-1,t))])==null?void 0:i.texture)||s.texture||e:s.texture||e}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",showShape:!0,shapeRangeVersion:1,innerRadius:0,outerRadius:30,innerRectW:0,innerRectH:0,outerRectW:60,outerRectH:40,spawnPathId:0,spawnPathDistribution:"fixed",radius:30,rectW:60,rectH:40,centerX:0,centerY:0,rootRotation:0,rootScaleX:1,rootScaleY:1,renderLayerMode:"top",renderLayerSpineId:0,renderLayerSlotName:"",renderLayerSlotPosition:"above",renderLayerFollowAttachment:!1,emissionAngleMode:"random",direction:0,spread:360,coneDirection:90,coneAngle:60,lifeMin:.6,lifeMax:1.8,lifeMode:"random",lifeCurve:[{x:0,y:0},{x:1,y:1}],speedMin:30,speedMax:140,speedMode:"random",speedCurve:[{x:0,y:0},{x:1,y:1}],scaleMin:.3,scaleMax:.8,scaleMode:"random",scaleAxisMode:"uniform",scaleYMin:.3,scaleYMax:.8,scaleCurve:[{x:0,y:0},{x:1,y:1}],scaleYCurve:[{x:0,y:0},{x:1,y:1}],scaleEndRatio:.3,initialRotationMode:"random",initialRotationMin:0,initialRotationMax:360,initialRotationCurve:[{x:0,y:0},{x:1,y:1}],alpha:.9,alphaEnd:0,rotationSpeedMin:-180,rotationSpeedMax:180,speedOverLifeEnabled:!1,speedOverLifeMode:"fixed",speedOverLifeMin:1,speedOverLifeMax:1,speedOverLifeCurve:[{x:0,y:1},{x:1,y:1}],scaleOverLifeEnabled:!1,scaleOverLifeMode:"curve",scaleOverLifeAxisMode:"uniform",scaleOverLifeMin:0,scaleOverLifeMax:1,scaleYOverLifeMin:0,scaleYOverLifeMax:1,scaleOverLifeCurve:[{x:0,y:1},{x:1,y:1}],scaleYOverLifeCurve:[{x:0,y:1},{x:1,y:1}],rotationOverLifeEnabled:!1,rotationOverLifeMode:"random",rotationOverLifeCurve:[{x:0,y:0},{x:1,y:1}],gravity:980,gravityMode:"fixed",gravityMin:980,gravityMax:980,gravityDirection:-90,gravityCurve:[{x:0,y:1},{x:1,y:1}],damping:0,seed:0,colorStart:"#ffffff",colorEnd:"#ff4d4d",colorOverLife:!1,blend:"add",alphaMode:"curve",curveMode:"线性",alphaCurve:[{x:0,y:0},{x:.2,y:1},{x:.8,y:1},{x:1,y:0}],textureName:"star",textureFolder:"",alphaScale:1,anchorX:.5,anchorY:.5,independentAlpha:"off",offsetX:0,offsetY:0,noise:!1,noiseAmt:30,noiseRange:100,noiseSpeed:1,useGravity:!1,wind:!1,windX:0,windY:0,windMode:"fixed",windMin:100,windMax:100,windDirection:0,windCurve:[{x:0,y:1},{x:1,y:1}],forceField:!1,forceStrength:10,forceRadius:100,forceCenterX:0,forceCenterY:0,forceFalloff:"linear",showForceFieldShape:!0,vortex:!1,vortexStrength:10,vortexRadius:100,vortexCenterX:0,vortexCenterY:0,vortexFalloff:"linear",showVortexShape:!0,attraction:!1,attractionCenterX:200,attractionCenterY:0,attractionRadius:20,attractionDuration:.5,attractionDelay:.1,attractionDelayMode:"particle",attractionPath:"curve",showAttractionShape:!0,trail:!1,trailConfigVersion:3,trailResources:[{id:1,texture:null,textureName:"trail",previewUrl:"/images/trail.png",weight:100,locked:!1,rotation:0,colorMode:"particle",color:"#ffffff",colorGradient:[{position:0,color:"#ffffff"},{position:1,color:"#ffffff"}],blend:"normal",alphaMode:"particle",alpha:1,alphaCurve:[{x:0,y:1},{x:1,y:1}],boneCount:3,trailRatio:100,lengthMode:"fixed",length:100,lengthMin:100,lengthMax:100,widthSizeMode:"fixed",width:100,widthMin:100,widthMax:100,widthMode:"particle",lifeLengthEnabled:!1,lifeLengthCurve:[{x:0,y:1},{x:1,y:1}],shapeEnabled:!1,shapeCurve:[{x:0,y:1},{x:1,y:1}]}],trailResourceVersion:6,trailTexture:null,trailTextureName:"trail",trailPreviewUrl:"/images/trail.png",trailColorMode:"particle",trailColor:"#ffffff",trailColorGradient:[{position:0,color:"#ffffff"},{position:1,color:"#ffffff"}],trailAlphaMode:"particle",trailAlpha:1,trailAlphaCurve:[{x:0,y:1},{x:1,y:1}],trailBoneCount:3,trailLength:100,trailWidth:100,trailWidthMode:"particle",trailLifeLengthEnabled:!1,trailLifeLengthCurve:[{x:0,y:1},{x:1,y:1}],trailShapeEnabled:!1,trailShapeCurve:[{x:0,y:1},{x:1,y:1}],trailGridRows:4,trailGridCols:4,collision:!1,collisionColliderIds:[],pathFollow:!1,eventEnabled:!1,events:[],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 Xn(s){var P;const e=wl(),t=s,i=t.shapeRangeVersion!==1,n=Number(t.radius),r=Number(t.rectW),o=Number(t.rectH),a=Number(t.direction),c=Number(t.spread),l=t.shape,h=t.imageWeightVersion!==1,u=t.loopDurationFrames==null,d=t.gravityMode==null,f=Number(t.gravity),m=t.windMode==null,p=Number(t.windX),g=Number(t.windY),x=t.forceFalloff==null,v=Number(t.forceStrength),y=t.trailConfigVersion!==3,S=!Array.isArray(t.trailResources),C=t.trailResourceVersion!==6,w=t.trailTexture,b=String(t.trailTextureName||"trail"),_=String(t.trailPreviewUrl||"/images/trail.png").replace("/trails/trail.png","/images/trail.png");for(const[E,R]of Object.entries(e))t[E]!==void 0&&t[E]!==null||(t[E]=Array.isArray(R)?R.map(O=>typeof O=="object"&&O!==null?{...O}:O):R);i&&(s.innerRadius=0,s.outerRadius=Math.max(0,Number.isFinite(n)?n:e.outerRadius),s.innerRectW=0,s.innerRectH=0,s.outerRectW=Math.max(0,Number.isFinite(r)?r:e.outerRectW),s.outerRectH=Math.max(0,Number.isFinite(o)?o:e.outerRectH),s.coneDirection=Number.isFinite(a)?a:90,s.emissionAngleMode=Number.isFinite(c)&&c>0?"random":"fixed",l==="cone"&&(s.spread=Math.max(0,Number(s.coneAngle)||0)),s.shapeRangeVersion=1),s.shape==="orbit"&&(s.shape="path"),["fixed","random","radial","path-normal","path-tangent"].includes(s.emissionAngleMode)||(s.emissionAngleMode="fixed"),!["circle","rect","cone"].includes(s.shape)&&s.emissionAngleMode==="radial"&&(s.emissionAngleMode="fixed"),s.shape!=="path"&&(s.emissionAngleMode==="path-normal"||s.emissionAngleMode==="path-tangent")&&(s.emissionAngleMode="fixed"),s.spawnPathId=Math.max(0,Math.round(Number(s.spawnPathId)||0)),s.spawnPathDistribution!=="fixed"&&s.spawnPathDistribution!=="random"&&(s.spawnPathDistribution="fixed"),s.renderLayerMode!=="top"&&s.renderLayerMode!=="slot"&&(s.renderLayerMode="top"),s.renderLayerSpineId=Math.max(0,Math.round(Number(s.renderLayerSpineId)||0)),typeof s.renderLayerSlotName!="string"&&(s.renderLayerSlotName=""),s.renderLayerSlotPosition!=="above"&&s.renderLayerSlotPosition!=="below"&&(s.renderLayerSlotPosition="above"),typeof s.renderLayerFollowAttachment!="boolean"&&(s.renderLayerFollowAttachment=!1),typeof s.eventEnabled!="boolean"&&(s.eventEnabled=!1),Array.isArray(s.events)||(s.events=[]);for(const E of s.events){E.id=Math.max(1,Math.round(Number(E.id)||1)),E.event!=="birth"&&E.event!=="death"&&E.event!=="collision"&&(E.event="birth"),E.targetSystemId=Math.max(0,Math.round(Number(E.targetSystemId)||0));const R=Number(E.probability);E.probability=Math.min(1,Math.max(0,Number.isFinite(R)?R:1));const O=Math.round(Number(E.collisionLimit));E.collisionLimit=Math.min(4,Math.max(1,Number.isFinite(O)?O:1));const U=E.inherit,Y=["color","scale","rotation","life"],$=Array.isArray(U)?U:U==="all"?[...Y]:Y.includes(String(U))?[String(U)]:[],X=[...new Set($.filter(F=>Y.includes(String(F))))],D=Array.isArray(U)?U:null;(!D||D.length!==X.length||X.some((F,N)=>F!==D[N]))&&(E.inherit=X),E.colorInheritMode!=="add"&&E.colorInheritMode!=="replace"&&(E.colorInheritMode="add")}s.innerRadius=Math.max(0,Number(s.innerRadius)||0),s.outerRadius=Math.max(s.innerRadius,Number(s.outerRadius)||0),s.innerRectW=Math.max(0,Number(s.innerRectW)||0),s.innerRectH=Math.max(0,Number(s.innerRectH)||0),s.outerRectW=Math.max(s.innerRectW,Number(s.outerRectW)||0),s.outerRectH=Math.max(s.innerRectH,Number(s.outerRectH)||0);const A=Array.from(new Set((Array.isArray(s.collisionColliderIds)?s.collisionColliderIds:[]).map(E=>Math.round(Number(E))).filter(E=>Number.isFinite(E)&&E>0)));(A.length!==s.collisionColliderIds.length||A.some((E,R)=>E!==s.collisionColliderIds[R]))&&(s.collisionColliderIds=A),s.streamBehavior!=="normal"&&s.streamBehavior!=="loop"&&(s.streamBehavior="normal"),(u||!Number.isFinite(s.loopDurationFrames))&&(s.loopDurationFrames=Math.ceil(Math.max(1/30,Number(s.duration)||1)*30)),s.loopDurationFrames=Math.min(1800,Math.max(1,Math.ceil(s.loopDurationFrames))),typeof s.generateLoopStartAnimation!="boolean"&&(s.generateLoopStartAnimation=!1),typeof s.generateLoopEndAnimation!="boolean"&&(s.generateLoopEndAnimation=!1),typeof s.loopStartUseCustomDuration!="boolean"&&(s.loopStartUseCustomDuration=!1),typeof s.loopEndUseCustomDuration!="boolean"&&(s.loopEndUseCustomDuration=!1),s.loopStartDurationFrames=Math.min(1800,Math.max(1,Math.ceil(Number(s.loopStartDurationFrames)||30))),s.loopEndDurationFrames=Math.min(1800,Math.max(1,Math.ceil(Number(s.loopEndDurationFrames)||30))),(!Array.isArray(s.imageResources)||s.imageResources.length===0)&&(s.imageResources=wl().imageResources);for(const E of s.imageResources){!E.texture&&s.texture&&(E.texture=s.texture),E.textureName||(E.textureName="star"),E.previewUrl==="/particles/star.png"&&(E.previewUrl="/images/star.png"),E.previewUrl||(E.previewUrl=E.textureName==="star"?"/images/star.png":""),E.imageMode!=="fixed"&&E.imageMode!=="sequence"&&(E.imageMode="fixed"),E.sequencePlayback==="once"?E.sequencePlayback="once-hold":E.sequencePlayback==="loop"?E.sequencePlayback="loop-forward":["once-hide","once-hold","loop-forward","loop-reverse"].includes(E.sequencePlayback)||(E.sequencePlayback="loop-forward"),Number.isFinite(E.sequenceFps)||(E.sequenceFps=30),E.sequenceFps=Math.min(120,Math.max(1,Number(E.sequenceFps)||30)),Array.isArray(E.sequenceFrames)||(E.sequenceFrames=[]);for(const R of E.sequenceFrames)typeof R.name!="string"&&(R.name=""),typeof R.previewUrl!="string"&&(R.previewUrl=""),R.texture===void 0&&(R.texture=null);Number.isFinite(E.weight)||(E.weight=100),typeof E.locked!="boolean"&&(E.locked=!1),Number.isFinite(E.scale)||(E.scale=1),Number.isFinite(E.anchorX)||(E.anchorX=.5),Number.isFinite(E.anchorY)||(E.anchorY=.5),E.colorMode!=="fixed"&&E.colorMode!=="random"&&E.colorMode!=="lifetime"&&(E.colorMode=s.colorOverLife?"lifetime":"fixed"),E.colorStart||(E.colorStart=s.colorStart||"#ffffff"),E.colorEnd||(E.colorEnd=s.colorEnd||E.colorStart),(!Array.isArray(E.colorGradient)||E.colorGradient.length<2)&&(E.colorGradient=[{position:0,color:E.colorStart},{position:1,color:E.colorEnd}]),Object.prototype.hasOwnProperty.call(br,E.blend)||(E.blend=s.blend||"normal"),["off","fixed","curve"].includes(E.independentAlpha)||(E.independentAlpha=s.independentAlpha||"off"),Number.isFinite(E.alpha)||(E.alpha=Number.isFinite(s.alphaScale)?s.alphaScale:1),["跟随导出","线性","贝塞尔"].includes(E.alphaCurveMode)||(E.alphaCurveMode=s.curveMode||"跟随导出"),(!Array.isArray(E.alphaCurve)||E.alphaCurve.length<2)&&(E.alphaCurve=(s.alphaCurve||[{x:0,y:1},{x:1,y:1}]).map(R=>({...R})))}if(s.imageResources.length===1)s.imageResources[0].weight=100,s.imageResources[0].locked=!1;else if(h){const E=100/s.imageResources.length;s.imageResources.forEach((R,O)=>{R.weight=O===s.imageResources.length-1?100-E*(s.imageResources.length-1):E,R.locked=!1})}if(s.imageWeightVersion=1,d){const E=Number.isFinite(f)&&f!==0?f:980;s.gravity=E,s.gravityMin=E,s.gravityMax=E}if(m){const E=Number.isFinite(p)&&Number.isFinite(g)&&(p!==0||g!==0);s.windMin=E?Math.hypot(p,g):100,s.windMax=s.windMin,s.windDirection=E?Math.atan2(-g,p)*180/Math.PI:0}x&&(s.forceStrength=Number.isFinite(v)&&v!==0?v:10),y&&(s.trailConfigVersion=3,s.trailAlphaCurve=[{x:0,y:1},{x:1,y:1}],s.trailLifeLengthCurve=[{x:0,y:1},{x:1,y:1}],s.trailShapeCurve=[{x:0,y:1},{x:1,y:1}],s.trailGridRows=4,s.trailGridCols=4),(S||!s.trailResources.length)&&(s.trailResources=[{id:1,texture:w||null,textureName:b,previewUrl:_,weight:100,locked:!1,rotation:0,colorMode:s.trailColorMode,color:s.trailColor,colorGradient:s.trailColorGradient.map(E=>({...E})),blend:"normal",alphaMode:s.trailAlphaMode,alpha:s.trailAlpha,alphaCurve:s.trailAlphaCurve.map(E=>({...E})),boneCount:s.trailBoneCount,trailRatio:100,lengthMode:"fixed",length:s.trailLength,lengthMin:s.trailLength,lengthMax:s.trailLength,widthSizeMode:"fixed",width:s.trailWidth,widthMin:s.trailWidth,widthMax:s.trailWidth,widthMode:s.trailWidthMode,lifeLengthEnabled:s.trailLifeLengthEnabled,lifeLengthCurve:s.trailLifeLengthCurve.map(E=>({...E})),shapeEnabled:s.trailShapeEnabled,shapeCurve:s.trailShapeCurve.map(E=>({...E}))}]);for(const E of s.trailResources)E.textureName||(E.textureName="trail"),E.previewUrl==="/trails/trail.png"&&(E.previewUrl="/images/trail.png"),E.previewUrl||(E.previewUrl="/images/trail.png"),Number.isFinite(E.weight)||(E.weight=100),typeof E.locked!="boolean"&&(E.locked=!1),Number.isFinite(E.rotation)||(E.rotation=0),["particle","fixed","curve"].includes(E.colorMode)||(E.colorMode=s.trailColorMode||"particle"),E.color||(E.color=s.trailColor||"#ffffff"),(!Array.isArray(E.colorGradient)||E.colorGradient.length<2)&&(E.colorGradient=(s.trailColorGradient||[{position:0,color:"#ffffff"},{position:1,color:"#ffffff"}]).map(R=>({...R}))),Object.prototype.hasOwnProperty.call(br,E.blend)||(E.blend="normal"),["particle","fixed","curve"].includes(E.alphaMode)||(E.alphaMode=s.trailAlphaMode||"particle"),Number.isFinite(E.alpha)||(E.alpha=Number.isFinite(s.trailAlpha)?s.trailAlpha:1),(!Array.isArray(E.alphaCurve)||E.alphaCurve.length<2)&&(E.alphaCurve=(s.trailAlphaCurve||[{x:0,y:1},{x:1,y:1}]).map(R=>({...R}))),Number.isFinite(E.boneCount)||(E.boneCount=Number.isFinite(s.trailBoneCount)?s.trailBoneCount:3),Number.isFinite(E.trailRatio)||(E.trailRatio=100),E.trailRatio=Math.min(100,Math.max(0,E.trailRatio)),["fixed","random"].includes(E.lengthMode)||(E.lengthMode="fixed"),Number.isFinite(E.length)||(E.length=Number.isFinite(s.trailLength)?s.trailLength:100),Number.isFinite(E.lengthMin)||(E.lengthMin=E.length),Number.isFinite(E.lengthMax)||(E.lengthMax=E.length),["fixed","random"].includes(E.widthSizeMode)||(E.widthSizeMode="fixed"),Number.isFinite(E.width)||(E.width=Number.isFinite(s.trailWidth)?s.trailWidth:100),Number.isFinite(E.widthMin)||(E.widthMin=E.width),Number.isFinite(E.widthMax)||(E.widthMax=E.width),["particle","fixed"].includes(E.widthMode)||(E.widthMode=s.trailWidthMode||"particle"),typeof E.lifeLengthEnabled!="boolean"&&(E.lifeLengthEnabled=!!s.trailLifeLengthEnabled),(!Array.isArray(E.lifeLengthCurve)||E.lifeLengthCurve.length<2)&&(E.lifeLengthCurve=(s.trailLifeLengthCurve||[{x:0,y:1},{x:1,y:1}]).map(R=>({...R}))),typeof E.shapeEnabled!="boolean"&&(E.shapeEnabled=!!s.trailShapeEnabled),(!Array.isArray(E.shapeCurve)||E.shapeCurve.length<2)&&(E.shapeCurve=(s.trailShapeCurve||[{x:0,y:1},{x:1,y:1}]).map(R=>({...R})));if(s.trailResources.length===1&&(s.trailResources[0].weight=100,s.trailResources[0].locked=!1),C)for(const E of s.trailResources)E.alphaCurve=((P=E.alphaCurve)==null?void 0:P.length)>=2?E.alphaCurve:[{x:0,y:1},{x:1,y:1}];return s.trailResourceVersion=6,s}class Xv extends gi{constructor(t,i=Lv){super();M(this,"pool",[]);M(this,"cfg");M(this,"accumulator",0);M(this,"burstTimer",0);M(this,"_spawnSerial",0);M(this,"_elapsed",0);M(this,"_attractionEnabledAt",0);M(this,"_attractionWasEnabled",!1);M(this,"autoEmission",!0);M(this,"pendingEventSpawns",[]);M(this,"states",[]);M(this,"onParticleEvent",null);M(this,"rng",Math.random);M(this,"_lastSeed",-1);M(this,"trailDebugGfx",new Ni);M(this,"trail");M(this,"colliders",[]);M(this,"followSpawnX",0);M(this,"followSpawnY",0);M(this,"followSpawnAngle",0);M(this,"spawnPathSampler",null);M(this,"spawnPathClosed",!1);M(this,"followExportCurveMode","线性");M(this,"simulationTransform",null);this.cfg=Xn(t),this.trail=new bR(this),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=af(t>>>0))}_ensurePool(t){for(;this.pool.length<t;){const i=this.pool.length,n=new Pr(this.cfg.texture);n.blendMode=br[this.cfg.blend],n.anchor.set(.5),n.visible=!1,this.addChild(n),this.pool.push({sprite:n,active:!1,boneName:"p_"+i,spawnId:-1,life:0,maxLife:1,x:0,y:0,vx:0,vy:0,scaleStartX:1,scaleStartY:1,alphaStart:1,alphaEnd:1,rotation:0,rotationSpeed:0,speedScale:1,speedScaleTarget:1,scaleOverLifeX:1,scaleOverLifeY:1,noisePhaseX:0,noisePhaseY:0,gravityStrength:980,windStrength:100,attractionActive:!1,attractionElapsed:0,attractionStartWorldX:0,attractionStartWorldY:0,attractionCurveSide:1,trail:xR(),resourceId:1,colorSample:16777215,colorAdd:0,colorOverride:null,currentScaleX:1,currentScaleY:1,imageFrameIndex:0,collisionPaused:!1,collisionCount:0,eventDepth:0})}}setSpawnPathSampler(t,i=!1){this.spawnPathSampler=t,this.spawnPathClosed=i}setColliders(t){this.colliders=t}setAutoEmission(t){this.autoEmission=t}setEmitterFollowSpawn(t,i,n){this.followSpawnX=t,this.followSpawnY=i,this.followSpawnAngle=n}setSimulationTransform(t,i,n,r,o){this.simulationTransform={centerX:t,centerY:i,rotation:n,scaleX:r,scaleY:o}}applyColliders(t,i){if(!this.cfg.collision||!this.colliders.length)return!1;const n=this.cfg;let r=tr(n,t.x,t.y,this.simulationTransform),o=mR(n,t.vx,t.vy,this.simulationTransform);for(const a of this.colliders){if(!a.enabled)continue;const c=gR(a,r.x,r.y);if(!c)continue;if(t.collisionCount++,this.emitWorldEvent("collision",t,c.x,c.y,{normalX:c.nx,normalY:c.ny}),a.response==="destroy")return this.kill(i),!0;if(r={x:c.x,y:c.y},a.response==="pause")t.collisionPaused=!0,o={x:0,y:0};else{const u=o.x*c.nx+o.y*c.ny,d=o.x-u*c.nx,f=o.y-u*c.ny,m=Math.min(1,Math.max(0,a.elasticity)),p=1-Math.min(1,Math.max(0,a.friction)),g=u<0?-u*m:u;o.x=d*p+g*c.nx,o.y=f*p+g*c.ny}const l=mc(n,r.x,r.y,this.simulationTransform),h=Bv(n,o.x,o.y,this.simulationTransform);t.x=l.x,t.y=l.y,t.vx=h.x,t.vy=h.y}return!1}update(t,i="normal"){var c,l,h,u,d,f;const n=this.cfg;if((n.lifeMode==null||n.speedMode==null||n.scaleMode==null||n.shapeRangeVersion!==1||n.initialRotationMode==null||n.speedOverLifeEnabled==null||n.scaleOverLifeEnabled==null||n.rotationOverLifeEnabled==null||!Array.isArray(n.scaleOverLifeCurve)||n.attraction==null||n.trailBoneCount==null)&&Xn(n),this.reseed(),this._elapsed+=t,n.attraction&&!this._attractionWasEnabled){this._attractionEnabledAt=this._elapsed;for(const m of this.pool)m.attractionActive=!1,m.attractionElapsed=0}else if(!n.attraction&&this._attractionWasEnabled)for(const m of this.pool)m.attractionActive=!1;this._attractionWasEnabled=n.attraction;const r=i==="force"||i==="normal"&&(n.delay<=0||this._elapsed>=n.delay),o=i==="force"||i==="normal"&&(n.mode==="burst"||this._elapsed<n.delay+Math.max(1/30,n.duration));if(this.autoEmission&&r&&o)if(n.mode==="stream")for(this.accumulator+=t*n.rate;this.accumulator>=1;)this.accumulator-=1,this.spawnOne();else this.burstTimer+=t,n.burstLoop?this.burstTimer>=1&&(this.burstTimer=0,this.emitBurst()):t>0&&this.burstTimer<=t&&this.emitBurst();if(this.pendingEventSpawns.length&&t>0){const m=[],p=[];for(const g of this.pendingEventSpawns)g.remaining-=t,g.remaining<=0?m.push(g):p.push(g);this.pendingEventSpawns=p;for(const g of m){const x=mc(this.cfg,g.worldX,g.worldY,this.simulationTransform);for(let v=0;v<g.count&&this.spawnOne({x:x.x,y:x.y},g.depth,g.inherit);v++);}}const a=[];for(let m=0;m<this.pool.length;m++){const p=this.pool[m];if(!p.active)continue;if(p.life-=t,p.life<=0){this.kill(m);continue}const g=vR(p);if(!p.collisionPaused&&n.useGravity){const F=Math.min(1,Math.max(0,nn(n.gravityCurve,g))),N=(n.gravityMode==="random"?p.gravityStrength:n.gravityMin)*F,k=n.gravityDirection*Math.PI/180;p.vx+=Math.cos(k)*N*t,p.vy+=-Math.sin(k)*N*t}if(!p.collisionPaused&&n.wind){const F=Math.min(1,Math.max(0,nn(n.windCurve,g))),N=(n.windMode==="random"?p.windStrength:n.windMin)*F,k=n.windDirection*Math.PI/180;p.vx+=Math.cos(k)*N*t,p.vy+=-Math.sin(k)*N*t}if(!p.collisionPaused&&n.forceField&&n.forceStrength!==0&&n.forceRadius>0){const F=Math.max(1e-4,Math.abs(n.rootScaleX)),N=Math.max(1e-4,Math.abs(n.rootScaleY)),k=-(((c=this.simulationTransform)==null?void 0:c.rotation)??n.rootRotation)*Math.PI/180,V=Math.cos(k),G=Math.sin(k),W=((l=this.simulationTransform)==null?void 0:l.centerX)??n.centerX,Z=((h=this.simulationTransform)==null?void 0:h.centerY)??n.centerY,ne=W+V*F*p.x-G*N*p.y,oe=-Z+G*F*p.x+V*N*p.y,de=ne,pe=-oe,he=n.forceCenterX-de,me=n.forceCenterY-pe,H=Math.hypot(he,me);if(H>1e-4&&H<=n.forceRadius){const z=C1(n.forceFalloff,H,n.forceRadius),K=n.forceStrength*z*10,B=he/H*K,L=me/H*K,j=B,ie=-L;p.vx+=(V*j+G*ie)/F*t,p.vy+=(-G*j+V*ie)/N*t}}if(!p.collisionPaused&&n.vortex&&n.vortexStrength!==0&&n.vortexRadius>0){const F=tr(n,p.x,p.y,this.simulationTransform),N=pR(F.x,F.y,n.vortexCenterX,n.vortexCenterY,n.vortexStrength,n.vortexRadius,n.vortexFalloff),k=Bv(n,N.x,N.y,this.simulationTransform);p.vx+=k.x*t,p.vy+=k.y*t}if(!p.collisionPaused&&n.damping>0){const F=Math.max(0,1-n.damping*t);p.vx*=F,p.vy*=F}if(p.collisionPaused)p.vx=0,p.vy=0;else if(p.x+=p.vx*t,p.y+=p.vy*t,this.applyColliders(p,m))continue;if(n.attraction&&!p.collisionPaused){const F=p.maxLife-p.life;if(n.attractionDelayMode==="particle"?F>=Math.max(0,n.attractionDelay):this._elapsed-this._attractionEnabledAt>=Math.max(0,n.attractionDelay)){const k=tr(n,p.x,p.y,this.simulationTransform),V=n.attractionCenterX,G=n.attractionCenterY,W=Math.max(0,n.attractionRadius);if(!p.attractionActive){if(Math.hypot(V-k.x,G-k.y)<=W){this.kill(m);continue}p.attractionActive=!0,p.attractionElapsed=0,p.attractionStartWorldX=k.x,p.attractionStartWorldY=k.y}p.attractionElapsed+=t;const Z=Math.max(1e-4,n.attractionDuration),ne=Math.min(1,p.attractionElapsed/Z);let oe=Mi(p.attractionStartWorldX,V,ne),de=Mi(p.attractionStartWorldY,G,ne);if(n.attractionPath==="curve"){const me=V-p.attractionStartWorldX,H=G-p.attractionStartWorldY,z=Math.hypot(me,H);if(z>1e-4){const K=z*.25*p.attractionCurveSide,B=(p.attractionStartWorldX+V)*.5-H/z*K,L=(p.attractionStartWorldY+G)*.5+me/z*K,j=1-ne;oe=j*j*p.attractionStartWorldX+2*j*ne*B+ne*ne*V,de=j*j*p.attractionStartWorldY+2*j*ne*L+ne*ne*G}}const pe=Math.hypot(V-oe,G-de);if(ne>=1||pe<=W){this.kill(m);continue}const he=mc(n,oe,de,this.simulationTransform);p.x=he.x,p.y=he.y,p.vx=0,p.vy=0}}const x=g,v=p.sprite,y=n.imageResources.find(F=>F.id===p.resourceId);if(y){const F=$v(y,p.maxLife-p.life);p.imageFrameIndex=F.index,v.texture=lf(y,n.texture,p.imageFrameIndex),v.visible=F.visible}if(n.speedOverLifeEnabled){const F=fc(of(n.speedOverLifeMode,n.speedOverLifeMin,n.speedOverLifeMax,n.speedOverLifeCurve,x,p.speedScaleTarget),1),N=p.speedScale===0?F:F/p.speedScale;p.vx*=N,p.vy*=N,p.speedScale=F}let S=p.rotationSpeed;n.rotationOverLifeEnabled&&n.rotationOverLifeMode==="curve"&&(S=Mi(n.rotationSpeedMin,n.rotationSpeedMax,nn(n.rotationOverLifeCurve,x))),p.rotation+=S*t;let C=p.x,w=p.y;if(n.noise&&n.noiseAmt>0&&n.noiseRange>0&&n.noiseSpeed>0){const F=p.maxLife-p.life,N=Math.max(0,n.noiseRange)*Math.min(1,Math.max(0,n.noiseAmt)/100)*.5,k=F*Math.max(0,n.noiseSpeed)*Math.PI*2;C+=(Math.sin(p.noisePhaseX+k)-Math.sin(p.noisePhaseX))*N,w+=(Math.sin(p.noisePhaseY+k*.83)-Math.sin(p.noisePhaseY))*N}v.x=C,v.y=w,v.rotation=-p.rotation*Math.PI/180;let b=1,_=1;n.scaleOverLifeEnabled&&(b=of(n.scaleOverLifeMode,n.scaleOverLifeMin,n.scaleOverLifeMax,n.scaleOverLifeCurve,x,p.scaleOverLifeX),_=n.scaleOverLifeAxisMode==="separate"?of(n.scaleOverLifeMode,n.scaleYOverLifeMin,n.scaleYOverLifeMax,n.scaleYOverLifeCurve,x,p.scaleOverLifeY):b),v.scale.set(fc(p.scaleStartX*b,1),fc(p.scaleStartY*_,1)),p.currentScaleX=v.scale.x,p.currentScaleY=v.scale.y;const A=n.alphaMode==="curve"?nn(n.alphaCurve,x,this.resolveCurveMode(n.curveMode))*n.alphaScale:n.alpha*n.alphaScale;v.alpha=fc((y==null?void 0:y.independentAlpha)==="fixed"?y.alpha:(y==null?void 0:y.independentAlpha)==="curve"?nn(y.alphaCurve,x,this.resolveCurveMode(y.alphaCurveMode)):A,1);const P=(y==null?void 0:y.colorStart)||"#ffffff",E=(y==null?void 0:y.colorMode)==="lifetime"?ym(y.colorGradient,x):(y==null?void 0:y.colorMode)==="random"?p.colorSample:sa(P),R=p.colorOverride??Uv(E,p.colorAdd);v.tint=R,v.blendMode=br[(y==null?void 0:y.blend)||"normal"];const O=this.trail.update(p.trail,n,p.boneName,C,w,x,v),U=tr(n,C,w,this.simulationTransform),Y=((u=this.simulationTransform)==null?void 0:u.rotation)??n.rootRotation,$=Math.abs(((d=this.simulationTransform)==null?void 0:d.scaleX)??n.rootScaleX),X=Math.abs(((f=this.simulationTransform)==null?void 0:f.scaleY)??n.rootScaleY),D=O?{...O,bones:O.bones.map(F=>{const N=tr(n,F.x,F.y,this.simulationTransform);return{...F,worldX:N.x,worldY:N.y,worldRotation:Y-F.rotation}})}:void 0;a.push({boneName:p.boneName,spawnId:p.spawnId,x:C,y:w,rotation:p.rotation,scaleX:v.scale.x,scaleY:v.scale.y,worldX:U.x,worldY:U.y,worldRotation:Y+p.rotation,worldScaleX:v.scale.x*$,worldScaleY:v.scale.y*X,alpha:v.alpha,colorHex:R,resourceId:p.resourceId,imageFrameIndex:p.imageFrameIndex,imageVisible:v.visible,trailState:D,active:!0})}return this.states=a,a}drawTrailMeshDebug(t){this.trail.drawDebug(this.trailDebugGfx,t,this.cfg,this.pool.map(i=>i.trail))}emitBurst(){for(let t=0;t<this.cfg.burstCount;t++)this.spawnOne()}spawnOrigin(){const t=this.cfg;let i=t.offsetX,n=t.offsetY;if(n=-n,t.shape==="path"&&t.spawnPathId>0&&this.spawnPathSampler){const a=this.estimatedEmissionCount(),c=hR(t.spawnPathDistribution,this._spawnSerial,a,this.spawnPathClosed,this.rng),l=this.spawnPathSampler(c);if(l)return{...this.applyFollowToOrigin(l.x+i,l.y+n),radialAngle:0,pathAngle:l.angle}}const r=dR(t,this.rng);return{...this.applyFollowToOrigin(i+r.x,n+r.y),radialAngle:r.radialAngle}}estimatedEmissionCount(){const t=this.cfg;return t.mode==="burst"?Math.max(1,Math.round(t.burstCount)):Math.max(1,Math.floor(t.rate*(t.streamBehavior==="loop"?Math.max(1,t.loopDurationFrames)/30:Math.max(0,t.duration))))}applyFollowToOrigin(t,i){const n=this.followSpawnAngle*Math.PI/180,r=Math.cos(n),o=Math.sin(n);return{x:this.followSpawnX+r*t-o*i,y:this.followSpawnY+o*t+r*i}}spawnEventParticle(t,i,n=1,r,o){if(n>2)return!1;const a=o??(this.cfg.mode==="burst"?this.cfg.burstCount:1),c=Math.max(1,Math.min(Lv,Math.round(Number(a)||1))),l=Math.max(0,Number(this.cfg.delay)||0);if(l>0)return this.pendingEventSpawns.push({worldX:t,worldY:i,depth:n,inherit:r,count:c,remaining:l}),!0;const h=mc(this.cfg,t,i,this.simulationTransform);let u=!1;for(let d=0;d<c&&this.spawnOne({x:h.x,y:h.y},n,r);d++)u=!0;return u}emitWorldEvent(t,i,n,r,o){this.onParticleEvent&&this.onParticleEvent({kind:t,worldX:n,worldY:r,rotation:i.rotation,spawnId:i.spawnId,depth:i.eventDepth,colorHex:i.sprite.tint,scaleX:i.currentScaleX,scaleY:i.currentScaleY,maxLife:i.maxLife,collisionCount:i.collisionCount,...o})}emitLocalEvent(t,i,n,r){if(!this.onParticleEvent)return;const o=tr(this.cfg,n,r,this.simulationTransform);this.emitWorldEvent(t,i,o.x,o.y)}spawnOne(t,i=0,n){const r=this.cfg;let o=this.pool.findIndex(_=>!_.active);if(o===-1)return!1;const a=t?{x:t.x,y:t.y,radialAngle:0}:this.spawnOrigin(),{x:c,y:l}=a,h=Io(r.lifeMode,r.lifeMin,r.lifeMax,r.lifeCurve,this.rng()),u=Io(r.speedMode,r.speedMin,r.speedMax,r.speedCurve,this.rng()),d=n!=null&&n.attributes.includes("rotation")?n.data.rotation:0,f=fR(r,a,this.followSpawnAngle,this.rng)+d*Math.PI/180,m=this.pool[o],p=MR(r,this.rng),g=this._spawnSerial++;m.spawnId=g;const x=TR(r,ar(r.seed,g,1540483477));m.noisePhaseX=ar(r.seed,g,1757159915)*Math.PI*2,m.noisePhaseY=ar(r.seed,g,48610963)*Math.PI*2,m.gravityStrength=r.useGravity&&r.gravityMode==="random"?Mi(r.gravityMin,r.gravityMax,this.rng()):r.gravityMin,m.windStrength=r.wind&&r.windMode==="random"?Mi(r.windMin,r.windMax,this.rng()):r.windMin,m.attractionActive=!1,m.attractionElapsed=0,m.collisionPaused=!1,m.collisionCount=0,m.eventDepth=i,m.attractionCurveSide=ar(r.seed,g,2738958700)<.5?-1:1,m.trail.history.length=0,m.trail.bones.length=0,m.trail.currentWidth=0,m.trail.currentAlpha=0,m.trail.currentColor=16777215,m.trail.resourceId=x.id;const v=Math.min(100,Math.max(0,Number(x.trailRatio)||0)),y=r.mode==="burst"?Math.max(0,Math.round(r.burstCount)):Math.max(0,Math.floor(r.rate*(r.streamBehavior==="loop"?Math.max(1,r.loopDurationFrames)/30:Math.max(0,r.duration)))),S=v>0&&y===1&&g===0,C=ar(r.seed,g,668265261)*100,w=(_,A,P,E,R)=>{if(_!=="random")return Math.max(0,Number(A)||0);const O=Math.max(0,Math.min(Number(P)||0,Number(E)||0)),U=Math.max(0,Math.max(Number(P)||0,Number(E)||0));return Mi(O,U,ar(r.seed,g,R))};if(m.trail.sampledLength=w(x.lengthMode,x.length,x.lengthMin,x.lengthMax,374761393),m.trail.sampledWidth=w(x.widthSizeMode,x.width,x.widthMin,x.widthMax,3550635116),m.trail.enabled=r.trail&&(S||C<v)&&m.trail.sampledLength>0&&m.trail.sampledWidth>0,m.trail.mesh&&(m.trail.mesh.visible=!1),m.active=!0,m.life=h,m.maxLife=h,m.x=c,m.y=l,m.trail.enabled&&m.trail.history.push({x:c,y:l}),m.vx=Math.cos(f)*u,m.vy=Math.sin(f)*u,m.scaleStartX=Io(r.scaleMode,r.scaleMin,r.scaleMax,r.scaleCurve,this.rng())*p.scale,m.scaleStartY=r.scaleAxisMode==="separate"?Io(r.scaleMode,r.scaleYMin,r.scaleYMax,r.scaleYCurve,this.rng())*p.scale:m.scaleStartX,m.alphaStart=r.alpha,m.alphaEnd=r.alphaEnd,m.rotation=r.initialRotationMode==="direction"?-Math.atan2(m.vy,m.vx)*180/Math.PI+r.initialRotationMin:Io(r.initialRotationMode,r.initialRotationMin,r.initialRotationMax,r.initialRotationCurve,this.rng())+d,m.rotationSpeed=r.rotationOverLifeEnabled?Io(r.rotationOverLifeMode,r.rotationSpeedMin,r.rotationSpeedMax,r.rotationOverLifeCurve,this.rng()):0,m.speedScale=1,m.speedScaleTarget=r.speedOverLifeMode==="random"?Mi(r.speedOverLifeMin,r.speedOverLifeMax,this.rng()):r.speedOverLifeMin,m.scaleOverLifeX=r.scaleOverLifeMode==="random"?Mi(r.scaleOverLifeMin,r.scaleOverLifeMax,this.rng()):r.scaleOverLifeMin,m.scaleOverLifeY=r.scaleOverLifeMode==="random"?Mi(r.scaleYOverLifeMin,r.scaleYOverLifeMax,this.rng()):r.scaleYOverLifeMin,m.resourceId=p.id,m.colorSample=p.colorMode==="random"?ym(p.colorGradient,ar(r.seed,g,2654435769)):sa(p.colorStart),m.colorAdd=0,m.colorOverride=null,n){const _=n.attributes;_.includes("color")&&(n.colorMode==="replace"?m.colorOverride=n.data.colorHex:m.colorAdd=n.data.colorHex),_.includes("scale")&&(m.scaleStartX*=n.data.scaleX,m.scaleStartY*=n.data.scaleY),_.includes("life")&&(m.life=Math.max(1e-4,n.data.life),m.maxLife=m.life)}m.currentScaleX=m.scaleStartX,m.currentScaleY=m.scaleStartY;const b=$v(p,0);return m.imageFrameIndex=b.index,m.sprite.texture=lf(p,r.texture,b.index),m.sprite.anchor.set(p.anchorX,p.anchorY),m.sprite.blendMode=br[p.blend],m.sprite.tint=m.colorOverride??Uv(m.colorSample,m.colorAdd),m.sprite.visible=!0,this.emitLocalEvent("birth",m,m.x,m.y),!0}kill(t){const i=this.pool[t];i.active&&this.emitLocalEvent("death",i,i.x,i.y),i.active=!1,i.sprite.visible=!1,Dc(i.trail)}clear(){this.pendingEventSpawns.length=0;for(const t of this.pool)t.active=!1,t.sprite.visible=!1,Dc(t.trail)}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.trail.bones.length?{bones:i.trail.bones.map(n=>{var o;const r=tr(this.cfg,n.x,n.y,this.simulationTransform);return{...n,worldX:r.x,worldY:r.y,worldRotation:(((o=this.simulationTransform)==null?void 0:o.rotation)??this.cfg.rootRotation)-n.rotation}}),activeBoneCount:i.trail.bones.length,width:i.trail.currentWidth,alpha:i.trail.currentAlpha,colorHex:i.trail.currentColor,resourceId:i.trail.resourceId}:void 0});return t}captureWorldTransform(t){var r,o,a;const i=tr(this.cfg,t.sprite.x,t.sprite.y,this.simulationTransform),n=((r=this.simulationTransform)==null?void 0:r.rotation)??this.cfg.rootRotation;return{worldX:i.x,worldY:i.y,worldRotation:n+t.rotation,worldScaleX:t.sprite.scale.x*Math.abs(((o=this.simulationTransform)==null?void 0:o.scaleX)??this.cfg.rootScaleX),worldScaleY:t.sprite.scale.y*Math.abs(((a=this.simulationTransform)==null?void 0:a.scaleY)??this.cfg.rootScaleY)}}apply(t){const i=new Map;for(const n of t)i.set(n.boneName,n);for(const n of this.pool){const r=i.get(n.boneName);if(!r){n.active=!1,n.sprite.visible=!1,n.trail.mesh&&(n.trail.mesh.visible=!1);continue}n.active=r.active;const o=n.sprite;if(o.visible=r.active&&r.imageVisible!==!1,o.x=r.x,o.y=r.y,o.rotation=-r.rotation*Math.PI/180,o.scale.set(r.scaleX,r.scaleY),o.alpha=r.alpha,o.tint=r.colorHex,r.resourceId!=null){const a=this.cfg.imageResources.find(c=>c.id===r.resourceId);a&&(n.imageFrameIndex=r.imageFrameIndex??0,o.texture=lf(a,this.cfg.texture,n.imageFrameIndex),o.anchor.set(a.anchorX,a.anchorY),o.blendMode=br[a.blend])}this.cfg.trail&&r.trailState?this.trail.applyState(n.trail,this.cfg,n.sprite,r.trailState):n.trail.mesh&&(n.trail.mesh.visible=!1)}}reset(){this.pendingEventSpawns.length=0;for(const t of this.pool)t.active=!1,t.sprite.visible=!1,Dc(t.trail);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=af(this.cfg.seed>>>0)}restartEmissionCycle(){this.pendingEventSpawns.length=0,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=af(this.cfg.seed>>>0)}}const fo=new Map,ao=new Map;function _R(s){return[...fo.values()].some(e=>e===s)}function E1(s){if(!(_R(s)||(ao.get(s)||0)>0)){ao.delete(s);for(const e of s.textures)e.destroy(!0)}}function CR(s){const e=ao.get(s)||0;e>1?ao.set(s,e-1):ao.delete(s),E1(s)}function ER(s){return fo.get(s)||null}function pu(s,e){Fl(s),fo.set(s,e)}function AR(s){const e=fo.get(s);return e?(ao.set(e,(ao.get(e)||0)+1),e):null}function IR(s,e){const t=fo.get(s);return t?(pu(e,t),!0):!1}function Fl(s){const e=fo.get(s);e&&(fo.delete(s),E1(e))}function Vt(s){if(Array.isArray(s))return s.map(e=>Vt(e));if(s&&typeof s=="object"){const e=Object.getPrototypeOf(s);if(e===Object.prototype||e===null){const t={};for(const[i,n]of Object.entries(s))t[i]=Vt(n);return t}}return s}const A1=["3.8","4.0","4.1","4.2","4.3"];function yh(s){const e=String(s||"").trim();return A1.find(t=>e===t||e.startsWith(`${t}.`))||null}function xm(){return A1.join(" / ")}function RR(s){return s==="4.3"?"4.3":"4.2"}function _p(){return{imagesPath:"./images/",spineVersion:"4.2",keyframeCurve:"bezier",fps:30,omitFps:!1,integerFrameAlignment:!0,bonePool:!0,excludeEmptyAnimations:!1,fileName:"SpineParticle.json"}}function I1(s){const e=Object.assign(_p(),s||{});return e.imagesPath=String(e.imagesPath||"./images/"),e.spineVersion=yh(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 bm=30;function Uc(s,e=1){return Math.min(1800,Math.max(1,Math.ceil(Number(s)||e)))}function R1(s,e=30){const t=Math.max(0,Number(s.lifeMin)||0),i=Math.max(0,Number(s.lifeMax)||0),n=s.lifeMode==="fixed"?t:Math.max(t,i);return Uc(Math.ceil(n*Math.max(1,e)),bm)}function Ps(s,e=30){const t=Uc(s.loopDurationFrames),i=R1(s,e),n=s.generateLoopStartAnimation?s.loopStartUseCustomDuration?Uc(s.loopStartDurationFrames,bm):i:0,r=s.generateLoopEndAnimation?s.loopEndUseCustomDuration?Uc(s.loopEndDurationFrames,bm):i:0;return{start:n,loop:t,end:r,total:n+t+r}}function P1(s,e){const t=Ps(s,e),n=Math.max(0,Math.ceil(Math.max(0,Number(s.delay)||0)*Math.max(1,e)))+t.start;return{start:n,end:n+t.loop}}function Sl(s){var t,i;const e=new Set;for(const n of s){if(((t=n.config)==null?void 0:t.eventEnabled)===!1)continue;const r=(i=n.config)==null?void 0:i.events;if(Array.isArray(r))for(const o of r)o.targetSystemId>0&&o.targetSystemId!==n.id&&e.add(o.targetSystemId)}return e}function k1(s,e){var r,o;const t=new Map;for(const a of s){if(((r=a.config)==null?void 0:r.eventEnabled)===!1)continue;const c=(o=a.config)==null?void 0:o.events;if(Array.isArray(c))for(const l of c){if(l.targetSystemId<=0||l.targetSystemId===a.id)continue;const h=t.get(l.targetSystemId);h?h.push(a.id):t.set(l.targetSystemId,[a.id])}}const i=new Set,n=[...t.get(e)||[]];for(;n.length;){const a=n.pop();i.has(a)||(i.add(a),n.push(...t.get(a)||[]))}return i.delete(e),i}const PR=.001;function F1(s,e){const t=Math.max(1,Number(e)||30),n=Math.max(0,Number(s)||0)*t+PR*t;return Math.max(0,Math.floor(n))}function O1(s,e,t){const i=Math.max(1,Math.floor(t)-1),n=Math.min(i-1,Math.max(0,Math.floor(Number(s)||0))),r=Math.min(i,Math.max(n+1,Math.floor(Number(e)||i)));return{start:n,end:r}}function cf(s,e,t,i){const n=Math.max(1,Math.floor(i)-1);return O1(s?e:0,s?t:n,i)}function kR(s,e,t){const i=Math.max(1,e-1),n=Math.max(1,t-1),r=s.end>=i?n:s.end;return O1(s.start,r,t)}let pc=1,gc=1,vc=1,yc=1;function xc(s,e){const t=new Set(e),i=`${s} Copy`;if(!t.has(i))return i;let n=2;for(;t.has(`${i} ${n}`);)n++;return`${i} ${n}`}const yo=z2("particle",{state:()=>({editor:{viewScale:1,viewX:0,viewY:0},systems:[],colliders:[],paths:[],spines:[],activeId:0,activeObjectType:"particle",activeObjectId:0,timeline:{playing:!0,loop:!0,abLoop:!1,frame:0,totalFrames:60,playbackStart:0,playbackEnd:59,fps:30,recorded:!1,animation:"animation",animations:["animation"]},settings:{parameterPanelOnRight:!0,tickEnabled:!1,axisFontSize:12,tickWidth:1,showAxisLabels:!0,axisColor:"#7a86ad",undoLimit:20,backgroundX:0,backgroundY:0,backgroundOpacity:1,backgroundImageName:"",backgroundImageData:"",showEmitter:!0,showBones:!1,bonePointDrawSize:1,boneAxisDrawSize:2,showSkinMesh:!1,showGrid:!0,exportSettings:_p()}}),getters:{activeSystemCount:s=>s.systems.length,playbackRange:s=>cf(s.timeline.abLoop,s.timeline.playbackStart,s.timeline.playbackEnd,s.timeline.totalFrames)},actions:{syncSceneSequences(){pc=Math.max(pc,...this.systems.map(s=>s.id+1),1),gc=Math.max(gc,...this.colliders.map(s=>s.id+1),1),vc=Math.max(vc,...this.paths.map(s=>s.id+1),1),yc=Math.max(yc,...this.spines.map(s=>s.id+1),1)},addSystem(s){const e=wl();s!=null&&s.config&&Object.assign(e,s.config);const t=new Set(this.systems.map(r=>r.config.name));if(t.has(e.name)){let r=0;for(const a of this.systems){const c=/^ParticleSystem(\d+)$/.exec(a.config.name);c&&(r=Math.max(r,parseInt(c[1],10)))}e.name=`ParticleSystem${r+1}`;let o=2;for(;t.has(e.name);)e.name=`ParticleSystem${r+o}`,o++}const i=this.timeline.animations.includes(this.timeline.animation)?this.timeline.animation:this.timeline.animations[0]||"animation",n={id:pc++,visible:!0,animation:i,config:e};return this.systems.push(n),this.activeId=n.id,this.activeObjectType="particle",this.activeObjectId=n.id,n},removeSystem(s){var i;const e=this.systems.findIndex(n=>n.id===s);e>=0&&this.systems.splice(e,1),this.activeId===s&&(this.activeId=((i=this.systems[0])==null?void 0:i.id)??0);const t=this.systems.find(n=>n.id===this.activeId);if(t&&(this.timeline.animation=t.animation),this.activeObjectType==="particle"&&this.activeObjectId===s){const n=this.systems[0];this.activeObjectId=(n==null?void 0:n.id)??0}},selectSystem(s){this.activeId=s,this.activeObjectType="particle",this.activeObjectId=s;const e=this.systems.find(t=>t.id===s);e&&(this.timeline.animation=e.animation)},setSystemAnimation(s,e){if(!this.timeline.animations.includes(e))return;const t=this.systems.find(i=>i.id===s);t&&(t.animation=e,this.timeline.animation=e)},addAnimation(){const s=new Set(this.timeline.animations);let e=2,t=`animation${e}`;for(;s.has(t);)t=`animation${++e}`;this.timeline.animations.push(t),this.timeline.animation=t;const i=this.systems.find(n=>n.id===this.activeId);return i&&(i.animation=t),t},renameAnimation(s,e){const t=e.trim(),i=this.timeline.animations.indexOf(s);if(i<0||!t||t!==s&&this.timeline.animations.includes(t))return!1;this.timeline.animations[i]=t;for(const n of this.systems)n.animation===s&&(n.animation=t);return this.timeline.animation===s&&(this.timeline.animation=t),!0},removeAnimation(s){if(this.timeline.animations.length<=1)return!1;const e=this.timeline.animations.indexOf(s);if(e<0)return!1;this.timeline.animations.splice(e,1);const t=this.timeline.animations[Math.min(e,this.timeline.animations.length-1)];for(const i of this.systems)i.animation===s&&(i.animation=t);return this.timeline.animation===s&&(this.timeline.animation=t),!0},addCollider(){const s=gc++,e={id:s,name:`Collider${s}`,visible:!0,shape:"circle",enabled:!0,x:0,y:0,rotation:0,scaleX:1,scaleY:1,radius:50,radiusX:70,radiusY:45,width:120,height:80,sides:6,response:"physics",elasticity:.8,friction:.3,followPath:!1,followPathId:0,followDuration:2,followPathRotation:!1,followCurveMode:"跟随导出",followCurve:[{x:0,y:0},{x:1,y:1}]};return this.colliders.push(e),this.activeObjectType="collision",this.activeObjectId=e.id,e},addPath(){const s=vc++,e={id:s,name:`Path${s}`,visible:!0,enabled:!0,x:0,y:0,rotation:0,scaleX:1,scaleY:1,closed:!1,color:"#ff933e",preset:"",points:[]};return this.paths.push(e),this.activeObjectType="path",this.activeObjectId=e.id,e},addSpine(){const s=yc++,e={id:s,name:`SpineSkeleton${s}`,enabled:!0,visible:!0,x:0,y:0,rotation:0,scaleX:1,scaleY:1,timeOffset:0,skeletonFileName:"",atlasFileName:"",textureFileNames:[],dataVersion:"",sourceBundle:null,selectedAnimation:"",selectedBone:"",selectedSlot:"",animations:[],bones:[],slots:[],assetVersion:0,status:"empty",error:""};return this.spines.push(e),this.activeObjectType="spine",this.activeObjectId=e.id,e},duplicateSelectedObject(){const s=this.activeObjectId;if(!s)return null;if(this.activeObjectType==="particle"){const i=this.systems.find(r=>r.id===s);if(!i)return null;const n=Vt(i);return n.id=pc++,n.config.name=xc(i.config.name,this.systems.map(r=>r.config.name)),n.frames=void 0,this.systems.push(n),this.activeId=n.id,this.activeObjectId=n.id,this.timeline.animation=n.animation,n}if(this.activeObjectType==="collision"){const i=this.colliders.find(r=>r.id===s);if(!i)return null;const n=Vt(i);return n.id=gc++,n.name=xc(i.name,this.colliders.map(r=>r.name)),this.colliders.push(n),this.activeObjectId=n.id,n}if(this.activeObjectType==="path"){const i=this.paths.find(r=>r.id===s);if(!i)return null;const n=Vt(i);return n.id=vc++,n.name=xc(i.name,this.paths.map(r=>r.name)),this.paths.push(n),this.activeObjectId=n.id,n}const e=this.spines.find(i=>i.id===s);if(!e)return null;const t=Vt(e);return t.id=yc++,t.name=xc(e.name,this.spines.map(i=>i.name)),t.selectedBone="",t.selectedSlot="",IR(e.id,t.id),this.spines.push(t),this.activeObjectId=t.id,t},selectSceneObject(s,e){if(this.activeObjectType=s,this.activeObjectId=e,s==="particle"){this.activeId=e;const t=this.systems.find(i=>i.id===e);t&&(this.timeline.animation=t.animation)}},removeCollider(s){var t;const e=this.colliders.findIndex(i=>i.id===s);e>=0&&this.colliders.splice(e,1);for(const i of this.systems){const n=Xn(i.config);n.collisionColliderIds=n.collisionColliderIds.filter(r=>r!==s)}if(this.activeObjectType==="collision"&&this.activeObjectId===s){const i=this.systems[0];this.activeObjectType=i?"particle":"collision",this.activeObjectId=(i==null?void 0:i.id)??((t=this.colliders[0])==null?void 0:t.id)??0}},removePath(s){var t;const e=this.paths.findIndex(i=>i.id===s);if(e>=0&&this.paths.splice(e,1),this.activeObjectType==="path"&&this.activeObjectId===s){const i=this.systems[0];this.activeObjectType=i?"particle":"path",this.activeObjectId=(i==null?void 0:i.id)??((t=this.paths[0])==null?void 0:t.id)??0}},removeSpine(s){Fl(s);const e=this.spines.findIndex(t=>t.id===s);if(e>=0&&this.spines.splice(e,1),this.activeObjectType==="spine"&&this.activeObjectId===s){const t=this.systems[0],i=this.colliders[0],n=this.paths[0],r=this.spines[0];t?(this.activeObjectType="particle",this.activeObjectId=t.id,this.activeId=t.id):i?(this.activeObjectType="collision",this.activeObjectId=i.id):n?(this.activeObjectType="path",this.activeObjectId=n.id):(this.activeObjectType="spine",this.activeObjectId=(r==null?void 0:r.id)??0)}this.recalcTotalFrames()},play(){const s=this.playbackRange;(this.timeline.frame<s.start||this.timeline.frame>=s.end)&&(this.timeline.frame=s.start),this.timeline.playing=!0},pause(){this.timeline.playing=!1},togglePlay(){this.timeline.playing?this.pause():this.play()},toStart(){this.timeline.frame=this.playbackRange.start},previousFrame(){this.timeline.playing=!1,this.timeline.frame=Math.max(this.playbackRange.start,this.timeline.frame-1)},nextFrame(){this.timeline.playing=!1,this.timeline.frame=Math.min(this.playbackRange.end,this.timeline.frame+1)},toEnd(){this.timeline.playing=!1,this.timeline.frame=this.playbackRange.end},toggleLoop(){this.timeline.loop=!this.timeline.loop},toggleABLoop(){this.timeline.abLoop=!this.timeline.abLoop;const s=this.playbackRange;(this.timeline.frame<s.start||this.timeline.frame>s.end)&&(this.timeline.frame=s.start)},setFrame(s){this.timeline.frame=Math.max(0,Math.min(s,this.timeline.totalFrames-1))},setPlaybackStart(s){const e=cf(!0,s,this.timeline.playbackEnd,this.timeline.totalFrames);this.timeline.playbackStart=e.start,this.timeline.playbackEnd=e.end,this.timeline.abLoop&&this.timeline.frame<e.start&&(this.timeline.frame=e.start)},setPlaybackEnd(s){const e=cf(!0,this.timeline.playbackStart,s,this.timeline.totalFrames);this.timeline.playbackStart=e.start,this.timeline.playbackEnd=e.end,this.timeline.abLoop&&this.timeline.frame>e.end&&(this.timeline.frame=e.end)},recalcTotalFrames(){const s=Math.max(1,this.timeline.fps||30),e=u=>{const d=Math.max(0,Number(u.lifeMin)||0),f=Math.max(0,Number(u.lifeMax)||0);return u.lifeMode==="fixed"?d:Math.max(d,f)},t=new Map(this.systems.map(u=>[u.id,u])),i=new Map,n=new Set,r=u=>{const d=i.get(u.id);if(d!=null)return d;if(n.has(u.id))return 0;n.add(u.id);const f=u.config,m=e(f);let p=m;if(f.eventEnabled)for(const g of f.events||[]){const x=t.get(g.targetSystemId);if(!x||x.id===u.id)continue;const v=r(x),y=g.event==="birth"?0:m,S=Math.max(0,Number(x.config.delay)||0);p=Math.max(p,y+S+v)}return n.delete(u.id),i.set(u.id,p),p},o=Sl(this.systems);let a=0;for(const u of this.systems){if(o.has(u.id))continue;const d=u.config,f=Math.max(0,Number(d.delay)||0),m=d.mode==="stream"&&d.streamBehavior==="loop";let p;if(d.mode==="stream"){const g=m?Ps(d,s).total/s:Math.max(1/s,Number(d.duration)||0);if(p=f+g,m){let x=0;if(d.eventEnabled){const v=e(d);for(const y of d.events||[]){const S=t.get(y.targetSystemId);if(!S||S.id===u.id)continue;const C=Math.max(0,Number(S.config.delay)||0);x=Math.max(x,(y.event==="birth"?0:v)+C+r(S))}}p+=x}else p+=r(u)}else p=f+r(u);p>a&&(a=p)}for(const u of this.spines){const d=u.animations.find(m=>m.name===u.selectedAnimation);if(!d)continue;const f=Math.max(0,Number(u.timeOffset)||0)+Math.max(0,d.duration||0);f>a&&(a=f)}for(const u of this.colliders){if(!u.followPath||!u.followPathId)continue;const d=Math.max(0,Number(u.followDuration)||0);d>a&&(a=d)}const c=this.timeline.totalFrames,l=Math.max(2,F1(a,s)+1);this.timeline.totalFrames=l;const h=kR({start:this.timeline.playbackStart,end:this.timeline.playbackEnd},c,l);return this.timeline.playbackStart=h.start,this.timeline.playbackEnd=h.end,this.timeline.frame>=l&&(this.timeline.frame=l-1),l}}}),L1="SpineParticle.SystemSettings",B1=1,hf="SpineParticle.SystemSettings.v1";function La(s,e,t,i){const n=Number(s);return Math.min(t,Math.max(e,Number.isFinite(n)?n:i))}function FR(s){return{parameterPanelOnRight:s.parameterPanelOnRight,undoLimit:s.undoLimit,showEmitter:s.showEmitter,showBones:s.showBones,bonePointDrawSize:s.bonePointDrawSize,boneAxisDrawSize:s.boneAxisDrawSize,showSkinMesh:s.showSkinMesh,tickEnabled:s.tickEnabled,axisFontSize:s.axisFontSize,tickWidth:s.tickWidth,showAxisLabels:s.showAxisLabels,axisColor:s.axisColor}}function OR(s,e){const t=n=>s[n]==null?!!e[n]:s[n]===!0,i=typeof s.axisColor=="string"&&/^#[0-9a-f]{6}$/i.test(s.axisColor)?s.axisColor:e.axisColor;return{parameterPanelOnRight:t("parameterPanelOnRight"),undoLimit:Math.round(La(s.undoLimit,1,200,e.undoLimit)),showEmitter:t("showEmitter"),showBones:t("showBones"),bonePointDrawSize:La(s.bonePointDrawSize,.1,10,e.bonePointDrawSize),boneAxisDrawSize:La(s.boneAxisDrawSize,.1,10,e.boneAxisDrawSize),showSkinMesh:t("showSkinMesh"),tickEnabled:t("tickEnabled"),axisFontSize:Math.round(La(s.axisFontSize,8,40,e.axisFontSize)),tickWidth:La(s.tickWidth,1,5,e.tickWidth),showAxisLabels:t("showAxisLabels"),axisColor:i}}function LR(s){let e;try{e=JSON.parse(s)}catch{throw new Error("系统设置缓存不是有效的 JSON")}const t=e;if(t.format!==L1)throw new Error("不是 Spine粒子编辑器系统设置缓存");if(t.version!==B1)throw new Error(`暂不支持系统配置版本:${t.version??"未知"}`);if(!t.settings||typeof t.settings!="object")throw new Error("系统设置缓存缺少 settings");return t}function BR(s,e){Object.assign(s.settings,OR(e,s.settings))}let bc=null;function NR(s){bc==null||bc();try{const e=localStorage.getItem(hf);e&&BR(s,LR(e).settings)}catch{try{localStorage.removeItem(hf)}catch{}}bc=ai(()=>FR(s.settings),e=>{const t={format:L1,version:B1,savedAt:new Date().toISOString(),settings:e};try{localStorage.setItem(hf,JSON.stringify(t))}catch{}},{deep:!0})}function DR(s,e=0){if(s<=0)return 1;const t=Math.pow(10,Math.floor(Math.log10(s))),i=[1,2,5,10,20,50,100];let n=1;for(const r of i)if(r*t>=s){n=r*t;break}return Math.max(n,e)}function UR(s,e,t,i,n){if(!t)return;const r=t;r.clear();const o=s.settings;if(!o.tickEnabled){for(const b of n)b.visible=!1;return}const a=0,c=0,l=e.screen.width/s.editor.viewScale,h=e.screen.height/s.editor.viewScale,u=+("0x"+o.axisColor.replace("#",""));r.lineStyle(1.5,u,.35),r.moveTo(-l,c),r.lineTo(l,c),r.moveTo(a,-h),r.lineTo(a,h);const d=s.editor.viewScale,f=DR(50/d),m=l,p=h,g=Math.max(1,o.tickWidth);if(o.tickEnabled){for(let b=0;b<=l;b+=f){const _=Math.round(b/f)*f;_!==0&&(r.lineStyle(g,u,.25),r.moveTo(_,c-4),r.lineTo(_,c+4),r.moveTo(-_,c-4),r.lineTo(-_,c+4))}for(let b=0;b<=h;b+=f)Math.round(b/f)*f!==0&&(r.lineStyle(g,u,.25),r.moveTo(a-4,b),r.lineTo(a+4,b),r.moveTo(a-4,-b),r.lineTo(a+4,-b))}const x=e.screen.width/2+s.editor.viewX,v=e.screen.height*.5+s.editor.viewY,y=o.axisFontSize,S=+("0x"+o.axisColor.replace("#",""));for(;n.length<64;){const b=new Tp("",{fontFamily:"monospace",fontSize:y,fill:S});b.anchor.set(.5,.5),i.addChild(b),n.push(b)}let C=0;const w=o.showAxisLabels&&o.tickEnabled;for(let b=0;b<=l;b+=f){const _=Math.round(b/f)*f;if(_===0||!w||_>m)continue;const A=n[C++];if(!A)break;A.style.fontSize=y,A.text=String(_),A.position.set(x+_*d,v+9),A.visible=!0;const P=n[C++];if(!P)break;P.style.fontSize=y,P.text=String(-_),P.position.set(x-_*d,v+9),P.visible=!0}for(let b=0;b<=h;b+=f){const _=Math.round(b/f)*f;if(_===0||!w||_>p)continue;const A=n[C++];if(!A)break;A.style.fontSize=y,A.text=String(_),A.position.set(x+8,v-b*d),A.visible=!0;const P=n[C++];if(!P)break;P.style.fontSize=y,P.text=String(-_),P.position.set(x+8,v+b*d),P.visible=!0}for(;C<n.length;){const b=n[C++];b&&(b.visible=!1)}}function $R(s,e,t){if(!t)return;const i=t;if(i.clear(),!!s.settings.showEmitter&&s.systems.length)for(const n of s.systems){if(n.visible===!1)continue;const r=e.get(n.id),o=(r==null?void 0:r.x)??n.config.centerX??0,a=-((r==null?void 0:r.y)??n.config.centerY??0),c=s.activeObjectType==="particle"&&n.id===s.activeId,l=c?16763955:9082040,h=c?.4:.2;i.lineStyle(1,l,h),i.drawCircle(o,a,10),i.beginFill(l,c?.8:.4),i.drawCircle(o,a,3),i.endFill(),i.lineStyle(1,l,c?.3:.15),i.moveTo(o-16,a),i.lineTo(o+16,a),i.moveTo(o,a-16),i.lineTo(o,a+16)}}function XR(s,e,t){if(!t)return;const i=t;i.clear();const n=s.systems.find(v=>v.id===s.activeId);if(!n||n.visible===!1)return;const r=n.config;if(!r.showShape)return;const o=e.get(n.id),a=(o==null?void 0:o.x)??r.centerX??0,c=-((o==null?void 0:o.y)??r.centerY??0),l=r.shape;if(l==="point"||l==="path")return;const h=r.rootScaleX??1,u=r.rootScaleY??1,d=-((o==null?void 0:o.rotation)??r.rootRotation??0)*Math.PI/180,f=Math.cos(d),m=Math.sin(d),p=r.offsetX??0,g=r.offsetY??0,x=(v,y)=>{const S=v+p,C=-y-g,w=S*h,b=C*u;return[a+w*f-b*m,c+(w*m+b*f)]};if(l==="circle"){const v=vh(r.innerRadius,r.outerRadius);i.lineStyle(2,3991658,.7);const y=48;for(const S of[v.outer,v.inner])if(!(S<=0))for(let C=0;C<=y;C++){const w=C/y*Math.PI*2,[b,_]=x(Math.cos(w)*S,Math.sin(w)*S);C===0?i.moveTo(b,_):i.lineTo(b,_)}}else if(l==="rect"){const v=_1(r);i.lineStyle(2,4885759,.7);for(const[y,S]of[[v.outerW,v.outerH],[v.innerW,v.innerH]]){if(y<=0||S<=0)continue;const C=y/2,w=S/2,b=x(-C,-w),_=x(C,-w),A=x(C,w),P=x(-C,w);i.moveTo(b[0],b[1]),i.lineTo(_[0],_[1]),i.lineTo(A[0],A[1]),i.lineTo(P[0],P[1]),i.lineTo(b[0],b[1])}}else if(l==="cone"){const v=vh(r.innerRadius,r.outerRadius),y=r.coneAngle/2*Math.PI/180,S=r.coneDirection*Math.PI/180,C=x(Math.cos(S-y)*v.inner,Math.sin(S-y)*v.inner),w=x(Math.cos(S+y)*v.inner,Math.sin(S+y)*v.inner),b=x(Math.cos(S-y)*v.outer,Math.sin(S-y)*v.outer),_=x(Math.cos(S+y)*v.outer,Math.sin(S+y)*v.outer);i.lineStyle(2,3991658,.7),i.moveTo(C[0],C[1]),i.lineTo(b[0],b[1]),i.moveTo(w[0],w[1]),i.lineTo(_[0],_[1]),i.lineStyle(1,3991658,.5);const A=24;for(const P of[v.outer,v.inner])if(!(P<=0))for(let E=0;E<=A;E++){const R=S-y+2*y*E/A,[O,U]=x(Math.cos(R)*P,Math.sin(R)*P);E===0?i.moveTo(O,U):i.lineTo(O,U)}}}function VR(s,e){if(!e)return;const t=e;t.clear();const i=s.systems.find(c=>c.id===s.activeId);if((i==null?void 0:i.visible)===!1)return;const n=i==null?void 0:i.config;if(!(n!=null&&n.forceField)||!n.showForceFieldShape||n.forceRadius<=0)return;const r=n.forceCenterX,o=-n.forceCenterY,a=n.forceStrength>=0?5818367:16739194;t.lineStyle(2,a,.85),t.beginFill(a,.08),t.drawCircle(r,o,n.forceRadius),t.endFill(),t.lineStyle(1,a,.7),t.moveTo(r-9,o),t.lineTo(r+9,o),t.moveTo(r,o-9),t.lineTo(r,o+9),t.beginFill(a,.95),t.drawCircle(r,o,4),t.endFill()}function YR(s,e){if(!e)return;const t=e;t.clear();const i=s.systems.find(u=>u.id===s.activeId);if((i==null?void 0:i.visible)===!1)return;const n=i==null?void 0:i.config;if(!(n!=null&&n.vortex)||!n.showVortexShape||n.vortexRadius<=0)return;const r=n.vortexCenterX,o=-n.vortexCenterY,a=n.vortexStrength>=0?12156159:16753228;t.lineStyle(2,a,.9),t.beginFill(a,.07),t.drawCircle(r,o,n.vortexRadius),t.endFill(),t.beginFill(a,.95),t.drawCircle(r,o,4),t.endFill();const c=r+Math.min(n.vortexRadius*.65,50),l=n.vortexStrength>=0?-1:1,h=o+l*14;t.lineStyle(2,a,.9),t.moveTo(c,o+l*-8),t.lineTo(c,h),t.moveTo(c,h),t.lineTo(c-4,h-l*5),t.moveTo(c,h),t.lineTo(c+4,h-l*5)}function GR(s,e){if(!e)return;const t=e;t.clear();const i=s.systems.find(l=>l.id===s.activeId);if((i==null?void 0:i.visible)===!1)return;const n=i==null?void 0:i.config;if(!(n!=null&&n.attraction)||!n.showAttractionShape)return;const r=n.attractionCenterX,o=-n.attractionCenterY,a=Math.max(0,n.attractionRadius),c=16731487;a>0&&(t.lineStyle(2,c,.95),t.beginFill(c,.09),t.drawCircle(r,o,a),t.endFill()),t.lineStyle(1,c,.85),t.moveTo(r-10,o),t.lineTo(r+10,o),t.moveTo(r,o-10),t.lineTo(r,o+10),t.beginFill(c,1),t.drawCircle(r,o,a>0?4:6),t.endFill()}function jR(s,e,t){const i=s.rotation*Math.PI/180,n=Math.cos(i),r=Math.sin(i),o=Math.max(1e-4,Math.abs(s.scaleX??1)),a=Math.max(1e-4,Math.abs(s.scaleY??1));return{x:s.x+n*e*o-r*t*a,y:s.y+r*e*o+n*t*a}}function Ro(s,e,t){const i=s.rotation*Math.PI/180,n=Math.cos(i),r=Math.sin(i),o=Math.max(1e-4,Math.abs(s.scaleX??1)),a=Math.max(1e-4,Math.abs(s.scaleY??1)),c=e-s.x,l=t-s.y;return{x:(n*c+r*l)/o,y:(-r*c+n*l)/a}}function N1(s,e,t="linear"){if(!s.length)return e;const i=[...s].sort((n,r)=>n.x-r.x);if(e<=i[0].x)return i[0].y;for(let n=1;n<i.length;n++){const r=i[n-1],o=i[n];if(e<=o.x){let a=(e-r.x)/Math.max(1e-4,o.x-r.x);if(t==="bezier"){const c=r.x+(r.outX??(o.x-r.x)/3),l=o.x+(o.inX??-(o.x-r.x)/3);let h=0,u=1;for(let d=0;d<18;d++){const f=(h+u)/2;Vv(r.x,c,l,o.x,f)<e?h=f:u=f}return a=(h+u)/2,Vv(r.y,r.y+(r.outY??(o.y-r.y)/3),o.y+(o.inY??-(o.y-r.y)/3),o.y,a)}return r.y+(o.y-r.y)*a}}return i[i.length-1].y}function Vv(s,e,t,i,n){const r=1-n;return r*r*r*s+3*r*r*n*e+3*r*n*n*t+n*n*n*i}function HR(s,e,t){var r;if(!t)return;const i=t;(r=i.parent)==null||r.addChild(i),i.clear();const n=new Map;for(const o of s.spines)o.visible===!1||!o.selectedBone||o.status!=="ready"||n.set(`${o.id}:${o.selectedBone}`,{spineId:o.id,boneName:o.selectedBone});for(const o of s.systems){if(o.visible===!1)continue;const a=o.config;if(!a.emitterFollow||a.emitterFollowMode!=="bone"||!a.emitterFollowSpineId||!a.emitterFollowBoneName)continue;const c=s.spines.find(l=>l.id===a.emitterFollowSpineId);!c||c.visible===!1||n.set(`${a.emitterFollowSpineId}:${a.emitterFollowBoneName}`,{spineId:a.emitterFollowSpineId,boneName:a.emitterFollowBoneName})}for(const o of n.values()){const a=e==null?void 0:e.getBoneWorldTransform(o.spineId,o.boneName);if(!a)continue;const c=a.x,l=-a.y;i.lineStyle(2,12881151,.95),i.beginFill(12881151,.2),i.drawCircle(c,l,8),i.endFill(),i.beginFill(15919103,1),i.drawCircle(c,l,3.5),i.endFill()}}function WR(s,e,t){if(!t)return;const i=t;if(i.clear(),!s.value)return;const n=e();if(!n)return;const r=n.x,o=-n.y,a=n.scaleX,c=n.scaleY,l=-n.rotation*Math.PI/180,h=Math.cos(l),u=Math.sin(l),d=(p,g)=>{const x=p*a,v=-g*c;return[r+x*h-v*u,o+(x*u+v*h)]},f=(p,g,x,v)=>{const y=d(p,g),S=d(x,v);i.moveTo(y[0],y[1]),i.lineTo(S[0],S[1])},m=26;if(i.lineStyle(2,3526911,.9),i.beginFill(3526911,.25),i.drawCircle(r,o,6),i.endFill(),s.value==="translate")i.lineStyle(2,3526911,.9),f(-m,0,m,0),f(0,-m,0,m),f(m-6,-4,m,0),f(m,0,m-6,4),f(-20,-4,-m,0),f(-m,0,-20,4),f(-4,m-6,0,m),f(0,m,4,m-6),f(-4,-20,0,-m),f(0,-m,4,-20);else if(s.value==="rotate"){i.lineStyle(2,3526911,.8);const p=48;for(let v=0;v<=p;v++){const y=v/p*Math.PI*2,[S,C]=d(Math.cos(y)*m,Math.sin(y)*m);v===0?i.moveTo(S,C):i.lineTo(S,C)}const[g,x]=d(0,m);i.beginFill(3526911,.95),i.drawCircle(g,x,4),i.endFill()}else if(s.value==="scale"){i.lineStyle(2,3526911,.9);const g=[[-m,-m],[m,-m],[m,m],[-m,m]].map(([x,v])=>d(x,v));i.moveTo(g[0][0],g[0][1]),i.lineTo(g[1][0],g[1][1]),i.lineTo(g[2][0],g[2][1]),i.lineTo(g[3][0],g[3][1]),i.lineTo(g[0][0],g[0][1]),i.beginFill(3526911,.9);for(const x of g)i.drawRect(x[0]-3,x[1]-3,6,6);i.endFill()}}function zR(s,e=16777215){const t=Number.parseInt(s.replace("#",""),16);return Number.isFinite(t)?t:e}function qR(s,e,t){if(!t)return;const i=t;i.clear();for(const n of e){if(n.visible===!1)continue;const r=s.activeObjectType==="collision"&&s.activeObjectId===n.id,o=n.enabled?r?16735858:13911899:5792116,a=n.rotation*Math.PI/180,c=Math.cos(a),l=Math.sin(a),h=Math.max(1e-4,Math.abs(n.scaleX??1)),u=Math.max(1e-4,Math.abs(n.scaleY??1)),d=(p,g)=>({x:n.x+c*p*h-l*g*u,y:-(n.y+l*p*h+c*g*u)});let f=[];if(n.shape==="circle"||n.shape==="ellipse"){const p=n.shape==="circle"?n.radius:n.radiusX,g=n.shape==="circle"?n.radius:n.radiusY;f=Array.from({length:49},(x,v)=>{const y=v/48*Math.PI*2;return d(Math.cos(y)*p,Math.sin(y)*g)})}else if(n.shape==="rect"){const p=n.width*.5,g=n.height*.5;f=[d(-p,-g),d(p,-g),d(p,g),d(-p,g),d(-p,-g)]}else{const p=Math.max(3,Math.min(16,Math.round(n.sides)));f=Array.from({length:p+1},(g,x)=>{const v=Math.PI*.5+x%p/p*Math.PI*2;return d(Math.cos(v)*n.width*.5,Math.sin(v)*n.height*.5)})}if(!f.length)continue;i.lineStyle(r?2.5:1.5,o,n.enabled?.95:.45),i.beginFill(o,r?.12:.055),i.moveTo(f[0].x,f[0].y);for(let p=1;p<f.length;p++)i.lineTo(f[p].x,f[p].y);i.endFill();const m=d(0,0);i.lineStyle(1,o,.8),i.moveTo(m.x-7,m.y),i.lineTo(m.x+7,m.y),i.moveTo(m.x,m.y-7),i.lineTo(m.x,m.y+7)}}function KR(s,e,t){if(!t)return;const i=t;i.clear();const n=s.activeObjectType==="particle"?s.systems.find(o=>o.id===s.activeObjectId):null,r=(n==null?void 0:n.config.shape)==="path"&&!n.config.showShape?n.config.spawnPathId:0;for(const o of s.paths){if(o.id===r||o.visible===!1||!o.enabled||!o.points.length)continue;const a=s.activeObjectType==="path"&&s.activeObjectId===o.id,c=zR(o.color,16749374),l=(f,m)=>{const p=jR(o,f,m);return{x:p.x,y:-p.y}},h=o.points[0],u=l(h.x,h.y);i.lineStyle(a?2.5:1.8,c,a?1:.75),i.moveTo(u.x,u.y);const d=o.closed?o.points.length:o.points.length-1;for(let f=0;f<d;f++){const m=o.points[f],p=o.points[(f+1)%o.points.length],g=l(m.x+m.outX,m.y+m.outY),x=l(p.x+p.inX,p.y+p.inY),v=l(p.x,p.y);i.bezierCurveTo(g.x,g.y,x.x,x.y,v.x,v.y)}a&&o.points.forEach((f,m)=>{const p=l(f.x,f.y),g=l(f.x+f.inX,f.y+f.inY),x=l(f.x+f.outX,f.y+f.outY),v=Math.hypot(f.inX,f.inY)>.01,y=Math.hypot(f.outX,f.outY)>.01;i.lineStyle(1,11121867,.65),v&&(i.moveTo(p.x,p.y),i.lineTo(g.x,g.y)),y&&(i.moveTo(p.x,p.y),i.lineTo(x.x,x.y)),v&&(i.beginFill(14015724,.95),i.drawCircle(g.x,g.y,3),i.endFill()),y&&(i.beginFill(14015724,.95),i.drawCircle(x.x,x.y,3),i.endFill()),i.beginFill(e.has(m)?16777215:c,1),i.lineStyle(1.5,e.has(m)?6126847:16777215,.95),i.drawCircle(p.x,p.y,e.has(m)?5:4),i.endFill()})}}function ZR(s,e,t,i){var o;const n=Number.isFinite(e.worldX)&&Number.isFinite(e.worldY),r=Number.isFinite(e.worldRotation);s.push({boneName:e.boneName,x:n?e.worldX:e.x,y:n?-e.worldY:e.y,rotation:r?-e.worldRotation:-e.rotation,parentX:t,parentY:i}),(o=e.trailState)!=null&&o.bones.length&&e.trailState.bones.forEach(a=>{const c=Number.isFinite(a.worldX)&&Number.isFinite(a.worldY),l=Number.isFinite(a.worldRotation);s.push({boneName:a.boneName,x:c?a.worldX:a.x,y:c?-a.worldY:a.y,rotation:l?-a.worldRotation:a.rotation,parentX:t,parentY:i,trail:!0})})}function Yv(s,e,t,i,n,r,o,a){const c=r*.62,l=e+i*r,h=t+n*r,u=Math.max(2.5,r*.32),d=Math.max(1.7,r*.22),f=l-i*u,m=h-n*u,p=-n,g=i;s.lineStyle(o,a,.95),s.moveTo(e-i*c,t-n*c),s.lineTo(f,m),s.lineStyle(0),s.beginFill(a,.95),s.drawPolygon([l,h,f+p*d,m+g*d,f-p*d,m-g*d]),s.endFill()}function JR(s,e,t){if(!t)return;const i=t;if(i.clear(),!e.settings.showBones)return;const n=0,r=0,o=Math.max(.25,Math.abs(e.editor.viewScale)||1),a=Math.min(10,Math.max(.1,Number(e.settings.bonePointDrawSize)||1)),c=Math.min(10,Math.max(.1,Number(e.settings.boneAxisDrawSize)||2)),l=2.5*a/o,h=4.5*c/o,u=Math.max(.65,c*.625)/o;for(const d of s){const f=d.trail?16731533:16747610;i.lineStyle(1,f,d.trail?.65:.35),i.moveTo(d.parentX??n,d.parentY??r),i.lineTo(d.x,d.y);const m=d.rotation*Math.PI/180,p=Math.cos(m),g=Math.sin(m);Yv(i,d.x,d.y,p,g,h,u,15684432),Yv(i,d.x,d.y,g,-p,h,u,5622123),i.beginFill(f,.9),i.drawCircle(d.x,d.y,l),i.endFill()}}function Ii(s){return s.map(e=>({...e,trailState:e.trailState?{...e.trailState,bones:e.trailState.bones.map(t=>({...t}))}:void 0}))}function QR(s){const e=new Map;for(const i of s)for(const n of i)e.has(n.boneName)||e.set(n.boneName,Ii([n])[0]);const t=[...e.keys()].sort((i,n)=>{const r=Number(i.replace(/^p_/,"")),o=Number(n.replace(/^p_/,""));return Number.isFinite(r)&&Number.isFinite(o)?r-o:i.localeCompare(n)});for(let i=0;i<s.length;i++){const n=new Map(s[i].map(r=>[r.boneName,r]));s[i]=t.map(r=>{const o=n.get(r);return o||{...Ii([e.get(r)])[0],alpha:0,imageVisible:!1,trailState:void 0,active:!0}})}}function eP(s){s.length<2||(s[s.length-1]=Ii(s[0]))}function tP(s,e){const t=Math.max(0,s.length-1),i=[];for(let n=0;n<=e;n++){const r=Math.min(t,Math.round(n/e*t));i.push(Ii(s[r]||[]))}return i}function uf(s){return`${s.boneName}:${s.spawnId??"legacy"}`}function Gv(s){return{...Ii([s])[0],alpha:0,imageVisible:!1,trailState:void 0,active:!0}}function iP(s,e,t,i){const n=Math.min(s.length,i+1),r=s.slice(Math.max(0,s.length-n)),o=new Map;for(const l of e){if(l.imageVisible===!1||l.alpha<=0)continue;const h=uf(l),u=new Map;let d=!1;for(let f=r.length-1;f>=0;f--){const m=r[f].find(p=>uf(p)===h);if(m)d=!0,u.set(f,m);else if(d)break}o.set(h,u)}const a=Math.max(0,r.length-1),c=[];for(let l=0;l<=t;l++){const h=Math.min(a,Math.round(l/t*a));c.push(e.map(u=>{var f;if(u.imageVisible===!1||u.alpha<=0)return Ii([u])[0];const d=(f=o.get(uf(u)))==null?void 0:f.get(h);return d?Ii([d])[0]:Gv(u)}))}return c[0]=c[0].map(Gv),c[c.length-1]=Ii(e),c}function jv(s,e){const t=s.length?1:0;for(let i=t;i<e.length;i++)s.push(Ii(e[i]))}function Hv(s,e,t,i){var x;const n=s.config,r=1/Math.max(1,t),o=n.lifeMode==="fixed"?Math.max(0,Number(n.lifeMin)||0):Math.max(0,Number(n.lifeMin)||0,Number(n.lifeMax)||0),a=Ps(n,t),c=Math.max(1,Math.ceil(o*t)),l=Math.max(1,Math.ceil(c/a.loop)),h=Math.max(0,Math.ceil(Math.max(0,Number(n.delay)||0)*t)),u=[],d=v=>{const y=v?[[]]:[];e.reset();for(let S=0;S<l;S++){S>0&&e.restartEmissionCycle();for(let C=0;C<a.loop;C++)e.update(r,"force"),v&&y.push(e.capture())}return{seam:e.capture(),warmup:y}},f=d(n.generateLoopStartAnimation),m=Ii(f.seam),p=[Ii(m)];e.restartEmissionCycle();for(let v=0;v<a.loop;v++)e.update(r,"force"),p.push(e.capture());QR(p),eP(p);for(let v=0;v<h;v++)u.push([]);if(n.generateLoopStartAnimation){const v=iP(f.warmup,p[0],a.start,c);for(const y of v)u.push(Ii(y))}else u.push(Ii(p[0]));if(jv(u,p),n.generateLoopEndAnimation){d(!1);const v=[Ii(p[0])],y=Math.max(1,c+2);for(let S=0;S<y&&e.activeCount>0;S++)e.update(r,"off"),v.push(e.capture());(x=v[v.length-1])!=null&&x.length&&v.push([]),jv(u,tP(v,a.end))}const g=Ii(u[u.length-1]||[]);for(u.length>i&&(u.length=i);u.length<i;)u.push(Ii(g));s.frames=u,e.apply(u[0]||[])}class sP{constructor(){M(this,"container",new gi);M(this,"entries",new Map)}getSpine(e){var t;return((t=this.entries.get(e))==null?void 0:t.spine)||null}getDrawOrder(e){var i,n;const t=(i=this.entries.get(e))==null?void 0:i.spine;try{const r=(n=t==null?void 0:t.skeleton)==null?void 0:n.drawOrder;return Array.isArray(r)?r.map(o=>{var a;return String(((a=o==null?void 0:o.data)==null?void 0:a.name)||"")}):null}catch{return null}}getSlotLocalMatrix(e,t){var o,a,c;const i=(o=this.entries.get(e))==null?void 0:o.spine,n=(c=(a=i==null?void 0:i.skeleton)==null?void 0:a.findSlot)==null?void 0:c.call(a,t),r=n==null?void 0:n.bone;return r!=null&&r.active?new Ft(r.a,r.c,-r.b,-r.d,r.worldX,r.worldY):null}getSlotParentMatrix(e,t,i){const n=this.getSlotLocalMatrix(e,t);if(!n)return null;const r=-i.rotation*Math.PI/180,o=Math.cos(r),a=Math.sin(r);return new Ft(o*i.scaleX,a*i.scaleX,-a*i.scaleY,o*i.scaleY,i.x,-i.y).append(n)}attachSlotObject(e,t,i,n){var o;const r=(o=this.entries.get(e))==null?void 0:o.spine;if(!(r!=null&&r.addSlotObject))return!1;try{return r.addSlotObject(t,i,{followAttachmentTimeline:n}),!0}catch{return!1}}detachSlotObject(e,t,i){var r,o;const n=(r=this.entries.get(e))==null?void 0:r.spine;try{(o=n==null?void 0:n.removeSlotObject)==null||o.call(n,t,i)}catch{}}destroyEntry(e){var t,i;try{(i=(t=e.spine)==null?void 0:t.removeSlotObjects)==null||i.call(t)}catch{}this.container.removeChild(e.root),e.root.destroy({children:!0})}sync(e,t,i){var n;for(const[r,o]of this.entries)e.some(a=>a.id===r)||(this.destroyEntry(o),this.entries.delete(r));for(const r of e){const o=ER(r.id);let a=this.entries.get(r.id);if(a&&a.assetVersion!==r.assetVersion&&!o&&(this.destroyEntry(a),this.entries.delete(r.id),a=void 0),(!a||a.assetVersion!==r.assetVersion)&&o){a&&this.destroyEntry(a);const d=new gi,f=new o.SpineClass({skeletonData:o.skeletonData,autoUpdate:!1,darkTint:!1});o.skeletonData.defaultSkin&&f.skeleton.setSkin(o.skeletonData.defaultSkin),o.runtimeVersion==="4.3"?f.skeleton.setupPoseSlots():f.skeleton.setSlotsToSetupPose(),d.addChild(f),this.container.addChild(d),a={root:d,spine:f,runtimeVersion:o.runtimeVersion,assetVersion:r.assetVersion,animation:""},this.entries.set(r.id,a)}if(!a)continue;const c=a.root,l=a.spine,h=r.visible!==!1&&r.enabled;c.visible=h,c.renderable=h,c.position.set(r.x,-r.y),c.rotation=-r.rotation*Math.PI/180,c.scale.set(r.scaleX,r.scaleY),a.animation!==r.selectedAnimation&&(a.animation=r.selectedAnimation,a.runtimeVersion==="4.3"?l.skeleton.setupPose():l.skeleton.setToSetupPose(),l.state.clearTracks(),a.animation&&l.state.setAnimation(0,a.animation,!1));const u=a.runtimeVersion==="4.3"?l.state.getTrack(0):l.state.getCurrent(0);if(u){const d=((n=r.animations.find(m=>m.name===r.selectedAnimation))==null?void 0:n.duration)||0,f=Math.max(0,t/Math.max(1,i)-r.timeOffset);u.trackTime=d>0?Math.min(f,d):f}l.update(0)}}getBoneWorldTransform(e,t){const i=this.entries.get(e),n=i==null?void 0:i.spine.skeleton.findBone(t);if(!i||!n||!n.active)return null;const r=i.runtimeVersion==="4.3"?n.appliedPose:n,o=i.root,a=Math.cos(o.rotation),c=Math.sin(o.rotation),l=a*o.scale.x,h=-c*o.scale.y,u=c*o.scale.x,d=a*o.scale.y,f=l*r.a+h*r.c,m=l*r.b+h*r.d,p=u*r.a+d*r.c,g=u*r.b+d*r.d,x=o.position.x+l*r.worldX+h*r.worldY,v=o.position.y+u*r.worldX+d*r.worldY;return{x,y:-v,rotation:-Math.atan2(p,f)*180/Math.PI,scaleX:Math.max(1e-4,Math.hypot(f,p)),scaleY:Math.max(1e-4,Math.hypot(m,g))}}destroy(){for(const e of this.entries.values())this.destroyEntry(e);this.entries.clear(),this.container.removeFromParent(),this.container.destroy({children:!0})}}let D1=class{constructor(){M(this,"entries",{});M(this,"size",0)}add(e){let t=this.entries[e];return this.entries[e]=!0,t?!1:(this.size++,!0)}addAll(e){let t=this.size;for(var i=0,n=e.length;i<n;i++)this.add(e[i]);return t!=this.size}contains(e){return this.entries[e]}clear(){this.entries={},this.size=0}};var Ai;let lt=(Ai=class{constructor(e=0,t=0,i=0,n=0){M(this,"r");M(this,"g");M(this,"b");M(this,"a");this.r=e,this.g=t,this.b=i,this.a=n}set(e,t,i,n){return this.r=e,this.g=t,this.b=i,this.a=n,this.clamp()}setFromColor(e){return this.r=e.r,this.g=e.g,this.b=e.b,this.a=e.a,this}setFromString(e){return e=e.charAt(0)=="#"?e.substr(1):e,this.r=parseInt(e.substr(0,2),16)/255,this.g=parseInt(e.substr(2,2),16)/255,this.b=parseInt(e.substr(4,2),16)/255,this.a=e.length!=8?1:parseInt(e.substr(6,2),16)/255,this}add(e,t,i,n){return this.r+=e,this.g+=t,this.b+=i,this.a+=n,this.clamp()}clamp(){return this.r<0?this.r=0:this.r>1&&(this.r=1),this.g<0?this.g=0:this.g>1&&(this.g=1),this.b<0?this.b=0:this.b>1&&(this.b=1),this.a<0?this.a=0:this.a>1&&(this.a=1),this}static rgba8888ToColor(e,t){e.r=((t&4278190080)>>>24)/255,e.g=((t&16711680)>>>16)/255,e.b=((t&65280)>>>8)/255,e.a=(t&255)/255}static rgb888ToColor(e,t){e.r=((t&16711680)>>>16)/255,e.g=((t&65280)>>>8)/255,e.b=(t&255)/255}toRgb888(){const e=t=>("0"+(t*255).toString(16)).slice(-2);return+("0x"+e(this.r)+e(this.g)+e(this.b))}static fromString(e,t=new Ai){return t.setFromString(e)}},M(Ai,"WHITE",new Ai(1,1,1,1)),M(Ai,"RED",new Ai(1,0,0,1)),M(Ai,"GREEN",new Ai(0,1,0,1)),M(Ai,"BLUE",new Ai(0,0,1,1)),M(Ai,"MAGENTA",new Ai(1,0,1,1)),Ai);var ii;let Re=(ii=class{static clamp(e,t,i){return e<t?t:e>i?i:e}static cosDeg(e){return Math.cos(e*ii.degRad)}static sinDeg(e){return Math.sin(e*ii.degRad)}static atan2Deg(e,t){return Math.atan2(e,t)*ii.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 ii.randomTriangularWith(e,t,(e+t)*.5)}static randomTriangularWith(e,t,i){let n=Math.random(),r=t-e;return n<=(i-e)/r?e+Math.sqrt(n*r*(i-e)):t-Math.sqrt((1-n)*r*(t-i))}static isPowerOfTwo(e){return e&&(e&e-1)===0}},M(ii,"PI",3.1415927),M(ii,"PI2",ii.PI*2),M(ii,"invPI2",1/ii.PI2),M(ii,"radiansToDegrees",180/ii.PI),M(ii,"radDeg",ii.radiansToDegrees),M(ii,"degreesToRadians",ii.PI/180),M(ii,"degRad",ii.degreesToRadians),ii);var Is;let Pe=(Is=class{static arrayCopy(e,t,i,n,r){for(let o=t,a=n;o<t+r;o++,a++)i[a]=e[o]}static arrayFill(e,t,i,n){for(let r=t;r<i;r++)e[r]=n}static setArraySize(e,t,i=0){let n=e.length;if(n==t)return e;if(e.length=t,n<t)for(let r=n;r<t;r++)e[r]=i;return e}static ensureArrayCapacity(e,t,i=0){return e.length>=t?e:Is.setArraySize(e,t,i)}static newArray(e,t){let i=new Array(e);for(let n=0;n<e;n++)i[n]=t;return i}static newFloatArray(e){if(Is.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(Is.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 Is.SUPPORTS_TYPED_ARRAYS?new Float32Array(e):e}static toSinglePrecision(e){return Is.SUPPORTS_TYPED_ARRAYS?Math.fround(e):e}static webkit602BugfixHelper(e,t){}static contains(e,t,i=!0){for(var n=0;n<e.length;n++)if(e[n]==t)return!0;return!1}static enumValue(e,t){return e[t[0].toUpperCase()+t.slice(1)]}},M(Is,"SUPPORTS_TYPED_ARRAYS",typeof Float32Array<"u"),Is),xh=class{constructor(e){M(this,"items",new Array);M(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}},bh=class{constructor(e=0,t=0){M(this,"x");M(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}},U1=class{constructor(e){M(this,"name");if(!e)throw new Error("name cannot be null.");this.name=e}};var Qr;let zn=(Qr=class extends U1{constructor(t){super(t);M(this,"id",Qr.nextID++);M(this,"bones",null);M(this,"vertices",[]);M(this,"worldVerticesLength",0);M(this,"timelineAttachment",this)}computeWorldVertices(t,i,n,r,o,a){n=o+(n>>1)*a;let c=t.bone.skeleton,l=t.deform,h=this.vertices,u=this.bones;if(!u){l.length>0&&(h=l);let p=t.bone,g=p.worldX,x=p.worldY,v=p.a,y=p.b,S=p.c,C=p.d;for(let w=i,b=o;b<n;w+=2,b+=a){let _=h[w],A=h[w+1];r[b]=_*v+A*y+g,r[b+1]=_*S+A*C+x}return}let d=0,f=0;for(let p=0;p<i;p+=2){let g=u[d];d+=g+1,f+=g}let m=c.bones;if(l.length==0)for(let p=o,g=f*3;p<n;p+=a){let x=0,v=0,y=u[d++];for(y+=d;d<y;d++,g+=3){let S=m[u[d]],C=h[g],w=h[g+1],b=h[g+2];x+=(C*S.a+w*S.b+S.worldX)*b,v+=(C*S.c+w*S.d+S.worldY)*b}r[p]=x,r[p+1]=v}else{let p=l;for(let g=o,x=f*3,v=f<<1;g<n;g+=a){let y=0,S=0,C=u[d++];for(C+=d;d<C;d++,x+=3,v+=2){let w=m[u[d]],b=h[x]+p[v],_=h[x+1]+p[v+1],A=h[x+2];y+=(b*w.a+_*w.b+w.worldX)*A,S+=(b*w.c+_*w.d+w.worldY)*A}r[g]=y,r[g+1]=S}}}copyTo(t){this.bones?(t.bones=new Array(this.bones.length),Pe.arrayCopy(this.bones,0,t.bones,0,this.bones.length)):t.bones=null,this.vertices&&(t.vertices=Pe.newFloatArray(this.vertices.length),Pe.arrayCopy(this.vertices,0,t.vertices,0,this.vertices.length)),t.worldVerticesLength=this.worldVerticesLength,t.timelineAttachment=this.timelineAttachment}},M(Qr,"nextID",0),Qr);var Nn;let $1=(Nn=class{constructor(e){M(this,"id",Nn.nextID());M(this,"regions");M(this,"start",0);M(this,"digits",0);M(this,"setupIndex",0);this.regions=new Array(e)}copy(){let e=new Nn(this.regions.length);return Pe.arrayCopy(this.regions,0,e.regions,0,this.regions.length),e.start=this.start,e.digits=this.digits,e.setupIndex=this.setupIndex,e}apply(e,t){let i=e.sequenceIndex;i==-1&&(i=this.setupIndex),i>=this.regions.length&&(i=this.regions.length-1);let n=this.regions[i];t.region!=n&&(t.region=n,t.updateRegion())}getPath(e,t){let i=e,n=(this.start+t).toString();for(let r=this.digits-n.length;r>0;r--)i+="0";return i+=n,i}static nextID(){return Nn._nextID++}},M(Nn,"_nextID",0),Nn);var Ti;(function(s){s[s.hold=0]="hold",s[s.once=1]="once",s[s.loop=2]="loop",s[s.pingpong=3]="pingpong",s[s.onceReverse=4]="onceReverse",s[s.loopReverse=5]="loopReverse",s[s.pingpongReverse=6]="pingpongReverse"})(Ti||(Ti={}));const X1=[Ti.hold,Ti.once,Ti.loop,Ti.pingpong,Ti.onceReverse,Ti.loopReverse,Ti.pingpongReverse];let Cp=class{constructor(e,t,i){M(this,"name");M(this,"timelines",[]);M(this,"timelineIds",new D1);M(this,"duration");if(!e)throw new Error("name cannot be null.");this.name=e,this.setTimelines(t),this.duration=i}setTimelines(e){if(!e)throw new Error("timelines cannot be null.");this.timelines=e,this.timelineIds.clear();for(var t=0;t<e.length;t++)this.timelineIds.addAll(e[t].getPropertyIds())}hasTimeline(e){for(let t=0;t<e.length;t++)if(this.timelineIds.contains(e[t]))return!0;return!1}apply(e,t,i,n,r,o,a,c){if(!e)throw new Error("skeleton cannot be null.");n&&this.duration!=0&&(i%=this.duration,t>0&&(t%=this.duration));let l=this.timelines;for(let h=0,u=l.length;h<u;h++)l[h].apply(e,t,i,r,o,a,c)}};var ye;(function(s){s[s.setup=0]="setup",s[s.first=1]="first",s[s.replace=2]="replace",s[s.add=3]="add"})(ye||(ye={}));var ki;(function(s){s[s.mixIn=0]="mixIn",s[s.mixOut=1]="mixOut"})(ki||(ki={}));const ht={rotate:0,x:1,y:2,scaleX:3,scaleY:4,shearX:5,shearY:6,inherit:7,rgb:8,alpha:9,rgb2:10,attachment:11,deform:12,event:13,drawOrder:14,ikConstraint:15,transformConstraint:16,pathConstraintPosition:17,pathConstraintSpacing:18,pathConstraintMix:19,physicsConstraintInertia:20,physicsConstraintStrength:21,physicsConstraintDamping:22,physicsConstraintMass:23,physicsConstraintWind:24,physicsConstraintGravity:25,physicsConstraintMix:26,physicsConstraintReset:27,sequence:28};let Yt=class{constructor(e,t){M(this,"propertyIds");M(this,"frames");this.propertyIds=t,this.frames=Pe.newFloatArray(e*this.getFrameEntries())}getPropertyIds(){return this.propertyIds}getFrameEntries(){return 1}getFrameCount(){return this.frames.length/this.getFrameEntries()}getDuration(){return this.frames[this.frames.length-this.getFrameEntries()]}static search1(e,t){let i=e.length;for(let n=1;n<i;n++)if(e[n]>t)return n-1;return i-1}static search(e,t,i){let n=e.length;for(let r=i;r<n;r+=i)if(e[r]>t)return r-i;return n-i}},pn=class extends Yt{constructor(t,i,n){super(t,n);M(this,"curves");this.curves=Pe.newFloatArray(t+i*18),this.curves[t-1]=1}setLinear(t){this.curves[t]=0}setStepped(t){this.curves[t]=1}shrink(t){let i=this.getFrameCount()+t*18;if(this.curves.length>i){let n=Pe.newFloatArray(i);Pe.arrayCopy(this.curves,0,n,0,i),this.curves=n}}setBezier(t,i,n,r,o,a,c,l,h,u,d){let f=this.curves,m=this.getFrameCount()+t*18;n==0&&(f[i]=2+m);let p=(r-a*2+l)*.03,g=(o-c*2+h)*.03,x=((a-l)*3-r+u)*.006,v=((c-h)*3-o+d)*.006,y=p*2+x,S=g*2+v,C=(a-r)*.3+p+x*.16666667,w=(c-o)*.3+g+v*.16666667,b=r+C,_=o+w;for(let A=m+18;m<A;m+=2)f[m]=b,f[m+1]=_,C+=y,w+=S,y+=x,S+=v,b+=C,_+=w}getBezierValue(t,i,n,r){let o=this.curves;if(o[r]>t){let h=this.frames[i],u=this.frames[i+n];return u+(t-h)/(o[r]-h)*(o[r+1]-u)}let a=r+18;for(r+=2;r<a;r+=2)if(o[r]>=t){let h=o[r-2],u=o[r-1];return u+(t-h)/(o[r]-h)*(o[r+1]-u)}i+=this.getFrameEntries();let c=o[a-2],l=o[a-1];return l+(t-c)/(this.frames[i]-c)*(this.frames[i+n]-l)}},Us=class extends pn{constructor(e,t,i){super(e,t,[i])}getFrameEntries(){return 2}setFrame(e,t,i){e<<=1,this.frames[e]=t,this.frames[e+1]=i}getCurveValue(e){let t=this.frames,i=t.length-2;for(let r=2;r<=i;r+=2)if(t[r]>e){i=r-2;break}let n=this.curves[i>>1];switch(n){case 0:let r=t[i],o=t[i+1];return o+(e-r)/(t[i+2]-r)*(t[i+2+1]-o);case 1:return t[i+1]}return this.getBezierValue(e,i,1,n-2)}getRelativeValue(e,t,i,n,r){if(e<this.frames[0]){switch(i){case ye.setup:return r;case ye.first:return n+(r-n)*t}return n}let o=this.getCurveValue(e);switch(i){case ye.setup:return r+o*t;case ye.first:case ye.replace:o+=r-n}return n+o*t}getAbsoluteValue(e,t,i,n,r){if(e<this.frames[0]){switch(i){case ye.setup:return r;case ye.first:return n+(r-n)*t}return n}let o=this.getCurveValue(e);return i==ye.setup?r+(o-r)*t:n+(o-n)*t}getAbsoluteValue2(e,t,i,n,r,o){if(e<this.frames[0]){switch(i){case ye.setup:return r;case ye.first:return n+(r-n)*t}return n}return i==ye.setup?r+(o-r)*t:n+(o-n)*t}getScaleValue(e,t,i,n,r,o){const a=this.frames;if(e<a[0]){switch(i){case ye.setup:return o;case ye.first:return r+(o-r)*t}return r}let c=this.getCurveValue(e)*o;if(t==1)return i==ye.add?r+c-o:c;if(n==ki.mixOut)switch(i){case ye.setup:return o+(Math.abs(c)*Re.signum(o)-o)*t;case ye.first:case ye.replace:return r+(Math.abs(c)*Re.signum(r)-r)*t}else{let l=0;switch(i){case ye.setup:return l=Math.abs(o)*Re.signum(c),l+(c-l)*t;case ye.first:case ye.replace:return l=Math.abs(r)*Re.signum(c),l+(c-l)*t}}return r+(c-o)*t}};class Ep extends pn{constructor(e,t,i,n){super(e,t,[i,n])}getFrameEntries(){return 3}setFrame(e,t,i,n){e*=3,this.frames[e]=t,this.frames[e+1]=i,this.frames[e+2]=n}}let wh=class extends Us{constructor(t,i,n){super(t,i,ht.rotate+"|"+n);M(this,"boneIndex",0);this.boneIndex=n}apply(t,i,n,r,o,a,c){let l=t.bones[this.boneIndex];l.active&&(l.rotation=this.getRelativeValue(n,o,a,l.rotation,l.data.rotation))}},V1=class extends Ep{constructor(t,i,n){super(t,i,ht.x+"|"+n,ht.y+"|"+n);M(this,"boneIndex",0);this.boneIndex=n}apply(t,i,n,r,o,a,c){let l=t.bones[this.boneIndex];if(!l.active)return;let h=this.frames;if(n<h[0]){switch(a){case ye.setup:l.x=l.data.x,l.y=l.data.y;return;case ye.first:l.x+=(l.data.x-l.x)*o,l.y+=(l.data.y-l.y)*o}return}let u=0,d=0,f=Yt.search(h,n,3),m=this.curves[f/3];switch(m){case 0:let p=h[f];u=h[f+1],d=h[f+2];let g=(n-p)/(h[f+3]-p);u+=(h[f+3+1]-u)*g,d+=(h[f+3+2]-d)*g;break;case 1:u=h[f+1],d=h[f+2];break;default:u=this.getBezierValue(n,f,1,m-2),d=this.getBezierValue(n,f,2,m+18-2)}switch(a){case ye.setup:l.x=l.data.x+u*o,l.y=l.data.y+d*o;break;case ye.first:case ye.replace:l.x+=(l.data.x+u-l.x)*o,l.y+=(l.data.y+d-l.y)*o;break;case ye.add:l.x+=u*o,l.y+=d*o}}},Y1=class extends Us{constructor(t,i,n){super(t,i,ht.x+"|"+n);M(this,"boneIndex",0);this.boneIndex=n}apply(t,i,n,r,o,a,c){let l=t.bones[this.boneIndex];l.active&&(l.x=this.getRelativeValue(n,o,a,l.x,l.data.x))}},G1=class extends Us{constructor(t,i,n){super(t,i,ht.y+"|"+n);M(this,"boneIndex",0);this.boneIndex=n}apply(t,i,n,r,o,a,c){let l=t.bones[this.boneIndex];l.active&&(l.y=this.getRelativeValue(n,o,a,l.y,l.data.y))}},j1=class extends Ep{constructor(t,i,n){super(t,i,ht.scaleX+"|"+n,ht.scaleY+"|"+n);M(this,"boneIndex",0);this.boneIndex=n}apply(t,i,n,r,o,a,c){let l=t.bones[this.boneIndex];if(!l.active)return;let h=this.frames;if(n<h[0]){switch(a){case ye.setup:l.scaleX=l.data.scaleX,l.scaleY=l.data.scaleY;return;case ye.first:l.scaleX+=(l.data.scaleX-l.scaleX)*o,l.scaleY+=(l.data.scaleY-l.scaleY)*o}return}let u,d,f=Yt.search(h,n,3),m=this.curves[f/3];switch(m){case 0:let p=h[f];u=h[f+1],d=h[f+2];let g=(n-p)/(h[f+3]-p);u+=(h[f+3+1]-u)*g,d+=(h[f+3+2]-d)*g;break;case 1:u=h[f+1],d=h[f+2];break;default:u=this.getBezierValue(n,f,1,m-2),d=this.getBezierValue(n,f,2,m+18-2)}if(u*=l.data.scaleX,d*=l.data.scaleY,o==1)a==ye.add?(l.scaleX+=u-l.data.scaleX,l.scaleY+=d-l.data.scaleY):(l.scaleX=u,l.scaleY=d);else{let p=0,g=0;if(c==ki.mixOut)switch(a){case ye.setup:p=l.data.scaleX,g=l.data.scaleY,l.scaleX=p+(Math.abs(u)*Re.signum(p)-p)*o,l.scaleY=g+(Math.abs(d)*Re.signum(g)-g)*o;break;case ye.first:case ye.replace:p=l.scaleX,g=l.scaleY,l.scaleX=p+(Math.abs(u)*Re.signum(p)-p)*o,l.scaleY=g+(Math.abs(d)*Re.signum(g)-g)*o;break;case ye.add:l.scaleX+=(u-l.data.scaleX)*o,l.scaleY+=(d-l.data.scaleY)*o}else switch(a){case ye.setup:p=Math.abs(l.data.scaleX)*Re.signum(u),g=Math.abs(l.data.scaleY)*Re.signum(d),l.scaleX=p+(u-p)*o,l.scaleY=g+(d-g)*o;break;case ye.first:case ye.replace:p=Math.abs(l.scaleX)*Re.signum(u),g=Math.abs(l.scaleY)*Re.signum(d),l.scaleX=p+(u-p)*o,l.scaleY=g+(d-g)*o;break;case ye.add:l.scaleX+=(u-l.data.scaleX)*o,l.scaleY+=(d-l.data.scaleY)*o}}}},H1=class extends Us{constructor(t,i,n){super(t,i,ht.scaleX+"|"+n);M(this,"boneIndex",0);this.boneIndex=n}apply(t,i,n,r,o,a,c){let l=t.bones[this.boneIndex];l.active&&(l.scaleX=this.getScaleValue(n,o,a,c,l.scaleX,l.data.scaleX))}},W1=class extends Us{constructor(t,i,n){super(t,i,ht.scaleY+"|"+n);M(this,"boneIndex",0);this.boneIndex=n}apply(t,i,n,r,o,a,c){let l=t.bones[this.boneIndex];l.active&&(l.scaleY=this.getScaleValue(n,o,a,c,l.scaleY,l.data.scaleY))}},z1=class extends Ep{constructor(t,i,n){super(t,i,ht.shearX+"|"+n,ht.shearY+"|"+n);M(this,"boneIndex",0);this.boneIndex=n}apply(t,i,n,r,o,a,c){let l=t.bones[this.boneIndex];if(!l.active)return;let h=this.frames;if(n<h[0]){switch(a){case ye.setup:l.shearX=l.data.shearX,l.shearY=l.data.shearY;return;case ye.first:l.shearX+=(l.data.shearX-l.shearX)*o,l.shearY+=(l.data.shearY-l.shearY)*o}return}let u=0,d=0,f=Yt.search(h,n,3),m=this.curves[f/3];switch(m){case 0:let p=h[f];u=h[f+1],d=h[f+2];let g=(n-p)/(h[f+3]-p);u+=(h[f+3+1]-u)*g,d+=(h[f+3+2]-d)*g;break;case 1:u=h[f+1],d=h[f+2];break;default:u=this.getBezierValue(n,f,1,m-2),d=this.getBezierValue(n,f,2,m+18-2)}switch(a){case ye.setup:l.shearX=l.data.shearX+u*o,l.shearY=l.data.shearY+d*o;break;case ye.first:case ye.replace:l.shearX+=(l.data.shearX+u-l.shearX)*o,l.shearY+=(l.data.shearY+d-l.shearY)*o;break;case ye.add:l.shearX+=u*o,l.shearY+=d*o}}},q1=class extends Us{constructor(t,i,n){super(t,i,ht.shearX+"|"+n);M(this,"boneIndex",0);this.boneIndex=n}apply(t,i,n,r,o,a,c){let l=t.bones[this.boneIndex];l.active&&(l.shearX=this.getRelativeValue(n,o,a,l.shearX,l.data.shearX))}},K1=class extends Us{constructor(t,i,n){super(t,i,ht.shearY+"|"+n);M(this,"boneIndex",0);this.boneIndex=n}apply(t,i,n,r,o,a,c){let l=t.bones[this.boneIndex];l.active&&(l.shearY=this.getRelativeValue(n,o,a,l.shearY,l.data.shearY))}},Z1=class extends Yt{constructor(t,i){super(t,[ht.inherit+"|"+i]);M(this,"boneIndex",0);this.boneIndex=i}getFrameEntries(){return 2}setFrame(t,i,n){t*=2,this.frames[t]=i,this.frames[t+1]=n}apply(t,i,n,r,o,a,c){let l=t.bones[this.boneIndex];if(!l.active)return;if(c==ki.mixOut){a==ye.setup&&(l.inherit=l.data.inherit);return}let h=this.frames;if(n<h[0]){(a==ye.setup||a==ye.first)&&(l.inherit=l.data.inherit);return}l.inherit=this.frames[Yt.search(h,n,2)+1]}},J1=class extends pn{constructor(t,i,n){super(t,i,[ht.rgb+"|"+n,ht.alpha+"|"+n]);M(this,"slotIndex",0);this.slotIndex=n}getFrameEntries(){return 5}setFrame(t,i,n,r,o,a){t*=5,this.frames[t]=i,this.frames[t+1]=n,this.frames[t+2]=r,this.frames[t+3]=o,this.frames[t+4]=a}apply(t,i,n,r,o,a,c){let l=t.slots[this.slotIndex];if(!l.bone.active)return;let h=this.frames,u=l.color;if(n<h[0]){let v=l.data.color;switch(a){case ye.setup:u.setFromColor(v);return;case ye.first:u.add((v.r-u.r)*o,(v.g-u.g)*o,(v.b-u.b)*o,(v.a-u.a)*o)}return}let d=0,f=0,m=0,p=0,g=Yt.search(h,n,5),x=this.curves[g/5];switch(x){case 0:let v=h[g];d=h[g+1],f=h[g+2],m=h[g+3],p=h[g+4];let y=(n-v)/(h[g+5]-v);d+=(h[g+5+1]-d)*y,f+=(h[g+5+2]-f)*y,m+=(h[g+5+3]-m)*y,p+=(h[g+5+4]-p)*y;break;case 1:d=h[g+1],f=h[g+2],m=h[g+3],p=h[g+4];break;default:d=this.getBezierValue(n,g,1,x-2),f=this.getBezierValue(n,g,2,x+18-2),m=this.getBezierValue(n,g,3,x+36-2),p=this.getBezierValue(n,g,4,x+54-2)}o==1?u.set(d,f,m,p):(a==ye.setup&&u.setFromColor(l.data.color),u.add((d-u.r)*o,(f-u.g)*o,(m-u.b)*o,(p-u.a)*o))}},Q1=class extends pn{constructor(t,i,n){super(t,i,[ht.rgb+"|"+n]);M(this,"slotIndex",0);this.slotIndex=n}getFrameEntries(){return 4}setFrame(t,i,n,r,o){t<<=2,this.frames[t]=i,this.frames[t+1]=n,this.frames[t+2]=r,this.frames[t+3]=o}apply(t,i,n,r,o,a,c){let l=t.slots[this.slotIndex];if(!l.bone.active)return;let h=this.frames,u=l.color;if(n<h[0]){let x=l.data.color;switch(a){case ye.setup:u.r=x.r,u.g=x.g,u.b=x.b;return;case ye.first:u.r+=(x.r-u.r)*o,u.g+=(x.g-u.g)*o,u.b+=(x.b-u.b)*o}return}let d=0,f=0,m=0,p=Yt.search(h,n,4),g=this.curves[p>>2];switch(g){case 0:let x=h[p];d=h[p+1],f=h[p+2],m=h[p+3];let v=(n-x)/(h[p+4]-x);d+=(h[p+4+1]-d)*v,f+=(h[p+4+2]-f)*v,m+=(h[p+4+3]-m)*v;break;case 1:d=h[p+1],f=h[p+2],m=h[p+3];break;default:d=this.getBezierValue(n,p,1,g-2),f=this.getBezierValue(n,p,2,g+18-2),m=this.getBezierValue(n,p,3,g+36-2)}if(o==1)u.r=d,u.g=f,u.b=m;else{if(a==ye.setup){let x=l.data.color;u.r=x.r,u.g=x.g,u.b=x.b}u.r+=(d-u.r)*o,u.g+=(f-u.g)*o,u.b+=(m-u.b)*o}}},ew=class extends Us{constructor(t,i,n){super(t,i,ht.alpha+"|"+n);M(this,"slotIndex",0);this.slotIndex=n}apply(t,i,n,r,o,a,c){let l=t.slots[this.slotIndex];if(!l.bone.active)return;let h=l.color;if(n<this.frames[0]){let d=l.data.color;switch(a){case ye.setup:h.a=d.a;return;case ye.first:h.a+=(d.a-h.a)*o}return}let u=this.getCurveValue(n);o==1?h.a=u:(a==ye.setup&&(h.a=l.data.color.a),h.a+=(u-h.a)*o)}},tw=class extends pn{constructor(t,i,n){super(t,i,[ht.rgb+"|"+n,ht.alpha+"|"+n,ht.rgb2+"|"+n]);M(this,"slotIndex",0);this.slotIndex=n}getFrameEntries(){return 8}setFrame(t,i,n,r,o,a,c,l,h){t<<=3,this.frames[t]=i,this.frames[t+1]=n,this.frames[t+2]=r,this.frames[t+3]=o,this.frames[t+4]=a,this.frames[t+5]=c,this.frames[t+6]=l,this.frames[t+7]=h}apply(t,i,n,r,o,a,c){let l=t.slots[this.slotIndex];if(!l.bone.active)return;let h=this.frames,u=l.color,d=l.darkColor;if(n<h[0]){let w=l.data.color,b=l.data.darkColor;switch(a){case ye.setup:u.setFromColor(w),d.r=b.r,d.g=b.g,d.b=b.b;return;case ye.first:u.add((w.r-u.r)*o,(w.g-u.g)*o,(w.b-u.b)*o,(w.a-u.a)*o),d.r+=(b.r-d.r)*o,d.g+=(b.g-d.g)*o,d.b+=(b.b-d.b)*o}return}let f=0,m=0,p=0,g=0,x=0,v=0,y=0,S=Yt.search(h,n,8),C=this.curves[S>>3];switch(C){case 0:let w=h[S];f=h[S+1],m=h[S+2],p=h[S+3],g=h[S+4],x=h[S+5],v=h[S+6],y=h[S+7];let b=(n-w)/(h[S+8]-w);f+=(h[S+8+1]-f)*b,m+=(h[S+8+2]-m)*b,p+=(h[S+8+3]-p)*b,g+=(h[S+8+4]-g)*b,x+=(h[S+8+5]-x)*b,v+=(h[S+8+6]-v)*b,y+=(h[S+8+7]-y)*b;break;case 1:f=h[S+1],m=h[S+2],p=h[S+3],g=h[S+4],x=h[S+5],v=h[S+6],y=h[S+7];break;default:f=this.getBezierValue(n,S,1,C-2),m=this.getBezierValue(n,S,2,C+18-2),p=this.getBezierValue(n,S,3,C+36-2),g=this.getBezierValue(n,S,4,C+54-2),x=this.getBezierValue(n,S,5,C+72-2),v=this.getBezierValue(n,S,6,C+90-2),y=this.getBezierValue(n,S,7,C+108-2)}if(o==1)u.set(f,m,p,g),d.r=x,d.g=v,d.b=y;else{if(a==ye.setup){u.setFromColor(l.data.color);let w=l.data.darkColor;d.r=w.r,d.g=w.g,d.b=w.b}u.add((f-u.r)*o,(m-u.g)*o,(p-u.b)*o,(g-u.a)*o),d.r+=(x-d.r)*o,d.g+=(v-d.g)*o,d.b+=(y-d.b)*o}}},iw=class extends pn{constructor(t,i,n){super(t,i,[ht.rgb+"|"+n,ht.rgb2+"|"+n]);M(this,"slotIndex",0);this.slotIndex=n}getFrameEntries(){return 7}setFrame(t,i,n,r,o,a,c,l){t*=7,this.frames[t]=i,this.frames[t+1]=n,this.frames[t+2]=r,this.frames[t+3]=o,this.frames[t+4]=a,this.frames[t+5]=c,this.frames[t+6]=l}apply(t,i,n,r,o,a,c){let l=t.slots[this.slotIndex];if(!l.bone.active)return;let h=this.frames,u=l.color,d=l.darkColor;if(n<h[0]){let C=l.data.color,w=l.data.darkColor;switch(a){case ye.setup:u.r=C.r,u.g=C.g,u.b=C.b,d.r=w.r,d.g=w.g,d.b=w.b;return;case ye.first:u.r+=(C.r-u.r)*o,u.g+=(C.g-u.g)*o,u.b+=(C.b-u.b)*o,d.r+=(w.r-d.r)*o,d.g+=(w.g-d.g)*o,d.b+=(w.b-d.b)*o}return}let f=0,m=0,p=0,g=0,x=0,v=0,y=Yt.search(h,n,7),S=this.curves[y/7];switch(S){case 0:let C=h[y];f=h[y+1],m=h[y+2],p=h[y+3],g=h[y+4],x=h[y+5],v=h[y+6];let w=(n-C)/(h[y+7]-C);f+=(h[y+7+1]-f)*w,m+=(h[y+7+2]-m)*w,p+=(h[y+7+3]-p)*w,g+=(h[y+7+4]-g)*w,x+=(h[y+7+5]-x)*w,v+=(h[y+7+6]-v)*w;break;case 1:f=h[y+1],m=h[y+2],p=h[y+3],g=h[y+4],x=h[y+5],v=h[y+6];break;default:f=this.getBezierValue(n,y,1,S-2),m=this.getBezierValue(n,y,2,S+18-2),p=this.getBezierValue(n,y,3,S+36-2),g=this.getBezierValue(n,y,4,S+54-2),x=this.getBezierValue(n,y,5,S+72-2),v=this.getBezierValue(n,y,6,S+90-2)}if(o==1)u.r=f,u.g=m,u.b=p,d.r=g,d.g=x,d.b=v;else{if(a==ye.setup){let C=l.data.color,w=l.data.darkColor;u.r=C.r,u.g=C.g,u.b=C.b,d.r=w.r,d.g=w.g,d.b=w.b}u.r+=(f-u.r)*o,u.g+=(m-u.g)*o,u.b+=(p-u.b)*o,d.r+=(g-d.r)*o,d.g+=(x-d.g)*o,d.b+=(v-d.b)*o}}},Yo=class extends Yt{constructor(t,i){super(t,[ht.attachment+"|"+i]);M(this,"slotIndex",0);M(this,"attachmentNames");this.slotIndex=i,this.attachmentNames=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,i,n){this.frames[t]=i,this.attachmentNames[t]=n}apply(t,i,n,r,o,a,c){let l=t.slots[this.slotIndex];if(l.bone.active){if(c==ki.mixOut){a==ye.setup&&this.setAttachment(t,l,l.data.attachmentName);return}if(n<this.frames[0]){(a==ye.setup||a==ye.first)&&this.setAttachment(t,l,l.data.attachmentName);return}this.setAttachment(t,l,this.attachmentNames[Yt.search1(this.frames,n)])}}setAttachment(t,i,n){i.setAttachment(n?t.getAttachment(this.slotIndex,n):null)}},sw=class extends pn{constructor(t,i,n,r){super(t,i,[ht.deform+"|"+n+"|"+r.id]);M(this,"slotIndex",0);M(this,"attachment");M(this,"vertices");this.slotIndex=n,this.attachment=r,this.vertices=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,i,n){this.frames[t]=i,this.vertices[t]=n}setBezier(t,i,n,r,o,a,c,l,h,u,d){let f=this.curves,m=this.getFrameCount()+t*18;n==0&&(f[i]=2+m);let p=(r-a*2+l)*.03,g=h*.03-c*.06,x=((a-l)*3-r+u)*.006,v=(c-h+.33333333)*.018,y=p*2+x,S=g*2+v,C=(a-r)*.3+p+x*.16666667,w=c*.3+g+v*.16666667,b=r+C,_=w;for(let A=m+18;m<A;m+=2)f[m]=b,f[m+1]=_,C+=y,w+=S,y+=x,S+=v,b+=C,_+=w}getCurvePercent(t,i){let n=this.curves,r=n[i];switch(r){case 0:let l=this.frames[i];return(t-l)/(this.frames[i+this.getFrameEntries()]-l);case 1:return 0}if(r-=2,n[r]>t){let l=this.frames[i];return n[r+1]*(t-l)/(n[r]-l)}let o=r+18;for(r+=2;r<o;r+=2)if(n[r]>=t){let l=n[r-2],h=n[r-1];return h+(t-l)/(n[r]-l)*(n[r+1]-h)}let a=n[o-2],c=n[o-1];return c+(1-c)*(t-a)/(this.frames[i+this.getFrameEntries()]-a)}apply(t,i,n,r,o,a,c){let l=t.slots[this.slotIndex];if(!l.bone.active)return;let h=l.getAttachment();if(!h||!(h instanceof zn)||h.timelineAttachment!=this.attachment)return;let u=l.deform;u.length==0&&(a=ye.setup);let d=this.vertices,f=d[0].length,m=this.frames;if(n<m[0]){switch(a){case ye.setup:u.length=0;return;case ye.first:if(o==1){u.length=0;return}u.length=f;let S=h;if(S.bones){o=1-o;for(var p=0;p<f;p++)u[p]*=o}else{let C=S.vertices;for(var p=0;p<f;p++)u[p]+=(C[p]-u[p])*o}}return}if(u.length=f,n>=m[m.length-1]){let S=d[m.length-1];if(o==1)if(a==ye.add){let C=h;if(C.bones)for(let w=0;w<f;w++)u[w]+=S[w];else{let w=C.vertices;for(let b=0;b<f;b++)u[b]+=S[b]-w[b]}}else Pe.arrayCopy(S,0,u,0,f);else switch(a){case ye.setup:{let w=h;if(w.bones)for(let b=0;b<f;b++)u[b]=S[b]*o;else{let b=w.vertices;for(let _=0;_<f;_++){let A=b[_];u[_]=A+(S[_]-A)*o}}break}case ye.first:case ye.replace:for(let w=0;w<f;w++)u[w]+=(S[w]-u[w])*o;break;case ye.add:let C=h;if(C.bones)for(let w=0;w<f;w++)u[w]+=S[w]*o;else{let w=C.vertices;for(let b=0;b<f;b++)u[b]+=(S[b]-w[b])*o}}return}let g=Yt.search1(m,n),x=this.getCurvePercent(n,g),v=d[g],y=d[g+1];if(o==1)if(a==ye.add){let S=h;if(S.bones)for(let C=0;C<f;C++){let w=v[C];u[C]+=w+(y[C]-w)*x}else{let C=S.vertices;for(let w=0;w<f;w++){let b=v[w];u[w]+=b+(y[w]-b)*x-C[w]}}}else for(let S=0;S<f;S++){let C=v[S];u[S]=C+(y[S]-C)*x}else switch(a){case ye.setup:{let C=h;if(C.bones)for(let w=0;w<f;w++){let b=v[w];u[w]=(b+(y[w]-b)*x)*o}else{let w=C.vertices;for(let b=0;b<f;b++){let _=v[b],A=w[b];u[b]=A+(_+(y[b]-_)*x-A)*o}}break}case ye.first:case ye.replace:for(let C=0;C<f;C++){let w=v[C];u[C]+=(w+(y[C]-w)*x-u[C])*o}break;case ye.add:let S=h;if(S.bones)for(let C=0;C<f;C++){let w=v[C];u[C]+=(w+(y[C]-w)*x)*o}else{let C=S.vertices;for(let w=0;w<f;w++){let b=v[w];u[w]+=(b+(y[w]-b)*x-C[w])*o}}}}};var eo;let Ap=(eo=class extends Yt{constructor(t){super(t,eo.propertyIds);M(this,"events");this.events=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,i){this.frames[t]=i.time,this.events[t]=i}apply(t,i,n,r,o,a,c){if(!r)return;let l=this.frames,h=this.frames.length;if(i>n)this.apply(t,i,Number.MAX_VALUE,r,o,a,c),i=-1;else if(i>=l[h-1])return;if(n<l[0])return;let u=0;if(i<l[0])u=0;else{u=Yt.search1(l,i)+1;let d=l[u];for(;u>0&&l[u-1]==d;)u--}for(;u<h&&n>=l[u];u++)r.push(this.events[u])}},M(eo,"propertyIds",[""+ht.event]),eo);var to;let el=(to=class extends Yt{constructor(t){super(t,to.propertyIds);M(this,"drawOrders");this.drawOrders=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,i,n){this.frames[t]=i,this.drawOrders[t]=n}apply(t,i,n,r,o,a,c){if(c==ki.mixOut){a==ye.setup&&Pe.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);return}if(n<this.frames[0]){(a==ye.setup||a==ye.first)&&Pe.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);return}let l=Yt.search1(this.frames,n),h=this.drawOrders[l];if(!h)Pe.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);else{let u=t.drawOrder,d=t.slots;for(let f=0,m=h.length;f<m;f++)u[f]=d[h[f]]}}},M(to,"propertyIds",[""+ht.drawOrder]),to),nw=class extends pn{constructor(t,i,n){super(t,i,[ht.ikConstraint+"|"+n]);M(this,"constraintIndex",0);this.constraintIndex=n}getFrameEntries(){return 6}setFrame(t,i,n,r,o,a,c){t*=6,this.frames[t]=i,this.frames[t+1]=n,this.frames[t+2]=r,this.frames[t+3]=o,this.frames[t+4]=a?1:0,this.frames[t+5]=c?1:0}apply(t,i,n,r,o,a,c){let l=t.ikConstraints[this.constraintIndex];if(!l.active)return;let h=this.frames;if(n<h[0]){switch(a){case ye.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 ye.first:l.mix+=(l.data.mix-l.mix)*o,l.softness+=(l.data.softness-l.softness)*o,l.bendDirection=l.data.bendDirection,l.compress=l.data.compress,l.stretch=l.data.stretch}return}let u=0,d=0,f=Yt.search(h,n,6),m=this.curves[f/6];switch(m){case 0:let p=h[f];u=h[f+1],d=h[f+2];let g=(n-p)/(h[f+6]-p);u+=(h[f+6+1]-u)*g,d+=(h[f+6+2]-d)*g;break;case 1:u=h[f+1],d=h[f+2];break;default:u=this.getBezierValue(n,f,1,m-2),d=this.getBezierValue(n,f,2,m+18-2)}a==ye.setup?(l.mix=l.data.mix+(u-l.data.mix)*o,l.softness=l.data.softness+(d-l.data.softness)*o,c==ki.mixOut?(l.bendDirection=l.data.bendDirection,l.compress=l.data.compress,l.stretch=l.data.stretch):(l.bendDirection=h[f+3],l.compress=h[f+4]!=0,l.stretch=h[f+5]!=0)):(l.mix+=(u-l.mix)*o,l.softness+=(d-l.softness)*o,c==ki.mixIn&&(l.bendDirection=h[f+3],l.compress=h[f+4]!=0,l.stretch=h[f+5]!=0))}},rw=class extends pn{constructor(t,i,n){super(t,i,[ht.transformConstraint+"|"+n]);M(this,"constraintIndex",0);this.constraintIndex=n}getFrameEntries(){return 7}setFrame(t,i,n,r,o,a,c,l){let h=this.frames;t*=7,h[t]=i,h[t+1]=n,h[t+2]=r,h[t+3]=o,h[t+4]=a,h[t+5]=c,h[t+6]=l}apply(t,i,n,r,o,a,c){let l=t.transformConstraints[this.constraintIndex];if(!l.active)return;let h=this.frames;if(n<h[0]){let y=l.data;switch(a){case ye.setup:l.mixRotate=y.mixRotate,l.mixX=y.mixX,l.mixY=y.mixY,l.mixScaleX=y.mixScaleX,l.mixScaleY=y.mixScaleY,l.mixShearY=y.mixShearY;return;case ye.first:l.mixRotate+=(y.mixRotate-l.mixRotate)*o,l.mixX+=(y.mixX-l.mixX)*o,l.mixY+=(y.mixY-l.mixY)*o,l.mixScaleX+=(y.mixScaleX-l.mixScaleX)*o,l.mixScaleY+=(y.mixScaleY-l.mixScaleY)*o,l.mixShearY+=(y.mixShearY-l.mixShearY)*o}return}let u,d,f,m,p,g,x=Yt.search(h,n,7),v=this.curves[x/7];switch(v){case 0:let y=h[x];u=h[x+1],d=h[x+2],f=h[x+3],m=h[x+4],p=h[x+5],g=h[x+6];let S=(n-y)/(h[x+7]-y);u+=(h[x+7+1]-u)*S,d+=(h[x+7+2]-d)*S,f+=(h[x+7+3]-f)*S,m+=(h[x+7+4]-m)*S,p+=(h[x+7+5]-p)*S,g+=(h[x+7+6]-g)*S;break;case 1:u=h[x+1],d=h[x+2],f=h[x+3],m=h[x+4],p=h[x+5],g=h[x+6];break;default:u=this.getBezierValue(n,x,1,v-2),d=this.getBezierValue(n,x,2,v+18-2),f=this.getBezierValue(n,x,3,v+36-2),m=this.getBezierValue(n,x,4,v+54-2),p=this.getBezierValue(n,x,5,v+72-2),g=this.getBezierValue(n,x,6,v+90-2)}if(a==ye.setup){let y=l.data;l.mixRotate=y.mixRotate+(u-y.mixRotate)*o,l.mixX=y.mixX+(d-y.mixX)*o,l.mixY=y.mixY+(f-y.mixY)*o,l.mixScaleX=y.mixScaleX+(m-y.mixScaleX)*o,l.mixScaleY=y.mixScaleY+(p-y.mixScaleY)*o,l.mixShearY=y.mixShearY+(g-y.mixShearY)*o}else l.mixRotate+=(u-l.mixRotate)*o,l.mixX+=(d-l.mixX)*o,l.mixY+=(f-l.mixY)*o,l.mixScaleX+=(m-l.mixScaleX)*o,l.mixScaleY+=(p-l.mixScaleY)*o,l.mixShearY+=(g-l.mixShearY)*o}},ow=class extends Us{constructor(t,i,n){super(t,i,ht.pathConstraintPosition+"|"+n);M(this,"constraintIndex",0);this.constraintIndex=n}apply(t,i,n,r,o,a,c){let l=t.pathConstraints[this.constraintIndex];l.active&&(l.position=this.getAbsoluteValue(n,o,a,l.position,l.data.position))}},aw=class extends Us{constructor(t,i,n){super(t,i,ht.pathConstraintSpacing+"|"+n);M(this,"constraintIndex",0);this.constraintIndex=n}apply(t,i,n,r,o,a,c){let l=t.pathConstraints[this.constraintIndex];l.active&&(l.spacing=this.getAbsoluteValue(n,o,a,l.spacing,l.data.spacing))}},lw=class extends pn{constructor(t,i,n){super(t,i,[ht.pathConstraintMix+"|"+n]);M(this,"constraintIndex",0);this.constraintIndex=n}getFrameEntries(){return 4}setFrame(t,i,n,r,o){let a=this.frames;t<<=2,a[t]=i,a[t+1]=n,a[t+2]=r,a[t+3]=o}apply(t,i,n,r,o,a,c){let l=t.pathConstraints[this.constraintIndex];if(!l.active)return;let h=this.frames;if(n<h[0]){switch(a){case ye.setup:l.mixRotate=l.data.mixRotate,l.mixX=l.data.mixX,l.mixY=l.data.mixY;return;case ye.first:l.mixRotate+=(l.data.mixRotate-l.mixRotate)*o,l.mixX+=(l.data.mixX-l.mixX)*o,l.mixY+=(l.data.mixY-l.mixY)*o}return}let u,d,f,m=Yt.search(h,n,4),p=this.curves[m>>2];switch(p){case 0:let g=h[m];u=h[m+1],d=h[m+2],f=h[m+3];let x=(n-g)/(h[m+4]-g);u+=(h[m+4+1]-u)*x,d+=(h[m+4+2]-d)*x,f+=(h[m+4+3]-f)*x;break;case 1:u=h[m+1],d=h[m+2],f=h[m+3];break;default:u=this.getBezierValue(n,m,1,p-2),d=this.getBezierValue(n,m,2,p+18-2),f=this.getBezierValue(n,m,3,p+36-2)}if(a==ye.setup){let g=l.data;l.mixRotate=g.mixRotate+(u-g.mixRotate)*o,l.mixX=g.mixX+(d-g.mixX)*o,l.mixY=g.mixY+(f-g.mixY)*o}else l.mixRotate+=(u-l.mixRotate)*o,l.mixX+=(d-l.mixX)*o,l.mixY+=(f-l.mixY)*o}},xo=class extends Us{constructor(t,i,n,r){super(t,i,r+"|"+n);M(this,"constraintIndex",0);this.constraintIndex=n}apply(t,i,n,r,o,a,c){let l;if(this.constraintIndex==-1){const h=n>=this.frames[0]?this.getCurveValue(n):0;for(const u of t.physicsConstraints)u.active&&this.global(u.data)&&this.set(u,this.getAbsoluteValue2(n,o,a,this.get(u),this.setup(u),h))}else l=t.physicsConstraints[this.constraintIndex],l.active&&this.set(l,this.getAbsoluteValue(n,o,a,this.get(l),this.setup(l)))}},cw=class extends xo{constructor(e,t,i){super(e,t,i,ht.physicsConstraintInertia)}setup(e){return e.data.inertia}get(e){return e.inertia}set(e,t){e.inertia=t}global(e){return e.inertiaGlobal}},hw=class extends xo{constructor(e,t,i){super(e,t,i,ht.physicsConstraintStrength)}setup(e){return e.data.strength}get(e){return e.strength}set(e,t){e.strength=t}global(e){return e.strengthGlobal}},uw=class extends xo{constructor(e,t,i){super(e,t,i,ht.physicsConstraintDamping)}setup(e){return e.data.damping}get(e){return e.damping}set(e,t){e.damping=t}global(e){return e.dampingGlobal}},dw=class extends xo{constructor(e,t,i){super(e,t,i,ht.physicsConstraintMass)}setup(e){return 1/e.data.massInverse}get(e){return 1/e.massInverse}set(e,t){e.massInverse=1/t}global(e){return e.massGlobal}},fw=class extends xo{constructor(e,t,i){super(e,t,i,ht.physicsConstraintWind)}setup(e){return e.data.wind}get(e){return e.wind}set(e,t){e.wind=t}global(e){return e.windGlobal}},mw=class extends xo{constructor(e,t,i){super(e,t,i,ht.physicsConstraintGravity)}setup(e){return e.data.gravity}get(e){return e.gravity}set(e,t){e.gravity=t}global(e){return e.gravityGlobal}},pw=class extends xo{constructor(e,t,i){super(e,t,i,ht.physicsConstraintMix)}setup(e){return e.data.mix}get(e){return e.mix}set(e,t){e.mix=t}global(e){return e.mixGlobal}};var io;let gw=(io=class extends Yt{constructor(t,i){super(t,io.propertyIds);M(this,"constraintIndex");this.constraintIndex=i}getFrameCount(){return this.frames.length}setFrame(t,i){this.frames[t]=i}apply(t,i,n,r,o,a,c){let l;if(this.constraintIndex!=-1&&(l=t.physicsConstraints[this.constraintIndex],!l.active))return;const h=this.frames;if(i>n)this.apply(t,i,Number.MAX_VALUE,[],o,a,c),i=-1;else if(i>=h[h.length-1])return;if(!(n<h[0])&&(i<h[0]||n>=h[Yt.search1(h,i)+1]))if(l!=null)l.reset();else for(const u of t.physicsConstraints)u.active&&u.reset()}},M(io,"propertyIds",[ht.physicsConstraintReset.toString()]),io);var Di;let vw=(Di=class extends Yt{constructor(t,i,n){super(t,[ht.sequence+"|"+i+"|"+n.sequence.id]);M(this,"slotIndex");M(this,"attachment");this.slotIndex=i,this.attachment=n}getFrameEntries(){return Di.ENTRIES}getSlotIndex(){return this.slotIndex}getAttachment(){return this.attachment}setFrame(t,i,n,r,o){let a=this.frames;t*=Di.ENTRIES,a[t]=i,a[t+Di.MODE]=n|r<<4,a[t+Di.DELAY]=o}apply(t,i,n,r,o,a,c){let l=t.slots[this.slotIndex];if(!l.bone.active)return;let h=l.attachment,u=this.attachment;if(h!=u&&(!(h instanceof zn)||h.timelineAttachment!=u))return;if(c==ki.mixOut){a==ye.setup&&(l.sequenceIndex=-1);return}let d=this.frames;if(n<d[0]){(a==ye.setup||a==ye.first)&&(l.sequenceIndex=-1);return}let f=Yt.search(d,n,Di.ENTRIES),m=d[f],p=d[f+Di.MODE],g=d[f+Di.DELAY];if(!this.attachment.sequence)return;let x=p>>4,v=this.attachment.sequence.regions.length,y=X1[p&15];if(y!=Ti.hold)switch(x+=(n-m)/g+1e-5|0,y){case Ti.once:x=Math.min(v-1,x);break;case Ti.loop:x%=v;break;case Ti.pingpong:{let S=(v<<1)-2;x=S==0?0:x%S,x>=v&&(x=S-x);break}case Ti.onceReverse:x=Math.max(v-1-x,0);break;case Ti.loopReverse:x=v-1-x%v;break;case Ti.pingpongReverse:{let S=(v<<1)-2;x=S==0?0:(x+v-1)%S,x>=v&&(x=S-x)}}l.sequenceIndex=x}},M(Di,"ENTRIES",3),M(Di,"MODE",1),M(Di,"DELAY",2),Di);var Dn;let nP=(Dn=class{constructor(e){M(this,"data");M(this,"tracks",new Array);M(this,"timeScale",1);M(this,"unkeyedState",0);M(this,"events",new Array);M(this,"listeners",new Array);M(this,"queue",new oP(this));M(this,"propertyIDs",new D1);M(this,"animationsChanged",!1);M(this,"trackEntryPool",new xh(()=>new rP));this.data=e}static emptyAnimation(){return Dn._emptyAnimation}update(e){e*=this.timeScale;let t=this.tracks;for(let i=0,n=t.length;i<n;i++){let r=t[i];if(!r)continue;r.animationLast=r.nextAnimationLast,r.trackLast=r.nextTrackLast;let o=e*r.timeScale;if(r.delay>0){if(r.delay-=o,r.delay>0)continue;o=-r.delay,r.delay=0}let a=r.next;if(a){let c=r.trackLast-a.delay;if(c>=0){for(a.delay=0,a.trackTime+=r.timeScale==0?0:(c/r.timeScale+e)*a.timeScale,r.trackTime+=o,this.setCurrent(i,a,!0);a.mixingFrom;)a.mixTime+=e,a=a.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 c=r.mixingFrom;for(r.mixingFrom=null,c&&(c.mixingTo=null);c;)this.queue.end(c),c=c.mixingFrom}r.trackTime+=o}this.queue.drain()}updateMixingFrom(e,t){let i=e.mixingFrom;if(!i)return!0;let n=this.updateMixingFrom(i,t);return i.animationLast=i.nextAnimationLast,i.trackLast=i.nextTrackLast,e.nextTrackLast!=-1&&e.mixTime>=e.mixDuration?((i.totalAlpha==0||e.mixDuration==0)&&(e.mixingFrom=i.mixingFrom,i.mixingFrom!=null&&(i.mixingFrom.mixingTo=e),e.interruptAlpha=i.interruptAlpha,this.queue.end(i)),n):(i.trackTime+=t*i.timeScale,e.mixTime+=t,!1)}apply(e){if(!e)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();let t=this.events,i=this.tracks,n=!1;for(let d=0,f=i.length;d<f;d++){let m=i[d];if(!m||m.delay>0)continue;n=!0;let p=d==0?ye.first:m.mixBlend,g=m.alpha;m.mixingFrom?g*=this.applyMixingFrom(m,e,p):m.trackTime>=m.trackEnd&&!m.next&&(g=0);let x=g>=m.alphaAttachmentThreshold,v=m.animationLast,y=m.getAnimationTime(),S=y,C=t;m.reverse&&(S=m.animation.duration-S,C=null);let w=m.animation.timelines,b=w.length;if(d==0&&g==1||p==ye.add){d==0&&(x=!0);for(let _=0;_<b;_++){var r=w[_];r instanceof Yo?this.applyAttachmentTimeline(r,e,S,p,x):r.apply(e,v,S,C,g,p,ki.mixIn)}}else{let _=m.timelineMode,A=m.shortestRotation,P=!A&&m.timelinesRotation.length!=b<<1;P&&(m.timelinesRotation.length=b<<1);for(let E=0;E<b;E++){let R=w[E],O=_[E]==df?p:ye.setup;!A&&R instanceof wh?this.applyRotateTimeline(R,e,S,g,O,m.timelinesRotation,E<<1,P):R instanceof Yo?this.applyAttachmentTimeline(R,e,S,p,x):R.apply(e,v,S,C,g,O,ki.mixIn)}}this.queueEvents(m,y),t.length=0,m.nextAnimationLast=y,m.nextTrackLast=m.trackTime}for(var o=this.unkeyedState+qv,a=e.slots,c=0,l=e.slots.length;c<l;c++){var h=a[c];if(h.attachmentState==o){var u=h.data.attachmentName;h.setAttachment(u?e.getAttachment(h.data.index,u):null)}}return this.unkeyedState+=2,this.queue.drain(),n}applyMixingFrom(e,t,i){let n=e.mixingFrom;n.mixingFrom&&this.applyMixingFrom(n,t,i);let r=0;e.mixDuration==0?(r=1,i==ye.first&&(i=ye.setup)):(r=e.mixTime/e.mixDuration,r>1&&(r=1),i!=ye.first&&(i=n.mixBlend));let o=r<n.mixAttachmentThreshold,a=r<n.mixDrawOrderThreshold,c=n.animation.timelines,l=c.length,h=n.alpha*e.interruptAlpha,u=h*(1-r),d=n.animationLast,f=n.getAnimationTime(),m=f,p=null;if(n.reverse?m=n.animation.duration-m:r<n.eventThreshold&&(p=this.events),i==ye.add)for(let g=0;g<l;g++)c[g].apply(t,d,m,p,u,i,ki.mixOut);else{let g=n.timelineMode,x=n.timelineHoldMix,v=n.shortestRotation,y=!v&&n.timelinesRotation.length!=l<<1;y&&(n.timelinesRotation.length=l<<1),n.totalAlpha=0;for(let S=0;S<l;S++){let C=c[S],w=ki.mixOut,b,_=0;switch(g[S]){case df:if(!a&&C instanceof el)continue;b=i,_=u;break;case Wv:b=ye.setup,_=u;break;case zv:b=i,_=h;break;case ff:b=ye.setup,_=h;break;default:b=ye.setup;let A=x[S];_=h*Math.max(0,1-A.mixTime/A.mixDuration);break}n.totalAlpha+=_,!v&&C instanceof wh?this.applyRotateTimeline(C,t,m,_,b,n.timelinesRotation,S<<1,y):C instanceof Yo?this.applyAttachmentTimeline(C,t,m,b,o&&_>=n.alphaAttachmentThreshold):(a&&C instanceof el&&b==ye.setup&&(w=ki.mixIn),C.apply(t,d,m,p,_,b,w))}}return e.mixDuration>0&&this.queueEvents(n,f),this.events.length=0,n.nextAnimationLast=f,n.nextTrackLast=n.trackTime,r}applyAttachmentTimeline(e,t,i,n,r){var o=t.slots[e.slotIndex];o.bone.active&&(i<e.frames[0]?(n==ye.setup||n==ye.first)&&this.setAttachment(t,o,o.data.attachmentName,r):this.setAttachment(t,o,e.attachmentNames[Yt.search1(e.frames,i)],r),o.attachmentState<=this.unkeyedState&&(o.attachmentState=this.unkeyedState+qv))}setAttachment(e,t,i,n){t.setAttachment(i?e.getAttachment(t.data.index,i):null),n&&(t.attachmentState=this.unkeyedState+lP)}applyRotateTimeline(e,t,i,n,r,o,a,c){if(c&&(o[a]=0),n==1){e.apply(t,0,i,null,1,r,ki.mixIn);return}let l=t.bones[e.boneIndex];if(!l.active)return;let h=e.frames,u=0,d=0;if(i<h[0])switch(r){case ye.setup:l.rotation=l.data.rotation;default:return;case ye.first:u=l.rotation,d=l.data.rotation}else u=r==ye.setup?l.data.rotation:l.rotation,d=l.data.rotation+e.getCurveValue(i);let f=0,m=d-u;if(m-=Math.ceil(m/360-.5)*360,m==0)f=o[a];else{let p=0,g=0;c?(p=0,g=m):(p=o[a],g=o[a+1]);let x=p-p%360;f=m+x;let v=m>=0,y=p>=0;Math.abs(g)<=90&&Re.signum(g)!=Re.signum(m)&&(Math.abs(p-x)>180?(f+=360*Re.signum(p),y=v):x!=0?f-=360*Re.signum(p):y=v),y!=v&&(f+=360*Re.signum(p)),o[a]=f}o[a+1]=m,l.rotation=u+f*n}queueEvents(e,t){let i=e.animationStart,n=e.animationEnd,r=n-i,o=e.trackLast%r,a=this.events,c=0,l=a.length;for(;c<l;c++){let u=a[c];if(u.time<o)break;u.time>n||this.queue.event(e,u)}let h=!1;if(e.loop)if(r==0)h=!0;else{const u=Math.floor(e.trackTime/r);h=u>0&&u>Math.floor(e.trackLast/r)}else h=t>=n&&e.animationLast<n;for(h&&this.queue.complete(e);c<l;c++){let u=a[c];u.time<i||this.queue.event(e,u)}}clearTracks(){let e=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let t=0,i=this.tracks.length;t<i;t++)this.clearTrack(t);this.tracks.length=0,this.queue.drainDisabled=e,this.queue.drain()}clearTrack(e){if(e>=this.tracks.length)return;let t=this.tracks[e];if(!t)return;this.queue.end(t),this.clearNext(t);let i=t;for(;;){let n=i.mixingFrom;if(!n)break;this.queue.end(n),i.mixingFrom=null,i.mixingTo=null,i=n}this.tracks[t.trackIndex]=null,this.queue.drain()}setCurrent(e,t,i){let n=this.expandToIndex(e);this.tracks[e]=t,t.previous=null,n&&(i&&this.queue.interrupt(n),t.mixingFrom=n,n.mixingTo=t,t.mixTime=0,n.mixingFrom&&n.mixDuration>0&&(t.interruptAlpha*=Math.min(1,n.mixTime/n.mixDuration)),n.timelinesRotation.length=0),this.queue.start(t)}setAnimation(e,t,i=!1){let n=this.data.skeletonData.findAnimation(t);if(!n)throw new Error("Animation not found: "+t);return this.setAnimationWith(e,n,i)}setAnimationWith(e,t,i=!1){if(!t)throw new Error("animation cannot be null.");let n=!0,r=this.expandToIndex(e);r&&(r.nextTrackLast==-1?(this.tracks[e]=r.mixingFrom,this.queue.interrupt(r),this.queue.end(r),this.clearNext(r),r=r.mixingFrom,n=!1):this.clearNext(r));let o=this.trackEntry(e,t,i,r);return this.setCurrent(e,o,n),this.queue.drain(),o}addAnimation(e,t,i=!1,n=0){let r=this.data.skeletonData.findAnimation(t);if(!r)throw new Error("Animation not found: "+t);return this.addAnimationWith(e,r,i,n)}addAnimationWith(e,t,i=!1,n=0){if(!t)throw new Error("animation cannot be null.");let r=this.expandToIndex(e);if(r)for(;r.next;)r=r.next;let o=this.trackEntry(e,t,i,r);return r?(r.next=o,o.previous=r,n<=0&&(n=Math.max(n+r.getTrackComplete()-o.mixDuration,0))):(this.setCurrent(e,o,!0),this.queue.drain(),n<0&&(n=0)),o.delay=n,o}setEmptyAnimation(e,t=0){let i=this.setAnimationWith(e,Dn.emptyAnimation(),!1);return i.mixDuration=t,i.trackEnd=t,i}addEmptyAnimation(e,t=0,i=0){let n=this.addAnimationWith(e,Dn.emptyAnimation(),!1,i);return i<=0&&(n.delay=Math.max(n.delay+n.mixDuration-t,0)),n.mixDuration=t,n.trackEnd=t,n}setEmptyAnimations(e=0){let t=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let i=0,n=this.tracks.length;i<n;i++){let r=this.tracks[i];r&&this.setEmptyAnimation(r.trackIndex,e)}this.queue.drainDisabled=t,this.queue.drain()}expandToIndex(e){return e<this.tracks.length?this.tracks[e]:(Pe.ensureArrayCapacity(this.tracks,e+1,null),this.tracks.length=e+1,null)}trackEntry(e,t,i,n){let r=this.trackEntryPool.obtain();return r.reset(),r.trackIndex=e,r.animation=t,r.loop=i,r.holdPrevious=!1,r.reverse=!1,r.shortestRotation=!1,r.eventThreshold=0,r.alphaAttachmentThreshold=0,r.mixAttachmentThreshold=0,r.mixDrawOrderThreshold=0,r.animationStart=0,r.animationEnd=t.duration,r.animationLast=-1,r.nextAnimationLast=-1,r.delay=0,r.trackTime=0,r.trackLast=-1,r.nextTrackLast=-1,r.trackEnd=Number.MAX_VALUE,r.timeScale=1,r.alpha=1,r.mixTime=0,r.mixDuration=n?this.data.getMix(n.animation,t):0,r.interruptAlpha=1,r.totalAlpha=0,r.mixBlend=ye.replace,r}clearNext(e){let t=e.next;for(;t;)this.queue.dispose(t),t=t.next;e.next=null}_animationsChanged(){this.animationsChanged=!1,this.propertyIDs.clear();let e=this.tracks;for(let t=0,i=e.length;t<i;t++){let n=e[t];if(n){for(;n.mixingFrom;)n=n.mixingFrom;do(!n.mixingTo||n.mixBlend!=ye.add)&&this.computeHold(n),n=n.mixingTo;while(n)}}}computeHold(e){let t=e.mixingTo,i=e.animation.timelines,n=e.animation.timelines.length,r=e.timelineMode;r.length=n;let o=e.timelineHoldMix;o.length=0;let a=this.propertyIDs;if(t&&t.holdPrevious){for(let c=0;c<n;c++)r[c]=a.addAll(i[c].getPropertyIds())?ff:zv;return}e:for(let c=0;c<n;c++){let l=i[c],h=l.getPropertyIds();if(!a.addAll(h))r[c]=df;else if(!t||l instanceof Yo||l instanceof el||l instanceof Ap||!t.animation.hasTimeline(h))r[c]=Wv;else{for(let u=t.mixingTo;u;u=u.mixingTo)if(!u.animation.hasTimeline(h)){if(e.mixDuration>0){r[c]=aP,o[c]=u;continue e}break}r[c]=ff}}}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()}},M(Dn,"_emptyAnimation",new Cp("<empty>",[],0)),Dn),rP=class{constructor(){M(this,"animation",null);M(this,"previous",null);M(this,"next",null);M(this,"mixingFrom",null);M(this,"mixingTo",null);M(this,"listener",null);M(this,"trackIndex",0);M(this,"loop",!1);M(this,"holdPrevious",!1);M(this,"reverse",!1);M(this,"shortestRotation",!1);M(this,"eventThreshold",0);M(this,"mixAttachmentThreshold",0);M(this,"alphaAttachmentThreshold",0);M(this,"mixDrawOrderThreshold",0);M(this,"animationStart",0);M(this,"animationEnd",0);M(this,"animationLast",0);M(this,"nextAnimationLast",0);M(this,"delay",0);M(this,"trackTime",0);M(this,"trackLast",0);M(this,"nextTrackLast",0);M(this,"trackEnd",0);M(this,"timeScale",0);M(this,"alpha",0);M(this,"mixTime",0);M(this,"_mixDuration",0);M(this,"interruptAlpha",0);M(this,"totalAlpha",0);M(this,"mixBlend",ye.replace);M(this,"timelineMode",new Array);M(this,"timelineHoldMix",new Array);M(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}},oP=class{constructor(e){M(this,"objects",[]);M(this,"drainDisabled",!1);M(this,"animState");this.animState=e}start(e){this.objects.push(Hi.start),this.objects.push(e),this.animState.animationsChanged=!0}interrupt(e){this.objects.push(Hi.interrupt),this.objects.push(e)}end(e){this.objects.push(Hi.end),this.objects.push(e),this.animState.animationsChanged=!0}dispose(e){this.objects.push(Hi.dispose),this.objects.push(e)}complete(e){this.objects.push(Hi.complete),this.objects.push(e)}event(e,t){this.objects.push(Hi.event),this.objects.push(e),this.objects.push(t)}drain(){if(this.drainDisabled)return;this.drainDisabled=!0;let e=this.objects;for(let t=0;t<e.length;t+=2){let i=e[t],n=e[t+1],r=this.animState.listeners.slice();switch(i){case Hi.start:n.listener&&n.listener.start&&n.listener.start(n);for(let a=0;a<r.length;a++){let c=r[a];c.start&&c.start(n)}break;case Hi.interrupt:n.listener&&n.listener.interrupt&&n.listener.interrupt(n);for(let a=0;a<r.length;a++){let c=r[a];c.interrupt&&c.interrupt(n)}break;case Hi.end:n.listener&&n.listener.end&&n.listener.end(n);for(let a=0;a<r.length;a++){let c=r[a];c.end&&c.end(n)}case Hi.dispose:n.listener&&n.listener.dispose&&n.listener.dispose(n);for(let a=0;a<r.length;a++){let c=r[a];c.dispose&&c.dispose(n)}this.animState.trackEntryPool.free(n);break;case Hi.complete:n.listener&&n.listener.complete&&n.listener.complete(n);for(let a=0;a<r.length;a++){let c=r[a];c.complete&&c.complete(n)}break;case Hi.event:let o=e[t+++2];n.listener&&n.listener.event&&n.listener.event(n,o);for(let a=0;a<r.length;a++){let c=r[a];c.event&&c.event(n,o)}break}}this.clear(),this.drainDisabled=!1}clear(){this.objects.length=0}};var Hi;(function(s){s[s.start=0]="start",s[s.interrupt=1]="interrupt",s[s.end=2]="end",s[s.dispose=3]="dispose",s[s.complete=4]="complete",s[s.event=5]="event"})(Hi||(Hi={}));const df=0,Wv=1,zv=2,ff=3,aP=4,qv=1,lP=2;class cP{constructor(e){M(this,"skeletonData");M(this,"animationToMixTime",{});M(this,"defaultMix",0);if(!e)throw new Error("skeletonData cannot be null.");this.skeletonData=e}setMix(e,t,i){let n=this.skeletonData.findAnimation(e);if(!n)throw new Error("Animation not found: "+e);let r=this.skeletonData.findAnimation(t);if(!r)throw new Error("Animation not found: "+t);this.setMixWith(n,r,i)}setMixWith(e,t,i){if(!e)throw new Error("from cannot be null.");if(!t)throw new Error("to cannot be null.");let n=e.name+"."+t.name;this.animationToMixTime[n]=i}getMix(e,t){let i=e.name+"."+t.name,n=this.animationToMixTime[i];return n===void 0?this.defaultMix:n}}let yw=class xw extends zn{constructor(t){super(t);M(this,"color",new lt(1,1,1,1))}copy(){let t=new xw(this.name);return this.copyTo(t),t.color.setFromColor(this.color),t}},na=class bw extends zn{constructor(t){super(t);M(this,"endSlot",null);M(this,"color",new lt(.2275,.2275,.8078,1))}copy(){let t=new bw(this.name);return this.copyTo(t),t.endSlot=this.endSlot,t.color.setFromColor(this.color),t}},hP=class{constructor(e){M(this,"_image");this._image=e}getImage(){return this._image}};var yi;(function(s){s[s.Nearest=9728]="Nearest",s[s.Linear=9729]="Linear",s[s.MipMap=9987]="MipMap",s[s.MipMapNearestNearest=9984]="MipMapNearestNearest",s[s.MipMapLinearNearest=9985]="MipMapLinearNearest",s[s.MipMapNearestLinear=9986]="MipMapNearestLinear",s[s.MipMapLinearLinear=9987]="MipMapLinearLinear"})(yi||(yi={}));var Vn;(function(s){s[s.MirroredRepeat=33648]="MirroredRepeat",s[s.ClampToEdge=33071]="ClampToEdge",s[s.Repeat=10497]="Repeat"})(Vn||(Vn={}));let uP=class{constructor(){M(this,"texture");M(this,"u",0);M(this,"v",0);M(this,"u2",0);M(this,"v2",0);M(this,"width",0);M(this,"height",0);M(this,"degrees",0);M(this,"offsetX",0);M(this,"offsetY",0);M(this,"originalWidth",0);M(this,"originalHeight",0)}},ww=class{constructor(e){M(this,"pages",new Array);M(this,"regions",new Array);let t=new dP(e),i=new Array(4),n={};n.size=h=>{h.width=parseInt(i[1]),h.height=parseInt(i[2])},n.format=()=>{},n.filter=h=>{h.minFilter=Pe.enumValue(yi,i[1]),h.magFilter=Pe.enumValue(yi,i[2])},n.repeat=h=>{i[1].indexOf("x")!=-1&&(h.uWrap=Vn.Repeat),i[1].indexOf("y")!=-1&&(h.vWrap=Vn.Repeat)},n.pma=h=>{h.pma=i[1]=="true"};var r={};r.xy=h=>{h.x=parseInt(i[1]),h.y=parseInt(i[2])},r.size=h=>{h.width=parseInt(i[1]),h.height=parseInt(i[2])},r.bounds=h=>{h.x=parseInt(i[1]),h.y=parseInt(i[2]),h.width=parseInt(i[3]),h.height=parseInt(i[4])},r.offset=h=>{h.offsetX=parseInt(i[1]),h.offsetY=parseInt(i[2])},r.orig=h=>{h.originalWidth=parseInt(i[1]),h.originalHeight=parseInt(i[2])},r.offsets=h=>{h.offsetX=parseInt(i[1]),h.offsetY=parseInt(i[2]),h.originalWidth=parseInt(i[3]),h.originalHeight=parseInt(i[4])},r.rotate=h=>{let u=i[1];u=="true"?h.degrees=90:u!="false"&&(h.degrees=parseInt(u))},r.index=h=>{h.index=parseInt(i[1])};let o=t.readLine();for(;o&&o.trim().length==0;)o=t.readLine();for(;!(!o||o.trim().length==0||t.readEntry(i,o)==0);)o=t.readLine();let a=null,c=null,l=null;for(;o!==null;)if(o.trim().length==0)a=null,o=t.readLine();else if(a){let h=new Sw(a,o);for(;;){let u=t.readEntry(i,o=t.readLine());if(u==0)break;let d=r[i[0]];if(d)d(h);else{c||(c=[]),l||(l=[]),c.push(i[0]);let f=[];for(let m=0;m<u;m++)f.push(parseInt(i[m+1]));l.push(f)}}h.originalWidth==0&&h.originalHeight==0&&(h.originalWidth=h.width,h.originalHeight=h.height),c&&c.length>0&&l&&l.length>0&&(h.names=c,h.values=l,c=null,l=null),h.u=h.x/a.width,h.v=h.y/a.height,h.degrees==90?(h.u2=(h.x+h.height)/a.width,h.v2=(h.y+h.width)/a.height):(h.u2=(h.x+h.width)/a.width,h.v2=(h.y+h.height)/a.height),this.regions.push(h)}else{for(a=new fP(o.trim());t.readEntry(i,o=t.readLine())!=0;){let h=n[i[0]];h&&h(a)}this.pages.push(a)}}findRegion(e){for(let t=0;t<this.regions.length;t++)if(this.regions[t].name==e)return this.regions[t];return null}setTextures(e,t=""){for(let 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()}},dP=class{constructor(e){M(this,"lines");M(this,"index",0);this.lines=e.split(/\r\n|\r|\n/)}readLine(){return this.index>=this.lines.length?null:this.lines[this.index++]}readEntry(e,t){if(!t||(t=t.trim(),t.length==0))return 0;let i=t.indexOf(":");if(i==-1)return 0;e[0]=t.substr(0,i).trim();for(let n=1,r=i+1;;n++){let o=t.indexOf(",",r);if(o==-1)return e[n]=t.substr(r).trim(),n;if(e[n]=t.substr(r,o-r).trim(),r=o+1,n==4)return 4}}},fP=class{constructor(e){M(this,"name");M(this,"minFilter",yi.Nearest);M(this,"magFilter",yi.Nearest);M(this,"uWrap",Vn.ClampToEdge);M(this,"vWrap",Vn.ClampToEdge);M(this,"texture",null);M(this,"width",0);M(this,"height",0);M(this,"pma",!1);M(this,"regions",new Array);this.name=e}setTexture(e){this.texture=e,e.setFilters(this.minFilter,this.magFilter),e.setWraps(this.uWrap,this.vWrap);for(let t of this.regions)t.texture=e}},Sw=class extends uP{constructor(t,i){super();M(this,"page");M(this,"name");M(this,"x",0);M(this,"y",0);M(this,"offsetX",0);M(this,"offsetY",0);M(this,"originalWidth",0);M(this,"originalHeight",0);M(this,"index",0);M(this,"degrees",0);M(this,"names",null);M(this,"values",null);this.page=t,this.name=i,t.regions.push(this)}},Ol=class wm extends zn{constructor(t,i){super(t);M(this,"region",null);M(this,"path");M(this,"regionUVs",[]);M(this,"uvs",[]);M(this,"triangles",[]);M(this,"color",new lt(1,1,1,1));M(this,"width",0);M(this,"height",0);M(this,"hullLength",0);M(this,"edges",[]);M(this,"parentMesh",null);M(this,"sequence",null);M(this,"tempColor",new lt(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=Pe.newFloatArray(t.length));let i=this.uvs,n=this.uvs.length,r=this.region.u,o=this.region.v,a=0,c=0;if(this.region instanceof Sw){let l=this.region,h=l.page,u=h.width,d=h.height;switch(l.degrees){case 90:r-=(l.originalHeight-l.offsetY-l.height)/u,o-=(l.originalWidth-l.offsetX-l.width)/d,a=l.originalHeight/u,c=l.originalWidth/d;for(let f=0;f<n;f+=2)i[f]=r+t[f+1]*a,i[f+1]=o+(1-t[f])*c;return;case 180:r-=(l.originalWidth-l.offsetX-l.width)/u,o-=l.offsetY/d,a=l.originalWidth/u,c=l.originalHeight/d;for(let f=0;f<n;f+=2)i[f]=r+(1-t[f])*a,i[f+1]=o+(1-t[f+1])*c;return;case 270:r-=l.offsetY/u,o-=l.offsetX/d,a=l.originalHeight/u,c=l.originalWidth/d;for(let f=0;f<n;f+=2)i[f]=r+(1-t[f+1])*a,i[f+1]=o+t[f]*c;return}r-=l.offsetX/u,o-=(l.originalHeight-l.offsetY-l.height)/d,a=l.originalWidth/u,c=l.originalHeight/d}else this.region?(a=this.region.u2-r,c=this.region.v2-o):(r=o=0,a=c=1);for(let l=0;l<n;l+=2)i[l]=r+t[l]*a,i[l+1]=o+t[l+1]*c}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 wm(this.name,this.path);return t.region=this.region,t.color.setFromColor(this.color),this.copyTo(t),t.regionUVs=new Array(this.regionUVs.length),Pe.arrayCopy(this.regionUVs,0,t.regionUVs,0,this.regionUVs.length),t.uvs=this.uvs instanceof Float32Array?Pe.newFloatArray(this.uvs.length):new Array(this.uvs.length),Pe.arrayCopy(this.uvs,0,t.uvs,0,this.uvs.length),t.triangles=new Array(this.triangles.length),Pe.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),Pe.arrayCopy(this.edges,0,t.edges,0,this.edges.length)),t.width=this.width,t.height=this.height,t}computeWorldVertices(t,i,n,r,o,a){this.sequence!=null&&this.sequence.apply(t,this),super.computeWorldVertices(t,i,n,r,o,a)}newLinkedMesh(){let t=new wm(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}},Ml=class Mw extends zn{constructor(t){super(t);M(this,"lengths",[]);M(this,"closed",!1);M(this,"constantSpeed",!1);M(this,"color",new lt(1,1,1,1))}copy(){let t=new Mw(this.name);return this.copyTo(t),t.lengths=new Array(this.lengths.length),Pe.arrayCopy(this.lengths,0,t.lengths,0,this.lengths.length),t.closed=closed,t.constantSpeed=this.constantSpeed,t.color.setFromColor(this.color),t}},Tw=class _w extends zn{constructor(t){super(t);M(this,"x",0);M(this,"y",0);M(this,"rotation",0);M(this,"color",new lt(.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*Re.degRad,n=Math.cos(i),r=Math.sin(i),o=n*t.a+r*t.b,a=n*t.c+r*t.d;return Re.atan2Deg(a,o)}copy(){let t=new _w(this.name);return t.x=this.x,t.y=this.y,t.rotation=this.rotation,t.color.setFromColor(this.color),t}};var dt;let gu=(dt=class extends U1{constructor(t,i){super(t);M(this,"x",0);M(this,"y",0);M(this,"scaleX",1);M(this,"scaleY",1);M(this,"rotation",0);M(this,"width",0);M(this,"height",0);M(this,"color",new lt(1,1,1,1));M(this,"path");M(this,"region",null);M(this,"sequence",null);M(this,"offset",Pe.newFloatArray(8));M(this,"uvs",Pe.newFloatArray(8));M(this,"tempColor",new lt(1,1,1,1));this.path=i}updateRegion(){if(!this.region)throw new Error("Region not set.");let t=this.region,i=this.uvs;if(t==null){i[0]=0,i[1]=0,i[2]=0,i[3]=1,i[4]=1,i[5]=1,i[6]=1,i[7]=0;return}let n=this.width/this.region.originalWidth*this.scaleX,r=this.height/this.region.originalHeight*this.scaleY,o=-this.width/2*this.scaleX+this.region.offsetX*n,a=-this.height/2*this.scaleY+this.region.offsetY*r,c=o+this.region.width*n,l=a+this.region.height*r,h=this.rotation*Re.degRad,u=Math.cos(h),d=Math.sin(h),f=this.x,m=this.y,p=o*u+f,g=o*d,x=a*u+m,v=a*d,y=c*u+f,S=c*d,C=l*u+m,w=l*d,b=this.offset;b[0]=p-v,b[1]=x+g,b[2]=p-w,b[3]=C+g,b[4]=y-w,b[5]=C+S,b[6]=y-v,b[7]=x+S,t.degrees==90?(i[0]=t.u2,i[1]=t.v2,i[2]=t.u,i[3]=t.v2,i[4]=t.u,i[5]=t.v,i[6]=t.u2,i[7]=t.v):(i[0]=t.u,i[1]=t.v2,i[2]=t.u,i[3]=t.v,i[4]=t.u2,i[5]=t.v,i[6]=t.u2,i[7]=t.v2)}computeWorldVertices(t,i,n,r){this.sequence!=null&&this.sequence.apply(t,this);let o=t.bone,a=this.offset,c=o.worldX,l=o.worldY,h=o.a,u=o.b,d=o.c,f=o.d,m=0,p=0;m=a[0],p=a[1],i[n]=m*h+p*u+c,i[n+1]=m*d+p*f+l,n+=r,m=a[2],p=a[3],i[n]=m*h+p*u+c,i[n+1]=m*d+p*f+l,n+=r,m=a[4],p=a[5],i[n]=m*h+p*u+c,i[n+1]=m*d+p*f+l,n+=r,m=a[6],p=a[7],i[n]=m*h+p*u+c,i[n+1]=m*d+p*f+l}copy(){let t=new dt(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,Pe.arrayCopy(this.uvs,0,t.uvs,0,8),Pe.arrayCopy(this.offset,0,t.offset,0,8),t.color.setFromColor(this.color),t.sequence=this.sequence!=null?this.sequence.copy():null,t}},M(dt,"X1",0),M(dt,"Y1",1),M(dt,"C1R",2),M(dt,"C1G",3),M(dt,"C1B",4),M(dt,"C1A",5),M(dt,"U1",6),M(dt,"V1",7),M(dt,"X2",8),M(dt,"Y2",9),M(dt,"C2R",10),M(dt,"C2G",11),M(dt,"C2B",12),M(dt,"C2A",13),M(dt,"U2",14),M(dt,"V2",15),M(dt,"X3",16),M(dt,"Y3",17),M(dt,"C3R",18),M(dt,"C3G",19),M(dt,"C3B",20),M(dt,"C3A",21),M(dt,"U3",22),M(dt,"V3",23),M(dt,"X4",24),M(dt,"Y4",25),M(dt,"C4R",26),M(dt,"C4G",27),M(dt,"C4B",28),M(dt,"C4A",29),M(dt,"U4",30),M(dt,"V4",31),dt);class Sm{constructor(e){M(this,"atlas");this.atlas=e}loadSequence(e,t,i){let n=i.regions;for(let r=0,o=n.length;r<o;r++){let a=i.getPath(t,r),c=this.atlas.findRegion(a);if(c==null)throw new Error("Region not found in atlas: "+a+" (sequence: "+e+")");n[r]=c}}newRegionAttachment(e,t,i,n){let r=new gu(t,i);if(n!=null)this.loadSequence(t,i,n);else{let o=this.atlas.findRegion(i);if(!o)throw new Error("Region not found in atlas: "+i+" (region attachment: "+t+")");r.region=o}return r}newMeshAttachment(e,t,i,n){let r=new Ol(t,i);if(n!=null)this.loadSequence(t,i,n);else{let o=this.atlas.findRegion(i);if(!o)throw new Error("Region not found in atlas: "+i+" (mesh attachment: "+t+")");r.region=o}return r}newBoundingBoxAttachment(e,t){return new yw(t)}newPathAttachment(e,t){return new Ml(t)}newPointAttachment(e,t){return new Tw(t)}newClippingAttachment(e,t){return new na(t)}}let Cw=class{constructor(e,t,i){M(this,"index",0);M(this,"name");M(this,"parent",null);M(this,"length",0);M(this,"x",0);M(this,"y",0);M(this,"rotation",0);M(this,"scaleX",1);M(this,"scaleY",1);M(this,"shearX",0);M(this,"shearY",0);M(this,"inherit",qt.Normal);M(this,"skinRequired",!1);M(this,"color",new lt);M(this,"icon");M(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 qt;(function(s){s[s.Normal=0]="Normal",s[s.OnlyTranslation=1]="OnlyTranslation",s[s.NoRotationOrReflection=2]="NoRotationOrReflection",s[s.NoScale=3]="NoScale",s[s.NoScaleOrReflection=4]="NoScaleOrReflection"})(qt||(qt={}));let Kv=class{constructor(e,t,i){M(this,"data");M(this,"skeleton");M(this,"parent",null);M(this,"children",new Array);M(this,"x",0);M(this,"y",0);M(this,"rotation",0);M(this,"scaleX",0);M(this,"scaleY",0);M(this,"shearX",0);M(this,"shearY",0);M(this,"ax",0);M(this,"ay",0);M(this,"arotation",0);M(this,"ascaleX",0);M(this,"ascaleY",0);M(this,"ashearX",0);M(this,"ashearY",0);M(this,"a",0);M(this,"b",0);M(this,"c",0);M(this,"d",0);M(this,"worldY",0);M(this,"worldX",0);M(this,"inherit",qt.Normal);M(this,"sorted",!1);M(this,"active",!1);if(!e)throw new Error("data cannot be null.");if(!t)throw new Error("skeleton cannot be null.");this.data=e,this.skeleton=t,this.parent=i,this.setToSetupPose()}isActive(){return this.active}update(e){this.updateWorldTransformWith(this.ax,this.ay,this.arotation,this.ascaleX,this.ascaleY,this.ashearX,this.ashearY)}updateWorldTransform(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)}updateWorldTransformWith(e,t,i,n,r,o,a){this.ax=e,this.ay=t,this.arotation=i,this.ascaleX=n,this.ascaleY=r,this.ashearX=o,this.ashearY=a;let c=this.parent;if(!c){let f=this.skeleton;const m=f.scaleX,p=f.scaleY,g=(i+o)*Re.degRad,x=(i+90+a)*Re.degRad;this.a=Math.cos(g)*n*m,this.b=Math.cos(x)*r*m,this.c=Math.sin(g)*n*p,this.d=Math.sin(x)*r*p,this.worldX=e*m+f.x,this.worldY=t*p+f.y;return}let l=c.a,h=c.b,u=c.c,d=c.d;switch(this.worldX=l*e+h*t+c.worldX,this.worldY=u*e+d*t+c.worldY,this.inherit){case qt.Normal:{const f=(i+o)*Re.degRad,m=(i+90+a)*Re.degRad,p=Math.cos(f)*n,g=Math.cos(m)*r,x=Math.sin(f)*n,v=Math.sin(m)*r;this.a=l*p+h*x,this.b=l*g+h*v,this.c=u*p+d*x,this.d=u*g+d*v;return}case qt.OnlyTranslation:{const f=(i+o)*Re.degRad,m=(i+90+a)*Re.degRad;this.a=Math.cos(f)*n,this.b=Math.cos(m)*r,this.c=Math.sin(f)*n,this.d=Math.sin(m)*r;break}case qt.NoRotationOrReflection:{let f=1/this.skeleton.scaleX,m=1/this.skeleton.scaleY;l*=f,u*=m;let p=l*l+u*u,g=0;p>1e-4?(p=Math.abs(l*d*m-h*f*u)/p,h=u*p,d=l*p,g=Math.atan2(u,l)*Re.radDeg):(l=0,u=0,g=90-Math.atan2(d,h)*Re.radDeg);const x=(i+o-g)*Re.degRad,v=(i+a-g+90)*Re.degRad,y=Math.cos(x)*n,S=Math.cos(v)*r,C=Math.sin(x)*n,w=Math.sin(v)*r;this.a=l*y-h*C,this.b=l*S-h*w,this.c=u*y+d*C,this.d=u*S+d*w;break}case qt.NoScale:case qt.NoScaleOrReflection:{i*=Re.degRad;const f=Math.cos(i),m=Math.sin(i);let p=(l*f+h*m)/this.skeleton.scaleX,g=(u*f+d*m)/this.skeleton.scaleY,x=Math.sqrt(p*p+g*g);x>1e-5&&(x=1/x),p*=x,g*=x,x=Math.sqrt(p*p+g*g),this.inherit==qt.NoScale&&l*d-h*u<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(x=-x),i=Math.PI/2+Math.atan2(g,p);const v=Math.cos(i)*x,y=Math.sin(i)*x;o*=Re.degRad,a=(90+a)*Re.degRad;const S=Math.cos(o)*n,C=Math.cos(a)*r,w=Math.sin(o)*n,b=Math.sin(a)*r;this.a=p*S+v*w,this.b=p*C+v*b,this.c=g*S+y*w,this.d=g*C+y*b;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)*Re.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)*Re.radDeg;return}let t=e.a,i=e.b,n=e.c,r=e.d,o=1/(t*r-i*n),a=r*o,c=i*o,l=n*o,h=t*o,u=this.worldX-e.worldX,d=this.worldY-e.worldY;this.ax=u*a-d*c,this.ay=d*h-u*l;let f,m,p,g;if(this.inherit==qt.OnlyTranslation)f=this.a,m=this.b,p=this.c,g=this.d;else{switch(this.inherit){case qt.NoRotationOrReflection:{let C=Math.abs(t*r-i*n)/(t*t+n*n);i=-n*this.skeleton.scaleX*C/this.skeleton.scaleY,r=t*this.skeleton.scaleY*C/this.skeleton.scaleX,o=1/(t*r-i*n),a=r*o,c=i*o;break}case qt.NoScale:case qt.NoScaleOrReflection:let x=Re.cosDeg(this.rotation),v=Re.sinDeg(this.rotation);t=(t*x+i*v)/this.skeleton.scaleX,n=(n*x+r*v)/this.skeleton.scaleY;let y=Math.sqrt(t*t+n*n);y>1e-5&&(y=1/y),t*=y,n*=y,y=Math.sqrt(t*t+n*n),this.inherit==qt.NoScale&&o<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(y=-y);let S=Re.PI/2+Math.atan2(n,t);i=Math.cos(S)*y,r=Math.sin(S)*y,o=1/(t*r-i*n),a=r*o,c=i*o,l=n*o,h=t*o}f=a*this.a-c*this.c,m=a*this.b-c*this.d,p=h*this.c-l*this.a,g=h*this.d-l*this.b}if(this.ashearX=0,this.ascaleX=Math.sqrt(f*f+p*p),this.ascaleX>1e-4){let x=f*g-m*p;this.ascaleY=x/this.ascaleX,this.ashearY=-Math.atan2(f*m+p*g,x)*Re.radDeg,this.arotation=Math.atan2(p,f)*Re.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(m*m+g*g),this.ashearY=0,this.arotation=90-Math.atan2(g,m)*Re.radDeg}getWorldRotationX(){return Math.atan2(this.c,this.a)*Re.radDeg}getWorldRotationY(){return Math.atan2(this.d,this.b)*Re.radDeg}getWorldScaleX(){return Math.sqrt(this.a*this.a+this.c*this.c)}getWorldScaleY(){return Math.sqrt(this.b*this.b+this.d*this.d)}worldToLocal(e){let t=1/(this.a*this.d-this.b*this.c),i=e.x-this.worldX,n=e.y-this.worldY;return e.x=i*this.d*t-n*this.b*t,e.y=n*this.a*t-i*this.c*t,e}localToWorld(e){let t=e.x,i=e.y;return e.x=t*this.a+i*this.b+this.worldX,e.y=t*this.c+i*this.d+this.worldY,e}worldToParent(e){if(e==null)throw new Error("world cannot be null.");return this.parent==null?e:this.parent.worldToLocal(e)}parentToWorld(e){if(e==null)throw new Error("world cannot be null.");return this.parent==null?e:this.parent.localToWorld(e)}worldToLocalRotation(e){let t=Re.sinDeg(e),i=Re.cosDeg(e);return Math.atan2(this.a*t-this.c*i,this.d*i-this.b*t)*Re.radDeg+this.rotation-this.shearX}localToWorldRotation(e){e-=this.rotation-this.shearX;let t=Re.sinDeg(e),i=Re.cosDeg(e);return Math.atan2(i*this.c+t*this.d,i*this.a+t*this.b)*Re.radDeg}rotateWorld(e){e*=Re.degRad;const t=Math.sin(e),i=Math.cos(e),n=this.a,r=this.b;this.a=i*n-t*this.c,this.b=i*r-t*this.d,this.c=t*n+i*this.c,this.d=t*r+i*this.d}},vu=class{constructor(e,t,i){M(this,"name");M(this,"order");M(this,"skinRequired");this.name=e,this.order=t,this.skinRequired=i}},Ew=class{constructor(e,t){M(this,"data");M(this,"intValue",0);M(this,"floatValue",0);M(this,"stringValue",null);M(this,"time",0);M(this,"volume",0);M(this,"balance",0);if(!t)throw new Error("data cannot be null.");this.time=e,this.data=t}},Aw=class{constructor(e){M(this,"name");M(this,"intValue",0);M(this,"floatValue",0);M(this,"stringValue",null);M(this,"audioPath",null);M(this,"volume",0);M(this,"balance",0);this.name=e}},mP=class{constructor(e,t){M(this,"data");M(this,"bones");M(this,"target");M(this,"bendDirection",0);M(this,"compress",!1);M(this,"stretch",!1);M(this,"mix",1);M(this,"softness",0);M(this,"active",!1);if(!e)throw new Error("data cannot be null.");if(!t)throw new Error("skeleton cannot be null.");this.data=e,this.bones=new Array;for(let n=0;n<e.bones.length;n++){let r=t.findBone(e.bones[n].name);if(!r)throw new Error(`Couldn't find bone ${e.bones[n].name}`);this.bones.push(r)}let i=t.findBone(e.target.name);if(!i)throw new Error(`Couldn't find bone ${e.target.name}`);this.target=i,this.mix=e.mix,this.softness=e.softness,this.bendDirection=e.bendDirection,this.compress=e.compress,this.stretch=e.stretch}isActive(){return this.active}setToSetupPose(){const e=this.data;this.mix=e.mix,this.softness=e.softness,this.bendDirection=e.bendDirection,this.compress=e.compress,this.stretch=e.stretch}update(e){if(this.mix==0)return;let t=this.target,i=this.bones;switch(i.length){case 1:this.apply1(i[0],t.worldX,t.worldY,this.compress,this.stretch,this.data.uniform,this.mix);break;case 2:this.apply2(i[0],i[1],t.worldX,t.worldY,this.bendDirection,this.stretch,this.data.uniform,this.softness,this.mix);break}}apply1(e,t,i,n,r,o,a){let c=e.parent;if(!c)throw new Error("IK bone must have parent.");let l=c.a,h=c.b,u=c.c,d=c.d,f=-e.ashearX-e.arotation,m=0,p=0;switch(e.inherit){case qt.OnlyTranslation:m=(t-e.worldX)*Re.signum(e.skeleton.scaleX),p=(i-e.worldY)*Re.signum(e.skeleton.scaleY);break;case qt.NoRotationOrReflection:let v=Math.abs(l*d-h*u)/Math.max(1e-4,l*l+u*u),y=l/e.skeleton.scaleX,S=u/e.skeleton.scaleY;h=-S*v*e.skeleton.scaleX,d=y*v*e.skeleton.scaleY,f+=Math.atan2(S,y)*Re.radDeg;default:let C=t-c.worldX,w=i-c.worldY,b=l*d-h*u;Math.abs(b)<=1e-4?(m=0,p=0):(m=(C*d-w*h)/b-e.ax,p=(w*l-C*u)/b-e.ay)}f+=Math.atan2(p,m)*Re.radDeg,e.ascaleX<0&&(f+=180),f>180?f-=360:f<-180&&(f+=360);let g=e.ascaleX,x=e.ascaleY;if(n||r){switch(e.inherit){case qt.NoScale:case qt.NoScaleOrReflection:m=t-e.worldX,p=i-e.worldY}const v=e.data.length*g;if(v>1e-4){const y=m*m+p*p;if(n&&y<v*v||r&&y>v*v){const S=(Math.sqrt(y)/v-1)*a+1;g*=S,o&&(x*=S)}}}e.updateWorldTransformWith(e.ax,e.ay,e.arotation+f*a,g,x,e.ashearX,e.ashearY)}apply2(e,t,i,n,r,o,a,c,l){if(e.inherit!=qt.Normal||t.inherit!=qt.Normal)return;let h=e.ax,u=e.ay,d=e.ascaleX,f=e.ascaleY,m=d,p=f,g=t.ascaleX,x=0,v=0,y=0;d<0?(d=-d,x=180,y=-1):(x=0,y=1),f<0&&(f=-f,y=-y),g<0?(g=-g,v=180):v=0;let S=t.ax,C=0,w=0,b=0,_=e.a,A=e.b,P=e.c,E=e.d,R=Math.abs(d-f)<=1e-4;!R||o?(C=0,w=_*S+e.worldX,b=P*S+e.worldY):(C=t.ay,w=_*S+A*C+e.worldX,b=P*S+E*C+e.worldY);let O=e.parent;if(!O)throw new Error("IK parent must itself have a parent.");_=O.a,A=O.b,P=O.c,E=O.d;let U=_*E-A*P,Y=w-O.worldX,$=b-O.worldY;U=Math.abs(U)<=1e-4?0:1/U;let X=(Y*E-$*A)*U-h,D=($*_-Y*P)*U-u,F=Math.sqrt(X*X+D*D),N=t.data.length*g,k,V;if(F<1e-4){this.apply1(e,i,n,!1,o,!1,l),t.updateWorldTransformWith(S,C,0,t.ascaleX,t.ascaleY,t.ashearX,t.ashearY);return}Y=i-O.worldX,$=n-O.worldY;let G=(Y*E-$*A)*U-h,W=($*_-Y*P)*U-u,Z=G*G+W*W;if(c!=0){c*=d*(g+1)*.5;let de=Math.sqrt(Z),pe=de-F-N*d+c;if(pe>0){let he=Math.min(1,pe/(c*2))-1;he=(pe-c*(1-he*he))/de,G-=he*G,W-=he*W,Z=G*G+W*W}}e:if(R){N*=d;let de=(Z-F*F-N*N)/(2*F*N);de<-1?(de=-1,V=Math.PI*r):de>1?(de=1,V=0,o&&(_=(Math.sqrt(Z)/(F+N)-1)*l+1,m*=_,a&&(p*=_))):V=Math.acos(de)*r,_=F+N*de,A=N*Math.sin(V),k=Math.atan2(W*_-G*A,G*_+W*A)}else{_=d*N,A=f*N;let de=_*_,pe=A*A,he=Math.atan2(W,G);P=pe*F*F+de*Z-de*pe;let me=-2*pe*F,H=pe-de;if(E=me*me-4*H*P,E>=0){let ee=Math.sqrt(E);me<0&&(ee=-ee),ee=-(me+ee)*.5;let Me=ee/H,be=P/ee,ge=Math.abs(Me)<Math.abs(be)?Me:be;if(Me=Z-ge*ge,Me>=0){$=Math.sqrt(Me)*r,k=he-Math.atan2($,ge),V=Math.atan2($/f,(ge-F)/d);break e}}let z=Re.PI,K=F-_,B=K*K,L=0,j=0,ie=F+_,ue=ie*ie,fe=0;P=-_*F/(de-pe),P>=-1&&P<=1&&(P=Math.acos(P),Y=_*Math.cos(P)+F,$=A*Math.sin(P),E=Y*Y+$*$,E<B&&(z=P,B=E,K=Y,L=$),E>ue&&(j=P,ue=E,ie=Y,fe=$)),Z<=(B+ue)*.5?(k=he-Math.atan2(L*r,K),V=z*r):(k=he-Math.atan2(fe*r,ie),V=j*r)}let ne=Math.atan2(C,S)*y,oe=e.arotation;k=(k-ne)*Re.radDeg+x-oe,k>180?k-=360:k<-180&&(k+=360),e.updateWorldTransformWith(h,u,oe+k*l,m,p,0,0),oe=t.arotation,V=((V+ne)*Re.radDeg-t.ashearX)*y+v-oe,V>180?V-=360:V<-180&&(V+=360),t.updateWorldTransformWith(S,C,oe+V*l,t.ascaleX,t.ascaleY,t.ashearX,t.ashearY)}},Iw=class extends vu{constructor(t){super(t,0,!1);M(this,"bones",new Array);M(this,"_target",null);M(this,"bendDirection",0);M(this,"compress",!1);M(this,"stretch",!1);M(this,"uniform",!1);M(this,"mix",0);M(this,"softness",0)}set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("BoneData not set.")}},Rw=class extends vu{constructor(t){super(t,0,!1);M(this,"bones",new Array);M(this,"_target",null);M(this,"positionMode",un.Fixed);M(this,"spacingMode",fi.Fixed);M(this,"rotateMode",lo.Chain);M(this,"offsetRotation",0);M(this,"position",0);M(this,"spacing",0);M(this,"mixRotate",0);M(this,"mixX",0);M(this,"mixY",0)}set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("SlotData not set.")}};var un;(function(s){s[s.Fixed=0]="Fixed",s[s.Percent=1]="Percent"})(un||(un={}));var fi;(function(s){s[s.Length=0]="Length",s[s.Fixed=1]="Fixed",s[s.Percent=2]="Percent",s[s.Proportional=3]="Proportional"})(fi||(fi={}));var lo;(function(s){s[s.Tangent=0]="Tangent",s[s.Chain=1]="Chain",s[s.ChainScale=2]="ChainScale"})(lo||(lo={}));var Ri;let pP=(Ri=class{constructor(e,t){M(this,"data");M(this,"bones");M(this,"target");M(this,"position",0);M(this,"spacing",0);M(this,"mixRotate",0);M(this,"mixX",0);M(this,"mixY",0);M(this,"spaces",new Array);M(this,"positions",new Array);M(this,"world",new Array);M(this,"curves",new Array);M(this,"lengths",new Array);M(this,"segments",new Array);M(this,"active",!1);if(!e)throw new Error("data cannot be null.");if(!t)throw new Error("skeleton cannot be null.");this.data=e,this.bones=new Array;for(let n=0,r=e.bones.length;n<r;n++){let o=t.findBone(e.bones[n].name);if(!o)throw new Error(`Couldn't find bone ${e.bones[n].name}.`);this.bones.push(o)}let 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 Ml))return;let i=this.mixRotate,n=this.mixX,r=this.mixY;if(i==0&&n==0&&r==0)return;let o=this.data,a=o.rotateMode==lo.Tangent,c=o.rotateMode==lo.ChainScale,l=this.bones,h=l.length,u=a?h:h+1,d=Pe.setArraySize(this.spaces,u),f=c?this.lengths=Pe.setArraySize(this.lengths,h):[],m=this.spacing;switch(o.spacingMode){case fi.Percent:if(c)for(let w=0,b=u-1;w<b;w++){let _=l[w],A=_.data.length,P=A*_.a,E=A*_.c;f[w]=Math.sqrt(P*P+E*E)}Pe.arrayFill(d,1,u,m);break;case fi.Proportional:let S=0;for(let w=0,b=u-1;w<b;){let _=l[w],A=_.data.length;if(A<Ri.epsilon)c&&(f[w]=0),d[++w]=m;else{let P=A*_.a,E=A*_.c,R=Math.sqrt(P*P+E*E);c&&(f[w]=R),d[++w]=R,S+=R}}if(S>0){S=u/S*m;for(let w=1;w<u;w++)d[w]*=S}break;default:let C=o.spacingMode==fi.Length;for(let w=0,b=u-1;w<b;){let _=l[w],A=_.data.length;if(A<Ri.epsilon)c&&(f[w]=0),d[++w]=m;else{let P=A*_.a,E=A*_.c,R=Math.sqrt(P*P+E*E);c&&(f[w]=R),d[++w]=(C?A+m:m)*R/A}}}let p=this.computeWorldPositions(t,u,a),g=p[0],x=p[1],v=o.offsetRotation,y=!1;if(v==0)y=o.rotateMode==lo.Chain;else{y=!1;let S=this.target.bone;v*=S.a*S.d-S.b*S.c>0?Re.degRad:-.01745329277777778}for(let S=0,C=3;S<h;S++,C+=3){let w=l[S];w.worldX+=(g-w.worldX)*n,w.worldY+=(x-w.worldY)*r;let b=p[C],_=p[C+1],A=b-g,P=_-x;if(c){let E=f[S];if(E!=0){let R=(Math.sqrt(A*A+P*P)/E-1)*i+1;w.a*=R,w.c*=R}}if(g=b,x=_,i>0){let E=w.a,R=w.b,O=w.c,U=w.d,Y=0,$=0,X=0;if(a?Y=p[C-1]:d[S+1]==0?Y=p[C+2]:Y=Math.atan2(P,A),Y-=Math.atan2(O,E),y){$=Math.cos(Y),X=Math.sin(Y);let D=w.data.length;g+=(D*($*E-X*O)-A)*i,x+=(D*(X*E+$*O)-P)*i}else Y+=v;Y>Re.PI?Y-=Re.PI2:Y<-3.1415927&&(Y+=Re.PI2),Y*=i,$=Math.cos(Y),X=Math.sin(Y),w.a=$*E-X*O,w.b=$*R-X*U,w.c=X*E+$*O,w.d=X*R+$*U}w.updateAppliedTransform()}}computeWorldPositions(e,t,i){let n=this.target,r=this.position,o=this.spaces,a=Pe.setArraySize(this.positions,t*3+2),c=this.world,l=e.closed,h=e.worldVerticesLength,u=h/6,d=Ri.NONE;if(!e.constantSpeed){let D=e.lengths;u-=l?1:2;let F=D[u];this.data.positionMode==un.Percent&&(r*=F);let N;switch(this.data.spacingMode){case fi.Percent:N=F;break;case fi.Proportional:N=F/t;break;default:N=1}c=Pe.setArraySize(this.world,8);for(let k=0,V=0,G=0;k<t;k++,V+=3){let W=o[k]*N;r+=W;let Z=r;if(l)Z%=F,Z<0&&(Z+=F),G=0;else if(Z<0){d!=Ri.BEFORE&&(d=Ri.BEFORE,e.computeWorldVertices(n,2,4,c,0,2)),this.addBeforePosition(Z,c,0,a,V);continue}else if(Z>F){d!=Ri.AFTER&&(d=Ri.AFTER,e.computeWorldVertices(n,h-6,4,c,0,2)),this.addAfterPosition(Z-F,c,0,a,V);continue}for(;;G++){let ne=D[G];if(!(Z>ne)){if(G==0)Z/=ne;else{let oe=D[G-1];Z=(Z-oe)/(ne-oe)}break}}G!=d&&(d=G,l&&G==u?(e.computeWorldVertices(n,h-4,4,c,0,2),e.computeWorldVertices(n,0,4,c,4,2)):e.computeWorldVertices(n,G*6+2,8,c,0,2)),this.addCurvePosition(Z,c[0],c[1],c[2],c[3],c[4],c[5],c[6],c[7],a,V,i||k>0&&W==0)}return a}l?(h+=2,c=Pe.setArraySize(this.world,h),e.computeWorldVertices(n,2,h-4,c,0,2),e.computeWorldVertices(n,0,2,c,h-4,2),c[h-2]=c[0],c[h-1]=c[1]):(u--,h-=4,c=Pe.setArraySize(this.world,h),e.computeWorldVertices(n,2,h,c,0,2));let f=Pe.setArraySize(this.curves,u),m=0,p=c[0],g=c[1],x=0,v=0,y=0,S=0,C=0,w=0,b=0,_=0,A=0,P=0,E=0,R=0,O=0,U=0;for(let D=0,F=2;D<u;D++,F+=6)x=c[F],v=c[F+1],y=c[F+2],S=c[F+3],C=c[F+4],w=c[F+5],b=(p-x*2+y)*.1875,_=(g-v*2+S)*.1875,A=((x-y)*3-p+C)*.09375,P=((v-S)*3-g+w)*.09375,E=b*2+A,R=_*2+P,O=(x-p)*.75+b+A*.16666667,U=(v-g)*.75+_+P*.16666667,m+=Math.sqrt(O*O+U*U),O+=E,U+=R,E+=A,R+=P,m+=Math.sqrt(O*O+U*U),O+=E,U+=R,m+=Math.sqrt(O*O+U*U),O+=E+A,U+=R+P,m+=Math.sqrt(O*O+U*U),f[D]=m,p=C,g=w;this.data.positionMode==un.Percent&&(r*=m);let Y;switch(this.data.spacingMode){case fi.Percent:Y=m;break;case fi.Proportional:Y=m/t;break;default:Y=1}let $=this.segments,X=0;for(let D=0,F=0,N=0,k=0;D<t;D++,F+=3){let V=o[D]*Y;r+=V;let G=r;if(l)G%=m,G<0&&(G+=m),N=0;else if(G<0){this.addBeforePosition(G,c,0,a,F);continue}else if(G>m){this.addAfterPosition(G-m,c,h-4,a,F);continue}for(;;N++){let W=f[N];if(!(G>W)){if(N==0)G/=W;else{let Z=f[N-1];G=(G-Z)/(W-Z)}break}}if(N!=d){d=N;let W=N*6;for(p=c[W],g=c[W+1],x=c[W+2],v=c[W+3],y=c[W+4],S=c[W+5],C=c[W+6],w=c[W+7],b=(p-x*2+y)*.03,_=(g-v*2+S)*.03,A=((x-y)*3-p+C)*.006,P=((v-S)*3-g+w)*.006,E=b*2+A,R=_*2+P,O=(x-p)*.3+b+A*.16666667,U=(v-g)*.3+_+P*.16666667,X=Math.sqrt(O*O+U*U),$[0]=X,W=1;W<8;W++)O+=E,U+=R,E+=A,R+=P,X+=Math.sqrt(O*O+U*U),$[W]=X;O+=E,U+=R,X+=Math.sqrt(O*O+U*U),$[8]=X,O+=E+A,U+=R+P,X+=Math.sqrt(O*O+U*U),$[9]=X,k=0}for(G*=X;;k++){let W=$[k];if(!(G>W)){if(k==0)G/=W;else{let Z=$[k-1];G=k+(G-Z)/(W-Z)}break}}this.addCurvePosition(G*.1,p,g,x,v,y,S,C,w,a,F,i||D>0&&V==0)}return a}addBeforePosition(e,t,i,n,r){let o=t[i],a=t[i+1],c=t[i+2]-o,l=t[i+3]-a,h=Math.atan2(l,c);n[r]=o+e*Math.cos(h),n[r+1]=a+e*Math.sin(h),n[r+2]=h}addAfterPosition(e,t,i,n,r){let o=t[i+2],a=t[i+3],c=o-t[i],l=a-t[i+1],h=Math.atan2(l,c);n[r]=o+e*Math.cos(h),n[r+1]=a+e*Math.sin(h),n[r+2]=h}addCurvePosition(e,t,i,n,r,o,a,c,l,h,u,d){if(e==0||isNaN(e)){h[u]=t,h[u+1]=i,h[u+2]=Math.atan2(r-i,n-t);return}let f=e*e,m=f*e,p=1-e,g=p*p,x=g*p,v=p*e,y=v*3,S=p*y,C=y*e,w=t*x+n*S+o*C+c*m,b=i*x+r*S+a*C+l*m;h[u]=w,h[u+1]=b,d&&(e<.001?h[u+2]=Math.atan2(r-i,n-t):h[u+2]=Math.atan2(b-(i*g+r*v*2+a*f),w-(t*g+n*v*2+o*f)))}},M(Ri,"NONE",-1),M(Ri,"BEFORE",-2),M(Ri,"AFTER",-3),M(Ri,"epsilon",1e-5),Ri),gP=class{constructor(e,t){M(this,"data");M(this,"_bone",null);M(this,"inertia",0);M(this,"strength",0);M(this,"damping",0);M(this,"massInverse",0);M(this,"wind",0);M(this,"gravity",0);M(this,"mix",0);M(this,"_reset",!0);M(this,"ux",0);M(this,"uy",0);M(this,"cx",0);M(this,"cy",0);M(this,"tx",0);M(this,"ty",0);M(this,"xOffset",0);M(this,"xVelocity",0);M(this,"yOffset",0);M(this,"yVelocity",0);M(this,"rotateOffset",0);M(this,"rotateVelocity",0);M(this,"scaleOffset",0);M(this,"scaleVelocity",0);M(this,"active",!1);M(this,"skeleton");M(this,"remaining",0);M(this,"lastTime",0);this.data=e,this.skeleton=t,this.bone=t.bones[e.bone.index],this.inertia=e.inertia,this.strength=e.strength,this.damping=e.damping,this.massInverse=e.massInverse,this.wind=e.wind,this.gravity=e.gravity,this.mix=e.mix}set bone(e){this._bone=e}get bone(){if(this._bone)return this._bone;throw new Error("Bone not set.")}reset(){this.remaining=0,this.lastTime=this.skeleton.time,this._reset=!0,this.xOffset=0,this.xVelocity=0,this.yOffset=0,this.yVelocity=0,this.rotateOffset=0,this.rotateVelocity=0,this.scaleOffset=0,this.scaleVelocity=0}setToSetupPose(){const e=this.data;this.inertia=e.inertia,this.strength=e.strength,this.damping=e.damping,this.massInverse=e.massInverse,this.wind=e.wind,this.gravity=e.gravity,this.mix=e.mix}isActive(){return this.active}update(e){const t=this.mix;if(t==0)return;const i=this.data.x>0,n=this.data.y>0,r=this.data.rotate>0||this.data.shearX>0,o=this.data.scaleX>0,a=this.bone,c=a.data.length;switch(e){case pr.none:return;case pr.reset:this.reset();case pr.update:const l=this.skeleton,h=Math.max(this.skeleton.time-this.lastTime,0);this.remaining+=h,this.lastTime=l.time;const u=a.worldX,d=a.worldY;if(this._reset)this._reset=!1,this.ux=u,this.uy=d;else{let f=this.remaining,m=this.inertia,p=this.data.step,g=this.skeleton.data.referenceScale,x=-1,v=this.data.limit*h,y=v*Math.abs(l.scaleY);if(v*=Math.abs(l.scaleX),i||n){if(i){const S=(this.ux-u)*m;this.xOffset+=S>v?v:S<-v?-v:S,this.ux=u}if(n){const S=(this.uy-d)*m;this.yOffset+=S>y?y:S<-y?-y:S,this.uy=d}if(f>=p){x=Math.pow(this.damping,60*p);const S=this.massInverse*p,C=this.strength,w=this.wind*g*l.scaleX,b=this.gravity*g*l.scaleY;do i&&(this.xVelocity+=(w-this.xOffset*C)*S,this.xOffset+=this.xVelocity*p,this.xVelocity*=x),n&&(this.yVelocity-=(b+this.yOffset*C)*S,this.yOffset+=this.yVelocity*p,this.yVelocity*=x),f-=p;while(f>=p)}i&&(a.worldX+=this.xOffset*t*this.data.x),n&&(a.worldY+=this.yOffset*t*this.data.y)}if(r||o){let S=Math.atan2(a.c,a.a),C=0,w=0,b=0,_=this.cx-a.worldX,A=this.cy-a.worldY;if(_>v?_=v:_<-v&&(_=-v),A>y?A=y:A<-y&&(A=-y),r){b=(this.data.rotate+this.data.shearX)*t;let P=Math.atan2(A+this.ty,_+this.tx)-S-this.rotateOffset*b;this.rotateOffset+=(P-Math.ceil(P*Re.invPI2-.5)*Re.PI2)*m,P=this.rotateOffset*b+S,C=Math.cos(P),w=Math.sin(P),o&&(P=c*a.getWorldScaleX(),P>0&&(this.scaleOffset+=(_*C+A*w)*m/P))}else{C=Math.cos(S),w=Math.sin(S);const P=c*a.getWorldScaleX();P>0&&(this.scaleOffset+=(_*C+A*w)*m/P)}if(f=this.remaining,f>=p){x==-1&&(x=Math.pow(this.damping,60*p));const P=this.massInverse*p,E=this.strength,R=this.wind,O=Ip.yDown?-this.gravity:this.gravity,U=c/g;for(;;)if(f-=p,o&&(this.scaleVelocity+=(R*C-O*w-this.scaleOffset*E)*P,this.scaleOffset+=this.scaleVelocity*p,this.scaleVelocity*=x),r){if(this.rotateVelocity-=((R*w+O*C)*U+this.rotateOffset*E)*P,this.rotateOffset+=this.rotateVelocity*p,this.rotateVelocity*=x,f<p)break;const Y=this.rotateOffset*b+S;C=Math.cos(Y),w=Math.sin(Y)}else if(f<p)break}}this.remaining=f}this.cx=a.worldX,this.cy=a.worldY;break;case pr.pose:i&&(a.worldX+=this.xOffset*t*this.data.x),n&&(a.worldY+=this.yOffset*t*this.data.y)}if(r){let l=this.rotateOffset*t,h=0,u=0,d=0;if(this.data.shearX>0){let f=0;this.data.rotate>0&&(f=l*this.data.rotate,h=Math.sin(f),u=Math.cos(f),d=a.b,a.b=u*d-h*a.d,a.d=h*d+u*a.d),f+=l*this.data.shearX,h=Math.sin(f),u=Math.cos(f),d=a.a,a.a=u*d-h*a.c,a.c=h*d+u*a.c}else l*=this.data.rotate,h=Math.sin(l),u=Math.cos(l),d=a.a,a.a=u*d-h*a.c,a.c=h*d+u*a.c,d=a.b,a.b=u*d-h*a.d,a.d=h*d+u*a.d}if(o){const l=1+this.scaleOffset*t*this.data.scaleX;a.a*=l,a.c*=l}e!=pr.pose&&(this.tx=c*a.a,this.ty=c*a.c),a.updateAppliedTransform()}translate(e,t){this.ux-=e,this.uy-=t,this.cx-=e,this.cy-=t}rotate(e,t,i){const n=i*Re.degRad,r=Math.cos(n),o=Math.sin(n),a=this.cx-e,c=this.cy-t;this.translate(a*r-c*o-a,a*o+c*r-c)}},vP=class{constructor(e,t){M(this,"data");M(this,"bone");M(this,"color");M(this,"darkColor",null);M(this,"attachment",null);M(this,"attachmentState",0);M(this,"sequenceIndex",-1);M(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 lt,this.darkColor=e.darkColor?new lt:null,this.setToSetupPose()}getSkeleton(){return this.bone.skeleton}getAttachment(){return this.attachment}setAttachment(e){this.attachment!=e&&((!(e instanceof zn)||!(this.attachment instanceof zn)||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}},yP=class{constructor(e,t){M(this,"data");M(this,"bones");M(this,"target");M(this,"mixRotate",0);M(this,"mixX",0);M(this,"mixY",0);M(this,"mixScaleX",0);M(this,"mixScaleY",0);M(this,"mixShearY",0);M(this,"temp",new bh);M(this,"active",!1);if(!e)throw new Error("data cannot be null.");if(!t)throw new Error("skeleton cannot be null.");this.data=e,this.bones=new Array;for(let n=0;n<e.bones.length;n++){let r=t.findBone(e.bones[n].name);if(!r)throw new Error(`Couldn't find bone ${e.bones[n].name}.`);this.bones.push(r)}let i=t.findBone(e.target.name);if(!i)throw new Error(`Couldn't find target bone ${e.target.name}.`);this.target=i,this.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY,this.mixScaleX=e.mixScaleX,this.mixScaleY=e.mixScaleY,this.mixShearY=e.mixShearY}isActive(){return this.active}setToSetupPose(){const e=this.data;this.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY,this.mixScaleX=e.mixScaleX,this.mixScaleY=e.mixScaleY,this.mixShearY=e.mixShearY}update(e){this.mixRotate==0&&this.mixX==0&&this.mixY==0&&this.mixScaleX==0&&this.mixScaleY==0&&this.mixShearY==0||(this.data.local?this.data.relative?this.applyRelativeLocal():this.applyAbsoluteLocal():this.data.relative?this.applyRelativeWorld():this.applyAbsoluteWorld())}applyAbsoluteWorld(){let e=this.mixRotate,t=this.mixX,i=this.mixY,n=this.mixScaleX,r=this.mixScaleY,o=this.mixShearY,a=t!=0||i!=0,c=this.target,l=c.a,h=c.b,u=c.c,d=c.d,f=l*d-h*u>0?Re.degRad:-.01745329277777778,m=this.data.offsetRotation*f,p=this.data.offsetShearY*f,g=this.bones;for(let x=0,v=g.length;x<v;x++){let y=g[x];if(e!=0){let S=y.a,C=y.b,w=y.c,b=y.d,_=Math.atan2(u,l)-Math.atan2(w,S)+m;_>Re.PI?_-=Re.PI2:_<-3.1415927&&(_+=Re.PI2),_*=e;let A=Math.cos(_),P=Math.sin(_);y.a=A*S-P*w,y.b=A*C-P*b,y.c=P*S+A*w,y.d=P*C+A*b}if(a){let S=this.temp;c.localToWorld(S.set(this.data.offsetX,this.data.offsetY)),y.worldX+=(S.x-y.worldX)*t,y.worldY+=(S.y-y.worldY)*i}if(n!=0){let S=Math.sqrt(y.a*y.a+y.c*y.c);S!=0&&(S=(S+(Math.sqrt(l*l+u*u)-S+this.data.offsetScaleX)*n)/S),y.a*=S,y.c*=S}if(r!=0){let S=Math.sqrt(y.b*y.b+y.d*y.d);S!=0&&(S=(S+(Math.sqrt(h*h+d*d)-S+this.data.offsetScaleY)*r)/S),y.b*=S,y.d*=S}if(o>0){let S=y.b,C=y.d,w=Math.atan2(C,S),b=Math.atan2(d,h)-Math.atan2(u,l)-(w-Math.atan2(y.c,y.a));b>Re.PI?b-=Re.PI2:b<-3.1415927&&(b+=Re.PI2),b=w+(b+p)*o;let _=Math.sqrt(S*S+C*C);y.b=Math.cos(b)*_,y.d=Math.sin(b)*_}y.updateAppliedTransform()}}applyRelativeWorld(){let e=this.mixRotate,t=this.mixX,i=this.mixY,n=this.mixScaleX,r=this.mixScaleY,o=this.mixShearY,a=t!=0||i!=0,c=this.target,l=c.a,h=c.b,u=c.c,d=c.d,f=l*d-h*u>0?Re.degRad:-.01745329277777778,m=this.data.offsetRotation*f,p=this.data.offsetShearY*f,g=this.bones;for(let x=0,v=g.length;x<v;x++){let y=g[x];if(e!=0){let S=y.a,C=y.b,w=y.c,b=y.d,_=Math.atan2(u,l)+m;_>Re.PI?_-=Re.PI2:_<-3.1415927&&(_+=Re.PI2),_*=e;let A=Math.cos(_),P=Math.sin(_);y.a=A*S-P*w,y.b=A*C-P*b,y.c=P*S+A*w,y.d=P*C+A*b}if(a){let S=this.temp;c.localToWorld(S.set(this.data.offsetX,this.data.offsetY)),y.worldX+=S.x*t,y.worldY+=S.y*i}if(n!=0){let S=(Math.sqrt(l*l+u*u)-1+this.data.offsetScaleX)*n+1;y.a*=S,y.c*=S}if(r!=0){let S=(Math.sqrt(h*h+d*d)-1+this.data.offsetScaleY)*r+1;y.b*=S,y.d*=S}if(o>0){let S=Math.atan2(d,h)-Math.atan2(u,l);S>Re.PI?S-=Re.PI2:S<-3.1415927&&(S+=Re.PI2);let C=y.b,w=y.d;S=Math.atan2(w,C)+(S-Re.PI/2+p)*o;let b=Math.sqrt(C*C+w*w);y.b=Math.cos(S)*b,y.d=Math.sin(S)*b}y.updateAppliedTransform()}}applyAbsoluteLocal(){let e=this.mixRotate,t=this.mixX,i=this.mixY,n=this.mixScaleX,r=this.mixScaleY,o=this.mixShearY,a=this.target,c=this.bones;for(let l=0,h=c.length;l<h;l++){let u=c[l],d=u.arotation;e!=0&&(d+=(a.arotation-d+this.data.offsetRotation)*e);let f=u.ax,m=u.ay;f+=(a.ax-f+this.data.offsetX)*t,m+=(a.ay-m+this.data.offsetY)*i;let p=u.ascaleX,g=u.ascaleY;n!=0&&p!=0&&(p=(p+(a.ascaleX-p+this.data.offsetScaleX)*n)/p),r!=0&&g!=0&&(g=(g+(a.ascaleY-g+this.data.offsetScaleY)*r)/g);let x=u.ashearY;o!=0&&(x+=(a.ashearY-x+this.data.offsetShearY)*o),u.updateWorldTransformWith(f,m,d,p,g,u.ashearX,x)}}applyRelativeLocal(){let e=this.mixRotate,t=this.mixX,i=this.mixY,n=this.mixScaleX,r=this.mixScaleY,o=this.mixShearY,a=this.target,c=this.bones;for(let l=0,h=c.length;l<h;l++){let u=c[l],d=u.arotation+(a.arotation+this.data.offsetRotation)*e,f=u.ax+(a.ax+this.data.offsetX)*t,m=u.ay+(a.ay+this.data.offsetY)*i,p=u.ascaleX*((a.ascaleX-1+this.data.offsetScaleX)*n+1),g=u.ascaleY*((a.ascaleY-1+this.data.offsetScaleY)*r+1),x=u.ashearY+(a.ashearY+this.data.offsetShearY)*o;u.updateWorldTransformWith(f,m,d,p,g,u.ashearX,x)}}};var Pn;let Ip=(Pn=class{constructor(e){M(this,"data");M(this,"bones");M(this,"slots");M(this,"drawOrder");M(this,"ikConstraints");M(this,"transformConstraints");M(this,"pathConstraints");M(this,"physicsConstraints");M(this,"_updateCache",new Array);M(this,"skin",null);M(this,"color");M(this,"scaleX",1);M(this,"_scaleY",1);M(this,"x",0);M(this,"y",0);M(this,"time",0);if(!e)throw new Error("data cannot be null.");this.data=e,this.bones=new Array;for(let t=0;t<e.bones.length;t++){let i=e.bones[t],n;if(!i.parent)n=new Kv(i,this,null);else{let r=this.bones[i.parent.index];n=new Kv(i,this,r),r.children.push(n)}this.bones.push(n)}this.slots=new Array,this.drawOrder=new Array;for(let t=0;t<e.slots.length;t++){let i=e.slots[t],n=this.bones[i.boneData.index],r=new vP(i,n);this.slots.push(r),this.drawOrder.push(r)}this.ikConstraints=new Array;for(let t=0;t<e.ikConstraints.length;t++){let i=e.ikConstraints[t];this.ikConstraints.push(new mP(i,this))}this.transformConstraints=new Array;for(let t=0;t<e.transformConstraints.length;t++){let i=e.transformConstraints[t];this.transformConstraints.push(new yP(i,this))}this.pathConstraints=new Array;for(let t=0;t<e.pathConstraints.length;t++){let i=e.pathConstraints[t];this.pathConstraints.push(new pP(i,this))}this.physicsConstraints=new Array;for(let t=0;t<e.physicsConstraints.length;t++){let i=e.physicsConstraints[t];this.physicsConstraints.push(new gP(i,this))}this.color=new lt(1,1,1,1),this.updateCache()}get scaleY(){return Pn.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 m=t[d];m.sorted=m.data.skinRequired,m.active=!m.sorted}if(this.skin){let d=this.skin.bones;for(let f=0,m=this.skin.bones.length;f<m;f++){let p=this.bones[d[f].index];do p.sorted=!1,p.active=!0,p=p.parent;while(p)}}let i=this.ikConstraints,n=this.transformConstraints,r=this.pathConstraints,o=this.physicsConstraints,a=i.length,c=n.length,l=r.length,h=this.physicsConstraints.length,u=a+c+l+h;e:for(let d=0;d<u;d++){for(let f=0;f<a;f++){let m=i[f];if(m.data.order==d){this.sortIkConstraint(m);continue e}}for(let f=0;f<c;f++){let m=n[f];if(m.data.order==d){this.sortTransformConstraint(m);continue e}}for(let f=0;f<l;f++){let m=r[f];if(m.data.order==d){this.sortPathConstraint(m);continue e}}for(let f=0;f<h;f++){const m=o[f];if(m.data.order==d){this.sortPhysicsConstraint(m);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&&Pe.contains(this.skin.constraints,e.data,!0)),!e.active)return;let t=e.target;this.sortBone(t);let i=e.bones,n=i[0];if(this.sortBone(n),i.length==1)this._updateCache.push(e),this.sortReset(n.children);else{let r=i[i.length-1];this.sortBone(r),this._updateCache.push(e),this.sortReset(n.children),r.sorted=!0}}sortPathConstraint(e){if(e.active=e.target.bone.isActive()&&(!e.data.skinRequired||this.skin&&Pe.contains(this.skin.constraints,e.data,!0)),!e.active)return;let t=e.target,i=t.data.index,n=t.bone;this.skin&&this.sortPathConstraintAttachment(this.skin,i,n),this.data.defaultSkin&&this.data.defaultSkin!=this.skin&&this.sortPathConstraintAttachment(this.data.defaultSkin,i,n);for(let c=0,l=this.data.skins.length;c<l;c++)this.sortPathConstraintAttachment(this.data.skins[c],i,n);let r=t.getAttachment();r instanceof Ml&&this.sortPathConstraintAttachmentWith(r,n);let o=e.bones,a=o.length;for(let c=0;c<a;c++)this.sortBone(o[c]);this._updateCache.push(e);for(let c=0;c<a;c++)this.sortReset(o[c].children);for(let c=0;c<a;c++)o[c].sorted=!0}sortTransformConstraint(e){if(e.active=e.target.isActive()&&(!e.data.skinRequired||this.skin&&Pe.contains(this.skin.constraints,e.data,!0)),!e.active)return;this.sortBone(e.target);let t=e.bones,i=t.length;if(e.data.local)for(let n=0;n<i;n++){let r=t[n];this.sortBone(r.parent),this.sortBone(r)}else for(let n=0;n<i;n++)this.sortBone(t[n]);this._updateCache.push(e);for(let n=0;n<i;n++)this.sortReset(t[n].children);for(let n=0;n<i;n++)t[n].sorted=!0}sortPathConstraintAttachment(e,t,i){let n=e.attachments[t];if(n)for(let r in n)this.sortPathConstraintAttachmentWith(n[r],i)}sortPathConstraintAttachmentWith(e,t){if(!(e instanceof Ml))return;let i=e.bones;if(!i)this.sortBone(t);else{let n=this.bones;for(let r=0,o=i.length;r<o;){let a=i[r++];for(a+=r;r<a;)this.sortBone(n[i[r++]])}}}sortPhysicsConstraint(e){const t=e.bone;e.active=t.active&&(!e.data.skinRequired||this.skin!=null&&Pe.contains(this.skin.constraints,e.data,!0)),e.active&&(this.sortBone(t),this._updateCache.push(e),this.sortReset(t.children),t.sorted=!0)}sortBone(e){if(!e||e.sorted)return;let t=e.parent;t&&this.sortBone(t),e.sorted=!0,this._updateCache.push(e)}sortReset(e){for(let t=0,i=e.length;t<i;t++){let n=e[t];n.active&&(n.sorted&&this.sortReset(n.children),n.sorted=!1)}}updateWorldTransform(e){if(e==null)throw new Error("physics is undefined");let t=this.bones;for(let n=0,r=t.length;n<r;n++){let o=t[n];o.ax=o.x,o.ay=o.y,o.arotation=o.rotation,o.ascaleX=o.scaleX,o.ascaleY=o.scaleY,o.ashearX=o.shearX,o.ashearY=o.shearY}let i=this._updateCache;for(let n=0,r=i.length;n<r;n++)i[n].update(e)}updateWorldTransformWith(e,t){if(!t)throw new Error("parent cannot be null.");let i=this.bones;for(let g=1,x=i.length;g<x;g++){let v=i[g];v.ax=v.x,v.ay=v.y,v.arotation=v.rotation,v.ascaleX=v.scaleX,v.ascaleY=v.scaleY,v.ashearX=v.shearX,v.ashearY=v.shearY}let n=this.getRootBone();if(!n)throw new Error("Root bone must not be null.");let r=t.a,o=t.b,a=t.c,c=t.d;n.worldX=r*this.x+o*this.y+t.worldX,n.worldY=a*this.x+c*this.y+t.worldY;const l=(n.rotation+n.shearX)*Re.degRad,h=(n.rotation+90+n.shearY)*Re.degRad,u=Math.cos(l)*n.scaleX,d=Math.cos(h)*n.scaleY,f=Math.sin(l)*n.scaleX,m=Math.sin(h)*n.scaleY;n.a=(r*u+o*f)*this.scaleX,n.b=(r*d+o*m)*this.scaleX,n.c=(a*u+c*f)*this.scaleY,n.d=(a*d+c*m)*this.scaleY;let p=this._updateCache;for(let g=0,x=p.length;g<x;g++){let v=p[g];v!=n&&v.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;Pe.arrayCopy(e,0,this.drawOrder,0,e.length);for(let t=0,i=e.length;t<i;t++)e[t].setToSetupPose()}getRootBone(){return this.bones.length==0?null:this.bones[0]}findBone(e){if(!e)throw new Error("boneName cannot be null.");let t=this.bones;for(let i=0,n=t.length;i<n;i++){let r=t[i];if(r.data.name==e)return r}return null}findSlot(e){if(!e)throw new Error("slotName cannot be null.");let t=this.slots;for(let i=0,n=t.length;i<n;i++){let r=t[i];if(r.data.name==e)return r}return null}setSkinByName(e){let t=this.data.findSkin(e);if(!t)throw new Error("Skin not found: "+e);this.setSkin(t)}setSkin(e){if(e!=this.skin){if(e)if(this.skin)e.attachAll(this,this.skin);else{let t=this.slots;for(let i=0,n=t.length;i<n;i++){let r=t[i],o=r.data.attachmentName;if(o){let a=e.getAttachment(i,o);a&&r.setAttachment(a)}}}this.skin=e,this.updateCache()}}getAttachmentByName(e,t){let i=this.data.findSlot(e);if(!i)throw new Error(`Can't find slot with name ${e}`);return this.getAttachment(i.index,t)}getAttachment(e,t){if(!t)throw new Error("attachmentName cannot be null.");if(this.skin){let i=this.skin.getAttachment(e,t);if(i)return i}return this.data.defaultSkin?this.data.defaultSkin.getAttachment(e,t):null}setAttachment(e,t){if(!e)throw new Error("slotName cannot be null.");let i=this.slots;for(let n=0,r=i.length;n<r;n++){let o=i[n];if(o.data.name==e){let a=null;if(t&&(a=this.getAttachment(n,t),!a))throw new Error("Attachment not found: "+t+", for slot: "+e);o.setAttachment(a);return}}throw new Error("Slot not found: "+e)}findIkConstraint(e){if(!e)throw new Error("constraintName cannot be null.");return this.ikConstraints.find(t=>t.data.name==e)??null}findTransformConstraint(e){if(!e)throw new Error("constraintName cannot be null.");return this.transformConstraints.find(t=>t.data.name==e)??null}findPathConstraint(e){if(!e)throw new Error("constraintName cannot be null.");return this.pathConstraints.find(t=>t.data.name==e)??null}findPhysicsConstraint(e){if(e==null)throw new Error("constraintName cannot be null.");return this.physicsConstraints.find(t=>t.data.name==e)??null}getBoundsRect(e){let t=new bh,i=new bh;return this.getBounds(t,i,void 0,e),{x:t.x,y:t.y,width:i.x,height:i.y}}getBounds(e,t,i=new Array(2),n=null){if(!e)throw new Error("offset cannot be null.");if(!t)throw new Error("size cannot be null.");let r=this.drawOrder,o=Number.POSITIVE_INFINITY,a=Number.POSITIVE_INFINITY,c=Number.NEGATIVE_INFINITY,l=Number.NEGATIVE_INFINITY;for(let h=0,u=r.length;h<u;h++){let d=r[h];if(!d.bone.active)continue;let f=0,m=null,p=null,g=d.getAttachment();if(g instanceof gu)f=8,m=Pe.setArraySize(i,f,0),g.computeWorldVertices(d,m,0,2),p=Pn.quadTriangles;else if(g instanceof Ol){let x=g;f=x.worldVerticesLength,m=Pe.setArraySize(i,f,0),x.computeWorldVertices(d,0,f,m,0,2),p=x.triangles}else if(g instanceof na&&n!=null){n.clipStart(d,g);continue}if(m&&p){n!=null&&n.isClipping()&&(n.clipTriangles(m,p,p.length),m=n.clippedVertices,f=n.clippedVertices.length);for(let x=0,v=m.length;x<v;x+=2){let y=m[x],S=m[x+1];o=Math.min(o,y),a=Math.min(a,S),c=Math.max(c,y),l=Math.max(l,S)}}n!=null&&n.clipEndWithSlot(d)}n!=null&&n.clipEnd(),e.set(o,a),t.set(c-o,l-a)}update(e){this.time+=e}physicsTranslate(e,t){const i=this.physicsConstraints;for(let n=0,r=i.length;n<r;n++)i[n].translate(e,t)}physicsRotate(e,t,i){const n=this.physicsConstraints;for(let r=0,o=n.length;r<o;r++)n[r].rotate(e,t,i)}},M(Pn,"quadTriangles",[0,1,2,2,3,0]),M(Pn,"yDown",!1),Pn);var pr;(function(s){s[s.none=0]="none",s[s.reset=1]="reset",s[s.update=2]="update",s[s.pose=3]="pose"})(pr||(pr={}));let Pw=class extends vu{constructor(t){super(t,0,!1);M(this,"_bone",null);M(this,"x",0);M(this,"y",0);M(this,"rotate",0);M(this,"scaleX",0);M(this,"shearX",0);M(this,"limit",0);M(this,"step",0);M(this,"inertia",0);M(this,"strength",0);M(this,"damping",0);M(this,"massInverse",0);M(this,"wind",0);M(this,"gravity",0);M(this,"mix",0);M(this,"inertiaGlobal",!1);M(this,"strengthGlobal",!1);M(this,"dampingGlobal",!1);M(this,"massGlobal",!1);M(this,"windGlobal",!1);M(this,"gravityGlobal",!1);M(this,"mixGlobal",!1)}set bone(t){this._bone=t}get bone(){if(this._bone)return this._bone;throw new Error("BoneData not set.")}},Sh=class{constructor(){M(this,"name",null);M(this,"bones",new Array);M(this,"slots",new Array);M(this,"skins",new Array);M(this,"defaultSkin",null);M(this,"events",new Array);M(this,"animations",new Array);M(this,"ikConstraints",new Array);M(this,"transformConstraints",new Array);M(this,"pathConstraints",new Array);M(this,"physicsConstraints",new Array);M(this,"x",0);M(this,"y",0);M(this,"width",0);M(this,"height",0);M(this,"referenceScale",100);M(this,"version",null);M(this,"hash",null);M(this,"fps",0);M(this,"imagesPath",null);M(this,"audioPath",null)}findBone(e){if(!e)throw new Error("boneName cannot be null.");let t=this.bones;for(let i=0,n=t.length;i<n;i++){let r=t[i];if(r.name==e)return r}return null}findSlot(e){if(!e)throw new Error("slotName cannot be null.");let t=this.slots;for(let i=0,n=t.length;i<n;i++){let r=t[i];if(r.name==e)return r}return null}findSkin(e){if(!e)throw new Error("skinName cannot be null.");let t=this.skins;for(let i=0,n=t.length;i<n;i++){let r=t[i];if(r.name==e)return r}return null}findEvent(e){if(!e)throw new Error("eventDataName cannot be null.");let t=this.events;for(let i=0,n=t.length;i<n;i++){let r=t[i];if(r.name==e)return r}return null}findAnimation(e){if(!e)throw new Error("animationName cannot be null.");let t=this.animations;for(let i=0,n=t.length;i<n;i++){let r=t[i];if(r.name==e)return r}return null}findIkConstraint(e){if(!e)throw new Error("constraintName cannot be null.");const t=this.ikConstraints;for(let i=0,n=t.length;i<n;i++){const r=t[i];if(r.name==e)return r}return null}findTransformConstraint(e){if(!e)throw new Error("constraintName cannot be null.");const t=this.transformConstraints;for(let i=0,n=t.length;i<n;i++){const r=t[i];if(r.name==e)return r}return null}findPathConstraint(e){if(!e)throw new Error("constraintName cannot be null.");const t=this.pathConstraints;for(let i=0,n=t.length;i<n;i++){const r=t[i];if(r.name==e)return r}return null}findPhysicsConstraint(e){if(!e)throw new Error("constraintName cannot be null.");const t=this.physicsConstraints;for(let i=0,n=t.length;i<n;i++){const r=t[i];if(r.name==e)return r}return null}},Zv=class{constructor(e=0,t,i){M(this,"slotIndex");M(this,"name");M(this,"attachment");this.slotIndex=e,this.name=t,this.attachment=i}},Mm=class{constructor(e){M(this,"name");M(this,"attachments",new Array);M(this,"bones",Array());M(this,"constraints",new Array);M(this,"color",new lt(.99607843,.61960787,.30980393,1));if(!e)throw new Error("name cannot be null.");this.name=e}setAttachment(e,t,i){if(!i)throw new Error("attachment cannot be null.");let n=this.attachments;e>=n.length&&(n.length=e+1),n[e]||(n[e]={}),n[e][t]=i}addSkin(e){for(let n=0;n<e.bones.length;n++){let r=e.bones[n],o=!1;for(let a=0;a<this.bones.length;a++)if(this.bones[a]==r){o=!0;break}o||this.bones.push(r)}for(let n=0;n<e.constraints.length;n++){let r=e.constraints[n],o=!1;for(let a=0;a<this.constraints.length;a++)if(this.constraints[a]==r){o=!0;break}o||this.constraints.push(r)}let t=e.getAttachments();for(let n=0;n<t.length;n++){var i=t[n];this.setAttachment(i.slotIndex,i.name,i.attachment)}}copySkin(e){for(let n=0;n<e.bones.length;n++){let r=e.bones[n],o=!1;for(let a=0;a<this.bones.length;a++)if(this.bones[a]==r){o=!0;break}o||this.bones.push(r)}for(let n=0;n<e.constraints.length;n++){let r=e.constraints[n],o=!1;for(let a=0;a<this.constraints.length;a++)if(this.constraints[a]==r){o=!0;break}o||this.constraints.push(r)}let t=e.getAttachments();for(let n=0;n<t.length;n++){var i=t[n];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 n in i){let r=i[n];r&&e.push(new Zv(t,n,r))}}return e}getAttachmentsForSlot(e,t){let i=this.attachments[e];if(i)for(let n in i){let r=i[n];r&&t.push(new Zv(e,n,r))}}clear(){this.attachments.length=0,this.bones.length=0,this.constraints.length=0}attachAll(e,t){let i=0;for(let n=0;n<e.slots.length;n++){let r=e.slots[n],o=r.getAttachment();if(o&&i<t.attachments.length){let a=t.attachments[i];for(let c in a){let l=a[c];if(o==l){let h=this.getAttachment(i,c);h&&r.setAttachment(h);break}}}i++}}},kw=class{constructor(e,t,i){M(this,"index",0);M(this,"name");M(this,"boneData");M(this,"color",new lt(1,1,1,1));M(this,"darkColor",null);M(this,"attachmentName",null);M(this,"blendMode",wr.Normal);M(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 wr;(function(s){s[s.Normal=0]="Normal",s[s.Additive=1]="Additive",s[s.Multiply=2]="Multiply",s[s.Screen=3]="Screen"})(wr||(wr={}));let Fw=class extends vu{constructor(t){super(t,0,!1);M(this,"bones",new Array);M(this,"_target",null);M(this,"mixRotate",0);M(this,"mixX",0);M(this,"mixY",0);M(this,"mixScaleX",0);M(this,"mixScaleY",0);M(this,"mixShearY",0);M(this,"offsetRotation",0);M(this,"offsetX",0);M(this,"offsetY",0);M(this,"offsetScaleX",0);M(this,"offsetScaleY",0);M(this,"offsetShearY",0);M(this,"relative",!1);M(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){M(this,"scale",1);M(this,"attachmentLoader");M(this,"linkedMeshes",new Array);this.attachmentLoader=e}readSkeletonData(e){let t=this.scale,i=new Sh;i.name="";let n=new xP(e),r=n.readInt32(),o=n.readInt32();i.hash=o==0&&r==0?null:o.toString(16)+r.toString(16),i.version=n.readString(),i.x=n.readFloat(),i.y=n.readFloat(),i.width=n.readFloat(),i.height=n.readFloat(),i.referenceScale=n.readFloat()*t;let a=n.readBoolean();a&&(i.fps=n.readFloat(),i.imagesPath=n.readString(),i.audioPath=n.readString());let c=0;c=n.readInt(!0);for(let h=0;h<c;h++){let u=n.readString();if(!u)throw new Error("String in string table must not be null.");n.strings.push(u)}c=n.readInt(!0);for(let h=0;h<c;h++){let u=n.readString();if(!u)throw new Error("Bone name must not be null.");let d=h==0?null:i.bones[n.readInt(!0)],f=new Cw(h,u,d);f.rotation=n.readFloat(),f.x=n.readFloat()*t,f.y=n.readFloat()*t,f.scaleX=n.readFloat(),f.scaleY=n.readFloat(),f.shearX=n.readFloat(),f.shearY=n.readFloat(),f.length=n.readFloat()*t,f.inherit=n.readByte(),f.skinRequired=n.readBoolean(),a&&(lt.rgba8888ToColor(f.color,n.readInt32()),f.icon=n.readString()??void 0,f.visible=n.readBoolean()),i.bones.push(f)}c=n.readInt(!0);for(let h=0;h<c;h++){let u=n.readString();if(!u)throw new Error("Slot name must not be null.");let d=i.bones[n.readInt(!0)],f=new kw(h,u,d);lt.rgba8888ToColor(f.color,n.readInt32());let m=n.readInt32();m!=-1&<.rgb888ToColor(f.darkColor=new lt,m),f.attachmentName=n.readStringRef(),f.blendMode=n.readInt(!0),a&&(f.visible=n.readBoolean()),i.slots.push(f)}c=n.readInt(!0);for(let h=0,u;h<c;h++){let d=n.readString();if(!d)throw new Error("IK constraint data name must not be null.");let f=new Iw(d);f.order=n.readInt(!0),u=n.readInt(!0);for(let p=0;p<u;p++)f.bones.push(i.bones[n.readInt(!0)]);f.target=i.bones[n.readInt(!0)];let m=n.readByte();f.skinRequired=(m&1)!=0,f.bendDirection=(m&2)!=0?1:-1,f.compress=(m&4)!=0,f.stretch=(m&8)!=0,f.uniform=(m&16)!=0,(m&32)!=0&&(f.mix=(m&64)!=0?n.readFloat():1),(m&128)!=0&&(f.softness=n.readFloat()*t),i.ikConstraints.push(f)}c=n.readInt(!0);for(let h=0,u;h<c;h++){let d=n.readString();if(!d)throw new Error("Transform constraint data name must not be null.");let f=new Fw(d);f.order=n.readInt(!0),u=n.readInt(!0);for(let p=0;p<u;p++)f.bones.push(i.bones[n.readInt(!0)]);f.target=i.bones[n.readInt(!0)];let m=n.readByte();f.skinRequired=(m&1)!=0,f.local=(m&2)!=0,f.relative=(m&4)!=0,(m&8)!=0&&(f.offsetRotation=n.readFloat()),(m&16)!=0&&(f.offsetX=n.readFloat()*t),(m&32)!=0&&(f.offsetY=n.readFloat()*t),(m&64)!=0&&(f.offsetScaleX=n.readFloat()),(m&128)!=0&&(f.offsetScaleY=n.readFloat()),m=n.readByte(),(m&1)!=0&&(f.offsetShearY=n.readFloat()),(m&2)!=0&&(f.mixRotate=n.readFloat()),(m&4)!=0&&(f.mixX=n.readFloat()),(m&8)!=0&&(f.mixY=n.readFloat()),(m&16)!=0&&(f.mixScaleX=n.readFloat()),(m&32)!=0&&(f.mixScaleY=n.readFloat()),(m&64)!=0&&(f.mixShearY=n.readFloat()),i.transformConstraints.push(f)}c=n.readInt(!0);for(let h=0,u;h<c;h++){let d=n.readString();if(!d)throw new Error("Path constraint data name must not be null.");let f=new Rw(d);f.order=n.readInt(!0),f.skinRequired=n.readBoolean(),u=n.readInt(!0);for(let p=0;p<u;p++)f.bones.push(i.bones[n.readInt(!0)]);f.target=i.slots[n.readInt(!0)];const m=n.readByte();f.positionMode=m&1,f.spacingMode=m>>1&3,f.rotateMode=m>>3&3,(m&128)!=0&&(f.offsetRotation=n.readFloat()),f.position=n.readFloat(),f.positionMode==un.Fixed&&(f.position*=t),f.spacing=n.readFloat(),(f.spacingMode==fi.Length||f.spacingMode==fi.Fixed)&&(f.spacing*=t),f.mixRotate=n.readFloat(),f.mixX=n.readFloat(),f.mixY=n.readFloat(),i.pathConstraints.push(f)}c=n.readInt(!0);for(let h=0,u;h<c;h++){const d=n.readString();if(!d)throw new Error("Physics constraint data name must not be null.");const f=new Pw(d);f.order=n.readInt(!0),f.bone=i.bones[n.readInt(!0)];let m=n.readByte();f.skinRequired=(m&1)!=0,(m&2)!=0&&(f.x=n.readFloat()),(m&4)!=0&&(f.y=n.readFloat()),(m&8)!=0&&(f.rotate=n.readFloat()),(m&16)!=0&&(f.scaleX=n.readFloat()),(m&32)!=0&&(f.shearX=n.readFloat()),f.limit=((m&64)!=0?n.readFloat():5e3)*t,f.step=1/n.readUnsignedByte(),f.inertia=n.readFloat(),f.strength=n.readFloat(),f.damping=n.readFloat(),f.massInverse=(m&128)!=0?n.readFloat():1,f.wind=n.readFloat(),f.gravity=n.readFloat(),m=n.readByte(),(m&1)!=0&&(f.inertiaGlobal=!0),(m&2)!=0&&(f.strengthGlobal=!0),(m&4)!=0&&(f.dampingGlobal=!0),(m&8)!=0&&(f.massGlobal=!0),(m&16)!=0&&(f.windGlobal=!0),(m&32)!=0&&(f.gravityGlobal=!0),(m&64)!=0&&(f.mixGlobal=!0),f.mix=(m&128)!=0?n.readFloat():1,i.physicsConstraints.push(f)}let l=this.readSkin(n,i,!0,a);l&&(i.defaultSkin=l,i.skins.push(l));{let h=i.skins.length;for(Pe.setArraySize(i.skins,c=h+n.readInt(!0));h<c;h++){let u=this.readSkin(n,i,!1,a);if(!u)throw new Error("readSkin() should not have returned null.");i.skins[h]=u}}c=this.linkedMeshes.length;for(let h=0;h<c;h++){let u=this.linkedMeshes[h];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,c=n.readInt(!0);for(let h=0;h<c;h++){let u=n.readString();if(!u)throw new Error("Event data name must not be null");let d=new Aw(u);d.intValue=n.readInt(!1),d.floatValue=n.readFloat(),d.stringValue=n.readString(),d.audioPath=n.readString(),d.audioPath&&(d.volume=n.readFloat(),d.balance=n.readFloat()),i.events.push(d)}c=n.readInt(!0);for(let h=0;h<c;h++){let u=n.readString();if(!u)throw new Error("Animatio name must not be null.");i.animations.push(this.readAnimation(n,u,i))}return i}readSkin(e,t,i,n){let r=null,o=0;if(i){if(o=e.readInt(!0),o==0)return null;r=new Mm("default")}else{let a=e.readString();if(!a)throw new Error("Skin name must not be null.");r=new Mm(a),n&<.rgba8888ToColor(r.color,e.readInt32()),r.bones.length=e.readInt(!0);for(let c=0,l=r.bones.length;c<l;c++)r.bones[c]=t.bones[e.readInt(!0)];for(let c=0,l=e.readInt(!0);c<l;c++)r.constraints.push(t.ikConstraints[e.readInt(!0)]);for(let c=0,l=e.readInt(!0);c<l;c++)r.constraints.push(t.transformConstraints[e.readInt(!0)]);for(let c=0,l=e.readInt(!0);c<l;c++)r.constraints.push(t.pathConstraints[e.readInt(!0)]);for(let c=0,l=e.readInt(!0);c<l;c++)r.constraints.push(t.physicsConstraints[e.readInt(!0)]);o=e.readInt(!0)}for(let a=0;a<o;a++){let c=e.readInt(!0);for(let l=0,h=e.readInt(!0);l<h;l++){let u=e.readStringRef();if(!u)throw new Error("Attachment name must not be null");let d=this.readAttachment(e,t,r,c,u,n);d&&r.setAttachment(c,u,d)}}return r}readAttachment(e,t,i,n,r,o){let a=this.scale,c=e.readByte();const l=(c&8)!=0?e.readStringRef():r;if(!l)throw new Error("Attachment name must not be null");switch(c&7){case Tn.Region:{let h=(c&16)!=0?e.readStringRef():null;const u=(c&32)!=0?e.readInt32():4294967295,d=(c&64)!=0?this.readSequence(e):null;let f=(c&128)!=0?e.readFloat():0,m=e.readFloat(),p=e.readFloat(),g=e.readFloat(),x=e.readFloat(),v=e.readFloat(),y=e.readFloat();h||(h=l);let S=this.attachmentLoader.newRegionAttachment(i,l,h,d);return S?(S.path=h,S.x=m*a,S.y=p*a,S.scaleX=g,S.scaleY=x,S.rotation=f,S.width=v*a,S.height=y*a,lt.rgba8888ToColor(S.color,u),S.sequence=d,d==null&&S.updateRegion(),S):null}case Tn.BoundingBox:{let h=this.readVertices(e,(c&16)!=0),u=o?e.readInt32():0,d=this.attachmentLoader.newBoundingBoxAttachment(i,l);return d?(d.worldVerticesLength=h.length,d.vertices=h.vertices,d.bones=h.bones,o&<.rgba8888ToColor(d.color,u),d):null}case Tn.Mesh:{let h=(c&16)!=0?e.readStringRef():l;const u=(c&32)!=0?e.readInt32():4294967295,d=(c&64)!=0?this.readSequence(e):null,f=e.readInt(!0),m=this.readVertices(e,(c&128)!=0),p=this.readFloatArray(e,m.length,1),g=this.readShortArray(e,(m.length-f-2)*3);let x=[],v=0,y=0;o&&(x=this.readShortArray(e,e.readInt(!0)),v=e.readFloat(),y=e.readFloat()),h||(h=l);let S=this.attachmentLoader.newMeshAttachment(i,l,h,d);return S?(S.path=h,lt.rgba8888ToColor(S.color,u),S.bones=m.bones,S.vertices=m.vertices,S.worldVerticesLength=m.length,S.triangles=g,S.regionUVs=p,d==null&&S.updateRegion(),S.hullLength=f<<1,S.sequence=d,o&&(S.edges=x,S.width=v*a,S.height=y*a),S):null}case Tn.LinkedMesh:{const h=(c&16)!=0?e.readStringRef():l;if(h==null)throw new Error("Path of linked mesh must not be null");const u=(c&32)!=0?e.readInt32():4294967295,d=(c&64)!=0?this.readSequence(e):null,f=(c&128)!=0,m=e.readInt(!0),p=e.readStringRef();let g=0,x=0;o&&(g=e.readFloat(),x=e.readFloat());let v=this.attachmentLoader.newMeshAttachment(i,l,h,d);return v?(v.path=h,lt.rgba8888ToColor(v.color,u),v.sequence=d,o&&(v.width=g*a,v.height=x*a),this.linkedMeshes.push(new bP(v,m,n,p,f)),v):null}case Tn.Path:{const h=(c&16)!=0,u=(c&32)!=0,d=this.readVertices(e,(c&64)!=0),f=Pe.newArray(d.length/6,0);for(let g=0,x=f.length;g<x;g++)f[g]=e.readFloat()*a;const m=o?e.readInt32():0,p=this.attachmentLoader.newPathAttachment(i,l);return p?(p.closed=h,p.constantSpeed=u,p.worldVerticesLength=d.length,p.vertices=d.vertices,p.bones=d.bones,p.lengths=f,o&<.rgba8888ToColor(p.color,m),p):null}case Tn.Point:{const h=e.readFloat(),u=e.readFloat(),d=e.readFloat(),f=o?e.readInt32():0,m=this.attachmentLoader.newPointAttachment(i,l);return m?(m.x=u*a,m.y=d*a,m.rotation=h,o&<.rgba8888ToColor(m.color,f),m):null}case Tn.Clipping:{const h=e.readInt(!0),u=this.readVertices(e,(c&16)!=0);let d=o?e.readInt32():0,f=this.attachmentLoader.newClippingAttachment(i,l);return f?(f.endSlot=t.slots[h],f.worldVerticesLength=u.length,f.vertices=u.vertices,f.bones=u.bones,o&<.rgba8888ToColor(f.color,d),f):null}}return null}readSequence(e){let t=new $1(e.readInt(!0));return t.start=e.readInt(!0),t.digits=e.readInt(!0),t.setupIndex=e.readInt(!0),t}readVertices(e,t){const i=this.scale,n=e.readInt(!0),r=new wP;if(r.length=n<<1,!t)return r.vertices=this.readFloatArray(e,r.length,i),r;let o=new Array,a=new Array;for(let c=0;c<n;c++){let l=e.readInt(!0);a.push(l);for(let h=0;h<l;h++)a.push(e.readInt(!0)),o.push(e.readFloat()*i),o.push(e.readFloat()*i),o.push(e.readFloat())}return r.vertices=Pe.toFloatArray(o),r.bones=a,r}readFloatArray(e,t,i){let n=new Array(t);if(i==1)for(let r=0;r<t;r++)n[r]=e.readFloat();else for(let r=0;r<t;r++)n[r]=e.readFloat()*i;return n}readShortArray(e,t){let i=new Array(t);for(let n=0;n<t;n++)i[n]=e.readInt(!0);return i}readAnimation(e,t,i){e.readInt(!0);let n=new Array,r=this.scale;for(let l=0,h=e.readInt(!0);l<h;l++){let u=e.readInt(!0);for(let d=0,f=e.readInt(!0);d<f;d++){let m=e.readByte(),p=e.readInt(!0),g=p-1;switch(m){case FP:{let x=new Yo(p,u);for(let v=0;v<p;v++)x.setFrame(v,e.readFloat(),e.readStringRef());n.push(x);break}case OP:{let x=e.readInt(!0),v=new J1(p,x,u),y=e.readFloat(),S=e.readUnsignedByte()/255,C=e.readUnsignedByte()/255,w=e.readUnsignedByte()/255,b=e.readUnsignedByte()/255;for(let _=0,A=0;v.setFrame(_,y,S,C,w,b),_!=g;_++){let P=e.readFloat(),E=e.readUnsignedByte()/255,R=e.readUnsignedByte()/255,O=e.readUnsignedByte()/255,U=e.readUnsignedByte()/255;switch(e.readByte()){case zs:v.setStepped(_);break;case qs:pt(e,v,A++,_,0,y,P,S,E,1),pt(e,v,A++,_,1,y,P,C,R,1),pt(e,v,A++,_,2,y,P,w,O,1),pt(e,v,A++,_,3,y,P,b,U,1)}y=P,S=E,C=R,w=O,b=U}n.push(v);break}case LP:{let x=e.readInt(!0),v=new Q1(p,x,u),y=e.readFloat(),S=e.readUnsignedByte()/255,C=e.readUnsignedByte()/255,w=e.readUnsignedByte()/255;for(let b=0,_=0;v.setFrame(b,y,S,C,w),b!=g;b++){let A=e.readFloat(),P=e.readUnsignedByte()/255,E=e.readUnsignedByte()/255,R=e.readUnsignedByte()/255;switch(e.readByte()){case zs:v.setStepped(b);break;case qs:pt(e,v,_++,b,0,y,A,S,P,1),pt(e,v,_++,b,1,y,A,C,E,1),pt(e,v,_++,b,2,y,A,w,R,1)}y=A,S=P,C=E,w=R}n.push(v);break}case BP:{let x=e.readInt(!0),v=new tw(p,x,u),y=e.readFloat(),S=e.readUnsignedByte()/255,C=e.readUnsignedByte()/255,w=e.readUnsignedByte()/255,b=e.readUnsignedByte()/255,_=e.readUnsignedByte()/255,A=e.readUnsignedByte()/255,P=e.readUnsignedByte()/255;for(let E=0,R=0;v.setFrame(E,y,S,C,w,b,_,A,P),E!=g;E++){let O=e.readFloat(),U=e.readUnsignedByte()/255,Y=e.readUnsignedByte()/255,$=e.readUnsignedByte()/255,X=e.readUnsignedByte()/255,D=e.readUnsignedByte()/255,F=e.readUnsignedByte()/255,N=e.readUnsignedByte()/255;switch(e.readByte()){case zs:v.setStepped(E);break;case qs:pt(e,v,R++,E,0,y,O,S,U,1),pt(e,v,R++,E,1,y,O,C,Y,1),pt(e,v,R++,E,2,y,O,w,$,1),pt(e,v,R++,E,3,y,O,b,X,1),pt(e,v,R++,E,4,y,O,_,D,1),pt(e,v,R++,E,5,y,O,A,F,1),pt(e,v,R++,E,6,y,O,P,N,1)}y=O,S=U,C=Y,w=$,b=X,_=D,A=F,P=N}n.push(v);break}case NP:{let x=e.readInt(!0),v=new iw(p,x,u),y=e.readFloat(),S=e.readUnsignedByte()/255,C=e.readUnsignedByte()/255,w=e.readUnsignedByte()/255,b=e.readUnsignedByte()/255,_=e.readUnsignedByte()/255,A=e.readUnsignedByte()/255;for(let P=0,E=0;v.setFrame(P,y,S,C,w,b,_,A),P!=g;P++){let R=e.readFloat(),O=e.readUnsignedByte()/255,U=e.readUnsignedByte()/255,Y=e.readUnsignedByte()/255,$=e.readUnsignedByte()/255,X=e.readUnsignedByte()/255,D=e.readUnsignedByte()/255;switch(e.readByte()){case zs:v.setStepped(P);break;case qs:pt(e,v,E++,P,0,y,R,S,O,1),pt(e,v,E++,P,1,y,R,C,U,1),pt(e,v,E++,P,2,y,R,w,Y,1),pt(e,v,E++,P,3,y,R,b,$,1),pt(e,v,E++,P,4,y,R,_,X,1),pt(e,v,E++,P,5,y,R,A,D,1)}y=R,S=O,C=U,w=Y,b=$,_=X,A=D}n.push(v);break}case DP:{let x=new ew(p,e.readInt(!0),u),v=e.readFloat(),y=e.readUnsignedByte()/255;for(let S=0,C=0;x.setFrame(S,v,y),S!=g;S++){let w=e.readFloat(),b=e.readUnsignedByte()/255;switch(e.readByte()){case zs:x.setStepped(S);break;case qs:pt(e,x,C++,S,0,v,w,y,b,1)}v=w,y=b}n.push(x)}}}}for(let l=0,h=e.readInt(!0);l<h;l++){let u=e.readInt(!0);for(let d=0,f=e.readInt(!0);d<f;d++){let m=e.readByte(),p=e.readInt(!0);if(m==kP){let x=new Z1(p,u);for(let v=0;v<p;v++)x.setFrame(v,e.readFloat(),e.readByte());n.push(x);continue}let g=e.readInt(!0);switch(m){case SP:n.push(Ei(e,new wh(p,g,u),1));break;case MP:n.push(mf(e,new V1(p,g,u),r));break;case TP:n.push(Ei(e,new Y1(p,g,u),r));break;case _P:n.push(Ei(e,new G1(p,g,u),r));break;case CP:n.push(mf(e,new j1(p,g,u),1));break;case EP:n.push(Ei(e,new H1(p,g,u),1));break;case AP:n.push(Ei(e,new W1(p,g,u),1));break;case IP:n.push(mf(e,new z1(p,g,u),1));break;case RP:n.push(Ei(e,new q1(p,g,u),1));break;case PP:n.push(Ei(e,new K1(p,g,u),1))}}}for(let l=0,h=e.readInt(!0);l<h;l++){let u=e.readInt(!0),d=e.readInt(!0),f=d-1,m=new nw(d,e.readInt(!0),u),p=e.readByte(),g=e.readFloat(),x=(p&1)!=0?(p&2)!=0?e.readFloat():1:0,v=(p&4)!=0?e.readFloat()*r:0;for(let y=0,S=0;m.setFrame(y,g,x,v,(p&8)!=0?1:-1,(p&16)!=0,(p&32)!=0),y!=f;y++){p=e.readByte();const C=e.readFloat(),w=(p&1)!=0?(p&2)!=0?e.readFloat():1:0,b=(p&4)!=0?e.readFloat()*r:0;(p&64)!=0?m.setStepped(y):(p&128)!=0&&(pt(e,m,S++,y,0,g,C,x,w,1),pt(e,m,S++,y,1,g,C,v,b,r)),g=C,x=w,v=b}n.push(m)}for(let l=0,h=e.readInt(!0);l<h;l++){let u=e.readInt(!0),d=e.readInt(!0),f=d-1,m=new rw(d,e.readInt(!0),u),p=e.readFloat(),g=e.readFloat(),x=e.readFloat(),v=e.readFloat(),y=e.readFloat(),S=e.readFloat(),C=e.readFloat();for(let w=0,b=0;m.setFrame(w,p,g,x,v,y,S,C),w!=f;w++){let _=e.readFloat(),A=e.readFloat(),P=e.readFloat(),E=e.readFloat(),R=e.readFloat(),O=e.readFloat(),U=e.readFloat();switch(e.readByte()){case zs:m.setStepped(w);break;case qs:pt(e,m,b++,w,0,p,_,g,A,1),pt(e,m,b++,w,1,p,_,x,P,1),pt(e,m,b++,w,2,p,_,v,E,1),pt(e,m,b++,w,3,p,_,y,R,1),pt(e,m,b++,w,4,p,_,S,O,1),pt(e,m,b++,w,5,p,_,C,U,1)}p=_,g=A,x=P,v=E,y=R,S=O,C=U}n.push(m)}for(let l=0,h=e.readInt(!0);l<h;l++){let u=e.readInt(!0),d=i.pathConstraints[u];for(let f=0,m=e.readInt(!0);f<m;f++){const p=e.readByte(),g=e.readInt(!0),x=e.readInt(!0);switch(p){case XP:n.push(Ei(e,new ow(g,x,u),d.positionMode==un.Fixed?r:1));break;case VP:n.push(Ei(e,new aw(g,x,u),d.spacingMode==fi.Length||d.spacingMode==fi.Fixed?r:1));break;case YP:let v=new lw(g,x,u),y=e.readFloat(),S=e.readFloat(),C=e.readFloat(),w=e.readFloat();for(let b=0,_=0,A=v.getFrameCount()-1;v.setFrame(b,y,S,C,w),b!=A;b++){let P=e.readFloat(),E=e.readFloat(),R=e.readFloat(),O=e.readFloat();switch(e.readByte()){case zs:v.setStepped(b);break;case qs:pt(e,v,_++,b,0,y,P,S,E,1),pt(e,v,_++,b,1,y,P,C,R,1),pt(e,v,_++,b,2,y,P,w,O,1)}y=P,S=E,C=R,w=O}n.push(v)}}}for(let l=0,h=e.readInt(!0);l<h;l++){const u=e.readInt(!0)-1;for(let d=0,f=e.readInt(!0);d<f;d++){const m=e.readByte(),p=e.readInt(!0);if(m==ZP){const x=new gw(p,u);for(let v=0;v<p;v++)x.setFrame(v,e.readFloat());n.push(x);continue}const g=e.readInt(!0);switch(m){case GP:n.push(Ei(e,new cw(p,g,u),1));break;case jP:n.push(Ei(e,new hw(p,g,u),1));break;case HP:n.push(Ei(e,new uw(p,g,u),1));break;case WP:n.push(Ei(e,new dw(p,g,u),1));break;case zP:n.push(Ei(e,new fw(p,g,u),1));break;case qP:n.push(Ei(e,new mw(p,g,u),1));break;case KP:n.push(Ei(e,new pw(p,g,u),1))}}}for(let l=0,h=e.readInt(!0);l<h;l++){let u=i.skins[e.readInt(!0)];for(let d=0,f=e.readInt(!0);d<f;d++){let m=e.readInt(!0);for(let p=0,g=e.readInt(!0);p<g;p++){let x=e.readStringRef();if(!x)throw new Error("attachmentName must not be null.");let v=u.getAttachment(m,x),y=e.readByte(),S=e.readInt(!0),C=S-1;switch(y){case UP:{let w=v,b=w.bones,_=w.vertices,A=b?_.length/3*2:_.length,P=e.readInt(!0),E=new sw(S,P,m,w),R=e.readFloat();for(let O=0,U=0;;O++){let Y,$=e.readInt(!0);if($==0)Y=b?Pe.newFloatArray(A):_;else{Y=Pe.newFloatArray(A);let D=e.readInt(!0);if($+=D,r==1)for(let F=D;F<$;F++)Y[F]=e.readFloat();else for(let F=D;F<$;F++)Y[F]=e.readFloat()*r;if(!b)for(let F=0,N=Y.length;F<N;F++)Y[F]+=_[F]}if(E.setFrame(O,R,Y),O==C)break;let X=e.readFloat();switch(e.readByte()){case zs:E.setStepped(O);break;case qs:pt(e,E,U++,O,0,R,X,0,1,1)}R=X}n.push(E);break}case $P:{let w=new vw(S,m,v);for(let b=0;b<S;b++){let _=e.readFloat(),A=e.readInt32();w.setFrame(b,_,X1[A&15],A>>4,e.readFloat())}n.push(w);break}}}}}let o=e.readInt(!0);if(o>0){let l=new el(o),h=i.slots.length;for(let u=0;u<o;u++){let d=e.readFloat(),f=e.readInt(!0),m=Pe.newArray(h,0);for(let v=h-1;v>=0;v--)m[v]=-1;let p=Pe.newArray(h-f,0),g=0,x=0;for(let v=0;v<f;v++){let y=e.readInt(!0);for(;g!=y;)p[x++]=g++;m[g+e.readInt(!0)]=g++}for(;g<h;)p[x++]=g++;for(let v=h-1;v>=0;v--)m[v]==-1&&(m[v]=p[--x]);l.setFrame(u,d,m)}n.push(l)}let a=e.readInt(!0);if(a>0){let l=new Ap(a);for(let h=0;h<a;h++){let u=e.readFloat(),d=i.events[e.readInt(!0)],f=new Ew(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(h,f)}n.push(l)}let c=0;for(let l=0,h=n.length;l<h;l++)c=Math.max(c,n[l].getDuration());return new Cp(t,n,c)}},xP=class{constructor(e,t=new Array,i=0,n=new DataView(e instanceof ArrayBuffer?e:e.buffer)){M(this,"strings");M(this,"index");M(this,"buffer");this.strings=t,this.index=i,this.buffer=n}readByte(){return this.buffer.getInt8(this.index++)}readUnsignedByte(){return this.buffer.getUint8(this.index++)}readShort(){let e=this.buffer.getInt16(this.index);return this.index+=2,e}readInt32(){let e=this.buffer.getInt32(this.index);return this.index+=4,e}readInt(e){let t=this.readByte(),i=t&127;return(t&128)!=0&&(t=this.readByte(),i|=(t&127)<<7,(t&128)!=0&&(t=this.readByte(),i|=(t&127)<<14,(t&128)!=0&&(t=this.readByte(),i|=(t&127)<<21,(t&128)!=0&&(t=this.readByte(),i|=(t&127)<<28)))),e?i:i>>>1^-(i&1)}readStringRef(){let e=this.readInt(!0);return e==0?null:this.strings[e-1]}readString(){let e=this.readInt(!0);switch(e){case 0:return null;case 1:return""}e--;let t="";for(let i=0;i<e;){let n=this.readUnsignedByte();switch(n>>4){case 12:case 13:t+=String.fromCharCode((n&31)<<6|this.readByte()&63),i+=2;break;case 14:t+=String.fromCharCode((n&15)<<12|(this.readByte()&63)<<6|this.readByte()&63),i+=3;break;default:t+=String.fromCharCode(n),i++}}return t}readFloat(){let e=this.buffer.getFloat32(this.index);return this.index+=4,e}readBoolean(){return this.readByte()!=0}},bP=class{constructor(e,t,i,n,r){M(this,"parent");M(this,"skinIndex");M(this,"slotIndex");M(this,"mesh");M(this,"inheritTimeline");this.mesh=e,this.skinIndex=t,this.slotIndex=i,this.parent=n,this.inheritTimeline=r}},wP=class{constructor(e=null,t=null,i=0){M(this,"bones");M(this,"vertices");M(this,"length");this.bones=e,this.vertices=t,this.length=i}};var Tn;(function(s){s[s.Region=0]="Region",s[s.BoundingBox=1]="BoundingBox",s[s.Mesh=2]="Mesh",s[s.LinkedMesh=3]="LinkedMesh",s[s.Path=4]="Path",s[s.Point=5]="Point",s[s.Clipping=6]="Clipping"})(Tn||(Tn={}));function Ei(s,e,t){let i=s.readFloat(),n=s.readFloat()*t;for(let r=0,o=0,a=e.getFrameCount()-1;e.setFrame(r,i,n),r!=a;r++){let c=s.readFloat(),l=s.readFloat()*t;switch(s.readByte()){case zs:e.setStepped(r);break;case qs:pt(s,e,o++,r,0,i,c,n,l,t)}i=c,n=l}return e}function mf(s,e,t){let i=s.readFloat(),n=s.readFloat()*t,r=s.readFloat()*t;for(let o=0,a=0,c=e.getFrameCount()-1;e.setFrame(o,i,n,r),o!=c;o++){let l=s.readFloat(),h=s.readFloat()*t,u=s.readFloat()*t;switch(s.readByte()){case zs:e.setStepped(o);break;case qs:pt(s,e,a++,o,0,i,l,n,h,t),pt(s,e,a++,o,1,i,l,r,u,t)}i=l,n=h,r=u}return e}function pt(s,e,t,i,n,r,o,a,c,l){e.setBezier(t,i,n,r,a,s.readFloat(),s.readFloat()*l,s.readFloat(),s.readFloat()*l,o,c)}const SP=0,MP=1,TP=2,_P=3,CP=4,EP=5,AP=6,IP=7,RP=8,PP=9,kP=10,FP=0,OP=1,LP=2,BP=3,NP=4,DP=5,UP=0,$P=1,XP=0,VP=1,YP=2,GP=0,jP=1,HP=2,WP=4,zP=5,qP=6,KP=7,ZP=8,zs=1,qs=2;class Wi{constructor(){M(this,"convexPolygons",new Array);M(this,"convexPolygonsIndices",new Array);M(this,"indicesArray",new Array);M(this,"isConcaveArray",new Array);M(this,"triangles",new Array);M(this,"polygonPool",new xh(()=>new Array));M(this,"polygonIndicesPool",new xh(()=>new Array))}triangulate(e){let t=e,i=e.length>>1,n=this.indicesArray;n.length=0;for(let a=0;a<i;a++)n[a]=a;let r=this.isConcaveArray;r.length=0;for(let a=0,c=i;a<c;++a)r[a]=Wi.isConcave(a,i,t,n);let o=this.triangles;for(o.length=0;i>3;){let a=i-1,c=0,l=1;for(;;){e:if(!r[c]){let d=n[a]<<1,f=n[c]<<1,m=n[l]<<1,p=t[d],g=t[d+1],x=t[f],v=t[f+1],y=t[m],S=t[m+1];for(let C=(l+1)%i;C!=a;C=(C+1)%i){if(!r[C])continue;let w=n[C]<<1,b=t[w],_=t[w+1];if(Wi.positiveArea(y,S,p,g,b,_)&&Wi.positiveArea(p,g,x,v,b,_)&&Wi.positiveArea(x,v,y,S,b,_))break e}break}if(l==0){do{if(!r[c])break;c--}while(c>0);break}a=c,c=l,l=(l+1)%i}o.push(n[(i+c-1)%i]),o.push(n[c]),o.push(n[(c+1)%i]),n.splice(c,1),r.splice(c,1),i--;let h=(i+c-1)%i,u=c==i?0:c;r[h]=Wi.isConcave(h,i,t,n),r[u]=Wi.isConcave(u,i,t,n)}return i==3&&(o.push(n[2]),o.push(n[0]),o.push(n[1])),o}decompose(e,t){let i=e,n=this.convexPolygons;this.polygonPool.freeAll(n),n.length=0;let r=this.convexPolygonsIndices;this.polygonIndicesPool.freeAll(r),r.length=0;let o=this.polygonIndicesPool.obtain();o.length=0;let a=this.polygonPool.obtain();a.length=0;let c=-1,l=0;for(let h=0,u=t.length;h<u;h+=3){let d=t[h]<<1,f=t[h+1]<<1,m=t[h+2]<<1,p=i[d],g=i[d+1],x=i[f],v=i[f+1],y=i[m],S=i[m+1],C=!1;if(c==d){let w=a.length-4,b=Wi.winding(a[w],a[w+1],a[w+2],a[w+3],y,S),_=Wi.winding(y,S,a[0],a[1],a[2],a[3]);b==l&&_==l&&(a.push(y),a.push(S),o.push(m),C=!0)}C||(a.length>0?(n.push(a),r.push(o)):(this.polygonPool.free(a),this.polygonIndicesPool.free(o)),a=this.polygonPool.obtain(),a.length=0,a.push(p),a.push(g),a.push(x),a.push(v),a.push(y),a.push(S),o=this.polygonIndicesPool.obtain(),o.length=0,o.push(d),o.push(f),o.push(m),l=Wi.winding(p,g,x,v,y,S),c=d)}a.length>0&&(n.push(a),r.push(o));for(let h=0,u=n.length;h<u;h++){if(o=r[h],o.length==0)continue;let d=o[0],f=o[o.length-1];a=n[h];let m=a.length-4,p=a[m],g=a[m+1],x=a[m+2],v=a[m+3],y=a[0],S=a[1],C=a[2],w=a[3],b=Wi.winding(p,g,x,v,y,S);for(let _=0;_<u;_++){if(_==h)continue;let A=r[_];if(A.length!=3)continue;let P=A[0],E=A[1],R=A[2],O=n[_],U=O[O.length-2],Y=O[O.length-1];if(P!=d||E!=f)continue;let $=Wi.winding(p,g,x,v,U,Y),X=Wi.winding(U,Y,y,S,C,w);$==b&&X==b&&(O.length=0,A.length=0,a.push(U),a.push(Y),o.push(R),p=x,g=v,x=U,v=Y,_=0)}}for(let h=n.length-1;h>=0;h--)a=n[h],a.length==0&&(n.splice(h,1),this.polygonPool.free(a),o=r[h],r.splice(h,1),this.polygonIndicesPool.free(o));return n}static isConcave(e,t,i,n){let r=n[(t+e-1)%t]<<1,o=n[e]<<1,a=n[(e+1)%t]<<1;return!this.positiveArea(i[r],i[r+1],i[o],i[o+1],i[a],i[a+1])}static positiveArea(e,t,i,n,r,o){return e*(o-n)+i*(t-o)+r*(n-t)>=0}static winding(e,t,i,n,r,o){let a=i-e,c=n-t;return r*c-o*a+a*t-e*c>=0?1:-1}}class Mh{constructor(){M(this,"triangulator",new Wi);M(this,"clippingPolygon",new Array);M(this,"clipOutput",new Array);M(this,"clippedVertices",new Array);M(this,"clippedUVs",new Array);M(this,"clippedTriangles",new Array);M(this,"scratch",new Array);M(this,"clipAttachment",null);M(this,"clippingPolygons",null)}clipStart(e,t){if(this.clipAttachment)return 0;this.clipAttachment=t;let i=t.worldVerticesLength,n=Pe.setArraySize(this.clippingPolygon,i);t.computeWorldVertices(e,0,i,n,0,2);let r=this.clippingPolygon;Mh.makeClockwise(r);let o=this.clippingPolygons=this.triangulator.decompose(r,this.triangulator.triangulate(r));for(let a=0,c=o.length;a<c;a++){let l=o[a];Mh.makeClockwise(l),l.push(l[0]),l.push(l[1])}return o.length}clipEndWithSlot(e){this.clipAttachment&&this.clipAttachment.endSlot==e.data&&this.clipEnd()}clipEnd(){this.clipAttachment&&(this.clipAttachment=null,this.clippingPolygons=null,this.clippedVertices.length=0,this.clippedTriangles.length=0,this.clippingPolygon.length=0)}isClipping(){return this.clipAttachment!=null}clipTriangles(e,t,i,n,r,o,a,c){let l,h,u,d,f,m;typeof t=="number"?(l=i,h=n,u=r,d=o,f=a,m=c):(l=t,h=i,u=n,d=r,f=o,m=a),u&&d&&f&&typeof m=="boolean"?this.clipTrianglesRender(e,l,h,u,d,f,m):this.clipTrianglesNoRender(e,l,h)}clipTrianglesNoRender(e,t,i){let n=this.clipOutput,r=this.clippedVertices,o=this.clippedTriangles,a=this.clippingPolygons,c=a.length,l=0;r.length=0,o.length=0;for(let h=0;h<i;h+=3){let u=t[h]<<1,d=e[u],f=e[u+1];u=t[h+1]<<1;let m=e[u],p=e[u+1];u=t[h+2]<<1;let g=e[u],x=e[u+1];for(let v=0;v<c;v++){let y=r.length;if(this.clip(d,f,m,p,g,x,a[v],n)){let S=n.length;if(S==0)continue;let C=S>>1,w=this.clipOutput,b=Pe.setArraySize(r,y+C*2);for(let A=0;A<S;A+=2,y+=2){let P=w[A],E=w[A+1];b[y]=P,b[y+1]=E}y=o.length;let _=Pe.setArraySize(o,y+3*(C-2));C--;for(let A=1;A<C;A++,y+=3)_[y]=l,_[y+1]=l+A,_[y+2]=l+A+1;l+=C+1}else{let S=Pe.setArraySize(r,y+6);S[y]=d,S[y+1]=f,S[y+2]=m,S[y+3]=p,S[y+4]=g,S[y+5]=x,y=o.length;let C=Pe.setArraySize(o,y+3);C[y]=l,C[y+1]=l+1,C[y+2]=l+2,l+=3;break}}}}clipTrianglesRender(e,t,i,n,r,o,a){let c=this.clipOutput,l=this.clippedVertices,h=this.clippedTriangles,u=this.clippingPolygons,d=u.length,f=a?12:8,m=0;l.length=0,h.length=0;for(let p=0;p<i;p+=3){let g=t[p]<<1,x=e[g],v=e[g+1],y=n[g],S=n[g+1];g=t[p+1]<<1;let C=e[g],w=e[g+1],b=n[g],_=n[g+1];g=t[p+2]<<1;let A=e[g],P=e[g+1],E=n[g],R=n[g+1];for(let O=0;O<d;O++){let U=l.length;if(this.clip(x,v,C,w,A,P,u[O],c)){let Y=c.length;if(Y==0)continue;let $=w-P,X=A-C,D=x-A,F=P-v,N=1/($*D+X*(v-P)),k=Y>>1,V=this.clipOutput,G=Pe.setArraySize(l,U+k*f);for(let Z=0;Z<Y;Z+=2,U+=f){let ne=V[Z],oe=V[Z+1];G[U]=ne,G[U+1]=oe,G[U+2]=r.r,G[U+3]=r.g,G[U+4]=r.b,G[U+5]=r.a;let de=ne-A,pe=oe-P,he=($*de+X*pe)*N,me=(F*de+D*pe)*N,H=1-he-me;G[U+6]=y*he+b*me+E*H,G[U+7]=S*he+_*me+R*H,a&&(G[U+8]=o.r,G[U+9]=o.g,G[U+10]=o.b,G[U+11]=o.a)}U=h.length;let W=Pe.setArraySize(h,U+3*(k-2));k--;for(let Z=1;Z<k;Z++,U+=3)W[U]=m,W[U+1]=m+Z,W[U+2]=m+Z+1;m+=k+1}else{let Y=Pe.setArraySize(l,U+3*f);Y[U]=x,Y[U+1]=v,Y[U+2]=r.r,Y[U+3]=r.g,Y[U+4]=r.b,Y[U+5]=r.a,a?(Y[U+6]=y,Y[U+7]=S,Y[U+8]=o.r,Y[U+9]=o.g,Y[U+10]=o.b,Y[U+11]=o.a,Y[U+12]=C,Y[U+13]=w,Y[U+14]=r.r,Y[U+15]=r.g,Y[U+16]=r.b,Y[U+17]=r.a,Y[U+18]=b,Y[U+19]=_,Y[U+20]=o.r,Y[U+21]=o.g,Y[U+22]=o.b,Y[U+23]=o.a,Y[U+24]=A,Y[U+25]=P,Y[U+26]=r.r,Y[U+27]=r.g,Y[U+28]=r.b,Y[U+29]=r.a,Y[U+30]=E,Y[U+31]=R,Y[U+32]=o.r,Y[U+33]=o.g,Y[U+34]=o.b,Y[U+35]=o.a):(Y[U+6]=y,Y[U+7]=S,Y[U+8]=C,Y[U+9]=w,Y[U+10]=r.r,Y[U+11]=r.g,Y[U+12]=r.b,Y[U+13]=r.a,Y[U+14]=b,Y[U+15]=_,Y[U+16]=A,Y[U+17]=P,Y[U+18]=r.r,Y[U+19]=r.g,Y[U+20]=r.b,Y[U+21]=r.a,Y[U+22]=E,Y[U+23]=R),U=h.length;let $=Pe.setArraySize(h,U+3);$[U]=m,$[U+1]=m+1,$[U+2]=m+2,m+=3;break}}}}clipTrianglesUnpacked(e,t,i,n){let r=this.clipOutput,o=this.clippedVertices,a=this.clippedUVs,c=this.clippedTriangles,l=this.clippingPolygons,h=l.length,u=0;o.length=0,a.length=0,c.length=0;for(let d=0;d<i;d+=3){let f=t[d]<<1,m=e[f],p=e[f+1],g=n[f],x=n[f+1];f=t[d+1]<<1;let v=e[f],y=e[f+1],S=n[f],C=n[f+1];f=t[d+2]<<1;let w=e[f],b=e[f+1],_=n[f],A=n[f+1];for(let P=0;P<h;P++){let E=o.length;if(this.clip(m,p,v,y,w,b,l[P],r)){let R=r.length;if(R==0)continue;let O=y-b,U=w-v,Y=m-w,$=b-p,X=1/(O*Y+U*(p-b)),D=R>>1,F=this.clipOutput,N=Pe.setArraySize(o,E+D*2),k=Pe.setArraySize(a,E+D*2);for(let G=0;G<R;G+=2,E+=2){let W=F[G],Z=F[G+1];N[E]=W,N[E+1]=Z;let ne=W-w,oe=Z-b,de=(O*ne+U*oe)*X,pe=($*ne+Y*oe)*X,he=1-de-pe;k[E]=g*de+S*pe+_*he,k[E+1]=x*de+C*pe+A*he}E=c.length;let V=Pe.setArraySize(c,E+3*(D-2));D--;for(let G=1;G<D;G++,E+=3)V[E]=u,V[E+1]=u+G,V[E+2]=u+G+1;u+=D+1}else{let R=Pe.setArraySize(o,E+6);R[E]=m,R[E+1]=p,R[E+2]=v,R[E+3]=y,R[E+4]=w,R[E+5]=b;let O=Pe.setArraySize(a,E+6);O[E]=g,O[E+1]=x,O[E+2]=S,O[E+3]=C,O[E+4]=_,O[E+5]=A,E=c.length;let U=Pe.setArraySize(c,E+3);U[E]=u,U[E+1]=u+1,U[E+2]=u+2,u+=3;break}}}}clip(e,t,i,n,r,o,a,c){let l=c,h=!1,u;a.length%4>=2?(u=c,c=this.scratch):u=this.scratch,u.length=0,u.push(e),u.push(t),u.push(i),u.push(n),u.push(r),u.push(o),u.push(e),u.push(t),c.length=0;let d=a.length-4,f=a;for(let m=0;;m+=2){let p=f[m],g=f[m+1],x=p-f[m+2],v=g-f[m+3],y=c.length,S=u;for(let w=0,b=u.length-2;w<b;){let _=S[w],A=S[w+1];w+=2;let P=S[w],E=S[w+1],R=v*(p-P)>x*(g-E),O=v*(p-_)-x*(g-A);if(O>0){if(R){c.push(P),c.push(E);continue}let U=P-_,Y=E-A,$=O/(U*v-Y*x);if($>=0&&$<=1)c.push(_+U*$),c.push(A+Y*$);else{c.push(P),c.push(E);continue}}else if(R){let U=P-_,Y=E-A,$=O/(U*v-Y*x);if($>=0&&$<=1)c.push(_+U*$),c.push(A+Y*$),c.push(P),c.push(E);else{c.push(P),c.push(E);continue}}h=!0}if(y==c.length)return l.length=0,!0;if(c.push(c[0]),c.push(c[1]),m==d)break;let C=c;c=u,c.length=0,u=C}if(l!=c){l.length=0;for(let m=0,p=c.length-2;m<p;m++)l[m]=c[m]}else l.length=l.length-2;return h}static makeClockwise(e){let t=e,i=e.length,n=t[i-2]*t[1]-t[0]*t[i-1],r=0,o=0,a=0,c=0;for(let l=0,h=i-3;l<h;l+=2)r=t[l],o=t[l+1],a=t[l+2],c=t[l+3],n+=r*c-a*o;if(!(n<0))for(let l=0,h=i-2,u=i>>1;l<u;l+=2){let d=t[l],f=t[l+1],m=h-l;t[l]=t[m],t[l+1]=t[m+1],t[m]=d,t[m+1]=f}}}let Th=class{constructor(e){M(this,"attachmentLoader");M(this,"scale",1);M(this,"linkedMeshes",new Array);this.attachmentLoader=e}readSkeletonData(e){let t=this.scale,i=new Sh,n=typeof e=="string"?JSON.parse(e):e,r=n.skeleton;if(r&&(i.hash=r.hash,i.version=r.spine,i.x=r.x,i.y=r.y,i.width=r.width,i.height=r.height,i.referenceScale=se(r,"referenceScale",100)*t,i.fps=r.fps,i.imagesPath=r.images??null,i.audioPath=r.audio??null),n.bones)for(let o=0;o<n.bones.length;o++){let a=n.bones[o],c=null,l=se(a,"parent",null);l&&(c=i.findBone(l));let h=new Cw(i.bones.length,a.name,c);h.length=se(a,"length",0)*t,h.x=se(a,"x",0)*t,h.y=se(a,"y",0)*t,h.rotation=se(a,"rotation",0),h.scaleX=se(a,"scaleX",1),h.scaleY=se(a,"scaleY",1),h.shearX=se(a,"shearX",0),h.shearY=se(a,"shearY",0),h.inherit=Pe.enumValue(qt,se(a,"inherit","Normal")),h.skinRequired=se(a,"skin",!1);let u=se(a,"color",null);u&&h.color.setFromString(u),i.bones.push(h)}if(n.slots)for(let o=0;o<n.slots.length;o++){let a=n.slots[o],c=a.name,l=i.findBone(a.bone);if(!l)throw new Error(`Couldn't find bone ${a.bone} for slot ${c}`);let h=new kw(i.slots.length,c,l),u=se(a,"color",null);u&&h.color.setFromString(u);let d=se(a,"dark",null);d&&(h.darkColor=lt.fromString(d)),h.attachmentName=se(a,"attachment",null),h.blendMode=Pe.enumValue(wr,se(a,"blend","normal")),h.visible=se(a,"visible",!0),i.slots.push(h)}if(n.ik)for(let o=0;o<n.ik.length;o++){let a=n.ik[o],c=new Iw(a.name);c.order=se(a,"order",0),c.skinRequired=se(a,"skin",!1);for(let h=0;h<a.bones.length;h++){let u=i.findBone(a.bones[h]);if(!u)throw new Error(`Couldn't find bone ${a.bones[h]} for IK constraint ${a.name}.`);c.bones.push(u)}let l=i.findBone(a.target);if(!l)throw new Error(`Couldn't find target bone ${a.target} for IK constraint ${a.name}.`);c.target=l,c.mix=se(a,"mix",1),c.softness=se(a,"softness",0)*t,c.bendDirection=se(a,"bendPositive",!0)?1:-1,c.compress=se(a,"compress",!1),c.stretch=se(a,"stretch",!1),c.uniform=se(a,"uniform",!1),i.ikConstraints.push(c)}if(n.transform)for(let o=0;o<n.transform.length;o++){let a=n.transform[o],c=new Fw(a.name);c.order=se(a,"order",0),c.skinRequired=se(a,"skin",!1);for(let u=0;u<a.bones.length;u++){let d=a.bones[u],f=i.findBone(d);if(!f)throw new Error(`Couldn't find bone ${d} for transform constraint ${a.name}.`);c.bones.push(f)}let l=a.target,h=i.findBone(l);if(!h)throw new Error(`Couldn't find target bone ${l} for transform constraint ${a.name}.`);c.target=h,c.local=se(a,"local",!1),c.relative=se(a,"relative",!1),c.offsetRotation=se(a,"rotation",0),c.offsetX=se(a,"x",0)*t,c.offsetY=se(a,"y",0)*t,c.offsetScaleX=se(a,"scaleX",0),c.offsetScaleY=se(a,"scaleY",0),c.offsetShearY=se(a,"shearY",0),c.mixRotate=se(a,"mixRotate",1),c.mixX=se(a,"mixX",1),c.mixY=se(a,"mixY",c.mixX),c.mixScaleX=se(a,"mixScaleX",1),c.mixScaleY=se(a,"mixScaleY",c.mixScaleX),c.mixShearY=se(a,"mixShearY",1),i.transformConstraints.push(c)}if(n.path)for(let o=0;o<n.path.length;o++){let a=n.path[o],c=new Rw(a.name);c.order=se(a,"order",0),c.skinRequired=se(a,"skin",!1);for(let u=0;u<a.bones.length;u++){let d=a.bones[u],f=i.findBone(d);if(!f)throw new Error(`Couldn't find bone ${d} for path constraint ${a.name}.`);c.bones.push(f)}let l=a.target,h=i.findSlot(l);if(!h)throw new Error(`Couldn't find target slot ${l} for path constraint ${a.name}.`);c.target=h,c.positionMode=Pe.enumValue(un,se(a,"positionMode","Percent")),c.spacingMode=Pe.enumValue(fi,se(a,"spacingMode","Length")),c.rotateMode=Pe.enumValue(lo,se(a,"rotateMode","Tangent")),c.offsetRotation=se(a,"rotation",0),c.position=se(a,"position",0),c.positionMode==un.Fixed&&(c.position*=t),c.spacing=se(a,"spacing",0),(c.spacingMode==fi.Length||c.spacingMode==fi.Fixed)&&(c.spacing*=t),c.mixRotate=se(a,"mixRotate",1),c.mixX=se(a,"mixX",1),c.mixY=se(a,"mixY",c.mixX),i.pathConstraints.push(c)}if(n.physics)for(let o=0;o<n.physics.length;o++){const a=n.physics[o],c=new Pw(a.name);c.order=se(a,"order",0),c.skinRequired=se(a,"skin",!1);const l=a.bone,h=i.findBone(l);if(h==null)throw new Error("Physics bone not found: "+l);c.bone=h,c.x=se(a,"x",0),c.y=se(a,"y",0),c.rotate=se(a,"rotate",0),c.scaleX=se(a,"scaleX",0),c.shearX=se(a,"shearX",0),c.limit=se(a,"limit",5e3)*t,c.step=1/se(a,"fps",60),c.inertia=se(a,"inertia",1),c.strength=se(a,"strength",100),c.damping=se(a,"damping",1),c.massInverse=1/se(a,"mass",1),c.wind=se(a,"wind",0),c.gravity=se(a,"gravity",0),c.mix=se(a,"mix",1),c.inertiaGlobal=se(a,"inertiaGlobal",!1),c.strengthGlobal=se(a,"strengthGlobal",!1),c.dampingGlobal=se(a,"dampingGlobal",!1),c.massGlobal=se(a,"massGlobal",!1),c.windGlobal=se(a,"windGlobal",!1),c.gravityGlobal=se(a,"gravityGlobal",!1),c.mixGlobal=se(a,"mixGlobal",!1),i.physicsConstraints.push(c)}if(n.skins)for(let o=0;o<n.skins.length;o++){let a=n.skins[o],c=new Mm(a.name);if(a.bones)for(let l=0;l<a.bones.length;l++){let h=a.bones[l],u=i.findBone(h);if(!u)throw new Error(`Couldn't find bone ${h} for skin ${a.name}.`);c.bones.push(u)}if(a.ik)for(let l=0;l<a.ik.length;l++){let h=a.ik[l],u=i.findIkConstraint(h);if(!u)throw new Error(`Couldn't find IK constraint ${h} for skin ${a.name}.`);c.constraints.push(u)}if(a.transform)for(let l=0;l<a.transform.length;l++){let h=a.transform[l],u=i.findTransformConstraint(h);if(!u)throw new Error(`Couldn't find transform constraint ${h} for skin ${a.name}.`);c.constraints.push(u)}if(a.path)for(let l=0;l<a.path.length;l++){let h=a.path[l],u=i.findPathConstraint(h);if(!u)throw new Error(`Couldn't find path constraint ${h} for skin ${a.name}.`);c.constraints.push(u)}if(a.physics)for(let l=0;l<a.physics.length;l++){let h=a.physics[l],u=i.findPhysicsConstraint(h);if(!u)throw new Error(`Couldn't find physics constraint ${h} for skin ${a.name}.`);c.constraints.push(u)}for(let l in a.attachments){let h=i.findSlot(l);if(!h)throw new Error(`Couldn't find slot ${l} for skin ${a.name}.`);let u=a.attachments[l];for(let d in u){let f=this.readAttachment(u[d],c,h.index,d,i);f&&c.setAttachment(h.index,d,f)}}i.skins.push(c),c.name=="default"&&(i.defaultSkin=c)}for(let o=0,a=this.linkedMeshes.length;o<a;o++){let c=this.linkedMeshes[o],l=c.skin?i.findSkin(c.skin):i.defaultSkin;if(!l)throw new Error(`Skin not found: ${c.skin}`);let h=l.getAttachment(c.slotIndex,c.parent);if(!h)throw new Error(`Parent mesh not found: ${c.parent}`);c.mesh.timelineAttachment=c.inheritTimeline?h:c.mesh,c.mesh.setParentMesh(h),c.mesh.region!=null&&c.mesh.updateRegion()}if(this.linkedMeshes.length=0,n.events)for(let o in n.events){let a=n.events[o],c=new Aw(o);c.intValue=se(a,"int",0),c.floatValue=se(a,"float",0),c.stringValue=se(a,"string",""),c.audioPath=se(a,"audio",null),c.audioPath&&(c.volume=se(a,"volume",1),c.balance=se(a,"balance",0)),i.events.push(c)}if(n.animations)for(let o in n.animations){let a=n.animations[o];this.readAnimation(a,o,i)}return i}readAttachment(e,t,i,n,r){let o=this.scale;switch(n=se(e,"name",n),se(e,"type","region")){case"region":{let a=se(e,"path",n),c=this.readSequence(se(e,"sequence",null)),l=this.attachmentLoader.newRegionAttachment(t,n,a,c);if(!l)return null;l.path=a,l.x=se(e,"x",0)*o,l.y=se(e,"y",0)*o,l.scaleX=se(e,"scaleX",1),l.scaleY=se(e,"scaleY",1),l.rotation=se(e,"rotation",0),l.width=e.width*o,l.height=e.height*o,l.sequence=c;let h=se(e,"color",null);return h&&l.color.setFromString(h),l.region!=null&&l.updateRegion(),l}case"boundingbox":{let a=this.attachmentLoader.newBoundingBoxAttachment(t,n);if(!a)return null;this.readVertices(e,a,e.vertexCount<<1);let c=se(e,"color",null);return c&&a.color.setFromString(c),a}case"mesh":case"linkedmesh":{let a=se(e,"path",n),c=this.readSequence(se(e,"sequence",null)),l=this.attachmentLoader.newMeshAttachment(t,n,a,c);if(!l)return null;l.path=a;let h=se(e,"color",null);h&&l.color.setFromString(h),l.width=se(e,"width",0)*o,l.height=se(e,"height",0)*o,l.sequence=c;let u=se(e,"parent",null);if(u)return this.linkedMeshes.push(new JP(l,se(e,"skin",null),i,u,se(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=se(e,"edges",null),l.hullLength=se(e,"hull",0)*2,l}case"path":{let a=this.attachmentLoader.newPathAttachment(t,n);if(!a)return null;a.closed=se(e,"closed",!1),a.constantSpeed=se(e,"constantSpeed",!0);let c=e.vertexCount;this.readVertices(e,a,c<<1);let l=Pe.newArray(c/3,0);for(let u=0;u<e.lengths.length;u++)l[u]=e.lengths[u]*o;a.lengths=l;let h=se(e,"color",null);return h&&a.color.setFromString(h),a}case"point":{let a=this.attachmentLoader.newPointAttachment(t,n);if(!a)return null;a.x=se(e,"x",0)*o,a.y=se(e,"y",0)*o,a.rotation=se(e,"rotation",0);let c=se(e,"color",null);return c&&a.color.setFromString(c),a}case"clipping":{let a=this.attachmentLoader.newClippingAttachment(t,n);if(!a)return null;let c=se(e,"end",null);c&&(a.endSlot=r.findSlot(c));let l=e.vertexCount;this.readVertices(e,a,l<<1);let h=se(e,"color",null);return h&&a.color.setFromString(h),a}}return null}readSequence(e){if(e==null)return null;let t=new $1(se(e,"count",0));return t.start=se(e,"start",1),t.digits=se(e,"digits",0),t.setupIndex=se(e,"setup",0),t}readVertices(e,t,i){let n=this.scale;t.worldVerticesLength=i;let r=e.vertices;if(i==r.length){let c=Pe.toFloatArray(r);if(n!=1)for(let l=0,h=r.length;l<h;l++)c[l]*=n;t.vertices=c;return}let o=new Array,a=new Array;for(let c=0,l=r.length;c<l;){let h=r[c++];a.push(h);for(let u=c+h*4;c<u;c+=4)a.push(r[c]),o.push(r[c+1]*n),o.push(r[c+2]*n),o.push(r[c+3])}t.bones=a,t.vertices=Pe.toFloatArray(o)}readAnimation(e,t,i){let n=this.scale,r=new Array;if(e.slots)for(let a in e.slots){let c=e.slots[a],l=i.findSlot(a);if(!l)throw new Error("Slot not found: "+a);let h=l.index;for(let u in c){let d=c[u];if(!d)continue;let f=d.length;if(u=="attachment"){let m=new Yo(f,h);for(let p=0;p<f;p++){let g=d[p];m.setFrame(p,se(g,"time",0),se(g,"name",null))}r.push(m)}else if(u=="rgba"){let m=new J1(f,f<<2,h),p=d[0],g=se(p,"time",0),x=lt.fromString(p.color);for(let v=0,y=0;;v++){m.setFrame(v,g,x.r,x.g,x.b,x.a);let S=d[v+1];if(!S){m.shrink(y);break}let C=se(S,"time",0),w=lt.fromString(S.color),b=p.curve;b&&(y=yt(b,m,y,v,0,g,C,x.r,w.r,1),y=yt(b,m,y,v,1,g,C,x.g,w.g,1),y=yt(b,m,y,v,2,g,C,x.b,w.b,1),y=yt(b,m,y,v,3,g,C,x.a,w.a,1)),g=C,x=w,p=S}r.push(m)}else if(u=="rgb"){let m=new Q1(f,f*3,h),p=d[0],g=se(p,"time",0),x=lt.fromString(p.color);for(let v=0,y=0;;v++){m.setFrame(v,g,x.r,x.g,x.b);let S=d[v+1];if(!S){m.shrink(y);break}let C=se(S,"time",0),w=lt.fromString(S.color),b=p.curve;b&&(y=yt(b,m,y,v,0,g,C,x.r,w.r,1),y=yt(b,m,y,v,1,g,C,x.g,w.g,1),y=yt(b,m,y,v,2,g,C,x.b,w.b,1)),g=C,x=w,p=S}r.push(m)}else if(u=="alpha")r.push(Ts(d,new ew(f,f,h),0,1));else if(u=="rgba2"){let m=new tw(f,f*7,h),p=d[0],g=se(p,"time",0),x=lt.fromString(p.light),v=lt.fromString(p.dark);for(let y=0,S=0;;y++){m.setFrame(y,g,x.r,x.g,x.b,x.a,v.r,v.g,v.b);let C=d[y+1];if(!C){m.shrink(S);break}let w=se(C,"time",0),b=lt.fromString(C.light),_=lt.fromString(C.dark),A=p.curve;A&&(S=yt(A,m,S,y,0,g,w,x.r,b.r,1),S=yt(A,m,S,y,1,g,w,x.g,b.g,1),S=yt(A,m,S,y,2,g,w,x.b,b.b,1),S=yt(A,m,S,y,3,g,w,x.a,b.a,1),S=yt(A,m,S,y,4,g,w,v.r,_.r,1),S=yt(A,m,S,y,5,g,w,v.g,_.g,1),S=yt(A,m,S,y,6,g,w,v.b,_.b,1)),g=w,x=b,v=_,p=C}r.push(m)}else if(u=="rgb2"){let m=new iw(f,f*6,h),p=d[0],g=se(p,"time",0),x=lt.fromString(p.light),v=lt.fromString(p.dark);for(let y=0,S=0;;y++){m.setFrame(y,g,x.r,x.g,x.b,v.r,v.g,v.b);let C=d[y+1];if(!C){m.shrink(S);break}let w=se(C,"time",0),b=lt.fromString(C.light),_=lt.fromString(C.dark),A=p.curve;A&&(S=yt(A,m,S,y,0,g,w,x.r,b.r,1),S=yt(A,m,S,y,1,g,w,x.g,b.g,1),S=yt(A,m,S,y,2,g,w,x.b,b.b,1),S=yt(A,m,S,y,3,g,w,v.r,_.r,1),S=yt(A,m,S,y,4,g,w,v.g,_.g,1),S=yt(A,m,S,y,5,g,w,v.b,_.b,1)),g=w,x=b,v=_,p=C}r.push(m)}}}if(e.bones)for(let a in e.bones){let c=e.bones[a],l=i.findBone(a);if(!l)throw new Error("Bone not found: "+a);let h=l.index;for(let u in c){let d=c[u],f=d.length;if(f!=0){if(u==="rotate")r.push(Ts(d,new wh(f,f,h),0,1));else if(u==="translate"){let m=new V1(f,f<<1,h);r.push(pf(d,m,"x","y",0,n))}else if(u==="translatex"){let m=new Y1(f,f,h);r.push(Ts(d,m,0,n))}else if(u==="translatey"){let m=new G1(f,f,h);r.push(Ts(d,m,0,n))}else if(u==="scale"){let m=new j1(f,f<<1,h);r.push(pf(d,m,"x","y",1,1))}else if(u==="scalex"){let m=new H1(f,f,h);r.push(Ts(d,m,1,1))}else if(u==="scaley"){let m=new W1(f,f,h);r.push(Ts(d,m,1,1))}else if(u==="shear"){let m=new z1(f,f<<1,h);r.push(pf(d,m,"x","y",0,1))}else if(u==="shearx"){let m=new q1(f,f,h);r.push(Ts(d,m,0,1))}else if(u==="sheary"){let m=new K1(f,f,h);r.push(Ts(d,m,0,1))}else if(u==="inherit"){let m=new Z1(f,l.index);for(let p=0;p<d.length;p++){let g=d[p];m.setFrame(p,se(g,"time",0),Pe.enumValue(qt,se(g,"inherit","Normal")))}r.push(m)}}}}if(e.ik)for(let a in e.ik){let c=e.ik[a],l=c[0];if(!l)continue;let h=i.findIkConstraint(a);if(!h)throw new Error("IK Constraint not found: "+a);let u=i.ikConstraints.indexOf(h),d=new nw(c.length,c.length<<1,u),f=se(l,"time",0),m=se(l,"mix",1),p=se(l,"softness",0)*n;for(let g=0,x=0;;g++){d.setFrame(g,f,m,p,se(l,"bendPositive",!0)?1:-1,se(l,"compress",!1),se(l,"stretch",!1));let v=c[g+1];if(!v){d.shrink(x);break}let y=se(v,"time",0),S=se(v,"mix",1),C=se(v,"softness",0)*n,w=l.curve;w&&(x=yt(w,d,x,g,0,f,y,m,S,1),x=yt(w,d,x,g,1,f,y,p,C,n)),f=y,m=S,p=C,l=v}r.push(d)}if(e.transform)for(let a in e.transform){let c=e.transform[a],l=c[0];if(!l)continue;let h=i.findTransformConstraint(a);if(!h)throw new Error("Transform constraint not found: "+a);let u=i.transformConstraints.indexOf(h),d=new rw(c.length,c.length*6,u),f=se(l,"time",0),m=se(l,"mixRotate",1),p=se(l,"mixX",1),g=se(l,"mixY",p),x=se(l,"mixScaleX",1),v=se(l,"mixScaleY",x),y=se(l,"mixShearY",1);for(let S=0,C=0;;S++){d.setFrame(S,f,m,p,g,x,v,y);let w=c[S+1];if(!w){d.shrink(C);break}let b=se(w,"time",0),_=se(w,"mixRotate",1),A=se(w,"mixX",1),P=se(w,"mixY",A),E=se(w,"mixScaleX",1),R=se(w,"mixScaleY",E),O=se(w,"mixShearY",1),U=l.curve;U&&(C=yt(U,d,C,S,0,f,b,m,_,1),C=yt(U,d,C,S,1,f,b,p,A,1),C=yt(U,d,C,S,2,f,b,g,P,1),C=yt(U,d,C,S,3,f,b,x,E,1),C=yt(U,d,C,S,4,f,b,v,R,1),C=yt(U,d,C,S,5,f,b,y,O,1)),f=b,m=_,p=A,g=P,x=E,v=R,x=E,l=w}r.push(d)}if(e.path)for(let a in e.path){let c=e.path[a],l=i.findPathConstraint(a);if(!l)throw new Error("Path constraint not found: "+a);let h=i.pathConstraints.indexOf(l);for(let u in c){let d=c[u],f=d[0];if(!f)continue;let m=d.length;if(u==="position"){let p=new ow(m,m,h);r.push(Ts(d,p,0,l.positionMode==un.Fixed?n:1))}else if(u==="spacing"){let p=new aw(m,m,h);r.push(Ts(d,p,0,l.spacingMode==fi.Length||l.spacingMode==fi.Fixed?n:1))}else if(u==="mix"){let p=new lw(m,m*3,h),g=se(f,"time",0),x=se(f,"mixRotate",1),v=se(f,"mixX",1),y=se(f,"mixY",v);for(let S=0,C=0;;S++){p.setFrame(S,g,x,v,y);let w=d[S+1];if(!w){p.shrink(C);break}let b=se(w,"time",0),_=se(w,"mixRotate",1),A=se(w,"mixX",1),P=se(w,"mixY",A),E=f.curve;E&&(C=yt(E,p,C,S,0,g,b,x,_,1),C=yt(E,p,C,S,1,g,b,v,A,1),C=yt(E,p,C,S,2,g,b,y,P,1)),g=b,x=_,v=A,y=P,f=w}r.push(p)}}}if(e.physics)for(let a in e.physics){let c=e.physics[a],l=-1;if(a.length>0){let h=i.findPhysicsConstraint(a);if(!h)throw new Error("Physics constraint not found: "+a);l=i.physicsConstraints.indexOf(h)}for(let h in c){let u=c[h],d=u[0];if(!d)continue;let f=u.length;if(h=="reset"){const p=new gw(f,l);for(let g=0;d!=null;d=u[g+1],g++)p.setFrame(g,se(d,"time",0));r.push(p);continue}let m;if(h=="inertia")m=new cw(f,f,l);else if(h=="strength")m=new hw(f,f,l);else if(h=="damping")m=new uw(f,f,l);else if(h=="mass")m=new dw(f,f,l);else if(h=="wind")m=new fw(f,f,l);else if(h=="gravity")m=new mw(f,f,l);else if(h=="mix")m=new pw(f,f,l);else continue;r.push(Ts(u,m,0,1))}}if(e.attachments)for(let a in e.attachments){let c=e.attachments[a],l=i.findSkin(a);if(!l)throw new Error("Skin not found: "+a);for(let h in c){let u=c[h],d=i.findSlot(h);if(!d)throw new Error("Slot not found: "+h);let f=d.index;for(let m in u){let p=u[m],g=l.getAttachment(f,m);for(let x in p){let v=p[x],y=v[0];if(y){if(x=="deform"){let S=g.bones,C=g.vertices,w=S?C.length/3*2:C.length,b=new sw(v.length,v.length,f,g),_=se(y,"time",0);for(let A=0,P=0;;A++){let E,R=se(y,"vertices",null);if(!R)E=S?Pe.newFloatArray(w):C;else{E=Pe.newFloatArray(w);let $=se(y,"offset",0);if(Pe.arrayCopy(R,0,E,$,R.length),n!=1)for(let X=$,D=X+R.length;X<D;X++)E[X]*=n;if(!S)for(let X=0;X<w;X++)E[X]+=C[X]}b.setFrame(A,_,E);let O=v[A+1];if(!O){b.shrink(P);break}let U=se(O,"time",0),Y=y.curve;Y&&(P=yt(Y,b,P,A,0,_,U,0,1,1)),_=U,y=O}r.push(b)}else if(x=="sequence"){let S=new vw(v.length,f,g),C=0;for(let w=0;w<v.length;w++){let b=se(y,"delay",C),_=se(y,"time",0),A=Ti[se(y,"mode","hold")],P=se(y,"index",0);S.setFrame(w,_,A,P,b),C=b,y=v[w+1]}r.push(S)}}}}}}if(e.drawOrder){let a=new el(e.drawOrder.length),c=i.slots.length,l=0;for(let h=0;h<e.drawOrder.length;h++,l++){let u=e.drawOrder[h],d=null,f=se(u,"offsets",null);if(f){d=Pe.newArray(c,-1);let m=Pe.newArray(c-f.length,0),p=0,g=0;for(let x=0;x<f.length;x++){let v=f[x],y=i.findSlot(v.slot);if(!y)throw new Error("Slot not found: "+y);let S=y.index;for(;p!=S;)m[g++]=p++;d[p+v.offset]=p++}for(;p<c;)m[g++]=p++;for(let x=c-1;x>=0;x--)d[x]==-1&&(d[x]=m[--g])}a.setFrame(l,se(u,"time",0),d)}r.push(a)}if(e.events){let a=new Ap(e.events.length),c=0;for(let l=0;l<e.events.length;l++,c++){let h=e.events[l],u=i.findEvent(h.name);if(!u)throw new Error("Event not found: "+h.name);let d=new Ew(Pe.toSinglePrecision(se(h,"time",0)),u);d.intValue=se(h,"int",u.intValue),d.floatValue=se(h,"float",u.floatValue),d.stringValue=se(h,"string",u.stringValue),d.data.audioPath&&(d.volume=se(h,"volume",1),d.balance=se(h,"balance",0)),a.setFrame(c,d)}r.push(a)}let o=0;for(let a=0,c=r.length;a<c;a++)o=Math.max(o,r[a].getDuration());i.animations.push(new Cp(t,r,o))}},JP=class{constructor(e,t,i,n,r){M(this,"parent");M(this,"skin");M(this,"slotIndex");M(this,"mesh");M(this,"inheritTimeline");this.mesh=e,this.skin=t,this.slotIndex=i,this.parent=n,this.inheritTimeline=r}};function Ts(s,e,t,i){let n=s[0],r=se(n,"time",0),o=se(n,"value",t)*i,a=0;for(let c=0;;c++){e.setFrame(c,r,o);let l=s[c+1];if(!l)return e.shrink(a),e;let h=se(l,"time",0),u=se(l,"value",t)*i;n.curve&&(a=yt(n.curve,e,a,c,0,r,h,o,u,i)),r=h,o=u,n=l}}function pf(s,e,t,i,n,r){let o=s[0],a=se(o,"time",0),c=se(o,t,n)*r,l=se(o,i,n)*r,h=0;for(let u=0;;u++){e.setFrame(u,a,c,l);let d=s[u+1];if(!d)return e.shrink(h),e;let f=se(d,"time",0),m=se(d,t,n)*r,p=se(d,i,n)*r,g=o.curve;g&&(h=yt(g,e,h,u,0,a,f,c,m,r),h=yt(g,e,h,u,1,a,f,l,p,r)),a=f,c=m,l=p,o=d}}function yt(s,e,t,i,n,r,o,a,c,l){if(s=="stepped")return e.setStepped(i),t;let h=n<<2,u=s[h],d=s[h+1]*l,f=s[h+2],m=s[h+3]*l;return e.setBezier(t,i,n,r,a,u,d,f,m,o,c),t+1}function se(s,e,t){return s[e]!==void 0?s[e]:t}typeof Math.fround>"u"&&(Math.fround=(function(s){return function(e){return s[0]=e,s[0]}})(new Float32Array(1)));if(typeof window<"u"&&window.PIXI){let s=window.require;window.require=e=>{if(s)return s(e);if(e.startsWith("@pixi/"))return window.PIXI}}const Cn=class Cn extends hP{constructor(t){super(t.resource.source);M(this,"texture");this.texture=Ke.from(t)}static from(t){return Cn.textureMap.has(t)?Cn.textureMap.get(t):new Cn(t)}setFilters(t,i){this.texture.baseTexture.scaleMode=Cn.toPixiTextureFilter(t),this.texture.baseTexture.mipmap=Cn.toPixiMipMap(t)}setWraps(t,i){this.texture.baseTexture.wrapMode=Cn.toPixiTextureWrap(t)}dispose(){this.texture.destroy()}static toPixiTextureFilter(t){switch(t){case yi.Nearest:case yi.MipMapNearestLinear:case yi.MipMapNearestNearest:return Rs.NEAREST;case yi.Linear:case yi.MipMapLinearLinear:case yi.MipMapLinearNearest:return Rs.LINEAR;default:throw new Error(`Unknown texture filter: ${String(t)}`)}}static toPixiMipMap(t){switch(t){case yi.Nearest:case yi.Linear:return vs.OFF;case yi.MipMapNearestLinear:case yi.MipMapNearestNearest:case yi.MipMapLinearLinear:case yi.MipMapLinearNearest:return vs.ON;default:throw new Error(`Unknown texture filter: ${String(t)}`)}}static toPixiTextureWrap(t){switch(t){case Vn.ClampToEdge:return Os.CLAMP;case Vn.MirroredRepeat:return Os.MIRRORED_REPEAT;case Vn.Repeat:return Os.REPEAT;default:throw new Error(`Unknown texture wrap: ${String(t)}`)}}static toPixiBlending(t){switch(t){case wr.Normal:return We.NORMAL;case wr.Additive:return We.ADD;case wr.Multiply:return We.MULTIPLY;case wr.Screen:return We.SCREEN;default:throw new Error(`Unknown blendMode: ${String(t)}`)}}};M(Cn,"textureMap",new Map);let mo=Cn;const En=class En extends bl{constructor(){const t=new Mp;t.getBuffer("aVertexPosition").static=!1,t.getBuffer("aTextureCoord").static=!1;const i=new ph(Ke.EMPTY);super(t,i);M(this,"name","");M(this,"warnedTwoTint",!1)}updateFromSpineData(t,i,n,r,o,a,c,l){var x,v;this.texture=t.texture;const h=o/(l?12:8)*2,u=this.geometry.getBuffer("aTextureCoord");((x=u.data)==null?void 0:x.length)!==h&&(u.data=new Float32Array(h));const d=this.geometry.getBuffer("aVertexPosition");((v=d.data)==null?void 0:v.length)!==h&&(d.data=new Float32Array(h));let f=0,m=u.data,p=d.data;for(let y=0;y<o;y+=l?12:8){let S=y;p[f]=r[S++],p[f+1]=r[S++],S+=4,m[f]=r[S++],m[f+1]=r[S++],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),En.auxColor[0]=r[2],En.auxColor[1]=r[3],En.auxColor[2]=r[4],En.auxColor[3]=r[5],this.tint=En.auxColor,this.alpha=En.auxColor[3],this.blendMode=mo.toPixiBlending(i);const g=this.geometry.indexBuffer;if(g.data.length!==a.length)g.data=new Uint32Array(a);else{const y=g.data;for(let S=0;S<c;S++)y[S]=a[S]}this.name=n,u.update(),d.update(),g.update()}};M(En,"auxColor",[0,0,0,0]);let _m=En;class QP extends fn{constructor(e=!1){super();const t=new $t(void 0),i=new $t(void 0,!0),n=new $t(void 0,!0,!0);this.addAttribute("aVertexPosition",t,2,!1,Ue.FLOAT),this.addAttribute("aTextureCoord",i,2,!1,Ue.FLOAT),this.addIndex(n)}}const ek=`
|
||
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;
|
||
}
|
||
`,tk=`
|
||
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 ik extends Ns{constructor(t){const i={uSampler:t??Ke.EMPTY,alpha:1,uTextureMatrix:Ft.IDENTITY,uColor:new Float32Array([1,1,1,1]),uDarkColor:new Float32Array([0,0,0,0])},n={tint:16777215,darkTint:0,alpha:1,pluginName:"darkTintBatch"};super(an.from(ek,tk),i);M(this,"uvMatrix");M(this,"batchable");M(this,"pluginName");M(this,"_tintRGB");M(this,"_darkTintRGB");M(this,"_colorDirty");M(this,"_alpha");M(this,"_tintColor");M(this,"_darkTintColor");this._colorDirty=!1,this.uvMatrix=new vp(i.uSampler),this.batchable=!0,this.pluginName=n.pluginName,this._tintColor=new At(n.tint),this._darkTintColor=new At(n.darkTint),this._tintRGB=this._tintColor.toLittleEndianNumber(),this._darkTintRGB=this._darkTintColor.toLittleEndianNumber(),this._alpha=n.alpha,this._colorDirty=!0}get texture(){return this.uniforms.uSampler}set texture(t){this.uniforms.uSampler!==t&&(!this.uniforms.uSampler.baseTexture.alphaMode!=!t.baseTexture.alphaMode&&(this._colorDirty=!0),this.uniforms.uSampler=t,this.uvMatrix.texture=t)}set alpha(t){t!==this._alpha&&(this._alpha=t,this._colorDirty=!0)}get alpha(){return this._alpha}set tint(t){t!==this.tint&&(this._tintColor.setValue(t),this._tintRGB=this._tintColor.toLittleEndianNumber(),this._colorDirty=!0)}get tint(){return this._tintColor.value}set darkTint(t){t!==this.darkTint&&(this._darkTintColor.setValue(t),this._darkTintRGB=this._darkTintColor.toLittleEndianNumber(),this._colorDirty=!0)}get darkTint(){return this._darkTintColor.value}get tintValue(){return this._tintColor.toNumber()}get darkTintValue(){return this._darkTintColor.toNumber()}update(){this._colorDirty&&(this._colorDirty=!1,At.shared.setValue(this._tintColor).premultiply(this._alpha,!0).toArray(this.uniforms.uColor),At.shared.setValue(this._darkTintColor).premultiply(this._alpha,!0).premultiply(1,!1).toArray(this.uniforms.uDarkColor)),this.uvMatrix.update()&&(this.uniforms.uTextureMatrix=this.uvMatrix.mapCoord)}}class sk extends bl{constructor(t){super(new QP,new ik(t),void 0,void 0);M(this,"_darkTintRGB",0)}get darkTint(){return"darkTint"in this.shader?this.shader.darkTint:null}set darkTint(t){this.shader.darkTint=t}get darkTintValue(){return this.shader.darkTintValue}_renderToBatch(t){const i=this.geometry,n=this.shader;n.uvMatrix&&(n.uvMatrix.update(),this.calculateUvs()),this.calculateVertices(),this.indices=i.indexBuffer.data,this._tintRGB=n._tintRGB,this._darkTintRGB=n._darkTintRGB,this._texture=n.texture;const r=this.material.pluginName;t.batch.setObjectRenderer(t.plugins[r]),t.plugins[r].render(this)}}const hi=class hi extends sk{constructor(){super();M(this,"name","")}updateFromSpineData(t,i,n,r,o,a,c,l){var x,v;this.texture=t.texture;const h=o/(l?12:8)*2,u=this.geometry.getBuffer("aTextureCoord");((x=u.data)==null?void 0:x.length)!==h&&(u.data=new Float32Array(h));const d=this.geometry.getBuffer("aVertexPosition");((v=d.data)==null?void 0:v.length)!==h&&(d.data=new Float32Array(h));let f=0,m=u.data,p=d.data;for(let y=0;y<o;y+=l?12:8){let S=y;p[f]=r[S++],p[f+1]=r[S++],S+=4,m[f]=r[S++],m[f+1]=r[S++],f+=2}l?(hi.auxColor[0]=r[8],hi.auxColor[1]=r[9],hi.auxColor[2]=r[10],hi.auxColor[3]=r[11],this.darkTint=hi.auxColor,hi.auxColor[0]=r[2],hi.auxColor[1]=r[3],hi.auxColor[2]=r[4],hi.auxColor[3]=r[5],this.tint=hi.auxColor):(hi.auxColor[0]=r[2],hi.auxColor[1]=r[3],hi.auxColor[2]=r[4],hi.auxColor[3]=r[5],this.tint=hi.auxColor),this.blendMode=mo.toPixiBlending(i),this.alpha=hi.auxColor[3];const g=this.geometry.indexBuffer;if(g.data.length!==a.length)g.data=new Uint32Array(a);else{const y=g.data;for(let S=0;S<c;S++)y[S]=a[S]}this.name=n,u.update(),d.update(),g.update()}};M(hi,"auxColor",[0,0,0,0]);let tl=hi;const Mt=class Mt extends gi{constructor(t,i){if(t instanceof Sh)t={...i,skeletonData:t};else if(i)throw new Error("You cannot use options and oldOptions together.");super();M(this,"skeleton");M(this,"state");M(this,"darkTint",!1);M(this,"hasNeverUpdated",!0);M(this,"_debug");M(this,"slotMeshFactory",()=>new _m);M(this,"beforeUpdateWorldTransforms",()=>{});M(this,"afterUpdateWorldTransforms",()=>{});M(this,"_autoUpdate",!1);M(this,"_ticker",Yi.shared);M(this,"meshesCache",new Map);M(this,"lightColor",new lt);M(this,"darkColor",new lt);M(this,"_boundsProvider");M(this,"_boundsPoint",new St);M(this,"_boundsSpineID",-1);M(this,"_boundsSpineDirty",!0);M(this,"slotsObject",new Map);M(this,"verticesCache",Pe.newFloatArray(1024));M(this,"clippingSlotToPixiMasks",{});M(this,"currentClippingSlot");const n=t instanceof Sh?t:t.skeletonData;this.skeleton=new Ip(n);const r=new cP(n);this.state=new nP(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(o=>!!o.data.darkColor):t==null?void 0:t.darkTint,this.darkTint&&(this.slotMeshFactory=()=>new tl)):this.initializeMeshFactory(i==null?void 0:i.slotMeshFactory),t!=null&&t.ticker&&(this._ticker=t.ticker),this.autoUpdate=(t==null?void 0:t.autoUpdate)??!0,this.boundsProvider=t.boundsProvider}get debug(){return this._debug}set debug(t){this._debug&&this._debug.unregisterSpine(this),t&&t.registerSpine(this),this._debug=t}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t&&!this._autoUpdate?this._ticker.add(this.internalUpdate,this):!t&&this._autoUpdate&&this._ticker.remove(this.internalUpdate,this),this._autoUpdate=t}get ticker(){return this._ticker}set ticker(t){t=t??Yi.shared,this._ticker!==t&&(this._autoUpdate&&(this._ticker.remove(this.internalUpdate,this),t.add(this.internalUpdate,this)),this._ticker=t)}get boundsProvider(){return this._boundsProvider}set boundsProvider(t){this._boundsProvider=t,t?(this._boundsSpineID=-1,this._boundsSpineDirty=!0,this.interactiveChildren=!1):(this.interactiveChildren=!0,this.hitArea=null),this.hasNeverUpdated||this.calculateBounds()}initializeMeshFactory(t){if(t){this.slotMeshFactory=t;const i=this.slotMeshFactory();i instanceof tl&&(this.darkTint=!0),i.destroy()}else for(let i=0;i<this.skeleton.slots.length;i++)if(this.skeleton.slots[i].data.darkColor){this.slotMeshFactory=()=>new tl,this.darkTint=!0;break}}update(t){this.internalUpdate(0,t)}internalUpdate(t,i){this.hasNeverUpdated=!1;const n=i??this._ticker.deltaMS/1e3;this.state.update(n),this.state.apply(this.skeleton),this.beforeUpdateWorldTransforms(this),this.skeleton.update(n),this.skeleton.updateWorldTransform(pr.update),this.afterUpdateWorldTransforms(this)}updateTransform(){var t;this.renderMeshes(),this.sortChildren(),(t=this.debug)==null||t.renderDebug(this),super.updateTransform()}destroy(t){var i;this.autoUpdate&&(this.autoUpdate=!1),this._ticker=null;for(const[,n]of this.meshesCache)n==null||n.destroy();this.state.clearListeners(),this.debug=void 0,this.meshesCache.clear(),this.slotsObject.clear();for(let n in this.clippingSlotToPixiMasks)(i=this.clippingSlotToPixiMasks[n].mask)==null||i.destroy(),delete this.clippingSlotToPixiMasks[n];super.destroy(t)}resetMeshes(){for(const[,t]of this.meshesCache)t.zIndex=-1,t.visible=!1}_calculateBounds(){this.hasNeverUpdated&&(this.internalUpdate(0,0),this.renderMeshes())}hasMeshForSlot(t){return this.meshesCache.has(t)}getMeshForSlot(t){if(this.hasMeshForSlot(t)){let i=this.meshesCache.get(t);return i.visible=!0,i}else{let i=this.slotMeshFactory();return this.addChild(i),this.meshesCache.set(t,i),i}}getSlotFromRef(t){let i;if(typeof t=="number"?i=this.skeleton.slots[t]:typeof t=="string"?i=this.skeleton.findSlot(t):i=t,!i)throw new Error(`No slot found with the given slot reference: ${t}`);return i}addSlotObject(t,i,n){var a;let r=this.getSlotFromRef(t);const o=(a=this.slotsObject.get(r))==null?void 0:a.container;if(!(o&&o===i)){for(const[c,{container:l}]of this.slotsObject)if(c!==r&&l===i){this.removeSlotObject(c,i);break}o&&this.removeChild(o),this.slotsObject.set(r,{container:i,followAttachmentTimeline:(n==null?void 0:n.followAttachmentTimeline)||!1,followSlotColor:(n==null?void 0:n.followSlotColor)||!1}),this.addChild(i)}}getSlotObject(t){const i=this.slotsObject.get(this.getSlotFromRef(t));return i?i.container:void 0}removeSlotObject(t,i){var o;let n=this.getSlotFromRef(t),r=(o=this.slotsObject.get(n))==null?void 0:o.container;r&&(i&&i!==r||(this.removeChild(r),this.slotsObject.delete(n)))}removeSlotObjects(){for(const[,t]of this.slotsObject)t.container.removeFromParent();this.slotsObject.clear()}updateSlotObject(t,i,n){const{container:r,followAttachmentTimeline:o}=t,a=o?!!i.attachment:!0;if(r.visible=this.skeleton.drawOrder.includes(i)&&a,r.visible){let c=i.bone;const l=r.localTransform;l.a=c.a,l.b=c.c,l.c=-c.b,l.d=-c.d,l.tx=c.worldX,l.ty=c.worldY,r.transform.setFromMatrix(l),r.zIndex=n,r.alpha=this.skeleton.color.a*i.color.a,t.followSlotColor&&this.setSlotObjectTint(r,255*this.skeleton.color.r*i.color.r<<16|255*this.skeleton.color.g*i.color.g<<8|255*this.skeleton.color.b*i.color.b)}}setSlotObjectTint(t,i){const n=t;"tint"in n&&(n.tint=i);for(const r of n.children??[])this.setSlotObjectTint(r,i)}updateAndSetPixiMask(t,i){var a,c;const n=t.attachment;if(n&&n instanceof na){const l=(a=this.clippingSlotToPixiMasks)[c=t.data.name]||(a[c]={slot:t,vertices:new Array});l.maskComputed=!1,this.currentClippingSlot=l;return}let r=this.currentClippingSlot;const o=this.slotsObject.get(t);if(r&&o){let l=r.mask;if(l||(l=Jv.obtain(),r.mask=l,this.addChild(l)),!r.maskComputed){let h=r.slot,u=h.attachment;r.maskComputed=!0;const d=u.worldVerticesLength,f=r.vertices;u.computeWorldVertices(h,0,d,f,0,2),l.clear().lineStyle(0).beginFill(0).drawPolygon(f).endFill()}o.container.mask=l}else o!=null&&o.container.mask&&(o.container.mask=null);if(r&&r.slot.attachment.endSlot==t.data&&(this.currentClippingSlot=void 0),i){for(const l in this.clippingSlotToPixiMasks){const h=this.clippingSlotToPixiMasks[l];(!(h.slot.attachment instanceof na)||!h.maskComputed)&&h.mask&&(this.removeChild(h.mask),Jv.free(h.mask),h.mask=void 0)}this.currentClippingSlot=void 0}}renderMeshes(){var r,o;this.resetMeshes();let t=null,i=null;const n=this.skeleton.drawOrder;for(let a=0,c=n.length,l=0;a<c;a++){const h=n[a];let u=this.slotsObject.get(h),d=a+l;u&&(this.updateSlotObject(u,h,d+1),l++),this.updateAndSetPixiMask(h,a===n.length-1);const f=h.darkColor!=null,m=Mt.clipper.isClipping()?2:f?Mt.DARK_VERTEX_SIZE:Mt.VERTEX_SIZE;if(!h.bone.active){Mt.clipper.clipEndWithSlot(h);continue}const p=h.getAttachment();let g,x,v=0;if(p instanceof gu){const y=p;g=y.color,v=m*4,y.computeWorldVertices(h,this.verticesCache,0,m),t=Mt.QUAD_TRIANGLES,i=y.uvs,x=(r=y.region)==null?void 0:r.texture}else if(p instanceof Ol){const y=p;g=y.color,v=(y.worldVerticesLength>>1)*m,v>this.verticesCache.length&&(this.verticesCache=Pe.newFloatArray(v)),y.computeWorldVertices(h,0,y.worldVerticesLength,this.verticesCache,0,m),t=y.triangles,i=y.uvs,x=(o=y.region)==null?void 0:o.texture}else if(p instanceof na){Mt.clipper.clipStart(h,p);continue}else{this.hasMeshForSlot(h)&&(this.getMeshForSlot(h).visible=!1),Mt.clipper.clipEndWithSlot(h);continue}if(x!=null){const S=h.bone.skeleton.color,C=h.color,w=S.a*C.a*g.a;this.lightColor.set(S.r*C.r*g.r,S.g*C.g*g.g,S.b*C.b*g.b,w),h.darkColor!=null?this.darkColor.set(h.darkColor.r,h.darkColor.g,h.darkColor.b,1):this.darkColor.set(0,0,0,1);let b,_,A,P;if(Mt.clipper.isClipping())Mt.clipper.clipTriangles(this.verticesCache,t,t.length,i,this.lightColor,this.darkColor,f),b=Mt.clipper.clippedVertices,_=b.length,A=Mt.clipper.clippedTriangles,P=A.length;else{const R=this.verticesCache;for(let O=2,U=0,Y=v;O<Y;O+=m,U+=2){let $=O;R[$++]=this.lightColor.r,R[$++]=this.lightColor.g,R[$++]=this.lightColor.b,R[$++]=this.lightColor.a,R[$++]=i[U],R[$++]=i[U+1],f&&(R[$++]=this.darkColor.r,R[$++]=this.darkColor.g,R[$++]=this.darkColor.b,R[$++]=this.darkColor.a)}b=this.verticesCache,_=v,A=t,P=t.length}if(_==0||P==0){Mt.clipper.clipEndWithSlot(h);continue}const E=this.getMeshForSlot(h);E.renderable=!0,E.zIndex=d,E.updateFromSpineData(x,h.data.blendMode,h.data.name,b,_,A,P,f)}Mt.clipper.clipEndWithSlot(h)}Mt.clipper.clipEnd()}calculateBounds(){if(!this._boundsProvider){super.calculateBounds();return}const t=this.transform;if(this._boundsSpineID===t._worldID)return;this.updateBounds();const i=this._localBounds,n=this._boundsPoint;n.set(i.minX,i.minY),t.worldTransform.apply(n,n),this._bounds.minX=n.x,this._bounds.minY=n.y,n.set(i.maxX,i.maxY),t.worldTransform.apply(n,n),this._bounds.maxX=n.x,this._bounds.maxY=n.y}updateBounds(){if(!this._boundsProvider||!this._boundsSpineDirty)return;this._boundsSpineDirty=!1,this._localBounds||(this._localBounds=new 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 n=t;if(typeof t=="string"&&(t=this.skeleton.findBone(t)),!t)throw Error(`Cannot set bone position, bone ${String(n)} not found`);if(Mt.vectorAux.set(i.x,i.y),t.parent){const r=t.parent.worldToLocal(Mt.vectorAux);t.x=r.x,t.y=r.y}else t.x=Mt.vectorAux.x,t.y=Mt.vectorAux.y}getBonePosition(t,i){const n=t;return typeof t=="string"&&(t=this.skeleton.findBone(t)),t?(i||(i={x:0,y:0}),i.x=t.worldX,i.y=t.worldY,i):(console.error(`Cannot get bone position! Bone ${String(n)} not found`),i)}skeletonToPixiWorldCoordinates(t){this.worldTransform.apply(t,t)}pixiWorldCoordinatesToSkeleton(t){this.worldTransform.applyInverse(t,t)}pixiWorldCoordinatesToBone(t,i){this.pixiWorldCoordinatesToSkeleton(t),i.parent?i.parent.worldToLocal(t):i.worldToLocal(t)}static from(t,i,n){if(typeof t=="string")return Mt.oldFrom(t,i,n);const{skeleton:r,atlas:o,scale:a=1,darkTint:c,autoUpdate:l,boundsProvider:h,ticker:u}=t,d=`${r}-${o}-${a}`;let f=Mt.skeletonCache[d];if(!f){const m=ln.get(r),p=ln.get(o),g=new Sm(p);let x=m instanceof Uint8Array?new Tm(g):new Th(g);x.scale=a,f=x.readSkeletonData(m),Mt.skeletonCache[d]=f}return new Mt({skeletonData:f,darkTint:c,autoUpdate:l,boundsProvider:h,ticker:u})}static oldFrom(t,i,n){const r=`${t}-${i}-${(n==null?void 0:n.scale)??1}`;let o=Mt.skeletonCache[r];if(o)return new Mt(o,n);const a=ln.get(t),c=ln.get(i),l=new Sm(c);let h=a instanceof Uint8Array?new Tm(l):new Th(l);return h.scale=(n==null?void 0:n.scale)??1,o=h.readSkeletonData(a),Mt.skeletonCache[r]=o,new this(o,n)}get tint(){return this.skeleton.color.toRgb888()}set tint(t){lt.rgb888ToColor(this.skeleton.color,t)}};M(Mt,"vectorAux",new bh),M(Mt,"clipper",new Mh),M(Mt,"QUAD_TRIANGLES",[0,1,2,2,3,0]),M(Mt,"VERTEX_SIZE",8),M(Mt,"DARK_VERTEX_SIZE",12),M(Mt,"skeletonCache",Object.create(null));let _h=Mt;const Jv=new xh(()=>new Ni);Ip.yDown=!0;const wc="spineTextureAtlasLoader",nk={extension:ke.Asset,resolver:{test:s=>Ki(s,".atlas"),parse:s=>{var t,i;const e=s.split(".");return{resolution:parseFloat(((i=(t=Be.RETINA_PREFIX)==null?void 0:t.exec(s))==null?void 0:i[1])??"1"),format:e[e.length-2],src:s}}},loader:{name:wc,extension:{type:ke.LoadParser,priority:os.Normal,name:wc},test(s){return Ki(s,".atlas")},async load(s){const e=await Be.ADAPTER.fetch(s);if(!e.ok)throw new Error(`[${wc}] Failed to fetch ${s}: ${e.status} ${e.statusText}`);return await e.text()},testParse(s,e){const t=Ki(e.src,".atlas"),i=typeof s=="string",n=e.loadParser===wc;return Promise.resolve((t||n)&&i)},unload(s){s.dispose()},async parse(s,e,t){var c;const i=e.data||{};let n=si.dirname(e.src);n&&n.lastIndexOf("/")!==n.length-1&&(n+="/");const r=new ww(s);if(i.images instanceof it||typeof i.images=="string"){const l=i.images;i.images={},i.images[r.pages[0].name]=l}const o=[];let a=!0;for(const l of t.parsers)if(l.name=="loadTextures"){a=(c=l.config)==null?void 0:c.preferCreateImageBitmap;break}ln.setPreferences({preferCreateImageBitmap:!1});for(const l of r.pages){const h=l.name,u=i!=null&&i.images?i.images[h]:void 0;if(u instanceof it)l.setTexture(mo.from(u));else{const d=u??si.normalize([...n.split(si.sep),h].join(si.sep)),f={src:hh(d,e.src),data:{...i.imageMetadata,alphaMode:l.pma?bi.PMA:bi.UNPACK}},m=t.load(f).then(p=>{l.setTexture(mo.from(p.baseTexture))});o.push(m)}}return await Promise.all(o),ln.setPreferences({preferCreateImageBitmap:a}),r}}};$e.add(nk);const Sc="spineSkeletonLoader";function rk(s){return s.hasOwnProperty("bones")}function ok(s){return s instanceof Uint8Array}const ak={extension:ke.Asset,loader:{name:Sc,extension:{type:ke.LoadParser,priority:os.Normal,name:Sc},test(s){return Ki(s,".skel")},async load(s){const e=await Be.ADAPTER.fetch(s);if(!e.ok)throw new Error(`[${Sc}] Failed to fetch ${s}: ${e.status} ${e.statusText}`);return new Uint8Array(await e.arrayBuffer())},testParse(s,e){const t=Ki(e.src,".json")&&rk(s),i=Ki(e.src,".skel")&&ok(s),n=e.loadParser===Sc;return Promise.resolve(t||i||n)}}};$e.add(ak);class lk extends fn{constructor(t=!1){super();M(this,"_buffer");M(this,"_indexBuffer");this._buffer=new $t(void 0,t,!1),this._indexBuffer=new $t(void 0,t,!0),this.addAttribute("aVertexPosition",this._buffer,2,!1,Ue.FLOAT).addAttribute("aTextureCoord",this._buffer,2,!1,Ue.FLOAT).addAttribute("aColor",this._buffer,4,!0,Ue.UNSIGNED_BYTE).addAttribute("aDarkColor",this._buffer,4,!0,Ue.UNSIGNED_BYTE).addAttribute("aTextureId",this._buffer,1,!0,Ue.FLOAT).addIndex(this._indexBuffer)}}const ck=`
|
||
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;
|
||
|
||
}
|
||
`,hk=`
|
||
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 Ow extends cr{constructor(e){super(e),this.shaderGenerator=new bb(ck,hk),this.geometryClass=lk,this.vertexSize=7}packInterleavedGeometry(e,t,i,n,r){const{uint32View:o,float32View:a}=t,c=n/this.vertexSize,l=e.uvs,h=e.indices,u=e.vertexData,d=e._texture.baseTexture._batchLocation,f=Math.min(e.worldAlpha,1),m=At.shared.setValue(e._tintRGB).toPremultiplied(f,!0),p=At.shared.setValue(e._darkTintRGB).premultiply(f,!0).toPremultiplied(1,!1);for(let g=0;g<u.length;g+=2)a[n++]=u[g],a[n++]=u[g+1],a[n++]=l[g],a[n++]=l[g+1],o[n++]=m,o[n++]=p,a[n++]=d;for(let g=0;g<h.length;g++)i[r++]=c+h[g]}}M(Ow,"extension",{name:"darkTintBatch",type:ke.RendererPlugin});$e.add(Ow);function uk(s){return s.replace(/\\/g,"/").split("/").pop()||s}function Rp(s,e,t){for(const i of s.pages){const n=e.get(uk(i.name).toLowerCase());if(!n)throw new Error(`Atlas 引用的纹理未选择:${i.name}`);n.baseTexture.alphaMode=i.pma?bi.PMA:bi.UNPACK,i.setTexture(t.from(n.baseTexture))}}function Lw(s,e){const t=new ww(s);return Rp(t,e,mo),new Sm(t)}function dk(s,e,t){return{skeletonData:new Th(Lw(e,t)).readSkeletonData(s),SpineClass:_h}}function fk(s,e,t){return{skeletonData:new Tm(Lw(e,t)).readSkeletonData(s),SpineClass:_h}}const mk="modulepreload",pk=function(s){return"/"+s},Qv={},ey=function(e,t,i){let n=Promise.resolve();if(t&&t.length>0){let o=function(l){return Promise.all(l.map(h=>Promise.resolve(h).then(u=>({status:"fulfilled",value:u}),u=>({status:"rejected",reason:u}))))};document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),c=(a==null?void 0:a.nonce)||(a==null?void 0:a.getAttribute("nonce"));n=o(t.map(l=>{if(l=pk(l),l in Qv)return;Qv[l]=!0;const h=l.endsWith(".css"),u=h?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${l}"]${u}`))return;const d=document.createElement("link");if(d.rel=h?"stylesheet":mk,h||(d.as="script"),d.crossOrigin="",d.href=l,c&&d.setAttribute("nonce",c),document.head.appendChild(d),h)return new Promise((f,m)=>{d.addEventListener("load",f),d.addEventListener("error",()=>m(new Error(`Unable to preload CSS for ${l}`)))})}))}function r(o){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o}return n.then(o=>{for(const a of o||[])a.status==="rejected"&&r(a.reason);return e().catch(r)})};async function Bw(){const[s,e]=await Promise.all([ey(()=>import("./index-CT90mgj8.js"),[]),ey(()=>import("./index-8-FN8Glu.js"),__vite__mapDeps([0,1]))]);return{core:s,pixi:e}}async function gk(s,e,t){const{core:i,pixi:n}=await Bw(),r=new i.TextureAtlas(e);return Rp(r,t,n.SpineTexture),{skeletonData:new i.SkeletonJson(new i.AtlasAttachmentLoader(r)).readSkeletonData(s),SpineClass:n.Spine}}async function vk(s,e,t){const{core:i,pixi:n}=await Bw(),r=new i.TextureAtlas(e);return Rp(r,t,n.SpineTexture),{skeletonData:new i.SkeletonBinary(new i.AtlasAttachmentLoader(r)).readSkeletonData(s),SpineClass:n.Spine}}function gr(s,e,t){const i=Number(s[e]);return Number.isFinite(i)?i:t}function qi(s,e,t,i){s[e]==null&&(s[e]=gr(s,t,i))}function Pp(s,e,t){if(typeof s.curve!="number")return;const i=gr(s,"time",0),r=gr(e,"time",0)-i,o=s.curve,a=gr(s,"c2",0),c=gr(s,"c3",1),l=gr(s,"c4",1);s.curve=t.flatMap(([h,u])=>[i+r*o,h+(u-h)*a,i+r*c,h+(u-h)*l]),delete s.c2,delete s.c3,delete s.c4}function Sr(s,e){if(Array.isArray(s))for(let t=0;t<s.length-1;t++){const i=s[t],n=s[t+1];Pp(i,n,e.map(({key:r,fallback:o})=>[gr(i,r,o),gr(n,r,o)]))}}function yk(s){if(Array.isArray(s))for(let e=0;e<s.length-1;e++)Pp(s[e],s[e+1],[[0,1]])}function Po(s,e){const t=typeof s=="string"?s.replace(/^#/,""):"",i=t.length===6?`${t}ff`:t.padEnd(8,"f").slice(0,8),n=[0,2,4,6].map(r=>Number.parseInt(i.slice(r,r+2),16)/255);return e?n:n.slice(0,3)}function ty(s,e){if(Array.isArray(s))for(let t=0;t<s.length-1;t++){const i=s[t],n=s[t+1],r=e?[...Po(i.light,!0),...Po(i.dark,!1)]:Po(i.color,!0),o=e?[...Po(n.light,!0),...Po(n.dark,!1)]:Po(n.color,!0);Pp(i,n,r.map((a,c)=>[a,o[c]]))}}function xk(s){for(const e of s.bones||[])e.inherit==null&&e.transform!=null&&(e.inherit=e.transform);for(const e of s.transform||[])qi(e,"mixRotate","rotateMix",1),qi(e,"mixX","translateMix",1),e.mixY==null&&(e.mixY=e.mixX),qi(e,"mixScaleX","scaleMix",1),e.mixScaleY==null&&(e.mixScaleY=e.mixScaleX),qi(e,"mixShearY","shearMix",1);for(const e of s.path||[])qi(e,"mixRotate","rotateMix",1),qi(e,"mixX","translateMix",1),e.mixY==null&&(e.mixY=e.mixX)}function bk(s){for(const e of s.skins||[])for(const t of Object.values(e.attachments||{}))for(const i of Object.values(t||{}))i.parent!=null&&i.timelines==null&&i.deform!=null&&(i.timelines=i.deform)}function wk(s){for(const e of Object.values(s.slots||{}))e.color&&!e.rgba&&(e.rgba=e.color,delete e.color),e.twoColor&&!e.rgba2&&(e.rgba2=e.twoColor,delete e.twoColor),ty(e.rgba,!1),ty(e.rgba2,!0)}function Sk(s){for(const e of Object.values(s.bones||{})){for(const t of e.rotate||[])qi(t,"value","angle",0);Sr(e.rotate,[{key:"value",fallback:0}]),Sr(e.translate,[{key:"x",fallback:0},{key:"y",fallback:0}]),Sr(e.scale,[{key:"x",fallback:1},{key:"y",fallback:1}]),Sr(e.shear,[{key:"x",fallback:0},{key:"y",fallback:0}])}}function Mk(s){for(const e of Object.values(s.ik||{}))Sr(e,[{key:"mix",fallback:1},{key:"softness",fallback:0}])}function Tk(s){for(const e of Object.values(s.transform||{})){for(const t of e)qi(t,"mixRotate","rotateMix",1),qi(t,"mixX","translateMix",1),t.mixY==null&&(t.mixY=t.mixX),qi(t,"mixScaleX","scaleMix",1),t.mixScaleY==null&&(t.mixScaleY=t.mixScaleX),qi(t,"mixShearY","shearMix",1);Sr(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 _k(s){for(const e of Object.values(s.path||{})){for(const i of["position","spacing"]){const n=e[i];for(const r of n||[])qi(r,"value",i,0);Sr(n,[{key:"value",fallback:0}])}const t=e.mix;for(const i of t||[])qi(i,"mixRotate","rotateMix",1),qi(i,"mixX","translateMix",1),i.mixY==null&&(i.mixY=i.mixX);Sr(t,[{key:"mixRotate",fallback:1},{key:"mixX",fallback:1},{key:"mixY",fallback:1}])}}function Ck(s){if(!s.deform)return;const e=s.attachments||(s.attachments={});for(const[t,i]of Object.entries(s.deform)){const n=e[t]||(e[t]={});for(const[r,o]of Object.entries(i)){const a=n[r]||(n[r]={});for(const[c,l]of Object.entries(o)){const h=a[c]||(a[c]={});h.deform=l,yk(l)}}}delete s.deform}function Nw(s){xk(s),bk(s);for(const e of Object.values(s.animations||{}))wk(e),Sk(e),Mk(e),Tk(e),_k(e),Ck(e),!e.drawOrder&&e.draworder&&(e.drawOrder=e.draworder);return s}function Ek(s){return s.replace(/\\/g,"/").split("/").pop()||s}async function Ak(s){const e=await Promise.all(s.map(async t=>{const i=URL.createObjectURL(t);try{return[Ek(t.name).toLowerCase(),await Ke.fromURL(i)]}finally{URL.revokeObjectURL(i)}}));return new Map(e)}function Ik(s){const e=new Map;return s.bones.map(t=>{var r;const i=((r=t.parent)==null?void 0:r.name)||null,n=i?(e.get(i)||0)+1:0;return e.set(t.name,n),{name:t.name,parent:i,depth:n}})}function Rk(s){return s.slots.map(e=>{var t;return{name:e.name,order:Number(e.index)||0,bone:((t=e.boneData)==null?void 0:t.name)||"",attachment:e.attachmentName||""}})}async function Dw(s,e,t){var o;if(!/\.(json|skel)$/i.test(s.name))throw new Error("Spine 数据仅支持 .json 或 .skel");if(!/\.atlas$/i.test(e.name))throw new Error("图集文件仅支持 .atlas");if(!t.length)throw new Error("请至少选择一张纹理图片");const i=await e.text(),n=await Ak(t),r=[...n.values()];try{let a,c,l=null,h;if(/\.skel$/i.test(s.name)){const u=await s.arrayBuffer();try{({skeletonData:a,SpineClass:c}=await vk(u,i,n)),h="4.3"}catch(d){try{({skeletonData:a,SpineClass:c}=fk(u,i,n)),h="4.2"}catch(f){const m=d instanceof Error?d.message:String(d),p=f instanceof Error?f.message:String(f);throw new Error(`Spine 二进制解析失败(4.3:${m};旧版:${p})`)}}l=yh(a.version)}else{let u;try{u=JSON.parse(await s.text())}catch{throw new Error("Spine JSON 文件格式无效")}if(l=yh((o=u==null?void 0:u.skeleton)==null?void 0:o.spine),!l)throw new Error(`Spine JSON 版本不受支持,仅支持 ${xm()}`);h=RR(l),l==="3.8"&&Nw(u);const d=h==="4.3"?await gk(u,i,n):dk(u,i,n);a=d.skeletonData,c=d.SpineClass}if(!l)throw new Error(`Spine 数据版本不受支持,仅支持 ${xm()}`);return{skeletonData:a,textures:r,runtimeVersion:h,SpineClass:c,dataVersion:l,animations:a.animations.map(u=>({name:u.name,duration:u.duration})),bones:Ik(a),slots:Rk(a)}}catch(a){for(const c of r)c.destroy(!0);throw a}}function $c(s){return new Promise((e,t)=>{const i=new FileReader;i.onload=()=>e(String(i.result||"")),i.onerror=()=>t(i.error),i.readAsDataURL(s)})}async function Pk(s,e,t){return{skeleton:{name:s.name,dataUrl:await $c(s)},atlas:{name:e.name,dataUrl:await $c(e)},textures:await Promise.all(t.map(async i=>({name:i.name,dataUrl:await $c(i)})))}}async function gf(s){const e=await fetch(s.dataUrl);if(!e.ok)throw new Error(`无法读取内嵌 Spine 文件:${s.name}`);return new File([await e.blob()],s.name)}async function kk(s){return{skeleton:await gf(s.skeleton),atlas:await gf(s.atlas),textures:await Promise.all(s.textures.map(gf))}}const Uw="SpineParticle.EditorConfig",$w=1;function Xw(s){return{backgroundX:s.backgroundX,backgroundY:s.backgroundY,backgroundOpacity:s.backgroundOpacity,backgroundImageName:s.backgroundImageName,backgroundImageData:s.backgroundImageData,showGrid:s.showGrid,exportSettings:Vt(s.exportSettings)}}function Fk(s){return JSON.parse(JSON.stringify(s,(e,t)=>{if(!(e==="texture"||e==="trailTexture"||e==="frames"))return t}))}function Vw(s){const e=Vt(s);return delete e.tags,delete e.selectedTag,e}function Ok(s){const e=Xw(s.settings),t=s.timeline.playbackEnd>=Math.max(1,s.timeline.totalFrames-1);return Fk({format:Uw,version:$w,savedAt:new Date().toISOString(),editor:Vt(s.editor),settings:e,timeline:{fps:s.timeline.fps,loop:s.timeline.loop,playbackStart:s.timeline.playbackStart,playbackEnd:s.timeline.playbackEnd,playbackEndAuto:t,abLoop:s.timeline.abLoop,animations:[...s.timeline.animations]},selection:{type:s.activeObjectType,id:s.activeObjectId},scene:{systems:s.systems.map(i=>({...Vt(i),frames:void 0})),colliders:s.colliders.map(Vw),paths:Vt(s.paths),spines:Vt(s.spines)}})}function Lk(s,e,t,i){const n=Math.max(1,i);let r=0;for(const o of s){const a=o.config,c=Math.max(0,Number(a.lifeMin)||0),l=Math.max(0,Number(a.lifeMax)||0),h=a.lifeMode==="fixed"?c:Math.max(c,l),u=a.mode==="stream"?a.streamBehavior==="loop"?Ps(a,n).total/n:Math.max(1/n,Number(a.duration)||0):0;let d=Math.max(0,Number(a.delay)||0)+u+h;a.mode==="stream"&&a.streamBehavior==="loop"&&(d=Math.max(0,Number(a.delay)||0)+Ps(a,n).total/n),r=Math.max(r,d)}for(const o of t){const a=o.animations.find(c=>c.name===o.selectedAnimation);a&&(r=Math.max(r,Math.max(0,Number(o.timeOffset)||0)+Math.max(0,a.duration||0)))}for(const o of e)o.followPath&&o.followPathId&&(r=Math.max(r,Math.max(0,o.followDuration)||0));return F1(r,n)}function Bk(){return`SpineParticle-${new Date().toISOString().replace(/[-:]/g,"").replace(/\.\d{3}Z$/,"").replace("T","-")}.json`}function Yw(s){const e=Ok(s),t=new Blob([JSON.stringify(e,null,2)],{type:"application/json;charset=utf-8"}),i=URL.createObjectURL(t),n=document.createElement("a");return n.href=i,n.download=Bk(),document.body.appendChild(n),n.click(),n.remove(),setTimeout(()=>URL.revokeObjectURL(i),0),e}function Gw(s){let e;try{e=JSON.parse(s)}catch{throw new Error("配置文件不是有效的 JSON")}const t=e;if(t.format!==Uw)throw new Error("不是 SpineParticle 编辑器配置文件");if(t.version!==$w)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 Nk(s){const e=new Map,t=n=>{const r=n==="/particles/star.png"?"/images/star.png":n==="/trails/trail.png"?"/images/trail.png":n||"/images/star.png";let o=e.get(r);return o||(o=Ke.fromURL(r).then(a=>vr(a)),e.set(r,o)),o},i=await t("/images/star.png");await Promise.all(s.map(async n=>{var o;const r=Xn(n.config);r.texture=i,await Promise.all(r.imageResources.map(async a=>{a.texture=await t(a.previewUrl||"/images/star.png"),await Promise.all(a.sequenceFrames.map(async c=>{c.texture=await t(c.previewUrl||a.previewUrl||"/images/star.png")}))})),await Promise.all(r.trailResources.map(async a=>{a.texture=await t(a.previewUrl||"/images/trail.png")})),r.trailTexture=((o=r.trailResources[0])==null?void 0:o.texture)||null,n.frames=[]}))}async function Dk(s){const e=new Map;try{for(const t of s){if(!t.sourceBundle)continue;const i=await kk(t.sourceBundle);e.set(t.id,await Dw(i.skeleton,i.atlas,i.textures))}return e}catch(t){for(const i of e.values())for(const n of i.textures)n.destroy(!0);throw t}}function Uk(s,e){const t=(e==null?void 0:e.type)||"particle",i=Number(e==null?void 0:e.id)||0;(t==="particle"?s.systems.some(r=>r.id===i):t==="collision"?s.colliders.some(r=>r.id===i):t==="path"?s.paths.some(r=>r.id===i):s.spines.some(r=>r.id===i))?s.selectSceneObject(t,i):s.systems[0]?s.selectSceneObject("particle",s.systems[0].id):s.colliders[0]?s.selectSceneObject("collision",s.colliders[0].id):s.paths[0]?s.selectSceneObject("path",s.paths[0].id):s.spines[0]?s.selectSceneObject("spine",s.spines[0].id):(s.activeObjectType="particle",s.activeObjectId=0,s.activeId=0)}async function $k(s,e){var d,f,m,p,g,x,v,y,S;const t=Gw(JSON.stringify(e)),i=Vt(t.scene.systems),n=t.scene.colliders.map(Vw),r=Vt(t.scene.paths),o=Vt(t.scene.spines);for(const C of o)C.sourceBundle==null&&(C.sourceBundle=null),C.dataVersion==null&&(C.dataVersion=""),Array.isArray(C.slots)||(C.slots=[]),typeof C.selectedBone!="string"&&(C.selectedBone=""),typeof C.selectedSlot!="string"&&(C.selectedSlot="");await Nk(i);const a=await Dk(o),c=new Map(s.spines.map(C=>[C.id,C.assetVersion]));for(const C of s.spines)Fl(C.id);s.systems=i,s.colliders=n,s.paths=r,s.spines=o,Object.assign(s.editor,Vt(t.editor||{}));const l=t.settings;if(l)for(const C of["backgroundX","backgroundY","backgroundOpacity","backgroundImageName","backgroundImageData","showGrid"])Object.prototype.hasOwnProperty.call(l,C)&&(s.settings[C]=l[C]);s.settings.exportSettings=I1((d=t.settings)==null?void 0:d.exportSettings),s.settings.undoLimit=Math.min(200,Math.max(1,Math.round(Number(s.settings.undoLimit)||20))),s.timeline.fps=Math.max(1,Math.round(Number((f=t.timeline)==null?void 0:f.fps)||30));const h=Math.max(1,Math.floor(Number((m=t.timeline)==null?void 0:m.playbackEnd)||Number.MAX_SAFE_INTEGER)),u=((p=t.timeline)==null?void 0:p.playbackEndAuto)??h>=Lk(i,n,o,s.timeline.fps);s.timeline.abLoop=((g=t.timeline)==null?void 0:g.abLoop)===!0,s.timeline.loop=((x=t.timeline)==null?void 0:x.loop)!==!1,s.timeline.animations=Array.isArray((v=t.timeline)==null?void 0:v.animations)&&t.timeline.animations.length?[...new Set(t.timeline.animations.filter(C=>typeof C=="string"&&C.trim()).map(C=>C.trim()))]:["animation"];for(const C of s.spines){const w=a.get(C.id);if(C.assetVersion=Math.max(Number(C.assetVersion)||0,c.get(C.id)||0)+1,!w){C.status="empty",C.error=C.skeletonFileName?"配置未包含可复用的 Spine 原始资源":"",C.animations=[],C.bones=[],C.slots=[],C.selectedAnimation="";continue}pu(C.id,w),C.dataVersion=w.dataVersion,C.animations=w.animations,C.bones=w.bones,C.slots=w.slots,w.animations.some(b=>b.name===C.selectedAnimation)||(C.selectedAnimation=((y=w.animations[0])==null?void 0:y.name)||""),C.status="ready",C.error=""}s.syncSceneSequences(),Uk(s,t.selection),s.timeline.playbackStart=Math.max(0,Math.floor(Number((S=t.timeline)==null?void 0:S.playbackStart)||0)),s.timeline.playbackEnd=h,s.timeline.frame=0,s.timeline.recorded=!1,s.timeline.playing=!0;for(const C of s.systems)s.timeline.animations.includes(C.animation)||(C.animation=s.timeline.animations[0]);return s.recalcTotalFrames(),u&&(s.timeline.playbackEnd=s.timeline.totalFrames-1),s.timeline.frame=s.timeline.playbackStart,t}async function jw(s,e){return $k(s,Gw(e))}async function Xk(s,e){if(!/\.json$/i.test(e.name))throw new Error("请选择 .json 配置文件");return jw(s,await e.text())}const yu=po({undoCount:0});let Ch=null,On=null,Tr=[],Ba=null,Ln=null,Eh=!1;function kp(s){return{systems:s.systems.map(t=>{const i=Vt(t);return i.frames=void 0,i}),colliders:Vt(s.colliders),paths:Vt(s.paths),spines:Vt(s.spines),animations:[...s.timeline.animations],settings:Xw(s.settings)}}function Fp(s){return JSON.stringify(s,(e,t)=>e==="texture"||e==="trailTexture"?null:typeof t=="string"&&t.startsWith("data:")&&t.length>256?`${t.length}:${t.slice(0,96)}:${t.slice(-48)}`:t)}function Hw(s,e=kp(s),t=Fp(e)){const i=new Map;for(const n of e.spines){const r=AR(n.id);r&&i.set(n.id,r)}return{data:e,signature:t,spineAssets:i}}function Ah(s){if(s){for(const e of s.spineAssets.values())CR(e);s.spineAssets.clear()}}function Ww(s){for(;Tr.length>s;)Ah(Tr.shift()||null);yu.undoCount=Tr.length}function zw(){const s=Ch;if(!s||!On||Eh)return;const e=kp(s),t=Fp(e);t!==On.signature&&(Tr.push(On),On=Hw(s,e,t),Ww(s.settings.undoLimit))}function Vk(){Eh||(Ln&&clearTimeout(Ln),Ln=setTimeout(()=>{Ln=null,zw()},250))}function Yk(s){const e=s.activeObjectId;return s.activeObjectType==="particle"?s.systems.some(t=>t.id===e):s.activeObjectType==="collision"?s.colliders.some(t=>t.id===e):s.activeObjectType==="path"?s.paths.some(t=>t.id===e):s.spines.some(t=>t.id===e)}function Gk(s){var t,i;if(!Yk(s)){const n=s.systems[0],r=s.colliders[0],o=s.paths[0],a=s.spines[0];n?(s.activeObjectType="particle",s.activeObjectId=n.id):r?(s.activeObjectType="collision",s.activeObjectId=r.id):o?(s.activeObjectType="path",s.activeObjectId=o.id):(s.activeObjectType="spine",s.activeObjectId=(a==null?void 0:a.id)||0)}const e=s.activeObjectType==="particle"?s.systems.find(n=>n.id===s.activeObjectId):s.systems.find(n=>n.id===s.activeId);s.activeId=(e==null?void 0:e.id)||((t=s.systems[0])==null?void 0:t.id)||0,s.timeline.animation=(e==null?void 0:e.animation)||((i=s.systems[0])==null?void 0:i.animation)||s.timeline.animations[0]||"animation"}function jk(s,e){const t=On;Eh=!0;try{for(const i of s.spines)Fl(i.id);s.systems=Vt(e.data.systems),s.colliders=Vt(e.data.colliders),s.paths=Vt(e.data.paths),s.spines=Vt(e.data.spines),s.timeline.animations=[...e.data.animations],Object.assign(s.settings,Vt(e.data.settings));for(const[i,n]of e.spineAssets)pu(i,n);for(const i of s.systems)i.frames=[];s.timeline.recorded=!1,s.timeline.playing=!1,Gk(s),s.recalcTotalFrames(),On=e}finally{Eh=!1,Ah(t)}}function Hk(s){if(!(Ch===s&&Ba)){Ba==null||Ba(),Ln&&clearTimeout(Ln),Ah(On);for(const e of Tr)Ah(e);Tr=[],Ch=s,On=Hw(s),yu.undoCount=0,Ba=ai(()=>Fp(kp(s)),Vk,{flush:"post"})}}function Wk(s,e){const t=Math.min(200,Math.max(1,Math.round(Number(e)||20)));s.settings.undoLimit=t,Ww(t)}function qw(){const s=Ch;if(!s||!On)return!1;Ln&&(clearTimeout(Ln),Ln=null),zw();const e=Tr.pop();return e?(jk(s,e),yu.undoCount=Tr.length,!0):!1}function zk(s){const e=s instanceof HTMLElement?s:null;return!!(e!=null&&e.closest('input, textarea, select, [contenteditable="true"]'))}function qk(s){function e(i){var r;const n=i.target instanceof Node?i.target:null;s.canvasFocused.value=!!n&&!!((r=s.canvasElement.value)!=null&&r.contains(n))}function t(i){const n=i.key.toLowerCase();if((i.ctrlKey||i.metaKey)&&!i.altKey&&n==="s"){i.preventDefault(),i.stopPropagation(),s.save();return}if((i.ctrlKey||i.metaKey)&&!i.altKey&&n==="z"){i.preventDefault(),i.stopPropagation(),s.undo();return}if(i.ctrlKey||i.metaKey||i.altKey||zk(i.target))return;if(n==="d"){i.preventDefault(),s.togglePlay();return}if(n==="s"){i.preventDefault(),s.toStart();return}if(!s.canvasFocused.value)return;const r={q:"",w:"translate",e:"rotate",r:"scale"};n in r&&(i.preventDefault(),s.setTool(r[n]))}ys(()=>{document.addEventListener("pointerdown",e,!0),window.addEventListener("keydown",t,!0)}),Al(()=>{document.removeEventListener("pointerdown",e,!0),window.removeEventListener("keydown",t,!0)})}const Kk={class:"help-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"help-title"},Zk={class:"help-body"},Jk=["aria-expanded"],Qk={class:"caret"},eF={class:"help-module-body"},tF=["aria-expanded"],iF={class:"caret"},sF={class:"help-module-body"},nF=["aria-expanded"],rF={class:"caret"},oF={class:"help-module-body"},aF=["aria-expanded"],lF={class:"caret"},cF={class:"help-module-body"},hF=["aria-expanded"],uF={class:"caret"},dF={class:"help-module-body"},fF=["aria-expanded"],mF={class:"caret"},pF={class:"help-module-body"},gF=["aria-expanded"],vF={class:"caret"},yF={class:"help-module-body"},xF=["aria-expanded"],bF={class:"caret"},wF={class:"help-module-body"},SF=["aria-expanded"],MF={class:"caret"},TF={class:"help-module-body"},_F=Zt({__name:"HelpDialog",props:{show:{type:Boolean}},emits:["close"],setup(s,{emit:e}){const t=e,i=Fe(Array.from({length:9},()=>!1));function n(){t("close")}function r(o){o.key==="Escape"&&n()}return ys(()=>window.addEventListener("keydown",r)),Rr(()=>window.removeEventListener("keydown",r)),(o,a)=>s.show?(q(),J("div",{key:0,class:"help-overlay",role:"presentation",onClick:qe(n,["self"])},[T("section",Kk,[T("header",{class:"help-head"},[a[9]||(a[9]=T("div",null,[T("h2",{id:"help-title"},"使用说明"),T("p",null,"从创建粒子到保存、导出的快速入门")],-1)),T("button",{class:"help-close","aria-label":"关闭使用说明",title:"关闭 (Esc)",onClick:n},"✕")]),T("div",Zk,[a[37]||(a[37]=is('<section class="help-section help-start" data-v-78204b9d><h3 data-v-78204b9d>快速开始</h3><ol data-v-78204b9d><li data-v-78204b9d><b data-v-78204b9d>创建对象:</b>在左侧“场景对象”中用 +粒子 / +碰撞 / +路径 / +Spine 添加场景对象。</li><li data-v-78204b9d><b data-v-78204b9d>编辑粒子:</b>选中某个粒子系统,依次调整“发射模式 → 发射器形状 → 粒子属性 → 外观与资源 → 修改器”。</li><li data-v-78204b9d><b data-v-78204b9d>查看效果:</b>底部时间轴可播放、暂停、逐帧或拖动;修改任意参数后会自动重新计算。</li><li data-v-78204b9d><b data-v-78204b9d>保存与导出:</b>用“保存配置”保留工程;“导出 Spine Json / images 包 / .spine 包”输出成品。</li></ol><p class="help-note" data-v-78204b9d>每个模块组标题右侧的“重置”可把该组参数恢复默认;系统设置会自动保存在当前浏览器。</p></section><div class="help-grid" data-v-78204b9d><section class="help-section" data-v-78204b9d><h3 data-v-78204b9d>常用操作</h3><dl class="help-list" data-v-78204b9d><div data-v-78204b9d><dt data-v-78204b9d>小眼睛</dt><dd data-v-78204b9d>单独显示/隐藏对象;隐藏的粒子系统不会被导出。</dd></div><div data-v-78204b9d><dt data-v-78204b9d>+Copy</dt><dd data-v-78204b9d>完整复制当前选中对象,方便对比不同参数。</dd></div><div data-v-78204b9d><dt data-v-78204b9d>背景图</dt><dd data-v-78204b9d>上传参考图并调整位置和透明度,只用于画布预览。</dd></div><div data-v-78204b9d><dt data-v-78204b9d>系统设置</dt><dd data-v-78204b9d>管理界面布局、辅助显示、刻度等,自动存入浏览器。</dd></div><div data-v-78204b9d><dt data-v-78204b9d>撤销/重做</dt><dd data-v-78204b9d>Ctrl+Z 撤回一步;可达成的步数在系统设置中调整。</dd></div><div data-v-78204b9d><dt data-v-78204b9d>Spine 骨骼</dt><dd data-v-78204b9d>在层级树搜索并选择骨骼,可用于粒子发射器跟随。</dd></div></dl></section><section class="help-section" data-v-78204b9d><h3 data-v-78204b9d>快捷键</h3><div class="shortcut-list" data-v-78204b9d><div data-v-78204b9d><kbd data-v-78204b9d>Ctrl/⌘</kbd><span data-v-78204b9d>+</span><kbd data-v-78204b9d>Z</kbd><em data-v-78204b9d>撤回上一步</em></div><div data-v-78204b9d><kbd data-v-78204b9d>Ctrl/⌘</kbd><span data-v-78204b9d>+</span><kbd data-v-78204b9d>S</kbd><em data-v-78204b9d>保存配置</em></div><div data-v-78204b9d><kbd data-v-78204b9d>Q</kbd><em data-v-78204b9d>拖动画布</em></div><div data-v-78204b9d><kbd data-v-78204b9d>W</kbd><em data-v-78204b9d>位移工具</em></div><div data-v-78204b9d><kbd data-v-78204b9d>E</kbd><em data-v-78204b9d>旋转工具</em></div><div data-v-78204b9d><kbd data-v-78204b9d>R</kbd><em data-v-78204b9d>缩放工具</em></div><div data-v-78204b9d><kbd data-v-78204b9d>D</kbd><em data-v-78204b9d>播放 / 暂停</em></div><div data-v-78204b9d><kbd data-v-78204b9d>S</kbd><em data-v-78204b9d>回到第一帧</em></div></div><p class="help-note" data-v-78204b9d>Q / W / E / R 需先点击画布;光标位于输入框时,单键快捷键不会触发。</p></section></div><div class="help-doc-title" data-v-78204b9d>功能模块详解</div>',3)),T("section",{class:Ce(["help-section help-module",{open:i.value[0]}])},[T("button",{type:"button",class:"help-module-head","aria-expanded":i.value[0]?"true":"false",onClick:a[0]||(a[0]=c=>i.value[0]=!i.value[0])},[a[10]||(a[10]=T("span",{class:"mnum"},"1",-1)),a[11]||(a[11]=T("span",{class:"mtitle"},"配置管理",-1)),T("span",Qk,ve(i.value[0]?"▾":"▸"),1)],8,Jk),ce(T("div",eF,[...a[12]||(a[12]=[is('<dl class="help-list" data-v-78204b9d><div data-v-78204b9d><dt data-v-78204b9d>保存配置</dt><dd data-v-78204b9d>把当前全部场景对象和参数保存为工程 JSON 文件(也支持 Ctrl+S)。</dd></div><div data-v-78204b9d><dt data-v-78204b9d>加载配置</dt><dd data-v-78204b9d>选择本地配置文件,恢复完整工程。</dd></div><div data-v-78204b9d><dt data-v-78204b9d>预设</dt><dd data-v-78204b9d>从下拉中选择已保存的预设快速套用;点击下拉即可刷新列表。</dd></div><div data-v-78204b9d><dt data-v-78204b9d>范围</dt><dd data-v-78204b9d>配置只含对象与参数,不含“系统设置”;系统设置单独存于浏览器。</dd></div></dl>',1)])],512),[[Si,i.value[0]]])],2),T("section",{class:Ce(["help-section help-module",{open:i.value[1]}])},[T("button",{type:"button",class:"help-module-head","aria-expanded":i.value[1]?"true":"false",onClick:a[1]||(a[1]=c=>i.value[1]=!i.value[1])},[a[13]||(a[13]=T("span",{class:"mnum"},"2",-1)),a[14]||(a[14]=T("span",{class:"mtitle"},"场景对象",-1)),T("span",iF,ve(i.value[1]?"▾":"▸"),1)],8,tF),ce(T("div",sF,[...a[15]||(a[15]=[is('<dl class="help-list" data-v-78204b9d><div data-v-78204b9d><dt data-v-78204b9d>粒子</dt><dd data-v-78204b9d>核心对象。可设名称、位置 X/Y、偏移、旋转、缩放 X/Y,以及“随机种子”——相同种子可精确复现同一次效果。</dd></div><div data-v-78204b9d><dt data-v-78204b9d>碰撞</dt><dd data-v-78204b9d>圆形/椭圆/矩形/多边形/自定义;启用开关、碰撞响应(物理弹跳/暂停/销毁)、弹性与摩擦,还可沿某条路径移动并带进度曲线。</dd></div><div data-v-78204b9d><dt data-v-78204b9d>路径</dt><dd data-v-78204b9d>贝塞尔路径,可双击新建/删除锚点、拖手柄调曲线;内置圆/方/多边形/星形预设,支持闭合与颜色。</dd></div><div data-v-78204b9d><dt data-v-78204b9d>Spine</dt><dd data-v-78204b9d>加载 .json+.atlas+.png 预览骨骼动画,可查看/搜索骨骼层级树,用于粒子“发射器跟随”。</dd></div><div data-v-78204b9d><dt data-v-78204b9d>通用</dt><dd data-v-78204b9d>每个对象都有小眼睛显隐;“+Copy”可以复制当前对象;隐藏的粒子系统不会进入导出。</dd></div></dl>',1)])],512),[[Si,i.value[1]]])],2),T("section",{class:Ce(["help-section help-module",{open:i.value[2]}])},[T("button",{type:"button",class:"help-module-head","aria-expanded":i.value[2]?"true":"false",onClick:a[2]||(a[2]=c=>i.value[2]=!i.value[2])},[a[16]||(a[16]=T("span",{class:"mnum"},"3",-1)),a[17]||(a[17]=T("span",{class:"mtitle"},"发射模式",-1)),T("span",rF,ve(i.value[2]?"▾":"▸"),1)],8,nF),ce(T("div",oF,[...a[18]||(a[18]=[is('<dl class="help-list" data-v-78204b9d><div data-v-78204b9d><dt data-v-78204b9d>持续</dt><dd data-v-78204b9d>按“每秒发射数量”持续喷射;再分“常规持续”(发射时长)与“循环持续”(三段式:开始循环 / 纯循环 / 结束循环,可自动或自定义帧长,做到无缝衔接)。</dd></div><div data-v-78204b9d><dt data-v-78204b9d>爆发</dt><dd data-v-78204b9d>一次性发射“单次数量”颗粒子。</dd></div><div data-v-78204b9d><dt data-v-78204b9d>延迟时间</dt><dd data-v-78204b9d>粒子条左端位置,表示发射开始前的等待时间。</dd></div><div data-v-78204b9d><dt data-v-78204b9d>注意</dt><dd data-v-78204b9d>循环持续模式不支持骨骼跟随和路径跟随;开关时会把跟随设置恢复默认。</dd></div></dl>',1)])],512),[[Si,i.value[2]]])],2),T("section",{class:Ce(["help-section help-module",{open:i.value[3]}])},[T("button",{type:"button",class:"help-module-head","aria-expanded":i.value[3]?"true":"false",onClick:a[3]||(a[3]=c=>i.value[3]=!i.value[3])},[a[19]||(a[19]=T("span",{class:"mnum"},"4",-1)),a[20]||(a[20]=T("span",{class:"mtitle"},"发射器形状",-1)),T("span",lF,ve(i.value[3]?"▾":"▸"),1)],8,aF),ce(T("div",cF,[...a[21]||(a[21]=[is('<dl class="help-list" data-v-78204b9d><div data-v-78204b9d><dt data-v-78204b9d>形状</dt><dd data-v-78204b9d>点 / 圆形 / 矩形 / 锥形 / 路径。</dd></div><div data-v-78204b9d><dt data-v-78204b9d>圆·锥</dt><dd data-v-78204b9d>内半径与外半径,形成环形或锥形发射区;锥形额外有“锥形朝向”和“开口角度”。</dd></div><div data-v-78204b9d><dt data-v-78204b9d>矩形</dt><dd data-v-78204b9d>“外框 − 内框”形成环带,可分别设置内外宽高。</dd></div><div data-v-78204b9d><dt data-v-78204b9d>路径</dt><dd data-v-78204b9d>选一条场景路径作为出生线;出生分布可选等距固定或随机。</dd></div><div data-v-78204b9d><dt data-v-78204b9d>发射角度</dt><dd data-v-78204b9d>固定 / 随机(基准角度 + 随机范围)/ 径向(圆、矩、锥中心向外)/ 垂直于路径 / 沿路径方向。</dd></div></dl>',1)])],512),[[Si,i.value[3]]])],2),T("section",{class:Ce(["help-section help-module",{open:i.value[4]}])},[T("button",{type:"button",class:"help-module-head","aria-expanded":i.value[4]?"true":"false",onClick:a[4]||(a[4]=c=>i.value[4]=!i.value[4])},[a[22]||(a[22]=T("span",{class:"mnum"},"5",-1)),a[23]||(a[23]=T("span",{class:"mtitle"},"粒子属性",-1)),T("span",uF,ve(i.value[4]?"▾":"▸"),1)],8,hF),ce(T("div",dF,[...a[24]||(a[24]=[T("dl",{class:"help-list"},[T("div",null,[T("dt",null,"初始参数"),T("dd",null,"生命周期、速度、缩放(统一或 X/Y 分离)、初始旋转(可跟随发射方向)。每个属性支持固定 / 随机 / 曲线三种取值。")]),T("div",null,[T("dt",null,"生命周期变化"),T("dd",null,"速度倍率、缩放倍率(统一/分离)、旋转速度,均可用“生命周期 → 倍率”曲线控制。")]),T("div",null,[T("dt",null,"曲线含义"),T("dd",null,"横轴为粒子生命周期 0→1,纵轴为倍率或对应数值。")])],-1)])],512),[[Si,i.value[4]]])],2),T("section",{class:Ce(["help-section help-module",{open:i.value[5]}])},[T("button",{type:"button",class:"help-module-head","aria-expanded":i.value[5]?"true":"false",onClick:a[5]||(a[5]=c=>i.value[5]=!i.value[5])},[a[25]||(a[25]=T("span",{class:"mnum"},"6",-1)),a[26]||(a[26]=T("span",{class:"mtitle"},"外观与资源",-1)),T("span",mF,ve(i.value[5]?"▾":"▸"),1)],8,fF),ce(T("div",pF,[...a[27]||(a[27]=[T("dl",{class:"help-list"},[T("div",null,[T("dt",null,"透明度"),T("dd",null,"曲线或固定;曲线模式可选“跟随导出 / 线性 / 贝塞尔”。")]),T("div",null,[T("dt",null,"图片资源"),T("dd",null,"“+”新增,可上传单图或序列帧;多张图片按权重随机。每张可调缩放、轴心、颜色(固定/随机/生命周期渐变)、混合模式(正常/相加/相乘/滤色)、独立透明度(关/固定/曲线)。")]),T("div",null,[T("dt",null,"序列帧"),T("dd",null,"播放方式:单次隐藏 / 单次定格 / 正向循环 / 反向循环,可设每秒帧数。")])],-1)])],512),[[Si,i.value[5]]])],2),T("section",{class:Ce(["help-section help-module",{open:i.value[6]}])},[T("button",{type:"button",class:"help-module-head","aria-expanded":i.value[6]?"true":"false",onClick:a[6]||(a[6]=c=>i.value[6]=!i.value[6])},[a[28]||(a[28]=T("span",{class:"mnum"},"7",-1)),a[29]||(a[29]=T("span",{class:"mtitle"},"修改器",-1)),T("span",vF,ve(i.value[6]?"▾":"▸"),1)],8,gF),ce(T("div",yF,[...a[30]||(a[30]=[is('<dl class="help-list" data-v-78204b9d><div data-v-78204b9d><dt data-v-78204b9d>移动噪声</dt><dd data-v-78204b9d>强度、波动范围、时间流速,让粒子轨迹产生抖动。</dd></div><div data-v-78204b9d><dt data-v-78204b9d>重力 / 风力</dt><dd data-v-78204b9d>固定或随机强度、方向,以及生命周期内强度曲线。</dd></div><div data-v-78204b9d><dt data-v-78204b9d>力场</dt><dd data-v-78204b9d>中心 X/Y、强度(正吸负斥)、半径、衰减(恒定/线性/反比)。</dd></div><div data-v-78204b9d><dt data-v-78204b9d>吸附</dt><dd data-v-78204b9d>延迟后把粒子吸到指定点,到达范围即死亡;可直线或曲线。</dd></div><div data-v-78204b9d><dt data-v-78204b9d>拖尾</dt><dd data-v-78204b9d>独立拖尾图片(多资源按权重)、旋转、拖尾骨骼数、拖尾比例;长度/宽度可固定或随机并支持放大;可加生命周期长度曲线与形状曲线;颜色/透明度可跟随粒子、固定或曲线。</dd></div><div data-v-78204b9d><dt data-v-78204b9d>发射器跟随</dt><dd data-v-78204b9d>跟随某条路径(局部/世界、正/反向、进度曲线),或跟随 Spine 骨骼(选中的骨骼 + 偏移)。</dd></div><div data-v-78204b9d><dt data-v-78204b9d>碰撞 + 阻尼</dt><dd data-v-78204b9d>选择场景中已启用的碰撞对象参与,并设置速度阻尼。</dd></div></dl>',1)])],512),[[Si,i.value[6]]])],2),T("section",{class:Ce(["help-section help-module",{open:i.value[7]}])},[T("button",{type:"button",class:"help-module-head","aria-expanded":i.value[7]?"true":"false",onClick:a[7]||(a[7]=c=>i.value[7]=!i.value[7])},[a[31]||(a[31]=T("span",{class:"mnum"},"8",-1)),a[32]||(a[32]=T("span",{class:"mtitle"},"导出设置",-1)),T("span",bF,ve(i.value[7]?"▾":"▸"),1)],8,xF),ce(T("div",wF,[...a[33]||(a[33]=[is('<dl class="help-list" data-v-78204b9d><div data-v-78204b9d><dt data-v-78204b9d>图片路径</dt><dd data-v-78204b9d>写入 Spine 的 images 路径,例如 ./images/。</dd></div><div data-v-78204b9d><dt data-v-78204b9d>Spine 版本</dt><dd data-v-78204b9d>3.8 / 4.0 / 4.1 / 4.2 / 4.3。</dd></div><div data-v-78204b9d><dt data-v-78204b9d>关键帧曲线</dt><dd data-v-78204b9d>线性或平滑贝塞尔;出生、死亡、突变仍使用阶跃关键帧。</dd></div><div data-v-78204b9d><dt data-v-78204b9d>导出 FPS</dt><dd data-v-78204b9d>修改 FPS 会保持动画实际秒数不变;“不写 fps”只省略元数据。</dd></div><div data-v-78204b9d><dt data-v-78204b9d>其它</dt><dd data-v-78204b9d>整数帧对齐、骨骼对象池、排除无内容动画。</dd></div><div data-v-78204b9d><dt data-v-78204b9d>导出按钮</dt><dd data-v-78204b9d>“导出 Spine Json”生成骨骼动画文件;“导出 images 包”单独下载图片 ZIP;“导出 .spine 包”需要连接器。</dd></div></dl>',1)])],512),[[Si,i.value[7]]])],2),T("section",{class:Ce(["help-section help-module help-connector",{open:i.value[8]}])},[T("button",{type:"button",class:"help-module-head","aria-expanded":i.value[8]?"true":"false",onClick:a[8]||(a[8]=c=>i.value[8]=!i.value[8])},[a[34]||(a[34]=T("span",{class:"mnum"},"9",-1)),a[35]||(a[35]=T("span",{class:"mtitle"},"连接器(Spine 连接器)使用说明",-1)),T("span",MF,ve(i.value[8]?"▾":"▸"),1)],8,SF),ce(T("div",TF,[...a[36]||(a[36]=[is('<p class="connector-intro" data-v-78204b9d>连接器用于把网页生成的 JSON 和图片,调用你电脑上<b data-v-78204b9d>已安装并激活</b>的 Spine,转换成可编辑的 <b data-v-78204b9d>.spine</b> 工程。</p><dl class="help-list" data-v-78204b9d><div data-v-78204b9d><dt data-v-78204b9d>前置</dt><dd data-v-78204b9d>电脑已安装并激活 Spine;并已启动桌面版连接器APP。</dd></div><div data-v-78204b9d><dt data-v-78204b9d>下载</dt><dd data-v-78204b9d><a class="dl-link" href="/downloads/connector/SpineParticleConnector-windows-x64.exe" download data-v-78204b9d>Windows 版<br data-v-78204b9d><small data-v-78204b9d>SpineParticleConnector-windows-x64.exe</small></a><a class="dl-link" href="/downloads/connector/SpineParticleConnector-macos-universal.zip" download data-v-78204b9d>macOS 版(Universal)<br data-v-78204b9d><small data-v-78204b9d>SpineParticleConnector-macos-universal.zip</small></a></dd></div><div data-v-78204b9d><dt data-v-78204b9d>网页端</dt><dd data-v-78204b9d>导出区状态显示“连接器可用 · Spine 已就绪”后,点击“导出 .spine 包”。</dd></div><div data-v-78204b9d><dt data-v-78204b9d>首次授权</dt><dd data-v-78204b9d>生产网站首次连接会显示“授权当前网站”;点击后在本机确认页核对完整来源(协议 + 域名 + 端口),再点“允许此网站”。授权一次后本机会保存白名单。本地 127.0.0.1:5173 默认允许。</dd></div><div data-v-78204b9d><dt data-v-78204b9d>路径设置</dt><dd data-v-78204b9d>连接器自动检测 Spine 安装位置;检测不到时可在桌面窗口手动指定:Windows 选 Spine.com,macOS 选 Spine.app/Contents/MacOS/Spine。</dd></div><div data-v-78204b9d><dt data-v-78204b9d>下载结果</dt><dd data-v-78204b9d>得到 ZIP 包,内含 .spine 工程和图片目录(如 images/star.png)。</dd></div><div data-v-78204b9d><dt data-v-78204b9d>版本</dt><dd data-v-78204b9d>连接器按请求与 JSON 内的版本自动匹配 3.8~4.3,使用最新可用补丁。</dd></div><div data-v-78204b9d><dt data-v-78204b9d>安全</dt><dd data-v-78204b9d>仅监听本机 127.0.0.1:27843;授权与白名单保存在连接器里;文件在临时目录转换后清理,并有大小限制。</dd></div></dl>',2)])],512),[[Si,i.value[8]]])],2),a[38]||(a[38]=T("section",{class:"help-section help-export"},[T("h3",null,"配置与导出有什么区别?"),T("p",null,[T("b",null,"保存配置"),ft("会保存编辑器中的全部对象和参数,之后可以继续修改;"),T("b",null,"导出 Spine Json"),ft("只导出显示中的粒子系统,并把跟随、碰撞和拖尾结果烘焙为独立动画数据。")])],-1))])])])):xe("",!0)}}),Jt=(s,e)=>{const t=s.__vccOpts||s;for(const[i,n]of e)t[i]=n;return t},CF=Jt(_F,[["__scopeId","data-v-78204b9d"]]);function ra(s){const e=()=>{window.removeEventListener("pointermove",s),window.removeEventListener("pointerup",e),window.removeEventListener("pointercancel",e)};window.addEventListener("pointermove",s),window.addEventListener("pointerup",e),window.addEventListener("pointercancel",e)}function ds(s,e,t){const i=s.holder.value,n=s.app(),r=i.getBoundingClientRect(),o=Math.max(1e-4,s.store.editor.viewScale),a=e-r.left,c=t-r.top;return{x:(a-n.screen.width/2-s.store.editor.viewX)/o,y:-(c-n.screen.height*.5-s.store.editor.viewY)/o}}function EF(s,e){const t=s.holder.value,i=s.app(),n=s.store,r=t.getBoundingClientRect(),o=e.clientX-r.left,a=e.clientY-r.top,c=e.deltaY<0?1.12:1/1.12,l=n.editor.viewScale,h=Math.max(.01,l*c),u=i.screen.width/2,d=i.screen.height*.5,f=n.editor.viewX,m=n.editor.viewY,p=(o-u-f)/l,g=(a-d-m)/l;n.editor.viewX=o-u-p*h,n.editor.viewY=a-d-g*h,n.editor.viewScale=h}function AF(s,e,t){const i=s.store,n=i.editor.viewX,r=i.editor.viewY;ra(o=>{i.editor.viewX=n+(o.clientX-e),i.editor.viewY=r+(o.clientY-t)})}function Kw(s,e){const t=Math.max(.01,s.store.editor.viewScale*e);s.store.editor.viewScale=t}function IF(s){Kw(s,1.2)}function RF(s){Kw(s,1/1.2)}function PF(s){s.store.editor.viewScale=1,s.store.editor.viewX=0,s.store.editor.viewY=0}function kF(s){s.store.editor.viewScale=1,s.store.editor.viewX=0,s.store.editor.viewY=0}function FF(s){s.store.settings.showGrid=!s.store.settings.showGrid}const OF={class:"topbar"},LF=["disabled"],BF={class:"tool-group"},NF={class:"tool-group"},DF={key:0,class:"background-panel"},UF=["disabled"],$F=["title"],XF={class:"background-position-row"},VF={class:"background-opacity-row"},YF={class:"zoom-pct"},GF=Zt({__name:"StageToolbar",props:{ctx:{},activeTool:{},showSettings:{type:Boolean},showHelp:{type:Boolean}},emits:["update:activeTool","update:showSettings","update:showHelp","clear-background","background-file"],setup(s,{emit:e}){const t=s,i=e,n=yo(),r=Fe(!1),o=Fe(null),a=Le(()=>n.settings.backgroundImageName);function c(p){i("update:activeTool",t.activeTool===p?"":p)}function l(){r.value=!r.value,r.value&&i("update:showSettings",!1)}function h(){const p=!t.showSettings;i("update:showSettings",p),p&&(r.value=!1)}function u(){i("update:showHelp",!0),r.value=!1,i("update:showSettings",!1)}function d(p){i("background-file",p)}function f(p=!0){o.value&&(o.value.value=""),i("clear-background",p)}function m(){qw()}return(p,g)=>(q(),J("div",OF,[T("button",{class:"settings-btn",onClick:h,title:"系统设置"},"系统设置"),T("button",{class:"undo-btn",disabled:I(yu).undoCount===0,onClick:m,title:"撤回上一步 (Ctrl+Z)"},"↶",8,LF),T("div",BF,[T("button",{class:Ce(["tool-btn",{on:s.activeTool===""}]),onClick:g[0]||(g[0]=x=>c("")),title:"拖动画布 (Q)"},"✋",2),T("button",{class:Ce(["tool-btn",{on:s.activeTool==="translate"}]),onClick:g[1]||(g[1]=x=>c("translate")),title:"位移 (W)"},"✥",2),T("button",{class:Ce(["tool-btn",{on:s.activeTool==="rotate"}]),onClick:g[2]||(g[2]=x=>c("rotate")),title:"旋转 (E)"},"⟳",2),T("button",{class:Ce(["tool-btn",{on:s.activeTool==="scale"}]),onClick:g[3]||(g[3]=x=>c("scale")),title:"缩放 (R)"},"⤢",2)]),T("div",NF,[T("button",{class:"tool-btn",onClick:g[4]||(g[4]=x=>I(IF)(s.ctx)),title:"放大"},"+"),T("button",{class:"tool-btn",onClick:g[5]||(g[5]=x=>I(RF)(s.ctx)),title:"缩小"},"-"),T("button",{class:"tool-btn",onClick:g[6]||(g[6]=x=>I(PF)(s.ctx)),title:"适配画布"},"⤢"),T("button",{class:Ce(["tool-btn",{on:I(n).settings.showGrid}]),onClick:g[7]||(g[7]=x=>I(FF)(s.ctx)),title:"切换网格"},"▦",2),T("button",{class:"tool-btn",onClick:g[8]||(g[8]=x=>I(kF)(s.ctx)),title:"重置视图"},"⟳")]),T("div",{class:"background-menu",onClick:g[14]||(g[14]=qe(()=>{},["stop"]))},[T("button",{class:Ce(["background-btn",{on:r.value}]),title:"背景图显示设置",onClick:l},"背景图",2),r.value?(q(),J("div",DF,[T("button",{class:"background-upload",onClick:g[9]||(g[9]=x=>{var v;return(v=o.value)==null?void 0:v.click()})},ve(a.value?"更换图像":"上传图像"),1),T("button",{class:"background-clear",disabled:!a.value,onClick:g[10]||(g[10]=x=>f())},"清除背景",8,UF),T("input",{ref_key:"backgroundFileInput",ref:o,class:"background-file-input",type:"file",accept:"image/png,image/jpeg,image/webp",onChange:d},null,544),T("div",{class:"background-file-name",title:a.value},ve(a.value||"未上传图像"),9,$F),T("div",XF,[T("label",null,[g[15]||(g[15]=T("span",null,"X",-1)),ce(T("input",{"onUpdate:modelValue":g[11]||(g[11]=x=>I(n).settings.backgroundX=x),type:"number",step:"1","aria-label":"背景图 X 偏移"},null,512),[[He,I(n).settings.backgroundX,void 0,{number:!0}]])]),T("label",null,[g[16]||(g[16]=T("span",null,"Y",-1)),ce(T("input",{"onUpdate:modelValue":g[12]||(g[12]=x=>I(n).settings.backgroundY=x),type:"number",step:"1","aria-label":"背景图 Y 偏移"},null,512),[[He,I(n).settings.backgroundY,void 0,{number:!0}]])])]),T("label",VF,[g[17]||(g[17]=T("span",null,"透明度",-1)),ce(T("input",{"onUpdate:modelValue":g[13]||(g[13]=x=>I(n).settings.backgroundOpacity=x),type:"range",min:"0",max:"1",step:"0.01","aria-label":"背景图透明度"},null,512),[[He,I(n).settings.backgroundOpacity,void 0,{number:!0}]]),T("b",null,ve(Math.round(I(n).settings.backgroundOpacity*100))+"%",1)])])):xe("",!0)]),T("button",{class:Ce(["help-btn",{on:s.showHelp}]),title:"查看使用说明",onClick:u},"使用说明",2),T("span",YF,ve(Math.round(I(n).editor.viewScale*100))+"%",1)]))}}),jF=Jt(GF,[["__scopeId","data-v-4749834a"]]),HF={key:0,class:"settings-panel"},WF={class:"sp-head"},zF={class:"sp-switch-row"},qF={class:"sp-switch-control"},KF={class:"sp-row"},ZF={class:"sp-chk"},JF={class:"sp-chk"},QF={class:"sp-row"},e3={class:"sp-row"},t3={class:"sp-chk"},i3={class:"sp-chk"},s3={class:"sp-row"},n3={class:"sp-row"},r3={class:"sp-row"},o3={class:"sp-hex"},a3={class:"sp-chk"},l3=Zt({__name:"StageSettingsPanel",props:{show:{type:Boolean}},emits:["close"],setup(s,{emit:e}){const t=e,i=yo();function n(o){Wk(i,Number(o.target.value))}function r(){i.settings.bonePointDrawSize=Math.min(10,Math.max(.1,Number(i.settings.bonePointDrawSize)||1)),i.settings.boneAxisDrawSize=Math.min(10,Math.max(.1,Number(i.settings.boneAxisDrawSize)||2))}return(o,a)=>s.show?(q(),J("div",HF,[T("div",WF,[a[15]||(a[15]=ft("系统设置 ",-1)),T("button",{class:"sp-close",onClick:a[0]||(a[0]=c=>t("close"))},"✕")]),a[29]||(a[29]=T("div",{class:"sp-section-title"},"界面布局",-1)),T("label",zF,[a[17]||(a[17]=T("span",null,"参数面板位置",-1)),T("span",qF,[ce(T("input",{type:"checkbox","onUpdate:modelValue":a[1]||(a[1]=c=>I(i).settings.parameterPanelOnRight=c),"aria-label":"参数面板显示在右侧"},null,512),[[wt,I(i).settings.parameterPanelOnRight]]),a[16]||(a[16]=T("span",{class:"sp-switch-ui","aria-hidden":"true"},null,-1)),T("b",null,ve(I(i).settings.parameterPanelOnRight?"右侧":"左侧"),1)])]),a[30]||(a[30]=T("div",{class:"sp-divider"},null,-1)),a[31]||(a[31]=T("div",{class:"sp-section-title"},"操作历史",-1)),T("label",KF,[a[18]||(a[18]=T("span",null,"最大撤回步数",-1)),ce(T("input",{class:"sp-num sp-undo-limit",type:"number",min:"1",max:"200","onUpdate:modelValue":a[2]||(a[2]=c=>I(i).settings.undoLimit=c),"aria-label":"最大撤回步数",onChange:n},null,544),[[He,I(i).settings.undoLimit,void 0,{number:!0}]])]),a[32]||(a[32]=T("div",{class:"sp-divider"},null,-1)),a[33]||(a[33]=T("div",{class:"sp-section-title"},"画布辅助显示",-1)),T("label",ZF,[ce(T("input",{type:"checkbox","onUpdate:modelValue":a[3]||(a[3]=c=>I(i).settings.showEmitter=c)},null,512),[[wt,I(i).settings.showEmitter]]),a[19]||(a[19]=ft("发射点",-1))]),T("label",JF,[ce(T("input",{type:"checkbox","onUpdate:modelValue":a[4]||(a[4]=c=>I(i).settings.showBones=c)},null,512),[[wt,I(i).settings.showBones]]),a[20]||(a[20]=ft("骨骼连线",-1))]),I(i).settings.showBones?(q(),J(_e,{key:0},[T("label",QF,[a[21]||(a[21]=T("span",null,"骨骼点绘制大小",-1)),ce(T("input",{class:"sp-num",type:"number",min:"0.1",max:"10",step:"0.1","onUpdate:modelValue":a[5]||(a[5]=c=>I(i).settings.bonePointDrawSize=c),"aria-label":"骨骼点绘制大小",onChange:r},null,544),[[He,I(i).settings.bonePointDrawSize,void 0,{number:!0}]])]),T("label",e3,[a[22]||(a[22]=T("span",null,"坐标轴绘制大小",-1)),ce(T("input",{class:"sp-num",type:"number",min:"0.1",max:"10",step:"0.1","onUpdate:modelValue":a[6]||(a[6]=c=>I(i).settings.boneAxisDrawSize=c),"aria-label":"坐标轴绘制大小",onChange:r},null,544),[[He,I(i).settings.boneAxisDrawSize,void 0,{number:!0}]])])],64)):xe("",!0),T("label",t3,[ce(T("input",{type:"checkbox","onUpdate:modelValue":a[7]||(a[7]=c=>I(i).settings.showSkinMesh=c)},null,512),[[wt,I(i).settings.showSkinMesh]]),a[23]||(a[23]=ft("蒙皮网格",-1))]),a[34]||(a[34]=T("div",{class:"sp-divider"},null,-1)),T("label",i3,[ce(T("input",{type:"checkbox","onUpdate:modelValue":a[8]||(a[8]=c=>I(i).settings.tickEnabled=c)},null,512),[[wt,I(i).settings.tickEnabled]]),a[24]||(a[24]=ft("启用刻度",-1))]),I(i).settings.tickEnabled?(q(),J(_e,{key:1},[T("label",s3,[a[25]||(a[25]=T("span",null,"刻度文字大小",-1)),ce(T("input",{type:"range",min:"8",max:"40",step:"1","onUpdate:modelValue":a[9]||(a[9]=c=>I(i).settings.axisFontSize=c)},null,512),[[He,I(i).settings.axisFontSize,void 0,{number:!0}]]),ce(T("input",{type:"number",min:"8",max:"40","onUpdate:modelValue":a[10]||(a[10]=c=>I(i).settings.axisFontSize=c),class:"sp-num"},null,512),[[He,I(i).settings.axisFontSize,void 0,{number:!0}]])]),T("label",n3,[a[26]||(a[26]=T("span",null,"刻度线粗细",-1)),ce(T("input",{type:"range",min:"1",max:"5",step:"0.5","onUpdate:modelValue":a[11]||(a[11]=c=>I(i).settings.tickWidth=c)},null,512),[[He,I(i).settings.tickWidth,void 0,{number:!0}]]),ce(T("input",{type:"number",min:"1",max:"5","onUpdate:modelValue":a[12]||(a[12]=c=>I(i).settings.tickWidth=c),class:"sp-num"},null,512),[[He,I(i).settings.tickWidth,void 0,{number:!0}]])]),T("label",r3,[a[27]||(a[27]=T("span",null,"坐标轴颜色",-1)),ce(T("input",{type:"color","onUpdate:modelValue":a[13]||(a[13]=c=>I(i).settings.axisColor=c),class:"sp-colr"},null,512),[[He,I(i).settings.axisColor]]),T("span",o3,ve(I(i).settings.axisColor),1)]),T("label",a3,[ce(T("input",{type:"checkbox","onUpdate:modelValue":a[14]||(a[14]=c=>I(i).settings.showAxisLabels=c)},null,512),[[wt,I(i).settings.showAxisLabels]]),a[28]||(a[28]=ft("显示刻度数值",-1))])],64)):xe("",!0),a[35]||(a[35]=T("div",{class:"sp-cache-note"},"整个系统设置会自动保存到当前浏览器",-1))])):xe("",!0)}}),c3=Jt(l3,[["__scopeId","data-v-1bba85d9"]]);class vf{constructor(){M(this,"sprite",null);M(this,"texture",null);M(this,"loadVersion",0)}createSprite(e){const t=new Pr(Ke.EMPTY);return t.anchor.set(.5),t.visible=!1,e.addChild(t),this.sprite=t,t}applyTransform(e,t,i){this.sprite&&(this.sprite.position.set(Number(e)||0,-(Number(t)||0)),this.sprite.alpha=Math.min(1,Math.max(0,Number(i)||0)))}async syncTexture(e){const t=++this.loadVersion;if(!e){this.sprite&&(this.sprite.texture=Ke.EMPTY,this.sprite.visible=!1),this.texture&&this.texture.destroy(!0),this.texture=null;return}try{const i=await Ke.fromURL(e);if(t!==this.loadVersion||!this.sprite){i.destroy(!0);return}const n=this.texture;this.texture=i,this.sprite.texture=i,this.sprite.visible=!0,n&&n.destroy(!0)}catch(i){console.error("背景图恢复失败",i)}}static clearStoreBackground(e,t){e.settings.backgroundImageData="",e.settings.backgroundImageName="",t&&(e.settings.backgroundX=0,e.settings.backgroundY=0,e.settings.backgroundOpacity=1)}static async handleFileChange(e,t){var r;const i=t.target,n=(r=i.files)==null?void 0:r[0];if(n)try{e.settings.backgroundImageData=await $c(n),e.settings.backgroundImageName=n.name}catch(o){console.error("背景图加载失败",o)}finally{i.value=""}}destroy(){this.loadVersion++,this.texture&&this.texture.destroy(!0),this.texture=null,this.sprite=null}}class h3{constructor(e){M(this,"selectedNodes",new Set);M(this,"suppressNextDoubleClick",!1);this.ctx=e}resetSelection(){this.selectedNodes.clear()}activePath(){const e=this.ctx.store;if(e.activeObjectType!=="path")return null;const t=e.paths.find(i=>i.id===e.activeObjectId)||null;return(t==null?void 0:t.visible)===!1?null:t}pathInsertIndex(e,t,i){if(e.points.length<2)return e.points.length;const n=e.closed?e.points.length:e.points.length-1;let r=e.points.length,o=1/0;for(let a=0;a<n;a++){const c=e.points[a],l=e.points[(a+1)%e.points.length],h=l.x-c.x,u=l.y-c.y,d=Math.max(1e-4,h*h+u*u),f=Math.min(1,Math.max(0,((t-c.x)*h+(i-c.y)*u)/d)),m=c.x+h*f,p=c.y+u*f,g=Math.hypot(t-m,i-p);g<o&&(o=g,r=a+1)}return r}onStageDoubleClick(e){const t=this.activePath();if(!t||!t.enabled)return;if(this.suppressNextDoubleClick){this.suppressNextDoubleClick=!1;return}const i=ds(this.ctx,e.clientX,e.clientY),n=Ro(t,i.x,i.y),r=9/Math.max(.01,this.ctx.store.editor.viewScale),o=t.points.findIndex(c=>Math.hypot(c.x-n.x,c.y-n.y)<=r);if(o>=0){t.points.splice(o,1),this.selectedNodes.clear();return}const a=this.pathInsertIndex(t,n.x,n.y);t.points.splice(a,0,{x:n.x,y:n.y,inX:0,inY:0,outX:0,outY:0}),this.selectedNodes.clear(),this.selectedNodes.add(a)}onPointerDown(e){const t=this.activePath();if(!t||!t.enabled)return!1;const i=ds(this.ctx,e.clientX,e.clientY),n=Ro(t,i.x,i.y),r=9/Math.max(.01,this.ctx.store.editor.viewScale);if(e.detail>=2){if(t.points.findIndex(u=>Math.hypot(u.x-n.x,u.y-n.y)<=r)>=0)return!0;const l={x:n.x,y:n.y,inX:0,inY:0,outX:0,outY:0},h=this.pathInsertIndex(t,n.x,n.y);return t.points.splice(h,0,l),this.selectedNodes.clear(),this.selectedNodes.add(h),this.suppressNextDoubleClick=!0,ra(u=>{const d=ds(this.ctx,u.clientX,u.clientY),f=Ro(t,d.x,d.y);l.outX=f.x-l.x,l.outY=f.y-l.y,l.inX=-l.outX,l.inY=-l.outY}),!0}let o=null;for(const c of this.selectedNodes){const l=t.points[c];l&&(Math.hypot(l.x+l.inX-n.x,l.y+l.inY-n.y)<=r&&(o={index:c,side:"in"}),Math.hypot(l.x+l.outX-n.x,l.y+l.outY-n.y)<=r&&(o={index:c,side:"out"}))}if(o){const c=t.points[o.index],l=o.side==="in"?Math.hypot(c.outX,c.outY):Math.hypot(c.inX,c.inY);return ra(u=>{const d=ds(this.ctx,u.clientX,u.clientY),f=Ro(t,d.x,d.y),m=f.x-c.x,p=f.y-c.y;if(o.side==="in"?(c.inX=m,c.inY=p):(c.outX=m,c.outY=p),!u.altKey){const g=Math.max(1e-4,Math.hypot(m,p)),x=u.shiftKey?g:l;o.side==="in"?(c.outX=-m/g*x,c.outY=-p/g*x):(c.inX=-m/g*x,c.inY=-p/g*x)}}),!0}const a=t.points.findIndex(c=>Math.hypot(c.x-n.x,c.y-n.y)<=r);if(a>=0){if(e.altKey)return this.selectedNodes.delete(a),!0;e.ctrlKey||e.metaKey?this.selectedNodes.add(a):this.selectedNodes.has(a)||(this.selectedNodes.clear(),this.selectedNodes.add(a));const c=n,l=[...this.selectedNodes].map(u=>({index:u,x:t.points[u].x,y:t.points[u].y}));return ra(u=>{const d=ds(this.ctx,u.clientX,u.clientY),f=Ro(t,d.x,d.y);for(const m of l)t.points[m.index].x=m.x+f.x-c.x,t.points[m.index].y=m.y+f.y-c.y}),!0}if(e.altKey&&!e.ctrlKey&&!e.metaKey)return this.selectedNodes.clear(),!0;if(e.ctrlKey||e.metaKey||e.altKey){const c=n,l=e.altKey,h=u=>{const d=ds(this.ctx,u.clientX,u.clientY),f=Ro(t,d.x,d.y),m=Math.min(c.x,f.x),p=Math.max(c.x,f.x),g=Math.min(c.y,f.y),x=Math.max(c.y,f.y);t.points.forEach((v,y)=>{v.x>=m&&v.x<=p&&v.y>=g&&v.y<=x&&(l?this.selectedNodes.delete(y):this.selectedNodes.add(y))}),window.removeEventListener("pointerup",h),window.removeEventListener("pointercancel",h)};return window.addEventListener("pointerup",h),window.addEventListener("pointercancel",h),!0}return!1}}class u3{constructor(e,t){this.ctx=e,this.getTool=t}onColliderPointerDown(e){const t=this.ctx.store;if(t.activeObjectType!=="collision")return!1;const i=t.colliders.find(v=>v.id===t.activeObjectId);if(!(i!=null&&i.enabled)||i.visible===!1)return!1;const n=ds(this.ctx,e.clientX,e.clientY),r=i.rotation*Math.PI/180,o=Math.cos(r),a=Math.sin(r),c=Math.max(1e-4,Math.abs(i.scaleX??1)),l=Math.max(1e-4,Math.abs(i.scaleY??1)),h=n.x-i.x,u=n.y-i.y,d=(o*h+a*u)/c,f=(-a*h+o*u)/l;if(!(i.shape==="circle"?Math.hypot(d,f)<=i.radius:i.shape==="ellipse"?Math.hypot(d/Math.max(1,i.radiusX),f/Math.max(1,i.radiusY))<=1:Math.abs(d)<=i.width*.5&&Math.abs(f)<=i.height*.5))return!1;const p=i.x,g=i.y,x=n;return ra(v=>{const y=ds(this.ctx,v.clientX,v.clientY);i.x=p+y.x-x.x,i.y=g+y.y-x.y}),!0}onForceFieldDown(e){const t=this.ctx.store.systems.find(h=>h.id===this.ctx.store.activeId);if((t==null?void 0:t.visible)===!1)return!1;const i=t==null?void 0:t.config;if(!(i!=null&&i.forceField)||!i.showForceFieldShape||i.forceRadius<=0)return!1;const n=ds(this.ctx,e.clientX,e.clientY);if(Math.hypot(n.x-i.forceCenterX,n.y-i.forceCenterY)>i.forceRadius)return!1;const o=i.forceCenterX,a=i.forceCenterY;this.ctx.holder.value&&(this.ctx.holder.value.style.cursor="grabbing");const c=h=>{const u=ds(this.ctx,h.clientX,h.clientY);i.forceCenterX=o+u.x-n.x,i.forceCenterY=a+u.y-n.y},l=()=>{this.ctx.holder.value&&(this.ctx.holder.value.style.cursor=""),window.removeEventListener("pointermove",c),window.removeEventListener("pointerup",l),window.removeEventListener("pointercancel",l)};return window.addEventListener("pointermove",c),window.addEventListener("pointerup",l),window.addEventListener("pointercancel",l),e.preventDefault(),!0}onAttractionDown(e){const t=this.ctx.store.systems.find(u=>u.id===this.ctx.store.activeId);if((t==null?void 0:t.visible)===!1)return!1;const i=t==null?void 0:t.config;if(!(i!=null&&i.attraction)||!i.showAttractionShape)return!1;const n=ds(this.ctx,e.clientX,e.clientY),r=Math.max(i.attractionRadius,12/Math.max(1e-4,this.ctx.store.editor.viewScale));if(Math.hypot(n.x-i.attractionCenterX,n.y-i.attractionCenterY)>r)return!1;const a=i.attractionCenterX,c=i.attractionCenterY;this.ctx.holder.value&&(this.ctx.holder.value.style.cursor="grabbing");const l=u=>{const d=ds(this.ctx,u.clientX,u.clientY);i.attractionCenterX=a+d.x-n.x,i.attractionCenterY=c+d.y-n.y},h=()=>{this.ctx.holder.value&&(this.ctx.holder.value.style.cursor=""),window.removeEventListener("pointermove",l),window.removeEventListener("pointerup",h),window.removeEventListener("pointercancel",h)};return window.addEventListener("pointermove",l),window.addEventListener("pointerup",h),window.addEventListener("pointercancel",h),e.preventDefault(),!0}selectedTransformTarget(){const e=this.ctx.store,t=e.activeObjectId;if(e.activeObjectType==="particle"){const r=e.systems.find(a=>a.id===t);if(!r||r.visible===!1)return null;const o=r.config;return{x:o.centerX,y:o.centerY,rotation:o.rootRotation,scaleX:o.rootScaleX??1,scaleY:o.rootScaleY??1,setPosition:(a,c)=>{o.centerX=a,o.centerY=c},setRotation:a=>{o.rootRotation=a},setScale:(a,c)=>{o.rootScaleX=a,o.rootScaleY=c}}}const n=(e.activeObjectType==="collision"?e.colliders:e.activeObjectType==="path"?e.paths:e.spines).find(r=>r.id===t);return!n||n.visible===!1?null:{x:Number(n.x)||0,y:Number(n.y)||0,rotation:Number(n.rotation)||0,scaleX:Math.max(.05,Number(n.scaleX)||1),scaleY:Math.max(.05,Number(n.scaleY)||1),setPosition:(r,o)=>{n.x=r,n.y=o},setRotation:r=>{n.rotation=r},setScale:(r,o)=>{n.scaleX=r,n.scaleY=o}}}onGizmoDown(e){const t=this.selectedTransformTarget();if(!t)return;const i=this.ctx.app(),n=this.ctx.store,r=n.editor.viewScale,o=this.ctx.holder.value.getBoundingClientRect(),a=o.left+i.screen.width/2+n.editor.viewX+t.x*r,c=o.top+i.screen.height*.5+n.editor.viewY+-t.y*r,l=e.clientX,h=e.clientY,u=this.getTool(),d=t.x,f=t.y,m=t.rotation,p=t.scaleX,g=t.scaleY,x=Math.hypot(l-a,h-c)||1,v=Math.atan2(h-c,l-a);ra(S=>{const C=(S.clientX-l)/r,w=(S.clientY-h)/r;if(u==="translate")t.setPosition(d+C,f-w);else if(u==="rotate"){const b=Math.atan2(S.clientY-c,S.clientX-a);t.setRotation(m-(b-v)*180/Math.PI)}else if(u==="scale"){const _=Math.hypot(S.clientX-a,S.clientY-c)/x;t.setScale(Math.max(.05,p*_),Math.max(.05,g*_))}})}}function iy(s,e,t,i,n){const r=1-n;return r*r*r*s+3*r*r*n*e+3*r*n*n*t+n*n*n*i}function sy(s,e,t){const i=s.rotation*Math.PI/180,n=Math.cos(i),r=Math.sin(i),o=Math.max(1e-4,Math.abs(s.scaleX??1)),a=Math.max(1e-4,Math.abs(s.scaleY??1));return{x:s.x+n*e*o-r*t*a,y:s.y+r*e*o+n*t*a}}function Op(s,e){if(!s.points.length)return null;if(s.points.length===1)return{...sy(s,s.points[0].x,s.points[0].y),angle:s.rotation};const t=s.closed?s.points.length:s.points.length-1,i=[];let n=0;for(let m=0;m<t;m++){const p=s.points[m],g=s.points[(m+1)%s.points.length];for(let x=0;x<=20;x++){if(m>0&&x===0)continue;const v=x/20,y=iy(p.x,p.x+p.outX,g.x+g.inX,g.x,v),S=iy(p.y,p.y+p.outY,g.y+g.inY,g.y,v),C=sy(s,y,S),w=i[i.length-1];w&&(n+=Math.hypot(C.x-w.x,C.y-w.y)),i.push({...C,distance:n})}}const r=Math.min(1,Math.max(0,e))*n;let o=i.findIndex(m=>m.distance>=r);o<0&&(o=i.length-1);const a=i[o],c=i[Math.max(0,o-1)],l=i[Math.min(i.length-1,o+1)],h=c.distance,u=o>0?(r-h)/Math.max(1e-4,a.distance-h):0,d=c.x+(a.x-c.x)*Math.min(1,Math.max(0,u)),f=c.y+(a.y-c.y)*Math.min(1,Math.max(0,u));return{x:d,y:f,angle:Math.atan2(l.y-c.y,l.x-c.x)*180/Math.PI}}function d3(s,e,t){if(e.renderLayerMode!=="slot")return null;const i=s.find(o=>o.id===e.renderLayerSpineId&&o.enabled&&o.status==="ready");if(!i)return null;const n=i.slots||[],r=n.find(o=>o.name===e.renderLayerSlotName);if(!r)return null;if(e.renderLayerSlotPosition==="below"){let o="";if(t!=null&&t.length){const a=t.indexOf(r.name);if(a===0)return null;a>0&&(o=t[a-1])}if(!o){const a=n.filter(c=>c.order<r.order).sort((c,l)=>l.order-c.order)[0];if(!a)return null;o=a.name}return{spineId:i.id,slotName:o,targetSlotName:r.name,followAttachment:!1}}return{spineId:i.id,slotName:r.name,targetSlotName:r.name,followAttachment:e.renderLayerFollowAttachment}}function Ih(s,e,t,i=Math.max(1e-4,Math.abs(s.rootScaleX)),n=Math.max(1e-4,Math.abs(s.rootScaleY))){const r=-s.rootRotation*Math.PI/180,o=Math.cos(r),a=Math.sin(r),c=e-s.centerX,l=-t+s.centerY;return{x:(o*c+a*l)/i,y:(-a*c+o*l)/n}}function f3(s,e,t){const i=Op(e,t);if(!i)return null;const n=Ih(s,i.x,i.y),r=i.angle*Math.PI/180,o=Ih(s,i.x+Math.cos(r),i.y+Math.sin(r)),a=Math.atan2(o.y-n.y,o.x-n.x)*180/Math.PI;return{...n,angle:a}}function m3(s,e){return s.colliders.map(t=>{if(!t.followPath||!t.followPathId)return t;const i=s.paths.find(h=>h.id===t.followPathId&&h.enabled);if(!(i!=null&&i.points.length))return t;const n=Math.max(.05,Number(t.followDuration)||2),r=Math.min(1,Math.max(0,e/n)),o=Array.isArray(t.followCurve)?t.followCurve:[{x:0,y:0},{x:1,y:1}],a=t.followCurveMode==="跟随导出"?s.settings.exportSettings.keyframeCurve==="bezier"?"bezier":"linear":t.followCurveMode==="贝塞尔"?"bezier":"linear",c=Math.min(1,Math.max(0,N1(o,r,a))),l=Op(i,c);return l?{...t,x:l.x,y:l.y,rotation:t.rotation+(t.followPathRotation?l.angle:0)}:t})}class p3{constructor(){M(this,"emitters",new Map);M(this,"configs",new Map);M(this,"store",null);M(this,"eventsSuspended",!1);M(this,"subEmitterState",new Map);M(this,"slotGroups",new Map)}sync(e,t,i,n,r=null){this.store=e;for(const[c,l]of this.emitters){const h=e.systems.find(u=>u.id===c);(!h||this.configs.get(c)!==h.config)&&(l.removeFromParent(),l.destroy({children:!0}),this.emitters.delete(c),this.configs.delete(c))}for(const c of e.systems){i&&!c.config.texture&&(c.config.texture=i);const l=Xn(c.config);if(n)for(const u of l.trailResources)!u.texture&&(u.previewUrl==="/images/trail.png"||u.previewUrl==="/trails/trail.png")&&(u.texture=n);if(i)for(const u of l.imageResources)!u.texture&&u.textureName==="star"&&(u.texture=i);if(this.emitters.has(c.id))continue;const h=new Xv(c.config);h.onParticleEvent=u=>this.handleParticleEvent(c.id,u),t.addChild(h),this.emitters.set(c.id,h),this.configs.set(c.id,c.config)}const o=Sl(e.systems);for(const c of e.systems){const l=this.emitters.get(c.id);if(!l)continue;l.onParticleEvent||(l.onParticleEvent=u=>this.handleParticleEvent(c.id,u));const h=o.has(c.id);this.subEmitterState.get(c.id)!==h&&(h&&l.clear(),this.subEmitterState.set(c.id,h)),l.setAutoEmission(!h)}const a=new Set;for(const c of e.systems){const l=this.emitters.get(c.id);if(!l)continue;const h=r&&c.config.renderLayerMode==="slot"?r.getDrawOrder(c.config.renderLayerSpineId):null,u=d3(e.spines,c.config,h),d=u&&r?this.ensureSlotGroup(u,r,c.config):null;d?(a.add(d.key),l.parent!==d.compensator&&d.compensator.addChild(l)):l.parent!==t&&t.addChild(l)}for(const[c,l]of[...this.slotGroups])if(!a.has(c)){for(const h of[...l.compensator.children])h instanceof Xv&&h.parent===l.compensator&&t.addChild(h);r==null||r.detachSlotObject(l.spineId,l.slotName,l.wrapper),l.wrapper.removeFromParent(),l.wrapper.removeChild(l.compensator),l.compensator.destroy(),l.wrapper.destroy(),this.slotGroups.delete(c)}}ensureSlotGroup(e,t,i){const n=`${e.spineId}:${e.targetSlotName}:${i.renderLayerSlotPosition}`;let r=this.slotGroups.get(n);if(!r){const o=new gi,a=new gi;o.addChild(a),r={key:n,spineId:e.spineId,slotName:e.slotName,wrapper:o,compensator:a,followAttachment:i.renderLayerFollowAttachment,attached:!1},this.slotGroups.set(n,r)}return(!r.attached||!r.wrapper.parent||r.slotName!==e.slotName)&&(r.wrapper.parent&&t.detachSlotObject(r.spineId,r.slotName,r.wrapper),r.slotName=e.slotName,r.attached=t.attachSlotObject(r.spineId,r.slotName,r.wrapper,e.followAttachment)),r.attached?r:null}updateRenderCompensation(e,t){if(t)for(const i of this.slotGroups.values()){if(!i.attached||!i.wrapper.parent)continue;const n=e.spines.find(o=>o.id===i.spineId);if(!n)continue;const r=t.getSlotParentMatrix(i.spineId,i.slotName,n);r&&(r.invert(),i.compensator.transform.setFromMatrix(r))}}suspendEvents(e){this.eventsSuspended=e}handleParticleEvent(e,t){if(this.eventsSuspended)return;const i=this.store;if(!i)return;const n=i.systems.find(o=>o.id===e),r=n==null?void 0:n.config;if(!(!(r!=null&&r.eventEnabled)||!Array.isArray(r.events)||!r.events.length)&&!(t.depth>=2))for(const o of r.events){if(o.event!==t.kind||o.event==="collision"&&t.collisionCount>o.collisionLimit||o.targetSystemId<=0||o.targetSystemId===e)continue;const a=Math.min(1,Math.max(0,Number(o.probability)||0));if(a<=0)continue;const c=(Math.imul(o.id+1,2654435761)^Math.imul(t.depth+1,2246822507))>>>0;if(ar(r.seed>>>0,t.spawnId+1,c)>=a)continue;const h=this.emitters.get(o.targetSystemId);if(!h)continue;const u=Array.isArray(o.inherit)?o.inherit:[],d=u.length?{attributes:u,colorMode:o.colorInheritMode==="replace"?"replace":"add",data:{colorHex:t.colorHex,scaleX:t.scaleX,scaleY:t.scaleY,rotation:t.rotation,life:t.maxLife}}:void 0;h.spawnEventParticle(t.worldX,t.worldY,t.depth+1,d)}}destroy(e){for(const t of this.slotGroups.values()){for(const i of[...t.compensator.children])t.compensator.removeChild(i);t.wrapper.removeFromParent(),t.compensator.destroy(),t.wrapper.destroy()}this.slotGroups.clear();for(const[t,i]of this.emitters)i.removeFromParent(),i.destroy({children:!0}),this.emitters.delete(t),this.configs.delete(t)}}async function g3(){const[s,e]=await Promise.all([Ke.fromURL("/images/star.png"),Ke.fromURL("/images/trail.png")]);return{dotTex:s,trailTex:e}}function v3(s,e,t){for(const i of s.systems){i.config.texture=e;const n=Xn(i.config);if(t)for(const r of n.trailResources)!r.texture&&(r.previewUrl==="/images/trail.png"||r.previewUrl==="/trails/trail.png")&&(r.texture=t);for(const r of n.imageResources)!r.texture&&r.textureName==="star"&&(r.texture=e)}}const y3={class:"stage-wrap"},x3={key:0,class:"hud"},b3={class:"hud-number hud-system-count"},w3={class:"hud-number hud-particle-count"},S3=Zt({__name:"Stage",setup(s){const e=yo(),t=Fe(null),i=Fe(null),n=Fe(!1),r=Fe(!1),o=Fe(""),a=Fe(!1);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);let c=null,l=null,h=null,u=null,d=null,f=null,m=null,p=null,g=null,x=null,v=null,y=null,S=null,C=null,w=null,b=[],_=0,A=0,P=0,E=0,R=null,O=null;const U=new vf,Y=new p3,$={store:e,holder:t,app:()=>c},X=new h3($),D=new u3($,()=>o.value);let F=[];const N=new Map;function k(){l=new gi,c.stage.addChild(l),C=new gi,c.stage.addChild(C),U.createSprite(l),S=new Ni,l.addChild(S),w=new sP,l.addChild(w.container),u=new Ni,l.addChild(u),h=new Ni,l.addChild(h),f=new Ni,l.addChild(f),m=new Ni,l.addChild(m),p=new Ni,l.addChild(p),g=new Ni,l.addChild(g),x=new Ni,l.addChild(x),v=new Ni,l.addChild(v),y=new Ni,l.addChild(y),d=new Ni,l.addChild(d)}function V(me){if(me.button===0){if(o.value&&D.selectedTransformTarget()){D.onGizmoDown(me);return}X.onPointerDown(me)||D.onColliderPointerDown(me)||D.onAttractionDown(me)||D.onForceFieldDown(me)||AF($,me.clientX,me.clientY)}}function G(me){X.onStageDoubleClick(me)}function W(me){EF($,me)}function Z(me=!0){vf.clearStoreBackground(e,me)}async function ne(me){await vf.handleFileChange(e,me)}qk({canvasElement:t,canvasFocused:a,undo:qw,save:()=>Yw(e),togglePlay:()=>e.togglePlay(),toStart:()=>e.toStart(),setTool:me=>{o.value=me}});function oe(){l&&Y.sync(e,l,R,O,w)}function de(me,H,z,K){const B=Math.max(2,Math.floor(K)||2);if(me.config.mode==="stream"&&me.config.streamBehavior==="loop"){Hv(me,H,z,B);return}H.reset();const L=1/Math.max(1,z),j=[];for(let ie=0;ie<B;ie++)ie===0?(H.apply([]),j.push([])):j.push(H.update(L));me.frames=j}function pe(me){var B;const H=Math.max(2,Math.floor(e.timeline.totalFrames)||2),z=Sl(e.systems);let K=!0;Y.suspendEvents(!0);try{for(const L of e.systems){if(z.has(L.id)||(((B=L.frames)==null?void 0:B.length)||0)>=H)continue;const j=Y.emitters.get(L.id);if(!j){K=!1;continue}de(L,j,me,H)}}finally{Y.suspendEvents(!1)}K&&(e.timeline.recorded=!0)}function he(){var z,K,B,L;E=requestAnimationFrame(he);const me=performance.now()/1e3;let H=me-_;if(_=me,H>.1&&(H=.1),c&&l){l.scale.set(e.editor.viewScale),l.position.set(c.screen.width/2+e.editor.viewX,c.screen.height*.5+e.editor.viewY),U.applyTransform(e.settings.backgroundX,e.settings.backgroundY,e.settings.backgroundOpacity),UR(e,c,S,C,b);const j=Math.max(1,e.timeline.fps),ie=e.timeline.frame,ue=ie/j;w==null||w.sync(e.spines,ie,j),oe(),Y.updateRenderCompensation(e,w),F=m3(e,ue);for(const je of e.systems){const Ae=Y.emitters.get(je.id);if(!Ae)continue;Ae.setFollowExportCurveMode(e.settings.exportSettings.keyframeCurve==="bezier"?"贝塞尔":"线性");const Qe=je.visible!==!1;Ae.visible=Qe,Ae.renderable=Qe;const Ee=je.config;Ae.scale.set(Ee.rootScaleX,Ee.rootScaleY);const Qt=new Set(Ee.collisionColliderIds);Ae.setColliders(Ee.collision?F.filter(Xt=>Qt.has(Xt.id)):[]),Ae.setEmitterFollowSpawn(0,0,0);let ut={x:Ee.centerX,y:Ee.centerY,rotation:Ee.rootRotation};const re=Ee.emitterFollow&&Ee.emitterFollowMode==="bone"?e.spines.find(Xt=>Xt.id===Ee.emitterFollowSpineId&&Xt.enabled&&Xt.status==="ready"):null,ae=re&&(w==null?void 0:w.getBoneWorldTransform(re.id,Ee.emitterFollowBoneName))||null,et=Ee.emitterFollow&&Ee.emitterFollowMode==="path"?e.paths.find(Xt=>Xt.id===Ee.emitterFollowPathId&&Xt.enabled):null,It=Math.max(.05,Ee.emitterFollowDuration),kt=Math.min(1,Math.max(0,ue/It)),ot=Math.min(1,Math.max(0,N1(Ee.emitterFollowCurve,kt))),Gi=Math.min(1,Math.max(0,Ee.emitterFollowOffset)),xs=Ee.emitterFollowDirection==="reverse"?(1-Gi)*(1-ot):Gi+(1-Gi)*ot,Nt=et?Op(et,xs):null;if(ae){const Xt=Ee.emitterFollowBoneOffsetX,ji=Ee.emitterFollowBoneOffsetY,ni=ae.x+Xt,bs=ae.y+ji,ws=Ee.rootRotation+Ee.emitterFollowBoneRotation,$s=Math.max(1e-4,Math.abs(Ee.rootScaleX*Ee.emitterFollowBoneScaleX)),Zi=Math.max(1e-4,Math.abs(Ee.rootScaleY*Ee.emitterFollowBoneScaleY));if(ut={x:ni,y:bs,rotation:ws},Ee.emitterFollowSpace==="local")Ae.position.set(ni,-bs),Ae.rotation=-ws*Math.PI/180,Ae.scale.set($s,Zi),Ae.setSimulationTransform(ni,bs,ws,$s,Zi);else{Ae.position.set(Ee.centerX,-Ee.centerY),Ae.rotation=-Ee.rootRotation*Math.PI/180,Ae.scale.set($s,Zi),Ae.setSimulationTransform(Ee.centerX,Ee.centerY,Ee.rootRotation,$s,Zi);const Zn=Ih(Ee,ni,bs,$s,Zi),gn=-(ws-Ee.rootRotation);Ae.setEmitterFollowSpawn(Zn.x,Zn.y,gn)}}else if(Nt){const Xt=Nt.angle+(Ee.emitterFollowDirection==="reverse"?180:0),ji=Ee.emitterAngleMode==="direction"?Xt:Ee.rootRotation;if(ut={x:Nt.x,y:Nt.y,rotation:ji},Ee.emitterFollowSpace==="local")Ae.position.set(Nt.x,-Nt.y),Ae.rotation=-ji*Math.PI/180,Ae.setSimulationTransform(Nt.x,Nt.y,ji);else{Ae.position.set(Ee.centerX,-Ee.centerY),Ae.rotation=-Ee.rootRotation*Math.PI/180,Ae.setSimulationTransform(Ee.centerX,Ee.centerY,Ee.rootRotation);const ni=Ih(Ee,Nt.x,Nt.y),bs=Ee.emitterAngleMode==="direction"?-(Xt-Ee.rootRotation):0;Ae.setEmitterFollowSpawn(ni.x,ni.y,bs)}}else Ae.position.set(Ee.centerX,-Ee.centerY),Ae.rotation=-Ee.rootRotation*Math.PI/180,Ae.setSimulationTransform(Ee.centerX,Ee.centerY,Ee.rootRotation);const vi=Ee.shape==="path"&&Ee.spawnPathId>0&&e.paths.find(Xt=>Xt.id===Ee.spawnPathId&&Xt.enabled&&Xt.points.length>0)||null;Ae.setSpawnPathSampler(vi?Xt=>f3(Ee,vi,Xt):null,(vi==null?void 0:vi.closed)===!0),N.set(je.id,ut)}let fe=0;const ee=[],Me=e.settings.showBones&&e.activeObjectType==="particle"?e.activeObjectId:0,be=(je,Ae,Qe)=>{!je||je.id!==Me||je.visible===!1||ZR(ee,Qe,Ae.position.x,Ae.position.y)},ge=e.timeline,Ne=e.playbackRange,Ve=ge.fps,Ze=1/Math.max(1,Ve);let rt=P,Je=0;if(ge.playing?(A+=H,Je=Math.floor(A/Ze),Je>0&&(A-=Je*Ze)):(A=0,pe(Ve)),ge.playing&&Je>0)for(let je=0;je<Je;je++)if(rt=ge.frame,ee.length=0,fe=0,ge.recorded){for(const ut of e.systems){const re=Y.emitters.get(ut.id),ae=(B=ut.frames)==null?void 0:B[ge.frame];if(re&&ae){re.apply(ae);for(const et of ae)et.active&&(be(ut,re,et),fe++)}}ge.frame++;const Ae=e.systems.find(ut=>ut.id===e.activeId),Qe=(Ae==null?void 0:Ae.config.mode)==="stream"&&Ae.config.streamBehavior==="loop"?P1(Ae.config,Ve):null,Qt=ge.loop&&ge.abLoop&&(Qe==null?void 0:Qe.start)===Ne.start&&Qe.end===Ne.end?Ne.end-1:Ne.end;if(ge.frame>Qt)if(ge.loop)ge.frame=Ne.start;else{ge.frame=Ne.end,ge.playing=!1;break}}else{Y.suspendEvents(!0);try{const Ae=Sl(e.systems);for(const Qe of e.systems){const Ee=Y.emitters.get(Qe.id);if(!Ee)continue;!Ae.has(Qe.id)&&Qe.config.mode==="stream"&&Qe.config.streamBehavior==="loop"?(z=Qe.frames)!=null&&z.length||Hv(Qe,Ee,Ve,ge.totalFrames):ge.frame===0&&Ee.reset()}}finally{Y.suspendEvents(!1)}for(const[Ae,Qe]of Y.emitters){const Ee=e.systems.find(et=>et.id===Ae),Qt=(Ee==null?void 0:Ee.config.mode)==="stream"&&Ee.config.streamBehavior==="loop",ut=Qt?(K=Ee.frames)==null?void 0:K[ge.frame]:void 0,re=ge.frame===0&&!Qt,ae=re?[]:ut||Qe.update(Ze);if(re?Qe.apply([]):ut&&Qe.apply(ut),(Ee==null?void 0:Ee.visible)!==!1)for(const et of ae)et.active&&be(Ee,Qe,et);fe+=ae.length}for(const Ae of e.systems){if(!Ae.config.texture)continue;Ae.frames=Ae.frames||[];const Qe=Y.emitters.get(Ae.id);Qe&&!(Ae.config.mode==="stream"&&Ae.config.streamBehavior==="loop")&&(Ae.frames[ge.frame]=Qe.capture())}ge.frame++,ge.frame>=ge.totalFrames&&(ge.frame=Ne.start,ge.recorded=!0)}else{ge.playing||(rt=ge.frame);for(const je of e.systems){const Ae=Y.emitters.get(je.id),Qe=ge.playing?P:ge.frame,Ee=(L=je.frames)==null?void 0:L[Qe],Qt=je.config.mode==="stream"&&je.config.streamBehavior==="loop"&&!!Ee;if((ge.recorded||Qt)&&Ae&&Ee){Ae.apply(Ee);for(const ut of Ee)ut.active&&(be(je,Ae,ut),fe++)}else if(Ae){const ut=ge.frame===0?[]:Ae.update(0);if(ge.frame===0&&Ae.apply([]),je.visible!==!1)for(const re of ut)re.active&&be(je,Ae,re);fe+=Ae.activeCount}}}P=rt,w==null||w.sync(e.spines,rt,Ve);for(const[,je]of Y.emitters)je.drawTrailMeshDebug(e.settings.showSkinMesh);qR(e,F,x),KR(e,X.selectedNodes,v),HR(e,w,u),$R(e,N,h),XR(e,N,f),VR(e,m),YR(e,p),GR(e,g),WR(o,D.selectedTransformTarget.bind(D),y),JR(ee,e,d),i.value&&(i.value.systems=e.systems.length,i.value.particles=fe)}}return ys(async()=>{const me=t.value;c=new i1({width:me.clientWidth||800,height:me.clientHeight||600,backgroundAlpha:0,antialias:!0}),me.appendChild(c.view),k(),ai(()=>e.settings.backgroundImageData,z=>U.syncTexture(z),{immediate:!0});const H=await g3();R=H.dotTex,O=H.trailTex,v3(e,R,O),i.value={systems:e.systems.length,particles:0},e.timeline.recorded=!1,e.timeline.frame=0,A=0,P=0,e.timeline.playing=!0,e.timeline.loop=!0;for(const z of e.systems)z.frames=[];e.recalcTotalFrames(),_=performance.now()/1e3,he(),ai(()=>e.systems.map(z=>JSON.stringify(z.config,(K,B)=>K==="texture"||K==="trailTexture"||K==="previewUrl"?void 0:B)).join("|")+`|colliders:${JSON.stringify(e.colliders)}|paths:${JSON.stringify(e.paths)}`,()=>{e.recalcTotalFrames(),e.timeline.recorded=!1,e.timeline.frame=0;for(const z of e.systems)z.frames=[];e.timeline.playing=!0,e.timeline.loop=!0}),Hk(e)}),Al(()=>{cancelAnimationFrame(E),w==null||w.destroy(),w=null,U.destroy(),l&&c&&Y.destroy(l),c&&(c.destroy(!0,{children:!0}),c=null)}),ai(()=>[e.activeObjectType,e.activeObjectId],()=>X.resetSelection()),(me,H)=>(q(),J("div",y3,[T("div",{ref_key:"holder",ref:t,class:Ce(["stage-holder",{grid:I(e).settings.showGrid}]),tabindex:"0",onWheel:qe(W,["prevent"]),onPointerdown:V,onDblclick:qe(G,["prevent"])},null,34),we(jF,{ctx:$,"active-tool":o.value,"show-settings":n.value,"show-help":r.value,"onUpdate:activeTool":H[0]||(H[0]=z=>o.value=z),"onUpdate:showSettings":H[1]||(H[1]=z=>n.value=z),"onUpdate:showHelp":H[2]||(H[2]=z=>r.value=z),onClearBackground:Z,onBackgroundFile:ne},null,8,["active-tool","show-settings","show-help"]),we(c3,{show:n.value,onClose:H[3]||(H[3]=z=>n.value=!1)},null,8,["show"]),we(CF,{show:r.value,onClose:H[4]||(H[4]=z=>r.value=!1)},null,8,["show"]),i.value?(q(),J("div",x3,[H[5]||(H[5]=ft(" 系统: ",-1)),T("b",b3,ve(i.value.systems),1),H[6]||(H[6]=ft(" · 粒子(骨骼): ",-1)),T("b",w3,ve(i.value.particles),1),H[7]||(H[7]=ft(" · 根骨骼: ",-1)),H[8]||(H[8]=T("b",null,"root",-1)),H[9]||(H[9]=T("span",{class:"hud-tip"},"滚轮缩放 · 左键拖动画布",-1))])):xe("",!0)]))}}),M3=Jt(S3,[["__scopeId","data-v-c9db9503"]]),T3=[{x:0,y:0},{x:1,y:1}],Cm=[{x:0,y:1},{x:1,y:1}],_3=[{x:0,y:0},{x:.2,y:1},{x:.8,y:1},{x:1,y:0}],Em=[{x:0,y:0},{x:.1,y:1},{x:.9,y:1},{x:1,y:0}],Am=[{x:0,y:1},{x:1,y:1}],Im=[{x:0,y:1},{x:1,y:1}],ti=po({visible:!1,title:"",detail:"",progress:0,indeterminate:!1,failed:!1});let Mc=0;function C3(s){return new Promise(e=>window.setTimeout(e,s))}function Zw(s,e){const t=++Mc,i=performance.now();Object.assign(ti,{visible:!0,title:s,detail:e,progress:0,indeterminate:!1,failed:!1});const n=(o,a)=>{t===Mc&&(ti.indeterminate=o==null,o!=null&&(ti.progress=Math.min(100,Math.max(0,o))),a&&(ti.detail=a))},r=async(o,a)=>{if(t!==Mc)return;ti.failed=o,ti.indeterminate=!1,ti.progress=o?ti.progress:100,ti.detail=a,await C3(Math.max(180,(o?850:450)-(performance.now()-i))),t===Mc&&(ti.visible=!1)};return{update:n,paint:()=>new Promise(o=>requestAnimationFrame(()=>o())),finish:(o="已完成")=>r(!1,o),fail:(o="操作失败")=>r(!0,o)}}async function E3(s,e){if(!s.body)return e(null),s.text();const t=Number(s.headers.get("content-length")),i=Number.isFinite(t)&&t>0,n=s.body.getReader(),r=new TextDecoder;let o=0,a="";for(e(i?0:null);;){const{done:c,value:l}=await n.read();if(c)break;o+=l.byteLength,a+=r.decode(l,{stream:!0}),e(i?Math.min(1,o/t):null)}return a+=r.decode(),i&&e(1),a}const A3="3.8";function fs(s,e,t){s[e]==null&&s[t]!=null&&(s[e]=s[t]),delete s[t]}function Rm(s){if(!s||typeof s!="object")return;if(Array.isArray(s)){for(const t of s)Rm(t);return}const e=s;Array.isArray(e.curve)&&delete e.curve;for(const t of Object.values(e))Rm(t)}function I3(s){for(const e of s.bones)fs(e,"transform","inherit");for(const e of s.transform||[])fs(e,"rotateMix","mixRotate"),e.translateMix==null&&(e.translateMix=e.mixX??e.mixY),e.scaleMix==null&&(e.scaleMix=e.mixScaleX??e.mixScaleY),fs(e,"shearMix","mixShearY"),delete e.mixX,delete e.mixY,delete e.mixScaleX,delete e.mixScaleY;for(const e of s.path||[])fs(e,"rotateMix","mixRotate"),e.translateMix==null&&(e.translateMix=e.mixX??e.mixY),delete e.mixX,delete e.mixY;for(const e of s.skins)for(const t of Object.values(e.attachments||{}))for(const i of Object.values(t||{}))i.parent!=null&&fs(i,"deform","timelines")}function R3(s){for(const e of Object.values(s.slots||{}))fs(e,"color","rgba"),fs(e,"twoColor","rgba2")}function P3(s){for(const e of Object.values(s.bones||{}))for(const t of e.rotate||[])fs(t,"angle","value")}function k3(s){for(const e of Object.values(s.transform||{}))for(const t of e)fs(t,"rotateMix","mixRotate"),t.translateMix==null&&(t.translateMix=t.mixX??t.mixY),t.scaleMix==null&&(t.scaleMix=t.mixScaleX??t.mixScaleY),fs(t,"shearMix","mixShearY"),delete t.mixX,delete t.mixY,delete t.mixScaleX,delete t.mixScaleY}function F3(s){for(const e of Object.values(s.path||{})){for(const t of["position","spacing"])for(const i of e[t]||[])fs(i,t,"value");for(const t of e.mix||[])fs(t,"rotateMix","mixRotate"),t.translateMix==null&&(t.translateMix=t.mixX??t.mixY),delete t.mixX,delete t.mixY}}function O3(s){if(!s.attachments)return;const e=s.deform||(s.deform={});for(const[t,i]of Object.entries(s.attachments)){const n=e[t]||(e[t]={});for(const[r,o]of Object.entries(i)){const a=n[r]||(n[r]={});for(const[c,l]of Object.entries(o))l.deform&&(a[c]=l.deform)}}delete s.attachments}function L3(s){s.skeleton.spine=A3,I3(s);for(const e of Object.values(s.animations))R3(e),P3(e),k3(e),F3(e),O3(e);return Rm(s.animations),s}function B3(s,e,t,i,n=!1){if(n){let c=0;for(let l=0;l<s.values.length;l++)c=Math.max(c,Math.abs(s.values[l]-e.values[l])/Math.max(1e-9,i[l]??i[0]??.001));return c}const r=t.frame-e.frame,o=r<=0?0:(s.frame-e.frame)/r;let a=0;for(let c=0;c<s.values.length;c++){const l=e.values[c]+(t.values[c]-e.values[c])*o;a=Math.max(a,Math.abs(s.values[c]-l)/Math.max(1e-9,i[c]??i[0]??.001))}return a}function Jw(s,e,t=new Set,i=new Set){if(s.length<=2)return s.slice();const n=new Set([0,s.length-1]);for(let a=1;a<s.length-1;a++)t.has(s[a].frame)&&n.add(a);for(let a=0;a<s.length;a++)i.has(s[a].frame)&&n.add(a);const r=()=>[...n].sort((a,c)=>a-c);let o=!0;for(;o;){o=!1;const a=r();for(let c=0;c<a.length-1;c++){const l=a[c],h=a[c+1],u=i.has(s[l].frame);let d=-1,f=1;for(let m=l+1;m<h;m++){const p=B3(s[m],s[l],s[h],e,u);p>f&&(f=p,d=m)}d>=0&&(n.add(d),o=!0)}}return r().map(a=>s[a])}function ny(s,e,t,i,n){const r=t-e+1;if(r<2)return 0;const o=n?e:t,a=n?e+1:t-1,c=n?e+2:t-2,l=Math.abs(s[a].frame-s[o].frame);if(r>=3&&l>0&&Math.abs(Math.abs(s[c].frame-s[a].frame)-l)<1e-6){const u=s[o].values[i],d=s[a].values[i],f=s[c].values[i];return n?(-3*u+4*d-f)/(2*l):(3*u-4*d+f)/(2*l)}const h=s[a].frame-s[o].frame;return h?(s[a].values[i]-s[o].values[i])/h:0}function ry(s,e,t){const i=s[t].frame-s[e].frame,n=[];for(let r=0;r<s[e].values.length;r++){const o=s[e].values[r],a=s[t].values[r],c=Math.min(...s.slice(e,t+1).map(d=>d.values[r])),l=Math.max(...s.slice(e,t+1).map(d=>d.values[r])),h=o+ny(s,e,t,r,!0)*i/3,u=a-ny(s,e,t,r,!1)*i/3;n.push([Math.max(c,Math.min(l,h)),Math.max(c,Math.min(l,u))])}return{values:n}}function N3(s,e,t,i,n){const r=1-n;return r*r*r*s+3*r*r*n*e+3*r*n*n*t+n*n*n*i}function D3(s,e,t,i,n,r=!1){if(r){let l=0;for(let h=0;h<s.values.length;h++)l=Math.max(l,Math.abs(s.values[h]-e.values[h])/Math.max(1e-9,n[h]??n[0]??.001));return l}const o=t.frame-e.frame,a=o<=0?0:(s.frame-e.frame)/o;let c=0;for(let l=0;l<s.values.length;l++){const h=i.values[l],u=N3(e.values[l],h[0],h[1],t.values[l],a);c=Math.max(c,Math.abs(s.values[l]-u)/Math.max(1e-9,n[l]??n[0]??.001))}return c}function Qw(s,e,t=new Set,i=new Set){if(s.length<=1)return{samples:s.slice(),controls:[]};const n=new Set([0,s.length-1]);for(let c=1;c<s.length-1;c++)t.has(s[c].frame)&&n.add(c);for(let c=0;c<s.length;c++)i.has(s[c].frame)&&n.add(c);const r=()=>[...n].sort((c,l)=>c-l);let o=!0;for(;o;){o=!1;const c=r();for(let l=0;l<c.length-1;l++){const h=c[l],u=c[l+1];if(u-h<=1)continue;const d=i.has(s[h].frame),f=ry(s,h,u);let m=-1,p=1;for(let g=h+1;g<u;g++){const x=D3(s[g],s[h],s[u],f,e,d);x>p&&(p=x,m=g)}m>=0&&(n.add(m),o=!0)}}const a=r();return{samples:a.map(c=>s[c]),controls:a.slice(0,-1).map((c,l)=>ry(s,c,a[l+1]))}}function U3(s){if(!s.length)return[];const e=[s[0]];for(let t=1;t<s.length;t++){let i=s[t];for(;i-e[t-1]>180;)i-=360;for(;i-e[t-1]<-180;)i+=360;e.push(i)}return e}function oi(s){if(!Number.isFinite(s))return 0;const e=Math.round(s*1e5)/1e5;return Object.is(e,-0)?0:e}function $3(s,e,t,i){const n=Math.max(2,Math.min(16,Math.round(Number(s.trailGridRows)||2))),r=Math.max(2,Math.min(32,Math.round(Number(s.trailGridCols)||2))),o=Math.max(2,t.length),a=e.lengthMode==="random"?Math.max(1,Number(e.lengthMin)||0,Number(e.lengthMax)||0):Math.max(.001,Number(e.length)||100),c=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,h=Math.cos(l),u=Math.sin(l),d=[],f=[],m=[],p=[],g=[];for(let y=0;y<r;y++)g.push({col:y,row:0});for(let y=1;y<n;y++)g.push({col:r-1,row:y});for(let y=r-2;y>=0;y--)g.push({col:y,row:n-1});for(let y=n-2;y>=1;y--)g.push({col:0,row:y});const x=g.length;for(let y=1;y<r-1;y++)for(let S=1;S<n-1;S++)g.push({col:y,row:S});const v=new Map;for(let y=0;y<g.length;y++){const{col:S,row:C}=g[y];v.set(`${S}:${C}`,y);const w=S/(r-1),b=w*(o-1),_=Math.min(o-1,Math.floor(b)),A=Math.min(o-1,_+1),P=b-_,E=C/(n-1),R=.5+h*(w-.5)-u*(E-.5),O=.5+u*(w-.5)+h*(E-.5);d.push(oi(R),oi(O));const U=(.5-E)*c;_===A||P<1e-6?m.push(1,t[_],0,oi(U),1):m.push(2,t[_],0,oi(U),oi(1-P),t[A],0,oi(U),oi(P))}for(let y=0;y<r-1;y++)for(let S=0;S<n-1;S++){const C=v.get(`${y}:${S}`),w=v.get(`${y+1}:${S}`),b=v.get(`${y}:${S+1}`),_=v.get(`${y+1}:${S+1}`);f.push(C,w,b,w,_,b)}for(let y=0;y<x;y++)p.push(y*2,(y+1)%x*2);return{type:"mesh",path:i,uvs:d,triangles:f,vertices:m,hull:x,edges:p,width:a,height:c}}const oy={normal:"normal",add:"additive",multiply:"multiply",screen:"screen"},ay=.1,ly=.1,cy=.01,Tc=.01;function X3(s,e){return String(s||"").trim().replace(/[\\/:*?"<>|\s]+/g,"_").replace(/^_+|_+$/g,"")||e}function eS(s,e){let t=s,i=2;for(;e.has(t);)t=`${s}_${i++}`;return e.add(t),t}function V3(s){return s.replace(/\.[^./\\]+$/,"")}function tS(s,e){return V3([s,e].filter(Boolean).join("/").replace(/\\/g,"/").replace(/\/{2,}/g,"/").replace(/^\.\//,""))}function Y3(s){var i,n;const e=Number(((i=s==null?void 0:s.orig)==null?void 0:i.width)??(s==null?void 0:s.width))||0,t=Number(((n=s==null?void 0:s.orig)==null?void 0:n.height)??(s==null?void 0:s.height))||0;return{width:e,height:t}}function _c(s){return Math.round(Math.max(0,Math.min(1,s))*255).toString(16).padStart(2,"0")}function hy(s,e){return[(s>>16&255)/255,(s>>8&255)/255,(s&255)/255,Math.max(0,Math.min(1,e))]}function il(s,e){return oi(s/e)}function G3(s,e){const t=s.config,i=t.lifeMode==="fixed"?Math.max(0,Number(t.lifeMin)||0):Math.max(0,Number(t.lifeMin)||0,Number(t.lifeMax)||0),n=Math.max(0,Number(t.delay)||0);let r;return t.mode!=="stream"?r=n+i:t.streamBehavior!=="loop"?r=n+Math.max(1/e,Number(t.duration)||0)+i:r=n+Ps(t,e).total/e,Math.max(1,Math.ceil(r*e)+1)}function j3(s,e,t){const i=s.config;if(i.mode!=="stream"||i.streamBehavior!=="loop")return new Set;const n=P1(i,e),r=Math.max(1,t)/Math.max(1,e);return new Set([Math.round(n.start*r),Math.round(n.end*r)])}function Rh(s,e){return e?s.boneName:`${s.spawnId??"legacy"}_${s.boneName}`}function H3(s,e,t,i){const n=new Set;for(const r of s)for(const o of r)n.add(Rh(o,e));return[...n].sort().map((r,o)=>({key:r,name:eS(`${i}_${o}`,t),states:s.map(a=>a.find(c=>Rh(c,e)===r)||null)}))}function uy(s,e){const t=new Set(e.states.map(i=>i==null?void 0:i.resourceId).filter(i=>typeof i=="number"));return s.config.imageResources.filter(i=>t.has(i.id))}function W3(s,e,t,i){const n=e*t/i,r=Math.min(s.states.length-1,Math.max(0,Math.floor(n))),o=Math.min(s.states.length-1,r+1),a=s.states[r],c=s.states[o];if(!a||!c||Rh(a,!0)!==Rh(c,!0)||a.spawnId!==c.spawnId)return a;const l=n-r;if(l<=1e-6)return a;const h=(d,f)=>(d??0)+((f??d??0)-(d??0))*l,u=a.trailState&&c.trailState&&a.trailState.resourceId===c.trailState.resourceId?{...a.trailState,width:h(a.trailState.width,c.trailState.width),alpha:h(a.trailState.alpha,c.trailState.alpha),bones:a.trailState.bones.map((d,f)=>{const m=c.trailState.bones[f]||d;return{...d,worldX:h(d.worldX??d.x,m.worldX??m.x),worldY:h(d.worldY??d.y,m.worldY??m.y),worldRotation:h(d.worldRotation??-d.rotation,m.worldRotation??-m.rotation)}})}:a.trailState;return{...a,worldX:h(a.worldX,c.worldX),worldY:h(a.worldY,c.worldY),worldRotation:h(a.worldRotation,c.worldRotation),worldScaleX:h(a.worldScaleX,c.worldScaleX),worldScaleY:h(a.worldScaleY,c.worldScaleY),alpha:h(a.alpha,c.alpha),trailState:u}}function dy(s,e){return!s||s==="跟随导出"?e.keyframeCurve:s==="贝塞尔"?"bezier":"linear"}function ko(s,e,t,i,n,r=new Set,o=new Set,a=n.keyframeCurve){if(!s.length)return[];const c=new Set(r);for(const u of o)c.add(u);const l=a==="bezier"&&n.spineVersion!=="3.8"?Qw(s,i,c,o):{samples:Jw(s,i,c,o),controls:[]},h=l.samples.map(u=>{const d={time:il(u.frame,e)};return t.forEach((f,m)=>{d[f]=oi(u.values[m])}),o.has(u.frame)&&(d.curve="stepped"),d});for(let u=0;u<l.controls.length;u++){if(h[u].curve==="stepped")continue;const d=Number(h[u].time)||0,f=Number(h[u+1].time)||0,m=[];for(let p=0;p<t.length;p++){const g=l.controls[u].values[p];m.push(oi(d+(f-d)/3),oi(g[0]),oi(d+(f-d)*2/3),oi(g[1]))}h[u].curve=m}return h}function z3(s){const e=new Set;for(let t=0;t<s.length;t++){const i=s[t],n=t?s[t-1]:null,r=!!i&&!!n&&i.spawnId!==n.spawnId;(!!i!=!!n||r)&&(t>0&&n&&e.add(t-1),i&&e.add(t))}return e}function q3(s){const e=new Set;for(let t=0;t<s.length;t++){const i=s[t];if(!(i!=null&&i.active))continue;const n=s[t+1];(!(n!=null&&n.active)||n.spawnId!==i.spawnId)&&e.add(t)}return e}function K3(s){const e=new Set;for(let t=0;t<s.length;t++)s[t]&&(s[t+1]||e.add(t));return e}function Z3(s){const e=new Set;for(let t=0;t<s.length;t++){const i=s[t],n=t?s[t-1]:void 0;!!i!=!!n&&(t>0&&n&&e.add(t-1),i&&e.add(t))}return e}function J3(s,e){var i;if(!s.shapeEnabled||!((i=s.shapeCurve)!=null&&i.length))return 1;const t=[...s.shapeCurve].sort((n,r)=>n.x-r.x);if(e<=t[0].x)return Math.max(0,t[0].y);for(let n=1;n<t.length;n++){const r=t[n-1],o=t[n];if(e<=o.x){const a=(e-r.x)/Math.max(1e-6,o.x-r.x);return Math.max(0,r.y+(o.y-r.y)*a)}}return Math.max(0,t[t.length-1].y)}function Q3(s,e,t,i=new Set){const n=[];let r=Symbol();return s.forEach((o,a)=>{(o!==r||i.has(a))&&(n.push(t(o,a)),r=o)}),n}function eO(s,e,t){const i=s.imageMode==="sequence"?s.sequenceFrames[e]:void 0,n=(i==null?void 0:i.name)||s.textureName||`image_${s.id}`,r=(i==null?void 0:i.texture)||s.texture,o=Y3(r);(!o.width||!o.height)&&t.push({code:"missing-image",message:`图片“${n}”缺失或尺寸不可读,已保留路径。`});const a=o.width||1,c=o.height||1;return{path:tS(s.textureFolder,n),x:oi((.5-s.anchorX)*a),y:oi((s.anchorY-.5)*c),width:oi(a),height:oi(c)}}function fy(s,e){const t=[];for(const n of e){const r=n.imageMode==="sequence"?Math.max(1,n.sequenceFrames.length):1;for(let o=0;o<r;o++)t.push(`${n.id}_${o}`)}const i=t.length>1;return new Map(t.map((n,r)=>[n,i?`${s}_${r}`:s]))}function tO(s,e,t,i,n=i.keyframeCurve,r=new Set,o=new Set){if(!s.length)return[];const a=new Set;for(let d=1;d<e.length;d++){const f=e[d],m=e[d-1],p=(f==null?void 0:f.replace(/_\d+$/,""))??null,g=(m==null?void 0:m.replace(/_\d+$/,""))??null;p!==g&&(a.add(d),a.add(d-1))}for(const d of r)a.add(d);for(const d of o)a.add(d);const c=s.map((d,f)=>({frame:f,values:d})),l=1/255,h=n==="bezier"&&i.spineVersion!=="3.8"?Qw(c,[l,l,l,.01],a,r):{samples:Jw(c,[l,l,l,.01],a,r),controls:[]},u=h.samples.map(d=>{const f={time:il(d.frame,t),color:`${_c(d.values[0])}${_c(d.values[1])}${_c(d.values[2])}${_c(d.values[3])}`};return r.has(d.frame)&&(f.curve="stepped"),f});if(h.controls.length)for(let d=0;d<h.controls.length;d++){if(u[d].curve==="stepped")continue;const f=il(h.samples[d].frame,t),m=il(h.samples[d+1].frame,t),p=[];for(let g=0;g<4;g++){const x=h.controls[d].values[g];p.push(oi(f+(m-f)/3),oi(x[0]),oi(f+(m-f)*2/3),oi(x[1]))}u[d].curve=p}return u}function my(s,e,t,i,n,r,o=r.keyframeCurve,a=new Set,c=new Set){var d;const l=(d=s.slots)[e]||(d[e]={}),h=Q3(t,n,(f,m)=>({time:il(m,n),name:f??null}),c);h.length&&(l.attachment=h);const u=tO(i,t,n,r,o,a,c);u.length&&(l.rgba=u)}function py(s){var m;const e=s.settings,t=Math.max(1,Number(s.timeline.fps)||30),i=Math.max(1,Math.round(e.fps||30)),n=e.integerFrameAlignment?i:t,r=[],o=s.systems.filter(p=>p.visible!==!1),a={skeleton:{hash:"",spine:e.spineVersion,x:0,y:0,width:0,height:0,images:e.imagesPath||"./images/"},bones:[{name:"root"}],slots:[],skins:[{name:"default",attachments:{}}],animations:{}};e.omitFps||(a.skeleton.fps=i);const c=a.skins[0].attachments,l=new Set(["root"]),h=[...new Set([...s.timeline.animations.length?s.timeline.animations:["animation"],...o.map(p=>p.animation||"animation")])],u=new Map;for(const p of o){const g=Math.min(((m=p.frames)==null?void 0:m.length)||0,G3(p,t)),x=(p.frames||[]).slice(0,g);x.length||r.push({code:"empty-cache",message:`“${p.config.name}”没有可用帧缓存。`});const v=eS(X3(p.config.name,`system_${p.id}`),l);a.bones.push({name:v,parent:"root"});const y=H3(x,e.bonePool,l,v),S=Math.max(0,(g-1)/t),C=Math.max(1,Math.ceil(S*n)+1),w=j3(p,t,n),b=u.get(p.animation)||[];b.push({system:p,tracks:y,targetFrames:C,boundaryFrames:w,attachmentPrefix:v}),u.set(p.animation,b);for(const _ of y){a.bones.push({name:_.name,parent:v});const A=uy(p,_),P=new Set(A.map(Y=>Y.blend)),E=[],R=[];for(const Y of P){const $=`${_.name}_${Y}`;E.push($),a.slots.push({name:$,bone:_.name,color:"ffffff00",blend:oy[Y]});const X=c[$]||(c[$]={}),D=A.filter(N=>N.blend===Y),F=fy(v,D);for(const N of D){const k=N.imageMode==="sequence"?Math.max(1,N.sequenceFrames.length):1;for(let V=0;V<k;V++){const G=F.get(`${N.id}_${V}`);G&&(X[G]=eO(N,V,r))}}}if(p.config.trail)for(const Y of p.config.trailResources){if(!_.states.some(k=>{var V;return((V=k==null?void 0:k.trailState)==null?void 0:V.resourceId)===Y.id}))continue;const $=Math.max(2,Math.min(16,Math.round(Y.boneCount||3))),X=[];for(let k=0;k<$;k++){const V=`${_.name}_trail_${Y.id}_${k}`;X.push(V),a.bones.push({name:V,parent:v})}const D=`${_.name}_trail_${Y.id}`;R.push(D),a.slots.push({name:D,bone:X[0],color:"ffffff00",blend:oy[Y.blend]});const F=X.map(k=>a.bones.findIndex(V=>V.name===k)),N=tS("",Y.textureName||`trail_${Y.id}`);(c[D]||(c[D]={}))[`trail_${Y.id}`]=$3(p.config,Y,F,N),Y.texture||r.push({code:"missing-image",message:`拖尾图片“${Y.textureName||Y.id}”缺失,已保留路径。`})}const O=new Set([...E,...R]),U=a.slots.filter(Y=>O.has(String(Y.name)));U.length&&(a.slots=a.slots.filter(Y=>!U.includes(Y)),a.slots.push(...U.filter(Y=>R.includes(String(Y.name))),...U.filter(Y=>E.includes(String(Y.name)))))}}for(const p of h){const g=u.get(p)||[],x={bones:{},slots:{}};let v=!1;for(const{system:y,tracks:S,targetFrames:C,boundaryFrames:w,attachmentPrefix:b}of g)for(const _ of S){const A=Array.from({length:C},(W,Z)=>W3(_,Z,t,n)),P=A.map(W=>!!(W!=null&&W.active)),E=[],R=[],O=[];A.forEach((W,Z)=>{W!=null&&W.active&&(E.push({frame:Z,values:[W.worldX??W.x,W.worldY??W.y]}),R.push(W.worldRotation??W.rotation),O.push({frame:Z,values:[W.worldScaleX??W.scaleX,W.worldScaleY??W.scaleY]}))});const U=U3(R),Y=E.map((W,Z)=>({frame:W.frame,values:[U[Z]??0]})),$=z3(A);for(const W of w)$.add(W);const X=q3(A),D={},F=ko(E,n,["x","y"],[ay,ay],e,$,X),N=ko(Y,n,["value"],[cy],e,$,X),k=ko(O,n,["x","y"],[Tc,Tc],e,$,X);F.length&&(D.translate=F),N.length&&(D.rotate=N),k.length&&(D.scale=k),Object.keys(D).length&&(x.bones[_.name]=D,v=!0);const V=uy(y,_),G=new Set(V.map(W=>W.blend));for(const W of G){const Z=V.filter(H=>H.blend===W),ne=fy(b,Z),oe=[],de=[];let pe=16777215;for(let H=0;H<C;H++){const z=A[H],K=z?y.config.imageResources.find(j=>j.id===z.resourceId):void 0,B=!!z&&P[H]&&z.imageVisible!==!1&&(K==null?void 0:K.blend)===W;z&&(K==null?void 0:K.blend)===W&&(pe=z.colorHex);const L=B?ne.get(`${K.id}_${z.imageFrameIndex??0}`):void 0;oe.push(L??null),de.push(hy(pe,B?z.alpha:0))}const he=Z.filter(H=>H.independentAlpha==="curve").map(H=>dy(H.alphaCurveMode,e)),me=he.length?he.includes("bezier")?"bezier":"linear":dy(y.config.alphaMode==="curve"?y.config.curveMode:void 0,e);my(x,`${_.name}_${W}`,oe,de,n,e,me,X,w),oe.some(Boolean)&&(v=!0)}if(y.config.trail)for(const W of y.config.trailResources){const Z=Math.max(2,Math.min(16,Math.round(W.boneCount||3))),ne=A.map(L=>{var j;return((j=L==null?void 0:L.trailState)==null?void 0:j.resourceId)===W.id?L.trailState:void 0}),oe=ne.find(L=>!!L);if(!oe)continue;const de=Z3(ne),pe=K3(ne),he=W.widthSizeMode==="random"?Math.max(1,Number(W.widthMin)||0,Number(W.widthMax)||0):Math.max(.001,Number(W.width)||100);let me=oe;const H=ne.map(L=>(L&&(me=L),me));for(let L=0;L<Z;L++){const j=[],ie=[],ue=[],fe=new Set(de);for(const Ze of w)fe.add(Ze);const ee=J3(W,L/Math.max(1,Z-1));H.forEach((Ze,rt)=>{const Je=Ze==null?void 0:Ze.bones[Math.min(Ze.bones.length-1,L)];if(!Je)return;const je={x:Je.worldX??Je.x,y:Je.worldY??Je.y,rotation:Je.worldRotation??-Je.rotation};j.push({frame:rt,values:[je.x,je.y]}),ie.push({frame:rt,values:[je.rotation]}),ue.push({frame:rt,values:[1,Math.max(0,Ze.width/he)*ee]})});const Me=`${_.name}_trail_${W.id}_${L}`,be={},ge=ko(j,n,["x","y"],[ly,ly],e,fe,pe),Ne=ko(ie,n,["value"],[cy],e,fe,pe),Ve=ko(ue,n,["x","y"],[Tc,Tc],e,fe,pe);ge.length&&(be.translate=ge),Ne.length&&(be.rotate=Ne),Ve.length&&(be.scale=Ve),Object.keys(be).length&&(x.bones[Me]=be)}const z=ne.map(()=>`trail_${W.id}`);let K=oe.colorHex;const B=ne.map(L=>(L&&(K=L.colorHex),hy(K,L?L.alpha:0)));my(x,`${_.name}_trail_${W.id}`,z,B,n,e,e.keyframeCurve,pe,w),v=!0}}(v||!e.excludeEmptyAnimations)&&(a.animations[p]=x)}!Object.keys(a.animations).length&&!e.excludeEmptyAnimations&&(a.animations.animation={bones:{},slots:{}});const d=e.spineVersion==="3.8"?L3(a):a,f=JSON.stringify(d,null,2);return{json:d,text:f,warnings:r,particleSystemCount:o.length,animationCount:Object.keys(d.animations).length,boneCount:d.bones.length}}function iO(s,e){const t=new Blob([s.text],{type:"application/json;charset=utf-8"}),i=URL.createObjectURL(t),n=document.createElement("a");n.href=i,n.download=/\.json$/i.test(e)?e:`${e||"SpineParticle"}.json`,n.style.display="none",document.body.appendChild(n),n.click(),n.remove(),setTimeout(()=>URL.revokeObjectURL(i),1e3)}class CV{constructor(){M(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 sO{constructor(){M(this,"entries",{});M(this,"size",0)}add(e){const t=this.entries[e];return this.entries[e]=!0,t?!1:(this.size++,!0)}addAll(e){const t=this.size;for(let i=0,n=e.length;i<n;i++)this.add(e[i]);return t!==this.size}contains(e){return this.entries[e]}clear(){this.entries={},this.size=0}}const ts=class ts{constructor(e=0,t=0,i=0,n=0){M(this,"r");M(this,"g");M(this,"b");M(this,"a");this.r=e,this.g=t,this.b=i,this.a=n}set(e,t,i,n){return this.r=e,this.g=t,this.b=i,this.a=n,this.clamp()}setFromColor(e){return this.r=e.r,this.g=e.g,this.b=e.b,this.a=e.a,this}setFromString(e){return e=e.charAt(0)==="#"?e.substr(1):e,this.r=parseInt(e.substr(0,2),16)/255,this.g=parseInt(e.substr(2,2),16)/255,this.b=parseInt(e.substr(4,2),16)/255,this.a=e.length!==8?1:parseInt(e.substr(6,2),16)/255,this}add(e,t,i,n){return this.r+=e,this.g+=t,this.b+=i,this.a+=n,this.clamp()}clamp(){return this.r<0?this.r=0:this.r>1&&(this.r=1),this.g<0?this.g=0:this.g>1&&(this.g=1),this.b<0?this.b=0:this.b>1&&(this.b=1),this.a<0?this.a=0:this.a>1&&(this.a=1),this}static rgba8888ToColor(e,t){e.r=((t&4278190080)>>>24)/255,e.g=((t&16711680)>>>16)/255,e.b=((t&65280)>>>8)/255,e.a=(t&255)/255}static rgb888ToColor(e,t){e.r=((t&16711680)>>>16)/255,e.g=((t&65280)>>>8)/255,e.b=(t&255)/255}toRgb888(){const e=t=>`0${(t*255).toString(16)}`.slice(-2);return+`0x${e(this.r)}${e(this.g)}${e(this.b)}`}static fromString(e,t=new ts){return t.setFromString(e)}};M(ts,"WHITE",new ts(1,1,1,1)),M(ts,"RED",new ts(1,0,0,1)),M(ts,"GREEN",new ts(0,1,0,1)),M(ts,"BLUE",new ts(0,0,1,1)),M(ts,"MAGENTA",new ts(1,0,1,1));let nt=ts;const Ht=class Ht{static clamp(e,t,i){return e<t?t:e>i?i:e}static cosDeg(e){return Math.cos(e*Ht.degRad)}static sinDeg(e){return Math.sin(e*Ht.degRad)}static atan2Deg(e,t){return Math.atan2(e,t)*Ht.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 Ht.randomTriangularWith(e,t,(e+t)*.5)}static randomTriangularWith(e,t,i){const n=Math.random(),r=t-e;return n<=(i-e)/r?e+Math.sqrt(n*r*(i-e)):t-Math.sqrt((1-n)*r*(t-i))}static isPowerOfTwo(e){return e&&(e&e-1)===0}};M(Ht,"epsilon",1e-5),M(Ht,"epsilon2",Ht.epsilon*Ht.epsilon),M(Ht,"PI",3.1415927),M(Ht,"PI2",Ht.PI*2),M(Ht,"invPI2",1/Ht.PI2),M(Ht,"radiansToDegrees",180/Ht.PI),M(Ht,"radDeg",Ht.radiansToDegrees),M(Ht,"degreesToRadians",Ht.PI/180),M(Ht,"degRad",Ht.degreesToRadians);let Ie=Ht;const ls=class ls{apply(e,t,i){return t===void 0||i===void 0?this.applyInternal(e):e+(t-e)*this.applyInternal(i)}};M(ls,"linear",new class extends ls{applyInternal(e){return e}}),M(ls,"smooth",new class extends ls{applyInternal(e){return e*e*(3-2*e)}}),M(ls,"slowFast",new class extends ls{applyInternal(e){return e*e}}),M(ls,"fastSlow",new class extends ls{applyInternal(e){return(e-1)*(e-1)*-1+1}}),M(ls,"circle",new class extends ls{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 oa=ls;class nO extends oa{constructor(t){super();M(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 EV extends nO{constructor(e){super(e)}applyInternal(e){return Math.pow(e-1,this.power)*(this.power%2===0?-1:1)+1}}const dr=class dr{static arrayCopy(e,t,i,n,r){for(let o=t,a=n;o<t+r;o++,a++)i[a]=e[o]}static arrayFill(e,t,i,n){for(let r=t;r<i;r++)e[r]=n}static setArraySize(e,t,i=0){const n=e.length;if(n===t)return e;if(e.length=t,n<t)for(let r=n;r<t;r++)e[r]=i;return e}static ensureArrayCapacity(e,t,i=0){return e.length>=t?e:dr.setArraySize(e,t,i)}static newArray(e,t){const i=[];for(let n=0;n<e;n++)i[n]=t;return i}static newFloatArray(e){if(dr.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(dr.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 dr.SUPPORTS_TYPED_ARRAYS?new Float32Array(e):e}static toSinglePrecision(e){return dr.SUPPORTS_TYPED_ARRAYS?Math.fround(e):e}static webkit602BugfixHelper(e){}static contains(e,t,i=!0){for(let n=0;n<e.length;n++)if(e[n]===t)return!0;return!1}static enumValue(e,t){return e[t[0].toUpperCase()+t.slice(1)]}};M(dr,"SUPPORTS_TYPED_ARRAYS",typeof Float32Array<"u");let Ge=dr;class AV{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 rO{constructor(e){M(this,"items",[]);M(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 gy{constructor(e=0,t=0){M(this,"x");M(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 IV{constructor(){M(this,"maxDelta",.064);M(this,"framesPerSecond",0);M(this,"delta",0);M(this,"totalTime",0);M(this,"lastTime",Date.now()/1e3);M(this,"frameCount",0);M(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 RV{constructor(e=32){M(this,"values");M(this,"addedValues",0);M(this,"lastValue",0);M(this,"mean",0);M(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 oO{constructor(e){M(this,"_image");this._image=e}getImage(){return this._image}}var ha;(function(s){s[s.Nearest=9728]="Nearest",s[s.Linear=9729]="Linear",s[s.MipMap=9987]="MipMap",s[s.MipMapNearestNearest=9984]="MipMapNearestNearest",s[s.MipMapLinearNearest=9985]="MipMapLinearNearest",s[s.MipMapNearestLinear=9986]="MipMapNearestLinear",s[s.MipMapLinearLinear=9987]="MipMapLinearLinear"})(ha||(ha={}));var ua;(function(s){s[s.MirroredRepeat=33648]="MirroredRepeat",s[s.ClampToEdge=33071]="ClampToEdge",s[s.Repeat=10497]="Repeat"})(ua||(ua={}));class iS{constructor(){M(this,"texture");M(this,"u",0);M(this,"v",0);M(this,"u2",0);M(this,"v2",0);M(this,"width",0);M(this,"height",0);M(this,"degrees",0);M(this,"offsetX",0);M(this,"offsetY",0);M(this,"originalWidth",0);M(this,"originalHeight",0)}}class PV extends oO{setFilters(e,t){}setWraps(e,t){}dispose(){}}class kV{constructor(e){M(this,"pages",[]);M(this,"regions",[]);const t=new aO(e),i=new Array(4),n={};n.size=h=>{h.width=parseInt(i[1]),h.height=parseInt(i[2])},n.format=()=>{},n.filter=h=>{h.minFilter=Ge.enumValue(ha,i[1]),h.magFilter=Ge.enumValue(ha,i[2])},n.repeat=h=>{i[1].indexOf("x")!==-1&&(h.uWrap=ua.Repeat),i[1].indexOf("y")!==-1&&(h.vWrap=ua.Repeat)},n.pma=h=>{h.pma=i[1]==="true"};var r={};r.xy=h=>{h.x=parseInt(i[1]),h.y=parseInt(i[2])},r.size=h=>{h.width=parseInt(i[1]),h.height=parseInt(i[2])},r.bounds=h=>{h.x=parseInt(i[1]),h.y=parseInt(i[2]),h.width=parseInt(i[3]),h.height=parseInt(i[4])},r.offset=h=>{h.offsetX=parseInt(i[1]),h.offsetY=parseInt(i[2])},r.orig=h=>{h.originalWidth=parseInt(i[1]),h.originalHeight=parseInt(i[2])},r.offsets=h=>{h.offsetX=parseInt(i[1]),h.offsetY=parseInt(i[2]),h.originalWidth=parseInt(i[3]),h.originalHeight=parseInt(i[4])},r.rotate=h=>{const u=i[1];u==="true"?h.degrees=90:u!=="false"&&(h.degrees=parseInt(u))},r.index=h=>{h.index=parseInt(i[1])};let o=t.readLine();for(;o&&o.trim().length===0;)o=t.readLine();for(;!(!o||o.trim().length===0||t.readEntry(i,o)===0);)o=t.readLine();let a=null,c=null,l=null;for(;o!==null;)if(o.trim().length===0)a=null,o=t.readLine();else if(a){const h=new sS(a,o);for(;;){const u=t.readEntry(i,o=t.readLine());if(u===0)break;const d=r[i[0]];if(d)d(h);else{c||(c=[]),l||(l=[]),c.push(i[0]);const f=[];for(let m=0;m<u;m++)f.push(parseInt(i[m+1]));l.push(f)}}h.originalWidth===0&&h.originalHeight===0&&(h.originalWidth=h.width,h.originalHeight=h.height),c&&c.length>0&&l&&l.length>0&&(h.names=c,h.values=l,c=null,l=null),h.u=h.x/a.width,h.v=h.y/a.height,h.degrees===90?(h.u2=(h.x+h.height)/a.width,h.v2=(h.y+h.width)/a.height):(h.u2=(h.x+h.width)/a.width,h.v2=(h.y+h.height)/a.height),this.regions.push(h)}else{for(a=new lO(o.trim());t.readEntry(i,o=t.readLine())!==0;){const h=n[i[0]];h&&h(a)}this.pages.push(a)}}findRegion(e){for(let t=0;t<this.regions.length;t++)if(this.regions[t].name===e)return this.regions[t];return null}setTextures(e,t=""){for(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 aO{constructor(e){M(this,"lines");M(this,"index",0);this.lines=e.split(/\r\n|\r|\n/)}readLine(){return this.index>=this.lines.length?null:this.lines[this.index++]}readEntry(e,t){if(!t||(t=t.trim(),t.length===0))return 0;const i=t.indexOf(":");if(i===-1)return 0;e[0]=t.substr(0,i).trim();for(let n=1,r=i+1;;n++){const o=t.indexOf(",",r);if(o===-1)return e[n]=t.substr(r).trim(),n;if(e[n]=t.substr(r,o-r).trim(),r=o+1,n===4)return 4}}}class lO{constructor(e){M(this,"name");M(this,"minFilter",ha.Nearest);M(this,"magFilter",ha.Nearest);M(this,"uWrap",ua.ClampToEdge);M(this,"vWrap",ua.ClampToEdge);M(this,"texture",null);M(this,"width",0);M(this,"height",0);M(this,"pma",!1);M(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 sS extends iS{constructor(t,i){super();M(this,"page");M(this,"name");M(this,"x",0);M(this,"y",0);M(this,"offsetX",0);M(this,"offsetY",0);M(this,"originalWidth",0);M(this,"originalHeight",0);M(this,"index",0);M(this,"degrees",0);M(this,"names",null);M(this,"values",null);this.page=t,this.name=i,t.regions.push(this)}}const Nh=class Nh{constructor(e){M(this,"name");M(this,"timelineAttachment");M(this,"timelineSlots",Nh.empty);if(!e)throw new Error("name cannot be null.");this.name=e,this.timelineAttachment=this}isTimelineActive(e,t,i){let n=e[t];if(n.bone.isActive()){const r=(i?n.getAppliedPose():n.getPose()).getAttachment();if(r!=null&&r.timelineAttachment===this)return!0}for(let r=0,o=this.timelineSlots.length;r<o;r++){if(n=e[this.timelineSlots[r]],!n.bone.isActive())continue;const a=(i?n.getAppliedPose():n.getPose()).getAttachment();if(a!=null&&a.timelineAttachment===this)return!0}return!1}};M(Nh,"empty",[]);let Ph=Nh;const Dh=class Dh extends Ph{constructor(t){super(t);M(this,"id",Dh.nextID++);M(this,"bones",null);M(this,"vertices",[]);M(this,"worldVerticesLength",0)}computeWorldVertices(t,i,n,r,o,a,c){r=a+(r>>1)*c;const l=i.appliedPose.deform;let h=this.vertices;const u=this.bones;if(!u){l.length>0&&(h=l);const p=i.bone.appliedPose,g=p.worldX,x=p.worldY,v=p.a,y=p.b,S=p.c,C=p.d;for(let w=n,b=a;b<r;w+=2,b+=c){const _=h[w],A=h[w+1];o[b]=_*v+A*y+g,o[b+1]=_*S+A*C+x}return}let d=0,f=0;for(let p=0;p<n;p+=2){const g=u[d];d+=g+1,f+=g}const m=t.bones;if(l.length===0)for(let p=a,g=f*3;p<r;p+=c){let x=0,v=0,y=u[d++];for(y+=d;d<y;d++,g+=3){const S=m[u[d]].appliedPose,C=h[g],w=h[g+1],b=h[g+2];x+=(C*S.a+w*S.b+S.worldX)*b,v+=(C*S.c+w*S.d+S.worldY)*b}o[p]=x,o[p+1]=v}else{const p=l;for(let g=a,x=f*3,v=f<<1;g<r;g+=c){let y=0,S=0,C=u[d++];for(C+=d;d<C;d++,x+=3,v+=2){const w=m[u[d]].appliedPose,b=h[x]+p[v],_=h[x+1]+p[v+1],A=h[x+2];y+=(b*w.a+_*w.b+w.worldX)*A,S+=(b*w.c+_*w.d+w.worldY)*A}o[g]=y,o[g+1]=S}}}copyTo(t){this.bones?(t.bones=[],Ge.arrayCopy(this.bones,0,t.bones,0,this.bones.length)):t.bones=null,this.vertices&&(t.vertices=Ge.newFloatArray(this.vertices.length),Ge.arrayCopy(this.vertices,0,t.vertices,0,this.vertices.length)),t.worldVerticesLength=this.worldVerticesLength,t.timelineAttachment=this.timelineAttachment,t.timelineSlots=this.timelineSlots}};M(Dh,"nextID",0);let qn=Dh;class Ar extends qn{constructor(t,i){super(t);M(this,"sequence");M(this,"regionUVs",[]);M(this,"triangles",[]);M(this,"hullLength",0);M(this,"path");M(this,"color",new nt(1,1,1,1));M(this,"sourceMesh",null);M(this,"edges",[]);M(this,"width",0);M(this,"height",0);M(this,"tempColor",new nt(0,0,0,0));this.sequence=i}copy(){if(this.sourceMesh)return this.newLinkedMesh();const t=new Ar(this.name,this.sequence.copy());return t.path=this.path,t.color.setFromColor(this.color),this.copyTo(t),t.regionUVs=[],Ge.arrayCopy(this.regionUVs,0,t.regionUVs,0,this.regionUVs.length),t.triangles=[],Ge.arrayCopy(this.triangles,0,t.triangles,0,this.triangles.length),t.hullLength=this.hullLength,this.edges&&(t.edges=[],Ge.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 Ar(this.name,this.sequence.copy());return t.timelineAttachment=this.timelineAttachment,t.path=this.path,t.color.setFromColor(this.color),t.setSourceMesh(this.sourceMesh?this.sourceMesh:this),t.updateSequence(),t}static computeUVs(t,i,n){if(!t)throw new Error("Region not set.");const r=n.length;let o=t.u,a=t.v,c=0,l=0;if(t instanceof sS){const h=t.page,u=h.width,d=h.height;switch(t.degrees){case 90:o-=(t.originalHeight-t.offsetY-t.height)/u,a-=(t.originalWidth-t.offsetX-t.width)/d,c=t.originalHeight/u,l=t.originalWidth/d;for(let f=0;f<r;f+=2)n[f]=o+i[f+1]*c,n[f+1]=a+(1-i[f])*l;return;case 180:o-=(t.originalWidth-t.offsetX-t.width)/u,a-=t.offsetY/d,c=t.originalWidth/u,l=t.originalHeight/d;for(let f=0;f<r;f+=2)n[f]=o+(1-i[f])*c,n[f+1]=a+(1-i[f+1])*l;return;case 270:o-=t.offsetY/u,a-=t.offsetX/d,c=t.originalHeight/u,l=t.originalWidth/d;for(let f=0;f<r;f+=2)n[f]=o+(1-i[f+1])*c,n[f+1]=a+i[f]*l;return;default:o-=t.offsetX/u,a-=(t.originalHeight-t.offsetY-t.height)/d,c=t.originalWidth/u,l=t.originalHeight/d}}else t?(c=t.u2-o,l=t.v2-a):(o=a=0,c=l=1);for(let h=0;h<r;h+=2)n[h]=o+i[h]*c,n[h+1]=a+i[h+1]*l}}const vt=class vt extends Ph{constructor(t,i){super(t);M(this,"sequence");M(this,"x",0);M(this,"y",0);M(this,"scaleX",1);M(this,"scaleY",1);M(this,"rotation",0);M(this,"width",0);M(this,"height",0);M(this,"path");M(this,"color",new nt(1,1,1,1));M(this,"tempColor",new nt(1,1,1,1));this.sequence=i}copy(){const t=new vt(this.name,this.sequence.copy());return t.path=this.path,t.x=this.x,t.y=this.y,t.scaleX=this.scaleX,t.scaleY=this.scaleY,t.rotation=this.rotation,t.width=this.width,t.height=this.height,t.color.setFromColor(this.color),t}computeWorldVertices(t,i,n,r,o){const a=t.bone.appliedPose,c=a.worldX,l=a.worldY,h=a.a,u=a.b,d=a.c,f=a.d;let m=i[0],p=i[1];n[r]=m*h+p*u+c,n[r+1]=m*d+p*f+l,r+=o,m=i[2],p=i[3],n[r]=m*h+p*u+c,n[r+1]=m*d+p*f+l,r+=o,m=i[4],p=i[5],n[r]=m*h+p*u+c,n[r+1]=m*d+p*f+l,r+=o,m=i[6],p=i[7],n[r]=m*h+p*u+c,n[r+1]=m*d+p*f+l}getOffsets(t){return this.sequence.offsets[this.sequence.resolveIndex(t)]}updateSequence(){this.sequence.update(this)}static computeUVs(t,i,n,r,o,a,c,l,h,u){if(!t)throw new Error("Region not set.");const d=c/t.originalWidth*r,f=l/t.originalHeight*o,m=-c/2*r+t.offsetX*d,p=-l/2*o+t.offsetY*f,g=m+t.width*d,x=p+t.height*f,v=a*Ie.degRad,y=Math.cos(v),S=Math.sin(v),C=m*y+i,w=m*S,b=p*y+n,_=p*S,A=g*y+i,P=g*S,E=x*y+n,R=x*S;h[0]=C-_,h[1]=b+w,h[2]=C-R,h[3]=E+w,h[4]=A-R,h[5]=E+P,h[6]=A-_,h[7]=b+P,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))}};M(vt,"X1",0),M(vt,"Y1",1),M(vt,"C1R",2),M(vt,"C1G",3),M(vt,"C1B",4),M(vt,"C1A",5),M(vt,"U1",6),M(vt,"V1",7),M(vt,"X2",8),M(vt,"Y2",9),M(vt,"C2R",10),M(vt,"C2G",11),M(vt,"C2B",12),M(vt,"C2A",13),M(vt,"U2",14),M(vt,"V2",15),M(vt,"X3",16),M(vt,"Y3",17),M(vt,"C3R",18),M(vt,"C3G",19),M(vt,"C3B",20),M(vt,"C3A",21),M(vt,"U3",22),M(vt,"V3",23),M(vt,"X4",24),M(vt,"Y4",25),M(vt,"C4R",26),M(vt,"C4G",27),M(vt,"C4B",28),M(vt,"C4A",29),M(vt,"U4",30),M(vt,"V4",31);let da=vt;const Go=class Go{constructor(e,t){M(this,"id",Go.nextID());M(this,"regions");M(this,"pathSuffix");M(this,"uvs");M(this,"offsets");M(this,"start",0);M(this,"digits",0);M(this,"setupIndex",0);this.regions=new Array(e),this.pathSuffix=t}copy(){const e=this.regions.length,t=new Go(e,this.pathSuffix);if(Ge.arrayCopy(this.regions,0,t.regions,0,e),t.start=this.start,t.digits=this.digits,t.setupIndex=this.setupIndex,this.uvs!=null){const i=this.uvs[0].length;t.uvs=[];for(let n=0;n<e;n++)t.uvs[n]=Ge.newFloatArray(i),Ge.arrayCopy(this.uvs[n],0,t.uvs[n],0,i)}if(this.offsets!=null){t.offsets=[];for(let i=0;i<e;i++)t.offsets[i]=[],Ge.arrayCopy(this.offsets[i],0,t.offsets[i],0,8)}return t}update(e){const t=this.regions.length;if(e instanceof da){this.uvs=[],this.offsets=[];for(let i=0;i<t;i++)this.uvs[i]=Ge.newFloatArray(8),this.offsets[i]=[],da.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 Ar){const i=e.regionUVs;this.uvs=[],this.offsets=void 0;for(let n=0;n<t;n++)this.uvs[n]=Ge.newFloatArray(i.length),Ar.computeUVs(this.regions[n],i,this.uvs[n])}}resolveIndex(e){let t=e.sequenceIndex;return t===-1&&(t=this.setupIndex),t>=this.regions.length&&(t=this.regions.length-1),t}getUVs(e){return this.uvs[e]}hasPathSuffix(){return this.pathSuffix}getPath(e,t){if(!this.pathSuffix)return e;let i=e;const n=(this.start+t).toString();for(let r=this.digits-n.length;r>0;r--)i+="0";return i+=n,i}static nextID(){return Go._nextID++}};M(Go,"_nextID",0);let fa=Go;var _i;(function(s){s[s.hold=0]="hold",s[s.once=1]="once",s[s.loop=2]="loop",s[s.pingpong=3]="pingpong",s[s.onceReverse=4]="onceReverse",s[s.loopReverse=5]="loopReverse",s[s.pingpongReverse=6]="pingpongReverse"})(_i||(_i={}));const nS=[_i.hold,_i.once,_i.loop,_i.pingpong,_i.onceReverse,_i.loopReverse,_i.pingpongReverse];class Lp{constructor(e,t,i){M(this,"name");M(this,"timelines",[]);M(this,"timelineIds");M(this,"bones");M(this,"color",new nt(1,1,1,1));M(this,"duration");if(!e)throw new Error("name cannot be null.");this.name=e,this.duration=i,this.timelineIds=new sO,this.bones=[],this.setTimelines(t)}setTimelines(e){if(!e)throw new Error("timelines cannot be null.");this.timelines=e;const t=e.length;this.timelineIds.clear(),this.bones.length=0;const i=new Set,n=e;for(let r=0;r<t;r++){const o=n[r];this.timelineIds.addAll(o.propertyIds),hO(o)&&i.add(o.boneIndex)&&this.bones.push(o.boneIndex)}}hasTimeline(e){for(let t=0;t<e.length;t++)if(this.timelineIds.contains(e[t]))return!0;return!1}apply(e,t,i,n,r,o,a,c,l,h){if(!e)throw new Error("skeleton cannot be null.");n&&this.duration!==0&&(i%=this.duration,t>0&&(t%=this.duration));const u=this.timelines;for(let d=0,f=u.length;d<f;d++)u[d].apply(e,t,i,r,o,a,c,l,h)}}var Xe;(function(s){s[s.current=0]="current",s[s.setup=1]="setup",s[s.first=2]="first"})(Xe||(Xe={}));var st;(function(s){s[s.rotate=0]="rotate",s[s.x=1]="x",s[s.y=2]="y",s[s.scaleX=3]="scaleX",s[s.scaleY=4]="scaleY",s[s.shearX=5]="shearX",s[s.shearY=6]="shearY",s[s.inherit=7]="inherit",s[s.rgb=8]="rgb",s[s.alpha=9]="alpha",s[s.rgb2=10]="rgb2",s[s.attachment=11]="attachment",s[s.deform=12]="deform",s[s.event=13]="event",s[s.drawOrder=14]="drawOrder",s[s.drawOrderFolder=15]="drawOrderFolder",s[s.ikConstraint=16]="ikConstraint",s[s.transformConstraint=17]="transformConstraint",s[s.pathConstraintPosition=18]="pathConstraintPosition",s[s.pathConstraintSpacing=19]="pathConstraintSpacing",s[s.pathConstraintMix=20]="pathConstraintMix",s[s.physicsConstraintInertia=21]="physicsConstraintInertia",s[s.physicsConstraintStrength=22]="physicsConstraintStrength",s[s.physicsConstraintDamping=23]="physicsConstraintDamping",s[s.physicsConstraintMass=24]="physicsConstraintMass",s[s.physicsConstraintWind=25]="physicsConstraintWind",s[s.physicsConstraintGravity=26]="physicsConstraintGravity",s[s.physicsConstraintMix=27]="physicsConstraintMix",s[s.physicsConstraintReset=28]="physicsConstraintReset",s[s.sequence=29]="sequence",s[s.sliderTime=30]="sliderTime",s[s.sliderMix=31]="sliderMix"})(st||(st={}));let Bt=class{constructor(e,...t){M(this,"propertyIds");M(this,"frames");M(this,"additive",!1);M(this,"instant",!1);this.propertyIds=t,this.frames=Ge.newFloatArray(e*this.getFrameEntries())}getPropertyIds(){return this.propertyIds}getFrameEntries(){return 1}getFrameCount(){return this.frames.length/this.getFrameEntries()}getDuration(){return this.frames[this.frames.length-this.getFrameEntries()]}static search(e,t,i=1){const n=e.length;for(let r=i;r<n;r+=i)if(e[r]>t)return r-i;return n-i}};function cO(s){return typeof s=="object"&&s!==null&&typeof s.slotIndex=="number"}class bo extends Bt{constructor(t,i,...n){super(t,...n);M(this,"curves");this.curves=Ge.newFloatArray(t+i*18),this.curves[t-1]=1}setLinear(t){this.curves[t]=0}setStepped(t){this.curves[t]=1}shrink(t){const i=this.getFrameCount()+t*18;if(this.curves.length>i){const n=Ge.newFloatArray(i);Ge.arrayCopy(this.curves,0,n,0,i),this.curves=n}}setBezier(t,i,n,r,o,a,c,l,h,u,d){const f=this.curves;let m=this.getFrameCount()+t*18;n===0&&(f[i]=2+m);const p=(r-a*2+l)*.03,g=(o-c*2+h)*.03,x=((a-l)*3-r+u)*.006,v=((c-h)*3-o+d)*.006;let y=p*2+x,S=g*2+v,C=(a-r)*.3+p+x*.16666667,w=(c-o)*.3+g+v*.16666667,b=r+C,_=o+w;for(let A=m+18;m<A;m+=2)f[m]=b,f[m+1]=_,C+=y,w+=S,y+=x,S+=v,b+=C,_+=w}getBezierValue(t,i,n,r){const o=this.curves;if(o[r]>t){const h=this.frames[i],u=this.frames[i+n];return u+(t-h)/(o[r]-h)*(o[r+1]-u)}const a=r+18;for(r+=2;r<a;r+=2)if(o[r]>=t){const h=o[r-2],u=o[r-1];return u+(t-h)/(o[r]-h)*(o[r+1]-u)}i+=this.getFrameEntries();const c=o[a-2],l=o[a-1];return l+(t-c)/(this.frames[i]-c)*(this.frames[i+n]-l)}}class Bn extends bo{constructor(e,t,i){super(e,t,i)}getFrameEntries(){return 2}setFrame(e,t,i){e<<=1,this.frames[e]=t,this.frames[e+1]=i}getCurveValue(e){const t=this.frames;let i=t.length-2;for(let r=2;r<=i;r+=2)if(t[r]>e){i=r-2;break}const n=this.curves[i>>1];switch(n){case 0:{const r=t[i],o=t[i+1];return o+(e-r)/(t[i+2]-r)*(t[i+2+1]-o)}case 1:return t[i+1]}return this.getBezierValue(e,i,1,n-2)}getRelativeValue(e,t,i,n,r,o){if(e<this.frames[0])return Bn.beforeFirstKey(i,t,r,o);const a=this.getCurveValue(e);return i===Xe.setup?o+a*t:r+(n?a:a+o-r)*t}getAbsoluteValue(e,t,i,n,r,o,a){return a===void 0?this.getAbsoluteValue1(e,t,i,n,r,o):this.getAbsoluteValue2(e,t,i,n,r,o,a)}getAbsoluteValue1(e,t,i,n,r,o){if(e<this.frames[0])return Bn.beforeFirstKey(i,t,r,o);const a=this.getCurveValue(e);return i===Xe.setup?o+(n?a:a-o)*t:r+(n?a:a-r)*t}getAbsoluteValue2(e,t,i,n,r,o,a){return e<this.frames[0]?Bn.beforeFirstKey(i,t,r,o):i===Xe.setup?o+(n?a:a-o)*t:r+(n?a:a-r)*t}getScaleValue(e,t,i,n,r,o,a){if(e<this.frames[0])return Bn.beforeFirstKey(i,t,o,a);const c=this.getCurveValue(e)*a;if(t===1&&!n)return c;let l=i===Xe.setup?a:o;return n?l+(c-a)*t:r?l+(Math.abs(c)*Math.sign(l)-l)*t:(l=Math.abs(l)*Math.sign(c),l+(c-l)*t)}static beforeFirstKey(e,t,i,n){switch(e){case Xe.setup:return n;case Xe.first:return i+(n-i)*t;case Xe.current:return i}}}function hO(s){return typeof s=="object"&&s!==null&&typeof s.boneIndex=="number"}class wo extends Bn{constructor(t,i,n,r){super(t,i,`${r}|${n}`);M(this,"boneIndex");this.boneIndex=n,this.additive=!0}apply(t,i,n,r,o,a,c,l,h){const u=t.bones[this.boneIndex];u.active&&this.apply1(h?u.appliedPose:u.pose,u.data.setupPose,n,o,a,c,l)}}class Bp extends bo{constructor(t,i,n,r,o){super(t,i,`${r}|${n}`,`${o}|${n}`);M(this,"boneIndex");this.boneIndex=n,this.additive=!0}getFrameEntries(){return 3}setFrame(t,i,n,r){t*=3,this.frames[t]=i,this.frames[t+1]=n,this.frames[t+2]=r}apply(t,i,n,r,o,a,c,l,h){const u=t.bones[this.boneIndex];u.active&&this.apply1(h?u.appliedPose:u.pose,u.data.setupPose,n,o,a,c,l)}}class kh extends wo{constructor(e,t,i){super(e,t,i,st.rotate)}apply1(e,t,i,n,r,o,a){e.rotation=this.getRelativeValue(i,n,r,o,e.rotation,t.rotation)}}class rS extends Bp{constructor(e,t,i){super(e,t,i,st.x,st.y)}apply1(e,t,i,n,r,o,a){const c=this.frames;if(i<c[0]){switch(r){case Xe.setup:e.x=t.x,e.y=t.y;break;case Xe.first:e.x+=(t.x-e.x)*n,e.y+=(t.y-e.y)*n;break}return}let l=0,h=0;const u=Bt.search(c,i,3),d=this.curves[u/3];switch(d){case 0:{const f=c[u];l=c[u+1],h=c[u+2];const m=(i-f)/(c[u+3]-f);l+=(c[u+3+1]-l)*m,h+=(c[u+3+2]-h)*m;break}case 1:l=c[u+1],h=c[u+2];break;default:l=this.getBezierValue(i,u,1,d-2),h=this.getBezierValue(i,u,2,d+18-2)}r===Xe.setup?(e.x=t.x+l*n,e.y=t.y+h*n):o?(e.x+=l*n,e.y+=h*n):(e.x+=(t.x+l-e.x)*n,e.y+=(t.y+h-e.y)*n)}}class oS extends wo{constructor(e,t,i){super(e,t,i,st.x)}apply1(e,t,i,n,r,o,a){e.x=this.getRelativeValue(i,n,r,o,e.x,t.x)}}class aS extends wo{constructor(e,t,i){super(e,t,i,st.y)}apply1(e,t,i,n,r,o,a){e.y=this.getRelativeValue(i,n,r,o,e.y,t.y)}}class lS extends Bp{constructor(e,t,i){super(e,t,i,st.scaleX,st.scaleY)}apply1(e,t,i,n,r,o,a){const c=this.frames;if(i<c[0]){switch(r){case Xe.setup:e.scaleX=t.scaleX,e.scaleY=t.scaleY;break;case Xe.first:e.scaleX+=(t.scaleX-e.scaleX)*n,e.scaleY+=(t.scaleY-e.scaleY)*n;break}return}let l,h;const u=Bt.search(c,i,3),d=this.curves[u/3];switch(d){case 0:{const f=c[u];l=c[u+1],h=c[u+2];const m=(i-f)/(c[u+3]-f);l+=(c[u+3+1]-l)*m,h+=(c[u+3+2]-h)*m;break}case 1:l=c[u+1],h=c[u+2];break;default:l=this.getBezierValue(i,u,1,d-2),h=this.getBezierValue(i,u,2,d+18-2)}if(l*=t.scaleX,h*=t.scaleY,n===1&&!o)e.scaleX=l,e.scaleY=h;else{let f=0,m=0;r===Xe.setup?(f=t.scaleX,m=t.scaleY):(f=e.scaleX,m=e.scaleY),o?(e.scaleX=f+(l-t.scaleX)*n,e.scaleY=m+(h-t.scaleY)*n):a?(e.scaleX=f+(Math.abs(l)*Math.sign(f)-f)*n,e.scaleY=m+(Math.abs(h)*Math.sign(m)-m)*n):(f=Math.abs(f)*Math.sign(l),m=Math.abs(m)*Math.sign(h),e.scaleX=f+(l-f)*n,e.scaleY=m+(h-m)*n)}}}class cS extends wo{constructor(e,t,i){super(e,t,i,st.scaleX)}apply1(e,t,i,n,r,o,a){e.scaleX=this.getScaleValue(i,n,r,o,a,e.scaleX,t.scaleX)}}class hS extends wo{constructor(e,t,i){super(e,t,i,st.scaleY)}apply1(e,t,i,n,r,o,a){e.scaleY=this.getScaleValue(i,n,r,o,a,e.scaleY,t.scaleY)}}class uS extends Bp{constructor(e,t,i){super(e,t,i,st.shearX,st.shearY)}apply1(e,t,i,n,r,o,a){const c=this.frames;if(i<c[0]){switch(r){case Xe.setup:e.shearX=t.shearX,e.shearY=t.shearY;break;case Xe.first:e.shearX+=(t.shearX-e.shearX)*n,e.shearY+=(t.shearY-e.shearY)*n;break}return}let l=0,h=0;const u=Bt.search(c,i,3),d=this.curves[u/3];switch(d){case 0:{const f=c[u];l=c[u+1],h=c[u+2];const m=(i-f)/(c[u+3]-f);l+=(c[u+3+1]-l)*m,h+=(c[u+3+2]-h)*m;break}case 1:l=c[u+1],h=c[u+2];break;default:l=this.getBezierValue(i,u,1,d-2),h=this.getBezierValue(i,u,2,d+18-2)}r===Xe.setup?(e.shearX=t.shearX+l*n,e.shearY=t.shearY+h*n):o?(e.shearX+=l*n,e.shearY+=h*n):(e.shearX+=(t.shearX+l-e.shearX)*n,e.shearY+=(t.shearY+h-e.shearY)*n)}}class dS extends wo{constructor(e,t,i){super(e,t,i,st.shearX)}apply1(e,t,i,n,r,o,a){e.shearX=this.getRelativeValue(i,n,r,o,e.shearX,t.shearX)}}class fS extends wo{constructor(e,t,i){super(e,t,i,st.shearY)}apply1(e,t,i,n,r,o,a){e.shearY=this.getRelativeValue(i,n,r,o,e.shearY,t.shearY)}}class mS extends Bt{constructor(t,i){super(t,`${st.inherit}|${i}`);M(this,"boneIndex");this.boneIndex=i,this.instant=!0}getFrameEntries(){return 2}setFrame(t,i,n){t*=2,this.frames[t]=i,this.frames[t+1]=n}apply(t,i,n,r,o,a,c,l,h){const u=t.bones[this.boneIndex];if(!u.active)return;const d=h?u.appliedPose:u.pose;if(l)a!==Xe.current&&(d.inherit=u.data.setupPose.inherit);else{const f=this.frames;n<f[0]?a!==Xe.current&&(d.inherit=u.data.setupPose.inherit):d.inherit=this.frames[Bt.search(f,n,2)+1]}}}class xu extends bo{constructor(t,i,n,...r){super(t,i,...r);M(this,"slotIndex");this.slotIndex=n}apply(t,i,n,r,o,a,c,l,h){const u=t.slots[this.slotIndex];u.bone.active&&this.apply1(u,h?u.appliedPose:u.pose,n,o,a,c)}}class pS extends xu{constructor(e,t,i){super(e,t,i,`${st.rgb}|${i}`,`${st.alpha}|${i}`)}getFrameEntries(){return 5}setFrame(e,t,i,n,r,o){e*=5,this.frames[e]=t,this.frames[e+1]=i,this.frames[e+2]=n,this.frames[e+3]=r,this.frames[e+4]=o}apply1(e,t,i,n,r,o){const a=t.color,c=this.frames;if(i<c[0]){const p=e.data.setupPose.color;switch(r){case Xe.setup:a.setFromColor(p);break;case Xe.first:a.add((p.r-a.r)*n,(p.g-a.g)*n,(p.b-a.b)*n,(p.a-a.a)*n);break}return}let l=0,h=0,u=0,d=0;const f=Bt.search(c,i,5),m=this.curves[f/5];switch(m){case 0:{const p=c[f];l=c[f+1],h=c[f+2],u=c[f+3],d=c[f+4];const g=(i-p)/(c[f+5]-p);l+=(c[f+5+1]-l)*g,h+=(c[f+5+2]-h)*g,u+=(c[f+5+3]-u)*g,d+=(c[f+5+4]-d)*g;break}case 1:l=c[f+1],h=c[f+2],u=c[f+3],d=c[f+4];break;default:l=this.getBezierValue(i,f,1,m-2),h=this.getBezierValue(i,f,2,m+18-2),u=this.getBezierValue(i,f,3,m+36-2),d=this.getBezierValue(i,f,4,m+54-2)}if(n===1)a.set(l,h,u,d);else if(r===Xe.setup){const p=e.data.setupPose.color;a.set(p.r+(l-p.r)*n,p.g+(h-p.g)*n,p.b+(u-p.b)*n,p.a+(d-p.a)*n)}else a.add((l-a.r)*n,(h-a.g)*n,(u-a.b)*n,(d-a.a)*n)}}class gS extends xu{constructor(e,t,i){super(e,t,i,`${st.rgb}|${i}`)}getFrameEntries(){return 4}setFrame(e,t,i,n,r){e<<=2,this.frames[e]=t,this.frames[e+1]=i,this.frames[e+2]=n,this.frames[e+3]=r}apply1(e,t,i,n,r,o){const a=t.color;let c=0,l=0,h=0;const u=this.frames;if(i<u[0]){const m=e.data.setupPose.color;switch(r){case Xe.setup:{a.r=m.r,a.g=m.g,a.b=m.b;break}case Xe.first:{a.r+=(m.r-a.r)*n,a.g+=(m.g-a.g)*n,a.b+=(m.b-a.b)*n;break}}return}const d=Bt.search(u,i,4),f=this.curves[d>>2];switch(f){case 0:{const m=u[d];c=u[d+1],l=u[d+2],h=u[d+3];const p=(i-m)/(u[d+4]-m);c+=(u[d+4+1]-c)*p,l+=(u[d+4+2]-l)*p,h+=(u[d+4+3]-h)*p;break}case 1:c=u[d+1],l=u[d+2],h=u[d+3];break;default:c=this.getBezierValue(i,d,1,f-2),l=this.getBezierValue(i,d,2,f+18-2),h=this.getBezierValue(i,d,3,f+36-2)}if(n!==1)if(r===Xe.setup){const m=e.data.setupPose.color;c=m.r+(c-m.r)*n,l=m.g+(l-m.g)*n,h=m.b+(h-m.b)*n}else c=a.r+(c-a.r)*n,l=a.g+(l-a.g)*n,h=a.b+(h-a.b)*n;a.r=c<0?0:c>1?1:c,a.g=l<0?0:l>1?1:l,a.b=h<0?0:h>1?1:h}}class vS extends Bn{constructor(t,i,n){super(t,i,`${st.alpha}|${n}`);M(this,"slotIndex",0);this.slotIndex=n}apply(t,i,n,r,o,a,c,l,h){const u=t.slots[this.slotIndex];if(!u.bone.active)return;const d=(h?u.appliedPose:u.pose).color;let f=0;const m=this.frames;if(n<m[0]){const p=u.data.setupPose.color.a;switch(a){case Xe.setup:d.a=p;break;case Xe.first:d.a+=(p-d.a)*o;break}return}if(f=this.getCurveValue(n),o!==1)if(a===Xe.setup){const p=u.data.setupPose.color;f=p.a+(f-p.a)*o}else f=d.a+(f-d.a)*o;d.a=f<0?0:f>1?1:f}}class yS extends xu{constructor(e,t,i){super(e,t,i,`${st.rgb}|${i}`,`${st.alpha}|${i}`,`${st.rgb2}|${i}`)}getFrameEntries(){return 8}setFrame(e,t,i,n,r,o,a,c,l){e<<=3,this.frames[e]=t,this.frames[e+1]=i,this.frames[e+2]=n,this.frames[e+3]=r,this.frames[e+4]=o,this.frames[e+5]=a,this.frames[e+6]=c,this.frames[e+7]=l}apply1(e,t,i,n,r,o){const a=t.color,c=t.darkColor;let l=0,h=0,u=0;const d=this.frames;if(i<d[0]){const y=e.data.setupPose,S=y.color,C=y.darkColor;switch(r){case Xe.setup:{a.setFromColor(S),c.r=C.r,c.g=C.g,c.b=C.b;break}case Xe.first:{a.add((S.r-a.r)*n,(S.g-a.g)*n,(S.b-a.b)*n,(S.a-a.a)*n),c.r+=(C.r-c.r)*n,c.g+=(C.g-c.g)*n,c.b+=(C.b-c.b)*n;break}}return}let f=0,m=0,p=0,g=0;const x=Bt.search(d,i,8),v=this.curves[x>>3];switch(v){case 0:{const y=d[x];f=d[x+1],m=d[x+2],p=d[x+3],g=d[x+4],l=d[x+5],h=d[x+6],u=d[x+7];const S=(i-y)/(d[x+8]-y);f+=(d[x+8+1]-f)*S,m+=(d[x+8+2]-m)*S,p+=(d[x+8+3]-p)*S,g+=(d[x+8+4]-g)*S,l+=(d[x+8+5]-l)*S,h+=(d[x+8+6]-h)*S,u+=(d[x+8+7]-u)*S;break}case 1:f=d[x+1],m=d[x+2],p=d[x+3],g=d[x+4],l=d[x+5],h=d[x+6],u=d[x+7];break;default:f=this.getBezierValue(i,x,1,v-2),m=this.getBezierValue(i,x,2,v+18-2),p=this.getBezierValue(i,x,3,v+36-2),g=this.getBezierValue(i,x,4,v+54-2),l=this.getBezierValue(i,x,5,v+72-2),h=this.getBezierValue(i,x,6,v+90-2),u=this.getBezierValue(i,x,7,v+108-2)}if(n===1)a.set(f,m,p,g);else if(r===Xe.setup){const y=e.data.setupPose;let S=y.color;a.set(S.r+(f-S.r)*n,S.g+(m-S.g)*n,S.b+(p-S.b)*n,S.a+(g-S.a)*n),S=y.darkColor,l=S.r+(l-S.r)*n,h=S.g+(h-S.g)*n,u=S.b+(u-S.b)*n}else a.add((f-a.r)*n,(m-a.g)*n,(p-a.b)*n,(g-a.a)*n),l=c.r+(l-c.r)*n,h=c.g+(h-c.g)*n,u=c.b+(u-c.b)*n;c.r=l<0?0:l>1?1:l,c.g=h<0?0:h>1?1:h,c.b=u<0?0:u>1?1:u}}class xS extends xu{constructor(e,t,i){super(e,t,i,`${st.rgb}|${i}`,`${st.rgb2}|${i}`)}getFrameEntries(){return 7}setFrame(e,t,i,n,r,o,a,c){e*=7,this.frames[e]=t,this.frames[e+1]=i,this.frames[e+2]=n,this.frames[e+3]=r,this.frames[e+4]=o,this.frames[e+5]=a,this.frames[e+6]=c}apply1(e,t,i,n,r,o){const a=t.color,c=t.darkColor;let l=0,h=0,u=0,d=0,f=0,m=0;const p=this.frames;if(i<p[0]){const v=e.data.setupPose,y=v.color,S=v.darkColor;switch(r){case Xe.setup:a.r=y.r,a.g=y.g,a.b=y.b,c.r=S.r,c.g=S.g,c.b=S.b;break;case Xe.first:a.r+=(y.r-a.r)*n,a.g+=(y.g-a.g)*n,a.b+=(y.b-a.b)*n,c.r+=(S.r-c.r)*n,c.g+=(S.g-c.g)*n,c.b+=(S.b-c.b)*n;break}return}const g=Bt.search(p,i,7),x=this.curves[g/7];switch(x){case 0:{const v=p[g];l=p[g+1],h=p[g+2],u=p[g+3],d=p[g+4],f=p[g+5],m=p[g+6];const y=(i-v)/(p[g+7]-v);l+=(p[g+7+1]-l)*y,h+=(p[g+7+2]-h)*y,u+=(p[g+7+3]-u)*y,d+=(p[g+7+4]-d)*y,f+=(p[g+7+5]-f)*y,m+=(p[g+7+6]-m)*y;break}case 1:l=p[g+1],h=p[g+2],u=p[g+3],d=p[g+4],f=p[g+5],m=p[g+6];break;default:l=this.getBezierValue(i,g,1,x-2),h=this.getBezierValue(i,g,2,x+18-2),u=this.getBezierValue(i,g,3,x+36-2),d=this.getBezierValue(i,g,4,x+54-2),f=this.getBezierValue(i,g,5,x+72-2),m=this.getBezierValue(i,g,6,x+90-2)}if(n!==1)if(r===Xe.setup){const v=e.data.setupPose;let y=v.color;l=y.r+(l-y.r)*n,h=y.g+(h-y.g)*n,u=y.b+(u-y.b)*n,y=v.darkColor,d=y.r+(d-y.r)*n,f=y.g+(f-y.g)*n,m=y.b+(m-y.b)*n}else l=a.r+(l-a.r)*n,h=a.g+(h-a.g)*n,u=a.b+(u-a.b)*n,d=c.r+(d-c.r)*n,f=c.g+(f-c.g)*n,m=c.b+(m-c.b)*n;a.r=l<0?0:l>1?1:l,a.g=h<0?0:h>1?1:h,a.b=u<0?0:u>1?1:u,c.r=d<0?0:d>1?1:d,c.g=f<0?0:f>1?1:f,c.b=m<0?0:m>1?1:m}}class sl extends Bt{constructor(t,i){super(t,`${st.attachment}|${i}`);M(this,"slotIndex",0);M(this,"attachmentNames");this.slotIndex=i,this.attachmentNames=new Array(t),this.instant=!0}getFrameCount(){return this.frames.length}setFrame(t,i,n){this.frames[t]=i,this.attachmentNames[t]=n}apply(t,i,n,r,o,a,c,l,h){const u=t.slots[this.slotIndex];if(!u.bone.active)return;const d=h?u.appliedPose:u.pose;l||n<this.frames[0]?a!==Xe.current&&this.setAttachment(t,d,u.data.attachmentName):this.setAttachment(t,d,this.attachmentNames[Bt.search(this.frames,n)])}setAttachment(t,i,n){i.setAttachment(n?t.getAttachment(this.slotIndex,n):null)}}class bS extends bo{constructor(t,i,n,r){super(t,i,`${st.deform}|${n}|${r.id}`);M(this,"slotIndex");M(this,"attachment");M(this,"vertices");this.slotIndex=n,this.attachment=r,this.vertices=new Array(t),this.additive=!0}getFrameCount(){return this.frames.length}setFrame(t,i,n){this.frames[t]=i,this.vertices[t]=n}setBezier(t,i,n,r,o,a,c,l,h,u,d){const f=this.curves;let m=this.getFrameCount()+t*18;n===0&&(f[i]=2+m);const p=(r-a*2+l)*.03,g=h*.03-c*.06,x=((a-l)*3-r+u)*.006,v=(c-h+.33333333)*.018;let y=p*2+x,S=g*2+v,C=(a-r)*.3+p+x*.16666667,w=c*.3+g+v*.16666667,b=r+C,_=w;for(let A=m+18;m<A;m+=2)f[m]=b,f[m+1]=_,C+=y,w+=S,y+=x,S+=v,b+=C,_+=w}getCurvePercent(t,i){const n=this.curves;let r=n[i];switch(r){case 0:{const l=this.frames[i];return(t-l)/(this.frames[i+this.getFrameEntries()]-l)}case 1:return 0}if(r-=2,n[r]>t){const l=this.frames[i];return n[r+1]*(t-l)/(n[r]-l)}const o=r+18;for(r+=2;r<o;r+=2)if(n[r]>=t){const l=n[r-2],h=n[r-1];return h+(t-l)/(n[r]-l)*(n[r+1]-h)}const a=n[o-2],c=n[o-1];return c+(1-c)*(t-a)/(this.frames[i+this.getFrameEntries()]-a)}apply(t,i,n,r,o,a,c,l,h){const u=t.slots;if(!this.attachment.isTimelineActive(u,this.slotIndex,h))return;const d=this.attachment.timelineSlots,f=this.frames;if(n<f[0]){this.applyBeforeFirst(u[this.slotIndex],h,o,a);for(const v of d)this.applyBeforeFirst(u[v],h,o,a);return}let m,p,g;if(n>=f[f.length-1])g=0,m=this.vertices[f.length-1],p=null;else{const v=Bt.search(f,n);g=this.getCurvePercent(n,v),m=this.vertices[v],p=this.vertices[v+1]}const x=this.vertices[0].length;this.applyToSlot(u[this.slotIndex],h,m,p,g,x,o,a,c);for(const v of d)this.applyToSlot(u[v],h,m,p,g,x,o,a,c)}applyBeforeFirst(t,i,n,r){if(!t.bone.active)return;const o=i?t.appliedPose:t.pose;if(o.attachment==null||o.attachment.timelineAttachment!==this.attachment)return;const a=o.deform;switch(a.length===0&&(r=Xe.setup),r){case Xe.setup:a.length=0;break;case Xe.first:{if(n===1){a.length=0;return}const c=this.vertices[0].length;a.length=c;const l=a,h=o.attachment;if(h.bones===null){const u=h.vertices;for(let d=0;d<c;d++)l[d]+=(u[d]-l[d])*n}else{n=1-n;for(let u=0;u<c;u++)l[u]*=n}}}}applyToSlot(t,i,n,r,o,a,c,l,h){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=Xe.setup);const m=l===Xe.setup;if(f.length=a,r===null)if(c===1)if(h&&!m)if(d.bones)for(let p=0;p<a;p++)f[p]+=n[p];else{const p=d.vertices;for(let g=0;g<a;g++)f[g]+=n[g]-p[g]}else Ge.arrayCopy(n,0,f,0,a);else if(m)if(d.bones)for(let p=0;p<a;p++)f[p]=n[p]*c;else{const p=d.vertices;for(let g=0;g<a;g++){const x=p[g];f[g]=x+(n[g]-x)*c}}else if(h)if(d.bones)for(let p=0;p<a;p++)f[p]+=n[p]*c;else{const p=d.vertices;for(let g=0;g<a;g++)f[g]+=(n[g]-p[g])*c}else for(let p=0;p<a;p++)f[p]+=(n[p]-f[p])*c;else if(c===1)if(h&&!m)if(d.bones)for(let p=0;p<a;p++){const g=n[p];f[p]+=g+(r[p]-g)*o}else{const p=d.vertices;for(let g=0;g<a;g++){const x=n[g];f[g]+=x+(r[g]-x)*o-p[g]}}else if(o===0)Ge.arrayCopy(n,0,f,0,a);else for(let p=0;p<a;p++){const g=n[p];f[p]=g+(r[p]-g)*o}else if(m)if(d.bones)for(let p=0;p<a;p++){const g=n[p];f[p]=(g+(r[p]-g)*o)*c}else{const p=d.vertices;for(let g=0;g<a;g++){const x=n[g],v=p[g];f[g]=v+(x+(r[g]-x)*o-v)*c}}else if(h)if(d.bones)for(let p=0;p<a;p++){const g=n[p];f[p]+=(g+(r[p]-g)*o)*c}else{const p=d.vertices;for(let g=0;g<a;g++){const x=n[g];f[g]+=(x+(r[g]-x)*o-p[g])*c}}else for(let p=0;p<a;p++){const g=n[p];f[p]+=(g+(r[p]-g)*o-f[p])*c}}}const cs=class cs extends Bt{constructor(t,i,n){super(t,`${st.sequence}|${i}|${n.sequence.id}`);M(this,"slotIndex");M(this,"attachment");this.slotIndex=i,this.attachment=n,this.instant=!0}getFrameEntries(){return cs.ENTRIES}getSlotIndex(){return this.slotIndex}getAttachment(){return this.attachment}setFrame(t,i,n,r,o){const a=this.frames;t*=cs.ENTRIES,a[t]=i,a[t+cs.MODE]=n|r<<4,a[t+cs.DELAY]=o}apply(t,i,n,r,o,a,c,l,h){const u=t.slots;if(!this.attachment.isTimelineActive(u,this.slotIndex,h))return;const d=this.attachment.timelineSlots,f=this.frames;if(l||n<f[0]){if(a!==Xe.current){this.setupPose(u[this.slotIndex],h);for(const v of d)this.setupPose(u[v],h)}return}const m=Bt.search(f,n,cs.ENTRIES),p=f[m],g=f[m+cs.MODE],x=f[m+cs.DELAY];this.applyToSlot(u[this.slotIndex],h,n,p,g,x);for(const v of d)this.applyToSlot(u[v],h,n,p,g,x)}setupPose(t,i){if(!t.bone.active)return;const n=i?t.appliedPose:t.pose;n.attachment===null||n.attachment.timelineAttachment!==this.attachment||(n.sequenceIndex=-1)}applyToSlot(t,i,n,r,o,a){if(!t.bone.active)return;const c=i?t.appliedPose:t.pose;if(c.attachment===null||c.attachment.timelineAttachment!==this.attachment)return;let l=o>>4,h=c.attachment.sequence.regions.length;const u=nS[o&15];if(u!==_i.hold)switch(l+=(n-r)/a+1e-5|0,u){case _i.once:l=Math.min(h-1,l);break;case _i.loop:l%=h;break;case _i.pingpong:{const d=(h<<1)-2;l=d===0?0:l%d,l>=h&&(l=d-l);break}case _i.onceReverse:l=Math.max(h-1-l,0);break;case _i.loopReverse:l=h-1-l%h;break;case _i.pingpongReverse:{const d=(h<<1)-2;l=d===0?0:(l+h-1)%d,l>=h&&(l=d-l)}}c.sequenceIndex=l}};M(cs,"ENTRIES",3),M(cs,"MODE",1),M(cs,"DELAY",2);let Fh=cs;const Uh=class Uh extends Bt{constructor(t){super(t,...Uh.propertyIds);M(this,"events");this.events=new Array(t),this.instant=!0}getFrameCount(){return this.frames.length}setFrame(t,i){this.frames[t]=i.time,this.events[t]=i}apply(t,i,n,r,o,a,c,l,h){if(!r)return;const u=this.frames,d=this.frames.length;if(i>n)this.apply(null,i,Number.MAX_VALUE,r,0,a,!1,!1,!1),i=-1;else if(i>=u[d-1])return;if(n<u[0])return;let f=0;if(i<u[0])f=0;else{f=Bt.search(u,i)+1;const m=u[f];for(;f>0&&u[f-1]===m;)f--}for(;f<d&&n>=u[f];f++)r.push(this.events[f])}};M(Uh,"propertyIds",[`${st.event}`]);let Tl=Uh;const jo=class jo extends Bt{constructor(t){super(t,...jo.propertyIds);M(this,"drawOrders");this.drawOrders=new Array(t),this.instant=!0}getFrameCount(){return this.frames.length}setFrame(t,i,n){this.frames[t]=i,this.drawOrders[t]=n}apply(t,i,n,r,o,a,c,l,h){const u=h?t.drawOrder.appliedPose:t.drawOrder.pose,d=t.slots;if(l||n<this.frames[0]){a!==Xe.current&&Ge.arrayCopy(d,0,u,0,t.slots.length);return}const f=this.drawOrders[Bt.search(this.frames,n)];if(!f)Ge.arrayCopy(d,0,u,0,t.slots.length);else for(let m=0,p=f.length;m<p;m++)u[m]=d[f[m]]}};M(jo,"propertyID",`${st.drawOrder}`),M(jo,"propertyIds",[jo.propertyID]);let _r=jo;const rl=class rl extends Bt{constructor(t,i,n){super(t,...rl.propertyIds(i));M(this,"slots");M(this,"inFolder");M(this,"drawOrders");this.slots=i,this.drawOrders=new Array(t),this.inFolder=new Array(n);for(const r of i)this.inFolder[r]=!0;this.instant=!0}static propertyIds(t){const i=t.length,n=new Array(i);for(let r=0;r<i;r++)n[r]=`${rl.propertyID}|${t[r]}`;return n}getFrameCount(){return this.frames.length}getSlots(){return this.slots}getDrawOrders(){return this.drawOrders}setFrame(t,i,n){this.frames[t]=i,this.drawOrders[t]=n}apply(t,i,n,r,o,a,c,l,h){const u=h?t.drawOrder.appliedPose:t.drawOrder.pose,d=t.slots;if(l||n<this.frames[0])a!==Xe.current&&this.setup(u,d);else{const f=this.drawOrders[Bt.search(this.frames,n)];if(!f)this.setup(u,d);else{const m=this.inFolder,p=this.slots;for(let g=0,x=0,v=p.length;!(m[u[g].data.index]&&(u[g]=d[p[f[x]]],++x===v));g++);}}}setup(t,i){const{inFolder:n,slots:r}=this;for(let o=0,a=0,c=r.length;!(n[t[o].data.index]&&(t[o]=i[r[a]],++a===c));o++);}};M(rl,"propertyID",`${st.drawOrderFolder}`);let ma=rl;function uO(s){return typeof s=="object"&&s!==null&&typeof s.constraintIndex=="number"}class wS extends bo{constructor(t,i,n){super(t,i,`${st.ikConstraint}|${n}`);M(this,"constraintIndex",0);this.constraintIndex=n}getFrameEntries(){return 6}setFrame(t,i,n,r,o,a,c){t*=6,this.frames[t]=i,this.frames[t+1]=n,this.frames[t+2]=r,this.frames[t+3]=o,this.frames[t+4]=a?1:0,this.frames[t+5]=c?1:0}apply(t,i,n,r,o,a,c,l,h){const u=t.constraints[this.constraintIndex];if(!u.active)return;const d=h?u.appliedPose:u.pose,f=this.frames;if(n<f[0]){const y=u.data.setupPose;switch(a){case Xe.setup:{d.mix=y.mix,d.softness=y.softness,d.bendDirection=y.bendDirection,d.compress=y.compress,d.stretch=y.stretch;break}case Xe.first:{d.mix+=(y.mix-d.mix)*o,d.softness+=(y.softness-d.softness)*o,d.bendDirection=y.bendDirection,d.compress=y.compress,d.stretch=y.stretch;break}}return}let m=0,p=0;const g=Bt.search(f,n,6),x=this.curves[g/6];switch(x){case 0:{const y=f[g];m=f[g+1],p=f[g+2];const S=(n-y)/(f[g+6]-y);m+=(f[g+6+1]-m)*S,p+=(f[g+6+2]-p)*S;break}case 1:m=f[g+1],p=f[g+2];break;default:m=this.getBezierValue(n,g,1,x-2),p=this.getBezierValue(n,g,2,x+18-2)}const v=a===Xe.setup?u.data.setupPose:d;d.mix=v.mix+(m-v.mix)*o,d.softness=v.softness+(p-v.softness)*o,l?a===Xe.setup&&(d.bendDirection=v.bendDirection,d.compress=v.compress,d.stretch=v.stretch):(d.bendDirection=f[g+3],d.compress=f[g+4]!==0,d.stretch=f[g+5]!==0)}}class SS extends bo{constructor(t,i,n){super(t,i,`${st.transformConstraint}|${n}`);M(this,"constraintIndex",0);this.constraintIndex=n,this.additive=!0}getFrameEntries(){return 7}setFrame(t,i,n,r,o,a,c,l){const h=this.frames;t*=7,h[t]=i,h[t+1]=n,h[t+2]=r,h[t+3]=o,h[t+4]=a,h[t+5]=c,h[t+6]=l}apply(t,i,n,r,o,a,c,l,h){const u=t.constraints[this.constraintIndex];if(!u.active)return;const d=h?u.appliedPose:u.pose,f=this.frames;if(n<f[0]){const b=u.data.setupPose;switch(a){case Xe.setup:{d.mixRotate=b.mixRotate,d.mixX=b.mixX,d.mixY=b.mixY,d.mixScaleX=b.mixScaleX,d.mixScaleY=b.mixScaleY,d.mixShearY=b.mixShearY;break}case Xe.first:{d.mixRotate+=(b.mixRotate-d.mixRotate)*o,d.mixX+=(b.mixX-d.mixX)*o,d.mixY+=(b.mixY-d.mixY)*o,d.mixScaleX+=(b.mixScaleX-d.mixScaleX)*o,d.mixScaleY+=(b.mixScaleY-d.mixScaleY)*o,d.mixShearY+=(b.mixShearY-d.mixShearY)*o;break}}return}let m,p,g,x,v,y;const S=Bt.search(f,n,7),C=this.curves[S/7];switch(C){case 0:{const b=f[S];m=f[S+1],p=f[S+2],g=f[S+3],x=f[S+4],v=f[S+5],y=f[S+6];const _=(n-b)/(f[S+7]-b);m+=(f[S+7+1]-m)*_,p+=(f[S+7+2]-p)*_,g+=(f[S+7+3]-g)*_,x+=(f[S+7+4]-x)*_,v+=(f[S+7+5]-v)*_,y+=(f[S+7+6]-y)*_;break}case 1:m=f[S+1],p=f[S+2],g=f[S+3],x=f[S+4],v=f[S+5],y=f[S+6];break;default:m=this.getBezierValue(n,S,1,C-2),p=this.getBezierValue(n,S,2,C+18-2),g=this.getBezierValue(n,S,3,C+36-2),x=this.getBezierValue(n,S,4,C+54-2),v=this.getBezierValue(n,S,5,C+72-2),y=this.getBezierValue(n,S,6,C+90-2)}const w=a===Xe.setup?u.data.setupPose:d;c?(d.mixRotate=w.mixRotate+m*o,d.mixX=w.mixX+p*o,d.mixY=w.mixY+g*o,d.mixScaleX=w.mixScaleX+x*o,d.mixScaleY=w.mixScaleY+v*o,d.mixShearY=w.mixShearY+y*o):(d.mixRotate=w.mixRotate+(m-w.mixRotate)*o,d.mixX=w.mixX+(p-w.mixX)*o,d.mixY=w.mixY+(g-w.mixY)*o,d.mixScaleX=w.mixScaleX+(x-w.mixScaleX)*o,d.mixScaleY=w.mixScaleY+(v-w.mixScaleY)*o,d.mixShearY=w.mixShearY+(y-w.mixShearY)*o)}}class Ll extends Bn{constructor(t,i,n,r){super(t,i,`${r}|${n}`);M(this,"constraintIndex");this.constraintIndex=n}}class MS extends Ll{constructor(e,t,i){super(e,t,i,st.pathConstraintPosition),this.additive=!0}apply(e,t,i,n,r,o,a,c,l){const h=e.constraints[this.constraintIndex];if(h.active){const u=l?h.appliedPose:h.pose;u.position=this.getAbsoluteValue(i,r,o,a,u.position,h.data.setupPose.position)}}}class TS extends Ll{constructor(e,t,i){super(e,t,i,st.pathConstraintSpacing)}apply(e,t,i,n,r,o,a,c,l){const h=e.constraints[this.constraintIndex];if(h.active){const u=l?h.appliedPose:h.pose;u.spacing=this.getAbsoluteValue(i,r,o,!1,u.spacing,h.data.setupPose.spacing)}}}class _S extends bo{constructor(t,i,n){super(t,i,`${st.pathConstraintMix}|${n}`);M(this,"constraintIndex");this.constraintIndex=n}getFrameEntries(){return 4}setFrame(t,i,n,r,o){const a=this.frames;t<<=2,a[t]=i,a[t+1]=n,a[t+2]=r,a[t+3]=o}apply(t,i,n,r,o,a,c,l,h){const u=t.constraints[this.constraintIndex];if(!u.active)return;const d=h?u.appliedPose:u.pose,f=this.frames;if(n<f[0]){const S=u.data.setupPose;switch(a){case Xe.setup:{d.mixRotate=S.mixRotate,d.mixX=S.mixX,d.mixY=S.mixY;break}case Xe.first:{d.mixRotate+=(S.mixRotate-d.mixRotate)*o,d.mixX+=(S.mixX-d.mixX)*o,d.mixY+=(S.mixY-d.mixY)*o;break}}return}let m,p,g;const x=Bt.search(f,n,4),v=this.curves[x>>2];switch(v){case 0:{const S=f[x];m=f[x+1],p=f[x+2],g=f[x+3];const C=(n-S)/(f[x+4]-S);m+=(f[x+4+1]-m)*C,p+=(f[x+4+2]-p)*C,g+=(f[x+4+3]-g)*C;break}case 1:m=f[x+1],p=f[x+2],g=f[x+3];break;default:m=this.getBezierValue(n,x,1,v-2),p=this.getBezierValue(n,x,2,v+18-2),g=this.getBezierValue(n,x,3,v+36-2)}const y=a===Xe.setup?u.data.setupPose:d;c?(d.mixRotate=y.mixRotate+m*o,d.mixX=y.mixX+p*o,d.mixY=y.mixY+g*o):(d.mixRotate=y.mixRotate+(m-y.mixRotate)*o,d.mixX=y.mixX+(p-y.mixX)*o,d.mixY=y.mixY+(g-y.mixY)*o)}}class kr extends Ll{constructor(e,t,i,n){super(e,t,i,n)}apply(e,t,i,n,r,o,a,c,l){if(a&&!this.additive&&(a=!1),this.constraintIndex===-1){const h=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,o,a,this.get(f),this.get(d.data.setupPose),h))}}else{const h=e.constraints[this.constraintIndex];if(h.active){const u=l?h.appliedPose:h.pose;this.set(u,this.getAbsoluteValue(i,r,o,a,this.get(u),this.get(h.data.setupPose)))}}}}class CS extends kr{constructor(e,t,i){super(e,t,i,st.physicsConstraintInertia)}get(e){return e.inertia}set(e,t){e.inertia=t}global(e){return e.inertiaGlobal}}class ES extends kr{constructor(e,t,i){super(e,t,i,st.physicsConstraintStrength)}get(e){return e.strength}set(e,t){e.strength=t}global(e){return e.strengthGlobal}}class AS extends kr{constructor(e,t,i){super(e,t,i,st.physicsConstraintDamping)}get(e){return e.damping}set(e,t){e.damping=t}global(e){return e.dampingGlobal}}class IS extends kr{constructor(e,t,i){super(e,t,i,st.physicsConstraintMass)}get(e){return 1/e.massInverse}set(e,t){e.massInverse=1/t}global(e){return e.massGlobal}}class RS extends kr{constructor(e,t,i){super(e,t,i,st.physicsConstraintWind),this.additive=!0}get(e){return e.wind}set(e,t){e.wind=t}global(e){return e.windGlobal}}class PS extends kr{constructor(e,t,i){super(e,t,i,st.physicsConstraintGravity),this.additive=!0}get(e){return e.gravity}set(e,t){e.gravity=t}global(e){return e.gravityGlobal}}class kS extends kr{constructor(e,t,i){super(e,t,i,st.physicsConstraintMix)}get(e){return e.mix}set(e,t){e.mix=t}global(e){return e.mixGlobal}}const $h=class $h extends Bt{constructor(t,i){super(t,...$h.propertyIds);M(this,"constraintIndex");this.constraintIndex=i,this.instant=!0}getFrameCount(){return this.frames.length}setFrame(t,i){this.frames[t]=i}apply(t,i,n,r,o,a,c,l,h){let u;if(this.constraintIndex!==-1&&(u=t.constraints[this.constraintIndex],!u.active))return;const d=this.frames;if(i>n)this.apply(t,i,Number.MAX_VALUE,[],o,a,!1,!1,!1),i=-1;else if(i>=d[d.length-1])return;if(!(n<d[0])&&(i<d[0]||n>=d[Bt.search(d,i)+1]))if(u!=null)u.reset(t);else for(const f of t.physics)f.active&&f.reset(t)}};M($h,"propertyIds",[st.physicsConstraintReset.toString()]);let Oh=$h;class FS extends Ll{constructor(e,t,i){super(e,t,i,st.sliderTime)}apply(e,t,i,n,r,o,a,c,l){const h=e.constraints[this.constraintIndex];if(h.active){const u=l?h.appliedPose:h.pose;u.time=this.getAbsoluteValue(i,r,o,a,u.time,h.data.setupPose.time)}}}class OS extends Ll{constructor(e,t,i){super(e,t,i,st.sliderMix),this.additive=!0}apply(e,t,i,n,r,o,a,c,l){const h=e.constraints[this.constraintIndex];if(h.active){const u=l?h.appliedPose:h.pose;u.mix=this.getAbsoluteValue(i,r,o,a,u.mix,h.data.setupPose.mix)}}}const ol=class ol{constructor(e){M(this,"data");M(this,"tracks",[]);M(this,"timeScale",1);M(this,"unkeyedState",0);M(this,"events",[]);M(this,"listeners",[]);M(this,"queue",new fO(this));M(this,"propertyIds",new Map);M(this,"animationsChanged",!1);M(this,"trackEntryPool",new rO(()=>new dO));this.data=e}update(e){e*=this.timeScale;const t=this.tracks;for(let i=0,n=t.length;i<n;i++){const r=t[i];if(!r)continue;r.animationLast=r.nextAnimationLast,r.trackLast=r.nextTrackLast;let o=e*r.timeScale;if(r.delay>0){if(r.delay-=o,r.delay>0)continue;o=-r.delay,r.delay=0}let a=r.next;if(a){const c=r.trackLast-a.delay;if(c>=0){for(a.delay=0,a.trackTime+=r.timeScale===0?0:(c/r.timeScale+e)*a.timeScale,r.trackTime+=o,this.setTrack(i,a,!0);a.mixingFrom;)a.mixTime+=e,a=a.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 c=r.mixingFrom;for(r.mixingFrom=null,c&&(c.mixingTo=null);c;)this.queue.end(c),c=c.mixingFrom}r.trackTime+=o}this.queue.drain()}updateMixingFrom(e,t){const i=e.mixingFrom;if(!i)return!0;const n=this.updateMixingFrom(i,t);if(i.animationLast=i.nextAnimationLast,i.trackLast=i.nextTrackLast,e.nextTrackLast!==-1&&e.mixTime>=e.mixDuration){if(i.totalAlpha===0||e.mixDuration===0){if(e.mixingFrom=i.mixingFrom,i.mixingFrom!=null&&(i.mixingFrom.mixingTo=e),i.totalAlpha===0)for(let r=e;r.mixingTo!=null;r=r.mixingTo)r.keepHold=!0;this.queue.end(i)}return n}return i.trackTime+=t*i.timeScale,e.mixTime+=t,!1}apply(e){if(!e)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();const t=this.events,i=this.tracks;let n=!1;for(let a=0,c=i.length;a<c;a++){const l=i[a];if(!l||l.delay>0)continue;n=!0;let h=l.alpha;l.mixingFrom?h*=this.applyMixingFrom(l,e):l.trackTime>=l.trackEnd&&!l.next&&(h=0);let u=l.animationLast,d=l.getAnimationTime(),f=d,m=t;l.reverse&&(f=l.animation.duration-f,m=null);const p=l.animation.timelines,g=p.length;if(a===0&&h===1)for(let x=0;x<g;x++){Ge.webkit602BugfixHelper(h);const v=p[x];v instanceof sl?this.applyAttachmentTimeline(v,e,f,Xe.setup,!0):v.apply(e,u,f,m,h,Xe.setup,!1,!1,!1)}else{const x=l.timelineMode,v=h>=l.alphaAttachmentThreshold,y=l.additive,S=y||l.shortestRotation,C=!S&&l.timelinesRotation.length!==g<<1;C&&(l.timelinesRotation.length=g<<1);for(let w=0;w<g;w++){const b=p[w],_=x[w]&by;!S&&b instanceof kh?this.applyRotateTimeline(b,e,f,h,_,l.timelinesRotation,w<<1,C):b instanceof sl?this.applyAttachmentTimeline(b,e,f,_,v):(Ge.webkit602BugfixHelper(h),b.apply(e,u,f,m,h,_,y,!1,!1))}}l.reverse&&this.eventsReverse(l,u,d),this.queueEvents(l,d),t.length=0,l.nextAnimationLast=d,l.nextTrackLast=l.trackTime}const r=this.unkeyedState+wy,o=e.slots;for(let a=0,c=e.slots.length;a<c;a++){const l=o[a];if(l.attachmentState===r){const h=l.data.attachmentName;l.pose.setAttachment(h?e.getAttachment(l.data.index,h):null)}}return this.unkeyedState+=2,this.queue.drain(),n}applyMixingFrom(e,t){const i=e.mixingFrom,n=i.mixingFrom!==null?this.applyMixingFrom(i,t):1,r=e.mix(),o=i.alpha*n,a=1-r*e.alpha,c=o*(1-r),l=a>0?c/a:o,h=i.animation.timelines,u=h.length,d=i.timelineMode,f=i.timelineHoldMix,m=r<i.mixAttachmentThreshold,p=r<i.mixDrawOrderThreshold,g=i.additive,x=g||i.shortestRotation,v=!x&&i.timelinesRotation.length!==u<<1;v&&(i.timelinesRotation.length=u<<1);const y=i.timelinesRotation;let S=i.animationLast,C=i.getAnimationTime(),w=C,b=null;i.reverse?w=i.animation.duration-w:r<i.eventThreshold&&(b=this.events),i.totalAlpha=0;for(let _=0;_<u;_++){const A=h[_],P=d[_],E=P&by;let R=0;if((P&Cc)!==0){const O=f[_];R=O==null?l:l*(1-O.mix())}else{if(!p&&A instanceof _r&&E===Xe.current)continue;R=c}if(i.totalAlpha+=R,!x&&A instanceof kh)this.applyRotateTimeline(A,t,w,R,E,y,_<<1,v);else if(A instanceof sl)this.applyAttachmentTimeline(A,t,w,E,m&&R>=i.alphaAttachmentThreshold);else{const O=!p||!(A instanceof _r)||E===Xe.current;A.apply(t,S,w,b,R,E,g,O,!1)}}return i.reverse&&r<i.eventThreshold&&this.eventsReverse(i,S,C),e.mixDuration>0&&this.queueEvents(i,C),this.events.length=0,i.nextAnimationLast=C,i.nextTrackLast=i.trackTime,r}applyAttachmentTimeline(e,t,i,n,r){const o=t.slots[e.slotIndex];if(!o.bone.active||!r&&o.attachmentState===this.unkeyedState+Sy)return;let a=i<e.frames[0],c=null;if(a||(c=e.attachmentNames[Bt.search(e.frames,i)],a=!r&&c==null),a){if(n===Xe.current)return;c=o.data.attachmentName}o.pose.setAttachment(c==null?null:t.getAttachment(o.data.index,c)),r?o.attachmentState=this.unkeyedState+Sy:a||(o.attachmentState=this.unkeyedState+wy)}applyRotateTimeline(e,t,i,n,r,o,a,c){if(c&&(o[a]=0),n===1){e.apply(t,0,i,null,1,r,!1,!1,!1);return}const l=t.bones[e.boneIndex];if(!l.active)return;const h=l.pose,u=l.data.setupPose,d=e.frames;let f,m;if(i<d[0]){switch(r){case Xe.setup:{h.rotation=u.rotation;return}case Xe.current:return}f=h.rotation,m=u.rotation}else f=r===Xe.setup?u.rotation:h.rotation,m=u.rotation+e.getCurveValue(i);let p=0,g=m-f;if(g-=Math.ceil(g/360-.5)*360,g===0)p=o[a];else{let x=0,v=0;c?(x=0,v=g):(x=o[a],v=o[a+1]);const y=x-x%360;p=g+y;let S=g>=0,C=x>=0;Math.abs(v)<=90&&Ie.signum(v)!==Ie.signum(g)&&(Math.abs(x-y)>180?(p+=360*Ie.signum(x),C=S):y!==0?p-=360*Ie.signum(x):C=S),C!==S&&(p+=360*Ie.signum(x)),o[a]=p}o[a+1]=g,h.rotation=f+p*n}queueEvents(e,t){const i=e.animationStart,n=e.animationEnd,r=n-i,o=e.reverse;let a=e.trackLast%r;o&&(a=r-a);const c=this.events;let l=0,h=c.length;for(;l<h;l++){const d=c[l];if(d.time<a!==o)break;d.time>=i&&d.time<=n&&this.queue.event(e,d)}let u=!1;if(e.loop)if(r===0)u=!0;else{const d=Math.floor(e.trackTime/r);u=d>0&&d>Math.floor(e.trackLast/r)}else u=t>=n&&e.animationLast<n;for(u&&this.queue.complete(e);l<h;l++){const d=c[l];d.time>=i&&d.time<=n&&this.queue.event(e,d)}}eventsReverse(e,t,i){const n=e.animation.duration,r=n-t,o=n-i,a=e.animation.timelines;for(let c=0,l=e.animation.timelines.length;c<l;c++){const h=a[c];if(!(h instanceof Tl))continue;const u=h.events,d=h.frames,f=d.length;if(r>=o){for(let m=0;m<f;m++)if(!(d[m]<o)){if(d[m]>=r)break;this.events.push(u[m])}}else{for(let p=0;p<f&&!(d[p]>=r);p++)this.events.push(u[p]);let m=0;for(;m<f&&!(d[m]>=o);m++);for(;m<f;m++)this.events.push(u[m])}}}clearTracks(){const e=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let t=0,i=this.tracks.length;t<i;t++)this.clearTrack(t);this.tracks.length=0,this.queue.drainDisabled=e,this.queue.drain()}clearTrack(e){if(e<0)throw new Error("trackIndex must be >= 0.");if(e>=this.tracks.length)return;const t=this.tracks[e];if(!t)return;this.queue.end(t),this.clearNext(t);let i=t;for(;;){const n=i.mixingFrom;if(!n)break;this.queue.end(n),i.mixingFrom=null,i.mixingTo=null,i=n}this.tracks[t.trackIndex]=null,this.queue.drain()}setTrack(e,t,i){const n=this.expandToIndex(e);this.tracks[e]=t,t.previous=null,n&&(n.next=null,i&&this.queue.interrupt(n),t.mixingFrom=n,n.mixingTo=t,t.mixTime=0,n.timelinesRotation.length=0),this.queue.start(t)}setAnimation(e,t,i=!1){return typeof t=="string"?this.setAnimation1(e,t,i):this.setAnimation2(e,t,i)}setAnimation1(e,t,i=!1){const n=this.data.skeletonData.findAnimation(t);if(!n)throw new Error(`Animation not found: ${t}`);return this.setAnimation2(e,n,i)}setAnimation2(e,t,i=!1){if(e<0)throw new Error("trackIndex must be >= 0.");if(!t)throw new Error("animation cannot be null.");let n=!0,r=this.expandToIndex(e);r&&(r.nextTrackLast===-1&&r.animation===t?(this.tracks[e]=r.mixingFrom,this.queue.interrupt(r),this.queue.end(r),this.clearNext(r),r=r.mixingFrom,n=!1):this.clearNext(r));const o=this.trackEntry(e,t,i,r);return this.setTrack(e,o,n),this.queue.drain(),o}addAnimation(e,t,i=!1,n=0){return typeof t=="string"?this.addAnimation1(e,t,i,n):this.addAnimation2(e,t,i,n)}addAnimation1(e,t,i=!1,n=0){const r=this.data.skeletonData.findAnimation(t);if(!r)throw new Error(`Animation not found: ${t}`);return this.addAnimation2(e,r,i,n)}addAnimation2(e,t,i=!1,n=0){if(e<0)throw new Error("trackIndex must be >= 0.");if(!t)throw new Error("animation cannot be null.");let r=this.expandToIndex(e);if(r)for(;r.next;)r=r.next;const o=this.trackEntry(e,t,i,r);return r?(r.next=o,o.previous=r,n<=0&&(n=Math.max(n+r.getTrackComplete()-o.mixDuration,0))):(this.setTrack(e,o,!0),this.queue.drain(),n<0&&(n=0)),o.delay=n,o}setEmptyAnimation(e,t=0){const i=this.setAnimation(e,ol.emptyAnimation,!1);return i.mixDuration=t,i.trackEnd=t,i}addEmptyAnimation(e,t=0,i=0){const n=this.addAnimation(e,ol.emptyAnimation,!1,i);return i<=0&&(n.delay=Math.max(n.delay+n.mixDuration-t,0)),n.mixDuration=t,n.trackEnd=t,n}setEmptyAnimations(e=0){const t=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let i=0,n=this.tracks.length;i<n;i++){const r=this.tracks[i];r&&this.setEmptyAnimation(r.trackIndex,e)}this.queue.drainDisabled=t,this.queue.drain()}expandToIndex(e){return e<this.tracks.length?this.tracks[e]:(Ge.ensureArrayCapacity(this.tracks,e+1,null),this.tracks.length=e+1,null)}trackEntry(e,t,i,n){const r=this.trackEntryPool.obtain();return r.reset(),r.trackIndex=e,r.animation=t,r.loop=i,r.additive=!1,r.reverse=!1,r.shortestRotation=!1,r.eventThreshold=0,r.alphaAttachmentThreshold=0,r.mixAttachmentThreshold=0,r.mixDrawOrderThreshold=0,r.animationStart=0,r.animationEnd=t.duration,r.animationLast=-1,r.nextAnimationLast=-1,r.delay=0,r.trackTime=0,r.trackLast=-1,r.nextTrackLast=-1,r.trackEnd=Number.MAX_VALUE,r.timeScale=1,r.alpha=1,r.mixTime=0,r.mixDuration=n?this.data.getMix(n.animation,t):0,r.totalAlpha=0,r.keepHold=!1,r}clearNext(e){let t=e.next;for(;t;)this.queue.dispose(t),t=t.next;e.next=null}_animationsChanged(){this.animationsChanged=!1;const e=this.tracks;for(let t=0,i=e.length;t<i;t++){const n=e[t];if(!n)continue;let r=n;for(;r.mixingFrom;)r=r.mixingFrom;do this.computeHold(r,n),r=r.mixingTo;while(r)}this.propertyIds.clear()}computeHold(e,t){var h,u;const i=e.animation.timelines,n=e.animation.timelines.length,r=e.timelineMode;r.length=n;const o=e.timelineHoldMix;o.length=0;const a=e.additive,c=e.keepHold,l=e.mixingTo;for(let d=0;d<n;d++){const f=i[d],m=f.propertyIds,p=this.from(t,f,m);if(a&&f.additive){r[d]=p;continue}let g;if(l===null||f.instant||l.additive&&f.additive||!((h=l.animation)!=null&&h.hasTimeline(m)))g=p;else{g=p|Cc;for(let x=l.mixingTo;x!=null;x=x.mixingTo)if(x.additive&&f.additive||!((u=x.animation)!=null&&u.hasTimeline(m))){x.mixDuration>0&&(o[d]=x);break}}c&&(g=g&~Cc|r[d]&Cc),r[d]=g}}from(e,t,i){const n=this.propertyIds;let r=mO;for(let o=0,a=i.length;o<a;o++){const c=n.get(i[o]);if(c===void 0)n.set(i[o],e);else{if(c!==e){for(;++o<a;)n.has(i[o])||n.set(i[o],e);return yy}r=xy}}if(t instanceof ma){const o=n.get(_r.propertyID);if(o!=null)return o!==e?yy:xy}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()}};M(ol,"emptyAnimation",new Lp("<empty>",[],0));let vy=ol;class dO{constructor(){M(this,"animation",null);M(this,"previous",null);M(this,"next",null);M(this,"mixingFrom",null);M(this,"mixingTo",null);M(this,"listener",null);M(this,"trackIndex",0);M(this,"loop",!1);M(this,"additive",!1);M(this,"reverse",!1);M(this,"shortestRotation",!1);M(this,"keepHold",!1);M(this,"eventThreshold",0);M(this,"mixAttachmentThreshold",0);M(this,"alphaAttachmentThreshold",0);M(this,"mixDrawOrderThreshold",0);M(this,"animationStart",0);M(this,"animationEnd",0);M(this,"animationLast",0);M(this,"nextAnimationLast",0);M(this,"delay",0);M(this,"trackTime",0);M(this,"trackLast",0);M(this,"nextTrackLast",0);M(this,"trackEnd",0);M(this,"timeScale",0);M(this,"alpha",0);M(this,"mixTime",0);M(this,"mixDuration",0);M(this,"totalAlpha",0);M(this,"mixInterpolation",oa.linear);M(this,"timelineMode",[]);M(this,"timelineHoldMix",[]);M(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===oa.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=oa.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 fO{constructor(e){M(this,"objects",[]);M(this,"drainDisabled",!1);M(this,"animState");this.animState=e}start(e){this.objects.push(zi.start),this.objects.push(e),this.animState.animationsChanged=!0}interrupt(e){this.objects.push(zi.interrupt),this.objects.push(e)}end(e){this.objects.push(zi.end),this.objects.push(e),this.animState.animationsChanged=!0}dispose(e){this.objects.push(zi.dispose),this.objects.push(e)}complete(e){this.objects.push(zi.complete),this.objects.push(e)}event(e,t){this.objects.push(zi.event),this.objects.push(e),this.objects.push(t)}drain(){var e,t,i,n,r,o;if(!this.drainDisabled){this.drainDisabled=!0;for(let a=0;a<this.objects.length;a+=2){const c=this.objects,l=c[a],h=c[a+1],u=this.animState.listeners.slice();switch(l){case zi.start:(e=h.listener)!=null&&e.start&&h.listener.start(h);for(let d=0;d<u.length;d++){const f=u[d];f.start&&f.start(h)}break;case zi.interrupt:(t=h.listener)!=null&&t.interrupt&&h.listener.interrupt(h);for(let d=0;d<u.length;d++){const f=u[d];f.interrupt&&f.interrupt(h)}break;case zi.end:(i=h.listener)!=null&&i.end&&h.listener.end(h);for(let d=0;d<u.length;d++){const f=u[d];f.end&&f.end(h)}case zi.dispose:(n=h.listener)!=null&&n.dispose&&h.listener.dispose(h);for(let d=0;d<u.length;d++){const f=u[d];f.dispose&&f.dispose(h)}this.animState.trackEntryPool.free(h);break;case zi.complete:(r=h.listener)!=null&&r.complete&&h.listener.complete(h);for(let d=0;d<u.length;d++){const f=u[d];f.complete&&f.complete(h)}break;case zi.event:{const d=c[a+++2];(o=h.listener)!=null&&o.event&&h.listener.event(h,d);for(let f=0;f<u.length;f++){const m=u[f];m.event&&m.event(h,d)}break}}}this.clear(),this.drainDisabled=!1}}clear(){this.objects.length=0}}var zi;(function(s){s[s.start=0]="start",s[s.interrupt=1]="interrupt",s[s.end=2]="end",s[s.dispose=3]="dispose",s[s.complete=4]="complete",s[s.event=5]="event"})(zi||(zi={}));class OV{start(e){}interrupt(e){}end(e){}dispose(e){}complete(e){}event(e,t){}}const yy=0,mO=1,xy=2,by=3,Cc=4,wy=1,Sy=2;class Np extends qn{constructor(t){super(t);M(this,"color",new nt(1,1,1,1))}copy(){const t=new Np(this.name);return this.copyTo(t),t.color.setFromColor(this.color),t}}class bu extends qn{constructor(t){super(t);M(this,"endSlot",null);M(this,"convex",!1);M(this,"inverse",!1);M(this,"color",new nt(.2275,.2275,.8078,1))}copy(){const t=new bu(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 _l extends qn{constructor(t){super(t);M(this,"lengths",[]);M(this,"closed",!1);M(this,"constantSpeed",!1);M(this,"color",new nt(1,1,1,1))}copy(){const t=new _l(this.name);return this.copyTo(t),t.lengths=[],Ge.arrayCopy(this.lengths,0,t.lengths,0,this.lengths.length),t.closed=this.closed,t.constantSpeed=this.constantSpeed,t.color.setFromColor(this.color),t}}class Dp extends qn{constructor(t){super(t);M(this,"x",0);M(this,"y",0);M(this,"rotation",0);M(this,"color",new nt(.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*Ie.degRad,n=Math.cos(i),r=Math.sin(i),o=n*t.a+r*t.b,a=n*t.c+r*t.d;return Ie.atan2Deg(a,o)}copy(){const t=new Dp(this.name);return t.x=this.x,t.y=this.y,t.rotation=this.rotation,t.color.setFromColor(this.color),t}}class Up{constructor(e,t){M(this,"name");M(this,"setupPose");M(this,"skinRequired",!1);if(e==null)throw new Error("name cannot be null.");this.name=e,this.setupPose=t}}class wu extends Up{constructor(t,i,n){super(i,new Pm);M(this,"index",0);M(this,"parent",null);M(this,"length",0);M(this,"color",new nt);M(this,"icon");M(this,"iconSize",1);M(this,"iconRotation",0);M(this,"visible",!1);if(t<0)throw new Error("index must be >= 0.");if(!i)throw new Error("name cannot be null.");this.index=t,this.parent=n}copy(t){const i=new wu(this.index,this.name,t);return i.length=this.length,i.setupPose.set(this.setupPose),i}}var zt;(function(s){s[s.Normal=0]="Normal",s[s.OnlyTranslation=1]="OnlyTranslation",s[s.NoRotationOrReflection=2]="NoRotationOrReflection",s[s.NoScale=3]="NoScale",s[s.NoScaleOrReflection=4]="NoScaleOrReflection"})(zt||(zt={}));class Pm{constructor(){M(this,"bone");M(this,"x",0);M(this,"y",0);M(this,"rotation",0);M(this,"scaleX",0);M(this,"scaleY",0);M(this,"shearX",0);M(this,"shearY",0);M(this,"inherit",zt.Normal);M(this,"a",0);M(this,"b",0);M(this,"c",0);M(this,"d",0);M(this,"worldY",0);M(this,"worldX",0);M(this,"world",0);M(this,"local",0)}set(e){if(e==null)throw new Error("pose cannot be null.");this.x=e.x,this.y=e.y,this.rotation=e.rotation,this.scaleX=e.scaleX,this.scaleY=e.scaleY,this.shearX=e.shearX,this.shearY=e.shearY,this.inherit=e.inherit}setPosition(e,t){this.x=e,this.y=t}setScale(e,t){this.scaleX=e,this.scaleY=t===void 0?e:t}getInherit(){return this.inherit}setInherit(e){if(e==null)throw new Error("inherit cannot be null.");this.inherit=e}update(e,t){this.world!==e._update&&this.updateWorldTransform(e)}updateWorldTransform(e){this.local===e._update?this.updateLocalTransform(e):this.world=e._update;const t=this.rotation,i=this.scaleX,n=this.scaleY,r=this.shearX,o=this.shearY;if(!this.bone.parent){const d=e.scaleX,f=e.scaleY,m=(t+r)*Ie.degRad,p=(t+90+o)*Ie.degRad;this.a=Math.cos(m)*i*d,this.b=Math.cos(p)*n*d,this.c=Math.sin(m)*i*f,this.d=Math.sin(p)*n*f,this.worldX=this.x*d+e.x,this.worldY=this.y*f+e.y;return}const a=this.bone.parent.appliedPose;let c=a.a,l=a.b,h=a.c,u=a.d;switch(this.worldX=c*this.x+l*this.y+a.worldX,this.worldY=h*this.x+u*this.y+a.worldY,this.inherit){case zt.Normal:{const d=(t+r)*Ie.degRad,f=(t+90+o)*Ie.degRad,m=Math.cos(d)*i,p=Math.cos(f)*n,g=Math.sin(d)*i,x=Math.sin(f)*n;this.a=c*m+l*g,this.b=c*p+l*x,this.c=h*m+u*g,this.d=h*p+u*x;return}case zt.OnlyTranslation:{const d=e.scaleX,f=e.scaleY,m=(t+r)*Ie.degRad,p=(t+90+o)*Ie.degRad;this.a=Math.cos(m)*i*d,this.b=Math.cos(p)*n*d,this.c=Math.sin(m)*i*f,this.d=Math.sin(p)*n*f;break}case zt.NoRotationOrReflection:{const d=e.scaleX,f=e.scaleY,m=1/d,p=1/f;c*=m,h*=p;let g=c*c+h*h,x=0;g>Ie.epsilon2?(g=Math.abs(c*u*p-l*m*h)/g,l=h*g,u=c*g,x=t-Ie.atan2Deg(h,c)):(c=0,h=0,x=t-90+Ie.atan2Deg(u,l));const v=(x+r)*Ie.degRad,y=(x+o+90)*Ie.degRad,S=Math.cos(v)*i,C=Math.cos(y)*n,w=Math.sin(v)*i,b=Math.sin(y)*n;this.a=(c*S-l*w)*d,this.b=(c*C-l*b)*d,this.c=(h*S+u*w)*f,this.d=(h*C+u*b)*f;break}case zt.NoScale:case zt.NoScaleOrReflection:{const d=e.scaleX,f=e.scaleY,m=1/d,p=1/f,g=t*Ie.degRad,x=Math.cos(g),v=Math.sin(g);let y=(c*x+l*v)*m,S=(h*x+u*v)*p;const C=1/Math.sqrt(y*y+S*S);y*=C,S*=C;let w=-S,b=y;this.inherit===zt.NoScale&&c*u-l*h<0!=(d<0!=f<0)&&(w=-w,b=-b);const _=r*Ie.degRad,A=(90+o)*Ie.degRad,P=Math.cos(_)*i,E=Math.cos(A)*n,R=Math.sin(_)*i,O=Math.sin(A)*n;this.a=(y*P+w*R)*d,this.b=(y*E+w*O)*d,this.c=(S*P+b*R)*f,this.d=(S*E+b*O)*f;break}}}updateLocalTransform(e){this.local=0,this.world=e._update;const t=e.scaleX,i=e.scaleY;if(!this.bone.parent){const x=1/t,v=1/i;this.x=(this.worldX-e.x)*x,this.y=(this.worldY-e.y)*v,this.set5(this.a*x,this.b*x,this.c*v,this.d*v,0);return}const n=this.bone.parent.appliedPose;let r=n.a,o=n.b,a=n.c,c=n.d;const l=r*c-o*a,h=1/(r*c-o*a),u=c*h,d=o*h,f=a*h,m=r*h,p=this.worldX-n.worldX,g=this.worldY-n.worldY;switch(this.x=p*u-g*d,this.y=g*m-p*f,this.inherit){case zt.Normal:this.set5(u*this.a-d*this.c,u*this.b-d*this.d,m*this.c-f*this.a,m*this.d-f*this.b,0);break;case zt.OnlyTranslation:{const x=1/t,v=1/i;this.set5(this.a*x,this.b*x,this.c*v,this.d*v,0);break}case zt.NoRotationOrReflection:{const x=1/t,v=1/i;r*=x,a*=v;const y=this.a*x,S=this.b*x,C=this.c*v,w=this.d*v,b=1/(r*r+a*a),_=1/Math.abs(l*x*v);this.set5((r*y+a*C)*b,(r*S+a*w)*b,(r*C-a*y)*_,(r*w-a*S)*_,Ie.atan2Deg(a,r));break}case zt.NoScale:case zt.NoScaleOrReflection:{const x=1/t,v=1/i,y=this.a*x,S=this.b*x,C=this.c*v,w=this.d*v;let b=c*this.a-o*this.c,_=r*this.c-a*this.a;l<0&&(b=-b,_=-_);let A=Ie.atan2Deg(_,b);this.rotation=A,A*=Ie.degRad;const P=Math.cos(A),E=Math.sin(A);let R=(r*P+o*E)*x,O=(a*P+c*E)*v;const U=1/Math.sqrt(R*R+O*O);R*=U,O*=U;const Y=this.inherit===zt.NoScale&&l<0!=(t<0!=i<0)?-1:1;this.set4(R*y+O*C,R*S+O*w,(R*C-O*y)*Y,(R*w-O*S)*Y)}}}set4(e,t,i,n){const r=e*e+i*i,o=t*t+n*n;r>Ie.epsilon2?(this.shearX=Ie.atan2Deg(i,e),this.scaleX=Math.sqrt(r)):(this.shearX=0,this.scaleX=0),this.scaleY=Math.sqrt(o),o>Ie.epsilon2?(this.shearY=Ie.atan2Deg(n,t),e*n-t*i<0?(this.scaleY=-this.scaleY,this.shearY+=90):this.shearY-=90,this.shearY>180?this.shearY-=360:this.shearY<=-180&&(this.shearY+=360)):this.shearY=0}set5(e,t,i,n,r){this.shearX=0;const o=e*e+i*i,a=t*t+n*n;if(o>Ie.epsilon2){const c=Ie.atan2Deg(i,e);this.rotation=c+r,this.scaleX=Math.sqrt(o),this.scaleY=Math.sqrt(a),a>Ie.epsilon2?(this.shearY=Ie.atan2Deg(n,t),e*n-t*i<0?(this.scaleY=-this.scaleY,this.shearY+=90-c):this.shearY-=90+c,this.shearY>180?this.shearY-=360:this.shearY<=-180&&(this.shearY+=360)):this.shearY=0}else this.scaleX=0,this.scaleY=Math.sqrt(a),this.shearY=0,this.rotation=a>Ie.epsilon2?Ie.atan2Deg(n,t)-90+r:r}validateLocalTransform(e){this.local===e._update&&this.updateLocalTransform(e)}modifyLocal(e){this.local===e._update&&this.updateLocalTransform(e),this.world=0,this.resetWorld(e,e._update)}modifyWorld(e){const t=e._update;this.local=t,this.world=t,this.resetWorld(e,t)}resetWorld(e,t){const i=this.bone.children;for(let n=0,r=i.length;n<r;n++){const o=i[n].appliedPose;o.world===t&&(o.local===t&&o.updateLocalTransform(e),o.world=0,o.resetWorld(e,t))}}getWorldRotationX(){return Ie.atan2Deg(this.c,this.a)}getWorldRotationY(){return Ie.atan2Deg(this.d,this.b)}getWorldScaleX(){return Math.sqrt(this.a*this.a+this.c*this.c)}getWorldScaleY(){return Math.sqrt(this.b*this.b+this.d*this.d)}worldToLocal(e){if(e==null)throw new Error("world cannot be null.");const t=this.a*this.d-this.b*this.c,i=e.x-this.worldX,n=e.y-this.worldY;return e.x=(i*this.d-n*this.b)/t,e.y=(n*this.a-i*this.c)/t,e}localToWorld(e){if(e==null)throw new Error("local cannot be null.");const t=e.x,i=e.y;return e.x=t*this.a+i*this.b+this.worldX,e.y=t*this.c+i*this.d+this.worldY,e}worldToParent(e){if(e==null)throw new Error("world cannot be null.");return this.bone.parent==null?e:this.bone.parent.appliedPose.worldToLocal(e)}parentToWorld(e){if(e==null)throw new Error("world cannot be null.");return this.bone.parent==null?e:this.bone.parent.appliedPose.localToWorld(e)}worldToLocalRotation(e){e*=Ie.degRad;const t=Math.sin(e),i=Math.cos(e);return Ie.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)*Ie.degRad;const t=Math.sin(e),i=Math.cos(e);return Ie.atan2Deg(i*this.c+t*this.d,i*this.a+t*this.b)}rotateWorld(e){e*=Ie.degRad;const t=Math.sin(e),i=Math.cos(e),n=this.a,r=this.b;this.a=i*n-t*this.c,this.b=i*r-t*this.d,this.c=t*n+i*this.c,this.d=t*r+i*this.d}}class LS{constructor(e,t,i){M(this,"data");M(this,"pose");M(this,"constrainedPose");M(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 BS extends LS{constructor(t,i,n){super(t,i,n);M(this,"active",!1);this.setupPose()}isActive(){return this.active}}class nl extends BS{constructor(t,i){super(t,new Pm,new Pm);M(this,"parent",null);M(this,"children",[]);M(this,"sorted",!1);this.parent=i,this.appliedPose.bone=this,this.constrainedPose.bone=this}copy(t){const i=new nl(this.data,t);return i.pose.set(this.pose),i}}class Bl extends BS{constructor(e,t,i){super(e,t,i)}isSourceActive(){return!0}}class pO{constructor(e){M(this,"_setupPose");M(this,"pose");M(this,"constrainedPose");M(this,"appliedPose");this._setupPose=e,this.pose=[...e],this.constrainedPose=[],this.appliedPose=this.pose}setupPose(){this.pose.length=this._setupPose.length,Ge.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,Ge.arrayCopy(this.pose,0,this.constrainedPose,0,this.pose.length)}}class Nl extends Up{constructor(e,t){super(e,t)}}var Xi;(function(s){s[s.None=0]="None",s[s.Uniform=1]="Uniform",s[s.Volume=2]="Volume"})(Xi||(Xi={}));let $p=class{constructor(e,t){M(this,"time",0);M(this,"data");M(this,"intValue",0);M(this,"floatValue",0);M(this,"stringValue",null);M(this,"volume",0);M(this,"balance",0);if(!t)throw new Error("data cannot be null.");this.time=e,this.data=t}};class NS{constructor(e){M(this,"name");M(this,"_audioPath",null);M(this,"setupPose",new $p(-1,this));this.name=e}get audioPath(){return this._audioPath}set audioPath(e){if(e==null)throw new Error("audioPath cannot be null.");this._audioPath=e}}class km{constructor(){M(this,"bendDirection",0);M(this,"compress",!1);M(this,"stretch",!1);M(this,"mix",0);M(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 ur extends Bl{constructor(t,i){super(t,new km,new km);M(this,"bones");M(this,"target");if(!i)throw new Error("skeleton cannot be null.");this.bones=[];for(const n of t.bones)this.bones.push(i.bones[n.index].constrainedPose);this.target=i.bones[t.target.index]}copy(t){var i=new ur(this.data,t);return i.pose.set(this.pose),i}update(t,i){const n=this.appliedPose;if(n.mix===0)return;const r=this.target.appliedPose,o=this.bones;switch(o.length){case 1:ur.apply(t,o[0],r.worldX,r.worldY,n.compress,n.stretch,this.data.scaleYMode,n.mix);break;case 2:ur.apply(t,o[0],o[1],r.worldX,r.worldY,n.bendDirection,n.stretch,this.data.scaleYMode,n.softness,n.mix);break}}sort(t){t.sortBone(this.target);const i=this.bones[0].bone;t.sortBone(i),t._updateCache.push(this),i.sorted=!1,t.sortReset(i.children),t.constrained(i),this.bones.length>1&&t.constrained(this.bones[1].bone)}isSourceActive(){return this.target.active}static apply(t,i,n,r,o,a,c,l,h,u){typeof n=="number"?ur.apply1(t,i,n,r,o,a,c,l):ur.apply2(t,i,n,r,o,a,c,l,h,u)}static apply1(t,i,n,r,o,a,c,l){i.modifyLocal(t);const h=i.bone.parent.appliedPose;let u=h.a,d=h.b,f=h.c,m=h.d,p=-i.shearX-i.rotation,g=0,x=0;switch(i.inherit){case zt.OnlyTranslation:g=(n-i.worldX)*Ie.signum(t.scaleX),x=(r-i.worldY)*Ie.signum(t.scaleY);break;case zt.NoRotationOrReflection:{const v=Math.abs(u*m-d*f)/Math.max(Ie.epsilon,u*u+f*f),y=u/t.scaleX,S=f/t.scaleY;d=-S*v*t.scaleX,m=y*v*t.scaleY,p+=Ie.atan2Deg(S,y)}default:{const v=n-h.worldX,y=r-h.worldY,S=u*m-d*f;Math.abs(S)<=Ie.epsilon?(g=0,x=0):(g=(v*m-y*d)/S-i.x,x=(y*u-v*f)/S-i.y)}}if(p+=Ie.atan2Deg(x,g),i.scaleX<0&&(p+=180),p>180?p-=360:p<=-180&&(p+=360),i.rotation+=p*l,o||a){switch(i.inherit){case zt.NoScale:case zt.NoScaleOrReflection:g=n-i.worldX,x=r-i.worldY}const v=i.bone.data.length*i.scaleX;if(v>Ie.epsilon){const y=g*g+x*x;if(o&&y<v*v||a&&y>v*v){const S=(Math.sqrt(y)/v-1)*l+1;switch(i.scaleX*=S,c){case Xi.Uniform:i.scaleY*=S;break;case Xi.Volume:i.scaleY/=S<.7?.25+.642857*S:S}}}}}static apply2(t,i,n,r,o,a,c,l,h,u){if(i.inherit!==zt.Normal||n.inherit!==zt.Normal)return;i.modifyLocal(t),n.modifyLocal(t);let d=i.x,f=i.y,m=i.scaleX,p=i.scaleY,g=n.scaleX,x=0,v=0,y=0;m<0?(m=-m,x=180,y=-1):(x=0,y=1),p<0&&(p=-p,y=-y),g<0?(g=-g,v=180):v=0;let S=0,C=0,w=i.a,b=i.b,_=i.c,A=i.d;const P=Math.abs(m-p)<=Ie.epsilon;!P||c?(n.y=0,S=w*n.x+i.worldX,C=_*n.x+i.worldY):(S=w*n.x+b*n.y+i.worldX,C=_*n.x+A*n.y+i.worldY);const E=i.bone.parent.appliedPose;w=E.a,b=E.b,_=E.c,A=E.d;let R=w*A-b*_,O=S-E.worldX,U=C-E.worldY;R=Math.abs(R)<=Ie.epsilon?0:1/R;const Y=(O*A-U*b)*R-d,$=(U*w-O*_)*R-f;let X=Math.sqrt(Y*Y+$*$),D=n.bone.data.length*g,F,N;if(X<Ie.epsilon){ur.apply(t,i,r,o,!1,c,Xi.None,u),n.rotation=0;return}O=r-E.worldX,U=o-E.worldY;let k=(O*A-U*b)*R-d,V=(U*w-O*_)*R-f,G=k*k+V*V;if(h!==0){h*=m*(g+1)*.5;const Z=Math.sqrt(G),ne=Z-X-D*m+h;if(ne>0){let oe=Math.min(1,ne/(h*2))-1;oe=(ne-h*(1-oe*oe))/Z,k-=oe*k,V-=oe*V,G=k*k+V*V}}e:if(P){D*=m;let Z=(G-X*X-D*D)/(2*X*D);if(Z<-1)Z=-1,N=Math.PI*a;else if(Z>1){if(Z=1,N=0,c)switch(w=(Math.sqrt(G)/(X+D)-1)*u+1,i.scaleX*=w,l){case Xi.Uniform:i.scaleY*=w;break;case Xi.Volume:i.scaleY/=w<.7?.25+.642857*w:w}}else N=Math.acos(Z)*a;w=X+D*Z,b=D*Math.sin(N),F=Math.atan2(V*w-k*b,k*w+V*b)}else{w=m*D,b=p*D;const Z=w*w,ne=b*b,oe=Math.atan2(V,k);_=ne*X*X+Z*G-Z*ne;const de=-2*ne*X,pe=ne-Z;if(A=de*de-4*pe*_,A>=0){let ie=Math.sqrt(A);de<0&&(ie=-ie),ie=-(de+ie)*.5;let ue=ie/pe,fe=_/ie;const ee=Math.abs(ue)<Math.abs(fe)?ue:fe;if(ue=G-ee*ee,ue>=0){U=Math.sqrt(ue)*a,F=oe-Math.atan2(U,ee),N=Math.atan2(U/p,(ee-X)/m);break e}}let he=Ie.PI,me=X-w,H=me*me,z=0,K=0,B=X+w,L=B*B,j=0;_=-w*X/(Z-ne),_>=-1&&_<=1&&(_=Math.acos(_),O=w*Math.cos(_)+X,U=b*Math.sin(_),A=O*O+U*U,A<H&&(he=_,H=A,me=O,z=U),A>L&&(K=_,L=A,B=O,j=U)),G<=(H+L)*.5?(F=oe-Math.atan2(z*a,me),N=he*a):(F=oe-Math.atan2(j*a,B),N=K*a)}const W=Math.atan2(n.y,n.x)*y;F=(F-W)*Ie.radDeg+x-i.rotation,F>180?F-=360:F<=-180&&(F+=360),i.rotation+=F*u,N=((N+W)*Ie.radDeg-n.shearX)*y+v-n.rotation,N>180?N-=360:N<=-180&&(N+=360),n.rotation+=N*u}}class Xc extends Nl{constructor(t){super(t,new km);M(this,"bones",[]);M(this,"_target",null);M(this,"_scaleYMode",Xi.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 ur(this,t)}}class Fm{constructor(){M(this,"position",0);M(this,"spacing",0);M(this,"mixRotate",0);M(this,"mixX",0);M(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 Vc extends Nl{constructor(t){super(t,new Fm);M(this,"bones",[]);M(this,"_slot",null);M(this,"positionMode",dn.Fixed);M(this,"spacingMode",mi.Fixed);M(this,"rotateMode",co.Chain);M(this,"offsetRotation",0)}set slot(t){this._slot=t}get slot(){if(this._slot)return this._slot;throw new Error("SlotData not set.")}create(t){return new Om(this,t)}}var dn;(function(s){s[s.Fixed=0]="Fixed",s[s.Percent=1]="Percent"})(dn||(dn={}));var mi;(function(s){s[s.Length=0]="Length",s[s.Fixed=1]="Fixed",s[s.Percent=2]="Percent",s[s.Proportional=3]="Proportional"})(mi||(mi={}));var co;(function(s){s[s.Tangent=0]="Tangent",s[s.Chain=1]="Chain",s[s.ChainScale=2]="ChainScale"})(co||(co={}));const Es=class Es extends Bl{constructor(t,i){super(t,new Fm,new Fm);M(this,"data");M(this,"bones");M(this,"slot");M(this,"spaces",[]);M(this,"positions",[]);M(this,"world",[]);M(this,"curves",[]);M(this,"lengths",[]);M(this,"segments",[]);if(!i)throw new Error("skeleton cannot be null.");this.data=t,this.bones=[];for(const n of this.data.bones)this.bones.push(i.bones[n.index].constrainedPose);this.slot=i.slots[t.slot.index]}copy(t){var i=new Es(this.data,t);return i.pose.set(this.pose),i}update(t,i){const n=this.slot.appliedPose.attachment;if(!(n instanceof _l))return;const r=this.appliedPose,o=r.mixRotate,a=r.mixX,c=r.mixY;if(o===0&&a===0&&c===0)return;const l=this.data,h=l.rotateMode===co.Tangent,u=l.rotateMode===co.ChainScale,d=this.bones,f=d.length,m=h?f:f+1,p=Ge.setArraySize(this.spaces,m),g=u?this.lengths=Ge.setArraySize(this.lengths,f):[],x=r.spacing;switch(l.spacingMode){case mi.Percent:if(u)for(let b=0,_=m-1;b<_;b++){const A=d[b],P=A.bone.data.length,E=P*A.a,R=P*A.c;g[b]=Math.sqrt(E*E+R*R)}Ge.arrayFill(p,1,m,x);break;case mi.Proportional:{let b=0;for(let _=0,A=m-1;_<A;){const P=d[_],E=P.bone.data.length;if(E<Ie.epsilon)u&&(g[_]=0),p[++_]=x;else{const R=E*P.a,O=E*P.c,U=Math.sqrt(R*R+O*O);u&&(g[_]=U),p[++_]=U,b+=U}}if(b>0){b=m/b*x;for(let _=1;_<m;_++)p[_]*=b}break}default:{const b=l.spacingMode===mi.Length;for(let _=0,A=m-1;_<A;){const P=d[_],E=P.bone.data.length;if(E<Ie.epsilon)u&&(g[_]=0),p[++_]=x;else{const R=E*P.a,O=E*P.c,U=Math.sqrt(R*R+O*O);u&&(g[_]=U),p[++_]=(b?Math.max(0,E+x):x)*U/E}}}}const v=this.computeWorldPositions(t,n,m,h);let y=v[0],S=v[1],C=l.offsetRotation,w=!1;if(C===0)w=l.rotateMode===co.Chain;else{w=!1;const b=this.slot.bone.appliedPose;C*=b.a*b.d-b.b*b.c>0?Ie.degRad:-Ie.degRad}for(let b=0,_=3;b<f;b++,_+=3){const A=d[b];A.modifyWorld(t),A.worldX+=(y-A.worldX)*a,A.worldY+=(S-A.worldY)*c;const P=v[_],E=v[_+1],R=P-y,O=E-S;if(u){const U=g[b];if(U!==0){const Y=(Math.sqrt(R*R+O*O)/U-1)*o+1;A.a*=Y,A.c*=Y}}if(y=P,S=E,o>0){let U=A.a,Y=A.b,$=A.c,X=A.d,D=0,F=0,N=0;if(h?D=v[_-1]:p[b+1]===0?D=v[_+2]:D=Math.atan2(O,R),D-=Math.atan2($,U),w){F=Math.cos(D),N=Math.sin(D);const k=A.bone.data.length;y+=(k*(F*U-N*$)-R)*o,S+=(k*(N*U+F*$)-O)*o}else D+=C;D>Ie.PI?D-=Ie.PI2:D<-Ie.PI&&(D+=Ie.PI2),D*=o,F=Math.cos(D),N=Math.sin(D),A.a=F*U-N*$,A.b=F*Y-N*X,A.c=N*U+F*$,A.d=N*Y+F*X}}}computeWorldPositions(t,i,n,r){const o=this.slot;let a=this.appliedPose.position,c=this.spaces,l=Ge.setArraySize(this.positions,n*3+2),h=this.world;const u=i.closed;let d=i.worldVerticesLength,f=d/6,m=Es.NONE;if(!i.constantSpeed){const N=i.lengths;f-=u?1:2;const k=N[f];this.data.positionMode===dn.Percent&&(a*=k);let V;switch(this.data.spacingMode){case mi.Percent:V=k;break;case mi.Proportional:V=k/n;break;default:V=1}h=Ge.setArraySize(this.world,8);for(let G=0,W=0,Z=0;G<n;G++,W+=3){const ne=c[G]*V;a+=ne;let oe=a;if(u)oe%=k,oe<0&&(oe+=k),Z=0;else if(oe<0){m!==Es.BEFORE&&(m=Es.BEFORE,i.computeWorldVertices(t,o,2,4,h,0,2)),this.addBeforePosition(oe,h,0,l,W);continue}else if(oe>k){m!==Es.AFTER&&(m=Es.AFTER,i.computeWorldVertices(t,o,d-6,4,h,0,2)),this.addAfterPosition(oe-k,h,0,l,W);continue}for(;;Z++){const de=N[Z];if(!(oe>de)){if(Z===0)oe/=de;else{const pe=N[Z-1];oe=(oe-pe)/(de-pe)}break}}Z!==m&&(m=Z,u&&Z===f?(i.computeWorldVertices(t,o,d-4,4,h,0,2),i.computeWorldVertices(t,o,0,4,h,4,2)):i.computeWorldVertices(t,o,Z*6+2,8,h,0,2)),this.addCurvePosition(oe,h[0],h[1],h[2],h[3],h[4],h[5],h[6],h[7],l,W,r||G>0&&ne===0)}return l}u?(d+=2,h=Ge.setArraySize(this.world,d),i.computeWorldVertices(t,o,2,d-4,h,0,2),i.computeWorldVertices(t,o,0,2,h,d-4,2),h[d-2]=h[0],h[d-1]=h[1]):(f--,d-=4,h=Ge.setArraySize(this.world,d),i.computeWorldVertices(t,o,2,d,h,0,2));const p=Ge.setArraySize(this.curves,f);let g=0,x=h[0],v=h[1],y=0,S=0,C=0,w=0,b=0,_=0,A=0,P=0,E=0,R=0,O=0,U=0,Y=0,$=0;for(let N=0,k=2;N<f;N++,k+=6)y=h[k],S=h[k+1],C=h[k+2],w=h[k+3],b=h[k+4],_=h[k+5],A=(x-y*2+C)*.1875,P=(v-S*2+w)*.1875,E=((y-C)*3-x+b)*.09375,R=((S-w)*3-v+_)*.09375,O=A*2+E,U=P*2+R,Y=(y-x)*.75+A+E*.16666667,$=(S-v)*.75+P+R*.16666667,g+=Math.sqrt(Y*Y+$*$),Y+=O,$+=U,O+=E,U+=R,g+=Math.sqrt(Y*Y+$*$),Y+=O,$+=U,g+=Math.sqrt(Y*Y+$*$),Y+=O+E,$+=U+R,g+=Math.sqrt(Y*Y+$*$),p[N]=g,x=b,v=_;this.data.positionMode===dn.Percent&&(a*=g);let X;switch(this.data.spacingMode){case mi.Percent:X=g;break;case mi.Proportional:X=g/n;break;default:X=1}const D=this.segments;let F=0;for(let N=0,k=0,V=0,G=0;N<n;N++,k+=3){const W=c[N]*X;a+=W;let Z=a;if(u)Z%=g,Z<0&&(Z+=g),V=0,G=0;else if(Z<0){this.addBeforePosition(Z,h,0,l,k);continue}else if(Z>g){this.addAfterPosition(Z-g,h,d-4,l,k);continue}for(;;V++){const ne=p[V];if(!(Z>ne)){if(V===0)Z/=ne;else{const oe=p[V-1];Z=(Z-oe)/(ne-oe)}break}}if(V!==m){m=V;let ne=V*6;for(x=h[ne],v=h[ne+1],y=h[ne+2],S=h[ne+3],C=h[ne+4],w=h[ne+5],b=h[ne+6],_=h[ne+7],A=(x-y*2+C)*.03,P=(v-S*2+w)*.03,E=((y-C)*3-x+b)*.006,R=((S-w)*3-v+_)*.006,O=A*2+E,U=P*2+R,Y=(y-x)*.3+A+E*.16666667,$=(S-v)*.3+P+R*.16666667,F=Math.sqrt(Y*Y+$*$),D[0]=F,ne=1;ne<8;ne++)Y+=O,$+=U,O+=E,U+=R,F+=Math.sqrt(Y*Y+$*$),D[ne]=F;Y+=O,$+=U,F+=Math.sqrt(Y*Y+$*$),D[8]=F,Y+=O+E,$+=U+R,F+=Math.sqrt(Y*Y+$*$),D[9]=F,G=0}for(Z*=F;;G++){const ne=D[G];if(!(Z>ne)){if(G===0)Z/=ne;else{const oe=D[G-1];Z=G+(Z-oe)/(ne-oe)}break}}this.addCurvePosition(Z*.1,x,v,y,S,C,w,b,_,l,k,r||N>0&&W===0)}return l}addBeforePosition(t,i,n,r,o){const a=i[n],c=i[n+1],l=i[n+2]-a,h=i[n+3]-c,u=Math.atan2(h,l);r[o]=a+t*Math.cos(u),r[o+1]=c+t*Math.sin(u),r[o+2]=u}addAfterPosition(t,i,n,r,o){const a=i[n+2],c=i[n+3],l=a-i[n],h=c-i[n+1],u=Math.atan2(h,l);r[o]=a+t*Math.cos(u),r[o+1]=c+t*Math.sin(u),r[o+2]=u}addCurvePosition(t,i,n,r,o,a,c,l,h,u,d,f){if(t===0||Number.isNaN(t)){u[d]=i,u[d+1]=n,u[d+2]=Math.atan2(o-n,r-i);return}const m=t*t,p=m*t,g=1-t,x=g*g,v=x*g,y=g*t,S=y*3,C=g*S,w=S*t,b=i*v+r*C+a*w+l*p,_=n*v+o*C+c*w+h*p;u[d]=b,u[d+1]=_,f&&(t<.001?u[d+2]=Math.atan2(o-n,r-i):u[d+2]=Math.atan2(_-(n*x+o*y*2+c*m),b-(i*x+r*y*2+a*m)))}sort(t){const i=this.slot.data.index,n=this.slot.bone;t.skin!=null&&this.sortPathSlot(t,t.skin,i,n),t.data.defaultSkin!=null&&t.data.defaultSkin!==t.skin&&this.sortPathSlot(t,t.data.defaultSkin,i,n),this.sortPath(t,this.slot.pose.attachment,n);const r=this.bones,o=this.bones.length;for(let a=0;a<o;a++){const c=r[a].bone;t.sortBone(c),t.constrained(c)}t._updateCache.push(this);for(let a=0;a<o;a++)t.sortReset(r[a].bone.children);for(let a=0;a<o;a++)r[a].bone.sorted=!0}sortPathSlot(t,i,n,r){const o=i.getAttachments();for(let a=0,c=o.length;a<c;a++){const l=o[a];l.slotIndex===n&&this.sortPath(t,l.attachment,r)}}sortPath(t,i,n){if(!(i instanceof _l))return;const r=i.bones;if(r==null)t.sortBone(n);else{const o=t.bones;for(let a=0,c=r.length;a<c;){let l=r[a++];for(l+=a;a<l;)t.sortBone(o[r[a++]])}}}isSourceActive(){return this.slot.bone.active}};M(Es,"NONE",-1),M(Es,"BEFORE",-2),M(Es,"AFTER",-3);let Om=Es;var Kr;(function(s){s[s.none=0]="none",s[s.reset=1]="reset",s[s.update=2]="update",s[s.pose=3]="pose"})(Kr||(Kr={}));class Lm{constructor(){M(this,"inertia",0);M(this,"strength",0);M(this,"damping",0);M(this,"massInverse",0);M(this,"wind",0);M(this,"gravity",0);M(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 Bm{constructor(){M(this,"color",new nt(1,1,1,1));M(this,"darkColor",null);M(this,"attachment",null);M(this,"sequenceIndex",0);M(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 qn)||!(this.attachment instanceof qn)||e.timelineAttachment!==this.attachment.timelineAttachment)&&(this.deform.length=0),this.attachment=e,this.sequenceIndex=-1)}}class Xp extends LS{constructor(t,i){super(t,new Bm,new Bm);M(this,"skeleton");M(this,"bone");M(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 nt,this.constrainedPose.darkColor=new nt),this.setupPose()}copy(t,i,n){const r=new Xp(t.data,this.skeleton);return this.data.setupPose.darkColor!=null&&(r.pose.darkColor=new nt,r.constrainedPose.darkColor=new nt),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 Zr=class Zr{constructor(e){M(this,"data");M(this,"bones");M(this,"slots");M(this,"drawOrder");M(this,"constraints");M(this,"physics");M(this,"_updateCache",[]);M(this,"resetCache",[]);M(this,"skin",null);M(this,"color");M(this,"scaleX",1);M(this,"_scaleY",1);M(this,"x",0);M(this,"y",0);M(this,"time",0);M(this,"windX",1);M(this,"windY",0);M(this,"gravityX",0);M(this,"gravityY",1);M(this,"_update",0);if(!e)throw new Error("data cannot be null.");this.data=e,this.bones=[];for(let t=0;t<e.bones.length;t++){const i=e.bones[t];let n;if(!i.parent)n=new nl(i,null);else{const r=this.bones[i.parent.index];n=new nl(i,r),r.children.push(n)}this.bones.push(n)}this.slots=[];for(const t of this.data.slots)this.slots.push(new Xp(t,this));this.drawOrder=new pO(this.slots),this.physics=[],this.constraints=[];for(const t of this.data.constraints){const i=t.create(this);i instanceof Su&&this.physics.push(i),this.constraints.push(i)}this.color=new nt(1,1,1,1),this.updateCache()}static get yDir(){return Zr.yDown?-1:1}get scaleY(){return this._scaleY*Zr.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 o=0,a=e.length;o<a;o++)e[o].unconstrained();const t=this.bones,i=t.length;for(let o=0,a=i;o<a;o++){const c=t[o];c.sorted=c.data.skinRequired,c.active=!c.sorted,c.unconstrained()}if(this.skin){const o=this.skin.bones;for(let a=0,c=this.skin.bones.length;a<c;a++){let l=this.bones[o[a].index];do l.sorted=!1,l.active=!0,l=l.parent;while(l)}}const n=this.constraints;let r=this.constraints.length;for(let o=0;o<r;o++)n[o].unconstrained();for(let o=0;o<r;o++){const a=n[o];a.active=a.isSourceActive()&&(!a.data.skinRequired||this.skin!=null&&this.skin.constraints.includes(a.data)),a.active&&a.sort(this)}for(let o=0;o<i;o++)this.sortBone(t[o]);r=this._updateCache.length;for(let o=0;o<r;o++){const a=this._updateCache[o];a instanceof nl&&(this._updateCache[o]=a.appliedPose)}}constrained(e){e.pose===e.appliedPose&&(e.constrained(),this.resetCache.push(e))}sortBone(e){if(e.sorted||!e.active)return;const t=e.parent;t&&this.sortBone(t),e.sorted=!0,this._updateCache.push(e)}sortReset(e){for(let t=0,i=e.length;t<i;t++){const n=e[t];n.active&&(n.sorted&&this.sortReset(n.children),n.sorted=!1)}}updateWorldTransform(e){this._update++,this.drawOrder.appliedPose===this.drawOrder.constrainedPose&&this.drawOrder.resetConstrained();const t=this.resetCache;for(let n=0,r=this.resetCache.length;n<r;n++)t[n].resetConstrained();const i=this._updateCache;for(let n=0,r=this._updateCache.length;n<r;n++)i[n].update(this,e)}setupPose(){this.setupPoseBones(),this.setupPoseSlots()}setupPoseBones(){const e=this.bones;for(let i=0,n=e.length;i<n;i++)e[i].setupPose();const t=this.constraints;for(let i=0,n=t.length;i<n;i++)t[i].setupPose()}setupPoseSlots(){this.drawOrder.setupPose();const e=this.slots;for(let t=0,i=e.length;t<i;t++)e[t].setupPose()}getRootBone(){return this.bones.length===0?null:this.bones[0]}findBone(e){if(!e)throw new Error("boneName cannot be null.");const t=this.bones;for(let i=0,n=t.length;i<n;i++)if(t[i].data.name===e)return t[i];return null}findSlot(e){if(!e)throw new Error("slotName cannot be null.");const t=this.slots;for(let i=0,n=t.length;i<n;i++)if(t[i].data.name===e)return t[i];return null}setSkin(e){typeof e=="string"?this.setSkinByName(e):this.setSkinBySkin(e)}setSkinByName(e){const t=this.data.findSkin(e);if(!t)throw new Error(`Skin not found: ${e}`);this.setSkin(t)}setSkinBySkin(e){if(e!==this.skin){if(e)if(this.skin)e.attachAll(this,this.skin);else{const t=this.slots;for(let i=0,n=t.length;i<n;i++){const r=t[i],o=r.data.attachmentName;if(o){const a=e.getAttachment(i,o);a&&r.pose.setAttachment(a)}}}this.skin=e,this.updateCache()}}getAttachment(e,t){return typeof e=="string"?this.getAttachmentByName(e,t):this.getAttachmentByIndex(e,t)}getAttachmentByName(e,t){const i=this.data.findSlot(e);if(!i)throw new Error(`Can't find slot with name ${e}`);return this.getAttachment(i.index,t)}getAttachmentByIndex(e,t){if(!t)throw new Error("placeholder cannot be null.");if(this.skin){const i=this.skin.getAttachment(e,t);if(i)return i}return this.data.defaultSkin?this.data.defaultSkin.getAttachment(e,t):null}setAttachment(e,t){if(!e)throw new Error("slotName cannot be null.");const i=this.findSlot(e);if(!i)throw new Error(`Slot not found: ${e}`);let n=null;if(t&&(n=this.getAttachment(i.data.index,t),!n))throw new Error(`Attachment not found: ${t}, for slot: ${e}`);i.pose.setAttachment(n)}findConstraint(e,t){if(e==null)throw new Error("constraintName cannot be null.");if(t==null)throw new Error("type cannot be null.");const i=this.constraints;for(let n=0,r=i.length;n<r;n++){const o=i[n];if(o instanceof t&&o.data.name===e)return o}return null}getBoundsRect(e){const t=new gy,i=new gy;return this.getBounds(t,i,void 0,e),{x:t.x,y:t.y,width:i.x,height:i.y}}getBounds(e,t,i=new Array(2),n=null){if(!e)throw new Error("offset cannot be null.");if(!t)throw new Error("size cannot be null.");const r=this.drawOrder.appliedPose,o=r;let a=Number.POSITIVE_INFINITY,c=Number.POSITIVE_INFINITY,l=Number.NEGATIVE_INFINITY,h=Number.NEGATIVE_INFINITY;for(let u=0,d=r.length;u<d;u++){const f=o[u];if(!f.bone.active)continue;let m=0,p=null,g=null;const x=f.appliedPose.attachment;if(x){if(x instanceof da)m=8,p=Ge.setArraySize(i,m,0),x.computeWorldVertices(f,x.getOffsets(f.appliedPose),p,0,2),g=Zr.quadTriangles;else if(x instanceof Ar)m=x.worldVerticesLength,p=Ge.setArraySize(i,m,0),x.computeWorldVertices(this,f,0,m,p,0,2),g=x.triangles;else if(x instanceof bu&&n){n.clipEnd(f),n.clipStart(this,f,x);continue}if(p&&g){n!=null&&n.isClipping()&&n.clipTriangles(p,g,g.length)&&(p=n.clippedVertices,m=n.clippedVertices.length);for(let v=0,y=p.length;v<y;v+=2){const S=p[v],C=p[v+1];a=Math.min(a,S),c=Math.min(c,C),l=Math.max(l,S),h=Math.max(h,C)}}}n&&n.clipEnd(f)}n&&n.clipEnd(),e.set(a,c),t.set(l-a,h-c)}setScale(e,t){this.scaleX=e,this.scaleY=t}setPosition(e,t){this.x=e,this.y=t}update(e){this.time+=e}physicsTranslate(e,t){const i=this.physics;for(let n=0,r=i.length;n<r;n++)i[n].translate(e,t)}physicsRotate(e,t,i){const n=this.physics;for(let r=0,o=n.length;r<o;r++)n[r].rotate(e,t,i)}};M(Zr,"quadTriangles",[0,1,2,2,3,0]),M(Zr,"yDown",!1);let Nm=Zr;class Su extends Bl{constructor(t,i){super(t,new Lm,new Lm);M(this,"bone");M(this,"_reset",!0);M(this,"ux",0);M(this,"uy",0);M(this,"cx",0);M(this,"cy",0);M(this,"tx",0);M(this,"ty",0);M(this,"xOffset",0);M(this,"xLag",0);M(this,"xVelocity",0);M(this,"yOffset",0);M(this,"yLag",0);M(this,"yVelocity",0);M(this,"rotateOffset",0);M(this,"rotateLag",0);M(this,"rotateVelocity",0);M(this,"scaleOffset",0);M(this,"scaleLag",0);M(this,"scaleVelocity",0);M(this,"remaining",0);M(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 Su(this.data,t);return i.pose.set(this.pose),i}reset(t){this.remaining=0,this.lastTime=t.time,this._reset=!0,this.xOffset=0,this.xLag=0,this.xVelocity=0,this.yOffset=0,this.yLag=0,this.yVelocity=0,this.rotateOffset=0,this.rotateLag=0,this.rotateVelocity=0,this.scaleOffset=0,this.scaleLag=0,this.scaleVelocity=0}translate(t,i){this.ux-=t,this.uy-=i,this.cx-=t,this.cy-=i}rotate(t,i,n){const r=n*Ie.degRad,o=Math.cos(r),a=Math.sin(r),c=this.cx-t,l=this.cy-i;this.translate(c*o-l*a-c,c*a+l*o-l)}update(t,i){const n=this.appliedPose,r=n.mix;if(r===0)return;const o=this.data.x>0,a=this.data.y>0,c=this.data.rotate>0||this.data.shearX>0,l=this.data.scaleX>0,h=this.bone;let u=h.bone.data.length,d=this.data.step,f=0;if(i!==Kr.none){switch(h.modifyWorld(t),i){case Kr.reset:this.reset(t);case Kr.update:{const m=Math.max(t.time-this.lastTime,0),p=this.remaining;this.remaining+=m,this.lastTime=t.time;const g=h.worldX,x=h.worldY;if(this._reset)this._reset=!1,this.ux=g,this.uy=x;else{let v=this.remaining,y=n.inertia,S=t.data.referenceScale,C=-1,w=0,b=0,_=this.data.limit*m,A=_*Math.abs(t.scaleY);if(_*=Math.abs(t.scaleX),o||a){if(o){const P=(this.ux-g)*y;this.xOffset+=P>_?_:P<-_?-_:P,this.ux=g}if(a){const P=(this.uy-x)*y;this.yOffset+=P>A?A:P<-A?-A:P,this.uy=x}if(v>=d){const P=this.xOffset,E=this.yOffset;C=n.damping**(60*d),w=d*n.massInverse,b=n.strength;const R=S*n.wind,O=S*n.gravity,U=(R*t.windX+O*t.gravityX)*t.scaleX,Y=(R*t.windY+O*t.gravityY)*t.scaleY;do o&&(this.xVelocity+=(U-this.xOffset*b)*w,this.xOffset+=this.xVelocity*d,this.xVelocity*=C),a&&(this.yVelocity-=(Y+this.yOffset*b)*w,this.yOffset+=this.yVelocity*d,this.yVelocity*=C),v-=d;while(v>=d);this.xLag=this.xOffset-P,this.yLag=this.yOffset-E}f=Math.max(0,1-v/d),o&&(h.worldX+=(this.xOffset-this.xLag*f)*r*this.data.x),a&&(h.worldY+=(this.yOffset-this.yLag*f)*r*this.data.y)}if(c||l){let P=Math.atan2(h.c,h.a),E=0,R=0,O=0,U=this.cx-h.worldX,Y=this.cy-h.worldY;if(U>_?U=_:U<-_&&(U=-_),Y>A?Y=A:Y<-A&&(Y=-A),v=this.remaining,c){O=(this.data.rotate+this.data.shearX)*r,f=this.rotateLag*Math.max(0,1-p/d);let $=Math.atan2(Y+this.ty,U+this.tx)-P-(this.rotateOffset-f)*O;this.rotateOffset+=($-Math.ceil($*Ie.invPI2-.5)*Ie.PI2)*y,$=(this.rotateOffset-f)*O+P,E=Math.cos($),R=Math.sin($),l&&($=u*h.getWorldScaleX(),$>0&&(this.scaleOffset+=(U*E+Y*R)*y/$))}else{E=Math.cos(P),R=Math.sin(P);const $=u*h.getWorldScaleX()-this.scaleLag*Math.max(0,1-p/d);$>0&&(this.scaleOffset+=(U*E+Y*R)*y/$)}if(v>=d){C===-1&&(C=n.damping**(60*d),w=d*n.massInverse,b=n.strength);const $=n.wind*t.windX+n.gravity*t.gravityX,X=(n.wind*t.windY+n.gravity*t.gravityY)*Nm.yDir,D=this.rotateOffset,F=this.scaleOffset,N=u/S;for(;;)if(v-=d,l&&(this.scaleVelocity+=($*E-X*R-this.scaleOffset*b)*w,this.scaleOffset+=this.scaleVelocity*d,this.scaleVelocity*=C),c){if(this.rotateVelocity-=(($*R+X*E)*N+this.rotateOffset*b)*w,this.rotateOffset+=this.rotateVelocity*d,this.rotateVelocity*=C,v<d)break;const k=this.rotateOffset*O+P;E=Math.cos(k),R=Math.sin(k)}else if(v<d)break;this.rotateLag=this.rotateOffset-D,this.scaleLag=this.scaleOffset-F}f=Math.max(0,1-v/d)}this.remaining=v}this.cx=h.worldX,this.cy=h.worldY;break}case Kr.pose:f=Math.max(0,1-this.remaining/d),o&&(h.worldX+=(this.xOffset-this.xLag*f)*r*this.data.x),a&&(h.worldY+=(this.yOffset-this.yLag*f)*r*this.data.y)}if(c){let m=(this.rotateOffset-this.rotateLag*f)*r,p=0,g=0,x=0;if(this.data.shearX>0){let v=0;this.data.rotate>0&&(v=m*this.data.rotate,p=Math.sin(v),g=Math.cos(v),x=h.b,h.b=g*x-p*h.d,h.d=p*x+g*h.d),v+=m*this.data.shearX,p=Math.sin(v),g=Math.cos(v),x=h.a,h.a=g*x-p*h.c,h.c=p*x+g*h.c}else m*=this.data.rotate,p=Math.sin(m),g=Math.cos(m),x=h.a,h.a=g*x-p*h.c,h.c=p*x+g*h.c,x=h.b,h.b=g*x-p*h.d,h.d=p*x+g*h.d}if(l){let m=1+(this.scaleOffset-this.scaleLag*f)*r*this.data.scaleX;switch(h.a*=m,h.c*=m,this.data.scaleYMode){case Xi.Uniform:h.b*=m,h.d*=m;break;case Xi.Volume:m=Math.abs(m),m=m>=.7?1/m:4-3.67347*m,h.b*=m,h.d*=m}}i!==Kr.pose&&(this.tx=u*h.a,this.ty=u*h.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 Yc extends Nl{constructor(t){super(t,new Lm);M(this,"_bone",null);M(this,"x",0);M(this,"y",0);M(this,"rotate",0);M(this,"scaleX",0);M(this,"shearX",0);M(this,"limit",0);M(this,"step",0);M(this,"inertiaGlobal",!1);M(this,"strengthGlobal",!1);M(this,"dampingGlobal",!1);M(this,"massGlobal",!1);M(this,"windGlobal",!1);M(this,"gravityGlobal",!1);M(this,"mixGlobal",!1);M(this,"_scaleYMode",Xi.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 Su(this,t)}}typeof Math.fround>"u"&&(Math.fround=(s=>e=>(s[0]=e,s[0]))(new Float32Array(1)));class Dm{constructor(){M(this,"time",0);M(this,"mix",0)}set(e){this.time=e.time,this.mix=e.mix}}const al=class al extends Bl{constructor(t,i){super(t,new Dm,new Dm);M(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 al(this.data,t);return i.pose.set(this.pose),i}update(t,i){const n=this.appliedPose;if(n.mix===0)return;const r=this.data,o=r.animation,a=this.bone;if(a!==null){if(!a.active)return;r.local&&a.appliedPose.validateLocalTransform(t),n.time=r.offset+(r.property.value(t,a.appliedPose,r.local,al.offsets)-r.property.offset)*r.scale,r.loop?n.time=o.duration+n.time%o.duration:n.time=Math.max(0,n.time)}const c=t.bones,l=o.bones;for(let h=0,u=o.bones.length;h<u;h++)c[l[h]].appliedPose.modifyLocal(t);o.apply(t,n.time,n.time,r.loop,null,n.mix,Xe.current,r.additive,!1,!0)}sort(t){const i=this.bone,n=this.data;i&&!n.local&&t.sortBone(i),t._updateCache.push(this);const r=t.bones,o=n.animation.bones;for(let d=0,f=n.animation.bones.length;d<f;d++){const m=r[o[d]];m.sorted=!1,t.sortReset(m.children),t.constrained(m)}const a=n.animation.timelines,c=t.slots,l=t.constraints,h=t.physics,u=t.physics.length;for(let d=0,f=n.animation.timelines.length;d<f;d++){const m=a[d];if(cO(m))t.constrained(c[m.slotIndex]);else if(m instanceof _r||m instanceof ma)t.drawOrder.constrained();else if(m instanceof kr)if(m.constraintIndex===-1)for(let p=0;p<u;p++)t.constrained(h[p]);else t.constrained(l[m.constraintIndex]);else if(uO(m)){const p=m.constraintIndex;p!==-1&&t.constrained(l[p])}}}};M(al,"offsets",[0,0,0,0,0,0]);let Um=al;class Jr extends Nl{constructor(t){super(t,new Dm);M(this,"animation");M(this,"additive",!1);M(this,"loop",!1);M(this,"bone",null);M(this,"property");M(this,"scale",0);M(this,"offset",0);M(this,"local",!1);M(this,"max",0)}create(t){return new Um(this,t)}}class DS{constructor(){M(this,"name",null);M(this,"bones",[]);M(this,"slots",[]);M(this,"skins",[]);M(this,"defaultSkin",null);M(this,"events",[]);M(this,"animations",[]);M(this,"constraints",[]);M(this,"x",0);M(this,"y",0);M(this,"width",0);M(this,"height",0);M(this,"referenceScale",100);M(this,"version",null);M(this,"hash",null);M(this,"fps",30);M(this,"imagesPath",null);M(this,"audioPath",null)}findBone(e){if(!e)throw new Error("boneName cannot be null.");const t=this.bones;for(let i=0,n=t.length;i<n;i++)if(t[i].name===e)return t[i];return null}findSlot(e){if(!e)throw new Error("slotName cannot be null.");const t=this.slots;for(let i=0,n=t.length;i<n;i++)if(t[i].name===e)return t[i];return null}findSkin(e){if(!e)throw new Error("skinName cannot be null.");const t=this.skins;for(let i=0,n=t.length;i<n;i++)if(t[i].name===e)return t[i];return null}findEvent(e){if(!e)throw new Error("eventDataName cannot be null.");const t=this.events;for(let i=0,n=t.length;i<n;i++)if(t[i].name===e)return t[i];return null}findSliderAnimations(e){const t=this.constraints;for(let i=0,n=this.constraints.length;i<n;i++){const r=t[i];r instanceof Jr&&r.animation!=null&&e.push(r.animation)}return e}findAnimation(e){if(!e)throw new Error("animationName cannot be null.");const t=this.animations;for(let i=0,n=t.length;i<n;i++)if(t[i].name===e)return t[i];return null}findConstraint(e,t){if(!e)throw new Error("constraintName cannot be null.");if(t==null)throw new Error("type cannot be null.");const i=this.constraints;for(let n=0,r=this.constraints.length;n<r;n++){const o=i[n];if(o instanceof t&&o.name===e)return o}return null}}class My{constructor(e=0,t,i){M(this,"slotIndex",0);M(this,"placeholder");M(this,"attachment");this.slotIndex=e,this.placeholder=t,this.attachment=i}}class $m{constructor(e){M(this,"name");M(this,"attachments",[]);M(this,"bones",[]);M(this,"constraints",[]);M(this,"color",new nt(.99607843,.61960787,.30980393,1));if(!e)throw new Error("name cannot be null.");this.name=e}setAttachment(e,t,i){if(!i)throw new Error("attachment cannot be null.");const n=this.attachments;e>=n.length&&(n.length=e+1),n[e]||(n[e]={}),n[e][t]=i}addSkin(e){for(let i=0;i<e.bones.length;i++){const n=e.bones[i];let r=!1;for(let o=0;o<this.bones.length;o++)if(this.bones[o]===n){r=!0;break}r||this.bones.push(n)}for(let i=0;i<e.constraints.length;i++){const n=e.constraints[i];let r=!1;for(let o=0;o<this.constraints.length;o++)if(this.constraints[o]===n){r=!0;break}r||this.constraints.push(n)}const t=e.getAttachments();for(let i=0;i<t.length;i++){const n=t[i];this.setAttachment(n.slotIndex,n.placeholder,n.attachment)}}copySkin(e){for(let i=0;i<e.bones.length;i++){const n=e.bones[i];let r=!1;for(let o=0;o<this.bones.length;o++)if(this.bones[o]===n){r=!0;break}r||this.bones.push(n)}for(let i=0;i<e.constraints.length;i++){const n=e.constraints[i];let r=!1;for(let o=0;o<this.constraints.length;o++)if(this.constraints[o]===n){r=!0;break}r||this.constraints.push(n)}const t=e.getAttachments();for(let i=0;i<t.length;i++){const n=t[i];n.attachment&&(n.attachment instanceof Ar?(n.attachment=n.attachment.newLinkedMesh(),this.setAttachment(n.slotIndex,n.placeholder,n.attachment)):(n.attachment=n.attachment.copy(),this.setAttachment(n.slotIndex,n.placeholder,n.attachment)))}}getAttachment(e,t){const i=this.attachments[e];return i?i[t]:null}removeAttachment(e,t){const i=this.attachments[e];i&&delete i[t]}getAttachments(){const e=[];for(let t=0;t<this.attachments.length;t++){const i=this.attachments[t];if(i)for(const n in i){const r=i[n];r&&e.push(new My(t,n,r))}}return e}getAttachmentsForSlot(e,t){const i=this.attachments[e];if(i)for(const n in i){const r=i[n];r&&t.push(new My(e,n,r))}}clear(){this.attachments.length=0,this.bones.length=0,this.constraints.length=0}attachAll(e,t){let i=0;for(let n=0;n<e.slots.length;n++){const r=e.slots[n],o=r.pose.getAttachment();if(o&&i<t.attachments.length){const a=t.attachments[i];for(const c in a){const l=a[c];if(o===l){const h=this.getAttachment(i,c);h&&r.pose.setAttachment(h);break}}}i++}}}class US extends Up{constructor(t,i,n){super(i,new Bm);M(this,"index",0);M(this,"boneData");M(this,"attachmentName",null);M(this,"blendMode",Lh.Normal);M(this,"visible",!0);if(t<0)throw new Error("index must be >= 0.");if(!n)throw new Error("boneData cannot be null.");this.index=t,this.boneData=n}}var Lh;(function(s){s[s.Normal=0]="Normal",s[s.Additive=1]="Additive",s[s.Multiply=2]="Multiply",s[s.Screen=3]="Screen"})(Lh||(Lh={}));class Xm{constructor(){M(this,"mixRotate",0);M(this,"mixX",0);M(this,"mixY",0);M(this,"mixScaleX",0);M(this,"mixScaleY",0);M(this,"mixShearY",0)}set(e){this.mixRotate=e.mixRotate,this.mixX=e.mixX,this.mixY=e.mixY,this.mixScaleX=e.mixScaleX,this.mixScaleY=e.mixScaleY,this.mixShearY=e.mixShearY}}class Vp extends Bl{constructor(t,i){super(t,new Xm,new Xm);M(this,"bones");M(this,"source");if(!i)throw new Error("skeleton cannot be null.");this.bones=[];for(const r of t.bones)this.bones.push(i.bones[r.index].constrainedPose);const n=i.bones[t.source.index];if(n==null)throw new Error("source cannot be null.");this.source=n}copy(t){var i=new Vp(this.data,t);return i.pose.set(this.pose),i}update(t,i){const n=this.appliedPose;if(n.mixRotate===0&&n.mixX===0&&n.mixY===0&&n.mixScaleX===0&&n.mixScaleY===0&&n.mixShearY===0)return;const r=this.data,o=r.localSource,a=r.localTarget,c=r.additive,l=r.clamp,h=r.offsets,u=this.source.appliedPose;o&&u.validateLocalTransform(t);const d=r.properties,f=r.properties.length,m=this.bones;for(let p=0,g=this.bones.length;p<g;p++){const x=m[p];a?x.modifyLocal(t):x.modifyWorld(t);for(let v=0;v<f;v++){const y=d[v],S=y.value(t,u,o,h)-y.offset,C=y.to;for(let w=0,b=y.to.length;w<b;w++){const _=C[w];if(_.mix(n)!==0){let A=_.offset+S*_.scale;l&&(_.offset<_.max?A=Ie.clamp(A,_.offset,_.max):A=Ie.clamp(A,_.max,_.offset)),_.apply(t,n,x,A,a,c)}}}}}sort(t){this.data.localSource||t.sortBone(this.source);const i=this.bones,n=this.bones.length,r=!this.data.localTarget;if(r)for(let o=0;o<n;o++)t.sortBone(i[o].bone);t._updateCache.push(this);for(let o=0;o<n;o++){const a=i[o].bone;t.sortReset(a.children),t.constrained(a)}for(let o=0;o<n;o++)i[o].bone.sorted=r}isSourceActive(){return this.source.active}}const li=class li extends Nl{constructor(t){super(t,new Xm);M(this,"bones",[]);M(this,"_source",null);M(this,"offsets",[0,0,0,0,0,0]);M(this,"offsetX",0);M(this,"offsetY",0);M(this,"localSource",!1);M(this,"localTarget",!1);M(this,"additive",!1);M(this,"clamp",!1);M(this,"properties",[])}set source(t){this._source=t}get source(){if(this._source)return this._source;throw new Error("BoneData not set.")}create(t){return new Vp(this,t)}getOffsetRotation(){return this.offsets[li.ROTATION]}setOffsetRotation(t){this.offsets[li.ROTATION]=t}getOffsetX(){return this.offsets[li.X]}setOffsetX(t){this.offsets[li.X]=t}getOffsetY(){return this.offsets[li.Y]}setOffsetY(t){this.offsets[li.Y]=t}getOffsetScaleX(){return this.offsets[li.SCALEX]}setOffsetScaleX(t){this.offsets[li.SCALEX]=t}getOffsetScaleY(){return this.offsets[li.SCALEY]}setOffsetScaleY(t){this.offsets[li.SCALEY]=t}getOffsetShearY(){return this.offsets[li.SHEARY]}setOffsetShearY(t){this.offsets[li.SHEARY]=t}};M(li,"ROTATION",0),M(li,"X",1),M(li,"Y",2),M(li,"SCALEX",3),M(li,"SCALEY",4),M(li,"SHEARY",5);let _t=li;class xa{constructor(){M(this,"offset",0);M(this,"to",[])}}class ba{constructor(){M(this,"offset",0);M(this,"max",0);M(this,"scale",0)}}class Vm extends xa{value(e,t,i,n){if(i)return t.rotation+n[_t.ROTATION];const r=e.scaleX,o=e.scaleY;let a=Math.atan2(t.c/o,t.a/r)*Ie.radDeg+((t.a*t.d-t.b*t.c)*r*o>0?n[_t.ROTATION]:-n[_t.ROTATION]);return a<0&&(a+=360),a}}class $S extends ba{mix(e){return e.mixRotate}apply(e,t,i,n,r,o){if(r)i.rotation+=(o?n:n-i.rotation)*t.mixRotate;else{const a=e.scaleX,c=e.scaleY,l=1/a,h=1/c,u=i.a*l,d=i.b*l,f=i.c*h,m=i.d*h;n*=Ie.degRad,o||(n-=Math.atan2(f,u)),n>Ie.PI?n-=Ie.PI2:n<-Ie.PI&&(n+=Ie.PI2),n*=t.mixRotate;const p=Math.cos(n),g=Math.sin(n);i.a=(p*u-g*f)*a,i.b=(p*d-g*m)*a,i.c=(g*u+p*f)*c,i.d=(g*d+p*m)*c}}}class Ym extends xa{value(e,t,i,n){return i?t.x+n[_t.X]:(n[_t.X]*t.a+n[_t.Y]*t.b+t.worldX)/e.scaleX}}class XS extends ba{mix(e){return e.mixX}apply(e,t,i,n,r,o){r?i.x+=(o?n:n-i.x)*t.mixX:(o||(n-=i.worldX/e.scaleX),i.worldX+=n*t.mixX*e.scaleX)}}class Gm extends xa{value(e,t,i,n){return i?t.y+n[_t.Y]:(n[_t.X]*t.c+n[_t.Y]*t.d+t.worldY)/e.scaleY}}class VS extends ba{mix(e){return e.mixY}apply(e,t,i,n,r,o){r?i.y+=(o?n:n-i.y)*t.mixY:(o||(n-=i.worldY/e.scaleY),i.worldY+=n*t.mixY*e.scaleY)}}class jm extends xa{value(e,t,i,n){if(i)return t.scaleX+n[_t.SCALEX];const r=t.a/e.scaleX,o=t.c/e.scaleY;return Math.sqrt(r*r+o*o)+n[_t.SCALEX]}}class YS extends ba{mix(e){return e.mixScaleX}apply(e,t,i,n,r,o){if(r)o?i.scaleX*=1+(n-1)*t.mixScaleX:i.scaleX!==0&&(i.scaleX+=(n-i.scaleX)*t.mixScaleX);else if(o){const a=1+(n-1)*t.mixScaleX;i.a*=a,i.c*=a}else{let a=i.a/e.scaleX,c=i.c/e.scaleY,l=Math.sqrt(a*a+c*c);l!==0&&(l=1+(n-l)*t.mixScaleX/l,i.a*=l,i.c*=l)}}}class Hm extends xa{value(e,t,i,n){if(i)return t.scaleY+n[_t.SCALEY];const r=t.b/e.scaleX,o=t.d/e.scaleY;return Math.sqrt(r*r+o*o)+n[_t.SCALEY]}}class GS extends ba{mix(e){return e.mixScaleY}apply(e,t,i,n,r,o){if(r)o?i.scaleY*=1+(n-1)*t.mixScaleY:i.scaleY!==0&&(i.scaleY+=(n-i.scaleY)*t.mixScaleY);else if(o){const a=1+(n-1)*t.mixScaleY;i.b*=a,i.d*=a}else{let a=i.b/e.scaleX,c=i.d/e.scaleY,l=Math.sqrt(a*a+c*c);l!==0&&(l=1+(n-l)*t.mixScaleY/l,i.b*=l,i.d*=l)}}}class Wm extends xa{value(e,t,i,n){if(i)return t.shearY+n[_t.SHEARY];const r=1/e.scaleX,o=1/e.scaleY;return(Math.atan2(t.d*o,t.b*r)-Math.atan2(t.c*o,t.a*r))*Ie.radDeg-90+n[_t.SHEARY]}}class jS extends ba{mix(e){return e.mixShearY}apply(e,t,i,n,r,o){if(r)o||(n-=i.shearY),i.shearY+=n*t.mixShearY;else{const a=e.scaleX,c=e.scaleY,l=i.b/a,h=i.d/c,u=Math.atan2(h,l);n=(n+90)*Ie.degRad,o?n-=Ie.PI/2:(n-=u-Math.atan2(i.c/c,i.a/a),n>Ie.PI?n-=Ie.PI2:n<-Ie.PI&&(n+=Ie.PI2)),n=u+n*t.mixShearY;const d=Math.sqrt(l*l+h*h);i.b=Math.cos(n)*d*a,i.d=Math.sin(n)*d*c}}}class BV{constructor(e){M(this,"scale",1);M(this,"attachmentLoader");M(this,"linkedMeshes",[]);this.attachmentLoader=e}readSkeletonData(e){const t=this.scale,i=new DS;i.name="";const n=new gO(e),r=n.readInt32(),o=n.readInt32();i.hash=o===0&&r===0?null:o.toString(16)+r.toString(16),i.version=n.readString(),i.x=n.readFloat(),i.y=n.readFloat(),i.width=n.readFloat(),i.height=n.readFloat(),i.referenceScale=n.readFloat()*t;const a=n.readBoolean();a&&(i.fps=n.readFloat(),i.imagesPath=n.readString(),i.audioPath=n.readString());let c=0;c=n.readInt(!0);for(let m=0;m<c;m++){const p=n.readString();if(!p)throw new Error("String in string table must not be null.");n.strings.push(p)}const l=i.bones;c=n.readInt(!0);for(let m=0;m<c;m++){const p=n.readString();if(!p)throw new Error("Bone name must not be null.");const g=m===0?null:l[n.readInt(!0)],x=new wu(m,p,g),v=x.setupPose;v.rotation=n.readFloat(),v.x=n.readFloat()*t,v.y=n.readFloat()*t,v.scaleX=n.readFloat(),v.scaleY=n.readFloat(),v.shearX=n.readFloat(),v.shearY=n.readFloat(),v.inherit=n.readByte(),x.length=n.readFloat()*t,x.skinRequired=n.readBoolean(),a&&(nt.rgba8888ToColor(x.color,n.readInt32()),x.icon=n.readString()??void 0,x.iconSize=n.readFloat(),x.iconRotation=n.readFloat(),x.visible=n.readBoolean()),l.push(x)}c=n.readInt(!0);for(let m=0;m<c;m++){const p=n.readString();if(!p)throw new Error("Slot name must not be null.");const g=l[n.readInt(!0)],x=new US(m,p,g);nt.rgba8888ToColor(x.setupPose.color,n.readInt32());const v=n.readInt32();v!==-1&&nt.rgb888ToColor(x.setupPose.darkColor=new nt,v),x.attachmentName=n.readStringRef(),x.blendMode=n.readInt(!0),a&&(x.visible=n.readBoolean()),i.slots.push(x)}const h=i.constraints,u=n.readInt(!0);for(let m=0;m<u;m++){const p=n.readString();if(!p)throw new Error("Constraint data name must not be null.");let g;switch(n.readByte()){case NO:{const x=new Xc(p);g=n.readInt(!0);for(let S=0;S<g;S++)x.bones.push(l[n.readInt(!0)]);x.target=l[n.readInt(!0)];const v=n.readByte();x.skinRequired=(v&1)!==0,(v&2)!==0&&(x.scaleYMode=n.readUnsignedByte());const y=x.setupPose;y.bendDirection=(v&4)!==0?-1:1,y.compress=(v&8)!==0,y.stretch=(v&16)!==0,(v&32)!==0&&(y.mix=(v&64)!==0?n.readFloat():1),(v&128)!==0&&(y.softness=n.readFloat()*t),h.push(x);break}case UO:{const x=new _t(p);g=n.readInt(!0);for(let S=0;S<g;S++)x.bones.push(l[n.readInt(!0)]);x.source=l[n.readInt(!0)];let v=n.readUnsignedByte();x.skinRequired=(v&1)!==0,x.localSource=(v&2)!==0,x.localTarget=(v&4)!==0,x.additive=(v&8)!==0,x.clamp=(v&16)!==0,g=v>>5;for(let S=0,C;S<g;S++){let w=1,b;switch(n.readByte()){case 0:b=new Vm;break;case 1:{w=t,b=new Ym;break}case 2:{w=t,b=new Gm;break}case 3:b=new jm;break;case 4:b=new Hm;break;case 5:b=new Wm;break;default:b=null}if(b){b.offset=n.readFloat()*w,C=n.readByte();for(let _=0;_<C;_++){let A=1,P;switch(n.readByte()){case 0:P=new $S;break;case 1:{A=t,P=new XS;break}case 2:{A=t,P=new VS;break}case 3:P=new YS;break;case 4:P=new GS;break;case 5:P=new jS;break;default:P=null}P&&(P.offset=n.readFloat()*A,P.max=n.readFloat()*A,P.scale=n.readFloat()*A/w,b.to[_]=P)}x.properties[S]=b}}v=n.readByte(),(v&1)!==0&&(x.offsets[_t.ROTATION]=n.readFloat()),(v&2)!==0&&(x.offsets[_t.X]=n.readFloat()*t),(v&4)!==0&&(x.offsets[_t.Y]=n.readFloat()*t),(v&8)!==0&&(x.offsets[_t.SCALEX]=n.readFloat()),(v&16)!==0&&(x.offsets[_t.SCALEY]=n.readFloat()),(v&32)!==0&&(x.offsets[_t.SHEARY]=n.readFloat()),v=n.readByte();const y=x.setupPose;(v&1)!==0&&(y.mixRotate=n.readFloat()),(v&2)!==0&&(y.mixX=n.readFloat()),(v&4)!==0&&(y.mixY=n.readFloat()),(v&8)!==0&&(y.mixScaleX=n.readFloat()),(v&16)!==0&&(y.mixScaleY=n.readFloat()),(v&32)!==0&&(y.mixShearY=n.readFloat()),h.push(x);break}case DO:{const x=new Vc(p);g=n.readInt(!0);for(let S=0;S<g;S++)x.bones.push(l[n.readInt(!0)]);x.slot=i.slots[n.readInt(!0)];const v=n.readByte();x.skinRequired=(v&1)!==0,x.positionMode=v>>1&1,x.spacingMode=v>>2&3,x.rotateMode=v>>4&3,(v&128)!==0&&(x.offsetRotation=n.readFloat());const y=x.setupPose;y.position=n.readFloat(),x.positionMode===dn.Fixed&&(y.position*=t),y.spacing=n.readFloat(),(x.spacingMode===mi.Length||x.spacingMode===mi.Fixed)&&(y.spacing*=t),y.mixRotate=n.readFloat(),y.mixX=n.readFloat(),y.mixY=n.readFloat(),h.push(x);break}case $O:{const x=new Yc(p);x.bone=l[n.readInt(!0)];let v=n.readByte();if(x.skinRequired=(v&1)!==0,(v&2)!==0&&(x.x=n.readFloat()),(v&4)!==0&&(x.y=n.readFloat()),(v&8)!==0&&(x.rotate=n.readFloat()),(v&16)!==0){let S=n.readFloat();S<-2?(x.scaleYMode=Xi.Volume,S=-2-S):S<0&&(x.scaleYMode=Xi.Uniform,S=-1-S),x.scaleX=S}(v&32)!==0&&(x.shearX=n.readFloat()),x.limit=((v&64)!==0?n.readFloat():5e3)*t,x.step=1/n.readUnsignedByte();const y=x.setupPose;y.inertia=n.readFloat(),y.strength=n.readFloat(),y.damping=n.readFloat(),y.massInverse=(v&128)!==0?n.readFloat():1,y.wind=n.readFloat(),y.gravity=n.readFloat(),v=n.readByte(),(v&1)!==0&&(x.inertiaGlobal=!0),(v&2)!==0&&(x.strengthGlobal=!0),(v&4)!==0&&(x.dampingGlobal=!0),(v&8)!==0&&(x.massGlobal=!0),(v&16)!==0&&(x.windGlobal=!0),(v&32)!==0&&(x.gravityGlobal=!0),(v&64)!==0&&(x.mixGlobal=!0),y.mix=(v&128)!==0?n.readFloat():1,h.push(x);break}case XO:{const x=new Jr(p),v=n.readByte();if(x.skinRequired=(v&1)!==0,x.loop=(v&2)!==0,x.additive=(v&4)!==0,(v&8)!==0){const y=n.readFloat();a&&(v&64)!==0?x.max=y:x.setupPose.time=y}if((v&16)!==0&&(x.setupPose.mix=(v&32)!==0?n.readFloat():1),(v&64)!==0){x.local=(v&128)!==0,x.bone=l[n.readInt(!0)];const y=n.readFloat();let S=1;switch(n.readByte()){case 0:x.property=new Vm;break;case 1:{S=t,x.property=new Ym;break}case 2:{S=t,x.property=new Gm;break}case 3:x.property=new jm;break;case 4:x.property=new Hm;break;case 5:x.property=new Wm;break;default:continue}x.property.offset=y*S,x.offset=n.readFloat(),x.scale=n.readFloat()/S}h.push(x);break}}}const d=this.readSkin(n,i,!0,a);d&&(i.defaultSkin=d,i.skins.push(d));{let m=i.skins.length;for(Ge.setArraySize(i.skins,c=m+n.readInt(!0));m<c;m++){const p=this.readSkin(n,i,!1,a);if(!p)throw new Error("readSkin() should not have returned null.");i.skins[m]=p}}c=this.linkedMeshes.length;for(let m=0;m<c;m++){const p=this.linkedMeshes[m],g=i.skins[p.skinIndex];if(!p.source)throw new Error("Linked mesh parent must not be null");const x=g.getAttachment(p.sourceIndex,p.source);if(!x)throw new Error(`Source mesh not found: ${p.source}`);p.mesh.timelineAttachment=p.inheritTimelines?x:p.mesh,p.mesh.setSourceMesh(x),p.mesh.updateSequence()}this.linkedMeshes.length=0,c=n.readInt(!0);for(let m=0;m<c;m++){const p=n.readString();if(!p)throw new Error("Event data name must not be null");const g=new NS(p),x=g.setupPose;x.intValue=n.readInt(!1),x.floatValue=n.readFloat(),x.stringValue=n.readString(),g._audioPath=n.readString(),g.audioPath&&(x.volume=n.readFloat(),x.balance=n.readFloat()),i.events.push(g)}const f=i.animations;c=n.readInt(!0);for(let m=0;m<c;m++){const p=n.readString();if(!p)throw new Error("Animation name must not be null.");f.push(this.readAnimation(n,p,i,a))}for(let m=0;m<u;m++){const p=h[m];p instanceof Jr&&(p.animation=f[n.readInt(!0)])}return i}readSkin(e,t,i,n){let r=null,o=0;if(i){if(o=e.readInt(!0),o===0)return null;r=new $m("default")}else{const a=e.readString();if(!a)throw new Error("Skin name must not be null.");r=new $m(a),n&&nt.rgba8888ToColor(r.color,e.readInt32());let c=e.readInt(!0),l=t.bones,h=r.bones;for(let u=0;u<c;u++)h[u]=l[e.readInt(!0)];c=e.readInt(!0),l=t.constraints,h=r.constraints;for(let u=0;u<c;u++)h[u]=l[e.readInt(!0)];o=e.readInt(!0)}for(let a=0;a<o;a++){const c=e.readInt(!0);for(let l=0,h=e.readInt(!0);l<h;l++){const u=e.readStringRef();if(!u)throw new Error("Attachment name must not be null");const d=this.readAttachment(e,t,r,c,u,n);d&&r.setAttachment(c,u,d)}}return r}readAttachment(e,t,i,n,r,o){const a=this.scale,c=e.readByte(),l=(c&8)!==0?e.readStringRef():r;if(!l)throw new Error("Attachment name must not be null");switch(c&7){case _n.Region:{let h=(c&16)!==0?e.readStringRef():null;const u=(c&32)!==0?e.readInt32():4294967295,d=this.readSequence(e,(c&64)!==0),f=(c&128)!==0?e.readFloat():0,m=e.readFloat(),p=e.readFloat(),g=e.readFloat(),x=e.readFloat(),v=e.readFloat(),y=e.readFloat();h||(h=l);const S=this.attachmentLoader.newRegionAttachment(i,r,l,h,d);return S?(S.path=h,S.x=m*a,S.y=p*a,S.scaleX=g,S.scaleY=x,S.rotation=f,S.width=v*a,S.height=y*a,nt.rgba8888ToColor(S.color,u),S.updateSequence(),S):null}case _n.BoundingBox:{const h=this.readVertices(e,(c&16)!==0),u=o?e.readInt32():0,d=this.attachmentLoader.newBoundingBoxAttachment(i,r,l);return d?(d.worldVerticesLength=h.length,d.vertices=h.vertices,d.bones=h.bones,o&&nt.rgba8888ToColor(d.color,u),d):null}case _n.Mesh:{let h=(c&16)!==0?e.readStringRef():l;const u=(c&32)!==0?e.readInt32():4294967295,d=this.readSequence(e,(c&64)!==0),f=e.readInt(!0),m=this.readVertices(e,(c&128)!==0),p=this.readFloatArray(e,m.length,1),g=this.readShortArray(e,(m.length-f-2)*3),x=e.readInt(!0);let v=null;if(x>0){v=[];for(let b=0;b<x;b++)v[b]=e.readInt(!0)}let y=[],S=0,C=0;o&&(y=this.readShortArray(e,e.readInt(!0)),S=e.readFloat(),C=e.readFloat()),h||(h=l);const w=this.attachmentLoader.newMeshAttachment(i,r,l,h,d);return w?(w.path=h,nt.rgba8888ToColor(w.color,u),w.hullLength=f<<1,w.bones=m.bones,w.vertices=m.vertices,w.worldVerticesLength=m.length,w.regionUVs=p,w.triangles=g,v&&(w.timelineSlots=v),o&&(w.edges=y,w.width=S*a,w.height=C*a),w.updateSequence(),w):null}case _n.LinkedMesh:{const h=(c&16)!==0?e.readStringRef():l;if(h==null)throw new Error("Path of linked mesh must not be null");const u=(c&32)!==0?e.readInt32():4294967295,d=this.readSequence(e,(c&64)!==0),f=(c&128)!==0,m=e.readInt(!0),p=e.readInt(!0),g=e.readStringRef();let x=0,v=0;o&&(x=e.readFloat(),v=e.readFloat());const y=this.attachmentLoader.newMeshAttachment(i,r,l,h,d);return y?(y.path=h,nt.rgba8888ToColor(y.color,u),o&&(y.width=x*a,y.height=v*a),this.linkedMeshes.push(new vO(y,p,n,m,g,f)),y):null}case _n.Path:{const h=(c&16)!==0,u=(c&32)!==0,d=this.readVertices(e,(c&64)!==0),f=this.readFloatArray(e,d.length/6,a),m=o?e.readInt32():0,p=this.attachmentLoader.newPathAttachment(i,r,l);return p?(p.closed=h,p.constantSpeed=u,p.worldVerticesLength=d.length,p.vertices=d.vertices,p.bones=d.bones,p.lengths=f,o&&nt.rgba8888ToColor(p.color,m),p):null}case _n.Point:{const h=e.readFloat(),u=e.readFloat(),d=e.readFloat(),f=o?e.readInt32():0,m=this.attachmentLoader.newPointAttachment(i,r,l);return m?(m.x=u*a,m.y=d*a,m.rotation=h,o&&nt.rgba8888ToColor(m.color,f),m):null}case _n.Clipping:{const h=e.readInt(!0),u=this.readVertices(e,(c&16)!==0),d=o?e.readInt32():0,f=this.attachmentLoader.newClippingAttachment(i,r,l);return f?(f.endSlot=t.slots[h],f.convex=(c&32)!==0,f.inverse=(c&64)!==0,f.worldVerticesLength=u.length,f.vertices=u.vertices,f.bones=u.bones,o&&nt.rgba8888ToColor(f.color,d),f):null}}}readSequence(e,t){if(!t)return new fa(1,!1);const i=new fa(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 Ty(null,this.readFloatArray(e,r,i),r);const o=e.readInt(!0),a=[],c=[];for(let l=0,h=0;l<o;){const u=e.readInt(!0);a[l++]=u;for(let d=0;d<u;d++,h+=3)a[l++]=e.readInt(!0),c[h]=e.readFloat()*i,c[h+1]=e.readFloat()*i,c[h+2]=e.readFloat()}return new Ty(a,Ge.toFloatArray(c),r)}readFloatArray(e,t,i){const n=[];if(i===1)for(let r=0;r<t;r++)n[r]=e.readFloat();else for(let r=0;r<t;r++)n[r]=e.readFloat()*i;return n}readShortArray(e,t){const i=[];for(let n=0;n<t;n++)i[n]=e.readInt(!0);return i}readAnimation(e,t,i,n){e.readInt(!0);const r=[],o=this.scale;for(let f=0,m=e.readInt(!0);f<m;f++){const p=e.readInt(!0);for(let g=0,x=e.readInt(!0);g<x;g++){const v=e.readByte(),y=e.readInt(!0),S=y-1;switch(v){case PO:{const C=new sl(y,p);for(let w=0;w<y;w++)C.setFrame(w,e.readFloat(),e.readStringRef());r.push(C);break}case kO:{const C=e.readInt(!0),w=new pS(y,C,p);let b=e.readFloat(),_=e.readUnsignedByte()/255,A=e.readUnsignedByte()/255,P=e.readUnsignedByte()/255,E=e.readUnsignedByte()/255;for(let R=0,O=0;w.setFrame(R,b,_,A,P,E),R!==S;R++){const U=e.readFloat(),Y=e.readUnsignedByte()/255,$=e.readUnsignedByte()/255,X=e.readUnsignedByte()/255,D=e.readUnsignedByte()/255;switch(e.readByte()){case Ks:w.setStepped(R);break;case Zs:gt(e,w,O++,R,0,b,U,_,Y,1),gt(e,w,O++,R,1,b,U,A,$,1),gt(e,w,O++,R,2,b,U,P,X,1),gt(e,w,O++,R,3,b,U,E,D,1)}b=U,_=Y,A=$,P=X,E=D}r.push(w);break}case FO:{const C=e.readInt(!0),w=new gS(y,C,p);let b=e.readFloat(),_=e.readUnsignedByte()/255,A=e.readUnsignedByte()/255,P=e.readUnsignedByte()/255;for(let E=0,R=0;w.setFrame(E,b,_,A,P),E!==S;E++){const O=e.readFloat(),U=e.readUnsignedByte()/255,Y=e.readUnsignedByte()/255,$=e.readUnsignedByte()/255;switch(e.readByte()){case Ks:w.setStepped(E);break;case Zs:gt(e,w,R++,E,0,b,O,_,U,1),gt(e,w,R++,E,1,b,O,A,Y,1),gt(e,w,R++,E,2,b,O,P,$,1)}b=O,_=U,A=Y,P=$}r.push(w);break}case OO:{const C=e.readInt(!0),w=new yS(y,C,p);let b=e.readFloat(),_=e.readUnsignedByte()/255,A=e.readUnsignedByte()/255,P=e.readUnsignedByte()/255,E=e.readUnsignedByte()/255,R=e.readUnsignedByte()/255,O=e.readUnsignedByte()/255,U=e.readUnsignedByte()/255;for(let Y=0,$=0;w.setFrame(Y,b,_,A,P,E,R,O,U),Y!==S;Y++){const X=e.readFloat(),D=e.readUnsignedByte()/255,F=e.readUnsignedByte()/255,N=e.readUnsignedByte()/255,k=e.readUnsignedByte()/255,V=e.readUnsignedByte()/255,G=e.readUnsignedByte()/255,W=e.readUnsignedByte()/255;switch(e.readByte()){case Ks:w.setStepped(Y);break;case Zs:gt(e,w,$++,Y,0,b,X,_,D,1),gt(e,w,$++,Y,1,b,X,A,F,1),gt(e,w,$++,Y,2,b,X,P,N,1),gt(e,w,$++,Y,3,b,X,E,k,1),gt(e,w,$++,Y,4,b,X,R,V,1),gt(e,w,$++,Y,5,b,X,O,G,1),gt(e,w,$++,Y,6,b,X,U,W,1)}b=X,_=D,A=F,P=N,E=k,R=V,O=G,U=W}r.push(w);break}case LO:{const C=e.readInt(!0),w=new xS(y,C,p);let b=e.readFloat(),_=e.readUnsignedByte()/255,A=e.readUnsignedByte()/255,P=e.readUnsignedByte()/255,E=e.readUnsignedByte()/255,R=e.readUnsignedByte()/255,O=e.readUnsignedByte()/255;for(let U=0,Y=0;w.setFrame(U,b,_,A,P,E,R,O),U!==S;U++){const $=e.readFloat(),X=e.readUnsignedByte()/255,D=e.readUnsignedByte()/255,F=e.readUnsignedByte()/255,N=e.readUnsignedByte()/255,k=e.readUnsignedByte()/255,V=e.readUnsignedByte()/255;switch(e.readByte()){case Ks:w.setStepped(U);break;case Zs:gt(e,w,Y++,U,0,b,$,_,X,1),gt(e,w,Y++,U,1,b,$,A,D,1),gt(e,w,Y++,U,2,b,$,P,F,1),gt(e,w,Y++,U,3,b,$,E,N,1),gt(e,w,Y++,U,4,b,$,R,k,1),gt(e,w,Y++,U,5,b,$,O,V,1)}b=$,_=X,A=D,P=F,E=N,R=k,O=V}r.push(w);break}case BO:{const C=new vS(y,e.readInt(!0),p);let w=e.readFloat(),b=e.readUnsignedByte()/255;for(let _=0,A=0;C.setFrame(_,w,b),_!==S;_++){const P=e.readFloat(),E=e.readUnsignedByte()/255;switch(e.readByte()){case Ks:C.setStepped(_);break;case Zs:gt(e,C,A++,_,0,w,P,b,E,1)}w=P,b=E}r.push(C)}}}}for(let f=0,m=e.readInt(!0);f<m;f++){const p=e.readInt(!0);for(let g=0,x=e.readInt(!0);g<x;g++){const v=e.readByte(),y=e.readInt(!0);if(v===RO){const C=new mS(y,p);for(let w=0;w<y;w++)C.setFrame(w,e.readFloat(),e.readByte());r.push(C);continue}const S=e.readInt(!0);switch(v){case bO:ri(e,r,new kh(y,S,p),1);break;case wO:ri(e,r,new rS(y,S,p),o);break;case SO:ri(e,r,new oS(y,S,p),o);break;case MO:ri(e,r,new aS(y,S,p),o);break;case TO:ri(e,r,new lS(y,S,p),1);break;case _O:ri(e,r,new cS(y,S,p),1);break;case CO:ri(e,r,new hS(y,S,p),1);break;case EO:ri(e,r,new uS(y,S,p),1);break;case AO:ri(e,r,new dS(y,S,p),1);break;case IO:ri(e,r,new fS(y,S,p),1);break}}}for(let f=0,m=e.readInt(!0);f<m;f++){const p=e.readInt(!0),g=e.readInt(!0),x=g-1,v=new wS(g,e.readInt(!0),p);let y=e.readByte(),S=e.readFloat(),C=(y&1)!==0?(y&2)!==0?e.readFloat():1:0,w=(y&4)!==0?e.readFloat()*o:0;for(let b=0,_=0;v.setFrame(b,S,C,w,(y&8)!==0?1:-1,(y&16)!==0,(y&32)!==0),b!==x;b++){y=e.readByte();const A=e.readFloat(),P=(y&1)!==0?(y&2)!==0?e.readFloat():1:0,E=(y&4)!==0?e.readFloat()*o:0;(y&64)!==0?v.setStepped(b):(y&128)!==0&&(gt(e,v,_++,b,0,S,A,C,P,1),gt(e,v,_++,b,1,S,A,w,E,o)),S=A,C=P,w=E}r.push(v)}for(let f=0,m=e.readInt(!0);f<m;f++){const p=e.readInt(!0),g=e.readInt(!0),x=g-1,v=new SS(g,e.readInt(!0),p);let y=e.readFloat(),S=e.readFloat(),C=e.readFloat(),w=e.readFloat(),b=e.readFloat(),_=e.readFloat(),A=e.readFloat();for(let P=0,E=0;v.setFrame(P,y,S,C,w,b,_,A),P!==x;P++){const R=e.readFloat(),O=e.readFloat(),U=e.readFloat(),Y=e.readFloat(),$=e.readFloat(),X=e.readFloat(),D=e.readFloat();switch(e.readByte()){case Ks:v.setStepped(P);break;case Zs:gt(e,v,E++,P,0,y,R,S,O,1),gt(e,v,E++,P,1,y,R,C,U,1),gt(e,v,E++,P,2,y,R,w,Y,1),gt(e,v,E++,P,3,y,R,b,$,1),gt(e,v,E++,P,4,y,R,_,X,1),gt(e,v,E++,P,5,y,R,A,D,1)}y=R,S=O,C=U,w=Y,b=$,_=X,A=D}r.push(v)}for(let f=0,m=e.readInt(!0);f<m;f++){const p=e.readInt(!0),g=i.constraints[p];for(let x=0,v=e.readInt(!0);x<v;x++){const y=e.readByte(),S=e.readInt(!0),C=e.readInt(!0);switch(y){case GO:ri(e,r,new MS(S,C,p),g.positionMode===dn.Fixed?o:1);break;case jO:ri(e,r,new TS(S,C,p),g.spacingMode===mi.Length||g.spacingMode===mi.Fixed?o:1);break;case HO:{const w=new _S(S,C,p);let b=e.readFloat(),_=e.readFloat(),A=e.readFloat(),P=e.readFloat();for(let E=0,R=0,O=w.getFrameCount()-1;w.setFrame(E,b,_,A,P),E!==O;E++){const U=e.readFloat(),Y=e.readFloat(),$=e.readFloat(),X=e.readFloat();switch(e.readByte()){case Ks:w.setStepped(E);break;case Zs:gt(e,w,R++,E,0,b,U,_,Y,1),gt(e,w,R++,E,1,b,U,A,$,1),gt(e,w,R++,E,2,b,U,P,X,1)}b=U,_=Y,A=$,P=X}r.push(w)}}}}for(let f=0,m=e.readInt(!0);f<m;f++){const p=e.readInt(!0)-1;for(let g=0,x=e.readInt(!0);g<x;g++){const v=e.readByte(),y=e.readInt(!0);if(v===eL){const C=new Oh(y,p);for(let w=0;w<y;w++)C.setFrame(w,e.readFloat());r.push(C);continue}const S=e.readInt(!0);switch(v){case WO:ri(e,r,new CS(y,S,p),1);break;case zO:ri(e,r,new ES(y,S,p),1);break;case qO:ri(e,r,new AS(y,S,p),1);break;case KO:ri(e,r,new IS(y,S,p),1);break;case ZO:ri(e,r,new RS(y,S,p),1);break;case JO:ri(e,r,new PS(y,S,p),1);break;case QO:ri(e,r,new kS(y,S,p),1);break;default:throw new Error("Unknown physics timeline type.")}}}for(let f=0,m=e.readInt(!0);f<m;f++){const p=e.readInt(!0);for(let g=0,x=e.readInt(!0);g<x;g++){const v=e.readByte(),y=e.readInt(!0),S=e.readInt(!0);switch(v){case tL:ri(e,r,new FS(y,S,p),1);break;case iL:ri(e,r,new OS(y,S,p),1);break;default:throw new Error(`Uknown slider type: ${v}`)}}}for(let f=0,m=e.readInt(!0);f<m;f++){const p=i.skins[e.readInt(!0)];for(let g=0,x=e.readInt(!0);g<x;g++){const v=e.readInt(!0);for(let y=0,S=e.readInt(!0);y<S;y++){const C=e.readStringRef();if(!C)throw new Error("attachmentName must not be null.");const w=p.getAttachment(v,C),b=e.readByte(),_=e.readInt(!0),A=_-1;switch(b){case VO:{const P=w,E=P.bones,R=P.vertices,O=E?R.length/3*2:R.length,U=e.readInt(!0),Y=new bS(_,U,v,P);let $=e.readFloat();for(let X=0,D=0;;X++){let F,N=e.readInt(!0);if(N===0)F=E?Ge.newFloatArray(O):R;else{F=Ge.newFloatArray(O);const V=e.readInt(!0);if(N+=V,o===1)for(let G=V;G<N;G++)F[G]=e.readFloat();else for(let G=V;G<N;G++)F[G]=e.readFloat()*o;if(!E)for(let G=0,W=F.length;G<W;G++)F[G]+=R[G]}if(Y.setFrame(X,$,F),X===A)break;const k=e.readFloat();switch(e.readByte()){case Ks:Y.setStepped(X);break;case Zs:gt(e,Y,D++,X,0,$,k,0,1,1)}$=k}r.push(Y);break}case YO:{const P=new Fh(_,v,w);for(let E=0;E<_;E++){const R=e.readFloat(),O=e.readInt32();P.setFrame(E,R,nS[O&15],O>>4,e.readFloat())}r.push(P);break}}}}}const a=i.slots.length,c=e.readInt(!0);if(c>0){const f=new _r(c);for(let m=0;m<c;m++)f.setFrame(m,e.readFloat(),_y(e,a));r.push(f)}const l=e.readInt(!0);for(let f=0;f<l;f++){const m=e.readInt(!0),p=new Array(m);for(let v=0;v<m;v++)p[v]=e.readInt(!0);const g=e.readInt(!0),x=new ma(g,p,a);for(let v=0;v<g;v++)x.setFrame(v,e.readFloat(),_y(e,m));r.push(x)}const h=e.readInt(!0);if(h>0){const f=new Tl(h);for(let m=0;m<h;m++){const p=e.readFloat(),g=i.events[e.readInt(!0)],x=new $p(p,g);x.intValue=e.readInt(!1),x.floatValue=e.readFloat(),x.stringValue=e.readString(),x.stringValue==null&&(x.stringValue=g.setupPose.stringValue),x.data.audioPath&&(x.volume=e.readFloat(),x.balance=e.readFloat()),f.setFrame(m,x)}r.push(f)}let u=0;for(let f=0,m=r.length;f<m;f++)u=Math.max(u,r[f].getDuration());const d=new Lp(t,r,u);return n&&nt.rgba8888ToColor(d.color,e.readInt32()),d}}class gO{constructor(e,t=[],i=0,n=new DataView(e instanceof ArrayBuffer?e:e.buffer)){M(this,"strings");M(this,"index");M(this,"buffer");this.strings=t,this.index=i,this.buffer=n}readByte(){return this.buffer.getInt8(this.index++)}readUnsignedByte(){return this.buffer.getUint8(this.index++)}readShort(){const e=this.buffer.getInt16(this.index);return this.index+=2,e}readInt32(){const e=this.buffer.getInt32(this.index);return this.index+=4,e}readInt(e){let t=this.readByte(),i=t&127;return(t&128)!==0&&(t=this.readByte(),i|=(t&127)<<7,(t&128)!==0&&(t=this.readByte(),i|=(t&127)<<14,(t&128)!==0&&(t=this.readByte(),i|=(t&127)<<21,(t&128)!==0&&(t=this.readByte(),i|=(t&127)<<28)))),e?i:i>>>1^-(i&1)}readStringRef(){const e=this.readInt(!0);return e===0?null:this.strings[e-1]}readString(){let e=this.readInt(!0);switch(e){case 0:return null;case 1:return""}e--;let t="";for(let i=0;i<e;){const n=this.readUnsignedByte();switch(n>>4){case 12:case 13:t+=String.fromCharCode((n&31)<<6|this.readByte()&63),i+=2;break;case 14:t+=String.fromCharCode((n&15)<<12|(this.readByte()&63)<<6|this.readByte()&63),i+=3;break;default:t+=String.fromCharCode(n),i++}}return t}readFloat(){const e=this.buffer.getFloat32(this.index);return this.index+=4,e}readBoolean(){return this.readByte()!==0}}let vO=class{constructor(e,t,i,n,r,o){M(this,"source");M(this,"skinIndex");M(this,"slotIndex");M(this,"sourceIndex");M(this,"mesh");M(this,"inheritTimelines");this.mesh=e,this.skinIndex=t,this.slotIndex=i,this.sourceIndex=n,this.source=r,this.inheritTimelines=o}};class Ty{constructor(e=null,t,i=0){M(this,"bones");M(this,"vertices");M(this,"length");this.bones=e,this.vertices=t,this.length=i}}var _n;(function(s){s[s.Region=0]="Region",s[s.BoundingBox=1]="BoundingBox",s[s.Mesh=2]="Mesh",s[s.LinkedMesh=3]="LinkedMesh",s[s.Path=4]="Path",s[s.Point=5]="Point",s[s.Clipping=6]="Clipping"})(_n||(_n={}));function ri(s,e,t,i){t instanceof Bn?yO(s,e,t,i):xO(s,e,t,i)}function yO(s,e,t,i){let n=s.readFloat(),r=s.readFloat()*i;for(let o=0,a=0,c=t.getFrameCount()-1;t.setFrame(o,n,r),o!==c;o++){const l=s.readFloat(),h=s.readFloat()*i;switch(s.readByte()){case Ks:t.setStepped(o);break;case Zs:gt(s,t,a++,o,0,n,l,r,h,i)}n=l,r=h}e.push(t)}function xO(s,e,t,i){let n=s.readFloat(),r=s.readFloat()*i,o=s.readFloat()*i;for(let a=0,c=0,l=t.getFrameCount()-1;t.setFrame(a,n,r,o),a!==l;a++){const h=s.readFloat(),u=s.readFloat()*i,d=s.readFloat()*i;switch(s.readByte()){case Ks:t.setStepped(a);break;case Zs:gt(s,t,c++,a,0,n,h,r,u,i),gt(s,t,c++,a,1,n,h,o,d,i)}n=h,r=u,o=d}e.push(t)}function _y(s,e){const t=s.readInt(!0);if(t===0)return null;const i=new Array(e).fill(-1),n=new Array(e-t);let r=0,o=0;for(let a=0;a<t;a++){const c=s.readInt(!0);for(;r!==c;)n[o++]=r++;i[r+s.readInt(!0)]=r++}for(;r<e;)n[o++]=r++;for(let a=e-1;a>=0;a--)i[a]===-1&&(i[a]=n[--o]);return i}function gt(s,e,t,i,n,r,o,a,c,l){e.setBezier(t,i,n,r,a,s.readFloat(),s.readFloat()*l,s.readFloat(),s.readFloat()*l,o,c)}const bO=0,wO=1,SO=2,MO=3,TO=4,_O=5,CO=6,EO=7,AO=8,IO=9,RO=10,PO=0,kO=1,FO=2,OO=3,LO=4,BO=5,NO=0,DO=1,UO=2,$O=3,XO=4,VO=0,YO=1,GO=0,jO=1,HO=2,WO=0,zO=1,qO=2,KO=4,ZO=5,JO=6,QO=7,eL=8,tL=0,iL=1,Ks=1,Zs=2;class sL{constructor(e){M(this,"attachmentLoader");M(this,"scale",1);M(this,"linkedMeshes",[]);this.attachmentLoader=e}readSkeletonData(e){const t=this.scale,i=new DS,n=typeof e=="string"?JSON.parse(e):e,r=n.skeleton;if(r&&(i.hash=r.hash,i.version=r.spine,i.x=r.x,i.y=r.y,i.width=r.width,i.height=r.height,i.referenceScale=te(r,"referenceScale",100)*t,i.fps=r.fps,i.imagesPath=r.images??null,i.audioPath=r.audio??null),n.bones)for(let o=0;o<n.bones.length;o++){const a=n.bones[o];let c=null;const l=te(a,"parent",null);l&&(c=i.findBone(l));const h=new wu(i.bones.length,a.name,c);h.length=te(a,"length",0)*t;const u=h.setupPose;u.x=te(a,"x",0)*t,u.y=te(a,"y",0)*t,u.rotation=te(a,"rotation",0),u.scaleX=te(a,"scaleX",1),u.scaleY=te(a,"scaleY",1),u.shearX=te(a,"shearX",0),u.shearY=te(a,"shearY",0),u.inherit=Ge.enumValue(zt,te(a,"inherit","Normal")),h.skinRequired=te(a,"skin",!1);const d=te(a,"color",null);d&&h.color.setFromString(d),h.icon=te(a,"icon",void 0),h.iconSize=te(a,"iconSize",1),h.iconRotation=te(a,"iconRotation",0),i.bones.push(h)}if(n.slots)for(let o=0;o<n.slots.length;o++){const a=n.slots[o],c=a.name,l=i.findBone(a.bone);if(!l)throw new Error(`Couldn't find bone ${a.bone} for slot ${c}`);const h=new US(i.slots.length,c,l),u=te(a,"color",null);u&&h.setupPose.color.setFromString(u);const d=te(a,"dark",null);d&&(h.setupPose.darkColor=nt.fromString(d)),h.attachmentName=te(a,"attachment",null),h.blendMode=Ge.enumValue(Lh,te(a,"blend","normal")),h.visible=te(a,"visible",!0),i.slots.push(h)}if(n.constraints)for(const o of n.constraints){const a=o.name,c=te(o,"skin",!1);switch(te(o,"type",!1)){case"ik":{const l=new Xc(a);l.skinRequired=c;for(let m=0;m<o.bones.length;m++){const p=i.findBone(o.bones[m]);if(!p)throw new Error(`Couldn't find bone ${o.bones[m]} for IK constraint ${a}.`);l.bones.push(p)}const h=o.target,u=i.findBone(h);if(!u)throw new Error(`Couldn't find target bone ${h} for IK constraint ${a}.`);l.target=u;const d=te(o,"scaleY",null);d!=null&&(l.scaleYMode=Ge.enumValue(Xi,d));const f=l.setupPose;f.mix=te(o,"mix",1),f.softness=te(o,"softness",0)*t,f.bendDirection=te(o,"bendPositive",!0)?1:-1,f.compress=te(o,"compress",!1),f.stretch=te(o,"stretch",!1),i.constraints.push(l);break}case"transform":{const l=new _t(a);l.skinRequired=c;for(let S=0;S<o.bones.length;S++){const C=o.bones[S],w=i.findBone(C);if(!w)throw new Error(`Couldn't find bone ${C} for transform constraint ${o.name}.`);l.bones.push(w)}const h=o.source,u=i.findBone(h);if(!u)throw new Error(`Couldn't find source bone ${h} for transform constraint ${o.name}.`);l.source=u,l.localSource=te(o,"localSource",!1),l.localTarget=te(o,"localTarget",!1),l.additive=te(o,"additive",!1),l.clamp=te(o,"clamp",!1);let d=!1,f=!1,m=!1,p=!1,g=!1,x=!1;const v=Object.entries(te(o,"properties",{}));for(const[S,C]of v){const w=this.fromProperty(S),b=this.propertyScale(S,t);w.offset=te(C,"offset",0)*b;const _=Object.entries(te(C,"to",{}));for(const[A,P]of _){let E=1,R;switch(A){case"rotate":{d=!0,R=new $S;break}case"x":{f=!0,R=new XS,E=t;break}case"y":{m=!0,R=new VS,E=t;break}case"scaleX":{p=!0,R=new YS;break}case"scaleY":{g=!0,R=new GS;break}case"shearY":{x=!0,R=new jS;break}default:throw new Error(`Invalid transform constraint to property: ${A}`)}R.offset=te(P,"offset",0)*E,R.max=te(P,"max",1)*E,R.scale=te(P,"scale",1)*E/b,w.to.push(R)}w.to.length>0&&l.properties.push(w)}l.offsets[_t.ROTATION]=te(o,"rotation",0),l.offsets[_t.X]=te(o,"x",0)*t,l.offsets[_t.Y]=te(o,"y",0)*t,l.offsets[_t.SCALEX]=te(o,"scaleX",0),l.offsets[_t.SCALEY]=te(o,"scaleY",0),l.offsets[_t.SHEARY]=te(o,"shearY",0);const y=l.setupPose;d&&(y.mixRotate=te(o,"mixRotate",1)),f&&(y.mixX=te(o,"mixX",1)),m&&(y.mixY=te(o,"mixY",y.mixX)),p&&(y.mixScaleX=te(o,"mixScaleX",1)),g&&(y.mixScaleY=te(o,"mixScaleY",y.mixScaleX)),x&&(y.mixShearY=te(o,"mixShearY",1)),i.constraints.push(l);break}case"path":{const l=new Vc(a);l.skinRequired=c;for(let f=0;f<o.bones.length;f++){const m=o.bones[f],p=i.findBone(m);if(!p)throw new Error(`Couldn't find bone ${m} for path constraint ${o.name}.`);l.bones.push(p)}const h=o.slot,u=i.findSlot(h);if(!u)throw new Error(`Couldn't find slot ${h} for path constraint ${o.name}.`);l.slot=u,l.positionMode=Ge.enumValue(dn,te(o,"positionMode","Percent")),l.spacingMode=Ge.enumValue(mi,te(o,"spacingMode","Length")),l.rotateMode=Ge.enumValue(co,te(o,"rotateMode","Tangent")),l.offsetRotation=te(o,"rotation",0);const d=l.setupPose;d.position=te(o,"position",0),l.positionMode===dn.Fixed&&(d.position*=t),d.spacing=te(o,"spacing",0),(l.spacingMode===mi.Length||l.spacingMode===mi.Fixed)&&(d.spacing*=t),d.mixRotate=te(o,"mixRotate",1),d.mixX=te(o,"mixX",1),d.mixY=te(o,"mixY",d.mixX),i.constraints.push(l);break}case"physics":{const l=new Yc(a);l.skinRequired=c;const h=o.bone,u=i.findBone(h);if(u==null)throw new Error(`Physics bone not found: ${h}`);l.bone=u,l.x=te(o,"x",0),l.y=te(o,"y",0),l.rotate=te(o,"rotate",0),l.scaleX=te(o,"scaleX",0);const d=te(o,"scaleY",null);d!=null&&(l.scaleYMode=Ge.enumValue(Xi,d)),l.shearX=te(o,"shearX",0),l.limit=te(o,"limit",5e3)*t,l.step=1/te(o,"fps",60);const f=l.setupPose;f.inertia=te(o,"inertia",.5),f.strength=te(o,"strength",100),f.damping=te(o,"damping",.85),f.massInverse=1/te(o,"mass",1),f.wind=te(o,"wind",0),f.gravity=te(o,"gravity",0),f.mix=te(o,"mix",1),l.inertiaGlobal=te(o,"inertiaGlobal",!1),l.strengthGlobal=te(o,"strengthGlobal",!1),l.dampingGlobal=te(o,"dampingGlobal",!1),l.massGlobal=te(o,"massGlobal",!1),l.windGlobal=te(o,"windGlobal",!1),l.gravityGlobal=te(o,"gravityGlobal",!1),l.mixGlobal=te(o,"mixGlobal",!1),i.constraints.push(l);break}case"slider":{const l=new Jr(a);l.skinRequired=c,l.additive=te(o,"additive",!1),l.loop=te(o,"loop",!1),l.setupPose.mix=te(o,"mix",1);const h=o.bone;if(h){if(l.bone=i.findBone(h),!l.bone)throw new Error(`Slider bone not found: ${h}`);const u=o.property;l.property=this.fromProperty(u);const d=this.propertyScale(u,t);l.property.offset=te(o,"from",0)*d,l.offset=te(o,"to",0),l.scale=te(o,"scale",1)/d,l.max=te(o,"max",0),l.local=te(o,"local",!1)}else l.setupPose.time=te(o,"time",0);i.constraints.push(l);break}}}if(n.skins)for(let o=0;o<n.skins.length;o++){const a=n.skins[o],c=new $m(a.name);if(a.bones)for(let l=0;l<a.bones.length;l++){const h=a.bones[l],u=i.findBone(h);if(!u)throw new Error(`Couldn't find bone ${h} for skin ${a.name}.`);c.bones.push(u)}if(a.ik)for(let l=0;l<a.ik.length;l++){const h=a.ik[l],u=i.findConstraint(h,Xc);if(!u)throw new Error(`Couldn't find IK constraint ${h} for skin ${a.name}.`);c.constraints.push(u)}if(a.transform)for(let l=0;l<a.transform.length;l++){const h=a.transform[l],u=i.findConstraint(h,_t);if(!u)throw new Error(`Couldn't find transform constraint ${h} for skin ${a.name}.`);c.constraints.push(u)}if(a.path)for(let l=0;l<a.path.length;l++){const h=a.path[l],u=i.findConstraint(h,Vc);if(!u)throw new Error(`Couldn't find path constraint ${h} for skin ${a.name}.`);c.constraints.push(u)}if(a.physics)for(let l=0;l<a.physics.length;l++){const h=a.physics[l],u=i.findConstraint(h,Yc);if(!u)throw new Error(`Couldn't find physics constraint ${h} for skin ${a.name}.`);c.constraints.push(u)}if(a.slider)for(let l=0;l<a.slider.length;l++){const h=a.slider[l],u=i.findConstraint(h,Jr);if(!u)throw new Error(`Couldn't find slider constraint ${h} for skin ${a.name}.`);c.constraints.push(u)}for(const l in a.attachments){const h=i.findSlot(l);if(!h)throw new Error(`Couldn't find skin slot ${l} for skin ${a.name}.`);const u=a.attachments[l];for(const d in u){const f=this.readAttachment(u[d],c,h.index,d,i);f&&c.setAttachment(h.index,d,f)}}i.skins.push(c),c.name==="default"&&(i.defaultSkin=c)}for(let o=0,a=this.linkedMeshes.length;o<a;o++){const c=this.linkedMeshes[o],l=c.skin?i.findSkin(c.skin):i.defaultSkin;if(!l)throw new Error(`Skin not found: ${c.skin}`);const h=l.getAttachment(c.sourceIndex,c.source);if(!h)throw new Error(`Source mesh not found: ${c.source}`);c.mesh.timelineAttachment=c.inheritTimelines?h:c.mesh,c.mesh.setSourceMesh(h),c.mesh.updateSequence();e:if(c.inheritTimelines&&c.slotIndex!==c.sourceIndex){const u=h.timelineSlots;for(const f of u)if(f===c.slotIndex)break e;const d=[...u];d[u.length]=c.slotIndex,h.timelineSlots=d}}if(this.linkedMeshes.length=0,n.events)for(const o in n.events){const a=n.events[o],c=new NS(o),l=c.setupPose;l.intValue=te(a,"int",0),l.floatValue=te(a,"float",0),l.stringValue=te(a,"string",""),c._audioPath=te(a,"audio",null),c.audioPath&&(l.volume=te(a,"volume",l.volume),l.balance=te(a,"balance",l.balance)),i.events.push(c)}if(n.animations)for(const o in n.animations){const a=n.animations[o];this.readAnimation(a,o,i)}if(n.constraints)for(const o in n.constraints){const a=n.constraints[o];if(a.type==="slider"){const c=i.findConstraint(a.name,Jr),l=a.animation,h=i.findAnimation(l);if(!h)throw new Error(`Slider animation not found: ${l}`);c.animation=h}}return i}fromProperty(e){let t;switch(e){case"rotate":t=new Vm;break;case"x":t=new Ym;break;case"y":t=new Gm;break;case"scaleX":t=new jm;break;case"scaleY":t=new Hm;break;case"shearY":t=new Wm;break;default:throw new Error(`Invalid transform constraint from property: ${e}`)}return t}propertyScale(e,t){switch(e){case"x":case"y":return t;default:return 1}}readAttachment(e,t,i,n,r){const o=this.scale,a=te(e,"name",n);switch(te(e,"type","region")){case"region":{const c=te(e,"path",a),l=this.readSequence(te(e,"sequence",null)),h=this.attachmentLoader.newRegionAttachment(t,n,a,c,l);if(!h)return null;h.path=c,h.x=te(e,"x",0)*o,h.y=te(e,"y",0)*o,h.scaleX=te(e,"scaleX",1),h.scaleY=te(e,"scaleY",1),h.rotation=te(e,"rotation",0),h.width=e.width*o,h.height=e.height*o;const u=te(e,"color",null);return u&&h.color.setFromString(u),h.updateSequence(),h}case"boundingbox":{const c=this.attachmentLoader.newBoundingBoxAttachment(t,n,a);if(!c)return null;this.readVertices(e,c,e.vertexCount<<1);const l=te(e,"color",null);return l&&c.color.setFromString(l),c}case"mesh":case"linkedmesh":{const c=te(e,"path",a),l=this.readSequence(te(e,"sequence",null)),h=this.attachmentLoader.newMeshAttachment(t,n,a,c,l);if(!h)return null;h.path=c;const u=te(e,"color",null);u&&h.color.setFromString(u),h.width=te(e,"width",0)*o,h.height=te(e,"height",0)*o;const d=te(e,"source",null);if(d){let m=i;const p=te(e,"slot",null);if(p){const g=r.findSlot(p);if(!g)throw new Error(`Source mesh slot not found: ${p}`);m=g.index}return this.linkedMeshes.push(new nL(h,te(e,"skin",null),i,m,d,te(e,"timelines",!0))),h}const f=e.uvs;return this.readVertices(e,h,f.length),h.triangles=e.triangles,h.regionUVs=f,h.edges=te(e,"edges",null),h.hullLength=te(e,"hull",0)*2,h.updateSequence(),h}case"path":{const c=this.attachmentLoader.newPathAttachment(t,n,a);if(!c)return null;c.closed=te(e,"closed",!1),c.constantSpeed=te(e,"constantSpeed",!0);const l=e.vertexCount;this.readVertices(e,c,l<<1);const h=Ge.newArray(l/3,0);for(let d=0;d<e.lengths.length;d++)h[d]=e.lengths[d]*o;c.lengths=h;const u=te(e,"color",null);return u&&c.color.setFromString(u),c}case"point":{const c=this.attachmentLoader.newPointAttachment(t,n,a);if(!c)return null;c.x=te(e,"x",0)*o,c.y=te(e,"y",0)*o,c.rotation=te(e,"rotation",0);const l=te(e,"color",null);return l&&c.color.setFromString(l),c}case"clipping":{const c=this.attachmentLoader.newClippingAttachment(t,n,a);if(!c)return null;const l=te(e,"end",null);l&&(c.endSlot=r.findSlot(l)),c.convex=te(e,"convex",!1),c.inverse=te(e,"inverse",!1);const h=e.vertexCount;this.readVertices(e,c,h<<1);const u=te(e,"color",null);return u&&c.color.setFromString(u),c}}return null}readSequence(e){if(e==null)return new fa(1,!1);const t=new fa(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 n=this.scale;t.worldVerticesLength=i;const r=e.vertices;if(i===r.length){const c=Ge.toFloatArray(r);if(n!==1)for(let l=0,h=r.length;l<h;l++)c[l]*=n;t.vertices=c;return}const o=[],a=[];for(let c=0,l=r.length;c<l;){const h=r[c++];a.push(h);for(let u=c+h*4;c<u;c+=4)a.push(r[c]),o.push(r[c+1]*n),o.push(r[c+2]*n),o.push(r[c+3])}t.bones=a,t.vertices=Ge.toFloatArray(o)}readAnimation(e,t,i){const n=this.scale,r=[];if(e.slots)for(const l in e.slots){const h=e.slots[l],u=i.findSlot(l);if(!u)throw new Error(`Slot not found: ${l}`);const d=u.index;for(const f in h){const m=h[f];if(!m)continue;const p=m.length;switch(f){case"attachment":{const g=new sl(p,d);for(let x=0;x<p;x++){const v=m[x];g.setFrame(x,te(v,"time",0),te(v,"name",null))}r.push(g);break}case"rgba":{const g=new pS(p,p<<2,d);let x=m[0],v=te(x,"time",0),y=nt.fromString(x.color);for(let S=0,C=0;;S++){g.setFrame(S,v,y.r,y.g,y.b,y.a);const w=m[S+1];if(!w){g.shrink(C);break}const b=te(w,"time",0),_=nt.fromString(w.color),A=x.curve;A&&(C=xt(A,g,C,S,0,v,b,y.r,_.r,1),C=xt(A,g,C,S,1,v,b,y.g,_.g,1),C=xt(A,g,C,S,2,v,b,y.b,_.b,1),C=xt(A,g,C,S,3,v,b,y.a,_.a,1)),v=b,y=_,x=w}r.push(g);break}case"rgb":{const g=new gS(p,p*3,d);let x=m[0],v=te(x,"time",0),y=nt.fromString(x.color);for(let S=0,C=0;;S++){g.setFrame(S,v,y.r,y.g,y.b);const w=m[S+1];if(!w){g.shrink(C);break}const b=te(w,"time",0),_=nt.fromString(w.color),A=x.curve;A&&(C=xt(A,g,C,S,0,v,b,y.r,_.r,1),C=xt(A,g,C,S,1,v,b,y.g,_.g,1),C=xt(A,g,C,S,2,v,b,y.b,_.b,1)),v=b,y=_,x=w}r.push(g);break}case"alpha":{Qi(r,m,new vS(p,p,d),0,1);break}case"rgba2":{const g=new yS(p,p*7,d);let x=m[0],v=te(x,"time",0),y=nt.fromString(x.light),S=nt.fromString(x.dark);for(let C=0,w=0;;C++){g.setFrame(C,v,y.r,y.g,y.b,y.a,S.r,S.g,S.b);const b=m[C+1];if(!b){g.shrink(w);break}const _=te(b,"time",0),A=nt.fromString(b.light),P=nt.fromString(b.dark),E=x.curve;E&&(w=xt(E,g,w,C,0,v,_,y.r,A.r,1),w=xt(E,g,w,C,1,v,_,y.g,A.g,1),w=xt(E,g,w,C,2,v,_,y.b,A.b,1),w=xt(E,g,w,C,3,v,_,y.a,A.a,1),w=xt(E,g,w,C,4,v,_,S.r,P.r,1),w=xt(E,g,w,C,5,v,_,S.g,P.g,1),w=xt(E,g,w,C,6,v,_,S.b,P.b,1)),v=_,y=A,S=P,x=b}r.push(g);break}case"rgb2":{const g=new xS(p,p*6,d);let x=m[0],v=te(x,"time",0),y=nt.fromString(x.light),S=nt.fromString(x.dark);for(let C=0,w=0;;C++){g.setFrame(C,v,y.r,y.g,y.b,S.r,S.g,S.b);const b=m[C+1];if(!b){g.shrink(w);break}const _=te(b,"time",0),A=nt.fromString(b.light),P=nt.fromString(b.dark),E=x.curve;E&&(w=xt(E,g,w,C,0,v,_,y.r,A.r,1),w=xt(E,g,w,C,1,v,_,y.g,A.g,1),w=xt(E,g,w,C,2,v,_,y.b,A.b,1),w=xt(E,g,w,C,3,v,_,S.r,P.r,1),w=xt(E,g,w,C,4,v,_,S.g,P.g,1),w=xt(E,g,w,C,5,v,_,S.b,P.b,1)),v=_,y=A,S=P,x=b}r.push(g);break}default:throw new Error(`Invalid timeline type for a slot: ${m.name} (${h.name})`)}}}if(e.bones)for(const l in e.bones){const h=e.bones[l],u=i.findBone(l);if(!u)throw new Error(`Bone not found: ${l}`);const d=u.index;for(const f in h){const m=h[f],p=m.length;if(p!==0)switch(f){case"rotate":Qi(r,m,new kh(p,p,d),0,1);break;case"translate":yf(r,m,new rS(p,p<<1,d),"x","y",0,n);break;case"translatex":Qi(r,m,new oS(p,p,d),0,n);break;case"translatey":Qi(r,m,new aS(p,p,d),0,n);break;case"scale":yf(r,m,new lS(p,p<<1,d),"x","y",1,1);break;case"scalex":Qi(r,m,new cS(p,p,d),1,1);break;case"scaley":Qi(r,m,new hS(p,p,d),1,1);break;case"shear":yf(r,m,new uS(p,p<<1,d),"x","y",0,1);break;case"shearx":Qi(r,m,new dS(p,p,d),0,1);break;case"sheary":Qi(r,m,new fS(p,p,d),0,1);break;case"inherit":{const g=new mS(p,u.index);for(let x=0;x<m.length;x++){const v=m[x];g.setFrame(x,te(v,"time",0),Ge.enumValue(zt,te(v,"inherit","Normal")))}r.push(g);break}default:throw new Error(`Invalid timeline type for a bone: ${m.name} (${h.name})`)}}}if(e.ik)for(const l in e.ik){const h=e.ik[l];let u=h[0];if(!u)continue;const d=i.findConstraint(l,Xc);if(!d)throw new Error(`IK Constraint not found: ${l}`);const f=new wS(h.length,h.length<<1,i.constraints.indexOf(d));let m=te(u,"time",0),p=te(u,"mix",1),g=te(u,"softness",0)*n;for(let x=0,v=0;;x++){f.setFrame(x,m,p,g,te(u,"bendPositive",!0)?1:-1,te(u,"compress",!1),te(u,"stretch",!1));const y=h[x+1];if(!y){f.shrink(v);break}const S=te(y,"time",0),C=te(y,"mix",1),w=te(y,"softness",0)*n,b=u.curve;b&&(v=xt(b,f,v,x,0,m,S,p,C,1),v=xt(b,f,v,x,1,m,S,g,w,n)),m=S,p=C,g=w,u=y}r.push(f)}if(e.transform)for(const l in e.transform){const h=e.transform[l];let u=h[0];if(!u)continue;const d=i.findConstraint(l,_t);if(!d)throw new Error(`Transform constraint not found: ${l}`);const f=new SS(h.length,h.length*6,i.constraints.indexOf(d));let m=te(u,"time",0),p=te(u,"mixRotate",1),g=te(u,"mixX",1),x=te(u,"mixY",g),v=te(u,"mixScaleX",1),y=te(u,"mixScaleY",1),S=te(u,"mixShearY",1);for(let C=0,w=0;;C++){f.setFrame(C,m,p,g,x,v,y,S);const b=h[C+1];if(!b){f.shrink(w);break}const _=te(b,"time",0),A=te(b,"mixRotate",1),P=te(b,"mixX",1),E=te(b,"mixY",P),R=te(b,"mixScaleX",1),O=te(b,"mixScaleY",1),U=te(b,"mixShearY",1),Y=u.curve;Y&&(w=xt(Y,f,w,C,0,m,_,p,A,1),w=xt(Y,f,w,C,1,m,_,g,P,1),w=xt(Y,f,w,C,2,m,_,x,E,1),w=xt(Y,f,w,C,3,m,_,v,R,1),w=xt(Y,f,w,C,4,m,_,y,O,1),w=xt(Y,f,w,C,5,m,_,S,U,1)),m=_,p=A,g=P,x=E,v=R,y=O,S=U,u=b}r.push(f)}if(e.path)for(const l in e.path){const h=e.path[l],u=i.findConstraint(l,Vc);if(!u)throw new Error(`Path constraint not found: ${l}`);const d=i.constraints.indexOf(u);for(const f in h){const m=h[f];let p=m[0];if(!p)continue;const g=m.length;switch(f){case"position":{const x=new MS(g,g,d);Qi(r,m,x,0,u.positionMode===dn.Fixed?n:1);break}case"spacing":{const x=new TS(g,g,d);Qi(r,m,x,0,u.spacingMode===mi.Length||u.spacingMode===mi.Fixed?n:1);break}case"mix":{const x=new _S(g,g*3,d);let v=te(p,"time",0),y=te(p,"mixRotate",1),S=te(p,"mixX",1),C=te(p,"mixY",S);for(let w=0,b=0;;w++){x.setFrame(w,v,y,S,C);const _=m[w+1];if(!_){x.shrink(b);break}const A=te(_,"time",0),P=te(_,"mixRotate",1),E=te(_,"mixX",1),R=te(_,"mixY",E),O=p.curve;O&&(b=xt(O,x,b,w,0,v,A,y,P,1),b=xt(O,x,b,w,1,v,A,S,E,1),b=xt(O,x,b,w,2,v,A,C,R,1)),v=A,y=P,S=E,C=R,p=_}r.push(x);break}}}}if(e.physics)for(const l in e.physics){const h=e.physics[l];let u=-1;if(l.length>0){const d=i.findConstraint(l,Yc);if(!d)throw new Error(`Physics constraint not found: ${l}`);u=i.constraints.indexOf(d)}for(const d in h){const f=h[d];let m=f[0];if(!m)continue;const p=f.length;let g,x=0;if(d==="reset"){const v=new Oh(p,u);for(let y=0;m!=null;m=f[y+1],y++)v.setFrame(y,te(m,"time",0));r.push(v);continue}switch(d){case"inertia":g=new CS(p,p,u);break;case"strength":g=new ES(p,p,u);break;case"damping":g=new AS(p,p,u);break;case"mass":g=new IS(p,p,u);break;case"wind":g=new RS(p,p,u);break;case"gravity":g=new PS(p,p,u);break;case"mix":{x=1,g=new kS(p,p,u);break}default:continue}Qi(r,f,g,x,1)}}if(e.slider)for(const l in e.slider){const h=e.slider[l],u=i.findConstraint(l,Jr);if(!u)throw new Error(`Slider not found: ${l}`);const d=i.constraints.indexOf(u);for(const f in h){const m=h[f];if(!m[0])continue;const g=m.length;switch(f){case"time":Qi(r,m,new FS(g,g,d),1,1);break;case"mix":Qi(r,m,new OS(g,g,d),1,1);break}}}if(e.attachments)for(const l in e.attachments){const h=e.attachments[l],u=i.findSkin(l);if(!u)throw new Error(`Skin not found: ${l}`);for(const d in h){const f=h[d],m=i.findSlot(d);if(!m)throw new Error(`Attachment slot not found: ${d}`);const p=m.index;for(const g in f){const x=f[g],v=u.getAttachment(p,g);if(!v)throw new Error(`Timeline attachment not found: ${g}`);for(const y in x){const S=x[y];let C=S[0];if(C){if(y==="deform"){const w=v.bones,b=v.vertices,_=w?b.length/3*2:b.length,A=new bS(S.length,S.length,p,v);let P=te(C,"time",0);for(let E=0,R=0;;E++){let O;const U=te(C,"vertices",null);if(!U)O=w?Ge.newFloatArray(_):b;else{O=Ge.newFloatArray(_);const D=te(C,"offset",0);if(Ge.arrayCopy(U,0,O,D,U.length),n!==1)for(let F=D,N=F+U.length;F<N;F++)O[F]*=n;if(!w)for(let F=0;F<_;F++)O[F]+=b[F]}A.setFrame(E,P,O);const Y=S[E+1];if(!Y){A.shrink(R);break}const $=te(Y,"time",0),X=C.curve;X&&(R=xt(X,A,R,E,0,P,$,0,1,1)),P=$,C=Y}r.push(A)}else if(y==="sequence"){const w=new Fh(S.length,p,v);let b=0;for(let _=0;_<S.length;_++){const A=te(C,"delay",b),P=te(C,"time",0),E=_i[te(C,"mode","hold")],R=te(C,"index",0);w.setFrame(_,P,E,R,A),b=A,C=S[_+1]}r.push(w)}}}}}}if(e.drawOrder){const l=new _r(e.drawOrder.length),h=i.slots.length;let u=0;for(const d of e.drawOrder)l.setFrame(u++,te(d,"time",0),Cy(i,d,h,null));r.push(l)}if(e.drawOrderFolder)for(const l of e.drawOrderFolder){const h=te(l,"slots",[]),u=new Array(h.length);let d=0;for(const g of h){const x=i.findSlot(g);if(!x)throw new Error(`Draw order folder slot not found: ${g}`);u[d++]=x.index}const f=te(l,"keys",[]),m=new ma(f.length,u,i.slots.length);let p=0;for(const g of f)m.setFrame(p++,te(g,"time",0),Cy(i,g,u.length,u));r.push(m)}if(e.events){const l=new Tl(e.events.length);let h=0;for(let u=0;u<e.events.length;u++,h++){const d=e.events[u],f=i.findEvent(d.name);if(!f)throw new Error(`Event not found: ${d.name}`);const m=f.setupPose,p=new $p(Ge.toSinglePrecision(te(d,"time",0)),f);p.intValue=te(d,"int",m.intValue),p.floatValue=te(d,"float",m.floatValue),p.stringValue=te(d,"string",m.stringValue),p.data.audioPath&&(p.volume=te(d,"volume",m.volume),p.balance=te(d,"balance",m.volume)),l.setFrame(h,p)}r.push(l)}let o=0;for(let l=0,h=r.length;l<h;l++)o=Math.max(o,r[l].getDuration());const a=new Lp(t,r,o),c=te(e,"color",null);c!==null&&a.color.setFromString(c),i.animations.push(a)}}class nL{constructor(e,t,i,n,r,o){M(this,"source");M(this,"skin");M(this,"slotIndex");M(this,"sourceIndex");M(this,"mesh");M(this,"inheritTimelines");this.mesh=e,this.skin=t,this.slotIndex=i,this.sourceIndex=n,this.source=r,this.inheritTimelines=o}}function Qi(s,e,t,i,n){let r=e[0],o=r.time??0,a=(r.value??i)*n,c=0;for(let l=0;;l++){t.setFrame(l,o,a);const h=e[l+1];if(!h){t.shrink(c),s.push(t);return}const u=h.time??0,d=(h.value??i)*n;r.curve&&(c=xt(r.curve,t,c,l,0,o,u,a,d,n)),o=u,a=d,r=h}}function yf(s,e,t,i,n,r,o){let a=e[0],c=a.time??0,l=(a[i]??r)*o,h=(a[n]??r)*o,u=0;for(let d=0;;d++){t.setFrame(d,c,l,h);const f=e[d+1];if(!f){t.shrink(u),s.push(t);return}const m=f.time??0,p=(f[i]??r)*o,g=(f[n]??r)*o,x=a.curve;x&&(u=xt(x,t,u,d,0,c,m,l,p,o),u=xt(x,t,u,d,1,c,m,h,g,o)),c=m,l=p,h=g,a=f}}function Cy(s,e,t,i){const n=e.offsets;if(!n)return null;const r=new Array(t).fill(-1),o=new Array(t-n.length);let a=0,c=0;for(const l of n){const h=s.findSlot(l.slot);if(h==null)throw new Error(`Draw order slot not found: ${l.slot}`);let u=0;if(!i)u=h.index;else{u=-1;for(let d=0;d<t;d++)if(i[d]===h.index){u=d;break}if(u===-1)throw new Error(`Slot not in folder: ${l.slot}`)}for(;a!==u;)o[c++]=a++;r[a+l.offset]=a++}for(;a<t;)o[c++]=a++;for(let l=t-1;l>=0;l--)r[l]===-1&&(r[l]=o[--c]);return r}function xt(s,e,t,i,n,r,o,a,c,l){if(s==="stepped")return e.setStepped(i),t;const h=n<<2,u=s[h],d=s[h+1]*l,f=s[h+2],m=s[h+3]*l;return e.setBezier(t,i,n,r,a,u,d,f,m,o,c),t+1}function te(s,e,t){return s[e]!==void 0?s[e]:t}class rL{newRegionAttachment(e,t,i,n){return new gu(t,i)}newMeshAttachment(e,t,i,n){return new Ol(t,i)}newBoundingBoxAttachment(e,t){return new yw(t)}newPathAttachment(e,t){return new Ml(t)}newPointAttachment(e,t){return new Tw(t)}newClippingAttachment(e,t){return new na(t)}}class oL{sequence(e){for(let t=0;t<e.regions.length;t++){if(e.regions[t])continue;const i=new iS;i.u=0,i.v=0,i.u2=1,i.v2=1,i.width=1,i.height=1,i.originalWidth=1,i.originalHeight=1,i.offsetX=0,i.offsetY=0,i.degrees=0,e.regions[t]=i}return e}newRegionAttachment(e,t,i,n,r){return new da(i,this.sequence(r))}newMeshAttachment(e,t,i,n,r){return new Ar(i,this.sequence(r))}newBoundingBoxAttachment(e,t,i){return new Np(i)}newPathAttachment(e,t,i){return new _l(i)}newPointAttachment(e,t,i){return new Dp(i)}newClippingAttachment(e,t,i){return new bu(i)}}const aL=new Set(["normal","onlyTranslation","noRotationOrReflection","noScale","noScaleOrReflection"]);function lL(s,e,t){const i=s.uvs,n=s.vertices,r=s.triangles;if(!Array.isArray(i)||!i.length||i.length%2)throw new Error(`拖尾网格“${e}”的 UV 数据无效`);if(!Array.isArray(n)||!n.length)throw new Error(`拖尾网格“${e}”缺少顶点数据`);const o=i.length/2;if(!Array.isArray(r)||r.some(h=>!Number.isInteger(h)||h<0||h>=o))throw new Error(`拖尾网格“${e}”的三角形索引越界`);const a=Number(s.hull)||0;if(!Number.isInteger(a)||a<0||a>o)throw new Error(`拖尾网格“${e}”的外轮廓数量无效`);if(Array.isArray(s.edges)&&s.edges.some(h=>!Number.isInteger(h)||h<0||h>=o*2||h%2))throw new Error(`拖尾网格“${e}”的外轮廓边索引越界`);if(n.length===i.length)return;let c=0,l=0;for(;c<n.length;){const h=n[c++];if(!Number.isInteger(h)||h<1)throw new Error(`拖尾网格“${e}”包含无效骨骼权重数量`);let u=0;for(let d=0;d<h;d++){const f=n[c++],m=n[c++],p=n[c++],g=n[c++];if(!Number.isInteger(f)||f<0||f>=t)throw new Error(`拖尾网格“${e}”引用了不存在的骨骼`);if(![m,p,g].every(Number.isFinite)||g<0)throw new Error(`拖尾网格“${e}”包含无效权重数据`);u+=g}if(Math.abs(u-1)>.001)throw new Error(`拖尾网格“${e}”的顶点权重之和不为 1`);l++}if(c!==n.length||l!==o)throw new Error(`拖尾网格“${e}”的顶点数量与 UV 不一致`)}function cL(s,e){var r,o,a,c;const t=Array.isArray(s.bones)?s.bones:[],i=new Map(t.map(l=>[String(l.name||""),l])),n=new Set;for(const l of t){if(l.inherit!=null&&!aL.has(l.inherit))throw new Error(`骨骼“${l.name||""}”的 inherit 值“${l.inherit}”不符合 Spine ${e} JSON 格式`);if(/_trail_\d+_\d+$/.test(String(l.name||""))){const h=i.get(String(l.parent||""));if(!h||/_trail_\d+_\d+$/.test(String(h.name||"")))throw new Error(`拖尾骨骼“${l.name||""}”必须直接挂在粒子系统骨骼下,不能组成骨骼链`)}}for(const l of Array.isArray(s.skins)?s.skins:[]){const h=(l==null?void 0:l.attachments)||{};for(const u of Object.keys(h))for(const d of Object.keys(h[u]||{})){const f=h[u][d];(f==null?void 0:f.type)==="mesh"&&(lL(f,d,t.length),((r=f.vertices)==null?void 0:r.length)!==((o=f.uvs)==null?void 0:o.length)&&n.add(u))}}for(const l of Object.values(s.animations||{}))for(const h of n){const u=(c=(a=l==null?void 0:l.slots)==null?void 0:a[h])==null?void 0:c.attachment;if(Array.isArray(u)&&u.some(d=>!(d!=null&&d.name)))throw new Error(`加权拖尾插槽“${h}”不能使用空附件,未出现或死亡阶段应将对应骨骼缩放设为 0`)}}function hL(s){var e;if(String(((e=s==null?void 0:s.skeleton)==null?void 0:e.spine)||"")!=="3.8")throw new Error("Spine 3.8 导出的版本标识必须为 3.8");for(const t of s.bones||[])if(t.inherit!=null)throw new Error(`Spine 3.8 骨骼“${t.name||""}”应使用 transform,不能使用 inherit`);for(const t of Object.values(s.animations||{})){for(const n of Object.values(t.slots||{})){if(n.rgba||n.rgba2)throw new Error("Spine 3.8 插槽颜色时间轴必须使用 color / twoColor");for(const r of n.attachment||[])if(!Object.prototype.hasOwnProperty.call(r,"name"))throw new Error("Spine 3.8 附件时间轴的隐藏帧必须显式写入 name: null")}for(const n of Object.values(t.bones||{}))for(const r of n.rotate||[])if(r.value!=null||r.angle==null)throw new Error("Spine 3.8 旋转时间轴必须使用 angle");const i=[t];for(;i.length;){const n=i.pop();if(!(!n||typeof n!="object")){if(!Array.isArray(n)&&Array.isArray(n.curve))throw new Error("Spine 3.8 不支持 4.x 数组曲线格式");i.push(...Object.values(n))}}}}function Ey(s,e){var o;const t=JSON.parse(s),i=yh((o=t==null?void 0:t.skeleton)==null?void 0:o.spine);if(!i)throw new Error(`导出版本不受支持,仅支持 Spine ${xm()}`);if(e&&i!==e)throw new Error(`导出版本不一致:设置为 Spine ${e},JSON 标记为 Spine ${i}`);cL(t,i),i==="3.8"&&hL(t);const n=i==="3.8"?Nw(JSON.parse(JSON.stringify(t))):t,r=i==="4.3"?new sL(new oL).readSkeletonData(n):new Th(new rL).readSkeletonData(n);if(!r.bones.length)throw new Error("导出结果缺少骨骼");return{version:i,bones:r.bones.length,slots:r.slots.length,animations:r.animations.length}}const HS="http://127.0.0.1:27843";class Bh extends Error{constructor(t,i="CONNECTOR_ERROR",n){super(t);M(this,"code");M(this,"pairUrl");this.name="SpineConnectorError",this.code=i,this.pairUrl=n}}function zm(s,e){return String(s||"").trim().replace(/[\\/:*?"<>|]+/g,"_").replace(/^\.+/,"")||e}function uL(s,e){const t=/\.([a-z0-9]{2,5})$/i.exec(s);return t?`.${t[1].toLowerCase()}`:e.includes("jpeg")?".jpg":e.includes("webp")?".webp":e.includes("gif")?".gif":".png"}function dL(s,e,t){const i=String(s||"").replace(/\\/g,"/").split("/").filter(Boolean).map(r=>zm(r,"images")),n=zm(e.replace(/\.[^./\\]+$/,""),"image");return[...i,`${n}${uL(e,t)}`].join("/")}async function xf(s,e,t){if(!s)return null;const i=await fetch(s);if(!i.ok)throw new Error(`无法读取导出图片:${t}`);const n=await i.blob(),r=new Uint8Array(await n.arrayBuffer());let o="";const a=32768;for(let c=0;c<r.length;c+=a)o+=String.fromCharCode(...r.subarray(c,c+a));return{path:dL(e,t,n.type),dataBase64:btoa(o)}}async function WS(s,e){const t=[];let i=0;const n=o=>o.finally(()=>{i++,e==null||e(i,t.length)});for(const o of s.filter(a=>a.visible!==!1)){for(const a of o.config.imageResources)if(a.imageMode==="sequence"&&a.sequenceFrames.length)for(const c of a.sequenceFrames)t.push(n(xf(c.previewUrl,a.textureFolder,c.name||a.textureName)));else t.push(n(xf(a.previewUrl,a.textureFolder,a.textureName)));if(o.config.trail)for(const a of o.config.trailResources)t.push(n(xf(a.previewUrl,"",a.textureName)))}const r=new Map;for(const o of await Promise.all(t))o&&!r.has(o.path)&&r.set(o.path,o);return[...r.values()]}async function fL(){try{const s=await fetch(`${HS}/v1/health`,{cache:"no-store"});if(!s.ok)throw new Error(`HTTP ${s.status}`);return{available:!0,...await s.json()}}catch(s){return{available:!1,authorized:!1,error:s instanceof Error?s.message:String(s)}}}async function mL(s,e){const t=await WS(s.systems,(n,r)=>{e==null||e({phase:"images",progress:r?n/r:1})}),i=JSON.stringify({schemaVersion:1,projectName:s.projectName,spineVersion:s.spineVersion,skeletonJson:s.skeletonJson,images:t});return new Promise((n,r)=>{const o=new XMLHttpRequest;o.open("POST",`${HS}/v1/convert`),o.responseType="blob",o.setRequestHeader("Content-Type","application/json"),o.upload.onprogress=a=>{e==null||e({phase:"upload",progress:a.lengthComputable&&a.total>0?a.loaded/a.total:null})},o.upload.onloadend=()=>e==null?void 0:e({phase:"processing",progress:null}),o.onprogress=a=>{e==null||e({phase:"download",progress:a.lengthComputable&&a.total>0?a.loaded/a.total:null})},o.onerror=()=>r(new Bh("未检测到本地 Spine 连接器,请先启动连接器","CONNECTOR_OFFLINE")),o.onload=async()=>{const a=o.response;if(o.status<200||o.status>=300){let h={};try{h=JSON.parse(await a.text())}catch{}r(new Bh(h.message||`Spine 连接器返回错误:HTTP ${o.status}`,h.code,h.pairUrl));return}const c=o.getResponseHeader("X-Spine-File-Name");let l=`${zm(s.projectName,"SpineParticle")}.zip`;if(c)try{l=decodeURIComponent(c)}catch{}n({blob:a,fileName:l,spineEditorVersion:o.getResponseHeader("X-Spine-Editor-Version")||s.spineVersion,imageCount:t.length})},o.send(i)})}function pL(s,e){const t=URL.createObjectURL(s),i=document.createElement("a");i.href=t,i.download=/\.zip$/i.test(e)?e:`${e}.zip`,i.style.display="none",document.body.appendChild(i),i.click(),i.remove(),setTimeout(()=>URL.revokeObjectURL(t),1e3)}const gL=Array.from({length:256},(s,e)=>{let t=e;for(let i=0;i<8;i++)t=t&1?3988292384^t>>>1:t>>>1;return t>>>0});function vL(s){let e=4294967295;for(const t of s)e=gL[(e^t)&255]^e>>>8;return(e^4294967295)>>>0}function yL(s){const e=String(s||"").replace(/\\/g,"/").split("/").filter(t=>t&&t!==".");if(!e.length||e.some(t=>t===".."))throw new Error("ZIP 文件路径无效");return e.join("/")}function xL(s=new Date){const e=Math.max(1980,s.getFullYear());return{time:s.getHours()<<11|s.getMinutes()<<5|Math.floor(s.getSeconds()/2),date:e-1980<<9|s.getMonth()+1<<5|s.getDate()}}function bf(s){const e=new Uint8Array(s);return{bytes:e,view:new DataView(e.buffer)}}function Ay(s){const e=new Uint8Array(s.reduce((i,n)=>i+n.length,0));let t=0;for(const i of s)e.set(i,t),t+=i.length;return e}function bL(s){const e=new TextEncoder,t=[],i=[],n=xL();let r=0;for(const c of s){const l=e.encode(yL(c.name)),h=vL(c.data),u=bf(30);u.view.setUint32(0,67324752,!0),u.view.setUint16(4,20,!0),u.view.setUint16(6,2048,!0),u.view.setUint16(10,n.time,!0),u.view.setUint16(12,n.date,!0),u.view.setUint32(14,h,!0),u.view.setUint32(18,c.data.length,!0),u.view.setUint32(22,c.data.length,!0),u.view.setUint16(26,l.length,!0),t.push(u.bytes,l,c.data);const d=bf(46);d.view.setUint32(0,33639248,!0),d.view.setUint16(4,20,!0),d.view.setUint16(6,20,!0),d.view.setUint16(8,2048,!0),d.view.setUint16(12,n.time,!0),d.view.setUint16(14,n.date,!0),d.view.setUint32(16,h,!0),d.view.setUint32(20,c.data.length,!0),d.view.setUint32(24,c.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+c.data.length}const o=Ay(i),a=bf(22);return a.view.setUint32(0,101010256,!0),a.view.setUint16(8,s.length,!0),a.view.setUint16(10,s.length,!0),a.view.setUint32(12,o.length,!0),a.view.setUint32(16,r,!0),new Blob([Ay([...t,o,a.bytes])],{type:"application/zip"})}function wL(s){const e=atob(s),t=new Uint8Array(e.length);for(let i=0;i<e.length;i++)t[i]=e.charCodeAt(i);return t}function SL(s){const t=String(s||"./images/").replace(/\\/g,"/").replace(/^\.\//,"").replace(/^\/+|\/+$/g,"").split("/").filter(Boolean);return!t.length||t.some(i=>i===".."||/^[a-z]+:/i.test(i))?"images":t.join("/")}function ML(s){return String(s||"SpineParticle").replace(/\.json$/i,"").replace(/[\\/:*?"<>|]+/g,"_").replace(/^\.+/,"")||"SpineParticle"}async function TL(s){const e=await WS(s.systems);if(!e.length)throw new Error("当前可见粒子系统没有可导出的图片");const t=SL(s.imagesPath);return{blob:bL(e.map(n=>({name:`${t}/${n.path}`,data:wL(n.dataBase64)}))),imageCount:e.length,folder:t}}function _L(s,e){const t=`${ML(e)}-images.zip`,i=URL.createObjectURL(s),n=document.createElement("a");return n.href=i,n.download=t,n.style.display="none",document.body.appendChild(n),n.click(),n.remove(),setTimeout(()=>URL.revokeObjectURL(i),1e3),t}function CL(s){s.settings.exportSettings=I1(s.settings.exportSettings);const e=Le(()=>s.settings.exportSettings),t=Fe(!1),i=Fe(null),n=Fe(""),r=Fe(!1),o=Fe(null),a=Fe(""),c=Fe(""),l=Le(()=>{const b=o.value;return b?b.available?b.spineFound?b.authorized?"连接器可用 · Spine 已就绪":"连接器已启动,当前网站尚未授权":"连接器已启动,但未找到 Spine":"本地 Spine 连接器未启动":"正在检测本地 Spine 连接器…"}),h=Le(()=>{var b,_,A,P,E,R;return{ready:!!((b=o.value)!=null&&b.available)&&!!((_=o.value)!=null&&_.spineFound)&&!!((A=o.value)!=null&&A.authorized),warning:!!((P=o.value)!=null&&P.available)&&(!((E=o.value)!=null&&E.spineFound)||!((R=o.value)!=null&&R.authorized))}}),u=Le(()=>{var b,_,A;return!!((b=o.value)!=null&&b.available)&&!!((_=o.value)!=null&&_.spineFound)&&!!((A=o.value)!=null&&A.authorized)}),d=Le(()=>{const b=o.value;return!(b!=null&&b.available)||!b.spineFound||b.authorized||typeof window>"u"?"":`http://127.0.0.1:27843/pair?origin=${encodeURIComponent(window.location.origin)}`}),f=Le(()=>{const b=o.value;return b?b.available?b.spineFound?b.authorized?"":"未授权":"未找到 Spine":"未启动":"检测中"}),m=Le(()=>t.value?"正在重新计算并生成 Spine 工程":f.value?`暂不可用:${f.value}`:`调用本机 Spine 自动生成 ${e.value.spineVersion} 工程`);ys(()=>{x(),p=window.setInterval(x,3e3)});let p,g=0;Rr(()=>{p!==void 0&&window.clearInterval(p)});async function x(){const b=++g,_=await fL();if(b!==g)return;o.value=_;const A=c.value;(A==="CONNECTOR_OFFLINE"?_.available:A==="SPINE_NOT_FOUND"?_.available&&_.spineFound:A==="ORIGIN_NOT_ALLOWED"?_.available&&_.spineFound&&_.authorized:!!A&&_.available&&_.spineFound&&_.authorized)&&(c.value="",a.value="",r.value&&(r.value=!1,n.value=""))}function v(){return new Promise(b=>requestAnimationFrame(()=>b()))}async function y(b){s.timeline.playing=!1,s.timeline.frame=0,s.timeline.recorded=!1;for(const P of s.systems)P.frames=void 0;s.recalcTotalFrames(),await v(),s.timeline.playing=!0;const _=s.timeline.totalFrames/Math.max(1,s.timeline.fps)*1e3,A=performance.now()+Math.max(8e3,_*2.5+3e3);for(;!s.timeline.recorded;){if(performance.now()>A)throw new Error("重新计算动画超时,请确认页面仍在运行后重试");b==null||b(Math.min(.98,s.timeline.frame/Math.max(1,s.timeline.totalFrames-1))),await new Promise(P=>setTimeout(P,50))}b==null||b(1)}async function S(){if(!t.value){t.value=!0,i.value="json",r.value=!1,c.value="",a.value="",n.value="正在重新计算粒子动画…";try{await y();const b=py({systems:s.systems,timeline:s.timeline,settings:e.value});Ey(b.text,e.value.spineVersion),iO(b,e.value.fileName);const _=b.warnings.length?`;${b.warnings.length} 条资源提示(缺图仍已导出)`:"";n.value=`已导出 Spine ${e.value.spineVersion}:${b.particleSystemCount} 个粒子系统、${b.animationCount} 个动画、${b.boneCount} 根骨骼${_}`}catch(b){r.value=!0,n.value=b instanceof Error?b.message:String(b)}finally{t.value=!1,i.value=null}}}async function C(){if(t.value)return;t.value=!0,i.value="spine",r.value=!1,c.value="",a.value="",n.value="正在重新计算粒子动画…";const b=Zw("导出 Spine 包","正在重新计算粒子动画…");try{await b.paint(),await y(E=>b.update(E*18,"正在重新计算粒子动画…")),b.update(20,"正在生成 Spine JSON…");const _=py({systems:s.systems,timeline:s.timeline,settings:e.value});Ey(_.text,e.value.spineVersion),n.value="正在整理图片并调用本机 Spine…";const A=e.value.fileName.replace(/\.json$/i,"")||"SpineParticle",P=await mL({projectName:A,spineVersion:e.value.spineVersion,skeletonJson:_.text,systems:s.systems},({phase:E,progress:R})=>{E==="images"?b.update(R==null?null:22+R*18,"正在整理工程图片…"):E==="upload"?b.update(R==null?null:40+R*30,"正在上传数据到 Spine 连接器…"):E==="processing"?b.update(null,"Spine 正在转换工程,请稍候…"):b.update(R==null?null:82+R*16,"正在下载生成的 Spine 工程包…")});b.update(99,"正在交给浏览器下载…"),pL(P.blob,P.fileName),n.value=`已生成 ${P.fileName}:包含 .spine 工程和 ${P.imageCount} 张图片,Spine ${P.spineEditorVersion}`,await x(),await b.finish("Spine 工程包已开始下载")}catch(_){const A=_ instanceof Error?_.message:String(_);r.value=!0,c.value=_ instanceof Bh?_.code:"",_ instanceof Bh&&_.pairUrl&&(a.value=_.pairUrl),n.value=A,await x(),await b.fail(A)}finally{t.value=!1,i.value=null}}async function w(){if(!t.value){t.value=!0,i.value="images",r.value=!1,c.value="",a.value="",n.value="正在整理当前粒子系统使用的图片…";try{const b=await TL({systems:s.systems,imagesPath:e.value.imagesPath}),_=_L(b.blob,e.value.fileName);n.value=`已生成 ${_}:${b.folder}/ 内包含 ${b.imageCount} 张图片`}catch(b){r.value=!0,n.value=b instanceof Error?b.message:String(b)}finally{t.value=!1,i.value=null}}}return{exportSettings:e,exportBusy:t,exportTarget:i,exportMessage:n,exportError:r,connectorHealth:o,connectorPairUrl:a,connectorExportErrorCode:c,connectorStatusText:l,connectorStatusClass:h,connectorReady:u,connectorAuthorizationUrl:d,connectorDisabledReason:f,connectorButtonTitle:m,connectorHealthTimer:p,connectorHealthRequestId:g,refreshConnectorHealth:x,nextPaint:v,prepareExportFrames:y,exportSpineJson:S,exportSpineProject:C,exportSpineImages:w}}function EL(s){const e=Fe(null),t=Fe(""),i=Fe([]),n=Fe(!1),r=Fe(""),o=Fe(!1);function a(){Yw(s),o.value=!1,r.value="配置已保存到本地"}async function c(u){var m;const d=u.target,f=(m=d.files)==null?void 0:m[0];if(f){r.value="正在加载配置…",o.value=!1;try{await Xk(s,f),r.value=`已加载:${f.name}`}catch(p){o.value=!0,r.value=p instanceof Error?p.message:String(p)}finally{d.value=""}}}async function l(){try{const u=await fetch(`/Preset/index.json?t=${Date.now()}`,{cache:"no-store"});if(!u.ok)throw new Error("无法读取预设列表");const d=await u.json();i.value=Array.isArray(d)?d.filter(f=>!!f&&typeof f.name=="string"&&typeof f.file=="string"):[]}catch{i.value=[]}}async function h(){const u=t.value;if(!u)return;n.value=!0,o.value=!1,r.value="正在加载预设…";const d=Zw("加载预设",`正在下载 ${u}…`);try{await d.paint();const f=await fetch(`/Preset/${encodeURIComponent(u)}`,{cache:"no-store"});if(!f.ok)throw new Error(`无法读取预设:${u}`);const m=await E3(f,p=>{d.update(p==null?null:p*55,`正在下载 ${u}…`)});d.update(58,"正在解析预设配置…"),d.update(70,"正在解析并恢复预设资源…"),await jw(s,m),r.value=`已加载预设:${u.replace(/\.json$/i,"")}`,await d.finish("预设加载完成")}catch(f){o.value=!0;const m=f instanceof Error?f.message:String(f);r.value=`${m},请检查预设文件命名`,await d.fail(m)}finally{n.value=!1,t.value=""}}return ys(l),{configFileInput:e,selectedPreset:t,presetOptions:i,presetLoading:n,configMessage:r,configError:o,saveConfig:a,onConfigFileChange:c,refreshPresets:l,loadSelectedPreset:h}}function AL(s){const e=Fe(null),t=Fe(null),i=Fe(null),n=Fe(null),r=Fe(null);function o(){var k;const F=(k=s.value)==null?void 0:k.config;if(!F)return;const N=Math.max(0,...F.trailResources.map(V=>V.id))+1;F.trailResources.push({id:N,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:Am.map(V=>({...V})),boneCount:3,trailRatio:100,lengthMode:"fixed",length:100,lengthMin:100,lengthMax:100,widthSizeMode:"fixed",width:100,widthMin:100,widthMax:100,widthMode:"particle",lifeLengthEnabled:!1,lifeLengthCurve:Cm.map(V=>({...V})),shapeEnabled:!1,shapeCurve:Im.map(V=>({...V}))}),m()}function a(F){var N;r.value=F,(N=n.value)==null||N.click()}function c(F,N){var G;const k=(G=s.value)==null?void 0:G.config;if(!k)return;const V=F==="trailGridCols"?32:16;k[F]=Math.min(V,Math.max(2,Math.round(Number(N)||2)))}function l(F,N){var V;const k=(V=s.value)==null?void 0:V.config.trailResources.find(G=>G.id===F);k&&(k.boneCount=Math.min(16,Math.max(2,Math.round(Number(N)||2))))}function h(F,N){var V;const k=(V=s.value)==null?void 0:V.config.trailResources.find(G=>G.id===F);k&&(k.rotation=Math.max(-360,Math.min(360,Number(N)||0)))}async function u(F){var Z,ne;const N=F.target,k=(Z=N.files)==null?void 0:Z[0],V=(ne=s.value)==null?void 0:ne.config,G=V==null?void 0:V.trailResources.find(oe=>oe.id===r.value);if(!k||!G){N.value="";return}const W=await _(k);G.texture=vr(await Ke.fromURL(W)),G.previewUrl=W,G.textureName=k.name.replace(/\.[^.]+$/,"")||"trail",N.value="",r.value=null}async function d(F){var V;const N=(V=s.value)==null?void 0:V.config,k=N==null?void 0:N.trailResources.find(G=>G.id===F);k&&(k.texture=vr(await Ke.fromURL("/images/trail.png")),k.previewUrl="/images/trail.png",k.textureName="trail",k.weight=100,k.locked=!1,k.rotation=0,k.boneCount=3,k.trailRatio=100,k.lengthMode="fixed",k.length=100,k.lengthMin=100,k.lengthMax=100,k.widthSizeMode="fixed",k.width=100,k.widthMin=100,k.widthMax=100,k.widthMode="particle",k.lifeLengthEnabled=!1,k.lifeLengthCurve=Cm.map(G=>({...G})),k.shapeEnabled=!1,k.shapeCurve=Im.map(G=>({...G})),k.colorMode="particle",k.color="#ffffff",k.colorGradient=[{position:0,color:"#ffffff"},{position:1,color:"#ffffff"}],k.blend="normal",k.alphaMode="particle",k.alpha=1,k.alphaCurve=Am.map(G=>({...G})),m())}function f(F){var V;const N=(V=s.value)==null?void 0:V.config.trailResources;if(!N||N.length<=1)return;const k=N.findIndex(G=>G.id===F);k>=0&&N.splice(k,1),m()}function m(){var G;const F=(G=s.value)==null?void 0:G.config.trailResources;if(!(F!=null&&F.length))return;if(F.length===1){F[0].weight=100,F[0].locked=!1;return}const N=F.filter(W=>W.locked),k=F.filter(W=>!W.locked);let V=N.reduce((W,Z)=>W+Math.max(0,Number(Z.weight)||0),0);V>100&&(Y(N,100,!0),V=100),Y(k,100-V)}function p(F,N){var ne;const k=(ne=s.value)==null?void 0:ne.config.trailResources;if(!(k!=null&&k.length))return;if(k.length===1){k[0].weight=100,k[0].locked=!1;return}const V=k.find(oe=>oe.id===F);if(!V||V.locked)return;const G=k.filter(oe=>oe.id!==F&&oe.locked).reduce((oe,de)=>oe+Math.max(0,Number(de.weight)||0),0),W=Math.max(0,100-G),Z=k.filter(oe=>oe.id!==F&&!oe.locked);V.weight=U(Math.min(W,Math.max(0,Number(N)||0))),Z.length?Y(Z,W-V.weight,!0):V.weight=U(W)}function g(F){var V;const N=(V=s.value)==null?void 0:V.config.trailResources;if(!N||N.length===1)return;const k=N.find(G=>G.id===F);k&&(k.locked=!k.locked)}function x(F,N){const k=N.target;F.color=P(k.value,F.color),k.value=F.color}function v(F,N){x(F,N),N.target.blur()}function y(){var k;const F=(k=s.value)==null?void 0:k.config;if(!F)return;const N=Math.max(0,...F.imageResources.map(V=>V.id))+1;F.imageResources.push({id:N,texture:F.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:Em.map(V=>({...V}))}),$()}function S(F){var N;i.value=F,(N=e.value)==null||N.click()}function C(F){var N;i.value=F,(N=t.value)==null||N.click()}async function w(F){var ne,oe;const N=F.target,k=(ne=N.files)==null?void 0:ne[0],V=(oe=s.value)==null?void 0:oe.config,G=V==null?void 0:V.imageResources.find(de=>de.id===i.value);if(!k||!G){N.value="";return}const W=await _(k),Z=vr(await Ke.fromURL(W));G.texture=Z,G.previewUrl=W,G.textureFolder="",G.textureName=k.name.replace(/\.[^.]+$/,"")||"particle",N.value="",i.value=null}async function b(F){var W;const N=F.target,k=Array.from(N.files||[]).sort((Z,ne)=>Z.name.localeCompare(ne.name,void 0,{numeric:!0,sensitivity:"base"})),V=(W=s.value)==null?void 0:W.config,G=V==null?void 0:V.imageResources.find(Z=>Z.id===i.value);if(!k.length||!G){N.value="";return}G.sequenceFrames=await Promise.all(k.map(async Z=>{const ne=await _(Z);return{name:Z.name,previewUrl:ne,texture:vr(await Ke.fromURL(ne))}})),G.imageMode="sequence",N.value="",i.value=null}function _(F){return new Promise((N,k)=>{const V=new FileReader;V.onload=()=>N(String(V.result||"")),V.onerror=()=>k(V.error),V.readAsDataURL(F)})}function A(F){var V;const N=(V=s.value)==null?void 0:V.config,k=N==null?void 0:N.imageResources.find(G=>G.id===F);!N||!k||(k.texture=N.texture,k.textureName="star",k.textureFolder="",k.previewUrl="/images/star.png",k.imageMode="fixed",k.sequencePlayback="loop-forward",k.sequenceFps=30,k.sequenceFrames=[],k.scale=1,k.anchorX=.5,k.anchorY=.5,k.colorMode="fixed",k.colorStart="#ffffff",k.colorEnd="#ff4d4d",k.colorGradient=[{position:0,color:"#ffffff"},{position:1,color:"#ff4d4d"}],k.blend="normal",k.independentAlpha="off",k.alpha=1,k.alphaCurveMode="跟随导出",k.alphaCurve=Em.map(G=>({...G})),k.locked=!1,$())}function P(F,N){let k=F.trim().replace(/^#/,"");return/^[0-9a-f]{3}$/i.test(k)&&(k=k.split("").map(V=>V+V).join("")),/^[0-9a-f]{6}$/i.test(k)?`#${k.toLowerCase()}`:N}function E(F,N){const k=N.target;F.colorStart=P(k.value,F.colorStart),k.value=F.colorStart}function R(F,N){E(F,N),N.target.blur()}function O(F){var V;const N=(V=s.value)==null?void 0:V.config.imageResources;if(!N||N.length<=1)return;const k=N.findIndex(G=>G.id===F);k>=0&&N.splice(k,1),$()}function U(F){return Math.round(F)}function Y(F,N,k=!1){if(!F.length)return;const V=Math.max(0,U(N)),G=k?F.reduce((Z,ne)=>Z+Math.max(0,Number(ne.weight)||0),0):0;let W=0;F.forEach((Z,ne)=>{const oe=ne===F.length-1,de=U(oe?V-W:G>0?V*Math.max(0,Number(Z.weight)||0)/G:V/F.length);Z.weight=de,W+=de})}function $(){var G;const F=(G=s.value)==null?void 0:G.config.imageResources;if(!(F!=null&&F.length))return;if(F.length===1){F[0].weight=100,F[0].locked=!1;return}const N=F.filter(W=>W.locked),k=F.filter(W=>!W.locked);let V=N.reduce((W,Z)=>W+Math.max(0,Number(Z.weight)||0),0);V>100&&(Y(N,100,!0),V=100),Y(k,100-V)}function X(F,N){var ne;const k=(ne=s.value)==null?void 0:ne.config.imageResources;if(!(k!=null&&k.length))return;if(k.length===1){k[0].weight=100,k[0].locked=!1;return}const V=k.find(oe=>oe.id===F);if(!V||V.locked)return;const G=k.filter(oe=>oe.id!==F&&oe.locked).reduce((oe,de)=>oe+Math.max(0,Number(de.weight)||0),0),W=Math.max(0,100-G),Z=k.filter(oe=>oe.id!==F&&!oe.locked);if(V.weight=U(Math.min(W,Math.max(0,Number(N)||0))),!Z.length){V.weight=U(W);return}Y(Z,W-V.weight,!0)}function D(F){var V;const N=(V=s.value)==null?void 0:V.config.imageResources;if(!N||N.length===1)return;const k=N.find(G=>G.id===F);k&&(k.locked=!k.locked)}return{textureFileInput:e,sequenceFileInput:t,pendingResourceId:i,trailTextureFileInput:n,pendingTrailResourceId:r,addTrailResource:o,openTrailTexturePicker:a,onTrailRigChange:c,onTrailResourceBoneCountChange:l,onTrailResourceRotationChange:h,onTrailTextureFile:u,resetTrailTexture:d,removeTrailResource:f,rebalanceTrailWeights:m,setTrailResourceWeight:p,toggleTrailResourceLock:g,setTrailColor:x,commitTrailColor:v,addImageResource:y,openTexturePicker:S,openSequencePicker:C,onTextureFile:w,onSequenceFiles:b,readFileAsDataUrl:_,resetTexture:A,normalizeHex:P,setResourceFixedColor:E,commitResourceFixedColor:R,removeImageResource:O,roundWeight:U,distributeImageWeights:Y,rebalanceImageWeights:$,setResourceWeight:X,toggleResourceLock:D}}function IL(){const s=yo(),{exportSettings:e,exportBusy:t,exportTarget:i,exportMessage:n,exportError:r,connectorPairUrl:o,connectorStatusText:a,connectorStatusClass:c,connectorReady:l,connectorAuthorizationUrl:h,connectorDisabledReason:u,connectorButtonTitle:d,refreshConnectorHealth:f,exportSpineJson:m,exportSpineProject:p,exportSpineImages:g}=CL(s),{configFileInput:x,selectedPreset:v,presetOptions:y,presetLoading:S,configMessage:C,configError:w,saveConfig:b,onConfigFileChange:_,refreshPresets:A,loadSelectedPreset:P}=EL(s);function E(Q){return Q==="跟随导出"?e.value.keyframeCurve==="bezier"?"bezier":"linear":Q==="贝塞尔"?"bezier":"linear"}s.systems.length||s.addSystem();const R=Le(()=>{const Q=s.systems.findIndex(le=>le.id===s.activeId);return Q>=0?Q:0}),O=Le(()=>s.systems[R.value]||null),{textureFileInput:U,sequenceFileInput:Y,trailTextureFileInput:$,addTrailResource:X,openTrailTexturePicker:D,onTrailRigChange:F,onTrailResourceBoneCountChange:N,onTrailResourceRotationChange:k,onTrailTextureFile:V,resetTrailTexture:G,removeTrailResource:W,setTrailResourceWeight:Z,toggleTrailResourceLock:ne,setTrailColor:oe,commitTrailColor:de,addImageResource:pe,openTexturePicker:he,openSequencePicker:me,onTextureFile:H,onSequenceFiles:z,resetTexture:K,setResourceFixedColor:B,commitResourceFixedColor:L,removeImageResource:j,setResourceWeight:ie,toggleResourceLock:ue}=AL(O),fe=Le(()=>O.value?R1(O.value.config,s.timeline.fps):30),ee=Le(()=>{var le;const Q=(le=O.value)==null?void 0:le.config;return Q?Math.max(1,Math.ceil(Number(Q.loopDurationFrames)||1)):1}),Me=Le(()=>s.activeObjectType),be=Le(()=>s.activeObjectType==="collision"&&s.colliders.find(Q=>Q.id===s.activeObjectId)||null),ge=Le(()=>s.activeObjectType==="path"&&s.paths.find(Q=>Q.id===s.activeObjectId)||null),Ne=Le(()=>s.activeObjectType==="spine"&&s.spines.find(Q=>Q.id===s.activeObjectId)||null),Ve=Le(()=>s.activeObjectType==="particle"?s.systems.some(Q=>Q.id===s.activeObjectId):s.activeObjectType==="collision"?s.colliders.some(Q=>Q.id===s.activeObjectId):s.activeObjectType==="path"?s.paths.some(Q=>Q.id===s.activeObjectId):s.spines.some(Q=>Q.id===s.activeObjectId)),Ze=Le(()=>{const Q=s.spines.find(le=>le.selectedBone&&le.bones.some(Se=>Se.name===le.selectedBone));return Q?{spine:Q,boneName:Q.selectedBone}:null}),rt=Le(()=>{var Se;const Q=(Se=O.value)==null?void 0:Se.config;if(!Q||Q.emitterFollowMode!=="bone")return null;const le=s.spines.find(tt=>tt.id===Q.emitterFollowSpineId);return!le||!le.bones.some(tt=>tt.name===Q.emitterFollowBoneName)?null:{spine:le,boneName:Q.emitterFollowBoneName}}),Je=Fe(!1),je=Fe(""),Ae=Le(()=>s.spines.filter(Q=>Q.enabled&&Q.visible!==!1&&Q.status==="ready")),Qe=Le(()=>s.spines.find(Q=>{var le;return Q.id===((le=O.value)==null?void 0:le.config.renderLayerSpineId)})||null),Ee=Le(()=>{const Q=Qe.value;return!!Q&&Q.enabled&&Q.visible!==!1&&Q.status==="ready"}),Qt=Le(()=>{var Q;return[...((Q=Qe.value)==null?void 0:Q.slots)||[]].sort((le,Se)=>le.order-Se.order)}),ut=Le(()=>{const Q=je.value.trim().toLocaleLowerCase();return Q?Qt.value.filter(le=>le.name.toLocaleLowerCase().includes(Q)||le.attachment.toLocaleLowerCase().includes(Q)):Qt.value}),re=Le(()=>Qt.value.find(Q=>{var le;return Q.name===((le=O.value)==null?void 0:le.config.renderLayerSlotName)})||null),ae=Le(()=>{const Q=re.value;return Q&&Qt.value.filter(le=>le.order<Q.order).sort((le,Se)=>Se.order-le.order)[0]||null}),et=Le(()=>{var tt;const Q=(tt=O.value)==null?void 0:tt.config,le=Qe.value,Se=re.value;return!Q||!le||!Se?"":`${le.name} / ${Se.name} · 图片${Q.renderLayerSlotPosition==="below"?"之下":"之上"}`}),It=Le(()=>{var Se;const Q=(Se=O.value)==null?void 0:Se.config,le=re.value;return!Q||!le?"":Q.renderLayerSlotPosition==="above"?`渲染在 ${le.name} 图片之上、其后插槽之下`:ae.value?`渲染在 ${ae.value.name} 与 ${le.name} 之间`:""}),kt=Le(()=>{var Se;const Q=(Se=O.value)==null?void 0:Se.config;if(!Q||Q.renderLayerMode!=="slot")return"";if(!Ae.value.length)return"没有已加载的 Spine,粒子临时显示在最上层。";if(!Q.renderLayerSpineId)return"尚未选择 Spine,粒子临时显示在最上层。";const le=Qe.value;return le?!le.enabled||le.status!=="ready"?"目标 Spine 未就绪,粒子临时显示在最上层。":Q.renderLayerSlotName?re.value?Q.renderLayerSlotPosition==="below"&&!ae.value?"这是第一个插槽,无法显示在其下方,粒子临时显示在最上层。":"":"目标插槽不存在(资源可能已更换),粒子临时显示在最上层。":"":"目标 Spine 不存在,粒子临时显示在最上层。"});function ot(){var le;const Q=(le=O.value)==null?void 0:le.config;Q&&(Q.renderLayerMode="slot",!Q.renderLayerSpineId&&Ae.value.length&&(Q.renderLayerSpineId=Ae.value[0].id),Je.value=!Q.renderLayerSlotName)}function Gi(Q){var Se;const le=(Se=O.value)==null?void 0:Se.config;le&&(le.renderLayerSpineId=Math.max(0,Math.round(Number(Q.target.value)||0)),le.renderLayerSlotName="",Je.value=!0)}function xs(Q){var Se;const le=(Se=O.value)==null?void 0:Se.config;le&&(le.renderLayerSlotName=Q.name,Je.value=!1,je.value="")}function Nt(){var le;const Q=(le=O.value)==null?void 0:le.config;Q&&(Q.renderLayerSlotName="",Q.renderLayerSlotPosition="above")}const vi=Fe(!1),Xt=Le(()=>{var le;const Q=new Set(((le=O.value)==null?void 0:le.config.collisionColliderIds)||[]);return s.colliders.filter(Se=>Q.has(Se.id))}),ji=Le(()=>{var le;const Q=new Set(((le=O.value)==null?void 0:le.config.collisionColliderIds)||[]);return s.colliders.filter(Se=>!Q.has(Se.id))});ai(()=>{var Q,le;return[(Q=O.value)==null?void 0:Q.id,(le=O.value)==null?void 0:le.config.collision]},()=>{vi.value=!1}),ai(()=>{var Q;return(Q=O.value)==null?void 0:Q.id},()=>{Je.value=!1,je.value=""});function ni(Q){var Se;const le=(Se=O.value)==null?void 0:Se.config;!le||le.collisionColliderIds.includes(Q)||(le.collisionColliderIds.push(Q),vi.value=!1)}function bs(Q){var Se;const le=(Se=O.value)==null?void 0:Se.config;le&&(le.collisionColliderIds=le.collisionColliderIds.filter(tt=>tt!==Q))}Lo(()=>{for(const Q of s.systems)Q.visible==null&&(Q.visible=!0);for(const Q of s.colliders)Q.visible==null&&(Q.visible=!0);for(const Q of s.paths)Q.visible==null&&(Q.visible=!0);for(const Q of s.spines)Q.visible==null&&(Q.visible=!0)}),Lo(()=>{if(!O.value)return;const Q=Xn(O.value.config);Q.lifeMode==="curve"&&(Q.lifeMode="random"),Q.speedMode==="curve"&&(Q.speedMode="random"),Q.scaleMode==="curve"&&(Q.scaleMode="random"),Q.initialRotationMode==="curve"&&(Q.initialRotationMode="random"),Q.mode==="stream"&&!(Q.duration>0)&&(Q.duration=1),Q.streamBehavior==="loop"&&(Q.emitterFollow||Q.emitterFollowMode!=="none")&&gn(Q)}),Lo(()=>{const Q=new Set(s.colliders.map(Se=>Se.id)),le=new Set(s.systems.map(Se=>Se.id));for(const Se of s.systems){const tt=Xn(Se.config),ei=tt.collisionColliderIds.filter(Ji=>Q.has(Ji));ei.length!==tt.collisionColliderIds.length&&(tt.collisionColliderIds=ei),tt.spawnPathId>0&&!s.paths.some(Ji=>Ji.id===tt.spawnPathId)&&(tt.spawnPathId=0,(tt.emissionAngleMode==="path-normal"||tt.emissionAngleMode==="path-tangent")&&(tt.emissionAngleMode="fixed"));const Mo=k1(s.systems,Se.id);for(const Ji of tt.events||[])Ji.targetSystemId>0&&(Ji.targetSystemId===Se.id||Mo.has(Ji.targetSystemId)||!le.has(Ji.targetSystemId))&&(Ji.targetSystemId=0);if(tt.emitterFollowMode!=="bone")continue;const _u=s.spines.find(Ji=>Ji.id===tt.emitterFollowSpineId);!!(_u!=null&&_u.bones.some(Ji=>Ji.name===tt.emitterFollowBoneName))||(tt.emitterFollowMode="none",tt.emitterFollowSpineId=0,tt.emitterFollowBoneName="")}}),Lo(()=>{for(const Q of s.systems){const le=Xn(Q.config);le.renderLayerMode!=="slot"||!le.renderLayerSpineId||s.spines.some(Se=>Se.id===le.renderLayerSpineId)||(le.renderLayerSpineId=0,le.renderLayerSlotName="")}}),Lo(()=>{for(const Q of s.colliders)Q.followPathId==null&&(Q.followPathId=0),Q.followDuration>0||(Q.followDuration=2),Q.followPathRotation==null&&(Q.followPathRotation=!1),["跟随导出","线性","贝塞尔"].includes(Q.followCurveMode)||(Q.followCurveMode="跟随导出"),(!Array.isArray(Q.followCurve)||Q.followCurve.length<2)&&(Q.followCurve=[{x:0,y:0},{x:1,y:1}])});const ws=po({config:!0,scene:!1,emitMode:!0,shape:!0,attr:!0,look:!0,mods:!0,export:!1});function $s(Q){ws[Q]=!ws[Q]}function Zi(Q){var Se;const le=(Se=O.value)==null?void 0:Se.config;le&&(le.mode=Q,Q==="stream"&&!(le.duration>0)&&(le.duration=1))}function Zn(Q){var tt;const le=(tt=O.value)==null?void 0:tt.config;if(!le)return;const Se=Math.min(1800,Math.max(1,Math.ceil(Number(Q)||1)));le.loopDurationFrames=Se}function gn(Q){const le=wl();Q.emitterFollow=!1,Q.emitterFollowMode="none",Q.emitterFollowPathId=le.emitterFollowPathId,Q.emitterFollowSpineId=le.emitterFollowSpineId,Q.emitterFollowBoneName=le.emitterFollowBoneName,Q.emitterFollowBoneOffsetX=le.emitterFollowBoneOffsetX,Q.emitterFollowBoneOffsetY=le.emitterFollowBoneOffsetY,Q.emitterFollowBoneRotation=le.emitterFollowBoneRotation,Q.emitterFollowBoneScaleX=le.emitterFollowBoneScaleX,Q.emitterFollowBoneScaleY=le.emitterFollowBoneScaleY,Q.emitterAngleMode=le.emitterAngleMode,Q.emitterFollowCurve=le.emitterFollowCurve.map(Se=>({...Se})),Q.emitterFollowDuration=le.emitterFollowDuration,Q.emitterFollowSpace=le.emitterFollowSpace,Q.emitterFollowDirection=le.emitterFollowDirection,Q.emitterFollowOffset=le.emitterFollowOffset}function wa(Q){var ei;const le=(ei=O.value)==null?void 0:ei.config;if(!le||le.streamBehavior===Q)return;const Se=Q==="loop",tt=Se?"进入循环持续模式后,粒子跟随设置会失效并恢复默认值。是否继续?":"退出循环持续模式后,粒子跟随设置会失效并恢复默认值。是否继续?";window.confirm(tt)&&(gn(le),le.streamBehavior=Q,Se||(le.generateLoopStartAnimation=!1,le.generateLoopEndAnimation=!1))}function Sa(Q,le){var ei;const Se=(ei=O.value)==null?void 0:ei.config;if(!Se)return;const tt=le.target.checked;Q==="start"?Se.generateLoopStartAnimation=tt:Se.generateLoopEndAnimation=tt}function Dl(Q,le){var ei;const Se=(ei=O.value)==null?void 0:ei.config;if(!Se)return;const tt=Math.min(1800,Math.max(1,Math.ceil(Number(le.target.value)||30)));Q==="start"?Se.loopStartDurationFrames=tt:Se.loopEndDurationFrames=tt}function Ul(Q,le){var ei;const Se=(ei=O.value)==null?void 0:ei.config;if(!Se)return;const tt=le.target.checked;Q==="start"?Se.loopStartUseCustomDuration=tt:Se.loopEndUseCustomDuration=tt}function Ma(Q,le){const Se=Q.target.value;if(le.emitterFollowMode=Se,Se!=="bone"){le.emitterFollowSpineId=0,le.emitterFollowBoneName="";return}Ta(le)}function Ta(Q){const le=Ze.value;if(!le){Q.emitterFollowMode="none",Q.emitterFollowSpineId=0,Q.emitterFollowBoneName="";return}Q.emitterFollowMode="bone",Q.emitterFollowSpineId=le.spine.id,Q.emitterFollowBoneName=le.boneName}const _a={emitMode:["mode","rate","streamBehavior","loopDurationFrames","generateLoopStartAnimation","loopStartUseCustomDuration","loopStartDurationFrames","generateLoopEndAnimation","loopEndUseCustomDuration","loopEndDurationFrames","burstCount","burstLoop","delay","duration"],shape:["shape","showShape","shapeRangeVersion","innerRadius","outerRadius","innerRectW","innerRectH","outerRectW","outerRectH","spawnPathId","spawnPathDistribution","radius","rectW","rectH","emissionAngleMode","direction","spread","coneDirection","coneAngle"],attr:["lifeMin","lifeMax","lifeMode","lifeCurve","speedMin","speedMax","speedMode","speedCurve","scaleMin","scaleMax","scaleMode","scaleAxisMode","scaleYMin","scaleYMax","scaleCurve","scaleYCurve","scaleEndRatio","initialRotationMode","initialRotationMin","initialRotationMax","initialRotationCurve","rotationSpeedMin","rotationSpeedMax","speedOverLifeEnabled","speedOverLifeMode","speedOverLifeMin","speedOverLifeMax","speedOverLifeCurve","scaleOverLifeEnabled","scaleOverLifeMode","scaleOverLifeAxisMode","scaleOverLifeMin","scaleOverLifeMax","scaleYOverLifeMin","scaleYOverLifeMax","scaleOverLifeCurve","scaleYOverLifeCurve","rotationOverLifeEnabled","rotationOverLifeMode","rotationOverLifeCurve"],look:["texture","imageResources","imageWeightVersion","alpha","alphaEnd","colorStart","colorEnd","colorOverLife","blend","alphaMode","curveMode","alphaCurve","textureName","textureFolder","alphaScale","anchorX","anchorY","independentAlpha","renderLayerMode","renderLayerSpineId","renderLayerSlotName","renderLayerSlotPosition","renderLayerFollowAttachment"],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","showForceFieldShape","vortex","vortexStrength","vortexRadius","vortexCenterX","vortexCenterY","vortexFalloff","showVortexShape","attraction","attractionCenterX","attractionCenterY","attractionRadius","attractionDuration","attractionDelay","attractionDelayMode","attractionPath","showAttractionShape","trail","trailConfigVersion","trailResources","trailResourceVersion","trailTexture","trailTextureName","trailPreviewUrl","trailColorMode","trailColor","trailColorGradient","trailAlphaMode","trailAlpha","trailAlphaCurve","trailBoneCount","trailLength","trailWidth","trailWidthMode","trailLifeLengthEnabled","trailLifeLengthCurve","trailShapeEnabled","trailShapeCurve","trailGridRows","trailGridCols","collision","collisionColliderIds","pathFollow","eventEnabled","events","emitterFollow","emitterFollowMode","emitterFollowPathId","emitterFollowSpineId","emitterFollowBoneName","emitterFollowBoneOffsetX","emitterFollowBoneOffsetY","emitterFollowBoneRotation","emitterFollowBoneScaleX","emitterFollowBoneScaleY","emitterAngleMode","emitterFollowCurve","emitterFollowDuration","emitterFollowSpace","emitterFollowDirection","emitterFollowOffset","damping"]};function $l(Q){var tt;const le=(tt=O.value)==null?void 0:tt.config;if(Q==="export"){s.settings.exportSettings=_p();return}if(!le)return;const Se=wl();for(const ei of _a[Q])le[ei]=Se[ei]}function Mu(){e.value.fps=Math.min(240,Math.max(1,Math.round(Number(e.value.fps)||30)))}function Ca(Q){var le;s.selectSystem(((le=s.systems[Q])==null?void 0:le.id)??0)}function Jn(){s.addSystem()}function So(){s.addCollider()}function Tu(){s.addPath()}function Xl(){s.addSpine()}function ZS(){s.duplicateSelectedObject()}function vn(Q,le,Se=0,tt=0,ei=0,Mo=0){return{x:Q,y:le,inX:Se,inY:tt,outX:ei,outY:Mo}}function JS(){const Q=ge.value;if(!(!Q||!Q.preset))if(Q.preset==="circle"){const Se=60.751328;Q.points=[vn(110,0,0,-Se,0,Se),vn(0,110,Se,0,-Se,0),vn(-110,0,0,Se,0,-Se),vn(0,-110,-Se,0,Se,0)],Q.closed=!0}else if(Q.preset==="square")Q.points=[vn(-100,-100),vn(100,-100),vn(100,100),vn(-100,100)],Q.closed=!0;else{const le=Q.preset==="star"?10:6;Q.points=Array.from({length:le},(Se,tt)=>{const ei=Q.preset==="star"&&tt%2?50:110,Mo=-Math.PI*.5+tt/le*Math.PI*2;return vn(Math.cos(Mo)*ei,Math.sin(Mo)*ei)}),Q.closed=!0}}function QS(){ge.value&&(ge.value.points=[])}function eM(){O.value&&(O.value.config.seed=Math.floor(Math.random()*999999)+1)}function tM(Q){var Se;const le=(Se=O.value)==null?void 0:Se.config;!le||Q==="direction"||(le.speedOverLifeMode=Q,Q==="curve"&&le.speedOverLifeMin===le.speedOverLifeMax&&(le.speedOverLifeMin=0,le.speedOverLifeMax=1))}function Yp(){var le;const Q=(le=O.value)==null?void 0:le.config;!Q||Q.scaleOverLifeMode!=="curve"||(Q.scaleOverLifeMin===Q.scaleOverLifeMax&&(Q.scaleOverLifeMin=0,Q.scaleOverLifeMax=1),Q.scaleYOverLifeMin===Q.scaleYOverLifeMax&&(Q.scaleYOverLifeMin=0,Q.scaleYOverLifeMax=1))}function iM(Q){var Se;const le=(Se=O.value)==null?void 0:Se.config;!le||Q==="direction"||(le.scaleOverLifeMode=Q,Yp())}const sM={point:{emissionAngleMode:"random",direction:0,spread:360},circle:{innerRadius:0,outerRadius:100,emissionAngleMode:"fixed",direction:-90,spread:0},rect:{innerRectW:0,innerRectH:0,outerRectW:200,outerRectH:100,emissionAngleMode:"fixed",direction:-90,spread:0},cone:{innerRadius:0,outerRadius:100,coneAngle:90,coneDirection:90,emissionAngleMode:"random",direction:90,spread:90},path:{spawnPathId:0,spawnPathDistribution:"fixed",emissionAngleMode:"fixed",direction:0,spread:0}};function nM(){var Se;const Q=(Se=O.value)==null?void 0:Se.config;if(!Q)return;const le=sM[Q.shape];le&&Object.assign(Q,le)}function rM(){var le;const Q=(le=O.value)==null?void 0:le.config;!Q||Q.spawnPathId>0||(Q.emissionAngleMode==="path-normal"||Q.emissionAngleMode==="path-tangent")&&(Q.emissionAngleMode="fixed")}return{store:s,exportSettings:e,exportBusy:t,exportTarget:i,exportMessage:n,exportError:r,connectorPairUrl:o,connectorStatusText:a,connectorStatusClass:c,connectorReady:l,connectorAuthorizationUrl:h,connectorDisabledReason:u,connectorButtonTitle:d,refreshConnectorHealth:f,exportSpineJson:m,exportSpineProject:p,exportSpineImages:g,configFileInput:x,selectedPreset:v,presetOptions:y,presetLoading:S,configMessage:C,configError:w,saveConfig:b,onConfigFileChange:_,refreshPresets:A,loadSelectedPreset:P,resolvedCurveEditorMode:E,sys:O,textureFileInput:U,sequenceFileInput:Y,trailTextureFileInput:$,addTrailResource:X,openTrailTexturePicker:D,onTrailRigChange:F,onTrailResourceBoneCountChange:N,onTrailResourceRotationChange:k,onTrailTextureFile:V,resetTrailTexture:G,removeTrailResource:W,setTrailResourceWeight:Z,toggleTrailResourceLock:ne,setTrailColor:oe,commitTrailColor:de,addImageResource:pe,openTexturePicker:he,openSequencePicker:me,onTextureFile:H,onSequenceFiles:z,resetTexture:K,setResourceFixedColor:B,commitResourceFixedColor:L,removeImageResource:j,setResourceWeight:ie,toggleResourceLock:ue,automaticLoopDuration:fe,loopDurationFrames:ee,activeObjectType:Me,activeCollider:be,activePath:ge,activeSpine:Ne,canCopyObject:Ve,selectedSpineBone:Ze,boundSpineBone:rt,renderLayerSlotPickerOpen:Je,renderLayerSlotSearch:je,renderLayerReadySpines:Ae,renderLayerSpineReady:Ee,renderLayerSlots:Qt,renderLayerFilteredSlots:ut,renderLayerSlotLabel:et,renderLayerResolvedLabel:It,renderLayerWarning:kt,setRenderLayerSlotMode:ot,selectRenderLayerSpine:Gi,pickRenderLayerSlot:xs,clearRenderLayerSlot:Nt,collisionPickerOpen:vi,selectedCollisionBodies:Xt,availableCollisionBodies:ji,addCollisionBody:ni,removeCollisionBody:bs,collapsed:ws,toggle:$s,setEmitMode:Zi,setLoopDurationFrames:Zn,setStreamBehavior:wa,setLoopSection:Sa,setLoopSectionDuration:Dl,setLoopCustomDuration:Ul,onEmitterFollowModeChange:Ma,bindSelectedBone:Ta,resetModule:$l,normalizeExportFps:Mu,select:Ca,addSys:Jn,addCollider:So,addPath:Tu,addSpine:Xl,copySelectedObject:ZS,applyPathPreset:JS,clearPathAnchors:QS,randomizeSeed:eM,setSpeedOverLifeMode:tM,prepareScaleOverLifeCurve:Yp,setScaleOverLifeMode:iM,onShapeChange:nM,onSpawnPathChange:rM,LINEAR_CURVE:T3,FLAT_CURVE:Cm,ALPHA_CURVE:_3,RESOURCE_ALPHA_CURVE:Em,TRAIL_ALPHA_CURVE:Am,TRAIL_SHAPE_CURVE:Im}}const zS=Symbol("particle-panel");function RL(){const s=IL();return cx(zS,s),s}function Fr(){const s=qo(zS);if(!s)throw new Error("Particle panel sections require a ParticlePanel parent");return s}const PL={class:"group config-management"},kL={class:"caret"},FL={class:"group-body config-management-body"},OL={class:"config-toolbar"},LL=["disabled"],BL={value:""},NL=["value"],DL=Zt({__name:"ProjectConfigSection",setup(s){const{configFileInput:e,selectedPreset:t,presetOptions:i,presetLoading:n,configMessage:r,configError:o,saveConfig:a,onConfigFileChange:c,refreshPresets:l,loadSelectedPreset:h,collapsed:u,toggle:d,select:f}=Fr();return(m,p)=>(q(),J("div",PL,[T("div",{class:"group-head",onClick:p[0]||(p[0]=g=>I(d)("config"))},[T("span",kL,ve(I(u).config?"▸":"▾"),1),p[8]||(p[8]=T("span",null,"配置管理",-1))]),ce(T("div",FL,[T("div",OL,[T("button",{title:"保存全部编辑器配置 (Ctrl+S)",onClick:p[1]||(p[1]=(...g)=>I(a)&&I(a)(...g))},"保存配置"),T("button",{title:"加载本地编辑器配置",onClick:p[2]||(p[2]=g=>{var x;return(x=I(e))==null?void 0:x.click()})},"加载配置"),ce(T("select",{"onUpdate:modelValue":p[3]||(p[3]=g=>jt(t)?t.value=g:null),"aria-label":"预设列表",disabled:!I(i).length||I(n),onPointerdown:p[4]||(p[4]=(...g)=>I(l)&&I(l)(...g)),onFocus:p[5]||(p[5]=(...g)=>I(l)&&I(l)(...g)),onChange:p[6]||(p[6]=(...g)=>I(h)&&I(h)(...g))},[T("option",BL,ve(I(i).length?"选择预设":"无预设文件"),1),(q(!0),J(_e,null,Et(I(i),g=>(q(),J("option",{key:g.file,value:g.file},ve(g.name),9,NL))),128))],40,LL),[[bt,I(t)]]),T("input",{ref_key:"configFileInput",ref:e,hidden:"",type:"file",accept:".json,application/json",onChange:p[7]||(p[7]=(...g)=>I(c)&&I(c)(...g))},null,544)]),I(r)?(q(),J("div",{key:0,class:Ce(["config-message",{error:I(o)}])},ve(I(r)),3)):xe("",!0)],512),[[Si,!I(u).config]])]))}}),UL=Jt(DL,[["__scopeId","data-v-cb52d3e0"]]),$L={class:"ns-label"},XL=["min","max","step","value","disabled"],VL=["min","max","step","value","disabled"],YL=Zt({__name:"NumSlider",props:{label:{},modelValue:{},min:{},max:{},step:{},disabled:{type:Boolean}},emits:["update:modelValue"],setup(s,{emit:e}){const t=s,i=e,n=Fe(String(t.modelValue));ai(()=>t.modelValue,c=>{n.value=String(c)});function r(c){const l=parseFloat(c.target.value);Number.isNaN(l)||i("update:modelValue",l)}function o(c){n.value=c.target.value;const l=parseFloat(n.value);Number.isNaN(l)||i("update:modelValue",l)}function a(){const c=parseFloat(n.value);Number.isNaN(c)&&(n.value=String(t.modelValue))}return(c,l)=>(q(),J("div",{class:Ce(["ns",{disabled:s.disabled}])},[T("span",$L,ve(s.label),1),T("input",{type:"range",class:"ns-range",min:s.min,max:s.max,step:s.step,value:s.modelValue,disabled:s.disabled,onInput:r},null,40,XL),T("input",{type:"number",class:"ns-num",min:s.min,max:s.max,step:s.step,value:n.value,disabled:s.disabled,onInput:o,onBlur:a},null,40,VL)],2))}}),Oe=Jt(YL,[["__scopeId","data-v-7c2fbed0"]]),GL={class:"ce"},jL={class:"ce-editor"},HL={class:"ce-grid"},WL=["x1","x2","y2"],zL=["y1","x2","y2"],qL=["x","y","width","height"],KL=["d"],ZL={key:0,class:"ce-handles"},JL=["x1","y1","x2","y2"],QL=["cx","cy","onPointerdown"],eB=["x1","y1","x2","y2"],tB=["cx","cy","onPointerdown"],iB=["cx","cy"],sB=["cx","cy","onPointerdown","onDblclick"],nB={class:"ce-nav"},rB={class:"ce-tip"},ir=8,oB=Zt({__name:"CurveEditor",props:{modelValue:{},defaultValue:{default:()=>[{x:0,y:0},{x:1,y:1}]},mode:{default:"linear"}},emits:["update:modelValue"],setup(s,{emit:e}){const t=s,i=e,n=Fe(null),r=Fe(300),o=Fe(110);let a=null;function c(){if(!n.value)return;const E=n.value.getBoundingClientRect();r.value=E.width,o.value=E.height}function l(E){return ir+E*(r.value-ir*2)}function h(E){return ir+(1-E)*(o.value-ir*2)}function u(){return[...t.modelValue].sort((E,R)=>E.x-R.x)}function d(E){i("update:modelValue",[...E].sort((R,O)=>R.x-O.x))}function f(){d(t.defaultValue.map(E=>({...E})))}const m=Le(()=>u());function p(E){const R=m.value[E],O=m.value[Math.max(0,E-1)];return{x:R.x-(R.x-O.x)/3,y:R.y-(R.y-O.y)/3}}function g(E){const R=m.value[E],O=m.value[Math.min(m.value.length-1,E+1)];return{x:R.x+(O.x-R.x)/3,y:R.y+(O.y-R.y)/3}}function x(E){const R=m.value[E],O=p(E);return{x:R.x+(R.inX??O.x-R.x),y:R.y+(R.inY??O.y-R.y)}}function v(E){const R=m.value[E],O=g(E);return{x:R.x+(R.outX??O.x-R.x),y:R.y+(R.outY??O.y-R.y)}}const y=Le(()=>{if(!m.value.length)return"";let E=`M ${l(m.value[0].x)} ${h(m.value[0].y)}`;for(let R=1;R<m.value.length;R++){const O=m.value[R];if(t.mode==="bezier"){const U=v(R-1),Y=x(R);E+=` C ${l(U.x)} ${h(U.y)} ${l(Y.x)} ${h(Y.y)} ${l(O.x)} ${h(O.y)}`}else E+=` L ${l(O.x)} ${h(O.y)}`}return E});function S(E,R){const O=n.value.getBoundingClientRect(),U=(E-O.left-ir)/(r.value-ir*2),Y=(R-O.top-ir)/(o.value-ir*2);return{x:Math.min(1,Math.max(0,Math.round(U*100)/100)),y:Math.min(1,Math.max(0,Math.round((1-Y)*100)/100))}}let C=0;function w(E){if(E.target.classList.contains("ce-hit")||Date.now()-C<400)return;const{x:R,y:O}=S(E.clientX,E.clientY),U=u().filter(Y=>Math.abs(Y.x-R)>.02);U.push({x:R,y:O}),d(U)}let b={t:0,i:-1,x:0,y:0};function _(E,R){E.stopPropagation();const O=u().findIndex(X=>Math.abs(X.x-m.value[R].x)<1e-6&&Math.abs(X.y-m.value[R].y)<1e-6);if(O<0)return;const U=Date.now();if(U-b.t<300&&b.i===R&&Math.abs(E.clientX-b.x)<8&&Math.abs(E.clientY-b.y)<8){b={t:0,i:-1,x:0,y:0},P(R);return}b={t:U,i:R,x:E.clientX,y:E.clientY};const Y=X=>{(Math.abs(X.clientX-E.clientX)>8||Math.abs(X.clientY-E.clientY)>8)&&(b={t:0,i:-1,x:0,y:0});const{x:D,y:F}=S(X.clientX,X.clientY),N=u();N[O]={x:D,y:F},d(N)},$=()=>{window.removeEventListener("pointermove",Y),window.removeEventListener("pointerup",$)};window.addEventListener("pointermove",Y),window.addEventListener("pointerup",$)}function A(E,R,O){E.stopPropagation();const U=$=>{const X=S($.clientX,$.clientY),D=u(),F=D[R],N=O==="in"?D[Math.max(0,R-1)].x:F.x,k=O==="in"?F.x:D[Math.min(D.length-1,R+1)].x,V=Math.min(k,Math.max(N,X.x)),G=Math.round((V-F.x)*100)/100,W=Math.round((X.y-F.y)*100)/100;D[R]=O==="in"?{...F,inX:G,inY:W}:{...F,outX:G,outY:W},d(D)},Y=()=>{window.removeEventListener("pointermove",U),window.removeEventListener("pointerup",Y)};window.addEventListener("pointermove",U),window.addEventListener("pointerup",Y)}function P(E,R){R==null||R.stopPropagation();const O=u();O.length<=2||(C=Date.now(),d(O.filter((U,Y)=>Y!==E)))}return ys(()=>{c(),a=new ResizeObserver(c),n.value&&a.observe(n.value)}),Al(()=>{a==null||a.disconnect()}),(E,R)=>(q(),J("div",GL,[T("div",jL,[(q(),J("svg",{ref_key:"svg",ref:n,class:"ce-svg",onDblclick:w},[T("g",HL,[(q(),J(_e,null,Et([.25,.5,.75],O=>T("line",{key:"v"+O,x1:l(O),y1:"0",x2:l(O),y2:h(0)},null,8,WL)),64)),(q(),J(_e,null,Et([.25,.5,.75],O=>T("line",{key:"h"+O,x1:"0",y1:h(O),x2:l(1),y2:h(O)},null,8,zL)),64))]),T("rect",{x:l(0),y:h(1),width:l(1)-l(0),height:h(0)-h(1),class:"ce-frame",fill:"none"},null,8,qL),T("path",{d:y.value,class:"ce-line",fill:"none"},null,8,KL),s.mode==="bezier"?(q(),J("g",ZL,[(q(!0),J(_e,null,Et(m.value,(O,U)=>(q(),J(_e,{key:"handles-"+U},[U>0?(q(),J("line",{key:0,x1:l(O.x),y1:h(O.y),x2:l(x(U).x),y2:h(x(U).y)},null,8,JL)):xe("",!0),U>0?(q(),J("circle",{key:1,cx:l(x(U).x),cy:h(x(U).y),r:"4",onPointerdown:Y=>A(Y,U,"in")},null,40,QL)):xe("",!0),U<m.value.length-1?(q(),J("line",{key:2,x1:l(O.x),y1:h(O.y),x2:l(v(U).x),y2:h(v(U).y)},null,8,eB)):xe("",!0),U<m.value.length-1?(q(),J("circle",{key:3,cx:l(v(U).x),cy:h(v(U).y),r:"4",onPointerdown:Y=>A(Y,U,"out")},null,40,tB)):xe("",!0)],64))),128))])):xe("",!0),(q(!0),J(_e,null,Et(m.value,(O,U)=>(q(),J("g",{key:U},[T("circle",{cx:l(O.x),cy:h(O.y),r:"5",class:"ce-node"},null,8,iB),T("circle",{cx:l(O.x),cy:h(O.y),r:"9",class:"ce-hit",onPointerdown:Y=>_(Y,U),onDblclick:Y=>P(U,Y)},null,40,sB)]))),128))],544)),T("div",nB,[T("span",rB,ve(s.mode==="bezier"?"拖动方形手柄调整弧度·双击空白新建·双击节点删除":"双击空白新建·双击节点删除·拖动节点调整"),1)])]),T("button",{class:"ce-reset",type:"button",title:"恢复默认曲线",onClick:f},"重置")]))}}),tn=Jt(oB,[["__scopeId","data-v-9bfb7b31"]]),aB={class:"spine-editor"},lB={class:"field wide"},cB={class:"grid three"},hB={class:"field"},uB={class:"field"},dB={class:"field"},fB={class:"grid three"},mB={class:"field"},pB={class:"field"},gB={class:"field"},vB=["disabled"],yB={class:"asset-row"},xB=["title"],bB={class:"asset-row"},wB=["title"],SB={class:"asset-row"},MB=["title"],TB={class:"asset-actions"},_B=["disabled"],CB={class:"runtime-note"},EB={key:0},AB={key:0,class:"error"},IB={class:"section-box"},RB={key:0,class:"empty"},PB={key:1,class:"field wide"},kB=["value"],FB={class:"section-box"},OB={class:"tree-title-row"},LB=["disabled","title"],BB=["disabled","title"],NB={class:"tree-tabs"},DB={key:0,class:"empty"},UB={key:1,class:"bone-search"},$B={key:2,class:"empty"},XB={key:3,class:"bone-tree"},VB=["onClick","onKeydown"],YB=["title","onClick"],GB={key:1,class:"bone-leaf"},jB={class:"bone-name"},HB={key:0,class:"empty"},WB={key:1,class:"bone-search"},zB={key:2,class:"empty"},qB={key:3,class:"bone-tree slot-tree"},KB=["title","onClick","onKeydown"],ZB={class:"slot-order"},JB={class:"bone-name"},QB={class:"slot-attachment"},eN=Zt({__name:"SpineObjectPanel",props:{spineObject:{}},setup(s){const e=s,t=yo(),i=Fe(null),n=Fe(null),r=Fe(null),o=Fe(null),a=Fe(new Set),c=Fe(""),l=Fe("bone"),h=Fe(""),u=Fe(null),d=Fe(null),f=Fe([]);e.spineObject.selectedBone==null&&(e.spineObject.selectedBone=""),e.spineObject.selectedSlot==null&&(e.spineObject.selectedSlot=""),Array.isArray(e.spineObject.slots)||(e.spineObject.slots=[]),e.spineObject.sourceBundle==null&&(e.spineObject.sourceBundle=null),e.spineObject.dataVersion==null&&(e.spineObject.dataVersion="");const m=Le(()=>{var k;return((k=u.value)==null?void 0:k.name)||e.spineObject.skeletonFileName}),p=Le(()=>{var k;return((k=d.value)==null?void 0:k.name)||e.spineObject.atlasFileName}),g=Le(()=>f.value.length?f.value.map(k=>k.name):e.spineObject.textureFileNames),x=Le(()=>g.value.length?`${g.value.length} 张:${g.value.join(", ")}`:"PNG / JPEG / WebP..."),v=Le(()=>new Set(e.spineObject.bones.map(k=>k.parent).filter(k=>!!k))),y=Le(()=>new Map(e.spineObject.bones.map(k=>[k.name,k]))),S=Le(()=>e.spineObject.bones.filter(k=>{var W;const V=c.value.trim().toLocaleLowerCase();if(V)return k.name.toLocaleLowerCase().includes(V);let G=k.parent;for(;G;){if(a.value.has(G))return!1;G=((W=y.value.get(G))==null?void 0:W.parent)||null}return!0})),C=Le(()=>v.value.size>0&&[...v.value].every(k=>a.value.has(k))),w=Le(()=>{const k=h.value.trim().toLocaleLowerCase(),V=[...e.spineObject.slots].sort((G,W)=>G.order-W.order);return k?V.filter(G=>G.name.toLocaleLowerCase().includes(k)||G.attachment.toLocaleLowerCase().includes(k)):V});function b(k){const V=e.spineObject.selectedBone===k;for(const G of t.spines)G.selectedBone="";V||(e.spineObject.selectedBone=k)}function _(k){const V=e.spineObject.selectedSlot===k;for(const G of t.spines)G.selectedSlot="";V||(e.spineObject.selectedSlot=k)}function A(k){a.value.has(k)?a.value.delete(k):a.value.add(k)}function P(){a.value=C.value?new Set:new Set(v.value)}function E(k){var V;return((V=k.target.files)==null?void 0:V[0])||null}function R(k){u.value=E(k)}function O(k){d.value=E(k)}function U(k){f.value=Array.from(k.target.files||[])}function Y(k){return k.name.replace(/\.[^.]+$/,"").toLocaleLowerCase()}async function $(k){const V=Array.from(k.target.files||[]);if(!V.length)return;const G=V.filter(pe=>/\.(json|skel)$/i.test(pe.name)),W=V.filter(pe=>/\.atlas$/i.test(pe.name)),Z=V.filter(pe=>/\.(png|jpe?g|webp|wepb)$/i.test(pe.name)),ne=W.map(pe=>({atlas:pe,skeleton:G.find(he=>Y(he)===Y(pe))})).find(pe=>pe.skeleton),oe=(ne==null?void 0:ne.skeleton)||G[0]||null,de=(ne==null?void 0:ne.atlas)||W[0]||null;if(u.value=oe,d.value=de,f.value=Z,!oe||!de||!Z.length){const pe=[!oe&&"JSON / SKEL",!de&&"Atlas",!Z.length&&"纹理图片"].filter(Boolean).join("、");e.spineObject.status="error",e.spineObject.error=`所选文件夹缺少:${pe}`;return}await F()}function X(){t.recalcTotalFrames()}function D(){X(),t.timeline.frame=0}async function F(){var G;const k=u.value,V=d.value;if(!k||!V||!f.value.length){e.spineObject.status="error",e.spineObject.error="请依次选择 Spine 数据、Atlas 和全部纹理图片";return}e.spineObject.status="loading",e.spineObject.error="";try{const W=await Dw(k,V,f.value);pu(e.spineObject.id,W),e.spineObject.skeletonFileName=k.name,e.spineObject.atlasFileName=V.name,e.spineObject.textureFileNames=f.value.map(Z=>Z.name),e.spineObject.dataVersion=W.dataVersion,e.spineObject.animations=W.animations,e.spineObject.bones=W.bones,e.spineObject.slots=W.slots,e.spineObject.selectedBone="",e.spineObject.selectedSlot="",c.value="",h.value="",a.value=new Set,e.spineObject.selectedAnimation=((G=W.animations[0])==null?void 0:G.name)||"",e.spineObject.assetVersion++,e.spineObject.status="ready",X(),t.timeline.frame=0;try{e.spineObject.sourceBundle=await Pk(k,V,f.value)}catch(Z){e.spineObject.sourceBundle=null,console.warn("Spine 配置资源嵌入失败",Z)}}catch(W){e.spineObject.status="error",e.spineObject.error=W instanceof Error?W.message:String(W)}}function N(){Fl(e.spineObject.id),u.value=null,d.value=null,f.value=[],i.value&&(i.value.value=""),n.value&&(n.value.value=""),r.value&&(r.value.value=""),o.value&&(o.value.value=""),e.spineObject.skeletonFileName="",e.spineObject.atlasFileName="",e.spineObject.textureFileNames=[],e.spineObject.dataVersion="",e.spineObject.sourceBundle=null,e.spineObject.animations=[],e.spineObject.bones=[],e.spineObject.slots=[],e.spineObject.selectedBone="",e.spineObject.selectedSlot="",c.value="",h.value="",a.value=new Set,e.spineObject.selectedAnimation="",e.spineObject.assetVersion++,e.spineObject.status="empty",e.spineObject.error="",X()}return(k,V)=>(q(),J("div",aB,[V[38]||(V[38]=T("div",{class:"editor-title"},"Spine 属性",-1)),T("label",lB,[V[20]||(V[20]=T("span",null,"Spine 名称",-1)),ce(T("input",{"onUpdate:modelValue":V[0]||(V[0]=G=>s.spineObject.name=G)},null,512),[[He,s.spineObject.name]])]),T("div",cB,[T("label",hB,[V[21]||(V[21]=T("span",null,"X 位置",-1)),ce(T("input",{"onUpdate:modelValue":V[1]||(V[1]=G=>s.spineObject.x=G),type:"number"},null,512),[[He,s.spineObject.x,void 0,{number:!0}]])]),T("label",uB,[V[22]||(V[22]=T("span",null,"Y 位置",-1)),ce(T("input",{"onUpdate:modelValue":V[2]||(V[2]=G=>s.spineObject.y=G),type:"number"},null,512),[[He,s.spineObject.y,void 0,{number:!0}]])]),T("label",dB,[V[23]||(V[23]=T("span",null,"旋转",-1)),ce(T("input",{"onUpdate:modelValue":V[3]||(V[3]=G=>s.spineObject.rotation=G),type:"number"},null,512),[[He,s.spineObject.rotation,void 0,{number:!0}]])])]),T("div",fB,[T("label",mB,[V[24]||(V[24]=T("span",null,"Scale X",-1)),ce(T("input",{"onUpdate:modelValue":V[4]||(V[4]=G=>s.spineObject.scaleX=G),type:"number",step:"0.05"},null,512),[[He,s.spineObject.scaleX,void 0,{number:!0}]])]),T("label",pB,[V[25]||(V[25]=T("span",null,"Scale Y",-1)),ce(T("input",{"onUpdate:modelValue":V[5]||(V[5]=G=>s.spineObject.scaleY=G),type:"number",step:"0.05"},null,512),[[He,s.spineObject.scaleY,void 0,{number:!0}]])]),T("label",gB,[V[26]||(V[26]=T("span",null,"开始时间",-1)),ce(T("input",{"onUpdate:modelValue":V[6]||(V[6]=G=>s.spineObject.timeOffset=G),type:"number",min:"0",step:"0.033333",onChange:X},null,544),[[He,s.spineObject.timeOffset,void 0,{number:!0}]])])]),V[39]||(V[39]=T("div",{class:"divider"},null,-1)),V[40]||(V[40]=T("div",{class:"section-title"},"Spine 资源",-1)),T("input",{ref_key:"skeletonInput",ref:i,hidden:"",type:"file",accept:".json,.skel,application/json,application/octet-stream",onChange:R},null,544),T("input",{ref_key:"atlasInput",ref:n,hidden:"",type:"file",accept:".atlas,text/plain",onChange:O},null,544),T("input",{ref_key:"textureInput",ref:r,hidden:"",type:"file",multiple:"",accept:".png,.jpg,.jpeg,.webp,.wepb,image/png,image/jpeg,image/webp",onChange:U},null,544),T("input",{ref_key:"folderInput",ref:o,hidden:"",type:"file",multiple:"",webkitdirectory:"",directory:"",onChange:$},null,544),T("button",{class:"folder-select",disabled:s.spineObject.status==="loading",onClick:V[7]||(V[7]=G=>{var W;return(W=o.value)==null?void 0:W.click()})},"选择文件夹并加载",8,vB),V[41]||(V[41]=T("div",{class:"folder-hint"},"一次读取文件夹中的 JSON / SKEL、Atlas 和全部纹理;仍可在下方单独替换资源。",-1)),T("div",yB,[T("div",{class:"asset-name",title:m.value},ve(m.value||"JSON / SKEL..."),9,xB),T("button",{onClick:V[8]||(V[8]=G=>{var W;return(W=i.value)==null?void 0:W.click()})},"选择")]),T("div",bB,[T("div",{class:"asset-name",title:p.value},ve(p.value||"Atlas..."),9,wB),T("button",{onClick:V[9]||(V[9]=G=>{var W;return(W=n.value)==null?void 0:W.click()})},"选择")]),T("div",SB,[T("div",{class:"asset-name",title:g.value.join(", ")},ve(x.value),9,MB),T("button",{onClick:V[10]||(V[10]=G=>{var W;return(W=r.value)==null?void 0:W.click()})},"选择(多选)")]),T("div",TB,[T("button",{class:"load",disabled:s.spineObject.status==="loading",onClick:F},ve(s.spineObject.status==="loading"?"加载中…":"↧ 加载"),9,_B),T("button",{class:"clear",onClick:N},"清除")]),T("div",CB,[V[27]||(V[27]=ft(" 支持 Spine 3.8 / 4.0 / 4.1 / 4.2 / 4.3 JSON · 对应版本运行时按需加载 · 本地离线 ",-1)),s.spineObject.dataVersion?(q(),J("span",EB," · 当前资源 "+ve(s.spineObject.dataVersion),1)):xe("",!0)]),s.spineObject.error?(q(),J("div",AB,ve(s.spineObject.error),1)):xe("",!0),T("div",IB,[V[30]||(V[30]=T("div",{class:"section-title"},"Spine 动画",-1)),s.spineObject.animations.length?(q(),J("label",PB,[V[29]||(V[29]=T("span",null,"时间轴播放动画",-1)),ce(T("select",{"onUpdate:modelValue":V[11]||(V[11]=G=>s.spineObject.selectedAnimation=G),onChange:D},[V[28]||(V[28]=T("option",{value:""},"无",-1)),(q(!0),J(_e,null,Et(s.spineObject.animations,G=>(q(),J("option",{key:G.name,value:G.name},ve(G.name)+"("+ve(G.duration.toFixed(2))+"s) ",9,kB))),128))],544),[[bt,s.spineObject.selectedAnimation]])])):(q(),J("div",RB,"无可用动画"))]),T("div",FB,[T("div",OB,[V[37]||(V[37]=T("div",{class:"section-title"},"层级树",-1)),l.value==="bone"?(q(),J("button",{key:0,class:Ce(["selected-bone",{active:s.spineObject.selectedBone}]),disabled:!s.spineObject.selectedBone,title:s.spineObject.selectedBone?"点击清除骨骼选择":"当前未选择骨骼",onClick:V[12]||(V[12]=G=>s.spineObject.selectedBone="")},[s.spineObject.selectedBone?(q(),J(_e,{key:0},[V[31]||(V[31]=ft("清除选中骨骼:",-1)),T("strong",null,ve(s.spineObject.selectedBone),1)],64)):(q(),J(_e,{key:1},[V[32]||(V[32]=ft("当前骨骼:",-1)),V[33]||(V[33]=T("strong",null,"未选择",-1))],64))],10,LB)):(q(),J("button",{key:1,class:Ce(["selected-bone",{active:s.spineObject.selectedSlot}]),disabled:!s.spineObject.selectedSlot,title:s.spineObject.selectedSlot?"点击清除插槽选择":"当前未选择插槽",onClick:V[13]||(V[13]=G=>s.spineObject.selectedSlot="")},[s.spineObject.selectedSlot?(q(),J(_e,{key:0},[V[34]||(V[34]=ft("清除选中插槽:",-1)),T("strong",null,ve(s.spineObject.selectedSlot),1)],64)):(q(),J(_e,{key:1},[V[35]||(V[35]=ft("当前插槽:",-1)),V[36]||(V[36]=T("strong",null,"未选择",-1))],64))],10,BB)),l.value==="bone"&&s.spineObject.bones.length?(q(),J("button",{key:2,class:"tree-action",onClick:P},ve(C.value?"全部展开":"全部折叠"),1)):xe("",!0)]),T("div",NB,[T("button",{class:Ce({on:l.value==="bone"}),onClick:V[14]||(V[14]=G=>l.value="bone")},"骨骼",2),T("button",{class:Ce({on:l.value==="slot"}),onClick:V[15]||(V[15]=G=>l.value="slot")},"插槽",2)]),l.value==="bone"?(q(),J(_e,{key:0},[s.spineObject.bones.length?(q(),J("div",UB,[ce(T("input",{"onUpdate:modelValue":V[16]||(V[16]=G=>c.value=G),type:"search","aria-label":"搜索骨骼",placeholder:"搜索骨骼名称…"},null,512),[[He,c.value,void 0,{trim:!0}]]),c.value?(q(),J("button",{key:0,title:"清空搜索","aria-label":"清空骨骼搜索",onClick:V[17]||(V[17]=G=>c.value="")},"✕")):xe("",!0)])):(q(),J("div",DB,"未加载 Spine")),s.spineObject.bones.length&&!S.value.length?(q(),J("div",$B,"未找到匹配的骨骼")):s.spineObject.bones.length?(q(),J("div",XB,[(q(!0),J(_e,null,Et(S.value,G=>(q(),J("div",{key:G.name,class:Ce(["bone",{selected:s.spineObject.selectedBone===G.name}]),style:Ot({paddingLeft:`${6+G.depth*16}px`}),role:"button",tabindex:"0",onClick:W=>b(G.name),onKeydown:Mr(qe(W=>b(G.name),["prevent"]),["enter"])},[v.value.has(G.name)?(q(),J("button",{key:0,class:"bone-toggle",title:a.value.has(G.name)?"展开子骨骼":"折叠子骨骼",onClick:qe(W=>A(G.name),["stop"])},ve(a.value.has(G.name)?"▸":"▾"),9,YB)):(q(),J("span",GB,"•")),T("span",jB,ve(G.name),1)],46,VB))),128))])):xe("",!0)],64)):(q(),J(_e,{key:1},[s.spineObject.slots.length?(q(),J("div",WB,[ce(T("input",{"onUpdate:modelValue":V[18]||(V[18]=G=>h.value=G),type:"search","aria-label":"搜索插槽",placeholder:"搜索插槽或附件名称…"},null,512),[[He,h.value,void 0,{trim:!0}]]),h.value?(q(),J("button",{key:0,title:"清空搜索","aria-label":"清空插槽搜索",onClick:V[19]||(V[19]=G=>h.value="")},"✕")):xe("",!0)])):(q(),J("div",HB,"未加载 Spine 插槽")),s.spineObject.slots.length&&!w.value.length?(q(),J("div",zB,"未找到匹配的插槽")):s.spineObject.slots.length?(q(),J("div",qB,[(q(!0),J(_e,null,Et(w.value,G=>(q(),J("div",{key:G.name,class:Ce(["bone slot-row",{selected:s.spineObject.selectedSlot===G.name}]),role:"button",tabindex:"0",title:`${G.name}(骨骼:${G.bone||"-"},附件:${G.attachment||"空"})`,onClick:W=>_(G.name),onKeydown:Mr(qe(W=>_(G.name),["prevent"]),["enter"])},[T("span",ZB,ve(G.order+1),1),T("span",JB,ve(G.name),1),T("span",QB,ve(G.attachment||"空"),1)],42,KB))),128))])):xe("",!0)],64))])]))}}),tN=Jt(eN,[["__scopeId","data-v-3545b078"]]),iN={class:"group"},sN={class:"caret"},nN={class:"scene-actions"},rN=["disabled"],oN={class:"group-body"},aN={class:"tree scene-tree"},lN=["onClick"],cN={key:0,class:"sub-branch"},hN={key:1,class:"tdot"},uN={class:"tlabel"},dN=["title","aria-label","onClick"],fN={viewBox:"0 0 24 24","aria-hidden":"true"},mN={key:0,class:"eye-slash",d:"M4 4l16 16"},pN=["onClick"],gN=["onClick"],vN={class:"tlabel"},yN=["title","aria-label","onClick"],xN={viewBox:"0 0 24 24","aria-hidden":"true"},bN={key:0,class:"eye-slash",d:"M4 4l16 16"},wN=["onClick"],SN=["onClick"],MN={class:"tlabel"},TN=["title","aria-label","onClick"],_N={viewBox:"0 0 24 24","aria-hidden":"true"},CN={key:0,class:"eye-slash",d:"M4 4l16 16"},EN=["onClick"],AN=["onClick"],IN={class:"tlabel"},RN=["title","aria-label","onClick"],PN={viewBox:"0 0 24 24","aria-hidden":"true"},kN={key:0,class:"eye-slash",d:"M4 4l16 16"},FN=["onClick"],ON={key:0,class:"empty"},LN={class:"row"},BN={class:"seed-row scene-seed"},NN={class:"field-block"},DN={class:"field-grid"},UN={class:"field-block"},$N={class:"field-block check-field"},XN={class:"field-grid"},VN={class:"compact-field"},YN={class:"compact-field"},GN={class:"field-grid"},jN={class:"compact-field"},HN={class:"compact-field"},WN={key:1,class:"field-grid"},zN={class:"compact-field"},qN={class:"compact-field"},KN={key:2,class:"field-grid"},ZN={class:"compact-field"},JN={class:"compact-field"},QN={class:"field-block"},eD={key:4,class:"field-grid"},tD={class:"compact-field"},iD={class:"compact-field"},sD={class:"collider-follow-section"},nD={class:"follow-path"},rD={class:"field-block"},oD=["value"],aD={class:"field-grid"},lD={class:"compact-field"},cD={class:"compact-field"},hD={class:"follow-path"},uD={class:"field-block"},dD={class:"field-grid"},fD={class:"compact-field"},mD={class:"compact-field"},pD={class:"field-grid"},gD={class:"compact-field"},vD={class:"compact-field"},yD={class:"setting-line"},xD={class:"setting-line"},bD={class:"field-block"},wD={key:4,class:"panel-hint"},SD=Zt({__name:"SceneObjectsSection",setup(s){const{store:e,resolvedCurveEditorMode:t,sys:i,activeObjectType:n,activeCollider:r,activePath:o,activeSpine:a,canCopyObject:c,collapsed:l,toggle:h,addSys:u,addCollider:d,addPath:f,addSpine:m,copySelectedObject:p,applyPathPreset:g,clearPathAnchors:x,randomizeSeed:v,LINEAR_CURVE:y}=Fr(),S=Le(()=>{const C=new Map(e.systems.map(E=>[E.id,E])),w=new Map;for(const E of e.systems)if(E.config.eventEnabled!==!1)for(const R of E.config.events||[])R.targetSystemId<=0||R.targetSystemId===E.id||!C.has(R.targetSystemId)||w.has(R.targetSystemId)||w.set(R.targetSystemId,E.id);const b=new Map;for(const[E,R]of w){const O=b.get(R);O?O.push(E):b.set(R,[E])}const _=[],A=new Set,P=(E,R)=>{if(!A.has(E.id)){A.add(E.id),_.push({system:E,depth:R});for(const O of b.get(E.id)||[]){const U=C.get(O);U&&P(U,R+1)}}};for(const E of e.systems)w.has(E.id)||P(E,0);for(const E of e.systems)A.has(E.id)||P(E,0);return _});return(C,w)=>(q(),J("div",iN,[T("div",{class:"group-head scene-head",onClick:w[5]||(w[5]=b=>I(h)("scene"))},[T("span",sN,ve(I(l).scene?"▸":"▾"),1),w[50]||(w[50]=T("span",null,"场景对象",-1)),T("div",nN,[T("button",{class:"scene-add",title:"添加粒子系统",onClick:w[0]||(w[0]=qe((...b)=>I(u)&&I(u)(...b),["stop"]))},"+粒子"),T("button",{class:"scene-add",title:"添加碰撞体",onClick:w[1]||(w[1]=qe((...b)=>I(d)&&I(d)(...b),["stop"]))},"+碰撞"),T("button",{class:"scene-add",title:"添加路径",onClick:w[2]||(w[2]=qe((...b)=>I(f)&&I(f)(...b),["stop"]))},"+路径"),T("button",{class:"scene-add",title:"添加 Spine",onClick:w[3]||(w[3]=qe((...b)=>I(m)&&I(m)(...b),["stop"]))},"+Spine"),T("button",{class:"scene-add",disabled:!I(c),title:"复制当前选中的场景对象",onClick:w[4]||(w[4]=qe((...b)=>I(p)&&I(p)(...b),["stop"]))},"+Copy",8,rN)])]),ce(T("div",oN,[T("div",aN,[(q(!0),J(_e,null,Et(S.value,b=>(q(),J("div",{key:`particle-${b.system.id}`,class:Ce(["tree-item scene-object-item",{on:I(n)==="particle"&&b.system.id===I(e).activeObjectId,"scene-object-child":b.depth>0}]),style:Ot(b.depth>0?{paddingLeft:`${b.depth*18}px`}:void 0),onClick:_=>I(e).selectSystem(b.system.id)},[b.depth>0?(q(),J("span",cN,"└")):(q(),J("span",hN,"●")),T("span",uN,ve(b.system.config.name||"ParticleSystem"),1),T("button",{class:Ce(["scene-object-eye",{off:b.system.visible===!1}]),title:b.system.visible===!1?"显示粒子系统":"隐藏粒子系统","aria-label":b.system.visible===!1?"显示粒子系统":"隐藏粒子系统",onClick:qe(_=>b.system.visible=b.system.visible===!1,["stop"])},[(q(),J("svg",fN,[w[51]||(w[51]=T("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)),w[52]||(w[52]=T("circle",{cx:"12",cy:"12",r:"2.8"},null,-1)),b.system.visible===!1?(q(),J("path",mN)):xe("",!0)]))],10,dN),T("span",{class:Ce(["scene-object-kind",{"sub-emitter-kind":b.depth>0}])},ve(b.depth>0?"子发射器":"粒子"),3),T("button",{class:"scene-object-delete",title:"删除粒子系统",onClick:qe(_=>I(e).removeSystem(b.system.id),["stop"])},"✕",8,pN)],14,lN))),128)),(q(!0),J(_e,null,Et(I(e).colliders,b=>(q(),J("div",{key:`collision-${b.id}`,class:Ce(["tree-item scene-object-item",{on:I(n)==="collision"&&b.id===I(e).activeObjectId}]),onClick:_=>I(e).selectSceneObject("collision",b.id)},[w[55]||(w[55]=T("span",{class:"tdot collision-dot"},"■",-1)),T("span",vN,ve(b.name),1),T("button",{class:Ce(["scene-object-eye",{off:b.visible===!1}]),title:b.visible===!1?"显示碰撞体":"隐藏碰撞体","aria-label":b.visible===!1?"显示碰撞体":"隐藏碰撞体",onClick:qe(_=>b.visible=b.visible===!1,["stop"])},[(q(),J("svg",xN,[w[53]||(w[53]=T("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)),w[54]||(w[54]=T("circle",{cx:"12",cy:"12",r:"2.8"},null,-1)),b.visible===!1?(q(),J("path",bN)):xe("",!0)]))],10,yN),w[56]||(w[56]=T("span",{class:"scene-object-kind"},"碰撞",-1)),T("button",{class:"scene-object-delete",title:"删除碰撞体",onClick:qe(_=>I(e).removeCollider(b.id),["stop"])},"✕",8,wN)],10,gN))),128)),(q(!0),J(_e,null,Et(I(e).paths,b=>(q(),J("div",{key:`path-${b.id}`,class:Ce(["tree-item scene-object-item",{on:I(n)==="path"&&b.id===I(e).activeObjectId}]),onClick:_=>I(e).selectSceneObject("path",b.id)},[w[59]||(w[59]=T("span",{class:"tdot path-dot"},"◇",-1)),T("span",MN,ve(b.name),1),T("button",{class:Ce(["scene-object-eye",{off:b.visible===!1}]),title:b.visible===!1?"显示路径":"隐藏路径","aria-label":b.visible===!1?"显示路径":"隐藏路径",onClick:qe(_=>b.visible=b.visible===!1,["stop"])},[(q(),J("svg",_N,[w[57]||(w[57]=T("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)),w[58]||(w[58]=T("circle",{cx:"12",cy:"12",r:"2.8"},null,-1)),b.visible===!1?(q(),J("path",CN)):xe("",!0)]))],10,TN),w[60]||(w[60]=T("span",{class:"scene-object-kind"},"路径",-1)),T("button",{class:"scene-object-delete",title:"删除路径",onClick:qe(_=>I(e).removePath(b.id),["stop"])},"✕",8,EN)],10,SN))),128)),(q(!0),J(_e,null,Et(I(e).spines,b=>(q(),J("div",{key:`spine-${b.id}`,class:Ce(["tree-item scene-object-item",{on:I(n)==="spine"&&b.id===I(e).activeObjectId}]),onClick:_=>I(e).selectSceneObject("spine",b.id)},[w[63]||(w[63]=T("span",{class:"tdot spine-dot"},"◆",-1)),T("span",IN,ve(b.name),1),T("button",{class:Ce(["scene-object-eye",{off:b.visible===!1}]),title:b.visible===!1?"显示 Spine":"隐藏 Spine","aria-label":b.visible===!1?"显示 Spine":"隐藏 Spine",onClick:qe(_=>b.visible=b.visible===!1,["stop"])},[(q(),J("svg",PN,[w[61]||(w[61]=T("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)),w[62]||(w[62]=T("circle",{cx:"12",cy:"12",r:"2.8"},null,-1)),b.visible===!1?(q(),J("path",kN)):xe("",!0)]))],10,RN),w[64]||(w[64]=T("span",{class:"scene-object-kind"},"Spine",-1)),T("button",{class:"scene-object-delete",title:"删除 Spine",onClick:qe(_=>I(e).removeSpine(b.id),["stop"])},"✕",8,FN)],10,AN))),128)),!I(e).systems.length&&!I(e).colliders.length&&!I(e).paths.length&&!I(e).spines.length?(q(),J("div",ON,"场景中暂无对象")):xe("",!0)]),I(n)==="particle"&&I(i)?(q(),J(_e,{key:0},[T("label",LN,[w[65]||(w[65]=T("span",null,"名称",-1)),ce(T("input",{"onUpdate:modelValue":w[6]||(w[6]=b=>I(i).config.name=b),class:"inp"},null,512),[[He,I(i).config.name]])]),we(Oe,{label:"位置X",min:-2e3,max:2e3,step:1,modelValue:I(i).config.centerX,"onUpdate:modelValue":w[7]||(w[7]=b=>I(i).config.centerX=b)},null,8,["modelValue"]),we(Oe,{label:"位置Y",min:-2e3,max:2e3,step:1,modelValue:I(i).config.centerY,"onUpdate:modelValue":w[8]||(w[8]=b=>I(i).config.centerY=b)},null,8,["modelValue"]),we(Oe,{label:"偏移X",min:-2e3,max:2e3,step:1,modelValue:I(i).config.offsetX,"onUpdate:modelValue":w[9]||(w[9]=b=>I(i).config.offsetX=b)},null,8,["modelValue"]),we(Oe,{label:"偏移Y",min:-2e3,max:2e3,step:1,modelValue:I(i).config.offsetY,"onUpdate:modelValue":w[10]||(w[10]=b=>I(i).config.offsetY=b)},null,8,["modelValue"]),we(Oe,{label:"旋转",min:-360,max:360,step:1,modelValue:I(i).config.rootRotation,"onUpdate:modelValue":w[11]||(w[11]=b=>I(i).config.rootRotation=b)},null,8,["modelValue"]),we(Oe,{label:"缩放X",min:.05,max:10,step:.05,modelValue:I(i).config.rootScaleX,"onUpdate:modelValue":w[12]||(w[12]=b=>I(i).config.rootScaleX=b)},null,8,["modelValue"]),we(Oe,{label:"缩放Y",min:.05,max:10,step:.05,modelValue:I(i).config.rootScaleY,"onUpdate:modelValue":w[13]||(w[13]=b=>I(i).config.rootScaleY=b)},null,8,["modelValue"]),T("div",BN,[w[66]||(w[66]=T("label",{for:"system-seed"},"随机种子",-1)),ce(T("input",{id:"system-seed",class:"seed-input",type:"number",min:"0",step:"1","onUpdate:modelValue":w[14]||(w[14]=b=>I(i).config.seed=b),title:"控制粒子系统内全部随机属性、资源选择与修改器随机采样"},null,512),[[He,I(i).config.seed,void 0,{number:!0}]]),T("button",{class:"seed-random",title:"生成新的全局随机种子",onClick:w[15]||(w[15]=(...b)=>I(v)&&I(v)(...b))},"⚄")]),w[67]||(w[67]=T("div",{class:"seed-hint"},"控制初始随机参数、资源选择和修改器随机采样;相同种子可复现相同效果",-1))],64)):I(r)?(q(),J(_e,{key:1},[w[92]||(w[92]=T("div",{class:"object-editor-title"},"碰撞体属性",-1)),T("label",NN,[w[68]||(w[68]=T("span",null,"碰撞体名称",-1)),ce(T("input",{"onUpdate:modelValue":w[16]||(w[16]=b=>I(r).name=b),class:"inp"},null,512),[[He,I(r).name]])]),T("div",DN,[T("label",UN,[w[70]||(w[70]=T("span",null,"类型",-1)),ce(T("select",{"onUpdate:modelValue":w[17]||(w[17]=b=>I(r).shape=b),class:"inp"},[...w[69]||(w[69]=[is('<option value="circle" data-v-55dcf3b2>圆形</option><option value="ellipse" data-v-55dcf3b2>椭圆</option><option value="rect" data-v-55dcf3b2>矩形</option><option value="polygon" data-v-55dcf3b2>多边形</option><option value="custom" data-v-55dcf3b2>自定义</option>',5)])],512),[[bt,I(r).shape]])]),T("label",$N,[w[71]||(w[71]=T("span",null,"启用",-1)),ce(T("input",{"onUpdate:modelValue":w[18]||(w[18]=b=>I(r).enabled=b),type:"checkbox"},null,512),[[wt,I(r).enabled]])])]),T("div",XN,[T("label",VN,[w[72]||(w[72]=T("span",null,"X 位置",-1)),ce(T("input",{"onUpdate:modelValue":w[19]||(w[19]=b=>I(r).x=b),type:"number",class:"inp"},null,512),[[He,I(r).x,void 0,{number:!0}]])]),T("label",YN,[w[73]||(w[73]=T("span",null,"Y 位置",-1)),ce(T("input",{"onUpdate:modelValue":w[20]||(w[20]=b=>I(r).y=b),type:"number",class:"inp"},null,512),[[He,I(r).y,void 0,{number:!0}]])])]),we(Oe,{label:"旋转",min:-360,max:360,step:1,modelValue:I(r).rotation,"onUpdate:modelValue":w[21]||(w[21]=b=>I(r).rotation=b)},null,8,["modelValue"]),T("div",GN,[T("label",jN,[w[74]||(w[74]=T("span",null,"缩放 X",-1)),ce(T("input",{"onUpdate:modelValue":w[22]||(w[22]=b=>I(r).scaleX=b),type:"number",min:"0.05",step:"0.05",class:"inp"},null,512),[[He,I(r).scaleX,void 0,{number:!0}]])]),T("label",HN,[w[75]||(w[75]=T("span",null,"缩放 Y",-1)),ce(T("input",{"onUpdate:modelValue":w[23]||(w[23]=b=>I(r).scaleY=b),type:"number",min:"0.05",step:"0.05",class:"inp"},null,512),[[He,I(r).scaleY,void 0,{number:!0}]])])]),I(r).shape==="circle"?(q(),Ct(Oe,{key:0,label:"半径",min:1,max:1e3,step:1,modelValue:I(r).radius,"onUpdate:modelValue":w[24]||(w[24]=b=>I(r).radius=b)},null,8,["modelValue"])):I(r).shape==="ellipse"?(q(),J("div",WN,[T("label",zN,[w[76]||(w[76]=T("span",null,"X 半径",-1)),ce(T("input",{"onUpdate:modelValue":w[25]||(w[25]=b=>I(r).radiusX=b),type:"number",min:"1",class:"inp"},null,512),[[He,I(r).radiusX,void 0,{number:!0}]])]),T("label",qN,[w[77]||(w[77]=T("span",null,"Y 半径",-1)),ce(T("input",{"onUpdate:modelValue":w[26]||(w[26]=b=>I(r).radiusY=b),type:"number",min:"1",class:"inp"},null,512),[[He,I(r).radiusY,void 0,{number:!0}]])])])):(q(),J("div",KN,[T("label",ZN,[w[78]||(w[78]=T("span",null,"宽度",-1)),ce(T("input",{"onUpdate:modelValue":w[27]||(w[27]=b=>I(r).width=b),type:"number",min:"1",class:"inp"},null,512),[[He,I(r).width,void 0,{number:!0}]])]),T("label",JN,[w[79]||(w[79]=T("span",null,"高度",-1)),ce(T("input",{"onUpdate:modelValue":w[28]||(w[28]=b=>I(r).height=b),type:"number",min:"1",class:"inp"},null,512),[[He,I(r).height,void 0,{number:!0}]])])])),I(r).shape==="polygon"||I(r).shape==="custom"?(q(),Ct(Oe,{key:3,label:"边数",min:3,max:16,step:1,modelValue:I(r).sides,"onUpdate:modelValue":w[29]||(w[29]=b=>I(r).sides=b)},null,8,["modelValue"])):xe("",!0),T("label",QN,[w[81]||(w[81]=T("span",null,"碰撞响应",-1)),ce(T("select",{"onUpdate:modelValue":w[30]||(w[30]=b=>I(r).response=b),class:"inp"},[...w[80]||(w[80]=[T("option",{value:"physics"},"物理(弹跳/摩擦)",-1),T("option",{value:"pause"},"暂停(停止不动)",-1),T("option",{value:"destroy"},"消失(立即销毁)",-1)])],512),[[bt,I(r).response]])]),I(r).response==="physics"?(q(),J("div",eD,[T("label",tD,[w[82]||(w[82]=T("span",null,"弹性 (0-1)",-1)),ce(T("input",{"onUpdate:modelValue":w[31]||(w[31]=b=>I(r).elasticity=b),type:"number",min:"0",max:"1",step:"0.01",class:"inp"},null,512),[[He,I(r).elasticity,void 0,{number:!0}]])]),T("label",iD,[w[83]||(w[83]=T("span",null,"摩擦 (0-1)",-1)),ce(T("input",{"onUpdate:modelValue":w[32]||(w[32]=b=>I(r).friction=b),type:"number",min:"0",max:"1",step:"0.01",class:"inp"},null,512),[[He,I(r).friction,void 0,{number:!0}]])])])):xe("",!0),T("div",sD,[T("label",nD,[ce(T("input",{"onUpdate:modelValue":w[33]||(w[33]=b=>I(r).followPath=b),type:"checkbox"},null,512),[[wt,I(r).followPath]]),w[84]||(w[84]=ft("跟随路径移动",-1))]),I(r).followPath?(q(),J(_e,{key:0},[T("label",rD,[w[86]||(w[86]=T("span",null,"目标路径",-1)),ce(T("select",{"onUpdate:modelValue":w[34]||(w[34]=b=>I(r).followPathId=b),class:"inp"},[w[85]||(w[85]=T("option",{value:0},"(未选择)",-1)),(q(!0),J(_e,null,Et(I(e).paths,b=>(q(),J("option",{key:b.id,value:b.id},ve(b.name),9,oD))),128))],512),[[bt,I(r).followPathId,void 0,{number:!0}]])]),T("div",aD,[T("label",lD,[w[87]||(w[87]=T("span",null,"移动时长(秒)",-1)),ce(T("input",{"onUpdate:modelValue":w[35]||(w[35]=b=>I(r).followDuration=b),type:"number",min:"0.05",step:"0.05",class:"inp"},null,512),[[He,I(r).followDuration,void 0,{number:!0}]])]),T("label",cD,[w[89]||(w[89]=T("span",null,"曲线模式",-1)),ce(T("select",{"onUpdate:modelValue":w[36]||(w[36]=b=>I(r).followCurveMode=b),class:"inp"},[...w[88]||(w[88]=[T("option",null,"跟随导出",-1),T("option",null,"线性",-1),T("option",null,"贝塞尔",-1)])],512),[[bt,I(r).followCurveMode]])])]),T("label",hD,[ce(T("input",{"onUpdate:modelValue":w[37]||(w[37]=b=>I(r).followPathRotation=b),type:"checkbox"},null,512),[[wt,I(r).followPathRotation]]),w[90]||(w[90]=ft("方向沿路径",-1))]),w[91]||(w[91]=T("div",{class:"collider-curve-title"},[ft("移动进度曲线 "),T("small",null,"横轴:实时/移动时长 纵轴:路径进度(0=起点 → 1=终点)")],-1)),we(tn,{"model-value":I(r).followCurve||I(y),"default-value":I(y),mode:I(t)(I(r).followCurveMode),"onUpdate:modelValue":w[38]||(w[38]=b=>I(r).followCurve=b)},null,8,["model-value","default-value","mode"])],64)):xe("",!0)])],64)):I(o)?(q(),J(_e,{key:2},[w[102]||(w[102]=T("div",{class:"object-editor-title"},"路径属性",-1)),T("label",uD,[w[93]||(w[93]=T("span",null,"路径名称",-1)),ce(T("input",{"onUpdate:modelValue":w[39]||(w[39]=b=>I(o).name=b),class:"inp"},null,512),[[He,I(o).name]])]),T("div",dD,[T("label",fD,[w[94]||(w[94]=T("span",null,"X 位置",-1)),ce(T("input",{"onUpdate:modelValue":w[40]||(w[40]=b=>I(o).x=b),type:"number",class:"inp"},null,512),[[He,I(o).x,void 0,{number:!0}]])]),T("label",mD,[w[95]||(w[95]=T("span",null,"Y 位置",-1)),ce(T("input",{"onUpdate:modelValue":w[41]||(w[41]=b=>I(o).y=b),type:"number",class:"inp"},null,512),[[He,I(o).y,void 0,{number:!0}]])])]),we(Oe,{label:"旋转",min:-360,max:360,step:1,modelValue:I(o).rotation,"onUpdate:modelValue":w[42]||(w[42]=b=>I(o).rotation=b)},null,8,["modelValue"]),T("div",pD,[T("label",gD,[w[96]||(w[96]=T("span",null,"缩放 X",-1)),ce(T("input",{"onUpdate:modelValue":w[43]||(w[43]=b=>I(o).scaleX=b),type:"number",min:"0.05",step:"0.05",class:"inp"},null,512),[[He,I(o).scaleX,void 0,{number:!0}]])]),T("label",vD,[w[97]||(w[97]=T("span",null,"缩放 Y",-1)),ce(T("input",{"onUpdate:modelValue":w[44]||(w[44]=b=>I(o).scaleY=b),type:"number",min:"0.05",step:"0.05",class:"inp"},null,512),[[He,I(o).scaleY,void 0,{number:!0}]])])]),T("label",yD,[w[98]||(w[98]=T("span",null,"闭合路径",-1)),ce(T("input",{"onUpdate:modelValue":w[45]||(w[45]=b=>I(o).closed=b),type:"checkbox"},null,512),[[wt,I(o).closed]])]),T("label",xD,[w[99]||(w[99]=T("span",null,"路径颜色",-1)),ce(T("input",{"onUpdate:modelValue":w[46]||(w[46]=b=>I(o).color=b),type:"color",class:"path-color"},null,512),[[He,I(o).color]])]),w[103]||(w[103]=is('<div class="path-help" data-v-55dcf3b2><span data-v-55dcf3b2>操作说明:</span><ul data-v-55dcf3b2><li data-v-55dcf3b2>双击空白处/曲线:新建锚点</li><li data-v-55dcf3b2>双击锚点:删除节点</li><li data-v-55dcf3b2>双击第二下按住拖动:新建并拉出手柄</li><li data-v-55dcf3b2>拖动锚点移动位置,拖动手柄调整曲线</li><li data-v-55dcf3b2>Shift+拖动手柄:两侧完全对称</li><li data-v-55dcf3b2>Alt+拖动手柄:独立控制单侧</li><li data-v-55dcf3b2>Ctrl+点击/框选:加选节点</li><li data-v-55dcf3b2>Alt+点击/框选:减选节点</li><li data-v-55dcf3b2>Alt+单击空白处:清除全部选中</li><li data-v-55dcf3b2>选中多个节点后可整体拖动</li></ul></div>',1)),T("label",bD,[w[101]||(w[101]=T("span",null,"应用预设形状",-1)),ce(T("select",{"onUpdate:modelValue":w[47]||(w[47]=b=>I(o).preset=b),class:"inp"},[...w[100]||(w[100]=[is('<option value="" data-v-55dcf3b2>选择预设...</option><option value="circle" data-v-55dcf3b2>圆形</option><option value="square" data-v-55dcf3b2>方形</option><option value="polygon" data-v-55dcf3b2>多边形</option><option value="star" data-v-55dcf3b2>星形</option>',5)])],512),[[bt,I(o).preset]])]),T("button",{class:"path-action primary",onClick:w[48]||(w[48]=(...b)=>I(g)&&I(g)(...b))},"应用预设"),T("button",{class:"path-action",onClick:w[49]||(w[49]=(...b)=>I(x)&&I(x)(...b))},"清空锚点")],64)):I(a)?(q(),Ct(tN,{key:3,"spine-object":I(a)},null,8,["spine-object"])):(q(),J("div",wD,"使用右上角按钮创建场景对象"))],512),[[Si,!I(l).scene]])]))}}),MD=Jt(SD,[["__scopeId","data-v-55dcf3b2"]]),TD={class:"group"},_D={class:"caret"},CD={class:"group-body"},ED={class:"segs"},AD={class:"segs stream-behavior-segs"},ID={key:2,class:"stream-loop-options"},RD={class:"loop-section-row"},PD={class:"switch-row"},kD=["checked"],FD={key:0,class:"loop-duration-control"},OD={class:"switch-row loop-duration-toggle"},LD=["checked"],BD={class:"loop-section-duration"},ND=["value"],DD={key:1},UD={key:2,class:"loop-auto-duration"},$D={class:"loop-section-row"},XD={class:"switch-row"},VD=["checked"],YD={key:0,class:"loop-duration-control"},GD={class:"switch-row loop-duration-toggle"},jD=["checked"],HD={class:"loop-section-duration"},WD=["value"],zD={key:1},qD={key:2,class:"loop-auto-duration"},KD={key:3,class:"modifier-hint stream-loop-hint"},ZD={class:"group"},JD={class:"caret"},QD={class:"group-body"},e4={class:"row"},t4={class:"row"},i4=["value","disabled"],s4={key:0,class:"row"},n4={class:"row"},r4={key:0,value:"radial"},o4={key:1,value:"path-normal"},a4={key:2,value:"path-tangent"},l4={key:6,class:"switch-row"},c4=Zt({__name:"EmissionSection",setup(s){const{store:e,sys:t,automaticLoopDuration:i,loopDurationFrames:n,collapsed:r,toggle:o,setEmitMode:a,setLoopDurationFrames:c,setStreamBehavior:l,setLoopSection:h,setLoopSectionDuration:u,setLoopCustomDuration:d,resetModule:f,select:m,onShapeChange:p,onSpawnPathChange:g}=Fr();return(x,v)=>(q(),J(_e,null,[T("div",TD,[T("div",{class:"group-head",onClick:v[1]||(v[1]=y=>I(o)("emitMode"))},[T("span",_D,ve(I(r).emitMode?"▸":"▾"),1),v[36]||(v[36]=T("span",null,"发射模式",-1)),T("button",{class:"group-reset",title:"重置发射模式参数",onClick:v[0]||(v[0]=qe(y=>I(f)("emitMode"),["stop"]))},"重置")]),ce(T("div",CD,[T("div",ED,[T("button",{class:Ce(["seg",{on:I(t).config.mode==="stream"}]),onClick:v[2]||(v[2]=y=>I(a)("stream"))},"持续",2),T("button",{class:Ce(["seg",{on:I(t).config.mode==="burst"}]),onClick:v[3]||(v[3]=y=>I(a)("burst"))},"爆发",2)]),I(t).config.mode==="stream"?(q(),J(_e,{key:0},[T("div",AD,[T("button",{class:Ce(["seg",{on:I(t).config.streamBehavior==="normal"}]),onClick:v[4]||(v[4]=y=>I(l)("normal"))},"常规持续",2),T("button",{class:Ce(["seg",{on:I(t).config.streamBehavior==="loop"}]),onClick:v[5]||(v[5]=y=>I(l)("loop"))},"循环持续",2)]),we(Oe,{label:"发射速率",min:1,max:300,step:1,modelValue:I(t).config.rate,"onUpdate:modelValue":v[6]||(v[6]=y=>I(t).config.rate=y)},null,8,["modelValue"]),I(t).config.streamBehavior==="normal"?(q(),Ct(Oe,{key:0,label:"发射时长",min:1/30,max:60,step:1/30,modelValue:I(t).config.duration,"onUpdate:modelValue":v[7]||(v[7]=y=>I(t).config.duration=y)},null,8,["modelValue"])):(q(),Ct(Oe,{key:1,label:"发射时长 (f)",min:1,max:1800,step:1,"model-value":I(n),"onUpdate:modelValue":I(c)},null,8,["model-value","onUpdate:modelValue"])),I(t).config.streamBehavior==="loop"?(q(),J("div",ID,[T("div",RD,[T("label",PD,[T("input",{type:"checkbox",checked:I(t).config.generateLoopStartAnimation,onChange:v[8]||(v[8]=y=>I(h)("start",y))},null,40,kD),v[37]||(v[37]=T("span",{class:"switch-ui"},null,-1)),v[38]||(v[38]=T("span",null,"生成开始循环动画",-1))]),I(t).config.generateLoopStartAnimation?(q(),J("div",FD,[T("label",OD,[T("input",{type:"checkbox",checked:I(t).config.loopStartUseCustomDuration,onChange:v[9]||(v[9]=y=>I(d)("start",y))},null,40,LD),v[39]||(v[39]=T("span",{class:"switch-ui"},null,-1)),v[40]||(v[40]=T("span",null,"指定时长",-1))]),T("label",BD,[I(t).config.loopStartUseCustomDuration?(q(),J("input",{key:0,value:I(t).config.loopStartDurationFrames,type:"number",min:"1",max:"1800",step:"1","aria-label":"开始循环段时长",onChange:v[10]||(v[10]=y=>I(u)("start",y))},null,40,ND)):xe("",!0),I(t).config.loopStartUseCustomDuration?(q(),J("span",DD,"f")):(q(),J("span",UD,"自动 "+ve(I(i))+"f",1))])])):xe("",!0)]),T("div",$D,[T("label",XD,[T("input",{type:"checkbox",checked:I(t).config.generateLoopEndAnimation,onChange:v[11]||(v[11]=y=>I(h)("end",y))},null,40,VD),v[41]||(v[41]=T("span",{class:"switch-ui"},null,-1)),v[42]||(v[42]=T("span",null,"生成结束循环动画",-1))]),I(t).config.generateLoopEndAnimation?(q(),J("div",YD,[T("label",GD,[T("input",{type:"checkbox",checked:I(t).config.loopEndUseCustomDuration,onChange:v[12]||(v[12]=y=>I(d)("end",y))},null,40,jD),v[43]||(v[43]=T("span",{class:"switch-ui"},null,-1)),v[44]||(v[44]=T("span",null,"指定时长",-1))]),T("label",HD,[I(t).config.loopEndUseCustomDuration?(q(),J("input",{key:0,value:I(t).config.loopEndDurationFrames,type:"number",min:"1",max:"1800",step:"1","aria-label":"结束循环段时长",onChange:v[13]||(v[13]=y=>I(u)("end",y))},null,40,WD)):xe("",!0),I(t).config.loopEndUseCustomDuration?(q(),J("span",zD,"f")):(q(),J("span",qD,"自动 "+ve(I(i))+"f",1))])])):xe("",!0)])])):xe("",!0),I(t).config.streamBehavior==="loop"?(q(),J("div",KD,"循环持续模式不支持骨骼跟随和路径跟随;进入或退出时会将粒子跟随设置恢复默认值。")):xe("",!0)],64)):(q(),Ct(Oe,{key:1,label:"单次数量",min:1,max:1e3,step:1,modelValue:I(t).config.burstCount,"onUpdate:modelValue":v[14]||(v[14]=y=>I(t).config.burstCount=y)},null,8,["modelValue"])),we(Oe,{label:"延迟时间",min:0,max:5,step:.1,modelValue:I(t).config.delay,"onUpdate:modelValue":v[15]||(v[15]=y=>I(t).config.delay=y)},null,8,["modelValue"])],512),[[Si,!I(r).emitMode]])]),T("div",ZD,[T("div",{class:"group-head",onClick:v[17]||(v[17]=y=>I(o)("shape"))},[T("span",JD,ve(I(r).shape?"▸":"▾"),1),v[45]||(v[45]=T("span",null,"发射器形状",-1)),T("button",{class:"group-reset",title:"重置发射器形状参数",onClick:v[16]||(v[16]=qe(y=>I(f)("shape"),["stop"]))},"重置")]),ce(T("div",QD,[T("label",e4,[v[47]||(v[47]=T("span",null,"形状",-1)),ce(T("select",{"onUpdate:modelValue":v[18]||(v[18]=y=>I(t).config.shape=y),class:"inp",onChange:v[19]||(v[19]=(...y)=>I(p)&&I(p)(...y))},[...v[46]||(v[46]=[is('<option value="point" data-v-f9eac627>点</option><option value="circle" data-v-f9eac627>圆形</option><option value="rect" data-v-f9eac627>矩形</option><option value="cone" data-v-f9eac627>锥形</option><option value="path" data-v-f9eac627>路径</option>',5)])],544),[[bt,I(t).config.shape]])]),I(t).config.shape==="circle"||I(t).config.shape==="cone"?(q(),J(_e,{key:0},[we(Oe,{label:I(t).config.shape==="cone"?"内径":"内半径",min:0,max:I(t).config.outerRadius,step:1,modelValue:I(t).config.innerRadius,"onUpdate:modelValue":v[20]||(v[20]=y=>I(t).config.innerRadius=y)},null,8,["label","max","modelValue"]),we(Oe,{label:I(t).config.shape==="cone"?"外径":"外半径",min:I(t).config.innerRadius,max:300,step:1,modelValue:I(t).config.outerRadius,"onUpdate:modelValue":v[21]||(v[21]=y=>I(t).config.outerRadius=y)},null,8,["label","min","modelValue"])],64)):xe("",!0),I(t).config.shape==="cone"?(q(),J(_e,{key:1},[we(Oe,{label:"锥形朝向",min:-360,max:360,step:1,modelValue:I(t).config.coneDirection,"onUpdate:modelValue":v[22]||(v[22]=y=>I(t).config.coneDirection=y)},null,8,["modelValue"]),we(Oe,{label:"锥形开口角度",min:1,max:360,step:1,modelValue:I(t).config.coneAngle,"onUpdate:modelValue":v[23]||(v[23]=y=>I(t).config.coneAngle=y)},null,8,["modelValue"])],64)):I(t).config.shape==="rect"?(q(),J(_e,{key:2},[we(Oe,{label:"内宽",min:0,max:I(t).config.outerRectW,step:1,modelValue:I(t).config.innerRectW,"onUpdate:modelValue":v[24]||(v[24]=y=>I(t).config.innerRectW=y)},null,8,["max","modelValue"]),we(Oe,{label:"内高",min:0,max:I(t).config.outerRectH,step:1,modelValue:I(t).config.innerRectH,"onUpdate:modelValue":v[25]||(v[25]=y=>I(t).config.innerRectH=y)},null,8,["max","modelValue"]),we(Oe,{label:"外宽",min:I(t).config.innerRectW,max:400,step:1,modelValue:I(t).config.outerRectW,"onUpdate:modelValue":v[26]||(v[26]=y=>I(t).config.outerRectW=y)},null,8,["min","modelValue"]),we(Oe,{label:"外高",min:I(t).config.innerRectH,max:400,step:1,modelValue:I(t).config.outerRectH,"onUpdate:modelValue":v[27]||(v[27]=y=>I(t).config.outerRectH=y)},null,8,["min","modelValue"])],64)):I(t).config.shape==="path"?(q(),J(_e,{key:3},[T("label",t4,[v[49]||(v[49]=T("span",null,"选择路径",-1)),ce(T("select",{"onUpdate:modelValue":v[28]||(v[28]=y=>I(t).config.spawnPathId=y),class:"inp",onChange:v[29]||(v[29]=(...y)=>I(g)&&I(g)(...y))},[v[48]||(v[48]=T("option",{value:0},"无路径(点发射)",-1)),(q(!0),J(_e,null,Et(I(e).paths,y=>(q(),J("option",{key:y.id,value:y.id,disabled:!y.enabled},ve(y.name),9,i4))),128))],544),[[bt,I(t).config.spawnPathId,void 0,{number:!0}]])]),I(t).config.spawnPathId>0?(q(),J("label",s4,[v[51]||(v[51]=T("span",null,"出生分布",-1)),ce(T("select",{"onUpdate:modelValue":v[30]||(v[30]=y=>I(t).config.spawnPathDistribution=y),class:"inp"},[...v[50]||(v[50]=[T("option",{value:"fixed"},"等间距固定分布",-1),T("option",{value:"random"},"随机分布",-1)])],512),[[bt,I(t).config.spawnPathDistribution]])])):xe("",!0)],64)):xe("",!0),v[57]||(v[57]=T("div",{class:"divider"},null,-1)),T("label",n4,[v[54]||(v[54]=T("span",null,"发射角度",-1)),ce(T("select",{"onUpdate:modelValue":v[31]||(v[31]=y=>I(t).config.emissionAngleMode=y),class:"inp"},[v[52]||(v[52]=T("option",{value:"fixed"},"固定",-1)),v[53]||(v[53]=T("option",{value:"random"},"随机",-1)),I(t).config.shape==="circle"||I(t).config.shape==="rect"||I(t).config.shape==="cone"?(q(),J("option",r4,"径向(中心向外)")):xe("",!0),I(t).config.shape==="path"&&I(t).config.spawnPathId>0?(q(),J("option",o4,"垂直于路径")):xe("",!0),I(t).config.shape==="path"&&I(t).config.spawnPathId>0?(q(),J("option",a4,"沿路径方向")):xe("",!0)],512),[[bt,I(t).config.emissionAngleMode]])]),I(t).config.emissionAngleMode==="fixed"?(q(),Ct(Oe,{key:4,label:"固定角度",min:-360,max:360,step:1,modelValue:I(t).config.direction,"onUpdate:modelValue":v[32]||(v[32]=y=>I(t).config.direction=y)},null,8,["modelValue"])):I(t).config.emissionAngleMode==="random"?(q(),J(_e,{key:5},[we(Oe,{label:"基准角度",min:-360,max:360,step:1,modelValue:I(t).config.direction,"onUpdate:modelValue":v[33]||(v[33]=y=>I(t).config.direction=y)},null,8,["modelValue"]),we(Oe,{label:"随机范围",min:0,max:360,step:1,modelValue:I(t).config.spread,"onUpdate:modelValue":v[34]||(v[34]=y=>I(t).config.spread=y)},null,8,["modelValue"])],64)):xe("",!0),I(t).config.shape!=="point"?(q(),J("label",l4,[ce(T("input",{type:"checkbox","onUpdate:modelValue":v[35]||(v[35]=y=>I(t).config.showShape=y)},null,512),[[wt,I(t).config.showShape]]),v[55]||(v[55]=T("span",{class:"switch-ui"},null,-1)),v[56]||(v[56]=T("span",null,"显示形状",-1))])):xe("",!0)],512),[[Si,!I(r).shape]])])],64))}}),h4=Jt(c4,[["__scopeId","data-v-f9eac627"]]),u4={class:"pac"},d4={class:"pac-head"},f4={class:"pac-label"},m4={key:0,class:"pac-modes"},p4=["onClick"],g4={class:"pac-range"},v4={class:"pac-curve"},y4={class:"pac-axis"},x4=Zt({__name:"ParticleAttributeControl",props:{label:{},mode:{},valueMin:{},valueMax:{},curve:{},defaultCurve:{default:()=>[{x:0,y:0},{x:1,y:1}]},min:{},max:{},step:{default:1},allowDirection:{type:Boolean,default:!1},allowCurve:{type:Boolean,default:!0},showModes:{type:Boolean,default:!0},curveLabel:{default:"曲线输入 →"}},emits:["update:mode","update:valueMin","update:valueMax","update:curve"],setup(s){const e=s,t=Le(()=>{const i=[{label:"固定",value:"fixed"},{label:"随机",value:"random"}];return e.allowCurve&&i.push({label:"曲线",value:"curve"}),e.allowDirection&&i.push({label:"发射方向",value:"direction"}),i});return(i,n)=>(q(),J("div",u4,[T("div",d4,[T("span",f4,ve(s.label),1),s.showModes?(q(),J("div",m4,[(q(!0),J(_e,null,Et(t.value,r=>(q(),J("button",{key:r.value,class:Ce(["pac-mode",{on:s.mode===r.value}]),onClick:o=>i.$emit("update:mode",r.value)},ve(r.label),11,p4))),128))])):xe("",!0)]),s.mode==="fixed"||s.mode==="direction"?(q(),Ct(Oe,{key:0,label:s.mode==="direction"?"角度偏移":"数值",min:s.min,max:s.max,step:s.step,"model-value":s.valueMin,"onUpdate:modelValue":n[0]||(n[0]=r=>i.$emit("update:valueMin",r))},null,8,["label","min","max","step","model-value"])):s.mode==="random"?(q(),J(_e,{key:1},[we(Oe,{label:"下限",min:s.min,max:s.max,step:s.step,"model-value":s.valueMin,"onUpdate:modelValue":n[1]||(n[1]=r=>i.$emit("update:valueMin",r))},null,8,["min","max","step","model-value"]),we(Oe,{label:"上限",min:s.min,max:s.max,step:s.step,"model-value":s.valueMax,"onUpdate:modelValue":n[2]||(n[2]=r=>i.$emit("update:valueMax",r))},null,8,["min","max","step","model-value"])],64)):(q(),J(_e,{key:2},[T("div",g4,[we(Oe,{label:"范围下限",min:s.min,max:s.max,step:s.step,"model-value":s.valueMin,"onUpdate:modelValue":n[3]||(n[3]=r=>i.$emit("update:valueMin",r))},null,8,["min","max","step","model-value"]),we(Oe,{label:"范围上限",min:s.min,max:s.max,step:s.step,"model-value":s.valueMax,"onUpdate:modelValue":n[4]||(n[4]=r=>i.$emit("update:valueMax",r))},null,8,["min","max","step","model-value"])]),T("div",v4,[we(tn,{"model-value":s.curve,"default-value":s.defaultCurve,"onUpdate:modelValue":n[5]||(n[5]=r=>i.$emit("update:curve",r))},null,8,["model-value","default-value"]),T("div",y4,[n[6]||(n[6]=T("span",null,"0",-1)),T("span",null,ve(s.curveLabel),1),n[7]||(n[7]=T("span",null,"1",-1))])])],64))]))}}),Sn=Jt(x4,[["__scopeId","data-v-238f838c"]]),b4={class:"group"},w4={class:"caret"},S4={class:"group-body attr-body"},M4={class:"attr-axis-head"},T4={class:"axis-modes"},_4={class:"life-item"},C4={class:"switch-row"},E4={class:"life-item"},A4={class:"switch-row"},I4={class:"axis-modes life-axis"},R4={class:"life-item"},P4={class:"switch-row"},k4=Zt({__name:"ParticleAttributesSection",setup(s){const{sys:e,collapsed:t,toggle:i,resetModule:n,setSpeedOverLifeMode:r,prepareScaleOverLifeCurve:o,setScaleOverLifeMode:a,LINEAR_CURVE:c,FLAT_CURVE:l}=Fr();return(h,u)=>(q(),J("div",b4,[T("div",{class:"group-head",onClick:u[1]||(u[1]=d=>I(i)("attr"))},[T("span",w4,ve(I(t).attr?"▸":"▾"),1),u[44]||(u[44]=T("span",null,"粒子属性",-1)),T("button",{class:"group-reset",title:"重置粒子属性参数",onClick:u[0]||(u[0]=qe(d=>I(n)("attr"),["stop"]))},"重置")]),ce(T("div",S4,[u[52]||(u[52]=T("div",{class:"attr-section-title"},"粒子初始参数",-1)),we(Sn,{label:"初始生命周期","allow-curve":!1,mode:I(e).config.lifeMode,"onUpdate:mode":u[2]||(u[2]=d=>I(e).config.lifeMode=d),"value-min":I(e).config.lifeMin,"onUpdate:valueMin":u[3]||(u[3]=d=>I(e).config.lifeMin=d),"value-max":I(e).config.lifeMax,"onUpdate:valueMax":u[4]||(u[4]=d=>I(e).config.lifeMax=d),curve:I(e).config.lifeCurve,"onUpdate:curve":u[5]||(u[5]=d=>I(e).config.lifeCurve=d),min:.1,max:10,step:.1,"curve-label":"随机采样 →"},null,8,["mode","value-min","value-max","curve"]),we(Sn,{label:"初始速度","allow-curve":!1,mode:I(e).config.speedMode,"onUpdate:mode":u[6]||(u[6]=d=>I(e).config.speedMode=d),"value-min":I(e).config.speedMin,"onUpdate:valueMin":u[7]||(u[7]=d=>I(e).config.speedMin=d),"value-max":I(e).config.speedMax,"onUpdate:valueMax":u[8]||(u[8]=d=>I(e).config.speedMax=d),curve:I(e).config.speedCurve,"onUpdate:curve":u[9]||(u[9]=d=>I(e).config.speedCurve=d),min:0,max:1e3,step:1,"curve-label":"随机采样 →"},null,8,["mode","value-min","value-max","curve"]),T("div",M4,[u[45]||(u[45]=T("span",null,"初始缩放",-1)),T("div",T4,[T("button",{class:Ce(["axis-mode",{on:I(e).config.scaleAxisMode==="uniform"}]),onClick:u[10]||(u[10]=d=>I(e).config.scaleAxisMode="uniform")},"统一",2),T("button",{class:Ce(["axis-mode",{on:I(e).config.scaleAxisMode==="separate"}]),onClick:u[11]||(u[11]=d=>I(e).config.scaleAxisMode="separate")},"XY分离",2)])]),we(Sn,{label:I(e).config.scaleAxisMode==="uniform"?"初始缩放":"缩放 X","allow-curve":!1,mode:I(e).config.scaleMode,"onUpdate:mode":u[12]||(u[12]=d=>I(e).config.scaleMode=d),"value-min":I(e).config.scaleMin,"onUpdate:valueMin":u[13]||(u[13]=d=>I(e).config.scaleMin=d),"value-max":I(e).config.scaleMax,"onUpdate:valueMax":u[14]||(u[14]=d=>I(e).config.scaleMax=d),curve:I(e).config.scaleCurve,"onUpdate:curve":u[15]||(u[15]=d=>I(e).config.scaleCurve=d),min:0,max:5,step:.05,"curve-label":"随机采样 →"},null,8,["label","mode","value-min","value-max","curve"]),I(e).config.scaleAxisMode==="separate"?(q(),Ct(Sn,{key:0,label:"缩放 Y","show-modes":!1,"allow-curve":!1,mode:I(e).config.scaleMode,"onUpdate:mode":u[16]||(u[16]=d=>I(e).config.scaleMode=d),"value-min":I(e).config.scaleYMin,"onUpdate:valueMin":u[17]||(u[17]=d=>I(e).config.scaleYMin=d),"value-max":I(e).config.scaleYMax,"onUpdate:valueMax":u[18]||(u[18]=d=>I(e).config.scaleYMax=d),curve:I(e).config.scaleYCurve,"onUpdate:curve":u[19]||(u[19]=d=>I(e).config.scaleYCurve=d),min:0,max:5,step:.05,"curve-label":"随机采样 →"},null,8,["mode","value-min","value-max","curve"])):xe("",!0),we(Sn,{label:"初始旋转","allow-direction":"","allow-curve":!1,mode:I(e).config.initialRotationMode,"onUpdate:mode":u[20]||(u[20]=d=>I(e).config.initialRotationMode=d),"value-min":I(e).config.initialRotationMin,"onUpdate:valueMin":u[21]||(u[21]=d=>I(e).config.initialRotationMin=d),"value-max":I(e).config.initialRotationMax,"onUpdate:valueMax":u[22]||(u[22]=d=>I(e).config.initialRotationMax=d),curve:I(e).config.initialRotationCurve,"onUpdate:curve":u[23]||(u[23]=d=>I(e).config.initialRotationCurve=d),min:-360,max:360,step:1,"curve-label":"随机采样 →"},null,8,["mode","value-min","value-max","curve"]),u[53]||(u[53]=T("div",{class:"attr-section-title life-title"},"粒子生命周期变化参数",-1)),T("div",_4,[T("label",C4,[ce(T("input",{type:"checkbox","onUpdate:modelValue":u[24]||(u[24]=d=>I(e).config.speedOverLifeEnabled=d)},null,512),[[wt,I(e).config.speedOverLifeEnabled]]),u[46]||(u[46]=T("span",{class:"switch-ui"},null,-1)),u[47]||(u[47]=T("span",null,"生命周期内速度",-1))]),I(e).config.speedOverLifeEnabled?(q(),Ct(Sn,{key:0,label:"速度倍率",mode:I(e).config.speedOverLifeMode,"onUpdate:mode":I(r),"value-min":I(e).config.speedOverLifeMin,"onUpdate:valueMin":u[25]||(u[25]=d=>I(e).config.speedOverLifeMin=d),"value-max":I(e).config.speedOverLifeMax,"onUpdate:valueMax":u[26]||(u[26]=d=>I(e).config.speedOverLifeMax=d),curve:I(e).config.speedOverLifeCurve,"onUpdate:curve":u[27]||(u[27]=d=>I(e).config.speedOverLifeCurve=d),"default-curve":I(l),min:0,max:3,step:.05,"curve-label":"生命周期 →"},null,8,["mode","onUpdate:mode","value-min","value-max","curve","default-curve"])):xe("",!0)]),T("div",E4,[T("label",A4,[ce(T("input",{type:"checkbox","onUpdate:modelValue":u[28]||(u[28]=d=>I(e).config.scaleOverLifeEnabled=d),onChange:u[29]||(u[29]=(...d)=>I(o)&&I(o)(...d))},null,544),[[wt,I(e).config.scaleOverLifeEnabled]]),u[48]||(u[48]=T("span",{class:"switch-ui"},null,-1)),u[49]||(u[49]=T("span",null,"生命周期内缩放",-1))]),I(e).config.scaleOverLifeEnabled?(q(),J(_e,{key:0},[T("div",I4,[T("button",{class:Ce(["axis-mode",{on:I(e).config.scaleOverLifeAxisMode==="uniform"}]),onClick:u[30]||(u[30]=d=>I(e).config.scaleOverLifeAxisMode="uniform")},"统一",2),T("button",{class:Ce(["axis-mode",{on:I(e).config.scaleOverLifeAxisMode==="separate"}]),onClick:u[31]||(u[31]=d=>I(e).config.scaleOverLifeAxisMode="separate")},"XY分离",2)]),we(Sn,{label:I(e).config.scaleOverLifeAxisMode==="uniform"?"缩放倍率":"倍率 X",mode:I(e).config.scaleOverLifeMode,"onUpdate:mode":I(a),"value-min":I(e).config.scaleOverLifeMin,"onUpdate:valueMin":u[32]||(u[32]=d=>I(e).config.scaleOverLifeMin=d),"value-max":I(e).config.scaleOverLifeMax,"onUpdate:valueMax":u[33]||(u[33]=d=>I(e).config.scaleOverLifeMax=d),curve:I(e).config.scaleOverLifeCurve,"onUpdate:curve":u[34]||(u[34]=d=>I(e).config.scaleOverLifeCurve=d),"default-curve":I(l),min:0,max:3,step:.05,"curve-label":"生命周期 →"},null,8,["label","mode","onUpdate:mode","value-min","value-max","curve","default-curve"]),I(e).config.scaleOverLifeAxisMode==="separate"?(q(),Ct(Sn,{key:0,label:"倍率 Y","show-modes":!1,mode:I(e).config.scaleOverLifeMode,"onUpdate:mode":u[35]||(u[35]=d=>I(e).config.scaleOverLifeMode=d),"value-min":I(e).config.scaleYOverLifeMin,"onUpdate:valueMin":u[36]||(u[36]=d=>I(e).config.scaleYOverLifeMin=d),"value-max":I(e).config.scaleYOverLifeMax,"onUpdate:valueMax":u[37]||(u[37]=d=>I(e).config.scaleYOverLifeMax=d),curve:I(e).config.scaleYOverLifeCurve,"onUpdate:curve":u[38]||(u[38]=d=>I(e).config.scaleYOverLifeCurve=d),"default-curve":I(l),min:0,max:3,step:.05,"curve-label":"生命周期 →"},null,8,["mode","value-min","value-max","curve","default-curve"])):xe("",!0)],64)):xe("",!0)]),T("div",R4,[T("label",P4,[ce(T("input",{type:"checkbox","onUpdate:modelValue":u[39]||(u[39]=d=>I(e).config.rotationOverLifeEnabled=d)},null,512),[[wt,I(e).config.rotationOverLifeEnabled]]),u[50]||(u[50]=T("span",{class:"switch-ui"},null,-1)),u[51]||(u[51]=T("span",null,"生命周期内旋转",-1))]),I(e).config.rotationOverLifeEnabled?(q(),Ct(Sn,{key:0,label:"旋转速度",mode:I(e).config.rotationOverLifeMode,"onUpdate:mode":u[40]||(u[40]=d=>I(e).config.rotationOverLifeMode=d),"value-min":I(e).config.rotationSpeedMin,"onUpdate:valueMin":u[41]||(u[41]=d=>I(e).config.rotationSpeedMin=d),"value-max":I(e).config.rotationSpeedMax,"onUpdate:valueMax":u[42]||(u[42]=d=>I(e).config.rotationSpeedMax=d),curve:I(e).config.rotationOverLifeCurve,"onUpdate:curve":u[43]||(u[43]=d=>I(e).config.rotationOverLifeCurve=d),"default-curve":I(c),min:-720,max:720,step:10,"curve-label":"生命周期 →"},null,8,["mode","value-min","value-max","curve","default-curve"])):xe("",!0)])],512),[[Si,!I(t).attr]])]))}}),F4=Jt(k4,[["__scopeId","data-v-cf6b86a5"]]),O4={class:"gradient-editor"},L4=["title","onClick","onDblclick","onPointerdown"],B4={key:0,class:"gradient-controls"},N4=["value"],D4=["value"],U4={class:"gradient-position"},$4=["value"],X4=["disabled"],V4=Zt({__name:"ColorGradientEditor",props:{modelValue:{}},emits:["update:modelValue"],setup(s,{emit:e}){const t=s,i=e,n=Fe(null),r=Fe(0),o=Le(()=>t.modelValue[r.value]||null),a=Le(()=>[...t.modelValue].sort((_,A)=>_.position-A.position)),c=Le(()=>{const _=a.value;return _.length?`linear-gradient(90deg, ${_.map(A=>`${A.color} ${l(A.position)*100}%`).join(", ")})`:"#ffffff"});ai(()=>t.modelValue.length,_=>{r.value>=_&&(r.value=Math.max(0,_-1))});function l(_){return Math.min(1,Math.max(0,Number(_)||0))}function h(){return t.modelValue.map(_=>({position:l(_.position),color:_.color}))}function u(_,A){const P=h();P[_]&&(P[_]={...P[_],...A},i("update:modelValue",P))}function d(_){u(r.value,{color:_.target.value})}function f(_){var E;const A=_.target,P=b(A.value,((E=o.value)==null?void 0:E.color)||"#ffffff");A.value=P,u(r.value,{color:P})}function m(_){const A=_.target;f(_),A.blur()}function p(_){const A=Number(_.target.value);Number.isFinite(A)&&u(r.value,{position:l(A/100)})}function g(_){const A=h();A.push({position:l(_),color:C(A,_)}),r.value=A.length-1,i("update:modelValue",A)}function x(_){if(!n.value)return;const A=n.value.getBoundingClientRect();g((_.clientX-A.left)/Math.max(1,A.width))}function v(){const _=a.value;let A=.5;if(_.length>1){let P=-1;for(let E=0;E<_.length-1;E++){const R=_[E+1].position-_[E].position;R>P&&(P=R,A=(_[E].position+_[E+1].position)/2)}}g(A)}function y(_){if(t.modelValue.length<=2||_<0)return;const A=h().filter((P,E)=>E!==_);r.value=Math.min(_,A.length-1),i("update:modelValue",A)}function S(_,A){if(!n.value)return;r.value=A;const P=R=>{const O=n.value.getBoundingClientRect();u(A,{position:l((R.clientX-O.left)/Math.max(1,O.width))})},E=()=>{window.removeEventListener("pointermove",P),window.removeEventListener("pointerup",E),window.removeEventListener("pointercancel",E)};window.addEventListener("pointermove",P),window.addEventListener("pointerup",E),window.addEventListener("pointercancel",E),_.preventDefault()}function C(_,A){const P=[..._].sort((E,R)=>E.position-R.position);if(!P.length)return"#ffffff";if(A<=P[0].position)return P[0].color;if(A>=P[P.length-1].position)return P[P.length-1].color;for(let E=0;E<P.length-1;E++){const R=P[E],O=P[E+1];if(A<R.position||A>O.position)continue;const U=(A-R.position)/Math.max(1e-4,O.position-R.position);return w(R.color,O.color,U)}return P[P.length-1].color}function w(_,A,P){const E=Y=>{const $=parseInt(Y.replace("#","").padEnd(6,"0").slice(0,6),16);return[$>>16&255,$>>8&255,$&255]},R=E(_),O=E(A),U=Y=>Math.round(R[Y]+(O[Y]-R[Y])*P);return`#${[U(0),U(1),U(2)].map(Y=>Y.toString(16).padStart(2,"0")).join("")}`}function b(_,A){let P=_.trim().replace(/^#/,"");return/^[0-9a-f]{3}$/i.test(P)&&(P=P.split("").map(E=>E+E).join("")),/^[0-9a-f]{6}$/i.test(P)?`#${P.toLowerCase()}`:A}return(_,A)=>(q(),J("div",O4,[T("div",{ref_key:"bar",ref:n,class:"gradient-bar",style:Ot({background:c.value}),title:"双击色带添加色标",onDblclick:x},[(q(!0),J(_e,null,Et(s.modelValue,(P,E)=>(q(),J("button",{key:E,type:"button",class:Ce(["gradient-stop",{selected:E===r.value}]),style:Ot({left:`${l(P.position)*100}%`,"--stop-color":P.color}),title:`${Math.round(l(P.position)*100)}% · ${P.color}`,onClick:qe(R=>r.value=E,["stop"]),onDblclick:qe(R=>y(E),["stop"]),onPointerdown:qe(R=>S(R,E),["stop"])},null,46,L4))),128))],36),o.value?(q(),J("div",B4,[T("input",{type:"color",class:"gradient-color",value:o.value.color,"aria-label":"色标颜色",onInput:d},null,40,N4),T("input",{type:"text",class:"gradient-hex-input",value:o.value.color,"aria-label":"色标颜色值",spellcheck:"false",onChange:f,onKeydown:Mr(m,["enter"])},null,40,D4),T("label",U4,[T("input",{type:"number",min:"0",max:"100",step:"1",value:Math.round(l(o.value.position)*100),"aria-label":"色标位置",onInput:p},null,40,$4),A[1]||(A[1]=T("span",null,"%",-1))]),T("button",{type:"button",class:"gradient-action",title:"在中间新增颜色",onClick:v},"+"),T("button",{type:"button",class:"gradient-action danger",title:"删除当前色标",disabled:s.modelValue.length<=2,onClick:A[0]||(A[0]=P=>y(r.value))},"×",8,X4)])):xe("",!0),A[2]||(A[2]=T("div",{class:"gradient-hint"},"双击色带新增 · 拖动色标调整位置 · 双击色标删除",-1))]))}}),qS=Jt(V4,[["__scopeId","data-v-f6ab10bf"]]),Y4={class:"pivot-toolbar"},G4={class:"pivot-zoom"},j4=["disabled"],H4=["disabled"],W4=["src"],z4={key:2,class:"pivot-empty"},q4={class:"pivot-bottom"},K4={class:"pivot-card"},Z4={class:"pivot-presets"},J4=["title","aria-label","onClick"],Q4={class:"pivot-card"},e5={class:"pivot-coords"},t5=["value"],i5=["value"],s5={class:"pivot-card-head pivot-rotate-head"},n5={class:"pivot-rotate-state"},r5={class:"pivot-rotate-body"},o5={class:"pivot-rotate-modes"},a5={class:"pivot-rotate-preview"},l5=["src"],wf=1e3,c5=Zt({__name:"PivotEditor",props:{previewUrl:{},anchorX:{},anchorY:{},large:{type:Boolean,default:!1}},emits:["update:anchorX","update:anchorY","fullscreen"],setup(s,{emit:e}){const t=s,i=e,n=[{icon:"↖",label:"左上",x:0,y:0},{icon:"↑",label:"正上",x:50,y:0},{icon:"↗",label:"右上",x:100,y:0},{icon:"←",label:"正左",x:0,y:50},{icon:"◯",label:"正中",x:50,y:50},{icon:"→",label:"正右",x:100,y:50},{icon:"↙",label:"左下",x:0,y:100},{icon:"↓",label:"正下·底部",x:50,y:100},{icon:"↘",label:"右下",x:100,y:100}],r=Fe(null),o=Fe(null),a=Fe({w:0,h:0}),c=Fe({w:1,h:1}),l=Fe(100),h=Fe({x:0,y:0}),u=Fe(!1),d=Fe("static");let f=null;const m=X=>Math.min(wf,Math.max(-wf,Number.isFinite(X)?X:0)),p=Le(()=>m(t.anchorX*100).toFixed(1)),g=Le(()=>m(t.anchorY*100).toFixed(1));function x(X,D){const F=c.value.w/Math.max(1,c.value.h);let N=X,k=N/F;return k>D&&(k=D,N=k*F),{w:Math.max(1,N),h:Math.max(1,k)}}const v=Le(()=>{const X=t.large?26:12,D=Math.max(1,a.value.w-X*2),F=Math.max(1,a.value.h-X*2);return x(D,F)}),y=Le(()=>({width:`${v.value.w}px`,height:`${v.value.h}px`,transform:`translate(${h.value.x}px, ${h.value.y}px) scale(${l.value/100})`})),S=Le(()=>{const X=l.value/100;return{x:a.value.w/2+h.value.x+(m(t.anchorX*100)/100-.5)*v.value.w*X,y:a.value.h/2+h.value.y+(m(t.anchorY*100)/100-.5)*v.value.h*X}}),C=Le(()=>{const X=t.large?128:72,D=x(X,X);return{width:`${D.w}px`,height:`${D.h}px`,transformOrigin:`${m(t.anchorX*100)}% ${m(t.anchorY*100)}%`}});function w(X,D){const F=wf/100;i("update:anchorX",Math.min(F,Math.max(-F,Number.isFinite(X)?X:0))),i("update:anchorY",Math.min(F,Math.max(-F,Number.isFinite(D)?D:0)))}function b(X){const D=o.value;if(!D)return;const F=D.getBoundingClientRect();F.width<=0||F.height<=0||w((X.clientX-F.left)/F.width,(X.clientY-F.top)/F.height)}function _(X){if(!t.previewUrl)return;if(X.button===2){A(X);return}if(X.button!==0)return;X.preventDefault(),b(X);const D=N=>b(N),F=()=>{window.removeEventListener("pointermove",D),window.removeEventListener("pointerup",F),window.removeEventListener("pointercancel",F)};window.addEventListener("pointermove",D),window.addEventListener("pointerup",F),window.addEventListener("pointercancel",F)}function A(X){X.preventDefault(),u.value=!0;const D=X.clientX,F=X.clientY,N=h.value.x,k=h.value.y,V=W=>{h.value={x:N+W.clientX-D,y:k+W.clientY-F}},G=()=>{u.value=!1,window.removeEventListener("pointermove",V),window.removeEventListener("pointerup",G),window.removeEventListener("pointercancel",G)};window.addEventListener("pointermove",V),window.addEventListener("pointerup",G),window.addEventListener("pointercancel",G)}function P(X){const D=X.deltaY<0?1.12:.8928571428571428,F=Math.min(400,Math.max(100,Math.round(l.value*D)));if(F===l.value)return;const N=r.value;if(!N){l.value=F;return}const k=N.getBoundingClientRect(),V=X.clientX-k.left,G=X.clientY-k.top,W=F/l.value;h.value={x:h.value.x+(V-k.width/2-h.value.x)*(1-W),y:h.value.y+(G-k.height/2-h.value.y)*(1-W)},l.value=F}function E(X){const D=X.target;c.value={w:D.naturalWidth||1,h:D.naturalHeight||1}}function R(X){l.value=Math.min(400,Math.max(100,l.value+X))}function O(){w(.5,.5)}function U(X){w(X.x/100,X.y/100)}function Y(X){return Math.abs(m(t.anchorX*100)-X.x)<.05&&Math.abs(m(t.anchorY*100)-X.y)<.05}function $(X,D){const F=m(Number(D.target.value));i(X==="x"?"update:anchorX":"update:anchorY",F/100)}return ai(()=>t.previewUrl,()=>{c.value={w:1,h:1},h.value={x:0,y:0},l.value=100}),ys(()=>{r.value&&(f=new ResizeObserver(X=>{var F;const D=(F=X[0])==null?void 0:F.contentRect;D&&(a.value={w:D.width,h:D.height})}),f.observe(r.value))}),Rr(()=>{f==null||f.disconnect(),f=null}),(X,D)=>(q(),J("div",{class:Ce(["pivot-editor",{"pivot-large":s.large}])},[T("div",Y4,[D[9]||(D[9]=T("div",{class:"pivot-hint"},[T("span",{class:"pivot-hint-icon"},"⊕"),T("span",null,"贴图轴点")],-1)),T("div",G4,[T("button",{type:"button",disabled:l.value<=100,title:"缩小",onClick:D[0]||(D[0]=F=>R(-25))},"−",8,j4),T("span",null,ve(l.value)+"%",1),T("button",{type:"button",disabled:l.value>=400,title:"放大",onClick:D[1]||(D[1]=F=>R(25))},"+",8,H4)]),s.large?xe("",!0):(q(),J("button",{key:0,type:"button",class:"pivot-expand",title:"放大到全屏操作",onClick:D[2]||(D[2]=F=>X.$emit("fullscreen"))},"⤢"))]),T("div",{ref_key:"stageRef",ref:r,class:Ce(["pivot-stage",{panning:u.value}]),title:"左键点击/拖动设置轴点 · 右键拖动画布 · 滚轮缩放",onPointerdown:_,onWheel:qe(P,["prevent"]),onContextmenu:D[3]||(D[3]=qe(()=>{},["prevent"]))},[s.previewUrl?(q(),J("div",{key:0,ref_key:"boxRef",ref:o,class:"pivot-box",style:Ot(y.value)},[T("img",{src:s.previewUrl,alt:"轴点预览",draggable:"false",onLoad:E},null,40,W4)],4)):xe("",!0),s.previewUrl?(q(),J(_e,{key:1},[T("div",{class:"pivot-cross vertical",style:Ot({left:`${S.value.x}px`})},null,4),T("div",{class:"pivot-cross horizontal",style:Ot({top:`${S.value.y}px`})},null,4),T("div",{class:"pivot-marker",style:Ot({left:`${S.value.x}px`,top:`${S.value.y}px`})},null,4),T("div",{class:"pivot-badge",style:Ot({left:`${S.value.x}px`,top:`${S.value.y}px`})},"X: "+ve(p.value)+"% | Y: "+ve(g.value)+"%",5)],64)):(q(),J("div",z4,"未选择图片"))],34),T("div",q4,[T("div",K4,[T("div",Z4,[(q(),J(_e,null,Et(n,F=>T("button",{key:F.label,type:"button",class:Ce(["pivot-preset",{on:Y(F)}]),title:`${F.label}(${F.x}%, ${F.y}%)`,"aria-label":F.label,onClick:N=>U(F)},ve(F.icon),11,J4)),64))]),T("button",{type:"button",class:"pivot-reset",onClick:O},"↺ 复位居中 (50%, 50%)")]),T("div",Q4,[D[15]||(D[15]=T("div",{class:"pivot-card-head"},[T("span",null,[T("span",{class:"pivot-card-icon"},"◎"),ft(" 轴点坐标(%)")])],-1)),T("div",e5,[T("label",null,[D[10]||(D[10]=ft("X: ",-1)),T("input",{type:"number",min:"-1000",max:"1000",step:"0.1",value:p.value,onInput:D[4]||(D[4]=F=>$("x",F))},null,40,t5),D[11]||(D[11]=T("span",null,"%",-1))]),T("label",null,[D[12]||(D[12]=ft("Y: ",-1)),T("input",{type:"number",min:"-1000",max:"1000",step:"0.1",value:g.value,onInput:D[5]||(D[5]=F=>$("y",F))},null,40,i5),D[13]||(D[13]=T("span",null,"%",-1))])]),s.large?(q(),J(_e,{key:0},[T("div",s5,[D[14]||(D[14]=T("span",null,[T("span",{class:"pivot-card-icon"},"✥"),ft(" 轴心旋转测试")],-1)),T("span",n5,ve(d.value==="static"?"静止":d.value==="spin"?"自转":"摆动"),1)]),T("div",r5,[T("div",o5,[T("button",{type:"button",class:Ce({on:d.value==="static"}),onClick:D[6]||(D[6]=F=>d.value="static")},"静止",2),T("button",{type:"button",class:Ce({on:d.value==="spin"}),onClick:D[7]||(D[7]=F=>d.value="spin")},"↻ 自转",2),T("button",{type:"button",class:Ce({on:d.value==="swing"}),onClick:D[8]||(D[8]=F=>d.value="swing")},"⇄ 摆动",2)]),T("div",a5,[s.previewUrl?(q(),J("img",{key:0,src:s.previewUrl,alt:"旋转测试",draggable:"false",class:Ce(d.value),style:Ot(C.value)},null,14,l5)):xe("",!0)])])],64)):xe("",!0)])])],2))}}),Iy=Jt(c5,[["__scopeId","data-v-1261b03a"]]),h5={class:"image-card"},u5={class:"imgrow"},d5=["title"],f5=["src","alt"],m5={key:1,viewBox:"0 0 24 24",width:"22",height:"22",fill:"none",stroke:"#8a93bb","stroke-width":"1.6"},p5={class:"img-fields"},g5={key:0,class:"row"},v5={class:"row"},y5=["placeholder"],x5={class:"img-actions"},b5=["title"],w5=["disabled"],S5={class:"thumb-note"},M5={key:0,class:"row"},T5={class:"row"},_5={class:"row"},C5={class:"sequence-note"},E5={class:"resource-weight-row"},A5=["disabled","title"],I5={key:0,viewBox:"0 0 24 24","aria-hidden":"true"},R5={key:1,viewBox:"0 0 24 24","aria-hidden":"true"},P5={key:2,class:"pivot-toggle-row"},k5={class:"pivot-toggle-text"},F5=["title"],O5=["title"],L5={class:"pivot-modal",role:"dialog","aria-modal":"true","aria-label":"贴图旋转轴点大图精修"},B5={class:"pivot-modal-head"},N5={class:"pivot-modal-info"},D5={class:"pivot-modal-title"},U5={class:"pivot-modal-badge"},$5={class:"pivot-modal-actions"},Ry="SpineParticle.PivotPanels.v1",X5=Zt({__name:"ImageResourceCard",props:{resource:{},resourceCount:{},defaultFile:{},namePlaceholder:{default:"particle"},showFolder:{type:Boolean,default:!0},supportsSequence:{type:Boolean,default:!1},pivotKey:{}},emits:["pick","pickSequence","reset","remove","updateWeight","toggleLock"],setup(s,{emit:e}){const t=s,i=e,n=Le(()=>{var _,A;if(t.resource.imageMode==="sequence"){const P=t.resource.sequenceFrames||[];if(!P.length)return"未选择序列帧";const E=((_=P[0])==null?void 0:_.name)||"第 1 帧",R=((A=P[P.length-1])==null?void 0:A.name)||E;return P.length===1?`1 帧 · ${E}`:`${P.length} 帧 · ${E} → ${R}`}const b=t.resource.textureName||t.defaultFile.replace(/\.[^.]+$/,"");return b.includes(".")?b:`${b}.png`}),r=Le(()=>{var b,_;return t.resource.imageMode==="sequence"?((_=(b=t.resource.sequenceFrames)==null?void 0:b[0])==null?void 0:_.previewUrl)||"":t.resource.previewUrl});function o(){try{const b=JSON.parse(sessionStorage.getItem(Ry)||"{}");return b&&typeof b=="object"?b:{}}catch{return{}}}const a=o(),c=Le(()=>t.pivotKey||`particle-image:${t.resource.id}`),l=Le(()=>typeof t.resource.anchorX=="number"&&typeof t.resource.anchorY=="number"),h=Le(()=>Math.abs((t.resource.anchorX??.5)-.5)<1e-4&&Math.abs((t.resource.anchorY??.5)-.5)<1e-4),u=typeof a[c.value]=="boolean",d=Fe(u?a[c.value]:!h.value);ai(d,b=>{a[c.value]=b;try{sessionStorage.setItem(Ry,JSON.stringify(a))}catch{}}),ai(c,b=>{d.value=typeof a[b]=="boolean"?a[b]:!h.value}),ai(()=>h.value,b=>{b||(d.value=!0)},{immediate:!0});const f=Fe(!1),m=Fe(.5),p=Fe(.5),g=Le(()=>{const b=((t.resource.anchorX??.5)*100).toFixed(1),_=((t.resource.anchorY??.5)*100).toFixed(1);return d.value?`已开启:X ${b}% | Y ${_}%`:h.value?"未开启,默认围绕图片正中心 (50%, 50%)":`轴点已自定义:X ${b}% | Y ${_}%`});function x(){m.value=t.resource.anchorX??.5,p.value=t.resource.anchorY??.5,f.value=!0}function v(){d.value||(t.resource.anchorX=.5,t.resource.anchorY=.5,f.value=!1)}function y(b){b&&(t.resource.anchorX=m.value,t.resource.anchorY=p.value),f.value=!1}function S(b){b.key==="Escape"&&f.value&&y(!1)}ys(()=>window.addEventListener("keydown",S)),Rr(()=>window.removeEventListener("keydown",S));const C=Le(()=>{var P,E;const b=t.resource.sequenceFrames||[];if(!b.length)return"未选择序列帧";const _=((P=b[0])==null?void 0:P.name)||"第一张图片",A=((E=b[b.length-1])==null?void 0:E.name)||"最后一张图片";return`已选择 ${b.length} 帧,按 ${_}-${A} 顺序播放`});function w(){t.supportsSequence&&t.resource.imageMode==="sequence"?i("pickSequence",t.resource.id):i("pick",t.resource.id)}return(b,_)=>(q(),J(_e,null,[T("div",h5,[T("div",u5,[T("button",{class:"img-thumb",title:s.supportsSequence&&s.resource.imageMode==="sequence"?"选择序列帧图片":"选择本地图片",onClick:w},[r.value?(q(),J("img",{key:0,src:r.value,alt:s.resource.textureName},null,8,f5)):(q(),J("svg",m5,[..._[19]||(_[19]=[T("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"},null,-1),T("circle",{cx:"8.5",cy:"8.5",r:"1.6"},null,-1),T("path",{d:"M21 15l-5-5-9 9"},null,-1)])]))],8,d5),T("div",p5,[s.showFolder?(q(),J("label",g5,[_[20]||(_[20]=T("span",null,"子文件夹",-1)),ce(T("input",{"onUpdate:modelValue":_[0]||(_[0]=A=>s.resource.textureFolder=A),type:"text",class:"inp",placeholder:"subfolder/"},null,512),[[He,s.resource.textureFolder]])])):xe("",!0),T("label",v5,[_[21]||(_[21]=T("span",null,"名称",-1)),ce(T("input",{"onUpdate:modelValue":_[1]||(_[1]=A=>s.resource.textureName=A),type:"text",class:"inp",placeholder:s.namePlaceholder},null,8,y5),[[He,s.resource.textureName]])])]),T("div",x5,[T("button",{class:"mini-btn2",title:`恢复 ${s.defaultFile}`,onClick:_[2]||(_[2]=A=>b.$emit("reset",s.resource.id))},"⟳",8,b5),T("button",{class:"mini-btn2",title:"删除图片资源",disabled:s.resourceCount===1,onClick:_[3]||(_[3]=A=>b.$emit("remove",s.resource.id))},"🗑",8,w5)])]),T("div",S5,ve(n.value),1),s.supportsSequence?(q(),J("label",M5,[_[23]||(_[23]=T("span",null,"图片模式",-1)),ce(T("select",{"onUpdate:modelValue":_[4]||(_[4]=A=>s.resource.imageMode=A),class:"inp"},[..._[22]||(_[22]=[T("option",{value:"fixed"},"固定",-1),T("option",{value:"sequence"},"序列帧",-1)])],512),[[bt,s.resource.imageMode]])])):xe("",!0),s.supportsSequence&&s.resource.imageMode==="sequence"?(q(),J(_e,{key:1},[T("label",T5,[_[25]||(_[25]=T("span",null,"播放模式",-1)),ce(T("select",{"onUpdate:modelValue":_[5]||(_[5]=A=>s.resource.sequencePlayback=A),class:"inp"},[..._[24]||(_[24]=[T("option",{value:"once-hide"},"单次-尾帧消失",-1),T("option",{value:"once-hold"},"单次-尾帧固定",-1),T("option",{value:"loop-forward"},"正向循环",-1),T("option",{value:"loop-reverse"},"反向循环",-1)])],512),[[bt,s.resource.sequencePlayback]])]),T("label",_5,[_[26]||(_[26]=T("span",null,"播放帧率",-1)),ce(T("input",{"onUpdate:modelValue":_[6]||(_[6]=A=>s.resource.sequenceFps=A),type:"number",min:"1",max:"120",step:"1",class:"inp"},null,512),[[He,s.resource.sequenceFps,void 0,{number:!0}]])]),T("button",{class:"sequence-pick",onClick:_[7]||(_[7]=A=>b.$emit("pickSequence",s.resource.id))},"选择序列帧(多选)"),T("div",C5,ve(C.value),1)],64)):xe("",!0),T("div",E5,[we(Oe,{class:"resource-weight-control",label:"占比%",min:0,max:100,step:1,"model-value":s.resource.weight,disabled:s.resource.locked||s.resourceCount===1,"onUpdate:modelValue":_[8]||(_[8]=A=>b.$emit("updateWeight",s.resource.id,A))},null,8,["model-value","disabled"]),T("button",{class:Ce(["weight-lock",{on:s.resource.locked}]),disabled:s.resourceCount===1,title:s.resource.locked?"解除占比锁定":"锁定当前占比",onClick:_[9]||(_[9]=A=>b.$emit("toggleLock",s.resource.id))},[s.resource.locked?(q(),J("svg",I5,[..._[27]||(_[27]=[T("rect",{x:"5",y:"10",width:"14",height:"10",rx:"2"},null,-1),T("path",{d:"M8 10V7a4 4 0 0 1 8 0v3"},null,-1)])])):(q(),J("svg",R5,[..._[28]||(_[28]=[T("rect",{x:"5",y:"10",width:"14",height:"10",rx:"2"},null,-1),T("path",{d:"M16 10V7a4 4 0 0 0-7.5-2"},null,-1)])]))],10,A5)]),bT(b.$slots,"default",{},void 0),l.value?(q(),J("div",P5,[_[31]||(_[31]=T("div",{class:"pivot-toggle-icon"},"◎",-1)),T("div",k5,[_[29]||(_[29]=T("div",{class:"pivot-toggle-title"},"贴图轴点",-1)),T("div",{class:"pivot-toggle-sub",title:g.value},ve(g.value),9,F5)]),T("label",{class:"pivot-switch",title:d.value?"收起轴点调整":"展开轴点调整"},[ce(T("input",{"onUpdate:modelValue":_[10]||(_[10]=A=>d.value=A),type:"checkbox",onChange:v},null,544),[[wt,d.value]]),_[30]||(_[30]=T("span",{class:"pivot-switch-ui"},null,-1))],8,O5)])):xe("",!0),l.value&&d.value?(q(),Ct(Iy,{key:3,"preview-url":r.value,"anchor-x":s.resource.anchorX??.5,"anchor-y":s.resource.anchorY??.5,"onUpdate:anchorX":_[11]||(_[11]=A=>s.resource.anchorX=A),"onUpdate:anchorY":_[12]||(_[12]=A=>s.resource.anchorY=A),onFullscreen:x},null,8,["preview-url","anchor-x","anchor-y"])):xe("",!0)]),(q(),Ct(dx,{to:"body"},[f.value?(q(),J("div",{key:0,class:"pivot-modal-backdrop",onPointerdown:_[18]||(_[18]=qe(A=>y(!1),["self"]))},[T("div",L5,[T("div",B5,[_[34]||(_[34]=T("div",{class:"pivot-modal-icon"},"◎",-1)),T("div",N5,[T("div",D5,[_[32]||(_[32]=ft(" 贴图旋转轴点大图精修 ",-1)),T("span",U5,ve(s.resource.textureName||s.defaultFile),1)]),_[33]||(_[33]=T("div",{class:"pivot-modal-desc"},"在下方贴图上任意点击或拖拽,精确设置粒子的旋转/摆动中心",-1))]),T("button",{type:"button",class:"pivot-modal-close",title:"关闭",onClick:_[13]||(_[13]=A=>y(!1))},"✕")]),_[35]||(_[35]=T("div",{class:"pivot-modal-hint"},"支持 100% ~ 400% 放大,精确对准尖端或根部:",-1)),we(Iy,{large:"","preview-url":r.value,"anchor-x":m.value,"anchor-y":p.value,"onUpdate:anchorX":_[14]||(_[14]=A=>m.value=A),"onUpdate:anchorY":_[15]||(_[15]=A=>p.value=A)},null,8,["preview-url","anchor-x","anchor-y"]),T("div",$5,[T("button",{type:"button",class:"pivot-modal-cancel",onClick:_[16]||(_[16]=A=>y(!1))},"取消"),T("button",{type:"button",class:"pivot-modal-confirm",onClick:_[17]||(_[17]=A=>y(!0))},"确定并保存轴点")])])],32)):xe("",!0)]))],64))}}),KS=Jt(X5,[["__scopeId","data-v-cb3a8e2c"]]),V5={class:"group"},Y5={class:"caret"},G5={class:"group-body"},j5={class:"seg"},H5={class:"row"},W5={class:"curve-wrap"},z5={class:"seg"},q5={class:"row"},K5=["value"],Z5={value:0},J5=["value"],Q5={class:"render-layer-current"},e8=["title"],t8={key:0,class:"slot-picker"},i8={class:"slot-list"},s8=["onClick"],n8={class:"slot-order"},r8={class:"slot-name"},o8={class:"slot-attachment"},a8={key:0,class:"modifier-hint"},l8={class:"seg"},c8={class:"switch-row render-layer-switch"},h8=["disabled"],u8={key:0,class:"modifier-hint"},d8={key:2,class:"modifier-hint render-layer-warning"},f8={class:"look-title image-title"},m8={class:"row resource-color-row"},p8=["onUpdate:modelValue"],g8=["onUpdate:modelValue"],v8={key:0,class:"row resource-color-picker"},y8=["onUpdate:modelValue"],x8=["value","onChange","onKeydown"],b8={key:0,class:"random-color-hint"},w8={class:"resource-alpha-head"},S8={class:"alpha-modes"},M8=["onClick"],T8=["onClick"],_8=["onClick"],C8={class:"row"},E8=["onUpdate:modelValue"],A8={class:"resource-alpha-curve"},I8=Zt({__name:"ParticleAppearanceSection",setup(s){const{resolvedCurveEditorMode:e,sys:t,textureFileInput:i,sequenceFileInput:n,addImageResource:r,openTexturePicker:o,openSequencePicker:a,onTextureFile:c,onSequenceFiles:l,resetTexture:h,setResourceFixedColor:u,commitResourceFixedColor:d,removeImageResource:f,setResourceWeight:m,toggleResourceLock:p,collapsed:g,toggle:x,resetModule:v,select:y,renderLayerSlotPickerOpen:S,renderLayerSlotSearch:C,renderLayerReadySpines:w,renderLayerSpineReady:b,renderLayerFilteredSlots:_,renderLayerSlotLabel:A,renderLayerResolvedLabel:P,renderLayerWarning:E,setRenderLayerSlotMode:R,selectRenderLayerSpine:O,pickRenderLayerSlot:U,clearRenderLayerSlot:Y,ALPHA_CURVE:$,RESOURCE_ALPHA_CURVE:X}=Fr();return(D,F)=>(q(),J("div",V5,[T("div",{class:"group-head",onClick:F[1]||(F[1]=N=>I(x)("look"))},[T("span",Y5,ve(I(g).look?"▸":"▾"),1),F[19]||(F[19]=T("span",null,"外观与资源",-1)),T("button",{class:"group-reset",title:"重置外观与资源参数",onClick:F[0]||(F[0]=qe(N=>I(v)("look"),["stop"]))},"重置")]),ce(T("div",G5,[F[36]||(F[36]=T("div",{class:"look-title"},"透明度",-1)),T("div",j5,[T("button",{class:Ce(["seg-btn",{active:I(t).config.alphaMode==="curve"}]),onClick:F[2]||(F[2]=N=>I(t).config.alphaMode="curve")},"曲线",2),T("button",{class:Ce(["seg-btn",{active:I(t).config.alphaMode==="fixed"}]),onClick:F[3]||(F[3]=N=>I(t).config.alphaMode="fixed")},"固定",2)]),I(t).config.alphaMode==="fixed"?(q(),Ct(Oe,{key:0,label:"透明度",min:0,max:1,step:.01,modelValue:I(t).config.alpha,"onUpdate:modelValue":F[4]||(F[4]=N=>I(t).config.alpha=N)},null,8,["modelValue"])):(q(),J(_e,{key:1},[T("label",H5,[F[21]||(F[21]=T("span",null,"曲线模式",-1)),ce(T("select",{"onUpdate:modelValue":F[5]||(F[5]=N=>I(t).config.curveMode=N),class:"inp"},[...F[20]||(F[20]=[T("option",null,"跟随导出",-1),T("option",null,"线性",-1),T("option",null,"贝塞尔",-1)])],512),[[bt,I(t).config.curveMode]])]),T("div",W5,[we(tn,{modelValue:I(t).config.alphaCurve,"onUpdate:modelValue":F[6]||(F[6]=N=>I(t).config.alphaCurve=N),"default-value":I($),mode:I(e)(I(t).config.curveMode)},null,8,["modelValue","default-value","mode"]),F[22]||(F[22]=T("div",{class:"curve-labels"},[T("span",null,"0(透明)"),T("span",null,"生命周期 →"),T("span",null,"1(不透明)")],-1))])],64)),F[37]||(F[37]=T("div",{class:"look-title"},"渲染层级(Spine 插槽)",-1)),T("div",z5,[T("button",{class:Ce(["seg-btn",{active:I(t).config.renderLayerMode==="top"}]),onClick:F[7]||(F[7]=N=>I(t).config.renderLayerMode="top")},"最上层",2),T("button",{class:Ce(["seg-btn",{active:I(t).config.renderLayerMode==="slot"}]),onClick:F[8]||(F[8]=(...N)=>I(R)&&I(R)(...N))},"Spine 插槽",2)]),I(t).config.renderLayerMode==="slot"?(q(),J(_e,{key:2},[T("label",q5,[F[23]||(F[23]=T("span",null,"Spine",-1)),T("select",{class:"inp",value:I(t).config.renderLayerSpineId,onChange:F[9]||(F[9]=(...N)=>I(O)&&I(O)(...N))},[T("option",Z5,ve(I(w).length?"请选择 Spine":"无可用 Spine"),1),(q(!0),J(_e,null,Et(I(w),N=>(q(),J("option",{key:N.id,value:N.id},ve(N.name),9,J5))),128))],40,K5)]),I(b)?(q(),J(_e,{key:0},[T("div",Q5,[T("span",{class:"render-layer-text",title:I(A)},ve(I(A)||"尚未选择插槽"),9,e8),T("button",{class:"mini-btn",onClick:F[10]||(F[10]=N=>S.value=!I(S))},ve(I(A)?"重新选择":"选择插槽"),1),I(t).config.renderLayerSlotName?(q(),J("button",{key:0,class:"mini-btn ghost",onClick:F[11]||(F[11]=(...N)=>I(Y)&&I(Y)(...N))},"清除")):xe("",!0)]),I(S)?(q(),J("div",t8,[ce(T("input",{"onUpdate:modelValue":F[12]||(F[12]=N=>jt(C)?C.value=N:null),class:"inp",type:"search",placeholder:"搜索插槽或附件名称…","aria-label":"搜索插槽"},null,512),[[He,I(C),void 0,{trim:!0}]]),T("div",i8,[(q(!0),J(_e,null,Et(I(_),N=>(q(),J("button",{key:N.name,class:Ce(["slot-item",{on:I(t).config.renderLayerSlotName===N.name}]),onClick:k=>I(U)(N)},[T("span",n8,ve(N.order+1),1),T("span",r8,ve(N.name),1),T("span",o8,ve(N.attachment||"空插槽"),1)],10,s8))),128)),I(_).length?xe("",!0):(q(),J("div",a8,"没有匹配的插槽"))])])):xe("",!0),I(t).config.renderLayerSlotName?(q(),J(_e,{key:1},[T("div",l8,[T("button",{class:Ce(["seg-btn",{active:I(t).config.renderLayerSlotPosition==="above"}]),onClick:F[13]||(F[13]=N=>I(t).config.renderLayerSlotPosition="above")},"在此插槽图片之上",2),T("button",{class:Ce(["seg-btn",{active:I(t).config.renderLayerSlotPosition==="below"}]),onClick:F[14]||(F[14]=N=>I(t).config.renderLayerSlotPosition="below")},"在此插槽图片之下",2)]),T("label",c8,[ce(T("input",{"onUpdate:modelValue":F[15]||(F[15]=N=>I(t).config.renderLayerFollowAttachment=N),type:"checkbox",disabled:I(t).config.renderLayerSlotPosition==="below"},null,8,h8),[[wt,I(t).config.renderLayerFollowAttachment]]),F[24]||(F[24]=T("span",{class:"switch-ui"},null,-1)),F[25]||(F[25]=T("span",null,"随插槽附件显隐",-1))]),I(P)?(q(),J("div",u8,ve(I(P)),1)):xe("",!0)],64)):xe("",!0),I(E)?(q(),J("div",d8,ve(I(E)),1)):xe("",!0),F[26]||(F[26]=T("div",{class:"modifier-hint"},"调整显示层级只影响编辑器预览,不影响导出数据。",-1))],64)):xe("",!0)],64)):xe("",!0),T("div",f8,[F[27]||(F[27]=T("span",null,"图片资源",-1)),T("button",{class:"image-add",title:"新增图片资源",onClick:F[16]||(F[16]=(...N)=>I(r)&&I(r)(...N))},"+")]),(q(!0),J(_e,null,Et(I(t).config.imageResources,N=>(q(),Ct(KS,{key:`${I(t).id}:${N.id}`,resource:N,"resource-count":I(t).config.imageResources.length,"pivot-key":`${I(t).id}:${N.id}`,"supports-sequence":"","default-file":"star.png",onPick:I(o),onPickSequence:I(a),onReset:I(h),onRemove:I(f),onUpdateWeight:I(m),onToggleLock:I(p)},{default:Zh(()=>[we(Oe,{label:"缩放",min:.1,max:3,step:.05,modelValue:N.scale,"onUpdate:modelValue":k=>N.scale=k},null,8,["modelValue","onUpdate:modelValue"]),F[35]||(F[35]=T("div",{class:"resource-divider"},null,-1)),T("label",m8,[F[30]||(F[30]=T("span",null,"颜色",-1)),ce(T("select",{"onUpdate:modelValue":k=>N.colorMode=k,class:"inp"},[...F[28]||(F[28]=[T("option",{value:"fixed"},"固定色",-1),T("option",{value:"random"},"随机颜色",-1),T("option",{value:"lifetime"},"生命周期",-1)])],8,p8),[[bt,N.colorMode]]),ce(T("select",{"onUpdate:modelValue":k=>N.blend=k,class:"inp blend-select"},[...F[29]||(F[29]=[T("option",{value:"normal"},"正常",-1),T("option",{value:"add"},"相加",-1),T("option",{value:"multiply"},"相乘",-1),T("option",{value:"screen"},"滤色",-1)])],8,g8),[[bt,N.blend]])]),N.colorMode==="fixed"?(q(),J("label",v8,[F[31]||(F[31]=T("span",null,"固定色",-1)),ce(T("input",{type:"color","onUpdate:modelValue":k=>N.colorStart=k,class:"colr"},null,8,y8),[[He,N.colorStart]]),T("input",{type:"text",class:"hex-input",value:N.colorStart,spellcheck:"false","aria-label":"固定颜色值",onChange:k=>I(u)(N,k),onKeydown:Mr(k=>I(d)(N,k),["enter"])},null,40,x8)])):(q(),J(_e,{key:1},[we(qS,{modelValue:N.colorGradient,"onUpdate:modelValue":k=>N.colorGradient=k},null,8,["modelValue","onUpdate:modelValue"]),N.colorMode==="random"?(q(),J("div",b8,"每个粒子出生时从色带随机取色,生命周期内保持不变")):xe("",!0)],64)),T("div",w8,[F[32]||(F[32]=T("span",null,"独立透明度",-1)),T("div",S8,[T("button",{class:Ce({on:N.independentAlpha==="off"}),onClick:k=>N.independentAlpha="off"},"关闭",10,M8),T("button",{class:Ce({on:N.independentAlpha==="fixed"}),onClick:k=>N.independentAlpha="fixed"},"固定",10,T8),T("button",{class:Ce({on:N.independentAlpha==="curve"}),onClick:k=>N.independentAlpha="curve"},"曲线",10,_8)])]),N.independentAlpha==="fixed"?(q(),Ct(Oe,{key:2,label:"透明度",min:0,max:1,step:.01,modelValue:N.alpha,"onUpdate:modelValue":k=>N.alpha=k},null,8,["modelValue","onUpdate:modelValue"])):N.independentAlpha==="curve"?(q(),J(_e,{key:3},[T("label",C8,[F[34]||(F[34]=T("span",null,"曲线模式",-1)),ce(T("select",{"onUpdate:modelValue":k=>N.alphaCurveMode=k,class:"inp"},[...F[33]||(F[33]=[T("option",null,"跟随导出",-1),T("option",null,"线性",-1),T("option",null,"贝塞尔",-1)])],8,E8),[[bt,N.alphaCurveMode]])]),T("div",A8,[we(tn,{modelValue:N.alphaCurve,"onUpdate:modelValue":k=>N.alphaCurve=k,"default-value":I(X),mode:I(e)(N.alphaCurveMode)},null,8,["modelValue","onUpdate:modelValue","default-value","mode"])])],64)):xe("",!0)]),_:2},1032,["resource","resource-count","pivot-key","onPick","onPickSequence","onReset","onRemove","onUpdateWeight","onToggleLock"]))),128)),T("input",{ref_key:"textureFileInput",ref:i,class:"file-input",type:"file",accept:"image/png,image/jpeg,image/webp,image/gif",onChange:F[17]||(F[17]=(...N)=>I(c)&&I(c)(...N))},null,544),T("input",{ref_key:"sequenceFileInput",ref:n,class:"file-input",type:"file",multiple:"",accept:"image/png,image/jpeg,image/webp,image/gif",onChange:F[18]||(F[18]=(...N)=>I(l)&&I(l)(...N))},null,544)],512),[[Si,!I(g).look]])]))}}),R8=Jt(I8,[["__scopeId","data-v-5709815f"]]),P8={class:"group"},k8={class:"caret"},F8={class:"group-body"},O8={class:"modifier-item damping-item"},L8={class:"modifier-item"},B8={class:"switch-row modifier-switch"},N8={key:0,class:"modifier-params"},D8={class:"modifier-item"},U8={class:"switch-row modifier-switch"},$8={key:0,class:"modifier-params gravity-params"},X8={class:"modifier-mode-row"},V8={class:"modifier-item"},Y8={class:"switch-row modifier-switch"},G8={key:0,class:"modifier-params gravity-params"},j8={class:"modifier-mode-row"},H8={class:"modifier-item"},W8={class:"switch-row modifier-switch"},z8={key:0,class:"modifier-params"},q8={class:"row"},K8={class:"switch-row"},Z8={class:"modifier-item"},J8={class:"switch-row modifier-switch"},Q8={key:0,class:"modifier-params"},eU={class:"row"},tU={class:"switch-row"},iU={class:"modifier-item"},sU={class:"switch-row modifier-switch"},nU={key:0,class:"modifier-params"},rU={class:"row"},oU={class:"row"},aU={class:"switch-row"},lU={class:"modifier-item"},cU={class:"switch-row modifier-switch"},hU={key:0,class:"modifier-params trail-params"},uU={class:"trail-section-head"},dU={class:"row"},fU=["onUpdate:modelValue"],mU={class:"row"},pU=["onUpdate:modelValue"],gU={class:"row"},vU=["onUpdate:modelValue"],yU={class:"switch-row trail-sub-switch"},xU=["onUpdate:modelValue"],bU={class:"switch-row trail-sub-switch"},wU=["onUpdate:modelValue"],SU={class:"trail-mode-head"},MU={class:"alpha-modes"},TU=["onClick"],_U=["onClick"],CU=["onClick"],EU={class:"row"},AU=["onUpdate:modelValue"],IU={key:6,class:"row trail-fixed-color"},RU=["onUpdate:modelValue"],PU=["value","onChange","onKeydown"],kU={class:"trail-mode-head"},FU={class:"alpha-modes"},OU=["onClick"],LU=["onClick"],BU=["onClick"],NU={class:"trail-grid-row"},DU={class:"modifier-item"},UU={class:"switch-row modifier-switch"},$U=["disabled"],XU={key:0,class:"modifier-params emitter-follow-params"},VU={class:"field-block"},YU=["value"],GU={key:0,value:"bone"},jU={class:"field-block"},HU=["value"],WU={class:"field-block"},zU={class:"field-grid follow-grid"},qU={class:"compact-field"},KU={class:"compact-field"},ZU={class:"field-block"},JU={key:0,class:"bone-follow-target"},QU={key:1,class:"bone-follow-missing"},e$={class:"field-block"},t$={class:"field-grid follow-grid"},i$={class:"compact-field"},s$={class:"compact-field"},n$={class:"bone-follow-transform-grid"},r$={class:"compact-field"},o$={class:"compact-field"},a$={class:"compact-field"},l$={class:"modifier-item"},c$={class:"switch-row modifier-switch"},h$={key:0,class:"modifier-params collision-filter-params"},u$={class:"collision-filter-tags"},d$=["title"],f$=["aria-label","onClick"],m$=["disabled","title"],p$={key:0,class:"collision-filter-empty"},g$={key:1,class:"collision-filter-picker"},v$=["onClick"],y$={class:"modifier-item events-item"},x$={class:"switch-row modifier-switch"},b$={key:0,class:"event-rules"},w$={class:"event-selects"},S$=["onUpdate:modelValue"],M$=["onUpdate:modelValue"],T$=["value"],_$=["onClick"],C$={class:"event-probability"},E$=["onUpdate:modelValue"],A$={key:0,class:"event-probability event-collision-limit"},I$=["value","onInput"],R$={class:"event-probability event-inherit"},P$=["onClick"],k$={class:"inherit-summary"},F$={key:1,class:"event-probability event-color-mode"},O$=["onUpdate:modelValue"],L$={class:"inherit-check"},B$={class:"inherit-check"},N$=["onClick"],D$={class:"inherit-check"},U$=Zt({__name:"ParticleModifiersSection",setup(s){const{store:e,sys:t,trailTextureFileInput:i,addTrailResource:n,openTrailTexturePicker:r,onTrailRigChange:o,onTrailResourceBoneCountChange:a,onTrailResourceRotationChange:c,onTrailTextureFile:l,resetTrailTexture:h,removeTrailResource:u,setTrailResourceWeight:d,toggleTrailResourceLock:f,setTrailColor:m,commitTrailColor:p,selectedSpineBone:g,boundSpineBone:x,collisionPickerOpen:v,selectedCollisionBodies:y,availableCollisionBodies:S,addCollisionBody:C,removeCollisionBody:w,collapsed:b,toggle:_,onEmitterFollowModeChange:A,bindSelectedBone:P,resetModule:E,select:R,LINEAR_CURVE:O,FLAT_CURVE:U,TRAIL_ALPHA_CURVE:Y,TRAIL_SHAPE_CURVE:$}=Fr(),X=Le(()=>{var L;const K=(L=t.value)==null?void 0:L.id;if(!K)return[];const B=k1(e.systems,K);return e.systems.filter(j=>j.id!==K&&!B.has(j.id))}),D=[{key:"color",label:"颜色"},{key:"scale",label:"大小"},{key:"rotation",label:"旋转"},{key:"life",label:"生命周期"}],F=Fe(null),N=Le(()=>{var L;const K=F.value,B=(L=t.value)==null?void 0:L.config.events;return!K||!Array.isArray(B)?null:B.find(j=>j.id===K.ruleId)||null});function k(K){return Array.isArray(K.inherit)||(K.inherit=[]),K.inherit}function V(K){const B=k(K);return B.length?B.length===D.length?"所有属性":D.filter(L=>B.includes(L.key)).map(L=>L.label).join("、"):"无(默认值)"}function G(K,B){return k(K).includes(B)}function W(K,B){const L=k(K),j=L.indexOf(B);j>=0?L.splice(j,1):L.push(B)}function Z(K){k(K).splice(0)}function ne(K){k(K).splice(0,k(K).length,...D.map(B=>B.key))}function oe(K,B){var Me;if(((Me=F.value)==null?void 0:Me.ruleId)===K.id){F.value=null;return}const L=B.currentTarget;if(!L)return;const j=L.getBoundingClientRect(),ie=Math.max(168,j.width),ue=212,fe=Math.min(Math.max(8,j.left),Math.max(8,window.innerWidth-ie-8));let ee=j.bottom+4;ee+ue>window.innerHeight-8&&(ee=Math.max(8,j.top-ue-4)),F.value={ruleId:K.id,left:fe,top:ee,width:ie}}function de(){F.value=null}function pe(){de()}function he(K){K.key==="Escape"&&de()}ys(()=>{document.addEventListener("pointerdown",de),window.addEventListener("scroll",pe,!0),window.addEventListener("resize",pe),window.addEventListener("keydown",he)}),Rr(()=>{document.removeEventListener("pointerdown",de),window.removeEventListener("scroll",pe,!0),window.removeEventListener("resize",pe),window.removeEventListener("keydown",he)});function me(){var L;const K=(L=t.value)==null?void 0:L.config;if(!K)return;Array.isArray(K.events)||(K.events=[]);const B=Math.max(0,...K.events.map(j=>j.id))+1;K.events.push({id:B,event:"birth",targetSystemId:0,probability:1,collisionLimit:1,inherit:[],colorInheritMode:"add"})}function H(K){var B;(B=t.value)==null||B.config.events.splice(K,1)}function z(K,B){const L=B.target,j=Math.round(Number(L.value));K.collisionLimit=Math.min(4,Math.max(1,Number.isFinite(j)?j:1)),L.value=String(K.collisionLimit)}return(K,B)=>(q(),J(_e,null,[T("div",P8,[T("div",{class:"group-head",onClick:B[1]||(B[1]=L=>I(_)("mods"))},[T("span",k8,ve(I(b).mods?"▸":"▾"),1),B[74]||(B[74]=T("span",null,"修改器",-1)),T("button",{class:"group-reset",title:"重置修改器参数",onClick:B[0]||(B[0]=qe(L=>I(E)("mods"),["stop"]))},"重置")]),ce(T("div",F8,[T("div",O8,[we(Oe,{label:"阻尼",min:0,max:2,step:.05,modelValue:I(t).config.damping,"onUpdate:modelValue":B[2]||(B[2]=L=>I(t).config.damping=L)},null,8,["modelValue"])]),T("div",L8,[T("label",B8,[ce(T("input",{type:"checkbox","onUpdate:modelValue":B[3]||(B[3]=L=>I(t).config.noise=L)},null,512),[[wt,I(t).config.noise]]),B[75]||(B[75]=T("span",{class:"switch-ui"},null,-1)),B[76]||(B[76]=T("span",null,"开启移动噪声",-1))]),I(t).config.noise?(q(),J("div",N8,[we(Oe,{label:"强度",min:0,max:100,step:1,modelValue:I(t).config.noiseAmt,"onUpdate:modelValue":B[4]||(B[4]=L=>I(t).config.noiseAmt=L)},null,8,["modelValue"]),we(Oe,{label:"波动范围",min:0,max:500,step:1,modelValue:I(t).config.noiseRange,"onUpdate:modelValue":B[5]||(B[5]=L=>I(t).config.noiseRange=L)},null,8,["modelValue"]),we(Oe,{label:"时间流速",min:0,max:10,step:.1,modelValue:I(t).config.noiseSpeed,"onUpdate:modelValue":B[6]||(B[6]=L=>I(t).config.noiseSpeed=L)},null,8,["modelValue"]),B[77]||(B[77]=T("div",{class:"modifier-hint"},"强度控制影响比例 · 波动范围控制最大偏移 · 时间流速控制变化速度",-1))])):xe("",!0)]),T("div",D8,[T("label",U8,[ce(T("input",{type:"checkbox","onUpdate:modelValue":B[7]||(B[7]=L=>I(t).config.useGravity=L)},null,512),[[wt,I(t).config.useGravity]]),B[78]||(B[78]=T("span",{class:"switch-ui"},null,-1)),B[79]||(B[79]=T("span",null,"开启重力",-1))]),I(t).config.useGravity?(q(),J("div",$8,[T("div",X8,[T("button",{class:Ce(["axis-mode",{on:I(t).config.gravityMode==="fixed"}]),onClick:B[8]||(B[8]=L=>I(t).config.gravityMode="fixed")},"固定",2),T("button",{class:Ce(["axis-mode",{on:I(t).config.gravityMode==="random"}]),onClick:B[9]||(B[9]=L=>I(t).config.gravityMode="random")},"随机",2)]),I(t).config.gravityMode==="fixed"?(q(),Ct(Oe,{key:0,label:"重力强度",min:-3e3,max:3e3,step:10,modelValue:I(t).config.gravityMin,"onUpdate:modelValue":B[10]||(B[10]=L=>I(t).config.gravityMin=L)},null,8,["modelValue"])):(q(),J(_e,{key:1},[we(Oe,{label:"强度 min",min:-3e3,max:3e3,step:10,modelValue:I(t).config.gravityMin,"onUpdate:modelValue":B[11]||(B[11]=L=>I(t).config.gravityMin=L)},null,8,["modelValue"]),we(Oe,{label:"强度 max",min:-3e3,max:3e3,step:10,modelValue:I(t).config.gravityMax,"onUpdate:modelValue":B[12]||(B[12]=L=>I(t).config.gravityMax=L)},null,8,["modelValue"])],64)),we(Oe,{label:"方向",min:-360,max:360,step:1,modelValue:I(t).config.gravityDirection,"onUpdate:modelValue":B[13]||(B[13]=L=>I(t).config.gravityDirection=L)},null,8,["modelValue"]),B[80]||(B[80]=T("div",{class:"gravity-curve-title"},[T("span",null,"生命周期内重力"),T("span",null,"纵轴:强度 0~1")],-1)),we(tn,{modelValue:I(t).config.gravityCurve,"onUpdate:modelValue":B[14]||(B[14]=L=>I(t).config.gravityCurve=L),"default-value":I(U)},null,8,["modelValue","default-value"]),B[81]||(B[81]=T("div",{class:"gravity-curve-axis"},[T("span",null,"0"),T("span",null,"生命周期 →"),T("span",null,"1")],-1)),B[82]||(B[82]=T("div",{class:"modifier-hint"},"0° 向右 · -90° 向下 · 负强度会反转方向",-1))])):xe("",!0)]),T("div",V8,[T("label",Y8,[ce(T("input",{type:"checkbox","onUpdate:modelValue":B[15]||(B[15]=L=>I(t).config.wind=L)},null,512),[[wt,I(t).config.wind]]),B[83]||(B[83]=T("span",{class:"switch-ui"},null,-1)),B[84]||(B[84]=T("span",null,"开启风力",-1))]),I(t).config.wind?(q(),J("div",G8,[T("div",j8,[T("button",{class:Ce(["axis-mode",{on:I(t).config.windMode==="fixed"}]),onClick:B[16]||(B[16]=L=>I(t).config.windMode="fixed")},"固定",2),T("button",{class:Ce(["axis-mode",{on:I(t).config.windMode==="random"}]),onClick:B[17]||(B[17]=L=>I(t).config.windMode="random")},"随机",2)]),I(t).config.windMode==="fixed"?(q(),Ct(Oe,{key:0,label:"风力强度",min:-3e3,max:3e3,step:10,modelValue:I(t).config.windMin,"onUpdate:modelValue":B[18]||(B[18]=L=>I(t).config.windMin=L)},null,8,["modelValue"])):(q(),J(_e,{key:1},[we(Oe,{label:"强度 min",min:-3e3,max:3e3,step:10,modelValue:I(t).config.windMin,"onUpdate:modelValue":B[19]||(B[19]=L=>I(t).config.windMin=L)},null,8,["modelValue"]),we(Oe,{label:"强度 max",min:-3e3,max:3e3,step:10,modelValue:I(t).config.windMax,"onUpdate:modelValue":B[20]||(B[20]=L=>I(t).config.windMax=L)},null,8,["modelValue"])],64)),we(Oe,{label:"方向",min:-360,max:360,step:1,modelValue:I(t).config.windDirection,"onUpdate:modelValue":B[21]||(B[21]=L=>I(t).config.windDirection=L)},null,8,["modelValue"]),B[85]||(B[85]=T("div",{class:"gravity-curve-title"},[T("span",null,"生命周期内风力"),T("span",null,"纵轴:强度 0~1")],-1)),we(tn,{modelValue:I(t).config.windCurve,"onUpdate:modelValue":B[22]||(B[22]=L=>I(t).config.windCurve=L),"default-value":I(U)},null,8,["modelValue","default-value"]),B[86]||(B[86]=T("div",{class:"gravity-curve-axis"},[T("span",null,"0"),T("span",null,"生命周期 →"),T("span",null,"1")],-1)),B[87]||(B[87]=T("div",{class:"modifier-hint"},"0° 向右 · -90° 向下 · 负强度会反转方向",-1))])):xe("",!0)]),T("div",H8,[T("label",W8,[ce(T("input",{type:"checkbox","onUpdate:modelValue":B[23]||(B[23]=L=>I(t).config.forceField=L)},null,512),[[wt,I(t).config.forceField]]),B[88]||(B[88]=T("span",{class:"switch-ui"},null,-1)),B[89]||(B[89]=T("span",null,"开启力场",-1))]),I(t).config.forceField?(q(),J("div",z8,[we(Oe,{label:"中心 X",min:-5e3,max:5e3,step:1,modelValue:I(t).config.forceCenterX,"onUpdate:modelValue":B[24]||(B[24]=L=>I(t).config.forceCenterX=L)},null,8,["modelValue"]),we(Oe,{label:"中心 Y",min:-5e3,max:5e3,step:1,modelValue:I(t).config.forceCenterY,"onUpdate:modelValue":B[25]||(B[25]=L=>I(t).config.forceCenterY=L)},null,8,["modelValue"]),we(Oe,{label:"力场强度",min:-300,max:300,step:1,modelValue:I(t).config.forceStrength,"onUpdate:modelValue":B[26]||(B[26]=L=>I(t).config.forceStrength=L)},null,8,["modelValue"]),we(Oe,{label:"力场半径",min:1,max:2e3,step:1,modelValue:I(t).config.forceRadius,"onUpdate:modelValue":B[27]||(B[27]=L=>I(t).config.forceRadius=L)},null,8,["modelValue"]),T("label",q8,[B[91]||(B[91]=T("span",null,"衰减模式",-1)),ce(T("select",{"onUpdate:modelValue":B[28]||(B[28]=L=>I(t).config.forceFalloff=L),class:"inp"},[...B[90]||(B[90]=[T("option",{value:"constant"},"恒定(范围内力度不变)",-1),T("option",{value:"linear"},"线性衰减(边缘为 0)",-1),T("option",{value:"inverse"},"距离反比(中心最强)",-1)])],512),[[bt,I(t).config.forceFalloff]])]),B[94]||(B[94]=T("div",{class:"modifier-hint"},"正数吸向中心 · 负数向外排斥 · 可在画布内拖动力场圆",-1)),T("label",K8,[ce(T("input",{type:"checkbox","onUpdate:modelValue":B[29]||(B[29]=L=>I(t).config.showForceFieldShape=L)},null,512),[[wt,I(t).config.showForceFieldShape]]),B[92]||(B[92]=T("span",{class:"switch-ui"},null,-1)),B[93]||(B[93]=T("span",null,"显示形状",-1))])])):xe("",!0)]),T("div",Z8,[T("label",J8,[ce(T("input",{type:"checkbox","onUpdate:modelValue":B[30]||(B[30]=L=>I(t).config.vortex=L)},null,512),[[wt,I(t).config.vortex]]),B[95]||(B[95]=T("span",{class:"switch-ui"},null,-1)),B[96]||(B[96]=T("span",null,"开启漩涡",-1))]),I(t).config.vortex?(q(),J("div",Q8,[we(Oe,{label:"中心 X",min:-5e3,max:5e3,step:1,modelValue:I(t).config.vortexCenterX,"onUpdate:modelValue":B[31]||(B[31]=L=>I(t).config.vortexCenterX=L)},null,8,["modelValue"]),we(Oe,{label:"中心 Y",min:-5e3,max:5e3,step:1,modelValue:I(t).config.vortexCenterY,"onUpdate:modelValue":B[32]||(B[32]=L=>I(t).config.vortexCenterY=L)},null,8,["modelValue"]),we(Oe,{label:"力场强度",min:-300,max:300,step:1,modelValue:I(t).config.vortexStrength,"onUpdate:modelValue":B[33]||(B[33]=L=>I(t).config.vortexStrength=L)},null,8,["modelValue"]),we(Oe,{label:"力场半径",min:1,max:2e3,step:1,modelValue:I(t).config.vortexRadius,"onUpdate:modelValue":B[34]||(B[34]=L=>I(t).config.vortexRadius=L)},null,8,["modelValue"]),T("label",eU,[B[98]||(B[98]=T("span",null,"衰减模式",-1)),ce(T("select",{"onUpdate:modelValue":B[35]||(B[35]=L=>I(t).config.vortexFalloff=L),class:"inp"},[...B[97]||(B[97]=[T("option",{value:"constant"},"恒定(范围内力度不变)",-1),T("option",{value:"linear"},"线性衰减(边缘为 0)",-1),T("option",{value:"inverse"},"距离反比(中心最强)",-1)])],512),[[bt,I(t).config.vortexFalloff]])]),B[101]||(B[101]=T("div",{class:"modifier-hint"},"正数逆时针 · 负数顺时针",-1)),T("label",tU,[ce(T("input",{type:"checkbox","onUpdate:modelValue":B[36]||(B[36]=L=>I(t).config.showVortexShape=L)},null,512),[[wt,I(t).config.showVortexShape]]),B[99]||(B[99]=T("span",{class:"switch-ui"},null,-1)),B[100]||(B[100]=T("span",null,"显示形状",-1))])])):xe("",!0)]),T("div",iU,[T("label",sU,[ce(T("input",{type:"checkbox","onUpdate:modelValue":B[37]||(B[37]=L=>I(t).config.attraction=L)},null,512),[[wt,I(t).config.attraction]]),B[102]||(B[102]=T("span",{class:"switch-ui"},null,-1)),B[103]||(B[103]=T("span",null,"开启吸附",-1))]),I(t).config.attraction?(q(),J("div",nU,[we(Oe,{label:"吸附点 X",min:-5e3,max:5e3,step:1,modelValue:I(t).config.attractionCenterX,"onUpdate:modelValue":B[38]||(B[38]=L=>I(t).config.attractionCenterX=L)},null,8,["modelValue"]),we(Oe,{label:"吸附点 Y",min:-5e3,max:5e3,step:1,modelValue:I(t).config.attractionCenterY,"onUpdate:modelValue":B[39]||(B[39]=L=>I(t).config.attractionCenterY=L)},null,8,["modelValue"]),we(Oe,{label:"吸附半径",min:0,max:2e3,step:1,modelValue:I(t).config.attractionRadius,"onUpdate:modelValue":B[40]||(B[40]=L=>I(t).config.attractionRadius=L)},null,8,["modelValue"]),we(Oe,{label:"吸附时长",min:.05,max:30,step:.05,modelValue:I(t).config.attractionDuration,"onUpdate:modelValue":B[41]||(B[41]=L=>I(t).config.attractionDuration=L)},null,8,["modelValue"]),we(Oe,{label:"延迟时间",min:0,max:30,step:.05,modelValue:I(t).config.attractionDelay,"onUpdate:modelValue":B[42]||(B[42]=L=>I(t).config.attractionDelay=L)},null,8,["modelValue"]),T("label",rU,[B[105]||(B[105]=T("span",null,"延迟方式",-1)),ce(T("select",{"onUpdate:modelValue":B[43]||(B[43]=L=>I(t).config.attractionDelayMode=L),class:"inp"},[...B[104]||(B[104]=[T("option",{value:"global"},"统一时间",-1),T("option",{value:"particle"},"单粒子生命",-1)])],512),[[bt,I(t).config.attractionDelayMode]])]),T("label",oU,[B[107]||(B[107]=T("span",null,"吸附方式",-1)),ce(T("select",{"onUpdate:modelValue":B[44]||(B[44]=L=>I(t).config.attractionPath=L),class:"inp"},[...B[106]||(B[106]=[T("option",{value:"linear"},"直线",-1),T("option",{value:"curve"},"曲线",-1)])],512),[[bt,I(t).config.attractionPath]])]),B[110]||(B[110]=T("div",{class:"modifier-hint"},"延迟后从当前位置开始吸附 · 到达红色范围即死亡 · 可在画布内拖动吸附圆",-1)),T("label",aU,[ce(T("input",{type:"checkbox","onUpdate:modelValue":B[45]||(B[45]=L=>I(t).config.showAttractionShape=L)},null,512),[[wt,I(t).config.showAttractionShape]]),B[108]||(B[108]=T("span",{class:"switch-ui"},null,-1)),B[109]||(B[109]=T("span",null,"显示形状",-1))])])):xe("",!0)]),T("div",lU,[T("label",cU,[ce(T("input",{type:"checkbox","onUpdate:modelValue":B[46]||(B[46]=L=>I(t).config.trail=L)},null,512),[[wt,I(t).config.trail]]),B[111]||(B[111]=T("span",{class:"switch-ui"},null,-1)),B[112]||(B[112]=T("span",null,"开启拖尾",-1))]),I(t).config.trail?(q(),J("div",hU,[T("div",uU,[B[113]||(B[113]=T("div",{class:"trail-section-title"},"拖尾独立图片",-1)),T("button",{class:"image-add",title:"增加拖尾图片资源",onClick:B[47]||(B[47]=(...L)=>I(n)&&I(n)(...L))},"+")]),(q(!0),J(_e,null,Et(I(t).config.trailResources,L=>(q(),Ct(KS,{key:L.id,resource:L,"resource-count":I(t).config.trailResources.length,"default-file":"trail.png","name-placeholder":"trail","show-folder":!1,onPick:I(r),onReset:I(h),onRemove:I(u),onUpdateWeight:I(d),onToggleLock:I(f)},{default:Zh(()=>[B[129]||(B[129]=T("div",{class:"resource-divider"},null,-1)),we(Oe,{label:"旋转",min:-360,max:360,step:1,"model-value":L.rotation,"onUpdate:modelValue":j=>I(c)(L.id,j)},null,8,["model-value","onUpdate:modelValue"]),we(Oe,{label:"拖尾骨骼数",min:2,max:16,step:1,"model-value":L.boneCount,"onUpdate:modelValue":j=>I(a)(L.id,j)},null,8,["model-value","onUpdate:modelValue"]),we(Oe,{label:"拖尾比例 (%)",min:0,max:100,step:1,modelValue:L.trailRatio,"onUpdate:modelValue":j=>L.trailRatio=j},null,8,["modelValue","onUpdate:modelValue"]),T("label",dU,[B[115]||(B[115]=T("span",null,"拖尾长度",-1)),ce(T("select",{"onUpdate:modelValue":j=>L.lengthMode=j,class:"inp"},[...B[114]||(B[114]=[T("option",{value:"fixed"},"固定",-1),T("option",{value:"random"},"随机范围",-1)])],8,fU),[[bt,L.lengthMode]])]),L.lengthMode==="fixed"?(q(),Ct(Oe,{key:0,label:"长度比例 (%)",min:0,max:500,step:1,modelValue:L.length,"onUpdate:modelValue":j=>L.length=j},null,8,["modelValue","onUpdate:modelValue"])):(q(),J(_e,{key:1},[we(Oe,{label:"长度最小 (%)",min:0,max:500,step:1,modelValue:L.lengthMin,"onUpdate:modelValue":j=>L.lengthMin=j},null,8,["modelValue","onUpdate:modelValue"]),we(Oe,{label:"长度最大 (%)",min:0,max:500,step:1,modelValue:L.lengthMax,"onUpdate:modelValue":j=>L.lengthMax=j},null,8,["modelValue","onUpdate:modelValue"])],64)),T("label",mU,[B[117]||(B[117]=T("span",null,"拖尾宽度",-1)),ce(T("select",{"onUpdate:modelValue":j=>L.widthSizeMode=j,class:"inp"},[...B[116]||(B[116]=[T("option",{value:"fixed"},"固定",-1),T("option",{value:"random"},"随机范围",-1)])],8,pU),[[bt,L.widthSizeMode]])]),L.widthSizeMode==="fixed"?(q(),Ct(Oe,{key:2,label:"宽度比例 (%)",min:0,max:500,step:1,modelValue:L.width,"onUpdate:modelValue":j=>L.width=j},null,8,["modelValue","onUpdate:modelValue"])):(q(),J(_e,{key:3},[we(Oe,{label:"宽度最小 (%)",min:0,max:500,step:1,modelValue:L.widthMin,"onUpdate:modelValue":j=>L.widthMin=j},null,8,["modelValue","onUpdate:modelValue"]),we(Oe,{label:"宽度最大 (%)",min:0,max:500,step:1,modelValue:L.widthMax,"onUpdate:modelValue":j=>L.widthMax=j},null,8,["modelValue","onUpdate:modelValue"])],64)),T("label",gU,[B[119]||(B[119]=T("span",null,"宽度缩放",-1)),ce(T("select",{"onUpdate:modelValue":j=>L.widthMode=j,class:"inp"},[...B[118]||(B[118]=[T("option",{value:"particle"},"跟随粒子",-1),T("option",{value:"fixed"},"固定",-1)])],8,vU),[[bt,L.widthMode]])]),T("label",yU,[ce(T("input",{type:"checkbox","onUpdate:modelValue":j=>L.lifeLengthEnabled=j},null,8,xU),[[wt,L.lifeLengthEnabled]]),B[120]||(B[120]=T("span",{class:"switch-ui"},null,-1)),B[121]||(B[121]=T("span",null,"生命周期长度曲线",-1))]),L.lifeLengthEnabled?(q(),Ct(tn,{key:4,modelValue:L.lifeLengthCurve,"onUpdate:modelValue":j=>L.lifeLengthCurve=j,"default-value":I(U)},null,8,["modelValue","onUpdate:modelValue","default-value"])):xe("",!0),T("label",bU,[ce(T("input",{type:"checkbox","onUpdate:modelValue":j=>L.shapeEnabled=j},null,8,wU),[[wt,L.shapeEnabled]]),B[122]||(B[122]=T("span",{class:"switch-ui"},null,-1)),B[123]||(B[123]=T("span",null,"形状曲线(首端 → 尾端宽度)",-1))]),L.shapeEnabled?(q(),Ct(tn,{key:5,modelValue:L.shapeCurve,"onUpdate:modelValue":j=>L.shapeCurve=j,"default-value":I($)},null,8,["modelValue","onUpdate:modelValue","default-value"])):xe("",!0),T("div",SU,[B[124]||(B[124]=T("span",null,"颜色模式",-1)),T("div",MU,[T("button",{class:Ce(["axis-mode",{on:L.colorMode==="particle"}]),onClick:j=>L.colorMode="particle"},"跟随粒子",10,TU),T("button",{class:Ce(["axis-mode",{on:L.colorMode==="fixed"}]),onClick:j=>L.colorMode="fixed"},"固定",10,_U),T("button",{class:Ce(["axis-mode",{on:L.colorMode==="curve"}]),onClick:j=>L.colorMode="curve"},"曲线",10,CU)])]),T("label",EU,[B[126]||(B[126]=T("span",null,"混合模式",-1)),ce(T("select",{"onUpdate:modelValue":j=>L.blend=j,class:"inp"},[...B[125]||(B[125]=[T("option",{value:"normal"},"正常",-1),T("option",{value:"add"},"相加",-1),T("option",{value:"multiply"},"相乘",-1),T("option",{value:"screen"},"滤色",-1)])],8,AU),[[bt,L.blend]])]),L.colorMode==="fixed"?(q(),J("label",IU,[B[127]||(B[127]=T("span",null,"固定颜色",-1)),ce(T("input",{class:"colr",type:"color","onUpdate:modelValue":j=>L.color=j},null,8,RU),[[He,L.color]]),T("input",{class:"hex-input",value:L.color,onChange:j=>I(m)(L,j),onKeydown:Mr(qe(j=>I(p)(L,j),["prevent"]),["enter"])},null,40,PU)])):L.colorMode==="curve"?(q(),Ct(qS,{key:7,modelValue:L.colorGradient,"onUpdate:modelValue":j=>L.colorGradient=j},null,8,["modelValue","onUpdate:modelValue"])):xe("",!0),T("div",kU,[B[128]||(B[128]=T("span",null,"透明度模式",-1)),T("div",FU,[T("button",{class:Ce(["axis-mode",{on:L.alphaMode==="particle"}]),onClick:j=>L.alphaMode="particle"},"跟随粒子",10,OU),T("button",{class:Ce(["axis-mode",{on:L.alphaMode==="fixed"}]),onClick:j=>L.alphaMode="fixed"},"固定",10,LU),T("button",{class:Ce(["axis-mode",{on:L.alphaMode==="curve"}]),onClick:j=>L.alphaMode="curve"},"曲线",10,BU)])]),L.alphaMode==="fixed"?(q(),Ct(Oe,{key:8,label:"透明度",min:0,max:1,step:.01,modelValue:L.alpha,"onUpdate:modelValue":j=>L.alpha=j},null,8,["modelValue","onUpdate:modelValue"])):xe("",!0),L.alphaMode==="curve"?(q(),Ct(tn,{key:9,modelValue:L.alphaCurve,"onUpdate:modelValue":j=>L.alphaCurve=j,"default-value":I(Y)},null,8,["modelValue","onUpdate:modelValue","default-value"])):xe("",!0)]),_:2},1032,["resource","resource-count","onPick","onReset","onRemove","onUpdateWeight","onToggleLock"]))),128)),T("input",{ref_key:"trailTextureFileInput",ref:i,class:"file-input",type:"file",accept:"image/png,image/jpeg,image/webp",onChange:B[48]||(B[48]=(...L)=>I(l)&&I(l)(...L))},null,544),T("div",NU,[we(Oe,{label:"网格行数",min:2,max:16,step:1,"model-value":I(t).config.trailGridRows,"onUpdate:modelValue":B[49]||(B[49]=L=>I(o)("trailGridRows",L))},null,8,["model-value"]),we(Oe,{label:"网格列数",min:2,max:32,step:1,"model-value":I(t).config.trailGridCols,"onUpdate:modelValue":B[50]||(B[50]=L=>I(o)("trailGridCols",L))},null,8,["model-value"])]),B[130]||(B[130]=T("div",{class:"modifier-hint"},"每个粒子按资源比例生成一组同级拖尾骨骼;随机长度与宽度在粒子出生时确定,相同种子可稳定复现",-1))])):xe("",!0)]),T("div",DU,[T("label",UU,[ce(T("input",{type:"checkbox","onUpdate:modelValue":B[51]||(B[51]=L=>I(t).config.emitterFollow=L),disabled:I(t).config.streamBehavior==="loop"},null,8,$U),[[wt,I(t).config.emitterFollow]]),B[131]||(B[131]=T("span",{class:"switch-ui"},null,-1)),B[132]||(B[132]=T("span",null,"开启发射器跟随",-1))]),I(t).config.emitterFollow&&I(t).config.streamBehavior!=="loop"?(q(),J("div",XU,[T("label",VU,[B[135]||(B[135]=T("span",null,"跟随模式",-1)),T("select",{value:I(t).config.emitterFollowMode,class:"inp",onChange:B[52]||(B[52]=L=>I(A)(L,I(t).config))},[B[133]||(B[133]=T("option",{value:"none"},"无",-1)),B[134]||(B[134]=T("option",{value:"path"},"跟随路径",-1)),I(g)||I(t).config.emitterFollowMode==="bone"?(q(),J("option",GU,"选中的骨骼")):xe("",!0)],40,YU)]),I(t).config.emitterFollowMode==="path"?(q(),J(_e,{key:0},[T("label",jU,[B[137]||(B[137]=T("span",null,"跟随路径",-1)),ce(T("select",{"onUpdate:modelValue":B[53]||(B[53]=L=>I(t).config.emitterFollowPathId=L),class:"inp"},[B[136]||(B[136]=T("option",{value:0},"无",-1)),(q(!0),J(_e,null,Et(I(e).paths,L=>(q(),J("option",{key:L.id,value:L.id},ve(L.name),9,HU))),128))],512),[[bt,I(t).config.emitterFollowPathId,void 0,{number:!0}]])]),T("label",WU,[B[139]||(B[139]=T("span",null,"发射器角度模式",-1)),ce(T("select",{"onUpdate:modelValue":B[54]||(B[54]=L=>I(t).config.emitterAngleMode=L),class:"inp"},[...B[138]||(B[138]=[T("option",{value:"fixed"},"固定角度",-1),T("option",{value:"direction"},"跟随移动方向",-1)])],512),[[bt,I(t).config.emitterAngleMode]])]),B[145]||(B[145]=T("div",{class:"gravity-curve-title"},[T("span",null,"移动进度曲线 (0→1)")],-1)),we(tn,{modelValue:I(t).config.emitterFollowCurve,"onUpdate:modelValue":B[55]||(B[55]=L=>I(t).config.emitterFollowCurve=L),"default-value":I(O)},null,8,["modelValue","default-value"]),T("div",zU,[T("label",qU,[B[140]||(B[140]=T("span",null,"移动时长 (s)",-1)),ce(T("input",{"onUpdate:modelValue":B[56]||(B[56]=L=>I(t).config.emitterFollowDuration=L),type:"number",min:"0.05",step:"0.05",class:"inp"},null,512),[[He,I(t).config.emitterFollowDuration,void 0,{number:!0}]])]),T("label",KU,[B[142]||(B[142]=T("span",null,"跟随空间",-1)),ce(T("select",{"onUpdate:modelValue":B[57]||(B[57]=L=>I(t).config.emitterFollowSpace=L),class:"inp"},[...B[141]||(B[141]=[T("option",{value:"local"},"局部空间(GEN 移动)",-1),T("option",{value:"world"},"世界空间(粒子生成点移动)",-1)])],512),[[bt,I(t).config.emitterFollowSpace]])])]),T("label",ZU,[B[144]||(B[144]=T("span",null,"移动方向",-1)),ce(T("select",{"onUpdate:modelValue":B[58]||(B[58]=L=>I(t).config.emitterFollowDirection=L),class:"inp"},[...B[143]||(B[143]=[T("option",{value:"forward"},"正向(起点 → 终点)",-1),T("option",{value:"reverse"},"反向(终点 → 起点)",-1)])],512),[[bt,I(t).config.emitterFollowDirection]])]),we(Oe,{label:"偏移起始点 (0-1)",min:0,max:1,step:.01,modelValue:I(t).config.emitterFollowOffset,"onUpdate:modelValue":B[59]||(B[59]=L=>I(t).config.emitterFollowOffset=L)},null,8,["modelValue"]),B[146]||(B[146]=T("div",{class:"modifier-hint"},"局部空间会移动整个发射器;世界空间只移动新粒子的生成点,已出生粒子留在世界位置。",-1))],64)):I(t).config.emitterFollowMode==="bone"?(q(),J(_e,{key:1},[I(x)?(q(),J("div",JU,[B[147]||(B[147]=ft("跟随目标:",-1)),T("strong",null,ve(I(x).spine.name)+" / "+ve(I(x).boneName),1)])):(q(),J("div",QU,"尚未绑定有效骨骼,请先在 Spine 层级树中选择骨骼。")),I(g)&&(!I(x)||I(g).spine.id!==I(x).spine.id||I(g).boneName!==I(x).boneName)?(q(),J("button",{key:2,class:"bone-follow-rebind",onClick:B[60]||(B[60]=L=>I(P)(I(t).config))},ve(I(x)?"重新绑定":"绑定")+"当前选中骨骼:"+ve(I(g).spine.name)+" / "+ve(I(g).boneName),1)):xe("",!0),I(x)?(q(),J(_e,{key:3},[T("label",e$,[B[149]||(B[149]=T("span",null,"跟随空间",-1)),ce(T("select",{"onUpdate:modelValue":B[61]||(B[61]=L=>I(t).config.emitterFollowSpace=L),class:"inp"},[...B[148]||(B[148]=[T("option",{value:"local"},"本地空间(随骨骼移动)",-1),T("option",{value:"world"},"世界空间(粒子生成后保持位置)",-1)])],512),[[bt,I(t).config.emitterFollowSpace]])]),T("div",t$,[T("label",i$,[B[150]||(B[150]=T("span",null,"位移偏移 X",-1)),ce(T("input",{"onUpdate:modelValue":B[62]||(B[62]=L=>I(t).config.emitterFollowBoneOffsetX=L),type:"number",step:"1",class:"inp"},null,512),[[He,I(t).config.emitterFollowBoneOffsetX,void 0,{number:!0}]])]),T("label",s$,[B[151]||(B[151]=T("span",null,"位移偏移 Y",-1)),ce(T("input",{"onUpdate:modelValue":B[63]||(B[63]=L=>I(t).config.emitterFollowBoneOffsetY=L),type:"number",step:"1",class:"inp"},null,512),[[He,I(t).config.emitterFollowBoneOffsetY,void 0,{number:!0}]])])]),T("div",n$,[T("label",r$,[B[152]||(B[152]=T("span",null,"旋转偏移",-1)),ce(T("input",{"onUpdate:modelValue":B[64]||(B[64]=L=>I(t).config.emitterFollowBoneRotation=L),type:"number",step:"1",class:"inp"},null,512),[[He,I(t).config.emitterFollowBoneRotation,void 0,{number:!0}]])]),T("label",o$,[B[153]||(B[153]=T("span",null,"缩放偏移 X",-1)),ce(T("input",{"onUpdate:modelValue":B[65]||(B[65]=L=>I(t).config.emitterFollowBoneScaleX=L),type:"number",step:"0.05",class:"inp"},null,512),[[He,I(t).config.emitterFollowBoneScaleX,void 0,{number:!0}]])]),T("label",a$,[B[154]||(B[154]=T("span",null,"缩放偏移 Y",-1)),ce(T("input",{"onUpdate:modelValue":B[66]||(B[66]=L=>I(t).config.emitterFollowBoneScaleY=L),type:"number",step:"0.05",class:"inp"},null,512),[[He,I(t).config.emitterFollowBoneScaleY,void 0,{number:!0}]])])]),B[155]||(B[155]=T("div",{class:"modifier-hint"},"发射器只跟随所选 Spine 骨骼的位置,不继承 Spine 的旋转或缩放;粒子变换使用粒子系统自身参数和上方偏移。",-1))],64)):xe("",!0)],64)):xe("",!0)])):xe("",!0)]),T("div",l$,[T("label",c$,[ce(T("input",{type:"checkbox","onUpdate:modelValue":B[67]||(B[67]=L=>I(t).config.collision=L)},null,512),[[wt,I(t).config.collision]]),B[156]||(B[156]=T("span",{class:"switch-ui"},null,-1)),B[157]||(B[157]=T("span",null,"开启碰撞",-1))]),I(t).config.collision?(q(),J("div",h$,[B[158]||(B[158]=T("div",{class:"collision-filter-title"},"参与的碰撞对象",-1)),T("div",u$,[(q(!0),J(_e,null,Et(I(y),L=>(q(),J("span",{key:L.id,class:Ce(["collision-filter-tag",{disabled:!L.enabled}]),title:L.enabled?L.name:`${L.name}(碰撞体已禁用)`},[T("span",null,ve(L.name),1),T("button",{type:"button","aria-label":`清除碰撞对象 ${L.name}`,onClick:j=>I(w)(L.id)},"×",8,f$)],10,d$))),128)),T("button",{type:"button",class:Ce(["collision-filter-add",{active:I(v)}]),disabled:I(S).length===0,title:I(S).length?"加入场景碰撞对象":"没有可加入的碰撞对象",onClick:B[68]||(B[68]=L=>v.value=!I(v))},"+",10,m$)]),I(y).length===0?(q(),J("div",p$,"未选择碰撞对象,当前粒子不会发生碰撞")):xe("",!0),I(v)&&I(S).length?(q(),J("div",g$,[(q(!0),J(_e,null,Et(I(S),L=>(q(),J("button",{key:L.id,type:"button",onClick:j=>I(C)(L.id)},[T("span",null,ve(L.name),1),T("small",null,ve(L.enabled?"可用":"已禁用"),1)],8,v$))),128))])):xe("",!0),B[159]||(B[159]=T("div",{class:"modifier-hint"},"只有已加入且启用的场景碰撞对象会参与当前粒子系统的碰撞",-1))])):xe("",!0)]),T("div",y$,[T("label",x$,[ce(T("input",{"onUpdate:modelValue":B[69]||(B[69]=L=>I(t).config.eventEnabled=L),type:"checkbox"},null,512),[[wt,I(t).config.eventEnabled]]),B[160]||(B[160]=T("span",{class:"switch-ui"},null,-1)),B[161]||(B[161]=T("span",null,"开启子发射器",-1))]),I(t).config.eventEnabled?(q(),J("div",b$,[(q(!0),J(_e,null,Et(I(t).config.events,(L,j)=>(q(),J("div",{key:L.id,class:"event-card"},[T("div",w$,[ce(T("select",{"onUpdate:modelValue":ie=>L.event=ie,class:"inp event-select",title:"选择触发时机"},[...B[162]||(B[162]=[T("option",{value:"birth"},"出生",-1),T("option",{value:"death"},"死亡",-1),T("option",{value:"collision"},"碰撞",-1)])],8,S$),[[bt,L.event]]),ce(T("select",{"onUpdate:modelValue":ie=>L.targetSystemId=ie,class:"inp event-target",title:"选择目标粒子系统"},[B[163]||(B[163]=T("option",{value:0},"无(粒子系统)",-1)),(q(!0),J(_e,null,Et(X.value,ie=>(q(),J("option",{key:ie.id,value:ie.id},ve(ie.config.name||`ParticleSystem${ie.id}`),9,T$))),128))],8,M$),[[bt,L.targetSystemId,void 0,{number:!0}]]),T("button",{type:"button",class:"event-remove",title:"删除该子发射器",onClick:ie=>H(j)},"✕",8,_$)]),T("label",C$,[B[164]||(B[164]=T("span",null,"发射概率",-1)),ce(T("input",{"onUpdate:modelValue":ie=>L.probability=ie,type:"number",min:"0",max:"1",step:"0.01",class:"inp"},null,8,E$),[[He,L.probability,void 0,{number:!0}]])]),L.event==="collision"?(q(),J("label",A$,[B[165]||(B[165]=T("span",null,"碰撞次数限制",-1)),T("input",{value:L.collisionLimit??1,type:"number",min:"1",max:"4",step:"1",class:"inp",onInput:ie=>z(L,ie)},null,40,I$)])):xe("",!0),T("div",R$,[B[167]||(B[167]=T("span",null,"继承",-1)),T("button",{type:"button",class:"inherit-trigger",onPointerdown:B[70]||(B[70]=qe(()=>{},["stop"])),onClick:qe(ie=>oe(L,ie),["stop"])},[T("span",k$,ve(V(L)),1),B[166]||(B[166]=T("i",null,"⌄",-1))],40,P$)]),G(L,"color")?(q(),J("label",F$,[B[169]||(B[169]=T("span",null,"颜色继承方式",-1)),ce(T("select",{"onUpdate:modelValue":ie=>L.colorInheritMode=ie,class:"inp"},[...B[168]||(B[168]=[T("option",{value:"add"},"相加",-1),T("option",{value:"replace"},"覆盖",-1)])],8,O$),[[bt,L.colorInheritMode]])])):xe("",!0)]))),128)),T("button",{type:"button",class:"event-add",onClick:me},"+ 新增子发射器")])):xe("",!0)])],512),[[Si,!I(b).mods]])]),(q(),Ct(dx,{to:"body"},[F.value&&N.value?(q(),J("div",{key:0,class:"inherit-menu",style:Ot({left:`${F.value.left}px`,top:`${F.value.top}px`,width:`${F.value.width}px`}),onPointerdown:B[73]||(B[73]=qe(()=>{},["stop"]))},[T("button",{type:"button",class:"inherit-option",onClick:B[71]||(B[71]=L=>Z(N.value))},[T("span",L$,ve(k(N.value).length===0?"✓":""),1),B[170]||(B[170]=ft("无(默认值) ",-1))]),T("button",{type:"button",class:"inherit-option",onClick:B[72]||(B[72]=L=>ne(N.value))},[T("span",B$,ve(k(N.value).length===4?"✓":""),1),B[171]||(B[171]=ft("所有属性 ",-1))]),B[172]||(B[172]=T("div",{class:"inherit-divider"},null,-1)),(q(),J(_e,null,Et(D,L=>T("button",{key:L.key,type:"button",class:"inherit-option",onClick:j=>W(N.value,L.key)},[T("span",D$,ve(G(N.value,L.key)?"✓":""),1),ft(ve(L.label),1)],8,N$)),64))],36)):xe("",!0)]))],64))}}),$$=Jt(U$,[["__scopeId","data-v-affb8652"]]),X$={class:"group"},V$={class:"caret"},Y$={class:"group-body export-settings"},G$={class:"export-field"},j$={class:"export-field"},H$={class:"export-field"},W$={key:0,class:"export-help"},z$={class:"export-fps-row"},q$={class:"export-field export-fps-field"},K$={class:"export-checkbox"},Z$={class:"export-switches"},J$={class:"switch-row export-switch"},Q$={class:"switch-row export-switch"},e6={class:"switch-row export-switch export-switch-last"},t6=Zt({__name:"ExportSettingsSection",setup(s){const{exportSettings:e,collapsed:t,toggle:i,resetModule:n,normalizeExportFps:r,select:o}=Fr();return(a,c)=>(q(),J("div",X$,[T("div",{class:"group-head",onClick:c[1]||(c[1]=l=>I(i)("export"))},[T("span",V$,ve(I(t).export?"▸":"▾"),1),c[11]||(c[11]=T("span",null,"导出设置",-1)),T("button",{class:"group-reset",title:"重置导出设置",onClick:c[0]||(c[0]=qe(l=>I(n)("export"),["stop"]))},"重置")]),ce(T("div",Y$,[T("label",G$,[c[12]||(c[12]=T("span",null,"图片路径 (Spine Images Path)",-1)),ce(T("input",{"onUpdate:modelValue":c[2]||(c[2]=l=>I(e).imagesPath=l),class:"inp export-input",type:"text",placeholder:"./images/"},null,512),[[He,I(e).imagesPath,void 0,{trim:!0}]])]),T("label",j$,[c[14]||(c[14]=T("span",null,"Spine 版本",-1)),ce(T("select",{"onUpdate:modelValue":c[3]||(c[3]=l=>I(e).spineVersion=l),class:"inp export-input"},[...c[13]||(c[13]=[is('<option value="3.8" data-v-04462c7a>Spine 3.8</option><option value="4.0" data-v-04462c7a>Spine 4.0</option><option value="4.1" data-v-04462c7a>Spine 4.1</option><option value="4.2" data-v-04462c7a>Spine 4.2</option><option value="4.3" data-v-04462c7a>Spine 4.3</option>',5)])],512),[[bt,I(e).spineVersion]])]),T("label",H$,[c[16]||(c[16]=T("span",null,"关键帧插值曲线",-1)),ce(T("select",{"onUpdate:modelValue":c[4]||(c[4]=l=>I(e).keyframeCurve=l),class:"inp export-input"},[...c[15]||(c[15]=[T("option",{value:"linear"},"线性 (Linear)",-1),T("option",{value:"bezier"},"平滑贝塞尔 (Smooth Bézier)",-1)])],512),[[bt,I(e).keyframeCurve]])]),c[25]||(c[25]=T("div",{class:"export-help"},"平滑贝塞尔会在误差允许范围内拟合连续运动;出生、死亡、附件切换和突变仍使用阶跃关键帧。",-1)),I(e).spineVersion==="3.8"?(q(),J("div",W$,"Spine 3.8 不支持 4.x 的逐通道数组贝塞尔,导出时会转换为经过容差精简的分段线性关键帧。")):xe("",!0),T("div",z$,[T("label",q$,[c[17]||(c[17]=T("span",null,"导出 FPS",-1)),ce(T("input",{"onUpdate:modelValue":c[5]||(c[5]=l=>I(e).fps=l),class:"inp export-input",type:"number",min:"1",max:"240",step:"1",onChange:c[6]||(c[6]=(...l)=>I(r)&&I(r)(...l))},null,544),[[He,I(e).fps,void 0,{number:!0}]])]),T("label",K$,[ce(T("input",{"onUpdate:modelValue":c[7]||(c[7]=l=>I(e).omitFps=l),type:"checkbox"},null,512),[[wt,I(e).omitFps]]),c[18]||(c[18]=ft("不写 fps",-1))])]),c[26]||(c[26]=T("div",{class:"export-help"},"修改 FPS 时保持动画实际秒数不变;“不写 fps”只省略 Spine 的 fps 元数据。",-1)),T("div",Z$,[T("label",J$,[ce(T("input",{"onUpdate:modelValue":c[8]||(c[8]=l=>I(e).integerFrameAlignment=l),type:"checkbox"},null,512),[[wt,I(e).integerFrameAlignment]]),c[19]||(c[19]=T("span",{class:"switch-ui"},null,-1)),c[20]||(c[20]=T("span",null,"整数帧对齐",-1))]),T("label",Q$,[ce(T("input",{"onUpdate:modelValue":c[9]||(c[9]=l=>I(e).bonePool=l),type:"checkbox"},null,512),[[wt,I(e).bonePool]]),c[21]||(c[21]=T("span",{class:"switch-ui"},null,-1)),c[22]||(c[22]=T("span",null,"骨骼对象池",-1))]),T("label",e6,[ce(T("input",{"onUpdate:modelValue":c[10]||(c[10]=l=>I(e).excludeEmptyAnimations=l),type:"checkbox"},null,512),[[wt,I(e).excludeEmptyAnimations]]),c[23]||(c[23]=T("span",{class:"switch-ui"},null,-1)),c[24]||(c[24]=T("span",null,"排除无内容动画",-1))])])],512),[[Si,!I(t).export]])]))}}),i6=Jt(t6,[["__scopeId","data-v-04462c7a"]]),s6={class:"spine-export-actions"},n6=["disabled","title"],r6=["disabled"],o6=["disabled","title"],a6={key:0},l6=["href"],c6=["href"],h6=Zt({__name:"ParticleExportFooter",setup(s){const{exportSettings:e,exportBusy:t,exportTarget:i,exportMessage:n,exportError:r,connectorPairUrl:o,connectorStatusText:a,connectorStatusClass:c,connectorReady:l,connectorAuthorizationUrl:h,connectorDisabledReason:u,connectorButtonTitle:d,refreshConnectorHealth:f,exportSpineJson:m,exportSpineProject:p,exportSpineImages:g}=Fr();return(x,v)=>(q(),J(_e,null,[T("div",s6,[T("button",{type:"button",class:"export-spine-json",disabled:I(t),title:I(t)?"正在重新计算并烘焙动画":`导出 Spine ${I(e).spineVersion} JSON`,onClick:v[0]||(v[0]=(...y)=>I(m)&&I(m)(...y))},ve(I(t)&&I(i)==="json"?"正在准备导出…":"导出Spine Json"),9,n6),T("button",{type:"button",class:"export-spine-images",disabled:I(t),title:"单独下载当前粒子系统使用的图片 ZIP",onClick:v[1]||(v[1]=(...y)=>I(g)&&I(g)(...y))},ve(I(t)&&I(i)==="images"?"正在整理图片…":"导出 images 包"),9,r6),T("button",{type:"button",class:"export-spine-project",disabled:I(t)||!I(l),title:I(d),onClick:v[2]||(v[2]=(...y)=>I(p)&&I(p)(...y))},[T("span",null,ve(I(t)&&I(i)==="spine"?"正在生成工程…":"导出 .spine 包"),1),!I(t)&&I(u)?(q(),J("small",a6,ve(I(u)),1)):xe("",!0)],8,o6)]),T("div",{class:Ce(["connector-status",I(c)])},[v[5]||(v[5]=T("span",{class:"connector-dot"},null,-1)),ft(ve(I(a))+" ",1),I(h)?(q(),J("a",{key:0,href:I(h),target:"_blank",rel:"noopener",title:"在本机连接器中授权当前网站"},"授权当前网站",8,l6)):xe("",!0),T("button",{type:"button",title:"重新检测连接器",onClick:v[3]||(v[3]=(...y)=>I(f)&&I(f)(...y))},"刷新")],2),I(n)?(q(),J("div",{key:0,class:Ce(["export-message",{error:I(r)}])},[ft(ve(I(n))+" ",1),I(o)?(q(),J("a",{key:0,href:I(o),target:"_blank",rel:"noopener",onClick:v[4]||(v[4]=y=>o.value="")},"授权当前网站",8,c6)):xe("",!0)],2)):xe("",!0)],64))}}),u6=Jt(h6,[["__scopeId","data-v-7ff40afe"]]),d6={class:"panel"},f6={class:"panel-scroll"},m6=Zt({__name:"ParticlePanel",setup(s){const{activeObjectType:e,sys:t}=RL();return(i,n)=>(q(),J("div",d6,[n[0]||(n[0]=T("div",{class:"panel-header"},[T("span",null,"Spine粒子编辑器-Yeomai")],-1)),T("div",f6,[we(UL),we(MD),I(e)==="particle"&&I(t)?(q(),J(_e,{key:0},[we(h4),we(F4),we(R8),we($$),we(i6)],64)):xe("",!0)]),we(u6)]))}}),p6=Jt(m6,[["__scopeId","data-v-283ef8eb"]]),Fo=s=>Math.max(0,Number(s)||0);function g6(s,e){const t=Math.max(1,e),i=new Map(s.map(v=>[v.id,v])),n=new Set;for(const v of s)if(v.config.eventEnabled)for(const y of v.config.events||[])y.targetSystemId>0&&y.targetSystemId!==v.id&&i.has(y.targetSystemId)&&n.add(y.targetSystemId);const r=new Map;for(const v of s)if(v.config.eventEnabled)for(const y of v.config.events||[]){if(y.targetSystemId<=0||y.targetSystemId===v.id||!i.has(y.targetSystemId))continue;const S=r.get(y.targetSystemId);S?S.push({parent:v,rule:y}):r.set(y.targetSystemId,[{parent:v,rule:y}])}const o=v=>Fo(v.delay),a=v=>Fo(v.delay),c=v=>{const y=o(v);return v.mode!=="stream"?y:v.streamBehavior==="loop"?y+Ps(v,t).total/t:y+Math.max(1/t,Number(v.duration)||0)},l=v=>{const y=Fo(v.lifeMin),S=Fo(v.lifeMax);return v.lifeMode==="fixed"?y:Math.min(y,S)},h=v=>{const y=Fo(v.lifeMin),S=Fo(v.lifeMax);return v.lifeMode==="fixed"?y:Math.max(y,S)},u=new Map,d=new Map,f=new Set,m=new Set,p=v=>{const y=u.get(v.id);if(y!=null)return y;if(f.has(v.id))return o(v.config);f.add(v.id);let S=1/0;for(const{parent:C,rule:w}of r.get(v.id)||[]){const b=n.has(C.id)?p(C)+a(C.config):o(C.config),_=w.event==="death"?l(C.config):0;S=Math.min(S,b+_)}return Number.isFinite(S)||(S=o(v.config)),f.delete(v.id),u.set(v.id,S),S},g=v=>{const y=d.get(v.id);if(y!=null)return y;if(m.has(v.id))return c(v.config);m.add(v.id);let S=-1/0;for(const{parent:C,rule:w}of r.get(v.id)||[]){const b=n.has(C.id)?g(C)+a(C.config):c(C.config),_=w.event==="birth"?0:h(C.config);S=Math.max(S,b+_)}return Number.isFinite(S)||(S=c(v.config)),m.delete(v.id),d.set(v.id,S),S},x=new Map;for(const v of n){const y=i.get(v);if(!y)continue;const S=p(y),C=g(y);x.set(v,{firstTrigger:S,lastTrigger:C,end:Math.max(S,C)+h(y.config)})}return x}const v6={class:"timeline"},y6={class:"tl-controls"},x6=["title"],b6={class:"tl-ab-loop"},w6={class:"tl-range",title:"自定义播放起始帧"},S6=["max","onKeydown"],M6={class:"tl-range",title:"自定义播放结束帧"},T6=["min","max","onKeydown"],_6={class:"tl-frame"},C6=["disabled"],E6=["onClick"],A6={key:0},I6={class:"tl-animation-editor"},R6={key:0,class:"tl-animation-error"},P6={class:"tl-animation-actions"},k6=["disabled"],F6={key:1,class:"tl-animation-hint"},O6={class:"tl-anim tl-spine-preview"},L6=["value","disabled"],B6={value:""},N6=["value"],D6={class:"tl-zoom"},U6={class:"tl-ticks"},$6={class:"tl-ticklabel"},X6={class:"tl-lanes"},V6=["onPointerdown"],Y6={class:"lane-name"},G6=["onPointerdown"],j6=["onPointerdown"],H6=["onPointerdown"],W6={class:"lane-name"},z6={key:0,class:"tl-empty"},q6=Zt({__name:"Timeline",setup(s){const e=yo(),t=Fe(null),i=Fe(null),n=Fe(!1),r=Fe("animation"),o=Fe("");Lo(()=>{(!Array.isArray(e.timeline.animations)||!e.timeline.animations.length)&&(e.timeline.animations=["animation"]),e.timeline.animations.includes(e.timeline.animation)||(e.timeline.animation=e.timeline.animations[0]);for(const L of e.systems)(!L.animation||!e.timeline.animations.includes(L.animation))&&(L.animation=e.timeline.animations[0])});const a=Le(()=>e.systems.find(L=>L.id===e.activeId)||null);function c(){a.value&&(n.value=!n.value,r.value=a.value.animation,o.value="")}function l(L){const j=a.value;j&&(e.setSystemAnimation(j.id,L),r.value=L,o.value="")}function h(){const L=e.addAnimation();r.value=L,o.value=""}function u(){var ie;const L=((ie=a.value)==null?void 0:ie.animation)||e.timeline.animation,j=r.value.trim();if(!j){o.value="动画名称不能为空";return}if(j!==L&&e.timeline.animations.includes(j)){o.value="动画名称不能重复";return}if(!e.renameAnimation(L,j)){o.value="无法修改动画名称";return}r.value=j,o.value=""}function d(){var ie,ue;const L=((ie=a.value)==null?void 0:ie.animation)||e.timeline.animation;if(!e.removeAnimation(L)){o.value="至少需要保留一个动画";return}const j=((ue=a.value)==null?void 0:ue.animation)||e.timeline.animation;r.value=j,o.value=""}function f(L){var j;(j=i.value)!=null&&j.contains(L.target)||(n.value=!1)}ys(()=>document.addEventListener("pointerdown",f)),Rr(()=>document.removeEventListener("pointerdown",f));const m=Le(()=>Math.max(1,e.timeline.fps||30)),p=Fe(Math.max(120,e.timeline.totalFrames)),g=Fe({}),x=Fe({}),v=Fe({}),y=Fe({}),S=Fe(String(e.timeline.playbackStart)),C=Fe(String(e.timeline.playbackEnd));ai(()=>e.timeline.playbackStart,L=>{S.value=String(L)}),ai(()=>e.timeline.playbackEnd,L=>{C.value=String(L)});const w=Le(()=>e.timeline.totalFrames);ai(w,L=>{L>p.value&&(p.value=Math.min(2e3,L))});const b=Le(()=>p.value<=30?"放大":p.value>=300?"缩小":"适中"),_=Le(()=>e.spines.filter(L=>L.selectedAnimation&&L.animations.some(j=>j.name===L.selectedAnimation&&j.duration>0))),A=Le(()=>(e.activeObjectType==="spine"?e.spines.find(j=>j.id===e.activeObjectId&&j.animations.length):null)||e.spines.find(j=>j.animations.length)||null);function P(L){const j=A.value;j&&(j.selectedAnimation=L.target.value,e.recalcTotalFrames(),e.timeline.frame=0)}function E(){e.setPlaybackStart(Number(S.value)),S.value=String(e.timeline.playbackStart)}function R(){e.setPlaybackEnd(Number(C.value)),C.value=String(e.timeline.playbackEnd)}function O(){var j;const L=((j=t.value)==null?void 0:j.clientWidth)||600;return p.value/L}const U=Le(()=>{const L=[],j=p.value;let ie=1;p.value<=10?ie=1:p.value<=50?ie=5:p.value<=200?ie=10:p.value<=500?ie=50:ie=100;for(let ue=0;ue<=j;ue+=ie)L.push({f:ue,px:ue/O()});return L}),Y=Le(()=>e.timeline.frame/O()),$=Le(()=>Sl(e.systems)),X=Le(()=>g6(e.systems,m.value));function D(L){return $.value.has(L.id)}function F(L){var ie;return(D(L)?((ie=X.value.get(L.id))==null?void 0:ie.firstTrigger)??0:0)*m.value/O()+4}function N(L){var ue;const j=L.config;if(D(L)){const fe=((ue=X.value.get(L.id))==null?void 0:ue.firstTrigger)??0,ee=g.value[L.id]??Math.max(0,Number(j.delay)||0);return(fe+ee)*m.value/O()}return(g.value[L.id]??Math.max(0,Number(j.delay)||0))*m.value/O()}function k(L){const j=L.config,ie=Math.max(0,Number(j.lifeMin)||0),ue=Math.max(0,Number(j.lifeMax)||0);return j.lifeMode==="fixed"?ie:Math.max(ie,ue)}function V(L){if(D(L)){const j=X.value.get(L.id),ie=(j==null?void 0:j.firstTrigger)??0,ue=(j==null?void 0:j.end)??ie;return Math.max(0,ue-ie)*m.value/O()}return W(L)}function G(L){if(D(L)||L.config.mode!=="stream")return 0;if(L.config.streamBehavior==="loop"){const ie=L.config;return(v.value[L.id]??Ps(ie,m.value).loop)/O()}return(x.value[L.id]??Math.max(1/m.value,Number(L.config.duration)||1))*m.value/O()}function W(L){if(D(L))return V(L);const j=L.config;return j.mode==="stream"&&j.streamBehavior==="loop"?ne(L)+G(L)+oe(L):G(L)+k(L)*m.value/O()}function Z(L){const j=L.config;return j.mode==="stream"&&j.streamBehavior==="loop"}function ne(L){return Z(L)?Ps(L.config,m.value).start/O():0}function oe(L){return Z(L)?Ps(L.config,m.value).end/O():0}function de(L){var j;return((j=L.animations.find(ie=>ie.name===L.selectedAnimation))==null?void 0:j.duration)||0}function pe(L){return(y.value[L.id]??Math.max(0,Number(L.timeOffset)||0))*m.value/O()}function he(L){return de(L)*m.value/O()}function me(L){const j=L.deltaY<0?.8:1.25;let ie=p.value*j;ie=Math.min(2e3,Math.max(10,ie)),p.value=Math.round(ie)}function H(L){const j=t.value;e.pause();const ie=fe=>{const ee=j.getBoundingClientRect(),Me=Math.floor((fe.clientX-ee.left)/ee.width*p.value);e.timeline.frame=Math.max(0,Math.min(Me,w.value-1))};ie(L);const ue=()=>{window.removeEventListener("pointermove",ie),window.removeEventListener("pointerup",ue)};window.addEventListener("pointermove",ie),window.addEventListener("pointerup",ue)}function z(L,j){L.stopPropagation();const ie=L.clientX,ue=Math.max(0,Number(j.config.delay)||0),fe=O()/m.value,ee=Ne=>{const Ve=(Ne.clientX-ie)*fe,Ze=Math.max(0,Math.min(ue+Ve,600));g.value[j.id]=Math.round(Ze*m.value)/m.value},Me=Ne=>{window.removeEventListener("pointermove",ee),window.removeEventListener("pointerup",be),window.removeEventListener("pointercancel",ge);const Ve=g.value[j.id];delete g.value[j.id],Ne&&Ve!=null&&Ve!==ue&&(j.config.delay=Ve)},be=()=>Me(!0),ge=()=>Me(!1);window.addEventListener("pointermove",ee),window.addEventListener("pointerup",be),window.addEventListener("pointercancel",ge)}function K(L,j){var Je;L.stopPropagation();const ie=Z(j),ue=Math.max(0,Number(j.config.duration)||0),fe=Ps(j.config,m.value).loop,ee=O()/m.value,Me=((Je=L.currentTarget.closest(".lane-bar"))==null?void 0:Je.getBoundingClientRect().left)??L.clientX,be=ne(j);let ge=!1;const Ne=je=>{if(ge=!0,ie){const Ae=Math.min(1800,Math.max(1,Math.round((je.clientX-Me-be)/O())));v.value[j.id]=Ae}else{const Ae=Math.max(1/m.value,Math.min((je.clientX-Me)*ee,600));x.value[j.id]=Math.round(Ae*m.value)/m.value}},Ve=je=>{window.removeEventListener("pointermove",Ne),window.removeEventListener("pointerup",Ze),window.removeEventListener("pointercancel",rt);const Ae=x.value[j.id],Qe=v.value[j.id];delete x.value[j.id],delete v.value[j.id],je&&ge&&ie&&Qe!=null&&Qe!==fe?j.config.loopDurationFrames=Qe:je&&ge&&!ie&&Ae!=null&&Ae!==ue&&(j.config.duration=Ae)},Ze=()=>Ve(!0),rt=()=>Ve(!1);window.addEventListener("pointermove",Ne),window.addEventListener("pointerup",Ze),window.addEventListener("pointercancel",rt)}function B(L,j){L.stopPropagation();const ie=L.clientX,ue=Math.max(0,Number(j.timeOffset)||0),fe=O()/m.value,ee=Ne=>{const Ve=Math.max(0,Math.min(ue+(Ne.clientX-ie)*fe,600));y.value[j.id]=Math.round(Ve*m.value)/m.value},Me=Ne=>{window.removeEventListener("pointermove",ee),window.removeEventListener("pointerup",be),window.removeEventListener("pointercancel",ge);const Ve=y.value[j.id];delete y.value[j.id],Ne&&Ve!=null&&Ve!==ue&&(j.timeOffset=Ve,e.recalcTotalFrames())},be=()=>Me(!0),ge=()=>Me(!1);window.addEventListener("pointermove",ee),window.addEventListener("pointerup",be),window.addEventListener("pointercancel",ge)}return(L,j)=>{var ie,ue,fe;return q(),J("div",v6,[T("div",y6,[T("button",{class:Ce(["tl-btn",{on:I(e).timeline.playing}]),onClick:j[0]||(j[0]=ee=>I(e).togglePlay()),title:I(e).timeline.playing?"暂停 (D)":"播放 (D)"},ve(I(e).timeline.playing?"❚❚":"▶"),11,x6),T("button",{class:"tl-btn",onClick:j[1]||(j[1]=ee=>I(e).toStart()),title:"回到第一帧 (S)"},"⏮"),T("button",{class:"tl-btn",onClick:j[2]||(j[2]=ee=>I(e).previousFrame()),title:"前一帧"},"◀"),T("button",{class:"tl-btn",onClick:j[3]||(j[3]=ee=>I(e).nextFrame()),title:"后一帧"},"▶"),T("button",{class:"tl-btn",onClick:j[4]||(j[4]=ee=>I(e).toEnd()),title:"移动到最后一帧"},"⏭"),T("button",{class:Ce(["tl-btn",{on:I(e).timeline.loop}]),title:"持续循环播放","aria-label":"持续循环播放",onClick:j[5]||(j[5]=ee=>I(e).toggleLoop())},"⟳",2),T("div",b6,[T("button",{class:Ce(["tl-ab-toggle",{on:I(e).timeline.abLoop}]),title:"独立 A/B 区间循环",onClick:j[6]||(j[6]=ee=>I(e).toggleABLoop())},[...j[12]||(j[12]=[T("span",null,"AB 循环",-1),T("i",{class:"tl-switch"},[T("b")],-1)])],2),I(e).timeline.abLoop?(q(),J("div",{key:0,class:"tl-ab-popover",onPointerdown:j[9]||(j[9]=qe(()=>{},["stop"]))},[j[15]||(j[15]=T("div",{class:"tl-ab-title"},"AB 循环区间",-1)),T("label",w6,[j[13]||(j[13]=T("span",null,"A",-1)),ce(T("input",{"onUpdate:modelValue":j[7]||(j[7]=ee=>S.value=ee),type:"number",min:"0",max:Math.max(0,I(e).timeline.playbackEnd-1),"aria-label":"播放起始帧",onChange:E,onKeydown:Mr(qe(E,["prevent"]),["enter"])},null,40,S6),[[He,S.value]])]),T("label",M6,[j[14]||(j[14]=T("span",null,"B",-1)),ce(T("input",{"onUpdate:modelValue":j[8]||(j[8]=ee=>C.value=ee),type:"number",min:I(e).timeline.playbackStart+1,max:Math.max(1,I(e).timeline.totalFrames-1),"aria-label":"播放结束帧",onChange:R,onKeydown:Mr(qe(R,["prevent"]),["enter"])},null,40,T6),[[He,C.value]])])],32)):xe("",!0)]),T("span",_6,[j[16]||(j[16]=ft("帧 ",-1)),T("b",null,ve(I(e).timeline.frame),1),j[17]||(j[17]=ft(" / ",-1)),T("b",null,ve(Math.max(0,I(e).timeline.totalFrames-1)),1)]),j[22]||(j[22]=T("span",{class:"tl-legend"},[T("i",{class:"legend-emission"}),ft("持续发射 "),T("i",{class:"legend-life"}),ft("粒子存在 "),T("i",{class:"legend-spine"}),ft("Spine 动画")],-1)),T("div",{ref_key:"animationMenuRef",ref:i,class:"tl-anim tl-owner-animation"},[j[20]||(j[20]=T("span",null,"所属动画",-1)),T("button",{class:"tl-animation-trigger",disabled:!a.value,title:"设置当前粒子系统所属的动画",onClick:qe(c,["stop"])},[T("span",null,ve(((ie=a.value)==null?void 0:ie.animation)||I(e).timeline.animation),1),j[18]||(j[18]=T("i",null,"⌄",-1))],8,C6),n.value?(q(),J("div",{key:0,class:"tl-animation-menu",onPointerdown:j[11]||(j[11]=qe(()=>{},["stop"]))},[j[19]||(j[19]=T("div",{class:"tl-animation-menu-title"},"选择所属动画",-1)),(q(!0),J(_e,null,Et(I(e).timeline.animations,ee=>{var Me,be;return q(),J("button",{key:ee,class:Ce(["tl-animation-option",{on:((Me=a.value)==null?void 0:Me.animation)===ee}]),onClick:ge=>l(ee)},[T("span",null,ve(ee),1),((be=a.value)==null?void 0:be.animation)===ee?(q(),J("i",A6,"✓")):xe("",!0)],10,E6)}),128)),T("div",I6,[ce(T("input",{"onUpdate:modelValue":j[10]||(j[10]=ee=>r.value=ee),class:"tl-animation-name",maxlength:"64","aria-label":"动画名称",onKeydown:Mr(u,["enter"])},null,544),[[He,r.value]]),T("button",{title:"重命名当前动画",onClick:u},"重命名")]),o.value?(q(),J("div",R6,ve(o.value),1)):xe("",!0),T("div",P6,[T("button",{onClick:h},"+ 新增"),T("button",{disabled:I(e).timeline.animations.length<=1,onClick:d},"删除",8,k6)]),I(e).timeline.animations.length<=1?(q(),J("div",F6,"至少需要保留一个动画")):xe("",!0)],32)):xe("",!0)],512),T("label",O6,[j[21]||(j[21]=ft("Spine 预览动画 ",-1)),T("select",{class:"tl-sel",value:((ue=A.value)==null?void 0:ue.selectedAnimation)||"",disabled:!A.value,onChange:P},[T("option",B6,ve(A.value?"无":"无可用 Spine 动画"),1),(q(!0),J(_e,null,Et(((fe=A.value)==null?void 0:fe.animations)||[],ee=>(q(),J("option",{key:ee.name,value:ee.name},ve(ee.name)+"("+ve(ee.duration.toFixed(2))+"s) ",9,N6))),128))],40,L6)]),T("span",D6,ve(b.value),1)]),T("div",{class:"tl-viewport",ref_key:"vpRef",ref:t,onWheel:qe(me,["prevent"]),onPointerdown:H},[T("div",U6,[(q(!0),J(_e,null,Et(U.value,ee=>(q(),J("div",{key:ee.f,class:"tl-tickline",style:Ot({left:ee.px+"px"})},[T("span",$6,ve(ee.f)+"f",1)],4))),128))]),T("div",{class:"tl-playhead",style:Ot({left:Y.value+"px"})},null,4),T("div",X6,[(q(!0),J(_e,null,Et(I(e).systems,(ee,Me)=>(q(),J("div",{key:ee.id,class:"tl-lane"},[T("span",{class:Ce(["lane-ico",{"sub-lane-ico":D(ee)}]),style:Ot({left:F(ee)+"px"})},"●",6),T("div",{class:Ce(["lane-bar",{"sub-emitter-bar":D(ee)}]),style:Ot({left:N(ee)+"px",width:V(ee)+"px"}),onPointerdown:qe(be=>z(be,ee),["stop"])},[T("span",Y6,ve(ee.config.name||"系统 "+(Me+1)),1),T("span",{class:Ce(["bar-life",{"loop-life":!D(ee)&&Z(ee)}]),style:Ot({width:W(ee)+"px"})},null,6),!D(ee)&&Z(ee)?(q(),J(_e,{key:0},[ne(ee)?(q(),J("span",{key:0,class:"bar-loop-transition bar-loop-start",style:Ot({width:ne(ee)+"px"})},null,4)):xe("",!0),T("span",{class:"bar-emission bar-loop",style:Ot({left:ne(ee)+"px",width:G(ee)+"px"})},[T("span",{class:"bar-handle",title:"拖动循环段时长",onPointerdown:qe(be=>K(be,ee),["stop"])},null,40,G6)],4),oe(ee)?(q(),J("span",{key:1,class:"bar-loop-transition bar-loop-end",style:Ot({left:ne(ee)+G(ee)+"px",width:oe(ee)+"px"})},null,4)):xe("",!0)],64)):!D(ee)&&ee.config.mode==="stream"?(q(),J("span",{key:1,class:"bar-emission",style:Ot({width:G(ee)+"px"})},[T("span",{class:"bar-handle",title:"拖动持续发射时长",onPointerdown:qe(be=>K(be,ee),["stop"])},null,40,j6)],4)):xe("",!0)],46,V6)]))),128)),(q(!0),J(_e,null,Et(_.value,ee=>(q(),J("div",{key:`spine-${ee.id}`,class:"tl-lane spine-lane"},[j[23]||(j[23]=T("span",{class:"lane-ico spine-ico"},"◆",-1)),T("div",{class:"spine-bar",style:Ot({left:pe(ee)+"px",width:he(ee)+"px"}),title:"拖动调整动画开始时间",onPointerdown:qe(Me=>B(Me,ee),["stop"])},[T("span",W6,ve(ee.name)+" · "+ve(ee.selectedAnimation),1)],44,H6)]))),128)),!I(e).systems.length&&!_.value.length?(q(),J("div",z6,"暂无可显示的动画数据")):xe("",!0)])],544)])}}}),K6=Jt(q6,[["__scopeId","data-v-6b4c353d"]]),Z6={class:"transfer-heading"},J6={key:0},Q6={class:"transfer-detail"},eX=Zt({__name:"TransferProgressOverlay",setup(s){const e=Fe(null);return ai(()=>ti.visible,async t=>{var i;t&&(await Kh(),(i=e.value)==null||i.focus({preventScroll:!0}))},{flush:"post"}),(t,i)=>(q(),Ct(u2,{name:"transfer-fade"},{default:Zh(()=>[I(ti).visible?(q(),J("div",{key:0,ref_key:"overlayElement",ref:e,class:"transfer-overlay",role:"dialog","aria-modal":"true","aria-live":"polite",tabindex:"-1",onPointerdown:i[0]||(i[0]=qe(()=>{},["stop","prevent"])),onPointerup:i[1]||(i[1]=qe(()=>{},["stop","prevent"])),onClick:i[2]||(i[2]=qe(()=>{},["stop","prevent"])),onDblclick:i[3]||(i[3]=qe(()=>{},["stop","prevent"])),onContextmenu:i[4]||(i[4]=qe(()=>{},["stop","prevent"])),onWheel:i[5]||(i[5]=qe(()=>{},["stop","prevent"])),onKeydown:i[6]||(i[6]=qe(()=>{},["stop","prevent"]))},[T("div",{class:Ce(["transfer-dialog",{failed:I(ti).failed}])},[T("div",Z6,[T("span",null,ve(I(ti).title),1),I(ti).indeterminate?xe("",!0):(q(),J("strong",J6,ve(Math.round(I(ti).progress))+"%",1))]),T("div",{class:Ce(["transfer-track",{indeterminate:I(ti).indeterminate}])},[T("div",{class:"transfer-bar",style:Ot(I(ti).indeterminate?void 0:{width:`${I(ti).progress}%`})},null,4)],2),T("div",Q6,ve(I(ti).detail),1)],2)],544)):xe("",!0)]),_:1}))}}),tX=Jt(eX,[["__scopeId","data-v-592b922e"]]),iX=["inert","aria-hidden"],sX={class:"right"},nX={class:"stage-area"},rX=Zt({__name:"App",setup(s){const e=yo();NR(e);const t=Fe(360),i=Fe(180);function n(o){o.preventDefault();const a=l=>{const h=e.settings.parameterPanelOnRight?window.innerWidth-l.clientX:l.clientX,u=Math.max(240,Math.min(h,window.innerWidth-200));t.value=u},c=()=>{window.removeEventListener("pointermove",a),window.removeEventListener("pointerup",c)};window.addEventListener("pointermove",a),window.addEventListener("pointerup",c)}function r(o){o.preventDefault();const a=o.clientY,c=i.value,l=u=>{const d=Math.max(80,Math.min(c+(a-u.clientY),window.innerHeight-200));i.value=d},h=()=>{window.removeEventListener("pointermove",l),window.removeEventListener("pointerup",h)};window.addEventListener("pointermove",l),window.addEventListener("pointerup",h)}return(o,a)=>(q(),J(_e,null,[T("div",{class:Ce(["layout",{"panel-right":I(e).settings.parameterPanelOnRight}]),inert:I(ti).visible?!0:void 0,"aria-hidden":I(ti).visible?"true":void 0},[T("div",{class:"parameter-panel",style:Ot({width:t.value+"px"})},[we(p6)],4),T("div",{class:"resizer-col",onPointerdown:n},null,32),T("div",sX,[T("div",nX,[we(M3)]),T("div",{class:"resizer-row",onPointerdown:r,title:"拖动调整时间轴高度"},null,32),T("div",{class:"timeline-area",style:Ot({height:i.value+"px"})},[we(K6)],4)])],10,iX),we(tX)],64))}}),oX=Jt(rX,[["__scopeId","data-v-42c4fa00"]]);U2(oX).use(V2()).mount("#app");export{Sy as $,ln as A,Lh as B,At as C,gi as D,ke as E,Yi as F,fn as G,nt as H,St as I,DS as J,Ni as K,os as L,vs as M,Ar as N,bu as O,an as P,xl as Q,da as R,Rs as S,oO as T,Ge as U,gy as V,Os as W,BV as X,sL as Y,_l as Z,Tp as _,Ke as a,Lm as a$,wy as a0,vS as a1,Lp as a2,OV as a3,Ph as a4,sl as a5,gO as a6,nl as a7,wu as a8,Pm as a9,Ym as aA,Gm as aB,Cc as aC,ur as aD,Xc as aE,km as aF,wS as aG,zt as aH,mS as aI,CV as aJ,oa as aK,by as aL,Ie as aM,Xe as aN,Om as aO,Vc as aP,_S as aQ,Fm as aR,MS as aS,TS as aT,Su as aU,AS as aV,Yc as aW,PS as aX,CS as aY,IS as aZ,kS as a_,wo as aa,Bp as ab,Np as ac,yy as ad,Bl as ae,Nl as af,Ll as ag,bo as ah,Bn as ai,AV as aj,bS as ak,pO as al,ma as am,_r as an,$p as ao,NS as ap,fO as aq,Tl as ar,zi as as,xy as at,PV as au,xa as av,Vm as aw,jm as ax,Hm as ay,Wm as az,ha as b,qn as b$,Oh as b0,ES as b1,kr as b2,RS as b3,Dp as b4,rO as b5,LS as b6,BS as b7,Up as b8,dn as b9,FS as bA,Xp as bB,xu as bC,US as bD,Bm as bE,mi as bF,sO as bG,lO as bH,sS as bI,iS as bJ,IV as bK,Bt as bL,ba as bM,$S as bN,YS as bO,GS as bP,jS as bQ,XS as bR,VS as bS,dO as bT,Vp as bU,_t as bV,Xm as bW,SS as bX,rS as bY,oS as bZ,aS as b_,nO as ba,EV as bb,st as bc,xS as bd,yS as be,pS as bf,gS as bg,co as bh,kh as bi,mO as bj,lS as bk,cS as bl,Xi as bm,hS as bn,fa as bo,_i as bp,nS as bq,Fh as br,uS as bs,dS as bt,fS as bu,My as bv,Um as bw,Jr as bx,OS as by,Dm as bz,ua as c,RV as c0,hO as c1,uO as c2,cO as c3,We as d,$e as e,kV as f,it as g,bi as h,hh as i,Ki as j,$t as k,Ue as l,Ns as m,Ft as n,vp as o,si as p,bl as q,cr as r,Be as s,bb as t,Mp as u,ph as v,Nm as w,Kr as x,vy as y,$m as z};
|