@xiping/react-components 1.0.20 → 1.0.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/confetti-button/index.d.ts +24 -0
- package/dist/cjs/components/confetti-button/index.js +1 -0
- package/dist/cjs/components/txt-editor/TxtEditor.js +1 -1
- package/dist/cjs/hooks/useStayTimeReport.d.ts +6 -0
- package/dist/cjs/hooks/useStayTimeReport.js +1 -0
- package/dist/cjs/index.d.ts +2 -0
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/node_modules/.pnpm/3d-force-graph@1.78.2/node_modules/3d-force-graph/dist/3d-force-graph.js +28 -0
- package/dist/cjs/node_modules/.pnpm/@tweenjs_tween.js@25.0.0/node_modules/@tweenjs/tween.js/dist/tween.esm.js +1 -0
- package/dist/cjs/node_modules/.pnpm/bowser@2.11.0/node_modules/bowser/src/bowser.js +6 -0
- package/dist/cjs/node_modules/.pnpm/bowser@2.11.0/node_modules/bowser/src/constants.js +1 -0
- package/dist/cjs/node_modules/.pnpm/bowser@2.11.0/node_modules/bowser/src/parser-browsers.js +1 -0
- package/dist/cjs/node_modules/.pnpm/bowser@2.11.0/node_modules/bowser/src/parser-engines.js +1 -0
- package/dist/cjs/node_modules/.pnpm/bowser@2.11.0/node_modules/bowser/src/parser-os.js +1 -0
- package/dist/cjs/node_modules/.pnpm/bowser@2.11.0/node_modules/bowser/src/parser-platforms.js +1 -0
- package/dist/cjs/node_modules/.pnpm/bowser@2.11.0/node_modules/bowser/src/parser.js +1 -0
- package/dist/cjs/node_modules/.pnpm/bowser@2.11.0/node_modules/bowser/src/utils.js +1 -0
- package/dist/cjs/node_modules/.pnpm/canvas-confetti@1.9.3/node_modules/canvas-confetti/dist/confetti.module.js +2 -0
- package/dist/cjs/node_modules/.pnpm/d3-array@3.2.4/node_modules/d3-array/src/max.js +1 -0
- package/dist/cjs/node_modules/.pnpm/d3-array@3.2.4/node_modules/d3-array/src/min.js +1 -0
- package/dist/cjs/node_modules/.pnpm/react-force-graph-3d@1.28.0_react@19.1.0/node_modules/react-force-graph-3d/dist/react-force-graph-3d.js +1 -0
- package/dist/cjs/node_modules/.pnpm/three-forcegraph@1.43.0_three@0.178.0/node_modules/three-forcegraph/dist/three-forcegraph.js +3 -0
- package/dist/cjs/node_modules/.pnpm/three-render-objects@1.40.3_three@0.178.0/node_modules/three-render-objects/dist/three-render-objects.js +18 -0
- package/dist/cjs/node_modules/.pnpm/three@0.178.0/node_modules/three/build/three.core.js +44 -0
- package/dist/cjs/node_modules/.pnpm/three@0.178.0/node_modules/three/build/three.module.js +3784 -0
- package/dist/cjs/node_modules/.pnpm/three@0.178.0/node_modules/three/build/three.webgpu.js +392 -0
- package/dist/cjs/node_modules/.pnpm/three@0.178.0/node_modules/three/examples/jsm/controls/DragControls.js +1 -0
- package/dist/cjs/node_modules/.pnpm/three@0.178.0/node_modules/three/examples/jsm/controls/FlyControls.js +1 -0
- package/dist/cjs/node_modules/.pnpm/three@0.178.0/node_modules/three/examples/jsm/controls/OrbitControls.js +1 -0
- package/dist/cjs/node_modules/.pnpm/three@0.178.0/node_modules/three/examples/jsm/controls/TrackballControls.js +1 -0
- package/dist/cjs/node_modules/.pnpm/three@0.178.0/node_modules/three/examples/jsm/postprocessing/ShaderPass.js +1 -0
- package/dist/cjs/react-components.css +1 -1
- package/dist/es/components/confetti-button/index.d.ts +24 -0
- package/dist/es/components/confetti-button/index.js +77 -0
- package/dist/es/components/txt-editor/TxtEditor.js +1 -1
- package/dist/es/hooks/useStayTimeReport.d.ts +6 -0
- package/dist/es/hooks/useStayTimeReport.js +31 -0
- package/dist/es/index.d.ts +2 -0
- package/dist/es/index.js +31 -26
- package/dist/es/node_modules/.pnpm/{3d-force-graph@1.77.0 → 3d-force-graph@1.78.2}/node_modules/3d-force-graph/dist/3d-force-graph.js +10 -10
- package/dist/es/node_modules/.pnpm/@tweenjs_tween.js@25.0.0/node_modules/@tweenjs/tween.js/dist/tween.esm.js +396 -0
- package/dist/es/node_modules/.pnpm/bowser@2.11.0/node_modules/bowser/src/bowser.js +55 -0
- package/dist/es/node_modules/.pnpm/bowser@2.11.0/node_modules/bowser/src/constants.js +113 -0
- package/dist/es/node_modules/.pnpm/bowser@2.11.0/node_modules/bowser/src/parser-browsers.js +404 -0
- package/dist/es/node_modules/.pnpm/bowser@2.11.0/node_modules/bowser/src/parser-engines.js +78 -0
- package/dist/es/node_modules/.pnpm/bowser@2.11.0/node_modules/bowser/src/parser-os.js +159 -0
- package/dist/es/node_modules/.pnpm/bowser@2.11.0/node_modules/bowser/src/parser-platforms.js +238 -0
- package/dist/es/node_modules/.pnpm/bowser@2.11.0/node_modules/bowser/src/parser.js +303 -0
- package/dist/es/node_modules/.pnpm/bowser@2.11.0/node_modules/bowser/src/utils.js +280 -0
- package/dist/es/node_modules/.pnpm/canvas-confetti@1.9.3/node_modules/canvas-confetti/dist/confetti.module.js +409 -0
- package/dist/es/node_modules/.pnpm/d3-array@3.2.4/node_modules/d3-array/src/max.js +15 -0
- package/dist/es/node_modules/.pnpm/d3-array@3.2.4/node_modules/d3-array/src/min.js +15 -0
- package/dist/es/node_modules/.pnpm/{react-force-graph-3d@1.27.0_react@18.3.1 → react-force-graph-3d@1.28.0_react@19.1.0}/node_modules/react-force-graph-3d/dist/react-force-graph-3d.js +5 -2
- package/dist/es/node_modules/.pnpm/three-forcegraph@1.43.0_three@0.178.0/node_modules/three-forcegraph/dist/three-forcegraph.js +1037 -0
- package/dist/es/node_modules/.pnpm/{three-render-objects@1.40.2_three@0.171.0 → three-render-objects@1.40.3_three@0.178.0}/node_modules/three-render-objects/dist/three-render-objects.js +10 -10
- package/dist/es/node_modules/.pnpm/three@0.178.0/node_modules/three/build/three.core.js +13236 -0
- package/dist/es/node_modules/.pnpm/{three@0.171.0 → three@0.178.0}/node_modules/three/build/three.module.js +3379 -3325
- package/dist/es/node_modules/.pnpm/three@0.178.0/node_modules/three/build/three.webgpu.js +24475 -0
- package/dist/es/node_modules/.pnpm/{three@0.171.0 → three@0.178.0}/node_modules/three/examples/jsm/controls/DragControls.js +15 -8
- package/dist/es/node_modules/.pnpm/{three@0.171.0 → three@0.178.0}/node_modules/three/examples/jsm/controls/FlyControls.js +26 -20
- package/dist/es/node_modules/.pnpm/{three@0.171.0 → three@0.178.0}/node_modules/three/examples/jsm/controls/OrbitControls.js +47 -10
- package/dist/es/node_modules/.pnpm/{three@0.171.0 → three@0.178.0}/node_modules/three/examples/jsm/controls/TrackballControls.js +16 -4
- package/dist/es/node_modules/.pnpm/{three@0.171.0 → three@0.178.0}/node_modules/three/examples/jsm/postprocessing/EffectComposer.js +62 -0
- package/dist/es/node_modules/.pnpm/{three@0.171.0 → three@0.178.0}/node_modules/three/examples/jsm/postprocessing/MaskPass.js +31 -0
- package/dist/es/node_modules/.pnpm/three@0.178.0/node_modules/three/examples/jsm/postprocessing/Pass.js +89 -0
- package/dist/es/node_modules/.pnpm/{three@0.171.0 → three@0.178.0}/node_modules/three/examples/jsm/postprocessing/RenderPass.js +21 -0
- package/dist/es/node_modules/.pnpm/three@0.178.0/node_modules/three/examples/jsm/postprocessing/ShaderPass.js +46 -0
- package/dist/es/react-components.css +1 -1
- package/package.json +29 -27
- package/dist/cjs/node_modules/.pnpm/3d-force-graph@1.77.0/node_modules/3d-force-graph/dist/3d-force-graph.js +0 -28
- package/dist/cjs/node_modules/.pnpm/@tweenjs_tween.js@23.1.3/node_modules/@tweenjs/tween.js/dist/tween.esm.js +0 -1
- package/dist/cjs/node_modules/.pnpm/d3-array@1.2.4/node_modules/d3-array/src/ascending.js +0 -1
- package/dist/cjs/node_modules/.pnpm/d3-array@1.2.4/node_modules/d3-array/src/bisect.js +0 -1
- package/dist/cjs/node_modules/.pnpm/d3-array@1.2.4/node_modules/d3-array/src/bisector.js +0 -1
- package/dist/cjs/node_modules/.pnpm/d3-array@1.2.4/node_modules/d3-array/src/max.js +0 -1
- package/dist/cjs/node_modules/.pnpm/d3-array@1.2.4/node_modules/d3-array/src/min.js +0 -1
- package/dist/cjs/node_modules/.pnpm/react-force-graph-3d@1.27.0_react@18.3.1/node_modules/react-force-graph-3d/dist/react-force-graph-3d.js +0 -1
- package/dist/cjs/node_modules/.pnpm/three-forcegraph@1.42.13_three@0.171.0/node_modules/three-forcegraph/dist/three-forcegraph.js +0 -3
- package/dist/cjs/node_modules/.pnpm/three-render-objects@1.40.2_three@0.171.0/node_modules/three-render-objects/dist/three-render-objects.js +0 -18
- package/dist/cjs/node_modules/.pnpm/three@0.171.0/node_modules/three/build/three.core.js +0 -44
- package/dist/cjs/node_modules/.pnpm/three@0.171.0/node_modules/three/build/three.module.js +0 -3789
- package/dist/cjs/node_modules/.pnpm/three@0.171.0/node_modules/three/build/three.webgpu.js +0 -373
- package/dist/cjs/node_modules/.pnpm/three@0.171.0/node_modules/three/examples/jsm/controls/DragControls.js +0 -1
- package/dist/cjs/node_modules/.pnpm/three@0.171.0/node_modules/three/examples/jsm/controls/FlyControls.js +0 -1
- package/dist/cjs/node_modules/.pnpm/three@0.171.0/node_modules/three/examples/jsm/controls/OrbitControls.js +0 -1
- package/dist/cjs/node_modules/.pnpm/three@0.171.0/node_modules/three/examples/jsm/controls/TrackballControls.js +0 -1
- package/dist/cjs/node_modules/.pnpm/three@0.171.0/node_modules/three/examples/jsm/postprocessing/ShaderPass.js +0 -1
- package/dist/es/node_modules/.pnpm/@tweenjs_tween.js@23.1.3/node_modules/@tweenjs/tween.js/dist/tween.esm.js +0 -379
- package/dist/es/node_modules/.pnpm/d3-array@1.2.4/node_modules/d3-array/src/ascending.js +0 -6
- package/dist/es/node_modules/.pnpm/d3-array@1.2.4/node_modules/d3-array/src/bisect.js +0 -3
- package/dist/es/node_modules/.pnpm/d3-array@1.2.4/node_modules/d3-array/src/bisector.js +0 -27
- package/dist/es/node_modules/.pnpm/d3-array@1.2.4/node_modules/d3-array/src/max.js +0 -17
- package/dist/es/node_modules/.pnpm/d3-array@1.2.4/node_modules/d3-array/src/min.js +0 -17
- package/dist/es/node_modules/.pnpm/three-forcegraph@1.42.13_three@0.171.0/node_modules/three-forcegraph/dist/three-forcegraph.js +0 -1020
- package/dist/es/node_modules/.pnpm/three@0.171.0/node_modules/three/build/three.core.js +0 -6662
- package/dist/es/node_modules/.pnpm/three@0.171.0/node_modules/three/build/three.webgpu.js +0 -13421
- package/dist/es/node_modules/.pnpm/three@0.171.0/node_modules/three/examples/jsm/postprocessing/Pass.js +0 -42
- package/dist/es/node_modules/.pnpm/three@0.171.0/node_modules/three/examples/jsm/postprocessing/ShaderPass.js +0 -23
- /package/dist/cjs/node_modules/.pnpm/{@monaco-editor_react@4.7.0_monaco-editor@0.52.2_react-dom@18.3.1_react@18.3.1__react@18.3.1 → @monaco-editor_react@4.7.0_monaco-editor@0.52.2_react-dom@19.1.0_react@19.1.0__react@19.1.0}/node_modules/@monaco-editor/react/dist/index.js +0 -0
- /package/dist/cjs/node_modules/.pnpm/{react-kapsule@2.5.7_react@18.3.1 → react-kapsule@2.5.7_react@19.1.0}/node_modules/react-kapsule/dist/react-kapsule.js +0 -0
- /package/dist/cjs/node_modules/.pnpm/{three@0.171.0 → three@0.178.0}/node_modules/three/examples/jsm/postprocessing/EffectComposer.js +0 -0
- /package/dist/cjs/node_modules/.pnpm/{three@0.171.0 → three@0.178.0}/node_modules/three/examples/jsm/postprocessing/MaskPass.js +0 -0
- /package/dist/cjs/node_modules/.pnpm/{three@0.171.0 → three@0.178.0}/node_modules/three/examples/jsm/postprocessing/Pass.js +0 -0
- /package/dist/cjs/node_modules/.pnpm/{three@0.171.0 → three@0.178.0}/node_modules/three/examples/jsm/postprocessing/RenderPass.js +0 -0
- /package/dist/cjs/node_modules/.pnpm/{three@0.171.0 → three@0.178.0}/node_modules/three/examples/jsm/shaders/CopyShader.js +0 -0
- /package/dist/es/node_modules/.pnpm/{@monaco-editor_react@4.7.0_monaco-editor@0.52.2_react-dom@18.3.1_react@18.3.1__react@18.3.1 → @monaco-editor_react@4.7.0_monaco-editor@0.52.2_react-dom@19.1.0_react@19.1.0__react@19.1.0}/node_modules/@monaco-editor/react/dist/index.js +0 -0
- /package/dist/es/node_modules/.pnpm/{react-kapsule@2.5.7_react@18.3.1 → react-kapsule@2.5.7_react@19.1.0}/node_modules/react-kapsule/dist/react-kapsule.js +0 -0
- /package/dist/es/node_modules/.pnpm/{three@0.171.0 → three@0.178.0}/node_modules/three/examples/jsm/shaders/CopyShader.js +0 -0
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2010-2024 Three.js Authors
|
|
4
|
-
* SPDX-License-Identifier: MIT
|
|
5
|
-
*/const Ni="171",pr={ROTATE:0,DOLLY:1,PAN:2},dr={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},mr=0,fr=1,yr=2,xr=0,gr=1,Mr=2,wr=3,Xe=0,Vi=1,br=2,Ds=0,zi=1,Sr=2,Ar=3,_r=4,vr=5,Ci=100,zr=101,Cr=102,Tr=103,Fr=104,Br=200,Rr=201,Er=202,Pr=203,Ti=204,Fi=205,Ir=206,Lr=207,Dr=208,kr=209,Or=210,Nr=211,Vr=212,Ur=213,Gr=214,Wr=0,qr=1,Xr=2,Bi=3,Jr=4,Hr=5,Yr=6,jr=7,je=0,Zr=1,$r=2,Qr=0,Kr=1,ta=2,ea=3,ia=4,sa=5,na=6,ra=7,Ui=300,ks=301,aa=302,oa=303,ha=304,la=306,Ri=1e3,Vt=1001,Ei=1002,lt=1003,ca=1004,ua=1005,ye=1006,pa=1007,Gi=1008,Wi=1009,Os=1010,Ns=1011,Vs=1012,Us=1013,qi=1014,Xi=1015,Gs=1016,Ws=1017,qs=1018,Xs=1020,Js=35902,Hs=1021,Ys=1022,Ji=1023,js=1024,Zs=1025,We=1026,Pi=1027,$s=1028,Qs=1029,Ks=1030,tn=1031,da=1032,en=1033,sn=33776,nn=33777,rn=33778,an=33779,on=35840,hn=35841,ln=35842,cn=35843,un=36196,pn=37492,dn=37496,mn=37808,fn=37809,yn=37810,xn=37811,gn=37812,Mn=37813,wn=37814,bn=37815,Sn=37816,An=37817,_n=37818,vn=37819,zn=37820,Cn=37821,Tn=36492,Fn=36494,Bn=36495,Rn=36283,En=36284,Pn=36285,In=36286,Ln=3200,ma=3201,Ut=0,fa=1,Hi="",nt="srgb",Ii="srgb-linear",Li="linear",qe="srgb",ya=0,Ot=7680,xa=7681,ga=7682,Ma=7683,wa=34055,ba=34056,Sa=5386,Aa=512,_a=513,va=514,za=515,Ca=516,Ta=517,Fa=518,Di=519,Ba=512,Ra=513,Ea=514,Pa=515,Ia=516,La=517,Da=518,ka=519,Je=35044,Oa=35048,Na="300 es",St=2e3,xe=2001;class Gt{addEventListener(t,e){this._listeners===void 0&&(this._listeners={});const i=this._listeners;i[t]===void 0&&(i[t]=[]),i[t].indexOf(e)===-1&&i[t].push(e)}hasEventListener(t,e){if(this._listeners===void 0)return!1;const i=this._listeners;return i[t]!==void 0&&i[t].indexOf(e)!==-1}removeEventListener(t,e){if(this._listeners===void 0)return;const s=this._listeners[t];if(s!==void 0){const n=s.indexOf(e);n!==-1&&s.splice(n,1)}}dispatchEvent(t){if(this._listeners===void 0)return;const i=this._listeners[t.type];if(i!==void 0){t.target=this;const s=i.slice(0);for(let n=0,r=s.length;n<r;n++)s[n].call(this,t);t.target=null}}}const q=["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 ls=1234567;const pe=Math.PI/180,se=180/Math.PI;function At(){const c=Math.random()*4294967295|0,t=Math.random()*4294967295|0,e=Math.random()*4294967295|0,i=Math.random()*4294967295|0;return(q[c&255]+q[c>>8&255]+q[c>>16&255]+q[c>>24&255]+"-"+q[t&255]+q[t>>8&255]+"-"+q[t>>16&15|64]+q[t>>24&255]+"-"+q[e&63|128]+q[e>>8&255]+"-"+q[e>>16&255]+q[e>>24&255]+q[i&255]+q[i>>8&255]+q[i>>16&255]+q[i>>24&255]).toLowerCase()}function T(c,t,e){return Math.max(t,Math.min(e,c))}function Yi(c,t){return(c%t+t)%t}function Va(c,t,e,i,s){return i+(c-t)*(s-i)/(e-t)}function Ua(c,t,e){return c!==t?(e-c)/(t-c):0}function de(c,t,e){return(1-e)*c+e*t}function Ga(c,t,e,i){return de(c,t,1-Math.exp(-e*i))}function Wa(c,t=1){return t-Math.abs(Yi(c,t*2)-t)}function qa(c,t,e){return c<=t?0:c>=e?1:(c=(c-t)/(e-t),c*c*(3-2*c))}function Xa(c,t,e){return c<=t?0:c>=e?1:(c=(c-t)/(e-t),c*c*c*(c*(c*6-15)+10))}function Ja(c,t){return c+Math.floor(Math.random()*(t-c+1))}function Ha(c,t){return c+Math.random()*(t-c)}function Ya(c){return c*(.5-Math.random())}function ja(c){c!==void 0&&(ls=c);let t=ls+=1831565813;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}function Za(c){return c*pe}function $a(c){return c*se}function Qa(c){return(c&c-1)===0&&c!==0}function Ka(c){return Math.pow(2,Math.ceil(Math.log(c)/Math.LN2))}function to(c){return Math.pow(2,Math.floor(Math.log(c)/Math.LN2))}function eo(c,t,e,i,s){const n=Math.cos,r=Math.sin,o=n(e/2),a=r(e/2),h=n((t+i)/2),l=r((t+i)/2),u=n((t-i)/2),p=r((t-i)/2),d=n((i-t)/2),m=r((i-t)/2);switch(s){case"XYX":c.set(o*l,a*u,a*p,o*h);break;case"YZY":c.set(a*p,o*l,a*u,o*h);break;case"ZXZ":c.set(a*u,a*p,o*l,o*h);break;case"XZX":c.set(o*l,a*m,a*d,o*h);break;case"YXY":c.set(a*d,o*l,a*m,o*h);break;case"ZYZ":c.set(a*m,a*d,o*l,o*h);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+s)}}function j(c,t){switch(t.constructor){case Float32Array:return c;case Uint32Array:return c/4294967295;case Uint16Array:return c/65535;case Uint8Array:return c/255;case Int32Array:return Math.max(c/2147483647,-1);case Int16Array:return Math.max(c/32767,-1);case Int8Array:return Math.max(c/127,-1);default:throw new Error("Invalid component type.")}}function C(c,t){switch(t.constructor){case Float32Array:return c;case Uint32Array:return Math.round(c*4294967295);case Uint16Array:return Math.round(c*65535);case Uint8Array:return Math.round(c*255);case Int32Array:return Math.round(c*2147483647);case Int16Array:return Math.round(c*32767);case Int8Array:return Math.round(c*127);default:throw new Error("Invalid component type.")}}const io={DEG2RAD:pe,RAD2DEG:se,generateUUID:At,clamp:T,euclideanModulo:Yi,mapLinear:Va,inverseLerp:Ua,lerp:de,damp:Ga,pingpong:Wa,smoothstep:qa,smootherstep:Xa,randInt:Ja,randFloat:Ha,randFloatSpread:Ya,seededRandom:ja,degToRad:Za,radToDeg:$a,isPowerOfTwo:Qa,ceilPowerOfTwo:Ka,floorPowerOfTwo:to,setQuaternionFromProperEuler:eo,normalize:C,denormalize:j};class z{constructor(t=0,e=0){z.prototype.isVector2=!0,this.x=t,this.y=e}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){const e=this.x,i=this.y,s=t.elements;return this.x=s[0]*e+s[3]*i+s[6],this.y=s[1]*e+s[4]*i+s[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,e){return this.x=T(this.x,t.x,e.x),this.y=T(this.y,t.y,e.y),this}clampScalar(t,e){return this.x=T(this.x,t,e),this.y=T(this.y,t,e),this}clampLength(t,e){const i=this.length();return this.divideScalar(i||1).multiplyScalar(T(i,t,e))}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(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.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(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;const i=this.dot(t)/e;return Math.acos(T(i,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,i=this.y-t.y;return e*e+i*i}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this}rotateAround(t,e){const i=Math.cos(e),s=Math.sin(e),n=this.x-t.x,r=this.y-t.y;return this.x=n*i-r*s+t.x,this.y=n*s+r*i+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class dt{constructor(t,e,i,s,n,r,o,a,h){dt.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],t!==void 0&&this.set(t,e,i,s,n,r,o,a,h)}set(t,e,i,s,n,r,o,a,h){const l=this.elements;return l[0]=t,l[1]=s,l[2]=o,l[3]=e,l[4]=n,l[5]=a,l[6]=i,l[7]=r,l[8]=h,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const e=this.elements,i=t.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],this}extractBasis(t,e,i){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(t){const e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const i=t.elements,s=e.elements,n=this.elements,r=i[0],o=i[3],a=i[6],h=i[1],l=i[4],u=i[7],p=i[2],d=i[5],m=i[8],y=s[0],x=s[3],g=s[6],b=s[1],w=s[4],M=s[7],S=s[2],v=s[5],_=s[8];return n[0]=r*y+o*b+a*S,n[3]=r*x+o*w+a*v,n[6]=r*g+o*M+a*_,n[1]=h*y+l*b+u*S,n[4]=h*x+l*w+u*v,n[7]=h*g+l*M+u*_,n[2]=p*y+d*b+m*S,n[5]=p*x+d*w+m*v,n[8]=p*g+d*M+m*_,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){const t=this.elements,e=t[0],i=t[1],s=t[2],n=t[3],r=t[4],o=t[5],a=t[6],h=t[7],l=t[8];return e*r*l-e*o*h-i*n*l+i*o*a+s*n*h-s*r*a}invert(){const t=this.elements,e=t[0],i=t[1],s=t[2],n=t[3],r=t[4],o=t[5],a=t[6],h=t[7],l=t[8],u=l*r-o*h,p=o*a-l*n,d=h*n-r*a,m=e*u+i*p+s*d;if(m===0)return this.set(0,0,0,0,0,0,0,0,0);const y=1/m;return t[0]=u*y,t[1]=(s*h-l*i)*y,t[2]=(o*i-s*r)*y,t[3]=p*y,t[4]=(l*e-s*a)*y,t[5]=(s*n-o*e)*y,t[6]=d*y,t[7]=(i*a-h*e)*y,t[8]=(r*e-i*n)*y,this}transpose(){let t;const e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){const e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this}setUvTransform(t,e,i,s,n,r,o){const a=Math.cos(n),h=Math.sin(n);return this.set(i*a,i*h,-i*(a*r+h*o)+r+t,-s*h,s*a,-s*(-h*r+a*o)+o+e,0,0,1),this}scale(t,e){return this.premultiply(ti.makeScale(t,e)),this}rotate(t){return this.premultiply(ti.makeRotation(-t)),this}translate(t,e){return this.premultiply(ti.makeTranslation(t,e)),this}makeTranslation(t,e){return t.isVector2?this.set(1,0,t.x,0,1,t.y,0,0,1):this.set(1,0,t,0,1,e,0,0,1),this}makeRotation(t){const e=Math.cos(t),i=Math.sin(t);return this.set(e,-i,0,i,e,0,0,0,1),this}makeScale(t,e){return this.set(t,0,0,0,e,0,0,0,1),this}equals(t){const e=this.elements,i=t.elements;for(let s=0;s<9;s++)if(e[s]!==i[s])return!1;return!0}fromArray(t,e=0){for(let i=0;i<9;i++)this.elements[i]=t[i+e];return this}toArray(t=[],e=0){const i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t}clone(){return new this.constructor().fromArray(this.elements)}}const ti=new dt;function Dn(c){for(let t=c.length-1;t>=0;--t)if(c[t]>=65535)return!0;return!1}function ge(c){return document.createElementNS("http://www.w3.org/1999/xhtml",c)}function so(){const c=ge("canvas");return c.style.display="block",c}const cs={};function no(c){c in cs||(cs[c]=!0,console.warn(c))}function ro(c,t,e){return new Promise(function(i,s){function n(){switch(c.clientWaitSync(t,c.SYNC_FLUSH_COMMANDS_BIT,0)){case c.WAIT_FAILED:s();break;case c.TIMEOUT_EXPIRED:setTimeout(n,e);break;default:i()}}setTimeout(n,e)})}function ao(c){const t=c.elements;t[2]=.5*t[2]+.5*t[3],t[6]=.5*t[6]+.5*t[7],t[10]=.5*t[10]+.5*t[11],t[14]=.5*t[14]+.5*t[15]}function oo(c){const t=c.elements;t[11]===-1?(t[10]=-t[10]-1,t[14]=-t[14]):(t[10]=-t[10],t[14]=-t[14]+1)}const us=new dt().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),ps=new dt().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function ho(){const c={enabled:!0,workingColorSpace:Ii,spaces:{},convert:function(s,n,r){return this.enabled===!1||n===r||!n||!r||(this.spaces[n].transfer===qe&&(s.r=_t(s.r),s.g=_t(s.g),s.b=_t(s.b)),this.spaces[n].primaries!==this.spaces[r].primaries&&(s.applyMatrix3(this.spaces[n].toXYZ),s.applyMatrix3(this.spaces[r].fromXYZ)),this.spaces[r].transfer===qe&&(s.r=ie(s.r),s.g=ie(s.g),s.b=ie(s.b))),s},fromWorkingColorSpace:function(s,n){return this.convert(s,this.workingColorSpace,n)},toWorkingColorSpace:function(s,n){return this.convert(s,n,this.workingColorSpace)},getPrimaries:function(s){return this.spaces[s].primaries},getTransfer:function(s){return s===Hi?Li:this.spaces[s].transfer},getLuminanceCoefficients:function(s,n=this.workingColorSpace){return s.fromArray(this.spaces[n].luminanceCoefficients)},define:function(s){Object.assign(this.spaces,s)},_getMatrix:function(s,n,r){return s.copy(this.spaces[n].toXYZ).multiply(this.spaces[r].fromXYZ)},_getDrawingBufferColorSpace:function(s){return this.spaces[s].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(s=this.workingColorSpace){return this.spaces[s].workingColorSpaceConfig.unpackColorSpace}},t=[.64,.33,.3,.6,.15,.06],e=[.2126,.7152,.0722],i=[.3127,.329];return c.define({[Ii]:{primaries:t,whitePoint:i,transfer:Li,toXYZ:us,fromXYZ:ps,luminanceCoefficients:e,workingColorSpaceConfig:{unpackColorSpace:nt},outputColorSpaceConfig:{drawingBufferColorSpace:nt}},[nt]:{primaries:t,whitePoint:i,transfer:qe,toXYZ:us,fromXYZ:ps,luminanceCoefficients:e,outputColorSpaceConfig:{drawingBufferColorSpace:nt}}}),c}const et=ho();function _t(c){return c<.04045?c*.0773993808:Math.pow(c*.9478672986+.0521327014,2.4)}function ie(c){return c<.0031308?c*12.92:1.055*Math.pow(c,.41666)-.055}let qt;class kn{static getDataURL(t){if(/^data:/i.test(t.src)||typeof HTMLCanvasElement>"u")return t.src;let e;if(t instanceof HTMLCanvasElement)e=t;else{qt===void 0&&(qt=ge("canvas")),qt.width=t.width,qt.height=t.height;const i=qt.getContext("2d");t instanceof ImageData?i.putImageData(t,0,0):i.drawImage(t,0,0,t.width,t.height),e=qt}return e.width>2048||e.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",t),e.toDataURL("image/jpeg",.6)):e.toDataURL("image/png")}static sRGBToLinear(t){if(typeof HTMLImageElement<"u"&&t instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&t instanceof ImageBitmap){const e=ge("canvas");e.width=t.width,e.height=t.height;const i=e.getContext("2d");i.drawImage(t,0,0,t.width,t.height);const s=i.getImageData(0,0,t.width,t.height),n=s.data;for(let r=0;r<n.length;r++)n[r]=_t(n[r]/255)*255;return i.putImageData(s,0,0),e}else if(t.data){const e=t.data.slice(0);for(let i=0;i<e.length;i++)e instanceof Uint8Array||e instanceof Uint8ClampedArray?e[i]=Math.floor(_t(e[i]/255)*255):e[i]=_t(e[i]);return{data:e,width:t.width,height:t.height}}else return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),t}}let lo=0;class ji{constructor(t=null){this.isSource=!0,Object.defineProperty(this,"id",{value:lo++}),this.uuid=At(),this.data=t,this.dataReady=!0,this.version=0}set needsUpdate(t){t===!0&&this.version++}toJSON(t){const e=t===void 0||typeof t=="string";if(!e&&t.images[this.uuid]!==void 0)return t.images[this.uuid];const i={uuid:this.uuid,url:""},s=this.data;if(s!==null){let n;if(Array.isArray(s)){n=[];for(let r=0,o=s.length;r<o;r++)s[r].isDataTexture?n.push(ei(s[r].image)):n.push(ei(s[r]))}else n=ei(s);i.url=n}return e||(t.images[this.uuid]=i),i}}function ei(c){return typeof HTMLImageElement<"u"&&c instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&c instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&c instanceof ImageBitmap?kn.getDataURL(c):c.data?{data:Array.from(c.data),width:c.width,height:c.height,type:c.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}let co=0;class J extends Gt{constructor(t=J.DEFAULT_IMAGE,e=J.DEFAULT_MAPPING,i=Vt,s=Vt,n=ye,r=Gi,o=Ji,a=Wi,h=J.DEFAULT_ANISOTROPY,l=Hi){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:co++}),this.uuid=At(),this.name="",this.source=new ji(t),this.mipmaps=[],this.mapping=e,this.channel=0,this.wrapS=i,this.wrapT=s,this.magFilter=n,this.minFilter=r,this.anisotropy=h,this.format=o,this.internalFormat=null,this.type=a,this.offset=new z(0,0),this.repeat=new z(1,1),this.center=new z(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new dt,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=l,this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.pmremVersion=0}get image(){return this.source.data}set image(t=null){this.source.data=t}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(t){return this.name=t.name,this.source=t.source,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.channel=t.channel,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.internalFormat=t.internalFormat,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.colorSpace=t.colorSpace,this.userData=JSON.parse(JSON.stringify(t.userData)),this.needsUpdate=!0,this}toJSON(t){const e=t===void 0||typeof t=="string";if(!e&&t.textures[this.uuid]!==void 0)return t.textures[this.uuid];const i={metadata:{version:4.6,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(t).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),e||(t.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(t){if(this.mapping!==Ui)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case Ri:t.x=t.x-Math.floor(t.x);break;case Vt:t.x=t.x<0?0:1;break;case Ei:Math.abs(Math.floor(t.x)%2)===1?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x);break}if(t.y<0||t.y>1)switch(this.wrapT){case Ri:t.y=t.y-Math.floor(t.y);break;case Vt:t.y=t.y<0?0:1;break;case Ei:Math.abs(Math.floor(t.y)%2)===1?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y);break}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){t===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(t){t===!0&&this.pmremVersion++}}J.DEFAULT_IMAGE=null;J.DEFAULT_MAPPING=Ui;J.DEFAULT_ANISOTROPY=1;class Y{constructor(t=0,e=0,i=0,s=1){Y.prototype.isVector4=!0,this.x=t,this.y=e,this.z=i,this.w=s}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,e,i,s){return this.x=t,this.y=e,this.z=i,this.w=s,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){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: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w!==void 0?t.w:1,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){const e=this.x,i=this.y,s=this.z,n=this.w,r=t.elements;return this.x=r[0]*e+r[4]*i+r[8]*s+r[12]*n,this.y=r[1]*e+r[5]*i+r[9]*s+r[13]*n,this.z=r[2]*e+r[6]*i+r[10]*s+r[14]*n,this.w=r[3]*e+r[7]*i+r[11]*s+r[15]*n,this}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this.w/=t.w,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);const e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this}setAxisAngleFromRotationMatrix(t){let e,i,s,n;const a=t.elements,h=a[0],l=a[4],u=a[8],p=a[1],d=a[5],m=a[9],y=a[2],x=a[6],g=a[10];if(Math.abs(l-p)<.01&&Math.abs(u-y)<.01&&Math.abs(m-x)<.01){if(Math.abs(l+p)<.1&&Math.abs(u+y)<.1&&Math.abs(m+x)<.1&&Math.abs(h+d+g-3)<.1)return this.set(1,0,0,0),this;e=Math.PI;const w=(h+1)/2,M=(d+1)/2,S=(g+1)/2,v=(l+p)/4,_=(u+y)/4,A=(m+x)/4;return w>M&&w>S?w<.01?(i=0,s=.707106781,n=.707106781):(i=Math.sqrt(w),s=v/i,n=_/i):M>S?M<.01?(i=.707106781,s=0,n=.707106781):(s=Math.sqrt(M),i=v/s,n=A/s):S<.01?(i=.707106781,s=.707106781,n=0):(n=Math.sqrt(S),i=_/n,s=A/n),this.set(i,s,n,e),this}let b=Math.sqrt((x-m)*(x-m)+(u-y)*(u-y)+(p-l)*(p-l));return Math.abs(b)<.001&&(b=1),this.x=(x-m)/b,this.y=(u-y)/b,this.z=(p-l)/b,this.w=Math.acos((h+d+g-1)/2),this}setFromMatrixPosition(t){const e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this.w=e[15],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this}clamp(t,e){return this.x=T(this.x,t.x,e.x),this.y=T(this.y,t.y,e.y),this.z=T(this.z,t.z,e.z),this.w=T(this.w,t.w,e.w),this}clampScalar(t,e){return this.x=T(this.x,t,e),this.y=T(this.y,t,e),this.z=T(this.z,t,e),this.w=T(this.w,t,e),this}clampLength(t,e){const i=this.length();return this.divideScalar(i||1).multiplyScalar(T(i,t,e))}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(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.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(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this.z=t.z+(e.z-t.z)*i,this.w=t.w+(e.w-t.w)*i,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),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 On extends Gt{constructor(t=1,e=1,i={}){super(),this.isRenderTarget=!0,this.width=t,this.height=e,this.depth=1,this.scissor=new Y(0,0,t,e),this.scissorTest=!1,this.viewport=new Y(0,0,t,e);const s={width:t,height:e,depth:1};i=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:ye,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1},i);const n=new J(s,i.mapping,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.colorSpace);n.flipY=!1,n.generateMipmaps=i.generateMipmaps,n.internalFormat=i.internalFormat,this.textures=[];const r=i.count;for(let o=0;o<r;o++)this.textures[o]=n.clone(),this.textures[o].isRenderTargetTexture=!0;this.depthBuffer=i.depthBuffer,this.stencilBuffer=i.stencilBuffer,this.resolveDepthBuffer=i.resolveDepthBuffer,this.resolveStencilBuffer=i.resolveStencilBuffer,this.depthTexture=i.depthTexture,this.samples=i.samples}get texture(){return this.textures[0]}set texture(t){this.textures[0]=t}setSize(t,e,i=1){if(this.width!==t||this.height!==e||this.depth!==i){this.width=t,this.height=e,this.depth=i;for(let s=0,n=this.textures.length;s<n;s++)this.textures[s].image.width=t,this.textures[s].image.height=e,this.textures[s].image.depth=i;this.dispose()}this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)}clone(){return new this.constructor().copy(this)}copy(t){this.width=t.width,this.height=t.height,this.depth=t.depth,this.scissor.copy(t.scissor),this.scissorTest=t.scissorTest,this.viewport.copy(t.viewport),this.textures.length=0;for(let i=0,s=t.textures.length;i<s;i++)this.textures[i]=t.textures[i].clone(),this.textures[i].isRenderTargetTexture=!0;const e=Object.assign({},t.texture.image);return this.texture.source=new ji(e),this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.resolveDepthBuffer=t.resolveDepthBuffer,this.resolveStencilBuffer=t.resolveStencilBuffer,t.depthTexture!==null&&(this.depthTexture=t.depthTexture.clone()),this.samples=t.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class Nn extends On{constructor(t=1,e=1,i={}){super(t,e,i),this.isWebGLRenderTarget=!0}}class uo extends J{constructor(t=null,e=1,i=1,s=1){super(null),this.isDataArrayTexture=!0,this.image={data:t,width:e,height:i,depth:s},this.magFilter=lt,this.minFilter=lt,this.wrapR=Vt,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(t){this.layerUpdates.add(t)}clearLayerUpdates(){this.layerUpdates.clear()}}class po extends J{constructor(t=null,e=1,i=1,s=1){super(null),this.isData3DTexture=!0,this.image={data:t,width:e,height:i,depth:s},this.magFilter=lt,this.minFilter=lt,this.wrapR=Vt,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class ne{constructor(t=0,e=0,i=0,s=1){this.isQuaternion=!0,this._x=t,this._y=e,this._z=i,this._w=s}static slerpFlat(t,e,i,s,n,r,o){let a=i[s+0],h=i[s+1],l=i[s+2],u=i[s+3];const p=n[r+0],d=n[r+1],m=n[r+2],y=n[r+3];if(o===0){t[e+0]=a,t[e+1]=h,t[e+2]=l,t[e+3]=u;return}if(o===1){t[e+0]=p,t[e+1]=d,t[e+2]=m,t[e+3]=y;return}if(u!==y||a!==p||h!==d||l!==m){let x=1-o;const g=a*p+h*d+l*m+u*y,b=g>=0?1:-1,w=1-g*g;if(w>Number.EPSILON){const S=Math.sqrt(w),v=Math.atan2(S,g*b);x=Math.sin(x*v)/S,o=Math.sin(o*v)/S}const M=o*b;if(a=a*x+p*M,h=h*x+d*M,l=l*x+m*M,u=u*x+y*M,x===1-o){const S=1/Math.sqrt(a*a+h*h+l*l+u*u);a*=S,h*=S,l*=S,u*=S}}t[e]=a,t[e+1]=h,t[e+2]=l,t[e+3]=u}static multiplyQuaternionsFlat(t,e,i,s,n,r){const o=i[s],a=i[s+1],h=i[s+2],l=i[s+3],u=n[r],p=n[r+1],d=n[r+2],m=n[r+3];return t[e]=o*m+l*u+a*d-h*p,t[e+1]=a*m+l*p+h*u-o*d,t[e+2]=h*m+l*d+o*p-a*u,t[e+3]=l*m-o*u-a*p-h*d,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,i,s){return this._x=t,this._y=e,this._z=i,this._w=s,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e=!0){const i=t._x,s=t._y,n=t._z,r=t._order,o=Math.cos,a=Math.sin,h=o(i/2),l=o(s/2),u=o(n/2),p=a(i/2),d=a(s/2),m=a(n/2);switch(r){case"XYZ":this._x=p*l*u+h*d*m,this._y=h*d*u-p*l*m,this._z=h*l*m+p*d*u,this._w=h*l*u-p*d*m;break;case"YXZ":this._x=p*l*u+h*d*m,this._y=h*d*u-p*l*m,this._z=h*l*m-p*d*u,this._w=h*l*u+p*d*m;break;case"ZXY":this._x=p*l*u-h*d*m,this._y=h*d*u+p*l*m,this._z=h*l*m+p*d*u,this._w=h*l*u-p*d*m;break;case"ZYX":this._x=p*l*u-h*d*m,this._y=h*d*u+p*l*m,this._z=h*l*m-p*d*u,this._w=h*l*u+p*d*m;break;case"YZX":this._x=p*l*u+h*d*m,this._y=h*d*u+p*l*m,this._z=h*l*m-p*d*u,this._w=h*l*u-p*d*m;break;case"XZY":this._x=p*l*u-h*d*m,this._y=h*d*u-p*l*m,this._z=h*l*m+p*d*u,this._w=h*l*u+p*d*m;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+r)}return e===!0&&this._onChangeCallback(),this}setFromAxisAngle(t,e){const i=e/2,s=Math.sin(i);return this._x=t.x*s,this._y=t.y*s,this._z=t.z*s,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(t){const e=t.elements,i=e[0],s=e[4],n=e[8],r=e[1],o=e[5],a=e[9],h=e[2],l=e[6],u=e[10],p=i+o+u;if(p>0){const d=.5/Math.sqrt(p+1);this._w=.25/d,this._x=(l-a)*d,this._y=(n-h)*d,this._z=(r-s)*d}else if(i>o&&i>u){const d=2*Math.sqrt(1+i-o-u);this._w=(l-a)/d,this._x=.25*d,this._y=(s+r)/d,this._z=(n+h)/d}else if(o>u){const d=2*Math.sqrt(1+o-i-u);this._w=(n-h)/d,this._x=(s+r)/d,this._y=.25*d,this._z=(a+l)/d}else{const d=2*Math.sqrt(1+u-i-o);this._w=(r-s)/d,this._x=(n+h)/d,this._y=(a+l)/d,this._z=.25*d}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let i=t.dot(e)+1;return i<Number.EPSILON?(i=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=i):(this._x=0,this._y=-t.z,this._z=t.y,this._w=i)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=i),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(T(this.dot(t),-1,1)))}rotateTowards(t,e){const i=this.angleTo(t);if(i===0)return this;const s=Math.min(1,e/i);return this.slerp(t,s),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(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._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 t=this.length();return t===0?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t){return this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){const i=t._x,s=t._y,n=t._z,r=t._w,o=e._x,a=e._y,h=e._z,l=e._w;return this._x=i*l+r*o+s*h-n*a,this._y=s*l+r*a+n*o-i*h,this._z=n*l+r*h+i*a-s*o,this._w=r*l-i*o-s*a-n*h,this._onChangeCallback(),this}slerp(t,e){if(e===0)return this;if(e===1)return this.copy(t);const i=this._x,s=this._y,n=this._z,r=this._w;let o=r*t._w+i*t._x+s*t._y+n*t._z;if(o<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,o=-o):this.copy(t),o>=1)return this._w=r,this._x=i,this._y=s,this._z=n,this;const a=1-o*o;if(a<=Number.EPSILON){const d=1-e;return this._w=d*r+e*this._w,this._x=d*i+e*this._x,this._y=d*s+e*this._y,this._z=d*n+e*this._z,this.normalize(),this}const h=Math.sqrt(a),l=Math.atan2(h,o),u=Math.sin((1-e)*l)/h,p=Math.sin(e*l)/h;return this._w=r*u+this._w*p,this._x=i*u+this._x*p,this._y=s*u+this._y*p,this._z=n*u+this._z*p,this._onChangeCallback(),this}slerpQuaternions(t,e,i){return this.copy(t).slerp(e,i)}random(){const t=2*Math.PI*Math.random(),e=2*Math.PI*Math.random(),i=Math.random(),s=Math.sqrt(1-i),n=Math.sqrt(i);return this.set(s*Math.sin(t),s*Math.cos(t),n*Math.sin(e),n*Math.cos(e))}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,e=0){return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}fromBufferAttribute(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class f{constructor(t=0,e=0,i=0){f.prototype.isVector3=!0,this.x=t,this.y=e,this.z=i}set(t,e,i){return i===void 0&&(i=this.z),this.x=t,this.y=e,this.z=i,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return this.applyQuaternion(ds.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(ds.setFromAxisAngle(t,e))}applyMatrix3(t){const e=this.x,i=this.y,s=this.z,n=t.elements;return this.x=n[0]*e+n[3]*i+n[6]*s,this.y=n[1]*e+n[4]*i+n[7]*s,this.z=n[2]*e+n[5]*i+n[8]*s,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){const e=this.x,i=this.y,s=this.z,n=t.elements,r=1/(n[3]*e+n[7]*i+n[11]*s+n[15]);return this.x=(n[0]*e+n[4]*i+n[8]*s+n[12])*r,this.y=(n[1]*e+n[5]*i+n[9]*s+n[13])*r,this.z=(n[2]*e+n[6]*i+n[10]*s+n[14])*r,this}applyQuaternion(t){const e=this.x,i=this.y,s=this.z,n=t.x,r=t.y,o=t.z,a=t.w,h=2*(r*s-o*i),l=2*(o*e-n*s),u=2*(n*i-r*e);return this.x=e+a*h+r*u-o*l,this.y=i+a*l+o*h-n*u,this.z=s+a*u+n*l-r*h,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){const e=this.x,i=this.y,s=this.z,n=t.elements;return this.x=n[0]*e+n[4]*i+n[8]*s,this.y=n[1]*e+n[5]*i+n[9]*s,this.z=n[2]*e+n[6]*i+n[10]*s,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,e){return this.x=T(this.x,t.x,e.x),this.y=T(this.y,t.y,e.y),this.z=T(this.z,t.z,e.z),this}clampScalar(t,e){return this.x=T(this.x,t,e),this.y=T(this.y,t,e),this.z=T(this.z,t,e),this}clampLength(t,e){const i=this.length();return this.divideScalar(i||1).multiplyScalar(T(i,t,e))}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(t){return this.x*t.x+this.y*t.y+this.z*t.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(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this.z=t.z+(e.z-t.z)*i,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,e){const i=t.x,s=t.y,n=t.z,r=e.x,o=e.y,a=e.z;return this.x=s*a-n*o,this.y=n*r-i*a,this.z=i*o-s*r,this}projectOnVector(t){const e=t.lengthSq();if(e===0)return this.set(0,0,0);const i=t.dot(this)/e;return this.copy(t).multiplyScalar(i)}projectOnPlane(t){return ii.copy(this).projectOnVector(t),this.sub(ii)}reflect(t){return this.sub(ii.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;const i=this.dot(t)/e;return Math.acos(T(i,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,i=this.y-t.y,s=this.z-t.z;return e*e+i*i+s*s}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,e,i){const s=Math.sin(e)*t;return this.x=s*Math.sin(i),this.y=Math.cos(e)*t,this.z=s*Math.cos(i),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,i){return this.x=t*Math.sin(e),this.y=i,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){const e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){const e=this.setFromMatrixColumn(t,0).length(),i=this.setFromMatrixColumn(t,1).length(),s=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=i,this.z=s,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,e*4)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,e*3)}setFromEuler(t){return this.x=t._x,this.y=t._y,this.z=t._z,this}setFromColor(t){return this.x=t.r,this.y=t.g,this.z=t.b,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const t=Math.random()*Math.PI*2,e=Math.random()*2-1,i=Math.sqrt(1-e*e);return this.x=i*Math.cos(t),this.y=e,this.z=i*Math.sin(t),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const ii=new f,ds=new ne;class re{constructor(t=new f(1/0,1/0,1/0),e=new f(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){this.makeEmpty();for(let e=0,i=t.length;e<i;e+=3)this.expandByPoint(at.fromArray(t,e));return this}setFromBufferAttribute(t){this.makeEmpty();for(let e=0,i=t.count;e<i;e++)this.expandByPoint(at.fromBufferAttribute(t,e));return this}setFromPoints(t){this.makeEmpty();for(let e=0,i=t.length;e<i;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){const i=at.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(i),this.max.copy(t).add(i),this}setFromObject(t,e=!1){return this.makeEmpty(),this.expandByObject(t,e)}clone(){return new this.constructor().copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.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(t){return this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}expandByObject(t,e=!1){t.updateWorldMatrix(!1,!1);const i=t.geometry;if(i!==void 0){const n=i.getAttribute("position");if(e===!0&&n!==void 0&&t.isInstancedMesh!==!0)for(let r=0,o=n.count;r<o;r++)t.isMesh===!0?t.getVertexPosition(r,at):at.fromBufferAttribute(n,r),at.applyMatrix4(t.matrixWorld),this.expandByPoint(at);else t.boundingBox!==void 0?(t.boundingBox===null&&t.computeBoundingBox(),Se.copy(t.boundingBox)):(i.boundingBox===null&&i.computeBoundingBox(),Se.copy(i.boundingBox)),Se.applyMatrix4(t.matrixWorld),this.union(Se)}const s=t.children;for(let n=0,r=s.length;n<r;n++)this.expandByObject(s[n],e);return this}containsPoint(t){return t.x>=this.min.x&&t.x<=this.max.x&&t.y>=this.min.y&&t.y<=this.max.y&&t.z>=this.min.z&&t.z<=this.max.z}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return t.max.x>=this.min.x&&t.min.x<=this.max.x&&t.max.y>=this.min.y&&t.min.y<=this.max.y&&t.max.z>=this.min.z&&t.min.z<=this.max.z}intersectsSphere(t){return this.clampPoint(t.center,at),at.distanceToSquared(t.center)<=t.radius*t.radius}intersectsPlane(t){let e,i;return t.normal.x>0?(e=t.normal.x*this.min.x,i=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,i=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,i+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,i+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,i+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,i+=t.normal.z*this.min.z),e<=-t.constant&&i>=-t.constant}intersectsTriangle(t){if(this.isEmpty())return!1;this.getCenter(ae),Ae.subVectors(this.max,ae),Xt.subVectors(t.a,ae),Jt.subVectors(t.b,ae),Ht.subVectors(t.c,ae),zt.subVectors(Jt,Xt),Ct.subVectors(Ht,Jt),It.subVectors(Xt,Ht);let e=[0,-zt.z,zt.y,0,-Ct.z,Ct.y,0,-It.z,It.y,zt.z,0,-zt.x,Ct.z,0,-Ct.x,It.z,0,-It.x,-zt.y,zt.x,0,-Ct.y,Ct.x,0,-It.y,It.x,0];return!si(e,Xt,Jt,Ht,Ae)||(e=[1,0,0,0,1,0,0,0,1],!si(e,Xt,Jt,Ht,Ae))?!1:(_e.crossVectors(zt,Ct),e=[_e.x,_e.y,_e.z],si(e,Xt,Jt,Ht,Ae))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,at).distanceTo(t)}getBoundingSphere(t){return this.isEmpty()?t.makeEmpty():(this.getCenter(t.center),t.radius=this.getSize(at).length()*.5),t}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()?this:(yt[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),yt[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),yt[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),yt[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),yt[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),yt[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),yt[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),yt[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(yt),this)}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}const yt=[new f,new f,new f,new f,new f,new f,new f,new f],at=new f,Se=new re,Xt=new f,Jt=new f,Ht=new f,zt=new f,Ct=new f,It=new f,ae=new f,Ae=new f,_e=new f,Lt=new f;function si(c,t,e,i,s){for(let n=0,r=c.length-3;n<=r;n+=3){Lt.fromArray(c,n);const o=s.x*Math.abs(Lt.x)+s.y*Math.abs(Lt.y)+s.z*Math.abs(Lt.z),a=t.dot(Lt),h=e.dot(Lt),l=i.dot(Lt);if(Math.max(-Math.max(a,h,l),Math.min(a,h,l))>o)return!1}return!0}const mo=new re,oe=new f,ni=new f;class Me{constructor(t=new f,e=-1){this.isSphere=!0,this.center=t,this.radius=e}set(t,e){return this.center.copy(t),this.radius=e,this}setFromPoints(t,e){const i=this.center;e!==void 0?i.copy(e):mo.setFromPoints(t).getCenter(i);let s=0;for(let n=0,r=t.length;n<r;n++)s=Math.max(s,i.distanceToSquared(t[n]));return this.radius=Math.sqrt(s),this}copy(t){return this.center.copy(t.center),this.radius=t.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(t){return t.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(t){return t.distanceTo(this.center)-this.radius}intersectsSphere(t){const e=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=e*e}intersectsBox(t){return t.intersectsSphere(this)}intersectsPlane(t){return Math.abs(t.distanceToPoint(this.center))<=this.radius}clampPoint(t,e){const i=this.center.distanceToSquared(t);return e.copy(t),i>this.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e}getBoundingBox(t){return this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)}applyMatrix4(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this}translate(t){return this.center.add(t),this}expandByPoint(t){if(this.isEmpty())return this.center.copy(t),this.radius=0,this;oe.subVectors(t,this.center);const e=oe.lengthSq();if(e>this.radius*this.radius){const i=Math.sqrt(e),s=(i-this.radius)*.5;this.center.addScaledVector(oe,s/i),this.radius+=s}return this}union(t){return t.isEmpty()?this:this.isEmpty()?(this.copy(t),this):(this.center.equals(t.center)===!0?this.radius=Math.max(this.radius,t.radius):(ni.subVectors(t.center,this.center).setLength(t.radius),this.expandByPoint(oe.copy(t.center).add(ni)),this.expandByPoint(oe.copy(t.center).sub(ni))),this)}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return new this.constructor().copy(this)}}const xt=new f,ri=new f,ve=new f,Tt=new f,ai=new f,ze=new f,oi=new f;class Ze{constructor(t=new f,e=new f(0,0,-1)){this.origin=t,this.direction=e}set(t,e){return this.origin.copy(t),this.direction.copy(e),this}copy(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this}at(t,e){return e.copy(this.origin).addScaledVector(this.direction,t)}lookAt(t){return this.direction.copy(t).sub(this.origin).normalize(),this}recast(t){return this.origin.copy(this.at(t,xt)),this}closestPointToPoint(t,e){e.subVectors(t,this.origin);const i=e.dot(this.direction);return i<0?e.copy(this.origin):e.copy(this.origin).addScaledVector(this.direction,i)}distanceToPoint(t){return Math.sqrt(this.distanceSqToPoint(t))}distanceSqToPoint(t){const e=xt.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(xt.copy(this.origin).addScaledVector(this.direction,e),xt.distanceToSquared(t))}distanceSqToSegment(t,e,i,s){ri.copy(t).add(e).multiplyScalar(.5),ve.copy(e).sub(t).normalize(),Tt.copy(this.origin).sub(ri);const n=t.distanceTo(e)*.5,r=-this.direction.dot(ve),o=Tt.dot(this.direction),a=-Tt.dot(ve),h=Tt.lengthSq(),l=Math.abs(1-r*r);let u,p,d,m;if(l>0)if(u=r*a-o,p=r*o-a,m=n*l,u>=0)if(p>=-m)if(p<=m){const y=1/l;u*=y,p*=y,d=u*(u+r*p+2*o)+p*(r*u+p+2*a)+h}else p=n,u=Math.max(0,-(r*p+o)),d=-u*u+p*(p+2*a)+h;else p=-n,u=Math.max(0,-(r*p+o)),d=-u*u+p*(p+2*a)+h;else p<=-m?(u=Math.max(0,-(-r*n+o)),p=u>0?-n:Math.min(Math.max(-n,-a),n),d=-u*u+p*(p+2*a)+h):p<=m?(u=0,p=Math.min(Math.max(-n,-a),n),d=p*(p+2*a)+h):(u=Math.max(0,-(r*n+o)),p=u>0?n:Math.min(Math.max(-n,-a),n),d=-u*u+p*(p+2*a)+h);else p=r>0?-n:n,u=Math.max(0,-(r*p+o)),d=-u*u+p*(p+2*a)+h;return i&&i.copy(this.origin).addScaledVector(this.direction,u),s&&s.copy(ri).addScaledVector(ve,p),d}intersectSphere(t,e){xt.subVectors(t.center,this.origin);const i=xt.dot(this.direction),s=xt.dot(xt)-i*i,n=t.radius*t.radius;if(s>n)return null;const r=Math.sqrt(n-s),o=i-r,a=i+r;return a<0?null:o<0?this.at(a,e):this.at(o,e)}intersectsSphere(t){return this.distanceSqToPoint(t.center)<=t.radius*t.radius}distanceToPlane(t){const e=t.normal.dot(this.direction);if(e===0)return t.distanceToPoint(this.origin)===0?0:null;const i=-(this.origin.dot(t.normal)+t.constant)/e;return i>=0?i:null}intersectPlane(t,e){const i=this.distanceToPlane(t);return i===null?null:this.at(i,e)}intersectsPlane(t){const e=t.distanceToPoint(this.origin);return e===0||t.normal.dot(this.direction)*e<0}intersectBox(t,e){let i,s,n,r,o,a;const h=1/this.direction.x,l=1/this.direction.y,u=1/this.direction.z,p=this.origin;return h>=0?(i=(t.min.x-p.x)*h,s=(t.max.x-p.x)*h):(i=(t.max.x-p.x)*h,s=(t.min.x-p.x)*h),l>=0?(n=(t.min.y-p.y)*l,r=(t.max.y-p.y)*l):(n=(t.max.y-p.y)*l,r=(t.min.y-p.y)*l),i>r||n>s||((n>i||isNaN(i))&&(i=n),(r<s||isNaN(s))&&(s=r),u>=0?(o=(t.min.z-p.z)*u,a=(t.max.z-p.z)*u):(o=(t.max.z-p.z)*u,a=(t.min.z-p.z)*u),i>a||o>s)||((o>i||i!==i)&&(i=o),(a<s||s!==s)&&(s=a),s<0)?null:this.at(i>=0?i:s,e)}intersectsBox(t){return this.intersectBox(t,xt)!==null}intersectTriangle(t,e,i,s,n){ai.subVectors(e,t),ze.subVectors(i,t),oi.crossVectors(ai,ze);let r=this.direction.dot(oi),o;if(r>0){if(s)return null;o=1}else if(r<0)o=-1,r=-r;else return null;Tt.subVectors(this.origin,t);const a=o*this.direction.dot(ze.crossVectors(Tt,ze));if(a<0)return null;const h=o*this.direction.dot(ai.cross(Tt));if(h<0||a+h>r)return null;const l=-o*Tt.dot(oi);return l<0?null:this.at(l/r,n)}applyMatrix4(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this}equals(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class D{constructor(t,e,i,s,n,r,o,a,h,l,u,p,d,m,y,x){D.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],t!==void 0&&this.set(t,e,i,s,n,r,o,a,h,l,u,p,d,m,y,x)}set(t,e,i,s,n,r,o,a,h,l,u,p,d,m,y,x){const g=this.elements;return g[0]=t,g[4]=e,g[8]=i,g[12]=s,g[1]=n,g[5]=r,g[9]=o,g[13]=a,g[2]=h,g[6]=l,g[10]=u,g[14]=p,g[3]=d,g[7]=m,g[11]=y,g[15]=x,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 D().fromArray(this.elements)}copy(t){const e=this.elements,i=t.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],e[9]=i[9],e[10]=i[10],e[11]=i[11],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15],this}copyPosition(t){const e=this.elements,i=t.elements;return e[12]=i[12],e[13]=i[13],e[14]=i[14],this}setFromMatrix3(t){const e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this}extractBasis(t,e,i){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this}makeBasis(t,e,i){return this.set(t.x,e.x,i.x,0,t.y,e.y,i.y,0,t.z,e.z,i.z,0,0,0,0,1),this}extractRotation(t){const e=this.elements,i=t.elements,s=1/Yt.setFromMatrixColumn(t,0).length(),n=1/Yt.setFromMatrixColumn(t,1).length(),r=1/Yt.setFromMatrixColumn(t,2).length();return e[0]=i[0]*s,e[1]=i[1]*s,e[2]=i[2]*s,e[3]=0,e[4]=i[4]*n,e[5]=i[5]*n,e[6]=i[6]*n,e[7]=0,e[8]=i[8]*r,e[9]=i[9]*r,e[10]=i[10]*r,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(t){const e=this.elements,i=t.x,s=t.y,n=t.z,r=Math.cos(i),o=Math.sin(i),a=Math.cos(s),h=Math.sin(s),l=Math.cos(n),u=Math.sin(n);if(t.order==="XYZ"){const p=r*l,d=r*u,m=o*l,y=o*u;e[0]=a*l,e[4]=-a*u,e[8]=h,e[1]=d+m*h,e[5]=p-y*h,e[9]=-o*a,e[2]=y-p*h,e[6]=m+d*h,e[10]=r*a}else if(t.order==="YXZ"){const p=a*l,d=a*u,m=h*l,y=h*u;e[0]=p+y*o,e[4]=m*o-d,e[8]=r*h,e[1]=r*u,e[5]=r*l,e[9]=-o,e[2]=d*o-m,e[6]=y+p*o,e[10]=r*a}else if(t.order==="ZXY"){const p=a*l,d=a*u,m=h*l,y=h*u;e[0]=p-y*o,e[4]=-r*u,e[8]=m+d*o,e[1]=d+m*o,e[5]=r*l,e[9]=y-p*o,e[2]=-r*h,e[6]=o,e[10]=r*a}else if(t.order==="ZYX"){const p=r*l,d=r*u,m=o*l,y=o*u;e[0]=a*l,e[4]=m*h-d,e[8]=p*h+y,e[1]=a*u,e[5]=y*h+p,e[9]=d*h-m,e[2]=-h,e[6]=o*a,e[10]=r*a}else if(t.order==="YZX"){const p=r*a,d=r*h,m=o*a,y=o*h;e[0]=a*l,e[4]=y-p*u,e[8]=m*u+d,e[1]=u,e[5]=r*l,e[9]=-o*l,e[2]=-h*l,e[6]=d*u+m,e[10]=p-y*u}else if(t.order==="XZY"){const p=r*a,d=r*h,m=o*a,y=o*h;e[0]=a*l,e[4]=-u,e[8]=h*l,e[1]=p*u+y,e[5]=r*l,e[9]=d*u-m,e[2]=m*u-d,e[6]=o*l,e[10]=y*u+p}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose(fo,t,yo)}lookAt(t,e,i){const s=this.elements;return Q.subVectors(t,e),Q.lengthSq()===0&&(Q.z=1),Q.normalize(),Ft.crossVectors(i,Q),Ft.lengthSq()===0&&(Math.abs(i.z)===1?Q.x+=1e-4:Q.z+=1e-4,Q.normalize(),Ft.crossVectors(i,Q)),Ft.normalize(),Ce.crossVectors(Q,Ft),s[0]=Ft.x,s[4]=Ce.x,s[8]=Q.x,s[1]=Ft.y,s[5]=Ce.y,s[9]=Q.y,s[2]=Ft.z,s[6]=Ce.z,s[10]=Q.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const i=t.elements,s=e.elements,n=this.elements,r=i[0],o=i[4],a=i[8],h=i[12],l=i[1],u=i[5],p=i[9],d=i[13],m=i[2],y=i[6],x=i[10],g=i[14],b=i[3],w=i[7],M=i[11],S=i[15],v=s[0],_=s[4],A=s[8],F=s[12],B=s[1],P=s[5],R=s[9],E=s[13],L=s[2],G=s[6],it=s[10],Pt=s[14],vt=s[3],U=s[7],W=s[11],$=s[15];return n[0]=r*v+o*B+a*L+h*vt,n[4]=r*_+o*P+a*G+h*U,n[8]=r*A+o*R+a*it+h*W,n[12]=r*F+o*E+a*Pt+h*$,n[1]=l*v+u*B+p*L+d*vt,n[5]=l*_+u*P+p*G+d*U,n[9]=l*A+u*R+p*it+d*W,n[13]=l*F+u*E+p*Pt+d*$,n[2]=m*v+y*B+x*L+g*vt,n[6]=m*_+y*P+x*G+g*U,n[10]=m*A+y*R+x*it+g*W,n[14]=m*F+y*E+x*Pt+g*$,n[3]=b*v+w*B+M*L+S*vt,n[7]=b*_+w*P+M*G+S*U,n[11]=b*A+w*R+M*it+S*W,n[15]=b*F+w*E+M*Pt+S*$,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this}determinant(){const t=this.elements,e=t[0],i=t[4],s=t[8],n=t[12],r=t[1],o=t[5],a=t[9],h=t[13],l=t[2],u=t[6],p=t[10],d=t[14],m=t[3],y=t[7],x=t[11],g=t[15];return m*(+n*a*u-s*h*u-n*o*p+i*h*p+s*o*d-i*a*d)+y*(+e*a*d-e*h*p+n*r*p-s*r*d+s*h*l-n*a*l)+x*(+e*h*u-e*o*d-n*r*u+i*r*d+n*o*l-i*h*l)+g*(-s*o*l-e*a*u+e*o*p+s*r*u-i*r*p+i*a*l)}transpose(){const t=this.elements;let e;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(t,e,i){const s=this.elements;return t.isVector3?(s[12]=t.x,s[13]=t.y,s[14]=t.z):(s[12]=t,s[13]=e,s[14]=i),this}invert(){const t=this.elements,e=t[0],i=t[1],s=t[2],n=t[3],r=t[4],o=t[5],a=t[6],h=t[7],l=t[8],u=t[9],p=t[10],d=t[11],m=t[12],y=t[13],x=t[14],g=t[15],b=u*x*h-y*p*h+y*a*d-o*x*d-u*a*g+o*p*g,w=m*p*h-l*x*h-m*a*d+r*x*d+l*a*g-r*p*g,M=l*y*h-m*u*h+m*o*d-r*y*d-l*o*g+r*u*g,S=m*u*a-l*y*a-m*o*p+r*y*p+l*o*x-r*u*x,v=e*b+i*w+s*M+n*S;if(v===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const _=1/v;return t[0]=b*_,t[1]=(y*p*n-u*x*n-y*s*d+i*x*d+u*s*g-i*p*g)*_,t[2]=(o*x*n-y*a*n+y*s*h-i*x*h-o*s*g+i*a*g)*_,t[3]=(u*a*n-o*p*n-u*s*h+i*p*h+o*s*d-i*a*d)*_,t[4]=w*_,t[5]=(l*x*n-m*p*n+m*s*d-e*x*d-l*s*g+e*p*g)*_,t[6]=(m*a*n-r*x*n-m*s*h+e*x*h+r*s*g-e*a*g)*_,t[7]=(r*p*n-l*a*n+l*s*h-e*p*h-r*s*d+e*a*d)*_,t[8]=M*_,t[9]=(m*u*n-l*y*n-m*i*d+e*y*d+l*i*g-e*u*g)*_,t[10]=(r*y*n-m*o*n+m*i*h-e*y*h-r*i*g+e*o*g)*_,t[11]=(l*o*n-r*u*n-l*i*h+e*u*h+r*i*d-e*o*d)*_,t[12]=S*_,t[13]=(l*y*s-m*u*s+m*i*p-e*y*p-l*i*x+e*u*x)*_,t[14]=(m*o*s-r*y*s-m*i*a+e*y*a+r*i*x-e*o*x)*_,t[15]=(r*u*s-l*o*s+l*i*a-e*u*a-r*i*p+e*o*p)*_,this}scale(t){const e=this.elements,i=t.x,s=t.y,n=t.z;return e[0]*=i,e[4]*=s,e[8]*=n,e[1]*=i,e[5]*=s,e[9]*=n,e[2]*=i,e[6]*=s,e[10]*=n,e[3]*=i,e[7]*=s,e[11]*=n,this}getMaxScaleOnAxis(){const t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],i=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],s=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,i,s))}makeTranslation(t,e,i){return t.isVector3?this.set(1,0,0,t.x,0,1,0,t.y,0,0,1,t.z,0,0,0,1):this.set(1,0,0,t,0,1,0,e,0,0,1,i,0,0,0,1),this}makeRotationX(t){const e=Math.cos(t),i=Math.sin(t);return this.set(1,0,0,0,0,e,-i,0,0,i,e,0,0,0,0,1),this}makeRotationY(t){const e=Math.cos(t),i=Math.sin(t);return this.set(e,0,i,0,0,1,0,0,-i,0,e,0,0,0,0,1),this}makeRotationZ(t){const e=Math.cos(t),i=Math.sin(t);return this.set(e,-i,0,0,i,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){const i=Math.cos(e),s=Math.sin(e),n=1-i,r=t.x,o=t.y,a=t.z,h=n*r,l=n*o;return this.set(h*r+i,h*o-s*a,h*a+s*o,0,h*o+s*a,l*o+i,l*a-s*r,0,h*a-s*o,l*a+s*r,n*a*a+i,0,0,0,0,1),this}makeScale(t,e,i){return this.set(t,0,0,0,0,e,0,0,0,0,i,0,0,0,0,1),this}makeShear(t,e,i,s,n,r){return this.set(1,i,n,0,t,1,r,0,e,s,1,0,0,0,0,1),this}compose(t,e,i){const s=this.elements,n=e._x,r=e._y,o=e._z,a=e._w,h=n+n,l=r+r,u=o+o,p=n*h,d=n*l,m=n*u,y=r*l,x=r*u,g=o*u,b=a*h,w=a*l,M=a*u,S=i.x,v=i.y,_=i.z;return s[0]=(1-(y+g))*S,s[1]=(d+M)*S,s[2]=(m-w)*S,s[3]=0,s[4]=(d-M)*v,s[5]=(1-(p+g))*v,s[6]=(x+b)*v,s[7]=0,s[8]=(m+w)*_,s[9]=(x-b)*_,s[10]=(1-(p+y))*_,s[11]=0,s[12]=t.x,s[13]=t.y,s[14]=t.z,s[15]=1,this}decompose(t,e,i){const s=this.elements;let n=Yt.set(s[0],s[1],s[2]).length();const r=Yt.set(s[4],s[5],s[6]).length(),o=Yt.set(s[8],s[9],s[10]).length();this.determinant()<0&&(n=-n),t.x=s[12],t.y=s[13],t.z=s[14],ot.copy(this);const h=1/n,l=1/r,u=1/o;return ot.elements[0]*=h,ot.elements[1]*=h,ot.elements[2]*=h,ot.elements[4]*=l,ot.elements[5]*=l,ot.elements[6]*=l,ot.elements[8]*=u,ot.elements[9]*=u,ot.elements[10]*=u,e.setFromRotationMatrix(ot),i.x=n,i.y=r,i.z=o,this}makePerspective(t,e,i,s,n,r,o=St){const a=this.elements,h=2*n/(e-t),l=2*n/(i-s),u=(e+t)/(e-t),p=(i+s)/(i-s);let d,m;if(o===St)d=-(r+n)/(r-n),m=-2*r*n/(r-n);else if(o===xe)d=-r/(r-n),m=-r*n/(r-n);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);return a[0]=h,a[4]=0,a[8]=u,a[12]=0,a[1]=0,a[5]=l,a[9]=p,a[13]=0,a[2]=0,a[6]=0,a[10]=d,a[14]=m,a[3]=0,a[7]=0,a[11]=-1,a[15]=0,this}makeOrthographic(t,e,i,s,n,r,o=St){const a=this.elements,h=1/(e-t),l=1/(i-s),u=1/(r-n),p=(e+t)*h,d=(i+s)*l;let m,y;if(o===St)m=(r+n)*u,y=-2*u;else if(o===xe)m=n*u,y=-1*u;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);return a[0]=2*h,a[4]=0,a[8]=0,a[12]=-p,a[1]=0,a[5]=2*l,a[9]=0,a[13]=-d,a[2]=0,a[6]=0,a[10]=y,a[14]=-m,a[3]=0,a[7]=0,a[11]=0,a[15]=1,this}equals(t){const e=this.elements,i=t.elements;for(let s=0;s<16;s++)if(e[s]!==i[s])return!1;return!0}fromArray(t,e=0){for(let i=0;i<16;i++)this.elements[i]=t[i+e];return this}toArray(t=[],e=0){const i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t[e+9]=i[9],t[e+10]=i[10],t[e+11]=i[11],t[e+12]=i[12],t[e+13]=i[13],t[e+14]=i[14],t[e+15]=i[15],t}}const Yt=new f,ot=new D,fo=new f(0,0,0),yo=new f(1,1,1),Ft=new f,Ce=new f,Q=new f,ms=new D,fs=new ne;class ct{constructor(t=0,e=0,i=0,s=ct.DEFAULT_ORDER){this.isEuler=!0,this._x=t,this._y=e,this._z=i,this._order=s}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,e,i,s=this._order){return this._x=t,this._y=e,this._z=i,this._order=s,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,e=this._order,i=!0){const s=t.elements,n=s[0],r=s[4],o=s[8],a=s[1],h=s[5],l=s[9],u=s[2],p=s[6],d=s[10];switch(e){case"XYZ":this._y=Math.asin(T(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-l,d),this._z=Math.atan2(-r,n)):(this._x=Math.atan2(p,h),this._z=0);break;case"YXZ":this._x=Math.asin(-T(l,-1,1)),Math.abs(l)<.9999999?(this._y=Math.atan2(o,d),this._z=Math.atan2(a,h)):(this._y=Math.atan2(-u,n),this._z=0);break;case"ZXY":this._x=Math.asin(T(p,-1,1)),Math.abs(p)<.9999999?(this._y=Math.atan2(-u,d),this._z=Math.atan2(-r,h)):(this._y=0,this._z=Math.atan2(a,n));break;case"ZYX":this._y=Math.asin(-T(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(p,d),this._z=Math.atan2(a,n)):(this._x=0,this._z=Math.atan2(-r,h));break;case"YZX":this._z=Math.asin(T(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-l,h),this._y=Math.atan2(-u,n)):(this._x=0,this._y=Math.atan2(o,d));break;case"XZY":this._z=Math.asin(-T(r,-1,1)),Math.abs(r)<.9999999?(this._x=Math.atan2(p,h),this._y=Math.atan2(o,n)):(this._x=Math.atan2(-l,d),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+e)}return this._order=e,i===!0&&this._onChangeCallback(),this}setFromQuaternion(t,e,i){return ms.makeRotationFromQuaternion(t),this.setFromRotationMatrix(ms,e,i)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return fs.setFromEuler(this),this.setFromQuaternion(fs,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],t[3]!==void 0&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}ct.DEFAULT_ORDER="XYZ";class Zi{constructor(){this.mask=1}set(t){this.mask=(1<<t|0)>>>0}enable(t){this.mask|=1<<t|0}enableAll(){this.mask=-1}toggle(t){this.mask^=1<<t|0}disable(t){this.mask&=~(1<<t|0)}disableAll(){this.mask=0}test(t){return(this.mask&t.mask)!==0}isEnabled(t){return(this.mask&(1<<t|0))!==0}}let xo=0;const ys=new f,jt=new ne,gt=new D,Te=new f,he=new f,go=new f,Mo=new ne,xs=new f(1,0,0),gs=new f(0,1,0),Ms=new f(0,0,1),ws={type:"added"},wo={type:"removed"},Zt={type:"childadded",child:null},hi={type:"childremoved",child:null};class k extends Gt{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:xo++}),this.uuid=At(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=k.DEFAULT_UP.clone();const t=new f,e=new ct,i=new ne,s=new f(1,1,1);function n(){i.setFromEuler(e,!1)}function r(){e.setFromQuaternion(i,void 0,!1)}e._onChange(n),i._onChange(r),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:t},rotation:{configurable:!0,enumerable:!0,value:e},quaternion:{configurable:!0,enumerable:!0,value:i},scale:{configurable:!0,enumerable:!0,value:s},modelViewMatrix:{value:new D},normalMatrix:{value:new dt}}),this.matrix=new D,this.matrixWorld=new D,this.matrixAutoUpdate=k.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=k.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Zi,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(t){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(t),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(t){return this.quaternion.premultiply(t),this}setRotationFromAxisAngle(t,e){this.quaternion.setFromAxisAngle(t,e)}setRotationFromEuler(t){this.quaternion.setFromEuler(t,!0)}setRotationFromMatrix(t){this.quaternion.setFromRotationMatrix(t)}setRotationFromQuaternion(t){this.quaternion.copy(t)}rotateOnAxis(t,e){return jt.setFromAxisAngle(t,e),this.quaternion.multiply(jt),this}rotateOnWorldAxis(t,e){return jt.setFromAxisAngle(t,e),this.quaternion.premultiply(jt),this}rotateX(t){return this.rotateOnAxis(xs,t)}rotateY(t){return this.rotateOnAxis(gs,t)}rotateZ(t){return this.rotateOnAxis(Ms,t)}translateOnAxis(t,e){return ys.copy(t).applyQuaternion(this.quaternion),this.position.add(ys.multiplyScalar(e)),this}translateX(t){return this.translateOnAxis(xs,t)}translateY(t){return this.translateOnAxis(gs,t)}translateZ(t){return this.translateOnAxis(Ms,t)}localToWorld(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(this.matrixWorld)}worldToLocal(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(gt.copy(this.matrixWorld).invert())}lookAt(t,e,i){t.isVector3?Te.copy(t):Te.set(t,e,i);const s=this.parent;this.updateWorldMatrix(!0,!1),he.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?gt.lookAt(he,Te,this.up):gt.lookAt(Te,he,this.up),this.quaternion.setFromRotationMatrix(gt),s&&(gt.extractRotation(s.matrixWorld),jt.setFromRotationMatrix(gt),this.quaternion.premultiply(jt.invert()))}add(t){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return t===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",t),this):(t&&t.isObject3D?(t.removeFromParent(),t.parent=this,this.children.push(t),t.dispatchEvent(ws),Zt.child=t,this.dispatchEvent(Zt),Zt.child=null):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",t),this)}remove(t){if(arguments.length>1){for(let i=0;i<arguments.length;i++)this.remove(arguments[i]);return this}const e=this.children.indexOf(t);return e!==-1&&(t.parent=null,this.children.splice(e,1),t.dispatchEvent(wo),hi.child=t,this.dispatchEvent(hi),hi.child=null),this}removeFromParent(){const t=this.parent;return t!==null&&t.remove(this),this}clear(){return this.remove(...this.children)}attach(t){return this.updateWorldMatrix(!0,!1),gt.copy(this.matrixWorld).invert(),t.parent!==null&&(t.parent.updateWorldMatrix(!0,!1),gt.multiply(t.parent.matrixWorld)),t.applyMatrix4(gt),t.removeFromParent(),t.parent=this,this.children.push(t),t.updateWorldMatrix(!1,!0),t.dispatchEvent(ws),Zt.child=t,this.dispatchEvent(Zt),Zt.child=null,this}getObjectById(t){return this.getObjectByProperty("id",t)}getObjectByName(t){return this.getObjectByProperty("name",t)}getObjectByProperty(t,e){if(this[t]===e)return this;for(let i=0,s=this.children.length;i<s;i++){const r=this.children[i].getObjectByProperty(t,e);if(r!==void 0)return r}}getObjectsByProperty(t,e,i=[]){this[t]===e&&i.push(this);const s=this.children;for(let n=0,r=s.length;n<r;n++)s[n].getObjectsByProperty(t,e,i);return i}getWorldPosition(t){return this.updateWorldMatrix(!0,!1),t.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(he,t,go),t}getWorldScale(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(he,Mo,t),t}getWorldDirection(t){this.updateWorldMatrix(!0,!1);const e=this.matrixWorld.elements;return t.set(e[8],e[9],e[10]).normalize()}raycast(){}traverse(t){t(this);const e=this.children;for(let i=0,s=e.length;i<s;i++)e[i].traverse(t)}traverseVisible(t){if(this.visible===!1)return;t(this);const e=this.children;for(let i=0,s=e.length;i<s;i++)e[i].traverseVisible(t)}traverseAncestors(t){const e=this.parent;e!==null&&(t(e),e.traverseAncestors(t))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,t=!0);const e=this.children;for(let i=0,s=e.length;i<s;i++)e[i].updateMatrixWorld(t)}updateWorldMatrix(t,e){const i=this.parent;if(t===!0&&i!==null&&i.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),e===!0){const s=this.children;for(let n=0,r=s.length;n<r;n++)s[n].updateWorldMatrix(!1,!0)}}toJSON(t){const e=t===void 0||typeof t=="string",i={};e&&(t={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},i.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});const s={};s.uuid=this.uuid,s.type=this.type,this.name!==""&&(s.name=this.name),this.castShadow===!0&&(s.castShadow=!0),this.receiveShadow===!0&&(s.receiveShadow=!0),this.visible===!1&&(s.visible=!1),this.frustumCulled===!1&&(s.frustumCulled=!1),this.renderOrder!==0&&(s.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(s.userData=this.userData),s.layers=this.layers.mask,s.matrix=this.matrix.toArray(),s.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(s.matrixAutoUpdate=!1),this.isInstancedMesh&&(s.type="InstancedMesh",s.count=this.count,s.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(s.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(s.type="BatchedMesh",s.perObjectFrustumCulled=this.perObjectFrustumCulled,s.sortObjects=this.sortObjects,s.drawRanges=this._drawRanges,s.reservedRanges=this._reservedRanges,s.visibility=this._visibility,s.active=this._active,s.bounds=this._bounds.map(o=>({boxInitialized:o.boxInitialized,boxMin:o.box.min.toArray(),boxMax:o.box.max.toArray(),sphereInitialized:o.sphereInitialized,sphereRadius:o.sphere.radius,sphereCenter:o.sphere.center.toArray()})),s.maxInstanceCount=this._maxInstanceCount,s.maxVertexCount=this._maxVertexCount,s.maxIndexCount=this._maxIndexCount,s.geometryInitialized=this._geometryInitialized,s.geometryCount=this._geometryCount,s.matricesTexture=this._matricesTexture.toJSON(t),this._colorsTexture!==null&&(s.colorsTexture=this._colorsTexture.toJSON(t)),this.boundingSphere!==null&&(s.boundingSphere={center:s.boundingSphere.center.toArray(),radius:s.boundingSphere.radius}),this.boundingBox!==null&&(s.boundingBox={min:s.boundingBox.min.toArray(),max:s.boundingBox.max.toArray()}));function n(o,a){return o[a.uuid]===void 0&&(o[a.uuid]=a.toJSON(t)),a.uuid}if(this.isScene)this.background&&(this.background.isColor?s.background=this.background.toJSON():this.background.isTexture&&(s.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(s.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){s.geometry=n(t.geometries,this.geometry);const o=this.geometry.parameters;if(o!==void 0&&o.shapes!==void 0){const a=o.shapes;if(Array.isArray(a))for(let h=0,l=a.length;h<l;h++){const u=a[h];n(t.shapes,u)}else n(t.shapes,a)}}if(this.isSkinnedMesh&&(s.bindMode=this.bindMode,s.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(n(t.skeletons,this.skeleton),s.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const o=[];for(let a=0,h=this.material.length;a<h;a++)o.push(n(t.materials,this.material[a]));s.material=o}else s.material=n(t.materials,this.material);if(this.children.length>0){s.children=[];for(let o=0;o<this.children.length;o++)s.children.push(this.children[o].toJSON(t).object)}if(this.animations.length>0){s.animations=[];for(let o=0;o<this.animations.length;o++){const a=this.animations[o];s.animations.push(n(t.animations,a))}}if(e){const o=r(t.geometries),a=r(t.materials),h=r(t.textures),l=r(t.images),u=r(t.shapes),p=r(t.skeletons),d=r(t.animations),m=r(t.nodes);o.length>0&&(i.geometries=o),a.length>0&&(i.materials=a),h.length>0&&(i.textures=h),l.length>0&&(i.images=l),u.length>0&&(i.shapes=u),p.length>0&&(i.skeletons=p),d.length>0&&(i.animations=d),m.length>0&&(i.nodes=m)}return i.object=s,i;function r(o){const a=[];for(const h in o){const l=o[h];delete l.metadata,a.push(l)}return a}}clone(t){return new this.constructor().copy(this,t)}copy(t,e=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldAutoUpdate=t.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.animations=t.animations.slice(),this.userData=JSON.parse(JSON.stringify(t.userData)),e===!0)for(let i=0;i<t.children.length;i++){const s=t.children[i];this.add(s.clone())}return this}}k.DEFAULT_UP=new f(0,1,0);k.DEFAULT_MATRIX_AUTO_UPDATE=!0;k.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const ht=new f,Mt=new f,li=new f,wt=new f,$t=new f,Qt=new f,bs=new f,ci=new f,ui=new f,pi=new f,di=new Y,mi=new Y,fi=new Y;class rt{constructor(t=new f,e=new f,i=new f){this.a=t,this.b=e,this.c=i}static getNormal(t,e,i,s){s.subVectors(i,e),ht.subVectors(t,e),s.cross(ht);const n=s.lengthSq();return n>0?s.multiplyScalar(1/Math.sqrt(n)):s.set(0,0,0)}static getBarycoord(t,e,i,s,n){ht.subVectors(s,e),Mt.subVectors(i,e),li.subVectors(t,e);const r=ht.dot(ht),o=ht.dot(Mt),a=ht.dot(li),h=Mt.dot(Mt),l=Mt.dot(li),u=r*h-o*o;if(u===0)return n.set(0,0,0),null;const p=1/u,d=(h*a-o*l)*p,m=(r*l-o*a)*p;return n.set(1-d-m,m,d)}static containsPoint(t,e,i,s){return this.getBarycoord(t,e,i,s,wt)===null?!1:wt.x>=0&&wt.y>=0&&wt.x+wt.y<=1}static getInterpolation(t,e,i,s,n,r,o,a){return this.getBarycoord(t,e,i,s,wt)===null?(a.x=0,a.y=0,"z"in a&&(a.z=0),"w"in a&&(a.w=0),null):(a.setScalar(0),a.addScaledVector(n,wt.x),a.addScaledVector(r,wt.y),a.addScaledVector(o,wt.z),a)}static getInterpolatedAttribute(t,e,i,s,n,r){return di.setScalar(0),mi.setScalar(0),fi.setScalar(0),di.fromBufferAttribute(t,e),mi.fromBufferAttribute(t,i),fi.fromBufferAttribute(t,s),r.setScalar(0),r.addScaledVector(di,n.x),r.addScaledVector(mi,n.y),r.addScaledVector(fi,n.z),r}static isFrontFacing(t,e,i,s){return ht.subVectors(i,e),Mt.subVectors(t,e),ht.cross(Mt).dot(s)<0}set(t,e,i){return this.a.copy(t),this.b.copy(e),this.c.copy(i),this}setFromPointsAndIndices(t,e,i,s){return this.a.copy(t[e]),this.b.copy(t[i]),this.c.copy(t[s]),this}setFromAttributeAndIndices(t,e,i,s){return this.a.fromBufferAttribute(t,e),this.b.fromBufferAttribute(t,i),this.c.fromBufferAttribute(t,s),this}clone(){return new this.constructor().copy(this)}copy(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this}getArea(){return ht.subVectors(this.c,this.b),Mt.subVectors(this.a,this.b),ht.cross(Mt).length()*.5}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return rt.getNormal(this.a,this.b,this.c,t)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return rt.getBarycoord(t,this.a,this.b,this.c,e)}getInterpolation(t,e,i,s,n){return rt.getInterpolation(t,this.a,this.b,this.c,e,i,s,n)}containsPoint(t){return rt.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return rt.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){const i=this.a,s=this.b,n=this.c;let r,o;$t.subVectors(s,i),Qt.subVectors(n,i),ci.subVectors(t,i);const a=$t.dot(ci),h=Qt.dot(ci);if(a<=0&&h<=0)return e.copy(i);ui.subVectors(t,s);const l=$t.dot(ui),u=Qt.dot(ui);if(l>=0&&u<=l)return e.copy(s);const p=a*u-l*h;if(p<=0&&a>=0&&l<=0)return r=a/(a-l),e.copy(i).addScaledVector($t,r);pi.subVectors(t,n);const d=$t.dot(pi),m=Qt.dot(pi);if(m>=0&&d<=m)return e.copy(n);const y=d*h-a*m;if(y<=0&&h>=0&&m<=0)return o=h/(h-m),e.copy(i).addScaledVector(Qt,o);const x=l*m-d*u;if(x<=0&&u-l>=0&&d-m>=0)return bs.subVectors(n,s),o=(u-l)/(u-l+(d-m)),e.copy(s).addScaledVector(bs,o);const g=1/(x+y+p);return r=y*g,o=p*g,e.copy(i).addScaledVector($t,r).addScaledVector(Qt,o)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}}const Vn={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},Bt={h:0,s:0,l:0},Fe={h:0,s:0,l:0};function yi(c,t,e){return e<0&&(e+=1),e>1&&(e-=1),e<1/6?c+(t-c)*6*e:e<1/2?t:e<2/3?c+(t-c)*6*(2/3-e):c}class I{constructor(t,e,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(t,e,i)}set(t,e,i){if(e===void 0&&i===void 0){const s=t;s&&s.isColor?this.copy(s):typeof s=="number"?this.setHex(s):typeof s=="string"&&this.setStyle(s)}else this.setRGB(t,e,i);return this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t,e=nt){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(t&255)/255,et.toWorkingColorSpace(this,e),this}setRGB(t,e,i,s=et.workingColorSpace){return this.r=t,this.g=e,this.b=i,et.toWorkingColorSpace(this,s),this}setHSL(t,e,i,s=et.workingColorSpace){if(t=Yi(t,1),e=T(e,0,1),i=T(i,0,1),e===0)this.r=this.g=this.b=i;else{const n=i<=.5?i*(1+e):i+e-i*e,r=2*i-n;this.r=yi(r,n,t+1/3),this.g=yi(r,n,t),this.b=yi(r,n,t-1/3)}return et.toWorkingColorSpace(this,s),this}setStyle(t,e=nt){function i(n){n!==void 0&&parseFloat(n)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}let s;if(s=/^(\w+)\(([^\)]*)\)/.exec(t)){let n;const r=s[1],o=s[2];switch(r){case"rgb":case"rgba":if(n=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return i(n[4]),this.setRGB(Math.min(255,parseInt(n[1],10))/255,Math.min(255,parseInt(n[2],10))/255,Math.min(255,parseInt(n[3],10))/255,e);if(n=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return i(n[4]),this.setRGB(Math.min(100,parseInt(n[1],10))/100,Math.min(100,parseInt(n[2],10))/100,Math.min(100,parseInt(n[3],10))/100,e);break;case"hsl":case"hsla":if(n=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return i(n[4]),this.setHSL(parseFloat(n[1])/360,parseFloat(n[2])/100,parseFloat(n[3])/100,e);break;default:console.warn("THREE.Color: Unknown color model "+t)}}else if(s=/^\#([A-Fa-f\d]+)$/.exec(t)){const n=s[1],r=n.length;if(r===3)return this.setRGB(parseInt(n.charAt(0),16)/15,parseInt(n.charAt(1),16)/15,parseInt(n.charAt(2),16)/15,e);if(r===6)return this.setHex(parseInt(n,16),e);console.warn("THREE.Color: Invalid hex color "+t)}else if(t&&t.length>0)return this.setColorName(t,e);return this}setColorName(t,e=nt){const i=Vn[t.toLowerCase()];return i!==void 0?this.setHex(i,e):console.warn("THREE.Color: Unknown color "+t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this}copySRGBToLinear(t){return this.r=_t(t.r),this.g=_t(t.g),this.b=_t(t.b),this}copyLinearToSRGB(t){return this.r=ie(t.r),this.g=ie(t.g),this.b=ie(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(t=nt){return et.fromWorkingColorSpace(X.copy(this),t),Math.round(T(X.r*255,0,255))*65536+Math.round(T(X.g*255,0,255))*256+Math.round(T(X.b*255,0,255))}getHexString(t=nt){return("000000"+this.getHex(t).toString(16)).slice(-6)}getHSL(t,e=et.workingColorSpace){et.fromWorkingColorSpace(X.copy(this),e);const i=X.r,s=X.g,n=X.b,r=Math.max(i,s,n),o=Math.min(i,s,n);let a,h;const l=(o+r)/2;if(o===r)a=0,h=0;else{const u=r-o;switch(h=l<=.5?u/(r+o):u/(2-r-o),r){case i:a=(s-n)/u+(s<n?6:0);break;case s:a=(n-i)/u+2;break;case n:a=(i-s)/u+4;break}a/=6}return t.h=a,t.s=h,t.l=l,t}getRGB(t,e=et.workingColorSpace){return et.fromWorkingColorSpace(X.copy(this),e),t.r=X.r,t.g=X.g,t.b=X.b,t}getStyle(t=nt){et.fromWorkingColorSpace(X.copy(this),t);const e=X.r,i=X.g,s=X.b;return t!==nt?`color(${t} ${e.toFixed(3)} ${i.toFixed(3)} ${s.toFixed(3)})`:`rgb(${Math.round(e*255)},${Math.round(i*255)},${Math.round(s*255)})`}offsetHSL(t,e,i){return this.getHSL(Bt),this.setHSL(Bt.h+t,Bt.s+e,Bt.l+i)}add(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this}addColors(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this}addScalar(t){return this.r+=t,this.g+=t,this.b+=t,this}sub(t){return this.r=Math.max(0,this.r-t.r),this.g=Math.max(0,this.g-t.g),this.b=Math.max(0,this.b-t.b),this}multiply(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this}multiplyScalar(t){return this.r*=t,this.g*=t,this.b*=t,this}lerp(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this}lerpColors(t,e,i){return this.r=t.r+(e.r-t.r)*i,this.g=t.g+(e.g-t.g)*i,this.b=t.b+(e.b-t.b)*i,this}lerpHSL(t,e){this.getHSL(Bt),t.getHSL(Fe);const i=de(Bt.h,Fe.h,e),s=de(Bt.s,Fe.s,e),n=de(Bt.l,Fe.l,e);return this.setHSL(i,s,n),this}setFromVector3(t){return this.r=t.x,this.g=t.y,this.b=t.z,this}applyMatrix3(t){const e=this.r,i=this.g,s=this.b,n=t.elements;return this.r=n[0]*e+n[3]*i+n[6]*s,this.g=n[1]*e+n[4]*i+n[7]*s,this.b=n[2]*e+n[5]*i+n[8]*s,this}equals(t){return t.r===this.r&&t.g===this.g&&t.b===this.b}fromArray(t,e=0){return this.r=t[e],this.g=t[e+1],this.b=t[e+2],this}toArray(t=[],e=0){return t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t}fromBufferAttribute(t,e){return this.r=t.getX(e),this.g=t.getY(e),this.b=t.getZ(e),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const X=new I;I.NAMES=Vn;let bo=0;class Z extends Gt{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:bo++}),this.uuid=At(),this.name="",this.type="Material",this.blending=zi,this.side=Xe,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=Ti,this.blendDst=Fi,this.blendEquation=Ci,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new I(0,0,0),this.blendAlpha=0,this.depthFunc=Bi,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=Di,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Ot,this.stencilZFail=Ot,this.stencilZPass=Ot,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(t){this._alphaTest>0!=t>0&&this.version++,this._alphaTest=t}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(t){if(t!==void 0)for(const e in t){const i=t[e];if(i===void 0){console.warn(`THREE.Material: parameter '${e}' has value of undefined.`);continue}const s=this[e];if(s===void 0){console.warn(`THREE.Material: '${e}' is not a property of THREE.${this.type}.`);continue}s&&s.isColor?s.set(i):s&&s.isVector3&&i&&i.isVector3?s.copy(i):this[e]=i}}toJSON(t){const e=t===void 0||typeof t=="string";e&&(t={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!==void 0&&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(t).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(t).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(t).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.dispersion!==void 0&&(i.dispersion=this.dispersion),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(t).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(i.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(t).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(t).uuid),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(t).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(t).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(t).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(t).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(t).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(t).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(t).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(t).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(t).uuid,this.combine!==void 0&&(i.combine=this.combine)),this.envMapRotation!==void 0&&(i.envMapRotation=this.envMapRotation.toArray()),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(t).uuid),this.transmission!==void 0&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(t).uuid),this.thickness!==void 0&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(t).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!==zi&&(i.blending=this.blending),this.side!==Xe&&(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!==Ti&&(i.blendSrc=this.blendSrc),this.blendDst!==Fi&&(i.blendDst=this.blendDst),this.blendEquation!==Ci&&(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!==Bi&&(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!==Di&&(i.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(i.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(i.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Ot&&(i.stencilFail=this.stencilFail),this.stencilZFail!==Ot&&(i.stencilZFail=this.stencilZFail),this.stencilZPass!==Ot&&(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 s(n){const r=[];for(const o in n){const a=n[o];delete a.metadata,r.push(a)}return r}if(e){const n=s(t.textures),r=s(t.images);n.length>0&&(i.textures=n),r.length>0&&(i.images=r)}return i}clone(){return new this.constructor().copy(this)}copy(t){this.name=t.name,this.blending=t.blending,this.side=t.side,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.blendColor.copy(t.blendColor),this.blendAlpha=t.blendAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.stencilWriteMask=t.stencilWriteMask,this.stencilFunc=t.stencilFunc,this.stencilRef=t.stencilRef,this.stencilFuncMask=t.stencilFuncMask,this.stencilFail=t.stencilFail,this.stencilZFail=t.stencilZFail,this.stencilZPass=t.stencilZPass,this.stencilWrite=t.stencilWrite;const e=t.clippingPlanes;let i=null;if(e!==null){const s=e.length;i=new Array(s);for(let n=0;n!==s;++n)i[n]=e[n].clone()}return this.clippingPlanes=i,this.clipIntersection=t.clipIntersection,this.clipShadows=t.clipShadows,this.shadowSide=t.shadowSide,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.alphaHash=t.alphaHash,this.alphaToCoverage=t.alphaToCoverage,this.premultipliedAlpha=t.premultipliedAlpha,this.forceSinglePass=t.forceSinglePass,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(t){t===!0&&this.version++}onBuild(){console.warn("Material: onBuild() has been removed.")}}class Un extends Z{constructor(t){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new I(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.envMapRotation=new ct,this.combine=je,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.fog=t.fog,this}}const bt=So();function So(){const c=new ArrayBuffer(4),t=new Float32Array(c),e=new Uint32Array(c),i=new Uint32Array(512),s=new Uint32Array(512);for(let a=0;a<256;++a){const h=a-127;h<-27?(i[a]=0,i[a|256]=32768,s[a]=24,s[a|256]=24):h<-14?(i[a]=1024>>-h-14,i[a|256]=1024>>-h-14|32768,s[a]=-h-1,s[a|256]=-h-1):h<=15?(i[a]=h+15<<10,i[a|256]=h+15<<10|32768,s[a]=13,s[a|256]=13):h<128?(i[a]=31744,i[a|256]=64512,s[a]=24,s[a|256]=24):(i[a]=31744,i[a|256]=64512,s[a]=13,s[a|256]=13)}const n=new Uint32Array(2048),r=new Uint32Array(64),o=new Uint32Array(64);for(let a=1;a<1024;++a){let h=a<<13,l=0;for(;(h&8388608)===0;)h<<=1,l-=8388608;h&=-8388609,l+=947912704,n[a]=h|l}for(let a=1024;a<2048;++a)n[a]=939524096+(a-1024<<13);for(let a=1;a<31;++a)r[a]=a<<23;r[31]=1199570944,r[32]=2147483648;for(let a=33;a<63;++a)r[a]=2147483648+(a-32<<23);r[63]=3347054592;for(let a=1;a<64;++a)a!==32&&(o[a]=1024);return{floatView:t,uint32View:e,baseTable:i,shiftTable:s,mantissaTable:n,exponentTable:r,offsetTable:o}}function K(c){Math.abs(c)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),c=T(c,-65504,65504),bt.floatView[0]=c;const t=bt.uint32View[0],e=t>>23&511;return bt.baseTable[e]+((t&8388607)>>bt.shiftTable[e])}function Be(c){const t=c>>10;return bt.uint32View[0]=bt.mantissaTable[bt.offsetTable[t]+(c&1023)]+bt.exponentTable[t],bt.floatView[0]}const O=new f,Re=new z;class pt{constructor(t,e,i=!1){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=t,this.itemSize=e,this.count=t!==void 0?t.length/e:0,this.normalized=i,this.usage=Je,this.updateRanges=[],this.gpuType=Xi,this.version=0}onUploadCallback(){}set needsUpdate(t){t===!0&&this.version++}setUsage(t){return this.usage=t,this}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}copy(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this.gpuType=t.gpuType,this}copyAt(t,e,i){t*=this.itemSize,i*=e.itemSize;for(let s=0,n=this.itemSize;s<n;s++)this.array[t+s]=e.array[i+s];return this}copyArray(t){return this.array.set(t),this}applyMatrix3(t){if(this.itemSize===2)for(let e=0,i=this.count;e<i;e++)Re.fromBufferAttribute(this,e),Re.applyMatrix3(t),this.setXY(e,Re.x,Re.y);else if(this.itemSize===3)for(let e=0,i=this.count;e<i;e++)O.fromBufferAttribute(this,e),O.applyMatrix3(t),this.setXYZ(e,O.x,O.y,O.z);return this}applyMatrix4(t){for(let e=0,i=this.count;e<i;e++)O.fromBufferAttribute(this,e),O.applyMatrix4(t),this.setXYZ(e,O.x,O.y,O.z);return this}applyNormalMatrix(t){for(let e=0,i=this.count;e<i;e++)O.fromBufferAttribute(this,e),O.applyNormalMatrix(t),this.setXYZ(e,O.x,O.y,O.z);return this}transformDirection(t){for(let e=0,i=this.count;e<i;e++)O.fromBufferAttribute(this,e),O.transformDirection(t),this.setXYZ(e,O.x,O.y,O.z);return this}set(t,e=0){return this.array.set(t,e),this}getComponent(t,e){let i=this.array[t*this.itemSize+e];return this.normalized&&(i=j(i,this.array)),i}setComponent(t,e,i){return this.normalized&&(i=C(i,this.array)),this.array[t*this.itemSize+e]=i,this}getX(t){let e=this.array[t*this.itemSize];return this.normalized&&(e=j(e,this.array)),e}setX(t,e){return this.normalized&&(e=C(e,this.array)),this.array[t*this.itemSize]=e,this}getY(t){let e=this.array[t*this.itemSize+1];return this.normalized&&(e=j(e,this.array)),e}setY(t,e){return this.normalized&&(e=C(e,this.array)),this.array[t*this.itemSize+1]=e,this}getZ(t){let e=this.array[t*this.itemSize+2];return this.normalized&&(e=j(e,this.array)),e}setZ(t,e){return this.normalized&&(e=C(e,this.array)),this.array[t*this.itemSize+2]=e,this}getW(t){let e=this.array[t*this.itemSize+3];return this.normalized&&(e=j(e,this.array)),e}setW(t,e){return this.normalized&&(e=C(e,this.array)),this.array[t*this.itemSize+3]=e,this}setXY(t,e,i){return t*=this.itemSize,this.normalized&&(e=C(e,this.array),i=C(i,this.array)),this.array[t+0]=e,this.array[t+1]=i,this}setXYZ(t,e,i,s){return t*=this.itemSize,this.normalized&&(e=C(e,this.array),i=C(i,this.array),s=C(s,this.array)),this.array[t+0]=e,this.array[t+1]=i,this.array[t+2]=s,this}setXYZW(t,e,i,s,n){return t*=this.itemSize,this.normalized&&(e=C(e,this.array),i=C(i,this.array),s=C(s,this.array),n=C(n,this.array)),this.array[t+0]=e,this.array[t+1]=i,this.array[t+2]=s,this.array[t+3]=n,this}onUpload(t){return this.onUploadCallback=t,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const t={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(t.name=this.name),this.usage!==Je&&(t.usage=this.usage),t}}class Gn extends pt{constructor(t,e,i){super(new Uint16Array(t),e,i)}}class Wn extends pt{constructor(t,e,i){super(new Uint32Array(t),e,i)}}class Ao extends pt{constructor(t,e,i){super(new Uint16Array(t),e,i),this.isFloat16BufferAttribute=!0}getX(t){let e=Be(this.array[t*this.itemSize]);return this.normalized&&(e=j(e,this.array)),e}setX(t,e){return this.normalized&&(e=C(e,this.array)),this.array[t*this.itemSize]=K(e),this}getY(t){let e=Be(this.array[t*this.itemSize+1]);return this.normalized&&(e=j(e,this.array)),e}setY(t,e){return this.normalized&&(e=C(e,this.array)),this.array[t*this.itemSize+1]=K(e),this}getZ(t){let e=Be(this.array[t*this.itemSize+2]);return this.normalized&&(e=j(e,this.array)),e}setZ(t,e){return this.normalized&&(e=C(e,this.array)),this.array[t*this.itemSize+2]=K(e),this}getW(t){let e=Be(this.array[t*this.itemSize+3]);return this.normalized&&(e=j(e,this.array)),e}setW(t,e){return this.normalized&&(e=C(e,this.array)),this.array[t*this.itemSize+3]=K(e),this}setXY(t,e,i){return t*=this.itemSize,this.normalized&&(e=C(e,this.array),i=C(i,this.array)),this.array[t+0]=K(e),this.array[t+1]=K(i),this}setXYZ(t,e,i,s){return t*=this.itemSize,this.normalized&&(e=C(e,this.array),i=C(i,this.array),s=C(s,this.array)),this.array[t+0]=K(e),this.array[t+1]=K(i),this.array[t+2]=K(s),this}setXYZW(t,e,i,s,n){return t*=this.itemSize,this.normalized&&(e=C(e,this.array),i=C(i,this.array),s=C(s,this.array),n=C(n,this.array)),this.array[t+0]=K(e),this.array[t+1]=K(i),this.array[t+2]=K(s),this.array[t+3]=K(n),this}}class V extends pt{constructor(t,e,i){super(new Float32Array(t),e,i)}}let _o=0;const st=new D,xi=new k,Kt=new f,tt=new re,le=new re,N=new f;class mt extends Gt{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:_o++}),this.uuid=At(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=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(t){return Array.isArray(t)?this.index=new(Dn(t)?Wn:Gn)(t,1):this.index=t,this}setIndirect(t){return this.indirect=t,this}getIndirect(){return this.indirect}getAttribute(t){return this.attributes[t]}setAttribute(t,e){return this.attributes[t]=e,this}deleteAttribute(t){return delete this.attributes[t],this}hasAttribute(t){return this.attributes[t]!==void 0}addGroup(t,e,i=0){this.groups.push({start:t,count:e,materialIndex:i})}clearGroups(){this.groups=[]}setDrawRange(t,e){this.drawRange.start=t,this.drawRange.count=e}applyMatrix4(t){const e=this.attributes.position;e!==void 0&&(e.applyMatrix4(t),e.needsUpdate=!0);const i=this.attributes.normal;if(i!==void 0){const n=new dt().getNormalMatrix(t);i.applyNormalMatrix(n),i.needsUpdate=!0}const s=this.attributes.tangent;return s!==void 0&&(s.transformDirection(t),s.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(t){return st.makeRotationFromQuaternion(t),this.applyMatrix4(st),this}rotateX(t){return st.makeRotationX(t),this.applyMatrix4(st),this}rotateY(t){return st.makeRotationY(t),this.applyMatrix4(st),this}rotateZ(t){return st.makeRotationZ(t),this.applyMatrix4(st),this}translate(t,e,i){return st.makeTranslation(t,e,i),this.applyMatrix4(st),this}scale(t,e,i){return st.makeScale(t,e,i),this.applyMatrix4(st),this}lookAt(t){return xi.lookAt(t),xi.updateMatrix(),this.applyMatrix4(xi.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Kt).negate(),this.translate(Kt.x,Kt.y,Kt.z),this}setFromPoints(t){const e=this.getAttribute("position");if(e===void 0){const i=[];for(let s=0,n=t.length;s<n;s++){const r=t[s];i.push(r.x,r.y,r.z||0)}this.setAttribute("position",new V(i,3))}else{const i=Math.min(t.length,e.count);for(let s=0;s<i;s++){const n=t[s];e.setXYZ(s,n.x,n.y,n.z||0)}t.length>e.count&&console.warn("THREE.BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),e.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new re);const t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new f(-1/0,-1/0,-1/0),new f(1/0,1/0,1/0));return}if(t!==void 0){if(this.boundingBox.setFromBufferAttribute(t),e)for(let i=0,s=e.length;i<s;i++){const n=e[i];tt.setFromBufferAttribute(n),this.morphTargetsRelative?(N.addVectors(this.boundingBox.min,tt.min),this.boundingBox.expandByPoint(N),N.addVectors(this.boundingBox.max,tt.max),this.boundingBox.expandByPoint(N)):(this.boundingBox.expandByPoint(tt.min),this.boundingBox.expandByPoint(tt.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 Me);const t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new f,1/0);return}if(t){const i=this.boundingSphere.center;if(tt.setFromBufferAttribute(t),e)for(let n=0,r=e.length;n<r;n++){const o=e[n];le.setFromBufferAttribute(o),this.morphTargetsRelative?(N.addVectors(tt.min,le.min),tt.expandByPoint(N),N.addVectors(tt.max,le.max),tt.expandByPoint(N)):(tt.expandByPoint(le.min),tt.expandByPoint(le.max))}tt.getCenter(i);let s=0;for(let n=0,r=t.count;n<r;n++)N.fromBufferAttribute(t,n),s=Math.max(s,i.distanceToSquared(N));if(e)for(let n=0,r=e.length;n<r;n++){const o=e[n],a=this.morphTargetsRelative;for(let h=0,l=o.count;h<l;h++)N.fromBufferAttribute(o,h),a&&(Kt.fromBufferAttribute(t,h),N.add(Kt)),s=Math.max(s,i.distanceToSquared(N))}this.boundingSphere.radius=Math.sqrt(s),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 t=this.index,e=this.attributes;if(t===null||e.position===void 0||e.normal===void 0||e.uv===void 0){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const i=e.position,s=e.normal,n=e.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new pt(new Float32Array(4*i.count),4));const r=this.getAttribute("tangent"),o=[],a=[];for(let A=0;A<i.count;A++)o[A]=new f,a[A]=new f;const h=new f,l=new f,u=new f,p=new z,d=new z,m=new z,y=new f,x=new f;function g(A,F,B){h.fromBufferAttribute(i,A),l.fromBufferAttribute(i,F),u.fromBufferAttribute(i,B),p.fromBufferAttribute(n,A),d.fromBufferAttribute(n,F),m.fromBufferAttribute(n,B),l.sub(h),u.sub(h),d.sub(p),m.sub(p);const P=1/(d.x*m.y-m.x*d.y);isFinite(P)&&(y.copy(l).multiplyScalar(m.y).addScaledVector(u,-d.y).multiplyScalar(P),x.copy(u).multiplyScalar(d.x).addScaledVector(l,-m.x).multiplyScalar(P),o[A].add(y),o[F].add(y),o[B].add(y),a[A].add(x),a[F].add(x),a[B].add(x))}let b=this.groups;b.length===0&&(b=[{start:0,count:t.count}]);for(let A=0,F=b.length;A<F;++A){const B=b[A],P=B.start,R=B.count;for(let E=P,L=P+R;E<L;E+=3)g(t.getX(E+0),t.getX(E+1),t.getX(E+2))}const w=new f,M=new f,S=new f,v=new f;function _(A){S.fromBufferAttribute(s,A),v.copy(S);const F=o[A];w.copy(F),w.sub(S.multiplyScalar(S.dot(F))).normalize(),M.crossVectors(v,F);const P=M.dot(a[A])<0?-1:1;r.setXYZW(A,w.x,w.y,w.z,P)}for(let A=0,F=b.length;A<F;++A){const B=b[A],P=B.start,R=B.count;for(let E=P,L=P+R;E<L;E+=3)_(t.getX(E+0)),_(t.getX(E+1)),_(t.getX(E+2))}}computeVertexNormals(){const t=this.index,e=this.getAttribute("position");if(e!==void 0){let i=this.getAttribute("normal");if(i===void 0)i=new pt(new Float32Array(e.count*3),3),this.setAttribute("normal",i);else for(let p=0,d=i.count;p<d;p++)i.setXYZ(p,0,0,0);const s=new f,n=new f,r=new f,o=new f,a=new f,h=new f,l=new f,u=new f;if(t)for(let p=0,d=t.count;p<d;p+=3){const m=t.getX(p+0),y=t.getX(p+1),x=t.getX(p+2);s.fromBufferAttribute(e,m),n.fromBufferAttribute(e,y),r.fromBufferAttribute(e,x),l.subVectors(r,n),u.subVectors(s,n),l.cross(u),o.fromBufferAttribute(i,m),a.fromBufferAttribute(i,y),h.fromBufferAttribute(i,x),o.add(l),a.add(l),h.add(l),i.setXYZ(m,o.x,o.y,o.z),i.setXYZ(y,a.x,a.y,a.z),i.setXYZ(x,h.x,h.y,h.z)}else for(let p=0,d=e.count;p<d;p+=3)s.fromBufferAttribute(e,p+0),n.fromBufferAttribute(e,p+1),r.fromBufferAttribute(e,p+2),l.subVectors(r,n),u.subVectors(s,n),l.cross(u),i.setXYZ(p+0,l.x,l.y,l.z),i.setXYZ(p+1,l.x,l.y,l.z),i.setXYZ(p+2,l.x,l.y,l.z);this.normalizeNormals(),i.needsUpdate=!0}}normalizeNormals(){const t=this.attributes.normal;for(let e=0,i=t.count;e<i;e++)N.fromBufferAttribute(t,e),N.normalize(),t.setXYZ(e,N.x,N.y,N.z)}toNonIndexed(){function t(o,a){const h=o.array,l=o.itemSize,u=o.normalized,p=new h.constructor(a.length*l);let d=0,m=0;for(let y=0,x=a.length;y<x;y++){o.isInterleavedBufferAttribute?d=a[y]*o.data.stride+o.offset:d=a[y]*l;for(let g=0;g<l;g++)p[m++]=h[d++]}return new pt(p,l,u)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const e=new mt,i=this.index.array,s=this.attributes;for(const o in s){const a=s[o],h=t(a,i);e.setAttribute(o,h)}const n=this.morphAttributes;for(const o in n){const a=[],h=n[o];for(let l=0,u=h.length;l<u;l++){const p=h[l],d=t(p,i);a.push(d)}e.morphAttributes[o]=a}e.morphTargetsRelative=this.morphTargetsRelative;const r=this.groups;for(let o=0,a=r.length;o<a;o++){const h=r[o];e.addGroup(h.start,h.count,h.materialIndex)}return e}toJSON(){const t={metadata:{version:4.6,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.type,this.name!==""&&(t.name=this.name),Object.keys(this.userData).length>0&&(t.userData=this.userData),this.parameters!==void 0){const a=this.parameters;for(const h in a)a[h]!==void 0&&(t[h]=a[h]);return t}t.data={attributes:{}};const e=this.index;e!==null&&(t.data.index={type:e.array.constructor.name,array:Array.prototype.slice.call(e.array)});const i=this.attributes;for(const a in i){const h=i[a];t.data.attributes[a]=h.toJSON(t.data)}const s={};let n=!1;for(const a in this.morphAttributes){const h=this.morphAttributes[a],l=[];for(let u=0,p=h.length;u<p;u++){const d=h[u];l.push(d.toJSON(t.data))}l.length>0&&(s[a]=l,n=!0)}n&&(t.data.morphAttributes=s,t.data.morphTargetsRelative=this.morphTargetsRelative);const r=this.groups;r.length>0&&(t.data.groups=JSON.parse(JSON.stringify(r)));const o=this.boundingSphere;return o!==null&&(t.data.boundingSphere={center:o.center.toArray(),radius:o.radius}),t}clone(){return new this.constructor().copy(this)}copy(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const e={};this.name=t.name;const i=t.index;i!==null&&this.setIndex(i.clone(e));const s=t.attributes;for(const h in s){const l=s[h];this.setAttribute(h,l.clone(e))}const n=t.morphAttributes;for(const h in n){const l=[],u=n[h];for(let p=0,d=u.length;p<d;p++)l.push(u[p].clone(e));this.morphAttributes[h]=l}this.morphTargetsRelative=t.morphTargetsRelative;const r=t.groups;for(let h=0,l=r.length;h<l;h++){const u=r[h];this.addGroup(u.start,u.count,u.materialIndex)}const o=t.boundingBox;o!==null&&(this.boundingBox=o.clone());const a=t.boundingSphere;return a!==null&&(this.boundingSphere=a.clone()),this.drawRange.start=t.drawRange.start,this.drawRange.count=t.drawRange.count,this.userData=t.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}const Ss=new D,Dt=new Ze,Ee=new Me,As=new f,Pe=new f,Ie=new f,Le=new f,gi=new f,De=new f,_s=new f,ke=new f;class qn extends k{constructor(t=new mt,e=new Un){super(),this.isMesh=!0,this.type="Mesh",this.geometry=t,this.material=e,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),t.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=t.morphTargetInfluences.slice()),t.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},t.morphTargetDictionary)),this.material=Array.isArray(t.material)?t.material.slice():t.material,this.geometry=t.geometry,this}updateMorphTargets(){const e=this.geometry.morphAttributes,i=Object.keys(e);if(i.length>0){const s=e[i[0]];if(s!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let n=0,r=s.length;n<r;n++){const o=s[n].name||String(n);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=n}}}}getVertexPosition(t,e){const i=this.geometry,s=i.attributes.position,n=i.morphAttributes.position,r=i.morphTargetsRelative;e.fromBufferAttribute(s,t);const o=this.morphTargetInfluences;if(n&&o){De.set(0,0,0);for(let a=0,h=n.length;a<h;a++){const l=o[a],u=n[a];l!==0&&(gi.fromBufferAttribute(u,t),r?De.addScaledVector(gi,l):De.addScaledVector(gi.sub(e),l))}e.add(De)}return e}raycast(t,e){const i=this.geometry,s=this.material,n=this.matrixWorld;s!==void 0&&(i.boundingSphere===null&&i.computeBoundingSphere(),Ee.copy(i.boundingSphere),Ee.applyMatrix4(n),Dt.copy(t.ray).recast(t.near),!(Ee.containsPoint(Dt.origin)===!1&&(Dt.intersectSphere(Ee,As)===null||Dt.origin.distanceToSquared(As)>(t.far-t.near)**2))&&(Ss.copy(n).invert(),Dt.copy(t.ray).applyMatrix4(Ss),!(i.boundingBox!==null&&Dt.intersectsBox(i.boundingBox)===!1)&&this._computeIntersections(t,e,Dt)))}_computeIntersections(t,e,i){let s;const n=this.geometry,r=this.material,o=n.index,a=n.attributes.position,h=n.attributes.uv,l=n.attributes.uv1,u=n.attributes.normal,p=n.groups,d=n.drawRange;if(o!==null)if(Array.isArray(r))for(let m=0,y=p.length;m<y;m++){const x=p[m],g=r[x.materialIndex],b=Math.max(x.start,d.start),w=Math.min(o.count,Math.min(x.start+x.count,d.start+d.count));for(let M=b,S=w;M<S;M+=3){const v=o.getX(M),_=o.getX(M+1),A=o.getX(M+2);s=Oe(this,g,t,i,h,l,u,v,_,A),s&&(s.faceIndex=Math.floor(M/3),s.face.materialIndex=x.materialIndex,e.push(s))}}else{const m=Math.max(0,d.start),y=Math.min(o.count,d.start+d.count);for(let x=m,g=y;x<g;x+=3){const b=o.getX(x),w=o.getX(x+1),M=o.getX(x+2);s=Oe(this,r,t,i,h,l,u,b,w,M),s&&(s.faceIndex=Math.floor(x/3),e.push(s))}}else if(a!==void 0)if(Array.isArray(r))for(let m=0,y=p.length;m<y;m++){const x=p[m],g=r[x.materialIndex],b=Math.max(x.start,d.start),w=Math.min(a.count,Math.min(x.start+x.count,d.start+d.count));for(let M=b,S=w;M<S;M+=3){const v=M,_=M+1,A=M+2;s=Oe(this,g,t,i,h,l,u,v,_,A),s&&(s.faceIndex=Math.floor(M/3),s.face.materialIndex=x.materialIndex,e.push(s))}}else{const m=Math.max(0,d.start),y=Math.min(a.count,d.start+d.count);for(let x=m,g=y;x<g;x+=3){const b=x,w=x+1,M=x+2;s=Oe(this,r,t,i,h,l,u,b,w,M),s&&(s.faceIndex=Math.floor(x/3),e.push(s))}}}}function vo(c,t,e,i,s,n,r,o){let a;if(t.side===Vi?a=i.intersectTriangle(r,n,s,!0,o):a=i.intersectTriangle(s,n,r,t.side===Xe,o),a===null)return null;ke.copy(o),ke.applyMatrix4(c.matrixWorld);const h=e.ray.origin.distanceTo(ke);return h<e.near||h>e.far?null:{distance:h,point:ke.clone(),object:c}}function Oe(c,t,e,i,s,n,r,o,a,h){c.getVertexPosition(o,Pe),c.getVertexPosition(a,Ie),c.getVertexPosition(h,Le);const l=vo(c,t,e,i,Pe,Ie,Le,_s);if(l){const u=new f;rt.getBarycoord(_s,Pe,Ie,Le,u),s&&(l.uv=rt.getInterpolatedAttribute(s,o,a,h,u,new z)),n&&(l.uv1=rt.getInterpolatedAttribute(n,o,a,h,u,new z)),r&&(l.normal=rt.getInterpolatedAttribute(r,o,a,h,u,new f),l.normal.dot(i.direction)>0&&l.normal.multiplyScalar(-1));const p={a:o,b:a,c:h,normal:new f,materialIndex:0};rt.getNormal(Pe,Ie,Le,p.normal),l.face=p,l.barycoord=u}return l}class $e extends mt{constructor(t=1,e=1,i=1,s=1,n=1,r=1){super(),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:i,widthSegments:s,heightSegments:n,depthSegments:r};const o=this;s=Math.floor(s),n=Math.floor(n),r=Math.floor(r);const a=[],h=[],l=[],u=[];let p=0,d=0;m("z","y","x",-1,-1,i,e,t,r,n,0),m("z","y","x",1,-1,i,e,-t,r,n,1),m("x","z","y",1,1,t,i,e,s,r,2),m("x","z","y",1,-1,t,i,-e,s,r,3),m("x","y","z",1,-1,t,e,i,s,n,4),m("x","y","z",-1,-1,t,e,-i,s,n,5),this.setIndex(a),this.setAttribute("position",new V(h,3)),this.setAttribute("normal",new V(l,3)),this.setAttribute("uv",new V(u,2));function m(y,x,g,b,w,M,S,v,_,A,F){const B=M/_,P=S/A,R=M/2,E=S/2,L=v/2,G=_+1,it=A+1;let Pt=0,vt=0;const U=new f;for(let W=0;W<it;W++){const $=W*P-E;for(let Wt=0;Wt<G;Wt++){const be=Wt*B-R;U[y]=be*b,U[x]=$*w,U[g]=L,h.push(U.x,U.y,U.z),U[y]=0,U[x]=0,U[g]=v>0?1:-1,l.push(U.x,U.y,U.z),u.push(Wt/_),u.push(1-W/A),Pt+=1}}for(let W=0;W<A;W++)for(let $=0;$<_;$++){const Wt=p+$+G*W,be=p+$+G*(W+1),ur=p+($+1)+G*(W+1),hs=p+($+1)+G*W;a.push(Wt,be,hs),a.push(be,ur,hs),vt+=6}o.addGroup(d,vt,F),d+=vt,p+=Pt}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new $e(t.width,t.height,t.depth,t.widthSegments,t.heightSegments,t.depthSegments)}}function we(c){const t={};for(const e in c){t[e]={};for(const i in c[e]){const s=c[e][i];s&&(s.isColor||s.isMatrix3||s.isMatrix4||s.isVector2||s.isVector3||s.isVector4||s.isTexture||s.isQuaternion)?s.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),t[e][i]=null):t[e][i]=s.clone():Array.isArray(s)?t[e][i]=s.slice():t[e][i]=s}}return t}function Xn(c){const t={};for(let e=0;e<c.length;e++){const i=we(c[e]);for(const s in i)t[s]=i[s]}return t}function zo(c){const t=[];for(let e=0;e<c.length;e++)t.push(c[e].clone());return t}function Co(c){const t=c.getRenderTarget();return t===null?c.outputColorSpace:t.isXRRenderTarget===!0?t.texture.colorSpace:et.workingColorSpace}const To={clone:we,merge:Xn};var Fo=`void main() {
|
|
6
|
-
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
|
7
|
-
}`,Bo=`void main() {
|
|
8
|
-
gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
|
|
9
|
-
}`;class Jn extends Z{constructor(t){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=Fo,this.fragmentShader=Bo,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,t!==void 0&&this.setValues(t)}copy(t){return super.copy(t),this.fragmentShader=t.fragmentShader,this.vertexShader=t.vertexShader,this.uniforms=we(t.uniforms),this.uniformsGroups=zo(t.uniformsGroups),this.defines=Object.assign({},t.defines),this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.fog=t.fog,this.lights=t.lights,this.clipping=t.clipping,this.extensions=Object.assign({},t.extensions),this.glslVersion=t.glslVersion,this}toJSON(t){const e=super.toJSON(t);e.glslVersion=this.glslVersion,e.uniforms={};for(const s in this.uniforms){const r=this.uniforms[s].value;r&&r.isTexture?e.uniforms[s]={type:"t",value:r.toJSON(t).uuid}:r&&r.isColor?e.uniforms[s]={type:"c",value:r.getHex()}:r&&r.isVector2?e.uniforms[s]={type:"v2",value:r.toArray()}:r&&r.isVector3?e.uniforms[s]={type:"v3",value:r.toArray()}:r&&r.isVector4?e.uniforms[s]={type:"v4",value:r.toArray()}:r&&r.isMatrix3?e.uniforms[s]={type:"m3",value:r.toArray()}:r&&r.isMatrix4?e.uniforms[s]={type:"m4",value:r.toArray()}:e.uniforms[s]={value:r}}Object.keys(this.defines).length>0&&(e.defines=this.defines),e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader,e.lights=this.lights,e.clipping=this.clipping;const i={};for(const s in this.extensions)this.extensions[s]===!0&&(i[s]=!0);return Object.keys(i).length>0&&(e.extensions=i),e}}class $i extends k{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new D,this.projectionMatrix=new D,this.projectionMatrixInverse=new D,this.coordinateSystem=St}copy(t,e){return super.copy(t,e),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this.projectionMatrixInverse.copy(t.projectionMatrixInverse),this.coordinateSystem=t.coordinateSystem,this}getWorldDirection(t){return super.getWorldDirection(t).negate()}updateMatrixWorld(t){super.updateMatrixWorld(t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(t,e){super.updateWorldMatrix(t,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}const Rt=new f,vs=new z,zs=new z;class ut extends $i{constructor(t=50,e=1,i=.1,s=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=t,this.zoom=1,this.near=i,this.far=s,this.focus=10,this.aspect=e,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.fov=t.fov,this.zoom=t.zoom,this.near=t.near,this.far=t.far,this.focus=t.focus,this.aspect=t.aspect,this.view=t.view===null?null:Object.assign({},t.view),this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this}setFocalLength(t){const e=.5*this.getFilmHeight()/t;this.fov=se*2*Math.atan(e),this.updateProjectionMatrix()}getFocalLength(){const t=Math.tan(pe*.5*this.fov);return .5*this.getFilmHeight()/t}getEffectiveFOV(){return se*2*Math.atan(Math.tan(pe*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(t,e,i){Rt.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),e.set(Rt.x,Rt.y).multiplyScalar(-t/Rt.z),Rt.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),i.set(Rt.x,Rt.y).multiplyScalar(-t/Rt.z)}getViewSize(t,e){return this.getViewBounds(t,vs,zs),e.subVectors(zs,vs)}setViewOffset(t,e,i,s,n,r){this.aspect=t/e,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=t,this.view.fullHeight=e,this.view.offsetX=i,this.view.offsetY=s,this.view.width=n,this.view.height=r,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const t=this.near;let e=t*Math.tan(pe*.5*this.fov)/this.zoom,i=2*e,s=this.aspect*i,n=-.5*s;const r=this.view;if(this.view!==null&&this.view.enabled){const a=r.fullWidth,h=r.fullHeight;n+=r.offsetX*s/a,e-=r.offsetY*i/h,s*=r.width/a,i*=r.height/h}const o=this.filmOffset;o!==0&&(n+=t*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(n,n+s,e,e-i,t,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const e=super.toJSON(t);return e.object.fov=this.fov,e.object.zoom=this.zoom,e.object.near=this.near,e.object.far=this.far,e.object.focus=this.focus,e.object.aspect=this.aspect,this.view!==null&&(e.object.view=Object.assign({},this.view)),e.object.filmGauge=this.filmGauge,e.object.filmOffset=this.filmOffset,e}}const te=-90,ee=1;class Hn extends k{constructor(t,e,i){super(),this.type="CubeCamera",this.renderTarget=i,this.coordinateSystem=null,this.activeMipmapLevel=0;const s=new ut(te,ee,t,e);s.layers=this.layers,this.add(s);const n=new ut(te,ee,t,e);n.layers=this.layers,this.add(n);const r=new ut(te,ee,t,e);r.layers=this.layers,this.add(r);const o=new ut(te,ee,t,e);o.layers=this.layers,this.add(o);const a=new ut(te,ee,t,e);a.layers=this.layers,this.add(a);const h=new ut(te,ee,t,e);h.layers=this.layers,this.add(h)}updateCoordinateSystem(){const t=this.coordinateSystem,e=this.children.concat(),[i,s,n,r,o,a]=e;for(const h of e)this.remove(h);if(t===St)i.up.set(0,1,0),i.lookAt(1,0,0),s.up.set(0,1,0),s.lookAt(-1,0,0),n.up.set(0,0,-1),n.lookAt(0,1,0),r.up.set(0,0,1),r.lookAt(0,-1,0),o.up.set(0,1,0),o.lookAt(0,0,1),a.up.set(0,1,0),a.lookAt(0,0,-1);else if(t===xe)i.up.set(0,-1,0),i.lookAt(-1,0,0),s.up.set(0,-1,0),s.lookAt(1,0,0),n.up.set(0,0,1),n.lookAt(0,1,0),r.up.set(0,0,-1),r.lookAt(0,-1,0),o.up.set(0,-1,0),o.lookAt(0,0,1),a.up.set(0,-1,0),a.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+t);for(const h of e)this.add(h),h.updateMatrixWorld()}update(t,e){this.parent===null&&this.updateMatrixWorld();const{renderTarget:i,activeMipmapLevel:s}=this;this.coordinateSystem!==t.coordinateSystem&&(this.coordinateSystem=t.coordinateSystem,this.updateCoordinateSystem());const[n,r,o,a,h,l]=this.children,u=t.getRenderTarget(),p=t.getActiveCubeFace(),d=t.getActiveMipmapLevel(),m=t.xr.enabled;t.xr.enabled=!1;const y=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,t.setRenderTarget(i,0,s),t.render(e,n),t.setRenderTarget(i,1,s),t.render(e,r),t.setRenderTarget(i,2,s),t.render(e,o),t.setRenderTarget(i,3,s),t.render(e,a),t.setRenderTarget(i,4,s),t.render(e,h),i.texture.generateMipmaps=y,t.setRenderTarget(i,5,s),t.render(e,l),t.setRenderTarget(u,p,d),t.xr.enabled=m,i.texture.needsPMREMUpdate=!0}}class Yn extends J{constructor(t,e,i,s,n,r,o,a,h,l){t=t!==void 0?t:[],e=e!==void 0?e:ks,super(t,e,i,s,n,r,o,a,h,l),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(t){this.image=t}}class Ro extends Nn{constructor(t=1,e={}){super(t,t,e),this.isWebGLCubeRenderTarget=!0;const i={width:t,height:t,depth:1},s=[i,i,i,i,i,i];this.texture=new Yn(s,e.mapping,e.wrapS,e.wrapT,e.magFilter,e.minFilter,e.format,e.type,e.anisotropy,e.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=e.generateMipmaps!==void 0?e.generateMipmaps:!1,this.texture.minFilter=e.minFilter!==void 0?e.minFilter:ye}fromEquirectangularTexture(t,e){this.texture.type=e.type,this.texture.colorSpace=e.colorSpace,this.texture.generateMipmaps=e.generateMipmaps,this.texture.minFilter=e.minFilter,this.texture.magFilter=e.magFilter;const i={uniforms:{tEquirect:{value:null}},vertexShader:`
|
|
10
|
-
|
|
11
|
-
varying vec3 vWorldDirection;
|
|
12
|
-
|
|
13
|
-
vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
|
|
14
|
-
|
|
15
|
-
return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
void main() {
|
|
20
|
-
|
|
21
|
-
vWorldDirection = transformDirection( position, modelMatrix );
|
|
22
|
-
|
|
23
|
-
#include <begin_vertex>
|
|
24
|
-
#include <project_vertex>
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
`,fragmentShader:`
|
|
28
|
-
|
|
29
|
-
uniform sampler2D tEquirect;
|
|
30
|
-
|
|
31
|
-
varying vec3 vWorldDirection;
|
|
32
|
-
|
|
33
|
-
#include <common>
|
|
34
|
-
|
|
35
|
-
void main() {
|
|
36
|
-
|
|
37
|
-
vec3 direction = normalize( vWorldDirection );
|
|
38
|
-
|
|
39
|
-
vec2 sampleUV = equirectUv( direction );
|
|
40
|
-
|
|
41
|
-
gl_FragColor = texture2D( tEquirect, sampleUV );
|
|
42
|
-
|
|
43
|
-
}
|
|
44
|
-
`},s=new $e(5,5,5),n=new Jn({name:"CubemapFromEquirect",uniforms:we(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:Vi,blending:Ds});n.uniforms.tEquirect.value=e;const r=new qn(s,n),o=e.minFilter;return e.minFilter===Gi&&(e.minFilter=ye),new Hn(1,10,this).update(t,r),e.minFilter=o,r.geometry.dispose(),r.material.dispose(),this}clear(t,e,i,s){const n=t.getRenderTarget();for(let r=0;r<6;r++)t.setRenderTarget(this,r),t.clear(e,i,s);t.setRenderTarget(n)}}class Eo extends k{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new ct,this.environmentIntensity=1,this.environmentRotation=new ct,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(t,e){return super.copy(t,e),t.background!==null&&(this.background=t.background.clone()),t.environment!==null&&(this.environment=t.environment.clone()),t.fog!==null&&(this.fog=t.fog.clone()),this.backgroundBlurriness=t.backgroundBlurriness,this.backgroundIntensity=t.backgroundIntensity,this.backgroundRotation.copy(t.backgroundRotation),this.environmentIntensity=t.environmentIntensity,this.environmentRotation.copy(t.environmentRotation),t.overrideMaterial!==null&&(this.overrideMaterial=t.overrideMaterial.clone()),this.matrixAutoUpdate=t.matrixAutoUpdate,this}toJSON(t){const e=super.toJSON(t);return this.fog!==null&&(e.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(e.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(e.object.backgroundIntensity=this.backgroundIntensity),e.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(e.object.environmentIntensity=this.environmentIntensity),e.object.environmentRotation=this.environmentRotation.toArray(),e}}class jn{constructor(t,e){this.isInterleavedBuffer=!0,this.array=t,this.stride=e,this.count=t!==void 0?t.length/e:0,this.usage=Je,this.updateRanges=[],this.version=0,this.uuid=At()}onUploadCallback(){}set needsUpdate(t){t===!0&&this.version++}setUsage(t){return this.usage=t,this}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}copy(t){return this.array=new t.array.constructor(t.array),this.count=t.count,this.stride=t.stride,this.usage=t.usage,this}copyAt(t,e,i){t*=this.stride,i*=e.stride;for(let s=0,n=this.stride;s<n;s++)this.array[t+s]=e.array[i+s];return this}set(t,e=0){return this.array.set(t,e),this}clone(t){t.arrayBuffers===void 0&&(t.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=At()),t.arrayBuffers[this.array.buffer._uuid]===void 0&&(t.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const e=new this.array.constructor(t.arrayBuffers[this.array.buffer._uuid]),i=new this.constructor(e,this.stride);return i.setUsage(this.usage),i}onUpload(t){return this.onUploadCallback=t,this}toJSON(t){return t.arrayBuffers===void 0&&(t.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=At()),t.arrayBuffers[this.array.buffer._uuid]===void 0&&(t.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 H=new f;class Qi{constructor(t,e,i,s=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=t,this.itemSize=e,this.offset=i,this.normalized=s}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(t){this.data.needsUpdate=t}applyMatrix4(t){for(let e=0,i=this.data.count;e<i;e++)H.fromBufferAttribute(this,e),H.applyMatrix4(t),this.setXYZ(e,H.x,H.y,H.z);return this}applyNormalMatrix(t){for(let e=0,i=this.count;e<i;e++)H.fromBufferAttribute(this,e),H.applyNormalMatrix(t),this.setXYZ(e,H.x,H.y,H.z);return this}transformDirection(t){for(let e=0,i=this.count;e<i;e++)H.fromBufferAttribute(this,e),H.transformDirection(t),this.setXYZ(e,H.x,H.y,H.z);return this}getComponent(t,e){let i=this.array[t*this.data.stride+this.offset+e];return this.normalized&&(i=j(i,this.array)),i}setComponent(t,e,i){return this.normalized&&(i=C(i,this.array)),this.data.array[t*this.data.stride+this.offset+e]=i,this}setX(t,e){return this.normalized&&(e=C(e,this.array)),this.data.array[t*this.data.stride+this.offset]=e,this}setY(t,e){return this.normalized&&(e=C(e,this.array)),this.data.array[t*this.data.stride+this.offset+1]=e,this}setZ(t,e){return this.normalized&&(e=C(e,this.array)),this.data.array[t*this.data.stride+this.offset+2]=e,this}setW(t,e){return this.normalized&&(e=C(e,this.array)),this.data.array[t*this.data.stride+this.offset+3]=e,this}getX(t){let e=this.data.array[t*this.data.stride+this.offset];return this.normalized&&(e=j(e,this.array)),e}getY(t){let e=this.data.array[t*this.data.stride+this.offset+1];return this.normalized&&(e=j(e,this.array)),e}getZ(t){let e=this.data.array[t*this.data.stride+this.offset+2];return this.normalized&&(e=j(e,this.array)),e}getW(t){let e=this.data.array[t*this.data.stride+this.offset+3];return this.normalized&&(e=j(e,this.array)),e}setXY(t,e,i){return t=t*this.data.stride+this.offset,this.normalized&&(e=C(e,this.array),i=C(i,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=i,this}setXYZ(t,e,i,s){return t=t*this.data.stride+this.offset,this.normalized&&(e=C(e,this.array),i=C(i,this.array),s=C(s,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=i,this.data.array[t+2]=s,this}setXYZW(t,e,i,s,n){return t=t*this.data.stride+this.offset,this.normalized&&(e=C(e,this.array),i=C(i,this.array),s=C(s,this.array),n=C(n,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=i,this.data.array[t+2]=s,this.data.array[t+3]=n,this}clone(t){if(t===void 0){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");const e=[];for(let i=0;i<this.count;i++){const s=i*this.data.stride+this.offset;for(let n=0;n<this.itemSize;n++)e.push(this.data.array[s+n])}return new pt(new this.array.constructor(e),this.itemSize,this.normalized)}else return t.interleavedBuffers===void 0&&(t.interleavedBuffers={}),t.interleavedBuffers[this.data.uuid]===void 0&&(t.interleavedBuffers[this.data.uuid]=this.data.clone(t)),new Qi(t.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(t){if(t===void 0){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");const e=[];for(let i=0;i<this.count;i++){const s=i*this.data.stride+this.offset;for(let n=0;n<this.itemSize;n++)e.push(this.data.array[s+n])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:e,normalized:this.normalized}}else return t.interleavedBuffers===void 0&&(t.interleavedBuffers={}),t.interleavedBuffers[this.data.uuid]===void 0&&(t.interleavedBuffers[this.data.uuid]=this.data.toJSON(t)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}class Po extends Z{constructor(t){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new I(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.alphaMap=t.alphaMap,this.rotation=t.rotation,this.sizeAttenuation=t.sizeAttenuation,this.fog=t.fog,this}}class Io extends J{constructor(t=null,e=1,i=1,s,n,r,o,a,h=lt,l=lt,u,p){super(null,r,o,a,h,l,s,n,u,p),this.isDataTexture=!0,this.image={data:t,width:e,height:i},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Lo extends pt{constructor(t,e,i,s=1){super(t,e,i),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=s}copy(t){return super.copy(t),this.meshPerAttribute=t.meshPerAttribute,this}toJSON(){const t=super.toJSON();return t.meshPerAttribute=this.meshPerAttribute,t.isInstancedBufferAttribute=!0,t}}const Mi=new f,Do=new f,ko=new dt;class Nt{constructor(t=new f(1,0,0),e=0){this.isPlane=!0,this.normal=t,this.constant=e}set(t,e){return this.normal.copy(t),this.constant=e,this}setComponents(t,e,i,s){return this.normal.set(t,e,i),this.constant=s,this}setFromNormalAndCoplanarPoint(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this}setFromCoplanarPoints(t,e,i){const s=Mi.subVectors(i,e).cross(Do.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(s,t),this}copy(t){return this.normal.copy(t.normal),this.constant=t.constant,this}normalize(){const t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(t){return this.normal.dot(t)+this.constant}distanceToSphere(t){return this.distanceToPoint(t.center)-t.radius}projectPoint(t,e){return e.copy(t).addScaledVector(this.normal,-this.distanceToPoint(t))}intersectLine(t,e){const i=t.delta(Mi),s=this.normal.dot(i);if(s===0)return this.distanceToPoint(t.start)===0?e.copy(t.start):null;const n=-(t.start.dot(this.normal)+this.constant)/s;return n<0||n>1?null:e.copy(t.start).addScaledVector(i,n)}intersectsLine(t){const e=this.distanceToPoint(t.start),i=this.distanceToPoint(t.end);return e<0&&i>0||i<0&&e>0}intersectsBox(t){return t.intersectsPlane(this)}intersectsSphere(t){return t.intersectsPlane(this)}coplanarPoint(t){return t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,e){const i=e||ko.getNormalMatrix(t),s=this.coplanarPoint(Mi).applyMatrix4(t),n=this.normal.applyMatrix3(i).normalize();return this.constant=-s.dot(n),this}translate(t){return this.constant-=t.dot(this.normal),this}equals(t){return t.normal.equals(this.normal)&&t.constant===this.constant}clone(){return new this.constructor().copy(this)}}const kt=new Me,Ne=new f;class Zn{constructor(t=new Nt,e=new Nt,i=new Nt,s=new Nt,n=new Nt,r=new Nt){this.planes=[t,e,i,s,n,r]}set(t,e,i,s,n,r){const o=this.planes;return o[0].copy(t),o[1].copy(e),o[2].copy(i),o[3].copy(s),o[4].copy(n),o[5].copy(r),this}copy(t){const e=this.planes;for(let i=0;i<6;i++)e[i].copy(t.planes[i]);return this}setFromProjectionMatrix(t,e=St){const i=this.planes,s=t.elements,n=s[0],r=s[1],o=s[2],a=s[3],h=s[4],l=s[5],u=s[6],p=s[7],d=s[8],m=s[9],y=s[10],x=s[11],g=s[12],b=s[13],w=s[14],M=s[15];if(i[0].setComponents(a-n,p-h,x-d,M-g).normalize(),i[1].setComponents(a+n,p+h,x+d,M+g).normalize(),i[2].setComponents(a+r,p+l,x+m,M+b).normalize(),i[3].setComponents(a-r,p-l,x-m,M-b).normalize(),i[4].setComponents(a-o,p-u,x-y,M-w).normalize(),e===St)i[5].setComponents(a+o,p+u,x+y,M+w).normalize();else if(e===xe)i[5].setComponents(o,u,y,w).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+e);return this}intersectsObject(t){if(t.boundingSphere!==void 0)t.boundingSphere===null&&t.computeBoundingSphere(),kt.copy(t.boundingSphere).applyMatrix4(t.matrixWorld);else{const e=t.geometry;e.boundingSphere===null&&e.computeBoundingSphere(),kt.copy(e.boundingSphere).applyMatrix4(t.matrixWorld)}return this.intersectsSphere(kt)}intersectsSprite(t){return kt.center.set(0,0,0),kt.radius=.7071067811865476,kt.applyMatrix4(t.matrixWorld),this.intersectsSphere(kt)}intersectsSphere(t){const e=this.planes,i=t.center,s=-t.radius;for(let n=0;n<6;n++)if(e[n].distanceToPoint(i)<s)return!1;return!0}intersectsBox(t){const e=this.planes;for(let i=0;i<6;i++){const s=e[i];if(Ne.x=s.normal.x>0?t.max.x:t.min.x,Ne.y=s.normal.y>0?t.max.y:t.min.y,Ne.z=s.normal.z>0?t.max.z:t.min.z,s.distanceToPoint(Ne)<0)return!1}return!0}containsPoint(t){const e=this.planes;for(let i=0;i<6;i++)if(e[i].distanceToPoint(t)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}class Ki extends Z{constructor(t){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new I(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.linewidth=t.linewidth,this.linecap=t.linecap,this.linejoin=t.linejoin,this.fog=t.fog,this}}const He=new f,Ye=new f,Cs=new D,ce=new Ze,Ve=new Me,wi=new f,Ts=new f;class Oo extends k{constructor(t=new mt,e=new Ki){super(),this.isLine=!0,this.type="Line",this.geometry=t,this.material=e,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),this.material=Array.isArray(t.material)?t.material.slice():t.material,this.geometry=t.geometry,this}computeLineDistances(){const t=this.geometry;if(t.index===null){const e=t.attributes.position,i=[0];for(let s=1,n=e.count;s<n;s++)He.fromBufferAttribute(e,s-1),Ye.fromBufferAttribute(e,s),i[s]=i[s-1],i[s]+=He.distanceTo(Ye);t.setAttribute("lineDistance",new V(i,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(t,e){const i=this.geometry,s=this.matrixWorld,n=t.params.Line.threshold,r=i.drawRange;if(i.boundingSphere===null&&i.computeBoundingSphere(),Ve.copy(i.boundingSphere),Ve.applyMatrix4(s),Ve.radius+=n,t.ray.intersectsSphere(Ve)===!1)return;Cs.copy(s).invert(),ce.copy(t.ray).applyMatrix4(Cs);const o=n/((this.scale.x+this.scale.y+this.scale.z)/3),a=o*o,h=this.isLineSegments?2:1,l=i.index,p=i.attributes.position;if(l!==null){const d=Math.max(0,r.start),m=Math.min(l.count,r.start+r.count);for(let y=d,x=m-1;y<x;y+=h){const g=l.getX(y),b=l.getX(y+1),w=Ue(this,t,ce,a,g,b);w&&e.push(w)}if(this.isLineLoop){const y=l.getX(m-1),x=l.getX(d),g=Ue(this,t,ce,a,y,x);g&&e.push(g)}}else{const d=Math.max(0,r.start),m=Math.min(p.count,r.start+r.count);for(let y=d,x=m-1;y<x;y+=h){const g=Ue(this,t,ce,a,y,y+1);g&&e.push(g)}if(this.isLineLoop){const y=Ue(this,t,ce,a,m-1,d);y&&e.push(y)}}}updateMorphTargets(){const e=this.geometry.morphAttributes,i=Object.keys(e);if(i.length>0){const s=e[i[0]];if(s!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let n=0,r=s.length;n<r;n++){const o=s[n].name||String(n);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=n}}}}}function Ue(c,t,e,i,s,n){const r=c.geometry.attributes.position;if(He.fromBufferAttribute(r,s),Ye.fromBufferAttribute(r,n),e.distanceSqToSegment(He,Ye,wi,Ts)>i)return;wi.applyMatrix4(c.matrixWorld);const a=t.ray.origin.distanceTo(wi);if(!(a<t.near||a>t.far))return{distance:a,point:Ts.clone().applyMatrix4(c.matrixWorld),index:s,face:null,faceIndex:null,barycoord:null,object:c}}class No extends Z{constructor(t){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new I(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.alphaMap=t.alphaMap,this.size=t.size,this.sizeAttenuation=t.sizeAttenuation,this.fog=t.fog,this}}class Vo extends k{constructor(){super(),this.isGroup=!0,this.type="Group"}}class Uo extends J{constructor(t,e){super({width:t,height:e}),this.isFramebufferTexture=!0,this.magFilter=lt,this.minFilter=lt,this.generateMipmaps=!1,this.needsUpdate=!0}}class Go extends J{constructor(t,e,i,s,n,r,o,a,h,l=We){if(l!==We&&l!==Pi)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");i===void 0&&l===We&&(i=qi),i===void 0&&l===Pi&&(i=Xs),super(null,s,n,r,o,a,l,i,h),this.isDepthTexture=!0,this.image={width:t,height:e},this.magFilter=o!==void 0?o:lt,this.minFilter=a!==void 0?a:lt,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(t){return super.copy(t),this.compareFunction=t.compareFunction,this}toJSON(t){const e=super.toJSON(t);return this.compareFunction!==null&&(e.compareFunction=this.compareFunction),e}}class ft{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(t,e){const i=this.getUtoTmapping(t);return this.getPoint(i,e)}getPoints(t=5){const e=[];for(let i=0;i<=t;i++)e.push(this.getPoint(i/t));return e}getSpacedPoints(t=5){const e=[];for(let i=0;i<=t;i++)e.push(this.getPointAt(i/t));return e}getLength(){const t=this.getLengths();return t[t.length-1]}getLengths(t=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const e=[];let i,s=this.getPoint(0),n=0;e.push(0);for(let r=1;r<=t;r++)i=this.getPoint(r/t),n+=i.distanceTo(s),e.push(n),s=i;return this.cacheArcLengths=e,e}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(t,e){const i=this.getLengths();let s=0;const n=i.length;let r;e?r=e:r=t*i[n-1];let o=0,a=n-1,h;for(;o<=a;)if(s=Math.floor(o+(a-o)/2),h=i[s]-r,h<0)o=s+1;else if(h>0)a=s-1;else{a=s;break}if(s=a,i[s]===r)return s/(n-1);const l=i[s],p=i[s+1]-l,d=(r-l)/p;return(s+d)/(n-1)}getTangent(t,e){let s=t-1e-4,n=t+1e-4;s<0&&(s=0),n>1&&(n=1);const r=this.getPoint(s),o=this.getPoint(n),a=e||(r.isVector2?new z:new f);return a.copy(o).sub(r).normalize(),a}getTangentAt(t,e){const i=this.getUtoTmapping(t);return this.getTangent(i,e)}computeFrenetFrames(t,e){const i=new f,s=[],n=[],r=[],o=new f,a=new D;for(let d=0;d<=t;d++){const m=d/t;s[d]=this.getTangentAt(m,new f)}n[0]=new f,r[0]=new f;let h=Number.MAX_VALUE;const l=Math.abs(s[0].x),u=Math.abs(s[0].y),p=Math.abs(s[0].z);l<=h&&(h=l,i.set(1,0,0)),u<=h&&(h=u,i.set(0,1,0)),p<=h&&i.set(0,0,1),o.crossVectors(s[0],i).normalize(),n[0].crossVectors(s[0],o),r[0].crossVectors(s[0],n[0]);for(let d=1;d<=t;d++){if(n[d]=n[d-1].clone(),r[d]=r[d-1].clone(),o.crossVectors(s[d-1],s[d]),o.length()>Number.EPSILON){o.normalize();const m=Math.acos(T(s[d-1].dot(s[d]),-1,1));n[d].applyMatrix4(a.makeRotationAxis(o,m))}r[d].crossVectors(s[d],n[d])}if(e===!0){let d=Math.acos(T(n[0].dot(n[t]),-1,1));d/=t,s[0].dot(o.crossVectors(n[0],n[t]))>0&&(d=-d);for(let m=1;m<=t;m++)n[m].applyMatrix4(a.makeRotationAxis(s[m],d*m)),r[m].crossVectors(s[m],n[m])}return{tangents:s,normals:n,binormals:r}}clone(){return new this.constructor().copy(this)}copy(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}toJSON(){const t={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.type,t}fromJSON(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}}class ts extends ft{constructor(t=0,e=0,i=1,s=1,n=0,r=Math.PI*2,o=!1,a=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=t,this.aY=e,this.xRadius=i,this.yRadius=s,this.aStartAngle=n,this.aEndAngle=r,this.aClockwise=o,this.aRotation=a}getPoint(t,e=new z){const i=e,s=Math.PI*2;let n=this.aEndAngle-this.aStartAngle;const r=Math.abs(n)<Number.EPSILON;for(;n<0;)n+=s;for(;n>s;)n-=s;n<Number.EPSILON&&(r?n=0:n=s),this.aClockwise===!0&&!r&&(n===s?n=-s:n=n-s);const o=this.aStartAngle+t*n;let a=this.aX+this.xRadius*Math.cos(o),h=this.aY+this.yRadius*Math.sin(o);if(this.aRotation!==0){const l=Math.cos(this.aRotation),u=Math.sin(this.aRotation),p=a-this.aX,d=h-this.aY;a=p*l-d*u+this.aX,h=p*u+d*l+this.aY}return i.set(a,h)}copy(t){return super.copy(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}toJSON(){const t=super.toJSON();return t.aX=this.aX,t.aY=this.aY,t.xRadius=this.xRadius,t.yRadius=this.yRadius,t.aStartAngle=this.aStartAngle,t.aEndAngle=this.aEndAngle,t.aClockwise=this.aClockwise,t.aRotation=this.aRotation,t}fromJSON(t){return super.fromJSON(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}}class $n extends ts{constructor(t,e,i,s,n,r){super(t,e,i,i,s,n,r),this.isArcCurve=!0,this.type="ArcCurve"}}function es(){let c=0,t=0,e=0,i=0;function s(n,r,o,a){c=n,t=o,e=-3*n+3*r-2*o-a,i=2*n-2*r+o+a}return{initCatmullRom:function(n,r,o,a,h){s(r,o,h*(o-n),h*(a-r))},initNonuniformCatmullRom:function(n,r,o,a,h,l,u){let p=(r-n)/h-(o-n)/(h+l)+(o-r)/l,d=(o-r)/l-(a-r)/(l+u)+(a-o)/u;p*=l,d*=l,s(r,o,p,d)},calc:function(n){const r=n*n,o=r*n;return c+t*n+e*r+i*o}}}const Ge=new f,bi=new es,Si=new es,Ai=new es;class Qn extends ft{constructor(t=[],e=!1,i="centripetal",s=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=t,this.closed=e,this.curveType=i,this.tension=s}getPoint(t,e=new f){const i=e,s=this.points,n=s.length,r=(n-(this.closed?0:1))*t;let o=Math.floor(r),a=r-o;this.closed?o+=o>0?0:(Math.floor(Math.abs(o)/n)+1)*n:a===0&&o===n-1&&(o=n-2,a=1);let h,l;this.closed||o>0?h=s[(o-1)%n]:(Ge.subVectors(s[0],s[1]).add(s[0]),h=Ge);const u=s[o%n],p=s[(o+1)%n];if(this.closed||o+2<n?l=s[(o+2)%n]:(Ge.subVectors(s[n-1],s[n-2]).add(s[n-1]),l=Ge),this.curveType==="centripetal"||this.curveType==="chordal"){const d=this.curveType==="chordal"?.5:.25;let m=Math.pow(h.distanceToSquared(u),d),y=Math.pow(u.distanceToSquared(p),d),x=Math.pow(p.distanceToSquared(l),d);y<1e-4&&(y=1),m<1e-4&&(m=y),x<1e-4&&(x=y),bi.initNonuniformCatmullRom(h.x,u.x,p.x,l.x,m,y,x),Si.initNonuniformCatmullRom(h.y,u.y,p.y,l.y,m,y,x),Ai.initNonuniformCatmullRom(h.z,u.z,p.z,l.z,m,y,x)}else this.curveType==="catmullrom"&&(bi.initCatmullRom(h.x,u.x,p.x,l.x,this.tension),Si.initCatmullRom(h.y,u.y,p.y,l.y,this.tension),Ai.initCatmullRom(h.z,u.z,p.z,l.z,this.tension));return i.set(bi.calc(a),Si.calc(a),Ai.calc(a)),i}copy(t){super.copy(t),this.points=[];for(let e=0,i=t.points.length;e<i;e++){const s=t.points[e];this.points.push(s.clone())}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}toJSON(){const t=super.toJSON();t.points=[];for(let e=0,i=this.points.length;e<i;e++){const s=this.points[e];t.points.push(s.toArray())}return t.closed=this.closed,t.curveType=this.curveType,t.tension=this.tension,t}fromJSON(t){super.fromJSON(t),this.points=[];for(let e=0,i=t.points.length;e<i;e++){const s=t.points[e];this.points.push(new f().fromArray(s))}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}}function Fs(c,t,e,i,s){const n=(i-t)*.5,r=(s-e)*.5,o=c*c,a=c*o;return(2*e-2*i+n+r)*a+(-3*e+3*i-2*n-r)*o+n*c+e}function Wo(c,t){const e=1-c;return e*e*t}function qo(c,t){return 2*(1-c)*c*t}function Xo(c,t){return c*c*t}function me(c,t,e,i){return Wo(c,t)+qo(c,e)+Xo(c,i)}function Jo(c,t){const e=1-c;return e*e*e*t}function Ho(c,t){const e=1-c;return 3*e*e*c*t}function Yo(c,t){return 3*(1-c)*c*c*t}function jo(c,t){return c*c*c*t}function fe(c,t,e,i,s){return Jo(c,t)+Ho(c,e)+Yo(c,i)+jo(c,s)}class Kn extends ft{constructor(t=new z,e=new z,i=new z,s=new z){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=t,this.v1=e,this.v2=i,this.v3=s}getPoint(t,e=new z){const i=e,s=this.v0,n=this.v1,r=this.v2,o=this.v3;return i.set(fe(t,s.x,n.x,r.x,o.x),fe(t,s.y,n.y,r.y,o.y)),i}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}}class tr extends ft{constructor(t=new f,e=new f,i=new f,s=new f){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=t,this.v1=e,this.v2=i,this.v3=s}getPoint(t,e=new f){const i=e,s=this.v0,n=this.v1,r=this.v2,o=this.v3;return i.set(fe(t,s.x,n.x,r.x,o.x),fe(t,s.y,n.y,r.y,o.y),fe(t,s.z,n.z,r.z,o.z)),i}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}}class er extends ft{constructor(t=new z,e=new z){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=t,this.v2=e}getPoint(t,e=new z){const i=e;return t===1?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(t).add(this.v1)),i}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e=new z){return e.subVectors(this.v2,this.v1).normalize()}getTangentAt(t,e){return this.getTangent(t,e)}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}class ir extends ft{constructor(t=new f,e=new f){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=t,this.v2=e}getPoint(t,e=new f){const i=e;return t===1?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(t).add(this.v1)),i}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e=new f){return e.subVectors(this.v2,this.v1).normalize()}getTangentAt(t,e){return this.getTangent(t,e)}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}class sr extends ft{constructor(t=new z,e=new z,i=new z){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=t,this.v1=e,this.v2=i}getPoint(t,e=new z){const i=e,s=this.v0,n=this.v1,r=this.v2;return i.set(me(t,s.x,n.x,r.x),me(t,s.y,n.y,r.y)),i}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}class is extends ft{constructor(t=new f,e=new f,i=new f){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=t,this.v1=e,this.v2=i}getPoint(t,e=new f){const i=e,s=this.v0,n=this.v1,r=this.v2;return i.set(me(t,s.x,n.x,r.x),me(t,s.y,n.y,r.y),me(t,s.z,n.z,r.z)),i}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}class nr extends ft{constructor(t=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=t}getPoint(t,e=new z){const i=e,s=this.points,n=(s.length-1)*t,r=Math.floor(n),o=n-r,a=s[r===0?r:r-1],h=s[r],l=s[r>s.length-2?s.length-1:r+1],u=s[r>s.length-3?s.length-1:r+2];return i.set(Fs(o,a.x,h.x,l.x,u.x),Fs(o,a.y,h.y,l.y,u.y)),i}copy(t){super.copy(t),this.points=[];for(let e=0,i=t.points.length;e<i;e++){const s=t.points[e];this.points.push(s.clone())}return this}toJSON(){const t=super.toJSON();t.points=[];for(let e=0,i=this.points.length;e<i;e++){const s=this.points[e];t.points.push(s.toArray())}return t}fromJSON(t){super.fromJSON(t),this.points=[];for(let e=0,i=t.points.length;e<i;e++){const s=t.points[e];this.points.push(new z().fromArray(s))}return this}}var Zo=Object.freeze({__proto__:null,ArcCurve:$n,CatmullRomCurve3:Qn,CubicBezierCurve:Kn,CubicBezierCurve3:tr,EllipseCurve:ts,LineCurve:er,LineCurve3:ir,QuadraticBezierCurve:sr,QuadraticBezierCurve3:is,SplineCurve:nr});class Qe extends mt{constructor(t=1,e=1,i=1,s=32,n=1,r=!1,o=0,a=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:t,radiusBottom:e,height:i,radialSegments:s,heightSegments:n,openEnded:r,thetaStart:o,thetaLength:a};const h=this;s=Math.floor(s),n=Math.floor(n);const l=[],u=[],p=[],d=[];let m=0;const y=[],x=i/2;let g=0;b(),r===!1&&(t>0&&w(!0),e>0&&w(!1)),this.setIndex(l),this.setAttribute("position",new V(u,3)),this.setAttribute("normal",new V(p,3)),this.setAttribute("uv",new V(d,2));function b(){const M=new f,S=new f;let v=0;const _=(e-t)/i;for(let A=0;A<=n;A++){const F=[],B=A/n,P=B*(e-t)+t;for(let R=0;R<=s;R++){const E=R/s,L=E*a+o,G=Math.sin(L),it=Math.cos(L);S.x=P*G,S.y=-B*i+x,S.z=P*it,u.push(S.x,S.y,S.z),M.set(G,_,it).normalize(),p.push(M.x,M.y,M.z),d.push(E,1-B),F.push(m++)}y.push(F)}for(let A=0;A<s;A++)for(let F=0;F<n;F++){const B=y[F][A],P=y[F+1][A],R=y[F+1][A+1],E=y[F][A+1];(t>0||F!==0)&&(l.push(B,P,E),v+=3),(e>0||F!==n-1)&&(l.push(P,R,E),v+=3)}h.addGroup(g,v,0),g+=v}function w(M){const S=m,v=new z,_=new f;let A=0;const F=M===!0?t:e,B=M===!0?1:-1;for(let R=1;R<=s;R++)u.push(0,x*B,0),p.push(0,B,0),d.push(.5,.5),m++;const P=m;for(let R=0;R<=s;R++){const L=R/s*a+o,G=Math.cos(L),it=Math.sin(L);_.x=F*it,_.y=x*B,_.z=F*G,u.push(_.x,_.y,_.z),p.push(0,B,0),v.x=G*.5+.5,v.y=it*.5*B+.5,d.push(v.x,v.y),m++}for(let R=0;R<s;R++){const E=S+R,L=P+R;M===!0?l.push(L,L+1,E):l.push(L+1,L,E),A+=3}h.addGroup(g,A,M===!0?1:2),g+=A}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new Qe(t.radiusTop,t.radiusBottom,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}}class ss extends Qe{constructor(t=1,e=1,i=32,s=1,n=!1,r=0,o=Math.PI*2){super(0,t,e,i,s,n,r,o),this.type="ConeGeometry",this.parameters={radius:t,height:e,radialSegments:i,heightSegments:s,openEnded:n,thetaStart:r,thetaLength:o}}static fromJSON(t){return new ss(t.radius,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}}class ns extends mt{constructor(t=1,e=1,i=1,s=1){super(),this.type="PlaneGeometry",this.parameters={width:t,height:e,widthSegments:i,heightSegments:s};const n=t/2,r=e/2,o=Math.floor(i),a=Math.floor(s),h=o+1,l=a+1,u=t/o,p=e/a,d=[],m=[],y=[],x=[];for(let g=0;g<l;g++){const b=g*p-r;for(let w=0;w<h;w++){const M=w*u-n;m.push(M,-b,0),y.push(0,0,1),x.push(w/o),x.push(1-g/a)}}for(let g=0;g<a;g++)for(let b=0;b<o;b++){const w=b+h*g,M=b+h*(g+1),S=b+1+h*(g+1),v=b+1+h*g;d.push(w,M,v),d.push(M,S,v)}this.setIndex(d),this.setAttribute("position",new V(m,3)),this.setAttribute("normal",new V(y,3)),this.setAttribute("uv",new V(x,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new ns(t.width,t.height,t.widthSegments,t.heightSegments)}}class rs extends mt{constructor(t=1,e=32,i=16,s=0,n=Math.PI*2,r=0,o=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:i,phiStart:s,phiLength:n,thetaStart:r,thetaLength:o},e=Math.max(3,Math.floor(e)),i=Math.max(2,Math.floor(i));const a=Math.min(r+o,Math.PI);let h=0;const l=[],u=new f,p=new f,d=[],m=[],y=[],x=[];for(let g=0;g<=i;g++){const b=[],w=g/i;let M=0;g===0&&r===0?M=.5/e:g===i&&a===Math.PI&&(M=-.5/e);for(let S=0;S<=e;S++){const v=S/e;u.x=-t*Math.cos(s+v*n)*Math.sin(r+w*o),u.y=t*Math.cos(r+w*o),u.z=t*Math.sin(s+v*n)*Math.sin(r+w*o),m.push(u.x,u.y,u.z),p.copy(u).normalize(),y.push(p.x,p.y,p.z),x.push(v+M,1-w),b.push(h++)}l.push(b)}for(let g=0;g<i;g++)for(let b=0;b<e;b++){const w=l[g][b+1],M=l[g][b],S=l[g+1][b],v=l[g+1][b+1];(g!==0||r>0)&&d.push(w,M,v),(g!==i-1||a<Math.PI)&&d.push(M,S,v)}this.setIndex(d),this.setAttribute("position",new V(m,3)),this.setAttribute("normal",new V(y,3)),this.setAttribute("uv",new V(x,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new rs(t.radius,t.widthSegments,t.heightSegments,t.phiStart,t.phiLength,t.thetaStart,t.thetaLength)}}class as extends mt{constructor(t=new is(new f(-1,-1,0),new f(-1,1,0),new f(1,1,0)),e=64,i=1,s=8,n=!1){super(),this.type="TubeGeometry",this.parameters={path:t,tubularSegments:e,radius:i,radialSegments:s,closed:n};const r=t.computeFrenetFrames(e,n);this.tangents=r.tangents,this.normals=r.normals,this.binormals=r.binormals;const o=new f,a=new f,h=new z;let l=new f;const u=[],p=[],d=[],m=[];y(),this.setIndex(m),this.setAttribute("position",new V(u,3)),this.setAttribute("normal",new V(p,3)),this.setAttribute("uv",new V(d,2));function y(){for(let w=0;w<e;w++)x(w);x(n===!1?e:0),b(),g()}function x(w){l=t.getPointAt(w/e,l);const M=r.normals[w],S=r.binormals[w];for(let v=0;v<=s;v++){const _=v/s*Math.PI*2,A=Math.sin(_),F=-Math.cos(_);a.x=F*M.x+A*S.x,a.y=F*M.y+A*S.y,a.z=F*M.z+A*S.z,a.normalize(),p.push(a.x,a.y,a.z),o.x=l.x+i*a.x,o.y=l.y+i*a.y,o.z=l.z+i*a.z,u.push(o.x,o.y,o.z)}}function g(){for(let w=1;w<=e;w++)for(let M=1;M<=s;M++){const S=(s+1)*(w-1)+(M-1),v=(s+1)*w+(M-1),_=(s+1)*w+M,A=(s+1)*(w-1)+M;m.push(S,v,A),m.push(v,_,A)}}function b(){for(let w=0;w<=e;w++)for(let M=0;M<=s;M++)h.x=w/e,h.y=M/s,d.push(h.x,h.y)}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}toJSON(){const t=super.toJSON();return t.path=this.parameters.path.toJSON(),t}static fromJSON(t){return new as(new Zo[t.path.type]().fromJSON(t.path),t.tubularSegments,t.radius,t.radialSegments,t.closed)}}class $o extends Z{constructor(t){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new I(0),this.transparent=!0,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.fog=t.fog,this}}class rr extends Z{constructor(t){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new I(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 I(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ut,this.normalScale=new z(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new ct,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.defines={STANDARD:""},this.color.copy(t.color),this.roughness=t.roughness,this.metalness=t.metalness,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.roughnessMap=t.roughnessMap,this.metalnessMap=t.metalnessMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.envMapIntensity=t.envMapIntensity,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this.fog=t.fog,this}}class Qo extends rr{constructor(t){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 z(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return T(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(e){this.ior=(1+.4*e)/(1-.4*e)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new I(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 I(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new I(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(t)}get anisotropy(){return this._anisotropy}set anisotropy(t){this._anisotropy>0!=t>0&&this.version++,this._anisotropy=t}get clearcoat(){return this._clearcoat}set clearcoat(t){this._clearcoat>0!=t>0&&this.version++,this._clearcoat=t}get iridescence(){return this._iridescence}set iridescence(t){this._iridescence>0!=t>0&&this.version++,this._iridescence=t}get dispersion(){return this._dispersion}set dispersion(t){this._dispersion>0!=t>0&&this.version++,this._dispersion=t}get sheen(){return this._sheen}set sheen(t){this._sheen>0!=t>0&&this.version++,this._sheen=t}get transmission(){return this._transmission}set transmission(t){this._transmission>0!=t>0&&this.version++,this._transmission=t}copy(t){return super.copy(t),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=t.anisotropy,this.anisotropyRotation=t.anisotropyRotation,this.anisotropyMap=t.anisotropyMap,this.clearcoat=t.clearcoat,this.clearcoatMap=t.clearcoatMap,this.clearcoatRoughness=t.clearcoatRoughness,this.clearcoatRoughnessMap=t.clearcoatRoughnessMap,this.clearcoatNormalMap=t.clearcoatNormalMap,this.clearcoatNormalScale.copy(t.clearcoatNormalScale),this.dispersion=t.dispersion,this.ior=t.ior,this.iridescence=t.iridescence,this.iridescenceMap=t.iridescenceMap,this.iridescenceIOR=t.iridescenceIOR,this.iridescenceThicknessRange=[...t.iridescenceThicknessRange],this.iridescenceThicknessMap=t.iridescenceThicknessMap,this.sheen=t.sheen,this.sheenColor.copy(t.sheenColor),this.sheenColorMap=t.sheenColorMap,this.sheenRoughness=t.sheenRoughness,this.sheenRoughnessMap=t.sheenRoughnessMap,this.transmission=t.transmission,this.transmissionMap=t.transmissionMap,this.thickness=t.thickness,this.thicknessMap=t.thicknessMap,this.attenuationDistance=t.attenuationDistance,this.attenuationColor.copy(t.attenuationColor),this.specularIntensity=t.specularIntensity,this.specularIntensityMap=t.specularIntensityMap,this.specularColor.copy(t.specularColor),this.specularColorMap=t.specularColorMap,this}}class Ko extends Z{constructor(t){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new I(16777215),this.specular=new I(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new I(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ut,this.normalScale=new z(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new ct,this.combine=je,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(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.specular.copy(t.specular),this.shininess=t.shininess,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this.fog=t.fog,this}}class th extends Z{constructor(t){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new I(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new I(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ut,this.normalScale=new z(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(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.gradientMap=t.gradientMap,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.fog=t.fog,this}}class eh extends Z{constructor(t){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ut,this.normalScale=new z(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(t)}copy(t){return super.copy(t),this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.flatShading=t.flatShading,this}}class ih extends Z{constructor(t){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new I(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new I(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ut,this.normalScale=new z(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new ct,this.combine=je,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(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this.fog=t.fog,this}}class sh extends Z{constructor(t){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=Ln,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(t)}copy(t){return super.copy(t),this.depthPacking=t.depthPacking,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this}}class nh extends Z{constructor(t){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(t)}copy(t){return super.copy(t),this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this}}class rh extends Z{constructor(t){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new I(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ut,this.normalScale=new z(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.defines={MATCAP:""},this.color.copy(t.color),this.matcap=t.matcap,this.map=t.map,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.flatShading=t.flatShading,this.fog=t.fog,this}}class ah extends Ki{constructor(t){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(t)}copy(t){return super.copy(t),this.scale=t.scale,this.dashSize=t.dashSize,this.gapSize=t.gapSize,this}}const ki={enabled:!1,files:{},add:function(c,t){this.enabled!==!1&&(this.files[c]=t)},get:function(c){if(this.enabled!==!1)return this.files[c]},remove:function(c){delete this.files[c]},clear:function(){this.files={}}};class ar{constructor(t,e,i){const s=this;let n=!1,r=0,o=0,a;const h=[];this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=i,this.itemStart=function(l){o++,n===!1&&s.onStart!==void 0&&s.onStart(l,r,o),n=!0},this.itemEnd=function(l){r++,s.onProgress!==void 0&&s.onProgress(l,r,o),r===o&&(n=!1,s.onLoad!==void 0&&s.onLoad())},this.itemError=function(l){s.onError!==void 0&&s.onError(l)},this.resolveURL=function(l){return a?a(l):l},this.setURLModifier=function(l){return a=l,this},this.addHandler=function(l,u){return h.push(l,u),this},this.removeHandler=function(l){const u=h.indexOf(l);return u!==-1&&h.splice(u,2),this},this.getHandler=function(l){for(let u=0,p=h.length;u<p;u+=2){const d=h[u],m=h[u+1];if(d.global&&(d.lastIndex=0),d.test(l))return m}return null}}}const or=new ar;class Ke{constructor(t){this.manager=t!==void 0?t:or,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(t,e){const i=this;return new Promise(function(s,n){i.load(t,s,e,n)})}parse(){}setCrossOrigin(t){return this.crossOrigin=t,this}setWithCredentials(t){return this.withCredentials=t,this}setPath(t){return this.path=t,this}setResourcePath(t){return this.resourcePath=t,this}setRequestHeader(t){return this.requestHeader=t,this}}Ke.DEFAULT_MATERIAL_NAME="__DEFAULT";class hr extends Ke{constructor(t){super(t)}load(t,e,i,s){this.path!==void 0&&(t=this.path+t),t=this.manager.resolveURL(t);const n=this,r=ki.get(t);if(r!==void 0)return n.manager.itemStart(t),setTimeout(function(){e&&e(r),n.manager.itemEnd(t)},0),r;const o=ge("img");function a(){l(),ki.add(t,this),e&&e(this),n.manager.itemEnd(t)}function h(u){l(),s&&s(u),n.manager.itemError(t),n.manager.itemEnd(t)}function l(){o.removeEventListener("load",a,!1),o.removeEventListener("error",h,!1)}return o.addEventListener("load",a,!1),o.addEventListener("error",h,!1),t.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(o.crossOrigin=this.crossOrigin),n.manager.itemStart(t),o.src=t,o}}class oh extends Ke{constructor(t){super(t)}load(t,e,i,s){const n=new J,r=new hr(this.manager);return r.setCrossOrigin(this.crossOrigin),r.setPath(this.path),r.load(t,function(o){n.image=o,n.needsUpdate=!0,e!==void 0&&e(n)},i,s),n}}class Et extends k{constructor(t,e=1){super(),this.isLight=!0,this.type="Light",this.color=new I(t),this.intensity=e}dispose(){}copy(t,e){return super.copy(t,e),this.color.copy(t.color),this.intensity=t.intensity,this}toJSON(t){const e=super.toJSON(t);return e.object.color=this.color.getHex(),e.object.intensity=this.intensity,this.groundColor!==void 0&&(e.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(e.object.distance=this.distance),this.angle!==void 0&&(e.object.angle=this.angle),this.decay!==void 0&&(e.object.decay=this.decay),this.penumbra!==void 0&&(e.object.penumbra=this.penumbra),this.shadow!==void 0&&(e.object.shadow=this.shadow.toJSON()),this.target!==void 0&&(e.object.target=this.target.uuid),e}}class hh extends Et{constructor(t,e,i){super(t,i),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(k.DEFAULT_UP),this.updateMatrix(),this.groundColor=new I(e)}copy(t,e){return super.copy(t,e),this.groundColor.copy(t.groundColor),this}}const _i=new D,Bs=new f,Rs=new f;class os{constructor(t){this.camera=t,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new z(512,512),this.map=null,this.mapPass=null,this.matrix=new D,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Zn,this._frameExtents=new z(1,1),this._viewportCount=1,this._viewports=[new Y(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(t){const e=this.camera,i=this.matrix;Bs.setFromMatrixPosition(t.matrixWorld),e.position.copy(Bs),Rs.setFromMatrixPosition(t.target.matrixWorld),e.lookAt(Rs),e.updateMatrixWorld(),_i.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),this._frustum.setFromProjectionMatrix(_i),i.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),i.multiply(_i)}getViewport(t){return this._viewports[t]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(t){return this.camera=t.camera.clone(),this.intensity=t.intensity,this.bias=t.bias,this.radius=t.radius,this.mapSize.copy(t.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){const t={};return this.intensity!==1&&(t.intensity=this.intensity),this.bias!==0&&(t.bias=this.bias),this.normalBias!==0&&(t.normalBias=this.normalBias),this.radius!==1&&(t.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(t.mapSize=this.mapSize.toArray()),t.camera=this.camera.toJSON(!1).object,delete t.camera.matrix,t}}class lh extends os{constructor(){super(new ut(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(t){const e=this.camera,i=se*2*t.angle*this.focus,s=this.mapSize.width/this.mapSize.height,n=t.distance||e.far;(i!==e.fov||s!==e.aspect||n!==e.far)&&(e.fov=i,e.aspect=s,e.far=n,e.updateProjectionMatrix()),super.updateMatrices(t)}copy(t){return super.copy(t),this.focus=t.focus,this}}class ch extends Et{constructor(t,e,i=0,s=Math.PI/3,n=0,r=2){super(t,e),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(k.DEFAULT_UP),this.updateMatrix(),this.target=new k,this.distance=i,this.angle=s,this.penumbra=n,this.decay=r,this.map=null,this.shadow=new lh}get power(){return this.intensity*Math.PI}set power(t){this.intensity=t/Math.PI}dispose(){this.shadow.dispose()}copy(t,e){return super.copy(t,e),this.distance=t.distance,this.angle=t.angle,this.penumbra=t.penumbra,this.decay=t.decay,this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}const Es=new D,ue=new f,vi=new f;class uh extends os{constructor(){super(new ut(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new z(4,2),this._viewportCount=6,this._viewports=[new Y(2,1,1,1),new Y(0,1,1,1),new Y(3,1,1,1),new Y(1,1,1,1),new Y(3,0,1,1),new Y(1,0,1,1)],this._cubeDirections=[new f(1,0,0),new f(-1,0,0),new f(0,0,1),new f(0,0,-1),new f(0,1,0),new f(0,-1,0)],this._cubeUps=[new f(0,1,0),new f(0,1,0),new f(0,1,0),new f(0,1,0),new f(0,0,1),new f(0,0,-1)]}updateMatrices(t,e=0){const i=this.camera,s=this.matrix,n=t.distance||i.far;n!==i.far&&(i.far=n,i.updateProjectionMatrix()),ue.setFromMatrixPosition(t.matrixWorld),i.position.copy(ue),vi.copy(i.position),vi.add(this._cubeDirections[e]),i.up.copy(this._cubeUps[e]),i.lookAt(vi),i.updateMatrixWorld(),s.makeTranslation(-ue.x,-ue.y,-ue.z),Es.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Es)}}class ph extends Et{constructor(t,e,i=0,s=2){super(t,e),this.isPointLight=!0,this.type="PointLight",this.distance=i,this.decay=s,this.shadow=new uh}get power(){return this.intensity*4*Math.PI}set power(t){this.intensity=t/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(t,e){return super.copy(t,e),this.distance=t.distance,this.decay=t.decay,this.shadow=t.shadow.clone(),this}}class lr extends $i{constructor(t=-1,e=1,i=1,s=-1,n=.1,r=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=t,this.right=e,this.top=i,this.bottom=s,this.near=n,this.far=r,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.near=t.near,this.far=t.far,this.zoom=t.zoom,this.view=t.view===null?null:Object.assign({},t.view),this}setViewOffset(t,e,i,s,n,r){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=t,this.view.fullHeight=e,this.view.offsetX=i,this.view.offsetY=s,this.view.width=n,this.view.height=r,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const t=(this.right-this.left)/(2*this.zoom),e=(this.top-this.bottom)/(2*this.zoom),i=(this.right+this.left)/2,s=(this.top+this.bottom)/2;let n=i-t,r=i+t,o=s+e,a=s-e;if(this.view!==null&&this.view.enabled){const h=(this.right-this.left)/this.view.fullWidth/this.zoom,l=(this.top-this.bottom)/this.view.fullHeight/this.zoom;n+=h*this.view.offsetX,r=n+h*this.view.width,o-=l*this.view.offsetY,a=o-l*this.view.height}this.projectionMatrix.makeOrthographic(n,r,o,a,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const e=super.toJSON(t);return e.object.zoom=this.zoom,e.object.left=this.left,e.object.right=this.right,e.object.top=this.top,e.object.bottom=this.bottom,e.object.near=this.near,e.object.far=this.far,this.view!==null&&(e.object.view=Object.assign({},this.view)),e}}class dh extends os{constructor(){super(new lr(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class mh extends Et{constructor(t,e){super(t,e),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(k.DEFAULT_UP),this.updateMatrix(),this.target=new k,this.shadow=new dh}dispose(){this.shadow.dispose()}copy(t){return super.copy(t),this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}class fh extends Et{constructor(t,e){super(t,e),this.isAmbientLight=!0,this.type="AmbientLight"}}class yh extends Et{constructor(t,e,i=10,s=10){super(t,e),this.isRectAreaLight=!0,this.type="RectAreaLight",this.width=i,this.height=s}get power(){return this.intensity*this.width*this.height*Math.PI}set power(t){this.intensity=t/(this.width*this.height*Math.PI)}copy(t){return super.copy(t),this.width=t.width,this.height=t.height,this}toJSON(t){const e=super.toJSON(t);return e.object.width=this.width,e.object.height=this.height,e}}class cr{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let t=0;t<9;t++)this.coefficients.push(new f)}set(t){for(let e=0;e<9;e++)this.coefficients[e].copy(t[e]);return this}zero(){for(let t=0;t<9;t++)this.coefficients[t].set(0,0,0);return this}getAt(t,e){const i=t.x,s=t.y,n=t.z,r=this.coefficients;return e.copy(r[0]).multiplyScalar(.282095),e.addScaledVector(r[1],.488603*s),e.addScaledVector(r[2],.488603*n),e.addScaledVector(r[3],.488603*i),e.addScaledVector(r[4],1.092548*(i*s)),e.addScaledVector(r[5],1.092548*(s*n)),e.addScaledVector(r[6],.315392*(3*n*n-1)),e.addScaledVector(r[7],1.092548*(i*n)),e.addScaledVector(r[8],.546274*(i*i-s*s)),e}getIrradianceAt(t,e){const i=t.x,s=t.y,n=t.z,r=this.coefficients;return e.copy(r[0]).multiplyScalar(.886227),e.addScaledVector(r[1],2*.511664*s),e.addScaledVector(r[2],2*.511664*n),e.addScaledVector(r[3],2*.511664*i),e.addScaledVector(r[4],2*.429043*i*s),e.addScaledVector(r[5],2*.429043*s*n),e.addScaledVector(r[6],.743125*n*n-.247708),e.addScaledVector(r[7],2*.429043*i*n),e.addScaledVector(r[8],.429043*(i*i-s*s)),e}add(t){for(let e=0;e<9;e++)this.coefficients[e].add(t.coefficients[e]);return this}addScaledSH(t,e){for(let i=0;i<9;i++)this.coefficients[i].addScaledVector(t.coefficients[i],e);return this}scale(t){for(let e=0;e<9;e++)this.coefficients[e].multiplyScalar(t);return this}lerp(t,e){for(let i=0;i<9;i++)this.coefficients[i].lerp(t.coefficients[i],e);return this}equals(t){for(let e=0;e<9;e++)if(!this.coefficients[e].equals(t.coefficients[e]))return!1;return!0}copy(t){return this.set(t.coefficients)}clone(){return new this.constructor().copy(this)}fromArray(t,e=0){const i=this.coefficients;for(let s=0;s<9;s++)i[s].fromArray(t,e+s*3);return this}toArray(t=[],e=0){const i=this.coefficients;for(let s=0;s<9;s++)i[s].toArray(t,e+s*3);return t}static getBasisAt(t,e){const i=t.x,s=t.y,n=t.z;e[0]=.282095,e[1]=.488603*s,e[2]=.488603*n,e[3]=.488603*i,e[4]=1.092548*i*s,e[5]=1.092548*s*n,e[6]=.315392*(3*n*n-1),e[7]=1.092548*i*n,e[8]=.546274*(i*i-s*s)}}class xh extends Et{constructor(t=new cr,e=1){super(void 0,e),this.isLightProbe=!0,this.sh=t}copy(t){return super.copy(t),this.sh.copy(t.sh),this}fromJSON(t){return this.intensity=t.intensity,this.sh.fromArray(t.sh),this}toJSON(t){const e=super.toJSON(t);return e.object.sh=this.sh.toArray(),e}}class gh extends ut{constructor(t=[]){super(),this.isArrayCamera=!0,this.cameras=t}}class Mh{constructor(t=!0){this.autoStart=t,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=Ps(),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 t=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const e=Ps();t=(e-this.oldTime)/1e3,this.oldTime=e,this.elapsedTime+=t}return t}}function Ps(){return performance.now()}class wh extends jn{constructor(t,e,i=1){super(t,e),this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=i}copy(t){return super.copy(t),this.meshPerAttribute=t.meshPerAttribute,this}clone(t){const e=super.clone(t);return e.meshPerAttribute=this.meshPerAttribute,e}toJSON(t){const e=super.toJSON(t);return e.isInstancedInterleavedBuffer=!0,e.meshPerAttribute=this.meshPerAttribute,e}}const Is=new D;class bh{constructor(t,e,i=0,s=1/0){this.ray=new Ze(t,e),this.near=i,this.far=s,this.camera=null,this.layers=new Zi,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(t,e){this.ray.set(t,e)}setFromCamera(t,e){e.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(t.x,t.y,.5).unproject(e).sub(this.ray.origin).normalize(),this.camera=e):e.isOrthographicCamera?(this.ray.origin.set(t.x,t.y,(e.near+e.far)/(e.near-e.far)).unproject(e),this.ray.direction.set(0,0,-1).transformDirection(e.matrixWorld),this.camera=e):console.error("THREE.Raycaster: Unsupported camera type: "+e.type)}setFromXRController(t){return Is.identity().extractRotation(t.matrixWorld),this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(Is),this}intersectObject(t,e=!0,i=[]){return Oi(t,this,i,e),i.sort(Ls),i}intersectObjects(t,e=!0,i=[]){for(let s=0,n=t.length;s<n;s++)Oi(t[s],this,i,e);return i.sort(Ls),i}}function Ls(c,t){return c.distance-t.distance}function Oi(c,t,e,i){let s=!0;if(c.layers.test(t.layers)&&c.raycast(t,e)===!1&&(s=!1),s===!0&&i===!0){const n=c.children;for(let r=0,o=n.length;r<o;r++)Oi(n[r],t,e,!0)}}class Sh{constructor(t=1,e=0,i=0){return this.radius=t,this.phi=e,this.theta=i,this}set(t,e,i){return this.radius=t,this.phi=e,this.theta=i,this}copy(t){return this.radius=t.radius,this.phi=t.phi,this.theta=t.theta,this}makeSafe(){return this.phi=T(this.phi,1e-6,Math.PI-1e-6),this}setFromVector3(t){return this.setFromCartesianCoords(t.x,t.y,t.z)}setFromCartesianCoords(t,e,i){return this.radius=Math.sqrt(t*t+e*e+i*i),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(t,i),this.phi=Math.acos(T(e/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}class Ah extends Gt{constructor(t,e=null){super(),this.object=t,this.domElement=e,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(){}disconnect(){}dispose(){}update(){}}function _h(c,t,e,i){const s=vh(i);switch(e){case Hs:return c*t;case js:return c*t;case Zs:return c*t*2;case $s:return c*t/s.components*s.byteLength;case Qs:return c*t/s.components*s.byteLength;case Ks:return c*t*2/s.components*s.byteLength;case tn:return c*t*2/s.components*s.byteLength;case Ys:return c*t*3/s.components*s.byteLength;case Ji:return c*t*4/s.components*s.byteLength;case en:return c*t*4/s.components*s.byteLength;case sn:case nn:return Math.floor((c+3)/4)*Math.floor((t+3)/4)*8;case rn:case an:return Math.floor((c+3)/4)*Math.floor((t+3)/4)*16;case hn:case cn:return Math.max(c,16)*Math.max(t,8)/4;case on:case ln:return Math.max(c,8)*Math.max(t,8)/2;case un:case pn:return Math.floor((c+3)/4)*Math.floor((t+3)/4)*8;case dn:return Math.floor((c+3)/4)*Math.floor((t+3)/4)*16;case mn:return Math.floor((c+3)/4)*Math.floor((t+3)/4)*16;case fn:return Math.floor((c+4)/5)*Math.floor((t+3)/4)*16;case yn:return Math.floor((c+4)/5)*Math.floor((t+4)/5)*16;case xn:return Math.floor((c+5)/6)*Math.floor((t+4)/5)*16;case gn:return Math.floor((c+5)/6)*Math.floor((t+5)/6)*16;case Mn:return Math.floor((c+7)/8)*Math.floor((t+4)/5)*16;case wn:return Math.floor((c+7)/8)*Math.floor((t+5)/6)*16;case bn:return Math.floor((c+7)/8)*Math.floor((t+7)/8)*16;case Sn:return Math.floor((c+9)/10)*Math.floor((t+4)/5)*16;case An:return Math.floor((c+9)/10)*Math.floor((t+5)/6)*16;case _n:return Math.floor((c+9)/10)*Math.floor((t+7)/8)*16;case vn:return Math.floor((c+9)/10)*Math.floor((t+9)/10)*16;case zn:return Math.floor((c+11)/12)*Math.floor((t+9)/10)*16;case Cn:return Math.floor((c+11)/12)*Math.floor((t+11)/12)*16;case Tn:case Fn:case Bn:return Math.ceil(c/4)*Math.ceil(t/4)*16;case Rn:case En:return Math.ceil(c/4)*Math.ceil(t/4)*8;case Pn:case In:return Math.ceil(c/4)*Math.ceil(t/4)*16}throw new Error(`Unable to determine texture byte length for ${e} format.`)}function vh(c){switch(c){case Wi:case Os:return{byteLength:1,components:1};case Vs:case Ns:case Gs:return{byteLength:2,components:1};case Ws:case qs:return{byteLength:2,components:4};case qi:case Us:case Xi:return{byteLength:4,components:1};case Js:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${c}.`)}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Ni}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Ni);exports.ACESFilmicToneMapping=ia;exports.AddEquation=Ci;exports.AddOperation=$r;exports.AdditiveBlending=Sr;exports.AgXToneMapping=na;exports.AlphaFormat=Hs;exports.AlwaysCompare=ka;exports.AlwaysDepth=qr;exports.AlwaysStencilFunc=Di;exports.AmbientLight=fh;exports.ArcCurve=$n;exports.ArrayCamera=gh;exports.BackSide=Vi;exports.BasicDepthPacking=Ln;exports.BasicShadowMap=xr;exports.Box3=re;exports.BoxGeometry=$e;exports.BufferAttribute=pt;exports.BufferGeometry=mt;exports.ByteType=Os;exports.Cache=ki;exports.Camera=$i;exports.CatmullRomCurve3=Qn;exports.CineonToneMapping=ea;exports.ClampToEdgeWrapping=Vt;exports.Clock=Mh;exports.Color=I;exports.ColorManagement=et;exports.ConeGeometry=ss;exports.ConstantAlphaFactor=Ur;exports.ConstantColorFactor=Nr;exports.Controls=Ah;exports.CubeCamera=Hn;exports.CubeReflectionMapping=ks;exports.CubeRefractionMapping=aa;exports.CubeTexture=Yn;exports.CubeUVReflectionMapping=la;exports.CubicBezierCurve=Kn;exports.CubicBezierCurve3=tr;exports.CullFaceBack=fr;exports.CullFaceFront=yr;exports.CullFaceNone=mr;exports.Curve=ft;exports.CustomBlending=vr;exports.CustomToneMapping=sa;exports.CylinderGeometry=Qe;exports.Data3DTexture=po;exports.DataArrayTexture=uo;exports.DataTexture=Io;exports.DecrementStencilOp=Ma;exports.DecrementWrapStencilOp=ba;exports.DefaultLoadingManager=or;exports.DepthFormat=We;exports.DepthStencilFormat=Pi;exports.DepthTexture=Go;exports.DirectionalLight=mh;exports.DoubleSide=br;exports.DstAlphaFactor=Ir;exports.DstColorFactor=Dr;exports.DynamicDrawUsage=Oa;exports.EllipseCurve=ts;exports.EqualCompare=Ea;exports.EqualDepth=Jr;exports.EqualStencilFunc=va;exports.EquirectangularReflectionMapping=oa;exports.EquirectangularRefractionMapping=ha;exports.Euler=ct;exports.EventDispatcher=Gt;exports.Float16BufferAttribute=Ao;exports.Float32BufferAttribute=V;exports.FloatType=Xi;exports.FramebufferTexture=Uo;exports.FrontSide=Xe;exports.Frustum=Zn;exports.GLSL3=Na;exports.GreaterCompare=Ia;exports.GreaterDepth=Yr;exports.GreaterEqualCompare=Da;exports.GreaterEqualDepth=Hr;exports.GreaterEqualStencilFunc=Fa;exports.GreaterStencilFunc=Ca;exports.Group=Vo;exports.HalfFloatType=Gs;exports.HemisphereLight=hh;exports.ImageLoader=hr;exports.ImageUtils=kn;exports.IncrementStencilOp=ga;exports.IncrementWrapStencilOp=wa;exports.InstancedBufferAttribute=Lo;exports.InstancedInterleavedBuffer=wh;exports.IntType=Us;exports.InterleavedBuffer=jn;exports.InterleavedBufferAttribute=Qi;exports.InvertStencilOp=Sa;exports.KeepStencilOp=Ot;exports.Layers=Zi;exports.LessCompare=Ra;exports.LessDepth=Xr;exports.LessEqualCompare=Pa;exports.LessEqualDepth=Bi;exports.LessEqualStencilFunc=za;exports.LessStencilFunc=_a;exports.Light=Et;exports.LightProbe=xh;exports.Line=Oo;exports.LineBasicMaterial=Ki;exports.LineCurve=er;exports.LineCurve3=ir;exports.LineDashedMaterial=ah;exports.LinearFilter=ye;exports.LinearMipmapLinearFilter=Gi;exports.LinearMipmapNearestFilter=pa;exports.LinearSRGBColorSpace=Ii;exports.LinearToneMapping=Kr;exports.LinearTransfer=Li;exports.Loader=Ke;exports.LoadingManager=ar;exports.LuminanceAlphaFormat=Zs;exports.LuminanceFormat=js;exports.MOUSE=pr;exports.Material=Z;exports.MathUtils=io;exports.Matrix3=dt;exports.Matrix4=D;exports.MaxEquation=Fr;exports.Mesh=qn;exports.MeshBasicMaterial=Un;exports.MeshDepthMaterial=sh;exports.MeshDistanceMaterial=nh;exports.MeshLambertMaterial=ih;exports.MeshMatcapMaterial=rh;exports.MeshNormalMaterial=eh;exports.MeshPhongMaterial=Ko;exports.MeshPhysicalMaterial=Qo;exports.MeshStandardMaterial=rr;exports.MeshToonMaterial=th;exports.MinEquation=Tr;exports.MirroredRepeatWrapping=Ei;exports.MixOperation=Zr;exports.MultiplyBlending=_r;exports.MultiplyOperation=je;exports.NearestFilter=lt;exports.NearestMipmapLinearFilter=ua;exports.NearestMipmapNearestFilter=ca;exports.NeutralToneMapping=ra;exports.NeverCompare=Ba;exports.NeverDepth=Wr;exports.NeverStencilFunc=Aa;exports.NoBlending=Ds;exports.NoColorSpace=Hi;exports.NoToneMapping=Qr;exports.NormalBlending=zi;exports.NotEqualCompare=La;exports.NotEqualDepth=jr;exports.NotEqualStencilFunc=Ta;exports.Object3D=k;exports.ObjectSpaceNormalMap=fa;exports.OneFactor=Rr;exports.OneMinusConstantAlphaFactor=Gr;exports.OneMinusConstantColorFactor=Vr;exports.OneMinusDstAlphaFactor=Lr;exports.OneMinusDstColorFactor=kr;exports.OneMinusSrcAlphaFactor=Fi;exports.OneMinusSrcColorFactor=Pr;exports.OrthographicCamera=lr;exports.PCFShadowMap=gr;exports.PCFSoftShadowMap=Mr;exports.PerspectiveCamera=ut;exports.Plane=Nt;exports.PlaneGeometry=ns;exports.PointLight=ph;exports.PointsMaterial=No;exports.QuadraticBezierCurve=sr;exports.QuadraticBezierCurve3=is;exports.Quaternion=ne;exports.RAD2DEG=se;exports.RED_GREEN_RGTC2_Format=Pn;exports.RED_RGTC1_Format=Rn;exports.REVISION=Ni;exports.RGBADepthPacking=ma;exports.RGBAFormat=Ji;exports.RGBAIntegerFormat=en;exports.RGBA_ASTC_10x10_Format=vn;exports.RGBA_ASTC_10x5_Format=Sn;exports.RGBA_ASTC_10x6_Format=An;exports.RGBA_ASTC_10x8_Format=_n;exports.RGBA_ASTC_12x10_Format=zn;exports.RGBA_ASTC_12x12_Format=Cn;exports.RGBA_ASTC_4x4_Format=mn;exports.RGBA_ASTC_5x4_Format=fn;exports.RGBA_ASTC_5x5_Format=yn;exports.RGBA_ASTC_6x5_Format=xn;exports.RGBA_ASTC_6x6_Format=gn;exports.RGBA_ASTC_8x5_Format=Mn;exports.RGBA_ASTC_8x6_Format=wn;exports.RGBA_ASTC_8x8_Format=bn;exports.RGBA_BPTC_Format=Tn;exports.RGBA_ETC2_EAC_Format=dn;exports.RGBA_PVRTC_2BPPV1_Format=cn;exports.RGBA_PVRTC_4BPPV1_Format=ln;exports.RGBA_S3TC_DXT1_Format=nn;exports.RGBA_S3TC_DXT3_Format=rn;exports.RGBA_S3TC_DXT5_Format=an;exports.RGBFormat=Ys;exports.RGBIntegerFormat=da;exports.RGB_BPTC_SIGNED_Format=Fn;exports.RGB_BPTC_UNSIGNED_Format=Bn;exports.RGB_ETC1_Format=un;exports.RGB_ETC2_Format=pn;exports.RGB_PVRTC_2BPPV1_Format=hn;exports.RGB_PVRTC_4BPPV1_Format=on;exports.RGB_S3TC_DXT1_Format=sn;exports.RGFormat=Ks;exports.RGIntegerFormat=tn;exports.Ray=Ze;exports.Raycaster=bh;exports.RectAreaLight=yh;exports.RedFormat=$s;exports.RedIntegerFormat=Qs;exports.ReinhardToneMapping=ta;exports.RenderTarget=On;exports.RepeatWrapping=Ri;exports.ReplaceStencilOp=xa;exports.ReverseSubtractEquation=Cr;exports.SIGNED_RED_GREEN_RGTC2_Format=In;exports.SIGNED_RED_RGTC1_Format=En;exports.SRGBColorSpace=nt;exports.SRGBTransfer=qe;exports.Scene=Eo;exports.ShaderMaterial=Jn;exports.ShadowMaterial=$o;exports.ShortType=Ns;exports.Source=ji;exports.Sphere=Me;exports.SphereGeometry=rs;exports.Spherical=Sh;exports.SphericalHarmonics3=cr;exports.SplineCurve=nr;exports.SpotLight=ch;exports.SpriteMaterial=Po;exports.SrcAlphaFactor=Ti;exports.SrcAlphaSaturateFactor=Or;exports.SrcColorFactor=Er;exports.StaticDrawUsage=Je;exports.SubtractEquation=zr;exports.SubtractiveBlending=Ar;exports.TOUCH=dr;exports.TangentSpaceNormalMap=Ut;exports.Texture=J;exports.TextureLoader=oh;exports.Triangle=rt;exports.TubeGeometry=as;exports.UVMapping=Ui;exports.Uint16BufferAttribute=Gn;exports.Uint32BufferAttribute=Wn;exports.UniformsUtils=To;exports.UnsignedByteType=Wi;exports.UnsignedInt248Type=Xs;exports.UnsignedInt5999Type=Js;exports.UnsignedIntType=qi;exports.UnsignedShort4444Type=Ws;exports.UnsignedShort5551Type=qs;exports.UnsignedShortType=Vs;exports.VSMShadowMap=wr;exports.Vector2=z;exports.Vector3=f;exports.Vector4=Y;exports.WebGLCoordinateSystem=St;exports.WebGLCubeRenderTarget=Ro;exports.WebGLRenderTarget=Nn;exports.WebGPUCoordinateSystem=xe;exports.ZeroFactor=Br;exports.ZeroStencilOp=ya;exports.arrayNeedsUint32=Dn;exports.cloneUniforms=we;exports.createCanvasElement=so;exports.createElementNS=ge;exports.getByteLength=_h;exports.getUnlitUniformColorSpace=Co;exports.mergeUniforms=Xn;exports.probeAsync=ro;exports.toNormalizedProjectionMatrix=ao;exports.toReversedProjectionMatrix=oo;exports.warnOnce=no;
|