icegl-three-vue-tres/dist/static/vendor-76c85ed2.js
hawk86104 cc7a5a656a Merge branch 'master' into online
# Conflicts:
#	.fes.js
2023-12-04 19:58:17 +08:00

15 lines
1.3 MiB
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

var CL=Object.defineProperty,PL=Object.defineProperties;var RL=Object.getOwnPropertyDescriptors;var Od=Object.getOwnPropertySymbols;var Mx=Object.prototype.hasOwnProperty,Ex=Object.prototype.propertyIsEnumerable;var Sx=(n,e,t)=>e in n?CL(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,Bt=(n,e)=>{for(var t in e||(e={}))Mx.call(e,t)&&Sx(n,t,e[t]);if(Od)for(var t of Od(e))Ex.call(e,t)&&Sx(n,t,e[t]);return n},ii=(n,e)=>PL(n,RL(e));var Id=(n,e)=>{var t={};for(var i in n)Mx.call(n,i)&&e.indexOf(i)<0&&(t[i]=n[i]);if(n!=null&&Od)for(var i of Od(n))e.indexOf(i)<0&&Ex.call(n,i)&&(t[i]=n[i]);return t};function B_(n,e){const t=Object.create(null),i=n.split(",");for(let r=0;r<i.length;r++)t[i[r]]=!0;return e?r=>!!t[r.toLowerCase()]:r=>!!t[r]}const Xt={},tc=[],Er=()=>{},LL=()=>!1,OL=/^on[^a-z]/,em=n=>OL.test(n),z_=n=>n.startsWith("onUpdate:"),Tn=Object.assign,V_=(n,e)=>{const t=n.indexOf(e);t>-1&&n.splice(t,1)},IL=Object.prototype.hasOwnProperty,Tt=(n,e)=>IL.call(n,e),$e=Array.isArray,nc=n=>id(n)==="[object Map]",xT=n=>id(n)==="[object Set]",DL=n=>id(n)==="[object RegExp]",rt=n=>typeof n=="function",tn=n=>typeof n=="string",tm=n=>typeof n=="symbol",Wt=n=>n!==null&&typeof n=="object",H_=n=>(Wt(n)||rt(n))&&rt(n.then)&&rt(n.catch),wT=Object.prototype.toString,id=n=>wT.call(n),UL=n=>id(n).slice(8,-1),ST=n=>id(n)==="[object Object]",G_=n=>tn(n)&&n!=="NaN"&&n[0]!=="-"&&""+parseInt(n,10)===n,rp=B_(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),nm=n=>{const e=Object.create(null);return t=>e[t]||(e[t]=n(t))},NL=/-(\w)/g,Zr=nm(n=>n.replace(NL,(e,t)=>t?t.toUpperCase():"")),FL=/\B([A-Z])/g,Uc=nm(n=>n.replace(FL,"-$1").toLowerCase()),im=nm(n=>n.charAt(0).toUpperCase()+n.slice(1)),yg=nm(n=>n?"on".concat(im(n)):""),Da=(n,e)=>!Object.is(n,e),Vu=(n,e)=>{for(let t=0;t<n.length;t++)n[t](e)},xp=(n,e,t)=>{Object.defineProperty(n,e,{configurable:!0,enumerable:!1,value:t})},kL=n=>{const e=parseFloat(n);return isNaN(e)?n:e},MT=n=>{const e=tn(n)?Number(n):NaN;return isNaN(e)?n:e};let Tx;const e0=()=>Tx||(Tx=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function Fn(n){if($e(n)){const e={};for(let t=0;t<n.length;t++){const i=n[t],r=tn(i)?HL(i):Fn(i);if(r)for(const s in r)e[s]=r[s]}return e}else if(tn(n)||Wt(n))return n}const BL=/;(?![^(]*\))/g,zL=/:([^]+)/,VL=/\/\*[^]*?\*\//g;function HL(n){const e={};return n.replace(VL,"").split(BL).forEach(t=>{if(t){const i=t.split(zL);i.length>1&&(e[i[0].trim()]=i[1].trim())}}),e}function Yt(n){let e="";if(tn(n))e=n;else if($e(n))for(let t=0;t<n.length;t++){const i=Yt(n[t]);i&&(e+=i+" ")}else if(Wt(n))for(const t in n)n[t]&&(e+=t+" ");return e.trim()}function nre(n){if(!n)return null;let{class:e,style:t}=n;return e&&!tn(e)&&(n.class=Yt(e)),t&&(n.style=Fn(t)),n}const GL="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",WL=B_(GL);function ET(n){return!!n||n===""}const $L=n=>tn(n)?n:n==null?"":$e(n)||Wt(n)&&(n.toString===wT||!rt(n.toString))?JSON.stringify(n,TT,2):String(n),TT=(n,e)=>e&&e.__v_isRef?TT(n,e.value):nc(e)?{["Map(".concat(e.size,")")]:[...e.entries()].reduce((t,[i,r])=>(t["".concat(i," =>")]=r,t),{})}:xT(e)?{["Set(".concat(e.size,")")]:[...e.values()]}:Wt(e)&&!$e(e)&&!ST(e)?String(e):e;let Ui;class AT{constructor(e=!1){this.detached=e,this._active=!0,this.effects=[],this.cleanups=[],this.parent=Ui,!e&&Ui&&(this.index=(Ui.scopes||(Ui.scopes=[])).push(this)-1)}get active(){return this._active}run(e){if(this._active){const t=Ui;try{return Ui=this,e()}finally{Ui=t}}}on(){Ui=this}off(){Ui=this.parent}stop(e){if(this._active){let t,i;for(t=0,i=this.effects.length;t<i;t++)this.effects[t].stop();for(t=0,i=this.cleanups.length;t<i;t++)this.cleanups[t]();if(this.scopes)for(t=0,i=this.scopes.length;t<i;t++)this.scopes[t].stop(!0);if(!this.detached&&this.parent&&!e){const r=this.parent.scopes.pop();r&&r!==this&&(this.parent.scopes[this.index]=r,r.index=this.index)}this.parent=void 0,this._active=!1}}}function jL(n){return new AT(n)}function XL(n,e=Ui){e&&e.active&&e.effects.push(n)}function rm(){return Ui}function W_(n){Ui&&Ui.cleanups.push(n)}const $_=n=>{const e=new Set(n);return e.w=0,e.n=0,e},CT=n=>(n.w&Lo)>0,PT=n=>(n.n&Lo)>0,YL=({deps:n})=>{if(n.length)for(let e=0;e<n.length;e++)n[e].w|=Lo},qL=n=>{const{deps:e}=n;if(e.length){let t=0;for(let i=0;i<e.length;i++){const r=e[i];CT(r)&&!PT(r)?r.delete(n):e[t++]=r,r.w&=~Lo,r.n&=~Lo}e.length=t}},wp=new WeakMap;let Uu=0,Lo=1;const t0=30;let wr;const Aa=Symbol(""),n0=Symbol("");class j_{constructor(e,t=null,i){this.fn=e,this.scheduler=t,this.active=!0,this.deps=[],this.parent=void 0,XL(this,i)}run(){if(!this.active)return this.fn();let e=wr,t=So;for(;e;){if(e===this)return;e=e.parent}try{return this.parent=wr,wr=this,So=!0,Lo=1<<++Uu,Uu<=t0?YL(this):Ax(this),this.fn()}finally{Uu<=t0&&qL(this),Lo=1<<--Uu,wr=this.parent,So=t,this.parent=void 0,this.deferStop&&this.stop()}}stop(){wr===this?this.deferStop=!0:this.active&&(Ax(this),this.onStop&&this.onStop(),this.active=!1)}}function Ax(n){const{deps:e}=n;if(e.length){for(let t=0;t<e.length;t++)e[t].delete(n);e.length=0}}let So=!0;const RT=[];function Nc(){RT.push(So),So=!1}function Fc(){const n=RT.pop();So=n===void 0?!0:n}function Mi(n,e,t){if(So&&wr){let i=wp.get(n);i||wp.set(n,i=new Map);let r=i.get(t);r||i.set(t,r=$_()),LT(r)}}function LT(n,e){let t=!1;Uu<=t0?PT(n)||(n.n|=Lo,t=!CT(n)):t=!n.has(wr),t&&(n.add(wr),wr.deps.push(n))}function Cs(n,e,t,i,r,s){const o=wp.get(n);if(!o)return;let a=[];if(e==="clear")a=[...o.values()];else if(t==="length"&&$e(n)){const l=Number(i);o.forEach((c,u)=>{(u==="length"||!tm(u)&&u>=l)&&a.push(c)})}else switch(t!==void 0&&a.push(o.get(t)),e){case"add":$e(n)?G_(t)&&a.push(o.get("length")):(a.push(o.get(Aa)),nc(n)&&a.push(o.get(n0)));break;case"delete":$e(n)||(a.push(o.get(Aa)),nc(n)&&a.push(o.get(n0)));break;case"set":nc(n)&&a.push(o.get(Aa));break}if(a.length===1)a[0]&&i0(a[0]);else{const l=[];for(const c of a)c&&l.push(...c);i0($_(l))}}function i0(n,e){const t=$e(n)?n:[...n];for(const i of t)i.computed&&Cx(i);for(const i of t)i.computed||Cx(i)}function Cx(n,e){(n!==wr||n.allowRecurse)&&(n.scheduler?n.scheduler():n.run())}function KL(n,e){var t;return(t=wp.get(n))==null?void 0:t.get(e)}const ZL=B_("__proto__,__v_isRef,__isVue"),OT=new Set(Object.getOwnPropertyNames(Symbol).filter(n=>n!=="arguments"&&n!=="caller").map(n=>Symbol[n]).filter(tm)),Px=JL();function JL(){const n={};return["includes","indexOf","lastIndexOf"].forEach(e=>{n[e]=function(...t){const i=Et(this);for(let s=0,o=this.length;s<o;s++)Mi(i,"get",s+"");const r=i[e](...t);return r===-1||r===!1?i[e](...t.map(Et)):r}}),["push","pop","shift","unshift","splice"].forEach(e=>{n[e]=function(...t){Nc();const i=Et(this)[e].apply(this,t);return Fc(),i}}),n}function QL(n){const e=Et(this);return Mi(e,"has",n),e.hasOwnProperty(n)}class IT{constructor(e=!1,t=!1){this._isReadonly=e,this._shallow=t}get(e,t,i){const r=this._isReadonly,s=this._shallow;if(t==="__v_isReactive")return!r;if(t==="__v_isReadonly")return r;if(t==="__v_isShallow")return s;if(t==="__v_raw"&&i===(r?s?dO:FT:s?NT:UT).get(e))return e;const o=$e(e);if(!r){if(o&&Tt(Px,t))return Reflect.get(Px,t,i);if(t==="hasOwnProperty")return QL}const a=Reflect.get(e,t,i);return(tm(t)?OT.has(t):ZL(t))||(r||Mi(e,"get",t),s)?a:yn(a)?o&&G_(t)?a:a.value:Wt(a)?r?om(a):ui(a):a}}class DT extends IT{constructor(e=!1){super(!1,e)}set(e,t,i,r){let s=e[t];if(vc(s)&&yn(s)&&!yn(i))return!1;if(!this._shallow&&(!Sp(i)&&!vc(i)&&(s=Et(s),i=Et(i)),!$e(e)&&yn(s)&&!yn(i)))return s.value=i,!0;const o=$e(e)&&G_(t)?Number(t)<e.length:Tt(e,t),a=Reflect.set(e,t,i,r);return e===Et(r)&&(o?Da(i,s)&&Cs(e,"set",t,i):Cs(e,"add",t,i)),a}deleteProperty(e,t){const i=Tt(e,t);e[t];const r=Reflect.deleteProperty(e,t);return r&&i&&Cs(e,"delete",t,void 0),r}has(e,t){const i=Reflect.has(e,t);return(!tm(t)||!OT.has(t))&&Mi(e,"has",t),i}ownKeys(e){return Mi(e,"iterate",$e(e)?"length":Aa),Reflect.ownKeys(e)}}class eO extends IT{constructor(e=!1){super(!0,e)}set(e,t){return!0}deleteProperty(e,t){return!0}}const tO=new DT,nO=new eO,iO=new DT(!0),X_=n=>n,sm=n=>Reflect.getPrototypeOf(n);function Dd(n,e,t=!1,i=!1){n=n.__v_raw;const r=Et(n),s=Et(e);t||(Da(e,s)&&Mi(r,"get",e),Mi(r,"get",s));const{has:o}=sm(r),a=i?X_:t?K_:ch;if(o.call(r,e))return a(n.get(e));if(o.call(r,s))return a(n.get(s));n!==r&&n.get(e)}function Ud(n,e=!1){const t=this.__v_raw,i=Et(t),r=Et(n);return e||(Da(n,r)&&Mi(i,"has",n),Mi(i,"has",r)),n===r?t.has(n):t.has(n)||t.has(r)}function Nd(n,e=!1){return n=n.__v_raw,!e&&Mi(Et(n),"iterate",Aa),Reflect.get(n,"size",n)}function Rx(n){n=Et(n);const e=Et(this);return sm(e).has.call(e,n)||(e.add(n),Cs(e,"add",n,n)),this}function Lx(n,e){e=Et(e);const t=Et(this),{has:i,get:r}=sm(t);let s=i.call(t,n);s||(n=Et(n),s=i.call(t,n));const o=r.call(t,n);return t.set(n,e),s?Da(e,o)&&Cs(t,"set",n,e):Cs(t,"add",n,e),this}function Ox(n){const e=Et(this),{has:t,get:i}=sm(e);let r=t.call(e,n);r||(n=Et(n),r=t.call(e,n)),i&&i.call(e,n);const s=e.delete(n);return r&&Cs(e,"delete",n,void 0),s}function Ix(){const n=Et(this),e=n.size!==0,t=n.clear();return e&&Cs(n,"clear",void 0,void 0),t}function Fd(n,e){return function(i,r){const s=this,o=s.__v_raw,a=Et(o),l=e?X_:n?K_:ch;return!n&&Mi(a,"iterate",Aa),o.forEach((c,u)=>i.call(r,l(c),l(u),s))}}function kd(n,e,t){return function(...i){const r=this.__v_raw,s=Et(r),o=nc(s),a=n==="entries"||n===Symbol.iterator&&o,l=n==="keys"&&o,c=r[n](...i),u=t?X_:e?K_:ch;return!e&&Mi(s,"iterate",l?n0:Aa),{next(){const{value:h,done:d}=c.next();return d?{value:h,done:d}:{value:a?[u(h[0]),u(h[1])]:u(h),done:d}},[Symbol.iterator](){return this}}}}function $s(n){return function(...e){return n==="delete"?!1:this}}function rO(){const n={get(s){return Dd(this,s)},get size(){return Nd(this)},has:Ud,add:Rx,set:Lx,delete:Ox,clear:Ix,forEach:Fd(!1,!1)},e={get(s){return Dd(this,s,!1,!0)},get size(){return Nd(this)},has:Ud,add:Rx,set:Lx,delete:Ox,clear:Ix,forEach:Fd(!1,!0)},t={get(s){return Dd(this,s,!0)},get size(){return Nd(this,!0)},has(s){return Ud.call(this,s,!0)},add:$s("add"),set:$s("set"),delete:$s("delete"),clear:$s("clear"),forEach:Fd(!0,!1)},i={get(s){return Dd(this,s,!0,!0)},get size(){return Nd(this,!0)},has(s){return Ud.call(this,s,!0)},add:$s("add"),set:$s("set"),delete:$s("delete"),clear:$s("clear"),forEach:Fd(!0,!0)};return["keys","values","entries",Symbol.iterator].forEach(s=>{n[s]=kd(s,!1,!1),t[s]=kd(s,!0,!1),e[s]=kd(s,!1,!0),i[s]=kd(s,!0,!0)}),[n,t,e,i]}const[sO,oO,aO,lO]=rO();function Y_(n,e){const t=e?n?lO:aO:n?oO:sO;return(i,r,s)=>r==="__v_isReactive"?!n:r==="__v_isReadonly"?n:r==="__v_raw"?i:Reflect.get(Tt(t,r)&&r in i?t:i,r,s)}const cO={get:Y_(!1,!1)},uO={get:Y_(!1,!0)},hO={get:Y_(!0,!1)},UT=new WeakMap,NT=new WeakMap,FT=new WeakMap,dO=new WeakMap;function fO(n){switch(n){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function pO(n){return n.__v_skip||!Object.isExtensible(n)?0:fO(UL(n))}function ui(n){return vc(n)?n:q_(n,!1,tO,cO,UT)}function kT(n){return q_(n,!1,iO,uO,NT)}function om(n){return q_(n,!0,nO,hO,FT)}function q_(n,e,t,i,r){if(!Wt(n)||n.__v_raw&&!(e&&n.__v_isReactive))return n;const s=r.get(n);if(s)return s;const o=pO(n);if(o===0)return n;const a=new Proxy(n,o===2?i:t);return r.set(n,a),a}function ic(n){return vc(n)?ic(n.__v_raw):!!(n&&n.__v_isReactive)}function vc(n){return!!(n&&n.__v_isReadonly)}function Sp(n){return!!(n&&n.__v_isShallow)}function BT(n){return ic(n)||vc(n)}function Et(n){const e=n&&n.__v_raw;return e?Et(e):n}function zT(n){return xp(n,"__v_skip",!0),n}const ch=n=>Wt(n)?ui(n):n,K_=n=>Wt(n)?om(n):n;function Z_(n){So&&wr&&(n=Et(n),LT(n.dep||(n.dep=$_())))}function J_(n,e){n=Et(n);const t=n.dep;t&&i0(t)}function yn(n){return!!(n&&n.__v_isRef===!0)}function xe(n){return VT(n,!1)}function jn(n){return VT(n,!0)}function VT(n,e){return yn(n)?n:new mO(n,e)}class mO{constructor(e,t){this.__v_isShallow=t,this.dep=void 0,this.__v_isRef=!0,this._rawValue=t?e:Et(e),this._value=t?e:ch(e)}get value(){return Z_(this),this._value}set value(e){const t=this.__v_isShallow||Sp(e)||vc(e);e=t?e:Et(e),Da(e,this._rawValue)&&(this._rawValue=e,this._value=t?e:ch(e),J_(this))}}function Se(n){return yn(n)?n.value:n}const gO={get:(n,e,t)=>Se(Reflect.get(n,e,t)),set:(n,e,t,i)=>{const r=n[e];return yn(r)&&!yn(t)?(r.value=t,!0):Reflect.set(n,e,t,i)}};function HT(n){return ic(n)?n:new Proxy(n,gO)}class vO{constructor(e){this.dep=void 0,this.__v_isRef=!0;const{get:t,set:i}=e(()=>Z_(this),()=>J_(this));this._get=t,this._set=i}get value(){return this._get()}set value(e){this._set(e)}}function _O(n){return new vO(n)}function Or(n){const e=$e(n)?new Array(n.length):{};for(const t in n)e[t]=GT(n,t);return e}class yO{constructor(e,t,i){this._object=e,this._key=t,this._defaultValue=i,this.__v_isRef=!0}get value(){const e=this._object[this._key];return e===void 0?this._defaultValue:e}set value(e){this._object[this._key]=e}get dep(){return KL(Et(this._object),this._key)}}class bO{constructor(e){this._getter=e,this.__v_isRef=!0,this.__v_isReadonly=!0}get value(){return this._getter()}}function Dx(n,e,t){return yn(n)?n:rt(n)?new bO(n):Wt(n)&&arguments.length>1?GT(n,e,t):xe(n)}function GT(n,e,t){const i=n[e];return yn(i)?i:new yO(n,e,t)}class xO{constructor(e,t,i,r){this._setter=t,this.dep=void 0,this.__v_isRef=!0,this.__v_isReadonly=!1,this._dirty=!0,this.effect=new j_(e,()=>{this._dirty||(this._dirty=!0,J_(this))}),this.effect.computed=this,this.effect.active=this._cacheable=!r,this.__v_isReadonly=i}get value(){const e=Et(this);return Z_(e),(e._dirty||!e._cacheable)&&(e._dirty=!1,e._value=e.effect.run()),e._value}set value(e){this._setter(e)}}function wO(n,e,t=!1){let i,r;const s=rt(n);return s?(i=n,r=Er):(i=n.get,r=n.set),new xO(i,r,s||!r,t)}function Mo(n,e,t,i){let r;try{r=i?n(...i):n()}catch(s){rd(s,e,t)}return r}function or(n,e,t,i){if(rt(n)){const s=Mo(n,e,t,i);return s&&H_(s)&&s.catch(o=>{rd(o,e,t)}),s}const r=[];for(let s=0;s<n.length;s++)r.push(or(n[s],e,t,i));return r}function rd(n,e,t,i=!0){const r=e?e.vnode:null;if(e){let s=e.parent;const o=e.proxy,a=t;for(;s;){const c=s.ec;if(c){for(let u=0;u<c.length;u++)if(c[u](n,o,a)===!1)return}s=s.parent}const l=e.appContext.config.errorHandler;if(l){Mo(l,null,10,[n,o,a]);return}}SO(n,t,r,i)}function SO(n,e,t,i=!0){console.error(n)}let uh=!1,r0=!1;const Zn=[];let Wr=0;const rc=[];let ws=null,ga=0;const WT=Promise.resolve();let Q_=null;function Jr(n){const e=Q_||WT;return n?e.then(this?n.bind(this):n):e}function MO(n){let e=Wr+1,t=Zn.length;for(;e<t;){const i=e+t>>>1,r=Zn[i],s=hh(r);s<n||s===n&&r.pre?e=i+1:t=i}return e}function ey(n){(!Zn.length||!Zn.includes(n,uh&&n.allowRecurse?Wr+1:Wr))&&(n.id==null?Zn.push(n):Zn.splice(MO(n.id),0,n),$T())}function $T(){!uh&&!r0&&(r0=!0,Q_=WT.then(XT))}function EO(n){const e=Zn.indexOf(n);e>Wr&&Zn.splice(e,1)}function s0(n){$e(n)?rc.push(...n):(!ws||!ws.includes(n,n.allowRecurse?ga+1:ga))&&rc.push(n),$T()}function Ux(n,e=uh?Wr+1:0){for(;e<Zn.length;e++){const t=Zn[e];t&&t.pre&&(Zn.splice(e,1),e--,t())}}function jT(n){if(rc.length){const e=[...new Set(rc)];if(rc.length=0,ws){ws.push(...e);return}for(ws=e,ws.sort((t,i)=>hh(t)-hh(i)),ga=0;ga<ws.length;ga++)ws[ga]();ws=null,ga=0}}const hh=n=>n.id==null?1/0:n.id,TO=(n,e)=>{const t=hh(n)-hh(e);if(t===0){if(n.pre&&!e.pre)return-1;if(e.pre&&!n.pre)return 1}return t};function XT(n){r0=!1,uh=!0,Zn.sort(TO);const e=Er;try{for(Wr=0;Wr<Zn.length;Wr++){const t=Zn[Wr];t&&t.active!==!1&&Mo(t,null,14)}}finally{Wr=0,Zn.length=0,jT(),uh=!1,Q_=null,(Zn.length||rc.length)&&XT()}}function AO(n,e,...t){if(n.isUnmounted)return;const i=n.vnode.props||Xt;let r=t;const s=e.startsWith("update:"),o=s&&e.slice(7);if(o&&o in i){const u="".concat(o==="modelValue"?"model":o,"Modifiers"),{number:h,trim:d}=i[u]||Xt;d&&(r=t.map(f=>tn(f)?f.trim():f)),h&&(r=t.map(kL))}let a,l=i[a=yg(e)]||i[a=yg(Zr(e))];!l&&s&&(l=i[a=yg(Uc(e))]),l&&or(l,n,6,r);const c=i[a+"Once"];if(c){if(!n.emitted)n.emitted={};else if(n.emitted[a])return;n.emitted[a]=!0,or(c,n,6,r)}}function YT(n,e,t=!1){const i=e.emitsCache,r=i.get(n);if(r!==void 0)return r;const s=n.emits;let o={},a=!1;if(!rt(n)){const l=c=>{const u=YT(c,e,!0);u&&(a=!0,Tn(o,u))};!t&&e.mixins.length&&e.mixins.forEach(l),n.extends&&l(n.extends),n.mixins&&n.mixins.forEach(l)}return!s&&!a?(Wt(n)&&i.set(n,null),null):($e(s)?s.forEach(l=>o[l]=null):Tn(o,s),Wt(n)&&i.set(n,o),o)}function am(n,e){return!n||!em(e)?!1:(e=e.slice(2).replace(/Once$/,""),Tt(n,e[0].toLowerCase()+e.slice(1))||Tt(n,Uc(e))||Tt(n,e))}let $n=null,lm=null;function Mp(n){const e=$n;return $n=n,lm=n&&n.type.__scopeId||null,e}function ire(n){lm=n}function rre(){lm=null}function cm(n,e=$n,t){if(!e||n._n)return n;const i=(...r)=>{i._d&&qx(-1);const s=Mp(e);let o;try{o=n(...r)}finally{Mp(s),i._d&&qx(1)}return o};return i._n=!0,i._c=!0,i._d=!0,i}function bg(n){const{type:e,vnode:t,proxy:i,withProxy:r,props:s,propsOptions:[o],slots:a,attrs:l,emit:c,render:u,renderCache:h,data:d,setupState:f,ctx:p,inheritAttrs:v}=n;let m,g;const b=Mp(n);try{if(t.shapeFlag&4){const y=r||i;m=br(u.call(y,y,h,s,f,d,p)),g=l}else{const y=e;m=br(y.length>1?y(s,{attrs:l,slots:a,emit:c}):y(s,null)),g=e.props?l:PO(l)}}catch(y){$u.length=0,rd(y,n,1),m=ie(li)}let _=m;if(g&&v!==!1){const y=Object.keys(g),{shapeFlag:T}=_;y.length&&T&7&&(o&&y.some(z_)&&(g=RO(g,o)),_=Ar(_,g))}return t.dirs&&(_=Ar(_),_.dirs=_.dirs?_.dirs.concat(t.dirs):t.dirs),t.transition&&(_.transition=t.transition),m=_,Mp(b),m}function CO(n){let e;for(let t=0;t<n.length;t++){const i=n[t];if(Ua(i)){if(i.type!==li||i.children==="v-if"){if(e)return;e=i}}else return}return e}const PO=n=>{let e;for(const t in n)(t==="class"||t==="style"||em(t))&&((e||(e={}))[t]=n[t]);return e},RO=(n,e)=>{const t={};for(const i in n)(!z_(i)||!(i.slice(9)in e))&&(t[i]=n[i]);return t};function LO(n,e,t){const{props:i,children:r,component:s}=n,{props:o,children:a,patchFlag:l}=e,c=s.emitsOptions;if(e.dirs||e.transition)return!0;if(t&&l>=0){if(l&1024)return!0;if(l&16)return i?Nx(i,o,c):!!o;if(l&8){const u=e.dynamicProps;for(let h=0;h<u.length;h++){const d=u[h];if(o[d]!==i[d]&&!am(c,d))return!0}}}else return(r||a)&&(!a||!a.$stable)?!0:i===o?!1:i?o?Nx(i,o,c):!0:!!o;return!1}function Nx(n,e,t){const i=Object.keys(e);if(i.length!==Object.keys(n).length)return!0;for(let r=0;r<i.length;r++){const s=i[r];if(e[s]!==n[s]&&!am(t,s))return!0}return!1}function ty({vnode:n,parent:e},t){for(;e&&e.subTree===n;)(n=e.vnode).el=t,e=e.parent}const ny="components";function Hu(n,e){return KT(ny,n,!0,e)||n}const qT=Symbol.for("v-ndc");function OO(n){return tn(n)?KT(ny,n,!1)||n:n||qT}function KT(n,e,t=!0,i=!1){const r=$n||kn;if(r){const s=r.type;if(n===ny){const a=f0(s,!1);if(a&&(a===e||a===Zr(e)||a===im(Zr(e))))return s}const o=Fx(r[n]||s[n],e)||Fx(r.appContext[n],e);return!o&&i?s:o}}function Fx(n,e){return n&&(n[e]||n[Zr(e)]||n[im(Zr(e))])}const ZT=n=>n.__isSuspense,IO={name:"Suspense",__isSuspense:!0,process(n,e,t,i,r,s,o,a,l,c){n==null?DO(e,t,i,r,s,o,a,l,c):UO(n,e,t,i,r,o,a,l,c)},hydrate:NO,create:iy,normalize:FO},sre=IO;function dh(n,e){const t=n.props&&n.props[e];rt(t)&&t()}function DO(n,e,t,i,r,s,o,a,l){const{p:c,o:{createElement:u}}=l,h=u("div"),d=n.suspense=iy(n,r,i,e,h,t,s,o,a,l);c(null,d.pendingBranch=n.ssContent,h,null,i,d,s,o),d.deps>0?(dh(n,"onPending"),dh(n,"onFallback"),c(null,n.ssFallback,e,t,i,null,s,o),sc(d,n.ssFallback)):d.resolve(!1,!0)}function UO(n,e,t,i,r,s,o,a,{p:l,um:c,o:{createElement:u}}){const h=e.suspense=n.suspense;h.vnode=e,e.el=n.el;const d=e.ssContent,f=e.ssFallback,{activeBranch:p,pendingBranch:v,isInFallback:m,isHydrating:g}=h;if(v)h.pendingBranch=d,Sr(d,v)?(l(v,d,h.hiddenContainer,null,r,h,s,o,a),h.deps<=0?h.resolve():m&&(l(p,f,t,i,r,null,s,o,a),sc(h,f))):(h.pendingId++,g?(h.isHydrating=!1,h.activeBranch=v):c(v,r,h),h.deps=0,h.effects.length=0,h.hiddenContainer=u("div"),m?(l(null,d,h.hiddenContainer,null,r,h,s,o,a),h.deps<=0?h.resolve():(l(p,f,t,i,r,null,s,o,a),sc(h,f))):p&&Sr(d,p)?(l(p,d,t,i,r,h,s,o,a),h.resolve(!0)):(l(null,d,h.hiddenContainer,null,r,h,s,o,a),h.deps<=0&&h.resolve()));else if(p&&Sr(d,p))l(p,d,t,i,r,h,s,o,a),sc(h,d);else if(dh(e,"onPending"),h.pendingBranch=d,h.pendingId++,l(null,d,h.hiddenContainer,null,r,h,s,o,a),h.deps<=0)h.resolve();else{const{timeout:b,pendingId:_}=h;b>0?setTimeout(()=>{h.pendingId===_&&h.fallback(f)},b):b===0&&h.fallback(f)}}function iy(n,e,t,i,r,s,o,a,l,c,u=!1){const{p:h,m:d,um:f,n:p,o:{parentNode:v,remove:m}}=c;let g;const b=BO(n);b&&e!=null&&e.pendingBranch&&(g=e.pendingId,e.deps++);const _=n.props?MT(n.props.timeout):void 0,y={vnode:n,parent:e,parentComponent:t,isSVG:o,container:i,hiddenContainer:r,anchor:s,deps:0,pendingId:0,timeout:typeof _=="number"?_:-1,activeBranch:null,pendingBranch:null,isInFallback:!0,isHydrating:u,isUnmounted:!1,effects:[],resolve(T=!1,S=!1){const{vnode:E,activeBranch:x,pendingBranch:M,pendingId:w,effects:C,parentComponent:L,container:$}=y;let U=!1;if(y.isHydrating)y.isHydrating=!1;else if(!T){U=x&&M.transition&&M.transition.mode==="out-in",U&&(x.transition.afterLeave=()=>{w===y.pendingId&&(d(M,$,j,0),s0(C))});let{anchor:j}=y;x&&(j=p(x),f(x,L,y,!0)),U||d(M,$,j,0)}sc(y,M),y.pendingBranch=null,y.isInFallback=!1;let H=y.parent,V=!1;for(;H;){if(H.pendingBranch){H.effects.push(...C),V=!0;break}H=H.parent}!V&&!U&&s0(C),y.effects=[],b&&e&&e.pendingBranch&&g===e.pendingId&&(e.deps--,e.deps===0&&!S&&e.resolve()),dh(E,"onResolve")},fallback(T){if(!y.pendingBranch)return;const{vnode:S,activeBranch:E,parentComponent:x,container:M,isSVG:w}=y;dh(S,"onFallback");const C=p(E),L=()=>{y.isInFallback&&(h(null,T,M,C,x,null,w,a,l),sc(y,T))},$=T.transition&&T.transition.mode==="out-in";$&&(E.transition.afterLeave=L),y.isInFallback=!0,f(E,x,null,!0),$||L()},move(T,S,E){y.activeBranch&&d(y.activeBranch,T,S,E),y.container=T},next(){return y.activeBranch&&p(y.activeBranch)},registerDep(T,S){const E=!!y.pendingBranch;E&&y.deps++;const x=T.vnode.el;T.asyncDep.catch(M=>{rd(M,T,0)}).then(M=>{if(T.isUnmounted||y.isUnmounted||y.pendingId!==T.suspenseId)return;T.asyncResolved=!0;const{vnode:w}=T;d0(T,M,!1),x&&(w.el=x);const C=!x&&T.subTree.el;S(T,w,v(x||T.subTree.el),x?null:p(T.subTree),y,o,l),C&&m(C),ty(T,w.el),E&&--y.deps===0&&y.resolve()})},unmount(T,S){y.isUnmounted=!0,y.activeBranch&&f(y.activeBranch,t,T,S),y.pendingBranch&&f(y.pendingBranch,t,T,S)}};return y}function NO(n,e,t,i,r,s,o,a,l){const c=e.suspense=iy(e,i,t,n.parentNode,document.createElement("div"),null,r,s,o,a,!0),u=l(n,c.pendingBranch=e.ssContent,t,c,s,o);return c.deps===0&&c.resolve(!1,!0),u}function FO(n){const{shapeFlag:e,children:t}=n,i=e&32;n.ssContent=kx(i?t.default:t),n.ssFallback=i?kx(t.fallback):ie(li)}function kx(n){let e;if(rt(n)){const t=yc&&n._c;t&&(n._d=!1,nt()),n=n(),t&&(n._d=!0,e=ir,gA())}return $e(n)&&(n=CO(n)),n=br(n),e&&!n.dynamicChildren&&(n.dynamicChildren=e.filter(t=>t!==n)),n}function kO(n,e){e&&e.pendingBranch?$e(n)?e.effects.push(...n):e.effects.push(n):s0(n)}function sc(n,e){n.activeBranch=e;const{vnode:t,parentComponent:i}=n,r=t.el=e.el;i&&i.subTree===t&&(i.vnode.el=r,ty(i,r))}function BO(n){var e;return((e=n.props)==null?void 0:e.suspensible)!=null&&n.props.suspensible!==!1}function ar(n,e){return ry(n,null,e)}const Bd={};function ft(n,e,t){return ry(n,e,t)}function ry(n,e,{immediate:t,deep:i,flush:r,onTrack:s,onTrigger:o}=Xt){var a;const l=rm()===((a=kn)==null?void 0:a.scope)?kn:null;let c,u=!1,h=!1;if(yn(n)?(c=()=>n.value,u=Sp(n)):ic(n)?(c=()=>n,i=!0):$e(n)?(h=!0,u=n.some(y=>ic(y)||Sp(y)),c=()=>n.map(y=>{if(yn(y))return y.value;if(ic(y))return ba(y);if(rt(y))return Mo(y,l,2)})):rt(n)?e?c=()=>Mo(n,l,2):c=()=>{if(!(l&&l.isUnmounted))return d&&d(),or(n,l,3,[f])}:c=Er,e&&i){const y=c;c=()=>ba(y())}let d,f=y=>{d=b.onStop=()=>{Mo(y,l,4)}},p;if(mh)if(f=Er,e?t&&or(e,l,3,[c(),h?[]:void 0,f]):c(),r==="sync"){const y=RI();p=y.__watcherHandles||(y.__watcherHandles=[])}else return Er;let v=h?new Array(n.length).fill(Bd):Bd;const m=()=>{if(b.active)if(e){const y=b.run();(i||u||(h?y.some((T,S)=>Da(T,v[S])):Da(y,v)))&&(d&&d(),or(e,l,3,[y,v===Bd?void 0:h&&v[0]===Bd?[]:v,f]),v=y)}else b.run()};m.allowRecurse=!!e;let g;r==="sync"?g=m:r==="post"?g=()=>Vn(m,l&&l.suspense):(m.pre=!0,l&&(m.id=l.uid),g=()=>ey(m));const b=new j_(c,g);e?t?m():v=b.run():r==="post"?Vn(b.run.bind(b),l&&l.suspense):b.run();const _=()=>{b.stop(),l&&l.scope&&V_(l.scope.effects,b)};return p&&p.push(_),_}function zO(n,e,t){const i=this.proxy,r=tn(n)?n.includes(".")?JT(i,n):()=>i[n]:n.bind(i,i);let s;rt(e)?s=e:(s=e.handler,t=e);const o=kn;Oo(this);const a=ry(r,s.bind(i),t);return o?Oo(o):Eo(),a}function JT(n,e){const t=e.split(".");return()=>{let i=n;for(let r=0;r<t.length&&i;r++)i=i[t[r]];return i}}function ba(n,e){if(!Wt(n)||n.__v_skip||(e=e||new Set,e.has(n)))return n;if(e.add(n),yn(n))ba(n.value,e);else if($e(n))for(let t=0;t<n.length;t++)ba(n[t],e);else if(xT(n)||nc(n))n.forEach(t=>{ba(t,e)});else if(ST(n))for(const t in n)ba(n[t],e);return n}function fh(n,e){const t=$n;if(t===null)return n;const i=pm(t)||t.proxy,r=n.dirs||(n.dirs=[]);for(let s=0;s<e.length;s++){let[o,a,l,c=Xt]=e[s];o&&(rt(o)&&(o={mounted:o,updated:o}),o.deep&&ba(a),r.push({dir:o,instance:i,value:a,oldValue:void 0,arg:l,modifiers:c}))}return n}function Yo(n,e,t,i){const r=n.dirs,s=e&&e.dirs;for(let o=0;o<r.length;o++){const a=r[o];s&&(a.oldValue=s[o].value);let l=a.dir[i];l&&(Nc(),or(l,t,8,[n.el,a,n,e]),Fc())}}const fo=Symbol("_leaveCb"),zd=Symbol("_enterCb");function QT(){const n={isMounted:!1,isLeaving:!1,isUnmounting:!1,leavingVNodes:new Map};return bn(()=>{n.isMounted=!0}),Ir(()=>{n.isUnmounting=!0}),n}const ji=[Function,Array],eA={mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:ji,onEnter:ji,onAfterEnter:ji,onEnterCancelled:ji,onBeforeLeave:ji,onLeave:ji,onAfterLeave:ji,onLeaveCancelled:ji,onBeforeAppear:ji,onAppear:ji,onAfterAppear:ji,onAppearCancelled:ji},VO={name:"BaseTransition",props:eA,setup(n,{slots:e}){const t=An(),i=QT();let r;return()=>{const s=e.default&&sy(e.default(),!0);if(!s||!s.length)return;let o=s[0];if(s.length>1){for(const v of s)if(v.type!==li){o=v;break}}const a=Et(n),{mode:l}=a;if(i.isLeaving)return xg(o);const c=Bx(o);if(!c)return xg(o);const u=ph(c,a,i,t);_c(c,u);const h=t.subTree,d=h&&Bx(h);let f=!1;const{getTransitionKey:p}=c.type;if(p){const v=p();r===void 0?r=v:v!==r&&(r=v,f=!0)}if(d&&d.type!==li&&(!Sr(c,d)||f)){const v=ph(d,a,i,t);if(_c(d,v),l==="out-in")return i.isLeaving=!0,v.afterLeave=()=>{i.isLeaving=!1,t.update.active!==!1&&t.update()},xg(o);l==="in-out"&&c.type!==li&&(v.delayLeave=(m,g,b)=>{const _=tA(i,d);_[String(d.key)]=d,m[fo]=()=>{g(),m[fo]=void 0,delete u.delayedLeave},u.delayedLeave=b})}return o}}},HO=VO;function tA(n,e){const{leavingVNodes:t}=n;let i=t.get(e.type);return i||(i=Object.create(null),t.set(e.type,i)),i}function ph(n,e,t,i){const{appear:r,mode:s,persisted:o=!1,onBeforeEnter:a,onEnter:l,onAfterEnter:c,onEnterCancelled:u,onBeforeLeave:h,onLeave:d,onAfterLeave:f,onLeaveCancelled:p,onBeforeAppear:v,onAppear:m,onAfterAppear:g,onAppearCancelled:b}=e,_=String(n.key),y=tA(t,n),T=(x,M)=>{x&&or(x,i,9,M)},S=(x,M)=>{const w=M[1];T(x,M),$e(x)?x.every(C=>C.length<=1)&&w():x.length<=1&&w()},E={mode:s,persisted:o,beforeEnter(x){let M=a;if(!t.isMounted)if(r)M=v||a;else return;x[fo]&&x[fo](!0);const w=y[_];w&&Sr(n,w)&&w.el[fo]&&w.el[fo](),T(M,[x])},enter(x){let M=l,w=c,C=u;if(!t.isMounted)if(r)M=m||l,w=g||c,C=b||u;else return;let L=!1;const $=x[zd]=U=>{L||(L=!0,U?T(C,[x]):T(w,[x]),E.delayedLeave&&E.delayedLeave(),x[zd]=void 0)};M?S(M,[x,$]):$()},leave(x,M){const w=String(n.key);if(x[zd]&&x[zd](!0),t.isUnmounting)return M();T(h,[x]);let C=!1;const L=x[fo]=$=>{C||(C=!0,M(),$?T(p,[x]):T(f,[x]),x[fo]=void 0,y[w]===n&&delete y[w])};y[w]=n,d?S(d,[x,L]):L()},clone(x){return ph(x,e,t,i)}};return E}function xg(n){if(um(n))return n=Ar(n),n.children=null,n}function Bx(n){return um(n)?n.children?n.children[0]:void 0:n}function _c(n,e){n.shapeFlag&6&&n.component?_c(n.component.subTree,e):n.shapeFlag&128?(n.ssContent.transition=e.clone(n.ssContent),n.ssFallback.transition=e.clone(n.ssFallback)):n.transition=e}function sy(n,e=!1,t){let i=[],r=0;for(let s=0;s<n.length;s++){let o=n[s];const a=t==null?o.key:String(t)+String(o.key!=null?o.key:s);o.type===en?(o.patchFlag&128&&r++,i=i.concat(sy(o.children,e,a))):(e||o.type!==li)&&i.push(a!=null?Ar(o,{key:a}):o)}if(r>1)for(let s=0;s<i.length;s++)i[s].patchFlag=-2;return i}/*! #__NO_SIDE_EFFECTS__ */function Xe(n,e){return rt(n)?(()=>Tn({name:n.name},e,{setup:n}))():n}const oc=n=>!!n.type.__asyncLoader,um=n=>n.type.__isKeepAlive,GO={name:"KeepAlive",__isKeepAlive:!0,props:{include:[String,RegExp,Array],exclude:[String,RegExp,Array],max:[String,Number]},setup(n,{slots:e}){const t=An(),i=t.ctx;if(!i.renderer)return()=>{const b=e.default&&e.default();return b&&b.length===1?b[0]:b};const r=new Map,s=new Set;let o=null;const a=t.suspense,{renderer:{p:l,m:c,um:u,o:{createElement:h}}}=i,d=h("div");i.activate=(b,_,y,T,S)=>{const E=b.component;c(b,_,y,0,a),l(E.vnode,b,_,y,E,a,T,b.slotScopeIds,S),Vn(()=>{E.isDeactivated=!1,E.a&&Vu(E.a);const x=b.props&&b.props.onVnodeMounted;x&&Zi(x,E.parent,b)},a)},i.deactivate=b=>{const _=b.component;c(b,d,null,1,a),Vn(()=>{_.da&&Vu(_.da);const y=b.props&&b.props.onVnodeUnmounted;y&&Zi(y,_.parent,b),_.isDeactivated=!0},a)};function f(b){wg(b),u(b,t,a,!0)}function p(b){r.forEach((_,y)=>{const T=f0(_.type);T&&(!b||!b(T))&&v(y)})}function v(b){const _=r.get(b);!o||!Sr(_,o)?f(_):o&&wg(o),r.delete(b),s.delete(b)}ft(()=>[n.include,n.exclude],([b,_])=>{b&&p(y=>Nu(b,y)),_&&p(y=>!Nu(_,y))},{flush:"post",deep:!0});let m=null;const g=()=>{m!=null&&r.set(m,Sg(t.subTree))};return bn(g),oy(g),Ir(()=>{r.forEach(b=>{const{subTree:_,suspense:y}=t,T=Sg(_);if(b.type===T.type&&b.key===T.key){wg(T);const S=T.component.da;S&&Vn(S,y);return}f(b)})}),()=>{if(m=null,!e.default)return null;const b=e.default(),_=b[0];if(b.length>1)return o=null,b;if(!Ua(_)||!(_.shapeFlag&4)&&!(_.shapeFlag&128))return o=null,_;let y=Sg(_);const T=y.type,S=f0(oc(y)?y.type.__asyncResolved||{}:T),{include:E,exclude:x,max:M}=n;if(E&&(!S||!Nu(E,S))||x&&S&&Nu(x,S))return o=y,_;const w=y.key==null?T:y.key,C=r.get(w);return y.el&&(y=Ar(y),_.shapeFlag&128&&(_.ssContent=y)),m=w,C?(y.el=C.el,y.component=C.component,y.transition&&_c(y,y.transition),y.shapeFlag|=512,s.delete(w),s.add(w)):(s.add(w),M&&s.size>parseInt(M,10)&&v(s.values().next().value)),y.shapeFlag|=256,o=y,ZT(_.type)?_:y}}},WO=GO;function Nu(n,e){return $e(n)?n.some(t=>Nu(t,e)):tn(n)?n.split(",").includes(e):DL(n)?n.test(e):!1}function nA(n,e){iA(n,"a",e)}function $O(n,e){iA(n,"da",e)}function iA(n,e,t=kn){const i=n.__wdc||(n.__wdc=()=>{let r=t;for(;r;){if(r.isDeactivated)return;r=r.parent}return n()});if(hm(e,i,t),t){let r=t.parent;for(;r&&r.parent;)um(r.parent.vnode)&&jO(i,e,t,r),r=r.parent}}function jO(n,e,t,i){const r=hm(e,n,i,!0);Ci(()=>{V_(i[e],r)},t)}function wg(n){n.shapeFlag&=-257,n.shapeFlag&=-513}function Sg(n){return n.shapeFlag&128?n.ssContent:n}function hm(n,e,t=kn,i=!1){if(t){const r=t[n]||(t[n]=[]),s=e.__weh||(e.__weh=(...o)=>{if(t.isUnmounted)return;Nc(),Oo(t);const a=or(e,t,n,o);return Eo(),Fc(),a});return i?r.unshift(s):r.push(s),s}}const zs=n=>(e,t=kn)=>(!mh||n==="sp")&&hm(n,(...i)=>e(...i),t),XO=zs("bm"),bn=zs("m"),YO=zs("bu"),oy=zs("u"),Ir=zs("bum"),Ci=zs("um"),qO=zs("sp"),KO=zs("rtg"),ZO=zs("rtc");function JO(n,e=kn){hm("ec",n,e)}function ore(n,e,t,i){let r;const s=t&&t[i];if($e(n)||tn(n)){r=new Array(n.length);for(let o=0,a=n.length;o<a;o++)r[o]=e(n[o],o,void 0,s&&s[o])}else if(typeof n=="number"){r=new Array(n);for(let o=0;o<n;o++)r[o]=e(o+1,o,void 0,s&&s[o])}else if(Wt(n))if(n[Symbol.iterator])r=Array.from(n,(o,a)=>e(o,a,void 0,s&&s[a]));else{const o=Object.keys(n);r=new Array(o.length);for(let a=0,l=o.length;a<l;a++){const c=o[a];r[a]=e(n[c],c,a,s&&s[a])}}else r=[];return t&&(t[i]=r),r}function Ei(n,e,t={},i,r){if($n.isCE||$n.parent&&oc($n.parent)&&$n.parent.isCE)return e!=="default"&&(t.name=e),ie("slot",t,i&&i());let s=n[e];s&&s._c&&(s._d=!1),nt();const o=s&&rA(s(t)),a=$r(en,{key:t.key||o&&o.key||"_".concat(e)},o||(i?i():[]),o&&n._===1?64:-2);return!r&&a.scopeId&&(a.slotScopeIds=[a.scopeId+"-s"]),s&&s._c&&(s._d=!0),a}function rA(n){return n.some(e=>Ua(e)?!(e.type===li||e.type===en&&!rA(e.children)):!0)?n:null}const o0=n=>n?yA(n)?pm(n)||n.proxy:o0(n.parent):null,Gu=Tn(Object.create(null),{$:n=>n,$el:n=>n.vnode.el,$data:n=>n.data,$props:n=>n.props,$attrs:n=>n.attrs,$slots:n=>n.slots,$refs:n=>n.refs,$parent:n=>o0(n.parent),$root:n=>o0(n.root),$emit:n=>n.emit,$options:n=>ay(n),$forceUpdate:n=>n.f||(n.f=()=>ey(n.update)),$nextTick:n=>n.n||(n.n=Jr.bind(n.proxy)),$watch:n=>zO.bind(n)}),Mg=(n,e)=>n!==Xt&&!n.__isScriptSetup&&Tt(n,e),QO={get({_:n},e){const{ctx:t,setupState:i,data:r,props:s,accessCache:o,type:a,appContext:l}=n;let c;if(e[0]!=="$"){const f=o[e];if(f!==void 0)switch(f){case 1:return i[e];case 2:return r[e];case 4:return t[e];case 3:return s[e]}else{if(Mg(i,e))return o[e]=1,i[e];if(r!==Xt&&Tt(r,e))return o[e]=2,r[e];if((c=n.propsOptions[0])&&Tt(c,e))return o[e]=3,s[e];if(t!==Xt&&Tt(t,e))return o[e]=4,t[e];a0&&(o[e]=0)}}const u=Gu[e];let h,d;if(u)return e==="$attrs"&&Mi(n,"get",e),u(n);if((h=a.__cssModules)&&(h=h[e]))return h;if(t!==Xt&&Tt(t,e))return o[e]=4,t[e];if(d=l.config.globalProperties,Tt(d,e))return d[e]},set({_:n},e,t){const{data:i,setupState:r,ctx:s}=n;return Mg(r,e)?(r[e]=t,!0):i!==Xt&&Tt(i,e)?(i[e]=t,!0):Tt(n.props,e)||e[0]==="$"&&e.slice(1)in n?!1:(s[e]=t,!0)},has({_:{data:n,setupState:e,accessCache:t,ctx:i,appContext:r,propsOptions:s}},o){let a;return!!t[o]||n!==Xt&&Tt(n,o)||Mg(e,o)||(a=s[0])&&Tt(a,o)||Tt(i,o)||Tt(Gu,o)||Tt(r.config.globalProperties,o)},defineProperty(n,e,t){return t.get!=null?n._.accessCache[e]=0:Tt(t,"value")&&this.set(n,e,t.value,null),Reflect.defineProperty(n,e,t)}};function sA(){return oA().slots}function eI(){return oA().attrs}function oA(){const n=An();return n.setupContext||(n.setupContext=xA(n))}function zx(n){return $e(n)?n.reduce((e,t)=>(e[t]=null,e),{}):n}function are(n){const e=An();let t=n();return Eo(),H_(t)&&(t=t.catch(i=>{throw Oo(e),i})),[t,()=>Oo(e)]}let a0=!0;function tI(n){const e=ay(n),t=n.proxy,i=n.ctx;a0=!1,e.beforeCreate&&Vx(e.beforeCreate,n,"bc");const{data:r,computed:s,methods:o,watch:a,provide:l,inject:c,created:u,beforeMount:h,mounted:d,beforeUpdate:f,updated:p,activated:v,deactivated:m,beforeDestroy:g,beforeUnmount:b,destroyed:_,unmounted:y,render:T,renderTracked:S,renderTriggered:E,errorCaptured:x,serverPrefetch:M,expose:w,inheritAttrs:C,components:L,directives:$,filters:U}=e;if(c&&nI(c,i,null),o)for(const j in o){const te=o[j];rt(te)&&(i[j]=te.bind(t))}if(r){const j=r.call(t,t);Wt(j)&&(n.data=ui(j))}if(a0=!0,s)for(const j in s){const te=s[j],Z=rt(te)?te.bind(t,t):rt(te.get)?te.get.bind(t,t):Er,Q=!rt(te)&&rt(te.set)?te.set.bind(t):Er,X=Te({get:Z,set:Q});Object.defineProperty(i,j,{enumerable:!0,configurable:!0,get:()=>X.value,set:re=>X.value=re})}if(a)for(const j in a)aA(a[j],i,t,j);if(l){const j=rt(l)?l.call(t):l;Reflect.ownKeys(j).forEach(te=>{Si(te,j[te])})}u&&Vx(u,n,"c");function V(j,te){$e(te)?te.forEach(Z=>j(Z.bind(t))):te&&j(te.bind(t))}if(V(XO,h),V(bn,d),V(YO,f),V(oy,p),V(nA,v),V($O,m),V(JO,x),V(ZO,S),V(KO,E),V(Ir,b),V(Ci,y),V(qO,M),$e(w))if(w.length){const j=n.exposed||(n.exposed={});w.forEach(te=>{Object.defineProperty(j,te,{get:()=>t[te],set:Z=>t[te]=Z})})}else n.exposed||(n.exposed={});T&&n.render===Er&&(n.render=T),C!=null&&(n.inheritAttrs=C),L&&(n.components=L),$&&(n.directives=$)}function nI(n,e,t=Er){$e(n)&&(n=l0(n));for(const i in n){const r=n[i];let s;Wt(r)?"default"in r?s=Zt(r.from||i,r.default,!0):s=Zt(r.from||i):s=Zt(r),yn(s)?Object.defineProperty(e,i,{enumerable:!0,configurable:!0,get:()=>s.value,set:o=>s.value=o}):e[i]=s}}function Vx(n,e,t){or($e(n)?n.map(i=>i.bind(e.proxy)):n.bind(e.proxy),e,t)}function aA(n,e,t,i){const r=i.includes(".")?JT(t,i):()=>t[i];if(tn(n)){const s=e[n];rt(s)&&ft(r,s)}else if(rt(n))ft(r,n.bind(t));else if(Wt(n))if($e(n))n.forEach(s=>aA(s,e,t,i));else{const s=rt(n.handler)?n.handler.bind(t):e[n.handler];rt(s)&&ft(r,s,n)}}function ay(n){const e=n.type,{mixins:t,extends:i}=e,{mixins:r,optionsCache:s,config:{optionMergeStrategies:o}}=n.appContext,a=s.get(e);let l;return a?l=a:!r.length&&!t&&!i?l=e:(l={},r.length&&r.forEach(c=>Ep(l,c,o,!0)),Ep(l,e,o)),Wt(e)&&s.set(e,l),l}function Ep(n,e,t,i=!1){const{mixins:r,extends:s}=e;s&&Ep(n,s,t,!0),r&&r.forEach(o=>Ep(n,o,t,!0));for(const o in e)if(!(i&&o==="expose")){const a=iI[o]||t&&t[o];n[o]=a?a(n[o],e[o]):e[o]}return n}const iI={data:Hx,props:Gx,emits:Gx,methods:Fu,computed:Fu,beforeCreate:si,created:si,beforeMount:si,mounted:si,beforeUpdate:si,updated:si,beforeDestroy:si,beforeUnmount:si,destroyed:si,unmounted:si,activated:si,deactivated:si,errorCaptured:si,serverPrefetch:si,components:Fu,directives:Fu,watch:sI,provide:Hx,inject:rI};function Hx(n,e){return e?n?function(){return Tn(rt(n)?n.call(this,this):n,rt(e)?e.call(this,this):e)}:e:n}function rI(n,e){return Fu(l0(n),l0(e))}function l0(n){if($e(n)){const e={};for(let t=0;t<n.length;t++)e[n[t]]=n[t];return e}return n}function si(n,e){return n?[...new Set([].concat(n,e))]:e}function Fu(n,e){return n?Tn(Object.create(null),n,e):e}function Gx(n,e){return n?$e(n)&&$e(e)?[...new Set([...n,...e])]:Tn(Object.create(null),zx(n),zx(e!=null?e:{})):e}function sI(n,e){if(!n)return e;if(!e)return n;const t=Tn(Object.create(null),n);for(const i in e)t[i]=si(n[i],e[i]);return t}function lA(){return{app:null,config:{isNativeTag:LL,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 oI=0;function aI(n,e){return function(i,r=null){rt(i)||(i=Tn({},i)),r!=null&&!Wt(r)&&(r=null);const s=lA(),o=new WeakSet;let a=!1;const l=s.app={_uid:oI++,_component:i,_props:r,_container:null,_context:s,_instance:null,version:LI,get config(){return s.config},set config(c){},use(c,...u){return o.has(c)||(c&&rt(c.install)?(o.add(c),c.install(l,...u)):rt(c)&&(o.add(c),c(l,...u))),l},mixin(c){return s.mixins.includes(c)||s.mixins.push(c),l},component(c,u){return u?(s.components[c]=u,l):s.components[c]},directive(c,u){return u?(s.directives[c]=u,l):s.directives[c]},mount(c,u,h){if(!a){const d=ie(i,r);return d.appContext=s,u&&e?e(d,c):n(d,c,h),a=!0,l._container=c,c.__vue_app__=l,pm(d.component)||d.component.proxy}},unmount(){a&&(n(null,l._container),delete l._container.__vue_app__)},provide(c,u){return s.provides[c]=u,l},runWithContext(c){Tp=l;try{return c()}finally{Tp=null}}};return l}}let Tp=null;function Si(n,e){if(kn){let t=kn.provides;const i=kn.parent&&kn.parent.provides;i===t&&(t=kn.provides=Object.create(i)),t[n]=e}}function Zt(n,e,t=!1){const i=kn||$n;if(i||Tp){const r=i?i.parent==null?i.vnode.appContext&&i.vnode.appContext.provides:i.parent.provides:Tp._context.provides;if(r&&n in r)return r[n];if(arguments.length>1)return t&&rt(e)?e.call(i&&i.proxy):e}}function lI(n,e,t,i=!1){const r={},s={};xp(s,fm,1),n.propsDefaults=Object.create(null),cA(n,e,r,s);for(const o in n.propsOptions[0])o in r||(r[o]=void 0);t?n.props=i?r:kT(r):n.type.props?n.props=r:n.props=s,n.attrs=s}function cI(n,e,t,i){const{props:r,attrs:s,vnode:{patchFlag:o}}=n,a=Et(r),[l]=n.propsOptions;let c=!1;if((i||o>0)&&!(o&16)){if(o&8){const u=n.vnode.dynamicProps;for(let h=0;h<u.length;h++){let d=u[h];if(am(n.emitsOptions,d))continue;const f=e[d];if(l)if(Tt(s,d))f!==s[d]&&(s[d]=f,c=!0);else{const p=Zr(d);r[p]=c0(l,a,p,f,n,!1)}else f!==s[d]&&(s[d]=f,c=!0)}}}else{cA(n,e,r,s)&&(c=!0);let u;for(const h in a)(!e||!Tt(e,h)&&((u=Uc(h))===h||!Tt(e,u)))&&(l?t&&(t[h]!==void 0||t[u]!==void 0)&&(r[h]=c0(l,a,h,void 0,n,!0)):delete r[h]);if(s!==a)for(const h in s)(!e||!Tt(e,h))&&(delete s[h],c=!0)}c&&Cs(n,"set","$attrs")}function cA(n,e,t,i){const[r,s]=n.propsOptions;let o=!1,a;if(e)for(let l in e){if(rp(l))continue;const c=e[l];let u;r&&Tt(r,u=Zr(l))?!s||!s.includes(u)?t[u]=c:(a||(a={}))[u]=c:am(n.emitsOptions,l)||(!(l in i)||c!==i[l])&&(i[l]=c,o=!0)}if(s){const l=Et(t),c=a||Xt;for(let u=0;u<s.length;u++){const h=s[u];t[h]=c0(r,l,h,c[h],n,!Tt(c,h))}}return o}function c0(n,e,t,i,r,s){const o=n[t];if(o!=null){const a=Tt(o,"default");if(a&&i===void 0){const l=o.default;if(o.type!==Function&&!o.skipFactory&&rt(l)){const{propsDefaults:c}=r;t in c?i=c[t]:(Oo(r),i=c[t]=l.call(null,e),Eo())}else i=l}o[0]&&(s&&!a?i=!1:o[1]&&(i===""||i===Uc(t))&&(i=!0))}return i}function uA(n,e,t=!1){const i=e.propsCache,r=i.get(n);if(r)return r;const s=n.props,o={},a=[];let l=!1;if(!rt(n)){const u=h=>{l=!0;const[d,f]=uA(h,e,!0);Tn(o,d),f&&a.push(...f)};!t&&e.mixins.length&&e.mixins.forEach(u),n.extends&&u(n.extends),n.mixins&&n.mixins.forEach(u)}if(!s&&!l)return Wt(n)&&i.set(n,tc),tc;if($e(s))for(let u=0;u<s.length;u++){const h=Zr(s[u]);Wx(h)&&(o[h]=Xt)}else if(s)for(const u in s){const h=Zr(u);if(Wx(h)){const d=s[u],f=o[h]=$e(d)||rt(d)?{type:d}:Tn({},d);if(f){const p=Xx(Boolean,f.type),v=Xx(String,f.type);f[0]=p>-1,f[1]=v<0||p<v,(p>-1||Tt(f,"default"))&&a.push(h)}}}const c=[o,a];return Wt(n)&&i.set(n,c),c}function Wx(n){return n[0]!=="$"}function $x(n){const e=n&&n.toString().match(/^\s*(function|class) (\w+)/);return e?e[2]:n===null?"null":""}function jx(n,e){return $x(n)===$x(e)}function Xx(n,e){return $e(e)?e.findIndex(t=>jx(t,n)):rt(e)&&jx(e,n)?0:-1}const hA=n=>n[0]==="_"||n==="$stable",ly=n=>$e(n)?n.map(br):[br(n)],uI=(n,e,t)=>{if(e._n)return e;const i=cm((...r)=>ly(e(...r)),t);return i._c=!1,i},dA=(n,e,t)=>{const i=n._ctx;for(const r in n){if(hA(r))continue;const s=n[r];if(rt(s))e[r]=uI(r,s,i);else if(s!=null){const o=ly(s);e[r]=()=>o}}},fA=(n,e)=>{const t=ly(e);n.slots.default=()=>t},hI=(n,e)=>{if(n.vnode.shapeFlag&32){const t=e._;t?(n.slots=Et(e),xp(e,"_",t)):dA(e,n.slots={})}else n.slots={},e&&fA(n,e);xp(n.slots,fm,1)},dI=(n,e,t)=>{const{vnode:i,slots:r}=n;let s=!0,o=Xt;if(i.shapeFlag&32){const a=e._;a?t&&a===1?s=!1:(Tn(r,e),!t&&a===1&&delete r._):(s=!e.$stable,dA(e,r)),o=e}else e&&(fA(n,e),o={default:1});if(s)for(const a in r)!hA(a)&&o[a]==null&&delete r[a]};function u0(n,e,t,i,r=!1){if($e(n)){n.forEach((d,f)=>u0(d,e&&($e(e)?e[f]:e),t,i,r));return}if(oc(i)&&!r)return;const s=i.shapeFlag&4?pm(i.component)||i.component.proxy:i.el,o=r?null:s,{i:a,r:l}=n,c=e&&e.r,u=a.refs===Xt?a.refs={}:a.refs,h=a.setupState;if(c!=null&&c!==l&&(tn(c)?(u[c]=null,Tt(h,c)&&(h[c]=null)):yn(c)&&(c.value=null)),rt(l))Mo(l,a,12,[o,u]);else{const d=tn(l),f=yn(l);if(d||f){const p=()=>{if(n.f){const v=d?Tt(h,l)?h[l]:u[l]:l.value;r?$e(v)&&V_(v,s):$e(v)?v.includes(s)||v.push(s):d?(u[l]=[s],Tt(h,l)&&(h[l]=u[l])):(l.value=[s],n.k&&(u[n.k]=l.value))}else d?(u[l]=o,Tt(h,l)&&(h[l]=o)):f&&(l.value=o,n.k&&(u[n.k]=o))};o?(p.id=-1,Vn(p,t)):p()}}}const Vn=kO;function pA(n){return fI(n)}function fI(n,e){const t=e0();t.__VUE__=!0;const{insert:i,remove:r,patchProp:s,createElement:o,createText:a,createComment:l,setText:c,setElementText:u,parentNode:h,nextSibling:d,setScopeId:f=Er,insertStaticContent:p}=n,v=(A,R,I,z=null,G=null,ee=null,ae=!1,se=null,ce=!!R.dynamicChildren)=>{if(A===R)return;A&&!Sr(A,R)&&(z=ne(A),re(A,G,ee,!0),A=null),R.patchFlag===-2&&(ce=!1,R.dynamicChildren=null);const{type:le,ref:Me,shapeFlag:F}=R;switch(le){case dm:m(A,R,I,z);break;case li:g(A,R,I,z);break;case Eg:A==null&&b(R,I,z,ae);break;case en:L(A,R,I,z,G,ee,ae,se,ce);break;default:F&1?T(A,R,I,z,G,ee,ae,se,ce):F&6?$(A,R,I,z,G,ee,ae,se,ce):(F&64||F&128)&&le.process(A,R,I,z,G,ee,ae,se,ce,P)}Me!=null&&G&&u0(Me,A&&A.ref,ee,R||A,!R)},m=(A,R,I,z)=>{if(A==null)i(R.el=a(R.children),I,z);else{const G=R.el=A.el;R.children!==A.children&&c(G,R.children)}},g=(A,R,I,z)=>{A==null?i(R.el=l(R.children||""),I,z):R.el=A.el},b=(A,R,I,z)=>{[A.el,A.anchor]=p(A.children,R,I,z,A.el,A.anchor)},_=({el:A,anchor:R},I,z)=>{let G;for(;A&&A!==R;)G=d(A),i(A,I,z),A=G;i(R,I,z)},y=({el:A,anchor:R})=>{let I;for(;A&&A!==R;)I=d(A),r(A),A=I;r(R)},T=(A,R,I,z,G,ee,ae,se,ce)=>{ae=ae||R.type==="svg",A==null?S(R,I,z,G,ee,ae,se,ce):M(A,R,G,ee,ae,se,ce)},S=(A,R,I,z,G,ee,ae,se)=>{let ce,le;const{type:Me,props:F,shapeFlag:O,transition:J,dirs:ge}=A;if(ce=A.el=o(A.type,ee,F&&F.is,F),O&8?u(ce,A.children):O&16&&x(A.children,ce,null,z,G,ee&&Me!=="foreignObject",ae,se),ge&&Yo(A,null,z,"created"),E(ce,A,A.scopeId,ae,z),F){for(const be in F)be!=="value"&&!rp(be)&&s(ce,be,null,F[be],ee,A.children,z,G,De);"value"in F&&s(ce,"value",null,F.value),(le=F.onVnodeBeforeMount)&&Zi(le,z,A)}ge&&Yo(A,null,z,"beforeMount");const de=pI(G,J);de&&J.beforeEnter(ce),i(ce,R,I),((le=F&&F.onVnodeMounted)||de||ge)&&Vn(()=>{le&&Zi(le,z,A),de&&J.enter(ce),ge&&Yo(A,null,z,"mounted")},G)},E=(A,R,I,z,G)=>{if(I&&f(A,I),z)for(let ee=0;ee<z.length;ee++)f(A,z[ee]);if(G){let ee=G.subTree;if(R===ee){const ae=G.vnode;E(A,ae,ae.scopeId,ae.slotScopeIds,G.parent)}}},x=(A,R,I,z,G,ee,ae,se,ce=0)=>{for(let le=ce;le<A.length;le++){const Me=A[le]=se?po(A[le]):br(A[le]);v(null,Me,R,I,z,G,ee,ae,se)}},M=(A,R,I,z,G,ee,ae)=>{const se=R.el=A.el;let{patchFlag:ce,dynamicChildren:le,dirs:Me}=R;ce|=A.patchFlag&16;const F=A.props||Xt,O=R.props||Xt;let J;I&&qo(I,!1),(J=O.onVnodeBeforeUpdate)&&Zi(J,I,R,A),Me&&Yo(R,A,I,"beforeUpdate"),I&&qo(I,!0);const ge=G&&R.type!=="foreignObject";if(le?w(A.dynamicChildren,le,se,I,z,ge,ee):ae||te(A,R,se,null,I,z,ge,ee,!1),ce>0){if(ce&16)C(se,R,F,O,I,z,G);else if(ce&2&&F.class!==O.class&&s(se,"class",null,O.class,G),ce&4&&s(se,"style",F.style,O.style,G),ce&8){const de=R.dynamicProps;for(let be=0;be<de.length;be++){const Ne=de[be],Ae=F[Ne],Fe=O[Ne];(Fe!==Ae||Ne==="value")&&s(se,Ne,Ae,Fe,G,A.children,I,z,De)}}ce&1&&A.children!==R.children&&u(se,R.children)}else!ae&&le==null&&C(se,R,F,O,I,z,G);((J=O.onVnodeUpdated)||Me)&&Vn(()=>{J&&Zi(J,I,R,A),Me&&Yo(R,A,I,"updated")},z)},w=(A,R,I,z,G,ee,ae)=>{for(let se=0;se<R.length;se++){const ce=A[se],le=R[se],Me=ce.el&&(ce.type===en||!Sr(ce,le)||ce.shapeFlag&70)?h(ce.el):I;v(ce,le,Me,null,z,G,ee,ae,!0)}},C=(A,R,I,z,G,ee,ae)=>{if(I!==z){if(I!==Xt)for(const se in I)!rp(se)&&!(se in z)&&s(A,se,I[se],null,ae,R.children,G,ee,De);for(const se in z){if(rp(se))continue;const ce=z[se],le=I[se];ce!==le&&se!=="value"&&s(A,se,le,ce,ae,R.children,G,ee,De)}"value"in z&&s(A,"value",I.value,z.value)}},L=(A,R,I,z,G,ee,ae,se,ce)=>{const le=R.el=A?A.el:a(""),Me=R.anchor=A?A.anchor:a("");let{patchFlag:F,dynamicChildren:O,slotScopeIds:J}=R;J&&(se=se?se.concat(J):J),A==null?(i(le,I,z),i(Me,I,z),x(R.children,I,Me,G,ee,ae,se,ce)):F>0&&F&64&&O&&A.dynamicChildren?(w(A.dynamicChildren,O,I,G,ee,ae,se),(R.key!=null||G&&R===G.subTree)&&cy(A,R,!0)):te(A,R,I,Me,G,ee,ae,se,ce)},$=(A,R,I,z,G,ee,ae,se,ce)=>{R.slotScopeIds=se,A==null?R.shapeFlag&512?G.ctx.activate(R,I,z,ae,ce):U(R,I,z,G,ee,ae,ce):H(A,R,ce)},U=(A,R,I,z,G,ee,ae)=>{const se=A.component=MI(A,z,G);if(um(A)&&(se.ctx.renderer=P),EI(se),se.asyncDep){if(G&&G.registerDep(se,V),!A.el){const ce=se.subTree=ie(li);g(null,ce,R,I)}return}V(se,A,R,I,G,ee,ae)},H=(A,R,I)=>{const z=R.component=A.component;if(LO(A,R,I))if(z.asyncDep&&!z.asyncResolved){j(z,R,I);return}else z.next=R,EO(z.update),z.update();else R.el=A.el,z.vnode=R},V=(A,R,I,z,G,ee,ae)=>{const se=()=>{if(A.isMounted){let{next:Me,bu:F,u:O,parent:J,vnode:ge}=A,de=Me,be;qo(A,!1),Me?(Me.el=ge.el,j(A,Me,ae)):Me=ge,F&&Vu(F),(be=Me.props&&Me.props.onVnodeBeforeUpdate)&&Zi(be,J,Me,ge),qo(A,!0);const Ne=bg(A),Ae=A.subTree;A.subTree=Ne,v(Ae,Ne,h(Ae.el),ne(Ae),A,G,ee),Me.el=Ne.el,de===null&&ty(A,Ne.el),O&&Vn(O,G),(be=Me.props&&Me.props.onVnodeUpdated)&&Vn(()=>Zi(be,J,Me,ge),G)}else{let Me;const{el:F,props:O}=R,{bm:J,m:ge,parent:de}=A,be=oc(R);if(qo(A,!1),J&&Vu(J),!be&&(Me=O&&O.onVnodeBeforeMount)&&Zi(Me,de,R),qo(A,!0),F&&B){const Ne=()=>{A.subTree=bg(A),B(F,A.subTree,A,G,null)};be?R.type.__asyncLoader().then(()=>!A.isUnmounted&&Ne()):Ne()}else{const Ne=A.subTree=bg(A);v(null,Ne,I,z,A,G,ee),R.el=Ne.el}if(ge&&Vn(ge,G),!be&&(Me=O&&O.onVnodeMounted)){const Ne=R;Vn(()=>Zi(Me,de,Ne),G)}(R.shapeFlag&256||de&&oc(de.vnode)&&de.vnode.shapeFlag&256)&&A.a&&Vn(A.a,G),A.isMounted=!0,R=I=z=null}},ce=A.effect=new j_(se,()=>ey(le),A.scope),le=A.update=()=>ce.run();le.id=A.uid,qo(A,!0),le()},j=(A,R,I)=>{R.component=A;const z=A.vnode.props;A.vnode=R,A.next=null,cI(A,R.props,z,I),dI(A,R.children,I),Nc(),Ux(),Fc()},te=(A,R,I,z,G,ee,ae,se,ce=!1)=>{const le=A&&A.children,Me=A?A.shapeFlag:0,F=R.children,{patchFlag:O,shapeFlag:J}=R;if(O>0){if(O&128){Q(le,F,I,z,G,ee,ae,se,ce);return}else if(O&256){Z(le,F,I,z,G,ee,ae,se,ce);return}}J&8?(Me&16&&De(le,G,ee),F!==le&&u(I,F)):Me&16?J&16?Q(le,F,I,z,G,ee,ae,se,ce):De(le,G,ee,!0):(Me&8&&u(I,""),J&16&&x(F,I,z,G,ee,ae,se,ce))},Z=(A,R,I,z,G,ee,ae,se,ce)=>{A=A||tc,R=R||tc;const le=A.length,Me=R.length,F=Math.min(le,Me);let O;for(O=0;O<F;O++){const J=R[O]=ce?po(R[O]):br(R[O]);v(A[O],J,I,null,G,ee,ae,se,ce)}le>Me?De(A,G,ee,!0,!1,F):x(R,I,z,G,ee,ae,se,ce,F)},Q=(A,R,I,z,G,ee,ae,se,ce)=>{let le=0;const Me=R.length;let F=A.length-1,O=Me-1;for(;le<=F&&le<=O;){const J=A[le],ge=R[le]=ce?po(R[le]):br(R[le]);if(Sr(J,ge))v(J,ge,I,null,G,ee,ae,se,ce);else break;le++}for(;le<=F&&le<=O;){const J=A[F],ge=R[O]=ce?po(R[O]):br(R[O]);if(Sr(J,ge))v(J,ge,I,null,G,ee,ae,se,ce);else break;F--,O--}if(le>F){if(le<=O){const J=O+1,ge=J<Me?R[J].el:z;for(;le<=O;)v(null,R[le]=ce?po(R[le]):br(R[le]),I,ge,G,ee,ae,se,ce),le++}}else if(le>O)for(;le<=F;)re(A[le],G,ee,!0),le++;else{const J=le,ge=le,de=new Map;for(le=ge;le<=O;le++){const et=R[le]=ce?po(R[le]):br(R[le]);et.key!=null&&de.set(et.key,le)}let be,Ne=0;const Ae=O-ge+1;let Fe=!1,je=0;const dt=new Array(Ae);for(le=0;le<Ae;le++)dt[le]=0;for(le=J;le<=F;le++){const et=A[le];if(Ne>=Ae){re(et,G,ee,!0);continue}let Y;if(et.key!=null)Y=de.get(et.key);else for(be=ge;be<=O;be++)if(dt[be-ge]===0&&Sr(et,R[be])){Y=be;break}Y===void 0?re(et,G,ee,!0):(dt[Y-ge]=le+1,Y>=je?je=Y:Fe=!0,v(et,R[Y],I,null,G,ee,ae,se,ce),Ne++)}const Le=Fe?mI(dt):tc;for(be=Le.length-1,le=Ae-1;le>=0;le--){const et=ge+le,Y=R[et],fe=et+1<Me?R[et+1].el:z;dt[le]===0?v(null,Y,I,fe,G,ee,ae,se,ce):Fe&&(be<0||le!==Le[be]?X(Y,I,fe,2):be--)}}},X=(A,R,I,z,G=null)=>{const{el:ee,type:ae,transition:se,children:ce,shapeFlag:le}=A;if(le&6){X(A.component.subTree,R,I,z);return}if(le&128){A.suspense.move(R,I,z);return}if(le&64){ae.move(A,R,I,P);return}if(ae===en){i(ee,R,I);for(let F=0;F<ce.length;F++)X(ce[F],R,I,z);i(A.anchor,R,I);return}if(ae===Eg){_(A,R,I);return}if(z!==2&&le&1&&se)if(z===0)se.beforeEnter(ee),i(ee,R,I),Vn(()=>se.enter(ee),G);else{const{leave:F,delayLeave:O,afterLeave:J}=se,ge=()=>i(ee,R,I),de=()=>{F(ee,()=>{ge(),J&&J()})};O?O(ee,ge,de):de()}else i(ee,R,I)},re=(A,R,I,z=!1,G=!1)=>{const{type:ee,props:ae,ref:se,children:ce,dynamicChildren:le,shapeFlag:Me,patchFlag:F,dirs:O}=A;if(se!=null&&u0(se,null,I,A,!0),Me&256){R.ctx.deactivate(A);return}const J=Me&1&&O,ge=!oc(A);let de;if(ge&&(de=ae&&ae.onVnodeBeforeUnmount)&&Zi(de,R,A),Me&6)Re(A.component,I,z);else{if(Me&128){A.suspense.unmount(I,z);return}J&&Yo(A,null,R,"beforeUnmount"),Me&64?A.type.remove(A,R,I,G,P,z):le&&(ee!==en||F>0&&F&64)?De(le,R,I,!1,!0):(ee===en&&F&384||!G&&Me&16)&&De(ce,R,I),z&&W(A)}(ge&&(de=ae&&ae.onVnodeUnmounted)||J)&&Vn(()=>{de&&Zi(de,R,A),J&&Yo(A,null,R,"unmounted")},I)},W=A=>{const{type:R,el:I,anchor:z,transition:G}=A;if(R===en){we(I,z);return}if(R===Eg){y(A);return}const ee=()=>{r(I),G&&!G.persisted&&G.afterLeave&&G.afterLeave()};if(A.shapeFlag&1&&G&&!G.persisted){const{leave:ae,delayLeave:se}=G,ce=()=>ae(I,ee);se?se(A.el,ee,ce):ce()}else ee()},we=(A,R)=>{let I;for(;A!==R;)I=d(A),r(A),A=I;r(R)},Re=(A,R,I)=>{const{bum:z,scope:G,update:ee,subTree:ae,um:se}=A;z&&Vu(z),G.stop(),ee&&(ee.active=!1,re(ae,A,R,I)),se&&Vn(se,R),Vn(()=>{A.isUnmounted=!0},R),R&&R.pendingBranch&&!R.isUnmounted&&A.asyncDep&&!A.asyncResolved&&A.suspenseId===R.pendingId&&(R.deps--,R.deps===0&&R.resolve())},De=(A,R,I,z=!1,G=!1,ee=0)=>{for(let ae=ee;ae<A.length;ae++)re(A[ae],R,I,z,G)},ne=A=>A.shapeFlag&6?ne(A.component.subTree):A.shapeFlag&128?A.suspense.next():d(A.anchor||A.el),q=(A,R,I)=>{A==null?R._vnode&&re(R._vnode,null,null,!0):v(R._vnode||null,A,R,null,null,null,I),Ux(),jT(),R._vnode=A},P={p:v,um:re,m:X,r:W,mt:U,mc:x,pc:te,pbc:w,n:ne,o:n};let N,B;return e&&([N,B]=e(P)),{render:q,hydrate:N,createApp:aI(q,N)}}function qo({effect:n,update:e},t){n.allowRecurse=e.allowRecurse=t}function pI(n,e){return(!n||n&&!n.pendingBranch)&&e&&!e.persisted}function cy(n,e,t=!1){const i=n.children,r=e.children;if($e(i)&&$e(r))for(let s=0;s<i.length;s++){const o=i[s];let a=r[s];a.shapeFlag&1&&!a.dynamicChildren&&((a.patchFlag<=0||a.patchFlag===32)&&(a=r[s]=po(r[s]),a.el=o.el),t||cy(o,a)),a.type===dm&&(a.el=o.el)}}function mI(n){const e=n.slice(),t=[0];let i,r,s,o,a;const l=n.length;for(i=0;i<l;i++){const c=n[i];if(c!==0){if(r=t[t.length-1],n[r]<c){e[i]=r,t.push(i);continue}for(s=0,o=t.length-1;s<o;)a=s+o>>1,n[t[a]]<c?s=a+1:o=a;c<n[t[s]]&&(s>0&&(e[i]=t[s-1]),t[s]=i)}}for(s=t.length,o=t[s-1];s-- >0;)t[s]=o,o=e[o];return t}const gI=n=>n.__isTeleport,Wu=n=>n&&(n.disabled||n.disabled===""),Yx=n=>typeof SVGElement<"u"&&n instanceof SVGElement,h0=(n,e)=>{const t=n&&n.to;return tn(t)?e?e(t):null:t},vI={__isTeleport:!0,process(n,e,t,i,r,s,o,a,l,c){const{mc:u,pc:h,pbc:d,o:{insert:f,querySelector:p,createText:v,createComment:m}}=c,g=Wu(e.props);let{shapeFlag:b,children:_,dynamicChildren:y}=e;if(n==null){const T=e.el=v(""),S=e.anchor=v("");f(T,t,i),f(S,t,i);const E=e.target=h0(e.props,p),x=e.targetAnchor=v("");E&&(f(x,E),o=o||Yx(E));const M=(w,C)=>{b&16&&u(_,w,C,r,s,o,a,l)};g?M(t,S):E&&M(E,x)}else{e.el=n.el;const T=e.anchor=n.anchor,S=e.target=n.target,E=e.targetAnchor=n.targetAnchor,x=Wu(n.props),M=x?t:S,w=x?T:E;if(o=o||Yx(S),y?(d(n.dynamicChildren,y,M,r,s,o,a),cy(n,e,!0)):l||h(n,e,M,w,r,s,o,a,!1),g)x?e.props&&n.props&&e.props.to!==n.props.to&&(e.props.to=n.props.to):Vd(e,t,T,c,1);else if((e.props&&e.props.to)!==(n.props&&n.props.to)){const C=e.target=h0(e.props,p);C&&Vd(e,C,null,c,0)}else x&&Vd(e,S,E,c,1)}mA(e)},remove(n,e,t,i,{um:r,o:{remove:s}},o){const{shapeFlag:a,children:l,anchor:c,targetAnchor:u,target:h,props:d}=n;if(h&&s(u),o&&s(c),a&16){const f=o||!Wu(d);for(let p=0;p<l.length;p++){const v=l[p];r(v,e,t,f,!!v.dynamicChildren)}}},move:Vd,hydrate:_I};function Vd(n,e,t,{o:{insert:i},m:r},s=2){s===0&&i(n.targetAnchor,e,t);const{el:o,anchor:a,shapeFlag:l,children:c,props:u}=n,h=s===2;if(h&&i(o,e,t),(!h||Wu(u))&&l&16)for(let d=0;d<c.length;d++)r(c[d],e,t,2);h&&i(a,e,t)}function _I(n,e,t,i,r,s,{o:{nextSibling:o,parentNode:a,querySelector:l}},c){const u=e.target=h0(e.props,l);if(u){const h=u._lpa||u.firstChild;if(e.shapeFlag&16)if(Wu(e.props))e.anchor=c(o(n),e,a(n),t,i,r,s),e.targetAnchor=h;else{e.anchor=o(n);let d=h;for(;d;)if(d=o(d),d&&d.nodeType===8&&d.data==="teleport anchor"){e.targetAnchor=d,u._lpa=e.targetAnchor&&o(e.targetAnchor);break}c(h,e,u,t,i,r,s)}mA(e)}return e.anchor&&o(e.anchor)}const yI=vI;function mA(n){const e=n.ctx;if(e&&e.ut){let t=n.children[0].el;for(;t&&t!==n.targetAnchor;)t.nodeType===1&&t.setAttribute("data-v-owner",e.uid),t=t.nextSibling;e.ut()}}const en=Symbol.for("v-fgt"),dm=Symbol.for("v-txt"),li=Symbol.for("v-cmt"),Eg=Symbol.for("v-stc"),$u=[];let ir=null;function nt(n=!1){$u.push(ir=n?null:[])}function gA(){$u.pop(),ir=$u[$u.length-1]||null}let yc=1;function qx(n){yc+=n}function vA(n){return n.dynamicChildren=yc>0?ir||tc:null,gA(),yc>0&&ir&&ir.push(n),n}function Mt(n,e,t,i,r,s){return vA(ei(n,e,t,i,r,s,!0))}function $r(n,e,t,i,r){return vA(ie(n,e,t,i,r,!0))}function Ua(n){return n?n.__v_isVNode===!0:!1}function Sr(n,e){return n.type===e.type&&n.key===e.key}const fm="__vInternal",_A=({key:n})=>n!=null?n:null,sp=({ref:n,ref_key:e,ref_for:t})=>(typeof n=="number"&&(n=""+n),n!=null?tn(n)||yn(n)||rt(n)?{i:$n,r:n,k:e,f:!!t}:n:null);function ei(n,e=null,t=null,i=0,r=null,s=n===en?0:1,o=!1,a=!1){const l={__v_isVNode:!0,__v_skip:!0,type:n,props:e,key:e&&_A(e),ref:e&&sp(e),scopeId:lm,slotScopeIds:null,children:t,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetAnchor:null,staticCount:0,shapeFlag:s,patchFlag:i,dynamicProps:r,dynamicChildren:null,appContext:null,ctx:$n};return a?(hy(l,t),s&128&&n.normalize(l)):t&&(l.shapeFlag|=tn(t)?8:16),yc>0&&!o&&ir&&(l.patchFlag>0||s&6)&&l.patchFlag!==32&&ir.push(l),l}const ie=bI;function bI(n,e=null,t=null,i=0,r=null,s=!1){if((!n||n===qT)&&(n=li),Ua(n)){const a=Ar(n,e,!0);return t&&hy(a,t),yc>0&&!s&&ir&&(a.shapeFlag&6?ir[ir.indexOf(n)]=a:ir.push(a)),a.patchFlag|=-2,a}if(CI(n)&&(n=n.__vccOpts),e){e=xI(e);let{class:a,style:l}=e;a&&!tn(a)&&(e.class=Yt(a)),Wt(l)&&(BT(l)&&!$e(l)&&(l=Tn({},l)),e.style=Fn(l))}const o=tn(n)?1:ZT(n)?128:gI(n)?64:Wt(n)?4:rt(n)?2:0;return ei(n,e,t,i,r,o,s,!0)}function xI(n){return n?BT(n)||fm in n?Tn({},n):n:null}function Ar(n,e,t=!1){const{props:i,ref:r,patchFlag:s,children:o}=n,a=e?Cr(i||{},e):i;return{__v_isVNode:!0,__v_skip:!0,type:n.type,props:a,key:a&&_A(a),ref:e&&e.ref?t&&r?$e(r)?r.concat(sp(e)):[r,sp(e)]:sp(e):r,scopeId:n.scopeId,slotScopeIds:n.slotScopeIds,children:o,target:n.target,targetAnchor:n.targetAnchor,staticCount:n.staticCount,shapeFlag:n.shapeFlag,patchFlag:e&&n.type!==en?s===-1?16:s|16:s,dynamicProps:n.dynamicProps,dynamicChildren:n.dynamicChildren,appContext:n.appContext,dirs:n.dirs,transition:n.transition,component:n.component,suspense:n.suspense,ssContent:n.ssContent&&Ar(n.ssContent),ssFallback:n.ssFallback&&Ar(n.ssFallback),el:n.el,anchor:n.anchor,ctx:n.ctx,ce:n.ce}}function uy(n=" ",e=0){return ie(dm,null,n,e)}function Fi(n="",e=!1){return e?(nt(),$r(li,null,n)):ie(li,null,n)}function br(n){return n==null||typeof n=="boolean"?ie(li):$e(n)?ie(en,null,n.slice()):typeof n=="object"?po(n):ie(dm,null,String(n))}function po(n){return n.el===null&&n.patchFlag!==-1||n.memo?n:Ar(n)}function hy(n,e){let t=0;const{shapeFlag:i}=n;if(e==null)e=null;else if($e(e))t=16;else if(typeof e=="object")if(i&65){const r=e.default;r&&(r._c&&(r._d=!1),hy(n,r()),r._c&&(r._d=!0));return}else{t=32;const r=e._;!r&&!(fm in e)?e._ctx=$n:r===3&&$n&&($n.slots._===1?e._=1:(e._=2,n.patchFlag|=1024))}else rt(e)?(e={default:e,_ctx:$n},t=32):(e=String(e),i&64?(t=16,e=[uy(e)]):t=8);n.children=e,n.shapeFlag|=t}function Cr(...n){const e={};for(let t=0;t<n.length;t++){const i=n[t];for(const r in i)if(r==="class")e.class!==i.class&&(e.class=Yt([e.class,i.class]));else if(r==="style")e.style=Fn([e.style,i.style]);else if(em(r)){const s=e[r],o=i[r];o&&s!==o&&!($e(s)&&s.includes(o))&&(e[r]=s?[].concat(s,o):o)}else r!==""&&(e[r]=i[r])}return e}function Zi(n,e,t,i=null){or(n,e,7,[t,i])}const wI=lA();let SI=0;function MI(n,e,t){const i=n.type,r=(e?e.appContext:n.appContext)||wI,s={uid:SI++,vnode:n,type:i,parent:e,appContext:r,root:null,next:null,subTree:null,effect:null,update:null,scope:new AT(!0),render:null,proxy:null,exposed:null,exposeProxy:null,withProxy:null,provides:e?e.provides:Object.create(r.provides),accessCache:null,renderCache:[],components:null,directives:null,propsOptions:uA(i,r),emitsOptions:YT(i,r),emit:null,emitted:null,propsDefaults:Xt,inheritAttrs:i.inheritAttrs,ctx:Xt,data:Xt,props:Xt,attrs:Xt,slots:Xt,refs:Xt,setupState:Xt,setupContext:null,attrsProxy:null,slotsProxy: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 s.ctx={_:s},s.root=e?e.root:s,s.emit=AO.bind(null,s),n.ce&&n.ce(s),s}let kn=null;const An=()=>kn||$n;let dy,dl,Kx="__VUE_INSTANCE_SETTERS__";(dl=e0()[Kx])||(dl=e0()[Kx]=[]),dl.push(n=>kn=n),dy=n=>{dl.length>1?dl.forEach(e=>e(n)):dl[0](n)};const Oo=n=>{dy(n),n.scope.on()},Eo=()=>{kn&&kn.scope.off(),dy(null)};function yA(n){return n.vnode.shapeFlag&4}let mh=!1;function EI(n,e=!1){mh=e;const{props:t,children:i}=n.vnode,r=yA(n);lI(n,t,r,e),hI(n,i);const s=r?TI(n,e):void 0;return mh=!1,s}function TI(n,e){const t=n.type;n.accessCache=Object.create(null),n.proxy=zT(new Proxy(n.ctx,QO));const{setup:i}=t;if(i){const r=n.setupContext=i.length>1?xA(n):null;Oo(n),Nc();const s=Mo(i,n,0,[n.props,r]);if(Fc(),Eo(),H_(s)){if(s.then(Eo,Eo),e)return s.then(o=>{d0(n,o,e)}).catch(o=>{rd(o,n,0)});n.asyncDep=s}else d0(n,s,e)}else bA(n,e)}function d0(n,e,t){rt(e)?n.type.__ssrInlineRender?n.ssrRender=e:n.render=e:Wt(e)&&(n.setupState=HT(e)),bA(n,t)}let Zx;function bA(n,e,t){const i=n.type;if(!n.render){if(!e&&Zx&&!i.render){const r=i.template||ay(n).template;if(r){const{isCustomElement:s,compilerOptions:o}=n.appContext.config,{delimiters:a,compilerOptions:l}=i,c=Tn(Tn({isCustomElement:s,delimiters:a},o),l);i.render=Zx(r,c)}}n.render=i.render||Er}{Oo(n),Nc();try{tI(n)}finally{Fc(),Eo()}}}function AI(n){return n.attrsProxy||(n.attrsProxy=new Proxy(n.attrs,{get(e,t){return Mi(n,"get","$attrs"),e[t]}}))}function xA(n){const e=t=>{n.exposed=t||{}};return{get attrs(){return AI(n)},slots:n.slots,emit:n.emit,expose:e}}function pm(n){if(n.exposed)return n.exposeProxy||(n.exposeProxy=new Proxy(HT(zT(n.exposed)),{get(e,t){if(t in e)return e[t];if(t in Gu)return Gu[t](n)},has(e,t){return t in e||t in Gu}}))}function f0(n,e=!0){return rt(n)?n.displayName||n.name:n.name||e&&n.__name}function CI(n){return rt(n)&&"__vccOpts"in n}const Te=(n,e)=>wO(n,e,mh);function Io(n,e,t){const i=arguments.length;return i===2?Wt(e)&&!$e(e)?Ua(e)?ie(n,null,[e]):ie(n,e):ie(n,null,e):(i>3?t=Array.prototype.slice.call(arguments,2):i===3&&Ua(t)&&(t=[t]),ie(n,e,t))}const PI=Symbol.for("v-scx"),RI=()=>Zt(PI),LI="3.3.8",OI="http://www.w3.org/2000/svg",va=typeof document<"u"?document:null,Jx=va&&va.createElement("template"),II={insert:(n,e,t)=>{e.insertBefore(n,t||null)},remove:n=>{const e=n.parentNode;e&&e.removeChild(n)},createElement:(n,e,t,i)=>{const r=e?va.createElementNS(OI,n):va.createElement(n,t?{is:t}:void 0);return n==="select"&&i&&i.multiple!=null&&r.setAttribute("multiple",i.multiple),r},createText:n=>va.createTextNode(n),createComment:n=>va.createComment(n),setText:(n,e)=>{n.nodeValue=e},setElementText:(n,e)=>{n.textContent=e},parentNode:n=>n.parentNode,nextSibling:n=>n.nextSibling,querySelector:n=>va.querySelector(n),setScopeId(n,e){n.setAttribute(e,"")},insertStaticContent(n,e,t,i,r,s){const o=t?t.previousSibling:e.lastChild;if(r&&(r===s||r.nextSibling))for(;e.insertBefore(r.cloneNode(!0),t),!(r===s||!(r=r.nextSibling)););else{Jx.innerHTML=i?"<svg>".concat(n,"</svg>"):n;const a=Jx.content;if(i){const l=a.firstChild;for(;l.firstChild;)a.appendChild(l.firstChild);a.removeChild(l)}e.insertBefore(a,t)}return[o?o.nextSibling:e.firstChild,t?t.previousSibling:e.lastChild]}},js="transition",tu="animation",bc=Symbol("_vtc"),kc=(n,{slots:e})=>Io(HO,SA(n),e);kc.displayName="Transition";const wA={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},DI=kc.props=Tn({},eA,wA),Ko=(n,e=[])=>{$e(n)?n.forEach(t=>t(...e)):n&&n(...e)},Qx=n=>n?$e(n)?n.some(e=>e.length>1):n.length>1:!1;function SA(n){const e={};for(const L in n)L in wA||(e[L]=n[L]);if(n.css===!1)return e;const{name:t="v",type:i,duration:r,enterFromClass:s="".concat(t,"-enter-from"),enterActiveClass:o="".concat(t,"-enter-active"),enterToClass:a="".concat(t,"-enter-to"),appearFromClass:l=s,appearActiveClass:c=o,appearToClass:u=a,leaveFromClass:h="".concat(t,"-leave-from"),leaveActiveClass:d="".concat(t,"-leave-active"),leaveToClass:f="".concat(t,"-leave-to")}=n,p=UI(r),v=p&&p[0],m=p&&p[1],{onBeforeEnter:g,onEnter:b,onEnterCancelled:_,onLeave:y,onLeaveCancelled:T,onBeforeAppear:S=g,onAppear:E=b,onAppearCancelled:x=_}=e,M=(L,$,U)=>{co(L,$?u:a),co(L,$?c:o),U&&U()},w=(L,$)=>{L._isLeaving=!1,co(L,h),co(L,f),co(L,d),$&&$()},C=L=>($,U)=>{const H=L?E:b,V=()=>M($,L,U);Ko(H,[$,V]),ew(()=>{co($,L?l:s),xs($,L?u:a),Qx(H)||tw($,i,v,V)})};return Tn(e,{onBeforeEnter(L){Ko(g,[L]),xs(L,s),xs(L,o)},onBeforeAppear(L){Ko(S,[L]),xs(L,l),xs(L,c)},onEnter:C(!1),onAppear:C(!0),onLeave(L,$){L._isLeaving=!0;const U=()=>w(L,$);xs(L,h),EA(),xs(L,d),ew(()=>{L._isLeaving&&(co(L,h),xs(L,f),Qx(y)||tw(L,i,m,U))}),Ko(y,[L,U])},onEnterCancelled(L){M(L,!1),Ko(_,[L])},onAppearCancelled(L){M(L,!0),Ko(x,[L])},onLeaveCancelled(L){w(L),Ko(T,[L])}})}function UI(n){if(n==null)return null;if(Wt(n))return[Tg(n.enter),Tg(n.leave)];{const e=Tg(n);return[e,e]}}function Tg(n){return MT(n)}function xs(n,e){e.split(/\s+/).forEach(t=>t&&n.classList.add(t)),(n[bc]||(n[bc]=new Set)).add(e)}function co(n,e){e.split(/\s+/).forEach(i=>i&&n.classList.remove(i));const t=n[bc];t&&(t.delete(e),t.size||(n[bc]=void 0))}function ew(n){requestAnimationFrame(()=>{requestAnimationFrame(n)})}let NI=0;function tw(n,e,t,i){const r=n._endId=++NI,s=()=>{r===n._endId&&i()};if(t)return setTimeout(s,t);const{type:o,timeout:a,propCount:l}=MA(n,e);if(!o)return i();const c=o+"end";let u=0;const h=()=>{n.removeEventListener(c,d),s()},d=f=>{f.target===n&&++u>=l&&h()};setTimeout(()=>{u<l&&h()},a+1),n.addEventListener(c,d)}function MA(n,e){const t=window.getComputedStyle(n),i=p=>(t[p]||"").split(", "),r=i("".concat(js,"Delay")),s=i("".concat(js,"Duration")),o=nw(r,s),a=i("".concat(tu,"Delay")),l=i("".concat(tu,"Duration")),c=nw(a,l);let u=null,h=0,d=0;e===js?o>0&&(u=js,h=o,d=s.length):e===tu?c>0&&(u=tu,h=c,d=l.length):(h=Math.max(o,c),u=h>0?o>c?js:tu:null,d=u?u===js?s.length:l.length:0);const f=u===js&&/\b(transform|all)(,|$)/.test(i("".concat(js,"Property")).toString());return{type:u,timeout:h,propCount:d,hasTransform:f}}function nw(n,e){for(;n.length<e.length;)n=n.concat(n);return Math.max(...e.map((t,i)=>iw(t)+iw(n[i])))}function iw(n){return n==="auto"?0:Number(n.slice(0,-1).replace(",","."))*1e3}function EA(){return document.body.offsetHeight}function FI(n,e,t){const i=n[bc];i&&(e=(e?[e,...i]:[...i]).join(" ")),e==null?n.removeAttribute("class"):t?n.setAttribute("class",e):n.className=e}const fy=Symbol("_vod"),gh={beforeMount(n,{value:e},{transition:t}){n[fy]=n.style.display==="none"?"":n.style.display,t&&e?t.beforeEnter(n):nu(n,e)},mounted(n,{value:e},{transition:t}){t&&e&&t.enter(n)},updated(n,{value:e,oldValue:t},{transition:i}){!e!=!t&&(i?e?(i.beforeEnter(n),nu(n,!0),i.enter(n)):i.leave(n,()=>{nu(n,!1)}):nu(n,e))},beforeUnmount(n,{value:e}){nu(n,e)}};function nu(n,e){n.style.display=e?n[fy]:"none"}function kI(n,e,t){const i=n.style,r=tn(t);if(t&&!r){if(e&&!tn(e))for(const s in e)t[s]==null&&p0(i,s,"");for(const s in t)p0(i,s,t[s])}else{const s=i.display;r?e!==t&&(i.cssText=t):e&&n.removeAttribute("style"),fy in n&&(i.display=s)}}const rw=/\s*!important$/;function p0(n,e,t){if($e(t))t.forEach(i=>p0(n,e,i));else if(t==null&&(t=""),e.startsWith("--"))n.setProperty(e,t);else{const i=BI(n,e);rw.test(t)?n.setProperty(Uc(i),t.replace(rw,""),"important"):n[i]=t}}const sw=["Webkit","Moz","ms"],Ag={};function BI(n,e){const t=Ag[e];if(t)return t;let i=Zr(e);if(i!=="filter"&&i in n)return Ag[e]=i;i=im(i);for(let r=0;r<sw.length;r++){const s=sw[r]+i;if(s in n)return Ag[e]=s}return e}const ow="http://www.w3.org/1999/xlink";function zI(n,e,t,i,r){if(i&&e.startsWith("xlink:"))t==null?n.removeAttributeNS(ow,e.slice(6,e.length)):n.setAttributeNS(ow,e,t);else{const s=WL(e);t==null||s&&!ET(t)?n.removeAttribute(e):n.setAttribute(e,s?"":t)}}function VI(n,e,t,i,r,s,o){if(e==="innerHTML"||e==="textContent"){i&&o(i,r,s),n[e]=t==null?"":t;return}const a=n.tagName;if(e==="value"&&a!=="PROGRESS"&&!a.includes("-")){n._value=t;const c=a==="OPTION"?n.getAttribute("value"):n.value,u=t==null?"":t;c!==u&&(n.value=u),t==null&&n.removeAttribute(e);return}let l=!1;if(t===""||t==null){const c=typeof n[e];c==="boolean"?t=ET(t):t==null&&c==="string"?(t="",l=!0):c==="number"&&(t=0,l=!0)}try{n[e]=t}catch(c){}l&&n.removeAttribute(e)}function HI(n,e,t,i){n.addEventListener(e,t,i)}function GI(n,e,t,i){n.removeEventListener(e,t,i)}const aw=Symbol("_vei");function WI(n,e,t,i,r=null){const s=n[aw]||(n[aw]={}),o=s[e];if(i&&o)o.value=i;else{const[a,l]=$I(e);if(i){const c=s[e]=YI(i,r);HI(n,a,c,l)}else o&&(GI(n,a,o,l),s[e]=void 0)}}const lw=/(?:Once|Passive|Capture)$/;function $I(n){let e;if(lw.test(n)){e={};let i;for(;i=n.match(lw);)n=n.slice(0,n.length-i[0].length),e[i[0].toLowerCase()]=!0}return[n[2]===":"?n.slice(3):Uc(n.slice(2)),e]}let Cg=0;const jI=Promise.resolve(),XI=()=>Cg||(jI.then(()=>Cg=0),Cg=Date.now());function YI(n,e){const t=i=>{if(!i._vts)i._vts=Date.now();else if(i._vts<=t.attached)return;or(qI(i,t.value),e,5,[i])};return t.value=n,t.attached=XI(),t}function qI(n,e){if($e(e)){const t=n.stopImmediatePropagation;return n.stopImmediatePropagation=()=>{t.call(n),n._stopped=!0},e.map(i=>r=>!r._stopped&&i&&i(r))}else return e}const cw=/^on[a-z]/,KI=(n,e,t,i,r=!1,s,o,a,l)=>{e==="class"?FI(n,i,r):e==="style"?kI(n,t,i):em(e)?z_(e)||WI(n,e,t,i,o):(e[0]==="."?(e=e.slice(1),!0):e[0]==="^"?(e=e.slice(1),!1):ZI(n,e,i,r))?VI(n,e,i,s,o,a,l):(e==="true-value"?n._trueValue=i:e==="false-value"&&(n._falseValue=i),zI(n,e,i,r))};function ZI(n,e,t,i){return i?!!(e==="innerHTML"||e==="textContent"||e in n&&cw.test(e)&&rt(t)):e==="spellcheck"||e==="draggable"||e==="translate"||e==="form"||e==="list"&&n.tagName==="INPUT"||e==="type"&&n.tagName==="TEXTAREA"||cw.test(e)&&tn(t)?!1:e in n}const TA=new WeakMap,AA=new WeakMap,Ap=Symbol("_moveCb"),uw=Symbol("_enterCb"),CA={name:"TransitionGroup",props:Tn({},DI,{tag:String,moveClass:String}),setup(n,{slots:e}){const t=An(),i=QT();let r,s;return oy(()=>{if(!r.length)return;const o=n.moveClass||"".concat(n.name||"v","-move");if(!nD(r[0].el,t.vnode.el,o))return;r.forEach(QI),r.forEach(eD);const a=r.filter(tD);EA(),a.forEach(l=>{const c=l.el,u=c.style;xs(c,o),u.transform=u.webkitTransform=u.transitionDuration="";const h=c[Ap]=d=>{d&&d.target!==c||(!d||/transform$/.test(d.propertyName))&&(c.removeEventListener("transitionend",h),c[Ap]=null,co(c,o))};c.addEventListener("transitionend",h)})}),()=>{const o=Et(n),a=SA(o);let l=o.tag||en;r=s,s=e.default?sy(e.default()):[];for(let c=0;c<s.length;c++){const u=s[c];u.key!=null&&_c(u,ph(u,a,i,t))}if(r)for(let c=0;c<r.length;c++){const u=r[c];_c(u,ph(u,a,i,t)),TA.set(u,u.el.getBoundingClientRect())}return ie(l,null,s)}}},JI=n=>delete n.mode;CA.props;const py=CA;function QI(n){const e=n.el;e[Ap]&&e[Ap](),e[uw]&&e[uw]()}function eD(n){AA.set(n,n.el.getBoundingClientRect())}function tD(n){const e=TA.get(n),t=AA.get(n),i=e.left-t.left,r=e.top-t.top;if(i||r){const s=n.el.style;return s.transform=s.webkitTransform="translate(".concat(i,"px,").concat(r,"px)"),s.transitionDuration="0s",n}}function nD(n,e,t){const i=n.cloneNode(),r=n[bc];r&&r.forEach(a=>{a.split(/\s+/).forEach(l=>l&&i.classList.remove(l))}),t.split(/\s+/).forEach(a=>a&&i.classList.add(a)),i.style.display="none";const s=e.nodeType===1?e:e.parentNode;s.appendChild(i);const{hasTransform:o}=MA(i);return s.removeChild(i),o}const iD=["ctrl","shift","alt","meta"],rD={stop:n=>n.stopPropagation(),prevent:n=>n.preventDefault(),self:n=>n.target!==n.currentTarget,ctrl:n=>!n.ctrlKey,shift:n=>!n.shiftKey,alt:n=>!n.altKey,meta:n=>!n.metaKey,left:n=>"button"in n&&n.button!==0,middle:n=>"button"in n&&n.button!==1,right:n=>"button"in n&&n.button!==2,exact:(n,e)=>iD.some(t=>n["".concat(t,"Key")]&&!e.includes(t))},hw=(n,e)=>(t,...i)=>{for(let r=0;r<e.length;r++){const s=rD[e[r]];if(s&&s(t,e))return}return n(t,...i)},sD=Tn({patchProp:KI},II);let dw;function PA(){return dw||(dw=pA(sD))}const oD=(...n)=>{PA().render(...n)},RA=(...n)=>{const e=PA().createApp(...n),{mount:t}=e;return e.mount=i=>{const r=aD(i);if(!r)return;const s=e._component;!rt(s)&&!s.render&&!s.template&&(s.template=r.innerHTML),r.innerHTML="";const o=t(r,!1,r instanceof SVGElement);return r instanceof Element&&(r.removeAttribute("v-cloak"),r.setAttribute("data-v-app","")),o},e};function aD(n){return tn(n)?document.querySelector(n):n}/*!
* vue-router v4.2.5
* (c) 2023 Eduardo San Martin Morote
* @license MIT
*/const Yl=typeof window<"u";function lD(n){return n.__esModule||n[Symbol.toStringTag]==="Module"}const It=Object.assign;function Pg(n,e){const t={};for(const i in e){const r=e[i];t[i]=Pr(r)?r.map(n):n(r)}return t}const ju=()=>{},Pr=Array.isArray,cD=/\/$/,uD=n=>n.replace(cD,"");function Rg(n,e,t="/"){let i,r={},s="",o="";const a=e.indexOf("#");let l=e.indexOf("?");return a<l&&a>=0&&(l=-1),l>-1&&(i=e.slice(0,l),s=e.slice(l+1,a>-1?a:e.length),r=n(s)),a>-1&&(i=i||e.slice(0,a),o=e.slice(a,e.length)),i=pD(i!=null?i:e,t),{fullPath:i+(s&&"?")+s+o,path:i,query:r,hash:o}}function hD(n,e){const t=e.query?n(e.query):"";return e.path+(t&&"?")+t+(e.hash||"")}function fw(n,e){return!e||!n.toLowerCase().startsWith(e.toLowerCase())?n:n.slice(e.length)||"/"}function dD(n,e,t){const i=e.matched.length-1,r=t.matched.length-1;return i>-1&&i===r&&xc(e.matched[i],t.matched[r])&&LA(e.params,t.params)&&n(e.query)===n(t.query)&&e.hash===t.hash}function xc(n,e){return(n.aliasOf||n)===(e.aliasOf||e)}function LA(n,e){if(Object.keys(n).length!==Object.keys(e).length)return!1;for(const t in n)if(!fD(n[t],e[t]))return!1;return!0}function fD(n,e){return Pr(n)?pw(n,e):Pr(e)?pw(e,n):n===e}function pw(n,e){return Pr(e)?n.length===e.length&&n.every((t,i)=>t===e[i]):n.length===1&&n[0]===e}function pD(n,e){if(n.startsWith("/"))return n;if(!n)return e;const t=e.split("/"),i=n.split("/"),r=i[i.length-1];(r===".."||r===".")&&i.push("");let s=t.length-1,o,a;for(o=0;o<i.length;o++)if(a=i[o],a!==".")if(a==="..")s>1&&s--;else break;return t.slice(0,s).join("/")+"/"+i.slice(o-(o===i.length?1:0)).join("/")}var vh;(function(n){n.pop="pop",n.push="push"})(vh||(vh={}));var Xu;(function(n){n.back="back",n.forward="forward",n.unknown=""})(Xu||(Xu={}));function mD(n){if(!n)if(Yl){const e=document.querySelector("base");n=e&&e.getAttribute("href")||"/",n=n.replace(/^\w+:\/\/[^\/]+/,"")}else n="/";return n[0]!=="/"&&n[0]!=="#"&&(n="/"+n),uD(n)}const gD=/^[^#]+#/;function vD(n,e){return n.replace(gD,"#")+e}function _D(n,e){const t=document.documentElement.getBoundingClientRect(),i=n.getBoundingClientRect();return{behavior:e.behavior,left:i.left-t.left-(e.left||0),top:i.top-t.top-(e.top||0)}}const mm=()=>({left:window.pageXOffset,top:window.pageYOffset});function yD(n){let e;if("el"in n){const t=n.el,i=typeof t=="string"&&t.startsWith("#"),r=typeof t=="string"?i?document.getElementById(t.slice(1)):document.querySelector(t):t;if(!r)return;e=_D(r,n)}else e=n;"scrollBehavior"in document.documentElement.style?window.scrollTo(e):window.scrollTo(e.left!=null?e.left:window.pageXOffset,e.top!=null?e.top:window.pageYOffset)}function mw(n,e){return(history.state?history.state.position-e:-1)+n}const m0=new Map;function bD(n,e){m0.set(n,e)}function xD(n){const e=m0.get(n);return m0.delete(n),e}let wD=()=>location.protocol+"//"+location.host;function OA(n,e){const{pathname:t,search:i,hash:r}=e,s=n.indexOf("#");if(s>-1){let a=r.includes(n.slice(s))?n.slice(s).length:1,l=r.slice(a);return l[0]!=="/"&&(l="/"+l),fw(l,"")}return fw(t,n)+i+r}function SD(n,e,t,i){let r=[],s=[],o=null;const a=({state:d})=>{const f=OA(n,location),p=t.value,v=e.value;let m=0;if(d){if(t.value=f,e.value=d,o&&o===p){o=null;return}m=v?d.position-v.position:0}else i(f);r.forEach(g=>{g(t.value,p,{delta:m,type:vh.pop,direction:m?m>0?Xu.forward:Xu.back:Xu.unknown})})};function l(){o=t.value}function c(d){r.push(d);const f=()=>{const p=r.indexOf(d);p>-1&&r.splice(p,1)};return s.push(f),f}function u(){const{history:d}=window;d.state&&d.replaceState(It({},d.state,{scroll:mm()}),"")}function h(){for(const d of s)d();s=[],window.removeEventListener("popstate",a),window.removeEventListener("beforeunload",u)}return window.addEventListener("popstate",a),window.addEventListener("beforeunload",u,{passive:!0}),{pauseListeners:l,listen:c,destroy:h}}function gw(n,e,t,i=!1,r=!1){return{back:n,current:e,forward:t,replaced:i,position:window.history.length,scroll:r?mm():null}}function MD(n){const{history:e,location:t}=window,i={value:OA(n,t)},r={value:e.state};r.value||s(i.value,{back:null,current:i.value,forward:null,position:e.length-1,replaced:!0,scroll:null},!0);function s(l,c,u){const h=n.indexOf("#"),d=h>-1?(t.host&&document.querySelector("base")?n:n.slice(h))+l:wD()+n+l;try{e[u?"replaceState":"pushState"](c,"",d),r.value=c}catch(f){console.error(f),t[u?"replace":"assign"](d)}}function o(l,c){const u=It({},e.state,gw(r.value.back,l,r.value.forward,!0),c,{position:r.value.position});s(l,u,!0),i.value=l}function a(l,c){const u=It({},r.value,e.state,{forward:l,scroll:mm()});s(u.current,u,!0);const h=It({},gw(i.value,l,null),{position:u.position+1},c);s(l,h,!1),i.value=l}return{location:i,state:r,push:a,replace:o}}function ED(n){n=mD(n);const e=MD(n),t=SD(n,e.state,e.location,e.replace);function i(s,o=!0){o||t.pauseListeners(),history.go(s)}const r=It({location:"",base:n,go:i,createHref:vD.bind(null,n)},e,t);return Object.defineProperty(r,"location",{enumerable:!0,get:()=>e.location.value}),Object.defineProperty(r,"state",{enumerable:!0,get:()=>e.state.value}),r}function TD(n){return n=location.host?n||location.pathname+location.search:"",n.includes("#")||(n+="#"),ED(n)}function AD(n){return typeof n=="string"||n&&typeof n=="object"}function IA(n){return typeof n=="string"||typeof n=="symbol"}const Xs={path:"/",name:void 0,params:{},query:{},hash:"",fullPath:"/",matched:[],meta:{},redirectedFrom:void 0},DA=Symbol("");var vw;(function(n){n[n.aborted=4]="aborted",n[n.cancelled=8]="cancelled",n[n.duplicated=16]="duplicated"})(vw||(vw={}));function wc(n,e){return It(new Error,{type:n,[DA]:!0},e)}function ds(n,e){return n instanceof Error&&DA in n&&(e==null||!!(n.type&e))}const _w="[^/]+?",CD={sensitive:!1,strict:!1,start:!0,end:!0},PD=/[.+*?^${}()[\]/\\]/g;function RD(n,e){const t=It({},CD,e),i=[];let r=t.start?"^":"";const s=[];for(const c of n){const u=c.length?[]:[90];t.strict&&!c.length&&(r+="/");for(let h=0;h<c.length;h++){const d=c[h];let f=40+(t.sensitive?.25:0);if(d.type===0)h||(r+="/"),r+=d.value.replace(PD,"\\$&"),f+=40;else if(d.type===1){const{value:p,repeatable:v,optional:m,regexp:g}=d;s.push({name:p,repeatable:v,optional:m});const b=g||_w;if(b!==_w){f+=10;try{new RegExp("(".concat(b,")"))}catch(y){throw new Error('Invalid custom RegExp for param "'.concat(p,'" (').concat(b,"): ")+y.message)}}let _=v?"((?:".concat(b,")(?:/(?:").concat(b,"))*)"):"(".concat(b,")");h||(_=m&&c.length<2?"(?:/".concat(_,")"):"/"+_),m&&(_+="?"),r+=_,f+=20,m&&(f+=-8),v&&(f+=-20),b===".*"&&(f+=-50)}u.push(f)}i.push(u)}if(t.strict&&t.end){const c=i.length-1;i[c][i[c].length-1]+=.7000000000000001}t.strict||(r+="/?"),t.end?r+="$":t.strict&&(r+="(?:/|$)");const o=new RegExp(r,t.sensitive?"":"i");function a(c){const u=c.match(o),h={};if(!u)return null;for(let d=1;d<u.length;d++){const f=u[d]||"",p=s[d-1];h[p.name]=f&&p.repeatable?f.split("/"):f}return h}function l(c){let u="",h=!1;for(const d of n){(!h||!u.endsWith("/"))&&(u+="/"),h=!1;for(const f of d)if(f.type===0)u+=f.value;else if(f.type===1){const{value:p,repeatable:v,optional:m}=f,g=p in c?c[p]:"";if(Pr(g)&&!v)throw new Error('Provided param "'.concat(p,'" is an array but it is not repeatable (* or + modifiers)'));const b=Pr(g)?g.join("/"):g;if(!b)if(m)d.length<2&&(u.endsWith("/")?u=u.slice(0,-1):h=!0);else throw new Error('Missing required param "'.concat(p,'"'));u+=b}}return u||"/"}return{re:o,score:i,keys:s,parse:a,stringify:l}}function LD(n,e){let t=0;for(;t<n.length&&t<e.length;){const i=e[t]-n[t];if(i)return i;t++}return n.length<e.length?n.length===1&&n[0]===40+40?-1:1:n.length>e.length?e.length===1&&e[0]===40+40?1:-1:0}function OD(n,e){let t=0;const i=n.score,r=e.score;for(;t<i.length&&t<r.length;){const s=LD(i[t],r[t]);if(s)return s;t++}if(Math.abs(r.length-i.length)===1){if(yw(i))return 1;if(yw(r))return-1}return r.length-i.length}function yw(n){const e=n[n.length-1];return n.length>0&&e[e.length-1]<0}const ID={type:0,value:""},DD=/[a-zA-Z0-9_]/;function UD(n){if(!n)return[[]];if(n==="/")return[[ID]];if(!n.startsWith("/"))throw new Error('Invalid path "'.concat(n,'"'));function e(f){throw new Error("ERR (".concat(t,')/"').concat(c,'": ').concat(f))}let t=0,i=t;const r=[];let s;function o(){s&&r.push(s),s=[]}let a=0,l,c="",u="";function h(){c&&(t===0?s.push({type:0,value:c}):t===1||t===2||t===3?(s.length>1&&(l==="*"||l==="+")&&e("A repeatable param (".concat(c,") must be alone in its segment. eg: '/:ids+.")),s.push({type:1,value:c,regexp:u,repeatable:l==="*"||l==="+",optional:l==="*"||l==="?"})):e("Invalid state to consume buffer"),c="")}function d(){c+=l}for(;a<n.length;){if(l=n[a++],l==="\\"&&t!==2){i=t,t=4;continue}switch(t){case 0:l==="/"?(c&&h(),o()):l===":"?(h(),t=1):d();break;case 4:d(),t=i;break;case 1:l==="("?t=2:DD.test(l)?d():(h(),t=0,l!=="*"&&l!=="?"&&l!=="+"&&a--);break;case 2:l===")"?u[u.length-1]=="\\"?u=u.slice(0,-1)+l:t=3:u+=l;break;case 3:h(),t=0,l!=="*"&&l!=="?"&&l!=="+"&&a--,u="";break;default:e("Unknown state");break}}return t===2&&e('Unfinished custom RegExp for param "'.concat(c,'"')),h(),o(),r}function ND(n,e,t){const i=RD(UD(n.path),t),r=It(i,{record:n,parent:e,children:[],alias:[]});return e&&!r.record.aliasOf==!e.record.aliasOf&&e.children.push(r),r}function FD(n,e){const t=[],i=new Map;e=ww({strict:!1,end:!0,sensitive:!1},e);function r(u){return i.get(u)}function s(u,h,d){const f=!d,p=kD(u);p.aliasOf=d&&d.record;const v=ww(e,u),m=[p];if("alias"in u){const _=typeof u.alias=="string"?[u.alias]:u.alias;for(const y of _)m.push(It({},p,{components:d?d.record.components:p.components,path:y,aliasOf:d?d.record:p}))}let g,b;for(const _ of m){const{path:y}=_;if(h&&y[0]!=="/"){const T=h.record.path,S=T[T.length-1]==="/"?"":"/";_.path=h.record.path+(y&&S+y)}if(g=ND(_,h,v),d?d.alias.push(g):(b=b||g,b!==g&&b.alias.push(g),f&&u.name&&!xw(g)&&o(u.name)),p.children){const T=p.children;for(let S=0;S<T.length;S++)s(T[S],g,d&&d.children[S])}d=d||g,(g.record.components&&Object.keys(g.record.components).length||g.record.name||g.record.redirect)&&l(g)}return b?()=>{o(b)}:ju}function o(u){if(IA(u)){const h=i.get(u);h&&(i.delete(u),t.splice(t.indexOf(h),1),h.children.forEach(o),h.alias.forEach(o))}else{const h=t.indexOf(u);h>-1&&(t.splice(h,1),u.record.name&&i.delete(u.record.name),u.children.forEach(o),u.alias.forEach(o))}}function a(){return t}function l(u){let h=0;for(;h<t.length&&OD(u,t[h])>=0&&(u.record.path!==t[h].record.path||!UA(u,t[h]));)h++;t.splice(h,0,u),u.record.name&&!xw(u)&&i.set(u.record.name,u)}function c(u,h){let d,f={},p,v;if("name"in u&&u.name){if(d=i.get(u.name),!d)throw wc(1,{location:u});v=d.record.name,f=It(bw(h.params,d.keys.filter(b=>!b.optional).map(b=>b.name)),u.params&&bw(u.params,d.keys.map(b=>b.name))),p=d.stringify(f)}else if("path"in u)p=u.path,d=t.find(b=>b.re.test(p)),d&&(f=d.parse(p),v=d.record.name);else{if(d=h.name?i.get(h.name):t.find(b=>b.re.test(h.path)),!d)throw wc(1,{location:u,currentLocation:h});v=d.record.name,f=It({},h.params,u.params),p=d.stringify(f)}const m=[];let g=d;for(;g;)m.unshift(g.record),g=g.parent;return{name:v,path:p,params:f,matched:m,meta:zD(m)}}return n.forEach(u=>s(u)),{addRoute:s,resolve:c,removeRoute:o,getRoutes:a,getRecordMatcher:r}}function bw(n,e){const t={};for(const i of e)i in n&&(t[i]=n[i]);return t}function kD(n){return{path:n.path,redirect:n.redirect,name:n.name,meta:n.meta||{},aliasOf:void 0,beforeEnter:n.beforeEnter,props:BD(n),children:n.children||[],instances:{},leaveGuards:new Set,updateGuards:new Set,enterCallbacks:{},components:"components"in n?n.components||null:n.component&&{default:n.component}}}function BD(n){const e={},t=n.props||!1;if("component"in n)e.default=t;else for(const i in n.components)e[i]=typeof t=="object"?t[i]:t;return e}function xw(n){for(;n;){if(n.record.aliasOf)return!0;n=n.parent}return!1}function zD(n){return n.reduce((e,t)=>It(e,t.meta),{})}function ww(n,e){const t={};for(const i in n)t[i]=i in e?e[i]:n[i];return t}function UA(n,e){return e.children.some(t=>t===n||UA(n,t))}const NA=/#/g,VD=/&/g,HD=/\//g,GD=/=/g,WD=/\?/g,FA=/\+/g,$D=/%5B/g,jD=/%5D/g,kA=/%5E/g,XD=/%60/g,BA=/%7B/g,YD=/%7C/g,zA=/%7D/g,qD=/%20/g;function my(n){return encodeURI(""+n).replace(YD,"|").replace($D,"[").replace(jD,"]")}function KD(n){return my(n).replace(BA,"{").replace(zA,"}").replace(kA,"^")}function g0(n){return my(n).replace(FA,"%2B").replace(qD,"+").replace(NA,"%23").replace(VD,"%26").replace(XD,"`").replace(BA,"{").replace(zA,"}").replace(kA,"^")}function ZD(n){return g0(n).replace(GD,"%3D")}function JD(n){return my(n).replace(NA,"%23").replace(WD,"%3F")}function QD(n){return n==null?"":JD(n).replace(HD,"%2F")}function Cp(n){try{return decodeURIComponent(""+n)}catch(e){}return""+n}function eU(n){const e={};if(n===""||n==="?")return e;const i=(n[0]==="?"?n.slice(1):n).split("&");for(let r=0;r<i.length;++r){const s=i[r].replace(FA," "),o=s.indexOf("="),a=Cp(o<0?s:s.slice(0,o)),l=o<0?null:Cp(s.slice(o+1));if(a in e){let c=e[a];Pr(c)||(c=e[a]=[c]),c.push(l)}else e[a]=l}return e}function Sw(n){let e="";for(let t in n){const i=n[t];if(t=ZD(t),i==null){i!==void 0&&(e+=(e.length?"&":"")+t);continue}(Pr(i)?i.map(s=>s&&g0(s)):[i&&g0(i)]).forEach(s=>{s!==void 0&&(e+=(e.length?"&":"")+t,s!=null&&(e+="="+s))})}return e}function tU(n){const e={};for(const t in n){const i=n[t];i!==void 0&&(e[t]=Pr(i)?i.map(r=>r==null?null:""+r):i==null?i:""+i)}return e}const nU=Symbol(""),Mw=Symbol(""),gm=Symbol(""),gy=Symbol(""),v0=Symbol("");function iu(){let n=[];function e(i){return n.push(i),()=>{const r=n.indexOf(i);r>-1&&n.splice(r,1)}}function t(){n=[]}return{add:e,list:()=>n.slice(),reset:t}}function mo(n,e,t,i,r){const s=i&&(i.enterCallbacks[r]=i.enterCallbacks[r]||[]);return()=>new Promise((o,a)=>{const l=h=>{h===!1?a(wc(4,{from:t,to:e})):h instanceof Error?a(h):AD(h)?a(wc(2,{from:e,to:h})):(s&&i.enterCallbacks[r]===s&&typeof h=="function"&&s.push(h),o())},c=n.call(i&&i.instances[r],e,t,l);let u=Promise.resolve(c);n.length<3&&(u=u.then(l)),u.catch(h=>a(h))})}function Lg(n,e,t,i){const r=[];for(const s of n)for(const o in s.components){let a=s.components[o];if(!(e!=="beforeRouteEnter"&&!s.instances[o]))if(iU(a)){const c=(a.__vccOpts||a)[e];c&&r.push(mo(c,t,i,s,o))}else{let l=a();r.push(()=>l.then(c=>{if(!c)return Promise.reject(new Error("Couldn't resolve component \"".concat(o,'" at "').concat(s.path,'"')));const u=lD(c)?c.default:c;s.components[o]=u;const d=(u.__vccOpts||u)[e];return d&&mo(d,t,i,s,o)()}))}}return r}function iU(n){return typeof n=="object"||"displayName"in n||"props"in n||"__vccOpts"in n}function Ew(n){const e=Zt(gm),t=Zt(gy),i=Te(()=>e.resolve(Se(n.to))),r=Te(()=>{const{matched:l}=i.value,{length:c}=l,u=l[c-1],h=t.matched;if(!u||!h.length)return-1;const d=h.findIndex(xc.bind(null,u));if(d>-1)return d;const f=Tw(l[c-2]);return c>1&&Tw(u)===f&&h[h.length-1].path!==f?h.findIndex(xc.bind(null,l[c-2])):d}),s=Te(()=>r.value>-1&&aU(t.params,i.value.params)),o=Te(()=>r.value>-1&&r.value===t.matched.length-1&&LA(t.params,i.value.params));function a(l={}){return oU(l)?e[Se(n.replace)?"replace":"push"](Se(n.to)).catch(ju):Promise.resolve()}return{route:i,href:Te(()=>i.value.href),isActive:s,isExactActive:o,navigate:a}}const rU=Xe({name:"RouterLink",compatConfig:{MODE:3},props:{to:{type:[String,Object],required:!0},replace:Boolean,activeClass:String,exactActiveClass:String,custom:Boolean,ariaCurrentValue:{type:String,default:"page"}},useLink:Ew,setup(n,{slots:e}){const t=ui(Ew(n)),{options:i}=Zt(gm),r=Te(()=>({[Aw(n.activeClass,i.linkActiveClass,"router-link-active")]:t.isActive,[Aw(n.exactActiveClass,i.linkExactActiveClass,"router-link-exact-active")]:t.isExactActive}));return()=>{const s=e.default&&e.default(t);return n.custom?s:Io("a",{"aria-current":t.isExactActive?n.ariaCurrentValue:null,href:t.href,onClick:t.navigate,class:r.value},s)}}}),sU=rU;function oU(n){if(!(n.metaKey||n.altKey||n.ctrlKey||n.shiftKey)&&!n.defaultPrevented&&!(n.button!==void 0&&n.button!==0)){if(n.currentTarget&&n.currentTarget.getAttribute){const e=n.currentTarget.getAttribute("target");if(/\b_blank\b/i.test(e))return}return n.preventDefault&&n.preventDefault(),!0}}function aU(n,e){for(const t in e){const i=e[t],r=n[t];if(typeof i=="string"){if(i!==r)return!1}else if(!Pr(r)||r.length!==i.length||i.some((s,o)=>s!==r[o]))return!1}return!0}function Tw(n){return n?n.aliasOf?n.aliasOf.path:n.path:""}const Aw=(n,e,t)=>n!=null?n:e!=null?e:t,lU=Xe({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,default:"default"},route:Object},compatConfig:{MODE:3},setup(n,{attrs:e,slots:t}){const i=Zt(v0),r=Te(()=>n.route||i.value),s=Zt(Mw,0),o=Te(()=>{let c=Se(s);const{matched:u}=r.value;let h;for(;(h=u[c])&&!h.components;)c++;return c}),a=Te(()=>r.value.matched[o.value]);Si(Mw,Te(()=>o.value+1)),Si(nU,a),Si(v0,r);const l=xe();return ft(()=>[l.value,a.value,n.name],([c,u,h],[d,f,p])=>{u&&(u.instances[h]=c,f&&f!==u&&c&&c===d&&(u.leaveGuards.size||(u.leaveGuards=f.leaveGuards),u.updateGuards.size||(u.updateGuards=f.updateGuards))),c&&u&&(!f||!xc(u,f)||!d)&&(u.enterCallbacks[h]||[]).forEach(v=>v(c))},{flush:"post"}),()=>{const c=r.value,u=n.name,h=a.value,d=h&&h.components[u];if(!d)return Cw(t.default,{Component:d,route:c});const f=h.props[u],p=f?f===!0?c.params:typeof f=="function"?f(c):f:null,m=Io(d,It({},p,e,{onVnodeUnmounted:g=>{g.component.isUnmounted&&(h.instances[u]=null)},ref:l}));return Cw(t.default,{Component:m,route:c})||m}}});function Cw(n,e){if(!n)return null;const t=n(e);return t.length===1?t[0]:t}const cU=lU;function uU(n){const e=FD(n.routes,n),t=n.parseQuery||eU,i=n.stringifyQuery||Sw,r=n.history,s=iu(),o=iu(),a=iu(),l=jn(Xs);let c=Xs;Yl&&n.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");const u=Pg.bind(null,ne=>""+ne),h=Pg.bind(null,QD),d=Pg.bind(null,Cp);function f(ne,q){let P,N;return IA(ne)?(P=e.getRecordMatcher(ne),N=q):N=ne,e.addRoute(N,P)}function p(ne){const q=e.getRecordMatcher(ne);q&&e.removeRoute(q)}function v(){return e.getRoutes().map(ne=>ne.record)}function m(ne){return!!e.getRecordMatcher(ne)}function g(ne,q){if(q=It({},q||l.value),typeof ne=="string"){const I=Rg(t,ne,q.path),z=e.resolve({path:I.path},q),G=r.createHref(I.fullPath);return It(I,z,{params:d(z.params),hash:Cp(I.hash),redirectedFrom:void 0,href:G})}let P;if("path"in ne)P=It({},ne,{path:Rg(t,ne.path,q.path).path});else{const I=It({},ne.params);for(const z in I)I[z]==null&&delete I[z];P=It({},ne,{params:h(I)}),q.params=h(q.params)}const N=e.resolve(P,q),B=ne.hash||"";N.params=u(d(N.params));const A=hD(i,It({},ne,{hash:KD(B),path:N.path})),R=r.createHref(A);return It({fullPath:A,hash:B,query:i===Sw?tU(ne.query):ne.query||{}},N,{redirectedFrom:void 0,href:R})}function b(ne){return typeof ne=="string"?Rg(t,ne,l.value.path):It({},ne)}function _(ne,q){if(c!==ne)return wc(8,{from:q,to:ne})}function y(ne){return E(ne)}function T(ne){return y(It(b(ne),{replace:!0}))}function S(ne){const q=ne.matched[ne.matched.length-1];if(q&&q.redirect){const{redirect:P}=q;let N=typeof P=="function"?P(ne):P;return typeof N=="string"&&(N=N.includes("?")||N.includes("#")?N=b(N):{path:N},N.params={}),It({query:ne.query,hash:ne.hash,params:"path"in N?{}:ne.params},N)}}function E(ne,q){const P=c=g(ne),N=l.value,B=ne.state,A=ne.force,R=ne.replace===!0,I=S(P);if(I)return E(It(b(I),{state:typeof I=="object"?It({},B,I.state):B,force:A,replace:R}),q||P);const z=P;z.redirectedFrom=q;let G;return!A&&dD(i,N,P)&&(G=wc(16,{to:z,from:N}),X(N,N,!0,!1)),(G?Promise.resolve(G):w(z,N)).catch(ee=>ds(ee)?ds(ee,2)?ee:Q(ee):te(ee,z,N)).then(ee=>{if(ee){if(ds(ee,2))return E(It({replace:R},b(ee.to),{state:typeof ee.to=="object"?It({},B,ee.to.state):B,force:A}),q||z)}else ee=L(z,N,!0,R,B);return C(z,N,ee),ee})}function x(ne,q){const P=_(ne,q);return P?Promise.reject(P):Promise.resolve()}function M(ne){const q=we.values().next().value;return q&&typeof q.runWithContext=="function"?q.runWithContext(ne):ne()}function w(ne,q){let P;const[N,B,A]=hU(ne,q);P=Lg(N.reverse(),"beforeRouteLeave",ne,q);for(const I of N)I.leaveGuards.forEach(z=>{P.push(mo(z,ne,q))});const R=x.bind(null,ne,q);return P.push(R),De(P).then(()=>{P=[];for(const I of s.list())P.push(mo(I,ne,q));return P.push(R),De(P)}).then(()=>{P=Lg(B,"beforeRouteUpdate",ne,q);for(const I of B)I.updateGuards.forEach(z=>{P.push(mo(z,ne,q))});return P.push(R),De(P)}).then(()=>{P=[];for(const I of A)if(I.beforeEnter)if(Pr(I.beforeEnter))for(const z of I.beforeEnter)P.push(mo(z,ne,q));else P.push(mo(I.beforeEnter,ne,q));return P.push(R),De(P)}).then(()=>(ne.matched.forEach(I=>I.enterCallbacks={}),P=Lg(A,"beforeRouteEnter",ne,q),P.push(R),De(P))).then(()=>{P=[];for(const I of o.list())P.push(mo(I,ne,q));return P.push(R),De(P)}).catch(I=>ds(I,8)?I:Promise.reject(I))}function C(ne,q,P){a.list().forEach(N=>M(()=>N(ne,q,P)))}function L(ne,q,P,N,B){const A=_(ne,q);if(A)return A;const R=q===Xs,I=Yl?history.state:{};P&&(N||R?r.replace(ne.fullPath,It({scroll:R&&I&&I.scroll},B)):r.push(ne.fullPath,B)),l.value=ne,X(ne,q,P,R),Q()}let $;function U(){$||($=r.listen((ne,q,P)=>{if(!Re.listening)return;const N=g(ne),B=S(N);if(B){E(It(B,{replace:!0}),N).catch(ju);return}c=N;const A=l.value;Yl&&bD(mw(A.fullPath,P.delta),mm()),w(N,A).catch(R=>ds(R,12)?R:ds(R,2)?(E(R.to,N).then(I=>{ds(I,20)&&!P.delta&&P.type===vh.pop&&r.go(-1,!1)}).catch(ju),Promise.reject()):(P.delta&&r.go(-P.delta,!1),te(R,N,A))).then(R=>{R=R||L(N,A,!1),R&&(P.delta&&!ds(R,8)?r.go(-P.delta,!1):P.type===vh.pop&&ds(R,20)&&r.go(-1,!1)),C(N,A,R)}).catch(ju)}))}let H=iu(),V=iu(),j;function te(ne,q,P){Q(ne);const N=V.list();return N.length?N.forEach(B=>B(ne,q,P)):console.error(ne),Promise.reject(ne)}function Z(){return j&&l.value!==Xs?Promise.resolve():new Promise((ne,q)=>{H.add([ne,q])})}function Q(ne){return j||(j=!ne,U(),H.list().forEach(([q,P])=>ne?P(ne):q()),H.reset()),ne}function X(ne,q,P,N){const{scrollBehavior:B}=n;if(!Yl||!B)return Promise.resolve();const A=!P&&xD(mw(ne.fullPath,0))||(N||!P)&&history.state&&history.state.scroll||null;return Jr().then(()=>B(ne,q,A)).then(R=>R&&yD(R)).catch(R=>te(R,ne,q))}const re=ne=>r.go(ne);let W;const we=new Set,Re={currentRoute:l,listening:!0,addRoute:f,removeRoute:p,hasRoute:m,getRoutes:v,resolve:g,options:n,push:y,replace:T,go:re,back:()=>re(-1),forward:()=>re(1),beforeEach:s.add,beforeResolve:o.add,afterEach:a.add,onError:V.add,isReady:Z,install(ne){const q=this;ne.component("RouterLink",sU),ne.component("RouterView",cU),ne.config.globalProperties.$router=q,Object.defineProperty(ne.config.globalProperties,"$route",{enumerable:!0,get:()=>Se(l)}),Yl&&!W&&l.value===Xs&&(W=!0,y(r.location).catch(B=>{}));const P={};for(const B in Xs)Object.defineProperty(P,B,{get:()=>l.value[B],enumerable:!0});ne.provide(gm,q),ne.provide(gy,kT(P)),ne.provide(v0,l);const N=ne.unmount;we.add(ne),ne.unmount=function(){we.delete(ne),we.size<1&&(c=Xs,$&&$(),$=null,l.value=Xs,W=!1,j=!1),N()}}};function De(ne){return ne.reduce((q,P)=>q.then(()=>M(P)),Promise.resolve())}return Re}function hU(n,e){const t=[],i=[],r=[],s=Math.max(e.matched.length,n.matched.length);for(let o=0;o<s;o++){const a=e.matched[o];a&&(n.matched.find(c=>xc(c,a))?i.push(a):t.push(a));const l=n.matched[o];l&&(e.matched.find(c=>xc(c,l))||r.push(l))}return[t,i,r]}function dU(){return Zt(gm)}function fU(){return Zt(gy)}function Ys(n,e){if(!n)throw new Error(e)}function Pw(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(n);e&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(n,r).enumerable})),t.push.apply(t,i)}return t}function Hd(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Pw(Object(t),!0).forEach(function(i){pU(n,i,t[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Pw(Object(t)).forEach(function(i){Object.defineProperty(n,i,Object.getOwnPropertyDescriptor(t,i))})}return n}function pU(n,e,t){return e=mU(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function mU(n){var e=gU(n,"string");return typeof e=="symbol"?e:String(e)}function gU(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var i=t.call(n,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function Rw(n,e,t,i,r,s,o){try{var a=n[s](o),l=a.value}catch(c){t(c);return}a.done?e(l):Promise.resolve(l).then(i,r)}function vU(n){return function(){var e=this,t=arguments;return new Promise(function(i,r){var s=n.apply(e,t);function o(l){Rw(s,i,r,o,a,"next",l)}function a(l){Rw(s,i,r,o,a,"throw",l)}o(void 0)})}}function _U({fns:n,args:e}){if(n.length===1)return n[0];const t=n.pop();return n.reduce((i,r)=>()=>r(i,e),t)}function ru(n){return!!n&&typeof n=="object"&&typeof n.then=="function"}const vo={compose:"compose",event:"event",modify:"modify"};class yU{constructor(e){this.validKeys=(e==null?void 0:e.validKeys)||[],this.hooks={},this.shared={}}share(e,t){Ys(!Object.keys(this.shared).includes(e),"share failed, key repeat"),this.shared[e]=t}getShared(e){return this.shared[e]}register(e){Ys(!!e.apply,"register failed, plugin.apply must supplied"),Ys(!!e.path,"register failed, plugin.path must supplied"),Object.keys(e.apply).forEach(t=>{Ys(this.validKeys.indexOf(t)>-1,"register failed, invalid key ".concat(t," from plugin ").concat(e.path,".")),this.hooks[t]||(this.hooks[t]=[]),this.hooks[t]=this.hooks[t].concat(e.apply[t])})}getHooks(e){const[t,...i]=e.split(".");let r=this.hooks[t]||[];return i.length&&(r=r.map(s=>{try{let o=s;for(const a of i)o=o[a];return o}catch(o){return null}}).filter(Boolean)),r}applyPlugins({key:e,type:t,initialValue:i,args:r,async:s}){const o=this.getHooks(e)||[];switch(r&&Ys(typeof r=="object","applyPlugins failed, args must be plain object."),t){case vo.modify:return s?o.reduce(function(){var a=vU(function*(l,c){if(Ys(typeof c=="function"||typeof c=="object"||ru(c),"applyPlugins failed, all hooks for key ".concat(e," must be function, plain object or Promise.")),ru(l)&&(l=yield l),typeof c=="function"){const u=c(l,r);return ru(u),u}return ru(c)&&(c=yield c),Hd(Hd({},l),c)});return function(l,c){return a.apply(this,arguments)}}(),ru(i)?i:Promise.resolve(i)):o.reduce((a,l)=>(Ys(typeof l=="function"||typeof l=="object","applyPlugins failed, all hooks for key ".concat(e," must be function or plain object.")),typeof l=="function"?l(a,r):Hd(Hd({},a),l)),i);case vo.event:return o.forEach(a=>{Ys(typeof a=="function","applyPlugins failed, all hooks for key ".concat(e," must be function.")),a(r)});case vo.compose:return()=>_U({fns:o.concat(i),args:r})();default:return null}}}const su=new yU({validKeys:["modifyClientRenderOpts","rootContainer","onAppCreated","render","patchRoutes","modifyCreateHistory","modifyRoute","beforeRender","onRouterCreated","access","layout","request"]}),VA=ui({}),bU=n=>{Object.assign(VA,n)},Lw="";let ou=null,Gd=null;const lre=n=>{var r;const e=su.applyPlugins({key:"modifyCreateHistory",type:vo.modify,args:{base:Lw},initialValue:TD});su.applyPlugins({key:"patchRoutes",type:vo.event,args:{routes:n}});const t=su.applyPlugins({key:"modifyRoute",type:vo.modify,initialValue:{base:Lw,routes:n,createHistory:e}});Gd=(r=t.createHistory)==null?void 0:r.call(t,t.base),ou=uU({history:Gd,routes:t.routes});let i=!1;return ou.beforeEach(async(s,o,a)=>{if(i)return a();i=!0;const l=su.applyPlugins({key:"beforeRender",type:vo.modify,initialValue:{loading:null,action:null}});if(typeof l.action!="function")return a();const c=document.createElement("div");document.body.appendChild(c);const u=RA(l.loading);u.mount(c);try{const h=await l.action({router:ou,history:Gd});bU(h||{}),a()}catch(h){a(!1),console.error("[fes] beforeRender执行出现异常"),console.error(h)}u.unmount(),u._container.innerHTML="",document.body.removeChild(c)}),su.applyPlugins({key:"onRouterCreated",type:vo.event,args:{router:ou,history:Gd}}),ou},Wd=new WeakMap,Ow=(n,e)=>{e.value?n.style.display=n._display:n.style.display="none"};function xU(n){return{beforeMount(e){const t={};t.watch=i=>{e._display=e._display||e.style.display;const r=n(i);return Ow(e,r),ft(r,()=>{Ow(e,r)})},Wd.set(e,t)},mounted(e,t){const i=Wd.get(e);i.unwatch&&i.unwatch(),i.unwatch=i.watch(t.value)},updated(e,t){const i=Wd.get(e);i.unwatch&&i.unwatch(),i.unwatch=i.watch(t.value)},beforeUnmount(e){const t=Wd.get(e);t.unwatch&&t.unwatch()}}}function wU(n){return(e,{slots:t})=>!n(e.id).value||!t.default?null:t.default()}var SU=typeof global=="object"&&global&&global.Object===Object&&global;const HA=SU;var MU=typeof self=="object"&&self&&self.Object===Object&&self,EU=HA||MU||Function("return this")();const Dr=EU;var TU=Dr.Symbol;const Do=TU;var GA=Object.prototype,AU=GA.hasOwnProperty,CU=GA.toString,au=Do?Do.toStringTag:void 0;function PU(n){var e=AU.call(n,au),t=n[au];try{n[au]=void 0;var i=!0}catch(s){}var r=CU.call(n);return i&&(e?n[au]=t:delete n[au]),r}var RU=Object.prototype,LU=RU.toString;function OU(n){return LU.call(n)}var IU="[object Null]",DU="[object Undefined]",Iw=Do?Do.toStringTag:void 0;function Vs(n){return n==null?n===void 0?DU:IU:Iw&&Iw in Object(n)?PU(n):OU(n)}function Os(n){return n!=null&&typeof n=="object"}var UU="[object Symbol]";function WA(n){return typeof n=="symbol"||Os(n)&&Vs(n)==UU}function NU(n,e){for(var t=-1,i=n==null?0:n.length,r=Array(i);++t<i;)r[t]=e(n[t],t,n);return r}var FU=Array.isArray;const Is=FU;var kU=1/0,Dw=Do?Do.prototype:void 0,Uw=Dw?Dw.toString:void 0;function $A(n){if(typeof n=="string")return n;if(Is(n))return NU(n,$A)+"";if(WA(n))return Uw?Uw.call(n):"";var e=n+"";return e=="0"&&1/n==-kU?"-0":e}var BU=/\s/;function zU(n){for(var e=n.length;e--&&BU.test(n.charAt(e)););return e}var VU=/^\s+/;function HU(n){return n&&n.slice(0,zU(n)+1).replace(VU,"")}function Na(n){var e=typeof n;return n!=null&&(e=="object"||e=="function")}var Nw=0/0,GU=/^[-+]0x[0-9a-f]+$/i,WU=/^0b[01]+$/i,$U=/^0o[0-7]+$/i,jU=parseInt;function Fw(n){if(typeof n=="number")return n;if(WA(n))return Nw;if(Na(n)){var e=typeof n.valueOf=="function"?n.valueOf():n;n=Na(e)?e+"":e}if(typeof n!="string")return n===0?n:+n;n=HU(n);var t=WU.test(n);return t||$U.test(n)?jU(n.slice(2),t?2:8):GU.test(n)?Nw:+n}var XU="[object AsyncFunction]",YU="[object Function]",qU="[object GeneratorFunction]",KU="[object Proxy]";function Qr(n){if(!Na(n))return!1;var e=Vs(n);return e==YU||e==qU||e==XU||e==KU}var ZU=Dr["__core-js_shared__"];const Og=ZU;var kw=function(){var n=/[^.]+$/.exec(Og&&Og.keys&&Og.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""}();function JU(n){return!!kw&&kw in n}var QU=Function.prototype,eN=QU.toString;function Za(n){if(n!=null){try{return eN.call(n)}catch(e){}try{return n+""}catch(e){}}return""}var tN=/[\\^$.*+?()[\]{}|]/g,nN=/^\[object .+?Constructor\]$/,iN=Function.prototype,rN=Object.prototype,sN=iN.toString,oN=rN.hasOwnProperty,aN=RegExp("^"+sN.call(oN).replace(tN,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function lN(n){if(!Na(n)||JU(n))return!1;var e=Qr(n)?aN:nN;return e.test(Za(n))}function cN(n,e){return n==null?void 0:n[e]}function Bc(n,e){var t=cN(n,e);return lN(t)?t:void 0}var uN=Bc(Dr,"WeakMap");const _0=uN;var hN=9007199254740991,dN=/^(?:0|[1-9]\d*)$/;function fN(n,e){var t=typeof n;return e=e==null?hN:e,!!e&&(t=="number"||t!="symbol"&&dN.test(n))&&n>-1&&n%1==0&&n<e}function jA(n,e){return n===e||n!==n&&e!==e}var pN=9007199254740991;function XA(n){return typeof n=="number"&&n>-1&&n%1==0&&n<=pN}function mN(n){return n!=null&&XA(n.length)&&!Qr(n)}var gN=Object.prototype;function vN(n){var e=n&&n.constructor,t=typeof e=="function"&&e.prototype||gN;return n===t}function _N(n,e){for(var t=-1,i=Array(n);++t<n;)i[t]=e(t);return i}var yN="[object Arguments]";function Bw(n){return Os(n)&&Vs(n)==yN}var YA=Object.prototype,bN=YA.hasOwnProperty,xN=YA.propertyIsEnumerable,wN=Bw(function(){return arguments}())?Bw:function(n){return Os(n)&&bN.call(n,"callee")&&!xN.call(n,"callee")};const SN=wN;function MN(){return!1}var qA=typeof exports=="object"&&exports&&!exports.nodeType&&exports,zw=qA&&typeof module=="object"&&module&&!module.nodeType&&module,EN=zw&&zw.exports===qA,Vw=EN?Dr.Buffer:void 0,TN=Vw?Vw.isBuffer:void 0,AN=TN||MN;const y0=AN;var CN="[object Arguments]",PN="[object Array]",RN="[object Boolean]",LN="[object Date]",ON="[object Error]",IN="[object Function]",DN="[object Map]",UN="[object Number]",NN="[object Object]",FN="[object RegExp]",kN="[object Set]",BN="[object String]",zN="[object WeakMap]",VN="[object ArrayBuffer]",HN="[object DataView]",GN="[object Float32Array]",WN="[object Float64Array]",$N="[object Int8Array]",jN="[object Int16Array]",XN="[object Int32Array]",YN="[object Uint8Array]",qN="[object Uint8ClampedArray]",KN="[object Uint16Array]",ZN="[object Uint32Array]",$t={};$t[GN]=$t[WN]=$t[$N]=$t[jN]=$t[XN]=$t[YN]=$t[qN]=$t[KN]=$t[ZN]=!0;$t[CN]=$t[PN]=$t[VN]=$t[RN]=$t[HN]=$t[LN]=$t[ON]=$t[IN]=$t[DN]=$t[UN]=$t[NN]=$t[FN]=$t[kN]=$t[BN]=$t[zN]=!1;function JN(n){return Os(n)&&XA(n.length)&&!!$t[Vs(n)]}function QN(n){return function(e){return n(e)}}var KA=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Yu=KA&&typeof module=="object"&&module&&!module.nodeType&&module,eF=Yu&&Yu.exports===KA,Ig=eF&&HA.process,tF=function(){try{var n=Yu&&Yu.require&&Yu.require("util").types;return n||Ig&&Ig.binding&&Ig.binding("util")}catch(e){}}();const Hw=tF;var Gw=Hw&&Hw.isTypedArray,nF=Gw?QN(Gw):JN;const ZA=nF;var iF=Object.prototype,rF=iF.hasOwnProperty;function sF(n,e){var t=Is(n),i=!t&&SN(n),r=!t&&!i&&y0(n),s=!t&&!i&&!r&&ZA(n),o=t||i||r||s,a=o?_N(n.length,String):[],l=a.length;for(var c in n)(e||rF.call(n,c))&&!(o&&(c=="length"||r&&(c=="offset"||c=="parent")||s&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||fN(c,l)))&&a.push(c);return a}function JA(n,e){return function(t){return n(e(t))}}var oF=JA(Object.keys,Object);const aF=oF;var lF=Object.prototype,cF=lF.hasOwnProperty;function uF(n){if(!vN(n))return aF(n);var e=[];for(var t in Object(n))cF.call(n,t)&&t!="constructor"&&e.push(t);return e}function hF(n){return mN(n)?sF(n):uF(n)}var dF=Bc(Object,"create");const _h=dF;function fF(){this.__data__=_h?_h(null):{},this.size=0}function pF(n){var e=this.has(n)&&delete this.__data__[n];return this.size-=e?1:0,e}var mF="__lodash_hash_undefined__",gF=Object.prototype,vF=gF.hasOwnProperty;function _F(n){var e=this.__data__;if(_h){var t=e[n];return t===mF?void 0:t}return vF.call(e,n)?e[n]:void 0}var yF=Object.prototype,bF=yF.hasOwnProperty;function xF(n){var e=this.__data__;return _h?e[n]!==void 0:bF.call(e,n)}var wF="__lodash_hash_undefined__";function SF(n,e){var t=this.__data__;return this.size+=this.has(n)?0:1,t[n]=_h&&e===void 0?wF:e,this}function Fa(n){var e=-1,t=n==null?0:n.length;for(this.clear();++e<t;){var i=n[e];this.set(i[0],i[1])}}Fa.prototype.clear=fF;Fa.prototype.delete=pF;Fa.prototype.get=_F;Fa.prototype.has=xF;Fa.prototype.set=SF;function MF(){this.__data__=[],this.size=0}function vm(n,e){for(var t=n.length;t--;)if(jA(n[t][0],e))return t;return-1}var EF=Array.prototype,TF=EF.splice;function AF(n){var e=this.__data__,t=vm(e,n);if(t<0)return!1;var i=e.length-1;return t==i?e.pop():TF.call(e,t,1),--this.size,!0}function CF(n){var e=this.__data__,t=vm(e,n);return t<0?void 0:e[t][1]}function PF(n){return vm(this.__data__,n)>-1}function RF(n,e){var t=this.__data__,i=vm(t,n);return i<0?(++this.size,t.push([n,e])):t[i][1]=e,this}function Hs(n){var e=-1,t=n==null?0:n.length;for(this.clear();++e<t;){var i=n[e];this.set(i[0],i[1])}}Hs.prototype.clear=MF;Hs.prototype.delete=AF;Hs.prototype.get=CF;Hs.prototype.has=PF;Hs.prototype.set=RF;var LF=Bc(Dr,"Map");const yh=LF;function OF(){this.size=0,this.__data__={hash:new Fa,map:new(yh||Hs),string:new Fa}}function IF(n){var e=typeof n;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?n!=="__proto__":n===null}function _m(n,e){var t=n.__data__;return IF(e)?t[typeof e=="string"?"string":"hash"]:t.map}function DF(n){var e=_m(this,n).delete(n);return this.size-=e?1:0,e}function UF(n){return _m(this,n).get(n)}function NF(n){return _m(this,n).has(n)}function FF(n,e){var t=_m(this,n),i=t.size;return t.set(n,e),this.size+=t.size==i?0:1,this}function Ja(n){var e=-1,t=n==null?0:n.length;for(this.clear();++e<t;){var i=n[e];this.set(i[0],i[1])}}Ja.prototype.clear=OF;Ja.prototype.delete=DF;Ja.prototype.get=UF;Ja.prototype.has=NF;Ja.prototype.set=FF;function QA(n){return n==null?"":$A(n)}function kF(n,e){for(var t=-1,i=e.length,r=n.length;++t<i;)n[r+t]=e[t];return n}var BF=JA(Object.getPrototypeOf,Object);const zF=BF;var VF="[object Object]",HF=Function.prototype,GF=Object.prototype,eC=HF.toString,WF=GF.hasOwnProperty,$F=eC.call(Object);function tC(n){if(!Os(n)||Vs(n)!=VF)return!1;var e=zF(n);if(e===null)return!0;var t=WF.call(e,"constructor")&&e.constructor;return typeof t=="function"&&t instanceof t&&eC.call(t)==$F}function jF(n,e,t,i){var r=-1,s=n==null?0:n.length;for(i&&s&&(t=n[++r]);++r<s;)t=e(t,n[r],r,n);return t}function XF(n){return function(e){return n==null?void 0:n[e]}}var YF={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},qF=XF(YF);const KF=qF;var ZF=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,JF="\\u0300-\\u036f",QF="\\ufe20-\\ufe2f",ek="\\u20d0-\\u20ff",tk=JF+QF+ek,nk="["+tk+"]",ik=RegExp(nk,"g");function rk(n){return n=QA(n),n&&n.replace(ZF,KF).replace(ik,"")}var sk=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function ok(n){return n.match(sk)||[]}var ak=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;function lk(n){return ak.test(n)}var nC="\\ud800-\\udfff",ck="\\u0300-\\u036f",uk="\\ufe20-\\ufe2f",hk="\\u20d0-\\u20ff",dk=ck+uk+hk,iC="\\u2700-\\u27bf",rC="a-z\\xdf-\\xf6\\xf8-\\xff",fk="\\xac\\xb1\\xd7\\xf7",pk="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",mk="\\u2000-\\u206f",gk=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",sC="A-Z\\xc0-\\xd6\\xd8-\\xde",vk="\\ufe0e\\ufe0f",oC=fk+pk+mk+gk,aC="[']",Ww="["+oC+"]",_k="["+dk+"]",lC="\\d+",yk="["+iC+"]",cC="["+rC+"]",uC="[^"+nC+oC+lC+iC+rC+sC+"]",bk="\\ud83c[\\udffb-\\udfff]",xk="(?:"+_k+"|"+bk+")",wk="[^"+nC+"]",hC="(?:\\ud83c[\\udde6-\\uddff]){2}",dC="[\\ud800-\\udbff][\\udc00-\\udfff]",ql="["+sC+"]",Sk="\\u200d",$w="(?:"+cC+"|"+uC+")",Mk="(?:"+ql+"|"+uC+")",jw="(?:"+aC+"(?:d|ll|m|re|s|t|ve))?",Xw="(?:"+aC+"(?:D|LL|M|RE|S|T|VE))?",fC=xk+"?",pC="["+vk+"]?",Ek="(?:"+Sk+"(?:"+[wk,hC,dC].join("|")+")"+pC+fC+")*",Tk="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ak="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Ck=pC+fC+Ek,Pk="(?:"+[yk,hC,dC].join("|")+")"+Ck,Rk=RegExp([ql+"?"+cC+"+"+jw+"(?="+[Ww,ql,"$"].join("|")+")",Mk+"+"+Xw+"(?="+[Ww,ql+$w,"$"].join("|")+")",ql+"?"+$w+"+"+jw,ql+"+"+Xw,Ak,Tk,lC,Pk].join("|"),"g");function Lk(n){return n.match(Rk)||[]}function Ok(n,e,t){return n=QA(n),e=t?void 0:e,e===void 0?lk(n)?Lk(n):ok(n):n.match(e)||[]}var Ik="[']",Dk=RegExp(Ik,"g");function Uk(n){return function(e){return jF(Ok(rk(e).replace(Dk,"")),n,"")}}function Nk(){this.__data__=new Hs,this.size=0}function Fk(n){var e=this.__data__,t=e.delete(n);return this.size=e.size,t}function kk(n){return this.__data__.get(n)}function Bk(n){return this.__data__.has(n)}var zk=200;function Vk(n,e){var t=this.__data__;if(t instanceof Hs){var i=t.__data__;if(!yh||i.length<zk-1)return i.push([n,e]),this.size=++t.size,this;t=this.__data__=new Ja(i)}return t.set(n,e),this.size=t.size,this}function To(n){var e=this.__data__=new Hs(n);this.size=e.size}To.prototype.clear=Nk;To.prototype.delete=Fk;To.prototype.get=kk;To.prototype.has=Bk;To.prototype.set=Vk;function Hk(n,e){for(var t=-1,i=n==null?0:n.length,r=0,s=[];++t<i;){var o=n[t];e(o,t,n)&&(s[r++]=o)}return s}function Gk(){return[]}var Wk=Object.prototype,$k=Wk.propertyIsEnumerable,Yw=Object.getOwnPropertySymbols,jk=Yw?function(n){return n==null?[]:(n=Object(n),Hk(Yw(n),function(e){return $k.call(n,e)}))}:Gk;const Xk=jk;function Yk(n,e,t){var i=e(n);return Is(n)?i:kF(i,t(n))}function qw(n){return Yk(n,hF,Xk)}var qk=Bc(Dr,"DataView");const b0=qk;var Kk=Bc(Dr,"Promise");const x0=Kk;var Zk=Bc(Dr,"Set");const w0=Zk;var Kw="[object Map]",Jk="[object Object]",Zw="[object Promise]",Jw="[object Set]",Qw="[object WeakMap]",e1="[object DataView]",Qk=Za(b0),eB=Za(yh),tB=Za(x0),nB=Za(w0),iB=Za(_0),da=Vs;(b0&&da(new b0(new ArrayBuffer(1)))!=e1||yh&&da(new yh)!=Kw||x0&&da(x0.resolve())!=Zw||w0&&da(new w0)!=Jw||_0&&da(new _0)!=Qw)&&(da=function(n){var e=Vs(n),t=e==Jk?n.constructor:void 0,i=t?Za(t):"";if(i)switch(i){case Qk:return e1;case eB:return Kw;case tB:return Zw;case nB:return Jw;case iB:return Qw}return e});const t1=da;var rB=Dr.Uint8Array;const n1=rB;var sB="__lodash_hash_undefined__";function oB(n){return this.__data__.set(n,sB),this}function aB(n){return this.__data__.has(n)}function Pp(n){var e=-1,t=n==null?0:n.length;for(this.__data__=new Ja;++e<t;)this.add(n[e])}Pp.prototype.add=Pp.prototype.push=oB;Pp.prototype.has=aB;function lB(n,e){for(var t=-1,i=n==null?0:n.length;++t<i;)if(e(n[t],t,n))return!0;return!1}function cB(n,e){return n.has(e)}var uB=1,hB=2;function mC(n,e,t,i,r,s){var o=t&uB,a=n.length,l=e.length;if(a!=l&&!(o&&l>a))return!1;var c=s.get(n),u=s.get(e);if(c&&u)return c==e&&u==n;var h=-1,d=!0,f=t&hB?new Pp:void 0;for(s.set(n,e),s.set(e,n);++h<a;){var p=n[h],v=e[h];if(i)var m=o?i(v,p,h,e,n,s):i(p,v,h,n,e,s);if(m!==void 0){if(m)continue;d=!1;break}if(f){if(!lB(e,function(g,b){if(!cB(f,b)&&(p===g||r(p,g,t,i,s)))return f.push(b)})){d=!1;break}}else if(!(p===v||r(p,v,t,i,s))){d=!1;break}}return s.delete(n),s.delete(e),d}function dB(n){var e=-1,t=Array(n.size);return n.forEach(function(i,r){t[++e]=[r,i]}),t}function fB(n){var e=-1,t=Array(n.size);return n.forEach(function(i){t[++e]=i}),t}var pB=1,mB=2,gB="[object Boolean]",vB="[object Date]",_B="[object Error]",yB="[object Map]",bB="[object Number]",xB="[object RegExp]",wB="[object Set]",SB="[object String]",MB="[object Symbol]",EB="[object ArrayBuffer]",TB="[object DataView]",i1=Do?Do.prototype:void 0,Dg=i1?i1.valueOf:void 0;function AB(n,e,t,i,r,s,o){switch(t){case TB:if(n.byteLength!=e.byteLength||n.byteOffset!=e.byteOffset)return!1;n=n.buffer,e=e.buffer;case EB:return!(n.byteLength!=e.byteLength||!s(new n1(n),new n1(e)));case gB:case vB:case bB:return jA(+n,+e);case _B:return n.name==e.name&&n.message==e.message;case xB:case SB:return n==e+"";case yB:var a=dB;case wB:var l=i&pB;if(a||(a=fB),n.size!=e.size&&!l)return!1;var c=o.get(n);if(c)return c==e;i|=mB,o.set(n,e);var u=mC(a(n),a(e),i,r,s,o);return o.delete(n),u;case MB:if(Dg)return Dg.call(n)==Dg.call(e)}return!1}var CB=1,PB=Object.prototype,RB=PB.hasOwnProperty;function LB(n,e,t,i,r,s){var o=t&CB,a=qw(n),l=a.length,c=qw(e),u=c.length;if(l!=u&&!o)return!1;for(var h=l;h--;){var d=a[h];if(!(o?d in e:RB.call(e,d)))return!1}var f=s.get(n),p=s.get(e);if(f&&p)return f==e&&p==n;var v=!0;s.set(n,e),s.set(e,n);for(var m=o;++h<l;){d=a[h];var g=n[d],b=e[d];if(i)var _=o?i(b,g,d,e,n,s):i(g,b,d,n,e,s);if(!(_===void 0?g===b||r(g,b,t,i,s):_)){v=!1;break}m||(m=d=="constructor")}if(v&&!m){var y=n.constructor,T=e.constructor;y!=T&&"constructor"in n&&"constructor"in e&&!(typeof y=="function"&&y instanceof y&&typeof T=="function"&&T instanceof T)&&(v=!1)}return s.delete(n),s.delete(e),v}var OB=1,r1="[object Arguments]",s1="[object Array]",$d="[object Object]",IB=Object.prototype,o1=IB.hasOwnProperty;function DB(n,e,t,i,r,s){var o=Is(n),a=Is(e),l=o?s1:t1(n),c=a?s1:t1(e);l=l==r1?$d:l,c=c==r1?$d:c;var u=l==$d,h=c==$d,d=l==c;if(d&&y0(n)){if(!y0(e))return!1;o=!0,u=!1}if(d&&!u)return s||(s=new To),o||ZA(n)?mC(n,e,t,i,r,s):AB(n,e,l,t,i,r,s);if(!(t&OB)){var f=u&&o1.call(n,"__wrapped__"),p=h&&o1.call(e,"__wrapped__");if(f||p){var v=f?n.value():n,m=p?e.value():e;return s||(s=new To),r(v,m,t,i,s)}}return d?(s||(s=new To),LB(n,e,t,i,r,s)):!1}function gC(n,e,t,i,r){return n===e?!0:n==null||e==null||!Os(n)&&!Os(e)?n!==n&&e!==e:DB(n,e,t,i,gC,r)}var UB=function(){return Dr.Date.now()};const Ug=UB;var NB="Expected a function",FB=Math.max,kB=Math.min;function BB(n,e,t){var i,r,s,o,a,l,c=0,u=!1,h=!1,d=!0;if(typeof n!="function")throw new TypeError(NB);e=Fw(e)||0,Na(t)&&(u=!!t.leading,h="maxWait"in t,s=h?FB(Fw(t.maxWait)||0,e):s,d="trailing"in t?!!t.trailing:d);function f(S){var E=i,x=r;return i=r=void 0,c=S,o=n.apply(x,E),o}function p(S){return c=S,a=setTimeout(g,e),u?f(S):o}function v(S){var E=S-l,x=S-c,M=e-E;return h?kB(M,s-x):M}function m(S){var E=S-l,x=S-c;return l===void 0||E>=e||E<0||h&&x>=s}function g(){var S=Ug();if(m(S))return b(S);a=setTimeout(g,v(S))}function b(S){return a=void 0,d&&i?f(S):(i=r=void 0,o)}function _(){a!==void 0&&clearTimeout(a),c=0,i=l=r=a=void 0}function y(){return a===void 0?o:b(Ug())}function T(){var S=Ug(),E=m(S);if(i=arguments,r=this,l=S,E){if(a===void 0)return p(l);if(h)return clearTimeout(a),a=setTimeout(g,e),f(l)}return a===void 0&&(a=setTimeout(g,e)),o}return T.cancel=_,T.flush=y,T}var zB="[object String]";function vC(n){return typeof n=="string"||!Is(n)&&Os(n)&&Vs(n)==zB}var VB="[object Boolean]";function Rp(n){return n===!0||n===!1||Os(n)&&Vs(n)==VB}function HB(n,e){return gC(n,e)}var GB=Dr.isFinite;function a1(n){return typeof n=="number"&&GB(n)}function vy(n){return n==null}function WB(n){return n===null}function _C(n){return n===void 0}var $B=Uk(function(n,e,t){return n+(t?"-":"")+e.toLowerCase()});const jB=$B;var XB="Expected a function";function YB(n,e,t){var i=!0,r=!0;if(typeof n!="function")throw new TypeError(XB);return Na(t)&&(i="leading"in t?!!t.leading:i,r="trailing"in t?!!t.trailing:r),BB(n,e,{leading:i,maxWait:e,trailing:r})}function yC(n){return!!n&&(typeof n=="object"||typeof n=="function")&&typeof n.then=="function"}const xa=ui({roles:{admin:["*"],manager:["/"]},currentRoleId:"",currentAccessIds:[]}),qu=[],Ku=[],bh=()=>{const n=xa.roles[xa.currentRoleId];return Array.isArray(n)&&n.length>0?xa.currentAccessIds.concat(n):xa.currentAccessIds},qB=n=>{Ku.push(n),n.then(e=>{_y(e)}).catch(e=>{console.error(e)}).then(()=>{const e=Ku.indexOf(n);e!==-1&&Ku.splice(e,1)})},_y=n=>{if(yC(n))return qB(n);if(tC(n)){n.accessIds&&_y(n.accessIds),n.roleId&&yy(n.roleId);return}if(!Array.isArray(n))throw new Error("[plugin-access]: argument to the setAccess() must be array or promise or object");xa.currentAccessIds=n},KB=n=>{qu.push(n),n.then(e=>{yy(e)}).catch(e=>{console.error(e)}).then(()=>{const e=qu.indexOf(n);e!==-1&&qu.splice(e,1)})},yy=async n=>{if(yC(n))return KB(n);if(typeof n!="string")throw new Error("[plugin-access]: argument to the setRole() must be string or promise");xa.currentRoleId=n},xh=(n,e)=>{if(n==null||!Array.isArray(e)||e.length===0)return!1;n=n.split("?")[0],n===""&&(n="/");const t=e.length;for(let i=0;i<t;i++)if(n===e[i]||new RegExp("^".concat(e[i].replace("*",".+"),"$")).test(n))return!0;return!1},bC=()=>qu.length||Ku.length,ZB=async n=>(bC()&&await Promise.all(qu.concat(Ku)),xh(n,bh())),cre=n=>{n.directive("access",xU(l1)),n.component("Access",wU(l1))},JB={hasAccess:ZB,isDataReady:bC,setRole:yy,getRole:()=>xa.currentRoleId,setAccess:_y,match:xh,getAccess:bh},ure=n=>xh(Se(n),bh()),l1=n=>{const e=Te(bh);return Te(()=>xh(Se(n),e.value))},c1={status:[["0","无效的"],["1","有效的"]]};Object.keys(c1).forEach(n=>{QB(n,c1[n])});function QB(n,e,t={keyName:"",valueName:""}){if(!n)throw new Error("enums error: name must not be empty");if(!Array.isArray(e))throw new Error("enums error: the ".concat(n,"'s enum must be array"));let i=[];return e.forEach((r,s)=>{let o;if(Array.isArray(r))o={key:r[0],value:r[1]};else if(Object.prototype.toString.call(r)==="[object Object]")t.keyName||(t.keyName="key"),o={key:r[t.keyName],value:t.valueName?r[t.valueName]:r};else{console.warn("enums warn: the key ".concat(n," enum item[").concat(s,"] must be array or object"));return}let a=i.filter(l=>l.key===o.key)[0];a?(console.warn("enums warn: the key ".concat(a.key," enum item already exists, cover!")),a.value=o.value):i.push(o)}),i}const e4=(n,e)=>{const t=n.__vccOpts||n;for(const[i,r]of e)t[i]=r;return t},t4=Xe({props:{pageKey:{type:Function,default:()=>{}},isAllKeepAlive:{type:Boolean,default:!1}},setup(n){const e=fU(),t=dU();function i(l){var c,u;if(l.meta["keep-alive"]||n.isAllKeepAlive){const h=l.matched,d=h[h.length-1].components.default,f=(u=(c=l.meta)==null?void 0:c.name)!=null?u:l.name;if(f&&d)return d.name=f,f}}function r(){const l=i(e);return l?[l]:[]}const s=xe(r());return t.afterEach(()=>{const l=i(e);l&&!s.value.includes(l)&&(s.value=[...s.value,l])}),{keepAlivePages:s,removeKeepAlive:l=>{const c=[...s.value],u=c.indexOf(l);u!==-1&&c.splice(u,1),s.value=c},removeAllAndSaveKeepAlive:l=>{s.value=[l]}}}});function n4(n,e,t,i,r,s){const o=Hu("router-view");return nt(),$r(o,null,{default:cm(({Component:a,route:l})=>[(nt(),$r(WO,{include:n.keepAlivePages},[(nt(),$r(OO(a),{key:n.pageKey(l)}))],1032,["include"]))]),_:1})}const hre=e4(t4,[["render",n4]]),xC=ui(new Map),dre=n=>xC.get(n),fre=n=>xC.delete(n);function i4(){const n=ui({userName:"11"});return{user:n,signin:()=>{const{setRole:i}=JB;n.userName="",i("admin")},signout:()=>{}}}function r4(){return VA}const s4={"@@initialState":r4,user:i4},Ng=new Map,pre=n=>{const e=s4[n];if(e===void 0)throw new Error("[plugin-model]: useModel, name is undefined.");if(typeof e!="function")throw new Error("[plugin-model]: useModel is not a function.");return Ng.has(n)||Ng.set(n,e()),Ng.get(n)};var o4=typeof global=="object"&&global&&global.Object===Object&&global;const wC=o4;var a4=typeof self=="object"&&self&&self.Object===Object&&self,l4=wC||a4||Function("return this")();const cs=l4;var c4=cs.Symbol;const es=c4;var SC=Object.prototype,u4=SC.hasOwnProperty,h4=SC.toString,lu=es?es.toStringTag:void 0;function d4(n){var e=u4.call(n,lu),t=n[lu];try{n[lu]=void 0;var i=!0}catch(s){}var r=h4.call(n);return i&&(e?n[lu]=t:delete n[lu]),r}var f4=Object.prototype,p4=f4.toString;function m4(n){return p4.call(n)}var g4="[object Null]",v4="[object Undefined]",u1=es?es.toStringTag:void 0;function Qa(n){return n==null?n===void 0?v4:g4:u1&&u1 in Object(n)?d4(n):m4(n)}function el(n){return n!=null&&typeof n=="object"}var _4="[object Symbol]";function by(n){return typeof n=="symbol"||el(n)&&Qa(n)==_4}function MC(n,e){for(var t=-1,i=n==null?0:n.length,r=Array(i);++t<i;)r[t]=e(n[t],t,n);return r}var y4=Array.isArray;const tl=y4;var b4=1/0,h1=es?es.prototype:void 0,d1=h1?h1.toString:void 0;function EC(n){if(typeof n=="string")return n;if(tl(n))return MC(n,EC)+"";if(by(n))return d1?d1.call(n):"";var e=n+"";return e=="0"&&1/n==-b4?"-0":e}function sd(n){var e=typeof n;return n!=null&&(e=="object"||e=="function")}function x4(n){return n}var w4="[object AsyncFunction]",S4="[object Function]",M4="[object GeneratorFunction]",E4="[object Proxy]";function TC(n){if(!sd(n))return!1;var e=Qa(n);return e==S4||e==M4||e==w4||e==E4}var T4=cs["__core-js_shared__"];const Fg=T4;var f1=function(){var n=/[^.]+$/.exec(Fg&&Fg.keys&&Fg.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""}();function A4(n){return!!f1&&f1 in n}var C4=Function.prototype,P4=C4.toString;function nl(n){if(n!=null){try{return P4.call(n)}catch(e){}try{return n+""}catch(e){}}return""}var R4=/[\\^$.*+?()[\]{}|]/g,L4=/^\[object .+?Constructor\]$/,O4=Function.prototype,I4=Object.prototype,D4=O4.toString,U4=I4.hasOwnProperty,N4=RegExp("^"+D4.call(U4).replace(R4,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function F4(n){if(!sd(n)||A4(n))return!1;var e=TC(n)?N4:L4;return e.test(nl(n))}function k4(n,e){return n==null?void 0:n[e]}function il(n,e){var t=k4(n,e);return F4(t)?t:void 0}var B4=il(cs,"WeakMap");const S0=B4;var p1=Object.create,z4=function(){function n(){}return function(e){if(!sd(e))return{};if(p1)return p1(e);n.prototype=e;var t=new n;return n.prototype=void 0,t}}();const V4=z4;function H4(n,e,t){switch(t.length){case 0:return n.call(e);case 1:return n.call(e,t[0]);case 2:return n.call(e,t[0],t[1]);case 3:return n.call(e,t[0],t[1],t[2])}return n.apply(e,t)}function G4(n,e){var t=-1,i=n.length;for(e||(e=Array(i));++t<i;)e[t]=n[t];return e}var W4=800,$4=16,j4=Date.now;function X4(n){var e=0,t=0;return function(){var i=j4(),r=$4-(i-t);if(t=i,r>0){if(++e>=W4)return arguments[0]}else e=0;return n.apply(void 0,arguments)}}function Y4(n){return function(){return n}}var q4=function(){try{var n=il(Object,"defineProperty");return n({},"",{}),n}catch(e){}}();const Lp=q4;var K4=Lp?function(n,e){return Lp(n,"toString",{configurable:!0,enumerable:!1,value:Y4(e),writable:!0})}:x4;const Z4=K4;var J4=X4(Z4);const Q4=J4;function e5(n,e){for(var t=-1,i=n==null?0:n.length;++t<i&&e(n[t],t,n)!==!1;);return n}var t5=9007199254740991,n5=/^(?:0|[1-9]\d*)$/;function i5(n,e){var t=typeof n;return e=e!=null?e:t5,!!e&&(t=="number"||t!="symbol"&&n5.test(n))&&n>-1&&n%1==0&&n<e}function AC(n,e,t){e=="__proto__"&&Lp?Lp(n,e,{configurable:!0,enumerable:!0,value:t,writable:!0}):n[e]=t}function CC(n,e){return n===e||n!==n&&e!==e}var r5=Object.prototype,s5=r5.hasOwnProperty;function PC(n,e,t){var i=n[e];(!(s5.call(n,e)&&CC(i,t))||t===void 0&&!(e in n))&&AC(n,e,t)}function od(n,e,t,i){var r=!t;t||(t={});for(var s=-1,o=e.length;++s<o;){var a=e[s],l=i?i(t[a],n[a],a,t,n):void 0;l===void 0&&(l=n[a]),r?AC(t,a,l):PC(t,a,l)}return t}var m1=Math.max;function o5(n,e,t){return e=m1(e===void 0?n.length-1:e,0),function(){for(var i=arguments,r=-1,s=m1(i.length-e,0),o=Array(s);++r<s;)o[r]=i[e+r];r=-1;for(var a=Array(e+1);++r<e;)a[r]=i[r];return a[e]=t(o),H4(n,this,a)}}var a5=9007199254740991;function RC(n){return typeof n=="number"&&n>-1&&n%1==0&&n<=a5}function LC(n){return n!=null&&RC(n.length)&&!TC(n)}var l5=Object.prototype;function xy(n){var e=n&&n.constructor,t=typeof e=="function"&&e.prototype||l5;return n===t}function c5(n,e){for(var t=-1,i=Array(n);++t<n;)i[t]=e(t);return i}var u5="[object Arguments]";function g1(n){return el(n)&&Qa(n)==u5}var OC=Object.prototype,h5=OC.hasOwnProperty,d5=OC.propertyIsEnumerable,f5=g1(function(){return arguments}())?g1:function(n){return el(n)&&h5.call(n,"callee")&&!d5.call(n,"callee")};const IC=f5;function p5(){return!1}var DC=typeof exports=="object"&&exports&&!exports.nodeType&&exports,v1=DC&&typeof module=="object"&&module&&!module.nodeType&&module,m5=v1&&v1.exports===DC,_1=m5?cs.Buffer:void 0,g5=_1?_1.isBuffer:void 0,v5=g5||p5;const UC=v5;var _5="[object Arguments]",y5="[object Array]",b5="[object Boolean]",x5="[object Date]",w5="[object Error]",S5="[object Function]",M5="[object Map]",E5="[object Number]",T5="[object Object]",A5="[object RegExp]",C5="[object Set]",P5="[object String]",R5="[object WeakMap]",L5="[object ArrayBuffer]",O5="[object DataView]",I5="[object Float32Array]",D5="[object Float64Array]",U5="[object Int8Array]",N5="[object Int16Array]",F5="[object Int32Array]",k5="[object Uint8Array]",B5="[object Uint8ClampedArray]",z5="[object Uint16Array]",V5="[object Uint32Array]",jt={};jt[I5]=jt[D5]=jt[U5]=jt[N5]=jt[F5]=jt[k5]=jt[B5]=jt[z5]=jt[V5]=!0;jt[_5]=jt[y5]=jt[L5]=jt[b5]=jt[O5]=jt[x5]=jt[w5]=jt[S5]=jt[M5]=jt[E5]=jt[T5]=jt[A5]=jt[C5]=jt[P5]=jt[R5]=!1;function H5(n){return el(n)&&RC(n.length)&&!!jt[Qa(n)]}function wy(n){return function(e){return n(e)}}var NC=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Zu=NC&&typeof module=="object"&&module&&!module.nodeType&&module,G5=Zu&&Zu.exports===NC,kg=G5&&wC.process,W5=function(){try{var n=Zu&&Zu.require&&Zu.require("util").types;return n||kg&&kg.binding&&kg.binding("util")}catch(e){}}();const Sc=W5;var y1=Sc&&Sc.isTypedArray,$5=y1?wy(y1):H5;const j5=$5;var X5=Object.prototype,Y5=X5.hasOwnProperty;function FC(n,e){var t=tl(n),i=!t&&IC(n),r=!t&&!i&&UC(n),s=!t&&!i&&!r&&j5(n),o=t||i||r||s,a=o?c5(n.length,String):[],l=a.length;for(var c in n)(e||Y5.call(n,c))&&!(o&&(c=="length"||r&&(c=="offset"||c=="parent")||s&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||i5(c,l)))&&a.push(c);return a}function kC(n,e){return function(t){return n(e(t))}}var q5=kC(Object.keys,Object);const K5=q5;var Z5=Object.prototype,J5=Z5.hasOwnProperty;function Q5(n){if(!xy(n))return K5(n);var e=[];for(var t in Object(n))J5.call(n,t)&&t!="constructor"&&e.push(t);return e}function Sy(n){return LC(n)?FC(n):Q5(n)}function ez(n){var e=[];if(n!=null)for(var t in Object(n))e.push(t);return e}var tz=Object.prototype,nz=tz.hasOwnProperty;function iz(n){if(!sd(n))return ez(n);var e=xy(n),t=[];for(var i in n)i=="constructor"&&(e||!nz.call(n,i))||t.push(i);return t}function My(n){return LC(n)?FC(n,!0):iz(n)}var rz=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,sz=/^\w*$/;function oz(n,e){if(tl(n))return!1;var t=typeof n;return t=="number"||t=="symbol"||t=="boolean"||n==null||by(n)?!0:sz.test(n)||!rz.test(n)||e!=null&&n in Object(e)}var az=il(Object,"create");const wh=az;function lz(){this.__data__=wh?wh(null):{},this.size=0}function cz(n){var e=this.has(n)&&delete this.__data__[n];return this.size-=e?1:0,e}var uz="__lodash_hash_undefined__",hz=Object.prototype,dz=hz.hasOwnProperty;function fz(n){var e=this.__data__;if(wh){var t=e[n];return t===uz?void 0:t}return dz.call(e,n)?e[n]:void 0}var pz=Object.prototype,mz=pz.hasOwnProperty;function gz(n){var e=this.__data__;return wh?e[n]!==void 0:mz.call(e,n)}var vz="__lodash_hash_undefined__";function _z(n,e){var t=this.__data__;return this.size+=this.has(n)?0:1,t[n]=wh&&e===void 0?vz:e,this}function ka(n){var e=-1,t=n==null?0:n.length;for(this.clear();++e<t;){var i=n[e];this.set(i[0],i[1])}}ka.prototype.clear=lz;ka.prototype.delete=cz;ka.prototype.get=fz;ka.prototype.has=gz;ka.prototype.set=_z;function yz(){this.__data__=[],this.size=0}function ym(n,e){for(var t=n.length;t--;)if(CC(n[t][0],e))return t;return-1}var bz=Array.prototype,xz=bz.splice;function wz(n){var e=this.__data__,t=ym(e,n);if(t<0)return!1;var i=e.length-1;return t==i?e.pop():xz.call(e,t,1),--this.size,!0}function Sz(n){var e=this.__data__,t=ym(e,n);return t<0?void 0:e[t][1]}function Mz(n){return ym(this.__data__,n)>-1}function Ez(n,e){var t=this.__data__,i=ym(t,n);return i<0?(++this.size,t.push([n,e])):t[i][1]=e,this}function Gs(n){var e=-1,t=n==null?0:n.length;for(this.clear();++e<t;){var i=n[e];this.set(i[0],i[1])}}Gs.prototype.clear=yz;Gs.prototype.delete=wz;Gs.prototype.get=Sz;Gs.prototype.has=Mz;Gs.prototype.set=Ez;var Tz=il(cs,"Map");const Sh=Tz;function Az(){this.size=0,this.__data__={hash:new ka,map:new(Sh||Gs),string:new ka}}function Cz(n){var e=typeof n;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?n!=="__proto__":n===null}function bm(n,e){var t=n.__data__;return Cz(e)?t[typeof e=="string"?"string":"hash"]:t.map}function Pz(n){var e=bm(this,n).delete(n);return this.size-=e?1:0,e}function Rz(n){return bm(this,n).get(n)}function Lz(n){return bm(this,n).has(n)}function Oz(n,e){var t=bm(this,n),i=t.size;return t.set(n,e),this.size+=t.size==i?0:1,this}function Bo(n){var e=-1,t=n==null?0:n.length;for(this.clear();++e<t;){var i=n[e];this.set(i[0],i[1])}}Bo.prototype.clear=Az;Bo.prototype.delete=Pz;Bo.prototype.get=Rz;Bo.prototype.has=Lz;Bo.prototype.set=Oz;var Iz="Expected a function";function Ey(n,e){if(typeof n!="function"||e!=null&&typeof e!="function")throw new TypeError(Iz);var t=function(){var i=arguments,r=e?e.apply(this,i):i[0],s=t.cache;if(s.has(r))return s.get(r);var o=n.apply(this,i);return t.cache=s.set(r,o)||s,o};return t.cache=new(Ey.Cache||Bo),t}Ey.Cache=Bo;var Dz=500;function Uz(n){var e=Ey(n,function(i){return t.size===Dz&&t.clear(),i}),t=e.cache;return e}var Nz=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Fz=/\\(\\)?/g,kz=Uz(function(n){var e=[];return n.charCodeAt(0)===46&&e.push(""),n.replace(Nz,function(t,i,r,s){e.push(r?s.replace(Fz,"$1"):i||t)}),e});const Bz=kz;function zz(n){return n==null?"":EC(n)}function Ty(n,e){return tl(n)?n:oz(n,e)?[n]:Bz(zz(n))}var Vz=1/0;function BC(n){if(typeof n=="string"||by(n))return n;var e=n+"";return e=="0"&&1/n==-Vz?"-0":e}function Hz(n,e){e=Ty(e,n);for(var t=0,i=e.length;n!=null&&t<i;)n=n[BC(e[t++])];return t&&t==i?n:void 0}function Ay(n,e){for(var t=-1,i=e.length,r=n.length;++t<i;)n[r+t]=e[t];return n}var b1=es?es.isConcatSpreadable:void 0;function Gz(n){return tl(n)||IC(n)||!!(b1&&n&&n[b1])}function zC(n,e,t,i,r){var s=-1,o=n.length;for(t||(t=Gz),r||(r=[]);++s<o;){var a=n[s];e>0&&t(a)?e>1?zC(a,e-1,t,i,r):Ay(r,a):i||(r[r.length]=a)}return r}function Wz(n){var e=n==null?0:n.length;return e?zC(n,1):[]}function $z(n){return Q4(o5(n,void 0,Wz),n+"")}var jz=kC(Object.getPrototypeOf,Object);const Cy=jz;var Xz="[object Object]",Yz=Function.prototype,qz=Object.prototype,VC=Yz.toString,Kz=qz.hasOwnProperty,Zz=VC.call(Object);function Jz(n){if(!el(n)||Qa(n)!=Xz)return!1;var e=Cy(n);if(e===null)return!0;var t=Kz.call(e,"constructor")&&e.constructor;return typeof t=="function"&&t instanceof t&&VC.call(t)==Zz}function Qz(n,e,t){var i=-1,r=n.length;e<0&&(e=-e>r?0:r+e),t=t>r?r:t,t<0&&(t+=r),r=e>t?0:t-e>>>0,e>>>=0;for(var s=Array(r);++i<r;)s[i]=n[i+e];return s}function eV(){this.__data__=new Gs,this.size=0}function tV(n){var e=this.__data__,t=e.delete(n);return this.size=e.size,t}function nV(n){return this.__data__.get(n)}function iV(n){return this.__data__.has(n)}var rV=200;function sV(n,e){var t=this.__data__;if(t instanceof Gs){var i=t.__data__;if(!Sh||i.length<rV-1)return i.push([n,e]),this.size=++t.size,this;t=this.__data__=new Bo(i)}return t.set(n,e),this.size=t.size,this}function zc(n){var e=this.__data__=new Gs(n);this.size=e.size}zc.prototype.clear=eV;zc.prototype.delete=tV;zc.prototype.get=nV;zc.prototype.has=iV;zc.prototype.set=sV;function oV(n,e){return n&&od(e,Sy(e),n)}function aV(n,e){return n&&od(e,My(e),n)}var HC=typeof exports=="object"&&exports&&!exports.nodeType&&exports,x1=HC&&typeof module=="object"&&module&&!module.nodeType&&module,lV=x1&&x1.exports===HC,w1=lV?cs.Buffer:void 0,S1=w1?w1.allocUnsafe:void 0;function cV(n,e){if(e)return n.slice();var t=n.length,i=S1?S1(t):new n.constructor(t);return n.copy(i),i}function uV(n,e){for(var t=-1,i=n==null?0:n.length,r=0,s=[];++t<i;){var o=n[t];e(o,t,n)&&(s[r++]=o)}return s}function GC(){return[]}var hV=Object.prototype,dV=hV.propertyIsEnumerable,M1=Object.getOwnPropertySymbols,fV=M1?function(n){return n==null?[]:(n=Object(n),uV(M1(n),function(e){return dV.call(n,e)}))}:GC;const Py=fV;function pV(n,e){return od(n,Py(n),e)}var mV=Object.getOwnPropertySymbols,gV=mV?function(n){for(var e=[];n;)Ay(e,Py(n)),n=Cy(n);return e}:GC;const WC=gV;function vV(n,e){return od(n,WC(n),e)}function $C(n,e,t){var i=e(n);return tl(n)?i:Ay(i,t(n))}function _V(n){return $C(n,Sy,Py)}function jC(n){return $C(n,My,WC)}var yV=il(cs,"DataView");const M0=yV;var bV=il(cs,"Promise");const E0=bV;var xV=il(cs,"Set");const T0=xV;var E1="[object Map]",wV="[object Object]",T1="[object Promise]",A1="[object Set]",C1="[object WeakMap]",P1="[object DataView]",SV=nl(M0),MV=nl(Sh),EV=nl(E0),TV=nl(T0),AV=nl(S0),fa=Qa;(M0&&fa(new M0(new ArrayBuffer(1)))!=P1||Sh&&fa(new Sh)!=E1||E0&&fa(E0.resolve())!=T1||T0&&fa(new T0)!=A1||S0&&fa(new S0)!=C1)&&(fa=function(n){var e=Qa(n),t=e==wV?n.constructor:void 0,i=t?nl(t):"";if(i)switch(i){case SV:return P1;case MV:return E1;case EV:return T1;case TV:return A1;case AV:return C1}return e});const Ry=fa;var CV=Object.prototype,PV=CV.hasOwnProperty;function RV(n){var e=n.length,t=new n.constructor(e);return e&&typeof n[0]=="string"&&PV.call(n,"index")&&(t.index=n.index,t.input=n.input),t}var LV=cs.Uint8Array;const R1=LV;function Ly(n){var e=new n.constructor(n.byteLength);return new R1(e).set(new R1(n)),e}function OV(n,e){var t=e?Ly(n.buffer):n.buffer;return new n.constructor(t,n.byteOffset,n.byteLength)}var IV=/\w*$/;function DV(n){var e=new n.constructor(n.source,IV.exec(n));return e.lastIndex=n.lastIndex,e}var L1=es?es.prototype:void 0,O1=L1?L1.valueOf:void 0;function UV(n){return O1?Object(O1.call(n)):{}}function NV(n,e){var t=e?Ly(n.buffer):n.buffer;return new n.constructor(t,n.byteOffset,n.length)}var FV="[object Boolean]",kV="[object Date]",BV="[object Map]",zV="[object Number]",VV="[object RegExp]",HV="[object Set]",GV="[object String]",WV="[object Symbol]",$V="[object ArrayBuffer]",jV="[object DataView]",XV="[object Float32Array]",YV="[object Float64Array]",qV="[object Int8Array]",KV="[object Int16Array]",ZV="[object Int32Array]",JV="[object Uint8Array]",QV="[object Uint8ClampedArray]",e6="[object Uint16Array]",t6="[object Uint32Array]";function n6(n,e,t){var i=n.constructor;switch(e){case $V:return Ly(n);case FV:case kV:return new i(+n);case jV:return OV(n,t);case XV:case YV:case qV:case KV:case ZV:case JV:case QV:case e6:case t6:return NV(n,t);case BV:return new i;case zV:case GV:return new i(n);case VV:return DV(n);case HV:return new i;case WV:return UV(n)}}function i6(n){return typeof n.constructor=="function"&&!xy(n)?V4(Cy(n)):{}}var r6="[object Map]";function s6(n){return el(n)&&Ry(n)==r6}var I1=Sc&&Sc.isMap,o6=I1?wy(I1):s6;const a6=o6;var l6="[object Set]";function c6(n){return el(n)&&Ry(n)==l6}var D1=Sc&&Sc.isSet,u6=D1?wy(D1):c6;const h6=u6;var d6=1,f6=2,p6=4,XC="[object Arguments]",m6="[object Array]",g6="[object Boolean]",v6="[object Date]",_6="[object Error]",YC="[object Function]",y6="[object GeneratorFunction]",b6="[object Map]",x6="[object Number]",qC="[object Object]",w6="[object RegExp]",S6="[object Set]",M6="[object String]",E6="[object Symbol]",T6="[object WeakMap]",A6="[object ArrayBuffer]",C6="[object DataView]",P6="[object Float32Array]",R6="[object Float64Array]",L6="[object Int8Array]",O6="[object Int16Array]",I6="[object Int32Array]",D6="[object Uint8Array]",U6="[object Uint8ClampedArray]",N6="[object Uint16Array]",F6="[object Uint32Array]",Vt={};Vt[XC]=Vt[m6]=Vt[A6]=Vt[C6]=Vt[g6]=Vt[v6]=Vt[P6]=Vt[R6]=Vt[L6]=Vt[O6]=Vt[I6]=Vt[b6]=Vt[x6]=Vt[qC]=Vt[w6]=Vt[S6]=Vt[M6]=Vt[E6]=Vt[D6]=Vt[U6]=Vt[N6]=Vt[F6]=!0;Vt[_6]=Vt[YC]=Vt[T6]=!1;function op(n,e,t,i,r,s){var o,a=e&d6,l=e&f6,c=e&p6;if(t&&(o=r?t(n,i,r,s):t(n)),o!==void 0)return o;if(!sd(n))return n;var u=tl(n);if(u){if(o=RV(n),!a)return G4(n,o)}else{var h=Ry(n),d=h==YC||h==y6;if(UC(n))return cV(n,a);if(h==qC||h==XC||d&&!r){if(o=l||d?{}:i6(n),!a)return l?vV(n,aV(o,n)):pV(n,oV(o,n))}else{if(!Vt[h])return r?n:{};o=n6(n,h,a)}}s||(s=new zc);var f=s.get(n);if(f)return f;s.set(n,o),h6(n)?n.forEach(function(m){o.add(op(m,e,t,m,n,s))}):a6(n)&&n.forEach(function(m,g){o.set(g,op(m,e,t,g,n,s))});var p=c?l?jC:_V:l?My:Sy,v=u?void 0:p(n);return e5(v||n,function(m,g){v&&(g=m,m=n[g]),PC(o,g,op(m,e,t,g,n,s))}),o}function k6(n){var e=n==null?0:n.length;return e?n[e-1]:void 0}function B6(n,e){return e.length<2?n:Hz(n,Qz(e,0,-1))}function z6(n,e){return e=Ty(e,n),n=B6(n,e),n==null||delete n[BC(k6(e))]}function V6(n){return Jz(n)?void 0:n}var H6=1,G6=2,W6=4;$z(function(n,e){var t={};if(n==null)return t;var i=!1;e=MC(e,function(s){return s=Ty(s,n),i||(i=s.length>1),s}),od(n,jC(n),t),i&&(t=op(t,H6|G6|W6,V6));for(var r=e.length;r--;)z6(t,e[r]);return t});function mre(n){return n}const Ds=()=>{},$6=()=>document.body,j6=(()=>{const n=function(e){return setTimeout(()=>{e==null||e()},10)};return typeof window<"u"&&window.requestAnimationFrame||n})(),Op=n=>{if(a1(n))return"".concat(n,"px");if(a1(Number(n)))return"".concat(Number(n),"px");if(!(_C(n)||WB(n)))return n};function X6(n){return n.nodeType===9?null:n.parentNode}function KC(n){if(n==null)return null;const e=X6(n);if(e===null)return null;if(e.nodeType===9)return document;if(e.nodeType===1){const{overflow:t,overflowX:i,overflowY:r}=getComputedStyle(e);if(/(auto|scroll|overlay)/.test(t+r+i))return e}return KC(e)}function Y6(n,e){const t=n.length,i=e.length;n.length=t+i;for(let r=0;r<i;r++)n[t+r]=e[r];return n}function Ur(n,e,t){const i=n;if(i.install=r=>{for(const s of[n,...Object.values(e!=null?e:{})])r.component(s.name,s);if(t)for(const s of t)r.directive(s.name,s)},e)for(const[r,s]of Object.entries(e))i[r]=s;return i}function zo(n){const e=n;return e.install=Ds,e}const U1="fes";function Qt(n){return n?"".concat(U1,"-").concat(n):U1}const N1="fes-design-icon",q6={spin:Boolean,rotate:[String,Number],tabIndex:Number,size:Number,color:String};var hi=Xe({name:"FIconWrapper",props:q6,setup(n,e){let{slots:t,attrs:i}=e;const r=Te(()=>{let a=n.tabIndex;return a==null&&i.onClick&&(a=-1),a}),s=Te(()=>[n.rotate&&{transform:"rotate(".concat(n.rotate,"deg)")},!vy(n.size)&&{fontSize:"".concat(n.size,"px")},n.color&&{color:n.color}]),o=Te(()=>[{[N1]:!0,["".concat(N1,"--spin")]:!!n.spin}]);return()=>ie("span",{tabindex:r.value,role:"img",class:o.value,style:s.value,onClick:i.onClick||Ds},[t.default&&t.default()])}});var K6=n=>ie(hi,n,{default:()=>[ie("svg",{width:"200",height:"200",viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg"},[ie("path",{d:"M512 42.667C771.2 42.667 981.333 252.8 981.333 512S771.2 981.333 512 981.333 42.667 771.2 42.667 512 252.8 42.667 512 42.667zm0 64a405.333 405.333 0 1 0 0 810.666 405.333 405.333 0 0 0 0-810.666zm140.288 243.925 21.12 21.12a17.067 17.067 0 0 1 0 24.15L557.269 512l116.139 116.139a17.067 17.067 0 0 1 0 24.149l-21.12 21.12a17.067 17.067 0 0 1-24.15 0L512 557.269 395.861 673.408a17.067 17.067 0 0 1-24.149 0l-21.12-21.12a17.067 17.067 0 0 1 0-24.15L466.731 512 350.592 395.861a17.067 17.067 0 0 1 0-24.149l21.12-21.12a17.067 17.067 0 0 1 24.15 0L512 466.731l116.139-116.139a17.067 17.067 0 0 1 24.149 0z"},null)])]});const xm="update:modelValue",F1="change",Ip="close",k1="ok",B1="cancel",z1=Symbol("FFormItemKey");function Z6(n,e){if(n==null)return{};var t={},i=Object.keys(n),r,s;for(s=0;s<i.length;s++)r=i[s],!(e.indexOf(r)>=0)&&(t[r]=n[r]);return t}function ZC(n,e){if(n==null)return{};var t=Z6(n,e),i,r;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(n);for(r=0;r<s.length;r++)i=s[r],!(e.indexOf(i)>=0)&&Object.prototype.propertyIsEnumerable.call(n,i)&&(t[i]=n[i])}return t}var gre=n=>ie(hi,n,{default:()=>[ie("svg",{width:"200",height:"200",viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg"},[ie("path",{d:"M458.453 544.128a21.333 21.333 0 0 1 21.334 21.333v341.163a21.333 21.333 0 0 1-21.334 21.333h-341.12A21.333 21.333 0 0 1 96 906.624V565.461a21.333 21.333 0 0 1 21.333-21.333h341.12zm448.171 0a21.333 21.333 0 0 1 21.333 21.333v341.163a21.333 21.333 0 0 1-21.333 21.333H565.461a21.333 21.333 0 0 1-21.333-21.333V565.461a21.333 21.333 0 0 1 21.333-21.333h341.163zm-490.837 64H160v255.787h255.787V608.128zm448.17 0H608.128v255.787h255.83V608.128zM458.453 96a21.333 21.333 0 0 1 21.334 21.333v341.163a21.333 21.333 0 0 1-21.334 21.333h-341.12A21.333 21.333 0 0 1 96 458.496V117.333A21.333 21.333 0 0 1 117.333 96h341.12zm448.171 0a21.333 21.333 0 0 1 21.333 21.333v341.163a21.333 21.333 0 0 1-21.333 21.333H565.461a21.333 21.333 0 0 1-21.333-21.333V117.333A21.333 21.333 0 0 1 565.461 96h341.163zm-490.837 64H160v255.787h255.787V160zm448.17 0H608.128v255.787h255.83V160z"},null)])]}),J6=n=>ie(hi,n,{default:()=>[ie("svg",{width:"200",height:"200",viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg"},[ie("path",{d:"M512 42.667C771.2 42.667 981.333 252.8 981.333 512S771.2 981.333 512 981.333 42.667 771.2 42.667 512 252.8 42.667 512 42.667zm180.821 265.472a21.333 21.333 0 0 0-26.709 5.845l-220.16 283.733-88.064-113.493a21.333 21.333 0 0 0-29.91-3.755l-16.853 13.056a21.333 21.333 0 0 0-3.84 29.952l121.771 156.928a21.333 21.333 0 0 0 33.707 0l253.909-327.168a21.333 21.333 0 0 0-3.755-29.952l-16.853-13.056z"},null)])]}),Q6=n=>ie(hi,n,{default:()=>[ie("svg",{width:"200",height:"200",viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg"},[ie("path",{d:"m685.312 445.568-253.91 327.168a21.333 21.333 0 0 1-33.706 0L275.968 615.808a21.333 21.333 0 0 1 3.797-29.91L296.62 572.8a21.333 21.333 0 0 1 29.909 3.797l88.064 113.494 220.16-283.734a21.333 21.333 0 0 1 29.952-3.797l16.853 13.099a21.333 21.333 0 0 1 3.755 29.909zm158.72-204.757L431.445 772.65a21.333 21.333 0 0 1-33.706-.128L152.02 452.437a21.333 21.333 0 0 1 3.84-29.866l16.854-13.014a21.333 21.333 0 0 1 30.037 3.84l211.84 276.651L793.472 201.6a21.333 21.333 0 0 1 29.952-3.797l16.853 13.098a21.333 21.333 0 0 1 3.755 29.91z"},null)])]}),JC=n=>ie(hi,n,{default:()=>[ie("svg",{width:"200",height:"200",viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg"},[ie("path",{d:"M512 42.667C771.2 42.667 981.333 252.8 981.333 512S771.2 981.333 512 981.333 42.667 771.2 42.667 512 252.8 42.667 512 42.667zm140.288 307.925a17.067 17.067 0 0 0-24.15 0L512 466.731 395.861 350.592a17.067 17.067 0 0 0-24.149 0l-21.12 21.12a17.067 17.067 0 0 0 0 24.15L466.731 512 350.592 628.139a17.067 17.067 0 0 0 0 24.149l21.12 21.12a17.067 17.067 0 0 0 24.15 0L512 557.227l116.139 116.181a17.067 17.067 0 0 0 24.149 0l21.12-21.12a17.067 17.067 0 0 0 0-24.15L557.227 512l116.181-116.139a17.067 17.067 0 0 0 0-24.149z"},null)])]}),eH=n=>ie(hi,n,{default:()=>[ie("svg",{width:"200",height:"200",viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg"},[ie("path",{d:"m158.464 314.581 336.64 434.048a21.333 21.333 0 0 0 33.75 0l336.682-434.048a21.333 21.333 0 0 0-3.755-29.952l-16.896-13.056a21.333 21.333 0 0 0-27.306.939l-2.603 2.859L512 665.984 209.067 275.371a21.333 21.333 0 0 0-26.71-5.888l-3.242 2.09-16.896 13.056a21.333 21.333 0 0 0-3.755 29.952z"},null)])]}),QC=n=>ie(hi,n,{default:()=>[ie("svg",{width:"200",height:"200",viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg"},[ie("path",{d:"M512 42.667C771.2 42.667 981.333 252.8 981.333 512S771.2 981.333 512 981.333 42.667 771.2 42.667 512 252.8 42.667 512 42.667zm0 626.474a42.667 42.667 0 1 0 0 85.334 42.667 42.667 0 0 0 0-85.334zm10.667-417.365h-21.334A21.333 21.333 0 0 0 480 273.109v311.979a21.333 21.333 0 0 0 21.333 21.333h21.334A21.333 21.333 0 0 0 544 585.088V273.067a21.333 21.333 0 0 0-21.333-21.334z"},null)])]}),tH=n=>ie(hi,n,{default:()=>[ie("svg",{width:"200",height:"200",viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg"},[ie("path",{d:"M512 981.333C252.8 981.333 42.667 771.2 42.667 512S252.8 42.667 512 42.667 981.333 252.8 981.333 512 771.2 981.333 512 981.333zm0-626.474a42.667 42.667 0 1 0 0-85.334 42.667 42.667 0 0 0 0 85.334zm-10.667 417.365h21.334a21.333 21.333 0 0 0 20.992-17.493l.341-3.84V438.912a21.333 21.333 0 0 0-17.493-20.992l-3.84-.341h-21.334a21.333 21.333 0 0 0-20.992 17.493l-.341 3.84v312.021a21.333 21.333 0 0 0 17.493 20.992l3.84.342z"},null)])]}),nH=n=>ie(hi,n,{default:()=>[ie("svg",{width:"200",height:"200",viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg"},[ie("path",{d:"M709.419 865.536 275.37 528.896a21.333 21.333 0 0 1 0-33.75l434.048-336.682a21.333 21.333 0 0 1 29.952 3.755l13.056 16.896a21.333 21.333 0 0 1-.939 27.306l-2.859 2.603L358.016 512l390.613 302.933a21.333 21.333 0 0 1 5.888 26.71l-2.09 3.242-13.056 16.896a21.333 21.333 0 0 1-29.952 3.755z"},null)])]}),e2=n=>ie(hi,Cr(n,{spin:!0}),{default:()=>[ie("svg",{viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg",width:"200",height:"200"},[ie("path",{d:"M512 42.453q42.667 0 42.667 42.667v128q0 42.667-42.667 42.667t-42.667-42.667v-128q0-42.667 42.667-42.667Z","fill-opacity":".7"},null),ie("path",{d:"M512 768.213q42.667 0 42.667 42.667v128q0 42.667-42.667 42.667t-42.667-42.667v-128q0-42.667 42.667-42.667Z","fill-opacity":".2"},null),ie("path",{d:"M42.667 511.787q0-42.667 42.666-42.667h128q42.667 0 42.667 42.667 0 42.666-42.667 42.666h-128q-42.666 0-42.666-42.666Z","fill-opacity":".4"},null),ie("path",{d:"M768 511.787q0-42.667 42.667-42.667h128q42.666 0 42.666 42.667 0 42.666-42.666 42.666h-128q-42.667 0-42.667-42.666Z"},null),ie("path",{d:"M179.978 179.978q30.17-30.17 60.34 0l90.51 90.51q30.17 30.17 0 60.34t-60.34 0l-90.51-90.51q-30.17-30.17 0-60.34Z","fill-opacity":".55"},null),ie("path",{d:"M693.173 693.172q30.17-30.17 60.34 0l90.51 90.51q30.169 30.17 0 60.34-30.17 30.17-60.34 0l-90.51-90.51q-30.17-30.17 0-60.34Z","fill-opacity":".1"},null),ie("path",{d:"M179.978 843.723q-30.17-30.17 0-60.34l90.51-90.51q30.17-30.169 60.34 0 30.17 30.17 0 60.34l-90.51 90.51q-30.17 30.17-60.34 0Z","fill-opacity":".3"},null),ie("path",{d:"M692.874 330.827q-30.17-30.17 0-60.34l90.51-90.51q30.17-30.169 60.34 0 30.17 30.17 0 60.34l-90.51 90.51q-30.17 30.17-60.34 0Z","fill-opacity":".85"},null)])]}),vre=n=>ie(hi,n,{default:()=>[ie("svg",{width:"200",height:"200",viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg"},[ie("path",{d:"M756.224 512a55.979 55.979 0 1 1 112 0 55.979 55.979 0 0 1-112 0zm-300.245 0a56.021 56.021 0 1 1 112.042 0 56.021 56.021 0 0 1-112.042 0zm-300.203 0a56.021 56.021 0 1 1 112 0 56.021 56.021 0 0 1-112 0z"},null)])]}),_re=n=>ie(hi,n,{default:()=>[ie("svg",{width:"200",height:"200",viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg"},[ie("path",{d:"M960 149.419a21.333 21.333 0 0 1 21.333 21.333v682.496A21.333 21.333 0 0 1 960 874.581H64a21.333 21.333 0 0 1-21.333-21.333V170.752A21.333 21.333 0 0 1 64 149.419h896zM670.464 475.86 438.869 748.245a21.333 21.333 0 0 1-32.682-.17l-140.075-168.96-159.488 187.861v43.563h810.71v-43.52L670.463 475.86zm246.87-262.4H106.666v454.571l143.616-169.088a21.333 21.333 0 0 1 32.682.213l139.99 168.918L654.25 396.16a21.333 21.333 0 0 1 32.512 0l230.57 271.83V213.418zM416 277.333a96 96 0 1 1 0 192 96 96 0 0 1 0-192zm0 64a32 32 0 1 0 0 64 32 32 0 0 0 0-64z"},null)])]}),iH=n=>ie(hi,n,{default:()=>[ie("svg",{width:"200",height:"200",viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg"},[ie("path",{d:"M544 117.333v362.624l362.667.043A21.333 21.333 0 0 1 928 501.333v21.334A21.333 21.333 0 0 1 906.667 544H544v362.667A21.333 21.333 0 0 1 522.667 928h-21.334A21.333 21.333 0 0 1 480 906.667V544H117.333A21.333 21.333 0 0 1 96 522.667v-21.334A21.333 21.333 0 0 1 117.333 480L480 479.957V117.333A21.333 21.333 0 0 1 501.333 96h21.334A21.333 21.333 0 0 1 544 117.333z"},null)])]}),yre=n=>ie(hi,n,{default:()=>[ie("svg",{width:"200",height:"200",viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg"},[ie("path",{d:"M512 95.915a414.848 414.848 0 0 1 297.472 125.141V117.461a21.333 21.333 0 0 1 21.333-21.333h21.334a21.333 21.333 0 0 1 21.333 21.333v214.614a21.333 21.333 0 0 1-21.333 21.333H637.525a21.333 21.333 0 0 1-21.333-21.333V310.74a21.333 21.333 0 0 1 21.333-21.333h147.286A352.085 352.085 0 1 0 864.128 512l-.47-14.464-.34-5.845a21.333 21.333 0 0 1 16.085-22.102l4.48-.597h22.101a21.333 21.333 0 0 1 21.333 20.053l.726 18.176.042 4.779c0 229.803-186.282 416.085-416.085 416.085-229.803 0-416.085-186.282-416.085-416.085C95.915 282.197 282.197 95.915 512 95.915z"},null)])]}),t2=n=>ie(hi,n,{default:()=>[ie("svg",{width:"200",height:"200",viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg"},[ie("path",{d:"m314.581 865.536 434.048-336.64a21.333 21.333 0 0 0 0-33.75L314.581 158.465a21.333 21.333 0 0 0-29.952 3.755l-13.056 16.896a21.333 21.333 0 0 0 .939 27.306l2.859 2.603L665.984 512 275.371 814.933a21.333 21.333 0 0 0-5.888 26.71l2.09 3.242 13.056 16.896a21.333 21.333 0 0 0 29.952 3.755z"},null)])]}),V1;const n2=typeof window<"u",rH=n=>typeof n=="string",sH=()=>{};n2&&((V1=window==null?void 0:window.navigator)!=null&&V1.userAgent)&&/iP(ad|hone|od)/.test(window.navigator.userAgent);function i2(n){return typeof n=="function"?n():Se(n)}function oH(n){return n}function r2(n){return rm()?(W_(n),!0):!1}function aH(n){let e=0,t,i;const r=()=>{e-=1,i&&e<=0&&(i.stop(),t=void 0,i=void 0)};return(...s)=>(e+=1,t||(i=jL(!0),t=i.run(()=>n(...s))),r2(r),t)}function lH(n){var e;const t=i2(n);return(e=t==null?void 0:t.$el)!=null?e:t}const cH=n2?window:void 0;function cu(...n){let e,t,i,r;if(rH(n[0])||Array.isArray(n[0])?([t,i,r]=n,e=cH):[e,t,i,r]=n,!e)return sH;Array.isArray(t)||(t=[t]),Array.isArray(i)||(i=[i]);const s=[],o=()=>{s.forEach(u=>u()),s.length=0},a=(u,h,d,f)=>(u.addEventListener(h,d,f),()=>u.removeEventListener(h,d,f)),l=ft(()=>[lH(e),i2(r)],([u,h])=>{o(),u&&s.push(...t.flatMap(d=>i.map(f=>a(u,d,f,h))))},{immediate:!0,flush:"post"}),c=()=>{l(),o()};return r2(c),c}const H1=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},G1="__vueuse_ssr_handlers__";H1[G1]=H1[G1]||{};var W1;(function(n){n.UP="UP",n.RIGHT="RIGHT",n.DOWN="DOWN",n.LEFT="LEFT",n.NONE="NONE"})(W1||(W1={}));var uH=Object.defineProperty,$1=Object.getOwnPropertySymbols,hH=Object.prototype.hasOwnProperty,dH=Object.prototype.propertyIsEnumerable,j1=(n,e,t)=>e in n?uH(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,fH=(n,e)=>{for(var t in e||(e={}))hH.call(e,t)&&j1(n,t,e[t]);if($1)for(var t of $1(e))dH.call(e,t)&&j1(n,t,e[t]);return n};const pH={easeInSine:[.12,0,.39,0],easeOutSine:[.61,1,.88,1],easeInOutSine:[.37,0,.63,1],easeInQuad:[.11,0,.5,0],easeOutQuad:[.5,1,.89,1],easeInOutQuad:[.45,0,.55,1],easeInCubic:[.32,0,.67,0],easeOutCubic:[.33,1,.68,1],easeInOutCubic:[.65,0,.35,1],easeInQuart:[.5,0,.75,0],easeOutQuart:[.25,1,.5,1],easeInOutQuart:[.76,0,.24,1],easeInQuint:[.64,0,.78,0],easeOutQuint:[.22,1,.36,1],easeInOutQuint:[.83,0,.17,1],easeInExpo:[.7,0,.84,0],easeOutExpo:[.16,1,.3,1],easeInOutExpo:[.87,0,.13,1],easeInCirc:[.55,0,1,.45],easeOutCirc:[0,.55,.45,1],easeInOutCirc:[.85,0,.15,1],easeInBack:[.36,0,.66,-.56],easeOutBack:[.34,1.56,.64,1],easeInOutBack:[.68,-.6,.32,1.6]};fH({linear:oH},pH);const mH=Symbol("ConfigProvider");function s2(){return An()?Zt(mH,{getContainer:xe($6)}):{}}function Mh(n){"@babel/helpers - typeof";return Mh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Mh(n)}function gH(n,e){if(Mh(n)!=="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var i=t.call(n,e||"default");if(Mh(i)!=="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function vH(n){var e=gH(n,"string");return Mh(e)==="symbol"?e:String(e)}function Rr(n,e,t){return e=vH(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function ap(n,e){return Math.min(Math.max(n,0),e)}function X1(n){return"#".concat(n.map(e=>(e=ap(Math.round(e),255),(e<16?"0":"")+e.toString(16))).join(""))}let ac=class{constructor(e,t,i){Rr(this,"alpha",0),Rr(this,"value",""),Array.isArray(e)?this.rgb=e:e.length>=6?(this.rgb=[],e.match(/.{2}/g).forEach((r,s)=>{s<3?this.rgb.push(parseInt(r,16)):this.alpha=parseInt(r,16)/255})):(this.rgb=[],e.split("").forEach((r,s)=>{s<3?this.rgb.push(parseInt(r+r,16)):this.alpha=parseInt(r+r,16)/255})),this.alpha=this.alpha||(typeof t=="number"?t:1),typeof i<"u"&&(this.value=i)}toRGB(){return X1(this.rgb)}toCSS(e){let t,i="",r=[];const s=this.alpha;if(this.value)if(this.value.indexOf("rgb")===0)s<1&&(i="rgba");else if(this.value.indexOf("hsl")===0)s<1?i="hsla":i="hsl";else return this.value;else s<1&&(i="rgba");switch(i){case"rgba":r=this.rgb.map(o=>ap(Math.round(o),255)).concat(ap(s,1));break;case"hsla":r.push(ap(s,1))}if(i)return"".concat(i,"(").concat(r.join(",".concat(e?"":" ")),")");if(t=this.toRGB(),e){const o=t.split("");o[1]===o[2]&&o[3]===o[4]&&o[5]===o[6]&&(t="#".concat(o[1]).concat(o[3]).concat(o[5]))}return t}toHex(){return X1(this.rgb)}toHSL(){const e=this.rgb[0]/255,t=this.rgb[1]/255,i=this.rgb[2]/255,r=this.alpha,s=Math.max(e,t,i),o=Math.min(e,t,i);let a=0,l;const c=(s+o)/2,u=s-o;if(s===o)a=l=0;else{switch(l=c>.5?u/(2-s-o):u/(s+o),s){case e:a=(t-i)/u+(t<i?6:0);break;case t:a=(i-e)/u+2;break;case i:a=(e-t)/u+4;break}a/=6}return{h:a*360,s:l,l:c,a:r}}};function lp(n){return Math.min(1,Math.max(0,n))}function _H(n,e,t,i){let r,s;function o(l){return l=l<0?l+1:l>1?l-1:l,l*6<1?r+(s-r)*l*6:l*2<1?s:l*3<2?r+(s-r)*(2/3-l)*6:r}n=n%360/360,e=lp(e),t=lp(t),i=lp(i),s=t<=.5?t*(e+1):t+e-t*e,r=t*2-s;const a=[o(n+1/3)*255,o(n)*255,o(n-1/3)*255];return new ac(a,i,"hsla")}function yH(n,e){const t=_H(e.h,e.s,e.l,e.a);return n.value&&/^(rgb|hsl)/.test(n.value)?t.value=n.value:t.value="rgb",t}function bH(n,e,t,i){if(n instanceof ac)return e?i=e:i=n.alpha,new ac(n.rgb,i,"rgba");const r=[n,e,t];return new ac(r,i,"rgba")}function o2(n,e,t){const r=bH(n,e,t,1);return r.value="rgb",r}function A0(n){if(n.toHSL)return n.toHSL();throw new Error("Argument cannot be evaluated to a color")}function a2(n,e,t){const i=t,r=i*2-1,s=A0(n).a-A0(e).a,o=((r*s===-1?r:(r+s)/(1+r*s))+1)/2,a=1-o,l=[n.rgb[0]*o+e.rgb[0]*a,n.rgb[1]*o+e.rgb[1]*a,n.rgb[2]*o+e.rgb[2]*a],c=n.alpha*i+e.alpha*(1-i);return new ac(l,c).toHex()}function Oy(n){const e=n.match(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})/);return new ac(e[1],void 0,n)}function wa(n,e){const t=Oy(n),i=A0(t);return i.a=e,i.a=lp(i.a),yH(t,i).toCSS()}function un(n,e){const t=Oy(n);return a2(o2(255,255,255),t,e)}function jd(n,e){const t=Oy(n);return a2(o2(0,0,0),t,e)}function Y1(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(n);e&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(n,r).enumerable})),t.push.apply(t,i)}return t}function q1(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Y1(Object(t),!0).forEach(function(i){Rr(n,i,t[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Y1(Object(t)).forEach(function(i){Object.defineProperty(n,i,Object.getOwnPropertyDescriptor(t,i))})}return n}function xH(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"#0f1222";return{primaryColor:"#5384ff",successColor:"#00cb91",dangerColor:"#ff4d4f",warningColor:"#f29360",tipColor:"#5384ff",white:"#fff",black:"#000",bodyBgColor:"#fff",fontColorBase:n,fontSizeBase:"14px",borderRadiusBase:"4px",borderRadiusSm:"2px",borderWidthBase:"1px",borderStyleBase:"solid",borderColorBase:un(n,.8),shadowColor:wa(n,.1),shadowColorSm:wa(n,.2),shadowRadius:"12px",shadowRadiusSm:"4px",maskColor:wa(n,.45),maskDarkColor:wa(n,.9),paddingLarge:"24px",paddingMiddle:"16px",paddingSmall:"12px",paddingXsmall:"8px"}}const l2=function(){var n;let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const t=Object.assign(xH((n=e.common)===null||n===void 0?void 0:n.fontColorBase),e.common);return q1(q1({},t),{},{linkColor:t.primaryColor,componentBgColor:un(t.fontColorBase,.97),hoverColorBase:un(t.primaryColor,.2),hoverColorLight:un(t.primaryColor,.94),hoverSuccessColor:un(t.successColor,.94),activeSuccessColor:jd(t.successColor,.06),hoverWarningColor:un(t.warningColor,.94),activeWarningColor:jd(t.warningColor,.06),hoverDangerColor:un(t.dangerColor,.94),activeDangerColor:jd(t.dangerColor,.06),activeColor:jd(t.primaryColor,.06),focusColor:t.primaryColor,focusShadowColor:un(t.primaryColor,.8),focusDangerShadowColor:un(t.dangerColor,.8),processingColor:un(t.primaryColor,.4),disabledColorBase:un(t.fontColorBase,.8),disabledColorLight:un(t.fontColorBase,.97),headColor:t.fontColorBase,subHeadColor:un(t.fontColorBase,.35),textColor:t.fontColorBase,textColorSecondary:un(t.fontColorBase,.55),textColorDisabled:un(t.fontColorBase,.7),textColorDisabledLight:un(t.fontColorBase,.8),textColorCaption:un(t.fontColorBase,.8),borderColorDisabled:un(t.fontColorBase,.8),borderColorSplit:un(t.fontColorBase,.94),borderColorInverse:t.white,borderBase:"".concat(t.borderWidthBase," ").concat(t.borderStyleBase," ").concat(t.borderColorBase),layoutInvertedBgColor:un(t.fontColorBase,.05),tooltipTextBgColor:un(t.fontColorBase,.3),selectTriggerIconColor:un(t.fontColorBase,.6),scrollbarBgColor:wa(t.fontColorBase,.25),scrollbarActiveColor:wa(t.fontColorBase,.65),carouselColor:t.shadowColorSm,carouselHoverColor:t.maskColor,carouselActiveColor:wa(t.fontColorBase,.65)},e.derivedColor)},wH="--f-";function SH(n,e,t){const i=l2(t),r=n||document.body;return Object.keys(i).forEach(s=>{r.style.setProperty("".concat(wH).concat(jB(s)),i[s])}),{themeVars:i}}function MH(){const n=s2(),e=xe(l2());return ft([()=>{var t;return(t=n.getContainer)===null||t===void 0?void 0:t.value},()=>{var t;return(t=n.theme)===null||t===void 0?void 0:t.value},()=>{var t;return(t=n.themeOverrides)===null||t===void 0?void 0:t.value}],t=>{let[i,r,s]=t;if(!i)return;const{themeVars:o}=SH(i(),r,s);e.value=o},{immediate:!0}),{config:n,themeVars:e}}const di=aH(MH);function c2(n){const e=Dp(n);return e.length===1?e[0]:(console.warn("getFirstSlotVNode","vNodes should have exactly one child"),null)}function C0(n){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"default",t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0;const i=n[e];return i===void 0?(console.warn("getSlot","slot[".concat(e,"] is empty.")),null):i(t)}function Dp(n){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],t=arguments.length>2?arguments[2]:void 0;return n.forEach(i=>{if(i!==null){if(typeof i!="object"){(typeof i=="string"||typeof i=="number")&&e.push(uy(String(i)));return}if(Array.isArray(i)){Dp(i,e);return}if(i.type===en){if(i.children===null)return;const r=t?"".concat(t,"_").concat(String(i.key)):String(i.key);Array.isArray(i.children)&&(i.children.forEach((s,o)=>{Ua(s)&&(s.key===void 0||s.key===null)&&(s.key="".concat(r,"_").concat(o))}),Dp(i.children,e,r))}else i.type!==li&&e.push(i)}}),e}const EH=["getContainer"];let TH=0;const AH=Date.now();function CH(){return"notice_manager_".concat(AH,"_").concat(TH++)}const PH=Xe({props:{maxCount:Number,transitionName:String},setup(n){const e=xe([]);function t(r){const s=e.value.findIndex(l=>l.key===r),o=e.value[s];if(o){var a;e.value.splice(s,1),(a=o.afterRemove)===null||a===void 0||a.call(o)}}function i(r){if(r.key||(r.key=CH()),n.maxCount&&e.value.length>=n.maxCount&&e.value.shift(),e.value.push(r),r.duration>0){const s=setTimeout(()=>{t(r.key),clearTimeout(s)},r.duration*1e3)}return r}return{notices:e,append:i,remove:t}},render(){const{notices:n,transitionName:e}=this,t=n.map(i=>{let r=typeof i.children=="function"?i.children():i.children;if(r=c2([r]),r)return Ar(r,{key:i.key})});return ie(py,{name:e,tag:"div"},{default:()=>[t]})}});function RH(n){return new Promise(e=>{const{getContainer:t}=n,i=ZC(n,EH),r=document.createElement("div");if(t){const o=t();o==null||o.appendChild(r)}else document.body.appendChild(r);const s=RA({setup(){di();const o=xe(),a={append:l=>o.value.append(l),remove:l=>o.value.remove(l),destroy(){s.unmount(),r.parentNode&&r.parentNode.removeChild(r)},exited(){if(!t)return!0;try{if(!t())return a.destroy(),!1}catch(l){return a.destroy(),!1}return!0}};return bn(()=>e(a)),()=>ie(PH,Cr({ref:o},i),null)}});s.mount(r)})}const K1={info:tH,success:J6,error:JC,warning:QC},Xi=Qt("alert"),LH={message:String,description:String,showIcon:Boolean,closable:Boolean,center:Boolean,type:{type:String,default:"info"},beforeClose:{type:Function,default:()=>!0}};var OH=Xe({name:"FAlert",props:LH,emits:[Ip],setup(n,e){di();const t=xe(!0);function i(o){var a;Promise.resolve((a=n.beforeClose)===null||a===void 0?void 0:a.call(n,o)).then(l=>{l&&(t.value=!1,e.emit(Ip))})}const r=Te(()=>["".concat(Xi,"-body"),n.showIcon&&!n.center&&"".concat(Xi,"-icon-padding")]),s=()=>{var o;return e.slots.icon?e.slots.icon():(o=K1[n.type])===null||o===void 0?void 0:o.call(K1)};return()=>{const{action:o,default:a,description:l}=e.slots,c=n.description||l?ie("div",{class:r.value},[l?l():n.description]):null;return ie(kc,{name:"".concat(Xi,"-fade-expand")},{default:()=>[t.value?ie("div",{class:"".concat(Xi," ").concat(n.center?"".concat(Xi,"-message-center"):""," ").concat(Xi,"-").concat(n.type)},[ie("div",{class:"".concat(Xi,"-head")},[ie("div",{class:"".concat(Xi,"-head-message")},[n.showIcon?ie("div",{class:"".concat(Xi,"-head-message-icon")},[s()]):null,ie("div",null,[a?a():n.message])]),ie("div",{class:"".concat(Xi,"-head-right")},[o?ie("div",{class:"".concat(Xi,"-head-right-action")},[o()]):null,n.closable?ie("div",{class:"".concat(Xi,"-head-right-close")},[ie(K6,{onClick:i},null)]):null])]),c]):null]})}}});function IH(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:300;const e=xe(!1),t=Te(()=>e.value?"is-animate":""),i=YB(()=>{e.value||(e.value=!0),setTimeout(()=>{e.value=!1},n)},100);return{animating:e,handelAnimate:i,animateClassName:t}}var DH=n=>{const e=n==null?void 0:n.valueType,t=n==null?void 0:n.forbidChildValidate,{validate:i,isError:r,setRuleDefaultType:s,isFormDisabled:o}=Zt(z1,{validate:Ds,isError:xe(!1),isFormDisabled:xe(!1)});return s&&e&&(vC(e)?s(e):yn(e)?ft(e,()=>{e.value&&s(e.value)},{immediate:!0}):Qr(e)&&s(e())),t&&Si(z1,{validate:Ds,isError:r,isFormDisabled:o}),{validate:i,isError:r,isFormDisabled:o}};const ku=Qt("btn"),UH="".concat(ku,"-loading-icon"),NH={disabled:{type:Boolean,default:!1},htmlType:{type:String,default:"button"},size:{type:String,default:"middle"},loading:{type:Boolean,default:!1},long:{type:Boolean,default:!1},throttle:{type:Number,default:300},type:{type:String,default:"default"}};var P0=Xe({name:"FButton",props:NH,emits:["click"],setup(n,e){let{slots:t,emit:i}=e;const{animateClassName:r,handelAnimate:s}=IH(400),{isFormDisabled:o}=DH();di();const a=xe(!1),l=u=>{a.value||n.disabled||n.loading||o.value||(s(),a.value=!0,setTimeout(()=>{a.value=!1},n.throttle),i("click",u))},c=Te(()=>[ku,r.value,"".concat(ku,"-type-").concat(n.type),n.long&&"".concat(ku,"-long"),n.size!=="middle"&&"".concat(ku,"-").concat(n.size),n.loading&&"is-loading"]);return()=>{var u,h;return ie("button",{type:n.htmlType,disabled:n.disabled||o.value,class:c.value,onClick:l},[n.loading?ie(e2,{class:UH},null):(u=t.icon)===null||u===void 0?void 0:u.call(t),(h=t.default)===null||h===void 0?void 0:h.call(t)])}}});const xre=Ur(P0);const FH={header:{type:String,default:""},divider:{type:Boolean,default:!0},bodyStyle:{type:Object,default:()=>({})},size:{type:String,default:"middle"},shadow:{type:String,default:"always"},bordered:{type:Boolean,default:!0}},uu=Qt("card");var Iy=Xe({name:"FCard",props:FH,setup(n){di();const e=Te(()=>({[uu]:!0,["".concat(uu,"-size--").concat(n.size)]:n.size,["".concat(uu,"-shadow--").concat(n.shadow)]:n.shadow,"is-bordered":n.bordered})),t=Te(()=>({["".concat(uu,"__header")]:!0,"no-divider":!n.divider}));return{prefixCls:uu,classes:e,headerClasses:t}}});function kH(n,e,t,i,r,s){return nt(),Mt("div",{class:Yt(n.classes)},[n.$slots.header||n.header?(nt(),Mt("div",{key:0,class:Yt(n.headerClasses)},[Ei(n.$slots,"header",{},()=>[uy($L(n.header),1)])],2)):Fi("v-if",!0),ei("div",{class:Yt("".concat(n.prefixCls,"__body")),style:Fn(n.bodyStyle)},[Ei(n.$slots,"default")],6)],2)}Iy.render=kH;Iy.__file="components/card/card.vue";const wre=Ur(Iy);var Ca=[],BH=function(){return Ca.some(function(n){return n.activeTargets.length>0})},zH=function(){return Ca.some(function(n){return n.skippedTargets.length>0})},Z1="ResizeObserver loop completed with undelivered notifications.",VH=function(){var n;typeof ErrorEvent=="function"?n=new ErrorEvent("error",{message:Z1}):(n=document.createEvent("Event"),n.initEvent("error",!1,!1),n.message=Z1),window.dispatchEvent(n)},Eh;(function(n){n.BORDER_BOX="border-box",n.CONTENT_BOX="content-box",n.DEVICE_PIXEL_CONTENT_BOX="device-pixel-content-box"})(Eh||(Eh={}));var Pa=function(n){return Object.freeze(n)},HH=function(){function n(e,t){this.inlineSize=e,this.blockSize=t,Pa(this)}return n}(),u2=function(){function n(e,t,i,r){return this.x=e,this.y=t,this.width=i,this.height=r,this.top=this.y,this.left=this.x,this.bottom=this.top+this.height,this.right=this.left+this.width,Pa(this)}return n.prototype.toJSON=function(){var e=this,t=e.x,i=e.y,r=e.top,s=e.right,o=e.bottom,a=e.left,l=e.width,c=e.height;return{x:t,y:i,top:r,right:s,bottom:o,left:a,width:l,height:c}},n.fromRect=function(e){return new n(e.x,e.y,e.width,e.height)},n}(),Dy=function(n){return n instanceof SVGElement&&"getBBox"in n},h2=function(n){if(Dy(n)){var e=n.getBBox(),t=e.width,i=e.height;return!t&&!i}var r=n,s=r.offsetWidth,o=r.offsetHeight;return!(s||o||n.getClientRects().length)},J1=function(n){var e;if(n instanceof Element)return!0;var t=(e=n==null?void 0:n.ownerDocument)===null||e===void 0?void 0:e.defaultView;return!!(t&&n instanceof t.Element)},GH=function(n){switch(n.tagName){case"INPUT":if(n.type!=="image")break;case"VIDEO":case"AUDIO":case"EMBED":case"OBJECT":case"CANVAS":case"IFRAME":case"IMG":return!0}return!1},Ju=typeof window<"u"?window:{},Xd=new WeakMap,Q1=/auto|scroll/,WH=/^tb|vertical/,$H=/msie|trident/i.test(Ju.navigator&&Ju.navigator.userAgent),zr=function(n){return parseFloat(n||"0")},lc=function(n,e,t){return n===void 0&&(n=0),e===void 0&&(e=0),t===void 0&&(t=!1),new HH((t?e:n)||0,(t?n:e)||0)},eS=Pa({devicePixelContentBoxSize:lc(),borderBoxSize:lc(),contentBoxSize:lc(),contentRect:new u2(0,0,0,0)}),d2=function(n,e){if(e===void 0&&(e=!1),Xd.has(n)&&!e)return Xd.get(n);if(h2(n))return Xd.set(n,eS),eS;var t=getComputedStyle(n),i=Dy(n)&&n.ownerSVGElement&&n.getBBox(),r=!$H&&t.boxSizing==="border-box",s=WH.test(t.writingMode||""),o=!i&&Q1.test(t.overflowY||""),a=!i&&Q1.test(t.overflowX||""),l=i?0:zr(t.paddingTop),c=i?0:zr(t.paddingRight),u=i?0:zr(t.paddingBottom),h=i?0:zr(t.paddingLeft),d=i?0:zr(t.borderTopWidth),f=i?0:zr(t.borderRightWidth),p=i?0:zr(t.borderBottomWidth),v=i?0:zr(t.borderLeftWidth),m=h+c,g=l+u,b=v+f,_=d+p,y=a?n.offsetHeight-_-n.clientHeight:0,T=o?n.offsetWidth-b-n.clientWidth:0,S=r?m+b:0,E=r?g+_:0,x=i?i.width:zr(t.width)-S-T,M=i?i.height:zr(t.height)-E-y,w=x+m+T+b,C=M+g+y+_,L=Pa({devicePixelContentBoxSize:lc(Math.round(x*devicePixelRatio),Math.round(M*devicePixelRatio),s),borderBoxSize:lc(w,C,s),contentBoxSize:lc(x,M,s),contentRect:new u2(h,l,x,M)});return Xd.set(n,L),L},f2=function(n,e,t){var i=d2(n,t),r=i.borderBoxSize,s=i.contentBoxSize,o=i.devicePixelContentBoxSize;switch(e){case Eh.DEVICE_PIXEL_CONTENT_BOX:return o;case Eh.BORDER_BOX:return r;default:return s}},jH=function(){function n(e){var t=d2(e);this.target=e,this.contentRect=t.contentRect,this.borderBoxSize=Pa([t.borderBoxSize]),this.contentBoxSize=Pa([t.contentBoxSize]),this.devicePixelContentBoxSize=Pa([t.devicePixelContentBoxSize])}return n}(),p2=function(n){if(h2(n))return 1/0;for(var e=0,t=n.parentNode;t;)e+=1,t=t.parentNode;return e},XH=function(){var n=1/0,e=[];Ca.forEach(function(o){if(o.activeTargets.length!==0){var a=[];o.activeTargets.forEach(function(c){var u=new jH(c.target),h=p2(c.target);a.push(u),c.lastReportedSize=f2(c.target,c.observedBox),h<n&&(n=h)}),e.push(function(){o.callback.call(o.observer,a,o.observer)}),o.activeTargets.splice(0,o.activeTargets.length)}});for(var t=0,i=e;t<i.length;t++){var r=i[t];r()}return n},tS=function(n){Ca.forEach(function(t){t.activeTargets.splice(0,t.activeTargets.length),t.skippedTargets.splice(0,t.skippedTargets.length),t.observationTargets.forEach(function(r){r.isActive()&&(p2(r.target)>n?t.activeTargets.push(r):t.skippedTargets.push(r))})})},YH=function(){var n=0;for(tS(n);BH();)n=XH(),tS(n);return zH()&&VH(),n>0},Bg,m2=[],qH=function(){return m2.splice(0).forEach(function(n){return n()})},KH=function(n){if(!Bg){var e=0,t=document.createTextNode(""),i={characterData:!0};new MutationObserver(function(){return qH()}).observe(t,i),Bg=function(){t.textContent="".concat(e?e--:e++)}}m2.push(n),Bg()},ZH=function(n){KH(function(){requestAnimationFrame(n)})},cp=0,JH=function(){return!!cp},QH=250,e8={attributes:!0,characterData:!0,childList:!0,subtree:!0},nS=["resize","load","transitionend","animationend","animationstart","animationiteration","keyup","keydown","mouseup","mousedown","mouseover","mouseout","blur","focus"],iS=function(n){return n===void 0&&(n=0),Date.now()+n},zg=!1,t8=function(){function n(){var e=this;this.stopped=!0,this.listener=function(){return e.schedule()}}return n.prototype.run=function(e){var t=this;if(e===void 0&&(e=QH),!zg){zg=!0;var i=iS(e);ZH(function(){var r=!1;try{r=YH()}finally{if(zg=!1,e=i-iS(),!JH())return;r?t.run(1e3):e>0?t.run(e):t.start()}})}},n.prototype.schedule=function(){this.stop(),this.run()},n.prototype.observe=function(){var e=this,t=function(){return e.observer&&e.observer.observe(document.body,e8)};document.body?t():Ju.addEventListener("DOMContentLoaded",t)},n.prototype.start=function(){var e=this;this.stopped&&(this.stopped=!1,this.observer=new MutationObserver(this.listener),this.observe(),nS.forEach(function(t){return Ju.addEventListener(t,e.listener,!0)}))},n.prototype.stop=function(){var e=this;this.stopped||(this.observer&&this.observer.disconnect(),nS.forEach(function(t){return Ju.removeEventListener(t,e.listener,!0)}),this.stopped=!0)},n}(),R0=new t8,rS=function(n){!cp&&n>0&&R0.start(),cp+=n,!cp&&R0.stop()},n8=function(n){return!Dy(n)&&!GH(n)&&getComputedStyle(n).display==="inline"},i8=function(){function n(e,t){this.target=e,this.observedBox=t||Eh.CONTENT_BOX,this.lastReportedSize={inlineSize:0,blockSize:0}}return n.prototype.isActive=function(){var e=f2(this.target,this.observedBox,!0);return n8(this.target)&&(this.lastReportedSize=e),this.lastReportedSize.inlineSize!==e.inlineSize||this.lastReportedSize.blockSize!==e.blockSize},n}(),r8=function(){function n(e,t){this.activeTargets=[],this.skippedTargets=[],this.observationTargets=[],this.observer=e,this.callback=t}return n}(),Yd=new WeakMap,sS=function(n,e){for(var t=0;t<n.length;t+=1)if(n[t].target===e)return t;return-1},qd=function(){function n(){}return n.connect=function(e,t){var i=new r8(e,t);Yd.set(e,i)},n.observe=function(e,t,i){var r=Yd.get(e),s=r.observationTargets.length===0;sS(r.observationTargets,t)<0&&(s&&Ca.push(r),r.observationTargets.push(new i8(t,i&&i.box)),rS(1),R0.schedule())},n.unobserve=function(e,t){var i=Yd.get(e),r=sS(i.observationTargets,t),s=i.observationTargets.length===1;r>=0&&(s&&Ca.splice(Ca.indexOf(i),1),i.observationTargets.splice(r,1),rS(-1))},n.disconnect=function(e){var t=this,i=Yd.get(e);i.observationTargets.slice().forEach(function(r){return t.unobserve(e,r.target)}),i.activeTargets.splice(0,i.activeTargets.length)},n}(),s8=function(){function n(e){if(arguments.length===0)throw new TypeError("Failed to construct 'ResizeObserver': 1 argument required, but only 0 present.");if(typeof e!="function")throw new TypeError("Failed to construct 'ResizeObserver': The callback provided as parameter 1 is not a function.");qd.connect(this,e)}return n.prototype.observe=function(e,t){if(arguments.length===0)throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': 1 argument required, but only 0 present.");if(!J1(e))throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element");qd.observe(this,e,t)},n.prototype.unobserve=function(e){if(arguments.length===0)throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': 1 argument required, but only 0 present.");if(!J1(e))throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element");qd.unobserve(this,e)},n.prototype.disconnect=function(){qd.disconnect(this)},n.toString=function(){return"function ResizeObserver () { [polyfill code] }"},n}(),Up=function(n,e,t){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0;const r=Te(()=>Se(t)),s=function(){if(!r.value){if(!i){i=!0;return}for(var c=arguments.length,u=new Array(c),h=0;h<c;h++)u[h]=arguments[h];e==null||e(...u)}},o=new s8(s);let a=null;const l=c=>{a&&o.unobserve(a),c&&(o.observe(c),a=c)};bn(()=>{ft(n,()=>{Jr(()=>{l(n.value)})},{immediate:!0})}),Ir(()=>{o.disconnect()})};function oS(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(n);e&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(n,r).enumerable})),t.push.apply(t,i)}return t}function o8(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?oS(Object(t),!0).forEach(function(i){Rr(n,i,t[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):oS(Object(t)).forEach(function(i){Object.defineProperty(n,i,Object.getOwnPropertyDescriptor(t,i))})}return n}const a8={vertical:{offset:"offsetHeight",scroll:"scrollTop",scrollSize:"scrollHeight",size:"height",key:"vertical",axis:"Y",client:"clientY",direction:"top"},horizontal:{offset:"offsetWidth",scroll:"scrollLeft",scrollSize:"scrollWidth",size:"width",key:"horizontal",axis:"X",client:"clientX",direction:"left"}},l8={shadow:{type:[Boolean,Object],default:!1}},c8=o8({height:{type:[Number,String]},maxHeight:{type:[Number,String]},native:{type:Boolean,default:!1},containerClass:[Array,Object,String],containerStyle:[String,Array,Object],contentStyle:[String,Array,Object],horizontalRatioStyle:[String,Array,Object],verticalRatioStyle:[String,Array,Object],shadowStyle:[String,Array,Object],thumbStyle:[String,Array,Object],noresize:Boolean,always:{type:Boolean,default:!1},minSize:{type:Number,default:20}},l8),u8=Qt("scrollbar-track");function h8(n){let{move:e,size:t,bar:i}=n;const r={},s="translate".concat(i.axis,"(").concat(e,"%)");return r[i.size]=t,r.transform=s,r}const d8={vertical:Boolean,size:String,move:Number,ratio:Number,always:Boolean,scrollbarRef:Array,containerRef:Object,thumbStyle:[String,Array,Object]};var Uy=Xe({name:"FBar",props:d8,setup(n){const e=Te(()=>n.containerRef),t=xe({}),i=xe(),r=xe(),s=Te(()=>a8[n.vertical?"vertical":"horizontal"]),o=Te(()=>[h8({size:n.size,move:n.move,bar:s.value}),n.thumbStyle]),a=Te(()=>i.value[s.value.offset]**2/e.value[s.value.scrollSize]/n.ratio/r.value[s.value.offset]),l=xe(!1),c=xe(),u=xe();let h=null;const d=y=>{if(u.value===!1)return;const T=t.value[s.value.axis];if(!T)return;const S=(i.value.getBoundingClientRect()[s.value.direction]-y[s.value.client])*-1,E=r.value[s.value.offset]-T,x=(S-E)*100*a.value/i.value[s.value.offset];e.value[s.value.scroll]=x*e.value[s.value.scrollSize]/100};let f;const p=()=>{var y;u.value=!1,t.value[s.value.axis]=0,(y=f)===null||y===void 0||y(),document.onselectstart=h,c.value&&(l.value=!1)},v=y=>{y.stopImmediatePropagation(),u.value=!0,f=cu(document,"mousemove",d),cu(document,"mouseup",p),h=document.onselectstart,document.onselectstart=()=>!1},m=()=>{c.value=!1,l.value=!!n.size},g=()=>{c.value=!0,l.value=u.value};return bn(()=>{Jr(()=>{n.scrollbarRef.forEach(y=>{cu(y,"mouseenter",m),cu(y,"mousemove",m),cu(y,"mouseleave",g)})})}),{prefixCls:u8,barRef:i,thumbRef:r,visible:l,cursorDown:u,barMap:s,thumbStyle:o,clickTrackHandler:y=>{const T=Math.abs(y.target.getBoundingClientRect()[s.value.direction]-y[s.value.client]),S=r.value[s.value.offset]/2,E=(T-S)*100*a.value/i.value[s.value.offset];e.value[s.value.scroll]=E*e.value[s.value.scrollSize]/100},clickThumbHandler:y=>{y.stopPropagation(),!(y.ctrlKey||[1,2].includes(y.button))&&(window.getSelection().removeAllRanges(),v(y),t.value[s.value.axis]=y.currentTarget[s.value.offset]-(y[s.value.client]-y.currentTarget.getBoundingClientRect()[s.value.direction]))}}}});function f8(n,e,t,i,r,s){return nt(),$r(kc,{name:"".concat(n.prefixCls,"-fade"),persisted:""},{default:cm(()=>[fh(ei("div",{ref:"barRef",class:Yt([n.prefixCls,"is-".concat(n.barMap.key),n.cursorDown&&"is-hovering"]),onMousedown:e[1]||(e[1]=hw(function(){return n.clickTrackHandler&&n.clickTrackHandler(...arguments)},["stop","prevent"]))},[ei("div",{ref:"thumbRef",class:Yt(["".concat(n.prefixCls,"-thumb")]),style:Fn(n.thumbStyle),onMousedown:e[0]||(e[0]=hw(function(){return n.clickThumbHandler&&n.clickThumbHandler(...arguments)},["stop","prevent"]))},null,38)],34),[[gh,n.always||n.visible]])]),_:1},8,["name"])}Uy.render=f8;Uy.__file="components/scrollbar/bar.vue";var p8=n=>{const e=xe(),t=xe(1),i=xe(1),r=xe(0),s=xe(0),o=xe("0"),a=xe("0"),l=xe(!1),c=xe(0),u=xe(!1),h=xe(0),d=4;return{containerRef:e,onUpdate:()=>{if(e.value){const v=e.value.offsetHeight-d,m=e.value.offsetWidth-d,g=v**2/e.value.scrollHeight,b=m**2/e.value.scrollWidth,_=Math.max(g,n.minSize),y=Math.max(b,n.minSize);i.value=g/(v-g)/(_/(v-_)),t.value=b/(m-b)/(y/(m-y)),o.value=_+d<v?Op(_):"",a.value=y+d<m?Op(y):""}},onScroll:()=>{const v=e.value;if(v){const m=v.offsetHeight-d,g=v.offsetWidth-d;s.value=v.scrollTop*100/m*i.value,r.value=v.scrollLeft*100/g*t.value,u.value=v.scrollHeight>v.offsetHeight,h.value=v.scrollTop/(v.scrollHeight-v.offsetHeight),l.value=v.scrollWidth>v.offsetWidth,c.value=v.scrollLeft/(v.scrollWidth-v.offsetWidth)}},ratioX:t,ratioY:i,thumbMoveX:r,thumbMoveY:s,sizeHeight:o,sizeWidth:a,scrollX:l,scrollXRatio:c,scrollY:u,scrollYRatio:h}};const Kd=Qt("scrollbar");var Ny=Xe({name:"FScrollbar",components:{FBar:Uy},props:c8,emits:["scroll"],setup(n,e){let{emit:t}=e;di();const{onUpdate:i,onScroll:r,containerRef:s,ratioX:o,ratioY:a,thumbMoveX:l,thumbMoveY:c,sizeHeight:u,sizeWidth:h,scrollX:d,scrollXRatio:f,scrollY:p,scrollYRatio:v}=p8(n),m=xe(),g=xe(),b=Te(()=>typeof n.shadow=="boolean"?{x:n.shadow,y:n.shadow}:n.shadow),_=Te(()=>[n.containerStyle,{height:Op(n.height),maxHeight:Op(n.maxHeight)}]),y=Te(()=>[Kd]),T=Te(()=>["".concat(Kd,"-container"),n.containerClass,!n.native&&"".concat(Kd,"-hidden-native-bar")]),S=C=>{r();const L=s.value;L&&t("scroll",C,L)};Up(g,()=>{i(),r()},Te(()=>n.noresize),!1),Up(m,()=>{i(),r()},Te(()=>n.noresize),!1),bn(()=>{n.native||setTimeout(i,0),setTimeout(r,0)});const E=(C,L,$)=>{if(!$||$<=0){s.value[C]=L;return}const H=(L-s.value[C])/$*10;j6(()=>{s.value[C]+=H,s.value[C]!==L&&E(C,L,$-10)})};return{scrollbarRef:m,containerRef:s,contentRef:g,style:_,prefixCls:Kd,setScrollTop:(C,L)=>{E("scrollTop",C,L)},setScrollLeft:(C,L)=>{E("scrollLeft",C,L)},scrollToEnd:(C,L)=>{C==="bottom"?E("scrollTop",g.value.offsetHeight,L):(C==="right"||E("scrollTop",g.value.offsetHeight,L),E("scrollLeft",g.value.offsetWidth,L))},update:i,handleScroll:S,thumbMoveX:l,thumbMoveY:c,ratioX:o,ratioY:a,sizeHeight:u,sizeWidth:h,wrapperClassRef:y,containerClassRef:T,scrollX:d,scrollXRatio:f,scrollY:p,scrollYRatio:v,shadowRef:b}}});function m8(n,e,t,i,r,s){const o=Hu("FBar");return nt(),Mt("div",{ref:"scrollbarRef",class:Yt(n.wrapperClassRef)},[ei("div",{ref:"containerRef",class:Yt(n.containerClassRef),style:Fn(n.style),onScroll:e[0]||(e[0]=function(){return n.handleScroll&&n.handleScroll(...arguments)})},[ei("div",{ref:"contentRef",class:Yt("".concat(n.prefixCls,"-content")),style:Fn([n.scrollX&&{width:"fit-content"},n.contentStyle])},[Ei(n.$slots,"default")],6)],38),n.native?Fi("v-if",!0):(nt(),Mt(en,{key:0},[ie(o,{thumbStyle:n.thumbStyle,scrollbarRef:[n.scrollbarRef],containerRef:n.containerRef,move:n.thumbMoveX,ratio:n.ratioX,size:n.sizeWidth,always:n.always,style:Fn(n.horizontalRatioStyle)},null,8,["thumbStyle","scrollbarRef","containerRef","move","ratio","size","always","style"]),ie(o,{thumbStyle:n.thumbStyle,scrollbarRef:[n.scrollbarRef],containerRef:n.containerRef,move:n.thumbMoveY,ratio:n.ratioY,size:n.sizeHeight,vertical:"",always:n.always,style:Fn(n.verticalRatioStyle)},null,8,["thumbStyle","scrollbarRef","containerRef","move","ratio","size","always","style"])],64)),n.shadowRef.x&&n.scrollX&&n.scrollXRatio<1?(nt(),Mt("div",{key:1,class:Yt("".concat(n.prefixCls,"-shadow-right")),style:Fn(n.shadowStyle)},null,6)):Fi("v-if",!0),n.shadowRef.x&&n.scrollX&&n.scrollXRatio>0?(nt(),Mt("div",{key:2,class:Yt("".concat(n.prefixCls,"-shadow-left")),style:Fn(n.shadowStyle)},null,6)):Fi("v-if",!0),n.shadowRef.y&&n.scrollY&&n.scrollYRatio<1?(nt(),Mt("div",{key:3,class:Yt("".concat(n.prefixCls,"-shadow-bottom")),style:Fn(n.shadowStyle)},null,6)):Fi("v-if",!0),n.shadowRef.y&&n.scrollY&&n.scrollYRatio>0?(nt(),Mt("div",{key:4,class:Yt("".concat(n.prefixCls,"-shadow-top")),style:Fn(n.shadowStyle)},null,6)):Fi("v-if",!0)],2)}Ny.render=m8;Ny.__file="components/scrollbar/scrollbar.vue";const g8=Ur(Ny);function Th(n){if(!n)return null;if(n instanceof Text||n instanceof HTMLElement)return n;if(typeof n=="object"&&!vy(n.$el))return n.$el;throw new Error("getElementFromVueInstance 传入的值不是 Text、HTMLElement 或 Vue 组件选项对象")}function aS(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(n);e&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(n,r).enumerable})),t.push.apply(t,i)}return t}function lS(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?aS(Object(t),!0).forEach(function(i){Rr(n,i,t[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):aS(Object(t)).forEach(function(i){Object.defineProperty(n,i,Object.getOwnPropertyDescriptor(t,i))})}return n}const rl=function(n,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const{prop:i="modelValue",deep:r=!1,isEqual:s=!1,defaultValue:o}=t,a=i,l=xe(_C(n[a])?o:n[a]),c=h=>{h===l.value||s&&HB(h,l.value)||(l.value=h)},u=h=>{c(h),e("update:".concat(a),l.value)};return ft(()=>n[a],h=>{h!==l.value&&(l.value=h)},{deep:r}),[Te({get(){return l.value},set(h){u(h)}}),u]},v8=function(n,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const[i,r]=rl(n,e,lS(lS({},t),{},{defaultValue:[]}));return Is(i.value)||(console.warn("[useArrayModel] 绑定值类型不匹配, 仅支持数组类型, value:",n[(t==null?void 0:t.prop)||"modelValue"]),r([])),[i,o=>{if(Is(o)){r(o);return}const a=i.value,l=a.indexOf(o);l!==-1?a.splice(l,1):a.push(o),r(a)}]};var _8=Xe({name:"LazyTeleport",props:{to:{type:[String,Object],default:void 0},disabled:Boolean,show:{type:Boolean,required:!0}},setup(n){const e=xe(n.show);return ft(()=>n.show,t=>{t&&(e.value=!0)}),{showTeleport:e,mergedTo:Te(()=>{var t;return(t=n.to)!==null&&t!==void 0?t:"body"})}},render(){return this.showTeleport?this.disabled?C0(this.$slots):Io(yI,{disabled:this.disabled,to:this.mergedTo},C0(this.$slots)):null}});function y8(n,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;const i=Array.isArray(n)?n:[n];let r=!1;const s=xe(t);function o(l){const c=l.target;i.every(u=>{const h=Th(Se(u));return h&&!h.contains(c)&&h!==c})&&(e==null||e())}const a=()=>{r&&(r=!1,window.removeEventListener("click",o,!0))};return ft(s,()=>{s.value?a():r||(r=!0,window.addEventListener("click",o,!0))},{immediate:!0}),Ir(a),a}const b8={click:["onClick"],hover:["onMouseenter","onMouseleave"],focus:["onFocus","onBlur"],contextmenu:["onContextmenu","onClick"]};function x8(n,e,t,i){let r=!1,s,o;const a=xe({});function l(){clearTimeout(s),clearTimeout(o)}const c=()=>{t.onlyShowTrigger||Rp(t.disabled)&&t.disabled||Qr(t.disabled)&&t.disabled()||(l(),t.hideAfter?o=setTimeout(()=>{e(!1)},t.hideAfter):e(!1))},u=()=>{Rp(t.disabled)&&t.disabled||Qr(t.disabled)&&t.disabled()||(l(),t.showAfter?s=setTimeout(()=>{e(!0)},t.showAfter):e(!0))},h=()=>{n.value?c():u()},d=(m,g)=>{switch(m.stopPropagation(),m.type){case"click":{g==="contextmenu"?n.value&&(i(null),h()):r?r=!1:h();break}case"mouseenter":{u();break}case"mouseleave":{c();break}case"focus":{r=!0,u();break}case"blur":{r=!1,c();break}case"contextmenu":{i({x:m.clientX,y:m.clientY}),m.preventDefault(),u();break}}},f=m=>{const g={};b8[m].forEach(b=>{g[b]=_=>{d(_,m)}}),a.value=g};ft(()=>t.trigger,()=>{t.trigger&&f(t.trigger)},{immediate:!0});function p(){t.trigger!=="click"&&clearTimeout(o)}function v(){const{trigger:m}=t;m==="click"||m==="focus"||m==="contextmenu"||c()}return{events:a,onPopperMouseEnter:p,onPopperMouseLeave:v}}const Ah=Math.min,cc=Math.max,Np=Math.round,Uo=n=>({x:n,y:n}),w8={left:"right",right:"left",bottom:"top",top:"bottom"},S8={start:"end",end:"start"};function L0(n,e,t){return cc(n,Ah(e,t))}function ad(n,e){return typeof n=="function"?n(e):n}function Ba(n){return n.split("-")[0]}function ld(n){return n.split("-")[1]}function g2(n){return n==="x"?"y":"x"}function Fy(n){return n==="y"?"height":"width"}function wm(n){return["top","bottom"].includes(Ba(n))?"y":"x"}function ky(n){return g2(wm(n))}function M8(n,e,t){t===void 0&&(t=!1);const i=ld(n),r=ky(n),s=Fy(r);let o=r==="x"?i===(t?"end":"start")?"right":"left":i==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(o=Fp(o)),[o,Fp(o)]}function E8(n){const e=Fp(n);return[O0(n),e,O0(e)]}function O0(n){return n.replace(/start|end/g,e=>S8[e])}function T8(n,e,t){const i=["left","right"],r=["right","left"],s=["top","bottom"],o=["bottom","top"];switch(n){case"top":case"bottom":return t?e?r:i:e?i:r;case"left":case"right":return e?s:o;default:return[]}}function A8(n,e,t,i){const r=ld(n);let s=T8(Ba(n),t==="start",i);return r&&(s=s.map(o=>o+"-"+r),e&&(s=s.concat(s.map(O0)))),s}function Fp(n){return n.replace(/left|right|bottom|top/g,e=>w8[e])}function C8(n){return Bt({top:0,right:0,bottom:0,left:0},n)}function v2(n){return typeof n!="number"?C8(n):{top:n,right:n,bottom:n,left:n}}function kp(n){return ii(Bt({},n),{top:n.y,left:n.x,right:n.x+n.width,bottom:n.y+n.height})}function cS(n,e,t){let{reference:i,floating:r}=n;const s=wm(e),o=ky(e),a=Fy(o),l=Ba(e),c=s==="y",u=i.x+i.width/2-r.width/2,h=i.y+i.height/2-r.height/2,d=i[a]/2-r[a]/2;let f;switch(l){case"top":f={x:u,y:i.y-r.height};break;case"bottom":f={x:u,y:i.y+i.height};break;case"right":f={x:i.x+i.width,y:h};break;case"left":f={x:i.x-r.width,y:h};break;default:f={x:i.x,y:i.y}}switch(ld(e)){case"start":f[o]-=d*(t&&c?-1:1);break;case"end":f[o]+=d*(t&&c?-1:1);break}return f}const P8=async(n,e,t)=>{const{placement:i="bottom",strategy:r="absolute",middleware:s=[],platform:o}=t,a=s.filter(Boolean),l=await(o.isRTL==null?void 0:o.isRTL(e));let c=await o.getElementRects({reference:n,floating:e,strategy:r}),{x:u,y:h}=cS(c,i,l),d=i,f={},p=0;for(let v=0;v<a.length;v++){const{name:m,fn:g}=a[v],{x:b,y:_,data:y,reset:T}=await g({x:u,y:h,initialPlacement:i,placement:d,strategy:r,middlewareData:f,rects:c,platform:o,elements:{reference:n,floating:e}});if(u=b!=null?b:u,h=_!=null?_:h,f=ii(Bt({},f),{[m]:Bt(Bt({},f[m]),y)}),T&&p<=50){p++,typeof T=="object"&&(T.placement&&(d=T.placement),T.rects&&(c=T.rects===!0?await o.getElementRects({reference:n,floating:e,strategy:r}):T.rects),{x:u,y:h}=cS(c,d,l)),v=-1;continue}}return{x:u,y:h,placement:d,strategy:r,middlewareData:f}};async function _2(n,e){var t;e===void 0&&(e={});const{x:i,y:r,platform:s,rects:o,elements:a,strategy:l}=n,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:h="floating",altBoundary:d=!1,padding:f=0}=ad(e,n),p=v2(f),m=a[d?h==="floating"?"reference":"floating":h],g=kp(await s.getClippingRect({element:(t=await(s.isElement==null?void 0:s.isElement(m)))==null||t?m:m.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(a.floating)),boundary:c,rootBoundary:u,strategy:l})),b=h==="floating"?ii(Bt({},o.floating),{x:i,y:r}):o.reference,_=await(s.getOffsetParent==null?void 0:s.getOffsetParent(a.floating)),y=await(s.isElement==null?void 0:s.isElement(_))?await(s.getScale==null?void 0:s.getScale(_))||{x:1,y:1}:{x:1,y:1},T=kp(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({rect:b,offsetParent:_,strategy:l}):b);return{top:(g.top-T.top+p.top)/y.y,bottom:(T.bottom-g.bottom+p.bottom)/y.y,left:(g.left-T.left+p.left)/y.x,right:(T.right-g.right+p.right)/y.x}}const R8=n=>({name:"arrow",options:n,async fn(e){const{x:t,y:i,placement:r,rects:s,platform:o,elements:a,middlewareData:l}=e,{element:c,padding:u=0}=ad(n,e)||{};if(c==null)return{};const h=v2(u),d={x:t,y:i},f=ky(r),p=Fy(f),v=await o.getDimensions(c),m=f==="y",g=m?"top":"left",b=m?"bottom":"right",_=m?"clientHeight":"clientWidth",y=s.reference[p]+s.reference[f]-d[f]-s.floating[p],T=d[f]-s.reference[f],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(c));let E=S?S[_]:0;(!E||!await(o.isElement==null?void 0:o.isElement(S)))&&(E=a.floating[_]||s.floating[p]);const x=y/2-T/2,M=E/2-v[p]/2-1,w=Ah(h[g],M),C=Ah(h[b],M),L=w,$=E-v[p]-C,U=E/2-v[p]/2+x,H=L0(L,U,$),V=!l.arrow&&ld(r)!=null&&U!=H&&s.reference[p]/2-(U<L?w:C)-v[p]/2<0,j=V?U<L?U-L:U-$:0;return{[f]:d[f]+j,data:Bt({[f]:H,centerOffset:U-H-j},V&&{alignmentOffset:j}),reset:V}}}),L8=function(n){return n===void 0&&(n={}),{name:"flip",options:n,async fn(e){var t,i;const{placement:r,middlewareData:s,rects:o,initialPlacement:a,platform:l,elements:c}=e,L=ad(n,e),{mainAxis:u=!0,crossAxis:h=!0,fallbackPlacements:d,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:v=!0}=L,m=Id(L,["mainAxis","crossAxis","fallbackPlacements","fallbackStrategy","fallbackAxisSideDirection","flipAlignment"]);if((t=s.arrow)!=null&&t.alignmentOffset)return{};const g=Ba(r),b=Ba(a)===a,_=await(l.isRTL==null?void 0:l.isRTL(c.floating)),y=d||(b||!v?[Fp(a)]:E8(a));!d&&p!=="none"&&y.push(...A8(a,v,p,_));const T=[a,...y],S=await _2(e,m),E=[];let x=((i=s.flip)==null?void 0:i.overflows)||[];if(u&&E.push(S[g]),h){const $=M8(r,o,_);E.push(S[$[0]],S[$[1]])}if(x=[...x,{placement:r,overflows:E}],!E.every($=>$<=0)){var M,w;const $=(((M=s.flip)==null?void 0:M.index)||0)+1,U=T[$];if(U)return{data:{index:$,overflows:x},reset:{placement:U}};let H=(w=x.filter(V=>V.overflows[0]<=0).sort((V,j)=>V.overflows[1]-j.overflows[1])[0])==null?void 0:w.placement;if(!H)switch(f){case"bestFit":{var C;const V=(C=x.map(j=>[j.placement,j.overflows.filter(te=>te>0).reduce((te,Z)=>te+Z,0)]).sort((j,te)=>j[1]-te[1])[0])==null?void 0:C[0];V&&(H=V);break}case"initialPlacement":H=a;break}if(r!==H)return{reset:{placement:H}}}return{}}}};async function O8(n,e){const{placement:t,platform:i,elements:r}=n,s=await(i.isRTL==null?void 0:i.isRTL(r.floating)),o=Ba(t),a=ld(t),l=wm(t)==="y",c=["left","top"].includes(o)?-1:1,u=s&&l?-1:1,h=ad(e,n);let{mainAxis:d,crossAxis:f,alignmentAxis:p}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:Bt({mainAxis:0,crossAxis:0,alignmentAxis:null},h);return a&&typeof p=="number"&&(f=a==="end"?p*-1:p),l?{x:f*u,y:d*c}:{x:d*c,y:f*u}}const I8=function(n){return n===void 0&&(n=0),{name:"offset",options:n,async fn(e){const{x:t,y:i}=e,r=await O8(e,n);return{x:t+r.x,y:i+r.y,data:r}}}},D8=function(n){return n===void 0&&(n={}),{name:"shift",options:n,async fn(e){const{x:t,y:i,placement:r}=e,m=ad(n,e),{mainAxis:s=!0,crossAxis:o=!1,limiter:a={fn:g=>{let{x:b,y:_}=g;return{x:b,y:_}}}}=m,l=Id(m,["mainAxis","crossAxis","limiter"]),c={x:t,y:i},u=await _2(e,l),h=wm(Ba(r)),d=g2(h);let f=c[d],p=c[h];if(s){const g=d==="y"?"top":"left",b=d==="y"?"bottom":"right",_=f+u[g],y=f-u[b];f=L0(_,f,y)}if(o){const g=h==="y"?"top":"left",b=h==="y"?"bottom":"right",_=p+u[g],y=p-u[b];p=L0(_,p,y)}const v=a.fn(ii(Bt({},e),{[d]:f,[h]:p}));return ii(Bt({},v),{data:{x:v.x-t,y:v.y-i}})}}};function No(n){return y2(n)?(n.nodeName||"").toLowerCase():"#document"}function Vi(n){var e;return(n==null||(e=n.ownerDocument)==null?void 0:e.defaultView)||window}function Vo(n){var e;return(e=(y2(n)?n.ownerDocument:n.document)||window.document)==null?void 0:e.documentElement}function y2(n){return n instanceof Node||n instanceof Vi(n).Node}function Us(n){return n instanceof Element||n instanceof Vi(n).Element}function ts(n){return n instanceof HTMLElement||n instanceof Vi(n).HTMLElement}function uS(n){return typeof ShadowRoot>"u"?!1:n instanceof ShadowRoot||n instanceof Vi(n).ShadowRoot}function cd(n){const{overflow:e,overflowX:t,overflowY:i,display:r}=lr(n);return/auto|scroll|overlay|hidden|clip/.test(e+i+t)&&!["inline","contents"].includes(r)}function U8(n){return["table","td","th"].includes(No(n))}function By(n){const e=zy(),t=lr(n);return t.transform!=="none"||t.perspective!=="none"||(t.containerType?t.containerType!=="normal":!1)||!e&&(t.backdropFilter?t.backdropFilter!=="none":!1)||!e&&(t.filter?t.filter!=="none":!1)||["transform","perspective","filter"].some(i=>(t.willChange||"").includes(i))||["paint","layout","strict","content"].some(i=>(t.contain||"").includes(i))}function N8(n){let e=Mc(n);for(;ts(e)&&!Sm(e);){if(By(e))return e;e=Mc(e)}return null}function zy(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Sm(n){return["html","body","#document"].includes(No(n))}function lr(n){return Vi(n).getComputedStyle(n)}function Mm(n){return Us(n)?{scrollLeft:n.scrollLeft,scrollTop:n.scrollTop}:{scrollLeft:n.pageXOffset,scrollTop:n.pageYOffset}}function Mc(n){if(No(n)==="html")return n;const e=n.assignedSlot||n.parentNode||uS(n)&&n.host||Vo(n);return uS(e)?e.host:e}function b2(n){const e=Mc(n);return Sm(e)?n.ownerDocument?n.ownerDocument.body:n.body:ts(e)&&cd(e)?e:b2(e)}function I0(n,e,t){var i;e===void 0&&(e=[]),t===void 0&&(t=!0);const r=b2(n),s=r===((i=n.ownerDocument)==null?void 0:i.body),o=Vi(r);return s?e.concat(o,o.visualViewport||[],cd(r)?r:[],o.frameElement&&t?I0(o.frameElement):[]):e.concat(r,I0(r,[],t))}function x2(n){const e=lr(n);let t=parseFloat(e.width)||0,i=parseFloat(e.height)||0;const r=ts(n),s=r?n.offsetWidth:t,o=r?n.offsetHeight:i,a=Np(t)!==s||Np(i)!==o;return a&&(t=s,i=o),{width:t,height:i,$:a}}function w2(n){return Us(n)?n:n.contextElement}function uc(n){const e=w2(n);if(!ts(e))return Uo(1);const t=e.getBoundingClientRect(),{width:i,height:r,$:s}=x2(e);let o=(s?Np(t.width):t.width)/i,a=(s?Np(t.height):t.height)/r;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const F8=Uo(0);function S2(n){const e=Vi(n);return!zy()||!e.visualViewport?F8:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function k8(n,e,t){return e===void 0&&(e=!1),!t||e&&t!==Vi(n)?!1:e}function Ch(n,e,t,i){e===void 0&&(e=!1),t===void 0&&(t=!1);const r=n.getBoundingClientRect(),s=w2(n);let o=Uo(1);e&&(i?Us(i)&&(o=uc(i)):o=uc(n));const a=k8(s,t,i)?S2(s):Uo(0);let l=(r.left+a.x)/o.x,c=(r.top+a.y)/o.y,u=r.width/o.x,h=r.height/o.y;if(s){const d=Vi(s),f=i&&Us(i)?Vi(i):i;let p=d.frameElement;for(;p&&i&&f!==d;){const v=uc(p),m=p.getBoundingClientRect(),g=lr(p),b=m.left+(p.clientLeft+parseFloat(g.paddingLeft))*v.x,_=m.top+(p.clientTop+parseFloat(g.paddingTop))*v.y;l*=v.x,c*=v.y,u*=v.x,h*=v.y,l+=b,c+=_,p=Vi(p).frameElement}}return kp({width:u,height:h,x:l,y:c})}function B8(n){let{rect:e,offsetParent:t,strategy:i}=n;const r=ts(t),s=Vo(t);if(t===s)return e;let o={scrollLeft:0,scrollTop:0},a=Uo(1);const l=Uo(0);if((r||!r&&i!=="fixed")&&((No(t)!=="body"||cd(s))&&(o=Mm(t)),ts(t))){const c=Ch(t);a=uc(t),l.x=c.x+t.clientLeft,l.y=c.y+t.clientTop}return{width:e.width*a.x,height:e.height*a.y,x:e.x*a.x-o.scrollLeft*a.x+l.x,y:e.y*a.y-o.scrollTop*a.y+l.y}}function z8(n){return Array.from(n.getClientRects())}function M2(n){return Ch(Vo(n)).left+Mm(n).scrollLeft}function V8(n){const e=Vo(n),t=Mm(n),i=n.ownerDocument.body,r=cc(e.scrollWidth,e.clientWidth,i.scrollWidth,i.clientWidth),s=cc(e.scrollHeight,e.clientHeight,i.scrollHeight,i.clientHeight);let o=-t.scrollLeft+M2(n);const a=-t.scrollTop;return lr(i).direction==="rtl"&&(o+=cc(e.clientWidth,i.clientWidth)-r),{width:r,height:s,x:o,y:a}}function H8(n,e){const t=Vi(n),i=Vo(n),r=t.visualViewport;let s=i.clientWidth,o=i.clientHeight,a=0,l=0;if(r){s=r.width,o=r.height;const c=zy();(!c||c&&e==="fixed")&&(a=r.offsetLeft,l=r.offsetTop)}return{width:s,height:o,x:a,y:l}}function G8(n,e){const t=Ch(n,!0,e==="fixed"),i=t.top+n.clientTop,r=t.left+n.clientLeft,s=ts(n)?uc(n):Uo(1),o=n.clientWidth*s.x,a=n.clientHeight*s.y,l=r*s.x,c=i*s.y;return{width:o,height:a,x:l,y:c}}function hS(n,e,t){let i;if(e==="viewport")i=H8(n,t);else if(e==="document")i=V8(Vo(n));else if(Us(e))i=G8(e,t);else{const r=S2(n);i=ii(Bt({},e),{x:e.x-r.x,y:e.y-r.y})}return kp(i)}function E2(n,e){const t=Mc(n);return t===e||!Us(t)||Sm(t)?!1:lr(t).position==="fixed"||E2(t,e)}function W8(n,e){const t=e.get(n);if(t)return t;let i=I0(n,[],!1).filter(a=>Us(a)&&No(a)!=="body"),r=null;const s=lr(n).position==="fixed";let o=s?Mc(n):n;for(;Us(o)&&!Sm(o);){const a=lr(o),l=By(o);!l&&a.position==="fixed"&&(r=null),(s?!l&&!r:!l&&a.position==="static"&&!!r&&["absolute","fixed"].includes(r.position)||cd(o)&&!l&&E2(n,o))?i=i.filter(u=>u!==o):r=a,o=Mc(o)}return e.set(n,i),i}function $8(n){let{element:e,boundary:t,rootBoundary:i,strategy:r}=n;const o=[...t==="clippingAncestors"?W8(e,this._c):[].concat(t),i],a=o[0],l=o.reduce((c,u)=>{const h=hS(e,u,r);return c.top=cc(h.top,c.top),c.right=Ah(h.right,c.right),c.bottom=Ah(h.bottom,c.bottom),c.left=cc(h.left,c.left),c},hS(e,a,r));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function j8(n){return x2(n)}function X8(n,e,t){const i=ts(e),r=Vo(e),s=t==="fixed",o=Ch(n,!0,s,e);let a={scrollLeft:0,scrollTop:0};const l=Uo(0);if(i||!i&&!s)if((No(e)!=="body"||cd(r))&&(a=Mm(e)),i){const c=Ch(e,!0,s,e);l.x=c.x+e.clientLeft,l.y=c.y+e.clientTop}else r&&(l.x=M2(r));return{x:o.left+a.scrollLeft-l.x,y:o.top+a.scrollTop-l.y,width:o.width,height:o.height}}function dS(n,e){return!ts(n)||lr(n).position==="fixed"?null:e?e(n):n.offsetParent}function T2(n,e){const t=Vi(n);if(!ts(n))return t;let i=dS(n,e);for(;i&&U8(i)&&lr(i).position==="static";)i=dS(i,e);return i&&(No(i)==="html"||No(i)==="body"&&lr(i).position==="static"&&!By(i))?t:i||N8(n)||t}const Y8=async function(n){let{reference:e,floating:t,strategy:i}=n;const r=this.getOffsetParent||T2,s=this.getDimensions;return{reference:X8(e,await r(t),i),floating:Bt({x:0,y:0},await s(t))}};function q8(n){return lr(n).direction==="rtl"}const K8={convertOffsetParentRelativeRectToViewportRelativeRect:B8,getDocumentElement:Vo,getClippingRect:$8,getOffsetParent:T2,getElementRects:Y8,getClientRects:z8,getDimensions:j8,getScale:uc,isElement:Us,isRTL:q8},Z8=(n,e,t)=>{const i=new Map,r=Bt({platform:K8},t),s=ii(Bt({},r.platform),{_c:i});return P8(n,e,ii(Bt({},r),{platform:s}))},Ph={zIndex:2e3,nextZIndex(){return++Ph.zIndex}},J8={bottom:"up",top:"down",left:"right",right:"left"};var Q8=(n,e)=>{const[t,i]=rl(n,e),r=xe(null),s=xe(),o=xe(),a=xe(),l=ui({zIndex:Ph.nextZIndex()}),c=xe(n.placement),u=xe(!0),h=Te(()=>{const p=c.value;return"fes-slide-".concat(J8[p.split("-")[0]])}),d=()=>{Rp(n.disabled)&&n.disabled||Qr(n.disabled)&&n.disabled()||t.value&&(l.zIndex=Ph.nextZIndex(),Jr(()=>{const p=r.value?{getBoundingClientRect:()=>r.value&&{width:0,height:0,top:r.value.y,right:r.value.x,bottom:r.value.y,left:r.value.x},contextElement:Th(s.value)}:Th(s.value),v=o.value;Z8(p,v,{placement:n.placement,middleware:[I8(n.offset),L8(),D8(),n.arrow&&R8({element:a.value})].filter(Boolean)}).then(m=>{if(c.value!==m.placement){u.value=!1,Jr(()=>{u.value=!0}),c.value=m.placement;return}if(c.value=m.placement,Object.assign(v.style,{left:"".concat(m.x,"px"),top:"".concat(m.y,"px")}),n.arrow){const{x:g,y:b}=m.middlewareData.arrow,_={top:"bottom",right:"left",bottom:"top",left:"right"}[m.placement.split("-")[0]];Object.assign(a.value.style,{left:g!=null?"".concat(g,"px"):"",top:b!=null?"".concat(b,"px"):"",right:"",bottom:"",[_]:"-3px"})}})}))},f=p=>{r.value=p};return ft(r,d),bn(d),nA(d),{visible:t,updateVisible:i,triggerRef:s,popperRef:o,arrowRef:a,popperStyle:l,computePopper:d,updateVirtualRect:f,cacheVisible:u,transitionName:h}};function eG(n,e){let t=[];const i=()=>{let s=n.value;for(;s=KC(s),s!==null;)t.push(s);for(const o of t)o.addEventListener("scroll",e,!0)},r=()=>{for(const s of t)s.removeEventListener("scroll",e,!0);t=[]};bn(()=>{i()}),Ci(()=>{r()})}const Vy={modelValue:{type:Boolean,default:!1},trigger:{type:String,default:"hover"},placement:{type:String,default:"bottom"},offset:{type:Number,default:6},disabled:{type:[Boolean,Function],default:!1},arrow:{type:Boolean,default:!1},appendToContainer:{type:Boolean,default:!0},popperClass:[String,Array,Object],showAfter:{type:Number,default:0},hideAfter:{type:Number,default:200},getContainer:{type:Function},lazy:{type:Boolean,default:!0},onlyShowTrigger:{type:Boolean}};function fS(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(n);e&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(n,r).enumerable})),t.push.apply(t,i)}return t}function tG(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?fS(Object(t),!0).forEach(function(i){Rr(n,i,t[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):fS(Object(t)).forEach(function(i){Object.defineProperty(n,i,Object.getOwnPropertyDescriptor(t,i))})}return n}const Vg=Qt("popper");var Hy=Xe({name:"FPopper",props:Vy,emits:[xm],setup(n,e){let{slots:t,emit:i}=e;if(di(),!t.trigger)throw new Error("[FPopper]: Trigger must be provided");const r=s2(),s=Te(()=>{var x;return n.getContainer||((x=r.getContainer)===null||x===void 0?void 0:x.value)}),{visible:o,updateVisible:a,triggerRef:l,popperRef:c,arrowRef:u,computePopper:h,popperStyle:d,updateVirtualRect:f,cacheVisible:p,transitionName:v}=Q8(n,i),m=Te(()=>(Rp(n.disabled)?n.disabled:!1)||!o.value),g=Te(()=>{const x=Th(l.value);if(x instanceof Text)throw TypeError("FPopper: trigger must be a Element, but get Text(".concat(x.nodeValue,")"));return x});eG(g,x=>{var M;m.value||Qr(n.disabled)&&n.disabled()||n.appendToContainer&&x.target!==((M=s.value)===null||M===void 0?void 0:M.call(s))&&h()}),y8([l,c],()=>{a(!1)},m),Up(g,h,m),Up(Te(()=>Th(c.value)),h,m);const{events:b,onPopperMouseEnter:_,onPopperMouseLeave:y}=x8(o,a,n,f),T=Te(()=>[Vg,n.popperClass].filter(Boolean)),S=()=>{var x;const M=c2((x=t.trigger)===null||x===void 0?void 0:x.call(t));if(M)return Ar(M,tG({ref:l},b.value),!0)},E=()=>{var x;return ie("div",{class:T.value},[(x=t.default)===null||x===void 0?void 0:x.call(t),n.arrow&&ie("div",{ref:u,class:"".concat(Vg,"-arrow")},null)])};return()=>{var x;return ie(en,null,[S(),ie(_8,{to:(x=s.value)===null||x===void 0?void 0:x.call(s),disabled:!n.appendToContainer,show:!n.lazy||o.value},{default:()=>[ie("div",{ref:c,class:"".concat(Vg,"-wrapper"),style:d,role:"tooltip",onMouseenter:_,onMouseleave:y},[ie(kc,{name:v.value,type:"animation",appear:!0,onBeforeEnter:h},{default:()=>[fh(ie(E,null,null),[[gh,o.value&&p.value]])]})])]})])}}});function pS(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(n);e&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(n,r).enumerable})),t.push.apply(t,i)}return t}function Qu(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?pS(Object(t),!0).forEach(function(i){Rr(n,i,t[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):pS(Object(t)).forEach(function(i){Object.defineProperty(n,i,Object.getOwnPropertyDescriptor(t,i))})}return n}const Zo=Qt("tooltip"),A2={okText:"确定",cancelText:"取消",icon:ie(QC,null,null)},nG=Qu(Qu({},Vy),{},{title:[Number,String],content:[Number,String],mode:{type:String,default:"text"},confirmOption:{type:Object,default:()=>A2},arrow:{type:Boolean,default:!0},offset:{type:Number,default:8}});var iG=Xe({name:"FTooltip",props:nG,emits:[k1,B1,xm],setup(n,e){di();const[t,i]=rl(n,e.emit);function r(){return{trigger:e.slots.default}}function s(l,c){i(!1),e.emit(l,c)}function o(){var l,c,u,h,d,f;const p=(l=(c=e.slots)===null||c===void 0||(u=c.content)===null||u===void 0?void 0:u.call(c))!==null&&l!==void 0?l:n.content,v=(h=(d=e.slots)===null||d===void 0||(f=d.title)===null||f===void 0?void 0:f.call(d))!==null&&h!==void 0?h:n.title,m=n.mode==="confirm",g=n.mode==="popover";if(n.mode==="text")return p;if(m||g){const b=Qu(Qu({},A2),n.confirmOption),_=["".concat(Zo,"-modal-body"),m&&"is-confirm",v&&"has-header"].filter(Boolean).join(" ");return ie(en,null,[v&&ie("div",{class:"".concat(Zo,"-modal-header ").concat(m&&"is-confirm")},[m&&ie("div",{class:"".concat(Zo,"-modal-icon")},[b.icon]),v]),vy(p)?p:ie("div",{class:_},[p]),m&&ie(en,null,[ie(P0,{class:"".concat(Zo,"-modal-btn"),onClick:y=>s(k1,y),size:"small",type:"primary"},{default:()=>[b.okText]}),ie(P0,{class:"".concat(Zo,"-modal-btn"),onClick:y=>s(B1,y),size:"small"},{default:()=>[b.cancelText]})])])}}const a=Te(()=>{const l={};return Object.keys(Vy).forEach(c=>{l[c]=n[c]}),n.mode==="confirm"&&(l.trigger="click"),l});return()=>ie(Hy,Cr(a.value,{modelValue:t.value,"onUpdate:modelValue":l=>t.value=l,popperClass:[Zo,"".concat(Zo,"-").concat(n.mode),a.value.popperClass]}),Qu({default:()=>[o()]},r()))}});const mS=Ur(iG),rG=Qt("ellipsis"),sG={content:[Number,String],line:{type:[Number,String],default:1},tooltip:{type:[Boolean,Object],default:()=>({showAfter:500})},class:[String,Array,Object],style:{type:[String,Array,Object],default(){return{}}}};var Rh=Xe({name:"FEllipsis",components:{Tooltip:mS},props:sG,setup(n,e){let{slots:t}=e;di();const i=xe(),r=xe(),s=Te(()=>[rG,n.class].filter(Boolean)),o=Te(()=>Number(n.line)),a=Te(()=>{const d=o.value>1?{display:"-webkit-inline-box","-webkit-line-clamp":o.value,"-webkit-box-orient":"vertical"}:{"text-overflow":"ellipsis","white-space":"nowrap"};return[n.style,d]}),l=Te(()=>Na(n.tooltip)?n.tooltip:{}),c=()=>{let d=!0;const{value:f}=i;if(!f)return!0;const{offsetHeight:p,scrollHeight:v,offsetWidth:m}=f;if(p&&m)if(o.value>1)d=v>p;else{const{value:g}=r;d=g.getBoundingClientRect().width>f.getBoundingClientRect().width}return!d},u=()=>{var d,f,p,v;return ie("span",{ref:i,class:s.value,style:a.value},[o.value>1?(d=(f=t.default)===null||f===void 0?void 0:f.call(t))!==null&&d!==void 0?d:n.content:ie("span",{ref:r},[(p=(v=t.default)===null||v===void 0?void 0:v.call(t))!==null&&p!==void 0?p:n.content])])},h=()=>n.content;return()=>{var d,f;return n.tooltip?ie(mS,Cr({placement:"top",disabled:c},l.value),{default:()=>[u()],content:(d=(f=t.tooltip)!==null&&f!==void 0?f:t.default)!==null&&d!==void 0?d:h}):u()}}}),gS=Xe({name:"FadeInExpandTransition",props:{appear:Boolean,group:Boolean,mode:String,onLeave:Function,onAfterLeave:Function,onAfterEnter:Function,width:Boolean,reverse:Boolean},setup(n,e){let{slots:t}=e;function i(l){n.width?l.style.maxWidth="".concat(l.offsetWidth,"px"):l.style.maxHeight="".concat(l.offsetHeight,"px"),l.offsetWidth}function r(l){n.width?l.style.maxWidth="0":l.style.maxHeight="0",l.offsetWidth;const{onLeave:c}=n;c&&c()}function s(l){n.width?l.style.maxWidth="":l.style.maxHeight="";const{onAfterLeave:c}=n;c&&c()}function o(l){if(l.style.transition="none",n.width){const c=l.offsetWidth;l.style.maxWidth="0",l.offsetWidth,l.style.transition="",l.style.maxWidth="".concat(c,"px")}else if(n.reverse)l.style.maxHeight="".concat(l.offsetHeight,"px"),l.offsetHeight,l.style.transition="",l.style.maxHeight="0";else{const c=l.offsetHeight;l.style.maxHeight="0",l.offsetWidth,l.style.transition="",l.style.maxHeight="".concat(c,"px")}l.offsetWidth}function a(l){var c;n.width?l.style.maxWidth="":n.reverse||(l.style.maxHeight=""),(c=n.onAfterEnter)===null||c===void 0||c.call(n)}return()=>{const l=n.group?py:kc;return Io(l,{name:n.width?"fes-fade-in-width-expand":"fes-fade-in-height-expand",mode:n.mode,appear:n.appear,onEnter:o,onAfterEnter:a,onBeforeLeave:i,onLeave:r,onAfterLeave:s},t)}}});const vS=Qt("divider"),oG={vertical:{type:Boolean,default:!1},titlePlacement:{type:String,default:"center"}};var aG=Xe({name:"FDivider",props:oG,setup(n,e){let{slots:t}=e;di();const i=Te(()=>[vS,n.vertical&&"is-vertical"].filter(Boolean).join(" "));return()=>{var r;return ie("div",{class:i.value},[n.vertical?null:ie("div",{class:"".concat(vS,"-text is-").concat(n.titlePlacement)},[(r=t.default)===null||r===void 0?void 0:r.call(t)])])}}});const Sre=Ur(aG);const fl=Qt("dropdown"),lG={visible:{type:Boolean,default:!1},appendToContainer:{type:Boolean,default:!0},getContainer:{type:Function},trigger:{type:String,default:"hover"},placement:{type:String,default:"bottom"},offset:{type:Number,default:6},options:{type:Array,default(){return[]}},disabled:{type:Boolean,default:!1},valueField:{type:String,default:"value"},labelField:{type:String,default:"label"},arrow:{type:Boolean,default:!1},showSelectedOption:{type:Boolean,default:!1}};var cG=Xe({name:"FDropdown",props:lG,emits:["click","visibleChange","update:visible"],setup(n,e){let{slots:t,emit:i}=e;di();const r=xe(),[s,o]=rl(n,i,{prop:"visible"}),a=Te(()=>n.options.some(u=>u.icon)),l=(u,h)=>{if(h.stopPropagation(),u.disabled)return;const d=u[n.valueField];r.value=d,o(!1),i("click",d)};ft(s,()=>{i("visibleChange",s.value)});const c=()=>ie("div",{class:["".concat(fl,"-option-wrapper"),a.value?"has-icon":""]},[n.options.map(u=>{var h;const d=u[n.valueField],f=u[n.labelField],p=n.showSelectedOption&&r.value===d,v=["".concat(fl,"-option"),u.disabled&&"is-disabled",p&&"is-checked"].filter(Boolean);return ie("div",{class:v,onClick:m=>{l(u,m)}},[u.icon&&ie("span",{class:"".concat(fl,"-option-icon")},[(h=u.icon)===null||h===void 0?void 0:h.call(u)]),ie("span",{class:"".concat(fl,"-option-label")},[Qr(f)?f(u):f]),p&&ie(Q6,{class:"".concat(fl,"-checked-icon")},null)])})]);return()=>ie(Hy,{modelValue:s.value,"onUpdate:modelValue":u=>s.value=u,trigger:n.trigger,placement:n.placement,popperClass:"".concat(fl,"-popper"),appendToContainer:n.appendToContainer,getContainer:n.getContainer,offset:n.offset,disabled:n.disabled,arrow:n.arrow},{default:c,trigger:t.default})}});const Mre=Ur(cG);let qt=function(n){return n.LAYOUT="FLayout",n.HEADER="FHeader",n.FOOTER="FFooter",n.ASIDE="FAside",n.MAIN="FMain",n}({});const uG={embedded:{type:Boolean,default:!1},fixed:{type:Boolean,default:!1},containerClass:[Array,Object,String],containerStyle:Object},Ec=Symbol("FLayout");function _S(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(n);e&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(n,r).enumerable})),t.push.apply(t,i)}return t}function yS(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?_S(Object(t),!0).forEach(function(i){Rr(n,i,t[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):_S(Object(t)).forEach(function(i){Object.defineProperty(n,i,Object.getOwnPropertyDescriptor(t,i))})}return n}const Hg=Qt("layout");var Gy=Xe({name:qt.LAYOUT,props:uG,setup(n){di();const e=xe(!0),t=Zt(Ec,null);t&&(e.value=!1,t.addChild({type:qt.LAYOUT}));const i=ui([]),r=c=>{i.push(c)},s=Te(()=>i.length?i.some(c=>c.type===qt.ASIDE):!1),o=Te(()=>{if(i.length>0){if(i[0].type===qt.ASIDE)return"left";if(i[i.length-1].type===qt.ASIDE)return"right"}return""}),a=Te(()=>[Hg,s.value&&"is-horizontal",n.fixed&&"is-fixed",e.value&&"is-root"].filter(Boolean)),l=Te(()=>{const c="".concat(Hg,"-container");return tC(n.containerClass)?yS({[c]:!0},n.containerClass):Is(n.containerClass)?[c,...n.containerClass]:vC(n.containerClass)?[c,n.containerClass]:[c]});return Si(Ec,yS({addChild:r,asidePlacement:o},Or(n))),{prefixCls:Hg,classList:a,containerClassRef:l}}});function hG(n,e,t,i,r,s){return nt(),Mt("section",{class:Yt(n.classList)},[ei("div",{class:Yt(n.containerClassRef),style:Fn(n.containerStyle)},[Ei(n.$slots,"default")],6)],2)}Gy.render=hG;Gy.__file="components/layout/layout.vue";const dG=Qt("layout"),fG={inverted:{type:Boolean,default:!1},bordered:{type:Boolean,default:!1},fixed:{type:Boolean,default:!1}};var Em=Xe({name:qt.HEADER,props:fG,setup(n){const e=An();(!e.parent||!e.parent.type||e.parent.type.name!==qt.LAYOUT)&&console.warn("[".concat(qt.HEADER,"] must be a child of ").concat(qt.LAYOUT));const{addChild:t}=Zt(Ec,{addChild:Ds});return t({type:qt.HEADER}),{classList:Te(()=>["".concat(dG,"-header"),n.fixed&&"is-fixed",n.inverted&&"is-inverted",n.bordered&&"is-bordered"].filter(Boolean))}}});function pG(n,e,t,i,r,s){return nt(),Mt("header",{class:Yt(n.classList)},[Ei(n.$slots,"default")],2)}Em.render=pG;Em.__file="components/layout/header.vue";const mG=Qt("layout"),gG={embedded:{type:Boolean,default:!1}};var Tm=Xe({name:qt.MAIN,props:gG,setup(n){const e=An();(!e.parent||!e.parent.type||e.parent.type.name!==qt.LAYOUT)&&console.warn("[".concat(qt.MAIN,"] must be a child of ").concat(qt.LAYOUT));const{addChild:t,embedded:i}=Zt(Ec,{addChild:Ds,embedded:xe(!1)});return t({type:qt.MAIN}),{classList:Te(()=>["".concat(mG,"-main"),(i.value||n.embedded)&&"is-embedded"].filter(Boolean))}}});function vG(n,e,t,i,r,s){return nt(),Mt("main",{class:Yt(n.classList)},[Ei(n.$slots,"default")],2)}Tm.render=vG;Tm.__file="components/layout/main.vue";const bS=Qt("layout"),_G={collapsible:{type:Boolean,default:!1},collapsedWidth:{type:String,default:"48px"},width:{type:String,default:"200px"},fixed:{type:Boolean,default:!1},inverted:{type:Boolean,default:!1},bordered:{type:Boolean,default:!1},showTrigger:{type:Boolean,default:!0}};var Am=Xe({name:qt.ASIDE,components:{FScrollbar:g8,LeftOutlined:nH,RightOutlined:t2},props:_G,emits:["update:collapsed"],setup(n,e){let{emit:t}=e;const i=An();(!i.parent||!i.parent.type||i.parent.type.name!==qt.LAYOUT)&&console.warn("[".concat(qt.ASIDE,"] must be a child of ").concat(qt.LAYOUT));const{addChild:r,asidePlacement:s}=Zt(Ec,{addChild:Ds,asidePlacement:xe("")}),[o,a]=rl(n,t,{prop:"collapsed"}),l=Te(()=>["".concat(bS,"-aside"),n.fixed&&"is-fixed",n.collapsible&&n.showTrigger&&"is-has-trigger",n.inverted&&"is-inverted",n.collapsible&&o.value&&"is-collapsed",s.value&&"is-placement-".concat(s.value),n.bordered&&"is-bordered"].filter(Boolean)),c=Te(()=>({width:n.collapsible&&o.value?n.collapsedWidth:n.width})),u=()=>{a(!o.value)};return r({type:qt.ASIDE}),{prefixCls:bS,classList:l,style:c,handleTrigger:u,asidePlacement:s,currentCollapsed:o}}});function yG(n,e,t,i,r,s){const o=Hu("FScrollbar"),a=Hu("LeftOutlined"),l=Hu("RightOutlined");return nt(),Mt("aside",{class:Yt(n.classList),style:Fn(n.style)},[ie(o,{style:Fn([n.collapsible&&n.showTrigger&&{height:"calc(100% - 48px)"}]),"thumb-style":[n.inverted&&{backgroundColor:"#fff"}]},{default:cm(()=>[Ei(n.$slots,"default")]),_:3},8,["style","thumb-style"]),n.collapsible&&n.showTrigger?(nt(),Mt("div",{key:0,class:Yt("".concat(n.prefixCls,"-aside-trigger")),onClick:e[0]||(e[0]=function(){return n.handleTrigger&&n.handleTrigger(...arguments)})},[n.asidePlacement==="left"?(nt(),Mt(en,{key:0},[n.currentCollapsed?(nt(),$r(l,{key:1})):(nt(),$r(a,{key:0}))],64)):(nt(),Mt(en,{key:1},[n.currentCollapsed?(nt(),$r(a,{key:0})):(nt(),$r(l,{key:1}))],64))],2)):Fi("v-if",!0)],6)}Am.render=yG;Am.__file="components/layout/aside.vue";const bG=Qt("layout"),xG={embedded:{type:Boolean,default:!1},bordered:{type:Boolean,default:!1},fixed:{type:Boolean,default:!1}};var Cm=Xe({name:qt.FOOTER,props:xG,setup(n){const e=An();(!e.parent||!e.parent.type||e.parent.type.name!==qt.LAYOUT)&&console.warn("[".concat(qt.FOOTER,"] must be a child of ").concat(qt.LAYOUT));const{addChild:t,embedded:i}=Zt(Ec,{addChild:Ds,embedded:xe(!1)});return t({type:qt.FOOTER}),{classList:Te(()=>["".concat(bG,"-footer"),n.bordered&&"is-bordered",(i.value||n.embedded)&&"is-embedded",n.fixed&&"is-fixed"].filter(Boolean))}}});function wG(n,e,t,i,r,s){return nt(),Mt("footer",{class:Yt(n.classList)},[Ei(n.$slots,"default")],2)}Cm.render=wG;Cm.__file="components/layout/footer.vue";const Ere=Ur(Gy,{Header:Em,Main:Tm,Aside:Am,Footer:Cm}),Tre=zo(Em),Are=zo(Tm),Cre=zo(Am),Pre=zo(Cm);const SG=["horizontal","vertical"],_n={MENU:"FMenu",SUB_MENU:"FSubMenu",MENU_ITEM:"FMenuItem",MENU_GROUP:"FMenuGroup"},C2=Symbol("FMenuChildren"),P2=Symbol("SUB_MENU_KEY"),xS=Symbol("FMenu"),MG={modelValue:{type:[String,Number]},mode:{type:String,default:SG[0]},collapsed:{type:Boolean,default:!1},inverted:{type:Boolean,default:!1},defaultExpandAll:{type:Boolean,default:!1},expandedKeys:{type:Array,default:()=>[]},accordion:{type:Boolean,default:!1},options:{type:Array,default(){return[]}}};var Wy=()=>{const n=ui([]);return Si(C2,{addChild:i=>{n.every(r=>r.uid!==i.uid)&&n.push(i)},removeChild:i=>{const r=n.findIndex(s=>s.uid===i.uid);r!==-1&&n.splice(r,1)}}),{children:n}},Pm=n=>{var e;n=(e=n)!==null&&e!==void 0?e:An();const t={name:n.type.name,uid:n.props.value||n.uid},{parentPath:i}=Zt(xS,{parentPath:Te(()=>[])}),r=Te(()=>i.value.concat(t));return Si(xS,{parentPath:r}),{indexPath:r}},$y=n=>{const e=Zt("rootMenu",null),t=Zt(C2,null),i=Te(()=>{if(e.renderWithPopper.value)return{};let o=16;const a=n.value.length;if(a>2)for(let l=a-2;l>=0;l--){const c=n.value[l];c.name===_n.SUB_MENU&&(o+=14),c.name===_n.MENU_GROUP&&(o+=8)}return{paddingLeft:"".concat(o,"px")}}),r=Te(()=>n.value.length<3),s=Te(()=>e.props.mode!=="vertical"?!1:r.value&&e.props.collapsed);return{rootMenu:e,parentMenu:t,paddingStyle:i,onlyIcon:s,isFirstLevel:r,indexPath:n}};const wS=Qt("menu-group"),EG={label:{type:String}};var jy=Xe({name:_n.MENU_GROUP,props:EG,setup(n,e){let{slots:t}=e;const i=An(),{indexPath:r}=Pm(i),{rootMenu:s,parentMenu:o,paddingStyle:a}=$y(r);s||console.warn("[".concat(_n.MENU_GROUP,"] must be a child of ").concat(_n.MENU)),o||console.warn("[".concat(_n.MENU_GROUP,"] must be a child of ").concat(_n.MENU," or ").concat(_n.SUB_MENU));const{children:l}=Wy(),c=Te(()=>l.some(d=>d==null?void 0:d.isActive)),u={uid:i.uid,type:"menuGroup",children:l,isActive:c};bn(()=>{o.addChild(u)}),Ir(()=>{o.removeChild(u)});const h=()=>{var d;return ie(Rh,{class:"".concat(wS,"-label"),style:a.value},{default:()=>[((d=t.label)===null||d===void 0?void 0:d.call(t))||n.label]})};return()=>{var d;return ie("div",{class:wS},[h(),(d=t.default)===null||d===void 0?void 0:d.call(t)])}}});const Zd=Qt("menu-item");var Xy=Xe({name:_n.MENU_ITEM,components:{Ellipsis:Rh},props:{value:{type:[String,Number],required:!0},label:String},setup(n,e){let{slots:t}=e;const i=An(),{indexPath:r}=Pm(i),{rootMenu:s,parentMenu:o,paddingStyle:a,onlyIcon:l}=$y(r),{handleItemClick:c}=Zt(P2,{handleItemClick:Ds});s||console.warn("[".concat(_n.MENU_ITEM,"] must be a child of ").concat(_n.MENU)),o||console.warn("[".concat(_n.MENU_ITEM,"] must be a child of ").concat(_n.MENU," or ").concat(_n.SUB_MENU));const u=Te(()=>s.currentValue.value===n.value),h={uid:i.uid,type:"menu",value:n.value,isActive:u};bn(()=>{o.addChild(h)}),Ir(()=>{o.removeChild(h)});const d=Te(()=>[Zd,u.value&&"is-active"].filter(Boolean).join(" ")),f=()=>{s.clickMenuItem(n.value),c()},p=()=>{var m;return ie(Rh,{class:"".concat(Zd,"-label")},{default:()=>[((m=t.label)===null||m===void 0?void 0:m.call(t))||n.label]})},v=()=>t.icon?ie("span",{class:"".concat(Zd,"-icon")},[t.icon()]):l.value?p():null;return()=>ie("div",{class:d.value,onClick:f},[ie("div",{class:"".concat(Zd,"-wrapper"),style:a.value},[v(),l.value?null:p()])])}});const qs=Qt("sub-menu");var Yy=Xe({name:_n.SUB_MENU,components:{Ellipsis:Rh,FadeInExpandTransition:gS},props:{value:{type:[String,Number],default:null},label:String},setup(n,e){let{slots:t}=e;const i=An(),{indexPath:r}=Pm(i),s=xe(null),{rootMenu:o,parentMenu:a,paddingStyle:l,isFirstLevel:c,onlyIcon:u}=$y(r);o||console.warn("[".concat(_n.SUB_MENU,"] must be a child of ").concat(_n.MENU)),a||console.warn("[".concat(_n.SUB_MENU,"] must be a child of ").concat(_n.MENU," or ").concat(_n.SUB_MENU));const{children:h}=Wy(),d=xe(!1),f=Te(()=>h.some(x=>x==null?void 0:x.isActive)),p={uid:i.uid,value:n.value,type:"subMenu",children:h,isOpened:d,isActive:f};bn(()=>{a.addChild(p)}),Ir(()=>{a.removeChild(p)}),Si(P2,{handleItemClick:()=>{o.renderWithPopper.value&&(d.value=!1)}});const v=Te(()=>o.props.mode==="horizontal"&&c.value?"bottom-start":"right-start"),m=Te(()=>[qs,f.value&&"is-active"].filter(Boolean).join(" ")),g=()=>{d.value=!d.value,o.clickSubMenu(p,r)};ft(o.currentExpandedKeys,()=>{if(!o.renderWithPopper.value){const x=o.currentExpandedKeys.value.indexOf(n.value||i.uid);x===-1&&d.value?d.value=!1:x!==-1&&!d.value&&(d.value=!0)}},{immediate:!0});const b=()=>{var x;return ie(Rh,{class:"".concat(qs,"-label")},{default:()=>[((x=t.label)===null||x===void 0?void 0:x.call(t))||n.label]})},_=()=>t.icon?ie("div",{class:"".concat(qs,"-icon")},[t.icon()]):u.value?b():null,y=()=>o.renderWithPopper.value&&!c.value?ie("span",{class:"".concat(qs,"-arrow")},[ie(t2,null,null)]):ie("span",{class:["".concat(qs,"-arrow"),d.value&&"is-opened"]},[ie(eH,null,null)]),T=x=>ie("div",{class:"".concat(qs,"-wrapper"),style:l.value,onClick:()=>{x==="click"&&g()}},[_(),u.value?null:b(),u.value?null:y()]),S=()=>{var x;return(x=t.default)===null||x===void 0?void 0:x.call(t)},E=()=>o.renderWithPopper.value?ie(Hy,{modelValue:d.value,"onUpdate:modelValue":x=>d.value=x,trigger:"hover",onlyShowTrigger:!0,placement:v.value,popperClass:"".concat(qs,"-popper"),offset:1},{default:S,trigger:T}):ie(en,null,[T("click"),ie(gS,null,{default:()=>[fh(ie("div",{class:"".concat(qs,"-children")},[S()]),[[gh,d.value]])]})]);return()=>ie("div",{class:m.value,ref:s},[E()])}});function SS(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(n);e&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(n,r).enumerable})),t.push.apply(t,i)}return t}function MS(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?SS(Object(t),!0).forEach(function(i){Rr(n,i,t[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):SS(Object(t)).forEach(function(i){Object.defineProperty(n,i,Object.getOwnPropertyDescriptor(t,i))})}return n}const TG=Qt("menu");var AG=Xe({name:_n.MENU,props:MG,emits:["select",xm,"update:expandedKeys"],setup(n,e){let{emit:t,slots:i}=e;di(),Pm();const[r,s]=rl(n,t),[o,a]=v8(n,t,{prop:"expandedKeys"}),l=Te(()=>n.mode==="horizontal"?!0:n.collapsed),{children:c}=Wy(),u=m=>{s(m),t("select",{value:m}),l.value&&c.forEach(g=>{g.type==="subMenu"&&(g.isOpened=!1)})},h=function(){return(arguments.length>0&&arguments[0]!==void 0?arguments[0]:[]).reduce((g,b)=>{var _;if(b.type==="subMenu"&&g.push(b.value||b.uid),(_=b.children)!==null&&_!==void 0&&_.length){const y=h(b.children);Y6(g,y)}return g},[])};bn(()=>{if(n.defaultExpandAll&&o.value.length===0){const m=h(c);a(m)}}),Si("rootMenu",{props:n,currentValue:r,clickMenuItem:u,clickSubMenu:(m,g)=>{m.isOpened.value&&n.accordion&&a(o.value.filter(b=>g.value.some(_=>_.uid===b))),a(m.value||m.uid)},renderWithPopper:l,currentExpandedKeys:o,updateExpandedKeys:a});const f=Te(()=>[TG,"is-".concat(n.mode),n.inverted&&"is-inverted",n.mode==="vertical"&&n.collapsed&&"is-collapsed"].filter(Boolean)),p=m=>m.map(g=>{const b={};return Qr(g.icon)&&(b.icon=g.icon),b.label=()=>Qr(g.label)?g.label():g.label,g.children?g.isGroup?ie(jy,null,MS({default:()=>[p(g.children)]},b)):ie(Yy,{value:g.value},MS({default:()=>[p(g.children)]},b)):ie(Xy,{value:g.value},b)}),v=()=>{if(n.options.length===0){var m;return(m=i.default)===null||m===void 0?void 0:m.call(i)}return p(n.options)};return()=>ie("div",{class:f.value},[v()])}});const Rre=Ur(AG,{MenuItem:Xy,MenuGroup:jy,SubMenu:Yy});zo(Xy);zo(jy);zo(Yy);function ES(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(n);e&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(n,r).enumerable})),t.push.apply(t,i)}return t}function TS(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ES(Object(t),!0).forEach(function(i){Rr(n,i,t[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):ES(Object(t)).forEach(function(i){Object.defineProperty(n,i,Object.getOwnPropertyDescriptor(t,i))})}return n}const pl=Qt("message"),R2={duration:3,getContainer:()=>document.body,top:"24px",colorful:!1};let Kl=R2,_o=null;const AS=ui({zIndex:0,top:Kl.top});function CG(n){var e,t;let{type:i,content:r,duration:s,icon:o,closable:a,afterClose:l,colorful:c}=n;AS.zIndex=Ph.nextZIndex();let u=null;function h(){var p,v;u&&((p=_o)===null||p===void 0||p.remove((v=u)===null||v===void 0?void 0:v.key)),u=null}function d(){var p,v;u&&((p=_o)===null||p===void 0||p.remove((v=u)===null||v===void 0?void 0:v.key)),u=null}function f(){const p=["".concat(pl)];c||c!==!1&&Kl.colorful||p.push("".concat(pl,"-no-colorful")),a&&p.push("".concat(pl,"-close"));const v=typeof r=="function",g={default:v?r:null,icon:typeof o=="function"?o:null};u=_o.append({afterRemove:l,duration:s!=null&&s>=0?s:Kl.duration,style:{zIndex:Ph.nextZIndex()},children:ie("div",{class:"".concat(pl,"-item")},[ie(OH,{class:p,type:i,message:v?"":r,showIcon:!0,closable:a,onClose:h},g)])})}return(e=_o)!==null&&e!==void 0&&(t=e.exited)!==null&&t!==void 0&&t.call(e)?f():RH({getContainer:Kl.getContainer,transitionName:"".concat(pl),class:"".concat(pl,"-wrapper"),maxCount:Kl.maxCount,style:AS}).then(p=>{_o=p,f()}),{destroy:d}}function hu(n,e,t){const i={type:n};return typeof e=="string"?(i.content=e,i.duration=t):Object.assign(i,e),CG(i)}const Lre={config(n){n&&(Kl=TS(TS({},R2),n))},info:(n,e)=>hu("info",n,e),success:(n,e)=>hu("success",n,e),warning:(n,e)=>hu("warning",n,e),warn:(n,e)=>hu("warning",n,e),error:(n,e)=>hu("error",n,e),destroy(){_o&&_o.destroy(),_o=null}};const du=Qt("spin"),PG={size:{type:String,default:"middle"},description:{type:String},stroke:{type:String},delay:{type:Number,default:0},show:{type:Boolean,default:!0}};var RG=Xe({name:"FSpin",props:PG,setup(n,e){let{slots:t}=e;di();const i=xe(n.show);let r;function s(){clearTimeout(r)}const o=()=>{i.value=!1},a=()=>{n.delay?r=setTimeout(()=>{i.value=!0},n.delay):i.value=!0};ft(()=>n.show,f=>{s(),f?a():o()}),Ir(()=>{s()});const c=Te(()=>{const f={};return n.stroke&&(f.color=n.stroke),f}),u=()=>{var f;return((f=t.icon)===null||f===void 0?void 0:f.call(t))||ie(e2,null,null)},h=()=>{var f;return!t.description&&!n.description?null:ie("span",{class:"".concat(du,"-description")},[((f=t.description)===null||f===void 0?void 0:f.call(t))||n.description])},d=()=>ie("div",{class:"".concat(du," is-size-").concat(n.size),style:c.value},[u()]);return()=>{var f;return t.default?ie("div",{class:"".concat(du,"-container ").concat(i.value?"is-spinning":"")},[ie("div",{class:"".concat(du,"-content")},[(f=t.default)===null||f===void 0?void 0:f.call(t)]),ie("div",{class:"".concat(du,"-wrapper")},[d(),h()])]):i.value?d():null}}});const Ore=Ur(RG);function LG(n){function e(i){const r=i.currentTarget;!r||!(r.offsetWidth<r.scrollWidth)||i.deltaY===0||(r.scrollLeft+=i.deltaY+i.deltaX,i.preventDefault())}function t(i){var r;(r=n.value)===null||r===void 0||r.scrollTo(i)}return bn(()=>{n.value.addEventListener("wheel",e)}),Ir(()=>{n.value.removeEventListener("wheel",e)}),{scrollTo:t}}const qy=Symbol("FTabs"),L2={key:[String,Number,Symbol],value:{type:[String,Number],required:!0},name:[String,Number],disabled:Boolean,closable:{type:Boolean,default:null},displayDirective:{type:String,default:"if"}};function OG(n){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"top";const t={width:"0px",height:"0px",transform:""};if(!n||n.children.length<=0)return t;const i=n.parentElement.children[0].getBoundingClientRect(),r=n.children[0].getBoundingClientRect();switch(e){case"left":case"right":t.width="2px",t.height="".concat(r.height,"px"),t.transform="translate(0px, ".concat(r.top-i.top,"px)");break;case"top":case"bottom":t.width="".concat(r.width,"px"),t.height="2px",t.transform="translate(".concat(r.left-i.left,"px, 0px)");break}return t}const ml=Qt("tabs");var IG=Xe({props:L2,setup(n,e){const{valueRef:t,tabsLength:i,closableRef:r,isCard:s,handleTabClick:o,handleClose:a,closeModeRef:l,setDefaultValue:c}=Zt(qy),u=Te(()=>{if(s.value)return typeof n.closable=="boolean"?n.closable:r.value});c(n.value);function h(){n.disabled||o(n.value)}function d(f){f.stopPropagation(),a(n.value)}return i.value=i.value+1,Ir(()=>{i.value=i.value-1}),()=>{const f=e.slots.default;return ie("div",{key:n.value,onClick:h,class:{["".concat(ml,"-tab")]:!0,["".concat(ml,"-tab-card")]:s.value,["".concat(ml,"-tab-active")]:t.value===n.value,["".concat(ml,"-tab-disabled")]:n.disabled,hover:l.value==="hover"}},[ie("div",{class:"".concat(ml,"-tab-label")},[f?f():n.name]),u.value&&ie("div",{class:"".concat(ml,"-tab-close")},[ie(JC,{onClick:d},null)])])}}});const DG=Qt("tabs");var ud=Xe({name:"FTabPane",props:L2,setup(){return Zt(qy,null)?{prefixCls:DG}:console.error("[FTabPane]: FTabPane 必须搭配 FTabs 组件使用!")}});function UG(n,e,t,i,r,s){return nt(),Mt("div",{class:Yt("".concat(n.prefixCls,"-tab-pane"))},[Ei(n.$slots,"default")],2)}ud.render=UG;ud.__file="components/tabs/tab-pane.vue";const NG=["render","renderTab"],Un=Qt("tabs"),CS="add";function FG(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],e=arguments.length>1?arguments[1]:void 0,t=arguments.length>2?arguments[2]:void 0;const i=[];return n.forEach(r=>{const{value:s,"display-directive":o,displayDirective:a}=r.props;r.key||(r.key=s),r.props.key||(r.props.key=s);const l=s===e,c=o||a;c==="show"?i.push(fh(r,[[gh,l]])):c==="show:lazy"&&(t[s]||l)?(t[s]=!0,i.push(fh(r,[[gh,l]]))):l&&i.push(r)}),i}const kG={modelValue:[String,Number],position:{type:String,default:"top"},type:{type:String,default:"line"},closable:{type:Boolean,default:!1},closeMode:{type:String,default:"visible"},addable:{type:Boolean,default:!1},transition:{type:[String,Boolean],default:!0},panes:{type:Array,default:()=>[]}};var BG=Xe({name:"FTabs",props:kG,emits:[xm,F1,Ip,CS],setup(n,e){di();const t={},i=xe([]),r=xe(!1),[s,o]=rl(n,e.emit),a=xe(0),l=Te(()=>n.type==="card"),c=Te(()=>l.value?"top":n.position),u=xe(!1),h=xe(!1),d=xe(null);bn(()=>{d.value&&LG(d)});const f=xe({});function p(S,E){S&&(i.value[E]=S)}function v(S){o(S),e.emit(F1,S)}function m(S){e.emit(CS,S)}function g(S){e.emit(Ip,S)}function b(S){if(S==null||S.preventDefault(),!d.value||!r.value)return;const{scrollWidth:E,scrollHeight:x,scrollLeft:M,scrollTop:w,offsetWidth:C,offsetHeight:L}=d.value;u.value=M>0||w>0,h.value=M+C<E||w+L<x}function _(S){if(!d.value||!S||!r.value)return;const{scrollLeft:E,scrollTop:x,offsetWidth:M,offsetHeight:w}=d.value;["top","bottom"].includes(n.position)&&(E+M<S.offsetLeft+S.offsetWidth||S.offsetLeft<E)?d.value.scrollTo({left:S.offsetLeft-M+S.offsetWidth}):["left","right"].includes(n.position)&&(x+w<S.offsetTop+S.offsetHeight||S.offsetTop<x)&&d.value.scrollTo({top:S.offsetTop-w+S.offsetHeight}),b()}const y=S=>{!s.value&&s.value!==0&&o(S)};Si(qy,{valueRef:s,closableRef:Dx(n,"closable"),closeModeRef:Dx(n,"closeMode"),isCard:l,tabsLength:a,handleTabClick:v,handleClose:g,setDefaultValue:y}),ft(()=>[s.value,c.value],()=>{Jr(()=>{const S=i.value.find(E=>E.value===s.value);l.value||(f.value=OG(S==null?void 0:S.$el,c.value)),_(S==null?void 0:S.$el)})},{immediate:!0}),ft(a,()=>{Jr(()=>{if(!d.value)return;const{scrollWidth:S,offsetWidth:E,scrollHeight:x,offsetHeight:M}=d.value;(S>E||x>M)&&(r.value=!0)})});const T=()=>{var S;const E=e.slots.default&&Dp(e.slots.default()).filter(x=>x.type.name==="FTabPane")||[];return(S=n.panes)!==null&&S!==void 0&&S.length?E.concat(n.panes.map(x=>{const{render:M,renderTab:w}=x,C=ZC(x,NG);M||console.warn("[FTab]: panes需要提供render");const L={default:()=>M==null?void 0:M(C),tab:w?()=>w(C):null};return ie(ud,Cr(C,{value:C.value}),L)})):E};return()=>{const S=T();return ie("div",{class:{["".concat(Un)]:!0,["".concat(Un,"-").concat(c.value)]:!0,["".concat(Un,"-card")]:l.value}},[ie("div",{class:"".concat(Un,"-nav")},[e.slots.prefix&&ie("div",{class:"".concat(Un,"-nav-prefix")},[e.slots.prefix()]),ie("div",{class:{["".concat(Un,"-nav-wrapper")]:!0,["".concat(Un,"-nav-wrapper--before")]:u.value,["".concat(Un,"-nav-wrapper--after")]:h.value}},[ie("div",{class:"".concat(Un,"-nav-scroll"),onScroll:b,ref:d},[S.map((E,x)=>{var M;const w=(M=E.children)===null||M===void 0?void 0:M.tab;return ie(en,null,[x>0&&l.value&&ie("div",{class:"".concat(Un,"-tab-pad")},null),ie(IG,Cr(E.props,{ref:C=>p(C,x)}),{default:w})])}),!l.value&&ie("div",{class:"".concat(Un,"-nav-bar"),style:f.value},null)])]),l.value&&n.addable&&ie(en,null,[ie("div",{class:"".concat(Un,"-tab-pad")},null),ie("div",{onClick:m,class:"".concat(Un,"-tab ").concat(Un,"-tab-card addable")},[ie(iH,null,null)])]),e.slots.suffix?ie("div",{class:"".concat(Un,"-nav-suffix")},[e.slots.suffix()]):l.value&&ie("div",{class:"".concat(Un,"-tab-pad--last")},null)]),ie("div",{class:"".concat(Un,"-tab-pane-wrapper")},[ie(py,{name:n.transition?n.transition===!0?"".concat(Un,"-slide-fade"):n.transition:null},{default:()=>[FG(S,s.value,t)]})])])}}});const Ire=Ur(BG,{TabPane:ud}),Dre=zo(ud);const zG={type:{type:String,default:"default"},size:{type:String,default:"middle"},strong:Boolean,italic:Boolean,tag:{type:String,default:"span"}};function PS(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(n);e&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(n,r).enumerable})),t.push.apply(t,i)}return t}function VG(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?PS(Object(t),!0).forEach(function(i){Rr(n,i,t[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):PS(Object(t)).forEach(function(i){Object.defineProperty(n,i,Object.getOwnPropertyDescriptor(t,i))})}return n}const gl=Qt("text");var HG=Xe({name:"FText",components:{},props:VG({},zG),setup(n){di();const e=Te(()=>({[gl]:!0,["".concat(gl,"-type--").concat(n.type)]:n.type,["".concat(gl,"-size--").concat(n.size)]:n.size,["".concat(gl,"-text--strong")]:n.strong,["".concat(gl,"-text--italic")]:n.italic}));return{prefixCls:gl,textClass:e}},render(){const n=C0(this.$slots);return Io(this.tag||"span",{class:this.textClass},n)}});const Ure=Ur(HG);/**
* @license
* Copyright 2010-2023 Three.js Authors
* SPDX-License-Identifier: MIT
*/const Vc="158",Ss={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},xr={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},O2=0,D0=1,I2=2,GG=3,WG=0,Ky=1,Zy=2,Gr=3,ns=0,Qn=1,bi=2,$G=2,Ps=0,Ra=1,Bp=2,U0=3,N0=4,D2=5,yo=100,U2=101,N2=102,F0=103,k0=104,F2=200,k2=201,B2=202,z2=203,zp=204,Vp=205,V2=206,H2=207,G2=208,W2=209,$2=210,j2=211,X2=212,Y2=213,q2=214,K2=0,Z2=1,J2=2,Lh=3,Q2=4,eP=5,tP=6,nP=7,hd=0,iP=1,rP=2,Rs=0,sP=1,oP=2,aP=3,Jy=4,lP=5,B0="attached",cP="detached",Rm=300,Ns=301,Fo=302,Tc=303,Oh=304,Hc=306,is=1e3,Rn=1001,Ac=1002,hn=1003,Ih=1004,jG=1004,hc=1005,XG=1005,rn=1006,Lm=1007,YG=1007,rs=1008,qG=1008,Tr=1009,uP=1010,hP=1011,Om=1012,Qy=1013,Ts=1014,jr=1015,Cc=1016,eb=1017,tb=1018,Ao=1020,dP=1021,ki=1023,fP=1024,pP=1025,Co=1026,za=1027,mP=1028,nb=1029,gP=1030,ib=1031,rb=1033,up=33776,hp=33777,dp=33778,fp=33779,z0=35840,V0=35841,H0=35842,G0=35843,vP=36196,W0=37492,$0=37496,j0=37808,X0=37809,Y0=37810,q0=37811,K0=37812,Z0=37813,J0=37814,Q0=37815,e_=37816,t_=37817,n_=37818,i_=37819,r_=37820,s_=37821,pp=36492,o_=36494,a_=36495,_P=36283,l_=36284,c_=36285,u_=36286,yP=2200,bP=2201,xP=2202,Pc=2300,Va=2301,mp=2302,Sa=2400,Ma=2401,Dh=2402,Im=2500,sb=2501,wP=0,ob=1,Hp=2,ab=3e3,Po=3001,SP=3200,MP=3201,Ho=0,EP=1,Bi="",Mn="srgb",ss="srgb-linear",Dm="display-p3",dd="display-p3-linear",Uh="linear",Ht="srgb",Nh="rec709",Fh="p3",KG=0,pa=7680,ZG=7681,JG=7682,QG=7683,e7=34055,t7=34056,n7=5386,i7=512,r7=513,s7=514,o7=515,a7=516,l7=517,c7=518,h_=519,TP=512,AP=513,CP=514,PP=515,RP=516,LP=517,OP=518,IP=519,kh=35044,u7=35048,h7=35040,d7=35045,f7=35049,p7=35041,m7=35046,g7=35050,v7=35042,_7="100",d_="300 es",Gp=1035,Xr=2e3,Bh=2001;class Nr{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const i=this._listeners;i[e]===void 0&&(i[e]=[]),i[e].indexOf(t)===-1&&i[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;const i=this._listeners;return i[e]!==void 0&&i[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const r=this._listeners[e];if(r!==void 0){const s=r.indexOf(t);s!==-1&&r.splice(s,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const i=this._listeners[e.type];if(i!==void 0){e.target=this;const r=i.slice(0);for(let s=0,o=r.length;s<o;s++)r[s].call(this,e);e.target=null}}}const Yn=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];let RS=1234567;const La=Math.PI/180,Rc=180/Math.PI;function Hi(){const n=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,i=Math.random()*4294967295|0;return(Yn[n&255]+Yn[n>>8&255]+Yn[n>>16&255]+Yn[n>>24&255]+"-"+Yn[e&255]+Yn[e>>8&255]+"-"+Yn[e>>16&15|64]+Yn[e>>24&255]+"-"+Yn[t&63|128]+Yn[t>>8&255]+"-"+Yn[t>>16&255]+Yn[t>>24&255]+Yn[i&255]+Yn[i>>8&255]+Yn[i>>16&255]+Yn[i>>24&255]).toLowerCase()}function dn(n,e,t){return Math.max(e,Math.min(t,n))}function lb(n,e){return(n%e+e)%e}function y7(n,e,t,i,r){return i+(n-e)*(r-i)/(t-e)}function b7(n,e,t){return n!==e?(t-n)/(e-n):0}function eh(n,e,t){return(1-t)*n+t*e}function x7(n,e,t,i){return eh(n,e,1-Math.exp(-t*i))}function w7(n,e=1){return e-Math.abs(lb(n,e*2)-e)}function S7(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*(3-2*n))}function M7(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*n*(n*(n*6-15)+10))}function E7(n,e){return n+Math.floor(Math.random()*(e-n+1))}function T7(n,e){return n+Math.random()*(e-n)}function A7(n){return n*(.5-Math.random())}function C7(n){n!==void 0&&(RS=n);let e=RS+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function P7(n){return n*La}function R7(n){return n*Rc}function f_(n){return(n&n-1)===0&&n!==0}function DP(n){return Math.pow(2,Math.ceil(Math.log(n)/Math.LN2))}function Wp(n){return Math.pow(2,Math.floor(Math.log(n)/Math.LN2))}function L7(n,e,t,i,r){const s=Math.cos,o=Math.sin,a=s(t/2),l=o(t/2),c=s((e+i)/2),u=o((e+i)/2),h=s((e-i)/2),d=o((e-i)/2),f=s((i-e)/2),p=o((i-e)/2);switch(r){case"XYX":n.set(a*u,l*h,l*d,a*c);break;case"YZY":n.set(l*d,a*u,l*h,a*c);break;case"ZXZ":n.set(l*h,l*d,a*u,a*c);break;case"XZX":n.set(a*u,l*p,l*f,a*c);break;case"YXY":n.set(l*f,a*u,l*p,a*c);break;case"ZYZ":n.set(l*p,l*f,a*u,a*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}function xi(n,e){switch(e.constructor){case Float32Array:return n;case Uint32Array:return n/4294967295;case Uint16Array:return n/65535;case Uint8Array:return n/255;case Int32Array:return Math.max(n/2147483647,-1);case Int16Array:return Math.max(n/32767,-1);case Int8Array:return Math.max(n/127,-1);default:throw new Error("Invalid component type.")}}function ht(n,e){switch(e.constructor){case Float32Array:return n;case Uint32Array:return Math.round(n*4294967295);case Uint16Array:return Math.round(n*65535);case Uint8Array:return Math.round(n*255);case Int32Array:return Math.round(n*2147483647);case Int16Array:return Math.round(n*32767);case Int8Array:return Math.round(n*127);default:throw new Error("Invalid component type.")}}const Gn={DEG2RAD:La,RAD2DEG:Rc,generateUUID:Hi,clamp:dn,euclideanModulo:lb,mapLinear:y7,inverseLerp:b7,lerp:eh,damp:x7,pingpong:w7,smoothstep:S7,smootherstep:M7,randInt:E7,randFloat:T7,randFloatSpread:A7,seededRandom:C7,degToRad:P7,radToDeg:R7,isPowerOfTwo:f_,ceilPowerOfTwo:DP,floorPowerOfTwo:Wp,setQuaternionFromProperEuler:L7,normalize:ht,denormalize:xi};class _e{constructor(e=0,t=0){_e.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,i=this.y,r=e.elements;return this.x=r[0]*t+r[3]*i+r[6],this.y=r[1]*t+r[4]*i+r[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const i=this.dot(e)/t;return Math.acos(dn(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,i=this.y-e.y;return t*t+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const i=Math.cos(t),r=Math.sin(t),s=this.x-e.x,o=this.y-e.y;return this.x=s*i-o*r+e.x,this.y=s*r+o*i+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class ut{constructor(e,t,i,r,s,o,a,l,c){ut.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,i,r,s,o,a,l,c)}set(e,t,i,r,s,o,a,l,c){const u=this.elements;return u[0]=e,u[1]=r,u[2]=a,u[3]=t,u[4]=s,u[5]=l,u[6]=i,u[7]=o,u[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],this}extractBasis(e,t,i){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const i=e.elements,r=t.elements,s=this.elements,o=i[0],a=i[3],l=i[6],c=i[1],u=i[4],h=i[7],d=i[2],f=i[5],p=i[8],v=r[0],m=r[3],g=r[6],b=r[1],_=r[4],y=r[7],T=r[2],S=r[5],E=r[8];return s[0]=o*v+a*b+l*T,s[3]=o*m+a*_+l*S,s[6]=o*g+a*y+l*E,s[1]=c*v+u*b+h*T,s[4]=c*m+u*_+h*S,s[7]=c*g+u*y+h*E,s[2]=d*v+f*b+p*T,s[5]=d*m+f*_+p*S,s[8]=d*g+f*y+p*E,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8];return t*o*u-t*a*c-i*s*u+i*a*l+r*s*c-r*o*l}invert(){const e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8],h=u*o-a*c,d=a*l-u*s,f=c*s-o*l,p=t*h+i*d+r*f;if(p===0)return this.set(0,0,0,0,0,0,0,0,0);const v=1/p;return e[0]=h*v,e[1]=(r*c-u*i)*v,e[2]=(a*i-r*o)*v,e[3]=d*v,e[4]=(u*t-r*l)*v,e[5]=(r*s-a*t)*v,e[6]=f*v,e[7]=(i*l-c*t)*v,e[8]=(o*t-i*s)*v,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,i,r,s,o,a){const l=Math.cos(s),c=Math.sin(s);return this.set(i*l,i*c,-i*(l*o+c*a)+o+e,-r*c,r*l,-r*(-c*o+l*a)+a+t,0,0,1),this}scale(e,t){return this.premultiply(Gg.makeScale(e,t)),this}rotate(e){return this.premultiply(Gg.makeRotation(-e)),this}translate(e,t){return this.premultiply(Gg.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,i,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,i=e.elements;for(let r=0;r<9;r++)if(t[r]!==i[r])return!1;return!0}fromArray(e,t=0){for(let i=0;i<9;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){const i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const Gg=new ut;function UP(n){for(let e=n.length-1;e>=0;--e)if(n[e]>=65535)return!0;return!1}const O7={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function Zl(n,e){return new O7[n](e)}function zh(n){return document.createElementNS("http://www.w3.org/1999/xhtml",n)}function NP(){const n=zh("canvas");return n.style.display="block",n}const LS={};function th(n){n in LS||(LS[n]=!0,console.warn(n))}const OS=new ut().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),IS=new ut().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),Jd={[ss]:{transfer:Uh,primaries:Nh,toReference:n=>n,fromReference:n=>n},[Mn]:{transfer:Ht,primaries:Nh,toReference:n=>n.convertSRGBToLinear(),fromReference:n=>n.convertLinearToSRGB()},[dd]:{transfer:Uh,primaries:Fh,toReference:n=>n.applyMatrix3(IS),fromReference:n=>n.applyMatrix3(OS)},[Dm]:{transfer:Ht,primaries:Fh,toReference:n=>n.convertSRGBToLinear().applyMatrix3(IS),fromReference:n=>n.applyMatrix3(OS).convertLinearToSRGB()}},I7=new Set([ss,dd]),Ut={enabled:!0,_workingColorSpace:ss,get legacyMode(){return console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),!this.enabled},set legacyMode(n){console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),this.enabled=!n},get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(n){if(!I7.has(n))throw new Error('Unsupported working color space, "'.concat(n,'".'));this._workingColorSpace=n},convert:function(n,e,t){if(this.enabled===!1||e===t||!e||!t)return n;const i=Jd[e].toReference,r=Jd[t].fromReference;return r(i(n))},fromWorkingColorSpace:function(n,e){return this.convert(n,this._workingColorSpace,e)},toWorkingColorSpace:function(n,e){return this.convert(n,e,this._workingColorSpace)},getPrimaries:function(n){return Jd[n].primaries},getTransfer:function(n){return n===Bi?Uh:Jd[n].transfer}};function dc(n){return n<.04045?n*.0773993808:Math.pow(n*.9478672986+.0521327014,2.4)}function Wg(n){return n<.0031308?n*12.92:1.055*Math.pow(n,.41666)-.055}let vl;class cb{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{vl===void 0&&(vl=zh("canvas")),vl.width=e.width,vl.height=e.height;const i=vl.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),t=vl}return t.width>2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=zh("canvas");t.width=e.width,t.height=e.height;const i=t.getContext("2d");i.drawImage(e,0,0,e.width,e.height);const r=i.getImageData(0,0,e.width,e.height),s=r.data;for(let o=0;o<s.length;o++)s[o]=dc(s[o]/255)*255;return i.putImageData(r,0,0),t}else if(e.data){const t=e.data.slice(0);for(let i=0;i<t.length;i++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[i]=Math.floor(dc(t[i]/255)*255):t[i]=dc(t[i]);return{data:t,width:e.width,height:e.height}}else return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let D7=0;class Ea{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:D7++}),this.uuid=Hi(),this.data=e,this.version=0}set needsUpdate(e){e===!0&&this.version++}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];const i={uuid:this.uuid,url:""},r=this.data;if(r!==null){let s;if(Array.isArray(r)){s=[];for(let o=0,a=r.length;o<a;o++)r[o].isDataTexture?s.push($g(r[o].image)):s.push($g(r[o]))}else s=$g(r);i.url=s}return t||(e.images[this.uuid]=i),i}}function $g(n){return typeof HTMLImageElement<"u"&&n instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&n instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&n instanceof ImageBitmap?cb.getDataURL(n):n.data?{data:Array.from(n.data),width:n.width,height:n.height,type:n.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}let U7=0;class Jt extends Nr{constructor(e=Jt.DEFAULT_IMAGE,t=Jt.DEFAULT_MAPPING,i=Rn,r=Rn,s=rn,o=rs,a=ki,l=Tr,c=Jt.DEFAULT_ANISOTROPY,u=Bi){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:U7++}),this.uuid=Hi(),this.name="",this.source=new Ea(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=i,this.wrapT=r,this.magFilter=s,this.minFilter=o,this.anisotropy=c,this.format=a,this.internalFormat=null,this.type=l,this.offset=new _e(0,0),this.repeat=new _e(1,1),this.center=new _e(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new ut,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,typeof u=="string"?this.colorSpace=u:(th("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace=u===Po?Mn:Bi),this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.needsPMREMUpdate=!1}get image(){return this.source.data}set image(e=null){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const i={metadata:{version:4.6,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(i.userData=this.userData),t||(e.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==Rm)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case is:e.x=e.x-Math.floor(e.x);break;case Rn:e.x=e.x<0?0:1;break;case Ac:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case is:e.y=e.y-Math.floor(e.y);break;case Rn:e.y=e.y<0?0:1;break;case Ac:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}get encoding(){return th("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace===Mn?Po:ab}set encoding(e){th("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace=e===Po?Mn:Bi}}Jt.DEFAULT_IMAGE=null;Jt.DEFAULT_MAPPING=Rm;Jt.DEFAULT_ANISOTROPY=1;class vt{constructor(e=0,t=0,i=0,r=1){vt.prototype.isVector4=!0,this.x=e,this.y=t,this.z=i,this.w=r}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,i,r){return this.x=e,this.y=t,this.z=i,this.w=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,i=this.y,r=this.z,s=this.w,o=e.elements;return this.x=o[0]*t+o[4]*i+o[8]*r+o[12]*s,this.y=o[1]*t+o[5]*i+o[9]*r+o[13]*s,this.z=o[2]*t+o[6]*i+o[10]*r+o[14]*s,this.w=o[3]*t+o[7]*i+o[11]*r+o[15]*s,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,i,r,s;const l=e.elements,c=l[0],u=l[4],h=l[8],d=l[1],f=l[5],p=l[9],v=l[2],m=l[6],g=l[10];if(Math.abs(u-d)<.01&&Math.abs(h-v)<.01&&Math.abs(p-m)<.01){if(Math.abs(u+d)<.1&&Math.abs(h+v)<.1&&Math.abs(p+m)<.1&&Math.abs(c+f+g-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const _=(c+1)/2,y=(f+1)/2,T=(g+1)/2,S=(u+d)/4,E=(h+v)/4,x=(p+m)/4;return _>y&&_>T?_<.01?(i=0,r=.707106781,s=.707106781):(i=Math.sqrt(_),r=S/i,s=E/i):y>T?y<.01?(i=.707106781,r=0,s=.707106781):(r=Math.sqrt(y),i=S/r,s=x/r):T<.01?(i=.707106781,r=.707106781,s=0):(s=Math.sqrt(T),i=E/s,r=x/s),this.set(i,r,s,t),this}let b=Math.sqrt((m-p)*(m-p)+(h-v)*(h-v)+(d-u)*(d-u));return Math.abs(b)<.001&&(b=1),this.x=(m-p)/b,this.y=(h-v)/b,this.z=(d-u)/b,this.w=Math.acos((c+f+g-1)/2),this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this.w=e.w+(t.w-e.w)*i,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class FP extends Nr{constructor(e=1,t=1,i={}){super(),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new vt(0,0,e,t),this.scissorTest=!1,this.viewport=new vt(0,0,e,t);const r={width:e,height:t,depth:1};i.encoding!==void 0&&(th("THREE.WebGLRenderTarget: option.encoding has been replaced by option.colorSpace."),i.colorSpace=i.encoding===Po?Mn:Bi),i=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:rn,depthBuffer:!0,stencilBuffer:!1,depthTexture:null,samples:0},i),this.texture=new Jt(r,i.mapping,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.flipY=!1,this.texture.generateMipmaps=i.generateMipmaps,this.texture.internalFormat=i.internalFormat,this.depthBuffer=i.depthBuffer,this.stencilBuffer=i.stencilBuffer,this.depthTexture=i.depthTexture,this.samples=i.samples}setSize(e,t,i=1){(this.width!==e||this.height!==t||this.depth!==i)&&(this.width=e,this.height=t,this.depth=i,this.texture.image.width=e,this.texture.image.height=t,this.texture.image.depth=i,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.texture.isRenderTargetTexture=!0;const t=Object.assign({},e.texture.image);return this.texture.source=new Ea(t),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class Lr extends FP{constructor(e=1,t=1,i={}){super(e,t,i),this.isWebGLRenderTarget=!0}}class Um extends Jt{constructor(e=null,t=1,i=1,r=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:i,depth:r},this.magFilter=hn,this.minFilter=hn,this.wrapR=Rn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class N7 extends Lr{constructor(e=1,t=1,i=1){super(e,t),this.isWebGLArrayRenderTarget=!0,this.depth=i,this.texture=new Um(null,e,t,i),this.texture.isRenderTargetTexture=!0}}class ub extends Jt{constructor(e=null,t=1,i=1,r=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:i,depth:r},this.magFilter=hn,this.minFilter=hn,this.wrapR=Rn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class F7 extends Lr{constructor(e=1,t=1,i=1){super(e,t),this.isWebGL3DRenderTarget=!0,this.depth=i,this.texture=new ub(null,e,t,i),this.texture.isRenderTargetTexture=!0}}class k7 extends Lr{constructor(e=1,t=1,i=1,r={}){super(e,t,r),this.isWebGLMultipleRenderTargets=!0;const s=this.texture;this.texture=[];for(let o=0;o<i;o++)this.texture[o]=s.clone(),this.texture[o].isRenderTargetTexture=!0}setSize(e,t,i=1){if(this.width!==e||this.height!==t||this.depth!==i){this.width=e,this.height=t,this.depth=i;for(let r=0,s=this.texture.length;r<s;r++)this.texture[r].image.width=e,this.texture[r].image.height=t,this.texture[r].image.depth=i;this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}copy(e){this.dispose(),this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.texture.length=0;for(let t=0,i=e.texture.length;t<i;t++)this.texture[t]=e.texture[t].clone(),this.texture[t].isRenderTargetTexture=!0;return this}}class gt{constructor(e=0,t=0,i=0,r=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=i,this._w=r}static slerpFlat(e,t,i,r,s,o,a){let l=i[r+0],c=i[r+1],u=i[r+2],h=i[r+3];const d=s[o+0],f=s[o+1],p=s[o+2],v=s[o+3];if(a===0){e[t+0]=l,e[t+1]=c,e[t+2]=u,e[t+3]=h;return}if(a===1){e[t+0]=d,e[t+1]=f,e[t+2]=p,e[t+3]=v;return}if(h!==v||l!==d||c!==f||u!==p){let m=1-a;const g=l*d+c*f+u*p+h*v,b=g>=0?1:-1,_=1-g*g;if(_>Number.EPSILON){const T=Math.sqrt(_),S=Math.atan2(T,g*b);m=Math.sin(m*S)/T,a=Math.sin(a*S)/T}const y=a*b;if(l=l*m+d*y,c=c*m+f*y,u=u*m+p*y,h=h*m+v*y,m===1-a){const T=1/Math.sqrt(l*l+c*c+u*u+h*h);l*=T,c*=T,u*=T,h*=T}}e[t]=l,e[t+1]=c,e[t+2]=u,e[t+3]=h}static multiplyQuaternionsFlat(e,t,i,r,s,o){const a=i[r],l=i[r+1],c=i[r+2],u=i[r+3],h=s[o],d=s[o+1],f=s[o+2],p=s[o+3];return e[t]=a*p+u*h+l*f-c*d,e[t+1]=l*p+u*d+c*h-a*f,e[t+2]=c*p+u*f+a*d-l*h,e[t+3]=u*p-a*h-l*d-c*f,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,i,r){return this._x=e,this._y=t,this._z=i,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t){const i=e._x,r=e._y,s=e._z,o=e._order,a=Math.cos,l=Math.sin,c=a(i/2),u=a(r/2),h=a(s/2),d=l(i/2),f=l(r/2),p=l(s/2);switch(o){case"XYZ":this._x=d*u*h+c*f*p,this._y=c*f*h-d*u*p,this._z=c*u*p+d*f*h,this._w=c*u*h-d*f*p;break;case"YXZ":this._x=d*u*h+c*f*p,this._y=c*f*h-d*u*p,this._z=c*u*p-d*f*h,this._w=c*u*h+d*f*p;break;case"ZXY":this._x=d*u*h-c*f*p,this._y=c*f*h+d*u*p,this._z=c*u*p+d*f*h,this._w=c*u*h-d*f*p;break;case"ZYX":this._x=d*u*h-c*f*p,this._y=c*f*h+d*u*p,this._z=c*u*p-d*f*h,this._w=c*u*h+d*f*p;break;case"YZX":this._x=d*u*h+c*f*p,this._y=c*f*h+d*u*p,this._z=c*u*p-d*f*h,this._w=c*u*h-d*f*p;break;case"XZY":this._x=d*u*h-c*f*p,this._y=c*f*h-d*u*p,this._z=c*u*p+d*f*h,this._w=c*u*h+d*f*p;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return t!==!1&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const i=t/2,r=Math.sin(i);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,i=t[0],r=t[4],s=t[8],o=t[1],a=t[5],l=t[9],c=t[2],u=t[6],h=t[10],d=i+a+h;if(d>0){const f=.5/Math.sqrt(d+1);this._w=.25/f,this._x=(u-l)*f,this._y=(s-c)*f,this._z=(o-r)*f}else if(i>a&&i>h){const f=2*Math.sqrt(1+i-a-h);this._w=(u-l)/f,this._x=.25*f,this._y=(r+o)/f,this._z=(s+c)/f}else if(a>h){const f=2*Math.sqrt(1+a-i-h);this._w=(s-c)/f,this._x=(r+o)/f,this._y=.25*f,this._z=(l+u)/f}else{const f=2*Math.sqrt(1+h-i-a);this._w=(o-r)/f,this._x=(s+c)/f,this._y=(l+u)/f,this._z=.25*f}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let i=e.dot(t)+1;return i<Number.EPSILON?(i=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=i):(this._x=0,this._y=-e.z,this._z=e.y,this._w=i)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=i),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(dn(this.dot(e),-1,1)))}rotateTowards(e,t){const i=this.angleTo(e);if(i===0)return this;const r=Math.min(1,t/i);return this.slerp(e,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const i=e._x,r=e._y,s=e._z,o=e._w,a=t._x,l=t._y,c=t._z,u=t._w;return this._x=i*u+o*a+r*c-s*l,this._y=r*u+o*l+s*a-i*c,this._z=s*u+o*c+i*l-r*a,this._w=o*u-i*a-r*l-s*c,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const i=this._x,r=this._y,s=this._z,o=this._w;let a=o*e._w+i*e._x+r*e._y+s*e._z;if(a<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,a=-a):this.copy(e),a>=1)return this._w=o,this._x=i,this._y=r,this._z=s,this;const l=1-a*a;if(l<=Number.EPSILON){const f=1-t;return this._w=f*o+t*this._w,this._x=f*i+t*this._x,this._y=f*r+t*this._y,this._z=f*s+t*this._z,this.normalize(),this._onChangeCallback(),this}const c=Math.sqrt(l),u=Math.atan2(c,a),h=Math.sin((1-t)*u)/c,d=Math.sin(t*u)/c;return this._w=o*h+this._w*d,this._x=i*h+this._x*d,this._y=r*h+this._y*d,this._z=s*h+this._z*d,this._onChangeCallback(),this}slerpQuaternions(e,t,i){return this.copy(e).slerp(t,i)}random(){const e=Math.random(),t=Math.sqrt(1-e),i=Math.sqrt(e),r=2*Math.PI*Math.random(),s=2*Math.PI*Math.random();return this.set(t*Math.cos(r),i*Math.sin(s),i*Math.cos(s),t*Math.sin(r))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class D{constructor(e=0,t=0,i=0){D.prototype.isVector3=!0,this.x=e,this.y=t,this.z=i}set(e,t,i){return i===void 0&&(i=this.z),this.x=e,this.y=t,this.z=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(DS.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(DS.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,i=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[3]*i+s[6]*r,this.y=s[1]*t+s[4]*i+s[7]*r,this.z=s[2]*t+s[5]*i+s[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,i=this.y,r=this.z,s=e.elements,o=1/(s[3]*t+s[7]*i+s[11]*r+s[15]);return this.x=(s[0]*t+s[4]*i+s[8]*r+s[12])*o,this.y=(s[1]*t+s[5]*i+s[9]*r+s[13])*o,this.z=(s[2]*t+s[6]*i+s[10]*r+s[14])*o,this}applyQuaternion(e){const t=this.x,i=this.y,r=this.z,s=e.x,o=e.y,a=e.z,l=e.w,c=2*(o*r-a*i),u=2*(a*t-s*r),h=2*(s*i-o*t);return this.x=t+l*c+o*h-a*u,this.y=i+l*u+a*c-s*h,this.z=r+l*h+s*u-o*c,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,i=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[4]*i+s[8]*r,this.y=s[1]*t+s[5]*i+s[9]*r,this.z=s[2]*t+s[6]*i+s[10]*r,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const i=e.x,r=e.y,s=e.z,o=t.x,a=t.y,l=t.z;return this.x=r*l-s*a,this.y=s*o-i*l,this.z=i*a-r*o,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const i=e.dot(this)/t;return this.copy(e).multiplyScalar(i)}projectOnPlane(e){return jg.copy(this).projectOnVector(e),this.sub(jg)}reflect(e){return this.sub(jg.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const i=this.dot(e)/t;return Math.acos(dn(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,i=this.y-e.y,r=this.z-e.z;return t*t+i*i+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,i){const r=Math.sin(t)*e;return this.x=r*Math.sin(i),this.y=Math.cos(t)*e,this.z=r*Math.cos(i),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,i){return this.x=e*Math.sin(t),this.y=i,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),i=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=i,this.z=r,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=(Math.random()-.5)*2,t=Math.random()*Math.PI*2,i=Math.sqrt(1-e**2);return this.x=i*Math.cos(t),this.y=i*Math.sin(t),this.z=e,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const jg=new D,DS=new gt;class Pi{constructor(e=new D(1/0,1/0,1/0),t=new D(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,i=e.length;t<i;t+=3)this.expandByPoint(fr.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,i=e.count;t<i;t++)this.expandByPoint(fr.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,i=e.length;t<i;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const i=fr.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);const i=e.geometry;if(i!==void 0){const s=i.getAttribute("position");if(t===!0&&s!==void 0&&e.isInstancedMesh!==!0)for(let o=0,a=s.count;o<a;o++)e.isMesh===!0?e.getVertexPosition(o,fr):fr.fromBufferAttribute(s,o),fr.applyMatrix4(e.matrixWorld),this.expandByPoint(fr);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),Qd.copy(e.boundingBox)):(i.boundingBox===null&&i.computeBoundingBox(),Qd.copy(i.boundingBox)),Qd.applyMatrix4(e.matrixWorld),this.union(Qd)}const r=e.children;for(let s=0,o=r.length;s<o;s++)this.expandByObject(r[s],t);return this}containsPoint(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y||e.z<this.min.z||e.z>this.max.z)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y||e.max.z<this.min.z||e.min.z>this.max.z)}intersectsSphere(e){return this.clampPoint(e.center,fr),fr.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,i;return e.normal.x>0?(t=e.normal.x*this.min.x,i=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,i=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,i+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,i+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,i+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,i+=e.normal.z*this.min.z),t<=-e.constant&&i>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(fu),ef.subVectors(this.max,fu),_l.subVectors(e.a,fu),yl.subVectors(e.b,fu),bl.subVectors(e.c,fu),Ks.subVectors(yl,_l),Zs.subVectors(bl,yl),Jo.subVectors(_l,bl);let t=[0,-Ks.z,Ks.y,0,-Zs.z,Zs.y,0,-Jo.z,Jo.y,Ks.z,0,-Ks.x,Zs.z,0,-Zs.x,Jo.z,0,-Jo.x,-Ks.y,Ks.x,0,-Zs.y,Zs.x,0,-Jo.y,Jo.x,0];return!Xg(t,_l,yl,bl,ef)||(t=[1,0,0,0,1,0,0,0,1],!Xg(t,_l,yl,bl,ef))?!1:(tf.crossVectors(Ks,Zs),t=[tf.x,tf.y,tf.z],Xg(t,_l,yl,bl,ef))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,fr).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(fr).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(fs[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),fs[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),fs[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),fs[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),fs[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),fs[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),fs[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),fs[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(fs),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const fs=[new D,new D,new D,new D,new D,new D,new D,new D],fr=new D,Qd=new Pi,_l=new D,yl=new D,bl=new D,Ks=new D,Zs=new D,Jo=new D,fu=new D,ef=new D,tf=new D,Qo=new D;function Xg(n,e,t,i,r){for(let s=0,o=n.length-3;s<=o;s+=3){Qo.fromArray(n,s);const a=r.x*Math.abs(Qo.x)+r.y*Math.abs(Qo.y)+r.z*Math.abs(Qo.z),l=e.dot(Qo),c=t.dot(Qo),u=i.dot(Qo);if(Math.max(-Math.max(l,c,u),Math.min(l,c,u))>a)return!1}return!0}const B7=new Pi,pu=new D,Yg=new D;class Ri{constructor(e=new D,t=-1){this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const i=this.center;t!==void 0?i.copy(t):B7.setFromPoints(e).getCenter(i);let r=0;for(let s=0,o=e.length;s<o;s++)r=Math.max(r,i.distanceToSquared(e[s]));return this.radius=Math.sqrt(r),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){const t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){const i=this.center.distanceToSquared(e);return t.copy(e),i>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;pu.subVectors(e,this.center);const t=pu.lengthSq();if(t>this.radius*this.radius){const i=Math.sqrt(t),r=(i-this.radius)*.5;this.center.addScaledVector(pu,r/i),this.radius+=r}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(Yg.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(pu.copy(e.center).add(Yg)),this.expandByPoint(pu.copy(e.center).sub(Yg))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const ps=new D,qg=new D,nf=new D,Js=new D,Kg=new D,rf=new D,Zg=new D;class sl{constructor(e=new D,t=new D(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,ps)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const i=t.dot(this.direction);return i<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,i)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=ps.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(ps.copy(this.origin).addScaledVector(this.direction,t),ps.distanceToSquared(e))}distanceSqToSegment(e,t,i,r){qg.copy(e).add(t).multiplyScalar(.5),nf.copy(t).sub(e).normalize(),Js.copy(this.origin).sub(qg);const s=e.distanceTo(t)*.5,o=-this.direction.dot(nf),a=Js.dot(this.direction),l=-Js.dot(nf),c=Js.lengthSq(),u=Math.abs(1-o*o);let h,d,f,p;if(u>0)if(h=o*l-a,d=o*a-l,p=s*u,h>=0)if(d>=-p)if(d<=p){const v=1/u;h*=v,d*=v,f=h*(h+o*d+2*a)+d*(o*h+d+2*l)+c}else d=s,h=Math.max(0,-(o*d+a)),f=-h*h+d*(d+2*l)+c;else d=-s,h=Math.max(0,-(o*d+a)),f=-h*h+d*(d+2*l)+c;else d<=-p?(h=Math.max(0,-(-o*s+a)),d=h>0?-s:Math.min(Math.max(-s,-l),s),f=-h*h+d*(d+2*l)+c):d<=p?(h=0,d=Math.min(Math.max(-s,-l),s),f=d*(d+2*l)+c):(h=Math.max(0,-(o*s+a)),d=h>0?s:Math.min(Math.max(-s,-l),s),f=-h*h+d*(d+2*l)+c);else d=o>0?-s:s,h=Math.max(0,-(o*d+a)),f=-h*h+d*(d+2*l)+c;return i&&i.copy(this.origin).addScaledVector(this.direction,h),r&&r.copy(qg).addScaledVector(nf,d),f}intersectSphere(e,t){ps.subVectors(e.center,this.origin);const i=ps.dot(this.direction),r=ps.dot(ps)-i*i,s=e.radius*e.radius;if(r>s)return null;const o=Math.sqrt(s-r),a=i-o,l=i+o;return l<0?null:a<0?this.at(l,t):this.at(a,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const i=-(this.origin.dot(e.normal)+e.constant)/t;return i>=0?i:null}intersectPlane(e,t){const i=this.distanceToPlane(e);return i===null?null:this.at(i,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let i,r,s,o,a,l;const c=1/this.direction.x,u=1/this.direction.y,h=1/this.direction.z,d=this.origin;return c>=0?(i=(e.min.x-d.x)*c,r=(e.max.x-d.x)*c):(i=(e.max.x-d.x)*c,r=(e.min.x-d.x)*c),u>=0?(s=(e.min.y-d.y)*u,o=(e.max.y-d.y)*u):(s=(e.max.y-d.y)*u,o=(e.min.y-d.y)*u),i>o||s>r||((s>i||isNaN(i))&&(i=s),(o<r||isNaN(r))&&(r=o),h>=0?(a=(e.min.z-d.z)*h,l=(e.max.z-d.z)*h):(a=(e.max.z-d.z)*h,l=(e.min.z-d.z)*h),i>l||a>r)||((a>i||i!==i)&&(i=a),(l<r||r!==r)&&(r=l),r<0)?null:this.at(i>=0?i:r,t)}intersectsBox(e){return this.intersectBox(e,ps)!==null}intersectTriangle(e,t,i,r,s){Kg.subVectors(t,e),rf.subVectors(i,e),Zg.crossVectors(Kg,rf);let o=this.direction.dot(Zg),a;if(o>0){if(r)return null;a=1}else if(o<0)a=-1,o=-o;else return null;Js.subVectors(this.origin,e);const l=a*this.direction.dot(rf.crossVectors(Js,rf));if(l<0)return null;const c=a*this.direction.dot(Kg.cross(Js));if(c<0||l+c>o)return null;const u=-a*Js.dot(Zg);return u<0?null:this.at(u/o,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class ze{constructor(e,t,i,r,s,o,a,l,c,u,h,d,f,p,v,m){ze.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,i,r,s,o,a,l,c,u,h,d,f,p,v,m)}set(e,t,i,r,s,o,a,l,c,u,h,d,f,p,v,m){const g=this.elements;return g[0]=e,g[4]=t,g[8]=i,g[12]=r,g[1]=s,g[5]=o,g[9]=a,g[13]=l,g[2]=c,g[6]=u,g[10]=h,g[14]=d,g[3]=f,g[7]=p,g[11]=v,g[15]=m,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new ze().fromArray(this.elements)}copy(e){const t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],t[9]=i[9],t[10]=i[10],t[11]=i[11],t[12]=i[12],t[13]=i[13],t[14]=i[14],t[15]=i[15],this}copyPosition(e){const t=this.elements,i=e.elements;return t[12]=i[12],t[13]=i[13],t[14]=i[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,i){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this}makeBasis(e,t,i){return this.set(e.x,t.x,i.x,0,e.y,t.y,i.y,0,e.z,t.z,i.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,i=e.elements,r=1/xl.setFromMatrixColumn(e,0).length(),s=1/xl.setFromMatrixColumn(e,1).length(),o=1/xl.setFromMatrixColumn(e,2).length();return t[0]=i[0]*r,t[1]=i[1]*r,t[2]=i[2]*r,t[3]=0,t[4]=i[4]*s,t[5]=i[5]*s,t[6]=i[6]*s,t[7]=0,t[8]=i[8]*o,t[9]=i[9]*o,t[10]=i[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,i=e.x,r=e.y,s=e.z,o=Math.cos(i),a=Math.sin(i),l=Math.cos(r),c=Math.sin(r),u=Math.cos(s),h=Math.sin(s);if(e.order==="XYZ"){const d=o*u,f=o*h,p=a*u,v=a*h;t[0]=l*u,t[4]=-l*h,t[8]=c,t[1]=f+p*c,t[5]=d-v*c,t[9]=-a*l,t[2]=v-d*c,t[6]=p+f*c,t[10]=o*l}else if(e.order==="YXZ"){const d=l*u,f=l*h,p=c*u,v=c*h;t[0]=d+v*a,t[4]=p*a-f,t[8]=o*c,t[1]=o*h,t[5]=o*u,t[9]=-a,t[2]=f*a-p,t[6]=v+d*a,t[10]=o*l}else if(e.order==="ZXY"){const d=l*u,f=l*h,p=c*u,v=c*h;t[0]=d-v*a,t[4]=-o*h,t[8]=p+f*a,t[1]=f+p*a,t[5]=o*u,t[9]=v-d*a,t[2]=-o*c,t[6]=a,t[10]=o*l}else if(e.order==="ZYX"){const d=o*u,f=o*h,p=a*u,v=a*h;t[0]=l*u,t[4]=p*c-f,t[8]=d*c+v,t[1]=l*h,t[5]=v*c+d,t[9]=f*c-p,t[2]=-c,t[6]=a*l,t[10]=o*l}else if(e.order==="YZX"){const d=o*l,f=o*c,p=a*l,v=a*c;t[0]=l*u,t[4]=v-d*h,t[8]=p*h+f,t[1]=h,t[5]=o*u,t[9]=-a*u,t[2]=-c*u,t[6]=f*h+p,t[10]=d-v*h}else if(e.order==="XZY"){const d=o*l,f=o*c,p=a*l,v=a*c;t[0]=l*u,t[4]=-h,t[8]=c*u,t[1]=d*h+v,t[5]=o*u,t[9]=f*h-p,t[2]=p*h-f,t[6]=a*u,t[10]=v*h+d}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(z7,e,V7)}lookAt(e,t,i){const r=this.elements;return Ii.subVectors(e,t),Ii.lengthSq()===0&&(Ii.z=1),Ii.normalize(),Qs.crossVectors(i,Ii),Qs.lengthSq()===0&&(Math.abs(i.z)===1?Ii.x+=1e-4:Ii.z+=1e-4,Ii.normalize(),Qs.crossVectors(i,Ii)),Qs.normalize(),sf.crossVectors(Ii,Qs),r[0]=Qs.x,r[4]=sf.x,r[8]=Ii.x,r[1]=Qs.y,r[5]=sf.y,r[9]=Ii.y,r[2]=Qs.z,r[6]=sf.z,r[10]=Ii.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const i=e.elements,r=t.elements,s=this.elements,o=i[0],a=i[4],l=i[8],c=i[12],u=i[1],h=i[5],d=i[9],f=i[13],p=i[2],v=i[6],m=i[10],g=i[14],b=i[3],_=i[7],y=i[11],T=i[15],S=r[0],E=r[4],x=r[8],M=r[12],w=r[1],C=r[5],L=r[9],$=r[13],U=r[2],H=r[6],V=r[10],j=r[14],te=r[3],Z=r[7],Q=r[11],X=r[15];return s[0]=o*S+a*w+l*U+c*te,s[4]=o*E+a*C+l*H+c*Z,s[8]=o*x+a*L+l*V+c*Q,s[12]=o*M+a*$+l*j+c*X,s[1]=u*S+h*w+d*U+f*te,s[5]=u*E+h*C+d*H+f*Z,s[9]=u*x+h*L+d*V+f*Q,s[13]=u*M+h*$+d*j+f*X,s[2]=p*S+v*w+m*U+g*te,s[6]=p*E+v*C+m*H+g*Z,s[10]=p*x+v*L+m*V+g*Q,s[14]=p*M+v*$+m*j+g*X,s[3]=b*S+_*w+y*U+T*te,s[7]=b*E+_*C+y*H+T*Z,s[11]=b*x+_*L+y*V+T*Q,s[15]=b*M+_*$+y*j+T*X,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],i=e[4],r=e[8],s=e[12],o=e[1],a=e[5],l=e[9],c=e[13],u=e[2],h=e[6],d=e[10],f=e[14],p=e[3],v=e[7],m=e[11],g=e[15];return p*(+s*l*h-r*c*h-s*a*d+i*c*d+r*a*f-i*l*f)+v*(+t*l*f-t*c*d+s*o*d-r*o*f+r*c*u-s*l*u)+m*(+t*c*h-t*a*f-s*o*h+i*o*f+s*a*u-i*c*u)+g*(-r*a*u-t*l*h+t*a*d+r*o*h-i*o*d+i*l*u)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,i){const r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=i),this}invert(){const e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8],h=e[9],d=e[10],f=e[11],p=e[12],v=e[13],m=e[14],g=e[15],b=h*m*c-v*d*c+v*l*f-a*m*f-h*l*g+a*d*g,_=p*d*c-u*m*c-p*l*f+o*m*f+u*l*g-o*d*g,y=u*v*c-p*h*c+p*a*f-o*v*f-u*a*g+o*h*g,T=p*h*l-u*v*l-p*a*d+o*v*d+u*a*m-o*h*m,S=t*b+i*_+r*y+s*T;if(S===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const E=1/S;return e[0]=b*E,e[1]=(v*d*s-h*m*s-v*r*f+i*m*f+h*r*g-i*d*g)*E,e[2]=(a*m*s-v*l*s+v*r*c-i*m*c-a*r*g+i*l*g)*E,e[3]=(h*l*s-a*d*s-h*r*c+i*d*c+a*r*f-i*l*f)*E,e[4]=_*E,e[5]=(u*m*s-p*d*s+p*r*f-t*m*f-u*r*g+t*d*g)*E,e[6]=(p*l*s-o*m*s-p*r*c+t*m*c+o*r*g-t*l*g)*E,e[7]=(o*d*s-u*l*s+u*r*c-t*d*c-o*r*f+t*l*f)*E,e[8]=y*E,e[9]=(p*h*s-u*v*s-p*i*f+t*v*f+u*i*g-t*h*g)*E,e[10]=(o*v*s-p*a*s+p*i*c-t*v*c-o*i*g+t*a*g)*E,e[11]=(u*a*s-o*h*s-u*i*c+t*h*c+o*i*f-t*a*f)*E,e[12]=T*E,e[13]=(u*v*r-p*h*r+p*i*d-t*v*d-u*i*m+t*h*m)*E,e[14]=(p*a*r-o*v*r-p*i*l+t*v*l+o*i*m-t*a*m)*E,e[15]=(o*h*r-u*a*r+u*i*l-t*h*l-o*i*d+t*a*d)*E,this}scale(e){const t=this.elements,i=e.x,r=e.y,s=e.z;return t[0]*=i,t[4]*=r,t[8]*=s,t[1]*=i,t[5]*=r,t[9]*=s,t[2]*=i,t[6]*=r,t[10]*=s,t[3]*=i,t[7]*=r,t[11]*=s,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],i=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,i,r))}makeTranslation(e,t,i){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,i,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),i=Math.sin(e);return this.set(1,0,0,0,0,t,-i,0,0,i,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,0,i,0,0,1,0,0,-i,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,0,i,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const i=Math.cos(t),r=Math.sin(t),s=1-i,o=e.x,a=e.y,l=e.z,c=s*o,u=s*a;return this.set(c*o+i,c*a-r*l,c*l+r*a,0,c*a+r*l,u*a+i,u*l-r*o,0,c*l-r*a,u*l+r*o,s*l*l+i,0,0,0,0,1),this}makeScale(e,t,i){return this.set(e,0,0,0,0,t,0,0,0,0,i,0,0,0,0,1),this}makeShear(e,t,i,r,s,o){return this.set(1,i,s,0,e,1,o,0,t,r,1,0,0,0,0,1),this}compose(e,t,i){const r=this.elements,s=t._x,o=t._y,a=t._z,l=t._w,c=s+s,u=o+o,h=a+a,d=s*c,f=s*u,p=s*h,v=o*u,m=o*h,g=a*h,b=l*c,_=l*u,y=l*h,T=i.x,S=i.y,E=i.z;return r[0]=(1-(v+g))*T,r[1]=(f+y)*T,r[2]=(p-_)*T,r[3]=0,r[4]=(f-y)*S,r[5]=(1-(d+g))*S,r[6]=(m+b)*S,r[7]=0,r[8]=(p+_)*E,r[9]=(m-b)*E,r[10]=(1-(d+v))*E,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,i){const r=this.elements;let s=xl.set(r[0],r[1],r[2]).length();const o=xl.set(r[4],r[5],r[6]).length(),a=xl.set(r[8],r[9],r[10]).length();this.determinant()<0&&(s=-s),e.x=r[12],e.y=r[13],e.z=r[14],pr.copy(this);const c=1/s,u=1/o,h=1/a;return pr.elements[0]*=c,pr.elements[1]*=c,pr.elements[2]*=c,pr.elements[4]*=u,pr.elements[5]*=u,pr.elements[6]*=u,pr.elements[8]*=h,pr.elements[9]*=h,pr.elements[10]*=h,t.setFromRotationMatrix(pr),i.x=s,i.y=o,i.z=a,this}makePerspective(e,t,i,r,s,o,a=Xr){const l=this.elements,c=2*s/(t-e),u=2*s/(i-r),h=(t+e)/(t-e),d=(i+r)/(i-r);let f,p;if(a===Xr)f=-(o+s)/(o-s),p=-2*o*s/(o-s);else if(a===Bh)f=-o/(o-s),p=-o*s/(o-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);return l[0]=c,l[4]=0,l[8]=h,l[12]=0,l[1]=0,l[5]=u,l[9]=d,l[13]=0,l[2]=0,l[6]=0,l[10]=f,l[14]=p,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,t,i,r,s,o,a=Xr){const l=this.elements,c=1/(t-e),u=1/(i-r),h=1/(o-s),d=(t+e)*c,f=(i+r)*u;let p,v;if(a===Xr)p=(o+s)*h,v=-2*h;else if(a===Bh)p=s*h,v=-1*h;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);return l[0]=2*c,l[4]=0,l[8]=0,l[12]=-d,l[1]=0,l[5]=2*u,l[9]=0,l[13]=-f,l[2]=0,l[6]=0,l[10]=v,l[14]=-p,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(e){const t=this.elements,i=e.elements;for(let r=0;r<16;r++)if(t[r]!==i[r])return!1;return!0}fromArray(e,t=0){for(let i=0;i<16;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){const i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e[t+9]=i[9],e[t+10]=i[10],e[t+11]=i[11],e[t+12]=i[12],e[t+13]=i[13],e[t+14]=i[14],e[t+15]=i[15],e}}const xl=new D,pr=new ze,z7=new D(0,0,0),V7=new D(1,1,1),Qs=new D,sf=new D,Ii=new D,US=new ze,NS=new gt;class rr{constructor(e=0,t=0,i=0,r=rr.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=i,this._order=r}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,i,r=this._order){return this._x=e,this._y=t,this._z=i,this._order=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,i=!0){const r=e.elements,s=r[0],o=r[4],a=r[8],l=r[1],c=r[5],u=r[9],h=r[2],d=r[6],f=r[10];switch(t){case"XYZ":this._y=Math.asin(dn(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-u,f),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(d,c),this._z=0);break;case"YXZ":this._x=Math.asin(-dn(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(a,f),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-h,s),this._z=0);break;case"ZXY":this._x=Math.asin(dn(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-h,f),this._z=Math.atan2(-o,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-dn(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(d,f),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-o,c));break;case"YZX":this._z=Math.asin(dn(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-u,c),this._y=Math.atan2(-h,s)):(this._x=0,this._y=Math.atan2(a,f));break;case"XZY":this._z=Math.asin(-dn(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(d,c),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-u,f),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,i===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,i){return US.makeRotationFromQuaternion(e),this.setFromRotationMatrix(US,t,i)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return NS.setFromEuler(this),this.setFromQuaternion(NS,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}rr.DEFAULT_ORDER="XYZ";class Nm{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}}let H7=0;const FS=new D,wl=new gt,ms=new ze,of=new D,mu=new D,G7=new D,W7=new gt,kS=new D(1,0,0),BS=new D(0,1,0),zS=new D(0,0,1),$7={type:"added"},j7={type:"removed"};class pt extends Nr{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:H7++}),this.uuid=Hi(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=pt.DEFAULT_UP.clone();const e=new D,t=new rr,i=new gt,r=new D(1,1,1);function s(){i.setFromEuler(t,!1)}function o(){t.setFromQuaternion(i,void 0,!1)}t._onChange(s),i._onChange(o),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:i},scale:{configurable:!0,enumerable:!0,value:r},modelViewMatrix:{value:new ze},normalMatrix:{value:new ut}}),this.matrix=new ze,this.matrixWorld=new ze,this.matrixAutoUpdate=pt.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.matrixWorldAutoUpdate=pt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.layers=new Nm,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return wl.setFromAxisAngle(e,t),this.quaternion.multiply(wl),this}rotateOnWorldAxis(e,t){return wl.setFromAxisAngle(e,t),this.quaternion.premultiply(wl),this}rotateX(e){return this.rotateOnAxis(kS,e)}rotateY(e){return this.rotateOnAxis(BS,e)}rotateZ(e){return this.rotateOnAxis(zS,e)}translateOnAxis(e,t){return FS.copy(e).applyQuaternion(this.quaternion),this.position.add(FS.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(kS,e)}translateY(e){return this.translateOnAxis(BS,e)}translateZ(e){return this.translateOnAxis(zS,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(ms.copy(this.matrixWorld).invert())}lookAt(e,t,i){e.isVector3?of.copy(e):of.set(e,t,i);const r=this.parent;this.updateWorldMatrix(!0,!1),mu.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?ms.lookAt(mu,of,this.up):ms.lookAt(of,mu,this.up),this.quaternion.setFromRotationMatrix(ms),r&&(ms.extractRotation(r.matrixWorld),wl.setFromRotationMatrix(ms),this.quaternion.premultiply(wl.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.parent!==null&&e.parent.remove(e),e.parent=this,this.children.push(e),e.dispatchEvent($7)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let i=0;i<arguments.length;i++)this.remove(arguments[i]);return this}const t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(j7)),this}removeFromParent(){const e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),ms.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),ms.multiply(e.parent.matrixWorld)),e.applyMatrix4(ms),this.add(e),e.updateWorldMatrix(!1,!0),this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let i=0,r=this.children.length;i<r;i++){const o=this.children[i].getObjectByProperty(e,t);if(o!==void 0)return o}}getObjectsByProperty(e,t){let i=[];this[e]===t&&i.push(this);for(let r=0,s=this.children.length;r<s;r++){const o=this.children[r].getObjectsByProperty(e,t);o.length>0&&(i=i.concat(o))}return i}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(mu,e,G7),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(mu,W7,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);const t=this.children;for(let i=0,r=t.length;i<r;i++)t[i].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const t=this.children;for(let i=0,r=t.length;i<r;i++)t[i].traverseVisible(e)}traverseAncestors(e){const t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,e=!0);const t=this.children;for(let i=0,r=t.length;i<r;i++){const s=t[i];(s.matrixWorldAutoUpdate===!0||e===!0)&&s.updateMatrixWorld(e)}}updateWorldMatrix(e,t){const i=this.parent;if(e===!0&&i!==null&&i.matrixWorldAutoUpdate===!0&&i.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),t===!0){const r=this.children;for(let s=0,o=r.length;s<o;s++){const a=r[s];a.matrixWorldAutoUpdate===!0&&a.updateWorldMatrix(!1,!0)}}}toJSON(e){const t=e===void 0||typeof e=="string",i={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},i.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});const r={};r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.castShadow===!0&&(r.castShadow=!0),this.receiveShadow===!0&&(r.receiveShadow=!0),this.visible===!1&&(r.visible=!1),this.frustumCulled===!1&&(r.frustumCulled=!1),this.renderOrder!==0&&(r.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON()));function s(a,l){return a[l.uuid]===void 0&&(a[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=s(e.geometries,this.geometry);const a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){const l=a.shapes;if(Array.isArray(l))for(let c=0,u=l.length;c<u;c++){const h=l[c];s(e.shapes,h)}else s(e.shapes,l)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(e.skeletons,this.skeleton),r.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const a=[];for(let l=0,c=this.material.length;l<c;l++)a.push(s(e.materials,this.material[l]));r.material=a}else r.material=s(e.materials,this.material);if(this.children.length>0){r.children=[];for(let a=0;a<this.children.length;a++)r.children.push(this.children[a].toJSON(e).object)}if(this.animations.length>0){r.animations=[];for(let a=0;a<this.animations.length;a++){const l=this.animations[a];r.animations.push(s(e.animations,l))}}if(t){const a=o(e.geometries),l=o(e.materials),c=o(e.textures),u=o(e.images),h=o(e.shapes),d=o(e.skeletons),f=o(e.animations),p=o(e.nodes);a.length>0&&(i.geometries=a),l.length>0&&(i.materials=l),c.length>0&&(i.textures=c),u.length>0&&(i.images=u),h.length>0&&(i.shapes=h),d.length>0&&(i.skeletons=d),f.length>0&&(i.animations=f),p.length>0&&(i.nodes=p)}return i.object=r,i;function o(a){const l=[];for(const c in a){const u=a[c];delete u.metadata,l.push(u)}return l}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let i=0;i<e.children.length;i++){const r=e.children[i];this.add(r.clone())}return this}}pt.DEFAULT_UP=new D(0,1,0);pt.DEFAULT_MATRIX_AUTO_UPDATE=!0;pt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const mr=new D,gs=new D,Jg=new D,vs=new D,Sl=new D,Ml=new D,VS=new D,Qg=new D,ev=new D,tv=new D;let af=!1;class yi{constructor(e=new D,t=new D,i=new D){this.a=e,this.b=t,this.c=i}static getNormal(e,t,i,r){r.subVectors(i,t),mr.subVectors(e,t),r.cross(mr);const s=r.lengthSq();return s>0?r.multiplyScalar(1/Math.sqrt(s)):r.set(0,0,0)}static getBarycoord(e,t,i,r,s){mr.subVectors(r,t),gs.subVectors(i,t),Jg.subVectors(e,t);const o=mr.dot(mr),a=mr.dot(gs),l=mr.dot(Jg),c=gs.dot(gs),u=gs.dot(Jg),h=o*c-a*a;if(h===0)return s.set(-2,-1,-1);const d=1/h,f=(c*l-a*u)*d,p=(o*u-a*l)*d;return s.set(1-f-p,p,f)}static containsPoint(e,t,i,r){return this.getBarycoord(e,t,i,r,vs),vs.x>=0&&vs.y>=0&&vs.x+vs.y<=1}static getUV(e,t,i,r,s,o,a,l){return af===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),af=!0),this.getInterpolation(e,t,i,r,s,o,a,l)}static getInterpolation(e,t,i,r,s,o,a,l){return this.getBarycoord(e,t,i,r,vs),l.setScalar(0),l.addScaledVector(s,vs.x),l.addScaledVector(o,vs.y),l.addScaledVector(a,vs.z),l}static isFrontFacing(e,t,i,r){return mr.subVectors(i,t),gs.subVectors(e,t),mr.cross(gs).dot(r)<0}set(e,t,i){return this.a.copy(e),this.b.copy(t),this.c.copy(i),this}setFromPointsAndIndices(e,t,i,r){return this.a.copy(e[t]),this.b.copy(e[i]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,i,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,i),this.c.fromBufferAttribute(e,r),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return mr.subVectors(this.c,this.b),gs.subVectors(this.a,this.b),mr.cross(gs).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return yi.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return yi.getBarycoord(e,this.a,this.b,this.c,t)}getUV(e,t,i,r,s){return af===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),af=!0),yi.getInterpolation(e,this.a,this.b,this.c,t,i,r,s)}getInterpolation(e,t,i,r,s){return yi.getInterpolation(e,this.a,this.b,this.c,t,i,r,s)}containsPoint(e){return yi.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return yi.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const i=this.a,r=this.b,s=this.c;let o,a;Sl.subVectors(r,i),Ml.subVectors(s,i),Qg.subVectors(e,i);const l=Sl.dot(Qg),c=Ml.dot(Qg);if(l<=0&&c<=0)return t.copy(i);ev.subVectors(e,r);const u=Sl.dot(ev),h=Ml.dot(ev);if(u>=0&&h<=u)return t.copy(r);const d=l*h-u*c;if(d<=0&&l>=0&&u<=0)return o=l/(l-u),t.copy(i).addScaledVector(Sl,o);tv.subVectors(e,s);const f=Sl.dot(tv),p=Ml.dot(tv);if(p>=0&&f<=p)return t.copy(s);const v=f*c-l*p;if(v<=0&&c>=0&&p<=0)return a=c/(c-p),t.copy(i).addScaledVector(Ml,a);const m=u*p-f*h;if(m<=0&&h-u>=0&&f-p>=0)return VS.subVectors(s,r),a=(h-u)/(h-u+(f-p)),t.copy(r).addScaledVector(VS,a);const g=1/(m+v+d);return o=v*g,a=d*g,t.copy(i).addScaledVector(Sl,o).addScaledVector(Ml,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const kP={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},eo={h:0,s:0,l:0},lf={h:0,s:0,l:0};function nv(n,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?n+(e-n)*6*t:t<1/2?e:t<2/3?n+(e-n)*6*(2/3-t):n}class Pe{constructor(e,t,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,i)}set(e,t,i){if(t===void 0&&i===void 0){const r=e;r&&r.isColor?this.copy(r):typeof r=="number"?this.setHex(r):typeof r=="string"&&this.setStyle(r)}else this.setRGB(e,t,i);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Mn){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Ut.toWorkingColorSpace(this,t),this}setRGB(e,t,i,r=Ut.workingColorSpace){return this.r=e,this.g=t,this.b=i,Ut.toWorkingColorSpace(this,r),this}setHSL(e,t,i,r=Ut.workingColorSpace){if(e=lb(e,1),t=dn(t,0,1),i=dn(i,0,1),t===0)this.r=this.g=this.b=i;else{const s=i<=.5?i*(1+t):i+t-i*t,o=2*i-s;this.r=nv(o,s,e+1/3),this.g=nv(o,s,e),this.b=nv(o,s,e-1/3)}return Ut.toWorkingColorSpace(this,r),this}setStyle(e,t=Mn){function i(s){s!==void 0&&parseFloat(s)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const o=r[1],a=r[2];switch(o){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,t);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,t);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=r[1],o=s.length;if(o===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(o===6)return this.setHex(parseInt(s,16),t);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Mn){const i=kP[e.toLowerCase()];return i!==void 0?this.setHex(i,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=dc(e.r),this.g=dc(e.g),this.b=dc(e.b),this}copyLinearToSRGB(e){return this.r=Wg(e.r),this.g=Wg(e.g),this.b=Wg(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Mn){return Ut.fromWorkingColorSpace(qn.copy(this),e),Math.round(dn(qn.r*255,0,255))*65536+Math.round(dn(qn.g*255,0,255))*256+Math.round(dn(qn.b*255,0,255))}getHexString(e=Mn){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Ut.workingColorSpace){Ut.fromWorkingColorSpace(qn.copy(this),t);const i=qn.r,r=qn.g,s=qn.b,o=Math.max(i,r,s),a=Math.min(i,r,s);let l,c;const u=(a+o)/2;if(a===o)l=0,c=0;else{const h=o-a;switch(c=u<=.5?h/(o+a):h/(2-o-a),o){case i:l=(r-s)/h+(r<s?6:0);break;case r:l=(s-i)/h+2;break;case s:l=(i-r)/h+4;break}l/=6}return e.h=l,e.s=c,e.l=u,e}getRGB(e,t=Ut.workingColorSpace){return Ut.fromWorkingColorSpace(qn.copy(this),t),e.r=qn.r,e.g=qn.g,e.b=qn.b,e}getStyle(e=Mn){Ut.fromWorkingColorSpace(qn.copy(this),e);const t=qn.r,i=qn.g,r=qn.b;return e!==Mn?"color(".concat(e," ").concat(t.toFixed(3)," ").concat(i.toFixed(3)," ").concat(r.toFixed(3),")"):"rgb(".concat(Math.round(t*255),",").concat(Math.round(i*255),",").concat(Math.round(r*255),")")}offsetHSL(e,t,i){return this.getHSL(eo),this.setHSL(eo.h+e,eo.s+t,eo.l+i)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,i){return this.r=e.r+(t.r-e.r)*i,this.g=e.g+(t.g-e.g)*i,this.b=e.b+(t.b-e.b)*i,this}lerpHSL(e,t){this.getHSL(eo),e.getHSL(lf);const i=eh(eo.h,lf.h,t),r=eh(eo.s,lf.s,t),s=eh(eo.l,lf.l,t);return this.setHSL(i,r,s),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const t=this.r,i=this.g,r=this.b,s=e.elements;return this.r=s[0]*t+s[3]*i+s[6]*r,this.g=s[1]*t+s[4]*i+s[7]*r,this.b=s[2]*t+s[5]*i+s[8]*r,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const qn=new Pe;Pe.NAMES=kP;let X7=0;class En extends Nr{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:X7++}),this.uuid=Hi(),this.name="",this.type="Material",this.blending=Ra,this.side=ns,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=zp,this.blendDst=Vp,this.blendEquation=yo,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Pe(0,0,0),this.blendAlpha=0,this.depthFunc=Lh,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=h_,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=pa,this.stencilZFail=pa,this.stencilZPass=pa,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const i=e[t];if(i===void 0){console.warn("THREE.Material: parameter '".concat(t,"' has value of undefined."));continue}const r=this[t];if(r===void 0){console.warn("THREE.Material: '".concat(t,"' is not a property of THREE.").concat(this.type,"."));continue}r&&r.isColor?r.set(i):r&&r.isVector3&&i&&i.isVector3?r.copy(i):this[t]=i}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const i={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),this.roughness!==void 0&&(i.roughness=this.roughness),this.metalness!==void 0&&(i.metalness=this.metalness),this.sheen!==void 0&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),this.emissiveIntensity&&this.emissiveIntensity!==1&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(i.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(i.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(i.shininess=this.shininess),this.clearcoat!==void 0&&(i.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.iridescence!==void 0&&(i.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(i.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(i.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(i.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(i.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(i.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(i.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(i.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(e).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(e).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(e).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(e).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(e).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(i.combine=this.combine)),this.envMapIntensity!==void 0&&(i.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(i.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(i.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(i.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(i.size=this.size),this.shadowSide!==null&&(i.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(i.sizeAttenuation=this.sizeAttenuation),this.blending!==Ra&&(i.blending=this.blending),this.side!==ns&&(i.side=this.side),this.vertexColors===!0&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),this.transparent===!0&&(i.transparent=!0),this.blendSrc!==zp&&(i.blendSrc=this.blendSrc),this.blendDst!==Vp&&(i.blendDst=this.blendDst),this.blendEquation!==yo&&(i.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(i.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(i.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(i.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(i.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(i.blendAlpha=this.blendAlpha),this.depthFunc!==Lh&&(i.depthFunc=this.depthFunc),this.depthTest===!1&&(i.depthTest=this.depthTest),this.depthWrite===!1&&(i.depthWrite=this.depthWrite),this.colorWrite===!1&&(i.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(i.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==h_&&(i.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(i.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(i.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==pa&&(i.stencilFail=this.stencilFail),this.stencilZFail!==pa&&(i.stencilZFail=this.stencilZFail),this.stencilZPass!==pa&&(i.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(i.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(i.rotation=this.rotation),this.polygonOffset===!0&&(i.polygonOffset=!0),this.polygonOffsetFactor!==0&&(i.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(i.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(i.linewidth=this.linewidth),this.dashSize!==void 0&&(i.dashSize=this.dashSize),this.gapSize!==void 0&&(i.gapSize=this.gapSize),this.scale!==void 0&&(i.scale=this.scale),this.dithering===!0&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),this.alphaHash===!0&&(i.alphaHash=!0),this.alphaToCoverage===!0&&(i.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(i.premultipliedAlpha=!0),this.forceSinglePass===!0&&(i.forceSinglePass=!0),this.wireframe===!0&&(i.wireframe=!0),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(i.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(i.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(i.flatShading=!0),this.visible===!1&&(i.visible=!1),this.toneMapped===!1&&(i.toneMapped=!1),this.fog===!1&&(i.fog=!1),Object.keys(this.userData).length>0&&(i.userData=this.userData);function r(s){const o=[];for(const a in s){const l=s[a];delete l.metadata,o.push(l)}return o}if(t){const s=r(e.textures),o=r(e.images);s.length>0&&(i.textures=s),o.length>0&&(i.images=o)}return i}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let i=null;if(t!==null){const r=t.length;i=new Array(r);for(let s=0;s!==r;++s)i[s]=t[s].clone()}return this.clippingPlanes=i,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}}class Jn extends En{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Pe(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=hd,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const Es=Y7();function Y7(){const n=new ArrayBuffer(4),e=new Float32Array(n),t=new Uint32Array(n),i=new Uint32Array(512),r=new Uint32Array(512);for(let l=0;l<256;++l){const c=l-127;c<-27?(i[l]=0,i[l|256]=32768,r[l]=24,r[l|256]=24):c<-14?(i[l]=1024>>-c-14,i[l|256]=1024>>-c-14|32768,r[l]=-c-1,r[l|256]=-c-1):c<=15?(i[l]=c+15<<10,i[l|256]=c+15<<10|32768,r[l]=13,r[l|256]=13):c<128?(i[l]=31744,i[l|256]=64512,r[l]=24,r[l|256]=24):(i[l]=31744,i[l|256]=64512,r[l]=13,r[l|256]=13)}const s=new Uint32Array(2048),o=new Uint32Array(64),a=new Uint32Array(64);for(let l=1;l<1024;++l){let c=l<<13,u=0;for(;!(c&8388608);)c<<=1,u-=8388608;c&=-8388609,u+=947912704,s[l]=c|u}for(let l=1024;l<2048;++l)s[l]=939524096+(l-1024<<13);for(let l=1;l<31;++l)o[l]=l<<23;o[31]=1199570944,o[32]=2147483648;for(let l=33;l<63;++l)o[l]=2147483648+(l-32<<23);o[63]=3347054592;for(let l=1;l<64;++l)l!==32&&(a[l]=1024);return{floatView:e,uint32View:t,baseTable:i,shiftTable:r,mantissaTable:s,exponentTable:o,offsetTable:a}}function vi(n){Math.abs(n)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),n=dn(n,-65504,65504),Es.floatView[0]=n;const e=Es.uint32View[0],t=e>>23&511;return Es.baseTable[t]+((e&8388607)>>Es.shiftTable[t])}function Bu(n){const e=n>>10;return Es.uint32View[0]=Es.mantissaTable[Es.offsetTable[e]+(n&1023)]+Es.exponentTable[e],Es.floatView[0]}const q7={toHalfFloat:vi,fromHalfFloat:Bu},wn=new D,cf=new _e;class At{constructor(e,t,i=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=i,this.usage=kh,this.updateRange={offset:0,count:-1},this.gpuType=jr,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,i){e*=this.itemSize,i*=t.itemSize;for(let r=0,s=this.itemSize;r<s;r++)this.array[e+r]=t.array[i+r];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,i=this.count;t<i;t++)cf.fromBufferAttribute(this,t),cf.applyMatrix3(e),this.setXY(t,cf.x,cf.y);else if(this.itemSize===3)for(let t=0,i=this.count;t<i;t++)wn.fromBufferAttribute(this,t),wn.applyMatrix3(e),this.setXYZ(t,wn.x,wn.y,wn.z);return this}applyMatrix4(e){for(let t=0,i=this.count;t<i;t++)wn.fromBufferAttribute(this,t),wn.applyMatrix4(e),this.setXYZ(t,wn.x,wn.y,wn.z);return this}applyNormalMatrix(e){for(let t=0,i=this.count;t<i;t++)wn.fromBufferAttribute(this,t),wn.applyNormalMatrix(e),this.setXYZ(t,wn.x,wn.y,wn.z);return this}transformDirection(e){for(let t=0,i=this.count;t<i;t++)wn.fromBufferAttribute(this,t),wn.transformDirection(e),this.setXYZ(t,wn.x,wn.y,wn.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let i=this.array[e*this.itemSize+t];return this.normalized&&(i=xi(i,this.array)),i}setComponent(e,t,i){return this.normalized&&(i=ht(i,this.array)),this.array[e*this.itemSize+t]=i,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=xi(t,this.array)),t}setX(e,t){return this.normalized&&(t=ht(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=xi(t,this.array)),t}setY(e,t){return this.normalized&&(t=ht(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=xi(t,this.array)),t}setZ(e,t){return this.normalized&&(t=ht(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=xi(t,this.array)),t}setW(e,t){return this.normalized&&(t=ht(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,i){return e*=this.itemSize,this.normalized&&(t=ht(t,this.array),i=ht(i,this.array)),this.array[e+0]=t,this.array[e+1]=i,this}setXYZ(e,t,i,r){return e*=this.itemSize,this.normalized&&(t=ht(t,this.array),i=ht(i,this.array),r=ht(r,this.array)),this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=r,this}setXYZW(e,t,i,r,s){return e*=this.itemSize,this.normalized&&(t=ht(t,this.array),i=ht(i,this.array),r=ht(r,this.array),s=ht(s,this.array)),this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=r,this.array[e+3]=s,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==kh&&(e.usage=this.usage),(this.updateRange.offset!==0||this.updateRange.count!==-1)&&(e.updateRange=this.updateRange),e}}class K7 extends At{constructor(e,t,i){super(new Int8Array(e),t,i)}}class Z7 extends At{constructor(e,t,i){super(new Uint8Array(e),t,i)}}class J7 extends At{constructor(e,t,i){super(new Uint8ClampedArray(e),t,i)}}class Q7 extends At{constructor(e,t,i){super(new Int16Array(e),t,i)}}class Fm extends At{constructor(e,t,i){super(new Uint16Array(e),t,i)}}class eW extends At{constructor(e,t,i){super(new Int32Array(e),t,i)}}class hb extends At{constructor(e,t,i){super(new Uint32Array(e),t,i)}}class tW extends At{constructor(e,t,i){super(new Uint16Array(e),t,i),this.isFloat16BufferAttribute=!0}getX(e){let t=Bu(this.array[e*this.itemSize]);return this.normalized&&(t=xi(t,this.array)),t}setX(e,t){return this.normalized&&(t=ht(t,this.array)),this.array[e*this.itemSize]=vi(t),this}getY(e){let t=Bu(this.array[e*this.itemSize+1]);return this.normalized&&(t=xi(t,this.array)),t}setY(e,t){return this.normalized&&(t=ht(t,this.array)),this.array[e*this.itemSize+1]=vi(t),this}getZ(e){let t=Bu(this.array[e*this.itemSize+2]);return this.normalized&&(t=xi(t,this.array)),t}setZ(e,t){return this.normalized&&(t=ht(t,this.array)),this.array[e*this.itemSize+2]=vi(t),this}getW(e){let t=Bu(this.array[e*this.itemSize+3]);return this.normalized&&(t=xi(t,this.array)),t}setW(e,t){return this.normalized&&(t=ht(t,this.array)),this.array[e*this.itemSize+3]=vi(t),this}setXY(e,t,i){return e*=this.itemSize,this.normalized&&(t=ht(t,this.array),i=ht(i,this.array)),this.array[e+0]=vi(t),this.array[e+1]=vi(i),this}setXYZ(e,t,i,r){return e*=this.itemSize,this.normalized&&(t=ht(t,this.array),i=ht(i,this.array),r=ht(r,this.array)),this.array[e+0]=vi(t),this.array[e+1]=vi(i),this.array[e+2]=vi(r),this}setXYZW(e,t,i,r,s){return e*=this.itemSize,this.normalized&&(t=ht(t,this.array),i=ht(i,this.array),r=ht(r,this.array),s=ht(s,this.array)),this.array[e+0]=vi(t),this.array[e+1]=vi(i),this.array[e+2]=vi(r),this.array[e+3]=vi(s),this}}class Ve extends At{constructor(e,t,i){super(new Float32Array(e),t,i)}}class nW extends At{constructor(e,t,i){super(new Float64Array(e),t,i)}}let iW=0;const Yi=new ze,iv=new pt,El=new D,Di=new Pi,gu=new Pi,Nn=new D;class qe extends Nr{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:iW++}),this.uuid=Hi(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(UP(e)?hb:Fm)(e,1):this.index=e,this}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,i=0){this.groups.push({start:e,count:t,materialIndex:i})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);const i=this.attributes.normal;if(i!==void 0){const s=new ut().getNormalMatrix(e);i.applyNormalMatrix(s),i.needsUpdate=!0}const r=this.attributes.tangent;return r!==void 0&&(r.transformDirection(e),r.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return Yi.makeRotationFromQuaternion(e),this.applyMatrix4(Yi),this}rotateX(e){return Yi.makeRotationX(e),this.applyMatrix4(Yi),this}rotateY(e){return Yi.makeRotationY(e),this.applyMatrix4(Yi),this}rotateZ(e){return Yi.makeRotationZ(e),this.applyMatrix4(Yi),this}translate(e,t,i){return Yi.makeTranslation(e,t,i),this.applyMatrix4(Yi),this}scale(e,t,i){return Yi.makeScale(e,t,i),this.applyMatrix4(Yi),this}lookAt(e){return iv.lookAt(e),iv.updateMatrix(),this.applyMatrix4(iv.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(El).negate(),this.translate(El.x,El.y,El.z),this}setFromPoints(e){const t=[];for(let i=0,r=e.length;i<r;i++){const s=e[i];t.push(s.x,s.y,s.z||0)}return this.setAttribute("position",new Ve(t,3)),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Pi);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error('THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box. Alternatively set "mesh.frustumCulled" to "false".',this),this.boundingBox.set(new D(-1/0,-1/0,-1/0),new D(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let i=0,r=t.length;i<r;i++){const s=t[i];Di.setFromBufferAttribute(s),this.morphTargetsRelative?(Nn.addVectors(this.boundingBox.min,Di.min),this.boundingBox.expandByPoint(Nn),Nn.addVectors(this.boundingBox.max,Di.max),this.boundingBox.expandByPoint(Nn)):(this.boundingBox.expandByPoint(Di.min),this.boundingBox.expandByPoint(Di.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Ri);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error('THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere. Alternatively set "mesh.frustumCulled" to "false".',this),this.boundingSphere.set(new D,1/0);return}if(e){const i=this.boundingSphere.center;if(Di.setFromBufferAttribute(e),t)for(let s=0,o=t.length;s<o;s++){const a=t[s];gu.setFromBufferAttribute(a),this.morphTargetsRelative?(Nn.addVectors(Di.min,gu.min),Di.expandByPoint(Nn),Nn.addVectors(Di.max,gu.max),Di.expandByPoint(Nn)):(Di.expandByPoint(gu.min),Di.expandByPoint(gu.max))}Di.getCenter(i);let r=0;for(let s=0,o=e.count;s<o;s++)Nn.fromBufferAttribute(e,s),r=Math.max(r,i.distanceToSquared(Nn));if(t)for(let s=0,o=t.length;s<o;s++){const a=t[s],l=this.morphTargetsRelative;for(let c=0,u=a.count;c<u;c++)Nn.fromBufferAttribute(a,c),l&&(El.fromBufferAttribute(e,c),Nn.add(El)),r=Math.max(r,i.distanceToSquared(Nn))}this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const i=e.array,r=t.position.array,s=t.normal.array,o=t.uv.array,a=r.length/3;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new At(new Float32Array(4*a),4));const l=this.getAttribute("tangent").array,c=[],u=[];for(let w=0;w<a;w++)c[w]=new D,u[w]=new D;const h=new D,d=new D,f=new D,p=new _e,v=new _e,m=new _e,g=new D,b=new D;function _(w,C,L){h.fromArray(r,w*3),d.fromArray(r,C*3),f.fromArray(r,L*3),p.fromArray(o,w*2),v.fromArray(o,C*2),m.fromArray(o,L*2),d.sub(h),f.sub(h),v.sub(p),m.sub(p);const $=1/(v.x*m.y-m.x*v.y);isFinite($)&&(g.copy(d).multiplyScalar(m.y).addScaledVector(f,-v.y).multiplyScalar($),b.copy(f).multiplyScalar(v.x).addScaledVector(d,-m.x).multiplyScalar($),c[w].add(g),c[C].add(g),c[L].add(g),u[w].add(b),u[C].add(b),u[L].add(b))}let y=this.groups;y.length===0&&(y=[{start:0,count:i.length}]);for(let w=0,C=y.length;w<C;++w){const L=y[w],$=L.start,U=L.count;for(let H=$,V=$+U;H<V;H+=3)_(i[H+0],i[H+1],i[H+2])}const T=new D,S=new D,E=new D,x=new D;function M(w){E.fromArray(s,w*3),x.copy(E);const C=c[w];T.copy(C),T.sub(E.multiplyScalar(E.dot(C))).normalize(),S.crossVectors(x,C);const $=S.dot(u[w])<0?-1:1;l[w*4]=T.x,l[w*4+1]=T.y,l[w*4+2]=T.z,l[w*4+3]=$}for(let w=0,C=y.length;w<C;++w){const L=y[w],$=L.start,U=L.count;for(let H=$,V=$+U;H<V;H+=3)M(i[H+0]),M(i[H+1]),M(i[H+2])}}computeVertexNormals(){const e=this.index,t=this.getAttribute("position");if(t!==void 0){let i=this.getAttribute("normal");if(i===void 0)i=new At(new Float32Array(t.count*3),3),this.setAttribute("normal",i);else for(let d=0,f=i.count;d<f;d++)i.setXYZ(d,0,0,0);const r=new D,s=new D,o=new D,a=new D,l=new D,c=new D,u=new D,h=new D;if(e)for(let d=0,f=e.count;d<f;d+=3){const p=e.getX(d+0),v=e.getX(d+1),m=e.getX(d+2);r.fromBufferAttribute(t,p),s.fromBufferAttribute(t,v),o.fromBufferAttribute(t,m),u.subVectors(o,s),h.subVectors(r,s),u.cross(h),a.fromBufferAttribute(i,p),l.fromBufferAttribute(i,v),c.fromBufferAttribute(i,m),a.add(u),l.add(u),c.add(u),i.setXYZ(p,a.x,a.y,a.z),i.setXYZ(v,l.x,l.y,l.z),i.setXYZ(m,c.x,c.y,c.z)}else for(let d=0,f=t.count;d<f;d+=3)r.fromBufferAttribute(t,d+0),s.fromBufferAttribute(t,d+1),o.fromBufferAttribute(t,d+2),u.subVectors(o,s),h.subVectors(r,s),u.cross(h),i.setXYZ(d+0,u.x,u.y,u.z),i.setXYZ(d+1,u.x,u.y,u.z),i.setXYZ(d+2,u.x,u.y,u.z);this.normalizeNormals(),i.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let t=0,i=e.count;t<i;t++)Nn.fromBufferAttribute(e,t),Nn.normalize(),e.setXYZ(t,Nn.x,Nn.y,Nn.z)}toNonIndexed(){function e(a,l){const c=a.array,u=a.itemSize,h=a.normalized,d=new c.constructor(l.length*u);let f=0,p=0;for(let v=0,m=l.length;v<m;v++){a.isInterleavedBufferAttribute?f=l[v]*a.data.stride+a.offset:f=l[v]*u;for(let g=0;g<u;g++)d[p++]=c[f++]}return new At(d,u,h)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new qe,i=this.index.array,r=this.attributes;for(const a in r){const l=r[a],c=e(l,i);t.setAttribute(a,c)}const s=this.morphAttributes;for(const a in s){const l=[],c=s[a];for(let u=0,h=c.length;u<h;u++){const d=c[u],f=e(d,i);l.push(f)}t.morphAttributes[a]=l}t.morphTargetsRelative=this.morphTargetsRelative;const o=this.groups;for(let a=0,l=o.length;a<l;a++){const c=o[a];t.addGroup(c.start,c.count,c.materialIndex)}return t}toJSON(){const e={metadata:{version:4.6,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0){const l=this.parameters;for(const c in l)l[c]!==void 0&&(e[c]=l[c]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const i=this.attributes;for(const l in i){const c=i[l];e.data.attributes[l]=c.toJSON(e.data)}const r={};let s=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],u=[];for(let h=0,d=c.length;h<d;h++){const f=c[h];u.push(f.toJSON(e.data))}u.length>0&&(r[l]=u,s=!0)}s&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);const o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));const a=this.boundingSphere;return a!==null&&(e.data.boundingSphere={center:a.center.toArray(),radius:a.radius}),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const i=e.index;i!==null&&this.setIndex(i.clone(t));const r=e.attributes;for(const c in r){const u=r[c];this.setAttribute(c,u.clone(t))}const s=e.morphAttributes;for(const c in s){const u=[],h=s[c];for(let d=0,f=h.length;d<f;d++)u.push(h[d].clone(t));this.morphAttributes[c]=u}this.morphTargetsRelative=e.morphTargetsRelative;const o=e.groups;for(let c=0,u=o.length;c<u;c++){const h=o[c];this.addGroup(h.start,h.count,h.materialIndex)}const a=e.boundingBox;a!==null&&(this.boundingBox=a.clone());const l=e.boundingSphere;return l!==null&&(this.boundingSphere=l.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}const HS=new ze,ea=new sl,uf=new Ri,GS=new D,Tl=new D,Al=new D,Cl=new D,rv=new D,hf=new D,df=new _e,ff=new _e,pf=new _e,WS=new D,$S=new D,jS=new D,mf=new D,gf=new D;class Be extends pt{constructor(e=new qe,t=new Jn){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const t=this.geometry.morphAttributes,i=Object.keys(t);if(i.length>0){const r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;s<o;s++){const a=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}getVertexPosition(e,t){const i=this.geometry,r=i.attributes.position,s=i.morphAttributes.position,o=i.morphTargetsRelative;t.fromBufferAttribute(r,e);const a=this.morphTargetInfluences;if(s&&a){hf.set(0,0,0);for(let l=0,c=s.length;l<c;l++){const u=a[l],h=s[l];u!==0&&(rv.fromBufferAttribute(h,e),o?hf.addScaledVector(rv,u):hf.addScaledVector(rv.sub(t),u))}t.add(hf)}return t}raycast(e,t){const i=this.geometry,r=this.material,s=this.matrixWorld;r!==void 0&&(i.boundingSphere===null&&i.computeBoundingSphere(),uf.copy(i.boundingSphere),uf.applyMatrix4(s),ea.copy(e.ray).recast(e.near),!(uf.containsPoint(ea.origin)===!1&&(ea.intersectSphere(uf,GS)===null||ea.origin.distanceToSquared(GS)>(e.far-e.near)**2))&&(HS.copy(s).invert(),ea.copy(e.ray).applyMatrix4(HS),!(i.boundingBox!==null&&ea.intersectsBox(i.boundingBox)===!1)&&this._computeIntersections(e,t,ea)))}_computeIntersections(e,t,i){let r;const s=this.geometry,o=this.material,a=s.index,l=s.attributes.position,c=s.attributes.uv,u=s.attributes.uv1,h=s.attributes.normal,d=s.groups,f=s.drawRange;if(a!==null)if(Array.isArray(o))for(let p=0,v=d.length;p<v;p++){const m=d[p],g=o[m.materialIndex],b=Math.max(m.start,f.start),_=Math.min(a.count,Math.min(m.start+m.count,f.start+f.count));for(let y=b,T=_;y<T;y+=3){const S=a.getX(y),E=a.getX(y+1),x=a.getX(y+2);r=vf(this,g,e,i,c,u,h,S,E,x),r&&(r.faceIndex=Math.floor(y/3),r.face.materialIndex=m.materialIndex,t.push(r))}}else{const p=Math.max(0,f.start),v=Math.min(a.count,f.start+f.count);for(let m=p,g=v;m<g;m+=3){const b=a.getX(m),_=a.getX(m+1),y=a.getX(m+2);r=vf(this,o,e,i,c,u,h,b,_,y),r&&(r.faceIndex=Math.floor(m/3),t.push(r))}}else if(l!==void 0)if(Array.isArray(o))for(let p=0,v=d.length;p<v;p++){const m=d[p],g=o[m.materialIndex],b=Math.max(m.start,f.start),_=Math.min(l.count,Math.min(m.start+m.count,f.start+f.count));for(let y=b,T=_;y<T;y+=3){const S=y,E=y+1,x=y+2;r=vf(this,g,e,i,c,u,h,S,E,x),r&&(r.faceIndex=Math.floor(y/3),r.face.materialIndex=m.materialIndex,t.push(r))}}else{const p=Math.max(0,f.start),v=Math.min(l.count,f.start+f.count);for(let m=p,g=v;m<g;m+=3){const b=m,_=m+1,y=m+2;r=vf(this,o,e,i,c,u,h,b,_,y),r&&(r.faceIndex=Math.floor(m/3),t.push(r))}}}}function rW(n,e,t,i,r,s,o,a){let l;if(e.side===Qn?l=i.intersectTriangle(o,s,r,!0,a):l=i.intersectTriangle(r,s,o,e.side===ns,a),l===null)return null;gf.copy(a),gf.applyMatrix4(n.matrixWorld);const c=t.ray.origin.distanceTo(gf);return c<t.near||c>t.far?null:{distance:c,point:gf.clone(),object:n}}function vf(n,e,t,i,r,s,o,a,l,c){n.getVertexPosition(a,Tl),n.getVertexPosition(l,Al),n.getVertexPosition(c,Cl);const u=rW(n,e,t,i,Tl,Al,Cl,mf);if(u){r&&(df.fromBufferAttribute(r,a),ff.fromBufferAttribute(r,l),pf.fromBufferAttribute(r,c),u.uv=yi.getInterpolation(mf,Tl,Al,Cl,df,ff,pf,new _e)),s&&(df.fromBufferAttribute(s,a),ff.fromBufferAttribute(s,l),pf.fromBufferAttribute(s,c),u.uv1=yi.getInterpolation(mf,Tl,Al,Cl,df,ff,pf,new _e),u.uv2=u.uv1),o&&(WS.fromBufferAttribute(o,a),$S.fromBufferAttribute(o,l),jS.fromBufferAttribute(o,c),u.normal=yi.getInterpolation(mf,Tl,Al,Cl,WS,$S,jS,new D),u.normal.dot(i.direction)>0&&u.normal.multiplyScalar(-1));const h={a,b:l,c,normal:new D,materialIndex:0};yi.getNormal(Tl,Al,Cl,h.normal),u.face=h}return u}class ai extends qe{constructor(e=1,t=1,i=1,r=1,s=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:i,widthSegments:r,heightSegments:s,depthSegments:o};const a=this;r=Math.floor(r),s=Math.floor(s),o=Math.floor(o);const l=[],c=[],u=[],h=[];let d=0,f=0;p("z","y","x",-1,-1,i,t,e,o,s,0),p("z","y","x",1,-1,i,t,-e,o,s,1),p("x","z","y",1,1,e,i,t,r,o,2),p("x","z","y",1,-1,e,i,-t,r,o,3),p("x","y","z",1,-1,e,t,i,r,s,4),p("x","y","z",-1,-1,e,t,-i,r,s,5),this.setIndex(l),this.setAttribute("position",new Ve(c,3)),this.setAttribute("normal",new Ve(u,3)),this.setAttribute("uv",new Ve(h,2));function p(v,m,g,b,_,y,T,S,E,x,M){const w=y/E,C=T/x,L=y/2,$=T/2,U=S/2,H=E+1,V=x+1;let j=0,te=0;const Z=new D;for(let Q=0;Q<V;Q++){const X=Q*C-$;for(let re=0;re<H;re++){const W=re*w-L;Z[v]=W*b,Z[m]=X*_,Z[g]=U,c.push(Z.x,Z.y,Z.z),Z[v]=0,Z[m]=0,Z[g]=S>0?1:-1,u.push(Z.x,Z.y,Z.z),h.push(re/E),h.push(1-Q/x),j+=1}}for(let Q=0;Q<x;Q++)for(let X=0;X<E;X++){const re=d+X+H*Q,W=d+X+H*(Q+1),we=d+(X+1)+H*(Q+1),Re=d+(X+1)+H*Q;l.push(re,W,Re),l.push(W,we,Re),te+=6}a.addGroup(f,te,M),f+=te,d+=j}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new ai(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function Lc(n){const e={};for(const t in n){e[t]={};for(const i in n[t]){const r=n[t][i];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture||r.isQuaternion)?r.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][i]=null):e[t][i]=r.clone():Array.isArray(r)?e[t][i]=r.slice():e[t][i]=r}}return e}function oi(n){const e={};for(let t=0;t<n.length;t++){const i=Lc(n[t]);for(const r in i)e[r]=i[r]}return e}function sW(n){const e=[];for(let t=0;t<n.length;t++)e.push(n[t].clone());return e}function BP(n){return n.getRenderTarget()===null?n.outputColorSpace:Ut.workingColorSpace}const km={clone:Lc,merge:oi};var oW="void main() {\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",aW="void main() {\n gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}";class cr extends En{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=oW,this.fragmentShader=aW,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,e!==void 0&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=Lc(e.uniforms),this.uniformsGroups=sW(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this}toJSON(e){const t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(const r in this.uniforms){const o=this.uniforms[r].value;o&&o.isTexture?t.uniforms[r]={type:"t",value:o.toJSON(e).uuid}:o&&o.isColor?t.uniforms[r]={type:"c",value:o.getHex()}:o&&o.isVector2?t.uniforms[r]={type:"v2",value:o.toArray()}:o&&o.isVector3?t.uniforms[r]={type:"v3",value:o.toArray()}:o&&o.isVector4?t.uniforms[r]={type:"v4",value:o.toArray()}:o&&o.isMatrix3?t.uniforms[r]={type:"m3",value:o.toArray()}:o&&o.isMatrix4?t.uniforms[r]={type:"m4",value:o.toArray()}:t.uniforms[r]={value:o}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const i={};for(const r in this.extensions)this.extensions[r]===!0&&(i[r]=!0);return Object.keys(i).length>0&&(t.extensions=i),t}}class fd extends pt{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new ze,this.projectionMatrix=new ze,this.projectionMatrixInverse=new ze,this.coordinateSystem=Xr}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}class Nt extends fd{constructor(e=50,t=1,i=.1,r=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=i,this.far=r,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=Rc*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(La*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Rc*2*Math.atan(Math.tan(La*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}setViewOffset(e,t,i,r,s,o){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=r,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(La*.5*this.fov)/this.zoom,i=2*t,r=this.aspect*i,s=-.5*r;const o=this.view;if(this.view!==null&&this.view.enabled){const l=o.fullWidth,c=o.fullHeight;s+=o.offsetX*r/l,t-=o.offsetY*i/c,r*=o.width/l,i*=o.height/c}const a=this.filmOffset;a!==0&&(s+=e*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+r,t,t-i,e,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}const Pl=-90,Rl=1;class zP extends pt{constructor(e,t,i){super(),this.type="CubeCamera",this.renderTarget=i,this.coordinateSystem=null,this.activeMipmapLevel=0;const r=new Nt(Pl,Rl,e,t);r.layers=this.layers,this.add(r);const s=new Nt(Pl,Rl,e,t);s.layers=this.layers,this.add(s);const o=new Nt(Pl,Rl,e,t);o.layers=this.layers,this.add(o);const a=new Nt(Pl,Rl,e,t);a.layers=this.layers,this.add(a);const l=new Nt(Pl,Rl,e,t);l.layers=this.layers,this.add(l);const c=new Nt(Pl,Rl,e,t);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[i,r,s,o,a,l]=t;for(const c of t)this.remove(c);if(e===Xr)i.up.set(0,1,0),i.lookAt(1,0,0),r.up.set(0,1,0),r.lookAt(-1,0,0),s.up.set(0,0,-1),s.lookAt(0,1,0),o.up.set(0,0,1),o.lookAt(0,-1,0),a.up.set(0,1,0),a.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(e===Bh)i.up.set(0,-1,0),i.lookAt(-1,0,0),r.up.set(0,-1,0),r.lookAt(1,0,0),s.up.set(0,0,1),s.lookAt(0,1,0),o.up.set(0,0,-1),o.lookAt(0,-1,0),a.up.set(0,-1,0),a.lookAt(0,0,1),l.up.set(0,-1,0),l.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const c of t)this.add(c),c.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();const{renderTarget:i,activeMipmapLevel:r}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[s,o,a,l,c,u]=this.children,h=e.getRenderTarget(),d=e.getActiveCubeFace(),f=e.getActiveMipmapLevel(),p=e.xr.enabled;e.xr.enabled=!1;const v=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,e.setRenderTarget(i,0,r),e.render(t,s),e.setRenderTarget(i,1,r),e.render(t,o),e.setRenderTarget(i,2,r),e.render(t,a),e.setRenderTarget(i,3,r),e.render(t,l),e.setRenderTarget(i,4,r),e.render(t,c),i.texture.generateMipmaps=v,e.setRenderTarget(i,5,r),e.render(t,u),e.setRenderTarget(h,d,f),e.xr.enabled=p,i.texture.needsPMREMUpdate=!0}}class pd extends Jt{constructor(e,t,i,r,s,o,a,l,c,u){e=e!==void 0?e:[],t=t!==void 0?t:Ns,super(e,t,i,r,s,o,a,l,c,u),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class VP extends Lr{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const i={width:e,height:e,depth:1},r=[i,i,i,i,i,i];t.encoding!==void 0&&(th("THREE.WebGLCubeRenderTarget: option.encoding has been replaced by option.colorSpace."),t.colorSpace=t.encoding===Po?Mn:Bi),this.texture=new pd(r,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=t.generateMipmaps!==void 0?t.generateMipmaps:!1,this.texture.minFilter=t.minFilter!==void 0?t.minFilter:rn}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const i={uniforms:{tEquirect:{value:null}},vertexShader:"\n\n varying vec3 vWorldDirection;\n\n vec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n }\n\n void main() {\n\n vWorldDirection = transformDirection( position, modelMatrix );\n\n #include <begin_vertex>\n #include <project_vertex>\n\n }\n ",fragmentShader:"\n\n uniform sampler2D tEquirect;\n\n varying vec3 vWorldDirection;\n\n #include <common>\n\n void main() {\n\n vec3 direction = normalize( vWorldDirection );\n\n vec2 sampleUV = equirectUv( direction );\n\n gl_FragColor = texture2D( tEquirect, sampleUV );\n\n }\n "},r=new ai(5,5,5),s=new cr({name:"CubemapFromEquirect",uniforms:Lc(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:Qn,blending:Ps});s.uniforms.tEquirect.value=t;const o=new Be(r,s),a=t.minFilter;return t.minFilter===rs&&(t.minFilter=rn),new zP(1,10,this).update(e,o),t.minFilter=a,o.geometry.dispose(),o.material.dispose(),this}clear(e,t,i,r){const s=e.getRenderTarget();for(let o=0;o<6;o++)e.setRenderTarget(this,o),e.clear(t,i,r);e.setRenderTarget(s)}}const sv=new D,lW=new D,cW=new ut;class Ms{constructor(e=new D(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,i,r){return this.normal.set(e,t,i),this.constant=r,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,i){const r=sv.subVectors(i,t).cross(lW.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t){const i=e.delta(sv),r=this.normal.dot(i);if(r===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const s=-(e.start.dot(this.normal)+this.constant)/r;return s<0||s>1?null:t.copy(e.start).addScaledVector(i,s)}intersectsLine(e){const t=this.distanceToPoint(e.start),i=this.distanceToPoint(e.end);return t<0&&i>0||i<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const i=t||cW.getNormalMatrix(e),r=this.coplanarPoint(sv).applyMatrix4(e),s=this.normal.applyMatrix3(i).normalize();return this.constant=-r.dot(s),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const ta=new Ri,_f=new D;class Bm{constructor(e=new Ms,t=new Ms,i=new Ms,r=new Ms,s=new Ms,o=new Ms){this.planes=[e,t,i,r,s,o]}set(e,t,i,r,s,o){const a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(i),a[3].copy(r),a[4].copy(s),a[5].copy(o),this}copy(e){const t=this.planes;for(let i=0;i<6;i++)t[i].copy(e.planes[i]);return this}setFromProjectionMatrix(e,t=Xr){const i=this.planes,r=e.elements,s=r[0],o=r[1],a=r[2],l=r[3],c=r[4],u=r[5],h=r[6],d=r[7],f=r[8],p=r[9],v=r[10],m=r[11],g=r[12],b=r[13],_=r[14],y=r[15];if(i[0].setComponents(l-s,d-c,m-f,y-g).normalize(),i[1].setComponents(l+s,d+c,m+f,y+g).normalize(),i[2].setComponents(l+o,d+u,m+p,y+b).normalize(),i[3].setComponents(l-o,d-u,m-p,y-b).normalize(),i[4].setComponents(l-a,d-h,m-v,y-_).normalize(),t===Xr)i[5].setComponents(l+a,d+h,m+v,y+_).normalize();else if(t===Bh)i[5].setComponents(a,h,v,_).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),ta.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),ta.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(ta)}intersectsSprite(e){return ta.center.set(0,0,0),ta.radius=.7071067811865476,ta.applyMatrix4(e.matrixWorld),this.intersectsSphere(ta)}intersectsSphere(e){const t=this.planes,i=e.center,r=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(i)<r)return!1;return!0}intersectsBox(e){const t=this.planes;for(let i=0;i<6;i++){const r=t[i];if(_f.x=r.normal.x>0?e.max.x:e.min.x,_f.y=r.normal.y>0?e.max.y:e.min.y,_f.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(_f)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let i=0;i<6;i++)if(t[i].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}function HP(){let n=null,e=!1,t=null,i=null;function r(s,o){t(s,o),i=n.requestAnimationFrame(r)}return{start:function(){e!==!0&&t!==null&&(i=n.requestAnimationFrame(r),e=!0)},stop:function(){n.cancelAnimationFrame(i),e=!1},setAnimationLoop:function(s){t=s},setContext:function(s){n=s}}}function uW(n,e){const t=e.isWebGL2,i=new WeakMap;function r(c,u){const h=c.array,d=c.usage,f=n.createBuffer();n.bindBuffer(u,f),n.bufferData(u,h,d),c.onUploadCallback();let p;if(h instanceof Float32Array)p=n.FLOAT;else if(h instanceof Uint16Array)if(c.isFloat16BufferAttribute)if(t)p=n.HALF_FLOAT;else throw new Error("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.");else p=n.UNSIGNED_SHORT;else if(h instanceof Int16Array)p=n.SHORT;else if(h instanceof Uint32Array)p=n.UNSIGNED_INT;else if(h instanceof Int32Array)p=n.INT;else if(h instanceof Int8Array)p=n.BYTE;else if(h instanceof Uint8Array)p=n.UNSIGNED_BYTE;else if(h instanceof Uint8ClampedArray)p=n.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+h);return{buffer:f,type:p,bytesPerElement:h.BYTES_PER_ELEMENT,version:c.version}}function s(c,u,h){const d=u.array,f=u.updateRange;n.bindBuffer(h,c),f.count===-1?n.bufferSubData(h,0,d):(t?n.bufferSubData(h,f.offset*d.BYTES_PER_ELEMENT,d,f.offset,f.count):n.bufferSubData(h,f.offset*d.BYTES_PER_ELEMENT,d.subarray(f.offset,f.offset+f.count)),f.count=-1),u.onUploadCallback()}function o(c){return c.isInterleavedBufferAttribute&&(c=c.data),i.get(c)}function a(c){c.isInterleavedBufferAttribute&&(c=c.data);const u=i.get(c);u&&(n.deleteBuffer(u.buffer),i.delete(c))}function l(c,u){if(c.isGLBufferAttribute){const d=i.get(c);(!d||d.version<c.version)&&i.set(c,{buffer:c.buffer,type:c.type,bytesPerElement:c.elementSize,version:c.version});return}c.isInterleavedBufferAttribute&&(c=c.data);const h=i.get(c);h===void 0?i.set(c,r(c,u)):h.version<c.version&&(s(h.buffer,c,u),h.version=c.version)}return{get:o,remove:a,update:l}}class Ni extends qe{constructor(e=1,t=1,i=1,r=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:i,heightSegments:r};const s=e/2,o=t/2,a=Math.floor(i),l=Math.floor(r),c=a+1,u=l+1,h=e/a,d=t/l,f=[],p=[],v=[],m=[];for(let g=0;g<u;g++){const b=g*d-o;for(let _=0;_<c;_++){const y=_*h-s;p.push(y,-b,0),v.push(0,0,1),m.push(_/a),m.push(1-g/l)}}for(let g=0;g<l;g++)for(let b=0;b<a;b++){const _=b+c*g,y=b+c*(g+1),T=b+1+c*(g+1),S=b+1+c*g;f.push(_,y,S),f.push(y,T,S)}this.setIndex(f),this.setAttribute("position",new Ve(p,3)),this.setAttribute("normal",new Ve(v,3)),this.setAttribute("uv",new Ve(m,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Ni(e.width,e.height,e.widthSegments,e.heightSegments)}}var hW="#ifdef USE_ALPHAHASH\n if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;\n#endif",dW="#ifdef USE_ALPHAHASH\n const float ALPHA_HASH_SCALE = 0.05;\n float hash2D( vec2 value ) {\n return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );\n }\n float hash3D( vec3 value ) {\n return hash2D( vec2( hash2D( value.xy ), value.z ) );\n }\n float getAlphaHashThreshold( vec3 position ) {\n float maxDeriv = max(\n length( dFdx( position.xyz ) ),\n length( dFdy( position.xyz ) )\n );\n float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );\n vec2 pixScales = vec2(\n exp2( floor( log2( pixScale ) ) ),\n exp2( ceil( log2( pixScale ) ) )\n );\n vec2 alpha = vec2(\n hash3D( floor( pixScales.x * position.xyz ) ),\n hash3D( floor( pixScales.y * position.xyz ) )\n );\n float lerpFactor = fract( log2( pixScale ) );\n float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;\n float a = min( lerpFactor, 1.0 - lerpFactor );\n vec3 cases = vec3(\n x * x / ( 2.0 * a * ( 1.0 - a ) ),\n ( x - 0.5 * a ) / ( 1.0 - a ),\n 1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )\n );\n float threshold = ( x < ( 1.0 - a ) )\n ? ( ( x < a ) ? cases.x : cases.y )\n : cases.z;\n return clamp( threshold , 1.0e-6, 1.0 );\n }\n#endif",fW="#ifdef USE_ALPHAMAP\n diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;\n#endif",pW="#ifdef USE_ALPHAMAP\n uniform sampler2D alphaMap;\n#endif",mW="#ifdef USE_ALPHATEST\n if ( diffuseColor.a < alphaTest ) discard;\n#endif",gW="#ifdef USE_ALPHATEST\n uniform float alphaTest;\n#endif",vW="#ifdef USE_AOMAP\n float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;\n reflectedLight.indirectDiffuse *= ambientOcclusion;\n #if defined( USE_CLEARCOAT ) \n clearcoatSpecularIndirect *= ambientOcclusion;\n #endif\n #if defined( USE_SHEEN ) \n sheenSpecularIndirect *= ambientOcclusion;\n #endif\n #if defined( USE_ENVMAP ) && defined( STANDARD )\n float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );\n reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );\n #endif\n#endif",_W="#ifdef USE_AOMAP\n uniform sampler2D aoMap;\n uniform float aoMapIntensity;\n#endif",yW="vec3 transformed = vec3( position );\n#ifdef USE_ALPHAHASH\n vPosition = vec3( position );\n#endif",bW="vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n vec3 objectTangent = vec3( tangent.xyz );\n#endif",xW="float G_BlinnPhong_Implicit( ) {\n return 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNH = saturate( dot( normal, halfDir ) );\n float dotVH = saturate( dot( viewDir, halfDir ) );\n vec3 F = F_Schlick( specularColor, 1.0, dotVH );\n float G = G_BlinnPhong_Implicit( );\n float D = D_BlinnPhong( shininess, dotNH );\n return F * ( G * D );\n} // validated",wW="#ifdef USE_IRIDESCENCE\n const mat3 XYZ_TO_REC709 = mat3(\n 3.2404542, -0.9692660, 0.0556434,\n -1.5371385, 1.8760108, -0.2040259,\n -0.4985314, 0.0415560, 1.0572252\n );\n vec3 Fresnel0ToIor( vec3 fresnel0 ) {\n vec3 sqrtF0 = sqrt( fresnel0 );\n return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );\n }\n vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {\n return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );\n }\n float IorToFresnel0( float transmittedIor, float incidentIor ) {\n return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));\n }\n vec3 evalSensitivity( float OPD, vec3 shift ) {\n float phase = 2.0 * PI * OPD * 1.0e-9;\n vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );\n vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );\n vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );\n vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );\n xyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );\n xyz /= 1.0685e-7;\n vec3 rgb = XYZ_TO_REC709 * xyz;\n return rgb;\n }\n vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {\n vec3 I;\n float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );\n float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );\n float cosTheta2Sq = 1.0 - sinTheta2Sq;\n if ( cosTheta2Sq < 0.0 ) {\n return vec3( 1.0 );\n }\n float cosTheta2 = sqrt( cosTheta2Sq );\n float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );\n float R12 = F_Schlick( R0, 1.0, cosTheta1 );\n float T121 = 1.0 - R12;\n float phi12 = 0.0;\n if ( iridescenceIOR < outsideIOR ) phi12 = PI;\n float phi21 = PI - phi12;\n vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) ); vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );\n vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );\n vec3 phi23 = vec3( 0.0 );\n if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;\n if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;\n if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;\n float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;\n vec3 phi = vec3( phi21 ) + phi23;\n vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );\n vec3 r123 = sqrt( R123 );\n vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );\n vec3 C0 = R12 + Rs;\n I = C0;\n vec3 Cm = Rs - T121;\n for ( int m = 1; m <= 2; ++ m ) {\n Cm *= r123;\n vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );\n I += Cm * Sm;\n }\n return max( I, vec3( 0.0 ) );\n }\n#endif",SW="#ifdef USE_BUMPMAP\n uniform sampler2D bumpMap;\n uniform float bumpScale;\n vec2 dHdxy_fwd() {\n vec2 dSTdx = dFdx( vBumpMapUv );\n vec2 dSTdy = dFdy( vBumpMapUv );\n float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;\n float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;\n float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;\n return vec2( dBx, dBy );\n }\n vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );\n vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );\n vec3 vN = surf_norm;\n vec3 R1 = cross( vSigmaY, vN );\n vec3 R2 = cross( vN, vSigmaX );\n float fDet = dot( vSigmaX, R1 ) * faceDirection;\n vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n return normalize( abs( fDet ) * surf_norm - vGrad );\n }\n#endif",MW="#if NUM_CLIPPING_PLANES > 0\n vec4 plane;\n #pragma unroll_loop_start\n for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n plane = clippingPlanes[ i ];\n if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n }\n #pragma unroll_loop_end\n #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n bool clipped = true;\n #pragma unroll_loop_start\n for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n plane = clippingPlanes[ i ];\n clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n }\n #pragma unroll_loop_end\n if ( clipped ) discard;\n #endif\n#endif",EW="#if NUM_CLIPPING_PLANES > 0\n varying vec3 vClipPosition;\n uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",TW="#if NUM_CLIPPING_PLANES > 0\n varying vec3 vClipPosition;\n#endif",AW="#if NUM_CLIPPING_PLANES > 0\n vClipPosition = - mvPosition.xyz;\n#endif",CW="#if defined( USE_COLOR_ALPHA )\n diffuseColor *= vColor;\n#elif defined( USE_COLOR )\n diffuseColor.rgb *= vColor;\n#endif",PW="#if defined( USE_COLOR_ALPHA )\n varying vec4 vColor;\n#elif defined( USE_COLOR )\n varying vec3 vColor;\n#endif",RW="#if defined( USE_COLOR_ALPHA )\n varying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n varying vec3 vColor;\n#endif",LW="#if defined( USE_COLOR_ALPHA )\n vColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n vColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n vColor *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n vColor.xyz *= instanceColor.xyz;\n#endif",OW="#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nvec3 pow2( const in vec3 x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }\nhighp float rand( const in vec2 uv ) {\n const highp float a = 12.9898, b = 78.233, c = 43758.5453;\n highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n return fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n float precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n float precisionSafeLength( vec3 v ) {\n float maxComponent = max3( abs( v ) );\n return length( v / maxComponent ) * maxComponent;\n }\n#endif\nstruct IncidentLight {\n vec3 color;\n vec3 direction;\n bool visible;\n};\nstruct ReflectedLight {\n vec3 directDiffuse;\n vec3 directSpecular;\n vec3 indirectDiffuse;\n vec3 indirectSpecular;\n};\n#ifdef USE_ALPHAHASH\n varying vec3 vPosition;\n#endif\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nmat3 transposeMat3( const in mat3 m ) {\n mat3 tmp;\n tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n return tmp;\n}\nfloat luminance( const in vec3 rgb ) {\n const vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 );\n return dot( weights, rgb );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n return m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n return vec2( u, v );\n}\nvec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n return RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\n float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n} // validated",IW="#ifdef ENVMAP_TYPE_CUBE_UV\n #define cubeUV_minMipLevel 4.0\n #define cubeUV_minTileSize 16.0\n float getFace( vec3 direction ) {\n vec3 absDirection = abs( direction );\n float face = - 1.0;\n if ( absDirection.x > absDirection.z ) {\n if ( absDirection.x > absDirection.y )\n face = direction.x > 0.0 ? 0.0 : 3.0;\n else\n face = direction.y > 0.0 ? 1.0 : 4.0;\n } else {\n if ( absDirection.z > absDirection.y )\n face = direction.z > 0.0 ? 2.0 : 5.0;\n else\n face = direction.y > 0.0 ? 1.0 : 4.0;\n }\n return face;\n }\n vec2 getUV( vec3 direction, float face ) {\n vec2 uv;\n if ( face == 0.0 ) {\n uv = vec2( direction.z, direction.y ) / abs( direction.x );\n } else if ( face == 1.0 ) {\n uv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n } else if ( face == 2.0 ) {\n uv = vec2( - direction.x, direction.y ) / abs( direction.z );\n } else if ( face == 3.0 ) {\n uv = vec2( - direction.z, direction.y ) / abs( direction.x );\n } else if ( face == 4.0 ) {\n uv = vec2( - direction.x, direction.z ) / abs( direction.y );\n } else {\n uv = vec2( direction.x, direction.y ) / abs( direction.z );\n }\n return 0.5 * ( uv + 1.0 );\n }\n vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n float face = getFace( direction );\n float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n mipInt = max( mipInt, cubeUV_minMipLevel );\n float faceSize = exp2( mipInt );\n highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\n if ( face > 2.0 ) {\n uv.y += faceSize;\n face -= 3.0;\n }\n uv.x += face * faceSize;\n uv.x += filterInt * 3.0 * cubeUV_minTileSize;\n uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n uv.x *= CUBEUV_TEXEL_WIDTH;\n uv.y *= CUBEUV_TEXEL_HEIGHT;\n #ifdef texture2DGradEXT\n return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n #else\n return texture2D( envMap, uv ).rgb;\n #endif\n }\n #define cubeUV_r0 1.0\n #define cubeUV_v0 0.339\n #define cubeUV_m0 - 2.0\n #define cubeUV_r1 0.8\n #define cubeUV_v1 0.276\n #define cubeUV_m1 - 1.0\n #define cubeUV_r4 0.4\n #define cubeUV_v4 0.046\n #define cubeUV_m4 2.0\n #define cubeUV_r5 0.305\n #define cubeUV_v5 0.016\n #define cubeUV_m5 3.0\n #define cubeUV_r6 0.21\n #define cubeUV_v6 0.0038\n #define cubeUV_m6 4.0\n float roughnessToMip( float roughness ) {\n float mip = 0.0;\n if ( roughness >= cubeUV_r1 ) {\n mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\n } else if ( roughness >= cubeUV_r4 ) {\n mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\n } else if ( roughness >= cubeUV_r5 ) {\n mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\n } else if ( roughness >= cubeUV_r6 ) {\n mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\n } else {\n mip = - 2.0 * log2( 1.16 * roughness ); }\n return mip;\n }\n vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\n float mipF = fract( mip );\n float mipInt = floor( mip );\n vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n if ( mipF == 0.0 ) {\n return vec4( color0, 1.0 );\n } else {\n vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n return vec4( mix( color0, color1, mipF ), 1.0 );\n }\n }\n#endif",DW="vec3 transformedNormal = objectNormal;\n#ifdef USE_INSTANCING\n mat3 m = mat3( instanceMatrix );\n transformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );\n transformedNormal = m * transformedNormal;\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n transformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n vec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n #ifdef FLIP_SIDED\n transformedTangent = - transformedTangent;\n #endif\n#endif",UW="#ifdef USE_DISPLACEMENTMAP\n uniform sampler2D displacementMap;\n uniform float displacementScale;\n uniform float displacementBias;\n#endif",NW="#ifdef USE_DISPLACEMENTMAP\n transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );\n#endif",FW="#ifdef USE_EMISSIVEMAP\n vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );\n totalEmissiveRadiance *= emissiveColor.rgb;\n#endif",kW="#ifdef USE_EMISSIVEMAP\n uniform sampler2D emissiveMap;\n#endif",BW="gl_FragColor = linearToOutputTexel( gl_FragColor );",zW="\nconst mat3 LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = mat3(\n vec3( 0.8224621, 0.177538, 0.0 ),\n vec3( 0.0331941, 0.9668058, 0.0 ),\n vec3( 0.0170827, 0.0723974, 0.9105199 )\n);\nconst mat3 LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = mat3(\n vec3( 1.2249401, - 0.2249404, 0.0 ),\n vec3( - 0.0420569, 1.0420571, 0.0 ),\n vec3( - 0.0196376, - 0.0786361, 1.0982735 )\n);\nvec4 LinearSRGBToLinearDisplayP3( in vec4 value ) {\n return vec4( value.rgb * LINEAR_SRGB_TO_LINEAR_DISPLAY_P3, value.a );\n}\nvec4 LinearDisplayP3ToLinearSRGB( in vec4 value ) {\n return vec4( value.rgb * LINEAR_DISPLAY_P3_TO_LINEAR_SRGB, value.a );\n}\nvec4 LinearTransferOETF( in vec4 value ) {\n return value;\n}\nvec4 sRGBTransferOETF( in vec4 value ) {\n return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}\nvec4 LinearToLinear( in vec4 value ) {\n return value;\n}\nvec4 LinearTosRGB( in vec4 value ) {\n return sRGBTransferOETF( value );\n}",VW="#ifdef USE_ENVMAP\n #ifdef ENV_WORLDPOS\n vec3 cameraToFrag;\n if ( isOrthographic ) {\n cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n } else {\n cameraToFrag = normalize( vWorldPosition - cameraPosition );\n }\n vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n #ifdef ENVMAP_MODE_REFLECTION\n vec3 reflectVec = reflect( cameraToFrag, worldNormal );\n #else\n vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n #endif\n #else\n vec3 reflectVec = vReflect;\n #endif\n #ifdef ENVMAP_TYPE_CUBE\n vec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n #else\n vec4 envColor = vec4( 0.0 );\n #endif\n #ifdef ENVMAP_BLENDING_MULTIPLY\n outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n #elif defined( ENVMAP_BLENDING_MIX )\n outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n #elif defined( ENVMAP_BLENDING_ADD )\n outgoingLight += envColor.xyz * specularStrength * reflectivity;\n #endif\n#endif",HW="#ifdef USE_ENVMAP\n uniform float envMapIntensity;\n uniform float flipEnvMap;\n #ifdef ENVMAP_TYPE_CUBE\n uniform samplerCube envMap;\n #else\n uniform sampler2D envMap;\n #endif\n \n#endif",GW="#ifdef USE_ENVMAP\n uniform float reflectivity;\n #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n #define ENV_WORLDPOS\n #endif\n #ifdef ENV_WORLDPOS\n varying vec3 vWorldPosition;\n uniform float refractionRatio;\n #else\n varying vec3 vReflect;\n #endif\n#endif",WW="#ifdef USE_ENVMAP\n #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n #define ENV_WORLDPOS\n #endif\n #ifdef ENV_WORLDPOS\n \n varying vec3 vWorldPosition;\n #else\n varying vec3 vReflect;\n uniform float refractionRatio;\n #endif\n#endif",$W="#ifdef USE_ENVMAP\n #ifdef ENV_WORLDPOS\n vWorldPosition = worldPosition.xyz;\n #else\n vec3 cameraToVertex;\n if ( isOrthographic ) {\n cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n } else {\n cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n }\n vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n #ifdef ENVMAP_MODE_REFLECTION\n vReflect = reflect( cameraToVertex, worldNormal );\n #else\n vReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n #endif\n #endif\n#endif",jW="#ifdef USE_FOG\n vFogDepth = - mvPosition.z;\n#endif",XW="#ifdef USE_FOG\n varying float vFogDepth;\n#endif",YW="#ifdef USE_FOG\n #ifdef FOG_EXP2\n float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n #else\n float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n #endif\n gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",qW="#ifdef USE_FOG\n uniform vec3 fogColor;\n varying float vFogDepth;\n #ifdef FOG_EXP2\n uniform float fogDensity;\n #else\n uniform float fogNear;\n uniform float fogFar;\n #endif\n#endif",KW="#ifdef USE_GRADIENTMAP\n uniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n float dotNL = dot( normal, lightDirection );\n vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n #ifdef USE_GRADIENTMAP\n return vec3( texture2D( gradientMap, coord ).r );\n #else\n vec2 fw = fwidth( coord ) * 0.5;\n return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );\n #endif\n}",ZW="#ifdef USE_LIGHTMAP\n vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n reflectedLight.indirectDiffuse += lightMapIrradiance;\n#endif",JW="#ifdef USE_LIGHTMAP\n uniform sampler2D lightMap;\n uniform float lightMapIntensity;\n#endif",QW="LambertMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularStrength = specularStrength;",e9="varying vec3 vViewPosition;\nstruct LambertMaterial {\n vec3 diffuseColor;\n float specularStrength;\n};\nvoid RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n float dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct RE_Direct_Lambert\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert",t9="uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\n#if defined( USE_LIGHT_PROBES )\n uniform vec3 lightProbe[ 9 ];\n#endif\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n float x = normal.x, y = normal.y, z = normal.z;\n vec3 result = shCoefficients[ 0 ] * 0.886227;\n result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n return result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n return irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n vec3 irradiance = ambientLightColor;\n return irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n #if defined ( LEGACY_LIGHTS )\n if ( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n return pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );\n }\n return 1.0;\n #else\n float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n if ( cutoffDistance > 0.0 ) {\n distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n }\n return distanceFalloff;\n #endif\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n return smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n struct DirectionalLight {\n vec3 direction;\n vec3 color;\n };\n uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {\n light.color = directionalLight.color;\n light.direction = directionalLight.direction;\n light.visible = true;\n }\n#endif\n#if NUM_POINT_LIGHTS > 0\n struct PointLight {\n vec3 position;\n vec3 color;\n float distance;\n float decay;\n };\n uniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {\n vec3 lVector = pointLight.position - geometryPosition;\n light.direction = normalize( lVector );\n float lightDistance = length( lVector );\n light.color = pointLight.color;\n light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n light.visible = ( light.color != vec3( 0.0 ) );\n }\n#endif\n#if NUM_SPOT_LIGHTS > 0\n struct SpotLight {\n vec3 position;\n vec3 direction;\n vec3 color;\n float distance;\n float decay;\n float coneCos;\n float penumbraCos;\n };\n uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {\n vec3 lVector = spotLight.position - geometryPosition;\n light.direction = normalize( lVector );\n float angleCos = dot( light.direction, spotLight.direction );\n float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n if ( spotAttenuation > 0.0 ) {\n float lightDistance = length( lVector );\n light.color = spotLight.color * spotAttenuation;\n light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n light.visible = ( light.color != vec3( 0.0 ) );\n } else {\n light.color = vec3( 0.0 );\n light.visible = false;\n }\n }\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n struct RectAreaLight {\n vec3 color;\n vec3 position;\n vec3 halfWidth;\n vec3 halfHeight;\n };\n uniform sampler2D ltc_1; uniform sampler2D ltc_2;\n uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n struct HemisphereLight {\n vec3 direction;\n vec3 skyColor;\n vec3 groundColor;\n };\n uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n float dotNL = dot( normal, hemiLight.direction );\n float hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n return irradiance;\n }\n#endif",n9="#ifdef USE_ENVMAP\n vec3 getIBLIrradiance( const in vec3 normal ) {\n #ifdef ENVMAP_TYPE_CUBE_UV\n vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n vec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );\n return PI * envMapColor.rgb * envMapIntensity;\n #else\n return vec3( 0.0 );\n #endif\n }\n vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n #ifdef ENVMAP_TYPE_CUBE_UV\n vec3 reflectVec = reflect( - viewDir, normal );\n reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n reflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n vec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );\n return envMapColor.rgb * envMapIntensity;\n #else\n return vec3( 0.0 );\n #endif\n }\n #ifdef USE_ANISOTROPY\n vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {\n #ifdef ENVMAP_TYPE_CUBE_UV\n vec3 bentNormal = cross( bitangent, viewDir );\n bentNormal = normalize( cross( bentNormal, bitangent ) );\n bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );\n return getIBLRadiance( viewDir, bentNormal, roughness );\n #else\n return vec3( 0.0 );\n #endif\n }\n #endif\n#endif",i9="ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",r9="varying vec3 vViewPosition;\nstruct ToonMaterial {\n vec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct RE_Direct_Toon\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon",s9="BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",o9="varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n vec3 diffuseColor;\n vec3 specularColor;\n float specularShininess;\n float specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n float dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct RE_Direct_BlinnPhong\n#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong",a9="PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n material.ior = ior;\n #ifdef USE_SPECULAR\n float specularIntensityFactor = specularIntensity;\n vec3 specularColorFactor = specularColor;\n #ifdef USE_SPECULAR_COLORMAP\n specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\n #endif\n #ifdef USE_SPECULAR_INTENSITYMAP\n specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\n #endif\n material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n #else\n float specularIntensityFactor = 1.0;\n vec3 specularColorFactor = vec3( 1.0 );\n material.specularF90 = 1.0;\n #endif\n material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\n#else\n material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n material.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n material.clearcoat = clearcoat;\n material.clearcoatRoughness = clearcoatRoughness;\n material.clearcoatF0 = vec3( 0.04 );\n material.clearcoatF90 = 1.0;\n #ifdef USE_CLEARCOATMAP\n material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;\n #endif\n #ifdef USE_CLEARCOAT_ROUGHNESSMAP\n material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;\n #endif\n material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n material.clearcoatRoughness += geometryRoughness;\n material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_IRIDESCENCE\n material.iridescence = iridescence;\n material.iridescenceIOR = iridescenceIOR;\n #ifdef USE_IRIDESCENCEMAP\n material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;\n #endif\n #ifdef USE_IRIDESCENCE_THICKNESSMAP\n material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;\n #else\n material.iridescenceThickness = iridescenceThicknessMaximum;\n #endif\n#endif\n#ifdef USE_SHEEN\n material.sheenColor = sheenColor;\n #ifdef USE_SHEEN_COLORMAP\n material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\n #endif\n material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n #ifdef USE_SHEEN_ROUGHNESSMAP\n material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\n #endif\n#endif\n#ifdef USE_ANISOTROPY\n #ifdef USE_ANISOTROPYMAP\n mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );\n vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;\n vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;\n #else\n vec2 anisotropyV = anisotropyVector;\n #endif\n material.anisotropy = length( anisotropyV );\n anisotropyV /= material.anisotropy;\n material.anisotropy = saturate( material.anisotropy );\n material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );\n material.anisotropyT = tbn[ 0 ] * anisotropyV.x - tbn[ 1 ] * anisotropyV.y;\n material.anisotropyB = tbn[ 1 ] * anisotropyV.x + tbn[ 0 ] * anisotropyV.y;\n#endif",l9="struct PhysicalMaterial {\n vec3 diffuseColor;\n float roughness;\n vec3 specularColor;\n float specularF90;\n #ifdef USE_CLEARCOAT\n float clearcoat;\n float clearcoatRoughness;\n vec3 clearcoatF0;\n float clearcoatF90;\n #endif\n #ifdef USE_IRIDESCENCE\n float iridescence;\n float iridescenceIOR;\n float iridescenceThickness;\n vec3 iridescenceFresnel;\n vec3 iridescenceF0;\n #endif\n #ifdef USE_SHEEN\n vec3 sheenColor;\n float sheenRoughness;\n #endif\n #ifdef IOR\n float ior;\n #endif\n #ifdef USE_TRANSMISSION\n float transmission;\n float transmissionAlpha;\n float thickness;\n float attenuationDistance;\n vec3 attenuationColor;\n #endif\n #ifdef USE_ANISOTROPY\n float anisotropy;\n float alphaT;\n vec3 anisotropyT;\n vec3 anisotropyB;\n #endif\n};\nvec3 clearcoatSpecularDirect = vec3( 0.0 );\nvec3 clearcoatSpecularIndirect = vec3( 0.0 );\nvec3 sheenSpecularDirect = vec3( 0.0 );\nvec3 sheenSpecularIndirect = vec3(0.0 );\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\n float x2 = x * x;\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n float a2 = pow2( alpha );\n float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n return 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n float a2 = pow2( alpha );\n float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n return RECIPROCAL_PI * a2 / pow2( denom );\n}\n#ifdef USE_ANISOTROPY\n float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {\n float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );\n float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\n float v = 0.5 / ( gv + gl );\n return saturate(v);\n }\n float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\n float a2 = alphaT * alphaB;\n highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\n highp float v2 = dot( v, v );\n float w2 = a2 / v2;\n return RECIPROCAL_PI * a2 * pow2 ( w2 );\n }\n#endif\n#ifdef USE_CLEARCOAT\n vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\n vec3 f0 = material.clearcoatF0;\n float f90 = material.clearcoatF90;\n float roughness = material.clearcoatRoughness;\n float alpha = pow2( roughness );\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n float dotNH = saturate( dot( normal, halfDir ) );\n float dotVH = saturate( dot( viewDir, halfDir ) );\n vec3 F = F_Schlick( f0, f90, dotVH );\n float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n float D = D_GGX( alpha, dotNH );\n return F * ( V * D );\n }\n#endif\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n vec3 f0 = material.specularColor;\n float f90 = material.specularF90;\n float roughness = material.roughness;\n float alpha = pow2( roughness );\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n float dotNH = saturate( dot( normal, halfDir ) );\n float dotVH = saturate( dot( viewDir, halfDir ) );\n vec3 F = F_Schlick( f0, f90, dotVH );\n #ifdef USE_IRIDESCENCE\n F = mix( F, material.iridescenceFresnel, material.iridescence );\n #endif\n #ifdef USE_ANISOTROPY\n float dotTL = dot( material.anisotropyT, lightDir );\n float dotTV = dot( material.anisotropyT, viewDir );\n float dotTH = dot( material.anisotropyT, halfDir );\n float dotBL = dot( material.anisotropyB, lightDir );\n float dotBV = dot( material.anisotropyB, viewDir );\n float dotBH = dot( material.anisotropyB, halfDir );\n float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\n float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\n #else\n float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n float D = D_GGX( alpha, dotNH );\n #endif\n return F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n const float LUT_SIZE = 64.0;\n const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n const float LUT_BIAS = 0.5 / LUT_SIZE;\n float dotNV = saturate( dot( N, V ) );\n vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n uv = uv * LUT_SCALE + LUT_BIAS;\n return uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n float l = length( f );\n return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n float x = dot( v1, v2 );\n float y = abs( x );\n float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n float b = 3.4175940 + ( 4.1616724 + y ) * y;\n float v = a / b;\n float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n return cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n vec3 lightNormal = cross( v1, v2 );\n if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n vec3 T1, T2;\n T1 = normalize( V - N * dot( V, N ) );\n T2 = - cross( N, T1 );\n mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n vec3 coords[ 4 ];\n coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n coords[ 0 ] = normalize( coords[ 0 ] );\n coords[ 1 ] = normalize( coords[ 1 ] );\n coords[ 2 ] = normalize( coords[ 2 ] );\n coords[ 3 ] = normalize( coords[ 3 ] );\n vec3 vectorFormFactor = vec3( 0.0 );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n float result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n return vec3( result );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n float alpha = pow2( roughness );\n float invAlpha = 1.0 / alpha;\n float cos2h = dotNH * dotNH;\n float sin2h = max( 1.0 - cos2h, 0.0078125 );\n return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n float dotNH = saturate( dot( normal, halfDir ) );\n float D = D_Charlie( sheenRoughness, dotNH );\n float V = V_Neubelt( dotNV, dotNL );\n return sheenColor * ( D * V );\n}\n#endif\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n float dotNV = saturate( dot( normal, viewDir ) );\n float r2 = roughness * roughness;\n float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\n float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\n float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\n return saturate( DG * RECIPROCAL_PI );\n}\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n float dotNV = saturate( dot( normal, viewDir ) );\n const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n vec4 r = roughness * c0 + c1;\n float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n return fab;\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n vec2 fab = DFGApprox( normal, viewDir, roughness );\n return specularColor * fab.x + specularF90 * fab.y;\n}\n#ifdef USE_IRIDESCENCE\nvoid computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#else\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#endif\n vec2 fab = DFGApprox( normal, viewDir, roughness );\n #ifdef USE_IRIDESCENCE\n vec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n #else\n vec3 Fr = specularColor;\n #endif\n vec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n float Ess = fab.x + fab.y;\n float Ems = 1.0 - Ess;\n vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n singleScatter += FssEss;\n multiScatter += Fms * Ems;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n vec3 normal = geometryNormal;\n vec3 viewDir = geometryViewDir;\n vec3 position = geometryPosition;\n vec3 lightPos = rectAreaLight.position;\n vec3 halfWidth = rectAreaLight.halfWidth;\n vec3 halfHeight = rectAreaLight.halfHeight;\n vec3 lightColor = rectAreaLight.color;\n float roughness = material.roughness;\n vec3 rectCoords[ 4 ];\n rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n vec2 uv = LTC_Uv( normal, viewDir, roughness );\n vec4 t1 = texture2D( ltc_1, uv );\n vec4 t2 = texture2D( ltc_2, uv );\n mat3 mInv = mat3(\n vec3( t1.x, 0, t1.y ),\n vec3( 0, 1, 0 ),\n vec3( t1.z, 0, t1.w )\n );\n vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n }\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n float dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n #ifdef USE_CLEARCOAT\n float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );\n vec3 ccIrradiance = dotNLcc * directLight.color;\n clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );\n #endif\n #ifdef USE_SHEEN\n sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );\n #endif\n reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n #ifdef USE_CLEARCOAT\n clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n #endif\n #ifdef USE_SHEEN\n sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n #endif\n vec3 singleScattering = vec3( 0.0 );\n vec3 multiScattering = vec3( 0.0 );\n vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n #ifdef USE_IRIDESCENCE\n computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );\n #else\n computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n #endif\n vec3 totalScattering = singleScattering + multiScattering;\n vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );\n reflectedLight.indirectSpecular += radiance * singleScattering;\n reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct RE_Direct_Physical\n#define RE_Direct_RectArea RE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular RE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",c9="\nvec3 geometryPosition = - vViewPosition;\nvec3 geometryNormal = normal;\nvec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\nvec3 geometryClearcoatNormal = vec3( 0.0 );\n#ifdef USE_CLEARCOAT\n geometryClearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n float dotNVi = saturate( dot( normal, geometryViewDir ) );\n if ( material.iridescenceThickness == 0.0 ) {\n material.iridescence = 0.0;\n } else {\n material.iridescence = saturate( material.iridescence );\n }\n if ( material.iridescence > 0.0 ) {\n material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n }\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n PointLight pointLight;\n #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n PointLightShadow pointLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n pointLight = pointLights[ i ];\n getPointLightInfo( pointLight, geometryPosition, directLight );\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n pointLightShadow = pointLightShadows[ i ];\n directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n #endif\n RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n SpotLight spotLight;\n vec4 spotColor;\n vec3 spotLightCoord;\n bool inSpotLightMap;\n #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n SpotLightShadow spotLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n spotLight = spotLights[ i ];\n getSpotLightInfo( spotLight, geometryPosition, directLight );\n #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n #else\n #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n #endif\n #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n #endif\n #undef SPOT_LIGHT_MAP_INDEX\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n spotLightShadow = spotLightShadows[ i ];\n directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n #endif\n RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n DirectionalLight directionalLight;\n #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n DirectionalLightShadow directionalLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n directionalLight = directionalLights[ i ];\n getDirectionalLightInfo( directionalLight, directLight );\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n directionalLightShadow = directionalLightShadows[ i ];\n directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n #endif\n RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n RectAreaLight rectAreaLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n rectAreaLight = rectAreaLights[ i ];\n RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n vec3 iblIrradiance = vec3( 0.0 );\n vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n #if defined( USE_LIGHT_PROBES )\n irradiance += getLightProbeIrradiance( lightProbe, geometryNormal );\n #endif\n #if ( NUM_HEMI_LIGHTS > 0 )\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );\n }\n #pragma unroll_loop_end\n #endif\n#endif\n#if defined( RE_IndirectSpecular )\n vec3 radiance = vec3( 0.0 );\n vec3 clearcoatRadiance = vec3( 0.0 );\n#endif",u9="#if defined( RE_IndirectDiffuse )\n #ifdef USE_LIGHTMAP\n vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n irradiance += lightMapIrradiance;\n #endif\n #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n iblIrradiance += getIBLIrradiance( geometryNormal );\n #endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n #ifdef USE_ANISOTROPY\n radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );\n #else\n radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );\n #endif\n #ifdef USE_CLEARCOAT\n clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );\n #endif\n#endif",h9="#if defined( RE_IndirectDiffuse )\n RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif",d9="#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n gl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",f9="#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n uniform float logDepthBufFC;\n varying float vFragDepth;\n varying float vIsPerspective;\n#endif",p9="#ifdef USE_LOGDEPTHBUF\n #ifdef USE_LOGDEPTHBUF_EXT\n varying float vFragDepth;\n varying float vIsPerspective;\n #else\n uniform float logDepthBufFC;\n #endif\n#endif",m9="#ifdef USE_LOGDEPTHBUF\n #ifdef USE_LOGDEPTHBUF_EXT\n vFragDepth = 1.0 + gl_Position.w;\n vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n #else\n if ( isPerspectiveMatrix( projectionMatrix ) ) {\n gl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n gl_Position.z *= gl_Position.w;\n }\n #endif\n#endif",g9="#ifdef USE_MAP\n vec4 sampledDiffuseColor = texture2D( map, vMapUv );\n #ifdef DECODE_VIDEO_TEXTURE\n sampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w );\n \n #endif\n diffuseColor *= sampledDiffuseColor;\n#endif",v9="#ifdef USE_MAP\n uniform sampler2D map;\n#endif",_9="#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n #if defined( USE_POINTS_UV )\n vec2 uv = vUv;\n #else\n vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n #endif\n#endif\n#ifdef USE_MAP\n diffuseColor *= texture2D( map, uv );\n#endif\n#ifdef USE_ALPHAMAP\n diffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",y9="#if defined( USE_POINTS_UV )\n varying vec2 vUv;\n#else\n #if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n uniform mat3 uvTransform;\n #endif\n#endif\n#ifdef USE_MAP\n uniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n uniform sampler2D alphaMap;\n#endif",b9="float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );\n metalnessFactor *= texelMetalness.b;\n#endif",x9="#ifdef USE_METALNESSMAP\n uniform sampler2D metalnessMap;\n#endif",w9="#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE )\n vColor *= morphTargetBaseInfluence;\n for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n #if defined( USE_COLOR_ALPHA )\n if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\n #elif defined( USE_COLOR )\n if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\n #endif\n }\n#endif",S9="#ifdef USE_MORPHNORMALS\n objectNormal *= morphTargetBaseInfluence;\n #ifdef MORPHTARGETS_TEXTURE\n for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\n }\n #else\n objectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\n objectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\n objectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\n objectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\n #endif\n#endif",M9="#ifdef USE_MORPHTARGETS\n uniform float morphTargetBaseInfluence;\n #ifdef MORPHTARGETS_TEXTURE\n uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n uniform sampler2DArray morphTargetsTexture;\n uniform ivec2 morphTargetsTextureSize;\n vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\n int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\n int y = texelIndex / morphTargetsTextureSize.x;\n int x = texelIndex - y * morphTargetsTextureSize.x;\n ivec3 morphUV = ivec3( x, y, morphTargetIndex );\n return texelFetch( morphTargetsTexture, morphUV, 0 );\n }\n #else\n #ifndef USE_MORPHNORMALS\n uniform float morphTargetInfluences[ 8 ];\n #else\n uniform float morphTargetInfluences[ 4 ];\n #endif\n #endif\n#endif",E9="#ifdef USE_MORPHTARGETS\n transformed *= morphTargetBaseInfluence;\n #ifdef MORPHTARGETS_TEXTURE\n for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n }\n #else\n transformed += morphTarget0 * morphTargetInfluences[ 0 ];\n transformed += morphTarget1 * morphTargetInfluences[ 1 ];\n transformed += morphTarget2 * morphTargetInfluences[ 2 ];\n transformed += morphTarget3 * morphTargetInfluences[ 3 ];\n #ifndef USE_MORPHNORMALS\n transformed += morphTarget4 * morphTargetInfluences[ 4 ];\n transformed += morphTarget5 * morphTargetInfluences[ 5 ];\n transformed += morphTarget6 * morphTargetInfluences[ 6 ];\n transformed += morphTarget7 * morphTargetInfluences[ 7 ];\n #endif\n #endif\n#endif",T9="float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n vec3 fdx = dFdx( vViewPosition );\n vec3 fdy = dFdy( vViewPosition );\n vec3 normal = normalize( cross( fdx, fdy ) );\n#else\n vec3 normal = normalize( vNormal );\n #ifdef DOUBLE_SIDED\n normal *= faceDirection;\n #endif\n#endif\n#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )\n #ifdef USE_TANGENT\n mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n #else\n mat3 tbn = getTangentFrame( - vViewPosition, normal,\n #if defined( USE_NORMALMAP )\n vNormalMapUv\n #elif defined( USE_CLEARCOAT_NORMALMAP )\n vClearcoatNormalMapUv\n #else\n vUv\n #endif\n );\n #endif\n #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n tbn[0] *= faceDirection;\n tbn[1] *= faceDirection;\n #endif\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n #ifdef USE_TANGENT\n mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n #else\n mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );\n #endif\n #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n tbn2[0] *= faceDirection;\n tbn2[1] *= faceDirection;\n #endif\n#endif\nvec3 nonPerturbedNormal = normal;",A9="#ifdef USE_NORMALMAP_OBJECTSPACE\n normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n #ifdef FLIP_SIDED\n normal = - normal;\n #endif\n #ifdef DOUBLE_SIDED\n normal = normal * faceDirection;\n #endif\n normal = normalize( normalMatrix * normal );\n#elif defined( USE_NORMALMAP_TANGENTSPACE )\n vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n mapN.xy *= normalScale;\n normal = normalize( tbn * mapN );\n#elif defined( USE_BUMPMAP )\n normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif",C9="#ifndef FLAT_SHADED\n varying vec3 vNormal;\n #ifdef USE_TANGENT\n varying vec3 vTangent;\n varying vec3 vBitangent;\n #endif\n#endif",P9="#ifndef FLAT_SHADED\n varying vec3 vNormal;\n #ifdef USE_TANGENT\n varying vec3 vTangent;\n varying vec3 vBitangent;\n #endif\n#endif",R9="#ifndef FLAT_SHADED\n vNormal = normalize( transformedNormal );\n #ifdef USE_TANGENT\n vTangent = normalize( transformedTangent );\n vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n #endif\n#endif",L9="#ifdef USE_NORMALMAP\n uniform sampler2D normalMap;\n uniform vec2 normalScale;\n#endif\n#ifdef USE_NORMALMAP_OBJECTSPACE\n uniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )\n mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {\n vec3 q0 = dFdx( eye_pos.xyz );\n vec3 q1 = dFdy( eye_pos.xyz );\n vec2 st0 = dFdx( uv.st );\n vec2 st1 = dFdy( uv.st );\n vec3 N = surf_norm;\n vec3 q1perp = cross( q1, N );\n vec3 q0perp = cross( N, q0 );\n vec3 T = q1perp * st0.x + q0perp * st1.x;\n vec3 B = q1perp * st0.y + q0perp * st1.y;\n float det = max( dot( T, T ), dot( B, B ) );\n float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );\n return mat3( T * scale, B * scale, N );\n }\n#endif",O9="#ifdef USE_CLEARCOAT\n vec3 clearcoatNormal = nonPerturbedNormal;\n#endif",I9="#ifdef USE_CLEARCOAT_NORMALMAP\n vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;\n clearcoatMapN.xy *= clearcoatNormalScale;\n clearcoatNormal = normalize( tbn2 * clearcoatMapN );\n#endif",D9="#ifdef USE_CLEARCOATMAP\n uniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n uniform sampler2D clearcoatNormalMap;\n uniform vec2 clearcoatNormalScale;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n uniform sampler2D clearcoatRoughnessMap;\n#endif",U9="#ifdef USE_IRIDESCENCEMAP\n uniform sampler2D iridescenceMap;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n uniform sampler2D iridescenceThicknessMap;\n#endif",N9="#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= material.transmissionAlpha;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );",F9="vec3 packNormalToRGB( const in vec3 normal ) {\n return normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n return 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n vec4 r = vec4( fract( v * PackFactors ), v );\n r.yzw -= r.xyz * ShiftRight8; return r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n return dot( v, UnpackFactors );\n}\nvec2 packDepthToRG( in highp float v ) {\n return packDepthToRGBA( v ).yx;\n}\nfloat unpackRGToDepth( const in highp vec2 v ) {\n return unpackRGBAToDepth( vec4( v.xy, 0.0, 0.0 ) );\n}\nvec4 pack2HalfToRGBA( vec2 v ) {\n vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );\n return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\n}\nvec2 unpackRGBATo2Half( vec4 v ) {\n return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n return ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {\n return depth * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {\n return ( near * far ) / ( ( far - near ) * depth - far );\n}",k9="#ifdef PREMULTIPLIED_ALPHA\n gl_FragColor.rgb *= gl_FragColor.a;\n#endif",B9="vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_INSTANCING\n mvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",z9="#ifdef DITHERING\n gl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",V9="#ifdef DITHERING\n vec3 dithering( vec3 color ) {\n float grid_position = rand( gl_FragCoord.xy );\n vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n return color + dither_shift_RGB;\n }\n#endif",H9="float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );\n roughnessFactor *= texelRoughness.g;\n#endif",G9="#ifdef USE_ROUGHNESSMAP\n uniform sampler2D roughnessMap;\n#endif",W9="#if NUM_SPOT_LIGHT_COORDS > 0\n varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHT_SHADOWS > 0\n uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n struct DirectionalLightShadow {\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n struct SpotLightShadow {\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n struct PointLightShadow {\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n float shadowCameraNear;\n float shadowCameraFar;\n };\n uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n #endif\n float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n }\n vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n return unpackRGBATo2Half( texture2D( shadow, uv ) );\n }\n float VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n float occlusion = 1.0;\n vec2 distribution = texture2DDistribution( shadow, uv );\n float hard_shadow = step( compare , distribution.x );\n if (hard_shadow != 1.0 ) {\n float distance = compare - distribution.x ;\n float variance = max( 0.00000, distribution.y * distribution.y );\n float softness_probability = variance / (variance + distance * distance ); softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 ); occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n }\n return occlusion;\n }\n float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n float shadow = 1.0;\n shadowCoord.xyz /= shadowCoord.w;\n shadowCoord.z += shadowBias;\n bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n bool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n if ( frustumTest ) {\n #if defined( SHADOWMAP_TYPE_PCF )\n vec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n float dx0 = - texelSize.x * shadowRadius;\n float dy0 = - texelSize.y * shadowRadius;\n float dx1 = + texelSize.x * shadowRadius;\n float dy1 = + texelSize.y * shadowRadius;\n float dx2 = dx0 / 2.0;\n float dy2 = dy0 / 2.0;\n float dx3 = dx1 / 2.0;\n float dy3 = dy1 / 2.0;\n shadow = (\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n ) * ( 1.0 / 17.0 );\n #elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n vec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n float dx = texelSize.x;\n float dy = texelSize.y;\n vec2 uv = shadowCoord.xy;\n vec2 f = fract( uv * shadowMapSize + 0.5 );\n uv -= f * texelSize;\n shadow = (\n texture2DCompare( shadowMap, uv, shadowCoord.z ) +\n texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n f.x ) +\n mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n f.x ) +\n mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n f.y ) +\n mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n f.y ) +\n mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n f.x ),\n mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n f.x ),\n f.y )\n ) * ( 1.0 / 9.0 );\n #elif defined( SHADOWMAP_TYPE_VSM )\n shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n #else\n shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n #endif\n }\n return shadow;\n }\n vec2 cubeToUV( vec3 v, float texelSizeY ) {\n vec3 absV = abs( v );\n float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n absV *= scaleToCube;\n v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n vec2 planar = v.xy;\n float almostATexel = 1.5 * texelSizeY;\n float almostOne = 1.0 - almostATexel;\n if ( absV.z >= almostOne ) {\n if ( v.z > 0.0 )\n planar.x = 4.0 - v.x;\n } else if ( absV.x >= almostOne ) {\n float signX = sign( v.x );\n planar.x = v.z * signX + 2.0 * signX;\n } else if ( absV.y >= almostOne ) {\n float signY = sign( v.y );\n planar.x = v.x + 2.0 * signY + 2.0;\n planar.y = v.z * signY - 2.0;\n }\n return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n }\n float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n vec3 lightToPosition = shadowCoord.xyz;\n float dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias;\n vec3 bd3D = normalize( lightToPosition );\n #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n return (\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n ) * ( 1.0 / 9.0 );\n #else\n return texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n #endif\n }\n#endif",$9="#if NUM_SPOT_LIGHT_COORDS > 0\n uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\n varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHT_SHADOWS > 0\n uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n struct DirectionalLightShadow {\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n struct SpotLightShadow {\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n struct PointLightShadow {\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n float shadowCameraNear;\n float shadowCameraFar;\n };\n uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n #endif\n#endif",j9="#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )\n vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n vec4 shadowWorldPosition;\n#endif\n#if defined( USE_SHADOWMAP )\n #if NUM_DIR_LIGHT_SHADOWS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n }\n #pragma unroll_loop_end\n #endif\n#endif\n#if NUM_SPOT_LIGHT_COORDS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\n shadowWorldPosition = worldPosition;\n #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\n #endif\n vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\n }\n #pragma unroll_loop_end\n#endif",X9="float getShadowMask() {\n float shadow = 1.0;\n #ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHT_SHADOWS > 0\n DirectionalLightShadow directionalLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n directionalLight = directionalLightShadows[ i ];\n shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n SpotLightShadow spotLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n spotLight = spotLightShadows[ i ];\n shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n PointLightShadow pointLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n pointLight = pointLightShadows[ i ];\n shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n }\n #pragma unroll_loop_end\n #endif\n #endif\n return shadow;\n}",Y9="#ifdef USE_SKINNING\n mat4 boneMatX = getBoneMatrix( skinIndex.x );\n mat4 boneMatY = getBoneMatrix( skinIndex.y );\n mat4 boneMatZ = getBoneMatrix( skinIndex.z );\n mat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",q9="#ifdef USE_SKINNING\n uniform mat4 bindMatrix;\n uniform mat4 bindMatrixInverse;\n uniform highp sampler2D boneTexture;\n uniform int boneTextureSize;\n mat4 getBoneMatrix( const in float i ) {\n float j = i * 4.0;\n float x = mod( j, float( boneTextureSize ) );\n float y = floor( j / float( boneTextureSize ) );\n float dx = 1.0 / float( boneTextureSize );\n float dy = 1.0 / float( boneTextureSize );\n y = dy * ( y + 0.5 );\n vec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n vec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n vec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n vec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n mat4 bone = mat4( v1, v2, v3, v4 );\n return bone;\n }\n#endif",K9="#ifdef USE_SKINNING\n vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n vec4 skinned = vec4( 0.0 );\n skinned += boneMatX * skinVertex * skinWeight.x;\n skinned += boneMatY * skinVertex * skinWeight.y;\n skinned += boneMatZ * skinVertex * skinWeight.z;\n skinned += boneMatW * skinVertex * skinWeight.w;\n transformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",Z9="#ifdef USE_SKINNING\n mat4 skinMatrix = mat4( 0.0 );\n skinMatrix += skinWeight.x * boneMatX;\n skinMatrix += skinWeight.y * boneMatY;\n skinMatrix += skinWeight.z * boneMatZ;\n skinMatrix += skinWeight.w * boneMatW;\n skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n #ifdef USE_TANGENT\n objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n #endif\n#endif",J9="float specularStrength;\n#ifdef USE_SPECULARMAP\n vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );\n specularStrength = texelSpecular.r;\n#else\n specularStrength = 1.0;\n#endif",Q9="#ifdef USE_SPECULARMAP\n uniform sampler2D specularMap;\n#endif",e$="#if defined( TONE_MAPPING )\n gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",t$="#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n return saturate( toneMappingExposure * color );\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n return saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n color = max( vec3( 0.0 ), color - 0.004 );\n return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n vec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n return a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n const mat3 ACESInputMat = mat3(\n vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ),\n vec3( 0.04823, 0.01566, 0.83777 )\n );\n const mat3 ACESOutputMat = mat3(\n vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ),\n vec3( -0.07367, -0.00605, 1.07602 )\n );\n color *= toneMappingExposure / 0.6;\n color = ACESInputMat * color;\n color = RRTAndODTFit( color );\n color = ACESOutputMat * color;\n return saturate( color );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",n$="#ifdef USE_TRANSMISSION\n material.transmission = transmission;\n material.transmissionAlpha = 1.0;\n material.thickness = thickness;\n material.attenuationDistance = attenuationDistance;\n material.attenuationColor = attenuationColor;\n #ifdef USE_TRANSMISSIONMAP\n material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;\n #endif\n #ifdef USE_THICKNESSMAP\n material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;\n #endif\n vec3 pos = vWorldPosition;\n vec3 v = normalize( cameraPosition - pos );\n vec3 n = inverseTransformDirection( normal, viewMatrix );\n vec4 transmitted = getIBLVolumeRefraction(\n n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,\n pos, modelMatrix, viewMatrix, projectionMatrix, material.ior, material.thickness,\n material.attenuationColor, material.attenuationDistance );\n material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );\n totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );\n#endif",i$="#ifdef USE_TRANSMISSION\n uniform float transmission;\n uniform float thickness;\n uniform float attenuationDistance;\n uniform vec3 attenuationColor;\n #ifdef USE_TRANSMISSIONMAP\n uniform sampler2D transmissionMap;\n #endif\n #ifdef USE_THICKNESSMAP\n uniform sampler2D thicknessMap;\n #endif\n uniform vec2 transmissionSamplerSize;\n uniform sampler2D transmissionSamplerMap;\n uniform mat4 modelMatrix;\n uniform mat4 projectionMatrix;\n varying vec3 vWorldPosition;\n float w0( float a ) {\n return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );\n }\n float w1( float a ) {\n return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );\n }\n float w2( float a ){\n return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );\n }\n float w3( float a ) {\n return ( 1.0 / 6.0 ) * ( a * a * a );\n }\n float g0( float a ) {\n return w0( a ) + w1( a );\n }\n float g1( float a ) {\n return w2( a ) + w3( a );\n }\n float h0( float a ) {\n return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );\n }\n float h1( float a ) {\n return 1.0 + w3( a ) / ( w2( a ) + w3( a ) );\n }\n vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {\n uv = uv * texelSize.zw + 0.5;\n vec2 iuv = floor( uv );\n vec2 fuv = fract( uv );\n float g0x = g0( fuv.x );\n float g1x = g1( fuv.x );\n float h0x = h0( fuv.x );\n float h1x = h1( fuv.x );\n float h0y = h0( fuv.y );\n float h1y = h1( fuv.y );\n vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +\n g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );\n }\n vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {\n vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );\n vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );\n vec2 fLodSizeInv = 1.0 / fLodSize;\n vec2 cLodSizeInv = 1.0 / cLodSize;\n vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );\n vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );\n return mix( fSample, cSample, fract( lod ) );\n }\n vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n vec3 modelScale;\n modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n return normalize( refractionVector ) * thickness * modelScale;\n }\n float applyIorToRoughness( const in float roughness, const in float ior ) {\n return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n }\n vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );\n }\n vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n if ( isinf( attenuationDistance ) ) {\n return vec3( 1.0 );\n } else {\n vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance;\n }\n }\n vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n const in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness,\n const in vec3 attenuationColor, const in float attenuationDistance ) {\n vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n vec3 refractedRayExit = position + transmissionRay;\n vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n vec2 refractionCoords = ndcPos.xy / ndcPos.w;\n refractionCoords += 1.0;\n refractionCoords /= 2.0;\n vec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n vec3 transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );\n vec3 attenuatedColor = transmittance * transmittedLight.rgb;\n vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;\n return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );\n }\n#endif",r$="#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n varying vec2 vUv;\n#endif\n#ifdef USE_MAP\n varying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n varying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n varying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n varying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n varying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n varying vec2 vNormalMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n varying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n varying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n varying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n varying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n varying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n varying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n varying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n varying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n varying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n varying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n varying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n varying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n varying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n varying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n uniform mat3 transmissionMapTransform;\n varying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n uniform mat3 thicknessMapTransform;\n varying vec2 vThicknessMapUv;\n#endif",s$="#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n varying vec2 vUv;\n#endif\n#ifdef USE_MAP\n uniform mat3 mapTransform;\n varying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n uniform mat3 alphaMapTransform;\n varying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n uniform mat3 lightMapTransform;\n varying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n uniform mat3 aoMapTransform;\n varying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n uniform mat3 bumpMapTransform;\n varying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n uniform mat3 normalMapTransform;\n varying vec2 vNormalMapUv;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n uniform mat3 displacementMapTransform;\n varying vec2 vDisplacementMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n uniform mat3 emissiveMapTransform;\n varying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n uniform mat3 metalnessMapTransform;\n varying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n uniform mat3 roughnessMapTransform;\n varying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n uniform mat3 anisotropyMapTransform;\n varying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n uniform mat3 clearcoatMapTransform;\n varying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n uniform mat3 clearcoatNormalMapTransform;\n varying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n uniform mat3 clearcoatRoughnessMapTransform;\n varying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n uniform mat3 sheenColorMapTransform;\n varying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n uniform mat3 sheenRoughnessMapTransform;\n varying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n uniform mat3 iridescenceMapTransform;\n varying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n uniform mat3 iridescenceThicknessMapTransform;\n varying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n uniform mat3 specularMapTransform;\n varying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n uniform mat3 specularColorMapTransform;\n varying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n uniform mat3 specularIntensityMapTransform;\n varying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n uniform mat3 transmissionMapTransform;\n varying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n uniform mat3 thicknessMapTransform;\n varying vec2 vThicknessMapUv;\n#endif",o$="#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n vUv = vec3( uv, 1 ).xy;\n#endif\n#ifdef USE_MAP\n vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ALPHAMAP\n vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_LIGHTMAP\n vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_AOMAP\n vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_BUMPMAP\n vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_NORMALMAP\n vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_EMISSIVEMAP\n vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_METALNESSMAP\n vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ROUGHNESSMAP\n vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ANISOTROPYMAP\n vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOATMAP\n vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULARMAP\n vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_THICKNESSMAP\n vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;\n#endif",a$="#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0\n vec4 worldPosition = vec4( transformed, 1.0 );\n #ifdef USE_INSTANCING\n worldPosition = instanceMatrix * worldPosition;\n #endif\n worldPosition = modelMatrix * worldPosition;\n#endif";const l$="varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n vUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n gl_Position = vec4( position.xy, 1.0, 1.0 );\n}",c$="uniform sampler2D t2D;\nuniform float backgroundIntensity;\nvarying vec2 vUv;\nvoid main() {\n vec4 texColor = texture2D( t2D, vUv );\n #ifdef DECODE_VIDEO_TEXTURE\n texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );\n #endif\n texColor.rgb *= backgroundIntensity;\n gl_FragColor = texColor;\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n}",u$="varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n vWorldDirection = transformDirection( position, modelMatrix );\n #include <begin_vertex>\n #include <project_vertex>\n gl_Position.z = gl_Position.w;\n}",h$="#ifdef ENVMAP_TYPE_CUBE\n uniform samplerCube envMap;\n#elif defined( ENVMAP_TYPE_CUBE_UV )\n uniform sampler2D envMap;\n#endif\nuniform float flipEnvMap;\nuniform float backgroundBlurriness;\nuniform float backgroundIntensity;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n #ifdef ENVMAP_TYPE_CUBE\n vec4 texColor = textureCube( envMap, vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );\n #elif defined( ENVMAP_TYPE_CUBE_UV )\n vec4 texColor = textureCubeUV( envMap, vWorldDirection, backgroundBlurriness );\n #else\n vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n #endif\n texColor.rgb *= backgroundIntensity;\n gl_FragColor = texColor;\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n}",d$="varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n vWorldDirection = transformDirection( position, modelMatrix );\n #include <begin_vertex>\n #include <project_vertex>\n gl_Position.z = gl_Position.w;\n}",f$="uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldDirection;\nvoid main() {\n vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n gl_FragColor = texColor;\n gl_FragColor.a *= opacity;\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n}",p$="#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n #include <uv_vertex>\n #include <skinbase_vertex>\n #ifdef USE_DISPLACEMENTMAP\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinnormal_vertex>\n #endif\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vHighPrecisionZW = gl_Position.zw;\n}",m$="#if DEPTH_PACKING == 3200\n uniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4( 1.0 );\n #if DEPTH_PACKING == 3200\n diffuseColor.a = opacity;\n #endif\n #include <map_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <logdepthbuf_fragment>\n float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n #if DEPTH_PACKING == 3200\n gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n #elif DEPTH_PACKING == 3201\n gl_FragColor = packDepthToRGBA( fragCoordZ );\n #endif\n}",g$="#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <skinbase_vertex>\n #ifdef USE_DISPLACEMENTMAP\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinnormal_vertex>\n #endif\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <worldpos_vertex>\n #include <clipping_planes_vertex>\n vWorldPosition = worldPosition.xyz;\n}",v$="#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4( 1.0 );\n #include <map_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n float dist = length( vWorldPosition - referencePosition );\n dist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n dist = saturate( dist );\n gl_FragColor = packDepthToRGBA( dist );\n}",_$="varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n vWorldDirection = transformDirection( position, modelMatrix );\n #include <begin_vertex>\n #include <project_vertex>\n}",y$="uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n vec3 direction = normalize( vWorldDirection );\n vec2 sampleUV = equirectUv( direction );\n gl_FragColor = texture2D( tEquirect, sampleUV );\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n}",b$="uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n vLineDistance = scale * lineDistance;\n #include <uv_vertex>\n #include <color_vertex>\n #include <morphcolor_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <fog_vertex>\n}",x$="uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n if ( mod( vLineDistance, totalSize ) > dashSize ) {\n discard;\n }\n vec3 outgoingLight = vec3( 0.0 );\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n outgoingLight = diffuseColor.rgb;\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n}",w$="#include <common>\n#include <uv_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <color_vertex>\n #include <morphcolor_vertex>\n #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #endif\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <worldpos_vertex>\n #include <envmap_vertex>\n #include <fog_vertex>\n}",S$="uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <specularmap_fragment>\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n #ifdef USE_LIGHTMAP\n vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n #else\n reflectedLight.indirectDiffuse += vec3( 1.0 );\n #endif\n #include <aomap_fragment>\n reflectedLight.indirectDiffuse *= diffuseColor.rgb;\n vec3 outgoingLight = reflectedLight.indirectDiffuse;\n #include <envmap_fragment>\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}",M$="#define LAMBERT\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <color_vertex>\n #include <morphcolor_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vViewPosition = - mvPosition.xyz;\n #include <worldpos_vertex>\n #include <envmap_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n}",E$="#define LAMBERT\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_lambert_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4( diffuse, opacity );\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <specularmap_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n #include <emissivemap_fragment>\n #include <lights_lambert_fragment>\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n #include <aomap_fragment>\n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n #include <envmap_fragment>\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}",T$="#define MATCAP\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <color_vertex>\n #include <morphcolor_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <fog_vertex>\n vViewPosition = - mvPosition.xyz;\n}",A$="#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n vec3 viewDir = normalize( vViewPosition );\n vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n vec3 y = cross( viewDir, x );\n vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n #ifdef USE_MATCAP\n vec4 matcapColor = texture2D( matcap, uv );\n #else\n vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\n #endif\n vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}",C$="#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n varying vec3 vViewPosition;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n vViewPosition = - mvPosition.xyz;\n#endif\n}",P$="#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n varying vec3 vViewPosition;\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n #include <logdepthbuf_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n gl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n #ifdef OPAQUE\n gl_FragColor.a = 1.0;\n #endif\n}",R$="#define PHONG\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <color_vertex>\n #include <morphcolor_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vViewPosition = - mvPosition.xyz;\n #include <worldpos_vertex>\n #include <envmap_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n}",L$="#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4( diffuse, opacity );\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <specularmap_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n #include <emissivemap_fragment>\n #include <lights_phong_fragment>\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n #include <aomap_fragment>\n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n #include <envmap_fragment>\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}",O$="#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n varying vec3 vWorldPosition;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <color_vertex>\n #include <morphcolor_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vViewPosition = - mvPosition.xyz;\n #include <worldpos_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n#ifdef USE_TRANSMISSION\n vWorldPosition = worldPosition.xyz;\n#endif\n}",I$="#define STANDARD\n#ifdef PHYSICAL\n #define IOR\n #define USE_SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n uniform float ior;\n#endif\n#ifdef USE_SPECULAR\n uniform float specularIntensity;\n uniform vec3 specularColor;\n #ifdef USE_SPECULAR_COLORMAP\n uniform sampler2D specularColorMap;\n #endif\n #ifdef USE_SPECULAR_INTENSITYMAP\n uniform sampler2D specularIntensityMap;\n #endif\n#endif\n#ifdef USE_CLEARCOAT\n uniform float clearcoat;\n uniform float clearcoatRoughness;\n#endif\n#ifdef USE_IRIDESCENCE\n uniform float iridescence;\n uniform float iridescenceIOR;\n uniform float iridescenceThicknessMinimum;\n uniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n uniform vec3 sheenColor;\n uniform float sheenRoughness;\n #ifdef USE_SHEEN_COLORMAP\n uniform sampler2D sheenColorMap;\n #endif\n #ifdef USE_SHEEN_ROUGHNESSMAP\n uniform sampler2D sheenRoughnessMap;\n #endif\n#endif\n#ifdef USE_ANISOTROPY\n uniform vec2 anisotropyVector;\n #ifdef USE_ANISOTROPYMAP\n uniform sampler2D anisotropyMap;\n #endif\n#endif\nvarying vec3 vViewPosition;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <iridescence_fragment>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_physical_pars_fragment>\n#include <transmission_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <iridescence_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4( diffuse, opacity );\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <roughnessmap_fragment>\n #include <metalnessmap_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n #include <clearcoat_normal_fragment_begin>\n #include <clearcoat_normal_fragment_maps>\n #include <emissivemap_fragment>\n #include <lights_physical_fragment>\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n #include <aomap_fragment>\n vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n #include <transmission_fragment>\n vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n #ifdef USE_SHEEN\n float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\n outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect;\n #endif\n #ifdef USE_CLEARCOAT\n float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );\n vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;\n #endif\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}",D$="#define TOON\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <color_vertex>\n #include <morphcolor_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vViewPosition = - mvPosition.xyz;\n #include <worldpos_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n}",U$="#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_toon_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4( diffuse, opacity );\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n #include <emissivemap_fragment>\n #include <lights_toon_fragment>\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n #include <aomap_fragment>\n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}",N$="uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n#ifdef USE_POINTS_UV\n varying vec2 vUv;\n uniform mat3 uvTransform;\n#endif\nvoid main() {\n #ifdef USE_POINTS_UV\n vUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n #endif\n #include <color_vertex>\n #include <morphcolor_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <project_vertex>\n gl_PointSize = size;\n #ifdef USE_SIZEATTENUATION\n bool isPerspective = isPerspectiveMatrix( projectionMatrix );\n if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n #endif\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <worldpos_vertex>\n #include <fog_vertex>\n}",F$="uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n vec3 outgoingLight = vec3( 0.0 );\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <logdepthbuf_fragment>\n #include <map_particle_fragment>\n #include <color_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n outgoingLight = diffuseColor.rgb;\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n}",k$="#include <common>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <worldpos_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n}",B$="uniform vec3 color;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <logdepthbuf_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n #include <logdepthbuf_fragment>\n gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n}",z$="uniform float rotation;\nuniform vec2 center;\n#include <common>\n#include <uv_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n vec2 scale;\n scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n #ifndef USE_SIZEATTENUATION\n bool isPerspective = isPerspectiveMatrix( projectionMatrix );\n if ( isPerspective ) scale *= - mvPosition.z;\n #endif\n vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n vec2 rotatedPosition;\n rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n mvPosition.xy += rotatedPosition;\n gl_Position = projectionMatrix * mvPosition;\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <fog_vertex>\n}",V$="uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n vec3 outgoingLight = vec3( 0.0 );\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n outgoingLight = diffuseColor.rgb;\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n}",lt={alphahash_fragment:hW,alphahash_pars_fragment:dW,alphamap_fragment:fW,alphamap_pars_fragment:pW,alphatest_fragment:mW,alphatest_pars_fragment:gW,aomap_fragment:vW,aomap_pars_fragment:_W,begin_vertex:yW,beginnormal_vertex:bW,bsdfs:xW,iridescence_fragment:wW,bumpmap_pars_fragment:SW,clipping_planes_fragment:MW,clipping_planes_pars_fragment:EW,clipping_planes_pars_vertex:TW,clipping_planes_vertex:AW,color_fragment:CW,color_pars_fragment:PW,color_pars_vertex:RW,color_vertex:LW,common:OW,cube_uv_reflection_fragment:IW,defaultnormal_vertex:DW,displacementmap_pars_vertex:UW,displacementmap_vertex:NW,emissivemap_fragment:FW,emissivemap_pars_fragment:kW,colorspace_fragment:BW,colorspace_pars_fragment:zW,envmap_fragment:VW,envmap_common_pars_fragment:HW,envmap_pars_fragment:GW,envmap_pars_vertex:WW,envmap_physical_pars_fragment:n9,envmap_vertex:$W,fog_vertex:jW,fog_pars_vertex:XW,fog_fragment:YW,fog_pars_fragment:qW,gradientmap_pars_fragment:KW,lightmap_fragment:ZW,lightmap_pars_fragment:JW,lights_lambert_fragment:QW,lights_lambert_pars_fragment:e9,lights_pars_begin:t9,lights_toon_fragment:i9,lights_toon_pars_fragment:r9,lights_phong_fragment:s9,lights_phong_pars_fragment:o9,lights_physical_fragment:a9,lights_physical_pars_fragment:l9,lights_fragment_begin:c9,lights_fragment_maps:u9,lights_fragment_end:h9,logdepthbuf_fragment:d9,logdepthbuf_pars_fragment:f9,logdepthbuf_pars_vertex:p9,logdepthbuf_vertex:m9,map_fragment:g9,map_pars_fragment:v9,map_particle_fragment:_9,map_particle_pars_fragment:y9,metalnessmap_fragment:b9,metalnessmap_pars_fragment:x9,morphcolor_vertex:w9,morphnormal_vertex:S9,morphtarget_pars_vertex:M9,morphtarget_vertex:E9,normal_fragment_begin:T9,normal_fragment_maps:A9,normal_pars_fragment:C9,normal_pars_vertex:P9,normal_vertex:R9,normalmap_pars_fragment:L9,clearcoat_normal_fragment_begin:O9,clearcoat_normal_fragment_maps:I9,clearcoat_pars_fragment:D9,iridescence_pars_fragment:U9,opaque_fragment:N9,packing:F9,premultiplied_alpha_fragment:k9,project_vertex:B9,dithering_fragment:z9,dithering_pars_fragment:V9,roughnessmap_fragment:H9,roughnessmap_pars_fragment:G9,shadowmap_pars_fragment:W9,shadowmap_pars_vertex:$9,shadowmap_vertex:j9,shadowmask_pars_fragment:X9,skinbase_vertex:Y9,skinning_pars_vertex:q9,skinning_vertex:K9,skinnormal_vertex:Z9,specularmap_fragment:J9,specularmap_pars_fragment:Q9,tonemapping_fragment:e$,tonemapping_pars_fragment:t$,transmission_fragment:n$,transmission_pars_fragment:i$,uv_pars_fragment:r$,uv_pars_vertex:s$,uv_vertex:o$,worldpos_vertex:a$,background_vert:l$,background_frag:c$,backgroundCube_vert:u$,backgroundCube_frag:h$,cube_vert:d$,cube_frag:f$,depth_vert:p$,depth_frag:m$,distanceRGBA_vert:g$,distanceRGBA_frag:v$,equirect_vert:_$,equirect_frag:y$,linedashed_vert:b$,linedashed_frag:x$,meshbasic_vert:w$,meshbasic_frag:S$,meshlambert_vert:M$,meshlambert_frag:E$,meshmatcap_vert:T$,meshmatcap_frag:A$,meshnormal_vert:C$,meshnormal_frag:P$,meshphong_vert:R$,meshphong_frag:L$,meshphysical_vert:O$,meshphysical_frag:I$,meshtoon_vert:D$,meshtoon_frag:U$,points_vert:N$,points_frag:F$,shadow_vert:k$,shadow_frag:B$,sprite_vert:z$,sprite_frag:V$},Ue={common:{diffuse:{value:new Pe(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new ut},alphaMap:{value:null},alphaMapTransform:{value:new ut},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new ut}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new ut}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new ut}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new ut},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new ut},normalScale:{value:new _e(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new ut},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new ut}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new ut}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new ut}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Pe(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new Pe(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new ut},alphaTest:{value:0},uvTransform:{value:new ut}},sprite:{diffuse:{value:new Pe(16777215)},opacity:{value:1},center:{value:new _e(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new ut},alphaMap:{value:null},alphaMapTransform:{value:new ut},alphaTest:{value:0}}},er={basic:{uniforms:oi([Ue.common,Ue.specularmap,Ue.envmap,Ue.aomap,Ue.lightmap,Ue.fog]),vertexShader:lt.meshbasic_vert,fragmentShader:lt.meshbasic_frag},lambert:{uniforms:oi([Ue.common,Ue.specularmap,Ue.envmap,Ue.aomap,Ue.lightmap,Ue.emissivemap,Ue.bumpmap,Ue.normalmap,Ue.displacementmap,Ue.fog,Ue.lights,{emissive:{value:new Pe(0)}}]),vertexShader:lt.meshlambert_vert,fragmentShader:lt.meshlambert_frag},phong:{uniforms:oi([Ue.common,Ue.specularmap,Ue.envmap,Ue.aomap,Ue.lightmap,Ue.emissivemap,Ue.bumpmap,Ue.normalmap,Ue.displacementmap,Ue.fog,Ue.lights,{emissive:{value:new Pe(0)},specular:{value:new Pe(1118481)},shininess:{value:30}}]),vertexShader:lt.meshphong_vert,fragmentShader:lt.meshphong_frag},standard:{uniforms:oi([Ue.common,Ue.envmap,Ue.aomap,Ue.lightmap,Ue.emissivemap,Ue.bumpmap,Ue.normalmap,Ue.displacementmap,Ue.roughnessmap,Ue.metalnessmap,Ue.fog,Ue.lights,{emissive:{value:new Pe(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:lt.meshphysical_vert,fragmentShader:lt.meshphysical_frag},toon:{uniforms:oi([Ue.common,Ue.aomap,Ue.lightmap,Ue.emissivemap,Ue.bumpmap,Ue.normalmap,Ue.displacementmap,Ue.gradientmap,Ue.fog,Ue.lights,{emissive:{value:new Pe(0)}}]),vertexShader:lt.meshtoon_vert,fragmentShader:lt.meshtoon_frag},matcap:{uniforms:oi([Ue.common,Ue.bumpmap,Ue.normalmap,Ue.displacementmap,Ue.fog,{matcap:{value:null}}]),vertexShader:lt.meshmatcap_vert,fragmentShader:lt.meshmatcap_frag},points:{uniforms:oi([Ue.points,Ue.fog]),vertexShader:lt.points_vert,fragmentShader:lt.points_frag},dashed:{uniforms:oi([Ue.common,Ue.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:lt.linedashed_vert,fragmentShader:lt.linedashed_frag},depth:{uniforms:oi([Ue.common,Ue.displacementmap]),vertexShader:lt.depth_vert,fragmentShader:lt.depth_frag},normal:{uniforms:oi([Ue.common,Ue.bumpmap,Ue.normalmap,Ue.displacementmap,{opacity:{value:1}}]),vertexShader:lt.meshnormal_vert,fragmentShader:lt.meshnormal_frag},sprite:{uniforms:oi([Ue.sprite,Ue.fog]),vertexShader:lt.sprite_vert,fragmentShader:lt.sprite_frag},background:{uniforms:{uvTransform:{value:new ut},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:lt.background_vert,fragmentShader:lt.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1}},vertexShader:lt.backgroundCube_vert,fragmentShader:lt.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:lt.cube_vert,fragmentShader:lt.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:lt.equirect_vert,fragmentShader:lt.equirect_frag},distanceRGBA:{uniforms:oi([Ue.common,Ue.displacementmap,{referencePosition:{value:new D},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:lt.distanceRGBA_vert,fragmentShader:lt.distanceRGBA_frag},shadow:{uniforms:oi([Ue.lights,Ue.fog,{color:{value:new Pe(0)},opacity:{value:1}}]),vertexShader:lt.shadow_vert,fragmentShader:lt.shadow_frag}};er.physical={uniforms:oi([er.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new ut},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new ut},clearcoatNormalScale:{value:new _e(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new ut},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new ut},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new ut},sheen:{value:0},sheenColor:{value:new Pe(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new ut},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new ut},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new ut},transmissionSamplerSize:{value:new _e},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new ut},attenuationDistance:{value:0},attenuationColor:{value:new Pe(0)},specularColor:{value:new Pe(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new ut},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new ut},anisotropyVector:{value:new _e},anisotropyMap:{value:null},anisotropyMapTransform:{value:new ut}}]),vertexShader:lt.meshphysical_vert,fragmentShader:lt.meshphysical_frag};const yf={r:0,b:0,g:0};function H$(n,e,t,i,r,s,o){const a=new Pe(0);let l=s===!0?0:1,c,u,h=null,d=0,f=null;function p(m,g){let b=!1,_=g.isScene===!0?g.background:null;_&&_.isTexture&&(_=(g.backgroundBlurriness>0?t:e).get(_)),_===null?v(a,l):_&&_.isColor&&(v(_,1),b=!0);const y=n.xr.getEnvironmentBlendMode();y==="additive"?i.buffers.color.setClear(0,0,0,1,o):y==="alpha-blend"&&i.buffers.color.setClear(0,0,0,0,o),(n.autoClear||b)&&n.clear(n.autoClearColor,n.autoClearDepth,n.autoClearStencil),_&&(_.isCubeTexture||_.mapping===Hc)?(u===void 0&&(u=new Be(new ai(1,1,1),new cr({name:"BackgroundCubeMaterial",uniforms:Lc(er.backgroundCube.uniforms),vertexShader:er.backgroundCube.vertexShader,fragmentShader:er.backgroundCube.fragmentShader,side:Qn,depthTest:!1,depthWrite:!1,fog:!1})),u.geometry.deleteAttribute("normal"),u.geometry.deleteAttribute("uv"),u.onBeforeRender=function(T,S,E){this.matrixWorld.copyPosition(E.matrixWorld)},Object.defineProperty(u.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(u)),u.material.uniforms.envMap.value=_,u.material.uniforms.flipEnvMap.value=_.isCubeTexture&&_.isRenderTargetTexture===!1?-1:1,u.material.uniforms.backgroundBlurriness.value=g.backgroundBlurriness,u.material.uniforms.backgroundIntensity.value=g.backgroundIntensity,u.material.toneMapped=Ut.getTransfer(_.colorSpace)!==Ht,(h!==_||d!==_.version||f!==n.toneMapping)&&(u.material.needsUpdate=!0,h=_,d=_.version,f=n.toneMapping),u.layers.enableAll(),m.unshift(u,u.geometry,u.material,0,0,null)):_&&_.isTexture&&(c===void 0&&(c=new Be(new Ni(2,2),new cr({name:"BackgroundMaterial",uniforms:Lc(er.background.uniforms),vertexShader:er.background.vertexShader,fragmentShader:er.background.fragmentShader,side:ns,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(c)),c.material.uniforms.t2D.value=_,c.material.uniforms.backgroundIntensity.value=g.backgroundIntensity,c.material.toneMapped=Ut.getTransfer(_.colorSpace)!==Ht,_.matrixAutoUpdate===!0&&_.updateMatrix(),c.material.uniforms.uvTransform.value.copy(_.matrix),(h!==_||d!==_.version||f!==n.toneMapping)&&(c.material.needsUpdate=!0,h=_,d=_.version,f=n.toneMapping),c.layers.enableAll(),m.unshift(c,c.geometry,c.material,0,0,null))}function v(m,g){m.getRGB(yf,BP(n)),i.buffers.color.setClear(yf.r,yf.g,yf.b,g,o)}return{getClearColor:function(){return a},setClearColor:function(m,g=1){a.set(m),l=g,v(a,l)},getClearAlpha:function(){return l},setClearAlpha:function(m){l=m,v(a,l)},render:p}}function G$(n,e,t,i){const r=n.getParameter(n.MAX_VERTEX_ATTRIBS),s=i.isWebGL2?null:e.get("OES_vertex_array_object"),o=i.isWebGL2||s!==null,a={},l=m(null);let c=l,u=!1;function h(U,H,V,j,te){let Z=!1;if(o){const Q=v(j,V,H);c!==Q&&(c=Q,f(c.object)),Z=g(U,j,V,te),Z&&b(U,j,V,te)}else{const Q=H.wireframe===!0;(c.geometry!==j.id||c.program!==V.id||c.wireframe!==Q)&&(c.geometry=j.id,c.program=V.id,c.wireframe=Q,Z=!0)}te!==null&&t.update(te,n.ELEMENT_ARRAY_BUFFER),(Z||u)&&(u=!1,x(U,H,V,j),te!==null&&n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,t.get(te).buffer))}function d(){return i.isWebGL2?n.createVertexArray():s.createVertexArrayOES()}function f(U){return i.isWebGL2?n.bindVertexArray(U):s.bindVertexArrayOES(U)}function p(U){return i.isWebGL2?n.deleteVertexArray(U):s.deleteVertexArrayOES(U)}function v(U,H,V){const j=V.wireframe===!0;let te=a[U.id];te===void 0&&(te={},a[U.id]=te);let Z=te[H.id];Z===void 0&&(Z={},te[H.id]=Z);let Q=Z[j];return Q===void 0&&(Q=m(d()),Z[j]=Q),Q}function m(U){const H=[],V=[],j=[];for(let te=0;te<r;te++)H[te]=0,V[te]=0,j[te]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:H,enabledAttributes:V,attributeDivisors:j,object:U,attributes:{},index:null}}function g(U,H,V,j){const te=c.attributes,Z=H.attributes;let Q=0;const X=V.getAttributes();for(const re in X)if(X[re].location>=0){const we=te[re];let Re=Z[re];if(Re===void 0&&(re==="instanceMatrix"&&U.instanceMatrix&&(Re=U.instanceMatrix),re==="instanceColor"&&U.instanceColor&&(Re=U.instanceColor)),we===void 0||we.attribute!==Re||Re&&we.data!==Re.data)return!0;Q++}return c.attributesNum!==Q||c.index!==j}function b(U,H,V,j){const te={},Z=H.attributes;let Q=0;const X=V.getAttributes();for(const re in X)if(X[re].location>=0){let we=Z[re];we===void 0&&(re==="instanceMatrix"&&U.instanceMatrix&&(we=U.instanceMatrix),re==="instanceColor"&&U.instanceColor&&(we=U.instanceColor));const Re={};Re.attribute=we,we&&we.data&&(Re.data=we.data),te[re]=Re,Q++}c.attributes=te,c.attributesNum=Q,c.index=j}function _(){const U=c.newAttributes;for(let H=0,V=U.length;H<V;H++)U[H]=0}function y(U){T(U,0)}function T(U,H){const V=c.newAttributes,j=c.enabledAttributes,te=c.attributeDivisors;V[U]=1,j[U]===0&&(n.enableVertexAttribArray(U),j[U]=1),te[U]!==H&&((i.isWebGL2?n:e.get("ANGLE_instanced_arrays"))[i.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](U,H),te[U]=H)}function S(){const U=c.newAttributes,H=c.enabledAttributes;for(let V=0,j=H.length;V<j;V++)H[V]!==U[V]&&(n.disableVertexAttribArray(V),H[V]=0)}function E(U,H,V,j,te,Z,Q){Q===!0?n.vertexAttribIPointer(U,H,V,te,Z):n.vertexAttribPointer(U,H,V,j,te,Z)}function x(U,H,V,j){if(i.isWebGL2===!1&&(U.isInstancedMesh||j.isInstancedBufferGeometry)&&e.get("ANGLE_instanced_arrays")===null)return;_();const te=j.attributes,Z=V.getAttributes(),Q=H.defaultAttributeValues;for(const X in Z){const re=Z[X];if(re.location>=0){let W=te[X];if(W===void 0&&(X==="instanceMatrix"&&U.instanceMatrix&&(W=U.instanceMatrix),X==="instanceColor"&&U.instanceColor&&(W=U.instanceColor)),W!==void 0){const we=W.normalized,Re=W.itemSize,De=t.get(W);if(De===void 0)continue;const ne=De.buffer,q=De.type,P=De.bytesPerElement,N=i.isWebGL2===!0&&(q===n.INT||q===n.UNSIGNED_INT||W.gpuType===Qy);if(W.isInterleavedBufferAttribute){const B=W.data,A=B.stride,R=W.offset;if(B.isInstancedInterleavedBuffer){for(let I=0;I<re.locationSize;I++)T(re.location+I,B.meshPerAttribute);U.isInstancedMesh!==!0&&j._maxInstanceCount===void 0&&(j._maxInstanceCount=B.meshPerAttribute*B.count)}else for(let I=0;I<re.locationSize;I++)y(re.location+I);n.bindBuffer(n.ARRAY_BUFFER,ne);for(let I=0;I<re.locationSize;I++)E(re.location+I,Re/re.locationSize,q,we,A*P,(R+Re/re.locationSize*I)*P,N)}else{if(W.isInstancedBufferAttribute){for(let B=0;B<re.locationSize;B++)T(re.location+B,W.meshPerAttribute);U.isInstancedMesh!==!0&&j._maxInstanceCount===void 0&&(j._maxInstanceCount=W.meshPerAttribute*W.count)}else for(let B=0;B<re.locationSize;B++)y(re.location+B);n.bindBuffer(n.ARRAY_BUFFER,ne);for(let B=0;B<re.locationSize;B++)E(re.location+B,Re/re.locationSize,q,we,Re*P,Re/re.locationSize*B*P,N)}}else if(Q!==void 0){const we=Q[X];if(we!==void 0)switch(we.length){case 2:n.vertexAttrib2fv(re.location,we);break;case 3:n.vertexAttrib3fv(re.location,we);break;case 4:n.vertexAttrib4fv(re.location,we);break;default:n.vertexAttrib1fv(re.location,we)}}}}S()}function M(){L();for(const U in a){const H=a[U];for(const V in H){const j=H[V];for(const te in j)p(j[te].object),delete j[te];delete H[V]}delete a[U]}}function w(U){if(a[U.id]===void 0)return;const H=a[U.id];for(const V in H){const j=H[V];for(const te in j)p(j[te].object),delete j[te];delete H[V]}delete a[U.id]}function C(U){for(const H in a){const V=a[H];if(V[U.id]===void 0)continue;const j=V[U.id];for(const te in j)p(j[te].object),delete j[te];delete V[U.id]}}function L(){$(),u=!0,c!==l&&(c=l,f(c.object))}function $(){l.geometry=null,l.program=null,l.wireframe=!1}return{setup:h,reset:L,resetDefaultState:$,dispose:M,releaseStatesOfGeometry:w,releaseStatesOfProgram:C,initAttributes:_,enableAttribute:y,disableUnusedAttributes:S}}function W$(n,e,t,i){const r=i.isWebGL2;let s;function o(c){s=c}function a(c,u){n.drawArrays(s,c,u),t.update(u,s,1)}function l(c,u,h){if(h===0)return;let d,f;if(r)d=n,f="drawArraysInstanced";else if(d=e.get("ANGLE_instanced_arrays"),f="drawArraysInstancedANGLE",d===null){console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}d[f](s,c,u,h),t.update(u,s,h)}this.setMode=o,this.render=a,this.renderInstances=l}function $$(n,e,t){let i;function r(){if(i!==void 0)return i;if(e.has("EXT_texture_filter_anisotropic")===!0){const E=e.get("EXT_texture_filter_anisotropic");i=n.getParameter(E.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else i=0;return i}function s(E){if(E==="highp"){if(n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_FLOAT).precision>0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT).precision>0)return"highp";E="mediump"}return E==="mediump"&&n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_FLOAT).precision>0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}const o=typeof WebGL2RenderingContext<"u"&&n.constructor.name==="WebGL2RenderingContext";let a=t.precision!==void 0?t.precision:"highp";const l=s(a);l!==a&&(console.warn("THREE.WebGLRenderer:",a,"not supported, using",l,"instead."),a=l);const c=o||e.has("WEBGL_draw_buffers"),u=t.logarithmicDepthBuffer===!0,h=n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS),d=n.getParameter(n.MAX_VERTEX_TEXTURE_IMAGE_UNITS),f=n.getParameter(n.MAX_TEXTURE_SIZE),p=n.getParameter(n.MAX_CUBE_MAP_TEXTURE_SIZE),v=n.getParameter(n.MAX_VERTEX_ATTRIBS),m=n.getParameter(n.MAX_VERTEX_UNIFORM_VECTORS),g=n.getParameter(n.MAX_VARYING_VECTORS),b=n.getParameter(n.MAX_FRAGMENT_UNIFORM_VECTORS),_=d>0,y=o||e.has("OES_texture_float"),T=_&&y,S=o?n.getParameter(n.MAX_SAMPLES):0;return{isWebGL2:o,drawBuffers:c,getMaxAnisotropy:r,getMaxPrecision:s,precision:a,logarithmicDepthBuffer:u,maxTextures:h,maxVertexTextures:d,maxTextureSize:f,maxCubemapSize:p,maxAttributes:v,maxVertexUniforms:m,maxVaryings:g,maxFragmentUniforms:b,vertexTextures:_,floatFragmentTextures:y,floatVertexTextures:T,maxSamples:S}}function j$(n){const e=this;let t=null,i=0,r=!1,s=!1;const o=new Ms,a=new ut,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(h,d){const f=h.length!==0||d||i!==0||r;return r=d,i=h.length,f},this.beginShadows=function(){s=!0,u(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(h,d){t=u(h,d,0)},this.setState=function(h,d,f){const p=h.clippingPlanes,v=h.clipIntersection,m=h.clipShadows,g=n.get(h);if(!r||p===null||p.length===0||s&&!m)s?u(null):c();else{const b=s?0:i,_=b*4;let y=g.clippingState||null;l.value=y,y=u(p,d,_,f);for(let T=0;T!==_;++T)y[T]=t[T];g.clippingState=y,this.numIntersection=v?this.numPlanes:0,this.numPlanes+=b}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=i>0),e.numPlanes=i,e.numIntersection=0}function u(h,d,f,p){const v=h!==null?h.length:0;let m=null;if(v!==0){if(m=l.value,p!==!0||m===null){const g=f+v*4,b=d.matrixWorldInverse;a.getNormalMatrix(b),(m===null||m.length<g)&&(m=new Float32Array(g));for(let _=0,y=f;_!==v;++_,y+=4)o.copy(h[_]).applyMatrix4(b,a),o.normal.toArray(m,y),m[y+3]=o.constant}l.value=m,l.needsUpdate=!0}return e.numPlanes=v,e.numIntersection=0,m}}function X$(n){let e=new WeakMap;function t(o,a){return a===Tc?o.mapping=Ns:a===Oh&&(o.mapping=Fo),o}function i(o){if(o&&o.isTexture&&o.isRenderTargetTexture===!1){const a=o.mapping;if(a===Tc||a===Oh)if(e.has(o)){const l=e.get(o).texture;return t(l,o.mapping)}else{const l=o.image;if(l&&l.height>0){const c=new VP(l.height/2);return c.fromEquirectangularTexture(n,o),e.set(o,c),o.addEventListener("dispose",r),t(c.texture,o.mapping)}else return null}}return o}function r(o){const a=o.target;a.removeEventListener("dispose",r);const l=e.get(a);l!==void 0&&(e.delete(a),l.dispose())}function s(){e=new WeakMap}return{get:i,dispose:s}}class zi extends fd{constructor(e=-1,t=1,i=1,r=-1,s=.1,o=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=i,this.bottom=r,this.near=s,this.far=o,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,i,r,s,o){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=r,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),i=(this.right+this.left)/2,r=(this.top+this.bottom)/2;let s=i-e,o=i+e,a=r+t,l=r-t;if(this.view!==null&&this.view.enabled){const c=(this.right-this.left)/this.view.fullWidth/this.zoom,u=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=c*this.view.offsetX,o=s+c*this.view.width,a-=u*this.view.offsetY,l=a-u*this.view.height}this.projectionMatrix.makeOrthographic(s,o,a,l,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}}const Jl=4,XS=[.125,.215,.35,.446,.526,.582],_a=20,ov=new zi,YS=new Pe;let av=null,lv=0,cv=0;const ma=(1+Math.sqrt(5))/2,Ll=1/ma,qS=[new D(1,1,1),new D(-1,1,1),new D(1,1,-1),new D(-1,1,-1),new D(0,ma,Ll),new D(0,ma,-Ll),new D(Ll,0,ma),new D(-Ll,0,ma),new D(ma,Ll,0),new D(-ma,Ll,0)];class p_{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,i=.1,r=100){av=this._renderer.getRenderTarget(),lv=this._renderer.getActiveCubeFace(),cv=this._renderer.getActiveMipmapLevel(),this._setSize(256);const s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(e,i,r,s),t>0&&this._blur(s,0,0,t),this._applyPMREM(s),this._cleanup(s),s}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=JS(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=ZS(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodPlanes.length;e++)this._lodPlanes[e].dispose()}_cleanup(e){this._renderer.setRenderTarget(av,lv,cv),e.scissorTest=!1,bf(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===Ns||e.mapping===Fo?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),av=this._renderer.getRenderTarget(),lv=this._renderer.getActiveCubeFace(),cv=this._renderer.getActiveMipmapLevel();const i=t||this._allocateTargets();return this._textureToCubeUV(e,i),this._applyPMREM(i),this._cleanup(i),i}_allocateTargets(){const e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,i={magFilter:rn,minFilter:rn,generateMipmaps:!1,type:Cc,format:ki,colorSpace:ss,depthBuffer:!1},r=KS(e,t,i);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=KS(e,t,i);const{_lodMax:s}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=Y$(s)),this._blurMaterial=q$(s,e,t)}return r}_compileMaterial(e){const t=new Be(this._lodPlanes[0],e);this._renderer.compile(t,ov)}_sceneToCubeUV(e,t,i,r){const a=new Nt(90,1,t,i),l=[1,-1,1,1,1,1],c=[1,1,1,-1,-1,-1],u=this._renderer,h=u.autoClear,d=u.toneMapping;u.getClearColor(YS),u.toneMapping=Rs,u.autoClear=!1;const f=new Jn({name:"PMREM.Background",side:Qn,depthWrite:!1,depthTest:!1}),p=new Be(new ai,f);let v=!1;const m=e.background;m?m.isColor&&(f.color.copy(m),e.background=null,v=!0):(f.color.copy(YS),v=!0);for(let g=0;g<6;g++){const b=g%3;b===0?(a.up.set(0,l[g],0),a.lookAt(c[g],0,0)):b===1?(a.up.set(0,0,l[g]),a.lookAt(0,c[g],0)):(a.up.set(0,l[g],0),a.lookAt(0,0,c[g]));const _=this._cubeSize;bf(r,b*_,g>2?_:0,_,_),u.setRenderTarget(r),v&&u.render(p,a),u.render(e,a)}p.geometry.dispose(),p.material.dispose(),u.toneMapping=d,u.autoClear=h,e.background=m}_textureToCubeUV(e,t){const i=this._renderer,r=e.mapping===Ns||e.mapping===Fo;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=JS()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=ZS());const s=r?this._cubemapMaterial:this._equirectMaterial,o=new Be(this._lodPlanes[0],s),a=s.uniforms;a.envMap.value=e;const l=this._cubeSize;bf(t,0,0,3*l,2*l),i.setRenderTarget(t),i.render(o,ov)}_applyPMREM(e){const t=this._renderer,i=t.autoClear;t.autoClear=!1;for(let r=1;r<this._lodPlanes.length;r++){const s=Math.sqrt(this._sigmas[r]*this._sigmas[r]-this._sigmas[r-1]*this._sigmas[r-1]),o=qS[(r-1)%qS.length];this._blur(e,r-1,r,s,o)}t.autoClear=i}_blur(e,t,i,r,s){const o=this._pingPongRenderTarget;this._halfBlur(e,o,t,i,r,"latitudinal",s),this._halfBlur(o,e,i,i,r,"longitudinal",s)}_halfBlur(e,t,i,r,s,o,a){const l=this._renderer,c=this._blurMaterial;o!=="latitudinal"&&o!=="longitudinal"&&console.error("blur direction must be either latitudinal or longitudinal!");const u=3,h=new Be(this._lodPlanes[r],c),d=c.uniforms,f=this._sizeLods[i]-1,p=isFinite(s)?Math.PI/(2*f):2*Math.PI/(2*_a-1),v=s/p,m=isFinite(s)?1+Math.floor(u*v):_a;m>_a&&console.warn("sigmaRadians, ".concat(s,", is too large and will clip, as it requested ").concat(m," samples when the maximum is set to ").concat(_a));const g=[];let b=0;for(let E=0;E<_a;++E){const x=E/v,M=Math.exp(-x*x/2);g.push(M),E===0?b+=M:E<m&&(b+=2*M)}for(let E=0;E<g.length;E++)g[E]=g[E]/b;d.envMap.value=e.texture,d.samples.value=m,d.weights.value=g,d.latitudinal.value=o==="latitudinal",a&&(d.poleAxis.value=a);const{_lodMax:_}=this;d.dTheta.value=p,d.mipInt.value=_-i;const y=this._sizeLods[r],T=3*y*(r>_-Jl?r-_+Jl:0),S=4*(this._cubeSize-y);bf(t,T,S,3*y,2*y),l.setRenderTarget(t),l.render(h,ov)}}function Y$(n){const e=[],t=[],i=[];let r=n;const s=n-Jl+1+XS.length;for(let o=0;o<s;o++){const a=Math.pow(2,r);t.push(a);let l=1/a;o>n-Jl?l=XS[o-n+Jl-1]:o===0&&(l=0),i.push(l);const c=1/(a-2),u=-c,h=1+c,d=[u,u,h,u,h,h,u,u,h,h,u,h],f=6,p=6,v=3,m=2,g=1,b=new Float32Array(v*p*f),_=new Float32Array(m*p*f),y=new Float32Array(g*p*f);for(let S=0;S<f;S++){const E=S%3*2/3-1,x=S>2?0:-1,M=[E,x,0,E+2/3,x,0,E+2/3,x+1,0,E,x,0,E+2/3,x+1,0,E,x+1,0];b.set(M,v*p*S),_.set(d,m*p*S);const w=[S,S,S,S,S,S];y.set(w,g*p*S)}const T=new qe;T.setAttribute("position",new At(b,v)),T.setAttribute("uv",new At(_,m)),T.setAttribute("faceIndex",new At(y,g)),e.push(T),r>Jl&&r--}return{lodPlanes:e,sizeLods:t,sigmas:i}}function KS(n,e,t){const i=new Lr(n,e,t);return i.texture.mapping=Hc,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function bf(n,e,t,i,r){n.viewport.set(e,t,i,r),n.scissor.set(e,t,i,r)}function q$(n,e,t){const i=new Float32Array(_a),r=new D(0,1,0);return new cr({name:"SphericalGaussianBlur",defines:{n:_a,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:"".concat(n,".0")},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:db(),fragmentShader:"\n\n precision mediump float;\n precision mediump int;\n\n varying vec3 vOutputDirection;\n\n uniform sampler2D envMap;\n uniform int samples;\n uniform float weights[ n ];\n uniform bool latitudinal;\n uniform float dTheta;\n uniform float mipInt;\n uniform vec3 poleAxis;\n\n #define ENVMAP_TYPE_CUBE_UV\n #include <cube_uv_reflection_fragment>\n\n vec3 getSample( float theta, vec3 axis ) {\n\n float cosTheta = cos( theta );\n // Rodrigues' axis-angle rotation\n vec3 sampleDirection = vOutputDirection * cosTheta\n + cross( axis, vOutputDirection ) * sin( theta )\n + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n return bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n }\n\n void main() {\n\n vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n if ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n }\n\n axis = normalize( axis );\n\n gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n for ( int i = 1; i < n; i++ ) {\n\n if ( i >= samples ) {\n\n break;\n\n }\n\n float theta = dTheta * float( i );\n gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n }\n\n }\n ",blending:Ps,depthTest:!1,depthWrite:!1})}function ZS(){return new cr({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:db(),fragmentShader:"\n\n precision mediump float;\n precision mediump int;\n\n varying vec3 vOutputDirection;\n\n uniform sampler2D envMap;\n\n #include <common>\n\n void main() {\n\n vec3 outputDirection = normalize( vOutputDirection );\n vec2 uv = equirectUv( outputDirection );\n\n gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );\n\n }\n ",blending:Ps,depthTest:!1,depthWrite:!1})}function JS(){return new cr({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:db(),fragmentShader:"\n\n precision mediump float;\n precision mediump int;\n\n uniform float flipEnvMap;\n\n varying vec3 vOutputDirection;\n\n uniform samplerCube envMap;\n\n void main() {\n\n gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );\n\n }\n ",blending:Ps,depthTest:!1,depthWrite:!1})}function db(){return"\n\n precision mediump float;\n precision mediump int;\n\n attribute float faceIndex;\n\n varying vec3 vOutputDirection;\n\n // RH coordinate system; PMREM face-indexing convention\n vec3 getDirection( vec2 uv, float face ) {\n\n uv = 2.0 * uv - 1.0;\n\n vec3 direction = vec3( uv, 1.0 );\n\n if ( face == 0.0 ) {\n\n direction = direction.zyx; // ( 1, v, u ) pos x\n\n } else if ( face == 1.0 ) {\n\n direction = direction.xzy;\n direction.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n } else if ( face == 2.0 ) {\n\n direction.x *= -1.0; // ( -u, v, 1 ) pos z\n\n } else if ( face == 3.0 ) {\n\n direction = direction.zyx;\n direction.xz *= -1.0; // ( -1, v, -u ) neg x\n\n } else if ( face == 4.0 ) {\n\n direction = direction.xzy;\n direction.xy *= -1.0; // ( -u, -1, v ) neg y\n\n } else if ( face == 5.0 ) {\n\n direction.z *= -1.0; // ( u, v, -1 ) neg z\n\n }\n\n return direction;\n\n }\n\n void main() {\n\n vOutputDirection = getDirection( uv, faceIndex );\n gl_Position = vec4( position, 1.0 );\n\n }\n "}function K$(n){let e=new WeakMap,t=null;function i(a){if(a&&a.isTexture){const l=a.mapping,c=l===Tc||l===Oh,u=l===Ns||l===Fo;if(c||u)if(a.isRenderTargetTexture&&a.needsPMREMUpdate===!0){a.needsPMREMUpdate=!1;let h=e.get(a);return t===null&&(t=new p_(n)),h=c?t.fromEquirectangular(a,h):t.fromCubemap(a,h),e.set(a,h),h.texture}else{if(e.has(a))return e.get(a).texture;{const h=a.image;if(c&&h&&h.height>0||u&&h&&r(h)){t===null&&(t=new p_(n));const d=c?t.fromEquirectangular(a):t.fromCubemap(a);return e.set(a,d),a.addEventListener("dispose",s),d.texture}else return null}}}return a}function r(a){let l=0;const c=6;for(let u=0;u<c;u++)a[u]!==void 0&&l++;return l===c}function s(a){const l=a.target;l.removeEventListener("dispose",s);const c=e.get(l);c!==void 0&&(e.delete(l),c.dispose())}function o(){e=new WeakMap,t!==null&&(t.dispose(),t=null)}return{get:i,dispose:o}}function Z$(n){const e={};function t(i){if(e[i]!==void 0)return e[i];let r;switch(i){case"WEBGL_depth_texture":r=n.getExtension("WEBGL_depth_texture")||n.getExtension("MOZ_WEBGL_depth_texture")||n.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":r=n.getExtension("EXT_texture_filter_anisotropic")||n.getExtension("MOZ_EXT_texture_filter_anisotropic")||n.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":r=n.getExtension("WEBGL_compressed_texture_s3tc")||n.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||n.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":r=n.getExtension("WEBGL_compressed_texture_pvrtc")||n.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:r=n.getExtension(i)}return e[i]=r,r}return{has:function(i){return t(i)!==null},init:function(i){i.isWebGL2?t("EXT_color_buffer_float"):(t("WEBGL_depth_texture"),t("OES_texture_float"),t("OES_texture_half_float"),t("OES_texture_half_float_linear"),t("OES_standard_derivatives"),t("OES_element_index_uint"),t("OES_vertex_array_object"),t("ANGLE_instanced_arrays")),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture")},get:function(i){const r=t(i);return r===null&&console.warn("THREE.WebGLRenderer: "+i+" extension not supported."),r}}}function J$(n,e,t,i){const r={},s=new WeakMap;function o(h){const d=h.target;d.index!==null&&e.remove(d.index);for(const p in d.attributes)e.remove(d.attributes[p]);for(const p in d.morphAttributes){const v=d.morphAttributes[p];for(let m=0,g=v.length;m<g;m++)e.remove(v[m])}d.removeEventListener("dispose",o),delete r[d.id];const f=s.get(d);f&&(e.remove(f),s.delete(d)),i.releaseStatesOfGeometry(d),d.isInstancedBufferGeometry===!0&&delete d._maxInstanceCount,t.memory.geometries--}function a(h,d){return r[d.id]===!0||(d.addEventListener("dispose",o),r[d.id]=!0,t.memory.geometries++),d}function l(h){const d=h.attributes;for(const p in d)e.update(d[p],n.ARRAY_BUFFER);const f=h.morphAttributes;for(const p in f){const v=f[p];for(let m=0,g=v.length;m<g;m++)e.update(v[m],n.ARRAY_BUFFER)}}function c(h){const d=[],f=h.index,p=h.attributes.position;let v=0;if(f!==null){const b=f.array;v=f.version;for(let _=0,y=b.length;_<y;_+=3){const T=b[_+0],S=b[_+1],E=b[_+2];d.push(T,S,S,E,E,T)}}else if(p!==void 0){const b=p.array;v=p.version;for(let _=0,y=b.length/3-1;_<y;_+=3){const T=_+0,S=_+1,E=_+2;d.push(T,S,S,E,E,T)}}else return;const m=new(UP(d)?hb:Fm)(d,1);m.version=v;const g=s.get(h);g&&e.remove(g),s.set(h,m)}function u(h){const d=s.get(h);if(d){const f=h.index;f!==null&&d.version<f.version&&c(h)}else c(h);return s.get(h)}return{get:a,update:l,getWireframeAttribute:u}}function Q$(n,e,t,i){const r=i.isWebGL2;let s;function o(d){s=d}let a,l;function c(d){a=d.type,l=d.bytesPerElement}function u(d,f){n.drawElements(s,f,a,d*l),t.update(f,s,1)}function h(d,f,p){if(p===0)return;let v,m;if(r)v=n,m="drawElementsInstanced";else if(v=e.get("ANGLE_instanced_arrays"),m="drawElementsInstancedANGLE",v===null){console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}v[m](s,f,a,d*l,p),t.update(f,s,p)}this.setMode=o,this.setIndex=c,this.render=u,this.renderInstances=h}function ej(n){const e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function i(s,o,a){switch(t.calls++,o){case n.TRIANGLES:t.triangles+=a*(s/3);break;case n.LINES:t.lines+=a*(s/2);break;case n.LINE_STRIP:t.lines+=a*(s-1);break;case n.LINE_LOOP:t.lines+=a*s;break;case n.POINTS:t.points+=a*s;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",o);break}}function r(){t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:r,update:i}}function tj(n,e){return n[0]-e[0]}function nj(n,e){return Math.abs(e[1])-Math.abs(n[1])}function ij(n,e,t){const i={},r=new Float32Array(8),s=new WeakMap,o=new vt,a=[];for(let c=0;c<8;c++)a[c]=[c,0];function l(c,u,h){const d=c.morphTargetInfluences;if(e.isWebGL2===!0){const f=u.morphAttributes.position||u.morphAttributes.normal||u.morphAttributes.color,p=f!==void 0?f.length:0;let v=s.get(u);if(v===void 0||v.count!==p){let U=function(){L.dispose(),s.delete(u),u.removeEventListener("dispose",U)};v!==void 0&&v.texture.dispose();const b=u.morphAttributes.position!==void 0,_=u.morphAttributes.normal!==void 0,y=u.morphAttributes.color!==void 0,T=u.morphAttributes.position||[],S=u.morphAttributes.normal||[],E=u.morphAttributes.color||[];let x=0;b===!0&&(x=1),_===!0&&(x=2),y===!0&&(x=3);let M=u.attributes.position.count*x,w=1;M>e.maxTextureSize&&(w=Math.ceil(M/e.maxTextureSize),M=e.maxTextureSize);const C=new Float32Array(M*w*4*p),L=new Um(C,M,w,p);L.type=jr,L.needsUpdate=!0;const $=x*4;for(let H=0;H<p;H++){const V=T[H],j=S[H],te=E[H],Z=M*w*4*H;for(let Q=0;Q<V.count;Q++){const X=Q*$;b===!0&&(o.fromBufferAttribute(V,Q),C[Z+X+0]=o.x,C[Z+X+1]=o.y,C[Z+X+2]=o.z,C[Z+X+3]=0),_===!0&&(o.fromBufferAttribute(j,Q),C[Z+X+4]=o.x,C[Z+X+5]=o.y,C[Z+X+6]=o.z,C[Z+X+7]=0),y===!0&&(o.fromBufferAttribute(te,Q),C[Z+X+8]=o.x,C[Z+X+9]=o.y,C[Z+X+10]=o.z,C[Z+X+11]=te.itemSize===4?o.w:1)}}v={count:p,texture:L,size:new _e(M,w)},s.set(u,v),u.addEventListener("dispose",U)}let m=0;for(let b=0;b<d.length;b++)m+=d[b];const g=u.morphTargetsRelative?1:1-m;h.getUniforms().setValue(n,"morphTargetBaseInfluence",g),h.getUniforms().setValue(n,"morphTargetInfluences",d),h.getUniforms().setValue(n,"morphTargetsTexture",v.texture,t),h.getUniforms().setValue(n,"morphTargetsTextureSize",v.size)}else{const f=d===void 0?0:d.length;let p=i[u.id];if(p===void 0||p.length!==f){p=[];for(let _=0;_<f;_++)p[_]=[_,0];i[u.id]=p}for(let _=0;_<f;_++){const y=p[_];y[0]=_,y[1]=d[_]}p.sort(nj);for(let _=0;_<8;_++)_<f&&p[_][1]?(a[_][0]=p[_][0],a[_][1]=p[_][1]):(a[_][0]=Number.MAX_SAFE_INTEGER,a[_][1]=0);a.sort(tj);const v=u.morphAttributes.position,m=u.morphAttributes.normal;let g=0;for(let _=0;_<8;_++){const y=a[_],T=y[0],S=y[1];T!==Number.MAX_SAFE_INTEGER&&S?(v&&u.getAttribute("morphTarget"+_)!==v[T]&&u.setAttribute("morphTarget"+_,v[T]),m&&u.getAttribute("morphNormal"+_)!==m[T]&&u.setAttribute("morphNormal"+_,m[T]),r[_]=S,g+=S):(v&&u.hasAttribute("morphTarget"+_)===!0&&u.deleteAttribute("morphTarget"+_),m&&u.hasAttribute("morphNormal"+_)===!0&&u.deleteAttribute("morphNormal"+_),r[_]=0)}const b=u.morphTargetsRelative?1:1-g;h.getUniforms().setValue(n,"morphTargetBaseInfluence",b),h.getUniforms().setValue(n,"morphTargetInfluences",r)}}return{update:l}}function rj(n,e,t,i){let r=new WeakMap;function s(l){const c=i.render.frame,u=l.geometry,h=e.get(l,u);if(r.get(h)!==c&&(e.update(h),r.set(h,c)),l.isInstancedMesh&&(l.hasEventListener("dispose",a)===!1&&l.addEventListener("dispose",a),r.get(l)!==c&&(t.update(l.instanceMatrix,n.ARRAY_BUFFER),l.instanceColor!==null&&t.update(l.instanceColor,n.ARRAY_BUFFER),r.set(l,c))),l.isSkinnedMesh){const d=l.skeleton;r.get(d)!==c&&(d.update(),r.set(d,c))}return h}function o(){r=new WeakMap}function a(l){const c=l.target;c.removeEventListener("dispose",a),t.remove(c.instanceMatrix),c.instanceColor!==null&&t.remove(c.instanceColor)}return{update:s,dispose:o}}const GP=new Jt,WP=new Um,$P=new ub,jP=new pd,QS=[],eM=[],tM=new Float32Array(16),nM=new Float32Array(9),iM=new Float32Array(4);function Gc(n,e,t){const i=n[0];if(i<=0||i>0)return n;const r=e*t;let s=QS[r];if(s===void 0&&(s=new Float32Array(r),QS[r]=s),e!==0){i.toArray(s,0);for(let o=1,a=0;o!==e;++o)a+=t,n[o].toArray(s,a)}return s}function On(n,e){if(n.length!==e.length)return!1;for(let t=0,i=n.length;t<i;t++)if(n[t]!==e[t])return!1;return!0}function In(n,e){for(let t=0,i=e.length;t<i;t++)n[t]=e[t]}function zm(n,e){let t=eM[e];t===void 0&&(t=new Int32Array(e),eM[e]=t);for(let i=0;i!==e;++i)t[i]=n.allocateTextureUnit();return t}function sj(n,e){const t=this.cache;t[0]!==e&&(n.uniform1f(this.addr,e),t[0]=e)}function oj(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(n.uniform2f(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(On(t,e))return;n.uniform2fv(this.addr,e),In(t,e)}}function aj(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(n.uniform3f(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else if(e.r!==void 0)(t[0]!==e.r||t[1]!==e.g||t[2]!==e.b)&&(n.uniform3f(this.addr,e.r,e.g,e.b),t[0]=e.r,t[1]=e.g,t[2]=e.b);else{if(On(t,e))return;n.uniform3fv(this.addr,e),In(t,e)}}function lj(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(n.uniform4f(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(On(t,e))return;n.uniform4fv(this.addr,e),In(t,e)}}function cj(n,e){const t=this.cache,i=e.elements;if(i===void 0){if(On(t,e))return;n.uniformMatrix2fv(this.addr,!1,e),In(t,e)}else{if(On(t,i))return;iM.set(i),n.uniformMatrix2fv(this.addr,!1,iM),In(t,i)}}function uj(n,e){const t=this.cache,i=e.elements;if(i===void 0){if(On(t,e))return;n.uniformMatrix3fv(this.addr,!1,e),In(t,e)}else{if(On(t,i))return;nM.set(i),n.uniformMatrix3fv(this.addr,!1,nM),In(t,i)}}function hj(n,e){const t=this.cache,i=e.elements;if(i===void 0){if(On(t,e))return;n.uniformMatrix4fv(this.addr,!1,e),In(t,e)}else{if(On(t,i))return;tM.set(i),n.uniformMatrix4fv(this.addr,!1,tM),In(t,i)}}function dj(n,e){const t=this.cache;t[0]!==e&&(n.uniform1i(this.addr,e),t[0]=e)}function fj(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(n.uniform2i(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(On(t,e))return;n.uniform2iv(this.addr,e),In(t,e)}}function pj(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(n.uniform3i(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(On(t,e))return;n.uniform3iv(this.addr,e),In(t,e)}}function mj(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(n.uniform4i(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(On(t,e))return;n.uniform4iv(this.addr,e),In(t,e)}}function gj(n,e){const t=this.cache;t[0]!==e&&(n.uniform1ui(this.addr,e),t[0]=e)}function vj(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(n.uniform2ui(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(On(t,e))return;n.uniform2uiv(this.addr,e),In(t,e)}}function _j(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(n.uniform3ui(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(On(t,e))return;n.uniform3uiv(this.addr,e),In(t,e)}}function yj(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(n.uniform4ui(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(On(t,e))return;n.uniform4uiv(this.addr,e),In(t,e)}}function bj(n,e,t){const i=this.cache,r=t.allocateTextureUnit();i[0]!==r&&(n.uniform1i(this.addr,r),i[0]=r),t.setTexture2D(e||GP,r)}function xj(n,e,t){const i=this.cache,r=t.allocateTextureUnit();i[0]!==r&&(n.uniform1i(this.addr,r),i[0]=r),t.setTexture3D(e||$P,r)}function wj(n,e,t){const i=this.cache,r=t.allocateTextureUnit();i[0]!==r&&(n.uniform1i(this.addr,r),i[0]=r),t.setTextureCube(e||jP,r)}function Sj(n,e,t){const i=this.cache,r=t.allocateTextureUnit();i[0]!==r&&(n.uniform1i(this.addr,r),i[0]=r),t.setTexture2DArray(e||WP,r)}function Mj(n){switch(n){case 5126:return sj;case 35664:return oj;case 35665:return aj;case 35666:return lj;case 35674:return cj;case 35675:return uj;case 35676:return hj;case 5124:case 35670:return dj;case 35667:case 35671:return fj;case 35668:case 35672:return pj;case 35669:case 35673:return mj;case 5125:return gj;case 36294:return vj;case 36295:return _j;case 36296:return yj;case 35678:case 36198:case 36298:case 36306:case 35682:return bj;case 35679:case 36299:case 36307:return xj;case 35680:case 36300:case 36308:case 36293:return wj;case 36289:case 36303:case 36311:case 36292:return Sj}}function Ej(n,e){n.uniform1fv(this.addr,e)}function Tj(n,e){const t=Gc(e,this.size,2);n.uniform2fv(this.addr,t)}function Aj(n,e){const t=Gc(e,this.size,3);n.uniform3fv(this.addr,t)}function Cj(n,e){const t=Gc(e,this.size,4);n.uniform4fv(this.addr,t)}function Pj(n,e){const t=Gc(e,this.size,4);n.uniformMatrix2fv(this.addr,!1,t)}function Rj(n,e){const t=Gc(e,this.size,9);n.uniformMatrix3fv(this.addr,!1,t)}function Lj(n,e){const t=Gc(e,this.size,16);n.uniformMatrix4fv(this.addr,!1,t)}function Oj(n,e){n.uniform1iv(this.addr,e)}function Ij(n,e){n.uniform2iv(this.addr,e)}function Dj(n,e){n.uniform3iv(this.addr,e)}function Uj(n,e){n.uniform4iv(this.addr,e)}function Nj(n,e){n.uniform1uiv(this.addr,e)}function Fj(n,e){n.uniform2uiv(this.addr,e)}function kj(n,e){n.uniform3uiv(this.addr,e)}function Bj(n,e){n.uniform4uiv(this.addr,e)}function zj(n,e,t){const i=this.cache,r=e.length,s=zm(t,r);On(i,s)||(n.uniform1iv(this.addr,s),In(i,s));for(let o=0;o!==r;++o)t.setTexture2D(e[o]||GP,s[o])}function Vj(n,e,t){const i=this.cache,r=e.length,s=zm(t,r);On(i,s)||(n.uniform1iv(this.addr,s),In(i,s));for(let o=0;o!==r;++o)t.setTexture3D(e[o]||$P,s[o])}function Hj(n,e,t){const i=this.cache,r=e.length,s=zm(t,r);On(i,s)||(n.uniform1iv(this.addr,s),In(i,s));for(let o=0;o!==r;++o)t.setTextureCube(e[o]||jP,s[o])}function Gj(n,e,t){const i=this.cache,r=e.length,s=zm(t,r);On(i,s)||(n.uniform1iv(this.addr,s),In(i,s));for(let o=0;o!==r;++o)t.setTexture2DArray(e[o]||WP,s[o])}function Wj(n){switch(n){case 5126:return Ej;case 35664:return Tj;case 35665:return Aj;case 35666:return Cj;case 35674:return Pj;case 35675:return Rj;case 35676:return Lj;case 5124:case 35670:return Oj;case 35667:case 35671:return Ij;case 35668:case 35672:return Dj;case 35669:case 35673:return Uj;case 5125:return Nj;case 36294:return Fj;case 36295:return kj;case 36296:return Bj;case 35678:case 36198:case 36298:case 36306:case 35682:return zj;case 35679:case 36299:case 36307:return Vj;case 35680:case 36300:case 36308:case 36293:return Hj;case 36289:case 36303:case 36311:case 36292:return Gj}}class $j{constructor(e,t,i){this.id=e,this.addr=i,this.cache=[],this.setValue=Mj(t.type)}}class jj{constructor(e,t,i){this.id=e,this.addr=i,this.cache=[],this.size=t.size,this.setValue=Wj(t.type)}}class Xj{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,i){const r=this.seq;for(let s=0,o=r.length;s!==o;++s){const a=r[s];a.setValue(e,t[a.id],i)}}}const uv=/(\w+)(\])?(\[|\.)?/g;function rM(n,e){n.seq.push(e),n.map[e.id]=e}function Yj(n,e,t){const i=n.name,r=i.length;for(uv.lastIndex=0;;){const s=uv.exec(i),o=uv.lastIndex;let a=s[1];const l=s[2]==="]",c=s[3];if(l&&(a=a|0),c===void 0||c==="["&&o+2===r){rM(t,c===void 0?new $j(a,n,e):new jj(a,n,e));break}else{let h=t.map[a];h===void 0&&(h=new Xj(a),rM(t,h)),t=h}}}class gp{constructor(e,t){this.seq=[],this.map={};const i=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let r=0;r<i;++r){const s=e.getActiveUniform(t,r),o=e.getUniformLocation(t,s.name);Yj(s,o,this)}}setValue(e,t,i,r){const s=this.map[t];s!==void 0&&s.setValue(e,i,r)}setOptional(e,t,i){const r=t[i];r!==void 0&&this.setValue(e,i,r)}static upload(e,t,i,r){for(let s=0,o=t.length;s!==o;++s){const a=t[s],l=i[a.id];l.needsUpdate!==!1&&a.setValue(e,l.value,r)}}static seqWithValue(e,t){const i=[];for(let r=0,s=e.length;r!==s;++r){const o=e[r];o.id in t&&i.push(o)}return i}}function sM(n,e,t){const i=n.createShader(e);return n.shaderSource(i,t),n.compileShader(i),i}const qj=37297;let Kj=0;function Zj(n,e){const t=n.split("\n"),i=[],r=Math.max(e-6,0),s=Math.min(e+6,t.length);for(let o=r;o<s;o++){const a=o+1;i.push("".concat(a===e?">":" "," ").concat(a,": ").concat(t[o]))}return i.join("\n")}function Jj(n){const e=Ut.getPrimaries(Ut.workingColorSpace),t=Ut.getPrimaries(n);let i;switch(e===t?i="":e===Fh&&t===Nh?i="LinearDisplayP3ToLinearSRGB":e===Nh&&t===Fh&&(i="LinearSRGBToLinearDisplayP3"),n){case ss:case dd:return[i,"LinearTransferOETF"];case Mn:case Dm:return[i,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",n),[i,"LinearTransferOETF"]}}function oM(n,e,t){const i=n.getShaderParameter(e,n.COMPILE_STATUS),r=n.getShaderInfoLog(e).trim();if(i&&r==="")return"";const s=/ERROR: 0:(\d+)/.exec(r);if(s){const o=parseInt(s[1]);return t.toUpperCase()+"\n\n"+r+"\n\n"+Zj(n.getShaderSource(e),o)}else return r}function Qj(n,e){const t=Jj(e);return"vec4 ".concat(n,"( vec4 value ) { return ").concat(t[0],"( ").concat(t[1],"( value ) ); }")}function eX(n,e){let t;switch(e){case sP:t="Linear";break;case oP:t="Reinhard";break;case aP:t="OptimizedCineon";break;case Jy:t="ACESFilmic";break;case lP:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+n+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}function tX(n){return[n.extensionDerivatives||n.envMapCubeUVHeight||n.bumpMap||n.normalMapTangentSpace||n.clearcoatNormalMap||n.flatShading||n.shaderID==="physical"?"#extension GL_OES_standard_derivatives : enable":"",(n.extensionFragDepth||n.logarithmicDepthBuffer)&&n.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",n.extensionDrawBuffers&&n.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(n.extensionShaderTextureLOD||n.envMap||n.transmission)&&n.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(zu).join("\n")}function nX(n){const e=[];for(const t in n){const i=n[t];i!==!1&&e.push("#define "+t+" "+i)}return e.join("\n")}function iX(n,e){const t={},i=n.getProgramParameter(e,n.ACTIVE_ATTRIBUTES);for(let r=0;r<i;r++){const s=n.getActiveAttrib(e,r),o=s.name;let a=1;s.type===n.FLOAT_MAT2&&(a=2),s.type===n.FLOAT_MAT3&&(a=3),s.type===n.FLOAT_MAT4&&(a=4),t[o]={type:s.type,location:n.getAttribLocation(e,o),locationSize:a}}return t}function zu(n){return n!==""}function aM(n,e){const t=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return n.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,e.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,t).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,e.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function lM(n,e){return n.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const rX=/^[ \t]*#include +<([\w\d./]+)>/gm;function m_(n){return n.replace(rX,oX)}const sX=new Map([["encodings_fragment","colorspace_fragment"],["encodings_pars_fragment","colorspace_pars_fragment"],["output_fragment","opaque_fragment"]]);function oX(n,e){let t=lt[e];if(t===void 0){const i=sX.get(e);if(i!==void 0)t=lt[i],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,i);else throw new Error("Can not resolve #include <"+e+">")}return m_(t)}const aX=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function cM(n){return n.replace(aX,lX)}function lX(n,e,t,i){let r="";for(let s=parseInt(e);s<parseInt(t);s++)r+=i.replace(/\[\s*i\s*\]/g,"[ "+s+" ]").replace(/UNROLLED_LOOP_INDEX/g,s);return r}function uM(n){let e="precision "+n.precision+" float;\nprecision "+n.precision+" int;";return n.precision==="highp"?e+="\n#define HIGH_PRECISION":n.precision==="mediump"?e+="\n#define MEDIUM_PRECISION":n.precision==="lowp"&&(e+="\n#define LOW_PRECISION"),e}function cX(n){let e="SHADOWMAP_TYPE_BASIC";return n.shadowMapType===Ky?e="SHADOWMAP_TYPE_PCF":n.shadowMapType===Zy?e="SHADOWMAP_TYPE_PCF_SOFT":n.shadowMapType===Gr&&(e="SHADOWMAP_TYPE_VSM"),e}function uX(n){let e="ENVMAP_TYPE_CUBE";if(n.envMap)switch(n.envMapMode){case Ns:case Fo:e="ENVMAP_TYPE_CUBE";break;case Hc:e="ENVMAP_TYPE_CUBE_UV";break}return e}function hX(n){let e="ENVMAP_MODE_REFLECTION";if(n.envMap)switch(n.envMapMode){case Fo:e="ENVMAP_MODE_REFRACTION";break}return e}function dX(n){let e="ENVMAP_BLENDING_NONE";if(n.envMap)switch(n.combine){case hd:e="ENVMAP_BLENDING_MULTIPLY";break;case iP:e="ENVMAP_BLENDING_MIX";break;case rP:e="ENVMAP_BLENDING_ADD";break}return e}function fX(n){const e=n.envMapCubeUVHeight;if(e===null)return null;const t=Math.log2(e)-2,i=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,t),7*16)),texelHeight:i,maxMip:t}}function pX(n,e,t,i){const r=n.getContext(),s=t.defines;let o=t.vertexShader,a=t.fragmentShader;const l=cX(t),c=uX(t),u=hX(t),h=dX(t),d=fX(t),f=t.isWebGL2?"":tX(t),p=nX(s),v=r.createProgram();let m,g,b=t.glslVersion?"#version "+t.glslVersion+"\n":"";t.isRawShaderMaterial?(m=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,p].filter(zu).join("\n"),m.length>0&&(m+="\n"),g=[f,"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,p].filter(zu).join("\n"),g.length>0&&(g+="\n")):(m=[uM(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,p,t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+u:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors&&t.isWebGL2?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.useLegacyLights?"#define LEGACY_LIGHTS":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.logarithmicDepthBuffer&&t.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )"," attribute vec3 morphTarget0;"," attribute vec3 morphTarget1;"," attribute vec3 morphTarget2;"," attribute vec3 morphTarget3;"," #ifdef USE_MORPHNORMALS"," attribute vec3 morphNormal0;"," attribute vec3 morphNormal1;"," attribute vec3 morphNormal2;"," attribute vec3 morphNormal3;"," #else"," attribute vec3 morphTarget4;"," attribute vec3 morphTarget5;"," attribute vec3 morphTarget6;"," attribute vec3 morphTarget7;"," #endif","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif","\n"].filter(zu).join("\n"),g=[f,uM(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,p,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+c:"",t.envMap?"#define "+u:"",t.envMap?"#define "+h:"",d?"#define CUBEUV_TEXEL_WIDTH "+d.texelWidth:"",d?"#define CUBEUV_TEXEL_HEIGHT "+d.texelHeight:"",d?"#define CUBEUV_MAX_MIP "+d.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.useLegacyLights?"#define LEGACY_LIGHTS":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.logarithmicDepthBuffer&&t.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==Rs?"#define TONE_MAPPING":"",t.toneMapping!==Rs?lt.tonemapping_pars_fragment:"",t.toneMapping!==Rs?eX("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",lt.colorspace_pars_fragment,Qj("linearToOutputTexel",t.outputColorSpace),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"","\n"].filter(zu).join("\n")),o=m_(o),o=aM(o,t),o=lM(o,t),a=m_(a),a=aM(a,t),a=lM(a,t),o=cM(o),a=cM(a),t.isWebGL2&&t.isRawShaderMaterial!==!0&&(b="#version 300 es\n",m=["precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+m,g=["precision mediump sampler2DArray;","#define varying in",t.glslVersion===d_?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===d_?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join("\n")+"\n"+g);const _=b+m+o,y=b+g+a,T=sM(r,r.VERTEX_SHADER,_),S=sM(r,r.FRAGMENT_SHADER,y);r.attachShader(v,T),r.attachShader(v,S),t.index0AttributeName!==void 0?r.bindAttribLocation(v,0,t.index0AttributeName):t.morphTargets===!0&&r.bindAttribLocation(v,0,"position"),r.linkProgram(v);function E(C){if(n.debug.checkShaderErrors){const L=r.getProgramInfoLog(v).trim(),$=r.getShaderInfoLog(T).trim(),U=r.getShaderInfoLog(S).trim();let H=!0,V=!0;if(r.getProgramParameter(v,r.LINK_STATUS)===!1)if(H=!1,typeof n.debug.onShaderError=="function")n.debug.onShaderError(r,v,T,S);else{const j=oM(r,T,"vertex"),te=oM(r,S,"fragment");console.error("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(v,r.VALIDATE_STATUS)+"\n\nProgram Info Log: "+L+"\n"+j+"\n"+te)}else L!==""?console.warn("THREE.WebGLProgram: Program Info Log:",L):($===""||U==="")&&(V=!1);V&&(C.diagnostics={runnable:H,programLog:L,vertexShader:{log:$,prefix:m},fragmentShader:{log:U,prefix:g}})}r.deleteShader(T),r.deleteShader(S),x=new gp(r,v),M=iX(r,v)}let x;this.getUniforms=function(){return x===void 0&&E(this),x};let M;this.getAttributes=function(){return M===void 0&&E(this),M};let w=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return w===!1&&(w=r.getProgramParameter(v,qj)),w},this.destroy=function(){i.releaseStatesOfProgram(this),r.deleteProgram(v),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=Kj++,this.cacheKey=e,this.usedTimes=1,this.program=v,this.vertexShader=T,this.fragmentShader=S,this}let mX=0;class gX{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,i=e.fragmentShader,r=this._getShaderStage(t),s=this._getShaderStage(i),o=this._getShaderCacheForMaterial(e);return o.has(r)===!1&&(o.add(r),r.usedTimes++),o.has(s)===!1&&(o.add(s),s.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const i of t)i.usedTimes--,i.usedTimes===0&&this.shaderCache.delete(i.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let i=t.get(e);return i===void 0&&(i=new Set,t.set(e,i)),i}_getShaderStage(e){const t=this.shaderCache;let i=t.get(e);return i===void 0&&(i=new vX(e),t.set(e,i)),i}}class vX{constructor(e){this.id=mX++,this.code=e,this.usedTimes=0}}function _X(n,e,t,i,r,s,o){const a=new Nm,l=new gX,c=[],u=r.isWebGL2,h=r.logarithmicDepthBuffer,d=r.vertexTextures;let f=r.precision;const p={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function v(M){return M===0?"uv":"uv".concat(M)}function m(M,w,C,L,$){const U=L.fog,H=$.geometry,V=M.isMeshStandardMaterial?L.environment:null,j=(M.isMeshStandardMaterial?t:e).get(M.envMap||V),te=j&&j.mapping===Hc?j.image.height:null,Z=p[M.type];M.precision!==null&&(f=r.getMaxPrecision(M.precision),f!==M.precision&&console.warn("THREE.WebGLProgram.getParameters:",M.precision,"not supported, using",f,"instead."));const Q=H.morphAttributes.position||H.morphAttributes.normal||H.morphAttributes.color,X=Q!==void 0?Q.length:0;let re=0;H.morphAttributes.position!==void 0&&(re=1),H.morphAttributes.normal!==void 0&&(re=2),H.morphAttributes.color!==void 0&&(re=3);let W,we,Re,De;if(Z){const Ft=er[Z];W=Ft.vertexShader,we=Ft.fragmentShader}else W=M.vertexShader,we=M.fragmentShader,l.update(M),Re=l.getVertexShaderID(M),De=l.getFragmentShaderID(M);const ne=n.getRenderTarget(),q=$.isInstancedMesh===!0,P=!!M.map,N=!!M.matcap,B=!!j,A=!!M.aoMap,R=!!M.lightMap,I=!!M.bumpMap,z=!!M.normalMap,G=!!M.displacementMap,ee=!!M.emissiveMap,ae=!!M.metalnessMap,se=!!M.roughnessMap,ce=M.anisotropy>0,le=M.clearcoat>0,Me=M.iridescence>0,F=M.sheen>0,O=M.transmission>0,J=ce&&!!M.anisotropyMap,ge=le&&!!M.clearcoatMap,de=le&&!!M.clearcoatNormalMap,be=le&&!!M.clearcoatRoughnessMap,Ne=Me&&!!M.iridescenceMap,Ae=Me&&!!M.iridescenceThicknessMap,Fe=F&&!!M.sheenColorMap,je=F&&!!M.sheenRoughnessMap,dt=!!M.specularMap,Le=!!M.specularColorMap,et=!!M.specularIntensityMap,Y=O&&!!M.transmissionMap,fe=O&&!!M.thicknessMap,Ee=!!M.gradientMap,Ce=!!M.alphaMap,Ke=M.alphaTest>0,K=!!M.alphaHash,ke=!!M.extensions,Ie=!!H.attributes.uv1,ve=!!H.attributes.uv2,Oe=!!H.attributes.uv3;let We=Rs;return M.toneMapped&&(ne===null||ne.isXRRenderTarget===!0)&&(We=n.toneMapping),{isWebGL2:u,shaderID:Z,shaderType:M.type,shaderName:M.name,vertexShader:W,fragmentShader:we,defines:M.defines,customVertexShaderID:Re,customFragmentShaderID:De,isRawShaderMaterial:M.isRawShaderMaterial===!0,glslVersion:M.glslVersion,precision:f,instancing:q,instancingColor:q&&$.instanceColor!==null,supportsVertexTextures:d,outputColorSpace:ne===null?n.outputColorSpace:ne.isXRRenderTarget===!0?ne.texture.colorSpace:ss,map:P,matcap:N,envMap:B,envMapMode:B&&j.mapping,envMapCubeUVHeight:te,aoMap:A,lightMap:R,bumpMap:I,normalMap:z,displacementMap:d&&G,emissiveMap:ee,normalMapObjectSpace:z&&M.normalMapType===EP,normalMapTangentSpace:z&&M.normalMapType===Ho,metalnessMap:ae,roughnessMap:se,anisotropy:ce,anisotropyMap:J,clearcoat:le,clearcoatMap:ge,clearcoatNormalMap:de,clearcoatRoughnessMap:be,iridescence:Me,iridescenceMap:Ne,iridescenceThicknessMap:Ae,sheen:F,sheenColorMap:Fe,sheenRoughnessMap:je,specularMap:dt,specularColorMap:Le,specularIntensityMap:et,transmission:O,transmissionMap:Y,thicknessMap:fe,gradientMap:Ee,opaque:M.transparent===!1&&M.blending===Ra,alphaMap:Ce,alphaTest:Ke,alphaHash:K,combine:M.combine,mapUv:P&&v(M.map.channel),aoMapUv:A&&v(M.aoMap.channel),lightMapUv:R&&v(M.lightMap.channel),bumpMapUv:I&&v(M.bumpMap.channel),normalMapUv:z&&v(M.normalMap.channel),displacementMapUv:G&&v(M.displacementMap.channel),emissiveMapUv:ee&&v(M.emissiveMap.channel),metalnessMapUv:ae&&v(M.metalnessMap.channel),roughnessMapUv:se&&v(M.roughnessMap.channel),anisotropyMapUv:J&&v(M.anisotropyMap.channel),clearcoatMapUv:ge&&v(M.clearcoatMap.channel),clearcoatNormalMapUv:de&&v(M.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:be&&v(M.clearcoatRoughnessMap.channel),iridescenceMapUv:Ne&&v(M.iridescenceMap.channel),iridescenceThicknessMapUv:Ae&&v(M.iridescenceThicknessMap.channel),sheenColorMapUv:Fe&&v(M.sheenColorMap.channel),sheenRoughnessMapUv:je&&v(M.sheenRoughnessMap.channel),specularMapUv:dt&&v(M.specularMap.channel),specularColorMapUv:Le&&v(M.specularColorMap.channel),specularIntensityMapUv:et&&v(M.specularIntensityMap.channel),transmissionMapUv:Y&&v(M.transmissionMap.channel),thicknessMapUv:fe&&v(M.thicknessMap.channel),alphaMapUv:Ce&&v(M.alphaMap.channel),vertexTangents:!!H.attributes.tangent&&(z||ce),vertexColors:M.vertexColors,vertexAlphas:M.vertexColors===!0&&!!H.attributes.color&&H.attributes.color.itemSize===4,vertexUv1s:Ie,vertexUv2s:ve,vertexUv3s:Oe,pointsUvs:$.isPoints===!0&&!!H.attributes.uv&&(P||Ce),fog:!!U,useFog:M.fog===!0,fogExp2:U&&U.isFogExp2,flatShading:M.flatShading===!0,sizeAttenuation:M.sizeAttenuation===!0,logarithmicDepthBuffer:h,skinning:$.isSkinnedMesh===!0,morphTargets:H.morphAttributes.position!==void 0,morphNormals:H.morphAttributes.normal!==void 0,morphColors:H.morphAttributes.color!==void 0,morphTargetsCount:X,morphTextureStride:re,numDirLights:w.directional.length,numPointLights:w.point.length,numSpotLights:w.spot.length,numSpotLightMaps:w.spotLightMap.length,numRectAreaLights:w.rectArea.length,numHemiLights:w.hemi.length,numDirLightShadows:w.directionalShadowMap.length,numPointLightShadows:w.pointShadowMap.length,numSpotLightShadows:w.spotShadowMap.length,numSpotLightShadowsWithMaps:w.numSpotLightShadowsWithMaps,numLightProbes:w.numLightProbes,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:M.dithering,shadowMapEnabled:n.shadowMap.enabled&&C.length>0,shadowMapType:n.shadowMap.type,toneMapping:We,useLegacyLights:n._useLegacyLights,decodeVideoTexture:P&&M.map.isVideoTexture===!0&&Ut.getTransfer(M.map.colorSpace)===Ht,premultipliedAlpha:M.premultipliedAlpha,doubleSided:M.side===bi,flipSided:M.side===Qn,useDepthPacking:M.depthPacking>=0,depthPacking:M.depthPacking||0,index0AttributeName:M.index0AttributeName,extensionDerivatives:ke&&M.extensions.derivatives===!0,extensionFragDepth:ke&&M.extensions.fragDepth===!0,extensionDrawBuffers:ke&&M.extensions.drawBuffers===!0,extensionShaderTextureLOD:ke&&M.extensions.shaderTextureLOD===!0,rendererExtensionFragDepth:u||i.has("EXT_frag_depth"),rendererExtensionDrawBuffers:u||i.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:u||i.has("EXT_shader_texture_lod"),rendererExtensionParallelShaderCompile:i.has("KHR_parallel_shader_compile"),customProgramCacheKey:M.customProgramCacheKey()}}function g(M){const w=[];if(M.shaderID?w.push(M.shaderID):(w.push(M.customVertexShaderID),w.push(M.customFragmentShaderID)),M.defines!==void 0)for(const C in M.defines)w.push(C),w.push(M.defines[C]);return M.isRawShaderMaterial===!1&&(b(w,M),_(w,M),w.push(n.outputColorSpace)),w.push(M.customProgramCacheKey),w.join()}function b(M,w){M.push(w.precision),M.push(w.outputColorSpace),M.push(w.envMapMode),M.push(w.envMapCubeUVHeight),M.push(w.mapUv),M.push(w.alphaMapUv),M.push(w.lightMapUv),M.push(w.aoMapUv),M.push(w.bumpMapUv),M.push(w.normalMapUv),M.push(w.displacementMapUv),M.push(w.emissiveMapUv),M.push(w.metalnessMapUv),M.push(w.roughnessMapUv),M.push(w.anisotropyMapUv),M.push(w.clearcoatMapUv),M.push(w.clearcoatNormalMapUv),M.push(w.clearcoatRoughnessMapUv),M.push(w.iridescenceMapUv),M.push(w.iridescenceThicknessMapUv),M.push(w.sheenColorMapUv),M.push(w.sheenRoughnessMapUv),M.push(w.specularMapUv),M.push(w.specularColorMapUv),M.push(w.specularIntensityMapUv),M.push(w.transmissionMapUv),M.push(w.thicknessMapUv),M.push(w.combine),M.push(w.fogExp2),M.push(w.sizeAttenuation),M.push(w.morphTargetsCount),M.push(w.morphAttributeCount),M.push(w.numDirLights),M.push(w.numPointLights),M.push(w.numSpotLights),M.push(w.numSpotLightMaps),M.push(w.numHemiLights),M.push(w.numRectAreaLights),M.push(w.numDirLightShadows),M.push(w.numPointLightShadows),M.push(w.numSpotLightShadows),M.push(w.numSpotLightShadowsWithMaps),M.push(w.numLightProbes),M.push(w.shadowMapType),M.push(w.toneMapping),M.push(w.numClippingPlanes),M.push(w.numClipIntersection),M.push(w.depthPacking)}function _(M,w){a.disableAll(),w.isWebGL2&&a.enable(0),w.supportsVertexTextures&&a.enable(1),w.instancing&&a.enable(2),w.instancingColor&&a.enable(3),w.matcap&&a.enable(4),w.envMap&&a.enable(5),w.normalMapObjectSpace&&a.enable(6),w.normalMapTangentSpace&&a.enable(7),w.clearcoat&&a.enable(8),w.iridescence&&a.enable(9),w.alphaTest&&a.enable(10),w.vertexColors&&a.enable(11),w.vertexAlphas&&a.enable(12),w.vertexUv1s&&a.enable(13),w.vertexUv2s&&a.enable(14),w.vertexUv3s&&a.enable(15),w.vertexTangents&&a.enable(16),w.anisotropy&&a.enable(17),w.alphaHash&&a.enable(18),M.push(a.mask),a.disableAll(),w.fog&&a.enable(0),w.useFog&&a.enable(1),w.flatShading&&a.enable(2),w.logarithmicDepthBuffer&&a.enable(3),w.skinning&&a.enable(4),w.morphTargets&&a.enable(5),w.morphNormals&&a.enable(6),w.morphColors&&a.enable(7),w.premultipliedAlpha&&a.enable(8),w.shadowMapEnabled&&a.enable(9),w.useLegacyLights&&a.enable(10),w.doubleSided&&a.enable(11),w.flipSided&&a.enable(12),w.useDepthPacking&&a.enable(13),w.dithering&&a.enable(14),w.transmission&&a.enable(15),w.sheen&&a.enable(16),w.opaque&&a.enable(17),w.pointsUvs&&a.enable(18),w.decodeVideoTexture&&a.enable(19),M.push(a.mask)}function y(M){const w=p[M.type];let C;if(w){const L=er[w];C=km.clone(L.uniforms)}else C=M.uniforms;return C}function T(M,w){let C;for(let L=0,$=c.length;L<$;L++){const U=c[L];if(U.cacheKey===w){C=U,++C.usedTimes;break}}return C===void 0&&(C=new pX(n,w,M,s),c.push(C)),C}function S(M){if(--M.usedTimes===0){const w=c.indexOf(M);c[w]=c[c.length-1],c.pop(),M.destroy()}}function E(M){l.remove(M)}function x(){l.dispose()}return{getParameters:m,getProgramCacheKey:g,getUniforms:y,acquireProgram:T,releaseProgram:S,releaseShaderCache:E,programs:c,dispose:x}}function yX(){let n=new WeakMap;function e(s){let o=n.get(s);return o===void 0&&(o={},n.set(s,o)),o}function t(s){n.delete(s)}function i(s,o,a){n.get(s)[o]=a}function r(){n=new WeakMap}return{get:e,remove:t,update:i,dispose:r}}function bX(n,e){return n.groupOrder!==e.groupOrder?n.groupOrder-e.groupOrder:n.renderOrder!==e.renderOrder?n.renderOrder-e.renderOrder:n.material.id!==e.material.id?n.material.id-e.material.id:n.z!==e.z?n.z-e.z:n.id-e.id}function hM(n,e){return n.groupOrder!==e.groupOrder?n.groupOrder-e.groupOrder:n.renderOrder!==e.renderOrder?n.renderOrder-e.renderOrder:n.z!==e.z?e.z-n.z:n.id-e.id}function dM(){const n=[];let e=0;const t=[],i=[],r=[];function s(){e=0,t.length=0,i.length=0,r.length=0}function o(h,d,f,p,v,m){let g=n[e];return g===void 0?(g={id:h.id,object:h,geometry:d,material:f,groupOrder:p,renderOrder:h.renderOrder,z:v,group:m},n[e]=g):(g.id=h.id,g.object=h,g.geometry=d,g.material=f,g.groupOrder=p,g.renderOrder=h.renderOrder,g.z=v,g.group=m),e++,g}function a(h,d,f,p,v,m){const g=o(h,d,f,p,v,m);f.transmission>0?i.push(g):f.transparent===!0?r.push(g):t.push(g)}function l(h,d,f,p,v,m){const g=o(h,d,f,p,v,m);f.transmission>0?i.unshift(g):f.transparent===!0?r.unshift(g):t.unshift(g)}function c(h,d){t.length>1&&t.sort(h||bX),i.length>1&&i.sort(d||hM),r.length>1&&r.sort(d||hM)}function u(){for(let h=e,d=n.length;h<d;h++){const f=n[h];if(f.id===null)break;f.id=null,f.object=null,f.geometry=null,f.material=null,f.group=null}}return{opaque:t,transmissive:i,transparent:r,init:s,push:a,unshift:l,finish:u,sort:c}}function xX(){let n=new WeakMap;function e(i,r){const s=n.get(i);let o;return s===void 0?(o=new dM,n.set(i,[o])):r>=s.length?(o=new dM,s.push(o)):o=s[r],o}function t(){n=new WeakMap}return{get:e,dispose:t}}function wX(){const n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new D,color:new Pe};break;case"SpotLight":t={position:new D,direction:new D,color:new Pe,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new D,color:new Pe,distance:0,decay:0};break;case"HemisphereLight":t={direction:new D,skyColor:new Pe,groundColor:new Pe};break;case"RectAreaLight":t={color:new Pe,position:new D,halfWidth:new D,halfHeight:new D};break}return n[e.id]=t,t}}}function SX(){const n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new _e};break;case"SpotLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new _e};break;case"PointLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new _e,shadowCameraNear:1,shadowCameraFar:1e3};break}return n[e.id]=t,t}}}let MX=0;function EX(n,e){return(e.castShadow?2:0)-(n.castShadow?2:0)+(e.map?1:0)-(n.map?1:0)}function TX(n,e){const t=new wX,i=SX(),r={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let u=0;u<9;u++)r.probe.push(new D);const s=new D,o=new ze,a=new ze;function l(u,h){let d=0,f=0,p=0;for(let L=0;L<9;L++)r.probe[L].set(0,0,0);let v=0,m=0,g=0,b=0,_=0,y=0,T=0,S=0,E=0,x=0,M=0;u.sort(EX);const w=h===!0?Math.PI:1;for(let L=0,$=u.length;L<$;L++){const U=u[L],H=U.color,V=U.intensity,j=U.distance,te=U.shadow&&U.shadow.map?U.shadow.map.texture:null;if(U.isAmbientLight)d+=H.r*V*w,f+=H.g*V*w,p+=H.b*V*w;else if(U.isLightProbe){for(let Z=0;Z<9;Z++)r.probe[Z].addScaledVector(U.sh.coefficients[Z],V);M++}else if(U.isDirectionalLight){const Z=t.get(U);if(Z.color.copy(U.color).multiplyScalar(U.intensity*w),U.castShadow){const Q=U.shadow,X=i.get(U);X.shadowBias=Q.bias,X.shadowNormalBias=Q.normalBias,X.shadowRadius=Q.radius,X.shadowMapSize=Q.mapSize,r.directionalShadow[v]=X,r.directionalShadowMap[v]=te,r.directionalShadowMatrix[v]=U.shadow.matrix,y++}r.directional[v]=Z,v++}else if(U.isSpotLight){const Z=t.get(U);Z.position.setFromMatrixPosition(U.matrixWorld),Z.color.copy(H).multiplyScalar(V*w),Z.distance=j,Z.coneCos=Math.cos(U.angle),Z.penumbraCos=Math.cos(U.angle*(1-U.penumbra)),Z.decay=U.decay,r.spot[g]=Z;const Q=U.shadow;if(U.map&&(r.spotLightMap[E]=U.map,E++,Q.updateMatrices(U),U.castShadow&&x++),r.spotLightMatrix[g]=Q.matrix,U.castShadow){const X=i.get(U);X.shadowBias=Q.bias,X.shadowNormalBias=Q.normalBias,X.shadowRadius=Q.radius,X.shadowMapSize=Q.mapSize,r.spotShadow[g]=X,r.spotShadowMap[g]=te,S++}g++}else if(U.isRectAreaLight){const Z=t.get(U);Z.color.copy(H).multiplyScalar(V),Z.halfWidth.set(U.width*.5,0,0),Z.halfHeight.set(0,U.height*.5,0),r.rectArea[b]=Z,b++}else if(U.isPointLight){const Z=t.get(U);if(Z.color.copy(U.color).multiplyScalar(U.intensity*w),Z.distance=U.distance,Z.decay=U.decay,U.castShadow){const Q=U.shadow,X=i.get(U);X.shadowBias=Q.bias,X.shadowNormalBias=Q.normalBias,X.shadowRadius=Q.radius,X.shadowMapSize=Q.mapSize,X.shadowCameraNear=Q.camera.near,X.shadowCameraFar=Q.camera.far,r.pointShadow[m]=X,r.pointShadowMap[m]=te,r.pointShadowMatrix[m]=U.shadow.matrix,T++}r.point[m]=Z,m++}else if(U.isHemisphereLight){const Z=t.get(U);Z.skyColor.copy(U.color).multiplyScalar(V*w),Z.groundColor.copy(U.groundColor).multiplyScalar(V*w),r.hemi[_]=Z,_++}}b>0&&(e.isWebGL2||n.has("OES_texture_float_linear")===!0?(r.rectAreaLTC1=Ue.LTC_FLOAT_1,r.rectAreaLTC2=Ue.LTC_FLOAT_2):n.has("OES_texture_half_float_linear")===!0?(r.rectAreaLTC1=Ue.LTC_HALF_1,r.rectAreaLTC2=Ue.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),r.ambient[0]=d,r.ambient[1]=f,r.ambient[2]=p;const C=r.hash;(C.directionalLength!==v||C.pointLength!==m||C.spotLength!==g||C.rectAreaLength!==b||C.hemiLength!==_||C.numDirectionalShadows!==y||C.numPointShadows!==T||C.numSpotShadows!==S||C.numSpotMaps!==E||C.numLightProbes!==M)&&(r.directional.length=v,r.spot.length=g,r.rectArea.length=b,r.point.length=m,r.hemi.length=_,r.directionalShadow.length=y,r.directionalShadowMap.length=y,r.pointShadow.length=T,r.pointShadowMap.length=T,r.spotShadow.length=S,r.spotShadowMap.length=S,r.directionalShadowMatrix.length=y,r.pointShadowMatrix.length=T,r.spotLightMatrix.length=S+E-x,r.spotLightMap.length=E,r.numSpotLightShadowsWithMaps=x,r.numLightProbes=M,C.directionalLength=v,C.pointLength=m,C.spotLength=g,C.rectAreaLength=b,C.hemiLength=_,C.numDirectionalShadows=y,C.numPointShadows=T,C.numSpotShadows=S,C.numSpotMaps=E,C.numLightProbes=M,r.version=MX++)}function c(u,h){let d=0,f=0,p=0,v=0,m=0;const g=h.matrixWorldInverse;for(let b=0,_=u.length;b<_;b++){const y=u[b];if(y.isDirectionalLight){const T=r.directional[d];T.direction.setFromMatrixPosition(y.matrixWorld),s.setFromMatrixPosition(y.target.matrixWorld),T.direction.sub(s),T.direction.transformDirection(g),d++}else if(y.isSpotLight){const T=r.spot[p];T.position.setFromMatrixPosition(y.matrixWorld),T.position.applyMatrix4(g),T.direction.setFromMatrixPosition(y.matrixWorld),s.setFromMatrixPosition(y.target.matrixWorld),T.direction.sub(s),T.direction.transformDirection(g),p++}else if(y.isRectAreaLight){const T=r.rectArea[v];T.position.setFromMatrixPosition(y.matrixWorld),T.position.applyMatrix4(g),a.identity(),o.copy(y.matrixWorld),o.premultiply(g),a.extractRotation(o),T.halfWidth.set(y.width*.5,0,0),T.halfHeight.set(0,y.height*.5,0),T.halfWidth.applyMatrix4(a),T.halfHeight.applyMatrix4(a),v++}else if(y.isPointLight){const T=r.point[f];T.position.setFromMatrixPosition(y.matrixWorld),T.position.applyMatrix4(g),f++}else if(y.isHemisphereLight){const T=r.hemi[m];T.direction.setFromMatrixPosition(y.matrixWorld),T.direction.transformDirection(g),m++}}}return{setup:l,setupView:c,state:r}}function fM(n,e){const t=new TX(n,e),i=[],r=[];function s(){i.length=0,r.length=0}function o(h){i.push(h)}function a(h){r.push(h)}function l(h){t.setup(i,h)}function c(h){t.setupView(i,h)}return{init:s,state:{lightsArray:i,shadowsArray:r,lights:t},setupLights:l,setupLightsView:c,pushLight:o,pushShadow:a}}function AX(n,e){let t=new WeakMap;function i(s,o=0){const a=t.get(s);let l;return a===void 0?(l=new fM(n,e),t.set(s,[l])):o>=a.length?(l=new fM(n,e),a.push(l)):l=a[o],l}function r(){t=new WeakMap}return{get:i,dispose:r}}class fb extends En{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=SP,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class pb extends En{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}const CX="void main() {\n gl_Position = vec4( position, 1.0 );\n}",PX="uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include <packing>\nvoid main() {\n const float samples = float( VSM_SAMPLES );\n float mean = 0.0;\n float squared_mean = 0.0;\n float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n float uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n for ( float i = 0.0; i < samples; i ++ ) {\n float uvOffset = uvStart + i * uvStride;\n #ifdef HORIZONTAL_PASS\n vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );\n mean += distribution.x;\n squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n #else\n float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );\n mean += depth;\n squared_mean += depth * depth;\n #endif\n }\n mean = mean / samples;\n squared_mean = squared_mean / samples;\n float std_dev = sqrt( squared_mean - mean * mean );\n gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}";function RX(n,e,t){let i=new Bm;const r=new _e,s=new _e,o=new vt,a=new fb({depthPacking:MP}),l=new pb,c={},u=t.maxTextureSize,h={[ns]:Qn,[Qn]:ns,[bi]:bi},d=new cr({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new _e},radius:{value:4}},vertexShader:CX,fragmentShader:PX}),f=d.clone();f.defines.HORIZONTAL_PASS=1;const p=new qe;p.setAttribute("position",new At(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const v=new Be(p,d),m=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Ky;let g=this.type;this.render=function(T,S,E){if(m.enabled===!1||m.autoUpdate===!1&&m.needsUpdate===!1||T.length===0)return;const x=n.getRenderTarget(),M=n.getActiveCubeFace(),w=n.getActiveMipmapLevel(),C=n.state;C.setBlending(Ps),C.buffers.color.setClear(1,1,1,1),C.buffers.depth.setTest(!0),C.setScissorTest(!1);const L=g!==Gr&&this.type===Gr,$=g===Gr&&this.type!==Gr;for(let U=0,H=T.length;U<H;U++){const V=T[U],j=V.shadow;if(j===void 0){console.warn("THREE.WebGLShadowMap:",V,"has no shadow.");continue}if(j.autoUpdate===!1&&j.needsUpdate===!1)continue;r.copy(j.mapSize);const te=j.getFrameExtents();if(r.multiply(te),s.copy(j.mapSize),(r.x>u||r.y>u)&&(r.x>u&&(s.x=Math.floor(u/te.x),r.x=s.x*te.x,j.mapSize.x=s.x),r.y>u&&(s.y=Math.floor(u/te.y),r.y=s.y*te.y,j.mapSize.y=s.y)),j.map===null||L===!0||$===!0){const Q=this.type!==Gr?{minFilter:hn,magFilter:hn}:{};j.map!==null&&j.map.dispose(),j.map=new Lr(r.x,r.y,Q),j.map.texture.name=V.name+".shadowMap",j.camera.updateProjectionMatrix()}n.setRenderTarget(j.map),n.clear();const Z=j.getViewportCount();for(let Q=0;Q<Z;Q++){const X=j.getViewport(Q);o.set(s.x*X.x,s.y*X.y,s.x*X.z,s.y*X.w),C.viewport(o),j.updateMatrices(V,Q),i=j.getFrustum(),y(S,E,j.camera,V,this.type)}j.isPointLightShadow!==!0&&this.type===Gr&&b(j,E),j.needsUpdate=!1}g=this.type,m.needsUpdate=!1,n.setRenderTarget(x,M,w)};function b(T,S){const E=e.update(v);d.defines.VSM_SAMPLES!==T.blurSamples&&(d.defines.VSM_SAMPLES=T.blurSamples,f.defines.VSM_SAMPLES=T.blurSamples,d.needsUpdate=!0,f.needsUpdate=!0),T.mapPass===null&&(T.mapPass=new Lr(r.x,r.y)),d.uniforms.shadow_pass.value=T.map.texture,d.uniforms.resolution.value=T.mapSize,d.uniforms.radius.value=T.radius,n.setRenderTarget(T.mapPass),n.clear(),n.renderBufferDirect(S,null,E,d,v,null),f.uniforms.shadow_pass.value=T.mapPass.texture,f.uniforms.resolution.value=T.mapSize,f.uniforms.radius.value=T.radius,n.setRenderTarget(T.map),n.clear(),n.renderBufferDirect(S,null,E,f,v,null)}function _(T,S,E,x){let M=null;const w=E.isPointLight===!0?T.customDistanceMaterial:T.customDepthMaterial;if(w!==void 0)M=w;else if(M=E.isPointLight===!0?l:a,n.localClippingEnabled&&S.clipShadows===!0&&Array.isArray(S.clippingPlanes)&&S.clippingPlanes.length!==0||S.displacementMap&&S.displacementScale!==0||S.alphaMap&&S.alphaTest>0||S.map&&S.alphaTest>0){const C=M.uuid,L=S.uuid;let $=c[C];$===void 0&&($={},c[C]=$);let U=$[L];U===void 0&&(U=M.clone(),$[L]=U),M=U}if(M.visible=S.visible,M.wireframe=S.wireframe,x===Gr?M.side=S.shadowSide!==null?S.shadowSide:S.side:M.side=S.shadowSide!==null?S.shadowSide:h[S.side],M.alphaMap=S.alphaMap,M.alphaTest=S.alphaTest,M.map=S.map,M.clipShadows=S.clipShadows,M.clippingPlanes=S.clippingPlanes,M.clipIntersection=S.clipIntersection,M.displacementMap=S.displacementMap,M.displacementScale=S.displacementScale,M.displacementBias=S.displacementBias,M.wireframeLinewidth=S.wireframeLinewidth,M.linewidth=S.linewidth,E.isPointLight===!0&&M.isMeshDistanceMaterial===!0){const C=n.properties.get(M);C.light=E}return M}function y(T,S,E,x,M){if(T.visible===!1)return;if(T.layers.test(S.layers)&&(T.isMesh||T.isLine||T.isPoints)&&(T.castShadow||T.receiveShadow&&M===Gr)&&(!T.frustumCulled||i.intersectsObject(T))){T.modelViewMatrix.multiplyMatrices(E.matrixWorldInverse,T.matrixWorld);const L=e.update(T),$=T.material;if(Array.isArray($)){const U=L.groups;for(let H=0,V=U.length;H<V;H++){const j=U[H],te=$[j.materialIndex];if(te&&te.visible){const Z=_(T,te,x,M);n.renderBufferDirect(E,null,L,Z,T,j)}}}else if($.visible){const U=_(T,$,x,M);n.renderBufferDirect(E,null,L,U,T,null)}}const C=T.children;for(let L=0,$=C.length;L<$;L++)y(C[L],S,E,x,M)}}function LX(n,e,t){const i=t.isWebGL2;function r(){let K=!1;const ke=new vt;let Ie=null;const ve=new vt(0,0,0,0);return{setMask:function(Oe){Ie!==Oe&&!K&&(n.colorMask(Oe,Oe,Oe,Oe),Ie=Oe)},setLocked:function(Oe){K=Oe},setClear:function(Oe,We,bt,Ft,zn){zn===!0&&(Oe*=Ft,We*=Ft,bt*=Ft),ke.set(Oe,We,bt,Ft),ve.equals(ke)===!1&&(n.clearColor(Oe,We,bt,Ft),ve.copy(ke))},reset:function(){K=!1,Ie=null,ve.set(-1,0,0,0)}}}function s(){let K=!1,ke=null,Ie=null,ve=null;return{setTest:function(Oe){Oe?P(n.DEPTH_TEST):N(n.DEPTH_TEST)},setMask:function(Oe){ke!==Oe&&!K&&(n.depthMask(Oe),ke=Oe)},setFunc:function(Oe){if(Ie!==Oe){switch(Oe){case K2:n.depthFunc(n.NEVER);break;case Z2:n.depthFunc(n.ALWAYS);break;case J2:n.depthFunc(n.LESS);break;case Lh:n.depthFunc(n.LEQUAL);break;case Q2:n.depthFunc(n.EQUAL);break;case eP:n.depthFunc(n.GEQUAL);break;case tP:n.depthFunc(n.GREATER);break;case nP:n.depthFunc(n.NOTEQUAL);break;default:n.depthFunc(n.LEQUAL)}Ie=Oe}},setLocked:function(Oe){K=Oe},setClear:function(Oe){ve!==Oe&&(n.clearDepth(Oe),ve=Oe)},reset:function(){K=!1,ke=null,Ie=null,ve=null}}}function o(){let K=!1,ke=null,Ie=null,ve=null,Oe=null,We=null,bt=null,Ft=null,zn=null;return{setTest:function(kt){K||(kt?P(n.STENCIL_TEST):N(n.STENCIL_TEST))},setMask:function(kt){ke!==kt&&!K&&(n.stencilMask(kt),ke=kt)},setFunc:function(kt,ti,Br){(Ie!==kt||ve!==ti||Oe!==Br)&&(n.stencilFunc(kt,ti,Br),Ie=kt,ve=ti,Oe=Br)},setOp:function(kt,ti,Br){(We!==kt||bt!==ti||Ft!==Br)&&(n.stencilOp(kt,ti,Br),We=kt,bt=ti,Ft=Br)},setLocked:function(kt){K=kt},setClear:function(kt){zn!==kt&&(n.clearStencil(kt),zn=kt)},reset:function(){K=!1,ke=null,Ie=null,ve=null,Oe=null,We=null,bt=null,Ft=null,zn=null}}}const a=new r,l=new s,c=new o,u=new WeakMap,h=new WeakMap;let d={},f={},p=new WeakMap,v=[],m=null,g=!1,b=null,_=null,y=null,T=null,S=null,E=null,x=null,M=new Pe(0,0,0),w=0,C=!1,L=null,$=null,U=null,H=null,V=null;const j=n.getParameter(n.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let te=!1,Z=0;const Q=n.getParameter(n.VERSION);Q.indexOf("WebGL")!==-1?(Z=parseFloat(/^WebGL (\d)/.exec(Q)[1]),te=Z>=1):Q.indexOf("OpenGL ES")!==-1&&(Z=parseFloat(/^OpenGL ES (\d)/.exec(Q)[1]),te=Z>=2);let X=null,re={};const W=n.getParameter(n.SCISSOR_BOX),we=n.getParameter(n.VIEWPORT),Re=new vt().fromArray(W),De=new vt().fromArray(we);function ne(K,ke,Ie,ve){const Oe=new Uint8Array(4),We=n.createTexture();n.bindTexture(K,We),n.texParameteri(K,n.TEXTURE_MIN_FILTER,n.NEAREST),n.texParameteri(K,n.TEXTURE_MAG_FILTER,n.NEAREST);for(let bt=0;bt<Ie;bt++)i&&(K===n.TEXTURE_3D||K===n.TEXTURE_2D_ARRAY)?n.texImage3D(ke,0,n.RGBA,1,1,ve,0,n.RGBA,n.UNSIGNED_BYTE,Oe):n.texImage2D(ke+bt,0,n.RGBA,1,1,0,n.RGBA,n.UNSIGNED_BYTE,Oe);return We}const q={};q[n.TEXTURE_2D]=ne(n.TEXTURE_2D,n.TEXTURE_2D,1),q[n.TEXTURE_CUBE_MAP]=ne(n.TEXTURE_CUBE_MAP,n.TEXTURE_CUBE_MAP_POSITIVE_X,6),i&&(q[n.TEXTURE_2D_ARRAY]=ne(n.TEXTURE_2D_ARRAY,n.TEXTURE_2D_ARRAY,1,1),q[n.TEXTURE_3D]=ne(n.TEXTURE_3D,n.TEXTURE_3D,1,1)),a.setClear(0,0,0,1),l.setClear(1),c.setClear(0),P(n.DEPTH_TEST),l.setFunc(Lh),ae(!1),se(D0),P(n.CULL_FACE),G(Ps);function P(K){d[K]!==!0&&(n.enable(K),d[K]=!0)}function N(K){d[K]!==!1&&(n.disable(K),d[K]=!1)}function B(K,ke){return f[K]!==ke?(n.bindFramebuffer(K,ke),f[K]=ke,i&&(K===n.DRAW_FRAMEBUFFER&&(f[n.FRAMEBUFFER]=ke),K===n.FRAMEBUFFER&&(f[n.DRAW_FRAMEBUFFER]=ke)),!0):!1}function A(K,ke){let Ie=v,ve=!1;if(K)if(Ie=p.get(ke),Ie===void 0&&(Ie=[],p.set(ke,Ie)),K.isWebGLMultipleRenderTargets){const Oe=K.texture;if(Ie.length!==Oe.length||Ie[0]!==n.COLOR_ATTACHMENT0){for(let We=0,bt=Oe.length;We<bt;We++)Ie[We]=n.COLOR_ATTACHMENT0+We;Ie.length=Oe.length,ve=!0}}else Ie[0]!==n.COLOR_ATTACHMENT0&&(Ie[0]=n.COLOR_ATTACHMENT0,ve=!0);else Ie[0]!==n.BACK&&(Ie[0]=n.BACK,ve=!0);ve&&(t.isWebGL2?n.drawBuffers(Ie):e.get("WEBGL_draw_buffers").drawBuffersWEBGL(Ie))}function R(K){return m!==K?(n.useProgram(K),m=K,!0):!1}const I={[yo]:n.FUNC_ADD,[U2]:n.FUNC_SUBTRACT,[N2]:n.FUNC_REVERSE_SUBTRACT};if(i)I[F0]=n.MIN,I[k0]=n.MAX;else{const K=e.get("EXT_blend_minmax");K!==null&&(I[F0]=K.MIN_EXT,I[k0]=K.MAX_EXT)}const z={[F2]:n.ZERO,[k2]:n.ONE,[B2]:n.SRC_COLOR,[zp]:n.SRC_ALPHA,[$2]:n.SRC_ALPHA_SATURATE,[G2]:n.DST_COLOR,[V2]:n.DST_ALPHA,[z2]:n.ONE_MINUS_SRC_COLOR,[Vp]:n.ONE_MINUS_SRC_ALPHA,[W2]:n.ONE_MINUS_DST_COLOR,[H2]:n.ONE_MINUS_DST_ALPHA,[j2]:n.CONSTANT_COLOR,[X2]:n.ONE_MINUS_CONSTANT_COLOR,[Y2]:n.CONSTANT_ALPHA,[q2]:n.ONE_MINUS_CONSTANT_ALPHA};function G(K,ke,Ie,ve,Oe,We,bt,Ft,zn,kt){if(K===Ps){g===!0&&(N(n.BLEND),g=!1);return}if(g===!1&&(P(n.BLEND),g=!0),K!==D2){if(K!==b||kt!==C){if((_!==yo||S!==yo)&&(n.blendEquation(n.FUNC_ADD),_=yo,S=yo),kt)switch(K){case Ra:n.blendFuncSeparate(n.ONE,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break;case Bp:n.blendFunc(n.ONE,n.ONE);break;case U0:n.blendFuncSeparate(n.ZERO,n.ONE_MINUS_SRC_COLOR,n.ZERO,n.ONE);break;case N0:n.blendFuncSeparate(n.ZERO,n.SRC_COLOR,n.ZERO,n.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",K);break}else switch(K){case Ra:n.blendFuncSeparate(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break;case Bp:n.blendFunc(n.SRC_ALPHA,n.ONE);break;case U0:n.blendFuncSeparate(n.ZERO,n.ONE_MINUS_SRC_COLOR,n.ZERO,n.ONE);break;case N0:n.blendFunc(n.ZERO,n.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",K);break}y=null,T=null,E=null,x=null,M.set(0,0,0),w=0,b=K,C=kt}return}Oe=Oe||ke,We=We||Ie,bt=bt||ve,(ke!==_||Oe!==S)&&(n.blendEquationSeparate(I[ke],I[Oe]),_=ke,S=Oe),(Ie!==y||ve!==T||We!==E||bt!==x)&&(n.blendFuncSeparate(z[Ie],z[ve],z[We],z[bt]),y=Ie,T=ve,E=We,x=bt),(Ft.equals(M)===!1||zn!==w)&&(n.blendColor(Ft.r,Ft.g,Ft.b,zn),M.copy(Ft),w=zn),b=K,C=!1}function ee(K,ke){K.side===bi?N(n.CULL_FACE):P(n.CULL_FACE);let Ie=K.side===Qn;ke&&(Ie=!Ie),ae(Ie),K.blending===Ra&&K.transparent===!1?G(Ps):G(K.blending,K.blendEquation,K.blendSrc,K.blendDst,K.blendEquationAlpha,K.blendSrcAlpha,K.blendDstAlpha,K.blendColor,K.blendAlpha,K.premultipliedAlpha),l.setFunc(K.depthFunc),l.setTest(K.depthTest),l.setMask(K.depthWrite),a.setMask(K.colorWrite);const ve=K.stencilWrite;c.setTest(ve),ve&&(c.setMask(K.stencilWriteMask),c.setFunc(K.stencilFunc,K.stencilRef,K.stencilFuncMask),c.setOp(K.stencilFail,K.stencilZFail,K.stencilZPass)),le(K.polygonOffset,K.polygonOffsetFactor,K.polygonOffsetUnits),K.alphaToCoverage===!0?P(n.SAMPLE_ALPHA_TO_COVERAGE):N(n.SAMPLE_ALPHA_TO_COVERAGE)}function ae(K){L!==K&&(K?n.frontFace(n.CW):n.frontFace(n.CCW),L=K)}function se(K){K!==O2?(P(n.CULL_FACE),K!==$&&(K===D0?n.cullFace(n.BACK):K===I2?n.cullFace(n.FRONT):n.cullFace(n.FRONT_AND_BACK))):N(n.CULL_FACE),$=K}function ce(K){K!==U&&(te&&n.lineWidth(K),U=K)}function le(K,ke,Ie){K?(P(n.POLYGON_OFFSET_FILL),(H!==ke||V!==Ie)&&(n.polygonOffset(ke,Ie),H=ke,V=Ie)):N(n.POLYGON_OFFSET_FILL)}function Me(K){K?P(n.SCISSOR_TEST):N(n.SCISSOR_TEST)}function F(K){K===void 0&&(K=n.TEXTURE0+j-1),X!==K&&(n.activeTexture(K),X=K)}function O(K,ke,Ie){Ie===void 0&&(X===null?Ie=n.TEXTURE0+j-1:Ie=X);let ve=re[Ie];ve===void 0&&(ve={type:void 0,texture:void 0},re[Ie]=ve),(ve.type!==K||ve.texture!==ke)&&(X!==Ie&&(n.activeTexture(Ie),X=Ie),n.bindTexture(K,ke||q[K]),ve.type=K,ve.texture=ke)}function J(){const K=re[X];K!==void 0&&K.type!==void 0&&(n.bindTexture(K.type,null),K.type=void 0,K.texture=void 0)}function ge(){try{n.compressedTexImage2D.apply(n,arguments)}catch(K){console.error("THREE.WebGLState:",K)}}function de(){try{n.compressedTexImage3D.apply(n,arguments)}catch(K){console.error("THREE.WebGLState:",K)}}function be(){try{n.texSubImage2D.apply(n,arguments)}catch(K){console.error("THREE.WebGLState:",K)}}function Ne(){try{n.texSubImage3D.apply(n,arguments)}catch(K){console.error("THREE.WebGLState:",K)}}function Ae(){try{n.compressedTexSubImage2D.apply(n,arguments)}catch(K){console.error("THREE.WebGLState:",K)}}function Fe(){try{n.compressedTexSubImage3D.apply(n,arguments)}catch(K){console.error("THREE.WebGLState:",K)}}function je(){try{n.texStorage2D.apply(n,arguments)}catch(K){console.error("THREE.WebGLState:",K)}}function dt(){try{n.texStorage3D.apply(n,arguments)}catch(K){console.error("THREE.WebGLState:",K)}}function Le(){try{n.texImage2D.apply(n,arguments)}catch(K){console.error("THREE.WebGLState:",K)}}function et(){try{n.texImage3D.apply(n,arguments)}catch(K){console.error("THREE.WebGLState:",K)}}function Y(K){Re.equals(K)===!1&&(n.scissor(K.x,K.y,K.z,K.w),Re.copy(K))}function fe(K){De.equals(K)===!1&&(n.viewport(K.x,K.y,K.z,K.w),De.copy(K))}function Ee(K,ke){let Ie=h.get(ke);Ie===void 0&&(Ie=new WeakMap,h.set(ke,Ie));let ve=Ie.get(K);ve===void 0&&(ve=n.getUniformBlockIndex(ke,K.name),Ie.set(K,ve))}function Ce(K,ke){const ve=h.get(ke).get(K);u.get(ke)!==ve&&(n.uniformBlockBinding(ke,ve,K.__bindingPointIndex),u.set(ke,ve))}function Ke(){n.disable(n.BLEND),n.disable(n.CULL_FACE),n.disable(n.DEPTH_TEST),n.disable(n.POLYGON_OFFSET_FILL),n.disable(n.SCISSOR_TEST),n.disable(n.STENCIL_TEST),n.disable(n.SAMPLE_ALPHA_TO_COVERAGE),n.blendEquation(n.FUNC_ADD),n.blendFunc(n.ONE,n.ZERO),n.blendFuncSeparate(n.ONE,n.ZERO,n.ONE,n.ZERO),n.blendColor(0,0,0,0),n.colorMask(!0,!0,!0,!0),n.clearColor(0,0,0,0),n.depthMask(!0),n.depthFunc(n.LESS),n.clearDepth(1),n.stencilMask(4294967295),n.stencilFunc(n.ALWAYS,0,4294967295),n.stencilOp(n.KEEP,n.KEEP,n.KEEP),n.clearStencil(0),n.cullFace(n.BACK),n.frontFace(n.CCW),n.polygonOffset(0,0),n.activeTexture(n.TEXTURE0),n.bindFramebuffer(n.FRAMEBUFFER,null),i===!0&&(n.bindFramebuffer(n.DRAW_FRAMEBUFFER,null),n.bindFramebuffer(n.READ_FRAMEBUFFER,null)),n.useProgram(null),n.lineWidth(1),n.scissor(0,0,n.canvas.width,n.canvas.height),n.viewport(0,0,n.canvas.width,n.canvas.height),d={},X=null,re={},f={},p=new WeakMap,v=[],m=null,g=!1,b=null,_=null,y=null,T=null,S=null,E=null,x=null,M=new Pe(0,0,0),w=0,C=!1,L=null,$=null,U=null,H=null,V=null,Re.set(0,0,n.canvas.width,n.canvas.height),De.set(0,0,n.canvas.width,n.canvas.height),a.reset(),l.reset(),c.reset()}return{buffers:{color:a,depth:l,stencil:c},enable:P,disable:N,bindFramebuffer:B,drawBuffers:A,useProgram:R,setBlending:G,setMaterial:ee,setFlipSided:ae,setCullFace:se,setLineWidth:ce,setPolygonOffset:le,setScissorTest:Me,activeTexture:F,bindTexture:O,unbindTexture:J,compressedTexImage2D:ge,compressedTexImage3D:de,texImage2D:Le,texImage3D:et,updateUBOMapping:Ee,uniformBlockBinding:Ce,texStorage2D:je,texStorage3D:dt,texSubImage2D:be,texSubImage3D:Ne,compressedTexSubImage2D:Ae,compressedTexSubImage3D:Fe,scissor:Y,viewport:fe,reset:Ke}}function OX(n,e,t,i,r,s,o){const a=r.isWebGL2,l=r.maxTextures,c=r.maxCubemapSize,u=r.maxTextureSize,h=r.maxSamples,d=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,f=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),p=new WeakMap;let v;const m=new WeakMap;let g=!1;try{g=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch(F){}function b(F,O){return g?new OffscreenCanvas(F,O):zh("canvas")}function _(F,O,J,ge){let de=1;if((F.width>ge||F.height>ge)&&(de=ge/Math.max(F.width,F.height)),de<1||O===!0)if(typeof HTMLImageElement<"u"&&F instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&F instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&F instanceof ImageBitmap){const be=O?Wp:Math.floor,Ne=be(de*F.width),Ae=be(de*F.height);v===void 0&&(v=b(Ne,Ae));const Fe=J?b(Ne,Ae):v;return Fe.width=Ne,Fe.height=Ae,Fe.getContext("2d").drawImage(F,0,0,Ne,Ae),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+F.width+"x"+F.height+") to ("+Ne+"x"+Ae+")."),Fe}else return"data"in F&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+F.width+"x"+F.height+")."),F;return F}function y(F){return f_(F.width)&&f_(F.height)}function T(F){return a?!1:F.wrapS!==Rn||F.wrapT!==Rn||F.minFilter!==hn&&F.minFilter!==rn}function S(F,O){return F.generateMipmaps&&O&&F.minFilter!==hn&&F.minFilter!==rn}function E(F){n.generateMipmap(F)}function x(F,O,J,ge,de=!1){if(a===!1)return O;if(F!==null){if(n[F]!==void 0)return n[F];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+F+"'")}let be=O;if(O===n.RED&&(J===n.FLOAT&&(be=n.R32F),J===n.HALF_FLOAT&&(be=n.R16F),J===n.UNSIGNED_BYTE&&(be=n.R8)),O===n.RED_INTEGER&&(J===n.UNSIGNED_BYTE&&(be=n.R8UI),J===n.UNSIGNED_SHORT&&(be=n.R16UI),J===n.UNSIGNED_INT&&(be=n.R32UI),J===n.BYTE&&(be=n.R8I),J===n.SHORT&&(be=n.R16I),J===n.INT&&(be=n.R32I)),O===n.RG&&(J===n.FLOAT&&(be=n.RG32F),J===n.HALF_FLOAT&&(be=n.RG16F),J===n.UNSIGNED_BYTE&&(be=n.RG8)),O===n.RGBA){const Ne=de?Uh:Ut.getTransfer(ge);J===n.FLOAT&&(be=n.RGBA32F),J===n.HALF_FLOAT&&(be=n.RGBA16F),J===n.UNSIGNED_BYTE&&(be=Ne===Ht?n.SRGB8_ALPHA8:n.RGBA8),J===n.UNSIGNED_SHORT_4_4_4_4&&(be=n.RGBA4),J===n.UNSIGNED_SHORT_5_5_5_1&&(be=n.RGB5_A1)}return(be===n.R16F||be===n.R32F||be===n.RG16F||be===n.RG32F||be===n.RGBA16F||be===n.RGBA32F)&&e.get("EXT_color_buffer_float"),be}function M(F,O,J){return S(F,J)===!0||F.isFramebufferTexture&&F.minFilter!==hn&&F.minFilter!==rn?Math.log2(Math.max(O.width,O.height))+1:F.mipmaps!==void 0&&F.mipmaps.length>0?F.mipmaps.length:F.isCompressedTexture&&Array.isArray(F.image)?O.mipmaps.length:1}function w(F){return F===hn||F===Ih||F===hc?n.NEAREST:n.LINEAR}function C(F){const O=F.target;O.removeEventListener("dispose",C),$(O),O.isVideoTexture&&p.delete(O)}function L(F){const O=F.target;O.removeEventListener("dispose",L),H(O)}function $(F){const O=i.get(F);if(O.__webglInit===void 0)return;const J=F.source,ge=m.get(J);if(ge){const de=ge[O.__cacheKey];de.usedTimes--,de.usedTimes===0&&U(F),Object.keys(ge).length===0&&m.delete(J)}i.remove(F)}function U(F){const O=i.get(F);n.deleteTexture(O.__webglTexture);const J=F.source,ge=m.get(J);delete ge[O.__cacheKey],o.memory.textures--}function H(F){const O=F.texture,J=i.get(F),ge=i.get(O);if(ge.__webglTexture!==void 0&&(n.deleteTexture(ge.__webglTexture),o.memory.textures--),F.depthTexture&&F.depthTexture.dispose(),F.isWebGLCubeRenderTarget)for(let de=0;de<6;de++){if(Array.isArray(J.__webglFramebuffer[de]))for(let be=0;be<J.__webglFramebuffer[de].length;be++)n.deleteFramebuffer(J.__webglFramebuffer[de][be]);else n.deleteFramebuffer(J.__webglFramebuffer[de]);J.__webglDepthbuffer&&n.deleteRenderbuffer(J.__webglDepthbuffer[de])}else{if(Array.isArray(J.__webglFramebuffer))for(let de=0;de<J.__webglFramebuffer.length;de++)n.deleteFramebuffer(J.__webglFramebuffer[de]);else n.deleteFramebuffer(J.__webglFramebuffer);if(J.__webglDepthbuffer&&n.deleteRenderbuffer(J.__webglDepthbuffer),J.__webglMultisampledFramebuffer&&n.deleteFramebuffer(J.__webglMultisampledFramebuffer),J.__webglColorRenderbuffer)for(let de=0;de<J.__webglColorRenderbuffer.length;de++)J.__webglColorRenderbuffer[de]&&n.deleteRenderbuffer(J.__webglColorRenderbuffer[de]);J.__webglDepthRenderbuffer&&n.deleteRenderbuffer(J.__webglDepthRenderbuffer)}if(F.isWebGLMultipleRenderTargets)for(let de=0,be=O.length;de<be;de++){const Ne=i.get(O[de]);Ne.__webglTexture&&(n.deleteTexture(Ne.__webglTexture),o.memory.textures--),i.remove(O[de])}i.remove(O),i.remove(F)}let V=0;function j(){V=0}function te(){const F=V;return F>=l&&console.warn("THREE.WebGLTextures: Trying to use "+F+" texture units while this GPU supports only "+l),V+=1,F}function Z(F){const O=[];return O.push(F.wrapS),O.push(F.wrapT),O.push(F.wrapR||0),O.push(F.magFilter),O.push(F.minFilter),O.push(F.anisotropy),O.push(F.internalFormat),O.push(F.format),O.push(F.type),O.push(F.generateMipmaps),O.push(F.premultiplyAlpha),O.push(F.flipY),O.push(F.unpackAlignment),O.push(F.colorSpace),O.join()}function Q(F,O){const J=i.get(F);if(F.isVideoTexture&&le(F),F.isRenderTargetTexture===!1&&F.version>0&&J.__version!==F.version){const ge=F.image;if(ge===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(ge.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{P(J,F,O);return}}t.bindTexture(n.TEXTURE_2D,J.__webglTexture,n.TEXTURE0+O)}function X(F,O){const J=i.get(F);if(F.version>0&&J.__version!==F.version){P(J,F,O);return}t.bindTexture(n.TEXTURE_2D_ARRAY,J.__webglTexture,n.TEXTURE0+O)}function re(F,O){const J=i.get(F);if(F.version>0&&J.__version!==F.version){P(J,F,O);return}t.bindTexture(n.TEXTURE_3D,J.__webglTexture,n.TEXTURE0+O)}function W(F,O){const J=i.get(F);if(F.version>0&&J.__version!==F.version){N(J,F,O);return}t.bindTexture(n.TEXTURE_CUBE_MAP,J.__webglTexture,n.TEXTURE0+O)}const we={[is]:n.REPEAT,[Rn]:n.CLAMP_TO_EDGE,[Ac]:n.MIRRORED_REPEAT},Re={[hn]:n.NEAREST,[Ih]:n.NEAREST_MIPMAP_NEAREST,[hc]:n.NEAREST_MIPMAP_LINEAR,[rn]:n.LINEAR,[Lm]:n.LINEAR_MIPMAP_NEAREST,[rs]:n.LINEAR_MIPMAP_LINEAR},De={[TP]:n.NEVER,[IP]:n.ALWAYS,[AP]:n.LESS,[PP]:n.LEQUAL,[CP]:n.EQUAL,[OP]:n.GEQUAL,[RP]:n.GREATER,[LP]:n.NOTEQUAL};function ne(F,O,J){if(J?(n.texParameteri(F,n.TEXTURE_WRAP_S,we[O.wrapS]),n.texParameteri(F,n.TEXTURE_WRAP_T,we[O.wrapT]),(F===n.TEXTURE_3D||F===n.TEXTURE_2D_ARRAY)&&n.texParameteri(F,n.TEXTURE_WRAP_R,we[O.wrapR]),n.texParameteri(F,n.TEXTURE_MAG_FILTER,Re[O.magFilter]),n.texParameteri(F,n.TEXTURE_MIN_FILTER,Re[O.minFilter])):(n.texParameteri(F,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(F,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),(F===n.TEXTURE_3D||F===n.TEXTURE_2D_ARRAY)&&n.texParameteri(F,n.TEXTURE_WRAP_R,n.CLAMP_TO_EDGE),(O.wrapS!==Rn||O.wrapT!==Rn)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),n.texParameteri(F,n.TEXTURE_MAG_FILTER,w(O.magFilter)),n.texParameteri(F,n.TEXTURE_MIN_FILTER,w(O.minFilter)),O.minFilter!==hn&&O.minFilter!==rn&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),O.compareFunction&&(n.texParameteri(F,n.TEXTURE_COMPARE_MODE,n.COMPARE_REF_TO_TEXTURE),n.texParameteri(F,n.TEXTURE_COMPARE_FUNC,De[O.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){const ge=e.get("EXT_texture_filter_anisotropic");if(O.magFilter===hn||O.minFilter!==hc&&O.minFilter!==rs||O.type===jr&&e.has("OES_texture_float_linear")===!1||a===!1&&O.type===Cc&&e.has("OES_texture_half_float_linear")===!1)return;(O.anisotropy>1||i.get(O).__currentAnisotropy)&&(n.texParameterf(F,ge.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(O.anisotropy,r.getMaxAnisotropy())),i.get(O).__currentAnisotropy=O.anisotropy)}}function q(F,O){let J=!1;F.__webglInit===void 0&&(F.__webglInit=!0,O.addEventListener("dispose",C));const ge=O.source;let de=m.get(ge);de===void 0&&(de={},m.set(ge,de));const be=Z(O);if(be!==F.__cacheKey){de[be]===void 0&&(de[be]={texture:n.createTexture(),usedTimes:0},o.memory.textures++,J=!0),de[be].usedTimes++;const Ne=de[F.__cacheKey];Ne!==void 0&&(de[F.__cacheKey].usedTimes--,Ne.usedTimes===0&&U(O)),F.__cacheKey=be,F.__webglTexture=de[be].texture}return J}function P(F,O,J){let ge=n.TEXTURE_2D;(O.isDataArrayTexture||O.isCompressedArrayTexture)&&(ge=n.TEXTURE_2D_ARRAY),O.isData3DTexture&&(ge=n.TEXTURE_3D);const de=q(F,O),be=O.source;t.bindTexture(ge,F.__webglTexture,n.TEXTURE0+J);const Ne=i.get(be);if(be.version!==Ne.__version||de===!0){t.activeTexture(n.TEXTURE0+J);const Ae=Ut.getPrimaries(Ut.workingColorSpace),Fe=O.colorSpace===Bi?null:Ut.getPrimaries(O.colorSpace),je=O.colorSpace===Bi||Ae===Fe?n.NONE:n.BROWSER_DEFAULT_WEBGL;n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,O.flipY),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,O.premultiplyAlpha),n.pixelStorei(n.UNPACK_ALIGNMENT,O.unpackAlignment),n.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,je);const dt=T(O)&&y(O.image)===!1;let Le=_(O.image,dt,!1,u);Le=Me(O,Le);const et=y(Le)||a,Y=s.convert(O.format,O.colorSpace);let fe=s.convert(O.type),Ee=x(O.internalFormat,Y,fe,O.colorSpace,O.isVideoTexture);ne(ge,O,et);let Ce;const Ke=O.mipmaps,K=a&&O.isVideoTexture!==!0,ke=Ne.__version===void 0||de===!0,Ie=M(O,Le,et);if(O.isDepthTexture)Ee=n.DEPTH_COMPONENT,a?O.type===jr?Ee=n.DEPTH_COMPONENT32F:O.type===Ts?Ee=n.DEPTH_COMPONENT24:O.type===Ao?Ee=n.DEPTH24_STENCIL8:Ee=n.DEPTH_COMPONENT16:O.type===jr&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),O.format===Co&&Ee===n.DEPTH_COMPONENT&&O.type!==Om&&O.type!==Ts&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),O.type=Ts,fe=s.convert(O.type)),O.format===za&&Ee===n.DEPTH_COMPONENT&&(Ee=n.DEPTH_STENCIL,O.type!==Ao&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),O.type=Ao,fe=s.convert(O.type))),ke&&(K?t.texStorage2D(n.TEXTURE_2D,1,Ee,Le.width,Le.height):t.texImage2D(n.TEXTURE_2D,0,Ee,Le.width,Le.height,0,Y,fe,null));else if(O.isDataTexture)if(Ke.length>0&&et){K&&ke&&t.texStorage2D(n.TEXTURE_2D,Ie,Ee,Ke[0].width,Ke[0].height);for(let ve=0,Oe=Ke.length;ve<Oe;ve++)Ce=Ke[ve],K?t.texSubImage2D(n.TEXTURE_2D,ve,0,0,Ce.width,Ce.height,Y,fe,Ce.data):t.texImage2D(n.TEXTURE_2D,ve,Ee,Ce.width,Ce.height,0,Y,fe,Ce.data);O.generateMipmaps=!1}else K?(ke&&t.texStorage2D(n.TEXTURE_2D,Ie,Ee,Le.width,Le.height),t.texSubImage2D(n.TEXTURE_2D,0,0,0,Le.width,Le.height,Y,fe,Le.data)):t.texImage2D(n.TEXTURE_2D,0,Ee,Le.width,Le.height,0,Y,fe,Le.data);else if(O.isCompressedTexture)if(O.isCompressedArrayTexture){K&&ke&&t.texStorage3D(n.TEXTURE_2D_ARRAY,Ie,Ee,Ke[0].width,Ke[0].height,Le.depth);for(let ve=0,Oe=Ke.length;ve<Oe;ve++)Ce=Ke[ve],O.format!==ki?Y!==null?K?t.compressedTexSubImage3D(n.TEXTURE_2D_ARRAY,ve,0,0,0,Ce.width,Ce.height,Le.depth,Y,Ce.data,0,0):t.compressedTexImage3D(n.TEXTURE_2D_ARRAY,ve,Ee,Ce.width,Ce.height,Le.depth,0,Ce.data,0,0):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):K?t.texSubImage3D(n.TEXTURE_2D_ARRAY,ve,0,0,0,Ce.width,Ce.height,Le.depth,Y,fe,Ce.data):t.texImage3D(n.TEXTURE_2D_ARRAY,ve,Ee,Ce.width,Ce.height,Le.depth,0,Y,fe,Ce.data)}else{K&&ke&&t.texStorage2D(n.TEXTURE_2D,Ie,Ee,Ke[0].width,Ke[0].height);for(let ve=0,Oe=Ke.length;ve<Oe;ve++)Ce=Ke[ve],O.format!==ki?Y!==null?K?t.compressedTexSubImage2D(n.TEXTURE_2D,ve,0,0,Ce.width,Ce.height,Y,Ce.data):t.compressedTexImage2D(n.TEXTURE_2D,ve,Ee,Ce.width,Ce.height,0,Ce.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):K?t.texSubImage2D(n.TEXTURE_2D,ve,0,0,Ce.width,Ce.height,Y,fe,Ce.data):t.texImage2D(n.TEXTURE_2D,ve,Ee,Ce.width,Ce.height,0,Y,fe,Ce.data)}else if(O.isDataArrayTexture)K?(ke&&t.texStorage3D(n.TEXTURE_2D_ARRAY,Ie,Ee,Le.width,Le.height,Le.depth),t.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,0,Le.width,Le.height,Le.depth,Y,fe,Le.data)):t.texImage3D(n.TEXTURE_2D_ARRAY,0,Ee,Le.width,Le.height,Le.depth,0,Y,fe,Le.data);else if(O.isData3DTexture)K?(ke&&t.texStorage3D(n.TEXTURE_3D,Ie,Ee,Le.width,Le.height,Le.depth),t.texSubImage3D(n.TEXTURE_3D,0,0,0,0,Le.width,Le.height,Le.depth,Y,fe,Le.data)):t.texImage3D(n.TEXTURE_3D,0,Ee,Le.width,Le.height,Le.depth,0,Y,fe,Le.data);else if(O.isFramebufferTexture){if(ke)if(K)t.texStorage2D(n.TEXTURE_2D,Ie,Ee,Le.width,Le.height);else{let ve=Le.width,Oe=Le.height;for(let We=0;We<Ie;We++)t.texImage2D(n.TEXTURE_2D,We,Ee,ve,Oe,0,Y,fe,null),ve>>=1,Oe>>=1}}else if(Ke.length>0&&et){K&&ke&&t.texStorage2D(n.TEXTURE_2D,Ie,Ee,Ke[0].width,Ke[0].height);for(let ve=0,Oe=Ke.length;ve<Oe;ve++)Ce=Ke[ve],K?t.texSubImage2D(n.TEXTURE_2D,ve,0,0,Y,fe,Ce):t.texImage2D(n.TEXTURE_2D,ve,Ee,Y,fe,Ce);O.generateMipmaps=!1}else K?(ke&&t.texStorage2D(n.TEXTURE_2D,Ie,Ee,Le.width,Le.height),t.texSubImage2D(n.TEXTURE_2D,0,0,0,Y,fe,Le)):t.texImage2D(n.TEXTURE_2D,0,Ee,Y,fe,Le);S(O,et)&&E(ge),Ne.__version=be.version,O.onUpdate&&O.onUpdate(O)}F.__version=O.version}function N(F,O,J){if(O.image.length!==6)return;const ge=q(F,O),de=O.source;t.bindTexture(n.TEXTURE_CUBE_MAP,F.__webglTexture,n.TEXTURE0+J);const be=i.get(de);if(de.version!==be.__version||ge===!0){t.activeTexture(n.TEXTURE0+J);const Ne=Ut.getPrimaries(Ut.workingColorSpace),Ae=O.colorSpace===Bi?null:Ut.getPrimaries(O.colorSpace),Fe=O.colorSpace===Bi||Ne===Ae?n.NONE:n.BROWSER_DEFAULT_WEBGL;n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,O.flipY),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,O.premultiplyAlpha),n.pixelStorei(n.UNPACK_ALIGNMENT,O.unpackAlignment),n.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,Fe);const je=O.isCompressedTexture||O.image[0].isCompressedTexture,dt=O.image[0]&&O.image[0].isDataTexture,Le=[];for(let ve=0;ve<6;ve++)!je&&!dt?Le[ve]=_(O.image[ve],!1,!0,c):Le[ve]=dt?O.image[ve].image:O.image[ve],Le[ve]=Me(O,Le[ve]);const et=Le[0],Y=y(et)||a,fe=s.convert(O.format,O.colorSpace),Ee=s.convert(O.type),Ce=x(O.internalFormat,fe,Ee,O.colorSpace),Ke=a&&O.isVideoTexture!==!0,K=be.__version===void 0||ge===!0;let ke=M(O,et,Y);ne(n.TEXTURE_CUBE_MAP,O,Y);let Ie;if(je){Ke&&K&&t.texStorage2D(n.TEXTURE_CUBE_MAP,ke,Ce,et.width,et.height);for(let ve=0;ve<6;ve++){Ie=Le[ve].mipmaps;for(let Oe=0;Oe<Ie.length;Oe++){const We=Ie[Oe];O.format!==ki?fe!==null?Ke?t.compressedTexSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+ve,Oe,0,0,We.width,We.height,fe,We.data):t.compressedTexImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+ve,Oe,Ce,We.width,We.height,0,We.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):Ke?t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+ve,Oe,0,0,We.width,We.height,fe,Ee,We.data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+ve,Oe,Ce,We.width,We.height,0,fe,Ee,We.data)}}}else{Ie=O.mipmaps,Ke&&K&&(Ie.length>0&&ke++,t.texStorage2D(n.TEXTURE_CUBE_MAP,ke,Ce,Le[0].width,Le[0].height));for(let ve=0;ve<6;ve++)if(dt){Ke?t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+ve,0,0,0,Le[ve].width,Le[ve].height,fe,Ee,Le[ve].data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+ve,0,Ce,Le[ve].width,Le[ve].height,0,fe,Ee,Le[ve].data);for(let Oe=0;Oe<Ie.length;Oe++){const bt=Ie[Oe].image[ve].image;Ke?t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+ve,Oe+1,0,0,bt.width,bt.height,fe,Ee,bt.data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+ve,Oe+1,Ce,bt.width,bt.height,0,fe,Ee,bt.data)}}else{Ke?t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+ve,0,0,0,fe,Ee,Le[ve]):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+ve,0,Ce,fe,Ee,Le[ve]);for(let Oe=0;Oe<Ie.length;Oe++){const We=Ie[Oe];Ke?t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+ve,Oe+1,0,0,fe,Ee,We.image[ve]):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+ve,Oe+1,Ce,fe,Ee,We.image[ve])}}}S(O,Y)&&E(n.TEXTURE_CUBE_MAP),be.__version=de.version,O.onUpdate&&O.onUpdate(O)}F.__version=O.version}function B(F,O,J,ge,de,be){const Ne=s.convert(J.format,J.colorSpace),Ae=s.convert(J.type),Fe=x(J.internalFormat,Ne,Ae,J.colorSpace);if(!i.get(O).__hasExternalTextures){const dt=Math.max(1,O.width>>be),Le=Math.max(1,O.height>>be);de===n.TEXTURE_3D||de===n.TEXTURE_2D_ARRAY?t.texImage3D(de,be,Fe,dt,Le,O.depth,0,Ne,Ae,null):t.texImage2D(de,be,Fe,dt,Le,0,Ne,Ae,null)}t.bindFramebuffer(n.FRAMEBUFFER,F),ce(O)?d.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,ge,de,i.get(J).__webglTexture,0,se(O)):(de===n.TEXTURE_2D||de>=n.TEXTURE_CUBE_MAP_POSITIVE_X&&de<=n.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&n.framebufferTexture2D(n.FRAMEBUFFER,ge,de,i.get(J).__webglTexture,be),t.bindFramebuffer(n.FRAMEBUFFER,null)}function A(F,O,J){if(n.bindRenderbuffer(n.RENDERBUFFER,F),O.depthBuffer&&!O.stencilBuffer){let ge=a===!0?n.DEPTH_COMPONENT24:n.DEPTH_COMPONENT16;if(J||ce(O)){const de=O.depthTexture;de&&de.isDepthTexture&&(de.type===jr?ge=n.DEPTH_COMPONENT32F:de.type===Ts&&(ge=n.DEPTH_COMPONENT24));const be=se(O);ce(O)?d.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,be,ge,O.width,O.height):n.renderbufferStorageMultisample(n.RENDERBUFFER,be,ge,O.width,O.height)}else n.renderbufferStorage(n.RENDERBUFFER,ge,O.width,O.height);n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.RENDERBUFFER,F)}else if(O.depthBuffer&&O.stencilBuffer){const ge=se(O);J&&ce(O)===!1?n.renderbufferStorageMultisample(n.RENDERBUFFER,ge,n.DEPTH24_STENCIL8,O.width,O.height):ce(O)?d.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,ge,n.DEPTH24_STENCIL8,O.width,O.height):n.renderbufferStorage(n.RENDERBUFFER,n.DEPTH_STENCIL,O.width,O.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.RENDERBUFFER,F)}else{const ge=O.isWebGLMultipleRenderTargets===!0?O.texture:[O.texture];for(let de=0;de<ge.length;de++){const be=ge[de],Ne=s.convert(be.format,be.colorSpace),Ae=s.convert(be.type),Fe=x(be.internalFormat,Ne,Ae,be.colorSpace),je=se(O);J&&ce(O)===!1?n.renderbufferStorageMultisample(n.RENDERBUFFER,je,Fe,O.width,O.height):ce(O)?d.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,je,Fe,O.width,O.height):n.renderbufferStorage(n.RENDERBUFFER,Fe,O.width,O.height)}}n.bindRenderbuffer(n.RENDERBUFFER,null)}function R(F,O){if(O&&O.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(n.FRAMEBUFFER,F),!(O.depthTexture&&O.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");(!i.get(O.depthTexture).__webglTexture||O.depthTexture.image.width!==O.width||O.depthTexture.image.height!==O.height)&&(O.depthTexture.image.width=O.width,O.depthTexture.image.height=O.height,O.depthTexture.needsUpdate=!0),Q(O.depthTexture,0);const ge=i.get(O.depthTexture).__webglTexture,de=se(O);if(O.depthTexture.format===Co)ce(O)?d.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.TEXTURE_2D,ge,0,de):n.framebufferTexture2D(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.TEXTURE_2D,ge,0);else if(O.depthTexture.format===za)ce(O)?d.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.TEXTURE_2D,ge,0,de):n.framebufferTexture2D(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.TEXTURE_2D,ge,0);else throw new Error("Unknown depthTexture format")}function I(F){const O=i.get(F),J=F.isWebGLCubeRenderTarget===!0;if(F.depthTexture&&!O.__autoAllocateDepthBuffer){if(J)throw new Error("target.depthTexture not supported in Cube render targets");R(O.__webglFramebuffer,F)}else if(J){O.__webglDepthbuffer=[];for(let ge=0;ge<6;ge++)t.bindFramebuffer(n.FRAMEBUFFER,O.__webglFramebuffer[ge]),O.__webglDepthbuffer[ge]=n.createRenderbuffer(),A(O.__webglDepthbuffer[ge],F,!1)}else t.bindFramebuffer(n.FRAMEBUFFER,O.__webglFramebuffer),O.__webglDepthbuffer=n.createRenderbuffer(),A(O.__webglDepthbuffer,F,!1);t.bindFramebuffer(n.FRAMEBUFFER,null)}function z(F,O,J){const ge=i.get(F);O!==void 0&&B(ge.__webglFramebuffer,F,F.texture,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,0),J!==void 0&&I(F)}function G(F){const O=F.texture,J=i.get(F),ge=i.get(O);F.addEventListener("dispose",L),F.isWebGLMultipleRenderTargets!==!0&&(ge.__webglTexture===void 0&&(ge.__webglTexture=n.createTexture()),ge.__version=O.version,o.memory.textures++);const de=F.isWebGLCubeRenderTarget===!0,be=F.isWebGLMultipleRenderTargets===!0,Ne=y(F)||a;if(de){J.__webglFramebuffer=[];for(let Ae=0;Ae<6;Ae++)if(a&&O.mipmaps&&O.mipmaps.length>0){J.__webglFramebuffer[Ae]=[];for(let Fe=0;Fe<O.mipmaps.length;Fe++)J.__webglFramebuffer[Ae][Fe]=n.createFramebuffer()}else J.__webglFramebuffer[Ae]=n.createFramebuffer()}else{if(a&&O.mipmaps&&O.mipmaps.length>0){J.__webglFramebuffer=[];for(let Ae=0;Ae<O.mipmaps.length;Ae++)J.__webglFramebuffer[Ae]=n.createFramebuffer()}else J.__webglFramebuffer=n.createFramebuffer();if(be)if(r.drawBuffers){const Ae=F.texture;for(let Fe=0,je=Ae.length;Fe<je;Fe++){const dt=i.get(Ae[Fe]);dt.__webglTexture===void 0&&(dt.__webglTexture=n.createTexture(),o.memory.textures++)}}else console.warn("THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.");if(a&&F.samples>0&&ce(F)===!1){const Ae=be?O:[O];J.__webglMultisampledFramebuffer=n.createFramebuffer(),J.__webglColorRenderbuffer=[],t.bindFramebuffer(n.FRAMEBUFFER,J.__webglMultisampledFramebuffer);for(let Fe=0;Fe<Ae.length;Fe++){const je=Ae[Fe];J.__webglColorRenderbuffer[Fe]=n.createRenderbuffer(),n.bindRenderbuffer(n.RENDERBUFFER,J.__webglColorRenderbuffer[Fe]);const dt=s.convert(je.format,je.colorSpace),Le=s.convert(je.type),et=x(je.internalFormat,dt,Le,je.colorSpace,F.isXRRenderTarget===!0),Y=se(F);n.renderbufferStorageMultisample(n.RENDERBUFFER,Y,et,F.width,F.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+Fe,n.RENDERBUFFER,J.__webglColorRenderbuffer[Fe])}n.bindRenderbuffer(n.RENDERBUFFER,null),F.depthBuffer&&(J.__webglDepthRenderbuffer=n.createRenderbuffer(),A(J.__webglDepthRenderbuffer,F,!0)),t.bindFramebuffer(n.FRAMEBUFFER,null)}}if(de){t.bindTexture(n.TEXTURE_CUBE_MAP,ge.__webglTexture),ne(n.TEXTURE_CUBE_MAP,O,Ne);for(let Ae=0;Ae<6;Ae++)if(a&&O.mipmaps&&O.mipmaps.length>0)for(let Fe=0;Fe<O.mipmaps.length;Fe++)B(J.__webglFramebuffer[Ae][Fe],F,O,n.COLOR_ATTACHMENT0,n.TEXTURE_CUBE_MAP_POSITIVE_X+Ae,Fe);else B(J.__webglFramebuffer[Ae],F,O,n.COLOR_ATTACHMENT0,n.TEXTURE_CUBE_MAP_POSITIVE_X+Ae,0);S(O,Ne)&&E(n.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(be){const Ae=F.texture;for(let Fe=0,je=Ae.length;Fe<je;Fe++){const dt=Ae[Fe],Le=i.get(dt);t.bindTexture(n.TEXTURE_2D,Le.__webglTexture),ne(n.TEXTURE_2D,dt,Ne),B(J.__webglFramebuffer,F,dt,n.COLOR_ATTACHMENT0+Fe,n.TEXTURE_2D,0),S(dt,Ne)&&E(n.TEXTURE_2D)}t.unbindTexture()}else{let Ae=n.TEXTURE_2D;if((F.isWebGL3DRenderTarget||F.isWebGLArrayRenderTarget)&&(a?Ae=F.isWebGL3DRenderTarget?n.TEXTURE_3D:n.TEXTURE_2D_ARRAY:console.error("THREE.WebGLTextures: THREE.Data3DTexture and THREE.DataArrayTexture only supported with WebGL2.")),t.bindTexture(Ae,ge.__webglTexture),ne(Ae,O,Ne),a&&O.mipmaps&&O.mipmaps.length>0)for(let Fe=0;Fe<O.mipmaps.length;Fe++)B(J.__webglFramebuffer[Fe],F,O,n.COLOR_ATTACHMENT0,Ae,Fe);else B(J.__webglFramebuffer,F,O,n.COLOR_ATTACHMENT0,Ae,0);S(O,Ne)&&E(Ae),t.unbindTexture()}F.depthBuffer&&I(F)}function ee(F){const O=y(F)||a,J=F.isWebGLMultipleRenderTargets===!0?F.texture:[F.texture];for(let ge=0,de=J.length;ge<de;ge++){const be=J[ge];if(S(be,O)){const Ne=F.isWebGLCubeRenderTarget?n.TEXTURE_CUBE_MAP:n.TEXTURE_2D,Ae=i.get(be).__webglTexture;t.bindTexture(Ne,Ae),E(Ne),t.unbindTexture()}}}function ae(F){if(a&&F.samples>0&&ce(F)===!1){const O=F.isWebGLMultipleRenderTargets?F.texture:[F.texture],J=F.width,ge=F.height;let de=n.COLOR_BUFFER_BIT;const be=[],Ne=F.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,Ae=i.get(F),Fe=F.isWebGLMultipleRenderTargets===!0;if(Fe)for(let je=0;je<O.length;je++)t.bindFramebuffer(n.FRAMEBUFFER,Ae.__webglMultisampledFramebuffer),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+je,n.RENDERBUFFER,null),t.bindFramebuffer(n.FRAMEBUFFER,Ae.__webglFramebuffer),n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0+je,n.TEXTURE_2D,null,0);t.bindFramebuffer(n.READ_FRAMEBUFFER,Ae.__webglMultisampledFramebuffer),t.bindFramebuffer(n.DRAW_FRAMEBUFFER,Ae.__webglFramebuffer);for(let je=0;je<O.length;je++){be.push(n.COLOR_ATTACHMENT0+je),F.depthBuffer&&be.push(Ne);const dt=Ae.__ignoreDepthValues!==void 0?Ae.__ignoreDepthValues:!1;if(dt===!1&&(F.depthBuffer&&(de|=n.DEPTH_BUFFER_BIT),F.stencilBuffer&&(de|=n.STENCIL_BUFFER_BIT)),Fe&&n.framebufferRenderbuffer(n.READ_FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.RENDERBUFFER,Ae.__webglColorRenderbuffer[je]),dt===!0&&(n.invalidateFramebuffer(n.READ_FRAMEBUFFER,[Ne]),n.invalidateFramebuffer(n.DRAW_FRAMEBUFFER,[Ne])),Fe){const Le=i.get(O[je]).__webglTexture;n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,Le,0)}n.blitFramebuffer(0,0,J,ge,0,0,J,ge,de,n.NEAREST),f&&n.invalidateFramebuffer(n.READ_FRAMEBUFFER,be)}if(t.bindFramebuffer(n.READ_FRAMEBUFFER,null),t.bindFramebuffer(n.DRAW_FRAMEBUFFER,null),Fe)for(let je=0;je<O.length;je++){t.bindFramebuffer(n.FRAMEBUFFER,Ae.__webglMultisampledFramebuffer),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+je,n.RENDERBUFFER,Ae.__webglColorRenderbuffer[je]);const dt=i.get(O[je]).__webglTexture;t.bindFramebuffer(n.FRAMEBUFFER,Ae.__webglFramebuffer),n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0+je,n.TEXTURE_2D,dt,0)}t.bindFramebuffer(n.DRAW_FRAMEBUFFER,Ae.__webglMultisampledFramebuffer)}}function se(F){return Math.min(h,F.samples)}function ce(F){const O=i.get(F);return a&&F.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&O.__useRenderToTexture!==!1}function le(F){const O=o.render.frame;p.get(F)!==O&&(p.set(F,O),F.update())}function Me(F,O){const J=F.colorSpace,ge=F.format,de=F.type;return F.isCompressedTexture===!0||F.isVideoTexture===!0||F.format===Gp||J!==ss&&J!==Bi&&(Ut.getTransfer(J)===Ht?a===!1?e.has("EXT_sRGB")===!0&&ge===ki?(F.format=Gp,F.minFilter=rn,F.generateMipmaps=!1):O=cb.sRGBToLinear(O):(ge!==ki||de!==Tr)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",J)),O}this.allocateTextureUnit=te,this.resetTextureUnits=j,this.setTexture2D=Q,this.setTexture2DArray=X,this.setTexture3D=re,this.setTextureCube=W,this.rebindTextures=z,this.setupRenderTarget=G,this.updateRenderTargetMipmap=ee,this.updateMultisampleRenderTarget=ae,this.setupDepthRenderbuffer=I,this.setupFrameBufferTexture=B,this.useMultisampledRTT=ce}function XP(n,e,t){const i=t.isWebGL2;function r(s,o=Bi){let a;const l=Ut.getTransfer(o);if(s===Tr)return n.UNSIGNED_BYTE;if(s===eb)return n.UNSIGNED_SHORT_4_4_4_4;if(s===tb)return n.UNSIGNED_SHORT_5_5_5_1;if(s===uP)return n.BYTE;if(s===hP)return n.SHORT;if(s===Om)return n.UNSIGNED_SHORT;if(s===Qy)return n.INT;if(s===Ts)return n.UNSIGNED_INT;if(s===jr)return n.FLOAT;if(s===Cc)return i?n.HALF_FLOAT:(a=e.get("OES_texture_half_float"),a!==null?a.HALF_FLOAT_OES:null);if(s===dP)return n.ALPHA;if(s===ki)return n.RGBA;if(s===fP)return n.LUMINANCE;if(s===pP)return n.LUMINANCE_ALPHA;if(s===Co)return n.DEPTH_COMPONENT;if(s===za)return n.DEPTH_STENCIL;if(s===Gp)return a=e.get("EXT_sRGB"),a!==null?a.SRGB_ALPHA_EXT:null;if(s===mP)return n.RED;if(s===nb)return n.RED_INTEGER;if(s===gP)return n.RG;if(s===ib)return n.RG_INTEGER;if(s===rb)return n.RGBA_INTEGER;if(s===up||s===hp||s===dp||s===fp)if(l===Ht)if(a=e.get("WEBGL_compressed_texture_s3tc_srgb"),a!==null){if(s===up)return a.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(s===hp)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(s===dp)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(s===fp)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(a=e.get("WEBGL_compressed_texture_s3tc"),a!==null){if(s===up)return a.COMPRESSED_RGB_S3TC_DXT1_EXT;if(s===hp)return a.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(s===dp)return a.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(s===fp)return a.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(s===z0||s===V0||s===H0||s===G0)if(a=e.get("WEBGL_compressed_texture_pvrtc"),a!==null){if(s===z0)return a.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(s===V0)return a.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(s===H0)return a.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(s===G0)return a.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(s===vP)return a=e.get("WEBGL_compressed_texture_etc1"),a!==null?a.COMPRESSED_RGB_ETC1_WEBGL:null;if(s===W0||s===$0)if(a=e.get("WEBGL_compressed_texture_etc"),a!==null){if(s===W0)return l===Ht?a.COMPRESSED_SRGB8_ETC2:a.COMPRESSED_RGB8_ETC2;if(s===$0)return l===Ht?a.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:a.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(s===j0||s===X0||s===Y0||s===q0||s===K0||s===Z0||s===J0||s===Q0||s===e_||s===t_||s===n_||s===i_||s===r_||s===s_)if(a=e.get("WEBGL_compressed_texture_astc"),a!==null){if(s===j0)return l===Ht?a.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:a.COMPRESSED_RGBA_ASTC_4x4_KHR;if(s===X0)return l===Ht?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:a.COMPRESSED_RGBA_ASTC_5x4_KHR;if(s===Y0)return l===Ht?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:a.COMPRESSED_RGBA_ASTC_5x5_KHR;if(s===q0)return l===Ht?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:a.COMPRESSED_RGBA_ASTC_6x5_KHR;if(s===K0)return l===Ht?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:a.COMPRESSED_RGBA_ASTC_6x6_KHR;if(s===Z0)return l===Ht?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:a.COMPRESSED_RGBA_ASTC_8x5_KHR;if(s===J0)return l===Ht?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:a.COMPRESSED_RGBA_ASTC_8x6_KHR;if(s===Q0)return l===Ht?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:a.COMPRESSED_RGBA_ASTC_8x8_KHR;if(s===e_)return l===Ht?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:a.COMPRESSED_RGBA_ASTC_10x5_KHR;if(s===t_)return l===Ht?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:a.COMPRESSED_RGBA_ASTC_10x6_KHR;if(s===n_)return l===Ht?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:a.COMPRESSED_RGBA_ASTC_10x8_KHR;if(s===i_)return l===Ht?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:a.COMPRESSED_RGBA_ASTC_10x10_KHR;if(s===r_)return l===Ht?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:a.COMPRESSED_RGBA_ASTC_12x10_KHR;if(s===s_)return l===Ht?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:a.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(s===pp||s===o_||s===a_)if(a=e.get("EXT_texture_compression_bptc"),a!==null){if(s===pp)return l===Ht?a.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:a.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(s===o_)return a.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(s===a_)return a.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(s===_P||s===l_||s===c_||s===u_)if(a=e.get("EXT_texture_compression_rgtc"),a!==null){if(s===pp)return a.COMPRESSED_RED_RGTC1_EXT;if(s===l_)return a.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(s===c_)return a.COMPRESSED_RED_GREEN_RGTC2_EXT;if(s===u_)return a.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return s===Ao?i?n.UNSIGNED_INT_24_8:(a=e.get("WEBGL_depth_texture"),a!==null?a.UNSIGNED_INT_24_8_WEBGL:null):n[s]!==void 0?n[s]:null}return{convert:r}}class YP extends Nt{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class Mr extends pt{constructor(){super(),this.isGroup=!0,this.type="Group"}}const IX={type:"move"};class hv{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Mr,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new Mr,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new D,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new D),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Mr,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new D,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new D),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const i of e.hand.values())this._getHandJoint(t,i)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,i){let r=null,s=null,o=null;const a=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(c&&e.hand){o=!0;for(const v of e.hand.values()){const m=t.getJointPose(v,i),g=this._getHandJoint(c,v);m!==null&&(g.matrix.fromArray(m.transform.matrix),g.matrix.decompose(g.position,g.rotation,g.scale),g.matrixWorldNeedsUpdate=!0,g.jointRadius=m.radius),g.visible=m!==null}const u=c.joints["index-finger-tip"],h=c.joints["thumb-tip"],d=u.position.distanceTo(h.position),f=.02,p=.005;c.inputState.pinching&&d>f+p?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&d<=f-p&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,i),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,s.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(s.linearVelocity)):l.hasLinearVelocity=!1,s.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(s.angularVelocity)):l.hasAngularVelocity=!1));a!==null&&(r=t.getPose(e.targetRaySpace,i),r===null&&s!==null&&(r=s),r!==null&&(a.matrix.fromArray(r.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,r.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(r.linearVelocity)):a.hasLinearVelocity=!1,r.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(r.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(IX)))}return a!==null&&(a.visible=r!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=o!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const i=new Mr;i.matrixAutoUpdate=!1,i.visible=!1,e.joints[t.jointName]=i,e.add(i)}return e.joints[t.jointName]}}class qP extends Jt{constructor(e,t,i,r,s,o,a,l,c,u){if(u=u!==void 0?u:Co,u!==Co&&u!==za)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");i===void 0&&u===Co&&(i=Ts),i===void 0&&u===za&&(i=Ao),super(null,r,s,o,a,l,u,i,c),this.isDepthTexture=!0,this.image={width:e,height:t},this.magFilter=a!==void 0?a:hn,this.minFilter=l!==void 0?l:hn,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}}class DX extends Nr{constructor(e,t){super();const i=this;let r=null,s=1,o=null,a="local-floor",l=1,c=null,u=null,h=null,d=null,f=null,p=null;const v=t.getContextAttributes();let m=null,g=null;const b=[],_=[],y=new Nt;y.layers.enable(1),y.viewport=new vt;const T=new Nt;T.layers.enable(2),T.viewport=new vt;const S=[y,T],E=new YP;E.layers.enable(1),E.layers.enable(2);let x=null,M=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(X){let re=b[X];return re===void 0&&(re=new hv,b[X]=re),re.getTargetRaySpace()},this.getControllerGrip=function(X){let re=b[X];return re===void 0&&(re=new hv,b[X]=re),re.getGripSpace()},this.getHand=function(X){let re=b[X];return re===void 0&&(re=new hv,b[X]=re),re.getHandSpace()};function w(X){const re=_.indexOf(X.inputSource);if(re===-1)return;const W=b[re];W!==void 0&&(W.update(X.inputSource,X.frame,c||o),W.dispatchEvent({type:X.type,data:X.inputSource}))}function C(){r.removeEventListener("select",w),r.removeEventListener("selectstart",w),r.removeEventListener("selectend",w),r.removeEventListener("squeeze",w),r.removeEventListener("squeezestart",w),r.removeEventListener("squeezeend",w),r.removeEventListener("end",C),r.removeEventListener("inputsourceschange",L);for(let X=0;X<b.length;X++){const re=_[X];re!==null&&(_[X]=null,b[X].disconnect(re))}x=null,M=null,e.setRenderTarget(m),f=null,d=null,h=null,r=null,g=null,Q.stop(),i.isPresenting=!1,i.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(X){s=X,i.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(X){a=X,i.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return c||o},this.setReferenceSpace=function(X){c=X},this.getBaseLayer=function(){return d!==null?d:f},this.getBinding=function(){return h},this.getFrame=function(){return p},this.getSession=function(){return r},this.setSession=async function(X){if(r=X,r!==null){if(m=e.getRenderTarget(),r.addEventListener("select",w),r.addEventListener("selectstart",w),r.addEventListener("selectend",w),r.addEventListener("squeeze",w),r.addEventListener("squeezestart",w),r.addEventListener("squeezeend",w),r.addEventListener("end",C),r.addEventListener("inputsourceschange",L),v.xrCompatible!==!0&&await t.makeXRCompatible(),r.renderState.layers===void 0||e.capabilities.isWebGL2===!1){const re={antialias:r.renderState.layers===void 0?v.antialias:!0,alpha:!0,depth:v.depth,stencil:v.stencil,framebufferScaleFactor:s};f=new XRWebGLLayer(r,t,re),r.updateRenderState({baseLayer:f}),g=new Lr(f.framebufferWidth,f.framebufferHeight,{format:ki,type:Tr,colorSpace:e.outputColorSpace,stencilBuffer:v.stencil})}else{let re=null,W=null,we=null;v.depth&&(we=v.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,re=v.stencil?za:Co,W=v.stencil?Ao:Ts);const Re={colorFormat:t.RGBA8,depthFormat:we,scaleFactor:s};h=new XRWebGLBinding(r,t),d=h.createProjectionLayer(Re),r.updateRenderState({layers:[d]}),g=new Lr(d.textureWidth,d.textureHeight,{format:ki,type:Tr,depthTexture:new qP(d.textureWidth,d.textureHeight,W,void 0,void 0,void 0,void 0,void 0,void 0,re),stencilBuffer:v.stencil,colorSpace:e.outputColorSpace,samples:v.antialias?4:0});const De=e.properties.get(g);De.__ignoreDepthValues=d.ignoreDepthValues}g.isXRRenderTarget=!0,this.setFoveation(l),c=null,o=await r.requestReferenceSpace(a),Q.setContext(r),Q.start(),i.isPresenting=!0,i.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(r!==null)return r.environmentBlendMode};function L(X){for(let re=0;re<X.removed.length;re++){const W=X.removed[re],we=_.indexOf(W);we>=0&&(_[we]=null,b[we].disconnect(W))}for(let re=0;re<X.added.length;re++){const W=X.added[re];let we=_.indexOf(W);if(we===-1){for(let De=0;De<b.length;De++)if(De>=_.length){_.push(W),we=De;break}else if(_[De]===null){_[De]=W,we=De;break}if(we===-1)break}const Re=b[we];Re&&Re.connect(W)}}const $=new D,U=new D;function H(X,re,W){$.setFromMatrixPosition(re.matrixWorld),U.setFromMatrixPosition(W.matrixWorld);const we=$.distanceTo(U),Re=re.projectionMatrix.elements,De=W.projectionMatrix.elements,ne=Re[14]/(Re[10]-1),q=Re[14]/(Re[10]+1),P=(Re[9]+1)/Re[5],N=(Re[9]-1)/Re[5],B=(Re[8]-1)/Re[0],A=(De[8]+1)/De[0],R=ne*B,I=ne*A,z=we/(-B+A),G=z*-B;re.matrixWorld.decompose(X.position,X.quaternion,X.scale),X.translateX(G),X.translateZ(z),X.matrixWorld.compose(X.position,X.quaternion,X.scale),X.matrixWorldInverse.copy(X.matrixWorld).invert();const ee=ne+z,ae=q+z,se=R-G,ce=I+(we-G),le=P*q/ae*ee,Me=N*q/ae*ee;X.projectionMatrix.makePerspective(se,ce,le,Me,ee,ae),X.projectionMatrixInverse.copy(X.projectionMatrix).invert()}function V(X,re){re===null?X.matrixWorld.copy(X.matrix):X.matrixWorld.multiplyMatrices(re.matrixWorld,X.matrix),X.matrixWorldInverse.copy(X.matrixWorld).invert()}this.updateCamera=function(X){if(r===null)return;E.near=T.near=y.near=X.near,E.far=T.far=y.far=X.far,(x!==E.near||M!==E.far)&&(r.updateRenderState({depthNear:E.near,depthFar:E.far}),x=E.near,M=E.far);const re=X.parent,W=E.cameras;V(E,re);for(let we=0;we<W.length;we++)V(W[we],re);W.length===2?H(E,y,T):E.projectionMatrix.copy(y.projectionMatrix),j(X,E,re)};function j(X,re,W){W===null?X.matrix.copy(re.matrixWorld):(X.matrix.copy(W.matrixWorld),X.matrix.invert(),X.matrix.multiply(re.matrixWorld)),X.matrix.decompose(X.position,X.quaternion,X.scale),X.updateMatrixWorld(!0),X.projectionMatrix.copy(re.projectionMatrix),X.projectionMatrixInverse.copy(re.projectionMatrixInverse),X.isPerspectiveCamera&&(X.fov=Rc*2*Math.atan(1/X.projectionMatrix.elements[5]),X.zoom=1)}this.getCamera=function(){return E},this.getFoveation=function(){if(!(d===null&&f===null))return l},this.setFoveation=function(X){l=X,d!==null&&(d.fixedFoveation=X),f!==null&&f.fixedFoveation!==void 0&&(f.fixedFoveation=X)};let te=null;function Z(X,re){if(u=re.getViewerPose(c||o),p=re,u!==null){const W=u.views;f!==null&&(e.setRenderTargetFramebuffer(g,f.framebuffer),e.setRenderTarget(g));let we=!1;W.length!==E.cameras.length&&(E.cameras.length=0,we=!0);for(let Re=0;Re<W.length;Re++){const De=W[Re];let ne=null;if(f!==null)ne=f.getViewport(De);else{const P=h.getViewSubImage(d,De);ne=P.viewport,Re===0&&(e.setRenderTargetTextures(g,P.colorTexture,d.ignoreDepthValues?void 0:P.depthStencilTexture),e.setRenderTarget(g))}let q=S[Re];q===void 0&&(q=new Nt,q.layers.enable(Re),q.viewport=new vt,S[Re]=q),q.matrix.fromArray(De.transform.matrix),q.matrix.decompose(q.position,q.quaternion,q.scale),q.projectionMatrix.fromArray(De.projectionMatrix),q.projectionMatrixInverse.copy(q.projectionMatrix).invert(),q.viewport.set(ne.x,ne.y,ne.width,ne.height),Re===0&&(E.matrix.copy(q.matrix),E.matrix.decompose(E.position,E.quaternion,E.scale)),we===!0&&E.cameras.push(q)}}for(let W=0;W<b.length;W++){const we=_[W],Re=b[W];we!==null&&Re!==void 0&&Re.update(we,re,c||o)}te&&te(X,re),re.detectedPlanes&&i.dispatchEvent({type:"planesdetected",data:re}),p=null}const Q=new HP;Q.setAnimationLoop(Z),this.setAnimationLoop=function(X){te=X},this.dispose=function(){}}}function UX(n,e){function t(m,g){m.matrixAutoUpdate===!0&&m.updateMatrix(),g.value.copy(m.matrix)}function i(m,g){g.color.getRGB(m.fogColor.value,BP(n)),g.isFog?(m.fogNear.value=g.near,m.fogFar.value=g.far):g.isFogExp2&&(m.fogDensity.value=g.density)}function r(m,g,b,_,y){g.isMeshBasicMaterial||g.isMeshLambertMaterial?s(m,g):g.isMeshToonMaterial?(s(m,g),h(m,g)):g.isMeshPhongMaterial?(s(m,g),u(m,g)):g.isMeshStandardMaterial?(s(m,g),d(m,g),g.isMeshPhysicalMaterial&&f(m,g,y)):g.isMeshMatcapMaterial?(s(m,g),p(m,g)):g.isMeshDepthMaterial?s(m,g):g.isMeshDistanceMaterial?(s(m,g),v(m,g)):g.isMeshNormalMaterial?s(m,g):g.isLineBasicMaterial?(o(m,g),g.isLineDashedMaterial&&a(m,g)):g.isPointsMaterial?l(m,g,b,_):g.isSpriteMaterial?c(m,g):g.isShadowMaterial?(m.color.value.copy(g.color),m.opacity.value=g.opacity):g.isShaderMaterial&&(g.uniformsNeedUpdate=!1)}function s(m,g){m.opacity.value=g.opacity,g.color&&m.diffuse.value.copy(g.color),g.emissive&&m.emissive.value.copy(g.emissive).multiplyScalar(g.emissiveIntensity),g.map&&(m.map.value=g.map,t(g.map,m.mapTransform)),g.alphaMap&&(m.alphaMap.value=g.alphaMap,t(g.alphaMap,m.alphaMapTransform)),g.bumpMap&&(m.bumpMap.value=g.bumpMap,t(g.bumpMap,m.bumpMapTransform),m.bumpScale.value=g.bumpScale,g.side===Qn&&(m.bumpScale.value*=-1)),g.normalMap&&(m.normalMap.value=g.normalMap,t(g.normalMap,m.normalMapTransform),m.normalScale.value.copy(g.normalScale),g.side===Qn&&m.normalScale.value.negate()),g.displacementMap&&(m.displacementMap.value=g.displacementMap,t(g.displacementMap,m.displacementMapTransform),m.displacementScale.value=g.displacementScale,m.displacementBias.value=g.displacementBias),g.emissiveMap&&(m.emissiveMap.value=g.emissiveMap,t(g.emissiveMap,m.emissiveMapTransform)),g.specularMap&&(m.specularMap.value=g.specularMap,t(g.specularMap,m.specularMapTransform)),g.alphaTest>0&&(m.alphaTest.value=g.alphaTest);const b=e.get(g).envMap;if(b&&(m.envMap.value=b,m.flipEnvMap.value=b.isCubeTexture&&b.isRenderTargetTexture===!1?-1:1,m.reflectivity.value=g.reflectivity,m.ior.value=g.ior,m.refractionRatio.value=g.refractionRatio),g.lightMap){m.lightMap.value=g.lightMap;const _=n._useLegacyLights===!0?Math.PI:1;m.lightMapIntensity.value=g.lightMapIntensity*_,t(g.lightMap,m.lightMapTransform)}g.aoMap&&(m.aoMap.value=g.aoMap,m.aoMapIntensity.value=g.aoMapIntensity,t(g.aoMap,m.aoMapTransform))}function o(m,g){m.diffuse.value.copy(g.color),m.opacity.value=g.opacity,g.map&&(m.map.value=g.map,t(g.map,m.mapTransform))}function a(m,g){m.dashSize.value=g.dashSize,m.totalSize.value=g.dashSize+g.gapSize,m.scale.value=g.scale}function l(m,g,b,_){m.diffuse.value.copy(g.color),m.opacity.value=g.opacity,m.size.value=g.size*b,m.scale.value=_*.5,g.map&&(m.map.value=g.map,t(g.map,m.uvTransform)),g.alphaMap&&(m.alphaMap.value=g.alphaMap,t(g.alphaMap,m.alphaMapTransform)),g.alphaTest>0&&(m.alphaTest.value=g.alphaTest)}function c(m,g){m.diffuse.value.copy(g.color),m.opacity.value=g.opacity,m.rotation.value=g.rotation,g.map&&(m.map.value=g.map,t(g.map,m.mapTransform)),g.alphaMap&&(m.alphaMap.value=g.alphaMap,t(g.alphaMap,m.alphaMapTransform)),g.alphaTest>0&&(m.alphaTest.value=g.alphaTest)}function u(m,g){m.specular.value.copy(g.specular),m.shininess.value=Math.max(g.shininess,1e-4)}function h(m,g){g.gradientMap&&(m.gradientMap.value=g.gradientMap)}function d(m,g){m.metalness.value=g.metalness,g.metalnessMap&&(m.metalnessMap.value=g.metalnessMap,t(g.metalnessMap,m.metalnessMapTransform)),m.roughness.value=g.roughness,g.roughnessMap&&(m.roughnessMap.value=g.roughnessMap,t(g.roughnessMap,m.roughnessMapTransform)),e.get(g).envMap&&(m.envMapIntensity.value=g.envMapIntensity)}function f(m,g,b){m.ior.value=g.ior,g.sheen>0&&(m.sheenColor.value.copy(g.sheenColor).multiplyScalar(g.sheen),m.sheenRoughness.value=g.sheenRoughness,g.sheenColorMap&&(m.sheenColorMap.value=g.sheenColorMap,t(g.sheenColorMap,m.sheenColorMapTransform)),g.sheenRoughnessMap&&(m.sheenRoughnessMap.value=g.sheenRoughnessMap,t(g.sheenRoughnessMap,m.sheenRoughnessMapTransform))),g.clearcoat>0&&(m.clearcoat.value=g.clearcoat,m.clearcoatRoughness.value=g.clearcoatRoughness,g.clearcoatMap&&(m.clearcoatMap.value=g.clearcoatMap,t(g.clearcoatMap,m.clearcoatMapTransform)),g.clearcoatRoughnessMap&&(m.clearcoatRoughnessMap.value=g.clearcoatRoughnessMap,t(g.clearcoatRoughnessMap,m.clearcoatRoughnessMapTransform)),g.clearcoatNormalMap&&(m.clearcoatNormalMap.value=g.clearcoatNormalMap,t(g.clearcoatNormalMap,m.clearcoatNormalMapTransform),m.clearcoatNormalScale.value.copy(g.clearcoatNormalScale),g.side===Qn&&m.clearcoatNormalScale.value.negate())),g.iridescence>0&&(m.iridescence.value=g.iridescence,m.iridescenceIOR.value=g.iridescenceIOR,m.iridescenceThicknessMinimum.value=g.iridescenceThicknessRange[0],m.iridescenceThicknessMaximum.value=g.iridescenceThicknessRange[1],g.iridescenceMap&&(m.iridescenceMap.value=g.iridescenceMap,t(g.iridescenceMap,m.iridescenceMapTransform)),g.iridescenceThicknessMap&&(m.iridescenceThicknessMap.value=g.iridescenceThicknessMap,t(g.iridescenceThicknessMap,m.iridescenceThicknessMapTransform))),g.transmission>0&&(m.transmission.value=g.transmission,m.transmissionSamplerMap.value=b.texture,m.transmissionSamplerSize.value.set(b.width,b.height),g.transmissionMap&&(m.transmissionMap.value=g.transmissionMap,t(g.transmissionMap,m.transmissionMapTransform)),m.thickness.value=g.thickness,g.thicknessMap&&(m.thicknessMap.value=g.thicknessMap,t(g.thicknessMap,m.thicknessMapTransform)),m.attenuationDistance.value=g.attenuationDistance,m.attenuationColor.value.copy(g.attenuationColor)),g.anisotropy>0&&(m.anisotropyVector.value.set(g.anisotropy*Math.cos(g.anisotropyRotation),g.anisotropy*Math.sin(g.anisotropyRotation)),g.anisotropyMap&&(m.anisotropyMap.value=g.anisotropyMap,t(g.anisotropyMap,m.anisotropyMapTransform))),m.specularIntensity.value=g.specularIntensity,m.specularColor.value.copy(g.specularColor),g.specularColorMap&&(m.specularColorMap.value=g.specularColorMap,t(g.specularColorMap,m.specularColorMapTransform)),g.specularIntensityMap&&(m.specularIntensityMap.value=g.specularIntensityMap,t(g.specularIntensityMap,m.specularIntensityMapTransform))}function p(m,g){g.matcap&&(m.matcap.value=g.matcap)}function v(m,g){const b=e.get(g).light;m.referencePosition.value.setFromMatrixPosition(b.matrixWorld),m.nearDistance.value=b.shadow.camera.near,m.farDistance.value=b.shadow.camera.far}return{refreshFogUniforms:i,refreshMaterialUniforms:r}}function NX(n,e,t,i){let r={},s={},o=[];const a=t.isWebGL2?n.getParameter(n.MAX_UNIFORM_BUFFER_BINDINGS):0;function l(b,_){const y=_.program;i.uniformBlockBinding(b,y)}function c(b,_){let y=r[b.id];y===void 0&&(p(b),y=u(b),r[b.id]=y,b.addEventListener("dispose",m));const T=_.program;i.updateUBOMapping(b,T);const S=e.render.frame;s[b.id]!==S&&(d(b),s[b.id]=S)}function u(b){const _=h();b.__bindingPointIndex=_;const y=n.createBuffer(),T=b.__size,S=b.usage;return n.bindBuffer(n.UNIFORM_BUFFER,y),n.bufferData(n.UNIFORM_BUFFER,T,S),n.bindBuffer(n.UNIFORM_BUFFER,null),n.bindBufferBase(n.UNIFORM_BUFFER,_,y),y}function h(){for(let b=0;b<a;b++)if(o.indexOf(b)===-1)return o.push(b),b;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function d(b){const _=r[b.id],y=b.uniforms,T=b.__cache;n.bindBuffer(n.UNIFORM_BUFFER,_);for(let S=0,E=y.length;S<E;S++){const x=y[S];if(f(x,S,T)===!0){const M=x.__offset,w=Array.isArray(x.value)?x.value:[x.value];let C=0;for(let L=0;L<w.length;L++){const $=w[L],U=v($);typeof $=="number"?(x.__data[0]=$,n.bufferSubData(n.UNIFORM_BUFFER,M+C,x.__data)):$.isMatrix3?(x.__data[0]=$.elements[0],x.__data[1]=$.elements[1],x.__data[2]=$.elements[2],x.__data[3]=$.elements[0],x.__data[4]=$.elements[3],x.__data[5]=$.elements[4],x.__data[6]=$.elements[5],x.__data[7]=$.elements[0],x.__data[8]=$.elements[6],x.__data[9]=$.elements[7],x.__data[10]=$.elements[8],x.__data[11]=$.elements[0]):($.toArray(x.__data,C),C+=U.storage/Float32Array.BYTES_PER_ELEMENT)}n.bufferSubData(n.UNIFORM_BUFFER,M,x.__data)}}n.bindBuffer(n.UNIFORM_BUFFER,null)}function f(b,_,y){const T=b.value;if(y[_]===void 0){if(typeof T=="number")y[_]=T;else{const S=Array.isArray(T)?T:[T],E=[];for(let x=0;x<S.length;x++)E.push(S[x].clone());y[_]=E}return!0}else if(typeof T=="number"){if(y[_]!==T)return y[_]=T,!0}else{const S=Array.isArray(y[_])?y[_]:[y[_]],E=Array.isArray(T)?T:[T];for(let x=0;x<S.length;x++){const M=S[x];if(M.equals(E[x])===!1)return M.copy(E[x]),!0}}return!1}function p(b){const _=b.uniforms;let y=0;const T=16;let S=0;for(let E=0,x=_.length;E<x;E++){const M=_[E],w={boundary:0,storage:0},C=Array.isArray(M.value)?M.value:[M.value];for(let L=0,$=C.length;L<$;L++){const U=C[L],H=v(U);w.boundary+=H.boundary,w.storage+=H.storage}if(M.__data=new Float32Array(w.storage/Float32Array.BYTES_PER_ELEMENT),M.__offset=y,E>0){S=y%T;const L=T-S;S!==0&&L-w.boundary<0&&(y+=T-S,M.__offset=y)}y+=w.storage}return S=y%T,S>0&&(y+=T-S),b.__size=y,b.__cache={},this}function v(b){const _={boundary:0,storage:0};return typeof b=="number"?(_.boundary=4,_.storage=4):b.isVector2?(_.boundary=8,_.storage=8):b.isVector3||b.isColor?(_.boundary=16,_.storage=12):b.isVector4?(_.boundary=16,_.storage=16):b.isMatrix3?(_.boundary=48,_.storage=48):b.isMatrix4?(_.boundary=64,_.storage=64):b.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",b),_}function m(b){const _=b.target;_.removeEventListener("dispose",m);const y=o.indexOf(_.__bindingPointIndex);o.splice(y,1),n.deleteBuffer(r[_.id]),delete r[_.id],delete s[_.id]}function g(){for(const b in r)n.deleteBuffer(r[b]);o=[],r={},s={}}return{bind:l,update:c,dispose:g}}class nh{constructor(e={}){const{canvas:t=NP(),context:i=null,depth:r=!0,stencil:s=!0,alpha:o=!1,antialias:a=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:u="default",failIfMajorPerformanceCaveat:h=!1}=e;this.isWebGLRenderer=!0;let d;i!==null?d=i.getContextAttributes().alpha:d=o;const f=new Uint32Array(4),p=new Int32Array(4);let v=null,m=null;const g=[],b=[];this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=Mn,this._useLegacyLights=!1,this.toneMapping=Rs,this.toneMappingExposure=1;const _=this;let y=!1,T=0,S=0,E=null,x=-1,M=null;const w=new vt,C=new vt;let L=null;const $=new Pe(0);let U=0,H=t.width,V=t.height,j=1,te=null,Z=null;const Q=new vt(0,0,H,V),X=new vt(0,0,H,V);let re=!1;const W=new Bm;let we=!1,Re=!1,De=null;const ne=new ze,q=new _e,P=new D,N={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function B(){return E===null?j:1}let A=i;function R(k,oe){for(let ue=0;ue<k.length;ue++){const he=k[ue],pe=t.getContext(he,oe);if(pe!==null)return pe}return null}try{const k={alpha:!0,depth:r,stencil:s,antialias:a,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:u,failIfMajorPerformanceCaveat:h};if("setAttribute"in t&&t.setAttribute("data-engine","three.js r".concat(Vc)),t.addEventListener("webglcontextlost",Ke,!1),t.addEventListener("webglcontextrestored",K,!1),t.addEventListener("webglcontextcreationerror",ke,!1),A===null){const oe=["webgl2","webgl","experimental-webgl"];if(_.isWebGL1Renderer===!0&&oe.shift(),A=R(oe,k),A===null)throw R(oe)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}typeof WebGLRenderingContext<"u"&&A instanceof WebGLRenderingContext&&console.warn("THREE.WebGLRenderer: WebGL 1 support was deprecated in r153 and will be removed in r163."),A.getShaderPrecisionFormat===void 0&&(A.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(k){throw console.error("THREE.WebGLRenderer: "+k.message),k}let I,z,G,ee,ae,se,ce,le,Me,F,O,J,ge,de,be,Ne,Ae,Fe,je,dt,Le,et,Y,fe;function Ee(){I=new Z$(A),z=new $$(A,I,e),I.init(z),et=new XP(A,I,z),G=new LX(A,I,z),ee=new ej(A),ae=new yX,se=new OX(A,I,G,ae,z,et,ee),ce=new X$(_),le=new K$(_),Me=new uW(A,z),Y=new G$(A,I,Me,z),F=new J$(A,Me,ee,Y),O=new rj(A,F,Me,ee),je=new ij(A,z,se),Ne=new j$(ae),J=new _X(_,ce,le,I,z,Y,Ne),ge=new UX(_,ae),de=new xX,be=new AX(I,z),Fe=new H$(_,ce,le,G,O,d,l),Ae=new RX(_,O,z),fe=new NX(A,ee,z,G),dt=new W$(A,I,ee,z),Le=new Q$(A,I,ee,z),ee.programs=J.programs,_.capabilities=z,_.extensions=I,_.properties=ae,_.renderLists=de,_.shadowMap=Ae,_.state=G,_.info=ee}Ee();const Ce=new DX(_,A);this.xr=Ce,this.getContext=function(){return A},this.getContextAttributes=function(){return A.getContextAttributes()},this.forceContextLoss=function(){const k=I.get("WEBGL_lose_context");k&&k.loseContext()},this.forceContextRestore=function(){const k=I.get("WEBGL_lose_context");k&&k.restoreContext()},this.getPixelRatio=function(){return j},this.setPixelRatio=function(k){k!==void 0&&(j=k,this.setSize(H,V,!1))},this.getSize=function(k){return k.set(H,V)},this.setSize=function(k,oe,ue=!0){if(Ce.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}H=k,V=oe,t.width=Math.floor(k*j),t.height=Math.floor(oe*j),ue===!0&&(t.style.width=k+"px",t.style.height=oe+"px"),this.setViewport(0,0,k,oe)},this.getDrawingBufferSize=function(k){return k.set(H*j,V*j).floor()},this.setDrawingBufferSize=function(k,oe,ue){H=k,V=oe,j=ue,t.width=Math.floor(k*ue),t.height=Math.floor(oe*ue),this.setViewport(0,0,k,oe)},this.getCurrentViewport=function(k){return k.copy(w)},this.getViewport=function(k){return k.copy(Q)},this.setViewport=function(k,oe,ue,he){k.isVector4?Q.set(k.x,k.y,k.z,k.w):Q.set(k,oe,ue,he),G.viewport(w.copy(Q).multiplyScalar(j).floor())},this.getScissor=function(k){return k.copy(X)},this.setScissor=function(k,oe,ue,he){k.isVector4?X.set(k.x,k.y,k.z,k.w):X.set(k,oe,ue,he),G.scissor(C.copy(X).multiplyScalar(j).floor())},this.getScissorTest=function(){return re},this.setScissorTest=function(k){G.setScissorTest(re=k)},this.setOpaqueSort=function(k){te=k},this.setTransparentSort=function(k){Z=k},this.getClearColor=function(k){return k.copy(Fe.getClearColor())},this.setClearColor=function(){Fe.setClearColor.apply(Fe,arguments)},this.getClearAlpha=function(){return Fe.getClearAlpha()},this.setClearAlpha=function(){Fe.setClearAlpha.apply(Fe,arguments)},this.clear=function(k=!0,oe=!0,ue=!0){let he=0;if(k){let pe=!1;if(E!==null){const He=E.texture.format;pe=He===rb||He===ib||He===nb}if(pe){const He=E.texture.type,Ge=He===Tr||He===Ts||He===Om||He===Ao||He===eb||He===tb,Ze=Fe.getClearColor(),it=Fe.getClearAlpha(),mt=Ze.r,st=Ze.g,ot=Ze.b;Ge?(f[0]=mt,f[1]=st,f[2]=ot,f[3]=it,A.clearBufferuiv(A.COLOR,0,f)):(p[0]=mt,p[1]=st,p[2]=ot,p[3]=it,A.clearBufferiv(A.COLOR,0,p))}else he|=A.COLOR_BUFFER_BIT}oe&&(he|=A.DEPTH_BUFFER_BIT),ue&&(he|=A.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),A.clear(he)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){t.removeEventListener("webglcontextlost",Ke,!1),t.removeEventListener("webglcontextrestored",K,!1),t.removeEventListener("webglcontextcreationerror",ke,!1),de.dispose(),be.dispose(),ae.dispose(),ce.dispose(),le.dispose(),O.dispose(),Y.dispose(),fe.dispose(),J.dispose(),Ce.dispose(),Ce.removeEventListener("sessionstart",zn),Ce.removeEventListener("sessionend",kt),De&&(De.dispose(),De=null),ti.stop()};function Ke(k){k.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),y=!0}function K(){console.log("THREE.WebGLRenderer: Context Restored."),y=!1;const k=ee.autoReset,oe=Ae.enabled,ue=Ae.autoUpdate,he=Ae.needsUpdate,pe=Ae.type;Ee(),ee.autoReset=k,Ae.enabled=oe,Ae.autoUpdate=ue,Ae.needsUpdate=he,Ae.type=pe}function ke(k){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",k.statusMessage)}function Ie(k){const oe=k.target;oe.removeEventListener("dispose",Ie),ve(oe)}function ve(k){Oe(k),ae.remove(k)}function Oe(k){const oe=ae.get(k).programs;oe!==void 0&&(oe.forEach(function(ue){J.releaseProgram(ue)}),k.isShaderMaterial&&J.releaseShaderCache(k))}this.renderBufferDirect=function(k,oe,ue,he,pe,He){oe===null&&(oe=N);const Ge=pe.isMesh&&pe.matrixWorld.determinant()<0,Ze=ML(k,oe,ue,he,pe);G.setMaterial(he,Ge);let it=ue.index,mt=1;if(he.wireframe===!0){if(it=F.getWireframeAttribute(ue),it===void 0)return;mt=2}const st=ue.drawRange,ot=ue.attributes.position;let pn=st.start*mt,Li=(st.start+st.count)*mt;He!==null&&(pn=Math.max(pn,He.start*mt),Li=Math.min(Li,(He.start+He.count)*mt)),it!==null?(pn=Math.max(pn,0),Li=Math.min(Li,it.count)):ot!=null&&(pn=Math.max(pn,0),Li=Math.min(Li,ot.count));const Dn=Li-pn;if(Dn<0||Dn===1/0)return;Y.setup(pe,he,Ze,ue,it);let hs,an=dt;if(it!==null&&(hs=Me.get(it),an=Le,an.setIndex(hs)),pe.isMesh)he.wireframe===!0?(G.setLineWidth(he.wireframeLinewidth*B()),an.setMode(A.LINES)):an.setMode(A.TRIANGLES);else if(pe.isLine){let wt=he.linewidth;wt===void 0&&(wt=1),G.setLineWidth(wt*B()),pe.isLineSegments?an.setMode(A.LINES):pe.isLineLoop?an.setMode(A.LINE_LOOP):an.setMode(A.LINE_STRIP)}else pe.isPoints?an.setMode(A.POINTS):pe.isSprite&&an.setMode(A.TRIANGLES);if(pe.isInstancedMesh)an.renderInstances(pn,Dn,pe.count);else if(ue.isInstancedBufferGeometry){const wt=ue._maxInstanceCount!==void 0?ue._maxInstanceCount:1/0,mg=Math.min(ue.instanceCount,wt);an.renderInstances(pn,Dn,mg)}else an.render(pn,Dn)};function We(k,oe,ue){k.transparent===!0&&k.side===bi&&k.forceSinglePass===!1?(k.side=Qn,k.needsUpdate=!0,Ld(k,oe,ue),k.side=ns,k.needsUpdate=!0,Ld(k,oe,ue),k.side=bi):Ld(k,oe,ue)}this.compile=function(k,oe,ue=null){ue===null&&(ue=k),m=be.get(ue),m.init(),b.push(m),ue.traverseVisible(function(pe){pe.isLight&&pe.layers.test(oe.layers)&&(m.pushLight(pe),pe.castShadow&&m.pushShadow(pe))}),k!==ue&&k.traverseVisible(function(pe){pe.isLight&&pe.layers.test(oe.layers)&&(m.pushLight(pe),pe.castShadow&&m.pushShadow(pe))}),m.setupLights(_._useLegacyLights);const he=new Set;return k.traverse(function(pe){const He=pe.material;if(He)if(Array.isArray(He))for(let Ge=0;Ge<He.length;Ge++){const Ze=He[Ge];We(Ze,ue,pe),he.add(Ze)}else We(He,ue,pe),he.add(He)}),b.pop(),m=null,he},this.compileAsync=function(k,oe,ue=null){const he=this.compile(k,oe,ue);return new Promise(pe=>{function He(){if(he.forEach(function(Ge){ae.get(Ge).currentProgram.isReady()&&he.delete(Ge)}),he.size===0){pe(k);return}setTimeout(He,10)}I.get("KHR_parallel_shader_compile")!==null?He():setTimeout(He,10)})};let bt=null;function Ft(k){bt&&bt(k)}function zn(){ti.stop()}function kt(){ti.start()}const ti=new HP;ti.setAnimationLoop(Ft),typeof self<"u"&&ti.setContext(self),this.setAnimationLoop=function(k){bt=k,Ce.setAnimationLoop(k),k===null?ti.stop():ti.start()},Ce.addEventListener("sessionstart",zn),Ce.addEventListener("sessionend",kt),this.render=function(k,oe){if(oe!==void 0&&oe.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(y===!0)return;k.matrixWorldAutoUpdate===!0&&k.updateMatrixWorld(),oe.parent===null&&oe.matrixWorldAutoUpdate===!0&&oe.updateMatrixWorld(),Ce.enabled===!0&&Ce.isPresenting===!0&&(Ce.cameraAutoUpdate===!0&&Ce.updateCamera(oe),oe=Ce.getCamera()),k.isScene===!0&&k.onBeforeRender(_,k,oe,E),m=be.get(k,b.length),m.init(),b.push(m),ne.multiplyMatrices(oe.projectionMatrix,oe.matrixWorldInverse),W.setFromProjectionMatrix(ne),Re=this.localClippingEnabled,we=Ne.init(this.clippingPlanes,Re),v=de.get(k,g.length),v.init(),g.push(v),Br(k,oe,0,_.sortObjects),v.finish(),_.sortObjects===!0&&v.sort(te,Z),this.info.render.frame++,we===!0&&Ne.beginShadows();const ue=m.state.shadowsArray;if(Ae.render(ue,k,oe),we===!0&&Ne.endShadows(),this.info.autoReset===!0&&this.info.reset(),Fe.render(v,k),m.setupLights(_._useLegacyLights),oe.isArrayCamera){const he=oe.cameras;for(let pe=0,He=he.length;pe<He;pe++){const Ge=he[pe];vx(v,k,Ge,Ge.viewport)}}else vx(v,k,oe);E!==null&&(se.updateMultisampleRenderTarget(E),se.updateRenderTargetMipmap(E)),k.isScene===!0&&k.onAfterRender(_,k,oe),Y.resetDefaultState(),x=-1,M=null,b.pop(),b.length>0?m=b[b.length-1]:m=null,g.pop(),g.length>0?v=g[g.length-1]:v=null};function Br(k,oe,ue,he){if(k.visible===!1)return;if(k.layers.test(oe.layers)){if(k.isGroup)ue=k.renderOrder;else if(k.isLOD)k.autoUpdate===!0&&k.update(oe);else if(k.isLight)m.pushLight(k),k.castShadow&&m.pushShadow(k);else if(k.isSprite){if(!k.frustumCulled||W.intersectsSprite(k)){he&&P.setFromMatrixPosition(k.matrixWorld).applyMatrix4(ne);const Ge=O.update(k),Ze=k.material;Ze.visible&&v.push(k,Ge,Ze,ue,P.z,null)}}else if((k.isMesh||k.isLine||k.isPoints)&&(!k.frustumCulled||W.intersectsObject(k))){const Ge=O.update(k),Ze=k.material;if(he&&(k.boundingSphere!==void 0?(k.boundingSphere===null&&k.computeBoundingSphere(),P.copy(k.boundingSphere.center)):(Ge.boundingSphere===null&&Ge.computeBoundingSphere(),P.copy(Ge.boundingSphere.center)),P.applyMatrix4(k.matrixWorld).applyMatrix4(ne)),Array.isArray(Ze)){const it=Ge.groups;for(let mt=0,st=it.length;mt<st;mt++){const ot=it[mt],pn=Ze[ot.materialIndex];pn&&pn.visible&&v.push(k,Ge,pn,ue,P.z,ot)}}else Ze.visible&&v.push(k,Ge,Ze,ue,P.z,null)}}const He=k.children;for(let Ge=0,Ze=He.length;Ge<Ze;Ge++)Br(He[Ge],oe,ue,he)}function vx(k,oe,ue,he){const pe=k.opaque,He=k.transmissive,Ge=k.transparent;m.setupLightsView(ue),we===!0&&Ne.setGlobalState(_.clippingPlanes,ue),He.length>0&&SL(pe,He,oe,ue),he&&G.viewport(w.copy(he)),pe.length>0&&Rd(pe,oe,ue),He.length>0&&Rd(He,oe,ue),Ge.length>0&&Rd(Ge,oe,ue),G.buffers.depth.setTest(!0),G.buffers.depth.setMask(!0),G.buffers.color.setMask(!0),G.setPolygonOffset(!1)}function SL(k,oe,ue,he){if((ue.isScene===!0?ue.overrideMaterial:null)!==null)return;const He=z.isWebGL2;De===null&&(De=new Lr(1,1,{generateMipmaps:!0,type:I.has("EXT_color_buffer_half_float")?Cc:Tr,minFilter:rs,samples:He?4:0})),_.getDrawingBufferSize(q),He?De.setSize(q.x,q.y):De.setSize(Wp(q.x),Wp(q.y));const Ge=_.getRenderTarget();_.setRenderTarget(De),_.getClearColor($),U=_.getClearAlpha(),U<1&&_.setClearColor(16777215,.5),_.clear();const Ze=_.toneMapping;_.toneMapping=Rs,Rd(k,ue,he),se.updateMultisampleRenderTarget(De),se.updateRenderTargetMipmap(De);let it=!1;for(let mt=0,st=oe.length;mt<st;mt++){const ot=oe[mt],pn=ot.object,Li=ot.geometry,Dn=ot.material,hs=ot.group;if(Dn.side===bi&&pn.layers.test(he.layers)){const an=Dn.side;Dn.side=Qn,Dn.needsUpdate=!0,_x(pn,ue,he,Li,Dn,hs),Dn.side=an,Dn.needsUpdate=!0,it=!0}}it===!0&&(se.updateMultisampleRenderTarget(De),se.updateRenderTargetMipmap(De)),_.setRenderTarget(Ge),_.setClearColor($,U),_.toneMapping=Ze}function Rd(k,oe,ue){const he=oe.isScene===!0?oe.overrideMaterial:null;for(let pe=0,He=k.length;pe<He;pe++){const Ge=k[pe],Ze=Ge.object,it=Ge.geometry,mt=he===null?Ge.material:he,st=Ge.group;Ze.layers.test(ue.layers)&&_x(Ze,oe,ue,it,mt,st)}}function _x(k,oe,ue,he,pe,He){k.onBeforeRender(_,oe,ue,he,pe,He),k.modelViewMatrix.multiplyMatrices(ue.matrixWorldInverse,k.matrixWorld),k.normalMatrix.getNormalMatrix(k.modelViewMatrix),pe.onBeforeRender(_,oe,ue,he,k,He),pe.transparent===!0&&pe.side===bi&&pe.forceSinglePass===!1?(pe.side=Qn,pe.needsUpdate=!0,_.renderBufferDirect(ue,oe,he,pe,k,He),pe.side=ns,pe.needsUpdate=!0,_.renderBufferDirect(ue,oe,he,pe,k,He),pe.side=bi):_.renderBufferDirect(ue,oe,he,pe,k,He),k.onAfterRender(_,oe,ue,he,pe,He)}function Ld(k,oe,ue){oe.isScene!==!0&&(oe=N);const he=ae.get(k),pe=m.state.lights,He=m.state.shadowsArray,Ge=pe.state.version,Ze=J.getParameters(k,pe.state,He,oe,ue),it=J.getProgramCacheKey(Ze);let mt=he.programs;he.environment=k.isMeshStandardMaterial?oe.environment:null,he.fog=oe.fog,he.envMap=(k.isMeshStandardMaterial?le:ce).get(k.envMap||he.environment),mt===void 0&&(k.addEventListener("dispose",Ie),mt=new Map,he.programs=mt);let st=mt.get(it);if(st!==void 0){if(he.currentProgram===st&&he.lightsStateVersion===Ge)return bx(k,Ze),st}else Ze.uniforms=J.getUniforms(k),k.onBuild(ue,Ze,_),k.onBeforeCompile(Ze,_),st=J.acquireProgram(Ze,it),mt.set(it,st),he.uniforms=Ze.uniforms;const ot=he.uniforms;return(!k.isShaderMaterial&&!k.isRawShaderMaterial||k.clipping===!0)&&(ot.clippingPlanes=Ne.uniform),bx(k,Ze),he.needsLights=TL(k),he.lightsStateVersion=Ge,he.needsLights&&(ot.ambientLightColor.value=pe.state.ambient,ot.lightProbe.value=pe.state.probe,ot.directionalLights.value=pe.state.directional,ot.directionalLightShadows.value=pe.state.directionalShadow,ot.spotLights.value=pe.state.spot,ot.spotLightShadows.value=pe.state.spotShadow,ot.rectAreaLights.value=pe.state.rectArea,ot.ltc_1.value=pe.state.rectAreaLTC1,ot.ltc_2.value=pe.state.rectAreaLTC2,ot.pointLights.value=pe.state.point,ot.pointLightShadows.value=pe.state.pointShadow,ot.hemisphereLights.value=pe.state.hemi,ot.directionalShadowMap.value=pe.state.directionalShadowMap,ot.directionalShadowMatrix.value=pe.state.directionalShadowMatrix,ot.spotShadowMap.value=pe.state.spotShadowMap,ot.spotLightMatrix.value=pe.state.spotLightMatrix,ot.spotLightMap.value=pe.state.spotLightMap,ot.pointShadowMap.value=pe.state.pointShadowMap,ot.pointShadowMatrix.value=pe.state.pointShadowMatrix),he.currentProgram=st,he.uniformsList=null,st}function yx(k){if(k.uniformsList===null){const oe=k.currentProgram.getUniforms();k.uniformsList=gp.seqWithValue(oe.seq,k.uniforms)}return k.uniformsList}function bx(k,oe){const ue=ae.get(k);ue.outputColorSpace=oe.outputColorSpace,ue.instancing=oe.instancing,ue.instancingColor=oe.instancingColor,ue.skinning=oe.skinning,ue.morphTargets=oe.morphTargets,ue.morphNormals=oe.morphNormals,ue.morphColors=oe.morphColors,ue.morphTargetsCount=oe.morphTargetsCount,ue.numClippingPlanes=oe.numClippingPlanes,ue.numIntersection=oe.numClipIntersection,ue.vertexAlphas=oe.vertexAlphas,ue.vertexTangents=oe.vertexTangents,ue.toneMapping=oe.toneMapping}function ML(k,oe,ue,he,pe){oe.isScene!==!0&&(oe=N),se.resetTextureUnits();const He=oe.fog,Ge=he.isMeshStandardMaterial?oe.environment:null,Ze=E===null?_.outputColorSpace:E.isXRRenderTarget===!0?E.texture.colorSpace:ss,it=(he.isMeshStandardMaterial?le:ce).get(he.envMap||Ge),mt=he.vertexColors===!0&&!!ue.attributes.color&&ue.attributes.color.itemSize===4,st=!!ue.attributes.tangent&&(!!he.normalMap||he.anisotropy>0),ot=!!ue.morphAttributes.position,pn=!!ue.morphAttributes.normal,Li=!!ue.morphAttributes.color;let Dn=Rs;he.toneMapped&&(E===null||E.isXRRenderTarget===!0)&&(Dn=_.toneMapping);const hs=ue.morphAttributes.position||ue.morphAttributes.normal||ue.morphAttributes.color,an=hs!==void 0?hs.length:0,wt=ae.get(he),mg=m.state.lights;if(we===!0&&(Re===!0||k!==M)){const Oi=k===M&&he.id===x;Ne.setState(he,k,Oi)}let xn=!1;he.version===wt.__version?(wt.needsLights&&wt.lightsStateVersion!==mg.state.version||wt.outputColorSpace!==Ze||pe.isInstancedMesh&&wt.instancing===!1||!pe.isInstancedMesh&&wt.instancing===!0||pe.isSkinnedMesh&&wt.skinning===!1||!pe.isSkinnedMesh&&wt.skinning===!0||pe.isInstancedMesh&&wt.instancingColor===!0&&pe.instanceColor===null||pe.isInstancedMesh&&wt.instancingColor===!1&&pe.instanceColor!==null||wt.envMap!==it||he.fog===!0&&wt.fog!==He||wt.numClippingPlanes!==void 0&&(wt.numClippingPlanes!==Ne.numPlanes||wt.numIntersection!==Ne.numIntersection)||wt.vertexAlphas!==mt||wt.vertexTangents!==st||wt.morphTargets!==ot||wt.morphNormals!==pn||wt.morphColors!==Li||wt.toneMapping!==Dn||z.isWebGL2===!0&&wt.morphTargetsCount!==an)&&(xn=!0):(xn=!0,wt.__version=he.version);let jo=wt.currentProgram;xn===!0&&(jo=Ld(he,oe,pe));let xx=!1,eu=!1,gg=!1;const ni=jo.getUniforms(),Xo=wt.uniforms;if(G.useProgram(jo.program)&&(xx=!0,eu=!0,gg=!0),he.id!==x&&(x=he.id,eu=!0),xx||M!==k){ni.setValue(A,"projectionMatrix",k.projectionMatrix),ni.setValue(A,"viewMatrix",k.matrixWorldInverse);const Oi=ni.map.cameraPosition;Oi!==void 0&&Oi.setValue(A,P.setFromMatrixPosition(k.matrixWorld)),z.logarithmicDepthBuffer&&ni.setValue(A,"logDepthBufFC",2/(Math.log(k.far+1)/Math.LN2)),(he.isMeshPhongMaterial||he.isMeshToonMaterial||he.isMeshLambertMaterial||he.isMeshBasicMaterial||he.isMeshStandardMaterial||he.isShaderMaterial)&&ni.setValue(A,"isOrthographic",k.isOrthographicCamera===!0),M!==k&&(M=k,eu=!0,gg=!0)}if(pe.isSkinnedMesh){ni.setOptional(A,pe,"bindMatrix"),ni.setOptional(A,pe,"bindMatrixInverse");const Oi=pe.skeleton;Oi&&(z.floatVertexTextures?(Oi.boneTexture===null&&Oi.computeBoneTexture(),ni.setValue(A,"boneTexture",Oi.boneTexture,se),ni.setValue(A,"boneTextureSize",Oi.boneTextureSize)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}const vg=ue.morphAttributes;if((vg.position!==void 0||vg.normal!==void 0||vg.color!==void 0&&z.isWebGL2===!0)&&je.update(pe,ue,jo),(eu||wt.receiveShadow!==pe.receiveShadow)&&(wt.receiveShadow=pe.receiveShadow,ni.setValue(A,"receiveShadow",pe.receiveShadow)),he.isMeshGouraudMaterial&&he.envMap!==null&&(Xo.envMap.value=it,Xo.flipEnvMap.value=it.isCubeTexture&&it.isRenderTargetTexture===!1?-1:1),eu&&(ni.setValue(A,"toneMappingExposure",_.toneMappingExposure),wt.needsLights&&EL(Xo,gg),He&&he.fog===!0&&ge.refreshFogUniforms(Xo,He),ge.refreshMaterialUniforms(Xo,he,j,V,De),gp.upload(A,yx(wt),Xo,se)),he.isShaderMaterial&&he.uniformsNeedUpdate===!0&&(gp.upload(A,yx(wt),Xo,se),he.uniformsNeedUpdate=!1),he.isSpriteMaterial&&ni.setValue(A,"center",pe.center),ni.setValue(A,"modelViewMatrix",pe.modelViewMatrix),ni.setValue(A,"normalMatrix",pe.normalMatrix),ni.setValue(A,"modelMatrix",pe.matrixWorld),he.isShaderMaterial||he.isRawShaderMaterial){const Oi=he.uniformsGroups;for(let _g=0,AL=Oi.length;_g<AL;_g++)if(z.isWebGL2){const wx=Oi[_g];fe.update(wx,jo),fe.bind(wx,jo)}else console.warn("THREE.WebGLRenderer: Uniform Buffer Objects can only be used with WebGL 2.")}return jo}function EL(k,oe){k.ambientLightColor.needsUpdate=oe,k.lightProbe.needsUpdate=oe,k.directionalLights.needsUpdate=oe,k.directionalLightShadows.needsUpdate=oe,k.pointLights.needsUpdate=oe,k.pointLightShadows.needsUpdate=oe,k.spotLights.needsUpdate=oe,k.spotLightShadows.needsUpdate=oe,k.rectAreaLights.needsUpdate=oe,k.hemisphereLights.needsUpdate=oe}function TL(k){return k.isMeshLambertMaterial||k.isMeshToonMaterial||k.isMeshPhongMaterial||k.isMeshStandardMaterial||k.isShadowMaterial||k.isShaderMaterial&&k.lights===!0}this.getActiveCubeFace=function(){return T},this.getActiveMipmapLevel=function(){return S},this.getRenderTarget=function(){return E},this.setRenderTargetTextures=function(k,oe,ue){ae.get(k.texture).__webglTexture=oe,ae.get(k.depthTexture).__webglTexture=ue;const he=ae.get(k);he.__hasExternalTextures=!0,he.__hasExternalTextures&&(he.__autoAllocateDepthBuffer=ue===void 0,he.__autoAllocateDepthBuffer||I.has("WEBGL_multisampled_render_to_texture")===!0&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),he.__useRenderToTexture=!1))},this.setRenderTargetFramebuffer=function(k,oe){const ue=ae.get(k);ue.__webglFramebuffer=oe,ue.__useDefaultFramebuffer=oe===void 0},this.setRenderTarget=function(k,oe=0,ue=0){E=k,T=oe,S=ue;let he=!0,pe=null,He=!1,Ge=!1;if(k){const it=ae.get(k);it.__useDefaultFramebuffer!==void 0?(G.bindFramebuffer(A.FRAMEBUFFER,null),he=!1):it.__webglFramebuffer===void 0?se.setupRenderTarget(k):it.__hasExternalTextures&&se.rebindTextures(k,ae.get(k.texture).__webglTexture,ae.get(k.depthTexture).__webglTexture);const mt=k.texture;(mt.isData3DTexture||mt.isDataArrayTexture||mt.isCompressedArrayTexture)&&(Ge=!0);const st=ae.get(k).__webglFramebuffer;k.isWebGLCubeRenderTarget?(Array.isArray(st[oe])?pe=st[oe][ue]:pe=st[oe],He=!0):z.isWebGL2&&k.samples>0&&se.useMultisampledRTT(k)===!1?pe=ae.get(k).__webglMultisampledFramebuffer:Array.isArray(st)?pe=st[ue]:pe=st,w.copy(k.viewport),C.copy(k.scissor),L=k.scissorTest}else w.copy(Q).multiplyScalar(j).floor(),C.copy(X).multiplyScalar(j).floor(),L=re;if(G.bindFramebuffer(A.FRAMEBUFFER,pe)&&z.drawBuffers&&he&&G.drawBuffers(k,pe),G.viewport(w),G.scissor(C),G.setScissorTest(L),He){const it=ae.get(k.texture);A.framebufferTexture2D(A.FRAMEBUFFER,A.COLOR_ATTACHMENT0,A.TEXTURE_CUBE_MAP_POSITIVE_X+oe,it.__webglTexture,ue)}else if(Ge){const it=ae.get(k.texture),mt=oe||0;A.framebufferTextureLayer(A.FRAMEBUFFER,A.COLOR_ATTACHMENT0,it.__webglTexture,ue||0,mt)}x=-1},this.readRenderTargetPixels=function(k,oe,ue,he,pe,He,Ge){if(!(k&&k.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Ze=ae.get(k).__webglFramebuffer;if(k.isWebGLCubeRenderTarget&&Ge!==void 0&&(Ze=Ze[Ge]),Ze){G.bindFramebuffer(A.FRAMEBUFFER,Ze);try{const it=k.texture,mt=it.format,st=it.type;if(mt!==ki&&et.convert(mt)!==A.getParameter(A.IMPLEMENTATION_COLOR_READ_FORMAT)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}const ot=st===Cc&&(I.has("EXT_color_buffer_half_float")||z.isWebGL2&&I.has("EXT_color_buffer_float"));if(st!==Tr&&et.convert(st)!==A.getParameter(A.IMPLEMENTATION_COLOR_READ_TYPE)&&!(st===jr&&(z.isWebGL2||I.has("OES_texture_float")||I.has("WEBGL_color_buffer_float")))&&!ot){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}oe>=0&&oe<=k.width-he&&ue>=0&&ue<=k.height-pe&&A.readPixels(oe,ue,he,pe,et.convert(mt),et.convert(st),He)}finally{const it=E!==null?ae.get(E).__webglFramebuffer:null;G.bindFramebuffer(A.FRAMEBUFFER,it)}}},this.copyFramebufferToTexture=function(k,oe,ue=0){const he=Math.pow(2,-ue),pe=Math.floor(oe.image.width*he),He=Math.floor(oe.image.height*he);se.setTexture2D(oe,0),A.copyTexSubImage2D(A.TEXTURE_2D,ue,0,0,k.x,k.y,pe,He),G.unbindTexture()},this.copyTextureToTexture=function(k,oe,ue,he=0){const pe=oe.image.width,He=oe.image.height,Ge=et.convert(ue.format),Ze=et.convert(ue.type);se.setTexture2D(ue,0),A.pixelStorei(A.UNPACK_FLIP_Y_WEBGL,ue.flipY),A.pixelStorei(A.UNPACK_PREMULTIPLY_ALPHA_WEBGL,ue.premultiplyAlpha),A.pixelStorei(A.UNPACK_ALIGNMENT,ue.unpackAlignment),oe.isDataTexture?A.texSubImage2D(A.TEXTURE_2D,he,k.x,k.y,pe,He,Ge,Ze,oe.image.data):oe.isCompressedTexture?A.compressedTexSubImage2D(A.TEXTURE_2D,he,k.x,k.y,oe.mipmaps[0].width,oe.mipmaps[0].height,Ge,oe.mipmaps[0].data):A.texSubImage2D(A.TEXTURE_2D,he,k.x,k.y,Ge,Ze,oe.image),he===0&&ue.generateMipmaps&&A.generateMipmap(A.TEXTURE_2D),G.unbindTexture()},this.copyTextureToTexture3D=function(k,oe,ue,he,pe=0){if(_.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}const He=k.max.x-k.min.x+1,Ge=k.max.y-k.min.y+1,Ze=k.max.z-k.min.z+1,it=et.convert(he.format),mt=et.convert(he.type);let st;if(he.isData3DTexture)se.setTexture3D(he,0),st=A.TEXTURE_3D;else if(he.isDataArrayTexture)se.setTexture2DArray(he,0),st=A.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}A.pixelStorei(A.UNPACK_FLIP_Y_WEBGL,he.flipY),A.pixelStorei(A.UNPACK_PREMULTIPLY_ALPHA_WEBGL,he.premultiplyAlpha),A.pixelStorei(A.UNPACK_ALIGNMENT,he.unpackAlignment);const ot=A.getParameter(A.UNPACK_ROW_LENGTH),pn=A.getParameter(A.UNPACK_IMAGE_HEIGHT),Li=A.getParameter(A.UNPACK_SKIP_PIXELS),Dn=A.getParameter(A.UNPACK_SKIP_ROWS),hs=A.getParameter(A.UNPACK_SKIP_IMAGES),an=ue.isCompressedTexture?ue.mipmaps[0]:ue.image;A.pixelStorei(A.UNPACK_ROW_LENGTH,an.width),A.pixelStorei(A.UNPACK_IMAGE_HEIGHT,an.height),A.pixelStorei(A.UNPACK_SKIP_PIXELS,k.min.x),A.pixelStorei(A.UNPACK_SKIP_ROWS,k.min.y),A.pixelStorei(A.UNPACK_SKIP_IMAGES,k.min.z),ue.isDataTexture||ue.isData3DTexture?A.texSubImage3D(st,pe,oe.x,oe.y,oe.z,He,Ge,Ze,it,mt,an.data):ue.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),A.compressedTexSubImage3D(st,pe,oe.x,oe.y,oe.z,He,Ge,Ze,it,an.data)):A.texSubImage3D(st,pe,oe.x,oe.y,oe.z,He,Ge,Ze,it,mt,an),A.pixelStorei(A.UNPACK_ROW_LENGTH,ot),A.pixelStorei(A.UNPACK_IMAGE_HEIGHT,pn),A.pixelStorei(A.UNPACK_SKIP_PIXELS,Li),A.pixelStorei(A.UNPACK_SKIP_ROWS,Dn),A.pixelStorei(A.UNPACK_SKIP_IMAGES,hs),pe===0&&he.generateMipmaps&&A.generateMipmap(st),G.unbindTexture()},this.initTexture=function(k){k.isCubeTexture?se.setTextureCube(k,0):k.isData3DTexture?se.setTexture3D(k,0):k.isDataArrayTexture||k.isCompressedArrayTexture?se.setTexture2DArray(k,0):se.setTexture2D(k,0),G.unbindTexture()},this.resetState=function(){T=0,S=0,E=null,G.reset(),Y.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Xr}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=e===Dm?"display-p3":"srgb",t.unpackColorSpace=Ut.workingColorSpace===dd?"display-p3":"srgb"}get physicallyCorrectLights(){return console.warn("THREE.WebGLRenderer: The property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),!this.useLegacyLights}set physicallyCorrectLights(e){console.warn("THREE.WebGLRenderer: The property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),this.useLegacyLights=!e}get outputEncoding(){return console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace===Mn?Po:ab}set outputEncoding(e){console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace=e===Po?Mn:ss}get useLegacyLights(){return console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights}set useLegacyLights(e){console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights=e}}class KP extends nh{}KP.prototype.isWebGL1Renderer=!0;class Vm{constructor(e,t=25e-5){this.isFogExp2=!0,this.name="",this.color=new Pe(e),this.density=t}clone(){return new Vm(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class Hm{constructor(e,t=1,i=1e3){this.isFog=!0,this.name="",this.color=new Pe(e),this.near=t,this.far=i}clone(){return new Hm(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}class mb extends pt{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t}}class Wc{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=kh,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=Hi()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,i){e*=this.stride,i*=t.stride;for(let r=0,s=this.stride;r<s;r++)this.array[e+r]=t.array[i+r];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Hi()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),i=new this.constructor(t,this.stride);return i.setUsage(this.usage),i}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Hi()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}const ri=new D;class os{constructor(e,t,i,r=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=i,this.normalized=r}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,i=this.data.count;t<i;t++)ri.fromBufferAttribute(this,t),ri.applyMatrix4(e),this.setXYZ(t,ri.x,ri.y,ri.z);return this}applyNormalMatrix(e){for(let t=0,i=this.count;t<i;t++)ri.fromBufferAttribute(this,t),ri.applyNormalMatrix(e),this.setXYZ(t,ri.x,ri.y,ri.z);return this}transformDirection(e){for(let t=0,i=this.count;t<i;t++)ri.fromBufferAttribute(this,t),ri.transformDirection(e),this.setXYZ(t,ri.x,ri.y,ri.z);return this}setX(e,t){return this.normalized&&(t=ht(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=ht(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=ht(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=ht(t,this.array)),this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){let t=this.data.array[e*this.data.stride+this.offset];return this.normalized&&(t=xi(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=xi(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=xi(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=xi(t,this.array)),t}setXY(e,t,i){return e=e*this.data.stride+this.offset,this.normalized&&(t=ht(t,this.array),i=ht(i,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=i,this}setXYZ(e,t,i,r){return e=e*this.data.stride+this.offset,this.normalized&&(t=ht(t,this.array),i=ht(i,this.array),r=ht(r,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=i,this.data.array[e+2]=r,this}setXYZW(e,t,i,r,s){return e=e*this.data.stride+this.offset,this.normalized&&(t=ht(t,this.array),i=ht(i,this.array),r=ht(r,this.array),s=ht(s,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=i,this.data.array[e+2]=r,this.data.array[e+3]=s,this}clone(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let i=0;i<this.count;i++){const r=i*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[r+s])}return new At(new this.array.constructor(t),this.itemSize,this.normalized)}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new os(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let i=0;i<this.count;i++){const r=i*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[r+s])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}class gb extends En{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new Pe(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}let Ol;const vu=new D,Il=new D,Dl=new D,Ul=new _e,_u=new _e,ZP=new ze,xf=new D,yu=new D,wf=new D,pM=new _e,dv=new _e,mM=new _e;class JP extends pt{constructor(e=new gb){if(super(),this.isSprite=!0,this.type="Sprite",Ol===void 0){Ol=new qe;const t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),i=new Wc(t,5);Ol.setIndex([0,1,2,0,2,3]),Ol.setAttribute("position",new os(i,3,0,!1)),Ol.setAttribute("uv",new os(i,2,3,!1))}this.geometry=Ol,this.material=e,this.center=new _e(.5,.5)}raycast(e,t){e.camera===null&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),Il.setFromMatrixScale(this.matrixWorld),ZP.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),Dl.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&Il.multiplyScalar(-Dl.z);const i=this.material.rotation;let r,s;i!==0&&(s=Math.cos(i),r=Math.sin(i));const o=this.center;Sf(xf.set(-.5,-.5,0),Dl,o,Il,r,s),Sf(yu.set(.5,-.5,0),Dl,o,Il,r,s),Sf(wf.set(.5,.5,0),Dl,o,Il,r,s),pM.set(0,0),dv.set(1,0),mM.set(1,1);let a=e.ray.intersectTriangle(xf,yu,wf,!1,vu);if(a===null&&(Sf(yu.set(-.5,.5,0),Dl,o,Il,r,s),dv.set(0,1),a=e.ray.intersectTriangle(xf,wf,yu,!1,vu),a===null))return;const l=e.ray.origin.distanceTo(vu);l<e.near||l>e.far||t.push({distance:l,point:vu.clone(),uv:yi.getInterpolation(vu,xf,yu,wf,pM,dv,mM,new _e),face:null,object:this})}copy(e,t){return super.copy(e,t),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}}function Sf(n,e,t,i,r,s){Ul.subVectors(n,t).addScalar(.5).multiply(i),r!==void 0?(_u.x=s*Ul.x-r*Ul.y,_u.y=r*Ul.x+s*Ul.y):_u.copy(Ul),n.copy(e),n.x+=_u.x,n.y+=_u.y,n.applyMatrix4(ZP)}const Mf=new D,gM=new D;class QP extends pt{constructor(){super(),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]},isLOD:{value:!0}}),this.autoUpdate=!0}copy(e){super.copy(e,!1);const t=e.levels;for(let i=0,r=t.length;i<r;i++){const s=t[i];this.addLevel(s.object.clone(),s.distance,s.hysteresis)}return this.autoUpdate=e.autoUpdate,this}addLevel(e,t=0,i=0){t=Math.abs(t);const r=this.levels;let s;for(s=0;s<r.length&&!(t<r[s].distance);s++);return r.splice(s,0,{distance:t,hysteresis:i,object:e}),this.add(e),this}getCurrentLevel(){return this._currentLevel}getObjectForDistance(e){const t=this.levels;if(t.length>0){let i,r;for(i=1,r=t.length;i<r;i++){let s=t[i].distance;if(t[i].object.visible&&(s-=s*t[i].hysteresis),e<s)break}return t[i-1].object}return null}raycast(e,t){if(this.levels.length>0){Mf.setFromMatrixPosition(this.matrixWorld);const r=e.ray.origin.distanceTo(Mf);this.getObjectForDistance(r).raycast(e,t)}}update(e){const t=this.levels;if(t.length>1){Mf.setFromMatrixPosition(e.matrixWorld),gM.setFromMatrixPosition(this.matrixWorld);const i=Mf.distanceTo(gM)/e.zoom;t[0].object.visible=!0;let r,s;for(r=1,s=t.length;r<s;r++){let o=t[r].distance;if(t[r].object.visible&&(o-=o*t[r].hysteresis),i>=o)t[r-1].object.visible=!1,t[r].object.visible=!0;else break}for(this._currentLevel=r-1;r<s;r++)t[r].object.visible=!1}}toJSON(e){const t=super.toJSON(e);this.autoUpdate===!1&&(t.object.autoUpdate=!1),t.object.levels=[];const i=this.levels;for(let r=0,s=i.length;r<s;r++){const o=i[r];t.object.levels.push({object:o.object.uuid,distance:o.distance,hysteresis:o.hysteresis})}return t}}const vM=new D,_M=new vt,yM=new vt,FX=new D,bM=new ze,Ef=new D,fv=new Ri,xM=new ze,pv=new sl;class Gm extends Be{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=B0,this.bindMatrix=new ze,this.bindMatrixInverse=new ze,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const e=this.geometry;this.boundingBox===null&&(this.boundingBox=new Pi),this.boundingBox.makeEmpty();const t=e.getAttribute("position");for(let i=0;i<t.count;i++)this.getVertexPosition(i,Ef),this.boundingBox.expandByPoint(Ef)}computeBoundingSphere(){const e=this.geometry;this.boundingSphere===null&&(this.boundingSphere=new Ri),this.boundingSphere.makeEmpty();const t=e.getAttribute("position");for(let i=0;i<t.count;i++)this.getVertexPosition(i,Ef),this.boundingSphere.expandByPoint(Ef)}copy(e,t){return super.copy(e,t),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}raycast(e,t){const i=this.material,r=this.matrixWorld;i!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),fv.copy(this.boundingSphere),fv.applyMatrix4(r),e.ray.intersectsSphere(fv)!==!1&&(xM.copy(r).invert(),pv.copy(e.ray).applyMatrix4(xM),!(this.boundingBox!==null&&pv.intersectsBox(this.boundingBox)===!1)&&this._computeIntersections(e,t,pv)))}getVertexPosition(e,t){return super.getVertexPosition(e,t),this.applyBoneTransform(e,t),t}bind(e,t){this.skeleton=e,t===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const e=new vt,t=this.geometry.attributes.skinWeight;for(let i=0,r=t.count;i<r;i++){e.fromBufferAttribute(t,i);const s=1/e.manhattanLength();s!==1/0?e.multiplyScalar(s):e.set(1,0,0,0),t.setXYZW(i,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode===B0?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===cP?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(e,t){const i=this.skeleton,r=this.geometry;_M.fromBufferAttribute(r.attributes.skinIndex,e),yM.fromBufferAttribute(r.attributes.skinWeight,e),vM.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let s=0;s<4;s++){const o=yM.getComponent(s);if(o!==0){const a=_M.getComponent(s);bM.multiplyMatrices(i.bones[a].matrixWorld,i.boneInverses[a]),t.addScaledVector(FX.copy(vM).applyMatrix4(bM),o)}}return t.applyMatrix4(this.bindMatrixInverse)}boneTransform(e,t){return console.warn("THREE.SkinnedMesh: .boneTransform() was renamed to .applyBoneTransform() in r151."),this.applyBoneTransform(e,t)}}class Oc extends pt{constructor(){super(),this.isBone=!0,this.type="Bone"}}class fc extends Jt{constructor(e=null,t=1,i=1,r,s,o,a,l,c=hn,u=hn,h,d){super(null,o,a,l,c,u,r,s,h,d),this.isDataTexture=!0,this.image={data:e,width:t,height:i},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const wM=new ze,kX=new ze;class $c{constructor(e=[],t=[]){this.uuid=Hi(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.boneTexture=null,this.boneTextureSize=0,this.init()}init(){const e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(e.length*16),t.length===0)this.calculateInverses();else if(e.length!==t.length){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let i=0,r=this.bones.length;i<r;i++)this.boneInverses.push(new ze)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){const i=new ze;this.bones[e]&&i.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(i)}}pose(){for(let e=0,t=this.bones.length;e<t;e++){const i=this.bones[e];i&&i.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){const i=this.bones[e];i&&(i.parent&&i.parent.isBone?(i.matrix.copy(i.parent.matrixWorld).invert(),i.matrix.multiply(i.matrixWorld)):i.matrix.copy(i.matrixWorld),i.matrix.decompose(i.position,i.quaternion,i.scale))}}update(){const e=this.bones,t=this.boneInverses,i=this.boneMatrices,r=this.boneTexture;for(let s=0,o=e.length;s<o;s++){const a=e[s]?e[s].matrixWorld:kX;wM.multiplyMatrices(a,t[s]),wM.toArray(i,s*16)}r!==null&&(r.needsUpdate=!0)}clone(){return new $c(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(this.bones.length*4);e=DP(e),e=Math.max(e,4);const t=new Float32Array(e*e*4);t.set(this.boneMatrices);const i=new fc(t,e,e,ki,jr);return i.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=i,this.boneTextureSize=e,this}getBoneByName(e){for(let t=0,i=this.bones.length;t<i;t++){const r=this.bones[t];if(r.name===e)return r}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;for(let i=0,r=e.bones.length;i<r;i++){const s=e.bones[i];let o=t[s];o===void 0&&(console.warn("THREE.Skeleton: No bone found with UUID:",s),o=new Oc),this.bones.push(o),this.boneInverses.push(new ze().fromArray(e.boneInverses[i]))}return this.init(),this}toJSON(){const e={metadata:{version:4.6,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;const t=this.bones,i=this.boneInverses;for(let r=0,s=t.length;r<s;r++){const o=t[r];e.bones.push(o.uuid);const a=i[r];e.boneInverses.push(a.toArray())}return e}}class Ic extends At{constructor(e,t,i,r=1){super(e,t,i),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=r}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){const e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}const Nl=new ze,SM=new ze,Tf=[],MM=new Pi,BX=new ze,bu=new Be,xu=new Ri;class vb extends Be{constructor(e,t,i){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new Ic(new Float32Array(i*16),16),this.instanceColor=null,this.count=i,this.boundingBox=null,this.boundingSphere=null;for(let r=0;r<i;r++)this.setMatrixAt(r,BX)}computeBoundingBox(){const e=this.geometry,t=this.count;this.boundingBox===null&&(this.boundingBox=new Pi),e.boundingBox===null&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let i=0;i<t;i++)this.getMatrixAt(i,Nl),MM.copy(e.boundingBox).applyMatrix4(Nl),this.boundingBox.union(MM)}computeBoundingSphere(){const e=this.geometry,t=this.count;this.boundingSphere===null&&(this.boundingSphere=new Ri),e.boundingSphere===null&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let i=0;i<t;i++)this.getMatrixAt(i,Nl),xu.copy(e.boundingSphere).applyMatrix4(Nl),this.boundingSphere.union(xu)}copy(e,t){return super.copy(e,t),this.instanceMatrix.copy(e.instanceMatrix),e.instanceColor!==null&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}getColorAt(e,t){t.fromArray(this.instanceColor.array,e*3)}getMatrixAt(e,t){t.fromArray(this.instanceMatrix.array,e*16)}raycast(e,t){const i=this.matrixWorld,r=this.count;if(bu.geometry=this.geometry,bu.material=this.material,bu.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),xu.copy(this.boundingSphere),xu.applyMatrix4(i),e.ray.intersectsSphere(xu)!==!1))for(let s=0;s<r;s++){this.getMatrixAt(s,Nl),SM.multiplyMatrices(i,Nl),bu.matrixWorld=SM,bu.raycast(e,Tf);for(let o=0,a=Tf.length;o<a;o++){const l=Tf[o];l.instanceId=s,l.object=this,t.push(l)}Tf.length=0}}setColorAt(e,t){this.instanceColor===null&&(this.instanceColor=new Ic(new Float32Array(this.instanceMatrix.count*3),3)),t.toArray(this.instanceColor.array,e*3)}setMatrixAt(e,t){t.toArray(this.instanceMatrix.array,e*16)}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"})}}class Bn extends En{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Pe(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}const EM=new D,TM=new D,AM=new ze,mv=new sl,Af=new Ri;class ct extends pt{constructor(e=new qe,t=new Bn){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,i=[0];for(let r=1,s=t.count;r<s;r++)EM.fromBufferAttribute(t,r-1),TM.fromBufferAttribute(t,r),i[r]=i[r-1],i[r]+=EM.distanceTo(TM);e.setAttribute("lineDistance",new Ve(i,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){const i=this.geometry,r=this.matrixWorld,s=e.params.Line.threshold,o=i.drawRange;if(i.boundingSphere===null&&i.computeBoundingSphere(),Af.copy(i.boundingSphere),Af.applyMatrix4(r),Af.radius+=s,e.ray.intersectsSphere(Af)===!1)return;AM.copy(r).invert(),mv.copy(e.ray).applyMatrix4(AM);const a=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=a*a,c=new D,u=new D,h=new D,d=new D,f=this.isLineSegments?2:1,p=i.index,m=i.attributes.position;if(p!==null){const g=Math.max(0,o.start),b=Math.min(p.count,o.start+o.count);for(let _=g,y=b-1;_<y;_+=f){const T=p.getX(_),S=p.getX(_+1);if(c.fromBufferAttribute(m,T),u.fromBufferAttribute(m,S),mv.distanceSqToSegment(c,u,d,h)>l)continue;d.applyMatrix4(this.matrixWorld);const x=e.ray.origin.distanceTo(d);x<e.near||x>e.far||t.push({distance:x,point:h.clone().applyMatrix4(this.matrixWorld),index:_,face:null,faceIndex:null,object:this})}}else{const g=Math.max(0,o.start),b=Math.min(m.count,o.start+o.count);for(let _=g,y=b-1;_<y;_+=f){if(c.fromBufferAttribute(m,_),u.fromBufferAttribute(m,_+1),mv.distanceSqToSegment(c,u,d,h)>l)continue;d.applyMatrix4(this.matrixWorld);const S=e.ray.origin.distanceTo(d);S<e.near||S>e.far||t.push({distance:S,point:h.clone().applyMatrix4(this.matrixWorld),index:_,face:null,faceIndex:null,object:this})}}}updateMorphTargets(){const t=this.geometry.morphAttributes,i=Object.keys(t);if(i.length>0){const r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;s<o;s++){const a=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}}const CM=new D,PM=new D;class Fr extends ct{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,i=[];for(let r=0,s=t.count;r<s;r+=2)CM.fromBufferAttribute(t,r),PM.fromBufferAttribute(t,r+1),i[r]=r===0?0:i[r-1],i[r+1]=i[r]+CM.distanceTo(PM);e.setAttribute("lineDistance",new Ve(i,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class _b extends ct{constructor(e,t){super(e,t),this.isLineLoop=!0,this.type="LineLoop"}}class Wm extends En{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new Pe(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}const RM=new ze,g_=new sl,Cf=new Ri,Pf=new D;class yb extends pt{constructor(e=new qe,t=new Wm){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}raycast(e,t){const i=this.geometry,r=this.matrixWorld,s=e.params.Points.threshold,o=i.drawRange;if(i.boundingSphere===null&&i.computeBoundingSphere(),Cf.copy(i.boundingSphere),Cf.applyMatrix4(r),Cf.radius+=s,e.ray.intersectsSphere(Cf)===!1)return;RM.copy(r).invert(),g_.copy(e.ray).applyMatrix4(RM);const a=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=a*a,c=i.index,h=i.attributes.position;if(c!==null){const d=Math.max(0,o.start),f=Math.min(c.count,o.start+o.count);for(let p=d,v=f;p<v;p++){const m=c.getX(p);Pf.fromBufferAttribute(h,m),LM(Pf,m,l,r,e,t,this)}}else{const d=Math.max(0,o.start),f=Math.min(h.count,o.start+o.count);for(let p=d,v=f;p<v;p++)Pf.fromBufferAttribute(h,p),LM(Pf,p,l,r,e,t,this)}}updateMorphTargets(){const t=this.geometry.morphAttributes,i=Object.keys(t);if(i.length>0){const r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;s<o;s++){const a=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}}function LM(n,e,t,i,r,s,o){const a=g_.distanceSqToPoint(n);if(a<t){const l=new D;g_.closestPointToPoint(n,l),l.applyMatrix4(i);const c=r.ray.origin.distanceTo(l);if(c<r.near||c>r.far)return;s.push({distance:c,distanceToRay:Math.sqrt(a),point:l,index:e,face:null,object:o})}}class zX extends Jt{constructor(e,t,i,r,s,o,a,l,c){super(e,t,i,r,s,o,a,l,c),this.isVideoTexture=!0,this.minFilter=o!==void 0?o:rn,this.magFilter=s!==void 0?s:rn,this.generateMipmaps=!1;const u=this;function h(){u.needsUpdate=!0,e.requestVideoFrameCallback(h)}"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback(h)}clone(){return new this.constructor(this.image).copy(this)}update(){const e=this.image;"requestVideoFrameCallback"in e===!1&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}class v_ extends Jt{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=hn,this.minFilter=hn,this.generateMipmaps=!1,this.needsUpdate=!0}}class $m extends Jt{constructor(e,t,i,r,s,o,a,l,c,u,h,d){super(null,o,a,l,c,u,r,s,h,d),this.isCompressedTexture=!0,this.image={width:t,height:i},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class VX extends $m{constructor(e,t,i,r,s,o){super(e,t,i,s,o),this.isCompressedArrayTexture=!0,this.image.depth=r,this.wrapR=Rn}}class HX extends $m{constructor(e,t,i){super(void 0,e[0].width,e[0].height,t,i,Ns),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}class GX extends Jt{constructor(e,t,i,r,s,o,a,l,c){super(e,t,i,r,s,o,a,l,c),this.isCanvasTexture=!0,this.needsUpdate=!0}}class hr{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){const i=this.getUtoTmapping(e);return this.getPoint(i,t)}getPoints(e=5){const t=[];for(let i=0;i<=e;i++)t.push(this.getPoint(i/e));return t}getSpacedPoints(e=5){const t=[];for(let i=0;i<=e;i++)t.push(this.getPointAt(i/e));return t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const t=[];let i,r=this.getPoint(0),s=0;t.push(0);for(let o=1;o<=e;o++)i=this.getPoint(o/e),s+=i.distanceTo(r),t.push(s),r=i;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){const i=this.getLengths();let r=0;const s=i.length;let o;t?o=t:o=e*i[s-1];let a=0,l=s-1,c;for(;a<=l;)if(r=Math.floor(a+(l-a)/2),c=i[r]-o,c<0)a=r+1;else if(c>0)l=r-1;else{l=r;break}if(r=l,i[r]===o)return r/(s-1);const u=i[r],d=i[r+1]-u,f=(o-u)/d;return(r+f)/(s-1)}getTangent(e,t){let r=e-1e-4,s=e+1e-4;r<0&&(r=0),s>1&&(s=1);const o=this.getPoint(r),a=this.getPoint(s),l=t||(o.isVector2?new _e:new D);return l.copy(a).sub(o).normalize(),l}getTangentAt(e,t){const i=this.getUtoTmapping(e);return this.getTangent(i,t)}computeFrenetFrames(e,t){const i=new D,r=[],s=[],o=[],a=new D,l=new ze;for(let f=0;f<=e;f++){const p=f/e;r[f]=this.getTangentAt(p,new D)}s[0]=new D,o[0]=new D;let c=Number.MAX_VALUE;const u=Math.abs(r[0].x),h=Math.abs(r[0].y),d=Math.abs(r[0].z);u<=c&&(c=u,i.set(1,0,0)),h<=c&&(c=h,i.set(0,1,0)),d<=c&&i.set(0,0,1),a.crossVectors(r[0],i).normalize(),s[0].crossVectors(r[0],a),o[0].crossVectors(r[0],s[0]);for(let f=1;f<=e;f++){if(s[f]=s[f-1].clone(),o[f]=o[f-1].clone(),a.crossVectors(r[f-1],r[f]),a.length()>Number.EPSILON){a.normalize();const p=Math.acos(dn(r[f-1].dot(r[f]),-1,1));s[f].applyMatrix4(l.makeRotationAxis(a,p))}o[f].crossVectors(r[f],s[f])}if(t===!0){let f=Math.acos(dn(s[0].dot(s[e]),-1,1));f/=e,r[0].dot(a.crossVectors(s[0],s[e]))>0&&(f=-f);for(let p=1;p<=e;p++)s[p].applyMatrix4(l.makeRotationAxis(r[p],f*p)),o[p].crossVectors(r[p],s[p])}return{tangents:r,normals:s,binormals:o}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class jm extends hr{constructor(e=0,t=0,i=1,r=1,s=0,o=Math.PI*2,a=!1,l=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=i,this.yRadius=r,this.aStartAngle=s,this.aEndAngle=o,this.aClockwise=a,this.aRotation=l}getPoint(e,t){const i=t||new _e,r=Math.PI*2;let s=this.aEndAngle-this.aStartAngle;const o=Math.abs(s)<Number.EPSILON;for(;s<0;)s+=r;for(;s>r;)s-=r;s<Number.EPSILON&&(o?s=0:s=r),this.aClockwise===!0&&!o&&(s===r?s=-r:s=s-r);const a=this.aStartAngle+e*s;let l=this.aX+this.xRadius*Math.cos(a),c=this.aY+this.yRadius*Math.sin(a);if(this.aRotation!==0){const u=Math.cos(this.aRotation),h=Math.sin(this.aRotation),d=l-this.aX,f=c-this.aY;l=d*u-f*h+this.aX,c=d*h+f*u+this.aY}return i.set(l,c)}copy(e){return super.copy(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}toJSON(){const e=super.toJSON();return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e}fromJSON(e){return super.fromJSON(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}}class e3 extends jm{constructor(e,t,i,r,s,o){super(e,t,i,i,r,s,o),this.isArcCurve=!0,this.type="ArcCurve"}}function bb(){let n=0,e=0,t=0,i=0;function r(s,o,a,l){n=s,e=a,t=-3*s+3*o-2*a-l,i=2*s-2*o+a+l}return{initCatmullRom:function(s,o,a,l,c){r(o,a,c*(a-s),c*(l-o))},initNonuniformCatmullRom:function(s,o,a,l,c,u,h){let d=(o-s)/c-(a-s)/(c+u)+(a-o)/u,f=(a-o)/u-(l-o)/(u+h)+(l-a)/h;d*=u,f*=u,r(o,a,d,f)},calc:function(s){const o=s*s,a=o*s;return n+e*s+t*o+i*a}}}const Rf=new D,gv=new bb,vv=new bb,_v=new bb;class t3 extends hr{constructor(e=[],t=!1,i="centripetal",r=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=i,this.tension=r}getPoint(e,t=new D){const i=t,r=this.points,s=r.length,o=(s-(this.closed?0:1))*e;let a=Math.floor(o),l=o-a;this.closed?a+=a>0?0:(Math.floor(Math.abs(a)/s)+1)*s:l===0&&a===s-1&&(a=s-2,l=1);let c,u;this.closed||a>0?c=r[(a-1)%s]:(Rf.subVectors(r[0],r[1]).add(r[0]),c=Rf);const h=r[a%s],d=r[(a+1)%s];if(this.closed||a+2<s?u=r[(a+2)%s]:(Rf.subVectors(r[s-1],r[s-2]).add(r[s-1]),u=Rf),this.curveType==="centripetal"||this.curveType==="chordal"){const f=this.curveType==="chordal"?.5:.25;let p=Math.pow(c.distanceToSquared(h),f),v=Math.pow(h.distanceToSquared(d),f),m=Math.pow(d.distanceToSquared(u),f);v<1e-4&&(v=1),p<1e-4&&(p=v),m<1e-4&&(m=v),gv.initNonuniformCatmullRom(c.x,h.x,d.x,u.x,p,v,m),vv.initNonuniformCatmullRom(c.y,h.y,d.y,u.y,p,v,m),_v.initNonuniformCatmullRom(c.z,h.z,d.z,u.z,p,v,m)}else this.curveType==="catmullrom"&&(gv.initCatmullRom(c.x,h.x,d.x,u.x,this.tension),vv.initCatmullRom(c.y,h.y,d.y,u.y,this.tension),_v.initCatmullRom(c.z,h.z,d.z,u.z,this.tension));return i.set(gv.calc(l),vv.calc(l),_v.calc(l)),i}copy(e){super.copy(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){const r=e.points[t];this.points.push(r.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,i=this.points.length;t<i;t++){const r=this.points[t];e.points.push(r.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){const r=e.points[t];this.points.push(new D().fromArray(r))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}}function OM(n,e,t,i,r){const s=(i-e)*.5,o=(r-t)*.5,a=n*n,l=n*a;return(2*t-2*i+s+o)*l+(-3*t+3*i-2*s-o)*a+s*n+t}function WX(n,e){const t=1-n;return t*t*e}function $X(n,e){return 2*(1-n)*n*e}function jX(n,e){return n*n*e}function ih(n,e,t,i){return WX(n,e)+$X(n,t)+jX(n,i)}function XX(n,e){const t=1-n;return t*t*t*e}function YX(n,e){const t=1-n;return 3*t*t*n*e}function qX(n,e){return 3*(1-n)*n*n*e}function KX(n,e){return n*n*n*e}function rh(n,e,t,i,r){return XX(n,e)+YX(n,t)+qX(n,i)+KX(n,r)}class xb extends hr{constructor(e=new _e,t=new _e,i=new _e,r=new _e){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=i,this.v3=r}getPoint(e,t=new _e){const i=t,r=this.v0,s=this.v1,o=this.v2,a=this.v3;return i.set(rh(e,r.x,s.x,o.x,a.x),rh(e,r.y,s.y,o.y,a.y)),i}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class n3 extends hr{constructor(e=new D,t=new D,i=new D,r=new D){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=i,this.v3=r}getPoint(e,t=new D){const i=t,r=this.v0,s=this.v1,o=this.v2,a=this.v3;return i.set(rh(e,r.x,s.x,o.x,a.x),rh(e,r.y,s.y,o.y,a.y),rh(e,r.z,s.z,o.z,a.z)),i}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class wb extends hr{constructor(e=new _e,t=new _e){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new _e){const i=t;return e===1?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(e).add(this.v1)),i}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new _e){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class i3 extends hr{constructor(e=new D,t=new D){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}getPoint(e,t=new D){const i=t;return e===1?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(e).add(this.v1)),i}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new D){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class Sb extends hr{constructor(e=new _e,t=new _e,i=new _e){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=i}getPoint(e,t=new _e){const i=t,r=this.v0,s=this.v1,o=this.v2;return i.set(ih(e,r.x,s.x,o.x),ih(e,r.y,s.y,o.y)),i}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class Mb extends hr{constructor(e=new D,t=new D,i=new D){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=i}getPoint(e,t=new D){const i=t,r=this.v0,s=this.v1,o=this.v2;return i.set(ih(e,r.x,s.x,o.x),ih(e,r.y,s.y,o.y),ih(e,r.z,s.z,o.z)),i}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class Eb extends hr{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,t=new _e){const i=t,r=this.points,s=(r.length-1)*e,o=Math.floor(s),a=s-o,l=r[o===0?o:o-1],c=r[o],u=r[o>r.length-2?r.length-1:o+1],h=r[o>r.length-3?r.length-1:o+2];return i.set(OM(a,l.x,c.x,u.x,h.x),OM(a,l.y,c.y,u.y,h.y)),i}copy(e){super.copy(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){const r=e.points[t];this.points.push(r.clone())}return this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,i=this.points.length;t<i;t++){const r=this.points[t];e.points.push(r.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){const r=e.points[t];this.points.push(new _e().fromArray(r))}return this}}var $p=Object.freeze({__proto__:null,ArcCurve:e3,CatmullRomCurve3:t3,CubicBezierCurve:xb,CubicBezierCurve3:n3,EllipseCurve:jm,LineCurve:wb,LineCurve3:i3,QuadraticBezierCurve:Sb,QuadraticBezierCurve3:Mb,SplineCurve:Eb});class r3 extends hr{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(e){this.curves.push(e)}closePath(){const e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);if(!e.equals(t)){const i=e.isVector2===!0?"LineCurve":"LineCurve3";this.curves.push(new $p[i](t,e))}return this}getPoint(e,t){const i=e*this.getLength(),r=this.getCurveLengths();let s=0;for(;s<r.length;){if(r[s]>=i){const o=r[s]-i,a=this.curves[s],l=a.getLength(),c=l===0?0:1-o/l;return a.getPointAt(c,t)}s++}return null}getLength(){const e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const e=[];let t=0;for(let i=0,r=this.curves.length;i<r;i++)t+=this.curves[i].getLength(),e.push(t);return this.cacheLengths=e,e}getSpacedPoints(e=40){const t=[];for(let i=0;i<=e;i++)t.push(this.getPoint(i/e));return this.autoClose&&t.push(t[0]),t}getPoints(e=12){const t=[];let i;for(let r=0,s=this.curves;r<s.length;r++){const o=s[r],a=o.isEllipseCurve?e*2:o.isLineCurve||o.isLineCurve3?1:o.isSplineCurve?e*o.points.length:e,l=o.getPoints(a);for(let c=0;c<l.length;c++){const u=l[c];i&&i.equals(u)||(t.push(u),i=u)}}return this.autoClose&&t.length>1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,i=e.curves.length;t<i;t++){const r=e.curves[t];this.curves.push(r.clone())}return this.autoClose=e.autoClose,this}toJSON(){const e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let t=0,i=this.curves.length;t<i;t++){const r=this.curves[t];e.curves.push(r.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let t=0,i=e.curves.length;t<i;t++){const r=e.curves[t];this.curves.push(new $p[r.type]().fromJSON(r))}return this}}class Vh extends r3{constructor(e){super(),this.type="Path",this.currentPoint=new _e,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,i=e.length;t<i;t++)this.lineTo(e[t].x,e[t].y);return this}moveTo(e,t){return this.currentPoint.set(e,t),this}lineTo(e,t){const i=new wb(this.currentPoint.clone(),new _e(e,t));return this.curves.push(i),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,i,r){const s=new Sb(this.currentPoint.clone(),new _e(e,t),new _e(i,r));return this.curves.push(s),this.currentPoint.set(i,r),this}bezierCurveTo(e,t,i,r,s,o){const a=new xb(this.currentPoint.clone(),new _e(e,t),new _e(i,r),new _e(s,o));return this.curves.push(a),this.currentPoint.set(s,o),this}splineThru(e){const t=[this.currentPoint.clone()].concat(e),i=new Eb(t);return this.curves.push(i),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,i,r,s,o){const a=this.currentPoint.x,l=this.currentPoint.y;return this.absarc(e+a,t+l,i,r,s,o),this}absarc(e,t,i,r,s,o){return this.absellipse(e,t,i,i,r,s,o),this}ellipse(e,t,i,r,s,o,a,l){const c=this.currentPoint.x,u=this.currentPoint.y;return this.absellipse(e+c,t+u,i,r,s,o,a,l),this}absellipse(e,t,i,r,s,o,a,l){const c=new jm(e,t,i,r,s,o,a,l);if(this.curves.length>0){const h=c.getPoint(0);h.equals(this.currentPoint)||this.lineTo(h.x,h.y)}this.curves.push(c);const u=c.getPoint(1);return this.currentPoint.copy(u),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){const e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}}class md extends qe{constructor(e=[new _e(0,-.5),new _e(.5,0),new _e(0,.5)],t=12,i=0,r=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:i,phiLength:r},t=Math.floor(t),r=dn(r,0,Math.PI*2);const s=[],o=[],a=[],l=[],c=[],u=1/t,h=new D,d=new _e,f=new D,p=new D,v=new D;let m=0,g=0;for(let b=0;b<=e.length-1;b++)switch(b){case 0:m=e[b+1].x-e[b].x,g=e[b+1].y-e[b].y,f.x=g*1,f.y=-m,f.z=g*0,v.copy(f),f.normalize(),l.push(f.x,f.y,f.z);break;case e.length-1:l.push(v.x,v.y,v.z);break;default:m=e[b+1].x-e[b].x,g=e[b+1].y-e[b].y,f.x=g*1,f.y=-m,f.z=g*0,p.copy(f),f.x+=v.x,f.y+=v.y,f.z+=v.z,f.normalize(),l.push(f.x,f.y,f.z),v.copy(p)}for(let b=0;b<=t;b++){const _=i+b*u*r,y=Math.sin(_),T=Math.cos(_);for(let S=0;S<=e.length-1;S++){h.x=e[S].x*y,h.y=e[S].y,h.z=e[S].x*T,o.push(h.x,h.y,h.z),d.x=b/t,d.y=S/(e.length-1),a.push(d.x,d.y);const E=l[3*S+0]*y,x=l[3*S+1],M=l[3*S+0]*T;c.push(E,x,M)}}for(let b=0;b<t;b++)for(let _=0;_<e.length-1;_++){const y=_+b*e.length,T=y,S=y+e.length,E=y+e.length+1,x=y+1;s.push(T,S,x),s.push(E,x,S)}this.setIndex(s),this.setAttribute("position",new Ve(o,3)),this.setAttribute("uv",new Ve(a,2)),this.setAttribute("normal",new Ve(c,3))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new md(e.points,e.segments,e.phiStart,e.phiLength)}}class Xm extends md{constructor(e=1,t=1,i=4,r=8){const s=new Vh;s.absarc(0,-t/2,e,Math.PI*1.5,0),s.absarc(0,t/2,e,0,Math.PI*.5),super(s.getPoints(i),r),this.type="CapsuleGeometry",this.parameters={radius:e,length:t,capSegments:i,radialSegments:r}}static fromJSON(e){return new Xm(e.radius,e.length,e.capSegments,e.radialSegments)}}class Ym extends qe{constructor(e=1,t=32,i=0,r=Math.PI*2){super(),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:i,thetaLength:r},t=Math.max(3,t);const s=[],o=[],a=[],l=[],c=new D,u=new _e;o.push(0,0,0),a.push(0,0,1),l.push(.5,.5);for(let h=0,d=3;h<=t;h++,d+=3){const f=i+h/t*r;c.x=e*Math.cos(f),c.y=e*Math.sin(f),o.push(c.x,c.y,c.z),a.push(0,0,1),u.x=(o[d]/e+1)/2,u.y=(o[d+1]/e+1)/2,l.push(u.x,u.y)}for(let h=1;h<=t;h++)s.push(h,h+1,0);this.setIndex(s),this.setAttribute("position",new Ve(o,3)),this.setAttribute("normal",new Ve(a,3)),this.setAttribute("uv",new Ve(l,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Ym(e.radius,e.segments,e.thetaStart,e.thetaLength)}}class Hn extends qe{constructor(e=1,t=1,i=1,r=32,s=1,o=!1,a=0,l=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:i,radialSegments:r,heightSegments:s,openEnded:o,thetaStart:a,thetaLength:l};const c=this;r=Math.floor(r),s=Math.floor(s);const u=[],h=[],d=[],f=[];let p=0;const v=[],m=i/2;let g=0;b(),o===!1&&(e>0&&_(!0),t>0&&_(!1)),this.setIndex(u),this.setAttribute("position",new Ve(h,3)),this.setAttribute("normal",new Ve(d,3)),this.setAttribute("uv",new Ve(f,2));function b(){const y=new D,T=new D;let S=0;const E=(t-e)/i;for(let x=0;x<=s;x++){const M=[],w=x/s,C=w*(t-e)+e;for(let L=0;L<=r;L++){const $=L/r,U=$*l+a,H=Math.sin(U),V=Math.cos(U);T.x=C*H,T.y=-w*i+m,T.z=C*V,h.push(T.x,T.y,T.z),y.set(H,E,V).normalize(),d.push(y.x,y.y,y.z),f.push($,1-w),M.push(p++)}v.push(M)}for(let x=0;x<r;x++)for(let M=0;M<s;M++){const w=v[M][x],C=v[M+1][x],L=v[M+1][x+1],$=v[M][x+1];u.push(w,C,$),u.push(C,L,$),S+=6}c.addGroup(g,S,0),g+=S}function _(y){const T=p,S=new _e,E=new D;let x=0;const M=y===!0?e:t,w=y===!0?1:-1;for(let L=1;L<=r;L++)h.push(0,m*w,0),d.push(0,w,0),f.push(.5,.5),p++;const C=p;for(let L=0;L<=r;L++){const U=L/r*l+a,H=Math.cos(U),V=Math.sin(U);E.x=M*V,E.y=m*w,E.z=M*H,h.push(E.x,E.y,E.z),d.push(0,w,0),S.x=H*.5+.5,S.y=V*.5*w+.5,f.push(S.x,S.y),p++}for(let L=0;L<r;L++){const $=T+L,U=C+L;y===!0?u.push(U,U+1,$):u.push(U+1,U,$),x+=3}c.addGroup(g,x,y===!0?1:2),g+=x}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Hn(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class qm extends Hn{constructor(e=1,t=1,i=32,r=1,s=!1,o=0,a=Math.PI*2){super(0,e,t,i,r,s,o,a),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:i,heightSegments:r,openEnded:s,thetaStart:o,thetaLength:a}}static fromJSON(e){return new qm(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class Go extends qe{constructor(e=[],t=[],i=1,r=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:i,detail:r};const s=[],o=[];a(r),c(i),u(),this.setAttribute("position",new Ve(s,3)),this.setAttribute("normal",new Ve(s.slice(),3)),this.setAttribute("uv",new Ve(o,2)),r===0?this.computeVertexNormals():this.normalizeNormals();function a(b){const _=new D,y=new D,T=new D;for(let S=0;S<t.length;S+=3)f(t[S+0],_),f(t[S+1],y),f(t[S+2],T),l(_,y,T,b)}function l(b,_,y,T){const S=T+1,E=[];for(let x=0;x<=S;x++){E[x]=[];const M=b.clone().lerp(y,x/S),w=_.clone().lerp(y,x/S),C=S-x;for(let L=0;L<=C;L++)L===0&&x===S?E[x][L]=M:E[x][L]=M.clone().lerp(w,L/C)}for(let x=0;x<S;x++)for(let M=0;M<2*(S-x)-1;M++){const w=Math.floor(M/2);M%2===0?(d(E[x][w+1]),d(E[x+1][w]),d(E[x][w])):(d(E[x][w+1]),d(E[x+1][w+1]),d(E[x+1][w]))}}function c(b){const _=new D;for(let y=0;y<s.length;y+=3)_.x=s[y+0],_.y=s[y+1],_.z=s[y+2],_.normalize().multiplyScalar(b),s[y+0]=_.x,s[y+1]=_.y,s[y+2]=_.z}function u(){const b=new D;for(let _=0;_<s.length;_+=3){b.x=s[_+0],b.y=s[_+1],b.z=s[_+2];const y=m(b)/2/Math.PI+.5,T=g(b)/Math.PI+.5;o.push(y,1-T)}p(),h()}function h(){for(let b=0;b<o.length;b+=6){const _=o[b+0],y=o[b+2],T=o[b+4],S=Math.max(_,y,T),E=Math.min(_,y,T);S>.9&&E<.1&&(_<.2&&(o[b+0]+=1),y<.2&&(o[b+2]+=1),T<.2&&(o[b+4]+=1))}}function d(b){s.push(b.x,b.y,b.z)}function f(b,_){const y=b*3;_.x=e[y+0],_.y=e[y+1],_.z=e[y+2]}function p(){const b=new D,_=new D,y=new D,T=new D,S=new _e,E=new _e,x=new _e;for(let M=0,w=0;M<s.length;M+=9,w+=6){b.set(s[M+0],s[M+1],s[M+2]),_.set(s[M+3],s[M+4],s[M+5]),y.set(s[M+6],s[M+7],s[M+8]),S.set(o[w+0],o[w+1]),E.set(o[w+2],o[w+3]),x.set(o[w+4],o[w+5]),T.copy(b).add(_).add(y).divideScalar(3);const C=m(T);v(S,w+0,b,C),v(E,w+2,_,C),v(x,w+4,y,C)}}function v(b,_,y,T){T<0&&b.x===1&&(o[_]=b.x-1),y.x===0&&y.z===0&&(o[_]=T/2/Math.PI+.5)}function m(b){return Math.atan2(b.z,-b.x)}function g(b){return Math.atan2(-b.y,Math.sqrt(b.x*b.x+b.z*b.z))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Go(e.vertices,e.indices,e.radius,e.details)}}class Km extends Go{constructor(e=1,t=0){const i=(1+Math.sqrt(5))/2,r=1/i,s=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-r,-i,0,-r,i,0,r,-i,0,r,i,-r,-i,0,-r,i,0,r,-i,0,r,i,0,-i,0,-r,i,0,-r,-i,0,r,i,0,r],o=[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9];super(s,o,e,t),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new Km(e.radius,e.detail)}}const Lf=new D,Of=new D,yv=new D,If=new yi;class s3 extends qe{constructor(e=null,t=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:e,thresholdAngle:t},e!==null){const r=Math.pow(10,4),s=Math.cos(La*t),o=e.getIndex(),a=e.getAttribute("position"),l=o?o.count:a.count,c=[0,0,0],u=["a","b","c"],h=new Array(3),d={},f=[];for(let p=0;p<l;p+=3){o?(c[0]=o.getX(p),c[1]=o.getX(p+1),c[2]=o.getX(p+2)):(c[0]=p,c[1]=p+1,c[2]=p+2);const{a:v,b:m,c:g}=If;if(v.fromBufferAttribute(a,c[0]),m.fromBufferAttribute(a,c[1]),g.fromBufferAttribute(a,c[2]),If.getNormal(yv),h[0]="".concat(Math.round(v.x*r),",").concat(Math.round(v.y*r),",").concat(Math.round(v.z*r)),h[1]="".concat(Math.round(m.x*r),",").concat(Math.round(m.y*r),",").concat(Math.round(m.z*r)),h[2]="".concat(Math.round(g.x*r),",").concat(Math.round(g.y*r),",").concat(Math.round(g.z*r)),!(h[0]===h[1]||h[1]===h[2]||h[2]===h[0]))for(let b=0;b<3;b++){const _=(b+1)%3,y=h[b],T=h[_],S=If[u[b]],E=If[u[_]],x="".concat(y,"_").concat(T),M="".concat(T,"_").concat(y);M in d&&d[M]?(yv.dot(d[M].normal)<=s&&(f.push(S.x,S.y,S.z),f.push(E.x,E.y,E.z)),d[M]=null):x in d||(d[x]={index0:c[b],index1:c[_],normal:yv.clone()})}}for(const p in d)if(d[p]){const{index0:v,index1:m}=d[p];Lf.fromBufferAttribute(a,v),Of.fromBufferAttribute(a,m),f.push(Lf.x,Lf.y,Lf.z),f.push(Of.x,Of.y,Of.z)}this.setAttribute("position",new Ve(f,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}class Oa extends Vh{constructor(e){super(e),this.uuid=Hi(),this.type="Shape",this.holes=[]}getPointsHoles(e){const t=[];for(let i=0,r=this.holes.length;i<r;i++)t[i]=this.holes[i].getPoints(e);return t}extractPoints(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}}copy(e){super.copy(e),this.holes=[];for(let t=0,i=e.holes.length;t<i;t++){const r=e.holes[t];this.holes.push(r.clone())}return this}toJSON(){const e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let t=0,i=this.holes.length;t<i;t++){const r=this.holes[t];e.holes.push(r.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let t=0,i=e.holes.length;t<i;t++){const r=e.holes[t];this.holes.push(new Vh().fromJSON(r))}return this}}const ZX={triangulate:function(n,e,t=2){const i=e&&e.length,r=i?e[0]*t:n.length;let s=o3(n,0,r,t,!0);const o=[];if(!s||s.next===s.prev)return o;let a,l,c,u,h,d,f;if(i&&(s=nY(n,e,s,t)),n.length>80*t){a=c=n[0],l=u=n[1];for(let p=t;p<r;p+=t)h=n[p],d=n[p+1],h<a&&(a=h),d<l&&(l=d),h>c&&(c=h),d>u&&(u=d);f=Math.max(c-a,u-l),f=f!==0?32767/f:0}return Hh(s,o,t,a,l,f,0),o}};function o3(n,e,t,i,r){let s,o;if(r===fY(n,e,t,i)>0)for(s=e;s<t;s+=i)o=IM(s,n[s],n[s+1],o);else for(s=t-i;s>=e;s-=i)o=IM(s,n[s],n[s+1],o);return o&&Zm(o,o.next)&&(Wh(o),o=o.next),o}function Ha(n,e){if(!n)return n;e||(e=n);let t=n,i;do if(i=!1,!t.steiner&&(Zm(t,t.next)||sn(t.prev,t,t.next)===0)){if(Wh(t),t=e=t.prev,t===t.next)break;i=!0}else t=t.next;while(i||t!==e);return e}function Hh(n,e,t,i,r,s,o){if(!n)return;!o&&s&&aY(n,i,r,s);let a=n,l,c;for(;n.prev!==n.next;){if(l=n.prev,c=n.next,s?QX(n,i,r,s):JX(n)){e.push(l.i/t|0),e.push(n.i/t|0),e.push(c.i/t|0),Wh(n),n=c.next,a=c.next;continue}if(n=c,n===a){o?o===1?(n=eY(Ha(n),e,t),Hh(n,e,t,i,r,s,2)):o===2&&tY(n,e,t,i,r,s):Hh(Ha(n),e,t,i,r,s,1);break}}}function JX(n){const e=n.prev,t=n,i=n.next;if(sn(e,t,i)>=0)return!1;const r=e.x,s=t.x,o=i.x,a=e.y,l=t.y,c=i.y,u=r<s?r<o?r:o:s<o?s:o,h=a<l?a<c?a:c:l<c?l:c,d=r>s?r>o?r:o:s>o?s:o,f=a>l?a>c?a:c:l>c?l:c;let p=i.next;for(;p!==e;){if(p.x>=u&&p.x<=d&&p.y>=h&&p.y<=f&&Ql(r,a,s,l,o,c,p.x,p.y)&&sn(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function QX(n,e,t,i){const r=n.prev,s=n,o=n.next;if(sn(r,s,o)>=0)return!1;const a=r.x,l=s.x,c=o.x,u=r.y,h=s.y,d=o.y,f=a<l?a<c?a:c:l<c?l:c,p=u<h?u<d?u:d:h<d?h:d,v=a>l?a>c?a:c:l>c?l:c,m=u>h?u>d?u:d:h>d?h:d,g=__(f,p,e,t,i),b=__(v,m,e,t,i);let _=n.prevZ,y=n.nextZ;for(;_&&_.z>=g&&y&&y.z<=b;){if(_.x>=f&&_.x<=v&&_.y>=p&&_.y<=m&&_!==r&&_!==o&&Ql(a,u,l,h,c,d,_.x,_.y)&&sn(_.prev,_,_.next)>=0||(_=_.prevZ,y.x>=f&&y.x<=v&&y.y>=p&&y.y<=m&&y!==r&&y!==o&&Ql(a,u,l,h,c,d,y.x,y.y)&&sn(y.prev,y,y.next)>=0))return!1;y=y.nextZ}for(;_&&_.z>=g;){if(_.x>=f&&_.x<=v&&_.y>=p&&_.y<=m&&_!==r&&_!==o&&Ql(a,u,l,h,c,d,_.x,_.y)&&sn(_.prev,_,_.next)>=0)return!1;_=_.prevZ}for(;y&&y.z<=b;){if(y.x>=f&&y.x<=v&&y.y>=p&&y.y<=m&&y!==r&&y!==o&&Ql(a,u,l,h,c,d,y.x,y.y)&&sn(y.prev,y,y.next)>=0)return!1;y=y.nextZ}return!0}function eY(n,e,t){let i=n;do{const r=i.prev,s=i.next.next;!Zm(r,s)&&a3(r,i,i.next,s)&&Gh(r,s)&&Gh(s,r)&&(e.push(r.i/t|0),e.push(i.i/t|0),e.push(s.i/t|0),Wh(i),Wh(i.next),i=n=s),i=i.next}while(i!==n);return Ha(i)}function tY(n,e,t,i,r,s){let o=n;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&uY(o,a)){let l=l3(o,a);o=Ha(o,o.next),l=Ha(l,l.next),Hh(o,e,t,i,r,s,0),Hh(l,e,t,i,r,s,0);return}a=a.next}o=o.next}while(o!==n)}function nY(n,e,t,i){const r=[];let s,o,a,l,c;for(s=0,o=e.length;s<o;s++)a=e[s]*i,l=s<o-1?e[s+1]*i:n.length,c=o3(n,a,l,i,!1),c===c.next&&(c.steiner=!0),r.push(cY(c));for(r.sort(iY),s=0;s<r.length;s++)t=rY(r[s],t);return t}function iY(n,e){return n.x-e.x}function rY(n,e){const t=sY(n,e);if(!t)return e;const i=l3(t,n);return Ha(i,i.next),Ha(t,t.next)}function sY(n,e){let t=e,i=-1/0,r;const s=n.x,o=n.y;do{if(o<=t.y&&o>=t.next.y&&t.next.y!==t.y){const d=t.x+(o-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(d<=s&&d>i&&(i=d,r=t.x<t.next.x?t:t.next,d===s))return r}t=t.next}while(t!==e);if(!r)return null;const a=r,l=r.x,c=r.y;let u=1/0,h;t=r;do s>=t.x&&t.x>=l&&s!==t.x&&Ql(o<c?s:i,o,l,c,o<c?i:s,o,t.x,t.y)&&(h=Math.abs(o-t.y)/(s-t.x),Gh(t,n)&&(h<u||h===u&&(t.x>r.x||t.x===r.x&&oY(r,t)))&&(r=t,u=h)),t=t.next;while(t!==a);return r}function oY(n,e){return sn(n.prev,n,e.prev)<0&&sn(e.next,n,n.next)<0}function aY(n,e,t,i){let r=n;do r.z===0&&(r.z=__(r.x,r.y,e,t,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next;while(r!==n);r.prevZ.nextZ=null,r.prevZ=null,lY(r)}function lY(n){let e,t,i,r,s,o,a,l,c=1;do{for(t=n,n=null,s=null,o=0;t;){for(o++,i=t,a=0,e=0;e<c&&(a++,i=i.nextZ,!!i);e++);for(l=c;a>0||l>0&&i;)a!==0&&(l===0||!i||t.z<=i.z)?(r=t,t=t.nextZ,a--):(r=i,i=i.nextZ,l--),s?s.nextZ=r:n=r,r.prevZ=s,s=r;t=i}s.nextZ=null,c*=2}while(o>1);return n}function __(n,e,t,i,r){return n=(n-t)*r|0,e=(e-i)*r|0,n=(n|n<<8)&16711935,n=(n|n<<4)&252645135,n=(n|n<<2)&858993459,n=(n|n<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,n|e<<1}function cY(n){let e=n,t=n;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==n);return t}function Ql(n,e,t,i,r,s,o,a){return(r-o)*(e-a)>=(n-o)*(s-a)&&(n-o)*(i-a)>=(t-o)*(e-a)&&(t-o)*(s-a)>=(r-o)*(i-a)}function uY(n,e){return n.next.i!==e.i&&n.prev.i!==e.i&&!hY(n,e)&&(Gh(n,e)&&Gh(e,n)&&dY(n,e)&&(sn(n.prev,n,e.prev)||sn(n,e.prev,e))||Zm(n,e)&&sn(n.prev,n,n.next)>0&&sn(e.prev,e,e.next)>0)}function sn(n,e,t){return(e.y-n.y)*(t.x-e.x)-(e.x-n.x)*(t.y-e.y)}function Zm(n,e){return n.x===e.x&&n.y===e.y}function a3(n,e,t,i){const r=Uf(sn(n,e,t)),s=Uf(sn(n,e,i)),o=Uf(sn(t,i,n)),a=Uf(sn(t,i,e));return!!(r!==s&&o!==a||r===0&&Df(n,t,e)||s===0&&Df(n,i,e)||o===0&&Df(t,n,i)||a===0&&Df(t,e,i))}function Df(n,e,t){return e.x<=Math.max(n.x,t.x)&&e.x>=Math.min(n.x,t.x)&&e.y<=Math.max(n.y,t.y)&&e.y>=Math.min(n.y,t.y)}function Uf(n){return n>0?1:n<0?-1:0}function hY(n,e){let t=n;do{if(t.i!==n.i&&t.next.i!==n.i&&t.i!==e.i&&t.next.i!==e.i&&a3(t,t.next,n,e))return!0;t=t.next}while(t!==n);return!1}function Gh(n,e){return sn(n.prev,n,n.next)<0?sn(n,e,n.next)>=0&&sn(n,n.prev,e)>=0:sn(n,e,n.prev)<0||sn(n,n.next,e)<0}function dY(n,e){let t=n,i=!1;const r=(n.x+e.x)/2,s=(n.y+e.y)/2;do t.y>s!=t.next.y>s&&t.next.y!==t.y&&r<(t.next.x-t.x)*(s-t.y)/(t.next.y-t.y)+t.x&&(i=!i),t=t.next;while(t!==n);return i}function l3(n,e){const t=new y_(n.i,n.x,n.y),i=new y_(e.i,e.x,e.y),r=n.next,s=e.prev;return n.next=e,e.prev=n,t.next=r,r.prev=t,i.next=t,t.prev=i,s.next=i,i.prev=s,i}function IM(n,e,t,i){const r=new y_(n,e,t);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function Wh(n){n.next.prev=n.prev,n.prev.next=n.next,n.prevZ&&(n.prevZ.nextZ=n.nextZ),n.nextZ&&(n.nextZ.prevZ=n.prevZ)}function y_(n,e,t){this.i=n,this.x=e,this.y=t,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function fY(n,e,t,i){let r=0;for(let s=e,o=t-i;s<t;s+=i)r+=(n[o]-n[s])*(n[s+1]+n[o+1]),o=s;return r}class Kr{static area(e){const t=e.length;let i=0;for(let r=t-1,s=0;s<t;r=s++)i+=e[r].x*e[s].y-e[s].x*e[r].y;return i*.5}static isClockWise(e){return Kr.area(e)<0}static triangulateShape(e,t){const i=[],r=[],s=[];DM(e),UM(i,e);let o=e.length;t.forEach(DM);for(let l=0;l<t.length;l++)r.push(o),o+=t[l].length,UM(i,t[l]);const a=ZX.triangulate(i,r);for(let l=0;l<a.length;l+=3)s.push(a.slice(l,l+3));return s}}function DM(n){const e=n.length;e>2&&n[e-1].equals(n[0])&&n.pop()}function UM(n,e){for(let t=0;t<e.length;t++)n.push(e[t].x),n.push(e[t].y)}class Jm extends qe{constructor(e=new Oa([new _e(.5,.5),new _e(-.5,.5),new _e(-.5,-.5),new _e(.5,-.5)]),t={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];const i=this,r=[],s=[];for(let a=0,l=e.length;a<l;a++){const c=e[a];o(c)}this.setAttribute("position",new Ve(r,3)),this.setAttribute("uv",new Ve(s,2)),this.computeVertexNormals();function o(a){const l=[],c=t.curveSegments!==void 0?t.curveSegments:12,u=t.steps!==void 0?t.steps:1,h=t.depth!==void 0?t.depth:1;let d=t.bevelEnabled!==void 0?t.bevelEnabled:!0,f=t.bevelThickness!==void 0?t.bevelThickness:.2,p=t.bevelSize!==void 0?t.bevelSize:f-.1,v=t.bevelOffset!==void 0?t.bevelOffset:0,m=t.bevelSegments!==void 0?t.bevelSegments:3;const g=t.extrudePath,b=t.UVGenerator!==void 0?t.UVGenerator:pY;let _,y=!1,T,S,E,x;g&&(_=g.getSpacedPoints(u),y=!0,d=!1,T=g.computeFrenetFrames(u,!1),S=new D,E=new D,x=new D),d||(m=0,f=0,p=0,v=0);const M=a.extractPoints(c);let w=M.shape;const C=M.holes;if(!Kr.isClockWise(w)){w=w.reverse();for(let A=0,R=C.length;A<R;A++){const I=C[A];Kr.isClockWise(I)&&(C[A]=I.reverse())}}const $=Kr.triangulateShape(w,C),U=w;for(let A=0,R=C.length;A<R;A++){const I=C[A];w=w.concat(I)}function H(A,R,I){return R||console.error("THREE.ExtrudeGeometry: vec does not exist"),A.clone().addScaledVector(R,I)}const V=w.length,j=$.length;function te(A,R,I){let z,G,ee;const ae=A.x-R.x,se=A.y-R.y,ce=I.x-A.x,le=I.y-A.y,Me=ae*ae+se*se,F=ae*le-se*ce;if(Math.abs(F)>Number.EPSILON){const O=Math.sqrt(Me),J=Math.sqrt(ce*ce+le*le),ge=R.x-se/O,de=R.y+ae/O,be=I.x-le/J,Ne=I.y+ce/J,Ae=((be-ge)*le-(Ne-de)*ce)/(ae*le-se*ce);z=ge+ae*Ae-A.x,G=de+se*Ae-A.y;const Fe=z*z+G*G;if(Fe<=2)return new _e(z,G);ee=Math.sqrt(Fe/2)}else{let O=!1;ae>Number.EPSILON?ce>Number.EPSILON&&(O=!0):ae<-Number.EPSILON?ce<-Number.EPSILON&&(O=!0):Math.sign(se)===Math.sign(le)&&(O=!0),O?(z=-se,G=ae,ee=Math.sqrt(Me)):(z=ae,G=se,ee=Math.sqrt(Me/2))}return new _e(z/ee,G/ee)}const Z=[];for(let A=0,R=U.length,I=R-1,z=A+1;A<R;A++,I++,z++)I===R&&(I=0),z===R&&(z=0),Z[A]=te(U[A],U[I],U[z]);const Q=[];let X,re=Z.concat();for(let A=0,R=C.length;A<R;A++){const I=C[A];X=[];for(let z=0,G=I.length,ee=G-1,ae=z+1;z<G;z++,ee++,ae++)ee===G&&(ee=0),ae===G&&(ae=0),X[z]=te(I[z],I[ee],I[ae]);Q.push(X),re=re.concat(X)}for(let A=0;A<m;A++){const R=A/m,I=f*Math.cos(R*Math.PI/2),z=p*Math.sin(R*Math.PI/2)+v;for(let G=0,ee=U.length;G<ee;G++){const ae=H(U[G],Z[G],z);ne(ae.x,ae.y,-I)}for(let G=0,ee=C.length;G<ee;G++){const ae=C[G];X=Q[G];for(let se=0,ce=ae.length;se<ce;se++){const le=H(ae[se],X[se],z);ne(le.x,le.y,-I)}}}const W=p+v;for(let A=0;A<V;A++){const R=d?H(w[A],re[A],W):w[A];y?(E.copy(T.normals[0]).multiplyScalar(R.x),S.copy(T.binormals[0]).multiplyScalar(R.y),x.copy(_[0]).add(E).add(S),ne(x.x,x.y,x.z)):ne(R.x,R.y,0)}for(let A=1;A<=u;A++)for(let R=0;R<V;R++){const I=d?H(w[R],re[R],W):w[R];y?(E.copy(T.normals[A]).multiplyScalar(I.x),S.copy(T.binormals[A]).multiplyScalar(I.y),x.copy(_[A]).add(E).add(S),ne(x.x,x.y,x.z)):ne(I.x,I.y,h/u*A)}for(let A=m-1;A>=0;A--){const R=A/m,I=f*Math.cos(R*Math.PI/2),z=p*Math.sin(R*Math.PI/2)+v;for(let G=0,ee=U.length;G<ee;G++){const ae=H(U[G],Z[G],z);ne(ae.x,ae.y,h+I)}for(let G=0,ee=C.length;G<ee;G++){const ae=C[G];X=Q[G];for(let se=0,ce=ae.length;se<ce;se++){const le=H(ae[se],X[se],z);y?ne(le.x,le.y+_[u-1].y,_[u-1].x+I):ne(le.x,le.y,h+I)}}}we(),Re();function we(){const A=r.length/3;if(d){let R=0,I=V*R;for(let z=0;z<j;z++){const G=$[z];q(G[2]+I,G[1]+I,G[0]+I)}R=u+m*2,I=V*R;for(let z=0;z<j;z++){const G=$[z];q(G[0]+I,G[1]+I,G[2]+I)}}else{for(let R=0;R<j;R++){const I=$[R];q(I[2],I[1],I[0])}for(let R=0;R<j;R++){const I=$[R];q(I[0]+V*u,I[1]+V*u,I[2]+V*u)}}i.addGroup(A,r.length/3-A,0)}function Re(){const A=r.length/3;let R=0;De(U,R),R+=U.length;for(let I=0,z=C.length;I<z;I++){const G=C[I];De(G,R),R+=G.length}i.addGroup(A,r.length/3-A,1)}function De(A,R){let I=A.length;for(;--I>=0;){const z=I;let G=I-1;G<0&&(G=A.length-1);for(let ee=0,ae=u+m*2;ee<ae;ee++){const se=V*ee,ce=V*(ee+1),le=R+z+se,Me=R+G+se,F=R+G+ce,O=R+z+ce;P(le,Me,F,O)}}}function ne(A,R,I){l.push(A),l.push(R),l.push(I)}function q(A,R,I){N(A),N(R),N(I);const z=r.length/3,G=b.generateTopUV(i,r,z-3,z-2,z-1);B(G[0]),B(G[1]),B(G[2])}function P(A,R,I,z){N(A),N(R),N(z),N(R),N(I),N(z);const G=r.length/3,ee=b.generateSideWallUV(i,r,G-6,G-3,G-2,G-1);B(ee[0]),B(ee[1]),B(ee[3]),B(ee[1]),B(ee[2]),B(ee[3])}function N(A){r.push(l[A*3+0]),r.push(l[A*3+1]),r.push(l[A*3+2])}function B(A){s.push(A.x),s.push(A.y)}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON(),t=this.parameters.shapes,i=this.parameters.options;return mY(t,i,e)}static fromJSON(e,t){const i=[];for(let s=0,o=e.shapes.length;s<o;s++){const a=t[e.shapes[s]];i.push(a)}const r=e.options.extrudePath;return r!==void 0&&(e.options.extrudePath=new $p[r.type]().fromJSON(r)),new Jm(i,e.options)}}const pY={generateTopUV:function(n,e,t,i,r){const s=e[t*3],o=e[t*3+1],a=e[i*3],l=e[i*3+1],c=e[r*3],u=e[r*3+1];return[new _e(s,o),new _e(a,l),new _e(c,u)]},generateSideWallUV:function(n,e,t,i,r,s){const o=e[t*3],a=e[t*3+1],l=e[t*3+2],c=e[i*3],u=e[i*3+1],h=e[i*3+2],d=e[r*3],f=e[r*3+1],p=e[r*3+2],v=e[s*3],m=e[s*3+1],g=e[s*3+2];return Math.abs(a-u)<Math.abs(o-c)?[new _e(o,1-l),new _e(c,1-h),new _e(d,1-p),new _e(v,1-g)]:[new _e(a,1-l),new _e(u,1-h),new _e(f,1-p),new _e(m,1-g)]}};function mY(n,e,t){if(t.shapes=[],Array.isArray(n))for(let i=0,r=n.length;i<r;i++){const s=n[i];t.shapes.push(s.uuid)}else t.shapes.push(n.uuid);return t.options=Object.assign({},e),e.extrudePath!==void 0&&(t.options.extrudePath=e.extrudePath.toJSON()),t}class Qm extends Go{constructor(e=1,t=0){const i=(1+Math.sqrt(5))/2,r=[-1,i,0,1,i,0,-1,-i,0,1,-i,0,0,-1,i,0,1,i,0,-1,-i,0,1,-i,i,0,-1,i,0,1,-i,0,-1,-i,0,1],s=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1];super(r,s,e,t),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new Qm(e.radius,e.detail)}}class Qi extends Go{constructor(e=1,t=0){const i=[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],r=[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2];super(i,r,e,t),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new Qi(e.radius,e.detail)}}class eg extends qe{constructor(e=.5,t=1,i=32,r=1,s=0,o=Math.PI*2){super(),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:i,phiSegments:r,thetaStart:s,thetaLength:o},i=Math.max(3,i),r=Math.max(1,r);const a=[],l=[],c=[],u=[];let h=e;const d=(t-e)/r,f=new D,p=new _e;for(let v=0;v<=r;v++){for(let m=0;m<=i;m++){const g=s+m/i*o;f.x=h*Math.cos(g),f.y=h*Math.sin(g),l.push(f.x,f.y,f.z),c.push(0,0,1),p.x=(f.x/t+1)/2,p.y=(f.y/t+1)/2,u.push(p.x,p.y)}h+=d}for(let v=0;v<r;v++){const m=v*(i+1);for(let g=0;g<i;g++){const b=g+m,_=b,y=b+i+1,T=b+i+2,S=b+1;a.push(_,y,S),a.push(y,T,S)}}this.setIndex(a),this.setAttribute("position",new Ve(l,3)),this.setAttribute("normal",new Ve(c,3)),this.setAttribute("uv",new Ve(u,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new eg(e.innerRadius,e.outerRadius,e.thetaSegments,e.phiSegments,e.thetaStart,e.thetaLength)}}class tg extends qe{constructor(e=new Oa([new _e(0,.5),new _e(-.5,-.5),new _e(.5,-.5)]),t=12){super(),this.type="ShapeGeometry",this.parameters={shapes:e,curveSegments:t};const i=[],r=[],s=[],o=[];let a=0,l=0;if(Array.isArray(e)===!1)c(e);else for(let u=0;u<e.length;u++)c(e[u]),this.addGroup(a,l,u),a+=l,l=0;this.setIndex(i),this.setAttribute("position",new Ve(r,3)),this.setAttribute("normal",new Ve(s,3)),this.setAttribute("uv",new Ve(o,2));function c(u){const h=r.length/3,d=u.extractPoints(t);let f=d.shape;const p=d.holes;Kr.isClockWise(f)===!1&&(f=f.reverse());for(let m=0,g=p.length;m<g;m++){const b=p[m];Kr.isClockWise(b)===!0&&(p[m]=b.reverse())}const v=Kr.triangulateShape(f,p);for(let m=0,g=p.length;m<g;m++){const b=p[m];f=f.concat(b)}for(let m=0,g=f.length;m<g;m++){const b=f[m];r.push(b.x,b.y,0),s.push(0,0,1),o.push(b.x,b.y)}for(let m=0,g=v.length;m<g;m++){const b=v[m],_=b[0]+h,y=b[1]+h,T=b[2]+h;i.push(_,y,T),l+=3}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON(),t=this.parameters.shapes;return gY(t,e)}static fromJSON(e,t){const i=[];for(let r=0,s=e.shapes.length;r<s;r++){const o=t[e.shapes[r]];i.push(o)}return new tg(i,e.curveSegments)}}function gY(n,e){if(e.shapes=[],Array.isArray(n))for(let t=0,i=n.length;t<i;t++){const r=n[t];e.shapes.push(r.uuid)}else e.shapes.push(n.uuid);return e}class jc extends qe{constructor(e=1,t=32,i=16,r=0,s=Math.PI*2,o=0,a=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:i,phiStart:r,phiLength:s,thetaStart:o,thetaLength:a},t=Math.max(3,Math.floor(t)),i=Math.max(2,Math.floor(i));const l=Math.min(o+a,Math.PI);let c=0;const u=[],h=new D,d=new D,f=[],p=[],v=[],m=[];for(let g=0;g<=i;g++){const b=[],_=g/i;let y=0;g===0&&o===0?y=.5/t:g===i&&l===Math.PI&&(y=-.5/t);for(let T=0;T<=t;T++){const S=T/t;h.x=-e*Math.cos(r+S*s)*Math.sin(o+_*a),h.y=e*Math.cos(o+_*a),h.z=e*Math.sin(r+S*s)*Math.sin(o+_*a),p.push(h.x,h.y,h.z),d.copy(h).normalize(),v.push(d.x,d.y,d.z),m.push(S+y,1-_),b.push(c++)}u.push(b)}for(let g=0;g<i;g++)for(let b=0;b<t;b++){const _=u[g][b+1],y=u[g][b],T=u[g+1][b],S=u[g+1][b+1];(g!==0||o>0)&&f.push(_,y,S),(g!==i-1||l<Math.PI)&&f.push(y,T,S)}this.setIndex(f),this.setAttribute("position",new Ve(p,3)),this.setAttribute("normal",new Ve(v,3)),this.setAttribute("uv",new Ve(m,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new jc(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}class ng extends Go{constructor(e=1,t=0){const i=[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],r=[2,1,0,0,3,2,1,3,0,2,3,1];super(i,r,e,t),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new ng(e.radius,e.detail)}}class bo extends qe{constructor(e=1,t=.4,i=12,r=48,s=Math.PI*2){super(),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:i,tubularSegments:r,arc:s},i=Math.floor(i),r=Math.floor(r);const o=[],a=[],l=[],c=[],u=new D,h=new D,d=new D;for(let f=0;f<=i;f++)for(let p=0;p<=r;p++){const v=p/r*s,m=f/i*Math.PI*2;h.x=(e+t*Math.cos(m))*Math.cos(v),h.y=(e+t*Math.cos(m))*Math.sin(v),h.z=t*Math.sin(m),a.push(h.x,h.y,h.z),u.x=e*Math.cos(v),u.y=e*Math.sin(v),d.subVectors(h,u).normalize(),l.push(d.x,d.y,d.z),c.push(p/r),c.push(f/i)}for(let f=1;f<=i;f++)for(let p=1;p<=r;p++){const v=(r+1)*f+p-1,m=(r+1)*(f-1)+p-1,g=(r+1)*(f-1)+p,b=(r+1)*f+p;o.push(v,m,b),o.push(m,g,b)}this.setIndex(o),this.setAttribute("position",new Ve(a,3)),this.setAttribute("normal",new Ve(l,3)),this.setAttribute("uv",new Ve(c,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new bo(e.radius,e.tube,e.radialSegments,e.tubularSegments,e.arc)}}class ig extends qe{constructor(e=1,t=.4,i=64,r=8,s=2,o=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,tubularSegments:i,radialSegments:r,p:s,q:o},i=Math.floor(i),r=Math.floor(r);const a=[],l=[],c=[],u=[],h=new D,d=new D,f=new D,p=new D,v=new D,m=new D,g=new D;for(let _=0;_<=i;++_){const y=_/i*s*Math.PI*2;b(y,s,o,e,f),b(y+.01,s,o,e,p),m.subVectors(p,f),g.addVectors(p,f),v.crossVectors(m,g),g.crossVectors(v,m),v.normalize(),g.normalize();for(let T=0;T<=r;++T){const S=T/r*Math.PI*2,E=-t*Math.cos(S),x=t*Math.sin(S);h.x=f.x+(E*g.x+x*v.x),h.y=f.y+(E*g.y+x*v.y),h.z=f.z+(E*g.z+x*v.z),l.push(h.x,h.y,h.z),d.subVectors(h,f).normalize(),c.push(d.x,d.y,d.z),u.push(_/i),u.push(T/r)}}for(let _=1;_<=i;_++)for(let y=1;y<=r;y++){const T=(r+1)*(_-1)+(y-1),S=(r+1)*_+(y-1),E=(r+1)*_+y,x=(r+1)*(_-1)+y;a.push(T,S,x),a.push(S,E,x)}this.setIndex(a),this.setAttribute("position",new Ve(l,3)),this.setAttribute("normal",new Ve(c,3)),this.setAttribute("uv",new Ve(u,2));function b(_,y,T,S,E){const x=Math.cos(_),M=Math.sin(_),w=T/y*_,C=Math.cos(w);E.x=S*(2+C)*.5*x,E.y=S*(2+C)*M*.5,E.z=S*Math.sin(w)*.5}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new ig(e.radius,e.tube,e.tubularSegments,e.radialSegments,e.p,e.q)}}class rg extends qe{constructor(e=new Mb(new D(-1,-1,0),new D(-1,1,0),new D(1,1,0)),t=64,i=1,r=8,s=!1){super(),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:i,radialSegments:r,closed:s};const o=e.computeFrenetFrames(t,s);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals;const a=new D,l=new D,c=new _e;let u=new D;const h=[],d=[],f=[],p=[];v(),this.setIndex(p),this.setAttribute("position",new Ve(h,3)),this.setAttribute("normal",new Ve(d,3)),this.setAttribute("uv",new Ve(f,2));function v(){for(let _=0;_<t;_++)m(_);m(s===!1?t:0),b(),g()}function m(_){u=e.getPointAt(_/t,u);const y=o.normals[_],T=o.binormals[_];for(let S=0;S<=r;S++){const E=S/r*Math.PI*2,x=Math.sin(E),M=-Math.cos(E);l.x=M*y.x+x*T.x,l.y=M*y.y+x*T.y,l.z=M*y.z+x*T.z,l.normalize(),d.push(l.x,l.y,l.z),a.x=u.x+i*l.x,a.y=u.y+i*l.y,a.z=u.z+i*l.z,h.push(a.x,a.y,a.z)}}function g(){for(let _=1;_<=t;_++)for(let y=1;y<=r;y++){const T=(r+1)*(_-1)+(y-1),S=(r+1)*_+(y-1),E=(r+1)*_+y,x=(r+1)*(_-1)+y;p.push(T,S,x),p.push(S,E,x)}}function b(){for(let _=0;_<=t;_++)for(let y=0;y<=r;y++)c.x=_/t,c.y=y/r,f.push(c.x,c.y)}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON();return e.path=this.parameters.path.toJSON(),e}static fromJSON(e){return new rg(new $p[e.path.type]().fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}}class c3 extends qe{constructor(e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:e},e!==null){const t=[],i=new Set,r=new D,s=new D;if(e.index!==null){const o=e.attributes.position,a=e.index;let l=e.groups;l.length===0&&(l=[{start:0,count:a.count,materialIndex:0}]);for(let c=0,u=l.length;c<u;++c){const h=l[c],d=h.start,f=h.count;for(let p=d,v=d+f;p<v;p+=3)for(let m=0;m<3;m++){const g=a.getX(p+m),b=a.getX(p+(m+1)%3);r.fromBufferAttribute(o,g),s.fromBufferAttribute(o,b),NM(r,s,i)===!0&&(t.push(r.x,r.y,r.z),t.push(s.x,s.y,s.z))}}}else{const o=e.attributes.position;for(let a=0,l=o.count/3;a<l;a++)for(let c=0;c<3;c++){const u=3*a+c,h=3*a+(c+1)%3;r.fromBufferAttribute(o,u),s.fromBufferAttribute(o,h),NM(r,s,i)===!0&&(t.push(r.x,r.y,r.z),t.push(s.x,s.y,s.z))}}this.setAttribute("position",new Ve(t,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}function NM(n,e,t){const i="".concat(n.x,",").concat(n.y,",").concat(n.z,"-").concat(e.x,",").concat(e.y,",").concat(e.z),r="".concat(e.x,",").concat(e.y,",").concat(e.z,"-").concat(n.x,",").concat(n.y,",").concat(n.z);return t.has(i)===!0||t.has(r)===!0?!1:(t.add(i),t.add(r),!0)}var FM=Object.freeze({__proto__:null,BoxGeometry:ai,CapsuleGeometry:Xm,CircleGeometry:Ym,ConeGeometry:qm,CylinderGeometry:Hn,DodecahedronGeometry:Km,EdgesGeometry:s3,ExtrudeGeometry:Jm,IcosahedronGeometry:Qm,LatheGeometry:md,OctahedronGeometry:Qi,PlaneGeometry:Ni,PolyhedronGeometry:Go,RingGeometry:eg,ShapeGeometry:tg,SphereGeometry:jc,TetrahedronGeometry:ng,TorusGeometry:bo,TorusKnotGeometry:ig,TubeGeometry:rg,WireframeGeometry:c3});class u3 extends En{constructor(e){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new Pe(0),this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.fog=e.fog,this}}class sh extends cr{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class ol extends En{constructor(e){super(),this.isMeshStandardMaterial=!0,this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new Pe(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Pe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ho,this.normalScale=new _e(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class us extends ol{constructor(e){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new _e(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return dn(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new Pe(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new Pe(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new Pe(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(e)}get anisotropy(){return this._anisotropy}set anisotropy(e){this._anisotropy>0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}class oh extends En{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new Pe(16777215),this.specular=new Pe(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Pe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ho,this.normalScale=new _e(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=hd,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class h3 extends En{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new Pe(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Pe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ho,this.normalScale=new _e(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}class d3 extends En{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ho,this.normalScale=new _e(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}}class Tb extends En{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new Pe(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Pe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ho,this.normalScale=new _e(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=hd,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class f3 extends En{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new Pe(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ho,this.normalScale=new _e(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.flatShading=e.flatShading,this.fog=e.fog,this}}class p3 extends Bn{constructor(e){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}}function Ta(n,e,t){return!n||!t&&n.constructor===e?n:typeof e.BYTES_PER_ELEMENT=="number"?new e(n):Array.prototype.slice.call(n)}function m3(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}function g3(n){function e(r,s){return n[r]-n[s]}const t=n.length,i=new Array(t);for(let r=0;r!==t;++r)i[r]=r;return i.sort(e),i}function b_(n,e,t){const i=n.length,r=new n.constructor(i);for(let s=0,o=0;o!==i;++s){const a=t[s]*e;for(let l=0;l!==e;++l)r[o++]=n[a+l]}return r}function Ab(n,e,t,i){let r=1,s=n[0];for(;s!==void 0&&s[i]===void 0;)s=n[r++];if(s===void 0)return;let o=s[i];if(o!==void 0)if(Array.isArray(o))do o=s[i],o!==void 0&&(e.push(s.time),t.push.apply(t,o)),s=n[r++];while(s!==void 0);else if(o.toArray!==void 0)do o=s[i],o!==void 0&&(e.push(s.time),o.toArray(t,t.length)),s=n[r++];while(s!==void 0);else do o=s[i],o!==void 0&&(e.push(s.time),t.push(o)),s=n[r++];while(s!==void 0)}function vY(n,e,t,i,r=30){const s=n.clone();s.name=e;const o=[];for(let l=0;l<s.tracks.length;++l){const c=s.tracks[l],u=c.getValueSize(),h=[],d=[];for(let f=0;f<c.times.length;++f){const p=c.times[f]*r;if(!(p<t||p>=i)){h.push(c.times[f]);for(let v=0;v<u;++v)d.push(c.values[f*u+v])}}h.length!==0&&(c.times=Ta(h,c.times.constructor),c.values=Ta(d,c.values.constructor),o.push(c))}s.tracks=o;let a=1/0;for(let l=0;l<s.tracks.length;++l)a>s.tracks[l].times[0]&&(a=s.tracks[l].times[0]);for(let l=0;l<s.tracks.length;++l)s.tracks[l].shift(-1*a);return s.resetDuration(),s}function _Y(n,e=0,t=n,i=30){i<=0&&(i=30);const r=t.tracks.length,s=e/i;for(let o=0;o<r;++o){const a=t.tracks[o],l=a.ValueTypeName;if(l==="bool"||l==="string")continue;const c=n.tracks.find(function(g){return g.name===a.name&&g.ValueTypeName===l});if(c===void 0)continue;let u=0;const h=a.getValueSize();a.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(u=h/3);let d=0;const f=c.getValueSize();c.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(d=f/3);const p=a.times.length-1;let v;if(s<=a.times[0]){const g=u,b=h-u;v=a.values.slice(g,b)}else if(s>=a.times[p]){const g=p*h+u,b=g+h-u;v=a.values.slice(g,b)}else{const g=a.createInterpolant(),b=u,_=h-u;g.evaluate(s),v=g.resultBuffer.slice(b,_)}l==="quaternion"&&new gt().fromArray(v).normalize().conjugate().toArray(v);const m=c.times.length;for(let g=0;g<m;++g){const b=g*f+d;if(l==="quaternion")gt.multiplyQuaternionsFlat(c.values,b,v,0,c.values,b);else{const _=f-d*2;for(let y=0;y<_;++y)c.values[b+y]-=v[y]}}}return n.blendMode=sb,n}const yY={convertArray:Ta,isTypedArray:m3,getKeyframeOrder:g3,sortedArray:b_,flattenJSON:Ab,subclip:vY,makeClipAdditive:_Y};class Xc{constructor(e,t,i,r){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=r!==void 0?r:new t.constructor(i),this.sampleValues=t,this.valueSize=i,this.settings=null,this.DefaultSettings_={}}evaluate(e){const t=this.parameterPositions;let i=this._cachedIndex,r=t[i],s=t[i-1];e:{t:{let o;n:{i:if(!(e<r)){for(let a=i+2;;){if(r===void 0){if(e<s)break i;return i=t.length,this._cachedIndex=i,this.copySampleValue_(i-1)}if(i===a)break;if(s=r,r=t[++i],e<r)break t}o=t.length;break n}if(!(e>=s)){const a=t[1];e<a&&(i=2,s=a);for(let l=i-2;;){if(s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(i===l)break;if(r=s,s=t[--i-1],e>=s)break t}o=i,i=0;break n}break e}for(;i<o;){const a=i+o>>>1;e<t[a]?o=a:i=a+1}if(r=t[i],s=t[i-1],s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(r===void 0)return i=t.length,this._cachedIndex=i,this.copySampleValue_(i-1)}this._cachedIndex=i,this.intervalChanged_(i,s,r)}return this.interpolate_(i,s,e,r)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){const t=this.resultBuffer,i=this.sampleValues,r=this.valueSize,s=e*r;for(let o=0;o!==r;++o)t[o]=i[s+o];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class v3 extends Xc{constructor(e,t,i,r){super(e,t,i,r),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:Sa,endingEnd:Sa}}intervalChanged_(e,t,i){const r=this.parameterPositions;let s=e-2,o=e+1,a=r[s],l=r[o];if(a===void 0)switch(this.getSettings_().endingStart){case Ma:s=e,a=2*t-i;break;case Dh:s=r.length-2,a=t+r[s]-r[s+1];break;default:s=e,a=i}if(l===void 0)switch(this.getSettings_().endingEnd){case Ma:o=e,l=2*i-t;break;case Dh:o=1,l=i+r[1]-r[0];break;default:o=e-1,l=t}const c=(i-t)*.5,u=this.valueSize;this._weightPrev=c/(t-a),this._weightNext=c/(l-i),this._offsetPrev=s*u,this._offsetNext=o*u}interpolate_(e,t,i,r){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=e*a,c=l-a,u=this._offsetPrev,h=this._offsetNext,d=this._weightPrev,f=this._weightNext,p=(i-t)/(r-t),v=p*p,m=v*p,g=-d*m+2*d*v-d*p,b=(1+d)*m+(-1.5-2*d)*v+(-.5+d)*p+1,_=(-1-f)*m+(1.5+f)*v+.5*p,y=f*m-f*v;for(let T=0;T!==a;++T)s[T]=g*o[u+T]+b*o[c+T]+_*o[l+T]+y*o[h+T];return s}}class Cb extends Xc{constructor(e,t,i,r){super(e,t,i,r)}interpolate_(e,t,i,r){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=e*a,c=l-a,u=(i-t)/(r-t),h=1-u;for(let d=0;d!==a;++d)s[d]=o[c+d]*h+o[l+d]*u;return s}}class _3 extends Xc{constructor(e,t,i,r){super(e,t,i,r)}interpolate_(e){return this.copySampleValue_(e-1)}}class kr{constructor(e,t,i,r){if(e===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(t===void 0||t.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=Ta(t,this.TimeBufferType),this.values=Ta(i,this.ValueBufferType),this.setInterpolation(r||this.DefaultInterpolation)}static toJSON(e){const t=e.constructor;let i;if(t.toJSON!==this.toJSON)i=t.toJSON(e);else{i={name:e.name,times:Ta(e.times,Array),values:Ta(e.values,Array)};const r=e.getInterpolation();r!==e.DefaultInterpolation&&(i.interpolation=r)}return i.type=e.ValueTypeName,i}InterpolantFactoryMethodDiscrete(e){return new _3(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new Cb(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new v3(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case Pc:t=this.InterpolantFactoryMethodDiscrete;break;case Va:t=this.InterpolantFactoryMethodLinear;break;case mp:t=this.InterpolantFactoryMethodSmooth;break}if(t===void 0){const i="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(i);return console.warn("THREE.KeyframeTrack:",i),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Pc;case this.InterpolantFactoryMethodLinear:return Va;case this.InterpolantFactoryMethodSmooth:return mp}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){const t=this.times;for(let i=0,r=t.length;i!==r;++i)t[i]+=e}return this}scale(e){if(e!==1){const t=this.times;for(let i=0,r=t.length;i!==r;++i)t[i]*=e}return this}trim(e,t){const i=this.times,r=i.length;let s=0,o=r-1;for(;s!==r&&i[s]<e;)++s;for(;o!==-1&&i[o]>t;)--o;if(++o,s!==0||o!==r){s>=o&&(o=Math.max(o,1),s=o-1);const a=this.getValueSize();this.times=i.slice(s,o),this.values=this.values.slice(s*a,o*a)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);const i=this.times,r=this.values,s=i.length;s===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let o=null;for(let a=0;a!==s;a++){const l=i[a];if(typeof l=="number"&&isNaN(l)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,a,l),e=!1;break}if(o!==null&&o>l){console.error("THREE.KeyframeTrack: Out of order keys.",this,a,l,o),e=!1;break}o=l}if(r!==void 0&&m3(r))for(let a=0,l=r.length;a!==l;++a){const c=r[a];if(isNaN(c)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,a,c),e=!1;break}}return e}optimize(){const e=this.times.slice(),t=this.values.slice(),i=this.getValueSize(),r=this.getInterpolation()===mp,s=e.length-1;let o=1;for(let a=1;a<s;++a){let l=!1;const c=e[a],u=e[a+1];if(c!==u&&(a!==1||c!==e[0]))if(r)l=!0;else{const h=a*i,d=h-i,f=h+i;for(let p=0;p!==i;++p){const v=t[h+p];if(v!==t[d+p]||v!==t[f+p]){l=!0;break}}}if(l){if(a!==o){e[o]=e[a];const h=a*i,d=o*i;for(let f=0;f!==i;++f)t[d+f]=t[h+f]}++o}}if(s>0){e[o]=e[s];for(let a=s*i,l=o*i,c=0;c!==i;++c)t[l+c]=t[a+c];++o}return o!==e.length?(this.times=e.slice(0,o),this.values=t.slice(0,o*i)):(this.times=e,this.values=t),this}clone(){const e=this.times.slice(),t=this.values.slice(),i=this.constructor,r=new i(this.name,e,t);return r.createInterpolant=this.createInterpolant,r}}kr.prototype.TimeBufferType=Float32Array;kr.prototype.ValueBufferType=Float32Array;kr.prototype.DefaultInterpolation=Va;class al extends kr{}al.prototype.ValueTypeName="bool";al.prototype.ValueBufferType=Array;al.prototype.DefaultInterpolation=Pc;al.prototype.InterpolantFactoryMethodLinear=void 0;al.prototype.InterpolantFactoryMethodSmooth=void 0;class Pb extends kr{}Pb.prototype.ValueTypeName="color";class Ga extends kr{}Ga.prototype.ValueTypeName="number";class y3 extends Xc{constructor(e,t,i,r){super(e,t,i,r)}interpolate_(e,t,i,r){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=(i-t)/(r-t);let c=e*a;for(let u=c+a;c!==u;c+=4)gt.slerpFlat(s,0,o,c-a,o,c,l);return s}}class Fs extends kr{InterpolantFactoryMethodLinear(e){return new y3(this.times,this.values,this.getValueSize(),e)}}Fs.prototype.ValueTypeName="quaternion";Fs.prototype.DefaultInterpolation=Va;Fs.prototype.InterpolantFactoryMethodSmooth=void 0;class ll extends kr{}ll.prototype.ValueTypeName="string";ll.prototype.ValueBufferType=Array;ll.prototype.DefaultInterpolation=Pc;ll.prototype.InterpolantFactoryMethodLinear=void 0;ll.prototype.InterpolantFactoryMethodSmooth=void 0;class Wa extends kr{}Wa.prototype.ValueTypeName="vector";class $a{constructor(e,t=-1,i,r=Im){this.name=e,this.tracks=i,this.duration=t,this.blendMode=r,this.uuid=Hi(),this.duration<0&&this.resetDuration()}static parse(e){const t=[],i=e.tracks,r=1/(e.fps||1);for(let o=0,a=i.length;o!==a;++o)t.push(xY(i[o]).scale(r));const s=new this(e.name,e.duration,t,e.blendMode);return s.uuid=e.uuid,s}static toJSON(e){const t=[],i=e.tracks,r={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let s=0,o=i.length;s!==o;++s)t.push(kr.toJSON(i[s]));return r}static CreateFromMorphTargetSequence(e,t,i,r){const s=t.length,o=[];for(let a=0;a<s;a++){let l=[],c=[];l.push((a+s-1)%s,a,(a+1)%s),c.push(0,1,0);const u=g3(l);l=b_(l,1,u),c=b_(c,1,u),!r&&l[0]===0&&(l.push(s),c.push(c[0])),o.push(new Ga(".morphTargetInfluences["+t[a].name+"]",l,c).scale(1/i))}return new this(e,-1,o)}static findByName(e,t){let i=e;if(!Array.isArray(e)){const r=e;i=r.geometry&&r.geometry.animations||r.animations}for(let r=0;r<i.length;r++)if(i[r].name===t)return i[r];return null}static CreateClipsFromMorphTargetSequences(e,t,i){const r={},s=/^([\w-]*?)([\d]+)$/;for(let a=0,l=e.length;a<l;a++){const c=e[a],u=c.name.match(s);if(u&&u.length>1){const h=u[1];let d=r[h];d||(r[h]=d=[]),d.push(c)}}const o=[];for(const a in r)o.push(this.CreateFromMorphTargetSequence(a,r[a],t,i));return o}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const i=function(h,d,f,p,v){if(f.length!==0){const m=[],g=[];Ab(f,m,g,p),m.length!==0&&v.push(new h(d,m,g))}},r=[],s=e.name||"default",o=e.fps||30,a=e.blendMode;let l=e.length||-1;const c=e.hierarchy||[];for(let h=0;h<c.length;h++){const d=c[h].keys;if(!(!d||d.length===0))if(d[0].morphTargets){const f={};let p;for(p=0;p<d.length;p++)if(d[p].morphTargets)for(let v=0;v<d[p].morphTargets.length;v++)f[d[p].morphTargets[v]]=-1;for(const v in f){const m=[],g=[];for(let b=0;b!==d[p].morphTargets.length;++b){const _=d[p];m.push(_.time),g.push(_.morphTarget===v?1:0)}r.push(new Ga(".morphTargetInfluence["+v+"]",m,g))}l=f.length*o}else{const f=".bones["+t[h].name+"]";i(Wa,f+".position",d,"pos",r),i(Fs,f+".quaternion",d,"rot",r),i(Wa,f+".scale",d,"scl",r)}}return r.length===0?null:new this(s,l,r,a)}resetDuration(){const e=this.tracks;let t=0;for(let i=0,r=e.length;i!==r;++i){const s=this.tracks[i];t=Math.max(t,s.times[s.times.length-1])}return this.duration=t,this}trim(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}validate(){let e=!0;for(let t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e}optimize(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){const e=[];for(let t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());return new this.constructor(this.name,this.duration,e,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}}function bY(n){switch(n.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return Ga;case"vector":case"vector2":case"vector3":case"vector4":return Wa;case"color":return Pb;case"quaternion":return Fs;case"bool":case"boolean":return al;case"string":return ll}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+n)}function xY(n){if(n.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=bY(n.type);if(n.times===void 0){const t=[],i=[];Ab(n.keys,t,i,"value"),n.times=t,n.values=i}return e.parse!==void 0?e.parse(n):new e(n.name,n.times,n.values,n.interpolation)}const ja={enabled:!1,files:{},add:function(n,e){this.enabled!==!1&&(this.files[n]=e)},get:function(n){if(this.enabled!==!1)return this.files[n]},remove:function(n){delete this.files[n]},clear:function(){this.files={}}};class sg{constructor(e,t,i){const r=this;let s=!1,o=0,a=0,l;const c=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=i,this.itemStart=function(u){a++,s===!1&&r.onStart!==void 0&&r.onStart(u,o,a),s=!0},this.itemEnd=function(u){o++,r.onProgress!==void 0&&r.onProgress(u,o,a),o===a&&(s=!1,r.onLoad!==void 0&&r.onLoad())},this.itemError=function(u){r.onError!==void 0&&r.onError(u)},this.resolveURL=function(u){return l?l(u):u},this.setURLModifier=function(u){return l=u,this},this.addHandler=function(u,h){return c.push(u,h),this},this.removeHandler=function(u){const h=c.indexOf(u);return h!==-1&&c.splice(h,2),this},this.getHandler=function(u){for(let h=0,d=c.length;h<d;h+=2){const f=c[h],p=c[h+1];if(f.global&&(f.lastIndex=0),f.test(u))return p}return null}}}const ec=new sg;class Xn{constructor(e){this.manager=e!==void 0?e:ec,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){const i=this;return new Promise(function(r,s){i.load(e,r,t,s)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}}Xn.DEFAULT_MATERIAL_NAME="__DEFAULT";const _s={};class wY extends Error{constructor(e,t){super(e),this.response=t}}class Ti extends Xn{constructor(e){super(e)}load(e,t,i,r){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=ja.get(e);if(s!==void 0)return this.manager.itemStart(e),setTimeout(()=>{t&&t(s),this.manager.itemEnd(e)},0),s;if(_s[e]!==void 0){_s[e].push({onLoad:t,onProgress:i,onError:r});return}_s[e]=[],_s[e].push({onLoad:t,onProgress:i,onError:r});const o=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),a=this.mimeType,l=this.responseType;fetch(o).then(c=>{if(c.status===200||c.status===0){if(c.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||c.body===void 0||c.body.getReader===void 0)return c;const u=_s[e],h=c.body.getReader(),d=c.headers.get("Content-Length")||c.headers.get("X-File-Size"),f=d?parseInt(d):0,p=f!==0;let v=0;const m=new ReadableStream({start(g){b();function b(){h.read().then(({done:_,value:y})=>{if(_)g.close();else{v+=y.byteLength;const T=new ProgressEvent("progress",{lengthComputable:p,loaded:v,total:f});for(let S=0,E=u.length;S<E;S++){const x=u[S];x.onProgress&&x.onProgress(T)}g.enqueue(y),b()}})}}});return new Response(m)}else throw new wY('fetch for "'.concat(c.url,'" responded with ').concat(c.status,": ").concat(c.statusText),c)}).then(c=>{switch(l){case"arraybuffer":return c.arrayBuffer();case"blob":return c.blob();case"document":return c.text().then(u=>new DOMParser().parseFromString(u,a));case"json":return c.json();default:if(a===void 0)return c.text();{const h=/charset="?([^;"\s]*)"?/i.exec(a),d=h&&h[1]?h[1].toLowerCase():void 0,f=new TextDecoder(d);return c.arrayBuffer().then(p=>f.decode(p))}}}).then(c=>{ja.add(e,c);const u=_s[e];delete _s[e];for(let h=0,d=u.length;h<d;h++){const f=u[h];f.onLoad&&f.onLoad(c)}}).catch(c=>{const u=_s[e];if(u===void 0)throw this.manager.itemError(e),c;delete _s[e];for(let h=0,d=u.length;h<d;h++){const f=u[h];f.onError&&f.onError(c)}this.manager.itemError(e)}).finally(()=>{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class SY extends Xn{constructor(e){super(e)}load(e,t,i,r){const s=this,o=new Ti(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(a){try{t(s.parse(JSON.parse(a)))}catch(l){r?r(l):console.error(l),s.manager.itemError(e)}},i,r)}parse(e){const t=[];for(let i=0;i<e.length;i++){const r=$a.parse(e[i]);t.push(r)}return t}}class MY extends Xn{constructor(e){super(e)}load(e,t,i,r){const s=this,o=[],a=new $m,l=new Ti(this.manager);l.setPath(this.path),l.setResponseType("arraybuffer"),l.setRequestHeader(this.requestHeader),l.setWithCredentials(s.withCredentials);let c=0;function u(h){l.load(e[h],function(d){const f=s.parse(d,!0);o[h]={width:f.width,height:f.height,format:f.format,mipmaps:f.mipmaps},c+=1,c===6&&(f.mipmapCount===1&&(a.minFilter=rn),a.image=o,a.format=f.format,a.needsUpdate=!0,t&&t(a))},i,r)}if(Array.isArray(e))for(let h=0,d=e.length;h<d;++h)u(h);else l.load(e,function(h){const d=s.parse(h,!0);if(d.isCubemap){const f=d.mipmaps.length/d.mipmapCount;for(let p=0;p<f;p++){o[p]={mipmaps:[]};for(let v=0;v<d.mipmapCount;v++)o[p].mipmaps.push(d.mipmaps[p*d.mipmapCount+v]),o[p].format=d.format,o[p].width=d.width,o[p].height=d.height}a.image=o}else a.image.width=d.width,a.image.height=d.height,a.mipmaps=d.mipmaps;d.mipmapCount===1&&(a.minFilter=rn),a.format=d.format,a.needsUpdate=!0,t&&t(a)},i,r);return a}}class $h extends Xn{constructor(e){super(e)}load(e,t,i,r){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,o=ja.get(e);if(o!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0),o;const a=zh("img");function l(){u(),ja.add(e,this),t&&t(this),s.manager.itemEnd(e)}function c(h){u(),r&&r(h),s.manager.itemError(e),s.manager.itemEnd(e)}function u(){a.removeEventListener("load",l,!1),a.removeEventListener("error",c,!1)}return a.addEventListener("load",l,!1),a.addEventListener("error",c,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(a.crossOrigin=this.crossOrigin),s.manager.itemStart(e),a.src=e,a}}class EY extends Xn{constructor(e){super(e)}load(e,t,i,r){const s=new pd;s.colorSpace=Mn;const o=new $h(this.manager);o.setCrossOrigin(this.crossOrigin),o.setPath(this.path);let a=0;function l(c){o.load(e[c],function(u){s.images[c]=u,a++,a===6&&(s.needsUpdate=!0,t&&t(s))},void 0,r)}for(let c=0;c<e.length;++c)l(c);return s}}class TY extends Xn{constructor(e){super(e)}load(e,t,i,r){const s=this,o=new fc,a=new Ti(this.manager);return a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setPath(this.path),a.setWithCredentials(s.withCredentials),a.load(e,function(l){let c;try{c=s.parse(l)}catch(u){if(r!==void 0)r(u);else{console.error(u);return}}c.image!==void 0?o.image=c.image:c.data!==void 0&&(o.image.width=c.width,o.image.height=c.height,o.image.data=c.data),o.wrapS=c.wrapS!==void 0?c.wrapS:Rn,o.wrapT=c.wrapT!==void 0?c.wrapT:Rn,o.magFilter=c.magFilter!==void 0?c.magFilter:rn,o.minFilter=c.minFilter!==void 0?c.minFilter:rn,o.anisotropy=c.anisotropy!==void 0?c.anisotropy:1,c.colorSpace!==void 0?o.colorSpace=c.colorSpace:c.encoding!==void 0&&(o.encoding=c.encoding),c.flipY!==void 0&&(o.flipY=c.flipY),c.format!==void 0&&(o.format=c.format),c.type!==void 0&&(o.type=c.type),c.mipmaps!==void 0&&(o.mipmaps=c.mipmaps,o.minFilter=rs),c.mipmapCount===1&&(o.minFilter=rn),c.generateMipmaps!==void 0&&(o.generateMipmaps=c.generateMipmaps),o.needsUpdate=!0,t&&t(o,c)},i,r),o}}class og extends Xn{constructor(e){super(e)}load(e,t,i,r){const s=new Jt,o=new $h(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),o.load(e,function(a){s.image=a,s.needsUpdate=!0,t!==void 0&&t(s)},i,r),s}}class Wo extends pt{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new Pe(e),this.intensity=t}dispose(){}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,this.groundColor!==void 0&&(t.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(t.object.distance=this.distance),this.angle!==void 0&&(t.object.angle=this.angle),this.decay!==void 0&&(t.object.decay=this.decay),this.penumbra!==void 0&&(t.object.penumbra=this.penumbra),this.shadow!==void 0&&(t.object.shadow=this.shadow.toJSON()),t}}class b3 extends Wo{constructor(e,t,i){super(e,i),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(pt.DEFAULT_UP),this.updateMatrix(),this.groundColor=new Pe(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}}const bv=new ze,kM=new D,BM=new D;class Rb{constructor(e){this.camera=e,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new _e(512,512),this.map=null,this.mapPass=null,this.matrix=new ze,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Bm,this._frameExtents=new _e(1,1),this._viewportCount=1,this._viewports=[new vt(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,i=this.matrix;kM.setFromMatrixPosition(e.matrixWorld),t.position.copy(kM),BM.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(BM),t.updateMatrixWorld(),bv.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(bv),i.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),i.multiply(bv)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){const e={};return this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}class AY extends Rb{constructor(){super(new Nt(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(e){const t=this.camera,i=Rc*2*e.angle*this.focus,r=this.mapSize.width/this.mapSize.height,s=e.distance||t.far;(i!==t.fov||r!==t.aspect||s!==t.far)&&(t.fov=i,t.aspect=r,t.far=s,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class ag extends Wo{constructor(e,t,i=0,r=Math.PI/3,s=0,o=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(pt.DEFAULT_UP),this.updateMatrix(),this.target=new pt,this.distance=i,this.angle=r,this.penumbra=s,this.decay=o,this.map=null,this.shadow=new AY}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}const zM=new ze,wu=new D,xv=new D;class CY extends Rb{constructor(){super(new Nt(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new _e(4,2),this._viewportCount=6,this._viewports=[new vt(2,1,1,1),new vt(0,1,1,1),new vt(3,1,1,1),new vt(1,1,1,1),new vt(3,0,1,1),new vt(1,0,1,1)],this._cubeDirections=[new D(1,0,0),new D(-1,0,0),new D(0,0,1),new D(0,0,-1),new D(0,1,0),new D(0,-1,0)],this._cubeUps=[new D(0,1,0),new D(0,1,0),new D(0,1,0),new D(0,1,0),new D(0,0,1),new D(0,0,-1)]}updateMatrices(e,t=0){const i=this.camera,r=this.matrix,s=e.distance||i.far;s!==i.far&&(i.far=s,i.updateProjectionMatrix()),wu.setFromMatrixPosition(e.matrixWorld),i.position.copy(wu),xv.copy(i.position),xv.add(this._cubeDirections[t]),i.up.copy(this._cubeUps[t]),i.lookAt(xv),i.updateMatrixWorld(),r.makeTranslation(-wu.x,-wu.y,-wu.z),zM.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),this._frustum.setFromProjectionMatrix(zM)}}class jh extends Wo{constructor(e,t,i=0,r=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=i,this.decay=r,this.shadow=new CY}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}class PY extends Rb{constructor(){super(new zi(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class lg extends Wo{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(pt.DEFAULT_UP),this.updateMatrix(),this.target=new pt,this.shadow=new PY}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class Lb extends Wo{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class x3 extends Wo{constructor(e,t,i=10,r=10){super(e,t),this.isRectAreaLight=!0,this.type="RectAreaLight",this.width=i,this.height=r}get power(){return this.intensity*this.width*this.height*Math.PI}set power(e){this.intensity=e/(this.width*this.height*Math.PI)}copy(e){return super.copy(e),this.width=e.width,this.height=e.height,this}toJSON(e){const t=super.toJSON(e);return t.object.width=this.width,t.object.height=this.height,t}}class w3{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new D)}set(e){for(let t=0;t<9;t++)this.coefficients[t].copy(e[t]);return this}zero(){for(let e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this}getAt(e,t){const i=e.x,r=e.y,s=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.282095),t.addScaledVector(o[1],.488603*r),t.addScaledVector(o[2],.488603*s),t.addScaledVector(o[3],.488603*i),t.addScaledVector(o[4],1.092548*(i*r)),t.addScaledVector(o[5],1.092548*(r*s)),t.addScaledVector(o[6],.315392*(3*s*s-1)),t.addScaledVector(o[7],1.092548*(i*s)),t.addScaledVector(o[8],.546274*(i*i-r*r)),t}getIrradianceAt(e,t){const i=e.x,r=e.y,s=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.886227),t.addScaledVector(o[1],2*.511664*r),t.addScaledVector(o[2],2*.511664*s),t.addScaledVector(o[3],2*.511664*i),t.addScaledVector(o[4],2*.429043*i*r),t.addScaledVector(o[5],2*.429043*r*s),t.addScaledVector(o[6],.743125*s*s-.247708),t.addScaledVector(o[7],2*.429043*i*s),t.addScaledVector(o[8],.429043*(i*i-r*r)),t}add(e){for(let t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this}addScaledSH(e,t){for(let i=0;i<9;i++)this.coefficients[i].addScaledVector(e.coefficients[i],t);return this}scale(e){for(let t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this}lerp(e,t){for(let i=0;i<9;i++)this.coefficients[i].lerp(e.coefficients[i],t);return this}equals(e){for(let t=0;t<9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0}copy(e){return this.set(e.coefficients)}clone(){return new this.constructor().copy(this)}fromArray(e,t=0){const i=this.coefficients;for(let r=0;r<9;r++)i[r].fromArray(e,t+r*3);return this}toArray(e=[],t=0){const i=this.coefficients;for(let r=0;r<9;r++)i[r].toArray(e,t+r*3);return e}static getBasisAt(e,t){const i=e.x,r=e.y,s=e.z;t[0]=.282095,t[1]=.488603*r,t[2]=.488603*s,t[3]=.488603*i,t[4]=1.092548*i*r,t[5]=1.092548*r*s,t[6]=.315392*(3*s*s-1),t[7]=1.092548*i*s,t[8]=.546274*(i*i-r*r)}}class S3 extends Wo{constructor(e=new w3,t=1){super(void 0,t),this.isLightProbe=!0,this.sh=e}copy(e){return super.copy(e),this.sh.copy(e.sh),this}fromJSON(e){return this.intensity=e.intensity,this.sh.fromArray(e.sh),this}toJSON(e){const t=super.toJSON(e);return t.object.sh=this.sh.toArray(),t}}class cg extends Xn{constructor(e){super(e),this.textures={}}load(e,t,i,r){const s=this,o=new Ti(s.manager);o.setPath(s.path),o.setRequestHeader(s.requestHeader),o.setWithCredentials(s.withCredentials),o.load(e,function(a){try{t(s.parse(JSON.parse(a)))}catch(l){r?r(l):console.error(l),s.manager.itemError(e)}},i,r)}parse(e){const t=this.textures;function i(s){return t[s]===void 0&&console.warn("THREE.MaterialLoader: Undefined texture",s),t[s]}const r=cg.createMaterialFromType(e.type);if(e.uuid!==void 0&&(r.uuid=e.uuid),e.name!==void 0&&(r.name=e.name),e.color!==void 0&&r.color!==void 0&&r.color.setHex(e.color),e.roughness!==void 0&&(r.roughness=e.roughness),e.metalness!==void 0&&(r.metalness=e.metalness),e.sheen!==void 0&&(r.sheen=e.sheen),e.sheenColor!==void 0&&(r.sheenColor=new Pe().setHex(e.sheenColor)),e.sheenRoughness!==void 0&&(r.sheenRoughness=e.sheenRoughness),e.emissive!==void 0&&r.emissive!==void 0&&r.emissive.setHex(e.emissive),e.specular!==void 0&&r.specular!==void 0&&r.specular.setHex(e.specular),e.specularIntensity!==void 0&&(r.specularIntensity=e.specularIntensity),e.specularColor!==void 0&&r.specularColor!==void 0&&r.specularColor.setHex(e.specularColor),e.shininess!==void 0&&(r.shininess=e.shininess),e.clearcoat!==void 0&&(r.clearcoat=e.clearcoat),e.clearcoatRoughness!==void 0&&(r.clearcoatRoughness=e.clearcoatRoughness),e.iridescence!==void 0&&(r.iridescence=e.iridescence),e.iridescenceIOR!==void 0&&(r.iridescenceIOR=e.iridescenceIOR),e.iridescenceThicknessRange!==void 0&&(r.iridescenceThicknessRange=e.iridescenceThicknessRange),e.transmission!==void 0&&(r.transmission=e.transmission),e.thickness!==void 0&&(r.thickness=e.thickness),e.attenuationDistance!==void 0&&(r.attenuationDistance=e.attenuationDistance),e.attenuationColor!==void 0&&r.attenuationColor!==void 0&&r.attenuationColor.setHex(e.attenuationColor),e.anisotropy!==void 0&&(r.anisotropy=e.anisotropy),e.anisotropyRotation!==void 0&&(r.anisotropyRotation=e.anisotropyRotation),e.fog!==void 0&&(r.fog=e.fog),e.flatShading!==void 0&&(r.flatShading=e.flatShading),e.blending!==void 0&&(r.blending=e.blending),e.combine!==void 0&&(r.combine=e.combine),e.side!==void 0&&(r.side=e.side),e.shadowSide!==void 0&&(r.shadowSide=e.shadowSide),e.opacity!==void 0&&(r.opacity=e.opacity),e.transparent!==void 0&&(r.transparent=e.transparent),e.alphaTest!==void 0&&(r.alphaTest=e.alphaTest),e.alphaHash!==void 0&&(r.alphaHash=e.alphaHash),e.depthFunc!==void 0&&(r.depthFunc=e.depthFunc),e.depthTest!==void 0&&(r.depthTest=e.depthTest),e.depthWrite!==void 0&&(r.depthWrite=e.depthWrite),e.colorWrite!==void 0&&(r.colorWrite=e.colorWrite),e.blendSrc!==void 0&&(r.blendSrc=e.blendSrc),e.blendDst!==void 0&&(r.blendDst=e.blendDst),e.blendEquation!==void 0&&(r.blendEquation=e.blendEquation),e.blendSrcAlpha!==void 0&&(r.blendSrcAlpha=e.blendSrcAlpha),e.blendDstAlpha!==void 0&&(r.blendDstAlpha=e.blendDstAlpha),e.blendEquationAlpha!==void 0&&(r.blendEquationAlpha=e.blendEquationAlpha),e.blendColor!==void 0&&r.blendColor!==void 0&&r.blendColor.setHex(e.blendColor),e.blendAlpha!==void 0&&(r.blendAlpha=e.blendAlpha),e.stencilWriteMask!==void 0&&(r.stencilWriteMask=e.stencilWriteMask),e.stencilFunc!==void 0&&(r.stencilFunc=e.stencilFunc),e.stencilRef!==void 0&&(r.stencilRef=e.stencilRef),e.stencilFuncMask!==void 0&&(r.stencilFuncMask=e.stencilFuncMask),e.stencilFail!==void 0&&(r.stencilFail=e.stencilFail),e.stencilZFail!==void 0&&(r.stencilZFail=e.stencilZFail),e.stencilZPass!==void 0&&(r.stencilZPass=e.stencilZPass),e.stencilWrite!==void 0&&(r.stencilWrite=e.stencilWrite),e.wireframe!==void 0&&(r.wireframe=e.wireframe),e.wireframeLinewidth!==void 0&&(r.wireframeLinewidth=e.wireframeLinewidth),e.wireframeLinecap!==void 0&&(r.wireframeLinecap=e.wireframeLinecap),e.wireframeLinejoin!==void 0&&(r.wireframeLinejoin=e.wireframeLinejoin),e.rotation!==void 0&&(r.rotation=e.rotation),e.linewidth!==void 0&&(r.linewidth=e.linewidth),e.dashSize!==void 0&&(r.dashSize=e.dashSize),e.gapSize!==void 0&&(r.gapSize=e.gapSize),e.scale!==void 0&&(r.scale=e.scale),e.polygonOffset!==void 0&&(r.polygonOffset=e.polygonOffset),e.polygonOffsetFactor!==void 0&&(r.polygonOffsetFactor=e.polygonOffsetFactor),e.polygonOffsetUnits!==void 0&&(r.polygonOffsetUnits=e.polygonOffsetUnits),e.dithering!==void 0&&(r.dithering=e.dithering),e.alphaToCoverage!==void 0&&(r.alphaToCoverage=e.alphaToCoverage),e.premultipliedAlpha!==void 0&&(r.premultipliedAlpha=e.premultipliedAlpha),e.forceSinglePass!==void 0&&(r.forceSinglePass=e.forceSinglePass),e.visible!==void 0&&(r.visible=e.visible),e.toneMapped!==void 0&&(r.toneMapped=e.toneMapped),e.userData!==void 0&&(r.userData=e.userData),e.vertexColors!==void 0&&(typeof e.vertexColors=="number"?r.vertexColors=e.vertexColors>0:r.vertexColors=e.vertexColors),e.uniforms!==void 0)for(const s in e.uniforms){const o=e.uniforms[s];switch(r.uniforms[s]={},o.type){case"t":r.uniforms[s].value=i(o.value);break;case"c":r.uniforms[s].value=new Pe().setHex(o.value);break;case"v2":r.uniforms[s].value=new _e().fromArray(o.value);break;case"v3":r.uniforms[s].value=new D().fromArray(o.value);break;case"v4":r.uniforms[s].value=new vt().fromArray(o.value);break;case"m3":r.uniforms[s].value=new ut().fromArray(o.value);break;case"m4":r.uniforms[s].value=new ze().fromArray(o.value);break;default:r.uniforms[s].value=o.value}}if(e.defines!==void 0&&(r.defines=e.defines),e.vertexShader!==void 0&&(r.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(r.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(r.glslVersion=e.glslVersion),e.extensions!==void 0)for(const s in e.extensions)r.extensions[s]=e.extensions[s];if(e.lights!==void 0&&(r.lights=e.lights),e.clipping!==void 0&&(r.clipping=e.clipping),e.size!==void 0&&(r.size=e.size),e.sizeAttenuation!==void 0&&(r.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(r.map=i(e.map)),e.matcap!==void 0&&(r.matcap=i(e.matcap)),e.alphaMap!==void 0&&(r.alphaMap=i(e.alphaMap)),e.bumpMap!==void 0&&(r.bumpMap=i(e.bumpMap)),e.bumpScale!==void 0&&(r.bumpScale=e.bumpScale),e.normalMap!==void 0&&(r.normalMap=i(e.normalMap)),e.normalMapType!==void 0&&(r.normalMapType=e.normalMapType),e.normalScale!==void 0){let s=e.normalScale;Array.isArray(s)===!1&&(s=[s,s]),r.normalScale=new _e().fromArray(s)}return e.displacementMap!==void 0&&(r.displacementMap=i(e.displacementMap)),e.displacementScale!==void 0&&(r.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(r.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(r.roughnessMap=i(e.roughnessMap)),e.metalnessMap!==void 0&&(r.metalnessMap=i(e.metalnessMap)),e.emissiveMap!==void 0&&(r.emissiveMap=i(e.emissiveMap)),e.emissiveIntensity!==void 0&&(r.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(r.specularMap=i(e.specularMap)),e.specularIntensityMap!==void 0&&(r.specularIntensityMap=i(e.specularIntensityMap)),e.specularColorMap!==void 0&&(r.specularColorMap=i(e.specularColorMap)),e.envMap!==void 0&&(r.envMap=i(e.envMap)),e.envMapIntensity!==void 0&&(r.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(r.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(r.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(r.lightMap=i(e.lightMap)),e.lightMapIntensity!==void 0&&(r.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(r.aoMap=i(e.aoMap)),e.aoMapIntensity!==void 0&&(r.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(r.gradientMap=i(e.gradientMap)),e.clearcoatMap!==void 0&&(r.clearcoatMap=i(e.clearcoatMap)),e.clearcoatRoughnessMap!==void 0&&(r.clearcoatRoughnessMap=i(e.clearcoatRoughnessMap)),e.clearcoatNormalMap!==void 0&&(r.clearcoatNormalMap=i(e.clearcoatNormalMap)),e.clearcoatNormalScale!==void 0&&(r.clearcoatNormalScale=new _e().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(r.iridescenceMap=i(e.iridescenceMap)),e.iridescenceThicknessMap!==void 0&&(r.iridescenceThicknessMap=i(e.iridescenceThicknessMap)),e.transmissionMap!==void 0&&(r.transmissionMap=i(e.transmissionMap)),e.thicknessMap!==void 0&&(r.thicknessMap=i(e.thicknessMap)),e.anisotropyMap!==void 0&&(r.anisotropyMap=i(e.anisotropyMap)),e.sheenColorMap!==void 0&&(r.sheenColorMap=i(e.sheenColorMap)),e.sheenRoughnessMap!==void 0&&(r.sheenRoughnessMap=i(e.sheenRoughnessMap)),r}setTextures(e){return this.textures=e,this}static createMaterialFromType(e){const t={ShadowMaterial:u3,SpriteMaterial:gb,RawShaderMaterial:sh,ShaderMaterial:cr,PointsMaterial:Wm,MeshPhysicalMaterial:us,MeshStandardMaterial:ol,MeshPhongMaterial:oh,MeshToonMaterial:h3,MeshNormalMaterial:d3,MeshLambertMaterial:Tb,MeshDepthMaterial:fb,MeshDistanceMaterial:pb,MeshBasicMaterial:Jn,MeshMatcapMaterial:f3,LineDashedMaterial:p3,LineBasicMaterial:Bn,Material:En};return new t[e]}}class Gi{static decodeText(e){if(typeof TextDecoder<"u")return new TextDecoder().decode(e);let t="";for(let i=0,r=e.length;i<r;i++)t+=String.fromCharCode(e[i]);try{return decodeURIComponent(escape(t))}catch(i){return t}}static extractUrlBase(e){const t=e.lastIndexOf("/");return t===-1?"./":e.slice(0,t+1)}static resolveURL(e,t){return typeof e!="string"||e===""?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}}class M3 extends qe{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(e){return super.copy(e),this.instanceCount=e.instanceCount,this}toJSON(){const e=super.toJSON();return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}}class E3 extends Xn{constructor(e){super(e)}load(e,t,i,r){const s=this,o=new Ti(s.manager);o.setPath(s.path),o.setRequestHeader(s.requestHeader),o.setWithCredentials(s.withCredentials),o.load(e,function(a){try{t(s.parse(JSON.parse(a)))}catch(l){r?r(l):console.error(l),s.manager.itemError(e)}},i,r)}parse(e){const t={},i={};function r(f,p){if(t[p]!==void 0)return t[p];const m=f.interleavedBuffers[p],g=s(f,m.buffer),b=Zl(m.type,g),_=new Wc(b,m.stride);return _.uuid=m.uuid,t[p]=_,_}function s(f,p){if(i[p]!==void 0)return i[p];const m=f.arrayBuffers[p],g=new Uint32Array(m).buffer;return i[p]=g,g}const o=e.isInstancedBufferGeometry?new M3:new qe,a=e.data.index;if(a!==void 0){const f=Zl(a.type,a.array);o.setIndex(new At(f,1))}const l=e.data.attributes;for(const f in l){const p=l[f];let v;if(p.isInterleavedBufferAttribute){const m=r(e.data,p.data);v=new os(m,p.itemSize,p.offset,p.normalized)}else{const m=Zl(p.type,p.array),g=p.isInstancedBufferAttribute?Ic:At;v=new g(m,p.itemSize,p.normalized)}p.name!==void 0&&(v.name=p.name),p.usage!==void 0&&v.setUsage(p.usage),p.updateRange!==void 0&&(v.updateRange.offset=p.updateRange.offset,v.updateRange.count=p.updateRange.count),o.setAttribute(f,v)}const c=e.data.morphAttributes;if(c)for(const f in c){const p=c[f],v=[];for(let m=0,g=p.length;m<g;m++){const b=p[m];let _;if(b.isInterleavedBufferAttribute){const y=r(e.data,b.data);_=new os(y,b.itemSize,b.offset,b.normalized)}else{const y=Zl(b.type,b.array);_=new At(y,b.itemSize,b.normalized)}b.name!==void 0&&(_.name=b.name),v.push(_)}o.morphAttributes[f]=v}e.data.morphTargetsRelative&&(o.morphTargetsRelative=!0);const h=e.data.groups||e.data.drawcalls||e.data.offsets;if(h!==void 0)for(let f=0,p=h.length;f!==p;++f){const v=h[f];o.addGroup(v.start,v.count,v.materialIndex)}const d=e.data.boundingSphere;if(d!==void 0){const f=new D;d.center!==void 0&&f.fromArray(d.center),o.boundingSphere=new Ri(f,d.radius)}return e.name&&(o.name=e.name),e.userData&&(o.userData=e.userData),o}}class RY extends Xn{constructor(e){super(e)}load(e,t,i,r){const s=this,o=this.path===""?Gi.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||o;const a=new Ti(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(l){let c=null;try{c=JSON.parse(l)}catch(h){r!==void 0&&r(h),console.error("THREE:ObjectLoader: Can't parse "+e+".",h.message);return}const u=c.metadata;if(u===void 0||u.type===void 0||u.type.toLowerCase()==="geometry"){r!==void 0&&r(new Error("THREE.ObjectLoader: Can't load "+e)),console.error("THREE.ObjectLoader: Can't load "+e);return}s.parse(c,t)},i,r)}async loadAsync(e,t){const i=this,r=this.path===""?Gi.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||r;const s=new Ti(this.manager);s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials);const o=await s.loadAsync(e,t),a=JSON.parse(o),l=a.metadata;if(l===void 0||l.type===void 0||l.type.toLowerCase()==="geometry")throw new Error("THREE.ObjectLoader: Can't load "+e);return await i.parseAsync(a)}parse(e,t){const i=this.parseAnimations(e.animations),r=this.parseShapes(e.shapes),s=this.parseGeometries(e.geometries,r),o=this.parseImages(e.images,function(){t!==void 0&&t(c)}),a=this.parseTextures(e.textures,o),l=this.parseMaterials(e.materials,a),c=this.parseObject(e.object,s,l,a,i),u=this.parseSkeletons(e.skeletons,c);if(this.bindSkeletons(c,u),t!==void 0){let h=!1;for(const d in o)if(o[d].data instanceof HTMLImageElement){h=!0;break}h===!1&&t(c)}return c}async parseAsync(e){const t=this.parseAnimations(e.animations),i=this.parseShapes(e.shapes),r=this.parseGeometries(e.geometries,i),s=await this.parseImagesAsync(e.images),o=this.parseTextures(e.textures,s),a=this.parseMaterials(e.materials,o),l=this.parseObject(e.object,r,a,o,t),c=this.parseSkeletons(e.skeletons,l);return this.bindSkeletons(l,c),l}parseShapes(e){const t={};if(e!==void 0)for(let i=0,r=e.length;i<r;i++){const s=new Oa().fromJSON(e[i]);t[s.uuid]=s}return t}parseSkeletons(e,t){const i={},r={};if(t.traverse(function(s){s.isBone&&(r[s.uuid]=s)}),e!==void 0)for(let s=0,o=e.length;s<o;s++){const a=new $c().fromJSON(e[s],r);i[a.uuid]=a}return i}parseGeometries(e,t){const i={};if(e!==void 0){const r=new E3;for(let s=0,o=e.length;s<o;s++){let a;const l=e[s];switch(l.type){case"BufferGeometry":case"InstancedBufferGeometry":a=r.parse(l);break;default:l.type in FM?a=FM[l.type].fromJSON(l,t):console.warn('THREE.ObjectLoader: Unsupported geometry type "'.concat(l.type,'"'))}a.uuid=l.uuid,l.name!==void 0&&(a.name=l.name),l.userData!==void 0&&(a.userData=l.userData),i[l.uuid]=a}}return i}parseMaterials(e,t){const i={},r={};if(e!==void 0){const s=new cg;s.setTextures(t);for(let o=0,a=e.length;o<a;o++){const l=e[o];i[l.uuid]===void 0&&(i[l.uuid]=s.parse(l)),r[l.uuid]=i[l.uuid]}}return r}parseAnimations(e){const t={};if(e!==void 0)for(let i=0;i<e.length;i++){const r=e[i],s=$a.parse(r);t[s.uuid]=s}return t}parseImages(e,t){const i=this,r={};let s;function o(l){return i.manager.itemStart(l),s.load(l,function(){i.manager.itemEnd(l)},void 0,function(){i.manager.itemError(l),i.manager.itemEnd(l)})}function a(l){if(typeof l=="string"){const c=l,u=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(c)?c:i.resourcePath+c;return o(u)}else return l.data?{data:Zl(l.type,l.data),width:l.width,height:l.height}:null}if(e!==void 0&&e.length>0){const l=new sg(t);s=new $h(l),s.setCrossOrigin(this.crossOrigin);for(let c=0,u=e.length;c<u;c++){const h=e[c],d=h.url;if(Array.isArray(d)){const f=[];for(let p=0,v=d.length;p<v;p++){const m=d[p],g=a(m);g!==null&&(g instanceof HTMLImageElement?f.push(g):f.push(new fc(g.data,g.width,g.height)))}r[h.uuid]=new Ea(f)}else{const f=a(h.url);r[h.uuid]=new Ea(f)}}}return r}async parseImagesAsync(e){const t=this,i={};let r;async function s(o){if(typeof o=="string"){const a=o,l=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(a)?a:t.resourcePath+a;return await r.loadAsync(l)}else return o.data?{data:Zl(o.type,o.data),width:o.width,height:o.height}:null}if(e!==void 0&&e.length>0){r=new $h(this.manager),r.setCrossOrigin(this.crossOrigin);for(let o=0,a=e.length;o<a;o++){const l=e[o],c=l.url;if(Array.isArray(c)){const u=[];for(let h=0,d=c.length;h<d;h++){const f=c[h],p=await s(f);p!==null&&(p instanceof HTMLImageElement?u.push(p):u.push(new fc(p.data,p.width,p.height)))}i[l.uuid]=new Ea(u)}else{const u=await s(l.url);i[l.uuid]=new Ea(u)}}}return i}parseTextures(e,t){function i(s,o){return typeof s=="number"?s:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",s),o[s])}const r={};if(e!==void 0)for(let s=0,o=e.length;s<o;s++){const a=e[s];a.image===void 0&&console.warn('THREE.ObjectLoader: No "image" specified for',a.uuid),t[a.image]===void 0&&console.warn("THREE.ObjectLoader: Undefined image",a.image);const l=t[a.image],c=l.data;let u;Array.isArray(c)?(u=new pd,c.length===6&&(u.needsUpdate=!0)):(c&&c.data?u=new fc:u=new Jt,c&&(u.needsUpdate=!0)),u.source=l,u.uuid=a.uuid,a.name!==void 0&&(u.name=a.name),a.mapping!==void 0&&(u.mapping=i(a.mapping,LY)),a.channel!==void 0&&(u.channel=a.channel),a.offset!==void 0&&u.offset.fromArray(a.offset),a.repeat!==void 0&&u.repeat.fromArray(a.repeat),a.center!==void 0&&u.center.fromArray(a.center),a.rotation!==void 0&&(u.rotation=a.rotation),a.wrap!==void 0&&(u.wrapS=i(a.wrap[0],VM),u.wrapT=i(a.wrap[1],VM)),a.format!==void 0&&(u.format=a.format),a.internalFormat!==void 0&&(u.internalFormat=a.internalFormat),a.type!==void 0&&(u.type=a.type),a.colorSpace!==void 0&&(u.colorSpace=a.colorSpace),a.encoding!==void 0&&(u.encoding=a.encoding),a.minFilter!==void 0&&(u.minFilter=i(a.minFilter,HM)),a.magFilter!==void 0&&(u.magFilter=i(a.magFilter,HM)),a.anisotropy!==void 0&&(u.anisotropy=a.anisotropy),a.flipY!==void 0&&(u.flipY=a.flipY),a.generateMipmaps!==void 0&&(u.generateMipmaps=a.generateMipmaps),a.premultiplyAlpha!==void 0&&(u.premultiplyAlpha=a.premultiplyAlpha),a.unpackAlignment!==void 0&&(u.unpackAlignment=a.unpackAlignment),a.compareFunction!==void 0&&(u.compareFunction=a.compareFunction),a.userData!==void 0&&(u.userData=a.userData),r[a.uuid]=u}return r}parseObject(e,t,i,r,s){let o;function a(d){return t[d]===void 0&&console.warn("THREE.ObjectLoader: Undefined geometry",d),t[d]}function l(d){if(d!==void 0){if(Array.isArray(d)){const f=[];for(let p=0,v=d.length;p<v;p++){const m=d[p];i[m]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",m),f.push(i[m])}return f}return i[d]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",d),i[d]}}function c(d){return r[d]===void 0&&console.warn("THREE.ObjectLoader: Undefined texture",d),r[d]}let u,h;switch(e.type){case"Scene":o=new mb,e.background!==void 0&&(Number.isInteger(e.background)?o.background=new Pe(e.background):o.background=c(e.background)),e.environment!==void 0&&(o.environment=c(e.environment)),e.fog!==void 0&&(e.fog.type==="Fog"?o.fog=new Hm(e.fog.color,e.fog.near,e.fog.far):e.fog.type==="FogExp2"&&(o.fog=new Vm(e.fog.color,e.fog.density)),e.fog.name!==""&&(o.fog.name=e.fog.name)),e.backgroundBlurriness!==void 0&&(o.backgroundBlurriness=e.backgroundBlurriness),e.backgroundIntensity!==void 0&&(o.backgroundIntensity=e.backgroundIntensity);break;case"PerspectiveCamera":o=new Nt(e.fov,e.aspect,e.near,e.far),e.focus!==void 0&&(o.focus=e.focus),e.zoom!==void 0&&(o.zoom=e.zoom),e.filmGauge!==void 0&&(o.filmGauge=e.filmGauge),e.filmOffset!==void 0&&(o.filmOffset=e.filmOffset),e.view!==void 0&&(o.view=Object.assign({},e.view));break;case"OrthographicCamera":o=new zi(e.left,e.right,e.top,e.bottom,e.near,e.far),e.zoom!==void 0&&(o.zoom=e.zoom),e.view!==void 0&&(o.view=Object.assign({},e.view));break;case"AmbientLight":o=new Lb(e.color,e.intensity);break;case"DirectionalLight":o=new lg(e.color,e.intensity);break;case"PointLight":o=new jh(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":o=new x3(e.color,e.intensity,e.width,e.height);break;case"SpotLight":o=new ag(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay);break;case"HemisphereLight":o=new b3(e.color,e.groundColor,e.intensity);break;case"LightProbe":o=new S3().fromJSON(e);break;case"SkinnedMesh":u=a(e.geometry),h=l(e.material),o=new Gm(u,h),e.bindMode!==void 0&&(o.bindMode=e.bindMode),e.bindMatrix!==void 0&&o.bindMatrix.fromArray(e.bindMatrix),e.skeleton!==void 0&&(o.skeleton=e.skeleton);break;case"Mesh":u=a(e.geometry),h=l(e.material),o=new Be(u,h);break;case"InstancedMesh":u=a(e.geometry),h=l(e.material);const d=e.count,f=e.instanceMatrix,p=e.instanceColor;o=new vb(u,h,d),o.instanceMatrix=new Ic(new Float32Array(f.array),16),p!==void 0&&(o.instanceColor=new Ic(new Float32Array(p.array),p.itemSize));break;case"LOD":o=new QP;break;case"Line":o=new ct(a(e.geometry),l(e.material));break;case"LineLoop":o=new _b(a(e.geometry),l(e.material));break;case"LineSegments":o=new Fr(a(e.geometry),l(e.material));break;case"PointCloud":case"Points":o=new yb(a(e.geometry),l(e.material));break;case"Sprite":o=new JP(l(e.material));break;case"Group":o=new Mr;break;case"Bone":o=new Oc;break;default:o=new pt}if(o.uuid=e.uuid,e.name!==void 0&&(o.name=e.name),e.matrix!==void 0?(o.matrix.fromArray(e.matrix),e.matrixAutoUpdate!==void 0&&(o.matrixAutoUpdate=e.matrixAutoUpdate),o.matrixAutoUpdate&&o.matrix.decompose(o.position,o.quaternion,o.scale)):(e.position!==void 0&&o.position.fromArray(e.position),e.rotation!==void 0&&o.rotation.fromArray(e.rotation),e.quaternion!==void 0&&o.quaternion.fromArray(e.quaternion),e.scale!==void 0&&o.scale.fromArray(e.scale)),e.up!==void 0&&o.up.fromArray(e.up),e.castShadow!==void 0&&(o.castShadow=e.castShadow),e.receiveShadow!==void 0&&(o.receiveShadow=e.receiveShadow),e.shadow&&(e.shadow.bias!==void 0&&(o.shadow.bias=e.shadow.bias),e.shadow.normalBias!==void 0&&(o.shadow.normalBias=e.shadow.normalBias),e.shadow.radius!==void 0&&(o.shadow.radius=e.shadow.radius),e.shadow.mapSize!==void 0&&o.shadow.mapSize.fromArray(e.shadow.mapSize),e.shadow.camera!==void 0&&(o.shadow.camera=this.parseObject(e.shadow.camera))),e.visible!==void 0&&(o.visible=e.visible),e.frustumCulled!==void 0&&(o.frustumCulled=e.frustumCulled),e.renderOrder!==void 0&&(o.renderOrder=e.renderOrder),e.userData!==void 0&&(o.userData=e.userData),e.layers!==void 0&&(o.layers.mask=e.layers),e.children!==void 0){const d=e.children;for(let f=0;f<d.length;f++)o.add(this.parseObject(d[f],t,i,r,s))}if(e.animations!==void 0){const d=e.animations;for(let f=0;f<d.length;f++){const p=d[f];o.animations.push(s[p])}}if(e.type==="LOD"){e.autoUpdate!==void 0&&(o.autoUpdate=e.autoUpdate);const d=e.levels;for(let f=0;f<d.length;f++){const p=d[f],v=o.getObjectByProperty("uuid",p.object);v!==void 0&&o.addLevel(v,p.distance,p.hysteresis)}}return o}bindSkeletons(e,t){Object.keys(t).length!==0&&e.traverse(function(i){if(i.isSkinnedMesh===!0&&i.skeleton!==void 0){const r=t[i.skeleton];r===void 0?console.warn("THREE.ObjectLoader: No skeleton found with UUID:",i.skeleton):i.bind(r,i.bindMatrix)}})}}const LY={UVMapping:Rm,CubeReflectionMapping:Ns,CubeRefractionMapping:Fo,EquirectangularReflectionMapping:Tc,EquirectangularRefractionMapping:Oh,CubeUVReflectionMapping:Hc},VM={RepeatWrapping:is,ClampToEdgeWrapping:Rn,MirroredRepeatWrapping:Ac},HM={NearestFilter:hn,NearestMipmapNearestFilter:Ih,NearestMipmapLinearFilter:hc,LinearFilter:rn,LinearMipmapNearestFilter:Lm,LinearMipmapLinearFilter:rs};class T3 extends Xn{constructor(e){super(e),this.isImageBitmapLoader=!0,typeof createImageBitmap>"u"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(e){return this.options=e,this}load(e,t,i,r){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,o=ja.get(e);if(o!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0),o;const a={};a.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",a.headers=this.requestHeader,fetch(e,a).then(function(l){return l.blob()}).then(function(l){return createImageBitmap(l,Object.assign(s.options,{colorSpaceConversion:"none"}))}).then(function(l){ja.add(e,l),t&&t(l),s.manager.itemEnd(e)}).catch(function(l){r&&r(l),s.manager.itemError(e),s.manager.itemEnd(e)}),s.manager.itemStart(e)}}let Nf;class Ob{static getContext(){return Nf===void 0&&(Nf=new(window.AudioContext||window.webkitAudioContext)),Nf}static setContext(e){Nf=e}}class OY extends Xn{constructor(e){super(e)}load(e,t,i,r){const s=this,o=new Ti(this.manager);o.setResponseType("arraybuffer"),o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(l){try{const c=l.slice(0);Ob.getContext().decodeAudioData(c,function(h){t(h)},a)}catch(c){a(c)}},i,r);function a(l){r?r(l):console.error(l),s.manager.itemError(e)}}}const GM=new ze,WM=new ze,na=new ze;class IY{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new Nt,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new Nt,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(e){const t=this._cache;if(t.focus!==e.focus||t.fov!==e.fov||t.aspect!==e.aspect*this.aspect||t.near!==e.near||t.far!==e.far||t.zoom!==e.zoom||t.eyeSep!==this.eyeSep){t.focus=e.focus,t.fov=e.fov,t.aspect=e.aspect*this.aspect,t.near=e.near,t.far=e.far,t.zoom=e.zoom,t.eyeSep=this.eyeSep,na.copy(e.projectionMatrix);const r=t.eyeSep/2,s=r*t.near/t.focus,o=t.near*Math.tan(La*t.fov*.5)/t.zoom;let a,l;WM.elements[12]=-r,GM.elements[12]=r,a=-o*t.aspect+s,l=o*t.aspect+s,na.elements[0]=2*t.near/(l-a),na.elements[8]=(l+a)/(l-a),this.cameraL.projectionMatrix.copy(na),a=-o*t.aspect-s,l=o*t.aspect-s,na.elements[0]=2*t.near/(l-a),na.elements[8]=(l+a)/(l-a),this.cameraR.projectionMatrix.copy(na)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(WM),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(GM)}}class Ib{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=$M(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const t=$M();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}function $M(){return(typeof performance>"u"?Date:performance).now()}const ia=new D,jM=new gt,DY=new D,ra=new D;class UY extends pt{constructor(){super(),this.type="AudioListener",this.context=Ob.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new Ib}getInput(){return this.gain}removeFilter(){return this.filter!==null&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(e){return this.filter!==null?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}updateMatrixWorld(e){super.updateMatrixWorld(e);const t=this.context.listener,i=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(ia,jM,DY),ra.set(0,0,-1).applyQuaternion(jM),t.positionX){const r=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(ia.x,r),t.positionY.linearRampToValueAtTime(ia.y,r),t.positionZ.linearRampToValueAtTime(ia.z,r),t.forwardX.linearRampToValueAtTime(ra.x,r),t.forwardY.linearRampToValueAtTime(ra.y,r),t.forwardZ.linearRampToValueAtTime(ra.z,r),t.upX.linearRampToValueAtTime(i.x,r),t.upY.linearRampToValueAtTime(i.y,r),t.upZ.linearRampToValueAtTime(i.z,r)}else t.setPosition(ia.x,ia.y,ia.z),t.setOrientation(ra.x,ra.y,ra.z,i.x,i.y,i.z)}}class A3 extends pt{constructor(e){super(),this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this}setMediaElementSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this}setMediaStreamSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this}setBuffer(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this}play(e=0){if(this.isPlaying===!0){console.warn("THREE.Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}this._startedAt=this.context.currentTime+e;const t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=t,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.isPlaying===!0&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,this.loop===!0&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this}stop(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this._progress=0,this.source!==null&&(this.source.stop(),this.source.onended=null),this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].connect(this.filters[e]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this}disconnect(){if(this._connected!==!1){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].disconnect(this.filters[e]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._connected=!1,this}}getFilters(){return this.filters}setFilters(e){return e||(e=[]),this._connected===!0?(this.disconnect(),this.filters=e.slice(),this.connect()):this.filters=e.slice(),this}setDetune(e){if(this.detune=e,this.source.detune!==void 0)return this.isPlaying===!0&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this}getDetune(){return this.detune}getFilter(){return this.getFilters()[0]}setFilter(e){return this.setFilters(e?[e]:[])}setPlaybackRate(e){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.playbackRate=e,this.isPlaying===!0&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this}getPlaybackRate(){return this.playbackRate}onEnded(){this.isPlaying=!1}getLoop(){return this.hasPlaybackControl===!1?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop}setLoop(e){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.loop=e,this.isPlaying===!0&&(this.source.loop=this.loop),this}setLoopStart(e){return this.loopStart=e,this}setLoopEnd(e){return this.loopEnd=e,this}getVolume(){return this.gain.gain.value}setVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}}const sa=new D,XM=new gt,NY=new D,oa=new D;class FY extends A3{constructor(e){super(e),this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}connect(){super.connect(),this.panner.connect(this.gain)}disconnect(){super.disconnect(),this.panner.disconnect(this.gain)}getOutput(){return this.panner}getRefDistance(){return this.panner.refDistance}setRefDistance(e){return this.panner.refDistance=e,this}getRolloffFactor(){return this.panner.rolloffFactor}setRolloffFactor(e){return this.panner.rolloffFactor=e,this}getDistanceModel(){return this.panner.distanceModel}setDistanceModel(e){return this.panner.distanceModel=e,this}getMaxDistance(){return this.panner.maxDistance}setMaxDistance(e){return this.panner.maxDistance=e,this}setDirectionalCone(e,t,i){return this.panner.coneInnerAngle=e,this.panner.coneOuterAngle=t,this.panner.coneOuterGain=i,this}updateMatrixWorld(e){if(super.updateMatrixWorld(e),this.hasPlaybackControl===!0&&this.isPlaying===!1)return;this.matrixWorld.decompose(sa,XM,NY),oa.set(0,0,1).applyQuaternion(XM);const t=this.panner;if(t.positionX){const i=this.context.currentTime+this.listener.timeDelta;t.positionX.linearRampToValueAtTime(sa.x,i),t.positionY.linearRampToValueAtTime(sa.y,i),t.positionZ.linearRampToValueAtTime(sa.z,i),t.orientationX.linearRampToValueAtTime(oa.x,i),t.orientationY.linearRampToValueAtTime(oa.y,i),t.orientationZ.linearRampToValueAtTime(oa.z,i)}else t.setPosition(sa.x,sa.y,sa.z),t.setOrientation(oa.x,oa.y,oa.z)}}class kY{constructor(e,t=2048){this.analyser=e.context.createAnalyser(),this.analyser.fftSize=t,this.data=new Uint8Array(this.analyser.frequencyBinCount),e.getOutput().connect(this.analyser)}getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){let e=0;const t=this.getFrequencyData();for(let i=0;i<t.length;i++)e+=t[i];return e/t.length}}class C3{constructor(e,t,i){this.binding=e,this.valueSize=i;let r,s,o;switch(t){case"quaternion":r=this._slerp,s=this._slerpAdditive,o=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(i*6),this._workIndex=5;break;case"string":case"bool":r=this._select,s=this._select,o=this._setAdditiveIdentityOther,this.buffer=new Array(i*5);break;default:r=this._lerp,s=this._lerpAdditive,o=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(i*5)}this._mixBufferRegion=r,this._mixBufferRegionAdditive=s,this._setIdentity=o,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(e,t){const i=this.buffer,r=this.valueSize,s=e*r+r;let o=this.cumulativeWeight;if(o===0){for(let a=0;a!==r;++a)i[s+a]=i[a];o=t}else{o+=t;const a=t/o;this._mixBufferRegion(i,s,0,a,r)}this.cumulativeWeight=o}accumulateAdditive(e){const t=this.buffer,i=this.valueSize,r=i*this._addIndex;this.cumulativeWeightAdditive===0&&this._setIdentity(),this._mixBufferRegionAdditive(t,r,0,e,i),this.cumulativeWeightAdditive+=e}apply(e){const t=this.valueSize,i=this.buffer,r=e*t+t,s=this.cumulativeWeight,o=this.cumulativeWeightAdditive,a=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,s<1){const l=t*this._origIndex;this._mixBufferRegion(i,r,l,1-s,t)}o>0&&this._mixBufferRegionAdditive(i,r,this._addIndex*t,1,t);for(let l=t,c=t+t;l!==c;++l)if(i[l]!==i[l+t]){a.setValue(i,r);break}}saveOriginalState(){const e=this.binding,t=this.buffer,i=this.valueSize,r=i*this._origIndex;e.getValue(t,r);for(let s=i,o=r;s!==o;++s)t[s]=t[r+s%i];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let i=e;i<t;i++)this.buffer[i]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){const e=this._origIndex*this.valueSize,t=this._addIndex*this.valueSize;for(let i=0;i<this.valueSize;i++)this.buffer[t+i]=this.buffer[e+i]}_select(e,t,i,r,s){if(r>=.5)for(let o=0;o!==s;++o)e[t+o]=e[i+o]}_slerp(e,t,i,r){gt.slerpFlat(e,t,e,t,e,i,r)}_slerpAdditive(e,t,i,r,s){const o=this._workIndex*s;gt.multiplyQuaternionsFlat(e,o,e,t,e,i),gt.slerpFlat(e,t,e,t,e,o,r)}_lerp(e,t,i,r,s){const o=1-r;for(let a=0;a!==s;++a){const l=t+a;e[l]=e[l]*o+e[i+a]*r}}_lerpAdditive(e,t,i,r,s){for(let o=0;o!==s;++o){const a=t+o;e[a]=e[a]+e[i+o]*r}}}const Db="\\[\\]\\.:\\/",BY=new RegExp("["+Db+"]","g"),Ub="[^"+Db+"]",zY="[^"+Db.replace("\\.","")+"]",VY=/((?:WC+[\/:])*)/.source.replace("WC",Ub),HY=/(WCOD+)?/.source.replace("WCOD",zY),GY=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Ub),WY=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Ub),$Y=new RegExp("^"+VY+HY+GY+WY+"$"),jY=["material","materials","bones","map"];class XY{constructor(e,t,i){const r=i||yt.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,r)}getValue(e,t){this.bind();const i=this._targetGroup.nCachedObjects_,r=this._bindings[i];r!==void 0&&r.getValue(e,t)}setValue(e,t){const i=this._bindings;for(let r=this._targetGroup.nCachedObjects_,s=i.length;r!==s;++r)i[r].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].unbind()}}class yt{constructor(e,t,i){this.path=t,this.parsedPath=i||yt.parseTrackName(t),this.node=yt.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,i){return e&&e.isAnimationObjectGroup?new yt.Composite(e,t,i):new yt(e,t,i)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(BY,"")}static parseTrackName(e){const t=$Y.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const i={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},r=i.nodeName&&i.nodeName.lastIndexOf(".");if(r!==void 0&&r!==-1){const s=i.nodeName.substring(r+1);jY.indexOf(s)!==-1&&(i.nodeName=i.nodeName.substring(0,r),i.objectName=s)}if(i.propertyName===null||i.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return i}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){const i=e.skeleton.getBoneByName(t);if(i!==void 0)return i}if(e.children){const i=function(s){for(let o=0;o<s.length;o++){const a=s[o];if(a.name===t||a.uuid===t)return a;const l=i(a.children);if(l)return l}return null},r=i(e.children);if(r)return r}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){const i=this.resolvedProperty;for(let r=0,s=i.length;r!==s;++r)e[t++]=i[r]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){const i=this.resolvedProperty;for(let r=0,s=i.length;r!==s;++r)i[r]=e[t++]}_setValue_array_setNeedsUpdate(e,t){const i=this.resolvedProperty;for(let r=0,s=i.length;r!==s;++r)i[r]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){const i=this.resolvedProperty;for(let r=0,s=i.length;r!==s;++r)i[r]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node;const t=this.parsedPath,i=t.objectName,r=t.propertyName;let s=t.propertyIndex;if(e||(e=yt.findNode(this.rootNode,t.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){console.warn("THREE.PropertyBinding: No target node found for track: "+this.path+".");return}if(i){let c=t.objectIndex;switch(i){case"materials":if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}e=e.material.materials;break;case"bones":if(!e.skeleton){console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(let u=0;u<e.length;u++)if(e[u].name===c){c=u;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.map){console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}e=e.material.map;break;default:if(e[i]===void 0){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[i]}if(c!==void 0){if(e[c]===void 0){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[c]}}const o=e[r];if(o===void 0){const c=t.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+c+"."+r+" but it wasn't found.",e);return}let a=this.Versioning.None;this.targetObject=e,e.needsUpdate!==void 0?a=this.Versioning.NeedsUpdate:e.matrixWorldNeedsUpdate!==void 0&&(a=this.Versioning.MatrixWorldNeedsUpdate);let l=this.BindingType.Direct;if(s!==void 0){if(r==="morphTargetInfluences"){if(!e.geometry){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!e.geometry.morphAttributes){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}e.morphTargetDictionary[s]!==void 0&&(s=e.morphTargetDictionary[s])}l=this.BindingType.ArrayElement,this.resolvedProperty=o,this.propertyIndex=s}else o.fromArray!==void 0&&o.toArray!==void 0?(l=this.BindingType.HasFromToArray,this.resolvedProperty=o):Array.isArray(o)?(l=this.BindingType.EntireArray,this.resolvedProperty=o):this.propertyName=r;this.getValue=this.GetterByBindingType[l],this.setValue=this.SetterByBindingTypeAndVersioning[l][a]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}yt.Composite=XY;yt.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};yt.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};yt.prototype.GetterByBindingType=[yt.prototype._getValue_direct,yt.prototype._getValue_array,yt.prototype._getValue_arrayElement,yt.prototype._getValue_toArray];yt.prototype.SetterByBindingTypeAndVersioning=[[yt.prototype._setValue_direct,yt.prototype._setValue_direct_setNeedsUpdate,yt.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[yt.prototype._setValue_array,yt.prototype._setValue_array_setNeedsUpdate,yt.prototype._setValue_array_setMatrixWorldNeedsUpdate],[yt.prototype._setValue_arrayElement,yt.prototype._setValue_arrayElement_setNeedsUpdate,yt.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[yt.prototype._setValue_fromArray,yt.prototype._setValue_fromArray_setNeedsUpdate,yt.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class YY{constructor(){this.isAnimationObjectGroup=!0,this.uuid=Hi(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;const e={};this._indicesByUUID=e;for(let i=0,r=arguments.length;i!==r;++i)e[arguments[i].uuid]=i;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};const t=this;this.stats={objects:{get total(){return t._objects.length},get inUse(){return this.total-t.nCachedObjects_}},get bindingsPerObject(){return t._bindings.length}}}add(){const e=this._objects,t=this._indicesByUUID,i=this._paths,r=this._parsedPaths,s=this._bindings,o=s.length;let a,l=e.length,c=this.nCachedObjects_;for(let u=0,h=arguments.length;u!==h;++u){const d=arguments[u],f=d.uuid;let p=t[f];if(p===void 0){p=l++,t[f]=p,e.push(d);for(let v=0,m=o;v!==m;++v)s[v].push(new yt(d,i[v],r[v]))}else if(p<c){a=e[p];const v=--c,m=e[v];t[m.uuid]=p,e[p]=m,t[f]=v,e[v]=d;for(let g=0,b=o;g!==b;++g){const _=s[g],y=_[v];let T=_[p];_[p]=y,T===void 0&&(T=new yt(d,i[g],r[g])),_[v]=T}}else e[p]!==a&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=c}remove(){const e=this._objects,t=this._indicesByUUID,i=this._bindings,r=i.length;let s=this.nCachedObjects_;for(let o=0,a=arguments.length;o!==a;++o){const l=arguments[o],c=l.uuid,u=t[c];if(u!==void 0&&u>=s){const h=s++,d=e[h];t[d.uuid]=u,e[u]=d,t[c]=h,e[h]=l;for(let f=0,p=r;f!==p;++f){const v=i[f],m=v[h],g=v[u];v[u]=m,v[h]=g}}}this.nCachedObjects_=s}uncache(){const e=this._objects,t=this._indicesByUUID,i=this._bindings,r=i.length;let s=this.nCachedObjects_,o=e.length;for(let a=0,l=arguments.length;a!==l;++a){const c=arguments[a],u=c.uuid,h=t[u];if(h!==void 0)if(delete t[u],h<s){const d=--s,f=e[d],p=--o,v=e[p];t[f.uuid]=h,e[h]=f,t[v.uuid]=d,e[d]=v,e.pop();for(let m=0,g=r;m!==g;++m){const b=i[m],_=b[d],y=b[p];b[h]=_,b[d]=y,b.pop()}}else{const d=--o,f=e[d];d>0&&(t[f.uuid]=h),e[h]=f,e.pop();for(let p=0,v=r;p!==v;++p){const m=i[p];m[h]=m[d],m.pop()}}}this.nCachedObjects_=s}subscribe_(e,t){const i=this._bindingsIndicesByPath;let r=i[e];const s=this._bindings;if(r!==void 0)return s[r];const o=this._paths,a=this._parsedPaths,l=this._objects,c=l.length,u=this.nCachedObjects_,h=new Array(c);r=s.length,i[e]=r,o.push(e),a.push(t),s.push(h);for(let d=u,f=l.length;d!==f;++d){const p=l[d];h[d]=new yt(p,e,t)}return h}unsubscribe_(e){const t=this._bindingsIndicesByPath,i=t[e];if(i!==void 0){const r=this._paths,s=this._parsedPaths,o=this._bindings,a=o.length-1,l=o[a],c=e[a];t[c]=i,o[i]=l,o.pop(),s[i]=s[a],s.pop(),r[i]=r[a],r.pop()}}}class P3{constructor(e,t,i=null,r=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=i,this.blendMode=r;const s=t.tracks,o=s.length,a=new Array(o),l={endingStart:Sa,endingEnd:Sa};for(let c=0;c!==o;++c){const u=s[c].createInterpolant(null);a[c]=u,u.settings=l}this._interpolantSettings=l,this._interpolants=a,this._propertyBindings=new Array(o),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=bP,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,t){return this.loop=e,this.repetitions=t,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t,i){if(e.fadeOut(t),this.fadeIn(t),i){const r=this._clip.duration,s=e._clip.duration,o=s/r,a=r/s;e.warp(1,o,t),this.warp(a,1,t)}return this}crossFadeTo(e,t,i){return e.crossFadeFrom(this,t,i)}stopFading(){const e=this._weightInterpolant;return e!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,i){const r=this._mixer,s=r.time,o=this.timeScale;let a=this._timeScaleInterpolant;a===null&&(a=r._lendControlInterpolant(),this._timeScaleInterpolant=a);const l=a.parameterPositions,c=a.sampleValues;return l[0]=s,l[1]=s+i,c[0]=e/o,c[1]=t/o,this}stopWarping(){const e=this._timeScaleInterpolant;return e!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,i,r){if(!this.enabled){this._updateWeight(e);return}const s=this._startTime;if(s!==null){const l=(e-s)*i;l<0||i===0?t=0:(this._startTime=null,t=i*l)}t*=this._updateTimeScale(e);const o=this._updateTime(t),a=this._updateWeight(e);if(a>0){const l=this._interpolants,c=this._propertyBindings;switch(this.blendMode){case sb:for(let u=0,h=l.length;u!==h;++u)l[u].evaluate(o),c[u].accumulateAdditive(a);break;case Im:default:for(let u=0,h=l.length;u!==h;++u)l[u].evaluate(o),c[u].accumulate(r,a)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const i=this._weightInterpolant;if(i!==null){const r=i.evaluate(e)[0];t*=r,e>i.parameterPositions[1]&&(this.stopFading(),r===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const i=this._timeScaleInterpolant;if(i!==null){const r=i.evaluate(e)[0];t*=r,e>i.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,i=this.loop;let r=this.time+e,s=this._loopCount;const o=i===xP;if(e===0)return s===-1?r:o&&(s&1)===1?t-r:r;if(i===yP){s===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(r>=t)r=t;else if(r<0)r=0;else{this.time=r;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(s===-1&&(e>=0?(s=0,this._setEndings(!0,this.repetitions===0,o)):this._setEndings(this.repetitions===0,!0,o)),r>=t||r<0){const a=Math.floor(r/t);r-=t*a,s+=Math.abs(a);const l=this.repetitions-s;if(l<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,r=e>0?t:0,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(l===1){const c=e<0;this._setEndings(c,!c,o)}else this._setEndings(!1,!1,o);this._loopCount=s,this.time=r,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:a})}}else this.time=r;if(o&&(s&1)===1)return t-r}return r}_setEndings(e,t,i){const r=this._interpolantSettings;i?(r.endingStart=Ma,r.endingEnd=Ma):(e?r.endingStart=this.zeroSlopeAtStart?Ma:Sa:r.endingStart=Dh,t?r.endingEnd=this.zeroSlopeAtEnd?Ma:Sa:r.endingEnd=Dh)}_scheduleFading(e,t,i){const r=this._mixer,s=r.time;let o=this._weightInterpolant;o===null&&(o=r._lendControlInterpolant(),this._weightInterpolant=o);const a=o.parameterPositions,l=o.sampleValues;return a[0]=s,l[0]=t,a[1]=s+e,l[1]=i,this}}const qY=new Float32Array(1);class KY extends Nr{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){const i=e._localRoot||this._root,r=e._clip.tracks,s=r.length,o=e._propertyBindings,a=e._interpolants,l=i.uuid,c=this._bindingsByRootAndName;let u=c[l];u===void 0&&(u={},c[l]=u);for(let h=0;h!==s;++h){const d=r[h],f=d.name;let p=u[f];if(p!==void 0)++p.referenceCount,o[h]=p;else{if(p=o[h],p!==void 0){p._cacheIndex===null&&(++p.referenceCount,this._addInactiveBinding(p,l,f));continue}const v=t&&t._propertyBindings[h].binding.parsedPath;p=new C3(yt.create(i,f,v),d.ValueTypeName,d.getValueSize()),++p.referenceCount,this._addInactiveBinding(p,l,f),o[h]=p}a[h].resultBuffer=p.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const i=(e._localRoot||this._root).uuid,r=e._clip.uuid,s=this._actionsByClip[r];this._bindAction(e,s&&s.knownActions[0]),this._addInactiveAction(e,r,i)}const t=e._propertyBindings;for(let i=0,r=t.length;i!==r;++i){const s=t[i];s.useCount++===0&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let i=0,r=t.length;i!==r;++i){const s=t[i];--s.useCount===0&&(s.restoreOriginalState(),this._takeBackBinding(s))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){const t=e._cacheIndex;return t!==null&&t<this._nActiveActions}_addInactiveAction(e,t,i){const r=this._actions,s=this._actionsByClip;let o=s[t];if(o===void 0)o={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,s[t]=o;else{const a=o.knownActions;e._byClipCacheIndex=a.length,a.push(e)}e._cacheIndex=r.length,r.push(e),o.actionByRoot[i]=e}_removeInactiveAction(e){const t=this._actions,i=t[t.length-1],r=e._cacheIndex;i._cacheIndex=r,t[r]=i,t.pop(),e._cacheIndex=null;const s=e._clip.uuid,o=this._actionsByClip,a=o[s],l=a.knownActions,c=l[l.length-1],u=e._byClipCacheIndex;c._byClipCacheIndex=u,l[u]=c,l.pop(),e._byClipCacheIndex=null;const h=a.actionByRoot,d=(e._localRoot||this._root).uuid;delete h[d],l.length===0&&delete o[s],this._removeInactiveBindingsForAction(e)}_removeInactiveBindingsForAction(e){const t=e._propertyBindings;for(let i=0,r=t.length;i!==r;++i){const s=t[i];--s.referenceCount===0&&this._removeInactiveBinding(s)}}_lendAction(e){const t=this._actions,i=e._cacheIndex,r=this._nActiveActions++,s=t[r];e._cacheIndex=r,t[r]=e,s._cacheIndex=i,t[i]=s}_takeBackAction(e){const t=this._actions,i=e._cacheIndex,r=--this._nActiveActions,s=t[r];e._cacheIndex=r,t[r]=e,s._cacheIndex=i,t[i]=s}_addInactiveBinding(e,t,i){const r=this._bindingsByRootAndName,s=this._bindings;let o=r[t];o===void 0&&(o={},r[t]=o),o[i]=e,e._cacheIndex=s.length,s.push(e)}_removeInactiveBinding(e){const t=this._bindings,i=e.binding,r=i.rootNode.uuid,s=i.path,o=this._bindingsByRootAndName,a=o[r],l=t[t.length-1],c=e._cacheIndex;l._cacheIndex=c,t[c]=l,t.pop(),delete a[s],Object.keys(a).length===0&&delete o[r]}_lendBinding(e){const t=this._bindings,i=e._cacheIndex,r=this._nActiveBindings++,s=t[r];e._cacheIndex=r,t[r]=e,s._cacheIndex=i,t[i]=s}_takeBackBinding(e){const t=this._bindings,i=e._cacheIndex,r=--this._nActiveBindings,s=t[r];e._cacheIndex=r,t[r]=e,s._cacheIndex=i,t[i]=s}_lendControlInterpolant(){const e=this._controlInterpolants,t=this._nActiveControlInterpolants++;let i=e[t];return i===void 0&&(i=new Cb(new Float32Array(2),new Float32Array(2),1,qY),i.__cacheIndex=t,e[t]=i),i}_takeBackControlInterpolant(e){const t=this._controlInterpolants,i=e.__cacheIndex,r=--this._nActiveControlInterpolants,s=t[r];e.__cacheIndex=r,t[r]=e,s.__cacheIndex=i,t[i]=s}clipAction(e,t,i){const r=t||this._root,s=r.uuid;let o=typeof e=="string"?$a.findByName(r,e):e;const a=o!==null?o.uuid:e,l=this._actionsByClip[a];let c=null;if(i===void 0&&(o!==null?i=o.blendMode:i=Im),l!==void 0){const h=l.actionByRoot[s];if(h!==void 0&&h.blendMode===i)return h;c=l.knownActions[0],o===null&&(o=c._clip)}if(o===null)return null;const u=new P3(this,o,t,i);return this._bindAction(u,c),this._addInactiveAction(u,a,s),u}existingAction(e,t){const i=t||this._root,r=i.uuid,s=typeof e=="string"?$a.findByName(i,e):e,o=s?s.uuid:e,a=this._actionsByClip[o];return a!==void 0&&a.actionByRoot[r]||null}stopAllAction(){const e=this._actions,t=this._nActiveActions;for(let i=t-1;i>=0;--i)e[i].stop();return this}update(e){e*=this.timeScale;const t=this._actions,i=this._nActiveActions,r=this.time+=e,s=Math.sign(e),o=this._accuIndex^=1;for(let c=0;c!==i;++c)t[c]._update(r,e,s,o);const a=this._bindings,l=this._nActiveBindings;for(let c=0;c!==l;++c)a[c].apply(o);return this}setTime(e){this.time=0;for(let t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(e)}getRoot(){return this._root}uncacheClip(e){const t=this._actions,i=e.uuid,r=this._actionsByClip,s=r[i];if(s!==void 0){const o=s.knownActions;for(let a=0,l=o.length;a!==l;++a){const c=o[a];this._deactivateAction(c);const u=c._cacheIndex,h=t[t.length-1];c._cacheIndex=null,c._byClipCacheIndex=null,h._cacheIndex=u,t[u]=h,t.pop(),this._removeInactiveBindingsForAction(c)}delete r[i]}}uncacheRoot(e){const t=e.uuid,i=this._actionsByClip;for(const o in i){const a=i[o].actionByRoot,l=a[t];l!==void 0&&(this._deactivateAction(l),this._removeInactiveAction(l))}const r=this._bindingsByRootAndName,s=r[t];if(s!==void 0)for(const o in s){const a=s[o];a.restoreOriginalState(),this._removeInactiveBinding(a)}}uncacheAction(e,t){const i=this.existingAction(e,t);i!==null&&(this._deactivateAction(i),this._removeInactiveAction(i))}}class Nb{constructor(e){this.value=e}clone(){return new Nb(this.value.clone===void 0?this.value:this.value.clone())}}let ZY=0;class JY extends Nr{constructor(){super(),this.isUniformsGroup=!0,Object.defineProperty(this,"id",{value:ZY++}),this.name="",this.usage=kh,this.uniforms=[]}add(e){return this.uniforms.push(e),this}remove(e){const t=this.uniforms.indexOf(e);return t!==-1&&this.uniforms.splice(t,1),this}setName(e){return this.name=e,this}setUsage(e){return this.usage=e,this}dispose(){return this.dispatchEvent({type:"dispose"}),this}copy(e){this.name=e.name,this.usage=e.usage;const t=e.uniforms;this.uniforms.length=0;for(let i=0,r=t.length;i<r;i++)this.uniforms.push(t[i].clone());return this}clone(){return new this.constructor().copy(this)}}class QY extends Wc{constructor(e,t,i=1){super(e,t),this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=i}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}clone(e){const t=super.clone(e);return t.meshPerAttribute=this.meshPerAttribute,t}toJSON(e){const t=super.toJSON(e);return t.isInstancedInterleavedBuffer=!0,t.meshPerAttribute=this.meshPerAttribute,t}}class eq{constructor(e,t,i,r,s){this.isGLBufferAttribute=!0,this.name="",this.buffer=e,this.type=t,this.itemSize=i,this.elementSize=r,this.count=s,this.version=0}set needsUpdate(e){e===!0&&this.version++}setBuffer(e){return this.buffer=e,this}setType(e,t){return this.type=e,this.elementSize=t,this}setItemSize(e){return this.itemSize=e,this}setCount(e){return this.count=e,this}}class ug{constructor(e,t,i=0,r=1/0){this.ray=new sl(e,t),this.near=i,this.far=r,this.camera=null,this.layers=new Nm,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):console.error("THREE.Raycaster: Unsupported camera type: "+t.type)}intersectObject(e,t=!0,i=[]){return x_(e,this,i,t),i.sort(YM),i}intersectObjects(e,t=!0,i=[]){for(let r=0,s=e.length;r<s;r++)x_(e[r],this,i,t);return i.sort(YM),i}}function YM(n,e){return n.distance-e.distance}function x_(n,e,t,i){if(n.layers.test(e.layers)&&n.raycast(e,t),i===!0){const r=n.children;for(let s=0,o=r.length;s<o;s++)x_(r[s],e,t,!0)}}class Xh{constructor(e=1,t=0,i=0){return this.radius=e,this.phi=t,this.theta=i,this}set(e,t,i){return this.radius=e,this.phi=t,this.theta=i,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi)),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,i){return this.radius=Math.sqrt(e*e+t*t+i*i),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,i),this.phi=Math.acos(dn(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}class tq{constructor(e=1,t=0,i=0){return this.radius=e,this.theta=t,this.y=i,this}set(e,t,i){return this.radius=e,this.theta=t,this.y=i,this}copy(e){return this.radius=e.radius,this.theta=e.theta,this.y=e.y,this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,i){return this.radius=Math.sqrt(e*e+i*i),this.theta=Math.atan2(e,i),this.y=t,this}clone(){return new this.constructor().copy(this)}}const qM=new _e;class R3{constructor(e=new _e(1/0,1/0),t=new _e(-1/0,-1/0)){this.isBox2=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromPoints(e){this.makeEmpty();for(let t=0,i=e.length;t<i;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const i=qM.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),this}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(e){return this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}containsPoint(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y)}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,qM).distanceTo(e)}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const KM=new D,Ff=new D;class L3{constructor(e=new D,t=new D){this.start=e,this.end=t}set(e,t){return this.start.copy(e),this.end.copy(t),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,t){KM.subVectors(e,this.start),Ff.subVectors(this.end,this.start);const i=Ff.dot(Ff);let s=Ff.dot(KM)/i;return t&&(s=dn(s,0,1)),s}closestPointToPoint(e,t,i){const r=this.closestPointToPointParameter(e,t);return this.delta(i).multiplyScalar(r).add(this.start)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}const ZM=new D;class O3 extends pt{constructor(e,t){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=t,this.type="SpotLightHelper";const i=new qe,r=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let o=0,a=1,l=32;o<l;o++,a++){const c=o/l*Math.PI*2,u=a/l*Math.PI*2;r.push(Math.cos(c),Math.sin(c),1,Math.cos(u),Math.sin(u),1)}i.setAttribute("position",new Ve(r,3));const s=new Bn({fog:!1,toneMapped:!1});this.cone=new Fr(i,s),this.add(this.cone),this.update()}dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1);const e=this.light.distance?this.light.distance:1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),ZM.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(ZM),this.color!==void 0?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}const to=new D,kf=new ze,wv=new ze;class nq extends Fr{constructor(e){const t=I3(e),i=new qe,r=[],s=[],o=new Pe(0,0,1),a=new Pe(0,1,0);for(let c=0;c<t.length;c++){const u=t[c];u.parent&&u.parent.isBone&&(r.push(0,0,0),r.push(0,0,0),s.push(o.r,o.g,o.b),s.push(a.r,a.g,a.b))}i.setAttribute("position",new Ve(r,3)),i.setAttribute("color",new Ve(s,3));const l=new Bn({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});super(i,l),this.isSkeletonHelper=!0,this.type="SkeletonHelper",this.root=e,this.bones=t,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1}updateMatrixWorld(e){const t=this.bones,i=this.geometry,r=i.getAttribute("position");wv.copy(this.root.matrixWorld).invert();for(let s=0,o=0;s<t.length;s++){const a=t[s];a.parent&&a.parent.isBone&&(kf.multiplyMatrices(wv,a.matrixWorld),to.setFromMatrixPosition(kf),r.setXYZ(o,to.x,to.y,to.z),kf.multiplyMatrices(wv,a.parent.matrixWorld),to.setFromMatrixPosition(kf),r.setXYZ(o+1,to.x,to.y,to.z),o+=2)}i.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(e)}dispose(){this.geometry.dispose(),this.material.dispose()}}function I3(n){const e=[];n.isBone===!0&&e.push(n);for(let t=0;t<n.children.length;t++)e.push.apply(e,I3(n.children[t]));return e}class D3 extends Be{constructor(e,t,i){const r=new jc(t,4,2),s=new Jn({wireframe:!0,fog:!1,toneMapped:!1});super(r,s),this.light=e,this.color=i,this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}dispose(){this.geometry.dispose(),this.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.color!==void 0?this.material.color.set(this.color):this.material.color.copy(this.light.color)}}const iq=new D,JM=new Pe,QM=new Pe;class U3 extends pt{constructor(e,t,i){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=i,this.type="HemisphereLightHelper";const r=new Qi(t);r.rotateY(Math.PI*.5),this.material=new Jn({wireframe:!0,fog:!1,toneMapped:!1}),this.color===void 0&&(this.material.vertexColors=!0);const s=r.getAttribute("position"),o=new Float32Array(s.count*3);r.setAttribute("color",new At(o,3)),this.add(new Be(r,this.material)),this.update()}dispose(){this.children[0].geometry.dispose(),this.children[0].material.dispose()}update(){const e=this.children[0];if(this.color!==void 0)this.material.color.set(this.color);else{const t=e.geometry.getAttribute("color");JM.copy(this.light.color),QM.copy(this.light.groundColor);for(let i=0,r=t.count;i<r;i++){const s=i<r/2?JM:QM;t.setXYZ(i,s.r,s.g,s.b)}t.needsUpdate=!0}this.light.updateWorldMatrix(!0,!1),e.lookAt(iq.setFromMatrixPosition(this.light.matrixWorld).negate())}}class rq extends Fr{constructor(e=10,t=10,i=4473924,r=8947848){i=new Pe(i),r=new Pe(r);const s=t/2,o=e/t,a=e/2,l=[],c=[];for(let d=0,f=0,p=-a;d<=t;d++,p+=o){l.push(-a,0,p,a,0,p),l.push(p,0,-a,p,0,a);const v=d===s?i:r;v.toArray(c,f),f+=3,v.toArray(c,f),f+=3,v.toArray(c,f),f+=3,v.toArray(c,f),f+=3}const u=new qe;u.setAttribute("position",new Ve(l,3)),u.setAttribute("color",new Ve(c,3));const h=new Bn({vertexColors:!0,toneMapped:!1});super(u,h),this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}class sq extends Fr{constructor(e=10,t=16,i=8,r=64,s=4473924,o=8947848){s=new Pe(s),o=new Pe(o);const a=[],l=[];if(t>1)for(let h=0;h<t;h++){const d=h/t*(Math.PI*2),f=Math.sin(d)*e,p=Math.cos(d)*e;a.push(0,0,0),a.push(f,0,p);const v=h&1?s:o;l.push(v.r,v.g,v.b),l.push(v.r,v.g,v.b)}for(let h=0;h<i;h++){const d=h&1?s:o,f=e-e/i*h;for(let p=0;p<r;p++){let v=p/r*(Math.PI*2),m=Math.sin(v)*f,g=Math.cos(v)*f;a.push(m,0,g),l.push(d.r,d.g,d.b),v=(p+1)/r*(Math.PI*2),m=Math.sin(v)*f,g=Math.cos(v)*f,a.push(m,0,g),l.push(d.r,d.g,d.b)}}const c=new qe;c.setAttribute("position",new Ve(a,3)),c.setAttribute("color",new Ve(l,3));const u=new Bn({vertexColors:!0,toneMapped:!1});super(c,u),this.type="PolarGridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}const eE=new D,Bf=new D,tE=new D;class N3 extends pt{constructor(e,t,i){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=i,this.type="DirectionalLightHelper",t===void 0&&(t=1);let r=new qe;r.setAttribute("position",new Ve([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));const s=new Bn({fog:!1,toneMapped:!1});this.lightPlane=new ct(r,s),this.add(this.lightPlane),r=new qe,r.setAttribute("position",new Ve([0,0,0,0,0,1],3)),this.targetLine=new ct(r,s),this.add(this.targetLine),this.update()}dispose(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),eE.setFromMatrixPosition(this.light.matrixWorld),Bf.setFromMatrixPosition(this.light.target.matrixWorld),tE.subVectors(Bf,eE),this.lightPlane.lookAt(Bf),this.color!==void 0?(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)):(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)),this.targetLine.lookAt(Bf),this.targetLine.scale.z=tE.length()}}const zf=new D,ln=new fd;class oq extends Fr{constructor(e){const t=new qe,i=new Bn({color:16777215,vertexColors:!0,toneMapped:!1}),r=[],s=[],o={};a("n1","n2"),a("n2","n4"),a("n4","n3"),a("n3","n1"),a("f1","f2"),a("f2","f4"),a("f4","f3"),a("f3","f1"),a("n1","f1"),a("n2","f2"),a("n3","f3"),a("n4","f4"),a("p","n1"),a("p","n2"),a("p","n3"),a("p","n4"),a("u1","u2"),a("u2","u3"),a("u3","u1"),a("c","t"),a("p","c"),a("cn1","cn2"),a("cn3","cn4"),a("cf1","cf2"),a("cf3","cf4");function a(p,v){l(p),l(v)}function l(p){r.push(0,0,0),s.push(0,0,0),o[p]===void 0&&(o[p]=[]),o[p].push(r.length/3-1)}t.setAttribute("position",new Ve(r,3)),t.setAttribute("color",new Ve(s,3)),super(t,i),this.type="CameraHelper",this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=o,this.update();const c=new Pe(16755200),u=new Pe(16711680),h=new Pe(43775),d=new Pe(16777215),f=new Pe(3355443);this.setColors(c,u,h,d,f)}setColors(e,t,i,r,s){const a=this.geometry.getAttribute("color");a.setXYZ(0,e.r,e.g,e.b),a.setXYZ(1,e.r,e.g,e.b),a.setXYZ(2,e.r,e.g,e.b),a.setXYZ(3,e.r,e.g,e.b),a.setXYZ(4,e.r,e.g,e.b),a.setXYZ(5,e.r,e.g,e.b),a.setXYZ(6,e.r,e.g,e.b),a.setXYZ(7,e.r,e.g,e.b),a.setXYZ(8,e.r,e.g,e.b),a.setXYZ(9,e.r,e.g,e.b),a.setXYZ(10,e.r,e.g,e.b),a.setXYZ(11,e.r,e.g,e.b),a.setXYZ(12,e.r,e.g,e.b),a.setXYZ(13,e.r,e.g,e.b),a.setXYZ(14,e.r,e.g,e.b),a.setXYZ(15,e.r,e.g,e.b),a.setXYZ(16,e.r,e.g,e.b),a.setXYZ(17,e.r,e.g,e.b),a.setXYZ(18,e.r,e.g,e.b),a.setXYZ(19,e.r,e.g,e.b),a.setXYZ(20,e.r,e.g,e.b),a.setXYZ(21,e.r,e.g,e.b),a.setXYZ(22,e.r,e.g,e.b),a.setXYZ(23,e.r,e.g,e.b),a.setXYZ(24,t.r,t.g,t.b),a.setXYZ(25,t.r,t.g,t.b),a.setXYZ(26,t.r,t.g,t.b),a.setXYZ(27,t.r,t.g,t.b),a.setXYZ(28,t.r,t.g,t.b),a.setXYZ(29,t.r,t.g,t.b),a.setXYZ(30,t.r,t.g,t.b),a.setXYZ(31,t.r,t.g,t.b),a.setXYZ(32,i.r,i.g,i.b),a.setXYZ(33,i.r,i.g,i.b),a.setXYZ(34,i.r,i.g,i.b),a.setXYZ(35,i.r,i.g,i.b),a.setXYZ(36,i.r,i.g,i.b),a.setXYZ(37,i.r,i.g,i.b),a.setXYZ(38,r.r,r.g,r.b),a.setXYZ(39,r.r,r.g,r.b),a.setXYZ(40,s.r,s.g,s.b),a.setXYZ(41,s.r,s.g,s.b),a.setXYZ(42,s.r,s.g,s.b),a.setXYZ(43,s.r,s.g,s.b),a.setXYZ(44,s.r,s.g,s.b),a.setXYZ(45,s.r,s.g,s.b),a.setXYZ(46,s.r,s.g,s.b),a.setXYZ(47,s.r,s.g,s.b),a.setXYZ(48,s.r,s.g,s.b),a.setXYZ(49,s.r,s.g,s.b),a.needsUpdate=!0}update(){const e=this.geometry,t=this.pointMap,i=1,r=1;ln.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),mn("c",t,e,ln,0,0,-1),mn("t",t,e,ln,0,0,1),mn("n1",t,e,ln,-i,-r,-1),mn("n2",t,e,ln,i,-r,-1),mn("n3",t,e,ln,-i,r,-1),mn("n4",t,e,ln,i,r,-1),mn("f1",t,e,ln,-i,-r,1),mn("f2",t,e,ln,i,-r,1),mn("f3",t,e,ln,-i,r,1),mn("f4",t,e,ln,i,r,1),mn("u1",t,e,ln,i*.7,r*1.1,-1),mn("u2",t,e,ln,-i*.7,r*1.1,-1),mn("u3",t,e,ln,0,r*2,-1),mn("cf1",t,e,ln,-i,0,1),mn("cf2",t,e,ln,i,0,1),mn("cf3",t,e,ln,0,-r,1),mn("cf4",t,e,ln,0,r,1),mn("cn1",t,e,ln,-i,0,-1),mn("cn2",t,e,ln,i,0,-1),mn("cn3",t,e,ln,0,-r,-1),mn("cn4",t,e,ln,0,r,-1),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}}function mn(n,e,t,i,r,s,o){zf.set(r,s,o).unproject(i);const a=e[n];if(a!==void 0){const l=t.getAttribute("position");for(let c=0,u=a.length;c<u;c++)l.setXYZ(a[c],zf.x,zf.y,zf.z)}}const Vf=new Pi;class aq extends Fr{constructor(e,t=16776960){const i=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),r=new Float32Array(8*3),s=new qe;s.setIndex(new At(i,1)),s.setAttribute("position",new At(r,3)),super(s,new Bn({color:t,toneMapped:!1})),this.object=e,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(e){if(e!==void 0&&console.warn("THREE.BoxHelper: .update() has no longer arguments."),this.object!==void 0&&Vf.setFromObject(this.object),Vf.isEmpty())return;const t=Vf.min,i=Vf.max,r=this.geometry.attributes.position,s=r.array;s[0]=i.x,s[1]=i.y,s[2]=i.z,s[3]=t.x,s[4]=i.y,s[5]=i.z,s[6]=t.x,s[7]=t.y,s[8]=i.z,s[9]=i.x,s[10]=t.y,s[11]=i.z,s[12]=i.x,s[13]=i.y,s[14]=t.z,s[15]=t.x,s[16]=i.y,s[17]=t.z,s[18]=t.x,s[19]=t.y,s[20]=t.z,s[21]=i.x,s[22]=t.y,s[23]=t.z,r.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(e){return this.object=e,this.update(),this}copy(e,t){return super.copy(e,t),this.object=e.object,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class lq extends Fr{constructor(e,t=16776960){const i=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),r=[1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],s=new qe;s.setIndex(new At(i,1)),s.setAttribute("position",new Ve(r,3)),super(s,new Bn({color:t,toneMapped:!1})),this.box=e,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(e){const t=this.box;t.isEmpty()||(t.getCenter(this.position),t.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(e))}dispose(){this.geometry.dispose(),this.material.dispose()}}class cq extends ct{constructor(e,t=1,i=16776960){const r=i,s=[1,-1,0,-1,1,0,-1,-1,0,1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],o=new qe;o.setAttribute("position",new Ve(s,3)),o.computeBoundingSphere(),super(o,new Bn({color:r,toneMapped:!1})),this.type="PlaneHelper",this.plane=e,this.size=t;const a=[1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],l=new qe;l.setAttribute("position",new Ve(a,3)),l.computeBoundingSphere(),this.add(new Be(l,new Jn({color:r,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}updateMatrixWorld(e){this.position.set(0,0,0),this.scale.set(.5*this.size,.5*this.size,1),this.lookAt(this.plane.normal),this.translateZ(-this.plane.constant),super.updateMatrixWorld(e)}dispose(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()}}const nE=new D;let Hf,Sv;class uq extends pt{constructor(e=new D(0,0,1),t=new D(0,0,0),i=1,r=16776960,s=i*.2,o=s*.2){super(),this.type="ArrowHelper",Hf===void 0&&(Hf=new qe,Hf.setAttribute("position",new Ve([0,0,0,0,1,0],3)),Sv=new Hn(0,.5,1,5,1),Sv.translate(0,-.5,0)),this.position.copy(t),this.line=new ct(Hf,new Bn({color:r,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new Be(Sv,new Jn({color:r,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(i,s,o)}setDirection(e){if(e.y>.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{nE.set(e.z,0,-e.x).normalize();const t=Math.acos(e.y);this.quaternion.setFromAxisAngle(nE,t)}}setLength(e,t=e*.2,i=t*.2){this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(i,t,i),this.cone.position.y=e,this.cone.updateMatrix()}setColor(e){this.line.material.color.set(e),this.cone.material.color.set(e)}copy(e){return super.copy(e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}class hq extends Fr{constructor(e=1){const t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],i=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],r=new qe;r.setAttribute("position",new Ve(t,3)),r.setAttribute("color",new Ve(i,3));const s=new Bn({vertexColors:!0,toneMapped:!1});super(r,s),this.type="AxesHelper"}setColors(e,t,i){const r=new Pe,s=this.geometry.attributes.color.array;return r.set(e),r.toArray(s,0),r.toArray(s,3),r.set(t),r.toArray(s,6),r.toArray(s,9),r.set(i),r.toArray(s,12),r.toArray(s,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class F3{constructor(){this.type="ShapePath",this.color=new Pe,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new Vh,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,i,r){return this.currentPath.quadraticCurveTo(e,t,i,r),this}bezierCurveTo(e,t,i,r,s,o){return this.currentPath.bezierCurveTo(e,t,i,r,s,o),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){function t(g){const b=[];for(let _=0,y=g.length;_<y;_++){const T=g[_],S=new Oa;S.curves=T.curves,b.push(S)}return b}function i(g,b){const _=b.length;let y=!1;for(let T=_-1,S=0;S<_;T=S++){let E=b[T],x=b[S],M=x.x-E.x,w=x.y-E.y;if(Math.abs(w)>Number.EPSILON){if(w<0&&(E=b[S],M=-M,x=b[T],w=-w),g.y<E.y||g.y>x.y)continue;if(g.y===E.y){if(g.x===E.x)return!0}else{const C=w*(g.x-E.x)-M*(g.y-E.y);if(C===0)return!0;if(C<0)continue;y=!y}}else{if(g.y!==E.y)continue;if(x.x<=g.x&&g.x<=E.x||E.x<=g.x&&g.x<=x.x)return!0}}return y}const r=Kr.isClockWise,s=this.subPaths;if(s.length===0)return[];let o,a,l;const c=[];if(s.length===1)return a=s[0],l=new Oa,l.curves=a.curves,c.push(l),c;let u=!r(s[0].getPoints());u=e?!u:u;const h=[],d=[];let f=[],p=0,v;d[p]=void 0,f[p]=[];for(let g=0,b=s.length;g<b;g++)a=s[g],v=a.getPoints(),o=r(v),o=e?!o:o,o?(!u&&d[p]&&p++,d[p]={s:new Oa,p:v},d[p].s.curves=a.curves,u&&p++,f[p]=[]):f[p].push({h:a,p:v[0]});if(!d[0])return t(s);if(d.length>1){let g=!1,b=0;for(let _=0,y=d.length;_<y;_++)h[_]=[];for(let _=0,y=d.length;_<y;_++){const T=f[_];for(let S=0;S<T.length;S++){const E=T[S];let x=!0;for(let M=0;M<d.length;M++)i(E.p,d[M].p)&&(_!==M&&b++,x?(x=!1,h[M].push(E)):g=!0);x&&h[_].push(E)}}b>0&&g===!1&&(f=h)}let m;for(let g=0,b=d.length;g<b;g++){l=d[g].s,c.push(l),m=f[g];for(let _=0,y=m.length;_<y;_++)l.holes.push(m[_].h)}return c}}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Vc}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Vc);const dq=Object.freeze(Object.defineProperty({__proto__:null,ACESFilmicToneMapping:Jy,AddEquation:yo,AddOperation:rP,AdditiveAnimationBlendMode:sb,AdditiveBlending:Bp,AlphaFormat:dP,AlwaysCompare:IP,AlwaysDepth:Z2,AlwaysStencilFunc:h_,AmbientLight:Lb,AnimationAction:P3,AnimationClip:$a,AnimationLoader:SY,AnimationMixer:KY,AnimationObjectGroup:YY,AnimationUtils:yY,ArcCurve:e3,ArrayCamera:YP,ArrowHelper:uq,AttachedBindMode:B0,Audio:A3,AudioAnalyser:kY,AudioContext:Ob,AudioListener:UY,AudioLoader:OY,AxesHelper:hq,BackSide:Qn,BasicDepthPacking:SP,BasicShadowMap:WG,Bone:Oc,BooleanKeyframeTrack:al,Box2:R3,Box3:Pi,Box3Helper:lq,BoxGeometry:ai,BoxHelper:aq,BufferAttribute:At,BufferGeometry:qe,BufferGeometryLoader:E3,ByteType:uP,Cache:ja,Camera:fd,CameraHelper:oq,CanvasTexture:GX,CapsuleGeometry:Xm,CatmullRomCurve3:t3,CineonToneMapping:aP,CircleGeometry:Ym,ClampToEdgeWrapping:Rn,Clock:Ib,Color:Pe,ColorKeyframeTrack:Pb,ColorManagement:Ut,CompressedArrayTexture:VX,CompressedCubeTexture:HX,CompressedTexture:$m,CompressedTextureLoader:MY,ConeGeometry:qm,ConstantAlphaFactor:Y2,ConstantColorFactor:j2,CubeCamera:zP,CubeReflectionMapping:Ns,CubeRefractionMapping:Fo,CubeTexture:pd,CubeTextureLoader:EY,CubeUVReflectionMapping:Hc,CubicBezierCurve:xb,CubicBezierCurve3:n3,CubicInterpolant:v3,CullFaceBack:D0,CullFaceFront:I2,CullFaceFrontBack:GG,CullFaceNone:O2,Curve:hr,CurvePath:r3,CustomBlending:D2,CustomToneMapping:lP,CylinderGeometry:Hn,Cylindrical:tq,Data3DTexture:ub,DataArrayTexture:Um,DataTexture:fc,DataTextureLoader:TY,DataUtils:q7,DecrementStencilOp:QG,DecrementWrapStencilOp:t7,DefaultLoadingManager:ec,DepthFormat:Co,DepthStencilFormat:za,DepthTexture:qP,DetachedBindMode:cP,DirectionalLight:lg,DirectionalLightHelper:N3,DiscreteInterpolant:_3,DisplayP3ColorSpace:Dm,DodecahedronGeometry:Km,DoubleSide:bi,DstAlphaFactor:V2,DstColorFactor:G2,DynamicCopyUsage:g7,DynamicDrawUsage:u7,DynamicReadUsage:f7,EdgesGeometry:s3,EllipseCurve:jm,EqualCompare:CP,EqualDepth:Q2,EqualStencilFunc:s7,EquirectangularReflectionMapping:Tc,EquirectangularRefractionMapping:Oh,Euler:rr,EventDispatcher:Nr,ExtrudeGeometry:Jm,FileLoader:Ti,Float16BufferAttribute:tW,Float32BufferAttribute:Ve,Float64BufferAttribute:nW,FloatType:jr,Fog:Hm,FogExp2:Vm,FramebufferTexture:v_,FrontSide:ns,Frustum:Bm,GLBufferAttribute:eq,GLSL1:_7,GLSL3:d_,GreaterCompare:RP,GreaterDepth:tP,GreaterEqualCompare:OP,GreaterEqualDepth:eP,GreaterEqualStencilFunc:c7,GreaterStencilFunc:a7,GridHelper:rq,Group:Mr,HalfFloatType:Cc,HemisphereLight:b3,HemisphereLightHelper:U3,IcosahedronGeometry:Qm,ImageBitmapLoader:T3,ImageLoader:$h,ImageUtils:cb,IncrementStencilOp:JG,IncrementWrapStencilOp:e7,InstancedBufferAttribute:Ic,InstancedBufferGeometry:M3,InstancedInterleavedBuffer:QY,InstancedMesh:vb,Int16BufferAttribute:Q7,Int32BufferAttribute:eW,Int8BufferAttribute:K7,IntType:Qy,InterleavedBuffer:Wc,InterleavedBufferAttribute:os,Interpolant:Xc,InterpolateDiscrete:Pc,InterpolateLinear:Va,InterpolateSmooth:mp,InvertStencilOp:n7,KeepStencilOp:pa,KeyframeTrack:kr,LOD:QP,LatheGeometry:md,Layers:Nm,LessCompare:AP,LessDepth:J2,LessEqualCompare:PP,LessEqualDepth:Lh,LessEqualStencilFunc:o7,LessStencilFunc:r7,Light:Wo,LightProbe:S3,Line:ct,Line3:L3,LineBasicMaterial:Bn,LineCurve:wb,LineCurve3:i3,LineDashedMaterial:p3,LineLoop:_b,LineSegments:Fr,LinearDisplayP3ColorSpace:dd,LinearEncoding:ab,LinearFilter:rn,LinearInterpolant:Cb,LinearMipMapLinearFilter:qG,LinearMipMapNearestFilter:YG,LinearMipmapLinearFilter:rs,LinearMipmapNearestFilter:Lm,LinearSRGBColorSpace:ss,LinearToneMapping:sP,LinearTransfer:Uh,Loader:Xn,LoaderUtils:Gi,LoadingManager:sg,LoopOnce:yP,LoopPingPong:xP,LoopRepeat:bP,LuminanceAlphaFormat:pP,LuminanceFormat:fP,MOUSE:Ss,Material:En,MaterialLoader:cg,MathUtils:Gn,Matrix3:ut,Matrix4:ze,MaxEquation:k0,Mesh:Be,MeshBasicMaterial:Jn,MeshDepthMaterial:fb,MeshDistanceMaterial:pb,MeshLambertMaterial:Tb,MeshMatcapMaterial:f3,MeshNormalMaterial:d3,MeshPhongMaterial:oh,MeshPhysicalMaterial:us,MeshStandardMaterial:ol,MeshToonMaterial:h3,MinEquation:F0,MirroredRepeatWrapping:Ac,MixOperation:iP,MultiplyBlending:N0,MultiplyOperation:hd,NearestFilter:hn,NearestMipMapLinearFilter:XG,NearestMipMapNearestFilter:jG,NearestMipmapLinearFilter:hc,NearestMipmapNearestFilter:Ih,NeverCompare:TP,NeverDepth:K2,NeverStencilFunc:i7,NoBlending:Ps,NoColorSpace:Bi,NoToneMapping:Rs,NormalAnimationBlendMode:Im,NormalBlending:Ra,NotEqualCompare:LP,NotEqualDepth:nP,NotEqualStencilFunc:l7,NumberKeyframeTrack:Ga,Object3D:pt,ObjectLoader:RY,ObjectSpaceNormalMap:EP,OctahedronGeometry:Qi,OneFactor:k2,OneMinusConstantAlphaFactor:q2,OneMinusConstantColorFactor:X2,OneMinusDstAlphaFactor:H2,OneMinusDstColorFactor:W2,OneMinusSrcAlphaFactor:Vp,OneMinusSrcColorFactor:z2,OrthographicCamera:zi,P3Primaries:Fh,PCFShadowMap:Ky,PCFSoftShadowMap:Zy,PMREMGenerator:p_,Path:Vh,PerspectiveCamera:Nt,Plane:Ms,PlaneGeometry:Ni,PlaneHelper:cq,PointLight:jh,PointLightHelper:D3,Points:yb,PointsMaterial:Wm,PolarGridHelper:sq,PolyhedronGeometry:Go,PositionalAudio:FY,PropertyBinding:yt,PropertyMixer:C3,QuadraticBezierCurve:Sb,QuadraticBezierCurve3:Mb,Quaternion:gt,QuaternionKeyframeTrack:Fs,QuaternionLinearInterpolant:y3,RED_GREEN_RGTC2_Format:c_,RED_RGTC1_Format:_P,REVISION:Vc,RGBADepthPacking:MP,RGBAFormat:ki,RGBAIntegerFormat:rb,RGBA_ASTC_10x10_Format:i_,RGBA_ASTC_10x5_Format:e_,RGBA_ASTC_10x6_Format:t_,RGBA_ASTC_10x8_Format:n_,RGBA_ASTC_12x10_Format:r_,RGBA_ASTC_12x12_Format:s_,RGBA_ASTC_4x4_Format:j0,RGBA_ASTC_5x4_Format:X0,RGBA_ASTC_5x5_Format:Y0,RGBA_ASTC_6x5_Format:q0,RGBA_ASTC_6x6_Format:K0,RGBA_ASTC_8x5_Format:Z0,RGBA_ASTC_8x6_Format:J0,RGBA_ASTC_8x8_Format:Q0,RGBA_BPTC_Format:pp,RGBA_ETC2_EAC_Format:$0,RGBA_PVRTC_2BPPV1_Format:G0,RGBA_PVRTC_4BPPV1_Format:H0,RGBA_S3TC_DXT1_Format:hp,RGBA_S3TC_DXT3_Format:dp,RGBA_S3TC_DXT5_Format:fp,RGB_BPTC_SIGNED_Format:o_,RGB_BPTC_UNSIGNED_Format:a_,RGB_ETC1_Format:vP,RGB_ETC2_Format:W0,RGB_PVRTC_2BPPV1_Format:V0,RGB_PVRTC_4BPPV1_Format:z0,RGB_S3TC_DXT1_Format:up,RGFormat:gP,RGIntegerFormat:ib,RawShaderMaterial:sh,Ray:sl,Raycaster:ug,Rec709Primaries:Nh,RectAreaLight:x3,RedFormat:mP,RedIntegerFormat:nb,ReinhardToneMapping:oP,RenderTarget:FP,RepeatWrapping:is,ReplaceStencilOp:ZG,ReverseSubtractEquation:N2,RingGeometry:eg,SIGNED_RED_GREEN_RGTC2_Format:u_,SIGNED_RED_RGTC1_Format:l_,SRGBColorSpace:Mn,SRGBTransfer:Ht,Scene:mb,ShaderChunk:lt,ShaderLib:er,ShaderMaterial:cr,ShadowMaterial:u3,Shape:Oa,ShapeGeometry:tg,ShapePath:F3,ShapeUtils:Kr,ShortType:hP,Skeleton:$c,SkeletonHelper:nq,SkinnedMesh:Gm,Source:Ea,Sphere:Ri,SphereGeometry:jc,Spherical:Xh,SphericalHarmonics3:w3,SplineCurve:Eb,SpotLight:ag,SpotLightHelper:O3,Sprite:JP,SpriteMaterial:gb,SrcAlphaFactor:zp,SrcAlphaSaturateFactor:$2,SrcColorFactor:B2,StaticCopyUsage:m7,StaticDrawUsage:kh,StaticReadUsage:d7,StereoCamera:IY,StreamCopyUsage:v7,StreamDrawUsage:h7,StreamReadUsage:p7,StringKeyframeTrack:ll,SubtractEquation:U2,SubtractiveBlending:U0,TOUCH:xr,TangentSpaceNormalMap:Ho,TetrahedronGeometry:ng,Texture:Jt,TextureLoader:og,TorusGeometry:bo,TorusKnotGeometry:ig,Triangle:yi,TriangleFanDrawMode:Hp,TriangleStripDrawMode:ob,TrianglesDrawMode:wP,TubeGeometry:rg,TwoPassDoubleSide:$G,UVMapping:Rm,Uint16BufferAttribute:Fm,Uint32BufferAttribute:hb,Uint8BufferAttribute:Z7,Uint8ClampedBufferAttribute:J7,Uniform:Nb,UniformsGroup:JY,UniformsLib:Ue,UniformsUtils:km,UnsignedByteType:Tr,UnsignedInt248Type:Ao,UnsignedIntType:Ts,UnsignedShort4444Type:eb,UnsignedShort5551Type:tb,UnsignedShortType:Om,VSMShadowMap:Gr,Vector2:_e,Vector3:D,Vector4:vt,VectorKeyframeTrack:Wa,VideoTexture:zX,WebGL1Renderer:KP,WebGL3DRenderTarget:F7,WebGLArrayRenderTarget:N7,WebGLCoordinateSystem:Xr,WebGLCubeRenderTarget:VP,WebGLMultipleRenderTargets:k7,WebGLRenderTarget:Lr,WebGLRenderer:nh,WebGLUtils:XP,WebGPUCoordinateSystem:Bh,WireframeGeometry:c3,WrapAroundEnding:Dh,ZeroCurvatureEnding:Sa,ZeroFactor:F2,ZeroSlopeEnding:Ma,ZeroStencilOp:KG,_SRGBAFormat:Gp,createCanvasElement:NP,sRGBEncoding:Po},Symbol.toStringTag,{value:"Module"}));function Yc(n){return rm()?(W_(n),!0):!1}function Yh(){const n=new Set,e=r=>{n.delete(r)};return{on:r=>{n.add(r);const s=()=>e(r);return Yc(s),{off:s}},off:e,trigger:r=>Promise.all(Array.from(n).map(s=>r?s(r):s()))}}function gn(n){return typeof n=="function"?n():Se(n)}const fq=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const pq=Object.prototype.toString,mq=n=>pq.call(n)==="[object Object]",gq=()=>{};function vq(n,e,t=!1){return e.reduce((i,r)=>(r in n&&(!t||n[r]!==void 0)&&(i[r]=n[r]),i),{})}function _q(n,e={}){if(!yn(n))return Or(n);const t=Array.isArray(n.value)?Array.from({length:n.value.length}):{};for(const i in n.value)t[i]=_O(()=>({get(){return n.value[i]},set(r){var s;if((s=gn(e.replaceRef))!=null?s:!0)if(Array.isArray(n.value)){const a=[...n.value];a[i]=r,n.value=a}else{const a=ii(Bt({},n.value),{[i]:r});Object.setPrototypeOf(a,Object.getPrototypeOf(n.value)),n.value=a}else n.value[i]=r}}));return t}function Fb(n,e=!0){An()?bn(n):e?n():Jr(n)}function Yr(n){var e;const t=gn(n);return(e=t==null?void 0:t.$el)!=null?e:t}const $o=fq?window:void 0;function qh(...n){let e,t,i,r;if(typeof n[0]=="string"||Array.isArray(n[0])?([t,i,r]=n,e=$o):[e,t,i,r]=n,!e)return gq;Array.isArray(t)||(t=[t]),Array.isArray(i)||(i=[i]);const s=[],o=()=>{s.forEach(u=>u()),s.length=0},a=(u,h,d,f)=>(u.addEventListener(h,d,f),()=>u.removeEventListener(h,d,f)),l=ft(()=>[Yr(e),gn(r)],([u,h])=>{if(o(),!u)return;const d=mq(h)?Bt({},h):h;s.push(...t.flatMap(f=>i.map(p=>a(u,f,p,d))))},{immediate:!0,flush:"post"}),c=()=>{l(),o()};return Yc(c),c}function yq(){const n=xe(!1);return An()&&bn(()=>{n.value=!0}),n}function k3(n){const e=yq();return Te(()=>(e.value,!!n()))}function bq(n,e={}){const{immediate:t=!0,fpsLimit:i=void 0,window:r=$o}=e,s=xe(!1),o=i?1e3/i:null;let a=0,l=null;function c(d){if(!s.value||!r)return;const f=d-(a||d);if(o&&f<o){l=r.requestAnimationFrame(c);return}n({delta:f,timestamp:d}),a=d,l=r.requestAnimationFrame(c)}function u(){!s.value&&r&&(s.value=!0,l=r.requestAnimationFrame(c))}function h(){s.value=!1,l!=null&&r&&(r.cancelAnimationFrame(l),l=null)}return t&&u(),Yc(h),{isActive:om(s),pause:h,resume:u}}function xq(n,e={}){const{window:t=$o}=e,i=k3(()=>t&&"matchMedia"in t&&typeof t.matchMedia=="function");let r;const s=xe(!1),o=c=>{s.value=c.matches},a=()=>{r&&("removeEventListener"in r?r.removeEventListener("change",o):r.removeListener(o))},l=ar(()=>{i.value&&(a(),r=t.matchMedia(gn(n)),"addEventListener"in r?r.addEventListener("change",o):r.addListener(o),s.value=r.matches)});return Yc(()=>{l(),a(),r=void 0}),s}function wq(n={}){const{window:e=$o}=n,t=xe(1);if(e){let i=function(){t.value=e.devicePixelRatio,r(),s=e.matchMedia("(resolution: ".concat(t.value,"dppx)")),s.addEventListener("change",i,{once:!0})},r=function(){s==null||s.removeEventListener("change",i)},s;i(),Yc(r)}return{pixelRatio:t}}function B3(n,e,t={}){const h=t,{window:i=$o}=h,r=Id(h,["window"]);let s;const o=k3(()=>i&&"ResizeObserver"in i),a=()=>{s&&(s.disconnect(),s=void 0)},l=Te(()=>Array.isArray(n)?n.map(d=>Yr(d)):[Yr(n)]),c=ft(l,d=>{if(a(),o.value&&i){s=new ResizeObserver(e);for(const f of d)f&&s.observe(f,r)}},{immediate:!0,flush:"post",deep:!0}),u=()=>{a(),c()};return Yc(u),{isSupported:o,stop:u}}function Sq(n,e={}){const{reset:t=!0,windowResize:i=!0,windowScroll:r=!0,immediate:s=!0}=e,o=xe(0),a=xe(0),l=xe(0),c=xe(0),u=xe(0),h=xe(0),d=xe(0),f=xe(0);function p(){const v=Yr(n);if(!v){t&&(o.value=0,a.value=0,l.value=0,c.value=0,u.value=0,h.value=0,d.value=0,f.value=0);return}const m=v.getBoundingClientRect();o.value=m.height,a.value=m.bottom,l.value=m.left,c.value=m.right,u.value=m.top,h.value=m.width,d.value=m.x,f.value=m.y}return B3(n,p),ft(()=>Yr(n),v=>!v&&p()),r&&qh("scroll",p,{capture:!0,passive:!0}),i&&qh("resize",p,{passive:!0}),Fb(()=>{s&&p()}),{height:o,bottom:a,left:l,right:c,top:u,width:h,x:d,y:f,update:p}}function Mq(n,e={width:0,height:0},t={}){const{window:i=$o,box:r="content-box"}=t,s=Te(()=>{var h,d;return(d=(h=Yr(n))==null?void 0:h.namespaceURI)==null?void 0:d.includes("svg")}),o=xe(e.width),a=xe(e.height),{stop:l}=B3(n,([h])=>{const d=r==="border-box"?h.borderBoxSize:r==="content-box"?h.contentBoxSize:h.devicePixelContentBoxSize;if(i&&s.value){const f=Yr(n);if(f){const p=i.getComputedStyle(f);o.value=Number.parseFloat(p.width),a.value=Number.parseFloat(p.height)}}else if(d){const f=Array.isArray(d)?d:[d];o.value=f.reduce((p,{inlineSize:v})=>p+v,0),a.value=f.reduce((p,{blockSize:v})=>p+v,0)}else o.value=h.contentRect.width,a.value=h.contentRect.height},t);Fb(()=>{const h=Yr(n);h&&(o.value="offsetWidth"in h?h.offsetWidth:e.width,a.value="offsetHeight"in h?h.offsetHeight:e.height)});const c=ft(()=>Yr(n),h=>{o.value=h?e.width:0,a.value=h?e.height:0});function u(){l(),c()}return{width:o,height:a,stop:u}}const z3={x:0,y:0,pointerId:0,pressure:0,tiltX:0,tiltY:0,width:0,height:0,twist:0,pointerType:null},Eq=Object.keys(z3);function Tq(n={}){const{target:e=$o}=n,t=xe(!1),i=xe(n.initialValue||{});Object.assign(i.value,z3,i.value);const r=s=>{t.value=!0,!(n.pointerTypes&&!n.pointerTypes.includes(s.pointerType))&&(i.value=vq(s,Eq,!1))};if(e){const s={passive:!0};qh(e,["pointerdown","pointermove","pointerup"],r,s),qh(e,"pointerleave",()=>t.value=!1,s)}return ii(Bt({},_q(i)),{isInside:t})}function Aq(n={}){const{window:e=$o,initialWidth:t=Number.POSITIVE_INFINITY,initialHeight:i=Number.POSITIVE_INFINITY,listenOrientation:r=!0,includeScrollbar:s=!0}=n,o=xe(t),a=xe(i),l=()=>{e&&(s?(o.value=e.innerWidth,a.value=e.innerHeight):(o.value=e.document.documentElement.clientWidth,a.value=e.document.documentElement.clientHeight))};if(l(),Fb(l),qh("resize",l,{passive:!0}),r){const c=xq("(orientation: portrait)");ft(c,()=>l())}return{width:o,height:a}}const Cq=({sizes:n,scene:e})=>{const t=xe([]),i=Te(()=>t.value[0]),r=(a,l=!1)=>{t.value.some(({uuid:c})=>c===a.uuid)||(l?o(a):t.value.push(a))},s=a=>{t.value=t.value.filter(({uuid:l})=>l!==a.uuid)},o=a=>{const l=a instanceof fd?a:t.value.find(u=>u.uuid===a);if(!l)return;const c=t.value.filter(({uuid:u})=>u!==l.uuid);t.value=[l,...c]};return ar(()=>{n.aspectRatio.value&&t.value.forEach(a=>{a instanceof Nt&&(a.aspect=n.aspectRatio.value),(a instanceof Nt||a instanceof zi)&&a.updateProjectionMatrix()})}),e.userData.tres__registerCamera=r,e.userData.tres__deregisterCamera=s,Ci(()=>{t.value=[]}),{camera:i,cameras:t,registerCamera:r,deregisterCamera:s,setCameraActive:o}},V3=Yh(),H3=Yh(),kb=Yh(),ah=new Ib;let vp=0,_p=0;const{pause:Pq,resume:Rq,isActive:Lq}=bq(()=>{V3.trigger({delta:vp,elapsed:_p,clock:ah}),H3.trigger({delta:vp,elapsed:_p,clock:ah}),kb.trigger({delta:vp,elapsed:_p,clock:ah})},{immediate:!1});kb.on(()=>{vp=ah.getDelta(),_p=ah.getElapsedTime()});const dr=()=>({onBeforeLoop:V3.on,onLoop:H3.on,onAfterLoop:kb.on,pause:Pq,resume:Rq,isActive:Lq}),iE="[TresJS ▲ ■ ●] ";function cl(){function n(i,r){console.error("".concat(iE," ").concat(i),r||"")}function e(i){console.warn("".concat(iE," ").concat(i))}function t(i,r){}return{logError:n,logWarning:e,logMessage:t}}function Oq(n){return n instanceof Pe?n:Array.isArray(n)?new Pe(...n):new Pe(n)}const G3=(n,e)=>{for(const t of Object.keys(e))e[t]instanceof Object&&Object.assign(e[t],G3(n[t],e[t]));return Object.assign(n||{},e),n},Iq="html,body,base,head,link,meta,style,title,address,article,aside,footer,header,hgroup,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,summary,template,blockquote,iframe,tfoot",Dq=Uq(Iq);function rE(n){return n&&n.nodeType===1}function Gf(n){return n.replace(/-([a-z])/g,(e,t)=>t.toUpperCase())}function Uq(n,e){const t=Object.create(null),i=n.split(",");for(let r=0;r<i.length;r++)t[i[r]]=!0;return e?r=>!!t[r.toLowerCase()]:r=>!!t[r]}const Nq=(n,e)=>{const t=new Set,i=[];for(const r of n){const s=e(r);t.has(s)||(t.add(s),i.push(r))}return i},sE=(n,e)=>{if(!e)return;const t=Array.isArray(e)?e:e.match(/([^[.\]])+/g);return t==null?void 0:t.reduce((i,r)=>i&&i[r],n)},Fq=(n,e,t)=>{const i=Array.isArray(e)?e:e.match(/([^[.\]])+/g);i&&i.reduce((r,s,o)=>(r[s]===void 0&&(r[s]={}),o===i.length-1&&(r[s]=t),r[s]),n)};function W3(n,e){if(rE(n)&&rE(e)){const r=n.attributes,s=e.attributes;return r.length!==s.length?!1:Array.from(r).every(({name:o,value:a})=>e.getAttribute(o)===a)}if(n===e)return!0;if(n===null||typeof n!="object"||e===null||typeof e!="object")return!1;const t=Object.keys(n),i=Object.keys(e);if(t.length!==i.length)return!1;for(const r of t)if(!i.includes(r)||!W3(n[r],e[r]))return!1;return!0}function kq(n,e){if(!Array.isArray(n)||!Array.isArray(e)||n.length!==e.length)return!1;for(let t=0;t<n.length;t++)if(!W3(n[t],e[t]))return!1;return!0}const Bq=Array.isArray,zq=Number.parseInt(Vc.replace("dev","")),Wf={realistic:{shadows:!0,physicallyCorrectLights:!0,outputColorSpace:Mn,toneMapping:Jy,toneMappingExposure:3,shadowMap:{enabled:!0,type:Zy}}};function Vq({scene:n,canvas:e,options:t,disableRender:i,contextParts:{sizes:r,camera:s}}){const o=Te(()=>({alpha:gn(t.alpha),depth:gn(t.depth),canvas:Yr(e),context:gn(t.context),stencil:gn(t.stencil),antialias:gn(t.antialias)===void 0?!0:gn(t.antialias),precision:gn(t.precision),powerPreference:gn(t.powerPreference),premultipliedAlpha:gn(t.premultipliedAlpha),preserveDrawingBuffer:gn(t.preserveDrawingBuffer),logarithmicDepthBuffer:gn(t.logarithmicDepthBuffer),failIfMajorPerformanceCaveat:gn(t.failIfMajorPerformanceCaveat)})),a=jn(new nh(o.value));ft(o,()=>{a.value.dispose(),a.value=new nh(o.value)}),ar(()=>{a.value.setSize(r.width.value,r.height.value)});const{pixelRatio:l}=wq();ar(()=>{a.value.setPixelRatio(l.value)});const{logError:c}=cl(),u=(()=>{const p=new nh,v={shadowMap:{enabled:p.shadowMap.enabled,type:p.shadowMap.type},toneMapping:p.toneMapping,toneMappingExposure:p.toneMappingExposure,outputColorSpace:p.outputColorSpace};return p.dispose(),v})();ar(()=>{const p=gn(t.preset);p&&(p in Wf||c("Renderer Preset must be one of these: ".concat(Object.keys(Wf).join(", "))),G3(a.value,Wf[p]));const v=(b,_)=>{const y=gn(b),T=()=>{if(p)return sE(Wf[p],_)};if(y!==void 0)return y;const S=T();return S!==void 0?S:sE(u,_)},m=(b,_)=>Fq(a.value,_,v(b,_));m(t.shadows,"shadowMap.enabled"),m(t.toneMapping,"toneMapping"),m(t.shadowMapType,"shadowMap.type"),zq<150&&m(!t.useLegacyLights,"physicallyCorrectLights"),m(t.outputColorSpace,"outputColorSpace"),m(t.toneMappingExposure,"toneMappingExposure");const g=v(t.clearColor,"clearColor");g&&a.value.setClearColor(g?Oq(g):new Pe(0))});const{pause:h,resume:d,onLoop:f}=dr();return f(()=>{s.value&&!gn(i)&&a.value.render(n,s.value)}),d(),Ci(()=>{h(),a.value.dispose(),a.value.forceContextLoss()}),{renderer:a}}const oE=n=>typeof n=="function",Hq=n=>!!n&&n.constructor===Array;function Gq(n){const e={nodes:{},materials:{}};return n&&n.traverse(t=>{t.name&&(e.nodes[t.name]=t),t.material&&!e.materials[t.material.name]&&(e.materials[t.material.name]=t.material)}),e}async function $3(n,e,t,i,r){const{logError:s}=cl(),o=new n;r&&r(o),t&&t(o);const a=(Array.isArray(e)?e:[e]).map(l=>new Promise((c,u)=>{o.load(l,h=>{h.scene&&Object.assign(h,Gq(h.scene)),c(h)},i,h=>u(s("[useLoader] - Failed to load resource",h)))}));return Hq(e)?await Promise.all(a):await a[0]}async function Nre(n){const e=new sg,t=new og(e),i=r=>new Promise((s,o)=>{t.load(r,a=>s(a),()=>null,()=>{o(new Error("[useTextures] - Failed to load texture"))})});if(Bq(n)){const r=await Promise.all(n.map(s=>i(s)));return n.length>1?r:r[0]}else{const{map:r,displacementMap:s,normalMap:o,roughnessMap:a,metalnessMap:l,aoMap:c,alphaMap:u,matcap:h}=n;return{map:r?await i(r):null,displacementMap:s?await i(s):null,normalMap:o?await i(o):null,roughnessMap:a?await i(a):null,metalnessMap:l?await i(l):null,aoMap:c?await i(c):null,alphaMap:u?await i(u):null,matcap:h?await i(h):null}}}const Wq=(n,{renderer:e,camera:t,raycaster:i})=>{const r=Te(()=>e.value.domElement),{x:s,y:o}=Tq({target:r}),{width:a,height:l,top:c,left:u}=Sq(r),h=({x:E,y:x})=>{if(r.value)return{x:(E-u.value)/a.value*2-1,y:-((x-c.value)/l.value)*2+1}},d=({x:E,y:x})=>{if(t.value)return i.value.setFromCamera(new _e(E,x),t.value),i.value.intersectObjects(n.value,!1)},f=E=>{var M,w;const x=h({x:(M=E==null?void 0:E.clientX)!=null?M:s.value,y:(w=E==null?void 0:E.clientY)!=null?w:o.value});return x?d(x)||[]:[]},p=Te(()=>f()),v=Yh(),m=Yh(),g=(E,x)=>{E.trigger({event:x,intersects:f(x)})},b=E=>{g(m,E)};let _;const y=E=>{var x;_=(x=f(E)[0])==null?void 0:x.object},T=E=>{var x;E instanceof PointerEvent&&_===((x=f(E)[0])==null?void 0:x.object)&&g(v,E)},S=E=>m.trigger({event:E,intersects:[]});return r.value.addEventListener("pointerup",T),r.value.addEventListener("pointerdown",y),r.value.addEventListener("pointermove",b),r.value.addEventListener("pointerleave",S),Ci(()=>{r!=null&&r.value&&(r.value.removeEventListener("pointerup",T),r.value.removeEventListener("pointerdown",y),r.value.removeEventListener("pointermove",b),r.value.removeEventListener("pointerleave",S))}),{intersects:p,onClick:E=>v.on(E).off,onPointerMove:E=>m.on(E).off}};function Fre(){const{logWarning:n}=cl();function e(s,o,a){let l=null;return s.traverse(c=>{c[o]===a&&(l=c)}),l||n("Child with ".concat(o," '").concat(a,"' not found.")),l}function t(s,o,a){const l=[];return s.traverse(c=>{c[o].includes(a)&&l.push(c)}),l.length||n("Children with ".concat(o," '").concat(a,"' not found.")),l}function i(s,o){return e(s,"name",o)}function r(s,o){return t(s,"name",o)}return{seek:e,seekByName:i,seekAll:t,seekAllByName:r}}const $q=({scene:n,contextParts:e})=>{const t=ui({click:new Map,pointerMove:new Map,pointerEnter:new Map,pointerLeave:new Map}),i=xe(new Set),r=d=>{i.value.add(d)},s=d=>{i.value.delete(d)},o=d=>{Object.values(t).forEach(f=>f.delete(d)),s(d)},a=d=>{const{onClick:f,onPointerMove:p,onPointerEnter:v,onPointerLeave:m}=d;f&&t.click.set(d,f),p&&t.pointerMove.set(d,p),v&&t.pointerEnter.set(d,v),m&&t.pointerLeave.set(d,m)};n.userData.tres__registerAtPointerEventHandler=a,n.userData.tres__deregisterAtPointerEventHandler=o,n.userData.tres__registerBlockingObjectAtPointerEventHandler=r,n.userData.tres__deregisterBlockingObjectAtPointerEventHandler=s;const l=Te(()=>Nq([...Array.from(i.value),...Object.values(t).map(d=>Array.from(d.keys())).flat()],({uuid:d})=>d)),{onClick:c,onPointerMove:u}=Wq(l,e);c(({intersects:d,event:f})=>{var p;d.length&&((p=t.click.get(d[0].object))==null||p(d[0],f))});let h;return u(({intersects:d,event:f})=>{var p,v,m,g;const b=(p=d==null?void 0:d[0])==null?void 0:p.object,{pointerLeave:_,pointerEnter:y,pointerMove:T}=t;h&&h!==b&&((v=_.get(h))==null||v(h,f)),b&&(h!==b&&((m=y.get(b))==null||m(d[0],f)),(g=T.get(b))==null||g(d[0],f)),h=b||null}),{registerObject:a,deregisterObject:o}},w_=xe({}),Bb=n=>Object.assign(w_.value,n);function jq({scene:n,canvas:e,windowSize:t,disableRender:i,rendererOptions:r}){const s=Te(()=>gn(t)?Aq():Mq(gn(e).parentElement)),o=Te(()=>s.value.width.value),a=Te(()=>s.value.height.value),l=Te(()=>o.value/a.value),c={height:a,width:o,aspectRatio:l},u=jn(n),{camera:h,cameras:d,registerCamera:f,deregisterCamera:p,setCameraActive:v}=Cq({sizes:c,scene:n}),{renderer:m}=Vq({scene:n,canvas:e,options:r,contextParts:{sizes:c,camera:h},disableRender:i}),g={sizes:c,scene:u,camera:h,cameras:om(d),renderer:m,raycaster:jn(new ug),controls:xe(null),extend:Bb,registerCamera:f,setCameraActive:v,deregisterCamera:p};return Si("useTres",g),g}function ur(){const n=Zt("useTres");if(!n)throw new Error("useTresContext must be used together with useTresContextProvider");return n}let cn=null;const{logError:aE}=cl(),Xq={createElement(n,e,t,i){var r,s;if(i||(i={}),i.args||(i.args=[]),n==="template"||Dq(n))return null;let o=n.replace("Tres",""),a;if(n==="primitive"){(i==null?void 0:i.object)===void 0&&aE("Tres primitives need a prop 'object'");const l=i.object;o=l.type,a=Object.assign(l,{type:o,attach:i.attach,primitive:!0})}else{const l=w_.value[o];l||aE("".concat(o," is not defined on the THREE namespace. Use extend to add it to the catalog.")),a=new l(...i.args)}return a.isCamera&&(i!=null&&i.position||a.position.set(3,3,3),i!=null&&i.lookAt||a.lookAt(0,0,0)),(i==null?void 0:i.attach)===void 0&&(a.isMaterial?a.attach="material":a.isBufferGeometry&&(a.attach="geometry")),a.isObject3D&&((r=i==null?void 0:i.material)!=null&&r.isMaterial&&(a.userData.tres__materialViaProp=!0),(s=i==null?void 0:i.geometry)!=null&&s.isBufferGeometry&&(a.userData.tres__geometryViaProp=!0)),a.userData=ii(Bt({},a.userData),{tres__name:o}),a},insert(n,e){var t,i,r,s;e&&e.isScene&&(cn=e);const o=e||cn;if(n!=null&&n.isObject3D){if(n!=null&&n.isCamera){if(!(cn!=null&&cn.userData.tres__registerCamera))throw"could not find tres__registerCamera on scene's userData";(i=cn==null?void 0:(t=cn.userData).tres__registerCamera)==null||i.call(t,n)}if(n!=null&&n.onClick||n!=null&&n.onPointerMove||n!=null&&n.onPointerEnter||n!=null&&n.onPointerLeave){if(!(cn!=null&&cn.userData.tres__registerAtPointerEventHandler))throw"could not find tres__registerAtPointerEventHandler on scene's userData";(s=cn==null?void 0:(r=cn.userData).tres__registerAtPointerEventHandler)==null||s.call(r,n)}}n!=null&&n.isObject3D&&o!=null&&o.isObject3D?(o.add(n),n.dispatchEvent({type:"added"})):n!=null&&n.isFog?o.fog=n:typeof(n==null?void 0:n.attach)=="string"&&(n.__previousAttach=n[o==null?void 0:o.attach],o&&(o[n.attach]=n))},remove(n){var e,t;if(n){if(n.isObject3D){const i=n,r=c=>{var u,h;const d=c;c.userData.tres__materialViaProp||(u=d.material)==null||u.dispose(),c.userData.tres__geometryViaProp||(h=d.geometry)==null||h.dispose()},s=cn==null?void 0:cn.userData.tres__deregisterAtPointerEventHandler,o=cn==null?void 0:cn.userData.tres__deregisterBlockingObjectAtPointerEventHandler,a=c=>{var u,h;if(!o)throw"could not find tres__deregisterBlockingObjectAtPointerEventHandler on scene's userData";if((h=cn==null?void 0:(u=cn.userData).tres__deregisterBlockingObjectAtPointerEventHandler)==null||h.call(u,c),!s)throw"could not find tres__deregisterAtPointerEventHandler on scene's userData";(c!=null&&c.onClick||c!=null&&c.onPointerMove||c!=null&&c.onPointerEnter||c!=null&&c.onPointerLeave)&&(s==null||s(c))},l=c=>{const u=cn==null?void 0:cn.userData.tres__deregisterCamera;if(!u)throw"could not find tres__deregisterCamera on scene's userData";c.isCamera&&(u==null||u(c))};i.traverse(c=>{r(c),l(c),a==null||a(c)}),r(i),l(i),a==null||a(i)}(e=n.removeFromParent)==null||e.call(n),(t=n.dispose)==null||t.call(n)}},patchProp(n,e,t,i){var r,s,o,a;if(n){let l=n,c=e;if(n.isObject3D&&c==="blocks-pointer-events"){i||i===""?(s=cn==null?void 0:(r=cn.userData).tres__registerBlockingObjectAtPointerEventHandler)==null||s.call(r,n):(a=cn==null?void 0:(o=cn.userData).tres__deregisterBlockingObjectAtPointerEventHandler)==null||a.call(o,n);return}let u=Gf(c),h=l==null?void 0:l[u];if(c==="args"){const f=n,p=t!=null?t:[],v=i!=null?i:[],m=n.userData.tres__name||n.type;m&&p.length&&!kq(p,v)&&(l=Object.assign(f,new w_.value[m](...i)));return}if(l.type==="BufferGeometry"){if(c==="args")return;l.setAttribute(Gf(c),new At(...i));return}if(c.includes("-")&&h===void 0){const f=c.split("-");h=f.reduce((p,v)=>p[Gf(v)],l),c=f.pop(),u=c.toLowerCase(),h!=null&&h.set||(l=f.reduce((p,v)=>p[Gf(v)],l))}let d=i;if(d===""&&(d=!0),oE(h)){Array.isArray(d)?n[u](...d):n[u](d);return}!(h!=null&&h.set)&&!oE(h)?l[u]=d:h.constructor===d.constructor&&h!=null&&h.copy?h==null||h.copy(d):Array.isArray(d)?h.set(...d):!h.isColor&&h.setScalar?h.setScalar(d):h.set(d)}},parentNode(n){return(n==null?void 0:n.parent)||null},createText:()=>{},createComment:()=>{},setText:()=>{},setElementText:()=>{},nextSibling:()=>{},querySelector:()=>{},setScopeId:()=>{},cloneNode:()=>{},insertStaticContent:()=>{}},{render:Yq}=pA(Xq);Bb(dq);const qq=["data-scene"],kre=Xe({__name:"TresCanvas",props:{shadows:{type:Boolean,default:void 0},clearColor:{},toneMapping:{},shadowMapType:{},useLegacyLights:{type:Boolean,default:void 0},outputColorSpace:{},toneMappingExposure:{},camera:{},preset:{},windowSize:{type:Boolean,default:void 0},disableRender:{type:Boolean,default:void 0},context:{},precision:{},alpha:{type:Boolean,default:void 0},premultipliedAlpha:{type:Boolean},antialias:{type:Boolean,default:void 0},stencil:{type:Boolean,default:void 0},preserveDrawingBuffer:{type:Boolean,default:void 0},powerPreference:{},depth:{type:Boolean,default:void 0},logarithmicDepthBuffer:{type:Boolean,default:void 0},failIfMajorPerformanceCaveat:{type:Boolean,default:void 0}},setup(n,{expose:e}){var t;const i=n,{logWarning:r}=cl(),s=xe(),o=jn(new mb);dr();const a=sA(),l=(t=An())==null?void 0:t.appContext.app,c=f=>Xe({setup(){var p;const v=(p=An())==null?void 0:p.appContext;return v&&(v.app=l),Si("useTres",f),Si("extend",Bb),()=>Io(en,null,a!=null&&a.default?a.default():[])}}),u=f=>{const p=c(f);Yq(Io(p),o.value)},h=Te(()=>i.disableRender),d=jn(null);return e({context:d}),bn(()=>{const f=s;d.value=jq({scene:o.value,canvas:f,windowSize:i.windowSize,disableRender:h,rendererOptions:i}),$q({scene:o.value,contextParts:d.value});const{registerCamera:p,camera:v,cameras:m,deregisterCamera:g}=d.value;u(d.value);const b=()=>{const _=new Nt(45,window.innerWidth/window.innerHeight,.1,1e3);_.position.set(3,3,3),_.lookAt(0,0,0),p(_);const y=ar(()=>{m.value.length>=2&&(_.removeFromParent(),g(_),y==null||y())})};ft(()=>i.camera,(_,y)=>{_&&p(_),y&&(y.removeFromParent(),g(y))},{immediate:!0}),v.value||(r("No camera found. Creating a default perspective camera. To have full control over a camera, please add one to the scene."),b())}),(f,p)=>(nt(),Mt("canvas",{ref_key:"canvas",ref:s,"data-scene":o.value.uuid,class:Yt(f.$attrs.class),style:Fn(Bt({display:"block",width:"100%",height:"100%",position:f.windowSize?"fixed":"relative",top:0,left:0,pointerEvents:"auto",touchAction:"none"},f.$attrs.style))},null,14,qq))}});/*! Tweakpane 4.0.1 (c) 2016 cocopon, licensed under the MIT license. */function Gt(n){return n==null}function zb(n){return n!==null&&typeof n=="object"}function S_(n){return n!==null&&typeof n=="object"}function Kq(n,e){if(n.length!==e.length)return!1;for(let t=0;t<n.length;t++)if(n[t]!==e[t])return!1;return!0}function Xa(n,e){return Array.from(new Set([...Object.keys(n),...Object.keys(e)])).reduce((i,r)=>{const s=n[r],o=e[r];return S_(s)&&S_(o)?Object.assign(Object.assign({},i),{[r]:Xa(s,o)}):Object.assign(Object.assign({},i),{[r]:r in e?o:s})},{})}function Vb(n){return zb(n)?"target"in n:!1}const Zq={alreadydisposed:()=>"View has been already disposed",invalidparams:n=>"Invalid parameters for '".concat(n.name,"'"),nomatchingcontroller:n=>"No matching controller for '".concat(n.key,"'"),nomatchingview:n=>"No matching view for '".concat(JSON.stringify(n.params),"'"),notbindable:()=>"Value is not bindable",notcompatible:n=>"Not compatible with plugin '".concat(n.id,"'"),propertynotfound:n=>"Property '".concat(n.name,"' not found"),shouldneverhappen:()=>"This error should never happen"};class fn{static alreadyDisposed(){return new fn({type:"alreadydisposed"})}static notBindable(){return new fn({type:"notbindable"})}static notCompatible(e,t){return new fn({type:"notcompatible",context:{id:"".concat(e,".").concat(t)}})}static propertyNotFound(e){return new fn({type:"propertynotfound",context:{name:e}})}static shouldNeverHappen(){return new fn({type:"shouldneverhappen"})}constructor(e){var t;this.message=(t=Zq[e.type](e.context))!==null&&t!==void 0?t:"Unexpected error",this.name=this.constructor.name,this.stack=new Error(this.message).stack,this.type=e.type}toString(){return this.message}}class jp{constructor(e,t){this.obj_=e,this.key=t}static isBindable(e){return!(e===null||typeof e!="object"&&typeof e!="function")}read(){return this.obj_[this.key]}write(e){this.obj_[this.key]=e}writeProperty(e,t){const i=this.read();if(!jp.isBindable(i))throw fn.notBindable();if(!(e in i))throw fn.propertyNotFound(e);i[e]=t}}class Cn{constructor(){this.observers_={}}on(e,t){let i=this.observers_[e];return i||(i=this.observers_[e]=[]),i.push({handler:t}),this}off(e,t){const i=this.observers_[e];return i&&(this.observers_[e]=i.filter(r=>r.handler!==t)),this}emit(e,t){const i=this.observers_[e];i&&i.forEach(r=>{r.handler(t)})}}class Jq{constructor(e,t){var i;this.constraint_=t==null?void 0:t.constraint,this.equals_=(i=t==null?void 0:t.equals)!==null&&i!==void 0?i:(r,s)=>r===s,this.emitter=new Cn,this.rawValue_=e}get constraint(){return this.constraint_}get rawValue(){return this.rawValue_}set rawValue(e){this.setRawValue(e,{forceEmit:!1,last:!0})}setRawValue(e,t){const i=t!=null?t:{forceEmit:!1,last:!0},r=this.constraint_?this.constraint_.constrain(e):e,s=this.rawValue_;this.equals_(s,r)&&!i.forceEmit||(this.emitter.emit("beforechange",{sender:this}),this.rawValue_=r,this.emitter.emit("change",{options:i,previousRawValue:s,rawValue:r,sender:this}))}}class Qq{constructor(e){this.emitter=new Cn,this.value_=e}get rawValue(){return this.value_}set rawValue(e){this.setRawValue(e,{forceEmit:!1,last:!0})}setRawValue(e,t){const i=t!=null?t:{forceEmit:!1,last:!0},r=this.value_;r===e&&!i.forceEmit||(this.emitter.emit("beforechange",{sender:this}),this.value_=e,this.emitter.emit("change",{options:i,previousRawValue:r,rawValue:this.value_,sender:this}))}}class eK{constructor(e){this.emitter=new Cn,this.onValueBeforeChange_=this.onValueBeforeChange_.bind(this),this.onValueChange_=this.onValueChange_.bind(this),this.value_=e,this.value_.emitter.on("beforechange",this.onValueBeforeChange_),this.value_.emitter.on("change",this.onValueChange_)}get rawValue(){return this.value_.rawValue}onValueBeforeChange_(e){this.emitter.emit("beforechange",Object.assign(Object.assign({},e),{sender:this}))}onValueChange_(e){this.emitter.emit("change",Object.assign(Object.assign({},e),{sender:this}))}}function nn(n,e){const t=e==null?void 0:e.constraint,i=e==null?void 0:e.equals;return!t&&!i?new Qq(n):new Jq(n,e)}function tK(n){return[new eK(n),(e,t)=>{n.setRawValue(e,t)}]}class _t{constructor(e){this.emitter=new Cn,this.valMap_=e;for(const t in this.valMap_)this.valMap_[t].emitter.on("change",()=>{this.emitter.emit("change",{key:t,sender:this})})}static createCore(e){return Object.keys(e).reduce((i,r)=>Object.assign(i,{[r]:nn(e[r])}),{})}static fromObject(e){const t=this.createCore(e);return new _t(t)}get(e){return this.valMap_[e].rawValue}set(e,t){this.valMap_[e].rawValue=t}value(e){return this.valMap_[e]}}class gd{constructor(e){this.values=_t.fromObject({max:e.max,min:e.min})}constrain(e){const t=this.values.get("max"),i=this.values.get("min");return Math.min(Math.max(e,i),t)}}class nK{constructor(e){this.values=_t.fromObject({max:e.max,min:e.min})}constrain(e){const t=this.values.get("max"),i=this.values.get("min");let r=e;return Gt(i)||(r=Math.max(r,i)),Gt(t)||(r=Math.min(r,t)),r}}class iK{constructor(e,t=0){this.step=e,this.origin=t}constrain(e){const t=this.origin%this.step,i=Math.round((e-t)/this.step);return t+i*this.step}}class rK{constructor(e){this.text=e}evaluate(){return Number(this.text)}toString(){return this.text}}const sK={"**":(n,e)=>Math.pow(n,e),"*":(n,e)=>n*e,"/":(n,e)=>n/e,"%":(n,e)=>n%e,"+":(n,e)=>n+e,"-":(n,e)=>n-e,"<<":(n,e)=>n<<e,">>":(n,e)=>n>>e,">>>":(n,e)=>n>>>e,"&":(n,e)=>n&e,"^":(n,e)=>n^e,"|":(n,e)=>n|e};class oK{constructor(e,t,i){this.left=t,this.operator=e,this.right=i}evaluate(){const e=sK[this.operator];if(!e)throw new Error("unexpected binary operator: '".concat(this.operator));return e(this.left.evaluate(),this.right.evaluate())}toString(){return["b(",this.left.toString(),this.operator,this.right.toString(),")"].join(" ")}}const aK={"+":n=>n,"-":n=>-n,"~":n=>~n};class lK{constructor(e,t){this.operator=e,this.expression=t}evaluate(){const e=aK[this.operator];if(!e)throw new Error("unexpected unary operator: '".concat(this.operator));return e(this.expression.evaluate())}toString(){return["u(",this.operator,this.expression.toString(),")"].join(" ")}}function Hb(n){return(e,t)=>{for(let i=0;i<n.length;i++){const r=n[i](e,t);if(r!=="")return r}return""}}function Kh(n,e){var t;const i=n.substr(e).match(/^\s+/);return(t=i&&i[0])!==null&&t!==void 0?t:""}function cK(n,e){const t=n.substr(e,1);return t.match(/^[1-9]$/)?t:""}function Zh(n,e){var t;const i=n.substr(e).match(/^[0-9]+/);return(t=i&&i[0])!==null&&t!==void 0?t:""}function uK(n,e){const t=Zh(n,e);if(t!=="")return t;const i=n.substr(e,1);if(e+=1,i!=="-"&&i!=="+")return"";const r=Zh(n,e);return r===""?"":i+r}function Gb(n,e){const t=n.substr(e,1);if(e+=1,t.toLowerCase()!=="e")return"";const i=uK(n,e);return i===""?"":t+i}function j3(n,e){const t=n.substr(e,1);if(t==="0")return t;const i=cK(n,e);return e+=i.length,i===""?"":i+Zh(n,e)}function hK(n,e){const t=j3(n,e);if(e+=t.length,t==="")return"";const i=n.substr(e,1);if(e+=i.length,i!==".")return"";const r=Zh(n,e);return e+=r.length,t+i+r+Gb(n,e)}function dK(n,e){const t=n.substr(e,1);if(e+=t.length,t!==".")return"";const i=Zh(n,e);return e+=i.length,i===""?"":t+i+Gb(n,e)}function fK(n,e){const t=j3(n,e);return e+=t.length,t===""?"":t+Gb(n,e)}const pK=Hb([hK,dK,fK]);function mK(n,e){var t;const i=n.substr(e).match(/^[01]+/);return(t=i&&i[0])!==null&&t!==void 0?t:""}function gK(n,e){const t=n.substr(e,2);if(e+=t.length,t.toLowerCase()!=="0b")return"";const i=mK(n,e);return i===""?"":t+i}function vK(n,e){var t;const i=n.substr(e).match(/^[0-7]+/);return(t=i&&i[0])!==null&&t!==void 0?t:""}function _K(n,e){const t=n.substr(e,2);if(e+=t.length,t.toLowerCase()!=="0o")return"";const i=vK(n,e);return i===""?"":t+i}function yK(n,e){var t;const i=n.substr(e).match(/^[0-9a-f]+/i);return(t=i&&i[0])!==null&&t!==void 0?t:""}function bK(n,e){const t=n.substr(e,2);if(e+=t.length,t.toLowerCase()!=="0x")return"";const i=yK(n,e);return i===""?"":t+i}const xK=Hb([gK,_K,bK]),wK=Hb([xK,pK]);function SK(n,e){const t=wK(n,e);return e+=t.length,t===""?null:{evaluable:new rK(t),cursor:e}}function MK(n,e){const t=n.substr(e,1);if(e+=t.length,t!=="(")return null;const i=Y3(n,e);if(!i)return null;e=i.cursor,e+=Kh(n,e).length;const r=n.substr(e,1);return e+=r.length,r!==")"?null:{evaluable:i.evaluable,cursor:e}}function EK(n,e){var t;return(t=SK(n,e))!==null&&t!==void 0?t:MK(n,e)}function X3(n,e){const t=EK(n,e);if(t)return t;const i=n.substr(e,1);if(e+=i.length,i!=="+"&&i!=="-"&&i!=="~")return null;const r=X3(n,e);return r?(e=r.cursor,{cursor:e,evaluable:new lK(i,r.evaluable)}):null}function TK(n,e,t){t+=Kh(e,t).length;const i=n.filter(r=>e.startsWith(r,t))[0];return i?(t+=i.length,t+=Kh(e,t).length,{cursor:t,operator:i}):null}function AK(n,e){return(t,i)=>{const r=n(t,i);if(!r)return null;i=r.cursor;let s=r.evaluable;for(;;){const o=TK(e,t,i);if(!o)break;i=o.cursor;const a=n(t,i);if(!a)return null;i=a.cursor,s=new oK(o.operator,s,a.evaluable)}return s?{cursor:i,evaluable:s}:null}}const CK=[["**"],["*","/","%"],["+","-"],["<<",">>>",">>"],["&"],["^"],["|"]].reduce((n,e)=>AK(n,e),X3);function Y3(n,e){return e+=Kh(n,e).length,CK(n,e)}function PK(n){const e=Y3(n,0);return!e||e.cursor+Kh(n,e.cursor).length!==n.length?null:e.evaluable}function ks(n){var e;const t=PK(n);return(e=t==null?void 0:t.evaluate())!==null&&e!==void 0?e:null}function q3(n){if(typeof n=="number")return n;if(typeof n=="string"){const e=ks(n);if(!Gt(e))return e}return 0}function RK(n){return String(n)}function Ai(n){return e=>e.toFixed(Math.max(Math.min(n,20),0))}function Ot(n,e,t,i,r){const s=(n-e)/(t-e);return i+s*(r-i)}function lE(n){return String(n.toFixed(10)).split(".")[1].replace(/0+$/,"").length}function Ln(n,e,t){return Math.min(Math.max(n,e),t)}function K3(n,e){return(n%e+e)%e}function LK(n,e){return Gt(n.step)?Math.max(lE(e),2):lE(n.step)}function Z3(n){var e;return(e=n.step)!==null&&e!==void 0?e:1}function J3(n,e){var t;const i=Math.abs((t=n.step)!==null&&t!==void 0?t:e);return i===0?.1:Math.pow(10,Math.floor(Math.log10(i))-1)}function Q3(n,e){return Gt(n.step)?null:new iK(n.step,e)}function eR(n){return!Gt(n.max)&&!Gt(n.min)?new gd({max:n.max,min:n.min}):!Gt(n.max)||!Gt(n.min)?new nK({max:n.max,min:n.min}):null}function tR(n,e){var t,i,r;return{formatter:(t=n.format)!==null&&t!==void 0?t:Ai(LK(n,e)),keyScale:(i=n.keyScale)!==null&&i!==void 0?i:Z3(n),pointerScale:(r=n.pointerScale)!==null&&r!==void 0?r:J3(n,e)}}function nR(n){return{format:n.optional.function,keyScale:n.optional.number,max:n.optional.number,min:n.optional.number,pointerScale:n.optional.number,step:n.optional.number}}function Wb(n){return{constraint:n.constraint,textProps:_t.fromObject(tR(n.params,n.initialValue))}}class ul{constructor(e){this.controller=e}get element(){return this.controller.view.element}get disabled(){return this.controller.viewProps.get("disabled")}set disabled(e){this.controller.viewProps.set("disabled",e)}get hidden(){return this.controller.viewProps.get("hidden")}set hidden(e){this.controller.viewProps.set("hidden",e)}dispose(){this.controller.viewProps.set("disposed",!0)}importState(e){return this.controller.importState(e)}exportState(){return this.controller.exportState()}}class hg{constructor(e){this.target=e}}class vd extends hg{constructor(e,t,i){super(e),this.value=t,this.last=i!=null?i:!0}}class OK extends hg{constructor(e,t){super(e),this.expanded=t}}class IK extends hg{constructor(e,t){super(e),this.index=t}}class Jh extends ul{constructor(e){super(e),this.onValueChange_=this.onValueChange_.bind(this),this.emitter_=new Cn,this.controller.value.emitter.on("change",this.onValueChange_)}get label(){return this.controller.labelController.props.get("label")}set label(e){this.controller.labelController.props.set("label",e)}get key(){return this.controller.value.binding.target.key}get tag(){return this.controller.tag}set tag(e){this.controller.tag=e}on(e,t){const i=t.bind(this);return this.emitter_.on(e,r=>{i(r)}),this}refresh(){this.controller.value.fetch()}onValueChange_(e){const t=this.controller.value;this.emitter_.emit("change",new vd(this,t.binding.target.read(),e.options.last))}}class DK{constructor(e,t){this.onValueBeforeChange_=this.onValueBeforeChange_.bind(this),this.onValueChange_=this.onValueChange_.bind(this),this.binding=t,this.value_=e,this.value_.emitter.on("beforechange",this.onValueBeforeChange_),this.value_.emitter.on("change",this.onValueChange_),this.emitter=new Cn}get rawValue(){return this.value_.rawValue}set rawValue(e){this.value_.rawValue=e}setRawValue(e,t){this.value_.setRawValue(e,t)}fetch(){this.value_.rawValue=this.binding.read()}push(){this.binding.write(this.value_.rawValue)}onValueBeforeChange_(e){this.emitter.emit("beforechange",Object.assign(Object.assign({},e),{sender:this}))}onValueChange_(e){this.push(),this.emitter.emit("change",Object.assign(Object.assign({},e),{sender:this}))}}function UK(n){if(!("binding"in n))return!1;const e=n.binding;return Vb(e)&&"read"in e&&"write"in e}function NK(n,e){const i=Object.keys(e).reduce((r,s)=>{if(r===void 0)return;const o=e[s],a=o(n[s]);return a.succeeded?Object.assign(Object.assign({},r),{[s]:a.value}):void 0},{});return i}function FK(n,e){return n.reduce((t,i)=>{if(t===void 0)return;const r=e(i);if(!(!r.succeeded||r.value===void 0))return[...t,r.value]},[])}function kK(n){return n===null?!1:typeof n=="object"}function ys(n){return e=>t=>{if(!e&&t===void 0)return{succeeded:!1,value:void 0};if(e&&t===void 0)return{succeeded:!0,value:void 0};const i=n(t);return i!==void 0?{succeeded:!0,value:i}:{succeeded:!1,value:void 0}}}function cE(n){return{custom:e=>ys(e)(n),boolean:ys(e=>typeof e=="boolean"?e:void 0)(n),number:ys(e=>typeof e=="number"?e:void 0)(n),string:ys(e=>typeof e=="string"?e:void 0)(n),function:ys(e=>typeof e=="function"?e:void 0)(n),constant:e=>ys(t=>t===e?e:void 0)(n),raw:ys(e=>e)(n),object:e=>ys(t=>{if(kK(t))return NK(t,e)})(n),array:e=>ys(t=>{if(Array.isArray(t))return FK(t,e)})(n)}}const M_={optional:cE(!0),required:cE(!1)};function on(n,e){const t=e(M_),i=M_.required.object(t)(n);return i.succeeded?i.value:void 0}function Wi(n,e,t,i){if(e&&!e(n))return!1;const r=on(n,t);return r?i(r):!1}function $i(n,e){var t;return Xa((t=n==null?void 0:n())!==null&&t!==void 0?t:{},e)}function Ia(n){return"value"in n}function iR(n){if(!zb(n)||!("binding"in n))return!1;const e=n.binding;return Vb(e)}const qr="http://www.w3.org/2000/svg";function Xp(n){n.offsetHeight}function BK(n,e){const t=n.style.transition;n.style.transition="none",e(),n.style.transition=t}function $b(n){return n.ontouchstart!==void 0}function zK(){return globalThis}function VK(){return zK().document}function HK(n){const e=n.ownerDocument.defaultView;return e&&"document"in e?n.getContext("2d",{willReadFrequently:!0}):null}const GK={check:'<path d="M2 8l4 4l8 -8"/>',dropdown:'<path d="M5 7h6l-3 3 z"/>',p2dpad:'<path d="M8 4v8"/><path d="M4 8h8"/><circle cx="12" cy="12" r="1.2"/>'};function dg(n,e){const t=n.createElementNS(qr,"svg");return t.innerHTML=GK[e],t}function rR(n,e,t){n.insertBefore(e,n.children[t])}function jb(n){n.parentElement&&n.parentElement.removeChild(n)}function sR(n){for(;n.children.length>0;)n.removeChild(n.children[0])}function WK(n){for(;n.childNodes.length>0;)n.removeChild(n.childNodes[0])}function oR(n){return n.relatedTarget?n.relatedTarget:"explicitOriginalTarget"in n?n.explicitOriginalTarget:null}function Ls(n,e){n.emitter.on("change",t=>{e(t.rawValue)}),e(n.rawValue)}function as(n,e,t){Ls(n.value(e),t)}const $K="tp";function Ct(n){return(t,i)=>[$K,"-",n,"v",t?"_".concat(t):"",i?"-".concat(i):""].join("")}const Su=Ct("lbl");function jK(n,e){const t=n.createDocumentFragment();return e.split("\n").map(r=>n.createTextNode(r)).forEach((r,s)=>{s>0&&t.appendChild(n.createElement("br")),t.appendChild(r)}),t}class aR{constructor(e,t){this.element=e.createElement("div"),this.element.classList.add(Su()),t.viewProps.bindClassModifiers(this.element);const i=e.createElement("div");i.classList.add(Su("l")),as(t.props,"label",s=>{Gt(s)?this.element.classList.add(Su(void 0,"nol")):(this.element.classList.remove(Su(void 0,"nol")),WK(i),i.appendChild(jK(e,s)))}),this.element.appendChild(i),this.labelElement=i;const r=e.createElement("div");r.classList.add(Su("v")),this.element.appendChild(r),this.valueElement=r}}class lR{constructor(e,t){this.props=t.props,this.valueController=t.valueController,this.viewProps=t.valueController.viewProps,this.view=new aR(e,{props:t.props,viewProps:this.viewProps}),this.view.valueElement.appendChild(this.valueController.view.element)}importProps(e){return Wi(e,null,t=>({label:t.optional.string}),t=>(this.props.set("label",t.label),!0))}exportProps(){return $i(null,{label:this.props.get("label")})}}function XK(){return["veryfirst","first","last","verylast"]}const uE=Ct(""),hE={veryfirst:"vfst",first:"fst",last:"lst",verylast:"vlst"};class fg{constructor(e){this.parent_=null,this.blade=e.blade,this.view=e.view,this.viewProps=e.viewProps;const t=this.view.element;this.blade.value("positions").emitter.on("change",()=>{XK().forEach(i=>{t.classList.remove(uE(void 0,hE[i]))}),this.blade.get("positions").forEach(i=>{t.classList.add(uE(void 0,hE[i]))})}),this.viewProps.handleDispose(()=>{jb(t)})}get parent(){return this.parent_}set parent(e){this.parent_=e,this.viewProps.set("parent",this.parent_?this.parent_.viewProps:null)}importState(e){return Wi(e,null,t=>({disabled:t.required.boolean,hidden:t.required.boolean}),t=>(this.viewProps.importState(t),!0))}exportState(){return $i(null,Object.assign({},this.viewProps.exportState()))}}class Ya extends fg{constructor(e,t){if(t.value!==t.valueController.value)throw fn.shouldNeverHappen();const i=t.valueController.viewProps,r=new lR(e,{blade:t.blade,props:t.props,valueController:t.valueController});super(Object.assign(Object.assign({},t),{view:new aR(e,{props:t.props,viewProps:i}),viewProps:i})),this.labelController=r,this.value=t.value,this.valueController=t.valueController,this.view.valueElement.appendChild(this.valueController.view.element)}importState(e){return Wi(e,t=>{var i,r,s;return super.importState(t)&&this.labelController.importProps(t)&&((s=(r=(i=this.valueController).importProps)===null||r===void 0?void 0:r.call(i,e))!==null&&s!==void 0?s:!0)},t=>({value:t.optional.raw}),t=>(t.value&&(this.value.rawValue=t.value),!0))}exportState(){var e,t,i;return $i(()=>super.exportState(),Object.assign(Object.assign({value:this.value.rawValue},this.labelController.exportProps()),(i=(t=(e=this.valueController).exportProps)===null||t===void 0?void 0:t.call(e))!==null&&i!==void 0?i:{}))}}function dE(n){const e=Object.assign({},n);return delete e.value,e}class cR extends Ya{constructor(e,t){super(e,t),this.tag=t.tag}importState(e){return Wi(e,t=>super.importState(dE(e)),t=>({tag:t.optional.string}),t=>(this.tag=t.tag,!0))}exportState(){return $i(()=>dE(super.exportState()),{binding:{key:this.value.binding.target.key,value:this.value.binding.target.read()},tag:this.tag})}}function YK(n){return Ia(n)&&iR(n.value)}class qK extends cR{importState(e){return Wi(e,t=>super.importState(t),t=>({binding:t.required.object({value:t.required.raw})}),t=>(this.value.binding.inject(t.binding.value),this.value.fetch(),!0))}}function KK(n){return Ia(n)&&UK(n.value)}function uR(n,e){for(;n.length<e;)n.push(void 0)}function ZK(n){const e=[];return uR(e,n),e}function JK(n){const e=n.indexOf(void 0);return e<0?n:n.slice(0,e)}function QK(n,e){const t=[...JK(n),e];return t.length>n.length?t.splice(0,t.length-n.length):uR(t,n.length),t}class eZ{constructor(e){this.emitter=new Cn,this.onTick_=this.onTick_.bind(this),this.onValueBeforeChange_=this.onValueBeforeChange_.bind(this),this.onValueChange_=this.onValueChange_.bind(this),this.binding=e.binding,this.value_=nn(ZK(e.bufferSize)),this.value_.emitter.on("beforechange",this.onValueBeforeChange_),this.value_.emitter.on("change",this.onValueChange_),this.ticker=e.ticker,this.ticker.emitter.on("tick",this.onTick_),this.fetch()}get rawValue(){return this.value_.rawValue}set rawValue(e){this.value_.rawValue=e}setRawValue(e,t){this.value_.setRawValue(e,t)}fetch(){this.value_.rawValue=QK(this.value_.rawValue,this.binding.read())}onTick_(){this.fetch()}onValueBeforeChange_(e){this.emitter.emit("beforechange",Object.assign(Object.assign({},e),{sender:this}))}onValueChange_(e){this.emitter.emit("change",Object.assign(Object.assign({},e),{sender:this}))}}function tZ(n){if(!("binding"in n))return!1;const e=n.binding;return Vb(e)&&"read"in e&&!("write"in e)}class nZ extends cR{exportState(){return $i(()=>super.exportState(),{binding:{readonly:!0}})}}function iZ(n){return Ia(n)&&tZ(n.value)}class rZ extends ul{get label(){return this.controller.labelController.props.get("label")}set label(e){this.controller.labelController.props.set("label",e)}get title(){var e;return(e=this.controller.buttonController.props.get("title"))!==null&&e!==void 0?e:""}set title(e){this.controller.buttonController.props.set("title",e)}on(e,t){const i=t.bind(this);return this.controller.buttonController.emitter.on(e,()=>{i(new hg(this))}),this}}function sZ(n,e,t){t?n.classList.add(e):n.classList.remove(e)}function qc(n,e){return t=>{sZ(n,e,t)}}function Xb(n,e){Ls(n,t=>{e.textContent=t!=null?t:""})}const Mv=Ct("btn");class oZ{constructor(e,t){this.element=e.createElement("div"),this.element.classList.add(Mv()),t.viewProps.bindClassModifiers(this.element);const i=e.createElement("button");i.classList.add(Mv("b")),t.viewProps.bindDisabled(i),this.element.appendChild(i),this.buttonElement=i;const r=e.createElement("div");r.classList.add(Mv("t")),Xb(t.props.value("title"),r),this.buttonElement.appendChild(r)}}class aZ{constructor(e,t){this.emitter=new Cn,this.onClick_=this.onClick_.bind(this),this.props=t.props,this.viewProps=t.viewProps,this.view=new oZ(e,{props:this.props,viewProps:this.viewProps}),this.view.buttonElement.addEventListener("click",this.onClick_)}importProps(e){return Wi(e,null,t=>({title:t.optional.string}),t=>(this.props.set("title",t.title),!0))}exportProps(){return $i(null,{title:this.props.get("title")})}onClick_(){this.emitter.emit("click",{sender:this})}}class fE extends fg{constructor(e,t){const i=new aZ(e,{props:t.buttonProps,viewProps:t.viewProps}),r=new lR(e,{blade:t.blade,props:t.labelProps,valueController:i});super({blade:t.blade,view:r.view,viewProps:t.viewProps}),this.buttonController=i,this.labelController=r}importState(e){return Wi(e,t=>super.importState(t)&&this.buttonController.importProps(t)&&this.labelController.importProps(t),()=>({}),()=>!0)}exportState(){return $i(()=>super.exportState(),Object.assign(Object.assign({},this.buttonController.exportProps()),this.labelController.exportProps()))}}class hR{constructor(e){const[t,i]=e.split("-"),r=t.split(".");this.major=parseInt(r[0],10),this.minor=parseInt(r[1],10),this.patch=parseInt(r[2],10),this.prerelease=i!=null?i:null}toString(){const e=[this.major,this.minor,this.patch].join(".");return this.prerelease!==null?[e,this.prerelease].join("-"):e}}const Kc=new hR("2.0.1");function fi(n){return Object.assign({core:Kc},n)}const lZ=fi({id:"button",type:"blade",accept(n){const e=on(n,t=>({title:t.required.string,view:t.required.constant("button"),label:t.optional.string}));return e?{params:e}:null},controller(n){return new fE(n.document,{blade:n.blade,buttonProps:_t.fromObject({title:n.params.title}),labelProps:_t.fromObject({label:n.params.label}),viewProps:n.viewProps})},api(n){return n.controller instanceof fE?new rZ(n.controller):null}});function cZ(n,e){return n.addBlade(Object.assign(Object.assign({},e),{view:"button"}))}function uZ(n,e){return n.addBlade(Object.assign(Object.assign({},e),{view:"folder"}))}function hZ(n,e){return n.addBlade(Object.assign(Object.assign({},e),{view:"tab"}))}function dZ(n){return zb(n)?"refresh"in n&&typeof n.refresh=="function":!1}function fZ(n,e){if(!jp.isBindable(n))throw fn.notBindable();return new jp(n,e)}class pZ{constructor(e,t){this.onRackValueChange_=this.onRackValueChange_.bind(this),this.controller_=e,this.emitter_=new Cn,this.pool_=t,this.controller_.rack.emitter.on("valuechange",this.onRackValueChange_)}get children(){return this.controller_.rack.children.map(e=>this.pool_.createApi(e))}addBinding(e,t,i){const r=i!=null?i:{},s=this.controller_.element.ownerDocument,o=this.pool_.createBinding(s,fZ(e,t),r),a=this.pool_.createBindingApi(o);return this.add(a,r.index)}addFolder(e){return uZ(this,e)}addButton(e){return cZ(this,e)}addTab(e){return hZ(this,e)}add(e,t){const i=e.controller;return this.controller_.rack.add(i,t),e}remove(e){this.controller_.rack.remove(e.controller)}addBlade(e){const t=this.controller_.element.ownerDocument,i=this.pool_.createBlade(t,e),r=this.pool_.createApi(i);return this.add(r,e.index)}on(e,t){const i=t.bind(this);return this.emitter_.on(e,r=>{i(r)}),this}refresh(){this.children.forEach(e=>{dZ(e)&&e.refresh()})}onRackValueChange_(e){const t=e.bladeController,i=this.pool_.createApi(t),r=iR(t.value)?t.value.binding:null;this.emitter_.emit("change",new vd(i,r?r.target.read():t.value.rawValue,e.options.last))}}class Yb extends ul{constructor(e,t){super(e),this.rackApi_=new pZ(e.rackController,t)}refresh(){this.rackApi_.refresh()}}class qb extends fg{constructor(e){super({blade:e.blade,view:e.view,viewProps:e.rackController.viewProps}),this.rackController=e.rackController}importState(e){return Wi(e,t=>super.importState(t),t=>({children:t.required.array(t.required.raw)}),t=>this.rackController.rack.children.every((i,r)=>i.importState(t.children[r])))}exportState(){return $i(()=>super.exportState(),{children:this.rackController.rack.children.map(e=>e.exportState())})}}function E_(n){return"rackController"in n}class mZ{constructor(e){this.emitter=new Cn,this.items_=[],this.cache_=new Set,this.onSubListAdd_=this.onSubListAdd_.bind(this),this.onSubListRemove_=this.onSubListRemove_.bind(this),this.extract_=e}get items(){return this.items_}allItems(){return Array.from(this.cache_)}find(e){for(const t of this.allItems())if(e(t))return t;return null}includes(e){return this.cache_.has(e)}add(e,t){if(this.includes(e))throw fn.shouldNeverHappen();const i=t!==void 0?t:this.items_.length;this.items_.splice(i,0,e),this.cache_.add(e);const r=this.extract_(e);r&&(r.emitter.on("add",this.onSubListAdd_),r.emitter.on("remove",this.onSubListRemove_),r.allItems().forEach(s=>{this.cache_.add(s)})),this.emitter.emit("add",{index:i,item:e,root:this,target:this})}remove(e){const t=this.items_.indexOf(e);if(t<0)return;this.items_.splice(t,1),this.cache_.delete(e);const i=this.extract_(e);i&&(i.allItems().forEach(r=>{this.cache_.delete(r)}),i.emitter.off("add",this.onSubListAdd_),i.emitter.off("remove",this.onSubListRemove_)),this.emitter.emit("remove",{index:t,item:e,root:this,target:this})}onSubListAdd_(e){this.cache_.add(e.item),this.emitter.emit("add",{index:e.index,item:e.item,root:this,target:e.target})}onSubListRemove_(e){this.cache_.delete(e.item),this.emitter.emit("remove",{index:e.index,item:e.item,root:this,target:e.target})}}function gZ(n,e){for(let t=0;t<n.length;t++){const i=n[t];if(Ia(i)&&i.value===e)return i}return null}function vZ(n){return E_(n)?n.rackController.rack.bcSet_:null}class _Z{constructor(e){var t,i;this.emitter=new Cn,this.onBladePositionsChange_=this.onBladePositionsChange_.bind(this),this.onSetAdd_=this.onSetAdd_.bind(this),this.onSetRemove_=this.onSetRemove_.bind(this),this.onChildDispose_=this.onChildDispose_.bind(this),this.onChildPositionsChange_=this.onChildPositionsChange_.bind(this),this.onChildValueChange_=this.onChildValueChange_.bind(this),this.onChildViewPropsChange_=this.onChildViewPropsChange_.bind(this),this.onRackLayout_=this.onRackLayout_.bind(this),this.onRackValueChange_=this.onRackValueChange_.bind(this),this.blade_=(t=e.blade)!==null&&t!==void 0?t:null,(i=this.blade_)===null||i===void 0||i.value("positions").emitter.on("change",this.onBladePositionsChange_),this.viewProps=e.viewProps,this.bcSet_=new mZ(vZ),this.bcSet_.emitter.on("add",this.onSetAdd_),this.bcSet_.emitter.on("remove",this.onSetRemove_)}get children(){return this.bcSet_.items}add(e,t){var i;(i=e.parent)===null||i===void 0||i.remove(e),e.parent=this,this.bcSet_.add(e,t)}remove(e){e.parent=null,this.bcSet_.remove(e)}find(e){return this.bcSet_.allItems().filter(e)}onSetAdd_(e){this.updatePositions_();const t=e.target===e.root;if(this.emitter.emit("add",{bladeController:e.item,index:e.index,root:t,sender:this}),!t)return;const i=e.item;if(i.viewProps.emitter.on("change",this.onChildViewPropsChange_),i.blade.value("positions").emitter.on("change",this.onChildPositionsChange_),i.viewProps.handleDispose(this.onChildDispose_),Ia(i))i.value.emitter.on("change",this.onChildValueChange_);else if(E_(i)){const r=i.rackController.rack;if(r){const s=r.emitter;s.on("layout",this.onRackLayout_),s.on("valuechange",this.onRackValueChange_)}}}onSetRemove_(e){this.updatePositions_();const t=e.target===e.root;if(this.emitter.emit("remove",{bladeController:e.item,root:t,sender:this}),!t)return;const i=e.item;if(Ia(i))i.value.emitter.off("change",this.onChildValueChange_);else if(E_(i)){const r=i.rackController.rack;if(r){const s=r.emitter;s.off("layout",this.onRackLayout_),s.off("valuechange",this.onRackValueChange_)}}}updatePositions_(){const e=this.bcSet_.items.filter(r=>!r.viewProps.get("hidden")),t=e[0],i=e[e.length-1];this.bcSet_.items.forEach(r=>{const s=[];r===t&&(s.push("first"),(!this.blade_||this.blade_.get("positions").includes("veryfirst"))&&s.push("veryfirst")),r===i&&(s.push("last"),(!this.blade_||this.blade_.get("positions").includes("verylast"))&&s.push("verylast")),r.blade.set("positions",s)})}onChildPositionsChange_(){this.updatePositions_(),this.emitter.emit("layout",{sender:this})}onChildViewPropsChange_(e){this.updatePositions_(),this.emitter.emit("layout",{sender:this})}onChildDispose_(){this.bcSet_.items.filter(t=>t.viewProps.get("disposed")).forEach(t=>{this.bcSet_.remove(t)})}onChildValueChange_(e){const t=gZ(this.find(Ia),e.sender);if(!t)throw fn.alreadyDisposed();this.emitter.emit("valuechange",{bladeController:t,options:e.options,sender:this})}onRackLayout_(e){this.updatePositions_(),this.emitter.emit("layout",{sender:this})}onRackValueChange_(e){this.emitter.emit("valuechange",{bladeController:e.bladeController,options:e.options,sender:this})}onBladePositionsChange_(){this.updatePositions_()}}class Kb{constructor(e){this.onRackAdd_=this.onRackAdd_.bind(this),this.onRackRemove_=this.onRackRemove_.bind(this),this.element=e.element,this.viewProps=e.viewProps;const t=new _Z({blade:e.root?void 0:e.blade,viewProps:e.viewProps});t.emitter.on("add",this.onRackAdd_),t.emitter.on("remove",this.onRackRemove_),this.rack=t,this.viewProps.handleDispose(()=>{for(let i=this.rack.children.length-1;i>=0;i--)this.rack.children[i].viewProps.set("disposed",!0)})}onRackAdd_(e){e.root&&rR(this.element,e.bladeController.view.element,e.index)}onRackRemove_(e){e.root&&jb(e.bladeController.view.element)}}function Zc(){return new _t({positions:nn([],{equals:Kq})})}class _d extends _t{constructor(e){super(e)}static create(e){const t={completed:!0,expanded:e,expandedHeight:null,shouldFixHeight:!1,temporaryExpanded:null},i=_t.createCore(t);return new _d(i)}get styleExpanded(){var e;return(e=this.get("temporaryExpanded"))!==null&&e!==void 0?e:this.get("expanded")}get styleHeight(){if(!this.styleExpanded)return"0";const e=this.get("expandedHeight");return this.get("shouldFixHeight")&&!Gt(e)?"".concat(e,"px"):"auto"}bindExpandedClass(e,t){const i=()=>{this.styleExpanded?e.classList.add(t):e.classList.remove(t)};as(this,"expanded",i),as(this,"temporaryExpanded",i)}cleanUpTransition(){this.set("shouldFixHeight",!1),this.set("expandedHeight",null),this.set("completed",!0)}}function yZ(n,e){let t=0;return BK(e,()=>{n.set("expandedHeight",null),n.set("temporaryExpanded",!0),Xp(e),t=e.clientHeight,n.set("temporaryExpanded",null),Xp(e)}),t}function pE(n,e){e.style.height=n.styleHeight}function Zb(n,e){n.value("expanded").emitter.on("beforechange",()=>{if(n.set("completed",!1),Gt(n.get("expandedHeight"))){const t=yZ(n,e);t>0&&n.set("expandedHeight",t)}n.set("shouldFixHeight",!0),Xp(e)}),n.emitter.on("change",()=>{pE(n,e)}),pE(n,e),e.addEventListener("transitionend",t=>{t.propertyName==="height"&&n.cleanUpTransition()})}class dR extends Yb{constructor(e,t){super(e,t),this.emitter_=new Cn,this.controller.foldable.value("expanded").emitter.on("change",i=>{this.emitter_.emit("fold",new OK(this,i.sender.rawValue))}),this.rackApi_.on("change",i=>{this.emitter_.emit("change",i)})}get expanded(){return this.controller.foldable.get("expanded")}set expanded(e){this.controller.foldable.set("expanded",e)}get title(){return this.controller.props.get("title")}set title(e){this.controller.props.set("title",e)}get children(){return this.rackApi_.children}addBinding(e,t,i){return this.rackApi_.addBinding(e,t,i)}addFolder(e){return this.rackApi_.addFolder(e)}addButton(e){return this.rackApi_.addButton(e)}addTab(e){return this.rackApi_.addTab(e)}add(e,t){return this.rackApi_.add(e,t)}remove(e){this.rackApi_.remove(e)}addBlade(e){return this.rackApi_.addBlade(e)}on(e,t){const i=t.bind(this);return this.emitter_.on(e,r=>{i(r)}),this}}const fR=Ct("cnt");class bZ{constructor(e,t){var i;this.className_=Ct((i=t.viewName)!==null&&i!==void 0?i:"fld"),this.element=e.createElement("div"),this.element.classList.add(this.className_(),fR()),t.viewProps.bindClassModifiers(this.element),this.foldable_=t.foldable,this.foldable_.bindExpandedClass(this.element,this.className_(void 0,"expanded")),as(this.foldable_,"completed",qc(this.element,this.className_(void 0,"cpl")));const r=e.createElement("button");r.classList.add(this.className_("b")),as(t.props,"title",c=>{Gt(c)?this.element.classList.add(this.className_(void 0,"not")):this.element.classList.remove(this.className_(void 0,"not"))}),t.viewProps.bindDisabled(r),this.element.appendChild(r),this.buttonElement=r;const s=e.createElement("div");s.classList.add(this.className_("i")),this.element.appendChild(s);const o=e.createElement("div");o.classList.add(this.className_("t")),Xb(t.props.value("title"),o),this.buttonElement.appendChild(o),this.titleElement=o;const a=e.createElement("div");a.classList.add(this.className_("m")),this.buttonElement.appendChild(a);const l=e.createElement("div");l.classList.add(this.className_("c")),this.element.appendChild(l),this.containerElement=l}}class T_ extends qb{constructor(e,t){var i;const r=_d.create((i=t.expanded)!==null&&i!==void 0?i:!0),s=new bZ(e,{foldable:r,props:t.props,viewName:t.root?"rot":void 0,viewProps:t.viewProps});super(Object.assign(Object.assign({},t),{rackController:new Kb({blade:t.blade,element:s.containerElement,root:t.root,viewProps:t.viewProps}),view:s})),this.onTitleClick_=this.onTitleClick_.bind(this),this.props=t.props,this.foldable=r,Zb(this.foldable,this.view.containerElement),this.rackController.rack.emitter.on("add",()=>{this.foldable.cleanUpTransition()}),this.rackController.rack.emitter.on("remove",()=>{this.foldable.cleanUpTransition()}),this.view.buttonElement.addEventListener("click",this.onTitleClick_)}get document(){return this.view.element.ownerDocument}importState(e){return Wi(e,t=>super.importState(t),t=>({expanded:t.required.boolean,title:t.optional.string}),t=>(this.foldable.set("expanded",t.expanded),this.props.set("title",t.title),!0))}exportState(){return $i(()=>super.exportState(),{expanded:this.foldable.get("expanded"),title:this.props.get("title")})}onTitleClick_(){this.foldable.set("expanded",!this.foldable.get("expanded"))}}const xZ=fi({id:"folder",type:"blade",accept(n){const e=on(n,t=>({title:t.required.string,view:t.required.constant("folder"),expanded:t.optional.boolean}));return e?{params:e}:null},controller(n){return new T_(n.document,{blade:n.blade,expanded:n.params.expanded,props:_t.fromObject({title:n.params.title}),viewProps:n.viewProps})},api(n){return n.controller instanceof T_?new dR(n.controller,n.pool):null}}),wZ=Ct("");function mE(n,e){return qc(n,wZ(void 0,e))}class Ws extends _t{constructor(e){var t;super(e),this.onDisabledChange_=this.onDisabledChange_.bind(this),this.onParentChange_=this.onParentChange_.bind(this),this.onParentGlobalDisabledChange_=this.onParentGlobalDisabledChange_.bind(this),[this.globalDisabled_,this.setGlobalDisabled_]=tK(nn(this.getGlobalDisabled_())),this.value("disabled").emitter.on("change",this.onDisabledChange_),this.value("parent").emitter.on("change",this.onParentChange_),(t=this.get("parent"))===null||t===void 0||t.globalDisabled.emitter.on("change",this.onParentGlobalDisabledChange_)}static create(e){var t,i,r;const s=e!=null?e:{};return new Ws(_t.createCore({disabled:(t=s.disabled)!==null&&t!==void 0?t:!1,disposed:!1,hidden:(i=s.hidden)!==null&&i!==void 0?i:!1,parent:(r=s.parent)!==null&&r!==void 0?r:null}))}get globalDisabled(){return this.globalDisabled_}bindClassModifiers(e){Ls(this.globalDisabled_,mE(e,"disabled")),as(this,"hidden",mE(e,"hidden"))}bindDisabled(e){Ls(this.globalDisabled_,t=>{e.disabled=t})}bindTabIndex(e){Ls(this.globalDisabled_,t=>{e.tabIndex=t?-1:0})}handleDispose(e){this.value("disposed").emitter.on("change",t=>{t&&e()})}importState(e){this.set("disabled",e.disabled),this.set("hidden",e.hidden)}exportState(){return{disabled:this.get("disabled"),hidden:this.get("hidden")}}getGlobalDisabled_(){const e=this.get("parent");return(e?e.globalDisabled.rawValue:!1)||this.get("disabled")}updateGlobalDisabled_(){this.setGlobalDisabled_(this.getGlobalDisabled_())}onDisabledChange_(){this.updateGlobalDisabled_()}onParentGlobalDisabledChange_(){this.updateGlobalDisabled_()}onParentChange_(e){var t;const i=e.previousRawValue;i==null||i.globalDisabled.emitter.off("change",this.onParentGlobalDisabledChange_),(t=this.get("parent"))===null||t===void 0||t.globalDisabled.emitter.on("change",this.onParentGlobalDisabledChange_),this.updateGlobalDisabled_()}}const gE=Ct("tbp");class SZ{constructor(e,t){this.element=e.createElement("div"),this.element.classList.add(gE()),t.viewProps.bindClassModifiers(this.element);const i=e.createElement("div");i.classList.add(gE("c")),this.element.appendChild(i),this.containerElement=i}}const Mu=Ct("tbi");class MZ{constructor(e,t){this.element=e.createElement("div"),this.element.classList.add(Mu()),t.viewProps.bindClassModifiers(this.element),as(t.props,"selected",s=>{s?this.element.classList.add(Mu(void 0,"sel")):this.element.classList.remove(Mu(void 0,"sel"))});const i=e.createElement("button");i.classList.add(Mu("b")),t.viewProps.bindDisabled(i),this.element.appendChild(i),this.buttonElement=i;const r=e.createElement("div");r.classList.add(Mu("t")),Xb(t.props.value("title"),r),this.buttonElement.appendChild(r),this.titleElement=r}}class EZ{constructor(e,t){this.emitter=new Cn,this.onClick_=this.onClick_.bind(this),this.props=t.props,this.viewProps=t.viewProps,this.view=new MZ(e,{props:t.props,viewProps:t.viewProps}),this.view.buttonElement.addEventListener("click",this.onClick_)}onClick_(){this.emitter.emit("click",{sender:this})}}class A_ extends qb{constructor(e,t){const i=new SZ(e,{viewProps:t.viewProps});super(Object.assign(Object.assign({},t),{rackController:new Kb({blade:t.blade,element:i.containerElement,viewProps:t.viewProps}),view:i})),this.onItemClick_=this.onItemClick_.bind(this),this.ic_=new EZ(e,{props:t.itemProps,viewProps:Ws.create()}),this.ic_.emitter.on("click",this.onItemClick_),this.props=t.props,as(this.props,"selected",r=>{this.itemController.props.set("selected",r),this.viewProps.set("hidden",!r)})}get itemController(){return this.ic_}importState(e){return Wi(e,t=>super.importState(t),t=>({selected:t.required.boolean,title:t.required.string}),t=>(this.ic_.props.set("selected",t.selected),this.ic_.props.set("title",t.title),!0))}exportState(){return $i(()=>super.exportState(),{selected:this.ic_.props.get("selected"),title:this.ic_.props.get("title")})}onItemClick_(){this.props.set("selected",!0)}}class TZ extends Yb{constructor(e,t){super(e,t),this.emitter_=new Cn,this.onSelect_=this.onSelect_.bind(this),this.pool_=t,this.rackApi_.on("change",i=>{this.emitter_.emit("change",i)}),this.controller.tab.selectedIndex.emitter.on("change",this.onSelect_)}get pages(){return this.rackApi_.children}addPage(e){const t=this.controller.view.element.ownerDocument,i=new A_(t,{blade:Zc(),itemProps:_t.fromObject({selected:!1,title:e.title}),props:_t.fromObject({selected:!1}),viewProps:Ws.create()}),r=this.pool_.createApi(i);return this.rackApi_.add(r,e.index)}removePage(e){this.rackApi_.remove(this.rackApi_.children[e])}on(e,t){const i=t.bind(this);return this.emitter_.on(e,r=>{i(r)}),this}onSelect_(e){this.emitter_.emit("select",new IK(this,e.rawValue))}}class AZ extends Yb{get title(){var e;return(e=this.controller.itemController.props.get("title"))!==null&&e!==void 0?e:""}set title(e){this.controller.itemController.props.set("title",e)}get selected(){return this.controller.props.get("selected")}set selected(e){this.controller.props.set("selected",e)}get children(){return this.rackApi_.children}addButton(e){return this.rackApi_.addButton(e)}addFolder(e){return this.rackApi_.addFolder(e)}addTab(e){return this.rackApi_.addTab(e)}add(e,t){this.rackApi_.add(e,t)}remove(e){this.rackApi_.remove(e)}addBinding(e,t,i){return this.rackApi_.addBinding(e,t,i)}addBlade(e){return this.rackApi_.addBlade(e)}}const vE=-1;class CZ{constructor(){this.onItemSelectedChange_=this.onItemSelectedChange_.bind(this),this.empty=nn(!0),this.selectedIndex=nn(vE),this.items_=[]}add(e,t){const i=t!=null?t:this.items_.length;this.items_.splice(i,0,e),e.emitter.on("change",this.onItemSelectedChange_),this.keepSelection_()}remove(e){const t=this.items_.indexOf(e);t<0||(this.items_.splice(t,1),e.emitter.off("change",this.onItemSelectedChange_),this.keepSelection_())}keepSelection_(){if(this.items_.length===0){this.selectedIndex.rawValue=vE,this.empty.rawValue=!0;return}const e=this.items_.findIndex(t=>t.rawValue);e<0?(this.items_.forEach((t,i)=>{t.rawValue=i===0}),this.selectedIndex.rawValue=0):(this.items_.forEach((t,i)=>{t.rawValue=i===e}),this.selectedIndex.rawValue=e),this.empty.rawValue=!1}onItemSelectedChange_(e){if(e.rawValue){const t=this.items_.findIndex(i=>i===e.sender);this.items_.forEach((i,r)=>{i.rawValue=r===t}),this.selectedIndex.rawValue=t}else this.keepSelection_()}}const Eu=Ct("tab");class PZ{constructor(e,t){this.element=e.createElement("div"),this.element.classList.add(Eu(),fR()),t.viewProps.bindClassModifiers(this.element),Ls(t.empty,qc(this.element,Eu(void 0,"nop")));const i=e.createElement("div");i.classList.add(Eu("t")),this.element.appendChild(i),this.itemsElement=i;const r=e.createElement("div");r.classList.add(Eu("i")),this.element.appendChild(r);const s=e.createElement("div");s.classList.add(Eu("c")),this.element.appendChild(s),this.contentsElement=s}}class _E extends qb{constructor(e,t){const i=new CZ,r=new PZ(e,{empty:i.empty,viewProps:t.viewProps});super({blade:t.blade,rackController:new Kb({blade:t.blade,element:r.contentsElement,viewProps:t.viewProps}),view:r}),this.onRackAdd_=this.onRackAdd_.bind(this),this.onRackRemove_=this.onRackRemove_.bind(this);const s=this.rackController.rack;s.emitter.on("add",this.onRackAdd_),s.emitter.on("remove",this.onRackRemove_),this.tab=i}add(e,t){this.rackController.rack.add(e,t)}remove(e){this.rackController.rack.remove(this.rackController.rack.children[e])}onRackAdd_(e){if(!e.root)return;const t=e.bladeController;rR(this.view.itemsElement,t.itemController.view.element,e.index),t.itemController.viewProps.set("parent",this.viewProps),this.tab.add(t.props.value("selected"))}onRackRemove_(e){if(!e.root)return;const t=e.bladeController;jb(t.itemController.view.element),t.itemController.viewProps.set("parent",null),this.tab.remove(t.props.value("selected"))}}const pR=fi({id:"tab",type:"blade",accept(n){const e=on(n,t=>({pages:t.required.array(t.required.object({title:t.required.string})),view:t.required.constant("tab")}));return!e||e.pages.length===0?null:{params:e}},controller(n){const e=new _E(n.document,{blade:n.blade,viewProps:n.viewProps});return n.params.pages.forEach(t=>{const i=new A_(n.document,{blade:Zc(),itemProps:_t.fromObject({selected:!1,title:t.title}),props:_t.fromObject({selected:!1}),viewProps:Ws.create()});e.add(i)}),e},api(n){return n.controller instanceof _E?new TZ(n.controller,n.pool):n.controller instanceof A_?new AZ(n.controller,n.pool):null}});function RZ(n,e){const t=n.accept(e.params);if(!t)return null;const i=on(e.params,r=>({disabled:r.optional.boolean,hidden:r.optional.boolean}));return n.controller({blade:Zc(),document:e.document,params:Object.assign(Object.assign({},t.params),{disabled:i==null?void 0:i.disabled,hidden:i==null?void 0:i.hidden}),viewProps:Ws.create({disabled:i==null?void 0:i.disabled,hidden:i==null?void 0:i.hidden})})}class Jb extends Jh{get options(){return this.controller.valueController.props.get("options")}set options(e){this.controller.valueController.props.set("options",e)}}class LZ{constructor(){this.disabled=!1,this.emitter=new Cn}dispose(){}tick(){this.disabled||this.emitter.emit("tick",{sender:this})}}class OZ{constructor(e,t){this.disabled_=!1,this.timerId_=null,this.onTick_=this.onTick_.bind(this),this.doc_=e,this.emitter=new Cn,this.interval_=t,this.setTimer_()}get disabled(){return this.disabled_}set disabled(e){this.disabled_=e,this.disabled_?this.clearTimer_():this.setTimer_()}dispose(){this.clearTimer_()}clearTimer_(){if(this.timerId_===null)return;const e=this.doc_.defaultView;e&&e.clearInterval(this.timerId_),this.timerId_=null}setTimer_(){if(this.clearTimer_(),this.interval_<=0)return;const e=this.doc_.defaultView;e&&(this.timerId_=e.setInterval(this.onTick_,this.interval_))}onTick_(){this.disabled_||this.emitter.emit("tick",{sender:this})}}class yd{constructor(e){this.constraints=e}constrain(e){return this.constraints.reduce((t,i)=>i.constrain(t),e)}}function Yp(n,e){if(n instanceof e)return n;if(n instanceof yd){const t=n.constraints.reduce((i,r)=>i||(r instanceof e?r:null),null);if(t)return t}return null}class bd{constructor(e){this.values=_t.fromObject({options:e})}constrain(e){const t=this.values.get("options");return t.length===0||t.filter(r=>r.value===e).length>0?e:t[0].value}}function xd(n){var e;const t=M_;if(Array.isArray(n))return(e=on({items:n},i=>({items:i.required.array(i.required.object({text:i.required.string,value:i.required.raw}))})))===null||e===void 0?void 0:e.items;if(typeof n=="object")return t.required.raw(n).value}function Qb(n){if(Array.isArray(n))return n;const e=[];return Object.keys(n).forEach(t=>{e.push({text:t,value:n[t]})}),e}function ex(n){return Gt(n)?null:new bd(Qb(n))}const Ev=Ct("lst");class IZ{constructor(e,t){this.onValueChange_=this.onValueChange_.bind(this),this.props_=t.props,this.element=e.createElement("div"),this.element.classList.add(Ev()),t.viewProps.bindClassModifiers(this.element);const i=e.createElement("select");i.classList.add(Ev("s")),t.viewProps.bindDisabled(i),this.element.appendChild(i),this.selectElement=i;const r=e.createElement("div");r.classList.add(Ev("m")),r.appendChild(dg(e,"dropdown")),this.element.appendChild(r),t.value.emitter.on("change",this.onValueChange_),this.value_=t.value,as(this.props_,"options",s=>{sR(this.selectElement),s.forEach(o=>{const a=e.createElement("option");a.textContent=o.text,this.selectElement.appendChild(a)}),this.update_()})}update_(){const e=this.props_.get("options").map(t=>t.value);this.selectElement.selectedIndex=e.indexOf(this.value_.rawValue)}onValueChange_(){this.update_()}}class ko{constructor(e,t){this.onSelectChange_=this.onSelectChange_.bind(this),this.props=t.props,this.value=t.value,this.viewProps=t.viewProps,this.view=new IZ(e,{props:this.props,value:this.value,viewProps:this.viewProps}),this.view.selectElement.addEventListener("change",this.onSelectChange_)}onSelectChange_(e){const t=e.currentTarget;this.value.rawValue=this.props.get("options")[t.selectedIndex].value}importProps(e){return Wi(e,null,t=>({options:t.required.custom(xd)}),t=>(this.props.set("options",Qb(t.options)),!0))}exportProps(){return $i(null,{options:this.props.get("options")})}}const yE=Ct("pop");class DZ{constructor(e,t){this.element=e.createElement("div"),this.element.classList.add(yE()),t.viewProps.bindClassModifiers(this.element),Ls(t.shows,qc(this.element,yE(void 0,"v")))}}class mR{constructor(e,t){this.shows=nn(!1),this.viewProps=t.viewProps,this.view=new DZ(e,{shows:this.shows,viewProps:this.viewProps})}}const bE=Ct("txt");class UZ{constructor(e,t){this.onChange_=this.onChange_.bind(this),this.element=e.createElement("div"),this.element.classList.add(bE()),t.viewProps.bindClassModifiers(this.element),this.props_=t.props,this.props_.emitter.on("change",this.onChange_);const i=e.createElement("input");i.classList.add(bE("i")),i.type="text",t.viewProps.bindDisabled(i),this.element.appendChild(i),this.inputElement=i,t.value.emitter.on("change",this.onChange_),this.value_=t.value,this.refresh()}refresh(){const e=this.props_.get("formatter");this.inputElement.value=e(this.value_.rawValue)}onChange_(){this.refresh()}}class Qh{constructor(e,t){this.onInputChange_=this.onInputChange_.bind(this),this.parser_=t.parser,this.props=t.props,this.value=t.value,this.viewProps=t.viewProps,this.view=new UZ(e,{props:t.props,value:this.value,viewProps:this.viewProps}),this.view.inputElement.addEventListener("change",this.onInputChange_)}onInputChange_(e){const i=e.currentTarget.value,r=this.parser_(i);Gt(r)||(this.value.rawValue=r),this.view.refresh()}}function NZ(n){return String(n)}function gR(n){return n==="false"?!1:!!n}function xE(n){return NZ(n)}function FZ(n){return e=>n.reduce((t,i)=>t!==null?t:i(e),null)}const kZ=Ai(0);function qp(n){return kZ(n)+"%"}function vR(n){return String(n)}function C_(n){return n}function Jc({primary:n,secondary:e,forward:t,backward:i}){let r=!1;function s(o){r||(r=!0,o(),r=!1)}n.emitter.on("change",o=>{s(()=>{e.setRawValue(t(n.rawValue,e.rawValue),o.options)})}),e.emitter.on("change",o=>{s(()=>{n.setRawValue(i(n.rawValue,e.rawValue),o.options)}),s(()=>{e.setRawValue(t(n.rawValue,e.rawValue),o.options)})}),s(()=>{e.setRawValue(t(n.rawValue,e.rawValue),{forceEmit:!1,last:!0})})}function wi(n,e){const t=n*(e.altKey?.1:1)*(e.shiftKey?10:1);return e.upKey?+t:e.downKey?-t:0}function ed(n){return{altKey:n.altKey,downKey:n.key==="ArrowDown",shiftKey:n.shiftKey,upKey:n.key==="ArrowUp"}}function Bs(n){return{altKey:n.altKey,downKey:n.key==="ArrowLeft",shiftKey:n.shiftKey,upKey:n.key==="ArrowRight"}}function BZ(n){return n==="ArrowUp"||n==="ArrowDown"}function _R(n){return BZ(n)||n==="ArrowLeft"||n==="ArrowRight"}function Tv(n,e){var t,i;const r=e.ownerDocument.defaultView,s=e.getBoundingClientRect();return{x:n.pageX-(((t=r&&r.scrollX)!==null&&t!==void 0?t:0)+s.left),y:n.pageY-(((i=r&&r.scrollY)!==null&&i!==void 0?i:0)+s.top)}}class hl{constructor(e){this.lastTouch_=null,this.onDocumentMouseMove_=this.onDocumentMouseMove_.bind(this),this.onDocumentMouseUp_=this.onDocumentMouseUp_.bind(this),this.onMouseDown_=this.onMouseDown_.bind(this),this.onTouchEnd_=this.onTouchEnd_.bind(this),this.onTouchMove_=this.onTouchMove_.bind(this),this.onTouchStart_=this.onTouchStart_.bind(this),this.elem_=e,this.emitter=new Cn,e.addEventListener("touchstart",this.onTouchStart_,{passive:!1}),e.addEventListener("touchmove",this.onTouchMove_,{passive:!0}),e.addEventListener("touchend",this.onTouchEnd_),e.addEventListener("mousedown",this.onMouseDown_)}computePosition_(e){const t=this.elem_.getBoundingClientRect();return{bounds:{width:t.width,height:t.height},point:e?{x:e.x,y:e.y}:null}}onMouseDown_(e){var t;e.preventDefault(),(t=e.currentTarget)===null||t===void 0||t.focus();const i=this.elem_.ownerDocument;i.addEventListener("mousemove",this.onDocumentMouseMove_),i.addEventListener("mouseup",this.onDocumentMouseUp_),this.emitter.emit("down",{altKey:e.altKey,data:this.computePosition_(Tv(e,this.elem_)),sender:this,shiftKey:e.shiftKey})}onDocumentMouseMove_(e){this.emitter.emit("move",{altKey:e.altKey,data:this.computePosition_(Tv(e,this.elem_)),sender:this,shiftKey:e.shiftKey})}onDocumentMouseUp_(e){const t=this.elem_.ownerDocument;t.removeEventListener("mousemove",this.onDocumentMouseMove_),t.removeEventListener("mouseup",this.onDocumentMouseUp_),this.emitter.emit("up",{altKey:e.altKey,data:this.computePosition_(Tv(e,this.elem_)),sender:this,shiftKey:e.shiftKey})}onTouchStart_(e){e.preventDefault();const t=e.targetTouches.item(0),i=this.elem_.getBoundingClientRect();this.emitter.emit("down",{altKey:e.altKey,data:this.computePosition_(t?{x:t.clientX-i.left,y:t.clientY-i.top}:void 0),sender:this,shiftKey:e.shiftKey}),this.lastTouch_=t}onTouchMove_(e){const t=e.targetTouches.item(0),i=this.elem_.getBoundingClientRect();this.emitter.emit("move",{altKey:e.altKey,data:this.computePosition_(t?{x:t.clientX-i.left,y:t.clientY-i.top}:void 0),sender:this,shiftKey:e.shiftKey}),this.lastTouch_=t}onTouchEnd_(e){var t;const i=(t=e.targetTouches.item(0))!==null&&t!==void 0?t:this.lastTouch_,r=this.elem_.getBoundingClientRect();this.emitter.emit("up",{altKey:e.altKey,data:this.computePosition_(i?{x:i.clientX-r.left,y:i.clientY-r.top}:void 0),sender:this,shiftKey:e.shiftKey})}}const qi=Ct("txt");class zZ{constructor(e,t){this.onChange_=this.onChange_.bind(this),this.props_=t.props,this.props_.emitter.on("change",this.onChange_),this.element=e.createElement("div"),this.element.classList.add(qi(),qi(void 0,"num")),t.arrayPosition&&this.element.classList.add(qi(void 0,t.arrayPosition)),t.viewProps.bindClassModifiers(this.element);const i=e.createElement("input");i.classList.add(qi("i")),i.type="text",t.viewProps.bindDisabled(i),this.element.appendChild(i),this.inputElement=i,this.onDraggingChange_=this.onDraggingChange_.bind(this),this.dragging_=t.dragging,this.dragging_.emitter.on("change",this.onDraggingChange_),this.element.classList.add(qi()),this.inputElement.classList.add(qi("i"));const r=e.createElement("div");r.classList.add(qi("k")),this.element.appendChild(r),this.knobElement=r;const s=e.createElementNS(qr,"svg");s.classList.add(qi("g")),this.knobElement.appendChild(s);const o=e.createElementNS(qr,"path");o.classList.add(qi("gb")),s.appendChild(o),this.guideBodyElem_=o;const a=e.createElementNS(qr,"path");a.classList.add(qi("gh")),s.appendChild(a),this.guideHeadElem_=a;const l=e.createElement("div");l.classList.add(Ct("tt")()),this.knobElement.appendChild(l),this.tooltipElem_=l,t.value.emitter.on("change",this.onChange_),this.value=t.value,this.refresh()}onDraggingChange_(e){if(e.rawValue===null){this.element.classList.remove(qi(void 0,"drg"));return}this.element.classList.add(qi(void 0,"drg"));const t=e.rawValue/this.props_.get("pointerScale"),i=t+(t>0?-1:t<0?1:0),r=Ln(-i,-4,4);this.guideHeadElem_.setAttributeNS(null,"d",["M ".concat(i+r,",0 L").concat(i,",4 L").concat(i+r,",8"),"M ".concat(t,",-1 L").concat(t,",9")].join(" ")),this.guideBodyElem_.setAttributeNS(null,"d","M 0,4 L".concat(t,",4"));const s=this.props_.get("formatter");this.tooltipElem_.textContent=s(this.value.rawValue),this.tooltipElem_.style.left="".concat(t,"px")}refresh(){const e=this.props_.get("formatter");this.inputElement.value=e(this.value.rawValue)}onChange_(){this.refresh()}}class wd{constructor(e,t){var i;this.originRawValue_=0,this.onInputChange_=this.onInputChange_.bind(this),this.onInputKeyDown_=this.onInputKeyDown_.bind(this),this.onInputKeyUp_=this.onInputKeyUp_.bind(this),this.onPointerDown_=this.onPointerDown_.bind(this),this.onPointerMove_=this.onPointerMove_.bind(this),this.onPointerUp_=this.onPointerUp_.bind(this),this.parser_=t.parser,this.props=t.props,this.sliderProps_=(i=t.sliderProps)!==null&&i!==void 0?i:null,this.value=t.value,this.viewProps=t.viewProps,this.dragging_=nn(null),this.view=new zZ(e,{arrayPosition:t.arrayPosition,dragging:this.dragging_,props:this.props,value:this.value,viewProps:this.viewProps}),this.view.inputElement.addEventListener("change",this.onInputChange_),this.view.inputElement.addEventListener("keydown",this.onInputKeyDown_),this.view.inputElement.addEventListener("keyup",this.onInputKeyUp_);const r=new hl(this.view.knobElement);r.emitter.on("down",this.onPointerDown_),r.emitter.on("move",this.onPointerMove_),r.emitter.on("up",this.onPointerUp_)}constrainValue_(e){var t,i;const r=(t=this.sliderProps_)===null||t===void 0?void 0:t.get("min"),s=(i=this.sliderProps_)===null||i===void 0?void 0:i.get("max");let o=e;return r!==void 0&&(o=Math.max(o,r)),s!==void 0&&(o=Math.min(o,s)),o}onInputChange_(e){const i=e.currentTarget.value,r=this.parser_(i);Gt(r)||(this.value.rawValue=this.constrainValue_(r)),this.view.refresh()}onInputKeyDown_(e){const t=wi(this.props.get("keyScale"),ed(e));t!==0&&this.value.setRawValue(this.constrainValue_(this.value.rawValue+t),{forceEmit:!1,last:!1})}onInputKeyUp_(e){wi(this.props.get("keyScale"),ed(e))!==0&&this.value.setRawValue(this.value.rawValue,{forceEmit:!0,last:!0})}onPointerDown_(){this.originRawValue_=this.value.rawValue,this.dragging_.rawValue=0}computeDraggingValue_(e){if(!e.point)return null;const t=e.point.x-e.bounds.width/2;return this.constrainValue_(this.originRawValue_+t*this.props.get("pointerScale"))}onPointerMove_(e){const t=this.computeDraggingValue_(e.data);t!==null&&(this.value.setRawValue(t,{forceEmit:!1,last:!1}),this.dragging_.rawValue=this.value.rawValue-this.originRawValue_)}onPointerUp_(e){const t=this.computeDraggingValue_(e.data);t!==null&&(this.value.setRawValue(t,{forceEmit:!0,last:!0}),this.dragging_.rawValue=null)}}const Av=Ct("sld");class VZ{constructor(e,t){this.onChange_=this.onChange_.bind(this),this.props_=t.props,this.props_.emitter.on("change",this.onChange_),this.element=e.createElement("div"),this.element.classList.add(Av()),t.viewProps.bindClassModifiers(this.element);const i=e.createElement("div");i.classList.add(Av("t")),t.viewProps.bindTabIndex(i),this.element.appendChild(i),this.trackElement=i;const r=e.createElement("div");r.classList.add(Av("k")),this.trackElement.appendChild(r),this.knobElement=r,t.value.emitter.on("change",this.onChange_),this.value=t.value,this.update_()}update_(){const e=Ln(Ot(this.value.rawValue,this.props_.get("min"),this.props_.get("max"),0,100),0,100);this.knobElement.style.width="".concat(e,"%")}onChange_(){this.update_()}}class HZ{constructor(e,t){this.onKeyDown_=this.onKeyDown_.bind(this),this.onKeyUp_=this.onKeyUp_.bind(this),this.onPointerDownOrMove_=this.onPointerDownOrMove_.bind(this),this.onPointerUp_=this.onPointerUp_.bind(this),this.value=t.value,this.viewProps=t.viewProps,this.props=t.props,this.view=new VZ(e,{props:this.props,value:this.value,viewProps:this.viewProps}),this.ptHandler_=new hl(this.view.trackElement),this.ptHandler_.emitter.on("down",this.onPointerDownOrMove_),this.ptHandler_.emitter.on("move",this.onPointerDownOrMove_),this.ptHandler_.emitter.on("up",this.onPointerUp_),this.view.trackElement.addEventListener("keydown",this.onKeyDown_),this.view.trackElement.addEventListener("keyup",this.onKeyUp_)}handlePointerEvent_(e,t){e.point&&this.value.setRawValue(Ot(Ln(e.point.x,0,e.bounds.width),0,e.bounds.width,this.props.get("min"),this.props.get("max")),t)}onPointerDownOrMove_(e){this.handlePointerEvent_(e.data,{forceEmit:!1,last:!1})}onPointerUp_(e){this.handlePointerEvent_(e.data,{forceEmit:!0,last:!0})}onKeyDown_(e){const t=wi(this.props.get("keyScale"),Bs(e));t!==0&&this.value.setRawValue(this.value.rawValue+t,{forceEmit:!1,last:!1})}onKeyUp_(e){wi(this.props.get("keyScale"),Bs(e))!==0&&this.value.setRawValue(this.value.rawValue,{forceEmit:!0,last:!0})}}const Cv=Ct("sldtxt");class GZ{constructor(e,t){this.element=e.createElement("div"),this.element.classList.add(Cv());const i=e.createElement("div");i.classList.add(Cv("s")),this.sliderView_=t.sliderView,i.appendChild(this.sliderView_.element),this.element.appendChild(i);const r=e.createElement("div");r.classList.add(Cv("t")),this.textView_=t.textView,r.appendChild(this.textView_.element),this.element.appendChild(r)}}class Kp{constructor(e,t){this.value=t.value,this.viewProps=t.viewProps,this.sliderC_=new HZ(e,{props:t.sliderProps,value:t.value,viewProps:this.viewProps}),this.textC_=new wd(e,{parser:t.parser,props:t.textProps,sliderProps:t.sliderProps,value:t.value,viewProps:t.viewProps}),this.view=new GZ(e,{sliderView:this.sliderC_.view,textView:this.textC_.view})}get sliderController(){return this.sliderC_}get textController(){return this.textC_}importProps(e){return Wi(e,null,t=>({max:t.required.number,min:t.required.number}),t=>{const i=this.sliderC_.props;return i.set("max",t.max),i.set("min",t.min),!0})}exportProps(){const e=this.sliderC_.props;return $i(null,{max:e.get("max"),min:e.get("min")})}}function yR(n){return{sliderProps:new _t({keyScale:n.keyScale,max:n.max,min:n.min}),textProps:new _t({formatter:nn(n.formatter),keyScale:n.keyScale,pointerScale:nn(n.pointerScale)})}}const WZ={containerUnitSize:"cnt-usz"};function bR(n){return"--".concat(WZ[n])}function td(n){return nR(n)}function xo(n){if(S_(n))return on(n,td)}function As(n,e){if(!n)return;const t=[],i=Q3(n,e);i&&t.push(i);const r=eR(n);return r&&t.push(r),new yd(t)}function $Z(n){return n?n.major===Kc.major:!1}function xR(n){if(n==="inline"||n==="popup")return n}function Sd(n,e){n.write(e)}const $f=Ct("ckb");class jZ{constructor(e,t){this.onValueChange_=this.onValueChange_.bind(this),this.element=e.createElement("div"),this.element.classList.add($f()),t.viewProps.bindClassModifiers(this.element);const i=e.createElement("label");i.classList.add($f("l")),this.element.appendChild(i);const r=e.createElement("input");r.classList.add($f("i")),r.type="checkbox",i.appendChild(r),this.inputElement=r,t.viewProps.bindDisabled(this.inputElement);const s=e.createElement("div");s.classList.add($f("w")),i.appendChild(s);const o=dg(e,"check");s.appendChild(o),t.value.emitter.on("change",this.onValueChange_),this.value=t.value,this.update_()}update_(){this.inputElement.checked=this.value.rawValue}onValueChange_(){this.update_()}}class XZ{constructor(e,t){this.onInputChange_=this.onInputChange_.bind(this),this.value=t.value,this.viewProps=t.viewProps,this.view=new jZ(e,{value:this.value,viewProps:this.viewProps}),this.view.inputElement.addEventListener("change",this.onInputChange_)}onInputChange_(e){const t=e.currentTarget;this.value.rawValue=t.checked}}function YZ(n){const e=[],t=ex(n.options);return t&&e.push(t),new yd(e)}const qZ=fi({id:"input-bool",type:"input",accept:(n,e)=>{if(typeof n!="boolean")return null;const t=on(e,i=>({options:i.optional.custom(xd),readonly:i.optional.constant(!1)}));return t?{initialValue:n,params:t}:null},binding:{reader:n=>gR,constraint:n=>YZ(n.params),writer:n=>Sd},controller:n=>{const e=n.document,t=n.value,i=n.constraint,r=i&&Yp(i,bd);return r?new ko(e,{props:new _t({options:r.values.value("options")}),value:t,viewProps:n.viewProps}):new XZ(e,{value:t,viewProps:n.viewProps})},api(n){return typeof n.controller.value.rawValue!="boolean"?null:n.controller.valueController instanceof ko?new Jb(n.controller):null}}),aa=Ct("col");class KZ{constructor(e,t){this.element=e.createElement("div"),this.element.classList.add(aa()),t.foldable.bindExpandedClass(this.element,aa(void 0,"expanded")),as(t.foldable,"completed",qc(this.element,aa(void 0,"cpl")));const i=e.createElement("div");i.classList.add(aa("h")),this.element.appendChild(i);const r=e.createElement("div");r.classList.add(aa("s")),i.appendChild(r),this.swatchElement=r;const s=e.createElement("div");if(s.classList.add(aa("t")),i.appendChild(s),this.textElement=s,t.pickerLayout==="inline"){const o=e.createElement("div");o.classList.add(aa("p")),this.element.appendChild(o),this.pickerElement=o}else this.pickerElement=null}}function ZZ(n,e,t){const i=Ln(n/255,0,1),r=Ln(e/255,0,1),s=Ln(t/255,0,1),o=Math.max(i,r,s),a=Math.min(i,r,s),l=o-a;let c=0,u=0;const h=(a+o)/2;return l!==0&&(u=l/(1-Math.abs(o+a-1)),i===o?c=(r-s)/l:r===o?c=2+(s-i)/l:c=4+(i-r)/l,c=c/6+(c<0?1:0)),[c*360,u*100,h*100]}function JZ(n,e,t){const i=(n%360+360)%360,r=Ln(e/100,0,1),s=Ln(t/100,0,1),o=(1-Math.abs(2*s-1))*r,a=o*(1-Math.abs(i/60%2-1)),l=s-o/2;let c,u,h;return i>=0&&i<60?[c,u,h]=[o,a,0]:i>=60&&i<120?[c,u,h]=[a,o,0]:i>=120&&i<180?[c,u,h]=[0,o,a]:i>=180&&i<240?[c,u,h]=[0,a,o]:i>=240&&i<300?[c,u,h]=[a,0,o]:[c,u,h]=[o,0,a],[(c+l)*255,(u+l)*255,(h+l)*255]}function QZ(n,e,t){const i=Ln(n/255,0,1),r=Ln(e/255,0,1),s=Ln(t/255,0,1),o=Math.max(i,r,s),a=Math.min(i,r,s),l=o-a;let c;l===0?c=0:o===i?c=60*(((r-s)/l%6+6)%6):o===r?c=60*((s-i)/l+2):c=60*((i-r)/l+4);const u=o===0?0:l/o,h=o;return[c,u*100,h*100]}function wR(n,e,t){const i=K3(n,360),r=Ln(e/100,0,1),s=Ln(t/100,0,1),o=s*r,a=o*(1-Math.abs(i/60%2-1)),l=s-o;let c,u,h;return i>=0&&i<60?[c,u,h]=[o,a,0]:i>=60&&i<120?[c,u,h]=[a,o,0]:i>=120&&i<180?[c,u,h]=[0,o,a]:i>=180&&i<240?[c,u,h]=[0,a,o]:i>=240&&i<300?[c,u,h]=[a,0,o]:[c,u,h]=[o,0,a],[(c+l)*255,(u+l)*255,(h+l)*255]}function eJ(n,e,t){const i=t+e*(100-Math.abs(2*t-100))/200;return[n,i!==0?e*(100-Math.abs(2*t-100))/i:0,t+e*(100-Math.abs(2*t-100))/(2*100)]}function tJ(n,e,t){const i=100-Math.abs(t*(200-e)/100-100);return[n,i!==0?e*t/i:0,t*(200-e)/(2*100)]}function ls(n){return[n[0],n[1],n[2]]}function pg(n,e){return[n[0],n[1],n[2],e]}const nJ={hsl:{hsl:(n,e,t)=>[n,e,t],hsv:eJ,rgb:JZ},hsv:{hsl:tJ,hsv:(n,e,t)=>[n,e,t],rgb:wR},rgb:{hsl:ZZ,hsv:QZ,rgb:(n,e,t)=>[n,e,t]}};function Dc(n,e){return[e==="float"?1:n==="rgb"?255:360,e==="float"?1:n==="rgb"?255:100,e==="float"?1:n==="rgb"?255:100]}function iJ(n,e){return n===e?e:K3(n,e)}function SR(n,e,t){var i;const r=Dc(e,t);return[e==="rgb"?Ln(n[0],0,r[0]):iJ(n[0],r[0]),Ln(n[1],0,r[1]),Ln(n[2],0,r[2]),Ln((i=n[3])!==null&&i!==void 0?i:1,0,1)]}function wE(n,e,t,i){const r=Dc(e,t),s=Dc(e,i);return n.map((o,a)=>o/r[a]*s[a])}function MR(n,e,t){const i=wE(n,e.mode,e.type,"int"),r=nJ[e.mode][t.mode](...i);return wE(r,t.mode,"int",t.type)}class Rt{static black(){return new Rt([0,0,0],"rgb")}constructor(e,t){this.type="int",this.mode=t,this.comps_=SR(e,t,this.type)}getComponents(e){return pg(MR(ls(this.comps_),{mode:this.mode,type:this.type},{mode:e!=null?e:this.mode,type:this.type}),this.comps_[3])}toRgbaObject(){const e=this.getComponents("rgb");return{r:e[0],g:e[1],b:e[2],a:e[3]}}}const no=Ct("colp");class rJ{constructor(e,t){this.alphaViews_=null,this.element=e.createElement("div"),this.element.classList.add(no()),t.viewProps.bindClassModifiers(this.element);const i=e.createElement("div");i.classList.add(no("hsv"));const r=e.createElement("div");r.classList.add(no("sv")),this.svPaletteView_=t.svPaletteView,r.appendChild(this.svPaletteView_.element),i.appendChild(r);const s=e.createElement("div");s.classList.add(no("h")),this.hPaletteView_=t.hPaletteView,s.appendChild(this.hPaletteView_.element),i.appendChild(s),this.element.appendChild(i);const o=e.createElement("div");if(o.classList.add(no("rgb")),this.textsView_=t.textsView,o.appendChild(this.textsView_.element),this.element.appendChild(o),t.alphaViews){this.alphaViews_={palette:t.alphaViews.palette,text:t.alphaViews.text};const a=e.createElement("div");a.classList.add(no("a"));const l=e.createElement("div");l.classList.add(no("ap")),l.appendChild(this.alphaViews_.palette.element),a.appendChild(l);const c=e.createElement("div");c.classList.add(no("at")),c.appendChild(this.alphaViews_.text.element),a.appendChild(c),this.element.appendChild(a)}}get allFocusableElements(){const e=[this.svPaletteView_.element,this.hPaletteView_.element,this.textsView_.modeSelectElement,...this.textsView_.inputViews.map(t=>t.inputElement)];return this.alphaViews_&&e.push(this.alphaViews_.palette.element,this.alphaViews_.text.inputElement),e}}function sJ(n){return n==="int"?"int":n==="float"?"float":void 0}function tx(n){return on(n,e=>({color:e.optional.object({alpha:e.optional.boolean,type:e.optional.custom(sJ)}),expanded:e.optional.boolean,picker:e.optional.custom(xR),readonly:e.optional.constant(!1)}))}function qa(n){return n?.1:1}function ER(n){var e;return(e=n.color)===null||e===void 0?void 0:e.type}class nx{constructor(e,t){this.type="float",this.mode=t,this.comps_=SR(e,t,this.type)}getComponents(e){return pg(MR(ls(this.comps_),{mode:this.mode,type:this.type},{mode:e!=null?e:this.mode,type:this.type}),this.comps_[3])}toRgbaObject(){const e=this.getComponents("rgb");return{r:e[0],g:e[1],b:e[2],a:e[3]}}}const oJ={int:(n,e)=>new Rt(n,e),float:(n,e)=>new nx(n,e)};function ix(n,e,t){return oJ[t](n,e)}function aJ(n){return n.type==="float"}function lJ(n){return n.type==="int"}function cJ(n){const e=n.getComponents(),t=Dc(n.mode,"int");return new Rt([Math.round(Ot(e[0],0,1,0,t[0])),Math.round(Ot(e[1],0,1,0,t[1])),Math.round(Ot(e[2],0,1,0,t[2])),e[3]],n.mode)}function uJ(n){const e=n.getComponents(),t=Dc(n.mode,"int");return new nx([Ot(e[0],0,t[0],0,1),Ot(e[1],0,t[1],0,1),Ot(e[2],0,t[2],0,1),e[3]],n.mode)}function ci(n,e){if(n.type===e)return n;if(lJ(n)&&e==="float")return uJ(n);if(aJ(n)&&e==="int")return cJ(n);throw fn.shouldNeverHappen()}function hJ(n,e){return n.alpha===e.alpha&&n.mode===e.mode&&n.notation===e.notation&&n.type===e.type}function sr(n,e){const t=n.match(/^(.+)%$/);return Math.min(t?parseFloat(t[1])*.01*e:parseFloat(n),e)}const dJ={deg:n=>n,grad:n=>n*360/400,rad:n=>n*360/(2*Math.PI),turn:n=>n*360};function TR(n){const e=n.match(/^([0-9.]+?)(deg|grad|rad|turn)$/);if(!e)return parseFloat(n);const t=parseFloat(e[1]),i=e[2];return dJ[i](t)}function AR(n){const e=n.match(/^rgb\(\s*([0-9A-Fa-f.]+%?)\s*,\s*([0-9A-Fa-f.]+%?)\s*,\s*([0-9A-Fa-f.]+%?)\s*\)$/);if(!e)return null;const t=[sr(e[1],255),sr(e[2],255),sr(e[3],255)];return isNaN(t[0])||isNaN(t[1])||isNaN(t[2])?null:t}function fJ(n){const e=AR(n);return e?new Rt(e,"rgb"):null}function CR(n){const e=n.match(/^rgba\(\s*([0-9A-Fa-f.]+%?)\s*,\s*([0-9A-Fa-f.]+%?)\s*,\s*([0-9A-Fa-f.]+%?)\s*,\s*([0-9A-Fa-f.]+%?)\s*\)$/);if(!e)return null;const t=[sr(e[1],255),sr(e[2],255),sr(e[3],255),sr(e[4],1)];return isNaN(t[0])||isNaN(t[1])||isNaN(t[2])||isNaN(t[3])?null:t}function pJ(n){const e=CR(n);return e?new Rt(e,"rgb"):null}function PR(n){const e=n.match(/^hsl\(\s*([0-9A-Fa-f.]+(?:deg|grad|rad|turn)?)\s*,\s*([0-9A-Fa-f.]+%?)\s*,\s*([0-9A-Fa-f.]+%?)\s*\)$/);if(!e)return null;const t=[TR(e[1]),sr(e[2],100),sr(e[3],100)];return isNaN(t[0])||isNaN(t[1])||isNaN(t[2])?null:t}function mJ(n){const e=PR(n);return e?new Rt(e,"hsl"):null}function RR(n){const e=n.match(/^hsla\(\s*([0-9A-Fa-f.]+(?:deg|grad|rad|turn)?)\s*,\s*([0-9A-Fa-f.]+%?)\s*,\s*([0-9A-Fa-f.]+%?)\s*,\s*([0-9A-Fa-f.]+%?)\s*\)$/);if(!e)return null;const t=[TR(e[1]),sr(e[2],100),sr(e[3],100),sr(e[4],1)];return isNaN(t[0])||isNaN(t[1])||isNaN(t[2])||isNaN(t[3])?null:t}function gJ(n){const e=RR(n);return e?new Rt(e,"hsl"):null}function LR(n){const e=n.match(/^#([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])$/);if(e)return[parseInt(e[1]+e[1],16),parseInt(e[2]+e[2],16),parseInt(e[3]+e[3],16)];const t=n.match(/^(?:#|0x)([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})$/);return t?[parseInt(t[1],16),parseInt(t[2],16),parseInt(t[3],16)]:null}function vJ(n){const e=LR(n);return e?new Rt(e,"rgb"):null}function OR(n){const e=n.match(/^#?([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])$/);if(e)return[parseInt(e[1]+e[1],16),parseInt(e[2]+e[2],16),parseInt(e[3]+e[3],16),Ot(parseInt(e[4]+e[4],16),0,255,0,1)];const t=n.match(/^(?:#|0x)?([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})$/);return t?[parseInt(t[1],16),parseInt(t[2],16),parseInt(t[3],16),Ot(parseInt(t[4],16),0,255,0,1)]:null}function _J(n){const e=OR(n);return e?new Rt(e,"rgb"):null}function IR(n){const e=n.match(/^\{\s*r\s*:\s*([0-9A-Fa-f.]+%?)\s*,\s*g\s*:\s*([0-9A-Fa-f.]+%?)\s*,\s*b\s*:\s*([0-9A-Fa-f.]+%?)\s*\}$/);if(!e)return null;const t=[parseFloat(e[1]),parseFloat(e[2]),parseFloat(e[3])];return isNaN(t[0])||isNaN(t[1])||isNaN(t[2])?null:t}function SE(n){return e=>{const t=IR(e);return t?ix(t,"rgb",n):null}}function DR(n){const e=n.match(/^\{\s*r\s*:\s*([0-9A-Fa-f.]+%?)\s*,\s*g\s*:\s*([0-9A-Fa-f.]+%?)\s*,\s*b\s*:\s*([0-9A-Fa-f.]+%?)\s*,\s*a\s*:\s*([0-9A-Fa-f.]+%?)\s*\}$/);if(!e)return null;const t=[parseFloat(e[1]),parseFloat(e[2]),parseFloat(e[3]),parseFloat(e[4])];return isNaN(t[0])||isNaN(t[1])||isNaN(t[2])||isNaN(t[3])?null:t}function ME(n){return e=>{const t=DR(e);return t?ix(t,"rgb",n):null}}const yJ=[{parser:LR,result:{alpha:!1,mode:"rgb",notation:"hex"}},{parser:OR,result:{alpha:!0,mode:"rgb",notation:"hex"}},{parser:AR,result:{alpha:!1,mode:"rgb",notation:"func"}},{parser:CR,result:{alpha:!0,mode:"rgb",notation:"func"}},{parser:PR,result:{alpha:!1,mode:"hsl",notation:"func"}},{parser:RR,result:{alpha:!0,mode:"hsl",notation:"func"}},{parser:IR,result:{alpha:!1,mode:"rgb",notation:"object"}},{parser:DR,result:{alpha:!0,mode:"rgb",notation:"object"}}];function bJ(n){return yJ.reduce((e,{parser:t,result:i})=>e||(t(n)?i:null),null)}function xJ(n,e="int"){const t=bJ(n);return t?t.notation==="hex"&&e!=="float"?Object.assign(Object.assign({},t),{type:"int"}):t.notation==="func"?Object.assign(Object.assign({},t),{type:e}):null:null}function Md(n){const e=[vJ,_J,fJ,pJ,mJ,gJ];n==="int"&&e.push(SE("int"),ME("int")),n==="float"&&e.push(SE("float"),ME("float"));const t=FZ(e);return i=>{const r=t(i);return r?ci(r,n):null}}function wJ(n){const e=Md("int");if(typeof n!="string")return Rt.black();const t=e(n);return t!=null?t:Rt.black()}function UR(n){const e=Ln(Math.floor(n),0,255).toString(16);return e.length===1?"0".concat(e):e}function rx(n,e="#"){const t=ls(n.getComponents("rgb")).map(UR).join("");return"".concat(e).concat(t)}function sx(n,e="#"){const t=n.getComponents("rgb"),i=[t[0],t[1],t[2],t[3]*255].map(UR).join("");return"".concat(e).concat(i)}function NR(n){const e=Ai(0),t=ci(n,"int"),i=ls(t.getComponents("rgb")).map(r=>e(r));return"rgb(".concat(i.join(", "),")")}function yp(n){const e=Ai(2),t=Ai(0),r=ci(n,"int").getComponents("rgb").map((s,o)=>(o===3?e:t)(s));return"rgba(".concat(r.join(", "),")")}function SJ(n){const e=[Ai(0),qp,qp],t=ci(n,"int"),i=ls(t.getComponents("hsl")).map((r,s)=>e[s](r));return"hsl(".concat(i.join(", "),")")}function MJ(n){const e=[Ai(0),qp,qp,Ai(2)],i=ci(n,"int").getComponents("hsl").map((r,s)=>e[s](r));return"hsla(".concat(i.join(", "),")")}function FR(n,e){const t=Ai(e==="float"?2:0),i=["r","g","b"],r=ci(n,e),s=ls(r.getComponents("rgb")).map((o,a)=>"".concat(i[a],": ").concat(t(o)));return"{".concat(s.join(", "),"}")}function EJ(n){return e=>FR(e,n)}function kR(n,e){const t=Ai(2),i=Ai(e==="float"?2:0),r=["r","g","b","a"],o=ci(n,e).getComponents("rgb").map((a,l)=>{const c=l===3?t:i;return"".concat(r[l],": ").concat(c(a))});return"{".concat(o.join(", "),"}")}function TJ(n){return e=>kR(e,n)}const AJ=[{format:{alpha:!1,mode:"rgb",notation:"hex",type:"int"},stringifier:rx},{format:{alpha:!0,mode:"rgb",notation:"hex",type:"int"},stringifier:sx},{format:{alpha:!1,mode:"rgb",notation:"func",type:"int"},stringifier:NR},{format:{alpha:!0,mode:"rgb",notation:"func",type:"int"},stringifier:yp},{format:{alpha:!1,mode:"hsl",notation:"func",type:"int"},stringifier:SJ},{format:{alpha:!0,mode:"hsl",notation:"func",type:"int"},stringifier:MJ},...["int","float"].reduce((n,e)=>[...n,{format:{alpha:!1,mode:"rgb",notation:"object",type:e},stringifier:EJ(e)},{format:{alpha:!0,mode:"rgb",notation:"object",type:e},stringifier:TJ(e)}],[])];function BR(n){return AJ.reduce((e,t)=>e||(hJ(t.format,n)?t.stringifier:null),null)}const Tu=Ct("apl");class CJ{constructor(e,t){this.onValueChange_=this.onValueChange_.bind(this),this.value=t.value,this.value.emitter.on("change",this.onValueChange_),this.element=e.createElement("div"),this.element.classList.add(Tu()),t.viewProps.bindClassModifiers(this.element),t.viewProps.bindTabIndex(this.element);const i=e.createElement("div");i.classList.add(Tu("b")),this.element.appendChild(i);const r=e.createElement("div");r.classList.add(Tu("c")),i.appendChild(r),this.colorElem_=r;const s=e.createElement("div");s.classList.add(Tu("m")),this.element.appendChild(s),this.markerElem_=s;const o=e.createElement("div");o.classList.add(Tu("p")),this.markerElem_.appendChild(o),this.previewElem_=o,this.update_()}update_(){const e=this.value.rawValue,t=e.getComponents("rgb"),i=new Rt([t[0],t[1],t[2],0],"rgb"),r=new Rt([t[0],t[1],t[2],255],"rgb"),s=["to right",yp(i),yp(r)];this.colorElem_.style.background="linear-gradient(".concat(s.join(","),")"),this.previewElem_.style.backgroundColor=yp(e);const o=Ot(t[3],0,1,0,100);this.markerElem_.style.left="".concat(o,"%")}onValueChange_(){this.update_()}}class PJ{constructor(e,t){this.onKeyDown_=this.onKeyDown_.bind(this),this.onKeyUp_=this.onKeyUp_.bind(this),this.onPointerDown_=this.onPointerDown_.bind(this),this.onPointerMove_=this.onPointerMove_.bind(this),this.onPointerUp_=this.onPointerUp_.bind(this),this.value=t.value,this.viewProps=t.viewProps,this.view=new CJ(e,{value:this.value,viewProps:this.viewProps}),this.ptHandler_=new hl(this.view.element),this.ptHandler_.emitter.on("down",this.onPointerDown_),this.ptHandler_.emitter.on("move",this.onPointerMove_),this.ptHandler_.emitter.on("up",this.onPointerUp_),this.view.element.addEventListener("keydown",this.onKeyDown_),this.view.element.addEventListener("keyup",this.onKeyUp_)}handlePointerEvent_(e,t){if(!e.point)return;const i=e.point.x/e.bounds.width,r=this.value.rawValue,[s,o,a]=r.getComponents("hsv");this.value.setRawValue(new Rt([s,o,a,i],"hsv"),t)}onPointerDown_(e){this.handlePointerEvent_(e.data,{forceEmit:!1,last:!1})}onPointerMove_(e){this.handlePointerEvent_(e.data,{forceEmit:!1,last:!1})}onPointerUp_(e){this.handlePointerEvent_(e.data,{forceEmit:!0,last:!0})}onKeyDown_(e){const t=wi(qa(!0),Bs(e));if(t===0)return;const i=this.value.rawValue,[r,s,o,a]=i.getComponents("hsv");this.value.setRawValue(new Rt([r,s,o,a+t],"hsv"),{forceEmit:!1,last:!1})}onKeyUp_(e){wi(qa(!0),Bs(e))!==0&&this.value.setRawValue(this.value.rawValue,{forceEmit:!0,last:!0})}}const Fl=Ct("coltxt");function RJ(n){const e=n.createElement("select"),t=[{text:"RGB",value:"rgb"},{text:"HSL",value:"hsl"},{text:"HSV",value:"hsv"},{text:"HEX",value:"hex"}];return e.appendChild(t.reduce((i,r)=>{const s=n.createElement("option");return s.textContent=r.text,s.value=r.value,i.appendChild(s),i},n.createDocumentFragment())),e}class LJ{constructor(e,t){this.element=e.createElement("div"),this.element.classList.add(Fl()),t.viewProps.bindClassModifiers(this.element);const i=e.createElement("div");i.classList.add(Fl("m")),this.modeElem_=RJ(e),this.modeElem_.classList.add(Fl("ms")),i.appendChild(this.modeSelectElement),t.viewProps.bindDisabled(this.modeElem_);const r=e.createElement("div");r.classList.add(Fl("mm")),r.appendChild(dg(e,"dropdown")),i.appendChild(r),this.element.appendChild(i);const s=e.createElement("div");s.classList.add(Fl("w")),this.element.appendChild(s),this.inputsElem_=s,this.inputViews_=t.inputViews,this.applyInputViews_(),Ls(t.mode,o=>{this.modeElem_.value=o})}get modeSelectElement(){return this.modeElem_}get inputViews(){return this.inputViews_}set inputViews(e){this.inputViews_=e,this.applyInputViews_()}applyInputViews_(){sR(this.inputsElem_);const e=this.element.ownerDocument;this.inputViews_.forEach(t=>{const i=e.createElement("div");i.classList.add(Fl("c")),i.appendChild(t.element),this.inputsElem_.appendChild(i)})}}function OJ(n){return Ai(n==="float"?2:0)}function IJ(n,e,t){const i=Dc(n,e)[t];return new gd({min:0,max:i})}function DJ(n,e,t){return new wd(n,{arrayPosition:t===0?"fst":t===3-1?"lst":"mid",parser:e.parser,props:_t.fromObject({formatter:OJ(e.colorType),keyScale:qa(!1),pointerScale:e.colorType==="float"?.01:1}),value:nn(0,{constraint:IJ(e.colorMode,e.colorType,t)}),viewProps:e.viewProps})}function UJ(n,e){const t={colorMode:e.colorMode,colorType:e.colorType,parser:ks,viewProps:e.viewProps};return[0,1,2].map(i=>{const r=DJ(n,t,i);return Jc({primary:e.value,secondary:r.value,forward(s){return ci(s,e.colorType).getComponents(e.colorMode)[i]},backward(s,o){const a=e.colorMode,c=ci(s,e.colorType).getComponents(a);c[i]=o;const u=ix(pg(ls(c),c[3]),a,e.colorType);return ci(u,"int")}}),r})}function NJ(n,e){const t=new Qh(n,{parser:Md("int"),props:_t.fromObject({formatter:rx}),value:nn(Rt.black()),viewProps:e.viewProps});return Jc({primary:e.value,secondary:t.value,forward:i=>new Rt(ls(i.getComponents()),i.mode),backward:(i,r)=>new Rt(pg(ls(r.getComponents(i.mode)),i.getComponents()[3]),i.mode)}),[t]}function FJ(n){return n!=="hex"}class kJ{constructor(e,t){this.onModeSelectChange_=this.onModeSelectChange_.bind(this),this.colorType_=t.colorType,this.value=t.value,this.viewProps=t.viewProps,this.colorMode=nn(this.value.rawValue.mode),this.ccs_=this.createComponentControllers_(e),this.view=new LJ(e,{mode:this.colorMode,inputViews:[this.ccs_[0].view,this.ccs_[1].view,this.ccs_[2].view],viewProps:this.viewProps}),this.view.modeSelectElement.addEventListener("change",this.onModeSelectChange_)}createComponentControllers_(e){const t=this.colorMode.rawValue;return FJ(t)?UJ(e,{colorMode:t,colorType:this.colorType_,value:this.value,viewProps:this.viewProps}):NJ(e,{value:this.value,viewProps:this.viewProps})}onModeSelectChange_(e){const t=e.currentTarget;this.colorMode.rawValue=t.value,this.ccs_=this.createComponentControllers_(this.view.element.ownerDocument),this.view.inputViews=this.ccs_.map(i=>i.view)}}const Pv=Ct("hpl");class BJ{constructor(e,t){this.onValueChange_=this.onValueChange_.bind(this),this.value=t.value,this.value.emitter.on("change",this.onValueChange_),this.element=e.createElement("div"),this.element.classList.add(Pv()),t.viewProps.bindClassModifiers(this.element),t.viewProps.bindTabIndex(this.element);const i=e.createElement("div");i.classList.add(Pv("c")),this.element.appendChild(i);const r=e.createElement("div");r.classList.add(Pv("m")),this.element.appendChild(r),this.markerElem_=r,this.update_()}update_(){const e=this.value.rawValue,[t]=e.getComponents("hsv");this.markerElem_.style.backgroundColor=NR(new Rt([t,100,100],"hsv"));const i=Ot(t,0,360,0,100);this.markerElem_.style.left="".concat(i,"%")}onValueChange_(){this.update_()}}class zJ{constructor(e,t){this.onKeyDown_=this.onKeyDown_.bind(this),this.onKeyUp_=this.onKeyUp_.bind(this),this.onPointerDown_=this.onPointerDown_.bind(this),this.onPointerMove_=this.onPointerMove_.bind(this),this.onPointerUp_=this.onPointerUp_.bind(this),this.value=t.value,this.viewProps=t.viewProps,this.view=new BJ(e,{value:this.value,viewProps:this.viewProps}),this.ptHandler_=new hl(this.view.element),this.ptHandler_.emitter.on("down",this.onPointerDown_),this.ptHandler_.emitter.on("move",this.onPointerMove_),this.ptHandler_.emitter.on("up",this.onPointerUp_),this.view.element.addEventListener("keydown",this.onKeyDown_),this.view.element.addEventListener("keyup",this.onKeyUp_)}handlePointerEvent_(e,t){if(!e.point)return;const i=Ot(Ln(e.point.x,0,e.bounds.width),0,e.bounds.width,0,360),r=this.value.rawValue,[,s,o,a]=r.getComponents("hsv");this.value.setRawValue(new Rt([i,s,o,a],"hsv"),t)}onPointerDown_(e){this.handlePointerEvent_(e.data,{forceEmit:!1,last:!1})}onPointerMove_(e){this.handlePointerEvent_(e.data,{forceEmit:!1,last:!1})}onPointerUp_(e){this.handlePointerEvent_(e.data,{forceEmit:!0,last:!0})}onKeyDown_(e){const t=wi(qa(!1),Bs(e));if(t===0)return;const i=this.value.rawValue,[r,s,o,a]=i.getComponents("hsv");this.value.setRawValue(new Rt([r+t,s,o,a],"hsv"),{forceEmit:!1,last:!1})}onKeyUp_(e){wi(qa(!1),Bs(e))!==0&&this.value.setRawValue(this.value.rawValue,{forceEmit:!0,last:!0})}}const Rv=Ct("svp"),EE=64;class VJ{constructor(e,t){this.onValueChange_=this.onValueChange_.bind(this),this.value=t.value,this.value.emitter.on("change",this.onValueChange_),this.element=e.createElement("div"),this.element.classList.add(Rv()),t.viewProps.bindClassModifiers(this.element),t.viewProps.bindTabIndex(this.element);const i=e.createElement("canvas");i.height=EE,i.width=EE,i.classList.add(Rv("c")),this.element.appendChild(i),this.canvasElement=i;const r=e.createElement("div");r.classList.add(Rv("m")),this.element.appendChild(r),this.markerElem_=r,this.update_()}update_(){const e=HK(this.canvasElement);if(!e)return;const i=this.value.rawValue.getComponents("hsv"),r=this.canvasElement.width,s=this.canvasElement.height,o=e.getImageData(0,0,r,s),a=o.data;for(let u=0;u<s;u++)for(let h=0;h<r;h++){const d=Ot(h,0,r,0,100),f=Ot(u,0,s,100,0),p=wR(i[0],d,f),v=(u*r+h)*4;a[v]=p[0],a[v+1]=p[1],a[v+2]=p[2],a[v+3]=255}e.putImageData(o,0,0);const l=Ot(i[1],0,100,0,100);this.markerElem_.style.left="".concat(l,"%");const c=Ot(i[2],0,100,100,0);this.markerElem_.style.top="".concat(c,"%")}onValueChange_(){this.update_()}}class HJ{constructor(e,t){this.onKeyDown_=this.onKeyDown_.bind(this),this.onKeyUp_=this.onKeyUp_.bind(this),this.onPointerDown_=this.onPointerDown_.bind(this),this.onPointerMove_=this.onPointerMove_.bind(this),this.onPointerUp_=this.onPointerUp_.bind(this),this.value=t.value,this.viewProps=t.viewProps,this.view=new VJ(e,{value:this.value,viewProps:this.viewProps}),this.ptHandler_=new hl(this.view.element),this.ptHandler_.emitter.on("down",this.onPointerDown_),this.ptHandler_.emitter.on("move",this.onPointerMove_),this.ptHandler_.emitter.on("up",this.onPointerUp_),this.view.element.addEventListener("keydown",this.onKeyDown_),this.view.element.addEventListener("keyup",this.onKeyUp_)}handlePointerEvent_(e,t){if(!e.point)return;const i=Ot(e.point.x,0,e.bounds.width,0,100),r=Ot(e.point.y,0,e.bounds.height,100,0),[s,,,o]=this.value.rawValue.getComponents("hsv");this.value.setRawValue(new Rt([s,i,r,o],"hsv"),t)}onPointerDown_(e){this.handlePointerEvent_(e.data,{forceEmit:!1,last:!1})}onPointerMove_(e){this.handlePointerEvent_(e.data,{forceEmit:!1,last:!1})}onPointerUp_(e){this.handlePointerEvent_(e.data,{forceEmit:!0,last:!0})}onKeyDown_(e){_R(e.key)&&e.preventDefault();const[t,i,r,s]=this.value.rawValue.getComponents("hsv"),o=qa(!1),a=wi(o,Bs(e)),l=wi(o,ed(e));a===0&&l===0||this.value.setRawValue(new Rt([t,i+a,r+l,s],"hsv"),{forceEmit:!1,last:!1})}onKeyUp_(e){const t=qa(!1),i=wi(t,Bs(e)),r=wi(t,ed(e));i===0&&r===0||this.value.setRawValue(this.value.rawValue,{forceEmit:!0,last:!0})}}class GJ{constructor(e,t){this.value=t.value,this.viewProps=t.viewProps,this.hPaletteC_=new zJ(e,{value:this.value,viewProps:this.viewProps}),this.svPaletteC_=new HJ(e,{value:this.value,viewProps:this.viewProps}),this.alphaIcs_=t.supportsAlpha?{palette:new PJ(e,{value:this.value,viewProps:this.viewProps}),text:new wd(e,{parser:ks,props:_t.fromObject({pointerScale:.01,keyScale:.1,formatter:Ai(2)}),value:nn(0,{constraint:new gd({min:0,max:1})}),viewProps:this.viewProps})}:null,this.alphaIcs_&&Jc({primary:this.value,secondary:this.alphaIcs_.text.value,forward:i=>i.getComponents()[3],backward:(i,r)=>{const s=i.getComponents();return s[3]=r,new Rt(s,i.mode)}}),this.textsC_=new kJ(e,{colorType:t.colorType,value:this.value,viewProps:this.viewProps}),this.view=new rJ(e,{alphaViews:this.alphaIcs_?{palette:this.alphaIcs_.palette.view,text:this.alphaIcs_.text.view}:null,hPaletteView:this.hPaletteC_.view,supportsAlpha:t.supportsAlpha,svPaletteView:this.svPaletteC_.view,textsView:this.textsC_.view,viewProps:this.viewProps})}get textsController(){return this.textsC_}}const Lv=Ct("colsw");class WJ{constructor(e,t){this.onValueChange_=this.onValueChange_.bind(this),t.value.emitter.on("change",this.onValueChange_),this.value=t.value,this.element=e.createElement("div"),this.element.classList.add(Lv()),t.viewProps.bindClassModifiers(this.element);const i=e.createElement("div");i.classList.add(Lv("sw")),this.element.appendChild(i),this.swatchElem_=i;const r=e.createElement("button");r.classList.add(Lv("b")),t.viewProps.bindDisabled(r),this.element.appendChild(r),this.buttonElement=r,this.update_()}update_(){const e=this.value.rawValue;this.swatchElem_.style.backgroundColor=sx(e)}onValueChange_(){this.update_()}}class $J{constructor(e,t){this.value=t.value,this.viewProps=t.viewProps,this.view=new WJ(e,{value:this.value,viewProps:this.viewProps})}}class ox{constructor(e,t){this.onButtonBlur_=this.onButtonBlur_.bind(this),this.onButtonClick_=this.onButtonClick_.bind(this),this.onPopupChildBlur_=this.onPopupChildBlur_.bind(this),this.onPopupChildKeydown_=this.onPopupChildKeydown_.bind(this),this.value=t.value,this.viewProps=t.viewProps,this.foldable_=_d.create(t.expanded),this.swatchC_=new $J(e,{value:this.value,viewProps:this.viewProps});const i=this.swatchC_.view.buttonElement;i.addEventListener("blur",this.onButtonBlur_),i.addEventListener("click",this.onButtonClick_),this.textC_=new Qh(e,{parser:t.parser,props:_t.fromObject({formatter:t.formatter}),value:this.value,viewProps:this.viewProps}),this.view=new KZ(e,{foldable:this.foldable_,pickerLayout:t.pickerLayout}),this.view.swatchElement.appendChild(this.swatchC_.view.element),this.view.textElement.appendChild(this.textC_.view.element),this.popC_=t.pickerLayout==="popup"?new mR(e,{viewProps:this.viewProps}):null;const r=new GJ(e,{colorType:t.colorType,supportsAlpha:t.supportsAlpha,value:this.value,viewProps:this.viewProps});r.view.allFocusableElements.forEach(s=>{s.addEventListener("blur",this.onPopupChildBlur_),s.addEventListener("keydown",this.onPopupChildKeydown_)}),this.pickerC_=r,this.popC_?(this.view.element.appendChild(this.popC_.view.element),this.popC_.view.element.appendChild(r.view.element),Jc({primary:this.foldable_.value("expanded"),secondary:this.popC_.shows,forward:s=>s,backward:(s,o)=>o})):this.view.pickerElement&&(this.view.pickerElement.appendChild(this.pickerC_.view.element),Zb(this.foldable_,this.view.pickerElement))}get textController(){return this.textC_}onButtonBlur_(e){if(!this.popC_)return;const t=this.view.element,i=e.relatedTarget;(!i||!t.contains(i))&&(this.popC_.shows.rawValue=!1)}onButtonClick_(){this.foldable_.set("expanded",!this.foldable_.get("expanded")),this.foldable_.get("expanded")&&this.pickerC_.view.allFocusableElements[0].focus()}onPopupChildBlur_(e){if(!this.popC_)return;const t=this.popC_.view.element,i=oR(e);i&&t.contains(i)||i&&i===this.swatchC_.view.buttonElement&&!$b(t.ownerDocument)||(this.popC_.shows.rawValue=!1)}onPopupChildKeydown_(e){this.popC_?e.key==="Escape"&&(this.popC_.shows.rawValue=!1):this.view.pickerElement&&e.key==="Escape"&&this.swatchC_.view.buttonElement.focus()}}function jJ(n){return ls(n.getComponents("rgb")).reduce((e,t)=>e<<8|Math.floor(t)&255,0)}function XJ(n){return n.getComponents("rgb").reduce((e,t,i)=>{const r=Math.floor(i===3?t*255:t)&255;return e<<8|r},0)>>>0}function YJ(n){return new Rt([n>>16&255,n>>8&255,n&255],"rgb")}function qJ(n){return new Rt([n>>24&255,n>>16&255,n>>8&255,Ot(n&255,0,255,0,1)],"rgb")}function KJ(n){return typeof n!="number"?Rt.black():YJ(n)}function ZJ(n){return typeof n!="number"?Rt.black():qJ(n)}function bp(n,e){return typeof n!="object"||Gt(n)?!1:e in n&&typeof n[e]=="number"}function zR(n){return bp(n,"r")&&bp(n,"g")&&bp(n,"b")}function VR(n){return zR(n)&&bp(n,"a")}function HR(n){return zR(n)}function ax(n,e){if(n.mode!==e.mode||n.type!==e.type)return!1;const t=n.getComponents(),i=e.getComponents();for(let r=0;r<t.length;r++)if(t[r]!==i[r])return!1;return!0}function TE(n){return"a"in n?[n.r,n.g,n.b,n.a]:[n.r,n.g,n.b]}function JJ(n){const e=BR(n);return e?(t,i)=>{Sd(t,e(i))}:null}function QJ(n){const e=n?XJ:jJ;return(t,i)=>{Sd(t,e(i))}}function eQ(n,e,t){const r=ci(e,t).toRgbaObject();n.writeProperty("r",r.r),n.writeProperty("g",r.g),n.writeProperty("b",r.b),n.writeProperty("a",r.a)}function tQ(n,e,t){const r=ci(e,t).toRgbaObject();n.writeProperty("r",r.r),n.writeProperty("g",r.g),n.writeProperty("b",r.b)}function nQ(n,e){return(t,i)=>{n?eQ(t,i,e):tQ(t,i,e)}}function iQ(n){var e;return!!(!((e=n==null?void 0:n.color)===null||e===void 0)&&e.alpha)}function rQ(n){return n?e=>sx(e,"0x"):e=>rx(e,"0x")}function sQ(n){return"color"in n||n.view==="color"}const oQ=fi({id:"input-color-number",type:"input",accept:(n,e)=>{if(typeof n!="number"||!sQ(e))return null;const t=tx(e);return t?{initialValue:n,params:Object.assign(Object.assign({},t),{supportsAlpha:iQ(e)})}:null},binding:{reader:n=>n.params.supportsAlpha?ZJ:KJ,equals:ax,writer:n=>QJ(n.params.supportsAlpha)},controller:n=>{var e,t;return new ox(n.document,{colorType:"int",expanded:(e=n.params.expanded)!==null&&e!==void 0?e:!1,formatter:rQ(n.params.supportsAlpha),parser:Md("int"),pickerLayout:(t=n.params.picker)!==null&&t!==void 0?t:"popup",supportsAlpha:n.params.supportsAlpha,value:n.value,viewProps:n.viewProps})}});function aQ(n,e){if(!HR(n))return ci(Rt.black(),e);if(e==="int"){const t=TE(n);return new Rt(t,"rgb")}if(e==="float"){const t=TE(n);return new nx(t,"rgb")}return ci(Rt.black(),"int")}function lQ(n){return VR(n)}function cQ(n){return e=>{const t=aQ(e,n);return ci(t,"int")}}function uQ(n,e){return t=>n?kR(t,e):FR(t,e)}const hQ=fi({id:"input-color-object",type:"input",accept:(n,e)=>{var t;if(!HR(n))return null;const i=tx(e);return i?{initialValue:n,params:Object.assign(Object.assign({},i),{colorType:(t=ER(e))!==null&&t!==void 0?t:"int"})}:null},binding:{reader:n=>cQ(n.params.colorType),equals:ax,writer:n=>nQ(lQ(n.initialValue),n.params.colorType)},controller:n=>{var e,t;const i=VR(n.initialValue);return new ox(n.document,{colorType:n.params.colorType,expanded:(e=n.params.expanded)!==null&&e!==void 0?e:!1,formatter:uQ(i,n.params.colorType),parser:Md("int"),pickerLayout:(t=n.params.picker)!==null&&t!==void 0?t:"popup",supportsAlpha:i,value:n.value,viewProps:n.viewProps})}}),dQ=fi({id:"input-color-string",type:"input",accept:(n,e)=>{if(typeof n!="string"||e.view==="text")return null;const t=xJ(n,ER(e));if(!t)return null;const i=BR(t);if(!i)return null;const r=tx(e);return r?{initialValue:n,params:Object.assign(Object.assign({},r),{format:t,stringifier:i})}:null},binding:{reader:()=>wJ,equals:ax,writer:n=>{const e=JJ(n.params.format);if(!e)throw fn.notBindable();return e}},controller:n=>{var e,t;return new ox(n.document,{colorType:n.params.format.type,expanded:(e=n.params.expanded)!==null&&e!==void 0?e:!1,formatter:n.params.stringifier,parser:Md("int"),pickerLayout:(t=n.params.picker)!==null&&t!==void 0?t:"popup",supportsAlpha:n.params.format.alpha,value:n.value,viewProps:n.viewProps})}});class lx{constructor(e){this.components=e.components,this.asm_=e.assembly}constrain(e){const t=this.asm_.toComponents(e).map((i,r)=>{var s,o;return(o=(s=this.components[r])===null||s===void 0?void 0:s.constrain(i))!==null&&o!==void 0?o:i});return this.asm_.fromComponents(t)}}const AE=Ct("pndtxt");class fQ{constructor(e,t){this.textViews=t.textViews,this.element=e.createElement("div"),this.element.classList.add(AE()),this.textViews.forEach(i=>{const r=e.createElement("div");r.classList.add(AE("a")),r.appendChild(i.element),this.element.appendChild(r)})}}function pQ(n,e,t){return new wd(n,{arrayPosition:t===0?"fst":t===e.axes.length-1?"lst":"mid",parser:e.parser,props:e.axes[t].textProps,value:nn(0,{constraint:e.axes[t].constraint}),viewProps:e.viewProps})}class cx{constructor(e,t){this.value=t.value,this.viewProps=t.viewProps,this.acs_=t.axes.map((i,r)=>pQ(e,t,r)),this.acs_.forEach((i,r)=>{Jc({primary:this.value,secondary:i.value,forward:s=>t.assembly.toComponents(s)[r],backward:(s,o)=>{const a=t.assembly.toComponents(s);return a[r]=o,t.assembly.fromComponents(a)}})}),this.view=new fQ(e,{textViews:this.acs_.map(i=>i.view)})}get textControllers(){return this.acs_}}class mQ extends Jh{get max(){return this.controller.valueController.sliderController.props.get("max")}set max(e){this.controller.valueController.sliderController.props.set("max",e)}get min(){return this.controller.valueController.sliderController.props.get("min")}set min(e){this.controller.valueController.sliderController.props.set("min",e)}}function gQ(n,e){const t=[],i=Q3(n,e);i&&t.push(i);const r=eR(n);r&&t.push(r);const s=ex(n.options);return s&&t.push(s),new yd(t)}const vQ=fi({id:"input-number",type:"input",accept:(n,e)=>{if(typeof n!="number")return null;const t=on(e,i=>Object.assign(Object.assign({},nR(i)),{options:i.optional.custom(xd),readonly:i.optional.constant(!1)}));return t?{initialValue:n,params:t}:null},binding:{reader:n=>q3,constraint:n=>gQ(n.params,n.initialValue),writer:n=>Sd},controller:n=>{const e=n.value,t=n.constraint,i=t&&Yp(t,bd);if(i)return new ko(n.document,{props:new _t({options:i.values.value("options")}),value:e,viewProps:n.viewProps});const r=tR(n.params,e.rawValue),s=t&&Yp(t,gd);return s?new Kp(n.document,Object.assign(Object.assign({},yR(Object.assign(Object.assign({},r),{keyScale:nn(r.keyScale),max:s.values.value("max"),min:s.values.value("min")}))),{parser:ks,value:e,viewProps:n.viewProps})):new wd(n.document,{parser:ks,props:_t.fromObject(r),value:e,viewProps:n.viewProps})},api(n){return typeof n.controller.value.rawValue!="number"?null:n.controller.valueController instanceof Kp?new mQ(n.controller):n.controller.valueController instanceof ko?new Jb(n.controller):null}});class Ro{constructor(e=0,t=0){this.x=e,this.y=t}getComponents(){return[this.x,this.y]}static isObject(e){if(Gt(e))return!1;const t=e.x,i=e.y;return!(typeof t!="number"||typeof i!="number")}static equals(e,t){return e.x===t.x&&e.y===t.y}toObject(){return{x:this.x,y:this.y}}}const GR={toComponents:n=>n.getComponents(),fromComponents:n=>new Ro(...n)},kl=Ct("p2d");class _Q{constructor(e,t){this.element=e.createElement("div"),this.element.classList.add(kl()),t.viewProps.bindClassModifiers(this.element),Ls(t.expanded,qc(this.element,kl(void 0,"expanded")));const i=e.createElement("div");i.classList.add(kl("h")),this.element.appendChild(i);const r=e.createElement("button");r.classList.add(kl("b")),r.appendChild(dg(e,"p2dpad")),t.viewProps.bindDisabled(r),i.appendChild(r),this.buttonElement=r;const s=e.createElement("div");if(s.classList.add(kl("t")),i.appendChild(s),this.textElement=s,t.pickerLayout==="inline"){const o=e.createElement("div");o.classList.add(kl("p")),this.element.appendChild(o),this.pickerElement=o}else this.pickerElement=null}}const io=Ct("p2dp");class yQ{constructor(e,t){this.onFoldableChange_=this.onFoldableChange_.bind(this),this.onPropsChange_=this.onPropsChange_.bind(this),this.onValueChange_=this.onValueChange_.bind(this),this.props_=t.props,this.props_.emitter.on("change",this.onPropsChange_),this.element=e.createElement("div"),this.element.classList.add(io()),t.layout==="popup"&&this.element.classList.add(io(void 0,"p")),t.viewProps.bindClassModifiers(this.element);const i=e.createElement("div");i.classList.add(io("p")),t.viewProps.bindTabIndex(i),this.element.appendChild(i),this.padElement=i;const r=e.createElementNS(qr,"svg");r.classList.add(io("g")),this.padElement.appendChild(r),this.svgElem_=r;const s=e.createElementNS(qr,"line");s.classList.add(io("ax")),s.setAttributeNS(null,"x1","0"),s.setAttributeNS(null,"y1","50%"),s.setAttributeNS(null,"x2","100%"),s.setAttributeNS(null,"y2","50%"),this.svgElem_.appendChild(s);const o=e.createElementNS(qr,"line");o.classList.add(io("ax")),o.setAttributeNS(null,"x1","50%"),o.setAttributeNS(null,"y1","0"),o.setAttributeNS(null,"x2","50%"),o.setAttributeNS(null,"y2","100%"),this.svgElem_.appendChild(o);const a=e.createElementNS(qr,"line");a.classList.add(io("l")),a.setAttributeNS(null,"x1","50%"),a.setAttributeNS(null,"y1","50%"),this.svgElem_.appendChild(a),this.lineElem_=a;const l=e.createElement("div");l.classList.add(io("m")),this.padElement.appendChild(l),this.markerElem_=l,t.value.emitter.on("change",this.onValueChange_),this.value=t.value,this.update_()}get allFocusableElements(){return[this.padElement]}update_(){const[e,t]=this.value.rawValue.getComponents(),i=this.props_.get("max"),r=Ot(e,-i,+i,0,100),s=Ot(t,-i,+i,0,100),o=this.props_.get("invertsY")?100-s:s;this.lineElem_.setAttributeNS(null,"x2","".concat(r,"%")),this.lineElem_.setAttributeNS(null,"y2","".concat(o,"%")),this.markerElem_.style.left="".concat(r,"%"),this.markerElem_.style.top="".concat(o,"%")}onValueChange_(){this.update_()}onPropsChange_(){this.update_()}onFoldableChange_(){this.update_()}}function CE(n,e,t){return[wi(e[0],Bs(n)),wi(e[1],ed(n))*(t?1:-1)]}class bQ{constructor(e,t){this.onPadKeyDown_=this.onPadKeyDown_.bind(this),this.onPadKeyUp_=this.onPadKeyUp_.bind(this),this.onPointerDown_=this.onPointerDown_.bind(this),this.onPointerMove_=this.onPointerMove_.bind(this),this.onPointerUp_=this.onPointerUp_.bind(this),this.props=t.props,this.value=t.value,this.viewProps=t.viewProps,this.view=new yQ(e,{layout:t.layout,props:this.props,value:this.value,viewProps:this.viewProps}),this.ptHandler_=new hl(this.view.padElement),this.ptHandler_.emitter.on("down",this.onPointerDown_),this.ptHandler_.emitter.on("move",this.onPointerMove_),this.ptHandler_.emitter.on("up",this.onPointerUp_),this.view.padElement.addEventListener("keydown",this.onPadKeyDown_),this.view.padElement.addEventListener("keyup",this.onPadKeyUp_)}handlePointerEvent_(e,t){if(!e.point)return;const i=this.props.get("max"),r=Ot(e.point.x,0,e.bounds.width,-i,+i),s=Ot(this.props.get("invertsY")?e.bounds.height-e.point.y:e.point.y,0,e.bounds.height,-i,+i);this.value.setRawValue(new Ro(r,s),t)}onPointerDown_(e){this.handlePointerEvent_(e.data,{forceEmit:!1,last:!1})}onPointerMove_(e){this.handlePointerEvent_(e.data,{forceEmit:!1,last:!1})}onPointerUp_(e){this.handlePointerEvent_(e.data,{forceEmit:!0,last:!0})}onPadKeyDown_(e){_R(e.key)&&e.preventDefault();const[t,i]=CE(e,[this.props.get("xKeyScale"),this.props.get("yKeyScale")],this.props.get("invertsY"));t===0&&i===0||this.value.setRawValue(new Ro(this.value.rawValue.x+t,this.value.rawValue.y+i),{forceEmit:!1,last:!1})}onPadKeyUp_(e){const[t,i]=CE(e,[this.props.get("xKeyScale"),this.props.get("yKeyScale")],this.props.get("invertsY"));t===0&&i===0||this.value.setRawValue(this.value.rawValue,{forceEmit:!0,last:!0})}}class xQ{constructor(e,t){var i,r;this.onPopupChildBlur_=this.onPopupChildBlur_.bind(this),this.onPopupChildKeydown_=this.onPopupChildKeydown_.bind(this),this.onPadButtonBlur_=this.onPadButtonBlur_.bind(this),this.onPadButtonClick_=this.onPadButtonClick_.bind(this),this.value=t.value,this.viewProps=t.viewProps,this.foldable_=_d.create(t.expanded),this.popC_=t.pickerLayout==="popup"?new mR(e,{viewProps:this.viewProps}):null;const s=new bQ(e,{layout:t.pickerLayout,props:new _t({invertsY:nn(t.invertsY),max:nn(t.max),xKeyScale:t.axes[0].textProps.value("keyScale"),yKeyScale:t.axes[1].textProps.value("keyScale")}),value:this.value,viewProps:this.viewProps});s.view.allFocusableElements.forEach(o=>{o.addEventListener("blur",this.onPopupChildBlur_),o.addEventListener("keydown",this.onPopupChildKeydown_)}),this.pickerC_=s,this.textC_=new cx(e,{assembly:GR,axes:t.axes,parser:t.parser,value:this.value,viewProps:this.viewProps}),this.view=new _Q(e,{expanded:this.foldable_.value("expanded"),pickerLayout:t.pickerLayout,viewProps:this.viewProps}),this.view.textElement.appendChild(this.textC_.view.element),(i=this.view.buttonElement)===null||i===void 0||i.addEventListener("blur",this.onPadButtonBlur_),(r=this.view.buttonElement)===null||r===void 0||r.addEventListener("click",this.onPadButtonClick_),this.popC_?(this.view.element.appendChild(this.popC_.view.element),this.popC_.view.element.appendChild(this.pickerC_.view.element),Jc({primary:this.foldable_.value("expanded"),secondary:this.popC_.shows,forward:o=>o,backward:(o,a)=>a})):this.view.pickerElement&&(this.view.pickerElement.appendChild(this.pickerC_.view.element),Zb(this.foldable_,this.view.pickerElement))}get textController(){return this.textC_}onPadButtonBlur_(e){if(!this.popC_)return;const t=this.view.element,i=e.relatedTarget;(!i||!t.contains(i))&&(this.popC_.shows.rawValue=!1)}onPadButtonClick_(){this.foldable_.set("expanded",!this.foldable_.get("expanded")),this.foldable_.get("expanded")&&this.pickerC_.view.allFocusableElements[0].focus()}onPopupChildBlur_(e){if(!this.popC_)return;const t=this.popC_.view.element,i=oR(e);i&&t.contains(i)||i&&i===this.view.buttonElement&&!$b(t.ownerDocument)||(this.popC_.shows.rawValue=!1)}onPopupChildKeydown_(e){this.popC_?e.key==="Escape"&&(this.popC_.shows.rawValue=!1):this.view.pickerElement&&e.key==="Escape"&&this.view.buttonElement.focus()}}function wQ(n){return Ro.isObject(n)?new Ro(n.x,n.y):new Ro}function SQ(n,e){n.writeProperty("x",e.x),n.writeProperty("y",e.y)}function MQ(n,e){return new lx({assembly:GR,components:[As(Object.assign(Object.assign({},n),n.x),e.x),As(Object.assign(Object.assign({},n),n.y),e.y)]})}function PE(n,e){var t,i;if(!Gt(n.min)||!Gt(n.max))return Math.max(Math.abs((t=n.min)!==null&&t!==void 0?t:0),Math.abs((i=n.max)!==null&&i!==void 0?i:0));const r=Z3(n);return Math.max(Math.abs(r)*10,Math.abs(e)*10)}function EQ(n,e){var t,i;const r=PE(Xa(n,(t=n.x)!==null&&t!==void 0?t:{}),e.x),s=PE(Xa(n,(i=n.y)!==null&&i!==void 0?i:{}),e.y);return Math.max(r,s)}function TQ(n){if(!("y"in n))return!1;const e=n.y;return e&&"inverted"in e?!!e.inverted:!1}const AQ=fi({id:"input-point2d",type:"input",accept:(n,e)=>{if(!Ro.isObject(n))return null;const t=on(e,i=>Object.assign(Object.assign({},td(i)),{expanded:i.optional.boolean,picker:i.optional.custom(xR),readonly:i.optional.constant(!1),x:i.optional.custom(xo),y:i.optional.object(Object.assign(Object.assign({},td(i)),{inverted:i.optional.boolean}))}));return t?{initialValue:n,params:t}:null},binding:{reader:()=>wQ,constraint:n=>MQ(n.params,n.initialValue),equals:Ro.equals,writer:()=>SQ},controller:n=>{var e,t;const i=n.document,r=n.value,s=n.constraint,o=[n.params.x,n.params.y];return new xQ(i,{axes:r.rawValue.getComponents().map((a,l)=>{var c;return Wb({constraint:s.components[l],initialValue:a,params:Xa(n.params,(c=o[l])!==null&&c!==void 0?c:{})})}),expanded:(e=n.params.expanded)!==null&&e!==void 0?e:!1,invertsY:TQ(n.params),max:EQ(n.params,r.rawValue),parser:ks,pickerLayout:(t=n.params.picker)!==null&&t!==void 0?t:"popup",value:r,viewProps:n.viewProps})}});class pc{constructor(e=0,t=0,i=0){this.x=e,this.y=t,this.z=i}getComponents(){return[this.x,this.y,this.z]}static isObject(e){if(Gt(e))return!1;const t=e.x,i=e.y,r=e.z;return!(typeof t!="number"||typeof i!="number"||typeof r!="number")}static equals(e,t){return e.x===t.x&&e.y===t.y&&e.z===t.z}toObject(){return{x:this.x,y:this.y,z:this.z}}}const WR={toComponents:n=>n.getComponents(),fromComponents:n=>new pc(...n)};function CQ(n){return pc.isObject(n)?new pc(n.x,n.y,n.z):new pc}function PQ(n,e){n.writeProperty("x",e.x),n.writeProperty("y",e.y),n.writeProperty("z",e.z)}function RQ(n,e){return new lx({assembly:WR,components:[As(Object.assign(Object.assign({},n),n.x),e.x),As(Object.assign(Object.assign({},n),n.y),e.y),As(Object.assign(Object.assign({},n),n.z),e.z)]})}const LQ=fi({id:"input-point3d",type:"input",accept:(n,e)=>{if(!pc.isObject(n))return null;const t=on(e,i=>Object.assign(Object.assign({},td(i)),{readonly:i.optional.constant(!1),x:i.optional.custom(xo),y:i.optional.custom(xo),z:i.optional.custom(xo)}));return t?{initialValue:n,params:t}:null},binding:{reader:n=>CQ,constraint:n=>RQ(n.params,n.initialValue),equals:pc.equals,writer:n=>PQ},controller:n=>{const e=n.value,t=n.constraint,i=[n.params.x,n.params.y,n.params.z];return new cx(n.document,{assembly:WR,axes:e.rawValue.getComponents().map((r,s)=>{var o;return Wb({constraint:t.components[s],initialValue:r,params:Xa(n.params,(o=i[s])!==null&&o!==void 0?o:{})})}),parser:ks,value:e,viewProps:n.viewProps})}});class mc{constructor(e=0,t=0,i=0,r=0){this.x=e,this.y=t,this.z=i,this.w=r}getComponents(){return[this.x,this.y,this.z,this.w]}static isObject(e){if(Gt(e))return!1;const t=e.x,i=e.y,r=e.z,s=e.w;return!(typeof t!="number"||typeof i!="number"||typeof r!="number"||typeof s!="number")}static equals(e,t){return e.x===t.x&&e.y===t.y&&e.z===t.z&&e.w===t.w}toObject(){return{x:this.x,y:this.y,z:this.z,w:this.w}}}const $R={toComponents:n=>n.getComponents(),fromComponents:n=>new mc(...n)};function OQ(n){return mc.isObject(n)?new mc(n.x,n.y,n.z,n.w):new mc}function IQ(n,e){n.writeProperty("x",e.x),n.writeProperty("y",e.y),n.writeProperty("z",e.z),n.writeProperty("w",e.w)}function DQ(n,e){return new lx({assembly:$R,components:[As(Object.assign(Object.assign({},n),n.x),e.x),As(Object.assign(Object.assign({},n),n.y),e.y),As(Object.assign(Object.assign({},n),n.z),e.z),As(Object.assign(Object.assign({},n),n.w),e.w)]})}const UQ=fi({id:"input-point4d",type:"input",accept:(n,e)=>{if(!mc.isObject(n))return null;const t=on(e,i=>Object.assign(Object.assign({},td(i)),{readonly:i.optional.constant(!1),w:i.optional.custom(xo),x:i.optional.custom(xo),y:i.optional.custom(xo),z:i.optional.custom(xo)}));return t?{initialValue:n,params:t}:null},binding:{reader:n=>OQ,constraint:n=>DQ(n.params,n.initialValue),equals:mc.equals,writer:n=>IQ},controller:n=>{const e=n.value,t=n.constraint,i=[n.params.x,n.params.y,n.params.z,n.params.w];return new cx(n.document,{assembly:$R,axes:e.rawValue.getComponents().map((r,s)=>{var o;return Wb({constraint:t.components[s],initialValue:r,params:Xa(n.params,(o=i[s])!==null&&o!==void 0?o:{})})}),parser:ks,value:e,viewProps:n.viewProps})}});function NQ(n){const e=[],t=ex(n.options);return t&&e.push(t),new yd(e)}const FQ=fi({id:"input-string",type:"input",accept:(n,e)=>{if(typeof n!="string")return null;const t=on(e,i=>({readonly:i.optional.constant(!1),options:i.optional.custom(xd)}));return t?{initialValue:n,params:t}:null},binding:{reader:n=>vR,constraint:n=>NQ(n.params),writer:n=>Sd},controller:n=>{const e=n.document,t=n.value,i=n.constraint,r=i&&Yp(i,bd);return r?new ko(e,{props:new _t({options:r.values.value("options")}),value:t,viewProps:n.viewProps}):new Qh(e,{parser:s=>s,props:_t.fromObject({formatter:C_}),value:t,viewProps:n.viewProps})},api(n){return typeof n.controller.value.rawValue!="string"?null:n.controller.valueController instanceof ko?new Jb(n.controller):null}}),Ed={monitor:{defaultInterval:200,defaultRows:3}},RE=Ct("mll");class kQ{constructor(e,t){this.onValueUpdate_=this.onValueUpdate_.bind(this),this.formatter_=t.formatter,this.element=e.createElement("div"),this.element.classList.add(RE()),t.viewProps.bindClassModifiers(this.element);const i=e.createElement("textarea");i.classList.add(RE("i")),i.style.height="calc(var(".concat(bR("containerUnitSize"),") * ").concat(t.rows,")"),i.readOnly=!0,t.viewProps.bindDisabled(i),this.element.appendChild(i),this.textareaElem_=i,t.value.emitter.on("change",this.onValueUpdate_),this.value=t.value,this.update_()}update_(){const e=this.textareaElem_,t=e.scrollTop===e.scrollHeight-e.clientHeight,i=[];this.value.rawValue.forEach(r=>{r!==void 0&&i.push(this.formatter_(r))}),e.textContent=i.join("\n"),t&&(e.scrollTop=e.scrollHeight)}onValueUpdate_(){this.update_()}}class ux{constructor(e,t){this.value=t.value,this.viewProps=t.viewProps,this.view=new kQ(e,{formatter:t.formatter,rows:t.rows,value:this.value,viewProps:this.viewProps})}}const LE=Ct("sgl");class BQ{constructor(e,t){this.onValueUpdate_=this.onValueUpdate_.bind(this),this.formatter_=t.formatter,this.element=e.createElement("div"),this.element.classList.add(LE()),t.viewProps.bindClassModifiers(this.element);const i=e.createElement("input");i.classList.add(LE("i")),i.readOnly=!0,i.type="text",t.viewProps.bindDisabled(i),this.element.appendChild(i),this.inputElement=i,t.value.emitter.on("change",this.onValueUpdate_),this.value=t.value,this.update_()}update_(){const e=this.value.rawValue,t=e[e.length-1];this.inputElement.value=t!==void 0?this.formatter_(t):""}onValueUpdate_(){this.update_()}}class hx{constructor(e,t){this.value=t.value,this.viewProps=t.viewProps,this.view=new BQ(e,{formatter:t.formatter,value:this.value,viewProps:this.viewProps})}}const zQ=fi({id:"monitor-bool",type:"monitor",accept:(n,e)=>{if(typeof n!="boolean")return null;const t=on(e,i=>({readonly:i.required.constant(!0),rows:i.optional.number}));return t?{initialValue:n,params:t}:null},binding:{reader:n=>gR},controller:n=>{var e;return n.value.rawValue.length===1?new hx(n.document,{formatter:xE,value:n.value,viewProps:n.viewProps}):new ux(n.document,{formatter:xE,rows:(e=n.params.rows)!==null&&e!==void 0?e:Ed.monitor.defaultRows,value:n.value,viewProps:n.viewProps})}});class VQ extends Jh{get max(){return this.controller.valueController.props.get("max")}set max(e){this.controller.valueController.props.set("max",e)}get min(){return this.controller.valueController.props.get("min")}set min(e){this.controller.valueController.props.set("min",e)}}const ro=Ct("grl");class HQ{constructor(e,t){this.onCursorChange_=this.onCursorChange_.bind(this),this.onValueUpdate_=this.onValueUpdate_.bind(this),this.element=e.createElement("div"),this.element.classList.add(ro()),t.viewProps.bindClassModifiers(this.element),this.formatter_=t.formatter,this.props_=t.props,this.cursor_=t.cursor,this.cursor_.emitter.on("change",this.onCursorChange_);const i=e.createElementNS(qr,"svg");i.classList.add(ro("g")),i.style.height="calc(var(".concat(bR("containerUnitSize"),") * ").concat(t.rows,")"),this.element.appendChild(i),this.svgElem_=i;const r=e.createElementNS(qr,"polyline");this.svgElem_.appendChild(r),this.lineElem_=r;const s=e.createElement("div");s.classList.add(ro("t"),Ct("tt")()),this.element.appendChild(s),this.tooltipElem_=s,t.value.emitter.on("change",this.onValueUpdate_),this.value=t.value,this.update_()}get graphElement(){return this.svgElem_}update_(){const e=this.svgElem_.getBoundingClientRect(),t=this.value.rawValue.length-1,i=this.props_.get("min"),r=this.props_.get("max"),s=[];this.value.rawValue.forEach((u,h)=>{if(u===void 0)return;const d=Ot(h,0,t,0,e.width),f=Ot(u,i,r,e.height,0);s.push([d,f].join(","))}),this.lineElem_.setAttributeNS(null,"points",s.join(" "));const o=this.tooltipElem_,a=this.value.rawValue[this.cursor_.rawValue];if(a===void 0){o.classList.remove(ro("t","a"));return}const l=Ot(this.cursor_.rawValue,0,t,0,e.width),c=Ot(a,i,r,e.height,0);o.style.left="".concat(l,"px"),o.style.top="".concat(c,"px"),o.textContent="".concat(this.formatter_(a)),o.classList.contains(ro("t","a"))||(o.classList.add(ro("t","a"),ro("t","in")),Xp(o),o.classList.remove(ro("t","in")))}onValueUpdate_(){this.update_()}onCursorChange_(){this.update_()}}class jR{constructor(e,t){if(this.onGraphMouseMove_=this.onGraphMouseMove_.bind(this),this.onGraphMouseLeave_=this.onGraphMouseLeave_.bind(this),this.onGraphPointerDown_=this.onGraphPointerDown_.bind(this),this.onGraphPointerMove_=this.onGraphPointerMove_.bind(this),this.onGraphPointerUp_=this.onGraphPointerUp_.bind(this),this.props=t.props,this.value=t.value,this.viewProps=t.viewProps,this.cursor_=nn(-1),this.view=new HQ(e,{cursor:this.cursor_,formatter:t.formatter,rows:t.rows,props:this.props,value:this.value,viewProps:this.viewProps}),!$b(e))this.view.element.addEventListener("mousemove",this.onGraphMouseMove_),this.view.element.addEventListener("mouseleave",this.onGraphMouseLeave_);else{const i=new hl(this.view.element);i.emitter.on("down",this.onGraphPointerDown_),i.emitter.on("move",this.onGraphPointerMove_),i.emitter.on("up",this.onGraphPointerUp_)}}importProps(e){return Wi(e,null,t=>({max:t.required.number,min:t.required.number}),t=>(this.props.set("max",t.max),this.props.set("min",t.min),!0))}exportProps(){return $i(null,{max:this.props.get("max"),min:this.props.get("min")})}onGraphMouseLeave_(){this.cursor_.rawValue=-1}onGraphMouseMove_(e){const t=this.view.element.getBoundingClientRect();this.cursor_.rawValue=Math.floor(Ot(e.offsetX,0,t.width,0,this.value.rawValue.length))}onGraphPointerDown_(e){this.onGraphPointerMove_(e)}onGraphPointerMove_(e){if(!e.data.point){this.cursor_.rawValue=-1;return}this.cursor_.rawValue=Math.floor(Ot(e.data.point.x,0,e.data.bounds.width,0,this.value.rawValue.length))}onGraphPointerUp_(){this.cursor_.rawValue=-1}}function P_(n){return Gt(n.format)?Ai(2):n.format}function GQ(n){var e;return n.value.rawValue.length===1?new hx(n.document,{formatter:P_(n.params),value:n.value,viewProps:n.viewProps}):new ux(n.document,{formatter:P_(n.params),rows:(e=n.params.rows)!==null&&e!==void 0?e:Ed.monitor.defaultRows,value:n.value,viewProps:n.viewProps})}function WQ(n){var e,t,i;return new jR(n.document,{formatter:P_(n.params),rows:(e=n.params.rows)!==null&&e!==void 0?e:Ed.monitor.defaultRows,props:_t.fromObject({max:(t=n.params.max)!==null&&t!==void 0?t:100,min:(i=n.params.min)!==null&&i!==void 0?i:0}),value:n.value,viewProps:n.viewProps})}function OE(n){return n.view==="graph"}const $Q=fi({id:"monitor-number",type:"monitor",accept:(n,e)=>{if(typeof n!="number")return null;const t=on(e,i=>({format:i.optional.function,max:i.optional.number,min:i.optional.number,readonly:i.required.constant(!0),rows:i.optional.number,view:i.optional.string}));return t?{initialValue:n,params:t}:null},binding:{defaultBufferSize:n=>OE(n)?64:1,reader:n=>q3},controller:n=>OE(n.params)?WQ(n):GQ(n),api:n=>n.controller.valueController instanceof jR?new VQ(n.controller):null}),jQ=fi({id:"monitor-string",type:"monitor",accept:(n,e)=>{if(typeof n!="string")return null;const t=on(e,i=>({multiline:i.optional.boolean,readonly:i.required.constant(!0),rows:i.optional.number}));return t?{initialValue:n,params:t}:null},binding:{reader:n=>vR},controller:n=>{var e;const t=n.value;return t.rawValue.length>1||n.params.multiline?new ux(n.document,{formatter:C_,rows:(e=n.params.rows)!==null&&e!==void 0?e:Ed.monitor.defaultRows,value:t,viewProps:n.viewProps}):new hx(n.document,{formatter:C_,value:t,viewProps:n.viewProps})}});class XQ{constructor(){this.map_=new Map}get(e){var t;return(t=this.map_.get(e))!==null&&t!==void 0?t:null}has(e){return this.map_.has(e)}add(e,t){return this.map_.set(e,t),e.viewProps.handleDispose(()=>{this.map_.delete(e)}),t}}class YQ{constructor(e){this.target=e.target,this.reader_=e.reader,this.writer_=e.writer}read(){return this.reader_(this.target.read())}write(e){this.writer_(this.target,e)}inject(e){this.write(this.reader_(e))}}function qQ(n,e){var t;const i=n.accept(e.target.read(),e.params);if(Gt(i))return null;const r={target:e.target,initialValue:i.initialValue,params:i.params},s=on(e.params,h=>({disabled:h.optional.boolean,hidden:h.optional.boolean,label:h.optional.string,tag:h.optional.string})),o=n.binding.reader(r),a=n.binding.constraint?n.binding.constraint(r):void 0,l=new YQ({reader:o,target:e.target,writer:n.binding.writer(r)}),c=new DK(nn(o(i.initialValue),{constraint:a,equals:n.binding.equals}),l),u=n.controller({constraint:a,document:e.document,initialValue:i.initialValue,params:i.params,value:c,viewProps:Ws.create({disabled:s==null?void 0:s.disabled,hidden:s==null?void 0:s.hidden})});return new qK(e.document,{blade:Zc(),props:_t.fromObject({label:"label"in e.params?(t=s==null?void 0:s.label)!==null&&t!==void 0?t:null:e.target.key}),tag:s==null?void 0:s.tag,value:c,valueController:u})}class KQ{constructor(e){this.target=e.target,this.reader_=e.reader}read(){return this.reader_(this.target.read())}}function ZQ(n,e){return e===0?new LZ:new OZ(n,e!=null?e:Ed.monitor.defaultInterval)}function JQ(n,e){var t,i,r;const s=n.accept(e.target.read(),e.params);if(Gt(s))return null;const o={target:e.target,initialValue:s.initialValue,params:s.params},a=on(e.params,d=>({bufferSize:d.optional.number,disabled:d.optional.boolean,hidden:d.optional.boolean,interval:d.optional.number,label:d.optional.string})),l=n.binding.reader(o),c=(i=(t=a==null?void 0:a.bufferSize)!==null&&t!==void 0?t:n.binding.defaultBufferSize&&n.binding.defaultBufferSize(s.params))!==null&&i!==void 0?i:1,u=new eZ({binding:new KQ({reader:l,target:e.target}),bufferSize:c,ticker:ZQ(e.document,a==null?void 0:a.interval)}),h=n.controller({document:e.document,params:s.params,value:u,viewProps:Ws.create({disabled:a==null?void 0:a.disabled,hidden:a==null?void 0:a.hidden})});return h.viewProps.bindDisabled(u.ticker),h.viewProps.handleDispose(()=>{u.ticker.dispose()}),new nZ(e.document,{blade:Zc(),props:_t.fromObject({label:"label"in e.params?(r=a==null?void 0:a.label)!==null&&r!==void 0?r:null:e.target.key}),value:u,valueController:h})}class QQ{constructor(e){this.pluginsMap_={blades:[],inputs:[],monitors:[]},this.apiCache_=e}getAll(){return[...this.pluginsMap_.blades,...this.pluginsMap_.inputs,...this.pluginsMap_.monitors]}register(e,t){if(!$Z(t.core))throw fn.notCompatible(e,t.id);t.type==="blade"?this.pluginsMap_.blades.unshift(t):t.type==="input"?this.pluginsMap_.inputs.unshift(t):t.type==="monitor"&&this.pluginsMap_.monitors.unshift(t)}createInput_(e,t,i){return this.pluginsMap_.inputs.reduce((r,s)=>r!=null?r:qQ(s,{document:e,target:t,params:i}),null)}createMonitor_(e,t,i){return this.pluginsMap_.monitors.reduce((r,s)=>r!=null?r:JQ(s,{document:e,params:i,target:t}),null)}createBinding(e,t,i){const r=t.read();if(Gt(r))throw new fn({context:{key:t.key},type:"nomatchingcontroller"});const s=this.createInput_(e,t,i);if(s)return s;const o=this.createMonitor_(e,t,i);if(o)return o;throw new fn({context:{key:t.key},type:"nomatchingcontroller"})}createBlade(e,t){const i=this.pluginsMap_.blades.reduce((r,s)=>r!=null?r:RZ(s,{document:e,params:t}),null);if(!i)throw new fn({type:"nomatchingview",context:{params:t}});return i}createInputBindingApi_(e){const t=this.pluginsMap_.inputs.reduce((i,r)=>{var s,o;return i||((o=(s=r.api)===null||s===void 0?void 0:s.call(r,{controller:e}))!==null&&o!==void 0?o:null)},null);return this.apiCache_.add(e,t!=null?t:new Jh(e))}createMonitorBindingApi_(e){const t=this.pluginsMap_.monitors.reduce((i,r)=>{var s,o;return i||((o=(s=r.api)===null||s===void 0?void 0:s.call(r,{controller:e}))!==null&&o!==void 0?o:null)},null);return this.apiCache_.add(e,t!=null?t:new Jh(e))}createBindingApi(e){if(this.apiCache_.has(e))return this.apiCache_.get(e);if(KK(e))return this.createInputBindingApi_(e);if(iZ(e))return this.createMonitorBindingApi_(e);throw fn.shouldNeverHappen()}createApi(e){if(this.apiCache_.has(e))return this.apiCache_.get(e);if(YK(e))return this.createBindingApi(e);const t=this.pluginsMap_.blades.reduce((i,r)=>i!=null?i:r.api({controller:e,pool:this}),null);if(!t)throw fn.shouldNeverHappen();return this.apiCache_.add(e,t)}}const eee=new XQ;function tee(){const n=new QQ(eee);return[AQ,LQ,UQ,FQ,vQ,dQ,hQ,oQ,qZ,zQ,jQ,$Q,lZ,xZ,pR].forEach(e=>{n.register("core",e)}),n}class nee extends ul{constructor(e){super(e),this.emitter_=new Cn,this.controller.value.emitter.on("change",t=>{this.emitter_.emit("change",new vd(this,t.rawValue))})}get label(){return this.controller.labelController.props.get("label")}set label(e){this.controller.labelController.props.set("label",e)}get options(){return this.controller.valueController.props.get("options")}set options(e){this.controller.valueController.props.set("options",e)}get value(){return this.controller.value.rawValue}set value(e){this.controller.value.rawValue=e}on(e,t){const i=t.bind(this);return this.emitter_.on(e,r=>{i(r)}),this}}class iee extends ul{}class ree extends ul{constructor(e){super(e),this.emitter_=new Cn,this.controller.value.emitter.on("change",t=>{this.emitter_.emit("change",new vd(this,t.rawValue))})}get label(){return this.controller.labelController.props.get("label")}set label(e){this.controller.labelController.props.set("label",e)}get max(){return this.controller.valueController.sliderController.props.get("max")}set max(e){this.controller.valueController.sliderController.props.set("max",e)}get min(){return this.controller.valueController.sliderController.props.get("min")}set min(e){this.controller.valueController.sliderController.props.set("min",e)}get value(){return this.controller.value.rawValue}set value(e){this.controller.value.rawValue=e}on(e,t){const i=t.bind(this);return this.emitter_.on(e,r=>{i(r)}),this}}class see extends ul{constructor(e){super(e),this.emitter_=new Cn,this.controller.value.emitter.on("change",t=>{this.emitter_.emit("change",new vd(this,t.rawValue))})}get label(){return this.controller.labelController.props.get("label")}set label(e){this.controller.labelController.props.set("label",e)}get formatter(){return this.controller.valueController.props.get("formatter")}set formatter(e){this.controller.valueController.props.set("formatter",e)}get value(){return this.controller.value.rawValue}set value(e){this.controller.value.rawValue=e}on(e,t){const i=t.bind(this);return this.emitter_.on(e,r=>{i(r)}),this}}const oee=function(){return{id:"list",type:"blade",core:Kc,accept(n){const e=on(n,t=>({options:t.required.custom(xd),value:t.required.raw,view:t.required.constant("list"),label:t.optional.string}));return e?{params:e}:null},controller(n){const e=new bd(Qb(n.params.options)),t=nn(n.params.value,{constraint:e}),i=new ko(n.document,{props:new _t({options:e.values.value("options")}),value:t,viewProps:n.viewProps});return new Ya(n.document,{blade:n.blade,props:_t.fromObject({label:n.params.label}),value:t,valueController:i})},api(n){return!(n.controller instanceof Ya)||!(n.controller.valueController instanceof ko)?null:new nee(n.controller)}}}();class aee extends dR{constructor(e,t){super(e,t)}get element(){return this.controller.view.element}}class lee extends T_{constructor(e,t){super(e,{expanded:t.expanded,blade:t.blade,props:t.props,root:!0,viewProps:t.viewProps})}}const IE=Ct("spr");class cee{constructor(e,t){this.element=e.createElement("div"),this.element.classList.add(IE()),t.viewProps.bindClassModifiers(this.element);const i=e.createElement("hr");i.classList.add(IE("r")),this.element.appendChild(i)}}class DE extends fg{constructor(e,t){super(Object.assign(Object.assign({},t),{view:new cee(e,{viewProps:t.viewProps})}))}}const uee={id:"separator",type:"blade",core:Kc,accept(n){const e=on(n,t=>({view:t.required.constant("separator")}));return e?{params:e}:null},controller(n){return new DE(n.document,{blade:n.blade,viewProps:n.viewProps})},api(n){return n.controller instanceof DE?new iee(n.controller):null}},hee={id:"slider",type:"blade",core:Kc,accept(n){const e=on(n,t=>({max:t.required.number,min:t.required.number,view:t.required.constant("slider"),format:t.optional.function,label:t.optional.string,value:t.optional.number}));return e?{params:e}:null},controller(n){var e,t;const i=(e=n.params.value)!==null&&e!==void 0?e:0,r=new gd({max:n.params.max,min:n.params.min}),s=nn(i,{constraint:r}),o=new Kp(n.document,Object.assign(Object.assign({},yR({formatter:(t=n.params.format)!==null&&t!==void 0?t:RK,keyScale:nn(1),max:r.values.value("max"),min:r.values.value("min"),pointerScale:J3(n.params,i)})),{parser:ks,value:s,viewProps:n.viewProps}));return new Ya(n.document,{blade:n.blade,props:_t.fromObject({label:n.params.label}),value:s,valueController:o})},api(n){return!(n.controller instanceof Ya)||!(n.controller.valueController instanceof Kp)?null:new ree(n.controller)}},dee=function(){return{id:"text",type:"blade",core:Kc,accept(n){const e=on(n,t=>({parse:t.required.function,value:t.required.raw,view:t.required.constant("text"),format:t.optional.function,label:t.optional.string}));return e?{params:e}:null},controller(n){var e;const t=nn(n.params.value),i=new Qh(n.document,{parser:n.params.parse,props:_t.fromObject({formatter:(e=n.params.format)!==null&&e!==void 0?e:r=>String(r)}),value:t,viewProps:n.viewProps});return new Ya(n.document,{blade:n.blade,props:_t.fromObject({label:n.params.label}),value:t,valueController:i})},api(n){return!(n.controller instanceof Ya)||!(n.controller.valueController instanceof Qh)?null:new see(n.controller)}}}();function fee(n){const e=n.createElement("div");return e.classList.add(Ct("dfw")()),n.body&&n.body.appendChild(e),e}function pee(n,e,t){if(n.querySelector("style[data-tp-style=".concat(e,"]")))return;const i=n.createElement("style");i.dataset.tpStyle=e,i.textContent=t,n.head.appendChild(i)}class mee extends aee{constructor(e){var t,i;const r=e!=null?e:{},s=(t=r.document)!==null&&t!==void 0?t:VK(),o=tee(),a=new lee(s,{expanded:r.expanded,blade:Zc(),props:_t.fromObject({title:r.title}),viewProps:Ws.create()});super(a,o),this.pool_=o,this.containerElem_=(i=r.container)!==null&&i!==void 0?i:fee(s),this.containerElem_.appendChild(this.element),this.doc_=s,this.usesDefaultWrapper_=!r.container,this.setUpDefaultPlugins_()}get document(){if(!this.doc_)throw fn.alreadyDisposed();return this.doc_}dispose(){const e=this.containerElem_;if(!e)throw fn.alreadyDisposed();if(this.usesDefaultWrapper_){const t=e.parentElement;t&&t.removeChild(e)}this.containerElem_=null,this.doc_=null,super.dispose()}registerPlugin(e){e.css&&pee(this.document,"plugin-".concat(e.id),e.css),("plugin"in e?[e.plugin]:"plugins"in e?e.plugins:[]).forEach(i=>{this.pool_.register(e.id,i)})}setUpDefaultPlugins_(){this.registerPlugin({id:"default",css:'.tp-tbiv_b,.tp-coltxtv_ms,.tp-colswv_b,.tp-ckbv_i,.tp-sglv_i,.tp-mllv_i,.tp-grlv_g,.tp-txtv_i,.tp-p2dpv_p,.tp-colswv_sw,.tp-rotv_b,.tp-fldv_b,.tp-p2dv_b,.tp-btnv_b,.tp-lstv_s{-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:rgba(0,0,0,0);border-width:0;font-family:inherit;font-size:inherit;font-weight:inherit;margin:0;outline:none;padding:0}.tp-p2dv_b,.tp-btnv_b,.tp-lstv_s{background-color:var(--btn-bg);border-radius:var(--bld-br);color:var(--btn-fg);cursor:pointer;display:block;font-weight:bold;height:var(--cnt-usz);line-height:var(--cnt-usz);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.tp-p2dv_b:hover,.tp-btnv_b:hover,.tp-lstv_s:hover{background-color:var(--btn-bg-h)}.tp-p2dv_b:focus,.tp-btnv_b:focus,.tp-lstv_s:focus{background-color:var(--btn-bg-f)}.tp-p2dv_b:active,.tp-btnv_b:active,.tp-lstv_s:active{background-color:var(--btn-bg-a)}.tp-p2dv_b:disabled,.tp-btnv_b:disabled,.tp-lstv_s:disabled{opacity:.5}.tp-rotv_c>.tp-cntv.tp-v-lst,.tp-tbpv_c>.tp-cntv.tp-v-lst,.tp-fldv_c>.tp-cntv.tp-v-lst{margin-bottom:calc(-1 * var(--cnt-vp))}.tp-rotv_c>.tp-fldv.tp-v-lst .tp-fldv_c,.tp-tbpv_c>.tp-fldv.tp-v-lst .tp-fldv_c,.tp-fldv_c>.tp-fldv.tp-v-lst .tp-fldv_c{border-bottom-left-radius:0}.tp-rotv_c>.tp-fldv.tp-v-lst .tp-fldv_b,.tp-tbpv_c>.tp-fldv.tp-v-lst .tp-fldv_b,.tp-fldv_c>.tp-fldv.tp-v-lst .tp-fldv_b{border-bottom-left-radius:0}.tp-rotv_c>*:not(.tp-v-fst),.tp-tbpv_c>*:not(.tp-v-fst),.tp-fldv_c>*:not(.tp-v-fst){margin-top:var(--cnt-usp)}.tp-rotv_c>.tp-sprv:not(.tp-v-fst),.tp-tbpv_c>.tp-sprv:not(.tp-v-fst),.tp-fldv_c>.tp-sprv:not(.tp-v-fst),.tp-rotv_c>.tp-cntv:not(.tp-v-fst),.tp-tbpv_c>.tp-cntv:not(.tp-v-fst),.tp-fldv_c>.tp-cntv:not(.tp-v-fst){margin-top:var(--cnt-vp)}.tp-rotv_c>.tp-sprv+*:not(.tp-v-hidden),.tp-tbpv_c>.tp-sprv+*:not(.tp-v-hidden),.tp-fldv_c>.tp-sprv+*:not(.tp-v-hidden),.tp-rotv_c>.tp-cntv+*:not(.tp-v-hidden),.tp-tbpv_c>.tp-cntv+*:not(.tp-v-hidden),.tp-fldv_c>.tp-cntv+*:not(.tp-v-hidden){margin-top:var(--cnt-vp)}.tp-rotv_c>.tp-sprv:not(.tp-v-hidden)+.tp-sprv,.tp-tbpv_c>.tp-sprv:not(.tp-v-hidden)+.tp-sprv,.tp-fldv_c>.tp-sprv:not(.tp-v-hidden)+.tp-sprv,.tp-rotv_c>.tp-cntv:not(.tp-v-hidden)+.tp-cntv,.tp-tbpv_c>.tp-cntv:not(.tp-v-hidden)+.tp-cntv,.tp-fldv_c>.tp-cntv:not(.tp-v-hidden)+.tp-cntv{margin-top:0}.tp-tbpv_c>.tp-cntv,.tp-fldv_c>.tp-cntv{margin-left:4px}.tp-tbpv_c>.tp-fldv>.tp-fldv_b,.tp-fldv_c>.tp-fldv>.tp-fldv_b{border-top-left-radius:var(--bld-br);border-bottom-left-radius:var(--bld-br)}.tp-tbpv_c>.tp-fldv.tp-fldv-expanded>.tp-fldv_b,.tp-fldv_c>.tp-fldv.tp-fldv-expanded>.tp-fldv_b{border-bottom-left-radius:0}.tp-tbpv_c .tp-fldv>.tp-fldv_c,.tp-fldv_c .tp-fldv>.tp-fldv_c{border-bottom-left-radius:var(--bld-br)}.tp-tbpv_c>.tp-cntv+.tp-fldv>.tp-fldv_b,.tp-fldv_c>.tp-cntv+.tp-fldv>.tp-fldv_b{border-top-left-radius:0}.tp-tbpv_c>.tp-cntv+.tp-tabv>.tp-tabv_t,.tp-fldv_c>.tp-cntv+.tp-tabv>.tp-tabv_t{border-top-left-radius:0}.tp-tbpv_c>.tp-tabv>.tp-tabv_t,.tp-fldv_c>.tp-tabv>.tp-tabv_t{border-top-left-radius:var(--bld-br)}.tp-tbpv_c .tp-tabv>.tp-tabv_c,.tp-fldv_c .tp-tabv>.tp-tabv_c{border-bottom-left-radius:var(--bld-br)}.tp-rotv_b,.tp-fldv_b{background-color:var(--cnt-bg);color:var(--cnt-fg);cursor:pointer;display:block;height:calc(var(--cnt-usz) + 4px);line-height:calc(var(--cnt-usz) + 4px);overflow:hidden;padding-left:var(--cnt-hp);padding-right:calc( 2px * 2 + var(--cnt-usz) + var(--cnt-hp) );position:relative;text-align:left;text-overflow:ellipsis;white-space:nowrap;width:100%;transition:border-radius .2s ease-in-out .2s}.tp-rotv_b:hover,.tp-fldv_b:hover{background-color:var(--cnt-bg-h)}.tp-rotv_b:focus,.tp-fldv_b:focus{background-color:var(--cnt-bg-f)}.tp-rotv_b:active,.tp-fldv_b:active{background-color:var(--cnt-bg-a)}.tp-rotv_b:disabled,.tp-fldv_b:disabled{opacity:.5}.tp-rotv_m,.tp-fldv_m{background:linear-gradient(to left, var(--cnt-fg), var(--cnt-fg) 2px, transparent 2px, transparent 4px, var(--cnt-fg) 4px);border-radius:2px;bottom:0;content:"";display:block;height:6px;right:calc( var(--cnt-hp) + ( var(--cnt-usz) + 4px - 6px ) / 2 - 2px );margin:auto;opacity:.5;position:absolute;top:0;transform:rotate(90deg);transition:transform .2s ease-in-out;width:6px}.tp-rotv.tp-rotv-expanded .tp-rotv_m,.tp-fldv.tp-fldv-expanded>.tp-fldv_b>.tp-fldv_m{transform:none}.tp-rotv_c,.tp-fldv_c{box-sizing:border-box;height:0;opacity:0;overflow:hidden;padding-bottom:0;padding-top:0;position:relative;transition:height .2s ease-in-out,opacity .2s linear,padding .2s ease-in-out}.tp-rotv.tp-rotv-cpl:not(.tp-rotv-expanded) .tp-rotv_c,.tp-fldv.tp-fldv-cpl:not(.tp-fldv-expanded)>.tp-fldv_c{display:none}.tp-rotv.tp-rotv-expanded .tp-rotv_c,.tp-fldv.tp-fldv-expanded>.tp-fldv_c{opacity:1;padding-bottom:var(--cnt-vp);padding-top:var(--cnt-vp);transform:none;overflow:visible;transition:height .2s ease-in-out,opacity .2s linear .2s,padding .2s ease-in-out}.tp-txtv_i,.tp-p2dpv_p,.tp-colswv_sw{background-color:var(--in-bg);border-radius:var(--bld-br);box-sizing:border-box;color:var(--in-fg);font-family:inherit;height:var(--cnt-usz);line-height:var(--cnt-usz);min-width:0;width:100%}.tp-txtv_i:hover,.tp-p2dpv_p:hover,.tp-colswv_sw:hover{background-color:var(--in-bg-h)}.tp-txtv_i:focus,.tp-p2dpv_p:focus,.tp-colswv_sw:focus{background-color:var(--in-bg-f)}.tp-txtv_i:active,.tp-p2dpv_p:active,.tp-colswv_sw:active{background-color:var(--in-bg-a)}.tp-txtv_i:disabled,.tp-p2dpv_p:disabled,.tp-colswv_sw:disabled{opacity:.5}.tp-lstv,.tp-coltxtv_m{position:relative}.tp-lstv_s{padding:0 20px 0 4px;width:100%}.tp-lstv_m,.tp-coltxtv_mm{bottom:0;margin:auto;pointer-events:none;position:absolute;right:2px;top:0}.tp-lstv_m svg,.tp-coltxtv_mm svg{bottom:0;height:16px;margin:auto;position:absolute;right:0;top:0;width:16px}.tp-lstv_m svg path,.tp-coltxtv_mm svg path{fill:currentColor}.tp-sglv_i,.tp-mllv_i,.tp-grlv_g{background-color:var(--mo-bg);border-radius:var(--bld-br);box-sizing:border-box;color:var(--mo-fg);height:var(--cnt-usz);scrollbar-color:currentColor rgba(0,0,0,0);scrollbar-width:thin;width:100%}.tp-sglv_i::-webkit-scrollbar,.tp-mllv_i::-webkit-scrollbar,.tp-grlv_g::-webkit-scrollbar{height:8px;width:8px}.tp-sglv_i::-webkit-scrollbar-corner,.tp-mllv_i::-webkit-scrollbar-corner,.tp-grlv_g::-webkit-scrollbar-corner{background-color:rgba(0,0,0,0)}.tp-sglv_i::-webkit-scrollbar-thumb,.tp-mllv_i::-webkit-scrollbar-thumb,.tp-grlv_g::-webkit-scrollbar-thumb{background-clip:padding-box;background-color:currentColor;border:rgba(0,0,0,0) solid 2px;border-radius:4px}.tp-pndtxtv,.tp-coltxtv_w{display:flex}.tp-pndtxtv_a,.tp-coltxtv_c{width:100%}.tp-pndtxtv_a+.tp-pndtxtv_a,.tp-coltxtv_c+.tp-pndtxtv_a,.tp-pndtxtv_a+.tp-coltxtv_c,.tp-coltxtv_c+.tp-coltxtv_c{margin-left:2px}.tp-rotv{--bs-bg: var(--tp-base-background-color, hsl(230, 7%, 17%));--bs-br: var(--tp-base-border-radius, 6px);--bs-ff: var(--tp-base-font-family, Roboto Mono, Source Code Pro, Menlo, Courier, monospace);--bs-sh: var(--tp-base-shadow-color, rgba(0, 0, 0, 0.2));--bld-br: var(--tp-blade-border-radius, 2px);--bld-hp: var(--tp-blade-horizontal-padding, 4px);--bld-vw: var(--tp-blade-value-width, 160px);--btn-bg: var(--tp-button-background-color, hsl(230, 7%, 70%));--btn-bg-a: var(--tp-button-background-color-active, #d6d7db);--btn-bg-f: var(--tp-button-background-color-focus, #c8cad0);--btn-bg-h: var(--tp-button-background-color-hover, #bbbcc4);--btn-fg: var(--tp-button-foreground-color, hsl(230, 7%, 17%));--cnt-bg: var(--tp-container-background-color, rgba(187, 188, 196, 0.1));--cnt-bg-a: var(--tp-container-background-color-active, rgba(187, 188, 196, 0.25));--cnt-bg-f: var(--tp-container-background-color-focus, rgba(187, 188, 196, 0.2));--cnt-bg-h: var(--tp-container-background-color-hover, rgba(187, 188, 196, 0.15));--cnt-fg: var(--tp-container-foreground-color, hsl(230, 7%, 75%));--cnt-hp: var(--tp-container-horizontal-padding, 4px);--cnt-vp: var(--tp-container-vertical-padding, 4px);--cnt-usp: var(--tp-container-unit-spacing, 4px);--cnt-usz: var(--tp-container-unit-size, 20px);--in-bg: var(--tp-input-background-color, rgba(187, 188, 196, 0.1));--in-bg-a: var(--tp-input-background-color-active, rgba(187, 188, 196, 0.25));--in-bg-f: var(--tp-input-background-color-focus, rgba(187, 188, 196, 0.2));--in-bg-h: var(--tp-input-background-color-hover, rgba(187, 188, 196, 0.15));--in-fg: var(--tp-input-foreground-color, hsl(230, 7%, 75%));--lbl-fg: var(--tp-label-foreground-color, rgba(187, 188, 196, 0.7));--mo-bg: var(--tp-monitor-background-color, rgba(0, 0, 0, 0.2));--mo-fg: var(--tp-monitor-foreground-color, rgba(187, 188, 196, 0.7));--grv-fg: var(--tp-groove-foreground-color, rgba(187, 188, 196, 0.1))}.tp-btnv_b{width:100%}.tp-btnv_t{text-align:center}.tp-ckbv_l{display:block;position:relative}.tp-ckbv_i{left:0;opacity:0;position:absolute;top:0}.tp-ckbv_w{background-color:var(--in-bg);border-radius:var(--bld-br);cursor:pointer;display:block;height:var(--cnt-usz);position:relative;width:var(--cnt-usz)}.tp-ckbv_w svg{bottom:0;display:block;height:16px;left:0;margin:auto;opacity:0;position:absolute;right:0;top:0;width:16px}.tp-ckbv_w svg path{fill:none;stroke:var(--in-fg);stroke-width:2}.tp-ckbv_i:hover+.tp-ckbv_w{background-color:var(--in-bg-h)}.tp-ckbv_i:focus+.tp-ckbv_w{background-color:var(--in-bg-f)}.tp-ckbv_i:active+.tp-ckbv_w{background-color:var(--in-bg-a)}.tp-ckbv_i:checked+.tp-ckbv_w svg{opacity:1}.tp-ckbv.tp-v-disabled .tp-ckbv_w{opacity:.5}.tp-colv{position:relative}.tp-colv_h{display:flex}.tp-colv_s{flex-grow:0;flex-shrink:0;width:var(--cnt-usz)}.tp-colv_t{flex:1;margin-left:4px}.tp-colv_p{height:0;margin-top:0;opacity:0;overflow:hidden;transition:height .2s ease-in-out,opacity .2s linear,margin .2s ease-in-out}.tp-colv.tp-colv-expanded.tp-colv-cpl .tp-colv_p{overflow:visible}.tp-colv.tp-colv-expanded .tp-colv_p{margin-top:var(--cnt-usp);opacity:1}.tp-colv .tp-popv{left:calc(-1 * var(--cnt-hp));right:calc(-1 * var(--cnt-hp));top:var(--cnt-usz)}.tp-colpv_h,.tp-colpv_ap{margin-left:6px;margin-right:6px}.tp-colpv_h{margin-top:var(--cnt-usp)}.tp-colpv_rgb{display:flex;margin-top:var(--cnt-usp);width:100%}.tp-colpv_a{display:flex;margin-top:var(--cnt-vp);padding-top:calc( var(--cnt-vp) + 2px );position:relative}.tp-colpv_a::before{background-color:var(--grv-fg);content:"";height:2px;left:calc(-1 * var(--cnt-hp));position:absolute;right:calc(-1 * var(--cnt-hp));top:0}.tp-colpv.tp-v-disabled .tp-colpv_a::before{opacity:.5}.tp-colpv_ap{align-items:center;display:flex;flex:3}.tp-colpv_at{flex:1;margin-left:4px}.tp-svpv{border-radius:var(--bld-br);outline:none;overflow:hidden;position:relative}.tp-svpv.tp-v-disabled{opacity:.5}.tp-svpv_c{cursor:crosshair;display:block;height:calc(var(--cnt-usz)*4);width:100%}.tp-svpv_m{border-radius:100%;border:rgba(255,255,255,.75) solid 2px;box-sizing:border-box;filter:drop-shadow(0 0 1px rgba(0, 0, 0, 0.3));height:12px;margin-left:-6px;margin-top:-6px;pointer-events:none;position:absolute;width:12px}.tp-svpv:focus .tp-svpv_m{border-color:#fff}.tp-hplv{cursor:pointer;height:var(--cnt-usz);outline:none;position:relative}.tp-hplv.tp-v-disabled{opacity:.5}.tp-hplv_c{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAAABCAYAAABubagXAAAAQ0lEQVQoU2P8z8Dwn0GCgQEDi2OK/RBgYHjBgIpfovFh8j8YBIgzFGQxuqEgPhaDOT5gOhPkdCxOZeBg+IDFZZiGAgCaSSMYtcRHLgAAAABJRU5ErkJggg==);background-position:left top;background-repeat:no-repeat;background-size:100% 100%;border-radius:2px;display:block;height:4px;left:0;margin-top:-2px;position:absolute;top:50%;width:100%}.tp-hplv_m{border-radius:var(--bld-br);border:rgba(255,255,255,.75) solid 2px;box-shadow:0 0 2px rgba(0,0,0,.1);box-sizing:border-box;height:12px;left:50%;margin-left:-6px;margin-top:-6px;pointer-events:none;position:absolute;top:50%;width:12px}.tp-hplv:focus .tp-hplv_m{border-color:#fff}.tp-aplv{cursor:pointer;height:var(--cnt-usz);outline:none;position:relative;width:100%}.tp-aplv.tp-v-disabled{opacity:.5}.tp-aplv_b{background-color:#fff;background-image:linear-gradient(to top right, #ddd 25%, transparent 25%, transparent 75%, #ddd 75%),linear-gradient(to top right, #ddd 25%, transparent 25%, transparent 75%, #ddd 75%);background-size:4px 4px;background-position:0 0,2px 2px;border-radius:2px;display:block;height:4px;left:0;margin-top:-2px;overflow:hidden;position:absolute;top:50%;width:100%}.tp-aplv_c{bottom:0;left:0;position:absolute;right:0;top:0}.tp-aplv_m{background-color:#fff;background-image:linear-gradient(to top right, #ddd 25%, transparent 25%, transparent 75%, #ddd 75%),linear-gradient(to top right, #ddd 25%, transparent 25%, transparent 75%, #ddd 75%);background-size:12px 12px;background-position:0 0,6px 6px;border-radius:var(--bld-br);box-shadow:0 0 2px rgba(0,0,0,.1);height:12px;left:50%;margin-left:-6px;margin-top:-6px;overflow:hidden;pointer-events:none;position:absolute;top:50%;width:12px}.tp-aplv_p{border-radius:var(--bld-br);border:rgba(255,255,255,.75) solid 2px;box-sizing:border-box;bottom:0;left:0;position:absolute;right:0;top:0}.tp-aplv:focus .tp-aplv_p{border-color:#fff}.tp-colswv{background-color:#fff;background-image:linear-gradient(to top right, #ddd 25%, transparent 25%, transparent 75%, #ddd 75%),linear-gradient(to top right, #ddd 25%, transparent 25%, transparent 75%, #ddd 75%);background-size:10px 10px;background-position:0 0,5px 5px;border-radius:var(--bld-br);overflow:hidden}.tp-colswv.tp-v-disabled{opacity:.5}.tp-colswv_sw{border-radius:0}.tp-colswv_b{cursor:pointer;display:block;height:var(--cnt-usz);left:0;position:absolute;top:0;width:var(--cnt-usz)}.tp-colswv_b:focus::after{border:rgba(255,255,255,.75) solid 2px;border-radius:var(--bld-br);bottom:0;content:"";display:block;left:0;position:absolute;right:0;top:0}.tp-coltxtv{display:flex;width:100%}.tp-coltxtv_m{margin-right:4px}.tp-coltxtv_ms{border-radius:var(--bld-br);color:var(--lbl-fg);cursor:pointer;height:var(--cnt-usz);line-height:var(--cnt-usz);padding:0 18px 0 4px}.tp-coltxtv_ms:hover{background-color:var(--in-bg-h)}.tp-coltxtv_ms:focus{background-color:var(--in-bg-f)}.tp-coltxtv_ms:active{background-color:var(--in-bg-a)}.tp-coltxtv_mm{color:var(--lbl-fg)}.tp-coltxtv.tp-v-disabled .tp-coltxtv_mm{opacity:.5}.tp-coltxtv_w{flex:1}.tp-dfwv{position:absolute;top:8px;right:8px;width:256px}.tp-fldv{position:relative}.tp-fldv_t{padding-left:4px}.tp-fldv_b:disabled .tp-fldv_m{display:none}.tp-fldv_c{padding-left:4px}.tp-fldv_i{bottom:0;color:var(--cnt-bg);left:0;overflow:hidden;position:absolute;top:calc(var(--cnt-usz) + 4px);width:max(var(--bs-br),4px)}.tp-fldv_i::before{background-color:currentColor;bottom:0;content:"";left:0;position:absolute;top:0;width:4px}.tp-fldv_b:hover+.tp-fldv_i{color:var(--cnt-bg-h)}.tp-fldv_b:focus+.tp-fldv_i{color:var(--cnt-bg-f)}.tp-fldv_b:active+.tp-fldv_i{color:var(--cnt-bg-a)}.tp-fldv.tp-v-disabled>.tp-fldv_i{opacity:.5}.tp-grlv{position:relative}.tp-grlv_g{display:block;height:calc(var(--cnt-usz) * 3)}.tp-grlv_g polyline{fill:none;stroke:var(--mo-fg);stroke-linejoin:round}.tp-grlv_t{margin-top:-4px;transition:left .05s,top .05s;visibility:hidden}.tp-grlv_t.tp-grlv_t-a{visibility:visible}.tp-grlv_t.tp-grlv_t-in{transition:none}.tp-grlv.tp-v-disabled .tp-grlv_g{opacity:.5}.tp-grlv .tp-ttv{background-color:var(--mo-fg)}.tp-grlv .tp-ttv::before{border-top-color:var(--mo-fg)}.tp-lblv{align-items:center;display:flex;line-height:1.3;padding-left:var(--cnt-hp);padding-right:var(--cnt-hp)}.tp-lblv.tp-lblv-nol{display:block}.tp-lblv_l{color:var(--lbl-fg);flex:1;-webkit-hyphens:auto;hyphens:auto;overflow:hidden;padding-left:4px;padding-right:16px}.tp-lblv.tp-v-disabled .tp-lblv_l{opacity:.5}.tp-lblv.tp-lblv-nol .tp-lblv_l{display:none}.tp-lblv_v{align-self:flex-start;flex-grow:0;flex-shrink:0;width:var(--bld-vw)}.tp-lblv.tp-lblv-nol .tp-lblv_v{width:100%}.tp-lstv_s{padding:0 20px 0 var(--bld-hp);width:100%}.tp-lstv_m{color:var(--btn-fg)}.tp-sglv_i{padding-left:var(--bld-hp);padding-right:var(--bld-hp)}.tp-sglv.tp-v-disabled .tp-sglv_i{opacity:.5}.tp-mllv_i{display:block;height:calc(var(--cnt-usz) * 3);line-height:var(--cnt-usz);padding-left:var(--bld-hp);padding-right:var(--bld-hp);resize:none;white-space:pre}.tp-mllv.tp-v-disabled .tp-mllv_i{opacity:.5}.tp-p2dv{position:relative}.tp-p2dv_h{display:flex}.tp-p2dv_b{height:var(--cnt-usz);margin-right:4px;position:relative;width:var(--cnt-usz)}.tp-p2dv_b svg{display:block;height:16px;left:50%;margin-left:-8px;margin-top:-8px;position:absolute;top:50%;width:16px}.tp-p2dv_b svg path{stroke:currentColor;stroke-width:2}.tp-p2dv_b svg circle{fill:currentColor}.tp-p2dv_t{flex:1}.tp-p2dv_p{height:0;margin-top:0;opacity:0;overflow:hidden;transition:height .2s ease-in-out,opacity .2s linear,margin .2s ease-in-out}.tp-p2dv.tp-p2dv-expanded .tp-p2dv_p{margin-top:var(--cnt-usp);opacity:1}.tp-p2dv .tp-popv{left:calc(-1 * var(--cnt-hp));right:calc(-1 * var(--cnt-hp));top:var(--cnt-usz)}.tp-p2dpv{padding-left:calc(var(--cnt-usz) + 4px)}.tp-p2dpv_p{cursor:crosshair;height:0;overflow:hidden;padding-bottom:100%;position:relative}.tp-p2dpv.tp-v-disabled .tp-p2dpv_p{opacity:.5}.tp-p2dpv_g{display:block;height:100%;left:0;pointer-events:none;position:absolute;top:0;width:100%}.tp-p2dpv_ax{opacity:.1;stroke:var(--in-fg);stroke-dasharray:1}.tp-p2dpv_l{opacity:.5;stroke:var(--in-fg);stroke-dasharray:1}.tp-p2dpv_m{border:var(--in-fg) solid 1px;border-radius:50%;box-sizing:border-box;height:4px;margin-left:-2px;margin-top:-2px;position:absolute;width:4px}.tp-p2dpv_p:focus .tp-p2dpv_m{background-color:var(--in-fg);border-width:0}.tp-popv{background-color:var(--bs-bg);border-radius:var(--bs-br);box-shadow:0 2px 4px var(--bs-sh);display:none;max-width:var(--bld-vw);padding:var(--cnt-vp) var(--cnt-hp);position:absolute;visibility:hidden;z-index:1000}.tp-popv.tp-popv-v{display:block;visibility:visible}.tp-sldv.tp-v-disabled{opacity:.5}.tp-sldv_t{box-sizing:border-box;cursor:pointer;height:var(--cnt-usz);margin:0 6px;outline:none;position:relative}.tp-sldv_t::before{background-color:var(--in-bg);border-radius:1px;bottom:0;content:"";display:block;height:2px;left:0;margin:auto;position:absolute;right:0;top:0}.tp-sldv_k{height:100%;left:0;position:absolute;top:0}.tp-sldv_k::before{background-color:var(--in-fg);border-radius:1px;bottom:0;content:"";display:block;height:2px;left:0;margin-bottom:auto;margin-top:auto;position:absolute;right:0;top:0}.tp-sldv_k::after{background-color:var(--btn-bg);border-radius:var(--bld-br);bottom:0;content:"";display:block;height:12px;margin-bottom:auto;margin-top:auto;position:absolute;right:-6px;top:0;width:12px}.tp-sldv_t:hover .tp-sldv_k::after{background-color:var(--btn-bg-h)}.tp-sldv_t:focus .tp-sldv_k::after{background-color:var(--btn-bg-f)}.tp-sldv_t:active .tp-sldv_k::after{background-color:var(--btn-bg-a)}.tp-sldtxtv{display:flex}.tp-sldtxtv_s{flex:2}.tp-sldtxtv_t{flex:1;margin-left:4px}.tp-tabv{position:relative}.tp-tabv_t{align-items:flex-end;color:var(--cnt-bg);display:flex;overflow:hidden;position:relative}.tp-tabv_t:hover{color:var(--cnt-bg-h)}.tp-tabv_t:has(*:focus){color:var(--cnt-bg-f)}.tp-tabv_t:has(*:active){color:var(--cnt-bg-a)}.tp-tabv_t::before{background-color:currentColor;bottom:0;content:"";height:2px;left:0;pointer-events:none;position:absolute;right:0}.tp-tabv.tp-v-disabled .tp-tabv_t::before{opacity:.5}.tp-tabv.tp-tabv-nop .tp-tabv_t{height:calc(var(--cnt-usz) + 4px);position:relative}.tp-tabv.tp-tabv-nop .tp-tabv_t::before{background-color:var(--cnt-bg);bottom:0;content:"";height:2px;left:0;position:absolute;right:0}.tp-tabv_i{bottom:0;color:var(--cnt-bg);left:0;overflow:hidden;position:absolute;top:calc(var(--cnt-usz) + 4px);width:max(var(--bs-br),4px)}.tp-tabv_i::before{background-color:currentColor;bottom:0;content:"";left:0;position:absolute;top:0;width:4px}.tp-tabv_t:hover+.tp-tabv_i{color:var(--cnt-bg-h)}.tp-tabv_t:has(*:focus)+.tp-tabv_i{color:var(--cnt-bg-f)}.tp-tabv_t:has(*:active)+.tp-tabv_i{color:var(--cnt-bg-a)}.tp-tabv.tp-v-disabled>.tp-tabv_i{opacity:.5}.tp-tbiv{flex:1;min-width:0;position:relative}.tp-tbiv+.tp-tbiv{margin-left:2px}.tp-tbiv+.tp-tbiv.tp-v-disabled::before{opacity:.5}.tp-tbiv_b{display:block;padding-left:calc(var(--cnt-hp) + 4px);padding-right:calc(var(--cnt-hp) + 4px);position:relative;width:100%}.tp-tbiv_b:disabled{opacity:.5}.tp-tbiv_b::before{background-color:var(--cnt-bg);bottom:2px;content:"";left:0;pointer-events:none;position:absolute;right:0;top:0}.tp-tbiv_b:hover::before{background-color:var(--cnt-bg-h)}.tp-tbiv_b:focus::before{background-color:var(--cnt-bg-f)}.tp-tbiv_b:active::before{background-color:var(--cnt-bg-a)}.tp-tbiv_t{color:var(--cnt-fg);height:calc(var(--cnt-usz) + 4px);line-height:calc(var(--cnt-usz) + 4px);opacity:.5;overflow:hidden;text-overflow:ellipsis}.tp-tbiv.tp-tbiv-sel .tp-tbiv_t{opacity:1}.tp-tbpv_c{padding-bottom:var(--cnt-vp);padding-left:4px;padding-top:var(--cnt-vp)}.tp-txtv{position:relative}.tp-txtv_i{padding-left:var(--bld-hp);padding-right:var(--bld-hp)}.tp-txtv.tp-txtv-fst .tp-txtv_i{border-bottom-right-radius:0;border-top-right-radius:0}.tp-txtv.tp-txtv-mid .tp-txtv_i{border-radius:0}.tp-txtv.tp-txtv-lst .tp-txtv_i{border-bottom-left-radius:0;border-top-left-radius:0}.tp-txtv.tp-txtv-num .tp-txtv_i{text-align:right}.tp-txtv.tp-txtv-drg .tp-txtv_i{opacity:.3}.tp-txtv_k{cursor:pointer;height:100%;left:calc( var(--bld-hp) - 5px );position:absolute;top:0;width:12px}.tp-txtv_k::before{background-color:var(--in-fg);border-radius:1px;bottom:0;content:"";height:calc(var(--cnt-usz) - 4px);left:50%;margin-bottom:auto;margin-left:-1px;margin-top:auto;opacity:.1;position:absolute;top:0;transition:border-radius .1s,height .1s,transform .1s,width .1s;width:2px}.tp-txtv_k:hover::before,.tp-txtv.tp-txtv-drg .tp-txtv_k::before{opacity:1}.tp-txtv.tp-txtv-drg .tp-txtv_k::before{border-radius:50%;height:4px;transform:translateX(-1px);width:4px}.tp-txtv_g{bottom:0;display:block;height:8px;left:50%;margin:auto;overflow:visible;pointer-events:none;position:absolute;top:0;visibility:hidden;width:100%}.tp-txtv.tp-txtv-drg .tp-txtv_g{visibility:visible}.tp-txtv_gb{fill:none;stroke:var(--in-fg);stroke-dasharray:1}.tp-txtv_gh{fill:none;stroke:var(--in-fg)}.tp-txtv .tp-ttv{margin-left:6px;visibility:hidden}.tp-txtv.tp-txtv-drg .tp-ttv{visibility:visible}.tp-ttv{background-color:var(--in-fg);border-radius:var(--bld-br);color:var(--bs-bg);padding:2px 4px;pointer-events:none;position:absolute;transform:translate(-50%, -100%)}.tp-ttv::before{border-color:var(--in-fg) rgba(0,0,0,0) rgba(0,0,0,0) rgba(0,0,0,0);border-style:solid;border-width:2px;box-sizing:border-box;content:"";font-size:.9em;height:4px;left:50%;margin-left:-2px;position:absolute;top:100%;width:4px}.tp-rotv{background-color:var(--bs-bg);border-radius:var(--bs-br);box-shadow:0 2px 4px var(--bs-sh);font-family:var(--bs-ff);font-size:11px;font-weight:500;line-height:1;text-align:left}.tp-rotv_b{border-bottom-left-radius:var(--bs-br);border-bottom-right-radius:var(--bs-br);border-top-left-radius:var(--bs-br);border-top-right-radius:var(--bs-br);padding-left:calc( 2px * 2 + var(--cnt-usz) + var(--cnt-hp) );text-align:center}.tp-rotv.tp-rotv-expanded .tp-rotv_b{border-bottom-left-radius:0;border-bottom-right-radius:0;transition-delay:0s;transition-duration:0s}.tp-rotv.tp-rotv-not>.tp-rotv_b{display:none}.tp-rotv_b:disabled .tp-rotv_m{display:none}.tp-rotv_c>.tp-fldv.tp-v-lst>.tp-fldv_c{border-bottom-left-radius:var(--bs-br);border-bottom-right-radius:var(--bs-br)}.tp-rotv_c>.tp-fldv.tp-v-lst>.tp-fldv_i{border-bottom-left-radius:var(--bs-br)}.tp-rotv_c>.tp-fldv.tp-v-lst:not(.tp-fldv-expanded)>.tp-fldv_b{border-bottom-left-radius:var(--bs-br);border-bottom-right-radius:var(--bs-br)}.tp-rotv_c>.tp-fldv.tp-v-lst.tp-fldv-expanded>.tp-fldv_b{transition-delay:0s;transition-duration:0s}.tp-rotv_c .tp-fldv.tp-v-vlst:not(.tp-fldv-expanded)>.tp-fldv_b{border-bottom-right-radius:var(--bs-br)}.tp-rotv.tp-rotv-not .tp-rotv_c>.tp-fldv.tp-v-fst{margin-top:calc(-1 * var(--cnt-vp))}.tp-rotv.tp-rotv-not .tp-rotv_c>.tp-fldv.tp-v-fst>.tp-fldv_b{border-top-left-radius:var(--bs-br);border-top-right-radius:var(--bs-br)}.tp-rotv_c>.tp-tabv.tp-v-lst>.tp-tabv_c{border-bottom-left-radius:var(--bs-br);border-bottom-right-radius:var(--bs-br)}.tp-rotv_c>.tp-tabv.tp-v-lst>.tp-tabv_i{border-bottom-left-radius:var(--bs-br)}.tp-rotv.tp-rotv-not .tp-rotv_c>.tp-tabv.tp-v-fst{margin-top:calc(-1 * var(--cnt-vp))}.tp-rotv.tp-rotv-not .tp-rotv_c>.tp-tabv.tp-v-fst>.tp-tabv_t{border-top-left-radius:var(--bs-br);border-top-right-radius:var(--bs-br)}.tp-rotv.tp-v-disabled,.tp-rotv .tp-v-disabled{pointer-events:none}.tp-rotv.tp-v-hidden,.tp-rotv .tp-v-hidden{display:none}.tp-sprv_r{background-color:var(--grv-fg);border-width:0;display:block;height:2px;margin:0;width:100%}.tp-sprv.tp-v-disabled .tp-sprv_r{opacity:.5}',plugins:[oee,uee,hee,pR,dee]})}}new hR("4.0.1");var gee=Object.defineProperty,vee=(n,e,t)=>e in n?gee(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,Sn=(n,e,t)=>(vee(n,typeof e!="symbol"?e+"":e,t),t);function UE(n,e){if(e===wP)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),n;if(e===Hp||e===ob){let t=n.getIndex();if(t===null){const o=[],a=n.getAttribute("position");if(a!==void 0){for(let l=0;l<a.count;l++)o.push(l);n.setIndex(o),t=n.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),n}const i=t.count-2,r=[];if(t)if(e===Hp)for(let o=1;o<=i;o++)r.push(t.getX(0)),r.push(t.getX(o)),r.push(t.getX(o+1));else for(let o=0;o<i;o++)o%2===0?(r.push(t.getX(o)),r.push(t.getX(o+1)),r.push(t.getX(o+2))):(r.push(t.getX(o+2)),r.push(t.getX(o+1)),r.push(t.getX(o)));r.length/3!==i&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const s=n.clone();return s.setIndex(r),s.clearGroups(),s}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",e),n}const _ee=parseInt(Vc.replace(/\D+/g,""));var tr=Uint8Array,wo=Uint16Array,R_=Uint32Array,XR=new tr([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),YR=new tr([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),yee=new tr([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),qR=function(n,e){for(var t=new wo(31),i=0;i<31;++i)t[i]=e+=1<<n[i-1];for(var r=new R_(t[30]),i=1;i<30;++i)for(var s=t[i];s<t[i+1];++s)r[s]=s-t[i]<<5|i;return[t,r]},KR=qR(XR,2),ZR=KR[0],bee=KR[1];ZR[28]=258,bee[258]=28;var xee=qR(YR,0),wee=xee[0],L_=new wo(32768);for(var Kt=0;Kt<32768;++Kt){var so=(Kt&43690)>>>1|(Kt&21845)<<1;so=(so&52428)>>>2|(so&13107)<<2,so=(so&61680)>>>4|(so&3855)<<4,L_[Kt]=((so&65280)>>>8|(so&255)<<8)>>>1}var lh=function(n,e,t){for(var i=n.length,r=0,s=new wo(e);r<i;++r)++s[n[r]-1];var o=new wo(e);for(r=0;r<e;++r)o[r]=o[r-1]+s[r-1]<<1;var a;if(t){a=new wo(1<<e);var l=15-e;for(r=0;r<i;++r)if(n[r])for(var c=r<<4|n[r],u=e-n[r],h=o[n[r]-1]++<<u,d=h|(1<<u)-1;h<=d;++h)a[L_[h]>>>l]=c}else for(a=new wo(i),r=0;r<i;++r)n[r]&&(a[r]=L_[o[n[r]-1]++]>>>15-n[r]);return a},Td=new tr(288);for(var Kt=0;Kt<144;++Kt)Td[Kt]=8;for(var Kt=144;Kt<256;++Kt)Td[Kt]=9;for(var Kt=256;Kt<280;++Kt)Td[Kt]=7;for(var Kt=280;Kt<288;++Kt)Td[Kt]=8;var JR=new tr(32);for(var Kt=0;Kt<32;++Kt)JR[Kt]=5;var See=lh(Td,9,1),Mee=lh(JR,5,1),Ov=function(n){for(var e=n[0],t=1;t<n.length;++t)n[t]>e&&(e=n[t]);return e},gr=function(n,e,t){var i=e/8|0;return(n[i]|n[i+1]<<8)>>(e&7)&t},Iv=function(n,e){var t=e/8|0;return(n[t]|n[t+1]<<8|n[t+2]<<16)>>(e&7)},Eee=function(n){return(n/8|0)+(n&7&&1)},Tee=function(n,e,t){(e==null||e<0)&&(e=0),(t==null||t>n.length)&&(t=n.length);var i=new(n instanceof wo?wo:n instanceof R_?R_:tr)(t-e);return i.set(n.subarray(e,t)),i},Aee=function(n,e,t){var i=n.length;if(!i||t&&!t.l&&i<5)return e||new tr(0);var r=!e||t,s=!t||t.i;t||(t={}),e||(e=new tr(i*3));var o=function(De){var ne=e.length;if(De>ne){var q=new tr(Math.max(ne*2,De));q.set(e),e=q}},a=t.f||0,l=t.p||0,c=t.b||0,u=t.l,h=t.d,d=t.m,f=t.n,p=i*8;do{if(!u){t.f=a=gr(n,l,1);var v=gr(n,l+1,3);if(l+=3,v)if(v==1)u=See,h=Mee,d=9,f=5;else if(v==2){var m=gr(n,l,31)+257,g=gr(n,l+10,15)+4,b=m+gr(n,l+5,31)+1;l+=14;for(var _=new tr(b),y=new tr(19),T=0;T<g;++T)y[yee[T]]=gr(n,l+T*3,7);l+=g*3;for(var S=Ov(y),E=(1<<S)-1,x=lh(y,S,1),T=0;T<b;){var M=x[gr(n,l,E)];l+=M&15;var w=M>>>4;if(w<16)_[T++]=w;else{var C=0,L=0;for(w==16?(L=3+gr(n,l,3),l+=2,C=_[T-1]):w==17?(L=3+gr(n,l,7),l+=3):w==18&&(L=11+gr(n,l,127),l+=7);L--;)_[T++]=C}}var $=_.subarray(0,m),U=_.subarray(m);d=Ov($),f=Ov(U),u=lh($,d,1),h=lh(U,f,1)}else throw"invalid block type";else{var w=Eee(l)+4,H=n[w-4]|n[w-3]<<8,V=w+H;if(V>i){if(s)throw"unexpected EOF";break}r&&o(c+H),e.set(n.subarray(w,V),c),t.b=c+=H,t.p=l=V*8;continue}if(l>p){if(s)throw"unexpected EOF";break}}r&&o(c+131072);for(var j=(1<<d)-1,te=(1<<f)-1,Z=l;;Z=l){var C=u[Iv(n,l)&j],Q=C>>>4;if(l+=C&15,l>p){if(s)throw"unexpected EOF";break}if(!C)throw"invalid length/literal";if(Q<256)e[c++]=Q;else if(Q==256){Z=l,u=null;break}else{var X=Q-254;if(Q>264){var T=Q-257,re=XR[T];X=gr(n,l,(1<<re)-1)+ZR[T],l+=re}var W=h[Iv(n,l)&te],we=W>>>4;if(!W)throw"invalid distance";l+=W&15;var U=wee[we];if(we>3){var re=YR[we];U+=Iv(n,l)&(1<<re)-1,l+=re}if(l>p){if(s)throw"unexpected EOF";break}r&&o(c+131072);for(var Re=c+X;c<Re;c+=4)e[c]=e[c-U],e[c+1]=e[c+1-U],e[c+2]=e[c+2-U],e[c+3]=e[c+3-U];c=Re}}t.l=u,t.p=Z,t.b=c,u&&(a=1,t.m=d,t.d=h,t.n=f)}while(!a);return c==e.length?e:Tee(e,0,c)},Cee=new tr(0),Pee=function(n){if((n[0]&15)!=8||n[0]>>>4>7||(n[0]<<8|n[1])%31)throw"invalid zlib data";if(n[1]&32)throw"invalid zlib data: preset dictionaries not supported"};function Ree(n,e){return Aee((Pee(n),n.subarray(2,-4)),e)}var Lee=typeof TextDecoder<"u"&&new TextDecoder,Oee=0;try{Lee.decode(Cee,{stream:!0}),Oee=1}catch(n){}var Iee=Object.defineProperty,Dee=(n,e,t)=>e in n?Iee(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,me=(n,e,t)=>(Dee(n,typeof e!="symbol"?e+"":e,t),t);class Uee extends pt{constructor(e,t){super(),me(this,"isTransformControls",!0),me(this,"visible",!1),me(this,"domElement"),me(this,"raycaster",new ug),me(this,"gizmo"),me(this,"plane"),me(this,"tempVector",new D),me(this,"tempVector2",new D),me(this,"tempQuaternion",new gt),me(this,"unit",{X:new D(1,0,0),Y:new D(0,1,0),Z:new D(0,0,1)}),me(this,"pointStart",new D),me(this,"pointEnd",new D),me(this,"offset",new D),me(this,"rotationAxis",new D),me(this,"startNorm",new D),me(this,"endNorm",new D),me(this,"rotationAngle",0),me(this,"cameraPosition",new D),me(this,"cameraQuaternion",new gt),me(this,"cameraScale",new D),me(this,"parentPosition",new D),me(this,"parentQuaternion",new gt),me(this,"parentQuaternionInv",new gt),me(this,"parentScale",new D),me(this,"worldPositionStart",new D),me(this,"worldQuaternionStart",new gt),me(this,"worldScaleStart",new D),me(this,"worldPosition",new D),me(this,"worldQuaternion",new gt),me(this,"worldQuaternionInv",new gt),me(this,"worldScale",new D),me(this,"eye",new D),me(this,"positionStart",new D),me(this,"quaternionStart",new gt),me(this,"scaleStart",new D),me(this,"camera"),me(this,"object"),me(this,"enabled",!0),me(this,"axis",null),me(this,"mode","translate"),me(this,"translationSnap",null),me(this,"rotationSnap",null),me(this,"scaleSnap",null),me(this,"space","world"),me(this,"size",1),me(this,"dragging",!1),me(this,"showX",!0),me(this,"showY",!0),me(this,"showZ",!0),me(this,"changeEvent",{type:"change"}),me(this,"mouseDownEvent",{type:"mouseDown",mode:this.mode}),me(this,"mouseUpEvent",{type:"mouseUp",mode:this.mode}),me(this,"objectChangeEvent",{type:"objectChange"}),me(this,"intersectObjectWithRay",(r,s,o)=>{const a=s.intersectObject(r,!0);for(let l=0;l<a.length;l++)if(a[l].object.visible||o)return a[l];return!1}),me(this,"attach",r=>(this.object=r,this.visible=!0,this)),me(this,"detach",()=>(this.object=void 0,this.visible=!1,this.axis=null,this)),me(this,"reset",()=>this.enabled?(this.dragging&&this.object!==void 0&&(this.object.position.copy(this.positionStart),this.object.quaternion.copy(this.quaternionStart),this.object.scale.copy(this.scaleStart),this.dispatchEvent(this.changeEvent),this.dispatchEvent(this.objectChangeEvent),this.pointStart.copy(this.pointEnd)),this):this),me(this,"updateMatrixWorld",()=>{this.object!==void 0&&(this.object.updateMatrixWorld(),this.object.parent===null?console.error("TransformControls: The attached 3D object must be a part of the scene graph."):this.object.parent.matrixWorld.decompose(this.parentPosition,this.parentQuaternion,this.parentScale),this.object.matrixWorld.decompose(this.worldPosition,this.worldQuaternion,this.worldScale),this.parentQuaternionInv.copy(this.parentQuaternion).invert(),this.worldQuaternionInv.copy(this.worldQuaternion).invert()),this.camera.updateMatrixWorld(),this.camera.matrixWorld.decompose(this.cameraPosition,this.cameraQuaternion,this.cameraScale),this.eye.copy(this.cameraPosition).sub(this.worldPosition).normalize(),super.updateMatrixWorld()}),me(this,"pointerHover",r=>{if(this.object===void 0||this.dragging===!0)return;this.raycaster.setFromCamera(r,this.camera);const s=this.intersectObjectWithRay(this.gizmo.picker[this.mode],this.raycaster);s?this.axis=s.object.name:this.axis=null}),me(this,"pointerDown",r=>{if(!(this.object===void 0||this.dragging===!0||r.button!==0)&&this.axis!==null){this.raycaster.setFromCamera(r,this.camera);const s=this.intersectObjectWithRay(this.plane,this.raycaster,!0);if(s){let o=this.space;if(this.mode==="scale"?o="local":(this.axis==="E"||this.axis==="XYZE"||this.axis==="XYZ")&&(o="world"),o==="local"&&this.mode==="rotate"){const a=this.rotationSnap;this.axis==="X"&&a&&(this.object.rotation.x=Math.round(this.object.rotation.x/a)*a),this.axis==="Y"&&a&&(this.object.rotation.y=Math.round(this.object.rotation.y/a)*a),this.axis==="Z"&&a&&(this.object.rotation.z=Math.round(this.object.rotation.z/a)*a)}this.object.updateMatrixWorld(),this.object.parent&&this.object.parent.updateMatrixWorld(),this.positionStart.copy(this.object.position),this.quaternionStart.copy(this.object.quaternion),this.scaleStart.copy(this.object.scale),this.object.matrixWorld.decompose(this.worldPositionStart,this.worldQuaternionStart,this.worldScaleStart),this.pointStart.copy(s.point).sub(this.worldPositionStart)}this.dragging=!0,this.mouseDownEvent.mode=this.mode,this.dispatchEvent(this.mouseDownEvent)}}),me(this,"pointerMove",r=>{const s=this.axis,o=this.mode,a=this.object;let l=this.space;if(o==="scale"?l="local":(s==="E"||s==="XYZE"||s==="XYZ")&&(l="world"),a===void 0||s===null||this.dragging===!1||r.button!==-1)return;this.raycaster.setFromCamera(r,this.camera);const c=this.intersectObjectWithRay(this.plane,this.raycaster,!0);if(c){if(this.pointEnd.copy(c.point).sub(this.worldPositionStart),o==="translate")this.offset.copy(this.pointEnd).sub(this.pointStart),l==="local"&&s!=="XYZ"&&this.offset.applyQuaternion(this.worldQuaternionInv),s.indexOf("X")===-1&&(this.offset.x=0),s.indexOf("Y")===-1&&(this.offset.y=0),s.indexOf("Z")===-1&&(this.offset.z=0),l==="local"&&s!=="XYZ"?this.offset.applyQuaternion(this.quaternionStart).divide(this.parentScale):this.offset.applyQuaternion(this.parentQuaternionInv).divide(this.parentScale),a.position.copy(this.offset).add(this.positionStart),this.translationSnap&&(l==="local"&&(a.position.applyQuaternion(this.tempQuaternion.copy(this.quaternionStart).invert()),s.search("X")!==-1&&(a.position.x=Math.round(a.position.x/this.translationSnap)*this.translationSnap),s.search("Y")!==-1&&(a.position.y=Math.round(a.position.y/this.translationSnap)*this.translationSnap),s.search("Z")!==-1&&(a.position.z=Math.round(a.position.z/this.translationSnap)*this.translationSnap),a.position.applyQuaternion(this.quaternionStart)),l==="world"&&(a.parent&&a.position.add(this.tempVector.setFromMatrixPosition(a.parent.matrixWorld)),s.search("X")!==-1&&(a.position.x=Math.round(a.position.x/this.translationSnap)*this.translationSnap),s.search("Y")!==-1&&(a.position.y=Math.round(a.position.y/this.translationSnap)*this.translationSnap),s.search("Z")!==-1&&(a.position.z=Math.round(a.position.z/this.translationSnap)*this.translationSnap),a.parent&&a.position.sub(this.tempVector.setFromMatrixPosition(a.parent.matrixWorld))));else if(o==="scale"){if(s.search("XYZ")!==-1){let u=this.pointEnd.length()/this.pointStart.length();this.pointEnd.dot(this.pointStart)<0&&(u*=-1),this.tempVector2.set(u,u,u)}else this.tempVector.copy(this.pointStart),this.tempVector2.copy(this.pointEnd),this.tempVector.applyQuaternion(this.worldQuaternionInv),this.tempVector2.applyQuaternion(this.worldQuaternionInv),this.tempVector2.divide(this.tempVector),s.search("X")===-1&&(this.tempVector2.x=1),s.search("Y")===-1&&(this.tempVector2.y=1),s.search("Z")===-1&&(this.tempVector2.z=1);a.scale.copy(this.scaleStart).multiply(this.tempVector2),this.scaleSnap&&this.object&&(s.search("X")!==-1&&(this.object.scale.x=Math.round(a.scale.x/this.scaleSnap)*this.scaleSnap||this.scaleSnap),s.search("Y")!==-1&&(a.scale.y=Math.round(a.scale.y/this.scaleSnap)*this.scaleSnap||this.scaleSnap),s.search("Z")!==-1&&(a.scale.z=Math.round(a.scale.z/this.scaleSnap)*this.scaleSnap||this.scaleSnap))}else if(o==="rotate"){this.offset.copy(this.pointEnd).sub(this.pointStart);const u=20/this.worldPosition.distanceTo(this.tempVector.setFromMatrixPosition(this.camera.matrixWorld));s==="E"?(this.rotationAxis.copy(this.eye),this.rotationAngle=this.pointEnd.angleTo(this.pointStart),this.startNorm.copy(this.pointStart).normalize(),this.endNorm.copy(this.pointEnd).normalize(),this.rotationAngle*=this.endNorm.cross(this.startNorm).dot(this.eye)<0?1:-1):s==="XYZE"?(this.rotationAxis.copy(this.offset).cross(this.eye).normalize(),this.rotationAngle=this.offset.dot(this.tempVector.copy(this.rotationAxis).cross(this.eye))*u):(s==="X"||s==="Y"||s==="Z")&&(this.rotationAxis.copy(this.unit[s]),this.tempVector.copy(this.unit[s]),l==="local"&&this.tempVector.applyQuaternion(this.worldQuaternion),this.rotationAngle=this.offset.dot(this.tempVector.cross(this.eye).normalize())*u),this.rotationSnap&&(this.rotationAngle=Math.round(this.rotationAngle/this.rotationSnap)*this.rotationSnap),l==="local"&&s!=="E"&&s!=="XYZE"?(a.quaternion.copy(this.quaternionStart),a.quaternion.multiply(this.tempQuaternion.setFromAxisAngle(this.rotationAxis,this.rotationAngle)).normalize()):(this.rotationAxis.applyQuaternion(this.parentQuaternionInv),a.quaternion.copy(this.tempQuaternion.setFromAxisAngle(this.rotationAxis,this.rotationAngle)),a.quaternion.multiply(this.quaternionStart).normalize())}this.dispatchEvent(this.changeEvent),this.dispatchEvent(this.objectChangeEvent)}}),me(this,"pointerUp",r=>{r.button===0&&(this.dragging&&this.axis!==null&&(this.mouseUpEvent.mode=this.mode,this.dispatchEvent(this.mouseUpEvent)),this.dragging=!1,this.axis=null)}),me(this,"getPointer",r=>{var s,o;if(this.domElement&&(s=this.domElement.ownerDocument)!=null&&s.pointerLockElement)return{x:0,y:0,button:r.button};{const a=r.changedTouches?r.changedTouches[0]:r,l=(o=this.domElement)==null?void 0:o.getBoundingClientRect();return{x:(a.clientX-l.left)/l.width*2-1,y:-(a.clientY-l.top)/l.height*2+1,button:r.button}}}),me(this,"onPointerHover",r=>{if(this.enabled)switch(r.pointerType){case"mouse":case"pen":this.pointerHover(this.getPointer(r));break}}),me(this,"onPointerDown",r=>{!this.enabled||!this.domElement||(this.domElement.style.touchAction="none",this.domElement.ownerDocument.addEventListener("pointermove",this.onPointerMove),this.pointerHover(this.getPointer(r)),this.pointerDown(this.getPointer(r)))}),me(this,"onPointerMove",r=>{this.enabled&&this.pointerMove(this.getPointer(r))}),me(this,"onPointerUp",r=>{!this.enabled||!this.domElement||(this.domElement.style.touchAction="",this.domElement.ownerDocument.removeEventListener("pointermove",this.onPointerMove),this.pointerUp(this.getPointer(r)))}),me(this,"getMode",()=>this.mode),me(this,"setMode",r=>{this.mode=r}),me(this,"setTranslationSnap",r=>{this.translationSnap=r}),me(this,"setRotationSnap",r=>{this.rotationSnap=r}),me(this,"setScaleSnap",r=>{this.scaleSnap=r}),me(this,"setSize",r=>{this.size=r}),me(this,"setSpace",r=>{this.space=r}),me(this,"update",()=>{console.warn("THREE.TransformControls: update function has no more functionality and therefore has been deprecated.")}),me(this,"connect",r=>{r===document&&console.error('THREE.OrbitControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.'),this.domElement=r,this.domElement.addEventListener("pointerdown",this.onPointerDown),this.domElement.addEventListener("pointermove",this.onPointerHover),this.domElement.ownerDocument.addEventListener("pointerup",this.onPointerUp)}),me(this,"dispose",()=>{var r,s,o,a,l,c;(r=this.domElement)==null||r.removeEventListener("pointerdown",this.onPointerDown),(s=this.domElement)==null||s.removeEventListener("pointermove",this.onPointerHover),(a=(o=this.domElement)==null?void 0:o.ownerDocument)==null||a.removeEventListener("pointermove",this.onPointerMove),(c=(l=this.domElement)==null?void 0:l.ownerDocument)==null||c.removeEventListener("pointerup",this.onPointerUp),this.traverse(u=>{const h=u;h.geometry&&h.geometry.dispose(),h.material&&h.material.dispose()})}),this.domElement=t,this.camera=e,this.gizmo=new Nee,this.add(this.gizmo),this.plane=new Fee,this.add(this.plane);const i=(r,s)=>{let o=s;Object.defineProperty(this,r,{get:function(){return o!==void 0?o:s},set:function(a){o!==a&&(o=a,this.plane[r]=a,this.gizmo[r]=a,this.dispatchEvent({type:r+"-changed",value:a}),this.dispatchEvent(this.changeEvent))}}),this[r]=s,this.plane[r]=s,this.gizmo[r]=s};i("camera",this.camera),i("object",this.object),i("enabled",this.enabled),i("axis",this.axis),i("mode",this.mode),i("translationSnap",this.translationSnap),i("rotationSnap",this.rotationSnap),i("scaleSnap",this.scaleSnap),i("space",this.space),i("size",this.size),i("dragging",this.dragging),i("showX",this.showX),i("showY",this.showY),i("showZ",this.showZ),i("worldPosition",this.worldPosition),i("worldPositionStart",this.worldPositionStart),i("worldQuaternion",this.worldQuaternion),i("worldQuaternionStart",this.worldQuaternionStart),i("cameraPosition",this.cameraPosition),i("cameraQuaternion",this.cameraQuaternion),i("pointStart",this.pointStart),i("pointEnd",this.pointEnd),i("rotationAxis",this.rotationAxis),i("rotationAngle",this.rotationAngle),i("eye",this.eye),t!==void 0&&this.connect(t)}}class Nee extends pt{constructor(){super(),me(this,"isTransformControlsGizmo",!0),me(this,"type","TransformControlsGizmo"),me(this,"tempVector",new D(0,0,0)),me(this,"tempEuler",new rr),me(this,"alignVector",new D(0,1,0)),me(this,"zeroVector",new D(0,0,0)),me(this,"lookAtMatrix",new ze),me(this,"tempQuaternion",new gt),me(this,"tempQuaternion2",new gt),me(this,"identityQuaternion",new gt),me(this,"unitX",new D(1,0,0)),me(this,"unitY",new D(0,1,0)),me(this,"unitZ",new D(0,0,1)),me(this,"gizmo"),me(this,"picker"),me(this,"helper"),me(this,"rotationAxis",new D),me(this,"cameraPosition",new D),me(this,"worldPositionStart",new D),me(this,"worldQuaternionStart",new gt),me(this,"worldPosition",new D),me(this,"worldQuaternion",new gt),me(this,"eye",new D),me(this,"camera",null),me(this,"enabled",!0),me(this,"axis",null),me(this,"mode","translate"),me(this,"space","world"),me(this,"size",1),me(this,"dragging",!1),me(this,"showX",!0),me(this,"showY",!0),me(this,"showZ",!0),me(this,"updateMatrixWorld",()=>{let Z=this.space;this.mode==="scale"&&(Z="local");const Q=Z==="local"?this.worldQuaternion:this.identityQuaternion;this.gizmo.translate.visible=this.mode==="translate",this.gizmo.rotate.visible=this.mode==="rotate",this.gizmo.scale.visible=this.mode==="scale",this.helper.translate.visible=this.mode==="translate",this.helper.rotate.visible=this.mode==="rotate",this.helper.scale.visible=this.mode==="scale";let X=[];X=X.concat(this.picker[this.mode].children),X=X.concat(this.gizmo[this.mode].children),X=X.concat(this.helper[this.mode].children);for(let re=0;re<X.length;re++){const W=X[re];W.visible=!0,W.rotation.set(0,0,0),W.position.copy(this.worldPosition);let we;if(this.camera.isOrthographicCamera?we=(this.camera.top-this.camera.bottom)/this.camera.zoom:we=this.worldPosition.distanceTo(this.cameraPosition)*Math.min(1.9*Math.tan(Math.PI*this.camera.fov/360)/this.camera.zoom,7),W.scale.set(1,1,1).multiplyScalar(we*this.size/7),W.tag==="helper"){W.visible=!1,W.name==="AXIS"?(W.position.copy(this.worldPositionStart),W.visible=!!this.axis,this.axis==="X"&&(this.tempQuaternion.setFromEuler(this.tempEuler.set(0,0,0)),W.quaternion.copy(Q).multiply(this.tempQuaternion),Math.abs(this.alignVector.copy(this.unitX).applyQuaternion(Q).dot(this.eye))>.9&&(W.visible=!1)),this.axis==="Y"&&(this.tempQuaternion.setFromEuler(this.tempEuler.set(0,0,Math.PI/2)),W.quaternion.copy(Q).multiply(this.tempQuaternion),Math.abs(this.alignVector.copy(this.unitY).applyQuaternion(Q).dot(this.eye))>.9&&(W.visible=!1)),this.axis==="Z"&&(this.tempQuaternion.setFromEuler(this.tempEuler.set(0,Math.PI/2,0)),W.quaternion.copy(Q).multiply(this.tempQuaternion),Math.abs(this.alignVector.copy(this.unitZ).applyQuaternion(Q).dot(this.eye))>.9&&(W.visible=!1)),this.axis==="XYZE"&&(this.tempQuaternion.setFromEuler(this.tempEuler.set(0,Math.PI/2,0)),this.alignVector.copy(this.rotationAxis),W.quaternion.setFromRotationMatrix(this.lookAtMatrix.lookAt(this.zeroVector,this.alignVector,this.unitY)),W.quaternion.multiply(this.tempQuaternion),W.visible=this.dragging),this.axis==="E"&&(W.visible=!1)):W.name==="START"?(W.position.copy(this.worldPositionStart),W.visible=this.dragging):W.name==="END"?(W.position.copy(this.worldPosition),W.visible=this.dragging):W.name==="DELTA"?(W.position.copy(this.worldPositionStart),W.quaternion.copy(this.worldQuaternionStart),this.tempVector.set(1e-10,1e-10,1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1),this.tempVector.applyQuaternion(this.worldQuaternionStart.clone().invert()),W.scale.copy(this.tempVector),W.visible=this.dragging):(W.quaternion.copy(Q),this.dragging?W.position.copy(this.worldPositionStart):W.position.copy(this.worldPosition),this.axis&&(W.visible=this.axis.search(W.name)!==-1));continue}W.quaternion.copy(Q),this.mode==="translate"||this.mode==="scale"?((W.name==="X"||W.name==="XYZX")&&Math.abs(this.alignVector.copy(this.unitX).applyQuaternion(Q).dot(this.eye))>.99&&(W.scale.set(1e-10,1e-10,1e-10),W.visible=!1),(W.name==="Y"||W.name==="XYZY")&&Math.abs(this.alignVector.copy(this.unitY).applyQuaternion(Q).dot(this.eye))>.99&&(W.scale.set(1e-10,1e-10,1e-10),W.visible=!1),(W.name==="Z"||W.name==="XYZZ")&&Math.abs(this.alignVector.copy(this.unitZ).applyQuaternion(Q).dot(this.eye))>.99&&(W.scale.set(1e-10,1e-10,1e-10),W.visible=!1),W.name==="XY"&&Math.abs(this.alignVector.copy(this.unitZ).applyQuaternion(Q).dot(this.eye))<.2&&(W.scale.set(1e-10,1e-10,1e-10),W.visible=!1),W.name==="YZ"&&Math.abs(this.alignVector.copy(this.unitX).applyQuaternion(Q).dot(this.eye))<.2&&(W.scale.set(1e-10,1e-10,1e-10),W.visible=!1),W.name==="XZ"&&Math.abs(this.alignVector.copy(this.unitY).applyQuaternion(Q).dot(this.eye))<.2&&(W.scale.set(1e-10,1e-10,1e-10),W.visible=!1),W.name.search("X")!==-1&&(this.alignVector.copy(this.unitX).applyQuaternion(Q).dot(this.eye)<0?W.tag==="fwd"?W.visible=!1:W.scale.x*=-1:W.tag==="bwd"&&(W.visible=!1)),W.name.search("Y")!==-1&&(this.alignVector.copy(this.unitY).applyQuaternion(Q).dot(this.eye)<0?W.tag==="fwd"?W.visible=!1:W.scale.y*=-1:W.tag==="bwd"&&(W.visible=!1)),W.name.search("Z")!==-1&&(this.alignVector.copy(this.unitZ).applyQuaternion(Q).dot(this.eye)<0?W.tag==="fwd"?W.visible=!1:W.scale.z*=-1:W.tag==="bwd"&&(W.visible=!1))):this.mode==="rotate"&&(this.tempQuaternion2.copy(Q),this.alignVector.copy(this.eye).applyQuaternion(this.tempQuaternion.copy(Q).invert()),W.name.search("E")!==-1&&W.quaternion.setFromRotationMatrix(this.lookAtMatrix.lookAt(this.eye,this.zeroVector,this.unitY)),W.name==="X"&&(this.tempQuaternion.setFromAxisAngle(this.unitX,Math.atan2(-this.alignVector.y,this.alignVector.z)),this.tempQuaternion.multiplyQuaternions(this.tempQuaternion2,this.tempQuaternion),W.quaternion.copy(this.tempQuaternion)),W.name==="Y"&&(this.tempQuaternion.setFromAxisAngle(this.unitY,Math.atan2(this.alignVector.x,this.alignVector.z)),this.tempQuaternion.multiplyQuaternions(this.tempQuaternion2,this.tempQuaternion),W.quaternion.copy(this.tempQuaternion)),W.name==="Z"&&(this.tempQuaternion.setFromAxisAngle(this.unitZ,Math.atan2(this.alignVector.y,this.alignVector.x)),this.tempQuaternion.multiplyQuaternions(this.tempQuaternion2,this.tempQuaternion),W.quaternion.copy(this.tempQuaternion))),W.visible=W.visible&&(W.name.indexOf("X")===-1||this.showX),W.visible=W.visible&&(W.name.indexOf("Y")===-1||this.showY),W.visible=W.visible&&(W.name.indexOf("Z")===-1||this.showZ),W.visible=W.visible&&(W.name.indexOf("E")===-1||this.showX&&this.showY&&this.showZ),W.material.tempOpacity=W.material.tempOpacity||W.material.opacity,W.material.tempColor=W.material.tempColor||W.material.color.clone(),W.material.color.copy(W.material.tempColor),W.material.opacity=W.material.tempOpacity,this.enabled?this.axis&&(W.name===this.axis?(W.material.opacity=1,W.material.color.lerp(new Pe(1,1,1),.5)):this.axis.split("").some(function(Re){return W.name===Re})?(W.material.opacity=1,W.material.color.lerp(new Pe(1,1,1),.5)):(W.material.opacity*=.25,W.material.color.lerp(new Pe(1,1,1),.5))):(W.material.opacity*=.5,W.material.color.lerp(new Pe(1,1,1),.5))}super.updateMatrixWorld()});const e=new Jn({depthTest:!1,depthWrite:!1,transparent:!0,side:bi,fog:!1,toneMapped:!1}),t=new Bn({depthTest:!1,depthWrite:!1,transparent:!0,linewidth:1,fog:!1,toneMapped:!1}),i=e.clone();i.opacity=.15;const r=e.clone();r.opacity=.33;const s=e.clone();s.color.set(16711680);const o=e.clone();o.color.set(65280);const a=e.clone();a.color.set(255);const l=e.clone();l.opacity=.25;const c=l.clone();c.color.set(16776960);const u=l.clone();u.color.set(65535);const h=l.clone();h.color.set(16711935),e.clone().color.set(16776960);const d=t.clone();d.color.set(16711680);const f=t.clone();f.color.set(65280);const p=t.clone();p.color.set(255);const v=t.clone();v.color.set(65535);const m=t.clone();m.color.set(16711935);const g=t.clone();g.color.set(16776960);const b=t.clone();b.color.set(7895160);const _=g.clone();_.opacity=.25;const y=new Hn(0,.05,.2,12,1,!1),T=new ai(.125,.125,.125),S=new qe;S.setAttribute("position",new Ve([0,0,0,1,0,0],3));const E=(Z,Q)=>{const X=new qe,re=[];for(let W=0;W<=64*Q;++W)re.push(0,Math.cos(W/32*Math.PI)*Z,Math.sin(W/32*Math.PI)*Z);return X.setAttribute("position",new Ve(re,3)),X},x=()=>{const Z=new qe;return Z.setAttribute("position",new Ve([0,0,0,1,1,1],3)),Z},M={X:[[new Be(y,s),[1,0,0],[0,0,-Math.PI/2],null,"fwd"],[new Be(y,s),[1,0,0],[0,0,Math.PI/2],null,"bwd"],[new ct(S,d)]],Y:[[new Be(y,o),[0,1,0],null,null,"fwd"],[new Be(y,o),[0,1,0],[Math.PI,0,0],null,"bwd"],[new ct(S,f),null,[0,0,Math.PI/2]]],Z:[[new Be(y,a),[0,0,1],[Math.PI/2,0,0],null,"fwd"],[new Be(y,a),[0,0,1],[-Math.PI/2,0,0],null,"bwd"],[new ct(S,p),null,[0,-Math.PI/2,0]]],XYZ:[[new Be(new Qi(.1,0),l.clone()),[0,0,0],[0,0,0]]],XY:[[new Be(new Ni(.295,.295),c.clone()),[.15,.15,0]],[new ct(S,g),[.18,.3,0],null,[.125,1,1]],[new ct(S,g),[.3,.18,0],[0,0,Math.PI/2],[.125,1,1]]],YZ:[[new Be(new Ni(.295,.295),u.clone()),[0,.15,.15],[0,Math.PI/2,0]],[new ct(S,v),[0,.18,.3],[0,0,Math.PI/2],[.125,1,1]],[new ct(S,v),[0,.3,.18],[0,-Math.PI/2,0],[.125,1,1]]],XZ:[[new Be(new Ni(.295,.295),h.clone()),[.15,0,.15],[-Math.PI/2,0,0]],[new ct(S,m),[.18,0,.3],null,[.125,1,1]],[new ct(S,m),[.3,0,.18],[0,-Math.PI/2,0],[.125,1,1]]]},w={X:[[new Be(new Hn(.2,0,1,4,1,!1),i),[.6,0,0],[0,0,-Math.PI/2]]],Y:[[new Be(new Hn(.2,0,1,4,1,!1),i),[0,.6,0]]],Z:[[new Be(new Hn(.2,0,1,4,1,!1),i),[0,0,.6],[Math.PI/2,0,0]]],XYZ:[[new Be(new Qi(.2,0),i)]],XY:[[new Be(new Ni(.4,.4),i),[.2,.2,0]]],YZ:[[new Be(new Ni(.4,.4),i),[0,.2,.2],[0,Math.PI/2,0]]],XZ:[[new Be(new Ni(.4,.4),i),[.2,0,.2],[-Math.PI/2,0,0]]]},C={START:[[new Be(new Qi(.01,2),r),null,null,null,"helper"]],END:[[new Be(new Qi(.01,2),r),null,null,null,"helper"]],DELTA:[[new ct(x(),r),null,null,null,"helper"]],X:[[new ct(S,r.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new ct(S,r.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new ct(S,r.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]},L={X:[[new ct(E(1,.5),d)],[new Be(new Qi(.04,0),s),[0,0,.99],null,[1,3,1]]],Y:[[new ct(E(1,.5),f),null,[0,0,-Math.PI/2]],[new Be(new Qi(.04,0),o),[0,0,.99],null,[3,1,1]]],Z:[[new ct(E(1,.5),p),null,[0,Math.PI/2,0]],[new Be(new Qi(.04,0),a),[.99,0,0],null,[1,3,1]]],E:[[new ct(E(1.25,1),_),null,[0,Math.PI/2,0]],[new Be(new Hn(.03,0,.15,4,1,!1),_),[1.17,0,0],[0,0,-Math.PI/2],[1,1,.001]],[new Be(new Hn(.03,0,.15,4,1,!1),_),[-1.17,0,0],[0,0,Math.PI/2],[1,1,.001]],[new Be(new Hn(.03,0,.15,4,1,!1),_),[0,-1.17,0],[Math.PI,0,0],[1,1,.001]],[new Be(new Hn(.03,0,.15,4,1,!1),_),[0,1.17,0],[0,0,0],[1,1,.001]]],XYZE:[[new ct(E(1,1),b),null,[0,Math.PI/2,0]]]},$={AXIS:[[new ct(S,r.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]]},U={X:[[new Be(new bo(1,.1,4,24),i),[0,0,0],[0,-Math.PI/2,-Math.PI/2]]],Y:[[new Be(new bo(1,.1,4,24),i),[0,0,0],[Math.PI/2,0,0]]],Z:[[new Be(new bo(1,.1,4,24),i),[0,0,0],[0,0,-Math.PI/2]]],E:[[new Be(new bo(1.25,.1,2,24),i)]],XYZE:[[new Be(new jc(.7,10,8),i)]]},H={X:[[new Be(T,s),[.8,0,0],[0,0,-Math.PI/2]],[new ct(S,d),null,null,[.8,1,1]]],Y:[[new Be(T,o),[0,.8,0]],[new ct(S,f),null,[0,0,Math.PI/2],[.8,1,1]]],Z:[[new Be(T,a),[0,0,.8],[Math.PI/2,0,0]],[new ct(S,p),null,[0,-Math.PI/2,0],[.8,1,1]]],XY:[[new Be(T,c),[.85,.85,0],null,[2,2,.2]],[new ct(S,g),[.855,.98,0],null,[.125,1,1]],[new ct(S,g),[.98,.855,0],[0,0,Math.PI/2],[.125,1,1]]],YZ:[[new Be(T,u),[0,.85,.85],null,[.2,2,2]],[new ct(S,v),[0,.855,.98],[0,0,Math.PI/2],[.125,1,1]],[new ct(S,v),[0,.98,.855],[0,-Math.PI/2,0],[.125,1,1]]],XZ:[[new Be(T,h),[.85,0,.85],null,[2,.2,2]],[new ct(S,m),[.855,0,.98],null,[.125,1,1]],[new ct(S,m),[.98,0,.855],[0,-Math.PI/2,0],[.125,1,1]]],XYZX:[[new Be(new ai(.125,.125,.125),l.clone()),[1.1,0,0]]],XYZY:[[new Be(new ai(.125,.125,.125),l.clone()),[0,1.1,0]]],XYZZ:[[new Be(new ai(.125,.125,.125),l.clone()),[0,0,1.1]]]},V={X:[[new Be(new Hn(.2,0,.8,4,1,!1),i),[.5,0,0],[0,0,-Math.PI/2]]],Y:[[new Be(new Hn(.2,0,.8,4,1,!1),i),[0,.5,0]]],Z:[[new Be(new Hn(.2,0,.8,4,1,!1),i),[0,0,.5],[Math.PI/2,0,0]]],XY:[[new Be(T,i),[.85,.85,0],null,[3,3,.2]]],YZ:[[new Be(T,i),[0,.85,.85],null,[.2,3,3]]],XZ:[[new Be(T,i),[.85,0,.85],null,[3,.2,3]]],XYZX:[[new Be(new ai(.2,.2,.2),i),[1.1,0,0]]],XYZY:[[new Be(new ai(.2,.2,.2),i),[0,1.1,0]]],XYZZ:[[new Be(new ai(.2,.2,.2),i),[0,0,1.1]]]},j={X:[[new ct(S,r.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new ct(S,r.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new ct(S,r.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]},te=Z=>{const Q=new pt;for(let X in Z)for(let re=Z[X].length;re--;){const W=Z[X][re][0].clone(),we=Z[X][re][1],Re=Z[X][re][2],De=Z[X][re][3],ne=Z[X][re][4];W.name=X,W.tag=ne,we&&W.position.set(we[0],we[1],we[2]),Re&&W.rotation.set(Re[0],Re[1],Re[2]),De&&W.scale.set(De[0],De[1],De[2]),W.updateMatrix();const q=W.geometry.clone();q.applyMatrix4(W.matrix),W.geometry=q,W.renderOrder=1/0,W.position.set(0,0,0),W.rotation.set(0,0,0),W.scale.set(1,1,1),Q.add(W)}return Q};this.gizmo={},this.picker={},this.helper={},this.add(this.gizmo.translate=te(M)),this.add(this.gizmo.rotate=te(L)),this.add(this.gizmo.scale=te(H)),this.add(this.picker.translate=te(w)),this.add(this.picker.rotate=te(U)),this.add(this.picker.scale=te(V)),this.add(this.helper.translate=te(C)),this.add(this.helper.rotate=te($)),this.add(this.helper.scale=te(j)),this.picker.translate.visible=!1,this.picker.rotate.visible=!1,this.picker.scale.visible=!1}}class Fee extends Be{constructor(){super(new Ni(1e5,1e5,2,2),new Jn({visible:!1,wireframe:!0,side:bi,transparent:!0,opacity:.1,toneMapped:!1})),me(this,"isTransformControlsPlane",!0),me(this,"type","TransformControlsPlane"),me(this,"unitX",new D(1,0,0)),me(this,"unitY",new D(0,1,0)),me(this,"unitZ",new D(0,0,1)),me(this,"tempVector",new D),me(this,"dirVector",new D),me(this,"alignVector",new D),me(this,"tempMatrix",new ze),me(this,"identityQuaternion",new gt),me(this,"cameraQuaternion",new gt),me(this,"worldPosition",new D),me(this,"worldQuaternion",new gt),me(this,"eye",new D),me(this,"axis",null),me(this,"mode","translate"),me(this,"space","world"),me(this,"updateMatrixWorld",()=>{let e=this.space;switch(this.position.copy(this.worldPosition),this.mode==="scale"&&(e="local"),this.unitX.set(1,0,0).applyQuaternion(e==="local"?this.worldQuaternion:this.identityQuaternion),this.unitY.set(0,1,0).applyQuaternion(e==="local"?this.worldQuaternion:this.identityQuaternion),this.unitZ.set(0,0,1).applyQuaternion(e==="local"?this.worldQuaternion:this.identityQuaternion),this.alignVector.copy(this.unitY),this.mode){case"translate":case"scale":switch(this.axis){case"X":this.alignVector.copy(this.eye).cross(this.unitX),this.dirVector.copy(this.unitX).cross(this.alignVector);break;case"Y":this.alignVector.copy(this.eye).cross(this.unitY),this.dirVector.copy(this.unitY).cross(this.alignVector);break;case"Z":this.alignVector.copy(this.eye).cross(this.unitZ),this.dirVector.copy(this.unitZ).cross(this.alignVector);break;case"XY":this.dirVector.copy(this.unitZ);break;case"YZ":this.dirVector.copy(this.unitX);break;case"XZ":this.alignVector.copy(this.unitZ),this.dirVector.copy(this.unitY);break;case"XYZ":case"E":this.dirVector.set(0,0,0);break}break;case"rotate":default:this.dirVector.set(0,0,0)}this.dirVector.length()===0?this.quaternion.copy(this.cameraQuaternion):(this.tempMatrix.lookAt(this.tempVector.set(0,0,0),this.dirVector,this.alignVector),this.quaternion.setFromRotationMatrix(this.tempMatrix)),super.updateMatrixWorld()})}}var kee=Object.defineProperty,Bee=(n,e,t)=>e in n?kee(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,Pn=(n,e,t)=>(Bee(n,typeof e!="symbol"?e+"":e,t),t);const Bl=new rr(0,0,0,"YXZ"),zl=new D,zee={type:"change"},Vee={type:"lock"},Hee={type:"unlock"},NE=Math.PI/2;class O_ extends Nr{constructor(e,t){super(),Pn(this,"camera"),Pn(this,"domElement"),Pn(this,"isLocked"),Pn(this,"minPolarAngle"),Pn(this,"maxPolarAngle"),Pn(this,"pointerSpeed"),Pn(this,"onMouseMove",i=>{if(!this.domElement||this.isLocked===!1)return;const r=i.movementX||i.mozMovementX||i.webkitMovementX||0,s=i.movementY||i.mozMovementY||i.webkitMovementY||0;Bl.setFromQuaternion(this.camera.quaternion),Bl.y-=r*.002*this.pointerSpeed,Bl.x-=s*.002*this.pointerSpeed,Bl.x=Math.max(NE-this.maxPolarAngle,Math.min(NE-this.minPolarAngle,Bl.x)),this.camera.quaternion.setFromEuler(Bl),this.dispatchEvent(zee)}),Pn(this,"onPointerlockChange",()=>{this.domElement&&(this.domElement.ownerDocument.pointerLockElement===this.domElement?(this.dispatchEvent(Vee),this.isLocked=!0):(this.dispatchEvent(Hee),this.isLocked=!1))}),Pn(this,"onPointerlockError",()=>{console.error("THREE.PointerLockControls: Unable to use Pointer Lock API")}),Pn(this,"connect",i=>{this.domElement=i||this.domElement,this.domElement&&(this.domElement.ownerDocument.addEventListener("mousemove",this.onMouseMove),this.domElement.ownerDocument.addEventListener("pointerlockchange",this.onPointerlockChange),this.domElement.ownerDocument.addEventListener("pointerlockerror",this.onPointerlockError))}),Pn(this,"disconnect",()=>{this.domElement&&(this.domElement.ownerDocument.removeEventListener("mousemove",this.onMouseMove),this.domElement.ownerDocument.removeEventListener("pointerlockchange",this.onPointerlockChange),this.domElement.ownerDocument.removeEventListener("pointerlockerror",this.onPointerlockError))}),Pn(this,"dispose",()=>{this.disconnect()}),Pn(this,"getObject",()=>this.camera),Pn(this,"direction",new D(0,0,-1)),Pn(this,"getDirection",i=>i.copy(this.direction).applyQuaternion(this.camera.quaternion)),Pn(this,"moveForward",i=>{zl.setFromMatrixColumn(this.camera.matrix,0),zl.crossVectors(this.camera.up,zl),this.camera.position.addScaledVector(zl,i)}),Pn(this,"moveRight",i=>{zl.setFromMatrixColumn(this.camera.matrix,0),this.camera.position.addScaledVector(zl,i)}),Pn(this,"lock",()=>{this.domElement&&this.domElement.requestPointerLock()}),Pn(this,"unlock",()=>{this.domElement&&this.domElement.ownerDocument.exitPointerLock()}),this.camera=e,this.domElement=t,this.isLocked=!1,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.pointerSpeed=1,t&&this.connect(t)}}var Gee=Object.defineProperty,Wee=(n,e,t)=>e in n?Gee(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,Je=(n,e,t)=>(Wee(n,typeof e!="symbol"?e+"":e,t),t);const jf=new sl,FE=new Ms,$ee=Math.cos(70*(Math.PI/180)),kE=(n,e)=>(n%e+e)%e;class QR extends Nr{constructor(e,t){super(),Je(this,"object"),Je(this,"domElement"),Je(this,"enabled",!0),Je(this,"target",new D),Je(this,"minDistance",0),Je(this,"maxDistance",1/0),Je(this,"minZoom",0),Je(this,"maxZoom",1/0),Je(this,"minPolarAngle",0),Je(this,"maxPolarAngle",Math.PI),Je(this,"minAzimuthAngle",-1/0),Je(this,"maxAzimuthAngle",1/0),Je(this,"enableDamping",!1),Je(this,"dampingFactor",.05),Je(this,"enableZoom",!0),Je(this,"zoomSpeed",1),Je(this,"enableRotate",!0),Je(this,"rotateSpeed",1),Je(this,"enablePan",!0),Je(this,"panSpeed",1),Je(this,"screenSpacePanning",!0),Je(this,"keyPanSpeed",7),Je(this,"zoomToCursor",!1),Je(this,"autoRotate",!1),Je(this,"autoRotateSpeed",2),Je(this,"reverseOrbit",!1),Je(this,"reverseHorizontalOrbit",!1),Je(this,"reverseVerticalOrbit",!1),Je(this,"keys",{LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"}),Je(this,"mouseButtons",{LEFT:Ss.ROTATE,MIDDLE:Ss.DOLLY,RIGHT:Ss.PAN}),Je(this,"touches",{ONE:xr.ROTATE,TWO:xr.DOLLY_PAN}),Je(this,"target0"),Je(this,"position0"),Je(this,"zoom0"),Je(this,"_domElementKeyEvents",null),Je(this,"getPolarAngle"),Je(this,"getAzimuthalAngle"),Je(this,"setPolarAngle"),Je(this,"setAzimuthalAngle"),Je(this,"getDistance"),Je(this,"listenToKeyEvents"),Je(this,"stopListenToKeyEvents"),Je(this,"saveState"),Je(this,"reset"),Je(this,"update"),Je(this,"connect"),Je(this,"dispose"),this.object=e,this.domElement=t,this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this.getPolarAngle=()=>u.phi,this.getAzimuthalAngle=()=>u.theta,this.setPolarAngle=Y=>{let fe=kE(Y,2*Math.PI),Ee=u.phi;Ee<0&&(Ee+=2*Math.PI),fe<0&&(fe+=2*Math.PI);let Ce=Math.abs(fe-Ee);2*Math.PI-Ce<Ce&&(fe<Ee?fe+=2*Math.PI:Ee+=2*Math.PI),h.phi=fe-Ee,i.update()},this.setAzimuthalAngle=Y=>{let fe=kE(Y,2*Math.PI),Ee=u.theta;Ee<0&&(Ee+=2*Math.PI),fe<0&&(fe+=2*Math.PI);let Ce=Math.abs(fe-Ee);2*Math.PI-Ce<Ce&&(fe<Ee?fe+=2*Math.PI:Ee+=2*Math.PI),h.theta=fe-Ee,i.update()},this.getDistance=()=>i.object.position.distanceTo(i.target),this.listenToKeyEvents=Y=>{Y.addEventListener("keydown",be),this._domElementKeyEvents=Y},this.stopListenToKeyEvents=()=>{this._domElementKeyEvents.removeEventListener("keydown",be),this._domElementKeyEvents=null},this.saveState=()=>{i.target0.copy(i.target),i.position0.copy(i.object.position),i.zoom0=i.object.zoom},this.reset=()=>{i.target.copy(i.target0),i.object.position.copy(i.position0),i.object.zoom=i.zoom0,i.object.updateProjectionMatrix(),i.dispatchEvent(r),i.update(),l=a.NONE},this.update=(()=>{const Y=new D,fe=new D(0,1,0),Ee=new gt().setFromUnitVectors(e.up,fe),Ce=Ee.clone().invert(),Ke=new D,K=new gt,ke=2*Math.PI;return function(){const Ie=i.object.position;Ee.setFromUnitVectors(e.up,fe),Ce.copy(Ee).invert(),Y.copy(Ie).sub(i.target),Y.applyQuaternion(Ee),u.setFromVector3(Y),i.autoRotate&&l===a.NONE&&U(L()),i.enableDamping?(u.theta+=h.theta*i.dampingFactor,u.phi+=h.phi*i.dampingFactor):(u.theta+=h.theta,u.phi+=h.phi);let ve=i.minAzimuthAngle,Oe=i.maxAzimuthAngle;isFinite(ve)&&isFinite(Oe)&&(ve<-Math.PI?ve+=ke:ve>Math.PI&&(ve-=ke),Oe<-Math.PI?Oe+=ke:Oe>Math.PI&&(Oe-=ke),ve<=Oe?u.theta=Math.max(ve,Math.min(Oe,u.theta)):u.theta=u.theta>(ve+Oe)/2?Math.max(ve,u.theta):Math.min(Oe,u.theta)),u.phi=Math.max(i.minPolarAngle,Math.min(i.maxPolarAngle,u.phi)),u.makeSafe(),i.enableDamping===!0?i.target.addScaledVector(f,i.dampingFactor):i.target.add(f),i.zoomToCursor&&M||i.object.isOrthographicCamera?u.radius=re(u.radius):u.radius=re(u.radius*d),Y.setFromSpherical(u),Y.applyQuaternion(Ce),Ie.copy(i.target).add(Y),i.object.lookAt(i.target),i.enableDamping===!0?(h.theta*=1-i.dampingFactor,h.phi*=1-i.dampingFactor,f.multiplyScalar(1-i.dampingFactor)):(h.set(0,0,0),f.set(0,0,0));let We=!1;if(i.zoomToCursor&&M){let bt=null;if(i.object instanceof Nt&&i.object.isPerspectiveCamera){const Ft=Y.length();bt=re(Ft*d);const zn=Ft-bt;i.object.position.addScaledVector(E,zn),i.object.updateMatrixWorld()}else if(i.object.isOrthographicCamera){const Ft=new D(x.x,x.y,0);Ft.unproject(i.object),i.object.zoom=Math.max(i.minZoom,Math.min(i.maxZoom,i.object.zoom/d)),i.object.updateProjectionMatrix(),We=!0;const zn=new D(x.x,x.y,0);zn.unproject(i.object),i.object.position.sub(zn).add(Ft),i.object.updateMatrixWorld(),bt=Y.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),i.zoomToCursor=!1;bt!==null&&(i.screenSpacePanning?i.target.set(0,0,-1).transformDirection(i.object.matrix).multiplyScalar(bt).add(i.object.position):(jf.origin.copy(i.object.position),jf.direction.set(0,0,-1).transformDirection(i.object.matrix),Math.abs(i.object.up.dot(jf.direction))<$ee?e.lookAt(i.target):(FE.setFromNormalAndCoplanarPoint(i.object.up,i.target),jf.intersectPlane(FE,i.target))))}else i.object instanceof zi&&i.object.isOrthographicCamera&&(i.object.zoom=Math.max(i.minZoom,Math.min(i.maxZoom,i.object.zoom/d)),i.object.updateProjectionMatrix(),We=!0);return d=1,M=!1,We||Ke.distanceToSquared(i.object.position)>c||8*(1-K.dot(i.object.quaternion))>c?(i.dispatchEvent(r),Ke.copy(i.object.position),K.copy(i.object.quaternion),We=!1,!0):!1}})(),this.connect=Y=>{Y===document&&console.error('THREE.OrbitControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.'),i.domElement=Y,i.domElement.style.touchAction="none",i.domElement.addEventListener("contextmenu",Fe),i.domElement.addEventListener("pointerdown",le),i.domElement.addEventListener("pointercancel",O),i.domElement.addEventListener("wheel",de)},this.dispose=()=>{var Y,fe,Ee,Ce,Ke,K;(Y=i.domElement)==null||Y.removeEventListener("contextmenu",Fe),(fe=i.domElement)==null||fe.removeEventListener("pointerdown",le),(Ee=i.domElement)==null||Ee.removeEventListener("pointercancel",O),(Ce=i.domElement)==null||Ce.removeEventListener("wheel",de),(Ke=i.domElement)==null||Ke.ownerDocument.removeEventListener("pointermove",Me),(K=i.domElement)==null||K.ownerDocument.removeEventListener("pointerup",F),i._domElementKeyEvents!==null&&i._domElementKeyEvents.removeEventListener("keydown",be)};const i=this,r={type:"change"},s={type:"start"},o={type:"end"},a={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let l=a.NONE;const c=1e-6,u=new Xh,h=new Xh;let d=1;const f=new D,p=new _e,v=new _e,m=new _e,g=new _e,b=new _e,_=new _e,y=new _e,T=new _e,S=new _e,E=new D,x=new _e;let M=!1;const w=[],C={};function L(){return 2*Math.PI/60/60*i.autoRotateSpeed}function $(){return Math.pow(.95,i.zoomSpeed)}function U(Y){i.reverseOrbit||i.reverseHorizontalOrbit?h.theta+=Y:h.theta-=Y}function H(Y){i.reverseOrbit||i.reverseVerticalOrbit?h.phi+=Y:h.phi-=Y}const V=(()=>{const Y=new D;return function(fe,Ee){Y.setFromMatrixColumn(Ee,0),Y.multiplyScalar(-fe),f.add(Y)}})(),j=(()=>{const Y=new D;return function(fe,Ee){i.screenSpacePanning===!0?Y.setFromMatrixColumn(Ee,1):(Y.setFromMatrixColumn(Ee,0),Y.crossVectors(i.object.up,Y)),Y.multiplyScalar(fe),f.add(Y)}})(),te=(()=>{const Y=new D;return function(fe,Ee){const Ce=i.domElement;if(Ce&&i.object instanceof Nt&&i.object.isPerspectiveCamera){const Ke=i.object.position;Y.copy(Ke).sub(i.target);let K=Y.length();K*=Math.tan(i.object.fov/2*Math.PI/180),V(2*fe*K/Ce.clientHeight,i.object.matrix),j(2*Ee*K/Ce.clientHeight,i.object.matrix)}else Ce&&i.object instanceof zi&&i.object.isOrthographicCamera?(V(fe*(i.object.right-i.object.left)/i.object.zoom/Ce.clientWidth,i.object.matrix),j(Ee*(i.object.top-i.object.bottom)/i.object.zoom/Ce.clientHeight,i.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),i.enablePan=!1)}})();function Z(Y){i.object instanceof Nt&&i.object.isPerspectiveCamera||i.object instanceof zi&&i.object.isOrthographicCamera?d/=Y:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),i.enableZoom=!1)}function Q(Y){i.object instanceof Nt&&i.object.isPerspectiveCamera||i.object instanceof zi&&i.object.isOrthographicCamera?d*=Y:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),i.enableZoom=!1)}function X(Y){if(!i.zoomToCursor||!i.domElement)return;M=!0;const fe=i.domElement.getBoundingClientRect(),Ee=Y.clientX-fe.left,Ce=Y.clientY-fe.top,Ke=fe.width,K=fe.height;x.x=Ee/Ke*2-1,x.y=-(Ce/K)*2+1,E.set(x.x,x.y,1).unproject(i.object).sub(i.object.position).normalize()}function re(Y){return Math.max(i.minDistance,Math.min(i.maxDistance,Y))}function W(Y){p.set(Y.clientX,Y.clientY)}function we(Y){X(Y),y.set(Y.clientX,Y.clientY)}function Re(Y){g.set(Y.clientX,Y.clientY)}function De(Y){v.set(Y.clientX,Y.clientY),m.subVectors(v,p).multiplyScalar(i.rotateSpeed);const fe=i.domElement;fe&&(U(2*Math.PI*m.x/fe.clientHeight),H(2*Math.PI*m.y/fe.clientHeight)),p.copy(v),i.update()}function ne(Y){T.set(Y.clientX,Y.clientY),S.subVectors(T,y),S.y>0?Z($()):S.y<0&&Q($()),y.copy(T),i.update()}function q(Y){b.set(Y.clientX,Y.clientY),_.subVectors(b,g).multiplyScalar(i.panSpeed),te(_.x,_.y),g.copy(b),i.update()}function P(Y){X(Y),Y.deltaY<0?Q($()):Y.deltaY>0&&Z($()),i.update()}function N(Y){let fe=!1;switch(Y.code){case i.keys.UP:te(0,i.keyPanSpeed),fe=!0;break;case i.keys.BOTTOM:te(0,-i.keyPanSpeed),fe=!0;break;case i.keys.LEFT:te(i.keyPanSpeed,0),fe=!0;break;case i.keys.RIGHT:te(-i.keyPanSpeed,0),fe=!0;break}fe&&(Y.preventDefault(),i.update())}function B(){if(w.length==1)p.set(w[0].pageX,w[0].pageY);else{const Y=.5*(w[0].pageX+w[1].pageX),fe=.5*(w[0].pageY+w[1].pageY);p.set(Y,fe)}}function A(){if(w.length==1)g.set(w[0].pageX,w[0].pageY);else{const Y=.5*(w[0].pageX+w[1].pageX),fe=.5*(w[0].pageY+w[1].pageY);g.set(Y,fe)}}function R(){const Y=w[0].pageX-w[1].pageX,fe=w[0].pageY-w[1].pageY,Ee=Math.sqrt(Y*Y+fe*fe);y.set(0,Ee)}function I(){i.enableZoom&&R(),i.enablePan&&A()}function z(){i.enableZoom&&R(),i.enableRotate&&B()}function G(Y){if(w.length==1)v.set(Y.pageX,Y.pageY);else{const Ee=et(Y),Ce=.5*(Y.pageX+Ee.x),Ke=.5*(Y.pageY+Ee.y);v.set(Ce,Ke)}m.subVectors(v,p).multiplyScalar(i.rotateSpeed);const fe=i.domElement;fe&&(U(2*Math.PI*m.x/fe.clientHeight),H(2*Math.PI*m.y/fe.clientHeight)),p.copy(v)}function ee(Y){if(w.length==1)b.set(Y.pageX,Y.pageY);else{const fe=et(Y),Ee=.5*(Y.pageX+fe.x),Ce=.5*(Y.pageY+fe.y);b.set(Ee,Ce)}_.subVectors(b,g).multiplyScalar(i.panSpeed),te(_.x,_.y),g.copy(b)}function ae(Y){const fe=et(Y),Ee=Y.pageX-fe.x,Ce=Y.pageY-fe.y,Ke=Math.sqrt(Ee*Ee+Ce*Ce);T.set(0,Ke),S.set(0,Math.pow(T.y/y.y,i.zoomSpeed)),Z(S.y),y.copy(T)}function se(Y){i.enableZoom&&ae(Y),i.enablePan&&ee(Y)}function ce(Y){i.enableZoom&&ae(Y),i.enableRotate&&G(Y)}function le(Y){var fe,Ee;i.enabled!==!1&&(w.length===0&&((fe=i.domElement)==null||fe.ownerDocument.addEventListener("pointermove",Me),(Ee=i.domElement)==null||Ee.ownerDocument.addEventListener("pointerup",F)),je(Y),Y.pointerType==="touch"?Ne(Y):J(Y))}function Me(Y){i.enabled!==!1&&(Y.pointerType==="touch"?Ae(Y):ge(Y))}function F(Y){var fe,Ee,Ce;dt(Y),w.length===0&&((fe=i.domElement)==null||fe.releasePointerCapture(Y.pointerId),(Ee=i.domElement)==null||Ee.ownerDocument.removeEventListener("pointermove",Me),(Ce=i.domElement)==null||Ce.ownerDocument.removeEventListener("pointerup",F)),i.dispatchEvent(o),l=a.NONE}function O(Y){dt(Y)}function J(Y){let fe;switch(Y.button){case 0:fe=i.mouseButtons.LEFT;break;case 1:fe=i.mouseButtons.MIDDLE;break;case 2:fe=i.mouseButtons.RIGHT;break;default:fe=-1}switch(fe){case Ss.DOLLY:if(i.enableZoom===!1)return;we(Y),l=a.DOLLY;break;case Ss.ROTATE:if(Y.ctrlKey||Y.metaKey||Y.shiftKey){if(i.enablePan===!1)return;Re(Y),l=a.PAN}else{if(i.enableRotate===!1)return;W(Y),l=a.ROTATE}break;case Ss.PAN:if(Y.ctrlKey||Y.metaKey||Y.shiftKey){if(i.enableRotate===!1)return;W(Y),l=a.ROTATE}else{if(i.enablePan===!1)return;Re(Y),l=a.PAN}break;default:l=a.NONE}l!==a.NONE&&i.dispatchEvent(s)}function ge(Y){if(i.enabled!==!1)switch(l){case a.ROTATE:if(i.enableRotate===!1)return;De(Y);break;case a.DOLLY:if(i.enableZoom===!1)return;ne(Y);break;case a.PAN:if(i.enablePan===!1)return;q(Y);break}}function de(Y){i.enabled===!1||i.enableZoom===!1||l!==a.NONE&&l!==a.ROTATE||(Y.preventDefault(),i.dispatchEvent(s),P(Y),i.dispatchEvent(o))}function be(Y){i.enabled===!1||i.enablePan===!1||N(Y)}function Ne(Y){switch(Le(Y),w.length){case 1:switch(i.touches.ONE){case xr.ROTATE:if(i.enableRotate===!1)return;B(),l=a.TOUCH_ROTATE;break;case xr.PAN:if(i.enablePan===!1)return;A(),l=a.TOUCH_PAN;break;default:l=a.NONE}break;case 2:switch(i.touches.TWO){case xr.DOLLY_PAN:if(i.enableZoom===!1&&i.enablePan===!1)return;I(),l=a.TOUCH_DOLLY_PAN;break;case xr.DOLLY_ROTATE:if(i.enableZoom===!1&&i.enableRotate===!1)return;z(),l=a.TOUCH_DOLLY_ROTATE;break;default:l=a.NONE}break;default:l=a.NONE}l!==a.NONE&&i.dispatchEvent(s)}function Ae(Y){switch(Le(Y),l){case a.TOUCH_ROTATE:if(i.enableRotate===!1)return;G(Y),i.update();break;case a.TOUCH_PAN:if(i.enablePan===!1)return;ee(Y),i.update();break;case a.TOUCH_DOLLY_PAN:if(i.enableZoom===!1&&i.enablePan===!1)return;se(Y),i.update();break;case a.TOUCH_DOLLY_ROTATE:if(i.enableZoom===!1&&i.enableRotate===!1)return;ce(Y),i.update();break;default:l=a.NONE}}function Fe(Y){i.enabled!==!1&&Y.preventDefault()}function je(Y){w.push(Y)}function dt(Y){delete C[Y.pointerId];for(let fe=0;fe<w.length;fe++)if(w[fe].pointerId==Y.pointerId){w.splice(fe,1);return}}function Le(Y){let fe=C[Y.pointerId];fe===void 0&&(fe=new _e,C[Y.pointerId]=fe),fe.set(Y.pageX,Y.pageY)}function et(Y){const fe=Y.pointerId===w[0].pointerId?w[1]:w[0];return C[fe.pointerId]}t!==void 0&&this.connect(t),this.update()}}class jee extends QR{constructor(e,t){super(e,t),this.screenSpacePanning=!1,this.mouseButtons.LEFT=Ss.PAN,this.mouseButtons.RIGHT=Ss.ROTATE,this.touches.ONE=xr.PAN,this.touches.TWO=xr.DOLLY_ROTATE}}class Xee extends Xn{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(t){return new Jee(t)}),this.register(function(t){return new ote(t)}),this.register(function(t){return new ate(t)}),this.register(function(t){return new lte(t)}),this.register(function(t){return new ete(t)}),this.register(function(t){return new tte(t)}),this.register(function(t){return new nte(t)}),this.register(function(t){return new ite(t)}),this.register(function(t){return new Zee(t)}),this.register(function(t){return new rte(t)}),this.register(function(t){return new Qee(t)}),this.register(function(t){return new ste(t)}),this.register(function(t){return new qee(t)}),this.register(function(t){return new cte(t)}),this.register(function(t){return new ute(t)})}load(e,t,i,r){const s=this;let o;this.resourcePath!==""?o=this.resourcePath:this.path!==""?o=this.path:o=Gi.extractUrlBase(e),this.manager.itemStart(e);const a=function(c){r?r(c):console.error(c),s.manager.itemError(e),s.manager.itemEnd(e)},l=new Ti(this.manager);l.setPath(this.path),l.setResponseType("arraybuffer"),l.setRequestHeader(this.requestHeader),l.setWithCredentials(this.withCredentials),l.load(e,function(c){try{s.parse(c,o,function(u){t(u),s.manager.itemEnd(e)},a)}catch(u){a(u)}},i,a)}setDRACOLoader(e){return this.dracoLoader=e,this}setDDSLoader(){throw new Error('THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".')}setKTX2Loader(e){return this.ktx2Loader=e,this}setMeshoptDecoder(e){return this.meshoptDecoder=e,this}register(e){return this.pluginCallbacks.indexOf(e)===-1&&this.pluginCallbacks.push(e),this}unregister(e){return this.pluginCallbacks.indexOf(e)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,i,r){let s;const o={},a={};if(typeof e=="string")s=JSON.parse(e);else if(e instanceof ArrayBuffer)if(Gi.decodeText(new Uint8Array(e.slice(0,4)))===eL){try{o[St.KHR_BINARY_GLTF]=new hte(e)}catch(c){r&&r(c);return}s=JSON.parse(o[St.KHR_BINARY_GLTF].content)}else s=JSON.parse(Gi.decodeText(new Uint8Array(e)));else s=e;if(s.asset===void 0||s.asset.version[0]<2){r&&r(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}const l=new Mte(s,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});l.fileLoader.setRequestHeader(this.requestHeader);for(let c=0;c<this.pluginCallbacks.length;c++){const u=this.pluginCallbacks[c](l);a[u.name]=u,o[u.name]=!0}if(s.extensionsUsed)for(let c=0;c<s.extensionsUsed.length;++c){const u=s.extensionsUsed[c],h=s.extensionsRequired||[];switch(u){case St.KHR_MATERIALS_UNLIT:o[u]=new Kee;break;case St.KHR_DRACO_MESH_COMPRESSION:o[u]=new dte(s,this.dracoLoader);break;case St.KHR_TEXTURE_TRANSFORM:o[u]=new fte;break;case St.KHR_MESH_QUANTIZATION:o[u]=new pte;break;default:h.indexOf(u)>=0&&a[u]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+u+'".')}}l.setExtensions(o),l.setPlugins(a),l.parse(i,r)}parseAsync(e,t){const i=this;return new Promise(function(r,s){i.parse(e,t,r,s)})}}function Yee(){let n={};return{get:function(e){return n[e]},add:function(e,t){n[e]=t},remove:function(e){delete n[e]},removeAll:function(){n={}}}}const St={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class qee{constructor(e){this.parser=e,this.name=St.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let i=0,r=t.length;i<r;i++){const s=t[i];s.extensions&&s.extensions[this.name]&&s.extensions[this.name].light!==void 0&&e._addNodeRef(this.cache,s.extensions[this.name].light)}}_loadLight(e){const t=this.parser,i="light:"+e;let r=t.cache.get(i);if(r)return r;const s=t.json,o=((s.extensions&&s.extensions[this.name]||{}).lights||[])[e];let a;const l=new Pe(16777215);o.color!==void 0&&l.fromArray(o.color);const c=o.range!==void 0?o.range:0;switch(o.type){case"directional":a=new lg(l),a.target.position.set(0,0,-1),a.add(a.target);break;case"point":a=new jh(l),a.distance=c;break;case"spot":a=new ag(l),a.distance=c,o.spot=o.spot||{},o.spot.innerConeAngle=o.spot.innerConeAngle!==void 0?o.spot.innerConeAngle:0,o.spot.outerConeAngle=o.spot.outerConeAngle!==void 0?o.spot.outerConeAngle:Math.PI/4,a.angle=o.spot.outerConeAngle,a.penumbra=1-o.spot.innerConeAngle/o.spot.outerConeAngle,a.target.position.set(0,0,-1),a.add(a.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+o.type)}return a.position.set(0,0,0),a.decay=2,go(a,o),o.intensity!==void 0&&(a.intensity=o.intensity),a.name=t.createUniqueName(o.name||"light_"+e),r=Promise.resolve(a),t.cache.add(i,r),r}getDependency(e,t){if(e==="light")return this._loadLight(t)}createNodeAttachment(e){const t=this,i=this.parser,r=i.json.nodes[e],s=(r.extensions&&r.extensions[this.name]||{}).light;return s===void 0?null:this._loadLight(s).then(function(o){return i._getNodeRef(t.cache,s,o)})}}class Kee{constructor(){this.name=St.KHR_MATERIALS_UNLIT}getMaterialType(){return Jn}extendParams(e,t,i){const r=[];e.color=new Pe(1,1,1),e.opacity=1;const s=t.pbrMetallicRoughness;if(s){if(Array.isArray(s.baseColorFactor)){const o=s.baseColorFactor;e.color.fromArray(o),e.opacity=o[3]}s.baseColorTexture!==void 0&&r.push(i.assignTexture(e,"map",s.baseColorTexture,3001))}return Promise.all(r)}}class Zee{constructor(e){this.parser=e,this.name=St.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(e,t){const i=this.parser.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=i.extensions[this.name].emissiveStrength;return r!==void 0&&(t.emissiveIntensity=r),Promise.resolve()}}class Jee{constructor(e){this.parser=e,this.name=St.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){const t=this.parser.json.materials[e];return!t.extensions||!t.extensions[this.name]?null:us}extendMaterialParams(e,t){const i=this.parser,r=i.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const s=[],o=r.extensions[this.name];if(o.clearcoatFactor!==void 0&&(t.clearcoat=o.clearcoatFactor),o.clearcoatTexture!==void 0&&s.push(i.assignTexture(t,"clearcoatMap",o.clearcoatTexture)),o.clearcoatRoughnessFactor!==void 0&&(t.clearcoatRoughness=o.clearcoatRoughnessFactor),o.clearcoatRoughnessTexture!==void 0&&s.push(i.assignTexture(t,"clearcoatRoughnessMap",o.clearcoatRoughnessTexture)),o.clearcoatNormalTexture!==void 0&&(s.push(i.assignTexture(t,"clearcoatNormalMap",o.clearcoatNormalTexture)),o.clearcoatNormalTexture.scale!==void 0)){const a=o.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new _e(a,a)}return Promise.all(s)}}class Qee{constructor(e){this.parser=e,this.name=St.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){const t=this.parser.json.materials[e];return!t.extensions||!t.extensions[this.name]?null:us}extendMaterialParams(e,t){const i=this.parser,r=i.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const s=[],o=r.extensions[this.name];return o.iridescenceFactor!==void 0&&(t.iridescence=o.iridescenceFactor),o.iridescenceTexture!==void 0&&s.push(i.assignTexture(t,"iridescenceMap",o.iridescenceTexture)),o.iridescenceIor!==void 0&&(t.iridescenceIOR=o.iridescenceIor),t.iridescenceThicknessRange===void 0&&(t.iridescenceThicknessRange=[100,400]),o.iridescenceThicknessMinimum!==void 0&&(t.iridescenceThicknessRange[0]=o.iridescenceThicknessMinimum),o.iridescenceThicknessMaximum!==void 0&&(t.iridescenceThicknessRange[1]=o.iridescenceThicknessMaximum),o.iridescenceThicknessTexture!==void 0&&s.push(i.assignTexture(t,"iridescenceThicknessMap",o.iridescenceThicknessTexture)),Promise.all(s)}}class ete{constructor(e){this.parser=e,this.name=St.KHR_MATERIALS_SHEEN}getMaterialType(e){const t=this.parser.json.materials[e];return!t.extensions||!t.extensions[this.name]?null:us}extendMaterialParams(e,t){const i=this.parser,r=i.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const s=[];t.sheenColor=new Pe(0,0,0),t.sheenRoughness=0,t.sheen=1;const o=r.extensions[this.name];return o.sheenColorFactor!==void 0&&t.sheenColor.fromArray(o.sheenColorFactor),o.sheenRoughnessFactor!==void 0&&(t.sheenRoughness=o.sheenRoughnessFactor),o.sheenColorTexture!==void 0&&s.push(i.assignTexture(t,"sheenColorMap",o.sheenColorTexture,3001)),o.sheenRoughnessTexture!==void 0&&s.push(i.assignTexture(t,"sheenRoughnessMap",o.sheenRoughnessTexture)),Promise.all(s)}}class tte{constructor(e){this.parser=e,this.name=St.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){const t=this.parser.json.materials[e];return!t.extensions||!t.extensions[this.name]?null:us}extendMaterialParams(e,t){const i=this.parser,r=i.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const s=[],o=r.extensions[this.name];return o.transmissionFactor!==void 0&&(t.transmission=o.transmissionFactor),o.transmissionTexture!==void 0&&s.push(i.assignTexture(t,"transmissionMap",o.transmissionTexture)),Promise.all(s)}}class nte{constructor(e){this.parser=e,this.name=St.KHR_MATERIALS_VOLUME}getMaterialType(e){const t=this.parser.json.materials[e];return!t.extensions||!t.extensions[this.name]?null:us}extendMaterialParams(e,t){const i=this.parser,r=i.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const s=[],o=r.extensions[this.name];t.thickness=o.thicknessFactor!==void 0?o.thicknessFactor:0,o.thicknessTexture!==void 0&&s.push(i.assignTexture(t,"thicknessMap",o.thicknessTexture)),t.attenuationDistance=o.attenuationDistance||1/0;const a=o.attenuationColor||[1,1,1];return t.attenuationColor=new Pe(a[0],a[1],a[2]),Promise.all(s)}}class ite{constructor(e){this.parser=e,this.name=St.KHR_MATERIALS_IOR}getMaterialType(e){const t=this.parser.json.materials[e];return!t.extensions||!t.extensions[this.name]?null:us}extendMaterialParams(e,t){const i=this.parser.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=i.extensions[this.name];return t.ior=r.ior!==void 0?r.ior:1.5,Promise.resolve()}}class rte{constructor(e){this.parser=e,this.name=St.KHR_MATERIALS_SPECULAR}getMaterialType(e){const t=this.parser.json.materials[e];return!t.extensions||!t.extensions[this.name]?null:us}extendMaterialParams(e,t){const i=this.parser,r=i.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const s=[],o=r.extensions[this.name];t.specularIntensity=o.specularFactor!==void 0?o.specularFactor:1,o.specularTexture!==void 0&&s.push(i.assignTexture(t,"specularIntensityMap",o.specularTexture));const a=o.specularColorFactor||[1,1,1];return t.specularColor=new Pe(a[0],a[1],a[2]),o.specularColorTexture!==void 0&&s.push(i.assignTexture(t,"specularColorMap",o.specularColorTexture,3001)),Promise.all(s)}}class ste{constructor(e){this.parser=e,this.name=St.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){const t=this.parser.json.materials[e];return!t.extensions||!t.extensions[this.name]?null:us}extendMaterialParams(e,t){const i=this.parser,r=i.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const s=[],o=r.extensions[this.name];return o.anisotropyStrength!==void 0&&(t.anisotropy=o.anisotropyStrength),o.anisotropyRotation!==void 0&&(t.anisotropyRotation=o.anisotropyRotation),o.anisotropyTexture!==void 0&&s.push(i.assignTexture(t,"anisotropyMap",o.anisotropyTexture)),Promise.all(s)}}class ote{constructor(e){this.parser=e,this.name=St.KHR_TEXTURE_BASISU}loadTexture(e){const t=this.parser,i=t.json,r=i.textures[e];if(!r.extensions||!r.extensions[this.name])return null;const s=r.extensions[this.name],o=t.options.ktx2Loader;if(!o){if(i.extensionsRequired&&i.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,s.source,o)}}class ate{constructor(e){this.parser=e,this.name=St.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){const t=this.name,i=this.parser,r=i.json,s=r.textures[e];if(!s.extensions||!s.extensions[t])return null;const o=s.extensions[t],a=r.images[o.source];let l=i.textureLoader;if(a.uri){const c=i.options.manager.getHandler(a.uri);c!==null&&(l=c)}return this.detectSupport().then(function(c){if(c)return i.loadTextureImage(e,o.source,l);if(r.extensionsRequired&&r.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return i.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(t.height===1)}})),this.isSupported}}class lte{constructor(e){this.parser=e,this.name=St.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(e){const t=this.name,i=this.parser,r=i.json,s=r.textures[e];if(!s.extensions||!s.extensions[t])return null;const o=s.extensions[t],a=r.images[o.source];let l=i.textureLoader;if(a.uri){const c=i.options.manager.getHandler(a.uri);c!==null&&(l=c)}return this.detectSupport().then(function(c){if(c)return i.loadTextureImage(e,o.source,l);if(r.extensionsRequired&&r.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return i.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const t=new Image;t.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",t.onload=t.onerror=function(){e(t.height===1)}})),this.isSupported}}class cte{constructor(e){this.name=St.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const t=this.parser.json,i=t.bufferViews[e];if(i.extensions&&i.extensions[this.name]){const r=i.extensions[this.name],s=this.parser.getDependency("buffer",r.buffer),o=this.parser.options.meshoptDecoder;if(!o||!o.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return s.then(function(a){const l=r.byteOffset||0,c=r.byteLength||0,u=r.count,h=r.byteStride,d=new Uint8Array(a,l,c);return o.decodeGltfBufferAsync?o.decodeGltfBufferAsync(u,h,d,r.mode,r.filter).then(function(f){return f.buffer}):o.ready.then(function(){const f=new ArrayBuffer(u*h);return o.decodeGltfBuffer(new Uint8Array(f),u,h,d,r.mode,r.filter),f})})}else return null}}class ute{constructor(e){this.name=St.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const t=this.parser.json,i=t.nodes[e];if(!i.extensions||!i.extensions[this.name]||i.mesh===void 0)return null;const r=t.meshes[i.mesh];for(const l of r.primitives)if(l.mode!==Ji.TRIANGLES&&l.mode!==Ji.TRIANGLE_STRIP&&l.mode!==Ji.TRIANGLE_FAN&&l.mode!==void 0)return null;const s=i.extensions[this.name].attributes,o=[],a={};for(const l in s)o.push(this.parser.getDependency("accessor",s[l]).then(c=>(a[l]=c,a[l])));return o.length<1?null:(o.push(this.parser.createNodeMesh(e)),Promise.all(o).then(l=>{const c=l.pop(),u=c.isGroup?c.children:[c],h=l[0].count,d=[];for(const f of u){const p=new ze,v=new D,m=new gt,g=new D(1,1,1),b=new vb(f.geometry,f.material,h);for(let _=0;_<h;_++)a.TRANSLATION&&v.fromBufferAttribute(a.TRANSLATION,_),a.ROTATION&&m.fromBufferAttribute(a.ROTATION,_),a.SCALE&&g.fromBufferAttribute(a.SCALE,_),b.setMatrixAt(_,p.compose(v,m,g));for(const _ in a)_!=="TRANSLATION"&&_!=="ROTATION"&&_!=="SCALE"&&f.geometry.setAttribute(_,a[_]);pt.prototype.copy.call(b,f),this.parser.assignFinalMaterial(b),d.push(b)}return c.isGroup?(c.clear(),c.add(...d),c):d[0]}))}}const eL="glTF",Au=12,BE={JSON:1313821514,BIN:5130562};class hte{constructor(e){this.name=St.KHR_BINARY_GLTF,this.content=null,this.body=null;const t=new DataView(e,0,Au);if(this.header={magic:Gi.decodeText(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==eL)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const i=this.header.length-Au,r=new DataView(e,Au);let s=0;for(;s<i;){const o=r.getUint32(s,!0);s+=4;const a=r.getUint32(s,!0);if(s+=4,a===BE.JSON){const l=new Uint8Array(e,Au+s,o);this.content=Gi.decodeText(l)}else if(a===BE.BIN){const l=Au+s;this.body=e.slice(l,l+o)}s+=o}if(this.content===null)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class dte{constructor(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=St.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){const i=this.json,r=this.dracoLoader,s=e.extensions[this.name].bufferView,o=e.extensions[this.name].attributes,a={},l={},c={};for(const u in o){const h=I_[u]||u.toLowerCase();a[h]=o[u]}for(const u in e.attributes){const h=I_[u]||u.toLowerCase();if(o[u]!==void 0){const d=i.accessors[e.attributes[u]],f=gc[d.componentType];c[h]=f.name,l[h]=d.normalized===!0}}return t.getDependency("bufferView",s).then(function(u){return new Promise(function(h){r.decodeDracoFile(u,function(d){for(const f in d.attributes){const p=d.attributes[f],v=l[f];v!==void 0&&(p.normalized=v)}h(d)},a,c)})})}}class fte{constructor(){this.name=St.KHR_TEXTURE_TRANSFORM}extendTexture(e,t){return(t.texCoord===void 0||t.texCoord===e.channel)&&t.offset===void 0&&t.rotation===void 0&&t.scale===void 0||(e=e.clone(),t.texCoord!==void 0&&(e.channel=t.texCoord),t.offset!==void 0&&e.offset.fromArray(t.offset),t.rotation!==void 0&&(e.rotation=t.rotation),t.scale!==void 0&&e.repeat.fromArray(t.scale),e.needsUpdate=!0),e}}class pte{constructor(){this.name=St.KHR_MESH_QUANTIZATION}}class tL extends Xc{constructor(e,t,i,r){super(e,t,i,r)}copySampleValue_(e){const t=this.resultBuffer,i=this.sampleValues,r=this.valueSize,s=e*r*3+r;for(let o=0;o!==r;o++)t[o]=i[s+o];return t}interpolate_(e,t,i,r){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=a*2,c=a*3,u=r-t,h=(i-t)/u,d=h*h,f=d*h,p=e*c,v=p-c,m=-2*f+3*d,g=f-d,b=1-m,_=g-d+h;for(let y=0;y!==a;y++){const T=o[v+y+a],S=o[v+y+l]*u,E=o[p+y+a],x=o[p+y]*u;s[y]=b*T+_*S+m*E+g*x}return s}}const mte=new gt;class gte extends tL{interpolate_(e,t,i,r){const s=super.interpolate_(e,t,i,r);return mte.fromArray(s).normalize().toArray(s),s}}const Ji={FLOAT:5126,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,LINEAR:9729,REPEAT:10497,SAMPLER_2D:35678,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123},gc={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},zE={9728:hn,9729:rn,9984:Ih,9985:Lm,9986:hc,9987:rs},VE={33071:Rn,33648:Ac,10497:is},Dv={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},I_=ii(Bt({POSITION:"position",NORMAL:"normal",TANGENT:"tangent"},_ee>=152?{TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3"}:{TEXCOORD_0:"uv",TEXCOORD_1:"uv2"}),{COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"}),oo={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},vte={CUBICSPLINE:void 0,LINEAR:Va,STEP:Pc},Uv={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function _te(n){return n.DefaultMaterial===void 0&&(n.DefaultMaterial=new ol({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:ns})),n.DefaultMaterial}function la(n,e,t){for(const i in t.extensions)n[i]===void 0&&(e.userData.gltfExtensions=e.userData.gltfExtensions||{},e.userData.gltfExtensions[i]=t.extensions[i])}function go(n,e){e.extras!==void 0&&(typeof e.extras=="object"?Object.assign(n.userData,e.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+e.extras))}function yte(n,e,t){let i=!1,r=!1,s=!1;for(let c=0,u=e.length;c<u;c++){const h=e[c];if(h.POSITION!==void 0&&(i=!0),h.NORMAL!==void 0&&(r=!0),h.COLOR_0!==void 0&&(s=!0),i&&r&&s)break}if(!i&&!r&&!s)return Promise.resolve(n);const o=[],a=[],l=[];for(let c=0,u=e.length;c<u;c++){const h=e[c];if(i){const d=h.POSITION!==void 0?t.getDependency("accessor",h.POSITION):n.attributes.position;o.push(d)}if(r){const d=h.NORMAL!==void 0?t.getDependency("accessor",h.NORMAL):n.attributes.normal;a.push(d)}if(s){const d=h.COLOR_0!==void 0?t.getDependency("accessor",h.COLOR_0):n.attributes.color;l.push(d)}}return Promise.all([Promise.all(o),Promise.all(a),Promise.all(l)]).then(function(c){const u=c[0],h=c[1],d=c[2];return i&&(n.morphAttributes.position=u),r&&(n.morphAttributes.normal=h),s&&(n.morphAttributes.color=d),n.morphTargetsRelative=!0,n})}function bte(n,e){if(n.updateMorphTargets(),e.weights!==void 0)for(let t=0,i=e.weights.length;t<i;t++)n.morphTargetInfluences[t]=e.weights[t];if(e.extras&&Array.isArray(e.extras.targetNames)){const t=e.extras.targetNames;if(n.morphTargetInfluences.length===t.length){n.morphTargetDictionary={};for(let i=0,r=t.length;i<r;i++)n.morphTargetDictionary[t[i]]=i}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function xte(n){let e;const t=n.extensions&&n.extensions[St.KHR_DRACO_MESH_COMPRESSION];if(t?e="draco:"+t.bufferView+":"+t.indices+":"+Nv(t.attributes):e=n.indices+":"+Nv(n.attributes)+":"+n.mode,n.targets!==void 0)for(let i=0,r=n.targets.length;i<r;i++)e+=":"+Nv(n.targets[i]);return e}function Nv(n){let e="";const t=Object.keys(n).sort();for(let i=0,r=t.length;i<r;i++)e+=t[i]+":"+n[t[i]]+";";return e}function D_(n){switch(n){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}function wte(n){return n.search(/\.jpe?g($|\?)/i)>0||n.search(/^data\:image\/jpeg/)===0?"image/jpeg":n.search(/\.webp($|\?)/i)>0||n.search(/^data\:image\/webp/)===0?"image/webp":"image/png"}const Ste=new ze;class Mte{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new Yee,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let i=!1,r=!1,s=-1;typeof navigator<"u"&&typeof navigator.userAgent<"u"&&(i=/^((?!chrome|android).)*safari/i.test(navigator.userAgent)===!0,r=navigator.userAgent.indexOf("Firefox")>-1,s=r?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1),typeof createImageBitmap>"u"||i||r&&s<98?this.textureLoader=new og(this.options.manager):this.textureLoader=new T3(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new Ti(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){const i=this,r=this.json,s=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(o){return o._markDefs&&o._markDefs()}),Promise.all(this._invokeAll(function(o){return o.beforeRoot&&o.beforeRoot()})).then(function(){return Promise.all([i.getDependencies("scene"),i.getDependencies("animation"),i.getDependencies("camera")])}).then(function(o){const a={scene:o[0][r.scene||0],scenes:o[0],animations:o[1],cameras:o[2],asset:r.asset,parser:i,userData:{}};la(s,a,r),go(a,r),Promise.all(i._invokeAll(function(l){return l.afterRoot&&l.afterRoot(a)})).then(function(){e(a)})}).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],i=this.json.meshes||[];for(let r=0,s=t.length;r<s;r++){const o=t[r].joints;for(let a=0,l=o.length;a<l;a++)e[o[a]].isBone=!0}for(let r=0,s=e.length;r<s;r++){const o=e[r];o.mesh!==void 0&&(this._addNodeRef(this.meshCache,o.mesh),o.skin!==void 0&&(i[o.mesh].isSkinnedMesh=!0)),o.camera!==void 0&&this._addNodeRef(this.cameraCache,o.camera)}}_addNodeRef(e,t){t!==void 0&&(e.refs[t]===void 0&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)}_getNodeRef(e,t,i){if(e.refs[t]<=1)return i;const r=i.clone(),s=(o,a)=>{const l=this.associations.get(o);l!=null&&this.associations.set(a,l);for(const[c,u]of o.children.entries())s(u,a.children[c])};return s(i,r),r.name+="_instance_"+e.uses[t]++,r}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let i=0;i<t.length;i++){const r=e(t[i]);if(r)return r}return null}_invokeAll(e){const t=Object.values(this.plugins);t.unshift(this);const i=[];for(let r=0;r<t.length;r++){const s=e(t[r]);s&&i.push(s)}return i}getDependency(e,t){const i=e+":"+t;let r=this.cache.get(i);if(!r){switch(e){case"scene":r=this.loadScene(t);break;case"node":r=this._invokeOne(function(s){return s.loadNode&&s.loadNode(t)});break;case"mesh":r=this._invokeOne(function(s){return s.loadMesh&&s.loadMesh(t)});break;case"accessor":r=this.loadAccessor(t);break;case"bufferView":r=this._invokeOne(function(s){return s.loadBufferView&&s.loadBufferView(t)});break;case"buffer":r=this.loadBuffer(t);break;case"material":r=this._invokeOne(function(s){return s.loadMaterial&&s.loadMaterial(t)});break;case"texture":r=this._invokeOne(function(s){return s.loadTexture&&s.loadTexture(t)});break;case"skin":r=this.loadSkin(t);break;case"animation":r=this._invokeOne(function(s){return s.loadAnimation&&s.loadAnimation(t)});break;case"camera":r=this.loadCamera(t);break;default:if(r=this._invokeOne(function(s){return s!=this&&s.getDependency&&s.getDependency(e,t)}),!r)throw new Error("Unknown type: "+e);break}this.cache.add(i,r)}return r}getDependencies(e){let t=this.cache.get(e);if(!t){const i=this,r=this.json[e+(e==="mesh"?"es":"s")]||[];t=Promise.all(r.map(function(s,o){return i.getDependency(e,o)})),this.cache.add(e,t)}return t}loadBuffer(e){const t=this.json.buffers[e],i=this.fileLoader;if(t.type&&t.type!=="arraybuffer")throw new Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(t.uri===void 0&&e===0)return Promise.resolve(this.extensions[St.KHR_BINARY_GLTF].body);const r=this.options;return new Promise(function(s,o){i.load(Gi.resolveURL(t.uri,r.path),s,void 0,function(){o(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))})})}loadBufferView(e){const t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then(function(i){const r=t.byteLength||0,s=t.byteOffset||0;return i.slice(s,s+r)})}loadAccessor(e){const t=this,i=this.json,r=this.json.accessors[e];if(r.bufferView===void 0&&r.sparse===void 0){const o=Dv[r.type],a=gc[r.componentType],l=r.normalized===!0,c=new a(r.count*o);return Promise.resolve(new At(c,o,l))}const s=[];return r.bufferView!==void 0?s.push(this.getDependency("bufferView",r.bufferView)):s.push(null),r.sparse!==void 0&&(s.push(this.getDependency("bufferView",r.sparse.indices.bufferView)),s.push(this.getDependency("bufferView",r.sparse.values.bufferView))),Promise.all(s).then(function(o){const a=o[0],l=Dv[r.type],c=gc[r.componentType],u=c.BYTES_PER_ELEMENT,h=u*l,d=r.byteOffset||0,f=r.bufferView!==void 0?i.bufferViews[r.bufferView].byteStride:void 0,p=r.normalized===!0;let v,m;if(f&&f!==h){const g=Math.floor(d/f),b="InterleavedBuffer:"+r.bufferView+":"+r.componentType+":"+g+":"+r.count;let _=t.cache.get(b);_||(v=new c(a,g*f,r.count*f/u),_=new Wc(v,f/u),t.cache.add(b,_)),m=new os(_,l,d%f/u,p)}else a===null?v=new c(r.count*l):v=new c(a,d,r.count*l),m=new At(v,l,p);if(r.sparse!==void 0){const g=Dv.SCALAR,b=gc[r.sparse.indices.componentType],_=r.sparse.indices.byteOffset||0,y=r.sparse.values.byteOffset||0,T=new b(o[1],_,r.sparse.count*g),S=new c(o[2],y,r.sparse.count*l);a!==null&&(m=new At(m.array.slice(),m.itemSize,m.normalized));for(let E=0,x=T.length;E<x;E++){const M=T[E];if(m.setX(M,S[E*l]),l>=2&&m.setY(M,S[E*l+1]),l>=3&&m.setZ(M,S[E*l+2]),l>=4&&m.setW(M,S[E*l+3]),l>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return m})}loadTexture(e){const t=this.json,i=this.options,r=t.textures[e].source,s=t.images[r];let o=this.textureLoader;if(s.uri){const a=i.manager.getHandler(s.uri);a!==null&&(o=a)}return this.loadTextureImage(e,r,o)}loadTextureImage(e,t,i){const r=this,s=this.json,o=s.textures[e],a=s.images[t],l=(a.uri||a.bufferView)+":"+o.sampler;if(this.textureCache[l])return this.textureCache[l];const c=this.loadImageSource(t,i).then(function(u){u.flipY=!1,u.name=o.name||a.name||"",u.name===""&&typeof a.uri=="string"&&a.uri.startsWith("data:image/")===!1&&(u.name=a.uri);const h=(s.samplers||{})[o.sampler]||{};return u.magFilter=zE[h.magFilter]||rn,u.minFilter=zE[h.minFilter]||rs,u.wrapS=VE[h.wrapS]||is,u.wrapT=VE[h.wrapT]||is,r.associations.set(u,{textures:e}),u}).catch(function(){return null});return this.textureCache[l]=c,c}loadImageSource(e,t){const i=this,r=this.json,s=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(h=>h.clone());const o=r.images[e],a=self.URL||self.webkitURL;let l=o.uri||"",c=!1;if(o.bufferView!==void 0)l=i.getDependency("bufferView",o.bufferView).then(function(h){c=!0;const d=new Blob([h],{type:o.mimeType});return l=a.createObjectURL(d),l});else if(o.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const u=Promise.resolve(l).then(function(h){return new Promise(function(d,f){let p=d;t.isImageBitmapLoader===!0&&(p=function(v){const m=new Jt(v);m.needsUpdate=!0,d(m)}),t.load(Gi.resolveURL(h,s.path),p,void 0,f)})}).then(function(h){return c===!0&&a.revokeObjectURL(l),h.userData.mimeType=o.mimeType||wte(o.uri),h}).catch(function(h){throw console.error("THREE.GLTFLoader: Couldn't load texture",l),h});return this.sourceCache[e]=u,u}assignTexture(e,t,i,r){const s=this;return this.getDependency("texture",i.index).then(function(o){if(!o)return null;if(i.texCoord!==void 0&&i.texCoord>0&&(o=o.clone(),o.channel=i.texCoord),s.extensions[St.KHR_TEXTURE_TRANSFORM]){const a=i.extensions!==void 0?i.extensions[St.KHR_TEXTURE_TRANSFORM]:void 0;if(a){const l=s.associations.get(o);o=s.extensions[St.KHR_TEXTURE_TRANSFORM].extendTexture(o,a),s.associations.set(o,l)}}return r!==void 0&&("colorSpace"in o?o.colorSpace=r===3001?"srgb":"srgb-linear":o.encoding=r),e[t]=o,o})}assignFinalMaterial(e){const t=e.geometry;let i=e.material;const r=t.attributes.tangent===void 0,s=t.attributes.color!==void 0,o=t.attributes.normal===void 0;if(e.isPoints){const a="PointsMaterial:"+i.uuid;let l=this.cache.get(a);l||(l=new Wm,En.prototype.copy.call(l,i),l.color.copy(i.color),l.map=i.map,l.sizeAttenuation=!1,this.cache.add(a,l)),i=l}else if(e.isLine){const a="LineBasicMaterial:"+i.uuid;let l=this.cache.get(a);l||(l=new Bn,En.prototype.copy.call(l,i),l.color.copy(i.color),l.map=i.map,this.cache.add(a,l)),i=l}if(r||s||o){let a="ClonedMaterial:"+i.uuid+":";r&&(a+="derivative-tangents:"),s&&(a+="vertex-colors:"),o&&(a+="flat-shading:");let l=this.cache.get(a);l||(l=i.clone(),s&&(l.vertexColors=!0),o&&(l.flatShading=!0),r&&(l.normalScale&&(l.normalScale.y*=-1),l.clearcoatNormalScale&&(l.clearcoatNormalScale.y*=-1)),this.cache.add(a,l),this.associations.set(l,this.associations.get(i))),i=l}e.material=i}getMaterialType(){return ol}loadMaterial(e){const t=this,i=this.json,r=this.extensions,s=i.materials[e];let o;const a={},l=s.extensions||{},c=[];if(l[St.KHR_MATERIALS_UNLIT]){const h=r[St.KHR_MATERIALS_UNLIT];o=h.getMaterialType(),c.push(h.extendParams(a,s,t))}else{const h=s.pbrMetallicRoughness||{};if(a.color=new Pe(1,1,1),a.opacity=1,Array.isArray(h.baseColorFactor)){const d=h.baseColorFactor;a.color.fromArray(d),a.opacity=d[3]}h.baseColorTexture!==void 0&&c.push(t.assignTexture(a,"map",h.baseColorTexture,3001)),a.metalness=h.metallicFactor!==void 0?h.metallicFactor:1,a.roughness=h.roughnessFactor!==void 0?h.roughnessFactor:1,h.metallicRoughnessTexture!==void 0&&(c.push(t.assignTexture(a,"metalnessMap",h.metallicRoughnessTexture)),c.push(t.assignTexture(a,"roughnessMap",h.metallicRoughnessTexture))),o=this._invokeOne(function(d){return d.getMaterialType&&d.getMaterialType(e)}),c.push(Promise.all(this._invokeAll(function(d){return d.extendMaterialParams&&d.extendMaterialParams(e,a)})))}s.doubleSided===!0&&(a.side=bi);const u=s.alphaMode||Uv.OPAQUE;if(u===Uv.BLEND?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,u===Uv.MASK&&(a.alphaTest=s.alphaCutoff!==void 0?s.alphaCutoff:.5)),s.normalTexture!==void 0&&o!==Jn&&(c.push(t.assignTexture(a,"normalMap",s.normalTexture)),a.normalScale=new _e(1,1),s.normalTexture.scale!==void 0)){const h=s.normalTexture.scale;a.normalScale.set(h,h)}return s.occlusionTexture!==void 0&&o!==Jn&&(c.push(t.assignTexture(a,"aoMap",s.occlusionTexture)),s.occlusionTexture.strength!==void 0&&(a.aoMapIntensity=s.occlusionTexture.strength)),s.emissiveFactor!==void 0&&o!==Jn&&(a.emissive=new Pe().fromArray(s.emissiveFactor)),s.emissiveTexture!==void 0&&o!==Jn&&c.push(t.assignTexture(a,"emissiveMap",s.emissiveTexture,3001)),Promise.all(c).then(function(){const h=new o(a);return s.name&&(h.name=s.name),go(h,s),t.associations.set(h,{materials:e}),s.extensions&&la(r,h,s),h})}createUniqueName(e){const t=yt.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){const t=this,i=this.extensions,r=this.primitiveCache;function s(a){return i[St.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a,t).then(function(l){return HE(l,a,t)})}const o=[];for(let a=0,l=e.length;a<l;a++){const c=e[a],u=xte(c),h=r[u];if(h)o.push(h.promise);else{let d;c.extensions&&c.extensions[St.KHR_DRACO_MESH_COMPRESSION]?d=s(c):d=HE(new qe,c,t),r[u]={primitive:c,promise:d},o.push(d)}}return Promise.all(o)}loadMesh(e){const t=this,i=this.json,r=this.extensions,s=i.meshes[e],o=s.primitives,a=[];for(let l=0,c=o.length;l<c;l++){const u=o[l].material===void 0?_te(this.cache):this.getDependency("material",o[l].material);a.push(u)}return a.push(t.loadGeometries(o)),Promise.all(a).then(function(l){const c=l.slice(0,l.length-1),u=l[l.length-1],h=[];for(let f=0,p=u.length;f<p;f++){const v=u[f],m=o[f];let g;const b=c[f];if(m.mode===Ji.TRIANGLES||m.mode===Ji.TRIANGLE_STRIP||m.mode===Ji.TRIANGLE_FAN||m.mode===void 0)g=s.isSkinnedMesh===!0?new Gm(v,b):new Be(v,b),g.isSkinnedMesh===!0&&g.normalizeSkinWeights(),m.mode===Ji.TRIANGLE_STRIP?g.geometry=UE(g.geometry,ob):m.mode===Ji.TRIANGLE_FAN&&(g.geometry=UE(g.geometry,Hp));else if(m.mode===Ji.LINES)g=new Fr(v,b);else if(m.mode===Ji.LINE_STRIP)g=new ct(v,b);else if(m.mode===Ji.LINE_LOOP)g=new _b(v,b);else if(m.mode===Ji.POINTS)g=new yb(v,b);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+m.mode);Object.keys(g.geometry.morphAttributes).length>0&&bte(g,s),g.name=t.createUniqueName(s.name||"mesh_"+e),go(g,s),m.extensions&&la(r,g,m),t.assignFinalMaterial(g),h.push(g)}for(let f=0,p=h.length;f<p;f++)t.associations.set(h[f],{meshes:e,primitives:f});if(h.length===1)return s.extensions&&la(r,h[0],s),h[0];const d=new Mr;s.extensions&&la(r,d,s),t.associations.set(d,{meshes:e});for(let f=0,p=h.length;f<p;f++)d.add(h[f]);return d})}loadCamera(e){let t;const i=this.json.cameras[e],r=i[i.type];if(!r){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}return i.type==="perspective"?t=new Nt(Gn.radToDeg(r.yfov),r.aspectRatio||1,r.znear||1,r.zfar||2e6):i.type==="orthographic"&&(t=new zi(-r.xmag,r.xmag,r.ymag,-r.ymag,r.znear,r.zfar)),i.name&&(t.name=this.createUniqueName(i.name)),go(t,i),Promise.resolve(t)}loadSkin(e){const t=this.json.skins[e],i=[];for(let r=0,s=t.joints.length;r<s;r++)i.push(this._loadNodeShallow(t.joints[r]));return t.inverseBindMatrices!==void 0?i.push(this.getDependency("accessor",t.inverseBindMatrices)):i.push(null),Promise.all(i).then(function(r){const s=r.pop(),o=r,a=[],l=[];for(let c=0,u=o.length;c<u;c++){const h=o[c];if(h){a.push(h);const d=new ze;s!==null&&d.fromArray(s.array,c*16),l.push(d)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[c])}return new $c(a,l)})}loadAnimation(e){const t=this.json.animations[e],i=t.name?t.name:"animation_"+e,r=[],s=[],o=[],a=[],l=[];for(let c=0,u=t.channels.length;c<u;c++){const h=t.channels[c],d=t.samplers[h.sampler],f=h.target,p=f.node,v=t.parameters!==void 0?t.parameters[d.input]:d.input,m=t.parameters!==void 0?t.parameters[d.output]:d.output;f.node!==void 0&&(r.push(this.getDependency("node",p)),s.push(this.getDependency("accessor",v)),o.push(this.getDependency("accessor",m)),a.push(d),l.push(f))}return Promise.all([Promise.all(r),Promise.all(s),Promise.all(o),Promise.all(a),Promise.all(l)]).then(function(c){const u=c[0],h=c[1],d=c[2],f=c[3],p=c[4],v=[];for(let m=0,g=u.length;m<g;m++){const b=u[m],_=h[m],y=d[m],T=f[m],S=p[m];if(b===void 0)continue;b.updateMatrix();let E;switch(oo[S.path]){case oo.weights:E=Ga;break;case oo.rotation:E=Fs;break;case oo.position:case oo.scale:default:E=Wa;break}const x=b.name?b.name:b.uuid,M=T.interpolation!==void 0?vte[T.interpolation]:Va,w=[];oo[S.path]===oo.weights?b.traverse(function(L){L.morphTargetInfluences&&w.push(L.name?L.name:L.uuid)}):w.push(x);let C=y.array;if(y.normalized){const L=D_(C.constructor),$=new Float32Array(C.length);for(let U=0,H=C.length;U<H;U++)$[U]=C[U]*L;C=$}for(let L=0,$=w.length;L<$;L++){const U=new E(w[L]+"."+oo[S.path],_.array,C,M);T.interpolation==="CUBICSPLINE"&&(U.createInterpolant=function(H){const V=this instanceof Fs?gte:tL;return new V(this.times,this.values,this.getValueSize()/3,H)},U.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0),v.push(U)}}return new $a(i,void 0,v)})}createNodeMesh(e){const t=this.json,i=this,r=t.nodes[e];return r.mesh===void 0?null:i.getDependency("mesh",r.mesh).then(function(s){const o=i._getNodeRef(i.meshCache,r.mesh,s);return r.weights!==void 0&&o.traverse(function(a){if(a.isMesh)for(let l=0,c=r.weights.length;l<c;l++)a.morphTargetInfluences[l]=r.weights[l]}),o})}loadNode(e){const t=this.json,i=this,r=t.nodes[e],s=i._loadNodeShallow(e),o=[],a=r.children||[];for(let c=0,u=a.length;c<u;c++)o.push(i.getDependency("node",a[c]));const l=r.skin===void 0?Promise.resolve(null):i.getDependency("skin",r.skin);return Promise.all([s,Promise.all(o),l]).then(function(c){const u=c[0],h=c[1],d=c[2];d!==null&&u.traverse(function(f){f.isSkinnedMesh&&f.bind(d,Ste)});for(let f=0,p=h.length;f<p;f++)u.add(h[f]);return u})}_loadNodeShallow(e){const t=this.json,i=this.extensions,r=this;if(this.nodeCache[e]!==void 0)return this.nodeCache[e];const s=t.nodes[e],o=s.name?r.createUniqueName(s.name):"",a=[],l=r._invokeOne(function(c){return c.createNodeMesh&&c.createNodeMesh(e)});return l&&a.push(l),s.camera!==void 0&&a.push(r.getDependency("camera",s.camera).then(function(c){return r._getNodeRef(r.cameraCache,s.camera,c)})),r._invokeAll(function(c){return c.createNodeAttachment&&c.createNodeAttachment(e)}).forEach(function(c){a.push(c)}),this.nodeCache[e]=Promise.all(a).then(function(c){let u;if(s.isBone===!0?u=new Oc:c.length>1?u=new Mr:c.length===1?u=c[0]:u=new pt,u!==c[0])for(let h=0,d=c.length;h<d;h++)u.add(c[h]);if(s.name&&(u.userData.name=s.name,u.name=o),go(u,s),s.extensions&&la(i,u,s),s.matrix!==void 0){const h=new ze;h.fromArray(s.matrix),u.applyMatrix4(h)}else s.translation!==void 0&&u.position.fromArray(s.translation),s.rotation!==void 0&&u.quaternion.fromArray(s.rotation),s.scale!==void 0&&u.scale.fromArray(s.scale);return r.associations.has(u)||r.associations.set(u,{}),r.associations.get(u).nodes=e,u}),this.nodeCache[e]}loadScene(e){const t=this.extensions,i=this.json.scenes[e],r=this,s=new Mr;i.name&&(s.name=r.createUniqueName(i.name)),go(s,i),i.extensions&&la(t,s,i);const o=i.nodes||[],a=[];for(let l=0,c=o.length;l<c;l++)a.push(r.getDependency("node",o[l]));return Promise.all(a).then(function(l){for(let u=0,h=l.length;u<h;u++)s.add(l[u]);const c=u=>{const h=new Map;for(const[d,f]of r.associations)(d instanceof En||d instanceof Jt)&&h.set(d,f);return u.traverse(d=>{const f=r.associations.get(d);f!=null&&h.set(d,f)}),h};return r.associations=c(s),s})}}function Ete(n,e,t){const i=e.attributes,r=new Pi;if(i.POSITION!==void 0){const a=t.json.accessors[i.POSITION],l=a.min,c=a.max;if(l!==void 0&&c!==void 0){if(r.set(new D(l[0],l[1],l[2]),new D(c[0],c[1],c[2])),a.normalized){const u=D_(gc[a.componentType]);r.min.multiplyScalar(u),r.max.multiplyScalar(u)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;const s=e.targets;if(s!==void 0){const a=new D,l=new D;for(let c=0,u=s.length;c<u;c++){const h=s[c];if(h.POSITION!==void 0){const d=t.json.accessors[h.POSITION],f=d.min,p=d.max;if(f!==void 0&&p!==void 0){if(l.setX(Math.max(Math.abs(f[0]),Math.abs(p[0]))),l.setY(Math.max(Math.abs(f[1]),Math.abs(p[1]))),l.setZ(Math.max(Math.abs(f[2]),Math.abs(p[2]))),d.normalized){const v=D_(gc[d.componentType]);l.multiplyScalar(v)}a.max(l)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}r.expandByVector(a)}n.boundingBox=r;const o=new Ri;r.getCenter(o.center),o.radius=r.min.distanceTo(r.max)/2,n.boundingSphere=o}function HE(n,e,t){const i=e.attributes,r=[];function s(o,a){return t.getDependency("accessor",o).then(function(l){n.setAttribute(a,l)})}for(const o in i){const a=I_[o]||o.toLowerCase();a in n.attributes||r.push(s(i[o],a))}if(e.indices!==void 0&&!n.index){const o=t.getDependency("accessor",e.indices).then(function(a){n.setIndex(a)});r.push(o)}return go(n,e),Ete(n,e,t),Promise.all(r).then(function(){return e.targets!==void 0?yte(n,e.targets,t):n})}function nL(n,e,t){const i=t.length-n-1;if(e>=t[i])return i-1;if(e<=t[n])return n;let r=n,s=i,o=Math.floor((r+s)/2);for(;e<t[o]||e>=t[o+1];)e<t[o]?s=o:r=o,o=Math.floor((r+s)/2);return o}function Tte(n,e,t,i){const r=[],s=[],o=[];r[0]=1;for(let a=1;a<=t;++a){s[a]=e-i[n+1-a],o[a]=i[n+a]-e;let l=0;for(let c=0;c<a;++c){const u=o[c+1],h=s[a-c],d=r[c]/(u+h);r[c]=l+u*d,l=h*d}r[a]=l}return r}function Ate(n,e,t,i){const r=nL(n,i,e),s=Tte(r,i,n,e),o=new vt(0,0,0,0);for(let a=0;a<=n;++a){const l=t[r-n+a],c=s[a],u=l.w*c;o.x+=l.x*u,o.y+=l.y*u,o.z+=l.z*u,o.w+=l.w*c}return o}function Cte(n,e,t,i,r){const s=[];for(let h=0;h<=t;++h)s[h]=0;const o=[];for(let h=0;h<=i;++h)o[h]=s.slice(0);const a=[];for(let h=0;h<=t;++h)a[h]=s.slice(0);a[0][0]=1;const l=s.slice(0),c=s.slice(0);for(let h=1;h<=t;++h){l[h]=e-r[n+1-h],c[h]=r[n+h]-e;let d=0;for(let f=0;f<h;++f){const p=c[f+1],v=l[h-f];a[h][f]=p+v;const m=a[f][h-1]/a[h][f];a[f][h]=d+p*m,d=v*m}a[h][h]=d}for(let h=0;h<=t;++h)o[0][h]=a[h][t];for(let h=0;h<=t;++h){let d=0,f=1;const p=[];for(let v=0;v<=t;++v)p[v]=s.slice(0);p[0][0]=1;for(let v=1;v<=i;++v){let m=0;const g=h-v,b=t-v;h>=v&&(p[f][0]=p[d][0]/a[b+1][g],m=p[f][0]*a[g][b]);const _=g>=-1?1:-g,y=h-1<=b?v-1:t-h;for(let S=_;S<=y;++S)p[f][S]=(p[d][S]-p[d][S-1])/a[b+1][g+S],m+=p[f][S]*a[g+S][b];h<=b&&(p[f][v]=-p[d][v-1]/a[b+1][h],m+=p[f][v]*a[h][b]),o[v][h]=m;const T=d;d=f,f=T}}let u=t;for(let h=1;h<=i;++h){for(let d=0;d<=t;++d)o[h][d]*=u;u*=t-h}return o}function Pte(n,e,t,i,r){const s=r<n?r:n,o=[],a=nL(n,i,e),l=Cte(a,i,n,s,e),c=[];for(let u=0;u<t.length;++u){const h=t[u].clone(),d=h.w;h.x*=d,h.y*=d,h.z*=d,c[u]=h}for(let u=0;u<=s;++u){const h=c[a-n].clone().multiplyScalar(l[u][0]);for(let d=1;d<=n;++d)h.add(c[a-n+d].clone().multiplyScalar(l[u][d]));o[u]=h}for(let u=s+1;u<=r+1;++u)o[u]=new vt(0,0,0);return o}function Rte(n,e){let t=1;for(let r=2;r<=n;++r)t*=r;let i=1;for(let r=2;r<=e;++r)i*=r;for(let r=2;r<=n-e;++r)i*=r;return t/i}function Lte(n){const e=n.length,t=[],i=[];for(let s=0;s<e;++s){const o=n[s];t[s]=new D(o.x,o.y,o.z),i[s]=o.w}const r=[];for(let s=0;s<e;++s){const o=t[s].clone();for(let a=1;a<=s;++a)o.sub(r[s-a].clone().multiplyScalar(Rte(s,a)*i[a]));r[s]=o.divideScalar(i[0])}return r}function Ote(n,e,t,i,r){const s=Pte(n,e,t,i,r);return Lte(s)}class GE extends hr{constructor(e,t,i,r,s){super(),this.degree=e,this.knots=t,this.controlPoints=[],this.startKnot=r||0,this.endKnot=s||this.knots.length-1;for(let o=0;o<i.length;++o){const a=i[o];this.controlPoints[o]=new vt(a.x,a.y,a.z,a.w)}}getPoint(e,t){const i=t||new D,r=this.knots[this.startKnot]+e*(this.knots[this.endKnot]-this.knots[this.startKnot]),s=Ate(this.degree,this.knots,this.controlPoints,r);return s.w!=1&&s.divideScalar(s.w),i.set(s.x,s.y,s.z)}getTangent(e,t){const i=t||new D,r=this.knots[0]+e*(this.knots[this.knots.length-1]-this.knots[0]),s=Ote(this.degree,this.knots,this.controlPoints,r,1);return i.copy(s[1]).normalize(),i}}let xt,vn,_i;class Ite extends Xn{constructor(e){super(e)}load(e,t,i,r){const s=this,o=s.path===""?Gi.extractUrlBase(e):s.path,a=new Ti(this.manager);a.setPath(s.path),a.setResponseType("arraybuffer"),a.setRequestHeader(s.requestHeader),a.setWithCredentials(s.withCredentials),a.load(e,function(l){try{t(s.parse(l,o))}catch(c){r?r(c):console.error(c),s.manager.itemError(e)}},i,r)}parse(e,t){if(Bte(e))xt=new kte().parse(e);else{const r=oL(e);if(!zte(r))throw new Error("THREE.FBXLoader: Unknown format.");if($E(r)<7e3)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+$E(r));xt=new Fte().parse(r)}const i=new og(this.manager).setPath(this.resourcePath||t).setCrossOrigin(this.crossOrigin);return new Dte(i,this.manager).parse(xt)}}class Dte{constructor(e,t){this.textureLoader=e,this.manager=t}parse(){vn=this.parseConnections();const e=this.parseImages(),t=this.parseTextures(e),i=this.parseMaterials(t),r=this.parseDeformers(),s=new Ute().parse(r);return this.parseScene(r,s,i),_i}parseConnections(){const e=new Map;return"Connections"in xt&&xt.Connections.connections.forEach(function(t){const i=t[0],r=t[1],s=t[2];e.has(i)||e.set(i,{parents:[],children:[]});const o={ID:r,relationship:s};e.get(i).parents.push(o),e.has(r)||e.set(r,{parents:[],children:[]});const a={ID:i,relationship:s};e.get(r).children.push(a)}),e}parseImages(){const e={},t={};if("Video"in xt.Objects){const i=xt.Objects.Video;for(const r in i){const s=i[r],o=parseInt(r);if(e[o]=s.RelativeFilename||s.Filename,"Content"in s){const a=s.Content instanceof ArrayBuffer&&s.Content.byteLength>0,l=typeof s.Content=="string"&&s.Content!=="";if(a||l){const c=this.parseImage(i[r]);t[s.RelativeFilename||s.Filename]=c}}}}for(const i in e){const r=e[i];t[r]!==void 0?e[i]=t[r]:e[i]=e[i].split("\\").pop()}return e}parseImage(e){const t=e.Content,i=e.RelativeFilename||e.Filename,r=i.slice(i.lastIndexOf(".")+1).toLowerCase();let s;switch(r){case"bmp":s="image/bmp";break;case"jpg":case"jpeg":s="image/jpeg";break;case"png":s="image/png";break;case"tif":s="image/tiff";break;case"tga":this.manager.getHandler(".tga")===null&&console.warn("FBXLoader: TGA loader not found, skipping ",i),s="image/tga";break;default:console.warn('FBXLoader: Image type "'+r+'" is not supported.');return}if(typeof t=="string")return"data:"+s+";base64,"+t;{const o=new Uint8Array(t);return window.URL.createObjectURL(new Blob([o],{type:s}))}}parseTextures(e){const t=new Map;if("Texture"in xt.Objects){const i=xt.Objects.Texture;for(const r in i){const s=this.parseTexture(i[r],e);t.set(parseInt(r),s)}}return t}parseTexture(e,t){const i=this.loadTexture(e,t);i.ID=e.id,i.name=e.attrName;const r=e.WrapModeU,s=e.WrapModeV,o=r!==void 0?r.value:0,a=s!==void 0?s.value:0;if(i.wrapS=o===0?is:Rn,i.wrapT=a===0?is:Rn,"Scaling"in e){const l=e.Scaling.value;i.repeat.x=l[0],i.repeat.y=l[1]}return i}loadTexture(e,t){let i;const r=this.textureLoader.path,s=vn.get(e.id).children;s!==void 0&&s.length>0&&t[s[0].ID]!==void 0&&(i=t[s[0].ID],(i.indexOf("blob:")===0||i.indexOf("data:")===0)&&this.textureLoader.setPath(void 0));let o;const a=e.FileName.slice(-3).toLowerCase();if(a==="tga"){const l=this.manager.getHandler(".tga");l===null?(console.warn("FBXLoader: TGA loader not found, creating placeholder texture for",e.RelativeFilename),o=new Jt):(l.setPath(this.textureLoader.path),o=l.load(i))}else a==="psd"?(console.warn("FBXLoader: PSD textures are not supported, creating placeholder texture for",e.RelativeFilename),o=new Jt):o=this.textureLoader.load(i);return this.textureLoader.setPath(r),o}parseMaterials(e){const t=new Map;if("Material"in xt.Objects){const i=xt.Objects.Material;for(const r in i){const s=this.parseMaterial(i[r],e);s!==null&&t.set(parseInt(r),s)}}return t}parseMaterial(e,t){const i=e.id,r=e.attrName;let s=e.ShadingModel;if(typeof s=="object"&&(s=s.value),!vn.has(i))return null;const o=this.parseParameters(e,t,i);let a;switch(s.toLowerCase()){case"phong":a=new oh;break;case"lambert":a=new Tb;break;default:console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.',s),a=new oh;break}return a.setValues(o),a.name=r,a}parseParameters(e,t,i){const r={};e.BumpFactor&&(r.bumpScale=e.BumpFactor.value),e.Diffuse?r.color=new Pe().fromArray(e.Diffuse.value):e.DiffuseColor&&(e.DiffuseColor.type==="Color"||e.DiffuseColor.type==="ColorRGB")&&(r.color=new Pe().fromArray(e.DiffuseColor.value)),e.DisplacementFactor&&(r.displacementScale=e.DisplacementFactor.value),e.Emissive?r.emissive=new Pe().fromArray(e.Emissive.value):e.EmissiveColor&&(e.EmissiveColor.type==="Color"||e.EmissiveColor.type==="ColorRGB")&&(r.emissive=new Pe().fromArray(e.EmissiveColor.value)),e.EmissiveFactor&&(r.emissiveIntensity=parseFloat(e.EmissiveFactor.value)),e.Opacity&&(r.opacity=parseFloat(e.Opacity.value)),r.opacity<1&&(r.transparent=!0),e.ReflectionFactor&&(r.reflectivity=e.ReflectionFactor.value),e.Shininess&&(r.shininess=e.Shininess.value),e.Specular?r.specular=new Pe().fromArray(e.Specular.value):e.SpecularColor&&e.SpecularColor.type==="Color"&&(r.specular=new Pe().fromArray(e.SpecularColor.value));const s=this;return vn.get(i).children.forEach(function(o){const a=o.relationship;switch(a){case"Bump":r.bumpMap=s.getTexture(t,o.ID);break;case"Maya|TEX_ao_map":r.aoMap=s.getTexture(t,o.ID);break;case"DiffuseColor":case"Maya|TEX_color_map":r.map=s.getTexture(t,o.ID),r.map!==void 0&&("colorSpace"in r.map?r.map.colorSpace="srgb":r.map.encoding=3001);break;case"DisplacementColor":r.displacementMap=s.getTexture(t,o.ID);break;case"EmissiveColor":r.emissiveMap=s.getTexture(t,o.ID),r.emissiveMap!==void 0&&("colorSpace"in r.emissiveMap?r.emissiveMap.colorSpace="srgb":r.emissiveMap.encoding=3001);break;case"NormalMap":case"Maya|TEX_normal_map":r.normalMap=s.getTexture(t,o.ID);break;case"ReflectionColor":r.envMap=s.getTexture(t,o.ID),r.envMap!==void 0&&(r.envMap.mapping=Tc,"colorSpace"in r.envMap?r.envMap.colorSpace="srgb":r.envMap.encoding=3001);break;case"SpecularColor":r.specularMap=s.getTexture(t,o.ID),r.specularMap!==void 0&&("colorSpace"in r.specularMap?r.specularMap.colorSpace="srgb":r.specularMap.encoding=3001);break;case"TransparentColor":case"TransparencyFactor":r.alphaMap=s.getTexture(t,o.ID),r.transparent=!0;break;case"AmbientColor":case"ShininessExponent":case"SpecularFactor":case"VectorDisplacementColor":default:console.warn("THREE.FBXLoader: %s map is not supported in three.js, skipping texture.",a);break}}),r}getTexture(e,t){return"LayeredTexture"in xt.Objects&&t in xt.Objects.LayeredTexture&&(console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."),t=vn.get(t).children[0].ID),e.get(t)}parseDeformers(){const e={},t={};if("Deformer"in xt.Objects){const i=xt.Objects.Deformer;for(const r in i){const s=i[r],o=vn.get(parseInt(r));if(s.attrType==="Skin"){const a=this.parseSkeleton(o,i);a.ID=r,o.parents.length>1&&console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."),a.geometryID=o.parents[0].ID,e[r]=a}else if(s.attrType==="BlendShape"){const a={id:r};a.rawTargets=this.parseMorphTargets(o,i),a.id=r,o.parents.length>1&&console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."),t[r]=a}}}return{skeletons:e,morphTargets:t}}parseSkeleton(e,t){const i=[];return e.children.forEach(function(r){const s=t[r.ID];if(s.attrType!=="Cluster")return;const o={ID:r.ID,indices:[],weights:[],transformLink:new ze().fromArray(s.TransformLink.a)};"Indexes"in s&&(o.indices=s.Indexes.a,o.weights=s.Weights.a),i.push(o)}),{rawBones:i,bones:[]}}parseMorphTargets(e,t){const i=[];for(let r=0;r<e.children.length;r++){const s=e.children[r],o=t[s.ID],a={name:o.attrName,initialWeight:o.DeformPercent,id:o.id,fullWeights:o.FullWeights.a};if(o.attrType!=="BlendShapeChannel")return;a.geoID=vn.get(parseInt(s.ID)).children.filter(function(l){return l.relationship===void 0})[0].ID,i.push(a)}return i}parseScene(e,t,i){_i=new Mr;const r=this.parseModels(e.skeletons,t,i),s=xt.Objects.Model,o=this;r.forEach(function(l){const c=s[l.ID];o.setLookAtProperties(l,c),vn.get(l.ID).parents.forEach(function(u){const h=r.get(u.ID);h!==void 0&&h.add(l)}),l.parent===null&&_i.add(l)}),this.bindSkeleton(e.skeletons,t,r),this.createAmbientLight(),_i.traverse(function(l){if(l.userData.transformData){l.parent&&(l.userData.transformData.parentMatrix=l.parent.matrix,l.userData.transformData.parentMatrixWorld=l.parent.matrixWorld);const c=rL(l.userData.transformData);l.applyMatrix4(c),l.updateWorldMatrix()}});const a=new Nte().parse();_i.children.length===1&&_i.children[0].isGroup&&(_i.children[0].animations=a,_i=_i.children[0]),_i.animations=a}parseModels(e,t,i){const r=new Map,s=xt.Objects.Model;for(const o in s){const a=parseInt(o),l=s[o],c=vn.get(a);let u=this.buildSkeleton(c,e,a,l.attrName);if(!u){switch(l.attrType){case"Camera":u=this.createCamera(c);break;case"Light":u=this.createLight(c);break;case"Mesh":u=this.createMesh(c,t,i);break;case"NurbsCurve":u=this.createCurve(c,t);break;case"LimbNode":case"Root":u=new Oc;break;case"Null":default:u=new Mr;break}u.name=l.attrName?yt.sanitizeNodeName(l.attrName):"",u.ID=a}this.getTransformData(u,l),r.set(a,u)}return r}buildSkeleton(e,t,i,r){let s=null;return e.parents.forEach(function(o){for(const a in t){const l=t[a];l.rawBones.forEach(function(c,u){if(c.ID===o.ID){const h=s;s=new Oc,s.matrixWorld.copy(c.transformLink),s.name=r?yt.sanitizeNodeName(r):"",s.ID=i,l.bones[u]=s,h!==null&&s.add(h)}})}}),s}createCamera(e){let t,i;if(e.children.forEach(function(r){const s=xt.Objects.NodeAttribute[r.ID];s!==void 0&&(i=s)}),i===void 0)t=new pt;else{let r=0;i.CameraProjectionType!==void 0&&i.CameraProjectionType.value===1&&(r=1);let s=1;i.NearPlane!==void 0&&(s=i.NearPlane.value/1e3);let o=1e3;i.FarPlane!==void 0&&(o=i.FarPlane.value/1e3);let a=window.innerWidth,l=window.innerHeight;i.AspectWidth!==void 0&&i.AspectHeight!==void 0&&(a=i.AspectWidth.value,l=i.AspectHeight.value);const c=a/l;let u=45;i.FieldOfView!==void 0&&(u=i.FieldOfView.value);const h=i.FocalLength?i.FocalLength.value:null;switch(r){case 0:t=new Nt(u,c,s,o),h!==null&&t.setFocalLength(h);break;case 1:t=new zi(-a/2,a/2,l/2,-l/2,s,o);break;default:console.warn("THREE.FBXLoader: Unknown camera type "+r+"."),t=new pt;break}}return t}createLight(e){let t,i;if(e.children.forEach(function(r){const s=xt.Objects.NodeAttribute[r.ID];s!==void 0&&(i=s)}),i===void 0)t=new pt;else{let r;i.LightType===void 0?r=0:r=i.LightType.value;let s=16777215;i.Color!==void 0&&(s=new Pe().fromArray(i.Color.value));let o=i.Intensity===void 0?1:i.Intensity.value/100;i.CastLightOnObject!==void 0&&i.CastLightOnObject.value===0&&(o=0);let a=0;i.FarAttenuationEnd!==void 0&&(i.EnableFarAttenuation!==void 0&&i.EnableFarAttenuation.value===0?a=0:a=i.FarAttenuationEnd.value);const l=1;switch(r){case 0:t=new jh(s,o,a,l);break;case 1:t=new lg(s,o);break;case 2:let c=Math.PI/3;i.InnerAngle!==void 0&&(c=Gn.degToRad(i.InnerAngle.value));let u=0;i.OuterAngle!==void 0&&(u=Gn.degToRad(i.OuterAngle.value),u=Math.max(u,1)),t=new ag(s,o,a,c,u,l);break;default:console.warn("THREE.FBXLoader: Unknown light type "+i.LightType.value+", defaulting to a PointLight."),t=new jh(s,o);break}i.CastShadows!==void 0&&i.CastShadows.value===1&&(t.castShadow=!0)}return t}createMesh(e,t,i){let r,s=null,o=null;const a=[];return e.children.forEach(function(l){t.has(l.ID)&&(s=t.get(l.ID)),i.has(l.ID)&&a.push(i.get(l.ID))}),a.length>1?o=a:a.length>0?o=a[0]:(o=new oh({color:13421772}),a.push(o)),"color"in s.attributes&&a.forEach(function(l){l.vertexColors=!0}),s.FBX_Deformer?(r=new Gm(s,o),r.normalizeSkinWeights()):r=new Be(s,o),r}createCurve(e,t){const i=e.children.reduce(function(s,o){return t.has(o.ID)&&(s=t.get(o.ID)),s},null),r=new Bn({color:3342591,linewidth:1});return new ct(i,r)}getTransformData(e,t){const i={};"InheritType"in t&&(i.inheritType=parseInt(t.InheritType.value)),"RotationOrder"in t?i.eulerOrder=sL(t.RotationOrder.value):i.eulerOrder="ZYX","Lcl_Translation"in t&&(i.translation=t.Lcl_Translation.value),"PreRotation"in t&&(i.preRotation=t.PreRotation.value),"Lcl_Rotation"in t&&(i.rotation=t.Lcl_Rotation.value),"PostRotation"in t&&(i.postRotation=t.PostRotation.value),"Lcl_Scaling"in t&&(i.scale=t.Lcl_Scaling.value),"ScalingOffset"in t&&(i.scalingOffset=t.ScalingOffset.value),"ScalingPivot"in t&&(i.scalingPivot=t.ScalingPivot.value),"RotationOffset"in t&&(i.rotationOffset=t.RotationOffset.value),"RotationPivot"in t&&(i.rotationPivot=t.RotationPivot.value),e.userData.transformData=i}setLookAtProperties(e,t){"LookAtProperty"in t&&vn.get(e.ID).children.forEach(function(i){if(i.relationship==="LookAtProperty"){const r=xt.Objects.Model[i.ID];if("Lcl_Translation"in r){const s=r.Lcl_Translation.value;e.target!==void 0?(e.target.position.fromArray(s),_i.add(e.target)):e.lookAt(new D().fromArray(s))}}})}bindSkeleton(e,t,i){const r=this.parsePoseNodes();for(const s in e){const o=e[s];vn.get(parseInt(o.ID)).parents.forEach(function(a){if(t.has(a.ID)){const l=a.ID;vn.get(l).parents.forEach(function(c){i.has(c.ID)&&i.get(c.ID).bind(new $c(o.bones),r[c.ID])})}})}}parsePoseNodes(){const e={};if("Pose"in xt.Objects){const t=xt.Objects.Pose;for(const i in t)if(t[i].attrType==="BindPose"&&t[i].NbPoseNodes>0){const r=t[i].PoseNode;Array.isArray(r)?r.forEach(function(s){e[s.Node]=new ze().fromArray(s.Matrix.a)}):e[r.Node]=new ze().fromArray(r.Matrix.a)}}return e}createAmbientLight(){if("GlobalSettings"in xt&&"AmbientColor"in xt.GlobalSettings){const e=xt.GlobalSettings.AmbientColor.value,t=e[0],i=e[1],r=e[2];if(t!==0||i!==0||r!==0){const s=new Pe(t,i,r);_i.add(new Lb(s,1))}}}}class Ute{parse(e){const t=new Map;if("Geometry"in xt.Objects){const i=xt.Objects.Geometry;for(const r in i){const s=vn.get(parseInt(r)),o=this.parseGeometry(s,i[r],e);t.set(parseInt(r),o)}}return t}parseGeometry(e,t,i){switch(t.attrType){case"Mesh":return this.parseMeshGeometry(e,t,i);case"NurbsCurve":return this.parseNurbsGeometry(t)}}parseMeshGeometry(e,t,i){const r=i.skeletons,s=[],o=e.parents.map(function(h){return xt.Objects.Model[h.ID]});if(o.length===0)return;const a=e.children.reduce(function(h,d){return r[d.ID]!==void 0&&(h=r[d.ID]),h},null);e.children.forEach(function(h){i.morphTargets[h.ID]!==void 0&&s.push(i.morphTargets[h.ID])});const l=o[0],c={};"RotationOrder"in l&&(c.eulerOrder=sL(l.RotationOrder.value)),"InheritType"in l&&(c.inheritType=parseInt(l.InheritType.value)),"GeometricTranslation"in l&&(c.translation=l.GeometricTranslation.value),"GeometricRotation"in l&&(c.rotation=l.GeometricRotation.value),"GeometricScaling"in l&&(c.scale=l.GeometricScaling.value);const u=rL(c);return this.genGeometry(t,a,s,u)}genGeometry(e,t,i,r){const s=new qe;e.attrName&&(s.name=e.attrName);const o=this.parseGeoNode(e,t),a=this.genBuffers(o),l=new Ve(a.vertex,3);if(l.applyMatrix4(r),s.setAttribute("position",l),a.colors.length>0&&s.setAttribute("color",new Ve(a.colors,3)),t&&(s.setAttribute("skinIndex",new Fm(a.weightsIndices,4)),s.setAttribute("skinWeight",new Ve(a.vertexWeights,4)),s.FBX_Deformer=t),a.normal.length>0){const c=new ut().getNormalMatrix(r),u=new Ve(a.normal,3);u.applyNormalMatrix(c),s.setAttribute("normal",u)}if(a.uvs.forEach(function(c,u){let h="uv"+(u+1).toString();u===0&&(h="uv"),s.setAttribute(h,new Ve(a.uvs[u],2))}),o.material&&o.material.mappingType!=="AllSame"){let c=a.materialIndex[0],u=0;if(a.materialIndex.forEach(function(h,d){h!==c&&(s.addGroup(u,d-u,c),c=h,u=d)}),s.groups.length>0){const h=s.groups[s.groups.length-1],d=h.start+h.count;d!==a.materialIndex.length&&s.addGroup(d,a.materialIndex.length-d,c)}s.groups.length===0&&s.addGroup(0,a.materialIndex.length,a.materialIndex[0])}return this.addMorphTargets(s,e,i,r),s}parseGeoNode(e,t){const i={};if(i.vertexPositions=e.Vertices!==void 0?e.Vertices.a:[],i.vertexIndices=e.PolygonVertexIndex!==void 0?e.PolygonVertexIndex.a:[],e.LayerElementColor&&(i.color=this.parseVertexColors(e.LayerElementColor[0])),e.LayerElementMaterial&&(i.material=this.parseMaterialIndices(e.LayerElementMaterial[0])),e.LayerElementNormal&&(i.normal=this.parseNormals(e.LayerElementNormal[0])),e.LayerElementUV){i.uv=[];let r=0;for(;e.LayerElementUV[r];)e.LayerElementUV[r].UV&&i.uv.push(this.parseUVs(e.LayerElementUV[r])),r++}return i.weightTable={},t!==null&&(i.skeleton=t,t.rawBones.forEach(function(r,s){r.indices.forEach(function(o,a){i.weightTable[o]===void 0&&(i.weightTable[o]=[]),i.weightTable[o].push({id:s,weight:r.weights[a]})})})),i}genBuffers(e){const t={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[],vertexWeights:[],weightsIndices:[]};let i=0,r=0,s=!1,o=[],a=[],l=[],c=[],u=[],h=[];const d=this;return e.vertexIndices.forEach(function(f,p){let v,m=!1;f<0&&(f=f^-1,m=!0);let g=[],b=[];if(o.push(f*3,f*3+1,f*3+2),e.color){const _=Xf(p,i,f,e.color);l.push(_[0],_[1],_[2])}if(e.skeleton){if(e.weightTable[f]!==void 0&&e.weightTable[f].forEach(function(_){b.push(_.weight),g.push(_.id)}),b.length>4){s||(console.warn("THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."),s=!0);const _=[0,0,0,0],y=[0,0,0,0];b.forEach(function(T,S){let E=T,x=g[S];y.forEach(function(M,w,C){if(E>M){C[w]=E,E=M;const L=_[w];_[w]=x,x=L}})}),g=_,b=y}for(;b.length<4;)b.push(0),g.push(0);for(let _=0;_<4;++_)u.push(b[_]),h.push(g[_])}if(e.normal){const _=Xf(p,i,f,e.normal);a.push(_[0],_[1],_[2])}e.material&&e.material.mappingType!=="AllSame"&&(v=Xf(p,i,f,e.material)[0]),e.uv&&e.uv.forEach(function(_,y){const T=Xf(p,i,f,_);c[y]===void 0&&(c[y]=[]),c[y].push(T[0]),c[y].push(T[1])}),r++,m&&(d.genFace(t,e,o,v,a,l,c,u,h,r),i++,r=0,o=[],a=[],l=[],c=[],u=[],h=[])}),t}genFace(e,t,i,r,s,o,a,l,c,u){for(let h=2;h<u;h++)e.vertex.push(t.vertexPositions[i[0]]),e.vertex.push(t.vertexPositions[i[1]]),e.vertex.push(t.vertexPositions[i[2]]),e.vertex.push(t.vertexPositions[i[(h-1)*3]]),e.vertex.push(t.vertexPositions[i[(h-1)*3+1]]),e.vertex.push(t.vertexPositions[i[(h-1)*3+2]]),e.vertex.push(t.vertexPositions[i[h*3]]),e.vertex.push(t.vertexPositions[i[h*3+1]]),e.vertex.push(t.vertexPositions[i[h*3+2]]),t.skeleton&&(e.vertexWeights.push(l[0]),e.vertexWeights.push(l[1]),e.vertexWeights.push(l[2]),e.vertexWeights.push(l[3]),e.vertexWeights.push(l[(h-1)*4]),e.vertexWeights.push(l[(h-1)*4+1]),e.vertexWeights.push(l[(h-1)*4+2]),e.vertexWeights.push(l[(h-1)*4+3]),e.vertexWeights.push(l[h*4]),e.vertexWeights.push(l[h*4+1]),e.vertexWeights.push(l[h*4+2]),e.vertexWeights.push(l[h*4+3]),e.weightsIndices.push(c[0]),e.weightsIndices.push(c[1]),e.weightsIndices.push(c[2]),e.weightsIndices.push(c[3]),e.weightsIndices.push(c[(h-1)*4]),e.weightsIndices.push(c[(h-1)*4+1]),e.weightsIndices.push(c[(h-1)*4+2]),e.weightsIndices.push(c[(h-1)*4+3]),e.weightsIndices.push(c[h*4]),e.weightsIndices.push(c[h*4+1]),e.weightsIndices.push(c[h*4+2]),e.weightsIndices.push(c[h*4+3])),t.color&&(e.colors.push(o[0]),e.colors.push(o[1]),e.colors.push(o[2]),e.colors.push(o[(h-1)*3]),e.colors.push(o[(h-1)*3+1]),e.colors.push(o[(h-1)*3+2]),e.colors.push(o[h*3]),e.colors.push(o[h*3+1]),e.colors.push(o[h*3+2])),t.material&&t.material.mappingType!=="AllSame"&&(e.materialIndex.push(r),e.materialIndex.push(r),e.materialIndex.push(r)),t.normal&&(e.normal.push(s[0]),e.normal.push(s[1]),e.normal.push(s[2]),e.normal.push(s[(h-1)*3]),e.normal.push(s[(h-1)*3+1]),e.normal.push(s[(h-1)*3+2]),e.normal.push(s[h*3]),e.normal.push(s[h*3+1]),e.normal.push(s[h*3+2])),t.uv&&t.uv.forEach(function(d,f){e.uvs[f]===void 0&&(e.uvs[f]=[]),e.uvs[f].push(a[f][0]),e.uvs[f].push(a[f][1]),e.uvs[f].push(a[f][(h-1)*2]),e.uvs[f].push(a[f][(h-1)*2+1]),e.uvs[f].push(a[f][h*2]),e.uvs[f].push(a[f][h*2+1])})}addMorphTargets(e,t,i,r){if(i.length===0)return;e.morphTargetsRelative=!0,e.morphAttributes.position=[];const s=this;i.forEach(function(o){o.rawTargets.forEach(function(a){const l=xt.Objects.Geometry[a.geoID];l!==void 0&&s.genMorphGeometry(e,t,l,r,a.name)})})}genMorphGeometry(e,t,i,r,s){const o=t.PolygonVertexIndex!==void 0?t.PolygonVertexIndex.a:[],a=i.Vertices!==void 0?i.Vertices.a:[],l=i.Indexes!==void 0?i.Indexes.a:[],c=e.attributes.position.count*3,u=new Float32Array(c);for(let p=0;p<l.length;p++){const v=l[p]*3;u[v]=a[p*3],u[v+1]=a[p*3+1],u[v+2]=a[p*3+2]}const h={vertexIndices:o,vertexPositions:u},d=this.genBuffers(h),f=new Ve(d.vertex,3);f.name=s||i.attrName,f.applyMatrix4(r),e.morphAttributes.position.push(f)}parseNormals(e){const t=e.MappingInformationType,i=e.ReferenceInformationType,r=e.Normals.a;let s=[];return i==="IndexToDirect"&&("NormalIndex"in e?s=e.NormalIndex.a:"NormalsIndex"in e&&(s=e.NormalsIndex.a)),{dataSize:3,buffer:r,indices:s,mappingType:t,referenceType:i}}parseUVs(e){const t=e.MappingInformationType,i=e.ReferenceInformationType,r=e.UV.a;let s=[];return i==="IndexToDirect"&&(s=e.UVIndex.a),{dataSize:2,buffer:r,indices:s,mappingType:t,referenceType:i}}parseVertexColors(e){const t=e.MappingInformationType,i=e.ReferenceInformationType,r=e.Colors.a;let s=[];return i==="IndexToDirect"&&(s=e.ColorIndex.a),{dataSize:4,buffer:r,indices:s,mappingType:t,referenceType:i}}parseMaterialIndices(e){const t=e.MappingInformationType,i=e.ReferenceInformationType;if(t==="NoMappingInformation")return{dataSize:1,buffer:[0],indices:[0],mappingType:"AllSame",referenceType:i};const r=e.Materials.a,s=[];for(let o=0;o<r.length;++o)s.push(o);return{dataSize:1,buffer:r,indices:s,mappingType:t,referenceType:i}}parseNurbsGeometry(e){if(GE===void 0)return console.error("THREE.FBXLoader: The loader relies on NURBSCurve for any nurbs present in the model. Nurbs will show up as empty geometry."),new qe;const t=parseInt(e.Order);if(isNaN(t))return console.error("THREE.FBXLoader: Invalid Order %s given for geometry ID: %s",e.Order,e.id),new qe;const i=t-1,r=e.KnotVector.a,s=[],o=e.Points.a;for(let u=0,h=o.length;u<h;u+=4)s.push(new vt().fromArray(o,u));let a,l;if(e.Form==="Closed")s.push(s[0]);else if(e.Form==="Periodic"){a=i,l=r.length-1-a;for(let u=0;u<i;++u)s.push(s[u])}const c=new GE(i,r,s,a,l).getPoints(s.length*12);return new qe().setFromPoints(c)}}class Nte{parse(){const e=[],t=this.parseClips();if(t!==void 0)for(const i in t){const r=t[i],s=this.addClip(r);e.push(s)}return e}parseClips(){if(xt.Objects.AnimationCurve===void 0)return;const e=this.parseAnimationCurveNodes();this.parseAnimationCurves(e);const t=this.parseAnimationLayers(e);return this.parseAnimStacks(t)}parseAnimationCurveNodes(){const e=xt.Objects.AnimationCurveNode,t=new Map;for(const i in e){const r=e[i];if(r.attrName.match(/S|R|T|DeformPercent/)!==null){const s={id:r.id,attr:r.attrName,curves:{}};t.set(s.id,s)}}return t}parseAnimationCurves(e){const t=xt.Objects.AnimationCurve;for(const i in t){const r={id:t[i].id,times:t[i].KeyTime.a.map(Vte),values:t[i].KeyValueFloat.a},s=vn.get(r.id);if(s!==void 0){const o=s.parents[0].ID,a=s.parents[0].relationship;a.match(/X/)?e.get(o).curves.x=r:a.match(/Y/)?e.get(o).curves.y=r:a.match(/Z/)?e.get(o).curves.z=r:a.match(/d|DeformPercent/)&&e.has(o)&&(e.get(o).curves.morph=r)}}}parseAnimationLayers(e){const t=xt.Objects.AnimationLayer,i=new Map;for(const r in t){const s=[],o=vn.get(parseInt(r));o!==void 0&&(o.children.forEach(function(a,l){if(e.has(a.ID)){const c=e.get(a.ID);if(c.curves.x!==void 0||c.curves.y!==void 0||c.curves.z!==void 0){if(s[l]===void 0){const u=vn.get(a.ID).parents.filter(function(h){return h.relationship!==void 0})[0].ID;if(u!==void 0){const h=xt.Objects.Model[u.toString()];if(h===void 0){console.warn("THREE.FBXLoader: Encountered a unused curve.",a);return}const d={modelName:h.attrName?yt.sanitizeNodeName(h.attrName):"",ID:h.id,initialPosition:[0,0,0],initialRotation:[0,0,0],initialScale:[1,1,1]};_i.traverse(function(f){f.ID===h.id&&(d.transform=f.matrix,f.userData.transformData&&(d.eulerOrder=f.userData.transformData.eulerOrder))}),d.transform||(d.transform=new ze),"PreRotation"in h&&(d.preRotation=h.PreRotation.value),"PostRotation"in h&&(d.postRotation=h.PostRotation.value),s[l]=d}}s[l]&&(s[l][c.attr]=c)}else if(c.curves.morph!==void 0){if(s[l]===void 0){const u=vn.get(a.ID).parents.filter(function(m){return m.relationship!==void 0})[0].ID,h=vn.get(u).parents[0].ID,d=vn.get(h).parents[0].ID,f=vn.get(d).parents[0].ID,p=xt.Objects.Model[f],v={modelName:p.attrName?yt.sanitizeNodeName(p.attrName):"",morphName:xt.Objects.Deformer[u].attrName};s[l]=v}s[l][c.attr]=c}}}),i.set(parseInt(r),s))}return i}parseAnimStacks(e){const t=xt.Objects.AnimationStack,i={};for(const r in t){const s=vn.get(parseInt(r)).children;s.length>1&&console.warn("THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers.");const o=e.get(s[0].ID);i[r]={name:t[r].attrName,layer:o}}return i}addClip(e){let t=[];const i=this;return e.layer.forEach(function(r){t=t.concat(i.generateTracks(r))}),new $a(e.name,-1,t)}generateTracks(e){const t=[];let i=new D,r=new gt,s=new D;if(e.transform&&e.transform.decompose(i,r,s),i=i.toArray(),r=new rr().setFromQuaternion(r,e.eulerOrder).toArray(),s=s.toArray(),e.T!==void 0&&Object.keys(e.T.curves).length>0){const o=this.generateVectorTrack(e.modelName,e.T.curves,i,"position");o!==void 0&&t.push(o)}if(e.R!==void 0&&Object.keys(e.R.curves).length>0){const o=this.generateRotationTrack(e.modelName,e.R.curves,r,e.preRotation,e.postRotation,e.eulerOrder);o!==void 0&&t.push(o)}if(e.S!==void 0&&Object.keys(e.S.curves).length>0){const o=this.generateVectorTrack(e.modelName,e.S.curves,s,"scale");o!==void 0&&t.push(o)}if(e.DeformPercent!==void 0){const o=this.generateMorphTrack(e);o!==void 0&&t.push(o)}return t}generateVectorTrack(e,t,i,r){const s=this.getTimesForAllAxes(t),o=this.getKeyframeTrackValues(s,t,i);return new Wa(e+"."+r,s,o)}generateRotationTrack(e,t,i,r,s,o){t.x!==void 0&&(this.interpolateRotations(t.x),t.x.values=t.x.values.map(Gn.degToRad)),t.y!==void 0&&(this.interpolateRotations(t.y),t.y.values=t.y.values.map(Gn.degToRad)),t.z!==void 0&&(this.interpolateRotations(t.z),t.z.values=t.z.values.map(Gn.degToRad));const a=this.getTimesForAllAxes(t),l=this.getKeyframeTrackValues(a,t,i);r!==void 0&&(r=r.map(Gn.degToRad),r.push(o),r=new rr().fromArray(r),r=new gt().setFromEuler(r)),s!==void 0&&(s=s.map(Gn.degToRad),s.push(o),s=new rr().fromArray(s),s=new gt().setFromEuler(s).invert());const c=new gt,u=new rr,h=[];for(let d=0;d<l.length;d+=3)u.set(l[d],l[d+1],l[d+2],o),c.setFromEuler(u),r!==void 0&&c.premultiply(r),s!==void 0&&c.multiply(s),c.toArray(h,d/3*4);return new Fs(e+".quaternion",a,h)}generateMorphTrack(e){const t=e.DeformPercent.curves.morph,i=t.values.map(function(s){return s/100}),r=_i.getObjectByName(e.modelName).morphTargetDictionary[e.morphName];return new Ga(e.modelName+".morphTargetInfluences["+r+"]",t.times,i)}getTimesForAllAxes(e){let t=[];if(e.x!==void 0&&(t=t.concat(e.x.times)),e.y!==void 0&&(t=t.concat(e.y.times)),e.z!==void 0&&(t=t.concat(e.z.times)),t=t.sort(function(i,r){return i-r}),t.length>1){let i=1,r=t[0];for(let s=1;s<t.length;s++){const o=t[s];o!==r&&(t[i]=o,r=o,i++)}t=t.slice(0,i)}return t}getKeyframeTrackValues(e,t,i){const r=i,s=[];let o=-1,a=-1,l=-1;return e.forEach(function(c){if(t.x&&(o=t.x.times.indexOf(c)),t.y&&(a=t.y.times.indexOf(c)),t.z&&(l=t.z.times.indexOf(c)),o!==-1){const u=t.x.values[o];s.push(u),r[0]=u}else s.push(r[0]);if(a!==-1){const u=t.y.values[a];s.push(u),r[1]=u}else s.push(r[1]);if(l!==-1){const u=t.z.values[l];s.push(u),r[2]=u}else s.push(r[2])}),s}interpolateRotations(e){for(let t=1;t<e.values.length;t++){const i=e.values[t-1],r=e.values[t]-i,s=Math.abs(r);if(s>=180){const o=s/180,a=r/o;let l=i+a;const c=e.times[t-1],u=(e.times[t]-c)/o;let h=c+u;const d=[],f=[];for(;h<e.times[t];)d.push(h),h+=u,f.push(l),l+=a;e.times=jE(e.times,t,d),e.values=jE(e.values,t,f)}}}}class Fte{getPrevNode(){return this.nodeStack[this.currentIndent-2]}getCurrentNode(){return this.nodeStack[this.currentIndent-1]}getCurrentProp(){return this.currentProp}pushStack(e){this.nodeStack.push(e),this.currentIndent+=1}popStack(){this.nodeStack.pop(),this.currentIndent-=1}setCurrentProp(e,t){this.currentProp=e,this.currentPropName=t}parse(e){this.currentIndent=0,this.allNodes=new iL,this.nodeStack=[],this.currentProp=[],this.currentPropName="";const t=this,i=e.split(/[\r\n]+/);return i.forEach(function(r,s){const o=r.match(/^[\s\t]*;/),a=r.match(/^[\s\t]*$/);if(o||a)return;const l=r.match("^\\t{"+t.currentIndent+"}(\\w+):(.*){",""),c=r.match("^\\t{"+t.currentIndent+"}(\\w+):[\\s\\t\\r\\n](.*)"),u=r.match("^\\t{"+(t.currentIndent-1)+"}}");l?t.parseNodeBegin(r,l):c?t.parseNodeProperty(r,c,i[++s]):u?t.popStack():r.match(/^[^\s\t}]/)&&t.parseNodePropertyContinued(r)}),this.allNodes}parseNodeBegin(e,t){const i=t[1].trim().replace(/^"/,"").replace(/"$/,""),r=t[2].split(",").map(function(l){return l.trim().replace(/^"/,"").replace(/"$/,"")}),s={name:i},o=this.parseNodeAttr(r),a=this.getCurrentNode();this.currentIndent===0?this.allNodes.add(i,s):i in a?(i==="PoseNode"?a.PoseNode.push(s):a[i].id!==void 0&&(a[i]={},a[i][a[i].id]=a[i]),o.id!==""&&(a[i][o.id]=s)):typeof o.id=="number"?(a[i]={},a[i][o.id]=s):i!=="Properties70"&&(i==="PoseNode"?a[i]=[s]:a[i]=s),typeof o.id=="number"&&(s.id=o.id),o.name!==""&&(s.attrName=o.name),o.type!==""&&(s.attrType=o.type),this.pushStack(s)}parseNodeAttr(e){let t=e[0];e[0]!==""&&(t=parseInt(e[0]),isNaN(t)&&(t=e[0]));let i="",r="";return e.length>1&&(i=e[1].replace(/^(\w+)::/,""),r=e[2]),{id:t,name:i,type:r}}parseNodeProperty(e,t,i){let r=t[1].replace(/^"/,"").replace(/"$/,"").trim(),s=t[2].replace(/^"/,"").replace(/"$/,"").trim();r==="Content"&&s===","&&(s=i.replace(/"/g,"").replace(/,$/,"").trim());const o=this.getCurrentNode();if(o.name==="Properties70"){this.parseNodeSpecialProperty(e,r,s);return}if(r==="C"){const a=s.split(",").slice(1),l=parseInt(a[0]),c=parseInt(a[1]);let u=s.split(",").slice(3);u=u.map(function(h){return h.trim().replace(/^"/,"")}),r="connections",s=[l,c],Gte(s,u),o[r]===void 0&&(o[r]=[])}r==="Node"&&(o.id=s),r in o&&Array.isArray(o[r])?o[r].push(s):r!=="a"?o[r]=s:o.a=s,this.setCurrentProp(o,r),r==="a"&&s.slice(-1)!==","&&(o.a=kv(s))}parseNodePropertyContinued(e){const t=this.getCurrentNode();t.a+=e,e.slice(-1)!==","&&(t.a=kv(t.a))}parseNodeSpecialProperty(e,t,i){const r=i.split('",').map(function(u){return u.trim().replace(/^\"/,"").replace(/\s/,"_")}),s=r[0],o=r[1],a=r[2],l=r[3];let c=r[4];switch(o){case"int":case"enum":case"bool":case"ULongLong":case"double":case"Number":case"FieldOfView":c=parseFloat(c);break;case"Color":case"ColorRGB":case"Vector3D":case"Lcl_Translation":case"Lcl_Rotation":case"Lcl_Scaling":c=kv(c);break}this.getPrevNode()[s]={type:o,type2:a,flag:l,value:c},this.setCurrentProp(this.getPrevNode(),s)}}class kte{parse(e){const t=new WE(e);t.skip(23);const i=t.getUint32();if(i<6400)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+i);const r=new iL;for(;!this.endOfContent(t);){const s=this.parseNode(t,i);s!==null&&r.add(s.name,s)}return r}endOfContent(e){return e.size()%16===0?(e.getOffset()+160+16&-16)>=e.size():e.getOffset()+160+16>=e.size()}parseNode(e,t){const i={},r=t>=7500?e.getUint64():e.getUint32(),s=t>=7500?e.getUint64():e.getUint32();t>=7500?e.getUint64():e.getUint32();const o=e.getUint8(),a=e.getString(o);if(r===0)return null;const l=[];for(let d=0;d<s;d++)l.push(this.parseProperty(e));const c=l.length>0?l[0]:"",u=l.length>1?l[1]:"",h=l.length>2?l[2]:"";for(i.singleProperty=s===1&&e.getOffset()===r;r>e.getOffset();){const d=this.parseNode(e,t);d!==null&&this.parseSubNode(a,i,d)}return i.propertyList=l,typeof c=="number"&&(i.id=c),u!==""&&(i.attrName=u),h!==""&&(i.attrType=h),a!==""&&(i.name=a),i}parseSubNode(e,t,i){if(i.singleProperty===!0){const r=i.propertyList[0];Array.isArray(r)?(t[i.name]=i,i.a=r):t[i.name]=r}else if(e==="Connections"&&i.name==="C"){const r=[];i.propertyList.forEach(function(s,o){o!==0&&r.push(s)}),t.connections===void 0&&(t.connections=[]),t.connections.push(r)}else if(i.name==="Properties70")Object.keys(i).forEach(function(r){t[r]=i[r]});else if(e==="Properties70"&&i.name==="P"){let r=i.propertyList[0],s=i.propertyList[1];const o=i.propertyList[2],a=i.propertyList[3];let l;r.indexOf("Lcl ")===0&&(r=r.replace("Lcl ","Lcl_")),s.indexOf("Lcl ")===0&&(s=s.replace("Lcl ","Lcl_")),s==="Color"||s==="ColorRGB"||s==="Vector"||s==="Vector3D"||s.indexOf("Lcl_")===0?l=[i.propertyList[4],i.propertyList[5],i.propertyList[6]]:l=i.propertyList[4],t[r]={type:s,type2:o,flag:a,value:l}}else t[i.name]===void 0?typeof i.id=="number"?(t[i.name]={},t[i.name][i.id]=i):t[i.name]=i:i.name==="PoseNode"?(Array.isArray(t[i.name])||(t[i.name]=[t[i.name]]),t[i.name].push(i)):t[i.name][i.id]===void 0&&(t[i.name][i.id]=i)}parseProperty(e){const t=e.getString(1);let i;switch(t){case"C":return e.getBoolean();case"D":return e.getFloat64();case"F":return e.getFloat32();case"I":return e.getInt32();case"L":return e.getInt64();case"R":return i=e.getUint32(),e.getArrayBuffer(i);case"S":return i=e.getUint32(),e.getString(i);case"Y":return e.getInt16();case"b":case"c":case"d":case"f":case"i":case"l":const r=e.getUint32(),s=e.getUint32(),o=e.getUint32();if(s===0)switch(t){case"b":case"c":return e.getBooleanArray(r);case"d":return e.getFloat64Array(r);case"f":return e.getFloat32Array(r);case"i":return e.getInt32Array(r);case"l":return e.getInt64Array(r)}const a=Ree(new Uint8Array(e.getArrayBuffer(o))),l=new WE(a.buffer);switch(t){case"b":case"c":return l.getBooleanArray(r);case"d":return l.getFloat64Array(r);case"f":return l.getFloat32Array(r);case"i":return l.getInt32Array(r);case"l":return l.getInt64Array(r)}default:throw new Error("THREE.FBXLoader: Unknown property type "+t)}}}class WE{constructor(e,t){this.dv=new DataView(e),this.offset=0,this.littleEndian=t!==void 0?t:!0}getOffset(){return this.offset}size(){return this.dv.buffer.byteLength}skip(e){this.offset+=e}getBoolean(){return(this.getUint8()&1)===1}getBooleanArray(e){const t=[];for(let i=0;i<e;i++)t.push(this.getBoolean());return t}getUint8(){const e=this.dv.getUint8(this.offset);return this.offset+=1,e}getInt16(){const e=this.dv.getInt16(this.offset,this.littleEndian);return this.offset+=2,e}getInt32(){const e=this.dv.getInt32(this.offset,this.littleEndian);return this.offset+=4,e}getInt32Array(e){const t=[];for(let i=0;i<e;i++)t.push(this.getInt32());return t}getUint32(){const e=this.dv.getUint32(this.offset,this.littleEndian);return this.offset+=4,e}getInt64(){let e,t;return this.littleEndian?(e=this.getUint32(),t=this.getUint32()):(t=this.getUint32(),e=this.getUint32()),t&2147483648?(t=~t&4294967295,e=~e&4294967295,e===4294967295&&(t=t+1&4294967295),e=e+1&4294967295,-(t*4294967296+e)):t*4294967296+e}getInt64Array(e){const t=[];for(let i=0;i<e;i++)t.push(this.getInt64());return t}getUint64(){let e,t;return this.littleEndian?(e=this.getUint32(),t=this.getUint32()):(t=this.getUint32(),e=this.getUint32()),t*4294967296+e}getFloat32(){const e=this.dv.getFloat32(this.offset,this.littleEndian);return this.offset+=4,e}getFloat32Array(e){const t=[];for(let i=0;i<e;i++)t.push(this.getFloat32());return t}getFloat64(){const e=this.dv.getFloat64(this.offset,this.littleEndian);return this.offset+=8,e}getFloat64Array(e){const t=[];for(let i=0;i<e;i++)t.push(this.getFloat64());return t}getArrayBuffer(e){const t=this.dv.buffer.slice(this.offset,this.offset+e);return this.offset+=e,t}getString(e){let t=[];for(let r=0;r<e;r++)t[r]=this.getUint8();const i=t.indexOf(0);return i>=0&&(t=t.slice(0,i)),Gi.decodeText(new Uint8Array(t))}}class iL{add(e,t){this[e]=t}}function Bte(n){const e="Kaydara FBX Binary \0";return n.byteLength>=e.length&&e===oL(n,0,e.length)}function zte(n){const e=["K","a","y","d","a","r","a","\\","F","B","X","\\","B","i","n","a","r","y","\\","\\"];let t=0;function i(r){const s=n[r-1];return n=n.slice(t+r),t++,s}for(let r=0;r<e.length;++r)if(i(1)===e[r])return!1;return!0}function $E(n){const e=/FBXVersion: (\d+)/,t=n.match(e);if(t)return parseInt(t[1]);throw new Error("THREE.FBXLoader: Cannot find the version number for the file given.")}function Vte(n){return n/46186158e3}const Hte=[];function Xf(n,e,t,i){let r;switch(i.mappingType){case"ByPolygonVertex":r=n;break;case"ByPolygon":r=e;break;case"ByVertice":r=t;break;case"AllSame":r=i.indices[0];break;default:console.warn("THREE.FBXLoader: unknown attribute mapping type "+i.mappingType)}i.referenceType==="IndexToDirect"&&(r=i.indices[r]);const s=r*i.dataSize,o=s+i.dataSize;return Wte(Hte,i.buffer,s,o)}const Fv=new rr,Vl=new D;function rL(n){const e=new ze,t=new ze,i=new ze,r=new ze,s=new ze,o=new ze,a=new ze,l=new ze,c=new ze,u=new ze,h=new ze,d=new ze,f=n.inheritType?n.inheritType:0;if(n.translation&&e.setPosition(Vl.fromArray(n.translation)),n.preRotation){const w=n.preRotation.map(Gn.degToRad);w.push(n.eulerOrder),t.makeRotationFromEuler(Fv.fromArray(w))}if(n.rotation){const w=n.rotation.map(Gn.degToRad);w.push(n.eulerOrder),i.makeRotationFromEuler(Fv.fromArray(w))}if(n.postRotation){const w=n.postRotation.map(Gn.degToRad);w.push(n.eulerOrder),r.makeRotationFromEuler(Fv.fromArray(w)),r.invert()}n.scale&&s.scale(Vl.fromArray(n.scale)),n.scalingOffset&&a.setPosition(Vl.fromArray(n.scalingOffset)),n.scalingPivot&&o.setPosition(Vl.fromArray(n.scalingPivot)),n.rotationOffset&&l.setPosition(Vl.fromArray(n.rotationOffset)),n.rotationPivot&&c.setPosition(Vl.fromArray(n.rotationPivot)),n.parentMatrixWorld&&(h.copy(n.parentMatrix),u.copy(n.parentMatrixWorld));const p=t.clone().multiply(i).multiply(r),v=new ze;v.extractRotation(u);const m=new ze;m.copyPosition(u);const g=m.clone().invert().multiply(u),b=v.clone().invert().multiply(g),_=s,y=new ze;if(f===0)y.copy(v).multiply(p).multiply(b).multiply(_);else if(f===1)y.copy(v).multiply(b).multiply(p).multiply(_);else{const w=new ze().scale(new D().setFromMatrixScale(h)).clone().invert(),C=b.clone().multiply(w);y.copy(v).multiply(p).multiply(C).multiply(_)}const T=c.clone().invert(),S=o.clone().invert();let E=e.clone().multiply(l).multiply(c).multiply(t).multiply(i).multiply(r).multiply(T).multiply(a).multiply(o).multiply(s).multiply(S);const x=new ze().copyPosition(E),M=u.clone().multiply(x);return d.copyPosition(M),E=d.clone().multiply(y),E.premultiply(u.invert()),E}function sL(n){n=n||0;const e=["ZYX","YZX","XZY","ZXY","YXZ","XYZ"];return n===6?(console.warn("THREE.FBXLoader: unsupported Euler Order: Spherical XYZ. Animations and rotations may be incorrect."),e[0]):e[n]}function kv(n){return n.split(",").map(function(e){return parseFloat(e)})}function oL(n,e,t){return e===void 0&&(e=0),t===void 0&&(t=n.byteLength),Gi.decodeText(new Uint8Array(n,e,t))}function Gte(n,e){for(let t=0,i=n.length,r=e.length;t<r;t++,i++)n[i]=e[t]}function Wte(n,e,t,i){for(let r=t,s=0;r<i;r++,s++)n[s]=e[r];return n}function jE(n,e,t){return n.slice(0,e).concat(t).concat(n.slice(e))}var $te=Object.defineProperty,jte=(n,e,t)=>e in n?$te(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,dx=(n,e,t)=>(jte(n,typeof e!="symbol"?e+"":e,t),t);class aL{constructor(e){dx(this,"data"),this.data=e}generateShapes(e,t=100,i){const r=[],s=Bt({letterSpacing:0,lineHeight:1},i),o=Xte(e,t,this.data,s);for(let a=0,l=o.length;a<l;a++)Array.prototype.push.apply(r,o[a].toShapes(!1));return r}}dx(aL,"isFont");dx(aL,"type");function Xte(n,e,t,i){const r=Array.from(n),s=e/t.resolution,o=(t.boundingBox.yMax-t.boundingBox.yMin+t.underlineThickness)*s,a=[];let l=0,c=0;for(let u=0;u<r.length;u++){const h=r[u];if(h==="\n")l=0,c-=o*i.lineHeight;else{const d=Yte(h,s,l,c,t);d&&(l+=d.offsetX+i.letterSpacing,a.push(d.path))}}return a}function Yte(n,e,t,i,r){const s=r.glyphs[n]||r.glyphs["?"];if(!s){console.error('THREE.Font: character "'+n+'" does not exists in font family '+r.familyName+".");return}const o=new F3;let a,l,c,u,h,d,f,p;if(s.o){const v=s._cachedOutline||(s._cachedOutline=s.o.split(" "));for(let m=0,g=v.length;m<g;)switch(v[m++]){case"m":a=parseInt(v[m++])*e+t,l=parseInt(v[m++])*e+i,o.moveTo(a,l);break;case"l":a=parseInt(v[m++])*e+t,l=parseInt(v[m++])*e+i,o.lineTo(a,l);break;case"q":c=parseInt(v[m++])*e+t,u=parseInt(v[m++])*e+i,h=parseInt(v[m++])*e+t,d=parseInt(v[m++])*e+i,o.quadraticCurveTo(h,d,c,u);break;case"b":c=parseInt(v[m++])*e+t,u=parseInt(v[m++])*e+i,h=parseInt(v[m++])*e+t,d=parseInt(v[m++])*e+i,f=parseInt(v[m++])*e+t,p=parseInt(v[m++])*e+i,o.bezierCurveTo(h,d,f,p,c,u);break}}return{offsetX:s.ha*e,path:o}}const Bv=new WeakMap;class qte extends Xn{constructor(e){super(e),this.decoderPath="",this.decoderConfig={},this.decoderBinary=null,this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL="",this.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},this.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"}}setDecoderPath(e){return this.decoderPath=e,this}setDecoderConfig(e){return this.decoderConfig=e,this}setWorkerLimit(e){return this.workerLimit=e,this}load(e,t,i,r){const s=new Ti(this.manager);s.setPath(this.path),s.setResponseType("arraybuffer"),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(e,o=>{const a={attributeIDs:this.defaultAttributeIDs,attributeTypes:this.defaultAttributeTypes,useUniqueIDs:!1};this.decodeGeometry(o,a).then(t).catch(r)},i,r)}decodeDracoFile(e,t,i,r){const s={attributeIDs:i||this.defaultAttributeIDs,attributeTypes:r||this.defaultAttributeTypes,useUniqueIDs:!!i};this.decodeGeometry(e,s).then(t)}decodeGeometry(e,t){for(const l in t.attributeTypes){const c=t.attributeTypes[l];c.BYTES_PER_ELEMENT!==void 0&&(t.attributeTypes[l]=c.name)}const i=JSON.stringify(t);if(Bv.has(e)){const l=Bv.get(e);if(l.key===i)return l.promise;if(e.byteLength===0)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let r;const s=this.workerNextTaskID++,o=e.byteLength,a=this._getWorker(s,o).then(l=>(r=l,new Promise((c,u)=>{r._callbacks[s]={resolve:c,reject:u},r.postMessage({type:"decode",id:s,taskConfig:t,buffer:e},[e])}))).then(l=>this._createGeometry(l.geometry));return a.catch(()=>!0).then(()=>{r&&s&&this._releaseTask(r,s)}),Bv.set(e,{key:i,promise:a}),a}_createGeometry(e){const t=new qe;e.index&&t.setIndex(new At(e.index.array,1));for(let i=0;i<e.attributes.length;i++){const r=e.attributes[i],s=r.name,o=r.array,a=r.itemSize;t.setAttribute(s,new At(o,a))}return t}_loadLibrary(e,t){const i=new Ti(this.manager);return i.setPath(this.decoderPath),i.setResponseType(t),i.setWithCredentials(this.withCredentials),new Promise((r,s)=>{i.load(e,r,void 0,s)})}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;const e=typeof WebAssembly!="object"||this.decoderConfig.type==="js",t=[];return e?t.push(this._loadLibrary("draco_decoder.js","text")):(t.push(this._loadLibrary("draco_wasm_wrapper.js","text")),t.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(t).then(i=>{const r=i[0];e||(this.decoderConfig.wasmBinary=i[1]);const s=Kte.toString(),o=["/* draco decoder */",r,"","/* worker */",s.substring(s.indexOf("{")+1,s.lastIndexOf("}"))].join("\n");this.workerSourceURL=URL.createObjectURL(new Blob([o]))}),this.decoderPending}_getWorker(e,t){return this._initDecoder().then(()=>{if(this.workerPool.length<this.workerLimit){const r=new Worker(this.workerSourceURL);r._callbacks={},r._taskCosts={},r._taskLoad=0,r.postMessage({type:"init",decoderConfig:this.decoderConfig}),r.onmessage=function(s){const o=s.data;switch(o.type){case"decode":r._callbacks[o.id].resolve(o);break;case"error":r._callbacks[o.id].reject(o);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+o.type+'"')}},this.workerPool.push(r)}else this.workerPool.sort(function(r,s){return r._taskLoad>s._taskLoad?-1:1});const i=this.workerPool[this.workerPool.length-1];return i._taskCosts[e]=t,i._taskLoad+=t,i})}_releaseTask(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}debug(){console.log("Task load: ",this.workerPool.map(e=>e._taskLoad))}dispose(){for(let e=0;e<this.workerPool.length;++e)this.workerPool[e].terminate();return this.workerPool.length=0,this}}function Kte(){let n,e;onmessage=function(o){const a=o.data;switch(a.type){case"init":n=a.decoderConfig,e=new Promise(function(u){n.onModuleLoaded=function(h){u({draco:h})},DracoDecoderModule(n)});break;case"decode":const l=a.buffer,c=a.taskConfig;e.then(u=>{const h=u.draco,d=new h.Decoder,f=new h.DecoderBuffer;f.Init(new Int8Array(l),l.byteLength);try{const p=t(h,d,f,c),v=p.attributes.map(m=>m.array.buffer);p.index&&v.push(p.index.array.buffer),self.postMessage({type:"decode",id:a.id,geometry:p},v)}catch(p){console.error(p),self.postMessage({type:"error",id:a.id,error:p.message})}finally{h.destroy(f),h.destroy(d)}});break}};function t(o,a,l,c){const u=c.attributeIDs,h=c.attributeTypes;let d,f;const p=a.GetEncodedGeometryType(l);if(p===o.TRIANGULAR_MESH)d=new o.Mesh,f=a.DecodeBufferToMesh(l,d);else if(p===o.POINT_CLOUD)d=new o.PointCloud,f=a.DecodeBufferToPointCloud(l,d);else throw new Error("THREE.DRACOLoader: Unexpected geometry type.");if(!f.ok()||d.ptr===0)throw new Error("THREE.DRACOLoader: Decoding failed: "+f.error_msg());const v={index:null,attributes:[]};for(const m in u){const g=self[h[m]];let b,_;if(c.useUniqueIDs)_=u[m],b=a.GetAttributeByUniqueId(d,_);else{if(_=a.GetAttributeId(d,o[u[m]]),_===-1)continue;b=a.GetAttribute(d,_)}v.attributes.push(r(o,a,d,m,g,b))}return p===o.TRIANGULAR_MESH&&(v.index=i(o,a,d)),o.destroy(d),v}function i(o,a,l){const c=l.num_faces()*3,u=c*4,h=o._malloc(u);a.GetTrianglesUInt32Array(l,u,h);const d=new Uint32Array(o.HEAPF32.buffer,h,c).slice();return o._free(h),{array:d,itemSize:1}}function r(o,a,l,c,u,h){const d=h.num_components(),f=l.num_points()*d,p=f*u.BYTES_PER_ELEMENT,v=s(o,u),m=o._malloc(p);a.GetAttributeDataArrayForAllPoints(l,h,v,p,m);const g=new u(o.HEAPF32.buffer,m,f).slice();return o._free(m),{name:c,array:g,itemSize:d}}function s(o,a){switch(a){case Float32Array:return o.DT_FLOAT32;case Int8Array:return o.DT_INT8;case Int16Array:return o.DT_INT16;case Int32Array:return o.DT_INT32;case Uint8Array:return o.DT_UINT8;case Uint16Array:return o.DT_UINT16;case Uint32Array:return o.DT_UINT32}}}const Bre=Xe({__name:"Levioso",props:{speed:{default:1},rotationFactor:{default:1},floatFactor:{default:1},range:{default:()=>[-.1,.1]}},setup(n,{expose:e}){const t=n,i=jn();e({value:i});{const r=Math.random()*1e4,{onLoop:s}=dr();let o=r;s(({delta:a})=>{if(!i.value)return;o+=a*t.speed;const l=o*.25,c=i.value;c.rotation.x=Math.cos(l)*.125*t.rotationFactor,c.rotation.y=Math.sin(l)*.125*t.rotationFactor,c.rotation.z=Math.sin(l)*.05*t.rotationFactor,c.position.y=Gn.mapLinear(Math.sin(l),-1,1,t.range[0],t.range[1])*t.floatFactor})}return(r,s)=>(nt(),Mt("TresGroup",Cr(r.$attrs,{ref_key:"groupRef",ref:i}),[Ei(r.$slots,"default")],16))}});function lL(n){return rm()?(W_(n),!0):!1}function nr(n){return typeof n=="function"?n():Se(n)}const Zte=typeof window<"u"&&typeof document<"u",Jte=Object.prototype.toString,Qte=n=>Jte.call(n)==="[object Object]",Ka=()=>{};function cL(n,e){function t(...i){return new Promise((r,s)=>{Promise.resolve(n(()=>e.apply(this,i),{fn:e,thisArg:this,args:i})).then(r).catch(s)})}return t}function ene(n,e={}){let t,i,r=Ka;const s=o=>{clearTimeout(o),r(),r=Ka};return o=>{const a=nr(n),l=nr(e.maxWait);return t&&s(t),a<=0||l!==void 0&&l<=0?(i&&(s(i),i=null),Promise.resolve(o())):new Promise((c,u)=>{r=e.rejectOnCancel?u:c,l&&!i&&(i=setTimeout(()=>{t&&s(t),i=null,c(o())},l)),t=setTimeout(()=>{i&&s(i),i=null,c(o())},a)})}}function tne(n,e=!0,t=!0,i=!1){let r=0,s,o=!0,a=Ka,l;const c=()=>{s&&(clearTimeout(s),s=void 0,a(),a=Ka)};return u=>{const h=nr(n),d=Date.now()-r,f=()=>l=u();return c(),h<=0?(r=Date.now(),f()):(d>h&&(t||!o)?(r=Date.now(),f()):e&&(l=new Promise((p,v)=>{a=i?v:p,s=setTimeout(()=>{r=Date.now(),o=!0,p(f()),c()},Math.max(0,h-d))})),!t&&!s&&(s=setTimeout(()=>o=!0,h)),o=!1,l)}}function nne(n,e=200,t={}){return cL(ene(e,t),n)}function ine(n,e=200,t=!1,i=!0,r=!1){return cL(tne(e,t,i,r),n)}function rne(n,e=!0){An()?bn(n):e?n():Jr(n)}function sne(n){var e;const t=nr(n);return(e=t==null?void 0:t.$el)!=null?e:t}const Qc=Zte?window:void 0;function Wn(...n){let e,t,i,r;if(typeof n[0]=="string"||Array.isArray(n[0])?([t,i,r]=n,e=Qc):[e,t,i,r]=n,!e)return Ka;Array.isArray(t)||(t=[t]),Array.isArray(i)||(i=[i]);const s=[],o=()=>{s.forEach(u=>u()),s.length=0},a=(u,h,d,f)=>(u.addEventListener(h,d,f),()=>u.removeEventListener(h,d,f)),l=ft(()=>[sne(e),nr(r)],([u,h])=>{if(o(),!u)return;const d=Qte(h)?Bt({},h):h;s.push(...t.flatMap(f=>i.map(p=>a(u,f,p,d))))},{immediate:!0,flush:"post"}),c=()=>{l(),o()};return lL(c),c}function one(n){return typeof n=="function"?n:typeof n=="string"?e=>e.key===n:Array.isArray(n)?e=>n.includes(e.key):()=>!0}function ca(...n){let e,t,i={};n.length===3?(e=n[0],t=n[1],i=n[2]):n.length===2?typeof n[1]=="object"?(e=!0,t=n[0],i=n[1]):(e=n[0],t=n[1]):(e=!0,t=n[0]);const{target:r=Qc,eventName:s="keydown",passive:o=!1,dedupe:a=!1}=i,l=one(e);return Wn(r,s,c=>{c.repeat&&nr(a)||l(c)&&t(c)},o)}function ane(){const n=xe(!1);return An()&&bn(()=>{n.value=!0}),n}function lne(n){const e=ane();return Te(()=>(e.value,!!n()))}function cne(n,e={}){const{window:t=Qc}=e,i=lne(()=>t&&"matchMedia"in t&&typeof t.matchMedia=="function");let r;const s=xe(!1),o=c=>{s.value=c.matches},a=()=>{r&&("removeEventListener"in r?r.removeEventListener("change",o):r.removeListener(o))},l=ar(()=>{i.value&&(a(),r=t.matchMedia(nr(n)),"addEventListener"in r?r.addEventListener("change",o):r.addListener(o),s.value=r.matches)});return lL(()=>{l(),a(),r=void 0}),s}const XE=1;function une(n,e={}){const{throttle:t=0,idle:i=200,onStop:r=Ka,onScroll:s=Ka,offset:o={left:0,right:0,top:0,bottom:0},eventListenerOptions:a={capture:!1,passive:!0},behavior:l="auto",window:c=Qc}=e,u=xe(0),h=xe(0),d=Te({get(){return u.value},set(S){p(S,void 0)}}),f=Te({get(){return h.value},set(S){p(void 0,S)}});function p(S,E){var x,M,w;if(!c)return;const C=nr(n);C&&((w=C instanceof Document?c.document.body:C)==null||w.scrollTo({top:(x=nr(E))!=null?x:f.value,left:(M=nr(S))!=null?M:d.value,behavior:nr(l)}))}const v=xe(!1),m=ui({left:!0,right:!1,top:!0,bottom:!1}),g=ui({left:!1,right:!1,top:!1,bottom:!1}),b=S=>{v.value&&(v.value=!1,g.left=!1,g.right=!1,g.top=!1,g.bottom=!1,r(S))},_=nne(b,t+i),y=S=>{var E;if(!c)return;const x=S.document?S.document.documentElement:(E=S.documentElement)!=null?E:S,{display:M,flexDirection:w}=getComputedStyle(x),C=x.scrollLeft;g.left=C<u.value,g.right=C>u.value;const L=Math.abs(C)<=0+(o.left||0),$=Math.abs(C)+x.clientWidth>=x.scrollWidth-(o.right||0)-XE;M==="flex"&&w==="row-reverse"?(m.left=$,m.right=L):(m.left=L,m.right=$),u.value=C;let U=x.scrollTop;S===c.document&&!U&&(U=c.document.body.scrollTop),g.top=U<h.value,g.bottom=U>h.value;const H=Math.abs(U)<=0+(o.top||0),V=Math.abs(U)+x.clientHeight>=x.scrollHeight-(o.bottom||0)-XE;M==="flex"&&w==="column-reverse"?(m.top=V,m.bottom=H):(m.top=H,m.bottom=V),h.value=U},T=S=>{var E;if(!c)return;const x=(E=S.target.documentElement)!=null?E:S.target;y(x),v.value=!0,_(S),s(S)};return Wn(n,"scroll",t?ine(T,t,!0,!1):T,a),Wn(n,"scrollend",b,a),{x:d,y:f,isScrolling:v,arrivedState:m,directions:g,measure(){const S=nr(n);c&&S&&y(S)}}}function hne(n={}){const{window:e=Qc}=n;if(!e)return{x:xe(0),y:xe(0)};const t=xe(e.scrollX),i=xe(e.scrollY);return Wn(e,"scroll",()=>{t.value=e.scrollX,i.value=e.scrollY},{capture:!1,passive:!0}),{x:t,y:i}}function dne(n={}){const{window:e=Qc,initialWidth:t=Number.POSITIVE_INFINITY,initialHeight:i=Number.POSITIVE_INFINITY,listenOrientation:r=!0,includeScrollbar:s=!0}=n,o=xe(t),a=xe(i),l=()=>{e&&(s?(o.value=e.innerWidth,a.value=e.innerHeight):(o.value=e.document.documentElement.clientWidth,a.value=e.document.documentElement.clientHeight))};if(l(),rne(l),Wn("resize",l,{passive:!0}),r){const c=cne("(orientation: portrait)");ft(c,()=>l())}return{width:o,height:a}}class Zp extends Be{constructor(){super(Zp.Geometry,new Jn({opacity:0,transparent:!0})),this.isLensflare=!0,this.type="Lensflare",this.frustumCulled=!1,this.renderOrder=1/0;const e=new D,t=new D,i=new v_(16,16),r=new v_(16,16);let s=Tr;const o=Zp.Geometry,a=new sh({uniforms:{scale:{value:null},screenPosition:{value:null}},vertexShader:"\n\n precision highp float;\n\n uniform vec3 screenPosition;\n uniform vec2 scale;\n\n attribute vec3 position;\n\n void main() {\n\n gl_Position = vec4( position.xy * scale + screenPosition.xy, screenPosition.z, 1.0 );\n\n }",fragmentShader:"\n\n precision highp float;\n\n void main() {\n\n gl_FragColor = vec4( 1.0, 0.0, 1.0, 1.0 );\n\n }",depthTest:!0,depthWrite:!1,transparent:!1}),l=new sh({uniforms:{map:{value:i},scale:{value:null},screenPosition:{value:null}},vertexShader:"\n\n precision highp float;\n\n uniform vec3 screenPosition;\n uniform vec2 scale;\n\n attribute vec3 position;\n attribute vec2 uv;\n\n varying vec2 vUV;\n\n void main() {\n\n vUV = uv;\n\n gl_Position = vec4( position.xy * scale + screenPosition.xy, screenPosition.z, 1.0 );\n\n }",fragmentShader:"\n\n precision highp float;\n\n uniform sampler2D map;\n\n varying vec2 vUV;\n\n void main() {\n\n gl_FragColor = texture2D( map, vUV );\n\n }",depthTest:!1,depthWrite:!1,transparent:!1}),c=new Be(o,a),u=[],h=uL.Shader,d=new sh({name:h.name,uniforms:{map:{value:null},occlusionMap:{value:r},color:{value:new Pe(16777215)},scale:{value:new _e},screenPosition:{value:new D}},vertexShader:h.vertexShader,fragmentShader:h.fragmentShader,blending:Bp,transparent:!0,depthWrite:!1}),f=new Be(o,d);this.addElement=function(b){u.push(b)};const p=new _e,v=new _e,m=new R3,g=new vt;this.onBeforeRender=function(b,_,y){b.getCurrentViewport(g);const T=b.getRenderTarget(),S=T!==null?T.texture.type:Tr;s!==S&&(i.dispose(),r.dispose(),i.type=r.type=S,s=S);const E=g.w/g.z,x=g.z/2,M=g.w/2;let w=16/g.w;if(p.set(w*E,w),m.min.set(g.x,g.y),m.max.set(g.x+(g.z-16),g.y+(g.w-16)),t.setFromMatrixPosition(this.matrixWorld),t.applyMatrix4(y.matrixWorldInverse),!(t.z>0)&&(e.copy(t).applyMatrix4(y.projectionMatrix),v.x=g.x+e.x*x+x-8,v.y=g.y+e.y*M+M-8,m.containsPoint(v))){b.copyFramebufferToTexture(v,i);let C=a.uniforms;C.scale.value=p,C.screenPosition.value=e,b.renderBufferDirect(y,null,o,a,c,null),b.copyFramebufferToTexture(v,r),C=l.uniforms,C.scale.value=p,C.screenPosition.value=e,b.renderBufferDirect(y,null,o,l,c,null);const L=-e.x*2,$=-e.y*2;for(let U=0,H=u.length;U<H;U++){const V=u[U],j=d.uniforms;j.color.value.copy(V.color),j.map.value=V.texture,j.screenPosition.value.x=e.x+L*V.distance,j.screenPosition.value.y=e.y+$*V.distance,w=V.size/g.w;const te=g.w/g.z;j.scale.value.set(w*te,w),d.uniformsNeedUpdate=!0,b.renderBufferDirect(y,null,o,d,f,null)}}},this.dispose=function(){a.dispose(),l.dispose(),d.dispose(),i.dispose(),r.dispose();for(let b=0,_=u.length;b<_;b++)u[b].texture.dispose()}}}class uL{constructor(e,t=1,i=0,r=new Pe(16777215)){this.texture=e,this.size=t,this.distance=i,this.color=r}}uL.Shader={name:"LensflareElementShader",uniforms:{map:{value:null},occlusionMap:{value:null},color:{value:null},scale:{value:null},screenPosition:{value:null}},vertexShader:"\n\n precision highp float;\n\n uniform vec3 screenPosition;\n uniform vec2 scale;\n\n uniform sampler2D occlusionMap;\n\n attribute vec3 position;\n attribute vec2 uv;\n\n varying vec2 vUV;\n varying float vVisibility;\n\n void main() {\n\n vUV = uv;\n\n vec2 pos = position.xy;\n\n vec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) );\n visibility += texture2D( occlusionMap, vec2( 0.5, 0.1 ) );\n visibility += texture2D( occlusionMap, vec2( 0.9, 0.1 ) );\n visibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) );\n visibility += texture2D( occlusionMap, vec2( 0.9, 0.9 ) );\n visibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) );\n visibility += texture2D( occlusionMap, vec2( 0.1, 0.9 ) );\n visibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) );\n visibility += texture2D( occlusionMap, vec2( 0.5, 0.5 ) );\n\n vVisibility = visibility.r / 9.0;\n vVisibility *= 1.0 - visibility.g / 9.0;\n vVisibility *= visibility.b / 9.0;\n\n gl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n\n }",fragmentShader:"\n\n precision highp float;\n\n uniform sampler2D map;\n uniform vec3 color;\n\n varying vec2 vUV;\n varying float vVisibility;\n\n void main() {\n\n vec4 texture = texture2D( map, vUV );\n texture.a *= vVisibility;\n gl_FragColor = texture;\n gl_FragColor.rgb *= color;\n\n }"};Zp.Geometry=function(){const n=new qe,e=new Float32Array([-1,-1,0,0,0,1,-1,0,1,0,1,1,0,1,1,-1,1,0,0,1]),t=new Wc(e,5);return n.setIndex([0,1,2,0,2,3]),n.setAttribute("position",new os(t,3,0,!1)),n.setAttribute("uv",new os(t,2,3,!1)),n}();Gn.clamp;Gn.lerp;let Yf=null;function fne(n,e){return t=>{e&&e(t),n.draco&&(Yf||(Yf=new qte),Yf.setDecoderPath(n.decoderPath||"https://www.gstatic.com/draco/versioned/decoders/1.4.3/"),t.setDRACOLoader(Yf))}}async function zre(n,e={draco:!1},t){return await $3(Xee,n,fne(e,t))}async function Vre(n){return await $3(Ite,n)}const YE="[TresJS - Cientos ▲ ■ ♥] ";function hL(){function n(i,r){console.error("".concat(YE," ").concat(i),r||"")}function e(i){console.warn("".concat(YE," ").concat(i))}function t(i,r){}return{logError:n,logWarning:e,logMessage:t}}let zv=0;function Hre(){const n=xe(!1),e=xe(0),t=xe([]),{logError:i}=hL();return new Promise(r=>{ec.onStart=()=>{n.value=!1},ec.onLoad=()=>{n.value=!0},ec.onProgress=(s,o,a)=>{o===a&&(zv=a,n.value=!0,t.value.push(s)),e.value=Math.round((o-zv)/(a-zv)*100||100,2)},ec.onError=s=>{i("Error loading assets",new Error(s)),n.value=!0},r({items:t,hasFinishLoading:n,progress:e})})}const pne=["target","auto-rotate","auto-rotate-speed","enable-damping","damping-factor","enable-pan","key-pan-speed","keys","max-azimuth-angle","min-azimuth-angle","max-polar-angle","min-polar-angle","min-distance","max-distance","min-zoom","max-zoom","touches","enable-zoom","zoom-speed","enable-rotate","rotate-speed","args"],Gre=Xe({__name:"OrbitControls",props:{makeDefault:{type:Boolean,default:!1},camera:{},domElement:{},target:{default:()=>[0,0,0]},enableDamping:{type:Boolean,default:!1},dampingFactor:{default:.05},autoRotate:{type:Boolean,default:!1},autoRotateSpeed:{default:2},enablePan:{type:Boolean,default:!0},keyPanSpeed:{default:7},keys:{},maxAzimuthAngle:{default:1/0},minAzimuthAngle:{default:-1/0},maxPolarAngle:{default:Math.PI},minPolarAngle:{default:0},minDistance:{default:0},maxDistance:{default:1/0},minZoom:{default:0},maxZoom:{default:1/0},touches:{default:()=>({ONE:xr.ROTATE,TWO:xr.DOLLY_PAN})},enableZoom:{type:Boolean,default:!0},zoomSpeed:{default:1},enableRotate:{type:Boolean,default:!0},rotateSpeed:{default:1}},emits:["change","start","end"],setup(n,{expose:e,emit:t}){const i=n,r=t,{makeDefault:s,autoRotate:o,autoRotateSpeed:a,enableDamping:l,dampingFactor:c,enablePan:u,keyPanSpeed:h,maxAzimuthAngle:d,minAzimuthAngle:f,maxPolarAngle:p,minPolarAngle:v,minDistance:m,maxDistance:g,minZoom:b,maxZoom:_,enableZoom:y,zoomSpeed:T,enableRotate:S,touches:E,rotateSpeed:x,target:M}=Or(i),{camera:w,renderer:C,extend:L,controls:$}=ur(),U=xe(null);L({OrbitControls:QR}),ft(U,j=>{H(),j&&s.value?$.value=j:$.value=null});function H(){Wn(U.value,"change",()=>r("change",U.value)),Wn(U.value,"start",()=>r("start",U.value)),Wn(U.value,"end",()=>r("end",U.value))}const{onLoop:V}=dr();return V(()=>{U.value&&(l.value||o.value)&&U.value.update()}),Ci(()=>{U.value&&U.value.dispose()}),e({value:U}),(j,te)=>(j.camera||Se(w))&&(j.domElement||Se(C))?(nt(),Mt("TresOrbitControls",{key:0,ref_key:"controlsRef",ref:U,target:Se(M),"auto-rotate":Se(o),"auto-rotate-speed":Se(a),"enable-damping":Se(l),"damping-factor":Se(c),"enable-pan":Se(u),"key-pan-speed":Se(h),keys:j.keys,"max-azimuth-angle":Se(d),"min-azimuth-angle":Se(f),"max-polar-angle":Se(p),"min-polar-angle":Se(v),"min-distance":Se(m),"max-distance":Se(g),"min-zoom":Se(b),"max-zoom":Se(_),touches:Se(E),"enable-zoom":Se(y),"zoom-speed":Se(T),"enable-rotate":Se(S),"rotate-speed":Se(x),args:[j.camera||Se(w),j.domElement||Se(C).domElement]},null,8,pne)):Fi("",!0)}}),mne=5,gne=6,vne=.3,Wre=Xe({__name:"KeyboardControls",props:{forward:{default:()=>["w","W"]},back:{default:()=>["s","S"]},left:{default:()=>["a","A"]},right:{default:()=>["d","D"]},jump:{default:()=>[" "]},gravity:{default:9.8},moveSpeed:{default:.1},headBobbing:{type:Boolean,default:!1},is2D:{type:Boolean,default:!1}},setup(n){var e;const t=n,{forward:i,back:r,left:s,right:o,jump:a,gravity:l,moveSpeed:c,headBobbing:u,is2D:h}=Or(t),{camera:d,controls:f}=ur(),p=xe(0),v=xe(0),m=xe(!1),g=xe(!1),b=xe(0),_=jn(),y=h.value?"y":"z",T=((e=d.value.position)==null?void 0:e.y)||0;ca(i.value,()=>{m.value=!0,v.value=c.value},{eventName:"keydown"}),ca(r.value,()=>{m.value=!0,v.value=-c.value},{eventName:"keydown"}),ca([...i.value,...r.value],()=>{m.value=!1,v.value=0},{eventName:"keyup"}),ca(s.value,()=>{m.value=!0,p.value=-c.value},{eventName:"keydown"}),ca(o.value,()=>{m.value=!0,p.value=c.value},{eventName:"keydown"}),ca([...s.value,...o.value],()=>{m.value=!1,p.value=0},{eventName:"keyup"}),ca(a.value,()=>{g.value||(b.value=Date.now()),g.value=!0});const S=C=>m.value?Math.sin(C*mne)*vne+T:T,E=()=>(Date.now()-b.value)/1e3*3,x=C=>T+gne*C-.5*l.value*C**2,M=()=>{if(g.value){const C=x(E());return C<=T&&(g.value=!1),C}return 0},{onLoop:w}=dr();return w(({elapsed:C})=>{var L;f.value instanceof O_&&(L=f.value)!=null&&L.isLocked?(f.value.moveForward(v.value),f.value.moveRight(p.value),d.value.position&&(d.value.position.y=u.value?S(C):T,d.value.position.y+=M())):_.value.children.length>0&&!(f.value instanceof O_)&&(_.value.position.x+=p.value,_.value.position[y]+=h.value?v.value:-v.value)}),(C,L)=>(nt(),Mt("TresGroup",{ref_key:"wrapperRef",ref:_},[Ei(C.$slots,"default")],512))}}),_ne=["object","args","mode","enabled","axis","translation-snap","rotation-snap","scale-snap","space","size","show-x","show-y","show-z"],$re=Xe({__name:"TransformControls",props:{object:{},mode:{default:"translate"},enabled:{type:Boolean,default:!0},axis:{default:"XYZ"},translationSnap:{},rotationSnap:{},scaleSnap:{},space:{default:"world"},size:{default:1},showX:{type:Boolean,default:!0},showY:{type:Boolean,default:!0},showZ:{type:Boolean,default:!0}},emits:["dragging","change","mouseDown","mouseUp","objectChange"],setup(n,{emit:e}){const t=n,i=e,{object:r,mode:s,enabled:o,axis:a,translationSnap:l,rotationSnap:c,scaleSnap:u,space:h,size:d,showX:f,showY:p,showZ:v}=Or(t),m=jn(),{controls:g,camera:b,renderer:_,extend:y}=ur();y({TransformControls:Uee});const T=E=>{g.value&&(g.value.enabled=!E.value),i("dragging",E.value)};function S(){Wn(m.value,"change",()=>i("change")),Wn(m.value,"dragging-changed",T),Wn(m.value,"mouseDown",()=>i("mouseDown")),Wn(m.value,"mouseUp",()=>i("mouseUp")),Wn(m.value,"objectChange",()=>i("objectChange"))}return ar(()=>{m.value&&S()}),Ci(()=>{m.value&&m.value.dispose()}),(E,x)=>Se(b)&&Se(_)?(nt(),Mt("TresTransformControls",{key:0,ref_key:"controlsRef",ref:m,object:Se(r),args:[Se(b),Se(_).domElement],mode:Se(s),enabled:Se(o),axis:Se(a),"translation-snap":Se(l),"rotation-snap":Se(c),"scale-snap":Se(u),space:Se(h),size:Se(d),"show-x":Se(f),"show-y":Se(p),"show-z":Se(v),visible:!0},null,8,_ne)):Fi("",!0)}}),yne=["args"],jre=Xe({__name:"PointerLockControls",props:{makeDefault:{type:Boolean,default:!1},camera:{},domElement:{},selector:{}},emits:["isLock"],setup(n,{expose:e,emit:t}){const i=n,r=t,{camera:s,renderer:o,extend:a,controls:l}=ur(),c=xe(null);let u;a({PointerLockControls:O_});const h=d=>{r("isLock",d)};return ft(c,d=>{d&&i.makeDefault?l.value=d:l.value=null,u=document.getElementById(i.selector||"")||o.value.domElement,Wn(u,"click",()=>{var p,v,m;(p=l.value)==null||p.lock(),(v=l.value)==null||v.addEventListener("lock",()=>h(!0)),(m=l.value)==null||m.addEventListener("unlock",()=>h(!1))})}),Ci(()=>{var d,f;(d=l.value)==null||d.removeEventListener("lock",()=>h(!0)),(f=l.value)==null||f.removeEventListener("unlock",()=>h(!1)),c.value&&c.value.dispose()}),e({value:l}),(d,f)=>(d.camera||Se(s))&&(d.domElement||Se(o))?(nt(),Mt("TresPointerLockControls",{key:0,ref_key:"controlsRef",ref:c,args:[d.camera||Se(s),d.domElement||Se(o).domElement]},null,8,yne)):Fi("",!0)}}),bne=["args"],Xre=Xe({__name:"MapControls",props:{makeDefault:{type:Boolean,default:!1},camera:{},domElement:{}},setup(n){const e=n,{camera:t,renderer:i,extend:r,controls:s}=ur(),o=xe(null);return r({MapControls:jee}),ft(s,a=>{a&&e.makeDefault?s.value=a:s.value=null}),Ci(()=>{o.value&&o.value.dispose()}),(a,l)=>(a.camera||Se(t))&&(a.domElement||Se(i))?(nt(),Mt("TresMapControls",{key:0,ref_key:"controlsRef",ref:o,args:[a.camera||Se(t),a.domElement||Se(i).domElement]},null,8,bne)):Fi("",!0)}}),Yre=Xe({__name:"ScrollControls",props:{pages:{default:4},distance:{default:4},smoothScroll:{default:.1},horizontal:{type:Boolean,default:!1},htmlScroll:{type:Boolean,default:!1}},emits:["update:modelValue"],setup(n,{emit:e}){const t=n,i=e,{logWarning:r}=cl();t.smoothScroll<0&&r("SmoothControl must be greater than zero"),t.pages<0&&r("Pages must be greater than zero");const{camera:s,controls:o,renderer:a}=ur(),l=jn(),c=document.createElement("div"),{y:u}=hne(),{x:h,y:d,isScrolling:f}=une(c),{height:p,width:v}=dne();let m=0;const g=xe(!1),b=xe(0),_=xe(0),y=xe(0),T=t.horizontal?"x":"y",S=ft(s,x=>{if(g.value){S();return}m=t.horizontal?(x==null?void 0:x.position.x)||0:(x==null?void 0:x.position.y)||0,g.value=!0},{immediate:!0});ft(f,x=>{o.value&&(o.value.enabled=!x)},{immediate:!0}),ft(u,x=>{!f.value&&!t.htmlScroll||(_.value=x/p.value/(y.value/p.value-1),b.value=-1*_.value,i("update:modelValue",_.value))}),ft(d,x=>{_.value=x/p.value/(y.value/p.value),b.value=-1*_.value,i("update:modelValue",_.value)}),ft(h,x=>{_.value=x/v.value/(y.value/v.value-1),b.value=+_.value,i("update:modelValue",_.value)}),ft(a,x=>{var M,w;const C=x==null?void 0:x.domElement;if(t.htmlScroll&&x!=null&&x.domElement)C!=null&&C.style.width&&C!=null&&C.style.position&&C!=null&&C.style.top&&C!=null&&C.style.left&&(C.style.width="100%",C.style.position="fixed",C.style.zIndex=" -99999",C.style.top="0",C.style.left="0"),y.value=document.body.scrollHeight;else{const L=document.createElement("div"),$=document.createElement("div");c.style[t.horizontal?"overflowX":"overflowY"]="auto",c.style[t.horizontal?"overflowY":"overflowX"]="hidden",c.style.position="absolute",c.style.width="100%",c.style.height=" 100%",c.style.top="0",c.style.left="0",c.classList.add("scrollContainer"),L.style.position="sticky",L.style.top="0px",L.style.left="0px",L.style.width="100%",L.style.height="100%",L.style.overflow="hidden",c.appendChild(L),$.style.height=t.horizontal?"100%":"".concat(p.value*t.pages,"px"),$.style.width=t.horizontal?"".concat(v.value*t.pages,"px"):"100vw",$.style.pointerEvents="none",C.style.position="fixed",C.style.zIndex="0",C!=null&&C.style.width&&(C.style.width="100%"),c.appendChild($),x.domElement.parentNode.style.position="relative",(w=(M=x==null?void 0:x.domElement)==null?void 0:M.parentNode)==null||w.appendChild(c),y.value=t.horizontal?v.value*t.pages:p.value*t.pages}},{immediate:!0});const{onLoop:E}=dr();return E(()=>{var x;if((x=s.value)!=null&&x.position){const M=(b.value*t.distance-s.value.position[T]+m)*t.smoothScroll;s.value.position[T]+=M,l.value.children.length>0&&(l.value.position[T]+=M)}}),(x,M)=>(nt(),Mt("TresGroup",{ref_key:"wrapperRef",ref:l},[Ei(x.$slots,"default")],512))}});/*!
* camera-controls
* https://github.com/yomotsu/camera-controls
* (c) 2017 @yomotsu
* Released under the MIT License.
*/const Qe={LEFT:1,RIGHT:2,MIDDLE:4},ye=Object.freeze({NONE:0,ROTATE:1,TRUCK:2,OFFSET:4,DOLLY:8,ZOOM:16,TOUCH_ROTATE:32,TOUCH_TRUCK:64,TOUCH_OFFSET:128,TOUCH_DOLLY:256,TOUCH_ZOOM:512,TOUCH_DOLLY_TRUCK:1024,TOUCH_DOLLY_OFFSET:2048,TOUCH_DOLLY_ROTATE:4096,TOUCH_ZOOM_TRUCK:8192,TOUCH_ZOOM_OFFSET:16384,TOUCH_ZOOM_ROTATE:32768}),Hl={NONE:0,IN:1,OUT:-1};function ua(n){return n.isPerspectiveCamera}function uo(n){return n.isOrthographicCamera}const Gl=Math.PI*2,qE=Math.PI/2,dL=1e-5,Cu=Math.PI/180;function yr(n,e,t){return Math.max(e,Math.min(t,n))}function zt(n,e=dL){return Math.abs(n)<e}function Lt(n,e,t=dL){return zt(n-e,t)}function KE(n,e){return Math.round(n/e)*e}function Pu(n){return isFinite(n)?n:n<0?-Number.MAX_VALUE:Number.MAX_VALUE}function Ru(n){return Math.abs(n)<Number.MAX_VALUE?n:n*(1/0)}function qf(n,e,t,i,r=1/0,s){i=Math.max(1e-4,i);const o=2/i,a=o*s,l=1/(1+a+.48*a*a+.235*a*a*a);let c=n-e;const u=e,h=r*i;c=yr(c,-h,h),e=n-c;const d=(t.value+o*c)*s;t.value=(t.value-o*d)*l;let f=e+(c+d)*l;return u-n>0==f>u&&(f=u,t.value=(f-u)/s),f}function ZE(n,e,t,i,r=1/0,s,o){i=Math.max(1e-4,i);const a=2/i,l=a*s,c=1/(1+l+.48*l*l+.235*l*l*l);let u=e.x,h=e.y,d=e.z,f=n.x-u,p=n.y-h,v=n.z-d;const m=u,g=h,b=d,_=r*i,y=_*_,T=f*f+p*p+v*v;if(T>y){const H=Math.sqrt(T);f=f/H*_,p=p/H*_,v=v/H*_}u=n.x-f,h=n.y-p,d=n.z-v;const S=(t.x+a*f)*s,E=(t.y+a*p)*s,x=(t.z+a*v)*s;t.x=(t.x-a*S)*c,t.y=(t.y-a*E)*c,t.z=(t.z-a*x)*c,o.x=u+(f+S)*c,o.y=h+(p+E)*c,o.z=d+(v+x)*c;const M=m-n.x,w=g-n.y,C=b-n.z,L=o.x-m,$=o.y-g,U=o.z-b;return M*L+w*$+C*U>0&&(o.x=m,o.y=g,o.z=b,t.x=(o.x-m)/s,t.y=(o.y-g)/s,t.z=(o.z-b)/s),o}function Vv(n,e){e.set(0,0),n.forEach(t=>{e.x+=t.clientX,e.y+=t.clientY}),e.x/=n.length,e.y/=n.length}function Hv(n,e){return uo(n)?(console.warn("".concat(e," is not supported in OrthographicCamera")),!0):!1}class xne{constructor(){this._listeners={}}addEventListener(e,t){const i=this._listeners;i[e]===void 0&&(i[e]=[]),i[e].indexOf(t)===-1&&i[e].push(t)}hasEventListener(e,t){const i=this._listeners;return i[e]!==void 0&&i[e].indexOf(t)!==-1}removeEventListener(e,t){const i=this._listeners[e];if(i!==void 0){const r=i.indexOf(t);r!==-1&&i.splice(r,1)}}removeAllEventListeners(e){if(!e){this._listeners={};return}Array.isArray(this._listeners[e])&&(this._listeners[e].length=0)}dispatchEvent(e){const t=this._listeners[e.type];if(t!==void 0){e.target=this;const i=t.slice(0);for(let r=0,s=i.length;r<s;r++)i[r].call(this,e)}}}const wne="2.7.3",Kf=1/8,fL=typeof window<"u",Sne=fL&&/Mac/.test(navigator.platform),Mne=!(fL&&"PointerEvent"in window);let Ye,JE,Zf,Gv,pi,at,Pt,Wl,Lu,Vr,Hr,ha,QE,eT,Ki,Ou,$l,tT,Wv,nT,$v,jv,Jf;class nd extends xne{static install(e){Ye=e.THREE,JE=Object.freeze(new Ye.Vector3(0,0,0)),Zf=Object.freeze(new Ye.Vector3(0,1,0)),Gv=Object.freeze(new Ye.Vector3(0,0,1)),pi=new Ye.Vector2,at=new Ye.Vector3,Pt=new Ye.Vector3,Wl=new Ye.Vector3,Lu=new Ye.Vector3,Vr=new Ye.Vector3,Hr=new Ye.Vector3,ha=new Ye.Vector3,QE=new Ye.Vector3,eT=new Ye.Vector3,Ki=new Ye.Spherical,Ou=new Ye.Spherical,$l=new Ye.Box3,tT=new Ye.Box3,Wv=new Ye.Sphere,nT=new Ye.Quaternion,$v=new Ye.Quaternion,jv=new Ye.Matrix4,Jf=new Ye.Raycaster}static get ACTION(){return ye}constructor(e,t){super(),this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.minDistance=Number.EPSILON,this.maxDistance=1/0,this.infinityDolly=!1,this.minZoom=.01,this.maxZoom=1/0,this.smoothTime=.25,this.draggingSmoothTime=.125,this.maxSpeed=1/0,this.azimuthRotateSpeed=1,this.polarRotateSpeed=1,this.dollySpeed=1,this.dollyDragInverted=!1,this.truckSpeed=2,this.dollyToCursor=!1,this.dragToOffset=!1,this.verticalDragToForward=!1,this.boundaryFriction=0,this.restThreshold=.01,this.colliderMeshes=[],this.cancel=()=>{},this._enabled=!0,this._state=ye.NONE,this._viewport=null,this._changedDolly=0,this._changedZoom=0,this._hasRested=!0,this._boundaryEnclosesCamera=!1,this._needsUpdate=!0,this._updatedLastTime=!1,this._elementRect=new DOMRect,this._isDragging=!1,this._dragNeedsUpdate=!0,this._activePointers=[],this._lockedPointer=null,this._interactiveArea=new DOMRect(0,0,1,1),this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._isUserControllingOffset=!1,this._isUserControllingZoom=!1,this._lastDollyDirection=Hl.NONE,this._thetaVelocity={value:0},this._phiVelocity={value:0},this._radiusVelocity={value:0},this._targetVelocity=new Ye.Vector3,this._focalOffsetVelocity=new Ye.Vector3,this._zoomVelocity={value:0},this._truckInternal=(y,T,S)=>{let E,x;if(ua(this._camera)){const M=at.copy(this._camera.position).sub(this._target),w=this._camera.getEffectiveFOV()*Cu,C=M.length()*Math.tan(w*.5);E=this.truckSpeed*y*C/this._elementRect.height,x=this.truckSpeed*T*C/this._elementRect.height}else if(uo(this._camera)){const M=this._camera;E=y*(M.right-M.left)/M.zoom/this._elementRect.width,x=T*(M.top-M.bottom)/M.zoom/this._elementRect.height}else return;this.verticalDragToForward?(S?this.setFocalOffset(this._focalOffsetEnd.x+E,this._focalOffsetEnd.y,this._focalOffsetEnd.z,!0):this.truck(E,0,!0),this.forward(-x,!0)):S?this.setFocalOffset(this._focalOffsetEnd.x+E,this._focalOffsetEnd.y+x,this._focalOffsetEnd.z,!0):this.truck(E,x,!0)},this._rotateInternal=(y,T)=>{const S=Gl*this.azimuthRotateSpeed*y/this._elementRect.height,E=Gl*this.polarRotateSpeed*T/this._elementRect.height;this.rotate(S,E,!0)},this._dollyInternal=(y,T,S)=>{const E=Math.pow(.95,-y*this.dollySpeed),x=this._sphericalEnd.radius,M=this._sphericalEnd.radius*E,w=yr(M,this.minDistance,this.maxDistance),C=w-M;this.infinityDolly&&this.dollyToCursor?this._dollyToNoClamp(M,!0):this.infinityDolly&&!this.dollyToCursor?(this.dollyInFixed(C,!0),this._dollyToNoClamp(w,!0)):this._dollyToNoClamp(w,!0),this.dollyToCursor&&(this._changedDolly+=(this.infinityDolly?M:w)-x,this._dollyControlCoord.set(T,S)),this._lastDollyDirection=Math.sign(-y)},this._zoomInternal=(y,T,S)=>{const E=Math.pow(.95,y*this.dollySpeed),x=this._zoom,M=this._zoom*E;this.zoomTo(M,!0),this.dollyToCursor&&(this._changedZoom+=M-x,this._dollyControlCoord.set(T,S))},typeof Ye>"u"&&console.error("camera-controls: `THREE` is undefined. You must first run `CameraControls.install( { THREE: THREE } )`. Check the docs for further information."),this._camera=e,this._yAxisUpSpace=new Ye.Quaternion().setFromUnitVectors(this._camera.up,Zf),this._yAxisUpSpaceInverse=this._yAxisUpSpace.clone().invert(),this._state=ye.NONE,this._target=new Ye.Vector3,this._targetEnd=this._target.clone(),this._focalOffset=new Ye.Vector3,this._focalOffsetEnd=this._focalOffset.clone(),this._spherical=new Ye.Spherical().setFromVector3(at.copy(this._camera.position).applyQuaternion(this._yAxisUpSpace)),this._sphericalEnd=this._spherical.clone(),this._lastDistance=this._spherical.radius,this._zoom=this._camera.zoom,this._zoomEnd=this._zoom,this._lastZoom=this._zoom,this._nearPlaneCorners=[new Ye.Vector3,new Ye.Vector3,new Ye.Vector3,new Ye.Vector3],this._updateNearPlaneCorners(),this._boundary=new Ye.Box3(new Ye.Vector3(-1/0,-1/0,-1/0),new Ye.Vector3(1/0,1/0,1/0)),this._cameraUp0=this._camera.up.clone(),this._target0=this._target.clone(),this._position0=this._camera.position.clone(),this._zoom0=this._zoom,this._focalOffset0=this._focalOffset.clone(),this._dollyControlCoord=new Ye.Vector2,this.mouseButtons={left:ye.ROTATE,middle:ye.DOLLY,right:ye.TRUCK,wheel:ua(this._camera)?ye.DOLLY:uo(this._camera)?ye.ZOOM:ye.NONE},this.touches={one:ye.TOUCH_ROTATE,two:ua(this._camera)?ye.TOUCH_DOLLY_TRUCK:uo(this._camera)?ye.TOUCH_ZOOM_TRUCK:ye.NONE,three:ye.TOUCH_TRUCK};const i=new Ye.Vector2,r=new Ye.Vector2,s=new Ye.Vector2,o=y=>{if(!this._enabled||!this._domElement)return;if(this._interactiveArea.left!==0||this._interactiveArea.top!==0||this._interactiveArea.width!==1||this._interactiveArea.height!==1){const E=this._domElement.getBoundingClientRect(),x=y.clientX/E.width,M=y.clientY/E.height;if(x<this._interactiveArea.left||x>this._interactiveArea.right||M<this._interactiveArea.top||M>this._interactiveArea.bottom)return}const T=y.pointerType!=="mouse"?null:(y.buttons&Qe.LEFT)===Qe.LEFT?Qe.LEFT:(y.buttons&Qe.MIDDLE)===Qe.MIDDLE?Qe.MIDDLE:(y.buttons&Qe.RIGHT)===Qe.RIGHT?Qe.RIGHT:null;if(T!==null){const E=this._findPointerByMouseButton(T);E&&this._disposePointer(E)}if((y.buttons&Qe.LEFT)===Qe.LEFT&&this._lockedPointer)return;const S={pointerId:y.pointerId,clientX:y.clientX,clientY:y.clientY,deltaX:0,deltaY:0,mouseButton:T};this._activePointers.push(S),this._domElement.ownerDocument.removeEventListener("pointermove",l,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",u),this._domElement.ownerDocument.addEventListener("pointermove",l,{passive:!1}),this._domElement.ownerDocument.addEventListener("pointerup",u),this._isDragging=!0,v(y)},a=y=>{if(!this._enabled||!this._domElement||this._lockedPointer)return;if(this._interactiveArea.left!==0||this._interactiveArea.top!==0||this._interactiveArea.width!==1||this._interactiveArea.height!==1){const E=this._domElement.getBoundingClientRect(),x=y.clientX/E.width,M=y.clientY/E.height;if(x<this._interactiveArea.left||x>this._interactiveArea.right||M<this._interactiveArea.top||M>this._interactiveArea.bottom)return}const T=(y.buttons&Qe.LEFT)===Qe.LEFT?Qe.LEFT:(y.buttons&Qe.MIDDLE)===Qe.MIDDLE?Qe.MIDDLE:(y.buttons&Qe.RIGHT)===Qe.RIGHT?Qe.RIGHT:null;if(T!==null){const E=this._findPointerByMouseButton(T);E&&this._disposePointer(E)}const S={pointerId:1,clientX:y.clientX,clientY:y.clientY,deltaX:0,deltaY:0,mouseButton:(y.buttons&Qe.LEFT)===Qe.LEFT?Qe.LEFT:(y.buttons&Qe.MIDDLE)===Qe.LEFT?Qe.MIDDLE:(y.buttons&Qe.RIGHT)===Qe.LEFT?Qe.RIGHT:null};this._activePointers.push(S),this._domElement.ownerDocument.removeEventListener("mousemove",c),this._domElement.ownerDocument.removeEventListener("mouseup",h),this._domElement.ownerDocument.addEventListener("mousemove",c),this._domElement.ownerDocument.addEventListener("mouseup",h),this._isDragging=!0,v(y)},l=y=>{y.cancelable&&y.preventDefault();const T=y.pointerId,S=this._lockedPointer||this._findPointerById(T);if(S){if(S.clientX=y.clientX,S.clientY=y.clientY,S.deltaX=y.movementX,S.deltaY=y.movementY,this._state=0,y.pointerType==="touch")switch(this._activePointers.length){case 1:this._state=this.touches.one;break;case 2:this._state=this.touches.two;break;case 3:this._state=this.touches.three;break}else(!this._isDragging&&this._lockedPointer||this._isDragging&&(y.buttons&Qe.LEFT)===Qe.LEFT)&&(this._state=this._state|this.mouseButtons.left),this._isDragging&&(y.buttons&Qe.MIDDLE)===Qe.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),this._isDragging&&(y.buttons&Qe.RIGHT)===Qe.RIGHT&&(this._state=this._state|this.mouseButtons.right);m()}},c=y=>{const T=this._lockedPointer||this._findPointerById(1);T&&(T.clientX=y.clientX,T.clientY=y.clientY,T.deltaX=y.movementX,T.deltaY=y.movementY,this._state=0,(this._lockedPointer||(y.buttons&Qe.LEFT)===Qe.LEFT)&&(this._state=this._state|this.mouseButtons.left),(y.buttons&Qe.MIDDLE)===Qe.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),(y.buttons&Qe.RIGHT)===Qe.RIGHT&&(this._state=this._state|this.mouseButtons.right),m())},u=y=>{const T=this._findPointerById(y.pointerId);if(!(T&&T===this._lockedPointer)){if(T&&this._disposePointer(T),y.pointerType==="touch")switch(this._activePointers.length){case 0:this._state=ye.NONE;break;case 1:this._state=this.touches.one;break;case 2:this._state=this.touches.two;break;case 3:this._state=this.touches.three;break}else this._state=ye.NONE;g()}},h=()=>{const y=this._findPointerById(1);y&&y===this._lockedPointer||(y&&this._disposePointer(y),this._state=ye.NONE,g())};let d=-1;const f=y=>{if(!this._domElement||!this._enabled||this.mouseButtons.wheel===ye.NONE)return;if(this._interactiveArea.left!==0||this._interactiveArea.top!==0||this._interactiveArea.width!==1||this._interactiveArea.height!==1){const M=this._domElement.getBoundingClientRect(),w=y.clientX/M.width,C=y.clientY/M.height;if(w<this._interactiveArea.left||w>this._interactiveArea.right||C<this._interactiveArea.top||C>this._interactiveArea.bottom)return}if(y.preventDefault(),this.dollyToCursor||this.mouseButtons.wheel===ye.ROTATE||this.mouseButtons.wheel===ye.TRUCK){const M=performance.now();d-M<1e3&&this._getClientRect(this._elementRect),d=M}const T=Sne?-1:-3,S=y.deltaMode===1?y.deltaY/T:y.deltaY/(T*10),E=this.dollyToCursor?(y.clientX-this._elementRect.x)/this._elementRect.width*2-1:0,x=this.dollyToCursor?(y.clientY-this._elementRect.y)/this._elementRect.height*-2+1:0;switch(this.mouseButtons.wheel){case ye.ROTATE:{this._rotateInternal(y.deltaX,y.deltaY),this._isUserControllingRotate=!0;break}case ye.TRUCK:{this._truckInternal(y.deltaX,y.deltaY,!1),this._isUserControllingTruck=!0;break}case ye.OFFSET:{this._truckInternal(y.deltaX,y.deltaY,!0),this._isUserControllingOffset=!0;break}case ye.DOLLY:{this._dollyInternal(-S,E,x),this._isUserControllingDolly=!0;break}case ye.ZOOM:{this._zoomInternal(-S,E,x),this._isUserControllingZoom=!0;break}}this.dispatchEvent({type:"control"})},p=y=>{if(!(!this._domElement||!this._enabled)){if(this.mouseButtons.right===nd.ACTION.NONE){const T=y instanceof PointerEvent?y.pointerId:0,S=this._findPointerById(T);S&&this._disposePointer(S),this._domElement.ownerDocument.removeEventListener("pointermove",l,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",u),this._domElement.ownerDocument.removeEventListener("mousemove",c),this._domElement.ownerDocument.removeEventListener("mouseup",h);return}y.preventDefault()}},v=y=>{if(this._enabled){if(Vv(this._activePointers,pi),this._getClientRect(this._elementRect),i.copy(pi),r.copy(pi),this._activePointers.length>=2){const T=pi.x-this._activePointers[1].clientX,S=pi.y-this._activePointers[1].clientY,E=Math.sqrt(T*T+S*S);s.set(0,E);const x=(this._activePointers[0].clientX+this._activePointers[1].clientX)*.5,M=(this._activePointers[0].clientY+this._activePointers[1].clientY)*.5;r.set(x,M)}if(this._state=0,!y)this._lockedPointer&&(this._state=this._state|this.mouseButtons.left);else if("pointerType"in y&&y.pointerType==="touch")switch(this._activePointers.length){case 1:this._state=this.touches.one;break;case 2:this._state=this.touches.two;break;case 3:this._state=this.touches.three;break}else!this._lockedPointer&&(y.buttons&Qe.LEFT)===Qe.LEFT&&(this._state=this._state|this.mouseButtons.left),(y.buttons&Qe.MIDDLE)===Qe.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),(y.buttons&Qe.RIGHT)===Qe.RIGHT&&(this._state=this._state|this.mouseButtons.right);((this._state&ye.ROTATE)===ye.ROTATE||(this._state&ye.TOUCH_ROTATE)===ye.TOUCH_ROTATE||(this._state&ye.TOUCH_DOLLY_ROTATE)===ye.TOUCH_DOLLY_ROTATE||(this._state&ye.TOUCH_ZOOM_ROTATE)===ye.TOUCH_ZOOM_ROTATE)&&(this._sphericalEnd.theta=this._spherical.theta,this._sphericalEnd.phi=this._spherical.phi,this._thetaVelocity.value=0,this._phiVelocity.value=0),((this._state&ye.TRUCK)===ye.TRUCK||(this._state&ye.TOUCH_TRUCK)===ye.TOUCH_TRUCK||(this._state&ye.TOUCH_DOLLY_TRUCK)===ye.TOUCH_DOLLY_TRUCK||(this._state&ye.TOUCH_ZOOM_TRUCK)===ye.TOUCH_ZOOM_TRUCK)&&(this._targetEnd.copy(this._target),this._targetVelocity.set(0,0,0)),((this._state&ye.DOLLY)===ye.DOLLY||(this._state&ye.TOUCH_DOLLY)===ye.TOUCH_DOLLY||(this._state&ye.TOUCH_DOLLY_TRUCK)===ye.TOUCH_DOLLY_TRUCK||(this._state&ye.TOUCH_DOLLY_OFFSET)===ye.TOUCH_DOLLY_OFFSET||(this._state&ye.TOUCH_DOLLY_ROTATE)===ye.TOUCH_DOLLY_ROTATE)&&(this._sphericalEnd.radius=this._spherical.radius,this._radiusVelocity.value=0),((this._state&ye.ZOOM)===ye.ZOOM||(this._state&ye.TOUCH_ZOOM)===ye.TOUCH_ZOOM||(this._state&ye.TOUCH_ZOOM_TRUCK)===ye.TOUCH_ZOOM_TRUCK||(this._state&ye.TOUCH_ZOOM_OFFSET)===ye.TOUCH_ZOOM_OFFSET||(this._state&ye.TOUCH_ZOOM_ROTATE)===ye.TOUCH_ZOOM_ROTATE)&&(this._zoomEnd=this._zoom,this._zoomVelocity.value=0),((this._state&ye.OFFSET)===ye.OFFSET||(this._state&ye.TOUCH_OFFSET)===ye.TOUCH_OFFSET||(this._state&ye.TOUCH_DOLLY_OFFSET)===ye.TOUCH_DOLLY_OFFSET||(this._state&ye.TOUCH_ZOOM_OFFSET)===ye.TOUCH_ZOOM_OFFSET)&&(this._focalOffsetEnd.copy(this._focalOffset),this._focalOffsetVelocity.set(0,0,0)),this.dispatchEvent({type:"controlstart"})}},m=()=>{if(!this._enabled||!this._dragNeedsUpdate)return;this._dragNeedsUpdate=!1,Vv(this._activePointers,pi);const y=this._domElement&&document.pointerLockElement===this._domElement?this._lockedPointer||this._activePointers[0]:null,T=y?-y.deltaX:r.x-pi.x,S=y?-y.deltaY:r.y-pi.y;if(r.copy(pi),((this._state&ye.ROTATE)===ye.ROTATE||(this._state&ye.TOUCH_ROTATE)===ye.TOUCH_ROTATE||(this._state&ye.TOUCH_DOLLY_ROTATE)===ye.TOUCH_DOLLY_ROTATE||(this._state&ye.TOUCH_ZOOM_ROTATE)===ye.TOUCH_ZOOM_ROTATE)&&(this._rotateInternal(T,S),this._isUserControllingRotate=!0),(this._state&ye.DOLLY)===ye.DOLLY||(this._state&ye.ZOOM)===ye.ZOOM){const E=this.dollyToCursor?(i.x-this._elementRect.x)/this._elementRect.width*2-1:0,x=this.dollyToCursor?(i.y-this._elementRect.y)/this._elementRect.height*-2+1:0,M=this.dollyDragInverted?-1:1;(this._state&ye.DOLLY)===ye.DOLLY?(this._dollyInternal(M*S*Kf,E,x),this._isUserControllingDolly=!0):(this._zoomInternal(M*S*Kf,E,x),this._isUserControllingZoom=!0)}if((this._state&ye.TOUCH_DOLLY)===ye.TOUCH_DOLLY||(this._state&ye.TOUCH_ZOOM)===ye.TOUCH_ZOOM||(this._state&ye.TOUCH_DOLLY_TRUCK)===ye.TOUCH_DOLLY_TRUCK||(this._state&ye.TOUCH_ZOOM_TRUCK)===ye.TOUCH_ZOOM_TRUCK||(this._state&ye.TOUCH_DOLLY_OFFSET)===ye.TOUCH_DOLLY_OFFSET||(this._state&ye.TOUCH_ZOOM_OFFSET)===ye.TOUCH_ZOOM_OFFSET||(this._state&ye.TOUCH_DOLLY_ROTATE)===ye.TOUCH_DOLLY_ROTATE||(this._state&ye.TOUCH_ZOOM_ROTATE)===ye.TOUCH_ZOOM_ROTATE){const E=pi.x-this._activePointers[1].clientX,x=pi.y-this._activePointers[1].clientY,M=Math.sqrt(E*E+x*x),w=s.y-M;s.set(0,M);const C=this.dollyToCursor?(r.x-this._elementRect.x)/this._elementRect.width*2-1:0,L=this.dollyToCursor?(r.y-this._elementRect.y)/this._elementRect.height*-2+1:0;(this._state&ye.TOUCH_DOLLY)===ye.TOUCH_DOLLY||(this._state&ye.TOUCH_DOLLY_ROTATE)===ye.TOUCH_DOLLY_ROTATE||(this._state&ye.TOUCH_DOLLY_TRUCK)===ye.TOUCH_DOLLY_TRUCK||(this._state&ye.TOUCH_DOLLY_OFFSET)===ye.TOUCH_DOLLY_OFFSET?(this._dollyInternal(w*Kf,C,L),this._isUserControllingDolly=!0):(this._zoomInternal(w*Kf,C,L),this._isUserControllingZoom=!0)}((this._state&ye.TRUCK)===ye.TRUCK||(this._state&ye.TOUCH_TRUCK)===ye.TOUCH_TRUCK||(this._state&ye.TOUCH_DOLLY_TRUCK)===ye.TOUCH_DOLLY_TRUCK||(this._state&ye.TOUCH_ZOOM_TRUCK)===ye.TOUCH_ZOOM_TRUCK)&&(this._truckInternal(T,S,!1),this._isUserControllingTruck=!0),((this._state&ye.OFFSET)===ye.OFFSET||(this._state&ye.TOUCH_OFFSET)===ye.TOUCH_OFFSET||(this._state&ye.TOUCH_DOLLY_OFFSET)===ye.TOUCH_DOLLY_OFFSET||(this._state&ye.TOUCH_ZOOM_OFFSET)===ye.TOUCH_ZOOM_OFFSET)&&(this._truckInternal(T,S,!0),this._isUserControllingOffset=!0),this.dispatchEvent({type:"control"})},g=()=>{Vv(this._activePointers,pi),r.copy(pi),this._dragNeedsUpdate=!1,(this._activePointers.length===0||this._activePointers.length===1&&this._activePointers[0]===this._lockedPointer)&&(this._isDragging=!1),this._activePointers.length===0&&this._domElement&&(this._domElement.ownerDocument.removeEventListener("pointermove",l,{passive:!1}),this._domElement.ownerDocument.removeEventListener("mousemove",c),this._domElement.ownerDocument.removeEventListener("pointerup",u),this._domElement.ownerDocument.removeEventListener("mouseup",h),this.dispatchEvent({type:"controlend"}))};this.lockPointer=()=>{!this._enabled||!this._domElement||(this.cancel(),this._lockedPointer={pointerId:-1,clientX:0,clientY:0,deltaX:0,deltaY:0,mouseButton:null},this._activePointers.push(this._lockedPointer),this._domElement.ownerDocument.removeEventListener("pointermove",l,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",u),this._domElement.requestPointerLock(),this._domElement.ownerDocument.addEventListener("pointerlockchange",b),this._domElement.ownerDocument.addEventListener("pointerlockerror",_),this._domElement.ownerDocument.addEventListener("pointermove",l,{passive:!1}),this._domElement.ownerDocument.addEventListener("pointerup",u),v())},this.unlockPointer=()=>{this._lockedPointer!==null&&(this._disposePointer(this._lockedPointer),this._lockedPointer=null),document.exitPointerLock(),this.cancel(),this._domElement&&(this._domElement.ownerDocument.removeEventListener("pointerlockchange",b),this._domElement.ownerDocument.removeEventListener("pointerlockerror",_))};const b=()=>{this._domElement&&this._domElement.ownerDocument.pointerLockElement===this._domElement||this.unlockPointer()},_=()=>{this.unlockPointer()};this._addAllEventListeners=y=>{this._domElement=y,this._domElement.style.touchAction="none",this._domElement.style.userSelect="none",this._domElement.style.webkitUserSelect="none",this._domElement.addEventListener("pointerdown",o),Mne&&this._domElement.addEventListener("mousedown",a),this._domElement.addEventListener("pointercancel",u),this._domElement.addEventListener("wheel",f,{passive:!1}),this._domElement.addEventListener("contextmenu",p)},this._removeAllEventListeners=()=>{this._domElement&&(this._domElement.style.touchAction="",this._domElement.style.userSelect="",this._domElement.style.webkitUserSelect="",this._domElement.removeEventListener("pointerdown",o),this._domElement.removeEventListener("mousedown",a),this._domElement.removeEventListener("pointercancel",u),this._domElement.removeEventListener("wheel",f,{passive:!1}),this._domElement.removeEventListener("contextmenu",p),this._domElement.ownerDocument.removeEventListener("pointermove",l,{passive:!1}),this._domElement.ownerDocument.removeEventListener("mousemove",c),this._domElement.ownerDocument.removeEventListener("pointerup",u),this._domElement.ownerDocument.removeEventListener("mouseup",h),this._domElement.ownerDocument.removeEventListener("pointerlockchange",b),this._domElement.ownerDocument.removeEventListener("pointerlockerror",_))},this.cancel=()=>{this._state!==ye.NONE&&(this._state=ye.NONE,this._activePointers.length=0,g())},t&&this.connect(t),this.update(0)}get camera(){return this._camera}set camera(e){this._camera=e,this.updateCameraUp(),this._camera.updateProjectionMatrix(),this._updateNearPlaneCorners(),this._needsUpdate=!0}get enabled(){return this._enabled}set enabled(e){this._enabled=e,this._domElement&&(e?(this._domElement.style.touchAction="none",this._domElement.style.userSelect="none",this._domElement.style.webkitUserSelect="none"):(this.cancel(),this._domElement.style.touchAction="",this._domElement.style.userSelect="",this._domElement.style.webkitUserSelect=""))}get active(){return!this._hasRested}get currentAction(){return this._state}get distance(){return this._spherical.radius}set distance(e){this._spherical.radius===e&&this._sphericalEnd.radius===e||(this._spherical.radius=e,this._sphericalEnd.radius=e,this._needsUpdate=!0)}get azimuthAngle(){return this._spherical.theta}set azimuthAngle(e){this._spherical.theta===e&&this._sphericalEnd.theta===e||(this._spherical.theta=e,this._sphericalEnd.theta=e,this._needsUpdate=!0)}get polarAngle(){return this._spherical.phi}set polarAngle(e){this._spherical.phi===e&&this._sphericalEnd.phi===e||(this._spherical.phi=e,this._sphericalEnd.phi=e,this._needsUpdate=!0)}get boundaryEnclosesCamera(){return this._boundaryEnclosesCamera}set boundaryEnclosesCamera(e){this._boundaryEnclosesCamera=e,this._needsUpdate=!0}set interactiveArea(e){this._interactiveArea.width=yr(e.width,0,1),this._interactiveArea.height=yr(e.height,0,1),this._interactiveArea.x=yr(e.x,0,1-this._interactiveArea.width),this._interactiveArea.y=yr(e.y,0,1-this._interactiveArea.height)}addEventListener(e,t){super.addEventListener(e,t)}removeEventListener(e,t){super.removeEventListener(e,t)}rotate(e,t,i=!1){return this.rotateTo(this._sphericalEnd.theta+e,this._sphericalEnd.phi+t,i)}rotateAzimuthTo(e,t=!1){return this.rotateTo(e,this._sphericalEnd.phi,t)}rotatePolarTo(e,t=!1){return this.rotateTo(this._sphericalEnd.theta,e,t)}rotateTo(e,t,i=!1){this._isUserControllingRotate=!1;const r=yr(e,this.minAzimuthAngle,this.maxAzimuthAngle),s=yr(t,this.minPolarAngle,this.maxPolarAngle);this._sphericalEnd.theta=r,this._sphericalEnd.phi=s,this._sphericalEnd.makeSafe(),this._needsUpdate=!0,i||(this._spherical.theta=this._sphericalEnd.theta,this._spherical.phi=this._sphericalEnd.phi);const o=!i||Lt(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&Lt(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold);return this._createOnRestPromise(o)}dolly(e,t=!1){return this.dollyTo(this._sphericalEnd.radius-e,t)}dollyTo(e,t=!1){return this._isUserControllingDolly=!1,this._lastDollyDirection=Hl.NONE,this._changedDolly=0,this._dollyToNoClamp(yr(e,this.minDistance,this.maxDistance),t)}_dollyToNoClamp(e,t=!1){const i=this._sphericalEnd.radius;if(this.colliderMeshes.length>=1){const s=this._collisionTest(),o=Lt(s,this._spherical.radius);if(!(i>e)&&o)return Promise.resolve();this._sphericalEnd.radius=Math.min(e,s)}else this._sphericalEnd.radius=e;this._needsUpdate=!0,t||(this._spherical.radius=this._sphericalEnd.radius);const r=!t||Lt(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(r)}dollyInFixed(e,t=!1){this._targetEnd.add(this._getCameraDirection(Lu).multiplyScalar(e)),t||this._target.copy(this._targetEnd);const i=!t||Lt(this._target.x,this._targetEnd.x,this.restThreshold)&&Lt(this._target.y,this._targetEnd.y,this.restThreshold)&&Lt(this._target.z,this._targetEnd.z,this.restThreshold);return this._createOnRestPromise(i)}zoom(e,t=!1){return this.zoomTo(this._zoomEnd+e,t)}zoomTo(e,t=!1){this._isUserControllingZoom=!1,this._zoomEnd=yr(e,this.minZoom,this.maxZoom),this._needsUpdate=!0,t||(this._zoom=this._zoomEnd);const i=!t||Lt(this._zoom,this._zoomEnd,this.restThreshold);return this._changedZoom=0,this._createOnRestPromise(i)}pan(e,t,i=!1){return console.warn("`pan` has been renamed to `truck`"),this.truck(e,t,i)}truck(e,t,i=!1){this._camera.updateMatrix(),Vr.setFromMatrixColumn(this._camera.matrix,0),Hr.setFromMatrixColumn(this._camera.matrix,1),Vr.multiplyScalar(e),Hr.multiplyScalar(-t);const r=at.copy(Vr).add(Hr),s=Pt.copy(this._targetEnd).add(r);return this.moveTo(s.x,s.y,s.z,i)}forward(e,t=!1){at.setFromMatrixColumn(this._camera.matrix,0),at.crossVectors(this._camera.up,at),at.multiplyScalar(e);const i=Pt.copy(this._targetEnd).add(at);return this.moveTo(i.x,i.y,i.z,t)}elevate(e,t=!1){return at.copy(this._camera.up).multiplyScalar(e),this.moveTo(this._targetEnd.x+at.x,this._targetEnd.y+at.y,this._targetEnd.z+at.z,t)}moveTo(e,t,i,r=!1){this._isUserControllingTruck=!1;const s=at.set(e,t,i).sub(this._targetEnd);this._encloseToBoundary(this._targetEnd,s,this.boundaryFriction),this._needsUpdate=!0,r||this._target.copy(this._targetEnd);const o=!r||Lt(this._target.x,this._targetEnd.x,this.restThreshold)&&Lt(this._target.y,this._targetEnd.y,this.restThreshold)&&Lt(this._target.z,this._targetEnd.z,this.restThreshold);return this._createOnRestPromise(o)}lookInDirectionOf(e,t,i,r=!1){const s=at.set(e,t,i).sub(this._targetEnd).normalize().multiplyScalar(-this._sphericalEnd.radius);return this.setPosition(s.x,s.y,s.z,r)}fitToBox(e,t,{cover:i=!1,paddingLeft:r=0,paddingRight:s=0,paddingBottom:o=0,paddingTop:a=0}={}){const l=[],c=e.isBox3?$l.copy(e):$l.setFromObject(e);c.isEmpty()&&(console.warn("camera-controls: fitTo() cannot be used with an empty box. Aborting"),Promise.resolve());const u=KE(this._sphericalEnd.theta,qE),h=KE(this._sphericalEnd.phi,qE);l.push(this.rotateTo(u,h,t));const d=at.setFromSpherical(this._sphericalEnd).normalize(),f=nT.setFromUnitVectors(d,Gv),p=Lt(Math.abs(d.y),1);p&&f.multiply($v.setFromAxisAngle(Zf,u)),f.multiply(this._yAxisUpSpaceInverse);const v=tT.makeEmpty();Pt.copy(c.min).applyQuaternion(f),v.expandByPoint(Pt),Pt.copy(c.min).setX(c.max.x).applyQuaternion(f),v.expandByPoint(Pt),Pt.copy(c.min).setY(c.max.y).applyQuaternion(f),v.expandByPoint(Pt),Pt.copy(c.max).setZ(c.min.z).applyQuaternion(f),v.expandByPoint(Pt),Pt.copy(c.min).setZ(c.max.z).applyQuaternion(f),v.expandByPoint(Pt),Pt.copy(c.max).setY(c.min.y).applyQuaternion(f),v.expandByPoint(Pt),Pt.copy(c.max).setX(c.min.x).applyQuaternion(f),v.expandByPoint(Pt),Pt.copy(c.max).applyQuaternion(f),v.expandByPoint(Pt),v.min.x-=r,v.min.y-=o,v.max.x+=s,v.max.y+=a,f.setFromUnitVectors(Gv,d),p&&f.premultiply($v.invert()),f.premultiply(this._yAxisUpSpace);const m=v.getSize(at),g=v.getCenter(Pt).applyQuaternion(f);if(ua(this._camera)){const b=this.getDistanceToFitBox(m.x,m.y,m.z,i);l.push(this.moveTo(g.x,g.y,g.z,t)),l.push(this.dollyTo(b,t)),l.push(this.setFocalOffset(0,0,0,t))}else if(uo(this._camera)){const b=this._camera,_=b.right-b.left,y=b.top-b.bottom,T=i?Math.max(_/m.x,y/m.y):Math.min(_/m.x,y/m.y);l.push(this.moveTo(g.x,g.y,g.z,t)),l.push(this.zoomTo(T,t)),l.push(this.setFocalOffset(0,0,0,t))}return Promise.all(l)}fitToSphere(e,t){const i=[],r=e instanceof Ye.Sphere?Wv.copy(e):nd.createBoundingSphere(e,Wv);if(i.push(this.moveTo(r.center.x,r.center.y,r.center.z,t)),ua(this._camera)){const s=this.getDistanceToFitSphere(r.radius);i.push(this.dollyTo(s,t))}else if(uo(this._camera)){const s=this._camera.right-this._camera.left,o=this._camera.top-this._camera.bottom,a=2*r.radius,l=Math.min(s/a,o/a);i.push(this.zoomTo(l,t))}return i.push(this.setFocalOffset(0,0,0,t)),Promise.all(i)}setLookAt(e,t,i,r,s,o,a=!1){this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._lastDollyDirection=Hl.NONE,this._changedDolly=0;const l=Pt.set(r,s,o),c=at.set(e,t,i);this._targetEnd.copy(l),this._sphericalEnd.setFromVector3(c.sub(l).applyQuaternion(this._yAxisUpSpace)),this.normalizeRotations(),this._needsUpdate=!0,a||(this._target.copy(this._targetEnd),this._spherical.copy(this._sphericalEnd));const u=!a||Lt(this._target.x,this._targetEnd.x,this.restThreshold)&&Lt(this._target.y,this._targetEnd.y,this.restThreshold)&&Lt(this._target.z,this._targetEnd.z,this.restThreshold)&&Lt(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&Lt(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold)&&Lt(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(u)}lerpLookAt(e,t,i,r,s,o,a,l,c,u,h,d,f,p=!1){this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._lastDollyDirection=Hl.NONE,this._changedDolly=0;const v=at.set(r,s,o),m=Pt.set(e,t,i);Ki.setFromVector3(m.sub(v).applyQuaternion(this._yAxisUpSpace));const g=Wl.set(u,h,d),b=Pt.set(a,l,c);Ou.setFromVector3(b.sub(g).applyQuaternion(this._yAxisUpSpace)),this._targetEnd.copy(v.lerp(g,f));const _=Ou.theta-Ki.theta,y=Ou.phi-Ki.phi,T=Ou.radius-Ki.radius;this._sphericalEnd.set(Ki.radius+T*f,Ki.phi+y*f,Ki.theta+_*f),this.normalizeRotations(),this._needsUpdate=!0,p||(this._target.copy(this._targetEnd),this._spherical.copy(this._sphericalEnd));const S=!p||Lt(this._target.x,this._targetEnd.x,this.restThreshold)&&Lt(this._target.y,this._targetEnd.y,this.restThreshold)&&Lt(this._target.z,this._targetEnd.z,this.restThreshold)&&Lt(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&Lt(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold)&&Lt(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(S)}setPosition(e,t,i,r=!1){return this.setLookAt(e,t,i,this._targetEnd.x,this._targetEnd.y,this._targetEnd.z,r)}setTarget(e,t,i,r=!1){const s=this.getPosition(at),o=this.setLookAt(s.x,s.y,s.z,e,t,i,r);return this._sphericalEnd.phi=yr(this._sphericalEnd.phi,this.minPolarAngle,this.maxPolarAngle),o}setFocalOffset(e,t,i,r=!1){this._isUserControllingOffset=!1,this._focalOffsetEnd.set(e,t,i),this._needsUpdate=!0,r||this._focalOffset.copy(this._focalOffsetEnd);const s=!r||Lt(this._focalOffset.x,this._focalOffsetEnd.x,this.restThreshold)&&Lt(this._focalOffset.y,this._focalOffsetEnd.y,this.restThreshold)&&Lt(this._focalOffset.z,this._focalOffsetEnd.z,this.restThreshold);return this._createOnRestPromise(s)}setOrbitPoint(e,t,i){this._camera.updateMatrixWorld(),Vr.setFromMatrixColumn(this._camera.matrixWorldInverse,0),Hr.setFromMatrixColumn(this._camera.matrixWorldInverse,1),ha.setFromMatrixColumn(this._camera.matrixWorldInverse,2);const r=at.set(e,t,i),s=r.distanceTo(this._camera.position),o=r.sub(this._camera.position);Vr.multiplyScalar(o.x),Hr.multiplyScalar(o.y),ha.multiplyScalar(o.z),at.copy(Vr).add(Hr).add(ha),at.z=at.z+s,this.dollyTo(s,!1),this.setFocalOffset(-at.x,at.y,-at.z,!1),this.moveTo(e,t,i,!1)}setBoundary(e){if(!e){this._boundary.min.set(-1/0,-1/0,-1/0),this._boundary.max.set(1/0,1/0,1/0),this._needsUpdate=!0;return}this._boundary.copy(e),this._boundary.clampPoint(this._targetEnd,this._targetEnd),this._needsUpdate=!0}setViewport(e,t,i,r){if(e===null){this._viewport=null;return}this._viewport=this._viewport||new Ye.Vector4,typeof e=="number"?this._viewport.set(e,t,i,r):this._viewport.copy(e)}getDistanceToFitBox(e,t,i,r=!1){if(Hv(this._camera,"getDistanceToFitBox"))return this._spherical.radius;const s=e/t,o=this._camera.getEffectiveFOV()*Cu,a=this._camera.aspect;return((r?s>a:s<a)?t:e/a)*.5/Math.tan(o*.5)+i*.5}getDistanceToFitSphere(e){if(Hv(this._camera,"getDistanceToFitSphere"))return this._spherical.radius;const t=this._camera.getEffectiveFOV()*Cu,i=Math.atan(Math.tan(t*.5)*this._camera.aspect)*2,r=1<this._camera.aspect?t:i;return e/Math.sin(r*.5)}getTarget(e,t=!0){return(e&&e.isVector3?e:new Ye.Vector3).copy(t?this._targetEnd:this._target)}getPosition(e,t=!0){return(e&&e.isVector3?e:new Ye.Vector3).setFromSpherical(t?this._sphericalEnd:this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).add(t?this._targetEnd:this._target)}getSpherical(e,t=!0){return(e&&e instanceof Ye.Spherical?e:new Ye.Spherical).copy(t?this._sphericalEnd:this._spherical)}getFocalOffset(e,t=!0){return(e&&e.isVector3?e:new Ye.Vector3).copy(t?this._focalOffsetEnd:this._focalOffset)}normalizeRotations(){this._sphericalEnd.theta=this._sphericalEnd.theta%Gl,this._sphericalEnd.theta<0&&(this._sphericalEnd.theta+=Gl),this._spherical.theta+=Gl*Math.round((this._sphericalEnd.theta-this._spherical.theta)/Gl)}reset(e=!1){if(!Lt(this._camera.up.x,this._cameraUp0.x)||!Lt(this._camera.up.y,this._cameraUp0.y)||!Lt(this._camera.up.z,this._cameraUp0.z)){this._camera.up.copy(this._cameraUp0);const i=this.getPosition(at);this.updateCameraUp(),this.setPosition(i.x,i.y,i.z)}const t=[this.setLookAt(this._position0.x,this._position0.y,this._position0.z,this._target0.x,this._target0.y,this._target0.z,e),this.setFocalOffset(this._focalOffset0.x,this._focalOffset0.y,this._focalOffset0.z,e),this.zoomTo(this._zoom0,e)];return Promise.all(t)}saveState(){this._cameraUp0.copy(this._camera.up),this.getTarget(this._target0),this.getPosition(this._position0),this._zoom0=this._zoom,this._focalOffset0.copy(this._focalOffset)}updateCameraUp(){this._yAxisUpSpace.setFromUnitVectors(this._camera.up,Zf),this._yAxisUpSpaceInverse.copy(this._yAxisUpSpace).invert()}applyCameraUp(){const e=at.subVectors(this._target,this._camera.position).normalize(),t=Pt.crossVectors(e,this._camera.up);this._camera.up.crossVectors(t,e).normalize(),this._camera.updateMatrixWorld();const i=this.getPosition(at);this.updateCameraUp(),this.setPosition(i.x,i.y,i.z)}update(e){const t=this._sphericalEnd.theta-this._spherical.theta,i=this._sphericalEnd.phi-this._spherical.phi,r=this._sphericalEnd.radius-this._spherical.radius,s=QE.subVectors(this._targetEnd,this._target),o=eT.subVectors(this._focalOffsetEnd,this._focalOffset),a=this._zoomEnd-this._zoom;if(zt(t))this._thetaVelocity.value=0,this._spherical.theta=this._sphericalEnd.theta;else{const u=this._isUserControllingRotate?this.draggingSmoothTime:this.smoothTime;this._spherical.theta=qf(this._spherical.theta,this._sphericalEnd.theta,this._thetaVelocity,u,1/0,e),this._needsUpdate=!0}if(zt(i))this._phiVelocity.value=0,this._spherical.phi=this._sphericalEnd.phi;else{const u=this._isUserControllingRotate?this.draggingSmoothTime:this.smoothTime;this._spherical.phi=qf(this._spherical.phi,this._sphericalEnd.phi,this._phiVelocity,u,1/0,e),this._needsUpdate=!0}if(zt(r))this._radiusVelocity.value=0,this._spherical.radius=this._sphericalEnd.radius;else{const u=this._isUserControllingDolly?this.draggingSmoothTime:this.smoothTime;this._spherical.radius=qf(this._spherical.radius,this._sphericalEnd.radius,this._radiusVelocity,u,this.maxSpeed,e),this._needsUpdate=!0}if(zt(s.x)&&zt(s.y)&&zt(s.z))this._targetVelocity.set(0,0,0),this._target.copy(this._targetEnd);else{const u=this._isUserControllingTruck?this.draggingSmoothTime:this.smoothTime;ZE(this._target,this._targetEnd,this._targetVelocity,u,this.maxSpeed,e,this._target),this._needsUpdate=!0}if(zt(o.x)&&zt(o.y)&&zt(o.z))this._focalOffsetVelocity.set(0,0,0),this._focalOffset.copy(this._focalOffsetEnd);else{const u=this._isUserControllingOffset?this.draggingSmoothTime:this.smoothTime;ZE(this._focalOffset,this._focalOffsetEnd,this._focalOffsetVelocity,u,this.maxSpeed,e,this._focalOffset),this._needsUpdate=!0}if(zt(a))this._zoomVelocity.value=0,this._zoom=this._zoomEnd;else{const u=this._isUserControllingZoom?this.draggingSmoothTime:this.smoothTime;this._zoom=qf(this._zoom,this._zoomEnd,this._zoomVelocity,u,1/0,e)}if(this.dollyToCursor){if(ua(this._camera)&&this._changedDolly!==0){const u=this._spherical.radius-this._lastDistance,h=this._camera,d=this._getCameraDirection(Lu),f=at.copy(d).cross(h.up).normalize();f.lengthSq()===0&&(f.x=1);const p=Pt.crossVectors(f,d),v=this._sphericalEnd.radius*Math.tan(h.getEffectiveFOV()*Cu*.5),m=(this._sphericalEnd.radius-u-this._sphericalEnd.radius)/this._sphericalEnd.radius,g=Wl.copy(this._targetEnd).add(f.multiplyScalar(this._dollyControlCoord.x*v*h.aspect)).add(p.multiplyScalar(this._dollyControlCoord.y*v)),b=at.copy(this._targetEnd).lerp(g,m),_=this._lastDollyDirection===Hl.IN&&this._spherical.radius<=this.minDistance,y=this._lastDollyDirection===Hl.OUT&&this.maxDistance<=this._spherical.radius;if(this.infinityDolly&&(_||y)){this._sphericalEnd.radius-=u,this._spherical.radius-=u;const S=Pt.copy(d).multiplyScalar(-u);b.add(S)}this._boundary.clampPoint(b,b);const T=Pt.subVectors(b,this._targetEnd);this._targetEnd.copy(b),this._target.add(T),this._changedDolly-=u,zt(this._changedDolly)&&(this._changedDolly=0)}else if(uo(this._camera)&&this._changedZoom!==0){const u=this._zoom-this._lastZoom,h=this._camera,d=at.set(this._dollyControlCoord.x,this._dollyControlCoord.y,(h.near+h.far)/(h.near-h.far)).unproject(h),f=Pt.set(0,0,-1).applyQuaternion(h.quaternion),p=Wl.copy(d).add(f.multiplyScalar(-d.dot(h.up))),v=-(this._zoom-u-this._zoom)/this._zoom,m=this._getCameraDirection(Lu),g=this._targetEnd.dot(m),b=at.copy(this._targetEnd).lerp(p,v),_=b.dot(m),y=m.multiplyScalar(_-g);b.sub(y),this._boundary.clampPoint(b,b);const T=Pt.subVectors(b,this._targetEnd);this._targetEnd.copy(b),this._target.add(T),this._changedZoom-=u,zt(this._changedZoom)&&(this._changedZoom=0)}}this._camera.zoom!==this._zoom&&(this._camera.zoom=this._zoom,this._camera.updateProjectionMatrix(),this._updateNearPlaneCorners(),this._needsUpdate=!0),this._dragNeedsUpdate=!0;const l=this._collisionTest();this._spherical.radius=Math.min(this._spherical.radius,l),this._spherical.makeSafe(),this._camera.position.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).add(this._target),this._camera.lookAt(this._target),(!zt(this._focalOffset.x)||!zt(this._focalOffset.y)||!zt(this._focalOffset.z))&&(this._camera.updateMatrixWorld(),Vr.setFromMatrixColumn(this._camera.matrix,0),Hr.setFromMatrixColumn(this._camera.matrix,1),ha.setFromMatrixColumn(this._camera.matrix,2),Vr.multiplyScalar(this._focalOffset.x),Hr.multiplyScalar(-this._focalOffset.y),ha.multiplyScalar(this._focalOffset.z),at.copy(Vr).add(Hr).add(ha),this._camera.position.add(at)),this._boundaryEnclosesCamera&&this._encloseToBoundary(this._camera.position.copy(this._target),at.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse),1);const c=this._needsUpdate;return c&&!this._updatedLastTime?(this._hasRested=!1,this.dispatchEvent({type:"wake"}),this.dispatchEvent({type:"update"})):c?(this.dispatchEvent({type:"update"}),zt(t,this.restThreshold)&&zt(i,this.restThreshold)&&zt(r,this.restThreshold)&&zt(s.x,this.restThreshold)&&zt(s.y,this.restThreshold)&&zt(s.z,this.restThreshold)&&zt(o.x,this.restThreshold)&&zt(o.y,this.restThreshold)&&zt(o.z,this.restThreshold)&&zt(a,this.restThreshold)&&!this._hasRested&&(this._hasRested=!0,this.dispatchEvent({type:"rest"}))):!c&&this._updatedLastTime&&this.dispatchEvent({type:"sleep"}),this._lastDistance=this._spherical.radius,this._lastZoom=this._zoom,this._updatedLastTime=c,this._needsUpdate=!1,c}toJSON(){return JSON.stringify({enabled:this._enabled,minDistance:this.minDistance,maxDistance:Pu(this.maxDistance),minZoom:this.minZoom,maxZoom:Pu(this.maxZoom),minPolarAngle:this.minPolarAngle,maxPolarAngle:Pu(this.maxPolarAngle),minAzimuthAngle:Pu(this.minAzimuthAngle),maxAzimuthAngle:Pu(this.maxAzimuthAngle),smoothTime:this.smoothTime,draggingSmoothTime:this.draggingSmoothTime,dollySpeed:this.dollySpeed,truckSpeed:this.truckSpeed,dollyToCursor:this.dollyToCursor,verticalDragToForward:this.verticalDragToForward,target:this._targetEnd.toArray(),position:at.setFromSpherical(this._sphericalEnd).add(this._targetEnd).toArray(),zoom:this._zoomEnd,focalOffset:this._focalOffsetEnd.toArray(),target0:this._target0.toArray(),position0:this._position0.toArray(),zoom0:this._zoom0,focalOffset0:this._focalOffset0.toArray()})}fromJSON(e,t=!1){const i=JSON.parse(e);this.enabled=i.enabled,this.minDistance=i.minDistance,this.maxDistance=Ru(i.maxDistance),this.minZoom=i.minZoom,this.maxZoom=Ru(i.maxZoom),this.minPolarAngle=i.minPolarAngle,this.maxPolarAngle=Ru(i.maxPolarAngle),this.minAzimuthAngle=Ru(i.minAzimuthAngle),this.maxAzimuthAngle=Ru(i.maxAzimuthAngle),this.smoothTime=i.smoothTime,this.draggingSmoothTime=i.draggingSmoothTime,this.dollySpeed=i.dollySpeed,this.truckSpeed=i.truckSpeed,this.dollyToCursor=i.dollyToCursor,this.verticalDragToForward=i.verticalDragToForward,this._target0.fromArray(i.target0),this._position0.fromArray(i.position0),this._zoom0=i.zoom0,this._focalOffset0.fromArray(i.focalOffset0),this.moveTo(i.target[0],i.target[1],i.target[2],t),Ki.setFromVector3(at.fromArray(i.position).sub(this._targetEnd).applyQuaternion(this._yAxisUpSpace)),this.rotateTo(Ki.theta,Ki.phi,t),this.dollyTo(Ki.radius,t),this.zoomTo(i.zoom,t),this.setFocalOffset(i.focalOffset[0],i.focalOffset[1],i.focalOffset[2],t),this._needsUpdate=!0}connect(e){if(this._domElement){console.warn("camera-controls is already connected.");return}e.setAttribute("data-camera-controls-version",wne),this._addAllEventListeners(e),this._getClientRect(this._elementRect)}disconnect(){this.cancel(),this._removeAllEventListeners(),this._domElement&&(this._domElement.removeAttribute("data-camera-controls-version"),this._domElement=void 0)}dispose(){this.removeAllEventListeners(),this.disconnect()}_getTargetDirection(e){return e.setFromSpherical(this._spherical).divideScalar(this._spherical.radius).applyQuaternion(this._yAxisUpSpaceInverse)}_getCameraDirection(e){return this._getTargetDirection(e).negate()}_findPointerById(e){return this._activePointers.find(t=>t.pointerId===e)}_findPointerByMouseButton(e){return this._activePointers.find(t=>t.mouseButton===e)}_disposePointer(e){this._activePointers.splice(this._activePointers.indexOf(e),1)}_encloseToBoundary(e,t,i){const r=t.lengthSq();if(r===0)return e;const s=Pt.copy(t).add(e),o=this._boundary.clampPoint(s,Wl).sub(s),a=o.lengthSq();if(a===0)return e.add(t);if(a===r)return e;if(i===0)return e.add(t).add(o);{const l=1+i*a/t.dot(o);return e.add(Pt.copy(t).multiplyScalar(l)).add(o.multiplyScalar(1-i))}}_updateNearPlaneCorners(){if(ua(this._camera)){const e=this._camera,t=e.near,i=e.getEffectiveFOV()*Cu,r=Math.tan(i*.5)*t,s=r*e.aspect;this._nearPlaneCorners[0].set(-s,-r,0),this._nearPlaneCorners[1].set(s,-r,0),this._nearPlaneCorners[2].set(s,r,0),this._nearPlaneCorners[3].set(-s,r,0)}else if(uo(this._camera)){const e=this._camera,t=1/e.zoom,i=e.left*t,r=e.right*t,s=e.top*t,o=e.bottom*t;this._nearPlaneCorners[0].set(i,s,0),this._nearPlaneCorners[1].set(r,s,0),this._nearPlaneCorners[2].set(r,o,0),this._nearPlaneCorners[3].set(i,o,0)}}_collisionTest(){let e=1/0;if(!(this.colliderMeshes.length>=1)||Hv(this._camera,"_collisionTest"))return e;const t=this._getTargetDirection(Lu);jv.lookAt(JE,t,this._camera.up);for(let i=0;i<4;i++){const r=Pt.copy(this._nearPlaneCorners[i]);r.applyMatrix4(jv);const s=Wl.addVectors(this._target,r);Jf.set(s,t),Jf.far=this._spherical.radius+1;const o=Jf.intersectObjects(this.colliderMeshes);o.length!==0&&o[0].distance<e&&(e=o[0].distance)}return e}_getClientRect(e){if(!this._domElement)return;const t=this._domElement.getBoundingClientRect();return e.x=t.left,e.y=t.top,this._viewport?(e.x+=this._viewport.x,e.y+=t.height-this._viewport.w-this._viewport.y,e.width=this._viewport.z,e.height=this._viewport.w):(e.width=t.width,e.height=t.height),e}_createOnRestPromise(e){return e?Promise.resolve():(this._hasRested=!1,this.dispatchEvent({type:"transitionstart"}),new Promise(t=>{const i=()=>{this.removeEventListener("rest",i),t()};this.addEventListener("rest",i)}))}_addAllEventListeners(e){}_removeAllEventListeners(){}get dampingFactor(){return console.warn(".dampingFactor has been deprecated. use smoothTime (in seconds) instead."),0}set dampingFactor(e){console.warn(".dampingFactor has been deprecated. use smoothTime (in seconds) instead.")}get draggingDampingFactor(){return console.warn(".draggingDampingFactor has been deprecated. use draggingSmoothTime (in seconds) instead."),0}set draggingDampingFactor(e){console.warn(".draggingDampingFactor has been deprecated. use draggingSmoothTime (in seconds) instead.")}static createBoundingSphere(e,t=new Ye.Sphere){const i=t,r=i.center;$l.makeEmpty(),e.traverseVisible(o=>{o.isMesh&&$l.expandByObject(o)}),$l.getCenter(r);let s=0;return e.traverseVisible(o=>{if(!o.isMesh)return;const a=o,l=a.geometry.clone();l.applyMatrix4(a.matrixWorld);const c=l.attributes.position;for(let u=0,h=c.count;u<h;u++)at.fromBufferAttribute(c,u),s=Math.max(s,r.distanceToSquared(at))}),i.radius=Math.sqrt(s),i}}const Ene=["min-polar-angle","max-polar-angle","min-azimuth-angle","max-azimuth-angle","distance","min-distance","max-distance","infinity-dolly","min-zoom","max-zoom","smooth-time","dragging-smooth-time","max-speed","azimuth-rotate-speed","polar-rotate-speed","dolly-speed","dolly-drag-inverted","truck-speed","dolly-to-cursor","drag-to-offset","vertical-drag-to-forward","boundary-friction","rest-threshold","collider-meshes","args"],qre=Xe({__name:"CameraControls",props:{makeDefault:{type:Boolean,default:!1},camera:{},domElement:{},minPolarAngle:{default:0},maxPolarAngle:{default:Math.PI},minAzimuthAngle:{default:-1/0},maxAzimuthAngle:{default:1/0},distance:{default:()=>ur().camera.value.position.z},minDistance:{default:Number.EPSILON},maxDistance:{default:1/0},infinityDolly:{type:Boolean,default:!1},minZoom:{default:.01},maxZoom:{default:1/0},smoothTime:{default:.25},draggingSmoothTime:{default:.125},maxSpeed:{default:1/0},azimuthRotateSpeed:{default:1},polarRotateSpeed:{default:1},dollySpeed:{default:1},dollyDragInverted:{type:Boolean,default:!1},truckSpeed:{default:2},dollyToCursor:{type:Boolean,default:!1},dragToOffset:{type:Boolean,default:!1},verticalDragToForward:{type:Boolean,default:!1},boundaryFriction:{default:0},restThreshold:{default:.01},colliderMeshes:{default:()=>[]},mouseButtons:{},touches:{}},emits:["change","start","end"],setup(n,{expose:e,emit:t}){const i=n,r=t,{makeDefault:s,minPolarAngle:o,maxPolarAngle:a,minAzimuthAngle:l,maxAzimuthAngle:c,distance:u,minDistance:h,maxDistance:d,infinityDolly:f,minZoom:p,maxZoom:v,smoothTime:m,draggingSmoothTime:g,maxSpeed:b,azimuthRotateSpeed:_,polarRotateSpeed:y,dollySpeed:T,dollyDragInverted:S,truckSpeed:E,dollyToCursor:x,dragToOffset:M,verticalDragToForward:w,boundaryFriction:C,restThreshold:L,colliderMeshes:$}=Or(i),U={Box3:Pi,MathUtils:{clamp:Gn.clamp},Matrix4:ze,Quaternion:gt,Raycaster:ug,Sphere:Ri,Spherical:Xh,Vector2:_e,Vector3:D,Vector4:vt};nd.install({THREE:U});const{camera:H,renderer:V,extend:j,controls:te}=ur(),Z=xe(null);j({CameraControls:nd}),ar(()=>{Q(),Z.value&&s.value?te.value=Z.value:te.value=null});function Q(){Wn(Z.value,"update",()=>r("change",Z.value)),Wn(Z.value,"controlend",()=>r("end",Z.value)),Wn(Z.value,"controlstart",()=>r("start",Z.value))}const{onLoop:X}=dr();return X(({delta:re})=>{var W,we;(W=Z.value)!=null&&W.enabled&&((we=Z.value)==null||we.update(re))}),Ci(()=>{Z.value&&Z.value.disconnect()}),e({value:Z}),(re,W)=>(re.camera||Se(H))&&(re.domElement||Se(V))?(nt(),Mt("TresCameraControls",{key:0,ref_key:"controlsRef",ref:Z,"min-polar-angle":Se(o),"max-polar-angle":Se(a),"min-azimuth-angle":Se(l),"max-azimuth-angle":Se(c),distance:Se(u),"min-distance":Se(h),"max-distance":Se(d),"infinity-dolly":Se(f),"min-zoom":Se(p),"max-zoom":Se(v),"smooth-time":Se(m),"dragging-smooth-time":Se(g),"max-speed":Se(b),"azimuth-rotate-speed":Se(_),"polar-rotate-speed":Se(y),"dolly-speed":Se(T),"dolly-drag-inverted":Se(S),"truck-speed":Se(E),"dolly-to-cursor":Se(x),"drag-to-offset":Se(M),"vertical-drag-to-forward":Se(w),"boundary-friction":Se(C),"rest-threshold":Se(L),"collider-meshes":Se($),args:[re.camera||Se(H),re.domElement||Se(V).domElement]},null,8,Ene)):Fi("",!0)}});class Tne extends ol{constructor(e={}){super(e),Sn(this,"_time"),Sn(this,"_factor"),this.setValues(e),this._time={value:0},this._factor={value:1}}onBeforeCompile(e){e.uniforms||(e.uniforms={}),e.uniforms.time=this._time,e.uniforms.factor=this._factor,e.vertexShader="\n uniform float time;\n uniform float factor;\n ".concat(e.vertexShader,"\n "),e.vertexShader=e.vertexShader.replace("#include <begin_vertex>","float theta = sin( time + position.y ) / 2.0 * factor;\n float c = cos( theta );\n float s = sin( theta );\n mat3 m = mat3( c, 0, s, 0, 1, 0, -s, 0, c );\n vec3 transformed = vec3( position ) * m;\n vNormal = vNormal * m;")}get time(){return this._time.value}set time(e){this._time.value=e}get factor(){return this._factor.value}set factor(e){this._factor.value=e}}const Ane=["factor"],Kre=Xe({__name:"index",props:{speed:{default:1},factor:{default:1}},setup(n){const e=n,t=jn(),{extend:i}=ur();i({MeshWobbleMaterial:Tne});const{onLoop:r}=dr();return r(({elapsed:s})=>{t.value&&(t.value.time=s*(e==null?void 0:e.speed))}),(s,o)=>(nt(),Mt("TresMeshWobbleMaterial",Cr({ref_key:"materialRef",ref:t,factor:s.factor},s.$attrs),null,16,Ane))}});function ya(n,e,t){return Math.max(e,Math.min(t,n))}function Cne(n,e){return(n%e+e)%e}function Xv(n,e,t){return(1-t)*n+t*e}class fx{constructor(e=0,t=0){fx.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,i=this.y,r=e.elements;return this.x=r[0]*t+r[3]*i+r[6],this.y=r[1]*t+r[4]*i+r[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const i=this.dot(e)/t;return Math.acos(ya(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,i=this.y-e.y;return t*t+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const i=Math.cos(t),r=Math.sin(t),s=this.x-e.x,o=this.y-e.y;return this.x=s*i-o*r+e.x,this.y=s*r+o*i+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}const Pne="",ho="srgb",px="srgb-linear",Rne="display-p3",pL="display-p3-linear",U_="linear",iT="srgb",rT="rec709",sT="p3";class Ad{constructor(e,t,i,r,s,o,a,l,c){Ad.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,i,r,s,o,a,l,c)}set(e,t,i,r,s,o,a,l,c){const u=this.elements;return u[0]=e,u[1]=r,u[2]=a,u[3]=t,u[4]=s,u[5]=l,u[6]=i,u[7]=o,u[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],this}extractBasis(e,t,i){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const i=e.elements,r=t.elements,s=this.elements,o=i[0],a=i[3],l=i[6],c=i[1],u=i[4],h=i[7],d=i[2],f=i[5],p=i[8],v=r[0],m=r[3],g=r[6],b=r[1],_=r[4],y=r[7],T=r[2],S=r[5],E=r[8];return s[0]=o*v+a*b+l*T,s[3]=o*m+a*_+l*S,s[6]=o*g+a*y+l*E,s[1]=c*v+u*b+h*T,s[4]=c*m+u*_+h*S,s[7]=c*g+u*y+h*E,s[2]=d*v+f*b+p*T,s[5]=d*m+f*_+p*S,s[8]=d*g+f*y+p*E,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8];return t*o*u-t*a*c-i*s*u+i*a*l+r*s*c-r*o*l}invert(){const e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8],h=u*o-a*c,d=a*l-u*s,f=c*s-o*l,p=t*h+i*d+r*f;if(p===0)return this.set(0,0,0,0,0,0,0,0,0);const v=1/p;return e[0]=h*v,e[1]=(r*c-u*i)*v,e[2]=(a*i-r*o)*v,e[3]=d*v,e[4]=(u*t-r*l)*v,e[5]=(r*s-a*t)*v,e[6]=f*v,e[7]=(i*l-c*t)*v,e[8]=(o*t-i*s)*v,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,i,r,s,o,a){const l=Math.cos(s),c=Math.sin(s);return this.set(i*l,i*c,-i*(l*o+c*a)+o+e,-r*c,r*l,-r*(-c*o+l*a)+a+t,0,0,1),this}scale(e,t){return this.premultiply(Yv.makeScale(e,t)),this}rotate(e){return this.premultiply(Yv.makeRotation(-e)),this}translate(e,t){return this.premultiply(Yv.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,i,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,i=e.elements;for(let r=0;r<9;r++)if(t[r]!==i[r])return!1;return!0}fromArray(e,t=0){for(let i=0;i<9;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){const i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const Yv=new Ad,oT=new Ad().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),aT=new Ad().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),Qf={[px]:{transfer:U_,primaries:rT,toReference:n=>n,fromReference:n=>n},[ho]:{transfer:iT,primaries:rT,toReference:n=>n.convertSRGBToLinear(),fromReference:n=>n.convertLinearToSRGB()},[pL]:{transfer:U_,primaries:sT,toReference:n=>n.applyMatrix3(aT),fromReference:n=>n.applyMatrix3(oT)},[Rne]:{transfer:iT,primaries:sT,toReference:n=>n.convertSRGBToLinear().applyMatrix3(aT),fromReference:n=>n.applyMatrix3(oT).convertLinearToSRGB()}},Lne=new Set([px,pL]),vr={enabled:!0,_workingColorSpace:px,get legacyMode(){return console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),!this.enabled},set legacyMode(n){console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),this.enabled=!n},get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(n){if(!Lne.has(n))throw new Error('Unsupported working color space, "'.concat(n,'".'));this._workingColorSpace=n},convert:function(n,e,t){if(this.enabled===!1||e===t||!e||!t)return n;const i=Qf[e].toReference,r=Qf[t].fromReference;return r(i(n))},fromWorkingColorSpace:function(n,e){return this.convert(n,this._workingColorSpace,e)},toWorkingColorSpace:function(n,e){return this.convert(n,e,this._workingColorSpace)},getPrimaries:function(n){return Qf[n].primaries},getTransfer:function(n){return n===Pne?U_:Qf[n].transfer}};function qv(n){return n<.04045?n*.0773993808:Math.pow(n*.9478672986+.0521327014,2.4)}function Kv(n){return n<.0031308?n*12.92:1.055*Math.pow(n,.41666)-.055}const mL={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},ao={h:0,s:0,l:0},ep={h:0,s:0,l:0};function Zv(n,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?n+(e-n)*6*t:t<1/2?e:t<2/3?n+(e-n)*6*(2/3-t):n}class Jp{constructor(e,t,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,i)}set(e,t,i){if(t===void 0&&i===void 0){const r=e;r&&r.isColor?this.copy(r):typeof r=="number"?this.setHex(r):typeof r=="string"&&this.setStyle(r)}else this.setRGB(e,t,i);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=ho){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,vr.toWorkingColorSpace(this,t),this}setRGB(e,t,i,r=vr.workingColorSpace){return this.r=e,this.g=t,this.b=i,vr.toWorkingColorSpace(this,r),this}setHSL(e,t,i,r=vr.workingColorSpace){if(e=Cne(e,1),t=ya(t,0,1),i=ya(i,0,1),t===0)this.r=this.g=this.b=i;else{const s=i<=.5?i*(1+t):i+t-i*t,o=2*i-s;this.r=Zv(o,s,e+1/3),this.g=Zv(o,s,e),this.b=Zv(o,s,e-1/3)}return vr.toWorkingColorSpace(this,r),this}setStyle(e,t=ho){function i(s){s!==void 0&&parseFloat(s)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const o=r[1],a=r[2];switch(o){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,t);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,t);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=r[1],o=s.length;if(o===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(o===6)return this.setHex(parseInt(s,16),t);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=ho){const i=mL[e.toLowerCase()];return i!==void 0?this.setHex(i,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=qv(e.r),this.g=qv(e.g),this.b=qv(e.b),this}copyLinearToSRGB(e){return this.r=Kv(e.r),this.g=Kv(e.g),this.b=Kv(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=ho){return vr.fromWorkingColorSpace(Kn.copy(this),e),Math.round(ya(Kn.r*255,0,255))*65536+Math.round(ya(Kn.g*255,0,255))*256+Math.round(ya(Kn.b*255,0,255))}getHexString(e=ho){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=vr.workingColorSpace){vr.fromWorkingColorSpace(Kn.copy(this),t);const i=Kn.r,r=Kn.g,s=Kn.b,o=Math.max(i,r,s),a=Math.min(i,r,s);let l,c;const u=(a+o)/2;if(a===o)l=0,c=0;else{const h=o-a;switch(c=u<=.5?h/(o+a):h/(2-o-a),o){case i:l=(r-s)/h+(r<s?6:0);break;case r:l=(s-i)/h+2;break;case s:l=(i-r)/h+4;break}l/=6}return e.h=l,e.s=c,e.l=u,e}getRGB(e,t=vr.workingColorSpace){return vr.fromWorkingColorSpace(Kn.copy(this),t),e.r=Kn.r,e.g=Kn.g,e.b=Kn.b,e}getStyle(e=ho){vr.fromWorkingColorSpace(Kn.copy(this),e);const t=Kn.r,i=Kn.g,r=Kn.b;return e!==ho?"color(".concat(e," ").concat(t.toFixed(3)," ").concat(i.toFixed(3)," ").concat(r.toFixed(3),")"):"rgb(".concat(Math.round(t*255),",").concat(Math.round(i*255),",").concat(Math.round(r*255),")")}offsetHSL(e,t,i){return this.getHSL(ao),this.setHSL(ao.h+e,ao.s+t,ao.l+i)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,i){return this.r=e.r+(t.r-e.r)*i,this.g=e.g+(t.g-e.g)*i,this.b=e.b+(t.b-e.b)*i,this}lerpHSL(e,t){this.getHSL(ao),e.getHSL(ep);const i=Xv(ao.h,ep.h,t),r=Xv(ao.s,ep.s,t),s=Xv(ao.l,ep.l,t);return this.setHSL(i,r,s),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const t=this.r,i=this.g,r=this.b,s=e.elements;return this.r=s[0]*t+s[3]*i+s[6]*r,this.g=s[1]*t+s[4]*i+s[7]*r,this.b=s[2]*t+s[5]*i+s[8]*r,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const Kn=new Jp;Jp.NAMES=mL;class One extends ol{constructor(e={}){super(),Sn(this,"isMeshPhysicalMaterial"),Sn(this,"clearcoatMap"),Sn(this,"clearcoatRoughness"),Sn(this,"clearcoatRoughnessMap"),Sn(this,"clearcoatNormalScale"),Sn(this,"clearcoatNormalMap"),Sn(this,"ior"),Sn(this,"transmissionMap"),Sn(this,"thickness"),Sn(this,"thicknessMap"),Sn(this,"attenuationDistance"),Sn(this,"attenuationColor"),Sn(this,"specularIntensity"),Sn(this,"specularIntensityMap"),Sn(this,"specularColor"),Sn(this,"specularColorMap"),Sn(this,"_clearcoat"),Sn(this,"_transmission"),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new fx(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get(){return ya(2.5*(this.ior-1)/(this.ior+1),0,1)},set(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.roughness=0,this.transmissionMap=null,this.thickness=.5,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new Jp(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new Jp(1,1,1),this.specularColorMap=null,this._clearcoat=.5,this._transmission=1,this.setValues(e)}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.ior=e.ior,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}const Ine=One,Zre=Xe({__name:"index",setup(n,{expose:e}){const t=jn(),{extend:i}=ur();return i({MeshGlassMaterial:Ine}),e({MeshGlassMaterialClass:t}),(r,s)=>(nt(),Mt("TresMeshGlassMaterial",{ref_key:"MeshGlassMaterialClass",ref:t},null,512))}});var Dne=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Cd(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}function tp(n){throw new Error('Could not dynamically require "'+n+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var gL={exports:{}};(function(n,e){(function(t){n.exports=t()})(function(){return function t(i,r,s){function o(c,u){if(!r[c]){if(!i[c]){var h=typeof tp=="function"&&tp;if(!u&&h)return h(c,!0);if(a)return a(c,!0);throw new Error("Cannot find module '"+c+"'")}u=r[c]={exports:{}},i[c][0].call(u.exports,function(d){var f=i[c][1][d];return o(f||d)},u,u.exports,t,i,r,s)}return r[c].exports}for(var a=typeof tp=="function"&&tp,l=0;l<s.length;l++)o(s[l]);return o}({1:[function(t,i,r){(function(s,o,a,l,c,u,h,d,f){var p=t("crypto");function v(S,E){E=b(S,E);var x;return(x=E.algorithm!=="passthrough"?p.createHash(E.algorithm):new T).write===void 0&&(x.write=x.update,x.end=x.update),y(E,x).dispatch(S),x.update||x.end(""),x.digest?x.digest(E.encoding==="buffer"?void 0:E.encoding):(S=x.read(),E.encoding!=="buffer"?S.toString(E.encoding):S)}(r=i.exports=v).sha1=function(S){return v(S)},r.keys=function(S){return v(S,{excludeValues:!0,algorithm:"sha1",encoding:"hex"})},r.MD5=function(S){return v(S,{algorithm:"md5",encoding:"hex"})},r.keysMD5=function(S){return v(S,{algorithm:"md5",encoding:"hex",excludeValues:!0})};var m=p.getHashes?p.getHashes().slice():["sha1","md5"],g=(m.push("passthrough"),["buffer","hex","binary","base64"]);function b(S,E){var x={};if(x.algorithm=(E=E||{}).algorithm||"sha1",x.encoding=E.encoding||"hex",x.excludeValues=!!E.excludeValues,x.algorithm=x.algorithm.toLowerCase(),x.encoding=x.encoding.toLowerCase(),x.ignoreUnknown=E.ignoreUnknown===!0,x.respectType=E.respectType!==!1,x.respectFunctionNames=E.respectFunctionNames!==!1,x.respectFunctionProperties=E.respectFunctionProperties!==!1,x.unorderedArrays=E.unorderedArrays===!0,x.unorderedSets=E.unorderedSets!==!1,x.unorderedObjects=E.unorderedObjects!==!1,x.replacer=E.replacer||void 0,x.excludeKeys=E.excludeKeys||void 0,S===void 0)throw new Error("Object argument required.");for(var M=0;M<m.length;++M)m[M].toLowerCase()===x.algorithm.toLowerCase()&&(x.algorithm=m[M]);if(m.indexOf(x.algorithm)===-1)throw new Error('Algorithm "'+x.algorithm+'" not supported. supported values: '+m.join(", "));if(g.indexOf(x.encoding)===-1&&x.algorithm!=="passthrough")throw new Error('Encoding "'+x.encoding+'" not supported. supported values: '+g.join(", "));return x}function _(S){if(typeof S=="function")return/^function\s+\w*\s*\(\s*\)\s*{\s+\[native code\]\s+}$/i.exec(Function.prototype.toString.call(S))!=null}function y(S,E,x){x=x||[];function M(w){return E.update?E.update(w,"utf8"):E.write(w,"utf8")}return{dispatch:function(w){return this["_"+((w=S.replacer?S.replacer(w):w)===null?"null":typeof w)](w)},_object:function(w){var C,L=Object.prototype.toString.call(w),$=/\[object (.*)\]/i.exec(L);if($=($=$?$[1]:"unknown:["+L+"]").toLowerCase(),0<=(L=x.indexOf(w)))return this.dispatch("[CIRCULAR:"+L+"]");if(x.push(w),a!==void 0&&a.isBuffer&&a.isBuffer(w))return M("buffer:"),M(w);if($==="object"||$==="function"||$==="asyncfunction")return L=Object.keys(w),S.unorderedObjects&&(L=L.sort()),S.respectType===!1||_(w)||L.splice(0,0,"prototype","__proto__","constructor"),S.excludeKeys&&(L=L.filter(function(U){return!S.excludeKeys(U)})),M("object:"+L.length+":"),C=this,L.forEach(function(U){C.dispatch(U),M(":"),S.excludeValues||C.dispatch(w[U]),M(",")});if(!this["_"+$]){if(S.ignoreUnknown)return M("["+$+"]");throw new Error('Unknown object type "'+$+'"')}this["_"+$](w)},_array:function(w,U){U=U!==void 0?U:S.unorderedArrays!==!1;var L=this;if(M("array:"+w.length+":"),!U||w.length<=1)return w.forEach(function(H){return L.dispatch(H)});var $=[],U=w.map(function(H){var V=new T,j=x.slice();return y(S,V,j).dispatch(H),$=$.concat(j.slice(x.length)),V.read().toString()});return x=x.concat($),U.sort(),this._array(U,!1)},_date:function(w){return M("date:"+w.toJSON())},_symbol:function(w){return M("symbol:"+w.toString())},_error:function(w){return M("error:"+w.toString())},_boolean:function(w){return M("bool:"+w.toString())},_string:function(w){M("string:"+w.length+":"),M(w.toString())},_function:function(w){M("fn:"),_(w)?this.dispatch("[native]"):this.dispatch(w.toString()),S.respectFunctionNames!==!1&&this.dispatch("function-name:"+String(w.name)),S.respectFunctionProperties&&this._object(w)},_number:function(w){return M("number:"+w.toString())},_xml:function(w){return M("xml:"+w.toString())},_null:function(){return M("Null")},_undefined:function(){return M("Undefined")},_regexp:function(w){return M("regex:"+w.toString())},_uint8array:function(w){return M("uint8array:"),this.dispatch(Array.prototype.slice.call(w))},_uint8clampedarray:function(w){return M("uint8clampedarray:"),this.dispatch(Array.prototype.slice.call(w))},_int8array:function(w){return M("int8array:"),this.dispatch(Array.prototype.slice.call(w))},_uint16array:function(w){return M("uint16array:"),this.dispatch(Array.prototype.slice.call(w))},_int16array:function(w){return M("int16array:"),this.dispatch(Array.prototype.slice.call(w))},_uint32array:function(w){return M("uint32array:"),this.dispatch(Array.prototype.slice.call(w))},_int32array:function(w){return M("int32array:"),this.dispatch(Array.prototype.slice.call(w))},_float32array:function(w){return M("float32array:"),this.dispatch(Array.prototype.slice.call(w))},_float64array:function(w){return M("float64array:"),this.dispatch(Array.prototype.slice.call(w))},_arraybuffer:function(w){return M("arraybuffer:"),this.dispatch(new Uint8Array(w))},_url:function(w){return M("url:"+w.toString())},_map:function(w){return M("map:"),w=Array.from(w),this._array(w,S.unorderedSets!==!1)},_set:function(w){return M("set:"),w=Array.from(w),this._array(w,S.unorderedSets!==!1)},_file:function(w){return M("file:"),this.dispatch([w.name,w.size,w.type,w.lastModfied])},_blob:function(){if(S.ignoreUnknown)return M("[blob]");throw Error('Hashing Blob objects is currently not supported\n(see https://github.com/puleos/object-hash/issues/26)\nUse "options.replacer" or "options.ignoreUnknown"\n')},_domwindow:function(){return M("domwindow")},_bigint:function(w){return M("bigint:"+w.toString())},_process:function(){return M("process")},_timer:function(){return M("timer")},_pipe:function(){return M("pipe")},_tcp:function(){return M("tcp")},_udp:function(){return M("udp")},_tty:function(){return M("tty")},_statwatcher:function(){return M("statwatcher")},_securecontext:function(){return M("securecontext")},_connection:function(){return M("connection")},_zlib:function(){return M("zlib")},_context:function(){return M("context")},_nodescript:function(){return M("nodescript")},_httpparser:function(){return M("httpparser")},_dataview:function(){return M("dataview")},_signal:function(){return M("signal")},_fsevent:function(){return M("fsevent")},_tlswrap:function(){return M("tlswrap")}}}function T(){return{buf:"",write:function(S){this.buf+=S},end:function(S){this.buf+=S},read:function(){return this.buf}}}r.writeToStream=function(S,E,x){return x===void 0&&(x=E,E={}),y(E=b(S,E),x).dispatch(S)}}).call(this,t("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/fake_9a5aa49d.js","/")},{buffer:3,crypto:5,lYpoI2:11}],2:[function(t,i,r){(function(s,o,a,l,c,u,h,d,f){(function(p){var v=typeof Uint8Array<"u"?Uint8Array:Array,m="+".charCodeAt(0),g="/".charCodeAt(0),b="0".charCodeAt(0),_="a".charCodeAt(0),y="A".charCodeAt(0),T="-".charCodeAt(0),S="_".charCodeAt(0);function E(x){return x=x.charCodeAt(0),x===m||x===T?62:x===g||x===S?63:x<b?-1:x<b+10?x-b+26+26:x<y+26?x-y:x<_+26?x-_+26:void 0}p.toByteArray=function(x){var M,w;if(0<x.length%4)throw new Error("Invalid string. Length must be a multiple of 4");var C=x.length,C=x.charAt(C-2)==="="?2:x.charAt(C-1)==="="?1:0,L=new v(3*x.length/4-C),$=0<C?x.length-4:x.length,U=0;function H(V){L[U++]=V}for(M=0;M<$;M+=4,0)H((16711680&(w=E(x.charAt(M))<<18|E(x.charAt(M+1))<<12|E(x.charAt(M+2))<<6|E(x.charAt(M+3))))>>16),H((65280&w)>>8),H(255&w);return C==2?H(255&(w=E(x.charAt(M))<<2|E(x.charAt(M+1))>>4)):C==1&&(H((w=E(x.charAt(M))<<10|E(x.charAt(M+1))<<4|E(x.charAt(M+2))>>2)>>8&255),H(255&w)),L},p.fromByteArray=function(x){var M,w,C,L,$=x.length%3,U="";function H(V){return"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(V)}for(M=0,C=x.length-$;M<C;M+=3)w=(x[M]<<16)+(x[M+1]<<8)+x[M+2],U+=H((L=w)>>18&63)+H(L>>12&63)+H(L>>6&63)+H(63&L);switch($){case 1:U=(U+=H((w=x[x.length-1])>>2))+H(w<<4&63)+"==";break;case 2:U=(U=(U+=H((w=(x[x.length-2]<<8)+x[x.length-1])>>10))+H(w>>4&63))+H(w<<2&63)+"="}return U}})(r===void 0?this.base64js={}:r)}).call(this,t("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/base64-js/lib/b64.js","/node_modules/gulp-browserify/node_modules/base64-js/lib")},{buffer:3,lYpoI2:11}],3:[function(t,i,r){(function(s,o,m,l,c,u,h,d,f){var p=t("base64-js"),v=t("ieee754");function m(P,N,B){if(!(this instanceof m))return new m(P,N,B);var A,R,I,z,G=typeof P;if(N==="base64"&&G=="string")for(P=(z=P).trim?z.trim():z.replace(/^\s+|\s+$/g,"");P.length%4!=0;)P+="=";if(G=="number")A=te(P);else if(G=="string")A=m.byteLength(P,N);else{if(G!="object")throw new Error("First argument needs to be a number, array or string.");A=te(P.length)}if(m._useTypedArrays?R=m._augment(new Uint8Array(A)):((R=this).length=A,R._isBuffer=!0),m._useTypedArrays&&typeof P.byteLength=="number")R._set(P);else if(Z(z=P)||m.isBuffer(z)||z&&typeof z=="object"&&typeof z.length=="number")for(I=0;I<A;I++)m.isBuffer(P)?R[I]=P.readUInt8(I):R[I]=P[I];else if(G=="string")R.write(P,0,N);else if(G=="number"&&!m._useTypedArrays&&!B)for(I=0;I<A;I++)R[I]=0;return R}function g(P,N,B,A){return m._charsWritten=W(function(R){for(var I=[],z=0;z<R.length;z++)I.push(255&R.charCodeAt(z));return I}(N),P,B,A)}function b(P,N,B,A){return m._charsWritten=W(function(R){for(var I,z,G=[],ee=0;ee<R.length;ee++)z=R.charCodeAt(ee),I=z>>8,z=z%256,G.push(z),G.push(I);return G}(N),P,B,A)}function _(P,N,B){var A="";B=Math.min(P.length,B);for(var R=N;R<B;R++)A+=String.fromCharCode(P[R]);return A}function y(P,N,B,I){I||(q(typeof B=="boolean","missing or invalid endian"),q(N!=null,"missing offset"),q(N+1<P.length,"Trying to read beyond buffer length"));var R,I=P.length;if(!(I<=N))return B?(R=P[N],N+1<I&&(R|=P[N+1]<<8)):(R=P[N]<<8,N+1<I&&(R|=P[N+1])),R}function T(P,N,B,I){I||(q(typeof B=="boolean","missing or invalid endian"),q(N!=null,"missing offset"),q(N+3<P.length,"Trying to read beyond buffer length"));var R,I=P.length;if(!(I<=N))return B?(N+2<I&&(R=P[N+2]<<16),N+1<I&&(R|=P[N+1]<<8),R|=P[N],N+3<I&&(R+=P[N+3]<<24>>>0)):(N+1<I&&(R=P[N+1]<<16),N+2<I&&(R|=P[N+2]<<8),N+3<I&&(R|=P[N+3]),R+=P[N]<<24>>>0),R}function S(P,N,B,A){if(A||(q(typeof B=="boolean","missing or invalid endian"),q(N!=null,"missing offset"),q(N+1<P.length,"Trying to read beyond buffer length")),!(P.length<=N))return A=y(P,N,B,!0),32768&A?-1*(65535-A+1):A}function E(P,N,B,A){if(A||(q(typeof B=="boolean","missing or invalid endian"),q(N!=null,"missing offset"),q(N+3<P.length,"Trying to read beyond buffer length")),!(P.length<=N))return A=T(P,N,B,!0),2147483648&A?-1*(4294967295-A+1):A}function x(P,N,B,A){return A||(q(typeof B=="boolean","missing or invalid endian"),q(N+3<P.length,"Trying to read beyond buffer length")),v.read(P,N,B,23,4)}function M(P,N,B,A){return A||(q(typeof B=="boolean","missing or invalid endian"),q(N+7<P.length,"Trying to read beyond buffer length")),v.read(P,N,B,52,8)}function w(P,N,B,A,R){if(R||(q(N!=null,"missing value"),q(typeof A=="boolean","missing or invalid endian"),q(B!=null,"missing offset"),q(B+1<P.length,"trying to write beyond buffer length"),Re(N,65535)),R=P.length,!(R<=B))for(var I=0,z=Math.min(R-B,2);I<z;I++)P[B+I]=(N&255<<8*(A?I:1-I))>>>8*(A?I:1-I)}function C(P,N,B,A,R){if(R||(q(N!=null,"missing value"),q(typeof A=="boolean","missing or invalid endian"),q(B!=null,"missing offset"),q(B+3<P.length,"trying to write beyond buffer length"),Re(N,4294967295)),R=P.length,!(R<=B))for(var I=0,z=Math.min(R-B,4);I<z;I++)P[B+I]=N>>>8*(A?I:3-I)&255}function L(P,N,B,A,R){R||(q(N!=null,"missing value"),q(typeof A=="boolean","missing or invalid endian"),q(B!=null,"missing offset"),q(B+1<P.length,"Trying to write beyond buffer length"),De(N,32767,-32768)),P.length<=B||w(P,0<=N?N:65535+N+1,B,A,R)}function $(P,N,B,A,R){R||(q(N!=null,"missing value"),q(typeof A=="boolean","missing or invalid endian"),q(B!=null,"missing offset"),q(B+3<P.length,"Trying to write beyond buffer length"),De(N,2147483647,-2147483648)),P.length<=B||C(P,0<=N?N:4294967295+N+1,B,A,R)}function U(P,N,B,A,R){R||(q(N!=null,"missing value"),q(typeof A=="boolean","missing or invalid endian"),q(B!=null,"missing offset"),q(B+3<P.length,"Trying to write beyond buffer length"),ne(N,34028234663852886e22,-34028234663852886e22)),P.length<=B||v.write(P,N,B,A,23,4)}function H(P,N,B,A,R){R||(q(N!=null,"missing value"),q(typeof A=="boolean","missing or invalid endian"),q(B!=null,"missing offset"),q(B+7<P.length,"Trying to write beyond buffer length"),ne(N,17976931348623157e292,-17976931348623157e292)),P.length<=B||v.write(P,N,B,A,52,8)}r.Buffer=m,r.SlowBuffer=m,r.INSPECT_MAX_BYTES=50,m.poolSize=8192,m._useTypedArrays=function(){try{var P=new ArrayBuffer(0),N=new Uint8Array(P);return N.foo=function(){return 42},N.foo()===42&&typeof N.subarray=="function"}catch(B){return!1}}(),m.isEncoding=function(P){switch(String(P).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"raw":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},m.isBuffer=function(P){return!(P==null||!P._isBuffer)},m.byteLength=function(P,N){var B;switch(P+="",N||"utf8"){case"hex":B=P.length/2;break;case"utf8":case"utf-8":B=X(P).length;break;case"ascii":case"binary":case"raw":B=P.length;break;case"base64":B=re(P).length;break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":B=2*P.length;break;default:throw new Error("Unknown encoding")}return B},m.concat=function(P,N){if(q(Z(P),"Usage: Buffer.concat(list, [totalLength])\nlist should be an Array."),P.length===0)return new m(0);if(P.length===1)return P[0];if(typeof N!="number")for(R=N=0;R<P.length;R++)N+=P[R].length;for(var B=new m(N),A=0,R=0;R<P.length;R++){var I=P[R];I.copy(B,A),A+=I.length}return B},m.prototype.write=function(P,N,B,A){isFinite(N)?isFinite(B)||(A=B,B=void 0):(ee=A,A=N,N=B,B=ee),N=Number(N)||0;var R,I,z,G,ee=this.length-N;switch((!B||ee<(B=Number(B)))&&(B=ee),A=String(A||"utf8").toLowerCase()){case"hex":R=function(ae,se,ce,le){ce=Number(ce)||0;var Me=ae.length-ce;(!le||Me<(le=Number(le)))&&(le=Me),q((Me=se.length)%2==0,"Invalid hex string"),Me/2<le&&(le=Me/2);for(var F=0;F<le;F++){var O=parseInt(se.substr(2*F,2),16);q(!isNaN(O),"Invalid hex string"),ae[ce+F]=O}return m._charsWritten=2*F,F}(this,P,N,B);break;case"utf8":case"utf-8":I=this,z=N,G=B,R=m._charsWritten=W(X(P),I,z,G);break;case"ascii":case"binary":R=g(this,P,N,B);break;case"base64":I=this,z=N,G=B,R=m._charsWritten=W(re(P),I,z,G);break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":R=b(this,P,N,B);break;default:throw new Error("Unknown encoding")}return R},m.prototype.toString=function(P,N,B){var A,R,I,z,G=this;if(P=String(P||"utf8").toLowerCase(),N=Number(N)||0,(B=B!==void 0?Number(B):G.length)===N)return"";switch(P){case"hex":A=function(ee,ae,se){var ce=ee.length;(!ae||ae<0)&&(ae=0),(!se||se<0||ce<se)&&(se=ce);for(var le="",Me=ae;Me<se;Me++)le+=Q(ee[Me]);return le}(G,N,B);break;case"utf8":case"utf-8":A=function(ee,ae,se){var ce="",le="";se=Math.min(ee.length,se);for(var Me=ae;Me<se;Me++)ee[Me]<=127?(ce+=we(le)+String.fromCharCode(ee[Me]),le=""):le+="%"+ee[Me].toString(16);return ce+we(le)}(G,N,B);break;case"ascii":case"binary":A=_(G,N,B);break;case"base64":R=G,z=B,A=(I=N)===0&&z===R.length?p.fromByteArray(R):p.fromByteArray(R.slice(I,z));break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":A=function(ee,ae,se){for(var ce=ee.slice(ae,se),le="",Me=0;Me<ce.length;Me+=2)le+=String.fromCharCode(ce[Me]+256*ce[Me+1]);return le}(G,N,B);break;default:throw new Error("Unknown encoding")}return A},m.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},m.prototype.copy=function(P,N,B,A){if(N=N||0,(A=A||A===0?A:this.length)!==(B=B||0)&&P.length!==0&&this.length!==0){q(B<=A,"sourceEnd < sourceStart"),q(0<=N&&N<P.length,"targetStart out of bounds"),q(0<=B&&B<this.length,"sourceStart out of bounds"),q(0<=A&&A<=this.length,"sourceEnd out of bounds"),A>this.length&&(A=this.length);var R=(A=P.length-N<A-B?P.length-N+B:A)-B;if(R<100||!m._useTypedArrays)for(var I=0;I<R;I++)P[I+N]=this[I+B];else P._set(this.subarray(B,B+R),N)}},m.prototype.slice=function(P,N){var B=this.length;if(P=j(P,B,0),N=j(N,B,B),m._useTypedArrays)return m._augment(this.subarray(P,N));for(var A=N-P,R=new m(A,void 0,!0),I=0;I<A;I++)R[I]=this[I+P];return R},m.prototype.get=function(P){return console.log(".get() is deprecated. Access using array indexes instead."),this.readUInt8(P)},m.prototype.set=function(P,N){return console.log(".set() is deprecated. Access using array indexes instead."),this.writeUInt8(P,N)},m.prototype.readUInt8=function(P,N){if(N||(q(P!=null,"missing offset"),q(P<this.length,"Trying to read beyond buffer length")),!(P>=this.length))return this[P]},m.prototype.readUInt16LE=function(P,N){return y(this,P,!0,N)},m.prototype.readUInt16BE=function(P,N){return y(this,P,!1,N)},m.prototype.readUInt32LE=function(P,N){return T(this,P,!0,N)},m.prototype.readUInt32BE=function(P,N){return T(this,P,!1,N)},m.prototype.readInt8=function(P,N){if(N||(q(P!=null,"missing offset"),q(P<this.length,"Trying to read beyond buffer length")),!(P>=this.length))return 128&this[P]?-1*(255-this[P]+1):this[P]},m.prototype.readInt16LE=function(P,N){return S(this,P,!0,N)},m.prototype.readInt16BE=function(P,N){return S(this,P,!1,N)},m.prototype.readInt32LE=function(P,N){return E(this,P,!0,N)},m.prototype.readInt32BE=function(P,N){return E(this,P,!1,N)},m.prototype.readFloatLE=function(P,N){return x(this,P,!0,N)},m.prototype.readFloatBE=function(P,N){return x(this,P,!1,N)},m.prototype.readDoubleLE=function(P,N){return M(this,P,!0,N)},m.prototype.readDoubleBE=function(P,N){return M(this,P,!1,N)},m.prototype.writeUInt8=function(P,N,B){B||(q(P!=null,"missing value"),q(N!=null,"missing offset"),q(N<this.length,"trying to write beyond buffer length"),Re(P,255)),N>=this.length||(this[N]=P)},m.prototype.writeUInt16LE=function(P,N,B){w(this,P,N,!0,B)},m.prototype.writeUInt16BE=function(P,N,B){w(this,P,N,!1,B)},m.prototype.writeUInt32LE=function(P,N,B){C(this,P,N,!0,B)},m.prototype.writeUInt32BE=function(P,N,B){C(this,P,N,!1,B)},m.prototype.writeInt8=function(P,N,B){B||(q(P!=null,"missing value"),q(N!=null,"missing offset"),q(N<this.length,"Trying to write beyond buffer length"),De(P,127,-128)),N>=this.length||(0<=P?this.writeUInt8(P,N,B):this.writeUInt8(255+P+1,N,B))},m.prototype.writeInt16LE=function(P,N,B){L(this,P,N,!0,B)},m.prototype.writeInt16BE=function(P,N,B){L(this,P,N,!1,B)},m.prototype.writeInt32LE=function(P,N,B){$(this,P,N,!0,B)},m.prototype.writeInt32BE=function(P,N,B){$(this,P,N,!1,B)},m.prototype.writeFloatLE=function(P,N,B){U(this,P,N,!0,B)},m.prototype.writeFloatBE=function(P,N,B){U(this,P,N,!1,B)},m.prototype.writeDoubleLE=function(P,N,B){H(this,P,N,!0,B)},m.prototype.writeDoubleBE=function(P,N,B){H(this,P,N,!1,B)},m.prototype.fill=function(P,N,B){if(N=N||0,B=B||this.length,q(typeof(P=typeof(P=P||0)=="string"?P.charCodeAt(0):P)=="number"&&!isNaN(P),"value is not a number"),q(N<=B,"end < start"),B!==N&&this.length!==0){q(0<=N&&N<this.length,"start out of bounds"),q(0<=B&&B<=this.length,"end out of bounds");for(var A=N;A<B;A++)this[A]=P}},m.prototype.inspect=function(){for(var P=[],N=this.length,B=0;B<N;B++)if(P[B]=Q(this[B]),B===r.INSPECT_MAX_BYTES){P[B+1]="...";break}return"<Buffer "+P.join(" ")+">"},m.prototype.toArrayBuffer=function(){if(typeof Uint8Array>"u")throw new Error("Buffer.toArrayBuffer not supported in this browser");if(m._useTypedArrays)return new m(this).buffer;for(var P=new Uint8Array(this.length),N=0,B=P.length;N<B;N+=1)P[N]=this[N];return P.buffer};var V=m.prototype;function j(P,N,B){return typeof P!="number"?B:N<=(P=~~P)?N:0<=P||0<=(P+=N)?P:0}function te(P){return(P=~~Math.ceil(+P))<0?0:P}function Z(P){return(Array.isArray||function(N){return Object.prototype.toString.call(N)==="[object Array]"})(P)}function Q(P){return P<16?"0"+P.toString(16):P.toString(16)}function X(P){for(var N=[],B=0;B<P.length;B++){var A=P.charCodeAt(B);if(A<=127)N.push(P.charCodeAt(B));else for(var R=B,I=(55296<=A&&A<=57343&&B++,encodeURIComponent(P.slice(R,B+1)).substr(1).split("%")),z=0;z<I.length;z++)N.push(parseInt(I[z],16))}return N}function re(P){return p.toByteArray(P)}function W(P,N,B,A){for(var R=0;R<A&&!(R+B>=N.length||R>=P.length);R++)N[R+B]=P[R];return R}function we(P){try{return decodeURIComponent(P)}catch(N){return String.fromCharCode(65533)}}function Re(P,N){q(typeof P=="number","cannot write a non-number as a number"),q(0<=P,"specified a negative value for writing an unsigned value"),q(P<=N,"value is larger than maximum value for type"),q(Math.floor(P)===P,"value has a fractional component")}function De(P,N,B){q(typeof P=="number","cannot write a non-number as a number"),q(P<=N,"value larger than maximum allowed value"),q(B<=P,"value smaller than minimum allowed value"),q(Math.floor(P)===P,"value has a fractional component")}function ne(P,N,B){q(typeof P=="number","cannot write a non-number as a number"),q(P<=N,"value larger than maximum allowed value"),q(B<=P,"value smaller than minimum allowed value")}function q(P,N){if(!P)throw new Error(N||"Failed assertion")}m._augment=function(P){return P._isBuffer=!0,P._get=P.get,P._set=P.set,P.get=V.get,P.set=V.set,P.write=V.write,P.toString=V.toString,P.toLocaleString=V.toString,P.toJSON=V.toJSON,P.copy=V.copy,P.slice=V.slice,P.readUInt8=V.readUInt8,P.readUInt16LE=V.readUInt16LE,P.readUInt16BE=V.readUInt16BE,P.readUInt32LE=V.readUInt32LE,P.readUInt32BE=V.readUInt32BE,P.readInt8=V.readInt8,P.readInt16LE=V.readInt16LE,P.readInt16BE=V.readInt16BE,P.readInt32LE=V.readInt32LE,P.readInt32BE=V.readInt32BE,P.readFloatLE=V.readFloatLE,P.readFloatBE=V.readFloatBE,P.readDoubleLE=V.readDoubleLE,P.readDoubleBE=V.readDoubleBE,P.writeUInt8=V.writeUInt8,P.writeUInt16LE=V.writeUInt16LE,P.writeUInt16BE=V.writeUInt16BE,P.writeUInt32LE=V.writeUInt32LE,P.writeUInt32BE=V.writeUInt32BE,P.writeInt8=V.writeInt8,P.writeInt16LE=V.writeInt16LE,P.writeInt16BE=V.writeInt16BE,P.writeInt32LE=V.writeInt32LE,P.writeInt32BE=V.writeInt32BE,P.writeFloatLE=V.writeFloatLE,P.writeFloatBE=V.writeFloatBE,P.writeDoubleLE=V.writeDoubleLE,P.writeDoubleBE=V.writeDoubleBE,P.fill=V.fill,P.inspect=V.inspect,P.toArrayBuffer=V.toArrayBuffer,P}}).call(this,t("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/buffer/index.js","/node_modules/gulp-browserify/node_modules/buffer")},{"base64-js":2,buffer:3,ieee754:10,lYpoI2:11}],4:[function(t,i,r){(function(s,o,p,l,c,u,h,d,f){var p=t("buffer").Buffer,v=4,m=new p(v);m.fill(0),i.exports={hash:function(g,b,_,y){for(var T=b(function(w,C){w.length%v!=0&&(L=w.length+(v-w.length%v),w=p.concat([w,m],L));for(var L,$=[],U=C?w.readInt32BE:w.readInt32LE,H=0;H<w.length;H+=v)$.push(U.call(w,H));return $}(g=p.isBuffer(g)?g:new p(g),y),8*g.length),b=y,S=new p(_),E=b?S.writeInt32BE:S.writeInt32LE,x=0;x<T.length;x++)E.call(S,T[x],4*x,!0);return S}}}).call(this,t("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/helpers.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{buffer:3,lYpoI2:11}],5:[function(t,i,r){(function(s,o,p,l,c,u,h,d,f){var p=t("buffer").Buffer,v=t("./sha"),m=t("./sha256"),g=t("./rng"),b={sha1:v,sha256:m,md5:t("./md5")},_=64,y=new p(_);function T(w,C){var L=b[w=w||"sha1"],$=[];return L||S("algorithm:",w,"is not yet supported"),{update:function(U){return p.isBuffer(U)||(U=new p(U)),$.push(U),U.length,this},digest:function(U){var H=p.concat($),H=C?function(V,j,te){p.isBuffer(j)||(j=new p(j)),p.isBuffer(te)||(te=new p(te)),j.length>_?j=V(j):j.length<_&&(j=p.concat([j,y],_));for(var Z=new p(_),Q=new p(_),X=0;X<_;X++)Z[X]=54^j[X],Q[X]=92^j[X];return te=V(p.concat([Z,te])),V(p.concat([Q,te]))}(L,C,H):L(H);return $=null,U?H.toString(U):H}}}function S(){var w=[].slice.call(arguments).join(" ");throw new Error([w,"we accept pull requests","http://github.com/dominictarr/crypto-browserify"].join("\n"))}y.fill(0),r.createHash=function(w){return T(w)},r.createHmac=T,r.randomBytes=function(w,C){if(!C||!C.call)return new p(g(w));try{C.call(this,void 0,new p(g(w)))}catch(L){C(L)}};var E,x=["createCredentials","createCipher","createCipheriv","createDecipher","createDecipheriv","createSign","createVerify","createDiffieHellman","pbkdf2"],M=function(w){r[w]=function(){S("sorry,",w,"is not implemented yet")}};for(E in x)M(x[E])}).call(this,t("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/index.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./md5":6,"./rng":7,"./sha":8,"./sha256":9,buffer:3,lYpoI2:11}],6:[function(t,i,r){(function(s,o,a,l,c,u,h,d,f){var p=t("./helpers");function v(S,E){S[E>>5]|=128<<E%32,S[14+(E+64>>>9<<4)]=E;for(var x=1732584193,M=-271733879,w=-1732584194,C=271733878,L=0;L<S.length;L+=16){var $=x,U=M,H=w,V=C,x=g(x,M,w,C,S[L+0],7,-680876936),C=g(C,x,M,w,S[L+1],12,-389564586),w=g(w,C,x,M,S[L+2],17,606105819),M=g(M,w,C,x,S[L+3],22,-1044525330);x=g(x,M,w,C,S[L+4],7,-176418897),C=g(C,x,M,w,S[L+5],12,1200080426),w=g(w,C,x,M,S[L+6],17,-1473231341),M=g(M,w,C,x,S[L+7],22,-45705983),x=g(x,M,w,C,S[L+8],7,1770035416),C=g(C,x,M,w,S[L+9],12,-1958414417),w=g(w,C,x,M,S[L+10],17,-42063),M=g(M,w,C,x,S[L+11],22,-1990404162),x=g(x,M,w,C,S[L+12],7,1804603682),C=g(C,x,M,w,S[L+13],12,-40341101),w=g(w,C,x,M,S[L+14],17,-1502002290),x=b(x,M=g(M,w,C,x,S[L+15],22,1236535329),w,C,S[L+1],5,-165796510),C=b(C,x,M,w,S[L+6],9,-1069501632),w=b(w,C,x,M,S[L+11],14,643717713),M=b(M,w,C,x,S[L+0],20,-373897302),x=b(x,M,w,C,S[L+5],5,-701558691),C=b(C,x,M,w,S[L+10],9,38016083),w=b(w,C,x,M,S[L+15],14,-660478335),M=b(M,w,C,x,S[L+4],20,-405537848),x=b(x,M,w,C,S[L+9],5,568446438),C=b(C,x,M,w,S[L+14],9,-1019803690),w=b(w,C,x,M,S[L+3],14,-187363961),M=b(M,w,C,x,S[L+8],20,1163531501),x=b(x,M,w,C,S[L+13],5,-1444681467),C=b(C,x,M,w,S[L+2],9,-51403784),w=b(w,C,x,M,S[L+7],14,1735328473),x=_(x,M=b(M,w,C,x,S[L+12],20,-1926607734),w,C,S[L+5],4,-378558),C=_(C,x,M,w,S[L+8],11,-2022574463),w=_(w,C,x,M,S[L+11],16,1839030562),M=_(M,w,C,x,S[L+14],23,-35309556),x=_(x,M,w,C,S[L+1],4,-1530992060),C=_(C,x,M,w,S[L+4],11,1272893353),w=_(w,C,x,M,S[L+7],16,-155497632),M=_(M,w,C,x,S[L+10],23,-1094730640),x=_(x,M,w,C,S[L+13],4,681279174),C=_(C,x,M,w,S[L+0],11,-358537222),w=_(w,C,x,M,S[L+3],16,-722521979),M=_(M,w,C,x,S[L+6],23,76029189),x=_(x,M,w,C,S[L+9],4,-640364487),C=_(C,x,M,w,S[L+12],11,-421815835),w=_(w,C,x,M,S[L+15],16,530742520),x=y(x,M=_(M,w,C,x,S[L+2],23,-995338651),w,C,S[L+0],6,-198630844),C=y(C,x,M,w,S[L+7],10,1126891415),w=y(w,C,x,M,S[L+14],15,-1416354905),M=y(M,w,C,x,S[L+5],21,-57434055),x=y(x,M,w,C,S[L+12],6,1700485571),C=y(C,x,M,w,S[L+3],10,-1894986606),w=y(w,C,x,M,S[L+10],15,-1051523),M=y(M,w,C,x,S[L+1],21,-2054922799),x=y(x,M,w,C,S[L+8],6,1873313359),C=y(C,x,M,w,S[L+15],10,-30611744),w=y(w,C,x,M,S[L+6],15,-1560198380),M=y(M,w,C,x,S[L+13],21,1309151649),x=y(x,M,w,C,S[L+4],6,-145523070),C=y(C,x,M,w,S[L+11],10,-1120210379),w=y(w,C,x,M,S[L+2],15,718787259),M=y(M,w,C,x,S[L+9],21,-343485551),x=T(x,$),M=T(M,U),w=T(w,H),C=T(C,V)}return Array(x,M,w,C)}function m(S,E,x,M,w,C){return T((E=T(T(E,S),T(M,C)))<<w|E>>>32-w,x)}function g(S,E,x,M,w,C,L){return m(E&x|~E&M,S,E,w,C,L)}function b(S,E,x,M,w,C,L){return m(E&M|x&~M,S,E,w,C,L)}function _(S,E,x,M,w,C,L){return m(E^x^M,S,E,w,C,L)}function y(S,E,x,M,w,C,L){return m(x^(E|~M),S,E,w,C,L)}function T(S,E){var x=(65535&S)+(65535&E);return(S>>16)+(E>>16)+(x>>16)<<16|65535&x}i.exports=function(S){return p.hash(S,v,16)}}).call(this,t("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/md5.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:11}],7:[function(t,i,r){(function(s,o,a,l,c,u,h,d,f){i.exports=function(p){for(var v,m=new Array(p),g=0;g<p;g++)!(3&g)&&(v=4294967296*Math.random()),m[g]=v>>>((3&g)<<3)&255;return m}}).call(this,t("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/rng.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{buffer:3,lYpoI2:11}],8:[function(t,i,r){(function(s,o,a,l,c,u,h,d,f){var p=t("./helpers");function v(b,_){b[_>>5]|=128<<24-_%32,b[15+(_+64>>9<<4)]=_;for(var y,T,S,E=Array(80),x=1732584193,M=-271733879,w=-1732584194,C=271733878,L=-1009589776,$=0;$<b.length;$+=16){for(var U=x,H=M,V=w,j=C,te=L,Z=0;Z<80;Z++){E[Z]=Z<16?b[$+Z]:g(E[Z-3]^E[Z-8]^E[Z-14]^E[Z-16],1);var Q=m(m(g(x,5),(Q=M,T=w,S=C,(y=Z)<20?Q&T|~Q&S:!(y<40)&&y<60?Q&T|Q&S|T&S:Q^T^S)),m(m(L,E[Z]),(y=Z)<20?1518500249:y<40?1859775393:y<60?-1894007588:-899497514)),L=C,C=w,w=g(M,30),M=x,x=Q}x=m(x,U),M=m(M,H),w=m(w,V),C=m(C,j),L=m(L,te)}return Array(x,M,w,C,L)}function m(b,_){var y=(65535&b)+(65535&_);return(b>>16)+(_>>16)+(y>>16)<<16|65535&y}function g(b,_){return b<<_|b>>>32-_}i.exports=function(b){return p.hash(b,v,20,!0)}}).call(this,t("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/sha.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:11}],9:[function(t,i,r){(function(s,o,a,l,c,u,h,d,f){function p(_,y){var T=(65535&_)+(65535&y);return(_>>16)+(y>>16)+(T>>16)<<16|65535&T}function v(_,y){var T,S=new Array(1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298),E=new Array(1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225),x=new Array(64);_[y>>5]|=128<<24-y%32,_[15+(y+64>>9<<4)]=y;for(var M,w,C=0;C<_.length;C+=16){for(var L=E[0],$=E[1],U=E[2],H=E[3],V=E[4],j=E[5],te=E[6],Z=E[7],Q=0;Q<64;Q++)x[Q]=Q<16?_[Q+C]:p(p(p((w=x[Q-2],g(w,17)^g(w,19)^b(w,10)),x[Q-7]),(w=x[Q-15],g(w,7)^g(w,18)^b(w,3))),x[Q-16]),T=p(p(p(p(Z,g(w=V,6)^g(w,11)^g(w,25)),V&j^~V&te),S[Q]),x[Q]),M=p(g(M=L,2)^g(M,13)^g(M,22),L&$^L&U^$&U),Z=te,te=j,j=V,V=p(H,T),H=U,U=$,$=L,L=p(T,M);E[0]=p(L,E[0]),E[1]=p($,E[1]),E[2]=p(U,E[2]),E[3]=p(H,E[3]),E[4]=p(V,E[4]),E[5]=p(j,E[5]),E[6]=p(te,E[6]),E[7]=p(Z,E[7])}return E}var m=t("./helpers"),g=function(_,y){return _>>>y|_<<32-y},b=function(_,y){return _>>>y};i.exports=function(_){return m.hash(_,v,32,!0)}}).call(this,t("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/sha256.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:11}],10:[function(t,i,r){(function(s,o,a,l,c,u,h,d,f){r.read=function(p,v,m,g,C){var _,y,T=8*C-g-1,S=(1<<T)-1,E=S>>1,x=-7,M=m?C-1:0,w=m?-1:1,C=p[v+M];for(M+=w,_=C&(1<<-x)-1,C>>=-x,x+=T;0<x;_=256*_+p[v+M],M+=w,x-=8);for(y=_&(1<<-x)-1,_>>=-x,x+=g;0<x;y=256*y+p[v+M],M+=w,x-=8);if(_===0)_=1-E;else{if(_===S)return y?NaN:1/0*(C?-1:1);y+=Math.pow(2,g),_-=E}return(C?-1:1)*y*Math.pow(2,_-g)},r.write=function(p,v,m,g,b,L){var y,T,S=8*L-b-1,E=(1<<S)-1,x=E>>1,M=b===23?Math.pow(2,-24)-Math.pow(2,-77):0,w=g?0:L-1,C=g?1:-1,L=v<0||v===0&&1/v<0?1:0;for(v=Math.abs(v),isNaN(v)||v===1/0?(T=isNaN(v)?1:0,y=E):(y=Math.floor(Math.log(v)/Math.LN2),v*(g=Math.pow(2,-y))<1&&(y--,g*=2),2<=(v+=1<=y+x?M/g:M*Math.pow(2,1-x))*g&&(y++,g/=2),E<=y+x?(T=0,y=E):1<=y+x?(T=(v*g-1)*Math.pow(2,b),y+=x):(T=v*Math.pow(2,x-1)*Math.pow(2,b),y=0));8<=b;p[m+w]=255&T,w+=C,T/=256,b-=8);for(y=y<<b|T,S+=b;0<S;p[m+w]=255&y,w+=C,y/=256,S-=8);p[m+w-C]|=128*L}}).call(this,t("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/ieee754/index.js","/node_modules/gulp-browserify/node_modules/ieee754")},{buffer:3,lYpoI2:11}],11:[function(t,i,r){(function(s,o,a,l,c,u,h,d,f){var p,v,m;function g(){}(s=i.exports={}).nextTick=(v=typeof window<"u"&&window.setImmediate,m=typeof window<"u"&&window.postMessage&&window.addEventListener,v?function(b){return window.setImmediate(b)}:m?(p=[],window.addEventListener("message",function(b){var _=b.source;_!==window&&_!==null||b.data!=="process-tick"||(b.stopPropagation(),0<p.length&&p.shift()())},!0),function(b){p.push(b),window.postMessage("process-tick","*")}):function(b){setTimeout(b,0)}),s.title="browser",s.browser=!0,s.env={},s.argv=[],s.on=g,s.addListener=g,s.once=g,s.off=g,s.removeListener=g,s.removeAllListeners=g,s.emit=g,s.binding=function(b){throw new Error("process.binding is not supported")},s.cwd=function(){return"/"},s.chdir=function(b){throw new Error("process.chdir is not supported")}}).call(this,t("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/process/browser.js","/node_modules/gulp-browserify/node_modules/process")},{buffer:3,lYpoI2:11}]},{},[1])(1)})})(gL);var Une=gL.exports;const Nne=Cd(Une);var vL=["precision","highp","mediump","lowp","attribute","const","uniform","varying","break","continue","do","for","while","if","else","in","out","inout","float","int","uint","void","bool","true","false","discard","return","mat2","mat3","mat4","vec2","vec3","vec4","ivec2","ivec3","ivec4","bvec2","bvec3","bvec4","sampler1D","sampler2D","sampler3D","samplerCube","sampler1DShadow","sampler2DShadow","struct","asm","class","union","enum","typedef","template","this","packed","goto","switch","default","inline","noinline","volatile","public","static","extern","external","interface","long","short","double","half","fixed","unsigned","input","output","hvec2","hvec3","hvec4","dvec2","dvec3","dvec4","fvec2","fvec3","fvec4","sampler2DRect","sampler3DRect","sampler2DRectShadow","sizeof","cast","namespace","using"],Fne=["<<=",">>=","++","--","<<",">>","<=",">=","==","!=","&&","||","+=","-=","*=","/=","%=","&=","^^","^=","|=","(",")","[","]",".","!","~","*","/","%","+","-","<",">","&","^","|","?",":","=",",",";","{","}"],_L=["abs","acos","all","any","asin","atan","ceil","clamp","cos","cross","dFdx","dFdy","degrees","distance","dot","equal","exp","exp2","faceforward","floor","fract","gl_BackColor","gl_BackLightModelProduct","gl_BackLightProduct","gl_BackMaterial","gl_BackSecondaryColor","gl_ClipPlane","gl_ClipVertex","gl_Color","gl_DepthRange","gl_DepthRangeParameters","gl_EyePlaneQ","gl_EyePlaneR","gl_EyePlaneS","gl_EyePlaneT","gl_Fog","gl_FogCoord","gl_FogFragCoord","gl_FogParameters","gl_FragColor","gl_FragCoord","gl_FragData","gl_FragDepth","gl_FragDepthEXT","gl_FrontColor","gl_FrontFacing","gl_FrontLightModelProduct","gl_FrontLightProduct","gl_FrontMaterial","gl_FrontSecondaryColor","gl_LightModel","gl_LightModelParameters","gl_LightModelProducts","gl_LightProducts","gl_LightSource","gl_LightSourceParameters","gl_MaterialParameters","gl_MaxClipPlanes","gl_MaxCombinedTextureImageUnits","gl_MaxDrawBuffers","gl_MaxFragmentUniformComponents","gl_MaxLights","gl_MaxTextureCoords","gl_MaxTextureImageUnits","gl_MaxTextureUnits","gl_MaxVaryingFloats","gl_MaxVertexAttribs","gl_MaxVertexTextureImageUnits","gl_MaxVertexUniformComponents","gl_ModelViewMatrix","gl_ModelViewMatrixInverse","gl_ModelViewMatrixInverseTranspose","gl_ModelViewMatrixTranspose","gl_ModelViewProjectionMatrix","gl_ModelViewProjectionMatrixInverse","gl_ModelViewProjectionMatrixInverseTranspose","gl_ModelViewProjectionMatrixTranspose","gl_MultiTexCoord0","gl_MultiTexCoord1","gl_MultiTexCoord2","gl_MultiTexCoord3","gl_MultiTexCoord4","gl_MultiTexCoord5","gl_MultiTexCoord6","gl_MultiTexCoord7","gl_Normal","gl_NormalMatrix","gl_NormalScale","gl_ObjectPlaneQ","gl_ObjectPlaneR","gl_ObjectPlaneS","gl_ObjectPlaneT","gl_Point","gl_PointCoord","gl_PointParameters","gl_PointSize","gl_Position","gl_ProjectionMatrix","gl_ProjectionMatrixInverse","gl_ProjectionMatrixInverseTranspose","gl_ProjectionMatrixTranspose","gl_SecondaryColor","gl_TexCoord","gl_TextureEnvColor","gl_TextureMatrix","gl_TextureMatrixInverse","gl_TextureMatrixInverseTranspose","gl_TextureMatrixTranspose","gl_Vertex","greaterThan","greaterThanEqual","inversesqrt","length","lessThan","lessThanEqual","log","log2","matrixCompMult","max","min","mix","mod","normalize","not","notEqual","pow","radians","reflect","refract","sign","sin","smoothstep","sqrt","step","tan","texture2D","texture2DLod","texture2DProj","texture2DProjLod","textureCube","textureCubeLod","texture2DLodEXT","texture2DProjLodEXT","textureCubeLodEXT","texture2DGradEXT","texture2DProjGradEXT","textureCubeGradEXT"],kne=vL,Bne=kne.slice().concat(["layout","centroid","smooth","case","mat2x2","mat2x3","mat2x4","mat3x2","mat3x3","mat3x4","mat4x2","mat4x3","mat4x4","uvec2","uvec3","uvec4","samplerCubeShadow","sampler2DArray","sampler2DArrayShadow","isampler2D","isampler3D","isamplerCube","isampler2DArray","usampler2D","usampler3D","usamplerCube","usampler2DArray","coherent","restrict","readonly","writeonly","resource","atomic_uint","noperspective","patch","sample","subroutine","common","partition","active","filter","image1D","image2D","image3D","imageCube","iimage1D","iimage2D","iimage3D","iimageCube","uimage1D","uimage2D","uimage3D","uimageCube","image1DArray","image2DArray","iimage1DArray","iimage2DArray","uimage1DArray","uimage2DArray","image1DShadow","image2DShadow","image1DArrayShadow","image2DArrayShadow","imageBuffer","iimageBuffer","uimageBuffer","sampler1DArray","sampler1DArrayShadow","isampler1D","isampler1DArray","usampler1D","usampler1DArray","isampler2DRect","usampler2DRect","samplerBuffer","isamplerBuffer","usamplerBuffer","sampler2DMS","isampler2DMS","usampler2DMS","sampler2DMSArray","isampler2DMSArray","usampler2DMSArray"]),N_=_L;N_=N_.slice().filter(function(n){return!/^(gl\_|texture)/.test(n)});var zne=N_.concat(["gl_VertexID","gl_InstanceID","gl_Position","gl_PointSize","gl_FragCoord","gl_FrontFacing","gl_FragDepth","gl_PointCoord","gl_MaxVertexAttribs","gl_MaxVertexUniformVectors","gl_MaxVertexOutputVectors","gl_MaxFragmentInputVectors","gl_MaxVertexTextureImageUnits","gl_MaxCombinedTextureImageUnits","gl_MaxTextureImageUnits","gl_MaxFragmentUniformVectors","gl_MaxDrawBuffers","gl_MinProgramTexelOffset","gl_MaxProgramTexelOffset","gl_DepthRangeParameters","gl_DepthRange","trunc","round","roundEven","isnan","isinf","floatBitsToInt","floatBitsToUint","intBitsToFloat","uintBitsToFloat","packSnorm2x16","unpackSnorm2x16","packUnorm2x16","unpackUnorm2x16","packHalf2x16","unpackHalf2x16","outerProduct","transpose","determinant","inverse","texture","textureSize","textureProj","textureLod","textureOffset","texelFetch","texelFetchOffset","textureProjOffset","textureLodOffset","textureProjLod","textureProjLodOffset","textureGrad","textureGradOffset","textureProjGrad","textureProjGradOffset"]),Vne=Zne,Hne=vL,lT=Fne,Gne=_L,Wne=Bne,$ne=zne,_r=999,cT=9999,Jv=0,Qv=1,uT=2,hT=3,dT=4,np=5,jne=6,Xne=7,Yne=8,fT=9,qne=10,pT=11,Kne=["block-comment","line-comment","preprocessor","operator","integer","float","ident","builtin","keyword","whitespace","eof","integer"];function Zne(n){var e=0,t=0,i=_r,r,s,o=[],a=[],l=1,c=0,u=0,h=!1,d=!1,f="",p;n=n||{};var v=Gne,m=Hne;n.version==="300 es"&&(v=$ne,m=Wne);for(var g={},b={},e=0;e<v.length;e++)g[v[e]]=!0;for(var e=0;e<m.length;e++)b[m[e]]=!0;return function(j){return a=[],j!==null?y(j):T()};function _(j){j.length&&a.push({type:Kne[i],data:j,position:u,line:l,column:c})}function y(j){e=0,j.toString&&(j=j.toString()),f+=j.replace(/\r\n/g,"\n"),p=f.length;for(var te;r=f[e],e<p;){switch(te=e,i){case Jv:e=w();break;case Qv:e=M();break;case uT:e=x();break;case hT:e=C();break;case dT:e=U();break;case pT:e=$();break;case np:e=H();break;case cT:e=V();break;case fT:e=E();break;case _r:e=S();break}if(te!==e)switch(f[te]){case"\n":c=0,++l;break;default:++c;break}}return t+=e,f=f.slice(e),a}function T(j){return o.length&&_(o.join("")),i=qne,_("(eof)"),a}function S(){return o=o.length?[]:o,s==="/"&&r==="*"?(u=t+e-1,i=Jv,s=r,e+1):s==="/"&&r==="/"?(u=t+e-1,i=Qv,s=r,e+1):r==="#"?(i=uT,u=t+e,e):/\s/.test(r)?(i=fT,u=t+e,e):(h=/\d/.test(r),d=/[^\w_]/.test(r),u=t+e,i=h?dT:d?hT:cT,e)}function E(){return/[^\s]/g.test(r)?(_(o.join("")),i=_r,e):(o.push(r),s=r,e+1)}function x(){return(r==="\r"||r==="\n")&&s!=="\\"?(_(o.join("")),i=_r,e):(o.push(r),s=r,e+1)}function M(){return x()}function w(){return r==="/"&&s==="*"?(o.push(r),_(o.join("")),i=_r,e+1):(o.push(r),s=r,e+1)}function C(){if(s==="."&&/\d/.test(r))return i=np,e;if(s==="/"&&r==="*")return i=Jv,e;if(s==="/"&&r==="/")return i=Qv,e;if(r==="."&&o.length){for(;L(o););return i=np,e}if(r===";"||r===")"||r==="("){if(o.length)for(;L(o););return _(r),i=_r,e+1}var j=o.length===2&&r!=="=";if(/[\w_\d\s]/.test(r)||j){for(;L(o););return i=_r,e}return o.push(r),s=r,e+1}function L(j){var te=0,Z,Q;do{if(Z=lT.indexOf(j.slice(0,j.length+te).join("")),Q=lT[Z],Z===-1){if(te--+j.length>0)continue;Q=j.slice(0,1).join("")}return _(Q),u+=Q.length,o=o.slice(Q.length),o.length}while(1)}function $(){return/[^a-fA-F0-9]/.test(r)?(_(o.join("")),i=_r,e):(o.push(r),s=r,e+1)}function U(){return r==="."||/[eE]/.test(r)?(o.push(r),i=np,s=r,e+1):r==="x"&&o.length===1&&o[0]==="0"?(i=pT,o.push(r),s=r,e+1):/[^\d]/.test(r)?(_(o.join("")),i=_r,e):(o.push(r),s=r,e+1)}function H(){return r==="f"&&(o.push(r),s=r,e+=1),/[eE]/.test(r)||(r==="-"||r==="+")&&/[eE]/.test(s)?(o.push(r),s=r,e+1):/[^\d]/.test(r)?(_(o.join("")),i=_r,e):(o.push(r),s=r,e+1)}function V(){if(/[^\d\w_]/.test(r)){var j=o.join("");return b[j]?i=Yne:g[j]?i=Xne:i=jne,_(o.join("")),i=_r,e}return o.push(r),s=r,e+1}}var Jne=Vne,Qne=eie;function eie(n,e){var t=Jne(e),i=[];return i=i.concat(t(n)),i=i.concat(t(null)),i}const tie=Cd(Qne);var nie=iie;function iie(n){for(var e=[],t=0;t<n.length;t++)n[t].type!=="eof"&&e.push(n[t].data);return e.join("")}const mT=Cd(nie);var rie=sie;function sie(n){var e=null,t=null,i=0,r=0,s=0,o=0,a=0,l=[],c,u,h;for(c=0,u;c<n.length;c++)if(h=n[c],h.data==="{"){if(i&&i++||(u=f(c,lo(")"),lo()),u<0)||(o=u,u=f(u,lo("("),lo(")")),u<0)||(a=u,u=f(u,Iu),u<0)||n[u].type!=="ident"||(t=n[u].data,u=f(u,Iu),u<0))continue;i=1,r=c,e=n[u].data,s=u;var d=f(u,Iu);switch(n[d]&&n[d].data){case"lowp":case"highp":case"mediump":s=d}}else if(i&&h.data==="}"){if(--i)continue;l.push({name:t,type:e,body:[r+1,c],args:[a,o+1],outer:[s,c+1]})}for(c=0;c<n.length;c++)if(h=n[c],h.data===";"){if(u=f(c,lo(")"),lo()),u<0||(o=u,u=f(u,lo("("),lo(")")),u<0)||(a=u,u=f(u,Iu),u<0)||n[u].type!=="ident"||(t=n[u].data,u=f(u,Iu),u<0)||n[u].type==="operator"||n[u].data==="return")continue;e=n[u].data,l.push({name:t,type:e,body:!1,args:[a,o+1],outer:[u,c+1]})}return l.sort(function(p,v){return p.outer[0]-v.outer[0]});function f(p,v,m){for(var g=p-1;g>=0;g--){if(v(n[g]))return g;if(m&&m(n[g]))return-1}return-1}}function lo(n){return function(e){return e.type==="operator"&&(!n||e.data===n)}}function Iu(n){return n.type!=="whitespace"}const oie=Cd(rie);function aie(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var i=t.call(n,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function yL(n){var e=aie(n,"string");return typeof e=="symbol"?e:String(e)}function Dt(n,e,t){return e=yL(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function gT(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(n);e&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(n,r).enumerable})),t.push.apply(t,i)}return t}function jl(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?gT(Object(t),!0).forEach(function(i){Dt(n,i,t[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):gT(Object(t)).forEach(function(i){Object.defineProperty(n,i,Object.getOwnPropertyDescriptor(t,i))})}return n}function lie(n,e){if(n==null)return{};var t={},i=Object.keys(n),r,s;for(s=0;s<i.length;s++)r=i[s],!(e.indexOf(r)>=0)&&(t[r]=n[r]);return t}function cie(n,e){if(n==null)return{};var t=lie(n,e),i,r;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(n);for(r=0;r<s.length;r++)i=s[r],!(e.indexOf(i)>=0)&&Object.prototype.propertyIsEnumerable.call(n,i)&&(t[i]=n[i])}return t}function uie(n,e){if(!(n instanceof e))throw new TypeError("Cannot call a class as a function")}function vT(n,e){for(var t=0;t<e.length;t++){var i=e[t];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(n,yL(i.key),i)}}function hie(n,e,t){return e&&vT(n.prototype,e),t&&vT(n,t),Object.defineProperty(n,"prototype",{writable:!1}),n}function bL(n){if(n===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return n}function F_(n,e){return F_=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,i){return t.__proto__=i,t},F_(n,e)}function die(n,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),Object.defineProperty(n,"prototype",{writable:!1}),e&&F_(n,e)}function Qp(n){return Qp=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Qp(n)}function fie(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(n){return!1}}function pie(n,e){if(e&&(typeof e=="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return bL(n)}function mie(n){var e=fie();return function(){var t=Qp(n),i;if(e){var r=Qp(this).constructor;i=Reflect.construct(t,arguments,r)}else i=t.apply(this,arguments);return pie(this,i)}}var tt={position:"csm_Position",positionRaw:"csm_PositionRaw",pointSize:"csm_PointSize",fragColor:"csm_FragColor",diffuseColor:"csm_DiffuseColor",normal:"csm_Normal",roughness:"csm_Roughness",metalness:"csm_Metalness",emissive:"csm_Emissive",ao:"csm_AO",bump:"csm_Bump",depthAlpha:"csm_DepthAlpha"},mi,Xl,gie=(mi={},Dt(mi,"".concat(tt.normal),{"#include <beginnormal_vertex>":"\n vec3 objectNormal = ".concat(tt.normal,";\n #ifdef USE_TANGENT\n vec3 objectTangent = vec3( tangent.xyz );\n #endif\n ")}),Dt(mi,"".concat(tt.position),{"#include <begin_vertex>":"\n vec3 transformed = ".concat(tt.position,";\n ")}),Dt(mi,"".concat(tt.positionRaw),{"#include <begin_vertex>":"\n vec4 csm_internal_positionUnprojected = ".concat(tt.positionRaw,";\n mat4x4 csm_internal_unprojectMatrix = projectionMatrix * modelViewMatrix;\n #ifdef USE_INSTANCING\n csm_internal_unprojectMatrix = csm_internal_unprojectMatrix * instanceMatrix;\n #endif\n csm_internal_positionUnprojected = inverse(csm_internal_unprojectMatrix) * csm_internal_positionUnprojected;\n vec3 transformed = csm_internal_positionUnprojected.xyz;\n ")}),Dt(mi,"".concat(tt.pointSize),{"gl_PointSize = size;":"\n gl_PointSize = ".concat(tt.pointSize,";\n ")}),Dt(mi,"".concat(tt.diffuseColor),{"#include <color_fragment>":"\n #include <color_fragment>\n diffuseColor = ".concat(tt.diffuseColor,";\n ")}),Dt(mi,"".concat(tt.fragColor),{"#include <dithering_fragment>":"\n #include <dithering_fragment>\n gl_FragColor = ".concat(tt.fragColor,";\n ")}),Dt(mi,"".concat(tt.emissive),{"vec3 totalEmissiveRadiance = emissive;":"\n vec3 totalEmissiveRadiance = ".concat(tt.emissive,";\n ")}),Dt(mi,"".concat(tt.roughness),{"#include <roughnessmap_fragment>":"\n #include <roughnessmap_fragment>\n roughnessFactor = ".concat(tt.roughness,";\n ")}),Dt(mi,"".concat(tt.metalness),{"#include <metalnessmap_fragment>":"\n #include <metalnessmap_fragment>\n metalnessFactor = ".concat(tt.metalness,";\n ")}),Dt(mi,"".concat(tt.ao),{"#include <aomap_fragment>":"\n #include <aomap_fragment>\n reflectedLight.indirectDiffuse *= 1. - ".concat(tt.ao,";\n ")}),Dt(mi,"".concat(tt.bump),{"#include <normal_fragment_maps>":"\n #include <normal_fragment_maps>\n\n vec3 csm_internal_orthogonal = ".concat(tt.bump," - (dot(").concat(tt.bump,", normal) * normal);\n vec3 csm_internal_projectedbump = mat3(csm_internal_vModelViewMatrix) * csm_internal_orthogonal;\n normal = normalize(normal - csm_internal_projectedbump);\n ")}),Dt(mi,"".concat(tt.depthAlpha),{"gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );":"\n gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity * ".concat(tt.depthAlpha," );\n "),"gl_FragColor = packDepthToRGBA( fragCoordZ );":"\n gl_FragColor = packDepthToRGBA( fragCoordZ );\n gl_FragColor.a *= ".concat(tt.depthAlpha,";\n ")}),mi),vie=(Xl={},Dt(Xl,"".concat(tt.position),{"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );":"\n gl_Position = projectionMatrix * modelViewMatrix * vec4( ".concat(tt.position,", 1.0 );\n ")}),Dt(Xl,"".concat(tt.positionRaw),{"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );":"\n gl_Position = ".concat(tt.position,";\n ")}),Dt(Xl,"".concat(tt.diffuseColor),{"gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );":"\n gl_FragColor = ".concat(tt.diffuseColor,";\n ")}),Dt(Xl,"".concat(tt.fragColor),{"gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );":"\n gl_FragColor = ".concat(tt.fragColor,";\n ")}),Xl),_ie="\n\n#ifdef IS_VERTEX\n // csm_Position & csm_PositionRaw\n #ifdef IS_UNKNOWN\n vec3 csm_Position = vec3(0.0);\n vec4 csm_PositionRaw = vec4(0.0);\n vec3 csm_Normal = vec3(0.0);\n #else\n vec3 csm_Position = position;\n vec4 csm_PositionRaw = projectionMatrix * modelViewMatrix * vec4(position, 1.);\n vec3 csm_Normal = normal;\n #endif\n\n // csm_PointSize\n #ifdef IS_POINTSMATERIAL\n float csm_PointSize = size;\n #endif\n#else\n // csm_DiffuseColor & csm_FragColor\n #if defined IS_UNKNOWN || defined IS_SHADERMATERIAL || defined IS_MESHDEPTHMATERIAL || defined IS_MESHNORMALMATERIAL || defined IS_SHADOWMATERIAL\n vec4 csm_DiffuseColor = vec4(1.0, 0.0, 1.0, 1.0);\n vec4 csm_FragColor = vec4(1.0, 0.0, 1.0, 1.0);\n #else\n #ifdef USE_MAP\n vec4 _csm_sampledDiffuseColor = texture2D(map, vMapUv);\n\n #ifdef DECODE_VIDEO_TEXTURE\n // inline sRGB decode (TODO: Remove this code when https://crbug.com/1256340 is solved)\n _csm_sampledDiffuseColor = vec4(mix(pow(_csm_sampledDiffuseColor.rgb * 0.9478672986 + vec3(0.0521327014), vec3(2.4)), _csm_sampledDiffuseColor.rgb * 0.0773993808, vec3(lessThanEqual(_csm_sampledDiffuseColor.rgb, vec3(0.04045)))), _csm_sampledDiffuseColor.w);\n #endif\n\n vec4 csm_DiffuseColor = vec4(diffuse, opacity) * _csm_sampledDiffuseColor;\n vec4 csm_FragColor = vec4(diffuse, opacity) * _csm_sampledDiffuseColor;\n #else\n vec4 csm_DiffuseColor = vec4(diffuse, opacity);\n vec4 csm_FragColor = vec4(diffuse, opacity);\n #endif\n #endif\n\n // csm_Emissive, csm_Roughness, csm_Metalness\n #if defined IS_MESHSTANDARDMATERIAL || defined IS_MESHPHYSICALMATERIAL\n vec3 csm_Emissive = emissive;\n float csm_Roughness = roughness;\n float csm_Metalness = metalness;\n #endif\n\n // csm_AO\n #if defined IS_MESHSTANDARDMATERIAL || defined IS_MESHPHYSICALMATERIAL || defined IS_MESHBASICMATERIAL || defined IS_MESHLAMBERTMATERIAL || defined IS_MESHPHONGMATERIAL || defined IS_MESHTOONMATERIAL\n float csm_AO = 0.0;\n #endif\n\n // csm_Bump\n #if defined IS_MESHLAMBERTMATERIAL || defined IS_MESHMATCAPMATERIAL || defined IS_MESHNORMALMATERIAL || defined IS_MESHPHONGMATERIAL || defined IS_MESHPHYSICALMATERIAL || defined IS_MESHSTANDARDMATERIAL || defined IS_MESHTOONMATERIAL || defined IS_SHADOWMATERIAL \n vec3 csm_Bump = vec3(0.0);\n #endif\n\n float csm_DepthAlpha = 1.0;\n#endif\n",yie="\n varying mat4 csm_internal_vModelViewMatrix;\n",bie="\n csm_internal_vModelViewMatrix = modelViewMatrix;\n",xie="\n varying mat4 csm_internal_vModelViewMatrix;\n",wie="\n \n",gi,Sie=(gi={},Dt(gi,"".concat(tt.position),"*"),Dt(gi,"".concat(tt.positionRaw),"*"),Dt(gi,"".concat(tt.normal),"*"),Dt(gi,"".concat(tt.pointSize),["PointsMaterial"]),Dt(gi,"".concat(tt.diffuseColor),"*"),Dt(gi,"".concat(tt.fragColor),"*"),Dt(gi,"".concat(tt.emissive),["MeshStandardMaterial","MeshPhysicalMaterial"]),Dt(gi,"".concat(tt.roughness),["MeshStandardMaterial","MeshPhysicalMaterial"]),Dt(gi,"".concat(tt.metalness),["MeshStandardMaterial","MeshPhysicalMaterial"]),Dt(gi,"".concat(tt.ao),["MeshStandardMaterial","MeshPhysicalMaterial","MeshBasicMaterial","MeshLambertMaterial","MeshPhongMaterial","MeshToonMaterial"]),Dt(gi,"".concat(tt.bump),["MeshLambertMaterial","MeshMatcapMaterial","MeshNormalMaterial","MeshPhongMaterial","MeshPhysicalMaterial","MeshStandardMaterial","MeshToonMaterial","ShadowMaterial"]),Dt(gi,"".concat(tt.depthAlpha),"*"),gi),Mie=["baseMaterial","fragmentShader","vertexShader","uniforms","patchMap","cacheKey","silent"],Eie=function(n,e,t){return n.split(e).join(t)},Tie=function(n){return n.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")},Aie=function(n,e){return new RegExp("\\b".concat(Tie(e),"\\b")).test(n)};function Cie(n){try{new n}catch(e){if(e.message.indexOf("is not a constructor")>=0)return!1}return!0}function Pie(n,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;Object.assign(n,e);var i=Object.getPrototypeOf(e);Object.entries(Object.getOwnPropertyDescriptors(i)).filter(function(r){var s=typeof r[1].get=="function",o=typeof r[1].set=="function",a=typeof r[1].value=="function",l=r[0]==="constructor";return(s||o||a)&&!l}).forEach(function(r){if(typeof n[r[0]]=="function"){t||console.warn("Function ".concat(r[0]," already exists on CSM, renaming to base_").concat(r[0]));var s="base_".concat(r[0]);n[s]=r[1].value.bind(n);return}Object.defineProperty(n,r[0],r[1])})}function Rie(n){var e=n.toString().trim(),t=e.substring(e.indexOf("{")+1,e.lastIndexOf("}"));return t.trim().length===0}function _T(n){return n.replace(/\s/g,"")}function Lie(n,e,t){var i=n.lastIndexOf(e);return i===-1?n:n.substring(0,i)+t+n.substring(i+e.length)}var Oie=function(n){die(t,n);var e=mie(t);function t(i){var r,s=i.baseMaterial,o=i.fragmentShader,a=i.vertexShader,l=i.uniforms,c=i.patchMap,u=i.cacheKey,h=i.silent,d=cie(i,Mie);uie(this,t);var f;if(Cie(s)?f=new s(d):(f=s,Object.assign(f,d)),f.type==="RawShaderMaterial")throw new Error("CustomShaderMaterial does not support RawShaderMaterial");r=e.call(this),Pie(bL(r),f,h),r.__csm={patchMap:c||{},fragmentShader:o||"",vertexShader:a||"",cacheKey:u,baseMaterial:s,instanceID:Gn.generateUUID(),type:f.type,isAlreadyExtended:!Rie(f.onBeforeCompile),cacheHash:"",silent:h},r.uniforms=jl(jl({},r.uniforms||{}),l||{});{var p=r.__csm,v=p.fragmentShader,m=p.vertexShader,g=r.uniforms;r.__csm.cacheHash=r.getCacheHash(),r.generateMaterial(v,m,g)}return r}return hie(t,[{key:"update",value:function(){var i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.uniforms=i.uniforms||this.uniforms,Object.assign(this.__csm,i);var r=this.__csm,s=r.fragmentShader,o=r.vertexShader,a=this.uniforms,l=this.getCacheHash();this.__csm.cacheHash=l,this.generateMaterial(s,o,a)}},{key:"clone",value:function(){var i={baseMaterial:this.__csm.baseMaterial,fragmentShader:this.__csm.fragmentShader,vertexShader:this.__csm.vertexShader,uniforms:this.uniforms,silent:this.__csm.silent,patchMap:this.__csm.patchMap,cacheKey:this.__csm.cacheKey},r=new this.constructor(i);return Object.assign(this,r),r}},{key:"getCacheHash",value:function(){var i=this.__csm,r=i.fragmentShader,s=i.vertexShader,o=this.uniforms,a=Object.values(o).reduce(function(c,u){var h=u.value;return c+JSON.stringify(h)},""),l=_T(r)+_T(s)+a;return l.trim().length>0?Nne(l):this.customProgramCacheKey()}},{key:"generateMaterial",value:function(i,r,s){var o=this,a=this.parseShader(i),l=this.parseShader(r);this.uniforms=s||{},this.customProgramCacheKey=function(){return o.__csm.cacheHash};var c=function(h){try{if(a){var d=o.patchShader(a,h.fragmentShader,!0);h.fragmentShader=o.getMaterialDefine()+d}if(l){var f=o.patchShader(l,h.vertexShader);h.vertexShader="#define IS_VERTEX;\n"+f,h.vertexShader=o.getMaterialDefine()+h.vertexShader}h.uniforms=jl(jl({},h.uniforms),o.uniforms),o.uniforms=h.uniforms}catch(p){console.error(p)}};if(this.__csm.isAlreadyExtended){var u=this.onBeforeCompile;this.onBeforeCompile=function(h,d){u(h,d),c(h)}}else this.onBeforeCompile=c;this.needsUpdate=!0}},{key:"patchShader",value:function(i,r,s){var o=this,a=r,l=jl(jl({},this.getPatchMapForMaterial()),this.__csm.patchMap);Object.keys(l).forEach(function(h){Object.keys(l[h]).forEach(function(d){var f=Sie[h],p=o.__csm.type;if(h==="*"||Aie(i.main,h))if(!f||Array.isArray(f)&&f.includes(p)||f==="*")a=Eie(a,d,l[h][d]);else throw new Error("CSM: ".concat(h," is not available in ").concat(p,". Shader cannot compile."))})}),a=a.replace("void main() {","\n #ifndef CSM_IS_HEAD_DEFAULTS_DEFINED\n ".concat(s?xie:yie,"\n #define CSM_IS_HEAD_DEFAULTS_DEFINED 1\n #endif\n\n ").concat(i.header,"\n \n void main() {\n #ifndef CSM_IS_DEFAULTS_DEFINED\n ").concat(_ie,"\n #define CSM_IS_DEFAULTS_DEFINED 1\n #endif\n \n #ifndef CSM_IS_MAIN_DEFAULTS_DEFINED\n ").concat(s?wie:bie,"\n #define CSM_IS_MAIN_DEFAULTS_DEFINED 1\n #endif\n\n // CSM_START\n "));var c=this.__csm.isAlreadyExtended,u=a.includes("// CSM_END");return c&&u?a=Lie(a,"// CSM_END","\n // CSM_END\n ".concat(i.main,"\n // CSM_END\n ")):a=a.replace("// CSM_START","\n // CSM_START\n ".concat(i.main,"\n // CSM_END\n ")),a=i.defines+a,a}},{key:"parseShader",value:function(i){if(i){var r=i.replace(/\/\*\*(.*?)\*\/|\/\/(.*?)\n/gm,""),s=tie(r),o=oie(s),a=o.map(function(u){return u.name}).indexOf("main"),l=mT(s.slice(0,a>=0?o[a].outer[0]:void 0)),c=a>=0?this.getShaderFromIndex(s,o[a].body):"";return{defines:"",header:l,main:c}}}},{key:"getMaterialDefine",value:function(){var i=this.__csm.type;return i?"#define IS_".concat(i.toUpperCase(),";\n"):"#define IS_UNKNOWN;\n"}},{key:"getPatchMapForMaterial",value:function(){switch(this.__csm.type){case"ShaderMaterial":return vie;default:return gie}}},{key:"getShaderFromIndex",value:function(i,r){return mT(i.slice(r[0],r[1]))}}]),t}(En);const Iie=["args"],Jre=Xe({__name:"index",props:{baseMaterial:{type:Function},vertexShader:{},fragmentShader:{},silent:{type:Boolean},uniforms:{}},setup(n,{expose:e}){const t=n,i=jn(null),{extend:r}=ur();return r({CustomShaderMaterial:Oie}),e({value:i}),(s,o)=>(nt(),Mt("TresCustomShaderMaterial",{ref_key:"customShaderMaterialClass",ref:i,args:[t]},null,8,Iie))}}),Die=["args"],Uie=["color"],Qre=Xe({__name:"Box",props:{args:{default:()=>[1,1,1]},color:{default:"#ffffff"}},setup(n,{expose:e}){const t=n,{args:i,color:r}=Or(t),s=jn();return e({value:s}),(o,a)=>(nt(),Mt("TresMesh",Cr({ref_key:"boxRef",ref:s},o.$attrs),[ei("TresBoxGeometry",{args:Se(i)},null,8,Die),Ei(o.$slots,"default",{},()=>[ei("TresMeshBasicMaterial",{color:Se(r)},null,8,Uie)])],16))}});new Pi;new D;Ue.line={worldUnits:{value:1},linewidth:{value:1},resolution:{value:new _e(1,1)},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}};er.line={uniforms:km.merge([Ue.common,Ue.fog,Ue.line]),vertexShader:"\n #include <common>\n #include <color_pars_vertex>\n #include <fog_pars_vertex>\n #include <logdepthbuf_pars_vertex>\n #include <clipping_planes_pars_vertex>\n\n uniform float linewidth;\n uniform vec2 resolution;\n\n attribute vec3 instanceStart;\n attribute vec3 instanceEnd;\n\n attribute vec3 instanceColorStart;\n attribute vec3 instanceColorEnd;\n\n #ifdef WORLD_UNITS\n\n varying vec4 worldPos;\n varying vec3 worldStart;\n varying vec3 worldEnd;\n\n #ifdef USE_DASH\n\n varying vec2 vUv;\n\n #endif\n\n #else\n\n varying vec2 vUv;\n\n #endif\n\n #ifdef USE_DASH\n\n uniform float dashScale;\n attribute float instanceDistanceStart;\n attribute float instanceDistanceEnd;\n varying float vLineDistance;\n\n #endif\n\n void trimSegment( const in vec4 start, inout vec4 end ) {\n\n // trim end segment so it terminates between the camera plane and the near plane\n\n // conservative estimate of the near plane\n float a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column\n float b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column\n float nearEstimate = - 0.5 * b / a;\n\n float alpha = ( nearEstimate - start.z ) / ( end.z - start.z );\n\n end.xyz = mix( start.xyz, end.xyz, alpha );\n\n }\n\n void main() {\n\n #ifdef USE_COLOR\n\n vColor.xyz = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd;\n\n #endif\n\n #ifdef USE_DASH\n\n vLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd;\n vUv = uv;\n\n #endif\n\n float aspect = resolution.x / resolution.y;\n\n // camera space\n vec4 start = modelViewMatrix * vec4( instanceStart, 1.0 );\n vec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 );\n\n #ifdef WORLD_UNITS\n\n worldStart = start.xyz;\n worldEnd = end.xyz;\n\n #else\n\n vUv = uv;\n\n #endif\n\n // special case for perspective projection, and segments that terminate either in, or behind, the camera plane\n // clearly the gpu firmware has a way of addressing this issue when projecting into ndc space\n // but we need to perform ndc-space calculations in the shader, so we must address this issue directly\n // perhaps there is a more elegant solution -- WestLangley\n\n bool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column\n\n if ( perspective ) {\n\n if ( start.z < 0.0 && end.z >= 0.0 ) {\n\n trimSegment( start, end );\n\n } else if ( end.z < 0.0 && start.z >= 0.0 ) {\n\n trimSegment( end, start );\n\n }\n\n }\n\n // clip space\n vec4 clipStart = projectionMatrix * start;\n vec4 clipEnd = projectionMatrix * end;\n\n // ndc space\n vec3 ndcStart = clipStart.xyz / clipStart.w;\n vec3 ndcEnd = clipEnd.xyz / clipEnd.w;\n\n // direction\n vec2 dir = ndcEnd.xy - ndcStart.xy;\n\n // account for clip-space aspect ratio\n dir.x *= aspect;\n dir = normalize( dir );\n\n #ifdef WORLD_UNITS\n\n // get the offset direction as perpendicular to the view vector\n vec3 worldDir = normalize( end.xyz - start.xyz );\n vec3 offset;\n if ( position.y < 0.5 ) {\n\n offset = normalize( cross( start.xyz, worldDir ) );\n\n } else {\n\n offset = normalize( cross( end.xyz, worldDir ) );\n\n }\n\n // sign flip\n if ( position.x < 0.0 ) offset *= - 1.0;\n\n float forwardOffset = dot( worldDir, vec3( 0.0, 0.0, 1.0 ) );\n\n // don't extend the line if we're rendering dashes because we\n // won't be rendering the endcaps\n #ifndef USE_DASH\n\n // extend the line bounds to encompass endcaps\n start.xyz += - worldDir * linewidth * 0.5;\n end.xyz += worldDir * linewidth * 0.5;\n\n // shift the position of the quad so it hugs the forward edge of the line\n offset.xy -= dir * forwardOffset;\n offset.z += 0.5;\n\n #endif\n\n // endcaps\n if ( position.y > 1.0 || position.y < 0.0 ) {\n\n offset.xy += dir * 2.0 * forwardOffset;\n\n }\n\n // adjust for linewidth\n offset *= linewidth * 0.5;\n\n // set the world position\n worldPos = ( position.y < 0.5 ) ? start : end;\n worldPos.xyz += offset;\n\n // project the worldpos\n vec4 clip = projectionMatrix * worldPos;\n\n // shift the depth of the projected points so the line\n // segments overlap neatly\n vec3 clipPose = ( position.y < 0.5 ) ? ndcStart : ndcEnd;\n clip.z = clipPose.z * clip.w;\n\n #else\n\n vec2 offset = vec2( dir.y, - dir.x );\n // undo aspect ratio adjustment\n dir.x /= aspect;\n offset.x /= aspect;\n\n // sign flip\n if ( position.x < 0.0 ) offset *= - 1.0;\n\n // endcaps\n if ( position.y < 0.0 ) {\n\n offset += - dir;\n\n } else if ( position.y > 1.0 ) {\n\n offset += dir;\n\n }\n\n // adjust for linewidth\n offset *= linewidth;\n\n // adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ...\n offset /= resolution.y;\n\n // select end\n vec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd;\n\n // back to clip space\n offset *= clip.w;\n\n clip.xy += offset;\n\n #endif\n\n gl_Position = clip;\n\n vec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation\n\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <fog_vertex>\n\n }\n ",fragmentShader:"\n uniform vec3 diffuse;\n uniform float opacity;\n uniform float linewidth;\n\n #ifdef USE_DASH\n\n uniform float dashOffset;\n uniform float dashSize;\n uniform float gapSize;\n\n #endif\n\n varying float vLineDistance;\n\n #ifdef WORLD_UNITS\n\n varying vec4 worldPos;\n varying vec3 worldStart;\n varying vec3 worldEnd;\n\n #ifdef USE_DASH\n\n varying vec2 vUv;\n\n #endif\n\n #else\n\n varying vec2 vUv;\n\n #endif\n\n #include <common>\n #include <color_pars_fragment>\n #include <fog_pars_fragment>\n #include <logdepthbuf_pars_fragment>\n #include <clipping_planes_pars_fragment>\n\n vec2 closestLineToLine(vec3 p1, vec3 p2, vec3 p3, vec3 p4) {\n\n float mua;\n float mub;\n\n vec3 p13 = p1 - p3;\n vec3 p43 = p4 - p3;\n\n vec3 p21 = p2 - p1;\n\n float d1343 = dot( p13, p43 );\n float d4321 = dot( p43, p21 );\n float d1321 = dot( p13, p21 );\n float d4343 = dot( p43, p43 );\n float d2121 = dot( p21, p21 );\n\n float denom = d2121 * d4343 - d4321 * d4321;\n\n float numer = d1343 * d4321 - d1321 * d4343;\n\n mua = numer / denom;\n mua = clamp( mua, 0.0, 1.0 );\n mub = ( d1343 + d4321 * ( mua ) ) / d4343;\n mub = clamp( mub, 0.0, 1.0 );\n\n return vec2( mua, mub );\n\n }\n\n void main() {\n\n #include <clipping_planes_fragment>\n\n #ifdef USE_DASH\n\n if ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps\n\n if ( mod( vLineDistance + dashOffset, dashSize + gapSize ) > dashSize ) discard; // todo - FIX\n\n #endif\n\n float alpha = opacity;\n\n #ifdef WORLD_UNITS\n\n // Find the closest points on the view ray and the line segment\n vec3 rayEnd = normalize( worldPos.xyz ) * 1e5;\n vec3 lineDir = worldEnd - worldStart;\n vec2 params = closestLineToLine( worldStart, worldEnd, vec3( 0.0, 0.0, 0.0 ), rayEnd );\n\n vec3 p1 = worldStart + lineDir * params.x;\n vec3 p2 = rayEnd * params.y;\n vec3 delta = p1 - p2;\n float len = length( delta );\n float norm = len / linewidth;\n\n #ifndef USE_DASH\n\n #ifdef USE_ALPHA_TO_COVERAGE\n\n float dnorm = fwidth( norm );\n alpha = 1.0 - smoothstep( 0.5 - dnorm, 0.5 + dnorm, norm );\n\n #else\n\n if ( norm > 0.5 ) {\n\n discard;\n\n }\n\n #endif\n\n #endif\n\n #else\n\n #ifdef USE_ALPHA_TO_COVERAGE\n\n // artifacts appear on some hardware if a derivative is taken within a conditional\n float a = vUv.x;\n float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n float len2 = a * a + b * b;\n float dlen = fwidth( len2 );\n\n if ( abs( vUv.y ) > 1.0 ) {\n\n alpha = 1.0 - smoothstep( 1.0 - dlen, 1.0 + dlen, len2 );\n\n }\n\n #else\n\n if ( abs( vUv.y ) > 1.0 ) {\n\n float a = vUv.x;\n float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n float len2 = a * a + b * b;\n\n if ( len2 > 1.0 ) discard;\n\n }\n\n #endif\n\n #endif\n\n vec4 diffuseColor = vec4( diffuse, alpha );\n\n #include <logdepthbuf_fragment>\n #include <color_fragment>\n\n gl_FragColor = vec4( diffuseColor.rgb, alpha );\n\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n\n }\n "};new D;new D;new vt;new vt;new vt;new D;new ze;new L3;new D;new Pi;new Ri;new vt;const Nie=["args"],Fie=["color"],ese=Xe({__name:"Sphere",props:{args:{default:()=>[2,32,16]},color:{default:"#ffffff"}},setup(n,{expose:e}){const t=n,{args:i,color:r}=Or(t),s=jn();return e({value:s}),(o,a)=>(nt(),Mt("TresMesh",Cr({ref_key:"sphereRef",ref:s},o.$attrs),[ei("TresSphereGeometry",{args:Se(i)},null,8,Nie),Ei(o.$slots,"default",{},()=>[ei("TresMeshBasicMaterial",{color:Se(r)},null,8,Fie)])],16))}}),kie=["size","color","alpha-map","map","opacity","alpha-test","depth-write","transparent","size-attenuation"],Bie=["position","velocity"],tse=Xe({__name:"Precipitation",props:{size:{default:.1},area:{default:()=>[10,10,20]},color:{default:16777215},map:{},alphaMap:{},alphaTest:{default:.01},opacity:{default:.8},count:{default:5e3},speed:{default:.1},randomness:{default:.5},depthWrite:{type:Boolean,default:!1},transparent:{type:Boolean,default:!0},sizeAttenuation:{type:Boolean,default:!0}},setup(n){const e=n,{size:t,area:i,color:r,alphaMap:s,map:o,opacity:a,alphaTest:l,depthWrite:c,transparent:u,sizeAttenuation:h,count:d,speed:f,randomness:p}=Or(e),v=jn();let m=[],g=[];const b=()=>{m=new Float32Array(d.value*3);for(let T=0;T<d.value;T++){const S=T*3;m[S]=(Math.random()-.5)*i.value[0],m[S+1]=(Math.random()-.5)*i.value[1],m[S+2]=(Math.random()-.5)*i.value[2]}},_=()=>{g=new Float32Array(d.value*2);for(let T=0;T<d.value*2;T+=2)g[T]=(Math.random()-.5)/5*f.value*p.value,g[T+1]=Math.random()/5*f.value+.01};_(),b(),ar(()=>{_(),b()});const{onLoop:y}=dr();return y(()=>{var T,S;if((T=v.value)!=null&&T.attributes.position.array&&(S=v.value)!=null&&S.attributes.position.count){const E=v.value.attributes.position.array;for(let x=0;x<v.value.attributes.position.count;x++){const M=g[x*2],w=g[x*2+1];E[x*3]+=M,E[x*3+1]-=w,(E[x*3]<=-i.value[0]/2||E[x*3]>=i.value[0]/2)&&(E[x*3]=E[x*3]*-1),(E[x*3+1]<=-i.value[1]/2||E[x*3+1]>=i.value[1]/2)&&(E[x*3+1]=E[x*3+1]*-1)}v.value.attributes.position.needsUpdate=!0}}),(T,S)=>(nt(),Mt("TresPoints",null,[ei("TresPointsMaterial",{size:Se(t),color:Se(r),"alpha-map":Se(s),map:Se(o),opacity:Se(a),"alpha-test":Se(l),"depth-write":Se(c),transparent:Se(u),"size-attenuation":Se(h)},null,8,kie),ei("TresBufferGeometry",{ref_key:"geometryRef",ref:v,position:[Se(m),3],velocity:[Se(g)]},null,8,Bie)]))}});class mx extends Be{constructor(){const e=mx.SkyShader,t=new cr({name:e.name,uniforms:km.clone(e.uniforms),vertexShader:e.vertexShader,fragmentShader:e.fragmentShader,side:Qn,depthWrite:!1});super(new ai(1,1,1),t),this.isSky=!0}}mx.SkyShader={name:"SkyShader",uniforms:{turbidity:{value:2},rayleigh:{value:1},mieCoefficient:{value:.005},mieDirectionalG:{value:.8},sunPosition:{value:new D},up:{value:new D(0,1,0)}},vertexShader:"\n uniform vec3 sunPosition;\n uniform float rayleigh;\n uniform float turbidity;\n uniform float mieCoefficient;\n uniform vec3 up;\n\n varying vec3 vWorldPosition;\n varying vec3 vSunDirection;\n varying float vSunfade;\n varying vec3 vBetaR;\n varying vec3 vBetaM;\n varying float vSunE;\n\n // constants for atmospheric scattering\n const float e = 2.71828182845904523536028747135266249775724709369995957;\n const float pi = 3.141592653589793238462643383279502884197169;\n\n // wavelength of used primaries, according to preetham\n const vec3 lambda = vec3( 680E-9, 550E-9, 450E-9 );\n // this pre-calcuation replaces older TotalRayleigh(vec3 lambda) function:\n // (8.0 * pow(pi, 3.0) * pow(pow(n, 2.0) - 1.0, 2.0) * (6.0 + 3.0 * pn)) / (3.0 * N * pow(lambda, vec3(4.0)) * (6.0 - 7.0 * pn))\n const vec3 totalRayleigh = vec3( 5.804542996261093E-6, 1.3562911419845635E-5, 3.0265902468824876E-5 );\n\n // mie stuff\n // K coefficient for the primaries\n const float v = 4.0;\n const vec3 K = vec3( 0.686, 0.678, 0.666 );\n // MieConst = pi * pow( ( 2.0 * pi ) / lambda, vec3( v - 2.0 ) ) * K\n const vec3 MieConst = vec3( 1.8399918514433978E14, 2.7798023919660528E14, 4.0790479543861094E14 );\n\n // earth shadow hack\n // cutoffAngle = pi / 1.95;\n const float cutoffAngle = 1.6110731556870734;\n const float steepness = 1.5;\n const float EE = 1000.0;\n\n float sunIntensity( float zenithAngleCos ) {\n zenithAngleCos = clamp( zenithAngleCos, -1.0, 1.0 );\n return EE * max( 0.0, 1.0 - pow( e, -( ( cutoffAngle - acos( zenithAngleCos ) ) / steepness ) ) );\n }\n\n vec3 totalMie( float T ) {\n float c = ( 0.2 * T ) * 10E-18;\n return 0.434 * c * MieConst;\n }\n\n void main() {\n\n vec4 worldPosition = modelMatrix * vec4( position, 1.0 );\n vWorldPosition = worldPosition.xyz;\n\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n gl_Position.z = gl_Position.w; // set z to camera.far\n\n vSunDirection = normalize( sunPosition );\n\n vSunE = sunIntensity( dot( vSunDirection, up ) );\n\n vSunfade = 1.0 - clamp( 1.0 - exp( ( sunPosition.y / 450000.0 ) ), 0.0, 1.0 );\n\n float rayleighCoefficient = rayleigh - ( 1.0 * ( 1.0 - vSunfade ) );\n\n // extinction (absorbtion + out scattering)\n // rayleigh coefficients\n vBetaR = totalRayleigh * rayleighCoefficient;\n\n // mie coefficients\n vBetaM = totalMie( turbidity ) * mieCoefficient;\n\n }",fragmentShader:"\n varying vec3 vWorldPosition;\n varying vec3 vSunDirection;\n varying float vSunfade;\n varying vec3 vBetaR;\n varying vec3 vBetaM;\n varying float vSunE;\n\n uniform float mieDirectionalG;\n uniform vec3 up;\n\n // constants for atmospheric scattering\n const float pi = 3.141592653589793238462643383279502884197169;\n\n const float n = 1.0003; // refractive index of air\n const float N = 2.545E25; // number of molecules per unit volume for air at 288.15K and 1013mb (sea level -45 celsius)\n\n // optical length at zenith for molecules\n const float rayleighZenithLength = 8.4E3;\n const float mieZenithLength = 1.25E3;\n // 66 arc seconds -> degrees, and the cosine of that\n const float sunAngularDiameterCos = 0.999956676946448443553574619906976478926848692873900859324;\n\n // 3.0 / ( 16.0 * pi )\n const float THREE_OVER_SIXTEENPI = 0.05968310365946075;\n // 1.0 / ( 4.0 * pi )\n const float ONE_OVER_FOURPI = 0.07957747154594767;\n\n float rayleighPhase( float cosTheta ) {\n return THREE_OVER_SIXTEENPI * ( 1.0 + pow( cosTheta, 2.0 ) );\n }\n\n float hgPhase( float cosTheta, float g ) {\n float g2 = pow( g, 2.0 );\n float inverse = 1.0 / pow( 1.0 - 2.0 * g * cosTheta + g2, 1.5 );\n return ONE_OVER_FOURPI * ( ( 1.0 - g2 ) * inverse );\n }\n\n void main() {\n\n vec3 direction = normalize( vWorldPosition - cameraPosition );\n\n // optical length\n // cutoff angle at 90 to avoid singularity in next formula.\n float zenithAngle = acos( max( 0.0, dot( up, direction ) ) );\n float inverse = 1.0 / ( cos( zenithAngle ) + 0.15 * pow( 93.885 - ( ( zenithAngle * 180.0 ) / pi ), -1.253 ) );\n float sR = rayleighZenithLength * inverse;\n float sM = mieZenithLength * inverse;\n\n // combined extinction factor\n vec3 Fex = exp( -( vBetaR * sR + vBetaM * sM ) );\n\n // in scattering\n float cosTheta = dot( direction, vSunDirection );\n\n float rPhase = rayleighPhase( cosTheta * 0.5 + 0.5 );\n vec3 betaRTheta = vBetaR * rPhase;\n\n float mPhase = hgPhase( cosTheta, mieDirectionalG );\n vec3 betaMTheta = vBetaM * mPhase;\n\n vec3 Lin = pow( vSunE * ( ( betaRTheta + betaMTheta ) / ( vBetaR + vBetaM ) ) * ( 1.0 - Fex ), vec3( 1.5 ) );\n Lin *= mix( vec3( 1.0 ), pow( vSunE * ( ( betaRTheta + betaMTheta ) / ( vBetaR + vBetaM ) ) * Fex, vec3( 1.0 / 2.0 ) ), clamp( pow( 1.0 - dot( up, vSunDirection ), 5.0 ), 0.0, 1.0 ) );\n\n // nightsky\n float theta = acos( direction.y ); // elevation --> y-axis, [-pi/2, pi/2]\n float phi = atan( direction.z, direction.x ); // azimuth --> x-axis [-pi/2, pi/2]\n vec2 uv = vec2( phi, theta ) / vec2( 2.0 * pi, pi ) + vec2( 0.5, 0.0 );\n vec3 L0 = vec3( 0.1 ) * Fex;\n\n // composition + solar disc\n float sundisk = smoothstep( sunAngularDiameterCos, sunAngularDiameterCos + 0.00002, cosTheta );\n L0 += ( vSunE * 19000.0 * Fex ) * sundisk;\n\n vec3 texColor = ( Lin + L0 ) * 0.04 + vec3( 0.0, 0.0003, 0.00075 );\n\n vec3 retColor = pow( texColor, vec3( 1.0 / ( 1.2 + ( 1.2 * vSunfade ) ) ) );\n\n gl_FragColor = vec4( retColor, 1.0 );\n\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n\n }"};const zie=["position","a-scale"],Vie=["size","size-attenuation","transparent","alpha-test","alpha-map"],nse=Xe({__name:"Stars",props:{size:{default:.1},sizeAttenuation:{type:Boolean,default:!0},transparent:{type:Boolean,default:!0},alphaTest:{default:.01},count:{default:5e3},depth:{default:50},radius:{default:100},alphaMap:{default:null}},setup(n,{expose:e}){const t=n,i=xe(),r=xe(),{radius:s,depth:o,count:a,size:l,sizeAttenuation:c,transparent:u,alphaMap:h,alphaTest:d}=Or(t),f=()=>{let v=s.value+o.value;const m=Te(()=>o.value/a.value),g=[],b=Array.from({length:a.value},()=>(.5+.5*Math.random())*4),_=y=>new D().setFromSpherical(new Xh(y,Math.acos(1-Math.random()*2),Math.random()*2*Math.PI)).toArray();for(let y=0;y<a.value;y++)v-=m.value*Math.random(),g.push(..._(v));i.value=new Float32Array(g),r.value=new Float32Array(b)};ar(()=>{f()});const p=jn();return e({value:p}),(v,m)=>(nt(),Mt("TresPoints",{ref_key:"starsRef",ref:p},[ei("TresBufferGeometry",{position:[i.value,3],"a-scale":[r.value,1]},null,8,zie),ei("TresPointsMaterial",{size:Se(l),"size-attenuation":Se(c),transparent:Se(u),"alpha-test":Se(d),"alpha-map":Se(h)},null,8,Vie)],512))}});let bs;const ise=(n="body")=>{bs||(bs=new mee({container:document.querySelector(n)}),bs.element.style.position="absolute",bs.element.style.top="1rem",bs.element.style.right="1rem",bs.element.style.zIndex="9999");const{logWarning:e}=hL();e("useTweakPane is going to be deprecated soon and will no longer be part of this package, please start migrating to @tresjs/leches package https://github.com/Tresjs/leches or v-tweakpane https://github.com/vinayakkulkarni/v-tweakpane instead.");function t(){bs&&bs.dispose()}return bn(()=>{const{resume:i}=dr();i()}),Ci(()=>{t()}),{pane:bs,disposeTweakPane:t}};var xL={exports:{}};(function(n,e){(function(t,i){n.exports=i()})(Dne,function(){var t=function(){function i(f){return o.appendChild(f.dom),f}function r(f){for(var p=0;p<o.children.length;p++)o.children[p].style.display=p===f?"block":"none";s=f}var s=0,o=document.createElement("div");o.style.cssText="position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000",o.addEventListener("click",function(f){f.preventDefault(),r(++s%o.children.length)},!1);var a=(performance||Date).now(),l=a,c=0,u=i(new t.Panel("FPS","#0ff","#002")),h=i(new t.Panel("MS","#0f0","#020"));if(self.performance&&self.performance.memory)var d=i(new t.Panel("MB","#f08","#201"));return r(0),{REVISION:16,dom:o,addPanel:i,showPanel:r,begin:function(){a=(performance||Date).now()},end:function(){c++;var f=(performance||Date).now();if(h.update(f-a,200),f>l+1e3&&(u.update(1e3*c/(f-l),100),l=f,c=0,d)){var p=performance.memory;d.update(p.usedJSHeapSize/1048576,p.jsHeapSizeLimit/1048576)}return f},update:function(){a=this.end()},domElement:o,setMode:r}};return t.Panel=function(i,r,s){var o=1/0,a=0,l=Math.round,c=l(window.devicePixelRatio||1),u=80*c,h=48*c,d=3*c,f=2*c,p=3*c,v=15*c,m=74*c,g=30*c,b=document.createElement("canvas");b.width=u,b.height=h,b.style.cssText="width:80px;height:48px";var _=b.getContext("2d");return _.font="bold "+9*c+"px Helvetica,Arial,sans-serif",_.textBaseline="top",_.fillStyle=s,_.fillRect(0,0,u,h),_.fillStyle=r,_.fillText(i,d,f),_.fillRect(p,v,m,g),_.fillStyle=s,_.globalAlpha=.9,_.fillRect(p,v,m,g),{dom:b,update:function(y,T){o=Math.min(o,y),a=Math.max(a,y),_.fillStyle=s,_.globalAlpha=1,_.fillRect(0,0,u,v),_.fillStyle=r,_.fillText(l(y)+" "+i+" ("+l(o)+"-"+l(a)+")",d,f),_.drawImage(b,p+c,v,m-c,g,p,v,m-c,g),_.fillRect(p+m-c,v,c,g),_.fillStyle=s,_.globalAlpha=.9,_.fillRect(p+m-c,v,c,l((1-y/T)*g))}}},t})})(xL);var Hie=xL.exports;const Gie=Cd(Hie),rse=Xe({name:"Stats",props:{showPanel:{type:Number,default:0}},setup(n,{expose:e}){const t=new Gie;e({stats:t});const i=document.body;t.showPanel(n.showPanel||0),i==null||i.appendChild(t.dom);const{onBeforeLoop:r,onAfterLoop:s,resume:o}=dr();return o(),r(()=>t.begin()),s(()=>t.end()),Ci(()=>{i==null||i.removeChild(t.dom)}),null}});var Wie="#include <common>\n\nvoid main() {\n vec2 center = vec2(0., 1.);\n float rotation = 0.0;\n\n \n \n float size = 0.03;\n\n vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n vec2 scale;\n scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n\n bool isPerspective = isPerspectiveMatrix( projectionMatrix );\n if ( isPerspective ) scale *= - mvPosition.z;\n\n vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale * size;\n vec2 rotatedPosition;\n rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n mvPosition.xy += rotatedPosition;\n\n gl_Position = projectionMatrix * mvPosition;\n}",$ie="void main() {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);\n}";const Pd=new D(0,0,0),gx=new D(0,0,0),jie=new D(0,0,0);function yT(n,e,t){const i=Pd.setFromMatrixPosition(n.matrixWorld);i.project(e);const r=t.width/2,s=t.height/2;return[(Number.isNaN(i.x)?0:i.x)*r+r,-(i.y*s)+s]}function Xie(n,e){const t=Pd.setFromMatrixPosition(n.matrixWorld),i=gx.setFromMatrixPosition(e.matrixWorld),r=t.sub(i),s=e.getWorldDirection(jie);return r.angleTo(s)>Math.PI/2}function Yie(n,e,t,i){const r=Pd.setFromMatrixPosition(n.matrixWorld),s=r.clone();s.project(e),t.setFromCamera(new _e(s.x,s.y),e);const o=t.intersectObjects(i,!0);if(o.length>0){const a=o[0].distance;return r.distanceTo(t.ray.origin)<a}return!0}function qie(n,e){if(e instanceof zi)return e.zoom;if(e instanceof Nt){const t=Pd.setFromMatrixPosition(n.matrixWorld),i=gx.setFromMatrixPosition(e.matrixWorld),r=e.fov*Math.PI/180,s=t.distanceTo(i);return 1/(2*Math.tan(r/2)*s)}else return 1}function Kie(n,e,t){if(e instanceof Nt||e instanceof zi){const i=Pd.setFromMatrixPosition(n.matrixWorld),r=gx.setFromMatrixPosition(e.matrixWorld),s=i.distanceTo(r),o=(t[1]-t[0])/(e.far-e.near),a=t[1]-o*e.far;return Math.round(o*s+a)}}const k_=n=>Math.abs(n)<1e-10?0:n;function wL(n,e,t=""){let i="matrix3d(";for(let r=0;r!==16;r++)i+=k_(e[r]*n.elements[r])+(r!==15?",":")");return t+i}const Zie=(n=>e=>wL(e,n))([1,-1,1,1,1,-1,1,1,1,-1,1,1,1,-1,1,1]),Jie=(n=>(e,t)=>wL(e,n(t),"translate(-50%,-50%)"))(n=>[1/n,1/n,1/n,1,-1/n,-1/n,-1/n,-1,1/n,1/n,1/n,1,1,1,1,1]),Qie=["geometry","material"],sse=Xe({__name:"HTML",props:{geometry:{default:new Ni},material:{},as:{default:"div"},transform:{type:Boolean,default:!1},portal:{},wrapperClass:{},eps:{default:1e-4},distanceFactor:{},fullscreen:{type:Boolean},center:{type:Boolean},pointerEvents:{default:"auto"},sprite:{type:Boolean,default:!1},zIndexRange:{default:()=>[16777271,0]},occlude:{type:[Array,Boolean,String]}},emits:["onOcclude"],setup(n,{emit:e}){const t=n,i=e,r=eI(),s=sA(),o=xe(),a=xe(),{geometry:l,material:c,as:u,transform:h,portal:d,wrapperClass:f,eps:p,distanceFactor:v,fullscreen:m,center:g,pointerEvents:b,sprite:_,occlude:y,zIndexRange:T}=Or(t),{renderer:S,scene:E,camera:x,raycaster:M,sizes:w}=ur(),C=Te(()=>document.createElement(u.value)),L=xe([0,0]),$=xe(0),U=xe(),H=Te(()=>h.value?{position:"absolute",top:0,left:0,width:"".concat(w.width.value,"px"),height:"".concat(w.height.value,"px"),transformStyle:"preserve-3d",pointerEvents:"none",zIndex:2,willChange:"transform"}:ii(Bt(ii(Bt({position:"absolute",transform:g.value?"translate3d(-50%,-50%,0)":"none"},m.value&&{top:-w.height.value/2,left:-w.width.value/2,width:"".concat(w.width.value,"px"),height:"".concat(w.height.value,"px")}),{zIndex:2}),r.style),{willChange:"transform"})),V=Te(()=>({position:"absolute",pointerEvents:b.value})),j=xe(null),te=xe(!1),Z=Te(()=>(y==null?void 0:y.value)&&(y==null?void 0:y.value)!=="blending"||Array.isArray(y==null?void 0:y.value)&&(y==null?void 0:y.value.length)&&yn(y.value[0]));ft(()=>y,we=>{we&&we==="blending"?(C.value.style.zIndex="".concat(Math.floor(T.value[0]/2)),C.value.style.position="absolute",C.value.style.pointerEvents="none"):(C.value.style.zIndex=null,C.value.style.position=null,C.value.style.pointerEvents=null)}),ft(()=>{var we;return[o.value,S.value,w.width.value,w.height.value,(we=s.default)==null?void 0:we.call(s)]},([we,Re])=>{var De,ne,q,P,N,B;if(we&&Re){const A=(d==null?void 0:d.value)||Re.domElement;if((De=E.value)==null||De.updateMatrixWorld(),h.value)C.value.style.cssText="position:absolute;top:0;left:0;pointer-events:none;overflow:hidden;";else{const R=yT(we,x.value,{width:w.width.value,height:w.height.value});C.value.style.cssText="position:absolute;top:0;left:0;transform:translate3d(".concat(R[0],"px,").concat(R[1],"px,0);transform-origin:0 0;")}A&&!C.value.parentNode&&((ne=A.parentNode)==null||ne.appendChild(C.value)),h.value?U.value=ie("div",{id:"outer",style:H.value},[ie("div",{id:"inner",style:V.value},[ie("div",{key:(q=a.value)==null?void 0:q.uuid,id:E==null?void 0:E.value.uuid,class:r.class,style:r.style},(P=s.default)==null?void 0:P.call(s))])]):U.value=ie("div",{key:(N=a.value)==null?void 0:N.uuid,id:E==null?void 0:E.value.uuid,style:H.value},(B=s.default)==null?void 0:B.call(s)),oD(U.value,C.value)}}),ar(()=>{f!=null&&f.value&&(C.value.className=f.value)});const Q=xe(!0),{onLoop:X}=dr();X(()=>{var we,Re,De,ne,q,P,N;if(o.value&&x.value&&S.value){(we=x.value)==null||we.updateMatrixWorld(),o.value.updateWorldMatrix(!0,!1);const B=h.value?L.value:yT(o.value,x.value,{width:w.width.value||0,height:w.height.value||0});if(h.value||Math.abs($.value-x.value.zoom)>p.value||Math.abs(L.value[0]-B[0])>p.value||Math.abs(L.value[1]-B[1])>p.value){const A=Xie(o.value,x.value);let R=!1;Z.value&&(Array.isArray(y==null?void 0:y.value)?R=y==null?void 0:y.value:(y==null?void 0:y.value)!=="blending"&&(R=[E.value]));const I=Q.value;if(R){const ee=Yie(o.value,x.value,M.value,R);Q.value=ee&&!A}else Q.value=!A;I!==Q.value&&(i("onOcclude",!Q.value),C.value.style.display=Q.value?"block":"none");const z=Math.floor(T.value[0]/2),G=y!=null&&y.value?Z.value?[T.value[0],z]:[z-1,0]:T.value;if(C.value.style.zIndex="".concat(Kie(o.value,x.value,G)),C.value.style.willChange="transform",h.value){const[ee,ae]=[w.width.value/2,w.height.value/2],se=x.value.projectionMatrix.elements[5]*ae,{isOrthographicCamera:ce,top:le,left:Me,bottom:F,right:O}=x.value,J=Zie(x.value.matrixWorldInverse),ge=ce?"scale(".concat(se,")translate(").concat(k_(-(O+Me)/2),"px,").concat(k_((le+F)/2),"px)"):"translateZ(".concat(se,"px)");let de=o.value.matrixWorld;_.value&&(de=x.value.matrixWorldInverse.clone().transpose().copyPosition(de).scale(o.value.scale),de.elements[3]=de.elements[7]=de.elements[11]=0,de.elements[15]=1),C.value.style.width="".concat(w.width.value,"px"),C.value.style.height="".concat(w.height.value,"px"),C.value.style.perspective=ce?"":"".concat(se,"px"),(Re=U.value)!=null&&Re.el&&(De=U.value)!=null&&De.children&&(U.value.el.style.willChange="transform",U.value.el.style.transform="".concat(ge).concat(J,"translate(").concat(ee,"px,").concat(ae,"px)"),U.value.children[0].willChange="transform",U.value.children[0].el.style.transform=Jie(de,1/(((v==null?void 0:v.value)||10)/400)))}else{const ee=(v==null?void 0:v.value)===void 0?1:qie(o.value,x.value)*(v==null?void 0:v.value);C.value.style.transform="translate3d(".concat(B[0],"px,").concat(B[1],"px,0) scale(").concat(ee,")")}}L.value=B,$.value=x.value.zoom}if(!Z.value&&a.value&&!te.value)if(h.value){if((ne=U.value)!=null&&ne.el&&(q=U.value)!=null&&q.children){const B=(P=U.value)==null?void 0:P.children[0];if(B!=null&&B.clientWidth&&B!=null&&B.clientHeight){const{isOrthographicCamera:A}=x.value;if(A||l)r.scale&&(Array.isArray(r.scale)?r.scale instanceof D?a.value.scale.copy(r.scale.clone().divideScalar(1)):a.value.scale.set(1/r.scale[0],1/r.scale[1],1/r.scale[2]):a.value.scale.setScalar(1/r.scale));else{const R=((v==null?void 0:v.value)||10)/400,I=B.clientWidth*R,z=B.clientHeight*R;a.value.scale.set(I,z,1)}te.value=!0}}}else{const B=C.value.children[0];if(B!=null&&B.clientWidth&&B!=null&&B.clientHeight){const A=B.clientWidth*1,R=B.clientHeight*1;a.value.scale.set(A,R,1),te.value=!0}j.value.lookAt((N=x.value)==null?void 0:N.position)}});const re=Te(()=>({vertexShader:h.value?void 0:Wie,fragmentShader:$ie})),W=Te(()=>{const we=re.value;return c.value||new cr({vertexShader:we.vertexShader,fragmentShader:we.fragmentShader,side:bi})});return Ci(()=>{W.value&&W.value.dispose()}),(we,Re)=>(nt(),Mt("TresGroup",{ref_key:"groupRef",ref:o},[Se(y)&&!Z.value?(nt(),Mt("TresMesh",{key:0,ref_key:"meshRef",ref:a,geometry:Se(l),material:W.value},null,8,Qie)):Fi("",!0)],512))}}),{logWarning:bT}=cl(),ose={mounted:n=>{if(!n.isLight){bT("".concat(n.type," is not a light"));return}ip=ere[n.type],n.parent.add(new ip(n))},updated:n=>{Du=n.parent.children.find(e=>e instanceof ip),Du.update()},unmounted:n=>{if(!n.isLight){bT("".concat(n.type," is not a light"));return}Du=n.parent.children.find(e=>e instanceof ip),Du.dispose(),n.parent.remove(Du)}};let ip,Du;const ere={DirectionalLight:N3,PointLight:D3,SpotLight:O3,HemisphereLight:U3};export{WG as $,vo as A,cm as B,en as C,ore as D,uy as E,Ore as F,fh as G,gh as H,Se as I,dre as J,fre as K,Ere as L,vre as M,Cre as N,Are as O,hre as P,Pre as Q,yre as R,Tre as S,Jr as T,ei as U,Fi as V,Fn as W,Ei as X,Xe as Y,ui as Z,e4 as _,ie as a,os as a$,Mn as a0,Rs as a1,dr as a2,ar as a3,bn as a4,Cr as a5,kre as a6,nre as a7,xI as a8,Gre as a9,zre as aA,Bre as aB,sre as aC,Zre as aD,bi as aE,Kre as aF,D as aG,yi as aH,qe as aI,At as aJ,ns as aK,Pe as aL,ur as aM,Qn as aN,Ra as aO,Nre as aP,ze as aQ,vt as aR,Jt as aS,i3 as aT,tse as aU,Or as aV,Vre as aW,Pi as aX,M3 as aY,Ve as aZ,QY as a_,jn as aa,xre as ab,cU as ac,RA as ad,mee as ae,sse as af,Lre as ag,Bp as ah,An as ai,Ci as aj,oh as ak,ise as al,Gn as am,qre as an,rse as ao,jre as ap,Wre as aq,Xre as ar,ese as as,ire as at,rre as au,nse as av,Yre as aw,Qre as ax,$re as ay,are as az,Rre as b,c3 as b0,Ri as b1,Ue as b2,_e as b3,er as b4,km as b5,cr as b6,L3 as b7,Be as b8,s3 as b9,Ht as bA,sP as bB,oP as bC,aP as bD,Jy as bE,Bn as bF,Fr as bG,En as bH,Xn as bI,Ti as bJ,Mr as bK,us as bL,ai as bM,ig as bN,dq as bO,Jre as bP,ose as bQ,Sre as bR,Ure as bS,wre as bT,gre as bU,_re as bV,Zy as ba,kc as bb,Hre as bc,e2 as bd,Vm as be,Hm as bf,jc as bg,og as bh,Rn as bi,pt as bj,Xh as bk,Ym as bl,Jn as bm,_b as bn,Ni as bo,Wm as bp,yb as bq,Fre as br,hn as bs,zi as bt,Lr as bu,Cc as bv,Ps as bw,Ib as bx,sh as by,Ut as bz,Mt as c,mre as d,lre as e,JB as f,VA as g,ure as h,cre as i,xe as j,XO as k,Ua as l,fU as m,dU as n,nt as o,su as p,Te as q,Hu as r,$r as s,$L as t,pre as u,Io as v,ft as w,Ire as x,Dre as y,Mre as z};